From: Andrea Amorese Date: Tue, 15 Feb 2022 11:02:40 +0000 (+0100) Subject: Built motion from commit f91e4f70.|2.5.50 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22angular-material.layout.css/%22?a=commitdiff_plain;h=93b6079f784816156aebcdbcb35e074467d7a5dc;p=motion2.git Built motion from commit f91e4f70.|2.5.50 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9c03289..bb28656 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-02-15T10:08:07.323Z", + "time": "2022-02-15T10:49:29.076Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 97c24e9..b6e533b 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-15T10:08:07.323Z", + "time": "2022-02-15T10:49:29.076Z", "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 bfcecb5..eb73f3c 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 _0x6e82=['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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','jscripty','urlForward','bot'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x6e82,0x13a));var _0x26e8=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x6e82[_0x1057a3];return _0x131cdb;};'use strict';var Sequelize=require(_0x26e8('0x0'));module[_0x26e8('0x1')]={'name':{'type':Sequelize[_0x26e8('0x2')],'get':function(_0x47a99a){return this[_0x26e8('0x3')]('action');}},'action':{'type':Sequelize[_0x26e8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x26e8('0x5'),'integration',_0x26e8('0x6'),_0x26e8('0x7'),_0x26e8('0x8'),'browser',_0x26e8('0x9'),'script']],'msg':_0x26e8('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x26e8('0x4')](0x1000),'comment':_0x26e8('0xb')},'data2':{'type':Sequelize[_0x26e8('0x4')](0x1000),'comment':_0x26e8('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x26e8('0x4')](0x1000),'comments':_0x26e8('0xd')},'data5':{'type':Sequelize[_0x26e8('0x4')](0x1000),'comments':_0x26e8('0xe')},'data6':{'type':Sequelize[_0x26e8('0x4')],'comments':_0x26e8('0xf')},'data7':{'type':Sequelize[_0x26e8('0x10')],'comments':_0x26e8('0x11')}}; \ No newline at end of file +var _0xe7ce=['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]','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7ce,0x1e5));var _0xee7c=function(_0x400b6b,_0x14f5fd){_0x400b6b=_0x400b6b-0x0;var _0x309f1b=_0xe7ce[_0x400b6b];return _0x309f1b;};'use strict';var Sequelize=require(_0xee7c('0x0'));module['exports']={'name':{'type':Sequelize[_0xee7c('0x1')],'get':function(_0x514773){return this[_0xee7c('0x2')](_0xee7c('0x3'));}},'action':{'type':Sequelize[_0xee7c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xee7c('0x5'),_0xee7c('0x6'),_0xee7c('0x7'),_0xee7c('0x8'),_0xee7c('0x9'),_0xee7c('0xa'),_0xee7c('0xb'),_0xee7c('0xc')]],'msg':_0xee7c('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xee7c('0x4')](0x1000),'comment':_0xee7c('0xe')},'data3':{'type':Sequelize[_0xee7c('0x4')](0x1000),'comment':_0xee7c('0xf')},'data4':{'type':Sequelize[_0xee7c('0x4')](0x1000),'comments':_0xee7c('0x10')},'data5':{'type':Sequelize[_0xee7c('0x4')](0x1000),'comments':_0xee7c('0x11')},'data6':{'type':Sequelize[_0xee7c('0x4')],'comments':_0xee7c('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0xee7c('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 860fe08..3529933 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 _0x1646=['Action','params','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','limit','count','offset','Content-Range','json','reject','update','then','destroy','end','sendStatus','name','send','body'];(function(_0x583fcf,_0x3ecc68){var _0x1b5c24=function(_0x6ac052){while(--_0x6ac052){_0x583fcf['push'](_0x583fcf['shift']());}};_0x1b5c24(++_0x3ecc68);}(_0x1646,0x1d2));var _0x6164=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x1646[_0x3f9584];return _0x9d54c;};'use strict';var emlformat=require(_0x6164('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6164('0x1'));var jsonpatch=require(_0x6164('0x2'));var rp=require(_0x6164('0x3'));var moment=require(_0x6164('0x4'));var BPromise=require(_0x6164('0x5'));var Mustache=require('mustache');var util=require(_0x6164('0x6'));var path=require('path');var sox=require(_0x6164('0x7'));var csv=require('to-csv');var ejs=require(_0x6164('0x8'));var fs=require('fs');var fs_extra=require(_0x6164('0x9'));var _=require(_0x6164('0xa'));var squel=require('squel');var crypto=require(_0x6164('0xb'));var jsforce=require(_0x6164('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6164('0xd'));var querystring=require(_0x6164('0xe'));var Papa=require(_0x6164('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6164('0x10'));var as=require(_0x6164('0x11'));var hardwareService=require(_0x6164('0x12'));var logger=require('../../config/logger')(_0x6164('0x13'));var utils=require(_0x6164('0x14'));var config=require(_0x6164('0x15'));var licenseUtil=require(_0x6164('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461cbe,_0x82127d){_0x82127d=_0x82127d||0xcc;return function(_0x3751bb){if(_0x3751bb){return _0x461cbe['sendStatus'](_0x82127d);}return _0x461cbe[_0x6164('0x17')](_0x82127d)['end']();};}function respondWithResult(_0x1f4aa1,_0x1c9f82){_0x1c9f82=_0x1c9f82||0xc8;return function(_0x23564a){if(_0x23564a){return _0x1f4aa1[_0x6164('0x17')](_0x1c9f82)['json'](_0x23564a);}};}function respondWithFilteredResult(_0x35d87d,_0x502286){return function(_0x2b7332){if(_0x2b7332){var _0x37763a=typeof _0x502286['offset']==='undefined'&&typeof _0x502286[_0x6164('0x18')]==='undefined';var _0x49d244=_0x2b7332[_0x6164('0x19')];var _0x912d5f=_0x37763a?0x0:_0x502286[_0x6164('0x1a')];var _0x599e20=_0x37763a?_0x2b7332[_0x6164('0x19')]:_0x502286[_0x6164('0x1a')]+_0x502286[_0x6164('0x18')];var _0x21c10e;if(_0x599e20>=_0x49d244){_0x599e20=_0x49d244;_0x21c10e=0xc8;}else{_0x21c10e=0xce;}_0x35d87d['status'](_0x21c10e);return _0x35d87d['set'](_0x6164('0x1b'),_0x912d5f+'-'+_0x599e20+'/'+_0x49d244)[_0x6164('0x1c')](_0x2b7332);}return null;};}function patchUpdates(_0x2d5323){return function(_0x161d8f){try{jsonpatch['apply'](_0x161d8f,_0x2d5323,!![]);}catch(_0x4e9adb){return BPromise[_0x6164('0x1d')](_0x4e9adb);}return _0x161d8f['save']();};}function saveUpdates(_0x54c459,_0x408995){return function(_0x3158f0){if(_0x3158f0){return _0x3158f0[_0x6164('0x1e')](_0x54c459)[_0x6164('0x1f')](function(_0x3ccaf2){return _0x3ccaf2;});}return null;};}function removeEntity(_0x403d7c,_0x4f2794){return function(_0xa2a30d){if(_0xa2a30d){return _0xa2a30d[_0x6164('0x20')]()[_0x6164('0x1f')](function(){_0x403d7c[_0x6164('0x17')](0xcc)[_0x6164('0x21')]();});}};}function handleEntityNotFound(_0x126c6b,_0x202fd5){return function(_0x24fa37){if(!_0x24fa37){_0x126c6b[_0x6164('0x22')](0x194);}return _0x24fa37;};}function handleError(_0x121c8b,_0x2d6844){_0x2d6844=_0x2d6844||0x1f4;return function(_0x4ba4c0){logger['error'](_0x4ba4c0['stack']);if(_0x4ba4c0[_0x6164('0x23')]){delete _0x4ba4c0[_0x6164('0x23')];}_0x121c8b[_0x6164('0x17')](_0x2d6844)[_0x6164('0x24')](_0x4ba4c0);};}exports[_0x6164('0x1e')]=function(_0x373cae,_0x595a9c){if(_0x373cae['body']['id']){delete _0x373cae[_0x6164('0x25')]['id'];}return db[_0x6164('0x26')]['find']({'where':{'id':_0x373cae[_0x6164('0x27')]['id']}})[_0x6164('0x1f')](handleEntityNotFound(_0x595a9c,null))['then'](saveUpdates(_0x373cae['body'],null))[_0x6164('0x1f')](respondWithResult(_0x595a9c,null))[_0x6164('0x28')](handleError(_0x595a9c,null));};exports[_0x6164('0x20')]=function(_0x5318cf,_0x215811){return db['Action'][_0x6164('0x29')]({'where':{'id':_0x5318cf[_0x6164('0x27')]['id']}})['then'](handleEntityNotFound(_0x215811,null))['then'](removeEntity(_0x215811,null))[_0x6164('0x28')](handleError(_0x215811,null));}; \ No newline at end of file +var _0x6fc4=['zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf'];(function(_0x145318,_0x46e6b0){var _0x5cf535=function(_0x1ed56d){while(--_0x1ed56d){_0x145318['push'](_0x145318['shift']());}};_0x5cf535(++_0x46e6b0);}(_0x6fc4,0x68));var _0x46fc=function(_0x35906a,_0x9e0b54){_0x35906a=_0x35906a-0x0;var _0x43ba69=_0x6fc4[_0x35906a];return _0x43ba69;};'use strict';var emlformat=require(_0x46fc('0x0'));var rimraf=require(_0x46fc('0x1'));var zipdir=require(_0x46fc('0x2'));var jsonpatch=require(_0x46fc('0x3'));var rp=require(_0x46fc('0x4'));var moment=require(_0x46fc('0x5'));var BPromise=require(_0x46fc('0x6'));var Mustache=require(_0x46fc('0x7'));var util=require('util');var path=require(_0x46fc('0x8'));var sox=require(_0x46fc('0x9'));var csv=require(_0x46fc('0xa'));var ejs=require(_0x46fc('0xb'));var fs=require('fs');var fs_extra=require(_0x46fc('0xc'));var _=require('lodash');var squel=require(_0x46fc('0xd'));var crypto=require(_0x46fc('0xe'));var jsforce=require(_0x46fc('0xf'));var deskjs=require(_0x46fc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46fc('0x11'));var Redis=require(_0x46fc('0x12'));var authService=require(_0x46fc('0x13'));var qs=require(_0x46fc('0x14'));var as=require(_0x46fc('0x15'));var hardwareService=require(_0x46fc('0x16'));var logger=require(_0x46fc('0x17'))('api');var utils=require(_0x46fc('0x18'));var config=require(_0x46fc('0x19'));var licenseUtil=require(_0x46fc('0x1a'));var db=require(_0x46fc('0x1b'))['db'];function respondWithStatusCode(_0x8d7a87,_0xb2aa8d){_0xb2aa8d=_0xb2aa8d||0xcc;return function(_0x599f2f){if(_0x599f2f){return _0x8d7a87['sendStatus'](_0xb2aa8d);}return _0x8d7a87[_0x46fc('0x1c')](_0xb2aa8d)[_0x46fc('0x1d')]();};}function respondWithResult(_0x194389,_0x58313e){_0x58313e=_0x58313e||0xc8;return function(_0x4f839b){if(_0x4f839b){return _0x194389[_0x46fc('0x1c')](_0x58313e)[_0x46fc('0x1e')](_0x4f839b);}};}function respondWithFilteredResult(_0x89a9e9,_0x4215c8){return function(_0x87bdac){if(_0x87bdac){var _0x511dd=typeof _0x4215c8['offset']==='undefined'&&typeof _0x4215c8[_0x46fc('0x1f')]===_0x46fc('0x20');var _0x52b6af=_0x87bdac[_0x46fc('0x21')];var _0x2ab4b9=_0x511dd?0x0:_0x4215c8[_0x46fc('0x22')];var _0x16c1de=_0x511dd?_0x87bdac['count']:_0x4215c8[_0x46fc('0x22')]+_0x4215c8['limit'];var _0x53487b;if(_0x16c1de>=_0x52b6af){_0x16c1de=_0x52b6af;_0x53487b=0xc8;}else{_0x53487b=0xce;}_0x89a9e9[_0x46fc('0x1c')](_0x53487b);return _0x89a9e9[_0x46fc('0x23')](_0x46fc('0x24'),_0x2ab4b9+'-'+_0x16c1de+'/'+_0x52b6af)[_0x46fc('0x1e')](_0x87bdac);}return null;};}function patchUpdates(_0x5d764b){return function(_0x155b81){try{jsonpatch[_0x46fc('0x25')](_0x155b81,_0x5d764b,!![]);}catch(_0x5554fb){return BPromise[_0x46fc('0x26')](_0x5554fb);}return _0x155b81[_0x46fc('0x27')]();};}function saveUpdates(_0xe1f6ca,_0x532018){return function(_0xcc5b24){if(_0xcc5b24){return _0xcc5b24[_0x46fc('0x28')](_0xe1f6ca)['then'](function(_0x5b95d3){return _0x5b95d3;});}return null;};}function removeEntity(_0x8c3992,_0x50f970){return function(_0xff47f1){if(_0xff47f1){return _0xff47f1[_0x46fc('0x29')]()[_0x46fc('0x2a')](function(){_0x8c3992[_0x46fc('0x1c')](0xcc)[_0x46fc('0x1d')]();});}};}function handleEntityNotFound(_0x3c125d,_0x1b14e3){return function(_0x13b312){if(!_0x13b312){_0x3c125d[_0x46fc('0x2b')](0x194);}return _0x13b312;};}function handleError(_0xdd5bec,_0x4767b0){_0x4767b0=_0x4767b0||0x1f4;return function(_0x1cc0e0){logger[_0x46fc('0x2c')](_0x1cc0e0[_0x46fc('0x2d')]);if(_0x1cc0e0[_0x46fc('0x2e')]){delete _0x1cc0e0[_0x46fc('0x2e')];}_0xdd5bec[_0x46fc('0x1c')](_0x4767b0)[_0x46fc('0x2f')](_0x1cc0e0);};}exports[_0x46fc('0x28')]=function(_0x12d0dc,_0xc76869){if(_0x12d0dc['body']['id']){delete _0x12d0dc[_0x46fc('0x30')]['id'];}return db[_0x46fc('0x31')][_0x46fc('0x32')]({'where':{'id':_0x12d0dc['params']['id']}})[_0x46fc('0x2a')](handleEntityNotFound(_0xc76869,null))['then'](saveUpdates(_0x12d0dc[_0x46fc('0x30')],null))[_0x46fc('0x2a')](respondWithResult(_0xc76869,null))['catch'](handleError(_0xc76869,null));};exports[_0x46fc('0x29')]=function(_0x568257,_0x4459e7){return db[_0x46fc('0x31')]['find']({'where':{'id':_0x568257[_0x46fc('0x33')]['id']}})[_0x46fc('0x2a')](handleEntityNotFound(_0x4459e7,null))[_0x46fc('0x2a')](removeEntity(_0x4459e7,null))[_0x46fc('0x34')](handleError(_0x4459e7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 92009a4..485b3f3 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 _0x269b=['path','../../config/environment','exports','define','Action','tools_actions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x269b,0x1be));var _0xb269=function(_0x80531e,_0x980d08){_0x80531e=_0x80531e-0x0;var _0x36fcae=_0x269b[_0x80531e];return _0x36fcae;};'use strict';var _=require(_0xb269('0x0'));var util=require('util');var logger=require(_0xb269('0x1'))('api');var moment=require(_0xb269('0x2'));var BPromise=require(_0xb269('0x3'));var rp=require(_0xb269('0x4'));var fs=require('fs');var path=require(_0xb269('0x5'));var rimraf=require('rimraf');var config=require(_0xb269('0x6'));var attributes=require('./action.attributes');module[_0xb269('0x7')]=function(_0x4cc43a,_0x8d49db){return _0x4cc43a[_0xb269('0x8')](_0xb269('0x9'),attributes,{'tableName':_0xb269('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb77c=['moment','bluebird','request-promise','path','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x557f28,_0xc7a5a6){var _0x2ffa93=function(_0x57abe2){while(--_0x57abe2){_0x557f28['push'](_0x557f28['shift']());}};_0x2ffa93(++_0xc7a5a6);}(_0xb77c,0x101));var _0xcb77=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb77c[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xcb77('0x0'));var util=require('util');var logger=require(_0xcb77('0x1'))(_0xcb77('0x2'));var moment=require(_0xcb77('0x3'));var BPromise=require(_0xcb77('0x4'));var rp=require(_0xcb77('0x5'));var fs=require('fs');var path=require(_0xcb77('0x6'));var rimraf=require(_0xcb77('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb77('0x8'));module[_0xcb77('0x9')]=function(_0x46c63f,_0x1b36d6){return _0x46c63f[_0xcb77('0xa')](_0xcb77('0xb'),attributes,{'tableName':_0xcb77('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 c247254..c5b1292 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(_0x999d97,_0x53e0d6){var _0x397da4=function(_0x38a334){while(--_0x38a334){_0x999d97['push'](_0x999d97['shift']());}};_0x397da4(++_0x53e0d6);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x539309,_0x35f17d){var _0x2277b5=function(_0x17cf56){while(--_0x17cf56){_0x539309['push'](_0x539309['shift']());}};_0x2277b5(++_0x35f17d);}(_0x1261,0x144));var _0x1126=function(_0x53f3ad,_0x39163e){_0x53f3ad=_0x53f3ad-0x0;var _0x48b203=_0x1261[_0x53f3ad];return _0x48b203;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7a58819..bacd3e9 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 _0x89a1=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x89a1,0x80));var _0x189a=function(_0x58be55,_0x4f7096){_0x58be55=_0x58be55-0x0;var _0x351fce=_0x89a1[_0x58be55];return _0x351fce;};'use strict';var multer=require(_0x189a('0x0'));var util=require(_0x189a('0x1'));var path=require(_0x189a('0x2'));var timeout=require(_0x189a('0x3'));var express=require(_0x189a('0x4'));var router=express[_0x189a('0x5')]();var fs_extra=require(_0x189a('0x6'));var auth=require(_0x189a('0x7'));var interaction=require(_0x189a('0x8'));var config=require(_0x189a('0x9'));var controller=require(_0x189a('0xa'));router[_0x189a('0xb')](_0x189a('0xc'),auth[_0x189a('0xd')](),controller['update']);router[_0x189a('0xe')](_0x189a('0xc'),auth['isAuthenticated'](),controller[_0x189a('0xf')]);module[_0x189a('0x10')]=router; \ No newline at end of file +var _0x2113=['put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0x2113,0x1c9));var _0x3211=function(_0xf0d997,_0x5848d5){_0xf0d997=_0xf0d997-0x0;var _0x5b64c5=_0x2113[_0xf0d997];return _0x5b64c5;};'use strict';var multer=require('multer');var util=require(_0x3211('0x0'));var path=require(_0x3211('0x1'));var timeout=require(_0x3211('0x2'));var express=require(_0x3211('0x3'));var router=express['Router']();var fs_extra=require(_0x3211('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3211('0x5'));var config=require(_0x3211('0x6'));var controller=require(_0x3211('0x7'));router[_0x3211('0x8')](_0x3211('0x9'),auth[_0x3211('0xa')](),controller[_0x3211('0xb')]);router[_0x3211('0xc')]('/:id',auth[_0x3211('0xa')](),controller[_0x3211('0xd')]);module[_0x3211('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d2c04c6..2a404cc 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 _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x5ccb02,_0x3588fb){var _0x52a833=function(_0x1b61d5){while(--_0x1b61d5){_0x5ccb02['push'](_0x5ccb02['shift']());}};_0x52a833(++_0x3588fb);}(_0x6aa7,0x178));var _0x76aa=function(_0x4be597,_0x3ab501){_0x4be597=_0x4be597-0x0;var _0x435456=_0x6aa7[_0x4be597];return _0x435456;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x456193,_0x136f3e){var _0x5e81f4=function(_0x35e937){while(--_0x35e937){_0x456193['push'](_0x456193['shift']());}};_0x5e81f4(++_0x136f3e);}(_0x6f47,0xc7));var _0x76f4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x6f47[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b20d34b..8325d91 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 _0xc42f=['savename','countTable','COUNT(*)','sequelize','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','count','set','json','apply','save','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','rows','show','params','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','metric','field','function','replace','format','orderBy','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','right_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','IS\x20NULL','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','MetricId','groupBy','DESC','alias','output','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports'];(function(_0x279a53,_0x5ea2a4){var _0x5b4d98=function(_0x4cbf60){while(--_0x4cbf60){_0x279a53['push'](_0x279a53['shift']());}};_0x5b4d98(++_0x5ea2a4);}(_0xc42f,0xb0));var _0xfc42=function(_0x67aa3,_0x32e741){_0x67aa3=_0x67aa3-0x0;var _0x32562e=_0xc42f[_0x67aa3];return _0x32562e;};'use strict';var emlformat=require(_0xfc42('0x0'));var rimraf=require(_0xfc42('0x1'));var zipdir=require(_0xfc42('0x2'));var jsonpatch=require(_0xfc42('0x3'));var rp=require(_0xfc42('0x4'));var moment=require('moment');var BPromise=require(_0xfc42('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc42('0x6'));var sox=require(_0xfc42('0x7'));var csv=require(_0xfc42('0x8'));var ejs=require(_0xfc42('0x9'));var fs=require('fs');var fs_extra=require(_0xfc42('0xa'));var _=require('lodash');var squel=require(_0xfc42('0xb'));var crypto=require(_0xfc42('0xc'));var jsforce=require(_0xfc42('0xd'));var deskjs=require(_0xfc42('0xe'));var toCsv=require(_0xfc42('0x8'));var querystring=require(_0xfc42('0xf'));var Papa=require(_0xfc42('0x10'));var Redis=require('ioredis');var authService=require(_0xfc42('0x11'));var qs=require(_0xfc42('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc42('0x13'));var logger=require(_0xfc42('0x14'))(_0xfc42('0x15'));var utils=require(_0xfc42('0x16'));var config=require(_0xfc42('0x17'));var licenseUtil=require(_0xfc42('0x18'));var db=require(_0xfc42('0x19'))['db'];var dbH=require(_0xfc42('0x19'))[_0xfc42('0x1a')];function respondWithStatusCode(_0x29ec4a,_0xc1012a){_0xc1012a=_0xc1012a||0xcc;return function(_0x5dca62){if(_0x5dca62){return _0x29ec4a[_0xfc42('0x1b')](_0xc1012a);}return _0x29ec4a[_0xfc42('0x1c')](_0xc1012a)[_0xfc42('0x1d')]();};}function respondWithResult(_0xcde6fc,_0x4c0c6e){_0x4c0c6e=_0x4c0c6e||0xc8;return function(_0x998fb){if(_0x998fb){return _0xcde6fc[_0xfc42('0x1c')](_0x4c0c6e)['json'](_0x998fb);}};}function respondWithFilteredResult(_0x5eb7b1,_0x3d27b1){return function(_0x50dd56){if(_0x50dd56){var _0x5475bc=typeof _0x3d27b1[_0xfc42('0x1e')]===_0xfc42('0x1f')&&typeof _0x3d27b1['limit']===_0xfc42('0x1f');var _0x47e199=_0x50dd56[_0xfc42('0x20')];var _0xe755b0=_0x5475bc?0x0:_0x3d27b1['offset'];var _0xb60d1=_0x5475bc?_0x50dd56[_0xfc42('0x20')]:_0x3d27b1[_0xfc42('0x1e')]+_0x3d27b1['limit'];var _0x22b7ad;if(_0xb60d1>=_0x47e199){_0xb60d1=_0x47e199;_0x22b7ad=0xc8;}else{_0x22b7ad=0xce;}_0x5eb7b1['status'](_0x22b7ad);return _0x5eb7b1[_0xfc42('0x21')]('Content-Range',_0xe755b0+'-'+_0xb60d1+'/'+_0x47e199)[_0xfc42('0x22')](_0x50dd56);}return null;};}function patchUpdates(_0xd52a3b){return function(_0x68b7d9){try{jsonpatch[_0xfc42('0x23')](_0x68b7d9,_0xd52a3b,!![]);}catch(_0xc61ee6){return BPromise['reject'](_0xc61ee6);}return _0x68b7d9[_0xfc42('0x24')]();};}function saveUpdates(_0x21a64f,_0x213436){return function(_0x75845c){if(_0x75845c){return _0x75845c['update'](_0x21a64f)[_0xfc42('0x25')](function(_0x5cf637){return _0x5cf637;});}return null;};}function removeEntity(_0x337c0b,_0x4429d5){return function(_0x5c2b3c){if(_0x5c2b3c){return _0x5c2b3c[_0xfc42('0x26')]()[_0xfc42('0x25')](function(){var _0x1bd03d=_0x5c2b3c[_0xfc42('0x27')]({'plain':!![]});var _0x1af783=_0xfc42('0x28');return db[_0xfc42('0x29')][_0xfc42('0x26')]({'where':{'type':_0x1af783,'resourceId':_0x1bd03d['id']}})[_0xfc42('0x25')](function(){return _0x5c2b3c;});})[_0xfc42('0x25')](function(){_0x337c0b[_0xfc42('0x1c')](0xcc)[_0xfc42('0x1d')]();});}};}function handleEntityNotFound(_0x3a6eef,_0x59bd99){return function(_0x58891d){if(!_0x58891d){_0x3a6eef[_0xfc42('0x1b')](0x194);}return _0x58891d;};}function handleError(_0x40a462,_0x2d5d00){_0x2d5d00=_0x2d5d00||0x1f4;return function(_0x2eb221){logger[_0xfc42('0x2a')](_0x2eb221[_0xfc42('0x2b')]);if(_0x2eb221[_0xfc42('0x2c')]){delete _0x2eb221[_0xfc42('0x2c')];}_0x40a462[_0xfc42('0x1c')](_0x2d5d00)[_0xfc42('0x2d')](_0x2eb221);};}exports[_0xfc42('0x2e')]=function(_0x16aa41,_0x1bdf2c){var _0x16ae4b={},_0x580177={},_0x2c77cf={'count':0x0,'rows':[]};var _0x1003a6=_[_0xfc42('0x2f')](db[_0xfc42('0x30')][_0xfc42('0x31')],function(_0x41f743){return{'name':_0x41f743[_0xfc42('0x32')],'type':_0x41f743[_0xfc42('0x33')][_0xfc42('0x34')]};});_0x580177[_0xfc42('0x35')]=_[_0xfc42('0x2f')](_0x1003a6,_0xfc42('0x2c'));_0x580177[_0xfc42('0x36')]=_[_0xfc42('0x37')](_0x16aa41[_0xfc42('0x36')]);_0x580177[_0xfc42('0x38')]=_[_0xfc42('0x39')](_0x580177[_0xfc42('0x35')],_0x580177[_0xfc42('0x36')]);_0x16ae4b[_0xfc42('0x3a')]=_['intersection'](_0x580177[_0xfc42('0x35')],qs[_0xfc42('0x3b')](_0x16aa41[_0xfc42('0x36')][_0xfc42('0x3b')]));_0x16ae4b[_0xfc42('0x3a')]=_0x16ae4b[_0xfc42('0x3a')][_0xfc42('0x3c')]?_0x16ae4b[_0xfc42('0x3a')]:_0x580177[_0xfc42('0x35')];if(!_0x16aa41[_0xfc42('0x36')]['hasOwnProperty'](_0xfc42('0x3d'))){_0x16ae4b[_0xfc42('0x3e')]=qs[_0xfc42('0x3e')](_0x16aa41['query']['limit']);_0x16ae4b[_0xfc42('0x1e')]=qs['offset'](_0x16aa41[_0xfc42('0x36')][_0xfc42('0x1e')]);}_0x16ae4b[_0xfc42('0x3f')]=qs[_0xfc42('0x40')](_0x16aa41['query']['sort']);_0x16ae4b[_0xfc42('0x41')]=qs[_0xfc42('0x38')](_[_0xfc42('0x42')](_0x16aa41[_0xfc42('0x36')],_0x580177[_0xfc42('0x38')]),_0x1003a6);if(_0x16aa41['query'][_0xfc42('0x43')]){_0x16ae4b['where']=_['merge'](_0x16ae4b[_0xfc42('0x41')],{'$or':_[_0xfc42('0x2f')](_0x1003a6,function(_0x477bc2){if(_0x477bc2[_0xfc42('0x33')]!==_0xfc42('0x44')){var _0x88cfd0={};_0x88cfd0[_0x477bc2['name']]={'$like':'%'+_0x16aa41[_0xfc42('0x36')][_0xfc42('0x43')]+'%'};return _0x88cfd0;}})});}_0x16ae4b=_[_0xfc42('0x45')]({},_0x16ae4b,_0x16aa41['options']);var _0x535499={'where':_0x16ae4b[_0xfc42('0x41')]};return db[_0xfc42('0x30')][_0xfc42('0x20')](_0x535499)[_0xfc42('0x25')](function(_0xcf2e0d){_0x2c77cf['count']=_0xcf2e0d;if(_0x16aa41[_0xfc42('0x36')]['includeAll']){_0x16ae4b['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x16ae4b);})[_0xfc42('0x25')](function(_0x16e790){_0x2c77cf[_0xfc42('0x46')]=_0x16e790;return _0x2c77cf;})[_0xfc42('0x25')](respondWithFilteredResult(_0x1bdf2c,_0x16ae4b))['catch'](handleError(_0x1bdf2c,null));};exports[_0xfc42('0x47')]=function(_0x1cd1be,_0x42f2b2){var _0x34638f={'raw':![],'where':{'id':_0x1cd1be[_0xfc42('0x48')]['id']}},_0x1e954a={};_0x1e954a['model']=_[_0xfc42('0x37')](db[_0xfc42('0x30')][_0xfc42('0x31')]);_0x1e954a[_0xfc42('0x36')]=_[_0xfc42('0x37')](_0x1cd1be[_0xfc42('0x36')]);_0x1e954a[_0xfc42('0x38')]=_[_0xfc42('0x39')](_0x1e954a[_0xfc42('0x35')],_0x1e954a['query']);_0x34638f[_0xfc42('0x3a')]=_[_0xfc42('0x39')](_0x1e954a['model'],qs[_0xfc42('0x3b')](_0x1cd1be[_0xfc42('0x36')][_0xfc42('0x3b')]));_0x34638f[_0xfc42('0x3a')]=_0x34638f[_0xfc42('0x3a')][_0xfc42('0x3c')]?_0x34638f[_0xfc42('0x3a')]:_0x1e954a['model'];if(_0x1cd1be['query'][_0xfc42('0x49')]){_0x34638f[_0xfc42('0x4a')]=[{'all':!![]}];}_0x34638f=_['merge']({},_0x34638f,_0x1cd1be[_0xfc42('0x4b')]);return db[_0xfc42('0x30')][_0xfc42('0x4c')](_0x34638f)[_0xfc42('0x25')](handleEntityNotFound(_0x42f2b2,null))[_0xfc42('0x25')](respondWithResult(_0x42f2b2,null))['catch'](handleError(_0x42f2b2,null));};exports['create']=function(_0x297e09,_0x76d92){return db[_0xfc42('0x30')][_0xfc42('0x4d')](_0x297e09[_0xfc42('0x4e')],{})[_0xfc42('0x25')](function(_0x552d6f){var _0x33e13f=_0x297e09['user'][_0xfc42('0x27')]({'plain':!![]});if(!_0x33e13f)throw new Error(_0xfc42('0x4f'));if(_0x33e13f[_0xfc42('0x50')]===_0xfc42('0x51')){var _0x50b7b5=_0x552d6f['get']({'plain':!![]});var _0x587d6c='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x587d6c,'userProfileId':_0x33e13f[_0xfc42('0x52')]},'raw':!![]})['then'](function(_0x3387dc){if(_0x3387dc&&_0x3387dc[_0xfc42('0x53')]===0x0){return db[_0xfc42('0x29')][_0xfc42('0x4d')]({'name':_0x50b7b5[_0xfc42('0x2c')],'resourceId':_0x50b7b5['id'],'type':_0xfc42('0x28'),'sectionId':_0x3387dc['id']},{})['then'](function(){return _0x552d6f;});}else{return _0x552d6f;}})['catch'](function(_0x204345){logger['error'](_0xfc42('0x54'),_0x204345);throw _0x204345;});}return _0x552d6f;})[_0xfc42('0x25')](respondWithResult(_0x76d92,0xc9))['catch'](handleError(_0x76d92,null));};exports['update']=function(_0xe7ecd9,_0x4bb4e5){if(_0xe7ecd9['body']['id']){delete _0xe7ecd9[_0xfc42('0x4e')]['id'];}return db[_0xfc42('0x30')][_0xfc42('0x4c')]({'where':{'id':_0xe7ecd9[_0xfc42('0x48')]['id']}})[_0xfc42('0x25')](handleEntityNotFound(_0x4bb4e5,null))[_0xfc42('0x25')](saveUpdates(_0xe7ecd9[_0xfc42('0x4e')],null))[_0xfc42('0x25')](respondWithResult(_0x4bb4e5,null))[_0xfc42('0x55')](handleError(_0x4bb4e5,null));};exports[_0xfc42('0x26')]=function(_0x2230ba,_0x458aaf){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2230ba[_0xfc42('0x48')]['id']}})[_0xfc42('0x25')](handleEntityNotFound(_0x458aaf,null))[_0xfc42('0x25')](removeEntity(_0x458aaf,null))[_0xfc42('0x55')](handleError(_0x458aaf,null));};exports[_0xfc42('0x56')]=function(_0x543df9,_0x4c940a){var _0x19595b=0xa;var _0x451afe=[_0xfc42('0x57'),_0xfc42('0x58'),'right_join',_0xfc42('0x59')];var _0x19bc07={'SUM':'SUM(%s)','COUNT':_0xfc42('0x5a'),'COUNT DISTINCT':_0xfc42('0x5b'),'MAX':_0xfc42('0x5c'),'MIN':_0xfc42('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfc42('0x5e'),'GROUP_CONCAT ASC':_0xfc42('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x462445={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xfc42('0x60'),'ROUND':_0xfc42('0x61'),'UNIX_TIMESTAMP':_0xfc42('0x62')};var _0x21c87c=function(_0x58ce23){return!_[_0xfc42('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xfc42('0x64'),_0xfc42('0x65')],_0x58ce23);};var _0x12e2cc=function(_0x1b2f80){if(!_0x1b2f80||!_0x1b2f80[_0xfc42('0x66')]['length']){return'';}for(var _0x406913='(',_0x4f34d3=0x0;_0x4f34d3<_0x1b2f80[_0xfc42('0x66')][_0xfc42('0x3c')];_0x4f34d3+=0x1){_0x4f34d3>0x0&&(_0x406913+='\x20'+_0x1b2f80[_0xfc42('0x67')]+'\x20');_0x406913+=_0x1b2f80['rules'][_0x4f34d3][_0xfc42('0x68')]?_0x12e2cc(_0x1b2f80[_0xfc42('0x66')][_0x4f34d3][_0xfc42('0x68')]):_0x1b2f80[_0xfc42('0x66')][_0x4f34d3]['field']+'\x20'+_0x1b2f80[_0xfc42('0x66')][_0x4f34d3][_0xfc42('0x69')]+(_0x21c87c(_0x1b2f80[_0xfc42('0x66')][_0x4f34d3][_0xfc42('0x69')])?'\x20'+_0x1b2f80[_0xfc42('0x66')][_0x4f34d3][_0xfc42('0x6a')]:'');}return _0x406913+')';};var _0x2dcd4d={'where':{'id':_0x543df9[_0xfc42('0x48')]['id']}},_0x11c720,_0x4534f0,_0x1be528,_0x166aca,_0x4285e6;_0x2dcd4d=_[_0xfc42('0x45')]({},_0x2dcd4d,_0x543df9[_0xfc42('0x4b')]);return db[_0xfc42('0x30')][_0xfc42('0x4c')](_0x2dcd4d)[_0xfc42('0x25')](function(_0x41e6ee){if(_0x41e6ee){_0x11c720=_0x41e6ee;return _0x41e6ee[_0xfc42('0x6b')]();}return null;})['then'](function(_0x387634){if(_0x387634){if(!_0x387634[_0xfc42('0x3c')]){throw new db[(_0xfc42('0x6c'))][(_0xfc42('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4534f0=_0x387634;return db[_0xfc42('0x6e')][_0xfc42('0x6f')]({'raw':!![]});}return null;})[_0xfc42('0x25')](function(_0xa5211d){if(_0xa5211d){_0x1be528=_[_0xfc42('0x70')](_0xa5211d,'id');var _0x5af06f;var _0x23cfde=squel[_0xfc42('0x71')]();_0x23cfde[_0xfc42('0x72')](_0x11c720[_0xfc42('0x73')]);for(var _0x5566d8=0x0;_0x5566d8<_0x4534f0[_0xfc42('0x3c')];_0x5566d8+=0x1){_0x5af06f=_0x4534f0[_0x5566d8]['MetricId']?_0x1be528[_0x4534f0[_0x5566d8]['MetricId']][_0xfc42('0x74')]:_0x4534f0[_0x5566d8][_0xfc42('0x75')];_0x5af06f=_0x4534f0[_0x5566d8][_0xfc42('0x76')]?_[_0xfc42('0x77')](_0x19bc07[_0x4534f0[_0x5566d8][_0xfc42('0x76')]],'%s',_0x5af06f):_0x5af06f;_0x5af06f=_0x4534f0[_0x5566d8][_0xfc42('0x78')]?_[_0xfc42('0x77')](_0x462445[_0x4534f0[_0x5566d8]['format']],'%s',_0x5af06f):_0x5af06f;if(_0x4534f0[_0x5566d8]['groupBy']){_0x23cfde[_0xfc42('0x68')](_0x5af06f);}_0x4534f0[_0x5566d8][_0xfc42('0x79')]&&_0x23cfde[_0xfc42('0x3f')](_0x5af06f,_0x4534f0[_0x5566d8][_0xfc42('0x79')]==='DESC'?![]:!![]);_0x23cfde[_0xfc42('0x75')](_0x5af06f,_0x4534f0[_0x5566d8]['alias']||_0x5af06f);}if(_0x11c720[_0xfc42('0x7a')]){_0x11c720[_0xfc42('0x7a')]=JSON[_0xfc42('0x7b')](_0x11c720['joins']);for(var _0x2e97af=0x0;_0x2e97af<_0x11c720[_0xfc42('0x7a')][_0xfc42('0x3c')];_0x2e97af+=0x1){if(_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x33')]&&_['includes'](_0x451afe,_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x33')])&&_0x11c720['joins'][_0x2e97af]['parentKey']&&_0x11c720[_0xfc42('0x7a')][_0x2e97af]['foreignTable']&&_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x7c')]){_0x23cfde[_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x33')]](_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x7d')],null,util['format'](_0xfc42('0x7e'),_0x11c720[_0xfc42('0x73')],_0x11c720[_0xfc42('0x7a')][_0x2e97af][_0xfc42('0x7f')],_0x11c720[_0xfc42('0x7a')][_0x2e97af]['foreignTable'],_0x11c720['joins'][_0x2e97af][_0xfc42('0x7c')]));}}}if(_0x11c720['conditions']){_0x11c720[_0xfc42('0x80')]=JSON['parse'](_0x11c720[_0xfc42('0x80')]);_0x23cfde[_0xfc42('0x41')](_0x12e2cc(_0x11c720[_0xfc42('0x80')]['group']));}_0x4285e6=_0x23cfde[_0xfc42('0x81')]();_0x23cfde[_0xfc42('0x3e')](_0x19595b);_0x23cfde[_0xfc42('0x1e')](0x0);logger[_0xfc42('0x82')](_0xfc42('0x83'),_0x23cfde[_0xfc42('0x84')]());return dbH['sequelize'][_0xfc42('0x36')](_0x23cfde[_0xfc42('0x84')](),{'type':dbH['sequelize'][_0xfc42('0x85')]['SELECT']});}})[_0xfc42('0x25')](respondWithResult(_0x4c940a,null))[_0xfc42('0x55')](handleError(_0x4c940a,null));};function runReport(_0x42eb6b,_0x860f01,_0x12903d){var _0x110135=_0x860f01[_0xfc42('0x2c')];var _0x3f0956=0xa;var _0x2e68e4=[_0xfc42('0x57'),_0xfc42('0x58'),_0xfc42('0x86'),_0xfc42('0x59')];var _0x4ee9ab={'SUM':_0xfc42('0x87'),'COUNT':_0xfc42('0x5a'),'COUNT DISTINCT':_0xfc42('0x5b'),'MAX':_0xfc42('0x5c'),'MIN':'MIN(%s)','AVG':_0xfc42('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfc42('0x5f'),'GROUP_CONCAT DESC':_0xfc42('0x89')};var _0x3e160a={'SEC_TO_TIME':_0xfc42('0x8a'),'DATE':_0xfc42('0x8b'),'HOUR':_0xfc42('0x60'),'ROUND':_0xfc42('0x61'),'UNIX_TIMESTAMP':_0xfc42('0x62')};var _0x10c5c3=function(_0xd3f2f4){return!_['includes']([_0xfc42('0x8c'),_0xfc42('0x8d'),_0xfc42('0x64'),_0xfc42('0x65')],_0xd3f2f4);};var _0x178579=function(_0xc36e49){if(!_0xc36e49||!_0xc36e49[_0xfc42('0x66')][_0xfc42('0x3c')]){return'';}for(var _0x1a4c4d='(',_0x386117=0x0;_0x386117<_0xc36e49[_0xfc42('0x66')][_0xfc42('0x3c')];_0x386117+=0x1){_0x386117>0x0&&(_0x1a4c4d+='\x20'+_0xc36e49['operator']+'\x20');_0x1a4c4d+=_0xc36e49[_0xfc42('0x66')][_0x386117]['group']?_0x178579(_0xc36e49['rules'][_0x386117][_0xfc42('0x68')]):_0xc36e49[_0xfc42('0x66')][_0x386117][_0xfc42('0x75')]+'\x20'+_0xc36e49[_0xfc42('0x66')][_0x386117][_0xfc42('0x69')]+(_0x10c5c3(_0xc36e49['rules'][_0x386117]['condition'])?'\x20'+_0xc36e49[_0xfc42('0x66')][_0x386117][_0xfc42('0x6a')]:'');}return _0x1a4c4d+')';};var _0x5ed4e1={'where':{'id':_0x42eb6b['id']}},_0x247b8d,_0x2f74be,_0x9085de,_0x32e87a,_0x4f9442;_0x5ed4e1=_[_0xfc42('0x45')]({},_0x5ed4e1,_0x12903d);return db[_0xfc42('0x30')][_0xfc42('0x4c')](_0x5ed4e1)[_0xfc42('0x25')](function(_0x364c77){if(_0x364c77){_0x247b8d=_0x364c77;return _0x364c77['getFields']();}return null;})[_0xfc42('0x25')](function(_0x24bc1a){if(_0x24bc1a){if(!_0x24bc1a[_0xfc42('0x3c')]){throw new db[(_0xfc42('0x6c'))][(_0xfc42('0x6d'))](_0xfc42('0x8e'),0x193);}_0x2f74be=_0x24bc1a;return db[_0xfc42('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xfc42('0x25')](function(_0x431af2){if(_0x431af2){_0x9085de=_[_0xfc42('0x70')](_0x431af2,'id');var _0x96a9ea;var _0x5602d3=squel[_0xfc42('0x71')]();_0x5602d3[_0xfc42('0x72')](_0x247b8d[_0xfc42('0x73')]);for(var _0x1563c9=0x0;_0x1563c9<_0x2f74be[_0xfc42('0x3c')];_0x1563c9+=0x1){_0x96a9ea=_0x2f74be[_0x1563c9]['MetricId']?_0x9085de[_0x2f74be[_0x1563c9][_0xfc42('0x8f')]][_0xfc42('0x74')]:_0x2f74be[_0x1563c9][_0xfc42('0x75')];_0x96a9ea=_0x2f74be[_0x1563c9][_0xfc42('0x76')]?_[_0xfc42('0x77')](_0x4ee9ab[_0x2f74be[_0x1563c9]['function']],'%s',_0x96a9ea):_0x96a9ea;_0x96a9ea=_0x2f74be[_0x1563c9][_0xfc42('0x78')]?_[_0xfc42('0x77')](_0x3e160a[_0x2f74be[_0x1563c9][_0xfc42('0x78')]],'%s',_0x96a9ea):_0x96a9ea;if(_0x2f74be[_0x1563c9][_0xfc42('0x90')]){_0x5602d3[_0xfc42('0x68')](_0x96a9ea);}_0x2f74be[_0x1563c9][_0xfc42('0x79')]&&_0x5602d3['order'](_0x96a9ea,_0x2f74be[_0x1563c9][_0xfc42('0x79')]===_0xfc42('0x91')?![]:!![]);_0x5602d3[_0xfc42('0x75')](_0x96a9ea,_0x2f74be[_0x1563c9][_0xfc42('0x92')]||_0x96a9ea);}if(_0x247b8d[_0xfc42('0x7a')]){_0x247b8d['joins']=JSON['parse'](_0x247b8d[_0xfc42('0x7a')]);for(var _0xa326af=0x0;_0xa326af<_0x247b8d[_0xfc42('0x7a')][_0xfc42('0x3c')];_0xa326af+=0x1){if(_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x33')]&&_[_0xfc42('0x63')](_0x2e68e4,_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x33')])&&_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x7f')]&&_0x247b8d['joins'][_0xa326af]['foreignTable']&&_0x247b8d[_0xfc42('0x7a')][_0xa326af]['foreignKey']){_0x5602d3[_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x33')]](_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x7d')],null,util['format'](_0xfc42('0x7e'),_0x247b8d[_0xfc42('0x73')],_0x247b8d['joins'][_0xa326af]['parentKey'],_0x247b8d[_0xfc42('0x7a')][_0xa326af][_0xfc42('0x7d')],_0x247b8d[_0xfc42('0x7a')][_0xa326af]['foreignKey']));}}}if(_0x247b8d['conditions']){_0x247b8d[_0xfc42('0x80')]=JSON[_0xfc42('0x7b')](_0x247b8d[_0xfc42('0x80')]);_0x5602d3['where'](_0x178579(_0x247b8d['conditions'][_0xfc42('0x68')]));}_0x4f9442=_0x5602d3[_0xfc42('0x81')]();_0x5602d3[_0xfc42('0x3e')](_0x3f0956);_0x5602d3[_0xfc42('0x1e')](0x0);return;}})[_0xfc42('0x25')](function(){if(_0x860f01[_0xfc42('0x93')]==='web'){return null;}var _0x43344f=_[_0xfc42('0x45')](_0x860f01,{'name':_0x860f01['fullPath']||_0x860f01[_0xfc42('0x2c')]||_0x247b8d[_0xfc42('0x2c')],'basename':_0x110135,'savename':util[_0xfc42('0x78')](_0xfc42('0x94'),_0x860f01[_0xfc42('0x2c')]||_0x247b8d[_0xfc42('0x2c')],require(_0xfc42('0x95'))[_0xfc42('0x96')](0x4),_0x860f01['output']||'csv'),'reportId':_0x247b8d['id'],'reportType':_0xfc42('0x97')});return db[_0xfc42('0x98')][_0xfc42('0x4d')](_0x43344f,{'raw':!![]});})['then'](function(_0x5e95b9){if(_0x247b8d[_0xfc42('0x73')]==='cdr'){_0x4f9442[_0xfc42('0x41')](_0x247b8d['table']+_0xfc42('0x99'),_0x860f01['startDate'],_0x860f01[_0xfc42('0x9a')]);}else{_0x4f9442[_0xfc42('0x41')](_0x247b8d['table']+_0xfc42('0x9b'),_0x860f01[_0xfc42('0x9c')],_0x860f01[_0xfc42('0x9a')]);}if(_0x5e95b9){logger[_0xfc42('0x9d')](_0xfc42('0x9e'),_0x4f9442['toString']());require('child_process')[_0xfc42('0x9f')](path[_0xfc42('0x57')](__dirname,_0xfc42('0xa0'),_0x5e95b9[_0xfc42('0x93')]),[_0x5e95b9['id'],_0x4f9442['toString'](),path[_0xfc42('0x57')](__dirname,_0xfc42('0xa1'),_0x5e95b9[_0xfc42('0xa2')]),_0x110135]);return _0x5e95b9;}else{var _0x51785d=squel['select']();_0x51785d[_0xfc42('0x72')]('('+_0x4f9442[_0xfc42('0x84')]()+')',_0xfc42('0xa3'));_0x51785d[_0xfc42('0x75')](_0xfc42('0xa4'),'count');_0x4f9442['limit'](_0x860f01[_0xfc42('0x3e')]||_0x3f0956);_0x4f9442[_0xfc42('0x1e')](_0x860f01['offset']||0x0);return dbH[_0xfc42('0xa5')][_0xfc42('0x36')](_0x51785d[_0xfc42('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0xfc42('0xa6')]})[_0xfc42('0x25')](function(_0x51a1f9){if(!_0x51a1f9[_0xfc42('0x3c')]){_0x32e87a=0x0;}else{_0x32e87a=_0x51a1f9[0x0]['count']||0x0;}return dbH[_0xfc42('0xa5')][_0xfc42('0x36')](_0x4f9442[_0xfc42('0x84')](),{'type':dbH[_0xfc42('0xa5')][_0xfc42('0x85')]['SELECT']});})[_0xfc42('0x25')](function(_0x544205){return{'rows':_0x544205||[],'count':_0x32e87a};});}});}exports[_0xfc42('0xa7')]=function(_0x5c68c3,_0x23187c){return runReport(_0x5c68c3[_0xfc42('0x48')],_0x5c68c3['query'],_0x5c68c3[_0xfc42('0x4b')])[_0xfc42('0x25')](respondWithResult(_0x23187c,null))[_0xfc42('0x55')](handleError(_0x23187c,null));};exports[_0xfc42('0xa8')]=runReport;exports[_0xfc42('0x36')]=function(_0x5a2cad,_0x57cbac){var _0x46da70=0xa;var _0x36e115=[_0xfc42('0x57'),_0xfc42('0x58'),'right_join',_0xfc42('0x59')];var _0x5cc276={'SUM':_0xfc42('0x87'),'COUNT':_0xfc42('0x5a'),'COUNT DISTINCT':_0xfc42('0x5b'),'MAX':_0xfc42('0x5c'),'MIN':_0xfc42('0x5d'),'AVG':_0xfc42('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfc42('0x5f'),'GROUP_CONCAT DESC':_0xfc42('0x89')};var _0x25da8d={'SEC_TO_TIME':_0xfc42('0x8a'),'DATE':_0xfc42('0x8b'),'HOUR':_0xfc42('0x60'),'ROUND':_0xfc42('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2909dc=function(_0x195832){return!_[_0xfc42('0x63')](['IS\x20NULL',_0xfc42('0x8d'),_0xfc42('0x64'),_0xfc42('0x65')],_0x195832);};var _0x53fa2d=function(_0x56ecf3){if(!_0x56ecf3||!_0x56ecf3[_0xfc42('0x66')][_0xfc42('0x3c')]){return'';}for(var _0x21c427='(',_0x589044=0x0;_0x589044<_0x56ecf3[_0xfc42('0x66')][_0xfc42('0x3c')];_0x589044+=0x1){_0x589044>0x0&&(_0x21c427+='\x20'+_0x56ecf3[_0xfc42('0x67')]+'\x20');_0x21c427+=_0x56ecf3['rules'][_0x589044][_0xfc42('0x68')]?_0x53fa2d(_0x56ecf3[_0xfc42('0x66')][_0x589044][_0xfc42('0x68')]):_0x56ecf3[_0xfc42('0x66')][_0x589044]['field']+'\x20'+_0x56ecf3['rules'][_0x589044][_0xfc42('0x69')]+(_0x2909dc(_0x56ecf3[_0xfc42('0x66')][_0x589044]['condition'])?'\x20'+_0x56ecf3[_0xfc42('0x66')][_0x589044][_0xfc42('0x6a')]:'');}return _0x21c427+')';};var _0x3a16d7={'where':{'id':_0x5a2cad[_0xfc42('0x48')]['id']}},_0x125610,_0x3b1c90,_0x36d390,_0x2794c1,_0x4815b0;_0x3a16d7=_[_0xfc42('0x45')]({},_0x3a16d7,_0x5a2cad[_0xfc42('0x4b')]);return db['AnalyticCustomReport'][_0xfc42('0x4c')](_0x3a16d7)['then'](function(_0x41fde2){if(_0x41fde2){_0x125610=_0x41fde2;return _0x41fde2['getFields']();}return null;})[_0xfc42('0x25')](function(_0x36bf2f){if(_0x36bf2f){if(!_0x36bf2f[_0xfc42('0x3c')]){throw new db[(_0xfc42('0x6c'))][(_0xfc42('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3b1c90=_0x36bf2f;return db[_0xfc42('0x6e')][_0xfc42('0x6f')]({'raw':!![]});}return null;})[_0xfc42('0x25')](function(_0x39f220){if(_0x39f220){_0x36d390=_[_0xfc42('0x70')](_0x39f220,'id');var _0x1cbedd;var _0x491fee=squel['select']();_0x491fee[_0xfc42('0x72')](_0x125610['table']);for(var _0x5a4191=0x0;_0x5a4191<_0x3b1c90[_0xfc42('0x3c')];_0x5a4191+=0x1){_0x1cbedd=_0x3b1c90[_0x5a4191][_0xfc42('0x8f')]?_0x36d390[_0x3b1c90[_0x5a4191]['MetricId']][_0xfc42('0x74')]:_0x3b1c90[_0x5a4191][_0xfc42('0x75')];_0x1cbedd=_0x3b1c90[_0x5a4191][_0xfc42('0x76')]?_[_0xfc42('0x77')](_0x5cc276[_0x3b1c90[_0x5a4191]['function']],'%s',_0x1cbedd):_0x1cbedd;_0x1cbedd=_0x3b1c90[_0x5a4191][_0xfc42('0x78')]?_[_0xfc42('0x77')](_0x25da8d[_0x3b1c90[_0x5a4191][_0xfc42('0x78')]],'%s',_0x1cbedd):_0x1cbedd;if(_0x3b1c90[_0x5a4191][_0xfc42('0x90')]){_0x491fee[_0xfc42('0x68')](_0x1cbedd);}_0x3b1c90[_0x5a4191][_0xfc42('0x79')]&&_0x491fee['order'](_0x1cbedd,_0x3b1c90[_0x5a4191][_0xfc42('0x79')]===_0xfc42('0x91')?![]:!![]);_0x491fee[_0xfc42('0x75')](_0x1cbedd,_0x3b1c90[_0x5a4191][_0xfc42('0x92')]||_0x1cbedd);}if(_0x125610[_0xfc42('0x7a')]){_0x125610[_0xfc42('0x7a')]=JSON['parse'](_0x125610[_0xfc42('0x7a')]);for(var _0x1baaec=0x0;_0x1baaec<_0x125610['joins']['length'];_0x1baaec+=0x1){if(_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x33')]&&_['includes'](_0x36e115,_0x125610['joins'][_0x1baaec][_0xfc42('0x33')])&&_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x7f')]&&_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x7d')]&&_0x125610[_0xfc42('0x7a')][_0x1baaec]['foreignKey']){_0x491fee[_0x125610[_0xfc42('0x7a')][_0x1baaec]['type']](_0x125610['joins'][_0x1baaec][_0xfc42('0x7d')],null,util[_0xfc42('0x78')](_0xfc42('0x7e'),_0x125610[_0xfc42('0x73')],_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x7f')],_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x7d')],_0x125610[_0xfc42('0x7a')][_0x1baaec][_0xfc42('0x7c')]));}}}if(_0x125610[_0xfc42('0x80')]){_0x125610[_0xfc42('0x80')]=JSON[_0xfc42('0x7b')](_0x125610[_0xfc42('0x80')]);_0x491fee[_0xfc42('0x41')](_0x53fa2d(_0x125610['conditions'][_0xfc42('0x68')]));}_0x4815b0=_0x491fee[_0xfc42('0x81')]();_0x491fee[_0xfc42('0x3e')](_0x46da70);_0x491fee[_0xfc42('0x1e')](0x0);logger[_0xfc42('0x82')]('Limited\x20Query:',_0x491fee['toString']());return dbH[_0xfc42('0xa5')][_0xfc42('0x36')](_0x491fee['toString'](),{'type':dbH[_0xfc42('0xa5')]['QueryTypes'][_0xfc42('0xa6')]});}})[_0xfc42('0x25')](function(){return{'sql':_0x4815b0[_0xfc42('0x84')]()};})['then'](respondWithResult(_0x57cbac,null))[_0xfc42('0x55')](handleError(_0x57cbac,null));}; \ No newline at end of file +var _0x7644=['value','clone','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','offset','count','set','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%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)','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','format','replace','orderBy','DESC','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','MAX(%s)','AVG(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','ValidationErrorItem','select','groupBy','alias','web','%s-%s.%s','output','csv','custom','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','savename','countTable','run','runReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7644,0x1d9));var _0x4764=function(_0x1d7571,_0x3f9a4e){_0x1d7571=_0x1d7571-0x0;var _0x1b3459=_0x7644[_0x1d7571];return _0x1b3459;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4764('0x0'));var zipdir=require(_0x4764('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4764('0x2'));var BPromise=require(_0x4764('0x3'));var Mustache=require('mustache');var util=require(_0x4764('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4764('0x5'));var ejs=require(_0x4764('0x6'));var fs=require('fs');var fs_extra=require(_0x4764('0x7'));var _=require(_0x4764('0x8'));var squel=require('squel');var crypto=require(_0x4764('0x9'));var jsforce=require(_0x4764('0xa'));var deskjs=require(_0x4764('0xb'));var toCsv=require(_0x4764('0x5'));var querystring=require(_0x4764('0xc'));var Papa=require(_0x4764('0xd'));var Redis=require('ioredis');var authService=require(_0x4764('0xe'));var qs=require(_0x4764('0xf'));var as=require(_0x4764('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4764('0x11'));var config=require(_0x4764('0x12'));var licenseUtil=require(_0x4764('0x13'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x32a7bf,_0x3740f7){_0x3740f7=_0x3740f7||0xcc;return function(_0x4b339f){if(_0x4b339f){return _0x32a7bf['sendStatus'](_0x3740f7);}return _0x32a7bf['status'](_0x3740f7)[_0x4764('0x14')]();};}function respondWithResult(_0x37f47f,_0x7610e3){_0x7610e3=_0x7610e3||0xc8;return function(_0x43386a){if(_0x43386a){return _0x37f47f[_0x4764('0x15')](_0x7610e3)[_0x4764('0x16')](_0x43386a);}};}function respondWithFilteredResult(_0x1ecbbf,_0x14cab3){return function(_0x4f7091){if(_0x4f7091){var _0x222d2d=typeof _0x14cab3['offset']===_0x4764('0x17')&&typeof _0x14cab3['limit']===_0x4764('0x17');var _0x3de95f=_0x4f7091['count'];var _0x18f491=_0x222d2d?0x0:_0x14cab3[_0x4764('0x18')];var _0x197d49=_0x222d2d?_0x4f7091[_0x4764('0x19')]:_0x14cab3[_0x4764('0x18')]+_0x14cab3['limit'];var _0x3dcb85;if(_0x197d49>=_0x3de95f){_0x197d49=_0x3de95f;_0x3dcb85=0xc8;}else{_0x3dcb85=0xce;}_0x1ecbbf[_0x4764('0x15')](_0x3dcb85);return _0x1ecbbf[_0x4764('0x1a')]('Content-Range',_0x18f491+'-'+_0x197d49+'/'+_0x3de95f)['json'](_0x4f7091);}return null;};}function patchUpdates(_0x3d348a){return function(_0x37c4b9){try{jsonpatch['apply'](_0x37c4b9,_0x3d348a,!![]);}catch(_0x3e5f72){return BPromise[_0x4764('0x1b')](_0x3e5f72);}return _0x37c4b9[_0x4764('0x1c')]();};}function saveUpdates(_0x5aaf24,_0x213525){return function(_0xeedecc){if(_0xeedecc){return _0xeedecc[_0x4764('0x1d')](_0x5aaf24)['then'](function(_0x35a47f){return _0x35a47f;});}return null;};}function removeEntity(_0x27d5f1,_0x5a6a4d){return function(_0x36fe91){if(_0x36fe91){return _0x36fe91[_0x4764('0x1e')]()[_0x4764('0x1f')](function(){var _0x46d4d=_0x36fe91[_0x4764('0x20')]({'plain':!![]});var _0x565429='CustomReports';return db[_0x4764('0x21')][_0x4764('0x1e')]({'where':{'type':_0x565429,'resourceId':_0x46d4d['id']}})[_0x4764('0x1f')](function(){return _0x36fe91;});})[_0x4764('0x1f')](function(){_0x27d5f1[_0x4764('0x15')](0xcc)[_0x4764('0x14')]();});}};}function handleEntityNotFound(_0x1f82da,_0x1a0701){return function(_0x125258){if(!_0x125258){_0x1f82da['sendStatus'](0x194);}return _0x125258;};}function handleError(_0x35d4c9,_0x133c3b){_0x133c3b=_0x133c3b||0x1f4;return function(_0x4f8114){logger[_0x4764('0x22')](_0x4f8114['stack']);if(_0x4f8114['name']){delete _0x4f8114[_0x4764('0x23')];}_0x35d4c9[_0x4764('0x15')](_0x133c3b)[_0x4764('0x24')](_0x4f8114);};}exports[_0x4764('0x25')]=function(_0x367e49,_0x49e5b0){var _0x1f0b81={},_0x4913f2={},_0x439aec={'count':0x0,'rows':[]};var _0x64421e=_[_0x4764('0x26')](db[_0x4764('0x27')][_0x4764('0x28')],function(_0x4dfa27){return{'name':_0x4dfa27[_0x4764('0x29')],'type':_0x4dfa27[_0x4764('0x2a')][_0x4764('0x2b')]};});_0x4913f2['model']=_[_0x4764('0x26')](_0x64421e,_0x4764('0x23'));_0x4913f2[_0x4764('0x2c')]=_['keys'](_0x367e49['query']);_0x4913f2[_0x4764('0x2d')]=_[_0x4764('0x2e')](_0x4913f2[_0x4764('0x2f')],_0x4913f2[_0x4764('0x2c')]);_0x1f0b81[_0x4764('0x30')]=_[_0x4764('0x2e')](_0x4913f2[_0x4764('0x2f')],qs[_0x4764('0x31')](_0x367e49[_0x4764('0x2c')][_0x4764('0x31')]));_0x1f0b81[_0x4764('0x30')]=_0x1f0b81[_0x4764('0x30')]['length']?_0x1f0b81['attributes']:_0x4913f2[_0x4764('0x2f')];if(!_0x367e49[_0x4764('0x2c')][_0x4764('0x32')](_0x4764('0x33'))){_0x1f0b81[_0x4764('0x34')]=qs[_0x4764('0x34')](_0x367e49['query'][_0x4764('0x34')]);_0x1f0b81[_0x4764('0x18')]=qs[_0x4764('0x18')](_0x367e49[_0x4764('0x2c')][_0x4764('0x18')]);}_0x1f0b81[_0x4764('0x35')]=qs['sort'](_0x367e49[_0x4764('0x2c')]['sort']);_0x1f0b81[_0x4764('0x36')]=qs[_0x4764('0x2d')](_[_0x4764('0x37')](_0x367e49[_0x4764('0x2c')],_0x4913f2[_0x4764('0x2d')]),_0x64421e);if(_0x367e49[_0x4764('0x2c')][_0x4764('0x38')]){_0x1f0b81['where']=_['merge'](_0x1f0b81[_0x4764('0x36')],{'$or':_[_0x4764('0x26')](_0x64421e,function(_0x1f2bbe){if(_0x1f2bbe[_0x4764('0x2a')]!==_0x4764('0x39')){var _0x4228cc={};_0x4228cc[_0x1f2bbe['name']]={'$like':'%'+_0x367e49[_0x4764('0x2c')][_0x4764('0x38')]+'%'};return _0x4228cc;}})});}_0x1f0b81=_[_0x4764('0x3a')]({},_0x1f0b81,_0x367e49[_0x4764('0x3b')]);var _0x315527={'where':_0x1f0b81[_0x4764('0x36')]};return db[_0x4764('0x27')][_0x4764('0x19')](_0x315527)[_0x4764('0x1f')](function(_0x497899){_0x439aec[_0x4764('0x19')]=_0x497899;if(_0x367e49['query'][_0x4764('0x3c')]){_0x1f0b81[_0x4764('0x3d')]=[{'all':!![]}];}return db[_0x4764('0x27')][_0x4764('0x3e')](_0x1f0b81);})['then'](function(_0x200e45){_0x439aec[_0x4764('0x3f')]=_0x200e45;return _0x439aec;})[_0x4764('0x1f')](respondWithFilteredResult(_0x49e5b0,_0x1f0b81))[_0x4764('0x40')](handleError(_0x49e5b0,null));};exports[_0x4764('0x41')]=function(_0xd993ca,_0x4e7d65){var _0x31e721={'raw':![],'where':{'id':_0xd993ca[_0x4764('0x42')]['id']}},_0x1ac7c2={};_0x1ac7c2[_0x4764('0x2f')]=_[_0x4764('0x43')](db[_0x4764('0x27')]['rawAttributes']);_0x1ac7c2[_0x4764('0x2c')]=_[_0x4764('0x43')](_0xd993ca[_0x4764('0x2c')]);_0x1ac7c2['filters']=_[_0x4764('0x2e')](_0x1ac7c2[_0x4764('0x2f')],_0x1ac7c2[_0x4764('0x2c')]);_0x31e721['attributes']=_[_0x4764('0x2e')](_0x1ac7c2['model'],qs[_0x4764('0x31')](_0xd993ca['query'][_0x4764('0x31')]));_0x31e721[_0x4764('0x30')]=_0x31e721[_0x4764('0x30')][_0x4764('0x44')]?_0x31e721['attributes']:_0x1ac7c2[_0x4764('0x2f')];if(_0xd993ca[_0x4764('0x2c')][_0x4764('0x3c')]){_0x31e721['include']=[{'all':!![]}];}_0x31e721=_[_0x4764('0x3a')]({},_0x31e721,_0xd993ca['options']);return db[_0x4764('0x27')]['find'](_0x31e721)['then'](handleEntityNotFound(_0x4e7d65,null))[_0x4764('0x1f')](respondWithResult(_0x4e7d65,null))[_0x4764('0x40')](handleError(_0x4e7d65,null));};exports[_0x4764('0x45')]=function(_0xd44e0,_0x88b3ce){return db[_0x4764('0x27')]['create'](_0xd44e0['body'],{})['then'](function(_0xec3975){var _0x1243d6=_0xd44e0['user'][_0x4764('0x20')]({'plain':!![]});if(!_0x1243d6)throw new Error(_0x4764('0x46'));if(_0x1243d6[_0x4764('0x47')]===_0x4764('0x48')){var _0x3f7a57=_0xec3975[_0x4764('0x20')]({'plain':!![]});var _0x16f8d5=_0x4764('0x49');return db[_0x4764('0x4a')][_0x4764('0x4b')]({'where':{'name':_0x16f8d5,'userProfileId':_0x1243d6[_0x4764('0x4c')]},'raw':!![]})[_0x4764('0x1f')](function(_0x37660c){if(_0x37660c&&_0x37660c[_0x4764('0x4d')]===0x0){return db[_0x4764('0x21')][_0x4764('0x45')]({'name':_0x3f7a57['name'],'resourceId':_0x3f7a57['id'],'type':'CustomReports','sectionId':_0x37660c['id']},{})[_0x4764('0x1f')](function(){return _0xec3975;});}else{return _0xec3975;}})[_0x4764('0x40')](function(_0x5448d9){logger[_0x4764('0x22')](_0x4764('0x4e'),_0x5448d9);throw _0x5448d9;});}return _0xec3975;})['then'](respondWithResult(_0x88b3ce,0xc9))[_0x4764('0x40')](handleError(_0x88b3ce,null));};exports[_0x4764('0x1d')]=function(_0x54ff9e,_0x3dd29f){if(_0x54ff9e[_0x4764('0x4f')]['id']){delete _0x54ff9e['body']['id'];}return db[_0x4764('0x27')][_0x4764('0x4b')]({'where':{'id':_0x54ff9e[_0x4764('0x42')]['id']}})[_0x4764('0x1f')](handleEntityNotFound(_0x3dd29f,null))['then'](saveUpdates(_0x54ff9e[_0x4764('0x4f')],null))[_0x4764('0x1f')](respondWithResult(_0x3dd29f,null))[_0x4764('0x40')](handleError(_0x3dd29f,null));};exports[_0x4764('0x1e')]=function(_0x3d52af,_0x5a42f1){return db[_0x4764('0x27')]['find']({'where':{'id':_0x3d52af[_0x4764('0x42')]['id']}})[_0x4764('0x1f')](handleEntityNotFound(_0x5a42f1,null))['then'](removeEntity(_0x5a42f1,null))[_0x4764('0x40')](handleError(_0x5a42f1,null));};exports[_0x4764('0x50')]=function(_0x1730ff,_0x53f3bf){var _0x11d06c=0xa;var _0x2cd92f=[_0x4764('0x51'),'left_join',_0x4764('0x52'),'cross_join'];var _0x39da8b={'SUM':_0x4764('0x53'),'COUNT':_0x4764('0x54'),'COUNT DISTINCT':_0x4764('0x55'),'MAX':'MAX(%s)','MIN':_0x4764('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4764('0x57'),'GROUP_CONCAT ASC':_0x4764('0x58'),'GROUP_CONCAT DESC':_0x4764('0x59')};var _0x1ca435={'SEC_TO_TIME':_0x4764('0x5a'),'DATE':_0x4764('0x5b'),'HOUR':_0x4764('0x5c'),'ROUND':_0x4764('0x5d'),'UNIX_TIMESTAMP':_0x4764('0x5e')};var _0x3c939f=function(_0x53639e){return!_['includes']([_0x4764('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x4764('0x60')],_0x53639e);};var _0x3aec08=function(_0x4416f9){if(!_0x4416f9||!_0x4416f9['rules']['length']){return'';}for(var _0x21292c='(',_0x1c38f8=0x0;_0x1c38f8<_0x4416f9['rules'][_0x4764('0x44')];_0x1c38f8+=0x1){_0x1c38f8>0x0&&(_0x21292c+='\x20'+_0x4416f9['operator']+'\x20');_0x21292c+=_0x4416f9[_0x4764('0x61')][_0x1c38f8][_0x4764('0x62')]?_0x3aec08(_0x4416f9[_0x4764('0x61')][_0x1c38f8][_0x4764('0x62')]):_0x4416f9[_0x4764('0x61')][_0x1c38f8][_0x4764('0x63')]+'\x20'+_0x4416f9['rules'][_0x1c38f8][_0x4764('0x64')]+(_0x3c939f(_0x4416f9[_0x4764('0x61')][_0x1c38f8][_0x4764('0x64')])?'\x20'+_0x4416f9[_0x4764('0x61')][_0x1c38f8]['value']:'');}return _0x21292c+')';};var _0x7b4350={'where':{'id':_0x1730ff[_0x4764('0x42')]['id']}},_0x2b5956,_0x14abb7,_0x48f210,_0x18da37,_0x49b7a1;_0x7b4350=_[_0x4764('0x3a')]({},_0x7b4350,_0x1730ff[_0x4764('0x3b')]);return db[_0x4764('0x27')][_0x4764('0x4b')](_0x7b4350)[_0x4764('0x1f')](function(_0x41b2f6){if(_0x41b2f6){_0x2b5956=_0x41b2f6;return _0x41b2f6[_0x4764('0x65')]();}return null;})[_0x4764('0x1f')](function(_0x283ccf){if(_0x283ccf){if(!_0x283ccf['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x4764('0x66'),0x193);}_0x14abb7=_0x283ccf;return db[_0x4764('0x67')][_0x4764('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x58a186){if(_0x58a186){_0x48f210=_[_0x4764('0x68')](_0x58a186,'id');var _0x87469e;var _0x475639=squel['select']();_0x475639[_0x4764('0x69')](_0x2b5956['table']);for(var _0x1476a6=0x0;_0x1476a6<_0x14abb7['length'];_0x1476a6+=0x1){_0x87469e=_0x14abb7[_0x1476a6]['MetricId']?_0x48f210[_0x14abb7[_0x1476a6][_0x4764('0x6a')]][_0x4764('0x6b')]:_0x14abb7[_0x1476a6]['field'];_0x87469e=_0x14abb7[_0x1476a6][_0x4764('0x6c')]?_['replace'](_0x39da8b[_0x14abb7[_0x1476a6][_0x4764('0x6c')]],'%s',_0x87469e):_0x87469e;_0x87469e=_0x14abb7[_0x1476a6][_0x4764('0x6d')]?_[_0x4764('0x6e')](_0x1ca435[_0x14abb7[_0x1476a6][_0x4764('0x6d')]],'%s',_0x87469e):_0x87469e;if(_0x14abb7[_0x1476a6]['groupBy']){_0x475639['group'](_0x87469e);}_0x14abb7[_0x1476a6][_0x4764('0x6f')]&&_0x475639[_0x4764('0x35')](_0x87469e,_0x14abb7[_0x1476a6]['orderBy']===_0x4764('0x70')?![]:!![]);_0x475639[_0x4764('0x63')](_0x87469e,_0x14abb7[_0x1476a6]['alias']||_0x87469e);}if(_0x2b5956[_0x4764('0x71')]){_0x2b5956[_0x4764('0x71')]=JSON['parse'](_0x2b5956[_0x4764('0x71')]);for(var _0x346899=0x0;_0x346899<_0x2b5956[_0x4764('0x71')]['length'];_0x346899+=0x1){if(_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x2a')]&&_[_0x4764('0x72')](_0x2cd92f,_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x2a')])&&_0x2b5956['joins'][_0x346899][_0x4764('0x73')]&&_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x74')]&&_0x2b5956['joins'][_0x346899][_0x4764('0x75')]){_0x475639[_0x2b5956['joins'][_0x346899][_0x4764('0x2a')]](_0x2b5956['joins'][_0x346899][_0x4764('0x74')],null,util[_0x4764('0x6d')](_0x4764('0x76'),_0x2b5956[_0x4764('0x77')],_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x73')],_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x74')],_0x2b5956[_0x4764('0x71')][_0x346899][_0x4764('0x75')]));}}}if(_0x2b5956[_0x4764('0x78')]){_0x2b5956[_0x4764('0x78')]=JSON[_0x4764('0x79')](_0x2b5956[_0x4764('0x78')]);_0x475639[_0x4764('0x36')](_0x3aec08(_0x2b5956[_0x4764('0x78')]['group']));}_0x49b7a1=_0x475639['clone']();_0x475639[_0x4764('0x34')](_0x11d06c);_0x475639[_0x4764('0x18')](0x0);logger[_0x4764('0x7a')](_0x4764('0x7b'),_0x475639[_0x4764('0x7c')]());return dbH[_0x4764('0x7d')][_0x4764('0x2c')](_0x475639[_0x4764('0x7c')](),{'type':dbH['sequelize'][_0x4764('0x7e')][_0x4764('0x7f')]});}})[_0x4764('0x1f')](respondWithResult(_0x53f3bf,null))[_0x4764('0x40')](handleError(_0x53f3bf,null));};function runReport(_0x2ec29d,_0x2c30eb,_0x28a9e3){var _0x1df0c7=_0x2c30eb['name'];var _0x337be4=0xa;var _0x431681=[_0x4764('0x51'),_0x4764('0x80'),_0x4764('0x52'),_0x4764('0x81')];var _0x6cc7e6={'SUM':_0x4764('0x53'),'COUNT':_0x4764('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4764('0x82'),'MIN':_0x4764('0x56'),'AVG':_0x4764('0x83'),'GROUP_CONCAT':_0x4764('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4764('0x59')};var _0x17b5ff={'SEC_TO_TIME':_0x4764('0x5a'),'DATE':_0x4764('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x4764('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bea0a=function(_0x22c8ff){return!_[_0x4764('0x72')]([_0x4764('0x5f'),_0x4764('0x84'),_0x4764('0x85'),'IS\x20NOT\x20EMPTY'],_0x22c8ff);};var _0x1c520a=function(_0x272f47){if(!_0x272f47||!_0x272f47[_0x4764('0x61')]['length']){return'';}for(var _0x52e69f='(',_0x2bbbca=0x0;_0x2bbbca<_0x272f47[_0x4764('0x61')][_0x4764('0x44')];_0x2bbbca+=0x1){_0x2bbbca>0x0&&(_0x52e69f+='\x20'+_0x272f47[_0x4764('0x86')]+'\x20');_0x52e69f+=_0x272f47[_0x4764('0x61')][_0x2bbbca][_0x4764('0x62')]?_0x1c520a(_0x272f47[_0x4764('0x61')][_0x2bbbca][_0x4764('0x62')]):_0x272f47[_0x4764('0x61')][_0x2bbbca][_0x4764('0x63')]+'\x20'+_0x272f47[_0x4764('0x61')][_0x2bbbca][_0x4764('0x64')]+(_0x5bea0a(_0x272f47[_0x4764('0x61')][_0x2bbbca]['condition'])?'\x20'+_0x272f47['rules'][_0x2bbbca]['value']:'');}return _0x52e69f+')';};var _0x2f654b={'where':{'id':_0x2ec29d['id']}},_0x59a5da,_0x57156d,_0x5a3f6d,_0x518dfa,_0x378a1d;_0x2f654b=_[_0x4764('0x3a')]({},_0x2f654b,_0x28a9e3);return db[_0x4764('0x27')]['find'](_0x2f654b)[_0x4764('0x1f')](function(_0x65ba7f){if(_0x65ba7f){_0x59a5da=_0x65ba7f;return _0x65ba7f[_0x4764('0x65')]();}return null;})[_0x4764('0x1f')](function(_0x308cd5){if(_0x308cd5){if(!_0x308cd5[_0x4764('0x44')]){throw new db['Sequelize'][(_0x4764('0x87'))](_0x4764('0x66'),0x193);}_0x57156d=_0x308cd5;return db[_0x4764('0x67')][_0x4764('0x3e')]({'raw':!![]});}return null;})[_0x4764('0x1f')](function(_0x534003){if(_0x534003){_0x5a3f6d=_[_0x4764('0x68')](_0x534003,'id');var _0x3e37e5;var _0xce3fb6=squel[_0x4764('0x88')]();_0xce3fb6['from'](_0x59a5da[_0x4764('0x77')]);for(var _0x350dc5=0x0;_0x350dc5<_0x57156d[_0x4764('0x44')];_0x350dc5+=0x1){_0x3e37e5=_0x57156d[_0x350dc5][_0x4764('0x6a')]?_0x5a3f6d[_0x57156d[_0x350dc5][_0x4764('0x6a')]][_0x4764('0x6b')]:_0x57156d[_0x350dc5]['field'];_0x3e37e5=_0x57156d[_0x350dc5][_0x4764('0x6c')]?_['replace'](_0x6cc7e6[_0x57156d[_0x350dc5]['function']],'%s',_0x3e37e5):_0x3e37e5;_0x3e37e5=_0x57156d[_0x350dc5]['format']?_['replace'](_0x17b5ff[_0x57156d[_0x350dc5][_0x4764('0x6d')]],'%s',_0x3e37e5):_0x3e37e5;if(_0x57156d[_0x350dc5][_0x4764('0x89')]){_0xce3fb6[_0x4764('0x62')](_0x3e37e5);}_0x57156d[_0x350dc5][_0x4764('0x6f')]&&_0xce3fb6[_0x4764('0x35')](_0x3e37e5,_0x57156d[_0x350dc5][_0x4764('0x6f')]===_0x4764('0x70')?![]:!![]);_0xce3fb6[_0x4764('0x63')](_0x3e37e5,_0x57156d[_0x350dc5][_0x4764('0x8a')]||_0x3e37e5);}if(_0x59a5da[_0x4764('0x71')]){_0x59a5da[_0x4764('0x71')]=JSON['parse'](_0x59a5da[_0x4764('0x71')]);for(var _0x14f284=0x0;_0x14f284<_0x59a5da[_0x4764('0x71')][_0x4764('0x44')];_0x14f284+=0x1){if(_0x59a5da['joins'][_0x14f284][_0x4764('0x2a')]&&_[_0x4764('0x72')](_0x431681,_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x2a')])&&_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x73')]&&_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x74')]&&_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x75')]){_0xce3fb6[_0x59a5da['joins'][_0x14f284]['type']](_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x74')],null,util[_0x4764('0x6d')](_0x4764('0x76'),_0x59a5da[_0x4764('0x77')],_0x59a5da[_0x4764('0x71')][_0x14f284]['parentKey'],_0x59a5da[_0x4764('0x71')][_0x14f284][_0x4764('0x74')],_0x59a5da['joins'][_0x14f284]['foreignKey']));}}}if(_0x59a5da['conditions']){_0x59a5da[_0x4764('0x78')]=JSON[_0x4764('0x79')](_0x59a5da[_0x4764('0x78')]);_0xce3fb6[_0x4764('0x36')](_0x1c520a(_0x59a5da[_0x4764('0x78')][_0x4764('0x62')]));}_0x378a1d=_0xce3fb6['clone']();_0xce3fb6[_0x4764('0x34')](_0x337be4);_0xce3fb6['offset'](0x0);return;}})[_0x4764('0x1f')](function(){if(_0x2c30eb['output']===_0x4764('0x8b')){return null;}var _0x156828=_[_0x4764('0x3a')](_0x2c30eb,{'name':_0x2c30eb['fullPath']||_0x2c30eb[_0x4764('0x23')]||_0x59a5da[_0x4764('0x23')],'basename':_0x1df0c7,'savename':util[_0x4764('0x6d')](_0x4764('0x8c'),_0x2c30eb[_0x4764('0x23')]||_0x59a5da[_0x4764('0x23')],require('randomstring')['generate'](0x4),_0x2c30eb[_0x4764('0x8d')]||_0x4764('0x8e')),'reportId':_0x59a5da['id'],'reportType':_0x4764('0x8f')});return db['AnalyticExtractedReport'][_0x4764('0x45')](_0x156828,{'raw':!![]});})['then'](function(_0x5ec505){if(_0x59a5da['table']==='cdr'){_0x378a1d[_0x4764('0x36')](_0x59a5da[_0x4764('0x77')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2c30eb['startDate'],_0x2c30eb[_0x4764('0x90')]);}else{_0x378a1d['where'](_0x59a5da['table']+_0x4764('0x91'),_0x2c30eb[_0x4764('0x92')],_0x2c30eb[_0x4764('0x90')]);}if(_0x5ec505){logger[_0x4764('0x93')](_0x4764('0x94'),_0x378a1d[_0x4764('0x7c')]());require(_0x4764('0x95'))[_0x4764('0x96')](path['join'](__dirname,'../../components/export/',_0x5ec505[_0x4764('0x8d')]),[_0x5ec505['id'],_0x378a1d[_0x4764('0x7c')](),path['join'](__dirname,'../../files/reports',_0x5ec505[_0x4764('0x97')]),_0x1df0c7]);return _0x5ec505;}else{var _0x2416a8=squel[_0x4764('0x88')]();_0x2416a8['from']('('+_0x378a1d[_0x4764('0x7c')]()+')',_0x4764('0x98'));_0x2416a8['field']('COUNT(*)',_0x4764('0x19'));_0x378a1d[_0x4764('0x34')](_0x2c30eb[_0x4764('0x34')]||_0x337be4);_0x378a1d['offset'](_0x2c30eb[_0x4764('0x18')]||0x0);return dbH[_0x4764('0x7d')][_0x4764('0x2c')](_0x2416a8['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0x4764('0x1f')](function(_0x536d7f){if(!_0x536d7f[_0x4764('0x44')]){_0x518dfa=0x0;}else{_0x518dfa=_0x536d7f[0x0][_0x4764('0x19')]||0x0;}return dbH[_0x4764('0x7d')][_0x4764('0x2c')](_0x378a1d['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x4764('0x7f')]});})['then'](function(_0xcb4180){return{'rows':_0xcb4180||[],'count':_0x518dfa};});}});}exports[_0x4764('0x99')]=function(_0x60bad2,_0x2250c0){return runReport(_0x60bad2['params'],_0x60bad2[_0x4764('0x2c')],_0x60bad2[_0x4764('0x3b')])[_0x4764('0x1f')](respondWithResult(_0x2250c0,null))[_0x4764('0x40')](handleError(_0x2250c0,null));};exports[_0x4764('0x9a')]=runReport;exports[_0x4764('0x2c')]=function(_0x4587c2,_0x3e0f55){var _0x1d9619=0xa;var _0x35b50a=[_0x4764('0x51'),_0x4764('0x80'),_0x4764('0x52'),_0x4764('0x81')];var _0x62508a={'SUM':_0x4764('0x53'),'COUNT':_0x4764('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4764('0x82'),'MIN':_0x4764('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4764('0x57'),'GROUP_CONCAT ASC':_0x4764('0x58'),'GROUP_CONCAT DESC':_0x4764('0x59')};var _0x5e2016={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x4764('0x5c'),'ROUND':_0x4764('0x5d'),'UNIX_TIMESTAMP':_0x4764('0x5e')};var _0x53874=function(_0x15abaa){return!_[_0x4764('0x72')]([_0x4764('0x5f'),_0x4764('0x84'),_0x4764('0x85'),_0x4764('0x60')],_0x15abaa);};var _0x20f9b6=function(_0x4306b6){if(!_0x4306b6||!_0x4306b6[_0x4764('0x61')][_0x4764('0x44')]){return'';}for(var _0x2a38f6='(',_0x1d7868=0x0;_0x1d7868<_0x4306b6['rules']['length'];_0x1d7868+=0x1){_0x1d7868>0x0&&(_0x2a38f6+='\x20'+_0x4306b6['operator']+'\x20');_0x2a38f6+=_0x4306b6['rules'][_0x1d7868]['group']?_0x20f9b6(_0x4306b6[_0x4764('0x61')][_0x1d7868][_0x4764('0x62')]):_0x4306b6[_0x4764('0x61')][_0x1d7868][_0x4764('0x63')]+'\x20'+_0x4306b6[_0x4764('0x61')][_0x1d7868]['condition']+(_0x53874(_0x4306b6[_0x4764('0x61')][_0x1d7868][_0x4764('0x64')])?'\x20'+_0x4306b6[_0x4764('0x61')][_0x1d7868][_0x4764('0x9b')]:'');}return _0x2a38f6+')';};var _0x195e80={'where':{'id':_0x4587c2[_0x4764('0x42')]['id']}},_0x4d6c8f,_0x40dc58,_0x2883fe,_0x576dd7,_0x1458a7;_0x195e80=_[_0x4764('0x3a')]({},_0x195e80,_0x4587c2[_0x4764('0x3b')]);return db[_0x4764('0x27')][_0x4764('0x4b')](_0x195e80)[_0x4764('0x1f')](function(_0x5755c6){if(_0x5755c6){_0x4d6c8f=_0x5755c6;return _0x5755c6[_0x4764('0x65')]();}return null;})['then'](function(_0x20090b){if(_0x20090b){if(!_0x20090b[_0x4764('0x44')]){throw new db['Sequelize']['ValidationErrorItem'](_0x4764('0x66'),0x193);}_0x40dc58=_0x20090b;return db[_0x4764('0x67')]['findAll']({'raw':!![]});}return null;})[_0x4764('0x1f')](function(_0x1d516a){if(_0x1d516a){_0x2883fe=_[_0x4764('0x68')](_0x1d516a,'id');var _0x2c124e;var _0x31d21f=squel['select']();_0x31d21f[_0x4764('0x69')](_0x4d6c8f[_0x4764('0x77')]);for(var _0x547f9b=0x0;_0x547f9b<_0x40dc58[_0x4764('0x44')];_0x547f9b+=0x1){_0x2c124e=_0x40dc58[_0x547f9b][_0x4764('0x6a')]?_0x2883fe[_0x40dc58[_0x547f9b]['MetricId']]['metric']:_0x40dc58[_0x547f9b][_0x4764('0x63')];_0x2c124e=_0x40dc58[_0x547f9b][_0x4764('0x6c')]?_[_0x4764('0x6e')](_0x62508a[_0x40dc58[_0x547f9b]['function']],'%s',_0x2c124e):_0x2c124e;_0x2c124e=_0x40dc58[_0x547f9b][_0x4764('0x6d')]?_['replace'](_0x5e2016[_0x40dc58[_0x547f9b][_0x4764('0x6d')]],'%s',_0x2c124e):_0x2c124e;if(_0x40dc58[_0x547f9b][_0x4764('0x89')]){_0x31d21f[_0x4764('0x62')](_0x2c124e);}_0x40dc58[_0x547f9b][_0x4764('0x6f')]&&_0x31d21f[_0x4764('0x35')](_0x2c124e,_0x40dc58[_0x547f9b][_0x4764('0x6f')]===_0x4764('0x70')?![]:!![]);_0x31d21f['field'](_0x2c124e,_0x40dc58[_0x547f9b]['alias']||_0x2c124e);}if(_0x4d6c8f[_0x4764('0x71')]){_0x4d6c8f[_0x4764('0x71')]=JSON[_0x4764('0x79')](_0x4d6c8f[_0x4764('0x71')]);for(var _0x4f8fb3=0x0;_0x4f8fb3<_0x4d6c8f[_0x4764('0x71')][_0x4764('0x44')];_0x4f8fb3+=0x1){if(_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3]['type']&&_['includes'](_0x35b50a,_0x4d6c8f['joins'][_0x4f8fb3][_0x4764('0x2a')])&&_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3][_0x4764('0x73')]&&_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3][_0x4764('0x74')]&&_0x4d6c8f['joins'][_0x4f8fb3][_0x4764('0x75')]){_0x31d21f[_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3][_0x4764('0x2a')]](_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3]['foreignTable'],null,util[_0x4764('0x6d')](_0x4764('0x76'),_0x4d6c8f[_0x4764('0x77')],_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3][_0x4764('0x73')],_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3][_0x4764('0x74')],_0x4d6c8f[_0x4764('0x71')][_0x4f8fb3]['foreignKey']));}}}if(_0x4d6c8f[_0x4764('0x78')]){_0x4d6c8f[_0x4764('0x78')]=JSON['parse'](_0x4d6c8f[_0x4764('0x78')]);_0x31d21f[_0x4764('0x36')](_0x20f9b6(_0x4d6c8f[_0x4764('0x78')][_0x4764('0x62')]));}_0x1458a7=_0x31d21f[_0x4764('0x9c')]();_0x31d21f[_0x4764('0x34')](_0x1d9619);_0x31d21f[_0x4764('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x31d21f[_0x4764('0x7c')]());return dbH[_0x4764('0x7d')][_0x4764('0x2c')](_0x31d21f['toString'](),{'type':dbH[_0x4764('0x7d')]['QueryTypes'][_0x4764('0x7f')]});}})[_0x4764('0x1f')](function(){return{'sql':_0x1458a7[_0x4764('0x7c')]()};})[_0x4764('0x1f')](respondWithResult(_0x3e0f55,null))['catch'](handleError(_0x3e0f55,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index dc24b6f..183c0b9 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 _0xf955=['request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf955,0xf6));var _0x5f95=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xf955[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require('lodash');var util=require(_0x5f95('0x0'));var logger=require(_0x5f95('0x1'))(_0x5f95('0x2'));var moment=require(_0x5f95('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f95('0x5'));var config=require(_0x5f95('0x6'));var attributes=require(_0x5f95('0x7'));module['exports']=function(_0x290ca1,_0x3ac70c){return _0x290ca1[_0x5f95('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x5f95('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa986=['util','../../config/logger','moment','request-promise','rimraf','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0xcf450c,_0x53ea36){var _0x34a03b=function(_0x14ecb3){while(--_0x14ecb3){_0xcf450c['push'](_0xcf450c['shift']());}};_0x34a03b(++_0x53ea36);}(_0xa986,0x129));var _0x6a98=function(_0x417b2a,_0x3069f7){_0x417b2a=_0x417b2a-0x0;var _0x33ee18=_0xa986[_0x417b2a];return _0x33ee18;};'use strict';var _=require('lodash');var util=require(_0x6a98('0x0'));var logger=require(_0x6a98('0x1'))('api');var moment=require(_0x6a98('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a98('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a98('0x4'));var config=require('../../config/environment');var attributes=require(_0x6a98('0x5'));module['exports']=function(_0x9b88bd,_0x4113ee){return _0x9b88bd[_0x6a98('0x6')](_0x6a98('0x7'),attributes,{'tableName':_0x6a98('0x8'),'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 519e766..d4fcabe 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 _0x5b30=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5b30,0xcb));var _0x05b3=function(_0x5f0225,_0x52631a){_0x5f0225=_0x5f0225-0x0;var _0x2cef4b=_0x5b30[_0x5f0225];return _0x2cef4b;};'use strict';var _=require(_0x05b3('0x0'));var util=require(_0x05b3('0x1'));var moment=require(_0x05b3('0x2'));var BPromise=require(_0x05b3('0x3'));var rs=require(_0x05b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x05b3('0x5'));var logger=require(_0x05b3('0x6'))(_0x05b3('0x7'));var config=require(_0x05b3('0x8'));var jayson=require(_0x05b3('0x9'));var client=jayson[_0x05b3('0xa')][_0x05b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x171fd8,_0x4899cd,_0x1d75f8){return new BPromise(function(_0x4f44d9,_0x184d42){return client[_0x05b3('0xc')](_0x171fd8,_0x1d75f8)[_0x05b3('0xd')](function(_0x167f12){logger[_0x05b3('0xe')](_0x05b3('0xf'),_0x4899cd,_0x05b3('0x10'));logger['debug'](_0x05b3('0x11'),_0x4899cd,_0x05b3('0x10'),JSON[_0x05b3('0x12')](_0x167f12));if(_0x167f12[_0x05b3('0x13')]){if(_0x167f12[_0x05b3('0x13')][_0x05b3('0x14')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4899cd,_0x167f12['error']['message']);return _0x184d42(_0x167f12[_0x05b3('0x13')][_0x05b3('0x15')]);}logger[_0x05b3('0x13')](_0x05b3('0xf'),_0x4899cd,_0x167f12[_0x05b3('0x13')]['message']);return _0x4f44d9(_0x167f12[_0x05b3('0x13')][_0x05b3('0x15')]);}else{logger[_0x05b3('0xe')](_0x05b3('0xf'),_0x4899cd,'request\x20sent');_0x4f44d9(_0x167f12[_0x05b3('0x16')]['message']);}})[_0x05b3('0x17')](function(_0x1c8fd8){logger['error'](_0x05b3('0xf'),_0x4899cd,_0x1c8fd8);_0x184d42(_0x1c8fd8);});});} \ No newline at end of file +var _0x8696=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0xc971a4,_0x5b381c){var _0x4ebd6b=function(_0x371149){while(--_0x371149){_0xc971a4['push'](_0xc971a4['shift']());}};_0x4ebd6b(++_0x5b381c);}(_0x8696,0x11d));var _0x6869=function(_0x497c76,_0x4946bf){_0x497c76=_0x497c76-0x0;var _0x53e1fe=_0x8696[_0x497c76];return _0x53e1fe;};'use strict';var _=require(_0x6869('0x0'));var util=require(_0x6869('0x1'));var moment=require(_0x6869('0x2'));var BPromise=require(_0x6869('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6869('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6869('0x5'));var logger=require(_0x6869('0x6'))(_0x6869('0x7'));var config=require(_0x6869('0x8'));var jayson=require(_0x6869('0x9'));var client=jayson[_0x6869('0xa')][_0x6869('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38192e,_0x6e9eea,_0x43d997){return new BPromise(function(_0x50a062,_0xe0280e){return client[_0x6869('0xc')](_0x38192e,_0x43d997)[_0x6869('0xd')](function(_0x44692b){logger['info'](_0x6869('0xe'),_0x6e9eea,_0x6869('0xf'));logger[_0x6869('0x10')](_0x6869('0x11'),_0x6e9eea,_0x6869('0xf'),JSON[_0x6869('0x12')](_0x44692b));if(_0x44692b[_0x6869('0x13')]){if(_0x44692b['error']['code']===0x1f4){logger['error'](_0x6869('0xe'),_0x6e9eea,_0x44692b[_0x6869('0x13')][_0x6869('0x14')]);return _0xe0280e(_0x44692b[_0x6869('0x13')][_0x6869('0x14')]);}logger['error'](_0x6869('0xe'),_0x6e9eea,_0x44692b['error'][_0x6869('0x14')]);return _0x50a062(_0x44692b['error'][_0x6869('0x14')]);}else{logger[_0x6869('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6e9eea,_0x6869('0xf'));_0x50a062(_0x44692b[_0x6869('0x16')][_0x6869('0x14')]);}})[_0x6869('0x17')](function(_0x44f708){logger[_0x6869('0x13')](_0x6869('0xe'),_0x6e9eea,_0x44f708);_0xe0280e(_0x44f708);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7e4fa9f..ff57cd3 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 _0xba8f=['/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/preview','isAuthenticated','preview','/:id/run','run','post','create','put'];(function(_0x100459,_0x4d4893){var _0x2c9d9e=function(_0x574097){while(--_0x574097){_0x100459['push'](_0x100459['shift']());}};_0x2c9d9e(++_0x4d4893);}(_0xba8f,0xea));var _0xfba8=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0xba8f[_0x4ffa64];return _0x5da001;};'use strict';var multer=require(_0xfba8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfba8('0x1'));var express=require(_0xfba8('0x2'));var router=express[_0xfba8('0x3')]();var fs_extra=require(_0xfba8('0x4'));var auth=require(_0xfba8('0x5'));var interaction=require(_0xfba8('0x6'));var config=require(_0xfba8('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xfba8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfba8('0x9')]);router['get'](_0xfba8('0xa'),auth[_0xfba8('0xb')](),controller[_0xfba8('0xc')]);router[_0xfba8('0x8')](_0xfba8('0xd'),auth['isAuthenticated'](),controller[_0xfba8('0xe')]);router[_0xfba8('0x8')]('/:id/query',auth[_0xfba8('0xb')](),controller['query']);router[_0xfba8('0xf')]('/',auth[_0xfba8('0xb')](),controller[_0xfba8('0x10')]);router[_0xfba8('0x11')](_0xfba8('0x12'),auth['isAuthenticated'](),controller[_0xfba8('0x13')]);router['delete'](_0xfba8('0x12'),auth[_0xfba8('0xb')](),controller['destroy']);module[_0xfba8('0x14')]=router; \ No newline at end of file +var _0xa723=['run','/:id/query','query','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','/:id/run'];(function(_0x2b012b,_0x463e28){var _0x32c4cf=function(_0x5871f2){while(--_0x5871f2){_0x2b012b['push'](_0x2b012b['shift']());}};_0x32c4cf(++_0x463e28);}(_0xa723,0x111));var _0x3a72=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xa723[_0x5d8018];return _0x151ac4;};'use strict';var multer=require(_0x3a72('0x0'));var util=require(_0x3a72('0x1'));var path=require('path');var timeout=require(_0x3a72('0x2'));var express=require('express');var router=express[_0x3a72('0x3')]();var fs_extra=require(_0x3a72('0x4'));var auth=require(_0x3a72('0x5'));var interaction=require(_0x3a72('0x6'));var config=require(_0x3a72('0x7'));var controller=require(_0x3a72('0x8'));router[_0x3a72('0x9')]('/',auth[_0x3a72('0xa')](),controller[_0x3a72('0xb')]);router[_0x3a72('0x9')](_0x3a72('0xc'),auth[_0x3a72('0xa')](),controller['show']);router[_0x3a72('0x9')](_0x3a72('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x3a72('0x9')](_0x3a72('0xe'),auth['isAuthenticated'](),controller[_0x3a72('0xf')]);router[_0x3a72('0x9')](_0x3a72('0x10'),auth['isAuthenticated'](),controller[_0x3a72('0x11')]);router[_0x3a72('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3a72('0x13')]('/:id',auth[_0x3a72('0xa')](),controller[_0x3a72('0x14')]);router[_0x3a72('0x15')](_0x3a72('0xc'),auth[_0x3a72('0xa')](),controller[_0x3a72('0x16')]);module[_0x3a72('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 2d4a949..bb094ee 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x27308f,_0x38bdef){var _0x170edc=function(_0x7534f0){while(--_0x7534f0){_0x27308f['push'](_0x27308f['shift']());}};_0x170edc(++_0x38bdef);}(_0x98a8,0x12c));var _0x898a=function(_0x474092,_0x1f6725){_0x474092=_0x474092-0x0;var _0x22b1eb=_0x98a8[_0x474092];return _0x22b1eb;};'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 +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x35213e,_0x2bae59){var _0x2cc141=function(_0x35d45b){while(--_0x35d45b){_0x35213e['push'](_0x35213e['shift']());}};_0x2cc141(++_0x2bae59);}(_0xabce,0x103));var _0xeabc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xabce[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a0d1df5..83c044c 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 _0xc6ac=['keyBy','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','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x10af24,_0x22d03a){_0x10af24=_0x10af24-0x0;var _0x4bcd4a=_0xc6ac[_0x10af24];return _0x4bcd4a;};'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'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6b58679..814fd6f 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 _0xb1f2=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports'];(function(_0x313047,_0x132c12){var _0x45ac45=function(_0x174e1b){while(--_0x174e1b){_0x313047['push'](_0x313047['shift']());}};_0x45ac45(++_0x132c12);}(_0xb1f2,0x129));var _0x2b1f=function(_0x144d0f,_0x1b1808){_0x144d0f=_0x144d0f-0x0;var _0x1c90c3=_0xb1f2[_0x144d0f];return _0x1c90c3;};'use strict';var _=require(_0x2b1f('0x0'));var util=require('util');var logger=require(_0x2b1f('0x1'))(_0x2b1f('0x2'));var moment=require(_0x2b1f('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b1f('0x4'));var fs=require('fs');var path=require(_0x2b1f('0x5'));var rimraf=require(_0x2b1f('0x6'));var config=require(_0x2b1f('0x7'));var attributes=require(_0x2b1f('0x8'));module[_0x2b1f('0x9')]=function(_0x110406,_0x2dc53f){return _0x110406['define']('AnalyticDefaultReport',attributes,{'tableName':_0x2b1f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc212=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x6cc31,_0x1b7e36){var _0xd14416=function(_0x22d9ad){while(--_0x22d9ad){_0x6cc31['push'](_0x6cc31['shift']());}};_0xd14416(++_0x1b7e36);}(_0xc212,0x19d));var _0x2c21=function(_0x4b738f,_0x5d2237){_0x4b738f=_0x4b738f-0x0;var _0x3c8b1f=_0xc212[_0x4b738f];return _0x3c8b1f;};'use strict';var _=require(_0x2c21('0x0'));var util=require(_0x2c21('0x1'));var logger=require(_0x2c21('0x2'))(_0x2c21('0x3'));var moment=require(_0x2c21('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c21('0x5'));var fs=require('fs');var path=require(_0x2c21('0x6'));var rimraf=require(_0x2c21('0x7'));var config=require(_0x2c21('0x8'));var attributes=require(_0x2c21('0x9'));module[_0x2c21('0xa')]=function(_0x331c58,_0x3b81c5){return _0x331c58[_0x2c21('0xb')](_0x2c21('0xc'),attributes,{'tableName':_0x2c21('0xd'),'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 52651f1..5836eb4 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 _0x6d03=['client','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a8fe4,_0x3eebe1){var _0x1d401c=function(_0x248a85){while(--_0x248a85){_0x5a8fe4['push'](_0x5a8fe4['shift']());}};_0x1d401c(++_0x3eebe1);}(_0x6d03,0x147));var _0x36d0=function(_0x89012e,_0x3b9442){_0x89012e=_0x89012e-0x0;var _0x57fb57=_0x6d03[_0x89012e];return _0x57fb57;};'use strict';var _=require(_0x36d0('0x0'));var util=require(_0x36d0('0x1'));var moment=require(_0x36d0('0x2'));var BPromise=require(_0x36d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36d0('0x5'));var logger=require(_0x36d0('0x6'))(_0x36d0('0x7'));var config=require(_0x36d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x36d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3d12,_0x26c4ee,_0x588636){return new BPromise(function(_0x432a3c,_0x5b9839){return client['request'](_0x4c3d12,_0x588636)[_0x36d0('0xa')](function(_0x14d5f7){logger['info'](_0x36d0('0xb'),_0x26c4ee,'request\x20sent');logger[_0x36d0('0xc')](_0x36d0('0xd'),_0x26c4ee,_0x36d0('0xe'),JSON[_0x36d0('0xf')](_0x14d5f7));if(_0x14d5f7['error']){if(_0x14d5f7[_0x36d0('0x10')][_0x36d0('0x11')]===0x1f4){logger[_0x36d0('0x10')](_0x36d0('0xb'),_0x26c4ee,_0x14d5f7[_0x36d0('0x10')][_0x36d0('0x12')]);return _0x5b9839(_0x14d5f7[_0x36d0('0x10')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x26c4ee,_0x14d5f7[_0x36d0('0x10')][_0x36d0('0x12')]);return _0x432a3c(_0x14d5f7['error'][_0x36d0('0x12')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x26c4ee,_0x36d0('0xe'));_0x432a3c(_0x14d5f7[_0x36d0('0x13')]['message']);}})[_0x36d0('0x14')](function(_0x5da24b){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x26c4ee,_0x5da24b);_0x5b9839(_0x5da24b);});});} \ No newline at end of file +var _0xab1a=['rpc','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0xab1a,0x6c));var _0xaab1=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xab1a[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xaab1('0x0'));var util=require(_0xaab1('0x1'));var moment=require(_0xaab1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaab1('0x4'));var logger=require(_0xaab1('0x5'))(_0xaab1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaab1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44b9f0,_0x1850af,_0x2df386){return new BPromise(function(_0x4da149,_0x3b6f11){return client[_0xaab1('0x8')](_0x44b9f0,_0x2df386)[_0xaab1('0x9')](function(_0x9b8474){logger['info'](_0xaab1('0xa'),_0x1850af,_0xaab1('0xb'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1850af,'request\x20sent',JSON[_0xaab1('0xc')](_0x9b8474));if(_0x9b8474[_0xaab1('0xd')]){if(_0x9b8474['error'][_0xaab1('0xe')]===0x1f4){logger[_0xaab1('0xd')](_0xaab1('0xa'),_0x1850af,_0x9b8474[_0xaab1('0xd')][_0xaab1('0xf')]);return _0x3b6f11(_0x9b8474['error'][_0xaab1('0xf')]);}logger[_0xaab1('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1850af,_0x9b8474[_0xaab1('0xd')][_0xaab1('0xf')]);return _0x4da149(_0x9b8474['error']['message']);}else{logger[_0xaab1('0x10')](_0xaab1('0xa'),_0x1850af,_0xaab1('0xb'));_0x4da149(_0x9b8474[_0xaab1('0x11')][_0xaab1('0xf')]);}})[_0xaab1('0x12')](function(_0x1e65a6){logger['error'](_0xaab1('0xa'),_0x1850af,_0x1e65a6);_0x3b6f11(_0x1e65a6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0e61fee..21a8021 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 _0x871e=['get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x49596e,_0x3761ff){var _0x353f54=function(_0x390951){while(--_0x390951){_0x49596e['push'](_0x49596e['shift']());}};_0x353f54(++_0x3761ff);}(_0x871e,0x185));var _0xe871=function(_0x243ab9,_0x21f034){_0x243ab9=_0x243ab9-0x0;var _0x9091d1=_0x871e[_0x243ab9];return _0x9091d1;};'use strict';var multer=require(_0xe871('0x0'));var util=require(_0xe871('0x1'));var path=require('path');var timeout=require(_0xe871('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe871('0x3'));var interaction=require(_0xe871('0x4'));var config=require(_0xe871('0x5'));var controller=require(_0xe871('0x6'));router[_0xe871('0x7')]('/',auth[_0xe871('0x8')](),controller[_0xe871('0x9')]);router['get'](_0xe871('0xa'),auth['isAuthenticated'](),controller[_0xe871('0xb')]);router['get']('/:id/preview',auth[_0xe871('0x8')](),controller[_0xe871('0xc')]);router[_0xe871('0x7')](_0xe871('0xd'),auth['isAuthenticated'](),controller[_0xe871('0xe')]);router[_0xe871('0x7')](_0xe871('0xf'),auth['isAuthenticated'](),controller[_0xe871('0x10')]);router[_0xe871('0x11')]('/',auth[_0xe871('0x8')](),controller[_0xe871('0x12')]);router[_0xe871('0x13')]('/:id',auth[_0xe871('0x8')](),controller[_0xe871('0x14')]);router['delete'](_0xe871('0xa'),auth[_0xe871('0x8')](),controller[_0xe871('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfcfc=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3817da,_0x1a324e){var _0x2e8245=function(_0x4e2640){while(--_0x4e2640){_0x3817da['push'](_0x3817da['shift']());}};_0x2e8245(++_0x1a324e);}(_0xfcfc,0x9b));var _0xcfcf=function(_0x51dbac,_0x1323ce){_0x51dbac=_0x51dbac-0x0;var _0x23c7d8=_0xfcfc[_0x51dbac];return _0x23c7d8;};'use strict';var multer=require(_0xcfcf('0x0'));var util=require(_0xcfcf('0x1'));var path=require('path');var timeout=require(_0xcfcf('0x2'));var express=require('express');var router=express[_0xcfcf('0x3')]();var fs_extra=require(_0xcfcf('0x4'));var auth=require(_0xcfcf('0x5'));var interaction=require(_0xcfcf('0x6'));var config=require(_0xcfcf('0x7'));var controller=require(_0xcfcf('0x8'));router[_0xcfcf('0x9')]('/',auth[_0xcfcf('0xa')](),controller[_0xcfcf('0xb')]);router[_0xcfcf('0x9')](_0xcfcf('0xc'),auth[_0xcfcf('0xa')](),controller[_0xcfcf('0xd')]);router[_0xcfcf('0x9')](_0xcfcf('0xe'),auth[_0xcfcf('0xa')](),controller['preview']);router[_0xcfcf('0x9')](_0xcfcf('0xf'),auth['isAuthenticated'](),controller[_0xcfcf('0x10')]);router[_0xcfcf('0x9')](_0xcfcf('0x11'),auth['isAuthenticated'](),controller['query']);router[_0xcfcf('0x12')]('/',auth[_0xcfcf('0xa')](),controller[_0xcfcf('0x13')]);router[_0xcfcf('0x14')](_0xcfcf('0xc'),auth[_0xcfcf('0xa')](),controller['update']);router['delete'](_0xcfcf('0xc'),auth[_0xcfcf('0xa')](),controller[_0xcfcf('0x15')]);module[_0xcfcf('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index da45918..6553f32 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 _0x494e=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','sequelize'];(function(_0x4dcd00,_0x569998){var _0x345dc5=function(_0x19deb7){while(--_0x19deb7){_0x4dcd00['push'](_0x4dcd00['shift']());}};_0x345dc5(++_0x569998);}(_0x494e,0x18b));var _0xe494=function(_0x236877,_0x4fca22){_0x236877=_0x236877-0x0;var _0x499490=_0x494e[_0x236877];return _0x499490;};'use strict';var Sequelize=require(_0xe494('0x0'));var moment=require('moment');module[_0xe494('0x1')]={'name':{'type':Sequelize[_0xe494('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xe494('0x3')](_0xe494('0x4'),_0xe494('0x5'),_0xe494('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xe494('0x7')]},'status':{'type':Sequelize[_0xe494('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xe494('0x3')](_0xe494('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xe494('0x2')]}}; \ No newline at end of file +var _0xba52=['DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv','xlsx'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0xba52,0x144));var _0x2ba5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba52[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2ba5('0x0'));var moment=require('moment');module[_0x2ba5('0x1')]={'name':{'type':Sequelize[_0x2ba5('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2ba5('0x3')](_0x2ba5('0x4'),'pdf',_0x2ba5('0x5')),'allowNull':![],'defaultValue':_0x2ba5('0x4')},'savename':{'type':Sequelize[_0x2ba5('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2ba5('0x6')]},'endDate':{'type':Sequelize[_0x2ba5('0x6')]},'status':{'type':Sequelize[_0x2ba5('0x2')],'defaultValue':_0x2ba5('0x7')},'type':{'type':Sequelize[_0x2ba5('0x3')](_0x2ba5('0x8'),_0x2ba5('0x9')),'allowNull':![],'defaultValue':_0x2ba5('0x8')},'reportId':{'type':Sequelize[_0x2ba5('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x2ba5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 53c98d0..970bc92 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 _0x8f9f=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','AnalyticExtractedReport','include','findAll','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0xd05cef,_0x1bbf5c){var _0x4e113e=function(_0x3d1bab){while(--_0x3d1bab){_0xd05cef['push'](_0xd05cef['shift']());}};_0x4e113e(++_0x1bbf5c);}(_0x8f9f,0x16e));var _0xf8f9=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x8f9f[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0xf8f9('0x0'));var rimraf=require(_0xf8f9('0x1'));var zipdir=require(_0xf8f9('0x2'));var jsonpatch=require(_0xf8f9('0x3'));var rp=require(_0xf8f9('0x4'));var moment=require(_0xf8f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8f9('0x6'));var util=require(_0xf8f9('0x7'));var path=require(_0xf8f9('0x8'));var sox=require(_0xf8f9('0x9'));var csv=require(_0xf8f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8f9('0xb'));var _=require(_0xf8f9('0xc'));var squel=require(_0xf8f9('0xd'));var crypto=require('crypto');var jsforce=require(_0xf8f9('0xe'));var deskjs=require(_0xf8f9('0xf'));var toCsv=require(_0xf8f9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8f9('0x10'));var authService=require(_0xf8f9('0x11'));var qs=require(_0xf8f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8f9('0x13'))('api');var utils=require(_0xf8f9('0x14'));var config=require(_0xf8f9('0x15'));var licenseUtil=require(_0xf8f9('0x16'));var db=require(_0xf8f9('0x17'))['db'];function respondWithStatusCode(_0x59a68a,_0x18a084){_0x18a084=_0x18a084||0xcc;return function(_0x55ff73){if(_0x55ff73){return _0x59a68a[_0xf8f9('0x18')](_0x18a084);}return _0x59a68a[_0xf8f9('0x19')](_0x18a084)['end']();};}function respondWithResult(_0x4ae200,_0x2050f8){_0x2050f8=_0x2050f8||0xc8;return function(_0x581274){if(_0x581274){return _0x4ae200[_0xf8f9('0x19')](_0x2050f8)[_0xf8f9('0x1a')](_0x581274);}};}function respondWithFilteredResult(_0x3aed81,_0x378c61){return function(_0x4f9e67){if(_0x4f9e67){var _0x5acca7=typeof _0x378c61[_0xf8f9('0x1b')]===_0xf8f9('0x1c')&&typeof _0x378c61[_0xf8f9('0x1d')]===_0xf8f9('0x1c');var _0x4ef500=_0x4f9e67[_0xf8f9('0x1e')];var _0x3ddceb=_0x5acca7?0x0:_0x378c61[_0xf8f9('0x1b')];var _0x2ab7e8=_0x5acca7?_0x4f9e67[_0xf8f9('0x1e')]:_0x378c61[_0xf8f9('0x1b')]+_0x378c61[_0xf8f9('0x1d')];var _0x393884;if(_0x2ab7e8>=_0x4ef500){_0x2ab7e8=_0x4ef500;_0x393884=0xc8;}else{_0x393884=0xce;}_0x3aed81['status'](_0x393884);return _0x3aed81[_0xf8f9('0x1f')](_0xf8f9('0x20'),_0x3ddceb+'-'+_0x2ab7e8+'/'+_0x4ef500)[_0xf8f9('0x1a')](_0x4f9e67);}return null;};}function patchUpdates(_0x3d37d8){return function(_0x34e4f9){try{jsonpatch[_0xf8f9('0x21')](_0x34e4f9,_0x3d37d8,!![]);}catch(_0x432916){return BPromise[_0xf8f9('0x22')](_0x432916);}return _0x34e4f9[_0xf8f9('0x23')]();};}function saveUpdates(_0x24015d,_0x42f607){return function(_0x5bf161){if(_0x5bf161){return _0x5bf161[_0xf8f9('0x24')](_0x24015d)[_0xf8f9('0x25')](function(_0x1f9c3c){return _0x1f9c3c;});}return null;};}function removeEntity(_0x32a596,_0x30069b){return function(_0x554de7){if(_0x554de7){return _0x554de7[_0xf8f9('0x26')]()[_0xf8f9('0x25')](function(){var _0x5da347=_0x554de7['get']({'plain':!![]});var _0x4d06c0=_0xf8f9('0x27');return db[_0xf8f9('0x28')][_0xf8f9('0x26')]({'where':{'type':_0x4d06c0,'resourceId':_0x5da347['id']}})[_0xf8f9('0x25')](function(){return _0x554de7;});})[_0xf8f9('0x25')](function(){_0x32a596[_0xf8f9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49bd82,_0x89593e){return function(_0x473539){if(!_0x473539){_0x49bd82[_0xf8f9('0x18')](0x194);}return _0x473539;};}function handleError(_0x12e6aa,_0x390b36){_0x390b36=_0x390b36||0x1f4;return function(_0xae774){logger[_0xf8f9('0x29')](_0xae774[_0xf8f9('0x2a')]);if(_0xae774['name']){delete _0xae774[_0xf8f9('0x2b')];}_0x12e6aa[_0xf8f9('0x19')](_0x390b36)[_0xf8f9('0x2c')](_0xae774);};}exports['index']=function(_0x306e1b,_0x345c5e){var _0x4a757c={},_0x18cb68={},_0x58e93c={'count':0x0,'rows':[]};var _0x961512=_[_0xf8f9('0x2d')](db['AnalyticExtractedReport'][_0xf8f9('0x2e')],function(_0x407be7){return{'name':_0x407be7[_0xf8f9('0x2f')],'type':_0x407be7[_0xf8f9('0x30')][_0xf8f9('0x31')]};});_0x18cb68[_0xf8f9('0x32')]=_['map'](_0x961512,'name');_0x18cb68['query']=_['keys'](_0x306e1b[_0xf8f9('0x33')]);_0x18cb68[_0xf8f9('0x34')]=_['intersection'](_0x18cb68[_0xf8f9('0x32')],_0x18cb68[_0xf8f9('0x33')]);_0x4a757c[_0xf8f9('0x35')]=_[_0xf8f9('0x36')](_0x18cb68[_0xf8f9('0x32')],qs[_0xf8f9('0x37')](_0x306e1b[_0xf8f9('0x33')][_0xf8f9('0x37')]));_0x4a757c['attributes']=_0x4a757c[_0xf8f9('0x35')][_0xf8f9('0x38')]?_0x4a757c['attributes']:_0x18cb68['model'];if(!_0x306e1b[_0xf8f9('0x33')][_0xf8f9('0x39')](_0xf8f9('0x3a'))){_0x4a757c[_0xf8f9('0x1d')]=qs[_0xf8f9('0x1d')](_0x306e1b[_0xf8f9('0x33')][_0xf8f9('0x1d')]);_0x4a757c['offset']=qs[_0xf8f9('0x1b')](_0x306e1b[_0xf8f9('0x33')][_0xf8f9('0x1b')]);}_0x4a757c[_0xf8f9('0x3b')]=qs[_0xf8f9('0x3c')](_0x306e1b[_0xf8f9('0x33')]['sort']);_0x4a757c[_0xf8f9('0x3d')]=qs['filters'](_[_0xf8f9('0x3e')](_0x306e1b['query'],_0x18cb68[_0xf8f9('0x34')]),_0x961512);if(_0x306e1b[_0xf8f9('0x33')]['filter']){_0x4a757c[_0xf8f9('0x3d')]=_[_0xf8f9('0x3f')](_0x4a757c['where'],{'$or':_[_0xf8f9('0x2d')](_0x961512,function(_0x2b7a79){if(_0x2b7a79[_0xf8f9('0x30')]!==_0xf8f9('0x40')){var _0x3bf416={};_0x3bf416[_0x2b7a79[_0xf8f9('0x2b')]]={'$like':'%'+_0x306e1b[_0xf8f9('0x33')]['filter']+'%'};return _0x3bf416;}})});}_0x4a757c=_[_0xf8f9('0x3f')]({},_0x4a757c,_0x306e1b[_0xf8f9('0x41')]);var _0x50975a={'where':_0x4a757c['where']};return db[_0xf8f9('0x42')][_0xf8f9('0x1e')](_0x50975a)[_0xf8f9('0x25')](function(_0x1cabaf){_0x58e93c[_0xf8f9('0x1e')]=_0x1cabaf;if(_0x306e1b[_0xf8f9('0x33')]['includeAll']){_0x4a757c[_0xf8f9('0x43')]=[{'all':!![]}];}return db[_0xf8f9('0x42')][_0xf8f9('0x44')](_0x4a757c);})[_0xf8f9('0x25')](function(_0x117704){_0x58e93c['rows']=_0x117704;return _0x58e93c;})[_0xf8f9('0x25')](respondWithFilteredResult(_0x345c5e,_0x4a757c))[_0xf8f9('0x45')](handleError(_0x345c5e,null));};exports[_0xf8f9('0x46')]=function(_0xb5ca58,_0x2b6fd7){var _0x232512={'raw':!![],'where':{'id':_0xb5ca58[_0xf8f9('0x47')]['id']}},_0x2541b3={};_0x2541b3['model']=_[_0xf8f9('0x48')](db['AnalyticExtractedReport'][_0xf8f9('0x2e')]);_0x2541b3[_0xf8f9('0x33')]=_[_0xf8f9('0x48')](_0xb5ca58[_0xf8f9('0x33')]);_0x2541b3[_0xf8f9('0x34')]=_['intersection'](_0x2541b3[_0xf8f9('0x32')],_0x2541b3[_0xf8f9('0x33')]);_0x232512[_0xf8f9('0x35')]=_[_0xf8f9('0x36')](_0x2541b3[_0xf8f9('0x32')],qs['fields'](_0xb5ca58[_0xf8f9('0x33')][_0xf8f9('0x37')]));_0x232512['attributes']=_0x232512[_0xf8f9('0x35')][_0xf8f9('0x38')]?_0x232512[_0xf8f9('0x35')]:_0x2541b3[_0xf8f9('0x32')];if(_0xb5ca58['query'][_0xf8f9('0x49')]){_0x232512[_0xf8f9('0x43')]=[{'all':!![]}];}_0x232512=_[_0xf8f9('0x3f')]({},_0x232512,_0xb5ca58[_0xf8f9('0x41')]);return db[_0xf8f9('0x42')][_0xf8f9('0x4a')](_0x232512)[_0xf8f9('0x25')](handleEntityNotFound(_0x2b6fd7,null))[_0xf8f9('0x25')](respondWithResult(_0x2b6fd7,null))['catch'](handleError(_0x2b6fd7,null));};exports[_0xf8f9('0x4b')]=function(_0x129b71,_0x59a8ed){return db[_0xf8f9('0x42')][_0xf8f9('0x4b')](_0x129b71[_0xf8f9('0x4c')],{})[_0xf8f9('0x25')](function(_0x56fd57){var _0x3a9fa1=_0x129b71['user']['get']({'plain':!![]});if(!_0x3a9fa1)throw new Error(_0xf8f9('0x4d'));if(_0x3a9fa1[_0xf8f9('0x4e')]===_0xf8f9('0x4f')){var _0x430f35=_0x56fd57[_0xf8f9('0x50')]({'plain':!![]});var _0x1cacbe='ExtractedReports';return db[_0xf8f9('0x51')][_0xf8f9('0x4a')]({'where':{'name':_0x1cacbe,'userProfileId':_0x3a9fa1[_0xf8f9('0x52')]},'raw':!![]})[_0xf8f9('0x25')](function(_0x15c1b8){if(_0x15c1b8&&_0x15c1b8[_0xf8f9('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x430f35[_0xf8f9('0x2b')],'resourceId':_0x430f35['id'],'type':_0x15c1b8[_0xf8f9('0x2b')],'sectionId':_0x15c1b8['id']},{})[_0xf8f9('0x25')](function(){return _0x56fd57;});}else{return _0x56fd57;}})[_0xf8f9('0x45')](function(_0x496cc3){logger[_0xf8f9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x496cc3);throw _0x496cc3;});}return _0x56fd57;})['then'](respondWithResult(_0x59a8ed,0xc9))[_0xf8f9('0x45')](handleError(_0x59a8ed,null));};exports[_0xf8f9('0x24')]=function(_0x29c8ad,_0xda29bb){if(_0x29c8ad[_0xf8f9('0x4c')]['id']){delete _0x29c8ad[_0xf8f9('0x4c')]['id'];}return db[_0xf8f9('0x42')][_0xf8f9('0x4a')]({'where':{'id':_0x29c8ad[_0xf8f9('0x47')]['id']}})[_0xf8f9('0x25')](handleEntityNotFound(_0xda29bb,null))[_0xf8f9('0x25')](saveUpdates(_0x29c8ad[_0xf8f9('0x4c')],null))[_0xf8f9('0x25')](respondWithResult(_0xda29bb,null))[_0xf8f9('0x45')](handleError(_0xda29bb,null));};exports['destroy']=function(_0x2e0674,_0x39c4fc){return db[_0xf8f9('0x42')][_0xf8f9('0x4a')]({'where':{'id':_0x2e0674[_0xf8f9('0x47')]['id']}})[_0xf8f9('0x25')](handleEntityNotFound(_0x39c4fc,null))['then'](removeEntity(_0x39c4fc,null))[_0xf8f9('0x45')](handleError(_0x39c4fc,null));};exports[_0xf8f9('0x54')]=function(_0x5e64c0,_0x520fc5,_0x5b4be2){return db[_0xf8f9('0x42')][_0xf8f9('0x4a')]({'where':{'id':_0x5e64c0[_0xf8f9('0x47')]['id']},'attributes':['name',_0xf8f9('0x55'),_0xf8f9('0x56'),_0xf8f9('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x520fc5,null))[_0xf8f9('0x25')](function(_0x192dcd){if(_0x192dcd){if(!fs[_0xf8f9('0x58')](path[_0xf8f9('0x59')](config[_0xf8f9('0x5a')],_0xf8f9('0x5b'),_0x192dcd[_0xf8f9('0x56')]))){throw new db[(_0xf8f9('0x5c'))][(_0xf8f9('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5e64c0[_0xf8f9('0x33')][_0xf8f9('0x5e')]){return _0x520fc5[_0xf8f9('0x18')](0xc8);}return _0x520fc5['download'](path[_0xf8f9('0x59')](config['root'],_0xf8f9('0x5b'),_0x192dcd['savename']),util['format'](_0xf8f9('0x5f'),_0x192dcd[_0xf8f9('0x55')]||_0x192dcd['name'],_0x192dcd[_0xf8f9('0x57')][_0xf8f9('0x60')]()));}})[_0xf8f9('0x45')](handleError(_0x520fc5,null));}; \ No newline at end of file +var _0x0863=['find','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','ExtractedReports','destroy','error','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x0863,0x6b));var _0x3086=function(_0x14a98e,_0x4f2bff){_0x14a98e=_0x14a98e-0x0;var _0x28b77a=_0x0863[_0x14a98e];return _0x28b77a;};'use strict';var emlformat=require(_0x3086('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3086('0x1'));var rp=require(_0x3086('0x2'));var moment=require(_0x3086('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3086('0x4'));var util=require(_0x3086('0x5'));var path=require('path');var sox=require(_0x3086('0x6'));var csv=require('to-csv');var ejs=require(_0x3086('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3086('0x8'));var squel=require(_0x3086('0x9'));var crypto=require('crypto');var jsforce=require(_0x3086('0xa'));var deskjs=require(_0x3086('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3086('0xc'));var Redis=require(_0x3086('0xd'));var authService=require(_0x3086('0xe'));var qs=require(_0x3086('0xf'));var as=require(_0x3086('0x10'));var hardwareService=require(_0x3086('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3086('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3086('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b30a9,_0x113803){_0x113803=_0x113803||0xcc;return function(_0x29dc9c){if(_0x29dc9c){return _0x5b30a9[_0x3086('0x14')](_0x113803);}return _0x5b30a9['status'](_0x113803)[_0x3086('0x15')]();};}function respondWithResult(_0x48a03a,_0x4f62bf){_0x4f62bf=_0x4f62bf||0xc8;return function(_0x189b00){if(_0x189b00){return _0x48a03a[_0x3086('0x16')](_0x4f62bf)['json'](_0x189b00);}};}function respondWithFilteredResult(_0xe9eb18,_0x5c74c2){return function(_0x277824){if(_0x277824){var _0x1d337c=typeof _0x5c74c2[_0x3086('0x17')]===_0x3086('0x18')&&typeof _0x5c74c2[_0x3086('0x19')]===_0x3086('0x18');var _0x14f586=_0x277824['count'];var _0x179357=_0x1d337c?0x0:_0x5c74c2[_0x3086('0x17')];var _0x16a316=_0x1d337c?_0x277824[_0x3086('0x1a')]:_0x5c74c2[_0x3086('0x17')]+_0x5c74c2['limit'];var _0x373734;if(_0x16a316>=_0x14f586){_0x16a316=_0x14f586;_0x373734=0xc8;}else{_0x373734=0xce;}_0xe9eb18[_0x3086('0x16')](_0x373734);return _0xe9eb18[_0x3086('0x1b')](_0x3086('0x1c'),_0x179357+'-'+_0x16a316+'/'+_0x14f586)[_0x3086('0x1d')](_0x277824);}return null;};}function patchUpdates(_0x50ba19){return function(_0x4c38e4){try{jsonpatch[_0x3086('0x1e')](_0x4c38e4,_0x50ba19,!![]);}catch(_0x45e099){return BPromise['reject'](_0x45e099);}return _0x4c38e4[_0x3086('0x1f')]();};}function saveUpdates(_0x54d5d8,_0x590c3d){return function(_0x54edc6){if(_0x54edc6){return _0x54edc6[_0x3086('0x20')](_0x54d5d8)[_0x3086('0x21')](function(_0x34ccc8){return _0x34ccc8;});}return null;};}function removeEntity(_0x30f9f5,_0xb7006a){return function(_0x1c21a1){if(_0x1c21a1){return _0x1c21a1['destroy']()[_0x3086('0x21')](function(){var _0x5321a5=_0x1c21a1['get']({'plain':!![]});var _0x30ea28=_0x3086('0x22');return db['UserProfileResource'][_0x3086('0x23')]({'where':{'type':_0x30ea28,'resourceId':_0x5321a5['id']}})[_0x3086('0x21')](function(){return _0x1c21a1;});})[_0x3086('0x21')](function(){_0x30f9f5['status'](0xcc)[_0x3086('0x15')]();});}};}function handleEntityNotFound(_0xa52203,_0x452495){return function(_0x240940){if(!_0x240940){_0xa52203[_0x3086('0x14')](0x194);}return _0x240940;};}function handleError(_0xf4f3ea,_0x1e785d){_0x1e785d=_0x1e785d||0x1f4;return function(_0x25bb4e){logger[_0x3086('0x24')](_0x25bb4e['stack']);if(_0x25bb4e[_0x3086('0x25')]){delete _0x25bb4e[_0x3086('0x25')];}_0xf4f3ea[_0x3086('0x16')](_0x1e785d)['send'](_0x25bb4e);};}exports[_0x3086('0x26')]=function(_0x4b6398,_0x2beb0a){var _0x3e38eb={},_0x513c02={},_0x1cf8ca={'count':0x0,'rows':[]};var _0x5eff1a=_[_0x3086('0x27')](db[_0x3086('0x28')][_0x3086('0x29')],function(_0x6237f9){return{'name':_0x6237f9[_0x3086('0x2a')],'type':_0x6237f9[_0x3086('0x2b')]['key']};});_0x513c02[_0x3086('0x2c')]=_[_0x3086('0x27')](_0x5eff1a,_0x3086('0x25'));_0x513c02['query']=_[_0x3086('0x2d')](_0x4b6398['query']);_0x513c02[_0x3086('0x2e')]=_[_0x3086('0x2f')](_0x513c02[_0x3086('0x2c')],_0x513c02[_0x3086('0x30')]);_0x3e38eb[_0x3086('0x31')]=_['intersection'](_0x513c02['model'],qs[_0x3086('0x32')](_0x4b6398[_0x3086('0x30')][_0x3086('0x32')]));_0x3e38eb[_0x3086('0x31')]=_0x3e38eb[_0x3086('0x31')][_0x3086('0x33')]?_0x3e38eb[_0x3086('0x31')]:_0x513c02[_0x3086('0x2c')];if(!_0x4b6398['query'][_0x3086('0x34')](_0x3086('0x35'))){_0x3e38eb[_0x3086('0x19')]=qs[_0x3086('0x19')](_0x4b6398[_0x3086('0x30')][_0x3086('0x19')]);_0x3e38eb[_0x3086('0x17')]=qs[_0x3086('0x17')](_0x4b6398[_0x3086('0x30')][_0x3086('0x17')]);}_0x3e38eb[_0x3086('0x36')]=qs[_0x3086('0x37')](_0x4b6398[_0x3086('0x30')][_0x3086('0x37')]);_0x3e38eb[_0x3086('0x38')]=qs[_0x3086('0x2e')](_[_0x3086('0x39')](_0x4b6398[_0x3086('0x30')],_0x513c02['filters']),_0x5eff1a);if(_0x4b6398['query']['filter']){_0x3e38eb[_0x3086('0x38')]=_['merge'](_0x3e38eb[_0x3086('0x38')],{'$or':_[_0x3086('0x27')](_0x5eff1a,function(_0x8c6bd6){if(_0x8c6bd6[_0x3086('0x2b')]!=='VIRTUAL'){var _0x777308={};_0x777308[_0x8c6bd6['name']]={'$like':'%'+_0x4b6398[_0x3086('0x30')]['filter']+'%'};return _0x777308;}})});}_0x3e38eb=_[_0x3086('0x3a')]({},_0x3e38eb,_0x4b6398['options']);var _0x4db292={'where':_0x3e38eb[_0x3086('0x38')]};return db[_0x3086('0x28')][_0x3086('0x1a')](_0x4db292)[_0x3086('0x21')](function(_0x200f56){_0x1cf8ca['count']=_0x200f56;if(_0x4b6398[_0x3086('0x30')][_0x3086('0x3b')]){_0x3e38eb[_0x3086('0x3c')]=[{'all':!![]}];}return db[_0x3086('0x28')][_0x3086('0x3d')](_0x3e38eb);})[_0x3086('0x21')](function(_0x345e12){_0x1cf8ca[_0x3086('0x3e')]=_0x345e12;return _0x1cf8ca;})[_0x3086('0x21')](respondWithFilteredResult(_0x2beb0a,_0x3e38eb))[_0x3086('0x3f')](handleError(_0x2beb0a,null));};exports[_0x3086('0x40')]=function(_0xa538fc,_0x425e28){var _0x4dd991={'raw':!![],'where':{'id':_0xa538fc[_0x3086('0x41')]['id']}},_0x40c995={};_0x40c995[_0x3086('0x2c')]=_[_0x3086('0x2d')](db[_0x3086('0x28')][_0x3086('0x29')]);_0x40c995[_0x3086('0x30')]=_['keys'](_0xa538fc['query']);_0x40c995[_0x3086('0x2e')]=_[_0x3086('0x2f')](_0x40c995['model'],_0x40c995[_0x3086('0x30')]);_0x4dd991[_0x3086('0x31')]=_[_0x3086('0x2f')](_0x40c995[_0x3086('0x2c')],qs[_0x3086('0x32')](_0xa538fc['query'][_0x3086('0x32')]));_0x4dd991[_0x3086('0x31')]=_0x4dd991[_0x3086('0x31')][_0x3086('0x33')]?_0x4dd991[_0x3086('0x31')]:_0x40c995['model'];if(_0xa538fc[_0x3086('0x30')][_0x3086('0x3b')]){_0x4dd991[_0x3086('0x3c')]=[{'all':!![]}];}_0x4dd991=_['merge']({},_0x4dd991,_0xa538fc[_0x3086('0x42')]);return db[_0x3086('0x28')]['find'](_0x4dd991)['then'](handleEntityNotFound(_0x425e28,null))[_0x3086('0x21')](respondWithResult(_0x425e28,null))[_0x3086('0x3f')](handleError(_0x425e28,null));};exports[_0x3086('0x43')]=function(_0xcb9eea,_0x2e1d62){return db[_0x3086('0x28')]['create'](_0xcb9eea['body'],{})[_0x3086('0x21')](function(_0x228393){var _0x34c448=_0xcb9eea[_0x3086('0x44')][_0x3086('0x45')]({'plain':!![]});if(!_0x34c448)throw new Error(_0x3086('0x46'));if(_0x34c448[_0x3086('0x47')]===_0x3086('0x44')){var _0x40cb32=_0x228393[_0x3086('0x45')]({'plain':!![]});var _0x5d278b=_0x3086('0x22');return db[_0x3086('0x48')]['find']({'where':{'name':_0x5d278b,'userProfileId':_0x34c448[_0x3086('0x49')]},'raw':!![]})['then'](function(_0x1df449){if(_0x1df449&&_0x1df449[_0x3086('0x4a')]===0x0){return db[_0x3086('0x4b')][_0x3086('0x43')]({'name':_0x40cb32['name'],'resourceId':_0x40cb32['id'],'type':_0x1df449[_0x3086('0x25')],'sectionId':_0x1df449['id']},{})[_0x3086('0x21')](function(){return _0x228393;});}else{return _0x228393;}})[_0x3086('0x3f')](function(_0x59ed06){logger[_0x3086('0x24')](_0x3086('0x4c'),_0x59ed06);throw _0x59ed06;});}return _0x228393;})['then'](respondWithResult(_0x2e1d62,0xc9))[_0x3086('0x3f')](handleError(_0x2e1d62,null));};exports[_0x3086('0x20')]=function(_0x10f15d,_0x36bc65){if(_0x10f15d[_0x3086('0x4d')]['id']){delete _0x10f15d[_0x3086('0x4d')]['id'];}return db[_0x3086('0x28')]['find']({'where':{'id':_0x10f15d[_0x3086('0x41')]['id']}})[_0x3086('0x21')](handleEntityNotFound(_0x36bc65,null))[_0x3086('0x21')](saveUpdates(_0x10f15d['body'],null))[_0x3086('0x21')](respondWithResult(_0x36bc65,null))['catch'](handleError(_0x36bc65,null));};exports['destroy']=function(_0xccb577,_0x204591){return db[_0x3086('0x28')]['find']({'where':{'id':_0xccb577[_0x3086('0x41')]['id']}})[_0x3086('0x21')](handleEntityNotFound(_0x204591,null))['then'](removeEntity(_0x204591,null))[_0x3086('0x3f')](handleError(_0x204591,null));};exports[_0x3086('0x4e')]=function(_0x12649c,_0x3648de,_0x17b918){return db[_0x3086('0x28')][_0x3086('0x4f')]({'where':{'id':_0x12649c['params']['id']},'attributes':[_0x3086('0x25'),_0x3086('0x50'),_0x3086('0x51'),_0x3086('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x3648de,null))[_0x3086('0x21')](function(_0x2a4372){if(_0x2a4372){if(!fs[_0x3086('0x53')](path[_0x3086('0x54')](config[_0x3086('0x55')],_0x3086('0x56'),_0x2a4372[_0x3086('0x51')]))){throw new db[(_0x3086('0x57'))][(_0x3086('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x12649c[_0x3086('0x30')][_0x3086('0x59')]){return _0x3648de[_0x3086('0x14')](0xc8);}return _0x3648de[_0x3086('0x4e')](path[_0x3086('0x54')](config['root'],'server/files/reports',_0x2a4372[_0x3086('0x51')]),util[_0x3086('0x5a')](_0x3086('0x5b'),_0x2a4372[_0x3086('0x50')]||_0x2a4372['name'],_0x2a4372['output'][_0x3086('0x5c')]()));}})[_0x3086('0x3f')](handleError(_0x3648de,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 89622f9..c577021 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 _0x8672=['request-promise','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x12e509,_0x503590){var _0x5eddc9=function(_0xe9dfac){while(--_0xe9dfac){_0x12e509['push'](_0x12e509['shift']());}};_0x5eddc9(++_0x503590);}(_0x8672,0x7f));var _0x2867=function(_0xb4fe77,_0x56b48d){_0xb4fe77=_0xb4fe77-0x0;var _0x400ebe=_0x8672[_0xb4fe77];return _0x400ebe;};'use strict';var _=require(_0x2867('0x0'));var util=require('util');var logger=require(_0x2867('0x1'))(_0x2867('0x2'));var moment=require(_0x2867('0x3'));var BPromise=require(_0x2867('0x4'));var rp=require(_0x2867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2867('0x6'));var config=require(_0x2867('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2867('0x8')]=function(_0x4b3fd2,_0x182fd1){return _0x4b3fd2['define'](_0x2867('0x9'),attributes,{'tableName':_0x2867('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x135d=['./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x577294,_0x1daa10){var _0x19b5b1=function(_0x4eb18a){while(--_0x4eb18a){_0x577294['push'](_0x577294['shift']());}};_0x19b5b1(++_0x1daa10);}(_0x135d,0x1b0));var _0xd135=function(_0x22ed83,_0x206a0d){_0x22ed83=_0x22ed83-0x0;var _0x5351cd=_0x135d[_0x22ed83];return _0x5351cd;};'use strict';var _=require(_0xd135('0x0'));var util=require(_0xd135('0x1'));var logger=require('../../config/logger')(_0xd135('0x2'));var moment=require(_0xd135('0x3'));var BPromise=require(_0xd135('0x4'));var rp=require(_0xd135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd135('0x6'));var config=require(_0xd135('0x7'));var attributes=require(_0xd135('0x8'));module['exports']=function(_0x349dde,_0x18dbbe){return _0x349dde[_0xd135('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xd135('0xa'),'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 6f62521..8494450 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 _0x1780=['stringify','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x1780,0xbf));var _0x0178=function(_0x237688,_0x414d07){_0x237688=_0x237688-0x0;var _0x592899=_0x1780[_0x237688];return _0x592899;};'use strict';var _=require(_0x0178('0x0'));var util=require('util');var moment=require(_0x0178('0x1'));var BPromise=require(_0x0178('0x2'));var rs=require(_0x0178('0x3'));var fs=require('fs');var Redis=require(_0x0178('0x4'));var db=require(_0x0178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0178('0x6'))(_0x0178('0x7'));var config=require(_0x0178('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb438,_0x31e42c,_0x205526){return new BPromise(function(_0x5212a3,_0x9b546d){return client[_0x0178('0xa')](_0x2eb438,_0x205526)[_0x0178('0xb')](function(_0x6be057){logger[_0x0178('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x31e42c,_0x0178('0xd'));logger[_0x0178('0xe')](_0x0178('0xf'),_0x31e42c,_0x0178('0xd'),JSON[_0x0178('0x10')](_0x6be057));if(_0x6be057['error']){if(_0x6be057[_0x0178('0x11')][_0x0178('0x12')]===0x1f4){logger[_0x0178('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x31e42c,_0x6be057[_0x0178('0x11')][_0x0178('0x13')]);return _0x9b546d(_0x6be057[_0x0178('0x11')][_0x0178('0x13')]);}logger[_0x0178('0x11')](_0x0178('0x14'),_0x31e42c,_0x6be057[_0x0178('0x11')][_0x0178('0x13')]);return _0x5212a3(_0x6be057[_0x0178('0x11')][_0x0178('0x13')]);}else{logger[_0x0178('0xc')](_0x0178('0x14'),_0x31e42c,_0x0178('0xd'));_0x5212a3(_0x6be057[_0x0178('0x15')][_0x0178('0x13')]);}})[_0x0178('0x16')](function(_0x2fb26f){logger['error'](_0x0178('0x14'),_0x31e42c,_0x2fb26f);_0x9b546d(_0x2fb26f);});});} \ No newline at end of file +var _0xcabd=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xcabd,0x1e8));var _0xdcab=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xcabd[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xdcab('0x0'));var util=require(_0xdcab('0x1'));var moment=require(_0xdcab('0x2'));var BPromise=require(_0xdcab('0x3'));var rs=require(_0xdcab('0x4'));var fs=require('fs');var Redis=require(_0xdcab('0x5'));var db=require(_0xdcab('0x6'))['db'];var utils=require(_0xdcab('0x7'));var logger=require(_0xdcab('0x8'))(_0xdcab('0x9'));var config=require('../../config/environment');var jayson=require(_0xdcab('0xa'));var client=jayson[_0xdcab('0xb')][_0xdcab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f4eac,_0x2dc7d7,_0x115008){return new BPromise(function(_0xc70bae,_0x169c61){return client[_0xdcab('0xd')](_0x5f4eac,_0x115008)[_0xdcab('0xe')](function(_0x44f73c){logger[_0xdcab('0xf')](_0xdcab('0x10'),_0x2dc7d7,_0xdcab('0x11'));logger[_0xdcab('0x12')](_0xdcab('0x13'),_0x2dc7d7,_0xdcab('0x11'),JSON[_0xdcab('0x14')](_0x44f73c));if(_0x44f73c[_0xdcab('0x15')]){if(_0x44f73c[_0xdcab('0x15')][_0xdcab('0x16')]===0x1f4){logger['error'](_0xdcab('0x10'),_0x2dc7d7,_0x44f73c[_0xdcab('0x15')][_0xdcab('0x17')]);return _0x169c61(_0x44f73c['error'][_0xdcab('0x17')]);}logger[_0xdcab('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2dc7d7,_0x44f73c[_0xdcab('0x15')]['message']);return _0xc70bae(_0x44f73c[_0xdcab('0x15')]['message']);}else{logger[_0xdcab('0xf')](_0xdcab('0x10'),_0x2dc7d7,'request\x20sent');_0xc70bae(_0x44f73c['result'][_0xdcab('0x17')]);}})['catch'](function(_0x3457f1){logger['error'](_0xdcab('0x10'),_0x2dc7d7,_0x3457f1);_0x169c61(_0x3457f1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d7f3450..6cfc5ce 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 _0x72f6=['show','/:id/download','download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','get','isAuthenticated','index'];(function(_0x22d2b2,_0x57c90c){var _0x593c59=function(_0x4b52fe){while(--_0x4b52fe){_0x22d2b2['push'](_0x22d2b2['shift']());}};_0x593c59(++_0x57c90c);}(_0x72f6,0xf4));var _0x672f=function(_0x31198f,_0x1a84aa){_0x31198f=_0x31198f-0x0;var _0x3de401=_0x72f6[_0x31198f];return _0x3de401;};'use strict';var multer=require('multer');var util=require(_0x672f('0x0'));var path=require(_0x672f('0x1'));var timeout=require(_0x672f('0x2'));var express=require('express');var router=express[_0x672f('0x3')]();var fs_extra=require(_0x672f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x672f('0x5')]('/',auth[_0x672f('0x6')](),controller[_0x672f('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x672f('0x8')]);router[_0x672f('0x5')](_0x672f('0x9'),auth[_0x672f('0x6')](),controller[_0x672f('0xa')]);router[_0x672f('0xb')]('/',auth['isAuthenticated'](),controller[_0x672f('0xc')]);router['put'](_0x672f('0xd'),auth['isAuthenticated'](),controller[_0x672f('0xe')]);router[_0x672f('0xf')](_0x672f('0xd'),auth[_0x672f('0x6')](),controller[_0x672f('0x10')]);module[_0x672f('0x11')]=router; \ No newline at end of file +var _0x87ad=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2f9026,_0x3b954b){var _0x2dec99=function(_0x21ca70){while(--_0x21ca70){_0x2f9026['push'](_0x2f9026['shift']());}};_0x2dec99(++_0x3b954b);}(_0x87ad,0x148));var _0xd87a=function(_0x30bf39,_0x5b6a73){_0x30bf39=_0x30bf39-0x0;var _0x545684=_0x87ad[_0x30bf39];return _0x545684;};'use strict';var multer=require(_0xd87a('0x0'));var util=require(_0xd87a('0x1'));var path=require(_0xd87a('0x2'));var timeout=require(_0xd87a('0x3'));var express=require(_0xd87a('0x4'));var router=express[_0xd87a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd87a('0x6'));var config=require(_0xd87a('0x7'));var controller=require(_0xd87a('0x8'));router[_0xd87a('0x9')]('/',auth[_0xd87a('0xa')](),controller[_0xd87a('0xb')]);router[_0xd87a('0x9')](_0xd87a('0xc'),auth[_0xd87a('0xa')](),controller[_0xd87a('0xd')]);router['get'](_0xd87a('0xe'),auth[_0xd87a('0xa')](),controller[_0xd87a('0xf')]);router[_0xd87a('0x10')]('/',auth[_0xd87a('0xa')](),controller[_0xd87a('0x11')]);router[_0xd87a('0x12')](_0xd87a('0xc'),auth[_0xd87a('0xa')](),controller['update']);router[_0xd87a('0x13')](_0xd87a('0xc'),auth[_0xd87a('0xa')](),controller[_0xd87a('0x14')]);module[_0xd87a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 23b7799..c06aa1f 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 _0xe2dc=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x195686,_0xd329df){var _0xaf27a1=function(_0x5a3ba8){while(--_0x5a3ba8){_0x195686['push'](_0x195686['shift']());}};_0xaf27a1(++_0xd329df);}(_0xe2dc,0x1b7));var _0xce2d=function(_0x20bda4,_0x197ab4){_0x20bda4=_0x20bda4-0x0;var _0x4d2124=_0xe2dc[_0x20bda4];return _0x4d2124;};'use strict';var Sequelize=require(_0xce2d('0x0'));module[_0xce2d('0x1')]={'field':{'type':Sequelize[_0xce2d('0x2')]},'alias':{'type':Sequelize[_0xce2d('0x3')]},'function':{'type':Sequelize[_0xce2d('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xce2d('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xce2d('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7fb9=['STRING','BOOLEAN','exports','TEXT'];(function(_0x229fa7,_0xcf12a5){var _0x26ee05=function(_0x4924db){while(--_0x4924db){_0x229fa7['push'](_0x229fa7['shift']());}};_0x26ee05(++_0xcf12a5);}(_0x7fb9,0x6a));var _0x97fb=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x7fb9[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require('sequelize');module[_0x97fb('0x0')]={'field':{'type':Sequelize[_0x97fb('0x1')]},'alias':{'type':Sequelize[_0x97fb('0x2')]},'function':{'type':Sequelize[_0x97fb('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x97fb('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x97fb('0x2')]},'custom':{'type':Sequelize[_0x97fb('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 38b33a9..f787746 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 _0x0b42=['key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','intersection','create','body','catch','bulkCreate','find','destroy','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','name','index','map','AnalyticFieldReport','fieldName','type'];(function(_0x62c17,_0x4f37eb){var _0x4fd74e=function(_0x216917){while(--_0x216917){_0x62c17['push'](_0x62c17['shift']());}};_0x4fd74e(++_0x4f37eb);}(_0x0b42,0x116));var _0x20b4=function(_0x1ed686,_0xd5d5e5){_0x1ed686=_0x1ed686-0x0;var _0x564882=_0x0b42[_0x1ed686];return _0x564882;};'use strict';var emlformat=require(_0x20b4('0x0'));var rimraf=require(_0x20b4('0x1'));var zipdir=require(_0x20b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20b4('0x3'));var moment=require(_0x20b4('0x4'));var BPromise=require(_0x20b4('0x5'));var Mustache=require('mustache');var util=require(_0x20b4('0x6'));var path=require(_0x20b4('0x7'));var sox=require(_0x20b4('0x8'));var csv=require('to-csv');var ejs=require(_0x20b4('0x9'));var fs=require('fs');var fs_extra=require(_0x20b4('0xa'));var _=require(_0x20b4('0xb'));var squel=require(_0x20b4('0xc'));var crypto=require(_0x20b4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20b4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x20b4('0xf'));var Redis=require(_0x20b4('0x10'));var authService=require(_0x20b4('0x11'));var qs=require(_0x20b4('0x12'));var as=require(_0x20b4('0x13'));var hardwareService=require(_0x20b4('0x14'));var logger=require('../../config/logger')(_0x20b4('0x15'));var utils=require(_0x20b4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x20b4('0x17'));var db=require(_0x20b4('0x18'))['db'];function respondWithStatusCode(_0x4a52db,_0x2c3f23){_0x2c3f23=_0x2c3f23||0xcc;return function(_0x58524c){if(_0x58524c){return _0x4a52db[_0x20b4('0x19')](_0x2c3f23);}return _0x4a52db[_0x20b4('0x1a')](_0x2c3f23)[_0x20b4('0x1b')]();};}function respondWithResult(_0x4dda9d,_0x47d3e5){_0x47d3e5=_0x47d3e5||0xc8;return function(_0x2a8929){if(_0x2a8929){return _0x4dda9d[_0x20b4('0x1a')](_0x47d3e5)[_0x20b4('0x1c')](_0x2a8929);}};}function respondWithFilteredResult(_0x3dec75,_0x1571f5){return function(_0x52e003){if(_0x52e003){var _0x578b9e=typeof _0x1571f5['offset']===_0x20b4('0x1d')&&typeof _0x1571f5[_0x20b4('0x1e')]===_0x20b4('0x1d');var _0x4414a6=_0x52e003[_0x20b4('0x1f')];var _0x107ce9=_0x578b9e?0x0:_0x1571f5[_0x20b4('0x20')];var _0x1f2f8a=_0x578b9e?_0x52e003[_0x20b4('0x1f')]:_0x1571f5[_0x20b4('0x20')]+_0x1571f5[_0x20b4('0x1e')];var _0x1901c5;if(_0x1f2f8a>=_0x4414a6){_0x1f2f8a=_0x4414a6;_0x1901c5=0xc8;}else{_0x1901c5=0xce;}_0x3dec75[_0x20b4('0x1a')](_0x1901c5);return _0x3dec75[_0x20b4('0x21')](_0x20b4('0x22'),_0x107ce9+'-'+_0x1f2f8a+'/'+_0x4414a6)[_0x20b4('0x1c')](_0x52e003);}return null;};}function patchUpdates(_0x3c0ba3){return function(_0x3266e2){try{jsonpatch[_0x20b4('0x23')](_0x3266e2,_0x3c0ba3,!![]);}catch(_0xb0c3c2){return BPromise[_0x20b4('0x24')](_0xb0c3c2);}return _0x3266e2[_0x20b4('0x25')]();};}function saveUpdates(_0x1d7259,_0x576bd5){return function(_0x38288a){if(_0x38288a){return _0x38288a[_0x20b4('0x26')](_0x1d7259)[_0x20b4('0x27')](function(_0x1771b5){return _0x1771b5;});}return null;};}function removeEntity(_0x2b77c9,_0x2de46d){return function(_0x1030ed){if(_0x1030ed){return _0x1030ed['destroy']()[_0x20b4('0x27')](function(){_0x2b77c9['status'](0xcc)[_0x20b4('0x1b')]();});}};}function handleEntityNotFound(_0x21d218,_0x929a7b){return function(_0x1b3b05){if(!_0x1b3b05){_0x21d218[_0x20b4('0x19')](0x194);}return _0x1b3b05;};}function handleError(_0x541bc7,_0x3b1d60){_0x3b1d60=_0x3b1d60||0x1f4;return function(_0x524662){logger['error'](_0x524662['stack']);if(_0x524662[_0x20b4('0x28')]){delete _0x524662['name'];}_0x541bc7[_0x20b4('0x1a')](_0x3b1d60)['send'](_0x524662);};}exports[_0x20b4('0x29')]=function(_0x5810fd,_0x3d815a){var _0x4598f4={},_0x17047e={},_0x37a394={'count':0x0,'rows':[]};var _0x3200a1=_[_0x20b4('0x2a')](db[_0x20b4('0x2b')]['rawAttributes'],function(_0x535aad){return{'name':_0x535aad[_0x20b4('0x2c')],'type':_0x535aad[_0x20b4('0x2d')][_0x20b4('0x2e')]};});_0x17047e[_0x20b4('0x2f')]=_['map'](_0x3200a1,_0x20b4('0x28'));_0x17047e['query']=_[_0x20b4('0x30')](_0x5810fd[_0x20b4('0x31')]);_0x17047e[_0x20b4('0x32')]=_['intersection'](_0x17047e['model'],_0x17047e[_0x20b4('0x31')]);_0x4598f4[_0x20b4('0x33')]=_['intersection'](_0x17047e[_0x20b4('0x2f')],qs[_0x20b4('0x34')](_0x5810fd[_0x20b4('0x31')][_0x20b4('0x34')]));_0x4598f4[_0x20b4('0x33')]=_0x4598f4[_0x20b4('0x33')][_0x20b4('0x35')]?_0x4598f4[_0x20b4('0x33')]:_0x17047e[_0x20b4('0x2f')];if(!_0x5810fd['query'][_0x20b4('0x36')](_0x20b4('0x37'))){_0x4598f4[_0x20b4('0x1e')]=qs[_0x20b4('0x1e')](_0x5810fd[_0x20b4('0x31')][_0x20b4('0x1e')]);_0x4598f4[_0x20b4('0x20')]=qs[_0x20b4('0x20')](_0x5810fd[_0x20b4('0x31')][_0x20b4('0x20')]);}_0x4598f4[_0x20b4('0x38')]=qs[_0x20b4('0x39')](_0x5810fd['query']['sort']);_0x4598f4['where']=qs[_0x20b4('0x32')](_['pick'](_0x5810fd['query'],_0x17047e['filters']),_0x3200a1);if(_0x5810fd[_0x20b4('0x31')][_0x20b4('0x3a')]){_0x4598f4[_0x20b4('0x3b')]=_[_0x20b4('0x3c')](_0x4598f4[_0x20b4('0x3b')],{'$or':_[_0x20b4('0x2a')](_0x3200a1,function(_0x4505ef){if(_0x4505ef[_0x20b4('0x2d')]!==_0x20b4('0x3d')){var _0x4d8d9d={};_0x4d8d9d[_0x4505ef[_0x20b4('0x28')]]={'$like':'%'+_0x5810fd['query'][_0x20b4('0x3a')]+'%'};return _0x4d8d9d;}})});}_0x4598f4=_['merge']({},_0x4598f4,_0x5810fd[_0x20b4('0x3e')]);var _0x2e8297={'where':_0x4598f4[_0x20b4('0x3b')]};return db[_0x20b4('0x2b')]['count'](_0x2e8297)[_0x20b4('0x27')](function(_0x5795fe){_0x37a394['count']=_0x5795fe;if(_0x5810fd[_0x20b4('0x31')][_0x20b4('0x3f')]){_0x4598f4[_0x20b4('0x40')]=[{'all':!![]}];}return db[_0x20b4('0x2b')][_0x20b4('0x41')](_0x4598f4);})['then'](function(_0x5c9246){_0x37a394[_0x20b4('0x42')]=_0x5c9246;return _0x37a394;})['then'](respondWithFilteredResult(_0x3d815a,_0x4598f4))['catch'](handleError(_0x3d815a,null));};exports['show']=function(_0x1387dd,_0x217c77){var _0x409320={'raw':![],'where':{'id':_0x1387dd[_0x20b4('0x43')]['id']}},_0x3201d8={};_0x3201d8['model']=_[_0x20b4('0x30')](db[_0x20b4('0x2b')][_0x20b4('0x44')]);_0x3201d8['query']=_[_0x20b4('0x30')](_0x1387dd['query']);_0x3201d8[_0x20b4('0x32')]=_[_0x20b4('0x45')](_0x3201d8['model'],_0x3201d8[_0x20b4('0x31')]);_0x409320[_0x20b4('0x33')]=_[_0x20b4('0x45')](_0x3201d8[_0x20b4('0x2f')],qs['fields'](_0x1387dd[_0x20b4('0x31')]['fields']));_0x409320[_0x20b4('0x33')]=_0x409320[_0x20b4('0x33')][_0x20b4('0x35')]?_0x409320[_0x20b4('0x33')]:_0x3201d8['model'];if(_0x1387dd[_0x20b4('0x31')][_0x20b4('0x3f')]){_0x409320[_0x20b4('0x40')]=[{'all':!![]}];}_0x409320=_[_0x20b4('0x3c')]({},_0x409320,_0x1387dd[_0x20b4('0x3e')]);return db['AnalyticFieldReport']['find'](_0x409320)[_0x20b4('0x27')](handleEntityNotFound(_0x217c77,null))[_0x20b4('0x27')](respondWithResult(_0x217c77,null))['catch'](handleError(_0x217c77,null));};exports[_0x20b4('0x46')]=function(_0x4f1960,_0x10ce57){return db[_0x20b4('0x2b')]['create'](_0x4f1960[_0x20b4('0x47')],{})[_0x20b4('0x27')](respondWithResult(_0x10ce57,0xc9))[_0x20b4('0x48')](handleError(_0x10ce57,null));};exports[_0x20b4('0x49')]=function(_0x5fe0c5,_0x348ea5){return db[_0x20b4('0x2b')][_0x20b4('0x49')](_0x5fe0c5['body'],{'raw':![],'individualHooks':!![]})[_0x20b4('0x27')](respondWithResult(_0x348ea5,0xc9))[_0x20b4('0x48')](handleError(_0x348ea5,null));};exports['update']=function(_0x4fad48,_0x342972){if(_0x4fad48[_0x20b4('0x47')]['id']){delete _0x4fad48['body']['id'];}return db[_0x20b4('0x2b')][_0x20b4('0x4a')]({'where':{'id':_0x4fad48[_0x20b4('0x43')]['id']}})[_0x20b4('0x27')](handleEntityNotFound(_0x342972,null))[_0x20b4('0x27')](saveUpdates(_0x4fad48['body'],null))[_0x20b4('0x27')](respondWithResult(_0x342972,null))[_0x20b4('0x48')](handleError(_0x342972,null));};exports['destroy']=function(_0x5847ec,_0x9fdb7b){return db[_0x20b4('0x2b')]['find']({'where':{'id':_0x5847ec[_0x20b4('0x43')]['id']}})[_0x20b4('0x27')](handleEntityNotFound(_0x9fdb7b,null))[_0x20b4('0x27')](removeEntity(_0x9fdb7b,null))['catch'](handleError(_0x9fdb7b,null));};exports['bulkDestroy']=function(_0x202914,_0x5c77d3){return db[_0x20b4('0x2b')][_0x20b4('0x4b')]({'where':{'id':_0x202914[_0x20b4('0x31')][_0x20b4('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x20b4('0x27')](respondWithResult(_0x5c77d3,0xcc))[_0x20b4('0x48')](handleError(_0x5c77d3,null));};exports['addFields']=function(_0x1ed014,_0x32ee7d,_0x3a4c4c){return db[_0x20b4('0x4d')][_0x20b4('0x4e')]({'where':{'id':_0x1ed014['params']['id']}})[_0x20b4('0x27')](handleEntityNotFound(_0x32ee7d,null))[_0x20b4('0x27')](function(_0x539f27){if(_0x539f27){return db['sequelize'][_0x20b4('0x4f')](function(_0x2369ec){return db[_0x20b4('0x2b')]['destroy']({'where':{'CustomReportId':_0x1ed014[_0x20b4('0x43')]['id']},'transaction':_0x2369ec})[_0x20b4('0x27')](function(_0x45a6a6){var _0x490af9=_[_0x20b4('0x2a')](_0x1ed014[_0x20b4('0x47')],function(_0x333caf){delete _0x333caf['id'];_0x333caf[_0x20b4('0x50')]=_0x1ed014[_0x20b4('0x43')]['id'];return _0x333caf;});return db[_0x20b4('0x2b')]['bulkCreate'](_0x490af9,{'transaction':_0x2369ec});});})[_0x20b4('0x27')](function(){return db[_0x20b4('0x2b')][_0x20b4('0x41')]({'where':{'CustomReportId':_0x1ed014[_0x20b4('0x43')]['id']}});});}})[_0x20b4('0x27')](respondWithResult(_0x32ee7d,null))['catch'](handleError(_0x32ee7d,null));}; \ No newline at end of file +var _0xdece=['reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x12e36c,_0x40c53e){var _0x2cbc51=function(_0xdd0876){while(--_0xdd0876){_0x12e36c['push'](_0x12e36c['shift']());}};_0x2cbc51(++_0x40c53e);}(_0xdece,0x88));var _0xedec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xdece[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xedec('0x0'));var rimraf=require(_0xedec('0x1'));var zipdir=require(_0xedec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedec('0x3'));var moment=require(_0xedec('0x4'));var BPromise=require(_0xedec('0x5'));var Mustache=require(_0xedec('0x6'));var util=require(_0xedec('0x7'));var path=require('path');var sox=require(_0xedec('0x8'));var csv=require('to-csv');var ejs=require(_0xedec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xedec('0xa'));var crypto=require('crypto');var jsforce=require(_0xedec('0xb'));var deskjs=require(_0xedec('0xc'));var toCsv=require(_0xedec('0xd'));var querystring=require(_0xedec('0xe'));var Papa=require(_0xedec('0xf'));var Redis=require(_0xedec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xedec('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedec('0x12'));var logger=require(_0xedec('0x13'))(_0xedec('0x14'));var utils=require(_0xedec('0x15'));var config=require(_0xedec('0x16'));var licenseUtil=require(_0xedec('0x17'));var db=require(_0xedec('0x18'))['db'];function respondWithStatusCode(_0x845205,_0xa01f69){_0xa01f69=_0xa01f69||0xcc;return function(_0x582359){if(_0x582359){return _0x845205[_0xedec('0x19')](_0xa01f69);}return _0x845205['status'](_0xa01f69)[_0xedec('0x1a')]();};}function respondWithResult(_0x474a9a,_0x9d306b){_0x9d306b=_0x9d306b||0xc8;return function(_0x4f8d6a){if(_0x4f8d6a){return _0x474a9a[_0xedec('0x1b')](_0x9d306b)[_0xedec('0x1c')](_0x4f8d6a);}};}function respondWithFilteredResult(_0x43c0df,_0xc4afdb){return function(_0x20bd56){if(_0x20bd56){var _0x37ad98=typeof _0xc4afdb[_0xedec('0x1d')]==='undefined'&&typeof _0xc4afdb['limit']===_0xedec('0x1e');var _0x3c1029=_0x20bd56[_0xedec('0x1f')];var _0x24e30f=_0x37ad98?0x0:_0xc4afdb[_0xedec('0x1d')];var _0x388f65=_0x37ad98?_0x20bd56[_0xedec('0x1f')]:_0xc4afdb[_0xedec('0x1d')]+_0xc4afdb[_0xedec('0x20')];var _0x3d27ae;if(_0x388f65>=_0x3c1029){_0x388f65=_0x3c1029;_0x3d27ae=0xc8;}else{_0x3d27ae=0xce;}_0x43c0df[_0xedec('0x1b')](_0x3d27ae);return _0x43c0df[_0xedec('0x21')](_0xedec('0x22'),_0x24e30f+'-'+_0x388f65+'/'+_0x3c1029)[_0xedec('0x1c')](_0x20bd56);}return null;};}function patchUpdates(_0x382acc){return function(_0xe86e21){try{jsonpatch[_0xedec('0x23')](_0xe86e21,_0x382acc,!![]);}catch(_0x1f9912){return BPromise[_0xedec('0x24')](_0x1f9912);}return _0xe86e21[_0xedec('0x25')]();};}function saveUpdates(_0x3edafd,_0x343551){return function(_0x4459d0){if(_0x4459d0){return _0x4459d0[_0xedec('0x26')](_0x3edafd)[_0xedec('0x27')](function(_0x2e629f){return _0x2e629f;});}return null;};}function removeEntity(_0x4573a2,_0x444ac1){return function(_0x6aeca4){if(_0x6aeca4){return _0x6aeca4[_0xedec('0x28')]()[_0xedec('0x27')](function(){_0x4573a2[_0xedec('0x1b')](0xcc)[_0xedec('0x1a')]();});}};}function handleEntityNotFound(_0x42b4cf,_0x19265b){return function(_0x4b84f7){if(!_0x4b84f7){_0x42b4cf[_0xedec('0x19')](0x194);}return _0x4b84f7;};}function handleError(_0x36be0e,_0x14f470){_0x14f470=_0x14f470||0x1f4;return function(_0x3d0866){logger[_0xedec('0x29')](_0x3d0866[_0xedec('0x2a')]);if(_0x3d0866['name']){delete _0x3d0866[_0xedec('0x2b')];}_0x36be0e[_0xedec('0x1b')](_0x14f470)[_0xedec('0x2c')](_0x3d0866);};}exports[_0xedec('0x2d')]=function(_0x399b8c,_0x52bdf5){var _0x5a60a1={},_0x521ae3={},_0x189c67={'count':0x0,'rows':[]};var _0x258fc7=_[_0xedec('0x2e')](db[_0xedec('0x2f')]['rawAttributes'],function(_0x565abd){return{'name':_0x565abd[_0xedec('0x30')],'type':_0x565abd[_0xedec('0x31')][_0xedec('0x32')]};});_0x521ae3[_0xedec('0x33')]=_['map'](_0x258fc7,_0xedec('0x2b'));_0x521ae3[_0xedec('0x34')]=_[_0xedec('0x35')](_0x399b8c[_0xedec('0x34')]);_0x521ae3[_0xedec('0x36')]=_[_0xedec('0x37')](_0x521ae3[_0xedec('0x33')],_0x521ae3[_0xedec('0x34')]);_0x5a60a1[_0xedec('0x38')]=_[_0xedec('0x37')](_0x521ae3['model'],qs[_0xedec('0x39')](_0x399b8c[_0xedec('0x34')]['fields']));_0x5a60a1[_0xedec('0x38')]=_0x5a60a1[_0xedec('0x38')][_0xedec('0x3a')]?_0x5a60a1['attributes']:_0x521ae3['model'];if(!_0x399b8c['query']['hasOwnProperty'](_0xedec('0x3b'))){_0x5a60a1[_0xedec('0x20')]=qs['limit'](_0x399b8c[_0xedec('0x34')][_0xedec('0x20')]);_0x5a60a1[_0xedec('0x1d')]=qs[_0xedec('0x1d')](_0x399b8c[_0xedec('0x34')]['offset']);}_0x5a60a1['order']=qs[_0xedec('0x3c')](_0x399b8c['query']['sort']);_0x5a60a1[_0xedec('0x3d')]=qs[_0xedec('0x36')](_[_0xedec('0x3e')](_0x399b8c['query'],_0x521ae3['filters']),_0x258fc7);if(_0x399b8c['query'][_0xedec('0x3f')]){_0x5a60a1[_0xedec('0x3d')]=_['merge'](_0x5a60a1[_0xedec('0x3d')],{'$or':_[_0xedec('0x2e')](_0x258fc7,function(_0x196e25){if(_0x196e25[_0xedec('0x31')]!==_0xedec('0x40')){var _0x1881e7={};_0x1881e7[_0x196e25[_0xedec('0x2b')]]={'$like':'%'+_0x399b8c[_0xedec('0x34')][_0xedec('0x3f')]+'%'};return _0x1881e7;}})});}_0x5a60a1=_[_0xedec('0x41')]({},_0x5a60a1,_0x399b8c[_0xedec('0x42')]);var _0xb46ed0={'where':_0x5a60a1[_0xedec('0x3d')]};return db[_0xedec('0x2f')][_0xedec('0x1f')](_0xb46ed0)[_0xedec('0x27')](function(_0xe5c1d7){_0x189c67['count']=_0xe5c1d7;if(_0x399b8c[_0xedec('0x34')][_0xedec('0x43')]){_0x5a60a1[_0xedec('0x44')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xedec('0x45')](_0x5a60a1);})[_0xedec('0x27')](function(_0x2fe060){_0x189c67[_0xedec('0x46')]=_0x2fe060;return _0x189c67;})[_0xedec('0x27')](respondWithFilteredResult(_0x52bdf5,_0x5a60a1))[_0xedec('0x47')](handleError(_0x52bdf5,null));};exports[_0xedec('0x48')]=function(_0x4c2968,_0x4b6a34){var _0x1e936e={'raw':![],'where':{'id':_0x4c2968['params']['id']}},_0x4eecb2={};_0x4eecb2[_0xedec('0x33')]=_['keys'](db['AnalyticFieldReport'][_0xedec('0x49')]);_0x4eecb2['query']=_[_0xedec('0x35')](_0x4c2968[_0xedec('0x34')]);_0x4eecb2[_0xedec('0x36')]=_[_0xedec('0x37')](_0x4eecb2[_0xedec('0x33')],_0x4eecb2[_0xedec('0x34')]);_0x1e936e[_0xedec('0x38')]=_['intersection'](_0x4eecb2[_0xedec('0x33')],qs[_0xedec('0x39')](_0x4c2968[_0xedec('0x34')][_0xedec('0x39')]));_0x1e936e['attributes']=_0x1e936e[_0xedec('0x38')]['length']?_0x1e936e[_0xedec('0x38')]:_0x4eecb2[_0xedec('0x33')];if(_0x4c2968['query'][_0xedec('0x43')]){_0x1e936e[_0xedec('0x44')]=[{'all':!![]}];}_0x1e936e=_[_0xedec('0x41')]({},_0x1e936e,_0x4c2968[_0xedec('0x42')]);return db[_0xedec('0x2f')][_0xedec('0x4a')](_0x1e936e)['then'](handleEntityNotFound(_0x4b6a34,null))[_0xedec('0x27')](respondWithResult(_0x4b6a34,null))[_0xedec('0x47')](handleError(_0x4b6a34,null));};exports[_0xedec('0x4b')]=function(_0x1c99db,_0x2791c9){return db[_0xedec('0x2f')][_0xedec('0x4b')](_0x1c99db[_0xedec('0x4c')],{})[_0xedec('0x27')](respondWithResult(_0x2791c9,0xc9))[_0xedec('0x47')](handleError(_0x2791c9,null));};exports[_0xedec('0x4d')]=function(_0x1e558f,_0xd0b174){return db[_0xedec('0x2f')][_0xedec('0x4d')](_0x1e558f['body'],{'raw':![],'individualHooks':!![]})[_0xedec('0x27')](respondWithResult(_0xd0b174,0xc9))[_0xedec('0x47')](handleError(_0xd0b174,null));};exports[_0xedec('0x26')]=function(_0x3779d1,_0x599fd5){if(_0x3779d1[_0xedec('0x4c')]['id']){delete _0x3779d1['body']['id'];}return db[_0xedec('0x2f')]['find']({'where':{'id':_0x3779d1[_0xedec('0x4e')]['id']}})[_0xedec('0x27')](handleEntityNotFound(_0x599fd5,null))['then'](saveUpdates(_0x3779d1['body'],null))[_0xedec('0x27')](respondWithResult(_0x599fd5,null))['catch'](handleError(_0x599fd5,null));};exports['destroy']=function(_0x347fa9,_0x231aef){return db[_0xedec('0x2f')][_0xedec('0x4a')]({'where':{'id':_0x347fa9[_0xedec('0x4e')]['id']}})[_0xedec('0x27')](handleEntityNotFound(_0x231aef,null))[_0xedec('0x27')](removeEntity(_0x231aef,null))['catch'](handleError(_0x231aef,null));};exports[_0xedec('0x4f')]=function(_0x49406c,_0x457128){return db[_0xedec('0x2f')][_0xedec('0x28')]({'where':{'id':_0x49406c[_0xedec('0x34')][_0xedec('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xedec('0x27')](respondWithResult(_0x457128,0xcc))['catch'](handleError(_0x457128,null));};exports[_0xedec('0x51')]=function(_0x3b2dea,_0x52a80c,_0x41d0db){return db[_0xedec('0x52')]['findOne']({'where':{'id':_0x3b2dea['params']['id']}})[_0xedec('0x27')](handleEntityNotFound(_0x52a80c,null))[_0xedec('0x27')](function(_0x499793){if(_0x499793){return db[_0xedec('0x53')][_0xedec('0x54')](function(_0x3501e3){return db['AnalyticFieldReport'][_0xedec('0x28')]({'where':{'CustomReportId':_0x3b2dea[_0xedec('0x4e')]['id']},'transaction':_0x3501e3})['then'](function(_0x34821b){var _0x44b794=_[_0xedec('0x2e')](_0x3b2dea[_0xedec('0x4c')],function(_0x418266){delete _0x418266['id'];_0x418266[_0xedec('0x55')]=_0x3b2dea[_0xedec('0x4e')]['id'];return _0x418266;});return db[_0xedec('0x2f')]['bulkCreate'](_0x44b794,{'transaction':_0x3501e3});});})[_0xedec('0x27')](function(){return db[_0xedec('0x2f')]['findAll']({'where':{'CustomReportId':_0x3b2dea[_0xedec('0x4e')]['id']}});});}})['then'](respondWithResult(_0x52a80c,null))[_0xedec('0x47')](handleError(_0x52a80c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6258a7a..1f000ec 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 _0x0a75=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','define','analytics_report_fields','lodash'];(function(_0x13483d,_0x21b059){var _0x14a692=function(_0x89c3ea){while(--_0x89c3ea){_0x13483d['push'](_0x13483d['shift']());}};_0x14a692(++_0x21b059);}(_0x0a75,0x83));var _0x50a7=function(_0xaf4c6e,_0x43c2e3){_0xaf4c6e=_0xaf4c6e-0x0;var _0x3a349b=_0x0a75[_0xaf4c6e];return _0x3a349b;};'use strict';var _=require(_0x50a7('0x0'));var util=require(_0x50a7('0x1'));var logger=require(_0x50a7('0x2'))(_0x50a7('0x3'));var moment=require(_0x50a7('0x4'));var BPromise=require(_0x50a7('0x5'));var rp=require(_0x50a7('0x6'));var fs=require('fs');var path=require(_0x50a7('0x7'));var rimraf=require(_0x50a7('0x8'));var config=require('../../config/environment');var attributes=require(_0x50a7('0x9'));module['exports']=function(_0x297375,_0x293ea2){return _0x297375[_0x50a7('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x50a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb386=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x4aef74,_0x168464){var _0x4adfdc=function(_0x3e7ea9){while(--_0x3e7ea9){_0x4aef74['push'](_0x4aef74['shift']());}};_0x4adfdc(++_0x168464);}(_0xb386,0x178));var _0x6b38=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xb386[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x6b38('0x0'));var util=require(_0x6b38('0x1'));var logger=require(_0x6b38('0x2'))(_0x6b38('0x3'));var moment=require(_0x6b38('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b38('0x5'));var fs=require('fs');var path=require(_0x6b38('0x6'));var rimraf=require('rimraf');var config=require(_0x6b38('0x7'));var attributes=require(_0x6b38('0x8'));module[_0x6b38('0x9')]=function(_0x20ac0f,_0x50ef99){return _0x20ac0f[_0x6b38('0xa')](_0x6b38('0xb'),attributes,{'tableName':_0x6b38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 5d73e13..61562e1 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 _0x34c3=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x322d1f,_0xbe7b8){var _0x2b51c1=function(_0x16af9c){while(--_0x16af9c){_0x322d1f['push'](_0x322d1f['shift']());}};_0x2b51c1(++_0xbe7b8);}(_0x34c3,0xff));var _0x334c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x34c3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x334c('0x0'));var util=require(_0x334c('0x1'));var moment=require(_0x334c('0x2'));var BPromise=require(_0x334c('0x3'));var rs=require(_0x334c('0x4'));var fs=require('fs');var Redis=require(_0x334c('0x5'));var db=require(_0x334c('0x6'))['db'];var utils=require(_0x334c('0x7'));var logger=require(_0x334c('0x8'))('rpc');var config=require(_0x334c('0x9'));var jayson=require(_0x334c('0xa'));var client=jayson[_0x334c('0xb')][_0x334c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28de1e,_0x3a4fe3,_0x1df281){return new BPromise(function(_0x1b89d0,_0x10dac6){return client[_0x334c('0xd')](_0x28de1e,_0x1df281)[_0x334c('0xe')](function(_0x35b687){logger[_0x334c('0xf')](_0x334c('0x10'),_0x3a4fe3,_0x334c('0x11'));logger[_0x334c('0x12')](_0x334c('0x13'),_0x3a4fe3,_0x334c('0x11'),JSON[_0x334c('0x14')](_0x35b687));if(_0x35b687['error']){if(_0x35b687[_0x334c('0x15')]['code']===0x1f4){logger[_0x334c('0x15')](_0x334c('0x10'),_0x3a4fe3,_0x35b687['error'][_0x334c('0x16')]);return _0x10dac6(_0x35b687[_0x334c('0x15')]['message']);}logger[_0x334c('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3a4fe3,_0x35b687[_0x334c('0x15')]['message']);return _0x1b89d0(_0x35b687[_0x334c('0x15')][_0x334c('0x16')]);}else{logger[_0x334c('0xf')](_0x334c('0x10'),_0x3a4fe3,_0x334c('0x11'));_0x1b89d0(_0x35b687['result'][_0x334c('0x16')]);}})[_0x334c('0x17')](function(_0x231ffd){logger[_0x334c('0x15')](_0x334c('0x10'),_0x3a4fe3,_0x231ffd);_0x10dac6(_0x231ffd);});});} \ No newline at end of file +var _0xdc00=['client','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e8415,_0x39b7e6){var _0x419be0=function(_0x513dbf){while(--_0x513dbf){_0x5e8415['push'](_0x5e8415['shift']());}};_0x419be0(++_0x39b7e6);}(_0xdc00,0x1ec));var _0x0dc0=function(_0xc5403e,_0xf70a94){_0xc5403e=_0xc5403e-0x0;var _0x44c421=_0xdc00[_0xc5403e];return _0x44c421;};'use strict';var _=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var moment=require(_0x0dc0('0x2'));var BPromise=require(_0x0dc0('0x3'));var rs=require(_0x0dc0('0x4'));var fs=require('fs');var Redis=require(_0x0dc0('0x5'));var db=require(_0x0dc0('0x6'))['db'];var utils=require(_0x0dc0('0x7'));var logger=require(_0x0dc0('0x8'))(_0x0dc0('0x9'));var config=require(_0x0dc0('0xa'));var jayson=require(_0x0dc0('0xb'));var client=jayson[_0x0dc0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1589a2,_0x3ff2db,_0x3624ff){return new BPromise(function(_0x44c32c,_0x51e4ff){return client['request'](_0x1589a2,_0x3624ff)[_0x0dc0('0xd')](function(_0x518e36){logger['info'](_0x0dc0('0xe'),_0x3ff2db,'request\x20sent');logger['debug'](_0x0dc0('0xf'),_0x3ff2db,_0x0dc0('0x10'),JSON[_0x0dc0('0x11')](_0x518e36));if(_0x518e36[_0x0dc0('0x12')]){if(_0x518e36[_0x0dc0('0x12')][_0x0dc0('0x13')]===0x1f4){logger[_0x0dc0('0x12')](_0x0dc0('0xe'),_0x3ff2db,_0x518e36['error']['message']);return _0x51e4ff(_0x518e36[_0x0dc0('0x12')]['message']);}logger[_0x0dc0('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3ff2db,_0x518e36[_0x0dc0('0x12')]['message']);return _0x44c32c(_0x518e36[_0x0dc0('0x12')][_0x0dc0('0x14')]);}else{logger[_0x0dc0('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3ff2db,_0x0dc0('0x10'));_0x44c32c(_0x518e36[_0x0dc0('0x16')]['message']);}})[_0x0dc0('0x17')](function(_0x3696b1){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3ff2db,_0x3696b1);_0x51e4ff(_0x3696b1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c4e2790..da135ea 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(_0x3e8e11,_0x6753dd){var _0x290f86=function(_0x56ad82){while(--_0x56ad82){_0x3e8e11['push'](_0x3e8e11['shift']());}};_0x290f86(++_0x6753dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x4f5bd3,_0x48122a){var _0x2e30b1=function(_0x3f1046){while(--_0x3f1046){_0x4f5bd3['push'](_0x4f5bd3['shift']());}};_0x2e30b1(++_0x48122a);}(_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['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 82bc030..ac43a66 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 _0x5ff3=['STRING','exports','name','TEXT'];(function(_0x17d7bb,_0x323777){var _0x51e6f5=function(_0x13200e){while(--_0x13200e){_0x17d7bb['push'](_0x17d7bb['shift']());}};_0x51e6f5(++_0x323777);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3ceba3,_0x4d07ae){_0x3ceba3=_0x3ceba3-0x0;var _0x5da943=_0x5ff3[_0x3ceba3];return _0x5da943;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x35ff('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x35ff('0x2')]},'description':{'type':Sequelize[_0x35ff('0x3')]}}; \ No newline at end of file +var _0x2c1b=['TEXT','sequelize','exports','STRING','name'];(function(_0x282ed6,_0x1244f6){var _0x1f85ca=function(_0x2083b6){while(--_0x2083b6){_0x282ed6['push'](_0x282ed6['shift']());}};_0x1f85ca(++_0x1244f6);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x2c1b[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'name':{'type':Sequelize[_0xb2c1('0x2')],'allowNull':![],'unique':_0xb2c1('0x3')},'table':{'type':Sequelize[_0xb2c1('0x2')]},'metric':{'type':Sequelize[_0xb2c1('0x4')]},'description':{'type':Sequelize[_0xb2c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0546533..ea01aa7 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5aba01,_0x11a9ed){var _0x1b6c10=function(_0x3089f2){while(--_0x3089f2){_0x5aba01['push'](_0x5aba01['shift']());}};_0x1b6c10(++_0x11a9ed);}(_0x4b84,0x1cc));var _0x44b8=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x4b84[_0x127a60];return _0xc1f6a3;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x2d7c4a,_0x2249d2){var _0x16d915=function(_0x2194d4){while(--_0x2194d4){_0x2d7c4a['push'](_0x2d7c4a['shift']());}};_0x16d915(++_0x2249d2);}(_0xabce,0x103));var _0xeabc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xabce[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d2524ff..45fbfd1 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 _0x598a=['util','../../config/logger','api','moment','request-promise','./analyticMetric.attributes','exports','define','lodash'];(function(_0x153aae,_0x28cf2c){var _0xb918f7=function(_0x26d167){while(--_0x26d167){_0x153aae['push'](_0x153aae['shift']());}};_0xb918f7(++_0x28cf2c);}(_0x598a,0xfb));var _0xa598=function(_0x160101,_0x845589){_0x160101=_0x160101-0x0;var _0x4ea259=_0x598a[_0x160101];return _0x4ea259;};'use strict';var _=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var logger=require(_0xa598('0x2'))(_0xa598('0x3'));var moment=require(_0xa598('0x4'));var BPromise=require('bluebird');var rp=require(_0xa598('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa598('0x6'));module[_0xa598('0x7')]=function(_0x41ebaa,_0x2b0ef0){return _0x41ebaa[_0xa598('0x8')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7b=['path','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','moment','request-promise'];(function(_0x44187c,_0x2c5fb0){var _0x58e801=function(_0x2ca665){while(--_0x2ca665){_0x44187c['push'](_0x44187c['shift']());}};_0x58e801(++_0x2c5fb0);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x583844,_0x25b60b){_0x583844=_0x583844-0x0;var _0x1f4c29=_0x6c7b[_0x583844];return _0x1f4c29;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('AnalyticMetric',attributes,{'tableName':_0xb6c7('0x8'),'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 93fa5b3..6ea3e98 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 _0x07f5=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x52180b,_0x43e91a){var _0x1abd3c=function(_0x13b4b8){while(--_0x13b4b8){_0x52180b['push'](_0x52180b['shift']());}};_0x1abd3c(++_0x43e91a);}(_0x07f5,0x1e6));var _0x507f=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x07f5[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x507f('0x0'));var util=require('util');var moment=require(_0x507f('0x1'));var BPromise=require('bluebird');var rs=require(_0x507f('0x2'));var fs=require('fs');var Redis=require(_0x507f('0x3'));var db=require(_0x507f('0x4'))['db'];var utils=require(_0x507f('0x5'));var logger=require(_0x507f('0x6'))(_0x507f('0x7'));var config=require(_0x507f('0x8'));var jayson=require(_0x507f('0x9'));var client=jayson['client'][_0x507f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cdc6b,_0x3bb1f4,_0x294714){return new BPromise(function(_0x3c971d,_0x3fc78d){return client[_0x507f('0xb')](_0x1cdc6b,_0x294714)[_0x507f('0xc')](function(_0x212687){logger[_0x507f('0xd')](_0x507f('0xe'),_0x3bb1f4,_0x507f('0xf'));logger[_0x507f('0x10')](_0x507f('0x11'),_0x3bb1f4,_0x507f('0xf'),JSON['stringify'](_0x212687));if(_0x212687['error']){if(_0x212687[_0x507f('0x12')][_0x507f('0x13')]===0x1f4){logger['error'](_0x507f('0xe'),_0x3bb1f4,_0x212687['error'][_0x507f('0x14')]);return _0x3fc78d(_0x212687['error'][_0x507f('0x14')]);}logger['error'](_0x507f('0xe'),_0x3bb1f4,_0x212687[_0x507f('0x12')]['message']);return _0x3c971d(_0x212687[_0x507f('0x12')][_0x507f('0x14')]);}else{logger[_0x507f('0xd')](_0x507f('0xe'),_0x3bb1f4,_0x507f('0xf'));_0x3c971d(_0x212687[_0x507f('0x15')][_0x507f('0x14')]);}})['catch'](function(_0x5640d1){logger[_0x507f('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3bb1f4,_0x5640d1);_0x3fc78d(_0x5640d1);});});} \ No newline at end of file +var _0x0e3f=['then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x594c6d,_0x4d984f){var _0x522757=function(_0x4ec408){while(--_0x4ec408){_0x594c6d['push'](_0x594c6d['shift']());}};_0x522757(++_0x4d984f);}(_0x0e3f,0x9d));var _0xf0e3=function(_0x119d13,_0x24b117){_0x119d13=_0x119d13-0x0;var _0x4e55ff=_0x0e3f[_0x119d13];return _0x4e55ff;};'use strict';var _=require('lodash');var util=require(_0xf0e3('0x0'));var moment=require(_0xf0e3('0x1'));var BPromise=require(_0xf0e3('0x2'));var rs=require(_0xf0e3('0x3'));var fs=require('fs');var Redis=require(_0xf0e3('0x4'));var db=require(_0xf0e3('0x5'))['db'];var utils=require(_0xf0e3('0x6'));var logger=require(_0xf0e3('0x7'))('rpc');var config=require(_0xf0e3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf0e3('0x9')][_0xf0e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa4f1ae,_0x373c87,_0x427685){return new BPromise(function(_0x49ff2f,_0x51ad08){return client['request'](_0xa4f1ae,_0x427685)[_0xf0e3('0xb')](function(_0x540a0f){logger[_0xf0e3('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x373c87,_0xf0e3('0xd'));logger[_0xf0e3('0xe')](_0xf0e3('0xf'),_0x373c87,'request\x20sent',JSON['stringify'](_0x540a0f));if(_0x540a0f[_0xf0e3('0x10')]){if(_0x540a0f['error']['code']===0x1f4){logger['error'](_0xf0e3('0x11'),_0x373c87,_0x540a0f[_0xf0e3('0x10')][_0xf0e3('0x12')]);return _0x51ad08(_0x540a0f['error'][_0xf0e3('0x12')]);}logger['error'](_0xf0e3('0x11'),_0x373c87,_0x540a0f[_0xf0e3('0x10')]['message']);return _0x49ff2f(_0x540a0f[_0xf0e3('0x10')][_0xf0e3('0x12')]);}else{logger[_0xf0e3('0xc')](_0xf0e3('0x11'),_0x373c87,_0xf0e3('0xd'));_0x49ff2f(_0x540a0f[_0xf0e3('0x13')][_0xf0e3('0x12')]);}})[_0xf0e3('0x14')](function(_0x11a8b1){logger[_0xf0e3('0x10')](_0xf0e3('0x11'),_0x373c87,_0x11a8b1);_0x51ad08(_0x11a8b1);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f67fdfa..3eca815 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 _0x294b=['../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x117356,_0x245b01){var _0x2a4f5a=function(_0x81ffef){while(--_0x81ffef){_0x117356['push'](_0x117356['shift']());}};_0x2a4f5a(++_0x245b01);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb294('0x0'));var util=require('util');var path=require(_0xb294('0x1'));var timeout=require(_0xb294('0x2'));var express=require(_0xb294('0x3'));var router=express[_0xb294('0x4')]();var fs_extra=require(_0xb294('0x5'));var auth=require(_0xb294('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb294('0x7'));router[_0xb294('0x8')]('/',auth[_0xb294('0x9')](),controller[_0xb294('0xa')]);router[_0xb294('0x8')]('/:id',auth[_0xb294('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb294('0xb')]);router[_0xb294('0xc')](_0xb294('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb294('0xd'),auth[_0xb294('0x9')](),controller[_0xb294('0xe')]);module[_0xb294('0xf')]=router; \ No newline at end of file +var _0xb491=['express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5c265d,_0x4351a4){var _0x1e348d=function(_0x34162b){while(--_0x34162b){_0x5c265d['push'](_0x5c265d['shift']());}};_0x1e348d(++_0x4351a4);}(_0xb491,0x18c));var _0x1b49=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb491[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var path=require(_0x1b49('0x2'));var timeout=require(_0x1b49('0x3'));var express=require(_0x1b49('0x4'));var router=express[_0x1b49('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b49('0x6'));var interaction=require(_0x1b49('0x7'));var config=require('../../config/environment');var controller=require(_0x1b49('0x8'));router[_0x1b49('0x9')]('/',auth[_0x1b49('0xa')](),controller['index']);router[_0x1b49('0x9')]('/:id',auth[_0x1b49('0xa')](),controller[_0x1b49('0xb')]);router[_0x1b49('0xc')]('/',auth[_0x1b49('0xa')](),controller[_0x1b49('0xd')]);router[_0x1b49('0xe')](_0x1b49('0xf'),auth[_0x1b49('0xa')](),controller[_0x1b49('0x10')]);router[_0x1b49('0x11')](_0x1b49('0xf'),auth[_0x1b49('0xa')](),controller[_0x1b49('0x12')]);module[_0x1b49('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ba9cb7d..8c21b5c 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 _0x8a6f=['TEXT','sequelize'];(function(_0x4e38c1,_0xf156d){var _0x42dbf9=function(_0x133b51){while(--_0x133b51){_0x4e38c1['push'](_0x4e38c1['shift']());}};_0x42dbf9(++_0xf156d);}(_0x8a6f,0x1a5));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf8a6('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf8a6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfe43=['TEXT','sequelize'];(function(_0x20eb8d,_0x133ef8){var _0x231423=function(_0x6571f1){while(--_0x6571f1){_0x20eb8d['push'](_0x20eb8d['shift']());}};_0x231423(++_0x133ef8);}(_0xfe43,0x10f));var _0x3fe4=function(_0x3aa97d,_0x1734c5){_0x3aa97d=_0x3aa97d-0x0;var _0x59bf69=_0xfe43[_0x3aa97d];return _0x59bf69;};'use strict';var Sequelize=require(_0x3fe4('0x0'));module['exports']={'tree':{'type':Sequelize[_0x3fe4('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 33d75d9..86b8ef7 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 _0x76b7=['sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','include','findAll','rows','show','keys','includeAll','options','find','catch','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x49873b,_0x26c041){var _0x4df91d=function(_0x4015d3){while(--_0x4015d3){_0x49873b['push'](_0x49873b['shift']());}};_0x4df91d(++_0x26c041);}(_0x76b7,0x128));var _0x776b=function(_0x16d29b,_0xa7e430){_0x16d29b=_0x16d29b-0x0;var _0x103f9d=_0x76b7[_0x16d29b];return _0x103f9d;};'use strict';var emlformat=require(_0x776b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x776b('0x1'));var rp=require(_0x776b('0x2'));var moment=require(_0x776b('0x3'));var BPromise=require(_0x776b('0x4'));var Mustache=require(_0x776b('0x5'));var util=require(_0x776b('0x6'));var path=require(_0x776b('0x7'));var sox=require(_0x776b('0x8'));var csv=require(_0x776b('0x9'));var ejs=require(_0x776b('0xa'));var fs=require('fs');var fs_extra=require(_0x776b('0xb'));var _=require(_0x776b('0xc'));var squel=require(_0x776b('0xd'));var crypto=require(_0x776b('0xe'));var jsforce=require(_0x776b('0xf'));var deskjs=require(_0x776b('0x10'));var toCsv=require(_0x776b('0x9'));var querystring=require(_0x776b('0x11'));var Papa=require(_0x776b('0x12'));var Redis=require('ioredis');var authService=require(_0x776b('0x13'));var qs=require(_0x776b('0x14'));var as=require(_0x776b('0x15'));var hardwareService=require(_0x776b('0x16'));var logger=require(_0x776b('0x17'))(_0x776b('0x18'));var utils=require(_0x776b('0x19'));var config=require(_0x776b('0x1a'));var licenseUtil=require(_0x776b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd81a4,_0x14037a){_0x14037a=_0x14037a||0xcc;return function(_0x4db86a){if(_0x4db86a){return _0xcd81a4[_0x776b('0x1c')](_0x14037a);}return _0xcd81a4['status'](_0x14037a)[_0x776b('0x1d')]();};}function respondWithResult(_0x46b729,_0x409aaa){_0x409aaa=_0x409aaa||0xc8;return function(_0x27fcbf){if(_0x27fcbf){return _0x46b729[_0x776b('0x1e')](_0x409aaa)[_0x776b('0x1f')](_0x27fcbf);}};}function respondWithFilteredResult(_0x222ff4,_0x2a0b7e){return function(_0x18a397){if(_0x18a397){var _0x41f5c9=typeof _0x2a0b7e['offset']===_0x776b('0x20')&&typeof _0x2a0b7e[_0x776b('0x21')]===_0x776b('0x20');var _0x1461ac=_0x18a397['count'];var _0x5effef=_0x41f5c9?0x0:_0x2a0b7e[_0x776b('0x22')];var _0x352225=_0x41f5c9?_0x18a397[_0x776b('0x23')]:_0x2a0b7e['offset']+_0x2a0b7e[_0x776b('0x21')];var _0x52fd98;if(_0x352225>=_0x1461ac){_0x352225=_0x1461ac;_0x52fd98=0xc8;}else{_0x52fd98=0xce;}_0x222ff4[_0x776b('0x1e')](_0x52fd98);return _0x222ff4[_0x776b('0x24')](_0x776b('0x25'),_0x5effef+'-'+_0x352225+'/'+_0x1461ac)[_0x776b('0x1f')](_0x18a397);}return null;};}function patchUpdates(_0x2f2406){return function(_0x560ca8){try{jsonpatch['apply'](_0x560ca8,_0x2f2406,!![]);}catch(_0x4416e4){return BPromise[_0x776b('0x26')](_0x4416e4);}return _0x560ca8[_0x776b('0x27')]();};}function saveUpdates(_0x10b6e7,_0x3bafe2){return function(_0x51c555){if(_0x51c555){return _0x51c555[_0x776b('0x28')](_0x10b6e7)[_0x776b('0x29')](function(_0x1dc2e3){return _0x1dc2e3;});}return null;};}function removeEntity(_0x3916f9,_0x17da71){return function(_0x4ed3d0){if(_0x4ed3d0){return _0x4ed3d0[_0x776b('0x2a')]()[_0x776b('0x29')](function(){_0x3916f9[_0x776b('0x1e')](0xcc)[_0x776b('0x1d')]();});}};}function handleEntityNotFound(_0x56dd23,_0x25a090){return function(_0x3ac0a7){if(!_0x3ac0a7){_0x56dd23[_0x776b('0x1c')](0x194);}return _0x3ac0a7;};}function handleError(_0x11b7b9,_0x21ccfc){_0x21ccfc=_0x21ccfc||0x1f4;return function(_0x3d4c46){logger[_0x776b('0x2b')](_0x3d4c46[_0x776b('0x2c')]);if(_0x3d4c46[_0x776b('0x2d')]){delete _0x3d4c46[_0x776b('0x2d')];}_0x11b7b9[_0x776b('0x1e')](_0x21ccfc)[_0x776b('0x2e')](_0x3d4c46);};}exports[_0x776b('0x2f')]=function(_0x1aaecc,_0x2dd71b){var _0x4f8c4d={},_0x423a88={},_0x2328ed={'count':0x0,'rows':[]};var _0x5ecbd2=_['map'](db[_0x776b('0x30')][_0x776b('0x31')],function(_0x4b6c70){return{'name':_0x4b6c70[_0x776b('0x32')],'type':_0x4b6c70[_0x776b('0x33')][_0x776b('0x34')]};});_0x423a88[_0x776b('0x35')]=_[_0x776b('0x36')](_0x5ecbd2,_0x776b('0x2d'));_0x423a88[_0x776b('0x37')]=_['keys'](_0x1aaecc[_0x776b('0x37')]);_0x423a88['filters']=_[_0x776b('0x38')](_0x423a88[_0x776b('0x35')],_0x423a88[_0x776b('0x37')]);_0x4f8c4d['attributes']=_['intersection'](_0x423a88[_0x776b('0x35')],qs[_0x776b('0x39')](_0x1aaecc['query'][_0x776b('0x39')]));_0x4f8c4d[_0x776b('0x3a')]=_0x4f8c4d[_0x776b('0x3a')][_0x776b('0x3b')]?_0x4f8c4d[_0x776b('0x3a')]:_0x423a88[_0x776b('0x35')];if(!_0x1aaecc['query']['hasOwnProperty'](_0x776b('0x3c'))){_0x4f8c4d[_0x776b('0x21')]=qs['limit'](_0x1aaecc[_0x776b('0x37')][_0x776b('0x21')]);_0x4f8c4d[_0x776b('0x22')]=qs[_0x776b('0x22')](_0x1aaecc[_0x776b('0x37')][_0x776b('0x22')]);}_0x4f8c4d[_0x776b('0x3d')]=qs[_0x776b('0x3e')](_0x1aaecc[_0x776b('0x37')]['sort']);_0x4f8c4d[_0x776b('0x3f')]=qs[_0x776b('0x40')](_[_0x776b('0x41')](_0x1aaecc[_0x776b('0x37')],_0x423a88[_0x776b('0x40')]),_0x5ecbd2);if(_0x1aaecc[_0x776b('0x37')]['filter']){_0x4f8c4d['where']=_['merge'](_0x4f8c4d[_0x776b('0x3f')],{'$or':_[_0x776b('0x36')](_0x5ecbd2,function(_0x2f534c){if(_0x2f534c[_0x776b('0x33')]!==_0x776b('0x42')){var _0x326b06={};_0x326b06[_0x2f534c[_0x776b('0x2d')]]={'$like':'%'+_0x1aaecc['query'][_0x776b('0x43')]+'%'};return _0x326b06;}})});}_0x4f8c4d=_[_0x776b('0x44')]({},_0x4f8c4d,_0x1aaecc['options']);var _0xd8f003={'where':_0x4f8c4d[_0x776b('0x3f')]};return db[_0x776b('0x30')][_0x776b('0x23')](_0xd8f003)[_0x776b('0x29')](function(_0x11c292){_0x2328ed[_0x776b('0x23')]=_0x11c292;if(_0x1aaecc['query']['includeAll']){_0x4f8c4d[_0x776b('0x45')]=[{'all':!![]}];}return db[_0x776b('0x30')][_0x776b('0x46')](_0x4f8c4d);})[_0x776b('0x29')](function(_0x1e07a3){_0x2328ed[_0x776b('0x47')]=_0x1e07a3;return _0x2328ed;})[_0x776b('0x29')](respondWithFilteredResult(_0x2dd71b,_0x4f8c4d))['catch'](handleError(_0x2dd71b,null));};exports[_0x776b('0x48')]=function(_0x4793d5,_0x295c54){var _0x5afdc6={'raw':!![],'where':{'id':_0x4793d5['params']['id']}},_0x9c9be7={};_0x9c9be7['model']=_[_0x776b('0x49')](db[_0x776b('0x30')][_0x776b('0x31')]);_0x9c9be7[_0x776b('0x37')]=_['keys'](_0x4793d5[_0x776b('0x37')]);_0x9c9be7['filters']=_['intersection'](_0x9c9be7[_0x776b('0x35')],_0x9c9be7[_0x776b('0x37')]);_0x5afdc6['attributes']=_[_0x776b('0x38')](_0x9c9be7[_0x776b('0x35')],qs['fields'](_0x4793d5['query'][_0x776b('0x39')]));_0x5afdc6[_0x776b('0x3a')]=_0x5afdc6['attributes'][_0x776b('0x3b')]?_0x5afdc6[_0x776b('0x3a')]:_0x9c9be7[_0x776b('0x35')];if(_0x4793d5['query'][_0x776b('0x4a')]){_0x5afdc6[_0x776b('0x45')]=[{'all':!![]}];}_0x5afdc6=_[_0x776b('0x44')]({},_0x5afdc6,_0x4793d5[_0x776b('0x4b')]);return db[_0x776b('0x30')][_0x776b('0x4c')](_0x5afdc6)[_0x776b('0x29')](handleEntityNotFound(_0x295c54,null))['then'](respondWithResult(_0x295c54,null))[_0x776b('0x4d')](handleError(_0x295c54,null));};exports[_0x776b('0x4e')]=function(_0x274ffa,_0x5629d2){return db['AnalyticTreeReport'][_0x776b('0x4e')](_0x274ffa[_0x776b('0x4f')],{})[_0x776b('0x29')](respondWithResult(_0x5629d2,0xc9))[_0x776b('0x4d')](handleError(_0x5629d2,null));};exports[_0x776b('0x28')]=function(_0x259573,_0x7fa115){if(_0x259573[_0x776b('0x4f')]['id']){delete _0x259573[_0x776b('0x4f')]['id'];}return db[_0x776b('0x30')][_0x776b('0x4c')]({'where':{'id':_0x259573[_0x776b('0x50')]['id']}})[_0x776b('0x29')](handleEntityNotFound(_0x7fa115,null))[_0x776b('0x29')](saveUpdates(_0x259573['body'],null))[_0x776b('0x29')](respondWithResult(_0x7fa115,null))['catch'](handleError(_0x7fa115,null));};exports[_0x776b('0x2a')]=function(_0x57e87d,_0x4027f5){return db['AnalyticTreeReport']['find']({'where':{'id':_0x57e87d[_0x776b('0x50')]['id']}})[_0x776b('0x29')](handleEntityNotFound(_0x4027f5,null))['then'](removeEntity(_0x4027f5,null))[_0x776b('0x4d')](handleError(_0x4027f5,null));}; \ No newline at end of file +var _0x084d=['end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0xe1bdfa,_0x5371ce){var _0x28daee=function(_0x3d0cbb){while(--_0x3d0cbb){_0xe1bdfa['push'](_0xe1bdfa['shift']());}};_0x28daee(++_0x5371ce);}(_0x084d,0x1f0));var _0xd084=function(_0x1ac0e4,_0x561600){_0x1ac0e4=_0x1ac0e4-0x0;var _0x3e0a05=_0x084d[_0x1ac0e4];return _0x3e0a05;};'use strict';var emlformat=require(_0xd084('0x0'));var rimraf=require(_0xd084('0x1'));var zipdir=require(_0xd084('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd084('0x3'));var moment=require(_0xd084('0x4'));var BPromise=require(_0xd084('0x5'));var Mustache=require(_0xd084('0x6'));var util=require(_0xd084('0x7'));var path=require(_0xd084('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd084('0x9'));var fs=require('fs');var fs_extra=require(_0xd084('0xa'));var _=require(_0xd084('0xb'));var squel=require(_0xd084('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd084('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd084('0xe'));var Papa=require(_0xd084('0xf'));var Redis=require('ioredis');var authService=require(_0xd084('0x10'));var qs=require(_0xd084('0x11'));var as=require(_0xd084('0x12'));var hardwareService=require(_0xd084('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd084('0x14'));var config=require(_0xd084('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd084('0x16'))['db'];function respondWithStatusCode(_0x4c7d89,_0xf40a57){_0xf40a57=_0xf40a57||0xcc;return function(_0x1cf598){if(_0x1cf598){return _0x4c7d89['sendStatus'](_0xf40a57);}return _0x4c7d89[_0xd084('0x17')](_0xf40a57)['end']();};}function respondWithResult(_0xedc714,_0x2e7157){_0x2e7157=_0x2e7157||0xc8;return function(_0x444924){if(_0x444924){return _0xedc714[_0xd084('0x17')](_0x2e7157)[_0xd084('0x18')](_0x444924);}};}function respondWithFilteredResult(_0x4e7450,_0x387e5e){return function(_0x43e7f1){if(_0x43e7f1){var _0x2545a4=typeof _0x387e5e[_0xd084('0x19')]===_0xd084('0x1a')&&typeof _0x387e5e[_0xd084('0x1b')]===_0xd084('0x1a');var _0x236794=_0x43e7f1[_0xd084('0x1c')];var _0x5dea67=_0x2545a4?0x0:_0x387e5e['offset'];var _0x1f26d1=_0x2545a4?_0x43e7f1[_0xd084('0x1c')]:_0x387e5e[_0xd084('0x19')]+_0x387e5e[_0xd084('0x1b')];var _0x5689e1;if(_0x1f26d1>=_0x236794){_0x1f26d1=_0x236794;_0x5689e1=0xc8;}else{_0x5689e1=0xce;}_0x4e7450['status'](_0x5689e1);return _0x4e7450[_0xd084('0x1d')](_0xd084('0x1e'),_0x5dea67+'-'+_0x1f26d1+'/'+_0x236794)[_0xd084('0x18')](_0x43e7f1);}return null;};}function patchUpdates(_0x360104){return function(_0x3d44f9){try{jsonpatch[_0xd084('0x1f')](_0x3d44f9,_0x360104,!![]);}catch(_0x52848f){return BPromise['reject'](_0x52848f);}return _0x3d44f9[_0xd084('0x20')]();};}function saveUpdates(_0x316ba1,_0x4a0085){return function(_0x1e1121){if(_0x1e1121){return _0x1e1121[_0xd084('0x21')](_0x316ba1)[_0xd084('0x22')](function(_0xe1042b){return _0xe1042b;});}return null;};}function removeEntity(_0x3b5854,_0x24aec5){return function(_0x4e01d1){if(_0x4e01d1){return _0x4e01d1[_0xd084('0x23')]()[_0xd084('0x22')](function(){_0x3b5854[_0xd084('0x17')](0xcc)[_0xd084('0x24')]();});}};}function handleEntityNotFound(_0x4320a1,_0xa4dbde){return function(_0x8d790){if(!_0x8d790){_0x4320a1[_0xd084('0x25')](0x194);}return _0x8d790;};}function handleError(_0x1cc951,_0x299e6a){_0x299e6a=_0x299e6a||0x1f4;return function(_0x24cf17){logger[_0xd084('0x26')](_0x24cf17[_0xd084('0x27')]);if(_0x24cf17['name']){delete _0x24cf17[_0xd084('0x28')];}_0x1cc951[_0xd084('0x17')](_0x299e6a)[_0xd084('0x29')](_0x24cf17);};}exports[_0xd084('0x2a')]=function(_0x10ef6c,_0x410b0a){var _0x2478f1={},_0x23c9f0={},_0x13d9bd={'count':0x0,'rows':[]};var _0x30ff7a=_[_0xd084('0x2b')](db[_0xd084('0x2c')][_0xd084('0x2d')],function(_0x1bfa50){return{'name':_0x1bfa50[_0xd084('0x2e')],'type':_0x1bfa50[_0xd084('0x2f')][_0xd084('0x30')]};});_0x23c9f0[_0xd084('0x31')]=_[_0xd084('0x2b')](_0x30ff7a,'name');_0x23c9f0['query']=_[_0xd084('0x32')](_0x10ef6c[_0xd084('0x33')]);_0x23c9f0[_0xd084('0x34')]=_['intersection'](_0x23c9f0[_0xd084('0x31')],_0x23c9f0[_0xd084('0x33')]);_0x2478f1[_0xd084('0x35')]=_[_0xd084('0x36')](_0x23c9f0['model'],qs[_0xd084('0x37')](_0x10ef6c['query'][_0xd084('0x37')]));_0x2478f1[_0xd084('0x35')]=_0x2478f1[_0xd084('0x35')][_0xd084('0x38')]?_0x2478f1['attributes']:_0x23c9f0[_0xd084('0x31')];if(!_0x10ef6c['query'][_0xd084('0x39')](_0xd084('0x3a'))){_0x2478f1[_0xd084('0x1b')]=qs[_0xd084('0x1b')](_0x10ef6c[_0xd084('0x33')][_0xd084('0x1b')]);_0x2478f1[_0xd084('0x19')]=qs['offset'](_0x10ef6c[_0xd084('0x33')][_0xd084('0x19')]);}_0x2478f1[_0xd084('0x3b')]=qs[_0xd084('0x3c')](_0x10ef6c[_0xd084('0x33')][_0xd084('0x3c')]);_0x2478f1[_0xd084('0x3d')]=qs[_0xd084('0x34')](_['pick'](_0x10ef6c[_0xd084('0x33')],_0x23c9f0[_0xd084('0x34')]),_0x30ff7a);if(_0x10ef6c['query'][_0xd084('0x3e')]){_0x2478f1[_0xd084('0x3d')]=_[_0xd084('0x3f')](_0x2478f1[_0xd084('0x3d')],{'$or':_[_0xd084('0x2b')](_0x30ff7a,function(_0x1e87be){if(_0x1e87be['type']!==_0xd084('0x40')){var _0x41b5fa={};_0x41b5fa[_0x1e87be[_0xd084('0x28')]]={'$like':'%'+_0x10ef6c[_0xd084('0x33')][_0xd084('0x3e')]+'%'};return _0x41b5fa;}})});}_0x2478f1=_['merge']({},_0x2478f1,_0x10ef6c[_0xd084('0x41')]);var _0xbb210a={'where':_0x2478f1[_0xd084('0x3d')]};return db['AnalyticTreeReport']['count'](_0xbb210a)['then'](function(_0x519a7c){_0x13d9bd['count']=_0x519a7c;if(_0x10ef6c[_0xd084('0x33')]['includeAll']){_0x2478f1[_0xd084('0x42')]=[{'all':!![]}];}return db[_0xd084('0x2c')][_0xd084('0x43')](_0x2478f1);})[_0xd084('0x22')](function(_0x176424){_0x13d9bd[_0xd084('0x44')]=_0x176424;return _0x13d9bd;})[_0xd084('0x22')](respondWithFilteredResult(_0x410b0a,_0x2478f1))[_0xd084('0x45')](handleError(_0x410b0a,null));};exports[_0xd084('0x46')]=function(_0x522012,_0xa49f24){var _0x4d2fb6={'raw':!![],'where':{'id':_0x522012[_0xd084('0x47')]['id']}},_0x52fc6a={};_0x52fc6a[_0xd084('0x31')]=_[_0xd084('0x32')](db[_0xd084('0x2c')]['rawAttributes']);_0x52fc6a['query']=_[_0xd084('0x32')](_0x522012[_0xd084('0x33')]);_0x52fc6a['filters']=_[_0xd084('0x36')](_0x52fc6a[_0xd084('0x31')],_0x52fc6a[_0xd084('0x33')]);_0x4d2fb6[_0xd084('0x35')]=_[_0xd084('0x36')](_0x52fc6a[_0xd084('0x31')],qs[_0xd084('0x37')](_0x522012[_0xd084('0x33')][_0xd084('0x37')]));_0x4d2fb6[_0xd084('0x35')]=_0x4d2fb6[_0xd084('0x35')][_0xd084('0x38')]?_0x4d2fb6[_0xd084('0x35')]:_0x52fc6a[_0xd084('0x31')];if(_0x522012[_0xd084('0x33')][_0xd084('0x48')]){_0x4d2fb6['include']=[{'all':!![]}];}_0x4d2fb6=_[_0xd084('0x3f')]({},_0x4d2fb6,_0x522012['options']);return db['AnalyticTreeReport'][_0xd084('0x49')](_0x4d2fb6)['then'](handleEntityNotFound(_0xa49f24,null))[_0xd084('0x22')](respondWithResult(_0xa49f24,null))[_0xd084('0x45')](handleError(_0xa49f24,null));};exports[_0xd084('0x4a')]=function(_0x2b8862,_0x19b951){return db[_0xd084('0x2c')][_0xd084('0x4a')](_0x2b8862[_0xd084('0x4b')],{})['then'](respondWithResult(_0x19b951,0xc9))[_0xd084('0x45')](handleError(_0x19b951,null));};exports[_0xd084('0x21')]=function(_0xf738dd,_0x334c42){if(_0xf738dd['body']['id']){delete _0xf738dd[_0xd084('0x4b')]['id'];}return db[_0xd084('0x2c')][_0xd084('0x49')]({'where':{'id':_0xf738dd[_0xd084('0x47')]['id']}})['then'](handleEntityNotFound(_0x334c42,null))[_0xd084('0x22')](saveUpdates(_0xf738dd[_0xd084('0x4b')],null))[_0xd084('0x22')](respondWithResult(_0x334c42,null))[_0xd084('0x45')](handleError(_0x334c42,null));};exports['destroy']=function(_0x3460ea,_0x373db8){return db[_0xd084('0x2c')][_0xd084('0x49')]({'where':{'id':_0x3460ea[_0xd084('0x47')]['id']}})[_0xd084('0x22')](handleEntityNotFound(_0x373db8,null))[_0xd084('0x22')](removeEntity(_0x373db8,null))[_0xd084('0x45')](handleError(_0x373db8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1acd0a8..f968ce5 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 _0x03e3=['api','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','util'];(function(_0x408357,_0x56042b){var _0x55812f=function(_0x622bf0){while(--_0x622bf0){_0x408357['push'](_0x408357['shift']());}};_0x55812f(++_0x56042b);}(_0x03e3,0xfb));var _0x303e=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x03e3[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0x303e('0x0'));var logger=require('../../config/logger')(_0x303e('0x1'));var moment=require(_0x303e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x303e('0x3'));var rimraf=require(_0x303e('0x4'));var config=require(_0x303e('0x5'));var attributes=require(_0x303e('0x6'));module[_0x303e('0x7')]=function(_0x13eea0,_0x5e58d4){return _0x13eea0[_0x303e('0x8')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x157f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x157f,0x1e0));var _0xf157=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x157f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xf157('0x0'));var logger=require(_0xf157('0x1'))(_0xf157('0x2'));var moment=require(_0xf157('0x3'));var BPromise=require(_0xf157('0x4'));var rp=require(_0xf157('0x5'));var fs=require('fs');var path=require(_0xf157('0x6'));var rimraf=require(_0xf157('0x7'));var config=require('../../config/environment');var attributes=require(_0xf157('0x8'));module[_0xf157('0x9')]=function(_0xe96228,_0x39e4f5){return _0xe96228['define'](_0xf157('0xa'),attributes,{'tableName':_0xf157('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 9b80d3e..7f7624a 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(_0x4ee5d3,_0x432589){var _0x3a0562=function(_0x442e4a){while(--_0x442e4a){_0x4ee5d3['push'](_0x4ee5d3['shift']());}};_0x3a0562(++_0x432589);}(_0x2ef3,0xba));var _0x32ef=function(_0xd20e6,_0x1fd952){_0xd20e6=_0xd20e6-0x0;var _0x179c35=_0x2ef3[_0xd20e6];return _0x179c35;};'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 _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(_0xd91551,_0x52d19c){var _0x4a387c=function(_0x1207a4){while(--_0x1207a4){_0xd91551['push'](_0xd91551['shift']());}};_0x4a387c(++_0x52d19c);}(_0x2ef3,0xba));var _0x32ef=function(_0x313d17,_0x6ca19){_0x313d17=_0x313d17-0x0;var _0x1030d7=_0x2ef3[_0x313d17];return _0x1030d7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index dd9dbe6..682f5ae 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 _0x007a=['get','index','/:id','post','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x007a,0x1b1));var _0xa007=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x007a[_0x6dd5c];return _0x5a87fa;};'use strict';var multer=require(_0xa007('0x0'));var util=require(_0xa007('0x1'));var path=require(_0xa007('0x2'));var timeout=require(_0xa007('0x3'));var express=require('express');var router=express[_0xa007('0x4')]();var fs_extra=require(_0xa007('0x5'));var auth=require(_0xa007('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa007('0x7'));var controller=require(_0xa007('0x8'));router[_0xa007('0x9')]('/',auth['isAuthenticated'](),controller[_0xa007('0xa')]);router[_0xa007('0x9')](_0xa007('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa007('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa007('0xd')](_0xa007('0xb'),auth[_0xa007('0xe')](),controller['update']);router[_0xa007('0xf')](_0xa007('0xb'),auth[_0xa007('0xe')](),controller[_0xa007('0x10')]);module['exports']=router; \ No newline at end of file +var _0xde5b=['post','create','put','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde5b,0x15b));var _0xbde5=function(_0x3164df,_0x422e0b){_0x3164df=_0x3164df-0x0;var _0x55a888=_0xde5b[_0x3164df];return _0x55a888;};'use strict';var multer=require(_0xbde5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbde5('0x1'));var express=require(_0xbde5('0x2'));var router=express[_0xbde5('0x3')]();var fs_extra=require(_0xbde5('0x4'));var auth=require(_0xbde5('0x5'));var interaction=require(_0xbde5('0x6'));var config=require(_0xbde5('0x7'));var controller=require(_0xbde5('0x8'));router[_0xbde5('0x9')]('/',auth[_0xbde5('0xa')](),controller[_0xbde5('0xb')]);router[_0xbde5('0x9')](_0xbde5('0xc'),auth[_0xbde5('0xa')](),controller['show']);router[_0xbde5('0xd')]('/',auth[_0xbde5('0xa')](),controller[_0xbde5('0xe')]);router[_0xbde5('0xf')](_0xbde5('0xc'),auth[_0xbde5('0xa')](),controller['update']);router[_0xbde5('0x10')](_0xbde5('0xc'),auth[_0xbde5('0xa')](),controller[_0xbde5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index cae0e2e..c82275a 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 _0x8781=['sequelize','exports','STRING'];(function(_0x284d0c,_0x2c902b){var _0x195652=function(_0x56518f){while(--_0x56518f){_0x284d0c['push'](_0x284d0c['shift']());}};_0x195652(++_0x2c902b);}(_0x8781,0x1c8));var _0x1878=function(_0xcdd7f6,_0x1b6b9f){_0xcdd7f6=_0xcdd7f6-0x0;var _0xd3cd3f=_0x8781[_0xcdd7f6];return _0xd3cd3f;};'use strict';var Sequelize=require(_0x1878('0x0'));module[_0x1878('0x1')]={'name':{'type':Sequelize[_0x1878('0x2')]},'basename':{'type':Sequelize[_0x1878('0x2')]},'type':{'type':Sequelize[_0x1878('0x2')]}}; \ No newline at end of file +var _0x53d5=['STRING','sequelize','exports'];(function(_0x596a28,_0x4cab9a){var _0x1bcb1f=function(_0xf9dda7){while(--_0xf9dda7){_0x596a28['push'](_0x596a28['shift']());}};_0x1bcb1f(++_0x4cab9a);}(_0x53d5,0x1cc));var _0x553d=function(_0x32f109,_0x1f1b71){_0x32f109=_0x32f109-0x0;var _0x550dc7=_0x53d5[_0x32f109];return _0x550dc7;};'use strict';var Sequelize=require(_0x553d('0x0'));module[_0x553d('0x1')]={'name':{'type':Sequelize[_0x553d('0x2')]},'basename':{'type':Sequelize[_0x553d('0x2')]},'type':{'type':Sequelize[_0x553d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 78a6139..25c8e86 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 _0xc497=['sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','includeAll','find','catch','clone','keys','get','omit','createdAt','updatedAt','body','originalname','file','filename','type','mimetype','download','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','basename','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','name','send','index','map','Attachment','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x586d8c,_0x32da99){var _0x173163=function(_0x530cac){while(--_0x530cac){_0x586d8c['push'](_0x586d8c['shift']());}};_0x173163(++_0x32da99);}(_0xc497,0x1ce));var _0x7c49=function(_0xc13260,_0x1e7b6a){_0xc13260=_0xc13260-0x0;var _0x2277ca=_0xc497[_0xc13260];return _0x2277ca;};'use strict';var emlformat=require(_0x7c49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c49('0x1'));var jsonpatch=require(_0x7c49('0x2'));var rp=require('request-promise');var moment=require(_0x7c49('0x3'));var BPromise=require(_0x7c49('0x4'));var Mustache=require('mustache');var util=require(_0x7c49('0x5'));var path=require(_0x7c49('0x6'));var sox=require(_0x7c49('0x7'));var csv=require(_0x7c49('0x8'));var ejs=require(_0x7c49('0x9'));var fs=require('fs');var fs_extra=require(_0x7c49('0xa'));var _=require(_0x7c49('0xb'));var squel=require(_0x7c49('0xc'));var crypto=require('crypto');var jsforce=require(_0x7c49('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c49('0xe'));var Papa=require(_0x7c49('0xf'));var Redis=require(_0x7c49('0x10'));var authService=require(_0x7c49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7c49('0x12'));var hardwareService=require(_0x7c49('0x13'));var logger=require(_0x7c49('0x14'))('api');var utils=require(_0x7c49('0x15'));var config=require(_0x7c49('0x16'));var licenseUtil=require(_0x7c49('0x17'));var db=require(_0x7c49('0x18'))['db'];function respondWithStatusCode(_0x217b2c,_0x5ef8ef){_0x5ef8ef=_0x5ef8ef||0xcc;return function(_0x3e5aca){if(_0x3e5aca){return _0x217b2c[_0x7c49('0x19')](_0x5ef8ef);}return _0x217b2c[_0x7c49('0x1a')](_0x5ef8ef)[_0x7c49('0x1b')]();};}function respondWithResult(_0x1f8bdd,_0x23f1b5){_0x23f1b5=_0x23f1b5||0xc8;return function(_0x268539){if(_0x268539){return _0x1f8bdd['status'](_0x23f1b5)[_0x7c49('0x1c')](_0x268539);}};}function respondWithFilteredResult(_0x102c93,_0x472e42){return function(_0x2360f7){if(_0x2360f7){var _0x38d317=typeof _0x472e42[_0x7c49('0x1d')]===_0x7c49('0x1e')&&typeof _0x472e42['limit']===_0x7c49('0x1e');var _0x15c6dc=_0x2360f7[_0x7c49('0x1f')];var _0x3b240e=_0x38d317?0x0:_0x472e42[_0x7c49('0x1d')];var _0x279bdc=_0x38d317?_0x2360f7['count']:_0x472e42[_0x7c49('0x1d')]+_0x472e42[_0x7c49('0x20')];var _0x2989b9;if(_0x279bdc>=_0x15c6dc){_0x279bdc=_0x15c6dc;_0x2989b9=0xc8;}else{_0x2989b9=0xce;}_0x102c93['status'](_0x2989b9);return _0x102c93['set']('Content-Range',_0x3b240e+'-'+_0x279bdc+'/'+_0x15c6dc)[_0x7c49('0x1c')](_0x2360f7);}return null;};}function patchUpdates(_0x1c0608){return function(_0x296432){try{jsonpatch[_0x7c49('0x21')](_0x296432,_0x1c0608,!![]);}catch(_0x4dc42a){return BPromise[_0x7c49('0x22')](_0x4dc42a);}return _0x296432[_0x7c49('0x23')]();};}function saveUpdates(_0x2a63cb,_0x51f8a2){return function(_0x357478){if(_0x357478){return _0x357478[_0x7c49('0x24')](_0x2a63cb)['then'](function(_0x3f2ae2){return _0x3f2ae2;});}return null;};}function removeEntity(_0x54451c,_0x143ced){return function(_0x4f34a4){if(_0x4f34a4){return _0x4f34a4['destroy']()[_0x7c49('0x25')](function(){_0x54451c[_0x7c49('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec9ee9,_0x3e9a12){return function(_0x3ca358){if(!_0x3ca358){_0xec9ee9[_0x7c49('0x19')](0x194);}return _0x3ca358;};}function handleError(_0x591088,_0x1d2177){_0x1d2177=_0x1d2177||0x1f4;return function(_0x58da52){logger['error'](_0x58da52['stack']);if(_0x58da52[_0x7c49('0x26')]){delete _0x58da52['name'];}_0x591088['status'](_0x1d2177)[_0x7c49('0x27')](_0x58da52);};}exports[_0x7c49('0x28')]=function(_0x1002b6,_0x442231){var _0x45aaa5={},_0x3a323f={},_0x52a258={'count':0x0,'rows':[]};var _0x155772=_[_0x7c49('0x29')](db[_0x7c49('0x2a')][_0x7c49('0x2b')],function(_0x27c233){return{'name':_0x27c233['fieldName'],'type':_0x27c233['type'][_0x7c49('0x2c')]};});_0x3a323f[_0x7c49('0x2d')]=_[_0x7c49('0x29')](_0x155772,_0x7c49('0x26'));_0x3a323f[_0x7c49('0x2e')]=_['keys'](_0x1002b6[_0x7c49('0x2e')]);_0x3a323f[_0x7c49('0x2f')]=_[_0x7c49('0x30')](_0x3a323f[_0x7c49('0x2d')],_0x3a323f[_0x7c49('0x2e')]);_0x45aaa5['attributes']=_[_0x7c49('0x30')](_0x3a323f['model'],qs[_0x7c49('0x31')](_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x31')]));_0x45aaa5[_0x7c49('0x32')]=_0x45aaa5[_0x7c49('0x32')][_0x7c49('0x33')]?_0x45aaa5[_0x7c49('0x32')]:_0x3a323f['model'];if(!_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x34')](_0x7c49('0x35'))){_0x45aaa5['limit']=qs['limit'](_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x20')]);_0x45aaa5[_0x7c49('0x1d')]=qs['offset'](_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x1d')]);}_0x45aaa5['order']=qs[_0x7c49('0x36')](_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x36')]);_0x45aaa5[_0x7c49('0x37')]=qs[_0x7c49('0x2f')](_[_0x7c49('0x38')](_0x1002b6['query'],_0x3a323f[_0x7c49('0x2f')]),_0x155772);if(_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x39')]){_0x45aaa5[_0x7c49('0x37')]=_[_0x7c49('0x3a')](_0x45aaa5[_0x7c49('0x37')],{'$or':_[_0x7c49('0x29')](_0x155772,function(_0x11e0c0){if(_0x11e0c0['type']!==_0x7c49('0x3b')){var _0x2ca840={};_0x2ca840[_0x11e0c0[_0x7c49('0x26')]]={'$like':'%'+_0x1002b6[_0x7c49('0x2e')][_0x7c49('0x39')]+'%'};return _0x2ca840;}})});}_0x45aaa5=_[_0x7c49('0x3a')]({},_0x45aaa5,_0x1002b6[_0x7c49('0x3c')]);var _0x582422={'where':_0x45aaa5['where']};return db[_0x7c49('0x2a')]['count'](_0x582422)[_0x7c49('0x25')](function(_0x133d26){_0x52a258[_0x7c49('0x1f')]=_0x133d26;if(_0x1002b6[_0x7c49('0x2e')]['includeAll']){_0x45aaa5[_0x7c49('0x3d')]=[{'all':!![]}];}return db[_0x7c49('0x2a')]['findAll'](_0x45aaa5);})[_0x7c49('0x25')](function(_0x5a5c1a){_0x52a258['rows']=_0x5a5c1a;return _0x52a258;})[_0x7c49('0x25')](respondWithFilteredResult(_0x442231,_0x45aaa5))['catch'](handleError(_0x442231,null));};exports[_0x7c49('0x3e')]=function(_0x44bf48,_0x56c853){var _0x51fd07={'raw':!![],'where':{'id':_0x44bf48[_0x7c49('0x3f')]['id']}},_0xcd9c5a={};_0xcd9c5a[_0x7c49('0x2d')]=_['keys'](db['Attachment'][_0x7c49('0x2b')]);_0xcd9c5a[_0x7c49('0x2e')]=_['keys'](_0x44bf48[_0x7c49('0x2e')]);_0xcd9c5a[_0x7c49('0x2f')]=_[_0x7c49('0x30')](_0xcd9c5a[_0x7c49('0x2d')],_0xcd9c5a[_0x7c49('0x2e')]);_0x51fd07[_0x7c49('0x32')]=_['intersection'](_0xcd9c5a[_0x7c49('0x2d')],qs['fields'](_0x44bf48[_0x7c49('0x2e')][_0x7c49('0x31')]));_0x51fd07[_0x7c49('0x32')]=_0x51fd07[_0x7c49('0x32')]['length']?_0x51fd07[_0x7c49('0x32')]:_0xcd9c5a[_0x7c49('0x2d')];if(_0x44bf48[_0x7c49('0x2e')][_0x7c49('0x40')]){_0x51fd07[_0x7c49('0x3d')]=[{'all':!![]}];}_0x51fd07=_[_0x7c49('0x3a')]({},_0x51fd07,_0x44bf48['options']);return db[_0x7c49('0x2a')][_0x7c49('0x41')](_0x51fd07)[_0x7c49('0x25')](handleEntityNotFound(_0x56c853,null))[_0x7c49('0x25')](respondWithResult(_0x56c853,null))[_0x7c49('0x42')](handleError(_0x56c853,null));};exports[_0x7c49('0x43')]=function(_0x5052fb,_0x293006){var _0x1c0501={'where':{'id':_0x5052fb[_0x7c49('0x3f')]['id']}},_0xf0c61c={};_0xf0c61c[_0x7c49('0x2d')]=_[_0x7c49('0x44')](db[_0x7c49('0x2a')][_0x7c49('0x2b')]);_0x1c0501[_0x7c49('0x32')]=_[_0x7c49('0x30')](_0xf0c61c['model'],qs['fields'](_0x5052fb[_0x7c49('0x2e')][_0x7c49('0x31')]));_0x1c0501['attributes']=_0x1c0501[_0x7c49('0x32')][_0x7c49('0x33')]?_0x1c0501['attributes']:_0xf0c61c['model'];if(_0x5052fb[_0x7c49('0x2e')][_0x7c49('0x40')]){_0x1c0501[_0x7c49('0x3d')]=[{'all':!![]}];}_0x1c0501=_[_0x7c49('0x3a')]({},_0x1c0501,_0x5052fb[_0x7c49('0x3c')]);return db['Attachment']['find'](_0x1c0501)[_0x7c49('0x25')](handleEntityNotFound(_0x293006,null))[_0x7c49('0x25')](function(_0xd6b98d){if(_0xd6b98d){var _0x136c51=_0xd6b98d[_0x7c49('0x45')]({'plain':!![]});_0x136c51=qs[_0x7c49('0x46')](_0x136c51,['id',_0x7c49('0x47'),_0x7c49('0x48')]);_0x5052fb[_0x7c49('0x49')]=_[_0x7c49('0x46')](_0x5052fb[_0x7c49('0x49')],['id',_0x7c49('0x47'),_0x7c49('0x48')]);return db['Attachment']['create'](_[_0x7c49('0x3a')](_0x136c51,_0x5052fb[_0x7c49('0x49')]),{'include':_0x5052fb[_0x7c49('0x2e')][_0x7c49('0x40')]?[{'all':!![]}]:undefined});}})[_0x7c49('0x25')](respondWithResult(_0x293006,0xc9))[_0x7c49('0x42')](handleError(_0x293006,null));};exports[_0x7c49('0x24')]=function(_0x8990e5,_0x4f4aac){if(_0x8990e5[_0x7c49('0x49')]['id']){delete _0x8990e5[_0x7c49('0x49')]['id'];}return db[_0x7c49('0x2a')][_0x7c49('0x41')]({'where':{'id':_0x8990e5['params']['id']}})[_0x7c49('0x25')](handleEntityNotFound(_0x4f4aac,null))['then'](saveUpdates(_0x8990e5[_0x7c49('0x49')],null))[_0x7c49('0x25')](respondWithResult(_0x4f4aac,null))['catch'](handleError(_0x4f4aac,null));};exports['destroy']=function(_0x33ae61,_0x1e1458){return db[_0x7c49('0x2a')]['find']({'where':{'id':_0x33ae61[_0x7c49('0x3f')]['id']}})[_0x7c49('0x25')](handleEntityNotFound(_0x1e1458,null))[_0x7c49('0x25')](removeEntity(_0x1e1458,null))[_0x7c49('0x42')](handleError(_0x1e1458,null));};exports['create']=function(_0x57ab6f,_0x83fbc,_0x3372d8){_0x57ab6f[_0x7c49('0x49')][_0x7c49('0x26')]=_0x57ab6f['file'][_0x7c49('0x4a')];_0x57ab6f['body']['basename']=_0x57ab6f[_0x7c49('0x4b')][_0x7c49('0x4c')];_0x57ab6f[_0x7c49('0x49')][_0x7c49('0x4d')]=_0x57ab6f[_0x7c49('0x4b')][_0x7c49('0x4e')];return db['Attachment']['create'](_0x57ab6f[_0x7c49('0x49')])[_0x7c49('0x25')](respondWithResult(_0x83fbc,0xc9))[_0x7c49('0x42')](handleError(_0x83fbc,null));};exports[_0x7c49('0x4f')]=function(_0x36ae3f,_0x3fa8b2,_0x83d7f2){return db[_0x7c49('0x2a')]['findOne']({'where':{'id':_0x36ae3f['params']['id']},'raw':!![]})[_0x7c49('0x25')](handleEntityNotFound(_0x3fa8b2,null))[_0x7c49('0x25')](function(_0x504c82){if(_0x504c82){var _0x5602d4=_0x504c82[_0x7c49('0x50')]!==null;var _0x47f9a4=path['join'](config[_0x7c49('0x51')],_0x7c49('0x52'));if(_0x5602d4){_0x47f9a4=path['join'](_0x47f9a4,_0x7c49('0x53'));}var _0x19929=path[_0x7c49('0x54')](_0x47f9a4,_0x504c82[_0x7c49('0x55')]);return _0x3fa8b2[_0x7c49('0x4f')](_0x19929);}})[_0x7c49('0x42')](handleError(_0x3fa8b2,null));}; \ No newline at end of file +var _0xbf83=['set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','options','include','Attachment','rows','show','params','includeAll','find','catch','clone','omit','createdAt','updatedAt','body','create','file','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count'];(function(_0x184b97,_0x4a6a57){var _0x35b5e2=function(_0x29f22b){while(--_0x29f22b){_0x184b97['push'](_0x184b97['shift']());}};_0x35b5e2(++_0x4a6a57);}(_0xbf83,0x8d));var _0x3bf8=function(_0x5307b8,_0x4eea1a){_0x5307b8=_0x5307b8-0x0;var _0x3e206b=_0xbf83[_0x5307b8];return _0x3e206b;};'use strict';var emlformat=require(_0x3bf8('0x0'));var rimraf=require(_0x3bf8('0x1'));var zipdir=require(_0x3bf8('0x2'));var jsonpatch=require(_0x3bf8('0x3'));var rp=require(_0x3bf8('0x4'));var moment=require(_0x3bf8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3bf8('0x6'));var util=require(_0x3bf8('0x7'));var path=require(_0x3bf8('0x8'));var sox=require('sox');var csv=require(_0x3bf8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bf8('0xa'));var squel=require(_0x3bf8('0xb'));var crypto=require(_0x3bf8('0xc'));var jsforce=require(_0x3bf8('0xd'));var deskjs=require(_0x3bf8('0xe'));var toCsv=require(_0x3bf8('0x9'));var querystring=require(_0x3bf8('0xf'));var Papa=require('papaparse');var Redis=require(_0x3bf8('0x10'));var authService=require(_0x3bf8('0x11'));var qs=require(_0x3bf8('0x12'));var as=require(_0x3bf8('0x13'));var hardwareService=require(_0x3bf8('0x14'));var logger=require('../../config/logger')(_0x3bf8('0x15'));var utils=require('../../config/utils');var config=require(_0x3bf8('0x16'));var licenseUtil=require(_0x3bf8('0x17'));var db=require(_0x3bf8('0x18'))['db'];function respondWithStatusCode(_0x1258c9,_0x2ea2f2){_0x2ea2f2=_0x2ea2f2||0xcc;return function(_0x2f1e62){if(_0x2f1e62){return _0x1258c9[_0x3bf8('0x19')](_0x2ea2f2);}return _0x1258c9[_0x3bf8('0x1a')](_0x2ea2f2)['end']();};}function respondWithResult(_0x1d8339,_0x22ee50){_0x22ee50=_0x22ee50||0xc8;return function(_0x34f941){if(_0x34f941){return _0x1d8339[_0x3bf8('0x1a')](_0x22ee50)['json'](_0x34f941);}};}function respondWithFilteredResult(_0x38a4bf,_0x23ce13){return function(_0x558ded){if(_0x558ded){var _0xfef83d=typeof _0x23ce13[_0x3bf8('0x1b')]==='undefined'&&typeof _0x23ce13[_0x3bf8('0x1c')]===_0x3bf8('0x1d');var _0x202eb0=_0x558ded['count'];var _0x4ed680=_0xfef83d?0x0:_0x23ce13[_0x3bf8('0x1b')];var _0x44ede6=_0xfef83d?_0x558ded[_0x3bf8('0x1e')]:_0x23ce13[_0x3bf8('0x1b')]+_0x23ce13[_0x3bf8('0x1c')];var _0x3eae09;if(_0x44ede6>=_0x202eb0){_0x44ede6=_0x202eb0;_0x3eae09=0xc8;}else{_0x3eae09=0xce;}_0x38a4bf[_0x3bf8('0x1a')](_0x3eae09);return _0x38a4bf[_0x3bf8('0x1f')](_0x3bf8('0x20'),_0x4ed680+'-'+_0x44ede6+'/'+_0x202eb0)[_0x3bf8('0x21')](_0x558ded);}return null;};}function patchUpdates(_0x4f273b){return function(_0x425dea){try{jsonpatch[_0x3bf8('0x22')](_0x425dea,_0x4f273b,!![]);}catch(_0x2559e4){return BPromise['reject'](_0x2559e4);}return _0x425dea[_0x3bf8('0x23')]();};}function saveUpdates(_0x5e197b,_0x50724a){return function(_0x147024){if(_0x147024){return _0x147024[_0x3bf8('0x24')](_0x5e197b)[_0x3bf8('0x25')](function(_0x2291a8){return _0x2291a8;});}return null;};}function removeEntity(_0x50515a,_0x1540da){return function(_0x50c971){if(_0x50c971){return _0x50c971[_0x3bf8('0x26')]()[_0x3bf8('0x25')](function(){_0x50515a[_0x3bf8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a8c29,_0x22f07c){return function(_0x23f9f9){if(!_0x23f9f9){_0x9a8c29[_0x3bf8('0x19')](0x194);}return _0x23f9f9;};}function handleError(_0x202051,_0x352ad4){_0x352ad4=_0x352ad4||0x1f4;return function(_0xf51695){logger[_0x3bf8('0x27')](_0xf51695[_0x3bf8('0x28')]);if(_0xf51695[_0x3bf8('0x29')]){delete _0xf51695[_0x3bf8('0x29')];}_0x202051[_0x3bf8('0x1a')](_0x352ad4)['send'](_0xf51695);};}exports['index']=function(_0x5d61a4,_0x321daa){var _0x3b8c40={},_0x39187a={},_0x31f615={'count':0x0,'rows':[]};var _0x272f6b=_[_0x3bf8('0x2a')](db['Attachment'][_0x3bf8('0x2b')],function(_0x5bfdda){return{'name':_0x5bfdda[_0x3bf8('0x2c')],'type':_0x5bfdda[_0x3bf8('0x2d')][_0x3bf8('0x2e')]};});_0x39187a[_0x3bf8('0x2f')]=_[_0x3bf8('0x2a')](_0x272f6b,_0x3bf8('0x29'));_0x39187a[_0x3bf8('0x30')]=_[_0x3bf8('0x31')](_0x5d61a4[_0x3bf8('0x30')]);_0x39187a['filters']=_['intersection'](_0x39187a[_0x3bf8('0x2f')],_0x39187a[_0x3bf8('0x30')]);_0x3b8c40[_0x3bf8('0x32')]=_[_0x3bf8('0x33')](_0x39187a[_0x3bf8('0x2f')],qs[_0x3bf8('0x34')](_0x5d61a4[_0x3bf8('0x30')][_0x3bf8('0x34')]));_0x3b8c40['attributes']=_0x3b8c40[_0x3bf8('0x32')][_0x3bf8('0x35')]?_0x3b8c40[_0x3bf8('0x32')]:_0x39187a[_0x3bf8('0x2f')];if(!_0x5d61a4[_0x3bf8('0x30')][_0x3bf8('0x36')]('nolimit')){_0x3b8c40[_0x3bf8('0x1c')]=qs[_0x3bf8('0x1c')](_0x5d61a4[_0x3bf8('0x30')]['limit']);_0x3b8c40[_0x3bf8('0x1b')]=qs['offset'](_0x5d61a4[_0x3bf8('0x30')][_0x3bf8('0x1b')]);}_0x3b8c40[_0x3bf8('0x37')]=qs['sort'](_0x5d61a4['query']['sort']);_0x3b8c40[_0x3bf8('0x38')]=qs[_0x3bf8('0x39')](_['pick'](_0x5d61a4[_0x3bf8('0x30')],_0x39187a['filters']),_0x272f6b);if(_0x5d61a4[_0x3bf8('0x30')][_0x3bf8('0x3a')]){_0x3b8c40[_0x3bf8('0x38')]=_[_0x3bf8('0x3b')](_0x3b8c40['where'],{'$or':_[_0x3bf8('0x2a')](_0x272f6b,function(_0x4c6b9a){if(_0x4c6b9a['type']!==_0x3bf8('0x3c')){var _0x1d327f={};_0x1d327f[_0x4c6b9a[_0x3bf8('0x29')]]={'$like':'%'+_0x5d61a4[_0x3bf8('0x30')][_0x3bf8('0x3a')]+'%'};return _0x1d327f;}})});}_0x3b8c40=_['merge']({},_0x3b8c40,_0x5d61a4[_0x3bf8('0x3d')]);var _0x831d63={'where':_0x3b8c40['where']};return db['Attachment']['count'](_0x831d63)['then'](function(_0x29abcc){_0x31f615[_0x3bf8('0x1e')]=_0x29abcc;if(_0x5d61a4[_0x3bf8('0x30')]['includeAll']){_0x3b8c40[_0x3bf8('0x3e')]=[{'all':!![]}];}return db[_0x3bf8('0x3f')]['findAll'](_0x3b8c40);})['then'](function(_0x12c27f){_0x31f615[_0x3bf8('0x40')]=_0x12c27f;return _0x31f615;})['then'](respondWithFilteredResult(_0x321daa,_0x3b8c40))['catch'](handleError(_0x321daa,null));};exports[_0x3bf8('0x41')]=function(_0x2bb2bc,_0x3aef44){var _0x2b0dfc={'raw':!![],'where':{'id':_0x2bb2bc[_0x3bf8('0x42')]['id']}},_0x3e7bba={};_0x3e7bba[_0x3bf8('0x2f')]=_['keys'](db[_0x3bf8('0x3f')][_0x3bf8('0x2b')]);_0x3e7bba[_0x3bf8('0x30')]=_['keys'](_0x2bb2bc[_0x3bf8('0x30')]);_0x3e7bba[_0x3bf8('0x39')]=_['intersection'](_0x3e7bba['model'],_0x3e7bba[_0x3bf8('0x30')]);_0x2b0dfc[_0x3bf8('0x32')]=_[_0x3bf8('0x33')](_0x3e7bba[_0x3bf8('0x2f')],qs[_0x3bf8('0x34')](_0x2bb2bc['query'][_0x3bf8('0x34')]));_0x2b0dfc[_0x3bf8('0x32')]=_0x2b0dfc['attributes'][_0x3bf8('0x35')]?_0x2b0dfc['attributes']:_0x3e7bba[_0x3bf8('0x2f')];if(_0x2bb2bc['query'][_0x3bf8('0x43')]){_0x2b0dfc[_0x3bf8('0x3e')]=[{'all':!![]}];}_0x2b0dfc=_['merge']({},_0x2b0dfc,_0x2bb2bc[_0x3bf8('0x3d')]);return db[_0x3bf8('0x3f')][_0x3bf8('0x44')](_0x2b0dfc)['then'](handleEntityNotFound(_0x3aef44,null))[_0x3bf8('0x25')](respondWithResult(_0x3aef44,null))[_0x3bf8('0x45')](handleError(_0x3aef44,null));};exports[_0x3bf8('0x46')]=function(_0x1946d1,_0x26d769){var _0x50799f={'where':{'id':_0x1946d1[_0x3bf8('0x42')]['id']}},_0x31260a={};_0x31260a['model']=_['keys'](db[_0x3bf8('0x3f')]['rawAttributes']);_0x50799f[_0x3bf8('0x32')]=_[_0x3bf8('0x33')](_0x31260a[_0x3bf8('0x2f')],qs[_0x3bf8('0x34')](_0x1946d1[_0x3bf8('0x30')]['fields']));_0x50799f[_0x3bf8('0x32')]=_0x50799f[_0x3bf8('0x32')][_0x3bf8('0x35')]?_0x50799f[_0x3bf8('0x32')]:_0x31260a['model'];if(_0x1946d1[_0x3bf8('0x30')]['includeAll']){_0x50799f['include']=[{'all':!![]}];}_0x50799f=_['merge']({},_0x50799f,_0x1946d1[_0x3bf8('0x3d')]);return db[_0x3bf8('0x3f')][_0x3bf8('0x44')](_0x50799f)[_0x3bf8('0x25')](handleEntityNotFound(_0x26d769,null))[_0x3bf8('0x25')](function(_0x20c6bd){if(_0x20c6bd){var _0x5e1fb0=_0x20c6bd['get']({'plain':!![]});_0x5e1fb0=qs[_0x3bf8('0x47')](_0x5e1fb0,['id',_0x3bf8('0x48'),_0x3bf8('0x49')]);_0x1946d1['body']=_[_0x3bf8('0x47')](_0x1946d1[_0x3bf8('0x4a')],['id',_0x3bf8('0x48'),_0x3bf8('0x49')]);return db[_0x3bf8('0x3f')][_0x3bf8('0x4b')](_[_0x3bf8('0x3b')](_0x5e1fb0,_0x1946d1[_0x3bf8('0x4a')]),{'include':_0x1946d1[_0x3bf8('0x30')][_0x3bf8('0x43')]?[{'all':!![]}]:undefined});}})[_0x3bf8('0x25')](respondWithResult(_0x26d769,0xc9))[_0x3bf8('0x45')](handleError(_0x26d769,null));};exports[_0x3bf8('0x24')]=function(_0xe01761,_0x2f22a3){if(_0xe01761['body']['id']){delete _0xe01761[_0x3bf8('0x4a')]['id'];}return db[_0x3bf8('0x3f')][_0x3bf8('0x44')]({'where':{'id':_0xe01761[_0x3bf8('0x42')]['id']}})[_0x3bf8('0x25')](handleEntityNotFound(_0x2f22a3,null))['then'](saveUpdates(_0xe01761[_0x3bf8('0x4a')],null))[_0x3bf8('0x25')](respondWithResult(_0x2f22a3,null))[_0x3bf8('0x45')](handleError(_0x2f22a3,null));};exports[_0x3bf8('0x26')]=function(_0x11567b,_0x5763ee){return db[_0x3bf8('0x3f')][_0x3bf8('0x44')]({'where':{'id':_0x11567b[_0x3bf8('0x42')]['id']}})[_0x3bf8('0x25')](handleEntityNotFound(_0x5763ee,null))['then'](removeEntity(_0x5763ee,null))[_0x3bf8('0x45')](handleError(_0x5763ee,null));};exports[_0x3bf8('0x4b')]=function(_0x70880,_0x3f580f,_0x4e7d3e){_0x70880['body']['name']=_0x70880[_0x3bf8('0x4c')]['originalname'];_0x70880[_0x3bf8('0x4a')][_0x3bf8('0x4d')]=_0x70880[_0x3bf8('0x4c')][_0x3bf8('0x4e')];_0x70880['body'][_0x3bf8('0x2d')]=_0x70880[_0x3bf8('0x4c')]['mimetype'];return db[_0x3bf8('0x3f')][_0x3bf8('0x4b')](_0x70880[_0x3bf8('0x4a')])[_0x3bf8('0x25')](respondWithResult(_0x3f580f,0xc9))[_0x3bf8('0x45')](handleError(_0x3f580f,null));};exports['download']=function(_0x1b957a,_0x5b8323,_0x24d01a){return db['Attachment'][_0x3bf8('0x4f')]({'where':{'id':_0x1b957a[_0x3bf8('0x42')]['id']},'raw':!![]})[_0x3bf8('0x25')](handleEntityNotFound(_0x5b8323,null))[_0x3bf8('0x25')](function(_0xe351ce){if(_0xe351ce){var _0x2f93ca=_0xe351ce[_0x3bf8('0x50')]!==null;var _0x48e8fd=path[_0x3bf8('0x51')](config[_0x3bf8('0x52')],_0x3bf8('0x53'));if(_0x2f93ca){_0x48e8fd=path['join'](_0x48e8fd,_0x3bf8('0x54'));}var _0x2a0b0a=path['join'](_0x48e8fd,_0xe351ce[_0x3bf8('0x4d')]);return _0x5b8323[_0x3bf8('0x55')](_0x2a0b0a);}})[_0x3bf8('0x45')](handleError(_0x5b8323,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 938f5c1..d5369d6 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 _0x849d=['attachments','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x849d,0xb7));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd849('0x0'));var util=require('util');var logger=require(_0xd849('0x1'))(_0xd849('0x2'));var moment=require(_0xd849('0x3'));var BPromise=require(_0xd849('0x4'));var rp=require(_0xd849('0x5'));var fs=require('fs');var path=require(_0xd849('0x6'));var rimraf=require(_0xd849('0x7'));var config=require(_0xd849('0x8'));var attributes=require(_0xd849('0x9'));module[_0xd849('0xa')]=function(_0x1f65b5,_0x51e462){return _0x1f65b5[_0xd849('0xb')](_0xd849('0xc'),attributes,{'tableName':_0xd849('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x741e=['path','../../config/environment','./attachment.attributes','define','attachments','util','api','bluebird','request-promise'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x741e,0x188));var _0xe741=function(_0x1d6118,_0x3fd686){_0x1d6118=_0x1d6118-0x0;var _0x4da1bc=_0x741e[_0x1d6118];return _0x4da1bc;};'use strict';var _=require('lodash');var util=require(_0xe741('0x0'));var logger=require('../../config/logger')(_0xe741('0x1'));var moment=require('moment');var BPromise=require(_0xe741('0x2'));var rp=require(_0xe741('0x3'));var fs=require('fs');var path=require(_0xe741('0x4'));var rimraf=require('rimraf');var config=require(_0xe741('0x5'));var attributes=require(_0xe741('0x6'));module['exports']=function(_0x3b8eae,_0xc63e0d){return _0x3b8eae[_0xe741('0x7')]('Attachment',attributes,{'tableName':_0xe741('0x8'),'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 2233a8f..1323abe 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 _0x780f=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','body','options','raw','then','stringify'];(function(_0x88da3c,_0x247311){var _0x245c9a=function(_0x4d003c){while(--_0x4d003c){_0x88da3c['push'](_0x88da3c['shift']());}};_0x245c9a(++_0x247311);}(_0x780f,0x6c));var _0xf780=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x780f[_0x33bcdb];return _0x18a9bf;};'use strict';var _=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var moment=require(_0xf780('0x2'));var BPromise=require(_0xf780('0x3'));var rs=require(_0xf780('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf780('0x5'));var logger=require(_0xf780('0x6'))(_0xf780('0x7'));var config=require(_0xf780('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf780('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd856,_0x93539d,_0x1c3fdc){return new BPromise(function(_0xa12d00,_0x44f14c){return client[_0xf780('0xa')](_0x1bd856,_0x1c3fdc)['then'](function(_0x2c8221){logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));logger[_0xf780('0xe')](_0xf780('0xf'),_0x93539d,_0xf780('0xd'),JSON['stringify'](_0x2c8221));if(_0x2c8221['error']){if(_0x2c8221[_0xf780('0x10')][_0xf780('0x11')]===0x1f4){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x2c8221['error'][_0xf780('0x12')]);return _0x44f14c(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}logger[_0xf780('0x10')]('Attachment,\x20%s,\x20%s',_0x93539d,_0x2c8221[_0xf780('0x10')]['message']);return _0xa12d00(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}else{logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));_0xa12d00(_0x2c8221[_0xf780('0x13')][_0xf780('0x12')]);}})['catch'](function(_0x450198){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x450198);_0x44f14c(_0x450198);});});}exports[_0xf780('0x14')]=function(_0x5d5a81){var _0x188554=this;return new Promise(function(_0x53dfee,_0x3ede41){return db[_0xf780('0x15')]['create'](_0x5d5a81[_0xf780('0x16')],{'raw':_0x5d5a81[_0xf780('0x17')]?_0x5d5a81['options'][_0xf780('0x18')]===undefined?!![]:![]:!![]})[_0xf780('0x19')](function(_0x3c7054){logger[_0xf780('0xb')](_0xf780('0x14'),_0x5d5a81);logger[_0xf780('0xe')]('CreateAttachment',_0x5d5a81,JSON[_0xf780('0x1a')](_0x3c7054));_0x53dfee(_0x3c7054);})['catch'](function(_0x5853ea){logger[_0xf780('0x10')](_0xf780('0x14'),_0x5853ea[_0xf780('0x12')],_0x5d5a81);_0x3ede41(_0x188554['error'](0x1f4,_0x5853ea[_0xf780('0x12')]));});});}; \ No newline at end of file +var _0x2504=['catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Attachment,\x20%s,\x20%s','message','result'];(function(_0x4b08fa,_0x1e020b){var _0x45a873=function(_0x752a4c){while(--_0x752a4c){_0x4b08fa['push'](_0x4b08fa['shift']());}};_0x45a873(++_0x1e020b);}(_0x2504,0xee));var _0x4250=function(_0x205d04,_0x8a59df){_0x205d04=_0x205d04-0x0;var _0x511f43=_0x2504[_0x205d04];return _0x511f43;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e177e,_0x5a5286,_0x370998){return new BPromise(function(_0x477312,_0x1a3b57){return client[_0x4250('0xd')](_0x4e177e,_0x370998)[_0x4250('0xe')](function(_0x51ea6f){logger[_0x4250('0xf')]('Attachment,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'),JSON['stringify'](_0x51ea6f));if(_0x51ea6f['error']){if(_0x51ea6f[_0x4250('0x12')][_0x4250('0x13')]===0x1f4){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')]['message']);return _0x1a3b57(_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);}logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);return _0x477312(_0x51ea6f['error'][_0x4250('0x15')]);}else{logger[_0x4250('0xf')](_0x4250('0x14'),_0x5a5286,_0x4250('0x10'));_0x477312(_0x51ea6f[_0x4250('0x16')][_0x4250('0x15')]);}})[_0x4250('0x17')](function(_0x4e70fc){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x4e70fc);_0x1a3b57(_0x4e70fc);});});}exports[_0x4250('0x18')]=function(_0x17a8a9){var _0x369010=this;return new Promise(function(_0x30e48c,_0x14d590){return db['Attachment'][_0x4250('0x19')](_0x17a8a9['body'],{'raw':_0x17a8a9['options']?_0x17a8a9[_0x4250('0x1a')][_0x4250('0x1b')]===undefined?!![]:![]:!![]})[_0x4250('0xe')](function(_0x42c331){logger[_0x4250('0xf')](_0x4250('0x18'),_0x17a8a9);logger[_0x4250('0x11')](_0x4250('0x18'),_0x17a8a9,JSON[_0x4250('0x1c')](_0x42c331));_0x30e48c(_0x42c331);})[_0x4250('0x17')](function(_0x728862){logger[_0x4250('0x12')]('CreateAttachment',_0x728862[_0x4250('0x15')],_0x17a8a9);_0x14d590(_0x369010[_0x4250('0x12')](0x1f4,_0x728862[_0x4250('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index aaed215..68455c3 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x51c033,_0x106532){var _0x37685c=function(_0x1e9a4a){while(--_0x1e9a4a){_0x51c033['push'](_0x51c033['shift']());}};_0x37685c(++_0x106532);}(_0xb10b,0x12a));var _0xbb10=function(_0x4efdfd,_0x4a27df){_0x4efdfd=_0x4efdfd-0x0;var _0x2b413=_0xb10b[_0x4efdfd];return _0x2b413;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index aba2a4d..fdd4b04 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 _0xaaa9=['minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','password','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','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:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','adSsoEnabled','findOne','role','blockedAt','user','then','name','domain','disabled','add'];(function(_0x3eae5e,_0x1064b6){var _0x1f8630=function(_0xac81c4){while(--_0xac81c4){_0x3eae5e['push'](_0x3eae5e['shift']());}};_0x1f8630(++_0x1064b6);}(_0xaaa9,0x98));var _0x9aaa=function(_0x1e0e3e,_0x26487f){_0x1e0e3e=_0x1e0e3e-0x0;var _0x64695=_0xaaa9[_0x1e0e3e];return _0x64695;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x9aaa('0x0'))[_0x9aaa('0x1')];var moment=require(_0x9aaa('0x2'));var ActiveDirectory=require(_0x9aaa('0x3'));var BPromise=require(_0x9aaa('0x4'));var util=require(_0x9aaa('0x5'));var db=require(_0x9aaa('0x6'))['db'];var authService=require(_0x9aaa('0x7'));var utils=require(_0x9aaa('0x8'));var config=require(_0x9aaa('0x9'));var logger=require(_0x9aaa('0xa'))(_0x9aaa('0xb'));function isActiveDirectoryConfigured(_0x17f37e){var _0xea111b=![];if(typeof _0x17f37e[_0x9aaa('0xc')]!==_0x9aaa('0xd')){_0xea111b=_0x17f37e[_0x9aaa('0xc')]['baseDN']&&_0x17f37e[_0x9aaa('0xc')]['url']&&_0x17f37e['activedirectory']['domain'];}return _0xea111b;}function adAuthenticate(_0x22bfcf,_0x249d87,_0x13d6f0){return new BPromise(function(_0x3394c0,_0x55e866){try{var _0x564bff=new ActiveDirectory(_0x22bfcf);_0x564bff[_0x9aaa('0xe')](_0x249d87,_0x13d6f0,function(_0x107f55,_0x1fd7a9){if(_0x107f55){logger[_0x9aaa('0xf')](_0x9aaa('0x10'),_0x249d87,util[_0x9aaa('0x11')](_0x107f55,{'showHidden':![],'depth':null}));_0x55e866(_0x9aaa('0x12'));}else if(!_0x1fd7a9){logger[_0x9aaa('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x249d87);_0x55e866(_0x9aaa('0x12'));}else{_0x3394c0(_0x1fd7a9);}});}catch(_0x5629b8){_0x55e866(_0x5629b8);}});}function ActiveDirectoryAuthenticate(_0x4d2108,_0x3d42ae,_0x441e7c,_0x1259fb){var _0x224d47,_0x282755;if(!isActiveDirectoryConfigured(config)){logger[_0x9aaa('0xf')](_0x9aaa('0x13'),_0x3d42ae);return _0x1259fb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x9aaa('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x9aaa('0x15')],'raw':!![]})['then'](function(_0x126155){_0x224d47=_0x126155;if(!_0x224d47[_0x9aaa('0x16')]){logger[_0x9aaa('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3d42ae);throw new Error(_0x9aaa('0x12'));}return _0x4d2108[_0x9aaa('0x17')]({'logging':!![],'attributes':['id','name','password','salt',_0x9aaa('0x18'),'disabled','blocked',_0x9aaa('0x19'),'online'],'where':{'name':_0x3d42ae,'role':{'$or':['admin',_0x9aaa('0x1a'),'agent']},'adSsoEnabled':!![]}});})[_0x9aaa('0x1b')](function(_0x4dec4d){if(!_0x4dec4d||_0x4dec4d&&_0x4dec4d[_0x9aaa('0x1c')]!==_0x3d42ae){throw new Error(_0x9aaa('0x12'));}_0x282755=_0x4dec4d;var _0x407d60=_0x282755[_0x9aaa('0x1c')]+'@'+config[_0x9aaa('0xc')][_0x9aaa('0x1d')];return adAuthenticate(config[_0x9aaa('0xc')],_0x407d60,_0x441e7c);})[_0x9aaa('0x1b')](function(_0x320e88){if(_0x282755[_0x9aaa('0x1e')]){throw new Error(_0x9aaa('0x12'));}if(_0x224d47['blockDuration']>0x0){if(_0x282755['blocked']){if(moment(_0x282755[_0x9aaa('0x19')])[_0x9aaa('0x1f')](_0x224d47[_0x9aaa('0x15')],_0x9aaa('0x20'))>moment()){throw new Error(_0x9aaa('0x12'));}return utils[_0x9aaa('0x21')](_0x282755,0x0,![],null)[_0x9aaa('0x1b')](function(){return utils[_0x9aaa('0x22')](_0x282755);})[_0x9aaa('0x1b')](function(){return _0x1259fb(null,_0x282755);});}else{return utils[_0x9aaa('0x22')](_0x282755)[_0x9aaa('0x1b')](function(){return _0x1259fb(null,_0x282755);});}}else{return utils[_0x9aaa('0x22')](_0x282755)[_0x9aaa('0x1b')](function(){return _0x1259fb(null,_0x282755);});}})[_0x9aaa('0x23')](function(_0x288b7d){return _0x1259fb(null,![],_0x288b7d);});}function handleError(_0xbdc98c,_0x199b06,_0x3dd3c6){return _0xbdc98c[_0x9aaa('0x24')](_0x199b06||0x1f4)[_0x9aaa('0x25')]({'message':_0x3dd3c6?_0x3dd3c6['message']||_0x3dd3c6:''});}exports[_0x9aaa('0x26')]=function(_0x2af9bd,_0x3142c6,_0x90335d){passport[_0x9aaa('0xe')](_0x9aaa('0x27'),function(_0xcb7925,_0x495605,_0x2a69be){var _0x17fb4c=_0xcb7925||_0x2a69be;if(_0x17fb4c){return handleError(_0x3142c6,0x191,_0x17fb4c);}if(!_0x495605){return handleError(_0x3142c6,0x194,{'message':_0x9aaa('0x28')});}else{var _0x37e4d1={'payload':{'id':_0x495605['id'],'role':_0x495605[_0x9aaa('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0x9aaa('0x29')](_0x37e4d1)[_0x9aaa('0x1b')](function(_0x626224){_0x3142c6[_0x9aaa('0x2a')]({'id':_0x495605['id'],'token':_0x626224,'statusCall':'','isAlreadyLogged':_0x495605[_0x9aaa('0x2b')]});});}})(_0x2af9bd,_0x3142c6,_0x90335d);};passport[_0x9aaa('0x2c')]('ad-login',new LocalStrategy({'usernameField':_0x9aaa('0x1c'),'passwordField':_0x9aaa('0x2d')},function(_0x2bb65d,_0x547040,_0x486102){return ActiveDirectoryAuthenticate(db['User'],_0x2bb65d,_0x547040,_0x486102);})); \ No newline at end of file +var _0xb32f=['findOne','adSsoEnabled','blockDuration','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','then','name','getLicense','catch','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','api','activedirectory','baseDN','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting'];(function(_0x35a771,_0x3577ff){var _0x3b977e=function(_0x21a06a){while(--_0x21a06a){_0x35a771['push'](_0x35a771['shift']());}};_0x3b977e(++_0x3577ff);}(_0xb32f,0x144));var _0xfb32=function(_0x2b0d9f,_0x20409d){_0x2b0d9f=_0x2b0d9f-0x0;var _0x21ad80=_0xb32f[_0x2b0d9f];return _0x21ad80;};'use strict';var passport=require(_0xfb32('0x0'));var LocalStrategy=require('passport-local')[_0xfb32('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xfb32('0x2'));var BPromise=require(_0xfb32('0x3'));var util=require(_0xfb32('0x4'));var db=require(_0xfb32('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xfb32('0x6'));var config=require(_0xfb32('0x7'));var logger=require('../../config/logger')(_0xfb32('0x8'));function isActiveDirectoryConfigured(_0x26b978){var _0x1e408f=![];if(typeof _0x26b978[_0xfb32('0x9')]!=='undefined'){_0x1e408f=_0x26b978[_0xfb32('0x9')][_0xfb32('0xa')]&&_0x26b978[_0xfb32('0x9')][_0xfb32('0xb')]&&_0x26b978[_0xfb32('0x9')]['domain'];}return _0x1e408f;}function adAuthenticate(_0x25fc81,_0x4025d0,_0x1fa551){return new BPromise(function(_0x3356de,_0x5b211e){try{var _0x96ede8=new ActiveDirectory(_0x25fc81);_0x96ede8[_0xfb32('0xc')](_0x4025d0,_0x1fa551,function(_0x5469d0,_0x3753da){if(_0x5469d0){logger['error'](_0xfb32('0xd'),_0x4025d0,util[_0xfb32('0xe')](_0x5469d0,{'showHidden':![],'depth':null}));_0x5b211e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3753da){logger[_0xfb32('0xf')](_0xfb32('0x10'),_0x4025d0);_0x5b211e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3356de(_0x3753da);}});}catch(_0x453e08){_0x5b211e(_0x453e08);}});}function ActiveDirectoryAuthenticate(_0x30354b,_0x19ec16,_0x45c9ac,_0x187899){var _0x2ec2ba,_0x3c4d6c;if(!isActiveDirectoryConfigured(config)){logger[_0xfb32('0xf')](_0xfb32('0x11'),_0x19ec16);return _0x187899(null,![],{'message':_0xfb32('0x12')});}return db[_0xfb32('0x13')][_0xfb32('0x14')]({'where':{'id':0x1},'attributes':[_0xfb32('0x15'),_0xfb32('0x16')],'raw':!![]})['then'](function(_0x5153e3){_0x2ec2ba=_0x5153e3;if(!_0x2ec2ba[_0xfb32('0x15')]){logger[_0xfb32('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x19ec16);throw new Error(_0xfb32('0x12'));}return _0x30354b[_0xfb32('0x14')]({'logging':!![],'attributes':['id','name',_0xfb32('0x17'),_0xfb32('0x18'),_0xfb32('0x19'),_0xfb32('0x1a'),_0xfb32('0x1b'),_0xfb32('0x1c'),_0xfb32('0x1d')],'where':{'name':_0x19ec16,'role':{'$or':[_0xfb32('0x1e'),'user',_0xfb32('0x1f')]},'adSsoEnabled':!![]}});})[_0xfb32('0x20')](function(_0x677cd0){if(!_0x677cd0||_0x677cd0&&_0x677cd0[_0xfb32('0x21')]!==_0x19ec16){throw new Error(_0xfb32('0x12'));}_0x3c4d6c=_0x677cd0;var _0x3ac3c7=_0x3c4d6c['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xfb32('0x9')],_0x3ac3c7,_0x45c9ac);})[_0xfb32('0x20')](function(_0x4732f4){if(_0x3c4d6c['disabled']){throw new Error(_0xfb32('0x12'));}if(_0x2ec2ba[_0xfb32('0x16')]>0x0){if(_0x3c4d6c[_0xfb32('0x1b')]){if(moment(_0x3c4d6c[_0xfb32('0x1c')])['add'](_0x2ec2ba[_0xfb32('0x16')],'minutes')>moment()){throw new Error(_0xfb32('0x12'));}return utils['clearBlockUser'](_0x3c4d6c,0x0,![],null)[_0xfb32('0x20')](function(){return utils['getLicense'](_0x3c4d6c);})['then'](function(){return _0x187899(null,_0x3c4d6c);});}else{return utils[_0xfb32('0x22')](_0x3c4d6c)[_0xfb32('0x20')](function(){return _0x187899(null,_0x3c4d6c);});}}else{return utils[_0xfb32('0x22')](_0x3c4d6c)[_0xfb32('0x20')](function(){return _0x187899(null,_0x3c4d6c);});}})[_0xfb32('0x23')](function(_0x5c9590){return _0x187899(null,![],_0x5c9590);});}function handleError(_0x2a78a2,_0x121f2e,_0x14e45b){return _0x2a78a2['status'](_0x121f2e||0x1f4)[_0xfb32('0x24')]({'message':_0x14e45b?_0x14e45b['message']||_0x14e45b:''});}exports[_0xfb32('0x25')]=function(_0x69152b,_0x5f3594,_0x52096f){passport[_0xfb32('0xc')](_0xfb32('0x26'),function(_0x2ce318,_0x23829e,_0x5d8723){var _0x1ceb9b=_0x2ce318||_0x5d8723;if(_0x1ceb9b){return handleError(_0x5f3594,0x191,_0x1ceb9b);}if(!_0x23829e){return handleError(_0x5f3594,0x194,{'message':_0xfb32('0x27')});}else{var _0x4ecf4d={'payload':{'id':_0x23829e['id'],'role':_0x23829e[_0xfb32('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4ecf4d)['then'](function(_0x56fc2c){_0x5f3594[_0xfb32('0x28')]({'id':_0x23829e['id'],'token':_0x56fc2c,'statusCall':'','isAlreadyLogged':_0x23829e[_0xfb32('0x1d')]});});}})(_0x69152b,_0x5f3594,_0x52096f);};passport[_0xfb32('0x29')]('ad-login',new LocalStrategy({'usernameField':_0xfb32('0x21'),'passwordField':'password'},function(_0x269be9,_0x541dd6,_0x5a9dc3){return ActiveDirectoryAuthenticate(db[_0xfb32('0x2a')],_0x269be9,_0x541dd6,_0x5a9dc3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 99b2875..172143d 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 _0xe9cc=['./authActiveDirectory.controller','post','login','Router'];(function(_0x1b354c,_0x21bbf5){var _0x314909=function(_0x48da4a){while(--_0x48da4a){_0x1b354c['push'](_0x1b354c['shift']());}};_0x314909(++_0x21bbf5);}(_0xe9cc,0x1b7));var _0xce9c=function(_0x62d66f,_0x3b3b37){_0x62d66f=_0x62d66f-0x0;var _0x332827=_0xe9cc[_0x62d66f];return _0x332827;};'use strict';var express=require('express');var router=express[_0xce9c('0x0')]();var controller=require(_0xce9c('0x1'));router[_0xce9c('0x2')]('/',controller[_0xce9c('0x3')]);module['exports']=router; \ No newline at end of file +var _0xadc0=['post','login','exports','Router'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0xadc0,0x13f));var _0x0adc=function(_0x11d919,_0x494442){_0x11d919=_0x11d919-0x0;var _0x39fbdb=_0xadc0[_0x11d919];return _0x39fbdb;};'use strict';var express=require('express');var router=express[_0x0adc('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x0adc('0x1')]('/',controller[_0x0adc('0x2')]);module[_0x0adc('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c2538eb..2a1ceec 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x5b369a,_0x242eb5){var _0x404a31=function(_0xf4bb24){while(--_0xf4bb24){_0x5b369a['push'](_0x5b369a['shift']());}};_0x404a31(++_0x242eb5);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x235b64,_0x32587d){_0x235b64=_0x235b64-0x0;var _0x228ffe=_0x7a54[_0x235b64];return _0x228ffe;};'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 528c2f7..4f56a14 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 _0xb9da=['express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports'];(function(_0x36e796,_0x4beeb7){var _0x2ee739=function(_0x18a18d){while(--_0x18a18d){_0x36e796['push'](_0x36e796['shift']());}};_0x2ee739(++_0x4beeb7);}(_0xb9da,0x1d6));var _0xab9d=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0xb9da[_0x1e48d3];return _0x2852b1;};'use strict';var express=require(_0xab9d('0x0'));var passport=require(_0xab9d('0x1'));var router=express[_0xab9d('0x2')]();var controller=require(_0xab9d('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xab9d('0x4'));router[_0xab9d('0x5')]('/',controller[_0xab9d('0x6')]);router[_0xab9d('0x5')]('/callback',controller['callback'],authService[_0xab9d('0x7')],userController[_0xab9d('0x6')],authService[_0xab9d('0x8')]);module[_0xab9d('0x9')]=router; \ No newline at end of file +var _0x394e=['isMiddleware','login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x37192f,_0x596c39){var _0x508e86=function(_0x2719c0){while(--_0x2719c0){_0x37192f['push'](_0x37192f['shift']());}};_0x508e86(++_0x596c39);}(_0x394e,0x88));var _0xe394=function(_0x5e275e,_0x190a72){_0x5e275e=_0x5e275e-0x0;var _0x969919=_0x394e[_0x5e275e];return _0x969919;};'use strict';var express=require(_0xe394('0x0'));var passport=require(_0xe394('0x1'));var router=express['Router']();var controller=require(_0xe394('0x2'));var userController=require(_0xe394('0x3'));var authService=require(_0xe394('0x4'));router[_0xe394('0x5')]('/',controller['login']);router[_0xe394('0x5')](_0xe394('0x6'),controller[_0xe394('0x7')],authService[_0xe394('0x8')],userController[_0xe394('0x9')],authService[_0xe394('0xa')]);module[_0xe394('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 0238955..75932d2 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 _0xccc6=['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','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','salt','role','disabled','blocked','blockedAt','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires'];(function(_0x56e2a9,_0x12ca68){var _0x586c9d=function(_0x55473d){while(--_0x55473d){_0x56e2a9['push'](_0x56e2a9['shift']());}};_0x586c9d(++_0x12ca68);}(_0xccc6,0x1c3));var _0x6ccc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xccc6[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x6ccc('0x0'));var passport=require(_0x6ccc('0x1'));var LocalStrategy=require(_0x6ccc('0x2'))[_0x6ccc('0x3')];var jayson=require(_0x6ccc('0x4'));var _=require(_0x6ccc('0x5'));var rs=require(_0x6ccc('0x6'));var moment=require(_0x6ccc('0x7'));var db=require(_0x6ccc('0x8'))['db'];var authService=require(_0x6ccc('0x9'));var utils=require(_0x6ccc('0xa'));var client=jayson[_0x6ccc('0xb')]['http']({'port':0x232b});function localAuthenticate(_0x3b994a,_0x2ef2a7,_0x343962,_0x3320a6){var _0x11b8a6,_0x497b3e;return db[_0x6ccc('0xc')][_0x6ccc('0xd')]({'where':{'id':0x1},'attributes':[_0x6ccc('0xe'),_0x6ccc('0xf')],'raw':!![]})[_0x6ccc('0x10')](function(_0x327fb6){_0x11b8a6=_0x327fb6;return _0x3b994a[_0x6ccc('0xd')]({'attributes':['id','name','password',_0x6ccc('0x11'),_0x6ccc('0x12'),_0x6ccc('0x13'),_0x6ccc('0x14'),_0x6ccc('0x15'),'loginAttempts'],'where':{'name':_0x2ef2a7,'role':{'$or':[_0x6ccc('0x16'),_0x6ccc('0x17'),_0x6ccc('0x18')]}}});})['then'](function(_0x11cc4c){if(!_0x11cc4c||_0x11cc4c&&_0x11cc4c[_0x6ccc('0x19')]!==_0x2ef2a7){throw new Error(_0x6ccc('0x1a'));}else{_0x497b3e=_0x11cc4c;return _0x497b3e;}})['then'](function(){_0x497b3e['authenticate'](_0x343962,function(_0x472421,_0x13a541){var _0x420db4=_0x497b3e[_0x6ccc('0x1b')]+0x1;if(_0x472421){return _0x3320a6(_0x472421);}else if(!_0x13a541){if(_0x497b3e[_0x6ccc('0x13')]){return _0x3320a6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x11b8a6['allowedLoginAttempts']>0x0){if(_0x497b3e[_0x6ccc('0x14')]){if(_0x11b8a6[_0x6ccc('0xf')]>0x0){if(moment(_0x497b3e['blockedAt'])[_0x6ccc('0x1c')](_0x11b8a6[_0x6ccc('0xf')],'minutes')>moment()){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}else{return utils[_0x6ccc('0x1d')](_0x497b3e,_0x420db4,![],null)[_0x6ccc('0x10')](function(){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});});}}else{return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}}else{if(_0x420db4>=_0x11b8a6[_0x6ccc('0xe')]){return utils[_0x6ccc('0x1d')](_0x497b3e,0x0,!![],moment())['then'](function(){return _0x3320a6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x6ccc('0x1d')](_0x497b3e,_0x420db4,![],null)['then'](function(){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});});}}}else{return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}}else{if(_0x497b3e[_0x6ccc('0x13')]){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}else if(_0x11b8a6[_0x6ccc('0xe')]>0x0){if(_0x497b3e['blocked']){if(_0x11b8a6['blockDuration']>0x0){if(moment(_0x497b3e[_0x6ccc('0x15')])['add'](_0x11b8a6[_0x6ccc('0xf')],_0x6ccc('0x1e'))>moment()){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}else{return utils[_0x6ccc('0x1d')](_0x497b3e,0x0,![],null)[_0x6ccc('0x10')](function(){return utils[_0x6ccc('0x1f')](_0x497b3e);})[_0x6ccc('0x10')](function(){return _0x3320a6(null,_0x497b3e);});}}else{return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}}else{return utils[_0x6ccc('0x1d')](_0x497b3e,0x0,![],null)[_0x6ccc('0x10')](function(){return utils[_0x6ccc('0x1f')](_0x497b3e);})[_0x6ccc('0x10')](function(){return _0x3320a6(null,_0x497b3e);})[_0x6ccc('0x20')](function(_0x11253a){return _0x3320a6(null,![],_0x11253a);});}}else{if(_0x497b3e['blocked']){return _0x3320a6(null,![],{'message':_0x6ccc('0x1a')});}else{return utils[_0x6ccc('0x1f')](_0x497b3e)[_0x6ccc('0x10')](function(){return _0x3320a6(null,_0x497b3e);});}}}});})['catch'](function(_0x2ed3c5){return _0x3320a6(null,![],_0x2ed3c5);});}function sendServiceMail(_0x347f47){return db['MailAccount'][_0x6ccc('0x21')]({'where':{'service':!![]},'attributes':['id',_0x6ccc('0x19'),_0x6ccc('0x22')],'include':[{'model':db[_0x6ccc('0x23')],'as':_0x6ccc('0x24'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x6ccc('0x10')](function(_0x34eb1d){if(!_0x34eb1d){throw new Error(_0x6ccc('0x25'));}var _0x3eeb34=_0x34eb1d[_0x6ccc('0x26')]();var _0x4c26f6={'account':_0x3eeb34,'message':_[_0x6ccc('0x27')]({'from':util['format'](_0x6ccc('0x28'),_0x34eb1d['name'],_0x34eb1d[_0x6ccc('0x22')]||_0x34eb1d[_0x6ccc('0x24')][_0x6ccc('0x17')])},_0x347f47)};return client['request']('SendMail',_0x4c26f6);})[_0x6ccc('0x10')](function(_0x154acb){if(_0x154acb[_0x6ccc('0x29')]){throw new Error(util[_0x6ccc('0x2a')](_0x6ccc('0x2b'),_0x154acb[_0x6ccc('0x29')][_0x6ccc('0x2c')]||JSON[_0x6ccc('0x2d')](_0x154acb[_0x6ccc('0x29')])));}return!![];});}function handleError(_0x35bb3f,_0x4ed962,_0x232a32){return _0x35bb3f[_0x6ccc('0x2e')](_0x4ed962||0x1f4)[_0x6ccc('0x2f')]({'message':_0x232a32?_0x232a32[_0x6ccc('0x2c')]||_0x232a32:''});}exports[_0x6ccc('0x30')]=function(_0x24df1c,_0xa3ab55,_0x5e900b){passport[_0x6ccc('0x31')](_0x6ccc('0x32'),function(_0x1fccdb,_0x47cc25,_0x3cb8dc){var _0x2634df=_0x1fccdb||_0x3cb8dc;if(_0x2634df){return handleError(_0xa3ab55,0x191,_0x2634df);}if(!_0x47cc25){return handleError(_0xa3ab55,0x194,{'message':_0x6ccc('0x33')});}else{var _0x335797={'payload':{'id':_0x47cc25['id'],'role':_0x47cc25[_0x6ccc('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x6ccc('0x34')](_0x335797)[_0x6ccc('0x10')](function(_0x5bdce1){_0xa3ab55[_0x6ccc('0x35')]({'id':_0x47cc25['id'],'token':_0x5bdce1,'statusCall':'','isAlreadyLogged':_0x47cc25[_0x6ccc('0x36')]});});}})(_0x24df1c,_0xa3ab55,_0x5e900b);};exports[_0x6ccc('0x37')]=function(_0x43ac83,_0x3da01c){if(!_0x43ac83[_0x6ccc('0x38')]['email']){return handleError(_0x3da01c,0x1f4,{'message':_0x6ccc('0x39')});}var _0x5ad9ac=rs[_0x6ccc('0x3a')]();_0x43ac83[_0x6ccc('0x38')][_0x6ccc('0x22')]=_0x43ac83[_0x6ccc('0x38')][_0x6ccc('0x22')][_0x6ccc('0x3b')]()[_0x6ccc('0x3c')]();var _0x283336;return db[_0x6ccc('0xc')][_0x6ccc('0xd')]({'where':{'id':0x1},'attributes':[_0x6ccc('0xe'),_0x6ccc('0xf')],'raw':!![]})[_0x6ccc('0x10')](function(_0x439a98){_0x283336=_0x439a98;return db['User'][_0x6ccc('0x21')]({'where':{'email':_0x43ac83[_0x6ccc('0x38')][_0x6ccc('0x22')]}});})[_0x6ccc('0x10')](function(_0x510a65){if(!_0x510a65){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x510a65[_0x6ccc('0x13')]){throw new Error(_0x6ccc('0x3d'));}if(_0x510a65[_0x6ccc('0x14')]){if(moment(_0x510a65[_0x6ccc('0x15')])[_0x6ccc('0x1c')](_0x283336[_0x6ccc('0xf')],_0x6ccc('0x1e'))>moment()){throw new Error(_0x6ccc('0x3e'));}else{_0x510a65[_0x6ccc('0x14')]=![];_0x510a65[_0x6ccc('0x15')]=null;}}_0x510a65[_0x6ccc('0x3f')]=_0x5ad9ac;_0x510a65[_0x6ccc('0x40')]=Date['now']()+0x36ee80;return _0x510a65[_0x6ccc('0x41')]();})[_0x6ccc('0x10')](function(){return sendServiceMail({'to':_0x43ac83['body'][_0x6ccc('0x22')],'subject':_0x6ccc('0x42'),'text':_0x6ccc('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x6ccc('0x44')+_0x43ac83[_0x6ccc('0x45')][_0x6ccc('0x46')]+_0x6ccc('0x47')+_0x5ad9ac+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6ccc('0x10')](function(){_0x3da01c[_0x6ccc('0x2e')](0xc8)[_0x6ccc('0x2f')]({'message':_0x6ccc('0x48')});})['catch'](function(_0x36ac23){return handleError(_0x3da01c,0x1f4,_0x36ac23);});};exports[_0x6ccc('0x49')]=function(_0x37e44b,_0x5d27dc){return db[_0x6ccc('0x4a')][_0x6ccc('0x21')]({'where':{'resetPasswordToken':_0x37e44b['params'][_0x6ccc('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x6ccc('0x4c')]()}}})[_0x6ccc('0x10')](function(_0x1de321){if(!_0x1de321){throw new Error(_0x6ccc('0x4d'));}return db[_0x6ccc('0xc')][_0x6ccc('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x6ccc('0x10')](function(_0x22659f){if(_0x22659f[_0x6ccc('0x4e')])authService[_0x6ccc('0x4f')](_0x37e44b[_0x6ccc('0x38')][_0x6ccc('0x50')]);if(!_0x22659f[_0x6ccc('0x51')]||!_0x1de321[_0x6ccc('0x52')])return _0x1de321;authService['validatePasswordHistory'](_0x37e44b[_0x6ccc('0x38')][_0x6ccc('0x50')],_0x1de321[_0x6ccc('0x52')],_0x22659f[_0x6ccc('0x53')]);return _0x1de321;})[_0x6ccc('0x10')](function(){_0x1de321[_0x6ccc('0x50')]=_0x37e44b[_0x6ccc('0x38')]['password'];_0x1de321['resetPasswordToken']=null;_0x1de321[_0x6ccc('0x40')]=null;return _0x1de321[_0x6ccc('0x41')]();});})['then'](function(){_0x5d27dc[_0x6ccc('0x2e')](0xc8)[_0x6ccc('0x2f')]({'message':_0x6ccc('0x54')});})[_0x6ccc('0x20')](function(_0x497aaa){return handleError(_0x5d27dc,0x1f4,_0x497aaa);});};passport[_0x6ccc('0x55')](_0x6ccc('0x32'),new LocalStrategy({'usernameField':_0x6ccc('0x19'),'passwordField':_0x6ccc('0x50')},function(_0x138269,_0x599008,_0x16c2d8){return localAuthenticate(db[_0x6ccc('0x4a')],_0x138269,_0x599008,_0x16c2d8);})); \ No newline at end of file +var _0x7a1c=['MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','Smtp','user','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','signToken','json','Email\x20parameter\x20is\x20missing','body','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordExpires','Password\x20reset!','use','local-login','util','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','findOne','name','password','salt','role','disabled','blocked','blockedAt','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email'];(function(_0x2b4378,_0xe0fba4){var _0x443c5f=function(_0x1fa8d7){while(--_0x1fa8d7){_0x2b4378['push'](_0x2b4378['shift']());}};_0x443c5f(++_0xe0fba4);}(_0x7a1c,0x1f2));var _0xc7a1=function(_0x3c8daa,_0x5ae824){_0x3c8daa=_0x3c8daa-0x0;var _0x5585a8=_0x7a1c[_0x3c8daa];return _0x5585a8;};'use strict';var util=require(_0xc7a1('0x0'));var passport=require(_0xc7a1('0x1'));var LocalStrategy=require('passport-local')[_0xc7a1('0x2')];var jayson=require('jayson/promise');var _=require(_0xc7a1('0x3'));var rs=require(_0xc7a1('0x4'));var moment=require(_0xc7a1('0x5'));var db=require(_0xc7a1('0x6'))['db'];var authService=require(_0xc7a1('0x7'));var utils=require(_0xc7a1('0x8'));var client=jayson['client'][_0xc7a1('0x9')]({'port':0x232b});function localAuthenticate(_0xb3213c,_0x1c926b,_0x351849,_0x76b3f1){var _0x44245c,_0x171d2b;return db[_0xc7a1('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xc7a1('0xb'),_0xc7a1('0xc')],'raw':!![]})['then'](function(_0xcb46b4){_0x44245c=_0xcb46b4;return _0xb3213c[_0xc7a1('0xd')]({'attributes':['id',_0xc7a1('0xe'),_0xc7a1('0xf'),_0xc7a1('0x10'),_0xc7a1('0x11'),_0xc7a1('0x12'),_0xc7a1('0x13'),_0xc7a1('0x14'),'loginAttempts'],'where':{'name':_0x1c926b,'role':{'$or':['admin','user',_0xc7a1('0x15')]}}});})[_0xc7a1('0x16')](function(_0x403c72){if(!_0x403c72||_0x403c72&&_0x403c72[_0xc7a1('0xe')]!==_0x1c926b){throw new Error(_0xc7a1('0x17'));}else{_0x171d2b=_0x403c72;return _0x171d2b;}})[_0xc7a1('0x16')](function(){_0x171d2b[_0xc7a1('0x18')](_0x351849,function(_0x40601e,_0x46e9f3){var _0xe2ead7=_0x171d2b[_0xc7a1('0x19')]+0x1;if(_0x40601e){return _0x76b3f1(_0x40601e);}else if(!_0x46e9f3){if(_0x171d2b[_0xc7a1('0x12')]){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}else if(_0x44245c[_0xc7a1('0xb')]>0x0){if(_0x171d2b['blocked']){if(_0x44245c[_0xc7a1('0xc')]>0x0){if(moment(_0x171d2b[_0xc7a1('0x14')])[_0xc7a1('0x1a')](_0x44245c[_0xc7a1('0xc')],_0xc7a1('0x1b'))>moment()){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}else{return utils[_0xc7a1('0x1c')](_0x171d2b,_0xe2ead7,![],null)['then'](function(){return _0x76b3f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}}else{if(_0xe2ead7>=_0x44245c['allowedLoginAttempts']){return utils['clearBlockUser'](_0x171d2b,0x0,!![],moment())[_0xc7a1('0x16')](function(){return _0x76b3f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xc7a1('0x1c')](_0x171d2b,_0xe2ead7,![],null)[_0xc7a1('0x16')](function(){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});});}}}else{return _0x76b3f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x171d2b['disabled']){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}else if(_0x44245c['allowedLoginAttempts']>0x0){if(_0x171d2b['blocked']){if(_0x44245c[_0xc7a1('0xc')]>0x0){if(moment(_0x171d2b[_0xc7a1('0x14')])[_0xc7a1('0x1a')](_0x44245c[_0xc7a1('0xc')],'minutes')>moment()){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}else{return utils[_0xc7a1('0x1c')](_0x171d2b,0x0,![],null)[_0xc7a1('0x16')](function(){return utils[_0xc7a1('0x1d')](_0x171d2b);})[_0xc7a1('0x16')](function(){return _0x76b3f1(null,_0x171d2b);});}}else{return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}}else{return utils['clearBlockUser'](_0x171d2b,0x0,![],null)[_0xc7a1('0x16')](function(){return utils[_0xc7a1('0x1d')](_0x171d2b);})[_0xc7a1('0x16')](function(){return _0x76b3f1(null,_0x171d2b);})[_0xc7a1('0x1e')](function(_0x39fc10){return _0x76b3f1(null,![],_0x39fc10);});}}else{if(_0x171d2b[_0xc7a1('0x13')]){return _0x76b3f1(null,![],{'message':_0xc7a1('0x17')});}else{return utils['getLicense'](_0x171d2b)[_0xc7a1('0x16')](function(){return _0x76b3f1(null,_0x171d2b);});}}}});})['catch'](function(_0x2af105){return _0x76b3f1(null,![],_0x2af105);});}function sendServiceMail(_0x2ad708){return db[_0xc7a1('0x1f')][_0xc7a1('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc7a1('0xe'),_0xc7a1('0x21')],'include':[{'model':db[_0xc7a1('0x22')],'as':'Smtp','include':[{'model':db[_0xc7a1('0x23')],'as':_0xc7a1('0x23')}]}]})['then'](function(_0x4d0c5d){if(!_0x4d0c5d){throw new Error(_0xc7a1('0x24'));}var _0x2ce2af=_0x4d0c5d[_0xc7a1('0x25')]();var _0x13b31a={'account':_0x2ce2af,'message':_[_0xc7a1('0x26')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x4d0c5d[_0xc7a1('0xe')],_0x4d0c5d['email']||_0x4d0c5d[_0xc7a1('0x27')][_0xc7a1('0x28')])},_0x2ad708)};return client[_0xc7a1('0x29')](_0xc7a1('0x2a'),_0x13b31a);})[_0xc7a1('0x16')](function(_0x2e848){if(_0x2e848[_0xc7a1('0x2b')]){throw new Error(util[_0xc7a1('0x2c')](_0xc7a1('0x2d'),_0x2e848[_0xc7a1('0x2b')][_0xc7a1('0x2e')]||JSON['stringify'](_0x2e848['error'])));}return!![];});}function handleError(_0x296647,_0x5d79cf,_0x140b8b){return _0x296647['status'](_0x5d79cf||0x1f4)[_0xc7a1('0x2f')]({'message':_0x140b8b?_0x140b8b[_0xc7a1('0x2e')]||_0x140b8b:''});}exports['login']=function(_0x5011da,_0x4a5bfc,_0x286add){passport[_0xc7a1('0x18')]('local-login',function(_0x3f3420,_0x26defd,_0x1c5c99){var _0x456f88=_0x3f3420||_0x1c5c99;if(_0x456f88){return handleError(_0x4a5bfc,0x191,_0x456f88);}if(!_0x26defd){return handleError(_0x4a5bfc,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x56399a={'payload':{'id':_0x26defd['id'],'role':_0x26defd[_0xc7a1('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xc7a1('0x30')](_0x56399a)[_0xc7a1('0x16')](function(_0xda0843){_0x4a5bfc[_0xc7a1('0x31')]({'id':_0x26defd['id'],'token':_0xda0843,'statusCall':'','isAlreadyLogged':_0x26defd['online']});});}})(_0x5011da,_0x4a5bfc,_0x286add);};exports['forgot']=function(_0x17a149,_0x304f89){if(!_0x17a149['body']['email']){return handleError(_0x304f89,0x1f4,{'message':_0xc7a1('0x32')});}var _0x31fa89=rs['generate']();_0x17a149[_0xc7a1('0x33')][_0xc7a1('0x21')]=_0x17a149['body'][_0xc7a1('0x21')]['trim']()['toLowerCase']();var _0x578793;return db[_0xc7a1('0xa')][_0xc7a1('0xd')]({'where':{'id':0x1},'attributes':[_0xc7a1('0xb'),_0xc7a1('0xc')],'raw':!![]})['then'](function(_0xdf0e16){_0x578793=_0xdf0e16;return db[_0xc7a1('0x34')][_0xc7a1('0x20')]({'where':{'email':_0x17a149['body'][_0xc7a1('0x21')]}});})['then'](function(_0x303364){if(!_0x303364){throw new Error(_0xc7a1('0x35'));}if(_0x303364[_0xc7a1('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x303364['blocked']){if(moment(_0x303364[_0xc7a1('0x14')])[_0xc7a1('0x1a')](_0x578793[_0xc7a1('0xc')],_0xc7a1('0x1b'))>moment()){throw new Error(_0xc7a1('0x36'));}else{_0x303364[_0xc7a1('0x13')]=![];_0x303364[_0xc7a1('0x14')]=null;}}_0x303364[_0xc7a1('0x37')]=_0x31fa89;_0x303364['resetPasswordExpires']=Date[_0xc7a1('0x38')]()+0x36ee80;return _0x303364[_0xc7a1('0x39')]();})[_0xc7a1('0x16')](function(){return sendServiceMail({'to':_0x17a149[_0xc7a1('0x33')]['email'],'subject':_0xc7a1('0x3a'),'text':_0xc7a1('0x3b')+_0xc7a1('0x3c')+_0xc7a1('0x3d')+_0x17a149['headers'][_0xc7a1('0x3e')]+_0xc7a1('0x3f')+_0x31fa89+'\x0a\x0a'+_0xc7a1('0x40')});})['then'](function(){_0x304f89[_0xc7a1('0x41')](0xc8)[_0xc7a1('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0xc7a1('0x1e')](function(_0x15a0e9){return handleError(_0x304f89,0x1f4,_0x15a0e9);});};exports['reset']=function(_0x261e77,_0x680c67){return db['User'][_0xc7a1('0x20')]({'where':{'resetPasswordToken':_0x261e77[_0xc7a1('0x42')][_0xc7a1('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc7a1('0x16')](function(_0xb1fee1){if(!_0xb1fee1){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xc7a1('0xd')]({'attributes':['id',_0xc7a1('0x44'),_0xc7a1('0x45'),_0xc7a1('0x46')]})[_0xc7a1('0x16')](function(_0x54a3ec){if(_0x54a3ec['securePassword'])authService['validatePasswordPattern'](_0x261e77[_0xc7a1('0x33')][_0xc7a1('0xf')]);if(!_0x54a3ec[_0xc7a1('0x45')]||!_0xb1fee1[_0xc7a1('0x47')])return _0xb1fee1;authService['validatePasswordHistory'](_0x261e77['body'][_0xc7a1('0xf')],_0xb1fee1['previousPasswords'],_0x54a3ec['passwordHistoryLimit']);return _0xb1fee1;})[_0xc7a1('0x16')](function(){_0xb1fee1[_0xc7a1('0xf')]=_0x261e77[_0xc7a1('0x33')][_0xc7a1('0xf')];_0xb1fee1[_0xc7a1('0x37')]=null;_0xb1fee1[_0xc7a1('0x48')]=null;return _0xb1fee1[_0xc7a1('0x39')]();});})['then'](function(){_0x680c67[_0xc7a1('0x41')](0xc8)[_0xc7a1('0x2f')]({'message':_0xc7a1('0x49')});})[_0xc7a1('0x1e')](function(_0x32eb29){return handleError(_0x680c67,0x1f4,_0x32eb29);});};passport[_0xc7a1('0x4a')](_0xc7a1('0x4b'),new LocalStrategy({'usernameField':_0xc7a1('0xe'),'passwordField':_0xc7a1('0xf')},function(_0x55cc79,_0x1a7152,_0x1b8fa0){return localAuthenticate(db[_0xc7a1('0x34')],_0x55cc79,_0x1a7152,_0x1b8fa0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5bd37c5..2bae492 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 _0xf082=['exports','express','Router','forgot'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf082,0x191));var _0x2f08=function(_0x1e4d2c,_0x3408e4){_0x1e4d2c=_0x1e4d2c-0x0;var _0x4a4b32=_0xf082[_0x1e4d2c];return _0x4a4b32;};'use strict';var express=require(_0x2f08('0x0'));var router=express[_0x2f08('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router['post']('/forgot',controller[_0x2f08('0x2')]);router['post']('/reset/:token',controller['reset']);module[_0x2f08('0x3')]=router; \ No newline at end of file +var _0x8ad7=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x4688aa,_0x20b48e){var _0x57f8ff=function(_0x9ffa16){while(--_0x9ffa16){_0x4688aa['push'](_0x4688aa['shift']());}};_0x57f8ff(++_0x20b48e);}(_0x8ad7,0x1df));var _0x78ad=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8ad7[_0x29d94e];return _0x106237;};'use strict';var express=require(_0x78ad('0x0'));var router=express[_0x78ad('0x1')]();var controller=require(_0x78ad('0x2'));router[_0x78ad('0x3')]('/',controller['login']);router[_0x78ad('0x3')]('/forgot',controller['forgot']);router[_0x78ad('0x3')](_0x78ad('0x4'),controller[_0x78ad('0x5')]);module[_0x78ad('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 0b0d505..5b5409d 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 _0x371b=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x554809,_0x34aa71){var _0x50e32f=function(_0x31eb05){while(--_0x31eb05){_0x554809['push'](_0x554809['shift']());}};_0x50e32f(++_0x34aa71);}(_0x371b,0x1d6));var _0xb371=function(_0x1f2dda,_0x539c5f){_0x1f2dda=_0x1f2dda-0x0;var _0x29b49e=_0x371b[_0x1f2dda];return _0x29b49e;};'use strict';var Sequelize=require(_0xb371('0x0'));module[_0xb371('0x1')]={'name':{'type':Sequelize[_0xb371('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb371('0x2')]},'description':{'type':Sequelize[_0xb371('0x2')]},'status':{'type':Sequelize[_0xb371('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb371('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x91a3=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x268744,_0x470583){var _0x498ec8=function(_0x515774){while(--_0x515774){_0x268744['push'](_0x268744['shift']());}};_0x498ec8(++_0x470583);}(_0x91a3,0xf9));var _0x391a=function(_0x4f3be4,_0x1a1270){_0x4f3be4=_0x4f3be4-0x0;var _0x1d16c9=_0x91a3[_0x4f3be4];return _0x1d16c9;};'use strict';var Sequelize=require(_0x391a('0x0'));module[_0x391a('0x1')]={'name':{'type':Sequelize[_0x391a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x391a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x391a('0x4')],'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 a07487e..558b13b 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 _0x42da=['findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','params','keys','find','create','body','catch','addConditions','Condition','ids','omit','getConditions','sort','hasOwnProperty','addActions','Action','getActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42da,0x1e7));var _0xa42d=function(_0x1d76af,_0x35fbe7){_0x1d76af=_0x1d76af-0x0;var _0x17c203=_0x42da[_0x1d76af];return _0x17c203;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa42d('0x0'));var zipdir=require(_0xa42d('0x1'));var jsonpatch=require(_0xa42d('0x2'));var rp=require(_0xa42d('0x3'));var moment=require(_0xa42d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa42d('0x5'));var util=require(_0xa42d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa42d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa42d('0x8'));var _=require(_0xa42d('0x9'));var squel=require(_0xa42d('0xa'));var crypto=require(_0xa42d('0xb'));var jsforce=require(_0xa42d('0xc'));var deskjs=require(_0xa42d('0xd'));var toCsv=require(_0xa42d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa42d('0xe'));var authService=require(_0xa42d('0xf'));var qs=require(_0xa42d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa42d('0x11'));var logger=require(_0xa42d('0x12'))(_0xa42d('0x13'));var utils=require(_0xa42d('0x14'));var config=require(_0xa42d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa42d('0x16'))['db'];function respondWithStatusCode(_0x5ee7de,_0x3683a2){_0x3683a2=_0x3683a2||0xcc;return function(_0x495965){if(_0x495965){return _0x5ee7de[_0xa42d('0x17')](_0x3683a2);}return _0x5ee7de[_0xa42d('0x18')](_0x3683a2)[_0xa42d('0x19')]();};}function respondWithResult(_0x3f1f9f,_0x1716b9){_0x1716b9=_0x1716b9||0xc8;return function(_0x447e5d){if(_0x447e5d){return _0x3f1f9f[_0xa42d('0x18')](_0x1716b9)[_0xa42d('0x1a')](_0x447e5d);}};}function respondWithFilteredResult(_0x2db61b,_0x1f16ba){return function(_0x579837){if(_0x579837){var _0x2e2213=typeof _0x1f16ba[_0xa42d('0x1b')]===_0xa42d('0x1c')&&typeof _0x1f16ba[_0xa42d('0x1d')]==='undefined';var _0x379816=_0x579837[_0xa42d('0x1e')];var _0x24e149=_0x2e2213?0x0:_0x1f16ba[_0xa42d('0x1b')];var _0x8b021c=_0x2e2213?_0x579837[_0xa42d('0x1e')]:_0x1f16ba[_0xa42d('0x1b')]+_0x1f16ba[_0xa42d('0x1d')];var _0x2e4203;if(_0x8b021c>=_0x379816){_0x8b021c=_0x379816;_0x2e4203=0xc8;}else{_0x2e4203=0xce;}_0x2db61b[_0xa42d('0x18')](_0x2e4203);return _0x2db61b['set'](_0xa42d('0x1f'),_0x24e149+'-'+_0x8b021c+'/'+_0x379816)['json'](_0x579837);}return null;};}function patchUpdates(_0x4f64ad){return function(_0x402a59){try{jsonpatch[_0xa42d('0x20')](_0x402a59,_0x4f64ad,!![]);}catch(_0x46b2b2){return BPromise['reject'](_0x46b2b2);}return _0x402a59[_0xa42d('0x21')]();};}function saveUpdates(_0x10a94c,_0x25e473){return function(_0x356da0){if(_0x356da0){return _0x356da0[_0xa42d('0x22')](_0x10a94c)[_0xa42d('0x23')](function(_0x23d48c){return _0x23d48c;});}return null;};}function removeEntity(_0x512d75,_0x511e2b){return function(_0x2d1969){if(_0x2d1969){return _0x2d1969[_0xa42d('0x24')]()[_0xa42d('0x23')](function(){_0x512d75['status'](0xcc)[_0xa42d('0x19')]();});}};}function handleEntityNotFound(_0x549f3c,_0x379f23){return function(_0x263778){if(!_0x263778){_0x549f3c[_0xa42d('0x17')](0x194);}return _0x263778;};}function handleError(_0x5ebc38,_0x5e4995){_0x5e4995=_0x5e4995||0x1f4;return function(_0x5b2c1e){logger[_0xa42d('0x25')](_0x5b2c1e[_0xa42d('0x26')]);if(_0x5b2c1e[_0xa42d('0x27')]){delete _0x5b2c1e[_0xa42d('0x27')];}_0x5ebc38[_0xa42d('0x18')](_0x5e4995)[_0xa42d('0x28')](_0x5b2c1e);};}exports[_0xa42d('0x29')]=function(_0x513fd4,_0x16a1ef){var _0x4d6bca={},_0x45ab0b={},_0x54ae0b={'count':0x0,'rows':[]};var _0x16aa8e=_['map'](db[_0xa42d('0x2a')][_0xa42d('0x2b')],function(_0x5ba461){return{'name':_0x5ba461[_0xa42d('0x2c')],'type':_0x5ba461[_0xa42d('0x2d')]['key']};});_0x45ab0b[_0xa42d('0x2e')]=_[_0xa42d('0x2f')](_0x16aa8e,_0xa42d('0x27'));_0x45ab0b[_0xa42d('0x30')]=_['keys'](_0x513fd4[_0xa42d('0x30')]);_0x45ab0b[_0xa42d('0x31')]=_[_0xa42d('0x32')](_0x45ab0b['model'],_0x45ab0b[_0xa42d('0x30')]);_0x4d6bca[_0xa42d('0x33')]=_['intersection'](_0x45ab0b[_0xa42d('0x2e')],qs[_0xa42d('0x34')](_0x513fd4[_0xa42d('0x30')]['fields']));_0x4d6bca[_0xa42d('0x33')]=_0x4d6bca[_0xa42d('0x33')][_0xa42d('0x35')]?_0x4d6bca[_0xa42d('0x33')]:_0x45ab0b[_0xa42d('0x2e')];if(!_0x513fd4['query']['hasOwnProperty'](_0xa42d('0x36'))){_0x4d6bca[_0xa42d('0x1d')]=qs[_0xa42d('0x1d')](_0x513fd4[_0xa42d('0x30')]['limit']);_0x4d6bca['offset']=qs[_0xa42d('0x1b')](_0x513fd4[_0xa42d('0x30')][_0xa42d('0x1b')]);}_0x4d6bca[_0xa42d('0x37')]=qs['sort'](_0x513fd4[_0xa42d('0x30')]['sort']);_0x4d6bca[_0xa42d('0x38')]=qs[_0xa42d('0x31')](_[_0xa42d('0x39')](_0x513fd4['query'],_0x45ab0b[_0xa42d('0x31')]),_0x16aa8e);if(_0x513fd4[_0xa42d('0x30')][_0xa42d('0x3a')]){_0x4d6bca['where']=_[_0xa42d('0x3b')](_0x4d6bca[_0xa42d('0x38')],{'$or':_[_0xa42d('0x2f')](_0x16aa8e,function(_0x83fcf9){if(_0x83fcf9['type']!=='VIRTUAL'){var _0x7d8f2f={};_0x7d8f2f[_0x83fcf9['name']]={'$like':'%'+_0x513fd4[_0xa42d('0x30')][_0xa42d('0x3a')]+'%'};return _0x7d8f2f;}})});}_0x4d6bca=_['merge']({},_0x4d6bca,_0x513fd4[_0xa42d('0x3c')]);var _0x275663={'where':_0x4d6bca['where']};return db[_0xa42d('0x2a')][_0xa42d('0x1e')](_0x275663)[_0xa42d('0x23')](function(_0x14580b){_0x54ae0b['count']=_0x14580b;if(_0x513fd4[_0xa42d('0x30')]['includeAll']){_0x4d6bca[_0xa42d('0x3d')]=[{'all':!![]}];}return db['Automation'][_0xa42d('0x3e')](_0x4d6bca);})['then'](function(_0x49bc39){_0x54ae0b[_0xa42d('0x3f')]=_0x49bc39;return _0x54ae0b;})[_0xa42d('0x23')](respondWithFilteredResult(_0x16a1ef,_0x4d6bca))['catch'](handleError(_0x16a1ef,null));};exports['show']=function(_0x1e6bce,_0x2f1d5a){var _0x1cd1c7={'raw':![],'where':{'id':_0x1e6bce[_0xa42d('0x40')]['id']}},_0x5adbb5={};_0x5adbb5[_0xa42d('0x2e')]=_['keys'](db[_0xa42d('0x2a')]['rawAttributes']);_0x5adbb5[_0xa42d('0x30')]=_[_0xa42d('0x41')](_0x1e6bce[_0xa42d('0x30')]);_0x5adbb5[_0xa42d('0x31')]=_[_0xa42d('0x32')](_0x5adbb5['model'],_0x5adbb5['query']);_0x1cd1c7[_0xa42d('0x33')]=_[_0xa42d('0x32')](_0x5adbb5['model'],qs[_0xa42d('0x34')](_0x1e6bce[_0xa42d('0x30')][_0xa42d('0x34')]));_0x1cd1c7[_0xa42d('0x33')]=_0x1cd1c7['attributes']['length']?_0x1cd1c7['attributes']:_0x5adbb5['model'];if(_0x1e6bce['query']['includeAll']){_0x1cd1c7[_0xa42d('0x3d')]=[{'all':!![]}];}_0x1cd1c7=_[_0xa42d('0x3b')]({},_0x1cd1c7,_0x1e6bce[_0xa42d('0x3c')]);return db[_0xa42d('0x2a')][_0xa42d('0x42')](_0x1cd1c7)['then'](handleEntityNotFound(_0x2f1d5a,null))[_0xa42d('0x23')](respondWithResult(_0x2f1d5a,null))['catch'](handleError(_0x2f1d5a,null));};exports[_0xa42d('0x43')]=function(_0x36b901,_0x1f520d){return db[_0xa42d('0x2a')][_0xa42d('0x43')](_0x36b901[_0xa42d('0x44')],{})[_0xa42d('0x23')](respondWithResult(_0x1f520d,0xc9))[_0xa42d('0x45')](handleError(_0x1f520d,null));};exports[_0xa42d('0x22')]=function(_0x44e417,_0x39dc17){if(_0x44e417[_0xa42d('0x44')]['id']){delete _0x44e417[_0xa42d('0x44')]['id'];}return db[_0xa42d('0x2a')][_0xa42d('0x42')]({'where':{'id':_0x44e417['params']['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0x39dc17,null))[_0xa42d('0x23')](saveUpdates(_0x44e417[_0xa42d('0x44')],null))[_0xa42d('0x23')](respondWithResult(_0x39dc17,null))['catch'](handleError(_0x39dc17,null));};exports[_0xa42d('0x24')]=function(_0x42d0ec,_0x4bdd23){return db['Automation'][_0xa42d('0x42')]({'where':{'id':_0x42d0ec[_0xa42d('0x40')]['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0x4bdd23,null))['then'](removeEntity(_0x4bdd23,null))[_0xa42d('0x45')](handleError(_0x4bdd23,null));};exports[_0xa42d('0x46')]=function(_0x1881aa,_0xd069c2,_0x3775c7){return db[_0xa42d('0x47')][_0xa42d('0x42')]({'where':{'id':_0x1881aa['params']['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0xd069c2,null))[_0xa42d('0x23')](function(_0x150478){if(_0x150478){return _0x150478['addConditions'](_0x1881aa[_0xa42d('0x44')][_0xa42d('0x48')],_[_0xa42d('0x49')](_0x1881aa[_0xa42d('0x44')],[_0xa42d('0x48'),'id'])||{});}})[_0xa42d('0x23')](respondWithResult(_0xd069c2,null))[_0xa42d('0x45')](handleError(_0xd069c2,null));};exports[_0xa42d('0x4a')]=function(_0x1d2cb8,_0x625588,_0x470eb9){var _0x1ca1a9={};var _0x31be36={};var _0x2bf330;var _0xf1b8d6;return db['Automation']['findOne']({'where':{'id':_0x1d2cb8[_0xa42d('0x40')]['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0x625588,null))[_0xa42d('0x23')](function(_0x30913d){if(_0x30913d){_0x2bf330=_0x30913d;_0x31be36['model']=_[_0xa42d('0x41')](db[_0xa42d('0x47')][_0xa42d('0x2b')]);_0x31be36[_0xa42d('0x30')]=_['keys'](_0x1d2cb8[_0xa42d('0x30')]);_0x31be36['filters']=_[_0xa42d('0x32')](_0x31be36['model'],_0x31be36[_0xa42d('0x30')]);_0x1ca1a9[_0xa42d('0x33')]=_['intersection'](_0x31be36[_0xa42d('0x2e')],qs[_0xa42d('0x34')](_0x1d2cb8['query'][_0xa42d('0x34')]));_0x1ca1a9[_0xa42d('0x33')]=_0x1ca1a9[_0xa42d('0x33')][_0xa42d('0x35')]?_0x1ca1a9['attributes']:_0x31be36[_0xa42d('0x2e')];_0x1ca1a9[_0xa42d('0x37')]=qs[_0xa42d('0x4b')](_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x4b')]);_0x1ca1a9[_0xa42d('0x38')]=qs[_0xa42d('0x31')](_[_0xa42d('0x39')](_0x1d2cb8['query'],_0x31be36[_0xa42d('0x31')]));if(_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x3a')]){_0x1ca1a9[_0xa42d('0x38')]=_[_0xa42d('0x3b')](_0x1ca1a9[_0xa42d('0x38')],{'$or':_[_0xa42d('0x2f')](_0x1ca1a9['attributes'],function(_0x5610cd){var _0x508b60={};_0x508b60[_0x5610cd]={'$like':'%'+_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x3a')]+'%'};return _0x508b60;})});}_0x1ca1a9=_[_0xa42d('0x3b')]({},_0x1ca1a9,_0x1d2cb8[_0xa42d('0x3c')]);return _0x2bf330[_0xa42d('0x4a')](_0x1ca1a9);}})['then'](function(_0x48d78f){if(_0x48d78f){_0xf1b8d6=_0x48d78f['length'];if(!_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x4c')](_0xa42d('0x36'))){_0x1ca1a9[_0xa42d('0x1d')]=qs['limit'](_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x1d')]);_0x1ca1a9[_0xa42d('0x1b')]=qs[_0xa42d('0x1b')](_0x1d2cb8[_0xa42d('0x30')][_0xa42d('0x1b')]);}return _0x2bf330['getConditions'](_0x1ca1a9);}})[_0xa42d('0x23')](function(_0x4e2d7e){if(_0x4e2d7e){return _0x4e2d7e?{'count':_0xf1b8d6,'rows':_0x4e2d7e}:null;}})['then'](respondWithResult(_0x625588,null))[_0xa42d('0x45')](handleError(_0x625588,null));};exports[_0xa42d('0x4d')]=function(_0x4d79f6,_0x27d87a,_0x490ee1){return db[_0xa42d('0x4e')][_0xa42d('0x42')]({'where':{'id':_0x4d79f6['params']['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0x27d87a,null))[_0xa42d('0x23')](function(_0x4b4b16){if(_0x4b4b16){return _0x4b4b16[_0xa42d('0x4d')](_0x4d79f6['body'][_0xa42d('0x48')],_[_0xa42d('0x49')](_0x4d79f6[_0xa42d('0x44')],[_0xa42d('0x48'),'id'])||{});}})['then'](respondWithResult(_0x27d87a,null))[_0xa42d('0x45')](handleError(_0x27d87a,null));};exports[_0xa42d('0x4f')]=function(_0x3bca18,_0x2ebe0d,_0x19a70f){var _0x5b0a69={};var _0x380748={};var _0x4b41c1;var _0xbe65c5;return db['Automation'][_0xa42d('0x50')]({'where':{'id':_0x3bca18[_0xa42d('0x40')]['id']}})[_0xa42d('0x23')](handleEntityNotFound(_0x2ebe0d,null))['then'](function(_0x2b833f){if(_0x2b833f){_0x4b41c1=_0x2b833f;_0x380748['model']=_[_0xa42d('0x41')](db['Action'][_0xa42d('0x2b')]);_0x380748[_0xa42d('0x30')]=_[_0xa42d('0x41')](_0x3bca18[_0xa42d('0x30')]);_0x380748['filters']=_['intersection'](_0x380748[_0xa42d('0x2e')],_0x380748[_0xa42d('0x30')]);_0x5b0a69[_0xa42d('0x33')]=_['intersection'](_0x380748[_0xa42d('0x2e')],qs['fields'](_0x3bca18[_0xa42d('0x30')][_0xa42d('0x34')]));_0x5b0a69['attributes']=_0x5b0a69['attributes'][_0xa42d('0x35')]?_0x5b0a69[_0xa42d('0x33')]:_0x380748[_0xa42d('0x2e')];_0x5b0a69[_0xa42d('0x37')]=qs[_0xa42d('0x4b')](_0x3bca18[_0xa42d('0x30')][_0xa42d('0x4b')]);_0x5b0a69[_0xa42d('0x38')]=qs[_0xa42d('0x31')](_['pick'](_0x3bca18[_0xa42d('0x30')],_0x380748[_0xa42d('0x31')]));if(_0x3bca18[_0xa42d('0x30')][_0xa42d('0x3a')]){_0x5b0a69[_0xa42d('0x38')]=_[_0xa42d('0x3b')](_0x5b0a69[_0xa42d('0x38')],{'$or':_['map'](_0x5b0a69[_0xa42d('0x33')],function(_0x1bcf12){var _0x1b12ed={};_0x1b12ed[_0x1bcf12]={'$like':'%'+_0x3bca18['query']['filter']+'%'};return _0x1b12ed;})});}_0x5b0a69=_[_0xa42d('0x3b')]({},_0x5b0a69,_0x3bca18[_0xa42d('0x3c')]);return _0x4b41c1['getActions'](_0x5b0a69);}})[_0xa42d('0x23')](function(_0x1e23e8){if(_0x1e23e8){_0xbe65c5=_0x1e23e8['length'];if(!_0x3bca18[_0xa42d('0x30')]['hasOwnProperty'](_0xa42d('0x36'))){_0x5b0a69[_0xa42d('0x1d')]=qs[_0xa42d('0x1d')](_0x3bca18[_0xa42d('0x30')][_0xa42d('0x1d')]);_0x5b0a69[_0xa42d('0x1b')]=qs[_0xa42d('0x1b')](_0x3bca18['query'][_0xa42d('0x1b')]);}return _0x4b41c1[_0xa42d('0x4f')](_0x5b0a69);}})[_0xa42d('0x23')](function(_0x8d5e21){if(_0x8d5e21){return _0x8d5e21?{'count':_0xbe65c5,'rows':_0x8d5e21}:null;}})[_0xa42d('0x23')](respondWithResult(_0x2ebe0d,null))[_0xa42d('0x45')](handleError(_0x2ebe0d,null));}; \ No newline at end of file +var _0xd769=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','end','stack','name','index','map','Automation','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','find','create','body','update','catch','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0xd769,0xa5));var _0x9d76=function(_0x234459,_0x8da0cc){_0x234459=_0x234459-0x0;var _0x2a73fb=_0xd769[_0x234459];return _0x2a73fb;};'use strict';var emlformat=require(_0x9d76('0x0'));var rimraf=require(_0x9d76('0x1'));var zipdir=require(_0x9d76('0x2'));var jsonpatch=require(_0x9d76('0x3'));var rp=require('request-promise');var moment=require(_0x9d76('0x4'));var BPromise=require(_0x9d76('0x5'));var Mustache=require(_0x9d76('0x6'));var util=require(_0x9d76('0x7'));var path=require(_0x9d76('0x8'));var sox=require(_0x9d76('0x9'));var csv=require(_0x9d76('0xa'));var ejs=require(_0x9d76('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d76('0xc'));var squel=require(_0x9d76('0xd'));var crypto=require(_0x9d76('0xe'));var jsforce=require(_0x9d76('0xf'));var deskjs=require(_0x9d76('0x10'));var toCsv=require(_0x9d76('0xa'));var querystring=require(_0x9d76('0x11'));var Papa=require(_0x9d76('0x12'));var Redis=require(_0x9d76('0x13'));var authService=require(_0x9d76('0x14'));var qs=require(_0x9d76('0x15'));var as=require(_0x9d76('0x16'));var hardwareService=require(_0x9d76('0x17'));var logger=require(_0x9d76('0x18'))(_0x9d76('0x19'));var utils=require('../../config/utils');var config=require(_0x9d76('0x1a'));var licenseUtil=require(_0x9d76('0x1b'));var db=require(_0x9d76('0x1c'))['db'];function respondWithStatusCode(_0x2fca46,_0x4ce83d){_0x4ce83d=_0x4ce83d||0xcc;return function(_0x439174){if(_0x439174){return _0x2fca46[_0x9d76('0x1d')](_0x4ce83d);}return _0x2fca46[_0x9d76('0x1e')](_0x4ce83d)['end']();};}function respondWithResult(_0x397549,_0x18ed7f){_0x18ed7f=_0x18ed7f||0xc8;return function(_0x201248){if(_0x201248){return _0x397549['status'](_0x18ed7f)['json'](_0x201248);}};}function respondWithFilteredResult(_0x3f21ea,_0x27e7e2){return function(_0x2fcb04){if(_0x2fcb04){var _0x35a0e5=typeof _0x27e7e2['offset']==='undefined'&&typeof _0x27e7e2[_0x9d76('0x1f')]===_0x9d76('0x20');var _0x557a14=_0x2fcb04['count'];var _0x270cf7=_0x35a0e5?0x0:_0x27e7e2[_0x9d76('0x21')];var _0xa09e9f=_0x35a0e5?_0x2fcb04[_0x9d76('0x22')]:_0x27e7e2['offset']+_0x27e7e2[_0x9d76('0x1f')];var _0xa4bd1e;if(_0xa09e9f>=_0x557a14){_0xa09e9f=_0x557a14;_0xa4bd1e=0xc8;}else{_0xa4bd1e=0xce;}_0x3f21ea[_0x9d76('0x1e')](_0xa4bd1e);return _0x3f21ea[_0x9d76('0x23')](_0x9d76('0x24'),_0x270cf7+'-'+_0xa09e9f+'/'+_0x557a14)[_0x9d76('0x25')](_0x2fcb04);}return null;};}function patchUpdates(_0x44393f){return function(_0x127cd5){try{jsonpatch[_0x9d76('0x26')](_0x127cd5,_0x44393f,!![]);}catch(_0x4086ef){return BPromise[_0x9d76('0x27')](_0x4086ef);}return _0x127cd5[_0x9d76('0x28')]();};}function saveUpdates(_0x5aecc6,_0x47c16a){return function(_0x9b81ce){if(_0x9b81ce){return _0x9b81ce['update'](_0x5aecc6)[_0x9d76('0x29')](function(_0x1a9c89){return _0x1a9c89;});}return null;};}function removeEntity(_0x13dd62,_0x2267e6){return function(_0x440bdc){if(_0x440bdc){return _0x440bdc['destroy']()[_0x9d76('0x29')](function(){_0x13dd62[_0x9d76('0x1e')](0xcc)[_0x9d76('0x2a')]();});}};}function handleEntityNotFound(_0x5ddee7,_0x20ced7){return function(_0x46b60d){if(!_0x46b60d){_0x5ddee7[_0x9d76('0x1d')](0x194);}return _0x46b60d;};}function handleError(_0x2e0dc6,_0x4b359f){_0x4b359f=_0x4b359f||0x1f4;return function(_0x4e9632){logger['error'](_0x4e9632[_0x9d76('0x2b')]);if(_0x4e9632[_0x9d76('0x2c')]){delete _0x4e9632[_0x9d76('0x2c')];}_0x2e0dc6[_0x9d76('0x1e')](_0x4b359f)['send'](_0x4e9632);};}exports[_0x9d76('0x2d')]=function(_0x9bb288,_0x439099){var _0x4677f9={},_0x2d1039={},_0x5b3cd8={'count':0x0,'rows':[]};var _0x1e175a=_[_0x9d76('0x2e')](db[_0x9d76('0x2f')][_0x9d76('0x30')],function(_0x16bd94){return{'name':_0x16bd94[_0x9d76('0x31')],'type':_0x16bd94[_0x9d76('0x32')]['key']};});_0x2d1039[_0x9d76('0x33')]=_[_0x9d76('0x2e')](_0x1e175a,_0x9d76('0x2c'));_0x2d1039['query']=_[_0x9d76('0x34')](_0x9bb288['query']);_0x2d1039[_0x9d76('0x35')]=_[_0x9d76('0x36')](_0x2d1039[_0x9d76('0x33')],_0x2d1039['query']);_0x4677f9[_0x9d76('0x37')]=_[_0x9d76('0x36')](_0x2d1039[_0x9d76('0x33')],qs[_0x9d76('0x38')](_0x9bb288['query'][_0x9d76('0x38')]));_0x4677f9['attributes']=_0x4677f9[_0x9d76('0x37')][_0x9d76('0x39')]?_0x4677f9[_0x9d76('0x37')]:_0x2d1039[_0x9d76('0x33')];if(!_0x9bb288['query'][_0x9d76('0x3a')](_0x9d76('0x3b'))){_0x4677f9[_0x9d76('0x1f')]=qs[_0x9d76('0x1f')](_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x1f')]);_0x4677f9[_0x9d76('0x21')]=qs[_0x9d76('0x21')](_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x21')]);}_0x4677f9[_0x9d76('0x3d')]=qs[_0x9d76('0x3e')](_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x3e')]);_0x4677f9['where']=qs['filters'](_[_0x9d76('0x3f')](_0x9bb288['query'],_0x2d1039[_0x9d76('0x35')]),_0x1e175a);if(_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x40')]){_0x4677f9[_0x9d76('0x41')]=_[_0x9d76('0x42')](_0x4677f9[_0x9d76('0x41')],{'$or':_['map'](_0x1e175a,function(_0x373cea){if(_0x373cea[_0x9d76('0x32')]!=='VIRTUAL'){var _0x1ab9d9={};_0x1ab9d9[_0x373cea[_0x9d76('0x2c')]]={'$like':'%'+_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x40')]+'%'};return _0x1ab9d9;}})});}_0x4677f9=_['merge']({},_0x4677f9,_0x9bb288[_0x9d76('0x43')]);var _0x2f73={'where':_0x4677f9[_0x9d76('0x41')]};return db[_0x9d76('0x2f')][_0x9d76('0x22')](_0x2f73)[_0x9d76('0x29')](function(_0x5c05fa){_0x5b3cd8['count']=_0x5c05fa;if(_0x9bb288[_0x9d76('0x3c')][_0x9d76('0x44')]){_0x4677f9[_0x9d76('0x45')]=[{'all':!![]}];}return db[_0x9d76('0x2f')][_0x9d76('0x46')](_0x4677f9);})['then'](function(_0x1f0656){_0x5b3cd8['rows']=_0x1f0656;return _0x5b3cd8;})[_0x9d76('0x29')](respondWithFilteredResult(_0x439099,_0x4677f9))['catch'](handleError(_0x439099,null));};exports['show']=function(_0x235810,_0x4d7440){var _0x2960d1={'raw':![],'where':{'id':_0x235810[_0x9d76('0x47')]['id']}},_0x3e24ee={};_0x3e24ee['model']=_[_0x9d76('0x34')](db[_0x9d76('0x2f')][_0x9d76('0x30')]);_0x3e24ee[_0x9d76('0x3c')]=_[_0x9d76('0x34')](_0x235810[_0x9d76('0x3c')]);_0x3e24ee[_0x9d76('0x35')]=_['intersection'](_0x3e24ee['model'],_0x3e24ee['query']);_0x2960d1[_0x9d76('0x37')]=_[_0x9d76('0x36')](_0x3e24ee[_0x9d76('0x33')],qs[_0x9d76('0x38')](_0x235810[_0x9d76('0x3c')][_0x9d76('0x38')]));_0x2960d1[_0x9d76('0x37')]=_0x2960d1[_0x9d76('0x37')][_0x9d76('0x39')]?_0x2960d1[_0x9d76('0x37')]:_0x3e24ee[_0x9d76('0x33')];if(_0x235810[_0x9d76('0x3c')][_0x9d76('0x44')]){_0x2960d1[_0x9d76('0x45')]=[{'all':!![]}];}_0x2960d1=_[_0x9d76('0x42')]({},_0x2960d1,_0x235810[_0x9d76('0x43')]);return db['Automation'][_0x9d76('0x48')](_0x2960d1)[_0x9d76('0x29')](handleEntityNotFound(_0x4d7440,null))['then'](respondWithResult(_0x4d7440,null))['catch'](handleError(_0x4d7440,null));};exports[_0x9d76('0x49')]=function(_0x3c55e1,_0x42220a){return db[_0x9d76('0x2f')][_0x9d76('0x49')](_0x3c55e1[_0x9d76('0x4a')],{})[_0x9d76('0x29')](respondWithResult(_0x42220a,0xc9))['catch'](handleError(_0x42220a,null));};exports[_0x9d76('0x4b')]=function(_0x58be18,_0x364e31){if(_0x58be18[_0x9d76('0x4a')]['id']){delete _0x58be18['body']['id'];}return db[_0x9d76('0x2f')][_0x9d76('0x48')]({'where':{'id':_0x58be18['params']['id']}})[_0x9d76('0x29')](handleEntityNotFound(_0x364e31,null))['then'](saveUpdates(_0x58be18[_0x9d76('0x4a')],null))['then'](respondWithResult(_0x364e31,null))[_0x9d76('0x4c')](handleError(_0x364e31,null));};exports['destroy']=function(_0x11992c,_0x198e18){return db[_0x9d76('0x2f')][_0x9d76('0x48')]({'where':{'id':_0x11992c['params']['id']}})[_0x9d76('0x29')](handleEntityNotFound(_0x198e18,null))[_0x9d76('0x29')](removeEntity(_0x198e18,null))[_0x9d76('0x4c')](handleError(_0x198e18,null));};exports[_0x9d76('0x4d')]=function(_0x2473b0,_0x588633,_0x6365ea){return db[_0x9d76('0x4e')][_0x9d76('0x48')]({'where':{'id':_0x2473b0[_0x9d76('0x47')]['id']}})['then'](handleEntityNotFound(_0x588633,null))['then'](function(_0x3b7499){if(_0x3b7499){return _0x3b7499[_0x9d76('0x4d')](_0x2473b0[_0x9d76('0x4a')][_0x9d76('0x4f')],_[_0x9d76('0x50')](_0x2473b0[_0x9d76('0x4a')],[_0x9d76('0x4f'),'id'])||{});}})[_0x9d76('0x29')](respondWithResult(_0x588633,null))[_0x9d76('0x4c')](handleError(_0x588633,null));};exports[_0x9d76('0x51')]=function(_0x58a2ff,_0x444bee,_0x43eee9){var _0x532554={};var _0x5a3a1b={};var _0x36d272;var _0x2f28b9;return db[_0x9d76('0x2f')]['findOne']({'where':{'id':_0x58a2ff[_0x9d76('0x47')]['id']}})[_0x9d76('0x29')](handleEntityNotFound(_0x444bee,null))[_0x9d76('0x29')](function(_0x32a7ac){if(_0x32a7ac){_0x36d272=_0x32a7ac;_0x5a3a1b[_0x9d76('0x33')]=_['keys'](db[_0x9d76('0x4e')][_0x9d76('0x30')]);_0x5a3a1b[_0x9d76('0x3c')]=_[_0x9d76('0x34')](_0x58a2ff[_0x9d76('0x3c')]);_0x5a3a1b[_0x9d76('0x35')]=_[_0x9d76('0x36')](_0x5a3a1b[_0x9d76('0x33')],_0x5a3a1b[_0x9d76('0x3c')]);_0x532554[_0x9d76('0x37')]=_[_0x9d76('0x36')](_0x5a3a1b['model'],qs['fields'](_0x58a2ff[_0x9d76('0x3c')][_0x9d76('0x38')]));_0x532554[_0x9d76('0x37')]=_0x532554[_0x9d76('0x37')]['length']?_0x532554[_0x9d76('0x37')]:_0x5a3a1b[_0x9d76('0x33')];_0x532554['order']=qs[_0x9d76('0x3e')](_0x58a2ff[_0x9d76('0x3c')][_0x9d76('0x3e')]);_0x532554[_0x9d76('0x41')]=qs[_0x9d76('0x35')](_[_0x9d76('0x3f')](_0x58a2ff['query'],_0x5a3a1b[_0x9d76('0x35')]));if(_0x58a2ff[_0x9d76('0x3c')]['filter']){_0x532554[_0x9d76('0x41')]=_[_0x9d76('0x42')](_0x532554[_0x9d76('0x41')],{'$or':_[_0x9d76('0x2e')](_0x532554['attributes'],function(_0x410902){var _0x460348={};_0x460348[_0x410902]={'$like':'%'+_0x58a2ff[_0x9d76('0x3c')][_0x9d76('0x40')]+'%'};return _0x460348;})});}_0x532554=_['merge']({},_0x532554,_0x58a2ff[_0x9d76('0x43')]);return _0x36d272[_0x9d76('0x51')](_0x532554);}})[_0x9d76('0x29')](function(_0x23cd29){if(_0x23cd29){_0x2f28b9=_0x23cd29[_0x9d76('0x39')];if(!_0x58a2ff[_0x9d76('0x3c')][_0x9d76('0x3a')](_0x9d76('0x3b'))){_0x532554[_0x9d76('0x1f')]=qs[_0x9d76('0x1f')](_0x58a2ff[_0x9d76('0x3c')][_0x9d76('0x1f')]);_0x532554['offset']=qs[_0x9d76('0x21')](_0x58a2ff['query'][_0x9d76('0x21')]);}return _0x36d272[_0x9d76('0x51')](_0x532554);}})[_0x9d76('0x29')](function(_0x1ad2f2){if(_0x1ad2f2){return _0x1ad2f2?{'count':_0x2f28b9,'rows':_0x1ad2f2}:null;}})['then'](respondWithResult(_0x444bee,null))[_0x9d76('0x4c')](handleError(_0x444bee,null));};exports[_0x9d76('0x52')]=function(_0x3a5386,_0x308a3c,_0x152a68){return db[_0x9d76('0x53')][_0x9d76('0x48')]({'where':{'id':_0x3a5386[_0x9d76('0x47')]['id']}})[_0x9d76('0x29')](handleEntityNotFound(_0x308a3c,null))[_0x9d76('0x29')](function(_0x201324){if(_0x201324){return _0x201324[_0x9d76('0x52')](_0x3a5386['body'][_0x9d76('0x4f')],_[_0x9d76('0x50')](_0x3a5386[_0x9d76('0x4a')],[_0x9d76('0x4f'),'id'])||{});}})[_0x9d76('0x29')](respondWithResult(_0x308a3c,null))[_0x9d76('0x4c')](handleError(_0x308a3c,null));};exports[_0x9d76('0x54')]=function(_0x5a7da4,_0x5e80a2,_0x23bffe){var _0xc005c5={};var _0x1f37a4={};var _0x4b07f5;var _0x75214b;return db[_0x9d76('0x2f')][_0x9d76('0x55')]({'where':{'id':_0x5a7da4[_0x9d76('0x47')]['id']}})[_0x9d76('0x29')](handleEntityNotFound(_0x5e80a2,null))[_0x9d76('0x29')](function(_0x4942b0){if(_0x4942b0){_0x4b07f5=_0x4942b0;_0x1f37a4[_0x9d76('0x33')]=_[_0x9d76('0x34')](db[_0x9d76('0x53')][_0x9d76('0x30')]);_0x1f37a4[_0x9d76('0x3c')]=_[_0x9d76('0x34')](_0x5a7da4['query']);_0x1f37a4[_0x9d76('0x35')]=_[_0x9d76('0x36')](_0x1f37a4[_0x9d76('0x33')],_0x1f37a4[_0x9d76('0x3c')]);_0xc005c5[_0x9d76('0x37')]=_[_0x9d76('0x36')](_0x1f37a4[_0x9d76('0x33')],qs[_0x9d76('0x38')](_0x5a7da4[_0x9d76('0x3c')][_0x9d76('0x38')]));_0xc005c5[_0x9d76('0x37')]=_0xc005c5[_0x9d76('0x37')][_0x9d76('0x39')]?_0xc005c5[_0x9d76('0x37')]:_0x1f37a4[_0x9d76('0x33')];_0xc005c5['order']=qs[_0x9d76('0x3e')](_0x5a7da4[_0x9d76('0x3c')][_0x9d76('0x3e')]);_0xc005c5[_0x9d76('0x41')]=qs[_0x9d76('0x35')](_[_0x9d76('0x3f')](_0x5a7da4[_0x9d76('0x3c')],_0x1f37a4['filters']));if(_0x5a7da4[_0x9d76('0x3c')][_0x9d76('0x40')]){_0xc005c5[_0x9d76('0x41')]=_[_0x9d76('0x42')](_0xc005c5[_0x9d76('0x41')],{'$or':_[_0x9d76('0x2e')](_0xc005c5['attributes'],function(_0x502595){var _0x48e23d={};_0x48e23d[_0x502595]={'$like':'%'+_0x5a7da4[_0x9d76('0x3c')][_0x9d76('0x40')]+'%'};return _0x48e23d;})});}_0xc005c5=_['merge']({},_0xc005c5,_0x5a7da4[_0x9d76('0x43')]);return _0x4b07f5['getActions'](_0xc005c5);}})[_0x9d76('0x29')](function(_0x296ef4){if(_0x296ef4){_0x75214b=_0x296ef4['length'];if(!_0x5a7da4[_0x9d76('0x3c')][_0x9d76('0x3a')]('nolimit')){_0xc005c5['limit']=qs[_0x9d76('0x1f')](_0x5a7da4['query'][_0x9d76('0x1f')]);_0xc005c5[_0x9d76('0x21')]=qs[_0x9d76('0x21')](_0x5a7da4[_0x9d76('0x3c')]['offset']);}return _0x4b07f5[_0x9d76('0x54')](_0xc005c5);}})[_0x9d76('0x29')](function(_0x1fd1fd){if(_0x1fd1fd){return _0x1fd1fd?{'count':_0x75214b,'rows':_0x1fd1fd}:null;}})[_0x9d76('0x29')](respondWithResult(_0x5e80a2,null))[_0x9d76('0x4c')](handleError(_0x5e80a2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 35c80ee..4118eba 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 _0x0e47=['path','rimraf','../../config/environment','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e47,0x1b3));var _0x70e4=function(_0x40baf1,_0x39a1e3){_0x40baf1=_0x40baf1-0x0;var _0x293477=_0x0e47[_0x40baf1];return _0x293477;};'use strict';var _=require(_0x70e4('0x0'));var util=require(_0x70e4('0x1'));var logger=require(_0x70e4('0x2'))(_0x70e4('0x3'));var moment=require(_0x70e4('0x4'));var BPromise=require(_0x70e4('0x5'));var rp=require(_0x70e4('0x6'));var fs=require('fs');var path=require(_0x70e4('0x7'));var rimraf=require(_0x70e4('0x8'));var config=require(_0x70e4('0x9'));var attributes=require('./automation.attributes');module['exports']=function(_0x2592e3,_0xa6288c){return _0x2592e3[_0x70e4('0xa')](_0x70e4('0xb'),attributes,{'tableName':_0x70e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9357=['define','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./automation.attributes','exports'];(function(_0x3c2666,_0x15fd23){var _0x10c814=function(_0x4660c0){while(--_0x4660c0){_0x3c2666['push'](_0x3c2666['shift']());}};_0x10c814(++_0x15fd23);}(_0x9357,0xe9));var _0x7935=function(_0x4b131a,_0x6bd404){_0x4b131a=_0x4b131a-0x0;var _0x1bdc07=_0x9357[_0x4b131a];return _0x1bdc07;};'use strict';var _=require(_0x7935('0x0'));var util=require('util');var logger=require(_0x7935('0x1'))(_0x7935('0x2'));var moment=require(_0x7935('0x3'));var BPromise=require(_0x7935('0x4'));var rp=require(_0x7935('0x5'));var fs=require('fs');var path=require(_0x7935('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7935('0x7'));module[_0x7935('0x8')]=function(_0x52f1a3,_0x42924b){return _0x52f1a3[_0x7935('0x9')]('Automation',attributes,{'tableName':_0x7935('0xa'),'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 67713b3..b3d5b50 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 _0xa5dd=['request','then','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1990da,_0x566d31){var _0x2dab2c=function(_0x19c48a){while(--_0x19c48a){_0x1990da['push'](_0x1990da['shift']());}};_0x2dab2c(++_0x566d31);}(_0xa5dd,0x101));var _0xda5d=function(_0x2e4790,_0x15d4ed){_0x2e4790=_0x2e4790-0x0;var _0x324230=_0xa5dd[_0x2e4790];return _0x324230;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda5d('0x1'));var rs=require(_0xda5d('0x2'));var fs=require('fs');var Redis=require(_0xda5d('0x3'));var db=require(_0xda5d('0x4'))['db'];var utils=require(_0xda5d('0x5'));var logger=require('../../config/logger')(_0xda5d('0x6'));var config=require(_0xda5d('0x7'));var jayson=require(_0xda5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x461283,_0x91cf4e,_0x432097){return new BPromise(function(_0x402aa8,_0x1c1e2d){return client[_0xda5d('0x9')](_0x461283,_0x432097)[_0xda5d('0xa')](function(_0x3d5c69){logger['info']('Automation,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'),JSON[_0xda5d('0xc')](_0x3d5c69));if(_0x3d5c69['error']){if(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xe')]===0x1f4){logger[_0xda5d('0xd')]('Automation,\x20%s,\x20%s',_0x91cf4e,_0x3d5c69['error'][_0xda5d('0xf')]);return _0x1c1e2d(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);}logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);return _0x402aa8(_0x3d5c69['error']['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x91cf4e,'request\x20sent');_0x402aa8(_0x3d5c69[_0xda5d('0x11')][_0xda5d('0xf')]);}})[_0xda5d('0x12')](function(_0x388f40){logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x388f40);_0x1c1e2d(_0x388f40);});});} \ No newline at end of file +var _0x5c96=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x435758,_0x723d44){var _0x4b0087=function(_0x38b019){while(--_0x38b019){_0x435758['push'](_0x435758['shift']());}};_0x4b0087(++_0x723d44);}(_0x5c96,0x133));var _0x65c9=function(_0x50f72b,_0x32cb7f){_0x50f72b=_0x50f72b-0x0;var _0x21fdef=_0x5c96[_0x50f72b];return _0x21fdef;};'use strict';var _=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var moment=require(_0x65c9('0x2'));var BPromise=require(_0x65c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65c9('0x4'));var db=require(_0x65c9('0x5'))['db'];var utils=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));var config=require(_0x65c9('0x9'));var jayson=require(_0x65c9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x502c63,_0x4eb25b,_0x1a9b93){return new BPromise(function(_0x10a355,_0x1c679d){return client['request'](_0x502c63,_0x1a9b93)[_0x65c9('0xb')](function(_0x3249da){logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));logger[_0x65c9('0xf')](_0x65c9('0x10'),_0x4eb25b,'request\x20sent',JSON['stringify'](_0x3249da));if(_0x3249da['error']){if(_0x3249da[_0x65c9('0x11')][_0x65c9('0x12')]===0x1f4){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da[_0x65c9('0x11')]['message']);return _0x1c679d(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da['error'][_0x65c9('0x13')]);return _0x10a355(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}else{logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));_0x10a355(_0x3249da[_0x65c9('0x14')][_0x65c9('0x13')]);}})[_0x65c9('0x15')](function(_0x25c0e9){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x25c0e9);_0x1c679d(_0x25c0e9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 98b403f..99532f0 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 _0x9f94=['addActions','put','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','post','/:id/conditions','addConditions'];(function(_0x4c6e38,_0x4902c7){var _0x472a16=function(_0x3ba24a){while(--_0x3ba24a){_0x4c6e38['push'](_0x4c6e38['shift']());}};_0x472a16(++_0x4902c7);}(_0x9f94,0x1e7));var _0x49f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9f94[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var path=require(_0x49f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49f9('0x3')]();var fs_extra=require(_0x49f9('0x4'));var auth=require(_0x49f9('0x5'));var interaction=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var controller=require('./automation.controller');router[_0x49f9('0x8')]('/',auth[_0x49f9('0x9')](),controller[_0x49f9('0xa')]);router[_0x49f9('0x8')](_0x49f9('0xb'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xc')]);router[_0x49f9('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x49f9('0xd')]);router['get'](_0x49f9('0xe'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xf')]);router['post']('/',auth[_0x49f9('0x9')](),controller['create']);router[_0x49f9('0x10')](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x12')]);router['post']('/:id/actions',auth[_0x49f9('0x9')](),controller[_0x49f9('0x13')]);router[_0x49f9('0x14')](_0x49f9('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x49f9('0xb'),auth['isAuthenticated'](),controller[_0x49f9('0x15')]);module['exports']=router; \ No newline at end of file +var _0xab55=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','create','post','addConditions','/:id/actions','addActions','put','delete','destroy'];(function(_0x46e749,_0x9b62a){var _0x1b776f=function(_0xe39362){while(--_0xe39362){_0x46e749['push'](_0x46e749['shift']());}};_0x1b776f(++_0x9b62a);}(_0xab55,0x139));var _0x5ab5=function(_0x86d299,_0x53bd07){_0x86d299=_0x86d299-0x0;var _0x44f0b3=_0xab55[_0x86d299];return _0x44f0b3;};'use strict';var multer=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var path=require(_0x5ab5('0x2'));var timeout=require(_0x5ab5('0x3'));var express=require('express');var router=express[_0x5ab5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ab5('0x5'));var interaction=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var controller=require(_0x5ab5('0x8'));router[_0x5ab5('0x9')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xb')]);router[_0x5ab5('0x9')](_0x5ab5('0xc'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xd')]);router[_0x5ab5('0x9')](_0x5ab5('0xe'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xf')]);router[_0x5ab5('0x9')]('/:id/actions',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x10')]);router['post']('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x11')]);router[_0x5ab5('0x12')](_0x5ab5('0xe'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x13')]);router[_0x5ab5('0x12')](_0x5ab5('0x14'),auth['isAuthenticated'](),controller[_0x5ab5('0x15')]);router[_0x5ab5('0x16')](_0x5ab5('0xc'),auth[_0x5ab5('0xa')](),controller['update']);router[_0x5ab5('0x17')]('/:id',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x18')]);module[_0x5ab5('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c14c450..f8003ce 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 _0xf41e=['exports','STRING','name','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x49fb45,_0x4cc16c){var _0x5d7dbc=function(_0x967546){while(--_0x967546){_0x49fb45['push'](_0x49fb45['shift']());}};_0x5d7dbc(++_0x4cc16c);}(_0xf41e,0x167));var _0xef41=function(_0x9a1fc,_0x461fd8){_0x9a1fc=_0x9a1fc-0x0;var _0x6969a3=_0xf41e[_0x9a1fc];return _0x6969a3;};'use strict';var Sequelize=require(_0xef41('0x0'));module[_0xef41('0x1')]={'name':{'type':Sequelize[_0xef41('0x2')],'unique':_0xef41('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xef41('0x4')](_0xef41('0x5')),'allowNull':![],'defaultValue':_0xef41('0x5')},'description':{'type':Sequelize[_0xef41('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xef41('0x6')](0x4)[_0xef41('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xef41('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xef41('0x6')](0x5)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef41('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xef41('0x6')](0x5)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xef41('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xef41('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xef41('0x4')]('always',_0xef41('0x11'),_0xef41('0x12')),'defaultValue':_0xef41('0x13')},'dialAMDActive':{'type':Sequelize[_0xef41('0x14')],'defaultValue':0x0,'comment':_0xef41('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xef41('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xef41('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xef41('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xef41('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xef41('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xef41('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xef41('0x6')](0x9)[_0xef41('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xef41('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xef41('0x4')](_0xef41('0x1b'),_0xef41('0x1c')),'defaultValue':_0xef41('0x1b')},'dialPrefix':{'type':Sequelize[_0xef41('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xef41('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xef41('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xef41('0x6')](0x5)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xef41('0x6')](0x3)[_0xef41('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef41('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xef41('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef41('0x23')}}; \ No newline at end of file +var _0xd250=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x458656,_0x4292d8){var _0x24e475=function(_0x15f497){while(--_0x15f497){_0x458656['push'](_0x458656['shift']());}};_0x24e475(++_0x4292d8);}(_0xd250,0x70));var _0x0d25=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xd250[_0x3817a9];return _0x443f30;};'use strict';var Sequelize=require(_0x0d25('0x0'));module[_0x0d25('0x1')]={'name':{'type':Sequelize[_0x0d25('0x2')],'unique':_0x0d25('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0d25('0x4')](_0x0d25('0x5')),'allowNull':![],'defaultValue':_0x0d25('0x5')},'description':{'type':Sequelize[_0x0d25('0x2')]},'active':{'type':Sequelize[_0x0d25('0x6')],'defaultValue':0x0,'comment':_0x0d25('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0d25('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0d25('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0d25('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d25('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0d25('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d25('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0d25('0x9')](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'comment':_0x0d25('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0d25('0x10')},'dialTimezone':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':_0x0d25('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x0d25('0x4')](_0x0d25('0x12'),_0x0d25('0x13'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0d25('0x6')],'defaultValue':0x0,'comment':_0x0d25('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0d25('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0d25('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0d25('0x9')](0x9)[_0x0d25('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0d25('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0d25('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d25('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x0d25('0x9')](0x9)[_0x0d25('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0d25('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0d25('0x9')](0x9)[_0x0d25('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0d25('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0d25('0x9')](0x9)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0d25('0x9')](0x5)[_0x0d25('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0d25('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0d25('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d25('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0d25('0x4')](_0x0d25('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d25('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0d25('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0d25('0x9')](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d25('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0d25('0x9')](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0d25('0x9')](0x3)[_0x0d25('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d25('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0d25('0x9')](0x5)[_0x0d25('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d25('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index bfa9b95..d777208 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 _0x69cd=['fs-extra','lodash','squel','crypto','desk.js','querystring','../../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','count','set','apply','reject','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','Campaign','params','includeAll','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','omit','createdAt','updatedAt','update','getHoppers','findOne','nolimit','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','mustache','util','to-csv','ejs'];(function(_0x931b59,_0x455da1){var _0x49d207=function(_0x1c2cd7){while(--_0x1c2cd7){_0x931b59['push'](_0x931b59['shift']());}};_0x49d207(++_0x455da1);}(_0x69cd,0x104));var _0xd69c=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x69cd[_0x2abc3d];return _0x252745;};'use strict';var emlformat=require(_0xd69c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd69c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd69c('0x2'));var util=require(_0xd69c('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xd69c('0x4'));var ejs=require(_0xd69c('0x5'));var fs=require('fs');var fs_extra=require(_0xd69c('0x6'));var _=require(_0xd69c('0x7'));var squel=require(_0xd69c('0x8'));var crypto=require(_0xd69c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd69c('0xa'));var toCsv=require(_0xd69c('0x4'));var querystring=require(_0xd69c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd69c('0xc'));var qs=require(_0xd69c('0xd'));var as=require(_0xd69c('0xe'));var hardwareService=require(_0xd69c('0xf'));var logger=require(_0xd69c('0x10'))('api');var utils=require(_0xd69c('0x11'));var config=require(_0xd69c('0x12'));var licenseUtil=require(_0xd69c('0x13'));var db=require(_0xd69c('0x14'))['db'];function respondWithStatusCode(_0x2a6b58,_0x577b3a){_0x577b3a=_0x577b3a||0xcc;return function(_0x167409){if(_0x167409){return _0x2a6b58[_0xd69c('0x15')](_0x577b3a);}return _0x2a6b58[_0xd69c('0x16')](_0x577b3a)[_0xd69c('0x17')]();};}function respondWithResult(_0xfe03c7,_0x468d1c){_0x468d1c=_0x468d1c||0xc8;return function(_0x222009){if(_0x222009){return _0xfe03c7[_0xd69c('0x16')](_0x468d1c)[_0xd69c('0x18')](_0x222009);}};}function respondWithFilteredResult(_0x2cbcd7,_0x21a0ce){return function(_0x414058){if(_0x414058){var _0x1515e1=typeof _0x21a0ce['offset']===_0xd69c('0x19')&&typeof _0x21a0ce[_0xd69c('0x1a')]===_0xd69c('0x19');var _0x380345=_0x414058['count'];var _0x118c66=_0x1515e1?0x0:_0x21a0ce[_0xd69c('0x1b')];var _0x5f0b85=_0x1515e1?_0x414058[_0xd69c('0x1c')]:_0x21a0ce[_0xd69c('0x1b')]+_0x21a0ce[_0xd69c('0x1a')];var _0x425b1d;if(_0x5f0b85>=_0x380345){_0x5f0b85=_0x380345;_0x425b1d=0xc8;}else{_0x425b1d=0xce;}_0x2cbcd7[_0xd69c('0x16')](_0x425b1d);return _0x2cbcd7[_0xd69c('0x1d')]('Content-Range',_0x118c66+'-'+_0x5f0b85+'/'+_0x380345)[_0xd69c('0x18')](_0x414058);}return null;};}function patchUpdates(_0x477a8f){return function(_0x3a98a2){try{jsonpatch[_0xd69c('0x1e')](_0x3a98a2,_0x477a8f,!![]);}catch(_0x12058f){return BPromise[_0xd69c('0x1f')](_0x12058f);}return _0x3a98a2['save']();};}function saveUpdates(_0x10d2ad,_0x4c48df){return function(_0x5a4bc8){if(_0x5a4bc8){return _0x5a4bc8['update'](_0x10d2ad)[_0xd69c('0x20')](function(_0x192e06){return _0x192e06;});}return null;};}function removeEntity(_0x5035bd,_0x357b5e){return function(_0x962112){if(_0x962112){return _0x962112[_0xd69c('0x21')]()['then'](function(){var _0x3a3143=_0x962112[_0xd69c('0x22')]({'plain':!![]});var _0x3cc560=_0xd69c('0x23');return db[_0xd69c('0x24')][_0xd69c('0x21')]({'where':{'type':_0x3cc560,'resourceId':_0x3a3143['id']}})[_0xd69c('0x20')](function(){return _0x962112;});})[_0xd69c('0x20')](function(){_0x5035bd[_0xd69c('0x16')](0xcc)[_0xd69c('0x17')]();});}};}function handleEntityNotFound(_0x24f84c,_0x5c6cf6){return function(_0x279483){if(!_0x279483){_0x24f84c[_0xd69c('0x15')](0x194);}return _0x279483;};}function handleError(_0x515cea,_0xd14b5e){_0xd14b5e=_0xd14b5e||0x1f4;return function(_0x3ff026){logger[_0xd69c('0x25')](_0x3ff026[_0xd69c('0x26')]);if(_0x3ff026[_0xd69c('0x27')]){delete _0x3ff026[_0xd69c('0x27')];}_0x515cea['status'](_0xd14b5e)['send'](_0x3ff026);};}exports[_0xd69c('0x28')]=function(_0x52b2d9,_0x308533){var _0x260e14={},_0x14e05d={},_0x106201={'count':0x0,'rows':[]};var _0x78a67f=_[_0xd69c('0x29')](db['Campaign'][_0xd69c('0x2a')],function(_0x8edb7c){return{'name':_0x8edb7c[_0xd69c('0x2b')],'type':_0x8edb7c[_0xd69c('0x2c')]['key']};});_0x14e05d[_0xd69c('0x2d')]=_[_0xd69c('0x29')](_0x78a67f,_0xd69c('0x27'));_0x14e05d[_0xd69c('0x2e')]=_[_0xd69c('0x2f')](_0x52b2d9[_0xd69c('0x2e')]);_0x14e05d[_0xd69c('0x30')]=_['intersection'](_0x14e05d[_0xd69c('0x2d')],_0x14e05d[_0xd69c('0x2e')]);_0x260e14[_0xd69c('0x31')]=_[_0xd69c('0x32')](_0x14e05d['model'],qs[_0xd69c('0x33')](_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x33')]));_0x260e14['attributes']=_0x260e14[_0xd69c('0x31')][_0xd69c('0x34')]?_0x260e14[_0xd69c('0x31')]:_0x14e05d[_0xd69c('0x2d')];if(!_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x35')]('nolimit')){_0x260e14[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x1a')]);_0x260e14[_0xd69c('0x1b')]=qs[_0xd69c('0x1b')](_0x52b2d9[_0xd69c('0x2e')]['offset']);}_0x260e14[_0xd69c('0x36')]=qs[_0xd69c('0x37')](_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x37')]);_0x260e14['where']=qs[_0xd69c('0x30')](_[_0xd69c('0x38')](_0x52b2d9[_0xd69c('0x2e')],_0x14e05d['filters']),_0x78a67f);if(_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x39')]){_0x260e14['where']=_[_0xd69c('0x3a')](_0x260e14[_0xd69c('0x3b')],{'$or':_[_0xd69c('0x29')](_0x78a67f,function(_0x5063cf){if(_0x5063cf[_0xd69c('0x2c')]!==_0xd69c('0x3c')){var _0x58a93f={};_0x58a93f[_0x5063cf[_0xd69c('0x27')]]={'$like':'%'+_0x52b2d9[_0xd69c('0x2e')][_0xd69c('0x39')]+'%'};return _0x58a93f;}})});}_0x260e14=_[_0xd69c('0x3a')]({},_0x260e14,_0x52b2d9[_0xd69c('0x3d')]);var _0x2323b9={'where':_0x260e14[_0xd69c('0x3b')]};return db['Campaign'][_0xd69c('0x1c')](_0x2323b9)[_0xd69c('0x20')](function(_0x159c24){_0x106201[_0xd69c('0x1c')]=_0x159c24;if(_0x52b2d9[_0xd69c('0x2e')]['includeAll']){_0x260e14['include']=[{'all':!![]}];}return db[_0xd69c('0x3e')]['findAll'](_0x260e14);})[_0xd69c('0x20')](function(_0x3d7fc9){_0x106201['rows']=_0x3d7fc9;return _0x106201;})[_0xd69c('0x20')](respondWithFilteredResult(_0x308533,_0x260e14))['catch'](handleError(_0x308533,null));};exports['show']=function(_0x388b98,_0xa74d2d){var _0x5e0196={'raw':![],'where':{'id':_0x388b98[_0xd69c('0x3f')]['id']}},_0x27b528={};_0x27b528[_0xd69c('0x2d')]=_['keys'](db[_0xd69c('0x3e')][_0xd69c('0x2a')]);_0x27b528[_0xd69c('0x2e')]=_[_0xd69c('0x2f')](_0x388b98[_0xd69c('0x2e')]);_0x27b528[_0xd69c('0x30')]=_[_0xd69c('0x32')](_0x27b528[_0xd69c('0x2d')],_0x27b528[_0xd69c('0x2e')]);_0x5e0196[_0xd69c('0x31')]=_[_0xd69c('0x32')](_0x27b528[_0xd69c('0x2d')],qs[_0xd69c('0x33')](_0x388b98['query'][_0xd69c('0x33')]));_0x5e0196[_0xd69c('0x31')]=_0x5e0196['attributes'][_0xd69c('0x34')]?_0x5e0196[_0xd69c('0x31')]:_0x27b528[_0xd69c('0x2d')];if(_0x388b98['query'][_0xd69c('0x40')]){_0x5e0196[_0xd69c('0x41')]=[{'all':!![]}];}_0x5e0196=_[_0xd69c('0x3a')]({},_0x5e0196,_0x388b98['options']);return db[_0xd69c('0x3e')][_0xd69c('0x42')](_0x5e0196)[_0xd69c('0x20')](handleEntityNotFound(_0xa74d2d,null))[_0xd69c('0x20')](respondWithResult(_0xa74d2d,null))[_0xd69c('0x43')](handleError(_0xa74d2d,null));};exports[_0xd69c('0x44')]=function(_0x5542c4,_0x45ff12){return db[_0xd69c('0x3e')][_0xd69c('0x44')](_0x5542c4[_0xd69c('0x45')],{})[_0xd69c('0x20')](function(_0x210999){var _0xa53459=_0x5542c4[_0xd69c('0x46')][_0xd69c('0x22')]({'plain':!![]});if(!_0xa53459)throw new Error(_0xd69c('0x47'));if(_0xa53459[_0xd69c('0x48')]==='user'){var _0x56e8ca=_0x210999[_0xd69c('0x22')]({'plain':!![]});var _0x314f1f=_0xd69c('0x23');return db[_0xd69c('0x49')][_0xd69c('0x42')]({'where':{'name':_0x314f1f,'userProfileId':_0xa53459[_0xd69c('0x4a')]},'raw':!![]})[_0xd69c('0x20')](function(_0x5be2fb){if(_0x5be2fb&&_0x5be2fb[_0xd69c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x56e8ca[_0xd69c('0x27')],'resourceId':_0x56e8ca['id'],'type':_0x5be2fb['name'],'sectionId':_0x5be2fb['id']},{})['then'](function(){return _0x210999;});}else{return _0x210999;}})['catch'](function(_0x1d479f){logger[_0xd69c('0x25')](_0xd69c('0x4c'),_0x1d479f);throw _0x1d479f;});}return _0x210999;})[_0xd69c('0x20')](respondWithResult(_0x45ff12,0xc9))[_0xd69c('0x43')](handleError(_0x45ff12,null));};exports[_0xd69c('0x4d')]=function(_0x435dca,_0x16580e){var _0x18fa47={'where':{'id':_0x435dca[_0xd69c('0x3f')]['id']}},_0x10ba30={};_0x10ba30[_0xd69c('0x2d')]=_[_0xd69c('0x2f')](db['Campaign'][_0xd69c('0x2a')]);_0x18fa47['attributes']=_['intersection'](_0x10ba30[_0xd69c('0x2d')],qs[_0xd69c('0x33')](_0x435dca[_0xd69c('0x2e')][_0xd69c('0x33')]));_0x18fa47[_0xd69c('0x31')]=_0x18fa47['attributes'][_0xd69c('0x34')]?_0x18fa47[_0xd69c('0x31')]:_0x10ba30[_0xd69c('0x2d')];if(_0x435dca[_0xd69c('0x2e')]['includeAll']){_0x18fa47[_0xd69c('0x41')]=[{'all':!![]}];}_0x18fa47=_[_0xd69c('0x3a')]({},_0x18fa47,_0x435dca['options']);return db[_0xd69c('0x3e')][_0xd69c('0x42')](_0x18fa47)[_0xd69c('0x20')](handleEntityNotFound(_0x16580e,null))['then'](function(_0x15f4a4){if(_0x15f4a4){var _0x1ee7b0=_0x15f4a4['get']({'plain':!![]});_0x1ee7b0=qs[_0xd69c('0x4e')](_0x1ee7b0,['id',_0xd69c('0x4f'),'updatedAt']);_0x435dca[_0xd69c('0x45')]=_[_0xd69c('0x4e')](_0x435dca[_0xd69c('0x45')],['id','createdAt',_0xd69c('0x50')]);return db['Campaign'][_0xd69c('0x44')](_[_0xd69c('0x3a')](_0x1ee7b0,_0x435dca[_0xd69c('0x45')]),{'include':_0x435dca[_0xd69c('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0xd69c('0x20')](function(_0x34ba9b){var _0x58f787=_0x435dca[_0xd69c('0x46')]['get']({'plain':!![]});if(!_0x58f787)throw new Error(_0xd69c('0x47'));if(_0x58f787['role']==='user'){var _0x309ea3=_0x34ba9b[_0xd69c('0x22')]({'plain':!![]});var _0x35c14a=_0xd69c('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x35c14a,'userProfileId':_0x58f787[_0xd69c('0x4a')]},'raw':!![]})['then'](function(_0x222817){if(_0x222817&&_0x222817[_0xd69c('0x4b')]===0x0){return db[_0xd69c('0x24')][_0xd69c('0x44')]({'name':_0x309ea3[_0xd69c('0x27')],'resourceId':_0x309ea3['id'],'type':_0x222817[_0xd69c('0x27')],'sectionId':_0x222817['id']},{})['then'](function(){return _0x34ba9b;});}else{return _0x34ba9b;}})['catch'](function(_0x5d543a){logger[_0xd69c('0x25')](_0xd69c('0x4c'),_0x5d543a);throw _0x5d543a;});}return _0x34ba9b;});}})['then'](respondWithResult(_0x16580e,0xc9))[_0xd69c('0x43')](handleError(_0x16580e,null));};exports[_0xd69c('0x51')]=function(_0xc5e200,_0x41a797){if(_0xc5e200[_0xd69c('0x45')]['id']){delete _0xc5e200[_0xd69c('0x45')]['id'];}return db[_0xd69c('0x3e')][_0xd69c('0x42')]({'where':{'id':_0xc5e200[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x41a797,null))[_0xd69c('0x20')](saveUpdates(_0xc5e200[_0xd69c('0x45')],null))[_0xd69c('0x20')](respondWithResult(_0x41a797,null))[_0xd69c('0x43')](handleError(_0x41a797,null));};exports[_0xd69c('0x21')]=function(_0x3c2461,_0x44bbe0){return db[_0xd69c('0x3e')][_0xd69c('0x42')]({'where':{'id':_0x3c2461[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x44bbe0,null))[_0xd69c('0x20')](removeEntity(_0x44bbe0,null))[_0xd69c('0x43')](handleError(_0x44bbe0,null));};exports[_0xd69c('0x52')]=function(_0x542d67,_0x41e693,_0x18a641){var _0x512a9f={'raw':!![],'where':{}};var _0x5988eb={};var _0x664804={'count':0x0,'rows':[]};return db[_0xd69c('0x3e')][_0xd69c('0x53')]({'where':{'id':_0x542d67[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x41e693,null))[_0xd69c('0x20')](function(_0x43b9b0){if(_0x43b9b0){_0x5988eb[_0xd69c('0x2d')]=_[_0xd69c('0x2f')](db['CmHopper'][_0xd69c('0x2a')]);_0x5988eb[_0xd69c('0x2e')]=_['keys'](_0x542d67[_0xd69c('0x2e')]);_0x5988eb[_0xd69c('0x30')]=_[_0xd69c('0x32')](_0x5988eb[_0xd69c('0x2d')],_0x5988eb[_0xd69c('0x2e')]);_0x512a9f['attributes']=_[_0xd69c('0x32')](_0x5988eb['model'],qs['fields'](_0x542d67[_0xd69c('0x2e')][_0xd69c('0x33')]));_0x512a9f[_0xd69c('0x31')]=_0x512a9f[_0xd69c('0x31')]['length']?_0x512a9f[_0xd69c('0x31')]:_0x5988eb['model'];if(!_0x542d67['query'][_0xd69c('0x35')](_0xd69c('0x54'))){_0x512a9f[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x542d67[_0xd69c('0x2e')]['limit']);_0x512a9f[_0xd69c('0x1b')]=qs['offset'](_0x542d67['query'][_0xd69c('0x1b')]);}_0x512a9f[_0xd69c('0x36')]=qs[_0xd69c('0x37')](_0x542d67[_0xd69c('0x2e')][_0xd69c('0x37')]);_0x512a9f['where']=qs[_0xd69c('0x30')](_[_0xd69c('0x38')](_0x542d67[_0xd69c('0x2e')],_0x5988eb[_0xd69c('0x30')]));_0x512a9f[_0xd69c('0x3b')][_0xd69c('0x55')]=_0x43b9b0['id'];if(_0x542d67[_0xd69c('0x2e')][_0xd69c('0x39')]){_0x512a9f[_0xd69c('0x3b')]=_[_0xd69c('0x3a')](_0x512a9f[_0xd69c('0x3b')],{'$or':_[_0xd69c('0x29')](_0x512a9f['attributes'],function(_0x1a2e72){var _0x22edd7={};_0x22edd7[_0x1a2e72]={'$like':'%'+_0x542d67[_0xd69c('0x2e')]['filter']+'%'};return _0x22edd7;})});}_0x512a9f=_['merge']({},_0x512a9f,_0x542d67[_0xd69c('0x3d')]);return db['CmHopper']['count']({'where':_0x512a9f[_0xd69c('0x3b')]})['then'](function(_0x570bcc){_0x664804[_0xd69c('0x1c')]=_0x570bcc;if(_0x542d67[_0xd69c('0x2e')][_0xd69c('0x40')]){_0x512a9f[_0xd69c('0x41')]=[{'all':!![]}];}return db[_0xd69c('0x56')][_0xd69c('0x57')](_0x512a9f);})[_0xd69c('0x20')](function(_0x1f7fae){_0x664804[_0xd69c('0x58')]=_0x1f7fae;return _0x664804;});}})[_0xd69c('0x20')](respondWithFilteredResult(_0x41e693,_0x512a9f))[_0xd69c('0x43')](handleError(_0x41e693,null));};exports[_0xd69c('0x59')]=function(_0xfc90a2,_0x1e92e8,_0x4f68c1){var _0x33772a={'raw':!![],'where':{}};var _0x47c39a={};var _0x3a1425={'count':0x0,'rows':[]};return db['Campaign'][_0xd69c('0x53')]({'where':{'id':_0xfc90a2[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x1e92e8,null))['then'](function(_0x1c6629){if(_0x1c6629){_0x47c39a[_0xd69c('0x2d')]=_['keys'](db[_0xd69c('0x5a')][_0xd69c('0x2a')]);_0x47c39a[_0xd69c('0x2e')]=_[_0xd69c('0x2f')](_0xfc90a2['query']);_0x47c39a[_0xd69c('0x30')]=_[_0xd69c('0x32')](_0x47c39a[_0xd69c('0x2d')],_0x47c39a['query']);_0x33772a[_0xd69c('0x31')]=_[_0xd69c('0x32')](_0x47c39a[_0xd69c('0x2d')],qs[_0xd69c('0x33')](_0xfc90a2[_0xd69c('0x2e')]['fields']));_0x33772a['attributes']=_0x33772a[_0xd69c('0x31')]['length']?_0x33772a[_0xd69c('0x31')]:_0x47c39a[_0xd69c('0x2d')];if(!_0xfc90a2[_0xd69c('0x2e')][_0xd69c('0x35')](_0xd69c('0x54'))){_0x33772a['limit']=qs[_0xd69c('0x1a')](_0xfc90a2[_0xd69c('0x2e')][_0xd69c('0x1a')]);_0x33772a[_0xd69c('0x1b')]=qs[_0xd69c('0x1b')](_0xfc90a2[_0xd69c('0x2e')][_0xd69c('0x1b')]);}_0x33772a[_0xd69c('0x36')]=qs[_0xd69c('0x37')](_0xfc90a2['query']['sort']);_0x33772a[_0xd69c('0x3b')]=qs['filters'](_[_0xd69c('0x38')](_0xfc90a2[_0xd69c('0x2e')],_0x47c39a[_0xd69c('0x30')]));_0x33772a[_0xd69c('0x3b')]['CampaignId']=_0x1c6629['id'];if(_0xfc90a2[_0xd69c('0x2e')]['filter']){_0x33772a[_0xd69c('0x3b')]=_[_0xd69c('0x3a')](_0x33772a['where'],{'$or':_[_0xd69c('0x29')](_0x33772a[_0xd69c('0x31')],function(_0x1013bd){var _0x1aa5a3={};_0x1aa5a3[_0x1013bd]={'$like':'%'+_0xfc90a2[_0xd69c('0x2e')][_0xd69c('0x39')]+'%'};return _0x1aa5a3;})});}_0x33772a=_[_0xd69c('0x3a')]({},_0x33772a,_0xfc90a2[_0xd69c('0x3d')]);return db[_0xd69c('0x5a')][_0xd69c('0x1c')]({'where':_0x33772a['where']})[_0xd69c('0x20')](function(_0x4d63e4){_0x3a1425[_0xd69c('0x1c')]=_0x4d63e4;if(_0xfc90a2[_0xd69c('0x2e')][_0xd69c('0x40')]){_0x33772a[_0xd69c('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x33772a);})['then'](function(_0x390462){_0x3a1425[_0xd69c('0x58')]=_0x390462;return _0x3a1425;});}})[_0xd69c('0x20')](respondWithFilteredResult(_0x1e92e8,_0x33772a))[_0xd69c('0x43')](handleError(_0x1e92e8,null));};exports[_0xd69c('0x5b')]=function(_0x38eedb,_0x3608cb,_0x588217){var _0x5a2c14={'raw':!![],'where':{}};var _0x2a3bc1={};var _0xe519e7={'count':0x0,'rows':[]};return db[_0xd69c('0x3e')][_0xd69c('0x53')]({'where':{'id':_0x38eedb[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x3608cb,null))[_0xd69c('0x20')](function(_0x1a0626){if(_0x1a0626){_0x2a3bc1[_0xd69c('0x2d')]=_[_0xd69c('0x2f')](db[_0xd69c('0x5c')][_0xd69c('0x2a')]);_0x2a3bc1[_0xd69c('0x2e')]=_['keys'](_0x38eedb[_0xd69c('0x2e')]);_0x2a3bc1[_0xd69c('0x30')]=_['intersection'](_0x2a3bc1[_0xd69c('0x2d')],_0x2a3bc1[_0xd69c('0x2e')]);_0x5a2c14['attributes']=_[_0xd69c('0x32')](_0x2a3bc1[_0xd69c('0x2d')],qs[_0xd69c('0x33')](_0x38eedb['query'][_0xd69c('0x33')]));_0x5a2c14['attributes']=_0x5a2c14[_0xd69c('0x31')][_0xd69c('0x34')]?_0x5a2c14[_0xd69c('0x31')]:_0x2a3bc1[_0xd69c('0x2d')];if(!_0x38eedb[_0xd69c('0x2e')][_0xd69c('0x35')]('nolimit')){_0x5a2c14[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x38eedb[_0xd69c('0x2e')]['limit']);_0x5a2c14[_0xd69c('0x1b')]=qs[_0xd69c('0x1b')](_0x38eedb[_0xd69c('0x2e')][_0xd69c('0x1b')]);}_0x5a2c14['order']=qs['sort'](_0x38eedb[_0xd69c('0x2e')][_0xd69c('0x37')]);_0x5a2c14[_0xd69c('0x3b')]=qs[_0xd69c('0x30')](_['pick'](_0x38eedb['query'],_0x2a3bc1[_0xd69c('0x30')]));_0x5a2c14[_0xd69c('0x3b')][_0xd69c('0x55')]=_0x1a0626['id'];if(_0x38eedb[_0xd69c('0x2e')]['filter']){_0x5a2c14[_0xd69c('0x3b')]=_[_0xd69c('0x3a')](_0x5a2c14[_0xd69c('0x3b')],{'$or':_[_0xd69c('0x29')](_0x5a2c14[_0xd69c('0x31')],function(_0x79c2ef){var _0x18f393={};_0x18f393[_0x79c2ef]={'$like':'%'+_0x38eedb['query'][_0xd69c('0x39')]+'%'};return _0x18f393;})});}_0x5a2c14=_['merge']({},_0x5a2c14,_0x38eedb[_0xd69c('0x3d')]);return db[_0xd69c('0x5c')][_0xd69c('0x1c')]({'where':_0x5a2c14[_0xd69c('0x3b')]})[_0xd69c('0x20')](function(_0xf15126){_0xe519e7[_0xd69c('0x1c')]=_0xf15126;if(_0x38eedb[_0xd69c('0x2e')]['includeAll']){_0x5a2c14[_0xd69c('0x41')]=[{'all':!![]}];}return db[_0xd69c('0x5c')][_0xd69c('0x57')](_0x5a2c14);})[_0xd69c('0x20')](function(_0x1723eb){_0xe519e7[_0xd69c('0x58')]=_0x1723eb;return _0xe519e7;});}})[_0xd69c('0x20')](respondWithFilteredResult(_0x3608cb,_0x5a2c14))[_0xd69c('0x43')](handleError(_0x3608cb,null));};exports[_0xd69c('0x5d')]=function(_0x27db0a,_0x3e3bb3,_0x509b17){var _0xde2c6c={'raw':!![],'where':{}};var _0x54e5a4={};var _0xb2a30f={'count':0x0,'rows':[]};return db[_0xd69c('0x3e')][_0xd69c('0x53')]({'where':{'id':_0x27db0a[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x3e3bb3,null))[_0xd69c('0x20')](function(_0x411518){if(_0x411518){_0x54e5a4[_0xd69c('0x2d')]=_[_0xd69c('0x2f')](db[_0xd69c('0x5e')][_0xd69c('0x2a')]);_0x54e5a4['query']=_[_0xd69c('0x2f')](_0x27db0a[_0xd69c('0x2e')]);_0x54e5a4[_0xd69c('0x30')]=_['intersection'](_0x54e5a4[_0xd69c('0x2d')],_0x54e5a4[_0xd69c('0x2e')]);_0xde2c6c[_0xd69c('0x31')]=_[_0xd69c('0x32')](_0x54e5a4[_0xd69c('0x2d')],qs['fields'](_0x27db0a[_0xd69c('0x2e')][_0xd69c('0x33')]));_0xde2c6c['attributes']=_0xde2c6c['attributes'][_0xd69c('0x34')]?_0xde2c6c[_0xd69c('0x31')]:_0x54e5a4[_0xd69c('0x2d')];if(!_0x27db0a[_0xd69c('0x2e')][_0xd69c('0x35')]('nolimit')){_0xde2c6c[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x27db0a[_0xd69c('0x2e')][_0xd69c('0x1a')]);_0xde2c6c[_0xd69c('0x1b')]=qs['offset'](_0x27db0a['query'][_0xd69c('0x1b')]);}_0xde2c6c[_0xd69c('0x36')]=qs[_0xd69c('0x37')](_0x27db0a[_0xd69c('0x2e')]['sort']);_0xde2c6c[_0xd69c('0x3b')]=qs[_0xd69c('0x30')](_[_0xd69c('0x38')](_0x27db0a['query'],_0x54e5a4[_0xd69c('0x30')]));_0xde2c6c[_0xd69c('0x3b')][_0xd69c('0x55')]=_0x411518['id'];if(_0x27db0a[_0xd69c('0x2e')][_0xd69c('0x39')]){_0xde2c6c[_0xd69c('0x3b')]=_[_0xd69c('0x3a')](_0xde2c6c[_0xd69c('0x3b')],{'$or':_[_0xd69c('0x29')](_0xde2c6c[_0xd69c('0x31')],function(_0x317668){var _0x24967b={};_0x24967b[_0x317668]={'$like':'%'+_0x27db0a['query']['filter']+'%'};return _0x24967b;})});}_0xde2c6c=_['merge']({},_0xde2c6c,_0x27db0a[_0xd69c('0x3d')]);return db[_0xd69c('0x5e')][_0xd69c('0x1c')]({'where':_0xde2c6c[_0xd69c('0x3b')]})[_0xd69c('0x20')](function(_0x3e0652){_0xb2a30f[_0xd69c('0x1c')]=_0x3e0652;if(_0x27db0a[_0xd69c('0x2e')][_0xd69c('0x40')]){_0xde2c6c[_0xd69c('0x41')]=[{'all':!![]}];}return db[_0xd69c('0x5e')][_0xd69c('0x57')](_0xde2c6c);})[_0xd69c('0x20')](function(_0x4c6c0a){_0xb2a30f['rows']=_0x4c6c0a;return _0xb2a30f;});}})[_0xd69c('0x20')](respondWithFilteredResult(_0x3e3bb3,_0xde2c6c))[_0xd69c('0x43')](handleError(_0x3e3bb3,null));};exports[_0xd69c('0x5f')]=function(_0x4da491,_0x40db1f,_0x36c402){var _0x2bc95b={};var _0x2558ad={};var _0x4e57f2;var _0x343204;return db[_0xd69c('0x3e')][_0xd69c('0x53')]({'where':{'id':_0x4da491[_0xd69c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x40db1f,null))[_0xd69c('0x20')](function(_0x77edbe){if(_0x77edbe){_0x4e57f2=_0x77edbe;_0x2558ad[_0xd69c('0x2d')]=_['keys'](db[_0xd69c('0x60')][_0xd69c('0x2a')]);_0x2558ad[_0xd69c('0x2e')]=_[_0xd69c('0x2f')](_0x4da491[_0xd69c('0x2e')]);_0x2558ad[_0xd69c('0x30')]=_['intersection'](_0x2558ad[_0xd69c('0x2d')],_0x2558ad[_0xd69c('0x2e')]);_0x2bc95b['attributes']=_['intersection'](_0x2558ad[_0xd69c('0x2d')],qs[_0xd69c('0x33')](_0x4da491[_0xd69c('0x2e')][_0xd69c('0x33')]));_0x2bc95b[_0xd69c('0x31')]=_0x2bc95b[_0xd69c('0x31')]['length']?_0x2bc95b[_0xd69c('0x31')]:_0x2558ad[_0xd69c('0x2d')];_0x2bc95b[_0xd69c('0x36')]=qs['sort'](_0x4da491[_0xd69c('0x2e')][_0xd69c('0x37')]);_0x2bc95b[_0xd69c('0x3b')]=qs[_0xd69c('0x30')](_[_0xd69c('0x38')](_0x4da491[_0xd69c('0x2e')],_0x2558ad[_0xd69c('0x30')]));if(_0x4da491[_0xd69c('0x2e')][_0xd69c('0x39')]){_0x2bc95b[_0xd69c('0x3b')]=_['merge'](_0x2bc95b['where'],{'$or':_[_0xd69c('0x29')](_0x2bc95b[_0xd69c('0x31')],function(_0x5c0ade){var _0x1c33f1={};_0x1c33f1[_0x5c0ade]={'$like':'%'+_0x4da491['query'][_0xd69c('0x39')]+'%'};return _0x1c33f1;})});}_0x2bc95b=_[_0xd69c('0x3a')]({},_0x2bc95b,_0x4da491[_0xd69c('0x3d')]);return _0x4e57f2['getLists'](_0x2bc95b);}})[_0xd69c('0x20')](function(_0x502c50){if(_0x502c50){_0x343204=_0x502c50['length'];if(!_0x4da491[_0xd69c('0x2e')][_0xd69c('0x35')](_0xd69c('0x54'))){_0x2bc95b[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x4da491[_0xd69c('0x2e')][_0xd69c('0x1a')]);_0x2bc95b[_0xd69c('0x1b')]=qs[_0xd69c('0x1b')](_0x4da491[_0xd69c('0x2e')]['offset']);}return _0x4e57f2[_0xd69c('0x5f')](_0x2bc95b);}})[_0xd69c('0x20')](function(_0x39606f){if(_0x39606f){return _0x39606f?{'count':_0x343204,'rows':_0x39606f}:null;}})[_0xd69c('0x20')](respondWithResult(_0x40db1f,null))[_0xd69c('0x43')](handleError(_0x40db1f,null));};exports[_0xd69c('0x61')]=function(_0x3064f7,_0x1b45e4,_0x192b9b){var _0x307bd4,_0x2ef17e;return db['Campaign'][_0xd69c('0x42')]({'where':{'id':_0x3064f7[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x1b45e4,null))['then'](function(_0x3eab92){if(_0x3eab92){_0x2ef17e=_0x3eab92;return _0x3eab92[_0xd69c('0x61')](_0x3064f7[_0xd69c('0x45')][_0xd69c('0x62')],_[_0xd69c('0x4e')](_0x3064f7[_0xd69c('0x45')],[_0xd69c('0x62'),'id'])||{});}return null;})[_0xd69c('0x63')](function(_0xb5bbc){var _0x289892;_0x307bd4=_0xb5bbc||[];var _0x1b7104=[];if(_0xb5bbc){for(var _0x50d10a=0x0;_0x50d10a<_0xb5bbc[_0xd69c('0x34')];_0x50d10a+=0x1){var _0x30ef82=_0xb5bbc[_0x50d10a]['get']({'plain':!![]});_0x2ef17e[_0xd69c('0x64')]=_0x3064f7[_0xd69c('0x45')][_0xd69c('0x64')]?_0x3064f7[_0xd69c('0x45')]['dialCheckDuplicateType']:_0x2ef17e[_0xd69c('0x64')];switch(_0x2ef17e[_0xd69c('0x64')]){case'always':_0x289892=squel[_0xd69c('0x65')]()[_0xd69c('0x66')](_0xd69c('0x67'))[_0xd69c('0x68')]([_0xd69c('0x69'),_0xd69c('0x6a'),_0xd69c('0x6b'),_0xd69c('0x6c'),_0xd69c('0x55'),_0xd69c('0x4f'),_0xd69c('0x50')],squel[_0xd69c('0x6d')]()['field'](_0xd69c('0x69'),_0xd69c('0x69'))[_0xd69c('0x6e')]('NOW()',_0xd69c('0x6a'))[_0xd69c('0x6e')]('id','ContactId')[_0xd69c('0x6e')](_0x30ef82[_0xd69c('0x6f')][_0xd69c('0x70')](),_0xd69c('0x6c'))['field'](_0x3064f7['params']['id'][_0xd69c('0x70')](),_0xd69c('0x55'))[_0xd69c('0x6e')](_0xd69c('0x71'),_0xd69c('0x4f'))[_0xd69c('0x6e')]('NOW()',_0xd69c('0x50'))[_0xd69c('0x72')](_0xd69c('0x73'))[_0xd69c('0x3b')](_0xd69c('0x74'))['where'](_0xd69c('0x75'),_0x30ef82[_0xd69c('0x6f')]['toString']())[_0xd69c('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0xd69c('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd69c('0x6d')]()[_0xd69c('0x6e')](_0xd69c('0x76'))[_0xd69c('0x72')](_0xd69c('0x77'))[_0xd69c('0x3b')](_0xd69c('0x78'),_0x3064f7[_0xd69c('0x3f')]['id'][_0xd69c('0x70')]()))[_0xd69c('0x3b')](_0xd69c('0x79'),squel[_0xd69c('0x6d')]()['field'](_0xd69c('0x7a'))[_0xd69c('0x72')](_0xd69c('0x67'))[_0xd69c('0x3b')](_0xd69c('0x78'),_0x3064f7[_0xd69c('0x3f')]['id'][_0xd69c('0x70')]())))[_0xd69c('0x70')]();break;case _0xd69c('0x7b'):_0x289892=squel['insert']()[_0xd69c('0x66')]('cm_hopper')[_0xd69c('0x68')]([_0xd69c('0x69'),'scheduledAt','ContactId',_0xd69c('0x6c'),_0xd69c('0x55'),_0xd69c('0x4f'),'updatedAt'],squel[_0xd69c('0x6d')]()[_0xd69c('0x6e')](_0xd69c('0x69'),_0xd69c('0x69'))[_0xd69c('0x6e')]('NOW()',_0xd69c('0x6a'))['field']('id',_0xd69c('0x6b'))[_0xd69c('0x6e')](_0x30ef82[_0xd69c('0x6f')][_0xd69c('0x70')](),_0xd69c('0x6c'))[_0xd69c('0x6e')](_0x3064f7[_0xd69c('0x3f')]['id']['toString'](),_0xd69c('0x55'))[_0xd69c('0x6e')]('NOW()',_0xd69c('0x4f'))['field'](_0xd69c('0x71'),_0xd69c('0x50'))[_0xd69c('0x72')](_0xd69c('0x73'))[_0xd69c('0x3b')](_0xd69c('0x74'))[_0xd69c('0x3b')]('ListId\x20=\x20?',_0x30ef82[_0xd69c('0x6f')][_0xd69c('0x70')]())['where'](_0xd69c('0x7c'))[_0xd69c('0x3b')](_0xd69c('0x79'),squel[_0xd69c('0x6d')]()[_0xd69c('0x6e')](_0xd69c('0x7a'))[_0xd69c('0x72')](_0xd69c('0x67'))[_0xd69c('0x3b')]('CampaignId\x20=\x20?',_0x3064f7[_0xd69c('0x3f')]['id'][_0xd69c('0x70')]())))['toString']();break;default:_0x289892=squel['insert']()[_0xd69c('0x66')]('cm_hopper')[_0xd69c('0x68')]([_0xd69c('0x69'),_0xd69c('0x6a'),_0xd69c('0x6b'),_0xd69c('0x6c'),_0xd69c('0x55'),'createdAt',_0xd69c('0x50')],squel[_0xd69c('0x6d')]()['field'](_0xd69c('0x69'),_0xd69c('0x69'))['field'](_0xd69c('0x71'),_0xd69c('0x6a'))[_0xd69c('0x6e')]('id',_0xd69c('0x6b'))[_0xd69c('0x6e')](_0x30ef82[_0xd69c('0x6f')]['toString'](),_0xd69c('0x6c'))['field'](_0x3064f7[_0xd69c('0x3f')]['id'][_0xd69c('0x70')](),_0xd69c('0x55'))[_0xd69c('0x6e')](_0xd69c('0x71'),_0xd69c('0x4f'))[_0xd69c('0x6e')](_0xd69c('0x71'),_0xd69c('0x50'))['from'](_0xd69c('0x73'))['where'](_0xd69c('0x74'))['where'](_0xd69c('0x75'),_0x30ef82[_0xd69c('0x6f')][_0xd69c('0x70')]())[_0xd69c('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0xd69c('0x70')]();}_0x1b7104[_0xd69c('0x7d')](db[_0xd69c('0x7e')][_0xd69c('0x2e')](_0x289892));}return BPromise[_0xd69c('0x7f')](_0x1b7104);}})[_0xd69c('0x20')](function(){return _0x307bd4;})[_0xd69c('0x20')](respondWithResult(_0x1b45e4,null))[_0xd69c('0x43')](handleError(_0x1b45e4,null));};exports[_0xd69c('0x80')]=function(_0x59887c,_0x4adfe2,_0x5b5cf7){return db['Campaign']['find']({'where':{'id':_0x59887c[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x4adfe2,null))['then'](function(_0x32c695){if(_0x32c695){return _0x32c695[_0xd69c('0x80')](_0x59887c['query'][_0xd69c('0x62')]);}})[_0xd69c('0x20')](function(_0x1c0841){if(_0x1c0841){return db['CmHopper'][_0xd69c('0x21')]({'where':{'ListId':_0x59887c[_0xd69c('0x2e')][_0xd69c('0x62')],'CampaignId':_0x59887c[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](function(){return _0x1c0841;});}})['then'](respondWithStatusCode(_0x4adfe2,null))[_0xd69c('0x43')](handleError(_0x4adfe2,null));};exports[_0xd69c('0x81')]=function(_0x29fc1a,_0xf350a8,_0x3d0cbd){var _0x2bbeaa={};var _0x19832b={};var _0x3b841f;var _0x49ccb3;return db[_0xd69c('0x3e')][_0xd69c('0x53')]({'where':{'id':_0x29fc1a['params']['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0xf350a8,null))[_0xd69c('0x20')](function(_0x4565de){if(_0x4565de){_0x3b841f=_0x4565de;_0x19832b[_0xd69c('0x2d')]=_[_0xd69c('0x2f')](db['CmList'][_0xd69c('0x2a')]);_0x19832b[_0xd69c('0x2e')]=_[_0xd69c('0x2f')](_0x29fc1a['query']);_0x19832b[_0xd69c('0x30')]=_[_0xd69c('0x32')](_0x19832b['model'],_0x19832b[_0xd69c('0x2e')]);_0x2bbeaa[_0xd69c('0x31')]=_[_0xd69c('0x32')](_0x19832b['model'],qs[_0xd69c('0x33')](_0x29fc1a[_0xd69c('0x2e')][_0xd69c('0x33')]));_0x2bbeaa[_0xd69c('0x31')]=_0x2bbeaa[_0xd69c('0x31')]['length']?_0x2bbeaa['attributes']:_0x19832b[_0xd69c('0x2d')];_0x2bbeaa[_0xd69c('0x36')]=qs[_0xd69c('0x37')](_0x29fc1a[_0xd69c('0x2e')]['sort']);_0x2bbeaa['where']=qs[_0xd69c('0x30')](_[_0xd69c('0x38')](_0x29fc1a[_0xd69c('0x2e')],_0x19832b[_0xd69c('0x30')]));if(_0x29fc1a[_0xd69c('0x2e')][_0xd69c('0x39')]){_0x2bbeaa['where']=_[_0xd69c('0x3a')](_0x2bbeaa[_0xd69c('0x3b')],{'$or':_['map'](_0x2bbeaa['attributes'],function(_0x268edf){var _0x208e25={};_0x208e25[_0x268edf]={'$like':'%'+_0x29fc1a[_0xd69c('0x2e')][_0xd69c('0x39')]+'%'};return _0x208e25;})});}_0x2bbeaa=_[_0xd69c('0x3a')]({},_0x2bbeaa,_0x29fc1a[_0xd69c('0x3d')]);return _0x3b841f[_0xd69c('0x81')](_0x2bbeaa);}})['then'](function(_0x169b9f){if(_0x169b9f){_0x49ccb3=_0x169b9f[_0xd69c('0x34')];if(!_0x29fc1a[_0xd69c('0x2e')][_0xd69c('0x35')](_0xd69c('0x54'))){_0x2bbeaa[_0xd69c('0x1a')]=qs[_0xd69c('0x1a')](_0x29fc1a['query'][_0xd69c('0x1a')]);_0x2bbeaa[_0xd69c('0x1b')]=qs[_0xd69c('0x1b')](_0x29fc1a[_0xd69c('0x2e')][_0xd69c('0x1b')]);}return _0x3b841f[_0xd69c('0x81')](_0x2bbeaa);}})[_0xd69c('0x20')](function(_0x1f4f7f){if(_0x1f4f7f){return _0x1f4f7f?{'count':_0x49ccb3,'rows':_0x1f4f7f}:null;}})[_0xd69c('0x20')](respondWithResult(_0xf350a8,null))[_0xd69c('0x43')](handleError(_0xf350a8,null));};exports[_0xd69c('0x82')]=function(_0x3c5571,_0x2fa41e,_0x5ebf7b){var _0x5a6f77,_0x940df9;return db['Campaign'][_0xd69c('0x42')]({'where':{'id':_0x3c5571[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x2fa41e,null))[_0xd69c('0x20')](function(_0x267b8e){if(_0x267b8e){_0x940df9=_0x267b8e;return _0x267b8e[_0xd69c('0x82')](_0x3c5571[_0xd69c('0x45')][_0xd69c('0x62')],_[_0xd69c('0x4e')](_0x3c5571[_0xd69c('0x45')],[_0xd69c('0x62'),'id'])||{});}return null;})['spread'](function(_0x121be9){var _0xb9f4e2;_0x5a6f77=_0x121be9||[];var _0x4f6868=[];if(_0x121be9){for(var _0x36debc=0x0;_0x36debc<_0x121be9['length'];_0x36debc+=0x1){var _0xcdbfd3=_0x121be9[_0x36debc][_0xd69c('0x22')]({'plain':!![]});_0xb9f4e2=squel['insert']()[_0xd69c('0x66')](_0xd69c('0x83'))[_0xd69c('0x68')]([_0xd69c('0x69'),_0xd69c('0x6b'),_0xd69c('0x6c'),_0xd69c('0x55'),_0xd69c('0x4f'),_0xd69c('0x50')],squel[_0xd69c('0x6d')]()[_0xd69c('0x6e')](_0xd69c('0x69'),_0xd69c('0x69'))[_0xd69c('0x6e')]('id',_0xd69c('0x6b'))[_0xd69c('0x6e')](_0xcdbfd3['CmListId']['toString'](),_0xd69c('0x6c'))[_0xd69c('0x6e')](_0x3c5571['params']['id'][_0xd69c('0x70')](),_0xd69c('0x55'))[_0xd69c('0x6e')](_0xd69c('0x71'),'createdAt')['field'](_0xd69c('0x71'),'updatedAt')[_0xd69c('0x72')](_0xd69c('0x73'))[_0xd69c('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xd69c('0x75'),_0xcdbfd3[_0xd69c('0x6f')][_0xd69c('0x70')]())[_0xd69c('0x3b')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x4f6868[_0xd69c('0x7d')](db['sequelize']['query'](_0xb9f4e2));}return BPromise[_0xd69c('0x7f')](_0x4f6868);}})[_0xd69c('0x20')](function(){return _0x5a6f77;})['then'](respondWithResult(_0x2fa41e,null))['catch'](handleError(_0x2fa41e,null));};exports['removeBlackLists']=function(_0x9ace3c,_0x1985aa,_0x7fba43){return db[_0xd69c('0x3e')][_0xd69c('0x42')]({'where':{'id':_0x9ace3c[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](handleEntityNotFound(_0x1985aa,null))['then'](function(_0x143376){if(_0x143376){return _0x143376[_0xd69c('0x84')](_0x9ace3c[_0xd69c('0x2e')][_0xd69c('0x62')]);}})['then'](function(_0x252189){if(_0x252189){return db[_0xd69c('0x5e')][_0xd69c('0x21')]({'where':{'ListId':_0x9ace3c[_0xd69c('0x2e')][_0xd69c('0x62')],'CampaignId':_0x9ace3c[_0xd69c('0x3f')]['id']}})[_0xd69c('0x20')](function(){return _0x252189;});}})[_0xd69c('0x20')](respondWithStatusCode(_0x1985aa,null))[_0xd69c('0x43')](handleError(_0x1985aa,null));}; \ No newline at end of file +var _0x0cef=['moment','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/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','IvrCampaigns','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','update','getHoppers','findOne','CmHopper','hasOwnProperty','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','addLists','ids','omit','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ListId','select','NOW()','field','ContactId','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','fromQuery','deletedAt\x20IS\x20NULL','sequelize','all','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','zip-dir','request-promise'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x0cef,0x18c));var _0xf0ce=function(_0x329fac,_0x43b216){_0x329fac=_0x329fac-0x0;var _0x42b353=_0x0cef[_0x329fac];return _0x42b353;};'use strict';var emlformat=require(_0xf0ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ce('0x2'));var moment=require(_0xf0ce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ce('0x4'));var util=require(_0xf0ce('0x5'));var path=require('path');var sox=require(_0xf0ce('0x6'));var csv=require(_0xf0ce('0x7'));var ejs=require(_0xf0ce('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ce('0x9'));var _=require('lodash');var squel=require(_0xf0ce('0xa'));var crypto=require(_0xf0ce('0xb'));var jsforce=require(_0xf0ce('0xc'));var deskjs=require(_0xf0ce('0xd'));var toCsv=require(_0xf0ce('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ce('0xe'));var Redis=require(_0xf0ce('0xf'));var authService=require(_0xf0ce('0x10'));var qs=require(_0xf0ce('0x11'));var as=require(_0xf0ce('0x12'));var hardwareService=require(_0xf0ce('0x13'));var logger=require(_0xf0ce('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf0ce('0x15'));var licenseUtil=require(_0xf0ce('0x16'));var db=require(_0xf0ce('0x17'))['db'];function respondWithStatusCode(_0x4c601e,_0x181a73){_0x181a73=_0x181a73||0xcc;return function(_0x480cf0){if(_0x480cf0){return _0x4c601e[_0xf0ce('0x18')](_0x181a73);}return _0x4c601e[_0xf0ce('0x19')](_0x181a73)['end']();};}function respondWithResult(_0x49ea92,_0x309918){_0x309918=_0x309918||0xc8;return function(_0xa3c5e0){if(_0xa3c5e0){return _0x49ea92[_0xf0ce('0x19')](_0x309918)[_0xf0ce('0x1a')](_0xa3c5e0);}};}function respondWithFilteredResult(_0x2b9a83,_0x238af2){return function(_0x3b383a){if(_0x3b383a){var _0x5a4a55=typeof _0x238af2[_0xf0ce('0x1b')]===_0xf0ce('0x1c')&&typeof _0x238af2[_0xf0ce('0x1d')]===_0xf0ce('0x1c');var _0x5751f4=_0x3b383a[_0xf0ce('0x1e')];var _0x19d346=_0x5a4a55?0x0:_0x238af2[_0xf0ce('0x1b')];var _0xa9e0f6=_0x5a4a55?_0x3b383a[_0xf0ce('0x1e')]:_0x238af2[_0xf0ce('0x1b')]+_0x238af2['limit'];var _0x2fea94;if(_0xa9e0f6>=_0x5751f4){_0xa9e0f6=_0x5751f4;_0x2fea94=0xc8;}else{_0x2fea94=0xce;}_0x2b9a83[_0xf0ce('0x19')](_0x2fea94);return _0x2b9a83[_0xf0ce('0x1f')]('Content-Range',_0x19d346+'-'+_0xa9e0f6+'/'+_0x5751f4)[_0xf0ce('0x1a')](_0x3b383a);}return null;};}function patchUpdates(_0x25dcad){return function(_0x311e65){try{jsonpatch[_0xf0ce('0x20')](_0x311e65,_0x25dcad,!![]);}catch(_0x47a4e3){return BPromise[_0xf0ce('0x21')](_0x47a4e3);}return _0x311e65[_0xf0ce('0x22')]();};}function saveUpdates(_0x31016c,_0x33c75c){return function(_0x46314b){if(_0x46314b){return _0x46314b['update'](_0x31016c)[_0xf0ce('0x23')](function(_0x3fb6f7){return _0x3fb6f7;});}return null;};}function removeEntity(_0x3b4af7,_0x41fe71){return function(_0xa0d91){if(_0xa0d91){return _0xa0d91[_0xf0ce('0x24')]()[_0xf0ce('0x23')](function(){var _0x4753d4=_0xa0d91['get']({'plain':!![]});var _0x85647=_0xf0ce('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x85647,'resourceId':_0x4753d4['id']}})['then'](function(){return _0xa0d91;});})[_0xf0ce('0x23')](function(){_0x3b4af7[_0xf0ce('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fe8d,_0xedb5d2){return function(_0x49170f){if(!_0x49170f){_0x12fe8d['sendStatus'](0x194);}return _0x49170f;};}function handleError(_0x295a4d,_0x3a8a35){_0x3a8a35=_0x3a8a35||0x1f4;return function(_0x1e5c55){logger['error'](_0x1e5c55['stack']);if(_0x1e5c55[_0xf0ce('0x26')]){delete _0x1e5c55[_0xf0ce('0x26')];}_0x295a4d[_0xf0ce('0x19')](_0x3a8a35)[_0xf0ce('0x27')](_0x1e5c55);};}exports['index']=function(_0x50ed91,_0x8aeb90){var _0x462697={},_0x28889d={},_0x436700={'count':0x0,'rows':[]};var _0x350d90=_[_0xf0ce('0x28')](db['Campaign'][_0xf0ce('0x29')],function(_0x3baa92){return{'name':_0x3baa92[_0xf0ce('0x2a')],'type':_0x3baa92[_0xf0ce('0x2b')]['key']};});_0x28889d['model']=_[_0xf0ce('0x28')](_0x350d90,_0xf0ce('0x26'));_0x28889d[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x50ed91[_0xf0ce('0x2c')]);_0x28889d[_0xf0ce('0x2e')]=_[_0xf0ce('0x2f')](_0x28889d[_0xf0ce('0x30')],_0x28889d[_0xf0ce('0x2c')]);_0x462697[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x28889d['model'],qs['fields'](_0x50ed91['query'][_0xf0ce('0x32')]));_0x462697['attributes']=_0x462697[_0xf0ce('0x31')][_0xf0ce('0x33')]?_0x462697[_0xf0ce('0x31')]:_0x28889d['model'];if(!_0x50ed91[_0xf0ce('0x2c')]['hasOwnProperty'](_0xf0ce('0x34'))){_0x462697['limit']=qs[_0xf0ce('0x1d')](_0x50ed91[_0xf0ce('0x2c')][_0xf0ce('0x1d')]);_0x462697[_0xf0ce('0x1b')]=qs[_0xf0ce('0x1b')](_0x50ed91['query'][_0xf0ce('0x1b')]);}_0x462697[_0xf0ce('0x35')]=qs['sort'](_0x50ed91['query'][_0xf0ce('0x36')]);_0x462697[_0xf0ce('0x37')]=qs[_0xf0ce('0x2e')](_[_0xf0ce('0x38')](_0x50ed91[_0xf0ce('0x2c')],_0x28889d[_0xf0ce('0x2e')]),_0x350d90);if(_0x50ed91['query'][_0xf0ce('0x39')]){_0x462697[_0xf0ce('0x37')]=_[_0xf0ce('0x3a')](_0x462697['where'],{'$or':_[_0xf0ce('0x28')](_0x350d90,function(_0x3a8937){if(_0x3a8937[_0xf0ce('0x2b')]!=='VIRTUAL'){var _0x12e76a={};_0x12e76a[_0x3a8937[_0xf0ce('0x26')]]={'$like':'%'+_0x50ed91[_0xf0ce('0x2c')][_0xf0ce('0x39')]+'%'};return _0x12e76a;}})});}_0x462697=_['merge']({},_0x462697,_0x50ed91[_0xf0ce('0x3b')]);var _0x3883d5={'where':_0x462697[_0xf0ce('0x37')]};return db[_0xf0ce('0x3c')][_0xf0ce('0x1e')](_0x3883d5)[_0xf0ce('0x23')](function(_0x23a7e6){_0x436700[_0xf0ce('0x1e')]=_0x23a7e6;if(_0x50ed91[_0xf0ce('0x2c')][_0xf0ce('0x3d')]){_0x462697[_0xf0ce('0x3e')]=[{'all':!![]}];}return db[_0xf0ce('0x3c')][_0xf0ce('0x3f')](_0x462697);})['then'](function(_0x56d459){_0x436700[_0xf0ce('0x40')]=_0x56d459;return _0x436700;})[_0xf0ce('0x23')](respondWithFilteredResult(_0x8aeb90,_0x462697))[_0xf0ce('0x41')](handleError(_0x8aeb90,null));};exports['show']=function(_0x279637,_0x56a579){var _0x4faeef={'raw':![],'where':{'id':_0x279637[_0xf0ce('0x42')]['id']}},_0x2a4c81={};_0x2a4c81[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db[_0xf0ce('0x3c')][_0xf0ce('0x29')]);_0x2a4c81[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x279637['query']);_0x2a4c81[_0xf0ce('0x2e')]=_[_0xf0ce('0x2f')](_0x2a4c81[_0xf0ce('0x30')],_0x2a4c81[_0xf0ce('0x2c')]);_0x4faeef[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x2a4c81[_0xf0ce('0x30')],qs[_0xf0ce('0x32')](_0x279637[_0xf0ce('0x2c')][_0xf0ce('0x32')]));_0x4faeef[_0xf0ce('0x31')]=_0x4faeef['attributes']['length']?_0x4faeef[_0xf0ce('0x31')]:_0x2a4c81[_0xf0ce('0x30')];if(_0x279637['query'][_0xf0ce('0x3d')]){_0x4faeef[_0xf0ce('0x3e')]=[{'all':!![]}];}_0x4faeef=_[_0xf0ce('0x3a')]({},_0x4faeef,_0x279637['options']);return db[_0xf0ce('0x3c')][_0xf0ce('0x43')](_0x4faeef)[_0xf0ce('0x23')](handleEntityNotFound(_0x56a579,null))[_0xf0ce('0x23')](respondWithResult(_0x56a579,null))[_0xf0ce('0x41')](handleError(_0x56a579,null));};exports[_0xf0ce('0x44')]=function(_0xbbe2d6,_0x200aef){return db[_0xf0ce('0x3c')][_0xf0ce('0x44')](_0xbbe2d6[_0xf0ce('0x45')],{})['then'](function(_0xe6a51e){var _0x17ce38=_0xbbe2d6[_0xf0ce('0x46')]['get']({'plain':!![]});if(!_0x17ce38)throw new Error(_0xf0ce('0x47'));if(_0x17ce38[_0xf0ce('0x48')]==='user'){var _0x57c51e=_0xe6a51e[_0xf0ce('0x49')]({'plain':!![]});var _0x2c5a10=_0xf0ce('0x25');return db[_0xf0ce('0x4a')]['find']({'where':{'name':_0x2c5a10,'userProfileId':_0x17ce38[_0xf0ce('0x4b')]},'raw':!![]})[_0xf0ce('0x23')](function(_0x295196){if(_0x295196&&_0x295196[_0xf0ce('0x4c')]===0x0){return db[_0xf0ce('0x4d')]['create']({'name':_0x57c51e[_0xf0ce('0x26')],'resourceId':_0x57c51e['id'],'type':_0x295196[_0xf0ce('0x26')],'sectionId':_0x295196['id']},{})[_0xf0ce('0x23')](function(){return _0xe6a51e;});}else{return _0xe6a51e;}})[_0xf0ce('0x41')](function(_0x4503fb){logger[_0xf0ce('0x4e')](_0xf0ce('0x4f'),_0x4503fb);throw _0x4503fb;});}return _0xe6a51e;})[_0xf0ce('0x23')](respondWithResult(_0x200aef,0xc9))[_0xf0ce('0x41')](handleError(_0x200aef,null));};exports[_0xf0ce('0x50')]=function(_0x5cc436,_0x1a5ca1){var _0x22a453={'where':{'id':_0x5cc436[_0xf0ce('0x42')]['id']}},_0x22c612={};_0x22c612['model']=_[_0xf0ce('0x2d')](db[_0xf0ce('0x3c')][_0xf0ce('0x29')]);_0x22a453[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x22c612['model'],qs[_0xf0ce('0x32')](_0x5cc436[_0xf0ce('0x2c')][_0xf0ce('0x32')]));_0x22a453['attributes']=_0x22a453[_0xf0ce('0x31')][_0xf0ce('0x33')]?_0x22a453[_0xf0ce('0x31')]:_0x22c612[_0xf0ce('0x30')];if(_0x5cc436['query']['includeAll']){_0x22a453['include']=[{'all':!![]}];}_0x22a453=_[_0xf0ce('0x3a')]({},_0x22a453,_0x5cc436[_0xf0ce('0x3b')]);return db[_0xf0ce('0x3c')][_0xf0ce('0x43')](_0x22a453)[_0xf0ce('0x23')](handleEntityNotFound(_0x1a5ca1,null))[_0xf0ce('0x23')](function(_0x584b6e){if(_0x584b6e){var _0x1588a3=_0x584b6e[_0xf0ce('0x49')]({'plain':!![]});_0x1588a3=qs['omit'](_0x1588a3,['id',_0xf0ce('0x51'),'updatedAt']);_0x5cc436['body']=_['omit'](_0x5cc436[_0xf0ce('0x45')],['id','createdAt',_0xf0ce('0x52')]);return db[_0xf0ce('0x3c')][_0xf0ce('0x44')](_[_0xf0ce('0x3a')](_0x1588a3,_0x5cc436[_0xf0ce('0x45')]),{'include':_0x5cc436['query']['includeAll']?[{'all':!![]}]:undefined})[_0xf0ce('0x23')](function(_0x7d135f){var _0xe5d3c3=_0x5cc436['user']['get']({'plain':!![]});if(!_0xe5d3c3)throw new Error(_0xf0ce('0x47'));if(_0xe5d3c3['role']===_0xf0ce('0x46')){var _0x2ee2d6=_0x7d135f[_0xf0ce('0x49')]({'plain':!![]});var _0xa70ba6='IvrCampaigns';return db[_0xf0ce('0x4a')][_0xf0ce('0x43')]({'where':{'name':_0xa70ba6,'userProfileId':_0xe5d3c3[_0xf0ce('0x4b')]},'raw':!![]})[_0xf0ce('0x23')](function(_0x5b5712){if(_0x5b5712&&_0x5b5712['autoAssociation']===0x0){return db[_0xf0ce('0x4d')][_0xf0ce('0x44')]({'name':_0x2ee2d6[_0xf0ce('0x26')],'resourceId':_0x2ee2d6['id'],'type':_0x5b5712[_0xf0ce('0x26')],'sectionId':_0x5b5712['id']},{})['then'](function(){return _0x7d135f;});}else{return _0x7d135f;}})[_0xf0ce('0x41')](function(_0x1da3bc){logger[_0xf0ce('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1da3bc);throw _0x1da3bc;});}return _0x7d135f;});}})[_0xf0ce('0x23')](respondWithResult(_0x1a5ca1,0xc9))[_0xf0ce('0x41')](handleError(_0x1a5ca1,null));};exports[_0xf0ce('0x53')]=function(_0x3c3810,_0x2a32ce){if(_0x3c3810[_0xf0ce('0x45')]['id']){delete _0x3c3810[_0xf0ce('0x45')]['id'];}return db[_0xf0ce('0x3c')][_0xf0ce('0x43')]({'where':{'id':_0x3c3810[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x2a32ce,null))[_0xf0ce('0x23')](saveUpdates(_0x3c3810[_0xf0ce('0x45')],null))[_0xf0ce('0x23')](respondWithResult(_0x2a32ce,null))[_0xf0ce('0x41')](handleError(_0x2a32ce,null));};exports[_0xf0ce('0x24')]=function(_0x417c9c,_0x29b4da){return db[_0xf0ce('0x3c')]['find']({'where':{'id':_0x417c9c['params']['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x29b4da,null))[_0xf0ce('0x23')](removeEntity(_0x29b4da,null))['catch'](handleError(_0x29b4da,null));};exports[_0xf0ce('0x54')]=function(_0x4e8c5b,_0x41989e,_0x2b5678){var _0x3a3905={'raw':!![],'where':{}};var _0x1a1ca2={};var _0x4211d9={'count':0x0,'rows':[]};return db[_0xf0ce('0x3c')][_0xf0ce('0x55')]({'where':{'id':_0x4e8c5b[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x41989e,null))[_0xf0ce('0x23')](function(_0x39c89b){if(_0x39c89b){_0x1a1ca2[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db[_0xf0ce('0x56')]['rawAttributes']);_0x1a1ca2[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x4e8c5b['query']);_0x1a1ca2[_0xf0ce('0x2e')]=_[_0xf0ce('0x2f')](_0x1a1ca2[_0xf0ce('0x30')],_0x1a1ca2[_0xf0ce('0x2c')]);_0x3a3905[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x1a1ca2['model'],qs[_0xf0ce('0x32')](_0x4e8c5b[_0xf0ce('0x2c')]['fields']));_0x3a3905['attributes']=_0x3a3905['attributes'][_0xf0ce('0x33')]?_0x3a3905[_0xf0ce('0x31')]:_0x1a1ca2[_0xf0ce('0x30')];if(!_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x57')]('nolimit')){_0x3a3905[_0xf0ce('0x1d')]=qs[_0xf0ce('0x1d')](_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x1d')]);_0x3a3905['offset']=qs[_0xf0ce('0x1b')](_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x1b')]);}_0x3a3905['order']=qs[_0xf0ce('0x36')](_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x36')]);_0x3a3905[_0xf0ce('0x37')]=qs[_0xf0ce('0x2e')](_['pick'](_0x4e8c5b[_0xf0ce('0x2c')],_0x1a1ca2['filters']));_0x3a3905[_0xf0ce('0x37')]['CampaignId']=_0x39c89b['id'];if(_0x4e8c5b['query'][_0xf0ce('0x39')]){_0x3a3905[_0xf0ce('0x37')]=_['merge'](_0x3a3905['where'],{'$or':_['map'](_0x3a3905[_0xf0ce('0x31')],function(_0xc4049a){var _0x152fc5={};_0x152fc5[_0xc4049a]={'$like':'%'+_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x39')]+'%'};return _0x152fc5;})});}_0x3a3905=_[_0xf0ce('0x3a')]({},_0x3a3905,_0x4e8c5b['options']);return db[_0xf0ce('0x56')]['count']({'where':_0x3a3905[_0xf0ce('0x37')]})['then'](function(_0x1a0635){_0x4211d9[_0xf0ce('0x1e')]=_0x1a0635;if(_0x4e8c5b[_0xf0ce('0x2c')][_0xf0ce('0x3d')]){_0x3a3905[_0xf0ce('0x3e')]=[{'all':!![]}];}return db[_0xf0ce('0x56')][_0xf0ce('0x3f')](_0x3a3905);})['then'](function(_0x411b37){_0x4211d9[_0xf0ce('0x40')]=_0x411b37;return _0x4211d9;});}})[_0xf0ce('0x23')](respondWithFilteredResult(_0x41989e,_0x3a3905))[_0xf0ce('0x41')](handleError(_0x41989e,null));};exports[_0xf0ce('0x58')]=function(_0x15fd9c,_0x100210,_0x58ee7e){var _0x65d13={'raw':!![],'where':{}};var _0x57c149={};var _0x148c16={'count':0x0,'rows':[]};return db[_0xf0ce('0x3c')][_0xf0ce('0x55')]({'where':{'id':_0x15fd9c[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x100210,null))[_0xf0ce('0x23')](function(_0x2ad789){if(_0x2ad789){_0x57c149['model']=_[_0xf0ce('0x2d')](db[_0xf0ce('0x59')]['rawAttributes']);_0x57c149['query']=_['keys'](_0x15fd9c['query']);_0x57c149[_0xf0ce('0x2e')]=_['intersection'](_0x57c149[_0xf0ce('0x30')],_0x57c149[_0xf0ce('0x2c')]);_0x65d13[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x57c149[_0xf0ce('0x30')],qs[_0xf0ce('0x32')](_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x32')]));_0x65d13[_0xf0ce('0x31')]=_0x65d13[_0xf0ce('0x31')][_0xf0ce('0x33')]?_0x65d13['attributes']:_0x57c149['model'];if(!_0x15fd9c['query'][_0xf0ce('0x57')]('nolimit')){_0x65d13['limit']=qs['limit'](_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x1d')]);_0x65d13[_0xf0ce('0x1b')]=qs[_0xf0ce('0x1b')](_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x1b')]);}_0x65d13[_0xf0ce('0x35')]=qs['sort'](_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x36')]);_0x65d13[_0xf0ce('0x37')]=qs['filters'](_[_0xf0ce('0x38')](_0x15fd9c[_0xf0ce('0x2c')],_0x57c149[_0xf0ce('0x2e')]));_0x65d13[_0xf0ce('0x37')]['CampaignId']=_0x2ad789['id'];if(_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x39')]){_0x65d13[_0xf0ce('0x37')]=_[_0xf0ce('0x3a')](_0x65d13[_0xf0ce('0x37')],{'$or':_[_0xf0ce('0x28')](_0x65d13[_0xf0ce('0x31')],function(_0xfa4507){var _0x520c48={};_0x520c48[_0xfa4507]={'$like':'%'+_0x15fd9c[_0xf0ce('0x2c')][_0xf0ce('0x39')]+'%'};return _0x520c48;})});}_0x65d13=_[_0xf0ce('0x3a')]({},_0x65d13,_0x15fd9c[_0xf0ce('0x3b')]);return db[_0xf0ce('0x59')][_0xf0ce('0x1e')]({'where':_0x65d13[_0xf0ce('0x37')]})[_0xf0ce('0x23')](function(_0x373b7e){_0x148c16[_0xf0ce('0x1e')]=_0x373b7e;if(_0x15fd9c[_0xf0ce('0x2c')]['includeAll']){_0x65d13['include']=[{'all':!![]}];}return db[_0xf0ce('0x59')][_0xf0ce('0x3f')](_0x65d13);})[_0xf0ce('0x23')](function(_0x5ef406){_0x148c16['rows']=_0x5ef406;return _0x148c16;});}})[_0xf0ce('0x23')](respondWithFilteredResult(_0x100210,_0x65d13))['catch'](handleError(_0x100210,null));};exports[_0xf0ce('0x5a')]=function(_0x4d4c60,_0x4ea0a7,_0x3d66d1){var _0x15d916={'raw':!![],'where':{}};var _0x2e5550={};var _0x1b51aa={'count':0x0,'rows':[]};return db[_0xf0ce('0x3c')][_0xf0ce('0x55')]({'where':{'id':_0x4d4c60[_0xf0ce('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ea0a7,null))[_0xf0ce('0x23')](function(_0x5dd0c){if(_0x5dd0c){_0x2e5550[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db[_0xf0ce('0x5b')]['rawAttributes']);_0x2e5550[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x4d4c60[_0xf0ce('0x2c')]);_0x2e5550[_0xf0ce('0x2e')]=_[_0xf0ce('0x2f')](_0x2e5550['model'],_0x2e5550[_0xf0ce('0x2c')]);_0x15d916[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x2e5550[_0xf0ce('0x30')],qs[_0xf0ce('0x32')](_0x4d4c60['query'][_0xf0ce('0x32')]));_0x15d916[_0xf0ce('0x31')]=_0x15d916['attributes'][_0xf0ce('0x33')]?_0x15d916[_0xf0ce('0x31')]:_0x2e5550[_0xf0ce('0x30')];if(!_0x4d4c60['query'][_0xf0ce('0x57')](_0xf0ce('0x34'))){_0x15d916[_0xf0ce('0x1d')]=qs[_0xf0ce('0x1d')](_0x4d4c60[_0xf0ce('0x2c')][_0xf0ce('0x1d')]);_0x15d916['offset']=qs[_0xf0ce('0x1b')](_0x4d4c60[_0xf0ce('0x2c')][_0xf0ce('0x1b')]);}_0x15d916['order']=qs['sort'](_0x4d4c60[_0xf0ce('0x2c')][_0xf0ce('0x36')]);_0x15d916[_0xf0ce('0x37')]=qs['filters'](_[_0xf0ce('0x38')](_0x4d4c60['query'],_0x2e5550[_0xf0ce('0x2e')]));_0x15d916['where'][_0xf0ce('0x5c')]=_0x5dd0c['id'];if(_0x4d4c60[_0xf0ce('0x2c')][_0xf0ce('0x39')]){_0x15d916[_0xf0ce('0x37')]=_['merge'](_0x15d916['where'],{'$or':_[_0xf0ce('0x28')](_0x15d916[_0xf0ce('0x31')],function(_0x36546d){var _0x120107={};_0x120107[_0x36546d]={'$like':'%'+_0x4d4c60[_0xf0ce('0x2c')]['filter']+'%'};return _0x120107;})});}_0x15d916=_[_0xf0ce('0x3a')]({},_0x15d916,_0x4d4c60[_0xf0ce('0x3b')]);return db[_0xf0ce('0x5b')][_0xf0ce('0x1e')]({'where':_0x15d916[_0xf0ce('0x37')]})[_0xf0ce('0x23')](function(_0x16af92){_0x1b51aa[_0xf0ce('0x1e')]=_0x16af92;if(_0x4d4c60['query']['includeAll']){_0x15d916[_0xf0ce('0x3e')]=[{'all':!![]}];}return db[_0xf0ce('0x5b')][_0xf0ce('0x3f')](_0x15d916);})[_0xf0ce('0x23')](function(_0x5b0654){_0x1b51aa[_0xf0ce('0x40')]=_0x5b0654;return _0x1b51aa;});}})[_0xf0ce('0x23')](respondWithFilteredResult(_0x4ea0a7,_0x15d916))['catch'](handleError(_0x4ea0a7,null));};exports['getHopperBlacks']=function(_0x33ffd2,_0x564ed1,_0x45dc14){var _0x3e255e={'raw':!![],'where':{}};var _0x595a8f={};var _0x218d57={'count':0x0,'rows':[]};return db['Campaign'][_0xf0ce('0x55')]({'where':{'id':_0x33ffd2[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x564ed1,null))['then'](function(_0x582ccd){if(_0x582ccd){_0x595a8f[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db[_0xf0ce('0x5d')][_0xf0ce('0x29')]);_0x595a8f[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x33ffd2[_0xf0ce('0x2c')]);_0x595a8f['filters']=_[_0xf0ce('0x2f')](_0x595a8f[_0xf0ce('0x30')],_0x595a8f[_0xf0ce('0x2c')]);_0x3e255e['attributes']=_[_0xf0ce('0x2f')](_0x595a8f[_0xf0ce('0x30')],qs[_0xf0ce('0x32')](_0x33ffd2[_0xf0ce('0x2c')]['fields']));_0x3e255e['attributes']=_0x3e255e[_0xf0ce('0x31')][_0xf0ce('0x33')]?_0x3e255e[_0xf0ce('0x31')]:_0x595a8f[_0xf0ce('0x30')];if(!_0x33ffd2[_0xf0ce('0x2c')][_0xf0ce('0x57')](_0xf0ce('0x34'))){_0x3e255e[_0xf0ce('0x1d')]=qs[_0xf0ce('0x1d')](_0x33ffd2['query'][_0xf0ce('0x1d')]);_0x3e255e[_0xf0ce('0x1b')]=qs[_0xf0ce('0x1b')](_0x33ffd2[_0xf0ce('0x2c')][_0xf0ce('0x1b')]);}_0x3e255e['order']=qs[_0xf0ce('0x36')](_0x33ffd2['query'][_0xf0ce('0x36')]);_0x3e255e[_0xf0ce('0x37')]=qs[_0xf0ce('0x2e')](_[_0xf0ce('0x38')](_0x33ffd2[_0xf0ce('0x2c')],_0x595a8f[_0xf0ce('0x2e')]));_0x3e255e[_0xf0ce('0x37')][_0xf0ce('0x5c')]=_0x582ccd['id'];if(_0x33ffd2[_0xf0ce('0x2c')]['filter']){_0x3e255e[_0xf0ce('0x37')]=_[_0xf0ce('0x3a')](_0x3e255e[_0xf0ce('0x37')],{'$or':_['map'](_0x3e255e['attributes'],function(_0xab93f4){var _0x3480f1={};_0x3480f1[_0xab93f4]={'$like':'%'+_0x33ffd2[_0xf0ce('0x2c')]['filter']+'%'};return _0x3480f1;})});}_0x3e255e=_['merge']({},_0x3e255e,_0x33ffd2[_0xf0ce('0x3b')]);return db[_0xf0ce('0x5d')]['count']({'where':_0x3e255e[_0xf0ce('0x37')]})[_0xf0ce('0x23')](function(_0x39a306){_0x218d57[_0xf0ce('0x1e')]=_0x39a306;if(_0x33ffd2['query'][_0xf0ce('0x3d')]){_0x3e255e[_0xf0ce('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xf0ce('0x3f')](_0x3e255e);})[_0xf0ce('0x23')](function(_0x207132){_0x218d57[_0xf0ce('0x40')]=_0x207132;return _0x218d57;});}})[_0xf0ce('0x23')](respondWithFilteredResult(_0x564ed1,_0x3e255e))[_0xf0ce('0x41')](handleError(_0x564ed1,null));};exports[_0xf0ce('0x5e')]=function(_0x4105de,_0x3b5e6f,_0x2d8dec){var _0x5424d4={};var _0x58ba5c={};var _0x373937;var _0x7624ed;return db[_0xf0ce('0x3c')][_0xf0ce('0x55')]({'where':{'id':_0x4105de[_0xf0ce('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b5e6f,null))[_0xf0ce('0x23')](function(_0x3593d5){if(_0x3593d5){_0x373937=_0x3593d5;_0x58ba5c[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db['CmList']['rawAttributes']);_0x58ba5c[_0xf0ce('0x2c')]=_[_0xf0ce('0x2d')](_0x4105de[_0xf0ce('0x2c')]);_0x58ba5c[_0xf0ce('0x2e')]=_[_0xf0ce('0x2f')](_0x58ba5c[_0xf0ce('0x30')],_0x58ba5c['query']);_0x5424d4[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0x58ba5c[_0xf0ce('0x30')],qs[_0xf0ce('0x32')](_0x4105de[_0xf0ce('0x2c')][_0xf0ce('0x32')]));_0x5424d4[_0xf0ce('0x31')]=_0x5424d4['attributes'][_0xf0ce('0x33')]?_0x5424d4[_0xf0ce('0x31')]:_0x58ba5c[_0xf0ce('0x30')];_0x5424d4[_0xf0ce('0x35')]=qs[_0xf0ce('0x36')](_0x4105de[_0xf0ce('0x2c')]['sort']);_0x5424d4[_0xf0ce('0x37')]=qs[_0xf0ce('0x2e')](_[_0xf0ce('0x38')](_0x4105de[_0xf0ce('0x2c')],_0x58ba5c['filters']));if(_0x4105de[_0xf0ce('0x2c')]['filter']){_0x5424d4[_0xf0ce('0x37')]=_['merge'](_0x5424d4[_0xf0ce('0x37')],{'$or':_[_0xf0ce('0x28')](_0x5424d4[_0xf0ce('0x31')],function(_0x243af1){var _0x58e601={};_0x58e601[_0x243af1]={'$like':'%'+_0x4105de[_0xf0ce('0x2c')]['filter']+'%'};return _0x58e601;})});}_0x5424d4=_['merge']({},_0x5424d4,_0x4105de[_0xf0ce('0x3b')]);return _0x373937[_0xf0ce('0x5e')](_0x5424d4);}})[_0xf0ce('0x23')](function(_0x1a1325){if(_0x1a1325){_0x7624ed=_0x1a1325[_0xf0ce('0x33')];if(!_0x4105de['query']['hasOwnProperty'](_0xf0ce('0x34'))){_0x5424d4['limit']=qs[_0xf0ce('0x1d')](_0x4105de[_0xf0ce('0x2c')][_0xf0ce('0x1d')]);_0x5424d4['offset']=qs[_0xf0ce('0x1b')](_0x4105de[_0xf0ce('0x2c')]['offset']);}return _0x373937[_0xf0ce('0x5e')](_0x5424d4);}})[_0xf0ce('0x23')](function(_0x4b39c3){if(_0x4b39c3){return _0x4b39c3?{'count':_0x7624ed,'rows':_0x4b39c3}:null;}})[_0xf0ce('0x23')](respondWithResult(_0x3b5e6f,null))[_0xf0ce('0x41')](handleError(_0x3b5e6f,null));};exports[_0xf0ce('0x5f')]=function(_0x1b8ea6,_0xfdc08d,_0x3adfac){var _0x194f4b,_0x27701e;return db['Campaign'][_0xf0ce('0x43')]({'where':{'id':_0x1b8ea6[_0xf0ce('0x42')]['id']}})['then'](handleEntityNotFound(_0xfdc08d,null))[_0xf0ce('0x23')](function(_0x1e601b){if(_0x1e601b){_0x27701e=_0x1e601b;return _0x1e601b[_0xf0ce('0x5f')](_0x1b8ea6[_0xf0ce('0x45')][_0xf0ce('0x60')],_[_0xf0ce('0x61')](_0x1b8ea6[_0xf0ce('0x45')],[_0xf0ce('0x60'),'id'])||{});}return null;})[_0xf0ce('0x62')](function(_0x5413a4){var _0x2a0b5e;_0x194f4b=_0x5413a4||[];var _0x23f73e=[];if(_0x5413a4){for(var _0x115556=0x0;_0x115556<_0x5413a4[_0xf0ce('0x33')];_0x115556+=0x1){var _0x11b7ac=_0x5413a4[_0x115556]['get']({'plain':!![]});_0x27701e['dialCheckDuplicateType']=_0x1b8ea6[_0xf0ce('0x45')]['dialCheckDuplicateType']?_0x1b8ea6[_0xf0ce('0x45')][_0xf0ce('0x63')]:_0x27701e[_0xf0ce('0x63')];switch(_0x27701e[_0xf0ce('0x63')]){case _0xf0ce('0x64'):_0x2a0b5e=squel[_0xf0ce('0x65')]()[_0xf0ce('0x66')](_0xf0ce('0x67'))['fromQuery']([_0xf0ce('0x68'),'scheduledAt','ContactId',_0xf0ce('0x69'),_0xf0ce('0x5c'),_0xf0ce('0x51'),_0xf0ce('0x52')],squel[_0xf0ce('0x6a')]()['field']('phone',_0xf0ce('0x68'))['field'](_0xf0ce('0x6b'),'scheduledAt')[_0xf0ce('0x6c')]('id',_0xf0ce('0x6d'))['field'](_0x11b7ac[_0xf0ce('0x6e')][_0xf0ce('0x6f')](),_0xf0ce('0x69'))[_0xf0ce('0x6c')](_0x1b8ea6[_0xf0ce('0x42')]['id'][_0xf0ce('0x6f')](),_0xf0ce('0x5c'))[_0xf0ce('0x6c')](_0xf0ce('0x6b'),'createdAt')[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x52'))[_0xf0ce('0x70')](_0xf0ce('0x71'))[_0xf0ce('0x37')]('deletedAt\x20IS\x20NULL')[_0xf0ce('0x37')](_0xf0ce('0x72'),_0x11b7ac['CmListId']['toString']())[_0xf0ce('0x37')](_0xf0ce('0x73'))['where'](_0xf0ce('0x74'),squel[_0xf0ce('0x6a')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0xf0ce('0x75'))[_0xf0ce('0x37')](_0xf0ce('0x76'),_0x1b8ea6['params']['id'][_0xf0ce('0x6f')]()))[_0xf0ce('0x37')](_0xf0ce('0x74'),squel[_0xf0ce('0x6a')]()[_0xf0ce('0x6c')](_0xf0ce('0x77'))[_0xf0ce('0x70')](_0xf0ce('0x67'))[_0xf0ce('0x37')]('CampaignId\x20=\x20?',_0x1b8ea6[_0xf0ce('0x42')]['id']['toString']())))['toString']();break;case _0xf0ce('0x78'):_0x2a0b5e=squel[_0xf0ce('0x65')]()[_0xf0ce('0x66')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0xf0ce('0x6d'),_0xf0ce('0x69'),_0xf0ce('0x5c'),'createdAt',_0xf0ce('0x52')],squel[_0xf0ce('0x6a')]()['field'](_0xf0ce('0x68'),_0xf0ce('0x68'))[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x79'))[_0xf0ce('0x6c')]('id',_0xf0ce('0x6d'))[_0xf0ce('0x6c')](_0x11b7ac['CmListId'][_0xf0ce('0x6f')](),_0xf0ce('0x69'))[_0xf0ce('0x6c')](_0x1b8ea6[_0xf0ce('0x42')]['id']['toString'](),'CampaignId')[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x51'))['field'](_0xf0ce('0x6b'),_0xf0ce('0x52'))[_0xf0ce('0x70')](_0xf0ce('0x71'))[_0xf0ce('0x37')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x11b7ac['CmListId'][_0xf0ce('0x6f')]())[_0xf0ce('0x37')](_0xf0ce('0x73'))[_0xf0ce('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf0ce('0x6a')]()[_0xf0ce('0x6c')](_0xf0ce('0x77'))[_0xf0ce('0x70')](_0xf0ce('0x67'))['where'](_0xf0ce('0x76'),_0x1b8ea6['params']['id']['toString']())))[_0xf0ce('0x6f')]();break;default:_0x2a0b5e=squel['insert']()[_0xf0ce('0x66')](_0xf0ce('0x67'))[_0xf0ce('0x7a')](['phone','scheduledAt',_0xf0ce('0x6d'),_0xf0ce('0x69'),'CampaignId',_0xf0ce('0x51'),_0xf0ce('0x52')],squel[_0xf0ce('0x6a')]()[_0xf0ce('0x6c')](_0xf0ce('0x68'),_0xf0ce('0x68'))[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x79'))['field']('id',_0xf0ce('0x6d'))[_0xf0ce('0x6c')](_0x11b7ac[_0xf0ce('0x6e')]['toString'](),_0xf0ce('0x69'))[_0xf0ce('0x6c')](_0x1b8ea6[_0xf0ce('0x42')]['id'][_0xf0ce('0x6f')](),'CampaignId')[_0xf0ce('0x6c')]('NOW()',_0xf0ce('0x51'))[_0xf0ce('0x6c')]('NOW()',_0xf0ce('0x52'))[_0xf0ce('0x70')](_0xf0ce('0x71'))['where'](_0xf0ce('0x7b'))[_0xf0ce('0x37')](_0xf0ce('0x72'),_0x11b7ac[_0xf0ce('0x6e')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xf0ce('0x6f')]();}_0x23f73e['push'](db[_0xf0ce('0x7c')]['query'](_0x2a0b5e));}return BPromise[_0xf0ce('0x7d')](_0x23f73e);}})[_0xf0ce('0x23')](function(){return _0x194f4b;})[_0xf0ce('0x23')](respondWithResult(_0xfdc08d,null))[_0xf0ce('0x41')](handleError(_0xfdc08d,null));};exports[_0xf0ce('0x7e')]=function(_0x9152ba,_0x56b5bb,_0x5dcdc6){return db[_0xf0ce('0x3c')][_0xf0ce('0x43')]({'where':{'id':_0x9152ba[_0xf0ce('0x42')]['id']}})['then'](handleEntityNotFound(_0x56b5bb,null))[_0xf0ce('0x23')](function(_0x3e8022){if(_0x3e8022){return _0x3e8022[_0xf0ce('0x7e')](_0x9152ba['query'][_0xf0ce('0x60')]);}})[_0xf0ce('0x23')](function(_0x348752){if(_0x348752){return db[_0xf0ce('0x56')]['destroy']({'where':{'ListId':_0x9152ba['query'][_0xf0ce('0x60')],'CampaignId':_0x9152ba[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](function(){return _0x348752;});}})[_0xf0ce('0x23')](respondWithStatusCode(_0x56b5bb,null))[_0xf0ce('0x41')](handleError(_0x56b5bb,null));};exports['getBlackLists']=function(_0xb994b8,_0x5b85f1,_0x3d37e5){var _0x167372={};var _0xa51720={};var _0x560d4c;var _0x263f11;return db[_0xf0ce('0x3c')][_0xf0ce('0x55')]({'where':{'id':_0xb994b8[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x5b85f1,null))[_0xf0ce('0x23')](function(_0x47acb5){if(_0x47acb5){_0x560d4c=_0x47acb5;_0xa51720[_0xf0ce('0x30')]=_[_0xf0ce('0x2d')](db[_0xf0ce('0x7f')]['rawAttributes']);_0xa51720['query']=_[_0xf0ce('0x2d')](_0xb994b8[_0xf0ce('0x2c')]);_0xa51720['filters']=_[_0xf0ce('0x2f')](_0xa51720[_0xf0ce('0x30')],_0xa51720[_0xf0ce('0x2c')]);_0x167372[_0xf0ce('0x31')]=_[_0xf0ce('0x2f')](_0xa51720[_0xf0ce('0x30')],qs['fields'](_0xb994b8['query']['fields']));_0x167372[_0xf0ce('0x31')]=_0x167372[_0xf0ce('0x31')][_0xf0ce('0x33')]?_0x167372[_0xf0ce('0x31')]:_0xa51720[_0xf0ce('0x30')];_0x167372[_0xf0ce('0x35')]=qs[_0xf0ce('0x36')](_0xb994b8[_0xf0ce('0x2c')][_0xf0ce('0x36')]);_0x167372[_0xf0ce('0x37')]=qs[_0xf0ce('0x2e')](_['pick'](_0xb994b8['query'],_0xa51720[_0xf0ce('0x2e')]));if(_0xb994b8[_0xf0ce('0x2c')][_0xf0ce('0x39')]){_0x167372[_0xf0ce('0x37')]=_[_0xf0ce('0x3a')](_0x167372[_0xf0ce('0x37')],{'$or':_[_0xf0ce('0x28')](_0x167372[_0xf0ce('0x31')],function(_0x30556f){var _0x4d6bc3={};_0x4d6bc3[_0x30556f]={'$like':'%'+_0xb994b8['query'][_0xf0ce('0x39')]+'%'};return _0x4d6bc3;})});}_0x167372=_['merge']({},_0x167372,_0xb994b8[_0xf0ce('0x3b')]);return _0x560d4c[_0xf0ce('0x80')](_0x167372);}})[_0xf0ce('0x23')](function(_0x5beadc){if(_0x5beadc){_0x263f11=_0x5beadc[_0xf0ce('0x33')];if(!_0xb994b8[_0xf0ce('0x2c')][_0xf0ce('0x57')](_0xf0ce('0x34'))){_0x167372[_0xf0ce('0x1d')]=qs['limit'](_0xb994b8['query'][_0xf0ce('0x1d')]);_0x167372[_0xf0ce('0x1b')]=qs[_0xf0ce('0x1b')](_0xb994b8[_0xf0ce('0x2c')][_0xf0ce('0x1b')]);}return _0x560d4c['getBlackLists'](_0x167372);}})[_0xf0ce('0x23')](function(_0x26d99e){if(_0x26d99e){return _0x26d99e?{'count':_0x263f11,'rows':_0x26d99e}:null;}})[_0xf0ce('0x23')](respondWithResult(_0x5b85f1,null))[_0xf0ce('0x41')](handleError(_0x5b85f1,null));};exports['addBlackLists']=function(_0x2ec435,_0xe68ad9,_0x48a5af){var _0x3d263a,_0x5c532e;return db[_0xf0ce('0x3c')][_0xf0ce('0x43')]({'where':{'id':_0x2ec435[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0xe68ad9,null))[_0xf0ce('0x23')](function(_0x1fb9cf){if(_0x1fb9cf){_0x5c532e=_0x1fb9cf;return _0x1fb9cf[_0xf0ce('0x81')](_0x2ec435['body']['ids'],_[_0xf0ce('0x61')](_0x2ec435[_0xf0ce('0x45')],[_0xf0ce('0x60'),'id'])||{});}return null;})[_0xf0ce('0x62')](function(_0x22b660){var _0x21798c;_0x3d263a=_0x22b660||[];var _0x5cb2c1=[];if(_0x22b660){for(var _0x4040a8=0x0;_0x4040a8<_0x22b660[_0xf0ce('0x33')];_0x4040a8+=0x1){var _0x5c2599=_0x22b660[_0x4040a8]['get']({'plain':!![]});_0x21798c=squel['insert']()['into'](_0xf0ce('0x82'))['fromQuery']([_0xf0ce('0x68'),'ContactId',_0xf0ce('0x69'),_0xf0ce('0x5c'),'createdAt',_0xf0ce('0x52')],squel['select']()[_0xf0ce('0x6c')](_0xf0ce('0x68'),'phone')[_0xf0ce('0x6c')]('id',_0xf0ce('0x6d'))['field'](_0x5c2599[_0xf0ce('0x6e')]['toString'](),_0xf0ce('0x69'))[_0xf0ce('0x6c')](_0x2ec435[_0xf0ce('0x42')]['id'][_0xf0ce('0x6f')](),_0xf0ce('0x5c'))[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x51'))[_0xf0ce('0x6c')](_0xf0ce('0x6b'),_0xf0ce('0x52'))['from']('cm_contacts')['where'](_0xf0ce('0x7b'))[_0xf0ce('0x37')](_0xf0ce('0x72'),_0x5c2599[_0xf0ce('0x6e')][_0xf0ce('0x6f')]())[_0xf0ce('0x37')](_0xf0ce('0x73')))[_0xf0ce('0x6f')]();_0x5cb2c1[_0xf0ce('0x83')](db['sequelize']['query'](_0x21798c));}return BPromise['all'](_0x5cb2c1);}})[_0xf0ce('0x23')](function(){return _0x3d263a;})[_0xf0ce('0x23')](respondWithResult(_0xe68ad9,null))[_0xf0ce('0x41')](handleError(_0xe68ad9,null));};exports[_0xf0ce('0x84')]=function(_0x3a6431,_0x4b91de,_0x319bb2){return db[_0xf0ce('0x3c')][_0xf0ce('0x43')]({'where':{'id':_0x3a6431[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](handleEntityNotFound(_0x4b91de,null))['then'](function(_0x543533){if(_0x543533){return _0x543533['removeBlackLists'](_0x3a6431[_0xf0ce('0x2c')][_0xf0ce('0x60')]);}})[_0xf0ce('0x23')](function(_0x5743ad){if(_0x5743ad){return db[_0xf0ce('0x5d')][_0xf0ce('0x24')]({'where':{'ListId':_0x3a6431['query']['ids'],'CampaignId':_0x3a6431[_0xf0ce('0x42')]['id']}})[_0xf0ce('0x23')](function(){return _0x5743ad;});}})['then'](respondWithStatusCode(_0x4b91de,null))['catch'](handleError(_0x4b91de,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3e46107..2a640ea 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(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x7a54,0x106));var _0x47a5=function(_0x717224,_0x2808a9){_0x717224=_0x717224-0x0;var _0x18ec06=_0x7a54[_0x717224];return _0x18ec06;};'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 c5e607c..982fd15 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 _0x7d86=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','lodash','moment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x7d86,0x86));var _0x67d8=function(_0x2fd871,_0x5ef012){_0x2fd871=_0x2fd871-0x0;var _0x58c191=_0x7d86[_0x2fd871];return _0x58c191;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var moment=require(_0x67d8('0x1'));var BPromise=require(_0x67d8('0x2'));var rs=require(_0x67d8('0x3'));var fs=require('fs');var Redis=require(_0x67d8('0x4'));var db=require(_0x67d8('0x5'))['db'];var utils=require(_0x67d8('0x6'));var logger=require(_0x67d8('0x7'))('rpc');var config=require(_0x67d8('0x8'));var jayson=require(_0x67d8('0x9'));var client=jayson[_0x67d8('0xa')][_0x67d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2485fa,_0x282b7a,_0x30c690){return new BPromise(function(_0x16e834,_0x31726a){return client[_0x67d8('0xc')](_0x2485fa,_0x30c690)[_0x67d8('0xd')](function(_0x6bc54c){logger[_0x67d8('0xe')](_0x67d8('0xf'),_0x282b7a,_0x67d8('0x10'));logger[_0x67d8('0x11')](_0x67d8('0x12'),_0x282b7a,_0x67d8('0x10'),JSON[_0x67d8('0x13')](_0x6bc54c));if(_0x6bc54c[_0x67d8('0x14')]){if(_0x6bc54c[_0x67d8('0x14')]['code']===0x1f4){logger[_0x67d8('0x14')](_0x67d8('0xf'),_0x282b7a,_0x6bc54c[_0x67d8('0x14')]['message']);return _0x31726a(_0x6bc54c[_0x67d8('0x14')][_0x67d8('0x15')]);}logger[_0x67d8('0x14')](_0x67d8('0xf'),_0x282b7a,_0x6bc54c[_0x67d8('0x14')][_0x67d8('0x15')]);return _0x16e834(_0x6bc54c[_0x67d8('0x14')]['message']);}else{logger[_0x67d8('0xe')](_0x67d8('0xf'),_0x282b7a,_0x67d8('0x10'));_0x16e834(_0x6bc54c['result'][_0x67d8('0x15')]);}})[_0x67d8('0x16')](function(_0x4b2795){logger[_0x67d8('0x14')](_0x67d8('0xf'),_0x282b7a,_0x4b2795);_0x31726a(_0x4b2795);});});}exports[_0x67d8('0x17')]=function(_0xefaaea){var _0x23328d=this;return new Promise(function(_0x2a9e66,_0x5117d0){return db[_0x67d8('0x18')][_0x67d8('0x19')]({'raw':_0xefaaea[_0x67d8('0x1a')]?_0xefaaea[_0x67d8('0x1a')][_0x67d8('0x1b')]===undefined?!![]:![]:!![],'where':_0xefaaea['options']?_0xefaaea[_0x67d8('0x1a')][_0x67d8('0x1c')]||null:null,'attributes':_0xefaaea['options']?_0xefaaea['options'][_0x67d8('0x1d')]||null:null,'limit':_0xefaaea['options']?_0xefaaea[_0x67d8('0x1a')][_0x67d8('0x1e')]||null:null,'include':_0xefaaea[_0x67d8('0x1a')]?_0xefaaea['options']['include']?_[_0x67d8('0x1f')](_0xefaaea[_0x67d8('0x1a')][_0x67d8('0x20')],function(_0x3949ce){return{'model':db[_0x3949ce[_0x67d8('0x21')]],'as':_0x3949ce['as'],'attributes':_0x3949ce['attributes'],'include':_0x3949ce[_0x67d8('0x20')]?_[_0x67d8('0x1f')](_0x3949ce['include'],function(_0x509ee9){return{'model':db[_0x509ee9[_0x67d8('0x21')]],'as':_0x509ee9['as'],'attributes':_0x509ee9[_0x67d8('0x1d')],'include':_0x509ee9['include']?_[_0x67d8('0x1f')](_0x509ee9[_0x67d8('0x20')],function(_0x4de8ae){return{'model':db[_0x4de8ae['model']],'as':_0x4de8ae['as'],'attributes':_0x4de8ae[_0x67d8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x67d8('0xd')](function(_0x5873f5){logger[_0x67d8('0xe')](_0x67d8('0x17'),_0xefaaea);logger['debug'](_0x67d8('0x17'),_0xefaaea,JSON['stringify'](_0x5873f5));_0x2a9e66(_0x5873f5);})[_0x67d8('0x16')](function(_0x8531f3){logger[_0x67d8('0x14')]('GetCampaign',_0x8531f3['message'],_0xefaaea);_0x5117d0(_0x23328d['error'](0x1f4,_0x8531f3[_0x67d8('0x15')]));});});}; \ No newline at end of file +var _0xfa2f=['attributes','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model'];(function(_0x23eac6,_0x4f118d){var _0x4dd58b=function(_0x2418ad){while(--_0x2418ad){_0x23eac6['push'](_0x23eac6['shift']());}};_0x4dd58b(++_0x4f118d);}(_0xfa2f,0xe8));var _0xffa2=function(_0x6a672d,_0x1750e4){_0x6a672d=_0x6a672d-0x0;var _0x3a7e4b=_0xfa2f[_0x6a672d];return _0x3a7e4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffa2('0x0'));var BPromise=require('bluebird');var rs=require(_0xffa2('0x1'));var fs=require('fs');var Redis=require(_0xffa2('0x2'));var db=require(_0xffa2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffa2('0x4'))(_0xffa2('0x5'));var config=require(_0xffa2('0x6'));var jayson=require(_0xffa2('0x7'));var client=jayson[_0xffa2('0x8')][_0xffa2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x215134,_0x489257,_0x4c6406){return new BPromise(function(_0x34cf1b,_0x20a710){return client[_0xffa2('0xa')](_0x215134,_0x4c6406)[_0xffa2('0xb')](function(_0x3462ae){logger[_0xffa2('0xc')](_0xffa2('0xd'),_0x489257,'request\x20sent');logger[_0xffa2('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x489257,'request\x20sent',JSON[_0xffa2('0xf')](_0x3462ae));if(_0x3462ae[_0xffa2('0x10')]){if(_0x3462ae[_0xffa2('0x10')][_0xffa2('0x11')]===0x1f4){logger[_0xffa2('0x10')]('Campaign,\x20%s,\x20%s',_0x489257,_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);return _0x20a710(_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x489257,_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);return _0x34cf1b(_0x3462ae[_0xffa2('0x10')]['message']);}else{logger[_0xffa2('0xc')](_0xffa2('0xd'),_0x489257,_0xffa2('0x13'));_0x34cf1b(_0x3462ae[_0xffa2('0x14')][_0xffa2('0x12')]);}})[_0xffa2('0x15')](function(_0x892043){logger['error'](_0xffa2('0xd'),_0x489257,_0x892043);_0x20a710(_0x892043);});});}exports[_0xffa2('0x16')]=function(_0x923abf){var _0x2ae03f=this;return new Promise(function(_0x2b71e7,_0x4e396f){return db[_0xffa2('0x17')][_0xffa2('0x18')]({'raw':_0x923abf[_0xffa2('0x19')]?_0x923abf[_0xffa2('0x19')][_0xffa2('0x1a')]===undefined?!![]:![]:!![],'where':_0x923abf[_0xffa2('0x19')]?_0x923abf['options'][_0xffa2('0x1b')]||null:null,'attributes':_0x923abf[_0xffa2('0x19')]?_0x923abf[_0xffa2('0x19')]['attributes']||null:null,'limit':_0x923abf[_0xffa2('0x19')]?_0x923abf['options'][_0xffa2('0x1c')]||null:null,'include':_0x923abf[_0xffa2('0x19')]?_0x923abf[_0xffa2('0x19')][_0xffa2('0x1d')]?_[_0xffa2('0x1e')](_0x923abf[_0xffa2('0x19')][_0xffa2('0x1d')],function(_0x251a0d){return{'model':db[_0x251a0d[_0xffa2('0x1f')]],'as':_0x251a0d['as'],'attributes':_0x251a0d[_0xffa2('0x20')],'include':_0x251a0d['include']?_[_0xffa2('0x1e')](_0x251a0d[_0xffa2('0x1d')],function(_0x4d97a3){return{'model':db[_0x4d97a3[_0xffa2('0x1f')]],'as':_0x4d97a3['as'],'attributes':_0x4d97a3[_0xffa2('0x20')],'include':_0x4d97a3[_0xffa2('0x1d')]?_[_0xffa2('0x1e')](_0x4d97a3[_0xffa2('0x1d')],function(_0x3fb328){return{'model':db[_0x3fb328[_0xffa2('0x1f')]],'as':_0x3fb328['as'],'attributes':_0x3fb328[_0xffa2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d4376){logger[_0xffa2('0xc')](_0xffa2('0x16'),_0x923abf);logger['debug'](_0xffa2('0x16'),_0x923abf,JSON[_0xffa2('0xf')](_0x2d4376));_0x2b71e7(_0x2d4376);})[_0xffa2('0x15')](function(_0x48e67b){logger[_0xffa2('0x10')](_0xffa2('0x16'),_0x48e67b[_0xffa2('0x12')],_0x923abf);_0x4e396f(_0x2ae03f[_0xffa2('0x10')](0x1f4,_0x48e67b[_0xffa2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 054d8c5..1a46ab1 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 _0xaf43=['getLists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','delete','destroy','/:id/blacklists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x4db141,_0x74de9b){var _0x4e8b56=function(_0x2dc06f){while(--_0x2dc06f){_0x4db141['push'](_0x4db141['shift']());}};_0x4e8b56(++_0x74de9b);}(_0xaf43,0x182));var _0x3af4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xaf43[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x3af4('0x0'));var path=require(_0x3af4('0x1'));var timeout=require(_0x3af4('0x2'));var express=require(_0x3af4('0x3'));var router=express[_0x3af4('0x4')]();var fs_extra=require(_0x3af4('0x5'));var auth=require(_0x3af4('0x6'));var interaction=require(_0x3af4('0x7'));var config=require(_0x3af4('0x8'));var controller=require(_0x3af4('0x9'));router[_0x3af4('0xa')]('/',auth['isAuthenticated'](),controller[_0x3af4('0xb')]);router[_0x3af4('0xa')](_0x3af4('0xc'),auth[_0x3af4('0xd')](),controller['show']);router['get'](_0x3af4('0xe'),auth['isAuthenticated'](),controller[_0x3af4('0xf')]);router[_0x3af4('0xa')](_0x3af4('0x10'),auth[_0x3af4('0xd')](),controller[_0x3af4('0x11')]);router[_0x3af4('0xa')](_0x3af4('0x12'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x3af4('0xa')](_0x3af4('0x13'),auth[_0x3af4('0xd')](),controller[_0x3af4('0x14')]);router['get'](_0x3af4('0x15'),auth[_0x3af4('0xd')](),controller[_0x3af4('0x16')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x3af4('0x17')]);router[_0x3af4('0x18')]('/',auth[_0x3af4('0xd')](),controller[_0x3af4('0x19')]);router['post'](_0x3af4('0x1a'),auth[_0x3af4('0xd')](),controller[_0x3af4('0x1b')]);router[_0x3af4('0x18')](_0x3af4('0x15'),auth[_0x3af4('0xd')](),controller[_0x3af4('0x1c')]);router[_0x3af4('0x18')]('/:id/blacklists',auth[_0x3af4('0xd')](),controller[_0x3af4('0x1d')]);router['put'](_0x3af4('0xc'),auth[_0x3af4('0xd')](),controller['update']);router[_0x3af4('0x1e')](_0x3af4('0xc'),auth['isAuthenticated'](),controller[_0x3af4('0x1f')]);router[_0x3af4('0x1e')](_0x3af4('0x15'),auth[_0x3af4('0xd')](),controller['removeLists']);router[_0x3af4('0x1e')](_0x3af4('0x20'),auth[_0x3af4('0xd')](),controller['removeBlackLists']);module[_0x3af4('0x21')]=router; \ No newline at end of file +var _0xd5bf=['getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists'];(function(_0x3c5658,_0x2fb0e6){var _0x3697b8=function(_0x474343){while(--_0x474343){_0x3c5658['push'](_0x3c5658['shift']());}};_0x3697b8(++_0x2fb0e6);}(_0xd5bf,0x66));var _0xfd5b=function(_0x58ea6b,_0xe690c){_0x58ea6b=_0x58ea6b-0x0;var _0x2f28ba=_0xd5bf[_0x58ea6b];return _0x2f28ba;};'use strict';var multer=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var path=require(_0xfd5b('0x2'));var timeout=require(_0xfd5b('0x3'));var express=require(_0xfd5b('0x4'));var router=express[_0xfd5b('0x5')]();var fs_extra=require(_0xfd5b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd5b('0x7'));var controller=require(_0xfd5b('0x8'));router[_0xfd5b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd5b('0x9')](_0xfd5b('0xa'),auth[_0xfd5b('0xb')](),controller['show']);router[_0xfd5b('0x9')](_0xfd5b('0xc'),auth['isAuthenticated'](),controller[_0xfd5b('0xd')]);router[_0xfd5b('0x9')]('/:id/hopper_histories',auth[_0xfd5b('0xb')](),controller['getHopperHistories']);router[_0xfd5b('0x9')]('/:id/hopper_finals',auth[_0xfd5b('0xb')](),controller['getHopperFinals']);router[_0xfd5b('0x9')](_0xfd5b('0xe'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xfd5b('0x9')](_0xfd5b('0xf'),auth['isAuthenticated'](),controller[_0xfd5b('0x10')]);router[_0xfd5b('0x9')](_0xfd5b('0x11'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x12')]);router[_0xfd5b('0x13')]('/',auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x14')]);router[_0xfd5b('0x13')](_0xfd5b('0x15'),auth['isAuthenticated'](),controller[_0xfd5b('0x16')]);router[_0xfd5b('0x13')](_0xfd5b('0xf'),auth[_0xfd5b('0xb')](),controller['addLists']);router[_0xfd5b('0x13')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xfd5b('0x17')]);router[_0xfd5b('0x18')](_0xfd5b('0xa'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x19')]);router['delete']('/:id',auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x1a')]);router[_0xfd5b('0x1b')](_0xfd5b('0xf'),auth[_0xfd5b('0xb')](),controller['removeLists']);router[_0xfd5b('0x1b')](_0xfd5b('0x11'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x1c')]);module[_0xfd5b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4d771f9..eb07028 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 _0x9a86=['VIRTUAL','key','sequelize','exports','STRING','TEXT'];(function(_0x570426,_0x1d8a31){var _0x1814e9=function(_0x520be5){while(--_0x520be5){_0x570426['push'](_0x570426['shift']());}};_0x1814e9(++_0x1d8a31);}(_0x9a86,0x134));var _0x69a8=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x9a86[_0x52e363];return _0x3fc2b5;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'key':{'type':Sequelize[_0x69a8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x69a8('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x69a8('0x4')],'get':function(){return this['getDataValue'](_0x69a8('0x5'));}}}; \ No newline at end of file +var _0x4e44=['sequelize','exports','STRING','getDataValue','key'];(function(_0xc717ed,_0x273018){var _0x4ef7c3=function(_0x5c2d32){while(--_0x5c2d32){_0xc717ed['push'](_0xc717ed['shift']());}};_0x4ef7c3(++_0x273018);}(_0x4e44,0x1d1));var _0x44e4=function(_0x421468,_0x4d4e39){_0x421468=_0x421468-0x0;var _0x257f7b=_0x4e44[_0x421468];return _0x257f7b;};'use strict';var Sequelize=require(_0x44e4('0x0'));module[_0x44e4('0x1')]={'key':{'type':Sequelize[_0x44e4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x44e4('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x44e4('0x3')](_0x44e4('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index feb2c36..8b163f9 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 _0xbc94=['UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','options','catch','body','find','params','destroy','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','get','CannedAnswers'];(function(_0x5dcdbe,_0x9ac399){var _0x5d5749=function(_0x1d2cb9){while(--_0x1d2cb9){_0x5dcdbe['push'](_0x5dcdbe['shift']());}};_0x5d5749(++_0x9ac399);}(_0xbc94,0x91));var _0x4bc9=function(_0x4ea31e,_0x45cc3d){_0x4ea31e=_0x4ea31e-0x0;var _0x151f45=_0xbc94[_0x4ea31e];return _0x151f45;};'use strict';var emlformat=require(_0x4bc9('0x0'));var rimraf=require(_0x4bc9('0x1'));var zipdir=require(_0x4bc9('0x2'));var jsonpatch=require(_0x4bc9('0x3'));var rp=require(_0x4bc9('0x4'));var moment=require(_0x4bc9('0x5'));var BPromise=require(_0x4bc9('0x6'));var Mustache=require(_0x4bc9('0x7'));var util=require(_0x4bc9('0x8'));var path=require('path');var sox=require(_0x4bc9('0x9'));var csv=require(_0x4bc9('0xa'));var ejs=require(_0x4bc9('0xb'));var fs=require('fs');var fs_extra=require(_0x4bc9('0xc'));var _=require(_0x4bc9('0xd'));var squel=require(_0x4bc9('0xe'));var crypto=require(_0x4bc9('0xf'));var jsforce=require(_0x4bc9('0x10'));var deskjs=require(_0x4bc9('0x11'));var toCsv=require(_0x4bc9('0xa'));var querystring=require(_0x4bc9('0x12'));var Papa=require('papaparse');var Redis=require(_0x4bc9('0x13'));var authService=require(_0x4bc9('0x14'));var qs=require(_0x4bc9('0x15'));var as=require(_0x4bc9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bc9('0x17'))(_0x4bc9('0x18'));var utils=require('../../config/utils');var config=require(_0x4bc9('0x19'));var licenseUtil=require(_0x4bc9('0x1a'));var db=require(_0x4bc9('0x1b'))['db'];function respondWithStatusCode(_0xae82a2,_0x3d0dc3){_0x3d0dc3=_0x3d0dc3||0xcc;return function(_0xff5907){if(_0xff5907){return _0xae82a2[_0x4bc9('0x1c')](_0x3d0dc3);}return _0xae82a2['status'](_0x3d0dc3)[_0x4bc9('0x1d')]();};}function respondWithResult(_0x5f0945,_0x26d66e){_0x26d66e=_0x26d66e||0xc8;return function(_0x52edfc){if(_0x52edfc){return _0x5f0945[_0x4bc9('0x1e')](_0x26d66e)[_0x4bc9('0x1f')](_0x52edfc);}};}function respondWithFilteredResult(_0x520d0c,_0x1f1128){return function(_0x2a67d7){if(_0x2a67d7){var _0xeac865=typeof _0x1f1128[_0x4bc9('0x20')]===_0x4bc9('0x21')&&typeof _0x1f1128[_0x4bc9('0x22')]===_0x4bc9('0x21');var _0x5b919a=_0x2a67d7['count'];var _0xf0337f=_0xeac865?0x0:_0x1f1128[_0x4bc9('0x20')];var _0x2f6dc4=_0xeac865?_0x2a67d7[_0x4bc9('0x23')]:_0x1f1128[_0x4bc9('0x20')]+_0x1f1128[_0x4bc9('0x22')];var _0x3f5e92;if(_0x2f6dc4>=_0x5b919a){_0x2f6dc4=_0x5b919a;_0x3f5e92=0xc8;}else{_0x3f5e92=0xce;}_0x520d0c[_0x4bc9('0x1e')](_0x3f5e92);return _0x520d0c['set']('Content-Range',_0xf0337f+'-'+_0x2f6dc4+'/'+_0x5b919a)[_0x4bc9('0x1f')](_0x2a67d7);}return null;};}function patchUpdates(_0x4ac760){return function(_0x429c93){try{jsonpatch[_0x4bc9('0x24')](_0x429c93,_0x4ac760,!![]);}catch(_0x139a5d){return BPromise[_0x4bc9('0x25')](_0x139a5d);}return _0x429c93[_0x4bc9('0x26')]();};}function saveUpdates(_0x5120ac,_0x57ed2f){return function(_0xb2b199){if(_0xb2b199){return _0xb2b199[_0x4bc9('0x27')](_0x5120ac)[_0x4bc9('0x28')](function(_0x4f9512){return _0x4f9512;});}return null;};}function removeEntity(_0x41bea8,_0x20e70e){return function(_0x3c1c99){if(_0x3c1c99){return _0x3c1c99['destroy']()[_0x4bc9('0x28')](function(){var _0x5cd713=_0x3c1c99[_0x4bc9('0x29')]({'plain':!![]});var _0x11ced2=_0x4bc9('0x2a');return db[_0x4bc9('0x2b')]['destroy']({'where':{'type':_0x11ced2,'resourceId':_0x5cd713['id']}})[_0x4bc9('0x28')](function(){return _0x3c1c99;});})[_0x4bc9('0x28')](function(){_0x41bea8[_0x4bc9('0x1e')](0xcc)[_0x4bc9('0x1d')]();});}};}function handleEntityNotFound(_0x9e74cb,_0x3ec36f){return function(_0x5dd87d){if(!_0x5dd87d){_0x9e74cb[_0x4bc9('0x1c')](0x194);}return _0x5dd87d;};}function handleError(_0x36185a,_0x450f86){_0x450f86=_0x450f86||0x1f4;return function(_0xae98e0){logger[_0x4bc9('0x2c')](_0xae98e0[_0x4bc9('0x2d')]);if(_0xae98e0[_0x4bc9('0x2e')]){delete _0xae98e0['name'];}_0x36185a[_0x4bc9('0x1e')](_0x450f86)[_0x4bc9('0x2f')](_0xae98e0);};}exports[_0x4bc9('0x30')]=function(_0x1d78b4,_0x36023e){var _0x59b7d8={},_0x35c974={},_0x11b1ec={'count':0x0,'rows':[]};var _0x219620=_[_0x4bc9('0x31')](db[_0x4bc9('0x32')][_0x4bc9('0x33')],function(_0x1c84e4){return{'name':_0x1c84e4[_0x4bc9('0x34')],'type':_0x1c84e4[_0x4bc9('0x35')]['key']};});_0x35c974[_0x4bc9('0x36')]=_[_0x4bc9('0x31')](_0x219620,'name');_0x35c974[_0x4bc9('0x37')]=_[_0x4bc9('0x38')](_0x1d78b4[_0x4bc9('0x37')]);_0x35c974[_0x4bc9('0x39')]=_[_0x4bc9('0x3a')](_0x35c974['model'],_0x35c974[_0x4bc9('0x37')]);_0x59b7d8[_0x4bc9('0x3b')]=_['intersection'](_0x35c974[_0x4bc9('0x36')],qs[_0x4bc9('0x3c')](_0x1d78b4['query'][_0x4bc9('0x3c')]));_0x59b7d8[_0x4bc9('0x3b')]=_0x59b7d8['attributes'][_0x4bc9('0x3d')]?_0x59b7d8[_0x4bc9('0x3b')]:_0x35c974[_0x4bc9('0x36')];if(!_0x1d78b4[_0x4bc9('0x37')][_0x4bc9('0x3e')](_0x4bc9('0x3f'))){_0x59b7d8[_0x4bc9('0x22')]=qs[_0x4bc9('0x22')](_0x1d78b4[_0x4bc9('0x37')]['limit']);_0x59b7d8[_0x4bc9('0x20')]=qs[_0x4bc9('0x20')](_0x1d78b4[_0x4bc9('0x37')][_0x4bc9('0x20')]);}_0x59b7d8['order']=qs[_0x4bc9('0x40')](_0x1d78b4[_0x4bc9('0x37')][_0x4bc9('0x40')]);_0x59b7d8[_0x4bc9('0x41')]=qs[_0x4bc9('0x39')](_[_0x4bc9('0x42')](_0x1d78b4[_0x4bc9('0x37')],_0x35c974[_0x4bc9('0x39')]),_0x219620);if(_0x1d78b4['query'][_0x4bc9('0x43')]){_0x59b7d8[_0x4bc9('0x41')]=_[_0x4bc9('0x44')](_0x59b7d8[_0x4bc9('0x41')],{'$or':[{'key':{'$like':'%'+_0x1d78b4['query'][_0x4bc9('0x43')]+'%'}},{'value':{'$like':'%'+_0x1d78b4[_0x4bc9('0x37')][_0x4bc9('0x43')]+'%'}}]});}_0x59b7d8=_[_0x4bc9('0x44')]({},_0x59b7d8,_0x1d78b4['options']);var _0xe1590={'where':_0x59b7d8[_0x4bc9('0x41')]};return db[_0x4bc9('0x32')][_0x4bc9('0x23')](_0xe1590)[_0x4bc9('0x28')](function(_0x5d2cab){_0x11b1ec[_0x4bc9('0x23')]=_0x5d2cab;if(_0x1d78b4[_0x4bc9('0x37')][_0x4bc9('0x45')]){_0x59b7d8[_0x4bc9('0x46')]=[{'all':!![]}];}return db[_0x4bc9('0x32')][_0x4bc9('0x47')](_0x59b7d8);})[_0x4bc9('0x28')](function(_0x26d003){_0x11b1ec[_0x4bc9('0x48')]=_0x26d003;return _0x11b1ec;})['then'](respondWithFilteredResult(_0x36023e,_0x59b7d8))['catch'](handleError(_0x36023e,null));};exports[_0x4bc9('0x49')]=function(_0x2e09d6,_0x561242){var _0x290d51={'raw':!![],'where':{'id':_0x2e09d6['params']['id']}},_0x4a67e6={};_0x4a67e6[_0x4bc9('0x36')]=_[_0x4bc9('0x38')](db[_0x4bc9('0x32')][_0x4bc9('0x33')]);_0x4a67e6[_0x4bc9('0x37')]=_['keys'](_0x2e09d6[_0x4bc9('0x37')]);_0x4a67e6[_0x4bc9('0x39')]=_[_0x4bc9('0x3a')](_0x4a67e6[_0x4bc9('0x36')],_0x4a67e6[_0x4bc9('0x37')]);_0x290d51[_0x4bc9('0x3b')]=_['intersection'](_0x4a67e6[_0x4bc9('0x36')],qs['fields'](_0x2e09d6[_0x4bc9('0x37')]['fields']));_0x290d51[_0x4bc9('0x3b')]=_0x290d51[_0x4bc9('0x3b')]['length']?_0x290d51[_0x4bc9('0x3b')]:_0x4a67e6[_0x4bc9('0x36')];if(_0x2e09d6['query'][_0x4bc9('0x45')]){_0x290d51[_0x4bc9('0x46')]=[{'all':!![]}];}_0x290d51=_[_0x4bc9('0x44')]({},_0x290d51,_0x2e09d6[_0x4bc9('0x4a')]);return db[_0x4bc9('0x32')]['find'](_0x290d51)[_0x4bc9('0x28')](handleEntityNotFound(_0x561242,null))[_0x4bc9('0x28')](respondWithResult(_0x561242,null))[_0x4bc9('0x4b')](handleError(_0x561242,null));};exports[_0x4bc9('0x27')]=function(_0x206776,_0xad5e44){if(_0x206776[_0x4bc9('0x4c')]['id']){delete _0x206776[_0x4bc9('0x4c')]['id'];}return db[_0x4bc9('0x32')][_0x4bc9('0x4d')]({'where':{'id':_0x206776[_0x4bc9('0x4e')]['id']}})[_0x4bc9('0x28')](handleEntityNotFound(_0xad5e44,null))[_0x4bc9('0x28')](saveUpdates(_0x206776['body'],null))[_0x4bc9('0x28')](respondWithResult(_0xad5e44,null))[_0x4bc9('0x4b')](handleError(_0xad5e44,null));};exports[_0x4bc9('0x4f')]=function(_0x52b003,_0xbff035){return db[_0x4bc9('0x32')][_0x4bc9('0x4d')]({'where':{'id':_0x52b003[_0x4bc9('0x4e')]['id']}})[_0x4bc9('0x28')](handleEntityNotFound(_0xbff035,null))[_0x4bc9('0x28')](removeEntity(_0xbff035,null))['catch'](handleError(_0xbff035,null));};exports[_0x4bc9('0x50')]=function(_0x1926ac,_0x28aa9c){var _0x336d5a={'key':_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x51')]};if(_0x1926ac['body']['MailAccountId']){_0x336d5a[_0x4bc9('0x52')]=_0x1926ac[_0x4bc9('0x4c')]['MailAccountId'];}else if(_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x53')]){_0x336d5a[_0x4bc9('0x53')]=_0x1926ac[_0x4bc9('0x4c')]['SmsAccountId'];}else if(_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x54')]){_0x336d5a[_0x4bc9('0x54')]=_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x54')];}else if(_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x55')]){_0x336d5a[_0x4bc9('0x55')]=_0x1926ac[_0x4bc9('0x4c')][_0x4bc9('0x55')];}return db[_0x4bc9('0x32')][_0x4bc9('0x4d')]({'where':_0x336d5a})[_0x4bc9('0x28')](function(_0x8e8671){if(_0x8e8671){throw new db[(_0x4bc9('0x56'))][(_0x4bc9('0x57'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x4bc9('0x32')]['create'](_0x1926ac[_0x4bc9('0x4c')]);})[_0x4bc9('0x28')](function(_0x52b193){var _0x296699=_0x1926ac[_0x4bc9('0x58')][_0x4bc9('0x29')]({'plain':!![]});if(!_0x296699)throw new Error(_0x4bc9('0x59'));if(_0x296699[_0x4bc9('0x5a')]===_0x4bc9('0x58')){var _0x4382a9=_0x52b193[_0x4bc9('0x29')]({'plain':!![]});return db[_0x4bc9('0x5b')][_0x4bc9('0x4d')]({'where':{'name':_0x4bc9('0x2a'),'userProfileId':_0x296699[_0x4bc9('0x5c')]},'raw':!![]})[_0x4bc9('0x28')](function(_0x3858fd){if(_0x3858fd&&_0x3858fd[_0x4bc9('0x5d')]===0x0){return db[_0x4bc9('0x2b')][_0x4bc9('0x50')]({'name':_0x4382a9[_0x4bc9('0x2e')],'resourceId':_0x4382a9['id'],'type':_0x3858fd[_0x4bc9('0x2e')],'sectionId':_0x3858fd['id']},{})[_0x4bc9('0x28')](function(){return _0x52b193;});}else{return _0x52b193;}})[_0x4bc9('0x4b')](function(_0x7ec10a){logger[_0x4bc9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7ec10a);throw _0x7ec10a;});}return _0x52b193;})[_0x4bc9('0x28')](respondWithResult(_0x28aa9c,0xc9))['catch'](handleError(_0x28aa9c,null));}; \ No newline at end of file +var _0x375e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','findAll','show','include','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','fieldName','type','key','model','map','keys','query','intersection','attributes'];(function(_0x19e425,_0x7f53c0){var _0x220e1d=function(_0x824c8){while(--_0x824c8){_0x19e425['push'](_0x19e425['shift']());}};_0x220e1d(++_0x7f53c0);}(_0x375e,0xce));var _0xe375=function(_0x4608c4,_0x51d3c5){_0x4608c4=_0x4608c4-0x0;var _0x4266db=_0x375e[_0x4608c4];return _0x4266db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe375('0x0'));var zipdir=require(_0xe375('0x1'));var jsonpatch=require(_0xe375('0x2'));var rp=require(_0xe375('0x3'));var moment=require(_0xe375('0x4'));var BPromise=require(_0xe375('0x5'));var Mustache=require(_0xe375('0x6'));var util=require('util');var path=require(_0xe375('0x7'));var sox=require(_0xe375('0x8'));var csv=require(_0xe375('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe375('0xa'));var squel=require(_0xe375('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe375('0xc'));var toCsv=require(_0xe375('0x9'));var querystring=require(_0xe375('0xd'));var Papa=require(_0xe375('0xe'));var Redis=require(_0xe375('0xf'));var authService=require(_0xe375('0x10'));var qs=require(_0xe375('0x11'));var as=require(_0xe375('0x12'));var hardwareService=require(_0xe375('0x13'));var logger=require(_0xe375('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xe375('0x15'));var licenseUtil=require(_0xe375('0x16'));var db=require(_0xe375('0x17'))['db'];function respondWithStatusCode(_0x2df643,_0x28cbff){_0x28cbff=_0x28cbff||0xcc;return function(_0x4359c5){if(_0x4359c5){return _0x2df643[_0xe375('0x18')](_0x28cbff);}return _0x2df643[_0xe375('0x19')](_0x28cbff)['end']();};}function respondWithResult(_0x23ebd4,_0x192ed2){_0x192ed2=_0x192ed2||0xc8;return function(_0x5a10a5){if(_0x5a10a5){return _0x23ebd4['status'](_0x192ed2)['json'](_0x5a10a5);}};}function respondWithFilteredResult(_0x16d786,_0xb0cb41){return function(_0x5400ad){if(_0x5400ad){var _0x15cde3=typeof _0xb0cb41[_0xe375('0x1a')]==='undefined'&&typeof _0xb0cb41['limit']===_0xe375('0x1b');var _0x5a36b2=_0x5400ad['count'];var _0x1e77b2=_0x15cde3?0x0:_0xb0cb41[_0xe375('0x1a')];var _0x35501a=_0x15cde3?_0x5400ad['count']:_0xb0cb41[_0xe375('0x1a')]+_0xb0cb41[_0xe375('0x1c')];var _0x1eafd1;if(_0x35501a>=_0x5a36b2){_0x35501a=_0x5a36b2;_0x1eafd1=0xc8;}else{_0x1eafd1=0xce;}_0x16d786['status'](_0x1eafd1);return _0x16d786['set'](_0xe375('0x1d'),_0x1e77b2+'-'+_0x35501a+'/'+_0x5a36b2)['json'](_0x5400ad);}return null;};}function patchUpdates(_0x305ad2){return function(_0x5d5f25){try{jsonpatch[_0xe375('0x1e')](_0x5d5f25,_0x305ad2,!![]);}catch(_0x357405){return BPromise[_0xe375('0x1f')](_0x357405);}return _0x5d5f25[_0xe375('0x20')]();};}function saveUpdates(_0xaca4fa,_0xcd5c35){return function(_0x2e4836){if(_0x2e4836){return _0x2e4836[_0xe375('0x21')](_0xaca4fa)[_0xe375('0x22')](function(_0x57a9c7){return _0x57a9c7;});}return null;};}function removeEntity(_0x5be3ef,_0xadf026){return function(_0x344977){if(_0x344977){return _0x344977[_0xe375('0x23')]()[_0xe375('0x22')](function(){var _0x173ea6=_0x344977[_0xe375('0x24')]({'plain':!![]});var _0x331af1=_0xe375('0x25');return db[_0xe375('0x26')]['destroy']({'where':{'type':_0x331af1,'resourceId':_0x173ea6['id']}})['then'](function(){return _0x344977;});})[_0xe375('0x22')](function(){_0x5be3ef[_0xe375('0x19')](0xcc)[_0xe375('0x27')]();});}};}function handleEntityNotFound(_0x46279d,_0x466613){return function(_0x2a6e90){if(!_0x2a6e90){_0x46279d[_0xe375('0x18')](0x194);}return _0x2a6e90;};}function handleError(_0x3e1402,_0x35dbb3){_0x35dbb3=_0x35dbb3||0x1f4;return function(_0x1fd4d4){logger[_0xe375('0x28')](_0x1fd4d4[_0xe375('0x29')]);if(_0x1fd4d4[_0xe375('0x2a')]){delete _0x1fd4d4[_0xe375('0x2a')];}_0x3e1402[_0xe375('0x19')](_0x35dbb3)[_0xe375('0x2b')](_0x1fd4d4);};}exports[_0xe375('0x2c')]=function(_0x35b2d3,_0x4dc744){var _0x4b1db6={},_0x42c86f={},_0x35d044={'count':0x0,'rows':[]};var _0x2e00be=_['map'](db[_0xe375('0x2d')]['rawAttributes'],function(_0x4453aa){return{'name':_0x4453aa[_0xe375('0x2e')],'type':_0x4453aa[_0xe375('0x2f')][_0xe375('0x30')]};});_0x42c86f[_0xe375('0x31')]=_[_0xe375('0x32')](_0x2e00be,_0xe375('0x2a'));_0x42c86f['query']=_[_0xe375('0x33')](_0x35b2d3[_0xe375('0x34')]);_0x42c86f['filters']=_[_0xe375('0x35')](_0x42c86f[_0xe375('0x31')],_0x42c86f[_0xe375('0x34')]);_0x4b1db6[_0xe375('0x36')]=_[_0xe375('0x35')](_0x42c86f['model'],qs[_0xe375('0x37')](_0x35b2d3[_0xe375('0x34')][_0xe375('0x37')]));_0x4b1db6[_0xe375('0x36')]=_0x4b1db6[_0xe375('0x36')][_0xe375('0x38')]?_0x4b1db6[_0xe375('0x36')]:_0x42c86f[_0xe375('0x31')];if(!_0x35b2d3['query'][_0xe375('0x39')](_0xe375('0x3a'))){_0x4b1db6[_0xe375('0x1c')]=qs[_0xe375('0x1c')](_0x35b2d3['query'][_0xe375('0x1c')]);_0x4b1db6[_0xe375('0x1a')]=qs[_0xe375('0x1a')](_0x35b2d3['query'][_0xe375('0x1a')]);}_0x4b1db6[_0xe375('0x3b')]=qs['sort'](_0x35b2d3['query'][_0xe375('0x3c')]);_0x4b1db6[_0xe375('0x3d')]=qs[_0xe375('0x3e')](_[_0xe375('0x3f')](_0x35b2d3[_0xe375('0x34')],_0x42c86f[_0xe375('0x3e')]),_0x2e00be);if(_0x35b2d3['query']['filter']){_0x4b1db6[_0xe375('0x3d')]=_['merge'](_0x4b1db6[_0xe375('0x3d')],{'$or':[{'key':{'$like':'%'+_0x35b2d3[_0xe375('0x34')][_0xe375('0x40')]+'%'}},{'value':{'$like':'%'+_0x35b2d3[_0xe375('0x34')][_0xe375('0x40')]+'%'}}]});}_0x4b1db6=_[_0xe375('0x41')]({},_0x4b1db6,_0x35b2d3[_0xe375('0x42')]);var _0x48181c={'where':_0x4b1db6['where']};return db[_0xe375('0x2d')][_0xe375('0x43')](_0x48181c)[_0xe375('0x22')](function(_0x54690f){_0x35d044[_0xe375('0x43')]=_0x54690f;if(_0x35b2d3[_0xe375('0x34')]['includeAll']){_0x4b1db6['include']=[{'all':!![]}];}return db[_0xe375('0x2d')][_0xe375('0x44')](_0x4b1db6);})[_0xe375('0x22')](function(_0xccf7be){_0x35d044['rows']=_0xccf7be;return _0x35d044;})['then'](respondWithFilteredResult(_0x4dc744,_0x4b1db6))['catch'](handleError(_0x4dc744,null));};exports[_0xe375('0x45')]=function(_0x116386,_0x5e6c3c){var _0x43168e={'raw':!![],'where':{'id':_0x116386['params']['id']}},_0xa02bc5={};_0xa02bc5[_0xe375('0x31')]=_[_0xe375('0x33')](db[_0xe375('0x2d')]['rawAttributes']);_0xa02bc5[_0xe375('0x34')]=_[_0xe375('0x33')](_0x116386['query']);_0xa02bc5['filters']=_['intersection'](_0xa02bc5[_0xe375('0x31')],_0xa02bc5[_0xe375('0x34')]);_0x43168e['attributes']=_['intersection'](_0xa02bc5[_0xe375('0x31')],qs[_0xe375('0x37')](_0x116386['query'][_0xe375('0x37')]));_0x43168e['attributes']=_0x43168e[_0xe375('0x36')][_0xe375('0x38')]?_0x43168e[_0xe375('0x36')]:_0xa02bc5[_0xe375('0x31')];if(_0x116386[_0xe375('0x34')]['includeAll']){_0x43168e[_0xe375('0x46')]=[{'all':!![]}];}_0x43168e=_[_0xe375('0x41')]({},_0x43168e,_0x116386[_0xe375('0x42')]);return db['CannedAnswer'][_0xe375('0x47')](_0x43168e)['then'](handleEntityNotFound(_0x5e6c3c,null))[_0xe375('0x22')](respondWithResult(_0x5e6c3c,null))[_0xe375('0x48')](handleError(_0x5e6c3c,null));};exports[_0xe375('0x21')]=function(_0x2dd315,_0x30be62){if(_0x2dd315[_0xe375('0x49')]['id']){delete _0x2dd315[_0xe375('0x49')]['id'];}return db[_0xe375('0x2d')][_0xe375('0x47')]({'where':{'id':_0x2dd315[_0xe375('0x4a')]['id']}})[_0xe375('0x22')](handleEntityNotFound(_0x30be62,null))[_0xe375('0x22')](saveUpdates(_0x2dd315[_0xe375('0x49')],null))['then'](respondWithResult(_0x30be62,null))[_0xe375('0x48')](handleError(_0x30be62,null));};exports['destroy']=function(_0x3453c2,_0x1aa059){return db[_0xe375('0x2d')][_0xe375('0x47')]({'where':{'id':_0x3453c2[_0xe375('0x4a')]['id']}})[_0xe375('0x22')](handleEntityNotFound(_0x1aa059,null))['then'](removeEntity(_0x1aa059,null))[_0xe375('0x48')](handleError(_0x1aa059,null));};exports[_0xe375('0x4b')]=function(_0x2051b2,_0xba38f8){var _0x1c8129={'key':_0x2051b2[_0xe375('0x49')][_0xe375('0x30')]};if(_0x2051b2[_0xe375('0x49')]['MailAccountId']){_0x1c8129['MailAccountId']=_0x2051b2['body'][_0xe375('0x4c')];}else if(_0x2051b2['body'][_0xe375('0x4d')]){_0x1c8129[_0xe375('0x4d')]=_0x2051b2[_0xe375('0x49')][_0xe375('0x4d')];}else if(_0x2051b2[_0xe375('0x49')][_0xe375('0x4e')]){_0x1c8129[_0xe375('0x4e')]=_0x2051b2[_0xe375('0x49')][_0xe375('0x4e')];}else if(_0x2051b2['body'][_0xe375('0x4f')]){_0x1c8129[_0xe375('0x4f')]=_0x2051b2[_0xe375('0x49')][_0xe375('0x4f')];}return db['CannedAnswer']['find']({'where':_0x1c8129})[_0xe375('0x22')](function(_0x388e2f){if(_0x388e2f){throw new db['Sequelize'][(_0xe375('0x50'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xe375('0x4b')](_0x2051b2[_0xe375('0x49')]);})[_0xe375('0x22')](function(_0x5d4f42){var _0x43beff=_0x2051b2[_0xe375('0x51')]['get']({'plain':!![]});if(!_0x43beff)throw new Error(_0xe375('0x52'));if(_0x43beff[_0xe375('0x53')]===_0xe375('0x51')){var _0xe8cc0=_0x5d4f42[_0xe375('0x24')]({'plain':!![]});return db[_0xe375('0x54')][_0xe375('0x47')]({'where':{'name':_0xe375('0x25'),'userProfileId':_0x43beff['userProfileId']},'raw':!![]})['then'](function(_0x3cd573){if(_0x3cd573&&_0x3cd573[_0xe375('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0xe8cc0[_0xe375('0x2a')],'resourceId':_0xe8cc0['id'],'type':_0x3cd573[_0xe375('0x2a')],'sectionId':_0x3cd573['id']},{})[_0xe375('0x22')](function(){return _0x5d4f42;});}else{return _0x5d4f42;}})[_0xe375('0x48')](function(_0x4426f4){logger[_0xe375('0x28')](_0xe375('0x56'),_0x4426f4);throw _0x4426f4;});}return _0x5d4f42;})['then'](respondWithResult(_0xba38f8,0xc9))[_0xe375('0x48')](handleError(_0xba38f8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9743aee..12a3ecc 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 _0x92f1=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','CannedAnswer'];(function(_0x3697ed,_0x137549){var _0x42d361=function(_0x303934){while(--_0x303934){_0x3697ed['push'](_0x3697ed['shift']());}};_0x42d361(++_0x137549);}(_0x92f1,0x1a3));var _0x192f=function(_0x39e18d,_0xe721e8){_0x39e18d=_0x39e18d-0x0;var _0x5e0034=_0x92f1[_0x39e18d];return _0x5e0034;};'use strict';var _=require(_0x192f('0x0'));var util=require(_0x192f('0x1'));var logger=require(_0x192f('0x2'))(_0x192f('0x3'));var moment=require('moment');var BPromise=require(_0x192f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x192f('0x5'));var rimraf=require('rimraf');var config=require(_0x192f('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x192f('0x7')]=function(_0x29fbba,_0x277897){return _0x29fbba[_0x192f('0x8')](_0x192f('0x9'),attributes,{'tableName':_0x192f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x192f('0xb'),'collate':_0x192f('0xc')});}; \ No newline at end of file +var _0x58a7=['bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0xe16d05,_0x26fd6){var _0x45ff26=function(_0x1d449e){while(--_0x1d449e){_0xe16d05['push'](_0xe16d05['shift']());}};_0x45ff26(++_0x26fd6);}(_0x58a7,0xf7));var _0x758a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x58a7[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x758a('0x0'));var util=require(_0x758a('0x1'));var logger=require(_0x758a('0x2'))(_0x758a('0x3'));var moment=require(_0x758a('0x4'));var BPromise=require(_0x758a('0x5'));var rp=require(_0x758a('0x6'));var fs=require('fs');var path=require(_0x758a('0x7'));var rimraf=require('rimraf');var config=require(_0x758a('0x8'));var attributes=require(_0x758a('0x9'));module[_0x758a('0xa')]=function(_0x294cf3,_0x5a34af){return _0x294cf3['define'](_0x758a('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x758a('0xc'),'collate':_0x758a('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index c8b082d..bc50ae3 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(_0x22f52b,_0x39cdfd){var _0x45c6ab=function(_0x326a20){while(--_0x326a20){_0x22f52b['push'](_0x22f52b['shift']());}};_0x45c6ab(++_0x39cdfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x2994aa,_0x3dda68){var _0x5ce4c7=function(_0xe498d4){while(--_0xe498d4){_0x2994aa['push'](_0x2994aa['shift']());}};_0x5ce4c7(++_0x3dda68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 9b26281..098136e 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 _0x6a4a=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','multer'];(function(_0x120042,_0x1dcb92){var _0x2f13ee=function(_0x1ab9ab){while(--_0x1ab9ab){_0x120042['push'](_0x120042['shift']());}};_0x2f13ee(++_0x1dcb92);}(_0x6a4a,0xb3));var _0xa6a4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6a4a[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0xa6a4('0x0'));var util=require(_0xa6a4('0x1'));var path=require(_0xa6a4('0x2'));var timeout=require(_0xa6a4('0x3'));var express=require(_0xa6a4('0x4'));var router=express['Router']();var fs_extra=require(_0xa6a4('0x5'));var auth=require(_0xa6a4('0x6'));var interaction=require(_0xa6a4('0x7'));var config=require(_0xa6a4('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xa6a4('0x9')](),controller['index']);router[_0xa6a4('0xa')](_0xa6a4('0xb'),auth[_0xa6a4('0x9')](),controller[_0xa6a4('0xc')]);router[_0xa6a4('0xd')]('/',auth[_0xa6a4('0x9')](),controller[_0xa6a4('0xe')]);router[_0xa6a4('0xf')](_0xa6a4('0xb'),auth[_0xa6a4('0x9')](),controller['update']);router[_0xa6a4('0x10')](_0xa6a4('0xb'),auth['isAuthenticated'](),controller[_0xa6a4('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaf8e=['post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x101116,_0xe71b75){var _0x25d117=function(_0x37b252){while(--_0x37b252){_0x101116['push'](_0x101116['shift']());}};_0x25d117(++_0xe71b75);}(_0xaf8e,0x169));var _0xeaf8=function(_0x2f809e,_0x187553){_0x2f809e=_0x2f809e-0x0;var _0x3dd8dd=_0xaf8e[_0x2f809e];return _0x3dd8dd;};'use strict';var multer=require(_0xeaf8('0x0'));var util=require(_0xeaf8('0x1'));var path=require('path');var timeout=require(_0xeaf8('0x2'));var express=require(_0xeaf8('0x3'));var router=express[_0xeaf8('0x4')]();var fs_extra=require(_0xeaf8('0x5'));var auth=require(_0xeaf8('0x6'));var interaction=require(_0xeaf8('0x7'));var config=require(_0xeaf8('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xeaf8('0x9')](_0xeaf8('0xa'),auth[_0xeaf8('0xb')](),controller[_0xeaf8('0xc')]);router[_0xeaf8('0xd')]('/',auth[_0xeaf8('0xb')](),controller[_0xeaf8('0xe')]);router['put']('/:id',auth[_0xeaf8('0xb')](),controller['update']);router[_0xeaf8('0xf')](_0xeaf8('0xa'),auth[_0xeaf8('0xb')](),controller['destroy']);module[_0xeaf8('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 dfbf303..7d495b9 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 _0x61be=['exports','DATE','STRING','sequelize'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x61be,0x1d7));var _0xe61b=function(_0x91abdd,_0x4e7e7d){_0x91abdd=_0x91abdd-0x0;var _0x3779ad=_0x61be[_0x91abdd];return _0x3779ad;};'use strict';var Sequelize=require(_0xe61b('0x0'));module[_0xe61b('0x1')]={'calldate':{'type':Sequelize[_0xe61b('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xe61b('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe61b('0x3')]},'dstchannel':{'type':Sequelize[_0xe61b('0x3')]},'lastapp':{'type':Sequelize[_0xe61b('0x3')]},'lastdata':{'type':Sequelize[_0xe61b('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe61b('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe61b('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xe61b('0x3')]},'sequence':{'type':Sequelize[_0xe61b('0x3')]},'peeraccount':{'type':Sequelize[_0xe61b('0x3')]},'type':{'type':Sequelize[_0xe61b('0x3')]},'tag':{'type':Sequelize[_0xe61b('0x3')]}}; \ No newline at end of file +var _0x58e9=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5371ef,_0x7fa109){var _0x46b1ee=function(_0x1ea254){while(--_0x1ea254){_0x5371ef['push'](_0x5371ef['shift']());}};_0x46b1ee(++_0x7fa109);}(_0x58e9,0x15e));var _0x958e=function(_0x56da45,_0x114642){_0x56da45=_0x56da45-0x0;var _0x31ccb0=_0x58e9[_0x56da45];return _0x31ccb0;};'use strict';var Sequelize=require(_0x958e('0x0'));module[_0x958e('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x958e('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x958e('0x3')]},'dst':{'type':Sequelize[_0x958e('0x3')]},'dcontext':{'type':Sequelize[_0x958e('0x3')]},'channel':{'type':Sequelize[_0x958e('0x3')]},'dstchannel':{'type':Sequelize[_0x958e('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x958e('0x3')]},'duration':{'type':Sequelize[_0x958e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x958e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x958e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x958e('0x3')]},'userfield':{'type':Sequelize[_0x958e('0x3')]},'uniqueid':{'type':Sequelize[_0x958e('0x3')]},'linkedid':{'type':Sequelize[_0x958e('0x3')]},'sequence':{'type':Sequelize[_0x958e('0x3')]},'peeraccount':{'type':Sequelize[_0x958e('0x3')]},'type':{'type':Sequelize[_0x958e('0x3')]},'tag':{'type':Sequelize[_0x958e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b175175..f3f256a 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 _0x1af3=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x4f0302,_0x5affd5){var _0x52988f=function(_0x53dc1f){while(--_0x53dc1f){_0x4f0302['push'](_0x4f0302['shift']());}};_0x52988f(++_0x5affd5);}(_0x1af3,0x1ca));var _0x31af=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0x1af3[_0x42020e];return _0x561551;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={},_0x3eb61f={},_0x1e6df8={'count':0x0,'rows':[]};var _0x1f4eae=_[_0x31af('0x31')](db[_0x31af('0x32')][_0x31af('0x33')],function(_0x231438){return{'name':_0x231438[_0x31af('0x34')],'type':_0x231438[_0x31af('0x35')][_0x31af('0x36')]};});_0x3eb61f[_0x31af('0x37')]=_['map'](_0x1f4eae,_0x31af('0x2e'));_0x3eb61f[_0x31af('0x38')]=_['keys'](_0x3326a7['query']);_0x3eb61f['filters']=_[_0x31af('0x39')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x38')]);_0xb1f5b1[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x3eb61f[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x3326a7[_0x31af('0x38')]['fields']));_0xb1f5b1[_0x31af('0x3a')]=_0xb1f5b1[_0x31af('0x3a')][_0x31af('0x3c')]?_0xb1f5b1[_0x31af('0x3a')]:_0x3eb61f[_0x31af('0x37')];if(!_0x3326a7[_0x31af('0x38')][_0x31af('0x3d')](_0x31af('0x3e'))){_0xb1f5b1['limit']=qs[_0x31af('0x23')](_0x3326a7['query'][_0x31af('0x23')]);_0xb1f5b1[_0x31af('0x20')]=qs[_0x31af('0x20')](_0x3326a7[_0x31af('0x38')][_0x31af('0x20')]);}_0xb1f5b1['order']=qs['sort'](_0x3326a7['query'][_0x31af('0x3f')]);_0xb1f5b1[_0x31af('0x40')]=qs[_0x31af('0x41')](_[_0x31af('0x42')](_0x3326a7[_0x31af('0x38')],_0x3eb61f[_0x31af('0x41')]),_0x1f4eae);if(_0x3326a7[_0x31af('0x38')][_0x31af('0x43')]){_0xb1f5b1['where']=_[_0x31af('0x44')](_0xb1f5b1[_0x31af('0x40')],{'$or':_[_0x31af('0x31')](_0x1f4eae,function(_0x2a5cde){if(_0x2a5cde[_0x31af('0x35')]!==_0x31af('0x45')){var _0x32d1b9={};_0x32d1b9[_0x2a5cde[_0x31af('0x2e')]]={'$like':'%'+_0x3326a7[_0x31af('0x38')]['filter']+'%'};return _0x32d1b9;}})});}_0xb1f5b1=_[_0x31af('0x44')]({},_0xb1f5b1,_0x3326a7['options']);var _0x447a01={'where':_0xb1f5b1['where']};return db['Cdr'][_0x31af('0x22')](_0x447a01)[_0x31af('0x2a')](function(_0x110f38){_0x1e6df8[_0x31af('0x22')]=_0x110f38;if(_0x3326a7[_0x31af('0x38')][_0x31af('0x46')]){_0xb1f5b1[_0x31af('0x47')]=[{'all':!![]}];}return db['Cdr'][_0x31af('0x48')](_0xb1f5b1);})[_0x31af('0x2a')](function(_0xb53565){_0x1e6df8['rows']=_0xb53565;return _0x1e6df8;})[_0x31af('0x2a')](respondWithFilteredResult(_0x5a1f41,_0xb1f5b1))[_0x31af('0x49')](handleError(_0x5a1f41,null));};exports[_0x31af('0x4a')]=function(_0x23942b,_0x34205a){var _0x57da2c={'raw':!![],'where':{'id':_0x23942b[_0x31af('0x4b')]['id']}},_0x12357c={};_0x12357c[_0x31af('0x37')]=_[_0x31af('0x4c')](db['Cdr'][_0x31af('0x33')]);_0x12357c[_0x31af('0x38')]=_['keys'](_0x23942b[_0x31af('0x38')]);_0x12357c[_0x31af('0x41')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],_0x12357c[_0x31af('0x38')]);_0x57da2c[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x23942b[_0x31af('0x38')]['fields']));_0x57da2c['attributes']=_0x57da2c[_0x31af('0x3a')]['length']?_0x57da2c[_0x31af('0x3a')]:_0x12357c[_0x31af('0x37')];if(_0x23942b[_0x31af('0x38')]['includeAll']){_0x57da2c['include']=[{'all':!![]}];}_0x57da2c=_[_0x31af('0x44')]({},_0x57da2c,_0x23942b['options']);return db[_0x31af('0x32')][_0x31af('0x4d')](_0x57da2c)[_0x31af('0x2a')](handleEntityNotFound(_0x34205a,null))[_0x31af('0x2a')](respondWithResult(_0x34205a,null))['catch'](handleError(_0x34205a,null));};exports['create']=function(_0x407386,_0x3acff1){return db[_0x31af('0x32')][_0x31af('0x4e')](_0x407386['body'],{})[_0x31af('0x2a')](respondWithResult(_0x3acff1,0xc9))[_0x31af('0x49')](handleError(_0x3acff1,null));};exports[_0x31af('0x29')]=function(_0x4ad7a6,_0x5a1cbe){if(_0x4ad7a6[_0x31af('0x4f')]['id']){delete _0x4ad7a6[_0x31af('0x4f')]['id'];}return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x4ad7a6[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x5a1cbe,null))[_0x31af('0x2a')](saveUpdates(_0x4ad7a6[_0x31af('0x4f')],null))[_0x31af('0x2a')](respondWithResult(_0x5a1cbe,null))[_0x31af('0x49')](handleError(_0x5a1cbe,null));};exports['destroy']=function(_0x441362,_0x29de7e){return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x441362[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x29de7e,null))[_0x31af('0x2a')](removeEntity(_0x29de7e,null))[_0x31af('0x49')](handleError(_0x29de7e,null));};exports[_0x31af('0x50')]=function(_0x25369b,_0x3bfbae){return db[_0x31af('0x32')][_0x31af('0x50')]()[_0x31af('0x2a')](respondWithResult(_0x3bfbae,null))['catch'](handleError(_0x3bfbae,null));}; \ No newline at end of file +var _0xfd0f=['moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','findAll','catch','show','params','keys','intersection','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2300fa,_0x41c382){var _0x11fef0=function(_0x597ffb){while(--_0x597ffb){_0x2300fa['push'](_0x2300fa['shift']());}};_0x11fef0(++_0x41c382);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x5e871e,_0x4844ba){_0x5e871e=_0x5e871e-0x0;var _0x5086a9=_0xfd0f[_0x5e871e];return _0x5086a9;};'use strict';var emlformat=require(_0xffd0('0x0'));var rimraf=require(_0xffd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd0('0x2'));var rp=require(_0xffd0('0x3'));var moment=require(_0xffd0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffd0('0x5'));var util=require('util');var path=require(_0xffd0('0x6'));var sox=require(_0xffd0('0x7'));var csv=require(_0xffd0('0x8'));var ejs=require(_0xffd0('0x9'));var fs=require('fs');var fs_extra=require(_0xffd0('0xa'));var _=require(_0xffd0('0xb'));var squel=require(_0xffd0('0xc'));var crypto=require(_0xffd0('0xd'));var jsforce=require(_0xffd0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffd0('0x8'));var querystring=require(_0xffd0('0xf'));var Papa=require(_0xffd0('0x10'));var Redis=require(_0xffd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xffd0('0x12'));var hardwareService=require(_0xffd0('0x13'));var logger=require(_0xffd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xffd0('0x15'));var licenseUtil=require(_0xffd0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6e1ad,_0xaf12c1){_0xaf12c1=_0xaf12c1||0xcc;return function(_0x2ca16d){if(_0x2ca16d){return _0xa6e1ad['sendStatus'](_0xaf12c1);}return _0xa6e1ad[_0xffd0('0x17')](_0xaf12c1)[_0xffd0('0x18')]();};}function respondWithResult(_0x5be5aa,_0x3cf549){_0x3cf549=_0x3cf549||0xc8;return function(_0x48fc60){if(_0x48fc60){return _0x5be5aa['status'](_0x3cf549)[_0xffd0('0x19')](_0x48fc60);}};}function respondWithFilteredResult(_0x5c799c,_0x321ceb){return function(_0x2e030d){if(_0x2e030d){var _0x15e710=typeof _0x321ceb[_0xffd0('0x1a')]===_0xffd0('0x1b')&&typeof _0x321ceb['limit']==='undefined';var _0x285c52=_0x2e030d[_0xffd0('0x1c')];var _0x2e9463=_0x15e710?0x0:_0x321ceb[_0xffd0('0x1a')];var _0x409b90=_0x15e710?_0x2e030d[_0xffd0('0x1c')]:_0x321ceb[_0xffd0('0x1a')]+_0x321ceb[_0xffd0('0x1d')];var _0x684579;if(_0x409b90>=_0x285c52){_0x409b90=_0x285c52;_0x684579=0xc8;}else{_0x684579=0xce;}_0x5c799c[_0xffd0('0x17')](_0x684579);return _0x5c799c[_0xffd0('0x1e')](_0xffd0('0x1f'),_0x2e9463+'-'+_0x409b90+'/'+_0x285c52)[_0xffd0('0x19')](_0x2e030d);}return null;};}function patchUpdates(_0x19c523){return function(_0x3deed6){try{jsonpatch[_0xffd0('0x20')](_0x3deed6,_0x19c523,!![]);}catch(_0x5219ca){return BPromise['reject'](_0x5219ca);}return _0x3deed6[_0xffd0('0x21')]();};}function saveUpdates(_0x13c117,_0x4fbb72){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xffd0('0x22')](_0x13c117)['then'](function(_0x10467e){return _0x10467e;});}return null;};}function removeEntity(_0x329864,_0x2c8d64){return function(_0x38f25f){if(_0x38f25f){return _0x38f25f[_0xffd0('0x23')]()[_0xffd0('0x24')](function(){_0x329864[_0xffd0('0x17')](0xcc)[_0xffd0('0x18')]();});}};}function handleEntityNotFound(_0x2e3046,_0x169036){return function(_0x278ba8){if(!_0x278ba8){_0x2e3046[_0xffd0('0x25')](0x194);}return _0x278ba8;};}function handleError(_0x24f135,_0x481c52){_0x481c52=_0x481c52||0x1f4;return function(_0x480322){logger[_0xffd0('0x26')](_0x480322['stack']);if(_0x480322['name']){delete _0x480322[_0xffd0('0x27')];}_0x24f135[_0xffd0('0x17')](_0x481c52)[_0xffd0('0x28')](_0x480322);};}exports[_0xffd0('0x29')]=function(_0x3f5423,_0x22c7fb){var _0x4f8d9c={},_0x14ded1={},_0x4e7367={'count':0x0,'rows':[]};var _0x5c4adb=_['map'](db[_0xffd0('0x2a')][_0xffd0('0x2b')],function(_0x3b71ac){return{'name':_0x3b71ac[_0xffd0('0x2c')],'type':_0x3b71ac[_0xffd0('0x2d')][_0xffd0('0x2e')]};});_0x14ded1['model']=_['map'](_0x5c4adb,'name');_0x14ded1[_0xffd0('0x2f')]=_['keys'](_0x3f5423[_0xffd0('0x2f')]);_0x14ded1[_0xffd0('0x30')]=_['intersection'](_0x14ded1[_0xffd0('0x31')],_0x14ded1['query']);_0x4f8d9c['attributes']=_['intersection'](_0x14ded1[_0xffd0('0x31')],qs[_0xffd0('0x32')](_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x32')]));_0x4f8d9c[_0xffd0('0x33')]=_0x4f8d9c['attributes'][_0xffd0('0x34')]?_0x4f8d9c[_0xffd0('0x33')]:_0x14ded1['model'];if(!_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x35')](_0xffd0('0x36'))){_0x4f8d9c[_0xffd0('0x1d')]=qs[_0xffd0('0x1d')](_0x3f5423[_0xffd0('0x2f')]['limit']);_0x4f8d9c[_0xffd0('0x1a')]=qs[_0xffd0('0x1a')](_0x3f5423['query'][_0xffd0('0x1a')]);}_0x4f8d9c[_0xffd0('0x37')]=qs['sort'](_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x38')]);_0x4f8d9c['where']=qs[_0xffd0('0x30')](_['pick'](_0x3f5423[_0xffd0('0x2f')],_0x14ded1[_0xffd0('0x30')]),_0x5c4adb);if(_0x3f5423['query'][_0xffd0('0x39')]){_0x4f8d9c[_0xffd0('0x3a')]=_[_0xffd0('0x3b')](_0x4f8d9c[_0xffd0('0x3a')],{'$or':_[_0xffd0('0x3c')](_0x5c4adb,function(_0x158efc){if(_0x158efc[_0xffd0('0x2d')]!==_0xffd0('0x3d')){var _0x1cdd8f={};_0x1cdd8f[_0x158efc[_0xffd0('0x27')]]={'$like':'%'+_0x3f5423[_0xffd0('0x2f')][_0xffd0('0x39')]+'%'};return _0x1cdd8f;}})});}_0x4f8d9c=_[_0xffd0('0x3b')]({},_0x4f8d9c,_0x3f5423[_0xffd0('0x3e')]);var _0x5aa4d3={'where':_0x4f8d9c[_0xffd0('0x3a')]};return db[_0xffd0('0x2a')]['count'](_0x5aa4d3)[_0xffd0('0x24')](function(_0xea6cbd){_0x4e7367[_0xffd0('0x1c')]=_0xea6cbd;if(_0x3f5423[_0xffd0('0x2f')]['includeAll']){_0x4f8d9c['include']=[{'all':!![]}];}return db[_0xffd0('0x2a')][_0xffd0('0x3f')](_0x4f8d9c);})[_0xffd0('0x24')](function(_0xc0aa){_0x4e7367['rows']=_0xc0aa;return _0x4e7367;})[_0xffd0('0x24')](respondWithFilteredResult(_0x22c7fb,_0x4f8d9c))[_0xffd0('0x40')](handleError(_0x22c7fb,null));};exports[_0xffd0('0x41')]=function(_0x3bd3e3,_0x237a71){var _0x46833e={'raw':!![],'where':{'id':_0x3bd3e3[_0xffd0('0x42')]['id']}},_0x9558c0={};_0x9558c0[_0xffd0('0x31')]=_[_0xffd0('0x43')](db[_0xffd0('0x2a')][_0xffd0('0x2b')]);_0x9558c0[_0xffd0('0x2f')]=_[_0xffd0('0x43')](_0x3bd3e3[_0xffd0('0x2f')]);_0x9558c0[_0xffd0('0x30')]=_[_0xffd0('0x44')](_0x9558c0[_0xffd0('0x31')],_0x9558c0[_0xffd0('0x2f')]);_0x46833e[_0xffd0('0x33')]=_[_0xffd0('0x44')](_0x9558c0['model'],qs[_0xffd0('0x32')](_0x3bd3e3[_0xffd0('0x2f')][_0xffd0('0x32')]));_0x46833e[_0xffd0('0x33')]=_0x46833e[_0xffd0('0x33')][_0xffd0('0x34')]?_0x46833e[_0xffd0('0x33')]:_0x9558c0[_0xffd0('0x31')];if(_0x3bd3e3[_0xffd0('0x2f')]['includeAll']){_0x46833e[_0xffd0('0x45')]=[{'all':!![]}];}_0x46833e=_[_0xffd0('0x3b')]({},_0x46833e,_0x3bd3e3[_0xffd0('0x3e')]);return db[_0xffd0('0x2a')][_0xffd0('0x46')](_0x46833e)['then'](handleEntityNotFound(_0x237a71,null))['then'](respondWithResult(_0x237a71,null))['catch'](handleError(_0x237a71,null));};exports[_0xffd0('0x47')]=function(_0xcae782,_0x5b3515){return db[_0xffd0('0x2a')][_0xffd0('0x47')](_0xcae782[_0xffd0('0x48')],{})[_0xffd0('0x24')](respondWithResult(_0x5b3515,0xc9))[_0xffd0('0x40')](handleError(_0x5b3515,null));};exports[_0xffd0('0x22')]=function(_0x3b70a7,_0x2c0ffd){if(_0x3b70a7[_0xffd0('0x48')]['id']){delete _0x3b70a7[_0xffd0('0x48')]['id'];}return db[_0xffd0('0x2a')][_0xffd0('0x46')]({'where':{'id':_0x3b70a7[_0xffd0('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c0ffd,null))['then'](saveUpdates(_0x3b70a7[_0xffd0('0x48')],null))[_0xffd0('0x24')](respondWithResult(_0x2c0ffd,null))[_0xffd0('0x40')](handleError(_0x2c0ffd,null));};exports['destroy']=function(_0x35b42e,_0x4bde7d){return db[_0xffd0('0x2a')][_0xffd0('0x46')]({'where':{'id':_0x35b42e[_0xffd0('0x42')]['id']}})[_0xffd0('0x24')](handleEntityNotFound(_0x4bde7d,null))['then'](removeEntity(_0x4bde7d,null))['catch'](handleError(_0x4bde7d,null));};exports['describe']=function(_0x2a0302,_0x24a18d){return db[_0xffd0('0x2a')][_0xffd0('0x49')]()[_0xffd0('0x24')](respondWithResult(_0x24a18d,null))[_0xffd0('0x40')](handleError(_0x24a18d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e8e6fa9..968a812 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4f5ba9,_0x507e88){var _0x357bc2=function(_0xa85006){while(--_0xa85006){_0x4f5ba9['push'](_0x4f5ba9['shift']());}};_0x357bc2(++_0x507e88);}(_0x7a54,0x106));var _0x47a5=function(_0x16a73a,_0x4df5bf){_0x16a73a=_0x16a73a-0x0;var _0x1c614f=_0x7a54[_0x16a73a];return _0x1c614f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x5cd25f,_0x5baf7e){var _0x30e390=function(_0x313003){while(--_0x313003){_0x5cd25f['push'](_0x5cd25f['shift']());}};_0x30e390(++_0x5baf7e);}(_0x7a54,0x106));var _0x47a5=function(_0x53567a,_0xe0ae6b){_0x53567a=_0x53567a-0x0;var _0x2697d0=_0x7a54[_0x53567a];return _0x2697d0;};'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 4b7ed5b..c728261 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 _0x1c81=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0xad9e64,_0x3ec5cc){var _0x1efabb=function(_0x9e10a2){while(--_0x9e10a2){_0xad9e64['push'](_0xad9e64['shift']());}};_0x1efabb(++_0x3ec5cc);}(_0x1c81,0xe9));var _0x11c8=function(_0x1c2323,_0x9770ee){_0x1c2323=_0x1c2323-0x0;var _0x3e5ed9=_0x1c81[_0x1c2323];return _0x3e5ed9;};'use strict';var _=require(_0x11c8('0x0'));var util=require(_0x11c8('0x1'));var moment=require(_0x11c8('0x2'));var BPromise=require(_0x11c8('0x3'));var rs=require(_0x11c8('0x4'));var fs=require('fs');var Redis=require(_0x11c8('0x5'));var db=require(_0x11c8('0x6'))['db'];var utils=require(_0x11c8('0x7'));var logger=require(_0x11c8('0x8'))('rpc');var config=require(_0x11c8('0x9'));var jayson=require(_0x11c8('0xa'));var client=jayson[_0x11c8('0xb')][_0x11c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x64d97a,_0x4e32e0,_0x2aa354){return new BPromise(function(_0x4a514b,_0x51ab93){return client[_0x11c8('0xd')](_0x64d97a,_0x2aa354)['then'](function(_0x4f7391){logger[_0x11c8('0xe')](_0x11c8('0xf'),_0x4e32e0,_0x11c8('0x10'));logger[_0x11c8('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x4e32e0,_0x11c8('0x10'),JSON['stringify'](_0x4f7391));if(_0x4f7391[_0x11c8('0x12')]){if(_0x4f7391[_0x11c8('0x12')][_0x11c8('0x13')]===0x1f4){logger['error'](_0x11c8('0xf'),_0x4e32e0,_0x4f7391['error'][_0x11c8('0x14')]);return _0x51ab93(_0x4f7391[_0x11c8('0x12')][_0x11c8('0x14')]);}logger[_0x11c8('0x12')](_0x11c8('0xf'),_0x4e32e0,_0x4f7391[_0x11c8('0x12')][_0x11c8('0x14')]);return _0x4a514b(_0x4f7391[_0x11c8('0x12')]['message']);}else{logger[_0x11c8('0xe')](_0x11c8('0xf'),_0x4e32e0,_0x11c8('0x10'));_0x4a514b(_0x4f7391['result'][_0x11c8('0x14')]);}})['catch'](function(_0x15d150){logger[_0x11c8('0x12')](_0x11c8('0xf'),_0x4e32e0,_0x15d150);_0x51ab93(_0x15d150);});});} \ No newline at end of file +var _0xaef8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ee7e2,_0x15cf09){var _0x1c1f18=function(_0x3426e0){while(--_0x3426e0){_0x3ee7e2['push'](_0x3ee7e2['shift']());}};_0x1c1f18(++_0x15cf09);}(_0xaef8,0x94));var _0x8aef=function(_0x15b042,_0x23fd98){_0x15b042=_0x15b042-0x0;var _0x440fb0=_0xaef8[_0x15b042];return _0x440fb0;};'use strict';var _=require(_0x8aef('0x0'));var util=require(_0x8aef('0x1'));var moment=require(_0x8aef('0x2'));var BPromise=require(_0x8aef('0x3'));var rs=require(_0x8aef('0x4'));var fs=require('fs');var Redis=require(_0x8aef('0x5'));var db=require(_0x8aef('0x6'))['db'];var utils=require(_0x8aef('0x7'));var logger=require(_0x8aef('0x8'))(_0x8aef('0x9'));var config=require(_0x8aef('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36eacb,_0x597d1a,_0x3bde61){return new BPromise(function(_0x191f54,_0x89cddf){return client['request'](_0x36eacb,_0x3bde61)[_0x8aef('0xc')](function(_0x7d5a39){logger[_0x8aef('0xd')]('Cdr,\x20%s,\x20%s',_0x597d1a,_0x8aef('0xe'));logger[_0x8aef('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x597d1a,_0x8aef('0xe'),JSON[_0x8aef('0x10')](_0x7d5a39));if(_0x7d5a39[_0x8aef('0x11')]){if(_0x7d5a39[_0x8aef('0x11')][_0x8aef('0x12')]===0x1f4){logger[_0x8aef('0x11')](_0x8aef('0x13'),_0x597d1a,_0x7d5a39[_0x8aef('0x11')][_0x8aef('0x14')]);return _0x89cddf(_0x7d5a39['error'][_0x8aef('0x14')]);}logger[_0x8aef('0x11')](_0x8aef('0x13'),_0x597d1a,_0x7d5a39[_0x8aef('0x11')]['message']);return _0x191f54(_0x7d5a39[_0x8aef('0x11')][_0x8aef('0x14')]);}else{logger[_0x8aef('0xd')](_0x8aef('0x13'),_0x597d1a,_0x8aef('0xe'));_0x191f54(_0x7d5a39['result']['message']);}})[_0x8aef('0x15')](function(_0x3b7df2){logger[_0x8aef('0x11')](_0x8aef('0x13'),_0x597d1a,_0x3b7df2);_0x89cddf(_0x3b7df2);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ebbd6ca..6926b86 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_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('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','./cdr.controller','get','index','/describe','show','post'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2c96ba8..881c463 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 _0xf857=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x133e62,_0x315390){var _0x8f88af=function(_0x32d220){while(--_0x32d220){_0x133e62['push'](_0x133e62['shift']());}};_0x8f88af(++_0x315390);}(_0xf857,0x166));var _0x7f85=function(_0x26d509,_0x2870f6){_0x26d509=_0x26d509-0x0;var _0x2a26be=_0xf857[_0x26d509];return _0x2a26be;};'use strict';var Sequelize=require('sequelize');module[_0x7f85('0x0')]={'priority':{'type':Sequelize[_0x7f85('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7f85('0x2')],'allowNull':![],'defaultValue':_0x7f85('0x3')},'appdata':{'type':Sequelize[_0x7f85('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7f85('0x2')],'defaultValue':_0x7f85('0x5')}}; \ No newline at end of file +var _0x3d6f=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3d6f,0x6d));var _0xf3d6=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x3d6f[_0xb66df];return _0x42a702;};'use strict';var Sequelize=require(_0xf3d6('0x0'));module[_0xf3d6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf3d6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf3d6('0x3')]()},'description':{'type':Sequelize[_0xf3d6('0x2')]},'interval':{'type':Sequelize[_0xf3d6('0x2')],'defaultValue':_0xf3d6('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fc6498a..5b64c90 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 _0x0269=['fields','length','includeAll','include','merge','find','catch','update','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes'];(function(_0x1a2e2c,_0x4f69a3){var _0x31075e=function(_0x4a51ea){while(--_0x4a51ea){_0x1a2e2c['push'](_0x1a2e2c['shift']());}};_0x31075e(++_0x4f69a3);}(_0x0269,0x135));var _0x9026=function(_0x2bd31e,_0x365971){_0x2bd31e=_0x2bd31e-0x0;var _0x26fe2c=_0x0269[_0x2bd31e];return _0x26fe2c;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9026('0x10'));var as=require(_0x9026('0x11'));var hardwareService=require(_0x9026('0x12'));var logger=require('../../config/logger')(_0x9026('0x13'));var utils=require('../../config/utils');var config=require(_0x9026('0x14'));var licenseUtil=require(_0x9026('0x15'));var db=require(_0x9026('0x16'))['db'];function respondWithStatusCode(_0x2148f0,_0x40f526){_0x40f526=_0x40f526||0xcc;return function(_0x40b5dd){if(_0x40b5dd){return _0x2148f0[_0x9026('0x17')](_0x40f526);}return _0x2148f0['status'](_0x40f526)[_0x9026('0x18')]();};}function respondWithResult(_0x4ee699,_0x385afc){_0x385afc=_0x385afc||0xc8;return function(_0x2612cd){if(_0x2612cd){return _0x4ee699[_0x9026('0x19')](_0x385afc)[_0x9026('0x1a')](_0x2612cd);}};}function respondWithFilteredResult(_0x11c0d1,_0x421ee2){return function(_0x142465){if(_0x142465){var _0x1eb679=typeof _0x421ee2['offset']===_0x9026('0x1b')&&typeof _0x421ee2[_0x9026('0x1c')]==='undefined';var _0xc68011=_0x142465[_0x9026('0x1d')];var _0x15b3ab=_0x1eb679?0x0:_0x421ee2[_0x9026('0x1e')];var _0x1d1613=_0x1eb679?_0x142465[_0x9026('0x1d')]:_0x421ee2[_0x9026('0x1e')]+_0x421ee2[_0x9026('0x1c')];var _0x52edf1;if(_0x1d1613>=_0xc68011){_0x1d1613=_0xc68011;_0x52edf1=0xc8;}else{_0x52edf1=0xce;}_0x11c0d1[_0x9026('0x19')](_0x52edf1);return _0x11c0d1['set'](_0x9026('0x1f'),_0x15b3ab+'-'+_0x1d1613+'/'+_0xc68011)['json'](_0x142465);}return null;};}function patchUpdates(_0x2a9bf0){return function(_0x1b03af){try{jsonpatch[_0x9026('0x20')](_0x1b03af,_0x2a9bf0,!![]);}catch(_0x22a77c){return BPromise[_0x9026('0x21')](_0x22a77c);}return _0x1b03af[_0x9026('0x22')]();};}function saveUpdates(_0x71a263,_0x39f515){return function(_0x12e0b3){if(_0x12e0b3){return _0x12e0b3['update'](_0x71a263)['then'](function(_0x7b962){return _0x7b962;});}return null;};}function removeEntity(_0x134221,_0x2968fb){return function(_0x82a8e0){if(_0x82a8e0){return _0x82a8e0[_0x9026('0x23')]()[_0x9026('0x24')](function(){_0x134221[_0x9026('0x19')](0xcc)[_0x9026('0x18')]();});}};}function handleEntityNotFound(_0x775596,_0x4293df){return function(_0xde5c83){if(!_0xde5c83){_0x775596[_0x9026('0x17')](0x194);}return _0xde5c83;};}function handleError(_0x38fd9c,_0x2ace13){_0x2ace13=_0x2ace13||0x1f4;return function(_0x28dba4){logger[_0x9026('0x25')](_0x28dba4[_0x9026('0x26')]);if(_0x28dba4[_0x9026('0x27')]){delete _0x28dba4[_0x9026('0x27')];}_0x38fd9c['status'](_0x2ace13)[_0x9026('0x28')](_0x28dba4);};}exports[_0x9026('0x29')]=function(_0x30c988,_0x103ce7){var _0x17dc25={'raw':!![],'where':{'id':_0x30c988[_0x9026('0x2a')]['id']}},_0x3cead8={};_0x3cead8[_0x9026('0x2b')]=_[_0x9026('0x2c')](db[_0x9026('0x2d')][_0x9026('0x2e')]);_0x3cead8['query']=_[_0x9026('0x2c')](_0x30c988[_0x9026('0x2f')]);_0x3cead8[_0x9026('0x30')]=_[_0x9026('0x31')](_0x3cead8[_0x9026('0x2b')],_0x3cead8[_0x9026('0x2f')]);_0x17dc25[_0x9026('0x32')]=_['intersection'](_0x3cead8[_0x9026('0x2b')],qs['fields'](_0x30c988[_0x9026('0x2f')][_0x9026('0x33')]));_0x17dc25[_0x9026('0x32')]=_0x17dc25[_0x9026('0x32')][_0x9026('0x34')]?_0x17dc25[_0x9026('0x32')]:_0x3cead8['model'];if(_0x30c988[_0x9026('0x2f')][_0x9026('0x35')]){_0x17dc25[_0x9026('0x36')]=[{'all':!![]}];}_0x17dc25=_[_0x9026('0x37')]({},_0x17dc25,_0x30c988['options']);return db[_0x9026('0x2d')][_0x9026('0x38')](_0x17dc25)['then'](handleEntityNotFound(_0x103ce7,null))[_0x9026('0x24')](respondWithResult(_0x103ce7,null))[_0x9026('0x39')](handleError(_0x103ce7,null));};exports[_0x9026('0x3a')]=function(_0xe63aad,_0x333e59){if(_0xe63aad[_0x9026('0x3b')]['id']){delete _0xe63aad[_0x9026('0x3b')]['id'];}return db[_0x9026('0x2d')]['find']({'where':{'id':_0xe63aad[_0x9026('0x2a')]['id']}})[_0x9026('0x24')](handleEntityNotFound(_0x333e59,null))['then'](saveUpdates(_0xe63aad[_0x9026('0x3b')],null))[_0x9026('0x24')](respondWithResult(_0x333e59,null))[_0x9026('0x39')](handleError(_0x333e59,null));};exports[_0x9026('0x23')]=function(_0xa251a,_0x240f8a){return db[_0x9026('0x2d')][_0x9026('0x38')]({'where':{'id':_0xa251a['params']['id']}})[_0x9026('0x24')](handleEntityNotFound(_0x240f8a,null))[_0x9026('0x24')](removeEntity(_0x240f8a,null))[_0x9026('0x39')](handleError(_0x240f8a,null));}; \ No newline at end of file +var _0x4ad3=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x4ad3[_0x5180c3];return _0x55c975;};'use strict';var emlformat=require(_0x34ad('0x0'));var rimraf=require(_0x34ad('0x1'));var zipdir=require(_0x34ad('0x2'));var jsonpatch=require(_0x34ad('0x3'));var rp=require(_0x34ad('0x4'));var moment=require(_0x34ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x34ad('0x6'));var util=require(_0x34ad('0x7'));var path=require(_0x34ad('0x8'));var sox=require(_0x34ad('0x9'));var csv=require(_0x34ad('0xa'));var ejs=require(_0x34ad('0xb'));var fs=require('fs');var fs_extra=require(_0x34ad('0xc'));var _=require(_0x34ad('0xd'));var squel=require(_0x34ad('0xe'));var crypto=require(_0x34ad('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34ad('0xa'));var querystring=require(_0x34ad('0x10'));var Papa=require(_0x34ad('0x11'));var Redis=require(_0x34ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34ad('0x13'));var as=require(_0x34ad('0x14'));var hardwareService=require(_0x34ad('0x15'));var logger=require(_0x34ad('0x16'))(_0x34ad('0x17'));var utils=require(_0x34ad('0x18'));var config=require(_0x34ad('0x19'));var licenseUtil=require(_0x34ad('0x1a'));var db=require(_0x34ad('0x1b'))['db'];function respondWithStatusCode(_0x377c90,_0x14c9fd){_0x14c9fd=_0x14c9fd||0xcc;return function(_0x1be906){if(_0x1be906){return _0x377c90[_0x34ad('0x1c')](_0x14c9fd);}return _0x377c90[_0x34ad('0x1d')](_0x14c9fd)[_0x34ad('0x1e')]();};}function respondWithResult(_0xc64e62,_0x558097){_0x558097=_0x558097||0xc8;return function(_0x4764e9){if(_0x4764e9){return _0xc64e62[_0x34ad('0x1d')](_0x558097)[_0x34ad('0x1f')](_0x4764e9);}};}function respondWithFilteredResult(_0x5e2a1d,_0x21a78c){return function(_0x262123){if(_0x262123){var _0x38a15e=typeof _0x21a78c[_0x34ad('0x20')]===_0x34ad('0x21')&&typeof _0x21a78c['limit']===_0x34ad('0x21');var _0x4daa5c=_0x262123[_0x34ad('0x22')];var _0x294326=_0x38a15e?0x0:_0x21a78c[_0x34ad('0x20')];var _0x7036e0=_0x38a15e?_0x262123[_0x34ad('0x22')]:_0x21a78c['offset']+_0x21a78c[_0x34ad('0x23')];var _0x3a2cd5;if(_0x7036e0>=_0x4daa5c){_0x7036e0=_0x4daa5c;_0x3a2cd5=0xc8;}else{_0x3a2cd5=0xce;}_0x5e2a1d[_0x34ad('0x1d')](_0x3a2cd5);return _0x5e2a1d[_0x34ad('0x24')](_0x34ad('0x25'),_0x294326+'-'+_0x7036e0+'/'+_0x4daa5c)[_0x34ad('0x1f')](_0x262123);}return null;};}function patchUpdates(_0x3c178a){return function(_0x45557e){try{jsonpatch[_0x34ad('0x26')](_0x45557e,_0x3c178a,!![]);}catch(_0x55140c){return BPromise[_0x34ad('0x27')](_0x55140c);}return _0x45557e['save']();};}function saveUpdates(_0x1c2d49,_0x493f73){return function(_0x154ee8){if(_0x154ee8){return _0x154ee8[_0x34ad('0x28')](_0x1c2d49)[_0x34ad('0x29')](function(_0x1c2fa5){return _0x1c2fa5;});}return null;};}function removeEntity(_0x737c2d,_0x4a06a7){return function(_0x5a8379){if(_0x5a8379){return _0x5a8379[_0x34ad('0x2a')]()['then'](function(){_0x737c2d[_0x34ad('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d5495,_0x34d2ae){return function(_0x3df4ca){if(!_0x3df4ca){_0x5d5495[_0x34ad('0x1c')](0x194);}return _0x3df4ca;};}function handleError(_0x3cb657,_0x17fc51){_0x17fc51=_0x17fc51||0x1f4;return function(_0x320b6a){logger[_0x34ad('0x2b')](_0x320b6a[_0x34ad('0x2c')]);if(_0x320b6a[_0x34ad('0x2d')]){delete _0x320b6a[_0x34ad('0x2d')];}_0x3cb657['status'](_0x17fc51)[_0x34ad('0x2e')](_0x320b6a);};}exports[_0x34ad('0x2f')]=function(_0x23bb04,_0x31b880){var _0x2bcdc3={'raw':!![],'where':{'id':_0x23bb04[_0x34ad('0x30')]['id']}},_0x1b2387={};_0x1b2387[_0x34ad('0x31')]=_[_0x34ad('0x32')](db[_0x34ad('0x33')][_0x34ad('0x34')]);_0x1b2387[_0x34ad('0x35')]=_[_0x34ad('0x32')](_0x23bb04[_0x34ad('0x35')]);_0x1b2387[_0x34ad('0x36')]=_[_0x34ad('0x37')](_0x1b2387['model'],_0x1b2387[_0x34ad('0x35')]);_0x2bcdc3['attributes']=_[_0x34ad('0x37')](_0x1b2387[_0x34ad('0x31')],qs[_0x34ad('0x38')](_0x23bb04[_0x34ad('0x35')]['fields']));_0x2bcdc3[_0x34ad('0x39')]=_0x2bcdc3[_0x34ad('0x39')][_0x34ad('0x3a')]?_0x2bcdc3[_0x34ad('0x39')]:_0x1b2387['model'];if(_0x23bb04['query']['includeAll']){_0x2bcdc3[_0x34ad('0x3b')]=[{'all':!![]}];}_0x2bcdc3=_[_0x34ad('0x3c')]({},_0x2bcdc3,_0x23bb04[_0x34ad('0x3d')]);return db[_0x34ad('0x33')][_0x34ad('0x3e')](_0x2bcdc3)['then'](handleEntityNotFound(_0x31b880,null))[_0x34ad('0x29')](respondWithResult(_0x31b880,null))[_0x34ad('0x3f')](handleError(_0x31b880,null));};exports[_0x34ad('0x28')]=function(_0x2a3330,_0x1b79b3){if(_0x2a3330[_0x34ad('0x40')]['id']){delete _0x2a3330[_0x34ad('0x40')]['id'];}return db[_0x34ad('0x33')][_0x34ad('0x3e')]({'where':{'id':_0x2a3330[_0x34ad('0x30')]['id']}})[_0x34ad('0x29')](handleEntityNotFound(_0x1b79b3,null))[_0x34ad('0x29')](saveUpdates(_0x2a3330[_0x34ad('0x40')],null))[_0x34ad('0x29')](respondWithResult(_0x1b79b3,null))[_0x34ad('0x3f')](handleError(_0x1b79b3,null));};exports[_0x34ad('0x2a')]=function(_0x41a5a2,_0x23e15b){return db[_0x34ad('0x33')][_0x34ad('0x3e')]({'where':{'id':_0x41a5a2['params']['id']}})['then'](handleEntityNotFound(_0x23e15b,null))[_0x34ad('0x29')](removeEntity(_0x23e15b,null))[_0x34ad('0x3f')](handleError(_0x23e15b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8e41777..d7f5e3d 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 _0x3182=['ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','../../config/environment','exports','define'];(function(_0xf2bab5,_0x1d6f3b){var _0x2f17bc=function(_0x305fbb){while(--_0x305fbb){_0xf2bab5['push'](_0xf2bab5['shift']());}};_0x2f17bc(++_0x1d6f3b);}(_0x3182,0x99));var _0x2318=function(_0x1fd173,_0x22b599){_0x1fd173=_0x1fd173-0x0;var _0x18bd7b=_0x3182[_0x1fd173];return _0x18bd7b;};'use strict';var _=require(_0x2318('0x0'));var util=require('util');var logger=require(_0x2318('0x1'))('api');var moment=require(_0x2318('0x2'));var BPromise=require('bluebird');var rp=require(_0x2318('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2318('0x4'));var attributes=require('./chatApplication.attributes');module[_0x2318('0x5')]=function(_0x2125b9,_0xe140e9){return _0x2125b9[_0x2318('0x6')](_0x2318('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2318('0x8'),'collate':_0x2318('0x9')});}; \ No newline at end of file +var _0xa3d4=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x3d731a,_0x50aa07){var _0x4413b2=function(_0x1746d6){while(--_0x1746d6){_0x3d731a['push'](_0x3d731a['shift']());}};_0x4413b2(++_0x50aa07);}(_0xa3d4,0x12e));var _0x4a3d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xa3d4[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0x4a3d('0x0'));var logger=require(_0x4a3d('0x1'))(_0x4a3d('0x2'));var moment=require('moment');var BPromise=require(_0x4a3d('0x3'));var rp=require(_0x4a3d('0x4'));var fs=require('fs');var path=require(_0x4a3d('0x5'));var rimraf=require(_0x4a3d('0x6'));var config=require(_0x4a3d('0x7'));var attributes=require(_0x4a3d('0x8'));module[_0x4a3d('0x9')]=function(_0x5bb9d0,_0x486c9b){return _0x5bb9d0[_0x4a3d('0xa')](_0x4a3d('0xb'),attributes,{'tableName':_0x4a3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a3d('0xd'),'collate':_0x4a3d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a7245ce..bc439fb 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 _0x01b5=['error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x57bea4,_0x5bd929){var _0x961b47=function(_0x31f438){while(--_0x31f438){_0x57bea4['push'](_0x57bea4['shift']());}};_0x961b47(++_0x5bd929);}(_0x01b5,0xdb));var _0x501b=function(_0x5ef221,_0x110fd8){_0x5ef221=_0x5ef221-0x0;var _0x2f66bc=_0x01b5[_0x5ef221];return _0x2f66bc;};'use strict';var _=require(_0x501b('0x0'));var util=require(_0x501b('0x1'));var moment=require('moment');var BPromise=require(_0x501b('0x2'));var rs=require(_0x501b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x501b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x501b('0x5'))(_0x501b('0x6'));var config=require(_0x501b('0x7'));var jayson=require(_0x501b('0x8'));var client=jayson[_0x501b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2891dc,_0x17ee7f,_0x55a38b){return new BPromise(function(_0xf75529,_0x40d722){return client[_0x501b('0xa')](_0x2891dc,_0x55a38b)['then'](function(_0x1c061b){logger[_0x501b('0xb')](_0x501b('0xc'),_0x17ee7f,'request\x20sent');logger['debug'](_0x501b('0xd'),_0x17ee7f,_0x501b('0xe'),JSON['stringify'](_0x1c061b));if(_0x1c061b[_0x501b('0xf')]){if(_0x1c061b[_0x501b('0xf')][_0x501b('0x10')]===0x1f4){logger[_0x501b('0xf')](_0x501b('0xc'),_0x17ee7f,_0x1c061b[_0x501b('0xf')][_0x501b('0x11')]);return _0x40d722(_0x1c061b['error'][_0x501b('0x11')]);}logger[_0x501b('0xf')](_0x501b('0xc'),_0x17ee7f,_0x1c061b[_0x501b('0xf')][_0x501b('0x11')]);return _0xf75529(_0x1c061b['error'][_0x501b('0x11')]);}else{logger['info'](_0x501b('0xc'),_0x17ee7f,_0x501b('0xe'));_0xf75529(_0x1c061b['result']['message']);}})['catch'](function(_0x1f2031){logger[_0x501b('0xf')](_0x501b('0xc'),_0x17ee7f,_0x1f2031);_0x40d722(_0x1f2031);});});} \ No newline at end of file +var _0xd6d8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring'];(function(_0x3863ab,_0xf0364){var _0x330834=function(_0x18ae83){while(--_0x18ae83){_0x3863ab['push'](_0x3863ab['shift']());}};_0x330834(++_0xf0364);}(_0xd6d8,0x147));var _0x8d6d=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xd6d8[_0xffa198];return _0x1e4b50;};'use strict';var _=require('lodash');var util=require(_0x8d6d('0x0'));var moment=require('moment');var BPromise=require(_0x8d6d('0x1'));var rs=require(_0x8d6d('0x2'));var fs=require('fs');var Redis=require(_0x8d6d('0x3'));var db=require(_0x8d6d('0x4'))['db'];var utils=require(_0x8d6d('0x5'));var logger=require(_0x8d6d('0x6'))(_0x8d6d('0x7'));var config=require(_0x8d6d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8d6d('0x9')][_0x8d6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f6ee,_0x377bca,_0x249d87){return new BPromise(function(_0x1017e4,_0x3d8e10){return client[_0x8d6d('0xb')](_0x40f6ee,_0x249d87)[_0x8d6d('0xc')](function(_0x5f15b){logger[_0x8d6d('0xd')](_0x8d6d('0xe'),_0x377bca,_0x8d6d('0xf'));logger[_0x8d6d('0x10')](_0x8d6d('0x11'),_0x377bca,'request\x20sent',JSON['stringify'](_0x5f15b));if(_0x5f15b[_0x8d6d('0x12')]){if(_0x5f15b[_0x8d6d('0x12')][_0x8d6d('0x13')]===0x1f4){logger[_0x8d6d('0x12')](_0x8d6d('0xe'),_0x377bca,_0x5f15b[_0x8d6d('0x12')]['message']);return _0x3d8e10(_0x5f15b['error'][_0x8d6d('0x14')]);}logger[_0x8d6d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x377bca,_0x5f15b[_0x8d6d('0x12')][_0x8d6d('0x14')]);return _0x1017e4(_0x5f15b[_0x8d6d('0x12')][_0x8d6d('0x14')]);}else{logger[_0x8d6d('0xd')](_0x8d6d('0xe'),_0x377bca,_0x8d6d('0xf'));_0x1017e4(_0x5f15b['result'][_0x8d6d('0x14')]);}})[_0x8d6d('0x15')](function(_0x263e4a){logger[_0x8d6d('0x12')](_0x8d6d('0xe'),_0x377bca,_0x263e4a);_0x3d8e10(_0x263e4a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 75b758c..3d83585 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 _0x1c9e=['fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1f2e5e,_0x36db41){var _0x16fcdb=function(_0x37fae9){while(--_0x37fae9){_0x1f2e5e['push'](_0x1f2e5e['shift']());}};_0x16fcdb(++_0x36db41);}(_0x1c9e,0xcc));var _0xe1c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1c9e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe1c9('0x0'));var util=require(_0xe1c9('0x1'));var path=require(_0xe1c9('0x2'));var timeout=require(_0xe1c9('0x3'));var express=require(_0xe1c9('0x4'));var router=express[_0xe1c9('0x5')]();var fs_extra=require(_0xe1c9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1c9('0x7'));var config=require(_0xe1c9('0x8'));var controller=require('./chatApplication.controller');router[_0xe1c9('0x9')](_0xe1c9('0xa'),auth[_0xe1c9('0xb')](),controller[_0xe1c9('0xc')]);router['put'](_0xe1c9('0xa'),auth[_0xe1c9('0xb')](),controller[_0xe1c9('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe1c9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x149d=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','update'];(function(_0x585db0,_0x8c8694){var _0x56584c=function(_0x40a718){while(--_0x40a718){_0x585db0['push'](_0x585db0['shift']());}};_0x56584c(++_0x8c8694);}(_0x149d,0x99));var _0xd149=function(_0x139e8d,_0xa2de80){_0x139e8d=_0x139e8d-0x0;var _0x40e60f=_0x149d[_0x139e8d];return _0x40e60f;};'use strict';var multer=require(_0xd149('0x0'));var util=require(_0xd149('0x1'));var path=require(_0xd149('0x2'));var timeout=require(_0xd149('0x3'));var express=require(_0xd149('0x4'));var router=express['Router']();var fs_extra=require(_0xd149('0x5'));var auth=require(_0xd149('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd149('0x7'));var controller=require('./chatApplication.controller');router[_0xd149('0x8')]('/:id',auth[_0xd149('0x9')](),controller['show']);router['put'](_0xd149('0xa'),auth[_0xd149('0x9')](),controller[_0xd149('0xb')]);router[_0xd149('0xc')](_0xd149('0xa'),auth[_0xd149('0x9')](),controller[_0xd149('0xd')]);module[_0xd149('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6c49546..656a4c2 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 _0x7bd5=['BOOLEAN','sequelize','STRING'];(function(_0xac8d0e,_0x5abac1){var _0x4aa882=function(_0x39dd3b){while(--_0x39dd3b){_0xac8d0e['push'](_0xac8d0e['shift']());}};_0x4aa882(++_0x5abac1);}(_0x7bd5,0x8e));var _0x57bd=function(_0x56c162,_0x68d55f){_0x56c162=_0x56c162-0x0;var _0x40a60f=_0x7bd5[_0x56c162];return _0x40a60f;};'use strict';var Sequelize=require(_0x57bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x57bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x57bd('0x1')]},'write':{'type':Sequelize[_0x57bd('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x69f8=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2f0c67,_0x253265){var _0x1199ae=function(_0x1dbbc4){while(--_0x1dbbc4){_0x2f0c67['push'](_0x2f0c67['shift']());}};_0x1199ae(++_0x253265);}(_0x69f8,0x14c));var _0x869f=function(_0x4d5aa4,_0x4acef5){_0x4d5aa4=_0x4d5aa4-0x0;var _0x1cab74=_0x69f8[_0x4d5aa4];return _0x1cab74;};'use strict';var Sequelize=require(_0x869f('0x0'));module[_0x869f('0x1')]={'name':{'type':Sequelize[_0x869f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x869f('0x2')]},'write':{'type':Sequelize[_0x869f('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 d2d829c..f3c6b1a 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 _0xe862=['stack','name','index','map','ChatGroup','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','getMembers','findOne','User','pick','filter','where','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error'];(function(_0x3c22f7,_0x1fb12a){var _0x537f59=function(_0x471688){while(--_0x471688){_0x3c22f7['push'](_0x3c22f7['shift']());}};_0x537f59(++_0x1fb12a);}(_0xe862,0x1bd));var _0x2e86=function(_0x312580,_0xe57338){_0x312580=_0x312580-0x0;var _0xb6953a=_0xe862[_0x312580];return _0xb6953a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e86('0x0'));var jsonpatch=require(_0x2e86('0x1'));var rp=require(_0x2e86('0x2'));var moment=require(_0x2e86('0x3'));var BPromise=require(_0x2e86('0x4'));var Mustache=require('mustache');var util=require(_0x2e86('0x5'));var path=require(_0x2e86('0x6'));var sox=require('sox');var csv=require(_0x2e86('0x7'));var ejs=require(_0x2e86('0x8'));var fs=require('fs');var fs_extra=require(_0x2e86('0x9'));var _=require(_0x2e86('0xa'));var squel=require(_0x2e86('0xb'));var crypto=require(_0x2e86('0xc'));var jsforce=require(_0x2e86('0xd'));var deskjs=require(_0x2e86('0xe'));var toCsv=require(_0x2e86('0x7'));var querystring=require(_0x2e86('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e86('0x10'));var authService=require(_0x2e86('0x11'));var qs=require(_0x2e86('0x12'));var as=require(_0x2e86('0x13'));var hardwareService=require(_0x2e86('0x14'));var logger=require(_0x2e86('0x15'))(_0x2e86('0x16'));var utils=require(_0x2e86('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2e86('0x18')](config[_0x2e86('0x19')],{'host':_0x2e86('0x1a'),'port':0x18eb});var socket=require(_0x2e86('0x1b'))(new Redis(config[_0x2e86('0x19')]));require(_0x2e86('0x1c'))[_0x2e86('0x1d')](socket);function respondWithStatusCode(_0xa4c51c,_0x1cf598){_0x1cf598=_0x1cf598||0xcc;return function(_0x41e96c){if(_0x41e96c){return _0xa4c51c[_0x2e86('0x1e')](_0x1cf598);}return _0xa4c51c['status'](_0x1cf598)['end']();};}function respondWithResult(_0xdd668a,_0x12800f){_0x12800f=_0x12800f||0xc8;return function(_0x287c5c){if(_0x287c5c){return _0xdd668a[_0x2e86('0x1f')](_0x12800f)[_0x2e86('0x20')](_0x287c5c);}};}function respondWithFilteredResult(_0xc71391,_0x378ab7){return function(_0x3eca9f){if(_0x3eca9f){var _0x5d30b2=typeof _0x378ab7[_0x2e86('0x21')]===_0x2e86('0x22')&&typeof _0x378ab7[_0x2e86('0x23')]===_0x2e86('0x22');var _0x1e6b64=_0x3eca9f[_0x2e86('0x24')];var _0x289020=_0x5d30b2?0x0:_0x378ab7[_0x2e86('0x21')];var _0x2be622=_0x5d30b2?_0x3eca9f[_0x2e86('0x24')]:_0x378ab7[_0x2e86('0x21')]+_0x378ab7[_0x2e86('0x23')];var _0x4693f;if(_0x2be622>=_0x1e6b64){_0x2be622=_0x1e6b64;_0x4693f=0xc8;}else{_0x4693f=0xce;}_0xc71391['status'](_0x4693f);return _0xc71391[_0x2e86('0x25')](_0x2e86('0x26'),_0x289020+'-'+_0x2be622+'/'+_0x1e6b64)['json'](_0x3eca9f);}return null;};}function patchUpdates(_0x52ea96){return function(_0x516b61){try{jsonpatch['apply'](_0x516b61,_0x52ea96,!![]);}catch(_0x5721cc){return BPromise['reject'](_0x5721cc);}return _0x516b61[_0x2e86('0x27')]();};}function saveUpdates(_0x1ef1af,_0x260542){return function(_0x3265d7){if(_0x3265d7){return _0x3265d7[_0x2e86('0x28')](_0x1ef1af)[_0x2e86('0x29')](function(_0xdd82d1){return _0xdd82d1;});}return null;};}function removeEntity(_0x2de7b6,_0x43b258){return function(_0x46917a){if(_0x46917a){return _0x46917a[_0x2e86('0x2a')]()[_0x2e86('0x29')](function(){_0x2de7b6['status'](0xcc)[_0x2e86('0x2b')]();});}};}function handleEntityNotFound(_0x6fe03f,_0x26af74){return function(_0x4422d8){if(!_0x4422d8){_0x6fe03f[_0x2e86('0x1e')](0x194);}return _0x4422d8;};}function handleError(_0x4c1e4f,_0x57e137){_0x57e137=_0x57e137||0x1f4;return function(_0x2a4025){logger[_0x2e86('0x2c')](_0x2a4025[_0x2e86('0x2d')]);if(_0x2a4025[_0x2e86('0x2e')]){delete _0x2a4025[_0x2e86('0x2e')];}_0x4c1e4f['status'](_0x57e137)['send'](_0x2a4025);};}exports[_0x2e86('0x2f')]=function(_0x4459e8,_0x15e0b6){var _0x826efd={},_0x3ec655={},_0x3903e1={'count':0x0,'rows':[]};var _0x3ab52b=_[_0x2e86('0x30')](db[_0x2e86('0x31')]['rawAttributes'],function(_0x3f31b5){return{'name':_0x3f31b5[_0x2e86('0x32')],'type':_0x3f31b5[_0x2e86('0x33')]['key']};});_0x3ec655[_0x2e86('0x34')]=_['map'](_0x3ab52b,_0x2e86('0x2e'));_0x3ec655[_0x2e86('0x35')]=_['keys'](_0x4459e8[_0x2e86('0x35')]);_0x3ec655['filters']=_['intersection'](_0x3ec655[_0x2e86('0x34')],_0x3ec655[_0x2e86('0x35')]);_0x826efd[_0x2e86('0x36')]=_[_0x2e86('0x37')](_0x3ec655[_0x2e86('0x34')],qs[_0x2e86('0x38')](_0x4459e8[_0x2e86('0x35')][_0x2e86('0x38')]));_0x826efd[_0x2e86('0x36')]=_0x826efd[_0x2e86('0x36')][_0x2e86('0x39')]?_0x826efd['attributes']:_0x3ec655[_0x2e86('0x34')];if(!_0x4459e8[_0x2e86('0x35')][_0x2e86('0x3a')](_0x2e86('0x3b'))){_0x826efd[_0x2e86('0x23')]=qs['limit'](_0x4459e8[_0x2e86('0x35')]['limit']);_0x826efd[_0x2e86('0x21')]=qs['offset'](_0x4459e8[_0x2e86('0x35')]['offset']);}_0x826efd[_0x2e86('0x3c')]=qs[_0x2e86('0x3d')](_0x4459e8[_0x2e86('0x35')][_0x2e86('0x3d')]);_0x826efd['where']=qs[_0x2e86('0x3e')](_['pick'](_0x4459e8[_0x2e86('0x35')],_0x3ec655[_0x2e86('0x3e')]),_0x3ab52b);if(_0x4459e8[_0x2e86('0x35')]['filter']){_0x826efd['where']=_[_0x2e86('0x3f')](_0x826efd['where'],{'$or':_[_0x2e86('0x30')](_0x3ab52b,function(_0xf65895){if(_0xf65895[_0x2e86('0x33')]!==_0x2e86('0x40')){var _0x4f1b85={};_0x4f1b85[_0xf65895['name']]={'$like':'%'+_0x4459e8[_0x2e86('0x35')]['filter']+'%'};return _0x4f1b85;}})});}_0x826efd=_[_0x2e86('0x3f')]({},_0x826efd,_0x4459e8[_0x2e86('0x41')]);var _0x4fab0e={'where':_0x826efd['where']};return db[_0x2e86('0x31')][_0x2e86('0x24')](_0x4fab0e)[_0x2e86('0x29')](function(_0x18e978){_0x3903e1[_0x2e86('0x24')]=_0x18e978;if(_0x4459e8['query'][_0x2e86('0x42')]){_0x826efd[_0x2e86('0x43')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x826efd);})['then'](function(_0x217e00){_0x3903e1[_0x2e86('0x44')]=_0x217e00;return _0x3903e1;})[_0x2e86('0x29')](respondWithFilteredResult(_0x15e0b6,_0x826efd))[_0x2e86('0x45')](handleError(_0x15e0b6,null));};exports[_0x2e86('0x46')]=function(_0x16cff0,_0x273d66){var _0x46201d={'raw':!![],'where':{'id':_0x16cff0[_0x2e86('0x47')]['id']}},_0x45e994={};_0x45e994[_0x2e86('0x34')]=_[_0x2e86('0x48')](db[_0x2e86('0x31')][_0x2e86('0x49')]);_0x45e994['query']=_[_0x2e86('0x48')](_0x16cff0[_0x2e86('0x35')]);_0x45e994[_0x2e86('0x3e')]=_[_0x2e86('0x37')](_0x45e994[_0x2e86('0x34')],_0x45e994['query']);_0x46201d[_0x2e86('0x36')]=_[_0x2e86('0x37')](_0x45e994[_0x2e86('0x34')],qs['fields'](_0x16cff0['query'][_0x2e86('0x38')]));_0x46201d['attributes']=_0x46201d[_0x2e86('0x36')][_0x2e86('0x39')]?_0x46201d[_0x2e86('0x36')]:_0x45e994[_0x2e86('0x34')];if(_0x16cff0['query'][_0x2e86('0x42')]){_0x46201d['include']=[{'all':!![]}];}_0x46201d=_[_0x2e86('0x3f')]({},_0x46201d,_0x16cff0[_0x2e86('0x41')]);return db[_0x2e86('0x31')]['find'](_0x46201d)[_0x2e86('0x29')](handleEntityNotFound(_0x273d66,null))[_0x2e86('0x29')](respondWithResult(_0x273d66,null))[_0x2e86('0x45')](handleError(_0x273d66,null));};exports[_0x2e86('0x4a')]=function(_0x2436fc,_0x34aae3){return db[_0x2e86('0x31')][_0x2e86('0x4a')](_0x2436fc[_0x2e86('0x4b')],{})['then'](respondWithResult(_0x34aae3,0xc9))[_0x2e86('0x45')](handleError(_0x34aae3,null));};exports['update']=function(_0x20e817,_0x4c5de9){if(_0x20e817[_0x2e86('0x4b')]['id']){delete _0x20e817[_0x2e86('0x4b')]['id'];}return db[_0x2e86('0x31')]['find']({'where':{'id':_0x20e817['params']['id']}})[_0x2e86('0x29')](handleEntityNotFound(_0x4c5de9,null))[_0x2e86('0x29')](saveUpdates(_0x20e817[_0x2e86('0x4b')],null))['then'](respondWithResult(_0x4c5de9,null))['catch'](handleError(_0x4c5de9,null));};exports[_0x2e86('0x2a')]=function(_0x2404ca,_0x26fdaa){return db['ChatGroup'][_0x2e86('0x4c')]({'where':{'id':_0x2404ca[_0x2e86('0x47')]['id']}})[_0x2e86('0x29')](handleEntityNotFound(_0x26fdaa,null))[_0x2e86('0x29')](removeEntity(_0x26fdaa,null))['catch'](handleError(_0x26fdaa,null));};exports[_0x2e86('0x4d')]=function(_0x4052ee,_0x254199){return db['ChatGroup'][_0x2e86('0x4d')]()[_0x2e86('0x29')](respondWithResult(_0x254199,null))[_0x2e86('0x45')](handleError(_0x254199,null));};exports[_0x2e86('0x4e')]=function(_0x297ac8,_0xf93667,_0x20e00e){return db[_0x2e86('0x4f')][_0x2e86('0x24')]({'where':{'ChatGroupId':_0x297ac8[_0x2e86('0x47')]['id'],'ToId':_0x297ac8['user']['id'],'read':![]}})[_0x2e86('0x29')](function(_0x43de4f){return{'id':_[_0x2e86('0x50')](_0x297ac8['params']['id']),'count':_0x43de4f};})[_0x2e86('0x29')](respondWithResult(_0xf93667,null))[_0x2e86('0x45')](handleError(_0xf93667,null));};exports['addMembers']=function(_0x3b03ef,_0x50d3fc,_0x496427){return db['ChatGroup'][_0x2e86('0x4c')]({'where':{'id':_0x3b03ef[_0x2e86('0x47')]['id']}})['then'](handleEntityNotFound(_0x50d3fc,null))['then'](function(_0x2c3e3a){if(_0x2c3e3a){return _0x2c3e3a[_0x2e86('0x51')](_0x3b03ef['body']['ids'],_[_0x2e86('0x52')](_0x3b03ef['body'],[_0x2e86('0x53'),'id'])||{});}})[_0x2e86('0x29')](respondWithResult(_0x50d3fc,null))[_0x2e86('0x45')](handleError(_0x50d3fc,null));};exports[_0x2e86('0x54')]=function(_0x54b40b,_0x14a6cc,_0x11924e){var _0x14d8ae={};var _0x21f225={};var _0x2df404;var _0x2eb1e7;return db[_0x2e86('0x31')][_0x2e86('0x55')]({'where':{'id':_0x54b40b[_0x2e86('0x47')]['id']}})[_0x2e86('0x29')](handleEntityNotFound(_0x14a6cc,null))[_0x2e86('0x29')](function(_0x1c615f){if(_0x1c615f){_0x2df404=_0x1c615f;_0x21f225[_0x2e86('0x34')]=_['keys'](db[_0x2e86('0x56')]['rawAttributes']);_0x21f225['query']=_[_0x2e86('0x48')](_0x54b40b[_0x2e86('0x35')]);_0x21f225[_0x2e86('0x3e')]=_[_0x2e86('0x37')](_0x21f225[_0x2e86('0x34')],_0x21f225[_0x2e86('0x35')]);_0x14d8ae[_0x2e86('0x36')]=_[_0x2e86('0x37')](_0x21f225[_0x2e86('0x34')],qs['fields'](_0x54b40b[_0x2e86('0x35')][_0x2e86('0x38')]));_0x14d8ae[_0x2e86('0x36')]=_0x14d8ae[_0x2e86('0x36')]['length']?_0x14d8ae[_0x2e86('0x36')]:_0x21f225[_0x2e86('0x34')];_0x14d8ae[_0x2e86('0x3c')]=qs[_0x2e86('0x3d')](_0x54b40b[_0x2e86('0x35')][_0x2e86('0x3d')]);_0x14d8ae['where']=qs[_0x2e86('0x3e')](_[_0x2e86('0x57')](_0x54b40b[_0x2e86('0x35')],_0x21f225[_0x2e86('0x3e')]));if(_0x54b40b[_0x2e86('0x35')][_0x2e86('0x58')]){_0x14d8ae[_0x2e86('0x59')]=_[_0x2e86('0x3f')](_0x14d8ae[_0x2e86('0x59')],{'$or':_[_0x2e86('0x30')](_0x14d8ae[_0x2e86('0x36')],function(_0x82a207){var _0x3369b6={};_0x3369b6[_0x82a207]={'$like':'%'+_0x54b40b[_0x2e86('0x35')][_0x2e86('0x58')]+'%'};return _0x3369b6;})});}_0x14d8ae=_[_0x2e86('0x3f')]({},_0x14d8ae,_0x54b40b[_0x2e86('0x41')]);return _0x2df404[_0x2e86('0x54')](_0x14d8ae);}})[_0x2e86('0x29')](function(_0x3a618d){if(_0x3a618d){_0x2eb1e7=_0x3a618d['length'];if(!_0x54b40b[_0x2e86('0x35')][_0x2e86('0x3a')](_0x2e86('0x3b'))){_0x14d8ae[_0x2e86('0x23')]=qs[_0x2e86('0x23')](_0x54b40b['query'][_0x2e86('0x23')]);_0x14d8ae[_0x2e86('0x21')]=qs[_0x2e86('0x21')](_0x54b40b[_0x2e86('0x35')][_0x2e86('0x21')]);}return _0x2df404['getMembers'](_0x14d8ae);}})['then'](function(_0xa6cfae){if(_0xa6cfae){return _0xa6cfae?{'count':_0x2eb1e7,'rows':_0xa6cfae}:null;}})['then'](respondWithResult(_0x14a6cc,null))[_0x2e86('0x45')](handleError(_0x14a6cc,null));};exports['removeMembers']=function(_0x1c7686,_0x3aa5a2,_0xe59ab1){return db[_0x2e86('0x31')][_0x2e86('0x4c')]({'where':{'id':_0x1c7686[_0x2e86('0x47')]['id']}})[_0x2e86('0x29')](handleEntityNotFound(_0x3aa5a2,null))[_0x2e86('0x29')](function(_0x340b4b){if(_0x340b4b){return _0x340b4b[_0x2e86('0x5a')](_0x1c7686[_0x2e86('0x35')][_0x2e86('0x53')]);}})['then'](respondWithStatusCode(_0x3aa5a2,null))['catch'](handleError(_0x3aa5a2,null));};exports[_0x2e86('0x5b')]=function(_0x139723,_0xfe2a15,_0x4dd6ed){if(_0x139723[_0x2e86('0x4b')]['id']){delete _0x139723[_0x2e86('0x4b')]['id'];}return db[_0x2e86('0x31')][_0x2e86('0x4c')]({'where':{'id':_0x139723[_0x2e86('0x47')]['id']}})['then'](handleEntityNotFound(_0xfe2a15,null))['then'](function(_0x1b740b){if(_0x1b740b){_0x139723[_0x2e86('0x4b')][_0x2e86('0x5c')]=_0x1b740b['id'];return db[_0x2e86('0x4f')][_0x2e86('0x4a')](_0x139723[_0x2e86('0x4b')]);}})['then'](respondWithResult(_0xfe2a15,null))['catch'](handleError(_0xfe2a15,null));};exports[_0x2e86('0x5d')]=function(_0xb3b4a5,_0x35408a,_0x56b33a){var _0x368261={};var _0x4176bd={};var _0x36d5cf;var _0x4e4621;return db[_0x2e86('0x31')][_0x2e86('0x55')]({'where':{'id':_0xb3b4a5[_0x2e86('0x47')]['id']}})[_0x2e86('0x29')](handleEntityNotFound(_0x35408a,null))[_0x2e86('0x29')](function(_0x2c2e33){if(_0x2c2e33){_0x36d5cf=_0x2c2e33;_0x4176bd[_0x2e86('0x34')]=_['keys'](db[_0x2e86('0x4f')][_0x2e86('0x49')]);_0x4176bd['query']=_['keys'](_0xb3b4a5[_0x2e86('0x35')]);_0x4176bd[_0x2e86('0x3e')]=_[_0x2e86('0x37')](_0x4176bd[_0x2e86('0x34')],_0x4176bd[_0x2e86('0x35')]);_0x368261[_0x2e86('0x36')]=_[_0x2e86('0x37')](_0x4176bd[_0x2e86('0x34')],qs['fields'](_0xb3b4a5[_0x2e86('0x35')][_0x2e86('0x38')]));_0x368261['attributes']=_0x368261[_0x2e86('0x36')][_0x2e86('0x39')]?_0x368261[_0x2e86('0x36')]:_0x4176bd['model'];_0x368261[_0x2e86('0x3c')]=qs[_0x2e86('0x3d')](_0xb3b4a5[_0x2e86('0x35')]['sort']);_0x368261[_0x2e86('0x59')]=qs['filters'](_[_0x2e86('0x57')](_0xb3b4a5[_0x2e86('0x35')],_0x4176bd[_0x2e86('0x3e')]));if(_0xb3b4a5['query'][_0x2e86('0x58')]){_0x368261[_0x2e86('0x59')]=_['merge'](_0x368261[_0x2e86('0x59')],{'$or':_[_0x2e86('0x30')](_0x368261['attributes'],function(_0x4d649a){var _0x4a8893={};_0x4a8893[_0x4d649a]={'$like':'%'+_0xb3b4a5[_0x2e86('0x35')]['filter']+'%'};return _0x4a8893;})});}if(_0xb3b4a5[_0x2e86('0x35')]['$gte']){var _0x3ac2df=_0xb3b4a5[_0x2e86('0x35')][_0x2e86('0x5e')][_0x2e86('0x5f')](',');var _0x186ac9={};_0x186ac9[_0x3ac2df[0x0]]={'$gte':moment(_0x3ac2df[0x1])[_0x2e86('0x60')](_0x2e86('0x61'))};_0x368261[_0x2e86('0x59')]=_[_0x2e86('0x3f')](_0x368261[_0x2e86('0x59')],_0x186ac9);}_0x368261=_[_0x2e86('0x3f')]({},_0x368261,_0xb3b4a5[_0x2e86('0x41')]);return _0x36d5cf[_0x2e86('0x5d')](_0x368261);}})[_0x2e86('0x29')](function(_0x11c739){if(_0x11c739){_0x4e4621=_0x11c739[_0x2e86('0x39')];if(!_0xb3b4a5[_0x2e86('0x35')][_0x2e86('0x3a')](_0x2e86('0x3b'))){_0x368261['limit']=qs['limit'](_0xb3b4a5['query'][_0x2e86('0x23')]);_0x368261[_0x2e86('0x21')]=qs[_0x2e86('0x21')](_0xb3b4a5[_0x2e86('0x35')][_0x2e86('0x21')]);}return _0x36d5cf[_0x2e86('0x5d')](_0x368261);}})['then'](function(_0x181a9c){if(_0x181a9c){return _0x181a9c?{'count':_0x4e4621,'rows':_0x181a9c}:null;}})['then'](respondWithResult(_0x35408a,null))[_0x2e86('0x45')](handleError(_0x35408a,null));}; \ No newline at end of file +var _0xa991=['ids','omit','getMembers','findOne','length','order','hasOwnProperty','removeMembers','ChatGroupId','ChatInternalMessage','create','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','describe','getUnread','user','toInteger'];(function(_0x1cbaac,_0x4ab388){var _0x285d9a=function(_0x36fa09){while(--_0x36fa09){_0x1cbaac['push'](_0x1cbaac['shift']());}};_0x285d9a(++_0x4ab388);}(_0xa991,0xcc));var _0x1a99=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa991[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x1a99('0x0'));var rimraf=require(_0x1a99('0x1'));var zipdir=require(_0x1a99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a99('0x4'));var util=require(_0x1a99('0x5'));var path=require(_0x1a99('0x6'));var sox=require(_0x1a99('0x7'));var csv=require(_0x1a99('0x8'));var ejs=require(_0x1a99('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1a99('0xa'));var crypto=require(_0x1a99('0xb'));var jsforce=require(_0x1a99('0xc'));var deskjs=require(_0x1a99('0xd'));var toCsv=require(_0x1a99('0x8'));var querystring=require(_0x1a99('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1a99('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a99('0x10'));var logger=require(_0x1a99('0x11'))(_0x1a99('0x12'));var utils=require(_0x1a99('0x13'));var config=require(_0x1a99('0x14'));var licenseUtil=require(_0x1a99('0x15'));var db=require(_0x1a99('0x16'))['db'];config['redis']=_[_0x1a99('0x17')](config[_0x1a99('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a99('0x19'))(new Redis(config[_0x1a99('0x18')]));require(_0x1a99('0x1a'))[_0x1a99('0x1b')](socket);function respondWithStatusCode(_0x43158c,_0x1fcb5e){_0x1fcb5e=_0x1fcb5e||0xcc;return function(_0x5f13f2){if(_0x5f13f2){return _0x43158c['sendStatus'](_0x1fcb5e);}return _0x43158c[_0x1a99('0x1c')](_0x1fcb5e)[_0x1a99('0x1d')]();};}function respondWithResult(_0x1bfeb5,_0x2824ae){_0x2824ae=_0x2824ae||0xc8;return function(_0xa7cca9){if(_0xa7cca9){return _0x1bfeb5[_0x1a99('0x1c')](_0x2824ae)['json'](_0xa7cca9);}};}function respondWithFilteredResult(_0x458b79,_0x3dec8e){return function(_0x3dd208){if(_0x3dd208){var _0x5df970=typeof _0x3dec8e[_0x1a99('0x1e')]==='undefined'&&typeof _0x3dec8e['limit']===_0x1a99('0x1f');var _0x34a6e5=_0x3dd208[_0x1a99('0x20')];var _0x10b31a=_0x5df970?0x0:_0x3dec8e[_0x1a99('0x1e')];var _0x45eb5e=_0x5df970?_0x3dd208[_0x1a99('0x20')]:_0x3dec8e[_0x1a99('0x1e')]+_0x3dec8e[_0x1a99('0x21')];var _0x508ee0;if(_0x45eb5e>=_0x34a6e5){_0x45eb5e=_0x34a6e5;_0x508ee0=0xc8;}else{_0x508ee0=0xce;}_0x458b79[_0x1a99('0x1c')](_0x508ee0);return _0x458b79[_0x1a99('0x22')](_0x1a99('0x23'),_0x10b31a+'-'+_0x45eb5e+'/'+_0x34a6e5)[_0x1a99('0x24')](_0x3dd208);}return null;};}function patchUpdates(_0x46b495){return function(_0x15837e){try{jsonpatch[_0x1a99('0x25')](_0x15837e,_0x46b495,!![]);}catch(_0x4b7b3c){return BPromise[_0x1a99('0x26')](_0x4b7b3c);}return _0x15837e[_0x1a99('0x27')]();};}function saveUpdates(_0x29d004,_0x378e9f){return function(_0x2396d7){if(_0x2396d7){return _0x2396d7[_0x1a99('0x28')](_0x29d004)[_0x1a99('0x29')](function(_0x26186d){return _0x26186d;});}return null;};}function removeEntity(_0x35637c,_0x463a81){return function(_0x38bd62){if(_0x38bd62){return _0x38bd62[_0x1a99('0x2a')]()[_0x1a99('0x29')](function(){_0x35637c[_0x1a99('0x1c')](0xcc)[_0x1a99('0x1d')]();});}};}function handleEntityNotFound(_0x48c3e4,_0xe93dec){return function(_0x3b1132){if(!_0x3b1132){_0x48c3e4['sendStatus'](0x194);}return _0x3b1132;};}function handleError(_0x1b6677,_0x45e0ae){_0x45e0ae=_0x45e0ae||0x1f4;return function(_0x18b907){logger[_0x1a99('0x2b')](_0x18b907[_0x1a99('0x2c')]);if(_0x18b907[_0x1a99('0x2d')]){delete _0x18b907[_0x1a99('0x2d')];}_0x1b6677[_0x1a99('0x1c')](_0x45e0ae)[_0x1a99('0x2e')](_0x18b907);};}exports['index']=function(_0x46fe97,_0x5aaf0d){var _0x1d2571={},_0x5c9a43={},_0x4c65bb={'count':0x0,'rows':[]};var _0x256696=_[_0x1a99('0x2f')](db[_0x1a99('0x30')][_0x1a99('0x31')],function(_0x3869ed){return{'name':_0x3869ed[_0x1a99('0x32')],'type':_0x3869ed[_0x1a99('0x33')][_0x1a99('0x34')]};});_0x5c9a43[_0x1a99('0x35')]=_[_0x1a99('0x2f')](_0x256696,_0x1a99('0x2d'));_0x5c9a43[_0x1a99('0x36')]=_[_0x1a99('0x37')](_0x46fe97[_0x1a99('0x36')]);_0x5c9a43['filters']=_[_0x1a99('0x38')](_0x5c9a43[_0x1a99('0x35')],_0x5c9a43['query']);_0x1d2571[_0x1a99('0x39')]=_[_0x1a99('0x38')](_0x5c9a43['model'],qs[_0x1a99('0x3a')](_0x46fe97['query']['fields']));_0x1d2571[_0x1a99('0x39')]=_0x1d2571[_0x1a99('0x39')]['length']?_0x1d2571['attributes']:_0x5c9a43['model'];if(!_0x46fe97[_0x1a99('0x36')]['hasOwnProperty'](_0x1a99('0x3b'))){_0x1d2571['limit']=qs[_0x1a99('0x21')](_0x46fe97[_0x1a99('0x36')]['limit']);_0x1d2571[_0x1a99('0x1e')]=qs[_0x1a99('0x1e')](_0x46fe97[_0x1a99('0x36')][_0x1a99('0x1e')]);}_0x1d2571['order']=qs[_0x1a99('0x3c')](_0x46fe97[_0x1a99('0x36')]['sort']);_0x1d2571[_0x1a99('0x3d')]=qs[_0x1a99('0x3e')](_['pick'](_0x46fe97[_0x1a99('0x36')],_0x5c9a43[_0x1a99('0x3e')]),_0x256696);if(_0x46fe97[_0x1a99('0x36')][_0x1a99('0x3f')]){_0x1d2571[_0x1a99('0x3d')]=_[_0x1a99('0x40')](_0x1d2571[_0x1a99('0x3d')],{'$or':_[_0x1a99('0x2f')](_0x256696,function(_0x1e6cc1){if(_0x1e6cc1[_0x1a99('0x33')]!=='VIRTUAL'){var _0x3afd5e={};_0x3afd5e[_0x1e6cc1[_0x1a99('0x2d')]]={'$like':'%'+_0x46fe97[_0x1a99('0x36')][_0x1a99('0x3f')]+'%'};return _0x3afd5e;}})});}_0x1d2571=_[_0x1a99('0x40')]({},_0x1d2571,_0x46fe97[_0x1a99('0x41')]);var _0xc0a6d1={'where':_0x1d2571[_0x1a99('0x3d')]};return db[_0x1a99('0x30')]['count'](_0xc0a6d1)[_0x1a99('0x29')](function(_0xd0d9fb){_0x4c65bb['count']=_0xd0d9fb;if(_0x46fe97[_0x1a99('0x36')][_0x1a99('0x42')]){_0x1d2571[_0x1a99('0x43')]=[{'all':!![]}];}return db[_0x1a99('0x30')][_0x1a99('0x44')](_0x1d2571);})[_0x1a99('0x29')](function(_0x2ee4cd){_0x4c65bb['rows']=_0x2ee4cd;return _0x4c65bb;})[_0x1a99('0x29')](respondWithFilteredResult(_0x5aaf0d,_0x1d2571))[_0x1a99('0x45')](handleError(_0x5aaf0d,null));};exports[_0x1a99('0x46')]=function(_0x4a73f3,_0x18f78c){var _0x166262={'raw':!![],'where':{'id':_0x4a73f3[_0x1a99('0x47')]['id']}},_0x1c1a0e={};_0x1c1a0e[_0x1a99('0x35')]=_[_0x1a99('0x37')](db['ChatGroup']['rawAttributes']);_0x1c1a0e[_0x1a99('0x36')]=_[_0x1a99('0x37')](_0x4a73f3[_0x1a99('0x36')]);_0x1c1a0e['filters']=_[_0x1a99('0x38')](_0x1c1a0e[_0x1a99('0x35')],_0x1c1a0e[_0x1a99('0x36')]);_0x166262['attributes']=_[_0x1a99('0x38')](_0x1c1a0e[_0x1a99('0x35')],qs[_0x1a99('0x3a')](_0x4a73f3[_0x1a99('0x36')][_0x1a99('0x3a')]));_0x166262['attributes']=_0x166262['attributes']['length']?_0x166262[_0x1a99('0x39')]:_0x1c1a0e['model'];if(_0x4a73f3[_0x1a99('0x36')][_0x1a99('0x42')]){_0x166262[_0x1a99('0x43')]=[{'all':!![]}];}_0x166262=_[_0x1a99('0x40')]({},_0x166262,_0x4a73f3[_0x1a99('0x41')]);return db['ChatGroup'][_0x1a99('0x48')](_0x166262)['then'](handleEntityNotFound(_0x18f78c,null))[_0x1a99('0x29')](respondWithResult(_0x18f78c,null))[_0x1a99('0x45')](handleError(_0x18f78c,null));};exports['create']=function(_0x37a991,_0x10c394){return db[_0x1a99('0x30')]['create'](_0x37a991[_0x1a99('0x49')],{})[_0x1a99('0x29')](respondWithResult(_0x10c394,0xc9))[_0x1a99('0x45')](handleError(_0x10c394,null));};exports[_0x1a99('0x28')]=function(_0xfa2d95,_0x144f43){if(_0xfa2d95[_0x1a99('0x49')]['id']){delete _0xfa2d95['body']['id'];}return db[_0x1a99('0x30')]['find']({'where':{'id':_0xfa2d95[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0x144f43,null))[_0x1a99('0x29')](saveUpdates(_0xfa2d95[_0x1a99('0x49')],null))[_0x1a99('0x29')](respondWithResult(_0x144f43,null))[_0x1a99('0x45')](handleError(_0x144f43,null));};exports[_0x1a99('0x2a')]=function(_0xc46271,_0x2a36f2){return db['ChatGroup']['find']({'where':{'id':_0xc46271[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0x2a36f2,null))['then'](removeEntity(_0x2a36f2,null))[_0x1a99('0x45')](handleError(_0x2a36f2,null));};exports[_0x1a99('0x4a')]=function(_0x221f62,_0x2784d7){return db['ChatGroup']['describe']()[_0x1a99('0x29')](respondWithResult(_0x2784d7,null))[_0x1a99('0x45')](handleError(_0x2784d7,null));};exports[_0x1a99('0x4b')]=function(_0x163434,_0x445dbf,_0x206afe){return db['ChatInternalMessage'][_0x1a99('0x20')]({'where':{'ChatGroupId':_0x163434[_0x1a99('0x47')]['id'],'ToId':_0x163434[_0x1a99('0x4c')]['id'],'read':![]}})[_0x1a99('0x29')](function(_0x2fb32a){return{'id':_[_0x1a99('0x4d')](_0x163434[_0x1a99('0x47')]['id']),'count':_0x2fb32a};})[_0x1a99('0x29')](respondWithResult(_0x445dbf,null))[_0x1a99('0x45')](handleError(_0x445dbf,null));};exports['addMembers']=function(_0x5363f6,_0x5e7ee9,_0x2b26bf){return db[_0x1a99('0x30')][_0x1a99('0x48')]({'where':{'id':_0x5363f6[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0x5e7ee9,null))[_0x1a99('0x29')](function(_0x59e7c5){if(_0x59e7c5){return _0x59e7c5['addMembers'](_0x5363f6[_0x1a99('0x49')][_0x1a99('0x4e')],_[_0x1a99('0x4f')](_0x5363f6[_0x1a99('0x49')],['ids','id'])||{});}})[_0x1a99('0x29')](respondWithResult(_0x5e7ee9,null))[_0x1a99('0x45')](handleError(_0x5e7ee9,null));};exports[_0x1a99('0x50')]=function(_0xf1b6c8,_0x1e5a66,_0x701fed){var _0x352509={};var _0x4a1ce8={};var _0x173ddf;var _0x54b1ac;return db[_0x1a99('0x30')][_0x1a99('0x51')]({'where':{'id':_0xf1b6c8[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0x1e5a66,null))['then'](function(_0x52204d){if(_0x52204d){_0x173ddf=_0x52204d;_0x4a1ce8[_0x1a99('0x35')]=_[_0x1a99('0x37')](db['User'][_0x1a99('0x31')]);_0x4a1ce8[_0x1a99('0x36')]=_[_0x1a99('0x37')](_0xf1b6c8[_0x1a99('0x36')]);_0x4a1ce8[_0x1a99('0x3e')]=_[_0x1a99('0x38')](_0x4a1ce8[_0x1a99('0x35')],_0x4a1ce8[_0x1a99('0x36')]);_0x352509[_0x1a99('0x39')]=_[_0x1a99('0x38')](_0x4a1ce8[_0x1a99('0x35')],qs[_0x1a99('0x3a')](_0xf1b6c8[_0x1a99('0x36')]['fields']));_0x352509[_0x1a99('0x39')]=_0x352509[_0x1a99('0x39')][_0x1a99('0x52')]?_0x352509[_0x1a99('0x39')]:_0x4a1ce8[_0x1a99('0x35')];_0x352509[_0x1a99('0x53')]=qs['sort'](_0xf1b6c8[_0x1a99('0x36')]['sort']);_0x352509[_0x1a99('0x3d')]=qs[_0x1a99('0x3e')](_['pick'](_0xf1b6c8[_0x1a99('0x36')],_0x4a1ce8[_0x1a99('0x3e')]));if(_0xf1b6c8[_0x1a99('0x36')][_0x1a99('0x3f')]){_0x352509[_0x1a99('0x3d')]=_[_0x1a99('0x40')](_0x352509[_0x1a99('0x3d')],{'$or':_[_0x1a99('0x2f')](_0x352509[_0x1a99('0x39')],function(_0x32f584){var _0x141853={};_0x141853[_0x32f584]={'$like':'%'+_0xf1b6c8[_0x1a99('0x36')][_0x1a99('0x3f')]+'%'};return _0x141853;})});}_0x352509=_[_0x1a99('0x40')]({},_0x352509,_0xf1b6c8[_0x1a99('0x41')]);return _0x173ddf[_0x1a99('0x50')](_0x352509);}})['then'](function(_0x1b8f80){if(_0x1b8f80){_0x54b1ac=_0x1b8f80[_0x1a99('0x52')];if(!_0xf1b6c8['query'][_0x1a99('0x54')](_0x1a99('0x3b'))){_0x352509[_0x1a99('0x21')]=qs[_0x1a99('0x21')](_0xf1b6c8['query'][_0x1a99('0x21')]);_0x352509[_0x1a99('0x1e')]=qs['offset'](_0xf1b6c8[_0x1a99('0x36')][_0x1a99('0x1e')]);}return _0x173ddf[_0x1a99('0x50')](_0x352509);}})['then'](function(_0x53fac6){if(_0x53fac6){return _0x53fac6?{'count':_0x54b1ac,'rows':_0x53fac6}:null;}})[_0x1a99('0x29')](respondWithResult(_0x1e5a66,null))[_0x1a99('0x45')](handleError(_0x1e5a66,null));};exports[_0x1a99('0x55')]=function(_0x2b946b,_0xaf4ec7,_0x5730f5){return db[_0x1a99('0x30')][_0x1a99('0x48')]({'where':{'id':_0x2b946b[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0xaf4ec7,null))['then'](function(_0x2891e6){if(_0x2891e6){return _0x2891e6[_0x1a99('0x55')](_0x2b946b[_0x1a99('0x36')]['ids']);}})[_0x1a99('0x29')](respondWithStatusCode(_0xaf4ec7,null))[_0x1a99('0x45')](handleError(_0xaf4ec7,null));};exports['addMessage']=function(_0x9d4f8e,_0xf6b6f6,_0x3c0247){if(_0x9d4f8e['body']['id']){delete _0x9d4f8e[_0x1a99('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x9d4f8e['params']['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0xf6b6f6,null))[_0x1a99('0x29')](function(_0xe0807){if(_0xe0807){_0x9d4f8e['body'][_0x1a99('0x56')]=_0xe0807['id'];return db[_0x1a99('0x57')][_0x1a99('0x58')](_0x9d4f8e[_0x1a99('0x49')]);}})[_0x1a99('0x29')](respondWithResult(_0xf6b6f6,null))[_0x1a99('0x45')](handleError(_0xf6b6f6,null));};exports['getMessages']=function(_0x35dc66,_0x613599,_0xcb5f78){var _0xe99cd={};var _0x5b1ef7={};var _0x16c1d8;var _0x40a402;return db[_0x1a99('0x30')][_0x1a99('0x51')]({'where':{'id':_0x35dc66[_0x1a99('0x47')]['id']}})[_0x1a99('0x29')](handleEntityNotFound(_0x613599,null))[_0x1a99('0x29')](function(_0x17fb4c){if(_0x17fb4c){_0x16c1d8=_0x17fb4c;_0x5b1ef7[_0x1a99('0x35')]=_[_0x1a99('0x37')](db[_0x1a99('0x57')][_0x1a99('0x31')]);_0x5b1ef7[_0x1a99('0x36')]=_[_0x1a99('0x37')](_0x35dc66[_0x1a99('0x36')]);_0x5b1ef7[_0x1a99('0x3e')]=_[_0x1a99('0x38')](_0x5b1ef7[_0x1a99('0x35')],_0x5b1ef7[_0x1a99('0x36')]);_0xe99cd[_0x1a99('0x39')]=_[_0x1a99('0x38')](_0x5b1ef7['model'],qs[_0x1a99('0x3a')](_0x35dc66[_0x1a99('0x36')]['fields']));_0xe99cd['attributes']=_0xe99cd[_0x1a99('0x39')][_0x1a99('0x52')]?_0xe99cd[_0x1a99('0x39')]:_0x5b1ef7[_0x1a99('0x35')];_0xe99cd[_0x1a99('0x53')]=qs['sort'](_0x35dc66['query'][_0x1a99('0x3c')]);_0xe99cd[_0x1a99('0x3d')]=qs[_0x1a99('0x3e')](_[_0x1a99('0x59')](_0x35dc66[_0x1a99('0x36')],_0x5b1ef7[_0x1a99('0x3e')]));if(_0x35dc66[_0x1a99('0x36')][_0x1a99('0x3f')]){_0xe99cd[_0x1a99('0x3d')]=_['merge'](_0xe99cd[_0x1a99('0x3d')],{'$or':_[_0x1a99('0x2f')](_0xe99cd[_0x1a99('0x39')],function(_0x59cb6f){var _0x5a15e2={};_0x5a15e2[_0x59cb6f]={'$like':'%'+_0x35dc66['query'][_0x1a99('0x3f')]+'%'};return _0x5a15e2;})});}if(_0x35dc66[_0x1a99('0x36')][_0x1a99('0x5a')]){var _0x5d4ae5=_0x35dc66[_0x1a99('0x36')][_0x1a99('0x5a')]['split'](',');var _0x34396d={};_0x34396d[_0x5d4ae5[0x0]]={'$gte':moment(_0x5d4ae5[0x1])[_0x1a99('0x5b')](_0x1a99('0x5c'))};_0xe99cd[_0x1a99('0x3d')]=_['merge'](_0xe99cd[_0x1a99('0x3d')],_0x34396d);}_0xe99cd=_[_0x1a99('0x40')]({},_0xe99cd,_0x35dc66[_0x1a99('0x41')]);return _0x16c1d8[_0x1a99('0x5d')](_0xe99cd);}})['then'](function(_0x1c756b){if(_0x1c756b){_0x40a402=_0x1c756b[_0x1a99('0x52')];if(!_0x35dc66[_0x1a99('0x36')]['hasOwnProperty'](_0x1a99('0x3b'))){_0xe99cd[_0x1a99('0x21')]=qs[_0x1a99('0x21')](_0x35dc66[_0x1a99('0x36')]['limit']);_0xe99cd[_0x1a99('0x1e')]=qs['offset'](_0x35dc66['query']['offset']);}return _0x16c1d8['getMessages'](_0xe99cd);}})[_0x1a99('0x29')](function(_0x1beaf9){if(_0x1beaf9){return _0x1beaf9?{'count':_0x40a402,'rows':_0x1beaf9}:null;}})[_0x1a99('0x29')](respondWithResult(_0x613599,null))[_0x1a99('0x45')](handleError(_0x613599,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ae91e56..0885aba 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 _0x745d=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0x745d,0xec));var _0xd745=function(_0x51f4fa,_0x55f229){_0x51f4fa=_0x51f4fa-0x0;var _0x11c00d=_0x745d[_0x51f4fa];return _0x11c00d;};'use strict';var EventEmitter=require(_0xd745('0x0'));var ChatGroup=require(_0xd745('0x1'))['db'][_0xd745('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd745('0x3')](0x0);var events={'afterCreate':_0xd745('0x4'),'afterUpdate':'update','afterDestroy':_0xd745('0x5')};function emitEvent(_0x998674){return function(_0x3565bf,_0x2c3e6a,_0x373f2e){ChatGroupEvents[_0xd745('0x6')](_0x998674+':'+_0x3565bf['id'],_0x3565bf);ChatGroupEvents[_0xd745('0x6')](_0x998674,_0x3565bf);_0x373f2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xd745('0x7')](e,emitEvent(event));}}module[_0xd745('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x442b=['ChatGroup','save','update','remove','emit','hook','exports','events'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x442b,0x6f));var _0xb442=function(_0x6e3d2,_0x373346){_0x6e3d2=_0x6e3d2-0x0;var _0x4ed099=_0x442b[_0x6e3d2];return _0x4ed099;};'use strict';var EventEmitter=require(_0xb442('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xb442('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb442('0x2'),'afterUpdate':_0xb442('0x3'),'afterDestroy':_0xb442('0x4')};function emitEvent(_0x4ce07e){return function(_0x5c02d3,_0x3278d4,_0xc91d1c){ChatGroupEvents['emit'](_0x4ce07e+':'+_0x5c02d3['id'],_0x5c02d3);ChatGroupEvents[_0xb442('0x5')](_0x4ce07e,_0x5c02d3);_0xc91d1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xb442('0x6')](e,emitEvent(event));}}module[_0xb442('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 361e414..57c89ac 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 _0x438b=['./chatGroup.attributes','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa82c60,_0x3f05bf){var _0x291fef=function(_0x31feda){while(--_0x31feda){_0xa82c60['push'](_0xa82c60['shift']());}};_0x291fef(++_0x3f05bf);}(_0x438b,0xc3));var _0xb438=function(_0x3ac810,_0x592ce5){_0x3ac810=_0x3ac810-0x0;var _0x2a2257=_0x438b[_0x3ac810];return _0x2a2257;};'use strict';var _=require(_0xb438('0x0'));var util=require(_0xb438('0x1'));var logger=require(_0xb438('0x2'))(_0xb438('0x3'));var moment=require(_0xb438('0x4'));var BPromise=require(_0xb438('0x5'));var rp=require(_0xb438('0x6'));var fs=require('fs');var path=require(_0xb438('0x7'));var rimraf=require('rimraf');var config=require(_0xb438('0x8'));var attributes=require(_0xb438('0x9'));module['exports']=function(_0x1b8207,_0x2ab4a8){return _0x1b8207[_0xb438('0xa')]('ChatGroup',attributes,{'tableName':_0xb438('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd167=['rimraf','define','ChatGroup','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x29c409,_0x30d61d){var _0x43e24f=function(_0x3c9ab6){while(--_0x3c9ab6){_0x29c409['push'](_0x29c409['shift']());}};_0x43e24f(++_0x30d61d);}(_0xd167,0x193));var _0x7d16=function(_0x4cea78,_0x3ce1d5){_0x4cea78=_0x4cea78-0x0;var _0x5c9a6e=_0xd167[_0x4cea78];return _0x5c9a6e;};'use strict';var _=require(_0x7d16('0x0'));var util=require(_0x7d16('0x1'));var logger=require(_0x7d16('0x2'))('api');var moment=require(_0x7d16('0x3'));var BPromise=require(_0x7d16('0x4'));var rp=require(_0x7d16('0x5'));var fs=require('fs');var path=require(_0x7d16('0x6'));var rimraf=require(_0x7d16('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x3642f2,_0x3f2063){return _0x3642f2[_0x7d16('0x8')](_0x7d16('0x9'),attributes,{'tableName':'chat_groups','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 2bd6998..69b5ece 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 _0x8910=['./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis'];(function(_0x2063bc,_0x1aa93b){var _0x2b352b=function(_0x4650aa){while(--_0x4650aa){_0x2063bc['push'](_0x2063bc['shift']());}};_0x2b352b(++_0x1aa93b);}(_0x8910,0x1ef));var _0x0891=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x8910[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x0891('0x0'));var util=require(_0x0891('0x1'));var moment=require(_0x0891('0x2'));var BPromise=require(_0x0891('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0891('0x4'));var db=require(_0x0891('0x5'))['db'];var utils=require(_0x0891('0x6'));var logger=require(_0x0891('0x7'))(_0x0891('0x8'));var config=require(_0x0891('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0891('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0891('0xb')](config['redis'],{'host':_0x0891('0xc'),'port':0x18eb});var socket=require(_0x0891('0xd'))(new Redis(config[_0x0891('0xe')]));require(_0x0891('0xf'))[_0x0891('0x10')](socket);function respondWithRpcPromise(_0x14535b,_0x1f1f9d,_0x442477){return new BPromise(function(_0xea4569,_0x436c2e){return client[_0x0891('0x11')](_0x14535b,_0x442477)[_0x0891('0x12')](function(_0x3f6906){logger[_0x0891('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1f1f9d,_0x0891('0x14'));logger[_0x0891('0x15')](_0x0891('0x16'),_0x1f1f9d,_0x0891('0x14'),JSON[_0x0891('0x17')](_0x3f6906));if(_0x3f6906[_0x0891('0x18')]){if(_0x3f6906[_0x0891('0x18')][_0x0891('0x19')]===0x1f4){logger[_0x0891('0x18')](_0x0891('0x1a'),_0x1f1f9d,_0x3f6906[_0x0891('0x18')][_0x0891('0x1b')]);return _0x436c2e(_0x3f6906[_0x0891('0x18')][_0x0891('0x1b')]);}logger[_0x0891('0x18')](_0x0891('0x1a'),_0x1f1f9d,_0x3f6906[_0x0891('0x18')][_0x0891('0x1b')]);return _0xea4569(_0x3f6906[_0x0891('0x18')][_0x0891('0x1b')]);}else{logger[_0x0891('0x13')](_0x0891('0x1a'),_0x1f1f9d,_0x0891('0x14'));_0xea4569(_0x3f6906[_0x0891('0x1c')][_0x0891('0x1b')]);}})[_0x0891('0x1d')](function(_0x18d5d8){logger[_0x0891('0x18')]('ChatGroup,\x20%s,\x20%s',_0x1f1f9d,_0x18d5d8);_0x436c2e(_0x18d5d8);});});} \ No newline at end of file +var _0xf0a2=['randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird'];(function(_0x3f7560,_0x3ebbab){var _0x3c3cf6=function(_0x452e3c){while(--_0x452e3c){_0x3f7560['push'](_0x3f7560['shift']());}};_0x3c3cf6(++_0x3ebbab);}(_0xf0a2,0x1ca));var _0x2f0a=function(_0x3de807,_0x578002){_0x3de807=_0x3de807-0x0;var _0x228899=_0xf0a2[_0x3de807];return _0x228899;};'use strict';var _=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var moment=require(_0x2f0a('0x2'));var BPromise=require(_0x2f0a('0x3'));var rs=require(_0x2f0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f0a('0x5'))['db'];var utils=require(_0x2f0a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f0a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f0a('0x8')]['http']({'port':0x232a});config[_0x2f0a('0x9')]=_['defaults'](config[_0x2f0a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f0a('0xa'))(new Redis(config[_0x2f0a('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3175ed,_0x1679c0,_0x3c0831){return new BPromise(function(_0xb541b5,_0x2f13ab){return client[_0x2f0a('0xb')](_0x3175ed,_0x3c0831)[_0x2f0a('0xc')](function(_0x196550){logger['info'](_0x2f0a('0xd'),_0x1679c0,'request\x20sent');logger[_0x2f0a('0xe')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1679c0,_0x2f0a('0xf'),JSON[_0x2f0a('0x10')](_0x196550));if(_0x196550['error']){if(_0x196550[_0x2f0a('0x11')]['code']===0x1f4){logger[_0x2f0a('0x11')](_0x2f0a('0xd'),_0x1679c0,_0x196550[_0x2f0a('0x11')][_0x2f0a('0x12')]);return _0x2f13ab(_0x196550[_0x2f0a('0x11')][_0x2f0a('0x12')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1679c0,_0x196550['error'][_0x2f0a('0x12')]);return _0xb541b5(_0x196550['error'][_0x2f0a('0x12')]);}else{logger[_0x2f0a('0x13')](_0x2f0a('0xd'),_0x1679c0,_0x2f0a('0xf'));_0xb541b5(_0x196550[_0x2f0a('0x14')][_0x2f0a('0x12')]);}})['catch'](function(_0x4e56d8){logger[_0x2f0a('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1679c0,_0x4e56d8);_0x2f13ab(_0x4e56d8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a93d2d8..71f67c5 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 _0x8532=['./chatGroup.events','save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x346411,_0x548a5b){var _0x4bf222=function(_0x17de11){while(--_0x17de11){_0x346411['push'](_0x346411['shift']());}};_0x4bf222(++_0x548a5b);}(_0x8532,0x144));var _0x2853=function(_0x45969a,_0x17f84d){_0x45969a=_0x45969a-0x0;var _0x187203=_0x8532[_0x45969a];return _0x187203;};'use strict';var ChatGroupEvents=require(_0x2853('0x0'));var events=[_0x2853('0x1'),_0x2853('0x2'),_0x2853('0x3')];function createListener(_0x103418,_0x150597){return function(_0x1f95a1){_0x150597[_0x2853('0x4')](_0x103418,_0x1f95a1);};}function removeListener(_0x488f56,_0x5e4e38){return function(){ChatGroupEvents[_0x2853('0x5')](_0x488f56,_0x5e4e38);};}exports[_0x2853('0x6')]=function(_0x24a0ba){for(var _0x50887f=0x0,_0x19ad60=events[_0x2853('0x7')];_0x50887f<_0x19ad60;_0x50887f++){var _0x20ef00=events[_0x50887f];var _0x14e39e=createListener(_0x2853('0x8')+_0x20ef00,_0x24a0ba);ChatGroupEvents['on'](_0x20ef00,_0x14e39e);}}; \ No newline at end of file +var _0x2fe5=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2fe5,0x158));var _0x52fe=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fe5[_0x59ee6f];return _0x4c0979;};'use strict';var ChatGroupEvents=require(_0x52fe('0x0'));var events=[_0x52fe('0x1'),_0x52fe('0x2'),_0x52fe('0x3')];function createListener(_0x6a4d6e,_0x41ef29){return function(_0x522d89){_0x41ef29[_0x52fe('0x4')](_0x6a4d6e,_0x522d89);};}function removeListener(_0x474b6c,_0x55bf66){return function(){ChatGroupEvents[_0x52fe('0x5')](_0x474b6c,_0x55bf66);};}exports['register']=function(_0x453342){for(var _0x1c6757=0x0,_0x4d554e=events['length'];_0x1c6757<_0x4d554e;_0x1c6757++){var _0x2ac307=events[_0x1c6757];var _0x2fc944=createListener(_0x52fe('0x6')+_0x2ac307,_0x453342);ChatGroupEvents['on'](_0x2ac307,_0x2fc944);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a5eea79..4021e7e 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 _0x8011=['/describe','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','/:id/messages','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','get'];(function(_0x5ed5b6,_0x2b98e1){var _0x353dce=function(_0x521604){while(--_0x521604){_0x5ed5b6['push'](_0x5ed5b6['shift']());}};_0x353dce(++_0x2b98e1);}(_0x8011,0x1ed));var _0x1801=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8011[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require(_0x1801('0x0'));var util=require(_0x1801('0x1'));var path=require(_0x1801('0x2'));var timeout=require(_0x1801('0x3'));var express=require(_0x1801('0x4'));var router=express['Router']();var fs_extra=require(_0x1801('0x5'));var auth=require(_0x1801('0x6'));var interaction=require(_0x1801('0x7'));var config=require('../../config/environment');var controller=require(_0x1801('0x8'));router['get']('/',auth[_0x1801('0x9')](),controller['index']);router[_0x1801('0xa')](_0x1801('0xb'),auth[_0x1801('0x9')](),controller[_0x1801('0xc')]);router['get'](_0x1801('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1801('0xa')](_0x1801('0xe'),auth[_0x1801('0x9')](),controller[_0x1801('0xf')]);router['get'](_0x1801('0x10'),auth[_0x1801('0x9')](),controller[_0x1801('0x11')]);router[_0x1801('0xa')]('/:id/messages',auth[_0x1801('0x9')](),controller[_0x1801('0x12')]);router[_0x1801('0x13')]('/',auth[_0x1801('0x9')](),controller[_0x1801('0x14')]);router[_0x1801('0x13')](_0x1801('0x10'),auth[_0x1801('0x9')](),controller['addMembers']);router[_0x1801('0x13')](_0x1801('0x15'),auth[_0x1801('0x9')](),controller[_0x1801('0x16')]);router[_0x1801('0x17')](_0x1801('0xd'),auth[_0x1801('0x9')](),controller[_0x1801('0x18')]);router['delete'](_0x1801('0xd'),auth[_0x1801('0x9')](),controller['destroy']);router[_0x1801('0x19')](_0x1801('0x10'),auth[_0x1801('0x9')](),controller[_0x1801('0x1a')]);module[_0x1801('0x1b')]=router; \ No newline at end of file +var _0xc423=['describe','/:id','show','get','/:id/members','/:id/messages','getMessages','create','post','addMessage','put','delete','destroy','removeMembers','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xc423,0x102));var _0x3c42=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc423[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0x3c42('0x0'));var path=require(_0x3c42('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c42('0x2'));var router=express[_0x3c42('0x3')]();var fs_extra=require(_0x3c42('0x4'));var auth=require(_0x3c42('0x5'));var interaction=require(_0x3c42('0x6'));var config=require(_0x3c42('0x7'));var controller=require(_0x3c42('0x8'));router['get']('/',auth[_0x3c42('0x9')](),controller[_0x3c42('0xa')]);router['get'](_0x3c42('0xb'),auth[_0x3c42('0x9')](),controller[_0x3c42('0xc')]);router['get'](_0x3c42('0xd'),auth[_0x3c42('0x9')](),controller[_0x3c42('0xe')]);router[_0x3c42('0xf')]('/:id/unread',auth[_0x3c42('0x9')](),controller['getUnread']);router[_0x3c42('0xf')](_0x3c42('0x10'),auth[_0x3c42('0x9')](),controller['getMembers']);router[_0x3c42('0xf')](_0x3c42('0x11'),auth[_0x3c42('0x9')](),controller[_0x3c42('0x12')]);router['post']('/',auth[_0x3c42('0x9')](),controller[_0x3c42('0x13')]);router['post'](_0x3c42('0x10'),auth[_0x3c42('0x9')](),controller['addMembers']);router[_0x3c42('0x14')]('/:id/messages',auth[_0x3c42('0x9')](),controller[_0x3c42('0x15')]);router[_0x3c42('0x16')](_0x3c42('0xd'),auth[_0x3c42('0x9')](),controller['update']);router[_0x3c42('0x17')](_0x3c42('0xd'),auth[_0x3c42('0x9')](),controller[_0x3c42('0x18')]);router[_0x3c42('0x17')](_0x3c42('0x10'),auth[_0x3c42('0x9')](),controller[_0x3c42('0x19')]);module[_0x3c42('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4d669da..183bef0 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 _0xb846=['STRING','DATE','out','BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb846,0x1d0));var _0x6b84=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb846[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6b84('0x1')]},'ratingType':{'type':Sequelize[_0x6b84('0x2')](_0x6b84('0x3'),_0x6b84('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x6b84('0x5')]},'mailTranscript':{'type':Sequelize[_0x6b84('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6b84('0x7')]},'disposition':{'type':Sequelize[_0x6b84('0x6')]},'secondDisposition':{'type':Sequelize[_0x6b84('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x6b84('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6b84('0x6')]},'osVersion':{'type':Sequelize[_0x6b84('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6b84('0x5')]},'customerIp':{'type':Sequelize[_0x6b84('0x6')]},'formData':{'type':Sequelize[_0x6b84('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6b84('0x2')]('in',_0x6b84('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6b84('0x6')]},'customerPort':{'type':Sequelize[_0x6b84('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6b84('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6b84('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xe3db=['star','thumb','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports','INTEGER','ENUM'];(function(_0x1c8d89,_0x3efad2){var _0x43027e=function(_0x158284){while(--_0x158284){_0x1c8d89['push'](_0x1c8d89['shift']());}};_0x43027e(++_0x3efad2);}(_0xe3db,0xc8));var _0xbe3d=function(_0xc722b6,_0x43d258){_0xc722b6=_0xc722b6-0x0;var _0x4f6ed9=_0xe3db[_0xc722b6];return _0x4f6ed9;};'use strict';var Sequelize=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbe3d('0x2')]},'ratingType':{'type':Sequelize[_0xbe3d('0x3')](_0xbe3d('0x4'),_0xbe3d('0x5')),'defaultValue':_0xbe3d('0x4')},'ratingMessage':{'type':Sequelize[_0xbe3d('0x6')]},'pathTranscript':{'type':Sequelize[_0xbe3d('0x6')]},'mailTranscript':{'type':Sequelize[_0xbe3d('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbe3d('0x8')]},'disposition':{'type':Sequelize[_0xbe3d('0x7')]},'secondDisposition':{'type':Sequelize[_0xbe3d('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbe3d('0x7')]},'browserName':{'type':Sequelize[_0xbe3d('0x7')]},'browserVersion':{'type':Sequelize[_0xbe3d('0x7')]},'osName':{'type':Sequelize[_0xbe3d('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xbe3d('0x7')]},'deviceVendor':{'type':Sequelize[_0xbe3d('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xbe3d('0x7')]},'formData':{'type':Sequelize[_0xbe3d('0x6')](_0xbe3d('0x9'))},'read1stAt':{'type':Sequelize[_0xbe3d('0x8')]},'lastMsgAt':{'type':Sequelize[_0xbe3d('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xbe3d('0x3')]('in',_0xbe3d('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbe3d('0x7')]},'customerPort':{'type':Sequelize[_0xbe3d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xbe3d('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xbe3d('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4482a40..ab5be28 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 _0x9f62=['findAll','getMyMessages','addTags','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','.pdf','err','zip-dir','moment','bluebird','mustache','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','stack','name','send','render','merge','body','contact','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','talking','answered','unmanaged','abandoned','total','UserId','closed','waiting','disposition','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','sequelize','toString','ChatInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','includeAll','include','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','ValidationError','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','nolimit','sort','$gte','options'];(function(_0x3bfd1c,_0x40e285){var _0x22527d=function(_0x21f04a){while(--_0x21f04a){_0x3bfd1c['push'](_0x3bfd1c['shift']());}};_0x22527d(++_0x40e285);}(_0x9f62,0x154));var _0x29f6=function(_0x257097,_0x46a074){_0x257097=_0x257097-0x0;var _0x38d0e7=_0x9f62[_0x257097];return _0x38d0e7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x0'));var rp=require('request-promise');var moment=require(_0x29f6('0x1'));var BPromise=require(_0x29f6('0x2'));var Mustache=require(_0x29f6('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x29f6('0x4'));var fs=require('fs');var _=require(_0x29f6('0x5'));var squel=require(_0x29f6('0x6'));var Redis=require(_0x29f6('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0x29f6('0x8'));var pdf=require(_0x29f6('0x9'));var logger=require(_0x29f6('0xa'))(_0x29f6('0xb'));var config=require(_0x29f6('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x29f6('0xd'),'port':0x18eb});var socket=require(_0x29f6('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x29f6('0xf')](socket);var jayson=require(_0x29f6('0x10'));var client=jayson['client'][_0x29f6('0x11')]({'port':0x232b});var client9004=jayson[_0x29f6('0x12')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b9b6a,_0x559585,_0x57b2d2,_0x2ae0e4){return new BPromise(function(_0x55cf4,_0x189344){var _0x11a1fd=_0x2ae0e4||client;return _0x11a1fd[_0x29f6('0x13')](_0x5b9b6a,_0x57b2d2)[_0x29f6('0x14')](function(_0x35d2e2){logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));logger[_0x29f6('0x18')](_0x29f6('0x19'),_0x559585,_0x29f6('0x17'),JSON[_0x29f6('0x1a')](_0x35d2e2));if(_0x35d2e2[_0x29f6('0x1b')]){if(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x559585,_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x189344(_0x35d2e2[_0x29f6('0x1b')]['message']);}logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x35d2e2['error'][_0x29f6('0x1d')]);return _0x55cf4(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);}else{logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));_0x55cf4(_0x35d2e2['result'][_0x29f6('0x1d')]);}})['catch'](function(_0x4acb15){logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x4acb15);_0x189344(_0x4acb15);});});}function respondWithStatusCode(_0x39c6b3,_0xafb5dd){_0xafb5dd=_0xafb5dd||0xcc;return function(_0x54ddeb){if(_0x54ddeb){return _0x39c6b3[_0x29f6('0x1e')](_0xafb5dd);}return _0x39c6b3['status'](_0xafb5dd)[_0x29f6('0x1f')]();};}function respondWithResult(_0xcce041,_0x4200cc){_0x4200cc=_0x4200cc||0xc8;return function(_0x1b80aa){if(_0x1b80aa){return _0xcce041['status'](_0x4200cc)[_0x29f6('0x20')](_0x1b80aa);}};}function respondWithFilteredResult(_0x4d494f,_0x47c385){return function(_0x1401fb){if(_0x1401fb){var _0x45f792=typeof _0x47c385[_0x29f6('0x21')]===_0x29f6('0x22')&&typeof _0x47c385[_0x29f6('0x23')]===_0x29f6('0x22');var _0x23c630=_0x1401fb['count'];var _0x2183b7=_0x45f792?0x0:_0x47c385[_0x29f6('0x21')];var _0x1ab8d8=_0x45f792?_0x1401fb[_0x29f6('0x24')]:_0x47c385[_0x29f6('0x21')]+_0x47c385[_0x29f6('0x23')];var _0x3790f5;if(_0x1ab8d8>=_0x23c630){_0x1ab8d8=_0x23c630;_0x3790f5=0xc8;}else{_0x3790f5=0xce;}_0x4d494f[_0x29f6('0x25')](_0x3790f5);return _0x4d494f[_0x29f6('0x26')](_0x29f6('0x27'),_0x2183b7+'-'+_0x1ab8d8+'/'+_0x23c630)[_0x29f6('0x20')](_0x1401fb);}return null;};}function saveUpdates(_0x1c3f0b){return function(_0x40c830){if(_0x40c830){return _0x40c830[_0x29f6('0x28')](_0x1c3f0b)[_0x29f6('0x14')](function(_0x218931){return _0x218931;});}return null;};}function removeEntity(_0x3a7249){return function(_0x5492c2){if(_0x5492c2){return _0x5492c2['destroy']()[_0x29f6('0x14')](function(){_0x3a7249['status'](0xcc)[_0x29f6('0x1f')]();});}};}function handleEntityNotFound(_0xc8d2c5){return function(_0x1e1bb6){if(!_0x1e1bb6){_0xc8d2c5[_0x29f6('0x1e')](0x194);}return _0x1e1bb6;};}function handleError(_0x5e5d89,_0x53e11f){_0x53e11f=_0x53e11f||0x1f4;return function(_0x1bde69){logger[_0x29f6('0x1b')](_0x1bde69[_0x29f6('0x29')]);if(_0x1bde69[_0x29f6('0x2a')]){delete _0x1bde69[_0x29f6('0x2a')];}_0x5e5d89[_0x29f6('0x25')](_0x53e11f)[_0x29f6('0x2b')](_0x1bde69);};}function getMustacheRender(_0x1c3f0f,_0xad83a3){return Mustache[_0x29f6('0x2c')](_0x1c3f0f,_[_0x29f6('0x2d')](_0xad83a3[_0x29f6('0x2e')],{'contact':_0xad83a3[_0x29f6('0x2f')],'message':_0xad83a3[_0x29f6('0x1d')],'agent':_0xad83a3['agent'],'interaction':_0xad83a3['interaction'],'account':_0xad83a3[_0x29f6('0x30')]}))||'';}function getInteractionUsers(_0x44cf19,_0x1cd62a){return new BPromise(function(_0x5416dc,_0x3e1e25){try{if(_0x1cd62a[_0x44cf19['id']]){_0x44cf19[_0x29f6('0x31')]=_[_0x29f6('0x32')](_0x1cd62a[_0x44cf19['id']],function(_0x27d945){return{'id':_0x27d945['id'],'fullname':_0x27d945[_0x29f6('0x33')]};});}}catch(_0x48fbd1){_0x3e1e25(_0x48fbd1);}_0x5416dc(_0x44cf19);});}function getInteractionTags(_0x7695ee,_0x2ad06f){return new BPromise(function(_0x2c3441,_0x1b51cc){try{if(_0x7695ee['TagIds']){_0x7695ee[_0x29f6('0x34')]=[];_0x7695ee[_0x29f6('0x35')][_0x29f6('0x36')](',')[_0x29f6('0x37')](function(_0x5ddc09){_0x7695ee['Tags'][_0x29f6('0x38')](_0x2ad06f[_0x5ddc09]);});}delete _0x7695ee['TagIds'];}catch(_0x10f077){_0x1b51cc(_0x10f077);}_0x2c3441(_0x7695ee);});}function updateChatInteraction(_0x551411,_0x3a1a75,_0x537210){return new BPromise(function(_0x34b1ea,_0x11fb2d){return getInteractionUsers(_0x551411,_0x537210)['then'](function(_0x1431fc){return getInteractionTags(_0x1431fc,_0x3a1a75);})['then'](function(_0x3f3475){return getStateInteraction(_0x3f3475);})[_0x29f6('0x14')](function(_0x4aea11){_0x34b1ea(_0x4aea11);})[_0x29f6('0x39')](function(_0xc6a6b1){_0x11fb2d(_0xc6a6b1);});});}function getStateInteraction(_0x2cad42){return new BPromise(function(_0x1e9d5a){_0x2cad42['waiting']=0x0;_0x2cad42[_0x29f6('0x3a')]=0x0;_0x2cad42[_0x29f6('0x3b')]=0x0;_0x2cad42[_0x29f6('0x3c')]=0x0;_0x2cad42[_0x29f6('0x3d')]=0x0;_0x2cad42[_0x29f6('0x3e')]=0x0;if(!_0x2cad42['closed']&&!_0x2cad42[_0x29f6('0x3f')]){_0x2cad42['waiting']+=0x1;}if(!_0x2cad42[_0x29f6('0x40')]&&_0x2cad42['UserId']){_0x2cad42[_0x29f6('0x3a')]+=0x1;if(_0x2cad42[_0x29f6('0x41')]){_0x2cad42['waiting']-=0x1;}}if(_0x2cad42[_0x29f6('0x40')]&&_0x2cad42[_0x29f6('0x42')]===_0x29f6('0x3d')){_0x2cad42[_0x29f6('0x3d')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42[_0x29f6('0x40')]&&!_0x2cad42[_0x29f6('0x3f')]&&_0x2cad42['disposition']){_0x2cad42[_0x29f6('0x3c')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42['closed']&&_0x2cad42['UserId']){_0x2cad42['answered']+=0x1;if(_0x2cad42[_0x29f6('0x3a')]){_0x2cad42[_0x29f6('0x3a')]-=0x1;}}_0x2cad42[_0x29f6('0x3e')]+=0x1;_0x1e9d5a(_0x2cad42);});}exports[_0x29f6('0x43')]=function(_0x19fd60,_0x270842){var _0x29b3f6={},_0x155ffb={},_0x352119={'count':0x0,'rows':[]};var _0x1bde93=_['map'](db['ChatInteraction'][_0x29f6('0x44')],function(_0x450e76){return{'name':_0x450e76[_0x29f6('0x45')],'type':_0x450e76[_0x29f6('0x46')]['key']};});_0x155ffb[_0x29f6('0x47')]=_[_0x29f6('0x32')](_0x1bde93,'name');_0x155ffb[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x19fd60[_0x29f6('0x48')]);_0x155ffb[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],_0x155ffb[_0x29f6('0x48')]);_0x29b3f6[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x19fd60[_0x29f6('0x48')]['fields']));_0x29b3f6[_0x29f6('0x4c')]=_0x29b3f6[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x29b3f6[_0x29f6('0x4c')]:_0x155ffb[_0x29f6('0x47')];if(!_0x19fd60['query'][_0x29f6('0x4f')]('nolimit')){_0x29b3f6['limit']=qs[_0x29f6('0x23')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x23')]);_0x29b3f6[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x19fd60['query'][_0x29f6('0x21')]);}_0x29b3f6[_0x29f6('0x50')]=qs['sort'](_0x19fd60[_0x29f6('0x48')]['sort']);_0x29b3f6[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x19fd60[_0x29f6('0x48')],_0x155ffb['filters']),_0x1bde93);var _0x199060=[];var _0xaa915c=squel[_0x29f6('0x53')]()[_0x29f6('0x54')]('id')[_0x29f6('0x54')](_0x29f6('0x2a'))[_0x29f6('0x54')]('color')[_0x29f6('0x55')](_0x29f6('0x56'));var _0x3bca11=squel[_0x29f6('0x53')]()[_0x29f6('0x54')](_0x29f6('0x57'))[_0x29f6('0x54')](_0x29f6('0x58'))[_0x29f6('0x54')](_0x29f6('0x59'))['from']('user_has_chat_interactions','ui')[_0x29f6('0x5a')](_0x29f6('0x5b'),'u',_0x29f6('0x5c'));var _0x5ab84e=squel[_0x29f6('0x53')]()['from']('chat_interactions','i')[_0x29f6('0x5a')](_0x29f6('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x29f6('0x5b'),'o',_0x29f6('0x5e'))[_0x29f6('0x5a')]('chat_websites','a',_0x29f6('0x5f'))[_0x29f6('0x5a')](_0x29f6('0x60'),'me',_0x29f6('0x61'))[_0x29f6('0x5a')](_0x29f6('0x62'),'it',_0x29f6('0x63'))[_0x29f6('0x5a')](_0x29f6('0x56'),'t',_0x29f6('0x64'));var _0x2d4c8d=squel[_0x29f6('0x65')]();var _0x434e04=[];var _0x5078d1=squel['expr']();var _0x2bd7d9;if(_0x19fd60['query'][_0x29f6('0x66')]){_0x2bd7d9=as[_0x29f6('0x67')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x66')]);var _0x2f757b=_0x2bd7d9['sqlOperator'];for(var _0x56c442=0x0;_0x56c442<_0x2bd7d9[_0x29f6('0x68')][_0x29f6('0x4e')];_0x56c442++){var _0x293f9d=_0x2bd7d9[_0x29f6('0x68')][_0x56c442];var _0x56342e='i';var _0x32291b=_['find'](_0x1bde93,['name',_0x293f9d[_0x29f6('0x54')]]);if(!_0x32291b){switch(_0x293f9d[_0x29f6('0x54')]){case'unreadMessages':if(_0x293f9d[_0x29f6('0x69')]==0x1){_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d['field']+_0x29f6('0x6b'));}else{_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d[_0x29f6('0x54')]+_0x29f6('0x6c'));}break;case _0x29f6('0x6d'):if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){if(_0x293f9d['value'][_0x29f6('0x36')]('\x20')['length']>0x1){_0x2d4c8d[_0x2f757b](_0x29f6('0x70'),qs['getFullTextValue'](_0x293f9d['value']),null);}else{var _0x1a3357='%'+_0x293f9d[_0x29f6('0x69')]+'%';_0x2d4c8d[_0x2f757b](_0x29f6('0x71'),_0x1a3357,_0x1a3357,_0x1a3357);}}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x72')]);_0x293f9d[_0x29f6('0x54')]='ContactId';_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b[_0x29f6('0x46')],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x76'):var _0x56f3cb=_0x293f9d[_0x29f6('0x69')][_0x29f6('0x36')](',')[_0x29f6('0x32')](function(_0x456578){return Number(_0x456578);});_0x56f3cb[_0x29f6('0x37')](function(_0x122a1a){_0x5078d1['or'](_0x29f6('0x77'),'%,'+_0x122a1a+',%');});_0x434e04=_[_0x29f6('0x78')](_0x434e04,_0x56f3cb);break;case'User':if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){_0x2d4c8d[_0x2f757b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x293f9d[_0x29f6('0x69')]+'%',null);}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x3f')]);_0x293f9d['field']=_0x29f6('0x3f');_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e['text'],_0x411f3e['value'][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x2e'):_0x411f3e=as[_0x29f6('0x73')]('me',null,_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')]['start'],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);break;}}else{var _0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}}}else{var _0x478ed0=_(_0x19fd60[_0x29f6('0x48')])[_0x29f6('0x49')]()[_0x29f6('0x32')](function(_0x1f401c){return _[_0x29f6('0x79')](_0x1bde93,[_0x29f6('0x2a'),_0x1f401c])?_0x1f401c:undefined;})['compact']()[_0x29f6('0x69')]();if(!_['isEmpty'](_0x478ed0)){_0x478ed0['forEach'](function(_0x4f9907){if(_0x4f9907===_0x29f6('0x7a')){_0x5ab84e['where'](_0x29f6('0x7b'),[][_0x29f6('0x7c')](_0x19fd60[_0x29f6('0x48')][_0x4f9907]));}else if(_0x4f9907===_0x29f6('0x7d')){var _0x8a5e58=JSON[_0x29f6('0x7e')](_0x19fd60[_0x29f6('0x48')][_0x4f9907])['$gte'];var _0x3a23f3=JSON['parse'](_0x19fd60[_0x29f6('0x48')][_0x4f9907])[_0x29f6('0x7f')];_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x80'),_0x8a5e58,_0x3a23f3);}else{if(_0x19fd60[_0x29f6('0x48')][_0x4f9907]===_0x29f6('0x81')){_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x82'));}else{_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x83'),_0x19fd60[_0x29f6('0x48')][_0x4f9907]);}}});}if(_0x19fd60[_0x29f6('0x48')]['read']){if(_0x19fd60['query']['read']==0x1){_0x5ab84e[_0x29f6('0x6a')](_0x29f6('0x84'));}else{_0x5ab84e['having'](_0x29f6('0x85'));}}if(_0x19fd60['query'][_0x29f6('0x86')]){_0x434e04=_[_0x29f6('0x87')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')])?_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]:new Array(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]);_0x434e04[_0x29f6('0x37')](function(_0xa2ab9e){_0x5078d1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa2ab9e+',%');});}if(_0x19fd60[_0x29f6('0x48')]['filter']){var _0x16bb3c=_0x19fd60[_0x29f6('0x48')][_0x29f6('0x88')][_0x29f6('0x89')]('\x5c','\x5c\x5c')[_0x29f6('0x89')](/'/g,'\x27\x27');if(qs[_0x29f6('0x8a')](_0x16bb3c)){_0x2d4c8d['or'](_0x29f6('0x8b'),_0x16bb3c+'%');}else{_0x2d4c8d['or'](_0x29f6('0x8c'),qs['getFullTextValue'](_0x16bb3c))['or'](_0x29f6('0x8d'),_0x16bb3c+'%');}}}_0x5ab84e[_0x29f6('0x51')](_0x2d4c8d);_0x5ab84e['group']('i.id');var _0x216f51={'type':db[_0x29f6('0x8e')][_0x29f6('0x8f')][_0x29f6('0x90')],'raw':!![]};var _0x467dd2=_0x5ab84e[_0x29f6('0x91')]();_0x467dd2[_0x29f6('0x54')](_0x29f6('0x92'));_0x467dd2[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));if(_0x29b3f6[_0x29f6('0x50')]){_0x29b3f6['order']['forEach'](function(_0x2e2f16){var _0x180658=_0x2e2f16[0x0]==='contactName'?_0x2e2f16[0x0]:'i.'+_0x2e2f16[0x0];_0x5ab84e[_0x29f6('0x50')](_0x180658,_0x2e2f16[0x1]===_0x29f6('0x95')?![]:!![]);});}if(!_[_0x29f6('0x96')](_0x434e04)){_0x5ab84e[_0x29f6('0x6a')](_0x5078d1);_0x467dd2[_0x29f6('0x51')](_0x29f6('0x97'),_0x434e04);}BPromise[_0x29f6('0x98')]()['then'](function(){if(!_0x2bd7d9){if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return;_0x467dd2[_0x29f6('0x51')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x99'));return;}if(_0x19fd60['user'][_0x29f6('0x9a')]!==_0x29f6('0x9b'))return;return _0x19fd60['user'][_0x29f6('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x405124){if(_[_0x29f6('0x96')](_0x405124)){_0x467dd2[_0x29f6('0x51')](_0x29f6('0x9d'));_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x9d'));}else{_0x467dd2['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));_0x5ab84e[_0x29f6('0x51')]('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));}});})['then'](function(){if(_0x19fd60[_0x29f6('0x9e')][_0x29f6('0x9a')]===_0x29f6('0x9b')&&!_0x2bd7d9&&!_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return[];return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x467dd2['toString'](),_0x216f51);})[_0x29f6('0x14')](function(_0x365b6d){_0x352119[_0x29f6('0x24')]=_0x365b6d['length'];if(_0x352119['count']===0x0)return[];return db['sequelize']['query'](_0xaa915c[_0x29f6('0xa0')](),_0x216f51)['then'](function(_0x537a8d){_0x199060=_['keyBy'](_0x537a8d,'id');_0x216f51=_[_0x29f6('0x2d')](_0x216f51,{'model':db[_0x29f6('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x4d')]){_0x29b3f6[_0x29f6('0x4c')]['forEach'](function(_0x28cf80){_0x5ab84e['field']('i.'+_0x28cf80);});}else{_0x5ab84e[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));_0x5ab84e[_0x29f6('0x54')]('a.key','Account.key');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa2'),_0x29f6('0xa3'));_0x5ab84e['field'](_0x29f6('0xa4'),_0x29f6('0xa5'));_0x5ab84e['field'](_0x29f6('0xa6'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa7'),_0x29f6('0xa8'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa9'),_0x29f6('0xaa'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xab'),_0x29f6('0xac'));_0x5ab84e['field'](_0x29f6('0xad'),'Contact.phone');_0x5ab84e['field']('c.mobile',_0x29f6('0xae'));_0x5ab84e[_0x29f6('0x54')]('c.fax','Contact.fax');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xaf'),'Owner.fullname');_0x5ab84e['field']('o.internal','Owner.internal');_0x5ab84e[_0x29f6('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x29f6('0x35'));}if(_0x29b3f6[_0x29f6('0x23')])_0x5ab84e['limit'](_0x29b3f6[_0x29f6('0x23')]);if(_0x29b3f6[_0x29f6('0x21')])_0x5ab84e['offset'](_0x29b3f6[_0x29f6('0x21')]);return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x5ab84e[_0x29f6('0xa0')](),_0x216f51);})[_0x29f6('0x14')](function(_0x399328){if(_0x399328[_0x29f6('0x4e')]>0x0)_0x3bca11[_0x29f6('0x51')](_0x29f6('0xb0'),_[_0x29f6('0x32')](_0x399328,'id'));return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x3bca11[_0x29f6('0xa0')](),_0x216f51)[_0x29f6('0x14')](function(_0x5076ed){var _0x24757e=_[_0x29f6('0xb1')](_0x5076ed,_0x29f6('0xb2'));var _0x264617=[];_0x399328[_0x29f6('0x37')](function(_0x3569f7){_0x264617[_0x29f6('0x38')](updateChatInteraction(_0x3569f7,_0x199060,_0x24757e));});return BPromise['all'](_0x264617);});});})[_0x29f6('0x14')](function(_0x4ec09d){_0x352119[_0x29f6('0xb3')]=_0x4ec09d;return _0x352119;})[_0x29f6('0x14')](respondWithFilteredResult(_0x270842,_0x29b3f6))[_0x29f6('0x39')](handleError(_0x270842,null));};exports[_0x29f6('0xb4')]=function(_0x43c44d,_0x63517e){var _0x2dc960={'raw':![],'where':{'id':_0x43c44d[_0x29f6('0xb5')]['id']}},_0x312a6f={};_0x312a6f['model']=_[_0x29f6('0x49')](db[_0x29f6('0xa1')]['rawAttributes']);_0x312a6f['query']=_[_0x29f6('0x49')](_0x43c44d[_0x29f6('0x48')]);_0x312a6f[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x312a6f['model'],_0x312a6f[_0x29f6('0x48')]);_0x2dc960[_0x29f6('0x4c')]=_['intersection'](_0x312a6f[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x43c44d[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x2dc960[_0x29f6('0x4c')]=_0x2dc960[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2dc960[_0x29f6('0x4c')]:_0x312a6f[_0x29f6('0x47')];if(_0x43c44d[_0x29f6('0x48')][_0x29f6('0xb6')]){_0x2dc960[_0x29f6('0xb7')]=[{'all':!![]}];}_0x2dc960=_[_0x29f6('0x2d')]({},_0x2dc960,_0x43c44d['options']);return db[_0x29f6('0xa1')][_0x29f6('0xb8')](_0x2dc960)[_0x29f6('0x14')](handleEntityNotFound(_0x63517e,null))[_0x29f6('0x14')](respondWithResult(_0x63517e,null))['catch'](handleError(_0x63517e,null));};exports[_0x29f6('0xb9')]=function(_0x2ffad1,_0x37ea1b){return db['ChatInteraction'][_0x29f6('0xb9')](_0x2ffad1[_0x29f6('0x2e')],{})['then'](respondWithResult(_0x37ea1b,0xc9))[_0x29f6('0x39')](handleError(_0x37ea1b,null));};exports[_0x29f6('0x28')]=function(_0x26f030,_0x247bce){if(_0x26f030[_0x29f6('0x2e')]['id']){delete _0x26f030[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x26f030[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x247bce,null))[_0x29f6('0x14')](saveUpdates(_0x26f030['body'],null))['then'](respondWithResult(_0x247bce,null))[_0x29f6('0x39')](handleError(_0x247bce,null));};exports[_0x29f6('0xba')]=function(_0x1621b7,_0x1f0e72){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x1621b7[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1f0e72,null))['then'](removeEntity(_0x1f0e72,null))['catch'](handleError(_0x1f0e72,null));};exports['describe']=function(_0x1fd477,_0x45dfd1){return db[_0x29f6('0xa1')][_0x29f6('0xbb')]()['then'](respondWithResult(_0x45dfd1,null))[_0x29f6('0x39')](handleError(_0x45dfd1,null));};exports[_0x29f6('0xbc')]=function(_0x4f2471,_0x1ef540){var _0x5a51c0=_0x4f2471[_0x29f6('0xb5')]['id'];var _0x2a2e0e;var _0xaccfb7;var _0x19c10d;return db['ChatInteraction'][_0x29f6('0xbd')]({'where':{'id':_0x5a51c0}})['then'](function(_0x47785a){_0x2a2e0e=_0x47785a;return db[_0x29f6('0xbe')][_0x29f6('0xbd')]({'where':{'id':_0x47785a[_0x29f6('0x7a')]},'attributes':['id',_0x29f6('0xbf'),_0x29f6('0xc0'),'vidaooTopic','vidaooNote',_0x29f6('0xc1')],'raw':!![]});})['then'](function(_0x5db958){if(_0x5db958&&_0x5db958[_0x29f6('0xbf')]&&_0x5db958['vidaooEscalation']){_0xaccfb7=_0x5db958;var _0x67c30a={'interaction':{'id':_0x5a51c0},'agent':{'id':_0x4f2471[_0x29f6('0x9e')]['id'],'name':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x2a')],'fullname':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x33')],'email':_0x4f2471['user'][_0x29f6('0xc2')]},'contact':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x2f')],'account':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x30')]};var _0x1cec09={'rejectUnauthorized':![],'method':_0x29f6('0xc3'),'url':_0x29f6('0xc4'),'headers':{'X-APIKEY':_0x5db958[_0x29f6('0xbf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f2471[_0x29f6('0x9e')][_0x29f6('0xc2')]],'buttons':null,'topic':_0xaccfb7['vidaooTopic'],'note':_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc6')])?null:getMustacheRender(_0xaccfb7['vidaooNote'],_0x67c30a),'metadata':null},'redirect':_0x29f6('0xc7'),'json':!![]};try{if(!_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc1')])){var _0x50d48d=getMustacheRender(_0xaccfb7['vidaooMetadata'],_0x67c30a);var _0x1413a5=JSON[_0x29f6('0x7e')](_0x50d48d);_0x1cec09[_0x29f6('0x2e')][_0x29f6('0xc8')]=_0x1413a5;}}catch(_0x2b6357){throw new db[(_0x29f6('0x8e'))]['ValidationError'](_0x29f6('0xc9'));}return rp(_0x1cec09);}else{throw new db[(_0x29f6('0x8e'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x231f26){_0x19c10d=_0x231f26;if(_0x19c10d['id']){var _0x578d49={'body':_0x19c10d[_0x29f6('0xca')],'ChatWebsiteId':_0xaccfb7['id'],'ChatInteractionId':_0x2a2e0e['id'],'direction':'out','UserId':_0x4f2471[_0x29f6('0x9e')]['id']};return db[_0x29f6('0xcb')][_0x29f6('0xb9')](_0x578d49,{});}else{throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x29f6('0x14')](function(){return _0x2a2e0e['updateAttributes']({'vidaooSessionId':_0x19c10d['id']});})[_0x29f6('0x14')](respondWithResult(_0x1ef540,null))[_0x29f6('0x39')](handleError(_0x1ef540,null));};exports[_0x29f6('0xcd')]=function(_0x19d1cb,_0x478660){if(_0x19d1cb[_0x29f6('0x2e')]['id']){delete _0x19d1cb[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x19d1cb[_0x29f6('0xb5')]['id']},'include':[{'model':db['CmContact'],'as':_0x29f6('0x6d')}]})[_0x29f6('0x14')](handleEntityNotFound(_0x478660,null))['then'](saveUpdates(_0x19d1cb[_0x29f6('0x2e')],null))['then'](respondWithResult(_0x478660,null))[_0x29f6('0x39')](handleError(_0x478660,null));};exports[_0x29f6('0xce')]=function(_0x52c66d,_0x955f7){if(_0x52c66d[_0x29f6('0x2e')]['id']){delete _0x52c66d['body']['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x52c66d[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](function(_0x352a07){if(!_0x352a07){logger[_0x29f6('0x1b')](_0x29f6('0xcf'),_0x29f6('0xce'),0x194,'entity\x20not\x20found');_0x955f7[_0x29f6('0x1e')](0x194);}else{if(_0x352a07[_0x29f6('0x3f')]){throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Interaction\x20already\x20assigned');}}return _0x352a07;})[_0x29f6('0x14')](function(_0x10648e){if(_0x10648e){return _0x10648e[_0x29f6('0x28')]({'closed':_0x52c66d[_0x29f6('0x2e')][_0x29f6('0x40')],'disposition':_0x52c66d['body']['disposition']})[_0x29f6('0x14')](function(_0x1b3b27){return _0x1b3b27;});}})['then'](function(){return respondWithRpcPromise(_0x29f6('0xd0'),'abandon',_0x52c66d['body'],client9004);})[_0x29f6('0x14')](respondWithResult(_0x955f7,null))['catch'](handleError(_0x955f7,null));};exports[_0x29f6('0xd1')]=function(_0x24a7fb,_0x454c4c){_0x24a7fb[_0x29f6('0x2e')]['name']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd3')];_0x24a7fb[_0x29f6('0x2e')][_0x29f6('0xd4')]=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd5')];_0x24a7fb['body']['type']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd6')];return db[_0x29f6('0xd7')][_0x29f6('0xb9')](_0x24a7fb[_0x29f6('0x2e')])[_0x29f6('0x14')](respondWithResult(_0x454c4c,0xc9))[_0x29f6('0x39')](handleError(_0x454c4c,null));};exports[_0x29f6('0xd8')]=function(_0x3d131a,_0x2bc181){return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d131a[_0x29f6('0xb5')]['id']},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null))[_0x29f6('0x14')](function(_0x583f5f){if(_0x583f5f){if(_0x583f5f[_0x29f6('0x40')]){return _0x2bc181[_0x29f6('0x25')](0x193)[_0x29f6('0x20')]({'status':0x193,'message':_0x29f6('0xd9')});}return db[_0x29f6('0xd7')]['findOne']({'where':{'id':_0x3d131a[_0x29f6('0x48')][_0x29f6('0xda')]},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null));}})['then'](function(_0x2378b8){if(_0x2378b8){var _0x2a5414=_0x2378b8[_0x29f6('0xdb')]!==null;var _0x189048=path['join'](config[_0x29f6('0xdc')],'server/files/attachments/');if(_0x2a5414){_0x189048=path[_0x29f6('0xdd')](_0x189048,'offline-chat/');}var _0x2aa18b=path[_0x29f6('0xdd')](_0x189048,_0x2378b8[_0x29f6('0xd4')]);return _0x2bc181[_0x29f6('0xde')](_0x2aa18b);}})['catch'](handleError(_0x2bc181,null));};exports[_0x29f6('0xdf')]=function(_0x2216ef,_0x4577ee){var _0x2ef994=null;var _0x28e4c5=null;var _0x168724=null;if(_0x2216ef[_0x29f6('0x2e')]['id']){delete _0x2216ef[_0x29f6('0x2e')]['id'];}if(_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')]){_0x168724=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server/files/chat/upload/',util[_0x29f6('0xe1')](_0x29f6('0xe2'),Date[_0x29f6('0xe3')]()));_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe4')]=_0x168724;}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x2216ef[_0x29f6('0xb5')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x29f6('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x29f6('0x14')](handleEntityNotFound(_0x4577ee,null))['then'](saveUpdates(_0x2216ef[_0x29f6('0x2e')],null))[_0x29f6('0x14')](function(_0x4a3381){if(_0x4a3381){_0x2ef994=_0x4a3381;return db[_0x29f6('0xbe')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994[_0x29f6('0x7a')]}});}})[_0x29f6('0x14')](function(_0xdb766a){if(_0xdb766a){_0x28e4c5=_0xdb766a;return db[_0x29f6('0xe6')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994['ContactId']}});}})[_0x29f6('0x14')](function(_0x37735f){if(_0x37735f){if(_0x168724){var _0x399aed=null;for(var _0xe432b0=0x1;_0xe432b0<_0x2ef994[_0x29f6('0xe5')][_0x29f6('0x4e')];++_0xe432b0){_0x399aed=_0x2ef994['Messages'][_0xe432b0];var _0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):_0x29f6('0xe9');var _0x46a5da=_0x2216ef['body'][_0x29f6('0xea')]||util['format']('%s%d',_0x29f6('0xeb'),_0x399aed[_0x29f6('0x72')]);switch(_0x28e4c5[_0x29f6('0xec')]){case _0x29f6('0xed'):_0x21bc96=_0x399aed['UserId']?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed[_0x29f6('0x3f')]):_0x29f6('0xe9');break;case _0x29f6('0xee'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed[_0x29f6('0xef')][_0x29f6('0xf0')]||_0x399aed[_0x29f6('0xef')][_0x29f6('0x33')]:_0x29f6('0xe9');break;case _0x29f6('0xf1'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed['User']['fullname']:_0x29f6('0xe9');break;default:_0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):'System';}var _0x593d86=util[_0x29f6('0xe1')](_0x29f6('0xf2'),moment(_0x399aed[_0x29f6('0x7d')])[_0x29f6('0xe1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x399aed[_0x29f6('0xf3')]==='in'?_0x46a5da:_0x21bc96,_0x399aed[_0x29f6('0x2e')]);if(!_0x399aed[_0x29f6('0xf4')]){fs[_0x29f6('0xf5')](_0x168724,_0x593d86);}}return db[_0x29f6('0xf6')][_0x29f6('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x29f6('0xf7')],'as':_0x29f6('0xf8'),'raw':!![],'include':[{'model':db[_0x29f6('0xf9')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x29f6('0x14')](function(_0x294136){if(!_0x294136||!_0x294136[_0x29f6('0xf8')]||!_0x2216ef[_0x29f6('0x2e')])return _0x2ef994;var _0x59fb2a=_0x294136['getSmtpOptions']();return respondWithRpcPromise(_0x29f6('0xfa'),_0x29f6('0xfb'),{'account':_0x59fb2a,'message':{'from':util[_0x29f6('0xe1')](_0x29f6('0xfc'),_0x294136[_0x29f6('0x2a')],_0x294136['email']||_0x294136[_0x29f6('0xf8')][_0x29f6('0x9e')]),'to':_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')],'subject':_0x29f6('0xfd'),'text':util[_0x29f6('0xe1')](_0x29f6('0xfe'),_0x2216ef['body'][_0x29f6('0xe0')]),'attachments':[{'path':_0x168724}]}})[_0x29f6('0x14')](function(){return _0x2ef994;})[_0x29f6('0x39')](function(_0x3d027f){logger['error'](_0x3d027f);});})[_0x29f6('0x14')](respondWithStatusCode(_0x4577ee,0xc8))[_0x29f6('0x39')](handleError(_0x4577ee,null));};exports[_0x29f6('0xff')]=function(_0x2df557,_0x589222){return db[_0x29f6('0xcb')][_0x29f6('0xb8')]({'where':{'id':_0x2df557[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x589222,null))[_0x29f6('0x14')](function(_0x318fd1){if(_0x318fd1){return _0x318fd1[_0x29f6('0xff')](_0x2df557[_0x29f6('0x2e')]['ids'],_[_0x29f6('0x100')](_0x2df557[_0x29f6('0x2e')],['ids','id'])||{});}})['then'](respondWithResult(_0x589222,null))['catch'](handleError(_0x589222,null));};exports[_0x29f6('0x101')]=function(_0x29017d,_0x5863a2){var _0x2f7729={'raw':![],'where':{}};var _0x171342={};var _0x1dafb9={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x29017d['params']['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x5863a2,null))[_0x29f6('0x14')](function(_0x1207f7){if(_0x1207f7){_0x171342[_0x29f6('0x47')]=_[_0x29f6('0x49')](db[_0x29f6('0xcb')][_0x29f6('0x44')]);_0x171342[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x29017d[_0x29f6('0x48')]);_0x171342['filters']=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],_0x171342['query']);_0x2f7729[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x29017d[_0x29f6('0x48')]['fields']));_0x2f7729[_0x29f6('0x4c')]=_0x2f7729[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2f7729['attributes']:_0x171342['model'];if(!_0x29017d[_0x29f6('0x48')][_0x29f6('0x4f')](_0x29f6('0x102'))){_0x2f7729[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x29017d[_0x29f6('0x48')]['limit']);_0x2f7729['offset']=qs[_0x29f6('0x21')](_0x29017d[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x2f7729[_0x29f6('0x50')]=qs[_0x29f6('0x103')](_0x29017d[_0x29f6('0x48')]['sort']);_0x2f7729['where']=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x29017d[_0x29f6('0x48')],_0x171342['filters']));_0x2f7729['where']['ChatInteractionId']=_0x1207f7['id'];if(_0x29017d[_0x29f6('0x48')]['filter']){_0x2f7729[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x2f7729[_0x29f6('0x4c')],function(_0x25532f){var _0x31ebb3={};_0x31ebb3[_0x25532f]={'$like':'%'+_0x29017d[_0x29f6('0x48')][_0x29f6('0x88')]+'%'};return _0x31ebb3;})});}if(_0x29017d['query'][_0x29f6('0x104')]){var _0x173977=_0x29017d['query'][_0x29f6('0x104')][_0x29f6('0x36')](',');var _0x43acdc={};_0x43acdc[_0x173977[0x0]]={'$gte':moment(_0x173977[0x1])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7729['where']=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],_0x43acdc);}_0x2f7729=_[_0x29f6('0x2d')]({},_0x2f7729,_0x29017d[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x2f7729['where']})[_0x29f6('0x14')](function(_0x216ad8){_0x1dafb9['count']=_0x216ad8;if(_0x29017d['query']['includeAll']){_0x2f7729[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')][_0x29f6('0x106')](_0x2f7729);})[_0x29f6('0x14')](function(_0x2b1808){_0x1dafb9['rows']=_0x2b1808;return _0x1dafb9;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x5863a2,_0x2f7729))[_0x29f6('0x39')](handleError(_0x5863a2,null));};exports[_0x29f6('0x107')]=function(_0x3d68f3,_0x1cb0c0){var _0x47e4e5={'where':{}},_0x3a19d2={},_0x3450c3={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d68f3[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1cb0c0,null))[_0x29f6('0x14')](function(_0x6a318b){if(_0x6a318b){_0x3a19d2['model']=_[_0x29f6('0x49')](db[_0x29f6('0xcb')]['rawAttributes']);_0x3a19d2[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x3d68f3[_0x29f6('0x48')]);_0x3a19d2['filters']=_['intersection'](_0x3a19d2['model'],_0x3a19d2['query']);_0x47e4e5[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x3a19d2[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x47e4e5[_0x29f6('0x4c')]=_0x47e4e5[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x47e4e5[_0x29f6('0x4c')]:_0x3a19d2['model'];if(!_0x3d68f3[_0x29f6('0x48')]['hasOwnProperty'](_0x29f6('0x102'))){_0x47e4e5[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x23')]);_0x47e4e5[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x47e4e5['order']=qs['sort'](_0x3d68f3[_0x29f6('0x48')]['sort']);_0x47e4e5[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x3d68f3[_0x29f6('0x48')],_0x3a19d2[_0x29f6('0x4a')]));_0x47e4e5['where'][_0x29f6('0xb2')]=_0x6a318b['id'];if(_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x88')]){_0x47e4e5[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x47e4e5[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x47e4e5[_0x29f6('0x4c')],function(_0x346ece){var _0xc22605={};_0xc22605[_0x346ece]={'$like':'%'+_0x3d68f3[_0x29f6('0x48')]['filter']+'%'};return _0xc22605;})});}_0x47e4e5[_0x29f6('0x51')]['secret']=![];if(_0x3d68f3[_0x29f6('0x48')]['id']){_0x47e4e5[_0x29f6('0x51')]['id']={'$gt':_0x3d68f3['query']['id']};}_0x47e4e5=_['merge']({},_0x47e4e5,_0x3d68f3[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x47e4e5[_0x29f6('0x51')]})[_0x29f6('0x14')](function(_0x15db8c){_0x3450c3[_0x29f6('0x24')]=_0x15db8c;_0x47e4e5[_0x29f6('0xb7')]=[];if(_0x3d68f3['query']['includeAgent']){_0x47e4e5[_0x29f6('0xb7')]['push']({'model':db[_0x29f6('0xef')],'as':_0x29f6('0xef'),'attributes':['id','fullname',_0x29f6('0xf0')]});}if(_0x3d68f3[_0x29f6('0x48')]['includeAll']){_0x47e4e5[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')]['findAll'](_0x47e4e5);})['then'](function(_0x37c860){_0x3450c3[_0x29f6('0xb3')]=_0x37c860;return _0x3450c3;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x1cb0c0,_0x47e4e5))[_0x29f6('0x39')](handleError(_0x1cb0c0,null));};exports[_0x29f6('0x108')]=function(_0x371548,_0x7a0ebf){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x371548[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x7a0ebf,null))[_0x29f6('0x14')](function(_0x1e05e2){if(_0x1e05e2){return _0x1e05e2[_0x29f6('0x109')](_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')],_[_0x29f6('0x100')](_0x371548[_0x29f6('0x2e')],[_0x29f6('0x10a'),'id'])||{})[_0x29f6('0x10b')](function(){return db[_0x29f6('0x76')]['findAll']({'attributes':['id',_0x29f6('0x2a'),_0x29f6('0x10c')],'where':{'id':_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')]}});})['then'](function(_0x5248ba){socket[_0x29f6('0x10d')](_0x29f6('0x10e'),{'id':Number(_0x371548[_0x29f6('0xb5')]['id']),'tags':_0x5248ba||[]});return{'id':Number(_0x371548['params']['id']),'tags':_0x5248ba||[]};});}})[_0x29f6('0x14')](respondWithResult(_0x7a0ebf,null))[_0x29f6('0x39')](handleError(_0x7a0ebf,null));};exports[_0x29f6('0x10f')]=function(_0x47028e,_0x410ab5){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x47028e[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x410ab5,null))[_0x29f6('0x14')](function(_0x281c49){if(_0x281c49){return _0x281c49[_0x29f6('0x10f')](_0x47028e[_0x29f6('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x410ab5,null))[_0x29f6('0x39')](handleError(_0x410ab5,null));};exports['download']=function(_0x5250bc,_0x31ba94){var _0x31dcfe=moment()[_0x29f6('0x110')]()[_0x29f6('0xa0')]();var _0x5cf3d4=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],_0x29f6('0x111'),'files',_0x29f6('0x112'));var _0x5dcaf2=path['join'](config['root'],'server',_0x29f6('0x113'),_0x29f6('0x114'));var _0xcf75fe=path[_0x29f6('0xdd')](_0x5cf3d4,_0x31dcfe);var _0x48ecb0=util['format']('transcript-%d-%s.zip',_0x5250bc[_0x29f6('0xb5')]['id'],_0x31dcfe);var _0x5de30e=path[_0x29f6('0xdd')](_0x5cf3d4,_0x48ecb0);var _0x10989a=[];_0x10989a[_0x29f6('0x38')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10989a[_0x29f6('0x38')]({'model':db[_0x29f6('0xe6')],'as':_0x29f6('0x6d'),'attributes':['id',_0x29f6('0x115'),_0x29f6('0x116')],'raw':!![]});if(_0x5250bc['query'][_0x29f6('0x114')]){_0x10989a[_0x29f6('0x38')]({'model':db['Attachment'],'as':_0x29f6('0xd7'),'raw':!![]});}var _0x15c951=[{'model':db[_0x29f6('0xcb')],'as':'Messages','attributes':['id','body',_0x29f6('0x7d'),'direction',_0x29f6('0xf4'),_0x29f6('0x117')],'include':_0x10989a}];_0x15c951['push']({'model':db['ChatWebsite'],'as':_0x29f6('0x118'),'attributes':['id',_0x29f6('0x2a')]});_0x15c951[_0x29f6('0x38')]({'model':db['User'],'as':_0x29f6('0x119'),'attributes':['id',_0x29f6('0x33')]});return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x5250bc[_0x29f6('0xb5')]['id']},'include':_0x15c951})['then'](handleEntityNotFound(_0x31ba94,null))[_0x29f6('0x14')](function(_0x4ad41d){if(_0x4ad41d){var _0x598bcd=_0x4ad41d['get']({'plain':!![]});fs['mkdirSync'](_0xcf75fe);var _0x53751c={'channel':_0x29f6('0x11a'),'account':_0x598bcd['Account'][_0x29f6('0x2a')],'agent':_0x598bcd[_0x29f6('0x119')]?_0x598bcd[_0x29f6('0x119')][_0x29f6('0x33')]:_0x29f6('0x11b'),'createdAt':moment(_0x598bcd['createdAt'])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'closedAt':_0x598bcd['closed']?moment(_0x598bcd[_0x29f6('0x11d')])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29f6('0xa0')]():'','disposition':_0x598bcd['disposition'],'chatInfo':{'browser':_0x598bcd[_0x29f6('0x11e')],'os':_0x598bcd[_0x29f6('0x11f')],'referer':_0x598bcd[_0x29f6('0x120')],'customerIp':_0x598bcd[_0x29f6('0x121')],'customerPort':_0x598bcd[_0x29f6('0x122')]?_0x598bcd[_0x29f6('0x122')]:_0x29f6('0x11b')},'messages':_(_0x598bcd[_0x29f6('0xe5')])[_0x29f6('0x123')]()[_0x29f6('0x88')]({'secret':![]})[_0x29f6('0x32')](function(_0x2fd414){if(_0x2fd414['Attachment']){var _0x49c5f6=path[_0x29f6('0xdd')](_0x5dcaf2,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]);if(fs[_0x29f6('0x124')](_0x49c5f6)){fs[_0x29f6('0x125')](_0x49c5f6)[_0x29f6('0x126')](fs[_0x29f6('0x127')](path[_0x29f6('0xdd')](_0xcf75fe,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')])));}}return{'date':moment(_0x2fd414[_0x29f6('0x7d')])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'sender':_0x2fd414[_0x29f6('0xf3')]===_0x29f6('0x128')?_0x2fd414[_0x29f6('0xef')]?_0x2fd414[_0x29f6('0xef')]['fullname']:_0x29f6('0xe9'):_0x2fd414[_0x29f6('0x6d')]['firstName']+(_0x2fd414['Contact'][_0x29f6('0x116')]?'\x20'+_0x2fd414[_0x29f6('0x6d')][_0x29f6('0x116')]:''),'body':_0x2fd414[_0x29f6('0xd7')]?_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]:_0x2fd414[_0x29f6('0x2e')],'direction':_0x2fd414['direction']==='out'?'A':'C','secret':_0x2fd414['secret'],'read':_0x2fd414[_0x29f6('0x117')],'attachment':_0x2fd414[_0x29f6('0xd7')]};})[_0x29f6('0x69')]()};return ejs[_0x29f6('0x129')](path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server','views',_0x29f6('0x12a')),{'interaction':_0x53751c})[_0x29f6('0x14')](function(_0x3307a1){var _0x595aff=path[_0x29f6('0xdd')](_0xcf75fe,'transcript-'+_0x598bcd['id']+'-'+_0x31dcfe+_0x29f6('0x12b'));var _0x3101aa={'path':_0x595aff,'channel':'Chat','interactionId':_0x598bcd['id']};return pdf['createPdfFromHTML'](_0x3307a1,_0x3101aa);})[_0x29f6('0x14')](function(){return new Promise(function(_0x4c7b46,_0x41d45f){zipdir(_0xcf75fe,{'saveTo':_0x5de30e},function(_0x1f1679,_0x2dfc83){if(_0x1f1679)return _0x41d45f(_0x1f1679);return _0x4c7b46(_0x2dfc83);});})[_0x29f6('0x14')](function(){return new BPromise(function(_0x53cde9,_0x26eef7){rimraf(_0xcf75fe,function(_0x17b595){if(_0x17b595)_0x26eef7(_0x17b595);return _0x53cde9();});});})['then'](function(){return _0x31ba94[_0x29f6('0xde')](_0x5de30e,_0x48ecb0,function(_0x22fcde){if(_0x22fcde){logger[_0x29f6('0x1b')](_0x29f6('0x12c'),_0x22fcde);}else{fs['unlinkSync'](_0x5de30e);}});});});}else{return _0x31ba94[_0x29f6('0x1e')](0xc8);}})[_0x29f6('0x39')](handleError(_0x31ba94,null));}; \ No newline at end of file +var _0x153f=['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','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','setTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','secret','read','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','render','merge','contact','agent','interaction','account','Users','map','TagIds','split','Tags','push','catch','waiting','talking','answered','unmanaged','closed','UserId','disposition','abandoned','total','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','params','fields','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','isNull','vidaooMetadata','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x153f,0x15b));var _0xf153=function(_0x4c0130,_0x4bc4b4){_0x4c0130=_0x4c0130-0x0;var _0x35c61c=_0x153f[_0x4c0130];return _0x35c61c;};'use strict';var rimraf=require(_0xf153('0x0'));var zipdir=require(_0xf153('0x1'));var rp=require(_0xf153('0x2'));var moment=require(_0xf153('0x3'));var BPromise=require(_0xf153('0x4'));var Mustache=require(_0xf153('0x5'));var util=require(_0xf153('0x6'));var path=require('path');var ejs=require(_0xf153('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf153('0x8'));var Redis=require(_0xf153('0x9'));var qs=require(_0xf153('0xa'));var as=require(_0xf153('0xb'));var pdf=require(_0xf153('0xc'));var logger=require('../../config/logger')(_0xf153('0xd'));var config=require(_0xf153('0xe'));var db=require(_0xf153('0xf'))['db'];config[_0xf153('0x10')]=_[_0xf153('0x11')](config[_0xf153('0x10')],{'host':_0xf153('0x12'),'port':0x18eb});var socket=require(_0xf153('0x13'))(new Redis(config[_0xf153('0x10')]));require(_0xf153('0x14'))['register'](socket);var jayson=require(_0xf153('0x15'));var client=jayson[_0xf153('0x16')][_0xf153('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xf153('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x292f89,_0x65756d,_0x1cc666,_0x256b7d){return new BPromise(function(_0x107d31,_0x3f915c){var _0x1d54c4=_0x256b7d||client;return _0x1d54c4[_0xf153('0x18')](_0x292f89,_0x1cc666)['then'](function(_0x18be7e){logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));logger[_0xf153('0x1c')](_0xf153('0x1d'),_0x65756d,_0xf153('0x1b'),JSON[_0xf153('0x1e')](_0x18be7e));if(_0x18be7e['error']){if(_0x18be7e[_0xf153('0x1f')]['code']===0x1f4){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x3f915c(_0x18be7e['error'][_0xf153('0x20')]);}logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x107d31(_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);}else{logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));_0x107d31(_0x18be7e[_0xf153('0x21')][_0xf153('0x20')]);}})['catch'](function(_0xcd5762){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0xcd5762);_0x3f915c(_0xcd5762);});});}function respondWithStatusCode(_0x32e759,_0x5c9f44){_0x5c9f44=_0x5c9f44||0xcc;return function(_0x3e94b5){if(_0x3e94b5){return _0x32e759[_0xf153('0x22')](_0x5c9f44);}return _0x32e759[_0xf153('0x23')](_0x5c9f44)[_0xf153('0x24')]();};}function respondWithResult(_0x38190c,_0x1570fc){_0x1570fc=_0x1570fc||0xc8;return function(_0x39f3ed){if(_0x39f3ed){return _0x38190c[_0xf153('0x23')](_0x1570fc)[_0xf153('0x25')](_0x39f3ed);}};}function respondWithFilteredResult(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(_0x141ef4){var _0x703adb=typeof _0x35f9da[_0xf153('0x26')]===_0xf153('0x27')&&typeof _0x35f9da['limit']===_0xf153('0x27');var _0x3f1c6f=_0x141ef4['count'];var _0x16cdcd=_0x703adb?0x0:_0x35f9da[_0xf153('0x26')];var _0x4e45f9=_0x703adb?_0x141ef4[_0xf153('0x28')]:_0x35f9da[_0xf153('0x26')]+_0x35f9da[_0xf153('0x29')];var _0x2b9a9c;if(_0x4e45f9>=_0x3f1c6f){_0x4e45f9=_0x3f1c6f;_0x2b9a9c=0xc8;}else{_0x2b9a9c=0xce;}_0xe490f8[_0xf153('0x23')](_0x2b9a9c);return _0xe490f8[_0xf153('0x2a')](_0xf153('0x2b'),_0x16cdcd+'-'+_0x4e45f9+'/'+_0x3f1c6f)[_0xf153('0x25')](_0x141ef4);}return null;};}function saveUpdates(_0x19a568){return function(_0x8e31bf){if(_0x8e31bf){return _0x8e31bf[_0xf153('0x2c')](_0x19a568)[_0xf153('0x2d')](function(_0x5b5237){return _0x5b5237;});}return null;};}function removeEntity(_0x258fb0){return function(_0xbb3619){if(_0xbb3619){return _0xbb3619[_0xf153('0x2e')]()[_0xf153('0x2d')](function(){_0x258fb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28433d){return function(_0x4c6ea0){if(!_0x4c6ea0){_0x28433d['sendStatus'](0x194);}return _0x4c6ea0;};}function handleError(_0x2473d0,_0x4ab958){_0x4ab958=_0x4ab958||0x1f4;return function(_0x2b9623){logger['error'](_0x2b9623[_0xf153('0x2f')]);if(_0x2b9623[_0xf153('0x30')]){delete _0x2b9623['name'];}_0x2473d0[_0xf153('0x23')](_0x4ab958)[_0xf153('0x31')](_0x2b9623);};}function getMustacheRender(_0x538069,_0x40be52){return Mustache[_0xf153('0x32')](_0x538069,_[_0xf153('0x33')](_0x40be52['body'],{'contact':_0x40be52[_0xf153('0x34')],'message':_0x40be52['message'],'agent':_0x40be52[_0xf153('0x35')],'interaction':_0x40be52[_0xf153('0x36')],'account':_0x40be52[_0xf153('0x37')]}))||'';}function getInteractionUsers(_0x1820c3,_0x274bcc){return new BPromise(function(_0x284fe8,_0x4becf3){try{if(_0x274bcc[_0x1820c3['id']]){_0x1820c3[_0xf153('0x38')]=_[_0xf153('0x39')](_0x274bcc[_0x1820c3['id']],function(_0x332809){return{'id':_0x332809['id'],'fullname':_0x332809['fullname']};});}}catch(_0x244172){_0x4becf3(_0x244172);}_0x284fe8(_0x1820c3);});}function getInteractionTags(_0x17d60c,_0xd2a763){return new BPromise(function(_0x254692,_0x36c5cd){try{if(_0x17d60c[_0xf153('0x3a')]){_0x17d60c['Tags']=[];_0x17d60c[_0xf153('0x3a')][_0xf153('0x3b')](',')['forEach'](function(_0x14b2e3){_0x17d60c[_0xf153('0x3c')][_0xf153('0x3d')](_0xd2a763[_0x14b2e3]);});}delete _0x17d60c[_0xf153('0x3a')];}catch(_0x103b91){_0x36c5cd(_0x103b91);}_0x254692(_0x17d60c);});}function updateChatInteraction(_0x42360a,_0xef1510,_0x4d90c1){return new BPromise(function(_0x355131,_0x2f63d6){return getInteractionUsers(_0x42360a,_0x4d90c1)[_0xf153('0x2d')](function(_0x352e7c){return getInteractionTags(_0x352e7c,_0xef1510);})[_0xf153('0x2d')](function(_0x1ee606){return getStateInteraction(_0x1ee606);})['then'](function(_0x4b108e){_0x355131(_0x4b108e);})[_0xf153('0x3e')](function(_0x5051f3){_0x2f63d6(_0x5051f3);});});}function getStateInteraction(_0x46dd09){return new BPromise(function(_0x36c456){_0x46dd09[_0xf153('0x3f')]=0x0;_0x46dd09[_0xf153('0x40')]=0x0;_0x46dd09[_0xf153('0x41')]=0x0;_0x46dd09[_0xf153('0x42')]=0x0;_0x46dd09['abandoned']=0x0;_0x46dd09['total']=0x0;if(!_0x46dd09[_0xf153('0x43')]&&!_0x46dd09[_0xf153('0x44')]){_0x46dd09['waiting']+=0x1;}if(!_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09[_0xf153('0x40')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x45')]===_0xf153('0x46')){_0x46dd09[_0xf153('0x46')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&!_0x46dd09['UserId']&&_0x46dd09[_0xf153('0x45')]){_0x46dd09[_0xf153('0x42')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09['waiting']-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09['answered']+=0x1;if(_0x46dd09[_0xf153('0x40')]){_0x46dd09['talking']-=0x1;}}_0x46dd09[_0xf153('0x47')]+=0x1;_0x36c456(_0x46dd09);});}exports[_0xf153('0x48')]=function(_0x17fb10,_0x550d45){var _0x1f540b={},_0x209048={},_0x1426eb={'count':0x0,'rows':[]};var _0x1bece2=_[_0xf153('0x39')](db['ChatInteraction'][_0xf153('0x49')],function(_0x3bc265){return{'name':_0x3bc265['fieldName'],'type':_0x3bc265[_0xf153('0x4a')][_0xf153('0x4b')]};});_0x209048[_0xf153('0x4c')]=_['map'](_0x1bece2,_0xf153('0x30'));_0x209048[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x17fb10[_0xf153('0x4d')]);_0x209048[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x209048[_0xf153('0x4c')],_0x209048[_0xf153('0x4d')]);_0x1f540b[_0xf153('0x51')]=_['intersection'](_0x209048[_0xf153('0x4c')],qs['fields'](_0x17fb10['query']['fields']));_0x1f540b[_0xf153('0x51')]=_0x1f540b[_0xf153('0x51')]['length']?_0x1f540b[_0xf153('0x51')]:_0x209048[_0xf153('0x4c')];if(!_0x17fb10['query'][_0xf153('0x52')](_0xf153('0x53'))){_0x1f540b[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1f540b['offset']=qs[_0xf153('0x26')](_0x17fb10[_0xf153('0x4d')]['offset']);}_0x1f540b['order']=qs[_0xf153('0x54')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x54')]);_0x1f540b[_0xf153('0x55')]=qs[_0xf153('0x4f')](_[_0xf153('0x56')](_0x17fb10['query'],_0x209048[_0xf153('0x4f')]),_0x1bece2);var _0x51d813=[];var _0x340aba=squel[_0xf153('0x57')]()[_0xf153('0x58')]('id')['field'](_0xf153('0x30'))[_0xf153('0x58')](_0xf153('0x59'))[_0xf153('0x5a')](_0xf153('0x5b'));var _0x18d0ce=squel[_0xf153('0x57')]()['field'](_0xf153('0x5c'))[_0xf153('0x58')](_0xf153('0x5d'))['field'](_0xf153('0x5e'))[_0xf153('0x5a')](_0xf153('0x5f'),'ui')[_0xf153('0x60')](_0xf153('0x61'),'u',_0xf153('0x62'));var _0x245124=squel[_0xf153('0x57')]()['from'](_0xf153('0x63'),'i')[_0xf153('0x60')]('cm_contacts','c',_0xf153('0x64'))[_0xf153('0x60')](_0xf153('0x61'),'o',_0xf153('0x65'))[_0xf153('0x60')](_0xf153('0x66'),'a',_0xf153('0x67'))[_0xf153('0x60')](_0xf153('0x68'),'me',_0xf153('0x69'))[_0xf153('0x60')]('chat_interaction_has_tags','it',_0xf153('0x6a'))[_0xf153('0x60')]('tools_tags','t',_0xf153('0x6b'));var _0x25e66e=squel[_0xf153('0x6c')]();var _0x147d3a=[];var _0x603892=squel[_0xf153('0x6c')]();var _0x2736e3;if(_0x17fb10['query'][_0xf153('0x6d')]){_0x2736e3=as[_0xf153('0x6e')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x6d')]);var _0x17f58d=_0x2736e3[_0xf153('0x6f')];for(var _0x19ec0b=0x0;_0x19ec0b<_0x2736e3[_0xf153('0x70')][_0xf153('0x71')];_0x19ec0b++){var _0x4c9157=_0x2736e3[_0xf153('0x70')][_0x19ec0b];var _0x433566='i';var _0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name',_0x4c9157[_0xf153('0x58')]]);if(!_0x4afdc4){switch(_0x4c9157[_0xf153('0x58')]){case'unreadMessages':if(_0x4c9157[_0xf153('0x73')]==0x1){_0x245124['having']('`'+_0x4c9157[_0xf153('0x58')]+_0xf153('0x74'));}else{_0x245124[_0xf153('0x75')]('`'+_0x4c9157[_0xf153('0x58')]+'`\x20>\x200');}break;case _0xf153('0x76'):if(_0x4c9157[_0xf153('0x77')]==='$substring'){if(_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')]('\x20')[_0xf153('0x71')]>0x1){_0x25e66e[_0x17f58d](_0xf153('0x78'),qs[_0xf153('0x79')](_0x4c9157['value']),null);}else{var _0xf4a542='%'+_0x4c9157['value']+'%';_0x25e66e[_0x17f58d](_0xf153('0x7a'),_0xf4a542,_0xf4a542,_0xf4a542);}}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','ContactId']);_0x4c9157[_0xf153('0x58')]=_0xf153('0x7b');_0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')]['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}break;case _0xf153('0x7d'):var _0x1e5e95=_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')](',')[_0xf153('0x39')](function(_0x364957){return Number(_0x364957);});_0x1e5e95[_0xf153('0x7e')](function(_0x858289){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x858289+',%');});_0x147d3a=_[_0xf153('0x80')](_0x147d3a,_0x1e5e95);break;case _0xf153('0x81'):if(_0x4c9157[_0xf153('0x77')]===_0xf153('0x82')){_0x25e66e[_0x17f58d](_0xf153('0x83'),'%'+_0x4c9157['value']+'%',null);}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','UserId']);_0x4c9157[_0xf153('0x58')]='UserId';_0x44da13=as[_0xf153('0x84')](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')][_0xf153('0x85')],_0x44da13[_0xf153('0x73')]['end']);}break;case _0xf153('0x86'):_0x44da13=as[_0xf153('0x84')]('me',null,_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13['value']['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);break;}}else{var _0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13['text'],_0x44da13['value'][_0xf153('0x85')],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}}}else{var _0x583dbf=_(_0x17fb10[_0xf153('0x4d')])[_0xf153('0x4e')]()['map'](function(_0x193c8c){return _[_0xf153('0x87')](_0x1bece2,[_0xf153('0x30'),_0x193c8c])?_0x193c8c:undefined;})[_0xf153('0x88')]()[_0xf153('0x73')]();if(!_['isEmpty'](_0x583dbf)){_0x583dbf[_0xf153('0x7e')](function(_0xf791a1){if(_0xf791a1===_0xf153('0x89')){_0x245124[_0xf153('0x55')](_0xf153('0x8a'),[][_0xf153('0x8b')](_0x17fb10[_0xf153('0x4d')][_0xf791a1]));}else if(_0xf791a1==='createdAt'){var _0x756f52=JSON[_0xf153('0x8c')](_0x17fb10[_0xf153('0x4d')][_0xf791a1])[_0xf153('0x8d')];var _0x269102=JSON[_0xf153('0x8c')](_0x17fb10['query'][_0xf791a1])[_0xf153('0x8e')];_0x245124[_0xf153('0x55')](_0xf153('0x8f'),_0x756f52,_0x269102);}else{if(_0x17fb10[_0xf153('0x4d')][_0xf791a1]===_0xf153('0x90')){_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x91'));}else{_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x92'),_0x17fb10[_0xf153('0x4d')][_0xf791a1]);}}});}if(_0x17fb10['query']['read']){if(_0x17fb10['query']['read']==0x1){_0x245124[_0xf153('0x75')](_0xf153('0x93'));}else{_0x245124[_0xf153('0x75')](_0xf153('0x94'));}}if(_0x17fb10[_0xf153('0x4d')]['tag']){_0x147d3a=_[_0xf153('0x95')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')])?_0x17fb10[_0xf153('0x4d')]['tag']:new Array(_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')]);_0x147d3a[_0xf153('0x7e')](function(_0x4a5f54){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x4a5f54+',%');});}if(_0x17fb10['query'][_0xf153('0x97')]){var _0x25ab76=_0x17fb10[_0xf153('0x4d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf153('0x98')](_0x25ab76)){_0x25e66e['or'](_0xf153('0x99'),_0x25ab76+'%');}else{_0x25e66e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x25ab76))['or'](_0xf153('0x9a'),_0x25ab76+'%');}}}_0x245124['where'](_0x25e66e);_0x245124[_0xf153('0x9b')]('i.id');var _0xb3632c={'type':db[_0xf153('0x9c')][_0xf153('0x9d')][_0xf153('0x9e')],'raw':!![]};var _0x303dcf=_0x245124[_0xf153('0x9f')]();_0x303dcf['field'](_0xf153('0xa0'));_0x303dcf[_0xf153('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf153('0xa1'));if(_0x1f540b[_0xf153('0xa2')]){_0x1f540b[_0xf153('0xa2')][_0xf153('0x7e')](function(_0x5c6ac2){var _0x3e36fc=_0x5c6ac2[0x0]===_0xf153('0xa3')?_0x5c6ac2[0x0]:'i.'+_0x5c6ac2[0x0];_0x245124['order'](_0x3e36fc,_0x5c6ac2[0x1]===_0xf153('0xa4')?![]:!![]);});}if(!_[_0xf153('0xa5')](_0x147d3a)){_0x245124[_0xf153('0x75')](_0x603892);_0x303dcf[_0xf153('0x55')]('t.id\x20IN\x20?',_0x147d3a);}BPromise[_0xf153('0xa6')]()[_0xf153('0x2d')](function(){if(!_0x2736e3){if(_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return;_0x303dcf[_0xf153('0x55')](_0xf153('0xa7'));_0x245124[_0xf153('0x55')](_0xf153('0xa7'));return;}if(_0x17fb10[_0xf153('0xa8')]['role']!==_0xf153('0x35'))return;return _0x17fb10[_0xf153('0xa8')][_0xf153('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d24b5){if(_[_0xf153('0xa5')](_0x4d24b5)){_0x303dcf['where'](_0xf153('0xaa'));_0x245124[_0xf153('0x55')](_0xf153('0xaa'));}else{_0x303dcf['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xf153('0x39')](_0x4d24b5,'id'));_0x245124[_0xf153('0x55')](_0xf153('0x8a'),_['map'](_0x4d24b5,'id'));}});})[_0xf153('0x2d')](function(){if(_0x17fb10[_0xf153('0xa8')][_0xf153('0xab')]===_0xf153('0x35')&&!_0x2736e3&&!_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x303dcf[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x347859){_0x1426eb[_0xf153('0x28')]=_0x347859[_0xf153('0x71')];if(_0x1426eb['count']===0x0)return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x340aba[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x573032){_0x51d813=_[_0xf153('0xae')](_0x573032,'id');_0xb3632c=_['merge'](_0xb3632c,{'model':db[_0xf153('0xaf')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17fb10[_0xf153('0x4d')]['fields']){_0x1f540b[_0xf153('0x51')][_0xf153('0x7e')](function(_0x3b0b94){_0x245124[_0xf153('0x58')]('i.'+_0x3b0b94);});}else{_0x245124[_0xf153('0x58')](_0xf153('0xb0'),_0xf153('0xa1'));_0x245124[_0xf153('0x58')]('a.key',_0xf153('0xb1'));_0x245124[_0xf153('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x245124[_0xf153('0x58')]('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');_0x245124[_0xf153('0x58')](_0xf153('0xb2'));_0x245124['field'](_0xf153('0xb3'),_0xf153('0xb4'));_0x245124[_0xf153('0x58')](_0xf153('0xb5'),_0xf153('0xb6'));_0x245124[_0xf153('0x58')](_0xf153('0xb7'),_0xf153('0xb8'));_0x245124[_0xf153('0x58')]('c.phone',_0xf153('0xb9'));_0x245124['field'](_0xf153('0xba'),'Contact.mobile');_0x245124[_0xf153('0x58')]('c.fax','Contact.fax');_0x245124[_0xf153('0x58')]('o.fullname',_0xf153('0xbb'));_0x245124[_0xf153('0x58')]('o.internal','Owner.internal');_0x245124[_0xf153('0x58')](_0xf153('0xbc'),_0xf153('0x3a'));}if(_0x1f540b['limit'])_0x245124[_0xf153('0x29')](_0x1f540b[_0xf153('0x29')]);if(_0x1f540b[_0xf153('0x26')])_0x245124[_0xf153('0x26')](_0x1f540b['offset']);return db[_0xf153('0xac')][_0xf153('0x4d')](_0x245124[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x1022c5){if(_0x1022c5[_0xf153('0x71')]>0x0)_0x18d0ce[_0xf153('0x55')](_0xf153('0xbd'),_[_0xf153('0x39')](_0x1022c5,'id'));return db[_0xf153('0xac')][_0xf153('0x4d')](_0x18d0ce[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x1aebab){var _0x192708=_['groupBy'](_0x1aebab,_0xf153('0xbe'));var _0x4525e1=[];_0x1022c5[_0xf153('0x7e')](function(_0x449f8d){_0x4525e1[_0xf153('0x3d')](updateChatInteraction(_0x449f8d,_0x51d813,_0x192708));});return BPromise['all'](_0x4525e1);});});})[_0xf153('0x2d')](function(_0xa13662){_0x1426eb[_0xf153('0xbf')]=_0xa13662;return _0x1426eb;})[_0xf153('0x2d')](respondWithFilteredResult(_0x550d45,_0x1f540b))[_0xf153('0x3e')](handleError(_0x550d45,null));};exports[_0xf153('0xc0')]=function(_0x2e55f4,_0x1098b7){var _0x29d492={'raw':![],'where':{'id':_0x2e55f4[_0xf153('0xc1')]['id']}},_0x3f7938={};_0x3f7938[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xaf')][_0xf153('0x49')]);_0x3f7938['query']=_[_0xf153('0x4e')](_0x2e55f4[_0xf153('0x4d')]);_0x3f7938[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x3f7938[_0xf153('0x4c')],_0x3f7938[_0xf153('0x4d')]);_0x29d492[_0xf153('0x51')]=_[_0xf153('0x50')](_0x3f7938['model'],qs[_0xf153('0xc2')](_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc2')]));_0x29d492[_0xf153('0x51')]=_0x29d492[_0xf153('0x51')]['length']?_0x29d492[_0xf153('0x51')]:_0x3f7938[_0xf153('0x4c')];if(_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc3')]){_0x29d492['include']=[{'all':!![]}];}_0x29d492=_['merge']({},_0x29d492,_0x2e55f4[_0xf153('0xc4')]);return db[_0xf153('0xaf')]['find'](_0x29d492)['then'](handleEntityNotFound(_0x1098b7,null))[_0xf153('0x2d')](respondWithResult(_0x1098b7,null))[_0xf153('0x3e')](handleError(_0x1098b7,null));};exports[_0xf153('0xc5')]=function(_0x339e9e,_0x31a019){return db[_0xf153('0xaf')][_0xf153('0xc5')](_0x339e9e[_0xf153('0x86')],{})[_0xf153('0x2d')](respondWithResult(_0x31a019,0xc9))['catch'](handleError(_0x31a019,null));};exports[_0xf153('0x2c')]=function(_0x110f72,_0x527cce){if(_0x110f72[_0xf153('0x86')]['id']){delete _0x110f72[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x110f72['params']['id']}})['then'](handleEntityNotFound(_0x527cce,null))[_0xf153('0x2d')](saveUpdates(_0x110f72[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0x527cce,null))['catch'](handleError(_0x527cce,null));};exports[_0xf153('0x2e')]=function(_0x45c835,_0x3ca774){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x45c835[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3ca774,null))['then'](removeEntity(_0x3ca774,null))[_0xf153('0x3e')](handleError(_0x3ca774,null));};exports[_0xf153('0xc6')]=function(_0x3451e9,_0x3af786){return db[_0xf153('0xaf')][_0xf153('0xc6')]()[_0xf153('0x2d')](respondWithResult(_0x3af786,null))[_0xf153('0x3e')](handleError(_0x3af786,null));};exports[_0xf153('0xc7')]=function(_0x53eee4,_0x2dd1d8){var _0x2c3f76=_0x53eee4[_0xf153('0xc1')]['id'];var _0x374ba4;var _0x1b4f50;var _0x40c1d1;return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c3f76}})[_0xf153('0x2d')](function(_0x8711eb){_0x374ba4=_0x8711eb;return db[_0xf153('0xc9')]['findOne']({'where':{'id':_0x8711eb[_0xf153('0x89')]},'attributes':['id',_0xf153('0xca'),_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcd'),'vidaooMetadata'],'raw':!![]});})[_0xf153('0x2d')](function(_0x2e908a){if(_0x2e908a&&_0x2e908a['vidaooApiKey']&&_0x2e908a[_0xf153('0xcb')]){_0x1b4f50=_0x2e908a;var _0x57d320={'interaction':{'id':_0x2c3f76},'agent':{'id':_0x53eee4[_0xf153('0xa8')]['id'],'name':_0x53eee4[_0xf153('0xa8')][_0xf153('0x30')],'fullname':_0x53eee4[_0xf153('0xa8')]['fullname'],'email':_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]},'contact':_0x53eee4['body'][_0xf153('0x34')],'account':_0x53eee4['body'][_0xf153('0x37')]};var _0x30ae3c={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2e908a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]],'buttons':null,'topic':_0x1b4f50['vidaooTopic'],'note':_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xcd')])?null:getMustacheRender(_0x1b4f50['vidaooNote'],_0x57d320),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xd0')])){var _0x32971d=getMustacheRender(_0x1b4f50[_0xf153('0xd0')],_0x57d320);var _0x1a4825=JSON[_0xf153('0x8c')](_0x32971d);_0x30ae3c[_0xf153('0x86')][_0xf153('0xd1')]=_0x1a4825;}}catch(_0xb03f70){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd2'));}return rp(_0x30ae3c);}else{throw new db['Sequelize']['ValidationError'](_0xf153('0xd3'));}})[_0xf153('0x2d')](function(_0x264968){_0x40c1d1=_0x264968;if(_0x40c1d1['id']){var _0xe61167={'body':_0x40c1d1['join_url'],'ChatWebsiteId':_0x1b4f50['id'],'ChatInteractionId':_0x374ba4['id'],'direction':_0xf153('0xd4'),'UserId':_0x53eee4['user']['id']};return db[_0xf153('0xd5')][_0xf153('0xc5')](_0xe61167,{});}else{throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd6'));}})[_0xf153('0x2d')](function(){return _0x374ba4['updateAttributes']({'vidaooSessionId':_0x40c1d1['id']});})[_0xf153('0x2d')](respondWithResult(_0x2dd1d8,null))['catch'](handleError(_0x2dd1d8,null));};exports[_0xf153('0xd7')]=function(_0x1ba174,_0xab67b7){if(_0x1ba174['body']['id']){delete _0x1ba174['body']['id'];}return db[_0xf153('0xaf')]['find']({'where':{'id':_0x1ba174[_0xf153('0xc1')]['id']},'include':[{'model':db[_0xf153('0xd8')],'as':_0xf153('0x76')}]})[_0xf153('0x2d')](handleEntityNotFound(_0xab67b7,null))[_0xf153('0x2d')](saveUpdates(_0x1ba174[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0xab67b7,null))[_0xf153('0x3e')](handleError(_0xab67b7,null));};exports[_0xf153('0xd9')]=function(_0x40ade6,_0x1a9bfb){if(_0x40ade6[_0xf153('0x86')]['id']){delete _0x40ade6[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x40ade6[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](function(_0x50dd96){if(!_0x50dd96){logger[_0xf153('0x1f')](_0xf153('0xda'),_0xf153('0xd9'),0x194,'entity\x20not\x20found');_0x1a9bfb[_0xf153('0x22')](0x194);}else{if(_0x50dd96[_0xf153('0x44')]){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xdb'));}}return _0x50dd96;})[_0xf153('0x2d')](function(_0xeebd4f){if(_0xeebd4f){return _0xeebd4f[_0xf153('0x2c')]({'closed':_0x40ade6[_0xf153('0x86')]['closed'],'disposition':_0x40ade6[_0xf153('0x86')]['disposition']})[_0xf153('0x2d')](function(_0x4fe273){return _0x4fe273;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xf153('0xd9'),_0x40ade6['body'],client9004);})[_0xf153('0x2d')](respondWithResult(_0x1a9bfb,null))['catch'](handleError(_0x1a9bfb,null));};exports[_0xf153('0xdc')]=function(_0x25543b,_0x3c1ae6){_0x25543b[_0xf153('0x86')]['name']=_0x25543b[_0xf153('0xdd')][_0xf153('0xde')];_0x25543b['body'][_0xf153('0xdf')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe0')];_0x25543b[_0xf153('0x86')][_0xf153('0x4a')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe1')];return db['Attachment'][_0xf153('0xc5')](_0x25543b[_0xf153('0x86')])[_0xf153('0x2d')](respondWithResult(_0x3c1ae6,0xc9))[_0xf153('0x3e')](handleError(_0x3c1ae6,null));};exports[_0xf153('0xe2')]=function(_0x2c8401,_0x41ef70){return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0xc1')]['id']},'raw':!![]})[_0xf153('0x2d')](handleEntityNotFound(_0x41ef70,null))[_0xf153('0x2d')](function(_0x283f9e){if(_0x283f9e){if(_0x283f9e['closed']){return _0x41ef70['status'](0x193)[_0xf153('0x25')]({'status':0x193,'message':_0xf153('0xe3')});}return db['Attachment'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0x4d')][_0xf153('0xe4')]},'raw':!![]})['then'](handleEntityNotFound(_0x41ef70,null));}})['then'](function(_0x13b7e2){if(_0x13b7e2){var _0x25222f=_0x13b7e2[_0xf153('0xe5')]!==null;var _0x4b2cdd=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0xe8'));if(_0x25222f){_0x4b2cdd=path[_0xf153('0xe6')](_0x4b2cdd,_0xf153('0xe9'));}var _0x1ac5ff=path[_0xf153('0xe6')](_0x4b2cdd,_0x13b7e2[_0xf153('0xdf')]);return _0x41ef70[_0xf153('0xea')](_0x1ac5ff);}})[_0xf153('0x3e')](handleError(_0x41ef70,null));};exports[_0xf153('0xeb')]=function(_0x126535,_0x392c8e){var _0x203143=null;var _0x173f12=null;var _0x1f8794=null;if(_0x126535[_0xf153('0x86')]['id']){delete _0x126535[_0xf153('0x86')]['id'];}if(_0x126535['body'][_0xf153('0xec')]){_0x1f8794=path['join'](config[_0xf153('0xe7')],_0xf153('0xed'),util['format']('transcript-%s.txt',Date['now']()));_0x126535[_0xf153('0x86')][_0xf153('0xee')]=_0x1f8794;}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x126535['params']['id']},'include':[{'model':db[_0xf153('0xd5')],'as':_0xf153('0xef'),'include':[{'model':db[_0xf153('0x81')],'as':_0xf153('0x81')}]}]})[_0xf153('0x2d')](handleEntityNotFound(_0x392c8e,null))[_0xf153('0x2d')](saveUpdates(_0x126535[_0xf153('0x86')],null))[_0xf153('0x2d')](function(_0x4c2b50){if(_0x4c2b50){_0x203143=_0x4c2b50;return db[_0xf153('0xc9')][_0xf153('0x72')]({'where':{'id':_0x203143['ChatWebsiteId']}});}})['then'](function(_0x3021e6){if(_0x3021e6){_0x173f12=_0x3021e6;return db[_0xf153('0xd8')]['find']({'where':{'id':_0x203143[_0xf153('0x7b')]}});}})['then'](function(_0x3057f1){if(_0x3057f1){if(_0x1f8794){var _0x207255=null;for(var _0xd8cd84=0x1;_0xd8cd84<_0x203143[_0xf153('0xef')][_0xf153('0x71')];++_0xd8cd84){_0x207255=_0x203143['Messages'][_0xd8cd84];var _0xb4dbdd=_0x207255['UserId']?util['format'](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');var _0x5b1a91=_0x126535[_0xf153('0x86')][_0xf153('0xf3')]||util[_0xf153('0xf4')](_0xf153('0xf0'),_0xf153('0xf5'),_0x207255[_0xf153('0x7b')]);switch(_0x173f12[_0xf153('0xf6')]){case _0xf153('0xf7'):_0xb4dbdd=_0x207255['UserId']?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');break;case _0xf153('0xf8'):_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')][_0xf153('0xf9')]||_0x207255[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2');break;case'agent_fullname':_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')]['fullname']:_0xf153('0xf2');break;default:_0xb4dbdd=_0x207255[_0xf153('0x44')]?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');}var _0x4b8d5c=util[_0xf153('0xf4')](_0xf153('0xfb'),moment(_0x207255[_0xf153('0xfc')])[_0xf153('0xf4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x207255[_0xf153('0xfd')]==='in'?_0x5b1a91:_0xb4dbdd,_0x207255[_0xf153('0x86')]);if(!_0x207255['secret']){fs[_0xf153('0xfe')](_0x1f8794,_0x4b8d5c);}}return db['MailAccount'][_0xf153('0xc8')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf153('0xff'),'raw':!![],'include':[{'model':db[_0xf153('0x100')],'as':_0xf153('0x100'),'raw':!![]}]}]});}}})[_0xf153('0x2d')](function(_0x5a8d13){if(!_0x5a8d13||!_0x5a8d13[_0xf153('0xff')]||!_0x126535['body'])return _0x203143;var _0x21285e=_0x5a8d13[_0xf153('0x101')]();return respondWithRpcPromise(_0xf153('0x102'),_0xf153('0x103'),{'account':_0x21285e,'message':{'from':util[_0xf153('0xf4')](_0xf153('0x104'),_0x5a8d13['name'],_0x5a8d13[_0xf153('0xce')]||_0x5a8d13['Smtp'][_0xf153('0xa8')]),'to':_0x126535['body'][_0xf153('0xec')],'subject':_0xf153('0x105'),'text':util[_0xf153('0xf4')](_0xf153('0x106'),_0x126535['body'][_0xf153('0xec')]),'attachments':[{'path':_0x1f8794}]}})['then'](function(){return _0x203143;})[_0xf153('0x3e')](function(_0x5c32d1){logger[_0xf153('0x1f')](_0x5c32d1);});})[_0xf153('0x2d')](respondWithStatusCode(_0x392c8e,0xc8))[_0xf153('0x3e')](handleError(_0x392c8e,null));};exports[_0xf153('0x107')]=function(_0x273b03,_0x3165e5){return db[_0xf153('0xd5')][_0xf153('0x72')]({'where':{'id':_0x273b03['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3165e5,null))[_0xf153('0x2d')](function(_0x48c9e4){if(_0x48c9e4){return _0x48c9e4[_0xf153('0x107')](_0x273b03[_0xf153('0x86')][_0xf153('0x108')],_[_0xf153('0x109')](_0x273b03[_0xf153('0x86')],[_0xf153('0x108'),'id'])||{});}})[_0xf153('0x2d')](respondWithResult(_0x3165e5,null))['catch'](handleError(_0x3165e5,null));};exports['getMessages']=function(_0x550c10,_0x3e8153){var _0x1fb83a={'raw':![],'where':{}};var _0x10f948={};var _0x5cc922={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x550c10['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3e8153,null))[_0xf153('0x2d')](function(_0x21a1c9){if(_0x21a1c9){_0x10f948[_0xf153('0x4c')]=_[_0xf153('0x4e')](db['ChatMessage'][_0xf153('0x49')]);_0x10f948[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x550c10['query']);_0x10f948[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],_0x10f948[_0xf153('0x4d')]);_0x1fb83a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x550c10[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1fb83a[_0xf153('0x51')]=_0x1fb83a[_0xf153('0x51')][_0xf153('0x71')]?_0x1fb83a[_0xf153('0x51')]:_0x10f948[_0xf153('0x4c')];if(!_0x550c10[_0xf153('0x4d')][_0xf153('0x52')]('nolimit')){_0x1fb83a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x550c10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1fb83a['offset']=qs[_0xf153('0x26')](_0x550c10[_0xf153('0x4d')][_0xf153('0x26')]);}_0x1fb83a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x550c10[_0xf153('0x4d')]['sort']);_0x1fb83a[_0xf153('0x55')]=qs[_0xf153('0x4f')](_['pick'](_0x550c10[_0xf153('0x4d')],_0x10f948[_0xf153('0x4f')]));_0x1fb83a[_0xf153('0x55')][_0xf153('0xbe')]=_0x21a1c9['id'];if(_0x550c10[_0xf153('0x4d')][_0xf153('0x97')]){_0x1fb83a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1fb83a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1fb83a[_0xf153('0x51')],function(_0x4538be){var _0x63ad32={};_0x63ad32[_0x4538be]={'$like':'%'+_0x550c10['query'][_0xf153('0x97')]+'%'};return _0x63ad32;})});}if(_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]){var _0x9503e=_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]['split'](',');var _0x49ea9a={};_0x49ea9a[_0x9503e[0x0]]={'$gte':moment(_0x9503e[0x1])[_0xf153('0xf4')](_0xf153('0x10a'))};_0x1fb83a[_0xf153('0x55')]=_['merge'](_0x1fb83a[_0xf153('0x55')],_0x49ea9a);}_0x1fb83a=_[_0xf153('0x33')]({},_0x1fb83a,_0x550c10[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1fb83a[_0xf153('0x55')]})[_0xf153('0x2d')](function(_0x921b52){_0x5cc922['count']=_0x921b52;if(_0x550c10['query'][_0xf153('0xc3')]){_0x1fb83a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1fb83a);})[_0xf153('0x2d')](function(_0x577fc7){_0x5cc922[_0xf153('0xbf')]=_0x577fc7;return _0x5cc922;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x3e8153,_0x1fb83a))[_0xf153('0x3e')](handleError(_0x3e8153,null));};exports[_0xf153('0x10d')]=function(_0x283af8,_0x58be79){var _0x1d0d1a={'where':{}},_0x5397a8={},_0x466386={'count':0x0,'rows':[]};return db[_0xf153('0xaf')][_0xf153('0xc8')]({'where':{'id':_0x283af8[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x58be79,null))['then'](function(_0x5efd23){if(_0x5efd23){_0x5397a8[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xd5')][_0xf153('0x49')]);_0x5397a8[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x283af8[_0xf153('0x4d')]);_0x5397a8[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],_0x5397a8[_0xf153('0x4d')]);_0x1d0d1a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x283af8[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1d0d1a[_0xf153('0x51')]=_0x1d0d1a[_0xf153('0x51')][_0xf153('0x71')]?_0x1d0d1a[_0xf153('0x51')]:_0x5397a8[_0xf153('0x4c')];if(!_0x283af8['query']['hasOwnProperty'](_0xf153('0x53'))){_0x1d0d1a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x283af8['query'][_0xf153('0x29')]);_0x1d0d1a[_0xf153('0x26')]=qs[_0xf153('0x26')](_0x283af8['query'][_0xf153('0x26')]);}_0x1d0d1a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x283af8[_0xf153('0x4d')]['sort']);_0x1d0d1a[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x56')](_0x283af8[_0xf153('0x4d')],_0x5397a8[_0xf153('0x4f')]));_0x1d0d1a[_0xf153('0x55')]['ChatInteractionId']=_0x5efd23['id'];if(_0x283af8[_0xf153('0x4d')]['filter']){_0x1d0d1a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1d0d1a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1d0d1a[_0xf153('0x51')],function(_0x397ee2){var _0x17e62e={};_0x17e62e[_0x397ee2]={'$like':'%'+_0x283af8[_0xf153('0x4d')][_0xf153('0x97')]+'%'};return _0x17e62e;})});}_0x1d0d1a['where']['secret']=![];if(_0x283af8[_0xf153('0x4d')]['id']){_0x1d0d1a[_0xf153('0x55')]['id']={'$gt':_0x283af8[_0xf153('0x4d')]['id']};}_0x1d0d1a=_['merge']({},_0x1d0d1a,_0x283af8[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1d0d1a['where']})[_0xf153('0x2d')](function(_0x100f48){_0x466386[_0xf153('0x28')]=_0x100f48;_0x1d0d1a[_0xf153('0x10b')]=[];if(_0x283af8['query']['includeAgent']){_0x1d0d1a[_0xf153('0x10b')][_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id','fullname',_0xf153('0xf9')]});}if(_0x283af8[_0xf153('0x4d')][_0xf153('0xc3')]){_0x1d0d1a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1d0d1a);})[_0xf153('0x2d')](function(_0x3a94c5){_0x466386[_0xf153('0xbf')]=_0x3a94c5;return _0x466386;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x58be79,_0x1d0d1a))['catch'](handleError(_0x58be79,null));};exports['addTags']=function(_0x11997d,_0x74943){return db[_0xf153('0xaf')]['find']({'where':{'id':_0x11997d[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x74943,null))['then'](function(_0x3f7eb6){if(_0x3f7eb6){return _0x3f7eb6[_0xf153('0x10e')](_0x11997d['body']['ids'],_[_0xf153('0x109')](_0x11997d['body'],[_0xf153('0x108'),'id'])||{})[_0xf153('0x10f')](function(){return db[_0xf153('0x7d')]['findAll']({'attributes':['id',_0xf153('0x30'),_0xf153('0x59')],'where':{'id':_0x11997d['body'][_0xf153('0x108')]}});})['then'](function(_0x5742a6){socket[_0xf153('0x110')](_0xf153('0x111'),{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]});return{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]};});}})[_0xf153('0x2d')](respondWithResult(_0x74943,null))[_0xf153('0x3e')](handleError(_0x74943,null));};exports['removeTags']=function(_0x9d9d65,_0x301675){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x9d9d65[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x301675,null))[_0xf153('0x2d')](function(_0x4a5c86){if(_0x4a5c86){return _0x4a5c86['removeTags'](_0x9d9d65[_0xf153('0x4d')][_0xf153('0x108')]);}})['then'](respondWithStatusCode(_0x301675,null))[_0xf153('0x3e')](handleError(_0x301675,null));};exports[_0xf153('0xea')]=function(_0x252e74,_0x48f9ff){var _0x2180ec=moment()[_0xf153('0x112')]()[_0xf153('0xad')]();var _0x265407=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x115'));var _0x2a39ae=path[_0xf153('0xe6')](config['root'],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x116'));var _0x154c3c=path[_0xf153('0xe6')](_0x265407,_0x2180ec);var _0x5b9c=util[_0xf153('0xf4')](_0xf153('0x117'),_0x252e74[_0xf153('0xc1')]['id'],_0x2180ec);var _0x304d66=path['join'](_0x265407,_0x5b9c);var _0x444f68=[];_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id',_0xf153('0xfa')],'raw':!![]});_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0xd8')],'as':_0xf153('0x76'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x252e74[_0xf153('0x4d')]['attachments']){_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x118')],'as':_0xf153('0x118'),'raw':!![]});}var _0x3d553d=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xf153('0x86'),_0xf153('0xfc'),_0xf153('0xfd'),_0xf153('0x119'),_0xf153('0x11a')],'include':_0x444f68}];_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0xc9')],'as':_0xf153('0x11b'),'attributes':['id',_0xf153('0x30')]});_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x11c'),'attributes':['id',_0xf153('0xfa')]});return db[_0xf153('0xaf')]['find']({'where':{'id':_0x252e74[_0xf153('0xc1')]['id']},'include':_0x3d553d})[_0xf153('0x2d')](handleEntityNotFound(_0x48f9ff,null))[_0xf153('0x2d')](function(_0xf53fc6){if(_0xf53fc6){var _0x45112b=_0xf53fc6[_0xf153('0x11d')]({'plain':!![]});fs[_0xf153('0x11e')](_0x154c3c);var _0x1435bd={'channel':_0xf153('0x11f'),'account':_0x45112b[_0xf153('0x11b')]['name'],'agent':_0x45112b[_0xf153('0x11c')]?_0x45112b[_0xf153('0x11c')][_0xf153('0xfa')]:_0xf153('0x120'),'createdAt':moment(_0x45112b['createdAt'])[_0xf153('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x45112b['closed']?moment(_0x45112b['closedAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')]():'','disposition':_0x45112b[_0xf153('0x45')],'chatInfo':{'browser':_0x45112b[_0xf153('0x121')],'os':_0x45112b['osName'],'referer':_0x45112b[_0xf153('0x122')],'customerIp':_0x45112b[_0xf153('0x123')],'customerPort':_0x45112b['customerPort']?_0x45112b[_0xf153('0x124')]:_0xf153('0x120')},'messages':_(_0x45112b['Messages'])[_0xf153('0x125')]()['filter']({'secret':![]})[_0xf153('0x39')](function(_0x5aa0bf){if(_0x5aa0bf[_0xf153('0x118')]){var _0x5ec77c=path[_0xf153('0xe6')](_0x2a39ae,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')]);if(fs[_0xf153('0x126')](_0x5ec77c)){fs[_0xf153('0x127')](_0x5ec77c)['pipe'](fs[_0xf153('0x128')](path[_0xf153('0xe6')](_0x154c3c,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')])));}}return{'date':moment(_0x5aa0bf['createdAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')](),'sender':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?_0x5aa0bf['User']?_0x5aa0bf[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2'):_0x5aa0bf[_0xf153('0x76')]['firstName']+(_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]?'\x20'+_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]:''),'body':_0x5aa0bf[_0xf153('0x118')]?_0x5aa0bf['Attachment'][_0xf153('0xdf')]:_0x5aa0bf[_0xf153('0x86')],'direction':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?'A':'C','secret':_0x5aa0bf[_0xf153('0x119')],'read':_0x5aa0bf[_0xf153('0x11a')],'attachment':_0x5aa0bf['Attachment']};})['value']()};return ejs[_0xf153('0x12a')](path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x12b'),'downloadInteraction.ejs'),{'interaction':_0x1435bd})[_0xf153('0x2d')](function(_0x415d13){var _0xb2f8e0=path[_0xf153('0xe6')](_0x154c3c,_0xf153('0x12c')+_0x45112b['id']+'-'+_0x2180ec+'.pdf');var _0x3b6a0e={'path':_0xb2f8e0,'channel':_0xf153('0x11f'),'interactionId':_0x45112b['id']};return pdf['createPdfFromHTML'](_0x415d13,_0x3b6a0e);})[_0xf153('0x2d')](function(){return new Promise(function(_0x19de76,_0x5912d8){zipdir(_0x154c3c,{'saveTo':_0x304d66},function(_0x426db4,_0x52677c){if(_0x426db4)return _0x5912d8(_0x426db4);return _0x19de76(_0x52677c);});})[_0xf153('0x2d')](function(){return new BPromise(function(_0x200d37,_0x393d95){rimraf(_0x154c3c,function(_0x30a638){if(_0x30a638)_0x393d95(_0x30a638);return _0x200d37();});});})[_0xf153('0x2d')](function(){return _0x48f9ff['download'](_0x304d66,_0x5b9c,function(_0x416a91){if(_0x416a91){logger['error'](_0xf153('0x12d'),_0x416a91);}else{fs[_0xf153('0x12e')](_0x304d66);}});});});}else{return _0x48f9ff[_0xf153('0x22')](0xc8);}})[_0xf153('0x3e')](handleError(_0x48f9ff,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 865aaf8..bbe9164 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 _0x69a7=['setDataValue','Users','findAll','length','emit','catch','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then'];(function(_0x11278a,_0x97706c){var _0x11d9af=function(_0x16c7d1){while(--_0x16c7d1){_0x11278a['push'](_0x11278a['shift']());}};_0x11d9af(++_0x97706c);}(_0x69a7,0x9d));var _0x769a=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x69a7[_0x4164f2];return _0x2575c7;};'use strict';var EventEmitter=require(_0x769a('0x0'));var ChatInteraction=require(_0x769a('0x1'))['db'][_0x769a('0x2')];var ChatMessage=require(_0x769a('0x1'))['db'][_0x769a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x769a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x769a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e9192){return function(_0x1ec084,_0x398d61,_0x3d8878){_0x1ec084[_0x769a('0x6')]({'attributes':['id'],'raw':!![]})[_0x769a('0x7')](function(_0x46424f){_0x1ec084[_0x769a('0x8')](_0x769a('0x9'),_0x46424f['map'](function(_0x12f472){return{'id':_0x12f472['id']};}));return ChatMessage[_0x769a('0xa')]({'where':{'ChatInteractionId':_0x1ec084['id'],'direction':'in','read':![]},'raw':!![]});})[_0x769a('0x7')](function(_0xb70fc8){_0x1ec084['setDataValue']('unreadMessages',_0xb70fc8[_0x769a('0xb')]);ChatInteractionEvents[_0x769a('0xc')](_0x3e9192+':'+_0x1ec084['id'],_0x1ec084);ChatInteractionEvents[_0x769a('0xc')](_0x3e9192,_0x1ec084);_0x3d8878(null);})[_0x769a('0xd')](_0x3d8878(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x769a('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x11bb=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','then','Users','map','unreadMessages','length','emit','catch'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x11bb,0x1f3));var _0xb11b=function(_0x5592ac,_0x53136c){_0x5592ac=_0x5592ac-0x0;var _0x456dd2=_0x11bb[_0x5592ac];return _0x456dd2;};'use strict';var EventEmitter=require(_0xb11b('0x0'));var ChatInteraction=require(_0xb11b('0x1'))['db'][_0xb11b('0x2')];var ChatMessage=require(_0xb11b('0x1'))['db'][_0xb11b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb11b('0x4'),'afterDestroy':_0xb11b('0x5')};function emitEvent(_0x403dc0){return function(_0x2183e2,_0x6ebb10,_0xbc3bf2){_0x2183e2['getUsers']({'attributes':['id'],'raw':!![]})[_0xb11b('0x6')](function(_0x52e884){_0x2183e2['setDataValue'](_0xb11b('0x7'),_0x52e884[_0xb11b('0x8')](function(_0x593c90){return{'id':_0x593c90['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2183e2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4637dd){_0x2183e2['setDataValue'](_0xb11b('0x9'),_0x4637dd[_0xb11b('0xa')]);ChatInteractionEvents[_0xb11b('0xb')](_0x403dc0+':'+_0x2183e2['id'],_0x2183e2);ChatInteractionEvents[_0xb11b('0xb')](_0x403dc0,_0x2183e2);_0xbc3bf2(null);})[_0xb11b('0xc')](_0xbc3bf2(null));};}for(var e in events){if(events[_0xb11b('0xd')](e)){var event=events[e];ChatInteraction[_0xb11b('0xe')](e,emitEvent(event));}}module[_0xb11b('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3e6b7bb..e321d40 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 _0x8b09=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInteraction','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x8b09,0x130));var _0x98b0=function(_0x177420,_0x18c369){_0x177420=_0x177420-0x0;var _0x437a50=_0x8b09[_0x177420];return _0x437a50;};'use strict';var _=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var logger=require(_0x98b0('0x2'))('api');var moment=require(_0x98b0('0x3'));var BPromise=require(_0x98b0('0x4'));var rp=require(_0x98b0('0x5'));var fs=require('fs');var path=require(_0x98b0('0x6'));var rimraf=require('rimraf');var config=require(_0x98b0('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x98b0('0x8')]=function(_0x3bc053,_0x10f2c6){return _0x3bc053[_0x98b0('0x9')](_0x98b0('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b8e9b,_0x3c1c03,_0x397773){if(_0x2b8e9b['changed'](_0x98b0('0xb'))){_0x2b8e9b[_0x98b0('0xc')]=moment()[_0x98b0('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x397773(null,_0x2b8e9b);}},'charset':_0x98b0('0xe'),'collate':_0x98b0('0xf')});}; \ No newline at end of file +var _0x8a11=['request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0xdb320,_0x116a79){var _0x1a552d=function(_0x3b41b2){while(--_0x3b41b2){_0xdb320['push'](_0xdb320['shift']());}};_0x1a552d(++_0x116a79);}(_0x8a11,0xcc));var _0x18a1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x8a11[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var logger=require(_0x18a1('0x2'))('api');var moment=require(_0x18a1('0x3'));var BPromise=require(_0x18a1('0x4'));var rp=require(_0x18a1('0x5'));var fs=require('fs');var path=require(_0x18a1('0x6'));var rimraf=require(_0x18a1('0x7'));var config=require(_0x18a1('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x18a1('0x9')]=function(_0x2875ba,_0x3d09a3){return _0x2875ba[_0x18a1('0xa')](_0x18a1('0xb'),attributes,{'tableName':_0x18a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15daf2,_0x14d16c,_0x45f55){if(_0x15daf2[_0x18a1('0xd')](_0x18a1('0xe'))){_0x15daf2[_0x18a1('0xf')]=moment()[_0x18a1('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x45f55(null,_0x15daf2);}},'charset':_0x18a1('0x11'),'collate':_0x18a1('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3fa12ff..0541651 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 _0x4f5a=['redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','limit','catch','AddTagsToChatInteraction','find','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0x4f5a,0xeb));var _0xa4f5=function(_0x37dee8,_0x3faaaf){_0x37dee8=_0x37dee8-0x0;var _0x18ae38=_0x4f5a[_0x37dee8];return _0x18ae38;};'use strict';var _=require('lodash');var util=require(_0xa4f5('0x0'));var moment=require(_0xa4f5('0x1'));var BPromise=require(_0xa4f5('0x2'));var rs=require(_0xa4f5('0x3'));var fs=require('fs');var Redis=require(_0xa4f5('0x4'));var db=require(_0xa4f5('0x5'))['db'];var utils=require(_0xa4f5('0x6'));var logger=require(_0xa4f5('0x7'))('rpc');var config=require(_0xa4f5('0x8'));var jayson=require(_0xa4f5('0x9'));var client=jayson['client'][_0xa4f5('0xa')]({'port':0x232a});config[_0xa4f5('0xb')]=_[_0xa4f5('0xc')](config[_0xa4f5('0xb')],{'host':_0xa4f5('0xd'),'port':0x18eb});var socket=require(_0xa4f5('0xe'))(new Redis(config[_0xa4f5('0xb')]));require(_0xa4f5('0xf'))[_0xa4f5('0x10')](socket);function respondWithRpcPromise(_0x40a291,_0x2a3d14,_0x58422a){return new BPromise(function(_0x32363e,_0x11bf80){return client['request'](_0x40a291,_0x58422a)[_0xa4f5('0x11')](function(_0x1fa31e){logger[_0xa4f5('0x12')](_0xa4f5('0x13'),_0x2a3d14,_0xa4f5('0x14'));logger[_0xa4f5('0x15')](_0xa4f5('0x16'),_0x2a3d14,'request\x20sent',JSON[_0xa4f5('0x17')](_0x1fa31e));if(_0x1fa31e[_0xa4f5('0x18')]){if(_0x1fa31e[_0xa4f5('0x18')][_0xa4f5('0x19')]===0x1f4){logger[_0xa4f5('0x18')](_0xa4f5('0x13'),_0x2a3d14,_0x1fa31e[_0xa4f5('0x18')][_0xa4f5('0x1a')]);return _0x11bf80(_0x1fa31e['error'][_0xa4f5('0x1a')]);}logger['error'](_0xa4f5('0x13'),_0x2a3d14,_0x1fa31e[_0xa4f5('0x18')][_0xa4f5('0x1a')]);return _0x32363e(_0x1fa31e[_0xa4f5('0x18')]['message']);}else{logger[_0xa4f5('0x12')](_0xa4f5('0x13'),_0x2a3d14,_0xa4f5('0x14'));_0x32363e(_0x1fa31e[_0xa4f5('0x1b')]['message']);}})['catch'](function(_0x59e8f5){logger[_0xa4f5('0x18')](_0xa4f5('0x13'),_0x2a3d14,_0x59e8f5);_0x11bf80(_0x59e8f5);});});}exports[_0xa4f5('0x1c')]=function(_0xb583a){var _0x952b5a=this;return new Promise(function(_0x3ba9f0,_0x52be72){return db[_0xa4f5('0x1d')]['update'](_0xb583a[_0xa4f5('0x1e')],{'raw':_0xb583a[_0xa4f5('0x1f')]?_0xb583a[_0xa4f5('0x1f')][_0xa4f5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb583a[_0xa4f5('0x1f')]?_0xb583a[_0xa4f5('0x1f')]['where']||null:null,'attributes':_0xb583a[_0xa4f5('0x1f')]?_0xb583a[_0xa4f5('0x1f')][_0xa4f5('0x21')]||null:null,'limit':_0xb583a[_0xa4f5('0x1f')]?_0xb583a[_0xa4f5('0x1f')][_0xa4f5('0x22')]||null:null})[_0xa4f5('0x11')](function(_0x638ad){logger[_0xa4f5('0x12')](_0xa4f5('0x1c'),_0xb583a);logger[_0xa4f5('0x15')](_0xa4f5('0x1c'),_0xb583a,JSON[_0xa4f5('0x17')](_0x638ad));_0x3ba9f0(_0x638ad);})[_0xa4f5('0x23')](function(_0x1ad64f){logger['error'](_0xa4f5('0x1c'),_0x1ad64f[_0xa4f5('0x1a')],_0xb583a);_0x52be72(_0x952b5a[_0xa4f5('0x18')](0x1f4,_0x1ad64f[_0xa4f5('0x1a')]));});});};exports[_0xa4f5('0x24')]=function(_0x5dcaaf){return new Promise(function(_0x5b8599,_0x4ab9b4){return db[_0xa4f5('0x1d')][_0xa4f5('0x25')]({'where':_0x5dcaaf['options']?_0x5dcaaf[_0xa4f5('0x1f')]['where']||null:null})[_0xa4f5('0x11')](function(_0x510b5c){if(_0x510b5c){return _0x510b5c['addTags'](_0x5dcaaf[_0xa4f5('0x1e')][_0xa4f5('0x26')],_['omit'](_0x5dcaaf[_0xa4f5('0x1e')],['ids','id'])||{});}})[_0xa4f5('0x27')](function(_0x10ced8){logger['info'](_0xa4f5('0x28'),_0x5dcaaf);logger[_0xa4f5('0x15')](_0xa4f5('0x28'),_0x5dcaaf,JSON[_0xa4f5('0x17')](_0x10ced8));_0x5b8599(_0x10ced8);})[_0xa4f5('0x23')](function(_0x25ba51){logger[_0xa4f5('0x18')]('AddTags',_0x25ba51[_0xa4f5('0x1a')],_0x5dcaaf);_0x4ab9b4(_this['error'](0x1f4,_0x25ba51[_0xa4f5('0x1a')]));});});}; \ No newline at end of file +var _0xc91b=['options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','debug','AddTags','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update'];(function(_0x47e97d,_0x23c172){var _0x2a248a=function(_0x2c7c80){while(--_0x2c7c80){_0x47e97d['push'](_0x47e97d['shift']());}};_0x2a248a(++_0x23c172);}(_0xc91b,0x157));var _0xbc91=function(_0x39ccd4,_0x412903){_0x39ccd4=_0x39ccd4-0x0;var _0x587605=_0xc91b[_0x39ccd4];return _0x587605;};'use strict';var _=require('lodash');var util=require(_0xbc91('0x0'));var moment=require(_0xbc91('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc91('0x2'));var fs=require('fs');var Redis=require(_0xbc91('0x3'));var db=require(_0xbc91('0x4'))['db'];var utils=require(_0xbc91('0x5'));var logger=require(_0xbc91('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc91('0x7'));var client=jayson['client'][_0xbc91('0x8')]({'port':0x232a});config[_0xbc91('0x9')]=_[_0xbc91('0xa')](config[_0xbc91('0x9')],{'host':_0xbc91('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc91('0xc'))[_0xbc91('0xd')](socket);function respondWithRpcPromise(_0x1ee372,_0x528eef,_0x136eac){return new BPromise(function(_0x30763d,_0x2a1c27){return client['request'](_0x1ee372,_0x136eac)[_0xbc91('0xe')](function(_0x49bf40){logger[_0xbc91('0xf')](_0xbc91('0x10'),_0x528eef,'request\x20sent');logger['debug'](_0xbc91('0x11'),_0x528eef,_0xbc91('0x12'),JSON['stringify'](_0x49bf40));if(_0x49bf40[_0xbc91('0x13')]){if(_0x49bf40[_0xbc91('0x13')]['code']===0x1f4){logger[_0xbc91('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x528eef,_0x49bf40[_0xbc91('0x13')][_0xbc91('0x14')]);return _0x2a1c27(_0x49bf40['error']['message']);}logger[_0xbc91('0x13')](_0xbc91('0x10'),_0x528eef,_0x49bf40[_0xbc91('0x13')][_0xbc91('0x14')]);return _0x30763d(_0x49bf40['error']['message']);}else{logger[_0xbc91('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x528eef,_0xbc91('0x12'));_0x30763d(_0x49bf40[_0xbc91('0x15')]['message']);}})[_0xbc91('0x16')](function(_0x57c825){logger['error'](_0xbc91('0x10'),_0x528eef,_0x57c825);_0x2a1c27(_0x57c825);});});}exports[_0xbc91('0x17')]=function(_0x395e3c){var _0x127b1d=this;return new Promise(function(_0x34e5a8,_0x58d01d){return db[_0xbc91('0x18')][_0xbc91('0x19')](_0x395e3c['body'],{'raw':_0x395e3c[_0xbc91('0x1a')]?_0x395e3c[_0xbc91('0x1a')][_0xbc91('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395e3c['options']?_0x395e3c[_0xbc91('0x1a')][_0xbc91('0x1c')]||null:null,'attributes':_0x395e3c[_0xbc91('0x1a')]?_0x395e3c['options'][_0xbc91('0x1d')]||null:null,'limit':_0x395e3c[_0xbc91('0x1a')]?_0x395e3c['options'][_0xbc91('0x1e')]||null:null})['then'](function(_0x142b85){logger[_0xbc91('0xf')]('UpdateChatInteraction',_0x395e3c);logger['debug'](_0xbc91('0x17'),_0x395e3c,JSON['stringify'](_0x142b85));_0x34e5a8(_0x142b85);})[_0xbc91('0x16')](function(_0x535098){logger['error']('UpdateChatInteraction',_0x535098['message'],_0x395e3c);_0x58d01d(_0x127b1d[_0xbc91('0x13')](0x1f4,_0x535098[_0xbc91('0x14')]));});});};exports[_0xbc91('0x1f')]=function(_0x5a79ec){return new Promise(function(_0xbd044,_0x1b4089){return db[_0xbc91('0x18')][_0xbc91('0x20')]({'where':_0x5a79ec['options']?_0x5a79ec[_0xbc91('0x1a')][_0xbc91('0x1c')]||null:null})[_0xbc91('0xe')](function(_0x447bec){if(_0x447bec){return _0x447bec[_0xbc91('0x21')](_0x5a79ec['body'][_0xbc91('0x22')],_[_0xbc91('0x23')](_0x5a79ec[_0xbc91('0x24')],['ids','id'])||{});}})[_0xbc91('0x25')](function(_0x271285){logger[_0xbc91('0xf')]('AddTags',_0x5a79ec);logger[_0xbc91('0x26')](_0xbc91('0x27'),_0x5a79ec,JSON[_0xbc91('0x28')](_0x271285));_0xbd044(_0x271285);})[_0xbc91('0x16')](function(_0x44a66d){logger[_0xbc91('0x13')](_0xbc91('0x27'),_0x44a66d[_0xbc91('0x14')],_0x5a79ec);_0x1b4089(_this[_0xbc91('0x13')](0x1f4,_0x44a66d[_0xbc91('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index be16729..9c1ec84 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 _0x155d=['update','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x5ed052,_0x2c5baa){var _0x2f2d6d=function(_0x42b3e4){while(--_0x42b3e4){_0x5ed052['push'](_0x5ed052['shift']());}};_0x2f2d6d(++_0x2c5baa);}(_0x155d,0x89));var _0xd155=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x155d[_0x13b02f];return _0x12e9a6;};'use strict';var ChatInteractionEvents=require(_0xd155('0x0'));var events=[_0xd155('0x1'),_0xd155('0x2'),_0xd155('0x3')];function createListener(_0x50eeee,_0x2526f7){return function(_0x3ec1be){_0x2526f7['emit'](_0x50eeee,_0x3ec1be);};}function removeListener(_0x4cf996,_0x4f127d){return function(){ChatInteractionEvents['removeListener'](_0x4cf996,_0x4f127d);};}exports[_0xd155('0x4')]=function(_0x433e8e){for(var _0x2ec7a9=0x0,_0x16c6d0=events[_0xd155('0x5')];_0x2ec7a9<_0x16c6d0;_0x2ec7a9++){var _0x102bb6=events[_0x2ec7a9];var _0x463e8e=createListener(_0xd155('0x6')+_0x102bb6,_0x433e8e);ChatInteractionEvents['on'](_0x102bb6,_0x463e8e);}}; \ No newline at end of file +var _0xfcda=['./chatInteraction.events','save','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x3941c5,_0x3b5b2f){var _0x9b93a3=function(_0x1f0264){while(--_0x1f0264){_0x3941c5['push'](_0x3941c5['shift']());}};_0x9b93a3(++_0x3b5b2f);}(_0xfcda,0x198));var _0xafcd=function(_0x74f73,_0x2acc98){_0x74f73=_0x74f73-0x0;var _0x3827c2=_0xfcda[_0x74f73];return _0x3827c2;};'use strict';var ChatInteractionEvents=require(_0xafcd('0x0'));var events=[_0xafcd('0x1'),'remove',_0xafcd('0x2')];function createListener(_0x55dc26,_0x57b33a){return function(_0x4c5beb){_0x57b33a[_0xafcd('0x3')](_0x55dc26,_0x4c5beb);};}function removeListener(_0x187185,_0x18d3fd){return function(){ChatInteractionEvents[_0xafcd('0x4')](_0x187185,_0x18d3fd);};}exports[_0xafcd('0x5')]=function(_0x412e67){for(var _0x2623cb=0x0,_0x53fb69=events[_0xafcd('0x6')];_0x2623cb<_0x53fb69;_0x2623cb++){var _0x4c1e30=events[_0x2623cb];var _0x3f625f=createListener(_0xafcd('0x7')+_0x4c1e30,_0x412e67);ChatInteractionEvents['on'](_0x4c1e30,_0x3f625f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ddc314c..7ead9d9 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 _0xdff0=['get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','replace','single','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller'];(function(_0x21f403,_0x209e8d){var _0x470dec=function(_0x1336eb){while(--_0x1336eb){_0x21f403['push'](_0x21f403['shift']());}};_0x470dec(++_0x209e8d);}(_0xdff0,0xe5));var _0x0dff=function(_0x5393c5,_0x4a05ac){_0x5393c5=_0x5393c5-0x0;var _0x3c0372=_0xdff0[_0x5393c5];return _0x3c0372;};'use strict';var multer=require('multer');var util=require(_0x0dff('0x0'));var path=require('path');var timeout=require(_0x0dff('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0dff('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0dff('0x3'));var config=require(_0x0dff('0x4'));var controller=require(_0x0dff('0x5'));router[_0x0dff('0x6')]('/',auth[_0x0dff('0x7')](),controller[_0x0dff('0x8')]);router[_0x0dff('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0dff('0x6')](_0x0dff('0x9'),auth[_0x0dff('0xa')](),controller[_0x0dff('0xb')]);router['get'](_0x0dff('0xc'),auth[_0x0dff('0xa')](),controller[_0x0dff('0xd')]);router[_0x0dff('0x6')](_0x0dff('0xe'),auth['isAuthenticated'](),controller[_0x0dff('0xf')]);router[_0x0dff('0x6')](_0x0dff('0x10'),auth[_0x0dff('0xa')](),controller[_0x0dff('0x11')]);router[_0x0dff('0x6')]('/:id/download',auth[_0x0dff('0x7')](),controller[_0x0dff('0x12')]);router[_0x0dff('0x13')]('/',auth['isAuthenticated'](),controller[_0x0dff('0x14')]);router['post'](_0x0dff('0x15'),auth[_0x0dff('0x7')](),controller[_0x0dff('0x16')]);var upload=multer({'storage':multer[_0x0dff('0x17')]({'destination':function(_0x3efc6c,_0x519569,_0x3595fb){_0x3595fb(null,path[_0x0dff('0x18')](config[_0x0dff('0x19')],_0x0dff('0x1a')));},'filename':function(_0x2dcfe7,_0xf9d734,_0xf34d2){_0xf34d2(null,util['format'](_0x0dff('0x1b'),Date[_0x0dff('0x1c')](),_0xf9d734['originalname'][_0x0dff('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x0dff('0x1e')]('file'),controller[_0x0dff('0x1f')]);router[_0x0dff('0x13')](_0x0dff('0xe'),auth[_0x0dff('0xa')](),controller['addMessage']);router[_0x0dff('0x13')](_0x0dff('0x20'),auth[_0x0dff('0x7')](),interaction[_0x0dff('0x21')](_0x0dff('0x22'),_0x0dff('0x23')),controller[_0x0dff('0x24')]);router[_0x0dff('0x25')](_0x0dff('0x9'),auth[_0x0dff('0x7')](),interaction[_0x0dff('0x21')]('chat',_0x0dff('0x26')),controller['update']);router['put'](_0x0dff('0x27'),controller[_0x0dff('0x28')]);router[_0x0dff('0x25')](_0x0dff('0x29'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x0dff('0x25')]('/:id/close',controller['close']);router[_0x0dff('0x2a')]('/:id',auth[_0x0dff('0x7')](),interaction[_0x0dff('0x21')]('chat',_0x0dff('0x2b')),controller[_0x0dff('0x2c')]);router[_0x0dff('0x2a')](_0x0dff('0x20'),auth[_0x0dff('0x7')](),controller[_0x0dff('0x2d')]);module[_0x0dff('0x2e')]=router; \ No newline at end of file +var _0x83a4=['update','put','/:id/custom_update','/:id/abandon','delete','tracked','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','/:id','chatinteraction:update'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x83a4,0x1d4));var _0x483a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x83a4[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x483a('0x0'));var util=require(_0x483a('0x1'));var path=require('path');var timeout=require(_0x483a('0x2'));var express=require('express');var router=express[_0x483a('0x3')]();var fs_extra=require(_0x483a('0x4'));var auth=require(_0x483a('0x5'));var interaction=require(_0x483a('0x6'));var config=require(_0x483a('0x7'));var controller=require(_0x483a('0x8'));router[_0x483a('0x9')]('/',auth[_0x483a('0xa')](),controller['index']);router[_0x483a('0x9')](_0x483a('0xb'),auth[_0x483a('0xa')](),controller[_0x483a('0xc')]);router[_0x483a('0x9')]('/:id',auth[_0x483a('0xd')](),controller['show']);router[_0x483a('0x9')](_0x483a('0xe'),auth[_0x483a('0xd')](),controller[_0x483a('0xf')]);router[_0x483a('0x9')]('/:id/messages',auth[_0x483a('0xa')](),controller['getMessages']);router['get'](_0x483a('0x10'),auth[_0x483a('0xd')](),controller[_0x483a('0x11')]);router['get'](_0x483a('0x12'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x483a('0xa')](),controller[_0x483a('0x13')]);router[_0x483a('0x14')](_0x483a('0x15'),auth['isAuthenticated'](),controller[_0x483a('0x16')]);var upload=multer({'storage':multer[_0x483a('0x17')]({'destination':function(_0x2428e6,_0x304aa6,_0x53d28d){_0x53d28d(null,path[_0x483a('0x18')](config['root'],_0x483a('0x19')));},'filename':function(_0x31f5d7,_0x4a95b6,_0x2ac469){_0x2ac469(null,util[_0x483a('0x1a')](_0x483a('0x1b'),Date[_0x483a('0x1c')](),_0x4a95b6[_0x483a('0x1d')][_0x483a('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x483a('0x14')](_0x483a('0x1f'),upload[_0x483a('0x20')]('file'),controller[_0x483a('0x21')]);router[_0x483a('0x14')](_0x483a('0x22'),auth[_0x483a('0xd')](),controller[_0x483a('0x23')]);router[_0x483a('0x14')](_0x483a('0x24'),auth[_0x483a('0xa')](),interaction['tracked'](_0x483a('0x25'),_0x483a('0x26')),controller[_0x483a('0x27')]);router['put'](_0x483a('0x28'),auth[_0x483a('0xa')](),interaction['tracked']('chat',_0x483a('0x29')),controller[_0x483a('0x2a')]);router[_0x483a('0x2b')](_0x483a('0x2c'),controller['customUpdate']);router[_0x483a('0x2b')](_0x483a('0x2d'),auth[_0x483a('0xd')](),controller['abandon']);router[_0x483a('0x2b')]('/:id/close',controller['close']);router[_0x483a('0x2e')](_0x483a('0x28'),auth[_0x483a('0xa')](),interaction[_0x483a('0x2f')](_0x483a('0x25'),'chatinteraction:destroy'),controller[_0x483a('0x30')]);router[_0x483a('0x2e')]('/:id/tags',auth[_0x483a('0xa')](),controller[_0x483a('0x31')]);module[_0x483a('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 969da77..ef8365b 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 _0xa863=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x14c51b,_0x5d71ba){var _0x3fdfe3=function(_0x2b5c25){while(--_0x2b5c25){_0x14c51b['push'](_0x14c51b['shift']());}};_0x3fdfe3(++_0x5d71ba);}(_0xa863,0x16c));var _0x3a86=function(_0x1389d4,_0x13f53b){_0x1389d4=_0x1389d4-0x0;var _0x11f32a=_0xa863[_0x1389d4];return _0x11f32a;};'use strict';var Sequelize=require(_0x3a86('0x0'));module[_0x3a86('0x1')]={'body':{'type':Sequelize[_0x3a86('0x2')](_0x3a86('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3a86('0x4')]}}; \ No newline at end of file +var _0xe0e8=['TEXT','medium','INTEGER','sequelize','exports'];(function(_0xfb7680,_0x2018ae){var _0x3eb2ac=function(_0x56d55f){while(--_0x56d55f){_0xfb7680['push'](_0xfb7680['shift']());}};_0x3eb2ac(++_0x2018ae);}(_0xe0e8,0x189));var _0x8e0e=function(_0x3ac027,_0x122bd2){_0x3ac027=_0x3ac027-0x0;var _0x3e98e9=_0xe0e8[_0x3ac027];return _0x3e98e9;};'use strict';var Sequelize=require(_0x8e0e('0x0'));module[_0x8e0e('0x1')]={'body':{'type':Sequelize[_0x8e0e('0x2')](_0x8e0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8e0e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f41e724..1ee574b 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 _0xacba=['options','ChatInternalMessage','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','fullname','role','userpic','online','showWebBar','-online','VoiceQueue','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','push','filter','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','type','VIRTUAL','merge'];(function(_0x563eab,_0x5edc88){var _0x5994ff=function(_0xe408ec){while(--_0xe408ec){_0x563eab['push'](_0x563eab['shift']());}};_0x5994ff(++_0x5edc88);}(_0xacba,0x9b));var _0xaacb=function(_0x54dbd5,_0x3e7ef6){_0x54dbd5=_0x54dbd5-0x0;var _0x2b8e09=_0xacba[_0x54dbd5];return _0x2b8e09;};'use strict';var emlformat=require(_0xaacb('0x0'));var rimraf=require(_0xaacb('0x1'));var zipdir=require(_0xaacb('0x2'));var jsonpatch=require(_0xaacb('0x3'));var rp=require(_0xaacb('0x4'));var moment=require(_0xaacb('0x5'));var BPromise=require(_0xaacb('0x6'));var Mustache=require(_0xaacb('0x7'));var util=require('util');var path=require(_0xaacb('0x8'));var sox=require(_0xaacb('0x9'));var csv=require(_0xaacb('0xa'));var ejs=require(_0xaacb('0xb'));var fs=require('fs');var fs_extra=require(_0xaacb('0xc'));var _=require(_0xaacb('0xd'));var squel=require(_0xaacb('0xe'));var crypto=require(_0xaacb('0xf'));var jsforce=require(_0xaacb('0x10'));var deskjs=require(_0xaacb('0x11'));var toCsv=require(_0xaacb('0xa'));var querystring=require(_0xaacb('0x12'));var Papa=require(_0xaacb('0x13'));var Redis=require(_0xaacb('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xaacb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaacb('0x16'));var logger=require(_0xaacb('0x17'))(_0xaacb('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaacb('0x19'));var db=require(_0xaacb('0x1a'))['db'];config[_0xaacb('0x1b')]=_[_0xaacb('0x1c')](config[_0xaacb('0x1b')],{'host':_0xaacb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaacb('0x1b')]));require('./chatInternalMessage.socket')[_0xaacb('0x1e')](socket);function respondWithStatusCode(_0x322232,_0x3f0a4a){_0x3f0a4a=_0x3f0a4a||0xcc;return function(_0x3e0858){if(_0x3e0858){return _0x322232[_0xaacb('0x1f')](_0x3f0a4a);}return _0x322232[_0xaacb('0x20')](_0x3f0a4a)[_0xaacb('0x21')]();};}function respondWithResult(_0x1cbeee,_0x3134f2){_0x3134f2=_0x3134f2||0xc8;return function(_0x2a5259){if(_0x2a5259){return _0x1cbeee['status'](_0x3134f2)[_0xaacb('0x22')](_0x2a5259);}};}function respondWithFilteredResult(_0x2bf584,_0x24c0fe){return function(_0x16ec32){if(_0x16ec32){var _0x155b96=typeof _0x24c0fe[_0xaacb('0x23')]==='undefined'&&typeof _0x24c0fe['limit']===_0xaacb('0x24');var _0x157c2b=_0x16ec32[_0xaacb('0x25')];var _0xd9e37e=_0x155b96?0x0:_0x24c0fe[_0xaacb('0x23')];var _0x528e43=_0x155b96?_0x16ec32['count']:_0x24c0fe[_0xaacb('0x23')]+_0x24c0fe[_0xaacb('0x26')];var _0x365248;if(_0x528e43>=_0x157c2b){_0x528e43=_0x157c2b;_0x365248=0xc8;}else{_0x365248=0xce;}_0x2bf584[_0xaacb('0x20')](_0x365248);return _0x2bf584[_0xaacb('0x27')](_0xaacb('0x28'),_0xd9e37e+'-'+_0x528e43+'/'+_0x157c2b)['json'](_0x16ec32);}return null;};}function patchUpdates(_0x2f6f35){return function(_0x1f430a){try{jsonpatch['apply'](_0x1f430a,_0x2f6f35,!![]);}catch(_0x89d2f6){return BPromise[_0xaacb('0x29')](_0x89d2f6);}return _0x1f430a[_0xaacb('0x2a')]();};}function saveUpdates(_0x109422,_0x150ba6){return function(_0x142d10){if(_0x142d10){return _0x142d10[_0xaacb('0x2b')](_0x109422)[_0xaacb('0x2c')](function(_0x91b2dc){return _0x91b2dc;});}return null;};}function removeEntity(_0x38ebe2,_0x3a3542){return function(_0x4f2ca1){if(_0x4f2ca1){return _0x4f2ca1[_0xaacb('0x2d')]()[_0xaacb('0x2c')](function(){_0x38ebe2[_0xaacb('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564b97,_0x1f751a){return function(_0x20b691){if(!_0x20b691){_0x564b97[_0xaacb('0x1f')](0x194);}return _0x20b691;};}function handleError(_0x56ae4a,_0x3106f3){_0x3106f3=_0x3106f3||0x1f4;return function(_0x523c9d){logger[_0xaacb('0x2e')](_0x523c9d[_0xaacb('0x2f')]);if(_0x523c9d['name']){delete _0x523c9d[_0xaacb('0x30')];}_0x56ae4a[_0xaacb('0x20')](_0x3106f3)[_0xaacb('0x31')](_0x523c9d);};}exports['index']=function(_0x44dd12,_0x40fc39){var _0x4848c2={},_0x1b6d81={},_0x51e608={'count':0x0,'rows':[]};var _0x5143da=_['map'](db['ChatInternalMessage'][_0xaacb('0x32')],function(_0x48147b){return{'name':_0x48147b[_0xaacb('0x33')],'type':_0x48147b['type'][_0xaacb('0x34')]};});_0x1b6d81[_0xaacb('0x35')]=_['map'](_0x5143da,_0xaacb('0x30'));_0x1b6d81[_0xaacb('0x36')]=_['keys'](_0x44dd12[_0xaacb('0x36')]);_0x1b6d81[_0xaacb('0x37')]=_[_0xaacb('0x38')](_0x1b6d81[_0xaacb('0x35')],_0x1b6d81['query']);_0x4848c2[_0xaacb('0x39')]=_['intersection'](_0x1b6d81['model'],qs[_0xaacb('0x3a')](_0x44dd12['query'][_0xaacb('0x3a')]));_0x4848c2['attributes']=_0x4848c2[_0xaacb('0x39')][_0xaacb('0x3b')]?_0x4848c2[_0xaacb('0x39')]:_0x1b6d81['model'];if(!_0x44dd12[_0xaacb('0x36')][_0xaacb('0x3c')](_0xaacb('0x3d'))){_0x4848c2[_0xaacb('0x26')]=qs['limit'](_0x44dd12[_0xaacb('0x36')][_0xaacb('0x26')]);_0x4848c2[_0xaacb('0x23')]=qs[_0xaacb('0x23')](_0x44dd12[_0xaacb('0x36')][_0xaacb('0x23')]);}_0x4848c2[_0xaacb('0x3e')]=qs[_0xaacb('0x3f')](_0x44dd12['query'][_0xaacb('0x3f')]);_0x4848c2[_0xaacb('0x40')]=qs[_0xaacb('0x37')](_['pick'](_0x44dd12['query'],_0x1b6d81[_0xaacb('0x37')]),_0x5143da);if(_0x44dd12[_0xaacb('0x36')]['filter']){_0x4848c2[_0xaacb('0x40')]=_['merge'](_0x4848c2[_0xaacb('0x40')],{'$or':_[_0xaacb('0x41')](_0x5143da,function(_0x57122){if(_0x57122[_0xaacb('0x42')]!==_0xaacb('0x43')){var _0xd5042d={};_0xd5042d[_0x57122[_0xaacb('0x30')]]={'$like':'%'+_0x44dd12[_0xaacb('0x36')]['filter']+'%'};return _0xd5042d;}})});}_0x4848c2=_[_0xaacb('0x44')]({},_0x4848c2,_0x44dd12[_0xaacb('0x45')]);var _0xe965af={'where':_0x4848c2[_0xaacb('0x40')]};return db[_0xaacb('0x46')][_0xaacb('0x25')](_0xe965af)[_0xaacb('0x2c')](function(_0x38e345){_0x51e608[_0xaacb('0x25')]=_0x38e345;if(_0x44dd12[_0xaacb('0x36')][_0xaacb('0x47')]){_0x4848c2[_0xaacb('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xaacb('0x49')](_0x4848c2);})[_0xaacb('0x2c')](function(_0x38104e){_0x51e608[_0xaacb('0x4a')]=_0x38104e;return _0x51e608;})[_0xaacb('0x2c')](respondWithFilteredResult(_0x40fc39,_0x4848c2))[_0xaacb('0x4b')](handleError(_0x40fc39,null));};exports['show']=function(_0x29a93b,_0x473aaf){var _0x4317d8={'raw':!![],'where':{'id':_0x29a93b['params']['id']}},_0xc4d706={};_0xc4d706[_0xaacb('0x35')]=_[_0xaacb('0x4c')](db['ChatInternalMessage'][_0xaacb('0x32')]);_0xc4d706['query']=_['keys'](_0x29a93b[_0xaacb('0x36')]);_0xc4d706[_0xaacb('0x37')]=_[_0xaacb('0x38')](_0xc4d706[_0xaacb('0x35')],_0xc4d706['query']);_0x4317d8[_0xaacb('0x39')]=_['intersection'](_0xc4d706[_0xaacb('0x35')],qs[_0xaacb('0x3a')](_0x29a93b['query'][_0xaacb('0x3a')]));_0x4317d8[_0xaacb('0x39')]=_0x4317d8['attributes'][_0xaacb('0x3b')]?_0x4317d8[_0xaacb('0x39')]:_0xc4d706['model'];if(_0x29a93b[_0xaacb('0x36')][_0xaacb('0x47')]){_0x4317d8['include']=[{'all':!![]}];}_0x4317d8=_['merge']({},_0x4317d8,_0x29a93b[_0xaacb('0x45')]);return db['ChatInternalMessage'][_0xaacb('0x4d')](_0x4317d8)['then'](handleEntityNotFound(_0x473aaf,null))[_0xaacb('0x2c')](respondWithResult(_0x473aaf,null))[_0xaacb('0x4b')](handleError(_0x473aaf,null));};exports[_0xaacb('0x4e')]=function(_0x567a05,_0x13e9f0){return db['ChatInternalMessage'][_0xaacb('0x4e')](_0x567a05[_0xaacb('0x4f')],{})[_0xaacb('0x2c')](respondWithResult(_0x13e9f0,0xc9))[_0xaacb('0x4b')](handleError(_0x13e9f0,null));};exports[_0xaacb('0x2b')]=function(_0x408bce,_0x5e6647){if(_0x408bce[_0xaacb('0x4f')]['id']){delete _0x408bce[_0xaacb('0x4f')]['id'];}return db[_0xaacb('0x46')][_0xaacb('0x4d')]({'where':{'id':_0x408bce['params']['id']}})[_0xaacb('0x2c')](handleEntityNotFound(_0x5e6647,null))[_0xaacb('0x2c')](saveUpdates(_0x408bce[_0xaacb('0x4f')],null))[_0xaacb('0x2c')](respondWithResult(_0x5e6647,null))[_0xaacb('0x4b')](handleError(_0x5e6647,null));};exports['destroy']=function(_0x54290e,_0x19c2b2){return db[_0xaacb('0x46')][_0xaacb('0x4d')]({'where':{'id':_0x54290e[_0xaacb('0x50')]['id']}})[_0xaacb('0x2c')](handleEntityNotFound(_0x19c2b2,null))['then'](removeEntity(_0x19c2b2,null))[_0xaacb('0x4b')](handleError(_0x19c2b2,null));};exports[_0xaacb('0x51')]=function(_0x1b4c91,_0x374f60){return db[_0xaacb('0x46')][_0xaacb('0x51')]()['then'](respondWithResult(_0x374f60,null))[_0xaacb('0x4b')](handleError(_0x374f60,null));};function wrapUser(_0x18f16e){return function(_0x561c1b){var _0x368dfe=_0x18f16e['get']({'plain':!![]});_0x368dfe[_0xaacb('0x52')]=[];if(_0x561c1b){_0x368dfe['lastMessageAt']=_0x561c1b[_0xaacb('0x53')];_0x368dfe['lastMessage']=_0x561c1b;}else{_0x368dfe[_0xaacb('0x54')]=moment(0x0)[_0xaacb('0x55')](_0xaacb('0x56'));_0x368dfe[_0xaacb('0x57')]={};}return _0x368dfe;};}exports[_0xaacb('0x58')]=function(_0x15a289,_0x5df241,_0x364a6c){var _0x5e1700=[];return db['User']['findAll']({'where':{'role':[_0xaacb('0x59'),_0xaacb('0x5a'),'user']},'attributes':['id',_0xaacb('0x5b'),_0xaacb('0x30'),_0xaacb('0x5c'),_0xaacb('0x5d'),'internal',_0xaacb('0x5e'),'lastLoginAt','allowmessenger',_0xaacb('0x5f')],'order':qs['sort'](_0xaacb('0x60')),'include':[{'model':db[_0xaacb('0x61')],'as':'VoiceQueues','attributes':['id','name',_0xaacb('0x42')],'through':{'attributes':[]}}]})[_0xaacb('0x2c')](function(_0x21a820){if(_0x21a820){var _0x562ddf=_0x15a289[_0xaacb('0x62')][_0xaacb('0x63')]({'plain':!![]});if(!_0x562ddf)throw new Error(_0xaacb('0x64'));if(_0x562ddf[_0xaacb('0x5c')]===_0xaacb('0x62')){return db[_0xaacb('0x65')]['find']({'where':{'name':_0xaacb('0x66'),'userProfileId':_0x562ddf['userProfileId']},'raw':!![]})[_0xaacb('0x2c')](function(_0x35104e){if(_0x35104e){if(_0x35104e[_0xaacb('0x67')]===0x0){return db[_0xaacb('0x68')][_0xaacb('0x49')]({'where':{'sectionId':_0x35104e['id']},'raw':!![]})[_0xaacb('0x2c')](function(_0x146df8){var _0x3274e2=[];if(_[_0xaacb('0x69')](_0x146df8)){_0x3274e2=_['filter'](_0x21a820,function(_0x211e4e){if(_0x211e4e['role']!==_0xaacb('0x59')){return _0x211e4e;}});return _0x3274e2;}else{for(var _0xec6aec=0x0;_0xec6aec<_0x21a820[_0xaacb('0x3b')];_0xec6aec++){var _0x184cff=_0x21a820[_0xec6aec];if(_0x184cff[_0xaacb('0x5c')]==='agent'){var _0x2f4c57=_[_0xaacb('0x4d')](_0x146df8,function(_0x48d42c){return _0x48d42c['resourceId']===_0x184cff['id'];});if(_0x2f4c57)_0x3274e2[_0xaacb('0x6a')](_0x184cff);}else{_0x3274e2[_0xaacb('0x6a')](_0x184cff);}}return _0x3274e2;}});}else{return _0x21a820;}}else{var _0x6c63f9=_[_0xaacb('0x6b')](_0x21a820,function(_0x2f7d1c){if(_0x2f7d1c['role']!==_0xaacb('0x59')){return _0x2f7d1c;}});return _0x6c63f9;}});}else{return _0x21a820;}}})[_0xaacb('0x2c')](function(_0x1b85c7){var _0x4b6177=[];if(_0x1b85c7){_0x5e1700=_0x1b85c7;for(var _0x184f80=0x0;_0x184f80<_0x1b85c7[_0xaacb('0x3b')];_0x184f80+=0x1){_0x5e1700[_0x184f80][_0xaacb('0x52')]=[];_0x4b6177[_0xaacb('0x6a')](db[_0xaacb('0x46')][_0xaacb('0x4d')]({'where':{'FromId':[_0x15a289[_0xaacb('0x62')]['id'],_0x1b85c7[_0x184f80]['id']],'ToId':[_0x15a289['user']['id'],_0x1b85c7[_0x184f80]['id']],'ChatGroupId':null},'attributes':['id',_0xaacb('0x53'),_0xaacb('0x6c'),_0xaacb('0x6d'),'read',_0xaacb('0x4f')],'order':qs[_0xaacb('0x3f')](_0xaacb('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x1b85c7[_0x184f80])));}return BPromise[_0xaacb('0x6f')](_0x4b6177);}return[];})[_0xaacb('0x2c')](function(_0x2933f9){return{'rows':_0x2933f9,'count':_0x2933f9[_0xaacb('0x3b')]};})['then'](respondWithResult(_0x5df241,null))[_0xaacb('0x4b')](handleError(_0x5df241,null));}; \ No newline at end of file +var _0xe564=['Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','findAll','rows','show','params','length','includeAll','include','catch','create','body','find','describe','get','messages','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x322f4d,_0x2211c6){var _0x548443=function(_0x5f42a4){while(--_0x5f42a4){_0x322f4d['push'](_0x322f4d['shift']());}};_0x548443(++_0x2211c6);}(_0xe564,0x1b7));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e56('0x0'));var zipdir=require(_0x4e56('0x1'));var jsonpatch=require(_0x4e56('0x2'));var rp=require(_0x4e56('0x3'));var moment=require(_0x4e56('0x4'));var BPromise=require(_0x4e56('0x5'));var Mustache=require(_0x4e56('0x6'));var util=require(_0x4e56('0x7'));var path=require(_0x4e56('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e56('0x9'));var fs=require('fs');var fs_extra=require(_0x4e56('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e56('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e56('0xc'));var Papa=require('papaparse');var Redis=require(_0x4e56('0xd'));var authService=require(_0x4e56('0xe'));var qs=require(_0x4e56('0xf'));var as=require(_0x4e56('0x10'));var hardwareService=require(_0x4e56('0x11'));var logger=require(_0x4e56('0x12'))(_0x4e56('0x13'));var utils=require(_0x4e56('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e56('0x15'))['db'];config[_0x4e56('0x16')]=_['defaults'](config[_0x4e56('0x16')],{'host':_0x4e56('0x17'),'port':0x18eb});var socket=require(_0x4e56('0x18'))(new Redis(config[_0x4e56('0x16')]));require('./chatInternalMessage.socket')[_0x4e56('0x19')](socket);function respondWithStatusCode(_0x23aa99,_0x1cfc27){_0x1cfc27=_0x1cfc27||0xcc;return function(_0x4408ac){if(_0x4408ac){return _0x23aa99[_0x4e56('0x1a')](_0x1cfc27);}return _0x23aa99['status'](_0x1cfc27)[_0x4e56('0x1b')]();};}function respondWithResult(_0xca930c,_0x287c98){_0x287c98=_0x287c98||0xc8;return function(_0x326cf6){if(_0x326cf6){return _0xca930c[_0x4e56('0x1c')](_0x287c98)[_0x4e56('0x1d')](_0x326cf6);}};}function respondWithFilteredResult(_0xa1b0a7,_0x39b64e){return function(_0x20c4ec){if(_0x20c4ec){var _0x3db547=typeof _0x39b64e[_0x4e56('0x1e')]===_0x4e56('0x1f')&&typeof _0x39b64e[_0x4e56('0x20')]===_0x4e56('0x1f');var _0x267696=_0x20c4ec[_0x4e56('0x21')];var _0x25c348=_0x3db547?0x0:_0x39b64e[_0x4e56('0x1e')];var _0x1870e6=_0x3db547?_0x20c4ec[_0x4e56('0x21')]:_0x39b64e[_0x4e56('0x1e')]+_0x39b64e[_0x4e56('0x20')];var _0x899123;if(_0x1870e6>=_0x267696){_0x1870e6=_0x267696;_0x899123=0xc8;}else{_0x899123=0xce;}_0xa1b0a7[_0x4e56('0x1c')](_0x899123);return _0xa1b0a7[_0x4e56('0x22')](_0x4e56('0x23'),_0x25c348+'-'+_0x1870e6+'/'+_0x267696)[_0x4e56('0x1d')](_0x20c4ec);}return null;};}function patchUpdates(_0x546a9c){return function(_0x34670d){try{jsonpatch[_0x4e56('0x24')](_0x34670d,_0x546a9c,!![]);}catch(_0x35e27a){return BPromise['reject'](_0x35e27a);}return _0x34670d[_0x4e56('0x25')]();};}function saveUpdates(_0x2b8568,_0x512078){return function(_0x84678c){if(_0x84678c){return _0x84678c[_0x4e56('0x26')](_0x2b8568)[_0x4e56('0x27')](function(_0x58d524){return _0x58d524;});}return null;};}function removeEntity(_0x2195f9,_0x150484){return function(_0x4f6b4f){if(_0x4f6b4f){return _0x4f6b4f[_0x4e56('0x28')]()[_0x4e56('0x27')](function(){_0x2195f9[_0x4e56('0x1c')](0xcc)[_0x4e56('0x1b')]();});}};}function handleEntityNotFound(_0x1a70f8,_0xe011e8){return function(_0x1d78e9){if(!_0x1d78e9){_0x1a70f8[_0x4e56('0x1a')](0x194);}return _0x1d78e9;};}function handleError(_0xc4dd1a,_0x39be3e){_0x39be3e=_0x39be3e||0x1f4;return function(_0x49f0a4){logger['error'](_0x49f0a4[_0x4e56('0x29')]);if(_0x49f0a4[_0x4e56('0x2a')]){delete _0x49f0a4[_0x4e56('0x2a')];}_0xc4dd1a['status'](_0x39be3e)[_0x4e56('0x2b')](_0x49f0a4);};}exports[_0x4e56('0x2c')]=function(_0x13776f,_0x46f6a2){var _0x577ea7={},_0x4aa0a8={},_0x5cf851={'count':0x0,'rows':[]};var _0x2e8443=_[_0x4e56('0x2d')](db[_0x4e56('0x2e')][_0x4e56('0x2f')],function(_0x3064db){return{'name':_0x3064db[_0x4e56('0x30')],'type':_0x3064db[_0x4e56('0x31')][_0x4e56('0x32')]};});_0x4aa0a8[_0x4e56('0x33')]=_[_0x4e56('0x2d')](_0x2e8443,_0x4e56('0x2a'));_0x4aa0a8[_0x4e56('0x34')]=_[_0x4e56('0x35')](_0x13776f['query']);_0x4aa0a8['filters']=_[_0x4e56('0x36')](_0x4aa0a8[_0x4e56('0x33')],_0x4aa0a8[_0x4e56('0x34')]);_0x577ea7[_0x4e56('0x37')]=_[_0x4e56('0x36')](_0x4aa0a8[_0x4e56('0x33')],qs[_0x4e56('0x38')](_0x13776f[_0x4e56('0x34')]['fields']));_0x577ea7[_0x4e56('0x37')]=_0x577ea7[_0x4e56('0x37')]['length']?_0x577ea7[_0x4e56('0x37')]:_0x4aa0a8[_0x4e56('0x33')];if(!_0x13776f[_0x4e56('0x34')][_0x4e56('0x39')]('nolimit')){_0x577ea7[_0x4e56('0x20')]=qs[_0x4e56('0x20')](_0x13776f[_0x4e56('0x34')][_0x4e56('0x20')]);_0x577ea7['offset']=qs['offset'](_0x13776f[_0x4e56('0x34')]['offset']);}_0x577ea7[_0x4e56('0x3a')]=qs['sort'](_0x13776f['query'][_0x4e56('0x3b')]);_0x577ea7['where']=qs[_0x4e56('0x3c')](_[_0x4e56('0x3d')](_0x13776f[_0x4e56('0x34')],_0x4aa0a8[_0x4e56('0x3c')]),_0x2e8443);if(_0x13776f['query'][_0x4e56('0x3e')]){_0x577ea7['where']=_[_0x4e56('0x3f')](_0x577ea7['where'],{'$or':_['map'](_0x2e8443,function(_0x21cc55){if(_0x21cc55[_0x4e56('0x31')]!==_0x4e56('0x40')){var _0x1db635={};_0x1db635[_0x21cc55['name']]={'$like':'%'+_0x13776f[_0x4e56('0x34')][_0x4e56('0x3e')]+'%'};return _0x1db635;}})});}_0x577ea7=_[_0x4e56('0x3f')]({},_0x577ea7,_0x13776f[_0x4e56('0x41')]);var _0x44ceb3={'where':_0x577ea7[_0x4e56('0x42')]};return db[_0x4e56('0x2e')]['count'](_0x44ceb3)[_0x4e56('0x27')](function(_0x364f53){_0x5cf851[_0x4e56('0x21')]=_0x364f53;if(_0x13776f['query']['includeAll']){_0x577ea7['include']=[{'all':!![]}];}return db[_0x4e56('0x2e')][_0x4e56('0x43')](_0x577ea7);})[_0x4e56('0x27')](function(_0x35a17b){_0x5cf851[_0x4e56('0x44')]=_0x35a17b;return _0x5cf851;})[_0x4e56('0x27')](respondWithFilteredResult(_0x46f6a2,_0x577ea7))['catch'](handleError(_0x46f6a2,null));};exports[_0x4e56('0x45')]=function(_0x1ce7dd,_0x36c7b7){var _0x2fc059={'raw':!![],'where':{'id':_0x1ce7dd[_0x4e56('0x46')]['id']}},_0x3fc222={};_0x3fc222[_0x4e56('0x33')]=_['keys'](db['ChatInternalMessage'][_0x4e56('0x2f')]);_0x3fc222[_0x4e56('0x34')]=_[_0x4e56('0x35')](_0x1ce7dd['query']);_0x3fc222[_0x4e56('0x3c')]=_[_0x4e56('0x36')](_0x3fc222['model'],_0x3fc222['query']);_0x2fc059['attributes']=_[_0x4e56('0x36')](_0x3fc222[_0x4e56('0x33')],qs[_0x4e56('0x38')](_0x1ce7dd[_0x4e56('0x34')]['fields']));_0x2fc059[_0x4e56('0x37')]=_0x2fc059['attributes'][_0x4e56('0x47')]?_0x2fc059[_0x4e56('0x37')]:_0x3fc222['model'];if(_0x1ce7dd[_0x4e56('0x34')][_0x4e56('0x48')]){_0x2fc059[_0x4e56('0x49')]=[{'all':!![]}];}_0x2fc059=_[_0x4e56('0x3f')]({},_0x2fc059,_0x1ce7dd[_0x4e56('0x41')]);return db[_0x4e56('0x2e')]['find'](_0x2fc059)[_0x4e56('0x27')](handleEntityNotFound(_0x36c7b7,null))[_0x4e56('0x27')](respondWithResult(_0x36c7b7,null))[_0x4e56('0x4a')](handleError(_0x36c7b7,null));};exports[_0x4e56('0x4b')]=function(_0x2fcfec,_0x364c26){return db[_0x4e56('0x2e')][_0x4e56('0x4b')](_0x2fcfec['body'],{})[_0x4e56('0x27')](respondWithResult(_0x364c26,0xc9))['catch'](handleError(_0x364c26,null));};exports['update']=function(_0x5e8dee,_0x329cd8){if(_0x5e8dee[_0x4e56('0x4c')]['id']){delete _0x5e8dee['body']['id'];}return db['ChatInternalMessage'][_0x4e56('0x4d')]({'where':{'id':_0x5e8dee['params']['id']}})[_0x4e56('0x27')](handleEntityNotFound(_0x329cd8,null))['then'](saveUpdates(_0x5e8dee[_0x4e56('0x4c')],null))[_0x4e56('0x27')](respondWithResult(_0x329cd8,null))['catch'](handleError(_0x329cd8,null));};exports['destroy']=function(_0x3aaa3a,_0x666ae7){return db[_0x4e56('0x2e')]['find']({'where':{'id':_0x3aaa3a[_0x4e56('0x46')]['id']}})[_0x4e56('0x27')](handleEntityNotFound(_0x666ae7,null))['then'](removeEntity(_0x666ae7,null))[_0x4e56('0x4a')](handleError(_0x666ae7,null));};exports[_0x4e56('0x4e')]=function(_0x209841,_0x5d555f){return db[_0x4e56('0x2e')][_0x4e56('0x4e')]()[_0x4e56('0x27')](respondWithResult(_0x5d555f,null))[_0x4e56('0x4a')](handleError(_0x5d555f,null));};function wrapUser(_0x5aeee0){return function(_0x333699){var _0x123c03=_0x5aeee0[_0x4e56('0x4f')]({'plain':!![]});_0x123c03[_0x4e56('0x50')]=[];if(_0x333699){_0x123c03['lastMessageAt']=_0x333699[_0x4e56('0x51')];_0x123c03[_0x4e56('0x52')]=_0x333699;}else{_0x123c03['lastMessageAt']=moment(0x0)['format'](_0x4e56('0x53'));_0x123c03[_0x4e56('0x52')]={};}return _0x123c03;};}exports['getUsers']=function(_0x19d943,_0x145de6,_0x15bee6){var _0xb8f312=[];return db[_0x4e56('0x54')][_0x4e56('0x43')]({'where':{'role':[_0x4e56('0x55'),'admin',_0x4e56('0x56')]},'attributes':['id',_0x4e56('0x57'),_0x4e56('0x2a'),_0x4e56('0x58'),_0x4e56('0x59'),_0x4e56('0x5a'),'online',_0x4e56('0x5b'),_0x4e56('0x5c'),'showWebBar'],'order':qs[_0x4e56('0x3b')]('-online'),'include':[{'model':db[_0x4e56('0x5d')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x4e56('0x27')](function(_0x1f5e14){if(_0x1f5e14){var _0x239702=_0x19d943['user'][_0x4e56('0x4f')]({'plain':!![]});if(!_0x239702)throw new Error(_0x4e56('0x5e'));if(_0x239702[_0x4e56('0x58')]===_0x4e56('0x56')){return db[_0x4e56('0x5f')]['find']({'where':{'name':_0x4e56('0x60'),'userProfileId':_0x239702[_0x4e56('0x61')]},'raw':!![]})['then'](function(_0xefcbdf){if(_0xefcbdf){if(_0xefcbdf['autoAssociation']===0x0){return db[_0x4e56('0x62')]['findAll']({'where':{'sectionId':_0xefcbdf['id']},'raw':!![]})[_0x4e56('0x27')](function(_0x580030){var _0x4c1cbe=[];if(_[_0x4e56('0x63')](_0x580030)){_0x4c1cbe=_[_0x4e56('0x3e')](_0x1f5e14,function(_0x3b6963){if(_0x3b6963[_0x4e56('0x58')]!=='agent'){return _0x3b6963;}});return _0x4c1cbe;}else{for(var _0x4cc4a8=0x0;_0x4cc4a8<_0x1f5e14[_0x4e56('0x47')];_0x4cc4a8++){var _0x3d8450=_0x1f5e14[_0x4cc4a8];if(_0x3d8450[_0x4e56('0x58')]===_0x4e56('0x55')){var _0xbdbc82=_[_0x4e56('0x4d')](_0x580030,function(_0x306377){return _0x306377[_0x4e56('0x64')]===_0x3d8450['id'];});if(_0xbdbc82)_0x4c1cbe[_0x4e56('0x65')](_0x3d8450);}else{_0x4c1cbe[_0x4e56('0x65')](_0x3d8450);}}return _0x4c1cbe;}});}else{return _0x1f5e14;}}else{var _0x2ba0c1=_[_0x4e56('0x3e')](_0x1f5e14,function(_0x2d8daa){if(_0x2d8daa['role']!=='agent'){return _0x2d8daa;}});return _0x2ba0c1;}});}else{return _0x1f5e14;}}})[_0x4e56('0x27')](function(_0x519659){var _0x3b3235=[];if(_0x519659){_0xb8f312=_0x519659;for(var _0x343485=0x0;_0x343485<_0x519659['length'];_0x343485+=0x1){_0xb8f312[_0x343485][_0x4e56('0x50')]=[];_0x3b3235[_0x4e56('0x65')](db[_0x4e56('0x2e')]['find']({'where':{'FromId':[_0x19d943[_0x4e56('0x56')]['id'],_0x519659[_0x343485]['id']],'ToId':[_0x19d943[_0x4e56('0x56')]['id'],_0x519659[_0x343485]['id']],'ChatGroupId':null},'attributes':['id',_0x4e56('0x51'),_0x4e56('0x66'),_0x4e56('0x67'),_0x4e56('0x68'),_0x4e56('0x4c')],'order':qs[_0x4e56('0x3b')](_0x4e56('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x519659[_0x343485])));}return BPromise[_0x4e56('0x6a')](_0x3b3235);}return[];})['then'](function(_0x364183){return{'rows':_0x364183,'count':_0x364183['length']};})[_0x4e56('0x27')](respondWithResult(_0x145de6,null))[_0x4e56('0x4a')](handleError(_0x145de6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8ed9446..ae75874 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 _0x8ee9=['../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty','exports'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x8ee9,0x1f1));var _0x98ee=function(_0x4d2a57,_0x267329){_0x4d2a57=_0x4d2a57-0x0;var _0x3a9514=_0x8ee9[_0x4d2a57];return _0x3a9514;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x98ee('0x0'))['db'][_0x98ee('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x98ee('0x2'),'afterUpdate':'update','afterDestroy':_0x98ee('0x3')};function emitEvent(_0x3ce827){return function(_0x16cc99,_0x19f208,_0x50a5fb){ChatInternalMessageEvents[_0x98ee('0x4')](_0x3ce827+':'+_0x16cc99['id'],_0x16cc99);ChatInternalMessageEvents[_0x98ee('0x4')](_0x3ce827,_0x16cc99);_0x50a5fb(null);};}for(var e in events){if(events[_0x98ee('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x98ee('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xdb2d=['save','remove','emit','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xdb2d,0x19c));var _0xddb2=function(_0x2f6af5,_0x776b09){_0x2f6af5=_0x2f6af5-0x0;var _0x4b9875=_0xdb2d[_0x2f6af5];return _0x4b9875;};'use strict';var EventEmitter=require(_0xddb2('0x0'));var ChatInternalMessage=require(_0xddb2('0x1'))['db'][_0xddb2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xddb2('0x3')](0x0);var events={'afterCreate':_0xddb2('0x4'),'afterUpdate':'update','afterDestroy':_0xddb2('0x5')};function emitEvent(_0x4ba9e5){return function(_0x435fc3,_0xa22392,_0x3c519f){ChatInternalMessageEvents[_0xddb2('0x6')](_0x4ba9e5+':'+_0x435fc3['id'],_0x435fc3);ChatInternalMessageEvents[_0xddb2('0x6')](_0x4ba9e5,_0x435fc3);_0x3c519f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xddb2('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b7de648..13fa7d7 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 _0x10ae=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0x10ae,0x6d));var _0xe10a=function(_0x1090be,_0x4bdd56){_0x1090be=_0x1090be-0x0;var _0x3afb33=_0x10ae[_0x1090be];return _0x3afb33;};'use strict';var _=require('lodash');var util=require(_0xe10a('0x0'));var logger=require(_0xe10a('0x1'))(_0xe10a('0x2'));var moment=require(_0xe10a('0x3'));var BPromise=require(_0xe10a('0x4'));var rp=require(_0xe10a('0x5'));var fs=require('fs');var path=require(_0xe10a('0x6'));var rimraf=require('rimraf');var config=require(_0xe10a('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xe10a('0x8')]=function(_0x30475c,_0x17ffd3){return _0x30475c[_0xe10a('0x9')](_0xe10a('0xa'),attributes,{'tableName':_0xe10a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe10a('0xc'),'collate':_0xe10a('0xd')});}; \ No newline at end of file +var _0xf799=['request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ea2f9,_0x320917){var _0x36e586=function(_0x2e79a2){while(--_0x2e79a2){_0x5ea2f9['push'](_0x5ea2f9['shift']());}};_0x36e586(++_0x320917);}(_0xf799,0x6f));var _0x9f79=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xf799[_0x12d812];return _0x3711ab;};'use strict';var _=require(_0x9f79('0x0'));var util=require(_0x9f79('0x1'));var logger=require(_0x9f79('0x2'))(_0x9f79('0x3'));var moment=require(_0x9f79('0x4'));var BPromise=require(_0x9f79('0x5'));var rp=require(_0x9f79('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f79('0x7'));var attributes=require(_0x9f79('0x8'));module[_0x9f79('0x9')]=function(_0x26f11c,_0x15f611){return _0x26f11c[_0x9f79('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x9f79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9f79('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3a2a8ec..ea09044 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 _0xf5a1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf5a1,0x129));var _0x1f5a=function(_0x13e193,_0x3a6a69){_0x13e193=_0x13e193-0x0;var _0x3eb142=_0xf5a1[_0x13e193];return _0x3eb142;};'use strict';var _=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var moment=require(_0x1f5a('0x2'));var BPromise=require(_0x1f5a('0x3'));var rs=require(_0x1f5a('0x4'));var fs=require('fs');var Redis=require(_0x1f5a('0x5'));var db=require(_0x1f5a('0x6'))['db'];var utils=require(_0x1f5a('0x7'));var logger=require('../../config/logger')(_0x1f5a('0x8'));var config=require(_0x1f5a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1f5a('0xa')][_0x1f5a('0xb')]({'port':0x232a});config[_0x1f5a('0xc')]=_['defaults'](config[_0x1f5a('0xc')],{'host':_0x1f5a('0xd'),'port':0x18eb});var socket=require(_0x1f5a('0xe'))(new Redis(config[_0x1f5a('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52d0dd,_0x10b3fe,_0x4babe9){return new BPromise(function(_0x34ee57,_0x44c941){return client[_0x1f5a('0xf')](_0x52d0dd,_0x4babe9)[_0x1f5a('0x10')](function(_0x29001e){logger['info'](_0x1f5a('0x11'),_0x10b3fe,_0x1f5a('0x12'));logger[_0x1f5a('0x13')](_0x1f5a('0x14'),_0x10b3fe,_0x1f5a('0x12'),JSON[_0x1f5a('0x15')](_0x29001e));if(_0x29001e['error']){if(_0x29001e[_0x1f5a('0x16')]['code']===0x1f4){logger['error'](_0x1f5a('0x11'),_0x10b3fe,_0x29001e[_0x1f5a('0x16')][_0x1f5a('0x17')]);return _0x44c941(_0x29001e[_0x1f5a('0x16')][_0x1f5a('0x17')]);}logger[_0x1f5a('0x16')](_0x1f5a('0x11'),_0x10b3fe,_0x29001e[_0x1f5a('0x16')][_0x1f5a('0x17')]);return _0x34ee57(_0x29001e[_0x1f5a('0x16')]['message']);}else{logger[_0x1f5a('0x18')](_0x1f5a('0x11'),_0x10b3fe,_0x1f5a('0x12'));_0x34ee57(_0x29001e[_0x1f5a('0x19')]['message']);}})[_0x1f5a('0x1a')](function(_0x253e2a){logger[_0x1f5a('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x10b3fe,_0x253e2a);_0x44c941(_0x253e2a);});});} \ No newline at end of file +var _0xc7e6=['register','request','then','info','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x112f76,_0x3ecf6b){var _0x2826cd=function(_0x121977){while(--_0x121977){_0x112f76['push'](_0x112f76['shift']());}};_0x2826cd(++_0x3ecf6b);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x4c315a,_0x187fc3){_0x4c315a=_0x4c315a-0x0;var _0x2310d8=_0xc7e6[_0x4c315a];return _0x2310d8;};'use strict';var _=require(_0x6c7e('0x0'));var util=require(_0x6c7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c7e('0x2'));var db=require(_0x6c7e('0x3'))['db'];var utils=require(_0x6c7e('0x4'));var logger=require('../../config/logger')(_0x6c7e('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c7e('0x6'));var client=jayson['client'][_0x6c7e('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6c7e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c7e('0x9'))(new Redis(config[_0x6c7e('0x8')]));require(_0x6c7e('0xa'))[_0x6c7e('0xb')](socket);function respondWithRpcPromise(_0x4da581,_0x250276,_0x1a27c9){return new BPromise(function(_0x407fd4,_0x50cfcf){return client[_0x6c7e('0xc')](_0x4da581,_0x1a27c9)[_0x6c7e('0xd')](function(_0xa3761e){logger[_0x6c7e('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x250276,_0x6c7e('0xf'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x250276,'request\x20sent',JSON['stringify'](_0xa3761e));if(_0xa3761e['error']){if(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x11')]===0x1f4){logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e['error']['message']);return _0x50cfcf(_0xa3761e['error'][_0x6c7e('0x13')]);}logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);return _0x407fd4(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);}else{logger[_0x6c7e('0xe')](_0x6c7e('0x12'),_0x250276,_0x6c7e('0xf'));_0x407fd4(_0xa3761e[_0x6c7e('0x14')]['message']);}})[_0x6c7e('0x15')](function(_0x25d380){logger[_0x6c7e('0x10')](_0x6c7e('0x12'),_0x250276,_0x25d380);_0x50cfcf(_0x25d380);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index aabeafe..6d5f62c 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 _0x88d7=['emit','removeListener','register','./chatInternalMessage.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88d7,0x16b));var _0x788d=function(_0x2c02d2,_0x3eb2ee){_0x2c02d2=_0x2c02d2-0x0;var _0xcac6b7=_0x88d7[_0x2c02d2];return _0xcac6b7;};'use strict';var ChatInternalMessageEvents=require(_0x788d('0x0'));var events=[_0x788d('0x1'),_0x788d('0x2'),'update'];function createListener(_0x2a2dc9,_0x2dab40){return function(_0x37ca97){_0x2dab40[_0x788d('0x3')](_0x2a2dc9,_0x37ca97);};}function removeListener(_0x5efbac,_0x3befe2){return function(){ChatInternalMessageEvents[_0x788d('0x4')](_0x5efbac,_0x3befe2);};}exports[_0x788d('0x5')]=function(_0x1296a5){for(var _0x2e811c=0x0,_0x493ff8=events['length'];_0x2e811c<_0x493ff8;_0x2e811c++){var _0x3b0179=events[_0x2e811c];var _0xc196b1=createListener('chatInternalMessage:'+_0x3b0179,_0x1296a5);ChatInternalMessageEvents['on'](_0x3b0179,_0xc196b1);}}; \ No newline at end of file +var _0x40c7=['./chatInternalMessage.events','save','register','length','chatInternalMessage:'];(function(_0x5b3018,_0x27f6c){var _0x35218f=function(_0x280907){while(--_0x280907){_0x5b3018['push'](_0x5b3018['shift']());}};_0x35218f(++_0x27f6c);}(_0x40c7,0x10e));var _0x740c=function(_0x15ed84,_0x589521){_0x15ed84=_0x15ed84-0x0;var _0x426d2b=_0x40c7[_0x15ed84];return _0x426d2b;};'use strict';var ChatInternalMessageEvents=require(_0x740c('0x0'));var events=[_0x740c('0x1'),'remove','update'];function createListener(_0x2c8d42,_0x1feac6){return function(_0x1da3a1){_0x1feac6['emit'](_0x2c8d42,_0x1da3a1);};}function removeListener(_0x117519,_0x1e95dc){return function(){ChatInternalMessageEvents['removeListener'](_0x117519,_0x1e95dc);};}exports[_0x740c('0x2')]=function(_0x15716a){for(var _0x2e16b7=0x0,_0x4ed148=events[_0x740c('0x3')];_0x2e16b7<_0x4ed148;_0x2e16b7++){var _0x25ff93=events[_0x2e16b7];var _0x441817=createListener(_0x740c('0x4')+_0x25ff93,_0x15716a);ChatInternalMessageEvents['on'](_0x25ff93,_0x441817);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 03a6efa..d1cc5ed 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 _0x3602=['update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','/describe','describe','/users','isAuthenticated','/:id','post','create','put'];(function(_0x3a53dc,_0x26b3c1){var _0x3dfae4=function(_0x508c9e){while(--_0x508c9e){_0x3a53dc['push'](_0x3a53dc['shift']());}};_0x3dfae4(++_0x26b3c1);}(_0x3602,0x100));var _0x2360=function(_0xe050d1,_0x12991e){_0xe050d1=_0xe050d1-0x0;var _0x50b4dc=_0x3602[_0xe050d1];return _0x50b4dc;};'use strict';var multer=require('multer');var util=require(_0x2360('0x0'));var path=require('path');var timeout=require(_0x2360('0x1'));var express=require('express');var router=express[_0x2360('0x2')]();var fs_extra=require(_0x2360('0x3'));var auth=require(_0x2360('0x4'));var interaction=require(_0x2360('0x5'));var config=require(_0x2360('0x6'));var controller=require(_0x2360('0x7'));router[_0x2360('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2360('0x8')](_0x2360('0x9'),auth['isAuthenticated'](),controller[_0x2360('0xa')]);router[_0x2360('0x8')](_0x2360('0xb'),auth[_0x2360('0xc')](),controller['getUsers']);router[_0x2360('0x8')](_0x2360('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2360('0xe')]('/',auth['isAuthenticated'](),controller[_0x2360('0xf')]);router[_0x2360('0x10')](_0x2360('0xd'),controller[_0x2360('0x11')]);router[_0x2360('0x12')](_0x2360('0xd'),auth[_0x2360('0xc')](),controller[_0x2360('0x13')]);module[_0x2360('0x14')]=router; \ No newline at end of file +var _0x0ee6=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','describe','/users','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x1af225,_0x46edd2){var _0x4bd6b3=function(_0x2b9b24){while(--_0x2b9b24){_0x1af225['push'](_0x1af225['shift']());}};_0x4bd6b3(++_0x46edd2);}(_0x0ee6,0x111));var _0x60ee=function(_0x12d81d,_0x5ebd1d){_0x12d81d=_0x12d81d-0x0;var _0x3f9ba7=_0x0ee6[_0x12d81d];return _0x3f9ba7;};'use strict';var multer=require(_0x60ee('0x0'));var util=require('util');var path=require(_0x60ee('0x1'));var timeout=require(_0x60ee('0x2'));var express=require(_0x60ee('0x3'));var router=express['Router']();var fs_extra=require(_0x60ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x60ee('0x5'));var config=require(_0x60ee('0x6'));var controller=require(_0x60ee('0x7'));router[_0x60ee('0x8')]('/',auth['isAuthenticated'](),controller[_0x60ee('0x9')]);router[_0x60ee('0x8')](_0x60ee('0xa'),auth['isAuthenticated'](),controller[_0x60ee('0xb')]);router[_0x60ee('0x8')](_0x60ee('0xc'),auth[_0x60ee('0xd')](),controller['getUsers']);router[_0x60ee('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x60ee('0xe')]);router[_0x60ee('0xf')]('/',auth[_0x60ee('0xd')](),controller['create']);router[_0x60ee('0x10')]('/:id',controller[_0x60ee('0x11')]);router[_0x60ee('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x60ee('0x13')]);module[_0x60ee('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2309d58..e738b7f 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 _0x0b0e=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x0b0e[_0x184759];return _0xf26d5f;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0b0('0x3')]('in',_0xe0b0('0x4')),'defaultValue':_0xe0b0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe0b0('0x5')]},'providerName':{'type':Sequelize[_0xe0b0('0x6')]},'providerResponse':{'type':Sequelize[_0xe0b0('0x1')]}}; \ No newline at end of file +var _0xbc9d=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x1ee5be,_0x5f46e3){var _0x177140=function(_0x162779){while(--_0x162779){_0x1ee5be['push'](_0x1ee5be['shift']());}};_0x177140(++_0x5f46e3);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x486a17,_0x14c452){_0x486a17=_0x486a17-0x0;var _0x584cb4=_0xbc9d[_0x486a17];return _0x584cb4;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'body':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdbc9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdbc9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdbc9('0x6')]},'providerName':{'type':Sequelize[_0xdbc9('0x7')]},'providerResponse':{'type':Sequelize[_0xdbc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ef917e9..6026da4 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 _0xbce5=['SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','rejectmessage','parse','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','count','set','Content-Range','apply','end','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','merge','VIRTUAL','filter','ChatMessage','include','rows','catch','show','params','rawAttributes','options','create','update','body','../../config/logger','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','find','read1stAt','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes'];(function(_0x14955c,_0x82f214){var _0x7ea0c=function(_0xa68c06){while(--_0xa68c06){_0x14955c['push'](_0x14955c['shift']());}};_0x7ea0c(++_0x82f214);}(_0xbce5,0x19f));var _0x5bce=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xbce5[_0x11e05d];return _0x335588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bce('0x1'));var rp=require(_0x5bce('0x2'));var moment=require(_0x5bce('0x3'));var BPromise=require(_0x5bce('0x4'));var Mustache=require(_0x5bce('0x5'));var util=require(_0x5bce('0x6'));var path=require(_0x5bce('0x7'));var sox=require(_0x5bce('0x8'));var csv=require(_0x5bce('0x9'));var ejs=require(_0x5bce('0xa'));var fs=require('fs');var fs_extra=require(_0x5bce('0xb'));var _=require(_0x5bce('0xc'));var squel=require(_0x5bce('0xd'));var crypto=require(_0x5bce('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5bce('0xf'));var toCsv=require(_0x5bce('0x9'));var querystring=require(_0x5bce('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bce('0x11'));var authService=require(_0x5bce('0x12'));var qs=require(_0x5bce('0x13'));var as=require(_0x5bce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5bce('0x15'));var config=require(_0x5bce('0x16'));var licenseUtil=require(_0x5bce('0x17'));var db=require(_0x5bce('0x18'))['db'];config['redis']=_[_0x5bce('0x19')](config['redis'],{'host':_0x5bce('0x1a'),'port':0x18eb});var socket=require(_0x5bce('0x1b'))(new Redis(config[_0x5bce('0x1c')]));require(_0x5bce('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5bce('0x1e')][_0x5bce('0x1f')]({'port':0x232c});var client9002=jayson[_0x5bce('0x1e')][_0x5bce('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x27dd0e,_0x338bfe,_0x26b64b,_0x1cffad){return new BPromise(function(_0x3c6260,_0x113d70){var _0x507f2f=_0x1cffad||client;return _0x507f2f['request'](_0x27dd0e,_0x26b64b)[_0x5bce('0x20')](function(_0x420414){logger[_0x5bce('0x21')](_0x5bce('0x22'),_0x338bfe,_0x5bce('0x23'));logger[_0x5bce('0x24')](_0x5bce('0x25'),_0x338bfe,_0x5bce('0x23'),JSON[_0x5bce('0x26')](_0x420414));if(_0x420414[_0x5bce('0x27')]){if(_0x420414['error'][_0x5bce('0x28')]===0x1f4){logger[_0x5bce('0x27')]('ChatMessage,\x20%s,\x20%s',_0x338bfe,_0x420414['error'][_0x5bce('0x29')]);return _0x113d70(_0x420414[_0x5bce('0x27')][_0x5bce('0x29')]);}logger[_0x5bce('0x27')](_0x5bce('0x22'),_0x338bfe,_0x420414[_0x5bce('0x27')][_0x5bce('0x29')]);return _0x3c6260(_0x420414[_0x5bce('0x27')][_0x5bce('0x29')]);}else{logger[_0x5bce('0x21')](_0x5bce('0x22'),_0x338bfe,_0x5bce('0x23'));_0x3c6260(_0x420414[_0x5bce('0x2a')][_0x5bce('0x29')]);}})['catch'](function(_0x4f0fa1){logger[_0x5bce('0x27')]('ChatMessage,\x20%s,\x20%s',_0x338bfe,_0x4f0fa1);_0x113d70(_0x4f0fa1);});});}function respondWithStatusCode(_0x4eb3df,_0x160048){_0x160048=_0x160048||0xcc;return function(_0x1fe8eb){if(_0x1fe8eb){return _0x4eb3df[_0x5bce('0x2b')](_0x160048);}return _0x4eb3df[_0x5bce('0x2c')](_0x160048)['end']();};}function respondWithResult(_0xba1a74,_0x59d648){_0x59d648=_0x59d648||0xc8;return function(_0x35fb52){if(_0x35fb52){return _0xba1a74[_0x5bce('0x2c')](_0x59d648)[_0x5bce('0x2d')](_0x35fb52);}};}function respondWithFilteredResult(_0x1e2fa4,_0x5d518b){return function(_0x1a9c3b){if(_0x1a9c3b){var _0x440e9b=typeof _0x5d518b[_0x5bce('0x2e')]==='undefined'&&typeof _0x5d518b['limit']==='undefined';var _0x49b9c1=_0x1a9c3b[_0x5bce('0x2f')];var _0xc072ca=_0x440e9b?0x0:_0x5d518b[_0x5bce('0x2e')];var _0x202171=_0x440e9b?_0x1a9c3b[_0x5bce('0x2f')]:_0x5d518b[_0x5bce('0x2e')]+_0x5d518b['limit'];var _0x4e5334;if(_0x202171>=_0x49b9c1){_0x202171=_0x49b9c1;_0x4e5334=0xc8;}else{_0x4e5334=0xce;}_0x1e2fa4['status'](_0x4e5334);return _0x1e2fa4[_0x5bce('0x30')](_0x5bce('0x31'),_0xc072ca+'-'+_0x202171+'/'+_0x49b9c1)[_0x5bce('0x2d')](_0x1a9c3b);}return null;};}function patchUpdates(_0x2f41a3){return function(_0x56fc6b){try{jsonpatch[_0x5bce('0x32')](_0x56fc6b,_0x2f41a3,!![]);}catch(_0x417e41){return BPromise['reject'](_0x417e41);}return _0x56fc6b['save']();};}function saveUpdates(_0x566258,_0x103fd0){return function(_0x115b3f){if(_0x115b3f){return _0x115b3f['update'](_0x566258)[_0x5bce('0x20')](function(_0x3f6b63){return _0x3f6b63;});}return null;};}function removeEntity(_0x201e63,_0x3b449f){return function(_0x5003db){if(_0x5003db){return _0x5003db['destroy']()[_0x5bce('0x20')](function(){_0x201e63['status'](0xcc)[_0x5bce('0x33')]();});}};}function handleEntityNotFound(_0x893258,_0x2dae19){return function(_0x3621ce){if(!_0x3621ce){_0x893258[_0x5bce('0x2b')](0x194);}return _0x3621ce;};}function handleError(_0x592b7f,_0x46894f){_0x46894f=_0x46894f||0x1f4;return function(_0x1d6598){logger[_0x5bce('0x27')](_0x1d6598[_0x5bce('0x34')]);if(_0x1d6598[_0x5bce('0x35')]){delete _0x1d6598[_0x5bce('0x35')];}_0x592b7f[_0x5bce('0x2c')](_0x46894f)[_0x5bce('0x36')](_0x1d6598);};}exports[_0x5bce('0x37')]=function(_0x1e5cb7,_0x58136c){var _0x2a334d={},_0xc0989d={},_0xcb5c0={'count':0x0,'rows':[]};var _0x45c1b4=_[_0x5bce('0x38')](db['ChatMessage']['rawAttributes'],function(_0x2e998a){return{'name':_0x2e998a['fieldName'],'type':_0x2e998a[_0x5bce('0x39')][_0x5bce('0x3a')]};});_0xc0989d[_0x5bce('0x3b')]=_['map'](_0x45c1b4,_0x5bce('0x35'));_0xc0989d[_0x5bce('0x3c')]=_[_0x5bce('0x3d')](_0x1e5cb7[_0x5bce('0x3c')]);_0xc0989d[_0x5bce('0x3e')]=_[_0x5bce('0x3f')](_0xc0989d[_0x5bce('0x3b')],_0xc0989d[_0x5bce('0x3c')]);_0x2a334d[_0x5bce('0x40')]=_[_0x5bce('0x3f')](_0xc0989d[_0x5bce('0x3b')],qs[_0x5bce('0x41')](_0x1e5cb7[_0x5bce('0x3c')][_0x5bce('0x41')]));_0x2a334d['attributes']=_0x2a334d['attributes'][_0x5bce('0x42')]?_0x2a334d[_0x5bce('0x40')]:_0xc0989d[_0x5bce('0x3b')];if(!_0x1e5cb7[_0x5bce('0x3c')]['hasOwnProperty'](_0x5bce('0x43'))){_0x2a334d[_0x5bce('0x44')]=qs[_0x5bce('0x44')](_0x1e5cb7[_0x5bce('0x3c')][_0x5bce('0x44')]);_0x2a334d['offset']=qs[_0x5bce('0x2e')](_0x1e5cb7[_0x5bce('0x3c')][_0x5bce('0x2e')]);}_0x2a334d[_0x5bce('0x45')]=qs[_0x5bce('0x46')](_0x1e5cb7['query'][_0x5bce('0x46')]);_0x2a334d['where']=qs[_0x5bce('0x3e')](_[_0x5bce('0x47')](_0x1e5cb7[_0x5bce('0x3c')],_0xc0989d[_0x5bce('0x3e')]),_0x45c1b4);if(_0x1e5cb7[_0x5bce('0x3c')]['filter']){_0x2a334d['where']=_[_0x5bce('0x48')](_0x2a334d['where'],{'$or':_[_0x5bce('0x38')](_0x45c1b4,function(_0x2f77a8){if(_0x2f77a8['type']!==_0x5bce('0x49')){var _0x5e0358={};_0x5e0358[_0x2f77a8['name']]={'$like':'%'+_0x1e5cb7[_0x5bce('0x3c')][_0x5bce('0x4a')]+'%'};return _0x5e0358;}})});}_0x2a334d=_[_0x5bce('0x48')]({},_0x2a334d,_0x1e5cb7['options']);var _0xe38bf8={'where':_0x2a334d['where']};return db[_0x5bce('0x4b')][_0x5bce('0x2f')](_0xe38bf8)[_0x5bce('0x20')](function(_0x42e406){_0xcb5c0[_0x5bce('0x2f')]=_0x42e406;if(_0x1e5cb7[_0x5bce('0x3c')]['includeAll']){_0x2a334d[_0x5bce('0x4c')]=[{'all':!![]}];}return db[_0x5bce('0x4b')]['findAll'](_0x2a334d);})[_0x5bce('0x20')](function(_0x3aa6ac){_0xcb5c0[_0x5bce('0x4d')]=_0x3aa6ac;return _0xcb5c0;})[_0x5bce('0x20')](respondWithFilteredResult(_0x58136c,_0x2a334d))[_0x5bce('0x4e')](handleError(_0x58136c,null));};exports[_0x5bce('0x4f')]=function(_0x5c52ee,_0x5b7d39){var _0x1a626e={'raw':!![],'where':{'id':_0x5c52ee[_0x5bce('0x50')]['id']}},_0x2ee5cf={};_0x2ee5cf[_0x5bce('0x3b')]=_['keys'](db[_0x5bce('0x4b')][_0x5bce('0x51')]);_0x2ee5cf[_0x5bce('0x3c')]=_[_0x5bce('0x3d')](_0x5c52ee[_0x5bce('0x3c')]);_0x2ee5cf['filters']=_[_0x5bce('0x3f')](_0x2ee5cf[_0x5bce('0x3b')],_0x2ee5cf[_0x5bce('0x3c')]);_0x1a626e[_0x5bce('0x40')]=_['intersection'](_0x2ee5cf[_0x5bce('0x3b')],qs[_0x5bce('0x41')](_0x5c52ee[_0x5bce('0x3c')][_0x5bce('0x41')]));_0x1a626e[_0x5bce('0x40')]=_0x1a626e['attributes'][_0x5bce('0x42')]?_0x1a626e[_0x5bce('0x40')]:_0x2ee5cf['model'];if(_0x5c52ee['query']['includeAll']){_0x1a626e['include']=[{'all':!![]}];}_0x1a626e=_[_0x5bce('0x48')]({},_0x1a626e,_0x5c52ee[_0x5bce('0x52')]);return db[_0x5bce('0x4b')]['find'](_0x1a626e)[_0x5bce('0x20')](handleEntityNotFound(_0x5b7d39,null))[_0x5bce('0x20')](respondWithResult(_0x5b7d39,null))[_0x5bce('0x4e')](handleError(_0x5b7d39,null));};exports[_0x5bce('0x53')]=function(_0x184da1,_0x5b1a58){return db[_0x5bce('0x4b')]['create'](_0x184da1['body'],{})[_0x5bce('0x20')](respondWithResult(_0x5b1a58,0xc9))[_0x5bce('0x4e')](handleError(_0x5b1a58,null));};exports[_0x5bce('0x54')]=function(_0x4b67a4,_0x522c7d){if(_0x4b67a4[_0x5bce('0x55')]['id']){delete _0x4b67a4[_0x5bce('0x55')]['id'];}return db[_0x5bce('0x4b')]['find']({'where':{'id':_0x4b67a4['params']['id']}})[_0x5bce('0x20')](handleEntityNotFound(_0x522c7d,null))['then'](saveUpdates(_0x4b67a4[_0x5bce('0x55')],null))[_0x5bce('0x20')](respondWithResult(_0x522c7d,null))[_0x5bce('0x4e')](handleError(_0x522c7d,null));};exports['destroy']=function(_0x52c94c,_0x533b23){return db['ChatMessage']['find']({'where':{'id':_0x52c94c['params']['id']}})[_0x5bce('0x20')](handleEntityNotFound(_0x533b23,null))[_0x5bce('0x20')](removeEntity(_0x533b23,null))[_0x5bce('0x4e')](handleError(_0x533b23,null));};exports['describe']=function(_0x34aa1a,_0x286262){return db[_0x5bce('0x4b')]['describe']()[_0x5bce('0x20')](respondWithResult(_0x286262,null))[_0x5bce('0x4e')](handleError(_0x286262,null));};var interaction_log=require(_0x5bce('0x56'))(_0x5bce('0x57'));exports[_0x5bce('0x58')]=function(_0x427a6a,_0x2fdba3,_0x9d3ee6){var _0x194465={'agent':{},'channel':_0x5bce('0x59')};if(_0x427a6a['body']['id']){delete _0x427a6a[_0x5bce('0x55')]['id'];}_0x427a6a['body'][_0x5bce('0x5a')]=!![];_0x427a6a[_0x5bce('0x55')][_0x5bce('0x5b')]=moment()['format'](_0x5bce('0x5c'));_0x427a6a[_0x5bce('0x55')]['UserId']=_0x427a6a[_0x5bce('0x55')][_0x5bce('0x5d')]||_0x427a6a['user']['id'];_0x194465[_0x5bce('0x5e')]['id']=_0x427a6a['body'][_0x5bce('0x5d')];return db['ChatMessage']['find']({'where':{'id':_0x427a6a[_0x5bce('0x50')]['id'],'UserId':null}})[_0x5bce('0x20')](handleEntityNotFound(_0x2fdba3,null))[_0x5bce('0x20')](saveUpdates(_0x427a6a[_0x5bce('0x55')],null))[_0x5bce('0x20')](function(_0xd64aa3){if(_0xd64aa3){_0x194465[_0x5bce('0x29')]=_0xd64aa3['get']({'plain':!![]});return db[_0x5bce('0x5f')][_0x5bce('0x60')]({'where':{'id':_0xd64aa3['ChatInteractionId']}});}return null;})[_0x5bce('0x20')](handleEntityNotFound(_0x2fdba3,null))['then'](function(_0x396160){if(_0x396160){return _0x396160['update']({'UserId':_0x427a6a[_0x5bce('0x55')][_0x5bce('0x5d')],'read1stAt':_['isNil'](_0x396160[_0x5bce('0x61')])?moment()[_0x5bce('0x62')](_0x5bce('0x5c')):undefined});}return null;})['then'](function(_0x3dd7a6){if(_0x3dd7a6){_0x194465[_0x5bce('0x63')]=_0x3dd7a6[_0x5bce('0x64')]({'plain':!![]});interaction_log[_0x5bce('0x21')](_0x5bce('0x65'),_0x427a6a[_0x5bce('0x66')]['id'],_0x427a6a[_0x5bce('0x66')]['name'],_0x427a6a[_0x5bce('0x66')]['role'],_0x194465[_0x5bce('0x63')]['id'],_0x427a6a[_0x5bce('0x55')]?JSON[_0x5bce('0x26')](_0x427a6a[_0x5bce('0x55')]):_0x5bce('0x67'));return respondWithRpcPromise(_0x5bce('0x68'),_0x5bce('0x69'),_0x194465);}return null;})['then'](function(_0x508ea8){var _0xb95d79=_0x5bce('0x6a')+_0x508ea8['message']['ContactId'];return db[_0x5bce('0x6b')][_0x5bce('0x3c')](_0xb95d79,{'type':db['Sequelize'][_0x5bce('0x6c')][_0x5bce('0x6d')],'raw':!![]})[_0x5bce('0x20')](function(_0x255d8b){return _0x255d8b;});})['then'](function(_0x3179a2){if(_0x3179a2){_0x194465[_0x5bce('0x29')][_0x5bce('0x6e')]=_0x3179a2[0x0];if(!_0x427a6a[_0x5bce('0x55')][_0x5bce('0x5d')])return;return db[_0x5bce('0x6f')]['find']({'where':{'id':_0x427a6a[_0x5bce('0x55')]['UserId'],'role':_0x5bce('0x5e')},'attributes':['id','name',_0x5bce('0x70'),_0x5bce('0x71'),_0x5bce('0x72')],'raw':!![]});}return null;})[_0x5bce('0x20')](function(_0x35abac){if(!_0x35abac)return null;_0x194465[_0x5bce('0x29')][_0x5bce('0x5e')]=_0x35abac;return _0x194465;})['then'](function(_0xeebf06){if(_0xeebf06){if(_0x427a6a[_0x5bce('0x55')][_0x5bce('0x73')]){_0x194465[_0x5bce('0x29')][_0x5bce('0x74')]=util[_0x5bce('0x62')](_0x5bce('0x75'),_0x427a6a[_0x5bce('0x66')][_0x5bce('0x35')]);_0x194465[_0x5bce('0x29')][_0x5bce('0x76')]=_0x194465[_0x5bce('0x76')];_0x194465[_0x5bce('0x29')][_0x5bce('0x77')]=_0x194465[_0x5bce('0x76')];_0x194465[_0x5bce('0x29')][_0x5bce('0x78')]=_0x5bce('0x58');return respondWithRpcPromise(_0x5bce('0x79'),'EventManager',{'event':_0x5bce('0x7a'),'message':_[_0x5bce('0x48')](_0x194465[_0x5bce('0x29')],JSON['parse'](_0x194465[_0x5bce('0x63')][_0x5bce('0x7b')]))},client9002)[_0x5bce('0x20')](function(){return _0x194465;});}return _0x194465;}return null;})['then'](respondWithResult(_0x2fdba3,null))[_0x5bce('0x4e')](handleError(_0x2fdba3,null));};var interaction_log=require(_0x5bce('0x56'))(_0x5bce('0x57'));exports[_0x5bce('0x7c')]=function(_0x37452e,_0x320f,_0x402aa1){var _0x267fae={'agent':{},'channel':'chat'};if(_0x37452e['body']['id']){delete _0x37452e[_0x5bce('0x55')]['id'];}_0x37452e[_0x5bce('0x55')][_0x5bce('0x5d')]=_0x37452e[_0x5bce('0x55')][_0x5bce('0x5d')]||_0x37452e[_0x5bce('0x66')]['id'];_0x267fae[_0x5bce('0x5e')]['id']=_0x37452e['body'][_0x5bce('0x5d')];return db[_0x5bce('0x4b')][_0x5bce('0x60')]({'where':{'id':_0x37452e['params']['id'],'UserId':null}})[_0x5bce('0x20')](handleEntityNotFound(_0x320f,null))[_0x5bce('0x20')](function(_0x4cd315){if(_0x4cd315){_0x267fae[_0x5bce('0x29')]=_0x4cd315['get']({'plain':!![]});return db['ChatInteraction'][_0x5bce('0x60')]({'where':{'id':_0x4cd315['ChatInteractionId']}});}return null;})[_0x5bce('0x20')](handleEntityNotFound(_0x320f,null))[_0x5bce('0x20')](function(_0x4cae06){if(_0x4cae06){_0x267fae[_0x5bce('0x63')]=_0x4cae06[_0x5bce('0x64')]({'plain':!![]});interaction_log[_0x5bce('0x21')](_0x5bce('0x7d'),_0x37452e['user']['id'],_0x37452e[_0x5bce('0x66')][_0x5bce('0x35')],_0x37452e[_0x5bce('0x66')][_0x5bce('0x7e')],_0x267fae['interaction']['id'],_0x37452e['body']?JSON[_0x5bce('0x26')](_0x37452e[_0x5bce('0x55')]):_0x5bce('0x67'));return respondWithRpcPromise(_0x5bce('0x7f'),'rejectMessage',_0x267fae);}return null;})[_0x5bce('0x20')](function(_0x5907c7){var _0x25c6f3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5907c7[_0x5bce('0x29')][_0x5bce('0x80')];return db[_0x5bce('0x6b')][_0x5bce('0x3c')](_0x25c6f3,{'type':db['Sequelize']['QueryTypes'][_0x5bce('0x6d')],'raw':!![]})[_0x5bce('0x20')](function(_0x4c6633){return _0x4c6633;});})[_0x5bce('0x20')](function(_0xae3b02){if(_0xae3b02){_0x267fae['message'][_0x5bce('0x6e')]=_0xae3b02[0x0];if(!_0x37452e[_0x5bce('0x55')][_0x5bce('0x5d')])return;return db[_0x5bce('0x6f')][_0x5bce('0x60')]({'where':{'id':_0x37452e['body'][_0x5bce('0x5d')],'role':_0x5bce('0x5e')},'attributes':['id',_0x5bce('0x35'),'fullname','email',_0x5bce('0x72')],'raw':!![]});}return null;})[_0x5bce('0x20')](function(_0x387803){if(!_0x387803)return null;_0x267fae[_0x5bce('0x29')][_0x5bce('0x5e')]=_0x387803;return _0x267fae;})[_0x5bce('0x20')](function(_0xabf14){if(_0xabf14){_0xabf14[_0x5bce('0x29')][_0x5bce('0x74')]=util[_0x5bce('0x62')]('SIP/%s',_0x37452e[_0x5bce('0x66')][_0x5bce('0x35')]);_0xabf14[_0x5bce('0x29')][_0x5bce('0x76')]=_0x267fae['channel'];_0xabf14['message']['motionChannel']=_0x267fae[_0x5bce('0x76')];_0xabf14['message']['event']=_0x5bce('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0x5bce('0x81'),'message':_[_0x5bce('0x48')](_0x267fae[_0x5bce('0x29')],JSON[_0x5bce('0x82')](_0x267fae[_0x5bce('0x63')]['formData']))},client9002);return _0x267fae;}return null;})[_0x5bce('0x20')](respondWithResult(_0x320f,null))[_0x5bce('0x4e')](handleError(_0x320f,null));}; \ No newline at end of file +var _0x4c48=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','interaction','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','motionChannel','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','end','name','send','index','ChatMessage','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','readAt','format'];(function(_0x570e0d,_0x21c326){var _0x2c6a7e=function(_0x34e8b5){while(--_0x34e8b5){_0x570e0d['push'](_0x570e0d['shift']());}};_0x2c6a7e(++_0x21c326);}(_0x4c48,0x1b5));var _0x84c4=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0x4c48[_0x4a7e98];return _0x27d10d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x84c4('0x0'));var jsonpatch=require(_0x84c4('0x1'));var rp=require(_0x84c4('0x2'));var moment=require(_0x84c4('0x3'));var BPromise=require(_0x84c4('0x4'));var Mustache=require(_0x84c4('0x5'));var util=require(_0x84c4('0x6'));var path=require(_0x84c4('0x7'));var sox=require('sox');var csv=require(_0x84c4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84c4('0x9'));var _=require(_0x84c4('0xa'));var squel=require(_0x84c4('0xb'));var crypto=require(_0x84c4('0xc'));var jsforce=require(_0x84c4('0xd'));var deskjs=require(_0x84c4('0xe'));var toCsv=require(_0x84c4('0x8'));var querystring=require(_0x84c4('0xf'));var Papa=require(_0x84c4('0x10'));var Redis=require(_0x84c4('0x11'));var authService=require(_0x84c4('0x12'));var qs=require(_0x84c4('0x13'));var as=require(_0x84c4('0x14'));var hardwareService=require(_0x84c4('0x15'));var logger=require(_0x84c4('0x16'))(_0x84c4('0x17'));var utils=require('../../config/utils');var config=require(_0x84c4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x84c4('0x19'))['db'];config[_0x84c4('0x1a')]=_[_0x84c4('0x1b')](config[_0x84c4('0x1a')],{'host':_0x84c4('0x1c'),'port':0x18eb});var socket=require(_0x84c4('0x1d'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x84c4('0x1e')](socket);var jayson=require(_0x84c4('0x1f'));var client=jayson[_0x84c4('0x20')][_0x84c4('0x21')]({'port':0x232c});var client9002=jayson[_0x84c4('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2abd63,_0x3c7a39,_0x56fb56,_0x3a936b){return new BPromise(function(_0x296b7f,_0x4ed0d2){var _0x5b1a51=_0x3a936b||client;return _0x5b1a51[_0x84c4('0x22')](_0x2abd63,_0x56fb56)[_0x84c4('0x23')](function(_0x3e6e5c){logger[_0x84c4('0x24')](_0x84c4('0x25'),_0x3c7a39,_0x84c4('0x26'));logger[_0x84c4('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3c7a39,'request\x20sent',JSON[_0x84c4('0x28')](_0x3e6e5c));if(_0x3e6e5c[_0x84c4('0x29')]){if(_0x3e6e5c[_0x84c4('0x29')][_0x84c4('0x2a')]===0x1f4){logger[_0x84c4('0x29')](_0x84c4('0x25'),_0x3c7a39,_0x3e6e5c[_0x84c4('0x29')][_0x84c4('0x2b')]);return _0x4ed0d2(_0x3e6e5c[_0x84c4('0x29')][_0x84c4('0x2b')]);}logger[_0x84c4('0x29')](_0x84c4('0x25'),_0x3c7a39,_0x3e6e5c[_0x84c4('0x29')][_0x84c4('0x2b')]);return _0x296b7f(_0x3e6e5c['error']['message']);}else{logger[_0x84c4('0x24')](_0x84c4('0x25'),_0x3c7a39,_0x84c4('0x26'));_0x296b7f(_0x3e6e5c[_0x84c4('0x2c')][_0x84c4('0x2b')]);}})[_0x84c4('0x2d')](function(_0x134355){logger['error'](_0x84c4('0x25'),_0x3c7a39,_0x134355);_0x4ed0d2(_0x134355);});});}function respondWithStatusCode(_0x30e978,_0x1d7e97){_0x1d7e97=_0x1d7e97||0xcc;return function(_0xe6cf71){if(_0xe6cf71){return _0x30e978[_0x84c4('0x2e')](_0x1d7e97);}return _0x30e978[_0x84c4('0x2f')](_0x1d7e97)['end']();};}function respondWithResult(_0x5a946b,_0x285e41){_0x285e41=_0x285e41||0xc8;return function(_0x4227b2){if(_0x4227b2){return _0x5a946b['status'](_0x285e41)['json'](_0x4227b2);}};}function respondWithFilteredResult(_0x1ad9a4,_0x3c06de){return function(_0x5c7eb5){if(_0x5c7eb5){var _0x41e864=typeof _0x3c06de[_0x84c4('0x30')]==='undefined'&&typeof _0x3c06de[_0x84c4('0x31')]===_0x84c4('0x32');var _0x32bbf2=_0x5c7eb5[_0x84c4('0x33')];var _0x37ef1c=_0x41e864?0x0:_0x3c06de[_0x84c4('0x30')];var _0x2c7438=_0x41e864?_0x5c7eb5[_0x84c4('0x33')]:_0x3c06de[_0x84c4('0x30')]+_0x3c06de['limit'];var _0x3bbd7a;if(_0x2c7438>=_0x32bbf2){_0x2c7438=_0x32bbf2;_0x3bbd7a=0xc8;}else{_0x3bbd7a=0xce;}_0x1ad9a4[_0x84c4('0x2f')](_0x3bbd7a);return _0x1ad9a4[_0x84c4('0x34')](_0x84c4('0x35'),_0x37ef1c+'-'+_0x2c7438+'/'+_0x32bbf2)['json'](_0x5c7eb5);}return null;};}function patchUpdates(_0x4015ed){return function(_0x3321cc){try{jsonpatch[_0x84c4('0x36')](_0x3321cc,_0x4015ed,!![]);}catch(_0x5d6991){return BPromise['reject'](_0x5d6991);}return _0x3321cc[_0x84c4('0x37')]();};}function saveUpdates(_0x4bcf6c,_0x2c7688){return function(_0x4196c8){if(_0x4196c8){return _0x4196c8[_0x84c4('0x38')](_0x4bcf6c)['then'](function(_0x21f224){return _0x21f224;});}return null;};}function removeEntity(_0x5adce3,_0x1f597b){return function(_0x4dceb5){if(_0x4dceb5){return _0x4dceb5[_0x84c4('0x39')]()[_0x84c4('0x23')](function(){_0x5adce3[_0x84c4('0x2f')](0xcc)[_0x84c4('0x3a')]();});}};}function handleEntityNotFound(_0x4ad6a4,_0x406f19){return function(_0x425cc9){if(!_0x425cc9){_0x4ad6a4[_0x84c4('0x2e')](0x194);}return _0x425cc9;};}function handleError(_0x4cc117,_0x343365){_0x343365=_0x343365||0x1f4;return function(_0x51b5b8){logger[_0x84c4('0x29')](_0x51b5b8['stack']);if(_0x51b5b8[_0x84c4('0x3b')]){delete _0x51b5b8[_0x84c4('0x3b')];}_0x4cc117[_0x84c4('0x2f')](_0x343365)[_0x84c4('0x3c')](_0x51b5b8);};}exports[_0x84c4('0x3d')]=function(_0x2dd169,_0x1b8d96){var _0x3f365b={},_0x2bdef7={},_0x5cabb7={'count':0x0,'rows':[]};var _0x19bdb9=_['map'](db[_0x84c4('0x3e')][_0x84c4('0x3f')],function(_0x3c411a){return{'name':_0x3c411a['fieldName'],'type':_0x3c411a[_0x84c4('0x40')][_0x84c4('0x41')]};});_0x2bdef7['model']=_['map'](_0x19bdb9,_0x84c4('0x3b'));_0x2bdef7[_0x84c4('0x42')]=_['keys'](_0x2dd169[_0x84c4('0x42')]);_0x2bdef7[_0x84c4('0x43')]=_[_0x84c4('0x44')](_0x2bdef7[_0x84c4('0x45')],_0x2bdef7[_0x84c4('0x42')]);_0x3f365b[_0x84c4('0x46')]=_[_0x84c4('0x44')](_0x2bdef7[_0x84c4('0x45')],qs[_0x84c4('0x47')](_0x2dd169[_0x84c4('0x42')][_0x84c4('0x47')]));_0x3f365b['attributes']=_0x3f365b[_0x84c4('0x46')][_0x84c4('0x48')]?_0x3f365b[_0x84c4('0x46')]:_0x2bdef7[_0x84c4('0x45')];if(!_0x2dd169[_0x84c4('0x42')][_0x84c4('0x49')]('nolimit')){_0x3f365b[_0x84c4('0x31')]=qs[_0x84c4('0x31')](_0x2dd169[_0x84c4('0x42')][_0x84c4('0x31')]);_0x3f365b[_0x84c4('0x30')]=qs['offset'](_0x2dd169[_0x84c4('0x42')][_0x84c4('0x30')]);}_0x3f365b[_0x84c4('0x4a')]=qs[_0x84c4('0x4b')](_0x2dd169[_0x84c4('0x42')][_0x84c4('0x4b')]);_0x3f365b['where']=qs[_0x84c4('0x43')](_[_0x84c4('0x4c')](_0x2dd169[_0x84c4('0x42')],_0x2bdef7[_0x84c4('0x43')]),_0x19bdb9);if(_0x2dd169[_0x84c4('0x42')][_0x84c4('0x4d')]){_0x3f365b[_0x84c4('0x4e')]=_[_0x84c4('0x4f')](_0x3f365b['where'],{'$or':_[_0x84c4('0x50')](_0x19bdb9,function(_0x4c8226){if(_0x4c8226[_0x84c4('0x40')]!==_0x84c4('0x51')){var _0x32f086={};_0x32f086[_0x4c8226['name']]={'$like':'%'+_0x2dd169[_0x84c4('0x42')][_0x84c4('0x4d')]+'%'};return _0x32f086;}})});}_0x3f365b=_[_0x84c4('0x4f')]({},_0x3f365b,_0x2dd169['options']);var _0x31c84e={'where':_0x3f365b[_0x84c4('0x4e')]};return db[_0x84c4('0x3e')]['count'](_0x31c84e)[_0x84c4('0x23')](function(_0x159249){_0x5cabb7[_0x84c4('0x33')]=_0x159249;if(_0x2dd169[_0x84c4('0x42')][_0x84c4('0x52')]){_0x3f365b[_0x84c4('0x53')]=[{'all':!![]}];}return db[_0x84c4('0x3e')][_0x84c4('0x54')](_0x3f365b);})[_0x84c4('0x23')](function(_0x31cc3f){_0x5cabb7[_0x84c4('0x55')]=_0x31cc3f;return _0x5cabb7;})[_0x84c4('0x23')](respondWithFilteredResult(_0x1b8d96,_0x3f365b))[_0x84c4('0x2d')](handleError(_0x1b8d96,null));};exports[_0x84c4('0x56')]=function(_0x1cdfa5,_0x5d8e28){var _0x5ae37e={'raw':!![],'where':{'id':_0x1cdfa5[_0x84c4('0x57')]['id']}},_0x5e3c0c={};_0x5e3c0c[_0x84c4('0x45')]=_['keys'](db[_0x84c4('0x3e')]['rawAttributes']);_0x5e3c0c[_0x84c4('0x42')]=_['keys'](_0x1cdfa5[_0x84c4('0x42')]);_0x5e3c0c[_0x84c4('0x43')]=_[_0x84c4('0x44')](_0x5e3c0c[_0x84c4('0x45')],_0x5e3c0c['query']);_0x5ae37e['attributes']=_[_0x84c4('0x44')](_0x5e3c0c[_0x84c4('0x45')],qs[_0x84c4('0x47')](_0x1cdfa5['query'][_0x84c4('0x47')]));_0x5ae37e['attributes']=_0x5ae37e[_0x84c4('0x46')][_0x84c4('0x48')]?_0x5ae37e[_0x84c4('0x46')]:_0x5e3c0c[_0x84c4('0x45')];if(_0x1cdfa5['query'][_0x84c4('0x52')]){_0x5ae37e[_0x84c4('0x53')]=[{'all':!![]}];}_0x5ae37e=_[_0x84c4('0x4f')]({},_0x5ae37e,_0x1cdfa5['options']);return db[_0x84c4('0x3e')][_0x84c4('0x58')](_0x5ae37e)['then'](handleEntityNotFound(_0x5d8e28,null))[_0x84c4('0x23')](respondWithResult(_0x5d8e28,null))[_0x84c4('0x2d')](handleError(_0x5d8e28,null));};exports[_0x84c4('0x59')]=function(_0x45be09,_0x49b90a){return db['ChatMessage'][_0x84c4('0x59')](_0x45be09['body'],{})['then'](respondWithResult(_0x49b90a,0xc9))[_0x84c4('0x2d')](handleError(_0x49b90a,null));};exports['update']=function(_0x1234b3,_0x290da3){if(_0x1234b3[_0x84c4('0x5a')]['id']){delete _0x1234b3['body']['id'];}return db[_0x84c4('0x3e')]['find']({'where':{'id':_0x1234b3[_0x84c4('0x57')]['id']}})['then'](handleEntityNotFound(_0x290da3,null))[_0x84c4('0x23')](saveUpdates(_0x1234b3['body'],null))['then'](respondWithResult(_0x290da3,null))[_0x84c4('0x2d')](handleError(_0x290da3,null));};exports[_0x84c4('0x39')]=function(_0x515fb7,_0x4a650e){return db[_0x84c4('0x3e')][_0x84c4('0x58')]({'where':{'id':_0x515fb7['params']['id']}})[_0x84c4('0x23')](handleEntityNotFound(_0x4a650e,null))['then'](removeEntity(_0x4a650e,null))[_0x84c4('0x2d')](handleError(_0x4a650e,null));};exports['describe']=function(_0x519de3,_0x25afb5){return db[_0x84c4('0x3e')][_0x84c4('0x5b')]()[_0x84c4('0x23')](respondWithResult(_0x25afb5,null))[_0x84c4('0x2d')](handleError(_0x25afb5,null));};var interaction_log=require(_0x84c4('0x16'))('chat-interactions');exports[_0x84c4('0x5c')]=function(_0x3fa5ef,_0x2cdb4c,_0x2ad96d){var _0x3697ef={'agent':{},'channel':'chat'};if(_0x3fa5ef['body']['id']){delete _0x3fa5ef[_0x84c4('0x5a')]['id'];}_0x3fa5ef[_0x84c4('0x5a')]['read']=!![];_0x3fa5ef[_0x84c4('0x5a')][_0x84c4('0x5d')]=moment()[_0x84c4('0x5e')](_0x84c4('0x5f'));_0x3fa5ef['body'][_0x84c4('0x60')]=_0x3fa5ef[_0x84c4('0x5a')][_0x84c4('0x60')]||_0x3fa5ef[_0x84c4('0x61')]['id'];_0x3697ef[_0x84c4('0x62')]['id']=_0x3fa5ef['body'][_0x84c4('0x60')];return db['ChatMessage'][_0x84c4('0x58')]({'where':{'id':_0x3fa5ef[_0x84c4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2cdb4c,null))[_0x84c4('0x23')](saveUpdates(_0x3fa5ef[_0x84c4('0x5a')],null))[_0x84c4('0x23')](function(_0x19e405){if(_0x19e405){_0x3697ef[_0x84c4('0x2b')]=_0x19e405[_0x84c4('0x63')]({'plain':!![]});return db[_0x84c4('0x64')]['find']({'where':{'id':_0x19e405[_0x84c4('0x65')]}});}return null;})[_0x84c4('0x23')](handleEntityNotFound(_0x2cdb4c,null))[_0x84c4('0x23')](function(_0x39cdf4){if(_0x39cdf4){return _0x39cdf4[_0x84c4('0x38')]({'UserId':_0x3fa5ef[_0x84c4('0x5a')][_0x84c4('0x60')],'read1stAt':_[_0x84c4('0x66')](_0x39cdf4[_0x84c4('0x67')])?moment()[_0x84c4('0x5e')](_0x84c4('0x5f')):undefined});}return null;})[_0x84c4('0x23')](function(_0x3c6d15){if(_0x3c6d15){_0x3697ef['interaction']=_0x3c6d15['get']({'plain':!![]});interaction_log[_0x84c4('0x24')](_0x84c4('0x68'),_0x3fa5ef['user']['id'],_0x3fa5ef[_0x84c4('0x61')][_0x84c4('0x3b')],_0x3fa5ef[_0x84c4('0x61')]['role'],_0x3697ef['interaction']['id'],_0x3fa5ef[_0x84c4('0x5a')]?JSON['stringify'](_0x3fa5ef[_0x84c4('0x5a')]):_0x84c4('0x69'));return respondWithRpcPromise(_0x84c4('0x6a'),_0x84c4('0x6b'),_0x3697ef);}return null;})[_0x84c4('0x23')](function(_0x21be94){var _0xd80483='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21be94[_0x84c4('0x2b')][_0x84c4('0x6c')];return db[_0x84c4('0x6d')][_0x84c4('0x42')](_0xd80483,{'type':db[_0x84c4('0x6e')][_0x84c4('0x6f')][_0x84c4('0x70')],'raw':!![]})[_0x84c4('0x23')](function(_0x280715){return _0x280715;});})[_0x84c4('0x23')](function(_0x54e0a6){if(_0x54e0a6){_0x3697ef[_0x84c4('0x2b')][_0x84c4('0x71')]=_0x54e0a6[0x0];if(!_0x3fa5ef[_0x84c4('0x5a')][_0x84c4('0x60')])return;return db[_0x84c4('0x72')]['find']({'where':{'id':_0x3fa5ef[_0x84c4('0x5a')][_0x84c4('0x60')],'role':_0x84c4('0x62')},'attributes':['id','name',_0x84c4('0x73'),_0x84c4('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x479486){if(!_0x479486)return null;_0x3697ef['message'][_0x84c4('0x62')]=_0x479486;return _0x3697ef;})[_0x84c4('0x23')](function(_0x1fea35){if(_0x1fea35){if(_0x3fa5ef['body']['manual']){_0x3697ef[_0x84c4('0x2b')][_0x84c4('0x75')]=util[_0x84c4('0x5e')](_0x84c4('0x76'),_0x3fa5ef[_0x84c4('0x61')][_0x84c4('0x3b')]);_0x3697ef[_0x84c4('0x2b')][_0x84c4('0x77')]=_0x3697ef[_0x84c4('0x77')];_0x3697ef['message']['motionChannel']=_0x3697ef[_0x84c4('0x77')];_0x3697ef[_0x84c4('0x2b')][_0x84c4('0x78')]=_0x84c4('0x5c');return respondWithRpcPromise(_0x84c4('0x79'),'EventManager',{'event':_0x84c4('0x7a'),'message':_['merge'](_0x3697ef[_0x84c4('0x2b')],JSON[_0x84c4('0x7b')](_0x3697ef[_0x84c4('0x7c')]['formData']))},client9002)[_0x84c4('0x23')](function(){return _0x3697ef;});}return _0x3697ef;}return null;})[_0x84c4('0x23')](respondWithResult(_0x2cdb4c,null))[_0x84c4('0x2d')](handleError(_0x2cdb4c,null));};var interaction_log=require(_0x84c4('0x16'))('chat-interactions');exports['reject']=function(_0x5bd179,_0x442dd4,_0x212e5c){var _0x2f8c74={'agent':{},'channel':_0x84c4('0x7d')};if(_0x5bd179['body']['id']){delete _0x5bd179[_0x84c4('0x5a')]['id'];}_0x5bd179[_0x84c4('0x5a')]['UserId']=_0x5bd179[_0x84c4('0x5a')][_0x84c4('0x60')]||_0x5bd179[_0x84c4('0x61')]['id'];_0x2f8c74[_0x84c4('0x62')]['id']=_0x5bd179['body'][_0x84c4('0x60')];return db[_0x84c4('0x3e')][_0x84c4('0x58')]({'where':{'id':_0x5bd179[_0x84c4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x442dd4,null))[_0x84c4('0x23')](function(_0x48a2b0){if(_0x48a2b0){_0x2f8c74[_0x84c4('0x2b')]=_0x48a2b0[_0x84c4('0x63')]({'plain':!![]});return db[_0x84c4('0x64')][_0x84c4('0x58')]({'where':{'id':_0x48a2b0[_0x84c4('0x65')]}});}return null;})[_0x84c4('0x23')](handleEntityNotFound(_0x442dd4,null))[_0x84c4('0x23')](function(_0x2ad022){if(_0x2ad022){_0x2f8c74[_0x84c4('0x7c')]=_0x2ad022[_0x84c4('0x63')]({'plain':!![]});interaction_log[_0x84c4('0x24')](_0x84c4('0x7e'),_0x5bd179[_0x84c4('0x61')]['id'],_0x5bd179['user'][_0x84c4('0x3b')],_0x5bd179[_0x84c4('0x61')][_0x84c4('0x7f')],_0x2f8c74['interaction']['id'],_0x5bd179['body']?JSON[_0x84c4('0x28')](_0x5bd179[_0x84c4('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x84c4('0x80'),_0x2f8c74);}return null;})[_0x84c4('0x23')](function(_0x464128){var _0xf1440d=_0x84c4('0x81')+_0x464128[_0x84c4('0x2b')][_0x84c4('0x6c')];return db[_0x84c4('0x6d')][_0x84c4('0x42')](_0xf1440d,{'type':db[_0x84c4('0x6e')][_0x84c4('0x6f')]['SELECT'],'raw':!![]})[_0x84c4('0x23')](function(_0x547b3e){return _0x547b3e;});})[_0x84c4('0x23')](function(_0x58aec5){if(_0x58aec5){_0x2f8c74[_0x84c4('0x2b')][_0x84c4('0x71')]=_0x58aec5[0x0];if(!_0x5bd179[_0x84c4('0x5a')][_0x84c4('0x60')])return;return db[_0x84c4('0x72')][_0x84c4('0x58')]({'where':{'id':_0x5bd179[_0x84c4('0x5a')][_0x84c4('0x60')],'role':_0x84c4('0x62')},'attributes':['id',_0x84c4('0x3b'),'fullname','email',_0x84c4('0x82')],'raw':!![]});}return null;})[_0x84c4('0x23')](function(_0x3814ed){if(!_0x3814ed)return null;_0x2f8c74[_0x84c4('0x2b')][_0x84c4('0x62')]=_0x3814ed;return _0x2f8c74;})[_0x84c4('0x23')](function(_0x38ab90){if(_0x38ab90){_0x38ab90[_0x84c4('0x2b')]['interface']=util[_0x84c4('0x5e')]('SIP/%s',_0x5bd179[_0x84c4('0x61')]['name']);_0x38ab90['message'][_0x84c4('0x77')]=_0x2f8c74['channel'];_0x38ab90[_0x84c4('0x2b')][_0x84c4('0x83')]=_0x2f8c74[_0x84c4('0x77')];_0x38ab90['message']['event']='reject';respondWithRpcPromise(_0x84c4('0x79'),_0x84c4('0x79'),{'event':_0x84c4('0x84'),'message':_[_0x84c4('0x4f')](_0x2f8c74[_0x84c4('0x2b')],JSON[_0x84c4('0x7b')](_0x2f8c74['interaction']['formData']))},client9002);return _0x2f8c74;}return null;})[_0x84c4('0x23')](respondWithResult(_0x442dd4,null))['catch'](handleError(_0x442dd4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0f6979e..e107347 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 _0x7efa=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1c20f0,_0x1f1600){var _0x3380b7=function(_0x56e3d6){while(--_0x56e3d6){_0x1c20f0['push'](_0x1c20f0['shift']());}};_0x3380b7(++_0x1f1600);}(_0x7efa,0x1a7));var _0xa7ef=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7efa[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0xa7ef('0x0'));var ChatMessage=require(_0xa7ef('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa7ef('0x2')](0x0);var events={'afterCreate':_0xa7ef('0x3'),'afterUpdate':_0xa7ef('0x4'),'afterDestroy':_0xa7ef('0x5')};function emitEvent(_0x441b7c){return function(_0x423f6b,_0x5c4954,_0x5d4267){ChatMessageEvents[_0xa7ef('0x6')](_0x441b7c+':'+_0x423f6b['id'],_0x423f6b);ChatMessageEvents[_0xa7ef('0x6')](_0x441b7c,_0x423f6b);_0x5d4267(null);};}for(var e in events){if(events[_0xa7ef('0x7')](e)){var event=events[e];ChatMessage[_0xa7ef('0x8')](e,emitEvent(event));}}module[_0xa7ef('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x31a0=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x553d36,_0x8d66de){var _0x1cc51d=function(_0x51ce77){while(--_0x51ce77){_0x553d36['push'](_0x553d36['shift']());}};_0x1cc51d(++_0x8d66de);}(_0x31a0,0x1b4));var _0x031a=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x31a0[_0x4dc7b9];return _0x3ab114;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x031a('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x031a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x031a('0x2'),'afterDestroy':_0x031a('0x3')};function emitEvent(_0x4ce8c9){return function(_0x1a8877,_0x3bb2a1,_0x2ca1af){ChatMessageEvents[_0x031a('0x4')](_0x4ce8c9+':'+_0x1a8877['id'],_0x1a8877);ChatMessageEvents[_0x031a('0x4')](_0x4ce8c9,_0x1a8877);_0x2ca1af(null);};}for(var e in events){if(events[_0x031a('0x5')](e)){var event=events[e];ChatMessage[_0x031a('0x6')](e,emitEvent(event));}}module[_0x031a('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f1702fb..dc3e94d 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 _0x27bf=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','direction','out','secret','isNil','UserId','findOne','ChatInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x458fc8,_0x185f79){var _0x4c66bd=function(_0x5a3d5d){while(--_0x5a3d5d){_0x458fc8['push'](_0x458fc8['shift']());}};_0x4c66bd(++_0x185f79);}(_0x27bf,0x117));var _0xf27b=function(_0x3b2976,_0x5bd2d3){_0x3b2976=_0x3b2976-0x0;var _0x17b743=_0x27bf[_0x3b2976];return _0x17b743;};'use strict';var _=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var logger=require(_0xf27b('0x2'))(_0xf27b('0x3'));var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var rp=require(_0xf27b('0x6'));var fs=require('fs');var path=require(_0xf27b('0x7'));var rimraf=require(_0xf27b('0x8'));var config=require(_0xf27b('0x9'));var attributes=require(_0xf27b('0xa'));module['exports']=function(_0x1a18b4,_0x39bf1b){return _0x1a18b4[_0xf27b('0xb')](_0xf27b('0xc'),attributes,{'tableName':_0xf27b('0xd'),'paranoid':![],'indexes':[{'name':_0xf27b('0xe'),'fields':['body'],'type':_0xf27b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9ca64e,_0x969a6f,_0x122944){var _0x3ff5e4=_0x1a18b4[_0xf27b('0x10')];var _0x28fc32=_0x9ca64e['get']({'plain':!![]});if(_0x28fc32['direction']['toLowerCase']()==='in'||_0x28fc32[_0xf27b('0x11')]['toLowerCase']()===_0xf27b('0x12')&&!_0x28fc32[_0xf27b('0x13')]&&!_[_0xf27b('0x14')](_0x28fc32[_0xf27b('0x15')])){_0x3ff5e4['ChatInteraction'][_0xf27b('0x16')]({'where':{'id':_0x28fc32[_0xf27b('0x17')]}})[_0xf27b('0x18')](function(_0x32e55f){if(_0x32e55f){_0x32e55f['update']({'lastMsgAt':_0x28fc32[_0xf27b('0x19')],'lastMsgDirection':_0x28fc32[_0xf27b('0x11')]['toLowerCase']()});}})['catch'](function(_0x1400ce){console['error'](_0x1400ce);});}_0x122944();}},'charset':_0xf27b('0x1a'),'collate':_0xf27b('0x1b')});}; \ No newline at end of file +var _0x58fa=['bluebird','request-promise','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','error','lodash','../../config/logger','api','moment'];(function(_0x4cfc78,_0x45ece1){var _0x4acc35=function(_0x2f910c){while(--_0x2f910c){_0x4cfc78['push'](_0x4cfc78['shift']());}};_0x4acc35(++_0x45ece1);}(_0x58fa,0x134));var _0xa58f=function(_0x3dca99,_0x4d4d95){_0x3dca99=_0x3dca99-0x0;var _0x440108=_0x58fa[_0x3dca99];return _0x440108;};'use strict';var _=require(_0xa58f('0x0'));var util=require('util');var logger=require(_0xa58f('0x1'))(_0xa58f('0x2'));var moment=require(_0xa58f('0x3'));var BPromise=require(_0xa58f('0x4'));var rp=require(_0xa58f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa58f('0x6'));module[_0xa58f('0x7')]=function(_0x4d9ca6,_0xfaf56){return _0x4d9ca6[_0xa58f('0x8')](_0xa58f('0x9'),attributes,{'tableName':_0xa58f('0xa'),'paranoid':![],'indexes':[{'name':_0xa58f('0xb'),'fields':[_0xa58f('0xc')],'type':_0xa58f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55e91a,_0x113f7a,_0x2051c7){var _0x221935=_0x4d9ca6[_0xa58f('0xe')];var _0x41d60e=_0x55e91a[_0xa58f('0xf')]({'plain':!![]});if(_0x41d60e[_0xa58f('0x10')][_0xa58f('0x11')]()==='in'||_0x41d60e[_0xa58f('0x10')][_0xa58f('0x11')]()==='out'&&!_0x41d60e[_0xa58f('0x12')]&&!_[_0xa58f('0x13')](_0x41d60e[_0xa58f('0x14')])){_0x221935[_0xa58f('0x15')][_0xa58f('0x16')]({'where':{'id':_0x41d60e[_0xa58f('0x17')]}})[_0xa58f('0x18')](function(_0x5a9743){if(_0x5a9743){_0x5a9743['update']({'lastMsgAt':_0x41d60e['createdAt'],'lastMsgDirection':_0x41d60e['direction'][_0xa58f('0x11')]()});}})['catch'](function(_0x5576df){console[_0xa58f('0x19')](_0x5576df);});}_0x2051c7();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ab94db6..a467f35 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 _0xd068=['message','info','catch','CreateChatMessage','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0xd068,0xce));var _0x8d06=function(_0x46c5e1,_0x32d719){_0x46c5e1=_0x46c5e1-0x0;var _0x14af5a=_0xd068[_0x46c5e1];return _0x14af5a;};'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});config[_0x8d06('0xe')]=_[_0x8d06('0xf')](config[_0x8d06('0xe')],{'host':_0x8d06('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d06('0xe')]));require('./chatMessage.socket')[_0x8d06('0x11')](socket);function respondWithRpcPromise(_0x1a6e88,_0x4e9acc,_0x2d3935){return new BPromise(function(_0x5afdc9,_0x44b6f5){return client[_0x8d06('0x12')](_0x1a6e88,_0x2d3935)['then'](function(_0x4e819a){logger['info'](_0x8d06('0x13'),_0x4e9acc,_0x8d06('0x14'));logger[_0x8d06('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4e9acc,_0x8d06('0x14'),JSON[_0x8d06('0x16')](_0x4e819a));if(_0x4e819a[_0x8d06('0x17')]){if(_0x4e819a[_0x8d06('0x17')][_0x8d06('0x18')]===0x1f4){logger[_0x8d06('0x17')](_0x8d06('0x13'),_0x4e9acc,_0x4e819a['error']['message']);return _0x44b6f5(_0x4e819a[_0x8d06('0x17')][_0x8d06('0x19')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x4e9acc,_0x4e819a[_0x8d06('0x17')][_0x8d06('0x19')]);return _0x5afdc9(_0x4e819a['error'][_0x8d06('0x19')]);}else{logger[_0x8d06('0x1a')](_0x8d06('0x13'),_0x4e9acc,_0x8d06('0x14'));_0x5afdc9(_0x4e819a['result'][_0x8d06('0x19')]);}})[_0x8d06('0x1b')](function(_0x8b9b52){logger[_0x8d06('0x17')](_0x8d06('0x13'),_0x4e9acc,_0x8b9b52);_0x44b6f5(_0x8b9b52);});});}exports[_0x8d06('0x1c')]=function(_0x26d1bf){var _0xd09a54=this;return new Promise(function(_0x2bd6d5,_0x578016){return db['ChatMessage']['create'](_0x26d1bf[_0x8d06('0x1d')],{'raw':_0x26d1bf[_0x8d06('0x1e')]?_0x26d1bf['options'][_0x8d06('0x1f')]===undefined?!![]:![]:!![]})[_0x8d06('0x20')](function(_0x53bc85){logger[_0x8d06('0x1a')]('CreateChatMessage',_0x26d1bf);logger[_0x8d06('0x15')]('CreateChatMessage',_0x26d1bf,JSON[_0x8d06('0x16')](_0x53bc85));_0x2bd6d5(_0x53bc85);})[_0x8d06('0x1b')](function(_0x3986c4){logger['error'](_0x8d06('0x1c'),_0x3986c4['message'],_0x26d1bf);_0x578016(_0xd09a54['error'](0x1f4,_0x3986c4[_0x8d06('0x19')]));});});}; \ No newline at end of file +var _0x2e0c=['ChatMessage','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x2e0c,0x1bf));var _0xc2e0=function(_0x5e4241,_0x4b437f){_0x5e4241=_0x5e4241-0x0;var _0x583197=_0x2e0c[_0x5e4241];return _0x583197;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2e0('0x0'));var BPromise=require(_0xc2e0('0x1'));var rs=require(_0xc2e0('0x2'));var fs=require('fs');var Redis=require(_0xc2e0('0x3'));var db=require(_0xc2e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc2e0('0x5'));var config=require(_0xc2e0('0x6'));var jayson=require(_0xc2e0('0x7'));var client=jayson[_0xc2e0('0x8')][_0xc2e0('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc2e0('0xa')],{'host':_0xc2e0('0xb'),'port':0x18eb});var socket=require(_0xc2e0('0xc'))(new Redis(config[_0xc2e0('0xa')]));require(_0xc2e0('0xd'))[_0xc2e0('0xe')](socket);function respondWithRpcPromise(_0x599ee3,_0x2e3115,_0x21b2ba){return new BPromise(function(_0x1f16b4,_0x1e2496){return client[_0xc2e0('0xf')](_0x599ee3,_0x21b2ba)[_0xc2e0('0x10')](function(_0x595f3e){logger[_0xc2e0('0x11')](_0xc2e0('0x12'),_0x2e3115,'request\x20sent');logger[_0xc2e0('0x13')](_0xc2e0('0x14'),_0x2e3115,_0xc2e0('0x15'),JSON[_0xc2e0('0x16')](_0x595f3e));if(_0x595f3e[_0xc2e0('0x17')]){if(_0x595f3e[_0xc2e0('0x17')][_0xc2e0('0x18')]===0x1f4){logger['error'](_0xc2e0('0x12'),_0x2e3115,_0x595f3e[_0xc2e0('0x17')][_0xc2e0('0x19')]);return _0x1e2496(_0x595f3e[_0xc2e0('0x17')][_0xc2e0('0x19')]);}logger[_0xc2e0('0x17')](_0xc2e0('0x12'),_0x2e3115,_0x595f3e['error'][_0xc2e0('0x19')]);return _0x1f16b4(_0x595f3e[_0xc2e0('0x17')][_0xc2e0('0x19')]);}else{logger[_0xc2e0('0x11')](_0xc2e0('0x12'),_0x2e3115,'request\x20sent');_0x1f16b4(_0x595f3e[_0xc2e0('0x1a')][_0xc2e0('0x19')]);}})[_0xc2e0('0x1b')](function(_0x49d740){logger[_0xc2e0('0x17')](_0xc2e0('0x12'),_0x2e3115,_0x49d740);_0x1e2496(_0x49d740);});});}exports[_0xc2e0('0x1c')]=function(_0x59c1bc){var _0x349e96=this;return new Promise(function(_0x15ef93,_0x27bf70){return db[_0xc2e0('0x1d')][_0xc2e0('0x1e')](_0x59c1bc[_0xc2e0('0x1f')],{'raw':_0x59c1bc[_0xc2e0('0x20')]?_0x59c1bc[_0xc2e0('0x20')][_0xc2e0('0x21')]===undefined?!![]:![]:!![]})[_0xc2e0('0x10')](function(_0x1f21de){logger[_0xc2e0('0x11')](_0xc2e0('0x1c'),_0x59c1bc);logger[_0xc2e0('0x13')](_0xc2e0('0x1c'),_0x59c1bc,JSON['stringify'](_0x1f21de));_0x15ef93(_0x1f21de);})['catch'](function(_0x54433d){logger[_0xc2e0('0x17')](_0xc2e0('0x1c'),_0x54433d['message'],_0x59c1bc);_0x27bf70(_0x349e96['error'](0x1f4,_0x54433d[_0xc2e0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 3f90a62..6573799 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 _0x818f=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x99d550,_0x3b7e84){var _0x557cc4=function(_0x45ff31){while(--_0x45ff31){_0x99d550['push'](_0x99d550['shift']());}};_0x557cc4(++_0x3b7e84);}(_0x818f,0x1da));var _0xf818=function(_0x560901,_0x5cf280){_0x560901=_0x560901-0x0;var _0x19b9a1=_0x818f[_0x560901];return _0x19b9a1;};'use strict';var ChatMessageEvents=require(_0xf818('0x0'));var events=[_0xf818('0x1'),_0xf818('0x2'),_0xf818('0x3')];function createListener(_0x121db7,_0x39b430){return function(_0x58f142){_0x39b430[_0xf818('0x4')](_0x121db7,_0x58f142);};}function removeListener(_0xd6c86,_0x2c1bb0){return function(){ChatMessageEvents[_0xf818('0x5')](_0xd6c86,_0x2c1bb0);};}exports[_0xf818('0x6')]=function(_0x41310f){for(var _0x27119b=0x0,_0x42a23e=events[_0xf818('0x7')];_0x27119b<_0x42a23e;_0x27119b++){var _0x55540d=events[_0x27119b];var _0x1dbfc8=createListener(_0xf818('0x8')+_0x55540d,_0x41310f);ChatMessageEvents['on'](_0x55540d,_0x1dbfc8);}}; \ No newline at end of file +var _0x85d0=['emit','register','length','chatMessage:'];(function(_0x16d058,_0x4e3030){var _0x159c45=function(_0x51cc8d){while(--_0x51cc8d){_0x16d058['push'](_0x16d058['shift']());}};_0x159c45(++_0x4e3030);}(_0x85d0,0x164));var _0x085d=function(_0x19ba8a,_0x29b432){_0x19ba8a=_0x19ba8a-0x0;var _0x2f5ff8=_0x85d0[_0x19ba8a];return _0x2f5ff8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){ChatMessageEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);ChatMessageEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fc9a446..ea2262e 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 _0x290f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','tracked','chat','chatmessage:create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x1c2ab8,_0x575359){var _0x2f683f=function(_0x1842b9){while(--_0x1842b9){_0x1c2ab8['push'](_0x1c2ab8['shift']());}};_0x2f683f(++_0x575359);}(_0x290f,0x1ae));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf290('0x0'));var util=require(_0xf290('0x1'));var path=require(_0xf290('0x2'));var timeout=require(_0xf290('0x3'));var express=require(_0xf290('0x4'));var router=express['Router']();var fs_extra=require(_0xf290('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf290('0x6'));var controller=require('./chatMessage.controller');router[_0xf290('0x7')]('/',auth[_0xf290('0x8')](),controller['index']);router['get'](_0xf290('0x9'),auth[_0xf290('0x8')](),controller['describe']);router[_0xf290('0x7')](_0xf290('0xa'),auth[_0xf290('0x8')](),controller[_0xf290('0xb')]);router[_0xf290('0xc')]('/',auth[_0xf290('0x8')](),interaction[_0xf290('0xd')](_0xf290('0xe'),_0xf290('0xf')),controller['create']);router[_0xf290('0x10')](_0xf290('0xa'),controller['update']);router['put'](_0xf290('0x11'),auth['isAuthenticated'](),controller[_0xf290('0x12')]);router['put'](_0xf290('0x13'),auth['isAuthenticated'](),controller[_0xf290('0x14')]);router[_0xf290('0x15')](_0xf290('0xa'),auth[_0xf290('0x8')](),controller[_0xf290('0x16')]);module[_0xf290('0x17')]=router; \ No newline at end of file +var _0x392a=['/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','tracked','chat','chatmessage:create','create','update','accept','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x392a,0x1b4));var _0xa392=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x392a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa392('0x0'));var util=require('util');var path=require(_0xa392('0x1'));var timeout=require(_0xa392('0x2'));var express=require(_0xa392('0x3'));var router=express[_0xa392('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa392('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa392('0x6'));router[_0xa392('0x7')]('/',auth[_0xa392('0x8')](),controller[_0xa392('0x9')]);router[_0xa392('0x7')](_0xa392('0xa'),auth[_0xa392('0x8')](),controller[_0xa392('0xb')]);router['get'](_0xa392('0xc'),auth[_0xa392('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xa392('0xd')](_0xa392('0xe'),_0xa392('0xf')),controller[_0xa392('0x10')]);router['put']('/:id',controller[_0xa392('0x11')]);router['put']('/:id/accept',auth[_0xa392('0x8')](),controller[_0xa392('0x12')]);router[_0xa392('0x13')](_0xa392('0x14'),auth[_0xa392('0x8')](),controller[_0xa392('0x15')]);router[_0xa392('0x16')](_0xa392('0xc'),auth[_0xa392('0x8')](),controller['destroy']);module[_0xa392('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d8b166d..5cf15cc 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(_0xc624,_0x2ff6f5){var _0x12831e=function(_0x2e59a3){while(--_0x2e59a3){_0xc624['push'](_0xc624['shift']());}};_0x12831e(++_0x2ff6f5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'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(_0x32ff69,_0x319391){var _0x223947=function(_0x44f855){while(--_0x44f855){_0x32ff69['push'](_0x32ff69['shift']());}};_0x223947(++_0x319391);}(_0xb10b,0x12a));var _0xbb10=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xb10b[_0x836465];return _0x2150ea;};'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 fbadbc3..dbfec0a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x7db371,_0x474c27){var _0x1ea571=function(_0x497f88){while(--_0x497f88){_0x7db371['push'](_0x7db371['shift']());}};_0x1ea571(++_0x474c27);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7a54,0x106));var _0x47a5=function(_0x54a3d9,_0x351d15){_0x54a3d9=_0x54a3d9-0x0;var _0x7564e8=_0x7a54[_0x54a3d9];return _0x7564e8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5bd986d..53a4d31 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 _0x779f=['../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x39f097,_0x17116b){var _0x544f6a=function(_0x457caf){while(--_0x457caf){_0x39f097['push'](_0x39f097['shift']());}};_0x544f6a(++_0x17116b);}(_0x779f,0x9a));var _0xf779=function(_0x42c8b2,_0x28285){_0x42c8b2=_0x42c8b2-0x0;var _0x215db7=_0x779f[_0x42c8b2];return _0x215db7;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xf779('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf779('0x1'),'afterUpdate':_0xf779('0x2'),'afterDestroy':_0xf779('0x3')};function emitEvent(_0x24f9a2){return function(_0x5b3456,_0x54cb9f,_0x28a9ba){ChatOfflineMessageEvents['emit'](_0x24f9a2+':'+_0x5b3456['id'],_0x5b3456);ChatOfflineMessageEvents[_0xf779('0x4')](_0x24f9a2,_0x5b3456);_0x28a9ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xf779('0x5')](e,emitEvent(event));}}module[_0xf779('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x83b9=['../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x23533c,_0x3cb682){var _0x583254=function(_0x2d7dc9){while(--_0x2d7dc9){_0x23533c['push'](_0x23533c['shift']());}};_0x583254(++_0x3cb682);}(_0x83b9,0x155));var _0x983b=function(_0xc5d9de,_0x151b03){_0xc5d9de=_0xc5d9de-0x0;var _0x49b41d=_0x83b9[_0xc5d9de];return _0x49b41d;};'use strict';var EventEmitter=require(_0x983b('0x0'));var ChatOfflineMessage=require(_0x983b('0x1'))['db'][_0x983b('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x983b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x983b('0x4'),'afterDestroy':_0x983b('0x5')};function emitEvent(_0x5dbe97){return function(_0x576883,_0x431c1c,_0x2d164e){ChatOfflineMessageEvents[_0x983b('0x6')](_0x5dbe97+':'+_0x576883['id'],_0x576883);ChatOfflineMessageEvents[_0x983b('0x6')](_0x5dbe97,_0x576883);_0x2d164e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x983b('0x7')](e,emitEvent(event));}}module[_0x983b('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e6dc294..d5fa9a5 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 _0x962c=['utf8mb4_unicode_ci','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x3fba72,_0x32f320){var _0x46b50f=function(_0x12e71b){while(--_0x12e71b){_0x3fba72['push'](_0x3fba72['shift']());}};_0x46b50f(++_0x32f320);}(_0x962c,0xa3));var _0xc962=function(_0x42db57,_0x36b686){_0x42db57=_0x42db57-0x0;var _0x48cf4f=_0x962c[_0x42db57];return _0x48cf4f;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xc962('0x0')]=function(_0x58ba60){return _0x58ba60[_0xc962('0x1')](_0xc962('0x2'),attributes,{'tableName':_0xc962('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc962('0x4'),'collate':_0xc962('0x5')});}; \ No newline at end of file +var _0x24ce=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','define'];(function(_0x1f88f0,_0x2dc0ac){var _0x3684f5=function(_0x2f5efd){while(--_0x2f5efd){_0x1f88f0['push'](_0x1f88f0['shift']());}};_0x3684f5(++_0x2dc0ac);}(_0x24ce,0x8b));var _0xe24c=function(_0x36e939,_0x299038){_0x36e939=_0x36e939-0x0;var _0xe60148=_0x24ce[_0x36e939];return _0xe60148;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x21eaaa){return _0x21eaaa[_0xe24c('0x0')]('ChatOfflineMessage',attributes,{'tableName':_0xe24c('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe24c('0x2'),'collate':_0xe24c('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5acead1..5c60b43 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 _0x73a9=['then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x18920a,_0x5c7896){var _0x5b48a2=function(_0x6e0bf5){while(--_0x6e0bf5){_0x18920a['push'](_0x18920a['shift']());}};_0x5b48a2(++_0x5c7896);}(_0x73a9,0xda));var _0x973a=function(_0x2207f4,_0x465326){_0x2207f4=_0x2207f4-0x0;var _0x19969f=_0x73a9[_0x2207f4];return _0x19969f;};'use strict';var _=require('lodash');var util=require(_0x973a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x973a('0x1'));var fs=require('fs');var Redis=require(_0x973a('0x2'));var db=require(_0x973a('0x3'))['db'];var utils=require(_0x973a('0x4'));var logger=require(_0x973a('0x5'))(_0x973a('0x6'));var config=require(_0x973a('0x7'));var jayson=require(_0x973a('0x8'));var client=jayson[_0x973a('0x9')][_0x973a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5afbf8,_0x13b27c,_0x579ea6){return new BPromise(function(_0x28a1d0,_0x21cf5a){return client[_0x973a('0xb')](_0x5afbf8,_0x579ea6)[_0x973a('0xc')](function(_0xb37905){logger['info'](_0x973a('0xd'),_0x13b27c,_0x973a('0xe'));logger[_0x973a('0xf')](_0x973a('0x10'),_0x13b27c,'request\x20sent',JSON[_0x973a('0x11')](_0xb37905));if(_0xb37905[_0x973a('0x12')]){if(_0xb37905[_0x973a('0x12')]['code']===0x1f4){logger['error'](_0x973a('0xd'),_0x13b27c,_0xb37905[_0x973a('0x12')][_0x973a('0x13')]);return _0x21cf5a(_0xb37905['error'][_0x973a('0x13')]);}logger[_0x973a('0x12')](_0x973a('0xd'),_0x13b27c,_0xb37905[_0x973a('0x12')][_0x973a('0x13')]);return _0x28a1d0(_0xb37905[_0x973a('0x12')]['message']);}else{logger[_0x973a('0x14')](_0x973a('0xd'),_0x13b27c,_0x973a('0xe'));_0x28a1d0(_0xb37905[_0x973a('0x15')][_0x973a('0x13')]);}})[_0x973a('0x16')](function(_0x5c9046){logger[_0x973a('0x12')](_0x973a('0xd'),_0x13b27c,_0x5c9046);_0x21cf5a(_0x5c9046);});});} \ No newline at end of file +var _0x7ca8=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x5b30ae,_0x2eecd9){var _0x27fe=function(_0x3c6d21){while(--_0x3c6d21){_0x5b30ae['push'](_0x5b30ae['shift']());}};_0x27fe(++_0x2eecd9);}(_0x7ca8,0xf5));var _0x87ca=function(_0x474018,_0x3e1fda){_0x474018=_0x474018-0x0;var _0x4a03d5=_0x7ca8[_0x474018];return _0x4a03d5;};'use strict';var _=require('lodash');var util=require(_0x87ca('0x0'));var moment=require(_0x87ca('0x1'));var BPromise=require(_0x87ca('0x2'));var rs=require(_0x87ca('0x3'));var fs=require('fs');var Redis=require(_0x87ca('0x4'));var db=require(_0x87ca('0x5'))['db'];var utils=require(_0x87ca('0x6'));var logger=require(_0x87ca('0x7'))(_0x87ca('0x8'));var config=require(_0x87ca('0x9'));var jayson=require(_0x87ca('0xa'));var client=jayson[_0x87ca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ce850,_0x1c5ca3,_0x12b73f){return new BPromise(function(_0x10323f,_0x444f47){return client[_0x87ca('0xc')](_0x4ce850,_0x12b73f)[_0x87ca('0xd')](function(_0x4953ff){logger[_0x87ca('0xe')](_0x87ca('0xf'),_0x1c5ca3,'request\x20sent');logger[_0x87ca('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1c5ca3,_0x87ca('0x11'),JSON['stringify'](_0x4953ff));if(_0x4953ff[_0x87ca('0x12')]){if(_0x4953ff[_0x87ca('0x12')][_0x87ca('0x13')]===0x1f4){logger[_0x87ca('0x12')](_0x87ca('0xf'),_0x1c5ca3,_0x4953ff[_0x87ca('0x12')][_0x87ca('0x14')]);return _0x444f47(_0x4953ff[_0x87ca('0x12')][_0x87ca('0x14')]);}logger['error'](_0x87ca('0xf'),_0x1c5ca3,_0x4953ff['error'][_0x87ca('0x14')]);return _0x10323f(_0x4953ff[_0x87ca('0x12')][_0x87ca('0x14')]);}else{logger[_0x87ca('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1c5ca3,_0x87ca('0x11'));_0x10323f(_0x4953ff['result'][_0x87ca('0x14')]);}})[_0x87ca('0x15')](function(_0xd8d74b){logger[_0x87ca('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1c5ca3,_0xd8d74b);_0x444f47(_0xd8d74b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e5abcb2..d5f1383 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 _0x423e=['express','Router','fs-extra','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x423e,0x188));var _0xe423=function(_0x8299df,_0x2887e1){_0x8299df=_0x8299df-0x0;var _0x4a707f=_0x423e[_0x8299df];return _0x4a707f;};'use strict';var multer=require(_0xe423('0x0'));var util=require(_0xe423('0x1'));var path=require(_0xe423('0x2'));var timeout=require(_0xe423('0x3'));var express=require(_0xe423('0x4'));var router=express[_0xe423('0x5')]();var fs_extra=require(_0xe423('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe423('0x7'));router['get']('/',auth[_0xe423('0x8')](),controller['index']);router[_0xe423('0x9')](_0xe423('0xa'),auth['isAuthenticated'](),controller[_0xe423('0xb')]);router[_0xe423('0x9')](_0xe423('0xc'),auth[_0xe423('0x8')](),controller[_0xe423('0xd')]);router['post']('/',auth[_0xe423('0x8')](),controller[_0xe423('0xe')]);router[_0xe423('0xf')](_0xe423('0xc'),auth[_0xe423('0x8')](),controller[_0xe423('0x10')]);router[_0xe423('0x11')]('/:id',auth[_0xe423('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf380=['/describe','describe','/:id','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x28fe98,_0x36592a){var _0x3b482d=function(_0x30405c){while(--_0x30405c){_0x28fe98['push'](_0x28fe98['shift']());}};_0x3b482d(++_0x36592a);}(_0xf380,0x1ac));var _0x0f38=function(_0x367b02,_0x163098){_0x367b02=_0x367b02-0x0;var _0x9bb382=_0xf380[_0x367b02];return _0x9bb382;};'use strict';var multer=require(_0x0f38('0x0'));var util=require(_0x0f38('0x1'));var path=require('path');var timeout=require(_0x0f38('0x2'));var express=require(_0x0f38('0x3'));var router=express[_0x0f38('0x4')]();var fs_extra=require(_0x0f38('0x5'));var auth=require(_0x0f38('0x6'));var interaction=require(_0x0f38('0x7'));var config=require(_0x0f38('0x8'));var controller=require(_0x0f38('0x9'));router[_0x0f38('0xa')]('/',auth[_0x0f38('0xb')](),controller['index']);router[_0x0f38('0xa')](_0x0f38('0xc'),auth[_0x0f38('0xb')](),controller[_0x0f38('0xd')]);router[_0x0f38('0xa')](_0x0f38('0xe'),auth[_0x0f38('0xb')](),controller['show']);router['post']('/',auth[_0x0f38('0xb')](),controller[_0x0f38('0xf')]);router['put'](_0x0f38('0xe'),auth[_0x0f38('0xb')](),controller[_0x0f38('0x10')]);router[_0x0f38('0x11')](_0x0f38('0xe'),auth['isAuthenticated'](),controller[_0x0f38('0x12')]);module[_0x0f38('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 57f2434..f3e0947 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 _0x8135=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8135,0x8d));var _0x5813=function(_0x5a00fa,_0x426a92){_0x5a00fa=_0x5a00fa-0x0;var _0x1f6acb=_0x8135[_0x5a00fa];return _0x1f6acb;};'use strict';var Sequelize=require(_0x5813('0x0'));module[_0x5813('0x1')]={'name':{'type':Sequelize[_0x5813('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5813('0x3')]('mouseOver','timeout'),'defaultValue':_0x5813('0x4')},'selector':{'type':Sequelize[_0x5813('0x2')]},'timeout':{'type':Sequelize[_0x5813('0x5')]}}; \ No newline at end of file +var _0x9870=['ENUM','mouseOver','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x54d826,_0x48a629){var _0x4305b9=function(_0x2da18a){while(--_0x2da18a){_0x54d826['push'](_0x54d826['shift']());}};_0x4305b9(++_0x48a629);}(_0x9870,0x17f));var _0x0987=function(_0x5e5443,_0x2dad79){_0x5e5443=_0x5e5443-0x0;var _0x32bd1d=_0x9870[_0x5e5443];return _0x32bd1d;};'use strict';var Sequelize=require(_0x0987('0x0'));module[_0x0987('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0987('0x2')](_0x0987('0x3'),_0x0987('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0987('0x5')]},'timeout':{'type':Sequelize[_0x0987('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 29cc4fd..b4f4770 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 _0xf3cc=['model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','params'];(function(_0x1e3e02,_0x4f78db){var _0x57291a=function(_0x4bf784){while(--_0x4bf784){_0x1e3e02['push'](_0x1e3e02['shift']());}};_0x57291a(++_0x4f78db);}(_0xf3cc,0x10d));var _0xcf3c=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0xf3cc[_0xf0f7ba];return _0x44382c;};'use strict';var emlformat=require(_0xcf3c('0x0'));var rimraf=require(_0xcf3c('0x1'));var zipdir=require(_0xcf3c('0x2'));var jsonpatch=require(_0xcf3c('0x3'));var rp=require('request-promise');var moment=require(_0xcf3c('0x4'));var BPromise=require(_0xcf3c('0x5'));var Mustache=require(_0xcf3c('0x6'));var util=require('util');var path=require(_0xcf3c('0x7'));var sox=require(_0xcf3c('0x8'));var csv=require('to-csv');var ejs=require(_0xcf3c('0x9'));var fs=require('fs');var fs_extra=require(_0xcf3c('0xa'));var _=require(_0xcf3c('0xb'));var squel=require(_0xcf3c('0xc'));var crypto=require(_0xcf3c('0xd'));var jsforce=require(_0xcf3c('0xe'));var deskjs=require(_0xcf3c('0xf'));var toCsv=require(_0xcf3c('0x10'));var querystring=require(_0xcf3c('0x11'));var Papa=require(_0xcf3c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf3c('0x13'));var as=require(_0xcf3c('0x14'));var hardwareService=require(_0xcf3c('0x15'));var logger=require(_0xcf3c('0x16'))(_0xcf3c('0x17'));var utils=require(_0xcf3c('0x18'));var config=require(_0xcf3c('0x19'));var licenseUtil=require(_0xcf3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245b88,_0x389b0f){_0x389b0f=_0x389b0f||0xcc;return function(_0x59a8dc){if(_0x59a8dc){return _0x245b88[_0xcf3c('0x1b')](_0x389b0f);}return _0x245b88['status'](_0x389b0f)['end']();};}function respondWithResult(_0x56261f,_0x3fd714){_0x3fd714=_0x3fd714||0xc8;return function(_0x598576){if(_0x598576){return _0x56261f[_0xcf3c('0x1c')](_0x3fd714)[_0xcf3c('0x1d')](_0x598576);}};}function respondWithFilteredResult(_0x4e35fc,_0x3e759f){return function(_0x540046){if(_0x540046){var _0x30d023=typeof _0x3e759f[_0xcf3c('0x1e')]===_0xcf3c('0x1f')&&typeof _0x3e759f['limit']===_0xcf3c('0x1f');var _0x190c8c=_0x540046[_0xcf3c('0x20')];var _0x3f6cef=_0x30d023?0x0:_0x3e759f['offset'];var _0x3789b6=_0x30d023?_0x540046[_0xcf3c('0x20')]:_0x3e759f[_0xcf3c('0x1e')]+_0x3e759f[_0xcf3c('0x21')];var _0x3d0e0a;if(_0x3789b6>=_0x190c8c){_0x3789b6=_0x190c8c;_0x3d0e0a=0xc8;}else{_0x3d0e0a=0xce;}_0x4e35fc[_0xcf3c('0x1c')](_0x3d0e0a);return _0x4e35fc[_0xcf3c('0x22')](_0xcf3c('0x23'),_0x3f6cef+'-'+_0x3789b6+'/'+_0x190c8c)[_0xcf3c('0x1d')](_0x540046);}return null;};}function patchUpdates(_0x8e7738){return function(_0x26a26e){try{jsonpatch[_0xcf3c('0x24')](_0x26a26e,_0x8e7738,!![]);}catch(_0x4e80d4){return BPromise[_0xcf3c('0x25')](_0x4e80d4);}return _0x26a26e['save']();};}function saveUpdates(_0x3c9153,_0x1228c1){return function(_0x5dddc1){if(_0x5dddc1){return _0x5dddc1[_0xcf3c('0x26')](_0x3c9153)[_0xcf3c('0x27')](function(_0x328336){return _0x328336;});}return null;};}function removeEntity(_0x1d7e79,_0x32bbd5){return function(_0x3f1771){if(_0x3f1771){return _0x3f1771[_0xcf3c('0x28')]()[_0xcf3c('0x27')](function(){_0x1d7e79['status'](0xcc)[_0xcf3c('0x29')]();});}};}function handleEntityNotFound(_0x4ce43c,_0x2281b6){return function(_0x15b55c){if(!_0x15b55c){_0x4ce43c[_0xcf3c('0x1b')](0x194);}return _0x15b55c;};}function handleError(_0x35e546,_0x181c90){_0x181c90=_0x181c90||0x1f4;return function(_0x43c912){logger['error'](_0x43c912[_0xcf3c('0x2a')]);if(_0x43c912['name']){delete _0x43c912[_0xcf3c('0x2b')];}_0x35e546[_0xcf3c('0x1c')](_0x181c90)[_0xcf3c('0x2c')](_0x43c912);};}exports['show']=function(_0x397996,_0x54174a){var _0x1d8223={'raw':!![],'where':{'id':_0x397996[_0xcf3c('0x2d')]['id']}},_0xe22e99={};_0xe22e99[_0xcf3c('0x2e')]=_['keys'](db[_0xcf3c('0x2f')][_0xcf3c('0x30')]);_0xe22e99[_0xcf3c('0x31')]=_[_0xcf3c('0x32')](_0x397996['query']);_0xe22e99[_0xcf3c('0x33')]=_[_0xcf3c('0x34')](_0xe22e99[_0xcf3c('0x2e')],_0xe22e99['query']);_0x1d8223[_0xcf3c('0x35')]=_[_0xcf3c('0x34')](_0xe22e99[_0xcf3c('0x2e')],qs['fields'](_0x397996[_0xcf3c('0x31')][_0xcf3c('0x36')]));_0x1d8223[_0xcf3c('0x35')]=_0x1d8223[_0xcf3c('0x35')][_0xcf3c('0x37')]?_0x1d8223['attributes']:_0xe22e99[_0xcf3c('0x2e')];if(_0x397996['query'][_0xcf3c('0x38')]){_0x1d8223['include']=[{'all':!![]}];}_0x1d8223=_[_0xcf3c('0x39')]({},_0x1d8223,_0x397996[_0xcf3c('0x3a')]);return db[_0xcf3c('0x2f')][_0xcf3c('0x3b')](_0x1d8223)[_0xcf3c('0x27')](handleEntityNotFound(_0x54174a,null))[_0xcf3c('0x27')](respondWithResult(_0x54174a,null))[_0xcf3c('0x3c')](handleError(_0x54174a,null));};exports[_0xcf3c('0x3d')]=function(_0x4844f2,_0xbc118e){return db[_0xcf3c('0x2f')][_0xcf3c('0x3d')](_0x4844f2[_0xcf3c('0x3e')],{})[_0xcf3c('0x27')](respondWithResult(_0xbc118e,0xc9))[_0xcf3c('0x3c')](handleError(_0xbc118e,null));};exports[_0xcf3c('0x26')]=function(_0xff382e,_0x16f81d){if(_0xff382e[_0xcf3c('0x3e')]['id']){delete _0xff382e['body']['id'];}return db[_0xcf3c('0x2f')]['find']({'where':{'id':_0xff382e['params']['id']}})['then'](handleEntityNotFound(_0x16f81d,null))[_0xcf3c('0x27')](saveUpdates(_0xff382e[_0xcf3c('0x3e')],null))[_0xcf3c('0x27')](respondWithResult(_0x16f81d,null))[_0xcf3c('0x3c')](handleError(_0x16f81d,null));};exports['destroy']=function(_0x54ca05,_0x27e186){return db[_0xcf3c('0x2f')][_0xcf3c('0x3b')]({'where':{'id':_0x54ca05[_0xcf3c('0x2d')]['id']}})[_0xcf3c('0x27')](handleEntityNotFound(_0x27e186,null))[_0xcf3c('0x27')](removeEntity(_0x27e186,null))['catch'](handleError(_0x27e186,null));}; \ No newline at end of file +var _0x1224=['query','keys','filters','intersection','attributes','fields','length','merge','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','show','params','model','ChatProactiveAction'];(function(_0xdac5f,_0x1c39c7){var _0x5ea6c3=function(_0x4e3ebb){while(--_0x4e3ebb){_0xdac5f['push'](_0xdac5f['shift']());}};_0x5ea6c3(++_0x1c39c7);}(_0x1224,0x10d));var _0x4122=function(_0x10865b,_0x252f1b){_0x10865b=_0x10865b-0x0;var _0x157426=_0x1224[_0x10865b];return _0x157426;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var jsonpatch=require(_0x4122('0x3'));var rp=require(_0x4122('0x4'));var moment=require(_0x4122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4122('0x6'));var util=require(_0x4122('0x7'));var path=require(_0x4122('0x8'));var sox=require('sox');var csv=require(_0x4122('0x9'));var ejs=require(_0x4122('0xa'));var fs=require('fs');var fs_extra=require(_0x4122('0xb'));var _=require(_0x4122('0xc'));var squel=require(_0x4122('0xd'));var crypto=require(_0x4122('0xe'));var jsforce=require(_0x4122('0xf'));var deskjs=require(_0x4122('0x10'));var toCsv=require(_0x4122('0x9'));var querystring=require(_0x4122('0x11'));var Papa=require(_0x4122('0x12'));var Redis=require(_0x4122('0x13'));var authService=require(_0x4122('0x14'));var qs=require(_0x4122('0x15'));var as=require(_0x4122('0x16'));var hardwareService=require(_0x4122('0x17'));var logger=require(_0x4122('0x18'))(_0x4122('0x19'));var utils=require(_0x4122('0x1a'));var config=require(_0x4122('0x1b'));var licenseUtil=require(_0x4122('0x1c'));var db=require(_0x4122('0x1d'))['db'];function respondWithStatusCode(_0x440ff0,_0x8d4876){_0x8d4876=_0x8d4876||0xcc;return function(_0xe213d){if(_0xe213d){return _0x440ff0[_0x4122('0x1e')](_0x8d4876);}return _0x440ff0[_0x4122('0x1f')](_0x8d4876)[_0x4122('0x20')]();};}function respondWithResult(_0x421ee3,_0x1a701e){_0x1a701e=_0x1a701e||0xc8;return function(_0x3a88fe){if(_0x3a88fe){return _0x421ee3['status'](_0x1a701e)[_0x4122('0x21')](_0x3a88fe);}};}function respondWithFilteredResult(_0x3c674e,_0x192e77){return function(_0x359909){if(_0x359909){var _0x520300=typeof _0x192e77[_0x4122('0x22')]===_0x4122('0x23')&&typeof _0x192e77['limit']===_0x4122('0x23');var _0x3ec4d3=_0x359909[_0x4122('0x24')];var _0x4636ae=_0x520300?0x0:_0x192e77[_0x4122('0x22')];var _0x42374d=_0x520300?_0x359909[_0x4122('0x24')]:_0x192e77['offset']+_0x192e77['limit'];var _0x586105;if(_0x42374d>=_0x3ec4d3){_0x42374d=_0x3ec4d3;_0x586105=0xc8;}else{_0x586105=0xce;}_0x3c674e[_0x4122('0x1f')](_0x586105);return _0x3c674e[_0x4122('0x25')](_0x4122('0x26'),_0x4636ae+'-'+_0x42374d+'/'+_0x3ec4d3)[_0x4122('0x21')](_0x359909);}return null;};}function patchUpdates(_0xef6995){return function(_0xb0a7d){try{jsonpatch[_0x4122('0x27')](_0xb0a7d,_0xef6995,!![]);}catch(_0x46b24e){return BPromise['reject'](_0x46b24e);}return _0xb0a7d[_0x4122('0x28')]();};}function saveUpdates(_0x50e243,_0x4f949a){return function(_0x508cd7){if(_0x508cd7){return _0x508cd7[_0x4122('0x29')](_0x50e243)[_0x4122('0x2a')](function(_0x317418){return _0x317418;});}return null;};}function removeEntity(_0x4eb35b,_0x128fde){return function(_0x386cdc){if(_0x386cdc){return _0x386cdc['destroy']()['then'](function(){_0x4eb35b[_0x4122('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db23e,_0x59895d){return function(_0x1b449b){if(!_0x1b449b){_0x4db23e[_0x4122('0x1e')](0x194);}return _0x1b449b;};}function handleError(_0xbb76e1,_0x1bb51b){_0x1bb51b=_0x1bb51b||0x1f4;return function(_0x31568f){logger[_0x4122('0x2b')](_0x31568f[_0x4122('0x2c')]);if(_0x31568f[_0x4122('0x2d')]){delete _0x31568f[_0x4122('0x2d')];}_0xbb76e1[_0x4122('0x1f')](_0x1bb51b)[_0x4122('0x2e')](_0x31568f);};}exports[_0x4122('0x2f')]=function(_0xfefaf6,_0x5f32c5){var _0x2e5bc2={'raw':!![],'where':{'id':_0xfefaf6[_0x4122('0x30')]['id']}},_0x43c51c={};_0x43c51c[_0x4122('0x31')]=_['keys'](db[_0x4122('0x32')]['rawAttributes']);_0x43c51c[_0x4122('0x33')]=_[_0x4122('0x34')](_0xfefaf6[_0x4122('0x33')]);_0x43c51c[_0x4122('0x35')]=_[_0x4122('0x36')](_0x43c51c[_0x4122('0x31')],_0x43c51c[_0x4122('0x33')]);_0x2e5bc2[_0x4122('0x37')]=_['intersection'](_0x43c51c[_0x4122('0x31')],qs[_0x4122('0x38')](_0xfefaf6['query'][_0x4122('0x38')]));_0x2e5bc2[_0x4122('0x37')]=_0x2e5bc2[_0x4122('0x37')][_0x4122('0x39')]?_0x2e5bc2['attributes']:_0x43c51c[_0x4122('0x31')];if(_0xfefaf6[_0x4122('0x33')]['includeAll']){_0x2e5bc2['include']=[{'all':!![]}];}_0x2e5bc2=_[_0x4122('0x3a')]({},_0x2e5bc2,_0xfefaf6['options']);return db[_0x4122('0x32')][_0x4122('0x3b')](_0x2e5bc2)['then'](handleEntityNotFound(_0x5f32c5,null))[_0x4122('0x2a')](respondWithResult(_0x5f32c5,null))[_0x4122('0x3c')](handleError(_0x5f32c5,null));};exports[_0x4122('0x3d')]=function(_0x5bb6d6,_0x35971b){return db['ChatProactiveAction'][_0x4122('0x3d')](_0x5bb6d6[_0x4122('0x3e')],{})[_0x4122('0x2a')](respondWithResult(_0x35971b,0xc9))['catch'](handleError(_0x35971b,null));};exports[_0x4122('0x29')]=function(_0x5427ca,_0x2da1bd){if(_0x5427ca[_0x4122('0x3e')]['id']){delete _0x5427ca['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x5427ca[_0x4122('0x30')]['id']}})['then'](handleEntityNotFound(_0x2da1bd,null))[_0x4122('0x2a')](saveUpdates(_0x5427ca[_0x4122('0x3e')],null))[_0x4122('0x2a')](respondWithResult(_0x2da1bd,null))[_0x4122('0x3c')](handleError(_0x2da1bd,null));};exports[_0x4122('0x3f')]=function(_0x517a59,_0x5c20ec){return db[_0x4122('0x32')]['find']({'where':{'id':_0x517a59[_0x4122('0x30')]['id']}})['then'](handleEntityNotFound(_0x5c20ec,null))[_0x4122('0x2a')](removeEntity(_0x5c20ec,null))[_0x4122('0x3c')](handleError(_0x5c20ec,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 37473b6..807b442 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 _0xc61c=['define','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x3544b1,_0x2f12aa){var _0x77c2a0=function(_0x5a231d){while(--_0x5a231d){_0x3544b1['push'](_0x3544b1['shift']());}};_0x77c2a0(++_0x2f12aa);}(_0xc61c,0x12d));var _0xcc61=function(_0x2929cd,_0x1d3a2a){_0x2929cd=_0x2929cd-0x0;var _0x16c157=_0xc61c[_0x2929cd];return _0x16c157;};'use strict';var _=require(_0xcc61('0x0'));var util=require('util');var logger=require(_0xcc61('0x1'))(_0xcc61('0x2'));var moment=require(_0xcc61('0x3'));var BPromise=require(_0xcc61('0x4'));var rp=require(_0xcc61('0x5'));var fs=require('fs');var path=require(_0xcc61('0x6'));var rimraf=require(_0xcc61('0x7'));var config=require(_0xcc61('0x8'));var attributes=require(_0xcc61('0x9'));module[_0xcc61('0xa')]=function(_0x151677,_0x539f54){return _0x151677[_0xcc61('0xb')]('ChatProactiveAction',attributes,{'tableName':_0xcc61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4efe=['path','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x4efe,0x1c7));var _0xe4ef=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x4efe[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xe4ef('0x0'));var util=require(_0xe4ef('0x1'));var logger=require(_0xe4ef('0x2'))(_0xe4ef('0x3'));var moment=require('moment');var BPromise=require(_0xe4ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4ef('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4ef('0x6'));module[_0xe4ef('0x7')]=function(_0x59ca1c,_0x66a8f3){return _0x59ca1c['define'](_0xe4ef('0x8'),attributes,{'tableName':_0xe4ef('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 e44bf6a..292c505 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 _0xe692=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x271ace,_0x2b1999){var _0x48e6af=function(_0x166e5c){while(--_0x166e5c){_0x271ace['push'](_0x271ace['shift']());}};_0x48e6af(++_0x2b1999);}(_0xe692,0x1b0));var _0x2e69=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xe692[_0x176329];return _0x31997c;};'use strict';var _=require(_0x2e69('0x0'));var util=require(_0x2e69('0x1'));var moment=require(_0x2e69('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e69('0x3'));var fs=require('fs');var Redis=require(_0x2e69('0x4'));var db=require(_0x2e69('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e69('0x6'));var jayson=require(_0x2e69('0x7'));var client=jayson[_0x2e69('0x8')][_0x2e69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f424c,_0x4f9ec9,_0x588f35){return new BPromise(function(_0x33ded8,_0x1f8fcf){return client[_0x2e69('0xa')](_0x4f424c,_0x588f35)[_0x2e69('0xb')](function(_0x4b1b6d){logger[_0x2e69('0xc')](_0x2e69('0xd'),_0x4f9ec9,'request\x20sent');logger[_0x2e69('0xe')](_0x2e69('0xf'),_0x4f9ec9,_0x2e69('0x10'),JSON[_0x2e69('0x11')](_0x4b1b6d));if(_0x4b1b6d[_0x2e69('0x12')]){if(_0x4b1b6d['error']['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4f9ec9,_0x4b1b6d[_0x2e69('0x12')][_0x2e69('0x13')]);return _0x1f8fcf(_0x4b1b6d[_0x2e69('0x12')]['message']);}logger[_0x2e69('0x12')](_0x2e69('0xd'),_0x4f9ec9,_0x4b1b6d['error']['message']);return _0x33ded8(_0x4b1b6d[_0x2e69('0x12')][_0x2e69('0x13')]);}else{logger[_0x2e69('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x4f9ec9,'request\x20sent');_0x33ded8(_0x4b1b6d[_0x2e69('0x14')][_0x2e69('0x13')]);}})['catch'](function(_0x5e882b){logger['error'](_0x2e69('0xd'),_0x4f9ec9,_0x5e882b);_0x1f8fcf(_0x5e882b);});});} \ No newline at end of file +var _0x6157=['stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6157,0xeb));var _0x7615=function(_0xf6ac4d,_0x18979a){_0xf6ac4d=_0xf6ac4d-0x0;var _0x3cfeb3=_0x6157[_0xf6ac4d];return _0x3cfeb3;};'use strict';var _=require(_0x7615('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7615('0x1'));var rs=require(_0x7615('0x2'));var fs=require('fs');var Redis=require(_0x7615('0x3'));var db=require(_0x7615('0x4'))['db'];var utils=require(_0x7615('0x5'));var logger=require(_0x7615('0x6'))(_0x7615('0x7'));var config=require(_0x7615('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7615('0x9')][_0x7615('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7490,_0xeb56d3,_0x3554dc){return new BPromise(function(_0x2320f7,_0x5512a1){return client[_0x7615('0xb')](_0x4d7490,_0x3554dc)[_0x7615('0xc')](function(_0x24b0db){logger[_0x7615('0xd')](_0x7615('0xe'),_0xeb56d3,_0x7615('0xf'));logger[_0x7615('0x10')](_0x7615('0x11'),_0xeb56d3,'request\x20sent',JSON[_0x7615('0x12')](_0x24b0db));if(_0x24b0db[_0x7615('0x13')]){if(_0x24b0db['error'][_0x7615('0x14')]===0x1f4){logger['error'](_0x7615('0xe'),_0xeb56d3,_0x24b0db[_0x7615('0x13')][_0x7615('0x15')]);return _0x5512a1(_0x24b0db[_0x7615('0x13')]['message']);}logger[_0x7615('0x13')](_0x7615('0xe'),_0xeb56d3,_0x24b0db[_0x7615('0x13')][_0x7615('0x15')]);return _0x2320f7(_0x24b0db[_0x7615('0x13')]['message']);}else{logger[_0x7615('0xd')](_0x7615('0xe'),_0xeb56d3,_0x7615('0xf'));_0x2320f7(_0x24b0db[_0x7615('0x16')]['message']);}})['catch'](function(_0x2ef30e){logger[_0x7615('0x13')](_0x7615('0xe'),_0xeb56d3,_0x2ef30e);_0x5512a1(_0x2ef30e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9e9d4fe..b652bdd 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 _0x7c09=['delete','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','show','post','isAuthenticated','create','put'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0x7c09,0x102));var _0x97c0=function(_0x375c2f,_0x2c1bec){_0x375c2f=_0x375c2f-0x0;var _0x7cc2c1=_0x7c09[_0x375c2f];return _0x7cc2c1;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xb')](),controller['update']);router[_0x97c0('0xe')](_0x97c0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x117369,_0x4466a2){var _0x541d94=function(_0x1b556b){while(--_0x1b556b){_0x117369['push'](_0x117369['shift']());}};_0x541d94(++_0x4466a2);}(_0xeda8,0x104));var _0x8eda=function(_0x51d630,_0x17f9d5){_0x51d630=_0x51d630-0x0;var _0x35059a=_0xeda8[_0x51d630];return _0x35059a;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('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 4b17586..d975ff2 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 _0x86ed=['name','INTEGER','rrmemory','roundrobin','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x86ed,0xa9));var _0xd86e=function(_0x4194cb,_0x1b2fa6){_0x4194cb=_0x4194cb-0x0;var _0x504484=_0x86ed[_0x4194cb];return _0x504484;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd86e('0x0')],'unique':_0xd86e('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd86e('0x0')]},'timeout':{'type':Sequelize[_0xd86e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd86e('0x3'),'beepall',_0xd86e('0x4'))}}; \ No newline at end of file +var _0xa0a9=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x27b99a,_0x22bedf){var _0x432ed2=function(_0x1844ad){while(--_0x1844ad){_0x27b99a['push'](_0x27b99a['shift']());}};_0x432ed2(++_0x22bedf);}(_0xa0a9,0x143));var _0x9a0a=function(_0x217098,_0x3b775e){_0x217098=_0x217098-0x0;var _0x2c2ddd=_0xa0a9[_0x217098];return _0x2c2ddd;};'use strict';var Sequelize=require(_0x9a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a0a('0x1')],'unique':_0x9a0a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a0a('0x1')]},'timeout':{'type':Sequelize[_0x9a0a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a0a('0x4')](_0x9a0a('0x5'),_0x9a0a('0x6'),_0x9a0a('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 51eea15..c38ad4e 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 _0xa274=['SIP','createdAt','findOne','Team','pick','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','get','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserChatQueue','length','hasOwnProperty','nolimit','findAndCountAll','UserId','chatPause','updatedAt','format'];(function(_0x10ac69,_0xfce771){var _0x5a9e0d=function(_0x464a4a){while(--_0x464a4a){_0x10ac69['push'](_0x10ac69['shift']());}};_0x5a9e0d(++_0xfce771);}(_0xa274,0xc3));var _0x4a27=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0xa274[_0x42d1f8];return _0x40d234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a27('0x0'));var zipdir=require(_0x4a27('0x1'));var jsonpatch=require(_0x4a27('0x2'));var rp=require(_0x4a27('0x3'));var moment=require(_0x4a27('0x4'));var BPromise=require(_0x4a27('0x5'));var Mustache=require(_0x4a27('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4a27('0x7'));var csv=require('to-csv');var ejs=require(_0x4a27('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a27('0x9'));var squel=require('squel');var crypto=require(_0x4a27('0xa'));var jsforce=require(_0x4a27('0xb'));var deskjs=require(_0x4a27('0xc'));var toCsv=require(_0x4a27('0xd'));var querystring=require(_0x4a27('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a27('0xf'));var authService=require(_0x4a27('0x10'));var qs=require(_0x4a27('0x11'));var as=require(_0x4a27('0x12'));var hardwareService=require(_0x4a27('0x13'));var logger=require(_0x4a27('0x14'))(_0x4a27('0x15'));var utils=require(_0x4a27('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a27('0x17'));var db=require(_0x4a27('0x18'))['db'];config[_0x4a27('0x19')]=_['defaults'](config[_0x4a27('0x19')],{'host':_0x4a27('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a27('0x19')]));require(_0x4a27('0x1b'))[_0x4a27('0x1c')](socket);var jayson=require(_0x4a27('0x1d'));var client=jayson[_0x4a27('0x1e')][_0x4a27('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x306fb0,_0x5b2b9a,_0x5add90,_0x3dc384){return new BPromise(function(_0x29b902,_0x2ff275){var _0x31d18d=_0x3dc384||client;return _0x31d18d[_0x4a27('0x20')](_0x306fb0,_0x5add90)[_0x4a27('0x21')](function(_0xf7118){logger['info'](_0x4a27('0x22'),_0x5b2b9a,_0x4a27('0x23'));logger[_0x4a27('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5b2b9a,_0x4a27('0x23'),JSON[_0x4a27('0x25')](_0xf7118));if(_0xf7118[_0x4a27('0x26')]){if(_0xf7118[_0x4a27('0x26')]['code']===0x1f4){logger[_0x4a27('0x26')](_0x4a27('0x22'),_0x5b2b9a,_0xf7118[_0x4a27('0x26')][_0x4a27('0x27')]);return _0x2ff275(_0xf7118[_0x4a27('0x26')]['message']);}logger[_0x4a27('0x26')]('ChatQueue,\x20%s,\x20%s',_0x5b2b9a,_0xf7118[_0x4a27('0x26')][_0x4a27('0x27')]);return _0x29b902(_0xf7118[_0x4a27('0x26')][_0x4a27('0x27')]);}else{logger[_0x4a27('0x28')]('ChatQueue,\x20%s,\x20%s',_0x5b2b9a,_0x4a27('0x23'));_0x29b902(_0xf7118[_0x4a27('0x29')][_0x4a27('0x27')]);}})['catch'](function(_0x552f24){logger[_0x4a27('0x26')]('ChatQueue,\x20%s,\x20%s',_0x5b2b9a,_0x552f24);_0x2ff275(_0x552f24);});});}function respondWithStatusCode(_0x23cda0,_0x3754ae){_0x3754ae=_0x3754ae||0xcc;return function(_0x261ad9){if(_0x261ad9){return _0x23cda0[_0x4a27('0x2a')](_0x3754ae);}return _0x23cda0[_0x4a27('0x2b')](_0x3754ae)[_0x4a27('0x2c')]();};}function respondWithResult(_0x532358,_0x53f991){_0x53f991=_0x53f991||0xc8;return function(_0xed36fa){if(_0xed36fa){return _0x532358['status'](_0x53f991)[_0x4a27('0x2d')](_0xed36fa);}};}function respondWithFilteredResult(_0x33b075,_0x5dfb44){return function(_0x3f3a78){if(_0x3f3a78){var _0x327582=typeof _0x5dfb44[_0x4a27('0x2e')]===_0x4a27('0x2f')&&typeof _0x5dfb44[_0x4a27('0x30')]===_0x4a27('0x2f');var _0x44f62f=_0x3f3a78[_0x4a27('0x31')];var _0xccea82=_0x327582?0x0:_0x5dfb44[_0x4a27('0x2e')];var _0x53aa67=_0x327582?_0x3f3a78['count']:_0x5dfb44[_0x4a27('0x2e')]+_0x5dfb44['limit'];var _0x33f3d9;if(_0x53aa67>=_0x44f62f){_0x53aa67=_0x44f62f;_0x33f3d9=0xc8;}else{_0x33f3d9=0xce;}_0x33b075[_0x4a27('0x2b')](_0x33f3d9);return _0x33b075[_0x4a27('0x32')](_0x4a27('0x33'),_0xccea82+'-'+_0x53aa67+'/'+_0x44f62f)[_0x4a27('0x2d')](_0x3f3a78);}return null;};}function patchUpdates(_0x262ee8){return function(_0x3ee5b8){try{jsonpatch[_0x4a27('0x34')](_0x3ee5b8,_0x262ee8,!![]);}catch(_0x406a2a){return BPromise['reject'](_0x406a2a);}return _0x3ee5b8['save']();};}function saveUpdates(_0x5e2d5e,_0xd11476){return function(_0x19037b){if(_0x19037b){return _0x19037b['update'](_0x5e2d5e)[_0x4a27('0x21')](function(_0x19f976){return _0x19f976;});}return null;};}function removeEntity(_0x3ba0cb,_0x3a1603){return function(_0x536d65){if(_0x536d65){return _0x536d65[_0x4a27('0x35')]()[_0x4a27('0x21')](function(){var _0x380c31=_0x536d65[_0x4a27('0x36')]({'plain':!![]});var _0x531b0a='ChatQueues';return db[_0x4a27('0x37')][_0x4a27('0x35')]({'where':{'type':_0x531b0a,'resourceId':_0x380c31['id']}})[_0x4a27('0x21')](function(){return _0x536d65;});})[_0x4a27('0x21')](function(){_0x3ba0cb[_0x4a27('0x2b')](0xcc)[_0x4a27('0x2c')]();});}};}function handleEntityNotFound(_0x1e831b,_0x316323){return function(_0x216238){if(!_0x216238){_0x1e831b[_0x4a27('0x2a')](0x194);}return _0x216238;};}function handleError(_0x543d63,_0x594d79){_0x594d79=_0x594d79||0x1f4;return function(_0xa148ae){logger[_0x4a27('0x26')](_0xa148ae[_0x4a27('0x38')]);if(_0xa148ae[_0x4a27('0x39')]){delete _0xa148ae['name'];}_0x543d63[_0x4a27('0x2b')](_0x594d79)[_0x4a27('0x3a')](_0xa148ae);};}exports[_0x4a27('0x3b')]=function(_0x2b5c04,_0x1d0762){var _0x4ffa23={},_0x20a9d6={},_0x311c31={'count':0x0,'rows':[]};var _0xd4d4c0=_[_0x4a27('0x3c')](db[_0x4a27('0x3d')]['rawAttributes'],function(_0x1166f0){return{'name':_0x1166f0['fieldName'],'type':_0x1166f0[_0x4a27('0x3e')][_0x4a27('0x3f')]};});_0x20a9d6[_0x4a27('0x40')]=_[_0x4a27('0x3c')](_0xd4d4c0,_0x4a27('0x39'));_0x20a9d6[_0x4a27('0x41')]=_[_0x4a27('0x42')](_0x2b5c04[_0x4a27('0x41')]);_0x20a9d6[_0x4a27('0x43')]=_[_0x4a27('0x44')](_0x20a9d6['model'],_0x20a9d6[_0x4a27('0x41')]);_0x4ffa23['attributes']=_[_0x4a27('0x44')](_0x20a9d6[_0x4a27('0x40')],qs[_0x4a27('0x45')](_0x2b5c04['query'][_0x4a27('0x45')]));_0x4ffa23[_0x4a27('0x46')]=_0x4ffa23[_0x4a27('0x46')]['length']?_0x4ffa23[_0x4a27('0x46')]:_0x20a9d6[_0x4a27('0x40')];if(!_0x2b5c04[_0x4a27('0x41')]['hasOwnProperty']('nolimit')){_0x4ffa23['limit']=qs[_0x4a27('0x30')](_0x2b5c04['query'][_0x4a27('0x30')]);_0x4ffa23[_0x4a27('0x2e')]=qs[_0x4a27('0x2e')](_0x2b5c04[_0x4a27('0x41')][_0x4a27('0x2e')]);}_0x4ffa23[_0x4a27('0x47')]=qs[_0x4a27('0x48')](_0x2b5c04['query'][_0x4a27('0x48')]);_0x4ffa23[_0x4a27('0x49')]=qs[_0x4a27('0x43')](_['pick'](_0x2b5c04[_0x4a27('0x41')],_0x20a9d6[_0x4a27('0x43')]),_0xd4d4c0);if(_0x2b5c04[_0x4a27('0x41')][_0x4a27('0x4a')]){_0x4ffa23[_0x4a27('0x49')]=_['merge'](_0x4ffa23[_0x4a27('0x49')],{'$or':_[_0x4a27('0x3c')](_0xd4d4c0,function(_0x98518a){if(_0x98518a['type']!==_0x4a27('0x4b')){var _0x5ca804={};_0x5ca804[_0x98518a['name']]={'$like':'%'+_0x2b5c04[_0x4a27('0x41')][_0x4a27('0x4a')]+'%'};return _0x5ca804;}})});}_0x4ffa23=_[_0x4a27('0x4c')]({},_0x4ffa23,_0x2b5c04[_0x4a27('0x4d')]);var _0x426c56={'where':_0x4ffa23[_0x4a27('0x49')]};return db[_0x4a27('0x3d')]['count'](_0x426c56)[_0x4a27('0x21')](function(_0x56d2bd){_0x311c31[_0x4a27('0x31')]=_0x56d2bd;if(_0x2b5c04['query'][_0x4a27('0x4e')]){_0x4ffa23[_0x4a27('0x4f')]=[{'all':!![]}];}return db[_0x4a27('0x3d')][_0x4a27('0x50')](_0x4ffa23);})[_0x4a27('0x21')](function(_0x59c8ef){_0x311c31[_0x4a27('0x51')]=_0x59c8ef;return _0x311c31;})[_0x4a27('0x21')](respondWithFilteredResult(_0x1d0762,_0x4ffa23))[_0x4a27('0x52')](handleError(_0x1d0762,null));};exports[_0x4a27('0x53')]=function(_0x3ca272,_0x456872){var _0x519c45={'raw':!![],'where':{'id':_0x3ca272[_0x4a27('0x54')]['id']}},_0x151704={};_0x151704[_0x4a27('0x40')]=_[_0x4a27('0x42')](db[_0x4a27('0x3d')][_0x4a27('0x55')]);_0x151704[_0x4a27('0x41')]=_[_0x4a27('0x42')](_0x3ca272[_0x4a27('0x41')]);_0x151704[_0x4a27('0x43')]=_[_0x4a27('0x44')](_0x151704[_0x4a27('0x40')],_0x151704[_0x4a27('0x41')]);_0x519c45[_0x4a27('0x46')]=_['intersection'](_0x151704[_0x4a27('0x40')],qs[_0x4a27('0x45')](_0x3ca272[_0x4a27('0x41')][_0x4a27('0x45')]));_0x519c45['attributes']=_0x519c45[_0x4a27('0x46')]['length']?_0x519c45[_0x4a27('0x46')]:_0x151704[_0x4a27('0x40')];if(_0x3ca272[_0x4a27('0x41')]['includeAll']){_0x519c45[_0x4a27('0x4f')]=[{'all':!![]}];}_0x519c45=_[_0x4a27('0x4c')]({},_0x519c45,_0x3ca272['options']);return db[_0x4a27('0x3d')]['find'](_0x519c45)[_0x4a27('0x21')](handleEntityNotFound(_0x456872,null))['then'](respondWithResult(_0x456872,null))[_0x4a27('0x52')](handleError(_0x456872,null));};exports[_0x4a27('0x56')]=function(_0x362a9c,_0x566dd1){return db[_0x4a27('0x3d')][_0x4a27('0x56')](_0x362a9c[_0x4a27('0x57')],{})[_0x4a27('0x21')](function(_0x425e1d){var _0x161465=_0x362a9c[_0x4a27('0x58')][_0x4a27('0x36')]({'plain':!![]});if(!_0x161465)throw new Error(_0x4a27('0x59'));if(_0x161465[_0x4a27('0x5a')]==='user'){var _0x54c30c=_0x425e1d[_0x4a27('0x36')]({'plain':!![]});var _0x5504ba=_0x4a27('0x5b');return db['UserProfileSection'][_0x4a27('0x5c')]({'where':{'name':_0x5504ba,'userProfileId':_0x161465[_0x4a27('0x5d')]},'raw':!![]})[_0x4a27('0x21')](function(_0x1ed1e9){if(_0x1ed1e9&&_0x1ed1e9[_0x4a27('0x5e')]===0x0){return db[_0x4a27('0x37')]['create']({'name':_0x54c30c['name'],'resourceId':_0x54c30c['id'],'type':_0x1ed1e9[_0x4a27('0x39')],'sectionId':_0x1ed1e9['id']},{})[_0x4a27('0x21')](function(){return _0x425e1d;});}else{return _0x425e1d;}})['catch'](function(_0x583516){logger[_0x4a27('0x26')](_0x4a27('0x5f'),_0x583516);throw _0x583516;});}return _0x425e1d;})[_0x4a27('0x21')](respondWithResult(_0x566dd1,0xc9))['catch'](handleError(_0x566dd1,null));};exports[_0x4a27('0x60')]=function(_0x3eb120,_0x5e6f3d){if(_0x3eb120[_0x4a27('0x57')]['id']){delete _0x3eb120[_0x4a27('0x57')]['id'];}return db[_0x4a27('0x3d')][_0x4a27('0x5c')]({'where':{'id':_0x3eb120['params']['id']}})[_0x4a27('0x21')](handleEntityNotFound(_0x5e6f3d,null))[_0x4a27('0x21')](saveUpdates(_0x3eb120[_0x4a27('0x57')],null))[_0x4a27('0x21')](respondWithResult(_0x5e6f3d,null))[_0x4a27('0x52')](handleError(_0x5e6f3d,null));};exports[_0x4a27('0x35')]=function(_0x37d145,_0x3efaa0){return db[_0x4a27('0x3d')][_0x4a27('0x5c')]({'where':{'id':_0x37d145[_0x4a27('0x54')]['id']}})['then'](handleEntityNotFound(_0x3efaa0,null))[_0x4a27('0x21')](removeEntity(_0x3efaa0,null))['catch'](handleError(_0x3efaa0,null));};exports[_0x4a27('0x61')]=function(_0x11a2a3,_0x169927){return db['ChatQueue'][_0x4a27('0x61')]()[_0x4a27('0x21')](respondWithResult(_0x169927,null))[_0x4a27('0x52')](handleError(_0x169927,null));};exports['getMembers']=function(_0x516003,_0x3573b1,_0x423da3){var _0x4650b1={'raw':!![],'where':{}},_0x319323={},_0x5abc96;return db[_0x4a27('0x3d')]['findOne']({'where':{'id':_0x516003[_0x4a27('0x54')]['id']}})[_0x4a27('0x21')](handleEntityNotFound(_0x3573b1,null))[_0x4a27('0x21')](function(_0x4cc310){if(_0x4cc310){_0x5abc96=_0x4cc310['get']({'plain':!![]});_0x319323[_0x4a27('0x40')]=_[_0x4a27('0x42')](db[_0x4a27('0x62')][_0x4a27('0x55')]);_0x319323[_0x4a27('0x41')]=_['keys'](_0x516003[_0x4a27('0x41')]);_0x319323[_0x4a27('0x43')]=_[_0x4a27('0x44')](_0x319323[_0x4a27('0x40')],_0x319323[_0x4a27('0x41')]);_0x4650b1['attributes']=_[_0x4a27('0x44')](_0x319323[_0x4a27('0x40')],qs[_0x4a27('0x45')](_0x516003[_0x4a27('0x41')][_0x4a27('0x45')]));_0x4650b1['attributes']=_0x4650b1[_0x4a27('0x46')][_0x4a27('0x63')]?_0x4650b1[_0x4a27('0x46')]:_0x319323['model'];if(!_0x516003[_0x4a27('0x41')][_0x4a27('0x64')](_0x4a27('0x65'))){_0x4650b1[_0x4a27('0x30')]=qs[_0x4a27('0x30')](_0x516003['query'][_0x4a27('0x30')]);_0x4650b1[_0x4a27('0x2e')]=qs[_0x4a27('0x2e')](_0x516003['query']['offset']);}_0x4650b1['order']=qs[_0x4a27('0x48')](_0x516003[_0x4a27('0x41')][_0x4a27('0x48')]);_0x4650b1[_0x4a27('0x49')]=qs[_0x4a27('0x43')](_['pick'](_0x516003[_0x4a27('0x41')],_0x319323['filters']));_0x4650b1['where']['ChatQueueId']=_0x4cc310['id'];if(_0x516003[_0x4a27('0x41')][_0x4a27('0x4a')]){_0x4650b1[_0x4a27('0x49')]=_[_0x4a27('0x4c')](_0x4650b1[_0x4a27('0x49')],{'$or':_['map'](_0x4650b1[_0x4a27('0x46')],function(_0x12c14f){var _0x63590d={};_0x63590d[_0x12c14f]={'$like':'%'+_0x516003[_0x4a27('0x41')][_0x4a27('0x4a')]+'%'};return _0x63590d;})});}_0x4650b1=_[_0x4a27('0x4c')]({},_0x4650b1,_0x516003['options']);return db[_0x4a27('0x62')][_0x4a27('0x50')](_0x4650b1);}})[_0x4a27('0x21')](function(_0x2e0e4b){if(_0x2e0e4b){return db['User'][_0x4a27('0x66')]({'where':{'id':_['map'](_0x2e0e4b,_0x4a27('0x67')),'role':'agent'},'attributes':['id',_0x4a27('0x39'),_0x4a27('0x68'),_0x4a27('0x69'),'createdAt']});}})[_0x4a27('0x21')](function(_0x18f6ea){if(_0x18f6ea){return{'count':_0x18f6ea[_0x4a27('0x31')],'rows':_[_0x4a27('0x3c')](_0x18f6ea[_0x4a27('0x51')],function(_0x2c8daa){return{'membername':_0x2c8daa[_0x4a27('0x39')],'UserId':_0x2c8daa['id'],'queue_name':_0x5abc96['name'],'ChatQueueId':_0x5abc96['id'],'interface':util[_0x4a27('0x6a')]('%s/%s',_0x4a27('0x6b'),_0x2c8daa[_0x4a27('0x39')]),'penalty':0x0,'paused':_0x2c8daa[_0x4a27('0x68')],'createdAt':_0x2c8daa[_0x4a27('0x6c')],'updatedAt':_0x2c8daa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4a27('0x21')](respondWithFilteredResult(_0x3573b1,_0x4650b1))['catch'](handleError(_0x3573b1,null));};exports['getTeams']=function(_0x4bc59b,_0x593fcf,_0x1d8ad){var _0x31b06c={};var _0x16a3f0={};var _0x302950;var _0xf3cf0b;return db['ChatQueue'][_0x4a27('0x6d')]({'where':{'id':_0x4bc59b[_0x4a27('0x54')]['id']}})['then'](handleEntityNotFound(_0x593fcf,null))[_0x4a27('0x21')](function(_0x3fd916){if(_0x3fd916){_0x302950=_0x3fd916;_0x16a3f0[_0x4a27('0x40')]=_[_0x4a27('0x42')](db[_0x4a27('0x6e')]['rawAttributes']);_0x16a3f0[_0x4a27('0x41')]=_[_0x4a27('0x42')](_0x4bc59b['query']);_0x16a3f0[_0x4a27('0x43')]=_[_0x4a27('0x44')](_0x16a3f0[_0x4a27('0x40')],_0x16a3f0[_0x4a27('0x41')]);_0x31b06c[_0x4a27('0x46')]=_[_0x4a27('0x44')](_0x16a3f0[_0x4a27('0x40')],qs['fields'](_0x4bc59b[_0x4a27('0x41')]['fields']));_0x31b06c[_0x4a27('0x46')]=_0x31b06c['attributes'][_0x4a27('0x63')]?_0x31b06c['attributes']:_0x16a3f0[_0x4a27('0x40')];_0x31b06c[_0x4a27('0x47')]=qs['sort'](_0x4bc59b[_0x4a27('0x41')][_0x4a27('0x48')]);_0x31b06c[_0x4a27('0x49')]=qs[_0x4a27('0x43')](_[_0x4a27('0x6f')](_0x4bc59b[_0x4a27('0x41')],_0x16a3f0['filters']));if(_0x4bc59b['query'][_0x4a27('0x4a')]){_0x31b06c[_0x4a27('0x49')]=_[_0x4a27('0x4c')](_0x31b06c[_0x4a27('0x49')],{'$or':_[_0x4a27('0x3c')](_0x31b06c[_0x4a27('0x46')],function(_0x2d86d9){var _0x3305be={};_0x3305be[_0x2d86d9]={'$like':'%'+_0x4bc59b[_0x4a27('0x41')][_0x4a27('0x4a')]+'%'};return _0x3305be;})});}_0x31b06c=_['merge']({},_0x31b06c,_0x4bc59b[_0x4a27('0x4d')]);return _0x302950[_0x4a27('0x70')](_0x31b06c);}})[_0x4a27('0x21')](function(_0x20c81b){if(_0x20c81b){_0xf3cf0b=_0x20c81b[_0x4a27('0x63')];if(!_0x4bc59b[_0x4a27('0x41')][_0x4a27('0x64')](_0x4a27('0x65'))){_0x31b06c['limit']=qs['limit'](_0x4bc59b[_0x4a27('0x41')][_0x4a27('0x30')]);_0x31b06c[_0x4a27('0x2e')]=qs[_0x4a27('0x2e')](_0x4bc59b[_0x4a27('0x41')][_0x4a27('0x2e')]);}return _0x302950[_0x4a27('0x70')](_0x31b06c);}})[_0x4a27('0x21')](function(_0x1cae37){if(_0x1cae37){return _0x1cae37?{'count':_0xf3cf0b,'rows':_0x1cae37}:null;}})[_0x4a27('0x21')](respondWithResult(_0x593fcf,null))['catch'](handleError(_0x593fcf,null));};exports[_0x4a27('0x71')]=function(_0x40000a,_0x53f51e,_0x39c0a7){var _0x5989d8=_0x40000a[_0x4a27('0x57')][_0x4a27('0x72')];return db['Team'][_0x4a27('0x50')]({'where':{'id':_0x5989d8},'attributes':['id'],'include':[{'model':db[_0x4a27('0x73')],'as':_0x4a27('0x74'),'attributes':['id','name','online',_0x4a27('0x75'),_0x4a27('0x76')],'raw':!![]}]})[_0x4a27('0x21')](function(_0x257d36){if(_0x257d36){var _0x14330b=_[_0x4a27('0x77')](_0x257d36,function(_0x34a149){var _0x51f000=_0x34a149[_0x4a27('0x36')]({'plain':!![]});return _0x51f000[_0x4a27('0x74')];});return db[_0x4a27('0x3d')]['find']({'where':{'id':_0x40000a[_0x4a27('0x54')]['id']}})[_0x4a27('0x21')](function(_0x22ad20){return db[_0x4a27('0x78')][_0x4a27('0x79')](function(_0x450862){return _0x22ad20[_0x4a27('0x71')](_0x5989d8,{'transaction':_0x450862})[_0x4a27('0x21')](function(){return BPromise[_0x4a27('0x7a')](_0x14330b,function(_0x15157b){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x15157b['id'],'ChatQueueId':_0x40000a[_0x4a27('0x54')]['id']},'transaction':_0x450862});});})[_0x4a27('0x21')](function(){_0x14330b['forEach'](function(_0x36fb6a){socket[_0x4a27('0x7b')](_0x4a27('0x7c'),{'UserId':_0x36fb6a['id'],'ChatQueueId':_0x22ad20['id']});});});});});}})[_0x4a27('0x21')](respondWithStatusCode(_0x53f51e,null))['catch'](handleError(_0x53f51e,null));};exports[_0x4a27('0x7d')]=function(_0x3214d6,_0x4eabd7,_0x303882){return db[_0x4a27('0x6e')][_0x4a27('0x50')]({'where':{'id':_0x3214d6[_0x4a27('0x41')][_0x4a27('0x72')]},'attributes':['id'],'include':[{'model':db[_0x4a27('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4a27('0x21')](handleEntityNotFound(_0x4eabd7,null))[_0x4a27('0x21')](function(_0x37fadb){var _0x56d7ac=_['map'](_0x37fadb,'id');var _0x4da1aa=[];var _0x359ccf=[];var _0x4aa944=squel[_0x4a27('0x7e')]();_0x4aa944[_0x4a27('0x7f')]('tq.TeamId')[_0x4a27('0x80')](_0x4a27('0x81'),'tq')[_0x4a27('0x82')](_0x4a27('0x83'),'ut',_0x4a27('0x84'))[_0x4a27('0x49')]('ChatQueueId\x20=\x20?',_0x3214d6[_0x4a27('0x54')]['id']);for(var _0x43b3d0=0x0;_0x43b3d0<_0x37fadb['length'];_0x43b3d0+=0x1){let _0x28b49b=_0x37fadb[_0x43b3d0];for(var _0x427d58=0x0;_0x427d58<_0x28b49b['Agents'][_0x4a27('0x63')];_0x427d58+=0x1){let _0x1de678=_0x28b49b['Agents'][_0x427d58];var _0x20a61e=_0x4aa944[_0x4a27('0x85')]();_0x20a61e[_0x4a27('0x49')](_0x4a27('0x86'),_0x1de678['id']);_0x359ccf[_0x4a27('0x87')](db['sequelize'][_0x4a27('0x41')](_0x20a61e[_0x4a27('0x88')](),{'type':db[_0x4a27('0x78')]['QueryTypes'][_0x4a27('0x89')]})['then'](function(_0x2eea04){if(_0x2eea04['length']===0x1){return _0x1de678['id'];}else{var _0x329d15=_['every'](_[_0x4a27('0x3c')](_0x2eea04,_0x4a27('0x8a')),function(_0x5cc9e3){return _['includes'](_0x56d7ac,_0x5cc9e3);});if(_0x329d15){return _0x1de678['id'];}}}));}}return BPromise[_0x4a27('0x8b')](_0x359ccf)[_0x4a27('0x21')](function(_0x585fbc){_0x4da1aa=_(_0x4da1aa)[_0x4a27('0x8c')](_0x585fbc)[_0x4a27('0x8d')]()[_0x4a27('0x8e')]();return db[_0x4a27('0x3d')][_0x4a27('0x5c')]({'where':{'id':_0x3214d6['params']['id']}})[_0x4a27('0x21')](function(_0x13ba10){return db[_0x4a27('0x78')][_0x4a27('0x79')](function(_0x662875){return _0x13ba10[_0x4a27('0x7d')](_0x3214d6['query']['ids'],{'transaction':_0x662875})[_0x4a27('0x21')](function(){if(!_[_0x4a27('0x8f')](_0x4da1aa)){return _0x13ba10[_0x4a27('0x90')](_0x4da1aa,{'transaction':_0x662875});}})[_0x4a27('0x21')](function(){_0x4da1aa[_0x4a27('0x91')](function(_0x97dbdb){socket[_0x4a27('0x7b')](_0x4a27('0x92'),{'UserId':_0x97dbdb,'ChatQueueId':_0x13ba10['id']});});});});});});})[_0x4a27('0x21')](respondWithStatusCode(_0x4eabd7,null))[_0x4a27('0x52')](handleError(_0x4eabd7,null));};exports[_0x4a27('0x93')]=function(_0x12924b,_0x11b218,_0x13fef0){return db['ChatQueue'][_0x4a27('0x5c')]({'where':{'id':_0x12924b['params']['id']}})['then'](handleEntityNotFound(_0x11b218,null))[_0x4a27('0x21')](function(_0x34cdf6){if(_0x34cdf6){return _0x34cdf6[_0x4a27('0x93')](_0x12924b['body'][_0x4a27('0x72')],_['omit'](_0x12924b[_0x4a27('0x57')],['ids','id'])||{})[_0x4a27('0x94')](function(_0x494565){for(var _0x63b55d=0x0;_0x63b55d<_0x12924b[_0x4a27('0x57')][_0x4a27('0x72')][_0x4a27('0x63')];_0x63b55d+=0x1){socket[_0x4a27('0x7b')]('userChatQueue:save',{'UserId':Number(_0x12924b[_0x4a27('0x57')][_0x4a27('0x72')][_0x63b55d]),'ChatQueueId':Number(_0x12924b[_0x4a27('0x54')]['id'])});}return _0x494565;});}})[_0x4a27('0x21')](respondWithResult(_0x11b218,null))[_0x4a27('0x52')](handleError(_0x11b218,null));};exports[_0x4a27('0x90')]=function(_0x1d2ca5,_0x4178e0,_0x17b3db){return db[_0x4a27('0x3d')][_0x4a27('0x5c')]({'where':{'id':_0x1d2ca5[_0x4a27('0x54')]['id']}})[_0x4a27('0x21')](handleEntityNotFound(_0x4178e0,null))[_0x4a27('0x21')](function(_0x2d04bf){if(_0x2d04bf){return _0x2d04bf[_0x4a27('0x90')](_0x1d2ca5[_0x4a27('0x41')][_0x4a27('0x72')])[_0x4a27('0x21')](function(){if(_[_0x4a27('0x95')](_0x1d2ca5[_0x4a27('0x41')][_0x4a27('0x72')])){for(var _0x55806f=0x0;_0x55806f<_0x1d2ca5[_0x4a27('0x41')][_0x4a27('0x72')][_0x4a27('0x63')];_0x55806f+=0x1){socket[_0x4a27('0x7b')](_0x4a27('0x92'),{'UserId':Number(_0x1d2ca5['query'][_0x4a27('0x72')][_0x55806f]),'ChatQueueId':Number(_0x1d2ca5[_0x4a27('0x54')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x1d2ca5['query'][_0x4a27('0x72')]),'ChatQueueId':Number(_0x1d2ca5[_0x4a27('0x54')]['id'])});}});}})[_0x4a27('0x21')](respondWithStatusCode(_0x4178e0,null))[_0x4a27('0x52')](handleError(_0x4178e0,null));};exports[_0x4a27('0x96')]=function(_0x1388cc,_0x8a0ff2,_0x3eb9d2){var _0x238fc2={};var _0x49de68={};var _0x440ca5;var _0x38a2e1;return db['ChatQueue'][_0x4a27('0x6d')]({'where':{'id':_0x1388cc[_0x4a27('0x54')]['id']}})[_0x4a27('0x21')](handleEntityNotFound(_0x8a0ff2,null))[_0x4a27('0x21')](function(_0x150d6a){if(_0x150d6a){_0x440ca5=_0x150d6a;_0x49de68[_0x4a27('0x40')]=_[_0x4a27('0x42')](db['User'][_0x4a27('0x55')]);_0x49de68[_0x4a27('0x41')]=_['keys'](_0x1388cc[_0x4a27('0x41')]);_0x49de68['filters']=_[_0x4a27('0x44')](_0x49de68[_0x4a27('0x40')],_0x49de68[_0x4a27('0x41')]);_0x238fc2['attributes']=_[_0x4a27('0x44')](_0x49de68['model'],qs['fields'](_0x1388cc[_0x4a27('0x41')][_0x4a27('0x45')]));_0x238fc2[_0x4a27('0x46')]=_0x238fc2[_0x4a27('0x46')]['length']?_0x238fc2[_0x4a27('0x46')]:_0x49de68[_0x4a27('0x40')];_0x238fc2[_0x4a27('0x47')]=qs[_0x4a27('0x48')](_0x1388cc[_0x4a27('0x41')][_0x4a27('0x48')]);_0x238fc2[_0x4a27('0x49')]=qs[_0x4a27('0x43')](_['pick'](_0x1388cc[_0x4a27('0x41')],_0x49de68[_0x4a27('0x43')]));if(_0x1388cc['query'][_0x4a27('0x4a')]){_0x238fc2[_0x4a27('0x49')]=_[_0x4a27('0x4c')](_0x238fc2[_0x4a27('0x49')],{'$or':_[_0x4a27('0x3c')](_0x238fc2[_0x4a27('0x46')],function(_0x6bd208){var _0x3922f1={};_0x3922f1[_0x6bd208]={'$like':'%'+_0x1388cc[_0x4a27('0x41')][_0x4a27('0x4a')]+'%'};return _0x3922f1;})});}_0x238fc2=_[_0x4a27('0x4c')]({},_0x238fc2,_0x1388cc[_0x4a27('0x4d')]);return _0x440ca5[_0x4a27('0x96')](_0x238fc2);}})['then'](function(_0x40f8bf){if(_0x40f8bf){_0x38a2e1=_0x40f8bf['length'];if(!_0x1388cc[_0x4a27('0x41')][_0x4a27('0x64')]('nolimit')){_0x238fc2[_0x4a27('0x30')]=qs[_0x4a27('0x30')](_0x1388cc[_0x4a27('0x41')]['limit']);_0x238fc2[_0x4a27('0x2e')]=qs['offset'](_0x1388cc['query'][_0x4a27('0x2e')]);}return _0x440ca5[_0x4a27('0x96')](_0x238fc2);}})['then'](function(_0x24c69a){if(_0x24c69a){return _0x24c69a?{'count':_0x38a2e1,'rows':_0x24c69a}:null;}})[_0x4a27('0x21')](respondWithResult(_0x8a0ff2,null))[_0x4a27('0x52')](handleError(_0x8a0ff2,null));}; \ No newline at end of file +var _0xb7a5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','get','ChatQueues','UserProfileResource','destroy','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','params','Team','addTeams','ids','Agents','interface','flatMap','transaction','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','omit','isArray','emit','getAgents','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb7a5,0x1bf));var _0x5b7a=function(_0x2d8dfb,_0x1768b5){_0x2d8dfb=_0x2d8dfb-0x0;var _0x59b6a6=_0xb7a5[_0x2d8dfb];return _0x59b6a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b7a('0x0'));var zipdir=require(_0x5b7a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b7a('0x2'));var moment=require(_0x5b7a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5b7a('0x4'));var util=require('util');var path=require(_0x5b7a('0x5'));var sox=require(_0x5b7a('0x6'));var csv=require(_0x5b7a('0x7'));var ejs=require(_0x5b7a('0x8'));var fs=require('fs');var fs_extra=require(_0x5b7a('0x9'));var _=require(_0x5b7a('0xa'));var squel=require(_0x5b7a('0xb'));var crypto=require(_0x5b7a('0xc'));var jsforce=require(_0x5b7a('0xd'));var deskjs=require(_0x5b7a('0xe'));var toCsv=require(_0x5b7a('0x7'));var querystring=require('querystring');var Papa=require(_0x5b7a('0xf'));var Redis=require(_0x5b7a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b7a('0x11'));var as=require(_0x5b7a('0x12'));var hardwareService=require(_0x5b7a('0x13'));var logger=require(_0x5b7a('0x14'))(_0x5b7a('0x15'));var utils=require(_0x5b7a('0x16'));var config=require(_0x5b7a('0x17'));var licenseUtil=require(_0x5b7a('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5b7a('0x19')](config[_0x5b7a('0x1a')],{'host':_0x5b7a('0x1b'),'port':0x18eb});var socket=require(_0x5b7a('0x1c'))(new Redis(config['redis']));require(_0x5b7a('0x1d'))[_0x5b7a('0x1e')](socket);var jayson=require(_0x5b7a('0x1f'));var client=jayson['client'][_0x5b7a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x37dd33,_0x5288a9,_0x5f4aff,_0x501502){return new BPromise(function(_0x20007c,_0x3a062e){var _0x1e8b08=_0x501502||client;return _0x1e8b08[_0x5b7a('0x21')](_0x37dd33,_0x5f4aff)[_0x5b7a('0x22')](function(_0x390a33){logger['info'](_0x5b7a('0x23'),_0x5288a9,_0x5b7a('0x24'));logger[_0x5b7a('0x25')](_0x5b7a('0x26'),_0x5288a9,_0x5b7a('0x24'),JSON[_0x5b7a('0x27')](_0x390a33));if(_0x390a33['error']){if(_0x390a33[_0x5b7a('0x28')][_0x5b7a('0x29')]===0x1f4){logger[_0x5b7a('0x28')]('ChatQueue,\x20%s,\x20%s',_0x5288a9,_0x390a33[_0x5b7a('0x28')][_0x5b7a('0x2a')]);return _0x3a062e(_0x390a33['error']['message']);}logger['error'](_0x5b7a('0x23'),_0x5288a9,_0x390a33['error'][_0x5b7a('0x2a')]);return _0x20007c(_0x390a33[_0x5b7a('0x28')][_0x5b7a('0x2a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5288a9,_0x5b7a('0x24'));_0x20007c(_0x390a33[_0x5b7a('0x2b')][_0x5b7a('0x2a')]);}})[_0x5b7a('0x2c')](function(_0x65e050){logger[_0x5b7a('0x28')](_0x5b7a('0x23'),_0x5288a9,_0x65e050);_0x3a062e(_0x65e050);});});}function respondWithStatusCode(_0x3f2d8c,_0x42c91d){_0x42c91d=_0x42c91d||0xcc;return function(_0x586467){if(_0x586467){return _0x3f2d8c[_0x5b7a('0x2d')](_0x42c91d);}return _0x3f2d8c['status'](_0x42c91d)[_0x5b7a('0x2e')]();};}function respondWithResult(_0x22d9c8,_0x1227d1){_0x1227d1=_0x1227d1||0xc8;return function(_0x252c97){if(_0x252c97){return _0x22d9c8[_0x5b7a('0x2f')](_0x1227d1)['json'](_0x252c97);}};}function respondWithFilteredResult(_0x190f89,_0x570106){return function(_0x48856e){if(_0x48856e){var _0x4010d4=typeof _0x570106[_0x5b7a('0x30')]==='undefined'&&typeof _0x570106[_0x5b7a('0x31')]===_0x5b7a('0x32');var _0x52e00e=_0x48856e[_0x5b7a('0x33')];var _0x28d60a=_0x4010d4?0x0:_0x570106['offset'];var _0xc4bf9f=_0x4010d4?_0x48856e[_0x5b7a('0x33')]:_0x570106['offset']+_0x570106['limit'];var _0x1aabdb;if(_0xc4bf9f>=_0x52e00e){_0xc4bf9f=_0x52e00e;_0x1aabdb=0xc8;}else{_0x1aabdb=0xce;}_0x190f89[_0x5b7a('0x2f')](_0x1aabdb);return _0x190f89[_0x5b7a('0x34')](_0x5b7a('0x35'),_0x28d60a+'-'+_0xc4bf9f+'/'+_0x52e00e)[_0x5b7a('0x36')](_0x48856e);}return null;};}function patchUpdates(_0xd7800d){return function(_0x5aecd9){try{jsonpatch['apply'](_0x5aecd9,_0xd7800d,!![]);}catch(_0x5e18c6){return BPromise[_0x5b7a('0x37')](_0x5e18c6);}return _0x5aecd9[_0x5b7a('0x38')]();};}function saveUpdates(_0x163860,_0x5bf348){return function(_0x4a6828){if(_0x4a6828){return _0x4a6828[_0x5b7a('0x39')](_0x163860)[_0x5b7a('0x22')](function(_0x48d007){return _0x48d007;});}return null;};}function removeEntity(_0xb49571,_0x5a88fa){return function(_0x158c41){if(_0x158c41){return _0x158c41['destroy']()['then'](function(){var _0x5d2e29=_0x158c41[_0x5b7a('0x3a')]({'plain':!![]});var _0x5f3a1d=_0x5b7a('0x3b');return db[_0x5b7a('0x3c')][_0x5b7a('0x3d')]({'where':{'type':_0x5f3a1d,'resourceId':_0x5d2e29['id']}})[_0x5b7a('0x22')](function(){return _0x158c41;});})[_0x5b7a('0x22')](function(){_0xb49571[_0x5b7a('0x2f')](0xcc)[_0x5b7a('0x2e')]();});}};}function handleEntityNotFound(_0x11693f,_0x7f4e35){return function(_0x4a4582){if(!_0x4a4582){_0x11693f[_0x5b7a('0x2d')](0x194);}return _0x4a4582;};}function handleError(_0x5d6b91,_0x157365){_0x157365=_0x157365||0x1f4;return function(_0x2b82b0){logger[_0x5b7a('0x28')](_0x2b82b0[_0x5b7a('0x3e')]);if(_0x2b82b0[_0x5b7a('0x3f')]){delete _0x2b82b0[_0x5b7a('0x3f')];}_0x5d6b91[_0x5b7a('0x2f')](_0x157365)['send'](_0x2b82b0);};}exports['index']=function(_0x3ead99,_0x418582){var _0x274cbb={},_0xc88028={},_0x430b8c={'count':0x0,'rows':[]};var _0x1233d4=_[_0x5b7a('0x40')](db[_0x5b7a('0x41')][_0x5b7a('0x42')],function(_0x3eb94b){return{'name':_0x3eb94b[_0x5b7a('0x43')],'type':_0x3eb94b[_0x5b7a('0x44')][_0x5b7a('0x45')]};});_0xc88028[_0x5b7a('0x46')]=_[_0x5b7a('0x40')](_0x1233d4,'name');_0xc88028['query']=_['keys'](_0x3ead99[_0x5b7a('0x47')]);_0xc88028['filters']=_[_0x5b7a('0x48')](_0xc88028[_0x5b7a('0x46')],_0xc88028[_0x5b7a('0x47')]);_0x274cbb[_0x5b7a('0x49')]=_[_0x5b7a('0x48')](_0xc88028[_0x5b7a('0x46')],qs[_0x5b7a('0x4a')](_0x3ead99[_0x5b7a('0x47')]['fields']));_0x274cbb[_0x5b7a('0x49')]=_0x274cbb[_0x5b7a('0x49')]['length']?_0x274cbb[_0x5b7a('0x49')]:_0xc88028[_0x5b7a('0x46')];if(!_0x3ead99[_0x5b7a('0x47')][_0x5b7a('0x4b')](_0x5b7a('0x4c'))){_0x274cbb[_0x5b7a('0x31')]=qs[_0x5b7a('0x31')](_0x3ead99['query']['limit']);_0x274cbb[_0x5b7a('0x30')]=qs[_0x5b7a('0x30')](_0x3ead99[_0x5b7a('0x47')][_0x5b7a('0x30')]);}_0x274cbb[_0x5b7a('0x4d')]=qs[_0x5b7a('0x4e')](_0x3ead99[_0x5b7a('0x47')][_0x5b7a('0x4e')]);_0x274cbb[_0x5b7a('0x4f')]=qs[_0x5b7a('0x50')](_[_0x5b7a('0x51')](_0x3ead99[_0x5b7a('0x47')],_0xc88028[_0x5b7a('0x50')]),_0x1233d4);if(_0x3ead99[_0x5b7a('0x47')][_0x5b7a('0x52')]){_0x274cbb['where']=_[_0x5b7a('0x53')](_0x274cbb['where'],{'$or':_[_0x5b7a('0x40')](_0x1233d4,function(_0x34e57f){if(_0x34e57f['type']!==_0x5b7a('0x54')){var _0x5d6f30={};_0x5d6f30[_0x34e57f[_0x5b7a('0x3f')]]={'$like':'%'+_0x3ead99['query'][_0x5b7a('0x52')]+'%'};return _0x5d6f30;}})});}_0x274cbb=_[_0x5b7a('0x53')]({},_0x274cbb,_0x3ead99[_0x5b7a('0x55')]);var _0x43c200={'where':_0x274cbb['where']};return db[_0x5b7a('0x41')][_0x5b7a('0x33')](_0x43c200)[_0x5b7a('0x22')](function(_0xe2d3e4){_0x430b8c[_0x5b7a('0x33')]=_0xe2d3e4;if(_0x3ead99[_0x5b7a('0x47')][_0x5b7a('0x56')]){_0x274cbb[_0x5b7a('0x57')]=[{'all':!![]}];}return db[_0x5b7a('0x41')][_0x5b7a('0x58')](_0x274cbb);})['then'](function(_0x3b3085){_0x430b8c[_0x5b7a('0x59')]=_0x3b3085;return _0x430b8c;})[_0x5b7a('0x22')](respondWithFilteredResult(_0x418582,_0x274cbb))[_0x5b7a('0x2c')](handleError(_0x418582,null));};exports['show']=function(_0x12cbb7,_0x404049){var _0x2e631a={'raw':!![],'where':{'id':_0x12cbb7['params']['id']}},_0x10d27e={};_0x10d27e['model']=_[_0x5b7a('0x5a')](db[_0x5b7a('0x41')]['rawAttributes']);_0x10d27e['query']=_[_0x5b7a('0x5a')](_0x12cbb7['query']);_0x10d27e[_0x5b7a('0x50')]=_[_0x5b7a('0x48')](_0x10d27e[_0x5b7a('0x46')],_0x10d27e['query']);_0x2e631a[_0x5b7a('0x49')]=_['intersection'](_0x10d27e[_0x5b7a('0x46')],qs[_0x5b7a('0x4a')](_0x12cbb7[_0x5b7a('0x47')][_0x5b7a('0x4a')]));_0x2e631a[_0x5b7a('0x49')]=_0x2e631a[_0x5b7a('0x49')][_0x5b7a('0x5b')]?_0x2e631a[_0x5b7a('0x49')]:_0x10d27e[_0x5b7a('0x46')];if(_0x12cbb7['query'][_0x5b7a('0x56')]){_0x2e631a[_0x5b7a('0x57')]=[{'all':!![]}];}_0x2e631a=_[_0x5b7a('0x53')]({},_0x2e631a,_0x12cbb7['options']);return db[_0x5b7a('0x41')][_0x5b7a('0x5c')](_0x2e631a)['then'](handleEntityNotFound(_0x404049,null))[_0x5b7a('0x22')](respondWithResult(_0x404049,null))[_0x5b7a('0x2c')](handleError(_0x404049,null));};exports[_0x5b7a('0x5d')]=function(_0x451223,_0x129b93){return db['ChatQueue'][_0x5b7a('0x5d')](_0x451223[_0x5b7a('0x5e')],{})[_0x5b7a('0x22')](function(_0x5a96d6){var _0x7a7a76=_0x451223[_0x5b7a('0x5f')][_0x5b7a('0x3a')]({'plain':!![]});if(!_0x7a7a76)throw new Error(_0x5b7a('0x60'));if(_0x7a7a76[_0x5b7a('0x61')]===_0x5b7a('0x5f')){var _0x14a25f=_0x5a96d6[_0x5b7a('0x3a')]({'plain':!![]});var _0x2da68f='ChatQueues';return db[_0x5b7a('0x62')][_0x5b7a('0x5c')]({'where':{'name':_0x2da68f,'userProfileId':_0x7a7a76[_0x5b7a('0x63')]},'raw':!![]})[_0x5b7a('0x22')](function(_0x3c60a5){if(_0x3c60a5&&_0x3c60a5[_0x5b7a('0x64')]===0x0){return db[_0x5b7a('0x3c')][_0x5b7a('0x5d')]({'name':_0x14a25f[_0x5b7a('0x3f')],'resourceId':_0x14a25f['id'],'type':_0x3c60a5['name'],'sectionId':_0x3c60a5['id']},{})['then'](function(){return _0x5a96d6;});}else{return _0x5a96d6;}})['catch'](function(_0x54fa37){logger[_0x5b7a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54fa37);throw _0x54fa37;});}return _0x5a96d6;})[_0x5b7a('0x22')](respondWithResult(_0x129b93,0xc9))[_0x5b7a('0x2c')](handleError(_0x129b93,null));};exports[_0x5b7a('0x39')]=function(_0x33ad36,_0x484dd1){if(_0x33ad36[_0x5b7a('0x5e')]['id']){delete _0x33ad36[_0x5b7a('0x5e')]['id'];}return db['ChatQueue'][_0x5b7a('0x5c')]({'where':{'id':_0x33ad36['params']['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x484dd1,null))[_0x5b7a('0x22')](saveUpdates(_0x33ad36[_0x5b7a('0x5e')],null))['then'](respondWithResult(_0x484dd1,null))[_0x5b7a('0x2c')](handleError(_0x484dd1,null));};exports[_0x5b7a('0x3d')]=function(_0xa057d,_0x49c3d8){return db[_0x5b7a('0x41')][_0x5b7a('0x5c')]({'where':{'id':_0xa057d['params']['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x49c3d8,null))[_0x5b7a('0x22')](removeEntity(_0x49c3d8,null))[_0x5b7a('0x2c')](handleError(_0x49c3d8,null));};exports[_0x5b7a('0x65')]=function(_0x243855,_0x226897){return db['ChatQueue'][_0x5b7a('0x65')]()[_0x5b7a('0x22')](respondWithResult(_0x226897,null))[_0x5b7a('0x2c')](handleError(_0x226897,null));};exports[_0x5b7a('0x66')]=function(_0x17de3d,_0x30a66b,_0xc8e8a3){var _0x2d8dcd={'raw':!![],'where':{}},_0x5e3b6d={},_0x489c93;return db['ChatQueue'][_0x5b7a('0x67')]({'where':{'id':_0x17de3d['params']['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x30a66b,null))['then'](function(_0x2a2d89){if(_0x2a2d89){_0x489c93=_0x2a2d89['get']({'plain':!![]});_0x5e3b6d[_0x5b7a('0x46')]=_[_0x5b7a('0x5a')](db[_0x5b7a('0x68')]['rawAttributes']);_0x5e3b6d['query']=_['keys'](_0x17de3d[_0x5b7a('0x47')]);_0x5e3b6d[_0x5b7a('0x50')]=_[_0x5b7a('0x48')](_0x5e3b6d[_0x5b7a('0x46')],_0x5e3b6d[_0x5b7a('0x47')]);_0x2d8dcd[_0x5b7a('0x49')]=_['intersection'](_0x5e3b6d[_0x5b7a('0x46')],qs[_0x5b7a('0x4a')](_0x17de3d[_0x5b7a('0x47')][_0x5b7a('0x4a')]));_0x2d8dcd[_0x5b7a('0x49')]=_0x2d8dcd[_0x5b7a('0x49')][_0x5b7a('0x5b')]?_0x2d8dcd[_0x5b7a('0x49')]:_0x5e3b6d[_0x5b7a('0x46')];if(!_0x17de3d[_0x5b7a('0x47')][_0x5b7a('0x4b')](_0x5b7a('0x4c'))){_0x2d8dcd[_0x5b7a('0x31')]=qs[_0x5b7a('0x31')](_0x17de3d['query'][_0x5b7a('0x31')]);_0x2d8dcd[_0x5b7a('0x30')]=qs[_0x5b7a('0x30')](_0x17de3d[_0x5b7a('0x47')][_0x5b7a('0x30')]);}_0x2d8dcd[_0x5b7a('0x4d')]=qs[_0x5b7a('0x4e')](_0x17de3d[_0x5b7a('0x47')]['sort']);_0x2d8dcd['where']=qs[_0x5b7a('0x50')](_['pick'](_0x17de3d['query'],_0x5e3b6d[_0x5b7a('0x50')]));_0x2d8dcd[_0x5b7a('0x4f')][_0x5b7a('0x69')]=_0x2a2d89['id'];if(_0x17de3d[_0x5b7a('0x47')][_0x5b7a('0x52')]){_0x2d8dcd['where']=_[_0x5b7a('0x53')](_0x2d8dcd[_0x5b7a('0x4f')],{'$or':_['map'](_0x2d8dcd[_0x5b7a('0x49')],function(_0x494ad4){var _0x2bb4a6={};_0x2bb4a6[_0x494ad4]={'$like':'%'+_0x17de3d[_0x5b7a('0x47')][_0x5b7a('0x52')]+'%'};return _0x2bb4a6;})});}_0x2d8dcd=_[_0x5b7a('0x53')]({},_0x2d8dcd,_0x17de3d[_0x5b7a('0x55')]);return db[_0x5b7a('0x68')][_0x5b7a('0x58')](_0x2d8dcd);}})['then'](function(_0x4dc286){if(_0x4dc286){return db[_0x5b7a('0x6a')][_0x5b7a('0x6b')]({'where':{'id':_[_0x5b7a('0x40')](_0x4dc286,_0x5b7a('0x6c')),'role':_0x5b7a('0x6d')},'attributes':['id','name',_0x5b7a('0x6e'),_0x5b7a('0x6f'),_0x5b7a('0x70')]});}})[_0x5b7a('0x22')](function(_0x1e8e88){if(_0x1e8e88){return{'count':_0x1e8e88[_0x5b7a('0x33')],'rows':_[_0x5b7a('0x40')](_0x1e8e88['rows'],function(_0xa05e1){return{'membername':_0xa05e1['name'],'UserId':_0xa05e1['id'],'queue_name':_0x489c93[_0x5b7a('0x3f')],'ChatQueueId':_0x489c93['id'],'interface':util[_0x5b7a('0x71')](_0x5b7a('0x72'),_0x5b7a('0x73'),_0xa05e1[_0x5b7a('0x3f')]),'penalty':0x0,'paused':_0xa05e1[_0x5b7a('0x6e')],'createdAt':_0xa05e1[_0x5b7a('0x70')],'updatedAt':_0xa05e1[_0x5b7a('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b7a('0x22')](respondWithFilteredResult(_0x30a66b,_0x2d8dcd))[_0x5b7a('0x2c')](handleError(_0x30a66b,null));};exports[_0x5b7a('0x74')]=function(_0x28e7fa,_0x372feb,_0x12b8df){var _0x3109c5={};var _0x328186={};var _0x47bce;var _0x2582cb;return db[_0x5b7a('0x41')][_0x5b7a('0x67')]({'where':{'id':_0x28e7fa[_0x5b7a('0x75')]['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x372feb,null))[_0x5b7a('0x22')](function(_0x46c6ed){if(_0x46c6ed){_0x47bce=_0x46c6ed;_0x328186['model']=_[_0x5b7a('0x5a')](db[_0x5b7a('0x76')]['rawAttributes']);_0x328186['query']=_[_0x5b7a('0x5a')](_0x28e7fa[_0x5b7a('0x47')]);_0x328186['filters']=_[_0x5b7a('0x48')](_0x328186[_0x5b7a('0x46')],_0x328186[_0x5b7a('0x47')]);_0x3109c5[_0x5b7a('0x49')]=_['intersection'](_0x328186[_0x5b7a('0x46')],qs[_0x5b7a('0x4a')](_0x28e7fa['query'][_0x5b7a('0x4a')]));_0x3109c5[_0x5b7a('0x49')]=_0x3109c5[_0x5b7a('0x49')][_0x5b7a('0x5b')]?_0x3109c5[_0x5b7a('0x49')]:_0x328186[_0x5b7a('0x46')];_0x3109c5['order']=qs[_0x5b7a('0x4e')](_0x28e7fa['query'][_0x5b7a('0x4e')]);_0x3109c5[_0x5b7a('0x4f')]=qs[_0x5b7a('0x50')](_[_0x5b7a('0x51')](_0x28e7fa[_0x5b7a('0x47')],_0x328186[_0x5b7a('0x50')]));if(_0x28e7fa[_0x5b7a('0x47')][_0x5b7a('0x52')]){_0x3109c5[_0x5b7a('0x4f')]=_['merge'](_0x3109c5[_0x5b7a('0x4f')],{'$or':_[_0x5b7a('0x40')](_0x3109c5['attributes'],function(_0x19c68b){var _0x1465dc={};_0x1465dc[_0x19c68b]={'$like':'%'+_0x28e7fa['query'][_0x5b7a('0x52')]+'%'};return _0x1465dc;})});}_0x3109c5=_[_0x5b7a('0x53')]({},_0x3109c5,_0x28e7fa[_0x5b7a('0x55')]);return _0x47bce[_0x5b7a('0x74')](_0x3109c5);}})[_0x5b7a('0x22')](function(_0x45d5d8){if(_0x45d5d8){_0x2582cb=_0x45d5d8[_0x5b7a('0x5b')];if(!_0x28e7fa['query']['hasOwnProperty'](_0x5b7a('0x4c'))){_0x3109c5[_0x5b7a('0x31')]=qs[_0x5b7a('0x31')](_0x28e7fa[_0x5b7a('0x47')]['limit']);_0x3109c5[_0x5b7a('0x30')]=qs['offset'](_0x28e7fa[_0x5b7a('0x47')]['offset']);}return _0x47bce['getTeams'](_0x3109c5);}})[_0x5b7a('0x22')](function(_0x361e96){if(_0x361e96){return _0x361e96?{'count':_0x2582cb,'rows':_0x361e96}:null;}})[_0x5b7a('0x22')](respondWithResult(_0x372feb,null))[_0x5b7a('0x2c')](handleError(_0x372feb,null));};exports[_0x5b7a('0x77')]=function(_0x2ebb3d,_0x27928d,_0x127890){var _0x597337=_0x2ebb3d[_0x5b7a('0x5e')][_0x5b7a('0x78')];return db[_0x5b7a('0x76')][_0x5b7a('0x58')]({'where':{'id':_0x597337},'attributes':['id'],'include':[{'model':db[_0x5b7a('0x6a')],'as':_0x5b7a('0x79'),'attributes':['id','name','online','voicePause',_0x5b7a('0x7a')],'raw':!![]}]})['then'](function(_0x423d14){if(_0x423d14){var _0x330809=_[_0x5b7a('0x7b')](_0x423d14,function(_0x46f27e){var _0x4b894a=_0x46f27e[_0x5b7a('0x3a')]({'plain':!![]});return _0x4b894a[_0x5b7a('0x79')];});return db[_0x5b7a('0x41')][_0x5b7a('0x5c')]({'where':{'id':_0x2ebb3d[_0x5b7a('0x75')]['id']}})[_0x5b7a('0x22')](function(_0x9ad87c){return db['sequelize'][_0x5b7a('0x7c')](function(_0xcd5d37){return _0x9ad87c[_0x5b7a('0x77')](_0x597337,{'transaction':_0xcd5d37})[_0x5b7a('0x22')](function(){return BPromise['each'](_0x330809,function(_0x3d28dc){return db[_0x5b7a('0x68')]['findOrCreate']({'where':{'UserId':_0x3d28dc['id'],'ChatQueueId':_0x2ebb3d['params']['id']},'transaction':_0xcd5d37});});})['then'](function(){_0x330809[_0x5b7a('0x7d')](function(_0x44756d){socket['emit'](_0x5b7a('0x7e'),{'UserId':_0x44756d['id'],'ChatQueueId':_0x9ad87c['id']});});});});});}})[_0x5b7a('0x22')](respondWithStatusCode(_0x27928d,null))[_0x5b7a('0x2c')](handleError(_0x27928d,null));};exports[_0x5b7a('0x7f')]=function(_0x136616,_0x4e2753,_0x26fb1a){return db[_0x5b7a('0x76')]['findAll']({'where':{'id':_0x136616['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5b7a('0x79'),'attributes':['id'],'raw':!![]}]})[_0x5b7a('0x22')](handleEntityNotFound(_0x4e2753,null))[_0x5b7a('0x22')](function(_0x202ad0){var _0x4eb133=_[_0x5b7a('0x40')](_0x202ad0,'id');var _0x353fea=[];var _0x22037e=[];var _0x32a273=squel[_0x5b7a('0x80')]();_0x32a273[_0x5b7a('0x81')](_0x5b7a('0x82'))[_0x5b7a('0x83')]('team_has_chat_queues','tq')[_0x5b7a('0x84')](_0x5b7a('0x85'),'ut',_0x5b7a('0x86'))[_0x5b7a('0x4f')](_0x5b7a('0x87'),_0x136616[_0x5b7a('0x75')]['id']);for(var _0x439c45=0x0;_0x439c45<_0x202ad0['length'];_0x439c45+=0x1){let _0x5a63b4=_0x202ad0[_0x439c45];for(var _0x1bf28b=0x0;_0x1bf28b<_0x5a63b4[_0x5b7a('0x79')][_0x5b7a('0x5b')];_0x1bf28b+=0x1){let _0x574f8a=_0x5a63b4[_0x5b7a('0x79')][_0x1bf28b];var _0x547c9d=_0x32a273['clone']();_0x547c9d[_0x5b7a('0x4f')](_0x5b7a('0x88'),_0x574f8a['id']);_0x22037e[_0x5b7a('0x89')](db[_0x5b7a('0x8a')]['query'](_0x547c9d[_0x5b7a('0x8b')](),{'type':db[_0x5b7a('0x8a')][_0x5b7a('0x8c')][_0x5b7a('0x8d')]})[_0x5b7a('0x22')](function(_0x561e7a){if(_0x561e7a[_0x5b7a('0x5b')]===0x1){return _0x574f8a['id'];}else{var _0x3d7e3b=_[_0x5b7a('0x8e')](_[_0x5b7a('0x40')](_0x561e7a,_0x5b7a('0x8f')),function(_0x487164){return _[_0x5b7a('0x90')](_0x4eb133,_0x487164);});if(_0x3d7e3b){return _0x574f8a['id'];}}}));}}return BPromise[_0x5b7a('0x91')](_0x22037e)[_0x5b7a('0x22')](function(_0x1059c0){_0x353fea=_(_0x353fea)[_0x5b7a('0x92')](_0x1059c0)[_0x5b7a('0x93')]()['value']();return db['ChatQueue'][_0x5b7a('0x5c')]({'where':{'id':_0x136616[_0x5b7a('0x75')]['id']}})[_0x5b7a('0x22')](function(_0x307523){return db[_0x5b7a('0x8a')][_0x5b7a('0x7c')](function(_0x54b1fb){return _0x307523[_0x5b7a('0x7f')](_0x136616[_0x5b7a('0x47')]['ids'],{'transaction':_0x54b1fb})[_0x5b7a('0x22')](function(){if(!_['isEmpty'](_0x353fea)){return _0x307523[_0x5b7a('0x94')](_0x353fea,{'transaction':_0x54b1fb});}})[_0x5b7a('0x22')](function(){_0x353fea[_0x5b7a('0x7d')](function(_0x33ab00){socket['emit'](_0x5b7a('0x95'),{'UserId':_0x33ab00,'ChatQueueId':_0x307523['id']});});});});});});})['then'](respondWithStatusCode(_0x4e2753,null))['catch'](handleError(_0x4e2753,null));};exports[_0x5b7a('0x96')]=function(_0x391a92,_0x1dd8da,_0x41af76){return db[_0x5b7a('0x41')][_0x5b7a('0x5c')]({'where':{'id':_0x391a92[_0x5b7a('0x75')]['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x1dd8da,null))['then'](function(_0xaec571){if(_0xaec571){return _0xaec571[_0x5b7a('0x96')](_0x391a92[_0x5b7a('0x5e')][_0x5b7a('0x78')],_[_0x5b7a('0x97')](_0x391a92[_0x5b7a('0x5e')],[_0x5b7a('0x78'),'id'])||{})['spread'](function(_0x560f4c){for(var _0x5874fe=0x0;_0x5874fe<_0x391a92['body']['ids'][_0x5b7a('0x5b')];_0x5874fe+=0x1){socket['emit'](_0x5b7a('0x7e'),{'UserId':Number(_0x391a92[_0x5b7a('0x5e')][_0x5b7a('0x78')][_0x5874fe]),'ChatQueueId':Number(_0x391a92[_0x5b7a('0x75')]['id'])});}return _0x560f4c;});}})[_0x5b7a('0x22')](respondWithResult(_0x1dd8da,null))['catch'](handleError(_0x1dd8da,null));};exports[_0x5b7a('0x94')]=function(_0x4ecc07,_0x3fbff4,_0x345748){return db[_0x5b7a('0x41')]['find']({'where':{'id':_0x4ecc07[_0x5b7a('0x75')]['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x3fbff4,null))[_0x5b7a('0x22')](function(_0x210bf7){if(_0x210bf7){return _0x210bf7[_0x5b7a('0x94')](_0x4ecc07['query']['ids'])['then'](function(){if(_[_0x5b7a('0x98')](_0x4ecc07['query'][_0x5b7a('0x78')])){for(var _0x2cbe08=0x0;_0x2cbe08<_0x4ecc07[_0x5b7a('0x47')][_0x5b7a('0x78')]['length'];_0x2cbe08+=0x1){socket[_0x5b7a('0x99')](_0x5b7a('0x95'),{'UserId':Number(_0x4ecc07[_0x5b7a('0x47')][_0x5b7a('0x78')][_0x2cbe08]),'ChatQueueId':Number(_0x4ecc07[_0x5b7a('0x75')]['id'])});}}else{socket['emit'](_0x5b7a('0x95'),{'UserId':Number(_0x4ecc07[_0x5b7a('0x47')][_0x5b7a('0x78')]),'ChatQueueId':Number(_0x4ecc07[_0x5b7a('0x75')]['id'])});}});}})['then'](respondWithStatusCode(_0x3fbff4,null))[_0x5b7a('0x2c')](handleError(_0x3fbff4,null));};exports[_0x5b7a('0x9a')]=function(_0x3008f9,_0x2efca4,_0x322021){var _0x256251={};var _0x4664d3={};var _0x3c9021;var _0x4b1aad;return db[_0x5b7a('0x41')]['findOne']({'where':{'id':_0x3008f9['params']['id']}})[_0x5b7a('0x22')](handleEntityNotFound(_0x2efca4,null))[_0x5b7a('0x22')](function(_0x43e0d0){if(_0x43e0d0){_0x3c9021=_0x43e0d0;_0x4664d3[_0x5b7a('0x46')]=_[_0x5b7a('0x5a')](db[_0x5b7a('0x6a')]['rawAttributes']);_0x4664d3[_0x5b7a('0x47')]=_[_0x5b7a('0x5a')](_0x3008f9['query']);_0x4664d3[_0x5b7a('0x50')]=_[_0x5b7a('0x48')](_0x4664d3[_0x5b7a('0x46')],_0x4664d3[_0x5b7a('0x47')]);_0x256251['attributes']=_[_0x5b7a('0x48')](_0x4664d3['model'],qs[_0x5b7a('0x4a')](_0x3008f9[_0x5b7a('0x47')]['fields']));_0x256251[_0x5b7a('0x49')]=_0x256251[_0x5b7a('0x49')][_0x5b7a('0x5b')]?_0x256251[_0x5b7a('0x49')]:_0x4664d3[_0x5b7a('0x46')];_0x256251[_0x5b7a('0x4d')]=qs[_0x5b7a('0x4e')](_0x3008f9[_0x5b7a('0x47')]['sort']);_0x256251['where']=qs[_0x5b7a('0x50')](_['pick'](_0x3008f9['query'],_0x4664d3[_0x5b7a('0x50')]));if(_0x3008f9[_0x5b7a('0x47')][_0x5b7a('0x52')]){_0x256251[_0x5b7a('0x4f')]=_[_0x5b7a('0x53')](_0x256251[_0x5b7a('0x4f')],{'$or':_[_0x5b7a('0x40')](_0x256251[_0x5b7a('0x49')],function(_0x110217){var _0xae8662={};_0xae8662[_0x110217]={'$like':'%'+_0x3008f9['query'][_0x5b7a('0x52')]+'%'};return _0xae8662;})});}_0x256251=_[_0x5b7a('0x53')]({},_0x256251,_0x3008f9['options']);return _0x3c9021[_0x5b7a('0x9a')](_0x256251);}})['then'](function(_0x37046a){if(_0x37046a){_0x4b1aad=_0x37046a[_0x5b7a('0x5b')];if(!_0x3008f9[_0x5b7a('0x47')][_0x5b7a('0x4b')](_0x5b7a('0x4c'))){_0x256251[_0x5b7a('0x31')]=qs[_0x5b7a('0x31')](_0x3008f9[_0x5b7a('0x47')][_0x5b7a('0x31')]);_0x256251['offset']=qs[_0x5b7a('0x30')](_0x3008f9[_0x5b7a('0x47')][_0x5b7a('0x30')]);}return _0x3c9021[_0x5b7a('0x9a')](_0x256251);}})[_0x5b7a('0x22')](function(_0x3506b9){if(_0x3506b9){return _0x3506b9?{'count':_0x4b1aad,'rows':_0x3506b9}:null;}})[_0x5b7a('0x22')](respondWithResult(_0x2efca4,null))[_0x5b7a('0x2c')](handleError(_0x2efca4,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index aa548d2..5703406 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 _0xe458=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x385879,_0x3135be){var _0x5652ef=function(_0x560be5){while(--_0x560be5){_0x385879['push'](_0x385879['shift']());}};_0x5652ef(++_0x3135be);}(_0xe458,0x6c));var _0x8e45=function(_0xe46b62,_0x4c0026){_0xe46b62=_0xe46b62-0x0;var _0x502552=_0xe458[_0xe46b62];return _0x502552;};'use strict';var EventEmitter=require(_0x8e45('0x0'));var ChatQueue=require(_0x8e45('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8e45('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e45('0x3'),'afterDestroy':_0x8e45('0x4')};function emitEvent(_0x942c83){return function(_0x236d56,_0x517d7e,_0x499820){ChatQueueEvents['emit'](_0x942c83+':'+_0x236d56['id'],_0x236d56);ChatQueueEvents[_0x8e45('0x5')](_0x942c83,_0x236d56);_0x499820(null);};}for(var e in events){if(events[_0x8e45('0x6')](e)){var event=events[e];ChatQueue[_0x8e45('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xa93a=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','save','update'];(function(_0x4a0156,_0x26e36e){var _0x13f19e=function(_0x2e8d16){while(--_0x2e8d16){_0x4a0156['push'](_0x4a0156['shift']());}};_0x13f19e(++_0x26e36e);}(_0xa93a,0x16c));var _0xaa93=function(_0x31a198,_0x53a914){_0x31a198=_0x31a198-0x0;var _0x112841=_0xa93a[_0x31a198];return _0x112841;};'use strict';var EventEmitter=require(_0xaa93('0x0'));var ChatQueue=require(_0xaa93('0x1'))['db'][_0xaa93('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa93('0x3'),'afterUpdate':_0xaa93('0x4'),'afterDestroy':_0xaa93('0x5')};function emitEvent(_0x534d94){return function(_0x1a142e,_0x1baeff,_0x1810ca){ChatQueueEvents['emit'](_0x534d94+':'+_0x1a142e['id'],_0x1a142e);ChatQueueEvents[_0xaa93('0x6')](_0x534d94,_0x1a142e);_0x1810ca(null);};}for(var e in events){if(events[_0xaa93('0x7')](e)){var event=events[e];ChatQueue[_0xaa93('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 29ed419..f7be447 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 _0x30f0=['request-promise','path','rimraf','define','ChatQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x30f0,0x18b));var _0x030f=function(_0x33d8c7,_0x300227){_0x33d8c7=_0x33d8c7-0x0;var _0x2fe482=_0x30f0[_0x33d8c7];return _0x2fe482;};'use strict';var _=require(_0x030f('0x0'));var util=require('util');var logger=require(_0x030f('0x1'))(_0x030f('0x2'));var moment=require(_0x030f('0x3'));var BPromise=require(_0x030f('0x4'));var rp=require(_0x030f('0x5'));var fs=require('fs');var path=require(_0x030f('0x6'));var rimraf=require(_0x030f('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0xc9abc1,_0xe30dc1){return _0xc9abc1[_0x030f('0x8')](_0x030f('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0710=['../../config/environment','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x378f34,_0x43ed5a){var _0x2f19e6=function(_0x1bd0b5){while(--_0x1bd0b5){_0x378f34['push'](_0x378f34['shift']());}};_0x2f19e6(++_0x43ed5a);}(_0x0710,0x67));var _0x0071=function(_0x3a3aa2,_0x16fada){_0x3a3aa2=_0x3a3aa2-0x0;var _0x2beb2a=_0x0710[_0x3a3aa2];return _0x2beb2a;};'use strict';var _=require(_0x0071('0x0'));var util=require(_0x0071('0x1'));var logger=require(_0x0071('0x2'))(_0x0071('0x3'));var moment=require(_0x0071('0x4'));var BPromise=require(_0x0071('0x5'));var rp=require(_0x0071('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0071('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x24fcd7,_0x2b1aa9){return _0x24fcd7['define'](_0x0071('0x8'),attributes,{'tableName':_0x0071('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 7d0e2d4..6ca8182 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 _0x5a3c=['include','map','model','ChatQueue','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5a3c,0x176));var _0xc5a3=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5a3c[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var moment=require(_0xc5a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5a3('0x3'));var fs=require('fs');var Redis=require(_0xc5a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5a3('0x5'));var logger=require(_0xc5a3('0x6'))(_0xc5a3('0x7'));var config=require(_0xc5a3('0x8'));var jayson=require(_0xc5a3('0x9'));var client=jayson[_0xc5a3('0xa')][_0xc5a3('0xb')]({'port':0x232a});config[_0xc5a3('0xc')]=_[_0xc5a3('0xd')](config[_0xc5a3('0xc')],{'host':_0xc5a3('0xe'),'port':0x18eb});var socket=require(_0xc5a3('0xf'))(new Redis(config[_0xc5a3('0xc')]));require(_0xc5a3('0x10'))['register'](socket);function respondWithRpcPromise(_0x3fc7ce,_0x354369,_0x12411a){return new BPromise(function(_0x4406c1,_0x264554){return client[_0xc5a3('0x11')](_0x3fc7ce,_0x12411a)[_0xc5a3('0x12')](function(_0xcece45){logger[_0xc5a3('0x13')]('ChatQueue,\x20%s,\x20%s',_0x354369,_0xc5a3('0x14'));logger[_0xc5a3('0x15')](_0xc5a3('0x16'),_0x354369,_0xc5a3('0x14'),JSON[_0xc5a3('0x17')](_0xcece45));if(_0xcece45[_0xc5a3('0x18')]){if(_0xcece45[_0xc5a3('0x18')][_0xc5a3('0x19')]===0x1f4){logger[_0xc5a3('0x18')](_0xc5a3('0x1a'),_0x354369,_0xcece45[_0xc5a3('0x18')][_0xc5a3('0x1b')]);return _0x264554(_0xcece45[_0xc5a3('0x18')][_0xc5a3('0x1b')]);}logger[_0xc5a3('0x18')](_0xc5a3('0x1a'),_0x354369,_0xcece45[_0xc5a3('0x18')]['message']);return _0x4406c1(_0xcece45[_0xc5a3('0x18')][_0xc5a3('0x1b')]);}else{logger['info'](_0xc5a3('0x1a'),_0x354369,_0xc5a3('0x14'));_0x4406c1(_0xcece45[_0xc5a3('0x1c')][_0xc5a3('0x1b')]);}})[_0xc5a3('0x1d')](function(_0x3d9834){logger[_0xc5a3('0x18')](_0xc5a3('0x1a'),_0x354369,_0x3d9834);_0x264554(_0x3d9834);});});}exports[_0xc5a3('0x1e')]=function(_0x401f98){var _0x22dd74=this;return new Promise(function(_0x4d1b8f,_0x429885){return db['ChatQueue'][_0xc5a3('0x1f')]({'raw':_0x401f98[_0xc5a3('0x20')]?_0x401f98[_0xc5a3('0x20')][_0xc5a3('0x21')]===undefined?!![]:![]:!![],'where':_0x401f98[_0xc5a3('0x20')]?_0x401f98['options'][_0xc5a3('0x22')]||null:null,'attributes':_0x401f98['options']?_0x401f98['options'][_0xc5a3('0x23')]||null:null,'limit':_0x401f98[_0xc5a3('0x20')]?_0x401f98[_0xc5a3('0x20')]['limit']||null:null,'include':_0x401f98['options']?_0x401f98['options'][_0xc5a3('0x24')]?_[_0xc5a3('0x25')](_0x401f98[_0xc5a3('0x20')]['include'],function(_0x52650f){return{'model':db[_0x52650f[_0xc5a3('0x26')]],'as':_0x52650f['as'],'attributes':_0x52650f['attributes'],'include':_0x52650f[_0xc5a3('0x24')]?_[_0xc5a3('0x25')](_0x52650f[_0xc5a3('0x24')],function(_0x198022){return{'model':db[_0x198022[_0xc5a3('0x26')]],'as':_0x198022['as'],'attributes':_0x198022['attributes'],'include':_0x198022[_0xc5a3('0x24')]?_['map'](_0x198022['include'],function(_0x40e15a){return{'model':db[_0x40e15a[_0xc5a3('0x26')]],'as':_0x40e15a['as'],'attributes':_0x40e15a[_0xc5a3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc5a3('0x12')](function(_0x393f2c){logger[_0xc5a3('0x13')](_0xc5a3('0x1e'),_0x401f98);logger[_0xc5a3('0x15')]('GetChatQueue',_0x401f98,JSON['stringify'](_0x393f2c));_0x4d1b8f(_0x393f2c);})['catch'](function(_0x4a180f){logger['error'](_0xc5a3('0x1e'),_0x4a180f[_0xc5a3('0x1b')],_0x401f98);_0x429885(_0x22dd74[_0xc5a3('0x18')](0x1f4,_0x4a180f[_0xc5a3('0x1b')]));});});};exports['ShowChatQueue']=function(_0x38d403){var _0x521090=this;return new Promise(function(_0x1cec54,_0x4bbc4d){return db[_0xc5a3('0x27')]['find']({'raw':_0x38d403[_0xc5a3('0x20')]?_0x38d403[_0xc5a3('0x20')][_0xc5a3('0x21')]===undefined?!![]:![]:!![],'where':_0x38d403[_0xc5a3('0x20')]?_0x38d403[_0xc5a3('0x20')]['where']||null:null,'attributes':_0x38d403[_0xc5a3('0x20')]?_0x38d403[_0xc5a3('0x20')][_0xc5a3('0x23')]||null:null,'include':_0x38d403[_0xc5a3('0x20')]?_0x38d403[_0xc5a3('0x20')]['include']?_[_0xc5a3('0x25')](_0x38d403[_0xc5a3('0x20')][_0xc5a3('0x24')],function(_0x4d0992){return{'model':db[_0x4d0992[_0xc5a3('0x26')]],'as':_0x4d0992['as'],'attributes':_0x4d0992[_0xc5a3('0x23')],'include':_0x4d0992['include']?_['map'](_0x4d0992['include'],function(_0x98d666){return{'model':db[_0x98d666[_0xc5a3('0x26')]],'as':_0x98d666['as'],'attributes':_0x98d666[_0xc5a3('0x23')],'include':_0x98d666['include']?_[_0xc5a3('0x25')](_0x98d666['include'],function(_0x4564bc){return{'model':db[_0x4564bc[_0xc5a3('0x26')]],'as':_0x4564bc['as'],'attributes':_0x4564bc[_0xc5a3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc5a3('0x12')](function(_0x26ed96){logger['info'](_0xc5a3('0x28'),_0x38d403);logger[_0xc5a3('0x15')]('ShowChatQueue',_0x38d403,JSON[_0xc5a3('0x17')](_0x26ed96));_0x1cec54(_0x26ed96);})['catch'](function(_0x3de593){logger[_0xc5a3('0x18')](_0xc5a3('0x28'),_0x3de593[_0xc5a3('0x1b')],_0x38d403);_0x4bbc4d(_0x521090[_0xc5a3('0x18')](0x1f4,_0x3de593[_0xc5a3('0x1b')]));});});}; \ No newline at end of file +var _0x082a=['findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','find','ShowChatQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatQueue'];(function(_0x6f76f5,_0xaa19d4){var _0x11d801=function(_0x57acee){while(--_0x57acee){_0x6f76f5['push'](_0x6f76f5['shift']());}};_0x11d801(++_0xaa19d4);}(_0x082a,0x154));var _0xa082=function(_0x291bc2,_0xb2d760){_0x291bc2=_0x291bc2-0x0;var _0x269d3c=_0x082a[_0x291bc2];return _0x269d3c;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var moment=require(_0xa082('0x1'));var BPromise=require(_0xa082('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa082('0x3'));var db=require(_0xa082('0x4'))['db'];var utils=require(_0xa082('0x5'));var logger=require(_0xa082('0x6'))(_0xa082('0x7'));var config=require('../../config/environment');var jayson=require(_0xa082('0x8'));var client=jayson['client'][_0xa082('0x9')]({'port':0x232a});config[_0xa082('0xa')]=_['defaults'](config[_0xa082('0xa')],{'host':_0xa082('0xb'),'port':0x18eb});var socket=require(_0xa082('0xc'))(new Redis(config['redis']));require(_0xa082('0xd'))[_0xa082('0xe')](socket);function respondWithRpcPromise(_0xd359ef,_0x46b66d,_0x7c826c){return new BPromise(function(_0x494ef6,_0x1fcf69){return client[_0xa082('0xf')](_0xd359ef,_0x7c826c)[_0xa082('0x10')](function(_0x5798dc){logger['info'](_0xa082('0x11'),_0x46b66d,_0xa082('0x12'));logger[_0xa082('0x13')](_0xa082('0x14'),_0x46b66d,'request\x20sent',JSON[_0xa082('0x15')](_0x5798dc));if(_0x5798dc[_0xa082('0x16')]){if(_0x5798dc[_0xa082('0x16')][_0xa082('0x17')]===0x1f4){logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x5798dc['error'][_0xa082('0x18')]);return _0x1fcf69(_0x5798dc[_0xa082('0x16')]['message']);}logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x5798dc[_0xa082('0x16')][_0xa082('0x18')]);return _0x494ef6(_0x5798dc['error']['message']);}else{logger[_0xa082('0x19')](_0xa082('0x11'),_0x46b66d,'request\x20sent');_0x494ef6(_0x5798dc[_0xa082('0x1a')]['message']);}})[_0xa082('0x1b')](function(_0x284376){logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x284376);_0x1fcf69(_0x284376);});});}exports['GetChatQueue']=function(_0x318663){var _0x18f765=this;return new Promise(function(_0x48f656,_0x24befc){return db[_0xa082('0x1c')][_0xa082('0x1d')]({'raw':_0x318663[_0xa082('0x1e')]?_0x318663['options'][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0x318663['options']?_0x318663[_0xa082('0x1e')][_0xa082('0x20')]||null:null,'attributes':_0x318663['options']?_0x318663[_0xa082('0x1e')][_0xa082('0x21')]||null:null,'limit':_0x318663['options']?_0x318663['options'][_0xa082('0x22')]||null:null,'include':_0x318663[_0xa082('0x1e')]?_0x318663[_0xa082('0x1e')][_0xa082('0x23')]?_[_0xa082('0x24')](_0x318663[_0xa082('0x1e')][_0xa082('0x23')],function(_0x457ca9){return{'model':db[_0x457ca9[_0xa082('0x25')]],'as':_0x457ca9['as'],'attributes':_0x457ca9[_0xa082('0x21')],'include':_0x457ca9[_0xa082('0x23')]?_[_0xa082('0x24')](_0x457ca9[_0xa082('0x23')],function(_0x2d6170){return{'model':db[_0x2d6170[_0xa082('0x25')]],'as':_0x2d6170['as'],'attributes':_0x2d6170[_0xa082('0x21')],'include':_0x2d6170[_0xa082('0x23')]?_[_0xa082('0x24')](_0x2d6170[_0xa082('0x23')],function(_0x22ace6){return{'model':db[_0x22ace6[_0xa082('0x25')]],'as':_0x22ace6['as'],'attributes':_0x22ace6[_0xa082('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa082('0x10')](function(_0x16e9bf){logger[_0xa082('0x19')](_0xa082('0x26'),_0x318663);logger['debug'](_0xa082('0x26'),_0x318663,JSON[_0xa082('0x15')](_0x16e9bf));_0x48f656(_0x16e9bf);})[_0xa082('0x1b')](function(_0x329bb2){logger[_0xa082('0x16')]('GetChatQueue',_0x329bb2[_0xa082('0x18')],_0x318663);_0x24befc(_0x18f765[_0xa082('0x16')](0x1f4,_0x329bb2['message']));});});};exports['ShowChatQueue']=function(_0x491652){var _0x17cc4b=this;return new Promise(function(_0x4247df,_0x31c10b){return db[_0xa082('0x1c')][_0xa082('0x27')]({'raw':_0x491652[_0xa082('0x1e')]?_0x491652[_0xa082('0x1e')][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0x491652[_0xa082('0x1e')]?_0x491652[_0xa082('0x1e')][_0xa082('0x20')]||null:null,'attributes':_0x491652[_0xa082('0x1e')]?_0x491652[_0xa082('0x1e')]['attributes']||null:null,'include':_0x491652['options']?_0x491652['options'][_0xa082('0x23')]?_[_0xa082('0x24')](_0x491652[_0xa082('0x1e')]['include'],function(_0x4c3291){return{'model':db[_0x4c3291[_0xa082('0x25')]],'as':_0x4c3291['as'],'attributes':_0x4c3291[_0xa082('0x21')],'include':_0x4c3291[_0xa082('0x23')]?_['map'](_0x4c3291[_0xa082('0x23')],function(_0x50d1b1){return{'model':db[_0x50d1b1[_0xa082('0x25')]],'as':_0x50d1b1['as'],'attributes':_0x50d1b1[_0xa082('0x21')],'include':_0x50d1b1['include']?_[_0xa082('0x24')](_0x50d1b1[_0xa082('0x23')],function(_0x5a30d1){return{'model':db[_0x5a30d1[_0xa082('0x25')]],'as':_0x5a30d1['as'],'attributes':_0x5a30d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xa082('0x10')](function(_0x32079c){logger[_0xa082('0x19')](_0xa082('0x28'),_0x491652);logger[_0xa082('0x13')](_0xa082('0x28'),_0x491652,JSON[_0xa082('0x15')](_0x32079c));_0x4247df(_0x32079c);})['catch'](function(_0xa942c9){logger[_0xa082('0x16')](_0xa082('0x28'),_0xa942c9[_0xa082('0x18')],_0x491652);_0x31c10b(_0x17cc4b[_0xa082('0x16')](0x1f4,_0xa942c9[_0xa082('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b874f90..e1f7020 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x72b1,0x16e));var _0x172b=function(_0x192611,_0x4e75ce){_0x192611=_0x192611-0x0;var _0x124c55=_0x72b1[_0x192611];return _0x124c55;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x36768a,_0x32fa68){var _0x18706e=function(_0x4adfc3){while(--_0x4adfc3){_0x36768a['push'](_0x36768a['shift']());}};_0x18706e(++_0x32fa68);}(_0xe107,0xb3));var _0x7e10=function(_0x43c03f,_0x5f21af){_0x43c03f=_0x43c03f-0x0;var _0x4fec76=_0xe107[_0x43c03f];return _0x4fec76;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a6d858c..328fdf5 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0xf74839,_0x4381f8){_0xf74839=_0xf74839-0x0;var _0x1153a4=_0x3e74[_0xf74839];return _0x1153a4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x92958f,_0x44430b){var _0x1e406d=function(_0x42699d){while(--_0x42699d){_0x92958f['push'](_0x92958f['shift']());}};_0x1e406d(++_0x44430b);}(_0x55ca,0x126));var _0xa55c=function(_0x170941,_0x38d105){_0x170941=_0x170941-0x0;var _0x50e48d=_0x55ca[_0x170941];return _0x50e48d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 8996636..b90856f 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 _0x9bb9=['moment','sequelize','STRING','DATE'];(function(_0x3b362c,_0x3fca6b){var _0x5a9c36=function(_0x2c1fcd){while(--_0x2c1fcd){_0x3b362c['push'](_0x3b362c['shift']());}};_0x5a9c36(++_0x3fca6b);}(_0x9bb9,0x84));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x99bb('0x0'));var Sequelize=require(_0x99bb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x99bb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x99bb('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x99bb('0x3')]},'exitAt':{'type':Sequelize[_0x99bb('0x3')]},'reason':{'type':Sequelize[_0x99bb('0x2')]}}; \ No newline at end of file +var _0xe1ff=['moment','sequelize','exports','STRING','DATE'];(function(_0x4e3e62,_0x1059a8){var _0x4a34df=function(_0x4fcfc1){while(--_0x4fcfc1){_0x4e3e62['push'](_0x4e3e62['shift']());}};_0x4a34df(++_0x1059a8);}(_0xe1ff,0x1e0));var _0xfe1f=function(_0x210e49,_0x4acbc2){_0x210e49=_0x210e49-0x0;var _0x20559b=_0xe1ff[_0x210e49];return _0x20559b;};'use strict';var moment=require(_0xfe1f('0x0'));var Sequelize=require(_0xfe1f('0x1'));module[_0xfe1f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfe1f('0x3')]},'joinAt':{'type':Sequelize[_0xfe1f('0x4')]},'leaveAt':{'type':Sequelize[_0xfe1f('0x4')]},'acceptAt':{'type':Sequelize[_0xfe1f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfe1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 70b151f..d0e3501 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 _0x5430=['update','then','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x41f3ee,_0x1e03f6){var _0x38406a=function(_0x376ec1){while(--_0x376ec1){_0x41f3ee['push'](_0x41f3ee['shift']());}};_0x38406a(++_0x1e03f6);}(_0x5430,0x10c));var _0x0543=function(_0x166fe1,_0xb302bb){_0x166fe1=_0x166fe1-0x0;var _0x1f059c=_0x5430[_0x166fe1];return _0x1f059c;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=typeof _0x40fb03[_0x0543('0x1c')]==='undefined'&&typeof _0x40fb03[_0x0543('0x1d')]===_0x0543('0x1e');var _0x2dd5cb=_0x1dff7d[_0x0543('0x1f')];var _0x20b396=_0x1cfadf?0x0:_0x40fb03[_0x0543('0x1c')];var _0x577cf0=_0x1cfadf?_0x1dff7d['count']:_0x40fb03[_0x0543('0x1c')]+_0x40fb03['limit'];var _0x50ea84;if(_0x577cf0>=_0x2dd5cb){_0x577cf0=_0x2dd5cb;_0x50ea84=0xc8;}else{_0x50ea84=0xce;}_0xcb09df[_0x0543('0x1a')](_0x50ea84);return _0xcb09df[_0x0543('0x20')](_0x0543('0x21'),_0x20b396+'-'+_0x577cf0+'/'+_0x2dd5cb)['json'](_0x1dff7d);}return null;};}function patchUpdates(_0x3f0452){return function(_0x51c271){try{jsonpatch[_0x0543('0x22')](_0x51c271,_0x3f0452,!![]);}catch(_0x411ec2){return BPromise['reject'](_0x411ec2);}return _0x51c271[_0x0543('0x23')]();};}function saveUpdates(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')](_0x333c72)[_0x0543('0x25')](function(_0x4adba7){return _0x4adba7;});}return null;};}function removeEntity(_0x5979d2,_0x59f1b2){return function(_0xbfe5dc){if(_0xbfe5dc){return _0xbfe5dc[_0x0543('0x26')]()[_0x0543('0x25')](function(){_0x5979d2[_0x0543('0x1a')](0xcc)[_0x0543('0x1b')]();});}};}function handleEntityNotFound(_0x26e500,_0x36d824){return function(_0x17a3de){if(!_0x17a3de){_0x26e500[_0x0543('0x19')](0x194);}return _0x17a3de;};}function handleError(_0xf1eccf,_0x40a261){_0x40a261=_0x40a261||0x1f4;return function(_0x21fc63){logger['error'](_0x21fc63[_0x0543('0x27')]);if(_0x21fc63[_0x0543('0x28')]){delete _0x21fc63[_0x0543('0x28')];}_0xf1eccf['status'](_0x40a261)[_0x0543('0x29')](_0x21fc63);};}exports[_0x0543('0x2a')]=function(_0x41c4a7,_0x10b881){var _0x5dd789={},_0x1732be={},_0x10b9f3={'count':0x0,'rows':[]};var _0x492f60=_['map'](db[_0x0543('0x2b')][_0x0543('0x2c')],function(_0x51d49d){return{'name':_0x51d49d[_0x0543('0x2d')],'type':_0x51d49d[_0x0543('0x2e')][_0x0543('0x2f')]};});_0x1732be[_0x0543('0x30')]=_[_0x0543('0x31')](_0x492f60,_0x0543('0x28'));_0x1732be[_0x0543('0x32')]=_['keys'](_0x41c4a7[_0x0543('0x32')]);_0x1732be['filters']=_[_0x0543('0x33')](_0x1732be[_0x0543('0x30')],_0x1732be[_0x0543('0x32')]);_0x5dd789[_0x0543('0x34')]=_[_0x0543('0x33')](_0x1732be['model'],qs[_0x0543('0x35')](_0x41c4a7['query'][_0x0543('0x35')]));_0x5dd789[_0x0543('0x34')]=_0x5dd789[_0x0543('0x34')][_0x0543('0x36')]?_0x5dd789['attributes']:_0x1732be[_0x0543('0x30')];if(!_0x41c4a7['query'][_0x0543('0x37')](_0x0543('0x38'))){_0x5dd789[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1d')]);_0x5dd789[_0x0543('0x1c')]=qs[_0x0543('0x1c')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1c')]);}_0x5dd789['order']=qs[_0x0543('0x39')](_0x41c4a7[_0x0543('0x32')]['sort']);_0x5dd789[_0x0543('0x3a')]=qs['filters'](_[_0x0543('0x3b')](_0x41c4a7[_0x0543('0x32')],_0x1732be['filters']),_0x492f60);if(_0x41c4a7['query'][_0x0543('0x3c')]){_0x5dd789[_0x0543('0x3a')]=_['merge'](_0x5dd789[_0x0543('0x3a')],{'$or':_[_0x0543('0x31')](_0x492f60,function(_0x54543f){if(_0x54543f[_0x0543('0x2e')]!==_0x0543('0x3d')){var _0x3ecd70={};_0x3ecd70[_0x54543f[_0x0543('0x28')]]={'$like':'%'+_0x41c4a7[_0x0543('0x32')]['filter']+'%'};return _0x3ecd70;}})});}_0x5dd789=_['merge']({},_0x5dd789,_0x41c4a7['options']);var _0x486d9c={'where':_0x5dd789[_0x0543('0x3a')]};return db[_0x0543('0x2b')][_0x0543('0x1f')](_0x486d9c)['then'](function(_0xc66396){_0x10b9f3[_0x0543('0x1f')]=_0xc66396;if(_0x41c4a7[_0x0543('0x32')][_0x0543('0x3e')]){_0x5dd789[_0x0543('0x3f')]=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5dd789);})['then'](function(_0x24a891){_0x10b9f3[_0x0543('0x41')]=_0x24a891;return _0x10b9f3;})[_0x0543('0x25')](respondWithFilteredResult(_0x10b881,_0x5dd789))[_0x0543('0x42')](handleError(_0x10b881,null));};exports[_0x0543('0x43')]=function(_0x43b7e8,_0x5bf53d){var _0x53dfb8={'raw':!![],'where':{'id':_0x43b7e8[_0x0543('0x44')]['id']}},_0x44116a={};_0x44116a[_0x0543('0x30')]=_[_0x0543('0x45')](db[_0x0543('0x2b')][_0x0543('0x2c')]);_0x44116a[_0x0543('0x32')]=_[_0x0543('0x45')](_0x43b7e8[_0x0543('0x32')]);_0x44116a['filters']=_['intersection'](_0x44116a[_0x0543('0x30')],_0x44116a[_0x0543('0x32')]);_0x53dfb8['attributes']=_['intersection'](_0x44116a[_0x0543('0x30')],qs[_0x0543('0x35')](_0x43b7e8['query'][_0x0543('0x35')]));_0x53dfb8['attributes']=_0x53dfb8[_0x0543('0x34')][_0x0543('0x36')]?_0x53dfb8['attributes']:_0x44116a['model'];if(_0x43b7e8[_0x0543('0x32')]['includeAll']){_0x53dfb8[_0x0543('0x3f')]=[{'all':!![]}];}_0x53dfb8=_[_0x0543('0x46')]({},_0x53dfb8,_0x43b7e8[_0x0543('0x47')]);return db[_0x0543('0x2b')][_0x0543('0x48')](_0x53dfb8)[_0x0543('0x25')](handleEntityNotFound(_0x5bf53d,null))['then'](respondWithResult(_0x5bf53d,null))[_0x0543('0x42')](handleError(_0x5bf53d,null));};exports[_0x0543('0x49')]=function(_0xb8076c,_0xf0a28f){return db[_0x0543('0x2b')]['create'](_0xb8076c[_0x0543('0x4a')],{})['then'](respondWithResult(_0xf0a28f,0xc9))[_0x0543('0x42')](handleError(_0xf0a28f,null));};exports[_0x0543('0x24')]=function(_0x3f4c40,_0x46d398){if(_0x3f4c40[_0x0543('0x4a')]['id']){delete _0x3f4c40[_0x0543('0x4a')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x3f4c40['params']['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x46d398,null))[_0x0543('0x25')](saveUpdates(_0x3f4c40['body'],null))[_0x0543('0x25')](respondWithResult(_0x46d398,null))[_0x0543('0x42')](handleError(_0x46d398,null));};exports[_0x0543('0x26')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x2b')]['find']({'where':{'id':_0x3d3bfc[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x90dd22,null))[_0x0543('0x25')](removeEntity(_0x90dd22,null))[_0x0543('0x42')](handleError(_0x90dd22,null));};exports[_0x0543('0x4b')]=function(_0x449150,_0x265bc1){return db[_0x0543('0x2b')][_0x0543('0x4b')]()[_0x0543('0x25')](respondWithResult(_0x265bc1,null))[_0x0543('0x42')](handleError(_0x265bc1,null));}; \ No newline at end of file +var _0x0650=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','rawAttributes','fieldName','key','model'];(function(_0x94b65,_0x2bbe54){var _0x21fd68=function(_0xfe60e8){while(--_0xfe60e8){_0x94b65['push'](_0x94b65['shift']());}};_0x21fd68(++_0x2bbe54);}(_0x0650,0xed));var _0x0065=function(_0x2db29c,_0xdfad2c){_0x2db29c=_0x2db29c-0x0;var _0x54a99c=_0x0650[_0x2db29c];return _0x54a99c;};'use strict';var emlformat=require(_0x0065('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0065('0x1'));var jsonpatch=require(_0x0065('0x2'));var rp=require('request-promise');var moment=require(_0x0065('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0065('0x4'));var util=require(_0x0065('0x5'));var path=require(_0x0065('0x6'));var sox=require('sox');var csv=require(_0x0065('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0x7'));var querystring=require(_0x0065('0xc'));var Papa=require(_0x0065('0xd'));var Redis=require(_0x0065('0xe'));var authService=require(_0x0065('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x10'));var hardwareService=require(_0x0065('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x12'));var licenseUtil=require(_0x0065('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c7d1,_0x4255f6){_0x4255f6=_0x4255f6||0xcc;return function(_0x4c6296){if(_0x4c6296){return _0x45c7d1[_0x0065('0x14')](_0x4255f6);}return _0x45c7d1[_0x0065('0x15')](_0x4255f6)['end']();};}function respondWithResult(_0x5ae653,_0x1b9b1e){_0x1b9b1e=_0x1b9b1e||0xc8;return function(_0x5c0b74){if(_0x5c0b74){return _0x5ae653['status'](_0x1b9b1e)[_0x0065('0x16')](_0x5c0b74);}};}function respondWithFilteredResult(_0x5773d6,_0x38a870){return function(_0x48d817){if(_0x48d817){var _0x391fc1=typeof _0x38a870[_0x0065('0x17')]===_0x0065('0x18')&&typeof _0x38a870[_0x0065('0x19')]===_0x0065('0x18');var _0x34b0e2=_0x48d817[_0x0065('0x1a')];var _0x393d6e=_0x391fc1?0x0:_0x38a870['offset'];var _0x18bfa1=_0x391fc1?_0x48d817[_0x0065('0x1a')]:_0x38a870['offset']+_0x38a870[_0x0065('0x19')];var _0x3a0517;if(_0x18bfa1>=_0x34b0e2){_0x18bfa1=_0x34b0e2;_0x3a0517=0xc8;}else{_0x3a0517=0xce;}_0x5773d6[_0x0065('0x15')](_0x3a0517);return _0x5773d6[_0x0065('0x1b')](_0x0065('0x1c'),_0x393d6e+'-'+_0x18bfa1+'/'+_0x34b0e2)[_0x0065('0x16')](_0x48d817);}return null;};}function patchUpdates(_0x319e7a){return function(_0x529e30){try{jsonpatch['apply'](_0x529e30,_0x319e7a,!![]);}catch(_0x4b1213){return BPromise[_0x0065('0x1d')](_0x4b1213);}return _0x529e30[_0x0065('0x1e')]();};}function saveUpdates(_0x5b60c3,_0x2de3ae){return function(_0x5f1733){if(_0x5f1733){return _0x5f1733[_0x0065('0x1f')](_0x5b60c3)[_0x0065('0x20')](function(_0x3ec265){return _0x3ec265;});}return null;};}function removeEntity(_0x376452,_0x161b4c){return function(_0x1efa70){if(_0x1efa70){return _0x1efa70[_0x0065('0x21')]()['then'](function(){_0x376452[_0x0065('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4a4e,_0x3c715a){return function(_0x5924b3){if(!_0x5924b3){_0x4b4a4e[_0x0065('0x14')](0x194);}return _0x5924b3;};}function handleError(_0x6bf13b,_0x5db92c){_0x5db92c=_0x5db92c||0x1f4;return function(_0x123604){logger['error'](_0x123604['stack']);if(_0x123604[_0x0065('0x22')]){delete _0x123604[_0x0065('0x22')];}_0x6bf13b['status'](_0x5db92c)['send'](_0x123604);};}exports['index']=function(_0x51e091,_0x2e554f){var _0x1a977a={},_0x1f8813={},_0x369d08={'count':0x0,'rows':[]};var _0x4f15f5=_['map'](db['ChatQueueReport'][_0x0065('0x23')],function(_0x3a5286){return{'name':_0x3a5286[_0x0065('0x24')],'type':_0x3a5286['type'][_0x0065('0x25')]};});_0x1f8813[_0x0065('0x26')]=_['map'](_0x4f15f5,_0x0065('0x22'));_0x1f8813[_0x0065('0x27')]=_[_0x0065('0x28')](_0x51e091[_0x0065('0x27')]);_0x1f8813[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x1f8813[_0x0065('0x26')],_0x1f8813[_0x0065('0x27')]);_0x1a977a['attributes']=_['intersection'](_0x1f8813['model'],qs[_0x0065('0x2b')](_0x51e091[_0x0065('0x27')][_0x0065('0x2b')]));_0x1a977a[_0x0065('0x2c')]=_0x1a977a[_0x0065('0x2c')][_0x0065('0x2d')]?_0x1a977a[_0x0065('0x2c')]:_0x1f8813['model'];if(!_0x51e091[_0x0065('0x27')][_0x0065('0x2e')](_0x0065('0x2f'))){_0x1a977a[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x51e091['query'][_0x0065('0x19')]);_0x1a977a[_0x0065('0x17')]=qs[_0x0065('0x17')](_0x51e091[_0x0065('0x27')][_0x0065('0x17')]);}_0x1a977a[_0x0065('0x30')]=qs[_0x0065('0x31')](_0x51e091[_0x0065('0x27')][_0x0065('0x31')]);_0x1a977a[_0x0065('0x32')]=qs['filters'](_[_0x0065('0x33')](_0x51e091[_0x0065('0x27')],_0x1f8813[_0x0065('0x29')]),_0x4f15f5);if(_0x51e091['query'][_0x0065('0x34')]){_0x1a977a[_0x0065('0x32')]=_[_0x0065('0x35')](_0x1a977a[_0x0065('0x32')],{'$or':_[_0x0065('0x36')](_0x4f15f5,function(_0x231986){if(_0x231986['type']!==_0x0065('0x37')){var _0x2d1ba9={};_0x2d1ba9[_0x231986[_0x0065('0x22')]]={'$like':'%'+_0x51e091['query'][_0x0065('0x34')]+'%'};return _0x2d1ba9;}})});}_0x1a977a=_['merge']({},_0x1a977a,_0x51e091[_0x0065('0x38')]);var _0x37a434={'where':_0x1a977a['where']};return db[_0x0065('0x39')][_0x0065('0x1a')](_0x37a434)[_0x0065('0x20')](function(_0x3c1d6b){_0x369d08[_0x0065('0x1a')]=_0x3c1d6b;if(_0x51e091[_0x0065('0x27')]['includeAll']){_0x1a977a[_0x0065('0x3a')]=[{'all':!![]}];}return db[_0x0065('0x39')][_0x0065('0x3b')](_0x1a977a);})[_0x0065('0x20')](function(_0x1d251d){_0x369d08[_0x0065('0x3c')]=_0x1d251d;return _0x369d08;})[_0x0065('0x20')](respondWithFilteredResult(_0x2e554f,_0x1a977a))[_0x0065('0x3d')](handleError(_0x2e554f,null));};exports[_0x0065('0x3e')]=function(_0x41d6f7,_0x26cef9){var _0x32ab66={'raw':!![],'where':{'id':_0x41d6f7[_0x0065('0x3f')]['id']}},_0x35722d={};_0x35722d[_0x0065('0x26')]=_[_0x0065('0x28')](db[_0x0065('0x39')][_0x0065('0x23')]);_0x35722d[_0x0065('0x27')]=_[_0x0065('0x28')](_0x41d6f7[_0x0065('0x27')]);_0x35722d[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x35722d['model'],_0x35722d[_0x0065('0x27')]);_0x32ab66['attributes']=_[_0x0065('0x2a')](_0x35722d['model'],qs[_0x0065('0x2b')](_0x41d6f7['query'][_0x0065('0x2b')]));_0x32ab66[_0x0065('0x2c')]=_0x32ab66[_0x0065('0x2c')]['length']?_0x32ab66['attributes']:_0x35722d[_0x0065('0x26')];if(_0x41d6f7[_0x0065('0x27')][_0x0065('0x40')]){_0x32ab66[_0x0065('0x3a')]=[{'all':!![]}];}_0x32ab66=_['merge']({},_0x32ab66,_0x41d6f7[_0x0065('0x38')]);return db[_0x0065('0x39')][_0x0065('0x41')](_0x32ab66)[_0x0065('0x20')](handleEntityNotFound(_0x26cef9,null))[_0x0065('0x20')](respondWithResult(_0x26cef9,null))['catch'](handleError(_0x26cef9,null));};exports[_0x0065('0x42')]=function(_0x5ef382,_0x339730){return db[_0x0065('0x39')][_0x0065('0x42')](_0x5ef382[_0x0065('0x43')],{})['then'](respondWithResult(_0x339730,0xc9))[_0x0065('0x3d')](handleError(_0x339730,null));};exports['update']=function(_0x86fa3d,_0x20b727){if(_0x86fa3d[_0x0065('0x43')]['id']){delete _0x86fa3d[_0x0065('0x43')]['id'];}return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0x86fa3d[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x20b727,null))[_0x0065('0x20')](saveUpdates(_0x86fa3d[_0x0065('0x43')],null))[_0x0065('0x20')](respondWithResult(_0x20b727,null))['catch'](handleError(_0x20b727,null));};exports[_0x0065('0x21')]=function(_0xcd7d13,_0x277b74){return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0xcd7d13[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x277b74,null))['then'](removeEntity(_0x277b74,null))['catch'](handleError(_0x277b74,null));};exports[_0x0065('0x44')]=function(_0x2da487,_0xf7e228){return db[_0x0065('0x39')][_0x0065('0x44')]()[_0x0065('0x20')](respondWithResult(_0xf7e228,null))[_0x0065('0x3d')](handleError(_0xf7e228,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b3d3c89..8963017 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(_0x27e2d9,_0x12a971){var _0x257582=function(_0xe49e76){while(--_0xe49e76){_0x27e2d9['push'](_0x27e2d9['shift']());}};_0x257582(++_0x12a971);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0xbf171b,_0x21c916){var _0x21ab7e=function(_0x46a03d){while(--_0x46a03d){_0xbf171b['push'](_0xbf171b['shift']());}};_0x21ab7e(++_0x21c916);}(_0xe706,0xa3));var _0x6e70=function(_0x41cb4b,_0x200468){_0x41cb4b=_0x41cb4b-0x0;var _0x1719c1=_0xe706[_0x41cb4b];return _0x1719c1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1371e31..46da8fe 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 _0xde44=['CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xde44,0x160));var _0x4de4=function(_0x5bf388,_0x418bec){_0x5bf388=_0x5bf388-0x0;var _0x2d0577=_0xde44[_0x5bf388];return _0x2d0577;};'use strict';var _=require(_0x4de4('0x0'));var util=require(_0x4de4('0x1'));var moment=require(_0x4de4('0x2'));var BPromise=require(_0x4de4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de4('0x4'));var db=require(_0x4de4('0x5'))['db'];var utils=require(_0x4de4('0x6'));var logger=require(_0x4de4('0x7'))(_0x4de4('0x8'));var config=require('../../config/environment');var jayson=require(_0x4de4('0x9'));var client=jayson['client'][_0x4de4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406f08,_0x4f0c11,_0x4f13e7){return new BPromise(function(_0x18b3f6,_0x2d43e5){return client[_0x4de4('0xb')](_0x406f08,_0x4f13e7)['then'](function(_0xcd37c7){logger['info'](_0x4de4('0xc'),_0x4f0c11,'request\x20sent');logger[_0x4de4('0xd')](_0x4de4('0xe'),_0x4f0c11,'request\x20sent',JSON[_0x4de4('0xf')](_0xcd37c7));if(_0xcd37c7[_0x4de4('0x10')]){if(_0xcd37c7['error']['code']===0x1f4){logger[_0x4de4('0x10')](_0x4de4('0xc'),_0x4f0c11,_0xcd37c7[_0x4de4('0x10')]['message']);return _0x2d43e5(_0xcd37c7[_0x4de4('0x10')][_0x4de4('0x11')]);}logger[_0x4de4('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4f0c11,_0xcd37c7[_0x4de4('0x10')]['message']);return _0x18b3f6(_0xcd37c7[_0x4de4('0x10')][_0x4de4('0x11')]);}else{logger[_0x4de4('0x12')](_0x4de4('0xc'),_0x4f0c11,_0x4de4('0x13'));_0x18b3f6(_0xcd37c7[_0x4de4('0x14')][_0x4de4('0x11')]);}})[_0x4de4('0x15')](function(_0x5c2ef2){logger[_0x4de4('0x10')](_0x4de4('0xc'),_0x4f0c11,_0x5c2ef2);_0x2d43e5(_0x5c2ef2);});});}exports[_0x4de4('0x16')]=function(_0x524d02){var _0x2ba13b=this;return new Promise(function(_0x3a0f4a,_0x33b818){return db[_0x4de4('0x17')][_0x4de4('0x18')](_0x524d02[_0x4de4('0x19')],{'raw':_0x524d02[_0x4de4('0x1a')]?_0x524d02[_0x4de4('0x1a')][_0x4de4('0x1b')]===undefined?!![]:![]:!![]})[_0x4de4('0x1c')](function(_0x1dfb0c){logger[_0x4de4('0x12')](_0x4de4('0x16'),_0x524d02);logger['debug'](_0x4de4('0x16'),_0x524d02,JSON['stringify'](_0x1dfb0c));_0x3a0f4a(_0x1dfb0c);})[_0x4de4('0x15')](function(_0x1e4098){logger[_0x4de4('0x10')](_0x4de4('0x16'),_0x1e4098[_0x4de4('0x11')],_0x524d02);_0x33b818(_0x2ba13b[_0x4de4('0x10')](0x1f4,_0x1e4098[_0x4de4('0x11')]));});});};exports[_0x4de4('0x1d')]=function(_0x52a43c){var _0x3c9572=this;return new Promise(function(_0xea570e,_0x3e4a88){return db['ChatQueueReport'][_0x4de4('0x1e')](_0x52a43c[_0x4de4('0x19')],{'raw':_0x52a43c[_0x4de4('0x1a')]?_0x52a43c[_0x4de4('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52a43c['options']?_0x52a43c[_0x4de4('0x1a')][_0x4de4('0x1f')]||null:null,'attributes':_0x52a43c['options']?_0x52a43c['options'][_0x4de4('0x20')]||null:null,'limit':_0x52a43c['options']?_0x52a43c['options'][_0x4de4('0x21')]||null:null})[_0x4de4('0x1c')](function(_0x1e3158){logger[_0x4de4('0x12')](_0x4de4('0x1d'),_0x52a43c);logger['debug'](_0x4de4('0x1d'),_0x52a43c,JSON['stringify'](_0x1e3158));_0xea570e(_0x1e3158);})[_0x4de4('0x15')](function(_0x3c78af){logger[_0x4de4('0x10')](_0x4de4('0x1d'),_0x3c78af['message'],_0x52a43c);_0x3e4a88(_0x3c9572[_0x4de4('0x10')](0x1f4,_0x3c78af[_0x4de4('0x11')]));});});}; \ No newline at end of file +var _0xe6fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','update','attributes','limit','lodash'];(function(_0x5b551e,_0x1d32c3){var _0x56fd43=function(_0x426201){while(--_0x426201){_0x5b551e['push'](_0x5b551e['shift']());}};_0x56fd43(++_0x1d32c3);}(_0xe6fa,0x154));var _0xae6f=function(_0x4b92e9,_0x2f6330){_0x4b92e9=_0x4b92e9-0x0;var _0x3de0be=_0xe6fa[_0x4b92e9];return _0x3de0be;};'use strict';var _=require(_0xae6f('0x0'));var util=require(_0xae6f('0x1'));var moment=require('moment');var BPromise=require(_0xae6f('0x2'));var rs=require(_0xae6f('0x3'));var fs=require('fs');var Redis=require(_0xae6f('0x4'));var db=require(_0xae6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xae6f('0x6'))(_0xae6f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae6f('0x8')][_0xae6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d124,_0x555526,_0x23c5cb){return new BPromise(function(_0x324df9,_0x1ec178){return client[_0xae6f('0xa')](_0x16d124,_0x23c5cb)[_0xae6f('0xb')](function(_0xd163b9){logger[_0xae6f('0xc')](_0xae6f('0xd'),_0x555526,_0xae6f('0xe'));logger['debug'](_0xae6f('0xf'),_0x555526,_0xae6f('0xe'),JSON[_0xae6f('0x10')](_0xd163b9));if(_0xd163b9[_0xae6f('0x11')]){if(_0xd163b9[_0xae6f('0x11')][_0xae6f('0x12')]===0x1f4){logger[_0xae6f('0x11')](_0xae6f('0xd'),_0x555526,_0xd163b9[_0xae6f('0x11')][_0xae6f('0x13')]);return _0x1ec178(_0xd163b9[_0xae6f('0x11')][_0xae6f('0x13')]);}logger[_0xae6f('0x11')](_0xae6f('0xd'),_0x555526,_0xd163b9[_0xae6f('0x11')][_0xae6f('0x13')]);return _0x324df9(_0xd163b9['error'][_0xae6f('0x13')]);}else{logger['info'](_0xae6f('0xd'),_0x555526,'request\x20sent');_0x324df9(_0xd163b9['result'][_0xae6f('0x13')]);}})['catch'](function(_0x262cdd){logger[_0xae6f('0x11')](_0xae6f('0xd'),_0x555526,_0x262cdd);_0x1ec178(_0x262cdd);});});}exports[_0xae6f('0x14')]=function(_0x1af955){var _0x3aa2b1=this;return new Promise(function(_0xa9990e,_0x3de8ba){return db[_0xae6f('0x15')][_0xae6f('0x16')](_0x1af955[_0xae6f('0x17')],{'raw':_0x1af955[_0xae6f('0x18')]?_0x1af955['options'][_0xae6f('0x19')]===undefined?!![]:![]:!![]})[_0xae6f('0xb')](function(_0x3c0ba8){logger['info']('CreateChatQueueReport',_0x1af955);logger['debug'](_0xae6f('0x14'),_0x1af955,JSON[_0xae6f('0x10')](_0x3c0ba8));_0xa9990e(_0x3c0ba8);})[_0xae6f('0x1a')](function(_0x497a6b){logger[_0xae6f('0x11')](_0xae6f('0x14'),_0x497a6b[_0xae6f('0x13')],_0x1af955);_0x3de8ba(_0x3aa2b1[_0xae6f('0x11')](0x1f4,_0x497a6b[_0xae6f('0x13')]));});});};exports[_0xae6f('0x1b')]=function(_0x429298){var _0x4fef40=this;return new Promise(function(_0x39400a,_0x486491){return db[_0xae6f('0x15')][_0xae6f('0x1c')](_0x429298[_0xae6f('0x17')],{'raw':_0x429298[_0xae6f('0x18')]?_0x429298[_0xae6f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x429298[_0xae6f('0x18')]?_0x429298[_0xae6f('0x18')]['where']||null:null,'attributes':_0x429298[_0xae6f('0x18')]?_0x429298[_0xae6f('0x18')][_0xae6f('0x1d')]||null:null,'limit':_0x429298[_0xae6f('0x18')]?_0x429298['options'][_0xae6f('0x1e')]||null:null})['then'](function(_0x358cdd){logger[_0xae6f('0xc')](_0xae6f('0x1b'),_0x429298);logger['debug'](_0xae6f('0x1b'),_0x429298,JSON[_0xae6f('0x10')](_0x358cdd));_0x39400a(_0x358cdd);})['catch'](function(_0x517bb2){logger[_0xae6f('0x11')](_0xae6f('0x1b'),_0x517bb2[_0xae6f('0x13')],_0x429298);_0x486491(_0x4fef40['error'](0x1f4,_0x517bb2[_0xae6f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 808eea6..56a918a 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 _0xf1bd=['delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1bd,0x158));var _0xdf1b=function(_0x39a0b3,_0x5c3c59){_0x39a0b3=_0x39a0b3-0x0;var _0x43ab98=_0xf1bd[_0x39a0b3];return _0x43ab98;};'use strict';var multer=require(_0xdf1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdf1b('0x1'));var express=require(_0xdf1b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf1b('0x3'));var interaction=require(_0xdf1b('0x4'));var config=require(_0xdf1b('0x5'));var controller=require(_0xdf1b('0x6'));router[_0xdf1b('0x7')]('/',auth[_0xdf1b('0x8')](),controller[_0xdf1b('0x9')]);router['get'](_0xdf1b('0xa'),auth['isAuthenticated'](),controller[_0xdf1b('0xb')]);router[_0xdf1b('0x7')](_0xdf1b('0xc'),auth['isAuthenticated'](),controller[_0xdf1b('0xd')]);router['post']('/',auth[_0xdf1b('0x8')](),controller[_0xdf1b('0xe')]);router[_0xdf1b('0xf')](_0xdf1b('0xc'),auth[_0xdf1b('0x8')](),controller[_0xdf1b('0x10')]);router[_0xdf1b('0x11')](_0xdf1b('0xc'),auth[_0xdf1b('0x8')](),controller['destroy']);module[_0xdf1b('0x12')]=router; \ No newline at end of file +var _0xd691=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x4c43de,_0x38b1d5){var _0x3de90a=function(_0x803cff){while(--_0x803cff){_0x4c43de['push'](_0x4c43de['shift']());}};_0x3de90a(++_0x38b1d5);}(_0xd691,0x18f));var _0x1d69=function(_0xa5bd84,_0x287943){_0xa5bd84=_0xa5bd84-0x0;var _0x22bcca=_0xd691[_0xa5bd84];return _0x22bcca;};'use strict';var multer=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var path=require('path');var timeout=require(_0x1d69('0x2'));var express=require(_0x1d69('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d69('0x4'));var interaction=require(_0x1d69('0x5'));var config=require(_0x1d69('0x6'));var controller=require(_0x1d69('0x7'));router[_0x1d69('0x8')]('/',auth[_0x1d69('0x9')](),controller[_0x1d69('0xa')]);router['get'](_0x1d69('0xb'),auth[_0x1d69('0x9')](),controller[_0x1d69('0xc')]);router[_0x1d69('0x8')](_0x1d69('0xd'),auth[_0x1d69('0x9')](),controller[_0x1d69('0xe')]);router[_0x1d69('0xf')]('/',auth[_0x1d69('0x9')](),controller[_0x1d69('0x10')]);router['put']('/:id',auth[_0x1d69('0x9')](),controller[_0x1d69('0x11')]);router[_0x1d69('0x12')]('/:id',auth[_0x1d69('0x9')](),controller[_0x1d69('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0aded07..6ef042f 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xb43b,0x1b2));var _0xbb43=function(_0x53bbc8,_0x379567){_0x53bbc8=_0x53bbc8-0x0;var _0x12d602=_0xb43b[_0x53bbc8];return _0x12d602;};'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(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42c5b1,_0x57613c){_0x42c5b1=_0x42c5b1-0x0;var _0x5633cd=_0xb43b[_0x42c5b1];return _0x5633cd;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 29b1194..cfcd5fd 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 _0x1833=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','ChatTransferReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x261a74,_0x244ae3){var _0x231cf3=function(_0x49314e){while(--_0x49314e){_0x261a74['push'](_0x261a74['shift']());}};_0x231cf3(++_0x244ae3);}(_0x1833,0x93));var _0x3183=function(_0x2e78b4,_0x4e9b05){_0x2e78b4=_0x2e78b4-0x0;var _0x129f4d=_0x1833[_0x2e78b4];return _0x129f4d;};'use strict';var emlformat=require(_0x3183('0x0'));var rimraf=require(_0x3183('0x1'));var zipdir=require(_0x3183('0x2'));var jsonpatch=require(_0x3183('0x3'));var rp=require(_0x3183('0x4'));var moment=require(_0x3183('0x5'));var BPromise=require(_0x3183('0x6'));var Mustache=require(_0x3183('0x7'));var util=require('util');var path=require(_0x3183('0x8'));var sox=require(_0x3183('0x9'));var csv=require(_0x3183('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3183('0xb'));var _=require(_0x3183('0xc'));var squel=require(_0x3183('0xd'));var crypto=require(_0x3183('0xe'));var jsforce=require(_0x3183('0xf'));var deskjs=require(_0x3183('0x10'));var toCsv=require(_0x3183('0xa'));var querystring=require(_0x3183('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3183('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3183('0x13'));var hardwareService=require(_0x3183('0x14'));var logger=require(_0x3183('0x15'))(_0x3183('0x16'));var utils=require(_0x3183('0x17'));var config=require(_0x3183('0x18'));var licenseUtil=require(_0x3183('0x19'));var db=require(_0x3183('0x1a'))['db'];function respondWithStatusCode(_0xb906d3,_0x385f90){_0x385f90=_0x385f90||0xcc;return function(_0x33bf23){if(_0x33bf23){return _0xb906d3[_0x3183('0x1b')](_0x385f90);}return _0xb906d3[_0x3183('0x1c')](_0x385f90)[_0x3183('0x1d')]();};}function respondWithResult(_0x566c6c,_0x13467d){_0x13467d=_0x13467d||0xc8;return function(_0x208e6e){if(_0x208e6e){return _0x566c6c[_0x3183('0x1c')](_0x13467d)[_0x3183('0x1e')](_0x208e6e);}};}function respondWithFilteredResult(_0x382051,_0x7d601f){return function(_0x3e0a61){if(_0x3e0a61){var _0x3ea34e=typeof _0x7d601f['offset']==='undefined'&&typeof _0x7d601f['limit']===_0x3183('0x1f');var _0x136ed1=_0x3e0a61[_0x3183('0x20')];var _0x547c70=_0x3ea34e?0x0:_0x7d601f[_0x3183('0x21')];var _0x177314=_0x3ea34e?_0x3e0a61[_0x3183('0x20')]:_0x7d601f[_0x3183('0x21')]+_0x7d601f[_0x3183('0x22')];var _0x14a8c4;if(_0x177314>=_0x136ed1){_0x177314=_0x136ed1;_0x14a8c4=0xc8;}else{_0x14a8c4=0xce;}_0x382051[_0x3183('0x1c')](_0x14a8c4);return _0x382051[_0x3183('0x23')](_0x3183('0x24'),_0x547c70+'-'+_0x177314+'/'+_0x136ed1)[_0x3183('0x1e')](_0x3e0a61);}return null;};}function patchUpdates(_0x1d42d2){return function(_0x219a7f){try{jsonpatch[_0x3183('0x25')](_0x219a7f,_0x1d42d2,!![]);}catch(_0x6ab817){return BPromise[_0x3183('0x26')](_0x6ab817);}return _0x219a7f[_0x3183('0x27')]();};}function saveUpdates(_0x3ffa1e,_0x257f2e){return function(_0x1ddd0a){if(_0x1ddd0a){return _0x1ddd0a[_0x3183('0x28')](_0x3ffa1e)['then'](function(_0x3d9ba7){return _0x3d9ba7;});}return null;};}function removeEntity(_0xe8a748,_0x5c206d){return function(_0x246379){if(_0x246379){return _0x246379[_0x3183('0x29')]()[_0x3183('0x2a')](function(){_0xe8a748[_0x3183('0x1c')](0xcc)[_0x3183('0x1d')]();});}};}function handleEntityNotFound(_0x10c7a9,_0x1f6bd6){return function(_0x423937){if(!_0x423937){_0x10c7a9[_0x3183('0x1b')](0x194);}return _0x423937;};}function handleError(_0x4ff959,_0x48684a){_0x48684a=_0x48684a||0x1f4;return function(_0x9826a6){logger[_0x3183('0x2b')](_0x9826a6[_0x3183('0x2c')]);if(_0x9826a6['name']){delete _0x9826a6[_0x3183('0x2d')];}_0x4ff959['status'](_0x48684a)['send'](_0x9826a6);};}exports[_0x3183('0x2e')]=function(_0x5a1e42,_0x256b59){var _0x5d1bb9={},_0x239a3a={},_0x1edf98={'count':0x0,'rows':[]};var _0x3eb0ed=_['map'](db[_0x3183('0x2f')]['rawAttributes'],function(_0x4b64af){return{'name':_0x4b64af[_0x3183('0x30')],'type':_0x4b64af[_0x3183('0x31')][_0x3183('0x32')]};});_0x239a3a[_0x3183('0x33')]=_[_0x3183('0x34')](_0x3eb0ed,_0x3183('0x2d'));_0x239a3a[_0x3183('0x35')]=_[_0x3183('0x36')](_0x5a1e42[_0x3183('0x35')]);_0x239a3a['filters']=_[_0x3183('0x37')](_0x239a3a[_0x3183('0x33')],_0x239a3a['query']);_0x5d1bb9[_0x3183('0x38')]=_[_0x3183('0x37')](_0x239a3a[_0x3183('0x33')],qs['fields'](_0x5a1e42['query'][_0x3183('0x39')]));_0x5d1bb9[_0x3183('0x38')]=_0x5d1bb9[_0x3183('0x38')]['length']?_0x5d1bb9[_0x3183('0x38')]:_0x239a3a[_0x3183('0x33')];if(!_0x5a1e42[_0x3183('0x35')]['hasOwnProperty'](_0x3183('0x3a'))){_0x5d1bb9[_0x3183('0x22')]=qs[_0x3183('0x22')](_0x5a1e42['query'][_0x3183('0x22')]);_0x5d1bb9[_0x3183('0x21')]=qs['offset'](_0x5a1e42[_0x3183('0x35')][_0x3183('0x21')]);}_0x5d1bb9[_0x3183('0x3b')]=qs[_0x3183('0x3c')](_0x5a1e42[_0x3183('0x35')][_0x3183('0x3c')]);_0x5d1bb9['where']=qs[_0x3183('0x3d')](_[_0x3183('0x3e')](_0x5a1e42[_0x3183('0x35')],_0x239a3a[_0x3183('0x3d')]),_0x3eb0ed);if(_0x5a1e42[_0x3183('0x35')]['filter']){_0x5d1bb9['where']=_[_0x3183('0x3f')](_0x5d1bb9[_0x3183('0x40')],{'$or':_[_0x3183('0x34')](_0x3eb0ed,function(_0x541c4f){if(_0x541c4f[_0x3183('0x31')]!==_0x3183('0x41')){var _0x1a4284={};_0x1a4284[_0x541c4f[_0x3183('0x2d')]]={'$like':'%'+_0x5a1e42[_0x3183('0x35')][_0x3183('0x42')]+'%'};return _0x1a4284;}})});}_0x5d1bb9=_['merge']({},_0x5d1bb9,_0x5a1e42[_0x3183('0x43')]);var _0x16b7cf={'where':_0x5d1bb9[_0x3183('0x40')]};return db[_0x3183('0x2f')][_0x3183('0x20')](_0x16b7cf)[_0x3183('0x2a')](function(_0x3db657){_0x1edf98[_0x3183('0x20')]=_0x3db657;if(_0x5a1e42[_0x3183('0x35')][_0x3183('0x44')]){_0x5d1bb9[_0x3183('0x45')]=[{'all':!![]}];}return db[_0x3183('0x2f')][_0x3183('0x46')](_0x5d1bb9);})[_0x3183('0x2a')](function(_0x302e3f){_0x1edf98[_0x3183('0x47')]=_0x302e3f;return _0x1edf98;})['then'](respondWithFilteredResult(_0x256b59,_0x5d1bb9))[_0x3183('0x48')](handleError(_0x256b59,null));};exports[_0x3183('0x49')]=function(_0xb48c2,_0x3f442b){var _0x5d1b48={'raw':!![],'where':{'id':_0xb48c2[_0x3183('0x4a')]['id']}},_0x2cd33d={};_0x2cd33d[_0x3183('0x33')]=_['keys'](db['ChatTransferReport'][_0x3183('0x4b')]);_0x2cd33d[_0x3183('0x35')]=_[_0x3183('0x36')](_0xb48c2[_0x3183('0x35')]);_0x2cd33d[_0x3183('0x3d')]=_[_0x3183('0x37')](_0x2cd33d[_0x3183('0x33')],_0x2cd33d[_0x3183('0x35')]);_0x5d1b48[_0x3183('0x38')]=_['intersection'](_0x2cd33d[_0x3183('0x33')],qs[_0x3183('0x39')](_0xb48c2['query'][_0x3183('0x39')]));_0x5d1b48[_0x3183('0x38')]=_0x5d1b48[_0x3183('0x38')][_0x3183('0x4c')]?_0x5d1b48[_0x3183('0x38')]:_0x2cd33d[_0x3183('0x33')];if(_0xb48c2['query']['includeAll']){_0x5d1b48['include']=[{'all':!![]}];}_0x5d1b48=_[_0x3183('0x3f')]({},_0x5d1b48,_0xb48c2['options']);return db[_0x3183('0x2f')][_0x3183('0x4d')](_0x5d1b48)['then'](handleEntityNotFound(_0x3f442b,null))[_0x3183('0x2a')](respondWithResult(_0x3f442b,null))['catch'](handleError(_0x3f442b,null));};exports[_0x3183('0x4e')]=function(_0x293c84,_0x547b5d){return db[_0x3183('0x2f')][_0x3183('0x4e')](_0x293c84[_0x3183('0x4f')],{})['then'](respondWithResult(_0x547b5d,0xc9))[_0x3183('0x48')](handleError(_0x547b5d,null));};exports[_0x3183('0x28')]=function(_0x158e33,_0x56829d){if(_0x158e33['body']['id']){delete _0x158e33[_0x3183('0x4f')]['id'];}return db[_0x3183('0x2f')][_0x3183('0x4d')]({'where':{'id':_0x158e33[_0x3183('0x4a')]['id']}})[_0x3183('0x2a')](handleEntityNotFound(_0x56829d,null))[_0x3183('0x2a')](saveUpdates(_0x158e33[_0x3183('0x4f')],null))[_0x3183('0x2a')](respondWithResult(_0x56829d,null))[_0x3183('0x48')](handleError(_0x56829d,null));};exports[_0x3183('0x29')]=function(_0x2bd7b8,_0x1f454b){return db[_0x3183('0x2f')]['find']({'where':{'id':_0x2bd7b8[_0x3183('0x4a')]['id']}})[_0x3183('0x2a')](handleEntityNotFound(_0x1f454b,null))[_0x3183('0x2a')](removeEntity(_0x1f454b,null))['catch'](handleError(_0x1f454b,null));};exports[_0x3183('0x50')]=function(_0x221277,_0x3fc2f2){return db[_0x3183('0x2f')][_0x3183('0x50')]()[_0x3183('0x2a')](respondWithResult(_0x3fc2f2,null))['catch'](handleError(_0x3fc2f2,null));}; \ No newline at end of file +var _0xa184=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x425353,_0x442351){var _0x566c59=function(_0x3d22d8){while(--_0x3d22d8){_0x425353['push'](_0x425353['shift']());}};_0x566c59(++_0x442351);}(_0xa184,0x110));var _0x4a18=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xa184[_0x1f1511];return _0x1d9ab8;};'use strict';var emlformat=require(_0x4a18('0x0'));var rimraf=require(_0x4a18('0x1'));var zipdir=require(_0x4a18('0x2'));var jsonpatch=require(_0x4a18('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a18('0x4'));var Mustache=require(_0x4a18('0x5'));var util=require('util');var path=require(_0x4a18('0x6'));var sox=require(_0x4a18('0x7'));var csv=require('to-csv');var ejs=require(_0x4a18('0x8'));var fs=require('fs');var fs_extra=require(_0x4a18('0x9'));var _=require(_0x4a18('0xa'));var squel=require('squel');var crypto=require(_0x4a18('0xb'));var jsforce=require(_0x4a18('0xc'));var deskjs=require(_0x4a18('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a18('0xe'));var Papa=require(_0x4a18('0xf'));var Redis=require(_0x4a18('0x10'));var authService=require(_0x4a18('0x11'));var qs=require(_0x4a18('0x12'));var as=require(_0x4a18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a18('0x14'))(_0x4a18('0x15'));var utils=require(_0x4a18('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a18('0x17'));var db=require(_0x4a18('0x18'))['db'];function respondWithStatusCode(_0x1616af,_0xc124c3){_0xc124c3=_0xc124c3||0xcc;return function(_0x45f64d){if(_0x45f64d){return _0x1616af[_0x4a18('0x19')](_0xc124c3);}return _0x1616af[_0x4a18('0x1a')](_0xc124c3)[_0x4a18('0x1b')]();};}function respondWithResult(_0x316f90,_0x47a3da){_0x47a3da=_0x47a3da||0xc8;return function(_0x18084f){if(_0x18084f){return _0x316f90[_0x4a18('0x1a')](_0x47a3da)[_0x4a18('0x1c')](_0x18084f);}};}function respondWithFilteredResult(_0x44206e,_0x17b687){return function(_0x57e44d){if(_0x57e44d){var _0x34c423=typeof _0x17b687[_0x4a18('0x1d')]==='undefined'&&typeof _0x17b687[_0x4a18('0x1e')]==='undefined';var _0x3a50e0=_0x57e44d[_0x4a18('0x1f')];var _0x3baf6d=_0x34c423?0x0:_0x17b687[_0x4a18('0x1d')];var _0xb44456=_0x34c423?_0x57e44d[_0x4a18('0x1f')]:_0x17b687[_0x4a18('0x1d')]+_0x17b687['limit'];var _0x27cffa;if(_0xb44456>=_0x3a50e0){_0xb44456=_0x3a50e0;_0x27cffa=0xc8;}else{_0x27cffa=0xce;}_0x44206e[_0x4a18('0x1a')](_0x27cffa);return _0x44206e['set'](_0x4a18('0x20'),_0x3baf6d+'-'+_0xb44456+'/'+_0x3a50e0)[_0x4a18('0x1c')](_0x57e44d);}return null;};}function patchUpdates(_0x38cae5){return function(_0x74e28b){try{jsonpatch[_0x4a18('0x21')](_0x74e28b,_0x38cae5,!![]);}catch(_0x3963d9){return BPromise[_0x4a18('0x22')](_0x3963d9);}return _0x74e28b[_0x4a18('0x23')]();};}function saveUpdates(_0x2f5e0e,_0x8f7633){return function(_0x4e2621){if(_0x4e2621){return _0x4e2621['update'](_0x2f5e0e)[_0x4a18('0x24')](function(_0xf30b89){return _0xf30b89;});}return null;};}function removeEntity(_0x474459,_0x5e5531){return function(_0x440a6b){if(_0x440a6b){return _0x440a6b[_0x4a18('0x25')]()['then'](function(){_0x474459[_0x4a18('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb99fed,_0x5b1c79){return function(_0x28bbee){if(!_0x28bbee){_0xb99fed[_0x4a18('0x19')](0x194);}return _0x28bbee;};}function handleError(_0x192c75,_0x20c9cc){_0x20c9cc=_0x20c9cc||0x1f4;return function(_0xa360c3){logger['error'](_0xa360c3[_0x4a18('0x26')]);if(_0xa360c3[_0x4a18('0x27')]){delete _0xa360c3[_0x4a18('0x27')];}_0x192c75[_0x4a18('0x1a')](_0x20c9cc)[_0x4a18('0x28')](_0xa360c3);};}exports[_0x4a18('0x29')]=function(_0x59fd98,_0x4df062){var _0x26e057={},_0x5cd8a1={},_0x3eea2b={'count':0x0,'rows':[]};var _0x4a3e7b=_[_0x4a18('0x2a')](db[_0x4a18('0x2b')]['rawAttributes'],function(_0x308b71){return{'name':_0x308b71[_0x4a18('0x2c')],'type':_0x308b71[_0x4a18('0x2d')][_0x4a18('0x2e')]};});_0x5cd8a1['model']=_['map'](_0x4a3e7b,_0x4a18('0x27'));_0x5cd8a1[_0x4a18('0x2f')]=_['keys'](_0x59fd98['query']);_0x5cd8a1[_0x4a18('0x30')]=_[_0x4a18('0x31')](_0x5cd8a1['model'],_0x5cd8a1[_0x4a18('0x2f')]);_0x26e057[_0x4a18('0x32')]=_[_0x4a18('0x31')](_0x5cd8a1['model'],qs['fields'](_0x59fd98['query'][_0x4a18('0x33')]));_0x26e057[_0x4a18('0x32')]=_0x26e057[_0x4a18('0x32')][_0x4a18('0x34')]?_0x26e057[_0x4a18('0x32')]:_0x5cd8a1[_0x4a18('0x35')];if(!_0x59fd98[_0x4a18('0x2f')]['hasOwnProperty']('nolimit')){_0x26e057[_0x4a18('0x1e')]=qs[_0x4a18('0x1e')](_0x59fd98['query'][_0x4a18('0x1e')]);_0x26e057[_0x4a18('0x1d')]=qs[_0x4a18('0x1d')](_0x59fd98[_0x4a18('0x2f')][_0x4a18('0x1d')]);}_0x26e057[_0x4a18('0x36')]=qs['sort'](_0x59fd98['query'][_0x4a18('0x37')]);_0x26e057[_0x4a18('0x38')]=qs['filters'](_[_0x4a18('0x39')](_0x59fd98['query'],_0x5cd8a1['filters']),_0x4a3e7b);if(_0x59fd98[_0x4a18('0x2f')][_0x4a18('0x3a')]){_0x26e057[_0x4a18('0x38')]=_[_0x4a18('0x3b')](_0x26e057[_0x4a18('0x38')],{'$or':_[_0x4a18('0x2a')](_0x4a3e7b,function(_0x591e9c){if(_0x591e9c['type']!=='VIRTUAL'){var _0x4907e0={};_0x4907e0[_0x591e9c['name']]={'$like':'%'+_0x59fd98[_0x4a18('0x2f')][_0x4a18('0x3a')]+'%'};return _0x4907e0;}})});}_0x26e057=_[_0x4a18('0x3b')]({},_0x26e057,_0x59fd98[_0x4a18('0x3c')]);var _0xd71dc7={'where':_0x26e057[_0x4a18('0x38')]};return db['ChatTransferReport'][_0x4a18('0x1f')](_0xd71dc7)[_0x4a18('0x24')](function(_0x201ca0){_0x3eea2b[_0x4a18('0x1f')]=_0x201ca0;if(_0x59fd98[_0x4a18('0x2f')][_0x4a18('0x3d')]){_0x26e057[_0x4a18('0x3e')]=[{'all':!![]}];}return db[_0x4a18('0x2b')][_0x4a18('0x3f')](_0x26e057);})['then'](function(_0xe3fdc3){_0x3eea2b['rows']=_0xe3fdc3;return _0x3eea2b;})[_0x4a18('0x24')](respondWithFilteredResult(_0x4df062,_0x26e057))[_0x4a18('0x40')](handleError(_0x4df062,null));};exports[_0x4a18('0x41')]=function(_0x1af579,_0x42f4f8){var _0x2a2d41={'raw':!![],'where':{'id':_0x1af579[_0x4a18('0x42')]['id']}},_0x5341b6={};_0x5341b6[_0x4a18('0x35')]=_[_0x4a18('0x43')](db[_0x4a18('0x2b')][_0x4a18('0x44')]);_0x5341b6[_0x4a18('0x2f')]=_['keys'](_0x1af579[_0x4a18('0x2f')]);_0x5341b6[_0x4a18('0x30')]=_[_0x4a18('0x31')](_0x5341b6[_0x4a18('0x35')],_0x5341b6[_0x4a18('0x2f')]);_0x2a2d41[_0x4a18('0x32')]=_[_0x4a18('0x31')](_0x5341b6['model'],qs[_0x4a18('0x33')](_0x1af579[_0x4a18('0x2f')][_0x4a18('0x33')]));_0x2a2d41['attributes']=_0x2a2d41['attributes'][_0x4a18('0x34')]?_0x2a2d41[_0x4a18('0x32')]:_0x5341b6[_0x4a18('0x35')];if(_0x1af579[_0x4a18('0x2f')][_0x4a18('0x3d')]){_0x2a2d41[_0x4a18('0x3e')]=[{'all':!![]}];}_0x2a2d41=_[_0x4a18('0x3b')]({},_0x2a2d41,_0x1af579[_0x4a18('0x3c')]);return db['ChatTransferReport'][_0x4a18('0x45')](_0x2a2d41)[_0x4a18('0x24')](handleEntityNotFound(_0x42f4f8,null))['then'](respondWithResult(_0x42f4f8,null))['catch'](handleError(_0x42f4f8,null));};exports['create']=function(_0x4e9f68,_0xc6e7a7){return db[_0x4a18('0x2b')][_0x4a18('0x46')](_0x4e9f68[_0x4a18('0x47')],{})[_0x4a18('0x24')](respondWithResult(_0xc6e7a7,0xc9))[_0x4a18('0x40')](handleError(_0xc6e7a7,null));};exports['update']=function(_0x18d50a,_0x12f1a7){if(_0x18d50a[_0x4a18('0x47')]['id']){delete _0x18d50a['body']['id'];}return db[_0x4a18('0x2b')][_0x4a18('0x45')]({'where':{'id':_0x18d50a[_0x4a18('0x42')]['id']}})[_0x4a18('0x24')](handleEntityNotFound(_0x12f1a7,null))[_0x4a18('0x24')](saveUpdates(_0x18d50a[_0x4a18('0x47')],null))[_0x4a18('0x24')](respondWithResult(_0x12f1a7,null))[_0x4a18('0x40')](handleError(_0x12f1a7,null));};exports[_0x4a18('0x25')]=function(_0x5eba95,_0x4ee0c4){return db['ChatTransferReport']['find']({'where':{'id':_0x5eba95[_0x4a18('0x42')]['id']}})[_0x4a18('0x24')](handleEntityNotFound(_0x4ee0c4,null))[_0x4a18('0x24')](removeEntity(_0x4ee0c4,null))[_0x4a18('0x40')](handleError(_0x4ee0c4,null));};exports[_0x4a18('0x48')]=function(_0x3738d5,_0x4ba180){return db[_0x4a18('0x2b')][_0x4a18('0x48')]()['then'](respondWithResult(_0x4ba180,null))[_0x4a18('0x40')](handleError(_0x4ba180,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 19a5c98..10a4154 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 _0xa009=['api','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x29cf2c,_0x2bc713){var _0x25d21b=function(_0x497622){while(--_0x497622){_0x29cf2c['push'](_0x29cf2c['shift']());}};_0x25d21b(++_0x2bc713);}(_0xa009,0x194));var _0x9a00=function(_0x48043a,_0x2b99c1){_0x48043a=_0x48043a-0x0;var _0x7d92d2=_0xa009[_0x48043a];return _0x7d92d2;};'use strict';var _=require(_0x9a00('0x0'));var util=require(_0x9a00('0x1'));var logger=require(_0x9a00('0x2'))(_0x9a00('0x3'));var moment=require('moment');var BPromise=require(_0x9a00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a00('0x5'));var rimraf=require(_0x9a00('0x6'));var config=require(_0x9a00('0x7'));var attributes=require(_0x9a00('0x8'));module['exports']=function(_0x3bec2e,_0x441300){return _0x3bec2e['define'](_0x9a00('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9a00('0xa'),'fields':[_0x9a00('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dde=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x9dde,0xc6));var _0xe9dd=function(_0x30c727,_0x678006){_0x30c727=_0x30c727-0x0;var _0x56cb22=_0x9dde[_0x30c727];return _0x56cb22;};'use strict';var _=require('lodash');var util=require(_0xe9dd('0x0'));var logger=require(_0xe9dd('0x1'))(_0xe9dd('0x2'));var moment=require(_0xe9dd('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9dd('0x4'));var fs=require('fs');var path=require(_0xe9dd('0x5'));var rimraf=require('rimraf');var config=require(_0xe9dd('0x6'));var attributes=require(_0xe9dd('0x7'));module['exports']=function(_0x443d8a,_0x28be7c){return _0x443d8a[_0xe9dd('0x8')](_0xe9dd('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe9dd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3f6ed28..eeef700 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 _0x9096=['then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2813fa,_0x3211d4){var _0x8a2acb=function(_0x4a9602){while(--_0x4a9602){_0x2813fa['push'](_0x2813fa['shift']());}};_0x8a2acb(++_0x3211d4);}(_0x9096,0x169));var _0x6909=function(_0x3e7285,_0x25b75b){_0x3e7285=_0x3e7285-0x0;var _0x3c3455=_0x9096[_0x3e7285];return _0x3c3455;};'use strict';var _=require(_0x6909('0x0'));var util=require(_0x6909('0x1'));var moment=require('moment');var BPromise=require(_0x6909('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6909('0x3'));var db=require(_0x6909('0x4'))['db'];var utils=require(_0x6909('0x5'));var logger=require(_0x6909('0x6'))(_0x6909('0x7'));var config=require(_0x6909('0x8'));var jayson=require(_0x6909('0x9'));var client=jayson[_0x6909('0xa')][_0x6909('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25dfd4,_0x422835,_0x3fd8fa){return new BPromise(function(_0x810876,_0x3fa604){return client[_0x6909('0xc')](_0x25dfd4,_0x3fd8fa)[_0x6909('0xd')](function(_0x5f236c){logger[_0x6909('0xe')](_0x6909('0xf'),_0x422835,'request\x20sent');logger[_0x6909('0x10')](_0x6909('0x11'),_0x422835,'request\x20sent',JSON[_0x6909('0x12')](_0x5f236c));if(_0x5f236c[_0x6909('0x13')]){if(_0x5f236c[_0x6909('0x13')]['code']===0x1f4){logger[_0x6909('0x13')](_0x6909('0xf'),_0x422835,_0x5f236c['error'][_0x6909('0x14')]);return _0x3fa604(_0x5f236c[_0x6909('0x13')][_0x6909('0x14')]);}logger[_0x6909('0x13')](_0x6909('0xf'),_0x422835,_0x5f236c[_0x6909('0x13')][_0x6909('0x14')]);return _0x810876(_0x5f236c[_0x6909('0x13')]['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x422835,'request\x20sent');_0x810876(_0x5f236c['result'][_0x6909('0x14')]);}})[_0x6909('0x15')](function(_0x367a6f){logger[_0x6909('0x13')](_0x6909('0xf'),_0x422835,_0x367a6f);_0x3fa604(_0x367a6f);});});} \ No newline at end of file +var _0x0b05=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3c908c,_0x8e3474){var _0xb94259=function(_0x53998d){while(--_0x53998d){_0x3c908c['push'](_0x3c908c['shift']());}};_0xb94259(++_0x8e3474);}(_0x0b05,0x1bd));var _0x50b0=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x0b05[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x50b0('0x0'));var util=require(_0x50b0('0x1'));var moment=require(_0x50b0('0x2'));var BPromise=require(_0x50b0('0x3'));var rs=require(_0x50b0('0x4'));var fs=require('fs');var Redis=require(_0x50b0('0x5'));var db=require(_0x50b0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50b0('0x7'))(_0x50b0('0x8'));var config=require(_0x50b0('0x9'));var jayson=require(_0x50b0('0xa'));var client=jayson[_0x50b0('0xb')][_0x50b0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35c709,_0xa79c37,_0x45a507){return new BPromise(function(_0x35d672,_0x44f3ef){return client[_0x50b0('0xd')](_0x35c709,_0x45a507)[_0x50b0('0xe')](function(_0x537b70){logger[_0x50b0('0xf')](_0x50b0('0x10'),_0xa79c37,_0x50b0('0x11'));logger[_0x50b0('0x12')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xa79c37,_0x50b0('0x11'),JSON['stringify'](_0x537b70));if(_0x537b70[_0x50b0('0x13')]){if(_0x537b70[_0x50b0('0x13')][_0x50b0('0x14')]===0x1f4){logger['error'](_0x50b0('0x10'),_0xa79c37,_0x537b70[_0x50b0('0x13')][_0x50b0('0x15')]);return _0x44f3ef(_0x537b70[_0x50b0('0x13')][_0x50b0('0x15')]);}logger[_0x50b0('0x13')](_0x50b0('0x10'),_0xa79c37,_0x537b70[_0x50b0('0x13')][_0x50b0('0x15')]);return _0x35d672(_0x537b70[_0x50b0('0x13')][_0x50b0('0x15')]);}else{logger[_0x50b0('0xf')](_0x50b0('0x10'),_0xa79c37,_0x50b0('0x11'));_0x35d672(_0x537b70['result']['message']);}})[_0x50b0('0x16')](function(_0x3cbf7b){logger[_0x50b0('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0xa79c37,_0x3cbf7b);_0x44f3ef(_0x3cbf7b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 634c29b..c00771e 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 _0xf744=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x11cb91,_0x5ef17c){var _0x2bc42f=function(_0x481ea2){while(--_0x481ea2){_0x11cb91['push'](_0x11cb91['shift']());}};_0x2bc42f(++_0x5ef17c);}(_0xf744,0x1ab));var _0x4f74=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xf744[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x4f74('0x0'));var util=require('util');var path=require(_0x4f74('0x1'));var timeout=require(_0x4f74('0x2'));var express=require(_0x4f74('0x3'));var router=express[_0x4f74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4f74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4f74('0x6'));var controller=require(_0x4f74('0x7'));router[_0x4f74('0x8')]('/',auth[_0x4f74('0x9')](),controller[_0x4f74('0xa')]);router[_0x4f74('0x8')]('/describe',auth[_0x4f74('0x9')](),controller['describe']);router[_0x4f74('0x8')](_0x4f74('0xb'),auth[_0x4f74('0x9')](),controller[_0x4f74('0xc')]);router['post']('/',auth[_0x4f74('0x9')](),controller[_0x4f74('0xd')]);router[_0x4f74('0xe')](_0x4f74('0xb'),auth[_0x4f74('0x9')](),controller[_0x4f74('0xf')]);router[_0x4f74('0x10')](_0x4f74('0xb'),auth['isAuthenticated'](),controller[_0x4f74('0x11')]);module['exports']=router; \ No newline at end of file +var _0x91aa=['show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x179920,_0xa14b27){var _0x57acb1=function(_0x8b0ad5){while(--_0x8b0ad5){_0x179920['push'](_0x179920['shift']());}};_0x57acb1(++_0xa14b27);}(_0x91aa,0xb0));var _0xa91a=function(_0x9f897b,_0x2bc0f7){_0x9f897b=_0x9f897b-0x0;var _0x595177=_0x91aa[_0x9f897b];return _0x595177;};'use strict';var multer=require('multer');var util=require(_0xa91a('0x0'));var path=require(_0xa91a('0x1'));var timeout=require('connect-timeout');var express=require(_0xa91a('0x2'));var router=express[_0xa91a('0x3')]();var fs_extra=require(_0xa91a('0x4'));var auth=require(_0xa91a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa91a('0x6'));var controller=require('./chatTransferReport.controller');router[_0xa91a('0x7')]('/',auth[_0xa91a('0x8')](),controller[_0xa91a('0x9')]);router['get'](_0xa91a('0xa'),auth[_0xa91a('0x8')](),controller[_0xa91a('0xb')]);router[_0xa91a('0x7')](_0xa91a('0xc'),auth[_0xa91a('0x8')](),controller[_0xa91a('0xd')]);router[_0xa91a('0xe')]('/',auth[_0xa91a('0x8')](),controller[_0xa91a('0xf')]);router[_0xa91a('0x10')](_0xa91a('0xc'),auth[_0xa91a('0x8')](),controller[_0xa91a('0x11')]);router[_0xa91a('0x12')]('/:id',auth[_0xa91a('0x8')](),controller[_0xa91a('0x13')]);module[_0xa91a('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 68f8ba1..853a84b 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 _0xfed0=['We\x20are\x20here!','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','ENUM','squared','rounded'];(function(_0x1d6807,_0x2f31bb){var _0x4025ac=function(_0x4e6de5){while(--_0x4e6de5){_0x1d6807['push'](_0x1d6807['shift']());}};_0x4025ac(++_0x2f31bb);}(_0xfed0,0x17c));var _0x0fed=function(_0x3bb200,_0x56df05){_0x3bb200=_0x3bb200-0x0;var _0x2e24a6=_0xfed0[_0x3bb200];return _0x2e24a6;};'use strict';var Sequelize=require(_0x0fed('0x0'));var rs=require(_0x0fed('0x1'));module[_0x0fed('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'unique':_0x0fed('0x4')},'description':{'type':Sequelize[_0x0fed('0x3')]},'mapKey':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x6')},'customerAlias':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'defaultValue':_0x0fed('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'defaultValue':_0x0fed('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0fed('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0fed('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0fed('0x9')]('rounded',_0x0fed('0xa')),'defaultValue':_0x0fed('0xb')},'header_online':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0xc')},'start_chat_button':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0xd')},'header_offline':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0fed('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0fed('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0x14')},'closingMessageButton':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0xd')},'skipMessageButton':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0x15')},'ratingType':{'type':Sequelize[_0x0fed('0x9')](_0x0fed('0x16'),_0x0fed('0x17')),'defaultValue':_0x0fed('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0fed('0x10')],'defaultValue':function(){return JSON[_0x0fed('0x18')]({'items':[{'type':_0x0fed('0x19'),'variable':null,'config':{'placeholder':_0x0fed('0x1a'),'type':_0x0fed('0x1b'),'required':!![]},'props':{'title':_0x0fed('0x1a'),'helpText':''}},{'type':_0x0fed('0x19'),'props':{'title':_0x0fed('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0fed('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0fed('0x1c')](_0x0fed('0x1d'))?JSON[_0x0fed('0x1e')](this[_0x0fed('0x1c')](_0x0fed('0x1d'))):{};},'set':function(_0x2d57cf){return this[_0x0fed('0x1f')](_0x0fed('0x1d'),JSON[_0x0fed('0x18')](_0x2d57cf));}},'offlineForm':{'type':Sequelize[_0x0fed('0x10')],'defaultValue':function(){return JSON[_0x0fed('0x18')]({'items':[{'type':_0x0fed('0x19'),'props':{'title':_0x0fed('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0fed('0x5'),'type':_0x0fed('0x5')},'variable':null},{'type':_0x0fed('0x20'),'config':{'placeholder':_0x0fed('0x21')},'props':{'title':_0x0fed('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0fed('0x1c')]('offlineForm')?JSON[_0x0fed('0x1e')](this[_0x0fed('0x1c')](_0x0fed('0x22'))):{};},'set':function(_0x36b06a){return this['setDataValue'](_0x0fed('0x22'),JSON[_0x0fed('0x18')](_0x36b06a));}},'token':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':function(){return rs[_0x0fed('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0fed('0x3')]},'forwardOffline':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0fed('0x3')]},'waitingTitle':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x24')},'waitingMessage':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0fed('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0fed('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0fed('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0fed('0x10')],'defaultValue':function(){return _0x0fed('0x29');}},'notificationSound':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fed('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0fed('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x2b')},'messagesAlignment':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':_0x0fed('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0fed('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fed('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0fed('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x0fed('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0fed('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![],'comment':_0x0fed('0x2d'),'set':function(_0x4e085b){if(!_0x4e085b)this[_0x0fed('0x1f')]('mandatoryDispositionPauseId',null);this[_0x0fed('0x1f')](_0x0fed('0x2e'),_0x4e085b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0fed('0x3')]},'vidaooTopic':{'type':Sequelize[_0x0fed('0x3')],'allowNull':![],'defaultValue':_0x0fed('0x2f')},'vidaooNote':{'type':Sequelize[_0x0fed('0x3')],'defaultValue':function(){return _0x0fed('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x0fed('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0fed('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3b66=['generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','offlineForm'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3b66,0x7b));var _0x63b6=function(_0x226731,_0x9e13a6){_0x226731=_0x226731-0x0;var _0x4f1992=_0x3b66[_0x226731];return _0x4f1992;};'use strict';var Sequelize=require(_0x63b6('0x0'));var rs=require(_0x63b6('0x1'));module[_0x63b6('0x2')]={'name':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![],'unique':_0x63b6('0x4')},'description':{'type':Sequelize[_0x63b6('0x3')]},'mapKey':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x5')},'mapKeyOffline':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x63b6('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![],'defaultValue':_0x63b6('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![],'defaultValue':_0x63b6('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x63b6('0x3')]},'animation':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x63b6('0xa')]('rounded',_0x63b6('0xb')),'defaultValue':_0x63b6('0xc')},'header_online':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0xd')},'start_chat_button':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x63b6('0xf')},'header_offline':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x10')},'download_transcript':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x63b6('0x11')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x63b6('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x63b6('0x13')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x63b6('0x14')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x63b6('0x15')},'placeholderMessage':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x16')},'closingMessage':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x17')},'closingMessageButton':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0xf')},'skipMessageButton':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x18')},'ratingType':{'type':Sequelize[_0x63b6('0xa')](_0x63b6('0x19'),'thumb'),'defaultValue':_0x63b6('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x63b6('0x11')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x63b6('0x13')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x63b6('0x1a'),'variable':null,'config':{'placeholder':_0x63b6('0x1b'),'type':_0x63b6('0x1c'),'required':!![]},'props':{'title':_0x63b6('0x1b'),'helpText':''}},{'type':_0x63b6('0x1a'),'props':{'title':_0x63b6('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x63b6('0x5'),'type':_0x63b6('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x63b6('0x1d')](_0x63b6('0x1e'))?JSON[_0x63b6('0x1f')](this[_0x63b6('0x1d')](_0x63b6('0x1e'))):{};},'set':function(_0x1fb1cb){return this[_0x63b6('0x20')](_0x63b6('0x1e'),JSON['stringify'](_0x1fb1cb));}},'offlineForm':{'type':Sequelize[_0x63b6('0x13')],'defaultValue':function(){return JSON[_0x63b6('0x21')]({'items':[{'type':'input','props':{'title':_0x63b6('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x63b6('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x63b6('0x22')},'props':{'title':_0x63b6('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x63b6('0x23'))?JSON[_0x63b6('0x1f')](this[_0x63b6('0x1d')](_0x63b6('0x23'))):{};},'set':function(_0x4ee541){return this['setDataValue'](_0x63b6('0x23'),JSON[_0x63b6('0x21')](_0x4ee541));}},'token':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':function(){return rs[_0x63b6('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x63b6('0x3')]},'forwardOffline':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x63b6('0x3')]},'waitingTitle':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x25')},'waitingMessage':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x27')},'offlineMessageBody':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x29')},'skipUnmanaged':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x63b6('0x13')]},'showAgentAvatar':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x63b6('0x13')],'defaultValue':function(){return _0x63b6('0x2b');}},'notificationSound':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x63b6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x63b6('0x11')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x2d')},'messagesAlignment':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![],'defaultValue':_0x63b6('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x63b6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x63b6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':_0x63b6('0x2f')},'systemAvatar':{'type':Sequelize[_0x63b6('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x63b6('0x11')],'comment':_0x63b6('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![],'comment':_0x63b6('0x31'),'set':function(_0x3f6219){if(!_0x3f6219)this[_0x63b6('0x20')]('mandatoryDispositionPauseId',null);this[_0x63b6('0x20')](_0x63b6('0x32'),_0x3f6219);}},'vidaooEscalation':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x63b6('0x3')]},'vidaooTopic':{'type':Sequelize[_0x63b6('0x3')],'allowNull':![],'defaultValue':_0x63b6('0x33')},'vidaooNote':{'type':Sequelize[_0x63b6('0x3')],'defaultValue':function(){return _0x63b6('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x63b6('0x13')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x63b6('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 44236c4..b98e5bf 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 _0x43fd=['addLogo','addAvatar','file','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','agentAvatar','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','unknown','device','vendor','type','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','User','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ChatWebsite,\x20%s,\x20%s','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','filters','model','intersection','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers'];(function(_0x31464b,_0x292eb3){var _0x48ba7c=function(_0x16dc3c){while(--_0x16dc3c){_0x31464b['push'](_0x31464b['shift']());}};_0x48ba7c(++_0x292eb3);}(_0x43fd,0x1ec));var _0xd43f=function(_0xe09cf,_0x237a4a){_0xe09cf=_0xe09cf-0x0;var _0x3bd449=_0x43fd[_0xe09cf];return _0x3bd449;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xd43f('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xd43f('0x1'));var fs=require('fs');var fs_extra=require(_0xd43f('0x2'));var _=require('lodash');var querystring=require(_0xd43f('0x3'));var Redis=require('ioredis');var qs=require(_0xd43f('0x4'));var logger=require(_0xd43f('0x5'))(_0xd43f('0x6'));var config=require(_0xd43f('0x7'));var db=require('../../mysqldb')['db'];config[_0xd43f('0x8')]=_[_0xd43f('0x9')](config[_0xd43f('0x8')],{'host':_0xd43f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd43f('0x8')]));require(_0xd43f('0xb'))['register'](socket);var htmlToText=require(_0xd43f('0xc'));var jayson=require(_0xd43f('0xd'));var client=jayson[_0xd43f('0xe')][_0xd43f('0xf')]({'port':0x232c});var client9002=jayson[_0xd43f('0xe')]['http']({'port':0x232a});var client9003=jayson[_0xd43f('0xe')][_0xd43f('0xf')]({'port':0x232b});var client9001=jayson[_0xd43f('0xe')][_0xd43f('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x430977,_0x396916,_0x22f057,_0x1a72f1){return new BPromise(function(_0x2b4549,_0x1bed70){var _0x1eba90=_0x1a72f1||client;return _0x1eba90['request'](_0x430977,_0x22f057)[_0xd43f('0x10')](function(_0x922f49){logger[_0xd43f('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x396916,'request\x20sent');logger['debug'](_0xd43f('0x12'),_0x396916,_0xd43f('0x13'),JSON['stringify'](_0x922f49));if(_0x922f49[_0xd43f('0x14')]){if(_0x922f49[_0xd43f('0x14')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x396916,_0x922f49['error'][_0xd43f('0x15')]);return _0x1bed70(_0x922f49[_0xd43f('0x14')]['message']);}logger[_0xd43f('0x14')](_0xd43f('0x16'),_0x396916,_0x922f49[_0xd43f('0x14')][_0xd43f('0x15')]);return _0x2b4549(_0x922f49['error'][_0xd43f('0x15')]);}else{logger[_0xd43f('0x11')](_0xd43f('0x16'),_0x396916,'request\x20sent');_0x2b4549(_0x922f49['result']['message']);}})[_0xd43f('0x17')](function(_0x25007c){logger[_0xd43f('0x14')](_0xd43f('0x16'),_0x396916,_0x25007c);_0x1bed70(_0x25007c);});});}function respondWithStatusCode(_0x3b1094,_0x3b974c){_0x3b974c=_0x3b974c||0xcc;return function(_0x296a77){if(_0x296a77){return _0x3b1094['sendStatus'](_0x3b974c);}return _0x3b1094[_0xd43f('0x18')](_0x3b974c)['end']();};}function respondWithResult(_0x352102,_0x47f960){_0x47f960=_0x47f960||0xc8;return function(_0x5ab88f){if(_0x5ab88f){return _0x352102[_0xd43f('0x18')](_0x47f960)[_0xd43f('0x19')](_0x5ab88f);}};}function respondWithFilteredResult(_0x2a9ce4,_0x2a38f6){return function(_0x35acd0){if(_0x35acd0){var _0xcaf5ae=typeof _0x2a38f6[_0xd43f('0x1a')]===_0xd43f('0x1b')&&typeof _0x2a38f6[_0xd43f('0x1c')]==='undefined';var _0x26a6c9=_0x35acd0[_0xd43f('0x1d')];var _0x366cf7=_0xcaf5ae?0x0:_0x2a38f6[_0xd43f('0x1a')];var _0x209ccd=_0xcaf5ae?_0x35acd0['count']:_0x2a38f6[_0xd43f('0x1a')]+_0x2a38f6[_0xd43f('0x1c')];var _0x285b86;if(_0x209ccd>=_0x26a6c9){_0x209ccd=_0x26a6c9;_0x285b86=0xc8;}else{_0x285b86=0xce;}_0x2a9ce4[_0xd43f('0x18')](_0x285b86);return _0x2a9ce4[_0xd43f('0x1e')](_0xd43f('0x1f'),_0x366cf7+'-'+_0x209ccd+'/'+_0x26a6c9)['json'](_0x35acd0);}return null;};}function saveUpdates(_0x1e54d0){return function(_0x1f476d){if(_0x1f476d){return _0x1f476d['update'](_0x1e54d0)[_0xd43f('0x10')](function(_0x5b1219){return _0x5b1219;});}return null;};}function removeEntity(_0x53aae7){return function(_0x45e84a){if(_0x45e84a){return _0x45e84a[_0xd43f('0x20')]()[_0xd43f('0x10')](function(){var _0x4d032e=_0x45e84a[_0xd43f('0x21')]({'plain':!![]});var _0x23c4f7='ChatWebsites';return db['UserProfileResource'][_0xd43f('0x20')]({'where':{'type':_0x23c4f7,'resourceId':_0x4d032e['id']}})[_0xd43f('0x10')](function(){return _0x45e84a;});})[_0xd43f('0x10')](function(){_0x53aae7[_0xd43f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfdea){return function(_0x24015b){if(!_0x24015b){_0x2bfdea[_0xd43f('0x22')](0x194);}return _0x24015b;};}function handleError(_0x3920eb,_0x5a5717){_0x5a5717=_0x5a5717||0x1f4;return function(_0x2461bc){logger[_0xd43f('0x14')](_0x2461bc['stack']);if(_0x2461bc[_0xd43f('0x23')]){delete _0x2461bc['name'];}_0x3920eb[_0xd43f('0x18')](_0x5a5717)[_0xd43f('0x24')](_0x2461bc);};}exports[_0xd43f('0x25')]=function(_0x51b765,_0x7fc3e){var _0x2ccd50={'include':[{'model':db[_0xd43f('0x26')],'as':_0xd43f('0x27')}]},_0x523718={},_0x3b785f={'count':0x0,'rows':[]};var _0x4ed4eb=_[_0xd43f('0x28')](db[_0xd43f('0x29')][_0xd43f('0x2a')],function(_0x20682d){return{'name':_0x20682d[_0xd43f('0x2b')],'type':_0x20682d['type'][_0xd43f('0x2c')]};});_0x523718['model']=_[_0xd43f('0x28')](_0x4ed4eb,_0xd43f('0x23'));_0x523718[_0xd43f('0x2d')]=_['keys'](_0x51b765[_0xd43f('0x2d')]);_0x523718[_0xd43f('0x2e')]=_['intersection'](_0x523718[_0xd43f('0x2f')],_0x523718['query']);_0x2ccd50['attributes']=_[_0xd43f('0x30')](_0x523718['model'],qs['fields'](_0x51b765[_0xd43f('0x2d')]['fields']));_0x2ccd50['attributes']=_0x2ccd50[_0xd43f('0x31')][_0xd43f('0x32')]?_0x2ccd50[_0xd43f('0x31')]:_0x523718[_0xd43f('0x2f')];if(!_0x51b765[_0xd43f('0x2d')]['hasOwnProperty'](_0xd43f('0x33'))){_0x2ccd50[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x51b765[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0x2ccd50[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0x51b765[_0xd43f('0x2d')][_0xd43f('0x1a')]);}_0x2ccd50[_0xd43f('0x34')]=qs[_0xd43f('0x35')](_0x51b765['query'][_0xd43f('0x35')]);_0x2ccd50[_0xd43f('0x36')]=qs['filters'](_['pick'](_0x51b765[_0xd43f('0x2d')],_0x523718[_0xd43f('0x2e')]),_0x4ed4eb);if(_0x51b765[_0xd43f('0x2d')]['filter']){_0x2ccd50[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0x2ccd50[_0xd43f('0x36')],{'$or':_[_0xd43f('0x28')](_0x4ed4eb,function(_0x546f1e){if(_0x546f1e['type']!==_0xd43f('0x38')){var _0x39e9d1={};_0x39e9d1[_0x546f1e[_0xd43f('0x23')]]={'$like':'%'+_0x51b765['query'][_0xd43f('0x39')]+'%'};return _0x39e9d1;}})});}_0x2ccd50=_[_0xd43f('0x37')]({},_0x2ccd50,_0x51b765[_0xd43f('0x3a')]);var _0x425628={'where':_0x2ccd50[_0xd43f('0x36')]};return db[_0xd43f('0x29')][_0xd43f('0x1d')](_0x425628)[_0xd43f('0x10')](function(_0x4f5587){_0x3b785f[_0xd43f('0x1d')]=_0x4f5587;if(_0x51b765[_0xd43f('0x2d')][_0xd43f('0x3b')]){_0x2ccd50[_0xd43f('0x3c')]=[{'all':!![]}];}return db[_0xd43f('0x29')][_0xd43f('0x3d')](_0x2ccd50);})[_0xd43f('0x10')](function(_0x30fcd9){_0x3b785f[_0xd43f('0x3e')]=_0x30fcd9;return _0x3b785f;})[_0xd43f('0x10')](respondWithFilteredResult(_0x7fc3e,_0x2ccd50))[_0xd43f('0x17')](handleError(_0x7fc3e,null));};exports['show']=function(_0x440627,_0x15d79c){var _0x3b6d79={'raw':![],'where':{'id':_0x440627[_0xd43f('0x3f')]['id']},'include':[{'model':db[_0xd43f('0x26')],'as':'mandatoryDispositionPause'}]},_0x237bc1={};_0x237bc1[_0xd43f('0x2f')]=_['keys'](db[_0xd43f('0x29')]['rawAttributes']);_0x237bc1[_0xd43f('0x2d')]=_[_0xd43f('0x40')](_0x440627[_0xd43f('0x2d')]);_0x237bc1[_0xd43f('0x2e')]=_[_0xd43f('0x30')](_0x237bc1[_0xd43f('0x2f')],_0x237bc1[_0xd43f('0x2d')]);_0x3b6d79[_0xd43f('0x31')]=_[_0xd43f('0x30')](_0x237bc1['model'],qs[_0xd43f('0x41')](_0x440627[_0xd43f('0x2d')][_0xd43f('0x41')]));_0x3b6d79[_0xd43f('0x31')]=_0x3b6d79[_0xd43f('0x31')][_0xd43f('0x32')]?_0x3b6d79[_0xd43f('0x31')]:_0x237bc1[_0xd43f('0x2f')];if(_0x440627[_0xd43f('0x2d')][_0xd43f('0x3b')]){_0x3b6d79[_0xd43f('0x3c')]=[{'all':!![]}];}_0x3b6d79=_['merge']({},_0x3b6d79,_0x440627['options']);return db[_0xd43f('0x29')][_0xd43f('0x42')](_0x3b6d79)[_0xd43f('0x10')](handleEntityNotFound(_0x15d79c,null))['then'](respondWithResult(_0x15d79c,null))['catch'](handleError(_0x15d79c,null));};exports[_0xd43f('0x43')]=function(_0x28bffb,_0x18fff9){return db[_0xd43f('0x29')][_0xd43f('0x43')](_0x28bffb['body'],{})[_0xd43f('0x10')](function(_0x9093b1){var _0x176332=_0x28bffb[_0xd43f('0x44')][_0xd43f('0x21')]({'plain':!![]});if(!_0x176332)throw new Error(_0xd43f('0x45'));if(_0x176332['role']===_0xd43f('0x44')){var _0x381276=_0x9093b1[_0xd43f('0x21')]({'plain':!![]});var _0x376d02=_0xd43f('0x46');return db[_0xd43f('0x47')][_0xd43f('0x42')]({'where':{'name':_0x376d02,'userProfileId':_0x176332[_0xd43f('0x48')]},'raw':!![]})['then'](function(_0x2a5fd1){if(_0x2a5fd1&&_0x2a5fd1[_0xd43f('0x49')]===0x0){return db[_0xd43f('0x4a')]['create']({'name':_0x381276[_0xd43f('0x23')],'resourceId':_0x381276['id'],'type':_0x2a5fd1[_0xd43f('0x23')],'sectionId':_0x2a5fd1['id']},{})[_0xd43f('0x10')](function(){return _0x9093b1;});}else{return _0x9093b1;}})[_0xd43f('0x17')](function(_0x41588b){logger[_0xd43f('0x14')](_0xd43f('0x4b'),_0x41588b);throw _0x41588b;});}return _0x9093b1;})[_0xd43f('0x10')](respondWithResult(_0x18fff9,0xc9))[_0xd43f('0x17')](handleError(_0x18fff9,null));};exports[_0xd43f('0x4c')]=function(_0x4ca871,_0x1398ef){if(_0x4ca871[_0xd43f('0x4d')]['id']){delete _0x4ca871['body']['id'];}return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x4ca871[_0xd43f('0x3f')]['id']},'include':[{'model':db['Pause'],'as':_0xd43f('0x27')}]})['then'](handleEntityNotFound(_0x1398ef,null))[_0xd43f('0x10')](saveUpdates(_0x4ca871['body'],null))[_0xd43f('0x10')](respondWithResult(_0x1398ef,null))['catch'](handleError(_0x1398ef,null));};exports[_0xd43f('0x20')]=function(_0x1378db,_0xee4cdd){return db['ChatWebsite']['find']({'where':{'id':_0x1378db[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0xee4cdd,null))['then'](removeEntity(_0xee4cdd,null))[_0xd43f('0x17')](handleError(_0xee4cdd,null));};exports[_0xd43f('0x4e')]=function(_0x4cd762,_0xc8f239){return db[_0xd43f('0x29')][_0xd43f('0x4e')]()[_0xd43f('0x10')](respondWithResult(_0xc8f239,null))[_0xd43f('0x17')](handleError(_0xc8f239,null));};exports[_0xd43f('0x4f')]=function(_0x2851dc,_0x5a2129){if(_0x2851dc[_0xd43f('0x4d')]['id']){delete _0x2851dc[_0xd43f('0x4d')]['id'];}return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x2851dc[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x5a2129,null))[_0xd43f('0x10')](function(_0x539a9b){if(_0x539a9b){_0x2851dc[_0xd43f('0x4d')][_0xd43f('0x50')]=_0x539a9b['id'];return db['Disposition'][_0xd43f('0x43')](_0x2851dc[_0xd43f('0x4d')]);}})[_0xd43f('0x10')](respondWithResult(_0x5a2129,null))[_0xd43f('0x17')](handleError(_0x5a2129,null));};exports[_0xd43f('0x51')]=function(_0xd40a7b,_0x459c43){var _0x553b4a={'raw':![],'where':{}};var _0xb1bd44={};var _0x15210f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd43f('0x52')]({'where':{'id':_0xd40a7b['params']['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x459c43,null))[_0xd43f('0x10')](function(_0xe5efb0){if(_0xe5efb0){_0xb1bd44[_0xd43f('0x2f')]=_[_0xd43f('0x40')](db[_0xd43f('0x53')][_0xd43f('0x2a')]);_0xb1bd44[_0xd43f('0x2d')]=_[_0xd43f('0x40')](_0xd40a7b[_0xd43f('0x2d')]);_0xb1bd44[_0xd43f('0x2e')]=_[_0xd43f('0x30')](_0xb1bd44[_0xd43f('0x2f')],_0xb1bd44[_0xd43f('0x2d')]);_0x553b4a['attributes']=_[_0xd43f('0x30')](_0xb1bd44[_0xd43f('0x2f')],qs[_0xd43f('0x41')](_0xd40a7b['query'][_0xd43f('0x41')]));_0x553b4a['attributes']=_0x553b4a[_0xd43f('0x31')][_0xd43f('0x32')]?_0x553b4a[_0xd43f('0x31')]:_0xb1bd44[_0xd43f('0x2f')];if(!_0xd40a7b['query'][_0xd43f('0x54')](_0xd43f('0x33'))){_0x553b4a[_0xd43f('0x1c')]=qs['limit'](_0xd40a7b[_0xd43f('0x2d')]['limit']);_0x553b4a[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0xd40a7b[_0xd43f('0x2d')][_0xd43f('0x1a')]);}_0x553b4a['order']=qs[_0xd43f('0x35')](_0xd40a7b['query'][_0xd43f('0x35')]);_0x553b4a['where']=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0xd40a7b['query'],_0xb1bd44[_0xd43f('0x2e')]));_0x553b4a[_0xd43f('0x36')][_0xd43f('0x50')]=_0xe5efb0['id'];if(_0xd40a7b[_0xd43f('0x2d')]['filter']){_0x553b4a[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0x553b4a[_0xd43f('0x36')],{'$or':_[_0xd43f('0x28')](_0x553b4a['attributes'],function(_0x3723de){var _0x182bfd={};_0x182bfd[_0x3723de]={'$like':'%'+_0xd40a7b['query']['filter']+'%'};return _0x182bfd;})});}_0x553b4a=_[_0xd43f('0x37')]({},_0x553b4a,_0xd40a7b[_0xd43f('0x3a')]);return db[_0xd43f('0x53')]['count']({'where':_0x553b4a[_0xd43f('0x36')]})['then'](function(_0x2d8760){_0x15210f[_0xd43f('0x1d')]=_0x2d8760;if(_0xd40a7b['query'][_0xd43f('0x3b')]){_0x553b4a[_0xd43f('0x3c')]=[{'all':!![]}];}return db[_0xd43f('0x53')][_0xd43f('0x3d')](_0x553b4a);})[_0xd43f('0x10')](function(_0x2f6499){_0x15210f[_0xd43f('0x3e')]=_0x2f6499;return _0x15210f;});}})[_0xd43f('0x10')](respondWithFilteredResult(_0x459c43,_0x553b4a))[_0xd43f('0x17')](handleError(_0x459c43,null));};exports[_0xd43f('0x56')]=function(_0x3703b5,_0x595ba5){return db[_0xd43f('0x29')]['find']({'where':{'id':_0x3703b5[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x595ba5,null))[_0xd43f('0x10')](function(_0x321f9){if(_0x321f9){return _0x321f9['removeDispositions'](_0x3703b5['query'][_0xd43f('0x57')]);}})[_0xd43f('0x10')](respondWithStatusCode(_0x595ba5,null))['catch'](handleError(_0x595ba5,null));};exports[_0xd43f('0x58')]=function(_0x370954,_0x3a5420){if(_0x370954[_0xd43f('0x4d')]['id']){delete _0x370954[_0xd43f('0x4d')]['id'];}return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x370954[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x3a5420,null))[_0xd43f('0x10')](function(_0x1c97c3){if(_0x1c97c3){_0x370954[_0xd43f('0x4d')][_0xd43f('0x50')]=_0x1c97c3['id'];return db[_0xd43f('0x59')][_0xd43f('0x43')](_0x370954[_0xd43f('0x4d')]);}})['then'](respondWithResult(_0x3a5420,null))['catch'](handleError(_0x3a5420,null));};exports[_0xd43f('0x5a')]=function(_0xc8fc9,_0x596bde){var _0xa29ccc={'raw':![],'where':{}};var _0x4a3dc={};var _0x4dab68={'count':0x0,'rows':[]};return db[_0xd43f('0x29')][_0xd43f('0x52')]({'where':{'id':_0xc8fc9[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x596bde,null))['then'](function(_0x17830b){if(_0x17830b){_0x4a3dc[_0xd43f('0x2f')]=_[_0xd43f('0x40')](db[_0xd43f('0x59')][_0xd43f('0x2a')]);_0x4a3dc[_0xd43f('0x2d')]=_[_0xd43f('0x40')](_0xc8fc9[_0xd43f('0x2d')]);_0x4a3dc[_0xd43f('0x2e')]=_[_0xd43f('0x30')](_0x4a3dc[_0xd43f('0x2f')],_0x4a3dc[_0xd43f('0x2d')]);_0xa29ccc['attributes']=_[_0xd43f('0x30')](_0x4a3dc[_0xd43f('0x2f')],qs[_0xd43f('0x41')](_0xc8fc9[_0xd43f('0x2d')][_0xd43f('0x41')]));_0xa29ccc[_0xd43f('0x31')]=_0xa29ccc[_0xd43f('0x31')]['length']?_0xa29ccc[_0xd43f('0x31')]:_0x4a3dc[_0xd43f('0x2f')];if(!_0xc8fc9[_0xd43f('0x2d')][_0xd43f('0x54')]('nolimit')){_0xa29ccc[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0xc8fc9[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0xa29ccc[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0xc8fc9[_0xd43f('0x2d')][_0xd43f('0x1a')]);}_0xa29ccc[_0xd43f('0x34')]=qs['sort'](_0xc8fc9[_0xd43f('0x2d')]['sort']);_0xa29ccc[_0xd43f('0x36')]=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0xc8fc9[_0xd43f('0x2d')],_0x4a3dc['filters']));_0xa29ccc[_0xd43f('0x36')][_0xd43f('0x50')]=_0x17830b['id'];if(_0xc8fc9['query'][_0xd43f('0x39')]){_0xa29ccc[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0xa29ccc[_0xd43f('0x36')],{'$or':_[_0xd43f('0x28')](_0xa29ccc[_0xd43f('0x31')],function(_0x4f3d39){var _0x5c6897={};_0x5c6897[_0x4f3d39]={'$like':'%'+_0xc8fc9['query'][_0xd43f('0x39')]+'%'};return _0x5c6897;})});}_0xa29ccc=_['merge']({},_0xa29ccc,_0xc8fc9[_0xd43f('0x3a')]);return db['CannedAnswer'][_0xd43f('0x1d')]({'where':_0xa29ccc[_0xd43f('0x36')]})[_0xd43f('0x10')](function(_0xcd8b45){_0x4dab68[_0xd43f('0x1d')]=_0xcd8b45;if(_0xc8fc9[_0xd43f('0x2d')][_0xd43f('0x3b')]){_0xa29ccc[_0xd43f('0x3c')]=[{'all':!![]}];}return db[_0xd43f('0x59')][_0xd43f('0x3d')](_0xa29ccc);})[_0xd43f('0x10')](function(_0x32a272){_0x4dab68[_0xd43f('0x3e')]=_0x32a272;return _0x4dab68;});}})['then'](respondWithFilteredResult(_0x596bde,_0xa29ccc))[_0xd43f('0x17')](handleError(_0x596bde,null));};exports[_0xd43f('0x5b')]=function(_0x80efa4,_0x43f29e){return db[_0xd43f('0x29')]['find']({'where':{'id':_0x80efa4[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x43f29e,null))[_0xd43f('0x10')](function(_0xd6f157){if(_0xd6f157){return _0xd6f157[_0xd43f('0x5b')](_0x80efa4[_0xd43f('0x2d')][_0xd43f('0x57')]);}})['then'](respondWithStatusCode(_0x43f29e,null))['catch'](handleError(_0x43f29e,null));};exports[_0xd43f('0x5c')]=function(_0x23fd84,_0x3781a9){_0x23fd84[_0xd43f('0x4d')]['sitepic']=_0x23fd84['file']['filename'];return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0x23fd84[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x3781a9,null))[_0xd43f('0x10')](saveUpdates(_0x23fd84[_0xd43f('0x4d')],null))[_0xd43f('0x10')](respondWithResult(_0x3781a9,null))['catch'](handleError(_0x3781a9,null));};exports[_0xd43f('0x5d')]=function(_0xfa6af3,_0x59da9b){_0xfa6af3['body']['agentAvatar']=_0xfa6af3[_0xd43f('0x5e')][_0xd43f('0x5f')];return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0xfa6af3['params']['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x59da9b,null))['then'](saveUpdates(_0xfa6af3[_0xd43f('0x4d')],null))[_0xd43f('0x10')](respondWithResult(_0x59da9b,null))['catch'](handleError(_0x59da9b,null));};exports[_0xd43f('0x60')]=function(_0x245b22,_0x12f230){_0x245b22['body']['customerAvatar']=_0x245b22[_0xd43f('0x5e')]['filename'];return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x245b22[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x12f230,null))[_0xd43f('0x10')](saveUpdates(_0x245b22['body'],null))[_0xd43f('0x10')](respondWithResult(_0x12f230,null))['catch'](handleError(_0x12f230,null));};exports[_0xd43f('0x61')]=function(_0x3bd29e,_0x547185){_0x3bd29e[_0xd43f('0x4d')][_0xd43f('0x62')]=_0x3bd29e['file'][_0xd43f('0x5f')];return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0x3bd29e[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x547185,null))[_0xd43f('0x10')](saveUpdates(_0x3bd29e[_0xd43f('0x4d')],null))[_0xd43f('0x10')](respondWithResult(_0x547185,null))[_0xd43f('0x17')](handleError(_0x547185,null));};exports[_0xd43f('0x63')]=function(_0x37e350,_0x8359f6){var _0xb503d9=path[_0xd43f('0x64')](config['root'],_0xd43f('0x65'));var _0x1caf5d={'where':{'id':_0x37e350[_0xd43f('0x3f')]['id']},'attributes':['id',_0xd43f('0x66')],'raw':!![]};var _0x493268=![];return require(_0xd43f('0x67'))[_0xd43f('0x68')]()['then'](function(_0x2a8c7b){if(_0x2a8c7b){_0x493268=_0x2a8c7b[_0xd43f('0x69')];}})[_0xd43f('0x10')](function(){return db[_0xd43f('0x29')][_0xd43f('0x42')](_0x1caf5d);})[_0xd43f('0x10')](handleEntityNotFound(_0x8359f6,null))['then'](function(_0x3757e1){if(_0x3757e1){if(!_['isNil'](_0x3757e1['sitepic'])){if(fs[_0xd43f('0x6a')](path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x6c'),_0x3757e1['sitepic']))&&_0x493268){_0xb503d9=path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x6c'),_0x3757e1[_0xd43f('0x66')]);}}return _0x8359f6['download'](_0xb503d9);}})[_0xd43f('0x17')](handleError(_0x8359f6,null));};exports[_0xd43f('0x6d')]=function(_0x5b2330,_0x56710d){var _0x3905c4=path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x6e'));var _0x2b8199={'where':{'id':_0x5b2330[_0xd43f('0x3f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xd43f('0x29')][_0xd43f('0x42')](_0x2b8199)[_0xd43f('0x10')](handleEntityNotFound(_0x56710d,null))[_0xd43f('0x10')](function(_0x526a55){if(_0x526a55){if(!_[_0xd43f('0x6f')](_0x526a55[_0xd43f('0x70')])){if(fs[_0xd43f('0x6a')](path[_0xd43f('0x64')](config['root'],'server/files/images/avatars/',_0x526a55[_0xd43f('0x70')]))){_0x3905c4=path[_0xd43f('0x64')](config['root'],_0xd43f('0x71'),_0x526a55[_0xd43f('0x70')]);}}return _0x56710d[_0xd43f('0x72')](_0x3905c4);}})[_0xd43f('0x17')](handleError(_0x56710d,null));};exports['getCustomerAvatar']=function(_0x3c7b21,_0x37fded){var _0x39b6ce=path['join'](config[_0xd43f('0x6b')],_0xd43f('0x73'));var _0x378e67={'where':{'id':_0x3c7b21[_0xd43f('0x3f')]['id']},'attributes':['id',_0xd43f('0x74'),_0xd43f('0x75')],'raw':!![]};return db[_0xd43f('0x29')]['find'](_0x378e67)['then'](handleEntityNotFound(_0x37fded,null))[_0xd43f('0x10')](function(_0x2b4210){if(_0x2b4210){if(!_[_0xd43f('0x6f')](_0x2b4210['customerAvatar'])){if(fs[_0xd43f('0x6a')](path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x71'),_0x2b4210[_0xd43f('0x74')]))&&_0x2b4210[_0xd43f('0x75')]){_0x39b6ce=path[_0xd43f('0x64')](config['root'],_0xd43f('0x71'),_0x2b4210[_0xd43f('0x74')]);}}return _0x37fded[_0xd43f('0x72')](_0x39b6ce);}})[_0xd43f('0x17')](handleError(_0x37fded,null));};exports[_0xd43f('0x76')]=function(_0x52db62,_0x211b48){var _0x4fe18a=path['join'](config[_0xd43f('0x6b')],_0xd43f('0x77'));var _0x1911e5={'where':{'id':_0x52db62[_0xd43f('0x3f')]['id']},'attributes':['id',_0xd43f('0x62')],'raw':!![]};return db[_0xd43f('0x29')][_0xd43f('0x42')](_0x1911e5)[_0xd43f('0x10')](handleEntityNotFound(_0x211b48,null))[_0xd43f('0x10')](function(_0x3958e3){if(_0x3958e3){if(!_['isNil'](_0x3958e3[_0xd43f('0x62')])){if(fs[_0xd43f('0x6a')](path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x71'),_0x3958e3['systemAvatar']))){_0x4fe18a=path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0x71'),_0x3958e3[_0xd43f('0x62')]);}}return _0x211b48[_0xd43f('0x72')](_0x4fe18a);}})[_0xd43f('0x17')](handleError(_0x211b48,null));};exports[_0xd43f('0x78')]=function(_0x30be89,_0x2eba10){var _0x549041=require('user-agent-parser');var _0x3b8c12=new _0x549041();var _0x5e631f=_0x3b8c12[_0xd43f('0x79')](_0x30be89[_0xd43f('0x7a')][_0xd43f('0x7b')])[_0xd43f('0x7c')]();var _0x48499c={'body':_0x30be89[_0xd43f('0x4d')],'channel':_0xd43f('0x7d')};var _0xde7606=[];var _0x50f233=[];var _0x126eae={};var _0x17443f=![];return db[_0xd43f('0x7e')][_0xd43f('0x4e')]()['then'](function(_0x427e05){if(!_0x427e05){throw new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))]('no\x20available\x20attributes');}_0xde7606=_[_0xd43f('0x81')](_['keys'](_0x427e05),[_0xd43f('0x82'),_0xd43f('0x83')]);_0x50f233=_[_0xd43f('0x81')](_[_0xd43f('0x40')](_0x427e05),[_0xd43f('0x82'),_0xd43f('0x83'),_0xd43f('0x84'),_0xd43f('0x85')]);if(_0x30be89[_0xd43f('0x4d')]['id']){delete _0x30be89[_0xd43f('0x4d')]['id'];}if(_['isNil'](_0x30be89[_0xd43f('0x4d')]['from'])){throw new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x30be89[_0xd43f('0x4d')][_0xd43f('0x4d')])||_0x30be89[_0xd43f('0x4d')][_0xd43f('0x4d')]===''){throw new db['Sequelize'][(_0xd43f('0x80'))](_0xd43f('0x86'));}if(_['isNil'](_0x30be89[_0xd43f('0x4d')][_0xd43f('0x87')])){throw new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50f233);}if(!_[_0xd43f('0x88')](_0x50f233,_0x30be89[_0xd43f('0x4d')][_0xd43f('0x87')])){throw new db[(_0xd43f('0x7f'))]['ValidationError'](_0xd43f('0x89')+_0x50f233);}_0x126eae[_0x30be89['body'][_0xd43f('0x87')]]=_0x30be89[_0xd43f('0x4d')][_0xd43f('0x8a')];})[_0xd43f('0x10')](function(){return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x30be89[_0xd43f('0x3f')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd43f('0x7e')],'as':_0xd43f('0x8b'),'where':_0x126eae,'limit':0x1,'order':[[_0xd43f('0x83'),_0xd43f('0x8c')]]}]},{'model':db[_0xd43f('0x8d')],'as':_0xd43f('0x8e')}]});})[_0xd43f('0x10')](handleEntityNotFound(_0x2eba10,null))[_0xd43f('0x10')](function(_0x445bb2){if(_0x445bb2&&_0x445bb2[_0xd43f('0x8f')]){_0x48499c[_0xd43f('0x90')]=_0x445bb2;_0x48499c[_0xd43f('0x91')]=_0x445bb2[_0xd43f('0x8e')];_0x48499c[_0xd43f('0x92')]=_0x445bb2[_0xd43f('0x8f')];_0x48499c['applications']=_[_0xd43f('0x93')](_0x48499c[_0xd43f('0x91')],[_0xd43f('0x94')],[_0xd43f('0x95')]);if(_0x48499c['account'][_0xd43f('0x8e')]){delete _0x48499c[_0xd43f('0x90')][_0xd43f('0x8e')];}if(_0x48499c[_0xd43f('0x90')][_0xd43f('0x8f')]&&_0x48499c[_0xd43f('0x90')][_0xd43f('0x8f')][_0xd43f('0x8b')][_0xd43f('0x32')]){return _0x48499c[_0xd43f('0x90')][_0xd43f('0x8f')][_0xd43f('0x8b')][0x0];}var _0x41c0ea=_[_0xd43f('0x9')](_0x30be89['body'],{'firstName':_0x30be89['body']['from'],'ListId':_0x445bb2[_0xd43f('0x85')]});_0x41c0ea[_0x30be89['body']['mapKey']]=_0x30be89[_0xd43f('0x4d')][_0xd43f('0x8a')];return db[_0xd43f('0x7e')][_0xd43f('0x43')](_0x41c0ea,{'fields':_0xde7606,'raw':!![]});}})[_0xd43f('0x10')](handleEntityNotFound(_0x2eba10,null))['then'](function(_0x808f94){_0x48499c[_0xd43f('0x96')]=_0x808f94;var _0x4cbb61=_0x30be89[_0xd43f('0x4d')]['customerIp'];if(_0x30be89[_0xd43f('0x7a')][_0xd43f('0x97')]){_0x4cbb61=_0x30be89[_0xd43f('0x7a')][_0xd43f('0x97')];}else if(_0x30be89['headers'][_0xd43f('0x98')]){_0x4cbb61=_[_0xd43f('0x99')](_0x30be89['headers'][_0xd43f('0x98')][_0xd43f('0x9a')](','));}if(_0x808f94){var _0x651f61={'ContactId':_0x808f94['id'],'ChatWebsiteId':_0x30be89['params']['id'],'from':(_0x808f94[_0xd43f('0x9b')]||'')+'\x20'+(_0x808f94['lastName']||''),'customerIp':_0x4cbb61,'customerPort':_0x30be89['headers'][_0xd43f('0x9c')]?_0x30be89[_0xd43f('0x7a')][_0xd43f('0x9c')]:null,'referer':_0x30be89[_0xd43f('0x4d')][_0xd43f('0x9d')],'browserName':_0x5e631f[_0xd43f('0x9e')][_0xd43f('0x23')]&&_0x5e631f[_0xd43f('0x9e')][_0xd43f('0x9f')]?util[_0xd43f('0xa0')]('%s\x20%s',_0x5e631f[_0xd43f('0x9e')]['name'],_0x5e631f[_0xd43f('0x9e')][_0xd43f('0x9f')]):'unknown','browserVersion':_0x5e631f['browser'][_0xd43f('0x9f')]||_0xd43f('0xa1'),'osName':util[_0xd43f('0xa0')]('%s\x20%s',_0x5e631f['os']['name'],_0x5e631f['os'][_0xd43f('0x9f')]),'osVersion':_0x5e631f['os'][_0xd43f('0x9f')],'deviceModel':_0x5e631f[_0xd43f('0xa2')]['model']&&_0x5e631f[_0xd43f('0xa2')][_0xd43f('0xa3')]?util[_0xd43f('0xa0')]('%s\x20%s\x20%s',_0x5e631f['device']['model'],_0x5e631f[_0xd43f('0xa2')][_0xd43f('0xa3')],_0x5e631f[_0xd43f('0xa2')][_0xd43f('0xa4')]):null,'deviceVendor':_0x5e631f[_0xd43f('0xa2')][_0xd43f('0xa3')],'deviceType':_0x5e631f[_0xd43f('0xa2')][_0xd43f('0xa4')],'formData':JSON[_0xd43f('0xa5')](_0x30be89[_0xd43f('0x4d')])};var _0xed7746={'ChatWebsiteId':_0x30be89[_0xd43f('0x3f')]['id'],'closed':![]};if(_0x30be89['body'][_0xd43f('0xa6')]){_0xed7746[_0xd43f('0xa6')]=_0x30be89[_0xd43f('0x4d')][_0xd43f('0xa6')];return db['ChatInteraction'][_0xd43f('0x42')]({'where':_0xed7746})['then'](function(_0x47c1a9){if(_0x47c1a9){return[_0x47c1a9,![]];}_0x651f61[_0xd43f('0xa6')]=_0x30be89[_0xd43f('0x4d')][_0xd43f('0xa6')];_0x651f61[_0xd43f('0xa7')]=_0x30be89['body'][_0xd43f('0xa7')];return db[_0xd43f('0xa8')][_0xd43f('0x43')](_0x651f61)[_0xd43f('0x10')](function(_0x1b46d8){return[_0x1b46d8,!![]];});});}_0xed7746[_0xd43f('0xa9')]=_0x808f94['id'];if(_0x30be89['body'][_0xd43f('0xaa')]&&_0x30be89['body']['interaction']['id']){_0xed7746['id']=_0x30be89['body'][_0xd43f('0xaa')]['id'];return db[_0xd43f('0xa8')][_0xd43f('0x42')]({'where':_0xed7746})['then'](function(_0x3e1382){if(_0x3e1382){return[_0x3e1382,![]];}return db[_0xd43f('0xa8')][_0xd43f('0x43')](_0x651f61)[_0xd43f('0x10')](function(_0x3c9d94){return[_0x3c9d94,!![]];});});}return db[_0xd43f('0xa8')][_0xd43f('0x43')](_0x651f61)[_0xd43f('0x10')](function(_0x651406){return[_0x651406,!![]];});}})[_0xd43f('0xab')](function(_0x32a0e5,_0x260151){if(_0x32a0e5){_0x17443f=_0x260151;if(!_0x260151){var _0x2f02b0={'from':(_0x48499c['contact'][_0xd43f('0x9b')]||'')+'\x20'+(_0x48499c[_0xd43f('0x96')][_0xd43f('0xac')]||'')};if(_0x30be89[_0xd43f('0x4d')][_0xd43f('0xa6')]&&_0x30be89[_0xd43f('0x4d')][_0xd43f('0xad')]&&_0x30be89['body'][_0xd43f('0xa6')]!=_0x30be89['body'][_0xd43f('0xad')]){_0x2f02b0[_0xd43f('0xa6')]=_0x30be89[_0xd43f('0x4d')][_0xd43f('0xad')];}return _0x32a0e5['update'](_0x2f02b0);}else{return _0x32a0e5;}}})[_0xd43f('0x10')](function(_0x175eb7){_0x48499c[_0xd43f('0xaa')]=_0x175eb7[_0xd43f('0x21')]({'plain':!![]});_0x48499c[_0xd43f('0xaa')][_0xd43f('0xae')]=_0x17443f;if(_0x48499c[_0xd43f('0xaa')][_0xd43f('0xae')]){if(_0x48499c[_0xd43f('0x90')]['autoclose']){_0x48499c['applications']['push']({'id':0x0,'priority':_0x48499c[_0xd43f('0x91')][_0xd43f('0x32')]+0x1,'app':_0xd43f('0xaf'),'appdata':_0xd43f('0xb0'),'interval':_0xd43f('0xb1')});}}return db[_0xd43f('0xb2')]['create']({'body':_0x30be89[_0xd43f('0x4d')][_0xd43f('0x4d')],'ChatWebsiteId':_0x30be89[_0xd43f('0x3f')]['id'],'ChatInteractionId':_0x175eb7['id'],'direction':'in','ContactId':_0x48499c['contact']['id'],'AttachmentId':_0x30be89[_0xd43f('0x4d')]['AttachmentId']});})[_0xd43f('0x10')](function(_0x2d4eb6){_0x48499c[_0xd43f('0x15')]=_0x2d4eb6;if(_0x48499c[_0xd43f('0xaa')]['UserId']){return db['User']['find']({'attributes':['id',_0xd43f('0x23')],'where':{'id':_0x48499c[_0xd43f('0xaa')][_0xd43f('0xb3')]}})[_0xd43f('0x10')](function(_0x1f27ae){if(_0x1f27ae){_0x48499c[_0xd43f('0x91')][_0xd43f('0xb4')]({'id':0x0,'priority':0x0,'app':_0xd43f('0xb5'),'appdata':_0x1f27ae[_0xd43f('0x23')]+','+(_0x48499c[_0xd43f('0x90')][_0xd43f('0xb6')]||0xa),'interval':_0xd43f('0xb1')});_0x48499c[_0xd43f('0xb7')]=!![];}return respondWithRpcPromise(_0xd43f('0xb8'),'startRouting',_0x48499c);});}return respondWithRpcPromise(_0xd43f('0xb8'),_0xd43f('0xb9'),_0x48499c);})[_0xd43f('0x10')](function(_0x161bbd){respondWithRpcPromise(_0xd43f('0xba'),'EventManager',{'event':_0xd43f('0x78'),'message':_0x161bbd},client9002);return _0x161bbd;})['then'](respondWithResult(_0x2eba10,null))['catch'](handleError(_0x2eba10,null));};exports[_0xd43f('0xbb')]=function(_0x3aa9e9,_0x2ed713){var _0x5c3ac1,_0x6e28c,_0x26f89a;var _0xf8f697=[];var _0x10ad5f={};var _0x45e33b=_0x3aa9e9[_0xd43f('0xbc')]||[];var _0x5aafaf=[];var _0x1995b2;return db[_0xd43f('0x7e')][_0xd43f('0x4e')]()[_0xd43f('0x10')](function(_0x1036e4){if(!_0x1036e4){throw new db['Sequelize'][(_0xd43f('0x80'))](_0xd43f('0xbd'));}_0xf8f697=_[_0xd43f('0x81')](_[_0xd43f('0x40')](_0x1036e4),[_0xd43f('0x82'),_0xd43f('0x83'),'CompanyId',_0xd43f('0x85')]);if(_0x3aa9e9['body']['id']){delete _0x3aa9e9[_0xd43f('0x4d')]['id'];}if(_[_0xd43f('0x6f')](_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0x8a')])){throw _0x2ed713['status'](0x1f4)[_0xd43f('0x24')](new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))](_0xd43f('0xbe')));}if(_[_0xd43f('0x6f')](_0x3aa9e9['body'][_0xd43f('0x4d')])||_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0x4d')]===''){throw _0x2ed713['status'](0x1f4)['send'](new db['Sequelize'][(_0xd43f('0x80'))](_0xd43f('0x86')));}if(_['isNil'](_0x3aa9e9['body'][_0xd43f('0xbf')])){throw _0x2ed713[_0xd43f('0x18')](0x1f4)[_0xd43f('0x24')](new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))](_0xd43f('0xc0')+_0xf8f697));}if(!_[_0xd43f('0x88')](_0xf8f697,_0x3aa9e9[_0xd43f('0x4d')]['mapKeyOffline'])){throw _0x2ed713[_0xd43f('0x18')](0x1f4)[_0xd43f('0x24')](new db[(_0xd43f('0x7f'))][(_0xd43f('0x80'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf8f697));}_0x10ad5f[_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0xbf')]]=_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0x8a')];})['then'](function(){return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0x3aa9e9[_0xd43f('0x3f')]['id']},'include':[{'model':db[_0xd43f('0xc1')],'as':_0xd43f('0x8f')},{'model':db['MailAccount'],'as':_0xd43f('0xc2')}]});})[_0xd43f('0x10')](handleEntityNotFound(_0x2ed713,null))['then'](function(_0x21bad8){if(_0x21bad8&&_0x21bad8[_0xd43f('0x8f')]){_0x6e28c=_0x21bad8;var _0x50c513=_[_0xd43f('0x9')](_0x3aa9e9[_0xd43f('0x4d')],{'firstName':_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0x8a')],'phone':_0x3aa9e9[_0xd43f('0x4d')]['from'],'ListId':_0x21bad8[_0xd43f('0x85')]});_0x50c513[_0x3aa9e9[_0xd43f('0x4d')][_0xd43f('0xbf')]]=_0x3aa9e9[_0xd43f('0x4d')]['from'];return db[_0xd43f('0x7e')][_0xd43f('0xc3')]({'where':_0x10ad5f,'defaults':_0x50c513});}})[_0xd43f('0xab')](function(_0x55600f){if(_0x55600f){_0x26f89a=_0x55600f;var _0x3a2f6f=fs[_0xd43f('0xc4')](path[_0xd43f('0x64')](config[_0xd43f('0x6b')],_0xd43f('0xc5')),'utf8');var _0x3562f5=ejs['render'](_0x3a2f6f,{'body':_['toPairs'](_0x3aa9e9[_0xd43f('0x4d')]['body']),'bodyTitle':_0x6e28c[_0xd43f('0xc6')]});return db['ChatOfflineMessage'][_0xd43f('0x43')]({'body':_0x3562f5,'plainBody':htmlToText[_0xd43f('0xc7')](_0x3562f5),'ContactId':_0x55600f['id'],'ChatWebsiteId':_0x6e28c['id']});}})[_0xd43f('0x10')](function(_0x13dcce){_0x1995b2=_0x13dcce;if(_0x45e33b[_0xd43f('0x32')]){var _0x2e30d3=_0x45e33b[_0xd43f('0x28')](function(_0x1a59d8){return{'name':_0x1a59d8[_0xd43f('0xc8')],'basename':_0x1a59d8[_0xd43f('0x5f')],'type':_0x1a59d8[_0xd43f('0xc9')],'ChatOfflineMessageId':_0x13dcce['id']};});_0x5aafaf=_0x2e30d3[_0xd43f('0x28')](_0x48410f=>{var _0x56e7eb={'filename':_0x48410f[_0xd43f('0x23')],'path':path['join'](config[_0xd43f('0x6b')],_0xd43f('0xca'),_0xd43f('0xbc'),_0xd43f('0xcb'),_0xd43f('0xcc'),_0x48410f[_0xd43f('0xcd')])};return _0x56e7eb;});if(!_0x6e28c[_0xd43f('0xce')]){return db[_0xd43f('0xcf')][_0xd43f('0xd0')](function(_0xfdbe57){return db[_0xd43f('0xd1')]['bulkCreate'](_0x2e30d3,{'transaction':_0xfdbe57});});}}})[_0xd43f('0x10')](function(){if(_0x1995b2){_0x5c3ac1=_0x1995b2;return db[_0xd43f('0xc2')][_0xd43f('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0xd43f('0xd2')],'as':_0xd43f('0xd3'),'raw':!![],'include':[{'model':db[_0xd43f('0xd4')],'as':_0xd43f('0xd4'),'raw':!![]}]}]});}})[_0xd43f('0x10')](function(_0x50571e){if(_0x50571e&&_0x50571e[_0xd43f('0xd3')]&&_0x6e28c[_0xd43f('0xd5')]&&_0x6e28c[_0xd43f('0xd6')]){var _0x1e40c0=_0x50571e['getSmtpOptions']();return respondWithRpcPromise(_0xd43f('0xd7'),_0xd43f('0xd8'),{'account':_0x1e40c0,'message':{'from':util[_0xd43f('0xa0')](_0xd43f('0xd9'),_0x50571e[_0xd43f('0x23')],_0x50571e[_0xd43f('0xda')]||_0x50571e['Smtp']['user']),'to':_0x6e28c['forwardOfflineAddress'],'subject':_0x6e28c[_0xd43f('0xdb')],'html':_0x5c3ac1[_0xd43f('0x4d')],'attachments':_0x5aafaf}},client9003)[_0xd43f('0x10')](function(){return _0x5c3ac1;})['catch'](function(_0x372b2d){logger[_0xd43f('0x14')](_0x372b2d);});}})[_0xd43f('0x10')](function(){if(_0x6e28c&&_0x6e28c[_0xd43f('0xce')]&&_0x6e28c[_0xd43f('0xdc')]){var _0x1e9d7e=[];if(_0x45e33b[_0xd43f('0x32')]){_0x1e9d7e=_0x45e33b['map'](function(_0x8ac678){return{'name':_0x8ac678[_0xd43f('0xc8')],'basename':_0x8ac678['filename'],'type':_0x8ac678['mimetype'],'ChatOfflineMessageId':_0x1995b2['id']};});}var _0x30c306;if(!_[_0xd43f('0x6f')](_0x6e28c[_0xd43f('0xdd')])){var _0x32c6ce=_['map'](_0x3aa9e9[_0xd43f('0x4d')],function(_0x19b090){return _0x19b090;});var _0xcad05c=_[_0xd43f('0xde')](_0x32c6ce)[0x0];var _0x122339=_[_0xd43f('0xdf')](_0xcad05c,function(_0x299bc7){return _0x299bc7;});_0x30c306=_0x122339[0x1][_0x6e28c['subjectOffline']];}var _0x4f762f={'from':_0x26f89a[_0xd43f('0xda')],'firstName':_0x26f89a[_0xd43f('0x9b')],'lastName':_0x26f89a[_0xd43f('0xac')],'mapKey':_0xd43f('0xda'),'message':{'from':_0x26f89a[_0xd43f('0xda')],'to':_0x6e28c[_0xd43f('0xc2')][_0xd43f('0xda')],'cc':'','subject':_[_0xd43f('0x6f')](_0x30c306)?_0x6e28c[_0xd43f('0xdb')]:_0x30c306,'messageId':'','sentAt':new Date(),'attach':_0x1e9d7e['length'],'attachments':_0x1e9d7e,'originChannel':_0xd43f('0xe0'),'ChatWebsiteId':_0x6e28c['id'],'ChatOfflineMessageId':_0x5c3ac1['id'],'originTo':_0x6e28c[_0xd43f('0xc2')][_0xd43f('0xda')]},'body':_0x5c3ac1[_0xd43f('0x4d')]};var _0x2143ad={'account':{'id':_0x6e28c['MailAccountId']},'body':_0x4f762f,'log':_0xd43f('0xe1')};return respondWithRpcPromise(_0xd43f('0xe1'),_0xd43f('0xe2'),_0x2143ad,client9001)['then'](function(){return _0x5c3ac1;})[_0xd43f('0x17')](function(_0x36839a){logger[_0xd43f('0x14')](_0x36839a);});}return;})[_0xd43f('0x10')](function(){if(_0x5c3ac1){return _0x5c3ac1;}})[_0xd43f('0x10')](respondWithResult(_0x2ed713,null))[_0xd43f('0x17')](function(_0x33517d){logger[_0xd43f('0x14')](_0xd43f('0x17'),_0x33517d);for(var _0x1379fe of _0x45e33b){var _0x328736=path['join'](config['root'],_0xd43f('0xca'),'files',_0xd43f('0xcb'),'offline-chat',_0x1379fe[_0xd43f('0x5f')]);fs_extra[_0xd43f('0xe3')](_0x328736)[_0xd43f('0x17')](function(_0x497c60){logger[_0xd43f('0x14')]('Could\x20not\x20remove\x20attachment\x20file',_0x328736,_0x497c60);});}});};exports[_0xd43f('0xe4')]=function(_0x2bd853,_0x29f0fc){return db[_0xd43f('0xa8')][_0xd43f('0x42')]({'where':{'id':_0x2bd853[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x29f0fc,null))[_0xd43f('0x10')](function(_0x25890a){if(_0x25890a){return _0x25890a['addInteraction'](_0x2bd853[_0xd43f('0x4d')]['ids'],_[_0xd43f('0xe5')](_0x2bd853[_0xd43f('0x4d')],[_0xd43f('0x57'),'id'])||{});}})[_0xd43f('0x10')](respondWithResult(_0x29f0fc,null))[_0xd43f('0x17')](handleError(_0x29f0fc,null));};exports['getInteractions']=function(_0x2f10ee,_0x41fae1){var _0x41f10e={'raw':![],'where':{}};var _0x240bf3={};var _0xbc1c44={'count':0x0,'rows':[]};return db[_0xd43f('0x29')]['findOne']({'where':{'id':_0x2f10ee[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x41fae1,null))[_0xd43f('0x10')](function(_0x1a4385){if(_0x1a4385){_0x240bf3[_0xd43f('0x2f')]=_[_0xd43f('0x40')](db['ChatInteraction'][_0xd43f('0x2a')]);_0x240bf3[_0xd43f('0x2d')]=_[_0xd43f('0x40')](_0x2f10ee[_0xd43f('0x2d')]);_0x240bf3[_0xd43f('0x2e')]=_[_0xd43f('0x30')](_0x240bf3[_0xd43f('0x2f')],_0x240bf3['query']);_0x41f10e[_0xd43f('0x31')]=_[_0xd43f('0x30')](_0x240bf3['model'],qs[_0xd43f('0x41')](_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0x41')]));_0x41f10e[_0xd43f('0x31')]=_0x41f10e[_0xd43f('0x31')]['length']?_0x41f10e[_0xd43f('0x31')]:_0x240bf3['model'];if(!_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0x54')](_0xd43f('0x33'))){_0x41f10e[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0x41f10e[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0x2f10ee[_0xd43f('0x2d')]['offset']);}_0x41f10e[_0xd43f('0x34')]=qs[_0xd43f('0x35')](_0x2f10ee[_0xd43f('0x2d')]['sort']);_0x41f10e[_0xd43f('0x36')]=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0x2f10ee['query'],_0x240bf3[_0xd43f('0x2e')]));_0x41f10e[_0xd43f('0x36')][_0xd43f('0x50')]=_0x1a4385['id'];if(_0x2f10ee[_0xd43f('0x2d')]['filter']){_0x41f10e[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0x41f10e[_0xd43f('0x36')],{'$or':_['map'](_0x41f10e['attributes'],function(_0x5264b4){var _0x58badb={};_0x58badb[_0x5264b4]={'$like':'%'+_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0x39')]+'%'};return _0x58badb;})});}_0x41f10e=_[_0xd43f('0x37')]({},_0x41f10e,_0x2f10ee[_0xd43f('0x3a')]);return db[_0xd43f('0xa8')]['count']({'where':_0x41f10e[_0xd43f('0x36')]})['then'](function(_0x16294d){_0xbc1c44[_0xd43f('0x1d')]=_0x16294d;if(_0x2f10ee[_0xd43f('0x2d')]['includeAll']){_0x41f10e[_0xd43f('0x3c')]=[{'model':db[_0xd43f('0x7e')],'as':_0xd43f('0xe6'),'required':![]},{'model':db[_0xd43f('0xe7')],'as':'Owner','attributes':[_0xd43f('0x23'),'fullname',_0xd43f('0xe8')],'required':![]},{'model':db['Tag'],'as':_0xd43f('0xe9'),'attributes':['id',_0xd43f('0x23'),_0xd43f('0xea')],'where':_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0xeb')]?{'id':_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0xeb')]}:undefined,'required':_0x2f10ee[_0xd43f('0x2d')][_0xd43f('0xeb')]?!![]:![]}];}return db['ChatInteraction'][_0xd43f('0x3d')](_0x41f10e);})[_0xd43f('0x10')](function(_0x5d7e12){_0xbc1c44[_0xd43f('0x3e')]=_0x5d7e12;return _0xbc1c44;});}})[_0xd43f('0x10')](respondWithFilteredResult(_0x41fae1,_0x41f10e))['catch'](handleError(_0x41fae1,null));};function iftimePromise(_0x10df6a,_0x5cf524){return respondWithRpcPromise(_0xd43f('0xec'),_0xd43f('0xed'),{'command':_0x5cf524[_0xd43f('0xee')]?util[_0xd43f('0xa0')](_0xd43f('0xef'),_0x10df6a['interval'],_0x5cf524[_0xd43f('0xee')]):util['format'](_0xd43f('0xf0'),_0x10df6a['interval'])},client9002)['then'](function(_0x207755){var _0x5a1369=_0x207755&&_0x207755[_0xd43f('0xf1')]('true')>=0x0?!![]:![];logger[_0xd43f('0x11')](_0xd43f('0xf2'),_0x5cf524['id'],_0x10df6a['id'],_0x10df6a[_0xd43f('0xf3')],_0x5a1369?_0xd43f('0xf4'):_0xd43f('0xf5'),_0x5cf524[_0xd43f('0xee')]?_0x5cf524['timezone']:'No\x20timezone');return _0x5a1369;})[_0xd43f('0x17')](function(_0xd7f1be){logger[_0xd43f('0x14')](_0xd43f('0xf2'),_0x5cf524['id'],_0x10df6a['id'],_0x10df6a[_0xd43f('0xf3')],util['inspect'](_0xd7f1be,{'showHidden':![],'depth':null}),_0x5cf524[_0xd43f('0xee')]?_0x5cf524[_0xd43f('0xee')]:'No\x20timezone');return![];});}exports[_0xd43f('0xed')]=function(_0x270e46,_0x2dffa3){var _0x579ae4=0x0;var _0xd5380c=0x0;var _0x2b2567=![];var _0x287845;var _0x543b0a;return db[_0xd43f('0x29')][_0xd43f('0x42')]({'where':{'id':_0x270e46[_0xd43f('0x3f')]['id']},'include':[{'model':db[_0xd43f('0xf6')],'as':_0xd43f('0xf6'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xd43f('0xf3')],'raw':!![]}]}]})[_0xd43f('0x10')](handleEntityNotFound(_0x2dffa3,null))[_0xd43f('0x10')](function(_0x159166){if(_0x159166){_0x287845=_0x159166;return _0x159166[_0xd43f('0xf7')]({'raw':!![]});}})['then'](function(_0x452dc0){if(_0x287845){if(_0x452dc0){_0x543b0a=_0x452dc0;}}return require(_0xd43f('0x67'))['getLicense']();})[_0xd43f('0x10')](function(_0x23142d){if(_0x23142d){_0xd5380c=_0x23142d[_0xd43f('0xf8')];_0x2b2567=_0x23142d[_0xd43f('0x69')];}})['then'](function(){return db[_0xd43f('0xa8')]['count']({'where':{'closed':![]}});})['then'](function(_0x2f6cf1){_0x579ae4=_0x2f6cf1;if(_0xd5380c&&_0x2f6cf1>_0xd5380c){return db[_0xd43f('0xf9')][_0xd43f('0x52')]({'where':{'id':0x1}})[_0xd43f('0x10')](function(_0x1110ff){if(_0x1110ff){_0x1110ff[_0xd43f('0xfa')](_0xd43f('0xfb'));}});}})[_0xd43f('0x10')](function(){if(_0x287845['Interval']&&_0x287845[_0xd43f('0xf6')][_0xd43f('0xfc')]){var _0x4acc9f=[];for(var _0x34f49e=0x0;_0x34f49e<_0x287845[_0xd43f('0xf6')][_0xd43f('0xfc')][_0xd43f('0x32')];_0x34f49e++){var _0x22b12d=_0x287845['Interval']['Intervals'][_0x34f49e][_0xd43f('0x21')]({'plain':!![]});_0x4acc9f[_0xd43f('0xfd')](iftimePromise(_0x22b12d,_0x287845));}return BPromise[_0xd43f('0xfe')](_0x4acc9f)[_0xd43f('0x10')](function(_0x5edccb){return _['some'](_0x5edccb);});}else{return!![];}})[_0xd43f('0x10')](function(_0x51345d){var _0x412f1a=fs[_0xd43f('0xc4')](path[_0xd43f('0x64')](config['root'],_0xd43f('0xff')),'utf8');var _0x4874fd={'remote':_0x287845[_0xd43f('0x100')],'query':querystring[_0xd43f('0xa5')](_[_0xd43f('0x37')](_0x287845['get']({'plain':!![]}),{'customerIp':_0x270e46['headers'][_0xd43f('0x98')]||_0x270e46[_0xd43f('0x7a')][_0xd43f('0x101')]||_0x270e46[_0xd43f('0x102')][_0xd43f('0x103')]||_0x270e46['ip'],'referer':_0x270e46[_0xd43f('0x7a')][_0xd43f('0x9d')],'openedInteractions':_0x579ae4,'maxInteractions':_0xd5380c,'virtual':_0x2b2567[_0xd43f('0xf8')],'online':_0x51345d,'custom':_0x2b2567}))['replace'](/'/g,'\x5c\x27')};_0x2dffa3[_0xd43f('0x24')](ejs[_0xd43f('0x104')](Mustache[_0xd43f('0x104')](_0x412f1a,_0x4874fd),{'proactiveActions':_0x543b0a,'alignment':_0x287845[_0xd43f('0x105')],'verticalAlignment':_0x287845[_0xd43f('0x106')],'div_color':_0x287845['color'],'labelText':_0x287845[_0xd43f('0x107')],'text_color':_0x287845[_0xd43f('0x108')],'button_color':_0x287845[_0xd43f('0x109')],'background_color':_0x287845[_0xd43f('0x10a')],'hideWhenOffline':_0x287845['hideWhenOffline'],'interval':_0x287845[_0xd43f('0x10b')]}));})[_0xd43f('0x17')](handleError(_0x2dffa3,null));};exports[_0xd43f('0x10c')]=function(_0x1623f3,_0xdee04d){var _0x530ded=_0x1623f3['params']['id'];var _0x10db9a=_0x1623f3['body'];var _0x5a0613=0xc8;var _0x427aa0=null;return db['sequelize'][_0xd43f('0xd0')]({'isolationLevel':db[_0xd43f('0xcf')][_0xd43f('0x10d')][_0xd43f('0x10e')][_0xd43f('0x10f')]},function(_0x6892ae){return db[_0xd43f('0x29')][_0xd43f('0x52')]({'where':{'id':_0x530ded},'transaction':_0x6892ae})[_0xd43f('0x10')](function(_0x5eab26){if(_0x5eab26){return db[_0xd43f('0x8d')]['destroy']({'where':{'ChatWebsiteId':_0x530ded},'transaction':_0x6892ae})[_0xd43f('0x10')](function(){var _0xe30976=_[_0xd43f('0x28')](_0x10db9a,function(_0x3b902e){_0x3b902e['ChatWebsiteId']=_0x530ded;return _0x3b902e;});return db['ChatApplication'][_0xd43f('0x110')](_0xe30976,{'transaction':_0x6892ae});});}else{_0x5a0613=0x194;_0x427aa0=[];}});})[_0xd43f('0x10')](function(){if(_0x5a0613!==0x194){return db[_0xd43f('0x8d')][_0xd43f('0x111')]({'where':{'ChatWebsiteId':_0x530ded},'order':_0xd43f('0x94')})[_0xd43f('0x10')](function(_0x57c3fb){_0x427aa0=_0x57c3fb;});}})[_0xd43f('0x17')](function(_0xbb6192){_0x5a0613=0x1f4;logger['error'](_0xbb6192['stack']);if(_0xbb6192[_0xd43f('0x23')]){delete _0xbb6192[_0xd43f('0x23')];}_0x427aa0=_0xbb6192;})[_0xd43f('0x112')](function(){if(_0x427aa0===null){_0xdee04d['sendStatus'](_0x5a0613);}else{if(_0x5a0613===0x1f4){_0xdee04d[_0xd43f('0x18')](_0x5a0613)[_0xd43f('0x24')](_0x427aa0);}else{_0xdee04d[_0xd43f('0x18')](_0x5a0613)[_0xd43f('0x19')](_0x427aa0);}}});};exports[_0xd43f('0x113')]=function(_0x592a62,_0x441e18){var _0x5ef779={};var _0xdb7bde={};var _0x5c69d9;var _0x390bc7;return db[_0xd43f('0x29')][_0xd43f('0x52')]({'where':{'id':_0x592a62[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x441e18,null))[_0xd43f('0x10')](function(_0x39238d){if(_0x39238d){_0x5c69d9=_0x39238d;_0xdb7bde[_0xd43f('0x2f')]=_['keys'](db[_0xd43f('0x8d')][_0xd43f('0x2a')]);_0xdb7bde[_0xd43f('0x2d')]=_[_0xd43f('0x40')](_0x592a62['query']);_0xdb7bde['filters']=_[_0xd43f('0x30')](_0xdb7bde[_0xd43f('0x2f')],_0xdb7bde[_0xd43f('0x2d')]);_0x5ef779[_0xd43f('0x31')]=_[_0xd43f('0x30')](_0xdb7bde['model'],qs[_0xd43f('0x41')](_0x592a62[_0xd43f('0x2d')][_0xd43f('0x41')]));_0x5ef779[_0xd43f('0x31')]=_0x5ef779[_0xd43f('0x31')][_0xd43f('0x32')]?_0x5ef779[_0xd43f('0x31')]:_0xdb7bde[_0xd43f('0x2f')];_0x5ef779[_0xd43f('0x34')]=qs[_0xd43f('0x35')](_0x592a62[_0xd43f('0x2d')][_0xd43f('0x35')]);_0x5ef779[_0xd43f('0x36')]=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0x592a62['query'],_0xdb7bde[_0xd43f('0x2e')]));if(_0x592a62[_0xd43f('0x2d')][_0xd43f('0x39')]){_0x5ef779['where']=_['merge'](_0x5ef779['where'],{'$or':_['map'](_0x5ef779[_0xd43f('0x31')],function(_0x18b433){var _0x1df508={};_0x1df508[_0x18b433]={'$like':'%'+_0x592a62['query'][_0xd43f('0x39')]+'%'};return _0x1df508;})});}_0x5ef779=_[_0xd43f('0x37')]({},_0x5ef779,_0x592a62[_0xd43f('0x3a')]);return _0x5c69d9['getApplications'](_0x5ef779);}})[_0xd43f('0x10')](function(_0x2e413d){if(_0x2e413d){_0x390bc7=_0x2e413d[_0xd43f('0x32')];if(!_0x592a62[_0xd43f('0x2d')][_0xd43f('0x54')](_0xd43f('0x33'))){_0x5ef779[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x592a62[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0x5ef779[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0x592a62[_0xd43f('0x2d')]['offset']);}return _0x5c69d9[_0xd43f('0x113')](_0x5ef779);}})[_0xd43f('0x10')](function(_0x22f638){if(_0x22f638){return _0x22f638?{'count':_0x390bc7,'rows':_0x22f638}:null;}})['then'](respondWithResult(_0x441e18,null))[_0xd43f('0x17')](handleError(_0x441e18,null));};exports['addProactiveActions']=function(_0x2d2884,_0x2b56e7){return db[_0xd43f('0x114')][_0xd43f('0x42')]({'where':{'id':_0x2d2884['params']['id']}})['then'](handleEntityNotFound(_0x2b56e7,null))[_0xd43f('0x10')](function(_0x2e424c){if(_0x2e424c){return _0x2e424c[_0xd43f('0x115')](_0x2d2884[_0xd43f('0x4d')][_0xd43f('0x57')],_[_0xd43f('0xe5')](_0x2d2884[_0xd43f('0x4d')],['ids','id'])||{});}})[_0xd43f('0x10')](respondWithResult(_0x2b56e7,null))[_0xd43f('0x17')](handleError(_0x2b56e7,null));};exports['getProactiveActions']=function(_0x3a5439,_0x1fe152){var _0x3aaea4={};var _0x743b23={};var _0x5819c1;var _0x1abff4;return db[_0xd43f('0x29')][_0xd43f('0x52')]({'where':{'id':_0x3a5439[_0xd43f('0x3f')]['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x1fe152,null))[_0xd43f('0x10')](function(_0x4d719d){if(_0x4d719d){_0x5819c1=_0x4d719d;_0x743b23[_0xd43f('0x2f')]=_[_0xd43f('0x40')](db[_0xd43f('0x116')][_0xd43f('0x2a')]);_0x743b23['query']=_['keys'](_0x3a5439[_0xd43f('0x2d')]);_0x743b23[_0xd43f('0x2e')]=_['intersection'](_0x743b23[_0xd43f('0x2f')],_0x743b23[_0xd43f('0x2d')]);_0x3aaea4[_0xd43f('0x31')]=_[_0xd43f('0x30')](_0x743b23['model'],qs[_0xd43f('0x41')](_0x3a5439[_0xd43f('0x2d')][_0xd43f('0x41')]));_0x3aaea4['attributes']=_0x3aaea4['attributes'][_0xd43f('0x32')]?_0x3aaea4[_0xd43f('0x31')]:_0x743b23[_0xd43f('0x2f')];_0x3aaea4[_0xd43f('0x34')]=qs['sort'](_0x3a5439[_0xd43f('0x2d')][_0xd43f('0x35')]);_0x3aaea4['where']=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0x3a5439[_0xd43f('0x2d')],_0x743b23[_0xd43f('0x2e')]));if(_0x3a5439[_0xd43f('0x2d')]['filter']){_0x3aaea4[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0x3aaea4[_0xd43f('0x36')],{'$or':_[_0xd43f('0x28')](_0x3aaea4[_0xd43f('0x31')],function(_0x4d411b){var _0x2fb265={};_0x2fb265[_0x4d411b]={'$like':'%'+_0x3a5439[_0xd43f('0x2d')][_0xd43f('0x39')]+'%'};return _0x2fb265;})});}_0x3aaea4=_['merge']({},_0x3aaea4,_0x3a5439[_0xd43f('0x3a')]);return _0x5819c1[_0xd43f('0xf7')](_0x3aaea4);}})[_0xd43f('0x10')](function(_0x43fd94){if(_0x43fd94){_0x1abff4=_0x43fd94[_0xd43f('0x32')];if(!_0x3a5439['query'][_0xd43f('0x54')]('nolimit')){_0x3aaea4[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x3a5439[_0xd43f('0x2d')]['limit']);_0x3aaea4[_0xd43f('0x1a')]=qs[_0xd43f('0x1a')](_0x3a5439[_0xd43f('0x2d')]['offset']);}return _0x5819c1[_0xd43f('0xf7')](_0x3aaea4);}})[_0xd43f('0x10')](function(_0x9d6218){if(_0x9d6218){return _0x9d6218?{'count':_0x1abff4,'rows':_0x9d6218}:null;}})['then'](respondWithResult(_0x1fe152,null))['catch'](handleError(_0x1fe152,null));};exports[_0xd43f('0x117')]=function(_0x105926,_0x4b6d30){var _0x472901=_0x105926[_0xd43f('0x2d')][_0xd43f('0x118')]===_0xd43f('0x119')?_0xd43f('0x11a'):_0xd43f('0x11b');return db[_0xd43f('0x29')]['find']({'attributes':['id',_0x472901],'where':{'id':_0x105926[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b6d30,null))[_0xd43f('0x10')](function(_0x3e4069){if(_0x3e4069){var _0x2aa5df=_0x3e4069[_0x472901];var _0x3464ec=_0x2aa5df&&_0x2aa5df['items']?_0x2aa5df[_0xd43f('0x11c')]:[];_0x4b6d30[_0xd43f('0x24')]({'fromKey':_[_0xd43f('0x6f')](_0x2aa5df['fromKey'])?undefined:_0x2aa5df['fromKey'],'count':_0x3464ec['length'],'rows':_0x3464ec});}})[_0xd43f('0x17')](handleError(_0x4b6d30,null));};exports['getOfflineMessages']=function(_0x129171,_0x195294){var _0x32aced={'raw':![],'where':{}};var _0x2ae795={};var _0x2315e5={'count':0x0,'rows':[]};return db[_0xd43f('0x29')]['findOne']({'where':{'id':_0x129171[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x195294,null))[_0xd43f('0x10')](function(_0x469bc1){if(_0x469bc1){_0x2ae795[_0xd43f('0x2f')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x2ae795[_0xd43f('0x2d')]=_['keys'](_0x129171[_0xd43f('0x2d')]);_0x2ae795[_0xd43f('0x2e')]=_['intersection'](_0x2ae795[_0xd43f('0x2f')],_0x2ae795[_0xd43f('0x2d')]);_0x32aced['attributes']=_[_0xd43f('0x30')](_0x2ae795[_0xd43f('0x2f')],qs[_0xd43f('0x41')](_0x129171[_0xd43f('0x2d')]['fields']));_0x32aced[_0xd43f('0x31')]=_0x32aced[_0xd43f('0x31')][_0xd43f('0x32')]?_0x32aced[_0xd43f('0x31')]:_0x2ae795['model'];if(!_0x129171[_0xd43f('0x2d')][_0xd43f('0x54')](_0xd43f('0x33'))){_0x32aced[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x129171[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0x32aced['offset']=qs[_0xd43f('0x1a')](_0x129171[_0xd43f('0x2d')][_0xd43f('0x1a')]);}_0x32aced[_0xd43f('0x34')]=qs[_0xd43f('0x35')](_0x129171['query'][_0xd43f('0x35')]);_0x32aced[_0xd43f('0x36')]=qs[_0xd43f('0x2e')](_[_0xd43f('0x55')](_0x129171[_0xd43f('0x2d')],_0x2ae795[_0xd43f('0x2e')]));_0x32aced[_0xd43f('0x36')][_0xd43f('0x50')]=_0x469bc1['id'];if(_0x129171[_0xd43f('0x2d')][_0xd43f('0x39')]){_0x32aced['where']=_[_0xd43f('0x37')](_0x32aced[_0xd43f('0x36')],{'$or':_[_0xd43f('0x28')](_0x32aced[_0xd43f('0x31')],function(_0x5ac693){var _0x296d90={};_0x296d90[_0x5ac693]={'$like':'%'+_0x129171[_0xd43f('0x2d')][_0xd43f('0x39')]+'%'};return _0x296d90;})});}_0x32aced=_[_0xd43f('0x37')]({},_0x32aced,_0x129171[_0xd43f('0x3a')]);return db[_0xd43f('0x11d')][_0xd43f('0x1d')]({'where':_0x32aced['where']})[_0xd43f('0x10')](function(_0x236c67){_0x2315e5[_0xd43f('0x1d')]=_0x236c67;if(_0x129171[_0xd43f('0x2d')][_0xd43f('0x3b')]){_0x32aced[_0xd43f('0x3c')]=[{'all':!![]}];}else{_0x32aced['include']=[{'model':db[_0xd43f('0x7e')],'as':_0xd43f('0xe6'),'required':![]},{'model':db[_0xd43f('0xd1')],'as':_0xd43f('0x11e'),'required':![]}];}return db[_0xd43f('0x11d')][_0xd43f('0x3d')](_0x32aced);})[_0xd43f('0x10')](function(_0xe7a088){_0x2315e5['rows']=_0xe7a088;return _0x2315e5;});}})[_0xd43f('0x10')](respondWithFilteredResult(_0x195294,_0x32aced))['catch'](handleError(_0x195294,null));};exports[_0xd43f('0x11f')]=function(_0x9a08a8,_0x1f4c51){return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0x9a08a8['params']['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x1f4c51,null))[_0xd43f('0x10')](function(_0x1477f0){if(_0x1477f0){return _0x1477f0[_0xd43f('0x11f')](_0x9a08a8[_0xd43f('0x4d')][_0xd43f('0x57')],_[_0xd43f('0xe5')](_0x9a08a8['body'],['ids','id'])||{})[_0xd43f('0xab')](function(_0x5d941e){for(var _0x5825a9=0x0;_0x5825a9<_0x9a08a8['body'][_0xd43f('0x57')][_0xd43f('0x32')];_0x5825a9+=0x1){socket[_0xd43f('0x120')]('userChatWebsite:save',{'UserId':Number(_0x9a08a8[_0xd43f('0x4d')][_0xd43f('0x57')][_0x5825a9]),'ChatWebsiteId':Number(_0x9a08a8[_0xd43f('0x3f')]['id'])});}return _0x5d941e;});}})[_0xd43f('0x10')](respondWithResult(_0x1f4c51,null))[_0xd43f('0x17')](handleError(_0x1f4c51,null));};exports[_0xd43f('0x121')]=function(_0x4ecf57,_0x1f32ea){return db['ChatWebsite'][_0xd43f('0x42')]({'where':{'id':_0x4ecf57['params']['id']}})[_0xd43f('0x10')](handleEntityNotFound(_0x1f32ea,null))[_0xd43f('0x10')](function(_0x39476e){if(_0x39476e){return _0x39476e[_0xd43f('0x121')](_0x4ecf57[_0xd43f('0x2d')]['ids'])[_0xd43f('0x10')](function(){if(_['isArray'](_0x4ecf57[_0xd43f('0x2d')][_0xd43f('0x57')])){for(var _0x232146=0x0;_0x232146<_0x4ecf57[_0xd43f('0x2d')][_0xd43f('0x57')][_0xd43f('0x32')];_0x232146+=0x1){socket['emit'](_0xd43f('0x122'),{'UserId':Number(_0x4ecf57['query'][_0xd43f('0x57')][_0x232146]),'ChatWebsiteId':Number(_0x4ecf57[_0xd43f('0x3f')]['id'])});}}else{socket[_0xd43f('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x4ecf57[_0xd43f('0x2d')][_0xd43f('0x57')]),'ChatWebsiteId':Number(_0x4ecf57[_0xd43f('0x3f')]['id'])});}});}})[_0xd43f('0x10')](respondWithStatusCode(_0x1f32ea,null))[_0xd43f('0x17')](handleError(_0x1f32ea,null));};exports[_0xd43f('0x123')]=function(_0x4bf1b5,_0x29d9c6){var _0x23bb54={};var _0x378673={};var _0x37cc97;var _0x2d4e34;return db['ChatWebsite'][_0xd43f('0x52')]({'where':{'id':_0x4bf1b5[_0xd43f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x29d9c6,null))[_0xd43f('0x10')](function(_0xc54744){if(_0xc54744){_0x37cc97=_0xc54744;_0x378673['model']=_[_0xd43f('0x40')](db[_0xd43f('0xe7')]['rawAttributes']);_0x378673['query']=_[_0xd43f('0x40')](_0x4bf1b5['query']);_0x378673[_0xd43f('0x2e')]=_[_0xd43f('0x30')](_0x378673['model'],_0x378673[_0xd43f('0x2d')]);_0x23bb54[_0xd43f('0x31')]=_['intersection'](_0x378673['model'],qs['fields'](_0x4bf1b5[_0xd43f('0x2d')][_0xd43f('0x41')]));_0x23bb54[_0xd43f('0x31')]=_0x23bb54['attributes'][_0xd43f('0x32')]?_0x23bb54[_0xd43f('0x31')]:_0x378673[_0xd43f('0x2f')];_0x23bb54[_0xd43f('0x34')]=qs['sort'](_0x4bf1b5[_0xd43f('0x2d')]['sort']);_0x23bb54[_0xd43f('0x36')]=qs[_0xd43f('0x2e')](_['pick'](_0x4bf1b5[_0xd43f('0x2d')],_0x378673[_0xd43f('0x2e')]));if(_0x4bf1b5[_0xd43f('0x2d')]['filter']){_0x23bb54[_0xd43f('0x36')]=_[_0xd43f('0x37')](_0x23bb54['where'],{'$or':_[_0xd43f('0x28')](_0x23bb54[_0xd43f('0x31')],function(_0x21bada){var _0x118add={};_0x118add[_0x21bada]={'$like':'%'+_0x4bf1b5[_0xd43f('0x2d')][_0xd43f('0x39')]+'%'};return _0x118add;})});}_0x23bb54=_[_0xd43f('0x37')]({},_0x23bb54,_0x4bf1b5['options']);return _0x37cc97['getAgents'](_0x23bb54);}})['then'](function(_0x5adfc7){if(_0x5adfc7){_0x2d4e34=_0x5adfc7[_0xd43f('0x32')];if(!_0x4bf1b5['query'][_0xd43f('0x54')]('nolimit')){_0x23bb54[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x4bf1b5[_0xd43f('0x2d')][_0xd43f('0x1c')]);_0x23bb54['offset']=qs[_0xd43f('0x1a')](_0x4bf1b5[_0xd43f('0x2d')][_0xd43f('0x1a')]);}return _0x37cc97['getAgents'](_0x23bb54);}})[_0xd43f('0x10')](function(_0x3e6cab){if(_0x3e6cab){return _0x3e6cab?{'count':_0x2d4e34,'rows':_0x3e6cab}:null;}})[_0xd43f('0x10')](respondWithResult(_0x29d9c6,null))['catch'](handleError(_0x29d9c6,null));}; \ No newline at end of file +var _0xf3cc=['ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','count','findAll','rows','show','params','keys','rawAttributes','options','find','create','body','user','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','length','sort','includeAll','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','ChatApplication','account','applications','orderBy','asc','Applications','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s','interval','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info'];(function(_0x2f3f01,_0x4a7f1a){var _0x20a7ad=function(_0x1c041f){while(--_0x1c041f){_0x2f3f01['push'](_0x2f3f01['shift']());}};_0x20a7ad(++_0x4a7f1a);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x5a125c,_0x155fa2){_0x5a125c=_0x5a125c-0x0;var _0x4c70af=_0xf3cc[_0x5a125c];return _0x4c70af;};'use strict';var BPromise=require(_0xcf3c('0x0'));var Mustache=require(_0xcf3c('0x1'));var util=require(_0xcf3c('0x2'));var path=require(_0xcf3c('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf3c('0x4'));var _=require(_0xcf3c('0x5'));var querystring=require(_0xcf3c('0x6'));var Redis=require('ioredis');var qs=require(_0xcf3c('0x7'));var logger=require(_0xcf3c('0x8'))('api');var config=require(_0xcf3c('0x9'));var db=require(_0xcf3c('0xa'))['db'];config[_0xcf3c('0xb')]=_[_0xcf3c('0xc')](config[_0xcf3c('0xb')],{'host':_0xcf3c('0xd'),'port':0x18eb});var socket=require(_0xcf3c('0xe'))(new Redis(config[_0xcf3c('0xb')]));require(_0xcf3c('0xf'))[_0xcf3c('0x10')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0xcf3c('0x11')][_0xcf3c('0x12')]({'port':0x232c});var client9002=jayson[_0xcf3c('0x11')][_0xcf3c('0x12')]({'port':0x232a});var client9003=jayson[_0xcf3c('0x11')][_0xcf3c('0x12')]({'port':0x232b});var client9001=jayson[_0xcf3c('0x11')][_0xcf3c('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x5b1526,_0x245b88,_0x389b0f,_0x59a8dc){return new BPromise(function(_0x60e424,_0x4e6c38){var _0x55ef34=_0x59a8dc||client;return _0x55ef34['request'](_0x5b1526,_0x389b0f)[_0xcf3c('0x13')](function(_0x598576){logger[_0xcf3c('0x14')](_0xcf3c('0x15'),_0x245b88,'request\x20sent');logger[_0xcf3c('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x245b88,_0xcf3c('0x17'),JSON[_0xcf3c('0x18')](_0x598576));if(_0x598576[_0xcf3c('0x19')]){if(_0x598576['error'][_0xcf3c('0x1a')]===0x1f4){logger[_0xcf3c('0x19')](_0xcf3c('0x15'),_0x245b88,_0x598576[_0xcf3c('0x19')]['message']);return _0x4e6c38(_0x598576[_0xcf3c('0x19')][_0xcf3c('0x1b')]);}logger[_0xcf3c('0x19')](_0xcf3c('0x15'),_0x245b88,_0x598576[_0xcf3c('0x19')][_0xcf3c('0x1b')]);return _0x60e424(_0x598576[_0xcf3c('0x19')][_0xcf3c('0x1b')]);}else{logger[_0xcf3c('0x14')](_0xcf3c('0x15'),_0x245b88,_0xcf3c('0x17'));_0x60e424(_0x598576[_0xcf3c('0x1c')]['message']);}})[_0xcf3c('0x1d')](function(_0x54cd87){logger[_0xcf3c('0x19')](_0xcf3c('0x15'),_0x245b88,_0x54cd87);_0x4e6c38(_0x54cd87);});});}function respondWithStatusCode(_0x5dddc1,_0x1bd0f2){_0x1bd0f2=_0x1bd0f2||0xcc;return function(_0x12ff47){if(_0x12ff47){return _0x5dddc1[_0xcf3c('0x1e')](_0x1bd0f2);}return _0x5dddc1[_0xcf3c('0x1f')](_0x1bd0f2)[_0xcf3c('0x20')]();};}function respondWithResult(_0x3f1771,_0x22d98e){_0x22d98e=_0x22d98e||0xc8;return function(_0x43609a){if(_0x43609a){return _0x3f1771['status'](_0x22d98e)[_0xcf3c('0x21')](_0x43609a);}};}function respondWithFilteredResult(_0x4ce43c,_0x2281b6){return function(_0x15b55c){if(_0x15b55c){var _0x42ce14=typeof _0x2281b6[_0xcf3c('0x22')]===_0xcf3c('0x23')&&typeof _0x2281b6[_0xcf3c('0x24')]==='undefined';var _0x22c54c=_0x15b55c['count'];var _0x47d619=_0x42ce14?0x0:_0x2281b6[_0xcf3c('0x22')];var _0x3b253d=_0x42ce14?_0x15b55c['count']:_0x2281b6[_0xcf3c('0x22')]+_0x2281b6['limit'];var _0x1d8223;if(_0x3b253d>=_0x22c54c){_0x3b253d=_0x22c54c;_0x1d8223=0xc8;}else{_0x1d8223=0xce;}_0x4ce43c[_0xcf3c('0x1f')](_0x1d8223);return _0x4ce43c[_0xcf3c('0x25')](_0xcf3c('0x26'),_0x47d619+'-'+_0x3b253d+'/'+_0x22c54c)['json'](_0x15b55c);}return null;};}function saveUpdates(_0xc751e8){return function(_0x41834f){if(_0x41834f){return _0x41834f[_0xcf3c('0x27')](_0xc751e8)[_0xcf3c('0x13')](function(_0x502bca){return _0x502bca;});}return null;};}function removeEntity(_0x1fae74){return function(_0x2cf47e){if(_0x2cf47e){return _0x2cf47e[_0xcf3c('0x28')]()['then'](function(){var _0x3a5880=_0x2cf47e[_0xcf3c('0x29')]({'plain':!![]});var _0x196b02='ChatWebsites';return db[_0xcf3c('0x2a')][_0xcf3c('0x28')]({'where':{'type':_0x196b02,'resourceId':_0x3a5880['id']}})[_0xcf3c('0x13')](function(){return _0x2cf47e;});})[_0xcf3c('0x13')](function(){_0x1fae74[_0xcf3c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aced6){return function(_0x549fb4){if(!_0x549fb4){_0x2aced6[_0xcf3c('0x1e')](0x194);}return _0x549fb4;};}function handleError(_0x57d644,_0x2a78f2){_0x2a78f2=_0x2a78f2||0x1f4;return function(_0x1daba1){logger[_0xcf3c('0x19')](_0x1daba1[_0xcf3c('0x2b')]);if(_0x1daba1[_0xcf3c('0x2c')]){delete _0x1daba1[_0xcf3c('0x2c')];}_0x57d644[_0xcf3c('0x1f')](_0x2a78f2)[_0xcf3c('0x2d')](_0x1daba1);};}exports['index']=function(_0xbc118e,_0x1106a6){var _0x592ecc={'include':[{'model':db[_0xcf3c('0x2e')],'as':_0xcf3c('0x2f')}]},_0x7c323d={},_0x34ea9f={'count':0x0,'rows':[]};var _0xff382e=_[_0xcf3c('0x30')](db[_0xcf3c('0x31')]['rawAttributes'],function(_0xcf5a75){return{'name':_0xcf5a75['fieldName'],'type':_0xcf5a75['type']['key']};});_0x7c323d[_0xcf3c('0x32')]=_[_0xcf3c('0x30')](_0xff382e,_0xcf3c('0x2c'));_0x7c323d[_0xcf3c('0x33')]=_['keys'](_0xbc118e['query']);_0x7c323d[_0xcf3c('0x34')]=_[_0xcf3c('0x35')](_0x7c323d[_0xcf3c('0x32')],_0x7c323d[_0xcf3c('0x33')]);_0x592ecc[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0x7c323d['model'],qs[_0xcf3c('0x37')](_0xbc118e[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x592ecc['attributes']=_0x592ecc[_0xcf3c('0x36')]['length']?_0x592ecc['attributes']:_0x7c323d[_0xcf3c('0x32')];if(!_0xbc118e[_0xcf3c('0x33')][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0x592ecc[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0xbc118e[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0x592ecc[_0xcf3c('0x22')]=qs['offset'](_0xbc118e['query'][_0xcf3c('0x22')]);}_0x592ecc[_0xcf3c('0x3a')]=qs['sort'](_0xbc118e[_0xcf3c('0x33')]['sort']);_0x592ecc[_0xcf3c('0x3b')]=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0xbc118e[_0xcf3c('0x33')],_0x7c323d[_0xcf3c('0x34')]),_0xff382e);if(_0xbc118e[_0xcf3c('0x33')][_0xcf3c('0x3d')]){_0x592ecc[_0xcf3c('0x3b')]=_[_0xcf3c('0x3e')](_0x592ecc[_0xcf3c('0x3b')],{'$or':_[_0xcf3c('0x30')](_0xff382e,function(_0x2a5399){if(_0x2a5399[_0xcf3c('0x3f')]!==_0xcf3c('0x40')){var _0x256e00={};_0x256e00[_0x2a5399[_0xcf3c('0x2c')]]={'$like':'%'+_0xbc118e[_0xcf3c('0x33')][_0xcf3c('0x3d')]+'%'};return _0x256e00;}})});}_0x592ecc=_['merge']({},_0x592ecc,_0xbc118e['options']);var _0x36846f={'where':_0x592ecc['where']};return db[_0xcf3c('0x31')][_0xcf3c('0x41')](_0x36846f)[_0xcf3c('0x13')](function(_0x33c576){_0x34ea9f[_0xcf3c('0x41')]=_0x33c576;if(_0xbc118e['query']['includeAll']){_0x592ecc['include']=[{'all':!![]}];}return db[_0xcf3c('0x31')][_0xcf3c('0x42')](_0x592ecc);})['then'](function(_0x43e6f8){_0x34ea9f[_0xcf3c('0x43')]=_0x43e6f8;return _0x34ea9f;})[_0xcf3c('0x13')](respondWithFilteredResult(_0x1106a6,_0x592ecc))[_0xcf3c('0x1d')](handleError(_0x1106a6,null));};exports[_0xcf3c('0x44')]=function(_0x37da53,_0x592da0){var _0x1a7271={'raw':![],'where':{'id':_0x37da53[_0xcf3c('0x45')]['id']},'include':[{'model':db[_0xcf3c('0x2e')],'as':_0xcf3c('0x2f')}]},_0x31124d={};_0x31124d['model']=_[_0xcf3c('0x46')](db[_0xcf3c('0x31')][_0xcf3c('0x47')]);_0x31124d[_0xcf3c('0x33')]=_['keys'](_0x37da53[_0xcf3c('0x33')]);_0x31124d['filters']=_[_0xcf3c('0x35')](_0x31124d['model'],_0x31124d['query']);_0x1a7271['attributes']=_['intersection'](_0x31124d[_0xcf3c('0x32')],qs[_0xcf3c('0x37')](_0x37da53['query'][_0xcf3c('0x37')]));_0x1a7271[_0xcf3c('0x36')]=_0x1a7271[_0xcf3c('0x36')]['length']?_0x1a7271['attributes']:_0x31124d[_0xcf3c('0x32')];if(_0x37da53[_0xcf3c('0x33')]['includeAll']){_0x1a7271['include']=[{'all':!![]}];}_0x1a7271=_['merge']({},_0x1a7271,_0x37da53[_0xcf3c('0x48')]);return db['ChatWebsite'][_0xcf3c('0x49')](_0x1a7271)['then'](handleEntityNotFound(_0x592da0,null))[_0xcf3c('0x13')](respondWithResult(_0x592da0,null))[_0xcf3c('0x1d')](handleError(_0x592da0,null));};exports[_0xcf3c('0x4a')]=function(_0x44c700,_0x2d0710){return db['ChatWebsite'][_0xcf3c('0x4a')](_0x44c700[_0xcf3c('0x4b')],{})[_0xcf3c('0x13')](function(_0xab4bb8){var _0x410b19=_0x44c700[_0xcf3c('0x4c')][_0xcf3c('0x29')]({'plain':!![]});if(!_0x410b19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410b19['role']==='user'){var _0x1697f3=_0xab4bb8['get']({'plain':!![]});var _0x5a7c0f=_0xcf3c('0x4d');return db[_0xcf3c('0x4e')][_0xcf3c('0x49')]({'where':{'name':_0x5a7c0f,'userProfileId':_0x410b19['userProfileId']},'raw':!![]})[_0xcf3c('0x13')](function(_0x543ed2){if(_0x543ed2&&_0x543ed2[_0xcf3c('0x4f')]===0x0){return db[_0xcf3c('0x2a')][_0xcf3c('0x4a')]({'name':_0x1697f3[_0xcf3c('0x2c')],'resourceId':_0x1697f3['id'],'type':_0x543ed2[_0xcf3c('0x2c')],'sectionId':_0x543ed2['id']},{})[_0xcf3c('0x13')](function(){return _0xab4bb8;});}else{return _0xab4bb8;}})[_0xcf3c('0x1d')](function(_0x13588c){logger[_0xcf3c('0x19')](_0xcf3c('0x50'),_0x13588c);throw _0x13588c;});}return _0xab4bb8;})[_0xcf3c('0x13')](respondWithResult(_0x2d0710,0xc9))['catch'](handleError(_0x2d0710,null));};exports[_0xcf3c('0x27')]=function(_0x191cfb,_0x27dbf1){if(_0x191cfb[_0xcf3c('0x4b')]['id']){delete _0x191cfb[_0xcf3c('0x4b')]['id'];}return db[_0xcf3c('0x31')]['find']({'where':{'id':_0x191cfb[_0xcf3c('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0xcf3c('0x2f')}]})['then'](handleEntityNotFound(_0x27dbf1,null))['then'](saveUpdates(_0x191cfb['body'],null))[_0xcf3c('0x13')](respondWithResult(_0x27dbf1,null))[_0xcf3c('0x1d')](handleError(_0x27dbf1,null));};exports['destroy']=function(_0x3dbb60,_0x138a4a){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x3dbb60[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x138a4a,null))['then'](removeEntity(_0x138a4a,null))[_0xcf3c('0x1d')](handleError(_0x138a4a,null));};exports[_0xcf3c('0x51')]=function(_0x2e01ab,_0x1b8212){return db[_0xcf3c('0x31')][_0xcf3c('0x51')]()[_0xcf3c('0x13')](respondWithResult(_0x1b8212,null))[_0xcf3c('0x1d')](handleError(_0x1b8212,null));};exports[_0xcf3c('0x52')]=function(_0x25df85,_0x1adca9){if(_0x25df85[_0xcf3c('0x4b')]['id']){delete _0x25df85[_0xcf3c('0x4b')]['id'];}return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x25df85[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x1adca9,null))[_0xcf3c('0x13')](function(_0x50b802){if(_0x50b802){_0x25df85[_0xcf3c('0x4b')][_0xcf3c('0x53')]=_0x50b802['id'];return db[_0xcf3c('0x54')][_0xcf3c('0x4a')](_0x25df85[_0xcf3c('0x4b')]);}})[_0xcf3c('0x13')](respondWithResult(_0x1adca9,null))[_0xcf3c('0x1d')](handleError(_0x1adca9,null));};exports[_0xcf3c('0x55')]=function(_0x2ddec1,_0x5b786e){var _0x40cc30={'raw':![],'where':{}};var _0x48f93b={};var _0x1789a7={'count':0x0,'rows':[]};return db[_0xcf3c('0x31')][_0xcf3c('0x56')]({'where':{'id':_0x2ddec1[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x5b786e,null))['then'](function(_0x53c850){if(_0x53c850){_0x48f93b[_0xcf3c('0x32')]=_['keys'](db['Disposition']['rawAttributes']);_0x48f93b[_0xcf3c('0x33')]=_[_0xcf3c('0x46')](_0x2ddec1[_0xcf3c('0x33')]);_0x48f93b[_0xcf3c('0x34')]=_['intersection'](_0x48f93b[_0xcf3c('0x32')],_0x48f93b['query']);_0x40cc30[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0x48f93b[_0xcf3c('0x32')],qs['fields'](_0x2ddec1[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x40cc30[_0xcf3c('0x36')]=_0x40cc30[_0xcf3c('0x36')][_0xcf3c('0x57')]?_0x40cc30[_0xcf3c('0x36')]:_0x48f93b[_0xcf3c('0x32')];if(!_0x2ddec1[_0xcf3c('0x33')][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0x40cc30[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0x2ddec1[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0x40cc30[_0xcf3c('0x22')]=qs[_0xcf3c('0x22')](_0x2ddec1['query'][_0xcf3c('0x22')]);}_0x40cc30[_0xcf3c('0x3a')]=qs[_0xcf3c('0x58')](_0x2ddec1['query'][_0xcf3c('0x58')]);_0x40cc30[_0xcf3c('0x3b')]=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0x2ddec1[_0xcf3c('0x33')],_0x48f93b[_0xcf3c('0x34')]));_0x40cc30[_0xcf3c('0x3b')][_0xcf3c('0x53')]=_0x53c850['id'];if(_0x2ddec1['query'][_0xcf3c('0x3d')]){_0x40cc30[_0xcf3c('0x3b')]=_['merge'](_0x40cc30[_0xcf3c('0x3b')],{'$or':_['map'](_0x40cc30[_0xcf3c('0x36')],function(_0x1f3e6e){var _0x17d3b6={};_0x17d3b6[_0x1f3e6e]={'$like':'%'+_0x2ddec1[_0xcf3c('0x33')]['filter']+'%'};return _0x17d3b6;})});}_0x40cc30=_[_0xcf3c('0x3e')]({},_0x40cc30,_0x2ddec1[_0xcf3c('0x48')]);return db['Disposition'][_0xcf3c('0x41')]({'where':_0x40cc30[_0xcf3c('0x3b')]})[_0xcf3c('0x13')](function(_0x1ded75){_0x1789a7[_0xcf3c('0x41')]=_0x1ded75;if(_0x2ddec1['query'][_0xcf3c('0x59')]){_0x40cc30[_0xcf3c('0x5a')]=[{'all':!![]}];}return db[_0xcf3c('0x54')][_0xcf3c('0x42')](_0x40cc30);})[_0xcf3c('0x13')](function(_0x2634eb){_0x1789a7[_0xcf3c('0x43')]=_0x2634eb;return _0x1789a7;});}})[_0xcf3c('0x13')](respondWithFilteredResult(_0x5b786e,_0x40cc30))['catch'](handleError(_0x5b786e,null));};exports[_0xcf3c('0x5b')]=function(_0x1627d7,_0x1102df){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x1627d7['params']['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x1102df,null))[_0xcf3c('0x13')](function(_0x4db968){if(_0x4db968){return _0x4db968['removeDispositions'](_0x1627d7[_0xcf3c('0x33')][_0xcf3c('0x5c')]);}})[_0xcf3c('0x13')](respondWithStatusCode(_0x1102df,null))[_0xcf3c('0x1d')](handleError(_0x1102df,null));};exports[_0xcf3c('0x5d')]=function(_0x16a973,_0x4c7ebd){if(_0x16a973[_0xcf3c('0x4b')]['id']){delete _0x16a973['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x16a973['params']['id']}})['then'](handleEntityNotFound(_0x4c7ebd,null))['then'](function(_0x574e56){if(_0x574e56){_0x16a973[_0xcf3c('0x4b')][_0xcf3c('0x53')]=_0x574e56['id'];return db[_0xcf3c('0x5e')][_0xcf3c('0x4a')](_0x16a973[_0xcf3c('0x4b')]);}})[_0xcf3c('0x13')](respondWithResult(_0x4c7ebd,null))[_0xcf3c('0x1d')](handleError(_0x4c7ebd,null));};exports[_0xcf3c('0x5f')]=function(_0x2bde9b,_0x3b05ea){var _0x4994d9={'raw':![],'where':{}};var _0x79c19={};var _0x1b2ee1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcf3c('0x56')]({'where':{'id':_0x2bde9b['params']['id']}})['then'](handleEntityNotFound(_0x3b05ea,null))[_0xcf3c('0x13')](function(_0x2283e9){if(_0x2283e9){_0x79c19[_0xcf3c('0x32')]=_[_0xcf3c('0x46')](db[_0xcf3c('0x5e')][_0xcf3c('0x47')]);_0x79c19[_0xcf3c('0x33')]=_[_0xcf3c('0x46')](_0x2bde9b[_0xcf3c('0x33')]);_0x79c19[_0xcf3c('0x34')]=_[_0xcf3c('0x35')](_0x79c19[_0xcf3c('0x32')],_0x79c19[_0xcf3c('0x33')]);_0x4994d9['attributes']=_[_0xcf3c('0x35')](_0x79c19['model'],qs['fields'](_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x4994d9[_0xcf3c('0x36')]=_0x4994d9[_0xcf3c('0x36')]['length']?_0x4994d9[_0xcf3c('0x36')]:_0x79c19[_0xcf3c('0x32')];if(!_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0x4994d9[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0x4994d9[_0xcf3c('0x22')]=qs[_0xcf3c('0x22')](_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x22')]);}_0x4994d9[_0xcf3c('0x3a')]=qs[_0xcf3c('0x58')](_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x58')]);_0x4994d9['where']=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0x2bde9b['query'],_0x79c19[_0xcf3c('0x34')]));_0x4994d9['where'][_0xcf3c('0x53')]=_0x2283e9['id'];if(_0x2bde9b['query'][_0xcf3c('0x3d')]){_0x4994d9[_0xcf3c('0x3b')]=_[_0xcf3c('0x3e')](_0x4994d9[_0xcf3c('0x3b')],{'$or':_['map'](_0x4994d9[_0xcf3c('0x36')],function(_0x3c190b){var _0x3a3a47={};_0x3a3a47[_0x3c190b]={'$like':'%'+_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x3d')]+'%'};return _0x3a3a47;})});}_0x4994d9=_[_0xcf3c('0x3e')]({},_0x4994d9,_0x2bde9b['options']);return db['CannedAnswer'][_0xcf3c('0x41')]({'where':_0x4994d9[_0xcf3c('0x3b')]})[_0xcf3c('0x13')](function(_0x2b1153){_0x1b2ee1[_0xcf3c('0x41')]=_0x2b1153;if(_0x2bde9b[_0xcf3c('0x33')][_0xcf3c('0x59')]){_0x4994d9['include']=[{'all':!![]}];}return db[_0xcf3c('0x5e')][_0xcf3c('0x42')](_0x4994d9);})[_0xcf3c('0x13')](function(_0x212589){_0x1b2ee1[_0xcf3c('0x43')]=_0x212589;return _0x1b2ee1;});}})[_0xcf3c('0x13')](respondWithFilteredResult(_0x3b05ea,_0x4994d9))['catch'](handleError(_0x3b05ea,null));};exports['removeAnswers']=function(_0x10e9f9,_0x56140a){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x10e9f9['params']['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x56140a,null))[_0xcf3c('0x13')](function(_0x53cdca){if(_0x53cdca){return _0x53cdca[_0xcf3c('0x60')](_0x10e9f9[_0xcf3c('0x33')][_0xcf3c('0x5c')]);}})[_0xcf3c('0x13')](respondWithStatusCode(_0x56140a,null))['catch'](handleError(_0x56140a,null));};exports[_0xcf3c('0x61')]=function(_0x123ba2,_0x520c31){_0x123ba2[_0xcf3c('0x4b')]['sitepic']=_0x123ba2[_0xcf3c('0x62')][_0xcf3c('0x63')];return db['ChatWebsite'][_0xcf3c('0x49')]({'where':{'id':_0x123ba2[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x520c31,null))[_0xcf3c('0x13')](saveUpdates(_0x123ba2[_0xcf3c('0x4b')],null))[_0xcf3c('0x13')](respondWithResult(_0x520c31,null))['catch'](handleError(_0x520c31,null));};exports['addAvatar']=function(_0x290696,_0x36ab71){_0x290696[_0xcf3c('0x4b')][_0xcf3c('0x64')]=_0x290696['file'][_0xcf3c('0x63')];return db['ChatWebsite'][_0xcf3c('0x49')]({'where':{'id':_0x290696[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x36ab71,null))[_0xcf3c('0x13')](saveUpdates(_0x290696['body'],null))[_0xcf3c('0x13')](respondWithResult(_0x36ab71,null))[_0xcf3c('0x1d')](handleError(_0x36ab71,null));};exports[_0xcf3c('0x65')]=function(_0x2a1d6d,_0x34cbf8){_0x2a1d6d['body'][_0xcf3c('0x66')]=_0x2a1d6d['file'][_0xcf3c('0x63')];return db['ChatWebsite'][_0xcf3c('0x49')]({'where':{'id':_0x2a1d6d['params']['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x34cbf8,null))[_0xcf3c('0x13')](saveUpdates(_0x2a1d6d[_0xcf3c('0x4b')],null))[_0xcf3c('0x13')](respondWithResult(_0x34cbf8,null))[_0xcf3c('0x1d')](handleError(_0x34cbf8,null));};exports[_0xcf3c('0x67')]=function(_0x12a9bf,_0x5236b9){_0x12a9bf[_0xcf3c('0x4b')][_0xcf3c('0x68')]=_0x12a9bf['file'][_0xcf3c('0x63')];return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x12a9bf[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x5236b9,null))[_0xcf3c('0x13')](saveUpdates(_0x12a9bf[_0xcf3c('0x4b')],null))[_0xcf3c('0x13')](respondWithResult(_0x5236b9,null))[_0xcf3c('0x1d')](handleError(_0x5236b9,null));};exports[_0xcf3c('0x69')]=function(_0x288215,_0x249842){var _0x152bf9=path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],_0xcf3c('0x6c'));var _0x88d24c={'where':{'id':_0x288215['params']['id']},'attributes':['id',_0xcf3c('0x6d')],'raw':!![]};var _0x55b6b2=![];return require(_0xcf3c('0x6e'))[_0xcf3c('0x6f')]()[_0xcf3c('0x13')](function(_0x9cbdb8){if(_0x9cbdb8){_0x55b6b2=_0x9cbdb8[_0xcf3c('0x70')];}})[_0xcf3c('0x13')](function(){return db['ChatWebsite'][_0xcf3c('0x49')](_0x88d24c);})['then'](handleEntityNotFound(_0x249842,null))[_0xcf3c('0x13')](function(_0x29ef87){if(_0x29ef87){if(!_[_0xcf3c('0x71')](_0x29ef87[_0xcf3c('0x6d')])){if(fs[_0xcf3c('0x72')](path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],'server/files/images/logos/',_0x29ef87[_0xcf3c('0x6d')]))&&_0x55b6b2){_0x152bf9=path[_0xcf3c('0x6a')](config['root'],'server/files/images/logos/',_0x29ef87[_0xcf3c('0x6d')]);}}return _0x249842[_0xcf3c('0x73')](_0x152bf9);}})[_0xcf3c('0x1d')](handleError(_0x249842,null));};exports['getAvatar']=function(_0x107708,_0x28d172){var _0x4614c3=path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],_0xcf3c('0x74'));var _0x510d5b={'where':{'id':_0x107708[_0xcf3c('0x45')]['id']},'attributes':['id',_0xcf3c('0x64')],'raw':!![]};return db[_0xcf3c('0x31')][_0xcf3c('0x49')](_0x510d5b)[_0xcf3c('0x13')](handleEntityNotFound(_0x28d172,null))[_0xcf3c('0x13')](function(_0x25f772){if(_0x25f772){if(!_[_0xcf3c('0x71')](_0x25f772[_0xcf3c('0x64')])){if(fs[_0xcf3c('0x72')](path['join'](config['root'],_0xcf3c('0x75'),_0x25f772['agentAvatar']))){_0x4614c3=path[_0xcf3c('0x6a')](config['root'],'server/files/images/avatars/',_0x25f772[_0xcf3c('0x64')]);}}return _0x28d172[_0xcf3c('0x73')](_0x4614c3);}})[_0xcf3c('0x1d')](handleError(_0x28d172,null));};exports['getCustomerAvatar']=function(_0x502e82,_0x59e3c8){var _0xecf2da=path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0x189fe8={'where':{'id':_0x502e82[_0xcf3c('0x45')]['id']},'attributes':['id',_0xcf3c('0x66'),_0xcf3c('0x76')],'raw':!![]};return db['ChatWebsite'][_0xcf3c('0x49')](_0x189fe8)[_0xcf3c('0x13')](handleEntityNotFound(_0x59e3c8,null))['then'](function(_0x3bb705){if(_0x3bb705){if(!_['isNil'](_0x3bb705[_0xcf3c('0x66')])){if(fs['existsSync'](path[_0xcf3c('0x6a')](config['root'],_0xcf3c('0x75'),_0x3bb705[_0xcf3c('0x66')]))&&_0x3bb705[_0xcf3c('0x76')]){_0xecf2da=path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],'server/files/images/avatars/',_0x3bb705[_0xcf3c('0x66')]);}}return _0x59e3c8[_0xcf3c('0x73')](_0xecf2da);}})[_0xcf3c('0x1d')](handleError(_0x59e3c8,null));};exports['getSystemAvatar']=function(_0x5d6132,_0x280ae9){var _0x18a7f8=path['join'](config[_0xcf3c('0x6b')],_0xcf3c('0x77'));var _0x329fe7={'where':{'id':_0x5d6132[_0xcf3c('0x45')]['id']},'attributes':['id',_0xcf3c('0x68')],'raw':!![]};return db[_0xcf3c('0x31')][_0xcf3c('0x49')](_0x329fe7)['then'](handleEntityNotFound(_0x280ae9,null))[_0xcf3c('0x13')](function(_0x31d09e){if(_0x31d09e){if(!_['isNil'](_0x31d09e['systemAvatar'])){if(fs['existsSync'](path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],_0xcf3c('0x75'),_0x31d09e[_0xcf3c('0x68')]))){_0x18a7f8=path['join'](config[_0xcf3c('0x6b')],_0xcf3c('0x75'),_0x31d09e[_0xcf3c('0x68')]);}}return _0x280ae9[_0xcf3c('0x73')](_0x18a7f8);}})[_0xcf3c('0x1d')](handleError(_0x280ae9,null));};exports[_0xcf3c('0x78')]=function(_0x26b1b3,_0xc304f3){var _0x1d80cd=require(_0xcf3c('0x79'));var _0x354c87=new _0x1d80cd();var _0xc4e572=_0x354c87[_0xcf3c('0x7a')](_0x26b1b3[_0xcf3c('0x7b')][_0xcf3c('0x7c')])['getResult']();var _0x5e3d35={'body':_0x26b1b3['body'],'channel':'chat'};var _0x27281e=[];var _0x18b67e=[];var _0x19c741={};var _0x453442=![];return db['CmContact'][_0xcf3c('0x51')]()[_0xcf3c('0x13')](function(_0x42a6ae){if(!_0x42a6ae){throw new db['Sequelize'][(_0xcf3c('0x7d'))](_0xcf3c('0x7e'));}_0x27281e=_[_0xcf3c('0x7f')](_[_0xcf3c('0x46')](_0x42a6ae),['createdAt',_0xcf3c('0x80')]);_0x18b67e=_[_0xcf3c('0x7f')](_[_0xcf3c('0x46')](_0x42a6ae),[_0xcf3c('0x81'),_0xcf3c('0x80'),_0xcf3c('0x82'),_0xcf3c('0x83')]);if(_0x26b1b3[_0xcf3c('0x4b')]['id']){delete _0x26b1b3[_0xcf3c('0x4b')]['id'];}if(_['isNil'](_0x26b1b3['body'][_0xcf3c('0x84')])){throw new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))]('from\x20is\x20mandatory');}if(_[_0xcf3c('0x71')](_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x4b')])||_0x26b1b3['body'][_0xcf3c('0x4b')]===''){throw new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcf3c('0x71')](_0x26b1b3[_0xcf3c('0x4b')]['mapKey'])){throw new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18b67e);}if(!_['includes'](_0x18b67e,_0x26b1b3[_0xcf3c('0x4b')]['mapKey'])){throw new db['Sequelize'][(_0xcf3c('0x7d'))](_0xcf3c('0x86')+_0x18b67e);}_0x19c741[_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x87')]]=_0x26b1b3['body'][_0xcf3c('0x84')];})[_0xcf3c('0x13')](function(){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x26b1b3[_0xcf3c('0x45')]['id']},'include':[{'model':db[_0xcf3c('0x88')],'as':_0xcf3c('0x89'),'include':[{'model':db[_0xcf3c('0x8a')],'as':_0xcf3c('0x8b'),'where':_0x19c741,'limit':0x1,'order':[[_0xcf3c('0x80'),'DESC']]}]},{'model':db[_0xcf3c('0x8c')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xc304f3,null))['then'](function(_0x5cf4c8){if(_0x5cf4c8&&_0x5cf4c8[_0xcf3c('0x89')]){_0x5e3d35[_0xcf3c('0x8d')]=_0x5cf4c8;_0x5e3d35[_0xcf3c('0x8e')]=_0x5cf4c8['Applications'];_0x5e3d35['list']=_0x5cf4c8[_0xcf3c('0x89')];_0x5e3d35['applications']=_[_0xcf3c('0x8f')](_0x5e3d35['applications'],['priority'],[_0xcf3c('0x90')]);if(_0x5e3d35[_0xcf3c('0x8d')][_0xcf3c('0x91')]){delete _0x5e3d35['account'][_0xcf3c('0x91')];}if(_0x5e3d35[_0xcf3c('0x8d')][_0xcf3c('0x89')]&&_0x5e3d35[_0xcf3c('0x8d')][_0xcf3c('0x89')][_0xcf3c('0x8b')]['length']){return _0x5e3d35['account'][_0xcf3c('0x89')][_0xcf3c('0x8b')][0x0];}var _0x433c71=_[_0xcf3c('0xc')](_0x26b1b3[_0xcf3c('0x4b')],{'firstName':_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x84')],'ListId':_0x5cf4c8['ListId']});_0x433c71[_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x87')]]=_0x26b1b3['body'][_0xcf3c('0x84')];return db['CmContact'][_0xcf3c('0x4a')](_0x433c71,{'fields':_0x27281e,'raw':!![]});}})[_0xcf3c('0x13')](handleEntityNotFound(_0xc304f3,null))[_0xcf3c('0x13')](function(_0x33917a){_0x5e3d35[_0xcf3c('0x92')]=_0x33917a;var _0x2f8e19=_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x93')];if(_0x26b1b3[_0xcf3c('0x7b')]['cf-connecting-ip']){_0x2f8e19=_0x26b1b3[_0xcf3c('0x7b')][_0xcf3c('0x94')];}else if(_0x26b1b3[_0xcf3c('0x7b')]['x-forwarded-for']){_0x2f8e19=_[_0xcf3c('0x95')](_0x26b1b3[_0xcf3c('0x7b')][_0xcf3c('0x96')][_0xcf3c('0x97')](','));}if(_0x33917a){var _0x45f249={'ContactId':_0x33917a['id'],'ChatWebsiteId':_0x26b1b3[_0xcf3c('0x45')]['id'],'from':(_0x33917a[_0xcf3c('0x98')]||'')+'\x20'+(_0x33917a[_0xcf3c('0x99')]||''),'customerIp':_0x2f8e19,'customerPort':_0x26b1b3['headers'][_0xcf3c('0x9a')]?_0x26b1b3['headers'][_0xcf3c('0x9a')]:null,'referer':_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x9b')],'browserName':_0xc4e572[_0xcf3c('0x9c')][_0xcf3c('0x2c')]&&_0xc4e572[_0xcf3c('0x9c')][_0xcf3c('0x9d')]?util[_0xcf3c('0x9e')](_0xcf3c('0x9f'),_0xc4e572[_0xcf3c('0x9c')][_0xcf3c('0x2c')],_0xc4e572[_0xcf3c('0x9c')][_0xcf3c('0x9d')]):'unknown','browserVersion':_0xc4e572[_0xcf3c('0x9c')]['version']||_0xcf3c('0xa0'),'osName':util[_0xcf3c('0x9e')](_0xcf3c('0x9f'),_0xc4e572['os'][_0xcf3c('0x2c')],_0xc4e572['os'][_0xcf3c('0x9d')]),'osVersion':_0xc4e572['os']['version'],'deviceModel':_0xc4e572['device'][_0xcf3c('0x32')]&&_0xc4e572[_0xcf3c('0xa1')]['vendor']?util[_0xcf3c('0x9e')]('%s\x20%s\x20%s',_0xc4e572['device']['model'],_0xc4e572['device']['vendor'],_0xc4e572[_0xcf3c('0xa1')][_0xcf3c('0x3f')]):null,'deviceVendor':_0xc4e572[_0xcf3c('0xa1')][_0xcf3c('0xa2')],'deviceType':_0xc4e572[_0xcf3c('0xa1')][_0xcf3c('0x3f')],'formData':JSON[_0xcf3c('0x18')](_0x26b1b3[_0xcf3c('0x4b')])};var _0x253144={'ChatWebsiteId':_0x26b1b3['params']['id'],'closed':![]};if(_0x26b1b3[_0xcf3c('0x4b')]['threadId']){_0x253144[_0xcf3c('0xa3')]=_0x26b1b3[_0xcf3c('0x4b')]['threadId'];return db['ChatInteraction']['find']({'where':_0x253144})[_0xcf3c('0x13')](function(_0x42dfd3){if(_0x42dfd3){return[_0x42dfd3,![]];}_0x45f249['threadId']=_0x26b1b3[_0xcf3c('0x4b')]['threadId'];_0x45f249[_0xcf3c('0xa4')]=_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa4')];return db[_0xcf3c('0xa5')][_0xcf3c('0x4a')](_0x45f249)[_0xcf3c('0x13')](function(_0x58b653){return[_0x58b653,!![]];});});}_0x253144[_0xcf3c('0xa6')]=_0x33917a['id'];if(_0x26b1b3['body'][_0xcf3c('0xa7')]&&_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa7')]['id']){_0x253144['id']=_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa7')]['id'];return db[_0xcf3c('0xa5')]['find']({'where':_0x253144})[_0xcf3c('0x13')](function(_0x3c928d){if(_0x3c928d){return[_0x3c928d,![]];}return db[_0xcf3c('0xa5')][_0xcf3c('0x4a')](_0x45f249)[_0xcf3c('0x13')](function(_0x4504d4){return[_0x4504d4,!![]];});});}return db[_0xcf3c('0xa5')][_0xcf3c('0x4a')](_0x45f249)[_0xcf3c('0x13')](function(_0x28265f){return[_0x28265f,!![]];});}})[_0xcf3c('0xa8')](function(_0x21f75b,_0x51d835){if(_0x21f75b){_0x453442=_0x51d835;if(!_0x51d835){var _0x2a59b6={'from':(_0x5e3d35['contact'][_0xcf3c('0x98')]||'')+'\x20'+(_0x5e3d35[_0xcf3c('0x92')][_0xcf3c('0x99')]||'')};if(_0x26b1b3[_0xcf3c('0x4b')]['threadId']&&_0x26b1b3[_0xcf3c('0x4b')]['messageId']&&_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa3')]!=_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa9')]){_0x2a59b6[_0xcf3c('0xa3')]=_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xa9')];}return _0x21f75b[_0xcf3c('0x27')](_0x2a59b6);}else{return _0x21f75b;}}})[_0xcf3c('0x13')](function(_0x4c0bcc){_0x5e3d35[_0xcf3c('0xa7')]=_0x4c0bcc[_0xcf3c('0x29')]({'plain':!![]});_0x5e3d35[_0xcf3c('0xa7')][_0xcf3c('0xaa')]=_0x453442;if(_0x5e3d35[_0xcf3c('0xa7')][_0xcf3c('0xaa')]){if(_0x5e3d35['account'][_0xcf3c('0xab')]){_0x5e3d35[_0xcf3c('0x8e')][_0xcf3c('0xac')]({'id':0x0,'priority':_0x5e3d35[_0xcf3c('0x8e')][_0xcf3c('0x57')]+0x1,'app':_0xcf3c('0xad'),'appdata':_0xcf3c('0xae'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0x4b')],'ChatWebsiteId':_0x26b1b3[_0xcf3c('0x45')]['id'],'ChatInteractionId':_0x4c0bcc['id'],'direction':'in','ContactId':_0x5e3d35[_0xcf3c('0x92')]['id'],'AttachmentId':_0x26b1b3[_0xcf3c('0x4b')][_0xcf3c('0xaf')]});})[_0xcf3c('0x13')](function(_0x559b85){_0x5e3d35['message']=_0x559b85;if(_0x5e3d35[_0xcf3c('0xa7')][_0xcf3c('0xb0')]){return db[_0xcf3c('0xb1')][_0xcf3c('0x49')]({'attributes':['id',_0xcf3c('0x2c')],'where':{'id':_0x5e3d35[_0xcf3c('0xa7')][_0xcf3c('0xb0')]}})['then'](function(_0x31f715){if(_0x31f715){_0x5e3d35[_0xcf3c('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcf3c('0xb2'),'appdata':_0x31f715[_0xcf3c('0x2c')]+','+(_0x5e3d35[_0xcf3c('0x8d')][_0xcf3c('0xb3')]||0xa),'interval':_0xcf3c('0xb4')});_0x5e3d35[_0xcf3c('0xb5')]=!![];}return respondWithRpcPromise('Start',_0xcf3c('0xb6'),_0x5e3d35);});}return respondWithRpcPromise('Start','startRouting',_0x5e3d35);})[_0xcf3c('0x13')](function(_0x2ace99){respondWithRpcPromise(_0xcf3c('0xb7'),'EventManager',{'event':'notify','message':_0x2ace99},client9002);return _0x2ace99;})[_0xcf3c('0x13')](respondWithResult(_0xc304f3,null))[_0xcf3c('0x1d')](handleError(_0xc304f3,null));};exports[_0xcf3c('0xb8')]=function(_0x2f1648,_0x4e5ed7){var _0x588a52,_0x176e9e,_0x428770;var _0x4be0c6=[];var _0x4fa441={};var _0x3b01c0=_0x2f1648[_0xcf3c('0xb9')]||[];var _0x3d6fe2=[];var _0x574443;return db['CmContact'][_0xcf3c('0x51')]()[_0xcf3c('0x13')](function(_0x20afdf){if(!_0x20afdf){throw new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))](_0xcf3c('0x7e'));}_0x4be0c6=_['difference'](_[_0xcf3c('0x46')](_0x20afdf),[_0xcf3c('0x81'),'updatedAt',_0xcf3c('0x82'),_0xcf3c('0x83')]);if(_0x2f1648[_0xcf3c('0x4b')]['id']){delete _0x2f1648[_0xcf3c('0x4b')]['id'];}if(_[_0xcf3c('0x71')](_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0x84')])){throw _0x4e5ed7[_0xcf3c('0x1f')](0x1f4)[_0xcf3c('0x2d')](new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))](_0xcf3c('0xba')));}if(_['isNil'](_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0x4b')])||_0x2f1648['body'][_0xcf3c('0x4b')]===''){throw _0x4e5ed7[_0xcf3c('0x1f')](0x1f4)[_0xcf3c('0x2d')](new db[(_0xcf3c('0x85'))][(_0xcf3c('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xcf3c('0x71')](_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0xbb')])){throw _0x4e5ed7[_0xcf3c('0x1f')](0x1f4)[_0xcf3c('0x2d')](new db[(_0xcf3c('0x85'))]['ValidationError'](_0xcf3c('0xbc')+_0x4be0c6));}if(!_[_0xcf3c('0xbd')](_0x4be0c6,_0x2f1648[_0xcf3c('0x4b')]['mapKeyOffline'])){throw _0x4e5ed7[_0xcf3c('0x1f')](0x1f4)[_0xcf3c('0x2d')](new db['Sequelize']['ValidationError'](_0xcf3c('0xbe')+_0x4be0c6));}_0x4fa441[_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0xbb')]]=_0x2f1648['body'][_0xcf3c('0x84')];})['then'](function(){return db['ChatWebsite'][_0xcf3c('0x49')]({'where':{'id':_0x2f1648['params']['id']},'include':[{'model':db[_0xcf3c('0x88')],'as':_0xcf3c('0x89')},{'model':db[_0xcf3c('0xbf')],'as':_0xcf3c('0xbf')}]});})[_0xcf3c('0x13')](handleEntityNotFound(_0x4e5ed7,null))[_0xcf3c('0x13')](function(_0x3ec69c){if(_0x3ec69c&&_0x3ec69c['List']){_0x176e9e=_0x3ec69c;var _0x1e84be=_[_0xcf3c('0xc')](_0x2f1648[_0xcf3c('0x4b')],{'firstName':_0x2f1648[_0xcf3c('0x4b')]['from'],'phone':_0x2f1648['body'][_0xcf3c('0x84')],'ListId':_0x3ec69c[_0xcf3c('0x83')]});_0x1e84be[_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0xbb')]]=_0x2f1648[_0xcf3c('0x4b')][_0xcf3c('0x84')];return db[_0xcf3c('0x8a')]['findOrCreate']({'where':_0x4fa441,'defaults':_0x1e84be});}})['spread'](function(_0x39e88e){if(_0x39e88e){_0x428770=_0x39e88e;var _0x796d3e=fs['readFileSync'](path[_0xcf3c('0x6a')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xcf3c('0xc0'));var _0x2000c8=ejs[_0xcf3c('0xc1')](_0x796d3e,{'body':_[_0xcf3c('0xc2')](_0x2f1648['body']['body']),'bodyTitle':_0x176e9e[_0xcf3c('0xc3')]});return db[_0xcf3c('0xc4')][_0xcf3c('0x4a')]({'body':_0x2000c8,'plainBody':htmlToText[_0xcf3c('0xc5')](_0x2000c8),'ContactId':_0x39e88e['id'],'ChatWebsiteId':_0x176e9e['id']});}})[_0xcf3c('0x13')](function(_0x1e4962){_0x574443=_0x1e4962;if(_0x3b01c0[_0xcf3c('0x57')]){var _0x5ab305=_0x3b01c0[_0xcf3c('0x30')](function(_0x1743e5){return{'name':_0x1743e5['originalname'],'basename':_0x1743e5['filename'],'type':_0x1743e5[_0xcf3c('0xc6')],'ChatOfflineMessageId':_0x1e4962['id']};});_0x3d6fe2=_0x5ab305[_0xcf3c('0x30')](_0x2c3179=>{var _0x40ecc8={'filename':_0x2c3179[_0xcf3c('0x2c')],'path':path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],_0xcf3c('0xc7'),_0xcf3c('0xb9'),_0xcf3c('0xc8'),_0xcf3c('0xc9'),_0x2c3179['basename'])};return _0x40ecc8;});if(!_0x176e9e[_0xcf3c('0xca')]){return db[_0xcf3c('0xcb')][_0xcf3c('0xcc')](function(_0x4e2396){return db[_0xcf3c('0xcd')][_0xcf3c('0xce')](_0x5ab305,{'transaction':_0x4e2396});});}}})['then'](function(){if(_0x574443){_0x588a52=_0x574443;return db[_0xcf3c('0xbf')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xcf3c('0xcf')],'as':_0xcf3c('0xd0'),'raw':!![],'include':[{'model':db[_0xcf3c('0xd1')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xcf3c('0x13')](function(_0xc288cb){if(_0xc288cb&&_0xc288cb[_0xcf3c('0xd0')]&&_0x176e9e[_0xcf3c('0xd2')]&&_0x176e9e[_0xcf3c('0xd3')]){var _0x3ada57=_0xc288cb[_0xcf3c('0xd4')]();return respondWithRpcPromise(_0xcf3c('0xd5'),_0xcf3c('0xd6'),{'account':_0x3ada57,'message':{'from':util[_0xcf3c('0x9e')](_0xcf3c('0xd7'),_0xc288cb[_0xcf3c('0x2c')],_0xc288cb[_0xcf3c('0xd8')]||_0xc288cb[_0xcf3c('0xd0')][_0xcf3c('0x4c')]),'to':_0x176e9e['forwardOfflineAddress'],'subject':_0x176e9e[_0xcf3c('0xd9')],'html':_0x588a52[_0xcf3c('0x4b')],'attachments':_0x3d6fe2}},client9003)[_0xcf3c('0x13')](function(){return _0x588a52;})[_0xcf3c('0x1d')](function(_0x5e4122){logger[_0xcf3c('0x19')](_0x5e4122);});}})['then'](function(){if(_0x176e9e&&_0x176e9e[_0xcf3c('0xca')]&&_0x176e9e[_0xcf3c('0xda')]){var _0x7034f7=[];if(_0x3b01c0[_0xcf3c('0x57')]){_0x7034f7=_0x3b01c0['map'](function(_0x350b92){return{'name':_0x350b92['originalname'],'basename':_0x350b92[_0xcf3c('0x63')],'type':_0x350b92[_0xcf3c('0xc6')],'ChatOfflineMessageId':_0x574443['id']};});}var _0x973db8;if(!_[_0xcf3c('0x71')](_0x176e9e[_0xcf3c('0xdb')])){var _0x99578f=_[_0xcf3c('0x30')](_0x2f1648[_0xcf3c('0x4b')],function(_0x1ed3f8){return _0x1ed3f8;});var _0x32eec9=_[_0xcf3c('0xdc')](_0x99578f)[0x0];var _0x3ca58c=_[_0xcf3c('0xdd')](_0x32eec9,function(_0x2f8e11){return _0x2f8e11;});_0x973db8=_0x3ca58c[0x1][_0x176e9e[_0xcf3c('0xdb')]];}var _0x5a1940={'from':_0x428770[_0xcf3c('0xd8')],'firstName':_0x428770[_0xcf3c('0x98')],'lastName':_0x428770[_0xcf3c('0x99')],'mapKey':_0xcf3c('0xd8'),'message':{'from':_0x428770['email'],'to':_0x176e9e['MailAccount'][_0xcf3c('0xd8')],'cc':'','subject':_[_0xcf3c('0x71')](_0x973db8)?_0x176e9e[_0xcf3c('0xd9')]:_0x973db8,'messageId':'','sentAt':new Date(),'attach':_0x7034f7[_0xcf3c('0x57')],'attachments':_0x7034f7,'originChannel':'Chat','ChatWebsiteId':_0x176e9e['id'],'ChatOfflineMessageId':_0x588a52['id'],'originTo':_0x176e9e[_0xcf3c('0xbf')][_0xcf3c('0xd8')]},'body':_0x588a52[_0xcf3c('0x4b')]};var _0x565cad={'account':{'id':_0x176e9e[_0xcf3c('0xda')]},'body':_0x5a1940,'log':_0xcf3c('0xde')};return respondWithRpcPromise(_0xcf3c('0xde'),_0xcf3c('0xdf'),_0x565cad,client9001)[_0xcf3c('0x13')](function(){return _0x588a52;})['catch'](function(_0x5b146a){logger[_0xcf3c('0x19')](_0x5b146a);});}return;})[_0xcf3c('0x13')](function(){if(_0x588a52){return _0x588a52;}})[_0xcf3c('0x13')](respondWithResult(_0x4e5ed7,null))[_0xcf3c('0x1d')](function(_0x4daf27){logger[_0xcf3c('0x19')]('catch',_0x4daf27);for(var _0x36f279 of _0x3b01c0){var _0x33c32b=path['join'](config[_0xcf3c('0x6b')],_0xcf3c('0xc7'),'files',_0xcf3c('0xc8'),'offline-chat',_0x36f279[_0xcf3c('0x63')]);fs_extra['remove'](_0x33c32b)['catch'](function(_0x369d57){logger[_0xcf3c('0x19')](_0xcf3c('0xe0'),_0x33c32b,_0x369d57);});}});};exports[_0xcf3c('0xe1')]=function(_0x5af868,_0x5ee1e8){return db[_0xcf3c('0xa5')]['find']({'where':{'id':_0x5af868[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x5ee1e8,null))[_0xcf3c('0x13')](function(_0x235303){if(_0x235303){return _0x235303[_0xcf3c('0xe1')](_0x5af868[_0xcf3c('0x4b')][_0xcf3c('0x5c')],_[_0xcf3c('0xe2')](_0x5af868[_0xcf3c('0x4b')],['ids','id'])||{});}})[_0xcf3c('0x13')](respondWithResult(_0x5ee1e8,null))['catch'](handleError(_0x5ee1e8,null));};exports[_0xcf3c('0xe3')]=function(_0x263d3f,_0x25d8af){var _0xba9782={'raw':![],'where':{}};var _0x215a9a={};var _0x20c67a={'count':0x0,'rows':[]};return db[_0xcf3c('0x31')][_0xcf3c('0x56')]({'where':{'id':_0x263d3f[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x25d8af,null))[_0xcf3c('0x13')](function(_0x26b306){if(_0x26b306){_0x215a9a[_0xcf3c('0x32')]=_[_0xcf3c('0x46')](db['ChatInteraction'][_0xcf3c('0x47')]);_0x215a9a[_0xcf3c('0x33')]=_['keys'](_0x263d3f[_0xcf3c('0x33')]);_0x215a9a[_0xcf3c('0x34')]=_[_0xcf3c('0x35')](_0x215a9a[_0xcf3c('0x32')],_0x215a9a['query']);_0xba9782['attributes']=_['intersection'](_0x215a9a[_0xcf3c('0x32')],qs['fields'](_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0xba9782[_0xcf3c('0x36')]=_0xba9782[_0xcf3c('0x36')]['length']?_0xba9782[_0xcf3c('0x36')]:_0x215a9a['model'];if(!_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0xba9782['limit']=qs['limit'](_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0xba9782[_0xcf3c('0x22')]=qs['offset'](_0x263d3f[_0xcf3c('0x33')]['offset']);}_0xba9782['order']=qs[_0xcf3c('0x58')](_0x263d3f['query']['sort']);_0xba9782[_0xcf3c('0x3b')]=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0x263d3f['query'],_0x215a9a[_0xcf3c('0x34')]));_0xba9782[_0xcf3c('0x3b')]['ChatWebsiteId']=_0x26b306['id'];if(_0x263d3f[_0xcf3c('0x33')]['filter']){_0xba9782[_0xcf3c('0x3b')]=_[_0xcf3c('0x3e')](_0xba9782[_0xcf3c('0x3b')],{'$or':_['map'](_0xba9782[_0xcf3c('0x36')],function(_0x676cc4){var _0x501954={};_0x501954[_0x676cc4]={'$like':'%'+_0x263d3f['query']['filter']+'%'};return _0x501954;})});}_0xba9782=_[_0xcf3c('0x3e')]({},_0xba9782,_0x263d3f[_0xcf3c('0x48')]);return db[_0xcf3c('0xa5')][_0xcf3c('0x41')]({'where':_0xba9782['where']})[_0xcf3c('0x13')](function(_0xb9b1d4){_0x20c67a[_0xcf3c('0x41')]=_0xb9b1d4;if(_0x263d3f[_0xcf3c('0x33')]['includeAll']){_0xba9782[_0xcf3c('0x5a')]=[{'model':db['CmContact'],'as':_0xcf3c('0xe4'),'required':![]},{'model':db['User'],'as':_0xcf3c('0xe5'),'attributes':[_0xcf3c('0x2c'),_0xcf3c('0xe6'),_0xcf3c('0xe7')],'required':![]},{'model':db[_0xcf3c('0xe8')],'as':_0xcf3c('0xe9'),'attributes':['id',_0xcf3c('0x2c'),_0xcf3c('0xea')],'where':_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0xeb')]?{'id':_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0xeb')]}:undefined,'required':_0x263d3f[_0xcf3c('0x33')][_0xcf3c('0xeb')]?!![]:![]}];}return db[_0xcf3c('0xa5')][_0xcf3c('0x42')](_0xba9782);})[_0xcf3c('0x13')](function(_0x29f61d){_0x20c67a[_0xcf3c('0x43')]=_0x29f61d;return _0x20c67a;});}})[_0xcf3c('0x13')](respondWithFilteredResult(_0x25d8af,_0xba9782))[_0xcf3c('0x1d')](handleError(_0x25d8af,null));};function iftimePromise(_0x6a9417,_0x255467){return respondWithRpcPromise(_0xcf3c('0xec'),'getSnippet',{'command':_0x255467[_0xcf3c('0xed')]?util[_0xcf3c('0x9e')]('iftime\x20%s,%s',_0x6a9417['interval'],_0x255467[_0xcf3c('0xed')]):util[_0xcf3c('0x9e')](_0xcf3c('0xee'),_0x6a9417[_0xcf3c('0xef')])},client9002)[_0xcf3c('0x13')](function(_0x16c628){var _0x22509a=_0x16c628&&_0x16c628['indexOf'](_0xcf3c('0xf0'))>=0x0?!![]:![];logger[_0xcf3c('0x14')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x255467['id'],_0x6a9417['id'],_0x6a9417[_0xcf3c('0xef')],_0x22509a?_0xcf3c('0xf1'):'OFFLINE',_0x255467[_0xcf3c('0xed')]?_0x255467['timezone']:_0xcf3c('0xf2'));return _0x22509a;})[_0xcf3c('0x1d')](function(_0x5ca255){logger[_0xcf3c('0x19')](_0xcf3c('0xf3'),_0x255467['id'],_0x6a9417['id'],_0x6a9417[_0xcf3c('0xef')],util[_0xcf3c('0xf4')](_0x5ca255,{'showHidden':![],'depth':null}),_0x255467[_0xcf3c('0xed')]?_0x255467['timezone']:'No\x20timezone');return![];});}exports[_0xcf3c('0xf5')]=function(_0x382ad3,_0xd0dd0){var _0x239be2=0x0;var _0x42174a=0x0;var _0x4092c9=![];var _0x1e21c7;var _0xeca3af;return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x382ad3[_0xcf3c('0x45')]['id']},'include':[{'model':db[_0xcf3c('0xf6')],'as':_0xcf3c('0xf6'),'include':[{'model':db[_0xcf3c('0xf6')],'as':'Intervals','attributes':['id',_0xcf3c('0xef')],'raw':!![]}]}]})[_0xcf3c('0x13')](handleEntityNotFound(_0xd0dd0,null))['then'](function(_0xe07d71){if(_0xe07d71){_0x1e21c7=_0xe07d71;return _0xe07d71[_0xcf3c('0xf7')]({'raw':!![]});}})[_0xcf3c('0x13')](function(_0x5b2af2){if(_0x1e21c7){if(_0x5b2af2){_0xeca3af=_0x5b2af2;}}return require(_0xcf3c('0x6e'))['getLicense']();})['then'](function(_0x258392){if(_0x258392){_0x42174a=_0x258392[_0xcf3c('0xf8')];_0x4092c9=_0x258392[_0xcf3c('0x70')];}})[_0xcf3c('0x13')](function(){return db[_0xcf3c('0xa5')][_0xcf3c('0x41')]({'where':{'closed':![]}});})[_0xcf3c('0x13')](function(_0x195a13){_0x239be2=_0x195a13;if(_0x42174a&&_0x195a13>_0x42174a){return db[_0xcf3c('0xf9')][_0xcf3c('0x56')]({'where':{'id':0x1}})[_0xcf3c('0x13')](function(_0x8c9770){if(_0x8c9770){_0x8c9770[_0xcf3c('0xfa')](_0xcf3c('0xfb'));}});}})[_0xcf3c('0x13')](function(){if(_0x1e21c7[_0xcf3c('0xf6')]&&_0x1e21c7[_0xcf3c('0xf6')][_0xcf3c('0xfc')]){var _0x896677=[];for(var _0x2652a4=0x0;_0x2652a4<_0x1e21c7[_0xcf3c('0xf6')]['Intervals'][_0xcf3c('0x57')];_0x2652a4++){var _0xaf298e=_0x1e21c7['Interval']['Intervals'][_0x2652a4]['get']({'plain':!![]});_0x896677[_0xcf3c('0xac')](iftimePromise(_0xaf298e,_0x1e21c7));}return BPromise[_0xcf3c('0xfd')](_0x896677)[_0xcf3c('0x13')](function(_0x51d625){return _['some'](_0x51d625);});}else{return!![];}})['then'](function(_0x5221f6){var _0x503c81=fs[_0xcf3c('0xfe')](path[_0xcf3c('0x6a')](config[_0xcf3c('0x6b')],_0xcf3c('0xff')),_0xcf3c('0xc0'));var _0x591299={'remote':_0x1e21c7[_0xcf3c('0x100')],'query':querystring['stringify'](_['merge'](_0x1e21c7[_0xcf3c('0x29')]({'plain':!![]}),{'customerIp':_0x382ad3[_0xcf3c('0x7b')][_0xcf3c('0x96')]||_0x382ad3[_0xcf3c('0x7b')][_0xcf3c('0x101')]||_0x382ad3[_0xcf3c('0x102')][_0xcf3c('0x103')]||_0x382ad3['ip'],'referer':_0x382ad3[_0xcf3c('0x7b')][_0xcf3c('0x9b')],'openedInteractions':_0x239be2,'maxInteractions':_0x42174a,'virtual':_0x4092c9['virtual'],'online':_0x5221f6,'custom':_0x4092c9}))[_0xcf3c('0x104')](/'/g,'\x5c\x27')};_0xd0dd0[_0xcf3c('0x2d')](ejs[_0xcf3c('0xc1')](Mustache[_0xcf3c('0xc1')](_0x503c81,_0x591299),{'proactiveActions':_0xeca3af,'alignment':_0x1e21c7[_0xcf3c('0x105')],'verticalAlignment':_0x1e21c7[_0xcf3c('0x106')],'div_color':_0x1e21c7['color'],'labelText':_0x1e21c7[_0xcf3c('0x107')],'text_color':_0x1e21c7[_0xcf3c('0x108')],'button_color':_0x1e21c7[_0xcf3c('0x109')],'background_color':_0x1e21c7[_0xcf3c('0x10a')],'hideWhenOffline':_0x1e21c7[_0xcf3c('0x10b')],'interval':_0x1e21c7[_0xcf3c('0x10c')]}));})[_0xcf3c('0x1d')](handleError(_0xd0dd0,null));};exports['addApplications']=function(_0xda368,_0x93c5cb){var _0xb91b19=_0xda368[_0xcf3c('0x45')]['id'];var _0x9768e1=_0xda368['body'];var _0x49d276=0xc8;var _0x5f4dd7=null;return db['sequelize'][_0xcf3c('0xcc')]({'isolationLevel':db[_0xcf3c('0xcb')][_0xcf3c('0x10d')][_0xcf3c('0x10e')]['READ_COMMITTED']},function(_0x314e53){return db[_0xcf3c('0x31')]['findOne']({'where':{'id':_0xb91b19},'transaction':_0x314e53})[_0xcf3c('0x13')](function(_0x271f7c){if(_0x271f7c){return db[_0xcf3c('0x8c')][_0xcf3c('0x28')]({'where':{'ChatWebsiteId':_0xb91b19},'transaction':_0x314e53})[_0xcf3c('0x13')](function(){var _0x234fc8=_[_0xcf3c('0x30')](_0x9768e1,function(_0x359fe3){_0x359fe3['ChatWebsiteId']=_0xb91b19;return _0x359fe3;});return db[_0xcf3c('0x8c')][_0xcf3c('0xce')](_0x234fc8,{'transaction':_0x314e53});});}else{_0x49d276=0x194;_0x5f4dd7=[];}});})[_0xcf3c('0x13')](function(){if(_0x49d276!==0x194){return db[_0xcf3c('0x8c')][_0xcf3c('0x10f')]({'where':{'ChatWebsiteId':_0xb91b19},'order':'priority'})[_0xcf3c('0x13')](function(_0x57347c){_0x5f4dd7=_0x57347c;});}})['catch'](function(_0x564c39){_0x49d276=0x1f4;logger[_0xcf3c('0x19')](_0x564c39[_0xcf3c('0x2b')]);if(_0x564c39[_0xcf3c('0x2c')]){delete _0x564c39[_0xcf3c('0x2c')];}_0x5f4dd7=_0x564c39;})[_0xcf3c('0x110')](function(){if(_0x5f4dd7===null){_0x93c5cb[_0xcf3c('0x1e')](_0x49d276);}else{if(_0x49d276===0x1f4){_0x93c5cb[_0xcf3c('0x1f')](_0x49d276)[_0xcf3c('0x2d')](_0x5f4dd7);}else{_0x93c5cb[_0xcf3c('0x1f')](_0x49d276)[_0xcf3c('0x21')](_0x5f4dd7);}}});};exports[_0xcf3c('0x111')]=function(_0x49aa0c,_0x6d132b){var _0x25636f={};var _0x59c3d4={};var _0x5d0178;var _0x23ea98;return db[_0xcf3c('0x31')]['findOne']({'where':{'id':_0x49aa0c[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x6d132b,null))[_0xcf3c('0x13')](function(_0x375525){if(_0x375525){_0x5d0178=_0x375525;_0x59c3d4[_0xcf3c('0x32')]=_[_0xcf3c('0x46')](db[_0xcf3c('0x8c')]['rawAttributes']);_0x59c3d4[_0xcf3c('0x33')]=_['keys'](_0x49aa0c[_0xcf3c('0x33')]);_0x59c3d4['filters']=_[_0xcf3c('0x35')](_0x59c3d4[_0xcf3c('0x32')],_0x59c3d4[_0xcf3c('0x33')]);_0x25636f['attributes']=_[_0xcf3c('0x35')](_0x59c3d4[_0xcf3c('0x32')],qs[_0xcf3c('0x37')](_0x49aa0c[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x25636f[_0xcf3c('0x36')]=_0x25636f[_0xcf3c('0x36')][_0xcf3c('0x57')]?_0x25636f['attributes']:_0x59c3d4['model'];_0x25636f[_0xcf3c('0x3a')]=qs['sort'](_0x49aa0c[_0xcf3c('0x33')][_0xcf3c('0x58')]);_0x25636f[_0xcf3c('0x3b')]=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0x49aa0c[_0xcf3c('0x33')],_0x59c3d4['filters']));if(_0x49aa0c[_0xcf3c('0x33')][_0xcf3c('0x3d')]){_0x25636f[_0xcf3c('0x3b')]=_[_0xcf3c('0x3e')](_0x25636f[_0xcf3c('0x3b')],{'$or':_[_0xcf3c('0x30')](_0x25636f['attributes'],function(_0x361c7d){var _0x2f1349={};_0x2f1349[_0x361c7d]={'$like':'%'+_0x49aa0c['query']['filter']+'%'};return _0x2f1349;})});}_0x25636f=_[_0xcf3c('0x3e')]({},_0x25636f,_0x49aa0c[_0xcf3c('0x48')]);return _0x5d0178[_0xcf3c('0x111')](_0x25636f);}})[_0xcf3c('0x13')](function(_0xefc36d){if(_0xefc36d){_0x23ea98=_0xefc36d[_0xcf3c('0x57')];if(!_0x49aa0c[_0xcf3c('0x33')][_0xcf3c('0x38')]('nolimit')){_0x25636f[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0x49aa0c[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0x25636f['offset']=qs[_0xcf3c('0x22')](_0x49aa0c['query']['offset']);}return _0x5d0178[_0xcf3c('0x111')](_0x25636f);}})[_0xcf3c('0x13')](function(_0x3e7d3f){if(_0x3e7d3f){return _0x3e7d3f?{'count':_0x23ea98,'rows':_0x3e7d3f}:null;}})['then'](respondWithResult(_0x6d132b,null))[_0xcf3c('0x1d')](handleError(_0x6d132b,null));};exports[_0xcf3c('0x112')]=function(_0x444f70,_0x8ba6da){return db[_0xcf3c('0x113')]['find']({'where':{'id':_0x444f70[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x8ba6da,null))[_0xcf3c('0x13')](function(_0x1979f2){if(_0x1979f2){return _0x1979f2[_0xcf3c('0x112')](_0x444f70['body'][_0xcf3c('0x5c')],_[_0xcf3c('0xe2')](_0x444f70['body'],['ids','id'])||{});}})[_0xcf3c('0x13')](respondWithResult(_0x8ba6da,null))['catch'](handleError(_0x8ba6da,null));};exports[_0xcf3c('0xf7')]=function(_0x50bba0,_0x1aa998){var _0xfad289={};var _0x5abf32={};var _0x3bee38;var _0x7dd644;return db['ChatWebsite'][_0xcf3c('0x56')]({'where':{'id':_0x50bba0[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x1aa998,null))[_0xcf3c('0x13')](function(_0x2c93e9){if(_0x2c93e9){_0x3bee38=_0x2c93e9;_0x5abf32[_0xcf3c('0x32')]=_[_0xcf3c('0x46')](db[_0xcf3c('0x114')][_0xcf3c('0x47')]);_0x5abf32[_0xcf3c('0x33')]=_[_0xcf3c('0x46')](_0x50bba0[_0xcf3c('0x33')]);_0x5abf32[_0xcf3c('0x34')]=_['intersection'](_0x5abf32[_0xcf3c('0x32')],_0x5abf32['query']);_0xfad289['attributes']=_[_0xcf3c('0x35')](_0x5abf32[_0xcf3c('0x32')],qs[_0xcf3c('0x37')](_0x50bba0[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0xfad289['attributes']=_0xfad289[_0xcf3c('0x36')][_0xcf3c('0x57')]?_0xfad289['attributes']:_0x5abf32['model'];_0xfad289[_0xcf3c('0x3a')]=qs[_0xcf3c('0x58')](_0x50bba0[_0xcf3c('0x33')][_0xcf3c('0x58')]);_0xfad289['where']=qs[_0xcf3c('0x34')](_[_0xcf3c('0x3c')](_0x50bba0['query'],_0x5abf32[_0xcf3c('0x34')]));if(_0x50bba0['query']['filter']){_0xfad289['where']=_['merge'](_0xfad289[_0xcf3c('0x3b')],{'$or':_[_0xcf3c('0x30')](_0xfad289[_0xcf3c('0x36')],function(_0x5c73b5){var _0x120147={};_0x120147[_0x5c73b5]={'$like':'%'+_0x50bba0[_0xcf3c('0x33')][_0xcf3c('0x3d')]+'%'};return _0x120147;})});}_0xfad289=_[_0xcf3c('0x3e')]({},_0xfad289,_0x50bba0[_0xcf3c('0x48')]);return _0x3bee38[_0xcf3c('0xf7')](_0xfad289);}})[_0xcf3c('0x13')](function(_0x2a5d2f){if(_0x2a5d2f){_0x7dd644=_0x2a5d2f[_0xcf3c('0x57')];if(!_0x50bba0[_0xcf3c('0x33')]['hasOwnProperty'](_0xcf3c('0x39'))){_0xfad289['limit']=qs[_0xcf3c('0x24')](_0x50bba0[_0xcf3c('0x33')][_0xcf3c('0x24')]);_0xfad289[_0xcf3c('0x22')]=qs[_0xcf3c('0x22')](_0x50bba0[_0xcf3c('0x33')][_0xcf3c('0x22')]);}return _0x3bee38[_0xcf3c('0xf7')](_0xfad289);}})['then'](function(_0xd07e8e){if(_0xd07e8e){return _0xd07e8e?{'count':_0x7dd644,'rows':_0xd07e8e}:null;}})['then'](respondWithResult(_0x1aa998,null))[_0xcf3c('0x1d')](handleError(_0x1aa998,null));};exports['getFields']=function(_0x33f26a,_0x5d2ca0){var _0x56608c=_0x33f26a[_0xcf3c('0x33')][_0xcf3c('0x115')]===_0xcf3c('0x116')?_0xcf3c('0x117'):_0xcf3c('0x118');return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'attributes':['id',_0x56608c],'where':{'id':_0x33f26a['params']['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x5d2ca0,null))[_0xcf3c('0x13')](function(_0x2beaba){if(_0x2beaba){var _0x2b258d=_0x2beaba[_0x56608c];var _0x583b5f=_0x2b258d&&_0x2b258d[_0xcf3c('0x119')]?_0x2b258d[_0xcf3c('0x119')]:[];_0x5d2ca0[_0xcf3c('0x2d')]({'fromKey':_[_0xcf3c('0x71')](_0x2b258d[_0xcf3c('0x11a')])?undefined:_0x2b258d['fromKey'],'count':_0x583b5f[_0xcf3c('0x57')],'rows':_0x583b5f});}})[_0xcf3c('0x1d')](handleError(_0x5d2ca0,null));};exports[_0xcf3c('0x11b')]=function(_0x2bc399,_0x201cc0){var _0x44f060={'raw':![],'where':{}};var _0x785fe9={};var _0x3c89ec={'count':0x0,'rows':[]};return db[_0xcf3c('0x31')][_0xcf3c('0x56')]({'where':{'id':_0x2bc399[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x201cc0,null))['then'](function(_0x5cd4ae){if(_0x5cd4ae){_0x785fe9[_0xcf3c('0x32')]=_['keys'](db[_0xcf3c('0xc4')][_0xcf3c('0x47')]);_0x785fe9[_0xcf3c('0x33')]=_['keys'](_0x2bc399['query']);_0x785fe9['filters']=_[_0xcf3c('0x35')](_0x785fe9[_0xcf3c('0x32')],_0x785fe9[_0xcf3c('0x33')]);_0x44f060['attributes']=_[_0xcf3c('0x35')](_0x785fe9[_0xcf3c('0x32')],qs[_0xcf3c('0x37')](_0x2bc399[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x44f060['attributes']=_0x44f060[_0xcf3c('0x36')][_0xcf3c('0x57')]?_0x44f060[_0xcf3c('0x36')]:_0x785fe9[_0xcf3c('0x32')];if(!_0x2bc399['query'][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0x44f060[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0x2bc399[_0xcf3c('0x33')]['limit']);_0x44f060[_0xcf3c('0x22')]=qs[_0xcf3c('0x22')](_0x2bc399[_0xcf3c('0x33')][_0xcf3c('0x22')]);}_0x44f060['order']=qs[_0xcf3c('0x58')](_0x2bc399[_0xcf3c('0x33')]['sort']);_0x44f060[_0xcf3c('0x3b')]=qs[_0xcf3c('0x34')](_['pick'](_0x2bc399['query'],_0x785fe9[_0xcf3c('0x34')]));_0x44f060['where']['ChatWebsiteId']=_0x5cd4ae['id'];if(_0x2bc399[_0xcf3c('0x33')][_0xcf3c('0x3d')]){_0x44f060[_0xcf3c('0x3b')]=_[_0xcf3c('0x3e')](_0x44f060[_0xcf3c('0x3b')],{'$or':_[_0xcf3c('0x30')](_0x44f060[_0xcf3c('0x36')],function(_0x36f0b8){var _0x46e8cf={};_0x46e8cf[_0x36f0b8]={'$like':'%'+_0x2bc399[_0xcf3c('0x33')][_0xcf3c('0x3d')]+'%'};return _0x46e8cf;})});}_0x44f060=_[_0xcf3c('0x3e')]({},_0x44f060,_0x2bc399[_0xcf3c('0x48')]);return db[_0xcf3c('0xc4')]['count']({'where':_0x44f060[_0xcf3c('0x3b')]})[_0xcf3c('0x13')](function(_0x43bdf2){_0x3c89ec[_0xcf3c('0x41')]=_0x43bdf2;if(_0x2bc399[_0xcf3c('0x33')]['includeAll']){_0x44f060['include']=[{'all':!![]}];}else{_0x44f060['include']=[{'model':db[_0xcf3c('0x8a')],'as':_0xcf3c('0xe4'),'required':![]},{'model':db[_0xcf3c('0xcd')],'as':'Attachments','required':![]}];}return db[_0xcf3c('0xc4')][_0xcf3c('0x42')](_0x44f060);})[_0xcf3c('0x13')](function(_0x4ab67f){_0x3c89ec[_0xcf3c('0x43')]=_0x4ab67f;return _0x3c89ec;});}})['then'](respondWithFilteredResult(_0x201cc0,_0x44f060))[_0xcf3c('0x1d')](handleError(_0x201cc0,null));};exports[_0xcf3c('0x11c')]=function(_0x376de3,_0x141da2){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x376de3[_0xcf3c('0x45')]['id']}})['then'](handleEntityNotFound(_0x141da2,null))[_0xcf3c('0x13')](function(_0x21fabd){if(_0x21fabd){return _0x21fabd[_0xcf3c('0x11c')](_0x376de3[_0xcf3c('0x4b')][_0xcf3c('0x5c')],_['omit'](_0x376de3[_0xcf3c('0x4b')],[_0xcf3c('0x5c'),'id'])||{})[_0xcf3c('0xa8')](function(_0x332254){for(var _0x2db1fd=0x0;_0x2db1fd<_0x376de3[_0xcf3c('0x4b')][_0xcf3c('0x5c')]['length'];_0x2db1fd+=0x1){socket[_0xcf3c('0x11d')]('userChatWebsite:save',{'UserId':Number(_0x376de3[_0xcf3c('0x4b')][_0xcf3c('0x5c')][_0x2db1fd]),'ChatWebsiteId':Number(_0x376de3[_0xcf3c('0x45')]['id'])});}return _0x332254;});}})[_0xcf3c('0x13')](respondWithResult(_0x141da2,null))[_0xcf3c('0x1d')](handleError(_0x141da2,null));};exports[_0xcf3c('0x11e')]=function(_0x157578,_0x156196){return db[_0xcf3c('0x31')][_0xcf3c('0x49')]({'where':{'id':_0x157578[_0xcf3c('0x45')]['id']}})[_0xcf3c('0x13')](handleEntityNotFound(_0x156196,null))[_0xcf3c('0x13')](function(_0x12e9a7){if(_0x12e9a7){return _0x12e9a7[_0xcf3c('0x11e')](_0x157578[_0xcf3c('0x33')]['ids'])['then'](function(){if(_[_0xcf3c('0x11f')](_0x157578[_0xcf3c('0x33')][_0xcf3c('0x5c')])){for(var _0x5bf191=0x0;_0x5bf191<_0x157578[_0xcf3c('0x33')][_0xcf3c('0x5c')][_0xcf3c('0x57')];_0x5bf191+=0x1){socket[_0xcf3c('0x11d')](_0xcf3c('0x120'),{'UserId':Number(_0x157578['query'][_0xcf3c('0x5c')][_0x5bf191]),'ChatWebsiteId':Number(_0x157578[_0xcf3c('0x45')]['id'])});}}else{socket[_0xcf3c('0x11d')](_0xcf3c('0x120'),{'UserId':Number(_0x157578[_0xcf3c('0x33')][_0xcf3c('0x5c')]),'ChatWebsiteId':Number(_0x157578[_0xcf3c('0x45')]['id'])});}});}})[_0xcf3c('0x13')](respondWithStatusCode(_0x156196,null))[_0xcf3c('0x1d')](handleError(_0x156196,null));};exports[_0xcf3c('0x121')]=function(_0x4a8c6b,_0x1a4884){var _0x4409c0={};var _0x3a4b55={};var _0x179dc9;var _0x5f540d;return db[_0xcf3c('0x31')][_0xcf3c('0x56')]({'where':{'id':_0x4a8c6b[_0xcf3c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a4884,null))['then'](function(_0x49e041){if(_0x49e041){_0x179dc9=_0x49e041;_0x3a4b55[_0xcf3c('0x32')]=_[_0xcf3c('0x46')](db[_0xcf3c('0xb1')][_0xcf3c('0x47')]);_0x3a4b55[_0xcf3c('0x33')]=_['keys'](_0x4a8c6b[_0xcf3c('0x33')]);_0x3a4b55['filters']=_[_0xcf3c('0x35')](_0x3a4b55['model'],_0x3a4b55['query']);_0x4409c0[_0xcf3c('0x36')]=_['intersection'](_0x3a4b55['model'],qs[_0xcf3c('0x37')](_0x4a8c6b[_0xcf3c('0x33')][_0xcf3c('0x37')]));_0x4409c0['attributes']=_0x4409c0[_0xcf3c('0x36')][_0xcf3c('0x57')]?_0x4409c0[_0xcf3c('0x36')]:_0x3a4b55[_0xcf3c('0x32')];_0x4409c0[_0xcf3c('0x3a')]=qs[_0xcf3c('0x58')](_0x4a8c6b[_0xcf3c('0x33')][_0xcf3c('0x58')]);_0x4409c0[_0xcf3c('0x3b')]=qs['filters'](_['pick'](_0x4a8c6b['query'],_0x3a4b55['filters']));if(_0x4a8c6b[_0xcf3c('0x33')]['filter']){_0x4409c0['where']=_['merge'](_0x4409c0['where'],{'$or':_[_0xcf3c('0x30')](_0x4409c0[_0xcf3c('0x36')],function(_0x10f9e0){var _0x4fd1b8={};_0x4fd1b8[_0x10f9e0]={'$like':'%'+_0x4a8c6b['query'][_0xcf3c('0x3d')]+'%'};return _0x4fd1b8;})});}_0x4409c0=_[_0xcf3c('0x3e')]({},_0x4409c0,_0x4a8c6b[_0xcf3c('0x48')]);return _0x179dc9[_0xcf3c('0x121')](_0x4409c0);}})[_0xcf3c('0x13')](function(_0x4f569f){if(_0x4f569f){_0x5f540d=_0x4f569f[_0xcf3c('0x57')];if(!_0x4a8c6b[_0xcf3c('0x33')][_0xcf3c('0x38')](_0xcf3c('0x39'))){_0x4409c0[_0xcf3c('0x24')]=qs[_0xcf3c('0x24')](_0x4a8c6b['query'][_0xcf3c('0x24')]);_0x4409c0[_0xcf3c('0x22')]=qs[_0xcf3c('0x22')](_0x4a8c6b['query'][_0xcf3c('0x22')]);}return _0x179dc9[_0xcf3c('0x121')](_0x4409c0);}})[_0xcf3c('0x13')](function(_0x2154b6){if(_0x2154b6){return _0x2154b6?{'count':_0x5f540d,'rows':_0x2154b6}:null;}})['then'](respondWithResult(_0x1a4884,null))[_0xcf3c('0x1d')](handleError(_0x1a4884,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d99b273..4c30628 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 _0x81bd=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x52f15e,_0x23b9d0){var _0x5caabe=function(_0x341545){while(--_0x341545){_0x52f15e['push'](_0x52f15e['shift']());}};_0x5caabe(++_0x23b9d0);}(_0x81bd,0x7c));var _0xd81b=function(_0x4fa0e8,_0x26b636){_0x4fa0e8=_0x4fa0e8-0x0;var _0x19cadd=_0x81bd[_0x4fa0e8];return _0x19cadd;};'use strict';var EventEmitter=require(_0xd81b('0x0'));var ChatWebsite=require(_0xd81b('0x1'))['db'][_0xd81b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd81b('0x3')](0x0);var events={'afterCreate':_0xd81b('0x4'),'afterUpdate':_0xd81b('0x5'),'afterDestroy':_0xd81b('0x6')};function emitEvent(_0x54e096){return function(_0x16e8de,_0x2c3d9e,_0x1b6cfe){ChatWebsiteEvents['emit'](_0x54e096+':'+_0x16e8de['id'],_0x16e8de);ChatWebsiteEvents[_0xd81b('0x7')](_0x54e096,_0x16e8de);_0x1b6cfe(null);};}for(var e in events){if(events[_0xd81b('0x8')](e)){var event=events[e];ChatWebsite[_0xd81b('0x9')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x302c=['save','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x200271,_0xc66c2a){var _0x2addbb=function(_0x3880c0){while(--_0x3880c0){_0x200271['push'](_0x200271['shift']());}};_0x2addbb(++_0xc66c2a);}(_0x302c,0x15c));var _0xc302=function(_0x3544ae,_0x3064a5){_0x3544ae=_0x3544ae-0x0;var _0x203f9c=_0x302c[_0x3544ae];return _0x203f9c;};'use strict';var EventEmitter=require(_0xc302('0x0'));var ChatWebsite=require(_0xc302('0x1'))['db'][_0xc302('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc302('0x3')](0x0);var events={'afterCreate':_0xc302('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x256168){return function(_0xdc61f1,_0x3ed277,_0x589559){ChatWebsiteEvents['emit'](_0x256168+':'+_0xdc61f1['id'],_0xdc61f1);ChatWebsiteEvents[_0xc302('0x5')](_0x256168,_0xdc61f1);_0x589559(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc302('0x6')](e,emitEvent(event));}}module[_0xc302('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ac267a7..e33b70c 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 _0x9f98=['lodash','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x516fb0,_0x250ebe){var _0x26758e=function(_0x222139){while(--_0x222139){_0x516fb0['push'](_0x516fb0['shift']());}};_0x26758e(++_0x250ebe);}(_0x9f98,0x132));var _0x89f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9f98[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x89f9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x89f9('0x1'));var moment=require('moment');var BPromise=require(_0x89f9('0x2'));var rp=require(_0x89f9('0x3'));var fs=require('fs');var path=require(_0x89f9('0x4'));var rimraf=require('rimraf');var config=require(_0x89f9('0x5'));var attributes=require(_0x89f9('0x6'));module[_0x89f9('0x7')]=function(_0x56719d,_0x42627a){return _0x56719d['define'](_0x89f9('0x8'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3115=['chat_websites','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3115,0x85));var _0x5311=function(_0xc376e1,_0x1a2b83){_0xc376e1=_0xc376e1-0x0;var _0x63e01c=_0x3115[_0xc376e1];return _0x63e01c;};'use strict';var _=require(_0x5311('0x0'));var util=require(_0x5311('0x1'));var logger=require(_0x5311('0x2'))('api');var moment=require(_0x5311('0x3'));var BPromise=require(_0x5311('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5311('0x5'));var rimraf=require(_0x5311('0x6'));var config=require(_0x5311('0x7'));var attributes=require(_0x5311('0x8'));module[_0x5311('0x9')]=function(_0x481c22,_0x4fc5bb){return _0x481c22['define']('ChatWebsite',attributes,{'tableName':_0x5311('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 31c73f3..b216e46 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 _0x3d6f=['ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','register','then','info'];(function(_0x1c4803,_0x59694c){var _0x3110bc=function(_0x162f3b){while(--_0x162f3b){_0x1c4803['push'](_0x1c4803['shift']());}};_0x3110bc(++_0x59694c);}(_0x3d6f,0xa2));var _0xf3d6=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x3d6f[_0x589eb4];return _0xf50816;};'use strict';var _=require('lodash');var util=require(_0xf3d6('0x0'));var moment=require(_0xf3d6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3d6('0x2'));var db=require(_0xf3d6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf3d6('0x4'));var config=require(_0xf3d6('0x5'));var jayson=require(_0xf3d6('0x6'));var client=jayson[_0xf3d6('0x7')]['http']({'port':0x232a});config['redis']=_[_0xf3d6('0x8')](config['redis'],{'host':_0xf3d6('0x9'),'port':0x18eb});var socket=require(_0xf3d6('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xf3d6('0xb')](socket);function respondWithRpcPromise(_0x574fc5,_0x28047b,_0x1d981a){return new BPromise(function(_0x10c787,_0x3add9a){return client['request'](_0x574fc5,_0x1d981a)[_0xf3d6('0xc')](function(_0x2f72f4){logger[_0xf3d6('0xd')](_0xf3d6('0xe'),_0x28047b,'request\x20sent');logger[_0xf3d6('0xf')](_0xf3d6('0x10'),_0x28047b,'request\x20sent',JSON[_0xf3d6('0x11')](_0x2f72f4));if(_0x2f72f4[_0xf3d6('0x12')]){if(_0x2f72f4[_0xf3d6('0x12')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x28047b,_0x2f72f4[_0xf3d6('0x12')][_0xf3d6('0x13')]);return _0x3add9a(_0x2f72f4[_0xf3d6('0x12')][_0xf3d6('0x13')]);}logger[_0xf3d6('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x28047b,_0x2f72f4[_0xf3d6('0x12')][_0xf3d6('0x13')]);return _0x10c787(_0x2f72f4['error'][_0xf3d6('0x13')]);}else{logger[_0xf3d6('0xd')](_0xf3d6('0xe'),_0x28047b,_0xf3d6('0x14'));_0x10c787(_0x2f72f4[_0xf3d6('0x15')][_0xf3d6('0x13')]);}})['catch'](function(_0x17bdf2){logger[_0xf3d6('0x12')](_0xf3d6('0xe'),_0x28047b,_0x17bdf2);_0x3add9a(_0x17bdf2);});});} \ No newline at end of file +var _0x9c26=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x9c26,0xdf));var _0x69c2=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x9c26[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x69c2('0x0'));var util=require(_0x69c2('0x1'));var moment=require(_0x69c2('0x2'));var BPromise=require(_0x69c2('0x3'));var rs=require(_0x69c2('0x4'));var fs=require('fs');var Redis=require(_0x69c2('0x5'));var db=require(_0x69c2('0x6'))['db'];var utils=require(_0x69c2('0x7'));var logger=require(_0x69c2('0x8'))(_0x69c2('0x9'));var config=require(_0x69c2('0xa'));var jayson=require(_0x69c2('0xb'));var client=jayson[_0x69c2('0xc')]['http']({'port':0x232a});config[_0x69c2('0xd')]=_[_0x69c2('0xe')](config[_0x69c2('0xd')],{'host':_0x69c2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x69c2('0x10'))[_0x69c2('0x11')](socket);function respondWithRpcPromise(_0x563372,_0x8da6b3,_0x1b5bf9){return new BPromise(function(_0x210172,_0x31410f){return client[_0x69c2('0x12')](_0x563372,_0x1b5bf9)[_0x69c2('0x13')](function(_0x402ac3){logger['info'](_0x69c2('0x14'),_0x8da6b3,_0x69c2('0x15'));logger[_0x69c2('0x16')](_0x69c2('0x17'),_0x8da6b3,_0x69c2('0x15'),JSON[_0x69c2('0x18')](_0x402ac3));if(_0x402ac3[_0x69c2('0x19')]){if(_0x402ac3[_0x69c2('0x19')]['code']===0x1f4){logger[_0x69c2('0x19')](_0x69c2('0x14'),_0x8da6b3,_0x402ac3[_0x69c2('0x19')][_0x69c2('0x1a')]);return _0x31410f(_0x402ac3['error']['message']);}logger[_0x69c2('0x19')](_0x69c2('0x14'),_0x8da6b3,_0x402ac3[_0x69c2('0x19')][_0x69c2('0x1a')]);return _0x210172(_0x402ac3[_0x69c2('0x19')]['message']);}else{logger['info'](_0x69c2('0x14'),_0x8da6b3,'request\x20sent');_0x210172(_0x402ac3['result'][_0x69c2('0x1a')]);}})[_0x69c2('0x1b')](function(_0x2af05b){logger[_0x69c2('0x19')](_0x69c2('0x14'),_0x8da6b3,_0x2af05b);_0x31410f(_0x2af05b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e41993e..3c112d3 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 _0x2de4=['remove','update','register','length','chatWebsite:','save'];(function(_0x9e778d,_0x227065){var _0x2d6bf8=function(_0x303994){while(--_0x303994){_0x9e778d['push'](_0x9e778d['shift']());}};_0x2d6bf8(++_0x227065);}(_0x2de4,0xef));var _0x42de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2de4[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x42de('0x0'),_0x42de('0x1'),_0x42de('0x2')];function createListener(_0x121453,_0x123fec){return function(_0x1efe5a){_0x123fec['emit'](_0x121453,_0x1efe5a);};}function removeListener(_0x3d21b0,_0x27f66b){return function(){ChatWebsiteEvents['removeListener'](_0x3d21b0,_0x27f66b);};}exports[_0x42de('0x3')]=function(_0x387008){for(var _0x21497d=0x0,_0x34320e=events[_0x42de('0x4')];_0x21497d<_0x34320e;_0x21497d++){var _0xe15b6=events[_0x21497d];var _0x56f68c=createListener(_0x42de('0x5')+_0xe15b6,_0x387008);ChatWebsiteEvents['on'](_0xe15b6,_0x56f68c);}}; \ No newline at end of file +var _0x4654=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x18fdea,_0x397091){var _0x5c0af1=function(_0x4c4edf){while(--_0x4c4edf){_0x18fdea['push'](_0x18fdea['shift']());}};_0x5c0af1(++_0x397091);}(_0x4654,0x6d));var _0x4465=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4654[_0x2dafbe];return _0x58a45a;};'use strict';var ChatWebsiteEvents=require(_0x4465('0x0'));var events=[_0x4465('0x1'),'remove',_0x4465('0x2')];function createListener(_0x1c7010,_0x5d6ae0){return function(_0x36b052){_0x5d6ae0[_0x4465('0x3')](_0x1c7010,_0x36b052);};}function removeListener(_0x2f9f5b,_0x2bf7b7){return function(){ChatWebsiteEvents[_0x4465('0x4')](_0x2f9f5b,_0x2bf7b7);};}exports[_0x4465('0x5')]=function(_0x53f1b1){for(var _0x189b63=0x0,_0x34f258=events['length'];_0x189b63<_0x34f258;_0x189b63++){var _0x269b94=events[_0x189b63];var _0x3170d3=createListener(_0x4465('0x6')+_0x269b94,_0x53f1b1);ChatWebsiteEvents['on'](_0x269b94,_0x3170d3);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1d130a7..6df2878 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 _0x7b8a=['/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','addLogo','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','any','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x7b8a,0x1ab));var _0xa7b8=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x7b8a[_0x2891d1];return _0x486948;};'use strict';var multer=require('multer');var util=require(_0xa7b8('0x0'));var path=require(_0xa7b8('0x1'));var timeout=require(_0xa7b8('0x2'));var express=require(_0xa7b8('0x3'));var router=express[_0xa7b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa7b8('0x5'));var interaction=require(_0xa7b8('0x6'));var config=require(_0xa7b8('0x7'));var controller=require(_0xa7b8('0x8'));router[_0xa7b8('0x9')]('/',auth[_0xa7b8('0xa')](),controller[_0xa7b8('0xb')]);router['get'](_0xa7b8('0xc'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0xd')]);router['get'](_0xa7b8('0xe'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0xf')]);router[_0xa7b8('0x9')](_0xa7b8('0x10'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x11')]);router[_0xa7b8('0x9')](_0xa7b8('0x12'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x13')]);router[_0xa7b8('0x9')]('/:id/logo',controller[_0xa7b8('0x14')]);router['get'](_0xa7b8('0x15'),controller[_0xa7b8('0x16')]);router[_0xa7b8('0x9')]('/:id/customer_avatar',controller[_0xa7b8('0x17')]);router['get'](_0xa7b8('0x18'),controller[_0xa7b8('0x19')]);router[_0xa7b8('0x9')](_0xa7b8('0x1a'),auth['isAuthenticated'](),controller[_0xa7b8('0x1b')]);router[_0xa7b8('0x9')](_0xa7b8('0x1c'),controller[_0xa7b8('0x1d')]);router['get'](_0xa7b8('0x1e'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x1f')]);router[_0xa7b8('0x9')](_0xa7b8('0x20'),auth[_0xa7b8('0xa')](),controller['getProactiveActions']);router[_0xa7b8('0x9')](_0xa7b8('0x21'),controller[_0xa7b8('0x22')]);router[_0xa7b8('0x9')](_0xa7b8('0x23'),auth['isAuthenticated'](),controller[_0xa7b8('0x24')]);router[_0xa7b8('0x9')]('/:id/users',auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x25')]);router[_0xa7b8('0x26')]('/',auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x27')]);router[_0xa7b8('0x26')](_0xa7b8('0x10'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x28')]);router[_0xa7b8('0x26')](_0xa7b8('0x12'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x29')]);var upload=multer({'storage':multer[_0xa7b8('0x2a')]({'destination':function(_0x207b13,_0xfccd37,_0x23b4a8){_0x23b4a8(null,path[_0xa7b8('0x2b')](config[_0xa7b8('0x2c')],_0xa7b8('0x2d')));},'filename':function(_0x5b111b,_0x4f1eb2,_0x25563a){_0x25563a(null,util[_0xa7b8('0x2e')](_0xa7b8('0x2f'),Date[_0xa7b8('0x30')](),_0x4f1eb2[_0xa7b8('0x31')]));}})});router[_0xa7b8('0x26')](_0xa7b8('0x32'),upload[_0xa7b8('0x33')]('file'),controller[_0xa7b8('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28f764,_0x23e6ad,_0x2d71bd){_0x2d71bd(null,path[_0xa7b8('0x2b')](config[_0xa7b8('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x15fd6b,_0x54bf01,_0x22a610){_0x22a610(null,util[_0xa7b8('0x2e')]('%s-%s',Date[_0xa7b8('0x30')](),_0x54bf01[_0xa7b8('0x31')]));}})});router[_0xa7b8('0x26')](_0xa7b8('0x15'),upload[_0xa7b8('0x33')](_0xa7b8('0x35')),controller[_0xa7b8('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34c759,_0x46659d,_0x4216c2){_0x4216c2(null,path[_0xa7b8('0x2b')](config[_0xa7b8('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x2d0947,_0xfdaebe,_0x452e48){_0x452e48(null,util[_0xa7b8('0x2e')](_0xa7b8('0x2f'),Date[_0xa7b8('0x30')](),_0xfdaebe[_0xa7b8('0x31')]));}})});router[_0xa7b8('0x26')](_0xa7b8('0x37'),upload['single'](_0xa7b8('0x35')),controller[_0xa7b8('0x38')]);var upload=multer({'storage':multer[_0xa7b8('0x2a')]({'destination':function(_0x510752,_0x125389,_0x3a27d0){_0x3a27d0(null,path[_0xa7b8('0x2b')](config[_0xa7b8('0x2c')],_0xa7b8('0x39')));},'filename':function(_0x2e80ea,_0x36cff0,_0x2a1e2a){_0x2a1e2a(null,util[_0xa7b8('0x2e')](_0xa7b8('0x2f'),Date['now'](),_0x36cff0[_0xa7b8('0x31')]));}})});router['post'](_0xa7b8('0x18'),upload['single'](_0xa7b8('0x35')),controller[_0xa7b8('0x3a')]);router[_0xa7b8('0x26')](_0xa7b8('0x3b'),controller[_0xa7b8('0x3c')]);const offlineUploadMulter=multer({'storage':multer[_0xa7b8('0x2a')]({'destination':function(_0x38be22,_0x208b39,_0xba94e1){const _0x5620c5=path[_0xa7b8('0x2b')](config[_0xa7b8('0x2c')],_0xa7b8('0x3d'),_0xa7b8('0x3e'),_0xa7b8('0x3f'));fs_extra[_0xa7b8('0x40')](_0x5620c5,function(){_0xba94e1(null,_0x5620c5);});},'filename':function(_0x411bac,_0x3b0bf1,_0x4d7559){const _0x321219=_0x3b0bf1[_0xa7b8('0x31')][_0xa7b8('0x41')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x28efd8=path['extname'](_0x321219);const _0x34b865=Date[_0xa7b8('0x30')]()+'-'+_0x321219[_0xa7b8('0x41')](_0x28efd8,'')+_0x28efd8;_0x4d7559(null,_0x34b865);}})});router[_0xa7b8('0x26')]('/:id/offline',offlineUploadMulter[_0xa7b8('0x42')](),controller[_0xa7b8('0x43')]);router['post']('/:id/interactions',auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x44')]);router[_0xa7b8('0x26')](_0xa7b8('0x1e'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa7b8('0x26')](_0xa7b8('0x20'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x45')]);router['post'](_0xa7b8('0x46'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x47')]);router[_0xa7b8('0x48')](_0xa7b8('0xe'),auth[_0xa7b8('0xa')](),controller['update']);router['delete']('/:id',auth[_0xa7b8('0xa')](),controller['destroy']);router[_0xa7b8('0x49')](_0xa7b8('0x10'),auth[_0xa7b8('0xa')](),controller['removeDispositions']);router[_0xa7b8('0x49')](_0xa7b8('0x12'),auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x4a')]);router[_0xa7b8('0x49')]('/:id/users',auth[_0xa7b8('0xa')](),controller[_0xa7b8('0x4b')]);module[_0xa7b8('0x4c')]=router; \ No newline at end of file +var _0x92d2=['isAuthenticated','/describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','join','root','format','now','originalname','file','addLogo','%s-%s','single','diskStorage','addCustomerAvatar','server/files/images/avatars/','/:id/system_avatar','notify','offline-chat','ensureDir','replace','/:id/offline','offline','addInteraction','addApplications','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get'];(function(_0x3e6d2f,_0x38d422){var _0xa43717=function(_0x3108ae){while(--_0x3108ae){_0x3e6d2f['push'](_0x3e6d2f['shift']());}};_0xa43717(++_0x38d422);}(_0x92d2,0x77));var _0x292d=function(_0x467b60,_0x4c33e4){_0x467b60=_0x467b60-0x0;var _0x2a7429=_0x92d2[_0x467b60];return _0x2a7429;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x292d('0x0'));var timeout=require(_0x292d('0x1'));var express=require(_0x292d('0x2'));var router=express[_0x292d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x292d('0x4'));var interaction=require(_0x292d('0x5'));var config=require(_0x292d('0x6'));var controller=require(_0x292d('0x7'));router[_0x292d('0x8')]('/',auth[_0x292d('0x9')](),controller['index']);router[_0x292d('0x8')](_0x292d('0xa'),auth[_0x292d('0x9')](),controller['describe']);router[_0x292d('0x8')](_0x292d('0xb'),auth['isAuthenticated'](),controller[_0x292d('0xc')]);router[_0x292d('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x292d('0xd'),auth['isAuthenticated'](),controller[_0x292d('0xe')]);router[_0x292d('0x8')](_0x292d('0xf'),controller[_0x292d('0x10')]);router['get'](_0x292d('0x11'),controller[_0x292d('0x12')]);router[_0x292d('0x8')](_0x292d('0x13'),controller[_0x292d('0x14')]);router[_0x292d('0x8')]('/:id/system_avatar',controller[_0x292d('0x15')]);router[_0x292d('0x8')](_0x292d('0x16'),auth['isAuthenticated'](),controller[_0x292d('0x17')]);router['get']('/:id/snippet',controller[_0x292d('0x18')]);router[_0x292d('0x8')](_0x292d('0x19'),auth[_0x292d('0x9')](),controller['getApplications']);router[_0x292d('0x8')](_0x292d('0x1a'),auth[_0x292d('0x9')](),controller[_0x292d('0x1b')]);router[_0x292d('0x8')](_0x292d('0x1c'),controller['getFields']);router[_0x292d('0x8')]('/:id/offline_messages',auth[_0x292d('0x9')](),controller[_0x292d('0x1d')]);router[_0x292d('0x8')](_0x292d('0x1e'),auth[_0x292d('0x9')](),controller['getAgents']);router[_0x292d('0x1f')]('/',auth['isAuthenticated'](),controller[_0x292d('0x20')]);router['post']('/:id/dispositions',auth[_0x292d('0x9')](),controller[_0x292d('0x21')]);router['post'](_0x292d('0xd'),auth[_0x292d('0x9')](),controller[_0x292d('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc2979c,_0x20be48,_0x14969c){_0x14969c(null,path[_0x292d('0x23')](config[_0x292d('0x24')],'server/files/images/logos/'));},'filename':function(_0x1e2d6b,_0xf8be08,_0xf3f4d3){_0xf3f4d3(null,util[_0x292d('0x25')]('%s-%s',Date[_0x292d('0x26')](),_0xf8be08[_0x292d('0x27')]));}})});router[_0x292d('0x1f')](_0x292d('0xf'),upload['single'](_0x292d('0x28')),controller[_0x292d('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4950c8,_0x39f230,_0xac2ed1){_0xac2ed1(null,path[_0x292d('0x23')](config[_0x292d('0x24')],'server/files/images/avatars/'));},'filename':function(_0x30194d,_0x53c8d4,_0x34d670){_0x34d670(null,util[_0x292d('0x25')](_0x292d('0x2a'),Date['now'](),_0x53c8d4[_0x292d('0x27')]));}})});router[_0x292d('0x1f')](_0x292d('0x11'),upload[_0x292d('0x2b')](_0x292d('0x28')),controller['addAvatar']);var upload=multer({'storage':multer[_0x292d('0x2c')]({'destination':function(_0x161697,_0x1b4f48,_0x234407){_0x234407(null,path[_0x292d('0x23')](config['root'],'server/files/images/avatars/'));},'filename':function(_0xf289b0,_0x1fdfa0,_0xdc6932){_0xdc6932(null,util['format']('%s-%s',Date[_0x292d('0x26')](),_0x1fdfa0[_0x292d('0x27')]));}})});router[_0x292d('0x1f')](_0x292d('0x13'),upload[_0x292d('0x2b')](_0x292d('0x28')),controller[_0x292d('0x2d')]);var upload=multer({'storage':multer[_0x292d('0x2c')]({'destination':function(_0x25fc5d,_0x16ace9,_0x3e01b2){_0x3e01b2(null,path[_0x292d('0x23')](config[_0x292d('0x24')],_0x292d('0x2e')));},'filename':function(_0x95abb6,_0x14c2a4,_0x4a0491){_0x4a0491(null,util[_0x292d('0x25')](_0x292d('0x2a'),Date['now'](),_0x14c2a4[_0x292d('0x27')]));}})});router[_0x292d('0x1f')](_0x292d('0x2f'),upload[_0x292d('0x2b')](_0x292d('0x28')),controller['addSystemAvatar']);router['post']('/:id/notify',controller[_0x292d('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x292d('0x2c')]({'destination':function(_0x479045,_0xb1432a,_0x93e3){const _0x2c69b8=path[_0x292d('0x23')](config['root'],'server/files','attachments',_0x292d('0x31'));fs_extra[_0x292d('0x32')](_0x2c69b8,function(){_0x93e3(null,_0x2c69b8);});},'filename':function(_0x39e99d,_0x5de9ca,_0x41e0fa){const _0x2984ba=_0x5de9ca[_0x292d('0x27')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1497e=path['extname'](_0x2984ba);const _0x5331a4=Date['now']()+'-'+_0x2984ba[_0x292d('0x33')](_0x1497e,'')+_0x1497e;_0x41e0fa(null,_0x5331a4);}})});router[_0x292d('0x1f')](_0x292d('0x34'),offlineUploadMulter['any'](),controller[_0x292d('0x35')]);router[_0x292d('0x1f')](_0x292d('0x16'),auth[_0x292d('0x9')](),controller[_0x292d('0x36')]);router[_0x292d('0x1f')]('/:id/applications',auth[_0x292d('0x9')](),controller[_0x292d('0x37')]);router['post'](_0x292d('0x1a'),auth[_0x292d('0x9')](),controller['addProactiveActions']);router[_0x292d('0x1f')](_0x292d('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0x292d('0x38')](_0x292d('0xb'),auth[_0x292d('0x9')](),controller[_0x292d('0x39')]);router[_0x292d('0x3a')](_0x292d('0xb'),auth['isAuthenticated'](),controller[_0x292d('0x3b')]);router['delete']('/:id/dispositions',auth[_0x292d('0x9')](),controller[_0x292d('0x3c')]);router[_0x292d('0x3a')](_0x292d('0xd'),auth[_0x292d('0x9')](),controller[_0x292d('0x3d')]);router[_0x292d('0x3a')](_0x292d('0x1e'),auth['isAuthenticated'](),controller[_0x292d('0x3e')]);module[_0x292d('0x3f')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 09f85d8..264a481 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 _0xb044=['expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app','get','Client-Side\x20logger\x20not\x20found!'];(function(_0x301f7f,_0x58a5d4){var _0x56dc26=function(_0x215563){while(--_0x215563){_0x301f7f['push'](_0x301f7f['shift']());}};_0x56dc26(++_0x58a5d4);}(_0xb044,0xd4));var _0x4b04=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb044[_0x16b9ed];return _0x66b1f8;};var beaverLogger=require(_0x4b04('0x0'));var express=require(_0x4b04('0x1'));var auth=require(_0x4b04('0x2'));var config=require(_0x4b04('0x3'));var router=express['Router']();var isProduction=config[_0x4b04('0x4')]===_0x4b04('0x5')||![];function clientSideLogs(_0x40f2f5,_0x3a5a58,_0x20f449){var _0x49492a=_0x40f2f5[_0x4b04('0x6')][_0x4b04('0x7')]('client-side-logger');if(!_0x49492a){throw new Error(_0x4b04('0x8'));}return beaverLogger[_0x4b04('0x9')]({'uri':_0x4b04('0xa'),'logger':_0x49492a,'enableCors':!isProduction})(_0x40f2f5,_0x3a5a58,_0x20f449);}router[_0x4b04('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x4b04('0xc')]=router; \ No newline at end of file +var _0x1098=['../components/auth/service','production','Client-Side\x20logger\x20not\x20found!','isAuthenticated','exports','express'];(function(_0x2142fa,_0x1e9945){var _0x350983=function(_0x125657){while(--_0x125657){_0x2142fa['push'](_0x2142fa['shift']());}};_0x350983(++_0x1e9945);}(_0x1098,0x131));var _0x8109=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1098[_0x3dd15e];return _0x231fd0;};var beaverLogger=require('beaver-logger/server');var express=require(_0x8109('0x0'));var auth=require(_0x8109('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config['env']===_0x8109('0x2')||![];function clientSideLogs(_0x3386cd,_0x8746eb,_0x2c0b7f){var _0x5a89ee=_0x3386cd['app']['get']('client-side-logger');if(!_0x5a89ee){throw new Error(_0x8109('0x3'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x5a89ee,'enableCors':!isProduction})(_0x3386cd,_0x8746eb,_0x2c0b7f);}router['use'](auth[_0x8109('0x4')](),clientSideLogs);module[_0x8109('0x5')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f3fdc56..2e6298a 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 _0x08c5=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x1364cb,_0x324656){var _0x5b2672=function(_0x447aba){while(--_0x447aba){_0x1364cb['push'](_0x1364cb['shift']());}};_0x5b2672(++_0x324656);}(_0x08c5,0x80));var _0x508c=function(_0x4b6159,_0x13da06){_0x4b6159=_0x4b6159-0x0;var _0x5e3b01=_0x08c5[_0x4b6159];return _0x5e3b01;};'use strict';var Sequelize=require(_0x508c('0x0'));module[_0x508c('0x1')]={'name':{'type':Sequelize[_0x508c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x508c('0x3')](_0x508c('0x4'),_0x508c('0x5'),_0x508c('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x508c('0x3')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x508c('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x508c('0x2')],'comment':_0x508c('0x7')},'data3':{'type':Sequelize[_0x508c('0x2')],'comment':_0x508c('0x8')},'data4':{'type':Sequelize[_0x508c('0x2')],'comment':_0x508c('0x9')},'data5':{'type':Sequelize[_0x508c('0xa')],'comment':_0x508c('0xb')},'data6':{'type':Sequelize[_0x508c('0xa')],'comment':_0x508c('0xc')},'data7':{'type':Sequelize[_0x508c('0xa')],'comment':_0x508c('0xd')}}; \ No newline at end of file +var _0x8396=['sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x3fb3ba,_0x2dd84d){var _0xfa43ea=function(_0x16e74b){while(--_0x16e74b){_0x3fb3ba['push'](_0x3fb3ba['shift']());}};_0xfa43ea(++_0x2dd84d);}(_0x8396,0xa8));var _0x6839=function(_0x5db600,_0x47f723){_0x5db600=_0x5db600-0x0;var _0x18190c=_0x8396[_0x5db600];return _0x18190c;};'use strict';var Sequelize=require(_0x6839('0x0'));module['exports']={'name':{'type':Sequelize[_0x6839('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6839('0x2')](_0x6839('0x3'),_0x6839('0x4'),_0x6839('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6839('0x6'),_0x6839('0x7'))},'data1':{'type':Sequelize[_0x6839('0x1')],'comment':_0x6839('0x8')},'data2':{'type':Sequelize[_0x6839('0x1')],'comment':_0x6839('0x9')},'data3':{'type':Sequelize[_0x6839('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x6839('0x1')],'comment':_0x6839('0xa')},'data5':{'type':Sequelize[_0x6839('0xb')],'comment':_0x6839('0xc')},'data6':{'type':Sequelize[_0x6839('0xb')],'comment':_0x6839('0xd')},'data7':{'type':Sequelize[_0x6839('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8f9bba8..dec4be7 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 _0x8379=['query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','service','decryptString','data3','catch','show','params','keys','find','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','MicrosoftAzure','encryptString','oauth2MicrosoftAuthorize','findOne','user','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','CloudProvider','rawAttributes','type','key','model','map'];(function(_0x101ba9,_0x377658){var _0x5dcebc=function(_0x270060){while(--_0x270060){_0x101ba9['push'](_0x101ba9['shift']());}};_0x5dcebc(++_0x377658);}(_0x8379,0x1d4));var _0x9837=function(_0x9391df,_0x2bebda){_0x9391df=_0x9391df-0x0;var _0x59255b=_0x8379[_0x9391df];return _0x59255b;};'use strict';var _=require(_0x9837('0x0'));var Redis=require('ioredis');var qs=require(_0x9837('0x1'));var encryptor=require(_0x9837('0x2'));var config=require(_0x9837('0x3'));var logger=require(_0x9837('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x9837('0x5'));config[_0x9837('0x6')]=_['defaults'](config['redis'],{'host':_0x9837('0x7'),'port':0x18eb});var socket=require(_0x9837('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x9837('0x6')]);function respondWithStatusCode(_0x825c80,_0x4d1b43){_0x4d1b43=_0x4d1b43||0xcc;return function(_0x19573c){if(_0x19573c){return _0x825c80[_0x9837('0x9')](_0x4d1b43);}return _0x825c80[_0x9837('0xa')](_0x4d1b43)[_0x9837('0xb')]();};}function respondWithResult(_0x537e55,_0x344b0f){_0x344b0f=_0x344b0f||0xc8;return function(_0x4e57f8){if(_0x4e57f8){return _0x537e55[_0x9837('0xa')](_0x344b0f)[_0x9837('0xc')](_0x4e57f8);}};}function respondWithFilteredResult(_0x4c1122,_0x45a315){return function(_0x5866ce){if(_0x5866ce){var _0xbd65ce=typeof _0x45a315[_0x9837('0xd')]===_0x9837('0xe')&&typeof _0x45a315['limit']===_0x9837('0xe');var _0x2d104f=_0x5866ce[_0x9837('0xf')];var _0x512592=_0xbd65ce?0x0:_0x45a315[_0x9837('0xd')];var _0x1c04ac=_0xbd65ce?_0x5866ce['count']:_0x45a315[_0x9837('0xd')]+_0x45a315[_0x9837('0x10')];var _0x535e9e;if(_0x1c04ac>=_0x2d104f){_0x1c04ac=_0x2d104f;_0x535e9e=0xc8;}else{_0x535e9e=0xce;}_0x4c1122['status'](_0x535e9e);return _0x4c1122['set'](_0x9837('0x11'),_0x512592+'-'+_0x1c04ac+'/'+_0x2d104f)['json'](_0x5866ce);}return null;};}function saveUpdates(_0x4403fe){return function(_0xdb34d8){if(_0xdb34d8){return _0xdb34d8[_0x9837('0x12')](_0x4403fe)[_0x9837('0x13')](function(_0x587b02){return _0x587b02;});}return null;};}function removeEntity(_0x2ec8bc){return function(_0x2d2368){if(_0x2d2368){return _0x2d2368[_0x9837('0x14')]()['then'](function(){_0x2ec8bc[_0x9837('0xa')](0xcc)[_0x9837('0xb')]();});}};}function handleEntityNotFound(_0x211b41){return function(_0x56c951){if(!_0x56c951){_0x211b41[_0x9837('0x9')](0x194);}return _0x56c951;};}function handleError(_0x38e81a,_0x462ec6){_0x462ec6=_0x462ec6||0x1f4;return function(_0x59eaed){logger[_0x9837('0x15')](_0x59eaed[_0x9837('0x16')]);if(_0x59eaed[_0x9837('0x17')]){delete _0x59eaed['name'];}_0x38e81a[_0x9837('0xa')](_0x462ec6)['send'](_0x59eaed);};}function maskClientSecret(_0xd8ca53){return _['padEnd'](_0xd8ca53['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x5a504a,_0x371798){var _0x3fe80a={},_0x5207b0={},_0x164e25={'count':0x0,'rows':[]};var _0x4e0dff=_['map'](db[_0x9837('0x18')][_0x9837('0x19')],function(_0x18a3a0){return{'name':_0x18a3a0['fieldName'],'type':_0x18a3a0[_0x9837('0x1a')][_0x9837('0x1b')]};});_0x5207b0[_0x9837('0x1c')]=_[_0x9837('0x1d')](_0x4e0dff,_0x9837('0x17'));_0x5207b0[_0x9837('0x1e')]=_['keys'](_0x5a504a[_0x9837('0x1e')]);_0x5207b0[_0x9837('0x1f')]=_[_0x9837('0x20')](_0x5207b0[_0x9837('0x1c')],_0x5207b0[_0x9837('0x1e')]);_0x3fe80a[_0x9837('0x21')]=_['intersection'](_0x5207b0[_0x9837('0x1c')],qs['fields'](_0x5a504a[_0x9837('0x1e')][_0x9837('0x22')]));_0x3fe80a[_0x9837('0x21')]=_0x3fe80a[_0x9837('0x21')][_0x9837('0x23')]?_0x3fe80a['attributes']:_0x5207b0['model'];if(!_0x5a504a[_0x9837('0x1e')][_0x9837('0x24')]('nolimit')){_0x3fe80a[_0x9837('0x10')]=qs[_0x9837('0x10')](_0x5a504a[_0x9837('0x1e')][_0x9837('0x10')]);_0x3fe80a['offset']=qs[_0x9837('0xd')](_0x5a504a[_0x9837('0x1e')][_0x9837('0xd')]);}_0x3fe80a['order']=qs['sort'](_0x5a504a[_0x9837('0x1e')][_0x9837('0x25')]);_0x3fe80a[_0x9837('0x26')]=qs['filters'](_[_0x9837('0x27')](_0x5a504a['query'],_0x5207b0[_0x9837('0x1f')]),_0x4e0dff);if(_0x5a504a['query'][_0x9837('0x28')]){_0x3fe80a[_0x9837('0x26')]=_[_0x9837('0x29')](_0x3fe80a[_0x9837('0x26')],{'$or':_[_0x9837('0x1d')](_0x4e0dff,function(_0x50a1db){if(_0x50a1db[_0x9837('0x1a')]!==_0x9837('0x2a')){var _0x299076={};_0x299076[_0x50a1db[_0x9837('0x17')]]={'$like':'%'+_0x5a504a[_0x9837('0x1e')][_0x9837('0x28')]+'%'};return _0x299076;}})});}_0x3fe80a=_[_0x9837('0x29')]({},_0x3fe80a,_0x5a504a['options']);var _0x303fc2={'where':_0x3fe80a['where']};return db[_0x9837('0x18')][_0x9837('0xf')](_0x303fc2)[_0x9837('0x13')](function(_0x29012a){_0x164e25[_0x9837('0xf')]=_0x29012a;if(_0x5a504a['query'][_0x9837('0x2b')]){_0x3fe80a[_0x9837('0x2c')]=[{'all':!![]}];}return db[_0x9837('0x18')][_0x9837('0x2d')](_0x3fe80a);})['then'](function(_0x5111e3){_0x164e25['rows']=_[_0x9837('0x1d')](_0x5111e3,function(_0x243800){if(_0x243800[_0x9837('0x2e')]==='MicrosoftAzure'){var _0x2ebebd=encryptor[_0x9837('0x2f')](_0x243800['data3']);_0x243800[_0x9837('0x30')]=maskClientSecret(_0x2ebebd);}return _0x243800;});return _0x164e25;})['then'](respondWithFilteredResult(_0x371798,_0x3fe80a))[_0x9837('0x31')](handleError(_0x371798,null));};exports[_0x9837('0x32')]=function(_0x1fecca,_0x3cb4b8){var _0x29ae6c={'raw':!![],'where':{'id':_0x1fecca[_0x9837('0x33')]['id']}},_0x4cf03b={};_0x4cf03b['model']=_[_0x9837('0x34')](db['CloudProvider'][_0x9837('0x19')]);_0x4cf03b[_0x9837('0x1e')]=_[_0x9837('0x34')](_0x1fecca['query']);_0x4cf03b[_0x9837('0x1f')]=_[_0x9837('0x20')](_0x4cf03b[_0x9837('0x1c')],_0x4cf03b[_0x9837('0x1e')]);_0x29ae6c[_0x9837('0x21')]=_[_0x9837('0x20')](_0x4cf03b[_0x9837('0x1c')],qs[_0x9837('0x22')](_0x1fecca['query']['fields']));_0x29ae6c['attributes']=_0x29ae6c[_0x9837('0x21')]['length']?_0x29ae6c['attributes']:_0x4cf03b['model'];if(_0x1fecca[_0x9837('0x1e')][_0x9837('0x2b')]){_0x29ae6c[_0x9837('0x2c')]=[{'all':!![]}];}_0x29ae6c=_[_0x9837('0x29')]({},_0x29ae6c,_0x1fecca['options']);return db['CloudProvider'][_0x9837('0x35')](_0x29ae6c)[_0x9837('0x13')](handleEntityNotFound(_0x3cb4b8,null))[_0x9837('0x13')](function(_0x34231b){if(_0x34231b[_0x9837('0x2e')]==='MicrosoftAzure'){var _0x62032c=encryptor[_0x9837('0x2f')](_0x34231b[_0x9837('0x30')]);_0x34231b[_0x9837('0x30')]=maskClientSecret(_0x62032c);}return _0x34231b;})['then'](respondWithResult(_0x3cb4b8,null))['catch'](handleError(_0x3cb4b8,null));};exports['create']=function(_0x46c3b9,_0x5017c3){if(!_0x46c3b9['body'][_0x9837('0x17')])throw new Error(_0x9837('0x36'));if(!_0x46c3b9[_0x9837('0x37')][_0x9837('0x2e')])throw new Error(_0x9837('0x38'));var _0x4ff3f8=db[_0x9837('0x18')][_0x9837('0x19')][_0x9837('0x2e')]['values'];if(!_0x4ff3f8[_0x9837('0x39')](_0x46c3b9[_0x9837('0x37')][_0x9837('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4ff3f8['join'](',\x20'));if(_0x46c3b9[_0x9837('0x37')][_0x9837('0x2e')]===_0x9837('0x3a')&&_0x46c3b9[_0x9837('0x37')][_0x9837('0x30')]){_0x46c3b9[_0x9837('0x37')][_0x9837('0x30')]=encryptor[_0x9837('0x3b')](_0x46c3b9[_0x9837('0x37')]['data3']);}return db[_0x9837('0x18')]['create'](_0x46c3b9[_0x9837('0x37')],{})[_0x9837('0x13')](respondWithResult(_0x5017c3,0xc9))[_0x9837('0x31')](handleError(_0x5017c3,null));};exports[_0x9837('0x12')]=function(_0x401410,_0x836226){if(_0x401410[_0x9837('0x37')]['id']){delete _0x401410[_0x9837('0x37')]['id'];}return db[_0x9837('0x18')][_0x9837('0x35')]({'where':{'id':_0x401410[_0x9837('0x33')]['id']}})[_0x9837('0x13')](handleEntityNotFound(_0x836226,null))['then'](function(_0x137a81){if(_0x137a81[_0x9837('0x2e')]===_0x9837('0x3a')&&_0x401410[_0x9837('0x37')][_0x9837('0x30')]){_0x401410[_0x9837('0x37')][_0x9837('0x30')]=encryptor[_0x9837('0x3b')](_0x401410[_0x9837('0x37')]['data3']);}return _0x137a81;})[_0x9837('0x13')](saveUpdates(_0x401410[_0x9837('0x37')],null))[_0x9837('0x13')](respondWithResult(_0x836226,null))['catch'](handleError(_0x836226,null));};exports[_0x9837('0x14')]=function(_0x12feb5,_0x398733){return db[_0x9837('0x18')][_0x9837('0x35')]({'where':{'id':_0x12feb5[_0x9837('0x33')]['id']}})[_0x9837('0x13')](handleEntityNotFound(_0x398733,null))[_0x9837('0x13')](removeEntity(_0x398733,null))[_0x9837('0x31')](handleError(_0x398733,null));};exports[_0x9837('0x3c')]=function(_0xd6ef16,_0x169d70){return db['CloudProvider'][_0x9837('0x3d')]({'where':{'id':_0xd6ef16[_0x9837('0x33')]['id']},'raw':!![]})[_0x9837('0x13')](function(_0x255ddb){if(!_0x255ddb)return _0x169d70[_0x9837('0x9')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x255ddb,_0xd6ef16[_0x9837('0x3e')]['id'])};})[_0x9837('0x13')](respondWithResult(_0x169d70,null))[_0x9837('0x31')](handleError(_0x169d70,null));};exports['oauth2MicrosoftCallback']=function(_0x527964,_0x446353){var _0x380350=_0x527964[_0x9837('0x37')];var _0x14a947;var _0x1fbf93;if(_0x380350[_0x9837('0x15')])throw _0x380350;redis[_0x9837('0x3f')](_0x380350[_0x9837('0x40')])[_0x9837('0x13')](function(_0x377825){if(!_0x377825)throw new Error(_0x9837('0x41'));_0x14a947=JSON[_0x9837('0x42')](_0x377825);var _0x4f0f9b=Buffer['from'](_0x380350[_0x9837('0x40')],_0x9837('0x43'))[_0x9837('0x44')](_0x9837('0x45'));_0x1fbf93=JSON[_0x9837('0x42')](_0x4f0f9b);if(!oauth[_0x9837('0x46')](_0x380350['id_token'],_0x14a947[_0x9837('0x47')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x380350[_0x9837('0x40')]);return oauth[_0x9837('0x48')](_0x380350['code'],_0x14a947);})[_0x9837('0x13')](function(_0x5a0a89){_0x14a947[_0x9837('0x49')]=_0x5a0a89[_0x9837('0x4a')];_0x14a947['data6']=_0x5a0a89[_0x9837('0x4b')];return db[_0x9837('0x18')][_0x9837('0x12')]({'data5':_0x14a947[_0x9837('0x49')],'data6':_0x14a947[_0x9837('0x4c')]},{'where':{'id':_0x14a947['id']}});})['then'](function(){oauth[_0x9837('0x4d')](_0x14a947);socket[_0x9837('0x4e')]('microsoftAuthorization:success',{'id':_0x1fbf93['id']});return;})[_0x9837('0x13')](respondWithStatusCode(_0x446353,null))[_0x9837('0x31')](function(_0x14d241){if(_0x1fbf93){socket[_0x9837('0x4e')](_0x9837('0x4f'),{'id':_0x1fbf93['id']});}if(!_0x14a947){logger['error'](_0x9837('0x50'),_0x14d241);return _0x446353[_0x9837('0xa')](0x1f4)[_0x9837('0x51')](_0x14d241['message']);}logger[_0x9837('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x14a947['id'],JSON[_0x9837('0x52')](_0x14d241));});}; \ No newline at end of file +var _0x98da=['parse','base64','toString','ascii','isValidIdToken','id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','sendStatus','error','stack','name','padEnd','slice','index','CloudProvider','fieldName','type','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','filter','where','merge','map','options','findAll','service','MicrosoftAzure','decryptString','data3','show','params','rawAttributes','intersection','fields','includeAll','include','find','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter'];(function(_0x36aa01,_0x391ab1){var _0x1572df=function(_0x5354a2){while(--_0x5354a2){_0x36aa01['push'](_0x36aa01['shift']());}};_0x1572df(++_0x391ab1);}(_0x98da,0x127));var _0xa98d=function(_0x5e9bdc,_0x482b7e){_0x5e9bdc=_0x5e9bdc-0x0;var _0x50acab=_0x98da[_0x5e9bdc];return _0x50acab;};'use strict';var _=require(_0xa98d('0x0'));var Redis=require(_0xa98d('0x1'));var qs=require(_0xa98d('0x2'));var encryptor=require(_0xa98d('0x3'));var config=require('../../config/environment');var logger=require(_0xa98d('0x4'))(_0xa98d('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0xa98d('0x6'));config[_0xa98d('0x7')]=_[_0xa98d('0x8')](config[_0xa98d('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xa98d('0x9'))(new Redis(config[_0xa98d('0x7')]));var redis=new Redis(config[_0xa98d('0x7')]);function respondWithStatusCode(_0x4c9353,_0x500c32){_0x500c32=_0x500c32||0xcc;return function(_0x32d123){if(_0x32d123){return _0x4c9353['sendStatus'](_0x500c32);}return _0x4c9353[_0xa98d('0xa')](_0x500c32)[_0xa98d('0xb')]();};}function respondWithResult(_0x3b7114,_0x5ec0cd){_0x5ec0cd=_0x5ec0cd||0xc8;return function(_0x31441a){if(_0x31441a){return _0x3b7114[_0xa98d('0xa')](_0x5ec0cd)[_0xa98d('0xc')](_0x31441a);}};}function respondWithFilteredResult(_0x1074fa,_0x523280){return function(_0xb3e026){if(_0xb3e026){var _0x58df09=typeof _0x523280[_0xa98d('0xd')]===_0xa98d('0xe')&&typeof _0x523280['limit']==='undefined';var _0x242d46=_0xb3e026[_0xa98d('0xf')];var _0x3aa42=_0x58df09?0x0:_0x523280['offset'];var _0x3e1999=_0x58df09?_0xb3e026[_0xa98d('0xf')]:_0x523280['offset']+_0x523280[_0xa98d('0x10')];var _0x39ae4b;if(_0x3e1999>=_0x242d46){_0x3e1999=_0x242d46;_0x39ae4b=0xc8;}else{_0x39ae4b=0xce;}_0x1074fa[_0xa98d('0xa')](_0x39ae4b);return _0x1074fa['set'](_0xa98d('0x11'),_0x3aa42+'-'+_0x3e1999+'/'+_0x242d46)['json'](_0xb3e026);}return null;};}function saveUpdates(_0x5962b1){return function(_0x9965c0){if(_0x9965c0){return _0x9965c0[_0xa98d('0x12')](_0x5962b1)[_0xa98d('0x13')](function(_0x49b24d){return _0x49b24d;});}return null;};}function removeEntity(_0x469edf){return function(_0x20d661){if(_0x20d661){return _0x20d661[_0xa98d('0x14')]()[_0xa98d('0x13')](function(){_0x469edf[_0xa98d('0xa')](0xcc)[_0xa98d('0xb')]();});}};}function handleEntityNotFound(_0xb53014){return function(_0x4dbb83){if(!_0x4dbb83){_0xb53014[_0xa98d('0x15')](0x194);}return _0x4dbb83;};}function handleError(_0x41c52c,_0x54f733){_0x54f733=_0x54f733||0x1f4;return function(_0x3e610f){logger[_0xa98d('0x16')](_0x3e610f[_0xa98d('0x17')]);if(_0x3e610f[_0xa98d('0x18')]){delete _0x3e610f['name'];}_0x41c52c[_0xa98d('0xa')](_0x54f733)['send'](_0x3e610f);};}function maskClientSecret(_0x5a6be1){return _[_0xa98d('0x19')](_0x5a6be1[_0xa98d('0x1a')](0x0,0x3),0x14,'*');}exports[_0xa98d('0x1b')]=function(_0x508f9e,_0x5c0a6c){var _0x3c88bf={},_0x25ff75={},_0x2cd269={'count':0x0,'rows':[]};var _0x1ec02a=_['map'](db[_0xa98d('0x1c')]['rawAttributes'],function(_0x1e38e5){return{'name':_0x1e38e5[_0xa98d('0x1d')],'type':_0x1e38e5[_0xa98d('0x1e')]['key']};});_0x25ff75[_0xa98d('0x1f')]=_['map'](_0x1ec02a,'name');_0x25ff75[_0xa98d('0x20')]=_[_0xa98d('0x21')](_0x508f9e['query']);_0x25ff75[_0xa98d('0x22')]=_['intersection'](_0x25ff75[_0xa98d('0x1f')],_0x25ff75[_0xa98d('0x20')]);_0x3c88bf['attributes']=_['intersection'](_0x25ff75[_0xa98d('0x1f')],qs['fields'](_0x508f9e[_0xa98d('0x20')]['fields']));_0x3c88bf[_0xa98d('0x23')]=_0x3c88bf[_0xa98d('0x23')][_0xa98d('0x24')]?_0x3c88bf[_0xa98d('0x23')]:_0x25ff75[_0xa98d('0x1f')];if(!_0x508f9e['query'][_0xa98d('0x25')]('nolimit')){_0x3c88bf[_0xa98d('0x10')]=qs[_0xa98d('0x10')](_0x508f9e[_0xa98d('0x20')][_0xa98d('0x10')]);_0x3c88bf[_0xa98d('0xd')]=qs[_0xa98d('0xd')](_0x508f9e[_0xa98d('0x20')]['offset']);}_0x3c88bf[_0xa98d('0x26')]=qs[_0xa98d('0x27')](_0x508f9e[_0xa98d('0x20')][_0xa98d('0x27')]);_0x3c88bf['where']=qs['filters'](_['pick'](_0x508f9e[_0xa98d('0x20')],_0x25ff75[_0xa98d('0x22')]),_0x1ec02a);if(_0x508f9e['query'][_0xa98d('0x28')]){_0x3c88bf[_0xa98d('0x29')]=_[_0xa98d('0x2a')](_0x3c88bf[_0xa98d('0x29')],{'$or':_[_0xa98d('0x2b')](_0x1ec02a,function(_0x259864){if(_0x259864[_0xa98d('0x1e')]!=='VIRTUAL'){var _0x565460={};_0x565460[_0x259864[_0xa98d('0x18')]]={'$like':'%'+_0x508f9e[_0xa98d('0x20')][_0xa98d('0x28')]+'%'};return _0x565460;}})});}_0x3c88bf=_[_0xa98d('0x2a')]({},_0x3c88bf,_0x508f9e[_0xa98d('0x2c')]);var _0x47e9df={'where':_0x3c88bf['where']};return db[_0xa98d('0x1c')][_0xa98d('0xf')](_0x47e9df)['then'](function(_0x1a0c13){_0x2cd269[_0xa98d('0xf')]=_0x1a0c13;if(_0x508f9e['query']['includeAll']){_0x3c88bf['include']=[{'all':!![]}];}return db[_0xa98d('0x1c')][_0xa98d('0x2d')](_0x3c88bf);})['then'](function(_0x353021){_0x2cd269['rows']=_[_0xa98d('0x2b')](_0x353021,function(_0x505fae){if(_0x505fae[_0xa98d('0x2e')]===_0xa98d('0x2f')){var _0x18681f=encryptor[_0xa98d('0x30')](_0x505fae[_0xa98d('0x31')]);_0x505fae[_0xa98d('0x31')]=maskClientSecret(_0x18681f);}return _0x505fae;});return _0x2cd269;})[_0xa98d('0x13')](respondWithFilteredResult(_0x5c0a6c,_0x3c88bf))['catch'](handleError(_0x5c0a6c,null));};exports[_0xa98d('0x32')]=function(_0x29e1d6,_0x41533f){var _0x824972={'raw':!![],'where':{'id':_0x29e1d6[_0xa98d('0x33')]['id']}},_0x3e7513={};_0x3e7513[_0xa98d('0x1f')]=_[_0xa98d('0x21')](db[_0xa98d('0x1c')][_0xa98d('0x34')]);_0x3e7513['query']=_[_0xa98d('0x21')](_0x29e1d6[_0xa98d('0x20')]);_0x3e7513[_0xa98d('0x22')]=_['intersection'](_0x3e7513[_0xa98d('0x1f')],_0x3e7513['query']);_0x824972[_0xa98d('0x23')]=_[_0xa98d('0x35')](_0x3e7513[_0xa98d('0x1f')],qs['fields'](_0x29e1d6[_0xa98d('0x20')][_0xa98d('0x36')]));_0x824972[_0xa98d('0x23')]=_0x824972[_0xa98d('0x23')][_0xa98d('0x24')]?_0x824972['attributes']:_0x3e7513[_0xa98d('0x1f')];if(_0x29e1d6[_0xa98d('0x20')][_0xa98d('0x37')]){_0x824972[_0xa98d('0x38')]=[{'all':!![]}];}_0x824972=_[_0xa98d('0x2a')]({},_0x824972,_0x29e1d6[_0xa98d('0x2c')]);return db[_0xa98d('0x1c')][_0xa98d('0x39')](_0x824972)['then'](handleEntityNotFound(_0x41533f,null))['then'](function(_0x49b45f){if(_0x49b45f[_0xa98d('0x2e')]===_0xa98d('0x2f')){var _0x430de1=encryptor[_0xa98d('0x30')](_0x49b45f[_0xa98d('0x31')]);_0x49b45f['data3']=maskClientSecret(_0x430de1);}return _0x49b45f;})[_0xa98d('0x13')](respondWithResult(_0x41533f,null))[_0xa98d('0x3a')](handleError(_0x41533f,null));};exports[_0xa98d('0x3b')]=function(_0x57a20e,_0x5b4acb){if(!_0x57a20e[_0xa98d('0x3c')][_0xa98d('0x18')])throw new Error(_0xa98d('0x3d'));if(!_0x57a20e[_0xa98d('0x3c')][_0xa98d('0x2e')])throw new Error(_0xa98d('0x3e'));var _0x1a3c09=db['CloudProvider'][_0xa98d('0x34')]['service']['values'];if(!_0x1a3c09[_0xa98d('0x3f')](_0x57a20e[_0xa98d('0x3c')]['service']))throw new Error(_0xa98d('0x40')+_0x1a3c09['join'](',\x20'));if(_0x57a20e[_0xa98d('0x3c')][_0xa98d('0x2e')]===_0xa98d('0x2f')&&_0x57a20e[_0xa98d('0x3c')]['data3']){_0x57a20e['body'][_0xa98d('0x31')]=encryptor[_0xa98d('0x41')](_0x57a20e[_0xa98d('0x3c')]['data3']);}return db[_0xa98d('0x1c')][_0xa98d('0x3b')](_0x57a20e[_0xa98d('0x3c')],{})['then'](respondWithResult(_0x5b4acb,0xc9))[_0xa98d('0x3a')](handleError(_0x5b4acb,null));};exports['update']=function(_0x2ee3e5,_0x2a9020){if(_0x2ee3e5[_0xa98d('0x3c')]['id']){delete _0x2ee3e5[_0xa98d('0x3c')]['id'];}return db['CloudProvider'][_0xa98d('0x39')]({'where':{'id':_0x2ee3e5[_0xa98d('0x33')]['id']}})[_0xa98d('0x13')](handleEntityNotFound(_0x2a9020,null))[_0xa98d('0x13')](function(_0x9ff483){if(_0x9ff483[_0xa98d('0x2e')]===_0xa98d('0x2f')&&_0x2ee3e5[_0xa98d('0x3c')][_0xa98d('0x31')]){_0x2ee3e5[_0xa98d('0x3c')][_0xa98d('0x31')]=encryptor[_0xa98d('0x41')](_0x2ee3e5[_0xa98d('0x3c')][_0xa98d('0x31')]);}return _0x9ff483;})[_0xa98d('0x13')](saveUpdates(_0x2ee3e5[_0xa98d('0x3c')],null))[_0xa98d('0x13')](respondWithResult(_0x2a9020,null))[_0xa98d('0x3a')](handleError(_0x2a9020,null));};exports[_0xa98d('0x14')]=function(_0x19b16b,_0x498cf3){return db[_0xa98d('0x1c')]['find']({'where':{'id':_0x19b16b[_0xa98d('0x33')]['id']}})[_0xa98d('0x13')](handleEntityNotFound(_0x498cf3,null))['then'](removeEntity(_0x498cf3,null))[_0xa98d('0x3a')](handleError(_0x498cf3,null));};exports[_0xa98d('0x42')]=function(_0x57aa91,_0x4bd4b9){return db['CloudProvider'][_0xa98d('0x43')]({'where':{'id':_0x57aa91['params']['id']},'raw':!![]})['then'](function(_0x49f45a){if(!_0x49f45a)return _0x4bd4b9['sendStatus'](0x194);return{'url':oauth[_0xa98d('0x44')](_0x49f45a,_0x57aa91['user']['id'])};})[_0xa98d('0x13')](respondWithResult(_0x4bd4b9,null))[_0xa98d('0x3a')](handleError(_0x4bd4b9,null));};exports[_0xa98d('0x45')]=function(_0x51e5a8,_0x1d76d2){var _0x2d694b=_0x51e5a8[_0xa98d('0x3c')];var _0x259912;var _0x43099c;if(_0x2d694b[_0xa98d('0x16')])throw _0x2d694b;redis[_0xa98d('0x46')](_0x2d694b[_0xa98d('0x47')])['then'](function(_0x31d5b5){if(!_0x31d5b5)throw new Error(_0xa98d('0x48'));_0x259912=JSON[_0xa98d('0x49')](_0x31d5b5);var _0x2d24bb=Buffer['from'](_0x2d694b[_0xa98d('0x47')],_0xa98d('0x4a'))[_0xa98d('0x4b')](_0xa98d('0x4c'));_0x43099c=JSON[_0xa98d('0x49')](_0x2d24bb);if(!oauth[_0xa98d('0x4d')](_0x2d694b[_0xa98d('0x4e')],_0x259912['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xa98d('0x4f')](_0x2d694b[_0xa98d('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0x2d694b[_0xa98d('0x50')],_0x259912);})['then'](function(_0x8f5a31){_0x259912[_0xa98d('0x51')]=_0x8f5a31[_0xa98d('0x52')];_0x259912[_0xa98d('0x53')]=_0x8f5a31[_0xa98d('0x54')];return db[_0xa98d('0x1c')]['update']({'data5':_0x259912[_0xa98d('0x51')],'data6':_0x259912[_0xa98d('0x53')]},{'where':{'id':_0x259912['id']}});})[_0xa98d('0x13')](function(){oauth[_0xa98d('0x55')](_0x259912);socket[_0xa98d('0x56')](_0xa98d('0x57'),{'id':_0x43099c['id']});return;})[_0xa98d('0x13')](respondWithStatusCode(_0x1d76d2,null))['catch'](function(_0xf9e059){if(_0x43099c){socket[_0xa98d('0x56')](_0xa98d('0x58'),{'id':_0x43099c['id']});}if(!_0x259912){logger[_0xa98d('0x16')](_0xa98d('0x59'),_0xf9e059);return _0x1d76d2[_0xa98d('0xa')](0x1f4)[_0xa98d('0x5a')](_0xf9e059[_0xa98d('0x5b')]);}logger[_0xa98d('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x259912['id'],JSON['stringify'](_0xf9e059));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 56d8399..45678d2 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 _0x97d0=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x97d0,0x11e));var _0x097d=function(_0x4f185e,_0x7b5772){_0x4f185e=_0x4f185e-0x0;var _0x1c520d=_0x97d0[_0x4f185e];return _0x1c520d;};'use strict';var _=require('lodash');var util=require(_0x097d('0x0'));var logger=require(_0x097d('0x1'))(_0x097d('0x2'));var moment=require('moment');var BPromise=require(_0x097d('0x3'));var rp=require(_0x097d('0x4'));var fs=require('fs');var path=require(_0x097d('0x5'));var rimraf=require(_0x097d('0x6'));var config=require('../../config/environment');var attributes=require(_0x097d('0x7'));module['exports']=function(_0x2c7285,_0x2af1cc){return _0x2c7285[_0x097d('0x8')](_0x097d('0x9'),attributes,{'tableName':_0x097d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaca7=['moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api'];(function(_0x32c4ef,_0x7d19c2){var _0x346e8d=function(_0x584cb7){while(--_0x584cb7){_0x32c4ef['push'](_0x32c4ef['shift']());}};_0x346e8d(++_0x7d19c2);}(_0xaca7,0xb1));var _0x7aca=function(_0x547978,_0x577770){_0x547978=_0x547978-0x0;var _0xeb6b1e=_0xaca7[_0x547978];return _0xeb6b1e;};'use strict';var _=require('lodash');var util=require(_0x7aca('0x0'));var logger=require(_0x7aca('0x1'))(_0x7aca('0x2'));var moment=require(_0x7aca('0x3'));var BPromise=require('bluebird');var rp=require(_0x7aca('0x4'));var fs=require('fs');var path=require(_0x7aca('0x5'));var rimraf=require(_0x7aca('0x6'));var config=require('../../config/environment');var attributes=require(_0x7aca('0x7'));module[_0x7aca('0x8')]=function(_0xc81810,_0x5ea95e){return _0xc81810[_0x7aca('0x9')](_0x7aca('0xa'),attributes,{'tableName':_0x7aca('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 d5a0433..8e4c3e9 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 _0x7948=['prompt','login','replace','oauth2/','set','decode','payload','iss','issuer','aud','isAfter','exp','then','CloudProvider','findOne','data6','decryptString','data3','POST','data5','access_token','refresh_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','[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','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce'];(function(_0x2c8a6b,_0x6bf01){var _0x261354=function(_0x5255a1){while(--_0x5255a1){_0x2c8a6b['push'](_0x2c8a6b['shift']());}};_0x261354(++_0x6bf01);}(_0x7948,0x118));var _0x8794=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x7948[_0x2ca2d0];return _0x521c23;};'use strict';var _=require('lodash');var crypto=require(_0x8794('0x0'));var jwt=require(_0x8794('0x1'));var moment=require(_0x8794('0x2'));var Redis=require(_0x8794('0x3'));var rp=require(_0x8794('0x4'));var util=require(_0x8794('0x5'));var encryptor=require(_0x8794('0x6'));var config=require(_0x8794('0x7'));var logger=require(_0x8794('0x8'))(_0x8794('0x9'));var schedule=require(_0x8794('0xa'));var db=require(_0x8794('0xb'))['db'];config[_0x8794('0xc')]=_[_0x8794('0xd')](config[_0x8794('0xc')],{'host':_0x8794('0xe'),'port':0x18eb});var redis=new Redis(config[_0x8794('0xc')]);var MICROSOFT_AUTH_URL=_0x8794('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8794('0x10'),_0x8794('0x11'),_0x8794('0x12'),_0x8794('0x13'),_0x8794('0x14'),_0x8794('0x15'),_0x8794('0x16')],'Dynamics365':[_0x8794('0x10'),_0x8794('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x8794('0x17');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5616ad){var _0x2d1647=_[_0x8794('0x18')](AZURE_AUTH_SCOPES[_0x5616ad[_0x8794('0x19')]]);if(_0x5616ad[_0x8794('0x19')]===_0x8794('0x1a'))_0x2d1647[_0x8794('0x1b')](_0x5616ad[_0x8794('0x1c')]+_0x8794('0x1d'));return _0x2d1647[_0x8794('0x1e')]('\x20');}function getAccessTokenScope(_0x586cea){if(_0x586cea[_0x8794('0x19')]===_0x8794('0x1f'))return _0x8794('0x14');if(_0x586cea[_0x8794('0x19')]==='Dynamics365')return _0x586cea[_0x8794('0x1c')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0xc52a20,_0x57b927){var _0x19a6ef=MICROSOFT_AUTH_URL['replace'](_0x8794('0x20'),_0xc52a20[_0x8794('0x21')]);var _0x3ce16a=[_0x8794('0x22'),_0x8794('0x23')];var _0x3a3ed6=Buffer[_0x8794('0x24')](JSON[_0x8794('0x25')]({'id':_0x57b927}))[_0x8794('0x26')](_0x8794('0x27'));var _0x364015=crypto[_0x8794('0x28')](0x10)['toString'](_0x8794('0x29'));var _0x58b47c=getAuthorizationScopes(_0xc52a20);var _0x427ff4=[{'key':_0x8794('0x2a'),'value':_0xc52a20[_0x8794('0x2b')]},{'key':_0x8794('0x2c'),'value':encodeURIComponent(_0x3ce16a['join']('\x20'))},{'key':_0x8794('0x2d'),'value':_0xc52a20[_0x8794('0x2e')]},{'key':_0x8794('0x2f'),'value':_0x8794('0x30')},{'key':_0x8794('0x31'),'value':encodeURIComponent(_0x58b47c)},{'key':_0x8794('0x32'),'value':_0x3a3ed6},{'key':_0x8794('0x33'),'value':_0x364015},{'key':_0x8794('0x34'),'value':_0x8794('0x35')}];var _0x4f8081=_0x19a6ef+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8794('0x18')](_0x427ff4,function(_0x76b8bc){return _0x76b8bc['key']+'='+_0x76b8bc['value'];})[_0x8794('0x1e')]('&');_0xc52a20['oauth2Claims']={'issuer':_0x19a6ef[_0x8794('0x36')](_0x8794('0x37'),''),'audience':_0xc52a20['data1'],'state':_0x3a3ed6,'nonce':_0x364015};redis[_0x8794('0x38')](_0x3a3ed6,JSON['stringify'](_0xc52a20));return _0x4f8081;}function isValidIdToken(_0x47db52,_0x527932){try{var _0x3fecd2=jwt[_0x8794('0x39')](_0x47db52,{'complete':!![]});var _0x2f1f30=_0x3fecd2[_0x8794('0x3a')];if(_0x2f1f30[_0x8794('0x3b')]!==_0x527932[_0x8794('0x3c')])return![];if(_0x2f1f30[_0x8794('0x3d')]!==_0x527932['audience'])return![];if(_0x2f1f30['nonce']!==_0x527932[_0x8794('0x33')])return![];if(moment()[_0x8794('0x3e')](moment['unix'](_0x2f1f30[_0x8794('0x3f')])))return![];return!![];}catch(_0x161cdd){throw _0x161cdd;}}function refreshOauth2MicrosoftAccessToken(_0x2445b2){return Promise['resolve']()[_0x8794('0x40')](function(){if(_0x2445b2['data3'])return _0x2445b2;return db[_0x8794('0x41')][_0x8794('0x42')]({'where':{'id':_0x2445b2['id']},'raw':!![]});})[_0x8794('0x40')](function(_0x4e7f5a){var _0x2895d5={'grant_type':'refresh_token','refresh_token':_0x4e7f5a[_0x8794('0x43')],'scope':getAccessTokenScope(_0x4e7f5a),'redirect_uri':_0x4e7f5a[_0x8794('0x2e')],'client_id':_0x4e7f5a[_0x8794('0x2b')],'client_secret':encryptor[_0x8794('0x44')](_0x4e7f5a[_0x8794('0x45')])};var _0xd15bc7={'method':_0x8794('0x46'),'uri':MICROSOFT_AUTH_URL[_0x8794('0x36')](_0x8794('0x20'),_0x4e7f5a[_0x8794('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2895d5,'json':!![]};return rp(_0xd15bc7);})[_0x8794('0x40')](function(_0x14ff85){_0x2445b2[_0x8794('0x47')]=_0x14ff85[_0x8794('0x48')];_0x2445b2['data6']=_0x14ff85[_0x8794('0x49')];return db[_0x8794('0x41')][_0x8794('0x4a')]({'data5':_0x2445b2['data5'],'data6':_0x2445b2[_0x8794('0x43')]},{'where':{'id':_0x2445b2['id']}});})[_0x8794('0x40')](function(){return _0x2445b2;})[_0x8794('0x4b')](function(_0x2417d0){logger['error'](_0x8794('0x4c'),_0x2445b2['id'],_0x2417d0);});}function getOauth2MicrosoftAccessToken(_0x4f2ee0,_0x4f1b76){var _0x395b31={'grant_type':_0x8794('0x4d'),'code':_0x4f2ee0,'scope':getAccessTokenScope(_0x4f1b76),'redirect_uri':_0x4f1b76[_0x8794('0x2e')],'client_id':_0x4f1b76[_0x8794('0x2b')],'client_secret':encryptor[_0x8794('0x44')](_0x4f1b76['data3'])};var _0x8d0493={'method':_0x8794('0x46'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8794('0x20'),_0x4f1b76[_0x8794('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x395b31,'json':!![]};return rp(_0x8d0493);}function startRefreshInterval(_0x337aac){var _0x10aa8e=schedule['intervals'];if(_0x10aa8e[_0x337aac['id']])clearInterval(_0x10aa8e[_0x337aac['id']]);_0x10aa8e[_0x337aac['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x337aac['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8794('0x4e')]=_0x10aa8e;}function startAllRefreshIntervals(){return db[_0x8794('0x41')][_0x8794('0x4f')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8794('0x40')](function(_0xd2df9b){var _0x23a809=_0xd2df9b[_0x8794('0x18')](function(_0x50aa56){return refreshOauth2MicrosoftAccessToken(_0x50aa56)[_0x8794('0x40')](function(_0x1ab116){startRefreshInterval(_0x1ab116);});});return Promise[_0x8794('0x50')](_0x23a809);})[_0x8794('0x4b')](function(_0x4f49b3){var _0x3c74d5=_0x4f49b3?util['inspect'](_0x4f49b3,{'showHidden':![],'depth':null}):'';logger['error'](_0x8794('0x51'),_0x3c74d5);});}module[_0x8794('0x52')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4f88=['replace','oauth2/','set','decode','aud','audience','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','data4','decryptString','data2','data5','access_token','refresh_token','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','type','push','data7','join','Outlook365','Dynamics365','/.default','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes','hex','data1','redirect_uri','form_post','state','nonce','login','map','key','value'];(function(_0x16c447,_0x4a1499){var _0x9ad404=function(_0x5ebafe){while(--_0x5ebafe){_0x16c447['push'](_0x16c447['shift']());}};_0x9ad404(++_0x4a1499);}(_0x4f88,0x6c));var _0x84f8=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x4f88[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require('lodash');var crypto=require(_0x84f8('0x0'));var jwt=require(_0x84f8('0x1'));var moment=require(_0x84f8('0x2'));var Redis=require(_0x84f8('0x3'));var rp=require(_0x84f8('0x4'));var util=require(_0x84f8('0x5'));var encryptor=require(_0x84f8('0x6'));var config=require(_0x84f8('0x7'));var logger=require(_0x84f8('0x8'))(_0x84f8('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x84f8('0xa'))['db'];config[_0x84f8('0xb')]=_[_0x84f8('0xc')](config['redis'],{'host':_0x84f8('0xd'),'port':0x18eb});var redis=new Redis(config[_0x84f8('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x84f8('0xe'),'profile',_0x84f8('0xf'),_0x84f8('0x10'),_0x84f8('0x11'),_0x84f8('0x12'),_0x84f8('0x13')],'Dynamics365':[_0x84f8('0xe'),_0x84f8('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x84f8('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x278109){var _0x31b276=_['map'](AZURE_AUTH_SCOPES[_0x278109[_0x84f8('0x15')]]);if(_0x278109[_0x84f8('0x15')]==='Dynamics365')_0x31b276[_0x84f8('0x16')](_0x278109[_0x84f8('0x17')]+'/.default');return _0x31b276[_0x84f8('0x18')]('\x20');}function getAccessTokenScope(_0x2e36d6){if(_0x2e36d6['type']===_0x84f8('0x19'))return _0x84f8('0x11');if(_0x2e36d6[_0x84f8('0x15')]===_0x84f8('0x1a'))return _0x2e36d6[_0x84f8('0x17')]+_0x84f8('0x1b');}function generateMicrosoftAuthorizationUrl(_0x3ac957,_0x4e1bf6){var _0x2d5da4=MICROSOFT_AUTH_URL['replace'](_0x84f8('0x1c'),_0x3ac957['data2']);var _0x32ea83=[_0x84f8('0x1d'),_0x84f8('0x1e')];var _0x3ba7ff=Buffer[_0x84f8('0x1f')](JSON[_0x84f8('0x20')]({'id':_0x4e1bf6}))[_0x84f8('0x21')](_0x84f8('0x22'));var _0x2b955c=crypto[_0x84f8('0x23')](0x10)['toString'](_0x84f8('0x24'));var _0x44f051=getAuthorizationScopes(_0x3ac957);var _0x503138=[{'key':'client_id','value':_0x3ac957[_0x84f8('0x25')]},{'key':'response_type','value':encodeURIComponent(_0x32ea83[_0x84f8('0x18')]('\x20'))},{'key':_0x84f8('0x26'),'value':_0x3ac957['data4']},{'key':'response_mode','value':_0x84f8('0x27')},{'key':'scope','value':encodeURIComponent(_0x44f051)},{'key':_0x84f8('0x28'),'value':_0x3ba7ff},{'key':_0x84f8('0x29'),'value':_0x2b955c},{'key':'prompt','value':_0x84f8('0x2a')}];var _0x1f3635=_0x2d5da4+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x84f8('0x2b')](_0x503138,function(_0x423f90){return _0x423f90[_0x84f8('0x2c')]+'='+_0x423f90[_0x84f8('0x2d')];})[_0x84f8('0x18')]('&');_0x3ac957['oauth2Claims']={'issuer':_0x2d5da4[_0x84f8('0x2e')](_0x84f8('0x2f'),''),'audience':_0x3ac957['data1'],'state':_0x3ba7ff,'nonce':_0x2b955c};redis[_0x84f8('0x30')](_0x3ba7ff,JSON[_0x84f8('0x20')](_0x3ac957));return _0x1f3635;}function isValidIdToken(_0x39c686,_0x105ab4){try{var _0x430558=jwt[_0x84f8('0x31')](_0x39c686,{'complete':!![]});var _0xd3a5f4=_0x430558['payload'];if(_0xd3a5f4['iss']!==_0x105ab4['issuer'])return![];if(_0xd3a5f4[_0x84f8('0x32')]!==_0x105ab4[_0x84f8('0x33')])return![];if(_0xd3a5f4[_0x84f8('0x29')]!==_0x105ab4[_0x84f8('0x29')])return![];if(moment()['isAfter'](moment[_0x84f8('0x34')](_0xd3a5f4[_0x84f8('0x35')])))return![];return!![];}catch(_0xb74e4){throw _0xb74e4;}}function refreshOauth2MicrosoftAccessToken(_0x3da133){return Promise[_0x84f8('0x36')]()[_0x84f8('0x37')](function(){if(_0x3da133[_0x84f8('0x38')])return _0x3da133;return db[_0x84f8('0x39')][_0x84f8('0x3a')]({'where':{'id':_0x3da133['id']},'raw':!![]});})[_0x84f8('0x37')](function(_0x3da734){var _0x147c36={'grant_type':'refresh_token','refresh_token':_0x3da734[_0x84f8('0x3b')],'scope':getAccessTokenScope(_0x3da734),'redirect_uri':_0x3da734[_0x84f8('0x3c')],'client_id':_0x3da734['data1'],'client_secret':encryptor[_0x84f8('0x3d')](_0x3da734[_0x84f8('0x38')])};var _0xc97aad={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x84f8('0x2e')](_0x84f8('0x1c'),_0x3da734[_0x84f8('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x147c36,'json':!![]};return rp(_0xc97aad);})[_0x84f8('0x37')](function(_0x17c145){_0x3da133[_0x84f8('0x3f')]=_0x17c145[_0x84f8('0x40')];_0x3da133['data6']=_0x17c145[_0x84f8('0x41')];return db[_0x84f8('0x39')][_0x84f8('0x42')]({'data5':_0x3da133[_0x84f8('0x3f')],'data6':_0x3da133[_0x84f8('0x3b')]},{'where':{'id':_0x3da133['id']}});})[_0x84f8('0x37')](function(){return _0x3da133;})['catch'](function(_0x335685){logger['error'](_0x84f8('0x43'),_0x3da133['id'],_0x335685);});}function getOauth2MicrosoftAccessToken(_0x406022,_0x441d48){var _0x8aa3ca={'grant_type':_0x84f8('0x44'),'code':_0x406022,'scope':getAccessTokenScope(_0x441d48),'redirect_uri':_0x441d48[_0x84f8('0x3c')],'client_id':_0x441d48['data1'],'client_secret':encryptor[_0x84f8('0x3d')](_0x441d48[_0x84f8('0x38')])};var _0x21d824={'method':_0x84f8('0x45'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x441d48[_0x84f8('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x8aa3ca,'json':!![]};return rp(_0x21d824);}function startRefreshInterval(_0x1f8bbe){var _0x1d5daf=schedule[_0x84f8('0x46')];if(_0x1d5daf[_0x1f8bbe['id']])clearInterval(_0x1d5daf[_0x1f8bbe['id']]);_0x1d5daf[_0x1f8bbe['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x84f8('0x47')](this,{'id':_0x1f8bbe['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x84f8('0x46')]=_0x1d5daf;}function startAllRefreshIntervals(){return db[_0x84f8('0x39')][_0x84f8('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x84f8('0x37')](function(_0x50bfbc){var _0x5c5980=_0x50bfbc['map'](function(_0x507c89){return refreshOauth2MicrosoftAccessToken(_0x507c89)[_0x84f8('0x37')](function(_0x43b341){startRefreshInterval(_0x43b341);});});return Promise[_0x84f8('0x49')](_0x5c5980);})['catch'](function(_0x156151){var _0x4289fb=_0x156151?util[_0x84f8('0x4a')](_0x156151,{'showHidden':![],'depth':null}):'';logger[_0x84f8('0x4b')](_0x84f8('0x4c'),_0x4289fb);});}module['exports']={'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 9c1ce23..027e3e4 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 _0x0c6b=['error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4aecfa,_0x28c3bd){var _0x3659d0=function(_0x1e96ce){while(--_0x1e96ce){_0x4aecfa['push'](_0x4aecfa['shift']());}};_0x3659d0(++_0x28c3bd);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x387005,_0x31fb09){_0x387005=_0x387005-0x0;var _0x475762=_0x0c6b[_0x387005];return _0x475762;};'use strict';var _=require(_0xb0c6('0x0'));var util=require('util');var moment=require(_0xb0c6('0x1'));var BPromise=require(_0xb0c6('0x2'));var rs=require(_0xb0c6('0x3'));var fs=require('fs');var Redis=require(_0xb0c6('0x4'));var db=require(_0xb0c6('0x5'))['db'];var utils=require(_0xb0c6('0x6'));var logger=require(_0xb0c6('0x7'))(_0xb0c6('0x8'));var config=require(_0xb0c6('0x9'));var jayson=require(_0xb0c6('0xa'));var client=jayson[_0xb0c6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590ef9,_0x5ec174,_0x4e1245){return new BPromise(function(_0x3f18bd,_0x1be8bd){return client['request'](_0x590ef9,_0x4e1245)['then'](function(_0x2beb18){logger[_0xb0c6('0xc')](_0xb0c6('0xd'),_0x5ec174,_0xb0c6('0xe'));logger[_0xb0c6('0xf')](_0xb0c6('0x10'),_0x5ec174,_0xb0c6('0xe'),JSON[_0xb0c6('0x11')](_0x2beb18));if(_0x2beb18['error']){if(_0x2beb18[_0xb0c6('0x12')]['code']===0x1f4){logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x2beb18[_0xb0c6('0x12')]['message']);return _0x1be8bd(_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);}logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);return _0x3f18bd(_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);}else{logger['info'](_0xb0c6('0xd'),_0x5ec174,_0xb0c6('0xe'));_0x3f18bd(_0x2beb18[_0xb0c6('0x14')][_0xb0c6('0x13')]);}})['catch'](function(_0x19a09e){logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x19a09e);_0x1be8bd(_0x19a09e);});});} \ No newline at end of file +var _0x09df=['rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb'];(function(_0x3a13f0,_0xdfd8dd){var _0x5a4a5d=function(_0x503848){while(--_0x503848){_0x3a13f0['push'](_0x3a13f0['shift']());}};_0x5a4a5d(++_0xdfd8dd);}(_0x09df,0x164));var _0xf09d=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x09df[_0x5c3ae9];return _0x3f5950;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('CloudProvider,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b63b671..fd300ac 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x4ddbc7,_0x184ce8){var _0x376551=function(_0x5373db){while(--_0x5373db){_0x4ddbc7['push'](_0x4ddbc7['shift']());}};_0x376551(++_0x184ce8);}(_0xdb28,0x106));var _0x8db2=function(_0x5119bf,_0x4e147e){_0x5119bf=_0x5119bf-0x0;var _0x4f2df7=_0xdb28[_0x5119bf];return _0x4f2df7;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x554eac,_0x3d8f56){var _0x8d1cde=function(_0x5d9f9b){while(--_0x5d9f9b){_0x554eac['push'](_0x554eac['shift']());}};_0x8d1cde(++_0x3d8f56);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ce6acf9..731e92d 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 _0xc69b=['sequelize','exports','STRING'];(function(_0x40221e,_0x1a8b60){var _0x46fa3a=function(_0x59f108){while(--_0x59f108){_0x40221e['push'](_0x40221e['shift']());}};_0x46fa3a(++_0x1a8b60);}(_0xc69b,0x14a));var _0xbc69=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc69b[_0x377a6e];return _0x37f751;};'use strict';var Sequelize=require(_0xbc69('0x0'));module[_0xbc69('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbc69('0x2')]},'companyId':{'type':Sequelize[_0xbc69('0x2')]},'website':{'type':Sequelize[_0xbc69('0x2')]},'phone':{'type':Sequelize[_0xbc69('0x2')]},'fax':{'type':Sequelize[_0xbc69('0x2')]},'type':{'type':Sequelize[_0xbc69('0x2')]},'street':{'type':Sequelize[_0xbc69('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbc69('0x2')]},'email':{'type':Sequelize[_0xbc69('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbc69('0x2')]},'sStreet':{'type':Sequelize[_0xbc69('0x2')]},'sPostalCode':{'type':Sequelize[_0xbc69('0x2')]},'sCity':{'type':Sequelize[_0xbc69('0x2')]},'sCountry':{'type':Sequelize[_0xbc69('0x2')]},'description':{'type':Sequelize[_0xbc69('0x2')]}}; \ No newline at end of file +var _0xf881=['sequelize','exports','STRING'];(function(_0x5cc2b2,_0x58d5c0){var _0x343d7f=function(_0x4fc480){while(--_0x4fc480){_0x5cc2b2['push'](_0x5cc2b2['shift']());}};_0x343d7f(++_0x58d5c0);}(_0xf881,0x9f));var _0x1f88=function(_0x55af0d,_0x5db5c9){_0x55af0d=_0x55af0d-0x0;var _0x245085=_0xf881[_0x55af0d];return _0x245085;};'use strict';var Sequelize=require(_0x1f88('0x0'));module[_0x1f88('0x1')]={'name':{'type':Sequelize[_0x1f88('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1f88('0x2')]},'companyId':{'type':Sequelize[_0x1f88('0x2')]},'website':{'type':Sequelize[_0x1f88('0x2')]},'phone':{'type':Sequelize[_0x1f88('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1f88('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1f88('0x2')]},'city':{'type':Sequelize[_0x1f88('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1f88('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1f88('0x2')]},'sStreet':{'type':Sequelize[_0x1f88('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1f88('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 5bdb302..10ee9a2 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 _0xf710=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','role','user','autoAssociation','body','describe','addContacts','CmContact','getContacts','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x126f0c,_0x47d74c){var _0x1adcce=function(_0x473897){while(--_0x473897){_0x126f0c['push'](_0x126f0c['shift']());}};_0x1adcce(++_0x47d74c);}(_0xf710,0xfc));var _0x0f71=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf710[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0f71('0x0'));var rimraf=require(_0x0f71('0x1'));var zipdir=require(_0x0f71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f71('0x3'));var moment=require(_0x0f71('0x4'));var BPromise=require(_0x0f71('0x5'));var Mustache=require(_0x0f71('0x6'));var util=require(_0x0f71('0x7'));var path=require(_0x0f71('0x8'));var sox=require('sox');var csv=require(_0x0f71('0x9'));var ejs=require(_0x0f71('0xa'));var fs=require('fs');var fs_extra=require(_0x0f71('0xb'));var _=require(_0x0f71('0xc'));var squel=require(_0x0f71('0xd'));var crypto=require(_0x0f71('0xe'));var jsforce=require(_0x0f71('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0f71('0x9'));var querystring=require(_0x0f71('0x10'));var Papa=require(_0x0f71('0x11'));var Redis=require(_0x0f71('0x12'));var authService=require(_0x0f71('0x13'));var qs=require(_0x0f71('0x14'));var as=require(_0x0f71('0x15'));var hardwareService=require(_0x0f71('0x16'));var logger=require(_0x0f71('0x17'))(_0x0f71('0x18'));var utils=require(_0x0f71('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0f71('0x1a'));var db=require(_0x0f71('0x1b'))['db'];function respondWithStatusCode(_0x35f449,_0x3cac93){_0x3cac93=_0x3cac93||0xcc;return function(_0x110801){if(_0x110801){return _0x35f449[_0x0f71('0x1c')](_0x3cac93);}return _0x35f449[_0x0f71('0x1d')](_0x3cac93)[_0x0f71('0x1e')]();};}function respondWithResult(_0x1901db,_0x45495d){_0x45495d=_0x45495d||0xc8;return function(_0x5265e8){if(_0x5265e8){return _0x1901db[_0x0f71('0x1d')](_0x45495d)[_0x0f71('0x1f')](_0x5265e8);}};}function respondWithFilteredResult(_0x284aff,_0x1e1621){return function(_0xdf89ba){if(_0xdf89ba){var _0x37e158=typeof _0x1e1621['offset']===_0x0f71('0x20')&&typeof _0x1e1621[_0x0f71('0x21')]==='undefined';var _0x534cdb=_0xdf89ba[_0x0f71('0x22')];var _0x43509f=_0x37e158?0x0:_0x1e1621[_0x0f71('0x23')];var _0x49e2c7=_0x37e158?_0xdf89ba['count']:_0x1e1621[_0x0f71('0x23')]+_0x1e1621[_0x0f71('0x21')];var _0x265be0;if(_0x49e2c7>=_0x534cdb){_0x49e2c7=_0x534cdb;_0x265be0=0xc8;}else{_0x265be0=0xce;}_0x284aff['status'](_0x265be0);return _0x284aff['set']('Content-Range',_0x43509f+'-'+_0x49e2c7+'/'+_0x534cdb)[_0x0f71('0x1f')](_0xdf89ba);}return null;};}function patchUpdates(_0x422877){return function(_0x1d0d46){try{jsonpatch[_0x0f71('0x24')](_0x1d0d46,_0x422877,!![]);}catch(_0x5ba809){return BPromise[_0x0f71('0x25')](_0x5ba809);}return _0x1d0d46[_0x0f71('0x26')]();};}function saveUpdates(_0x5671c9,_0xcda3af){return function(_0x3e4e86){if(_0x3e4e86){return _0x3e4e86[_0x0f71('0x27')](_0x5671c9)[_0x0f71('0x28')](function(_0x4c2031){return _0x4c2031;});}return null;};}function removeEntity(_0x519968,_0x35aa84){return function(_0x2f7c2f){if(_0x2f7c2f){return _0x2f7c2f[_0x0f71('0x29')]()[_0x0f71('0x28')](function(){var _0x5d7fef=_0x2f7c2f[_0x0f71('0x2a')]({'plain':!![]});var _0x43e36b=_0x0f71('0x2b');return db[_0x0f71('0x2c')][_0x0f71('0x29')]({'where':{'type':_0x43e36b,'resourceId':_0x5d7fef['id']}})['then'](function(){return _0x2f7c2f;});})[_0x0f71('0x28')](function(){_0x519968['status'](0xcc)[_0x0f71('0x1e')]();});}};}function handleEntityNotFound(_0x3fef22,_0x39ec16){return function(_0x48c082){if(!_0x48c082){_0x3fef22['sendStatus'](0x194);}return _0x48c082;};}function handleError(_0x3c545d,_0x352c74){_0x352c74=_0x352c74||0x1f4;return function(_0x2d89f1){logger[_0x0f71('0x2d')](_0x2d89f1[_0x0f71('0x2e')]);if(_0x2d89f1[_0x0f71('0x2f')]){delete _0x2d89f1[_0x0f71('0x2f')];}_0x3c545d[_0x0f71('0x1d')](_0x352c74)[_0x0f71('0x30')](_0x2d89f1);};}exports[_0x0f71('0x31')]=function(_0x402b20,_0x15aa1c){var _0x45d68f={},_0x4d4cab={},_0x3af2ac={'count':0x0,'rows':[]};return db[_0x0f71('0x32')]['describe']()['then'](function(_0xf1a1f7){_0x4d4cab['model']=_[_0x0f71('0x33')](_0xf1a1f7);_0x4d4cab[_0x0f71('0x34')]=_['keys'](_0x402b20[_0x0f71('0x34')]);_0x4d4cab[_0x0f71('0x35')]=_[_0x0f71('0x36')](_0x4d4cab[_0x0f71('0x37')],_0x4d4cab['query']);_0x45d68f[_0x0f71('0x38')]=_[_0x0f71('0x36')](_0x4d4cab[_0x0f71('0x37')],qs[_0x0f71('0x39')](_0x402b20[_0x0f71('0x34')][_0x0f71('0x39')]));_0x45d68f['attributes']=_0x45d68f[_0x0f71('0x38')][_0x0f71('0x3a')]?_0x45d68f[_0x0f71('0x38')]:_0x4d4cab['model'];if(!_0x402b20[_0x0f71('0x34')][_0x0f71('0x3b')](_0x0f71('0x3c'))){_0x45d68f[_0x0f71('0x21')]=qs[_0x0f71('0x21')](_0x402b20[_0x0f71('0x34')]['limit']);_0x45d68f['offset']=qs[_0x0f71('0x23')](_0x402b20[_0x0f71('0x34')][_0x0f71('0x23')]);}_0x45d68f[_0x0f71('0x3d')]=qs[_0x0f71('0x3e')](_0x402b20[_0x0f71('0x34')]['sort']);_0x45d68f[_0x0f71('0x3f')]=qs['filters'](_['pick'](_0x402b20[_0x0f71('0x34')],_0x4d4cab[_0x0f71('0x35')]),_0xf1a1f7);if(_0x402b20[_0x0f71('0x34')][_0x0f71('0x40')]){_0x45d68f[_0x0f71('0x3f')]=_[_0x0f71('0x41')](_0x45d68f[_0x0f71('0x3f')],{'$or':_[_0x0f71('0x42')](_0x45d68f[_0x0f71('0x38')],function(_0x5cbcf0){var _0x5cc979={};_0x5cc979[_0x5cbcf0]={'$like':'%'+_0x402b20['query'][_0x0f71('0x40')]+'%'};return _0x5cc979;})});}_0x45d68f=_[_0x0f71('0x41')]({},_0x45d68f,_0x402b20['options']);var _0x5e48ce={'where':_0x45d68f[_0x0f71('0x3f')]};return db[_0x0f71('0x32')][_0x0f71('0x22')](_0x5e48ce)['then'](function(_0x4c36b2){_0x3af2ac[_0x0f71('0x22')]=_0x4c36b2;if(_0x402b20[_0x0f71('0x34')][_0x0f71('0x43')]){_0x45d68f['include']=[{'all':!![]}];}return db[_0x0f71('0x32')][_0x0f71('0x44')](_0x45d68f);})[_0x0f71('0x28')](function(_0x45ca39){_0x3af2ac[_0x0f71('0x45')]=_0x45ca39;return _0x3af2ac;})[_0x0f71('0x28')](respondWithFilteredResult(_0x15aa1c,_0x45d68f))['catch'](handleError(_0x15aa1c,null));})[_0x0f71('0x46')](handleError(_0x15aa1c,null));};exports[_0x0f71('0x47')]=function(_0x4d8d6e,_0x3ac8a0){var _0x19b989={'raw':![],'where':{'id':_0x4d8d6e[_0x0f71('0x48')]['id']}},_0x2b8090={};_0x2b8090[_0x0f71('0x37')]=_[_0x0f71('0x33')](db[_0x0f71('0x32')][_0x0f71('0x49')]);_0x2b8090[_0x0f71('0x34')]=_[_0x0f71('0x33')](_0x4d8d6e[_0x0f71('0x34')]);_0x2b8090[_0x0f71('0x35')]=_[_0x0f71('0x36')](_0x2b8090['model'],_0x2b8090[_0x0f71('0x34')]);_0x19b989['attributes']=_[_0x0f71('0x36')](_0x2b8090['model'],qs[_0x0f71('0x39')](_0x4d8d6e[_0x0f71('0x34')]['fields']));_0x19b989[_0x0f71('0x38')]=_0x19b989[_0x0f71('0x38')]['length']?_0x19b989[_0x0f71('0x38')]:_0x2b8090[_0x0f71('0x37')];if(_0x4d8d6e[_0x0f71('0x34')]['includeAll']){_0x19b989[_0x0f71('0x4a')]=[{'all':!![]}];}_0x19b989=_[_0x0f71('0x41')]({},_0x19b989,_0x4d8d6e[_0x0f71('0x4b')]);return db['CmCompany'][_0x0f71('0x4c')](_0x19b989)[_0x0f71('0x28')](handleEntityNotFound(_0x3ac8a0,null))['then'](respondWithResult(_0x3ac8a0,null))['catch'](handleError(_0x3ac8a0,null));};exports[_0x0f71('0x4d')]=function(_0x5c21d1,_0x11c254){return db[_0x0f71('0x32')]['create'](_0x5c21d1['body'],{})[_0x0f71('0x28')](function(_0xa3719b){var _0x265dd2=_0x5c21d1['user']['get']({'plain':!![]});if(!_0x265dd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x265dd2[_0x0f71('0x4e')]===_0x0f71('0x4f')){var _0xeecaa1=_0xa3719b[_0x0f71('0x2a')]({'plain':!![]});var _0x486bf5=_0x0f71('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x486bf5,'userProfileId':_0x265dd2['userProfileId']},'raw':!![]})[_0x0f71('0x28')](function(_0x49878c){if(_0x49878c&&_0x49878c[_0x0f71('0x50')]===0x0){return db[_0x0f71('0x2c')][_0x0f71('0x4d')]({'name':_0xeecaa1[_0x0f71('0x2f')],'resourceId':_0xeecaa1['id'],'type':_0x49878c[_0x0f71('0x2f')],'sectionId':_0x49878c['id']},{})[_0x0f71('0x28')](function(){return _0xa3719b;});}else{return _0xa3719b;}})[_0x0f71('0x46')](function(_0x18a31d){logger[_0x0f71('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a31d);throw _0x18a31d;});}return _0xa3719b;})[_0x0f71('0x28')](respondWithResult(_0x11c254,0xc9))['catch'](handleError(_0x11c254,null));};exports['update']=function(_0x1aa9da,_0x169104){if(_0x1aa9da[_0x0f71('0x51')]['id']){delete _0x1aa9da['body']['id'];}return db[_0x0f71('0x32')][_0x0f71('0x4c')]({'where':{'id':_0x1aa9da[_0x0f71('0x48')]['id']}})[_0x0f71('0x28')](handleEntityNotFound(_0x169104,null))['then'](saveUpdates(_0x1aa9da['body'],null))[_0x0f71('0x28')](respondWithResult(_0x169104,null))[_0x0f71('0x46')](handleError(_0x169104,null));};exports[_0x0f71('0x29')]=function(_0x42e8ff,_0x102adc){return db[_0x0f71('0x32')]['find']({'where':{'id':_0x42e8ff[_0x0f71('0x48')]['id']}})[_0x0f71('0x28')](handleEntityNotFound(_0x102adc,null))[_0x0f71('0x28')](removeEntity(_0x102adc,null))[_0x0f71('0x46')](handleError(_0x102adc,null));};exports[_0x0f71('0x52')]=function(_0x5b5c05,_0x4de767){return db[_0x0f71('0x32')]['describe']()[_0x0f71('0x28')](respondWithResult(_0x4de767,null))[_0x0f71('0x46')](handleError(_0x4de767,null));};exports[_0x0f71('0x53')]=function(_0x1f4f96,_0x153670,_0x5a6337){return db[_0x0f71('0x54')]['find']({'where':{'id':_0x1f4f96[_0x0f71('0x48')]['id']}})['then'](handleEntityNotFound(_0x153670,null))[_0x0f71('0x28')](function(_0x1013f4){if(_0x1013f4){return _0x1013f4['addContacts'](_0x1f4f96['body']['ids'],_['omit'](_0x1f4f96['body'],['ids','id'])||{});}})[_0x0f71('0x28')](respondWithResult(_0x153670,null))[_0x0f71('0x46')](handleError(_0x153670,null));};exports[_0x0f71('0x55')]=function(_0x5be120,_0x3101ca,_0x381f03){var _0x41914e={};var _0x4561dc={};var _0x5d7c98;var _0x3c148f;return db['CmCompany']['findOne']({'where':{'id':_0x5be120[_0x0f71('0x48')]['id']}})[_0x0f71('0x28')](handleEntityNotFound(_0x3101ca,null))[_0x0f71('0x28')](function(_0x4ee5bd){if(_0x4ee5bd){_0x5d7c98=_0x4ee5bd;_0x4561dc[_0x0f71('0x37')]=_[_0x0f71('0x33')](db[_0x0f71('0x54')][_0x0f71('0x49')]);_0x4561dc['query']=_['keys'](_0x5be120[_0x0f71('0x34')]);_0x4561dc[_0x0f71('0x35')]=_[_0x0f71('0x36')](_0x4561dc[_0x0f71('0x37')],_0x4561dc['query']);_0x41914e['attributes']=_[_0x0f71('0x36')](_0x4561dc['model'],qs[_0x0f71('0x39')](_0x5be120[_0x0f71('0x34')][_0x0f71('0x39')]));_0x41914e['attributes']=_0x41914e[_0x0f71('0x38')][_0x0f71('0x3a')]?_0x41914e[_0x0f71('0x38')]:_0x4561dc[_0x0f71('0x37')];_0x41914e[_0x0f71('0x3d')]=qs[_0x0f71('0x3e')](_0x5be120['query'][_0x0f71('0x3e')]);_0x41914e[_0x0f71('0x3f')]=qs[_0x0f71('0x35')](_[_0x0f71('0x56')](_0x5be120[_0x0f71('0x34')],_0x4561dc['filters']));if(_0x5be120['query'][_0x0f71('0x40')]){_0x41914e[_0x0f71('0x3f')]=_[_0x0f71('0x41')](_0x41914e[_0x0f71('0x3f')],{'$or':_[_0x0f71('0x42')](_0x41914e[_0x0f71('0x38')],function(_0x15351b){var _0x495310={};_0x495310[_0x15351b]={'$like':'%'+_0x5be120[_0x0f71('0x34')][_0x0f71('0x40')]+'%'};return _0x495310;})});}_0x41914e=_['merge']({},_0x41914e,_0x5be120[_0x0f71('0x4b')]);return _0x5d7c98[_0x0f71('0x55')](_0x41914e);}})[_0x0f71('0x28')](function(_0x27b988){if(_0x27b988){_0x3c148f=_0x27b988[_0x0f71('0x3a')];if(!_0x5be120['query']['hasOwnProperty'](_0x0f71('0x3c'))){_0x41914e['limit']=qs[_0x0f71('0x21')](_0x5be120[_0x0f71('0x34')][_0x0f71('0x21')]);_0x41914e['offset']=qs[_0x0f71('0x23')](_0x5be120[_0x0f71('0x34')][_0x0f71('0x23')]);}return _0x5d7c98[_0x0f71('0x55')](_0x41914e);}})[_0x0f71('0x28')](function(_0x4feb6c){if(_0x4feb6c){return _0x4feb6c?{'count':_0x3c148f,'rows':_0x4feb6c}:null;}})[_0x0f71('0x28')](respondWithResult(_0x3101ca,null))[_0x0f71('0x46')](handleError(_0x3101ca,null));}; \ No newline at end of file +var _0xa3c0=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','Companies','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','filter','options','CmCompany','include','findAll','rows','catch','params','rawAttributes','includeAll','find'];(function(_0x42341f,_0x65f8c3){var _0x32c896=function(_0x1841b7){while(--_0x1841b7){_0x42341f['push'](_0x42341f['shift']());}};_0x32c896(++_0x65f8c3);}(_0xa3c0,0x114));var _0x0a3c=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xa3c0[_0x133277];return _0x5b4a22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a3c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a3c('0x1'));var rp=require('request-promise');var moment=require(_0x0a3c('0x2'));var BPromise=require(_0x0a3c('0x3'));var Mustache=require(_0x0a3c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0a3c('0x5'));var csv=require(_0x0a3c('0x6'));var ejs=require(_0x0a3c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a3c('0x8'));var squel=require(_0x0a3c('0x9'));var crypto=require('crypto');var jsforce=require(_0x0a3c('0xa'));var deskjs=require(_0x0a3c('0xb'));var toCsv=require(_0x0a3c('0x6'));var querystring=require(_0x0a3c('0xc'));var Papa=require(_0x0a3c('0xd'));var Redis=require(_0x0a3c('0xe'));var authService=require(_0x0a3c('0xf'));var qs=require(_0x0a3c('0x10'));var as=require(_0x0a3c('0x11'));var hardwareService=require(_0x0a3c('0x12'));var logger=require('../../config/logger')(_0x0a3c('0x13'));var utils=require('../../config/utils');var config=require(_0x0a3c('0x14'));var licenseUtil=require(_0x0a3c('0x15'));var db=require(_0x0a3c('0x16'))['db'];function respondWithStatusCode(_0x397f82,_0x447bc0){_0x447bc0=_0x447bc0||0xcc;return function(_0x49bb7e){if(_0x49bb7e){return _0x397f82[_0x0a3c('0x17')](_0x447bc0);}return _0x397f82[_0x0a3c('0x18')](_0x447bc0)[_0x0a3c('0x19')]();};}function respondWithResult(_0x23c828,_0xdde9c9){_0xdde9c9=_0xdde9c9||0xc8;return function(_0x4b626d){if(_0x4b626d){return _0x23c828[_0x0a3c('0x18')](_0xdde9c9)[_0x0a3c('0x1a')](_0x4b626d);}};}function respondWithFilteredResult(_0x9ac5cf,_0x1ec7f4){return function(_0x58db40){if(_0x58db40){var _0x1949b0=typeof _0x1ec7f4['offset']===_0x0a3c('0x1b')&&typeof _0x1ec7f4[_0x0a3c('0x1c')]===_0x0a3c('0x1b');var _0x5c24dd=_0x58db40[_0x0a3c('0x1d')];var _0x8d2cf4=_0x1949b0?0x0:_0x1ec7f4[_0x0a3c('0x1e')];var _0x48a3a6=_0x1949b0?_0x58db40[_0x0a3c('0x1d')]:_0x1ec7f4[_0x0a3c('0x1e')]+_0x1ec7f4['limit'];var _0x591c66;if(_0x48a3a6>=_0x5c24dd){_0x48a3a6=_0x5c24dd;_0x591c66=0xc8;}else{_0x591c66=0xce;}_0x9ac5cf[_0x0a3c('0x18')](_0x591c66);return _0x9ac5cf['set'](_0x0a3c('0x1f'),_0x8d2cf4+'-'+_0x48a3a6+'/'+_0x5c24dd)[_0x0a3c('0x1a')](_0x58db40);}return null;};}function patchUpdates(_0x54e569){return function(_0x1f24d4){try{jsonpatch[_0x0a3c('0x20')](_0x1f24d4,_0x54e569,!![]);}catch(_0x47f118){return BPromise['reject'](_0x47f118);}return _0x1f24d4[_0x0a3c('0x21')]();};}function saveUpdates(_0xdf3155,_0x569b5c){return function(_0x18226e){if(_0x18226e){return _0x18226e[_0x0a3c('0x22')](_0xdf3155)[_0x0a3c('0x23')](function(_0x225e39){return _0x225e39;});}return null;};}function removeEntity(_0x32640a,_0x2d52a7){return function(_0x3eb1a2){if(_0x3eb1a2){return _0x3eb1a2[_0x0a3c('0x24')]()[_0x0a3c('0x23')](function(){var _0x1e1e43=_0x3eb1a2[_0x0a3c('0x25')]({'plain':!![]});var _0x550587=_0x0a3c('0x26');return db['UserProfileResource'][_0x0a3c('0x24')]({'where':{'type':_0x550587,'resourceId':_0x1e1e43['id']}})[_0x0a3c('0x23')](function(){return _0x3eb1a2;});})['then'](function(){_0x32640a[_0x0a3c('0x18')](0xcc)[_0x0a3c('0x19')]();});}};}function handleEntityNotFound(_0x1e3b0a,_0x19f233){return function(_0x5ace33){if(!_0x5ace33){_0x1e3b0a['sendStatus'](0x194);}return _0x5ace33;};}function handleError(_0x221aaa,_0x2a2484){_0x2a2484=_0x2a2484||0x1f4;return function(_0x367126){logger[_0x0a3c('0x27')](_0x367126[_0x0a3c('0x28')]);if(_0x367126['name']){delete _0x367126[_0x0a3c('0x29')];}_0x221aaa[_0x0a3c('0x18')](_0x2a2484)[_0x0a3c('0x2a')](_0x367126);};}exports[_0x0a3c('0x2b')]=function(_0x37fb92,_0x8037a8){var _0x43a5e0={},_0x20f8e6={},_0x1ecd9={'count':0x0,'rows':[]};return db['CmCompany'][_0x0a3c('0x2c')]()[_0x0a3c('0x23')](function(_0x564661){_0x20f8e6[_0x0a3c('0x2d')]=_[_0x0a3c('0x2e')](_0x564661);_0x20f8e6[_0x0a3c('0x2f')]=_[_0x0a3c('0x2e')](_0x37fb92['query']);_0x20f8e6[_0x0a3c('0x30')]=_[_0x0a3c('0x31')](_0x20f8e6[_0x0a3c('0x2d')],_0x20f8e6[_0x0a3c('0x2f')]);_0x43a5e0[_0x0a3c('0x32')]=_[_0x0a3c('0x31')](_0x20f8e6[_0x0a3c('0x2d')],qs[_0x0a3c('0x33')](_0x37fb92[_0x0a3c('0x2f')][_0x0a3c('0x33')]));_0x43a5e0[_0x0a3c('0x32')]=_0x43a5e0[_0x0a3c('0x32')][_0x0a3c('0x34')]?_0x43a5e0['attributes']:_0x20f8e6[_0x0a3c('0x2d')];if(!_0x37fb92['query'][_0x0a3c('0x35')](_0x0a3c('0x36'))){_0x43a5e0['limit']=qs[_0x0a3c('0x1c')](_0x37fb92[_0x0a3c('0x2f')][_0x0a3c('0x1c')]);_0x43a5e0['offset']=qs[_0x0a3c('0x1e')](_0x37fb92['query'][_0x0a3c('0x1e')]);}_0x43a5e0[_0x0a3c('0x37')]=qs[_0x0a3c('0x38')](_0x37fb92[_0x0a3c('0x2f')]['sort']);_0x43a5e0['where']=qs[_0x0a3c('0x30')](_[_0x0a3c('0x39')](_0x37fb92[_0x0a3c('0x2f')],_0x20f8e6[_0x0a3c('0x30')]),_0x564661);if(_0x37fb92[_0x0a3c('0x2f')]['filter']){_0x43a5e0[_0x0a3c('0x3a')]=_[_0x0a3c('0x3b')](_0x43a5e0[_0x0a3c('0x3a')],{'$or':_[_0x0a3c('0x3c')](_0x43a5e0[_0x0a3c('0x32')],function(_0x206075){var _0x35c89d={};_0x35c89d[_0x206075]={'$like':'%'+_0x37fb92['query'][_0x0a3c('0x3d')]+'%'};return _0x35c89d;})});}_0x43a5e0=_[_0x0a3c('0x3b')]({},_0x43a5e0,_0x37fb92[_0x0a3c('0x3e')]);var _0x39b876={'where':_0x43a5e0[_0x0a3c('0x3a')]};return db[_0x0a3c('0x3f')][_0x0a3c('0x1d')](_0x39b876)[_0x0a3c('0x23')](function(_0x483ab1){_0x1ecd9[_0x0a3c('0x1d')]=_0x483ab1;if(_0x37fb92[_0x0a3c('0x2f')]['includeAll']){_0x43a5e0[_0x0a3c('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0x0a3c('0x41')](_0x43a5e0);})[_0x0a3c('0x23')](function(_0x3b6290){_0x1ecd9[_0x0a3c('0x42')]=_0x3b6290;return _0x1ecd9;})['then'](respondWithFilteredResult(_0x8037a8,_0x43a5e0))['catch'](handleError(_0x8037a8,null));})[_0x0a3c('0x43')](handleError(_0x8037a8,null));};exports['show']=function(_0x3a034f,_0x5f49c6){var _0x953e71={'raw':![],'where':{'id':_0x3a034f[_0x0a3c('0x44')]['id']}},_0x1b34af={};_0x1b34af[_0x0a3c('0x2d')]=_['keys'](db[_0x0a3c('0x3f')][_0x0a3c('0x45')]);_0x1b34af[_0x0a3c('0x2f')]=_[_0x0a3c('0x2e')](_0x3a034f['query']);_0x1b34af[_0x0a3c('0x30')]=_[_0x0a3c('0x31')](_0x1b34af[_0x0a3c('0x2d')],_0x1b34af['query']);_0x953e71[_0x0a3c('0x32')]=_['intersection'](_0x1b34af[_0x0a3c('0x2d')],qs[_0x0a3c('0x33')](_0x3a034f['query'][_0x0a3c('0x33')]));_0x953e71[_0x0a3c('0x32')]=_0x953e71['attributes']['length']?_0x953e71[_0x0a3c('0x32')]:_0x1b34af[_0x0a3c('0x2d')];if(_0x3a034f[_0x0a3c('0x2f')][_0x0a3c('0x46')]){_0x953e71[_0x0a3c('0x40')]=[{'all':!![]}];}_0x953e71=_[_0x0a3c('0x3b')]({},_0x953e71,_0x3a034f[_0x0a3c('0x3e')]);return db[_0x0a3c('0x3f')][_0x0a3c('0x47')](_0x953e71)['then'](handleEntityNotFound(_0x5f49c6,null))['then'](respondWithResult(_0x5f49c6,null))['catch'](handleError(_0x5f49c6,null));};exports[_0x0a3c('0x48')]=function(_0x2f31a3,_0x4b5e3b){return db[_0x0a3c('0x3f')][_0x0a3c('0x48')](_0x2f31a3[_0x0a3c('0x49')],{})[_0x0a3c('0x23')](function(_0x21934f){var _0x269d05=_0x2f31a3[_0x0a3c('0x4a')][_0x0a3c('0x25')]({'plain':!![]});if(!_0x269d05)throw new Error(_0x0a3c('0x4b'));if(_0x269d05['role']===_0x0a3c('0x4a')){var _0x5683f3=_0x21934f[_0x0a3c('0x25')]({'plain':!![]});var _0x490020=_0x0a3c('0x26');return db[_0x0a3c('0x4c')][_0x0a3c('0x47')]({'where':{'name':_0x490020,'userProfileId':_0x269d05[_0x0a3c('0x4d')]},'raw':!![]})[_0x0a3c('0x23')](function(_0x3a59ad){if(_0x3a59ad&&_0x3a59ad[_0x0a3c('0x4e')]===0x0){return db[_0x0a3c('0x4f')][_0x0a3c('0x48')]({'name':_0x5683f3[_0x0a3c('0x29')],'resourceId':_0x5683f3['id'],'type':_0x3a59ad[_0x0a3c('0x29')],'sectionId':_0x3a59ad['id']},{})[_0x0a3c('0x23')](function(){return _0x21934f;});}else{return _0x21934f;}})[_0x0a3c('0x43')](function(_0x387ef8){logger[_0x0a3c('0x27')](_0x0a3c('0x50'),_0x387ef8);throw _0x387ef8;});}return _0x21934f;})[_0x0a3c('0x23')](respondWithResult(_0x4b5e3b,0xc9))[_0x0a3c('0x43')](handleError(_0x4b5e3b,null));};exports[_0x0a3c('0x22')]=function(_0x264395,_0x480934){if(_0x264395[_0x0a3c('0x49')]['id']){delete _0x264395[_0x0a3c('0x49')]['id'];}return db[_0x0a3c('0x3f')][_0x0a3c('0x47')]({'where':{'id':_0x264395[_0x0a3c('0x44')]['id']}})[_0x0a3c('0x23')](handleEntityNotFound(_0x480934,null))['then'](saveUpdates(_0x264395[_0x0a3c('0x49')],null))[_0x0a3c('0x23')](respondWithResult(_0x480934,null))['catch'](handleError(_0x480934,null));};exports['destroy']=function(_0x2b0b74,_0x1576d5){return db[_0x0a3c('0x3f')]['find']({'where':{'id':_0x2b0b74['params']['id']}})['then'](handleEntityNotFound(_0x1576d5,null))[_0x0a3c('0x23')](removeEntity(_0x1576d5,null))[_0x0a3c('0x43')](handleError(_0x1576d5,null));};exports['describe']=function(_0x44e027,_0x802cfa){return db[_0x0a3c('0x3f')]['describe']()[_0x0a3c('0x23')](respondWithResult(_0x802cfa,null))[_0x0a3c('0x43')](handleError(_0x802cfa,null));};exports[_0x0a3c('0x51')]=function(_0x5815ac,_0x16bad5,_0x130c61){return db[_0x0a3c('0x52')]['find']({'where':{'id':_0x5815ac['params']['id']}})['then'](handleEntityNotFound(_0x16bad5,null))['then'](function(_0x32fea3){if(_0x32fea3){return _0x32fea3[_0x0a3c('0x51')](_0x5815ac[_0x0a3c('0x49')]['ids'],_[_0x0a3c('0x53')](_0x5815ac[_0x0a3c('0x49')],[_0x0a3c('0x54'),'id'])||{});}})[_0x0a3c('0x23')](respondWithResult(_0x16bad5,null))['catch'](handleError(_0x16bad5,null));};exports[_0x0a3c('0x55')]=function(_0x48908e,_0x44dad0,_0x3e384f){var _0x590521={};var _0x4a5717={};var _0x2cf490;var _0x1b43aa;return db[_0x0a3c('0x3f')][_0x0a3c('0x56')]({'where':{'id':_0x48908e[_0x0a3c('0x44')]['id']}})[_0x0a3c('0x23')](handleEntityNotFound(_0x44dad0,null))[_0x0a3c('0x23')](function(_0x102874){if(_0x102874){_0x2cf490=_0x102874;_0x4a5717[_0x0a3c('0x2d')]=_['keys'](db[_0x0a3c('0x52')][_0x0a3c('0x45')]);_0x4a5717['query']=_[_0x0a3c('0x2e')](_0x48908e[_0x0a3c('0x2f')]);_0x4a5717[_0x0a3c('0x30')]=_[_0x0a3c('0x31')](_0x4a5717['model'],_0x4a5717[_0x0a3c('0x2f')]);_0x590521[_0x0a3c('0x32')]=_['intersection'](_0x4a5717[_0x0a3c('0x2d')],qs[_0x0a3c('0x33')](_0x48908e[_0x0a3c('0x2f')][_0x0a3c('0x33')]));_0x590521[_0x0a3c('0x32')]=_0x590521[_0x0a3c('0x32')]['length']?_0x590521['attributes']:_0x4a5717[_0x0a3c('0x2d')];_0x590521[_0x0a3c('0x37')]=qs[_0x0a3c('0x38')](_0x48908e[_0x0a3c('0x2f')][_0x0a3c('0x38')]);_0x590521[_0x0a3c('0x3a')]=qs[_0x0a3c('0x30')](_[_0x0a3c('0x39')](_0x48908e[_0x0a3c('0x2f')],_0x4a5717['filters']));if(_0x48908e[_0x0a3c('0x2f')][_0x0a3c('0x3d')]){_0x590521['where']=_[_0x0a3c('0x3b')](_0x590521[_0x0a3c('0x3a')],{'$or':_['map'](_0x590521[_0x0a3c('0x32')],function(_0x2345e2){var _0x2f1b68={};_0x2f1b68[_0x2345e2]={'$like':'%'+_0x48908e[_0x0a3c('0x2f')][_0x0a3c('0x3d')]+'%'};return _0x2f1b68;})});}_0x590521=_[_0x0a3c('0x3b')]({},_0x590521,_0x48908e[_0x0a3c('0x3e')]);return _0x2cf490[_0x0a3c('0x55')](_0x590521);}})[_0x0a3c('0x23')](function(_0x4c39db){if(_0x4c39db){_0x1b43aa=_0x4c39db[_0x0a3c('0x34')];if(!_0x48908e[_0x0a3c('0x2f')]['hasOwnProperty']('nolimit')){_0x590521[_0x0a3c('0x1c')]=qs['limit'](_0x48908e[_0x0a3c('0x2f')][_0x0a3c('0x1c')]);_0x590521[_0x0a3c('0x1e')]=qs[_0x0a3c('0x1e')](_0x48908e[_0x0a3c('0x2f')]['offset']);}return _0x2cf490[_0x0a3c('0x55')](_0x590521);}})['then'](function(_0x11a863){if(_0x11a863){return _0x11a863?{'count':_0x1b43aa,'rows':_0x11a863}:null;}})[_0x0a3c('0x23')](respondWithResult(_0x44dad0,null))[_0x0a3c('0x43')](handleError(_0x44dad0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 2dac399..4221e26 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 _0x7403=['bluebird','request-promise','./cmCompany.attributes','exports','define','cm_companies','util','moment'];(function(_0xed0448,_0x1cf0d2){var _0x5263d3=function(_0xb7df2){while(--_0xb7df2){_0xed0448['push'](_0xed0448['shift']());}};_0x5263d3(++_0x1cf0d2);}(_0x7403,0x1b6));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3740('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3740('0x1'));var BPromise=require(_0x3740('0x2'));var rp=require(_0x3740('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3740('0x4'));module[_0x3740('0x5')]=function(_0x3e1e27,_0x1ba72a){return _0x3e1e27[_0x3740('0x6')]('CmCompany',attributes,{'tableName':_0x3740('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed4=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','moment','request-promise'];(function(_0x57b77c,_0x33093a){var _0x244ef5=function(_0x54a398){while(--_0x54a398){_0x57b77c['push'](_0x57b77c['shift']());}};_0x244ef5(++_0x33093a);}(_0x1ed4,0x13c));var _0x41ed=function(_0x44e121,_0x1f561c){_0x44e121=_0x44e121-0x0;var _0x1507a2=_0x1ed4[_0x44e121];return _0x1507a2;};'use strict';var _=require('lodash');var util=require(_0x41ed('0x0'));var logger=require(_0x41ed('0x1'))('api');var moment=require(_0x41ed('0x2'));var BPromise=require('bluebird');var rp=require(_0x41ed('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x41ed('0x4'));var attributes=require(_0x41ed('0x5'));module[_0x41ed('0x6')]=function(_0x1924e4,_0x2a631b){return _0x1924e4[_0x41ed('0x7')](_0x41ed('0x8'),attributes,{'tableName':_0x41ed('0x9'),'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 bd21da8..4982c31 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 _0x5498=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x3e454d,_0x17357f){var _0x3ae007=function(_0x40b2c6){while(--_0x40b2c6){_0x3e454d['push'](_0x3e454d['shift']());}};_0x3ae007(++_0x17357f);}(_0x5498,0xe7));var _0x8549=function(_0x2a8917,_0x55368e){_0x2a8917=_0x2a8917-0x0;var _0x19c1f1=_0x5498[_0x2a8917];return _0x19c1f1;};'use strict';var _=require('lodash');var util=require(_0x8549('0x0'));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'))('rpc');var config=require(_0x8549('0x7'));var jayson=require(_0x8549('0x8'));var client=jayson['client'][_0x8549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe57e97,_0x25d7e5,_0x2fed05){return new BPromise(function(_0xc3e6d3,_0x315d86){return client['request'](_0xe57e97,_0x2fed05)[_0x8549('0xa')](function(_0x129f20){logger[_0x8549('0xb')](_0x8549('0xc'),_0x25d7e5,_0x8549('0xd'));logger[_0x8549('0xe')](_0x8549('0xf'),_0x25d7e5,'request\x20sent',JSON[_0x8549('0x10')](_0x129f20));if(_0x129f20['error']){if(_0x129f20[_0x8549('0x11')][_0x8549('0x12')]===0x1f4){logger[_0x8549('0x11')](_0x8549('0xc'),_0x25d7e5,_0x129f20[_0x8549('0x11')]['message']);return _0x315d86(_0x129f20[_0x8549('0x11')][_0x8549('0x13')]);}logger[_0x8549('0x11')](_0x8549('0xc'),_0x25d7e5,_0x129f20[_0x8549('0x11')][_0x8549('0x13')]);return _0xc3e6d3(_0x129f20[_0x8549('0x11')][_0x8549('0x13')]);}else{logger[_0x8549('0xb')](_0x8549('0xc'),_0x25d7e5,_0x8549('0xd'));_0xc3e6d3(_0x129f20[_0x8549('0x14')][_0x8549('0x13')]);}})[_0x8549('0x15')](function(_0x34a1b8){logger[_0x8549('0x11')](_0x8549('0xc'),_0x25d7e5,_0x34a1b8);_0x315d86(_0x34a1b8);});});} \ No newline at end of file +var _0x0f48=['result','moment','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x0f48,0xeb));var _0x80f4=function(_0x5934e4,_0x477406){_0x5934e4=_0x5934e4-0x0;var _0x3fbb91=_0x0f48[_0x5934e4];return _0x3fbb91;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80f4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80f4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x80f4('0x2'));var logger=require('../../config/logger')(_0x80f4('0x3'));var config=require('../../config/environment');var jayson=require(_0x80f4('0x4'));var client=jayson['client'][_0x80f4('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x41f905,_0x4f54fd,_0x2a97d3){return new BPromise(function(_0x34a9d2,_0x2e359a){return client[_0x80f4('0x6')](_0x41f905,_0x2a97d3)[_0x80f4('0x7')](function(_0x4f903c){logger[_0x80f4('0x8')](_0x80f4('0x9'),_0x4f54fd,_0x80f4('0xa'));logger[_0x80f4('0xb')](_0x80f4('0xc'),_0x4f54fd,'request\x20sent',JSON[_0x80f4('0xd')](_0x4f903c));if(_0x4f903c[_0x80f4('0xe')]){if(_0x4f903c[_0x80f4('0xe')][_0x80f4('0xf')]===0x1f4){logger[_0x80f4('0xe')]('CmCompany,\x20%s,\x20%s',_0x4f54fd,_0x4f903c[_0x80f4('0xe')][_0x80f4('0x10')]);return _0x2e359a(_0x4f903c['error'][_0x80f4('0x10')]);}logger[_0x80f4('0xe')](_0x80f4('0x9'),_0x4f54fd,_0x4f903c['error'][_0x80f4('0x10')]);return _0x34a9d2(_0x4f903c[_0x80f4('0xe')][_0x80f4('0x10')]);}else{logger[_0x80f4('0x8')](_0x80f4('0x9'),_0x4f54fd,_0x80f4('0xa'));_0x34a9d2(_0x4f903c[_0x80f4('0x11')]['message']);}})['catch'](function(_0x106c2c){logger[_0x80f4('0xe')]('CmCompany,\x20%s,\x20%s',_0x4f54fd,_0x106c2c);_0x2e359a(_0x106c2c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5dca981..9b59550 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 _0x231d=['./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','post','/:id/contacts','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11eed5,_0x1d2a1c){var _0x3d4bfb=function(_0x1fbb09){while(--_0x1fbb09){_0x11eed5['push'](_0x11eed5['shift']());}};_0x3d4bfb(++_0x1d2a1c);}(_0x231d,0x78));var _0xd231=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x231d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd231('0x0'));var util=require(_0xd231('0x1'));var path=require(_0xd231('0x2'));var timeout=require(_0xd231('0x3'));var express=require(_0xd231('0x4'));var router=express[_0xd231('0x5')]();var fs_extra=require(_0xd231('0x6'));var auth=require(_0xd231('0x7'));var interaction=require(_0xd231('0x8'));var config=require(_0xd231('0x9'));var controller=require(_0xd231('0xa'));router['get']('/',auth[_0xd231('0xb')](),controller[_0xd231('0xc')]);router[_0xd231('0xd')](_0xd231('0xe'),auth[_0xd231('0xb')](),controller[_0xd231('0xf')]);router[_0xd231('0xd')](_0xd231('0x10'),auth[_0xd231('0xb')](),controller[_0xd231('0x11')]);router[_0xd231('0xd')]('/:id/contacts',auth[_0xd231('0xb')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0xd231('0x12')]);router[_0xd231('0x13')](_0xd231('0x14'),auth[_0xd231('0xb')](),controller[_0xd231('0x15')]);router[_0xd231('0x16')](_0xd231('0x10'),auth[_0xd231('0xb')](),controller[_0xd231('0x17')]);router['delete']('/:id',auth[_0xd231('0xb')](),controller[_0xd231('0x18')]);module[_0xd231('0x19')]=router; \ No newline at end of file +var _0x2728=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3f8759,_0x3fe6fb){var _0x2d33ca=function(_0x39b5c9){while(--_0x39b5c9){_0x3f8759['push'](_0x3f8759['shift']());}};_0x2d33ca(++_0x3fe6fb);}(_0x2728,0x1d8));var _0x8272=function(_0x11d49b,_0xba47b7){_0x11d49b=_0x11d49b-0x0;var _0x1d2089=_0x2728[_0x11d49b];return _0x1d2089;};'use strict';var multer=require(_0x8272('0x0'));var util=require(_0x8272('0x1'));var path=require(_0x8272('0x2'));var timeout=require(_0x8272('0x3'));var express=require(_0x8272('0x4'));var router=express[_0x8272('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8272('0x6'));var interaction=require(_0x8272('0x7'));var config=require('../../config/environment');var controller=require(_0x8272('0x8'));router[_0x8272('0x9')]('/',auth[_0x8272('0xa')](),controller[_0x8272('0xb')]);router['get']('/describe',auth[_0x8272('0xa')](),controller[_0x8272('0xc')]);router['get'](_0x8272('0xd'),auth[_0x8272('0xa')](),controller[_0x8272('0xe')]);router[_0x8272('0x9')](_0x8272('0xf'),auth['isAuthenticated'](),controller[_0x8272('0x10')]);router[_0x8272('0x11')]('/',auth[_0x8272('0xa')](),controller[_0x8272('0x12')]);router[_0x8272('0x11')]('/:id/contacts',auth[_0x8272('0xa')](),controller[_0x8272('0x13')]);router[_0x8272('0x14')](_0x8272('0xd'),auth[_0x8272('0xa')](),controller[_0x8272('0x15')]);router[_0x8272('0x16')](_0x8272('0xd'),auth['isAuthenticated'](),controller[_0x8272('0x17')]);module[_0x8272('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3343d14..01c9d21 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 _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x597a5,_0x563e48){var _0x1a47bb=function(_0x21f0e4){while(--_0x21f0e4){_0x597a5['push'](_0x597a5['shift']());}};_0x1a47bb(++_0x563e48);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c0776,_0x4ae99b){_0x4c0776=_0x4c0776-0x0;var _0x38a814=_0x5f2f[_0x4c0776];return _0x38a814;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x5f66=['sequelize','STRING','INTEGER','DATE'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var Sequelize=require(_0x65f6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x65f6('0x1')]},'street':{'type':Sequelize[_0x65f6('0x1')]},'postalCode':{'type':Sequelize[_0x65f6('0x1')]},'city':{'type':Sequelize[_0x65f6('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x65f6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x65f6('0x1')]},'mobile':{'type':Sequelize[_0x65f6('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65f6('0x1')]},'facebook':{'type':Sequelize[_0x65f6('0x1')]},'fb_data':{'type':Sequelize[_0x65f6('0x1')]},'twitter':{'type':Sequelize[_0x65f6('0x1')]},'skype':{'type':Sequelize[_0x65f6('0x1')]},'teams':{'type':Sequelize[_0x65f6('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65f6('0x1')]},'telegram':{'type':Sequelize[_0x65f6('0x1')]},'UserId':{'type':Sequelize[_0x65f6('0x2')]},'priority':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 580a9f1..59b0082 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 _0x39cb=['File\x20uploaded\x20correctly!','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','Website','Account','closed','closedAt','disposition','secondDisposition','Owner','browserName','deviceModel','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','count','set','then','end','sendStatus','error','stack','name','send','CmContact','describe','keys','length','startsWith','CmCustomField','trimStart','cf_','all','fieldType','type','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','select','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','start','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','getFullTextValue','isNumeric','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?','group','c.id','Sequelize','QueryTypes','SELECT','DESC','having','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.phone','c.mobile','c.fax','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','tags','displayName','analytics','findAll','columnName','alias','custom','values','merge','body','get','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','join','dialTimezone','timezones','utcOffset','bulkCreate','duplicates','$or','findOrCreate','spread','params','cf_%d','$and','omit','pickBy','format','table','setFields','text','phone','getTags','findOne','rawAttributes','options','nolimit','setTags','ids','ContactId','includeAll','include','rows','getHopperHistories','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x39cb,0x151));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xb39c('0x0'));var BPromise=require(_0xb39c('0x1'));var util=require(_0xb39c('0x2'));var path=require(_0xb39c('0x3'));var fs=require('fs');var _=require(_0xb39c('0x4'));var squel=require('squel');var Papa=require(_0xb39c('0x5'));var Redis=require(_0xb39c('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0xb39c('0x7'));var logger=require(_0xb39c('0x8'))(_0xb39c('0x9'));var config=require(_0xb39c('0xa'));var shared=require(_0xb39c('0xb'));var db=require(_0xb39c('0xc'))['db'];config[_0xb39c('0xd')]=_['defaults'](config[_0xb39c('0xd')],{'host':_0xb39c('0xe'),'port':0x18eb});var socket=require(_0xb39c('0xf'))(new Redis(config[_0xb39c('0xd')]));require(_0xb39c('0x10'))['register'](socket);function respondWithResult(_0x469e7b,_0x27f2e0){_0x27f2e0=_0x27f2e0||0xc8;return function(_0x4421e7){if(_0x4421e7){return _0x469e7b[_0xb39c('0x11')](_0x27f2e0)[_0xb39c('0x12')](_0x4421e7);}};}function respondWithFilteredResult(_0x578dd9,_0xd30128){return function(_0x54f4b8){if(_0x54f4b8){var _0x13b0f8=typeof _0xd30128[_0xb39c('0x13')]===_0xb39c('0x14')&&typeof _0xd30128[_0xb39c('0x15')]===_0xb39c('0x14');var _0x4de628=_0x54f4b8[_0xb39c('0x16')];var _0x18843e=_0x13b0f8?0x0:_0xd30128[_0xb39c('0x13')];var _0x58f7ae=_0x13b0f8?_0x54f4b8[_0xb39c('0x16')]:_0xd30128['offset']+_0xd30128['limit'];var _0x2cb74f;if(_0x58f7ae>=_0x4de628){_0x58f7ae=_0x4de628;_0x2cb74f=0xc8;}else{_0x2cb74f=0xce;}_0x578dd9[_0xb39c('0x11')](_0x2cb74f);return _0x578dd9[_0xb39c('0x17')]('Content-Range',_0x18843e+'-'+_0x58f7ae+'/'+_0x4de628)[_0xb39c('0x12')](_0x54f4b8);}return null;};}function saveUpdates(_0x46cba1){return function(_0x3195f8){if(_0x3195f8){return _0x3195f8['update'](_0x46cba1)[_0xb39c('0x18')](function(_0x3812fa){return _0x3812fa;});}return null;};}function removeEntity(_0x4b38d3){return function(_0x5a8ee8){if(_0x5a8ee8){return _0x5a8ee8['destroy']()[_0xb39c('0x18')](function(){_0x4b38d3['status'](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x53d138){return function(_0x464356){if(!_0x464356){_0x53d138[_0xb39c('0x1a')](0x194);}return _0x464356;};}function handleError(_0x3971d6,_0xed36fe){_0xed36fe=_0xed36fe||0x1f4;return function(_0x230fb3){logger[_0xb39c('0x1b')](_0x230fb3[_0xb39c('0x1c')]);if(_0x230fb3['name']){delete _0x230fb3[_0xb39c('0x1d')];}_0x3971d6[_0xb39c('0x11')](_0xed36fe)[_0xb39c('0x1e')](_0x230fb3);};}exports['index']=function(_0x89aa99,_0xb8ba59){var _0x1af7ae={},_0x2e072b={},_0x5d8be3={'count':0x0,'rows':[]};return db[_0xb39c('0x1f')][_0xb39c('0x20')]()[_0xb39c('0x18')](function(_0x2fd06e){var _0x4aa82b=[];for(var _0x19eb41=0x0;_0x19eb410x1){_0x1916be['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb39c('0x5f')](_0x779182),null);}else{if(qs[_0xb39c('0x60')](_0x779182)){_0x1916be['or'](_0xb39c('0x61'),_0x779182+'%');_0x1916be['or'](_0xb39c('0x62'),_0x779182+'%');_0x1916be['or'](_0xb39c('0x63'),_0x779182+'%');_0x1916be['or'](_0xb39c('0x64'),_0x779182+'%');}else if(qs[_0xb39c('0x65')](_0x779182)){_0x1916be['or']('c.email\x20LIKE\x20?',_0x779182+'%');}else{_0x1916be['or'](_0xb39c('0x66'),'%'+_0x779182+'%');_0x1916be['or'](_0xb39c('0x67'),'%'+_0x779182+'%');_0x1916be['or'](_0xb39c('0x68'),'%'+_0x779182+'%');}}}}_0x2d870c['where'](_0x1916be);_0x2d870c[_0xb39c('0x69')](_0xb39c('0x6a'));var _0x3b9203={'type':db[_0xb39c('0x6b')][_0xb39c('0x6c')][_0xb39c('0x6d')],'raw':!![]};var _0x16dc74=_0x2d870c['clone']()[_0xb39c('0x36')](_0xb39c('0x6a'));if(_0x1af7ae[_0xb39c('0x30')]){_0x1af7ae['order'][_0xb39c('0x48')](function(_0x8037ff){_0x2d870c[_0xb39c('0x30')]('c.'+_0x8037ff[0x0],_0x8037ff[0x1]===_0xb39c('0x6e')?![]:!![]);});}if(!_[_0xb39c('0x56')](_0x290ed6)){_0x2d870c[_0xb39c('0x6f')](_0xb9b7d5);_0x16dc74[_0xb39c('0x32')]('t.id\x20IN\x20?',_0x290ed6);}BPromise[_0xb39c('0x70')]()['then'](function(){if(!_0xef8f0a)return;if(_0x89aa99[_0xb39c('0x71')][_0xb39c('0x72')]!==_0xb39c('0x73'))return;if(!_[_0xb39c('0x74')](_0xef8f0a[_0xb39c('0x43')],[_0xb39c('0x36'),_0xb39c('0x4a')])){return _0x89aa99[_0xb39c('0x71')][_0xb39c('0x75')]({'attributes':['id'],'raw':!![]})[_0xb39c('0x18')](function(_0x5a481a){if(_[_0xb39c('0x56')](_0x5a481a)){_0x16dc74[_0xb39c('0x32')](_0xb39c('0x76'));_0x2d870c[_0xb39c('0x32')]('c.ListId\x20IS\x20NULL');}else{_0x16dc74[_0xb39c('0x32')](_0xb39c('0x58'),_['map'](_0x5a481a,'id'));_0x2d870c['where'](_0xb39c('0x58'),_[_0xb39c('0x47')](_0x5a481a,'id'));}});}})[_0xb39c('0x18')](function(){if(_0x89aa99[_0xb39c('0x71')]['role']===_0xb39c('0x73')&&!_0xef8f0a&&!_0x89aa99[_0xb39c('0x2c')]['ListId'])return[];return db[_0xb39c('0x77')][_0xb39c('0x2c')](_0x16dc74[_0xb39c('0x78')](),_0x3b9203);})[_0xb39c('0x18')](function(_0x3eb6c0){_0x5d8be3[_0xb39c('0x16')]=_0x3eb6c0['length'];if(_0x5d8be3[_0xb39c('0x16')]===0x0)return[];return db['sequelize'][_0xb39c('0x2c')](_0x3094b3[_0xb39c('0x78')](),_0x3b9203)['then'](function(_0x50d2ea){_0x2e8b09=_[_0xb39c('0x79')](_0x50d2ea,'id');_0x3b9203=_['merge'](_0x3b9203,{'model':db[_0xb39c('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x89aa99['query'][_0xb39c('0x2e')]){_0x1af7ae['attributes'][_0xb39c('0x48')](function(_0x33f7d8){_0x2d870c['field']('c.'+_0x33f7d8);});}else{_0x2d870c[_0xb39c('0x36')](_0xb39c('0x6a'));_0x2d870c[_0xb39c('0x36')](_0xb39c('0x7a'));_0x2d870c[_0xb39c('0x36')]('c.lastName');_0x2d870c['field'](_0xb39c('0x7b'));_0x2d870c['field'](_0xb39c('0x7c'));_0x2d870c[_0xb39c('0x36')](_0xb39c('0x7d'));_0x2d870c[_0xb39c('0x36')]('c.email');_0x2d870c['field']('c.ListId');_0x2d870c['field'](_0xb39c('0x7e'));_0x2d870c['field'](_0xb39c('0x7f'));_0x2d870c[_0xb39c('0x36')]('c.CompanyId');_0x2d870c[_0xb39c('0x36')](_0xb39c('0x80'),_0xb39c('0x81'));}if(_0x1af7ae['limit'])_0x2d870c[_0xb39c('0x15')](_0x1af7ae[_0xb39c('0x15')]);if(_0x1af7ae[_0xb39c('0x13')])_0x2d870c['offset'](_0x1af7ae[_0xb39c('0x13')]);return db[_0xb39c('0x77')][_0xb39c('0x2c')](_0x2d870c['toString'](),_0x3b9203);});})[_0xb39c('0x18')](function(_0x2c8c57){_0x2c8c57[_0xb39c('0x48')](function(_0x211bb2){if(_0x211bb2['TagIds']){_0x211bb2[_0xb39c('0x82')]=[];_0x211bb2[_0xb39c('0x81')][_0xb39c('0x46')](',')[_0xb39c('0x48')](function(_0x167870){_0x211bb2['Tags'][_0xb39c('0x55')](_0x2e8b09[_0x167870]);});}delete _0x211bb2[_0xb39c('0x81')];});_0x5d8be3['rows']=_0x2c8c57;return _0x5d8be3;})['then'](respondWithFilteredResult(_0xb8ba59,_0x1af7ae));})[_0xb39c('0x83')](handleError(_0xb8ba59,null));};exports['destroy']=function(_0xd7595,_0x1d541c){return db[_0xb39c('0x1f')][_0xb39c('0x84')]({'where':{'id':_0xd7595['params']['id']}})['then'](handleEntityNotFound(_0x1d541c,null))[_0xb39c('0x18')](removeEntity(_0x1d541c,null))[_0xb39c('0x83')](handleError(_0x1d541c,null));};exports[_0xb39c('0x20')]=function(_0x407586,_0x42ac18){return db[_0xb39c('0x1f')][_0xb39c('0x20')]()[_0xb39c('0x18')](function(_0x2ece37){delete _0x2ece37[_0xb39c('0x85')];for(var _0x2ad256=0x0;_0x2ad256=_0x45a360){_0x13a685=_0x45a360;_0x1eb683=0xc8;}else{_0x1eb683=0xce;}_0x3772ee[_0x4816('0x13')](_0x1eb683);return _0x3772ee[_0x4816('0x14')](_0x4816('0x15'),_0xf66470+'-'+_0x13a685+'/'+_0x45a360)[_0x4816('0xe')](_0x27bc3e);}return null;};}function saveUpdates(_0x4678a9){return function(_0x6119f){if(_0x6119f){return _0x6119f[_0x4816('0x16')](_0x4678a9)[_0x4816('0x17')](function(_0x5c446b){return _0x5c446b;});}return null;};}function removeEntity(_0x4803d0){return function(_0x5b54d4){if(_0x5b54d4){return _0x5b54d4[_0x4816('0x18')]()[_0x4816('0x17')](function(){_0x4803d0[_0x4816('0x13')](0xcc)[_0x4816('0x19')]();});}};}function handleEntityNotFound(_0xc8ffd5){return function(_0x37effd){if(!_0x37effd){_0xc8ffd5[_0x4816('0x1a')](0x194);}return _0x37effd;};}function handleError(_0x121522,_0x3df423){_0x3df423=_0x3df423||0x1f4;return function(_0x53189e){logger[_0x4816('0x1b')](_0x53189e['stack']);if(_0x53189e['name']){delete _0x53189e[_0x4816('0x1c')];}_0x121522[_0x4816('0x13')](_0x3df423)['send'](_0x53189e);};}exports[_0x4816('0x1d')]=function(_0x576221,_0x46eb06){var _0x41d7f0={},_0x571c81={},_0x504851={'count':0x0,'rows':[]};return db[_0x4816('0x1e')][_0x4816('0x1f')]()[_0x4816('0x17')](function(_0x47fd5d){var _0x9b1a4c=[];for(var _0x427054=0x0;_0x4270540x1){_0x48b8f0['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4816('0x5f')](_0x3f6bf2),null);}else{if(qs[_0x4816('0x60')](_0x3f6bf2)){_0x48b8f0['or']('c.id\x20LIKE\x20?',_0x3f6bf2+'%');_0x48b8f0['or'](_0x4816('0x61'),_0x3f6bf2+'%');_0x48b8f0['or'](_0x4816('0x62'),_0x3f6bf2+'%');_0x48b8f0['or'](_0x4816('0x63'),_0x3f6bf2+'%');}else if(qs[_0x4816('0x64')](_0x3f6bf2)){_0x48b8f0['or'](_0x4816('0x65'),_0x3f6bf2+'%');}else{_0x48b8f0['or']('c.firstName\x20LIKE\x20?','%'+_0x3f6bf2+'%');_0x48b8f0['or'](_0x4816('0x66'),'%'+_0x3f6bf2+'%');_0x48b8f0['or'](_0x4816('0x65'),'%'+_0x3f6bf2+'%');}}}}_0x8a3366[_0x4816('0x3d')](_0x48b8f0);_0x8a3366[_0x4816('0x67')](_0x4816('0x68'));var _0x231c80={'type':db['Sequelize'][_0x4816('0x69')][_0x4816('0x6a')],'raw':!![]};var _0x266395=_0x8a3366['clone']()[_0x4816('0x32')](_0x4816('0x68'));if(_0x41d7f0[_0x4816('0x2f')]){_0x41d7f0['order'][_0x4816('0x46')](function(_0x1f790b){_0x8a3366[_0x4816('0x2f')]('c.'+_0x1f790b[0x0],_0x1f790b[0x1]===_0x4816('0x6b')?![]:!![]);});}if(!_['isEmpty'](_0x292669)){_0x8a3366[_0x4816('0x6c')](_0x4cbb05);_0x266395[_0x4816('0x3d')](_0x4816('0x6d'),_0x292669);}BPromise['resolve']()['then'](function(){if(!_0x140a7e)return;if(_0x576221[_0x4816('0x6e')][_0x4816('0x6f')]!==_0x4816('0x70'))return;if(!_[_0x4816('0x71')](_0x140a7e[_0x4816('0x42')],[_0x4816('0x32'),_0x4816('0x49')])){return _0x576221['user'][_0x4816('0x72')]({'attributes':['id'],'raw':!![]})[_0x4816('0x17')](function(_0x38e74b){if(_['isEmpty'](_0x38e74b)){_0x266395[_0x4816('0x3d')](_0x4816('0x73'));_0x8a3366[_0x4816('0x3d')](_0x4816('0x73'));}else{_0x266395[_0x4816('0x3d')](_0x4816('0x58'),_[_0x4816('0x45')](_0x38e74b,'id'));_0x8a3366['where'](_0x4816('0x58'),_[_0x4816('0x45')](_0x38e74b,'id'));}});}})[_0x4816('0x17')](function(){if(_0x576221['user'][_0x4816('0x6f')]===_0x4816('0x70')&&!_0x140a7e&&!_0x576221['query'][_0x4816('0x57')])return[];return db[_0x4816('0x74')][_0x4816('0x29')](_0x266395[_0x4816('0x75')](),_0x231c80);})[_0x4816('0x17')](function(_0x3ffcf4){_0x504851[_0x4816('0x11')]=_0x3ffcf4['length'];if(_0x504851[_0x4816('0x11')]===0x0)return[];return db['sequelize']['query'](_0x428370['toString'](),_0x231c80)['then'](function(_0x553093){_0x543db3=_[_0x4816('0x76')](_0x553093,'id');_0x231c80=_[_0x4816('0x77')](_0x231c80,{'model':db[_0x4816('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x576221['query'][_0x4816('0x2b')]){_0x41d7f0[_0x4816('0x2c')][_0x4816('0x46')](function(_0x1b9745){_0x8a3366[_0x4816('0x32')]('c.'+_0x1b9745);});}else{_0x8a3366[_0x4816('0x32')](_0x4816('0x68'));_0x8a3366['field'](_0x4816('0x78'));_0x8a3366['field'](_0x4816('0x79'));_0x8a3366[_0x4816('0x32')](_0x4816('0x7a'));_0x8a3366[_0x4816('0x32')](_0x4816('0x7b'));_0x8a3366[_0x4816('0x32')]('c.fax');_0x8a3366[_0x4816('0x32')](_0x4816('0x7c'));_0x8a3366[_0x4816('0x32')]('c.ListId');_0x8a3366[_0x4816('0x32')](_0x4816('0x7d'));_0x8a3366[_0x4816('0x32')]('c.deletedAt');_0x8a3366[_0x4816('0x32')](_0x4816('0x7e'));_0x8a3366[_0x4816('0x32')](_0x4816('0x7f'),_0x4816('0x80'));}if(_0x41d7f0[_0x4816('0x12')])_0x8a3366[_0x4816('0x12')](_0x41d7f0['limit']);if(_0x41d7f0[_0x4816('0x10')])_0x8a3366[_0x4816('0x10')](_0x41d7f0[_0x4816('0x10')]);return db[_0x4816('0x74')][_0x4816('0x29')](_0x8a3366[_0x4816('0x75')](),_0x231c80);});})[_0x4816('0x17')](function(_0x4abba0){_0x4abba0[_0x4816('0x46')](function(_0x247b48){if(_0x247b48[_0x4816('0x80')]){_0x247b48[_0x4816('0x81')]=[];_0x247b48['TagIds'][_0x4816('0x82')](',')[_0x4816('0x46')](function(_0x46f5f4){_0x247b48[_0x4816('0x81')][_0x4816('0x83')](_0x543db3[_0x46f5f4]);});}delete _0x247b48[_0x4816('0x80')];});_0x504851[_0x4816('0x84')]=_0x4abba0;return _0x504851;})[_0x4816('0x17')](respondWithFilteredResult(_0x46eb06,_0x41d7f0));})[_0x4816('0x85')](handleError(_0x46eb06,null));};exports[_0x4816('0x18')]=function(_0x436d35,_0x3f6c62){return db[_0x4816('0x1e')]['find']({'where':{'id':_0x436d35[_0x4816('0x86')]['id']}})[_0x4816('0x17')](handleEntityNotFound(_0x3f6c62,null))[_0x4816('0x17')](removeEntity(_0x3f6c62,null))[_0x4816('0x85')](handleError(_0x3f6c62,null));};exports[_0x4816('0x1f')]=function(_0x35093e,_0x12d58f){return db[_0x4816('0x1e')][_0x4816('0x1f')]()[_0x4816('0x17')](function(_0x359a0d){delete _0x359a0d[_0x4816('0x87')];for(var _0xf439b3=0x0;_0xf439b3{}\s\\|]/g,'-');_0x4707e6(null,util['format'](_0xef18('0x24'),path[_0xef18('0x25')](_0x573fa3['originalname'],path['extname'](_0x573fa3[_0xef18('0x22')])),Date[_0xef18('0x26')](),path[_0xef18('0x27')](_0x573fa3[_0xef18('0x22')])));}})});router[_0xef18('0x19')](_0xef18('0x28'),upload[_0xef18('0x29')](_0xef18('0x2a')),controller[_0xef18('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ce9d6,_0x1df971,_0x114f67){_0x114f67(null,path['join'](config[_0xef18('0x2c')],_0xef18('0x21')));},'filename':function(_0x421f6d,_0x4f455a,_0xbd0856){_0x4f455a[_0xef18('0x22')]=_0x4f455a['originalname'][_0xef18('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xbd0856(null,util[_0xef18('0x2d')]('%s-%s%s',path[_0xef18('0x25')](_0x4f455a[_0xef18('0x22')],path[_0xef18('0x27')](_0x4f455a[_0xef18('0x22')])),Date['now'](),path[_0xef18('0x27')](_0x4f455a['originalname'])));}})});router[_0xef18('0x19')](_0xef18('0x2e'),upload[_0xef18('0x29')](_0xef18('0x2a')),controller[_0xef18('0x2f')]);router[_0xef18('0x19')](_0xef18('0x30'),auth[_0xef18('0xb')](),controller['import']);router['put'](_0xef18('0x31'),auth[_0xef18('0xb')](),controller[_0xef18('0x32')]);router[_0xef18('0x33')](_0xef18('0x31'),auth[_0xef18('0xb')](),controller[_0xef18('0x34')]);module[_0xef18('0x35')]=router; \ No newline at end of file +var _0x8136=['setTags','diskStorage','join','root','originalname','%s-%s%s','basename','extname','now','single','file','uploadCsv','server/files/tmp','replace','format','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','merge','post','bulkCreate'];(function(_0x2e0854,_0x52544a){var _0x4d0ff9=function(_0x3647fb){while(--_0x3647fb){_0x2e0854['push'](_0x2e0854['shift']());}};_0x4d0ff9(++_0x52544a);}(_0x8136,0x184));var _0x6813=function(_0x4b1e59,_0x3fa537){_0x4b1e59=_0x4b1e59-0x0;var _0x381330=_0x8136[_0x4b1e59];return _0x381330;};'use strict';var multer=require('multer');var util=require(_0x6813('0x0'));var path=require(_0x6813('0x1'));var timeout=require(_0x6813('0x2'));var express=require(_0x6813('0x3'));var router=express[_0x6813('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6813('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6813('0x6'));var controller=require(_0x6813('0x7'));router[_0x6813('0x8')]('/',auth[_0x6813('0x9')](),controller[_0x6813('0xa')]);router[_0x6813('0x8')](_0x6813('0xb'),auth[_0x6813('0x9')](),controller[_0x6813('0xc')]);router[_0x6813('0x8')](_0x6813('0xd'),auth[_0x6813('0x9')](),controller[_0x6813('0xe')]);router[_0x6813('0x8')](_0x6813('0xf'),auth[_0x6813('0x9')](),controller[_0x6813('0x10')]);router[_0x6813('0x8')](_0x6813('0x11'),auth[_0x6813('0x9')](),controller[_0x6813('0x12')]);router[_0x6813('0x8')](_0x6813('0x13'),auth[_0x6813('0x9')](),controller['getHopperHistories']);router[_0x6813('0x8')](_0x6813('0x14'),auth['isAuthenticated'](),controller[_0x6813('0x15')]);router['get'](_0x6813('0x16'),auth['isAuthenticated'](),controller[_0x6813('0x17')]);router[_0x6813('0x8')](_0x6813('0x18'),auth[_0x6813('0x9')](),controller['getJourney']);router['post']('/merge',auth[_0x6813('0x9')](),controller[_0x6813('0x19')]);router[_0x6813('0x1a')]('/',auth[_0x6813('0x9')](),controller['create']);router[_0x6813('0x1a')]('/create_many',auth['isAuthenticated'](),controller[_0x6813('0x1b')]);router[_0x6813('0x1a')](_0x6813('0xf'),auth[_0x6813('0x9')](),controller[_0x6813('0x1c')]);var upload=multer({'storage':multer[_0x6813('0x1d')]({'destination':function(_0x48d3ab,_0x52e7aa,_0x4f4b1a){_0x4f4b1a(null,path[_0x6813('0x1e')](config[_0x6813('0x1f')],'server/files/tmp'));},'filename':function(_0x1c7b84,_0x2aba60,_0x55b055){_0x2aba60[_0x6813('0x20')]=_0x2aba60[_0x6813('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x55b055(null,util['format'](_0x6813('0x21'),path[_0x6813('0x22')](_0x2aba60[_0x6813('0x20')],path[_0x6813('0x23')](_0x2aba60[_0x6813('0x20')])),Date[_0x6813('0x24')](),path[_0x6813('0x23')](_0x2aba60[_0x6813('0x20')])));}})});router[_0x6813('0x1a')]('/csv',upload[_0x6813('0x25')](_0x6813('0x26')),controller[_0x6813('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27d890,_0x4f402b,_0x219d78){_0x219d78(null,path['join'](config[_0x6813('0x1f')],_0x6813('0x28')));},'filename':function(_0xdee474,_0x51789b,_0x18542b){_0x51789b[_0x6813('0x20')]=_0x51789b[_0x6813('0x20')][_0x6813('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x18542b(null,util[_0x6813('0x2a')](_0x6813('0x21'),path[_0x6813('0x22')](_0x51789b[_0x6813('0x20')],path[_0x6813('0x23')](_0x51789b['originalname'])),Date[_0x6813('0x24')](),path[_0x6813('0x23')](_0x51789b['originalname'])));}})});router['post'](_0x6813('0x2b'),upload['single'](_0x6813('0x26')),controller[_0x6813('0x2c')]);router['post'](_0x6813('0x2d'),auth[_0x6813('0x9')](),controller[_0x6813('0x2e')]);router[_0x6813('0x2f')](_0x6813('0xd'),auth['isAuthenticated'](),controller[_0x6813('0x30')]);router[_0x6813('0x31')](_0x6813('0xd'),auth[_0x6813('0x9')](),controller[_0x6813('0x32')]);module[_0x6813('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9888a03..213fd1d 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 _0xb89f=['sequelize','lodash','exports','VIRTUAL','STRING','getDataValue','name','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0xb89f,0x134));var _0xfb89=function(_0x51c08e,_0x4c4d20){_0x51c08e=_0x51c08e-0x0;var _0x4e08c1=_0xb89f[_0x51c08e];return _0x4e08c1;};'use strict';var Sequelize=require(_0xfb89('0x0'));var _=require(_0xfb89('0x1'));module[_0xfb89('0x2')]={'name':{'type':Sequelize[_0xfb89('0x3')],'get':function(_0x176797){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xfb89('0x4')],'allowNull':![],'set':function(_0x58b61b){this['setDataValue']('alias',_0x58b61b?_0x58b61b:this[_0xfb89('0x5')](_0xfb89('0x6')));}},'type':{'type':Sequelize[_0xfb89('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xfb89('0x5')]('type')==='select'){return JSON['parse'](this['getDataValue'](_0xfb89('0x7')));}else{return this[_0xfb89('0x5')](_0xfb89('0x7'));}},'set':function(_0x590aa5){if(Array[_0xfb89('0x8')](_0x590aa5)){this[_0xfb89('0x9')]('values',JSON[_0xfb89('0xa')](_0x590aa5));}else{this[_0xfb89('0x9')](_0xfb89('0x7'),_0x590aa5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfb89('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfb89('0xc')](_0xfb89('0xd'))}}; \ No newline at end of file +var _0x72cd=['stringify','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type','parse','values'];(function(_0x1a597e,_0x17d4a8){var _0x2041a8=function(_0x2a7f4d){while(--_0x2a7f4d){_0x1a597e['push'](_0x1a597e['shift']());}};_0x2041a8(++_0x17d4a8);}(_0x72cd,0x1d0));var _0xd72c=function(_0x1ac107,_0x4f47ef){_0x1ac107=_0x1ac107-0x0;var _0xbf1df6=_0x72cd[_0x1ac107];return _0xbf1df6;};'use strict';var Sequelize=require(_0xd72c('0x0'));var _=require(_0xd72c('0x1'));module['exports']={'name':{'type':Sequelize[_0xd72c('0x2')],'get':function(_0x252c18){return this[_0xd72c('0x3')](_0xd72c('0x4'));}},'alias':{'type':Sequelize[_0xd72c('0x5')],'allowNull':![],'set':function(_0x5b422c){this[_0xd72c('0x6')](_0xd72c('0x4'),_0x5b422c?_0x5b422c:this[_0xd72c('0x3')](_0xd72c('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xd72c('0x8')),'get':function(){if(this[_0xd72c('0x3')](_0xd72c('0x9'))==='select'){return JSON[_0xd72c('0xa')](this[_0xd72c('0x3')](_0xd72c('0xb')));}else{return this[_0xd72c('0x3')](_0xd72c('0xb'));}},'set':function(_0x3c27dd){if(Array['isArray'](_0x3c27dd)){this[_0xd72c('0x6')](_0xd72c('0xb'),JSON[_0xd72c('0xc')](_0x3c27dd));}else{this['setDataValue'](_0xd72c('0xb'),_0x3c27dd);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd72c('0xd')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d9608d5..6d92e3b 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 _0xe89d=['length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','CmCustomField','rawAttributes','type','differenceBy','query','filters','intersection','model','attributes','fields'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xe89d,0x7a));var _0xde89=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xe89d[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require(_0xde89('0x0'));var rimraf=require(_0xde89('0x1'));var zipdir=require(_0xde89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde89('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde89('0x4'));var util=require(_0xde89('0x5'));var path=require('path');var sox=require(_0xde89('0x6'));var csv=require(_0xde89('0x7'));var ejs=require(_0xde89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde89('0x9'));var squel=require(_0xde89('0xa'));var crypto=require('crypto');var jsforce=require(_0xde89('0xb'));var deskjs=require(_0xde89('0xc'));var toCsv=require(_0xde89('0x7'));var querystring=require(_0xde89('0xd'));var Papa=require(_0xde89('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde89('0xf'));var as=require(_0xde89('0x10'));var hardwareService=require(_0xde89('0x11'));var logger=require('../../config/logger')(_0xde89('0x12'));var utils=require(_0xde89('0x13'));var config=require(_0xde89('0x14'));var licenseUtil=require(_0xde89('0x15'));var db=require(_0xde89('0x16'))['db'];function respondWithStatusCode(_0x2bf172,_0x1f94fd){_0x1f94fd=_0x1f94fd||0xcc;return function(_0x2b39a6){if(_0x2b39a6){return _0x2bf172[_0xde89('0x17')](_0x1f94fd);}return _0x2bf172[_0xde89('0x18')](_0x1f94fd)['end']();};}function respondWithResult(_0x4d2f91,_0x583375){_0x583375=_0x583375||0xc8;return function(_0x2ffcea){if(_0x2ffcea){return _0x4d2f91[_0xde89('0x18')](_0x583375)[_0xde89('0x19')](_0x2ffcea);}};}function respondWithFilteredResult(_0x3ab301,_0x3cf12c){return function(_0x5d60f0){if(_0x5d60f0){var _0x1347c3=typeof _0x3cf12c[_0xde89('0x1a')]===_0xde89('0x1b')&&typeof _0x3cf12c['limit']==='undefined';var _0xea2ec8=_0x5d60f0['count'];var _0x5c99a0=_0x1347c3?0x0:_0x3cf12c[_0xde89('0x1a')];var _0x56266f=_0x1347c3?_0x5d60f0[_0xde89('0x1c')]:_0x3cf12c['offset']+_0x3cf12c[_0xde89('0x1d')];var _0x5e2696;if(_0x56266f>=_0xea2ec8){_0x56266f=_0xea2ec8;_0x5e2696=0xc8;}else{_0x5e2696=0xce;}_0x3ab301[_0xde89('0x18')](_0x5e2696);return _0x3ab301[_0xde89('0x1e')](_0xde89('0x1f'),_0x5c99a0+'-'+_0x56266f+'/'+_0xea2ec8)[_0xde89('0x19')](_0x5d60f0);}return null;};}function patchUpdates(_0x4d2eee){return function(_0x19f161){try{jsonpatch[_0xde89('0x20')](_0x19f161,_0x4d2eee,!![]);}catch(_0xa108d0){return BPromise[_0xde89('0x21')](_0xa108d0);}return _0x19f161[_0xde89('0x22')]();};}function saveUpdates(_0x8200b2,_0x5b883e){return function(_0x1c288d){if(_0x1c288d){return _0x1c288d[_0xde89('0x23')](_0x8200b2)[_0xde89('0x24')](function(_0x56dd5b){return _0x56dd5b;});}return null;};}function removeEntity(_0x3180f5,_0x880fbf){return function(_0x1cac6d){if(_0x1cac6d){return _0x1cac6d[_0xde89('0x25')]()[_0xde89('0x24')](function(){_0x3180f5[_0xde89('0x18')](0xcc)[_0xde89('0x26')]();});}};}function handleEntityNotFound(_0x5e26bb,_0x45993c){return function(_0x16d882){if(!_0x16d882){_0x5e26bb[_0xde89('0x17')](0x194);}return _0x16d882;};}function handleError(_0x1b4a66,_0x4a9707){_0x4a9707=_0x4a9707||0x1f4;return function(_0x5be49e){logger[_0xde89('0x27')](_0x5be49e[_0xde89('0x28')]);if(_0x5be49e[_0xde89('0x29')]){delete _0x5be49e[_0xde89('0x29')];}_0x1b4a66[_0xde89('0x18')](_0x4a9707)['send'](_0x5be49e);};}exports[_0xde89('0x2a')]=function(_0x1bbd75,_0x18a8de){var _0xa49b46={},_0x59e54c={},_0x283d67={'count':0x0,'rows':[]};var _0xbb4db3=_[_0xde89('0x2b')](db[_0xde89('0x2c')][_0xde89('0x2d')],function(_0x158200){return{'name':_0x158200['fieldName'],'type':_0x158200[_0xde89('0x2e')]['key']};});_0x59e54c['model']=_[_0xde89('0x2f')](_[_0xde89('0x2b')](_0xbb4db3,_0xde89('0x29')),['name']);_0x59e54c['query']=_['keys'](_0x1bbd75[_0xde89('0x30')]);_0x59e54c[_0xde89('0x31')]=_[_0xde89('0x32')](_0x59e54c[_0xde89('0x33')],_0x59e54c[_0xde89('0x30')]);_0xa49b46[_0xde89('0x34')]=_[_0xde89('0x32')](_0x59e54c[_0xde89('0x33')],qs[_0xde89('0x35')](_0x1bbd75[_0xde89('0x30')][_0xde89('0x35')]));_0xa49b46[_0xde89('0x34')]=_0xa49b46[_0xde89('0x34')][_0xde89('0x36')]?_0xa49b46['attributes']:_0x59e54c[_0xde89('0x33')];if(!_0x1bbd75[_0xde89('0x30')][_0xde89('0x37')](_0xde89('0x38'))){_0xa49b46[_0xde89('0x1d')]=qs[_0xde89('0x1d')](_0x1bbd75['query']['limit']);_0xa49b46['offset']=qs['offset'](_0x1bbd75['query'][_0xde89('0x1a')]);}_0xa49b46[_0xde89('0x39')]=qs['sort'](_0x1bbd75[_0xde89('0x30')]['sort']);_0xa49b46[_0xde89('0x3a')]=qs['filters'](_['pick'](_0x1bbd75[_0xde89('0x30')],_0x59e54c[_0xde89('0x31')]),_0xbb4db3);if(_0x1bbd75[_0xde89('0x30')][_0xde89('0x3b')]){_0xa49b46[_0xde89('0x3a')]=_[_0xde89('0x3c')](_0xa49b46[_0xde89('0x3a')],{'$or':_['map'](_0xbb4db3,function(_0x42853c){if(_0x42853c['type']!==_0xde89('0x3d')){var _0x3e4b3f={};_0x3e4b3f[_0x42853c[_0xde89('0x29')]]={'$like':'%'+_0x1bbd75[_0xde89('0x30')]['filter']+'%'};return _0x3e4b3f;}})});}_0xa49b46=_['merge']({},_0xa49b46,_0x1bbd75[_0xde89('0x3e')]);var _0x1f3f8b={'where':_0xa49b46['where']};return db[_0xde89('0x2c')][_0xde89('0x1c')](_0x1f3f8b)[_0xde89('0x24')](function(_0x582043){_0x283d67[_0xde89('0x1c')]=_0x582043;if(_0x1bbd75[_0xde89('0x30')][_0xde89('0x3f')]){_0xa49b46[_0xde89('0x40')]=[{'all':!![]}];}return db[_0xde89('0x2c')][_0xde89('0x41')](_0xa49b46);})['then'](function(_0x12abdb){_0x283d67[_0xde89('0x42')]=_0x12abdb;return _0x283d67;})[_0xde89('0x24')](respondWithFilteredResult(_0x18a8de,_0xa49b46))[_0xde89('0x43')](handleError(_0x18a8de,null));};exports[_0xde89('0x44')]=function(_0x502876,_0xa208e5){var _0x3eb337={'raw':!![],'where':{'id':_0x502876[_0xde89('0x45')]['id']}},_0x25e202={};_0x25e202[_0xde89('0x33')]=_[_0xde89('0x46')](db[_0xde89('0x2c')][_0xde89('0x2d')]);_0x25e202['query']=_[_0xde89('0x46')](_0x502876[_0xde89('0x30')]);_0x25e202[_0xde89('0x31')]=_[_0xde89('0x32')](_0x25e202[_0xde89('0x33')],_0x25e202[_0xde89('0x30')]);_0x3eb337[_0xde89('0x34')]=_['intersection'](_0x25e202[_0xde89('0x33')],qs[_0xde89('0x35')](_0x502876['query'][_0xde89('0x35')]));_0x3eb337[_0xde89('0x34')]=_0x3eb337[_0xde89('0x34')][_0xde89('0x36')]?_0x3eb337['attributes']:_0x25e202[_0xde89('0x33')];if(_0x502876[_0xde89('0x30')][_0xde89('0x3f')]){_0x3eb337[_0xde89('0x40')]=[{'all':!![]}];}_0x3eb337=_[_0xde89('0x3c')]({},_0x3eb337,_0x502876[_0xde89('0x3e')]);return db['CmCustomField']['find'](_0x3eb337)['then'](handleEntityNotFound(_0xa208e5,null))[_0xde89('0x24')](respondWithResult(_0xa208e5,null))['catch'](handleError(_0xa208e5,null));};exports[_0xde89('0x23')]=function(_0x4d2bae,_0x36bd84){if(_0x4d2bae['body']['id']){delete _0x4d2bae[_0xde89('0x47')]['id'];}return db[_0xde89('0x2c')][_0xde89('0x48')]({'where':{'id':_0x4d2bae[_0xde89('0x45')]['id']}})[_0xde89('0x24')](handleEntityNotFound(_0x36bd84,null))[_0xde89('0x24')](saveUpdates(_0x4d2bae[_0xde89('0x47')],null))[_0xde89('0x24')](respondWithResult(_0x36bd84,null))['catch'](handleError(_0x36bd84,null));};exports[_0xde89('0x25')]=function(_0x37cb3c,_0x43a01b){return db['CmCustomField'][_0xde89('0x48')]({'where':{'id':_0x37cb3c[_0xde89('0x45')]['id']}})['then'](handleEntityNotFound(_0x43a01b,null))[_0xde89('0x24')](removeEntity(_0x43a01b,null))[_0xde89('0x43')](handleError(_0x43a01b,null));};exports[_0xde89('0x49')]=function(_0x459eae,_0x15772c){var _0x2078d3;return db[_0xde89('0x4a')][_0xde89('0x4b')](function(_0x52a595){return db['CmCustomField'][_0xde89('0x49')](_0x459eae[_0xde89('0x47')],{'transaction':_0x52a595})[_0xde89('0x24')](function(_0x46d6fe){_0x2078d3=_0x46d6fe;var _0x16af4a={'type':db[_0xde89('0x4c')][_0xde89('0x4d')],'transaction':_0x52a595};switch(_0x459eae[_0xde89('0x47')]['type']){case _0xde89('0x4e'):_0x16af4a['type']=db[_0xde89('0x4c')][_0xde89('0x4d')];break;case _0xde89('0x4f'):_0x16af4a[_0xde89('0x2e')]=db[_0xde89('0x4c')][_0xde89('0x50')];break;case _0xde89('0x51'):_0x16af4a['type']=db[_0xde89('0x4c')][_0xde89('0x52')];_0x16af4a[_0xde89('0x53')]=![];break;default:}return db['sequelize'][_0xde89('0x54')]['addColumn'](_0xde89('0x55'),util[_0xde89('0x56')](_0xde89('0x57'),_0x2078d3['id']),_0x16af4a);})[_0xde89('0x24')](function(){return _0x2078d3;});})[_0xde89('0x24')](respondWithResult(_0x15772c,0xc9))[_0xde89('0x43')](handleError(_0x15772c,null));}; \ No newline at end of file +var _0x5444=['keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','catch','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x11b955,_0x50f032){var _0x58f3b1=function(_0x1e45ef){while(--_0x1e45ef){_0x11b955['push'](_0x11b955['shift']());}};_0x58f3b1(++_0x50f032);}(_0x5444,0x181));var _0x4544=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5444[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4544('0x0'));var rimraf=require(_0x4544('0x1'));var zipdir=require(_0x4544('0x2'));var jsonpatch=require(_0x4544('0x3'));var rp=require(_0x4544('0x4'));var moment=require('moment');var BPromise=require(_0x4544('0x5'));var Mustache=require(_0x4544('0x6'));var util=require('util');var path=require(_0x4544('0x7'));var sox=require(_0x4544('0x8'));var csv=require(_0x4544('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4544('0xa'));var _=require(_0x4544('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4544('0xc'));var deskjs=require(_0x4544('0xd'));var toCsv=require(_0x4544('0x9'));var querystring=require(_0x4544('0xe'));var Papa=require('papaparse');var Redis=require(_0x4544('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4544('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4544('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4544('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4544('0x13'));var db=require(_0x4544('0x14'))['db'];function respondWithStatusCode(_0x1ba490,_0x452a6e){_0x452a6e=_0x452a6e||0xcc;return function(_0x50aa58){if(_0x50aa58){return _0x1ba490['sendStatus'](_0x452a6e);}return _0x1ba490[_0x4544('0x15')](_0x452a6e)[_0x4544('0x16')]();};}function respondWithResult(_0x2fe0a9,_0x12d27b){_0x12d27b=_0x12d27b||0xc8;return function(_0x1b2e6c){if(_0x1b2e6c){return _0x2fe0a9[_0x4544('0x15')](_0x12d27b)[_0x4544('0x17')](_0x1b2e6c);}};}function respondWithFilteredResult(_0x7507ce,_0x2c6647){return function(_0x32aa03){if(_0x32aa03){var _0x204932=typeof _0x2c6647[_0x4544('0x18')]==='undefined'&&typeof _0x2c6647[_0x4544('0x19')]==='undefined';var _0x3101e0=_0x32aa03[_0x4544('0x1a')];var _0x61d5c5=_0x204932?0x0:_0x2c6647[_0x4544('0x18')];var _0x4ee9a3=_0x204932?_0x32aa03[_0x4544('0x1a')]:_0x2c6647['offset']+_0x2c6647['limit'];var _0x4e6ae6;if(_0x4ee9a3>=_0x3101e0){_0x4ee9a3=_0x3101e0;_0x4e6ae6=0xc8;}else{_0x4e6ae6=0xce;}_0x7507ce['status'](_0x4e6ae6);return _0x7507ce[_0x4544('0x1b')](_0x4544('0x1c'),_0x61d5c5+'-'+_0x4ee9a3+'/'+_0x3101e0)['json'](_0x32aa03);}return null;};}function patchUpdates(_0x480017){return function(_0x28ea60){try{jsonpatch[_0x4544('0x1d')](_0x28ea60,_0x480017,!![]);}catch(_0x158613){return BPromise[_0x4544('0x1e')](_0x158613);}return _0x28ea60[_0x4544('0x1f')]();};}function saveUpdates(_0x54ae5b,_0x5ab777){return function(_0x180500){if(_0x180500){return _0x180500[_0x4544('0x20')](_0x54ae5b)[_0x4544('0x21')](function(_0x88f352){return _0x88f352;});}return null;};}function removeEntity(_0x371fa5,_0x833d76){return function(_0x307f28){if(_0x307f28){return _0x307f28['destroy']()[_0x4544('0x21')](function(){_0x371fa5[_0x4544('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305157,_0x17c6fa){return function(_0x54b352){if(!_0x54b352){_0x305157[_0x4544('0x22')](0x194);}return _0x54b352;};}function handleError(_0x3e89b1,_0x170297){_0x170297=_0x170297||0x1f4;return function(_0x3fbf0c){logger[_0x4544('0x23')](_0x3fbf0c[_0x4544('0x24')]);if(_0x3fbf0c[_0x4544('0x25')]){delete _0x3fbf0c[_0x4544('0x25')];}_0x3e89b1[_0x4544('0x15')](_0x170297)[_0x4544('0x26')](_0x3fbf0c);};}exports[_0x4544('0x27')]=function(_0x5f5bc3,_0x5161ee){var _0x1f5f4c={},_0x5c820f={},_0x40d821={'count':0x0,'rows':[]};var _0x56b6ea=_[_0x4544('0x28')](db['CmCustomField'][_0x4544('0x29')],function(_0x562e2d){return{'name':_0x562e2d[_0x4544('0x2a')],'type':_0x562e2d[_0x4544('0x2b')][_0x4544('0x2c')]};});_0x5c820f['model']=_['differenceBy'](_[_0x4544('0x28')](_0x56b6ea,_0x4544('0x25')),[_0x4544('0x25')]);_0x5c820f['query']=_[_0x4544('0x2d')](_0x5f5bc3[_0x4544('0x2e')]);_0x5c820f[_0x4544('0x2f')]=_[_0x4544('0x30')](_0x5c820f[_0x4544('0x31')],_0x5c820f[_0x4544('0x2e')]);_0x1f5f4c['attributes']=_[_0x4544('0x30')](_0x5c820f[_0x4544('0x31')],qs[_0x4544('0x32')](_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x32')]));_0x1f5f4c[_0x4544('0x33')]=_0x1f5f4c[_0x4544('0x33')][_0x4544('0x34')]?_0x1f5f4c['attributes']:_0x5c820f[_0x4544('0x31')];if(!_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x35')](_0x4544('0x36'))){_0x1f5f4c[_0x4544('0x19')]=qs['limit'](_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x19')]);_0x1f5f4c[_0x4544('0x18')]=qs[_0x4544('0x18')](_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x18')]);}_0x1f5f4c[_0x4544('0x37')]=qs['sort'](_0x5f5bc3['query'][_0x4544('0x38')]);_0x1f5f4c[_0x4544('0x39')]=qs['filters'](_[_0x4544('0x3a')](_0x5f5bc3[_0x4544('0x2e')],_0x5c820f[_0x4544('0x2f')]),_0x56b6ea);if(_0x5f5bc3['query'][_0x4544('0x3b')]){_0x1f5f4c[_0x4544('0x39')]=_[_0x4544('0x3c')](_0x1f5f4c[_0x4544('0x39')],{'$or':_[_0x4544('0x28')](_0x56b6ea,function(_0x1d94b3){if(_0x1d94b3[_0x4544('0x2b')]!==_0x4544('0x3d')){var _0xcb576b={};_0xcb576b[_0x1d94b3[_0x4544('0x25')]]={'$like':'%'+_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x3b')]+'%'};return _0xcb576b;}})});}_0x1f5f4c=_[_0x4544('0x3c')]({},_0x1f5f4c,_0x5f5bc3[_0x4544('0x3e')]);var _0x33159f={'where':_0x1f5f4c[_0x4544('0x39')]};return db[_0x4544('0x3f')][_0x4544('0x1a')](_0x33159f)['then'](function(_0x5a557f){_0x40d821['count']=_0x5a557f;if(_0x5f5bc3[_0x4544('0x2e')][_0x4544('0x40')]){_0x1f5f4c[_0x4544('0x41')]=[{'all':!![]}];}return db[_0x4544('0x3f')][_0x4544('0x42')](_0x1f5f4c);})[_0x4544('0x21')](function(_0x1dc659){_0x40d821['rows']=_0x1dc659;return _0x40d821;})['then'](respondWithFilteredResult(_0x5161ee,_0x1f5f4c))[_0x4544('0x43')](handleError(_0x5161ee,null));};exports['show']=function(_0x407be0,_0x30f35a){var _0x2ddfd8={'raw':!![],'where':{'id':_0x407be0[_0x4544('0x44')]['id']}},_0xd31498={};_0xd31498[_0x4544('0x31')]=_['keys'](db[_0x4544('0x3f')][_0x4544('0x29')]);_0xd31498['query']=_['keys'](_0x407be0['query']);_0xd31498[_0x4544('0x2f')]=_[_0x4544('0x30')](_0xd31498['model'],_0xd31498['query']);_0x2ddfd8[_0x4544('0x33')]=_[_0x4544('0x30')](_0xd31498[_0x4544('0x31')],qs[_0x4544('0x32')](_0x407be0['query']['fields']));_0x2ddfd8['attributes']=_0x2ddfd8[_0x4544('0x33')][_0x4544('0x34')]?_0x2ddfd8['attributes']:_0xd31498[_0x4544('0x31')];if(_0x407be0['query'][_0x4544('0x40')]){_0x2ddfd8[_0x4544('0x41')]=[{'all':!![]}];}_0x2ddfd8=_['merge']({},_0x2ddfd8,_0x407be0['options']);return db['CmCustomField'][_0x4544('0x45')](_0x2ddfd8)[_0x4544('0x21')](handleEntityNotFound(_0x30f35a,null))[_0x4544('0x21')](respondWithResult(_0x30f35a,null))[_0x4544('0x43')](handleError(_0x30f35a,null));};exports['update']=function(_0x3bee4a,_0x3c2362){if(_0x3bee4a['body']['id']){delete _0x3bee4a[_0x4544('0x46')]['id'];}return db[_0x4544('0x3f')][_0x4544('0x45')]({'where':{'id':_0x3bee4a['params']['id']}})[_0x4544('0x21')](handleEntityNotFound(_0x3c2362,null))[_0x4544('0x21')](saveUpdates(_0x3bee4a[_0x4544('0x46')],null))[_0x4544('0x21')](respondWithResult(_0x3c2362,null))[_0x4544('0x43')](handleError(_0x3c2362,null));};exports[_0x4544('0x47')]=function(_0x54dd5,_0xe423ab){return db[_0x4544('0x3f')]['find']({'where':{'id':_0x54dd5[_0x4544('0x44')]['id']}})['then'](handleEntityNotFound(_0xe423ab,null))[_0x4544('0x21')](removeEntity(_0xe423ab,null))[_0x4544('0x43')](handleError(_0xe423ab,null));};exports[_0x4544('0x48')]=function(_0x3e441d,_0x4ac183){var _0x11ed72;return db[_0x4544('0x49')][_0x4544('0x4a')](function(_0x2ba40b){return db[_0x4544('0x3f')]['create'](_0x3e441d[_0x4544('0x46')],{'transaction':_0x2ba40b})[_0x4544('0x21')](function(_0x272964){_0x11ed72=_0x272964;var _0x2807e5={'type':db[_0x4544('0x4b')][_0x4544('0x4c')],'transaction':_0x2ba40b};switch(_0x3e441d['body'][_0x4544('0x2b')]){case _0x4544('0x4d'):_0x2807e5[_0x4544('0x2b')]=db[_0x4544('0x4b')][_0x4544('0x4c')];break;case _0x4544('0x4e'):_0x2807e5[_0x4544('0x2b')]=db[_0x4544('0x4b')][_0x4544('0x4f')];break;case _0x4544('0x50'):_0x2807e5['type']=db[_0x4544('0x4b')][_0x4544('0x51')];_0x2807e5[_0x4544('0x52')]=![];break;default:}return db['sequelize']['queryInterface'][_0x4544('0x53')]('cm_contacts',util[_0x4544('0x54')](_0x4544('0x55'),_0x11ed72['id']),_0x2807e5);})[_0x4544('0x21')](function(){return _0x11ed72;});})[_0x4544('0x21')](respondWithResult(_0x4ac183,0xc9))[_0x4544('0x43')](handleError(_0x4ac183,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a5faede..b334e6b 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 _0xd424=['../../config/environment','exports','define','CmCustomField','cm_custom_fields','util','api','moment','request-promise','path','rimraf'];(function(_0x38868f,_0x1b9044){var _0x97dac2=function(_0x32a6bc){while(--_0x32a6bc){_0x38868f['push'](_0x38868f['shift']());}};_0x97dac2(++_0x1b9044);}(_0xd424,0x1bd));var _0x4d42=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xd424[_0x3a6efd];return _0x487b9a;};'use strict';var _=require('lodash');var util=require(_0x4d42('0x0'));var logger=require('../../config/logger')(_0x4d42('0x1'));var moment=require(_0x4d42('0x2'));var BPromise=require('bluebird');var rp=require(_0x4d42('0x3'));var fs=require('fs');var path=require(_0x4d42('0x4'));var rimraf=require(_0x4d42('0x5'));var config=require(_0x4d42('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x4d42('0x7')]=function(_0x5320e4,_0x347926){return _0x5320e4[_0x4d42('0x8')](_0x4d42('0x9'),attributes,{'tableName':_0x4d42('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8786=['exports','CmCustomField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x8786,0x174));var _0x6878=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8786[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var logger=require('../../config/logger')(_0x6878('0x2'));var moment=require('moment');var BPromise=require(_0x6878('0x3'));var rp=require(_0x6878('0x4'));var fs=require('fs');var path=require(_0x6878('0x5'));var rimraf=require(_0x6878('0x6'));var config=require(_0x6878('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x6878('0x8')]=function(_0x442bab,_0xa5e832){return _0x442bab['define'](_0x6878('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9dffb8b..47bd102 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 _0xa138=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xa138,0xcd));var _0x8a13=function(_0x55e632,_0x2899c1){_0x55e632=_0x55e632-0x0;var _0x160c16=_0xa138[_0x55e632];return _0x160c16;};'use strict';var _=require(_0x8a13('0x0'));var util=require(_0x8a13('0x1'));var moment=require('moment');var BPromise=require(_0x8a13('0x2'));var rs=require(_0x8a13('0x3'));var fs=require('fs');var Redis=require(_0x8a13('0x4'));var db=require(_0x8a13('0x5'))['db'];var utils=require(_0x8a13('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a13('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8a13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24a773,_0x1d6238,_0x4d99e1){return new BPromise(function(_0x2e0348,_0x352a01){return client[_0x8a13('0x9')](_0x24a773,_0x4d99e1)[_0x8a13('0xa')](function(_0x578572){logger[_0x8a13('0xb')](_0x8a13('0xc'),_0x1d6238,_0x8a13('0xd'));logger[_0x8a13('0xe')](_0x8a13('0xf'),_0x1d6238,_0x8a13('0xd'),JSON[_0x8a13('0x10')](_0x578572));if(_0x578572[_0x8a13('0x11')]){if(_0x578572['error'][_0x8a13('0x12')]===0x1f4){logger[_0x8a13('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1d6238,_0x578572[_0x8a13('0x11')][_0x8a13('0x13')]);return _0x352a01(_0x578572[_0x8a13('0x11')][_0x8a13('0x13')]);}logger[_0x8a13('0x11')](_0x8a13('0xc'),_0x1d6238,_0x578572[_0x8a13('0x11')]['message']);return _0x2e0348(_0x578572['error'][_0x8a13('0x13')]);}else{logger['info'](_0x8a13('0xc'),_0x1d6238,_0x8a13('0xd'));_0x2e0348(_0x578572[_0x8a13('0x14')][_0x8a13('0x13')]);}})['catch'](function(_0x42760f){logger[_0x8a13('0x11')](_0x8a13('0xc'),_0x1d6238,_0x42760f);_0x352a01(_0x42760f);});});} \ No newline at end of file +var _0xbd55=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info'];(function(_0x492cdc,_0x365c2c){var _0x2a77a7=function(_0x4b7aa0){while(--_0x4b7aa0){_0x492cdc['push'](_0x492cdc['shift']());}};_0x2a77a7(++_0x365c2c);}(_0xbd55,0xff));var _0x5bd5=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xbd55[_0x582d0b];return _0x2e93e1;};'use strict';var _=require('lodash');var util=require(_0x5bd5('0x0'));var moment=require('moment');var BPromise=require(_0x5bd5('0x1'));var rs=require(_0x5bd5('0x2'));var fs=require('fs');var Redis=require(_0x5bd5('0x3'));var db=require(_0x5bd5('0x4'))['db'];var utils=require(_0x5bd5('0x5'));var logger=require(_0x5bd5('0x6'))('rpc');var config=require(_0x5bd5('0x7'));var jayson=require(_0x5bd5('0x8'));var client=jayson[_0x5bd5('0x9')][_0x5bd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x447b48,_0x45591b,_0x579148){return new BPromise(function(_0x5ef7ea,_0x1138a0){return client['request'](_0x447b48,_0x579148)[_0x5bd5('0xb')](function(_0x5a797d){logger['info']('CmCustomField,\x20%s,\x20%s',_0x45591b,_0x5bd5('0xc'));logger[_0x5bd5('0xd')](_0x5bd5('0xe'),_0x45591b,_0x5bd5('0xc'),JSON[_0x5bd5('0xf')](_0x5a797d));if(_0x5a797d[_0x5bd5('0x10')]){if(_0x5a797d[_0x5bd5('0x10')][_0x5bd5('0x11')]===0x1f4){logger['error'](_0x5bd5('0x12'),_0x45591b,_0x5a797d[_0x5bd5('0x10')][_0x5bd5('0x13')]);return _0x1138a0(_0x5a797d['error'][_0x5bd5('0x13')]);}logger[_0x5bd5('0x10')](_0x5bd5('0x12'),_0x45591b,_0x5a797d[_0x5bd5('0x10')][_0x5bd5('0x13')]);return _0x5ef7ea(_0x5a797d[_0x5bd5('0x10')][_0x5bd5('0x13')]);}else{logger[_0x5bd5('0x14')](_0x5bd5('0x12'),_0x45591b,'request\x20sent');_0x5ef7ea(_0x5a797d[_0x5bd5('0x15')][_0x5bd5('0x13')]);}})[_0x5bd5('0x16')](function(_0x29527a){logger[_0x5bd5('0x10')](_0x5bd5('0x12'),_0x45591b,_0x29527a);_0x1138a0(_0x29527a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ce312e7..c5065f6 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 _0x58f4=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x48110a,_0x39dd89){var _0x810719=function(_0x938cbb){while(--_0x938cbb){_0x48110a['push'](_0x48110a['shift']());}};_0x810719(++_0x39dd89);}(_0x58f4,0x1b2));var _0x458f=function(_0xa6e504,_0x41c842){_0xa6e504=_0xa6e504-0x0;var _0x21cf40=_0x58f4[_0xa6e504];return _0x21cf40;};'use strict';var multer=require('multer');var util=require(_0x458f('0x0'));var path=require(_0x458f('0x1'));var timeout=require(_0x458f('0x2'));var express=require(_0x458f('0x3'));var router=express[_0x458f('0x4')]();var fs_extra=require(_0x458f('0x5'));var auth=require(_0x458f('0x6'));var interaction=require(_0x458f('0x7'));var config=require(_0x458f('0x8'));var controller=require(_0x458f('0x9'));router[_0x458f('0xa')]('/',auth[_0x458f('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x458f('0xc')]);router[_0x458f('0xd')]('/',auth['isAuthenticated'](),controller[_0x458f('0xe')]);router[_0x458f('0xf')](_0x458f('0x10'),auth[_0x458f('0xb')](),controller[_0x458f('0x11')]);router[_0x458f('0x12')](_0x458f('0x10'),auth['isAuthenticated'](),controller[_0x458f('0x13')]);module[_0x458f('0x14')]=router; \ No newline at end of file +var _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x277c,0x153));var _0xc277=function(_0x27ece0,_0x5d4d9a){_0x27ece0=_0x27ece0-0x0;var _0x579b8c=_0x277c[_0x27ece0];return _0x579b8c;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['post']('/',auth[_0xc277('0x9')](),controller[_0xc277('0xc')]);router[_0xc277('0xd')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['delete']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);module[_0xc277('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9f34eb1..84b97c9 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 _0x4888=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x4218c8,_0x2983ad){var _0x18d573=function(_0x2111c8){while(--_0x2111c8){_0x4218c8['push'](_0x4218c8['shift']());}};_0x18d573(++_0x2983ad);}(_0x4888,0x198));var _0x8488=function(_0xc266d6,_0x15fc8c){_0xc266d6=_0xc266d6-0x0;var _0x2ab82c=_0x4888[_0xc266d6];return _0x2ab82c;};'use strict';var moment=require('moment');var Sequelize=require(_0x8488('0x0'));module[_0x8488('0x1')]={'phone':{'type':Sequelize[_0x8488('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x8488('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8488('0x4')],'defaultValue':moment()[_0x8488('0x5')](_0x8488('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8488('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8488('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8488('0x4')]},'priority':{'type':Sequelize[_0x8488('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8488('0x7')],'unique':_0x8488('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x8488('0x7')],'unique':_0x8488('0x8')},'CampaignId':{'type':Sequelize[_0x8488('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8488('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8488('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8488('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7708=['moment','sequelize','STRING','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue'];(function(_0x43e53b,_0xc4f07c){var _0x5deb08=function(_0x1337db){while(--_0x1337db){_0x43e53b['push'](_0x43e53b['shift']());}};_0x5deb08(++_0xc4f07c);}(_0x7708,0x188));var _0x8770=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x7708[_0x503cd5];return _0x1fdf1e;};'use strict';var moment=require(_0x8770('0x0'));var Sequelize=require(_0x8770('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8770('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8770('0x5')]},'priority':{'type':Sequelize[_0x8770('0x3')](0x2)[_0x8770('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8770('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8770('0x3')],'unique':_0x8770('0x7')},'ListId':{'type':Sequelize[_0x8770('0x3')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x8770('0x3')]},'VoiceQueueId':{'type':Sequelize[_0x8770('0x3')],'unique':_0x8770('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8770('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8770('0x5')],'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 97db28f..d38a9c9 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 _0xf4a5=['getTimezones','timezones','push','utcOffset','getTimezone','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','body','update','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','create','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','priority','ASC','scheduledAt','DESC','literal','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','UPDATE','Contact','CmCompany','Company','List','dialActive','getVoiceQueues','transaction','hopperId','scheduledat','LOCK','CmList','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found'];(function(_0x33f0aa,_0x5a1f81){var _0x3a27ba=function(_0xf6fc16){while(--_0xf6fc16){_0x33f0aa['push'](_0x33f0aa['shift']());}};_0x3a27ba(++_0x5a1f81);}(_0xf4a5,0x143));var _0x5f4a=function(_0x2a6ba9,_0x28dfd2){_0x2a6ba9=_0x2a6ba9-0x0;var _0x5f264a=_0xf4a5[_0x2a6ba9];return _0x5f264a;};'use strict';var emlformat=require(_0x5f4a('0x0'));var rimraf=require(_0x5f4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f4a('0x2'));var rp=require(_0x5f4a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f4a('0x4'));var util=require('util');var path=require(_0x5f4a('0x5'));var sox=require('sox');var csv=require(_0x5f4a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f4a('0x7'));var _=require(_0x5f4a('0x8'));var squel=require('squel');var crypto=require(_0x5f4a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5f4a('0xa'));var toCsv=require(_0x5f4a('0x6'));var querystring=require(_0x5f4a('0xb'));var Papa=require('papaparse');var Redis=require(_0x5f4a('0xc'));var authService=require(_0x5f4a('0xd'));var qs=require(_0x5f4a('0xe'));var as=require(_0x5f4a('0xf'));var hardwareService=require(_0x5f4a('0x10'));var logger=require(_0x5f4a('0x11'))(_0x5f4a('0x12'));var utils=require(_0x5f4a('0x13'));var config=require('../../config/environment');var shared=require(_0x5f4a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f4a('0x15'))['db'];function respondWithStatusCode(_0x30a93b,_0xbda9ef){_0xbda9ef=_0xbda9ef||0xcc;return function(_0x31c392){if(_0x31c392){return _0x30a93b[_0x5f4a('0x16')](_0xbda9ef);}return _0x30a93b[_0x5f4a('0x17')](_0xbda9ef)[_0x5f4a('0x18')]();};}function respondWithResult(_0x443a15,_0x75d895){_0x75d895=_0x75d895||0xc8;return function(_0x44dacb){if(_0x44dacb){return _0x443a15[_0x5f4a('0x17')](_0x75d895)[_0x5f4a('0x19')](_0x44dacb);}};}function respondWithFilteredResult(_0x2f00e2,_0x418c00){return function(_0x1f369c){if(_0x1f369c){var _0x50bd73=typeof _0x418c00['offset']===_0x5f4a('0x1a')&&typeof _0x418c00[_0x5f4a('0x1b')]===_0x5f4a('0x1a');var _0xf90bd5=_0x1f369c[_0x5f4a('0x1c')];var _0x5e54ee=_0x50bd73?0x0:_0x418c00[_0x5f4a('0x1d')];var _0x1bc4b6=_0x50bd73?_0x1f369c[_0x5f4a('0x1c')]:_0x418c00[_0x5f4a('0x1d')]+_0x418c00['limit'];var _0x34e53f;if(_0x1bc4b6>=_0xf90bd5){_0x1bc4b6=_0xf90bd5;_0x34e53f=0xc8;}else{_0x34e53f=0xce;}_0x2f00e2['status'](_0x34e53f);return _0x2f00e2['set'](_0x5f4a('0x1e'),_0x5e54ee+'-'+_0x1bc4b6+'/'+_0xf90bd5)[_0x5f4a('0x19')](_0x1f369c);}return null;};}function patchUpdates(_0xa3c0d9){return function(_0x45f449){try{jsonpatch[_0x5f4a('0x1f')](_0x45f449,_0xa3c0d9,!![]);}catch(_0x61198b){return BPromise['reject'](_0x61198b);}return _0x45f449[_0x5f4a('0x20')]();};}function saveUpdates(_0x397ee3,_0x1aaa14){return function(_0x1d1d5e){if(_0x1d1d5e){return _0x1d1d5e['update'](_0x397ee3)[_0x5f4a('0x21')](function(_0x480840){return _0x480840;});}return null;};}function removeEntity(_0x5a1837,_0x55350c){return function(_0x92a307){if(_0x92a307){return _0x92a307[_0x5f4a('0x22')]()[_0x5f4a('0x21')](function(){_0x5a1837[_0x5f4a('0x17')](0xcc)[_0x5f4a('0x18')]();});}};}function handleEntityNotFound(_0x4595b0,_0x4f7970){return function(_0x18b4d6){if(!_0x18b4d6){_0x4595b0[_0x5f4a('0x16')](0x194);}return _0x18b4d6;};}function handleError(_0x2f553c,_0x2d5c5b){_0x2d5c5b=_0x2d5c5b||0x1f4;return function(_0x3c77dc){logger[_0x5f4a('0x23')](_0x3c77dc[_0x5f4a('0x24')]);if(_0x3c77dc[_0x5f4a('0x25')]){delete _0x3c77dc[_0x5f4a('0x25')];}_0x2f553c[_0x5f4a('0x17')](_0x2d5c5b)[_0x5f4a('0x26')](_0x3c77dc);};}exports['index']=function(_0x13ea28,_0x2fb0a9){var _0x183661={},_0x4b7630={},_0x1c7818={'count':0x0,'rows':[]};var _0x76ed2a=_[_0x5f4a('0x27')](db[_0x5f4a('0x28')][_0x5f4a('0x29')],function(_0x5e9868){return{'name':_0x5e9868[_0x5f4a('0x2a')],'type':_0x5e9868[_0x5f4a('0x2b')]['key']};});_0x4b7630[_0x5f4a('0x2c')]=_['map'](_0x76ed2a,'name');_0x4b7630[_0x5f4a('0x2d')]=_[_0x5f4a('0x2e')](_0x13ea28[_0x5f4a('0x2d')]);_0x4b7630[_0x5f4a('0x2f')]=_['intersection'](_0x4b7630[_0x5f4a('0x2c')],_0x4b7630[_0x5f4a('0x2d')]);_0x4b7630[_0x5f4a('0x2f')]=_[_0x5f4a('0x30')](_0x4b7630[_0x5f4a('0x2f')],[_0x5f4a('0x31'),_0x5f4a('0x32'),_0x5f4a('0x33'),_0x5f4a('0x34'),_0x5f4a('0x35'),_0x5f4a('0x36'),'$ne','$eq',_0x5f4a('0x37'),_0x5f4a('0x38'),_0x5f4a('0x39'),_0x5f4a('0x3a'),_0x5f4a('0x3b'),_0x5f4a('0x3c'),_0x5f4a('0x3d'),'$iLike','$notILike','$like',_0x5f4a('0x3e'),_0x5f4a('0x3f'),_0x5f4a('0x40'),_0x5f4a('0x41')]);_0x183661[_0x5f4a('0x42')]=_[_0x5f4a('0x43')](_0x4b7630[_0x5f4a('0x2c')],qs['fields'](_0x13ea28[_0x5f4a('0x2d')][_0x5f4a('0x44')]));_0x183661[_0x5f4a('0x42')]=_0x183661['attributes'][_0x5f4a('0x45')]?_0x183661['attributes']:_0x4b7630[_0x5f4a('0x2c')];if(!_0x13ea28['query'][_0x5f4a('0x46')]('nolimit')){_0x183661['limit']=qs[_0x5f4a('0x1b')](_0x13ea28['query'][_0x5f4a('0x1b')]);_0x183661[_0x5f4a('0x1d')]=qs['offset'](_0x13ea28[_0x5f4a('0x2d')]['offset']);}_0x183661[_0x5f4a('0x47')]=qs[_0x5f4a('0x48')](_0x13ea28['query'][_0x5f4a('0x48')]);_0x183661[_0x5f4a('0x49')]=qs[_0x5f4a('0x2f')](_[_0x5f4a('0x4a')](_0x13ea28['query'],_0x4b7630[_0x5f4a('0x2f')]),_0x76ed2a);if(_0x13ea28[_0x5f4a('0x2d')][_0x5f4a('0x4b')]){_0x183661[_0x5f4a('0x49')]=_[_0x5f4a('0x4c')](_0x183661[_0x5f4a('0x49')],{'$or':_[_0x5f4a('0x27')](_0x76ed2a,function(_0x8372b4){if(_0x8372b4[_0x5f4a('0x2b')]!=='VIRTUAL'){var _0x121251={};_0x121251[_0x8372b4[_0x5f4a('0x25')]]={'$like':'%'+_0x13ea28[_0x5f4a('0x2d')][_0x5f4a('0x4b')]+'%'};return _0x121251;}})});}_0x183661=_[_0x5f4a('0x4c')]({},_0x183661,_0x13ea28[_0x5f4a('0x4d')]);var _0x175338={'where':_0x183661[_0x5f4a('0x49')]};return db[_0x5f4a('0x28')][_0x5f4a('0x1c')](_0x175338)[_0x5f4a('0x21')](function(_0x125e3e){_0x1c7818[_0x5f4a('0x1c')]=_0x125e3e;if(_0x13ea28[_0x5f4a('0x2d')]['includeAll']){_0x183661[_0x5f4a('0x4e')]=[{'all':!![]}];}return db[_0x5f4a('0x28')][_0x5f4a('0x4f')](_0x183661);})[_0x5f4a('0x21')](function(_0x55d8fc){_0x1c7818[_0x5f4a('0x50')]=_0x55d8fc;return _0x1c7818;})[_0x5f4a('0x21')](respondWithFilteredResult(_0x2fb0a9,_0x183661))[_0x5f4a('0x51')](handleError(_0x2fb0a9,null));};exports[_0x5f4a('0x52')]=function(_0x1ebcca,_0x4dff5b){var _0xcd2247={'raw':!![],'where':{'id':_0x1ebcca[_0x5f4a('0x53')]['id']}},_0x1bf8dd={};_0x1bf8dd[_0x5f4a('0x2c')]=_['keys'](db['CmHopper'][_0x5f4a('0x29')]);_0x1bf8dd['query']=_[_0x5f4a('0x2e')](_0x1ebcca['query']);_0x1bf8dd[_0x5f4a('0x2f')]=_[_0x5f4a('0x43')](_0x1bf8dd[_0x5f4a('0x2c')],_0x1bf8dd[_0x5f4a('0x2d')]);_0xcd2247['attributes']=_[_0x5f4a('0x43')](_0x1bf8dd[_0x5f4a('0x2c')],qs[_0x5f4a('0x44')](_0x1ebcca['query'][_0x5f4a('0x44')]));_0xcd2247[_0x5f4a('0x42')]=_0xcd2247[_0x5f4a('0x42')]['length']?_0xcd2247[_0x5f4a('0x42')]:_0x1bf8dd[_0x5f4a('0x2c')];if(_0x1ebcca[_0x5f4a('0x2d')]['includeAll']){_0xcd2247['include']=[{'all':!![]}];}_0xcd2247=_[_0x5f4a('0x4c')]({},_0xcd2247,_0x1ebcca[_0x5f4a('0x4d')]);return db['CmHopper']['find'](_0xcd2247)[_0x5f4a('0x21')](handleEntityNotFound(_0x4dff5b,null))['then'](respondWithResult(_0x4dff5b,null))[_0x5f4a('0x51')](handleError(_0x4dff5b,null));};exports['create']=function(_0x13648c,_0x390ac3){return db['CmHopper']['create'](_0x13648c[_0x5f4a('0x54')],{})[_0x5f4a('0x21')](respondWithResult(_0x390ac3,0xc9))['catch'](handleError(_0x390ac3,null));};exports[_0x5f4a('0x55')]=function(_0xe7a16d,_0x5f5f07){if(_0xe7a16d[_0x5f4a('0x54')]['id']){delete _0xe7a16d[_0x5f4a('0x54')]['id'];}return db[_0x5f4a('0x28')][_0x5f4a('0x56')]({'where':{'id':_0xe7a16d[_0x5f4a('0x53')]['id']}})[_0x5f4a('0x21')](handleEntityNotFound(_0x5f5f07,null))[_0x5f4a('0x21')](saveUpdates(_0xe7a16d[_0x5f4a('0x54')],null))[_0x5f4a('0x21')](respondWithResult(_0x5f5f07,null))[_0x5f4a('0x51')](handleError(_0x5f5f07,null));};exports[_0x5f4a('0x57')]=function(_0x46cca2,_0x5b0026){return db[_0x5f4a('0x28')][_0x5f4a('0x57')]()[_0x5f4a('0x21')](respondWithResult(_0x5b0026,null))['catch'](handleError(_0x5b0026,null));};exports[_0x5f4a('0x22')]=function(_0x32c48a,_0xf12158){var _0x4e017c;return db[_0x5f4a('0x28')][_0x5f4a('0x56')]({'where':{'id':_0x32c48a[_0x5f4a('0x53')]['id']}})[_0x5f4a('0x21')](handleEntityNotFound(_0xf12158,null))[_0x5f4a('0x21')](function(_0x4bba52){if(_0x4bba52){return _0x4bba52[_0x5f4a('0x22')]()[_0x5f4a('0x21')](function(_0x5652ce){return _0x5652ce;});}})[_0x5f4a('0x21')](function(_0x3acbba){_0x4e017c=_0x3acbba;if(_0x3acbba){if(_0x3acbba[_0x5f4a('0x58')]||_0x3acbba[_0x5f4a('0x59')]){return db[_0x3acbba['VoiceQueueId']?_0x5f4a('0x5a'):_0x5f4a('0x5b')][_0x5f4a('0x56')]({'where':{'id':_0x3acbba[_0x5f4a('0x58')]?_0x3acbba[_0x5f4a('0x58')]:_0x3acbba[_0x5f4a('0x59')]},'attributes':['id',_0x5f4a('0x25')],'raw':!![]});}}})['then'](function(_0xef06ac){var _0x38652f={};if(_0xef06ac){_[_0x5f4a('0x4c')](_0x38652f,_[_0x5f4a('0x5c')](_0x4e017c['dataValues'],[_0x5f4a('0x5d'),_0x5f4a('0x5e'),'id']));_0x38652f[_0x5f4a('0x5f')]=0x15;_0x38652f[_0x5f4a('0x60')]=_0x5f4a('0x61');_0x38652f[_0x5f4a('0x62')]=_0xef06ac[_0x5f4a('0x25')];_0x38652f['membername']=_0x32c48a['user']['name'];_0x38652f[_0x5f4a('0x63')]=_0x32c48a[_0x5f4a('0x64')]['id'];_0x38652f[_0x5f4a('0x61')]=!![];_0x38652f[_0x5f4a('0x65')]=moment()[_0x5f4a('0x66')](_0x5f4a('0x67'));_0x38652f[_0x5f4a('0x68')]=_0x4e017c[_0x5f4a('0x69')];_0x38652f[_0x5f4a('0x6a')]=_0x4e017c['VoiceQueueId']?_0x5f4a('0x6b'):_0x5f4a('0x6c');return db[_0x5f4a('0x6d')][_0x5f4a('0x56')]({'where':{'id':_0x38652f[_0x5f4a('0x6e')]},'attributes':[_0x5f4a('0x6f'),_0x5f4a('0x70')]})['then'](function(_0x2447e4){if(!_[_0x5f4a('0x71')](_0xf12158)&&!_[_0x5f4a('0x71')](_0x2447e4[_0x5f4a('0x6f')])){_0x38652f[_0x5f4a('0x72')]=_0x2447e4[_0x5f4a('0x6f')];if(!_['isNil'](_0x2447e4[_0x5f4a('0x70')])){_0x38652f[_0x5f4a('0x72')]+='\x20'+_0x2447e4[_0x5f4a('0x70')];}}})[_0x5f4a('0x73')](function(){return db[_0x5f4a('0x74')][_0x5f4a('0x75')](_0x38652f);});}})[_0x5f4a('0x21')](function(){return _0xf12158['status'](0xcc)[_0x5f4a('0x18')]();})[_0x5f4a('0x51')](handleError(_0xf12158,null));};exports[_0x5f4a('0x76')]=function(_0x28bd22,_0x1073e8,_0x3f4246){var _0x471243=[];return db[_0x5f4a('0x6d')][_0x5f4a('0x57')]()[_0x5f4a('0x21')](function(_0x25fe79){_0x471243=_[_0x5f4a('0x2e')](_0x25fe79);return _0x28bd22[_0x5f4a('0x64')]['getVoiceQueues']({'where':{'type':_0x5f4a('0x77'),'dialActive':!![],'dialMethod':_0x5f4a('0x78')},'attributes':['id',_0x5f4a('0x79'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x2b0737){if(_0x2b0737&&_0x2b0737[_0x5f4a('0x45')]){return db[_0x5f4a('0x7a')]['transaction'](function(_0x50b57f){var _0x5a00ac={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f4a('0x66')](_0x5f4a('0x67'))},'VoiceQueueId':{'$in':_['map'](_0x2b0737,'id')},'$or':[{'UserId':null},{'UserId':_0x28bd22['user']['id']}]};var _0x6eb08c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2b0737)['filter']([_0x5f4a('0x7b'),0x0])[_0x5f4a('0x27')]('id')[_0x5f4a('0x7c')]()},'$or':[{'UserId':null},{'UserId':_0x28bd22['user']['id']}]};var _0x4785d1={'$or':[_0x5a00ac,_0x6eb08c]};var _0x6a6c35=[];if(_0x28bd22['body']['direction']&&_0x28bd22['body'][_0x5f4a('0x7d')]===_0x5f4a('0x7e')){if(!_[_0x5f4a('0x7f')](_0x28bd22[_0x5f4a('0x54')]['hopperIds'])){_0x4785d1['id']={'$in':_0x28bd22['body']['hopperIds']};}_0x6a6c35=[[_0x5f4a('0x80'),_0x5f4a('0x81')],[_0x5f4a('0x82'),_0x2b0737[0x0][_0x5f4a('0x79')]===_0x5f4a('0x81')?_0x5f4a('0x83'):'ASC'],db[_0x5f4a('0x7a')][_0x5f4a('0x84')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x5f4a('0x7f')](_0x28bd22[_0x5f4a('0x54')][_0x5f4a('0x85')])){_0x4785d1['id']={'$notIn':_0x28bd22[_0x5f4a('0x54')]['hopperIds']};}_0x6a6c35=[['priority',_0x5f4a('0x83')],['scheduledAt',_0x2b0737[0x0][_0x5f4a('0x79')]],db['sequelize'][_0x5f4a('0x84')](_0x5f4a('0x86')),['id',_0x5f4a('0x81')]];}return db[_0x5f4a('0x28')][_0x5f4a('0x87')]({'attributes':['id','scheduledat',_0x5f4a('0x88')],'where':_0x4785d1,'order':_0x6a6c35,'transaction':_0x50b57f,'lock':_0x50b57f['LOCK'][_0x5f4a('0x89')],'include':[{'model':db[_0x5f4a('0x6d')],'as':_0x5f4a('0x8a'),'attributes':_0x471243,'include':[{'model':db[_0x5f4a('0x8b')],'as':_0x5f4a('0x8c'),'attributes':['id',_0x5f4a('0x25')]}]},{'model':db['CmList'],'as':_0x5f4a('0x8d'),'attributes':['id','name']},{'model':db[_0x5f4a('0x5a')],'as':'Queue','attributes':['id','name',_0x5f4a('0x8e')]}]})[_0x5f4a('0x21')](function(_0x3fcc26){if(_0x3fcc26){return _0x3fcc26['update']({'UserId':_0x28bd22[_0x5f4a('0x64')]['id']},{'transaction':_0x50b57f});}});});}})[_0x5f4a('0x21')](handleEntityNotFound(_0x1073e8,null))['then'](respondWithResult(_0x1073e8,null))[_0x5f4a('0x51')](handleError(_0x1073e8,null));};exports['getPreviewRecall']=function(_0x140ab9,_0x24c177,_0x3b78aa){var _0x1a3a13=[];return db[_0x5f4a('0x6d')]['describe']()[_0x5f4a('0x21')](function(_0x3a72c5){_0x1a3a13=_[_0x5f4a('0x2e')](_0x3a72c5);return _0x140ab9['user'][_0x5f4a('0x8f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x5f4a('0x79'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x5f4a('0x21')](function(_0xa413){if(_0xa413&&_0xa413[_0x5f4a('0x45')]){return db[_0x5f4a('0x7a')][_0x5f4a('0x90')](function(_0x599627){var _0x3175d2={'active':![],'recallme':!![],'id':_0x140ab9[_0x5f4a('0x54')][_0x5f4a('0x91')]};return db[_0x5f4a('0x28')]['findOne']({'attributes':['id',_0x5f4a('0x92'),'recallme'],'where':_0x3175d2,'transaction':_0x599627,'lock':_0x599627[_0x5f4a('0x93')][_0x5f4a('0x89')],'include':[{'model':db[_0x5f4a('0x6d')],'as':_0x5f4a('0x8a'),'attributes':_0x1a3a13,'include':[{'model':db['CmCompany'],'as':_0x5f4a('0x8c'),'attributes':['id',_0x5f4a('0x25')]}]},{'model':db[_0x5f4a('0x94')],'as':_0x5f4a('0x8d'),'attributes':['id',_0x5f4a('0x25')]},{'model':db['VoiceQueue'],'as':_0x5f4a('0x95'),'attributes':['id',_0x5f4a('0x25'),'dialActive']}]})[_0x5f4a('0x21')](function(_0x3600f2){if(_0x3600f2){return _0x3600f2['update']({'UserId':_0x140ab9[_0x5f4a('0x64')]['id']},{'transaction':_0x599627});}});});}})[_0x5f4a('0x21')](handleEntityNotFound(_0x24c177,null))[_0x5f4a('0x21')](respondWithResult(_0x24c177,null))[_0x5f4a('0x51')](handleError(_0x24c177,null));};exports[_0x5f4a('0x96')]=function(_0x594749,_0x50320e,_0x2e5f8b){return _0x594749[_0x5f4a('0x64')]['getVoiceQueues']({'where':{'type':_0x5f4a('0x77'),'dialActive':!![],'dialMethod':_0x5f4a('0x78')},'attributes':['id'],'raw':!![]})[_0x5f4a('0x21')](function(_0x345d38){if(_0x345d38&&_0x345d38[_0x5f4a('0x45')]){return db[_0x5f4a('0x28')][_0x5f4a('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f4a('0x66')](_0x5f4a('0x67'))},'VoiceQueueId':{'$in':_[_0x5f4a('0x27')](_0x345d38,'id')},'$or':[{'UserId':null},{'UserId':_0x594749[_0x5f4a('0x64')]['id']}]}});}return 0x0;})[_0x5f4a('0x21')](function(_0x427a95){if(!_[_0x5f4a('0x71')](_0x427a95)&&_[_0x5f4a('0x97')](_0x427a95)){return _0x50320e[_0x5f4a('0x17')](0xc8)[_0x5f4a('0x19')]({'contacts':_0x427a95});}else{logger[_0x5f4a('0x23')](_0x5f4a('0x98'),_0x5f4a('0x96'),0x194,_0x5f4a('0x99'));_0x50320e['sendStatus'](0x194);}})[_0x5f4a('0x51')](handleError(_0x50320e,null));};exports[_0x5f4a('0x9a')]=function(_0x478187,_0x152905,_0x368f40){var _0x854449=shared[_0x5f4a('0x9b')];var _0x14c5db=[];_[_0x5f4a('0x27')](_0x854449,function(_0x401fd7){_0x14c5db[_0x5f4a('0x9c')]({'id':_0x401fd7[_0x5f4a('0x25')],'name':_0x401fd7[_0x5f4a('0x25')],'utcOffset':_0x401fd7[_0x5f4a('0x9d')]});});return _0x152905['status'](0xc8)[_0x5f4a('0x19')]({'tz':_0x14c5db});};exports[_0x5f4a('0x9e')]=function(_0x35c589,_0x46e782,_0x2109ba){var _0x55c944=shared[_0x5f4a('0x9b')];var _0x2f541a={};if(!_[_0x5f4a('0x71')](_0x55c944[_0x35c589['body']['id']]))_0x2f541a=_0x55c944[_0x35c589[_0x5f4a('0x54')]['id']];return _0x46e782[_0x5f4a('0x17')](0xc8)[_0x5f4a('0x19')](_0x2f541a);}; \ No newline at end of file +var _0x073c=['error','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','find','create','body','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','literal','findOne','scheduledat','recallme','UPDATE','CmCompany','Company','List','Queue','outbound','hopperId','LOCK','Contact','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','timezones','utcOffset','getTimezone','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then'];(function(_0x50699a,_0x166116){var _0x277e6e=function(_0x5286e9){while(--_0x5286e9){_0x50699a['push'](_0x50699a['shift']());}};_0x277e6e(++_0x166116);}(_0x073c,0x118));var _0xc073=function(_0x2d1d5,_0x48e69e){_0x2d1d5=_0x2d1d5-0x0;var _0x1ad142=_0x073c[_0x2d1d5];return _0x1ad142;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc073('0x0'));var zipdir=require(_0xc073('0x1'));var jsonpatch=require(_0xc073('0x2'));var rp=require(_0xc073('0x3'));var moment=require(_0xc073('0x4'));var BPromise=require(_0xc073('0x5'));var Mustache=require('mustache');var util=require(_0xc073('0x6'));var path=require('path');var sox=require(_0xc073('0x7'));var csv=require(_0xc073('0x8'));var ejs=require(_0xc073('0x9'));var fs=require('fs');var fs_extra=require(_0xc073('0xa'));var _=require(_0xc073('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc073('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc073('0x8'));var querystring=require(_0xc073('0xd'));var Papa=require('papaparse');var Redis=require(_0xc073('0xe'));var authService=require(_0xc073('0xf'));var qs=require(_0xc073('0x10'));var as=require(_0xc073('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc073('0x12'))(_0xc073('0x13'));var utils=require(_0xc073('0x14'));var config=require(_0xc073('0x15'));var shared=require(_0xc073('0x15'));var licenseUtil=require(_0xc073('0x16'));var db=require(_0xc073('0x17'))['db'];function respondWithStatusCode(_0x575bb5,_0x645a55){_0x645a55=_0x645a55||0xcc;return function(_0x25956c){if(_0x25956c){return _0x575bb5[_0xc073('0x18')](_0x645a55);}return _0x575bb5[_0xc073('0x19')](_0x645a55)[_0xc073('0x1a')]();};}function respondWithResult(_0x209771,_0x315ffe){_0x315ffe=_0x315ffe||0xc8;return function(_0x3ebfa0){if(_0x3ebfa0){return _0x209771[_0xc073('0x19')](_0x315ffe)[_0xc073('0x1b')](_0x3ebfa0);}};}function respondWithFilteredResult(_0x54b17f,_0x4f6851){return function(_0x4af48a){if(_0x4af48a){var _0x44dc18=typeof _0x4f6851[_0xc073('0x1c')]===_0xc073('0x1d')&&typeof _0x4f6851['limit']===_0xc073('0x1d');var _0x5f4560=_0x4af48a['count'];var _0x3277da=_0x44dc18?0x0:_0x4f6851[_0xc073('0x1c')];var _0x2ef8d1=_0x44dc18?_0x4af48a[_0xc073('0x1e')]:_0x4f6851[_0xc073('0x1c')]+_0x4f6851[_0xc073('0x1f')];var _0x57799c;if(_0x2ef8d1>=_0x5f4560){_0x2ef8d1=_0x5f4560;_0x57799c=0xc8;}else{_0x57799c=0xce;}_0x54b17f[_0xc073('0x19')](_0x57799c);return _0x54b17f[_0xc073('0x20')](_0xc073('0x21'),_0x3277da+'-'+_0x2ef8d1+'/'+_0x5f4560)[_0xc073('0x1b')](_0x4af48a);}return null;};}function patchUpdates(_0x307085){return function(_0xfcfd3){try{jsonpatch[_0xc073('0x22')](_0xfcfd3,_0x307085,!![]);}catch(_0x3f5c09){return BPromise[_0xc073('0x23')](_0x3f5c09);}return _0xfcfd3['save']();};}function saveUpdates(_0x56ef10,_0x246eed){return function(_0x216480){if(_0x216480){return _0x216480[_0xc073('0x24')](_0x56ef10)['then'](function(_0x4a4565){return _0x4a4565;});}return null;};}function removeEntity(_0x369856,_0x4eec60){return function(_0x52a72b){if(_0x52a72b){return _0x52a72b['destroy']()[_0xc073('0x25')](function(){_0x369856['status'](0xcc)[_0xc073('0x1a')]();});}};}function handleEntityNotFound(_0x12600d,_0x41d7ab){return function(_0xad3f43){if(!_0xad3f43){_0x12600d[_0xc073('0x18')](0x194);}return _0xad3f43;};}function handleError(_0xd8679d,_0x5bc87c){_0x5bc87c=_0x5bc87c||0x1f4;return function(_0x59f7fa){logger[_0xc073('0x26')](_0x59f7fa['stack']);if(_0x59f7fa[_0xc073('0x27')]){delete _0x59f7fa[_0xc073('0x27')];}_0xd8679d[_0xc073('0x19')](_0x5bc87c)[_0xc073('0x28')](_0x59f7fa);};}exports[_0xc073('0x29')]=function(_0x5bcd11,_0x3a8b8f){var _0x49ce62={},_0x5d9caa={},_0x594e66={'count':0x0,'rows':[]};var _0x43c5f5=_['map'](db[_0xc073('0x2a')][_0xc073('0x2b')],function(_0x3e0006){return{'name':_0x3e0006[_0xc073('0x2c')],'type':_0x3e0006[_0xc073('0x2d')][_0xc073('0x2e')]};});_0x5d9caa[_0xc073('0x2f')]=_[_0xc073('0x30')](_0x43c5f5,_0xc073('0x27'));_0x5d9caa[_0xc073('0x31')]=_[_0xc073('0x32')](_0x5bcd11[_0xc073('0x31')]);_0x5d9caa[_0xc073('0x33')]=_['intersection'](_0x5d9caa['model'],_0x5d9caa[_0xc073('0x31')]);_0x5d9caa[_0xc073('0x33')]=_[_0xc073('0x34')](_0x5d9caa[_0xc073('0x33')],[_0xc073('0x35'),_0xc073('0x36'),_0xc073('0x37'),_0xc073('0x38'),_0xc073('0x39'),_0xc073('0x3a'),_0xc073('0x3b'),_0xc073('0x3c'),_0xc073('0x3d'),_0xc073('0x3e'),'$notBetween',_0xc073('0x3f'),_0xc073('0x40'),_0xc073('0x41'),'$notLike',_0xc073('0x42'),_0xc073('0x43'),_0xc073('0x41'),_0xc073('0x44'),_0xc073('0x45'),_0xc073('0x46'),_0xc073('0x47')]);_0x49ce62['attributes']=_['intersection'](_0x5d9caa[_0xc073('0x2f')],qs[_0xc073('0x48')](_0x5bcd11['query'][_0xc073('0x48')]));_0x49ce62['attributes']=_0x49ce62[_0xc073('0x49')][_0xc073('0x4a')]?_0x49ce62['attributes']:_0x5d9caa[_0xc073('0x2f')];if(!_0x5bcd11[_0xc073('0x31')][_0xc073('0x4b')](_0xc073('0x4c'))){_0x49ce62['limit']=qs[_0xc073('0x1f')](_0x5bcd11['query'][_0xc073('0x1f')]);_0x49ce62[_0xc073('0x1c')]=qs[_0xc073('0x1c')](_0x5bcd11[_0xc073('0x31')][_0xc073('0x1c')]);}_0x49ce62[_0xc073('0x4d')]=qs[_0xc073('0x4e')](_0x5bcd11[_0xc073('0x31')]['sort']);_0x49ce62[_0xc073('0x4f')]=qs[_0xc073('0x33')](_[_0xc073('0x50')](_0x5bcd11[_0xc073('0x31')],_0x5d9caa[_0xc073('0x33')]),_0x43c5f5);if(_0x5bcd11[_0xc073('0x31')][_0xc073('0x51')]){_0x49ce62[_0xc073('0x4f')]=_[_0xc073('0x52')](_0x49ce62[_0xc073('0x4f')],{'$or':_[_0xc073('0x30')](_0x43c5f5,function(_0x175170){if(_0x175170[_0xc073('0x2d')]!==_0xc073('0x53')){var _0xec1a3a={};_0xec1a3a[_0x175170['name']]={'$like':'%'+_0x5bcd11[_0xc073('0x31')]['filter']+'%'};return _0xec1a3a;}})});}_0x49ce62=_[_0xc073('0x52')]({},_0x49ce62,_0x5bcd11[_0xc073('0x54')]);var _0x484d3b={'where':_0x49ce62[_0xc073('0x4f')]};return db[_0xc073('0x2a')][_0xc073('0x1e')](_0x484d3b)['then'](function(_0x2f532a){_0x594e66['count']=_0x2f532a;if(_0x5bcd11[_0xc073('0x31')][_0xc073('0x55')]){_0x49ce62['include']=[{'all':!![]}];}return db['CmHopper'][_0xc073('0x56')](_0x49ce62);})[_0xc073('0x25')](function(_0x1538bf){_0x594e66[_0xc073('0x57')]=_0x1538bf;return _0x594e66;})[_0xc073('0x25')](respondWithFilteredResult(_0x3a8b8f,_0x49ce62))[_0xc073('0x58')](handleError(_0x3a8b8f,null));};exports[_0xc073('0x59')]=function(_0x330e2e,_0x1775b4){var _0x229a82={'raw':!![],'where':{'id':_0x330e2e['params']['id']}},_0x1f5475={};_0x1f5475[_0xc073('0x2f')]=_[_0xc073('0x32')](db[_0xc073('0x2a')]['rawAttributes']);_0x1f5475[_0xc073('0x31')]=_[_0xc073('0x32')](_0x330e2e[_0xc073('0x31')]);_0x1f5475[_0xc073('0x33')]=_['intersection'](_0x1f5475['model'],_0x1f5475[_0xc073('0x31')]);_0x229a82['attributes']=_[_0xc073('0x5a')](_0x1f5475[_0xc073('0x2f')],qs['fields'](_0x330e2e[_0xc073('0x31')][_0xc073('0x48')]));_0x229a82[_0xc073('0x49')]=_0x229a82[_0xc073('0x49')][_0xc073('0x4a')]?_0x229a82[_0xc073('0x49')]:_0x1f5475[_0xc073('0x2f')];if(_0x330e2e[_0xc073('0x31')][_0xc073('0x55')]){_0x229a82['include']=[{'all':!![]}];}_0x229a82=_['merge']({},_0x229a82,_0x330e2e[_0xc073('0x54')]);return db[_0xc073('0x2a')][_0xc073('0x5b')](_0x229a82)[_0xc073('0x25')](handleEntityNotFound(_0x1775b4,null))[_0xc073('0x25')](respondWithResult(_0x1775b4,null))[_0xc073('0x58')](handleError(_0x1775b4,null));};exports[_0xc073('0x5c')]=function(_0x332b7d,_0x2e090e){return db[_0xc073('0x2a')][_0xc073('0x5c')](_0x332b7d[_0xc073('0x5d')],{})[_0xc073('0x25')](respondWithResult(_0x2e090e,0xc9))[_0xc073('0x58')](handleError(_0x2e090e,null));};exports[_0xc073('0x24')]=function(_0x32061c,_0x5c2d5a){if(_0x32061c['body']['id']){delete _0x32061c[_0xc073('0x5d')]['id'];}return db[_0xc073('0x2a')][_0xc073('0x5b')]({'where':{'id':_0x32061c['params']['id']}})[_0xc073('0x25')](handleEntityNotFound(_0x5c2d5a,null))[_0xc073('0x25')](saveUpdates(_0x32061c['body'],null))[_0xc073('0x25')](respondWithResult(_0x5c2d5a,null))[_0xc073('0x58')](handleError(_0x5c2d5a,null));};exports[_0xc073('0x5e')]=function(_0x1c4e84,_0x1294bb){return db['CmHopper'][_0xc073('0x5e')]()[_0xc073('0x25')](respondWithResult(_0x1294bb,null))['catch'](handleError(_0x1294bb,null));};exports[_0xc073('0x5f')]=function(_0x4778a3,_0x45d115){var _0x5c5518;return db[_0xc073('0x2a')][_0xc073('0x5b')]({'where':{'id':_0x4778a3[_0xc073('0x60')]['id']}})[_0xc073('0x25')](handleEntityNotFound(_0x45d115,null))[_0xc073('0x25')](function(_0x293bb2){if(_0x293bb2){return _0x293bb2[_0xc073('0x5f')]()[_0xc073('0x25')](function(_0x42a2a6){return _0x42a2a6;});}})[_0xc073('0x25')](function(_0x1388db){_0x5c5518=_0x1388db;if(_0x1388db){if(_0x1388db[_0xc073('0x61')]||_0x1388db[_0xc073('0x62')]){return db[_0x1388db['VoiceQueueId']?_0xc073('0x63'):'Campaign'][_0xc073('0x5b')]({'where':{'id':_0x1388db[_0xc073('0x61')]?_0x1388db[_0xc073('0x61')]:_0x1388db['CampaignId']},'attributes':['id',_0xc073('0x27')],'raw':!![]});}}})[_0xc073('0x25')](function(_0x39d4c2){var _0x280550={};if(_0x39d4c2){_[_0xc073('0x52')](_0x280550,_[_0xc073('0x64')](_0x5c5518[_0xc073('0x65')],['createdAt',_0xc073('0x66'),'id']));_0x280550[_0xc073('0x67')]=0x15;_0x280550[_0xc073('0x68')]='deleted';_0x280550[_0xc073('0x69')]=_0x39d4c2[_0xc073('0x27')];_0x280550['membername']=_0x4778a3[_0xc073('0x6a')][_0xc073('0x27')];_0x280550[_0xc073('0x6b')]=_0x4778a3[_0xc073('0x6a')]['id'];_0x280550['deleted']=!![];_0x280550['deletedat']=moment()[_0xc073('0x6c')](_0xc073('0x6d'));_0x280550[_0xc073('0x6e')]=_0x5c5518[_0xc073('0x6f')];_0x280550[_0xc073('0x70')]=_0x5c5518[_0xc073('0x61')]?_0xc073('0x71'):_0xc073('0x72');return db[_0xc073('0x73')]['find']({'where':{'id':_0x280550[_0xc073('0x74')]},'attributes':[_0xc073('0x75'),_0xc073('0x76')]})[_0xc073('0x25')](function(_0x310278){if(!_[_0xc073('0x77')](_0x45d115)&&!_['isNil'](_0x310278['firstName'])){_0x280550['calleridname']=_0x310278['firstName'];if(!_[_0xc073('0x77')](_0x310278[_0xc073('0x76')])){_0x280550[_0xc073('0x78')]+='\x20'+_0x310278[_0xc073('0x76')];}}})[_0xc073('0x79')](function(){return db[_0xc073('0x7a')][_0xc073('0x5c')](_0x280550);});}})['then'](function(){return _0x45d115[_0xc073('0x19')](0xcc)['end']();})['catch'](handleError(_0x45d115,null));};exports[_0xc073('0x7b')]=function(_0x190e43,_0x53bb2b,_0x1222e7){var _0x1c4106=[];return db['CmContact'][_0xc073('0x5e')]()[_0xc073('0x25')](function(_0x4c1d13){_0x1c4106=_[_0xc073('0x32')](_0x4c1d13);return _0x190e43[_0xc073('0x6a')][_0xc073('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc073('0x7d')},'attributes':['id',_0xc073('0x7e'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x10ea55){if(_0x10ea55&&_0x10ea55[_0xc073('0x4a')]){return db[_0xc073('0x7f')][_0xc073('0x80')](function(_0x33dd8c){var _0x1faf9a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xc073('0x30')](_0x10ea55,'id')},'$or':[{'UserId':null},{'UserId':_0x190e43[_0xc073('0x6a')]['id']}]};var _0x1760ce={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x10ea55)['filter']([_0xc073('0x81'),0x0])[_0xc073('0x30')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x190e43['user']['id']}]};var _0x322ce6={'$or':[_0x1faf9a,_0x1760ce]};var _0x55b80c=[];if(_0x190e43['body']['direction']&&_0x190e43[_0xc073('0x5d')][_0xc073('0x82')]===_0xc073('0x83')){if(!_['isEmpty'](_0x190e43[_0xc073('0x5d')][_0xc073('0x84')])){_0x322ce6['id']={'$in':_0x190e43[_0xc073('0x5d')][_0xc073('0x84')]};}_0x55b80c=[[_0xc073('0x85'),_0xc073('0x86')],[_0xc073('0x87'),_0x10ea55[0x0][_0xc073('0x7e')]===_0xc073('0x86')?_0xc073('0x88'):_0xc073('0x86')],db[_0xc073('0x7f')]['literal'](_0xc073('0x89')),['id',_0xc073('0x88')]];}else{if(!_[_0xc073('0x8a')](_0x190e43['body'][_0xc073('0x84')])){_0x322ce6['id']={'$notIn':_0x190e43[_0xc073('0x5d')][_0xc073('0x84')]};}_0x55b80c=[[_0xc073('0x85'),_0xc073('0x88')],['scheduledAt',_0x10ea55[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xc073('0x8b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xc073('0x86')]];}return db[_0xc073('0x2a')][_0xc073('0x8c')]({'attributes':['id',_0xc073('0x8d'),_0xc073('0x8e')],'where':_0x322ce6,'order':_0x55b80c,'transaction':_0x33dd8c,'lock':_0x33dd8c['LOCK'][_0xc073('0x8f')],'include':[{'model':db[_0xc073('0x73')],'as':'Contact','attributes':_0x1c4106,'include':[{'model':db[_0xc073('0x90')],'as':_0xc073('0x91'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xc073('0x92'),'attributes':['id',_0xc073('0x27')]},{'model':db[_0xc073('0x63')],'as':_0xc073('0x93'),'attributes':['id',_0xc073('0x27'),'dialActive']}]})[_0xc073('0x25')](function(_0xf9a179){if(_0xf9a179){return _0xf9a179[_0xc073('0x24')]({'UserId':_0x190e43[_0xc073('0x6a')]['id']},{'transaction':_0x33dd8c});}});});}})['then'](handleEntityNotFound(_0x53bb2b,null))[_0xc073('0x25')](respondWithResult(_0x53bb2b,null))[_0xc073('0x58')](handleError(_0x53bb2b,null));};exports['getPreviewRecall']=function(_0x51c6ae,_0x51e11c,_0x1f249c){var _0x50dccc=[];return db[_0xc073('0x73')][_0xc073('0x5e')]()[_0xc073('0x25')](function(_0x7ae3ee){_0x50dccc=_[_0xc073('0x32')](_0x7ae3ee);return _0x51c6ae[_0xc073('0x6a')]['getVoiceQueues']({'where':{'type':_0xc073('0x94'),'dialActive':!![],'dialMethod':_0xc073('0x7d')},'attributes':['id',_0xc073('0x7e'),_0xc073('0x81')],'raw':!![]});})[_0xc073('0x25')](function(_0x348f84){if(_0x348f84&&_0x348f84['length']){return db[_0xc073('0x7f')][_0xc073('0x80')](function(_0x541717){var _0x533265={'active':![],'recallme':!![],'id':_0x51c6ae[_0xc073('0x5d')][_0xc073('0x95')]};return db['CmHopper'][_0xc073('0x8c')]({'attributes':['id','scheduledat','recallme'],'where':_0x533265,'transaction':_0x541717,'lock':_0x541717[_0xc073('0x96')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xc073('0x97'),'attributes':_0x50dccc,'include':[{'model':db['CmCompany'],'as':_0xc073('0x91'),'attributes':['id',_0xc073('0x27')]}]},{'model':db['CmList'],'as':_0xc073('0x92'),'attributes':['id',_0xc073('0x27')]},{'model':db[_0xc073('0x63')],'as':_0xc073('0x93'),'attributes':['id','name',_0xc073('0x98')]}]})['then'](function(_0x572f1a){if(_0x572f1a){return _0x572f1a[_0xc073('0x24')]({'UserId':_0x51c6ae['user']['id']},{'transaction':_0x541717});}});});}})['then'](handleEntityNotFound(_0x51e11c,null))[_0xc073('0x25')](respondWithResult(_0x51e11c,null))[_0xc073('0x58')](handleError(_0x51e11c,null));};exports[_0xc073('0x99')]=function(_0x34a027,_0x3125b0,_0x62b9c7){return _0x34a027[_0xc073('0x6a')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc073('0x7d')},'attributes':['id'],'raw':!![]})[_0xc073('0x25')](function(_0x4dfc5a){if(_0x4dfc5a&&_0x4dfc5a[_0xc073('0x4a')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc073('0x6d'))},'VoiceQueueId':{'$in':_[_0xc073('0x30')](_0x4dfc5a,'id')},'$or':[{'UserId':null},{'UserId':_0x34a027[_0xc073('0x6a')]['id']}]}});}return 0x0;})['then'](function(_0x55750b){if(!_['isNil'](_0x55750b)&&_[_0xc073('0x9a')](_0x55750b)){return _0x3125b0['status'](0xc8)[_0xc073('0x1b')]({'contacts':_0x55750b});}else{logger[_0xc073('0x26')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc073('0x99'),0x194,_0xc073('0x9b'));_0x3125b0[_0xc073('0x18')](0x194);}})[_0xc073('0x58')](handleError(_0x3125b0,null));};exports['getTimezones']=function(_0x5d8a86,_0x1e68b3,_0x3c4a9a){var _0x2c9c92=shared[_0xc073('0x9c')];var _0xc35870=[];_['map'](_0x2c9c92,function(_0x35143f){_0xc35870['push']({'id':_0x35143f[_0xc073('0x27')],'name':_0x35143f[_0xc073('0x27')],'utcOffset':_0x35143f[_0xc073('0x9d')]});});return _0x1e68b3[_0xc073('0x19')](0xc8)[_0xc073('0x1b')]({'tz':_0xc35870});};exports[_0xc073('0x9e')]=function(_0x563f07,_0x57cc99,_0x17235f){var _0x578f82=shared[_0xc073('0x9c')];var _0x20b663={};if(!_['isNil'](_0x578f82[_0x563f07[_0xc073('0x5d')]['id']]))_0x20b663=_0x578f82[_0x563f07['body']['id']];return _0x57cc99['status'](0xc8)[_0xc073('0x1b')](_0x20b663);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b502ba4..b43a75c 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x3073b1,_0x349ef5){_0x3073b1=_0x3073b1-0x0;var _0x58d884=_0x687b[_0x3073b1];return _0x58d884;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x465167,_0x596b28){var _0x2b0a5a=function(_0x5aafdd){while(--_0x5aafdd){_0x465167['push'](_0x465167['shift']());}};_0x2b0a5a(++_0x596b28);}(_0x2bd8,0x130));var _0x82bd=function(_0x2761df,_0x161401){_0x2761df=_0x2761df-0x0;var _0x20d29f=_0x2bd8[_0x2761df];return _0x20d29f;};'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 diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d5020b3..554886b 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 _0x5985=['update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','destroy','literal','format','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowCmHopper','catch','create','body','CreateCmHopper','UpdateCmHopper'];(function(_0x1b4400,_0xe64899){var _0x1d0911=function(_0x4c2098){while(--_0x4c2098){_0x1b4400['push'](_0x1b4400['shift']());}};_0x1d0911(++_0xe64899);}(_0x5985,0x17e));var _0x5598=function(_0x2bb8c9,_0xe2f9c){_0x2bb8c9=_0x2bb8c9-0x0;var _0x15329c=_0x5985[_0x2bb8c9];return _0x15329c;};'use strict';var _=require('lodash');var util=require(_0x5598('0x0'));var moment=require(_0x5598('0x1'));var BPromise=require(_0x5598('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5598('0x3'))['db'];var utils=require(_0x5598('0x4'));var logger=require(_0x5598('0x5'))(_0x5598('0x6'));var config=require(_0x5598('0x7'));var jayson=require(_0x5598('0x8'));const {validateExpressRequest}=require(_0x5598('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53c8de,_0x39b60a,_0x40d7b4){return new BPromise(function(_0x327245,_0x1b1c04){return client[_0x5598('0xa')](_0x53c8de,_0x40d7b4)['then'](function(_0x228cd9){logger['info'](_0x5598('0xb'),_0x39b60a,_0x5598('0xc'));logger[_0x5598('0xd')](_0x5598('0xe'),_0x39b60a,_0x5598('0xc'),JSON[_0x5598('0xf')](_0x228cd9));if(_0x228cd9[_0x5598('0x10')]){if(_0x228cd9[_0x5598('0x10')][_0x5598('0x11')]===0x1f4){logger[_0x5598('0x10')]('CmHopper,\x20%s,\x20%s',_0x39b60a,_0x228cd9[_0x5598('0x10')][_0x5598('0x12')]);return _0x1b1c04(_0x228cd9[_0x5598('0x10')][_0x5598('0x12')]);}logger[_0x5598('0x10')]('CmHopper,\x20%s,\x20%s',_0x39b60a,_0x228cd9[_0x5598('0x10')][_0x5598('0x12')]);return _0x327245(_0x228cd9[_0x5598('0x10')][_0x5598('0x12')]);}else{logger[_0x5598('0x13')](_0x5598('0xb'),_0x39b60a,'request\x20sent');_0x327245(_0x228cd9['result']['message']);}})['catch'](function(_0x52ed33){logger[_0x5598('0x10')](_0x5598('0xb'),_0x39b60a,_0x52ed33);_0x1b1c04(_0x52ed33);});});}exports[_0x5598('0x14')]=function(_0x5b306d){var _0x7e48e6=this;return new Promise(function(_0x24bd59,_0x30fd59){return db[_0x5598('0x15')][_0x5598('0x16')]({'raw':_0x5b306d[_0x5598('0x17')]?_0x5b306d[_0x5598('0x17')][_0x5598('0x18')]===undefined?!![]:![]:!![],'where':_0x5b306d[_0x5598('0x17')]?_0x5b306d['options'][_0x5598('0x19')]||null:null,'attributes':_0x5b306d[_0x5598('0x17')]?_0x5b306d['options'][_0x5598('0x1a')]||null:null,'limit':_0x5b306d[_0x5598('0x17')]?_0x5b306d[_0x5598('0x17')][_0x5598('0x1b')]||null:null,'include':_0x5b306d['options']?_0x5b306d[_0x5598('0x17')][_0x5598('0x1c')]?_['map'](_0x5b306d[_0x5598('0x17')][_0x5598('0x1c')],function(_0x53b287){return{'model':db[_0x53b287[_0x5598('0x1d')]],'as':_0x53b287['as'],'attributes':_0x53b287[_0x5598('0x1a')],'include':_0x53b287['include']?_[_0x5598('0x1e')](_0x53b287[_0x5598('0x1c')],function(_0x1fdd7d){return{'model':db[_0x1fdd7d['model']],'as':_0x1fdd7d['as'],'attributes':_0x1fdd7d['attributes'],'include':_0x1fdd7d[_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x1fdd7d['include'],function(_0x21167b){return{'model':db[_0x21167b['model']],'as':_0x21167b['as'],'attributes':_0x21167b[_0x5598('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5598('0x1f')](function(_0x1112a4){logger[_0x5598('0x13')](_0x5598('0x14'),_0x5b306d);logger[_0x5598('0xd')](_0x5598('0x14'),_0x5b306d,JSON[_0x5598('0xf')](_0x1112a4));_0x24bd59(_0x1112a4);})['catch'](function(_0x3d3d88){logger[_0x5598('0x10')]('GetCmHopper',_0x3d3d88[_0x5598('0x12')],_0x5b306d);_0x30fd59(_0x7e48e6[_0x5598('0x10')](0x1f4,_0x3d3d88[_0x5598('0x12')]));});});};exports[_0x5598('0x20')]=function(_0x169778){var _0x4f7899=this;return new Promise(function(_0x17c538,_0x24917e){return db[_0x5598('0x15')]['find']({'raw':_0x169778['options']?_0x169778['options']['raw']===undefined?!![]:![]:!![],'where':_0x169778[_0x5598('0x17')]?_0x169778[_0x5598('0x17')]['where']||null:null,'attributes':_0x169778['options']?_0x169778[_0x5598('0x17')][_0x5598('0x1a')]||null:null,'include':_0x169778[_0x5598('0x17')]?_0x169778[_0x5598('0x17')][_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x169778[_0x5598('0x17')]['include'],function(_0x375314){return{'model':db[_0x375314[_0x5598('0x1d')]],'as':_0x375314['as'],'attributes':_0x375314[_0x5598('0x1a')],'include':_0x375314[_0x5598('0x1c')]?_['map'](_0x375314['include'],function(_0x1f0eab){return{'model':db[_0x1f0eab[_0x5598('0x1d')]],'as':_0x1f0eab['as'],'attributes':_0x1f0eab[_0x5598('0x1a')],'include':_0x1f0eab[_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x1f0eab['include'],function(_0x817d10){return{'model':db[_0x817d10[_0x5598('0x1d')]],'as':_0x817d10['as'],'attributes':_0x817d10[_0x5598('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5598('0x1f')](function(_0x37a960){logger[_0x5598('0x13')](_0x5598('0x20'),_0x169778);logger[_0x5598('0xd')]('ShowCmHopper',_0x169778,JSON[_0x5598('0xf')](_0x37a960));_0x17c538(_0x37a960);})[_0x5598('0x21')](function(_0x2d4ff5){logger[_0x5598('0x10')](_0x5598('0x20'),_0x2d4ff5[_0x5598('0x12')],_0x169778);_0x24917e(_0x4f7899[_0x5598('0x10')](0x1f4,_0x2d4ff5[_0x5598('0x12')]));});});};exports['CreateCmHopper']=function(_0x7a74f2){var _0x40343c=this;return new Promise(function(_0x8c58d2,_0x20d873){return db[_0x5598('0x15')][_0x5598('0x22')](_0x7a74f2[_0x5598('0x23')],{'raw':_0x7a74f2[_0x5598('0x17')]?_0x7a74f2[_0x5598('0x17')][_0x5598('0x18')]===undefined?!![]:![]:!![]})[_0x5598('0x1f')](function(_0x405d15){logger[_0x5598('0x13')](_0x5598('0x24'),_0x7a74f2);logger[_0x5598('0xd')](_0x5598('0x24'),_0x7a74f2,JSON[_0x5598('0xf')](_0x405d15));_0x8c58d2(_0x405d15);})[_0x5598('0x21')](function(_0xdd2695){logger['error'](_0x5598('0x24'),_0xdd2695[_0x5598('0x12')],_0x7a74f2);_0x20d873(_0x40343c[_0x5598('0x10')](0x1f4,_0xdd2695[_0x5598('0x12')]));});});};exports[_0x5598('0x25')]=function(_0x2ff4a2){var _0x5e1ef8=this;return new Promise(function(_0x56572e,_0x497d4f){return db[_0x5598('0x15')][_0x5598('0x26')](_0x2ff4a2[_0x5598('0x23')],{'raw':_0x2ff4a2[_0x5598('0x17')]?_0x2ff4a2[_0x5598('0x17')][_0x5598('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff4a2[_0x5598('0x17')]?_0x2ff4a2[_0x5598('0x17')][_0x5598('0x19')]||null:null,'attributes':_0x2ff4a2[_0x5598('0x17')]?_0x2ff4a2['options']['attributes']||null:null,'limit':_0x2ff4a2[_0x5598('0x17')]?_0x2ff4a2[_0x5598('0x17')][_0x5598('0x1b')]||null:null})['then'](function(_0x1b39e0){logger['info']('UpdateCmHopper',_0x2ff4a2);logger['info'](_0x5598('0x27'),JSON['stringify'](_0x2ff4a2[_0x5598('0x17')][_0x5598('0x19')]),_0x2ff4a2[_0x5598('0x23')][_0x5598('0x28')]);logger[_0x5598('0xd')](_0x5598('0x25'),_0x2ff4a2,JSON[_0x5598('0xf')](_0x1b39e0));_0x56572e(_0x1b39e0);})['catch'](function(_0x3444a7){logger[_0x5598('0x10')](_0x5598('0x25'),_0x3444a7[_0x5598('0x12')],_0x2ff4a2);_0x497d4f(_0x5e1ef8[_0x5598('0x10')](0x1f4,_0x3444a7['message']));});});};exports['DestroyCmHopper']=function(_0x3b97ca){var _0x282ca9=this;return new Promise(function(_0x327cde,_0x4ef464){return db[_0x5598('0x15')]['destroy']({'where':_0x3b97ca[_0x5598('0x17')]?_0x3b97ca[_0x5598('0x17')][_0x5598('0x19')]||null:null})[_0x5598('0x1f')](function(_0x49c14a){logger[_0x5598('0x13')](_0x5598('0x29'),_0x3b97ca);logger[_0x5598('0xd')]('DestroyCmHopper',_0x3b97ca,JSON['stringify'](_0x49c14a));_0x327cde(_0x49c14a);})[_0x5598('0x21')](function(_0x35ac6c){logger[_0x5598('0x10')]('DestroyCmHopper',_0x35ac6c[_0x5598('0x12')],_0x3b97ca);_0x4ef464(_0x282ca9['error'](0x1f4,_0x35ac6c['message']));});});};exports[_0x5598('0x2a')]=function(_0x4c9ef2){var _0x51dea5=this;return new Promise(function(_0x5b0bbf,_0x1ddf5a){return db[_0x5598('0x2b')][_0x5598('0x2c')]()[_0x5598('0x1f')](function(_0x17325d){return db[_0x5598('0x2d')][_0x5598('0x2e')](function(_0xb8fd14){return db[_0x5598('0x15')][_0x5598('0x16')]({'where':_0x4c9ef2[_0x5598('0x17')]?_0x4c9ef2[_0x5598('0x17')][_0x5598('0x19')]||null:null,'attributes':_0x4c9ef2[_0x5598('0x17')]?_0x4c9ef2[_0x5598('0x17')][_0x5598('0x1a')]||null:null,'limit':_0x4c9ef2[_0x5598('0x17')]?_0x4c9ef2[_0x5598('0x17')][_0x5598('0x1b')]||null:null,'order':_0x4c9ef2[_0x5598('0x17')]?_0x4c9ef2[_0x5598('0x17')][_0x5598('0x2f')]||null:null,'transaction':_0xb8fd14,'lock':_0xb8fd14[_0x5598('0x30')][_0x5598('0x31')],'include':[{'model':db['CmContact'],'as':_0x5598('0x32'),'attributes':_[_0x5598('0x33')](_0x17325d)},{'model':db[_0x5598('0x34')],'as':_0x5598('0x35'),'attributes':['id',_0x5598('0x36'),_0x5598('0x37')]}]})[_0x5598('0x1f')](function(_0x436ae7){var _0x32e1f8=[];var _0x21901e=[];for(var _0xc68706=0x0;_0xc68706<_0x436ae7[_0x5598('0x38')];_0xc68706+=0x1){var _0x160150=_0x436ae7[_0xc68706][_0x5598('0x39')];if(_0x160150===null){_0x32e1f8[_0x5598('0x3a')](_0x436ae7[_0xc68706][_0x5598('0x26')](_0x4c9ef2[_0x5598('0x23')],{'transaction':_0xb8fd14}));}else if(!_0x21901e['includes'](_0x160150)){_0x21901e[_0x5598('0x3a')](_0x160150);_0x32e1f8['push'](_0x436ae7[_0xc68706]['update'](_0x4c9ef2[_0x5598('0x23')],{'transaction':_0xb8fd14}));}}return BPromise[_0x5598('0x3b')](_0x32e1f8);});})[_0x5598('0x1f')](function(_0x45598b){logger['info'](_0x5598('0x2a'),_0x4c9ef2);if(_0x45598b[_0x5598('0x38')]>0x0){logger[_0x5598('0x13')](_0x5598('0x3c'),_0x45598b[0x0][_0x5598('0x3d')]['id'],_0x45598b[0x0][_0x5598('0x3d')][_0x5598('0x3e')],_0x45598b[0x0]['dataValues']['active']);}logger['debug'](_0x5598('0x2a'),_0x4c9ef2,JSON[_0x5598('0xf')](_0x45598b));_0x5b0bbf(_0x45598b);})[_0x5598('0x21')](function(_0x5070e5){logger[_0x5598('0x10')](_0x5598('0x2a'),_0x5070e5[_0x5598('0x12')],_0x4c9ef2);_0x1ddf5a(_0x51dea5[_0x5598('0x10')](0x1f4,_0x5070e5[_0x5598('0x12')]));});});});};exports[_0x5598('0x3f')]=function(_0x575f76){var _0x12e94a=this;return new Promise(function(_0x2c3c9a,_0xdfd84f){return db[_0x5598('0x2d')][_0x5598('0x2e')](function(_0x29da12){return db['CmHopperFinal'][_0x5598('0x22')](_0x575f76['body'],{'raw':_0x575f76[_0x5598('0x17')]?_0x575f76[_0x5598('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x29da12})[_0x5598('0x1f')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x5598('0xf')](_0x575f76[_0x5598('0x17')][_0x5598('0x19')]),_0x575f76['options'][_0x5598('0x19')][_0x5598('0x28')]);return db[_0x5598('0x15')][_0x5598('0x40')]({'where':_0x575f76[_0x5598('0x17')]?_0x575f76[_0x5598('0x17')][_0x5598('0x19')]||null:null,'transaction':_0x29da12});});})[_0x5598('0x1f')](function(_0x960bd9){logger[_0x5598('0x13')](_0x5598('0x3f'),_0x575f76);logger['debug'](_0x5598('0x3f'),_0x575f76,JSON['stringify'](_0x960bd9));_0x2c3c9a(_0x960bd9);})[_0x5598('0x21')](function(_0x727dbe){logger['error']('MoveContactManagedDialer',_0x727dbe[_0x5598('0x12')],_0x575f76);_0xdfd84f(_0x12e94a[_0x5598('0x10')](0x1f4,_0x727dbe[_0x5598('0x12')]));});});};exports['CountReScheduled']=function(_0x3150d2){var _0x235d8e=this;return new Promise(function(_0x35574f,_0x52aaa5){return db[_0x5598('0x15')][_0x5598('0x16')]({'raw':_0x3150d2[_0x5598('0x17')]?_0x3150d2[_0x5598('0x17')][_0x5598('0x18')]===undefined?!![]:![]:!![],'where':_0x3150d2['options']?_0x3150d2['options'][_0x5598('0x19')]||null:null,'attributes':[[db[_0x5598('0x2d')]['fn']('COUNT',db[_0x5598('0x2d')]['fn']('IF',db[_0x5598('0x2d')][_0x5598('0x41')]('`scheduledat`\x20>=\x20'+util[_0x5598('0x42')]('\x22%s\x22',moment()[_0x5598('0x42')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5598('0x43')))),_0x5598('0x44')]]})[_0x5598('0x1f')](function(_0x4a2005){logger['info'](_0x5598('0x45'),_0x3150d2);logger[_0x5598('0xd')](_0x5598('0x45'),_0x3150d2,JSON[_0x5598('0xf')](_0x4a2005));_0x35574f(_0x4a2005);})[_0x5598('0x21')](function(_0xb7946e){logger[_0x5598('0x10')](_0x5598('0x45'),_0xb7946e['message'],_0x3150d2);_0x52aaa5(_0x235d8e[_0x5598('0x10')](0x1f4,_0xb7946e['message']));});});};exports[_0x5598('0x46')]=function(_0x3fb83f){var _0xb29173=this;return new Promise(function(_0x124b58,_0x348657){return db[_0x5598('0x2b')][_0x5598('0x2c')]()[_0x5598('0x1f')](function(_0x196e3e){return db[_0x5598('0x2d')][_0x5598('0x2e')](function(_0x1bc16e){return db['CmHopper']['findAll']({'where':_0x3fb83f['options']?_0x3fb83f[_0x5598('0x17')][_0x5598('0x19')]||null:null,'attributes':_0x3fb83f[_0x5598('0x17')]?_0x3fb83f['options'][_0x5598('0x1a')]||null:null,'limit':0x1,'order':_0x3fb83f[_0x5598('0x17')]?_0x3fb83f[_0x5598('0x17')]['order']||null:null,'group':db[_0x5598('0x15')]['UserId'],'transaction':_0x1bc16e,'lock':_0x1bc16e[_0x5598('0x30')][_0x5598('0x31')],'include':_0x3fb83f['options']?_0x3fb83f[_0x5598('0x17')][_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x3fb83f[_0x5598('0x17')][_0x5598('0x1c')],function(_0x3c5840){return{'model':db[_0x3c5840[_0x5598('0x1d')]],'as':_0x3c5840['as'],'attributes':_0x3c5840[_0x5598('0x1a')],'include':_0x3c5840['include']?_[_0x5598('0x1e')](_0x3c5840['include'],function(_0x287417){return{'model':db[_0x287417[_0x5598('0x1d')]],'as':_0x287417['as'],'attributes':_0x287417[_0x5598('0x1a')],'include':_0x287417[_0x5598('0x1c')]?_['map'](_0x287417[_0x5598('0x1c')],function(_0xd5b85d){return{'model':db[_0xd5b85d['model']],'as':_0xd5b85d['as'],'attributes':_0xd5b85d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5598('0x1f')](function(_0xda33e2){var _0x420cae=[];for(var _0x110ef6=0x0;_0x110ef6<_0xda33e2['length'];_0x110ef6+=0x1){_0x420cae[_0x5598('0x3a')](_0xda33e2[_0x110ef6][_0x5598('0x26')](_0x3fb83f[_0x5598('0x23')],{'transaction':_0x1bc16e}));}return BPromise[_0x5598('0x3b')](_0x420cae);});})[_0x5598('0x1f')](function(_0x495a33){logger[_0x5598('0x13')](_0x5598('0x46'),_0x3fb83f);logger[_0x5598('0xd')](_0x5598('0x46'),_0x3fb83f,JSON[_0x5598('0xf')](_0x495a33));_0x124b58(_0x495a33);})[_0x5598('0x21')](function(_0x29878b){logger['error'](_0x5598('0x46'),_0x29878b[_0x5598('0x12')],_0x3fb83f);_0x348657(_0xb29173['error'](0x1f4,_0x29878b[_0x5598('0x12')]));});});});};exports[_0x5598('0x47')]=function(_0x271f94){var _0xe00076=this;return new Promise(function(_0x133fc2,_0x3697e3){db[_0x5598('0x2b')][_0x5598('0x2c')]()[_0x5598('0x1f')](function(_0x1ad2e7){return db[_0x5598('0x15')][_0x5598('0x16')]({'raw':_0x271f94[_0x5598('0x17')]?_0x271f94['options'][_0x5598('0x18')]===undefined?!![]:![]:!![],'where':_0x271f94[_0x5598('0x17')]?_0x271f94[_0x5598('0x17')][_0x5598('0x19')]||null:null,'attributes':_0x271f94[_0x5598('0x17')]?_0x271f94[_0x5598('0x17')][_0x5598('0x1a')]||null:null,'limit':_0x271f94[_0x5598('0x17')]?_0x271f94[_0x5598('0x17')][_0x5598('0x1b')]||null:null,'include':_0x271f94[_0x5598('0x17')]?_0x271f94[_0x5598('0x17')][_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x271f94[_0x5598('0x17')][_0x5598('0x1c')],function(_0x519a1d){return{'model':db[_0x519a1d[_0x5598('0x1d')]],'as':_0x519a1d['as'],'attributes':_0x519a1d['as']===_0x5598('0x32')?_[_0x5598('0x33')](_0x1ad2e7):_0x519a1d['attributes'],'include':_0x519a1d[_0x5598('0x1c')]?_[_0x5598('0x1e')](_0x519a1d[_0x5598('0x1c')],function(_0x26c8d4){return{'model':db[_0x26c8d4[_0x5598('0x1d')]],'as':_0x26c8d4['as'],'attributes':_0x26c8d4['attributes'],'include':_0x26c8d4[_0x5598('0x1c')]?_['map'](_0x26c8d4[_0x5598('0x1c')],function(_0x4bd3a9){return{'model':db[_0x4bd3a9[_0x5598('0x1d')]],'as':_0x4bd3a9['as'],'attributes':_0x4bd3a9[_0x5598('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5598('0x1f')](function(_0x14746f){logger[_0x5598('0x13')](_0x5598('0x14'),_0x271f94);logger['debug'](_0x5598('0x14'),_0x271f94,JSON[_0x5598('0xf')](_0x14746f));_0x133fc2(_0x14746f);})[_0x5598('0x21')](function(_0x1fdd62){logger[_0x5598('0x10')](_0x5598('0x14'),_0x1fdd62[_0x5598('0x12')],_0x271f94);_0x3697e3(_0xe00076[_0x5598('0x10')](0x1f4,_0x1fdd62[_0x5598('0x12')]));});});});};exports[_0x5598('0x48')]=function(_0x48b885){var _0x10026d=this;return new Promise(function(_0x159f24,_0x75ddb4){return db[_0x5598('0x2b')][_0x5598('0x49')]({'raw':!![],'where':{'phone':_0x48b885[_0x5598('0x17')]['where'][_0x5598('0x4a')]},'attributes':['id',_0x5598('0x4b')],'order':[['id',_0x5598('0x4c')]]})[_0x5598('0x1f')](function(_0x4f9948){logger['info']('getContactByPhone',_0x48b885);logger[_0x5598('0xd')](_0x5598('0x4d'),_0x48b885,JSON[_0x5598('0xf')](_0x4f9948));_0x159f24(_0x4f9948);})[_0x5598('0x21')](function(_0x5a80e1){logger[_0x5598('0x10')](_0x5598('0x4d'),_0x5a80e1[_0x5598('0x12')],_0x48b885);_0x75ddb4(_0x10026d['error'](0x1f4,_0x5a80e1[_0x5598('0x12')]));});});};exports[_0x5598('0x4e')]=function(_0x4a12f4){var _0x431085=this;return new Promise(function(_0x9a345e,_0x5b8f97){return db[_0x5598('0x2d')]['transaction'](function(_0x24e968){return db[_0x5598('0x15')][_0x5598('0x26')]({'active':![]},{'where':{},'transaction':_0x24e968})[_0x5598('0x1f')](function(_0x41d159){logger['info'](_0x5598('0x4e'),_0x4a12f4);logger[_0x5598('0xd')](_0x5598('0x4e'),_0x4a12f4,JSON[_0x5598('0xf')](_0x41d159));_0x9a345e(_0x41d159);})[_0x5598('0x21')](function(_0x45f311){logger[_0x5598('0x10')](_0x5598('0x4e'),_0x45f311[_0x5598('0x12')],_0x4a12f4);_0x5b8f97(_0x431085['error'](0x1f4,_0x45f311['message']));});});});};exports[_0x5598('0x4f')]=function(_0x411c54){var _0x4a451d=this;var _0x492899=_0x411c54[_0x5598('0x23')][_0x5598('0x19')][_0x5598('0x50')];var _0x3c3437=_0x411c54[_0x5598('0x23')]['where'][_0x5598('0x51')];return new Promise(function(_0x2cc4d0,_0x27fdaf){return db[_0x5598('0x15')][_0x5598('0x16')]({'where':{'voiceQueueId':_0x492899,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5598('0x2d')][_0x5598('0x41')](_0x5598('0x52')+_0x3c3437+_0x5598('0x53'))}},'include':[{'model':db['CmContact'],'as':_0x5598('0x32')},{'model':db[_0x5598('0x34')],'as':_0x5598('0x35'),'attributes':['id','name',_0x5598('0x37')]},{'model':db['CmList'],'as':'List'}]})[_0x5598('0x1f')](function(_0x39d157){return db[_0x5598('0x2d')][_0x5598('0x2e')](function(_0x621e6c){return db[_0x5598('0x15')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x492899,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x5598('0x41')](_0x5598('0x52')+_0x3c3437+_0x5598('0x53'))}},'transaction':_0x621e6c})['then'](function(_0x1777a0){_0x2cc4d0(_0x39d157);})[_0x5598('0x21')](function(_0x5f435c){logger[_0x5598('0x10')](_0x5598('0x4f'),_0x5f435c[_0x5598('0x12')],_0x411c54);_0x27fdaf(validateExpressRequest);});});})[_0x5598('0x21')](function(_0x4a8433){logger[_0x5598('0x10')]('CmHopperHandlePreviewRecallNotifications',_0x4a8433[_0x5598('0x12')],_0x411c54);_0x27fdaf(_0x4a451d[_0x5598('0x10')](0x1f4,_0x4a8433['message']));});});}; \ No newline at end of file +var _0x4fcf=['../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','client','http','request','then','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','UserId','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','describe','length','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x287d41,_0x30913a){var _0x5a729b=function(_0x3fa62a){while(--_0x3fa62a){_0x287d41['push'](_0x287d41['shift']());}};_0x5a729b(++_0x30913a);}(_0x4fcf,0x1b7));var _0xf4fc=function(_0x1cf2ca,_0x2e77f9){_0x1cf2ca=_0x1cf2ca-0x0;var _0x55f695=_0x4fcf[_0x1cf2ca];return _0x55f695;};'use strict';var _=require(_0xf4fc('0x0'));var util=require(_0xf4fc('0x1'));var moment=require('moment');var BPromise=require(_0xf4fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fc('0x3'));var db=require(_0xf4fc('0x4'))['db'];var utils=require(_0xf4fc('0x5'));var logger=require(_0xf4fc('0x6'))(_0xf4fc('0x7'));var config=require(_0xf4fc('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0xf4fc('0x9'));var client=jayson[_0xf4fc('0xa')][_0xf4fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x123056,_0x151d0d,_0x449016){return new BPromise(function(_0x292859,_0x235234){return client[_0xf4fc('0xc')](_0x123056,_0x449016)[_0xf4fc('0xd')](function(_0x267f3d){logger['info'](_0xf4fc('0xe'),_0x151d0d,'request\x20sent');logger['debug'](_0xf4fc('0xf'),_0x151d0d,_0xf4fc('0x10'),JSON[_0xf4fc('0x11')](_0x267f3d));if(_0x267f3d['error']){if(_0x267f3d[_0xf4fc('0x12')][_0xf4fc('0x13')]===0x1f4){logger[_0xf4fc('0x12')](_0xf4fc('0xe'),_0x151d0d,_0x267f3d['error'][_0xf4fc('0x14')]);return _0x235234(_0x267f3d[_0xf4fc('0x12')][_0xf4fc('0x14')]);}logger['error'](_0xf4fc('0xe'),_0x151d0d,_0x267f3d[_0xf4fc('0x12')][_0xf4fc('0x14')]);return _0x292859(_0x267f3d['error'][_0xf4fc('0x14')]);}else{logger['info'](_0xf4fc('0xe'),_0x151d0d,_0xf4fc('0x10'));_0x292859(_0x267f3d[_0xf4fc('0x15')][_0xf4fc('0x14')]);}})[_0xf4fc('0x16')](function(_0x1c1168){logger[_0xf4fc('0x12')](_0xf4fc('0xe'),_0x151d0d,_0x1c1168);_0x235234(_0x1c1168);});});}exports[_0xf4fc('0x17')]=function(_0x66ff68){var _0x2ebc84=this;return new Promise(function(_0x3de812,_0x953e8){return db[_0xf4fc('0x18')][_0xf4fc('0x19')]({'raw':_0x66ff68[_0xf4fc('0x1a')]?_0x66ff68[_0xf4fc('0x1a')][_0xf4fc('0x1b')]===undefined?!![]:![]:!![],'where':_0x66ff68['options']?_0x66ff68[_0xf4fc('0x1a')][_0xf4fc('0x1c')]||null:null,'attributes':_0x66ff68[_0xf4fc('0x1a')]?_0x66ff68[_0xf4fc('0x1a')][_0xf4fc('0x1d')]||null:null,'limit':_0x66ff68[_0xf4fc('0x1a')]?_0x66ff68[_0xf4fc('0x1a')][_0xf4fc('0x1e')]||null:null,'include':_0x66ff68['options']?_0x66ff68['options'][_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x66ff68['options']['include'],function(_0x23b68d){return{'model':db[_0x23b68d[_0xf4fc('0x21')]],'as':_0x23b68d['as'],'attributes':_0x23b68d['attributes'],'include':_0x23b68d[_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x23b68d[_0xf4fc('0x1f')],function(_0x434d88){return{'model':db[_0x434d88['model']],'as':_0x434d88['as'],'attributes':_0x434d88[_0xf4fc('0x1d')],'include':_0x434d88['include']?_[_0xf4fc('0x20')](_0x434d88[_0xf4fc('0x1f')],function(_0x3cc23a){return{'model':db[_0x3cc23a['model']],'as':_0x3cc23a['as'],'attributes':_0x3cc23a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4fc('0xd')](function(_0xcfd00d){logger[_0xf4fc('0x22')](_0xf4fc('0x17'),_0x66ff68);logger[_0xf4fc('0x23')]('GetCmHopper',_0x66ff68,JSON[_0xf4fc('0x11')](_0xcfd00d));_0x3de812(_0xcfd00d);})['catch'](function(_0x51693b){logger[_0xf4fc('0x12')]('GetCmHopper',_0x51693b[_0xf4fc('0x14')],_0x66ff68);_0x953e8(_0x2ebc84['error'](0x1f4,_0x51693b['message']));});});};exports['ShowCmHopper']=function(_0x1e1f47){var _0x1bdc6e=this;return new Promise(function(_0x5658ee,_0x318c08){return db[_0xf4fc('0x18')]['find']({'raw':_0x1e1f47['options']?_0x1e1f47[_0xf4fc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e1f47[_0xf4fc('0x1a')]?_0x1e1f47[_0xf4fc('0x1a')][_0xf4fc('0x1c')]||null:null,'attributes':_0x1e1f47[_0xf4fc('0x1a')]?_0x1e1f47[_0xf4fc('0x1a')][_0xf4fc('0x1d')]||null:null,'include':_0x1e1f47['options']?_0x1e1f47['options']['include']?_[_0xf4fc('0x20')](_0x1e1f47[_0xf4fc('0x1a')][_0xf4fc('0x1f')],function(_0x85047a){return{'model':db[_0x85047a[_0xf4fc('0x21')]],'as':_0x85047a['as'],'attributes':_0x85047a[_0xf4fc('0x1d')],'include':_0x85047a[_0xf4fc('0x1f')]?_['map'](_0x85047a[_0xf4fc('0x1f')],function(_0x517ac3){return{'model':db[_0x517ac3['model']],'as':_0x517ac3['as'],'attributes':_0x517ac3[_0xf4fc('0x1d')],'include':_0x517ac3[_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x517ac3[_0xf4fc('0x1f')],function(_0x22be73){return{'model':db[_0x22be73[_0xf4fc('0x21')]],'as':_0x22be73['as'],'attributes':_0x22be73[_0xf4fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf4fc('0xd')](function(_0x5a3aa8){logger[_0xf4fc('0x22')](_0xf4fc('0x24'),_0x1e1f47);logger[_0xf4fc('0x23')]('ShowCmHopper',_0x1e1f47,JSON[_0xf4fc('0x11')](_0x5a3aa8));_0x5658ee(_0x5a3aa8);})[_0xf4fc('0x16')](function(_0x510659){logger['error'](_0xf4fc('0x24'),_0x510659[_0xf4fc('0x14')],_0x1e1f47);_0x318c08(_0x1bdc6e[_0xf4fc('0x12')](0x1f4,_0x510659[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x25')]=function(_0x459413){var _0x42a083=this;return new Promise(function(_0x3afdf8,_0x495266){return db[_0xf4fc('0x18')][_0xf4fc('0x26')](_0x459413['body'],{'raw':_0x459413['options']?_0x459413[_0xf4fc('0x1a')][_0xf4fc('0x1b')]===undefined?!![]:![]:!![]})[_0xf4fc('0xd')](function(_0x29fdf9){logger[_0xf4fc('0x22')](_0xf4fc('0x25'),_0x459413);logger[_0xf4fc('0x23')]('CreateCmHopper',_0x459413,JSON[_0xf4fc('0x11')](_0x29fdf9));_0x3afdf8(_0x29fdf9);})[_0xf4fc('0x16')](function(_0x613ff0){logger[_0xf4fc('0x12')](_0xf4fc('0x25'),_0x613ff0[_0xf4fc('0x14')],_0x459413);_0x495266(_0x42a083[_0xf4fc('0x12')](0x1f4,_0x613ff0[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x27')]=function(_0x504178){var _0x1bd21b=this;return new Promise(function(_0x2c36c3,_0x3cc5a9){return db[_0xf4fc('0x18')][_0xf4fc('0x28')](_0x504178[_0xf4fc('0x29')],{'raw':_0x504178['options']?_0x504178[_0xf4fc('0x1a')][_0xf4fc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x504178[_0xf4fc('0x1a')]?_0x504178[_0xf4fc('0x1a')]['where']||null:null,'attributes':_0x504178[_0xf4fc('0x1a')]?_0x504178['options'][_0xf4fc('0x1d')]||null:null,'limit':_0x504178[_0xf4fc('0x1a')]?_0x504178[_0xf4fc('0x1a')][_0xf4fc('0x1e')]||null:null})[_0xf4fc('0xd')](function(_0x51ebd4){logger[_0xf4fc('0x22')]('UpdateCmHopper',_0x504178);logger[_0xf4fc('0x22')](_0xf4fc('0x2a'),JSON[_0xf4fc('0x11')](_0x504178[_0xf4fc('0x1a')][_0xf4fc('0x1c')]),_0x504178[_0xf4fc('0x29')]['active']);logger[_0xf4fc('0x23')]('UpdateCmHopper',_0x504178,JSON[_0xf4fc('0x11')](_0x51ebd4));_0x2c36c3(_0x51ebd4);})[_0xf4fc('0x16')](function(_0x4bb3c2){logger[_0xf4fc('0x12')](_0xf4fc('0x27'),_0x4bb3c2[_0xf4fc('0x14')],_0x504178);_0x3cc5a9(_0x1bd21b[_0xf4fc('0x12')](0x1f4,_0x4bb3c2['message']));});});};exports['DestroyCmHopper']=function(_0x442883){var _0x5a48ee=this;return new Promise(function(_0x1c9973,_0x221c2d){return db[_0xf4fc('0x18')][_0xf4fc('0x2b')]({'where':_0x442883[_0xf4fc('0x1a')]?_0x442883[_0xf4fc('0x1a')][_0xf4fc('0x1c')]||null:null})[_0xf4fc('0xd')](function(_0x31e030){logger[_0xf4fc('0x22')](_0xf4fc('0x2c'),_0x442883);logger[_0xf4fc('0x23')]('DestroyCmHopper',_0x442883,JSON[_0xf4fc('0x11')](_0x31e030));_0x1c9973(_0x31e030);})[_0xf4fc('0x16')](function(_0x552c37){logger[_0xf4fc('0x12')]('DestroyCmHopper',_0x552c37[_0xf4fc('0x14')],_0x442883);_0x221c2d(_0x5a48ee[_0xf4fc('0x12')](0x1f4,_0x552c37[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x2d')]=function(_0x21bda1){var _0x15ca49=this;return new Promise(function(_0x49b26f,_0x3d58f8){return db[_0xf4fc('0x2e')]['describe']()[_0xf4fc('0xd')](function(_0x31a4d5){return db[_0xf4fc('0x2f')][_0xf4fc('0x30')](function(_0x3762ab){return db[_0xf4fc('0x18')][_0xf4fc('0x19')]({'where':_0x21bda1[_0xf4fc('0x1a')]?_0x21bda1['options']['where']||null:null,'attributes':_0x21bda1[_0xf4fc('0x1a')]?_0x21bda1['options'][_0xf4fc('0x1d')]||null:null,'limit':_0x21bda1['options']?_0x21bda1[_0xf4fc('0x1a')][_0xf4fc('0x1e')]||null:null,'order':_0x21bda1[_0xf4fc('0x1a')]?_0x21bda1[_0xf4fc('0x1a')][_0xf4fc('0x31')]||null:null,'transaction':_0x3762ab,'lock':_0x3762ab[_0xf4fc('0x32')][_0xf4fc('0x33')],'include':[{'model':db[_0xf4fc('0x2e')],'as':_0xf4fc('0x34'),'attributes':_[_0xf4fc('0x35')](_0x31a4d5)},{'model':db['User'],'as':_0xf4fc('0x36'),'attributes':['id',_0xf4fc('0x37'),'voicePause']}]})['then'](function(_0x510e6a){var _0x1a28c8=[];var _0x2993fc=[];for(var _0x530599=0x0;_0x530599<_0x510e6a['length'];_0x530599+=0x1){var _0xc74f36=_0x510e6a[_0x530599][_0xf4fc('0x38')];if(_0xc74f36===null){_0x1a28c8[_0xf4fc('0x39')](_0x510e6a[_0x530599][_0xf4fc('0x28')](_0x21bda1[_0xf4fc('0x29')],{'transaction':_0x3762ab}));}else if(!_0x2993fc[_0xf4fc('0x3a')](_0xc74f36)){_0x2993fc[_0xf4fc('0x39')](_0xc74f36);_0x1a28c8[_0xf4fc('0x39')](_0x510e6a[_0x530599][_0xf4fc('0x28')](_0x21bda1[_0xf4fc('0x29')],{'transaction':_0x3762ab}));}}return BPromise[_0xf4fc('0x3b')](_0x1a28c8);});})['then'](function(_0x2239ac){logger[_0xf4fc('0x22')]('GetContactDialer',_0x21bda1);if(_0x2239ac['length']>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x2239ac[0x0][_0xf4fc('0x3c')]['id'],_0x2239ac[0x0][_0xf4fc('0x3c')][_0xf4fc('0x3d')],_0x2239ac[0x0]['dataValues'][_0xf4fc('0x3e')]);}logger['debug']('GetContactDialer',_0x21bda1,JSON[_0xf4fc('0x11')](_0x2239ac));_0x49b26f(_0x2239ac);})['catch'](function(_0x2a564f){logger[_0xf4fc('0x12')]('GetContactDialer',_0x2a564f[_0xf4fc('0x14')],_0x21bda1);_0x3d58f8(_0x15ca49[_0xf4fc('0x12')](0x1f4,_0x2a564f[_0xf4fc('0x14')]));});});});};exports[_0xf4fc('0x3f')]=function(_0x1fec9b){var _0x147010=this;return new Promise(function(_0x379c87,_0x5a635a){return db['sequelize'][_0xf4fc('0x30')](function(_0x33e09e){return db[_0xf4fc('0x40')][_0xf4fc('0x26')](_0x1fec9b['body'],{'raw':_0x1fec9b[_0xf4fc('0x1a')]?_0x1fec9b[_0xf4fc('0x1a')][_0xf4fc('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x33e09e})[_0xf4fc('0xd')](function(){logger[_0xf4fc('0x22')](_0xf4fc('0x41'),JSON[_0xf4fc('0x11')](_0x1fec9b[_0xf4fc('0x1a')][_0xf4fc('0x1c')]),_0x1fec9b['options'][_0xf4fc('0x1c')][_0xf4fc('0x3e')]);return db[_0xf4fc('0x18')][_0xf4fc('0x2b')]({'where':_0x1fec9b[_0xf4fc('0x1a')]?_0x1fec9b['options'][_0xf4fc('0x1c')]||null:null,'transaction':_0x33e09e});});})[_0xf4fc('0xd')](function(_0x48df04){logger['info']('MoveContactManagedDialer',_0x1fec9b);logger[_0xf4fc('0x23')](_0xf4fc('0x3f'),_0x1fec9b,JSON[_0xf4fc('0x11')](_0x48df04));_0x379c87(_0x48df04);})[_0xf4fc('0x16')](function(_0x46a489){logger[_0xf4fc('0x12')](_0xf4fc('0x3f'),_0x46a489['message'],_0x1fec9b);_0x5a635a(_0x147010[_0xf4fc('0x12')](0x1f4,_0x46a489[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x42')]=function(_0x4d37ae){var _0x75a203=this;return new Promise(function(_0x32de8a,_0x33b754){return db['CmHopper']['findAll']({'raw':_0x4d37ae[_0xf4fc('0x1a')]?_0x4d37ae[_0xf4fc('0x1a')][_0xf4fc('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d37ae[_0xf4fc('0x1a')]?_0x4d37ae[_0xf4fc('0x1a')][_0xf4fc('0x1c')]||null:null,'attributes':[[db[_0xf4fc('0x2f')]['fn'](_0xf4fc('0x43'),db['sequelize']['fn']('IF',db[_0xf4fc('0x2f')][_0xf4fc('0x44')](_0xf4fc('0x45')+util['format'](_0xf4fc('0x46'),moment()[_0xf4fc('0x47')](_0xf4fc('0x48')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xf4fc('0xd')](function(_0x4e8590){logger[_0xf4fc('0x22')](_0xf4fc('0x42'),_0x4d37ae);logger[_0xf4fc('0x23')](_0xf4fc('0x42'),_0x4d37ae,JSON[_0xf4fc('0x11')](_0x4e8590));_0x32de8a(_0x4e8590);})[_0xf4fc('0x16')](function(_0x1e40e6){logger[_0xf4fc('0x12')](_0xf4fc('0x42'),_0x1e40e6[_0xf4fc('0x14')],_0x4d37ae);_0x33b754(_0x75a203['error'](0x1f4,_0x1e40e6[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x49')]=function(_0x22c208){var _0x48a9a9=this;return new Promise(function(_0x2bf7bf,_0x16d093){return db[_0xf4fc('0x2e')][_0xf4fc('0x4a')]()[_0xf4fc('0xd')](function(_0x726d77){return db[_0xf4fc('0x2f')][_0xf4fc('0x30')](function(_0x31aabc){return db[_0xf4fc('0x18')][_0xf4fc('0x19')]({'where':_0x22c208['options']?_0x22c208[_0xf4fc('0x1a')]['where']||null:null,'attributes':_0x22c208['options']?_0x22c208[_0xf4fc('0x1a')]['attributes']||null:null,'limit':0x1,'order':_0x22c208[_0xf4fc('0x1a')]?_0x22c208[_0xf4fc('0x1a')][_0xf4fc('0x31')]||null:null,'group':db[_0xf4fc('0x18')][_0xf4fc('0x38')],'transaction':_0x31aabc,'lock':_0x31aabc[_0xf4fc('0x32')][_0xf4fc('0x33')],'include':_0x22c208[_0xf4fc('0x1a')]?_0x22c208['options'][_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x22c208['options'][_0xf4fc('0x1f')],function(_0x54c7ec){return{'model':db[_0x54c7ec[_0xf4fc('0x21')]],'as':_0x54c7ec['as'],'attributes':_0x54c7ec[_0xf4fc('0x1d')],'include':_0x54c7ec['include']?_[_0xf4fc('0x20')](_0x54c7ec[_0xf4fc('0x1f')],function(_0x4984d1){return{'model':db[_0x4984d1[_0xf4fc('0x21')]],'as':_0x4984d1['as'],'attributes':_0x4984d1[_0xf4fc('0x1d')],'include':_0x4984d1[_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x4984d1[_0xf4fc('0x1f')],function(_0x20baca){return{'model':db[_0x20baca['model']],'as':_0x20baca['as'],'attributes':_0x20baca[_0xf4fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf4fc('0xd')](function(_0x14ab00){var _0x15b3e5=[];for(var _0x4d2172=0x0;_0x4d2172<_0x14ab00[_0xf4fc('0x4b')];_0x4d2172+=0x1){_0x15b3e5[_0xf4fc('0x39')](_0x14ab00[_0x4d2172][_0xf4fc('0x28')](_0x22c208[_0xf4fc('0x29')],{'transaction':_0x31aabc}));}return BPromise['all'](_0x15b3e5);});})[_0xf4fc('0xd')](function(_0x154739){logger[_0xf4fc('0x22')](_0xf4fc('0x49'),_0x22c208);logger[_0xf4fc('0x23')](_0xf4fc('0x49'),_0x22c208,JSON[_0xf4fc('0x11')](_0x154739));_0x2bf7bf(_0x154739);})[_0xf4fc('0x16')](function(_0x198d4e){logger['error'](_0xf4fc('0x49'),_0x198d4e[_0xf4fc('0x14')],_0x22c208);_0x16d093(_0x48a9a9['error'](0x1f4,_0x198d4e[_0xf4fc('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1f69a5){var _0x216379=this;return new Promise(function(_0xa922aa,_0x3ff5b1){db[_0xf4fc('0x2e')]['describe']()[_0xf4fc('0xd')](function(_0x4b7a5b){return db['CmHopper'][_0xf4fc('0x19')]({'raw':_0x1f69a5[_0xf4fc('0x1a')]?_0x1f69a5[_0xf4fc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1f69a5[_0xf4fc('0x1a')]?_0x1f69a5[_0xf4fc('0x1a')][_0xf4fc('0x1c')]||null:null,'attributes':_0x1f69a5[_0xf4fc('0x1a')]?_0x1f69a5[_0xf4fc('0x1a')][_0xf4fc('0x1d')]||null:null,'limit':_0x1f69a5[_0xf4fc('0x1a')]?_0x1f69a5[_0xf4fc('0x1a')][_0xf4fc('0x1e')]||null:null,'include':_0x1f69a5[_0xf4fc('0x1a')]?_0x1f69a5['options'][_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x1f69a5[_0xf4fc('0x1a')][_0xf4fc('0x1f')],function(_0x2fe047){return{'model':db[_0x2fe047[_0xf4fc('0x21')]],'as':_0x2fe047['as'],'attributes':_0x2fe047['as']===_0xf4fc('0x34')?_[_0xf4fc('0x35')](_0x4b7a5b):_0x2fe047['attributes'],'include':_0x2fe047['include']?_['map'](_0x2fe047[_0xf4fc('0x1f')],function(_0x1e8f0f){return{'model':db[_0x1e8f0f[_0xf4fc('0x21')]],'as':_0x1e8f0f['as'],'attributes':_0x1e8f0f[_0xf4fc('0x1d')],'include':_0x1e8f0f[_0xf4fc('0x1f')]?_[_0xf4fc('0x20')](_0x1e8f0f['include'],function(_0x1af7fa){return{'model':db[_0x1af7fa[_0xf4fc('0x21')]],'as':_0x1af7fa['as'],'attributes':_0x1af7fa[_0xf4fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf4fc('0xd')](function(_0xf409bf){logger['info']('GetCmHopper',_0x1f69a5);logger['debug'](_0xf4fc('0x17'),_0x1f69a5,JSON[_0xf4fc('0x11')](_0xf409bf));_0xa922aa(_0xf409bf);})['catch'](function(_0x1622f5){logger['error'](_0xf4fc('0x17'),_0x1622f5[_0xf4fc('0x14')],_0x1f69a5);_0x3ff5b1(_0x216379['error'](0x1f4,_0x1622f5[_0xf4fc('0x14')]));});});});};exports[_0xf4fc('0x4c')]=function(_0x4ce4a5){var _0x1ca0c9=this;return new Promise(function(_0x1a8bba,_0x226cce){return db[_0xf4fc('0x2e')][_0xf4fc('0x4d')]({'raw':!![],'where':{'phone':_0x4ce4a5['options'][_0xf4fc('0x1c')]['phone']},'attributes':['id',_0xf4fc('0x4e')],'order':[['id',_0xf4fc('0x4f')]]})[_0xf4fc('0xd')](function(_0x296b59){logger[_0xf4fc('0x22')](_0xf4fc('0x50'),_0x4ce4a5);logger[_0xf4fc('0x23')]('getContactByPhone',_0x4ce4a5,JSON[_0xf4fc('0x11')](_0x296b59));_0x1a8bba(_0x296b59);})[_0xf4fc('0x16')](function(_0x4ddca4){logger[_0xf4fc('0x12')](_0xf4fc('0x50'),_0x4ddca4['message'],_0x4ce4a5);_0x226cce(_0x1ca0c9[_0xf4fc('0x12')](0x1f4,_0x4ddca4[_0xf4fc('0x14')]));});});};exports[_0xf4fc('0x51')]=function(_0x54c1cb){var _0xbc034b=this;return new Promise(function(_0x1f5b1e,_0x90d74){return db[_0xf4fc('0x2f')][_0xf4fc('0x30')](function(_0x2c83d6){return db[_0xf4fc('0x18')]['update']({'active':![]},{'where':{},'transaction':_0x2c83d6})['then'](function(_0x53a1ce){logger[_0xf4fc('0x22')](_0xf4fc('0x51'),_0x54c1cb);logger[_0xf4fc('0x23')](_0xf4fc('0x51'),_0x54c1cb,JSON[_0xf4fc('0x11')](_0x53a1ce));_0x1f5b1e(_0x53a1ce);})[_0xf4fc('0x16')](function(_0x2e29cb){logger[_0xf4fc('0x12')](_0xf4fc('0x51'),_0x2e29cb['message'],_0x54c1cb);_0x90d74(_0xbc034b[_0xf4fc('0x12')](0x1f4,_0x2e29cb[_0xf4fc('0x14')]));});});});};exports[_0xf4fc('0x52')]=function(_0x1144e9){var _0x212219=this;var _0x54d045=_0x1144e9[_0xf4fc('0x29')][_0xf4fc('0x1c')][_0xf4fc('0x53')];var _0x16f920=_0x1144e9[_0xf4fc('0x29')][_0xf4fc('0x1c')][_0xf4fc('0x54')];return new Promise(function(_0x4f1210,_0x13ba03){return db[_0xf4fc('0x18')]['findAll']({'where':{'voiceQueueId':_0x54d045,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xf4fc('0x2f')][_0xf4fc('0x44')](_0xf4fc('0x55')+_0x16f920+_0xf4fc('0x56'))}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0xf4fc('0x36'),'attributes':['id',_0xf4fc('0x37'),_0xf4fc('0x57')]},{'model':db[_0xf4fc('0x58')],'as':'List'}]})['then'](function(_0x20be88){return db['sequelize'][_0xf4fc('0x30')](function(_0x2bc242){return db[_0xf4fc('0x18')][_0xf4fc('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x54d045,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xf4fc('0x2f')][_0xf4fc('0x44')](_0xf4fc('0x55')+_0x16f920+_0xf4fc('0x56'))}},'transaction':_0x2bc242})[_0xf4fc('0xd')](function(_0x96610){_0x4f1210(_0x20be88);})[_0xf4fc('0x16')](function(_0xd0e23d){logger[_0xf4fc('0x12')](_0xf4fc('0x52'),_0xd0e23d[_0xf4fc('0x14')],_0x1144e9);_0x13ba03(validateExpressRequest);});});})['catch'](function(_0x1f6d5f){logger[_0xf4fc('0x12')](_0xf4fc('0x52'),_0x1f6d5f[_0xf4fc('0x14')],_0x1144e9);_0x13ba03(_0x212219[_0xf4fc('0x12')](0x1f4,_0x1f6d5f[_0xf4fc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 72a7025..598ef25 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 _0x92c6=['post','/preview','getTimezone','/previewrecall','getPreviewRecall','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/opencontacts','/timezones','getTimezones','/:id','show'];(function(_0x1ad3d0,_0xe73223){var _0x56cef0=function(_0x167bda){while(--_0x167bda){_0x1ad3d0['push'](_0x1ad3d0['shift']());}};_0x56cef0(++_0xe73223);}(_0x92c6,0x1e4));var _0x692c=function(_0x36a328,_0x3736dc){_0x36a328=_0x36a328-0x0;var _0x1fa0ca=_0x92c6[_0x36a328];return _0x1fa0ca;};'use strict';var multer=require(_0x692c('0x0'));var util=require(_0x692c('0x1'));var path=require('path');var timeout=require(_0x692c('0x2'));var express=require('express');var router=express[_0x692c('0x3')]();var fs_extra=require(_0x692c('0x4'));var auth=require(_0x692c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x692c('0x6'));var controller=require('./cmHopper.controller');router[_0x692c('0x7')]('/',auth[_0x692c('0x8')](),controller[_0x692c('0x9')]);router[_0x692c('0x7')]('/describe',auth[_0x692c('0x8')](),controller[_0x692c('0xa')]);router[_0x692c('0x7')](_0x692c('0xb'),auth[_0x692c('0x8')](),controller['getOpenContacts']);router[_0x692c('0x7')](_0x692c('0xc'),auth['isAuthenticated'](),controller[_0x692c('0xd')]);router[_0x692c('0x7')](_0x692c('0xe'),auth['isAuthenticated'](),controller[_0x692c('0xf')]);router[_0x692c('0x10')]('/',auth[_0x692c('0x8')](),controller['create']);router['post'](_0x692c('0x11'),auth['isAuthenticated'](),controller['getPreview']);router[_0x692c('0x10')]('/timezone',auth[_0x692c('0x8')](),controller[_0x692c('0x12')]);router['post'](_0x692c('0x13'),auth[_0x692c('0x8')](),controller[_0x692c('0x14')]);router[_0x692c('0x15')](_0x692c('0xe'),auth[_0x692c('0x8')](),controller['update']);router[_0x692c('0x16')](_0x692c('0xe'),auth[_0x692c('0x8')](),controller[_0x692c('0x17')]);module[_0x692c('0x18')]=router; \ No newline at end of file +var _0x2eac=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','create','/timezone','getTimezone','/previewrecall','getPreviewRecall','put','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4cb7c2,_0x5981a9){var _0x1ef88b=function(_0x2e4d04){while(--_0x2e4d04){_0x4cb7c2['push'](_0x4cb7c2['shift']());}};_0x1ef88b(++_0x5981a9);}(_0x2eac,0x1aa));var _0xc2ea=function(_0xf5a234,_0x1aaea5){_0xf5a234=_0xf5a234-0x0;var _0x5cb3a8=_0x2eac[_0xf5a234];return _0x5cb3a8;};'use strict';var multer=require(_0xc2ea('0x0'));var util=require(_0xc2ea('0x1'));var path=require(_0xc2ea('0x2'));var timeout=require(_0xc2ea('0x3'));var express=require(_0xc2ea('0x4'));var router=express[_0xc2ea('0x5')]();var fs_extra=require(_0xc2ea('0x6'));var auth=require(_0xc2ea('0x7'));var interaction=require(_0xc2ea('0x8'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router['get']('/',auth[_0xc2ea('0x9')](),controller[_0xc2ea('0xa')]);router[_0xc2ea('0xb')](_0xc2ea('0xc'),auth['isAuthenticated'](),controller[_0xc2ea('0xd')]);router['get'](_0xc2ea('0xe'),auth['isAuthenticated'](),controller[_0xc2ea('0xf')]);router[_0xc2ea('0xb')]('/timezones',auth['isAuthenticated'](),controller[_0xc2ea('0x10')]);router[_0xc2ea('0xb')](_0xc2ea('0x11'),auth['isAuthenticated'](),controller[_0xc2ea('0x12')]);router[_0xc2ea('0x13')]('/',auth[_0xc2ea('0x9')](),controller[_0xc2ea('0x14')]);router[_0xc2ea('0x13')]('/preview',auth[_0xc2ea('0x9')](),controller['getPreview']);router['post'](_0xc2ea('0x15'),auth[_0xc2ea('0x9')](),controller[_0xc2ea('0x16')]);router[_0xc2ea('0x13')](_0xc2ea('0x17'),auth['isAuthenticated'](),controller[_0xc2ea('0x18')]);router[_0xc2ea('0x19')]('/:id',auth[_0xc2ea('0x9')](),controller['update']);router['delete'](_0xc2ea('0x11'),auth[_0xc2ea('0x9')](),controller[_0xc2ea('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a492218..1849a8a 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 _0x0183=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x14406e,_0x5e8863){var _0xe0d78d=function(_0x55b54b){while(--_0x55b54b){_0x14406e['push'](_0x14406e['shift']());}};_0xe0d78d(++_0x5e8863);}(_0x0183,0x1e1));var _0x3018=function(_0x432286,_0xc7f906){_0x432286=_0x432286-0x0;var _0x475b6e=_0x0183[_0x432286];return _0x475b6e;};'use strict';var moment=require(_0x3018('0x0'));var Sequelize=require(_0x3018('0x1'));module[_0x3018('0x2')]={'phone':{'type':Sequelize[_0x3018('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3018('0x4')],'unique':_0x3018('0x5')},'ListId':{'type':Sequelize[_0x3018('0x4')],'unique':_0x3018('0x5')},'VoiceQueueId':{'type':Sequelize[_0x3018('0x4')],'unique':_0x3018('0x5')}}; \ No newline at end of file +var _0x848e=['contactListQueue','INTEGER','moment','exports','STRING'];(function(_0xa984ab,_0x111e67){var _0x219eb3=function(_0x1c05ba){while(--_0x1c05ba){_0xa984ab['push'](_0xa984ab['shift']());}};_0x219eb3(++_0x111e67);}(_0x848e,0x1e2));var _0xe848=function(_0x589274,_0xa3f1bd){_0x589274=_0x589274-0x0;var _0x21814b=_0x848e[_0x589274];return _0x21814b;};'use strict';var moment=require(_0xe848('0x0'));var Sequelize=require('sequelize');module[_0xe848('0x1')]={'phone':{'type':Sequelize[_0xe848('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe848('0x3')},'ListId':{'type':Sequelize[_0xe848('0x4')],'unique':_0xe848('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe848('0x4')],'unique':_0xe848('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ecafcb6..24c19e4 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 _0x4fce=['attributes','length','hasOwnProperty','offset','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','show','params','intersection','fields','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','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','json','limit','undefined','count','status','set','Content-Range','apply','save','update','then','sendStatus','error','name','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x211091,_0xe222dd){var _0x1d8f7b=function(_0x365d75){while(--_0x365d75){_0x211091['push'](_0x211091['shift']());}};_0x1d8f7b(++_0xe222dd);}(_0x4fce,0xfa));var _0xe4fc=function(_0x3ecd7a,_0x3ca4a8){_0x3ecd7a=_0x3ecd7a-0x0;var _0x46afe2=_0x4fce[_0x3ecd7a];return _0x46afe2;};'use strict';var emlformat=require(_0xe4fc('0x0'));var rimraf=require(_0xe4fc('0x1'));var zipdir=require(_0xe4fc('0x2'));var jsonpatch=require(_0xe4fc('0x3'));var rp=require(_0xe4fc('0x4'));var moment=require(_0xe4fc('0x5'));var BPromise=require(_0xe4fc('0x6'));var Mustache=require(_0xe4fc('0x7'));var util=require(_0xe4fc('0x8'));var path=require(_0xe4fc('0x9'));var sox=require('sox');var csv=require(_0xe4fc('0xa'));var ejs=require(_0xe4fc('0xb'));var fs=require('fs');var fs_extra=require(_0xe4fc('0xc'));var _=require(_0xe4fc('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4fc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4fc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4fc('0xf'));var authService=require(_0xe4fc('0x10'));var qs=require(_0xe4fc('0x11'));var as=require(_0xe4fc('0x12'));var hardwareService=require(_0xe4fc('0x13'));var logger=require(_0xe4fc('0x14'))(_0xe4fc('0x15'));var utils=require(_0xe4fc('0x16'));var config=require(_0xe4fc('0x17'));var licenseUtil=require(_0xe4fc('0x18'));var db=require(_0xe4fc('0x19'))['db'];function respondWithStatusCode(_0x2e4d95,_0x5e5ad5){_0x5e5ad5=_0x5e5ad5||0xcc;return function(_0x45c8ef){if(_0x45c8ef){return _0x2e4d95['sendStatus'](_0x5e5ad5);}return _0x2e4d95['status'](_0x5e5ad5)[_0xe4fc('0x1a')]();};}function respondWithResult(_0x12e7a1,_0x393f23){_0x393f23=_0x393f23||0xc8;return function(_0x5484a5){if(_0x5484a5){return _0x12e7a1['status'](_0x393f23)[_0xe4fc('0x1b')](_0x5484a5);}};}function respondWithFilteredResult(_0xc924e1,_0x45d677){return function(_0x1a49b8){if(_0x1a49b8){var _0x2c0881=typeof _0x45d677['offset']==='undefined'&&typeof _0x45d677[_0xe4fc('0x1c')]===_0xe4fc('0x1d');var _0x109b52=_0x1a49b8[_0xe4fc('0x1e')];var _0x409b2e=_0x2c0881?0x0:_0x45d677['offset'];var _0x1b96d=_0x2c0881?_0x1a49b8[_0xe4fc('0x1e')]:_0x45d677['offset']+_0x45d677['limit'];var _0x454cfc;if(_0x1b96d>=_0x109b52){_0x1b96d=_0x109b52;_0x454cfc=0xc8;}else{_0x454cfc=0xce;}_0xc924e1[_0xe4fc('0x1f')](_0x454cfc);return _0xc924e1[_0xe4fc('0x20')](_0xe4fc('0x21'),_0x409b2e+'-'+_0x1b96d+'/'+_0x109b52)['json'](_0x1a49b8);}return null;};}function patchUpdates(_0x168c28){return function(_0x5b0a2c){try{jsonpatch[_0xe4fc('0x22')](_0x5b0a2c,_0x168c28,!![]);}catch(_0x10cf90){return BPromise['reject'](_0x10cf90);}return _0x5b0a2c[_0xe4fc('0x23')]();};}function saveUpdates(_0x197603,_0x1ca5a0){return function(_0x3b020f){if(_0x3b020f){return _0x3b020f[_0xe4fc('0x24')](_0x197603)[_0xe4fc('0x25')](function(_0x198ea6){return _0x198ea6;});}return null;};}function removeEntity(_0x4dfd33,_0x415e21){return function(_0x447c7c){if(_0x447c7c){return _0x447c7c['destroy']()[_0xe4fc('0x25')](function(){_0x4dfd33['status'](0xcc)[_0xe4fc('0x1a')]();});}};}function handleEntityNotFound(_0x48eab1,_0x131d1f){return function(_0x9ff1ef){if(!_0x9ff1ef){_0x48eab1[_0xe4fc('0x26')](0x194);}return _0x9ff1ef;};}function handleError(_0x4f4e1c,_0x2ac334){_0x2ac334=_0x2ac334||0x1f4;return function(_0x2c0ea4){logger[_0xe4fc('0x27')](_0x2c0ea4['stack']);if(_0x2c0ea4['name']){delete _0x2c0ea4[_0xe4fc('0x28')];}_0x4f4e1c[_0xe4fc('0x1f')](_0x2ac334)['send'](_0x2c0ea4);};}exports['index']=function(_0x480798,_0x5b6aa4){var _0xba3d08={},_0x2b1474={},_0x42f786={'count':0x0,'rows':[]};var _0x309e47=_['map'](db[_0xe4fc('0x29')][_0xe4fc('0x2a')],function(_0x43d46f){return{'name':_0x43d46f[_0xe4fc('0x2b')],'type':_0x43d46f[_0xe4fc('0x2c')][_0xe4fc('0x2d')]};});_0x2b1474[_0xe4fc('0x2e')]=_['map'](_0x309e47,_0xe4fc('0x28'));_0x2b1474[_0xe4fc('0x2f')]=_[_0xe4fc('0x30')](_0x480798[_0xe4fc('0x2f')]);_0x2b1474[_0xe4fc('0x31')]=_['intersection'](_0x2b1474['model'],_0x2b1474[_0xe4fc('0x2f')]);_0xba3d08['attributes']=_['intersection'](_0x2b1474[_0xe4fc('0x2e')],qs['fields'](_0x480798[_0xe4fc('0x2f')]['fields']));_0xba3d08['attributes']=_0xba3d08[_0xe4fc('0x32')][_0xe4fc('0x33')]?_0xba3d08['attributes']:_0x2b1474[_0xe4fc('0x2e')];if(!_0x480798[_0xe4fc('0x2f')][_0xe4fc('0x34')]('nolimit')){_0xba3d08[_0xe4fc('0x1c')]=qs[_0xe4fc('0x1c')](_0x480798['query'][_0xe4fc('0x1c')]);_0xba3d08[_0xe4fc('0x35')]=qs[_0xe4fc('0x35')](_0x480798[_0xe4fc('0x2f')]['offset']);}_0xba3d08[_0xe4fc('0x36')]=qs[_0xe4fc('0x37')](_0x480798[_0xe4fc('0x2f')]['sort']);_0xba3d08[_0xe4fc('0x38')]=qs['filters'](_[_0xe4fc('0x39')](_0x480798['query'],_0x2b1474[_0xe4fc('0x31')]),_0x309e47);if(_0x480798[_0xe4fc('0x2f')]['filter']){_0xba3d08['where']=_[_0xe4fc('0x3a')](_0xba3d08[_0xe4fc('0x38')],{'$or':_[_0xe4fc('0x3b')](_0x309e47,function(_0x228143){if(_0x228143[_0xe4fc('0x2c')]!=='VIRTUAL'){var _0x28a4a9={};_0x28a4a9[_0x228143[_0xe4fc('0x28')]]={'$like':'%'+_0x480798['query'][_0xe4fc('0x3c')]+'%'};return _0x28a4a9;}})});}_0xba3d08=_['merge']({},_0xba3d08,_0x480798[_0xe4fc('0x3d')]);var _0x19ab0c={'where':_0xba3d08[_0xe4fc('0x38')]};return db[_0xe4fc('0x29')]['count'](_0x19ab0c)[_0xe4fc('0x25')](function(_0x2a8dda){_0x42f786['count']=_0x2a8dda;if(_0x480798['query'][_0xe4fc('0x3e')]){_0xba3d08[_0xe4fc('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe4fc('0x40')](_0xba3d08);})[_0xe4fc('0x25')](function(_0x2cbece){_0x42f786[_0xe4fc('0x41')]=_0x2cbece;return _0x42f786;})[_0xe4fc('0x25')](respondWithFilteredResult(_0x5b6aa4,_0xba3d08))['catch'](handleError(_0x5b6aa4,null));};exports[_0xe4fc('0x42')]=function(_0x50aaa5,_0x570979){var _0x3c18c3={'raw':!![],'where':{'id':_0x50aaa5[_0xe4fc('0x43')]['id']}},_0x39f548={};_0x39f548[_0xe4fc('0x2e')]=_[_0xe4fc('0x30')](db[_0xe4fc('0x29')][_0xe4fc('0x2a')]);_0x39f548[_0xe4fc('0x2f')]=_[_0xe4fc('0x30')](_0x50aaa5[_0xe4fc('0x2f')]);_0x39f548[_0xe4fc('0x31')]=_[_0xe4fc('0x44')](_0x39f548['model'],_0x39f548[_0xe4fc('0x2f')]);_0x3c18c3[_0xe4fc('0x32')]=_[_0xe4fc('0x44')](_0x39f548[_0xe4fc('0x2e')],qs['fields'](_0x50aaa5[_0xe4fc('0x2f')][_0xe4fc('0x45')]));_0x3c18c3[_0xe4fc('0x32')]=_0x3c18c3['attributes'][_0xe4fc('0x33')]?_0x3c18c3[_0xe4fc('0x32')]:_0x39f548[_0xe4fc('0x2e')];if(_0x50aaa5[_0xe4fc('0x2f')][_0xe4fc('0x3e')]){_0x3c18c3[_0xe4fc('0x3f')]=[{'all':!![]}];}_0x3c18c3=_[_0xe4fc('0x3a')]({},_0x3c18c3,_0x50aaa5['options']);return db[_0xe4fc('0x29')][_0xe4fc('0x46')](_0x3c18c3)[_0xe4fc('0x25')](handleEntityNotFound(_0x570979,null))[_0xe4fc('0x25')](respondWithResult(_0x570979,null))[_0xe4fc('0x47')](handleError(_0x570979,null));};exports[_0xe4fc('0x24')]=function(_0x9ff1bc,_0x3a2f0d){if(_0x9ff1bc[_0xe4fc('0x48')]['id']){delete _0x9ff1bc[_0xe4fc('0x48')]['id'];}return db[_0xe4fc('0x29')][_0xe4fc('0x46')]({'where':{'id':_0x9ff1bc[_0xe4fc('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a2f0d,null))['then'](saveUpdates(_0x9ff1bc[_0xe4fc('0x48')],null))[_0xe4fc('0x25')](respondWithResult(_0x3a2f0d,null))[_0xe4fc('0x47')](handleError(_0x3a2f0d,null));};exports[_0xe4fc('0x49')]=function(_0x183f46,_0x4eb444){return db[_0xe4fc('0x29')]['find']({'where':{'id':_0x183f46['params']['id']}})[_0xe4fc('0x25')](handleEntityNotFound(_0x4eb444,null))[_0xe4fc('0x25')](removeEntity(_0x4eb444,null))[_0xe4fc('0x47')](handleError(_0x4eb444,null));};exports[_0xe4fc('0x4a')]=function(_0x5bb05f,_0x57fc92){return db[_0xe4fc('0x29')][_0xe4fc('0x4a')]()[_0xe4fc('0x25')](respondWithResult(_0x57fc92,null))['catch'](handleError(_0x57fc92,null));}; \ No newline at end of file +var _0x50a5=['sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','destroy','describe','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b1194,_0x8d4ac9){var _0x3423a8=function(_0x213c08){while(--_0x213c08){_0x4b1194['push'](_0x4b1194['shift']());}};_0x3423a8(++_0x8d4ac9);}(_0x50a5,0xd1));var _0x550a=function(_0x52a42d,_0x2c6b20){_0x52a42d=_0x52a42d-0x0;var _0x83eb3a=_0x50a5[_0x52a42d];return _0x83eb3a;};'use strict';var emlformat=require(_0x550a('0x0'));var rimraf=require(_0x550a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x550a('0x2'));var Mustache=require('mustache');var util=require(_0x550a('0x3'));var path=require(_0x550a('0x4'));var sox=require(_0x550a('0x5'));var csv=require(_0x550a('0x6'));var ejs=require(_0x550a('0x7'));var fs=require('fs');var fs_extra=require(_0x550a('0x8'));var _=require(_0x550a('0x9'));var squel=require(_0x550a('0xa'));var crypto=require(_0x550a('0xb'));var jsforce=require(_0x550a('0xc'));var deskjs=require(_0x550a('0xd'));var toCsv=require(_0x550a('0x6'));var querystring=require(_0x550a('0xe'));var Papa=require('papaparse');var Redis=require(_0x550a('0xf'));var authService=require(_0x550a('0x10'));var qs=require(_0x550a('0x11'));var as=require(_0x550a('0x12'));var hardwareService=require(_0x550a('0x13'));var logger=require(_0x550a('0x14'))('api');var utils=require(_0x550a('0x15'));var config=require(_0x550a('0x16'));var licenseUtil=require(_0x550a('0x17'));var db=require(_0x550a('0x18'))['db'];function respondWithStatusCode(_0x2fb177,_0x38b9fe){_0x38b9fe=_0x38b9fe||0xcc;return function(_0x1fea00){if(_0x1fea00){return _0x2fb177[_0x550a('0x19')](_0x38b9fe);}return _0x2fb177['status'](_0x38b9fe)[_0x550a('0x1a')]();};}function respondWithResult(_0x4d22ea,_0x535eab){_0x535eab=_0x535eab||0xc8;return function(_0x1c602a){if(_0x1c602a){return _0x4d22ea[_0x550a('0x1b')](_0x535eab)['json'](_0x1c602a);}};}function respondWithFilteredResult(_0x23d2db,_0x4d1cb8){return function(_0x388aaa){if(_0x388aaa){var _0x4fa030=typeof _0x4d1cb8[_0x550a('0x1c')]===_0x550a('0x1d')&&typeof _0x4d1cb8[_0x550a('0x1e')]===_0x550a('0x1d');var _0x179ae5=_0x388aaa[_0x550a('0x1f')];var _0x5d4f5d=_0x4fa030?0x0:_0x4d1cb8[_0x550a('0x1c')];var _0x5d8f86=_0x4fa030?_0x388aaa[_0x550a('0x1f')]:_0x4d1cb8[_0x550a('0x1c')]+_0x4d1cb8[_0x550a('0x1e')];var _0x31c19b;if(_0x5d8f86>=_0x179ae5){_0x5d8f86=_0x179ae5;_0x31c19b=0xc8;}else{_0x31c19b=0xce;}_0x23d2db[_0x550a('0x1b')](_0x31c19b);return _0x23d2db['set'](_0x550a('0x20'),_0x5d4f5d+'-'+_0x5d8f86+'/'+_0x179ae5)[_0x550a('0x21')](_0x388aaa);}return null;};}function patchUpdates(_0x252242){return function(_0x1556c3){try{jsonpatch[_0x550a('0x22')](_0x1556c3,_0x252242,!![]);}catch(_0x4bb936){return BPromise[_0x550a('0x23')](_0x4bb936);}return _0x1556c3[_0x550a('0x24')]();};}function saveUpdates(_0x3d1c2d,_0x1fcf3b){return function(_0x4c550d){if(_0x4c550d){return _0x4c550d[_0x550a('0x25')](_0x3d1c2d)[_0x550a('0x26')](function(_0xc48d09){return _0xc48d09;});}return null;};}function removeEntity(_0x512517,_0x2d03e5){return function(_0x18aa4b){if(_0x18aa4b){return _0x18aa4b['destroy']()[_0x550a('0x26')](function(){_0x512517['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132679,_0x55ae44){return function(_0x231470){if(!_0x231470){_0x132679['sendStatus'](0x194);}return _0x231470;};}function handleError(_0x4893ec,_0x2d4565){_0x2d4565=_0x2d4565||0x1f4;return function(_0x19b2cf){logger[_0x550a('0x27')](_0x19b2cf[_0x550a('0x28')]);if(_0x19b2cf[_0x550a('0x29')]){delete _0x19b2cf[_0x550a('0x29')];}_0x4893ec[_0x550a('0x1b')](_0x2d4565)[_0x550a('0x2a')](_0x19b2cf);};}exports['index']=function(_0x51b453,_0x26d08d){var _0x1d0a05={},_0x2326ef={},_0x56273d={'count':0x0,'rows':[]};var _0xc1cf31=_['map'](db[_0x550a('0x2b')][_0x550a('0x2c')],function(_0x369905){return{'name':_0x369905[_0x550a('0x2d')],'type':_0x369905[_0x550a('0x2e')][_0x550a('0x2f')]};});_0x2326ef[_0x550a('0x30')]=_[_0x550a('0x31')](_0xc1cf31,_0x550a('0x29'));_0x2326ef[_0x550a('0x32')]=_[_0x550a('0x33')](_0x51b453['query']);_0x2326ef[_0x550a('0x34')]=_[_0x550a('0x35')](_0x2326ef['model'],_0x2326ef[_0x550a('0x32')]);_0x1d0a05[_0x550a('0x36')]=_['intersection'](_0x2326ef[_0x550a('0x30')],qs['fields'](_0x51b453[_0x550a('0x32')][_0x550a('0x37')]));_0x1d0a05[_0x550a('0x36')]=_0x1d0a05['attributes'][_0x550a('0x38')]?_0x1d0a05['attributes']:_0x2326ef[_0x550a('0x30')];if(!_0x51b453[_0x550a('0x32')][_0x550a('0x39')](_0x550a('0x3a'))){_0x1d0a05[_0x550a('0x1e')]=qs[_0x550a('0x1e')](_0x51b453[_0x550a('0x32')][_0x550a('0x1e')]);_0x1d0a05[_0x550a('0x1c')]=qs[_0x550a('0x1c')](_0x51b453[_0x550a('0x32')][_0x550a('0x1c')]);}_0x1d0a05[_0x550a('0x3b')]=qs[_0x550a('0x3c')](_0x51b453['query'][_0x550a('0x3c')]);_0x1d0a05['where']=qs[_0x550a('0x34')](_[_0x550a('0x3d')](_0x51b453[_0x550a('0x32')],_0x2326ef['filters']),_0xc1cf31);if(_0x51b453['query']['filter']){_0x1d0a05[_0x550a('0x3e')]=_['merge'](_0x1d0a05[_0x550a('0x3e')],{'$or':_[_0x550a('0x31')](_0xc1cf31,function(_0x447508){if(_0x447508['type']!==_0x550a('0x3f')){var _0x2fc459={};_0x2fc459[_0x447508[_0x550a('0x29')]]={'$like':'%'+_0x51b453[_0x550a('0x32')][_0x550a('0x40')]+'%'};return _0x2fc459;}})});}_0x1d0a05=_[_0x550a('0x41')]({},_0x1d0a05,_0x51b453[_0x550a('0x42')]);var _0x4fa71f={'where':_0x1d0a05[_0x550a('0x3e')]};return db['CmHopperBlack']['count'](_0x4fa71f)[_0x550a('0x26')](function(_0x57a521){_0x56273d[_0x550a('0x1f')]=_0x57a521;if(_0x51b453['query']['includeAll']){_0x1d0a05[_0x550a('0x43')]=[{'all':!![]}];}return db[_0x550a('0x2b')][_0x550a('0x44')](_0x1d0a05);})[_0x550a('0x26')](function(_0x44ee5f){_0x56273d[_0x550a('0x45')]=_0x44ee5f;return _0x56273d;})[_0x550a('0x26')](respondWithFilteredResult(_0x26d08d,_0x1d0a05))[_0x550a('0x46')](handleError(_0x26d08d,null));};exports[_0x550a('0x47')]=function(_0x11b3e7,_0x54f8b8){var _0x4aacb4={'raw':!![],'where':{'id':_0x11b3e7[_0x550a('0x48')]['id']}},_0x37dc74={};_0x37dc74['model']=_[_0x550a('0x33')](db[_0x550a('0x2b')][_0x550a('0x2c')]);_0x37dc74[_0x550a('0x32')]=_[_0x550a('0x33')](_0x11b3e7[_0x550a('0x32')]);_0x37dc74[_0x550a('0x34')]=_[_0x550a('0x35')](_0x37dc74['model'],_0x37dc74['query']);_0x4aacb4[_0x550a('0x36')]=_['intersection'](_0x37dc74[_0x550a('0x30')],qs[_0x550a('0x37')](_0x11b3e7['query'][_0x550a('0x37')]));_0x4aacb4['attributes']=_0x4aacb4[_0x550a('0x36')][_0x550a('0x38')]?_0x4aacb4['attributes']:_0x37dc74[_0x550a('0x30')];if(_0x11b3e7[_0x550a('0x32')][_0x550a('0x49')]){_0x4aacb4['include']=[{'all':!![]}];}_0x4aacb4=_[_0x550a('0x41')]({},_0x4aacb4,_0x11b3e7[_0x550a('0x42')]);return db[_0x550a('0x2b')][_0x550a('0x4a')](_0x4aacb4)['then'](handleEntityNotFound(_0x54f8b8,null))[_0x550a('0x26')](respondWithResult(_0x54f8b8,null))[_0x550a('0x46')](handleError(_0x54f8b8,null));};exports[_0x550a('0x25')]=function(_0x567373,_0x3f852b){if(_0x567373['body']['id']){delete _0x567373['body']['id'];}return db['CmHopperBlack'][_0x550a('0x4a')]({'where':{'id':_0x567373[_0x550a('0x48')]['id']}})[_0x550a('0x26')](handleEntityNotFound(_0x3f852b,null))[_0x550a('0x26')](saveUpdates(_0x567373[_0x550a('0x4b')],null))[_0x550a('0x26')](respondWithResult(_0x3f852b,null))['catch'](handleError(_0x3f852b,null));};exports[_0x550a('0x4c')]=function(_0x70a0f2,_0x4be114){return db[_0x550a('0x2b')]['find']({'where':{'id':_0x70a0f2[_0x550a('0x48')]['id']}})[_0x550a('0x26')](handleEntityNotFound(_0x4be114,null))[_0x550a('0x26')](removeEntity(_0x4be114,null))[_0x550a('0x46')](handleError(_0x4be114,null));};exports[_0x550a('0x4d')]=function(_0x1f7211,_0x4035d1){return db['CmHopperBlack'][_0x550a('0x4d')]()['then'](respondWithResult(_0x4035d1,null))[_0x550a('0x46')](handleError(_0x4035d1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f9895b0..7e1e203 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 _0x8374=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x4f7ab4,_0x19372c){var _0x4225e0=function(_0x5b1ea5){while(--_0x5b1ea5){_0x4f7ab4['push'](_0x4f7ab4['shift']());}};_0x4225e0(++_0x19372c);}(_0x8374,0xe3));var _0x4837=function(_0x1a45af,_0x248386){_0x1a45af=_0x1a45af-0x0;var _0x32778d=_0x8374[_0x1a45af];return _0x32778d;};'use strict';var _=require(_0x4837('0x0'));var util=require('util');var logger=require(_0x4837('0x1'))(_0x4837('0x2'));var moment=require(_0x4837('0x3'));var BPromise=require(_0x4837('0x4'));var rp=require(_0x4837('0x5'));var fs=require('fs');var path=require(_0x4837('0x6'));var rimraf=require(_0x4837('0x7'));var config=require(_0x4837('0x8'));var attributes=require(_0x4837('0x9'));module['exports']=function(_0x547771,_0x44d388){return _0x547771['define'](_0x4837('0xa'),attributes,{'tableName':_0x4837('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf31=['request-promise','path','rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x47f6d1,_0x3192d1){var _0x2cc17f=function(_0x4d6371){while(--_0x4d6371){_0x47f6d1['push'](_0x47f6d1['shift']());}};_0x2cc17f(++_0x3192d1);}(_0xbf31,0x19a));var _0x1bf3=function(_0x1b203b,_0x135efa){_0x1b203b=_0x1b203b-0x0;var _0x450fa3=_0xbf31[_0x1b203b];return _0x450fa3;};'use strict';var _=require(_0x1bf3('0x0'));var util=require(_0x1bf3('0x1'));var logger=require(_0x1bf3('0x2'))(_0x1bf3('0x3'));var moment=require(_0x1bf3('0x4'));var BPromise=require(_0x1bf3('0x5'));var rp=require(_0x1bf3('0x6'));var fs=require('fs');var path=require(_0x1bf3('0x7'));var rimraf=require(_0x1bf3('0x8'));var config=require(_0x1bf3('0x9'));var attributes=require('./cmHopperBlack.attributes');module[_0x1bf3('0xa')]=function(_0x29d325,_0x1127c2){return _0x29d325['define'](_0x1bf3('0xb'),attributes,{'tableName':_0x1bf3('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 8cdd635..646392f 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 _0x8db4=['raw','where','attributes','limit','map','include','model','GetCmHopperBlack','debug','stringify','UpdateCmHopperBlack','DestroyCmHopperBlack','CmHopperBlack','destroy','lodash','util','../../config/environment','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','options'];(function(_0x8a0824,_0x21712e){var _0x9eedf5=function(_0x2e3e01){while(--_0x2e3e01){_0x8a0824['push'](_0x8a0824['shift']());}};_0x9eedf5(++_0x21712e);}(_0x8db4,0x125));var _0x48db=function(_0x586d14,_0x206fce){_0x586d14=_0x586d14-0x0;var _0x258d5a=_0x8db4[_0x586d14];return _0x258d5a;};'use strict';var _=require(_0x48db('0x0'));var util=require(_0x48db('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('../../config/logger')('rpc');var config=require(_0x48db('0x2'));var jayson=require(_0x48db('0x3'));var client=jayson['client'][_0x48db('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x28c611,_0x29de18,_0x1b3c15){return new BPromise(function(_0x2e35a0,_0x166edd){return client[_0x48db('0x5')](_0x28c611,_0x1b3c15)[_0x48db('0x6')](function(_0x2dd70e){logger['info'](_0x48db('0x7'),_0x29de18,'request\x20sent');logger['debug'](_0x48db('0x8'),_0x29de18,_0x48db('0x9'),JSON['stringify'](_0x2dd70e));if(_0x2dd70e['error']){if(_0x2dd70e[_0x48db('0xa')][_0x48db('0xb')]===0x1f4){logger[_0x48db('0xa')](_0x48db('0x7'),_0x29de18,_0x2dd70e[_0x48db('0xa')][_0x48db('0xc')]);return _0x166edd(_0x2dd70e[_0x48db('0xa')][_0x48db('0xc')]);}logger[_0x48db('0xa')](_0x48db('0x7'),_0x29de18,_0x2dd70e[_0x48db('0xa')][_0x48db('0xc')]);return _0x2e35a0(_0x2dd70e[_0x48db('0xa')]['message']);}else{logger[_0x48db('0xd')](_0x48db('0x7'),_0x29de18,_0x48db('0x9'));_0x2e35a0(_0x2dd70e[_0x48db('0xe')][_0x48db('0xc')]);}})[_0x48db('0xf')](function(_0x4c773e){logger[_0x48db('0xa')](_0x48db('0x7'),_0x29de18,_0x4c773e);_0x166edd(_0x4c773e);});});}exports['GetCmHopperBlack']=function(_0x205069){var _0x5929ad=this;return new Promise(function(_0x5e2286,_0x3f93f5){return db['CmHopperBlack']['findAll']({'raw':_0x205069[_0x48db('0x10')]?_0x205069[_0x48db('0x10')][_0x48db('0x11')]===undefined?!![]:![]:!![],'where':_0x205069['options']?_0x205069[_0x48db('0x10')][_0x48db('0x12')]||null:null,'attributes':_0x205069[_0x48db('0x10')]?_0x205069[_0x48db('0x10')][_0x48db('0x13')]||null:null,'limit':_0x205069['options']?_0x205069[_0x48db('0x10')][_0x48db('0x14')]||null:null,'include':_0x205069[_0x48db('0x10')]?_0x205069[_0x48db('0x10')]['include']?_[_0x48db('0x15')](_0x205069[_0x48db('0x10')][_0x48db('0x16')],function(_0x321122){return{'model':db[_0x321122[_0x48db('0x17')]],'as':_0x321122['as'],'attributes':_0x321122[_0x48db('0x13')],'include':_0x321122[_0x48db('0x16')]?_[_0x48db('0x15')](_0x321122[_0x48db('0x16')],function(_0x1b96ef){return{'model':db[_0x1b96ef[_0x48db('0x17')]],'as':_0x1b96ef['as'],'attributes':_0x1b96ef[_0x48db('0x13')],'include':_0x1b96ef[_0x48db('0x16')]?_[_0x48db('0x15')](_0x1b96ef[_0x48db('0x16')],function(_0x38968d){return{'model':db[_0x38968d[_0x48db('0x17')]],'as':_0x38968d['as'],'attributes':_0x38968d[_0x48db('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x511d8a){logger['info'](_0x48db('0x18'),_0x205069);logger[_0x48db('0x19')](_0x48db('0x18'),_0x205069,JSON[_0x48db('0x1a')](_0x511d8a));_0x5e2286(_0x511d8a);})[_0x48db('0xf')](function(_0x3ae7da){logger[_0x48db('0xa')]('GetCmHopperBlack',_0x3ae7da['message'],_0x205069);_0x3f93f5(_0x5929ad['error'](0x1f4,_0x3ae7da[_0x48db('0xc')]));});});};exports[_0x48db('0x1b')]=function(_0x3a0960){var _0x43380f=this;return new Promise(function(_0x350964,_0x30e502){return db['CmHopperBlack']['update'](_0x3a0960['body'],{'raw':_0x3a0960[_0x48db('0x10')]?_0x3a0960[_0x48db('0x10')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0960[_0x48db('0x10')]?_0x3a0960[_0x48db('0x10')][_0x48db('0x12')]||null:null,'attributes':_0x3a0960['options']?_0x3a0960[_0x48db('0x10')][_0x48db('0x13')]||null:null,'limit':_0x3a0960[_0x48db('0x10')]?_0x3a0960[_0x48db('0x10')][_0x48db('0x14')]||null:null})[_0x48db('0x6')](function(_0x3d0319){logger[_0x48db('0xd')](_0x48db('0x1b'),_0x3a0960);logger['debug'](_0x48db('0x1b'),_0x3a0960,JSON['stringify'](_0x3d0319));_0x350964(_0x3d0319);})['catch'](function(_0x239f69){logger[_0x48db('0xa')](_0x48db('0x1b'),_0x239f69[_0x48db('0xc')],_0x3a0960);_0x30e502(_0x43380f['error'](0x1f4,_0x239f69[_0x48db('0xc')]));});});};exports[_0x48db('0x1c')]=function(_0x3768ca){var _0x10a429=this;return new Promise(function(_0x56e930,_0x213a48){return db[_0x48db('0x1d')][_0x48db('0x1e')]({'where':_0x3768ca['options']?_0x3768ca['options']['where']||null:null})['then'](function(_0x1b94d3){logger[_0x48db('0xd')]('DestroyCmHopperBlack',_0x3768ca);logger[_0x48db('0x19')](_0x48db('0x1c'),_0x3768ca,JSON[_0x48db('0x1a')](_0x1b94d3));_0x56e930(_0x1b94d3);})[_0x48db('0xf')](function(_0x382b83){logger[_0x48db('0xa')](_0x48db('0x1c'),_0x382b83['message'],_0x3768ca);_0x213a48(_0x10a429[_0x48db('0xa')](0x1f4,_0x382b83['message']));});});}; \ No newline at end of file +var _0xa7bf=['body','raw','where','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperBlack','findAll','options','limit','include','map','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','update'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0xa7bf,0x15a));var _0xfa7b=function(_0x500de4,_0x4fd1c0){_0x500de4=_0x500de4-0x0;var _0x209894=_0xa7bf[_0x500de4];return _0x209894;};'use strict';var _=require(_0xfa7b('0x0'));var util=require('util');var moment=require(_0xfa7b('0x1'));var BPromise=require(_0xfa7b('0x2'));var rs=require(_0xfa7b('0x3'));var fs=require('fs');var Redis=require(_0xfa7b('0x4'));var db=require(_0xfa7b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa7b('0x6'))(_0xfa7b('0x7'));var config=require(_0xfa7b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfa7b('0x9')][_0xfa7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f07fb,_0x14130c,_0x3c6afd){return new BPromise(function(_0x4d29c5,_0x446c51){return client[_0xfa7b('0xb')](_0x1f07fb,_0x3c6afd)[_0xfa7b('0xc')](function(_0x42d5a9){logger[_0xfa7b('0xd')](_0xfa7b('0xe'),_0x14130c,_0xfa7b('0xf'));logger[_0xfa7b('0x10')](_0xfa7b('0x11'),_0x14130c,_0xfa7b('0xf'),JSON[_0xfa7b('0x12')](_0x42d5a9));if(_0x42d5a9[_0xfa7b('0x13')]){if(_0x42d5a9[_0xfa7b('0x13')]['code']===0x1f4){logger[_0xfa7b('0x13')](_0xfa7b('0xe'),_0x14130c,_0x42d5a9[_0xfa7b('0x13')][_0xfa7b('0x14')]);return _0x446c51(_0x42d5a9[_0xfa7b('0x13')][_0xfa7b('0x14')]);}logger[_0xfa7b('0x13')](_0xfa7b('0xe'),_0x14130c,_0x42d5a9[_0xfa7b('0x13')]['message']);return _0x4d29c5(_0x42d5a9[_0xfa7b('0x13')][_0xfa7b('0x14')]);}else{logger['info'](_0xfa7b('0xe'),_0x14130c,_0xfa7b('0xf'));_0x4d29c5(_0x42d5a9[_0xfa7b('0x15')]['message']);}})[_0xfa7b('0x16')](function(_0x1ab7d7){logger[_0xfa7b('0x13')](_0xfa7b('0xe'),_0x14130c,_0x1ab7d7);_0x446c51(_0x1ab7d7);});});}exports['GetCmHopperBlack']=function(_0x2f120e){var _0x333fee=this;return new Promise(function(_0x2a99b4,_0x490e90){return db[_0xfa7b('0x17')][_0xfa7b('0x18')]({'raw':_0x2f120e[_0xfa7b('0x19')]?_0x2f120e[_0xfa7b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2f120e[_0xfa7b('0x19')]?_0x2f120e['options']['where']||null:null,'attributes':_0x2f120e['options']?_0x2f120e[_0xfa7b('0x19')]['attributes']||null:null,'limit':_0x2f120e['options']?_0x2f120e['options'][_0xfa7b('0x1a')]||null:null,'include':_0x2f120e[_0xfa7b('0x19')]?_0x2f120e[_0xfa7b('0x19')][_0xfa7b('0x1b')]?_[_0xfa7b('0x1c')](_0x2f120e[_0xfa7b('0x19')][_0xfa7b('0x1b')],function(_0x357013){return{'model':db[_0x357013[_0xfa7b('0x1d')]],'as':_0x357013['as'],'attributes':_0x357013['attributes'],'include':_0x357013[_0xfa7b('0x1b')]?_[_0xfa7b('0x1c')](_0x357013[_0xfa7b('0x1b')],function(_0x46e38b){return{'model':db[_0x46e38b['model']],'as':_0x46e38b['as'],'attributes':_0x46e38b[_0xfa7b('0x1e')],'include':_0x46e38b[_0xfa7b('0x1b')]?_[_0xfa7b('0x1c')](_0x46e38b[_0xfa7b('0x1b')],function(_0x152bde){return{'model':db[_0x152bde[_0xfa7b('0x1d')]],'as':_0x152bde['as'],'attributes':_0x152bde[_0xfa7b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfa7b('0xc')](function(_0x31cdc1){logger[_0xfa7b('0xd')]('GetCmHopperBlack',_0x2f120e);logger['debug'](_0xfa7b('0x1f'),_0x2f120e,JSON[_0xfa7b('0x12')](_0x31cdc1));_0x2a99b4(_0x31cdc1);})[_0xfa7b('0x16')](function(_0x44a68b){logger['error'](_0xfa7b('0x1f'),_0x44a68b['message'],_0x2f120e);_0x490e90(_0x333fee[_0xfa7b('0x13')](0x1f4,_0x44a68b['message']));});});};exports[_0xfa7b('0x20')]=function(_0xce5e2c){var _0x461765=this;return new Promise(function(_0x432590,_0x567b19){return db[_0xfa7b('0x17')][_0xfa7b('0x21')](_0xce5e2c[_0xfa7b('0x22')],{'raw':_0xce5e2c[_0xfa7b('0x19')]?_0xce5e2c[_0xfa7b('0x19')][_0xfa7b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce5e2c['options']?_0xce5e2c['options'][_0xfa7b('0x24')]||null:null,'attributes':_0xce5e2c[_0xfa7b('0x19')]?_0xce5e2c[_0xfa7b('0x19')]['attributes']||null:null,'limit':_0xce5e2c[_0xfa7b('0x19')]?_0xce5e2c[_0xfa7b('0x19')][_0xfa7b('0x1a')]||null:null})[_0xfa7b('0xc')](function(_0x9ecc6c){logger[_0xfa7b('0xd')](_0xfa7b('0x20'),_0xce5e2c);logger[_0xfa7b('0x10')](_0xfa7b('0x20'),_0xce5e2c,JSON[_0xfa7b('0x12')](_0x9ecc6c));_0x432590(_0x9ecc6c);})[_0xfa7b('0x16')](function(_0x49689e){logger['error'](_0xfa7b('0x20'),_0x49689e['message'],_0xce5e2c);_0x567b19(_0x461765['error'](0x1f4,_0x49689e[_0xfa7b('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x12c7d3){var _0x1514a3=this;return new Promise(function(_0x50a940,_0x3bdc1d){return db['CmHopperBlack']['destroy']({'where':_0x12c7d3[_0xfa7b('0x19')]?_0x12c7d3[_0xfa7b('0x19')]['where']||null:null})[_0xfa7b('0xc')](function(_0x3e3e1d){logger[_0xfa7b('0xd')](_0xfa7b('0x25'),_0x12c7d3);logger[_0xfa7b('0x10')](_0xfa7b('0x25'),_0x12c7d3,JSON[_0xfa7b('0x12')](_0x3e3e1d));_0x50a940(_0x3e3e1d);})[_0xfa7b('0x16')](function(_0x4e6497){logger['error'](_0xfa7b('0x25'),_0x4e6497[_0xfa7b('0x14')],_0x12c7d3);_0x3bdc1d(_0x1514a3[_0xfa7b('0x13')](0x1f4,_0x4e6497[_0xfa7b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1ae8739..aefc0ea 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27a0=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','./cmHopperBlack.controller','get'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x27a0,0xbf));var _0x027a=function(_0x124ded,_0x25905a){_0x124ded=_0x124ded-0x0;var _0x1f16d6=_0x27a0[_0x124ded];return _0x1f16d6;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xe')]);router[_0x027a('0xf')](_0x027a('0xb'),auth[_0x027a('0x7')](),controller[_0x027a('0x10')]);module[_0x027a('0x11')]=router; \ No newline at end of file +var _0x4137=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/:id',auth[_0x7413('0xe')](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c7c12b4..2a55694 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 _0xe649=['endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xe649,0x95));var _0x9e64=function(_0x195004,_0xa1e1af){_0x195004=_0x195004-0x0;var _0x33e15c=_0xe649[_0x195004];return _0x33e15c;};'use strict';var Sequelize=require(_0x9e64('0x0'));var moment=require(_0x9e64('0x1'));module[_0x9e64('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9e64('0x3')]},'scheduledat':{'type':Sequelize[_0x9e64('0x4')]},'countbusyretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9e64('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9e64('0x3')]},'calleridnum':{'type':Sequelize[_0x9e64('0x3')]},'calleridname':{'type':Sequelize[_0x9e64('0x3')]},'starttime':{'type':Sequelize[_0x9e64('0x4')]},'responsetime':{'type':Sequelize[_0x9e64('0x4')]},'answertime':{'type':Sequelize[_0x9e64('0x4')]},'droptime':{'type':Sequelize[_0x9e64('0x4')]},'endtime':{'type':Sequelize[_0x9e64('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9e64('0x3')]},'campaign':{'type':Sequelize[_0x9e64('0x3')]},'campaigntype':{'type':Sequelize[_0x9e64('0x3')]},'membername':{'type':Sequelize[_0x9e64('0x3')]},'reason':{'type':Sequelize[_0x9e64('0x3')]},'disposition':{'type':Sequelize[_0x9e64('0x3')]},'secondDisposition':{'type':Sequelize[_0x9e64('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9e64('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x25e74a){var _0x4235d3=this[_0x9e64('0x6')](_0x9e64('0x7'));if(_0x4235d3&&_0x25e74a){this[_0x9e64('0x8')]('followuptime',moment(_0x25e74a)[_0x9e64('0x9')](moment(_0x4235d3),_0x9e64('0xa')));}return this[_0x9e64('0x8')](_0x9e64('0xb'),_0x25e74a);}},'amd':{'type':Sequelize[_0x9e64('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9e64('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9e64('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9e64('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9e64('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9e64('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x9e64('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9e64('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9e64('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea4f=['INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize'];(function(_0x2a5f0a,_0x1e48fe){var _0x2a1bc9=function(_0x511ed8){while(--_0x511ed8){_0x2a5f0a['push'](_0x2a5f0a['shift']());}};_0x2a1bc9(++_0x1e48fe);}(_0xea4f,0x167));var _0xfea4=function(_0x57899e,_0x55fe97){_0x57899e=_0x57899e-0x0;var _0x2828b7=_0xea4f[_0x57899e];return _0x2828b7;};'use strict';var Sequelize=require(_0xfea4('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xfea4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfea4('0x2')]},'scheduledat':{'type':Sequelize[_0xfea4('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfea4('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xfea4('0x2')]},'originatecalleridname':{'type':Sequelize[_0xfea4('0x2')]},'calleridnum':{'type':Sequelize[_0xfea4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xfea4('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xfea4('0x2')]},'campaigntype':{'type':Sequelize[_0xfea4('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfea4('0x2')]},'disposition':{'type':Sequelize[_0xfea4('0x2')]},'secondDisposition':{'type':Sequelize[_0xfea4('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfea4('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x521f97){var _0x2e124b=this[_0xfea4('0x4')](_0xfea4('0x5'));if(_0x2e124b&&_0x521f97){this['setDataValue'](_0xfea4('0x6'),moment(_0x521f97)[_0xfea4('0x7')](moment(_0x2e124b),_0xfea4('0x8')));}return this['setDataValue']('dispositionat',_0x521f97);}},'amd':{'type':Sequelize[_0xfea4('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfea4('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xfea4('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfea4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfea4('0x3')]},'deleted':{'type':Sequelize[_0xfea4('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xfea4('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfea4('0x1')],'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 eea79fa..9c66d1d 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 _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','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','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x3ada3d,_0x21ef0a){var _0x8b90a=function(_0xa4a129){while(--_0xa4a129){_0x3ada3d['push'](_0x3ada3d['shift']());}};_0x8b90a(++_0x21ef0a);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file +var _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0xa46404,_0x208e5d){var _0xcce04=function(_0x21e5c3){while(--_0x21e5c3){_0xa46404['push'](_0xa46404['shift']());}};_0xcce04(++_0x208e5d);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x50630f,_0x52703c){_0x50630f=_0x50630f-0x0;var _0x2ffd44=_0xbd51[_0x50630f];return _0x2ffd44;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 280eff5..8cd9af8 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 _0xdbeb=['define','CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x104f90,_0x394c26){var _0x19c00c=function(_0x1a6123){while(--_0x1a6123){_0x104f90['push'](_0x104f90['shift']());}};_0x19c00c(++_0x394c26);}(_0xdbeb,0x74));var _0xbdbe=function(_0x38a7fe,_0xb43709){_0x38a7fe=_0x38a7fe-0x0;var _0x17de83=_0xdbeb[_0x38a7fe];return _0x17de83;};'use strict';var _=require(_0xbdbe('0x0'));var util=require('util');var logger=require(_0xbdbe('0x1'))(_0xbdbe('0x2'));var moment=require(_0xbdbe('0x3'));var BPromise=require(_0xbdbe('0x4'));var rp=require(_0xbdbe('0x5'));var fs=require('fs');var path=require(_0xbdbe('0x6'));var rimraf=require(_0xbdbe('0x7'));var config=require(_0xbdbe('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0xbdbe('0x9')]=function(_0x131f8e,_0x4259a2){return _0x131f8e[_0xbdbe('0xa')](_0xbdbe('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xbdbe('0xc')]},{'name':_0xbdbe('0xd'),'fields':[_0xbdbe('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5057=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2b4767,_0x29316f){var _0xfc36a8=function(_0x394ac2){while(--_0x394ac2){_0x2b4767['push'](_0x2b4767['shift']());}};_0xfc36a8(++_0x29316f);}(_0x5057,0x1a0));var _0x7505=function(_0x49d023,_0x19fca0){_0x49d023=_0x49d023-0x0;var _0x3e1d78=_0x5057[_0x49d023];return _0x3e1d78;};'use strict';var _=require(_0x7505('0x0'));var util=require('util');var logger=require(_0x7505('0x1'))('api');var moment=require(_0x7505('0x2'));var BPromise=require(_0x7505('0x3'));var rp=require(_0x7505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7505('0x5'));var config=require(_0x7505('0x6'));var attributes=require(_0x7505('0x7'));module[_0x7505('0x8')]=function(_0x10374e,_0x3d4406){return _0x10374e[_0x7505('0x9')]('CmHopperFinal',attributes,{'tableName':_0x7505('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x7505('0xb')]},{'name':_0x7505('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3cc80e5..319f379 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2e1f13,_0xa085ea){var _0x35b137=function(_0x3ce887){while(--_0x3ce887){_0x2e1f13['push'](_0x2e1f13['shift']());}};_0x35b137(++_0xa085ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x5541ae,_0x4a902d){_0x5541ae=_0x5541ae-0x0;var _0x42adf6=_0xb10b[_0x5541ae];return _0x42adf6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xf26963,_0x46ece2){var _0x41bd98=function(_0x43bccb){while(--_0x43bccb){_0xf26963['push'](_0xf26963['shift']());}};_0x41bd98(++_0x46ece2);}(_0xb10b,0x12a));var _0xbb10=function(_0x41deb8,_0x458105){_0x41deb8=_0x41deb8-0x0;var _0x1e2084=_0xb10b[_0x41deb8];return _0x1e2084;};'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 1f7c03f..5e049dc 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 _0x528c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x528c,0x65));var _0xc528=function(_0x335f2c,_0x1b84b8){_0x335f2c=_0x335f2c-0x0;var _0x4d31dd=_0x528c[_0x335f2c];return _0x4d31dd;};'use strict';var multer=require(_0xc528('0x0'));var util=require(_0xc528('0x1'));var path=require(_0xc528('0x2'));var timeout=require(_0xc528('0x3'));var express=require(_0xc528('0x4'));var router=express[_0xc528('0x5')]();var fs_extra=require(_0xc528('0x6'));var auth=require(_0xc528('0x7'));var interaction=require(_0xc528('0x8'));var config=require(_0xc528('0x9'));var controller=require('./cmHopperFinal.controller');router[_0xc528('0xa')]('/',auth['isAuthenticated'](),controller[_0xc528('0xb')]);router[_0xc528('0xa')](_0xc528('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc528('0xa')](_0xc528('0xd'),auth[_0xc528('0xe')](),controller[_0xc528('0xf')]);router[_0xc528('0xa')](_0xc528('0x10'),auth[_0xc528('0xe')](),controller[_0xc528('0x11')]);router[_0xc528('0xa')](_0xc528('0x12'),auth[_0xc528('0xe')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xc528('0x13'),auth[_0xc528('0xe')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xc528('0x14')]('/voice/campaign/moveContacts/:id',auth[_0xc528('0xe')](),controller[_0xc528('0x15')]);router['post'](_0xc528('0x16'),auth['isAuthenticated'](),controller[_0xc528('0x17')]);router[_0xc528('0x18')](_0xc528('0xd'),auth[_0xc528('0xe')](),controller[_0xc528('0x19')]);module[_0xc528('0x1a')]=router; \ No newline at end of file +var _0xd70e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','multer','connect-timeout'];(function(_0x4edbc3,_0x35edc6){var _0xa1e5ff=function(_0x2eb4ac){while(--_0x2eb4ac){_0x4edbc3['push'](_0x4edbc3['shift']());}};_0xa1e5ff(++_0x35edc6);}(_0xd70e,0x157));var _0xed70=function(_0x8d7de,_0x242da2){_0x8d7de=_0x8d7de-0x0;var _0x4e27f2=_0xd70e[_0x8d7de];return _0x4e27f2;};'use strict';var multer=require(_0xed70('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed70('0x1'));var express=require(_0xed70('0x2'));var router=express[_0xed70('0x3')]();var fs_extra=require(_0xed70('0x4'));var auth=require(_0xed70('0x5'));var interaction=require(_0xed70('0x6'));var config=require(_0xed70('0x7'));var controller=require('./cmHopperFinal.controller');router[_0xed70('0x8')]('/',auth[_0xed70('0x9')](),controller[_0xed70('0xa')]);router[_0xed70('0x8')]('/describe',auth[_0xed70('0x9')](),controller['describe']);router[_0xed70('0x8')]('/:id',auth[_0xed70('0x9')](),controller[_0xed70('0xb')]);router[_0xed70('0x8')](_0xed70('0xc'),auth[_0xed70('0x9')](),controller[_0xed70('0xd')]);router['get'](_0xed70('0xe'),auth[_0xed70('0x9')](),controller[_0xed70('0xf')]);router[_0xed70('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xed70('0x11')]);router[_0xed70('0x10')]('/voice/campaign/moveContacts/:id',auth[_0xed70('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xed70('0x10')](_0xed70('0x12'),auth[_0xed70('0x9')](),controller['checkContactHopper']);router[_0xed70('0x13')](_0xed70('0x14'),auth['isAuthenticated'](),controller[_0xed70('0x15')]);module[_0xed70('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 55dc556..f620512 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 _0xc0d7=['DATE','INTEGER','BOOLEAN','STRING'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3b4595,_0x4271ec){_0x3b4595=_0x3b4595-0x0;var _0x5ddbb0=_0xc0d7[_0x3b4595];return _0x5ddbb0;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7c0d('0x0')]},'scheduledat':{'type':Sequelize[_0x7c0d('0x1')]},'countbusyretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7c0d('0x0')]},'originatecalleridnum':{'type':Sequelize[_0x7c0d('0x0')]},'originatecalleridname':{'type':Sequelize[_0x7c0d('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7c0d('0x0')]},'starttime':{'type':Sequelize[_0x7c0d('0x1')]},'responsetime':{'type':Sequelize[_0x7c0d('0x1')]},'answertime':{'type':Sequelize[_0x7c0d('0x1')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7c0d('0x1')]},'ringtime':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7c0d('0x0')]},'campaign':{'type':Sequelize[_0x7c0d('0x0')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7c0d('0x0')]},'amd':{'type':Sequelize[_0x7c0d('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x7c0d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7c0d('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7c0d('0x1')]},'recallme':{'type':Sequelize[_0x7c0d('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7c0d('0x1')]},'edited':{'type':Sequelize[_0x7c0d('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7c0d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7c0d('0x0')]}}; \ No newline at end of file +var _0xd237=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd237,0x12b));var _0x7d23=function(_0x1d5c12,_0x3a49b0){_0x1d5c12=_0x1d5c12-0x0;var _0x56edd2=_0xd237[_0x1d5c12];return _0x56edd2;};'use strict';var Sequelize=require(_0x7d23('0x0'));module[_0x7d23('0x1')]={'state':{'type':Sequelize[_0x7d23('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7d23('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7d23('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7d23('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7d23('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7d23('0x4')]},'responsetime':{'type':Sequelize[_0x7d23('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7d23('0x4')]},'endtime':{'type':Sequelize[_0x7d23('0x4')]},'ringtime':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x7d23('0x3')]},'campaigntype':{'type':Sequelize[_0x7d23('0x3')]},'membername':{'type':Sequelize[_0x7d23('0x3')]},'reason':{'type':Sequelize[_0x7d23('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7d23('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7d23('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7d23('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d23('0x4')]},'recallme':{'type':Sequelize[_0x7d23('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x7d23('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d23('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7d23('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2b8a94d..e52f193 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 _0x7bc9=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x7bc9,0xde));var _0x97bc=function(_0x22ea4a,_0x16776a){_0x22ea4a=_0x22ea4a-0x0;var _0x1f0639=_0x7bc9[_0x22ea4a];return _0x1f0639;};'use strict';var emlformat=require(_0x97bc('0x0'));var rimraf=require(_0x97bc('0x1'));var zipdir=require(_0x97bc('0x2'));var jsonpatch=require(_0x97bc('0x3'));var rp=require(_0x97bc('0x4'));var moment=require(_0x97bc('0x5'));var BPromise=require(_0x97bc('0x6'));var Mustache=require(_0x97bc('0x7'));var util=require(_0x97bc('0x8'));var path=require(_0x97bc('0x9'));var sox=require(_0x97bc('0xa'));var csv=require('to-csv');var ejs=require(_0x97bc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97bc('0xc'));var crypto=require(_0x97bc('0xd'));var jsforce=require(_0x97bc('0xe'));var deskjs=require(_0x97bc('0xf'));var toCsv=require(_0x97bc('0x10'));var querystring=require(_0x97bc('0x11'));var Papa=require(_0x97bc('0x12'));var Redis=require('ioredis');var authService=require(_0x97bc('0x13'));var qs=require(_0x97bc('0x14'));var as=require(_0x97bc('0x15'));var hardwareService=require(_0x97bc('0x16'));var logger=require('../../config/logger')(_0x97bc('0x17'));var utils=require('../../config/utils');var config=require(_0x97bc('0x18'));var licenseUtil=require(_0x97bc('0x19'));var db=require(_0x97bc('0x1a'))['db'];function respondWithStatusCode(_0x45b49e,_0x570d1e){_0x570d1e=_0x570d1e||0xcc;return function(_0x47a53d){if(_0x47a53d){return _0x45b49e[_0x97bc('0x1b')](_0x570d1e);}return _0x45b49e[_0x97bc('0x1c')](_0x570d1e)[_0x97bc('0x1d')]();};}function respondWithResult(_0x2e238d,_0x227341){_0x227341=_0x227341||0xc8;return function(_0x485ddf){if(_0x485ddf){return _0x2e238d[_0x97bc('0x1c')](_0x227341)[_0x97bc('0x1e')](_0x485ddf);}};}function respondWithFilteredResult(_0x158b74,_0x5bab60){return function(_0x39baa3){if(_0x39baa3){var _0x13db03=typeof _0x5bab60['offset']===_0x97bc('0x1f')&&typeof _0x5bab60[_0x97bc('0x20')]==='undefined';var _0x56bdd0=_0x39baa3[_0x97bc('0x21')];var _0x693c9d=_0x13db03?0x0:_0x5bab60[_0x97bc('0x22')];var _0x487cad=_0x13db03?_0x39baa3['count']:_0x5bab60['offset']+_0x5bab60[_0x97bc('0x20')];var _0x226643;if(_0x487cad>=_0x56bdd0){_0x487cad=_0x56bdd0;_0x226643=0xc8;}else{_0x226643=0xce;}_0x158b74[_0x97bc('0x1c')](_0x226643);return _0x158b74[_0x97bc('0x23')](_0x97bc('0x24'),_0x693c9d+'-'+_0x487cad+'/'+_0x56bdd0)[_0x97bc('0x1e')](_0x39baa3);}return null;};}function patchUpdates(_0x38bd45){return function(_0x3c8aae){try{jsonpatch[_0x97bc('0x25')](_0x3c8aae,_0x38bd45,!![]);}catch(_0x3d257b){return BPromise['reject'](_0x3d257b);}return _0x3c8aae[_0x97bc('0x26')]();};}function saveUpdates(_0x392ac4,_0xc8e89b){return function(_0x5c375a){if(_0x5c375a){return _0x5c375a[_0x97bc('0x27')](_0x392ac4)[_0x97bc('0x28')](function(_0x577793){return _0x577793;});}return null;};}function removeEntity(_0x6f9589,_0x46ce94){return function(_0x48acda){if(_0x48acda){return _0x48acda[_0x97bc('0x29')]()[_0x97bc('0x28')](function(){_0x6f9589[_0x97bc('0x1c')](0xcc)[_0x97bc('0x1d')]();});}};}function handleEntityNotFound(_0x43b286,_0x447808){return function(_0x187260){if(!_0x187260){_0x43b286[_0x97bc('0x1b')](0x194);}return _0x187260;};}function handleError(_0x59016f,_0x302fc6){_0x302fc6=_0x302fc6||0x1f4;return function(_0x3e8f58){logger['error'](_0x3e8f58['stack']);if(_0x3e8f58[_0x97bc('0x2a')]){delete _0x3e8f58[_0x97bc('0x2a')];}_0x59016f[_0x97bc('0x1c')](_0x302fc6)['send'](_0x3e8f58);};}exports[_0x97bc('0x2b')]=function(_0x27a434,_0x31adc8){var _0x3b4bbe={},_0xac453a={},_0x48b6ce={'count':0x0,'rows':[]};var _0x46f0e5=_[_0x97bc('0x2c')](db['CmHopperHistory'][_0x97bc('0x2d')],function(_0x323c11){return{'name':_0x323c11['fieldName'],'type':_0x323c11[_0x97bc('0x2e')][_0x97bc('0x2f')]};});_0xac453a[_0x97bc('0x30')]=_['map'](_0x46f0e5,_0x97bc('0x2a'));_0xac453a[_0x97bc('0x31')]=_['keys'](_0x27a434[_0x97bc('0x31')]);_0xac453a[_0x97bc('0x32')]=_[_0x97bc('0x33')](_0xac453a[_0x97bc('0x30')],_0xac453a[_0x97bc('0x31')]);_0x3b4bbe[_0x97bc('0x34')]=_[_0x97bc('0x33')](_0xac453a[_0x97bc('0x30')],qs['fields'](_0x27a434[_0x97bc('0x31')][_0x97bc('0x35')]));_0x3b4bbe['attributes']=_0x3b4bbe['attributes'][_0x97bc('0x36')]?_0x3b4bbe[_0x97bc('0x34')]:_0xac453a['model'];if(!_0x27a434[_0x97bc('0x31')][_0x97bc('0x37')](_0x97bc('0x38'))){_0x3b4bbe['limit']=qs['limit'](_0x27a434[_0x97bc('0x31')]['limit']);_0x3b4bbe[_0x97bc('0x22')]=qs['offset'](_0x27a434['query']['offset']);}_0x3b4bbe[_0x97bc('0x39')]=qs[_0x97bc('0x3a')](_0x27a434[_0x97bc('0x31')][_0x97bc('0x3a')]);_0x3b4bbe[_0x97bc('0x3b')]=qs[_0x97bc('0x32')](_['pick'](_0x27a434[_0x97bc('0x31')],_0xac453a[_0x97bc('0x32')]),_0x46f0e5);if(_0x27a434['query'][_0x97bc('0x3c')]){_0x3b4bbe['where']=_[_0x97bc('0x3d')](_0x3b4bbe[_0x97bc('0x3b')],{'$or':_[_0x97bc('0x2c')](_0x46f0e5,function(_0x2ffa6e){if(_0x2ffa6e['type']!==_0x97bc('0x3e')){var _0x27215f={};_0x27215f[_0x2ffa6e[_0x97bc('0x2a')]]={'$like':'%'+_0x27a434[_0x97bc('0x31')][_0x97bc('0x3c')]+'%'};return _0x27215f;}})});}_0x3b4bbe=_[_0x97bc('0x3d')]({},_0x3b4bbe,_0x27a434[_0x97bc('0x3f')]);var _0x252132={'where':_0x3b4bbe[_0x97bc('0x3b')]};return db[_0x97bc('0x40')][_0x97bc('0x21')](_0x252132)['then'](function(_0x4decec){_0x48b6ce[_0x97bc('0x21')]=_0x4decec;if(_0x27a434[_0x97bc('0x31')][_0x97bc('0x41')]){_0x3b4bbe[_0x97bc('0x42')]=[{'all':!![]}];}return db[_0x97bc('0x40')][_0x97bc('0x43')](_0x3b4bbe);})['then'](function(_0x363b8f){_0x48b6ce[_0x97bc('0x44')]=_0x363b8f;return _0x48b6ce;})[_0x97bc('0x28')](respondWithFilteredResult(_0x31adc8,_0x3b4bbe))[_0x97bc('0x45')](handleError(_0x31adc8,null));};exports[_0x97bc('0x46')]=function(_0x46680e,_0x92f4f9){var _0x2bc171={'raw':!![],'where':{'id':_0x46680e[_0x97bc('0x47')]['id']}},_0x53605e={};_0x53605e['model']=_[_0x97bc('0x48')](db[_0x97bc('0x40')][_0x97bc('0x2d')]);_0x53605e[_0x97bc('0x31')]=_[_0x97bc('0x48')](_0x46680e[_0x97bc('0x31')]);_0x53605e[_0x97bc('0x32')]=_[_0x97bc('0x33')](_0x53605e[_0x97bc('0x30')],_0x53605e[_0x97bc('0x31')]);_0x2bc171[_0x97bc('0x34')]=_[_0x97bc('0x33')](_0x53605e[_0x97bc('0x30')],qs[_0x97bc('0x35')](_0x46680e[_0x97bc('0x31')][_0x97bc('0x35')]));_0x2bc171[_0x97bc('0x34')]=_0x2bc171[_0x97bc('0x34')][_0x97bc('0x36')]?_0x2bc171['attributes']:_0x53605e[_0x97bc('0x30')];if(_0x46680e[_0x97bc('0x31')][_0x97bc('0x41')]){_0x2bc171[_0x97bc('0x42')]=[{'all':!![]}];}_0x2bc171=_[_0x97bc('0x3d')]({},_0x2bc171,_0x46680e['options']);return db[_0x97bc('0x40')][_0x97bc('0x49')](_0x2bc171)[_0x97bc('0x28')](handleEntityNotFound(_0x92f4f9,null))[_0x97bc('0x28')](respondWithResult(_0x92f4f9,null))[_0x97bc('0x45')](handleError(_0x92f4f9,null));};exports['create']=function(_0x36acfb,_0x3412e6){return db[_0x97bc('0x40')][_0x97bc('0x4a')](_0x36acfb[_0x97bc('0x4b')],{})['then'](respondWithResult(_0x3412e6,0xc9))[_0x97bc('0x45')](handleError(_0x3412e6,null));};exports[_0x97bc('0x4c')]=function(_0x34fb8d,_0x154440){return db[_0x97bc('0x40')][_0x97bc('0x4c')]()[_0x97bc('0x28')](respondWithResult(_0x154440,null))[_0x97bc('0x45')](handleError(_0x154440,null));};exports['update']=function(_0x560ed2,_0x26b218){if(_0x560ed2[_0x97bc('0x4b')][_0x97bc('0x4d')]){delete _0x560ed2[_0x97bc('0x4b')][_0x97bc('0x4d')];}return db[_0x97bc('0x40')]['find']({'where':{'uniqueid':_0x560ed2[_0x97bc('0x47')]['id']}})[_0x97bc('0x28')](handleEntityNotFound(_0x26b218,null))[_0x97bc('0x28')](saveUpdates(_0x560ed2['body'],null))[_0x97bc('0x28')](respondWithResult(_0x26b218,null))[_0x97bc('0x45')](handleError(_0x26b218,null));}; \ No newline at end of file +var _0xc8f2=['apply','reject','save','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','type','filter','options','includeAll','include','rows','params','catch','create','body','describe','update','uniqueid','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x444251,_0x3cf5af){var _0x328ab7=function(_0x5f1283){while(--_0x5f1283){_0x444251['push'](_0x444251['shift']());}};_0x328ab7(++_0x3cf5af);}(_0xc8f2,0x137));var _0x2c8f=function(_0x574ac1,_0x1f6ace){_0x574ac1=_0x574ac1-0x0;var _0x2805b5=_0xc8f2[_0x574ac1];return _0x2805b5;};'use strict';var emlformat=require(_0x2c8f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c8f('0x1'));var rp=require('request-promise');var moment=require(_0x2c8f('0x2'));var BPromise=require(_0x2c8f('0x3'));var Mustache=require(_0x2c8f('0x4'));var util=require(_0x2c8f('0x5'));var path=require(_0x2c8f('0x6'));var sox=require(_0x2c8f('0x7'));var csv=require(_0x2c8f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c8f('0x9'));var deskjs=require(_0x2c8f('0xa'));var toCsv=require(_0x2c8f('0x8'));var querystring=require('querystring');var Papa=require(_0x2c8f('0xb'));var Redis=require('ioredis');var authService=require(_0x2c8f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2c8f('0xd'));var hardwareService=require(_0x2c8f('0xe'));var logger=require(_0x2c8f('0xf'))(_0x2c8f('0x10'));var utils=require(_0x2c8f('0x11'));var config=require(_0x2c8f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c8f('0x13'))['db'];function respondWithStatusCode(_0x62dc3a,_0x19ee2c){_0x19ee2c=_0x19ee2c||0xcc;return function(_0x3928ed){if(_0x3928ed){return _0x62dc3a[_0x2c8f('0x14')](_0x19ee2c);}return _0x62dc3a['status'](_0x19ee2c)[_0x2c8f('0x15')]();};}function respondWithResult(_0x3638d6,_0x3b4348){_0x3b4348=_0x3b4348||0xc8;return function(_0x46d3eb){if(_0x46d3eb){return _0x3638d6[_0x2c8f('0x16')](_0x3b4348)[_0x2c8f('0x17')](_0x46d3eb);}};}function respondWithFilteredResult(_0x3a2c5f,_0x26ab92){return function(_0x3c1e15){if(_0x3c1e15){var _0x39209e=typeof _0x26ab92[_0x2c8f('0x18')]==='undefined'&&typeof _0x26ab92[_0x2c8f('0x19')]===_0x2c8f('0x1a');var _0x1c687c=_0x3c1e15[_0x2c8f('0x1b')];var _0x3aed3c=_0x39209e?0x0:_0x26ab92[_0x2c8f('0x18')];var _0xf19612=_0x39209e?_0x3c1e15[_0x2c8f('0x1b')]:_0x26ab92['offset']+_0x26ab92[_0x2c8f('0x19')];var _0x2fa458;if(_0xf19612>=_0x1c687c){_0xf19612=_0x1c687c;_0x2fa458=0xc8;}else{_0x2fa458=0xce;}_0x3a2c5f[_0x2c8f('0x16')](_0x2fa458);return _0x3a2c5f['set'](_0x2c8f('0x1c'),_0x3aed3c+'-'+_0xf19612+'/'+_0x1c687c)[_0x2c8f('0x17')](_0x3c1e15);}return null;};}function patchUpdates(_0x3f8031){return function(_0x285f8a){try{jsonpatch[_0x2c8f('0x1d')](_0x285f8a,_0x3f8031,!![]);}catch(_0xce92f0){return BPromise[_0x2c8f('0x1e')](_0xce92f0);}return _0x285f8a[_0x2c8f('0x1f')]();};}function saveUpdates(_0x5d33d3,_0x1f9d9a){return function(_0x2e681a){if(_0x2e681a){return _0x2e681a['update'](_0x5d33d3)[_0x2c8f('0x20')](function(_0x3c623b){return _0x3c623b;});}return null;};}function removeEntity(_0x469334,_0x5ab834){return function(_0x32ffcf){if(_0x32ffcf){return _0x32ffcf[_0x2c8f('0x21')]()[_0x2c8f('0x20')](function(){_0x469334[_0x2c8f('0x16')](0xcc)[_0x2c8f('0x15')]();});}};}function handleEntityNotFound(_0x520f52,_0x550470){return function(_0x5e6a3e){if(!_0x5e6a3e){_0x520f52[_0x2c8f('0x14')](0x194);}return _0x5e6a3e;};}function handleError(_0x328731,_0x4fe34e){_0x4fe34e=_0x4fe34e||0x1f4;return function(_0x18fede){logger[_0x2c8f('0x22')](_0x18fede[_0x2c8f('0x23')]);if(_0x18fede[_0x2c8f('0x24')]){delete _0x18fede['name'];}_0x328731['status'](_0x4fe34e)['send'](_0x18fede);};}exports[_0x2c8f('0x25')]=function(_0x51d52d,_0x154df){var _0xdc9eb1={},_0x5ba6c7={},_0x480be7={'count':0x0,'rows':[]};var _0x4d7af3=_[_0x2c8f('0x26')](db[_0x2c8f('0x27')][_0x2c8f('0x28')],function(_0x406230){return{'name':_0x406230[_0x2c8f('0x29')],'type':_0x406230['type']['key']};});_0x5ba6c7['model']=_[_0x2c8f('0x26')](_0x4d7af3,_0x2c8f('0x24'));_0x5ba6c7['query']=_[_0x2c8f('0x2a')](_0x51d52d[_0x2c8f('0x2b')]);_0x5ba6c7['filters']=_[_0x2c8f('0x2c')](_0x5ba6c7[_0x2c8f('0x2d')],_0x5ba6c7['query']);_0xdc9eb1[_0x2c8f('0x2e')]=_[_0x2c8f('0x2c')](_0x5ba6c7['model'],qs[_0x2c8f('0x2f')](_0x51d52d[_0x2c8f('0x2b')]['fields']));_0xdc9eb1[_0x2c8f('0x2e')]=_0xdc9eb1['attributes']['length']?_0xdc9eb1[_0x2c8f('0x2e')]:_0x5ba6c7[_0x2c8f('0x2d')];if(!_0x51d52d['query'][_0x2c8f('0x30')]('nolimit')){_0xdc9eb1[_0x2c8f('0x19')]=qs[_0x2c8f('0x19')](_0x51d52d[_0x2c8f('0x2b')][_0x2c8f('0x19')]);_0xdc9eb1[_0x2c8f('0x18')]=qs[_0x2c8f('0x18')](_0x51d52d[_0x2c8f('0x2b')][_0x2c8f('0x18')]);}_0xdc9eb1[_0x2c8f('0x31')]=qs[_0x2c8f('0x32')](_0x51d52d[_0x2c8f('0x2b')]['sort']);_0xdc9eb1[_0x2c8f('0x33')]=qs[_0x2c8f('0x34')](_['pick'](_0x51d52d['query'],_0x5ba6c7[_0x2c8f('0x34')]),_0x4d7af3);if(_0x51d52d[_0x2c8f('0x2b')]['filter']){_0xdc9eb1[_0x2c8f('0x33')]=_[_0x2c8f('0x35')](_0xdc9eb1[_0x2c8f('0x33')],{'$or':_['map'](_0x4d7af3,function(_0x2a9235){if(_0x2a9235[_0x2c8f('0x36')]!=='VIRTUAL'){var _0x152865={};_0x152865[_0x2a9235[_0x2c8f('0x24')]]={'$like':'%'+_0x51d52d[_0x2c8f('0x2b')][_0x2c8f('0x37')]+'%'};return _0x152865;}})});}_0xdc9eb1=_[_0x2c8f('0x35')]({},_0xdc9eb1,_0x51d52d[_0x2c8f('0x38')]);var _0x39e178={'where':_0xdc9eb1[_0x2c8f('0x33')]};return db[_0x2c8f('0x27')][_0x2c8f('0x1b')](_0x39e178)[_0x2c8f('0x20')](function(_0x2e9ebf){_0x480be7[_0x2c8f('0x1b')]=_0x2e9ebf;if(_0x51d52d[_0x2c8f('0x2b')][_0x2c8f('0x39')]){_0xdc9eb1[_0x2c8f('0x3a')]=[{'all':!![]}];}return db[_0x2c8f('0x27')]['findAll'](_0xdc9eb1);})['then'](function(_0x305ecf){_0x480be7[_0x2c8f('0x3b')]=_0x305ecf;return _0x480be7;})['then'](respondWithFilteredResult(_0x154df,_0xdc9eb1))['catch'](handleError(_0x154df,null));};exports['show']=function(_0x4a092f,_0x421036){var _0xe35099={'raw':!![],'where':{'id':_0x4a092f[_0x2c8f('0x3c')]['id']}},_0x3b2a89={};_0x3b2a89['model']=_['keys'](db[_0x2c8f('0x27')][_0x2c8f('0x28')]);_0x3b2a89[_0x2c8f('0x2b')]=_[_0x2c8f('0x2a')](_0x4a092f['query']);_0x3b2a89['filters']=_[_0x2c8f('0x2c')](_0x3b2a89[_0x2c8f('0x2d')],_0x3b2a89[_0x2c8f('0x2b')]);_0xe35099['attributes']=_[_0x2c8f('0x2c')](_0x3b2a89[_0x2c8f('0x2d')],qs[_0x2c8f('0x2f')](_0x4a092f[_0x2c8f('0x2b')]['fields']));_0xe35099['attributes']=_0xe35099[_0x2c8f('0x2e')]['length']?_0xe35099[_0x2c8f('0x2e')]:_0x3b2a89[_0x2c8f('0x2d')];if(_0x4a092f[_0x2c8f('0x2b')]['includeAll']){_0xe35099[_0x2c8f('0x3a')]=[{'all':!![]}];}_0xe35099=_[_0x2c8f('0x35')]({},_0xe35099,_0x4a092f[_0x2c8f('0x38')]);return db['CmHopperHistory']['find'](_0xe35099)['then'](handleEntityNotFound(_0x421036,null))[_0x2c8f('0x20')](respondWithResult(_0x421036,null))[_0x2c8f('0x3d')](handleError(_0x421036,null));};exports['create']=function(_0x1b2a1b,_0x1735f2){return db[_0x2c8f('0x27')][_0x2c8f('0x3e')](_0x1b2a1b[_0x2c8f('0x3f')],{})[_0x2c8f('0x20')](respondWithResult(_0x1735f2,0xc9))[_0x2c8f('0x3d')](handleError(_0x1735f2,null));};exports[_0x2c8f('0x40')]=function(_0x3963f9,_0x573bfa){return db[_0x2c8f('0x27')][_0x2c8f('0x40')]()[_0x2c8f('0x20')](respondWithResult(_0x573bfa,null))['catch'](handleError(_0x573bfa,null));};exports[_0x2c8f('0x41')]=function(_0x2b7f75,_0x16917d){if(_0x2b7f75[_0x2c8f('0x3f')][_0x2c8f('0x42')]){delete _0x2b7f75[_0x2c8f('0x3f')][_0x2c8f('0x42')];}return db[_0x2c8f('0x27')][_0x2c8f('0x43')]({'where':{'uniqueid':_0x2b7f75['params']['id']}})[_0x2c8f('0x20')](handleEntityNotFound(_0x16917d,null))[_0x2c8f('0x20')](saveUpdates(_0x2b7f75['body'],null))[_0x2c8f('0x20')](respondWithResult(_0x16917d,null))['catch'](handleError(_0x16917d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4275fd2..c43dff8 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 _0x5d59=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x15b035,_0xbd4029){var _0xe561b4=function(_0xac0b72){while(--_0xac0b72){_0x15b035['push'](_0x15b035['shift']());}};_0xe561b4(++_0xbd4029);}(_0x5d59,0x15f));var _0x95d5=function(_0x20a8ea,_0x3937d8){_0x20a8ea=_0x20a8ea-0x0;var _0x4df51b=_0x5d59[_0x20a8ea];return _0x4df51b;};'use strict';var _=require('lodash');var util=require(_0x95d5('0x0'));var logger=require(_0x95d5('0x1'))(_0x95d5('0x2'));var moment=require(_0x95d5('0x3'));var BPromise=require(_0x95d5('0x4'));var rp=require(_0x95d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95d5('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x95d5('0x7')]=function(_0x4a733e,_0x4b4e5f){return _0x4a733e[_0x95d5('0x8')](_0x95d5('0x9'),attributes,{'tableName':_0x95d5('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x95d5('0xb')]},{'name':'uniqueid','fields':[_0x95d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ab=['endtime','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history'];(function(_0x58176b,_0x1b4a62){var _0x2a89cd=function(_0x28e7ea){while(--_0x28e7ea){_0x58176b['push'](_0x58176b['shift']());}};_0x2a89cd(++_0x1b4a62);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x2e9a86,_0x3a9b1e){_0x2e9a86=_0x2e9a86-0x0;var _0x56cb69=_0xe2ab[_0x2e9a86];return _0x56cb69;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var logger=require(_0xbe2a('0x2'))(_0xbe2a('0x3'));var moment=require(_0xbe2a('0x4'));var BPromise=require(_0xbe2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe2a('0x6'));var rimraf=require(_0xbe2a('0x7'));var config=require(_0xbe2a('0x8'));var attributes=require(_0xbe2a('0x9'));module['exports']=function(_0x2023d3,_0x521365){return _0x2023d3[_0xbe2a('0xa')]('CmHopperHistory',attributes,{'tableName':_0xbe2a('0xb'),'paranoid':![],'indexes':[{'name':_0xbe2a('0xc'),'fields':[_0xbe2a('0xc')]},{'name':'uniqueid','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 8386b84..149e63a 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 _0x8ad0=['CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','options','raw','debug','catch','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20e811,_0x3232c8){var _0x2c06e0=function(_0x54f56c){while(--_0x54f56c){_0x20e811['push'](_0x20e811['shift']());}};_0x2c06e0(++_0x3232c8);}(_0x8ad0,0xfa));var _0x08ad=function(_0x12b002,_0x49420b){_0x12b002=_0x12b002-0x0;var _0x576eb6=_0x8ad0[_0x12b002];return _0x576eb6;};'use strict';var _=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var moment=require(_0x08ad('0x2'));var BPromise=require(_0x08ad('0x3'));var rs=require(_0x08ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ad('0x5'))['db'];var utils=require(_0x08ad('0x6'));var logger=require(_0x08ad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08ad('0x8')][_0x08ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c900,_0x5ca4f7,_0x337f42){return new BPromise(function(_0x376b72,_0x5c9d8d){return client['request'](_0x49c900,_0x337f42)[_0x08ad('0xa')](function(_0x121817){logger[_0x08ad('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x08ad('0xc'));logger['debug'](_0x08ad('0xd'),_0x5ca4f7,_0x08ad('0xc'),JSON[_0x08ad('0xe')](_0x121817));if(_0x121817[_0x08ad('0xf')]){if(_0x121817[_0x08ad('0xf')][_0x08ad('0x10')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x121817[_0x08ad('0xf')]['message']);return _0x5c9d8d(_0x121817[_0x08ad('0xf')][_0x08ad('0x11')]);}logger[_0x08ad('0xf')](_0x08ad('0x12'),_0x5ca4f7,_0x121817[_0x08ad('0xf')][_0x08ad('0x11')]);return _0x376b72(_0x121817['error'][_0x08ad('0x11')]);}else{logger['info'](_0x08ad('0x12'),_0x5ca4f7,_0x08ad('0xc'));_0x376b72(_0x121817[_0x08ad('0x13')][_0x08ad('0x11')]);}})['catch'](function(_0x5dc038){logger[_0x08ad('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x5dc038);_0x5c9d8d(_0x5dc038);});});}exports[_0x08ad('0x14')]=function(_0x70dedd){var _0x394cb9=this;return new Promise(function(_0x56ed72,_0x4b5294){return db[_0x08ad('0x15')]['create'](_0x70dedd['body'],{'raw':_0x70dedd[_0x08ad('0x16')]?_0x70dedd[_0x08ad('0x16')][_0x08ad('0x17')]===undefined?!![]:![]:!![]})[_0x08ad('0xa')](function(_0x5255fd){logger['info'](_0x08ad('0x14'),_0x70dedd);logger[_0x08ad('0x18')](_0x08ad('0x14'),_0x70dedd,JSON['stringify'](_0x5255fd));_0x56ed72(_0x5255fd);})[_0x08ad('0x19')](function(_0x58d3b6){logger[_0x08ad('0xf')](_0x08ad('0x14'),_0x58d3b6[_0x08ad('0x11')],_0x70dedd);_0x4b5294(_0x394cb9[_0x08ad('0xf')](0x1f4,_0x58d3b6[_0x08ad('0x11')]));});});};exports['AvgHandleTime']=function(_0x6fbc8f){var _0xe08aac=this;return new Promise(function(_0x44af86,_0x55444f){return db[_0x08ad('0x15')][_0x08ad('0x1a')]({'raw':_0x6fbc8f[_0x08ad('0x16')]?_0x6fbc8f[_0x08ad('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6fbc8f['options']?_0x6fbc8f[_0x08ad('0x16')]['where']||null:null,'attributes':[[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize'][_0x08ad('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x20')))),_0x08ad('0x21')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x08ad('0x1b')]['fn']('AVG',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x08ad('0x22')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x23'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x24')))),_0x08ad('0x25')]]})['then'](function(_0x11a47d){logger['info'](_0x08ad('0x26'),_0x6fbc8f);logger[_0x08ad('0x18')](_0x08ad('0x26'),_0x6fbc8f,JSON[_0x08ad('0xe')](_0x11a47d));_0x44af86(_0x11a47d);})[_0x08ad('0x19')](function(_0x6cfae7){logger['error'](_0x08ad('0x26'),_0x6cfae7[_0x08ad('0x11')],_0x6fbc8f);_0x55444f(_0xe08aac['error'](0x1f4,_0x6cfae7[_0x08ad('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x486538){var _0x196f78=this;return new Promise(function(_0xbc46f2,_0x3b69ee){return db[_0x08ad('0x15')][_0x08ad('0x1a')]({'raw':_0x486538['options']?_0x486538[_0x08ad('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x486538[_0x08ad('0x16')]?_0x486538['options'][_0x08ad('0x27')]||null:null,'attributes':[[_0x08ad('0x28'),_0x08ad('0x29')],[db['sequelize']['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x2a')))),_0x08ad('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')](_0x08ad('0x2c')))),_0x08ad('0x2d')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x2e')))),_0x08ad('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x30')))),'outboundCongestionCallsDay'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x31')))),_0x08ad('0x32')],[db['sequelize']['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x08ad('0x33')))),_0x08ad('0x34')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x35')))),_0x08ad('0x36')],[db[_0x08ad('0x1b')]['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x37')))),_0x08ad('0x38')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x39')))),_0x08ad('0x3a')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x08ad('0x3b')],[db[_0x08ad('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x08ad('0x1e')](_0x08ad('0x3c')))),_0x08ad('0x3d')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x08ad('0x3e')))),_0x08ad('0x3b')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x08ad('0x28')]})[_0x08ad('0xa')](function(_0x129217){logger[_0x08ad('0xb')](_0x08ad('0x3f'),_0x486538);logger[_0x08ad('0x18')](_0x08ad('0x3f'),_0x486538,JSON[_0x08ad('0xe')](_0x129217));_0xbc46f2(_0x129217);})[_0x08ad('0x19')](function(_0x4b4333){logger[_0x08ad('0xf')]('GetVoiceQueueHopperHistory',_0x4b4333[_0x08ad('0x11')],_0x486538);_0x3b69ee(_0x196f78['error'](0x1f4,_0x4b4333[_0x08ad('0x11')]));});});};exports[_0x08ad('0x40')]=function(_0x201f49){var _0x4e04a0=this;return new Promise(function(_0x350010,_0x57729b){return db['CmHopperHistory'][_0x08ad('0x1a')]({'raw':_0x201f49['options']?_0x201f49['options']['raw']===undefined?!![]:![]:!![],'where':_0x201f49['options']?_0x201f49[_0x08ad('0x16')][_0x08ad('0x27')]||null:null,'attributes':[[_0x08ad('0x28'),_0x08ad('0x29')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['col']('id')),_0x08ad('0x41')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x1f')))),_0x08ad('0x42')]],'group':[_0x08ad('0x28')]})[_0x08ad('0xa')](function(_0x211dc8){logger['info'](_0x08ad('0x40'),_0x201f49);logger[_0x08ad('0x18')](_0x08ad('0x40'),_0x201f49,JSON[_0x08ad('0xe')](_0x211dc8));_0x350010(_0x211dc8);})[_0x08ad('0x19')](function(_0x28a2ec){logger['error'](_0x08ad('0x40'),_0x28a2ec['message'],_0x201f49);_0x57729b(_0x4e04a0[_0x08ad('0xf')](0x1f4,_0x28a2ec[_0x08ad('0x11')]));});});}; \ No newline at end of file +var _0x82b0=['stringify','code','error','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','sequelize','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','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','col','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x82b0,0x81));var _0x082b=function(_0x26bbd1,_0xb274f3){_0x26bbd1=_0x26bbd1-0x0;var _0x26b1eb=_0x82b0[_0x26bbd1];return _0x26b1eb;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require('bluebird');var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require('../../config/logger')(_0x082b('0x7'));var config=require(_0x082b('0x8'));var jayson=require(_0x082b('0x9'));var client=jayson[_0x082b('0xa')][_0x082b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e8485,_0x16b989,_0x3b9c2a){return new BPromise(function(_0x339585,_0x3ff037){return client[_0x082b('0xc')](_0x5e8485,_0x3b9c2a)[_0x082b('0xd')](function(_0xa65fdf){logger[_0x082b('0xe')](_0x082b('0xf'),_0x16b989,_0x082b('0x10'));logger[_0x082b('0x11')](_0x082b('0x12'),_0x16b989,_0x082b('0x10'),JSON[_0x082b('0x13')](_0xa65fdf));if(_0xa65fdf['error']){if(_0xa65fdf['error'][_0x082b('0x14')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x16b989,_0xa65fdf[_0x082b('0x15')][_0x082b('0x16')]);return _0x3ff037(_0xa65fdf['error'][_0x082b('0x16')]);}logger[_0x082b('0x15')](_0x082b('0xf'),_0x16b989,_0xa65fdf[_0x082b('0x15')][_0x082b('0x16')]);return _0x339585(_0xa65fdf['error'][_0x082b('0x16')]);}else{logger[_0x082b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x16b989,_0x082b('0x10'));_0x339585(_0xa65fdf['result'][_0x082b('0x16')]);}})[_0x082b('0x17')](function(_0x4e5791){logger[_0x082b('0x15')](_0x082b('0xf'),_0x16b989,_0x4e5791);_0x3ff037(_0x4e5791);});});}exports[_0x082b('0x18')]=function(_0x3aa0ed){var _0x4adfc6=this;return new Promise(function(_0x2772e9,_0x2d5cbc){return db[_0x082b('0x19')][_0x082b('0x1a')](_0x3aa0ed[_0x082b('0x1b')],{'raw':_0x3aa0ed[_0x082b('0x1c')]?_0x3aa0ed[_0x082b('0x1c')][_0x082b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x9faf2){logger[_0x082b('0xe')](_0x082b('0x18'),_0x3aa0ed);logger['debug'](_0x082b('0x18'),_0x3aa0ed,JSON[_0x082b('0x13')](_0x9faf2));_0x2772e9(_0x9faf2);})[_0x082b('0x17')](function(_0x56fbd2){logger['error'](_0x082b('0x18'),_0x56fbd2['message'],_0x3aa0ed);_0x2d5cbc(_0x4adfc6['error'](0x1f4,_0x56fbd2[_0x082b('0x16')]));});});};exports[_0x082b('0x1e')]=function(_0x271340){var _0x376d0a=this;return new Promise(function(_0x186613,_0x4ed723){return db[_0x082b('0x19')][_0x082b('0x1f')]({'raw':_0x271340[_0x082b('0x1c')]?_0x271340[_0x082b('0x1c')][_0x082b('0x1d')]===undefined?!![]:![]:!![],'where':_0x271340[_0x082b('0x1c')]?_0x271340[_0x082b('0x1c')]['where']||null:null,'attributes':[[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')]['col']('id')),_0x082b('0x21')],[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')]['fn']('IF',db['sequelize'][_0x082b('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x082b('0x23')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x25')))),_0x082b('0x26')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')]['literal'](_0x082b('0x27')))),_0x082b('0x28')],[db[_0x082b('0x20')]['fn'](_0x082b('0x29'),db[_0x082b('0x20')]['fn']('IF',db['sequelize']['literal'](_0x082b('0x2a')))),_0x082b('0x2b')],[db['sequelize']['fn'](_0x082b('0x29'),db[_0x082b('0x20')]['fn']('IF',db['sequelize'][_0x082b('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x082b('0x2c')]]})[_0x082b('0xd')](function(_0x55e89e){logger[_0x082b('0xe')](_0x082b('0x1e'),_0x271340);logger[_0x082b('0x11')](_0x082b('0x1e'),_0x271340,JSON[_0x082b('0x13')](_0x55e89e));_0x186613(_0x55e89e);})['catch'](function(_0x42146a){logger['error'](_0x082b('0x1e'),_0x42146a[_0x082b('0x16')],_0x271340);_0x4ed723(_0x376d0a[_0x082b('0x15')](0x1f4,_0x42146a[_0x082b('0x16')]));});});};exports[_0x082b('0x2d')]=function(_0x122077){var _0x6bf96c=this;return new Promise(function(_0x133805,_0x56f15c){return db[_0x082b('0x19')][_0x082b('0x1f')]({'raw':_0x122077['options']?_0x122077[_0x082b('0x1c')][_0x082b('0x1d')]===undefined?!![]:![]:!![],'where':_0x122077[_0x082b('0x1c')]?_0x122077[_0x082b('0x1c')][_0x082b('0x2e')]||null:null,'attributes':[[_0x082b('0x2f'),_0x082b('0x30')],[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x31')))),'outboundNoSuchCallsDay'],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x082b('0x32')],[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')]['literal'](_0x082b('0x33')))),_0x082b('0x34')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x35')))),_0x082b('0x36')],[db['sequelize']['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')]('`state`\x20=\x208,\x201,\x20null'))),_0x082b('0x37')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db['sequelize']['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x38')))),_0x082b('0x39')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db['sequelize']['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x3a')))),_0x082b('0x3b')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')]['literal'](_0x082b('0x3c')))),_0x082b('0x3d')],[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')]['literal'](_0x082b('0x3e')))),'outboundBlacklistCallsDay'],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db['sequelize'][_0x082b('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x082b('0x3f')],[db['sequelize']['fn'](_0x082b('0x24'),db['sequelize']['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x40')))),_0x082b('0x41')],[db[_0x082b('0x20')]['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db['sequelize'][_0x082b('0x22')](_0x082b('0x42')))),_0x082b('0x43')],[db['sequelize']['fn'](_0x082b('0x24'),db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x44')))),_0x082b('0x41')],[db[_0x082b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x082b('0x20')]['literal'](_0x082b('0x45')))),_0x082b('0x46')]],'group':[_0x082b('0x2f')]})['then'](function(_0x4a48f8){logger['info']('GetVoiceQueueHopperHistory',_0x122077);logger[_0x082b('0x11')](_0x082b('0x2d'),_0x122077,JSON['stringify'](_0x4a48f8));_0x133805(_0x4a48f8);})[_0x082b('0x17')](function(_0x35ffad){logger[_0x082b('0x15')](_0x082b('0x2d'),_0x35ffad['message'],_0x122077);_0x56f15c(_0x6bf96c[_0x082b('0x15')](0x1f4,_0x35ffad[_0x082b('0x16')]));});});};exports[_0x082b('0x47')]=function(_0x4381ea){var _0x1f2a57=this;return new Promise(function(_0x4a5f3e,_0x3f3e97){return db[_0x082b('0x19')]['findAll']({'raw':_0x4381ea[_0x082b('0x1c')]?_0x4381ea[_0x082b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4381ea[_0x082b('0x1c')]?_0x4381ea['options'][_0x082b('0x2e')]||null:null,'attributes':[[_0x082b('0x2f'),'name'],[db[_0x082b('0x20')]['fn']('COUNT',db[_0x082b('0x20')][_0x082b('0x48')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x082b('0x20')]['fn']('IF',db[_0x082b('0x20')][_0x082b('0x22')](_0x082b('0x33')))),_0x082b('0x49')]],'group':[_0x082b('0x2f')]})[_0x082b('0xd')](function(_0x454e18){logger['info'](_0x082b('0x47'),_0x4381ea);logger[_0x082b('0x11')]('GetCampaignHopperHistory',_0x4381ea,JSON[_0x082b('0x13')](_0x454e18));_0x4a5f3e(_0x454e18);})[_0x082b('0x17')](function(_0x38d3f9){logger[_0x082b('0x15')](_0x082b('0x47'),_0x38d3f9[_0x082b('0x16')],_0x4381ea);_0x3f3e97(_0x1f2a57[_0x082b('0x15')](0x1f4,_0x38d3f9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8c4b8da..26f1a41 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 _0x217d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','describe','show','post','create','put','/:id','exports','multer','path'];(function(_0x490baa,_0x362800){var _0xb862d4=function(_0x5c8443){while(--_0x5c8443){_0x490baa['push'](_0x490baa['shift']());}};_0xb862d4(++_0x362800);}(_0x217d,0x1e4));var _0xd217=function(_0x4d35d6,_0x4f3c5e){_0x4d35d6=_0x4d35d6-0x0;var _0x308a20=_0x217d[_0x4d35d6];return _0x308a20;};'use strict';var multer=require(_0xd217('0x0'));var util=require('util');var path=require(_0xd217('0x1'));var timeout=require(_0xd217('0x2'));var express=require(_0xd217('0x3'));var router=express[_0xd217('0x4')]();var fs_extra=require(_0xd217('0x5'));var auth=require(_0xd217('0x6'));var interaction=require(_0xd217('0x7'));var config=require('../../config/environment');var controller=require(_0xd217('0x8'));router[_0xd217('0x9')]('/',auth[_0xd217('0xa')](),controller['index']);router['get']('/describe',auth[_0xd217('0xa')](),controller[_0xd217('0xb')]);router['get']('/:id',auth[_0xd217('0xa')](),controller[_0xd217('0xc')]);router[_0xd217('0xd')]('/',auth[_0xd217('0xa')](),controller[_0xd217('0xe')]);router[_0xd217('0xf')](_0xd217('0x10'),auth[_0xd217('0xa')](),controller['update']);module[_0xd217('0x11')]=router; \ No newline at end of file +var _0xe226=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','/:id','show','create','put','update','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe226,0x1ea));var _0x6e22=function(_0x3a0c12,_0x2d1eab){_0x3a0c12=_0x3a0c12-0x0;var _0x346288=_0xe226[_0x3a0c12];return _0x346288;};'use strict';var multer=require(_0x6e22('0x0'));var util=require(_0x6e22('0x1'));var path=require(_0x6e22('0x2'));var timeout=require(_0x6e22('0x3'));var express=require(_0x6e22('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e22('0x5'));var config=require(_0x6e22('0x6'));var controller=require(_0x6e22('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6e22('0x8')]('/describe',auth[_0x6e22('0x9')](),controller[_0x6e22('0xa')]);router[_0x6e22('0x8')](_0x6e22('0xb'),auth['isAuthenticated'](),controller[_0x6e22('0xc')]);router['post']('/',auth[_0x6e22('0x9')](),controller[_0x6e22('0xd')]);router[_0x6e22('0xe')](_0x6e22('0xb'),auth['isAuthenticated'](),controller[_0x6e22('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3a24258..3f13ef5 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 _0x6aa7=['name','sequelize','STRING'];(function(_0xea1c2,_0x494d1f){var _0x38b14a=function(_0x4e2f21){while(--_0x4e2f21){_0xea1c2['push'](_0xea1c2['shift']());}};_0x38b14a(++_0x494d1f);}(_0x6aa7,0x178));var _0x76aa=function(_0x355530,_0x2d6f05){_0x355530=_0x355530-0x0;var _0x457d07=_0x6aa7[_0x355530];return _0x457d07;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'unique':_0x76aa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x76aa('0x1')]},'dialPrefix':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0x624c=['STRING','name','exports'];(function(_0x5ad51e,_0x49e366){var _0x570c6e=function(_0x2f6f20){while(--_0x2f6f20){_0x5ad51e['push'](_0x5ad51e['shift']());}};_0x570c6e(++_0x49e366);}(_0x624c,0x1ee));var _0xc624=function(_0x233ba9,_0x581b20){_0x233ba9=_0x233ba9-0x0;var _0x3704da=_0x624c[_0x233ba9];return _0x3704da;};'use strict';var Sequelize=require('sequelize');module[_0xc624('0x0')]={'name':{'type':Sequelize[_0xc624('0x1')],'unique':_0xc624('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc624('0x1')]},'dialPrefix':{'type':Sequelize[_0xc624('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8737c9f..eee5fa5 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 _0x2dd4=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','CmList','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ListId','getDispositions','Disposition','pick','findAll','removeDispositions','ids','CmContact','tags','join','isArray','push','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','order','raw','getContactsCsv','CmCustomField','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','findOne','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./cmList.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','rawAttributes','type','key'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x2dd4,0x173));var _0x42dd=function(_0x23b979,_0x1c3b9e){_0x23b979=_0x23b979-0x0;var _0x48e58d=_0x2dd4[_0x23b979];return _0x48e58d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42dd('0x0'));var rp=require(_0x42dd('0x1'));var moment=require(_0x42dd('0x2'));var BPromise=require(_0x42dd('0x3'));var Mustache=require(_0x42dd('0x4'));var util=require(_0x42dd('0x5'));var path=require(_0x42dd('0x6'));var sox=require(_0x42dd('0x7'));var csv=require(_0x42dd('0x8'));var ejs=require(_0x42dd('0x9'));var fs=require('fs');var fs_extra=require(_0x42dd('0xa'));var _=require(_0x42dd('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42dd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x42dd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x42dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42dd('0xf'));var logger=require('../../config/logger')(_0x42dd('0x10'));var utils=require(_0x42dd('0x11'));var config=require(_0x42dd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x42dd('0x13'))['db'];config['redis']=_[_0x42dd('0x14')](config[_0x42dd('0x15')],{'host':_0x42dd('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42dd('0x15')]));require(_0x42dd('0x17'))['register'](socket);function respondWithStatusCode(_0x5b5136,_0x1c4aed){_0x1c4aed=_0x1c4aed||0xcc;return function(_0x22adbe){if(_0x22adbe){return _0x5b5136[_0x42dd('0x18')](_0x1c4aed);}return _0x5b5136['status'](_0x1c4aed)[_0x42dd('0x19')]();};}function respondWithResult(_0x260b93,_0x267c6b){_0x267c6b=_0x267c6b||0xc8;return function(_0x162181){if(_0x162181){return _0x260b93[_0x42dd('0x1a')](_0x267c6b)['json'](_0x162181);}};}function respondWithFilteredResult(_0x554b6f,_0x18b8ac){return function(_0x1a45a0){if(_0x1a45a0){var _0x44bc33=typeof _0x18b8ac[_0x42dd('0x1b')]===_0x42dd('0x1c')&&typeof _0x18b8ac[_0x42dd('0x1d')]===_0x42dd('0x1c');var _0xe1ccb2=_0x1a45a0[_0x42dd('0x1e')];var _0x512c12=_0x44bc33?0x0:_0x18b8ac[_0x42dd('0x1b')];var _0x244a2b=_0x44bc33?_0x1a45a0[_0x42dd('0x1e')]:_0x18b8ac[_0x42dd('0x1b')]+_0x18b8ac[_0x42dd('0x1d')];var _0x4f8791;if(_0x244a2b>=_0xe1ccb2){_0x244a2b=_0xe1ccb2;_0x4f8791=0xc8;}else{_0x4f8791=0xce;}_0x554b6f[_0x42dd('0x1a')](_0x4f8791);return _0x554b6f[_0x42dd('0x1f')](_0x42dd('0x20'),_0x512c12+'-'+_0x244a2b+'/'+_0xe1ccb2)[_0x42dd('0x21')](_0x1a45a0);}return null;};}function patchUpdates(_0x384255){return function(_0x7dfc40){try{jsonpatch[_0x42dd('0x22')](_0x7dfc40,_0x384255,!![]);}catch(_0x5369ee){return BPromise[_0x42dd('0x23')](_0x5369ee);}return _0x7dfc40[_0x42dd('0x24')]();};}function saveUpdates(_0x1e023d,_0x3ca6e0){return function(_0x52f1d9){if(_0x52f1d9){return _0x52f1d9[_0x42dd('0x25')](_0x1e023d)[_0x42dd('0x26')](function(_0x4bb2f6){return _0x4bb2f6;});}return null;};}function removeEntity(_0x4c5211,_0x2bb047){return function(_0x39c753){if(_0x39c753){return _0x39c753[_0x42dd('0x27')]()[_0x42dd('0x26')](function(){var _0x5c3200=_0x39c753[_0x42dd('0x28')]({'plain':!![]});var _0x41cdbc='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x41cdbc,'resourceId':_0x5c3200['id']}})[_0x42dd('0x26')](function(){return _0x39c753;});})[_0x42dd('0x26')](function(){_0x4c5211[_0x42dd('0x1a')](0xcc)[_0x42dd('0x19')]();});}};}function handleEntityNotFound(_0x4a764b,_0x5e91a5){return function(_0x13400b){if(!_0x13400b){_0x4a764b['sendStatus'](0x194);}return _0x13400b;};}function handleError(_0x18aea6,_0x49fba2){_0x49fba2=_0x49fba2||0x1f4;return function(_0x4c1f2c){logger[_0x42dd('0x29')](_0x4c1f2c[_0x42dd('0x2a')]);if(_0x4c1f2c[_0x42dd('0x2b')]){delete _0x4c1f2c['name'];}_0x18aea6[_0x42dd('0x1a')](_0x49fba2)['send'](_0x4c1f2c);};}exports[_0x42dd('0x2c')]=function(_0x116634,_0x409a19){var _0x23c819={},_0x125a06={},_0x5259c0={'count':0x0,'rows':[]};var _0x58a4c4=_[_0x42dd('0x2d')](db['CmList'][_0x42dd('0x2e')],function(_0x5040b3){return{'name':_0x5040b3['fieldName'],'type':_0x5040b3[_0x42dd('0x2f')][_0x42dd('0x30')]};});_0x125a06[_0x42dd('0x31')]=_['map'](_0x58a4c4,_0x42dd('0x2b'));_0x125a06[_0x42dd('0x32')]=_['keys'](_0x116634[_0x42dd('0x32')]);_0x125a06[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0x125a06['model'],_0x125a06['query']);_0x23c819['attributes']=_[_0x42dd('0x34')](_0x125a06['model'],qs[_0x42dd('0x35')](_0x116634[_0x42dd('0x32')][_0x42dd('0x35')]));_0x23c819['attributes']=_0x23c819[_0x42dd('0x36')][_0x42dd('0x37')]?_0x23c819[_0x42dd('0x36')]:_0x125a06['model'];if(!_0x116634[_0x42dd('0x32')][_0x42dd('0x38')](_0x42dd('0x39'))){_0x23c819[_0x42dd('0x1d')]=qs[_0x42dd('0x1d')](_0x116634[_0x42dd('0x32')][_0x42dd('0x1d')]);_0x23c819[_0x42dd('0x1b')]=qs[_0x42dd('0x1b')](_0x116634[_0x42dd('0x32')]['offset']);}_0x23c819['order']=qs[_0x42dd('0x3a')](_0x116634['query'][_0x42dd('0x3a')]);_0x23c819['where']=qs['filters'](_['pick'](_0x116634[_0x42dd('0x32')],_0x125a06[_0x42dd('0x33')]),_0x58a4c4);if(_0x116634['query'][_0x42dd('0x3b')]){_0x23c819['where']=_[_0x42dd('0x3c')](_0x23c819[_0x42dd('0x3d')],{'$or':_['map'](_0x58a4c4,function(_0x471412){if(_0x471412[_0x42dd('0x2f')]!==_0x42dd('0x3e')){var _0x2afa41={};_0x2afa41[_0x471412[_0x42dd('0x2b')]]={'$like':'%'+_0x116634['query'][_0x42dd('0x3b')]+'%'};return _0x2afa41;}})});}_0x23c819=_[_0x42dd('0x3c')]({},_0x23c819,_0x116634[_0x42dd('0x3f')]);var _0x104464={'where':_0x23c819[_0x42dd('0x3d')]};return db[_0x42dd('0x40')][_0x42dd('0x1e')](_0x104464)[_0x42dd('0x26')](function(_0x5b3a2f){_0x5259c0[_0x42dd('0x1e')]=_0x5b3a2f;if(_0x116634[_0x42dd('0x32')][_0x42dd('0x41')]){_0x23c819[_0x42dd('0x42')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x23c819);})[_0x42dd('0x26')](function(_0x1d60c4){_0x5259c0[_0x42dd('0x43')]=_0x1d60c4;return _0x5259c0;})[_0x42dd('0x26')](respondWithFilteredResult(_0x409a19,_0x23c819))[_0x42dd('0x44')](handleError(_0x409a19,null));};exports['show']=function(_0x30b9de,_0x33a6c0){var _0x222c9d={'raw':![],'where':{'id':_0x30b9de[_0x42dd('0x45')]['id']}},_0xd0d167={};_0xd0d167['model']=_[_0x42dd('0x46')](db['CmList'][_0x42dd('0x2e')]);_0xd0d167[_0x42dd('0x32')]=_[_0x42dd('0x46')](_0x30b9de[_0x42dd('0x32')]);_0xd0d167[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0xd0d167['model'],_0xd0d167['query']);_0x222c9d[_0x42dd('0x36')]=_[_0x42dd('0x34')](_0xd0d167[_0x42dd('0x31')],qs[_0x42dd('0x35')](_0x30b9de['query']['fields']));_0x222c9d['attributes']=_0x222c9d['attributes'][_0x42dd('0x37')]?_0x222c9d[_0x42dd('0x36')]:_0xd0d167[_0x42dd('0x31')];if(_0x30b9de[_0x42dd('0x32')][_0x42dd('0x41')]){_0x222c9d[_0x42dd('0x42')]=[{'all':!![]}];}_0x222c9d=_[_0x42dd('0x3c')]({},_0x222c9d,_0x30b9de[_0x42dd('0x3f')]);return db['CmList'][_0x42dd('0x47')](_0x222c9d)['then'](handleEntityNotFound(_0x33a6c0,null))['then'](respondWithResult(_0x33a6c0,null))[_0x42dd('0x44')](handleError(_0x33a6c0,null));};exports[_0x42dd('0x48')]=function(_0x6a0fa,_0xfa2c10){return db['CmList'][_0x42dd('0x48')](_0x6a0fa[_0x42dd('0x49')],{})[_0x42dd('0x26')](function(_0x3ef9a0){var _0x1473e4=_0x6a0fa[_0x42dd('0x4a')][_0x42dd('0x28')]({'plain':!![]});if(!_0x1473e4)throw new Error(_0x42dd('0x4b'));if(_0x1473e4[_0x42dd('0x4c')]===_0x42dd('0x4a')){var _0x39e895=_0x3ef9a0['get']({'plain':!![]});var _0x4b65a1=_0x42dd('0x4d');return db[_0x42dd('0x4e')][_0x42dd('0x47')]({'where':{'name':_0x4b65a1,'userProfileId':_0x1473e4[_0x42dd('0x4f')]},'raw':!![]})[_0x42dd('0x26')](function(_0x431481){if(_0x431481&&_0x431481[_0x42dd('0x50')]===0x0){return db[_0x42dd('0x51')]['create']({'name':_0x39e895['name'],'resourceId':_0x39e895['id'],'type':_0x431481[_0x42dd('0x2b')],'sectionId':_0x431481['id']},{})[_0x42dd('0x26')](function(){return _0x3ef9a0;});}else{return _0x3ef9a0;}})[_0x42dd('0x44')](function(_0x200f62){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x200f62);throw _0x200f62;});}return _0x3ef9a0;})['then'](respondWithResult(_0xfa2c10,0xc9))[_0x42dd('0x44')](handleError(_0xfa2c10,null));};exports[_0x42dd('0x25')]=function(_0x48c2f8,_0x5a5cf3){if(_0x48c2f8[_0x42dd('0x49')]['id']){delete _0x48c2f8[_0x42dd('0x49')]['id'];}return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x48c2f8[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x5a5cf3,null))[_0x42dd('0x26')](saveUpdates(_0x48c2f8[_0x42dd('0x49')],null))['then'](respondWithResult(_0x5a5cf3,null))[_0x42dd('0x44')](handleError(_0x5a5cf3,null));};exports['destroy']=function(_0x5f3c0e,_0x272fb7){return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x5f3c0e[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x272fb7,null))[_0x42dd('0x26')](removeEntity(_0x272fb7,null))['catch'](handleError(_0x272fb7,null));};exports[_0x42dd('0x52')]=function(_0x59c871,_0xb13268){return db[_0x42dd('0x40')][_0x42dd('0x52')]()[_0x42dd('0x26')](respondWithResult(_0xb13268,null))['catch'](handleError(_0xb13268,null));};exports[_0x42dd('0x53')]=function(_0x43588a,_0x97ad83,_0x8e836f){if(_0x43588a[_0x42dd('0x49')]['id']){delete _0x43588a[_0x42dd('0x49')]['id'];}return db['CmList']['find']({'where':{'id':_0x43588a[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x97ad83,null))[_0x42dd('0x26')](function(_0x3c14af){if(_0x3c14af){_0x43588a[_0x42dd('0x49')][_0x42dd('0x54')]=_0x3c14af['id'];return db['Disposition']['create'](_0x43588a[_0x42dd('0x49')]);}})[_0x42dd('0x26')](respondWithResult(_0x97ad83,null))[_0x42dd('0x44')](handleError(_0x97ad83,null));};exports[_0x42dd('0x55')]=function(_0x353699,_0x839472,_0x54ddee){var _0x11a643={'raw':![],'where':{}};var _0x1bc795={};var _0x5e176b={'count':0x0,'rows':[]};return db[_0x42dd('0x40')]['findOne']({'where':{'id':_0x353699[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x839472,null))[_0x42dd('0x26')](function(_0x406e34){if(_0x406e34){_0x1bc795[_0x42dd('0x31')]=_[_0x42dd('0x46')](db[_0x42dd('0x56')][_0x42dd('0x2e')]);_0x1bc795['query']=_[_0x42dd('0x46')](_0x353699[_0x42dd('0x32')]);_0x1bc795[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0x1bc795[_0x42dd('0x31')],_0x1bc795[_0x42dd('0x32')]);_0x11a643[_0x42dd('0x36')]=_[_0x42dd('0x34')](_0x1bc795[_0x42dd('0x31')],qs['fields'](_0x353699[_0x42dd('0x32')]['fields']));_0x11a643[_0x42dd('0x36')]=_0x11a643[_0x42dd('0x36')][_0x42dd('0x37')]?_0x11a643[_0x42dd('0x36')]:_0x1bc795[_0x42dd('0x31')];if(!_0x353699[_0x42dd('0x32')][_0x42dd('0x38')](_0x42dd('0x39'))){_0x11a643['limit']=qs[_0x42dd('0x1d')](_0x353699[_0x42dd('0x32')][_0x42dd('0x1d')]);_0x11a643[_0x42dd('0x1b')]=qs[_0x42dd('0x1b')](_0x353699[_0x42dd('0x32')][_0x42dd('0x1b')]);}_0x11a643['order']=qs[_0x42dd('0x3a')](_0x353699['query'][_0x42dd('0x3a')]);_0x11a643[_0x42dd('0x3d')]=qs[_0x42dd('0x33')](_[_0x42dd('0x57')](_0x353699['query'],_0x1bc795[_0x42dd('0x33')]));_0x11a643[_0x42dd('0x3d')][_0x42dd('0x54')]=_0x406e34['id'];if(_0x353699[_0x42dd('0x32')][_0x42dd('0x3b')]){_0x11a643[_0x42dd('0x3d')]=_[_0x42dd('0x3c')](_0x11a643[_0x42dd('0x3d')],{'$or':_[_0x42dd('0x2d')](_0x11a643['attributes'],function(_0x30f5b0){var _0x33d422={};_0x33d422[_0x30f5b0]={'$like':'%'+_0x353699[_0x42dd('0x32')][_0x42dd('0x3b')]+'%'};return _0x33d422;})});}_0x11a643=_[_0x42dd('0x3c')]({},_0x11a643,_0x353699[_0x42dd('0x3f')]);return db['Disposition'][_0x42dd('0x1e')]({'where':_0x11a643[_0x42dd('0x3d')]})[_0x42dd('0x26')](function(_0x12f7e4){_0x5e176b['count']=_0x12f7e4;if(_0x353699['query'][_0x42dd('0x41')]){_0x11a643['include']=[{'all':!![]}];}return db[_0x42dd('0x56')][_0x42dd('0x58')](_0x11a643);})[_0x42dd('0x26')](function(_0x1acb3d){_0x5e176b['rows']=_0x1acb3d;return _0x5e176b;});}})['then'](respondWithFilteredResult(_0x839472,_0x11a643))[_0x42dd('0x44')](handleError(_0x839472,null));};exports[_0x42dd('0x59')]=function(_0x43cec9,_0x18be94,_0x22b1c6){return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x43cec9['params']['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x18be94,null))[_0x42dd('0x26')](function(_0x262d22){if(_0x262d22){return _0x262d22['removeDispositions'](_0x43cec9[_0x42dd('0x32')][_0x42dd('0x5a')]);}})[_0x42dd('0x26')](respondWithStatusCode(_0x18be94,null))[_0x42dd('0x44')](handleError(_0x18be94,null));};exports['addContacts']=function(_0x1868e5,_0x36878f,_0x11e95e){return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x1868e5['params']['id']}})['then'](handleEntityNotFound(_0x36878f,null))[_0x42dd('0x26')](function(_0x4ab2bf){if(_0x4ab2bf){var _0x157cac=[];var _0x1c37c1={'success':[],'errors':[]};return db[_0x42dd('0x5b')][_0x42dd('0x52')]()[_0x42dd('0x26')](function(_0x5e21b5){if(_0x1868e5['body'][_0x42dd('0x5c')]&&_['isArray'](_0x1868e5['body'][_0x42dd('0x5c')])){if(_0x1868e5[_0x42dd('0x49')][_0x42dd('0x5c')][_0x42dd('0x37')]){_0x1868e5[_0x42dd('0x49')][_0x42dd('0x5c')]=_0x1868e5[_0x42dd('0x49')][_0x42dd('0x5c')][_0x42dd('0x5d')](';')+';';}else{_0x1868e5[_0x42dd('0x49')]['tags']=null;}}else{_0x1868e5[_0x42dd('0x49')][_0x42dd('0x5c')]=null;}if(_0x1868e5[_0x42dd('0x49')]&&_[_0x42dd('0x5e')](_0x1868e5[_0x42dd('0x49')])){for(var _0x50b735=0x0;_0x50b735<_0x1868e5['body']['length'];_0x50b735+=0x1){_0x1868e5[_0x42dd('0x49')][_0x50b735][_0x42dd('0x54')]=_0x1868e5[_0x42dd('0x45')]['id'];_0x157cac[_0x42dd('0x5f')](_0x1868e5[_0x42dd('0x49')][_0x50b735]);}return BPromise['each'](_0x157cac,function(_0x28ce00){return db[_0x42dd('0x5b')]['create'](_[_0x42dd('0x60')](_0x28ce00,['ids','id'])||{},{'fields':_['keys'](_0x5e21b5),'raw':!![]})[_0x42dd('0x26')](function(_0x5a2b06){_0x1c37c1['success'][_0x42dd('0x5f')](_0x5a2b06[_0x42dd('0x61')]);})[_0x42dd('0x44')](function(_0x37add5){_0x1c37c1[_0x42dd('0x62')]['push']({'data':_0x28ce00,'error':_0x37add5[_0x42dd('0x63')]});});})[_0x42dd('0x26')](function(_0x1a3110){return _0x1c37c1;})[_0x42dd('0x44')](function(_0xed5b79){return _0xed5b79;});}else{_0x36878f[_0x42dd('0x1a')](0x190)[_0x42dd('0x21')]({'message':_0x42dd('0x64')});}});}})[_0x42dd('0x26')](respondWithResult(_0x36878f,null))[_0x42dd('0x44')](handleError(_0x36878f,null));};exports[_0x42dd('0x65')]=function(_0x4e3426,_0x322db0,_0x77f4d3){var _0x589157;return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x4e3426[_0x42dd('0x45')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x322db0,null))['then'](function(_0x19b3e9){if(_0x19b3e9){_0x589157=_0x19b3e9;return db[_0x42dd('0x5b')][_0x42dd('0x2e')];}})[_0x42dd('0x26')](function(_0x7c8563){if(_0x7c8563){var _0x53ce71={};var _0x4fb603={};_0x4fb603['model']=_[_0x42dd('0x66')](_[_0x42dd('0x46')](_0x7c8563),_[_0x42dd('0x2d')](_0x589157[_0x42dd('0x67')],function(_0x7988da){return util[_0x42dd('0x68')]('cf_%d',_0x7988da['id']);}));_0x4fb603[_0x42dd('0x32')]=_[_0x42dd('0x46')](_0x4e3426[_0x42dd('0x32')]);_0x4fb603[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0x4fb603[_0x42dd('0x31')],_0x4fb603[_0x42dd('0x32')]);_0x53ce71[_0x42dd('0x36')]=_[_0x42dd('0x34')](_0x4fb603[_0x42dd('0x31')],qs[_0x42dd('0x35')](_0x4e3426[_0x42dd('0x32')]['fields']));_0x53ce71[_0x42dd('0x36')]=_0x53ce71[_0x42dd('0x36')][_0x42dd('0x37')]?_0x53ce71[_0x42dd('0x36')]:_0x4fb603[_0x42dd('0x31')];if(!_0x4e3426['query'][_0x42dd('0x38')](_0x42dd('0x39'))){_0x53ce71['limit']=qs['limit'](_0x4e3426[_0x42dd('0x32')]['limit']);_0x53ce71['offset']=qs['offset'](_0x4e3426[_0x42dd('0x32')][_0x42dd('0x1b')]);}_0x53ce71[_0x42dd('0x69')]=qs[_0x42dd('0x3a')](_0x4e3426[_0x42dd('0x32')][_0x42dd('0x3a')]);_0x53ce71['where']=qs['filters'](_['pick'](_0x4e3426[_0x42dd('0x32')],_0x4fb603[_0x42dd('0x33')]));_0x53ce71[_0x42dd('0x6a')]=!![];if(_0x4e3426[_0x42dd('0x32')][_0x42dd('0x3b')]){_0x53ce71[_0x42dd('0x3d')]=_['merge'](_0x53ce71[_0x42dd('0x3d')],{'$or':_[_0x42dd('0x2d')](_0x53ce71['attributes'],function(_0x273d17){var _0x11eb5a={};_0x11eb5a[_0x273d17]={'$like':'%'+_0x4e3426[_0x42dd('0x32')][_0x42dd('0x3b')]+'%'};return _0x11eb5a;})});}_0x53ce71=_[_0x42dd('0x3c')]({},_0x53ce71,_0x4e3426[_0x42dd('0x3f')]);return _0x589157[_0x42dd('0x65')](_0x53ce71);}})[_0x42dd('0x26')](respondWithResult(_0x322db0,null))[_0x42dd('0x44')](handleError(_0x322db0,null));};exports[_0x42dd('0x6b')]=function(_0x1eb1e6,_0x379d5e,_0x24404d){var _0x5986bc;return db[_0x42dd('0x40')]['find']({'where':{'id':_0x1eb1e6[_0x42dd('0x45')]['id']},'include':[{'model':db[_0x42dd('0x6c')],'as':'CustomFields'}]})[_0x42dd('0x26')](handleEntityNotFound(_0x379d5e,null))['then'](function(_0x2a2e2a){if(_0x2a2e2a){_0x5986bc=_0x2a2e2a;return db['CmContact'][_0x42dd('0x2e')];}})[_0x42dd('0x26')](function(_0x45b7ed){if(_0x45b7ed){var _0x322732={};var _0x3cb82c={};_0x3cb82c['model']=_[_0x42dd('0x66')](_[_0x42dd('0x46')](_0x45b7ed),_[_0x42dd('0x2d')](_0x5986bc[_0x42dd('0x67')],function(_0x29352d){return util[_0x42dd('0x68')](_0x42dd('0x6d'),_0x29352d['id']);}));_0x3cb82c[_0x42dd('0x32')]=_[_0x42dd('0x46')](_0x1eb1e6[_0x42dd('0x32')]);_0x3cb82c[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0x3cb82c[_0x42dd('0x31')],_0x3cb82c['query']);_0x322732[_0x42dd('0x36')]=_['intersection'](_0x3cb82c[_0x42dd('0x31')],qs[_0x42dd('0x35')](_0x1eb1e6[_0x42dd('0x32')][_0x42dd('0x35')]));_0x322732[_0x42dd('0x36')]=_0x322732[_0x42dd('0x36')][_0x42dd('0x37')]?_0x322732['attributes']:_0x3cb82c[_0x42dd('0x31')];if(!_0x1eb1e6[_0x42dd('0x32')]['hasOwnProperty'](_0x42dd('0x39'))){_0x322732['limit']=qs[_0x42dd('0x1d')](_0x1eb1e6[_0x42dd('0x32')]['limit']);_0x322732['offset']=qs[_0x42dd('0x1b')](_0x1eb1e6[_0x42dd('0x32')][_0x42dd('0x1b')]);}_0x322732[_0x42dd('0x69')]=qs[_0x42dd('0x3a')](_0x1eb1e6[_0x42dd('0x32')]['sort']);_0x322732[_0x42dd('0x3d')]=qs[_0x42dd('0x33')](_[_0x42dd('0x57')](_0x1eb1e6[_0x42dd('0x32')],_0x3cb82c['filters']));_0x322732[_0x42dd('0x6a')]=!![];if(_0x1eb1e6[_0x42dd('0x32')][_0x42dd('0x3b')]){_0x322732[_0x42dd('0x3d')]=_[_0x42dd('0x3c')](_0x322732['where'],{'$or':_[_0x42dd('0x2d')](_0x322732[_0x42dd('0x36')],function(_0x409090){var _0x43ea47={};_0x43ea47[_0x409090]={'$like':'%'+_0x1eb1e6[_0x42dd('0x32')][_0x42dd('0x3b')]+'%'};return _0x43ea47;})});}_0x322732=_[_0x42dd('0x3c')]({},_0x322732,_0x1eb1e6['options']);return _0x5986bc[_0x42dd('0x65')](_0x322732);}})[_0x42dd('0x26')](function(_0x19fe4d){if(!_[_0x42dd('0x6e')](_0x19fe4d)){var _0x1cd865=toCsv(_0x19fe4d);var _0x538a43=Date[_0x42dd('0x6f')]();fs[_0x42dd('0x70')](util[_0x42dd('0x68')](_0x42dd('0x71'),_0x5986bc['id'],_0x538a43),_0x1cd865);_0x379d5e[_0x42dd('0x72')](_0x42dd('0x73'),_0x42dd('0x74')+util['format']('list_%d_%s.csv',_0x5986bc['id'],_0x538a43));_0x379d5e['setHeader'](_0x42dd('0x75'),_0x42dd('0x76'));return _0x379d5e[_0x42dd('0x77')](util[_0x42dd('0x68')]('/tmp/list_%d_%s.csv',_0x5986bc['id'],_0x538a43));}else{return _0x379d5e[_0x42dd('0x18')](0xcc);}})[_0x42dd('0x44')](handleError(_0x379d5e,null));};exports['addCustomField']=function(_0x109eeb,_0x5b206b,_0x413149){var _0x38d10c;delete _0x109eeb['body']['id'];return db[_0x42dd('0x40')][_0x42dd('0x78')]({'where':{'id':_0x109eeb[_0x42dd('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b206b,null))['then'](function(_0x58d40e){if(_0x58d40e){return db['sequelize'][_0x42dd('0x79')](function(_0x1aeadd){return db[_0x42dd('0x6c')][_0x42dd('0x48')](_0x109eeb[_0x42dd('0x49')],{'transaction':_0x1aeadd})['then'](function(_0x77e57f){_0x38d10c=_0x77e57f;return _0x58d40e[_0x42dd('0x7a')](_0x77e57f,{'transaction':_0x1aeadd});})[_0x42dd('0x26')](function(){var _0x1419cc={'type':db[_0x42dd('0x7b')][_0x42dd('0x7c')],'transaction':_0x1aeadd};switch(_0x109eeb['body']['type']){case _0x42dd('0x7d'):_0x1419cc[_0x42dd('0x2f')]=db[_0x42dd('0x7b')][_0x42dd('0x7c')];break;case _0x42dd('0x7e'):_0x1419cc[_0x42dd('0x2f')]=db[_0x42dd('0x7b')][_0x42dd('0x7f')];break;case'switch':_0x1419cc[_0x42dd('0x2f')]=db[_0x42dd('0x7b')][_0x42dd('0x80')];_0x1419cc['defaultValue']=![];break;default:}return db['sequelize'][_0x42dd('0x81')][_0x42dd('0x82')]('cm_contacts',util[_0x42dd('0x68')]('cf_%s',_0x38d10c['id']),_0x1419cc);})['then'](function(){return _0x38d10c;});});}})[_0x42dd('0x26')](respondWithResult(_0x5b206b,null))[_0x42dd('0x44')](handleError(_0x5b206b,null));};exports['getCustomFields']=function(_0x5cb249,_0x2dc0ad,_0x1d3488){var _0x4892a9={};var _0x346223={};var _0x2059b4;var _0x444431;return db[_0x42dd('0x40')][_0x42dd('0x78')]({'where':{'id':_0x5cb249[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x2dc0ad,null))['then'](function(_0xd3d829){if(_0xd3d829){_0x2059b4=_0xd3d829;_0x346223[_0x42dd('0x31')]=_[_0x42dd('0x46')](db[_0x42dd('0x6c')]['rawAttributes']);_0x346223[_0x42dd('0x32')]=_['keys'](_0x5cb249[_0x42dd('0x32')]);_0x346223[_0x42dd('0x33')]=_['intersection'](_0x346223[_0x42dd('0x31')],_0x346223[_0x42dd('0x32')]);_0x4892a9['attributes']=_[_0x42dd('0x34')](_0x346223[_0x42dd('0x31')],qs['fields'](_0x5cb249[_0x42dd('0x32')][_0x42dd('0x35')]));_0x4892a9[_0x42dd('0x36')]=_0x4892a9[_0x42dd('0x36')]['length']?_0x4892a9['attributes']:_0x346223[_0x42dd('0x31')];_0x4892a9[_0x42dd('0x69')]=qs[_0x42dd('0x3a')](_0x5cb249['query']['sort']);_0x4892a9[_0x42dd('0x3d')]=qs[_0x42dd('0x33')](_[_0x42dd('0x57')](_0x5cb249['query'],_0x346223[_0x42dd('0x33')]));_0x4892a9[_0x42dd('0x3d')]=_['merge'](_0x4892a9[_0x42dd('0x3d')],{'$or':[{'ListId':_0xd3d829['id']},{'ListId':null}]});if(_0x5cb249[_0x42dd('0x32')][_0x42dd('0x3b')]){_0x4892a9['where']=_[_0x42dd('0x3c')](_0x4892a9[_0x42dd('0x3d')],{'$or':_[_0x42dd('0x2d')](_0x4892a9[_0x42dd('0x36')],function(_0x4d733f){var _0x3059c1={};_0x3059c1[_0x4d733f]={'$like':'%'+_0x5cb249[_0x42dd('0x32')][_0x42dd('0x3b')]+'%'};return _0x3059c1;})});}_0x4892a9=_[_0x42dd('0x3c')]({},_0x4892a9,_0x5cb249['options']);return db[_0x42dd('0x6c')][_0x42dd('0x83')](_0x4892a9);}})[_0x42dd('0x26')](respondWithResult(_0x2dc0ad,null))[_0x42dd('0x44')](handleError(_0x2dc0ad,null));};exports[_0x42dd('0x84')]=function(_0x3f678c,_0x5d4bc2,_0x379fce){return db['CmList']['find']({'where':{'id':_0x3f678c[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x5d4bc2,null))[_0x42dd('0x26')](function(_0x21027a){if(_0x21027a){return _0x21027a[_0x42dd('0x84')](_0x3f678c[_0x42dd('0x49')]['ids'],_['omit'](_0x3f678c[_0x42dd('0x49')],[_0x42dd('0x5a'),'id'])||{})[_0x42dd('0x85')](function(_0x323eb8){for(var _0x4704da=0x0;_0x4704da<_0x3f678c[_0x42dd('0x49')][_0x42dd('0x5a')][_0x42dd('0x37')];_0x4704da+=0x1){socket['emit'](_0x42dd('0x86'),{'UserId':Number(_0x3f678c[_0x42dd('0x49')]['ids'][_0x4704da]),'CmListId':Number(_0x3f678c[_0x42dd('0x45')]['id'])});}return _0x323eb8;});}})[_0x42dd('0x26')](respondWithResult(_0x5d4bc2,null))[_0x42dd('0x44')](handleError(_0x5d4bc2,null));};exports[_0x42dd('0x87')]=function(_0x112a62,_0x3830da,_0x2b56cb){return db[_0x42dd('0x40')][_0x42dd('0x47')]({'where':{'id':_0x112a62[_0x42dd('0x45')]['id']}})['then'](handleEntityNotFound(_0x3830da,null))[_0x42dd('0x26')](function(_0x201276){if(_0x201276){return _0x201276[_0x42dd('0x87')](_0x112a62[_0x42dd('0x32')]['ids'])[_0x42dd('0x26')](function(){if(_[_0x42dd('0x5e')](_0x112a62[_0x42dd('0x32')]['ids'])){for(var _0x396d03=0x0;_0x396d03<_0x112a62[_0x42dd('0x32')]['ids'][_0x42dd('0x37')];_0x396d03+=0x1){socket[_0x42dd('0x88')](_0x42dd('0x89'),{'UserId':Number(_0x112a62['query']['ids'][_0x396d03]),'CmListId':Number(_0x112a62[_0x42dd('0x45')]['id'])});}}else{socket[_0x42dd('0x88')]('userCmList:remove',{'UserId':Number(_0x112a62[_0x42dd('0x32')]['ids']),'CmListId':Number(_0x112a62['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3830da,null))[_0x42dd('0x44')](handleError(_0x3830da,null));};exports[_0x42dd('0x8a')]=function(_0x11bd2d,_0x3032d9,_0x28cfbb){var _0x5e869b={};var _0x5d286b={};var _0x24d76b;var _0xc938ef;return db['CmList'][_0x42dd('0x78')]({'where':{'id':_0x11bd2d[_0x42dd('0x45')]['id']}})[_0x42dd('0x26')](handleEntityNotFound(_0x3032d9,null))[_0x42dd('0x26')](function(_0x2aed25){if(_0x2aed25){_0x24d76b=_0x2aed25;_0x5d286b[_0x42dd('0x31')]=_['keys'](db[_0x42dd('0x8b')][_0x42dd('0x2e')]);_0x5d286b[_0x42dd('0x32')]=_[_0x42dd('0x46')](_0x11bd2d['query']);_0x5d286b[_0x42dd('0x33')]=_[_0x42dd('0x34')](_0x5d286b[_0x42dd('0x31')],_0x5d286b[_0x42dd('0x32')]);_0x5e869b[_0x42dd('0x36')]=_[_0x42dd('0x34')](_0x5d286b['model'],qs['fields'](_0x11bd2d[_0x42dd('0x32')]['fields']));_0x5e869b['attributes']=_0x5e869b[_0x42dd('0x36')][_0x42dd('0x37')]?_0x5e869b[_0x42dd('0x36')]:_0x5d286b[_0x42dd('0x31')];_0x5e869b[_0x42dd('0x69')]=qs['sort'](_0x11bd2d[_0x42dd('0x32')]['sort']);_0x5e869b[_0x42dd('0x3d')]=qs['filters'](_[_0x42dd('0x57')](_0x11bd2d[_0x42dd('0x32')],_0x5d286b[_0x42dd('0x33')]));if(_0x11bd2d['query']['filter']){_0x5e869b['where']=_[_0x42dd('0x3c')](_0x5e869b[_0x42dd('0x3d')],{'$or':_[_0x42dd('0x2d')](_0x5e869b[_0x42dd('0x36')],function(_0x206afb){var _0x1c87a2={};_0x1c87a2[_0x206afb]={'$like':'%'+_0x11bd2d[_0x42dd('0x32')][_0x42dd('0x3b')]+'%'};return _0x1c87a2;})});}_0x5e869b=_['merge']({},_0x5e869b,_0x11bd2d[_0x42dd('0x3f')]);return _0x24d76b['getAgents'](_0x5e869b);}})['then'](function(_0x16ec4e){if(_0x16ec4e){_0xc938ef=_0x16ec4e[_0x42dd('0x37')];if(!_0x11bd2d['query'][_0x42dd('0x38')](_0x42dd('0x39'))){_0x5e869b[_0x42dd('0x1d')]=qs[_0x42dd('0x1d')](_0x11bd2d[_0x42dd('0x32')][_0x42dd('0x1d')]);_0x5e869b[_0x42dd('0x1b')]=qs['offset'](_0x11bd2d[_0x42dd('0x32')][_0x42dd('0x1b')]);}return _0x24d76b[_0x42dd('0x8a')](_0x5e869b);}})[_0x42dd('0x26')](function(_0x1fc22b){if(_0x1fc22b){return _0x1fc22b?{'count':_0xc938ef,'rows':_0x1fc22b}:null;}})[_0x42dd('0x26')](respondWithResult(_0x3032d9,null))[_0x42dd('0x44')](handleError(_0x3032d9,null));}; \ No newline at end of file +var _0xf2f6=['offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','fieldName','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','length','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','concat','cf_%d','raw','getContactsCsv','CustomFields','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','type','number','INTEGER','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./cmList.socket','status','json'];(function(_0x4f7790,_0x2da6fc){var _0x465701=function(_0x3bf927){while(--_0x3bf927){_0x4f7790['push'](_0x4f7790['shift']());}};_0x465701(++_0x2da6fc);}(_0xf2f6,0x70));var _0x6f2f=function(_0x2dcb63,_0x41623f){_0x2dcb63=_0x2dcb63-0x0;var _0x73fe8e=_0xf2f6[_0x2dcb63];return _0x73fe8e;};'use strict';var emlformat=require(_0x6f2f('0x0'));var rimraf=require(_0x6f2f('0x1'));var zipdir=require(_0x6f2f('0x2'));var jsonpatch=require(_0x6f2f('0x3'));var rp=require(_0x6f2f('0x4'));var moment=require(_0x6f2f('0x5'));var BPromise=require(_0x6f2f('0x6'));var Mustache=require(_0x6f2f('0x7'));var util=require(_0x6f2f('0x8'));var path=require('path');var sox=require(_0x6f2f('0x9'));var csv=require(_0x6f2f('0xa'));var ejs=require(_0x6f2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f2f('0xc'));var crypto=require(_0x6f2f('0xd'));var jsforce=require(_0x6f2f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f2f('0xa'));var querystring=require(_0x6f2f('0xf'));var Papa=require(_0x6f2f('0x10'));var Redis=require('ioredis');var authService=require(_0x6f2f('0x11'));var qs=require(_0x6f2f('0x12'));var as=require(_0x6f2f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f2f('0x14'))(_0x6f2f('0x15'));var utils=require(_0x6f2f('0x16'));var config=require(_0x6f2f('0x17'));var licenseUtil=require(_0x6f2f('0x18'));var db=require(_0x6f2f('0x19'))['db'];config['redis']=_[_0x6f2f('0x1a')](config[_0x6f2f('0x1b')],{'host':_0x6f2f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f2f('0x1b')]));require(_0x6f2f('0x1d'))['register'](socket);function respondWithStatusCode(_0x69aa6d,_0x47a18d){_0x47a18d=_0x47a18d||0xcc;return function(_0x49c3db){if(_0x49c3db){return _0x69aa6d['sendStatus'](_0x47a18d);}return _0x69aa6d[_0x6f2f('0x1e')](_0x47a18d)['end']();};}function respondWithResult(_0x5db62c,_0x528aee){_0x528aee=_0x528aee||0xc8;return function(_0x45f89a){if(_0x45f89a){return _0x5db62c[_0x6f2f('0x1e')](_0x528aee)[_0x6f2f('0x1f')](_0x45f89a);}};}function respondWithFilteredResult(_0x2e3c0a,_0x292545){return function(_0x4065a6){if(_0x4065a6){var _0x102e9e=typeof _0x292545[_0x6f2f('0x20')]===_0x6f2f('0x21')&&typeof _0x292545['limit']===_0x6f2f('0x21');var _0x3a5f2d=_0x4065a6['count'];var _0x34d9f7=_0x102e9e?0x0:_0x292545[_0x6f2f('0x20')];var _0x4f4d43=_0x102e9e?_0x4065a6[_0x6f2f('0x22')]:_0x292545[_0x6f2f('0x20')]+_0x292545[_0x6f2f('0x23')];var _0xd8aaa6;if(_0x4f4d43>=_0x3a5f2d){_0x4f4d43=_0x3a5f2d;_0xd8aaa6=0xc8;}else{_0xd8aaa6=0xce;}_0x2e3c0a[_0x6f2f('0x1e')](_0xd8aaa6);return _0x2e3c0a[_0x6f2f('0x24')](_0x6f2f('0x25'),_0x34d9f7+'-'+_0x4f4d43+'/'+_0x3a5f2d)[_0x6f2f('0x1f')](_0x4065a6);}return null;};}function patchUpdates(_0x11ede3){return function(_0x1a4a2b){try{jsonpatch['apply'](_0x1a4a2b,_0x11ede3,!![]);}catch(_0x17972d){return BPromise['reject'](_0x17972d);}return _0x1a4a2b[_0x6f2f('0x26')]();};}function saveUpdates(_0x2809d6,_0x4ecaca){return function(_0x26559a){if(_0x26559a){return _0x26559a[_0x6f2f('0x27')](_0x2809d6)[_0x6f2f('0x28')](function(_0x4e4953){return _0x4e4953;});}return null;};}function removeEntity(_0x3df68a,_0x4f7dcf){return function(_0x2de534){if(_0x2de534){return _0x2de534[_0x6f2f('0x29')]()[_0x6f2f('0x28')](function(){var _0x5d1f38=_0x2de534['get']({'plain':!![]});var _0x2c7a86=_0x6f2f('0x2a');return db[_0x6f2f('0x2b')]['destroy']({'where':{'type':_0x2c7a86,'resourceId':_0x5d1f38['id']}})[_0x6f2f('0x28')](function(){return _0x2de534;});})[_0x6f2f('0x28')](function(){_0x3df68a[_0x6f2f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cdb3d,_0x520193){return function(_0x3735f8){if(!_0x3735f8){_0x1cdb3d[_0x6f2f('0x2c')](0x194);}return _0x3735f8;};}function handleError(_0x2c42f6,_0x213172){_0x213172=_0x213172||0x1f4;return function(_0x32460a){logger[_0x6f2f('0x2d')](_0x32460a[_0x6f2f('0x2e')]);if(_0x32460a['name']){delete _0x32460a[_0x6f2f('0x2f')];}_0x2c42f6[_0x6f2f('0x1e')](_0x213172)[_0x6f2f('0x30')](_0x32460a);};}exports[_0x6f2f('0x31')]=function(_0x63820a,_0xfac08){var _0x5c03f9={},_0x2445d0={},_0x5b5898={'count':0x0,'rows':[]};var _0xd736ee=_['map'](db[_0x6f2f('0x32')]['rawAttributes'],function(_0x444520){return{'name':_0x444520[_0x6f2f('0x33')],'type':_0x444520['type'][_0x6f2f('0x34')]};});_0x2445d0[_0x6f2f('0x35')]=_[_0x6f2f('0x36')](_0xd736ee,_0x6f2f('0x2f'));_0x2445d0[_0x6f2f('0x37')]=_['keys'](_0x63820a[_0x6f2f('0x37')]);_0x2445d0['filters']=_['intersection'](_0x2445d0[_0x6f2f('0x35')],_0x2445d0[_0x6f2f('0x37')]);_0x5c03f9['attributes']=_[_0x6f2f('0x38')](_0x2445d0[_0x6f2f('0x35')],qs[_0x6f2f('0x39')](_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x39')]));_0x5c03f9[_0x6f2f('0x3a')]=_0x5c03f9[_0x6f2f('0x3a')]['length']?_0x5c03f9[_0x6f2f('0x3a')]:_0x2445d0['model'];if(!_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x3b')](_0x6f2f('0x3c'))){_0x5c03f9['limit']=qs[_0x6f2f('0x23')](_0x63820a['query']['limit']);_0x5c03f9[_0x6f2f('0x20')]=qs[_0x6f2f('0x20')](_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x20')]);}_0x5c03f9[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x5c03f9[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_[_0x6f2f('0x41')](_0x63820a['query'],_0x2445d0[_0x6f2f('0x40')]),_0xd736ee);if(_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x42')]){_0x5c03f9[_0x6f2f('0x3f')]=_[_0x6f2f('0x43')](_0x5c03f9['where'],{'$or':_[_0x6f2f('0x36')](_0xd736ee,function(_0x422436){if(_0x422436['type']!=='VIRTUAL'){var _0x45802a={};_0x45802a[_0x422436[_0x6f2f('0x2f')]]={'$like':'%'+_0x63820a[_0x6f2f('0x37')][_0x6f2f('0x42')]+'%'};return _0x45802a;}})});}_0x5c03f9=_[_0x6f2f('0x43')]({},_0x5c03f9,_0x63820a[_0x6f2f('0x44')]);var _0x1398c1={'where':_0x5c03f9[_0x6f2f('0x3f')]};return db[_0x6f2f('0x32')][_0x6f2f('0x22')](_0x1398c1)[_0x6f2f('0x28')](function(_0x38eb14){_0x5b5898[_0x6f2f('0x22')]=_0x38eb14;if(_0x63820a['query']['includeAll']){_0x5c03f9[_0x6f2f('0x45')]=[{'all':!![]}];}return db[_0x6f2f('0x32')]['findAll'](_0x5c03f9);})[_0x6f2f('0x28')](function(_0xf5a964){_0x5b5898[_0x6f2f('0x46')]=_0xf5a964;return _0x5b5898;})[_0x6f2f('0x28')](respondWithFilteredResult(_0xfac08,_0x5c03f9))[_0x6f2f('0x47')](handleError(_0xfac08,null));};exports['show']=function(_0xb58185,_0x535956){var _0x63f6b2={'raw':![],'where':{'id':_0xb58185[_0x6f2f('0x48')]['id']}},_0x5ea9ee={};_0x5ea9ee[_0x6f2f('0x35')]=_[_0x6f2f('0x49')](db[_0x6f2f('0x32')][_0x6f2f('0x4a')]);_0x5ea9ee['query']=_[_0x6f2f('0x49')](_0xb58185['query']);_0x5ea9ee[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x5ea9ee[_0x6f2f('0x35')],_0x5ea9ee[_0x6f2f('0x37')]);_0x63f6b2[_0x6f2f('0x3a')]=_['intersection'](_0x5ea9ee[_0x6f2f('0x35')],qs[_0x6f2f('0x39')](_0xb58185[_0x6f2f('0x37')][_0x6f2f('0x39')]));_0x63f6b2[_0x6f2f('0x3a')]=_0x63f6b2[_0x6f2f('0x3a')]['length']?_0x63f6b2[_0x6f2f('0x3a')]:_0x5ea9ee[_0x6f2f('0x35')];if(_0xb58185[_0x6f2f('0x37')][_0x6f2f('0x4b')]){_0x63f6b2[_0x6f2f('0x45')]=[{'all':!![]}];}_0x63f6b2=_[_0x6f2f('0x43')]({},_0x63f6b2,_0xb58185[_0x6f2f('0x44')]);return db['CmList'][_0x6f2f('0x4c')](_0x63f6b2)[_0x6f2f('0x28')](handleEntityNotFound(_0x535956,null))[_0x6f2f('0x28')](respondWithResult(_0x535956,null))[_0x6f2f('0x47')](handleError(_0x535956,null));};exports[_0x6f2f('0x4d')]=function(_0x7b91b6,_0x1da8fb){return db[_0x6f2f('0x32')][_0x6f2f('0x4d')](_0x7b91b6[_0x6f2f('0x4e')],{})['then'](function(_0x270851){var _0x7928ba=_0x7b91b6[_0x6f2f('0x4f')]['get']({'plain':!![]});if(!_0x7928ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7928ba[_0x6f2f('0x50')]===_0x6f2f('0x4f')){var _0x4a4ca7=_0x270851['get']({'plain':!![]});var _0x301712=_0x6f2f('0x2a');return db[_0x6f2f('0x51')][_0x6f2f('0x4c')]({'where':{'name':_0x301712,'userProfileId':_0x7928ba[_0x6f2f('0x52')]},'raw':!![]})[_0x6f2f('0x28')](function(_0x1e2c99){if(_0x1e2c99&&_0x1e2c99[_0x6f2f('0x53')]===0x0){return db[_0x6f2f('0x2b')]['create']({'name':_0x4a4ca7[_0x6f2f('0x2f')],'resourceId':_0x4a4ca7['id'],'type':_0x1e2c99[_0x6f2f('0x2f')],'sectionId':_0x1e2c99['id']},{})[_0x6f2f('0x28')](function(){return _0x270851;});}else{return _0x270851;}})[_0x6f2f('0x47')](function(_0x289d62){logger['error'](_0x6f2f('0x54'),_0x289d62);throw _0x289d62;});}return _0x270851;})['then'](respondWithResult(_0x1da8fb,0xc9))[_0x6f2f('0x47')](handleError(_0x1da8fb,null));};exports['update']=function(_0x20893a,_0x3d7c1f){if(_0x20893a[_0x6f2f('0x4e')]['id']){delete _0x20893a['body']['id'];}return db[_0x6f2f('0x32')][_0x6f2f('0x4c')]({'where':{'id':_0x20893a['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x3d7c1f,null))[_0x6f2f('0x28')](saveUpdates(_0x20893a[_0x6f2f('0x4e')],null))[_0x6f2f('0x28')](respondWithResult(_0x3d7c1f,null))[_0x6f2f('0x47')](handleError(_0x3d7c1f,null));};exports[_0x6f2f('0x29')]=function(_0x406db6,_0x3be029){return db['CmList']['find']({'where':{'id':_0x406db6['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x3be029,null))[_0x6f2f('0x28')](removeEntity(_0x3be029,null))[_0x6f2f('0x47')](handleError(_0x3be029,null));};exports[_0x6f2f('0x55')]=function(_0x38ca96,_0x2045b8){return db['CmList'][_0x6f2f('0x55')]()[_0x6f2f('0x28')](respondWithResult(_0x2045b8,null))[_0x6f2f('0x47')](handleError(_0x2045b8,null));};exports[_0x6f2f('0x56')]=function(_0x5d2a9d,_0x11dccf,_0x272d9a){if(_0x5d2a9d[_0x6f2f('0x4e')]['id']){delete _0x5d2a9d[_0x6f2f('0x4e')]['id'];}return db[_0x6f2f('0x32')][_0x6f2f('0x4c')]({'where':{'id':_0x5d2a9d[_0x6f2f('0x48')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x11dccf,null))['then'](function(_0x1b3f6d){if(_0x1b3f6d){_0x5d2a9d['body'][_0x6f2f('0x57')]=_0x1b3f6d['id'];return db[_0x6f2f('0x58')]['create'](_0x5d2a9d[_0x6f2f('0x4e')]);}})[_0x6f2f('0x28')](respondWithResult(_0x11dccf,null))[_0x6f2f('0x47')](handleError(_0x11dccf,null));};exports[_0x6f2f('0x59')]=function(_0x478b76,_0x741d08,_0x5cb5fb){var _0x1ec141={'raw':![],'where':{}};var _0x1f6d5d={};var _0x1ad393={'count':0x0,'rows':[]};return db['CmList'][_0x6f2f('0x5a')]({'where':{'id':_0x478b76['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x741d08,null))[_0x6f2f('0x28')](function(_0x1a8118){if(_0x1a8118){_0x1f6d5d[_0x6f2f('0x35')]=_[_0x6f2f('0x49')](db[_0x6f2f('0x58')][_0x6f2f('0x4a')]);_0x1f6d5d[_0x6f2f('0x37')]=_[_0x6f2f('0x49')](_0x478b76[_0x6f2f('0x37')]);_0x1f6d5d[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x1f6d5d[_0x6f2f('0x35')],_0x1f6d5d[_0x6f2f('0x37')]);_0x1ec141[_0x6f2f('0x3a')]=_['intersection'](_0x1f6d5d[_0x6f2f('0x35')],qs[_0x6f2f('0x39')](_0x478b76[_0x6f2f('0x37')][_0x6f2f('0x39')]));_0x1ec141[_0x6f2f('0x3a')]=_0x1ec141[_0x6f2f('0x3a')]['length']?_0x1ec141['attributes']:_0x1f6d5d[_0x6f2f('0x35')];if(!_0x478b76[_0x6f2f('0x37')][_0x6f2f('0x3b')](_0x6f2f('0x3c'))){_0x1ec141['limit']=qs[_0x6f2f('0x23')](_0x478b76[_0x6f2f('0x37')]['limit']);_0x1ec141['offset']=qs[_0x6f2f('0x20')](_0x478b76[_0x6f2f('0x37')][_0x6f2f('0x20')]);}_0x1ec141[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x478b76[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x1ec141['where']=qs[_0x6f2f('0x40')](_[_0x6f2f('0x41')](_0x478b76[_0x6f2f('0x37')],_0x1f6d5d[_0x6f2f('0x40')]));_0x1ec141[_0x6f2f('0x3f')][_0x6f2f('0x57')]=_0x1a8118['id'];if(_0x478b76[_0x6f2f('0x37')]['filter']){_0x1ec141['where']=_[_0x6f2f('0x43')](_0x1ec141[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x36')](_0x1ec141[_0x6f2f('0x3a')],function(_0x5e3517){var _0x32bcc8={};_0x32bcc8[_0x5e3517]={'$like':'%'+_0x478b76['query'][_0x6f2f('0x42')]+'%'};return _0x32bcc8;})});}_0x1ec141=_[_0x6f2f('0x43')]({},_0x1ec141,_0x478b76['options']);return db[_0x6f2f('0x58')]['count']({'where':_0x1ec141['where']})[_0x6f2f('0x28')](function(_0x193941){_0x1ad393['count']=_0x193941;if(_0x478b76['query'][_0x6f2f('0x4b')]){_0x1ec141['include']=[{'all':!![]}];}return db[_0x6f2f('0x58')][_0x6f2f('0x5b')](_0x1ec141);})[_0x6f2f('0x28')](function(_0x531663){_0x1ad393[_0x6f2f('0x46')]=_0x531663;return _0x1ad393;});}})[_0x6f2f('0x28')](respondWithFilteredResult(_0x741d08,_0x1ec141))[_0x6f2f('0x47')](handleError(_0x741d08,null));};exports['removeDispositions']=function(_0x2357f1,_0x10f90c,_0x3730a7){return db['CmList'][_0x6f2f('0x4c')]({'where':{'id':_0x2357f1[_0x6f2f('0x48')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x10f90c,null))[_0x6f2f('0x28')](function(_0x6c1462){if(_0x6c1462){return _0x6c1462[_0x6f2f('0x5c')](_0x2357f1['query'][_0x6f2f('0x5d')]);}})['then'](respondWithStatusCode(_0x10f90c,null))[_0x6f2f('0x47')](handleError(_0x10f90c,null));};exports[_0x6f2f('0x5e')]=function(_0x4045cb,_0xbd5f01,_0x2a8866){return db['CmList'][_0x6f2f('0x4c')]({'where':{'id':_0x4045cb[_0x6f2f('0x48')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0xbd5f01,null))[_0x6f2f('0x28')](function(_0x3ac05c){if(_0x3ac05c){var _0x2f2241=[];var _0x24a88f={'success':[],'errors':[]};return db[_0x6f2f('0x5f')][_0x6f2f('0x55')]()[_0x6f2f('0x28')](function(_0x2be192){if(_0x4045cb[_0x6f2f('0x4e')][_0x6f2f('0x60')]&&_[_0x6f2f('0x61')](_0x4045cb[_0x6f2f('0x4e')]['tags'])){if(_0x4045cb[_0x6f2f('0x4e')]['tags'][_0x6f2f('0x62')]){_0x4045cb[_0x6f2f('0x4e')][_0x6f2f('0x60')]=_0x4045cb['body']['tags'][_0x6f2f('0x63')](';')+';';}else{_0x4045cb[_0x6f2f('0x4e')][_0x6f2f('0x60')]=null;}}else{_0x4045cb[_0x6f2f('0x4e')][_0x6f2f('0x60')]=null;}if(_0x4045cb[_0x6f2f('0x4e')]&&_['isArray'](_0x4045cb[_0x6f2f('0x4e')])){for(var _0x5865ca=0x0;_0x5865ca<_0x4045cb[_0x6f2f('0x4e')][_0x6f2f('0x62')];_0x5865ca+=0x1){_0x4045cb[_0x6f2f('0x4e')][_0x5865ca][_0x6f2f('0x57')]=_0x4045cb['params']['id'];_0x2f2241[_0x6f2f('0x64')](_0x4045cb['body'][_0x5865ca]);}return BPromise[_0x6f2f('0x65')](_0x2f2241,function(_0x54bb6a){return db[_0x6f2f('0x5f')][_0x6f2f('0x4d')](_[_0x6f2f('0x66')](_0x54bb6a,['ids','id'])||{},{'fields':_['keys'](_0x2be192),'raw':!![]})[_0x6f2f('0x28')](function(_0x1d85c8){_0x24a88f[_0x6f2f('0x67')][_0x6f2f('0x64')](_0x1d85c8[_0x6f2f('0x68')]);})[_0x6f2f('0x47')](function(_0x5045ee){_0x24a88f[_0x6f2f('0x69')][_0x6f2f('0x64')]({'data':_0x54bb6a,'error':_0x5045ee['message']});});})[_0x6f2f('0x28')](function(_0x14ce38){return _0x24a88f;})['catch'](function(_0x222eba){return _0x222eba;});}else{_0xbd5f01[_0x6f2f('0x1e')](0x190)[_0x6f2f('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6f2f('0x28')](respondWithResult(_0xbd5f01,null))[_0x6f2f('0x47')](handleError(_0xbd5f01,null));};exports[_0x6f2f('0x6a')]=function(_0x17c1be,_0x55acaa,_0xdcf82f){var _0x15b0f9;return db[_0x6f2f('0x32')]['find']({'where':{'id':_0x17c1be[_0x6f2f('0x48')]['id']},'include':[{'model':db[_0x6f2f('0x6b')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x55acaa,null))[_0x6f2f('0x28')](function(_0x3cb010){if(_0x3cb010){_0x15b0f9=_0x3cb010;return db[_0x6f2f('0x5f')]['rawAttributes'];}})[_0x6f2f('0x28')](function(_0x220fc6){if(_0x220fc6){var _0x7d8c7f={};var _0x2d7b30={};_0x2d7b30[_0x6f2f('0x35')]=_[_0x6f2f('0x6c')](_[_0x6f2f('0x49')](_0x220fc6),_[_0x6f2f('0x36')](_0x15b0f9['CustomFields'],function(_0x180a7e){return util['format'](_0x6f2f('0x6d'),_0x180a7e['id']);}));_0x2d7b30[_0x6f2f('0x37')]=_[_0x6f2f('0x49')](_0x17c1be[_0x6f2f('0x37')]);_0x2d7b30[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x2d7b30[_0x6f2f('0x35')],_0x2d7b30['query']);_0x7d8c7f[_0x6f2f('0x3a')]=_[_0x6f2f('0x38')](_0x2d7b30[_0x6f2f('0x35')],qs['fields'](_0x17c1be[_0x6f2f('0x37')][_0x6f2f('0x39')]));_0x7d8c7f[_0x6f2f('0x3a')]=_0x7d8c7f[_0x6f2f('0x3a')]['length']?_0x7d8c7f['attributes']:_0x2d7b30[_0x6f2f('0x35')];if(!_0x17c1be[_0x6f2f('0x37')][_0x6f2f('0x3b')]('nolimit')){_0x7d8c7f[_0x6f2f('0x23')]=qs[_0x6f2f('0x23')](_0x17c1be[_0x6f2f('0x37')]['limit']);_0x7d8c7f[_0x6f2f('0x20')]=qs[_0x6f2f('0x20')](_0x17c1be[_0x6f2f('0x37')]['offset']);}_0x7d8c7f[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x17c1be[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x7d8c7f[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_[_0x6f2f('0x41')](_0x17c1be[_0x6f2f('0x37')],_0x2d7b30['filters']));_0x7d8c7f[_0x6f2f('0x6e')]=!![];if(_0x17c1be[_0x6f2f('0x37')][_0x6f2f('0x42')]){_0x7d8c7f[_0x6f2f('0x3f')]=_[_0x6f2f('0x43')](_0x7d8c7f[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x36')](_0x7d8c7f[_0x6f2f('0x3a')],function(_0x140a00){var _0x45ca17={};_0x45ca17[_0x140a00]={'$like':'%'+_0x17c1be[_0x6f2f('0x37')][_0x6f2f('0x42')]+'%'};return _0x45ca17;})});}_0x7d8c7f=_['merge']({},_0x7d8c7f,_0x17c1be[_0x6f2f('0x44')]);return _0x15b0f9[_0x6f2f('0x6a')](_0x7d8c7f);}})[_0x6f2f('0x28')](respondWithResult(_0x55acaa,null))[_0x6f2f('0x47')](handleError(_0x55acaa,null));};exports[_0x6f2f('0x6f')]=function(_0x4c9385,_0x4c5c81,_0x2d1be8){var _0xd4ec51;return db[_0x6f2f('0x32')][_0x6f2f('0x4c')]({'where':{'id':_0x4c9385['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x6f2f('0x28')](handleEntityNotFound(_0x4c5c81,null))[_0x6f2f('0x28')](function(_0xb41784){if(_0xb41784){_0xd4ec51=_0xb41784;return db[_0x6f2f('0x5f')][_0x6f2f('0x4a')];}})[_0x6f2f('0x28')](function(_0x57542e){if(_0x57542e){var _0x7d8940={};var _0x151c73={};_0x151c73[_0x6f2f('0x35')]=_[_0x6f2f('0x6c')](_[_0x6f2f('0x49')](_0x57542e),_[_0x6f2f('0x36')](_0xd4ec51[_0x6f2f('0x70')],function(_0x4668af){return util['format']('cf_%d',_0x4668af['id']);}));_0x151c73[_0x6f2f('0x37')]=_[_0x6f2f('0x49')](_0x4c9385[_0x6f2f('0x37')]);_0x151c73[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x151c73[_0x6f2f('0x35')],_0x151c73[_0x6f2f('0x37')]);_0x7d8940[_0x6f2f('0x3a')]=_[_0x6f2f('0x38')](_0x151c73['model'],qs[_0x6f2f('0x39')](_0x4c9385[_0x6f2f('0x37')][_0x6f2f('0x39')]));_0x7d8940[_0x6f2f('0x3a')]=_0x7d8940[_0x6f2f('0x3a')][_0x6f2f('0x62')]?_0x7d8940[_0x6f2f('0x3a')]:_0x151c73['model'];if(!_0x4c9385[_0x6f2f('0x37')][_0x6f2f('0x3b')]('nolimit')){_0x7d8940[_0x6f2f('0x23')]=qs[_0x6f2f('0x23')](_0x4c9385[_0x6f2f('0x37')][_0x6f2f('0x23')]);_0x7d8940['offset']=qs[_0x6f2f('0x20')](_0x4c9385['query']['offset']);}_0x7d8940['order']=qs[_0x6f2f('0x3e')](_0x4c9385[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x7d8940[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_[_0x6f2f('0x41')](_0x4c9385[_0x6f2f('0x37')],_0x151c73[_0x6f2f('0x40')]));_0x7d8940['raw']=!![];if(_0x4c9385['query'][_0x6f2f('0x42')]){_0x7d8940[_0x6f2f('0x3f')]=_[_0x6f2f('0x43')](_0x7d8940['where'],{'$or':_['map'](_0x7d8940['attributes'],function(_0x3c67ec){var _0x3350ac={};_0x3350ac[_0x3c67ec]={'$like':'%'+_0x4c9385[_0x6f2f('0x37')][_0x6f2f('0x42')]+'%'};return _0x3350ac;})});}_0x7d8940=_[_0x6f2f('0x43')]({},_0x7d8940,_0x4c9385[_0x6f2f('0x44')]);return _0xd4ec51[_0x6f2f('0x6a')](_0x7d8940);}})['then'](function(_0x29c5a2){if(!_[_0x6f2f('0x71')](_0x29c5a2)){var _0x38b9f2=toCsv(_0x29c5a2);var _0x423d3c=Date[_0x6f2f('0x72')]();fs['writeFileSync'](util['format'](_0x6f2f('0x73'),_0xd4ec51['id'],_0x423d3c),_0x38b9f2);_0x4c5c81[_0x6f2f('0x74')](_0x6f2f('0x75'),_0x6f2f('0x76')+util[_0x6f2f('0x77')](_0x6f2f('0x78'),_0xd4ec51['id'],_0x423d3c));_0x4c5c81[_0x6f2f('0x74')](_0x6f2f('0x79'),_0x6f2f('0x7a'));return _0x4c5c81[_0x6f2f('0x7b')](util[_0x6f2f('0x77')](_0x6f2f('0x73'),_0xd4ec51['id'],_0x423d3c));}else{return _0x4c5c81[_0x6f2f('0x2c')](0xcc);}})[_0x6f2f('0x47')](handleError(_0x4c5c81,null));};exports['addCustomField']=function(_0x14906a,_0x181e89,_0x373000){var _0x462483;delete _0x14906a[_0x6f2f('0x4e')]['id'];return db['CmList'][_0x6f2f('0x5a')]({'where':{'id':_0x14906a[_0x6f2f('0x48')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x181e89,null))[_0x6f2f('0x28')](function(_0x3eaeee){if(_0x3eaeee){return db[_0x6f2f('0x7c')][_0x6f2f('0x7d')](function(_0x1460b4){return db[_0x6f2f('0x6b')][_0x6f2f('0x4d')](_0x14906a[_0x6f2f('0x4e')],{'transaction':_0x1460b4})['then'](function(_0x59d8f2){_0x462483=_0x59d8f2;return _0x3eaeee[_0x6f2f('0x7e')](_0x59d8f2,{'transaction':_0x1460b4});})['then'](function(){var _0x5e7395={'type':db[_0x6f2f('0x7f')]['TEXT'],'transaction':_0x1460b4};switch(_0x14906a[_0x6f2f('0x4e')]['type']){case'text':_0x5e7395[_0x6f2f('0x80')]=db[_0x6f2f('0x7f')]['TEXT'];break;case _0x6f2f('0x81'):_0x5e7395[_0x6f2f('0x80')]=db[_0x6f2f('0x7f')][_0x6f2f('0x82')];break;case _0x6f2f('0x83'):_0x5e7395[_0x6f2f('0x80')]=db['Sequelize']['BOOLEAN'];_0x5e7395[_0x6f2f('0x84')]=![];break;default:}return db[_0x6f2f('0x7c')][_0x6f2f('0x85')]['addColumn']('cm_contacts',util[_0x6f2f('0x77')](_0x6f2f('0x86'),_0x462483['id']),_0x5e7395);})[_0x6f2f('0x28')](function(){return _0x462483;});});}})[_0x6f2f('0x28')](respondWithResult(_0x181e89,null))[_0x6f2f('0x47')](handleError(_0x181e89,null));};exports[_0x6f2f('0x87')]=function(_0x1acbd1,_0x1b0395,_0x2d23d9){var _0x50b3f0={};var _0x3beed5={};var _0x3c4d15;var _0x4deec5;return db[_0x6f2f('0x32')]['findOne']({'where':{'id':_0x1acbd1['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x1b0395,null))[_0x6f2f('0x28')](function(_0x2ae7ef){if(_0x2ae7ef){_0x3c4d15=_0x2ae7ef;_0x3beed5['model']=_[_0x6f2f('0x49')](db[_0x6f2f('0x6b')]['rawAttributes']);_0x3beed5[_0x6f2f('0x37')]=_['keys'](_0x1acbd1[_0x6f2f('0x37')]);_0x3beed5[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x3beed5[_0x6f2f('0x35')],_0x3beed5[_0x6f2f('0x37')]);_0x50b3f0[_0x6f2f('0x3a')]=_['intersection'](_0x3beed5['model'],qs['fields'](_0x1acbd1['query'][_0x6f2f('0x39')]));_0x50b3f0[_0x6f2f('0x3a')]=_0x50b3f0[_0x6f2f('0x3a')][_0x6f2f('0x62')]?_0x50b3f0[_0x6f2f('0x3a')]:_0x3beed5[_0x6f2f('0x35')];_0x50b3f0['order']=qs[_0x6f2f('0x3e')](_0x1acbd1[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x50b3f0[_0x6f2f('0x3f')]=qs['filters'](_[_0x6f2f('0x41')](_0x1acbd1[_0x6f2f('0x37')],_0x3beed5[_0x6f2f('0x40')]));_0x50b3f0[_0x6f2f('0x3f')]=_[_0x6f2f('0x43')](_0x50b3f0[_0x6f2f('0x3f')],{'$or':[{'ListId':_0x2ae7ef['id']},{'ListId':null}]});if(_0x1acbd1[_0x6f2f('0x37')]['filter']){_0x50b3f0[_0x6f2f('0x3f')]=_['merge'](_0x50b3f0[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x36')](_0x50b3f0['attributes'],function(_0x3e5201){var _0x325907={};_0x325907[_0x3e5201]={'$like':'%'+_0x1acbd1[_0x6f2f('0x37')][_0x6f2f('0x42')]+'%'};return _0x325907;})});}_0x50b3f0=_[_0x6f2f('0x43')]({},_0x50b3f0,_0x1acbd1[_0x6f2f('0x44')]);return db[_0x6f2f('0x6b')][_0x6f2f('0x88')](_0x50b3f0);}})[_0x6f2f('0x28')](respondWithResult(_0x1b0395,null))['catch'](handleError(_0x1b0395,null));};exports['addAgents']=function(_0x2b8885,_0x26bcc9,_0x4fc434){return db[_0x6f2f('0x32')][_0x6f2f('0x4c')]({'where':{'id':_0x2b8885['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x26bcc9,null))[_0x6f2f('0x28')](function(_0x3237d2){if(_0x3237d2){return _0x3237d2['addAgents'](_0x2b8885[_0x6f2f('0x4e')]['ids'],_[_0x6f2f('0x66')](_0x2b8885[_0x6f2f('0x4e')],['ids','id'])||{})[_0x6f2f('0x89')](function(_0x438349){for(var _0x3e0cf8=0x0;_0x3e0cf8<_0x2b8885[_0x6f2f('0x4e')][_0x6f2f('0x5d')]['length'];_0x3e0cf8+=0x1){socket[_0x6f2f('0x8a')](_0x6f2f('0x8b'),{'UserId':Number(_0x2b8885['body'][_0x6f2f('0x5d')][_0x3e0cf8]),'CmListId':Number(_0x2b8885[_0x6f2f('0x48')]['id'])});}return _0x438349;});}})[_0x6f2f('0x28')](respondWithResult(_0x26bcc9,null))['catch'](handleError(_0x26bcc9,null));};exports[_0x6f2f('0x8c')]=function(_0x10aa3a,_0x380fa8,_0x4dd241){return db['CmList'][_0x6f2f('0x4c')]({'where':{'id':_0x10aa3a[_0x6f2f('0x48')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x380fa8,null))[_0x6f2f('0x28')](function(_0x4e7307){if(_0x4e7307){return _0x4e7307['removeAgents'](_0x10aa3a['query'][_0x6f2f('0x5d')])[_0x6f2f('0x28')](function(){if(_[_0x6f2f('0x61')](_0x10aa3a['query']['ids'])){for(var _0xbfe178=0x0;_0xbfe178<_0x10aa3a[_0x6f2f('0x37')]['ids'][_0x6f2f('0x62')];_0xbfe178+=0x1){socket[_0x6f2f('0x8a')](_0x6f2f('0x8d'),{'UserId':Number(_0x10aa3a['query'][_0x6f2f('0x5d')][_0xbfe178]),'CmListId':Number(_0x10aa3a['params']['id'])});}}else{socket[_0x6f2f('0x8a')](_0x6f2f('0x8d'),{'UserId':Number(_0x10aa3a[_0x6f2f('0x37')][_0x6f2f('0x5d')]),'CmListId':Number(_0x10aa3a[_0x6f2f('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x380fa8,null))[_0x6f2f('0x47')](handleError(_0x380fa8,null));};exports[_0x6f2f('0x8e')]=function(_0x110adb,_0x381911,_0xb0d68b){var _0x22a1b1={};var _0x164569={};var _0x1c9ec5;var _0x1f152a;return db[_0x6f2f('0x32')]['findOne']({'where':{'id':_0x110adb[_0x6f2f('0x48')]['id']}})['then'](handleEntityNotFound(_0x381911,null))['then'](function(_0x15dc73){if(_0x15dc73){_0x1c9ec5=_0x15dc73;_0x164569['model']=_[_0x6f2f('0x49')](db[_0x6f2f('0x8f')][_0x6f2f('0x4a')]);_0x164569[_0x6f2f('0x37')]=_[_0x6f2f('0x49')](_0x110adb[_0x6f2f('0x37')]);_0x164569[_0x6f2f('0x40')]=_[_0x6f2f('0x38')](_0x164569[_0x6f2f('0x35')],_0x164569[_0x6f2f('0x37')]);_0x22a1b1[_0x6f2f('0x3a')]=_[_0x6f2f('0x38')](_0x164569[_0x6f2f('0x35')],qs['fields'](_0x110adb[_0x6f2f('0x37')]['fields']));_0x22a1b1[_0x6f2f('0x3a')]=_0x22a1b1[_0x6f2f('0x3a')][_0x6f2f('0x62')]?_0x22a1b1['attributes']:_0x164569['model'];_0x22a1b1['order']=qs[_0x6f2f('0x3e')](_0x110adb[_0x6f2f('0x37')][_0x6f2f('0x3e')]);_0x22a1b1[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_['pick'](_0x110adb['query'],_0x164569[_0x6f2f('0x40')]));if(_0x110adb['query'][_0x6f2f('0x42')]){_0x22a1b1[_0x6f2f('0x3f')]=_[_0x6f2f('0x43')](_0x22a1b1[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x36')](_0x22a1b1['attributes'],function(_0x4724e2){var _0x1f11fe={};_0x1f11fe[_0x4724e2]={'$like':'%'+_0x110adb[_0x6f2f('0x37')][_0x6f2f('0x42')]+'%'};return _0x1f11fe;})});}_0x22a1b1=_[_0x6f2f('0x43')]({},_0x22a1b1,_0x110adb[_0x6f2f('0x44')]);return _0x1c9ec5[_0x6f2f('0x8e')](_0x22a1b1);}})[_0x6f2f('0x28')](function(_0x3522e5){if(_0x3522e5){_0x1f152a=_0x3522e5[_0x6f2f('0x62')];if(!_0x110adb[_0x6f2f('0x37')][_0x6f2f('0x3b')](_0x6f2f('0x3c'))){_0x22a1b1['limit']=qs[_0x6f2f('0x23')](_0x110adb[_0x6f2f('0x37')]['limit']);_0x22a1b1['offset']=qs[_0x6f2f('0x20')](_0x110adb['query']['offset']);}return _0x1c9ec5[_0x6f2f('0x8e')](_0x22a1b1);}})[_0x6f2f('0x28')](function(_0x2185bf){if(_0x2185bf){return _0x2185bf?{'count':_0x1f152a,'rows':_0x2185bf}:null;}})[_0x6f2f('0x28')](respondWithResult(_0x381911,null))[_0x6f2f('0x47')](handleError(_0x381911,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c8bab3c..38c24d9 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x5fc3[_0x58a4fe];return _0x697de2;};'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 +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x55ca,0x126));var _0xa55c=function(_0x64bbb9,_0x909c76){_0x64bbb9=_0x64bbb9-0x0;var _0x5c3707=_0x55ca[_0x64bbb9];return _0x5c3707;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](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 0e06991..d49898d 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 _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x245b99,_0x4dc787){var _0x37b53c=function(_0x22c8ad){while(--_0x22c8ad){_0x245b99['push'](_0x245b99['shift']());}};_0x37b53c(++_0x4dc787);}(_0xf109,0xce));var _0x9f10=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf109[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x18b7c7,_0x3df910){var _0x3fd2c0=function(_0x5df4f7){while(--_0x5df4f7){_0x18b7c7['push'](_0x18b7c7['shift']());}};_0x3fd2c0(++_0x3df910);}(_0x702d,0x147));var _0xd702=function(_0x593a43,_0x5d9f07){_0x593a43=_0x593a43-0x0;var _0x2bf077=_0x702d[_0x593a43];return _0x2bf077;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index cd51bc0..7ad682b 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 _0x33b7=['register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./cmList.socket'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x33b7,0x16b));var _0x733b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x33b7[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x733b('0x0'));var util=require(_0x733b('0x1'));var moment=require(_0x733b('0x2'));var BPromise=require(_0x733b('0x3'));var rs=require(_0x733b('0x4'));var fs=require('fs');var Redis=require(_0x733b('0x5'));var db=require(_0x733b('0x6'))['db'];var utils=require(_0x733b('0x7'));var logger=require(_0x733b('0x8'))(_0x733b('0x9'));var config=require(_0x733b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x733b('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x733b('0xc')],{'host':_0x733b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x733b('0xc')]));require(_0x733b('0xe'))[_0x733b('0xf')](socket);function respondWithRpcPromise(_0x5d1a98,_0x54ace2,_0x59a62c){return new BPromise(function(_0xc6b541,_0x3c5073){return client[_0x733b('0x10')](_0x5d1a98,_0x59a62c)[_0x733b('0x11')](function(_0x204cbc){logger[_0x733b('0x12')]('CmList,\x20%s,\x20%s',_0x54ace2,_0x733b('0x13'));logger[_0x733b('0x14')](_0x733b('0x15'),_0x54ace2,_0x733b('0x13'),JSON[_0x733b('0x16')](_0x204cbc));if(_0x204cbc['error']){if(_0x204cbc['error']['code']===0x1f4){logger[_0x733b('0x17')](_0x733b('0x18'),_0x54ace2,_0x204cbc[_0x733b('0x17')][_0x733b('0x19')]);return _0x3c5073(_0x204cbc[_0x733b('0x17')][_0x733b('0x19')]);}logger[_0x733b('0x17')](_0x733b('0x18'),_0x54ace2,_0x204cbc[_0x733b('0x17')][_0x733b('0x19')]);return _0xc6b541(_0x204cbc[_0x733b('0x17')]['message']);}else{logger[_0x733b('0x12')](_0x733b('0x18'),_0x54ace2,_0x733b('0x13'));_0xc6b541(_0x204cbc[_0x733b('0x1a')][_0x733b('0x19')]);}})['catch'](function(_0x3e0d6c){logger[_0x733b('0x17')]('CmList,\x20%s,\x20%s',_0x54ace2,_0x3e0d6c);_0x3c5073(_0x3e0d6c);});});} \ No newline at end of file +var _0x6583=['info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0x6583,0xc7));var _0x3658=function(_0x2da3fe,_0x55ad2d){_0x2da3fe=_0x2da3fe-0x0;var _0x564b34=_0x6583[_0x2da3fe];return _0x564b34;};'use strict';var _=require(_0x3658('0x0'));var util=require(_0x3658('0x1'));var moment=require('moment');var BPromise=require(_0x3658('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3658('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3658('0x4'));var logger=require(_0x3658('0x5'))(_0x3658('0x6'));var config=require(_0x3658('0x7'));var jayson=require(_0x3658('0x8'));var client=jayson[_0x3658('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3658('0xa')](config[_0x3658('0xb')],{'host':_0x3658('0xc'),'port':0x18eb});var socket=require(_0x3658('0xd'))(new Redis(config[_0x3658('0xb')]));require('./cmList.socket')[_0x3658('0xe')](socket);function respondWithRpcPromise(_0x5ccac9,_0x2eded9,_0x5438b6){return new BPromise(function(_0x520f07,_0x26d986){return client[_0x3658('0xf')](_0x5ccac9,_0x5438b6)[_0x3658('0x10')](function(_0x1a9090){logger[_0x3658('0x11')](_0x3658('0x12'),_0x2eded9,'request\x20sent');logger[_0x3658('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x2eded9,_0x3658('0x14'),JSON[_0x3658('0x15')](_0x1a9090));if(_0x1a9090['error']){if(_0x1a9090[_0x3658('0x16')][_0x3658('0x17')]===0x1f4){logger[_0x3658('0x16')]('CmList,\x20%s,\x20%s',_0x2eded9,_0x1a9090[_0x3658('0x16')]['message']);return _0x26d986(_0x1a9090[_0x3658('0x16')][_0x3658('0x18')]);}logger[_0x3658('0x16')](_0x3658('0x12'),_0x2eded9,_0x1a9090[_0x3658('0x16')]['message']);return _0x520f07(_0x1a9090[_0x3658('0x16')][_0x3658('0x18')]);}else{logger[_0x3658('0x11')](_0x3658('0x12'),_0x2eded9,_0x3658('0x14'));_0x520f07(_0x1a9090[_0x3658('0x19')][_0x3658('0x18')]);}})[_0x3658('0x1a')](function(_0x2e2b18){logger[_0x3658('0x16')](_0x3658('0x12'),_0x2eded9,_0x2e2b18);_0x26d986(_0x2e2b18);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a14387b..edd8dad 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 _0x4004=['length','./cmList.events','save','remove','update','removeListener','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4004,0x127));var _0x4400=function(_0x179c0c,_0x20fe42){_0x179c0c=_0x179c0c-0x0;var _0x2ab663=_0x4004[_0x179c0c];return _0x2ab663;};'use strict';var CmListEvents=require(_0x4400('0x0'));var events=[_0x4400('0x1'),_0x4400('0x2'),_0x4400('0x3')];function createListener(_0x4463ae,_0x31f96d){return function(_0x1ddafa){_0x31f96d['emit'](_0x4463ae,_0x1ddafa);};}function removeListener(_0x31f959,_0xfee9e6){return function(){CmListEvents[_0x4400('0x4')](_0x31f959,_0xfee9e6);};}exports[_0x4400('0x5')]=function(_0x3b51e0){for(var _0x394e5b=0x0,_0x53ca3a=events[_0x4400('0x6')];_0x394e5b<_0x53ca3a;_0x394e5b++){var _0x30cb70=events[_0x394e5b];var _0x2723f5=createListener('cmList:'+_0x30cb70,_0x3b51e0);CmListEvents['on'](_0x30cb70,_0x2723f5);}}; \ No newline at end of file +var _0x41d4=['register','length','cmList:','./cmList.events','save','remove','update','removeListener'];(function(_0x2be103,_0x5b6f02){var _0x22b279=function(_0x199e53){while(--_0x199e53){_0x2be103['push'](_0x2be103['shift']());}};_0x22b279(++_0x5b6f02);}(_0x41d4,0x103));var _0x441d=function(_0x3186ae,_0x5d615c){_0x3186ae=_0x3186ae-0x0;var _0x247818=_0x41d4[_0x3186ae];return _0x247818;};'use strict';var CmListEvents=require(_0x441d('0x0'));var events=[_0x441d('0x1'),_0x441d('0x2'),_0x441d('0x3')];function createListener(_0x50eea0,_0xfb8c1c){return function(_0x151cc2){_0xfb8c1c['emit'](_0x50eea0,_0x151cc2);};}function removeListener(_0x1ed445,_0x7b36a5){return function(){CmListEvents[_0x441d('0x4')](_0x1ed445,_0x7b36a5);};}exports[_0x441d('0x5')]=function(_0x51dfd5){for(var _0x1411d1=0x0,_0x29065b=events[_0x441d('0x6')];_0x1411d1<_0x29065b;_0x1411d1++){var _0x4e481c=events[_0x1411d1];var _0x1bc601=createListener(_0x441d('0x7')+_0x4e481c,_0x51dfd5);CmListEvents['on'](_0x4e481c,_0x1bc601);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 53267c5..a3ef7d2 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 _0xdec5=['describe','/:id','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x4d88b7,_0x2b6d01){var _0x1a5796=function(_0x14aeea){while(--_0x14aeea){_0x4d88b7['push'](_0x4d88b7['shift']());}};_0x1a5796(++_0x2b6d01);}(_0xdec5,0x175));var _0x5dec=function(_0xd08c39,_0x384816){_0xd08c39=_0xd08c39-0x0;var _0x4ee836=_0xdec5[_0xd08c39];return _0x4ee836;};'use strict';var multer=require(_0x5dec('0x0'));var util=require('util');var path=require(_0x5dec('0x1'));var timeout=require(_0x5dec('0x2'));var express=require(_0x5dec('0x3'));var router=express[_0x5dec('0x4')]();var fs_extra=require(_0x5dec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5dec('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x5dec('0x7')]('/',auth[_0x5dec('0x8')](),controller[_0x5dec('0x9')]);router[_0x5dec('0x7')](_0x5dec('0xa'),auth[_0x5dec('0x8')](),controller[_0x5dec('0xb')]);router[_0x5dec('0x7')](_0x5dec('0xc'),auth[_0x5dec('0x8')](),controller['show']);router[_0x5dec('0x7')]('/:id/dispositions',auth[_0x5dec('0x8')](),controller['getDispositions']);router[_0x5dec('0x7')]('/:id/contacts',auth[_0x5dec('0x8')](),controller[_0x5dec('0xd')]);router[_0x5dec('0x7')](_0x5dec('0xe'),auth[_0x5dec('0x8')](),controller[_0x5dec('0xf')]);router[_0x5dec('0x7')](_0x5dec('0x10'),auth[_0x5dec('0x8')](),controller[_0x5dec('0x11')]);router[_0x5dec('0x7')](_0x5dec('0x12'),auth[_0x5dec('0x8')](),controller['getAgents']);router[_0x5dec('0x13')]('/',auth['isAuthenticated'](),controller[_0x5dec('0x14')]);router['post'](_0x5dec('0x15'),auth[_0x5dec('0x8')](),controller[_0x5dec('0x16')]);router[_0x5dec('0x13')](_0x5dec('0x17'),auth[_0x5dec('0x8')](),controller[_0x5dec('0x18')]);router[_0x5dec('0x13')]('/:id/fields',auth[_0x5dec('0x8')](),controller[_0x5dec('0x19')]);router[_0x5dec('0x13')]('/:id/users',auth[_0x5dec('0x8')](),controller[_0x5dec('0x1a')]);router[_0x5dec('0x1b')](_0x5dec('0xc'),auth['isAuthenticated'](),controller[_0x5dec('0x1c')]);router[_0x5dec('0x1d')](_0x5dec('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x5dec('0x1d')](_0x5dec('0x15'),auth['isAuthenticated'](),controller[_0x5dec('0x1e')]);router[_0x5dec('0x1d')](_0x5dec('0x12'),auth[_0x5dec('0x8')](),controller['removeAgents']);module[_0x5dec('0x1f')]=router; \ No newline at end of file +var _0x97e9=['destroy','removeDispositions','removeAgents','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','addAgents','put','delete'];(function(_0x529de3,_0x3d1735){var _0x3166fe=function(_0x1aec4c){while(--_0x1aec4c){_0x529de3['push'](_0x529de3['shift']());}};_0x3166fe(++_0x3d1735);}(_0x97e9,0x1a3));var _0x997e=function(_0x2e6e38,_0x25547b){_0x2e6e38=_0x2e6e38-0x0;var _0x46afba=_0x97e9[_0x2e6e38];return _0x46afba;};'use strict';var multer=require('multer');var util=require(_0x997e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x997e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x997e('0x2'));var interaction=require(_0x997e('0x3'));var config=require(_0x997e('0x4'));var controller=require(_0x997e('0x5'));router[_0x997e('0x6')]('/',auth[_0x997e('0x7')](),controller[_0x997e('0x8')]);router['get'](_0x997e('0x9'),auth['isAuthenticated'](),controller[_0x997e('0xa')]);router['get'](_0x997e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x997e('0x6')]('/:id/dispositions',auth[_0x997e('0x7')](),controller[_0x997e('0xc')]);router[_0x997e('0x6')]('/:id/contacts',auth[_0x997e('0x7')](),controller[_0x997e('0xd')]);router['get'](_0x997e('0xe'),auth[_0x997e('0x7')](),controller[_0x997e('0xf')]);router[_0x997e('0x6')](_0x997e('0x10'),auth[_0x997e('0x7')](),controller[_0x997e('0x11')]);router[_0x997e('0x6')](_0x997e('0x12'),auth[_0x997e('0x7')](),controller[_0x997e('0x13')]);router[_0x997e('0x14')]('/',auth[_0x997e('0x7')](),controller[_0x997e('0x15')]);router[_0x997e('0x14')](_0x997e('0x16'),auth[_0x997e('0x7')](),controller[_0x997e('0x17')]);router['post'](_0x997e('0x18'),auth[_0x997e('0x7')](),controller[_0x997e('0x19')]);router[_0x997e('0x14')]('/:id/fields',auth[_0x997e('0x7')](),controller['addCustomField']);router['post'](_0x997e('0x12'),auth[_0x997e('0x7')](),controller[_0x997e('0x1a')]);router[_0x997e('0x1b')]('/:id',auth[_0x997e('0x7')](),controller['update']);router[_0x997e('0x1c')]('/:id',auth[_0x997e('0x7')](),controller[_0x997e('0x1d')]);router[_0x997e('0x1c')](_0x997e('0x16'),auth[_0x997e('0x7')](),controller[_0x997e('0x1e')]);router[_0x997e('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x997e('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 106a0eb..4b2ff0a 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 _0x8705=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x3afd09,_0x52634e){var _0x451138=function(_0xbc8280){while(--_0xbc8280){_0x3afd09['push'](_0x3afd09['shift']());}};_0x451138(++_0x52634e);}(_0x8705,0x16a));var _0x5870=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8705[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5870('0x0'));module[_0x5870('0x1')]={'name':{'type':Sequelize[_0x5870('0x2')],'get':function(_0x5ac35d){return this[_0x5870('0x3')](_0x5870('0x4'));}},'field':{'type':Sequelize[_0x5870('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x5870('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x5870('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x67e1=['sequelize','exports','field','STRING'];(function(_0x1e93fa,_0x210f48){var _0xd4e1e6=function(_0x3149da){while(--_0x3149da){_0x1e93fa['push'](_0x1e93fa['shift']());}};_0xd4e1e6(++_0x210f48);}(_0x67e1,0x1f4));var _0x167e=function(_0x4bb366,_0xe7cbd7){_0x4bb366=_0x4bb366-0x0;var _0x178846=_0x67e1[_0x4bb366];return _0x178846;};'use strict';var Sequelize=require(_0x167e('0x0'));module[_0x167e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x118599){return this['getDataValue'](_0x167e('0x2'));}},'field':{'type':Sequelize[_0x167e('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x167e('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x167e('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 773b7ed..a398af9 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(_0x477f8f,_0xb148c3){var _0x41de49=function(_0x558203){while(--_0x558203){_0x477f8f['push'](_0x477f8f['shift']());}};_0x41de49(++_0xb148c3);}(_0x7a54,0x106));var _0x47a5=function(_0x20dc26,_0x833e8e){_0x20dc26=_0x20dc26-0x0;var _0x1376f5=_0x7a54[_0x20dc26];return _0x1376f5;};'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(_0x850994,_0x17999c){var _0xbecb19=function(_0x8ad536){while(--_0x8ad536){_0x850994['push'](_0x850994['shift']());}};_0xbecb19(++_0x17999c);}(_0x7a54,0x106));var _0x47a5=function(_0x19d0b4,_0x470f42){_0x19d0b4=_0x19d0b4-0x0;var _0x17db1b=_0x7a54[_0x19d0b4];return _0x17db1b;};'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 4ae2aa5..eb80fc0 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 _0x8916=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions'];(function(_0x3d5db9,_0x2dbe0a){var _0x3c114c=function(_0x3e0239){while(--_0x3e0239){_0x3d5db9['push'](_0x3d5db9['shift']());}};_0x3c114c(++_0x2dbe0a);}(_0x8916,0x82));var _0x6891=function(_0x343743,_0x42f0d2){_0x343743=_0x343743-0x0;var _0xf34b0f=_0x8916[_0x343743];return _0xf34b0f;};'use strict';var _=require(_0x6891('0x0'));var util=require(_0x6891('0x1'));var logger=require(_0x6891('0x2'))(_0x6891('0x3'));var moment=require(_0x6891('0x4'));var BPromise=require(_0x6891('0x5'));var rp=require(_0x6891('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6891('0x7'));var config=require(_0x6891('0x8'));var attributes=require(_0x6891('0x9'));module[_0x6891('0xa')]=function(_0x3d2153,_0x58299c){return _0x3d2153['define'](_0x6891('0xb'),attributes,{'tableName':_0x6891('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf83=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa69abe,_0x26448b){var _0x230cde=function(_0x5000db){while(--_0x5000db){_0xa69abe['push'](_0xa69abe['shift']());}};_0x230cde(++_0x26448b);}(_0xaf83,0x85));var _0x3af8=function(_0x316fac,_0x204ba6){_0x316fac=_0x316fac-0x0;var _0x852e8f=_0xaf83[_0x316fac];return _0x852e8f;};'use strict';var _=require(_0x3af8('0x0'));var util=require(_0x3af8('0x1'));var logger=require(_0x3af8('0x2'))('api');var moment=require(_0x3af8('0x3'));var BPromise=require(_0x3af8('0x4'));var rp=require(_0x3af8('0x5'));var fs=require('fs');var path=require(_0x3af8('0x6'));var rimraf=require(_0x3af8('0x7'));var config=require(_0x3af8('0x8'));var attributes=require(_0x3af8('0x9'));module[_0x3af8('0xa')]=function(_0x232bc7,_0x14a1e1){return _0x232bc7[_0x3af8('0xb')](_0x3af8('0xc'),attributes,{'tableName':_0x3af8('0xd'),'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 2517f20..a904d8a 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 _0x7c08=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7c08,0x10d));var _0x87c0=function(_0x253aac,_0x35d714){_0x253aac=_0x253aac-0x0;var _0x1391bf=_0x7c08[_0x253aac];return _0x1391bf;};'use strict';var _=require(_0x87c0('0x0'));var util=require(_0x87c0('0x1'));var moment=require(_0x87c0('0x2'));var BPromise=require(_0x87c0('0x3'));var rs=require(_0x87c0('0x4'));var fs=require('fs');var Redis=require(_0x87c0('0x5'));var db=require(_0x87c0('0x6'))['db'];var utils=require(_0x87c0('0x7'));var logger=require(_0x87c0('0x8'))(_0x87c0('0x9'));var config=require(_0x87c0('0xa'));var jayson=require(_0x87c0('0xb'));var client=jayson['client'][_0x87c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x262c0a,_0x4c83db,_0x21dbbd){return new BPromise(function(_0x21fa61,_0x4c33d4){return client[_0x87c0('0xd')](_0x262c0a,_0x21dbbd)[_0x87c0('0xe')](function(_0x542c66){logger['info'](_0x87c0('0xf'),_0x4c83db,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x4c83db,_0x87c0('0x10'),JSON[_0x87c0('0x11')](_0x542c66));if(_0x542c66[_0x87c0('0x12')]){if(_0x542c66[_0x87c0('0x12')][_0x87c0('0x13')]===0x1f4){logger['error'](_0x87c0('0xf'),_0x4c83db,_0x542c66[_0x87c0('0x12')]['message']);return _0x4c33d4(_0x542c66['error'][_0x87c0('0x14')]);}logger['error'](_0x87c0('0xf'),_0x4c83db,_0x542c66['error'][_0x87c0('0x14')]);return _0x21fa61(_0x542c66[_0x87c0('0x12')][_0x87c0('0x14')]);}else{logger[_0x87c0('0x15')](_0x87c0('0xf'),_0x4c83db,'request\x20sent');_0x21fa61(_0x542c66[_0x87c0('0x16')][_0x87c0('0x14')]);}})[_0x87c0('0x17')](function(_0x169c4c){logger[_0x87c0('0x12')]('Condition,\x20%s,\x20%s',_0x4c83db,_0x169c4c);_0x4c33d4(_0x169c4c);});});} \ No newline at end of file +var _0x60b1=['info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','Condition,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x23bd7e,_0x28c3f4){var _0x97cd11=function(_0x470c79){while(--_0x470c79){_0x23bd7e['push'](_0x23bd7e['shift']());}};_0x97cd11(++_0x28c3f4);}(_0x60b1,0xf2));var _0x160b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x160b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x160b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x160b('0x2'));var db=require(_0x160b('0x3'))['db'];var utils=require(_0x160b('0x4'));var logger=require(_0x160b('0x5'))('rpc');var config=require(_0x160b('0x6'));var jayson=require(_0x160b('0x7'));var client=jayson[_0x160b('0x8')][_0x160b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf2a4b9,_0x3c943f,_0x3a08d0){return new BPromise(function(_0x53084a,_0x450a24){return client['request'](_0xf2a4b9,_0x3a08d0)['then'](function(_0x2c3f17){logger[_0x160b('0xa')]('Condition,\x20%s,\x20%s',_0x3c943f,_0x160b('0xb'));logger['debug'](_0x160b('0xc'),_0x3c943f,_0x160b('0xb'),JSON['stringify'](_0x2c3f17));if(_0x2c3f17[_0x160b('0xd')]){if(_0x2c3f17[_0x160b('0xd')]['code']===0x1f4){logger[_0x160b('0xd')](_0x160b('0xe'),_0x3c943f,_0x2c3f17['error'][_0x160b('0xf')]);return _0x450a24(_0x2c3f17['error'][_0x160b('0xf')]);}logger[_0x160b('0xd')](_0x160b('0xe'),_0x3c943f,_0x2c3f17[_0x160b('0xd')][_0x160b('0xf')]);return _0x53084a(_0x2c3f17[_0x160b('0xd')][_0x160b('0xf')]);}else{logger[_0x160b('0xa')]('Condition,\x20%s,\x20%s',_0x3c943f,_0x160b('0xb'));_0x53084a(_0x2c3f17[_0x160b('0x10')]['message']);}})[_0x160b('0x11')](function(_0x55aeb1){logger['error'](_0x160b('0xe'),_0x3c943f,_0x55aeb1);_0x450a24(_0x55aeb1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9ea872e..e56aa72 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 _0x4fc8=['put','update','delete','/:id','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x4fc8,0xb1));var _0x84fc=function(_0x568d1a,_0x4cfc6a){_0x568d1a=_0x568d1a-0x0;var _0x505881=_0x4fc8[_0x568d1a];return _0x505881;};'use strict';var multer=require(_0x84fc('0x0'));var util=require(_0x84fc('0x1'));var path=require('path');var timeout=require(_0x84fc('0x2'));var express=require(_0x84fc('0x3'));var router=express[_0x84fc('0x4')]();var fs_extra=require(_0x84fc('0x5'));var auth=require(_0x84fc('0x6'));var interaction=require(_0x84fc('0x7'));var config=require(_0x84fc('0x8'));var controller=require(_0x84fc('0x9'));router[_0x84fc('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x84fc('0xb')]);router[_0x84fc('0xc')](_0x84fc('0xd'),auth[_0x84fc('0xe')](),controller[_0x84fc('0xf')]);module[_0x84fc('0x10')]=router; \ No newline at end of file +var _0x19e6=['/:id','isAuthenticated','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put'];(function(_0x380302,_0x1e3ef0){var _0x34a7e6=function(_0x578704){while(--_0x578704){_0x380302['push'](_0x380302['shift']());}};_0x34a7e6(++_0x1e3ef0);}(_0x19e6,0x101));var _0x619e=function(_0x9841a6,_0x348d4e){_0x9841a6=_0x9841a6-0x0;var _0x197505=_0x19e6[_0x9841a6];return _0x197505;};'use strict';var multer=require('multer');var util=require(_0x619e('0x0'));var path=require(_0x619e('0x1'));var timeout=require('connect-timeout');var express=require(_0x619e('0x2'));var router=express[_0x619e('0x3')]();var fs_extra=require(_0x619e('0x4'));var auth=require(_0x619e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x619e('0x6'));var controller=require(_0x619e('0x7'));router[_0x619e('0x8')](_0x619e('0x9'),auth[_0x619e('0xa')](),controller[_0x619e('0xb')]);router['delete']('/:id',auth[_0x619e('0xa')](),controller[_0x619e('0xc')]);module[_0x619e('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 80296ce..2d10ea8 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 _0xe706=['STRING','sequelize','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe706,0xa3));var _0x6e70=function(_0x5b8685,_0x1a1c28){_0x5b8685=_0x5b8685-0x0;var _0xa3ef57=_0xe706[_0x5b8685];return _0xa3ef57;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe706,0xa3));var _0x6e70=function(_0x2e752b,_0x5cb17d){_0x2e752b=_0x2e752b-0x0;var _0x40a0b4=_0xe706[_0x2e752b];return _0x40a0b4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 96b05d2..5b5a70b 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 _0x7074=['include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','autoAssociation','error','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','limit','undefined','offset','set','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','stack','index','map','Dashboard','rawAttributes','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x3a30da,_0x5f7f9a){var _0x26dbef=function(_0x3603fd){while(--_0x3603fd){_0x3a30da['push'](_0x3a30da['shift']());}};_0x26dbef(++_0x5f7f9a);}(_0x7074,0x1bc));var _0x4707=function(_0x4463b4,_0x1d1a55){_0x4463b4=_0x4463b4-0x0;var _0x1af667=_0x7074[_0x4463b4];return _0x1af667;};'use strict';var emlformat=require(_0x4707('0x0'));var rimraf=require(_0x4707('0x1'));var zipdir=require(_0x4707('0x2'));var jsonpatch=require(_0x4707('0x3'));var rp=require(_0x4707('0x4'));var moment=require(_0x4707('0x5'));var BPromise=require(_0x4707('0x6'));var Mustache=require(_0x4707('0x7'));var util=require(_0x4707('0x8'));var path=require(_0x4707('0x9'));var sox=require(_0x4707('0xa'));var csv=require(_0x4707('0xb'));var ejs=require(_0x4707('0xc'));var fs=require('fs');var fs_extra=require(_0x4707('0xd'));var _=require(_0x4707('0xe'));var squel=require(_0x4707('0xf'));var crypto=require(_0x4707('0x10'));var jsforce=require(_0x4707('0x11'));var deskjs=require(_0x4707('0x12'));var toCsv=require(_0x4707('0xb'));var querystring=require(_0x4707('0x13'));var Papa=require(_0x4707('0x14'));var Redis=require(_0x4707('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x4707('0x16'));var as=require(_0x4707('0x17'));var hardwareService=require(_0x4707('0x18'));var logger=require(_0x4707('0x19'))(_0x4707('0x1a'));var utils=require('../../config/utils');var config=require(_0x4707('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4707('0x1c')]=_[_0x4707('0x1d')](config[_0x4707('0x1c')],{'host':_0x4707('0x1e'),'port':0x18eb});var socket=require(_0x4707('0x1f'))(new Redis(config['redis']));require(_0x4707('0x20'))[_0x4707('0x21')](socket);function respondWithStatusCode(_0x80522,_0x1e9330){_0x1e9330=_0x1e9330||0xcc;return function(_0x6ada99){if(_0x6ada99){return _0x80522['sendStatus'](_0x1e9330);}return _0x80522[_0x4707('0x22')](_0x1e9330)[_0x4707('0x23')]();};}function respondWithResult(_0x4f74dd,_0x2110a8){_0x2110a8=_0x2110a8||0xc8;return function(_0x55fc27){if(_0x55fc27){return _0x4f74dd[_0x4707('0x22')](_0x2110a8)[_0x4707('0x24')](_0x55fc27);}};}function respondWithFilteredResult(_0x16c29e,_0x4e774b){return function(_0x238d35){if(_0x238d35){var _0x1389e0=typeof _0x4e774b['offset']==='undefined'&&typeof _0x4e774b[_0x4707('0x25')]===_0x4707('0x26');var _0x930009=_0x238d35['count'];var _0x2966ca=_0x1389e0?0x0:_0x4e774b['offset'];var _0x74b195=_0x1389e0?_0x238d35['count']:_0x4e774b[_0x4707('0x27')]+_0x4e774b['limit'];var _0x3db2f2;if(_0x74b195>=_0x930009){_0x74b195=_0x930009;_0x3db2f2=0xc8;}else{_0x3db2f2=0xce;}_0x16c29e[_0x4707('0x22')](_0x3db2f2);return _0x16c29e[_0x4707('0x28')]('Content-Range',_0x2966ca+'-'+_0x74b195+'/'+_0x930009)[_0x4707('0x24')](_0x238d35);}return null;};}function patchUpdates(_0x2ab5ea){return function(_0x38eaf7){try{jsonpatch[_0x4707('0x29')](_0x38eaf7,_0x2ab5ea,!![]);}catch(_0x466344){return BPromise[_0x4707('0x2a')](_0x466344);}return _0x38eaf7[_0x4707('0x2b')]();};}function saveUpdates(_0x51a1f7,_0x1554ab){return function(_0x2bbea4){if(_0x2bbea4){return _0x2bbea4['update'](_0x51a1f7)[_0x4707('0x2c')](function(_0x406da9){return _0x406da9;});}return null;};}function removeEntity(_0x202ac8,_0x5526ce){return function(_0x4ed095){if(_0x4ed095){return _0x4ed095[_0x4707('0x2d')]()['then'](function(){var _0x490aba=_0x4ed095[_0x4707('0x2e')]({'plain':!![]});var _0x24e76a=_0x4707('0x2f');return db[_0x4707('0x30')][_0x4707('0x2d')]({'where':{'type':_0x24e76a,'resourceId':_0x490aba['id']}})[_0x4707('0x2c')](function(){return _0x4ed095;});})[_0x4707('0x2c')](function(){_0x202ac8[_0x4707('0x22')](0xcc)[_0x4707('0x23')]();});}};}function handleEntityNotFound(_0x1d2cc6,_0x583ca6){return function(_0x3db4f6){if(!_0x3db4f6){_0x1d2cc6['sendStatus'](0x194);}return _0x3db4f6;};}function handleError(_0x47ef35,_0xd9b438){_0xd9b438=_0xd9b438||0x1f4;return function(_0x350173){logger['error'](_0x350173[_0x4707('0x31')]);if(_0x350173['name']){delete _0x350173['name'];}_0x47ef35[_0x4707('0x22')](_0xd9b438)['send'](_0x350173);};}exports[_0x4707('0x32')]=function(_0x1170eb,_0x5aa1b2){var _0x3d9fa3={},_0x42a92b={},_0x546a68={'count':0x0,'rows':[]};var _0x247785=_[_0x4707('0x33')](db[_0x4707('0x34')][_0x4707('0x35')],function(_0x5b090b){return{'name':_0x5b090b['fieldName'],'type':_0x5b090b[_0x4707('0x36')]['key']};});_0x42a92b['model']=_['map'](_0x247785,_0x4707('0x37'));_0x42a92b[_0x4707('0x38')]=_[_0x4707('0x39')](_0x1170eb['query']);_0x42a92b[_0x4707('0x3a')]=_[_0x4707('0x3b')](_0x42a92b[_0x4707('0x3c')],_0x42a92b[_0x4707('0x38')]);_0x3d9fa3['attributes']=_[_0x4707('0x3b')](_0x42a92b[_0x4707('0x3c')],qs[_0x4707('0x3d')](_0x1170eb[_0x4707('0x38')][_0x4707('0x3d')]));_0x3d9fa3[_0x4707('0x3e')]=_0x3d9fa3[_0x4707('0x3e')][_0x4707('0x3f')]?_0x3d9fa3[_0x4707('0x3e')]:_0x42a92b[_0x4707('0x3c')];if(!_0x1170eb[_0x4707('0x38')][_0x4707('0x40')](_0x4707('0x41'))){_0x3d9fa3[_0x4707('0x25')]=qs[_0x4707('0x25')](_0x1170eb['query'][_0x4707('0x25')]);_0x3d9fa3[_0x4707('0x27')]=qs[_0x4707('0x27')](_0x1170eb[_0x4707('0x38')][_0x4707('0x27')]);}_0x3d9fa3[_0x4707('0x42')]=qs[_0x4707('0x43')](_0x1170eb[_0x4707('0x38')][_0x4707('0x43')]);_0x3d9fa3[_0x4707('0x44')]=qs[_0x4707('0x3a')](_[_0x4707('0x45')](_0x1170eb['query'],_0x42a92b[_0x4707('0x3a')]),_0x247785);if(_0x1170eb[_0x4707('0x38')][_0x4707('0x46')]){_0x3d9fa3[_0x4707('0x44')]=_[_0x4707('0x47')](_0x3d9fa3[_0x4707('0x44')],{'$or':_[_0x4707('0x33')](_0x247785,function(_0x3b242c){if(_0x3b242c[_0x4707('0x36')]!==_0x4707('0x48')){var _0x10654a={};_0x10654a[_0x3b242c['name']]={'$like':'%'+_0x1170eb[_0x4707('0x38')][_0x4707('0x46')]+'%'};return _0x10654a;}})});}_0x3d9fa3=_['merge']({},_0x3d9fa3,_0x1170eb[_0x4707('0x49')]);var _0x2604cf={'where':_0x3d9fa3[_0x4707('0x44')]};return db[_0x4707('0x34')][_0x4707('0x4a')](_0x2604cf)[_0x4707('0x2c')](function(_0x436ae){_0x546a68[_0x4707('0x4a')]=_0x436ae;if(_0x1170eb[_0x4707('0x38')][_0x4707('0x4b')]){_0x3d9fa3[_0x4707('0x4c')]=[{'all':!![]}];}return db['Dashboard'][_0x4707('0x4d')](_0x3d9fa3);})[_0x4707('0x2c')](function(_0x4191ea){_0x546a68[_0x4707('0x4e')]=_0x4191ea;return _0x546a68;})[_0x4707('0x2c')](respondWithFilteredResult(_0x5aa1b2,_0x3d9fa3))['catch'](handleError(_0x5aa1b2,null));};exports[_0x4707('0x4f')]=function(_0x20937d,_0x340a86){var _0x255926={'raw':![],'where':{'id':_0x20937d[_0x4707('0x50')]['id']}},_0xa711db={};_0xa711db['model']=_[_0x4707('0x39')](db[_0x4707('0x34')]['rawAttributes']);_0xa711db[_0x4707('0x38')]=_[_0x4707('0x39')](_0x20937d[_0x4707('0x38')]);_0xa711db['filters']=_['intersection'](_0xa711db['model'],_0xa711db['query']);_0x255926[_0x4707('0x3e')]=_[_0x4707('0x3b')](_0xa711db['model'],qs['fields'](_0x20937d[_0x4707('0x38')][_0x4707('0x3d')]));_0x255926['attributes']=_0x255926['attributes'][_0x4707('0x3f')]?_0x255926[_0x4707('0x3e')]:_0xa711db[_0x4707('0x3c')];if(_0x20937d[_0x4707('0x38')][_0x4707('0x4b')]){_0x255926['include']=[{'all':!![]}];}_0x255926=_[_0x4707('0x47')]({},_0x255926,_0x20937d[_0x4707('0x49')]);return db[_0x4707('0x34')][_0x4707('0x51')](_0x255926)['then'](handleEntityNotFound(_0x340a86,null))[_0x4707('0x2c')](respondWithResult(_0x340a86,null))[_0x4707('0x52')](handleError(_0x340a86,null));};exports['create']=function(_0x1772b0,_0x17eab8){return db['Dashboard'][_0x4707('0x53')](_0x1772b0['body'],{})[_0x4707('0x2c')](function(_0x3b0d08){var _0x2ab646=_0x1772b0[_0x4707('0x54')][_0x4707('0x2e')]({'plain':!![]});if(!_0x2ab646)throw new Error(_0x4707('0x55'));if(_0x2ab646[_0x4707('0x56')]===_0x4707('0x54')){var _0x2cd8b1=_0x3b0d08[_0x4707('0x2e')]({'plain':!![]});var _0x504685=_0x4707('0x2f');return db[_0x4707('0x57')]['find']({'where':{'name':_0x504685,'userProfileId':_0x2ab646[_0x4707('0x58')]},'raw':!![]})[_0x4707('0x2c')](function(_0x3b3566){if(_0x3b3566&&_0x3b3566['autoAssociation']===0x0){return db['UserProfileResource'][_0x4707('0x53')]({'name':_0x2cd8b1[_0x4707('0x37')],'resourceId':_0x2cd8b1['id'],'type':_0x3b3566[_0x4707('0x37')],'sectionId':_0x3b3566['id']},{})[_0x4707('0x2c')](function(){return _0x3b0d08;});}else{return _0x3b0d08;}})['catch'](function(_0x397aed){logger['error'](_0x4707('0x59'),_0x397aed);throw _0x397aed;});}return _0x3b0d08;})[_0x4707('0x2c')](respondWithResult(_0x17eab8,0xc9))[_0x4707('0x52')](handleError(_0x17eab8,null));};exports[_0x4707('0x5a')]=function(_0x2bd2e5,_0x1d94b0){var _0x4dbf80={'where':{'id':_0x2bd2e5['params']['id']}},_0x3ee528={};_0x3ee528[_0x4707('0x3c')]=_['keys'](db[_0x4707('0x34')][_0x4707('0x35')]);_0x4dbf80[_0x4707('0x3e')]=_[_0x4707('0x3b')](_0x3ee528['model'],qs[_0x4707('0x3d')](_0x2bd2e5[_0x4707('0x38')]['fields']));_0x4dbf80[_0x4707('0x3e')]=_0x4dbf80[_0x4707('0x3e')][_0x4707('0x3f')]?_0x4dbf80[_0x4707('0x3e')]:_0x3ee528[_0x4707('0x3c')];if(_0x2bd2e5[_0x4707('0x38')][_0x4707('0x4b')]){_0x4dbf80[_0x4707('0x4c')]=[{'all':!![]}];}_0x4dbf80=_[_0x4707('0x47')]({},_0x4dbf80,_0x2bd2e5[_0x4707('0x49')]);return db[_0x4707('0x34')][_0x4707('0x51')](_0x4dbf80)[_0x4707('0x2c')](handleEntityNotFound(_0x1d94b0,null))[_0x4707('0x2c')](function(_0x37a638){if(_0x37a638){var _0x1357c3=_0x37a638[_0x4707('0x2e')]({'plain':!![]});_0x1357c3=qs[_0x4707('0x5b')](_0x1357c3,['id',_0x4707('0x5c'),'updatedAt']);_0x2bd2e5[_0x4707('0x5d')]=_[_0x4707('0x5b')](_0x2bd2e5['body'],['id',_0x4707('0x5c'),_0x4707('0x5e')]);return db[_0x4707('0x34')][_0x4707('0x53')](_[_0x4707('0x47')](_0x1357c3,_0x2bd2e5['body']),{'include':_0x2bd2e5[_0x4707('0x38')][_0x4707('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x255e63){var _0x51a727=_0x2bd2e5[_0x4707('0x54')][_0x4707('0x2e')]({'plain':!![]});if(!_0x51a727)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51a727[_0x4707('0x56')]===_0x4707('0x54')){var _0x1d8024=_0x255e63[_0x4707('0x2e')]({'plain':!![]});var _0x1406e0=_0x4707('0x2f');return db['UserProfileSection'][_0x4707('0x51')]({'where':{'name':_0x1406e0,'userProfileId':_0x51a727['userProfileId']},'raw':!![]})[_0x4707('0x2c')](function(_0x5f1dfa){if(_0x5f1dfa&&_0x5f1dfa[_0x4707('0x5f')]===0x0){return db[_0x4707('0x30')]['create']({'name':_0x1d8024['name'],'resourceId':_0x1d8024['id'],'type':_0x5f1dfa[_0x4707('0x37')],'sectionId':_0x5f1dfa['id']},{})['then'](function(){return _0x255e63;});}else{return _0x255e63;}})[_0x4707('0x52')](function(_0x1e39b0){logger[_0x4707('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e39b0);throw _0x1e39b0;});}return _0x255e63;});}})[_0x4707('0x2c')](respondWithResult(_0x1d94b0,0xc9))[_0x4707('0x52')](handleError(_0x1d94b0,null));};exports['update']=function(_0x2729e0,_0x450dff){if(_0x2729e0['body']['id']){delete _0x2729e0[_0x4707('0x5d')]['id'];}return db[_0x4707('0x34')]['find']({'where':{'id':_0x2729e0[_0x4707('0x50')]['id']}})[_0x4707('0x2c')](handleEntityNotFound(_0x450dff,null))[_0x4707('0x2c')](saveUpdates(_0x2729e0[_0x4707('0x5d')],null))[_0x4707('0x2c')](respondWithResult(_0x450dff,null))[_0x4707('0x52')](handleError(_0x450dff,null));};exports['destroy']=function(_0x38d6c8,_0x14541b){return db[_0x4707('0x34')][_0x4707('0x51')]({'where':{'id':_0x38d6c8[_0x4707('0x50')]['id']}})[_0x4707('0x2c')](handleEntityNotFound(_0x14541b,null))[_0x4707('0x2c')](removeEntity(_0x14541b,null))[_0x4707('0x52')](handleError(_0x14541b,null));};function widgetAttributes(_0x3718b0){try{switch(_0x3718b0[_0x4707('0x36')]){case _0x4707('0x61'):return[{'name':'attrUrl','value':_0x3718b0[_0x4707('0x62')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0['attrs'][0x0]?_0x3718b0['attrs'][0x0][_0x4707('0x64')]:undefined)||'https://'}];case _0x4707('0x65'):return[{'name':_0x4707('0x66'),'value':_0x3718b0[_0x4707('0x66')]||(_0x3718b0['attrs']&&_0x3718b0[_0x4707('0x63')][0x0]?_0x3718b0[_0x4707('0x63')][0x0][_0x4707('0x64')]:undefined)||''}];case _0x4707('0x67'):return[{'name':_0x4707('0x68'),'value':_0x3718b0[_0x4707('0x68')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0['attrs'][0x0]?_0x3718b0[_0x4707('0x63')][0x0][_0x4707('0x64')]:undefined)||'HH:mm:ss'},{'name':_0x4707('0x69'),'value':_0x3718b0[_0x4707('0x69')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0['attrs'][0x1]?_0x3718b0['attrs'][0x1][_0x4707('0x64')]:undefined)||'0.00'},{'name':_0x4707('0x6a'),'value':_0x3718b0[_0x4707('0x6a')]||(_0x3718b0['attrs']&&_0x3718b0['attrs'][0x2]?_0x3718b0[_0x4707('0x63')][0x2][_0x4707('0x64')]:undefined)||0xc}];case _0x4707('0x6b'):return[{'name':'attrMetric','value':_0x3718b0['attrMetric']||(_0x3718b0['attrs']&&_0x3718b0[_0x4707('0x63')][0x0]?_0x3718b0['attrs'][0x0][_0x4707('0x64')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x3718b0[_0x4707('0x6c')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x1]?_0x3718b0[_0x4707('0x63')][0x1][_0x4707('0x64')]:undefined)||[]},{'name':'attrFontSize','value':_0x3718b0['attrFontSize']||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x2]?_0x3718b0[_0x4707('0x63')][0x2][_0x4707('0x64')]:undefined)||0x14},{'name':_0x4707('0x6d'),'value':_0x3718b0[_0x4707('0x6d')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x3]?_0x3718b0['attrs'][0x3][_0x4707('0x64')]:undefined)||_0x4707('0x6e')},{'name':_0x4707('0x6f'),'value':_0x3718b0[_0x4707('0x6f')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x4]?_0x3718b0[_0x4707('0x63')][0x4]['value']:undefined)||''},{'name':_0x4707('0x70'),'value':_0x3718b0[_0x4707('0x70')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0['attrs'][0x5]?_0x3718b0[_0x4707('0x63')][0x5][_0x4707('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3718b0[_0x4707('0x71')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x6]?_0x3718b0['attrs'][0x6][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x72'),'value':_0x3718b0[_0x4707('0x72')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x7]?_0x3718b0['attrs'][0x7][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x73'),'value':_0x3718b0[_0x4707('0x73')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x8]?_0x3718b0['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3718b0[_0x4707('0x74')]||(_0x3718b0['attrs']&&_0x3718b0[_0x4707('0x63')][0x9]?_0x3718b0[_0x4707('0x63')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x4707('0x75'),'value':_0x3718b0[_0x4707('0x75')]||(_0x3718b0['attrs']&&_0x3718b0[_0x4707('0x63')][0x0]?_0x3718b0[_0x4707('0x63')][0x0][_0x4707('0x64')]:undefined)||_0x4707('0x76')},{'name':'attrSerie2','value':_0x3718b0[_0x4707('0x77')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x1]?_0x3718b0[_0x4707('0x63')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3718b0[_0x4707('0x78')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x2]?_0x3718b0['attrs'][0x2][_0x4707('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3718b0[_0x4707('0x6c')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x3]?_0x3718b0[_0x4707('0x63')][0x3][_0x4707('0x64')]:undefined)||[]},{'name':_0x4707('0x6d'),'value':_0x3718b0[_0x4707('0x6d')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x4]?_0x3718b0[_0x4707('0x63')][0x4]['value']:undefined)||'voice'},{'name':_0x4707('0x6f'),'value':_0x3718b0[_0x4707('0x6f')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0['attrs'][0x5]?_0x3718b0[_0x4707('0x63')][0x5][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x70'),'value':_0x3718b0[_0x4707('0x70')]||(_0x3718b0['attrs']&&_0x3718b0[_0x4707('0x63')][0x6]?_0x3718b0['attrs'][0x6][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x71'),'value':_0x3718b0[_0x4707('0x71')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x7]?_0x3718b0['attrs'][0x7][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x72'),'value':_0x3718b0[_0x4707('0x72')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x8]?_0x3718b0[_0x4707('0x63')][0x8][_0x4707('0x64')]:undefined)||''},{'name':_0x4707('0x73'),'value':_0x3718b0[_0x4707('0x73')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x9]?_0x3718b0['attrs'][0x9][_0x4707('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3718b0[_0x4707('0x74')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0xa]?_0x3718b0['attrs'][0xa][_0x4707('0x64')]:undefined)||''}];case'web-report':return[{'name':_0x4707('0x79'),'type':_0x3718b0[_0x4707('0x7a')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x0]?_0x3718b0[_0x4707('0x63')][0x0][_0x4707('0x36')]:undefined)||null,'value':_0x3718b0[_0x4707('0x79')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x0]?_0x3718b0[_0x4707('0x63')][0x0][_0x4707('0x64')]:undefined)||null},{'name':_0x4707('0x7b'),'value':_0x3718b0[_0x4707('0x7b')]||(_0x3718b0[_0x4707('0x63')]&&_0x3718b0[_0x4707('0x63')][0x1]?_0x3718b0[_0x4707('0x63')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xf5dc7e){logger[_0x4707('0x60')](_0x4707('0x7c'),JSON[_0x4707('0x7d')](_0xf5dc7e));return[];}}exports[_0x4707('0x7e')]=function(_0x41e947,_0x192398,_0x5cf850){if(_0x41e947['body']['id']){delete _0x41e947[_0x4707('0x5d')]['id'];}return db['Dashboard'][_0x4707('0x51')]({'where':{'id':_0x41e947[_0x4707('0x50')]['id']}})[_0x4707('0x2c')](handleEntityNotFound(_0x192398,null))[_0x4707('0x2c')](function(_0x2e81f1){if(_0x2e81f1){_0x41e947['body'][_0x4707('0x7f')]=_0x2e81f1['id'];_0x41e947[_0x4707('0x5d')][_0x4707('0x63')]=widgetAttributes(_0x41e947[_0x4707('0x5d')]);return db[_0x4707('0x80')]['create'](_0x41e947['body']);}})[_0x4707('0x2c')](respondWithResult(_0x192398,null))[_0x4707('0x52')](handleError(_0x192398,null));};exports['getItems']=function(_0x10d312,_0x485842,_0x5e505f){var _0x2735ef={};var _0x33f55b={};var _0x1df77a;var _0x5a1f0f;return db[_0x4707('0x34')]['findOne']({'where':{'id':_0x10d312[_0x4707('0x50')]['id']}})[_0x4707('0x2c')](handleEntityNotFound(_0x485842,null))[_0x4707('0x2c')](function(_0xd3ff){if(_0xd3ff){_0x1df77a=_0xd3ff;_0x33f55b['model']=_[_0x4707('0x39')](db[_0x4707('0x80')]['rawAttributes']);_0x33f55b[_0x4707('0x38')]=_['keys'](_0x10d312[_0x4707('0x38')]);_0x33f55b['filters']=_[_0x4707('0x3b')](_0x33f55b[_0x4707('0x3c')],_0x33f55b['query']);_0x2735ef[_0x4707('0x3e')]=_[_0x4707('0x3b')](_0x33f55b['model'],qs[_0x4707('0x3d')](_0x10d312[_0x4707('0x38')][_0x4707('0x3d')]));_0x2735ef[_0x4707('0x3e')]=_0x2735ef[_0x4707('0x3e')][_0x4707('0x3f')]?_0x2735ef[_0x4707('0x3e')]:_0x33f55b[_0x4707('0x3c')];_0x2735ef[_0x4707('0x42')]=qs[_0x4707('0x43')](_0x10d312[_0x4707('0x38')][_0x4707('0x43')]);_0x2735ef[_0x4707('0x44')]=qs[_0x4707('0x3a')](_[_0x4707('0x45')](_0x10d312[_0x4707('0x38')],_0x33f55b[_0x4707('0x3a')]));if(_0x10d312[_0x4707('0x38')]['filter']){_0x2735ef['where']=_['merge'](_0x2735ef['where'],{'$or':_['map'](_0x2735ef['attributes'],function(_0x333dd5){var _0x534a34={};_0x534a34[_0x333dd5]={'$like':'%'+_0x10d312[_0x4707('0x38')][_0x4707('0x46')]+'%'};return _0x534a34;})});}_0x2735ef=_[_0x4707('0x47')]({},_0x2735ef,_0x10d312[_0x4707('0x49')]);return _0x1df77a[_0x4707('0x81')](_0x2735ef);}})[_0x4707('0x2c')](function(_0x29c5c3){if(_0x29c5c3){_0x5a1f0f=_0x29c5c3['length'];if(!_0x10d312[_0x4707('0x38')]['hasOwnProperty'](_0x4707('0x41'))){_0x2735ef[_0x4707('0x25')]=qs['limit'](_0x10d312[_0x4707('0x38')]['limit']);_0x2735ef['offset']=qs[_0x4707('0x27')](_0x10d312['query'][_0x4707('0x27')]);}return _0x1df77a[_0x4707('0x81')](_0x2735ef);}})[_0x4707('0x2c')](function(_0x3119d8){if(_0x3119d8){return _0x3119d8?{'count':_0x5a1f0f,'rows':_0x3119d8}:null;}})[_0x4707('0x2c')](respondWithResult(_0x485842,null))['catch'](handleError(_0x485842,null));}; \ No newline at end of file +var _0xf26a=['counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','findOne','order','pick','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','Dashboard','includeAll','include','rows','catch','show','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','params','omit','createdAt','updatedAt','body','update','iframe','attrUrl','attrs','https://','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x47ead1,_0x1bd492){var _0x3684ec=function(_0x503796){while(--_0x503796){_0x47ead1['push'](_0x47ead1['shift']());}};_0x3684ec(++_0x1bd492);}(_0xf26a,0x1a4));var _0xaf26=function(_0xce735a,_0x110122){_0xce735a=_0xce735a-0x0;var _0x1dfea6=_0xf26a[_0xce735a];return _0x1dfea6;};'use strict';var emlformat=require(_0xaf26('0x0'));var rimraf=require(_0xaf26('0x1'));var zipdir=require(_0xaf26('0x2'));var jsonpatch=require(_0xaf26('0x3'));var rp=require(_0xaf26('0x4'));var moment=require(_0xaf26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf26('0x6'));var util=require(_0xaf26('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xaf26('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf26('0x9'));var _=require(_0xaf26('0xa'));var squel=require(_0xaf26('0xb'));var crypto=require(_0xaf26('0xc'));var jsforce=require(_0xaf26('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaf26('0x8'));var querystring=require(_0xaf26('0xe'));var Papa=require(_0xaf26('0xf'));var Redis=require(_0xaf26('0x10'));var authService=require(_0xaf26('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf26('0x12'));var hardwareService=require(_0xaf26('0x13'));var logger=require('../../config/logger')(_0xaf26('0x14'));var utils=require('../../config/utils');var config=require(_0xaf26('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf26('0x16'))['db'];config[_0xaf26('0x17')]=_[_0xaf26('0x18')](config['redis'],{'host':_0xaf26('0x19'),'port':0x18eb});var socket=require(_0xaf26('0x1a'))(new Redis(config[_0xaf26('0x17')]));require(_0xaf26('0x1b'))[_0xaf26('0x1c')](socket);function respondWithStatusCode(_0x47ed33,_0x2155cc){_0x2155cc=_0x2155cc||0xcc;return function(_0x5bff74){if(_0x5bff74){return _0x47ed33[_0xaf26('0x1d')](_0x2155cc);}return _0x47ed33['status'](_0x2155cc)[_0xaf26('0x1e')]();};}function respondWithResult(_0x374aff,_0x218cad){_0x218cad=_0x218cad||0xc8;return function(_0x25ada2){if(_0x25ada2){return _0x374aff[_0xaf26('0x1f')](_0x218cad)['json'](_0x25ada2);}};}function respondWithFilteredResult(_0x2b3526,_0x195682){return function(_0x5d8edc){if(_0x5d8edc){var _0x2a87a3=typeof _0x195682[_0xaf26('0x20')]===_0xaf26('0x21')&&typeof _0x195682[_0xaf26('0x22')]==='undefined';var _0x41ce95=_0x5d8edc[_0xaf26('0x23')];var _0x4be032=_0x2a87a3?0x0:_0x195682[_0xaf26('0x20')];var _0x32371c=_0x2a87a3?_0x5d8edc[_0xaf26('0x23')]:_0x195682[_0xaf26('0x20')]+_0x195682['limit'];var _0x4b361f;if(_0x32371c>=_0x41ce95){_0x32371c=_0x41ce95;_0x4b361f=0xc8;}else{_0x4b361f=0xce;}_0x2b3526['status'](_0x4b361f);return _0x2b3526[_0xaf26('0x24')](_0xaf26('0x25'),_0x4be032+'-'+_0x32371c+'/'+_0x41ce95)[_0xaf26('0x26')](_0x5d8edc);}return null;};}function patchUpdates(_0x4a5e8c){return function(_0x54a487){try{jsonpatch[_0xaf26('0x27')](_0x54a487,_0x4a5e8c,!![]);}catch(_0x38c240){return BPromise['reject'](_0x38c240);}return _0x54a487[_0xaf26('0x28')]();};}function saveUpdates(_0x27935a,_0x2edd12){return function(_0x5cb42b){if(_0x5cb42b){return _0x5cb42b['update'](_0x27935a)[_0xaf26('0x29')](function(_0x266050){return _0x266050;});}return null;};}function removeEntity(_0x58116a,_0xb57c1b){return function(_0x5620ec){if(_0x5620ec){return _0x5620ec[_0xaf26('0x2a')]()[_0xaf26('0x29')](function(){var _0x1e4278=_0x5620ec[_0xaf26('0x2b')]({'plain':!![]});var _0x1611e7=_0xaf26('0x2c');return db[_0xaf26('0x2d')][_0xaf26('0x2a')]({'where':{'type':_0x1611e7,'resourceId':_0x1e4278['id']}})[_0xaf26('0x29')](function(){return _0x5620ec;});})[_0xaf26('0x29')](function(){_0x58116a[_0xaf26('0x1f')](0xcc)[_0xaf26('0x1e')]();});}};}function handleEntityNotFound(_0x3c1d65,_0x10aeab){return function(_0x473923){if(!_0x473923){_0x3c1d65[_0xaf26('0x1d')](0x194);}return _0x473923;};}function handleError(_0x5481eb,_0x430f44){_0x430f44=_0x430f44||0x1f4;return function(_0x155024){logger[_0xaf26('0x2e')](_0x155024[_0xaf26('0x2f')]);if(_0x155024['name']){delete _0x155024[_0xaf26('0x30')];}_0x5481eb[_0xaf26('0x1f')](_0x430f44)['send'](_0x155024);};}exports[_0xaf26('0x31')]=function(_0x22901f,_0x3c45d6){var _0x16e187={},_0x27e7d5={},_0x4853c2={'count':0x0,'rows':[]};var _0x2e61ac=_['map'](db['Dashboard'][_0xaf26('0x32')],function(_0x1f7265){return{'name':_0x1f7265[_0xaf26('0x33')],'type':_0x1f7265[_0xaf26('0x34')][_0xaf26('0x35')]};});_0x27e7d5[_0xaf26('0x36')]=_[_0xaf26('0x37')](_0x2e61ac,_0xaf26('0x30'));_0x27e7d5[_0xaf26('0x38')]=_[_0xaf26('0x39')](_0x22901f[_0xaf26('0x38')]);_0x27e7d5[_0xaf26('0x3a')]=_[_0xaf26('0x3b')](_0x27e7d5['model'],_0x27e7d5['query']);_0x16e187['attributes']=_['intersection'](_0x27e7d5[_0xaf26('0x36')],qs[_0xaf26('0x3c')](_0x22901f[_0xaf26('0x38')]['fields']));_0x16e187[_0xaf26('0x3d')]=_0x16e187[_0xaf26('0x3d')][_0xaf26('0x3e')]?_0x16e187[_0xaf26('0x3d')]:_0x27e7d5[_0xaf26('0x36')];if(!_0x22901f[_0xaf26('0x38')][_0xaf26('0x3f')](_0xaf26('0x40'))){_0x16e187['limit']=qs['limit'](_0x22901f[_0xaf26('0x38')][_0xaf26('0x22')]);_0x16e187[_0xaf26('0x20')]=qs[_0xaf26('0x20')](_0x22901f[_0xaf26('0x38')][_0xaf26('0x20')]);}_0x16e187['order']=qs[_0xaf26('0x41')](_0x22901f[_0xaf26('0x38')]['sort']);_0x16e187['where']=qs[_0xaf26('0x3a')](_['pick'](_0x22901f['query'],_0x27e7d5['filters']),_0x2e61ac);if(_0x22901f['query'][_0xaf26('0x42')]){_0x16e187['where']=_[_0xaf26('0x43')](_0x16e187['where'],{'$or':_['map'](_0x2e61ac,function(_0x1ee6a7){if(_0x1ee6a7['type']!==_0xaf26('0x44')){var _0x483de6={};_0x483de6[_0x1ee6a7[_0xaf26('0x30')]]={'$like':'%'+_0x22901f[_0xaf26('0x38')]['filter']+'%'};return _0x483de6;}})});}_0x16e187=_['merge']({},_0x16e187,_0x22901f[_0xaf26('0x45')]);var _0x4a09ae={'where':_0x16e187[_0xaf26('0x46')]};return db[_0xaf26('0x47')][_0xaf26('0x23')](_0x4a09ae)['then'](function(_0x474ac8){_0x4853c2[_0xaf26('0x23')]=_0x474ac8;if(_0x22901f[_0xaf26('0x38')][_0xaf26('0x48')]){_0x16e187[_0xaf26('0x49')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x16e187);})[_0xaf26('0x29')](function(_0x3398a8){_0x4853c2[_0xaf26('0x4a')]=_0x3398a8;return _0x4853c2;})[_0xaf26('0x29')](respondWithFilteredResult(_0x3c45d6,_0x16e187))[_0xaf26('0x4b')](handleError(_0x3c45d6,null));};exports[_0xaf26('0x4c')]=function(_0x343d95,_0x25a0e1){var _0x319d2b={'raw':![],'where':{'id':_0x343d95['params']['id']}},_0x289b49={};_0x289b49[_0xaf26('0x36')]=_[_0xaf26('0x39')](db['Dashboard']['rawAttributes']);_0x289b49[_0xaf26('0x38')]=_[_0xaf26('0x39')](_0x343d95[_0xaf26('0x38')]);_0x289b49[_0xaf26('0x3a')]=_[_0xaf26('0x3b')](_0x289b49[_0xaf26('0x36')],_0x289b49['query']);_0x319d2b[_0xaf26('0x3d')]=_['intersection'](_0x289b49['model'],qs[_0xaf26('0x3c')](_0x343d95[_0xaf26('0x38')][_0xaf26('0x3c')]));_0x319d2b[_0xaf26('0x3d')]=_0x319d2b[_0xaf26('0x3d')][_0xaf26('0x3e')]?_0x319d2b[_0xaf26('0x3d')]:_0x289b49[_0xaf26('0x36')];if(_0x343d95[_0xaf26('0x38')][_0xaf26('0x48')]){_0x319d2b[_0xaf26('0x49')]=[{'all':!![]}];}_0x319d2b=_[_0xaf26('0x43')]({},_0x319d2b,_0x343d95['options']);return db[_0xaf26('0x47')][_0xaf26('0x4d')](_0x319d2b)[_0xaf26('0x29')](handleEntityNotFound(_0x25a0e1,null))[_0xaf26('0x29')](respondWithResult(_0x25a0e1,null))[_0xaf26('0x4b')](handleError(_0x25a0e1,null));};exports['create']=function(_0x32001d,_0x1d3360){return db[_0xaf26('0x47')][_0xaf26('0x4e')](_0x32001d['body'],{})[_0xaf26('0x29')](function(_0x3dd30a){var _0x11973e=_0x32001d[_0xaf26('0x4f')]['get']({'plain':!![]});if(!_0x11973e)throw new Error(_0xaf26('0x50'));if(_0x11973e[_0xaf26('0x51')]===_0xaf26('0x4f')){var _0x5ced93=_0x3dd30a[_0xaf26('0x2b')]({'plain':!![]});var _0x100169=_0xaf26('0x2c');return db[_0xaf26('0x52')][_0xaf26('0x4d')]({'where':{'name':_0x100169,'userProfileId':_0x11973e[_0xaf26('0x53')]},'raw':!![]})[_0xaf26('0x29')](function(_0x3a31de){if(_0x3a31de&&_0x3a31de[_0xaf26('0x54')]===0x0){return db[_0xaf26('0x2d')][_0xaf26('0x4e')]({'name':_0x5ced93[_0xaf26('0x30')],'resourceId':_0x5ced93['id'],'type':_0x3a31de[_0xaf26('0x30')],'sectionId':_0x3a31de['id']},{})['then'](function(){return _0x3dd30a;});}else{return _0x3dd30a;}})['catch'](function(_0x18cd4a){logger[_0xaf26('0x2e')](_0xaf26('0x55'),_0x18cd4a);throw _0x18cd4a;});}return _0x3dd30a;})[_0xaf26('0x29')](respondWithResult(_0x1d3360,0xc9))[_0xaf26('0x4b')](handleError(_0x1d3360,null));};exports[_0xaf26('0x56')]=function(_0x2a6a87,_0xb998c7){var _0x2cfa69={'where':{'id':_0x2a6a87[_0xaf26('0x57')]['id']}},_0x1e7f17={};_0x1e7f17[_0xaf26('0x36')]=_['keys'](db[_0xaf26('0x47')][_0xaf26('0x32')]);_0x2cfa69['attributes']=_[_0xaf26('0x3b')](_0x1e7f17[_0xaf26('0x36')],qs[_0xaf26('0x3c')](_0x2a6a87[_0xaf26('0x38')][_0xaf26('0x3c')]));_0x2cfa69[_0xaf26('0x3d')]=_0x2cfa69[_0xaf26('0x3d')][_0xaf26('0x3e')]?_0x2cfa69['attributes']:_0x1e7f17[_0xaf26('0x36')];if(_0x2a6a87['query'][_0xaf26('0x48')]){_0x2cfa69['include']=[{'all':!![]}];}_0x2cfa69=_[_0xaf26('0x43')]({},_0x2cfa69,_0x2a6a87[_0xaf26('0x45')]);return db[_0xaf26('0x47')][_0xaf26('0x4d')](_0x2cfa69)['then'](handleEntityNotFound(_0xb998c7,null))['then'](function(_0x428602){if(_0x428602){var _0x39832c=_0x428602[_0xaf26('0x2b')]({'plain':!![]});_0x39832c=qs[_0xaf26('0x58')](_0x39832c,['id',_0xaf26('0x59'),_0xaf26('0x5a')]);_0x2a6a87[_0xaf26('0x5b')]=_[_0xaf26('0x58')](_0x2a6a87[_0xaf26('0x5b')],['id',_0xaf26('0x59'),_0xaf26('0x5a')]);return db['Dashboard'][_0xaf26('0x4e')](_[_0xaf26('0x43')](_0x39832c,_0x2a6a87['body']),{'include':_0x2a6a87[_0xaf26('0x38')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x37095f){var _0x31b50f=_0x2a6a87[_0xaf26('0x4f')][_0xaf26('0x2b')]({'plain':!![]});if(!_0x31b50f)throw new Error(_0xaf26('0x50'));if(_0x31b50f['role']===_0xaf26('0x4f')){var _0x58a0f0=_0x37095f[_0xaf26('0x2b')]({'plain':!![]});var _0x4b966c='CustomDashboards';return db['UserProfileSection'][_0xaf26('0x4d')]({'where':{'name':_0x4b966c,'userProfileId':_0x31b50f[_0xaf26('0x53')]},'raw':!![]})[_0xaf26('0x29')](function(_0x5d72dc){if(_0x5d72dc&&_0x5d72dc['autoAssociation']===0x0){return db[_0xaf26('0x2d')]['create']({'name':_0x58a0f0['name'],'resourceId':_0x58a0f0['id'],'type':_0x5d72dc['name'],'sectionId':_0x5d72dc['id']},{})[_0xaf26('0x29')](function(){return _0x37095f;});}else{return _0x37095f;}})[_0xaf26('0x4b')](function(_0x325e13){logger[_0xaf26('0x2e')](_0xaf26('0x55'),_0x325e13);throw _0x325e13;});}return _0x37095f;});}})['then'](respondWithResult(_0xb998c7,0xc9))[_0xaf26('0x4b')](handleError(_0xb998c7,null));};exports[_0xaf26('0x5c')]=function(_0x2f9b11,_0x121587){if(_0x2f9b11[_0xaf26('0x5b')]['id']){delete _0x2f9b11[_0xaf26('0x5b')]['id'];}return db[_0xaf26('0x47')][_0xaf26('0x4d')]({'where':{'id':_0x2f9b11[_0xaf26('0x57')]['id']}})['then'](handleEntityNotFound(_0x121587,null))[_0xaf26('0x29')](saveUpdates(_0x2f9b11[_0xaf26('0x5b')],null))['then'](respondWithResult(_0x121587,null))[_0xaf26('0x4b')](handleError(_0x121587,null));};exports[_0xaf26('0x2a')]=function(_0x554ccc,_0x1eb6c5){return db[_0xaf26('0x47')]['find']({'where':{'id':_0x554ccc[_0xaf26('0x57')]['id']}})[_0xaf26('0x29')](handleEntityNotFound(_0x1eb6c5,null))[_0xaf26('0x29')](removeEntity(_0x1eb6c5,null))[_0xaf26('0x4b')](handleError(_0x1eb6c5,null));};function widgetAttributes(_0xa9c16){try{switch(_0xa9c16[_0xaf26('0x34')]){case _0xaf26('0x5d'):return[{'name':_0xaf26('0x5e'),'value':_0xa9c16['attrUrl']||(_0xa9c16['attrs']&&_0xa9c16['attrs'][0x0]?_0xa9c16[_0xaf26('0x5f')][0x0]['value']:undefined)||_0xaf26('0x60')}];case'custom':return[{'name':_0xaf26('0x61'),'value':_0xa9c16[_0xaf26('0x61')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0xa9c16[_0xaf26('0x62')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16[_0xaf26('0x5f')][0x0][_0xaf26('0x63')]:undefined)||_0xaf26('0x64')},{'name':_0xaf26('0x65'),'value':_0xa9c16[_0xaf26('0x65')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x1]?_0xa9c16['attrs'][0x1][_0xaf26('0x63')]:undefined)||_0xaf26('0x66')},{'name':_0xaf26('0x67'),'value':_0xa9c16[_0xaf26('0x67')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x2]?_0xa9c16[_0xaf26('0x5f')][0x2]['value']:undefined)||0xc}];case _0xaf26('0x68'):return[{'name':_0xaf26('0x69'),'value':_0xa9c16[_0xaf26('0x69')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16[_0xaf26('0x5f')][0x0]['value']:undefined)||_0xaf26('0x6a')},{'name':_0xaf26('0x6b'),'value':_0xa9c16[_0xaf26('0x6b')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x1]?_0xa9c16[_0xaf26('0x5f')][0x1][_0xaf26('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0xa9c16[_0xaf26('0x67')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x2]?_0xa9c16['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xaf26('0x6c'),'value':_0xa9c16[_0xaf26('0x6c')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x3]?_0xa9c16[_0xaf26('0x5f')][0x3][_0xaf26('0x63')]:undefined)||_0xaf26('0x6d')},{'name':_0xaf26('0x6e'),'value':_0xa9c16[_0xaf26('0x6e')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x4]?_0xa9c16['attrs'][0x4][_0xaf26('0x63')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xa9c16[_0xaf26('0x6f')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x5]?_0xa9c16['attrs'][0x5][_0xaf26('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xa9c16[_0xaf26('0x70')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x6]?_0xa9c16[_0xaf26('0x5f')][0x6][_0xaf26('0x63')]:undefined)||''},{'name':_0xaf26('0x71'),'value':_0xa9c16[_0xaf26('0x71')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x7]?_0xa9c16[_0xaf26('0x5f')][0x7]['value']:undefined)||''},{'name':_0xaf26('0x72'),'value':_0xa9c16[_0xaf26('0x72')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x8]?_0xa9c16[_0xaf26('0x5f')][0x8]['value']:undefined)||''},{'name':_0xaf26('0x73'),'value':_0xa9c16[_0xaf26('0x73')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x9]?_0xa9c16['attrs'][0x9][_0xaf26('0x63')]:undefined)||''}];case'multibar-chart':case _0xaf26('0x74'):return[{'name':_0xaf26('0x75'),'value':_0xa9c16[_0xaf26('0x75')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16['attrs'][0x0][_0xaf26('0x63')]:undefined)||'total'},{'name':_0xaf26('0x76'),'value':_0xa9c16[_0xaf26('0x76')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x1]?_0xa9c16[_0xaf26('0x5f')][0x1][_0xaf26('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0xa9c16[_0xaf26('0x77')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x2]?_0xa9c16['attrs'][0x2][_0xaf26('0x63')]:undefined)||null},{'name':_0xaf26('0x6b'),'value':_0xa9c16['attrVoiceQueues']||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x3]?_0xa9c16[_0xaf26('0x5f')][0x3][_0xaf26('0x63')]:undefined)||[]},{'name':_0xaf26('0x6c'),'value':_0xa9c16[_0xaf26('0x6c')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x4]?_0xa9c16['attrs'][0x4][_0xaf26('0x63')]:undefined)||_0xaf26('0x6d')},{'name':_0xaf26('0x6e'),'value':_0xa9c16['attrEmailAccounts']||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x5]?_0xa9c16['attrs'][0x5][_0xaf26('0x63')]:undefined)||''},{'name':_0xaf26('0x6f'),'value':_0xa9c16[_0xaf26('0x6f')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x6]?_0xa9c16[_0xaf26('0x5f')][0x6]['value']:undefined)||''},{'name':_0xaf26('0x70'),'value':_0xa9c16[_0xaf26('0x70')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x7]?_0xa9c16[_0xaf26('0x5f')][0x7][_0xaf26('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xa9c16[_0xaf26('0x71')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16['attrs'][0x8]?_0xa9c16[_0xaf26('0x5f')][0x8][_0xaf26('0x63')]:undefined)||''},{'name':_0xaf26('0x72'),'value':_0xa9c16[_0xaf26('0x72')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x9]?_0xa9c16['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xa9c16['attrChatWebsites']||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0xa]?_0xa9c16[_0xaf26('0x5f')][0xa][_0xaf26('0x63')]:undefined)||''}];case _0xaf26('0x78'):return[{'name':_0xaf26('0x79'),'type':_0xa9c16[_0xaf26('0x7a')]||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16[_0xaf26('0x5f')][0x0][_0xaf26('0x34')]:undefined)||null,'value':_0xa9c16['attrReport']||(_0xa9c16[_0xaf26('0x5f')]&&_0xa9c16[_0xaf26('0x5f')][0x0]?_0xa9c16[_0xaf26('0x5f')][0x0][_0xaf26('0x63')]:undefined)||null},{'name':_0xaf26('0x7b'),'value':_0xa9c16[_0xaf26('0x7b')]||(_0xa9c16['attrs']&&_0xa9c16[_0xaf26('0x5f')][0x1]?_0xa9c16[_0xaf26('0x5f')][0x1][_0xaf26('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x1cfbfc){logger['error'](_0xaf26('0x7c'),JSON['stringify'](_0x1cfbfc));return[];}}exports[_0xaf26('0x7d')]=function(_0x1c9baf,_0x51cbf0,_0x5cdd8b){if(_0x1c9baf['body']['id']){delete _0x1c9baf[_0xaf26('0x5b')]['id'];}return db['Dashboard'][_0xaf26('0x4d')]({'where':{'id':_0x1c9baf[_0xaf26('0x57')]['id']}})['then'](handleEntityNotFound(_0x51cbf0,null))[_0xaf26('0x29')](function(_0x3c50a6){if(_0x3c50a6){_0x1c9baf[_0xaf26('0x5b')]['DashboardId']=_0x3c50a6['id'];_0x1c9baf[_0xaf26('0x5b')]['attrs']=widgetAttributes(_0x1c9baf['body']);return db[_0xaf26('0x7e')][_0xaf26('0x4e')](_0x1c9baf['body']);}})[_0xaf26('0x29')](respondWithResult(_0x51cbf0,null))['catch'](handleError(_0x51cbf0,null));};exports['getItems']=function(_0x35353f,_0x23db6e,_0x1aff17){var _0x366b54={};var _0x3dcb8d={};var _0x226fbe;var _0x31f905;return db[_0xaf26('0x47')][_0xaf26('0x7f')]({'where':{'id':_0x35353f[_0xaf26('0x57')]['id']}})[_0xaf26('0x29')](handleEntityNotFound(_0x23db6e,null))[_0xaf26('0x29')](function(_0x18b6d5){if(_0x18b6d5){_0x226fbe=_0x18b6d5;_0x3dcb8d[_0xaf26('0x36')]=_[_0xaf26('0x39')](db[_0xaf26('0x7e')]['rawAttributes']);_0x3dcb8d['query']=_[_0xaf26('0x39')](_0x35353f[_0xaf26('0x38')]);_0x3dcb8d[_0xaf26('0x3a')]=_[_0xaf26('0x3b')](_0x3dcb8d[_0xaf26('0x36')],_0x3dcb8d[_0xaf26('0x38')]);_0x366b54[_0xaf26('0x3d')]=_[_0xaf26('0x3b')](_0x3dcb8d['model'],qs[_0xaf26('0x3c')](_0x35353f[_0xaf26('0x38')]['fields']));_0x366b54[_0xaf26('0x3d')]=_0x366b54[_0xaf26('0x3d')]['length']?_0x366b54['attributes']:_0x3dcb8d[_0xaf26('0x36')];_0x366b54[_0xaf26('0x80')]=qs[_0xaf26('0x41')](_0x35353f[_0xaf26('0x38')][_0xaf26('0x41')]);_0x366b54['where']=qs[_0xaf26('0x3a')](_[_0xaf26('0x81')](_0x35353f[_0xaf26('0x38')],_0x3dcb8d[_0xaf26('0x3a')]));if(_0x35353f[_0xaf26('0x38')]['filter']){_0x366b54['where']=_['merge'](_0x366b54[_0xaf26('0x46')],{'$or':_[_0xaf26('0x37')](_0x366b54[_0xaf26('0x3d')],function(_0x46120f){var _0x44ba76={};_0x44ba76[_0x46120f]={'$like':'%'+_0x35353f[_0xaf26('0x38')][_0xaf26('0x42')]+'%'};return _0x44ba76;})});}_0x366b54=_[_0xaf26('0x43')]({},_0x366b54,_0x35353f[_0xaf26('0x45')]);return _0x226fbe[_0xaf26('0x82')](_0x366b54);}})[_0xaf26('0x29')](function(_0x387553){if(_0x387553){_0x31f905=_0x387553[_0xaf26('0x3e')];if(!_0x35353f[_0xaf26('0x38')][_0xaf26('0x3f')]('nolimit')){_0x366b54[_0xaf26('0x22')]=qs[_0xaf26('0x22')](_0x35353f[_0xaf26('0x38')]['limit']);_0x366b54[_0xaf26('0x20')]=qs['offset'](_0x35353f[_0xaf26('0x38')]['offset']);}return _0x226fbe[_0xaf26('0x82')](_0x366b54);}})[_0xaf26('0x29')](function(_0x19094b){if(_0x19094b){return _0x19094b?{'count':_0x31f905,'rows':_0x19094b}:null;}})[_0xaf26('0x29')](respondWithResult(_0x23db6e,null))[_0xaf26('0x4b')](handleError(_0x23db6e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e4601b5..d11724a 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 _0x607c=['remove','emit','hook','exports','../../mysqldb','Dashboard','save','update'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x607c,0x1dc));var _0xc607=function(_0x3d624d,_0x4cc344){_0x3d624d=_0x3d624d-0x0;var _0x5bf42f=_0x607c[_0x3d624d];return _0x5bf42f;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xc607('0x0'))['db'][_0xc607('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc607('0x2'),'afterUpdate':_0xc607('0x3'),'afterDestroy':_0xc607('0x4')};function emitEvent(_0xe7ef3b){return function(_0x1f52d7,_0x4f16b8,_0x40249d){DashboardEvents[_0xc607('0x5')](_0xe7ef3b+':'+_0x1f52d7['id'],_0x1f52d7);DashboardEvents['emit'](_0xe7ef3b,_0x1f52d7);_0x40249d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xc607('0x6')](e,emitEvent(event));}}module[_0xc607('0x7')]=DashboardEvents; \ No newline at end of file +var _0x0880=['Dashboard','save','hook','exports','events'];(function(_0x5665bc,_0x4117e9){var _0x1e6072=function(_0x191688){while(--_0x191688){_0x5665bc['push'](_0x5665bc['shift']());}};_0x1e6072(++_0x4117e9);}(_0x0880,0x7c));var _0x0088=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x0880[_0xed9fea];return _0x198f12;};'use strict';var EventEmitter=require(_0x0088('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x0088('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0088('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cd1c5){return function(_0xac6cf3,_0x549a77,_0x516173){DashboardEvents['emit'](_0x4cd1c5+':'+_0xac6cf3['id'],_0xac6cf3);DashboardEvents['emit'](_0x4cd1c5,_0xac6cf3);_0x516173(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x0088('0x3')](e,emitEvent(event));}}module[_0x0088('0x4')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 0cfca0d..98f6f12 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 _0x183f=['define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x183f,0x1c9));var _0xf183=function(_0x2e16d1,_0x55af2c){_0x2e16d1=_0x2e16d1-0x0;var _0x499133=_0x183f[_0x2e16d1];return _0x499133;};'use strict';var _=require(_0xf183('0x0'));var util=require(_0xf183('0x1'));var logger=require(_0xf183('0x2'))(_0xf183('0x3'));var moment=require(_0xf183('0x4'));var BPromise=require(_0xf183('0x5'));var rp=require(_0xf183('0x6'));var fs=require('fs');var path=require(_0xf183('0x7'));var rimraf=require(_0xf183('0x8'));var config=require(_0xf183('0x9'));var attributes=require(_0xf183('0xa'));module['exports']=function(_0x341dd6,_0x5f1cdc){return _0x341dd6[_0xf183('0xb')]('Dashboard',attributes,{'tableName':_0xf183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9274=['api','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x4920ef,_0x5188ba){var _0x59b3be=function(_0x49ad8c){while(--_0x49ad8c){_0x4920ef['push'](_0x4920ef['shift']());}};_0x59b3be(++_0x5188ba);}(_0x9274,0x159));var _0x4927=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9274[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4927('0x0'));var util=require(_0x4927('0x1'));var logger=require(_0x4927('0x2'))(_0x4927('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4927('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4927('0x5'));var config=require(_0x4927('0x6'));var attributes=require(_0x4927('0x7'));module[_0x4927('0x8')]=function(_0x3074ea,_0x3edb59){return _0x3074ea[_0x4927('0x9')](_0x4927('0xa'),attributes,{'tableName':_0x4927('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 fb0a95e..bbc64bf 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 _0xe526=['Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then'];(function(_0x13e401,_0x365cc2){var _0x3b0468=function(_0x171693){while(--_0x171693){_0x13e401['push'](_0x13e401['shift']());}};_0x3b0468(++_0x365cc2);}(_0xe526,0x103));var _0x6e52=function(_0x3d1e43,_0xeb2790){_0x3d1e43=_0x3d1e43-0x0;var _0x49a0f9=_0xe526[_0x3d1e43];return _0x49a0f9;};'use strict';var _=require(_0x6e52('0x0'));var util=require(_0x6e52('0x1'));var moment=require(_0x6e52('0x2'));var BPromise=require(_0x6e52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e52('0x4'))['db'];var utils=require(_0x6e52('0x5'));var logger=require(_0x6e52('0x6'))(_0x6e52('0x7'));var config=require(_0x6e52('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e52('0x9')]({'port':0x232a});config[_0x6e52('0xa')]=_[_0x6e52('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6e52('0xc'))(new Redis(config[_0x6e52('0xa')]));require(_0x6e52('0xd'))[_0x6e52('0xe')](socket);function respondWithRpcPromise(_0x4f4bbf,_0x161f71,_0x33a4f9){return new BPromise(function(_0x1f1842,_0x40dac6){return client['request'](_0x4f4bbf,_0x33a4f9)[_0x6e52('0xf')](function(_0x54a374){logger['info']('Dashboard,\x20%s,\x20%s',_0x161f71,'request\x20sent');logger['debug'](_0x6e52('0x10'),_0x161f71,_0x6e52('0x11'),JSON[_0x6e52('0x12')](_0x54a374));if(_0x54a374['error']){if(_0x54a374[_0x6e52('0x13')][_0x6e52('0x14')]===0x1f4){logger[_0x6e52('0x13')](_0x6e52('0x15'),_0x161f71,_0x54a374[_0x6e52('0x13')][_0x6e52('0x16')]);return _0x40dac6(_0x54a374[_0x6e52('0x13')][_0x6e52('0x16')]);}logger[_0x6e52('0x13')](_0x6e52('0x15'),_0x161f71,_0x54a374[_0x6e52('0x13')][_0x6e52('0x16')]);return _0x1f1842(_0x54a374[_0x6e52('0x13')]['message']);}else{logger[_0x6e52('0x17')](_0x6e52('0x15'),_0x161f71,'request\x20sent');_0x1f1842(_0x54a374[_0x6e52('0x18')][_0x6e52('0x16')]);}})['catch'](function(_0x14f98f){logger[_0x6e52('0x13')](_0x6e52('0x15'),_0x161f71,_0x14f98f);_0x40dac6(_0x14f98f);});});} \ No newline at end of file +var _0x7118=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register'];(function(_0x21929f,_0xb96182){var _0x1a6077=function(_0x209786){while(--_0x209786){_0x21929f['push'](_0x21929f['shift']());}};_0x1a6077(++_0xb96182);}(_0x7118,0xba));var _0x8711=function(_0x3ff582,_0x17a34a){_0x3ff582=_0x3ff582-0x0;var _0x2f3e0f=_0x7118[_0x3ff582];return _0x2f3e0f;};'use strict';var _=require(_0x8711('0x0'));var util=require(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rs=require(_0x8711('0x3'));var fs=require('fs');var Redis=require(_0x8711('0x4'));var db=require(_0x8711('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8711('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8711('0x7')][_0x8711('0x8')]({'port':0x232a});config[_0x8711('0x9')]=_['defaults'](config[_0x8711('0x9')],{'host':_0x8711('0xa'),'port':0x18eb});var socket=require(_0x8711('0xb'))(new Redis(config[_0x8711('0x9')]));require(_0x8711('0xc'))[_0x8711('0xd')](socket);function respondWithRpcPromise(_0xcf1384,_0x2de0e5,_0x31fc5f){return new BPromise(function(_0x3819b2,_0x2f9bb3){return client['request'](_0xcf1384,_0x31fc5f)['then'](function(_0x2be8ce){logger['info']('Dashboard,\x20%s,\x20%s',_0x2de0e5,_0x8711('0xe'));logger[_0x8711('0xf')](_0x8711('0x10'),_0x2de0e5,'request\x20sent',JSON[_0x8711('0x11')](_0x2be8ce));if(_0x2be8ce[_0x8711('0x12')]){if(_0x2be8ce[_0x8711('0x12')][_0x8711('0x13')]===0x1f4){logger[_0x8711('0x12')](_0x8711('0x14'),_0x2de0e5,_0x2be8ce['error'][_0x8711('0x15')]);return _0x2f9bb3(_0x2be8ce[_0x8711('0x12')][_0x8711('0x15')]);}logger[_0x8711('0x12')](_0x8711('0x14'),_0x2de0e5,_0x2be8ce['error'][_0x8711('0x15')]);return _0x3819b2(_0x2be8ce[_0x8711('0x12')][_0x8711('0x15')]);}else{logger[_0x8711('0x16')](_0x8711('0x14'),_0x2de0e5,_0x8711('0xe'));_0x3819b2(_0x2be8ce[_0x8711('0x17')][_0x8711('0x15')]);}})[_0x8711('0x18')](function(_0x583bc2){logger[_0x8711('0x12')](_0x8711('0x14'),_0x2de0e5,_0x583bc2);_0x2f9bb3(_0x583bc2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1cce04c..d331c98 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 _0xf2a6=['update','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x4a47d6,_0x4f56c0){var _0x72a29d=function(_0x4275e5){while(--_0x4275e5){_0x4a47d6['push'](_0x4a47d6['shift']());}};_0x72a29d(++_0x4f56c0);}(_0xf2a6,0x1da));var _0x6f2a=function(_0x658c5d,_0x1624d8){_0x658c5d=_0x658c5d-0x0;var _0x47bc44=_0xf2a6[_0x658c5d];return _0x47bc44;};'use strict';var DashboardEvents=require(_0x6f2a('0x0'));var events=[_0x6f2a('0x1'),'remove',_0x6f2a('0x2')];function createListener(_0x15e04c,_0x468d37){return function(_0x3c8a3d){_0x468d37['emit'](_0x15e04c,_0x3c8a3d);};}function removeListener(_0xf89adc,_0x3f3eb9){return function(){DashboardEvents[_0x6f2a('0x3')](_0xf89adc,_0x3f3eb9);};}exports[_0x6f2a('0x4')]=function(_0x4b53d0){for(var _0x287023=0x0,_0x46837e=events[_0x6f2a('0x5')];_0x287023<_0x46837e;_0x287023++){var _0xbed95c=events[_0x287023];var _0x25cca2=createListener(_0x6f2a('0x6')+_0xbed95c,_0x4b53d0);DashboardEvents['on'](_0xbed95c,_0x25cca2);}}; \ No newline at end of file +var _0x0d50=['remove','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d50,0x6f));var _0x00d5=function(_0x3550e8,_0x424fea){_0x3550e8=_0x3550e8-0x0;var _0x18eb61=_0x0d50[_0x3550e8];return _0x18eb61;};'use strict';var DashboardEvents=require(_0x00d5('0x0'));var events=['save',_0x00d5('0x1'),_0x00d5('0x2')];function createListener(_0x2041ad,_0x17adea){return function(_0x39a6b1){_0x17adea[_0x00d5('0x3')](_0x2041ad,_0x39a6b1);};}function removeListener(_0x5af51d,_0x15cc93){return function(){DashboardEvents[_0x00d5('0x4')](_0x5af51d,_0x15cc93);};}exports[_0x00d5('0x5')]=function(_0x57522b){for(var _0x7b5368=0x0,_0x3c8b9e=events['length'];_0x7b5368<_0x3c8b9e;_0x7b5368++){var _0x403bfe=events[_0x7b5368];var _0x4dea28=createListener(_0x00d5('0x6')+_0x403bfe,_0x57522b);DashboardEvents['on'](_0x403bfe,_0x4dea28);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 738652d..9aa6229 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 _0xecb2=['addItem','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/items','create','/:id/clone','clone'];(function(_0xf2efae,_0x307737){var _0x241311=function(_0x5ba928){while(--_0x5ba928){_0xf2efae['push'](_0xf2efae['shift']());}};_0x241311(++_0x307737);}(_0xecb2,0x133));var _0x2ecb=function(_0x391885,_0x2fc43a){_0x391885=_0x391885-0x0;var _0x20a63c=_0xecb2[_0x391885];return _0x20a63c;};'use strict';var multer=require(_0x2ecb('0x0'));var util=require(_0x2ecb('0x1'));var path=require(_0x2ecb('0x2'));var timeout=require(_0x2ecb('0x3'));var express=require(_0x2ecb('0x4'));var router=express[_0x2ecb('0x5')]();var fs_extra=require(_0x2ecb('0x6'));var auth=require(_0x2ecb('0x7'));var interaction=require(_0x2ecb('0x8'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x2ecb('0x9')]('/',auth[_0x2ecb('0xa')](),controller['index']);router[_0x2ecb('0x9')](_0x2ecb('0xb'),auth[_0x2ecb('0xa')](),controller['show']);router[_0x2ecb('0x9')](_0x2ecb('0xc'),auth[_0x2ecb('0xa')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0x2ecb('0xd')]);router['post'](_0x2ecb('0xe'),auth[_0x2ecb('0xa')](),controller[_0x2ecb('0xf')]);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x2ecb('0x10')]);router[_0x2ecb('0x11')](_0x2ecb('0xb'),auth['isAuthenticated'](),controller[_0x2ecb('0x12')]);router['delete']('/:id',auth[_0x2ecb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe20d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','show','isAuthenticated','post','create','/:id/clone','/:id/items','addItem','update','destroy','exports','util','path','connect-timeout'];(function(_0x57bac1,_0x23e3cf){var _0x446fb7=function(_0x417d9d){while(--_0x417d9d){_0x57bac1['push'](_0x57bac1['shift']());}};_0x446fb7(++_0x23e3cf);}(_0xe20d,0x11b));var _0xde20=function(_0x4e9178,_0x5d09b7){_0x4e9178=_0x4e9178-0x0;var _0x278dbe=_0xe20d[_0x4e9178];return _0x278dbe;};'use strict';var multer=require('multer');var util=require(_0xde20('0x0'));var path=require(_0xde20('0x1'));var timeout=require(_0xde20('0x2'));var express=require(_0xde20('0x3'));var router=express[_0xde20('0x4')]();var fs_extra=require(_0xde20('0x5'));var auth=require(_0xde20('0x6'));var interaction=require(_0xde20('0x7'));var config=require(_0xde20('0x8'));var controller=require(_0xde20('0x9'));router[_0xde20('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde20('0xa')](_0xde20('0xb'),auth['isAuthenticated'](),controller[_0xde20('0xc')]);router[_0xde20('0xa')]('/:id/items',auth[_0xde20('0xd')](),controller['getItems']);router[_0xde20('0xe')]('/',auth[_0xde20('0xd')](),controller[_0xde20('0xf')]);router[_0xde20('0xe')](_0xde20('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0xde20('0xe')](_0xde20('0x11'),auth['isAuthenticated'](),controller[_0xde20('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xde20('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xde20('0x14')]);module[_0xde20('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 41400ab..a7da5a5 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 _0x187d=['stringify','INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0x361009,_0x3cf52e){var _0x1e84dc=function(_0x4cfc0b){while(--_0x4cfc0b){_0x361009['push'](_0x361009['shift']());}};_0x1e84dc(++_0x3cf52e);}(_0x187d,0x93));var _0xd187=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x187d[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xd187('0x0'));var squel=require('squel');var _=require(_0xd187('0x1'));module[_0xd187('0x2')]={'title':{'type':Sequelize[_0xd187('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd187('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){try{return JSON['parse'](this[_0xd187('0x6')](_0xd187('0x7')));}catch(_0x4ebc8d){return[];}},'set':function(_0x1d2533){try{this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')](_0x1d2533));}catch(_0x28ce2f){this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd187('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd187('0xa')]},'col':{'type':Sequelize[_0xd187('0xa')]},'background':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':_0xd187('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd187('0x3')]},'titleFontSize':{'type':Sequelize[_0xd187('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x577acd,_0x2dddb2){var _0x2bfd74=function(_0x39d069){while(--_0x39d069){_0x577acd['push'](_0x577acd['shift']());}};_0x2bfd74(++_0x2dddb2);}(_0x2a07,0x74));var _0x72a0=function(_0x4d150a,_0x25f904){_0x4d150a=_0x4d150a-0x0;var _0x885bd4=_0x2a07[_0x4d150a];return _0x885bd4;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'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 69fda61..e2adb6f 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 _0xd8fb=['apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','body','create','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range'];(function(_0x35b22b,_0x1fd772){var _0x1712a3=function(_0x2d731f){while(--_0x2d731f){_0x35b22b['push'](_0x35b22b['shift']());}};_0x1712a3(++_0x1fd772);}(_0xd8fb,0x99));var _0xbd8f=function(_0x49397e,_0xe3930f){_0x49397e=_0x49397e-0x0;var _0x528414=_0xd8fb[_0x49397e];return _0x528414;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];config[_0xbd8f('0x14')]=_[_0xbd8f('0x15')](config[_0xbd8f('0x14')],{'host':_0xbd8f('0x16'),'port':0x18eb});var socket=require(_0xbd8f('0x17'))(new Redis(config[_0xbd8f('0x14')]));require(_0xbd8f('0x18'))[_0xbd8f('0x19')](socket);function respondWithStatusCode(_0x14606c,_0x5e59ae){_0x5e59ae=_0x5e59ae||0xcc;return function(_0x31573c){if(_0x31573c){return _0x14606c[_0xbd8f('0x1a')](_0x5e59ae);}return _0x14606c[_0xbd8f('0x1b')](_0x5e59ae)[_0xbd8f('0x1c')]();};}function respondWithResult(_0x4da96f,_0x174929){_0x174929=_0x174929||0xc8;return function(_0x63db18){if(_0x63db18){return _0x4da96f['status'](_0x174929)[_0xbd8f('0x1d')](_0x63db18);}};}function respondWithFilteredResult(_0xf5e7a,_0x504adb){return function(_0x4435b9){if(_0x4435b9){var _0x36a6af=typeof _0x504adb['offset']==='undefined'&&typeof _0x504adb[_0xbd8f('0x1e')]==='undefined';var _0x5705c5=_0x4435b9[_0xbd8f('0x1f')];var _0x4b5fac=_0x36a6af?0x0:_0x504adb[_0xbd8f('0x20')];var _0x7f46d4=_0x36a6af?_0x4435b9[_0xbd8f('0x1f')]:_0x504adb[_0xbd8f('0x20')]+_0x504adb[_0xbd8f('0x1e')];var _0x20cab7;if(_0x7f46d4>=_0x5705c5){_0x7f46d4=_0x5705c5;_0x20cab7=0xc8;}else{_0x20cab7=0xce;}_0xf5e7a[_0xbd8f('0x1b')](_0x20cab7);return _0xf5e7a[_0xbd8f('0x21')](_0xbd8f('0x22'),_0x4b5fac+'-'+_0x7f46d4+'/'+_0x5705c5)[_0xbd8f('0x1d')](_0x4435b9);}return null;};}function patchUpdates(_0xfe4048){return function(_0x1628f5){try{jsonpatch[_0xbd8f('0x23')](_0x1628f5,_0xfe4048,!![]);}catch(_0x15c4a9){return BPromise[_0xbd8f('0x24')](_0x15c4a9);}return _0x1628f5[_0xbd8f('0x25')]();};}function saveUpdates(_0x395b1b,_0x4ba8db){return function(_0x359ead){if(_0x359ead){return _0x359ead[_0xbd8f('0x26')](_0x395b1b)[_0xbd8f('0x27')](function(_0x2f3df7){return _0x2f3df7;});}return null;};}function removeEntity(_0xa88414,_0x2257fd){return function(_0xa31166){if(_0xa31166){return _0xa31166[_0xbd8f('0x28')]()['then'](function(){_0xa88414[_0xbd8f('0x1b')](0xcc)[_0xbd8f('0x1c')]();});}};}function handleEntityNotFound(_0x5a3a8c,_0x339df7){return function(_0x557daa){if(!_0x557daa){_0x5a3a8c[_0xbd8f('0x1a')](0x194);}return _0x557daa;};}function handleError(_0x30d62e,_0x991401){_0x991401=_0x991401||0x1f4;return function(_0x202126){logger[_0xbd8f('0x29')](_0x202126[_0xbd8f('0x2a')]);if(_0x202126['name']){delete _0x202126[_0xbd8f('0x2b')];}_0x30d62e[_0xbd8f('0x1b')](_0x991401)[_0xbd8f('0x2c')](_0x202126);};}exports[_0xbd8f('0x2d')]=function(_0x3d2e1b,_0x2ac26f){var _0x2a4b32={'raw':![],'where':{'id':_0x3d2e1b[_0xbd8f('0x2e')]['id']}},_0x479a0c={};_0x479a0c[_0xbd8f('0x2f')]=_[_0xbd8f('0x30')](db[_0xbd8f('0x31')]['rawAttributes']);_0x479a0c['query']=_[_0xbd8f('0x30')](_0x3d2e1b[_0xbd8f('0x32')]);_0x479a0c[_0xbd8f('0x33')]=_[_0xbd8f('0x34')](_0x479a0c['model'],_0x479a0c[_0xbd8f('0x32')]);_0x2a4b32[_0xbd8f('0x35')]=_[_0xbd8f('0x34')](_0x479a0c[_0xbd8f('0x2f')],qs[_0xbd8f('0x36')](_0x3d2e1b['query'][_0xbd8f('0x36')]));_0x2a4b32[_0xbd8f('0x35')]=_0x2a4b32[_0xbd8f('0x35')][_0xbd8f('0x37')]?_0x2a4b32[_0xbd8f('0x35')]:_0x479a0c['model'];if(_0x3d2e1b[_0xbd8f('0x32')]['includeAll']){_0x2a4b32[_0xbd8f('0x38')]=[{'all':!![]}];}_0x2a4b32=_[_0xbd8f('0x39')]({},_0x2a4b32,_0x3d2e1b[_0xbd8f('0x3a')]);return db[_0xbd8f('0x31')][_0xbd8f('0x3b')](_0x2a4b32)[_0xbd8f('0x27')](handleEntityNotFound(_0x2ac26f,null))['then'](respondWithResult(_0x2ac26f,null))['catch'](handleError(_0x2ac26f,null));};exports['destroy']=function(_0x22d1de,_0x46c84d){return db[_0xbd8f('0x31')][_0xbd8f('0x3b')]({'where':{'id':_0x22d1de[_0xbd8f('0x2e')]['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x46c84d,null))[_0xbd8f('0x27')](removeEntity(_0x46c84d,null))[_0xbd8f('0x3c')](handleError(_0x46c84d,null));};function widgetAttributes(_0x2d4882){try{switch(_0x2d4882[_0xbd8f('0x3d')]){case _0xbd8f('0x3e'):return[{'name':_0xbd8f('0x3f'),'value':_0x2d4882[_0xbd8f('0x3f')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x0]?_0x2d4882['attrs'][0x0][_0xbd8f('0x41')]:undefined)||_0xbd8f('0x42')}];case'custom':return[{'name':_0xbd8f('0x43'),'value':_0x2d4882[_0xbd8f('0x43')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0]['value']:undefined)||''}];case _0xbd8f('0x44'):return[{'name':_0xbd8f('0x45'),'value':_0x2d4882[_0xbd8f('0x45')]||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0][_0xbd8f('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xbd8f('0x46'),'value':_0x2d4882[_0xbd8f('0x46')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x1]?_0x2d4882[_0xbd8f('0x40')][0x1][_0xbd8f('0x41')]:undefined)||_0xbd8f('0x47')},{'name':_0xbd8f('0x48'),'value':_0x2d4882[_0xbd8f('0x48')]||(_0x2d4882['attrs']&&_0x2d4882['attrs'][0x2]?_0x2d4882[_0xbd8f('0x40')][0x2][_0xbd8f('0x41')]:undefined)||0xc}];case _0xbd8f('0x49'):return[{'name':_0xbd8f('0x4a'),'value':_0x2d4882['attrMetric']||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0][_0xbd8f('0x41')]:undefined)||_0xbd8f('0x4b')},{'name':'attrVoiceQueues','value':_0x2d4882['attrVoiceQueues']||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x1]?_0x2d4882[_0xbd8f('0x40')][0x1][_0xbd8f('0x41')]:undefined)||[]},{'name':_0xbd8f('0x48'),'value':_0x2d4882[_0xbd8f('0x48')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x2]?_0x2d4882[_0xbd8f('0x40')][0x2][_0xbd8f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x2d4882[_0xbd8f('0x4c')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x3]?_0x2d4882[_0xbd8f('0x40')][0x3][_0xbd8f('0x41')]:undefined)||_0xbd8f('0x4d')},{'name':_0xbd8f('0x4e'),'value':_0x2d4882[_0xbd8f('0x4e')]||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x4]?_0x2d4882[_0xbd8f('0x40')][0x4][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x4f'),'value':_0x2d4882[_0xbd8f('0x4f')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x5]?_0x2d4882[_0xbd8f('0x40')][0x5][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x50'),'value':_0x2d4882[_0xbd8f('0x50')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x6]?_0x2d4882[_0xbd8f('0x40')][0x6][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x51'),'value':_0x2d4882[_0xbd8f('0x51')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x7]?_0x2d4882['attrs'][0x7][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x52'),'value':_0x2d4882[_0xbd8f('0x52')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x8]?_0x2d4882[_0xbd8f('0x40')][0x8]['value']:undefined)||''},{'name':_0xbd8f('0x53'),'value':_0x2d4882[_0xbd8f('0x53')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x9]?_0x2d4882['attrs'][0x9][_0xbd8f('0x41')]:undefined)||''}];case _0xbd8f('0x54'):case _0xbd8f('0x55'):return[{'name':_0xbd8f('0x56'),'value':_0x2d4882[_0xbd8f('0x56')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0]['value']:undefined)||_0xbd8f('0x4b')},{'name':_0xbd8f('0x57'),'value':_0x2d4882[_0xbd8f('0x57')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x1]?_0x2d4882[_0xbd8f('0x40')][0x1][_0xbd8f('0x41')]:undefined)||null},{'name':_0xbd8f('0x58'),'value':_0x2d4882[_0xbd8f('0x58')]||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x2]?_0x2d4882['attrs'][0x2][_0xbd8f('0x41')]:undefined)||null},{'name':_0xbd8f('0x59'),'value':_0x2d4882['attrVoiceQueues']||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x3]?_0x2d4882['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2d4882[_0xbd8f('0x4c')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x4]?_0x2d4882[_0xbd8f('0x40')][0x4][_0xbd8f('0x41')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2d4882[_0xbd8f('0x4e')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x5]?_0x2d4882[_0xbd8f('0x40')][0x5][_0xbd8f('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2d4882[_0xbd8f('0x4f')]||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x6]?_0x2d4882[_0xbd8f('0x40')][0x6][_0xbd8f('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2d4882[_0xbd8f('0x50')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x7]?_0x2d4882[_0xbd8f('0x40')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2d4882[_0xbd8f('0x51')]||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x8]?_0x2d4882[_0xbd8f('0x40')][0x8][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x52'),'value':_0x2d4882['attrWhatsappAccounts']||(_0x2d4882['attrs']&&_0x2d4882[_0xbd8f('0x40')][0x9]?_0x2d4882[_0xbd8f('0x40')][0x9][_0xbd8f('0x41')]:undefined)||''},{'name':_0xbd8f('0x53'),'value':_0x2d4882[_0xbd8f('0x53')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0xa]?_0x2d4882[_0xbd8f('0x40')][0xa][_0xbd8f('0x41')]:undefined)||''}];case _0xbd8f('0x5a'):return[{'name':_0xbd8f('0x5b'),'type':_0x2d4882['reportType']||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0][_0xbd8f('0x3d')]:undefined)||null,'value':_0x2d4882[_0xbd8f('0x5b')]||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882['attrs'][0x0]?_0x2d4882[_0xbd8f('0x40')][0x0][_0xbd8f('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x2d4882['attrRefresh']||(_0x2d4882[_0xbd8f('0x40')]&&_0x2d4882[_0xbd8f('0x40')][0x1]?_0x2d4882[_0xbd8f('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4eb37b){logger[_0xbd8f('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4eb37b));return[];}}exports['create']=function(_0x5a858e,_0x5b26eb){if(_0x5a858e[_0xbd8f('0x5c')]){_0x5a858e['body'][_0xbd8f('0x40')]=widgetAttributes(_0x5a858e[_0xbd8f('0x5c')]);}return db['DashboardItem'][_0xbd8f('0x5d')](_0x5a858e[_0xbd8f('0x5c')],{})[_0xbd8f('0x27')](respondWithResult(_0x5b26eb,0xc9))[_0xbd8f('0x3c')](handleError(_0x5b26eb,null));};exports[_0xbd8f('0x26')]=function(_0x4c976f,_0x583d7a){if(_0x4c976f[_0xbd8f('0x5c')]['id']){delete _0x4c976f[_0xbd8f('0x5c')]['id'];}_0x4c976f[_0xbd8f('0x5c')][_0xbd8f('0x40')]=widgetAttributes(_0x4c976f[_0xbd8f('0x5c')]);return db[_0xbd8f('0x31')]['find']({'where':{'id':_0x4c976f['params']['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x583d7a,null))[_0xbd8f('0x27')](saveUpdates(_0x4c976f['body'],null))[_0xbd8f('0x27')](respondWithResult(_0x583d7a,null))[_0xbd8f('0x3c')](handleError(_0x583d7a,null));}; \ No newline at end of file +var _0x1a44=['create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','reportType','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify'];(function(_0x221b0a,_0xfff86a){var _0x5a03ca=function(_0x3c0844){while(--_0x3c0844){_0x221b0a['push'](_0x221b0a['shift']());}};_0x5a03ca(++_0xfff86a);}(_0x1a44,0xc4));var _0x41a4=function(_0x31978d,_0xf25b96){_0x31978d=_0x31978d-0x0;var _0x42827a=_0x1a44[_0x31978d];return _0x42827a;};'use strict';var emlformat=require(_0x41a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41a4('0x1'));var jsonpatch=require(_0x41a4('0x2'));var rp=require(_0x41a4('0x3'));var moment=require(_0x41a4('0x4'));var BPromise=require(_0x41a4('0x5'));var Mustache=require(_0x41a4('0x6'));var util=require(_0x41a4('0x7'));var path=require('path');var sox=require(_0x41a4('0x8'));var csv=require(_0x41a4('0x9'));var ejs=require(_0x41a4('0xa'));var fs=require('fs');var fs_extra=require(_0x41a4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x41a4('0xc'));var jsforce=require(_0x41a4('0xd'));var deskjs=require(_0x41a4('0xe'));var toCsv=require(_0x41a4('0x9'));var querystring=require(_0x41a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x41a4('0x10'));var qs=require(_0x41a4('0x11'));var as=require(_0x41a4('0x12'));var hardwareService=require(_0x41a4('0x13'));var logger=require(_0x41a4('0x14'))(_0x41a4('0x15'));var utils=require('../../config/utils');var config=require(_0x41a4('0x16'));var licenseUtil=require(_0x41a4('0x17'));var db=require(_0x41a4('0x18'))['db'];config[_0x41a4('0x19')]=_['defaults'](config[_0x41a4('0x19')],{'host':_0x41a4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41a4('0x19')]));require(_0x41a4('0x1b'))['register'](socket);function respondWithStatusCode(_0x59a178,_0xb4c27e){_0xb4c27e=_0xb4c27e||0xcc;return function(_0x25acc1){if(_0x25acc1){return _0x59a178[_0x41a4('0x1c')](_0xb4c27e);}return _0x59a178[_0x41a4('0x1d')](_0xb4c27e)[_0x41a4('0x1e')]();};}function respondWithResult(_0x59dc91,_0x4f7967){_0x4f7967=_0x4f7967||0xc8;return function(_0x5043f5){if(_0x5043f5){return _0x59dc91[_0x41a4('0x1d')](_0x4f7967)[_0x41a4('0x1f')](_0x5043f5);}};}function respondWithFilteredResult(_0x1c45db,_0x35e658){return function(_0x239912){if(_0x239912){var _0x1b5788=typeof _0x35e658[_0x41a4('0x20')]===_0x41a4('0x21')&&typeof _0x35e658[_0x41a4('0x22')]===_0x41a4('0x21');var _0xea3da1=_0x239912['count'];var _0x2faa2a=_0x1b5788?0x0:_0x35e658[_0x41a4('0x20')];var _0x347403=_0x1b5788?_0x239912['count']:_0x35e658[_0x41a4('0x20')]+_0x35e658[_0x41a4('0x22')];var _0x3669dd;if(_0x347403>=_0xea3da1){_0x347403=_0xea3da1;_0x3669dd=0xc8;}else{_0x3669dd=0xce;}_0x1c45db[_0x41a4('0x1d')](_0x3669dd);return _0x1c45db['set'](_0x41a4('0x23'),_0x2faa2a+'-'+_0x347403+'/'+_0xea3da1)[_0x41a4('0x1f')](_0x239912);}return null;};}function patchUpdates(_0x4b86be){return function(_0x110a18){try{jsonpatch['apply'](_0x110a18,_0x4b86be,!![]);}catch(_0x14d401){return BPromise[_0x41a4('0x24')](_0x14d401);}return _0x110a18[_0x41a4('0x25')]();};}function saveUpdates(_0x18e3dd,_0x3b1fbc){return function(_0x327fe9){if(_0x327fe9){return _0x327fe9[_0x41a4('0x26')](_0x18e3dd)[_0x41a4('0x27')](function(_0x263639){return _0x263639;});}return null;};}function removeEntity(_0x2a7c16,_0x3890eb){return function(_0x1ddd4f){if(_0x1ddd4f){return _0x1ddd4f['destroy']()[_0x41a4('0x27')](function(){_0x2a7c16[_0x41a4('0x1d')](0xcc)[_0x41a4('0x1e')]();});}};}function handleEntityNotFound(_0x54590b,_0x3478dd){return function(_0x99bcec){if(!_0x99bcec){_0x54590b[_0x41a4('0x1c')](0x194);}return _0x99bcec;};}function handleError(_0x298073,_0x4b2f83){_0x4b2f83=_0x4b2f83||0x1f4;return function(_0x2f7305){logger['error'](_0x2f7305[_0x41a4('0x28')]);if(_0x2f7305[_0x41a4('0x29')]){delete _0x2f7305[_0x41a4('0x29')];}_0x298073['status'](_0x4b2f83)[_0x41a4('0x2a')](_0x2f7305);};}exports[_0x41a4('0x2b')]=function(_0x3bbcc5,_0x3c1371){var _0x2cfe57={'raw':![],'where':{'id':_0x3bbcc5[_0x41a4('0x2c')]['id']}},_0x3ad2fa={};_0x3ad2fa[_0x41a4('0x2d')]=_[_0x41a4('0x2e')](db['DashboardItem'][_0x41a4('0x2f')]);_0x3ad2fa[_0x41a4('0x30')]=_['keys'](_0x3bbcc5['query']);_0x3ad2fa[_0x41a4('0x31')]=_[_0x41a4('0x32')](_0x3ad2fa['model'],_0x3ad2fa[_0x41a4('0x30')]);_0x2cfe57[_0x41a4('0x33')]=_[_0x41a4('0x32')](_0x3ad2fa[_0x41a4('0x2d')],qs[_0x41a4('0x34')](_0x3bbcc5[_0x41a4('0x30')][_0x41a4('0x34')]));_0x2cfe57[_0x41a4('0x33')]=_0x2cfe57[_0x41a4('0x33')][_0x41a4('0x35')]?_0x2cfe57['attributes']:_0x3ad2fa[_0x41a4('0x2d')];if(_0x3bbcc5[_0x41a4('0x30')][_0x41a4('0x36')]){_0x2cfe57[_0x41a4('0x37')]=[{'all':!![]}];}_0x2cfe57=_[_0x41a4('0x38')]({},_0x2cfe57,_0x3bbcc5[_0x41a4('0x39')]);return db[_0x41a4('0x3a')][_0x41a4('0x3b')](_0x2cfe57)[_0x41a4('0x27')](handleEntityNotFound(_0x3c1371,null))['then'](respondWithResult(_0x3c1371,null))[_0x41a4('0x3c')](handleError(_0x3c1371,null));};exports['destroy']=function(_0x65ab1,_0x156d90){return db[_0x41a4('0x3a')][_0x41a4('0x3b')]({'where':{'id':_0x65ab1[_0x41a4('0x2c')]['id']}})[_0x41a4('0x27')](handleEntityNotFound(_0x156d90,null))[_0x41a4('0x27')](removeEntity(_0x156d90,null))['catch'](handleError(_0x156d90,null));};function widgetAttributes(_0x489603){try{switch(_0x489603['type']){case'iframe':return[{'name':_0x41a4('0x3d'),'value':_0x489603[_0x41a4('0x3d')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x0]?_0x489603['attrs'][0x0][_0x41a4('0x3f')]:undefined)||_0x41a4('0x40')}];case _0x41a4('0x41'):return[{'name':_0x41a4('0x42'),'value':_0x489603[_0x41a4('0x42')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x0]?_0x489603['attrs'][0x0][_0x41a4('0x3f')]:undefined)||''}];case _0x41a4('0x43'):return[{'name':_0x41a4('0x44'),'value':_0x489603[_0x41a4('0x44')]||(_0x489603['attrs']&&_0x489603['attrs'][0x0]?_0x489603['attrs'][0x0][_0x41a4('0x3f')]:undefined)||_0x41a4('0x45')},{'name':_0x41a4('0x46'),'value':_0x489603[_0x41a4('0x46')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x1]?_0x489603[_0x41a4('0x3e')][0x1][_0x41a4('0x3f')]:undefined)||'0.00'},{'name':_0x41a4('0x47'),'value':_0x489603[_0x41a4('0x47')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x2]?_0x489603[_0x41a4('0x3e')][0x2][_0x41a4('0x3f')]:undefined)||0xc}];case _0x41a4('0x48'):return[{'name':'attrMetric','value':_0x489603['attrMetric']||(_0x489603['attrs']&&_0x489603[_0x41a4('0x3e')][0x0]?_0x489603[_0x41a4('0x3e')][0x0][_0x41a4('0x3f')]:undefined)||_0x41a4('0x49')},{'name':_0x41a4('0x4a'),'value':_0x489603['attrVoiceQueues']||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x1]?_0x489603['attrs'][0x1][_0x41a4('0x3f')]:undefined)||[]},{'name':'attrFontSize','value':_0x489603[_0x41a4('0x47')]||(_0x489603['attrs']&&_0x489603[_0x41a4('0x3e')][0x2]?_0x489603[_0x41a4('0x3e')][0x2][_0x41a4('0x3f')]:undefined)||0x14},{'name':_0x41a4('0x4b'),'value':_0x489603['attrChannel']||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x3]?_0x489603[_0x41a4('0x3e')][0x3][_0x41a4('0x3f')]:undefined)||_0x41a4('0x4c')},{'name':'attrEmailAccounts','value':_0x489603[_0x41a4('0x4d')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x4]?_0x489603[_0x41a4('0x3e')][0x4][_0x41a4('0x3f')]:undefined)||''},{'name':_0x41a4('0x4e'),'value':_0x489603['attrFaxAccounts']||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x5]?_0x489603[_0x41a4('0x3e')][0x5][_0x41a4('0x3f')]:undefined)||''},{'name':_0x41a4('0x4f'),'value':_0x489603[_0x41a4('0x4f')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x6]?_0x489603[_0x41a4('0x3e')][0x6]['value']:undefined)||''},{'name':_0x41a4('0x50'),'value':_0x489603[_0x41a4('0x50')]||(_0x489603['attrs']&&_0x489603['attrs'][0x7]?_0x489603[_0x41a4('0x3e')][0x7][_0x41a4('0x3f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x489603['attrWhatsappAccounts']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x8]?_0x489603[_0x41a4('0x3e')][0x8]['value']:undefined)||''},{'name':_0x41a4('0x51'),'value':_0x489603['attrChatWebsites']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x9]?_0x489603[_0x41a4('0x3e')][0x9]['value']:undefined)||''}];case _0x41a4('0x52'):case _0x41a4('0x53'):return[{'name':_0x41a4('0x54'),'value':_0x489603['attrSerie1']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x0]?_0x489603['attrs'][0x0]['value']:undefined)||_0x41a4('0x49')},{'name':_0x41a4('0x55'),'value':_0x489603[_0x41a4('0x55')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x1]?_0x489603[_0x41a4('0x3e')][0x1][_0x41a4('0x3f')]:undefined)||null},{'name':_0x41a4('0x56'),'value':_0x489603['attrSerie3']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x2]?_0x489603[_0x41a4('0x3e')][0x2][_0x41a4('0x3f')]:undefined)||null},{'name':_0x41a4('0x4a'),'value':_0x489603[_0x41a4('0x4a')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x3]?_0x489603[_0x41a4('0x3e')][0x3]['value']:undefined)||[]},{'name':_0x41a4('0x4b'),'value':_0x489603['attrChannel']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x4]?_0x489603[_0x41a4('0x3e')][0x4][_0x41a4('0x3f')]:undefined)||_0x41a4('0x4c')},{'name':_0x41a4('0x4d'),'value':_0x489603['attrEmailAccounts']||(_0x489603['attrs']&&_0x489603['attrs'][0x5]?_0x489603[_0x41a4('0x3e')][0x5]['value']:undefined)||''},{'name':_0x41a4('0x4e'),'value':_0x489603[_0x41a4('0x4e')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x6]?_0x489603[_0x41a4('0x3e')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x489603[_0x41a4('0x4f')]||(_0x489603['attrs']&&_0x489603['attrs'][0x7]?_0x489603[_0x41a4('0x3e')][0x7][_0x41a4('0x3f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x489603['attrOpenchannelAccounts']||(_0x489603[_0x41a4('0x3e')]&&_0x489603['attrs'][0x8]?_0x489603[_0x41a4('0x3e')][0x8][_0x41a4('0x3f')]:undefined)||''},{'name':_0x41a4('0x57'),'value':_0x489603[_0x41a4('0x57')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x9]?_0x489603['attrs'][0x9][_0x41a4('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x489603['attrChatWebsites']||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0xa]?_0x489603[_0x41a4('0x3e')][0xa][_0x41a4('0x3f')]:undefined)||''}];case _0x41a4('0x58'):return[{'name':'attrReport','type':_0x489603[_0x41a4('0x59')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x0]?_0x489603[_0x41a4('0x3e')][0x0]['type']:undefined)||null,'value':_0x489603[_0x41a4('0x5a')]||(_0x489603[_0x41a4('0x3e')]&&_0x489603[_0x41a4('0x3e')][0x0]?_0x489603[_0x41a4('0x3e')][0x0][_0x41a4('0x3f')]:undefined)||null},{'name':_0x41a4('0x5b'),'value':_0x489603[_0x41a4('0x5b')]||(_0x489603['attrs']&&_0x489603[_0x41a4('0x3e')][0x1]?_0x489603['attrs'][0x1][_0x41a4('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x5c2c21){logger[_0x41a4('0x5c')](_0x41a4('0x5d'),JSON[_0x41a4('0x5e')](_0x5c2c21));return[];}}exports[_0x41a4('0x5f')]=function(_0x3b47ae,_0x2d8c0c){if(_0x3b47ae[_0x41a4('0x60')]){_0x3b47ae[_0x41a4('0x60')][_0x41a4('0x3e')]=widgetAttributes(_0x3b47ae[_0x41a4('0x60')]);}return db[_0x41a4('0x3a')][_0x41a4('0x5f')](_0x3b47ae[_0x41a4('0x60')],{})[_0x41a4('0x27')](respondWithResult(_0x2d8c0c,0xc9))['catch'](handleError(_0x2d8c0c,null));};exports[_0x41a4('0x26')]=function(_0x187b03,_0x523703){if(_0x187b03[_0x41a4('0x60')]['id']){delete _0x187b03['body']['id'];}_0x187b03[_0x41a4('0x60')][_0x41a4('0x3e')]=widgetAttributes(_0x187b03[_0x41a4('0x60')]);return db['DashboardItem']['find']({'where':{'id':_0x187b03[_0x41a4('0x2c')]['id']}})[_0x41a4('0x27')](handleEntityNotFound(_0x523703,null))[_0x41a4('0x27')](saveUpdates(_0x187b03[_0x41a4('0x60')],null))['then'](respondWithResult(_0x523703,null))['catch'](handleError(_0x523703,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f767945..8ce3d56 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 _0xb16f=['hook','exports','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xffbb5f,_0x2367fb){var _0x2da0de=function(_0x24a81c){while(--_0x24a81c){_0xffbb5f['push'](_0xffbb5f['shift']());}};_0x2da0de(++_0x2367fb);}(_0xb16f,0x1c4));var _0xfb16=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0xb16f[_0x1667df];return _0x341abf;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xfb16('0x0'))['db'][_0xfb16('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfb16('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb16('0x3'),'afterDestroy':_0xfb16('0x4')};function emitEvent(_0x4c8cf1){return function(_0x3e4b4a,_0x5d40ab,_0x419c03){DashboardItemEvents['emit'](_0x4c8cf1+':'+_0x3e4b4a['id'],_0x3e4b4a);DashboardItemEvents[_0xfb16('0x5')](_0x4c8cf1,_0x3e4b4a);_0x419c03(null);};}for(var e in events){if(events[_0xfb16('0x6')](e)){var event=events[e];DashboardItem[_0xfb16('0x7')](e,emitEvent(event));}}module[_0xfb16('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xc090=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x438780,_0x14f6a5){var _0x4cb778=function(_0x28c5bb){while(--_0x28c5bb){_0x438780['push'](_0x438780['shift']());}};_0x4cb778(++_0x14f6a5);}(_0xc090,0x132));var _0x0c09=function(_0x2e987e,_0x68ecf4){_0x2e987e=_0x2e987e-0x0;var _0x24915f=_0xc090[_0x2e987e];return _0x24915f;};'use strict';var EventEmitter=require(_0x0c09('0x0'));var DashboardItem=require(_0x0c09('0x1'))['db'][_0x0c09('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0c09('0x3')](0x0);var events={'afterCreate':_0x0c09('0x4'),'afterUpdate':_0x0c09('0x5'),'afterDestroy':_0x0c09('0x6')};function emitEvent(_0x2ed090){return function(_0x35627c,_0x686a68,_0x1ae1a0){DashboardItemEvents[_0x0c09('0x7')](_0x2ed090+':'+_0x35627c['id'],_0x35627c);DashboardItemEvents['emit'](_0x2ed090,_0x35627c);_0x1ae1a0(null);};}for(var e in events){if(events[_0x0c09('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x0c09('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index eeb4fde..3ccda18 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x469a07,_0x478132){var _0x58b755=function(_0x48ad4f){while(--_0x48ad4f){_0x469a07['push'](_0x469a07['shift']());}};_0x58b755(++_0x478132);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0xf3cd[_0x26dc96];return _0x30b7be;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8820=['dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8820,0x16c));var _0x0882=function(_0x53ac1e,_0x3860bf){_0x53ac1e=_0x53ac1e-0x0;var _0x1a48be=_0x8820[_0x53ac1e];return _0x1a48be;};'use strict';var _=require(_0x0882('0x0'));var util=require('util');var logger=require(_0x0882('0x1'))(_0x0882('0x2'));var moment=require(_0x0882('0x3'));var BPromise=require(_0x0882('0x4'));var rp=require(_0x0882('0x5'));var fs=require('fs');var path=require(_0x0882('0x6'));var rimraf=require('rimraf');var config=require(_0x0882('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x0882('0x8')]=function(_0x27ed12,_0x4ca31e){return _0x27ed12[_0x0882('0x9')]('DashboardItem',attributes,{'tableName':_0x0882('0xa'),'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 e8c131f..5fb243d 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 _0xe565=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x8a7bfc,_0x135f36){var _0x5a836f=function(_0x5c959a){while(--_0x5c959a){_0x8a7bfc['push'](_0x8a7bfc['shift']());}};_0x5a836f(++_0x135f36);}(_0xe565,0x1ca));var _0x5e56=function(_0x2584b5,_0x27c4af){_0x2584b5=_0x2584b5-0x0;var _0x1f74a3=_0xe565[_0x2584b5];return _0x1f74a3;};'use strict';var _=require(_0x5e56('0x0'));var util=require(_0x5e56('0x1'));var moment=require(_0x5e56('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e56('0x3'));var fs=require('fs');var Redis=require(_0x5e56('0x4'));var db=require(_0x5e56('0x5'))['db'];var utils=require(_0x5e56('0x6'));var logger=require(_0x5e56('0x7'))(_0x5e56('0x8'));var config=require(_0x5e56('0x9'));var jayson=require(_0x5e56('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5e56('0xb')](config[_0x5e56('0xc')],{'host':_0x5e56('0xd'),'port':0x18eb});var socket=require(_0x5e56('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x5e56('0xf')](socket);function respondWithRpcPromise(_0x5a9a6f,_0x2e978c,_0x433b6){return new BPromise(function(_0x26c998,_0x2a9061){return client[_0x5e56('0x10')](_0x5a9a6f,_0x433b6)[_0x5e56('0x11')](function(_0x5099f1){logger[_0x5e56('0x12')](_0x5e56('0x13'),_0x2e978c,_0x5e56('0x14'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2e978c,'request\x20sent',JSON[_0x5e56('0x15')](_0x5099f1));if(_0x5099f1[_0x5e56('0x16')]){if(_0x5099f1[_0x5e56('0x16')][_0x5e56('0x17')]===0x1f4){logger['error'](_0x5e56('0x13'),_0x2e978c,_0x5099f1['error'][_0x5e56('0x18')]);return _0x2a9061(_0x5099f1[_0x5e56('0x16')][_0x5e56('0x18')]);}logger[_0x5e56('0x16')](_0x5e56('0x13'),_0x2e978c,_0x5099f1[_0x5e56('0x16')][_0x5e56('0x18')]);return _0x26c998(_0x5099f1[_0x5e56('0x16')][_0x5e56('0x18')]);}else{logger[_0x5e56('0x12')](_0x5e56('0x13'),_0x2e978c,_0x5e56('0x14'));_0x26c998(_0x5099f1[_0x5e56('0x19')][_0x5e56('0x18')]);}})[_0x5e56('0x1a')](function(_0x38c0e2){logger[_0x5e56('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2e978c,_0x38c0e2);_0x2a9061(_0x38c0e2);});});} \ No newline at end of file +var _0x6a55=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./dashboardItem.socket'];(function(_0x4bca9b,_0x54811c){var _0x23caeb=function(_0x4d0032){while(--_0x4d0032){_0x4bca9b['push'](_0x4bca9b['shift']());}};_0x23caeb(++_0x54811c);}(_0x6a55,0xc8));var _0x56a5=function(_0x33314d,_0x499628){_0x33314d=_0x33314d-0x0;var _0x4ffe8e=_0x6a55[_0x33314d];return _0x4ffe8e;};'use strict';var _=require(_0x56a5('0x0'));var util=require(_0x56a5('0x1'));var moment=require(_0x56a5('0x2'));var BPromise=require(_0x56a5('0x3'));var rs=require(_0x56a5('0x4'));var fs=require('fs');var Redis=require(_0x56a5('0x5'));var db=require(_0x56a5('0x6'))['db'];var utils=require(_0x56a5('0x7'));var logger=require(_0x56a5('0x8'))(_0x56a5('0x9'));var config=require('../../config/environment');var jayson=require(_0x56a5('0xa'));var client=jayson[_0x56a5('0xb')][_0x56a5('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x56a5('0xd')],{'host':_0x56a5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56a5('0xd')]));require(_0x56a5('0xf'))['register'](socket);function respondWithRpcPromise(_0x1ad8c2,_0x1bc94f,_0x4aa32e){return new BPromise(function(_0x5af1ed,_0x39ff38){return client['request'](_0x1ad8c2,_0x4aa32e)[_0x56a5('0x10')](function(_0x3599e1){logger[_0x56a5('0x11')](_0x56a5('0x12'),_0x1bc94f,_0x56a5('0x13'));logger[_0x56a5('0x14')](_0x56a5('0x15'),_0x1bc94f,_0x56a5('0x13'),JSON[_0x56a5('0x16')](_0x3599e1));if(_0x3599e1['error']){if(_0x3599e1['error']['code']===0x1f4){logger['error'](_0x56a5('0x12'),_0x1bc94f,_0x3599e1[_0x56a5('0x17')][_0x56a5('0x18')]);return _0x39ff38(_0x3599e1[_0x56a5('0x17')][_0x56a5('0x18')]);}logger['error'](_0x56a5('0x12'),_0x1bc94f,_0x3599e1[_0x56a5('0x17')]['message']);return _0x5af1ed(_0x3599e1[_0x56a5('0x17')][_0x56a5('0x18')]);}else{logger[_0x56a5('0x11')](_0x56a5('0x12'),_0x1bc94f,_0x56a5('0x13'));_0x5af1ed(_0x3599e1[_0x56a5('0x19')][_0x56a5('0x18')]);}})[_0x56a5('0x1a')](function(_0xa1c57f){logger[_0x56a5('0x17')](_0x56a5('0x12'),_0x1bc94f,_0xa1c57f);_0x39ff38(_0xa1c57f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9183442..3537257 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 _0x3e29=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x52896e,_0x1399e9){var _0x46976c=function(_0x38d430){while(--_0x38d430){_0x52896e['push'](_0x52896e['shift']());}};_0x46976c(++_0x1399e9);}(_0x3e29,0x1db));var _0x93e2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3e29[_0x20a584];return _0x4b41a8;};'use strict';var DashboardItemEvents=require(_0x93e2('0x0'));var events=['save',_0x93e2('0x1'),_0x93e2('0x2')];function createListener(_0x327670,_0x10ee8f){return function(_0x5ee6cc){_0x10ee8f['emit'](_0x327670,_0x5ee6cc);};}function removeListener(_0x4fbbdb,_0x50c863){return function(){DashboardItemEvents[_0x93e2('0x3')](_0x4fbbdb,_0x50c863);};}exports[_0x93e2('0x4')]=function(_0x5022d3){for(var _0x1630ad=0x0,_0x4e1331=events[_0x93e2('0x5')];_0x1630ad<_0x4e1331;_0x1630ad++){var _0x1ec9d3=events[_0x1630ad];var _0x472d71=createListener(_0x93e2('0x6')+_0x1ec9d3,_0x5022d3);DashboardItemEvents['on'](_0x1ec9d3,_0x472d71);}}; \ No newline at end of file +var _0x0944=['register','length','dashboardItem:','./dashboardItem.events','update','emit','removeListener'];(function(_0x3f6bf6,_0x575614){var _0x4731a3=function(_0x17b4a0){while(--_0x17b4a0){_0x3f6bf6['push'](_0x3f6bf6['shift']());}};_0x4731a3(++_0x575614);}(_0x0944,0xe3));var _0x4094=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x0944[_0x9e0cb3];return _0x5926b7;};'use strict';var DashboardItemEvents=require(_0x4094('0x0'));var events=['save','remove',_0x4094('0x1')];function createListener(_0x595570,_0xd2b3fb){return function(_0x561631){_0xd2b3fb[_0x4094('0x2')](_0x595570,_0x561631);};}function removeListener(_0x225827,_0x57bdff){return function(){DashboardItemEvents[_0x4094('0x3')](_0x225827,_0x57bdff);};}exports[_0x4094('0x4')]=function(_0x371908){for(var _0x397c45=0x0,_0x424153=events[_0x4094('0x5')];_0x397c45<_0x424153;_0x397c45++){var _0x52b6cf=events[_0x397c45];var _0xf1873b=createListener(_0x4094('0x6')+_0x52b6cf,_0x371908);DashboardItemEvents['on'](_0x52b6cf,_0xf1873b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5e176f7..69befa3 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 _0xc833=['get','isAuthenticated','show','post','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1fad1c,_0x2eb62f){var _0x475f67=function(_0x7600af){while(--_0x7600af){_0x1fad1c['push'](_0x1fad1c['shift']());}};_0x475f67(++_0x2eb62f);}(_0xc833,0xaf));var _0x3c83=function(_0x4a1124,_0x1683f1){_0x4a1124=_0x4a1124-0x0;var _0x72060=_0xc833[_0x4a1124];return _0x72060;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c83('0x0'));var timeout=require(_0x3c83('0x1'));var express=require(_0x3c83('0x2'));var router=express['Router']();var fs_extra=require(_0x3c83('0x3'));var auth=require(_0x3c83('0x4'));var interaction=require(_0x3c83('0x5'));var config=require(_0x3c83('0x6'));var controller=require('./dashboardItem.controller');router[_0x3c83('0x7')]('/:id',auth[_0x3c83('0x8')](),controller[_0x3c83('0x9')]);router[_0x3c83('0xa')]('/',auth[_0x3c83('0x8')](),controller['create']);router['put'](_0x3c83('0xb'),auth[_0x3c83('0x8')](),controller['update']);router['delete'](_0x3c83('0xb'),auth[_0x3c83('0x8')](),controller[_0x3c83('0xc')]);module[_0x3c83('0xd')]=router; \ No newline at end of file +var _0x95d1=['/:id','isAuthenticated','post','create','update','delete','destroy','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5499e8,_0x163c90){var _0x353a35=function(_0x2f11f7){while(--_0x2f11f7){_0x5499e8['push'](_0x5499e8['shift']());}};_0x353a35(++_0x163c90);}(_0x95d1,0x1e3));var _0x195d=function(_0x2fa082,_0x542781){_0x2fa082=_0x2fa082-0x0;var _0x40d484=_0x95d1[_0x2fa082];return _0x40d484;};'use strict';var multer=require('multer');var util=require(_0x195d('0x0'));var path=require('path');var timeout=require(_0x195d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x195d('0x2'));var auth=require(_0x195d('0x3'));var interaction=require(_0x195d('0x4'));var config=require(_0x195d('0x5'));var controller=require('./dashboardItem.controller');router[_0x195d('0x6')](_0x195d('0x7'),auth[_0x195d('0x8')](),controller['show']);router[_0x195d('0x9')]('/',auth[_0x195d('0x8')](),controller[_0x195d('0xa')]);router['put'](_0x195d('0x7'),auth[_0x195d('0x8')](),controller[_0x195d('0xb')]);router[_0x195d('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x195d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4d1b83e..70a5130 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 _0x594f=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x594f,0x180));var _0xf594=function(_0x650dd7,_0x382806){_0x650dd7=_0x650dd7-0x0;var _0x40e8ae=_0x594f[_0x650dd7];return _0x40e8ae;};'use strict';var Sequelize=require(_0xf594('0x0'));module[_0xf594('0x1')]={'name':{'type':Sequelize[_0xf594('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf594('0x3')](_0xf594('0x4'),_0xf594('0x5'),_0xf594('0x6')),'allowNull':![],'defaultValue':_0xf594('0x4')},'description':{'type':Sequelize[_0xf594('0x2')]}}; \ No newline at end of file +var _0x2bf6=['exports','STRING','ENUM','second','first'];(function(_0x5e097e,_0x9e7953){var _0x3af873=function(_0x25e27c){while(--_0x25e27c){_0x5e097e['push'](_0x5e097e['shift']());}};_0x3af873(++_0x9e7953);}(_0x2bf6,0xaa));var _0x62bf=function(_0x11a595,_0xdcd488){_0x11a595=_0x11a595-0x0;var _0x5d5911=_0x2bf6[_0x11a595];return _0x5d5911;};'use strict';var Sequelize=require('sequelize');module[_0x62bf('0x0')]={'name':{'type':Sequelize[_0x62bf('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x62bf('0x2')]('first',_0x62bf('0x3'),'third'),'allowNull':![],'defaultValue':_0x62bf('0x4')},'description':{'type':Sequelize[_0x62bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a4226d3..d8c7026 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 _0xe13a=['model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','Content-Range','reject','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','Disposition','rawAttributes','key'];(function(_0x5dd413,_0x167fd6){var _0x47c199=function(_0x239a62){while(--_0x239a62){_0x5dd413['push'](_0x5dd413['shift']());}};_0x47c199(++_0x167fd6);}(_0xe13a,0x1ee));var _0xae13=function(_0x15958a,_0x57a9d6){_0x15958a=_0x15958a-0x0;var _0x1b2c1b=_0xe13a[_0x15958a];return _0x1b2c1b;};'use strict';var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae13('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae13('0x4'));var util=require(_0xae13('0x5'));var path=require('path');var sox=require(_0xae13('0x6'));var csv=require(_0xae13('0x7'));var ejs=require(_0xae13('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae13('0x9'));var squel=require('squel');var crypto=require(_0xae13('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xae13('0xb'));var toCsv=require(_0xae13('0x7'));var querystring=require(_0xae13('0xc'));var Papa=require(_0xae13('0xd'));var Redis=require(_0xae13('0xe'));var authService=require(_0xae13('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xae13('0x10'));var hardwareService=require(_0xae13('0x11'));var logger=require(_0xae13('0x12'))(_0xae13('0x13'));var utils=require(_0xae13('0x14'));var config=require(_0xae13('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xae13('0x16'))['db'];function respondWithStatusCode(_0x1c39da,_0x76d720){_0x76d720=_0x76d720||0xcc;return function(_0x540485){if(_0x540485){return _0x1c39da['sendStatus'](_0x76d720);}return _0x1c39da[_0xae13('0x17')](_0x76d720)[_0xae13('0x18')]();};}function respondWithResult(_0x21a392,_0x228cad){_0x228cad=_0x228cad||0xc8;return function(_0x53661d){if(_0x53661d){return _0x21a392[_0xae13('0x17')](_0x228cad)[_0xae13('0x19')](_0x53661d);}};}function respondWithFilteredResult(_0x120d63,_0x55735f){return function(_0x50ebdf){if(_0x50ebdf){var _0x17f751=typeof _0x55735f['offset']===_0xae13('0x1a')&&typeof _0x55735f[_0xae13('0x1b')]===_0xae13('0x1a');var _0x1cbe7f=_0x50ebdf['count'];var _0x2766a2=_0x17f751?0x0:_0x55735f[_0xae13('0x1c')];var _0x49586f=_0x17f751?_0x50ebdf[_0xae13('0x1d')]:_0x55735f[_0xae13('0x1c')]+_0x55735f[_0xae13('0x1b')];var _0x5251ce;if(_0x49586f>=_0x1cbe7f){_0x49586f=_0x1cbe7f;_0x5251ce=0xc8;}else{_0x5251ce=0xce;}_0x120d63[_0xae13('0x17')](_0x5251ce);return _0x120d63['set'](_0xae13('0x1e'),_0x2766a2+'-'+_0x49586f+'/'+_0x1cbe7f)[_0xae13('0x19')](_0x50ebdf);}return null;};}function patchUpdates(_0x7b2ec4){return function(_0x11f2fc){try{jsonpatch['apply'](_0x11f2fc,_0x7b2ec4,!![]);}catch(_0x90fc57){return BPromise[_0xae13('0x1f')](_0x90fc57);}return _0x11f2fc['save']();};}function saveUpdates(_0x5f110a,_0x2d13a8){return function(_0x553dde){if(_0x553dde){return _0x553dde[_0xae13('0x20')](_0x5f110a)[_0xae13('0x21')](function(_0x59e53a){return _0x59e53a;});}return null;};}function removeEntity(_0x59c906,_0x455365){return function(_0x35bd44){if(_0x35bd44){return _0x35bd44[_0xae13('0x22')]()[_0xae13('0x21')](function(){var _0x35e881=_0x35bd44[_0xae13('0x23')]({'plain':!![]});var _0x508137=_0xae13('0x24');return db[_0xae13('0x25')]['destroy']({'where':{'type':_0x508137,'resourceId':_0x35e881['id']}})[_0xae13('0x21')](function(){return _0x35bd44;});})[_0xae13('0x21')](function(){_0x59c906[_0xae13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29928e,_0x534d8e){return function(_0x4b5b2b){if(!_0x4b5b2b){_0x29928e[_0xae13('0x26')](0x194);}return _0x4b5b2b;};}function handleError(_0x10fd1c,_0x5aa0df){_0x5aa0df=_0x5aa0df||0x1f4;return function(_0x694c76){logger[_0xae13('0x27')](_0x694c76[_0xae13('0x28')]);if(_0x694c76[_0xae13('0x29')]){delete _0x694c76[_0xae13('0x29')];}_0x10fd1c[_0xae13('0x17')](_0x5aa0df)['send'](_0x694c76);};}exports['index']=function(_0x42443b,_0x355514){var _0x4f033e={},_0x14abe8={},_0x2b5a10={'count':0x0,'rows':[]};var _0x112cb1=_['map'](db[_0xae13('0x2a')][_0xae13('0x2b')],function(_0x535161){return{'name':_0x535161['fieldName'],'type':_0x535161['type'][_0xae13('0x2c')]};});_0x14abe8[_0xae13('0x2d')]=_[_0xae13('0x2e')](_0x112cb1,_0xae13('0x29'));_0x14abe8[_0xae13('0x2f')]=_[_0xae13('0x30')](_0x42443b[_0xae13('0x2f')]);_0x14abe8[_0xae13('0x31')]=_['intersection'](_0x14abe8[_0xae13('0x2d')],_0x14abe8[_0xae13('0x2f')]);_0x4f033e['attributes']=_[_0xae13('0x32')](_0x14abe8['model'],qs[_0xae13('0x33')](_0x42443b[_0xae13('0x2f')]['fields']));_0x4f033e[_0xae13('0x34')]=_0x4f033e[_0xae13('0x34')]['length']?_0x4f033e[_0xae13('0x34')]:_0x14abe8[_0xae13('0x2d')];if(!_0x42443b['query']['hasOwnProperty'](_0xae13('0x35'))){_0x4f033e[_0xae13('0x1b')]=qs[_0xae13('0x1b')](_0x42443b['query'][_0xae13('0x1b')]);_0x4f033e[_0xae13('0x1c')]=qs[_0xae13('0x1c')](_0x42443b[_0xae13('0x2f')][_0xae13('0x1c')]);}_0x4f033e[_0xae13('0x36')]=qs[_0xae13('0x37')](_0x42443b[_0xae13('0x2f')][_0xae13('0x37')]);_0x4f033e[_0xae13('0x38')]=qs[_0xae13('0x31')](_[_0xae13('0x39')](_0x42443b[_0xae13('0x2f')],_0x14abe8[_0xae13('0x31')]),_0x112cb1);if(_0x42443b[_0xae13('0x2f')][_0xae13('0x3a')]){_0x4f033e[_0xae13('0x38')]=_['merge'](_0x4f033e[_0xae13('0x38')],{'$or':_[_0xae13('0x2e')](_0x112cb1,function(_0x459d33){if(_0x459d33['type']!==_0xae13('0x3b')){var _0x3a5198={};_0x3a5198[_0x459d33[_0xae13('0x29')]]={'$like':'%'+_0x42443b[_0xae13('0x2f')][_0xae13('0x3a')]+'%'};return _0x3a5198;}})});}_0x4f033e=_[_0xae13('0x3c')]({},_0x4f033e,_0x42443b[_0xae13('0x3d')]);var _0x24e7d5={'where':_0x4f033e[_0xae13('0x38')]};return db[_0xae13('0x2a')]['count'](_0x24e7d5)[_0xae13('0x21')](function(_0x6730c9){_0x2b5a10[_0xae13('0x1d')]=_0x6730c9;if(_0x42443b['query'][_0xae13('0x3e')]){_0x4f033e[_0xae13('0x3f')]=[{'all':!![]}];}return db[_0xae13('0x2a')]['findAll'](_0x4f033e);})[_0xae13('0x21')](function(_0x490e29){_0x2b5a10[_0xae13('0x40')]=_0x490e29;return _0x2b5a10;})[_0xae13('0x21')](respondWithFilteredResult(_0x355514,_0x4f033e))['catch'](handleError(_0x355514,null));};exports[_0xae13('0x41')]=function(_0x25ab95,_0x1cc57b){var _0x45a11a={'raw':!![],'where':{'id':_0x25ab95[_0xae13('0x42')]['id']}},_0x3f2b2f={};_0x3f2b2f['model']=_[_0xae13('0x30')](db[_0xae13('0x2a')][_0xae13('0x2b')]);_0x3f2b2f[_0xae13('0x2f')]=_[_0xae13('0x30')](_0x25ab95['query']);_0x3f2b2f[_0xae13('0x31')]=_[_0xae13('0x32')](_0x3f2b2f['model'],_0x3f2b2f[_0xae13('0x2f')]);_0x45a11a[_0xae13('0x34')]=_[_0xae13('0x32')](_0x3f2b2f[_0xae13('0x2d')],qs[_0xae13('0x33')](_0x25ab95[_0xae13('0x2f')][_0xae13('0x33')]));_0x45a11a['attributes']=_0x45a11a['attributes']['length']?_0x45a11a[_0xae13('0x34')]:_0x3f2b2f[_0xae13('0x2d')];if(_0x25ab95['query']['includeAll']){_0x45a11a[_0xae13('0x3f')]=[{'all':!![]}];}_0x45a11a=_['merge']({},_0x45a11a,_0x25ab95[_0xae13('0x3d')]);return db[_0xae13('0x2a')][_0xae13('0x43')](_0x45a11a)[_0xae13('0x21')](handleEntityNotFound(_0x1cc57b,null))['then'](respondWithResult(_0x1cc57b,null))['catch'](handleError(_0x1cc57b,null));};exports['create']=function(_0x4fcab6,_0x17aa80){return db[_0xae13('0x2a')][_0xae13('0x44')](_0x4fcab6[_0xae13('0x45')],{})[_0xae13('0x21')](function(_0x430a07){var _0x1f5fca=_0x4fcab6[_0xae13('0x46')][_0xae13('0x23')]({'plain':!![]});if(!_0x1f5fca)throw new Error(_0xae13('0x47'));if(_0x1f5fca[_0xae13('0x48')]===_0xae13('0x46')){var _0x5c5eb4=_0x430a07[_0xae13('0x23')]({'plain':!![]});var _0x46c7e7=_0xae13('0x24');return db[_0xae13('0x49')][_0xae13('0x43')]({'where':{'name':_0x46c7e7,'userProfileId':_0x1f5fca[_0xae13('0x4a')]},'raw':!![]})[_0xae13('0x21')](function(_0xfb759b){if(_0xfb759b&&_0xfb759b['autoAssociation']===0x0){return db[_0xae13('0x25')][_0xae13('0x44')]({'name':_0x5c5eb4['name'],'resourceId':_0x5c5eb4['id'],'type':_0xfb759b['name'],'sectionId':_0xfb759b['id']},{})['then'](function(){return _0x430a07;});}else{return _0x430a07;}})['catch'](function(_0x4b90ab){logger[_0xae13('0x27')](_0xae13('0x4b'),_0x4b90ab);throw _0x4b90ab;});}return _0x430a07;})[_0xae13('0x21')](respondWithResult(_0x17aa80,0xc9))[_0xae13('0x4c')](handleError(_0x17aa80,null));};exports[_0xae13('0x20')]=function(_0x3a88e4,_0xff55fd){if(_0x3a88e4[_0xae13('0x45')]['id']){delete _0x3a88e4['body']['id'];}return db[_0xae13('0x2a')][_0xae13('0x43')]({'where':{'id':_0x3a88e4[_0xae13('0x42')]['id']}})[_0xae13('0x21')](handleEntityNotFound(_0xff55fd,null))[_0xae13('0x21')](saveUpdates(_0x3a88e4[_0xae13('0x45')],null))[_0xae13('0x21')](respondWithResult(_0xff55fd,null))[_0xae13('0x4c')](handleError(_0xff55fd,null));};exports[_0xae13('0x22')]=function(_0x296425,_0x5ba4e6){return db[_0xae13('0x2a')][_0xae13('0x43')]({'where':{'id':_0x296425[_0xae13('0x42')]['id']}})[_0xae13('0x21')](handleEntityNotFound(_0x5ba4e6,null))[_0xae13('0x21')](removeEntity(_0x5ba4e6,null))[_0xae13('0x4c')](handleError(_0x5ba4e6,null));}; \ No newline at end of file +var _0x17c4=['userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','sort','pick','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions'];(function(_0x3f4c42,_0x2f57c2){var _0x47e673=function(_0x2e4cb2){while(--_0x2e4cb2){_0x3f4c42['push'](_0x3f4c42['shift']());}};_0x47e673(++_0x2f57c2);}(_0x17c4,0x102));var _0x417c=function(_0xe322c,_0x3226f9){_0xe322c=_0xe322c-0x0;var _0x3436b0=_0x17c4[_0xe322c];return _0x3436b0;};'use strict';var emlformat=require(_0x417c('0x0'));var rimraf=require(_0x417c('0x1'));var zipdir=require(_0x417c('0x2'));var jsonpatch=require(_0x417c('0x3'));var rp=require(_0x417c('0x4'));var moment=require(_0x417c('0x5'));var BPromise=require(_0x417c('0x6'));var Mustache=require(_0x417c('0x7'));var util=require(_0x417c('0x8'));var path=require(_0x417c('0x9'));var sox=require(_0x417c('0xa'));var csv=require('to-csv');var ejs=require(_0x417c('0xb'));var fs=require('fs');var fs_extra=require(_0x417c('0xc'));var _=require(_0x417c('0xd'));var squel=require(_0x417c('0xe'));var crypto=require(_0x417c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x417c('0x10'));var querystring=require(_0x417c('0x11'));var Papa=require(_0x417c('0x12'));var Redis=require(_0x417c('0x13'));var authService=require(_0x417c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x417c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x417c('0x16'))(_0x417c('0x17'));var utils=require(_0x417c('0x18'));var config=require(_0x417c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b22f,_0x5952b2){_0x5952b2=_0x5952b2||0xcc;return function(_0x4e113a){if(_0x4e113a){return _0x23b22f['sendStatus'](_0x5952b2);}return _0x23b22f[_0x417c('0x1a')](_0x5952b2)['end']();};}function respondWithResult(_0x73f8c3,_0x34361a){_0x34361a=_0x34361a||0xc8;return function(_0x49a227){if(_0x49a227){return _0x73f8c3[_0x417c('0x1a')](_0x34361a)[_0x417c('0x1b')](_0x49a227);}};}function respondWithFilteredResult(_0x3feb87,_0x4416c6){return function(_0x509fce){if(_0x509fce){var _0x56d121=typeof _0x4416c6[_0x417c('0x1c')]===_0x417c('0x1d')&&typeof _0x4416c6[_0x417c('0x1e')]==='undefined';var _0x1ab811=_0x509fce[_0x417c('0x1f')];var _0xf8d94c=_0x56d121?0x0:_0x4416c6[_0x417c('0x1c')];var _0x308618=_0x56d121?_0x509fce[_0x417c('0x1f')]:_0x4416c6[_0x417c('0x1c')]+_0x4416c6[_0x417c('0x1e')];var _0x4a8fc3;if(_0x308618>=_0x1ab811){_0x308618=_0x1ab811;_0x4a8fc3=0xc8;}else{_0x4a8fc3=0xce;}_0x3feb87[_0x417c('0x1a')](_0x4a8fc3);return _0x3feb87[_0x417c('0x20')](_0x417c('0x21'),_0xf8d94c+'-'+_0x308618+'/'+_0x1ab811)[_0x417c('0x1b')](_0x509fce);}return null;};}function patchUpdates(_0x226647){return function(_0x7c1e5a){try{jsonpatch[_0x417c('0x22')](_0x7c1e5a,_0x226647,!![]);}catch(_0x32247b){return BPromise[_0x417c('0x23')](_0x32247b);}return _0x7c1e5a[_0x417c('0x24')]();};}function saveUpdates(_0xcb26f7,_0x6b6835){return function(_0xd5a3fa){if(_0xd5a3fa){return _0xd5a3fa['update'](_0xcb26f7)['then'](function(_0x1924eb){return _0x1924eb;});}return null;};}function removeEntity(_0x3b3c60,_0x1867e6){return function(_0x5b6067){if(_0x5b6067){return _0x5b6067[_0x417c('0x25')]()[_0x417c('0x26')](function(){var _0x1a8a70=_0x5b6067[_0x417c('0x27')]({'plain':!![]});var _0x2a27f8='Dispositions';return db[_0x417c('0x28')][_0x417c('0x25')]({'where':{'type':_0x2a27f8,'resourceId':_0x1a8a70['id']}})['then'](function(){return _0x5b6067;});})['then'](function(){_0x3b3c60['status'](0xcc)[_0x417c('0x29')]();});}};}function handleEntityNotFound(_0x484ba1,_0x1c3e00){return function(_0x344867){if(!_0x344867){_0x484ba1[_0x417c('0x2a')](0x194);}return _0x344867;};}function handleError(_0x42d71b,_0x109034){_0x109034=_0x109034||0x1f4;return function(_0xa9435f){logger[_0x417c('0x2b')](_0xa9435f[_0x417c('0x2c')]);if(_0xa9435f[_0x417c('0x2d')]){delete _0xa9435f[_0x417c('0x2d')];}_0x42d71b['status'](_0x109034)[_0x417c('0x2e')](_0xa9435f);};}exports[_0x417c('0x2f')]=function(_0x217094,_0x2f0376){var _0x45a075={},_0x1345ba={},_0x4c2573={'count':0x0,'rows':[]};var _0x3f91d9=_[_0x417c('0x30')](db[_0x417c('0x31')][_0x417c('0x32')],function(_0x47c479){return{'name':_0x47c479[_0x417c('0x33')],'type':_0x47c479['type']['key']};});_0x1345ba[_0x417c('0x34')]=_['map'](_0x3f91d9,'name');_0x1345ba['query']=_['keys'](_0x217094[_0x417c('0x35')]);_0x1345ba[_0x417c('0x36')]=_['intersection'](_0x1345ba[_0x417c('0x34')],_0x1345ba['query']);_0x45a075[_0x417c('0x37')]=_[_0x417c('0x38')](_0x1345ba[_0x417c('0x34')],qs['fields'](_0x217094[_0x417c('0x35')][_0x417c('0x39')]));_0x45a075[_0x417c('0x37')]=_0x45a075[_0x417c('0x37')][_0x417c('0x3a')]?_0x45a075[_0x417c('0x37')]:_0x1345ba[_0x417c('0x34')];if(!_0x217094['query']['hasOwnProperty'](_0x417c('0x3b'))){_0x45a075[_0x417c('0x1e')]=qs['limit'](_0x217094['query'][_0x417c('0x1e')]);_0x45a075[_0x417c('0x1c')]=qs['offset'](_0x217094['query'][_0x417c('0x1c')]);}_0x45a075['order']=qs[_0x417c('0x3c')](_0x217094[_0x417c('0x35')]['sort']);_0x45a075['where']=qs[_0x417c('0x36')](_[_0x417c('0x3d')](_0x217094[_0x417c('0x35')],_0x1345ba[_0x417c('0x36')]),_0x3f91d9);if(_0x217094[_0x417c('0x35')]['filter']){_0x45a075['where']=_[_0x417c('0x3e')](_0x45a075[_0x417c('0x3f')],{'$or':_['map'](_0x3f91d9,function(_0x2e01c8){if(_0x2e01c8[_0x417c('0x40')]!==_0x417c('0x41')){var _0x2f9f1d={};_0x2f9f1d[_0x2e01c8[_0x417c('0x2d')]]={'$like':'%'+_0x217094[_0x417c('0x35')]['filter']+'%'};return _0x2f9f1d;}})});}_0x45a075=_['merge']({},_0x45a075,_0x217094[_0x417c('0x42')]);var _0x298bdb={'where':_0x45a075[_0x417c('0x3f')]};return db[_0x417c('0x31')]['count'](_0x298bdb)[_0x417c('0x26')](function(_0x3d7ec3){_0x4c2573[_0x417c('0x1f')]=_0x3d7ec3;if(_0x217094[_0x417c('0x35')][_0x417c('0x43')]){_0x45a075[_0x417c('0x44')]=[{'all':!![]}];}return db[_0x417c('0x31')][_0x417c('0x45')](_0x45a075);})[_0x417c('0x26')](function(_0x24d265){_0x4c2573[_0x417c('0x46')]=_0x24d265;return _0x4c2573;})[_0x417c('0x26')](respondWithFilteredResult(_0x2f0376,_0x45a075))[_0x417c('0x47')](handleError(_0x2f0376,null));};exports[_0x417c('0x48')]=function(_0x448d93,_0x41f985){var _0x5a6339={'raw':!![],'where':{'id':_0x448d93[_0x417c('0x49')]['id']}},_0xf76ac1={};_0xf76ac1['model']=_[_0x417c('0x4a')](db[_0x417c('0x31')][_0x417c('0x32')]);_0xf76ac1[_0x417c('0x35')]=_[_0x417c('0x4a')](_0x448d93[_0x417c('0x35')]);_0xf76ac1[_0x417c('0x36')]=_[_0x417c('0x38')](_0xf76ac1[_0x417c('0x34')],_0xf76ac1['query']);_0x5a6339['attributes']=_[_0x417c('0x38')](_0xf76ac1[_0x417c('0x34')],qs[_0x417c('0x39')](_0x448d93[_0x417c('0x35')][_0x417c('0x39')]));_0x5a6339[_0x417c('0x37')]=_0x5a6339[_0x417c('0x37')]['length']?_0x5a6339[_0x417c('0x37')]:_0xf76ac1['model'];if(_0x448d93['query']['includeAll']){_0x5a6339['include']=[{'all':!![]}];}_0x5a6339=_[_0x417c('0x3e')]({},_0x5a6339,_0x448d93[_0x417c('0x42')]);return db[_0x417c('0x31')][_0x417c('0x4b')](_0x5a6339)[_0x417c('0x26')](handleEntityNotFound(_0x41f985,null))[_0x417c('0x26')](respondWithResult(_0x41f985,null))[_0x417c('0x47')](handleError(_0x41f985,null));};exports[_0x417c('0x4c')]=function(_0x384a4f,_0x19b001){return db[_0x417c('0x31')]['create'](_0x384a4f[_0x417c('0x4d')],{})['then'](function(_0x1862fc){var _0xd43eeb=_0x384a4f[_0x417c('0x4e')][_0x417c('0x27')]({'plain':!![]});if(!_0xd43eeb)throw new Error(_0x417c('0x4f'));if(_0xd43eeb[_0x417c('0x50')]===_0x417c('0x4e')){var _0x33db9d=_0x1862fc['get']({'plain':!![]});var _0x550719=_0x417c('0x51');return db['UserProfileSection'][_0x417c('0x4b')]({'where':{'name':_0x550719,'userProfileId':_0xd43eeb[_0x417c('0x52')]},'raw':!![]})[_0x417c('0x26')](function(_0x16217d){if(_0x16217d&&_0x16217d[_0x417c('0x53')]===0x0){return db[_0x417c('0x28')][_0x417c('0x4c')]({'name':_0x33db9d['name'],'resourceId':_0x33db9d['id'],'type':_0x16217d[_0x417c('0x2d')],'sectionId':_0x16217d['id']},{})['then'](function(){return _0x1862fc;});}else{return _0x1862fc;}})['catch'](function(_0x39ca6c){logger[_0x417c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39ca6c);throw _0x39ca6c;});}return _0x1862fc;})[_0x417c('0x26')](respondWithResult(_0x19b001,0xc9))[_0x417c('0x47')](handleError(_0x19b001,null));};exports[_0x417c('0x54')]=function(_0x1b20fd,_0x33c379){if(_0x1b20fd[_0x417c('0x4d')]['id']){delete _0x1b20fd[_0x417c('0x4d')]['id'];}return db['Disposition'][_0x417c('0x4b')]({'where':{'id':_0x1b20fd[_0x417c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33c379,null))[_0x417c('0x26')](saveUpdates(_0x1b20fd[_0x417c('0x4d')],null))[_0x417c('0x26')](respondWithResult(_0x33c379,null))['catch'](handleError(_0x33c379,null));};exports['destroy']=function(_0x1bc2eb,_0x3849f9){return db[_0x417c('0x31')][_0x417c('0x4b')]({'where':{'id':_0x1bc2eb[_0x417c('0x49')]['id']}})['then'](handleEntityNotFound(_0x3849f9,null))[_0x417c('0x26')](removeEntity(_0x3849f9,null))[_0x417c('0x47')](handleError(_0x3849f9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index df240be..c32aef8 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 _0x81c5=['MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail'];(function(_0x47b226,_0xf5d1fe){var _0x5d5b00=function(_0x136620){while(--_0x136620){_0x47b226['push'](_0x47b226['shift']());}};_0x5d5b00(++_0xf5d1fe);}(_0x81c5,0xbf));var _0x581c=function(_0x137d1a,_0x397af9){_0x137d1a=_0x137d1a-0x0;var _0x2d8a31=_0x81c5[_0x137d1a];return _0x2d8a31;};'use strict';var _=require(_0x581c('0x0'));var util=require(_0x581c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x581c('0x2'));var rp=require(_0x581c('0x3'));var fs=require('fs');var path=require(_0x581c('0x4'));var rimraf=require(_0x581c('0x5'));var config=require(_0x581c('0x6'));var attributes=require('./disposition.attributes');module[_0x581c('0x7')]=function(_0x4ed041,_0x458b55){return _0x4ed041['define'](_0x581c('0x8'),attributes,{'tableName':_0x581c('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x581c('0xa'),'fields':[_0x581c('0xb'),_0x581c('0xc')]},{'unique':!![],'name':_0x581c('0xd'),'fields':['name',_0x581c('0xe')]},{'unique':!![],'name':_0x581c('0xf'),'fields':[_0x581c('0xb'),_0x581c('0x10')]},{'unique':!![],'name':_0x581c('0x11'),'fields':['name',_0x581c('0x12')]},{'unique':!![],'name':_0x581c('0x13'),'fields':[_0x581c('0xb'),_0x581c('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x581c('0xb'),_0x581c('0x15')]},{'unique':!![],'name':_0x581c('0x16'),'fields':[_0x581c('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3be2=['api','bluebird','path','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3be2,0xfa));var _0x23be=function(_0x3c8cb3,_0x2d2f07){_0x3c8cb3=_0x3c8cb3-0x0;var _0x2cfe76=_0x3be2[_0x3c8cb3];return _0x2cfe76;};'use strict';var _=require(_0x23be('0x0'));var util=require(_0x23be('0x1'));var logger=require('../../config/logger')(_0x23be('0x2'));var moment=require('moment');var BPromise=require(_0x23be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23be('0x4'));var rimraf=require(_0x23be('0x5'));var config=require('../../config/environment');var attributes=require(_0x23be('0x6'));module[_0x23be('0x7')]=function(_0x3708c3,_0x421dda){return _0x3708c3[_0x23be('0x8')]('Disposition',attributes,{'tableName':_0x23be('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x23be('0xa'),'fields':['name',_0x23be('0xb')]},{'unique':!![],'name':_0x23be('0xc'),'fields':['name',_0x23be('0xd')]},{'unique':!![],'name':_0x23be('0xe'),'fields':[_0x23be('0xf'),_0x23be('0x10')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x23be('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x23be('0x11'),'fields':['name',_0x23be('0x12')]},{'unique':!![],'name':_0x23be('0x13'),'fields':[_0x23be('0xf'),_0x23be('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 06014a3..299c084 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(_0x4aa3ef,_0x5addf8){var _0x198240=function(_0xcc26b5){while(--_0xcc26b5){_0x4aa3ef['push'](_0x4aa3ef['shift']());}};_0x198240(++_0x5addf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x3ec12d,_0x476804){var _0x49e7ba=function(_0x45b7c3){while(--_0x45b7c3){_0x3ec12d['push'](_0x3ec12d['shift']());}};_0x49e7ba(++_0x476804);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 c6f8f23..585eec3 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 _0x30f7=['exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x43d99b,_0x4d6ad9){var _0x1f43b9=function(_0x433a44){while(--_0x433a44){_0x43d99b['push'](_0x43d99b['shift']());}};_0x1f43b9(++_0x4d6ad9);}(_0x30f7,0xd9));var _0x730f=function(_0xd6eb29,_0x539635){_0xd6eb29=_0xd6eb29-0x0;var _0x4c0113=_0x30f7[_0xd6eb29];return _0x4c0113;};'use strict';var multer=require('multer');var util=require(_0x730f('0x0'));var path=require(_0x730f('0x1'));var timeout=require('connect-timeout');var express=require(_0x730f('0x2'));var router=express['Router']();var fs_extra=require(_0x730f('0x3'));var auth=require(_0x730f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x730f('0x5'));var controller=require(_0x730f('0x6'));router[_0x730f('0x7')]('/',auth[_0x730f('0x8')](),controller[_0x730f('0x9')]);router[_0x730f('0x7')](_0x730f('0xa'),auth[_0x730f('0x8')](),controller[_0x730f('0xb')]);router[_0x730f('0xc')]('/',auth[_0x730f('0x8')](),controller[_0x730f('0xd')]);router[_0x730f('0xe')]('/:id',auth[_0x730f('0x8')](),controller[_0x730f('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x730f('0x10')]);module[_0x730f('0x11')]=router; \ No newline at end of file +var _0xb2b9=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x16466f,_0x39888b){var _0xec7bbd=function(_0xe52392){while(--_0xe52392){_0x16466f['push'](_0x16466f['shift']());}};_0xec7bbd(++_0x39888b);}(_0xb2b9,0xea));var _0x9b2b=function(_0x291ebc,_0x48a394){_0x291ebc=_0x291ebc-0x0;var _0x3e9a02=_0xb2b9[_0x291ebc];return _0x3e9a02;};'use strict';var multer=require('multer');var util=require(_0x9b2b('0x0'));var path=require(_0x9b2b('0x1'));var timeout=require(_0x9b2b('0x2'));var express=require(_0x9b2b('0x3'));var router=express[_0x9b2b('0x4')]();var fs_extra=require(_0x9b2b('0x5'));var auth=require(_0x9b2b('0x6'));var interaction=require(_0x9b2b('0x7'));var config=require(_0x9b2b('0x8'));var controller=require('./disposition.controller');router[_0x9b2b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b2b('0xa')]);router['get'](_0x9b2b('0xb'),auth[_0x9b2b('0xc')](),controller[_0x9b2b('0xd')]);router[_0x9b2b('0xe')]('/',auth[_0x9b2b('0xc')](),controller[_0x9b2b('0xf')]);router[_0x9b2b('0x10')](_0x9b2b('0xb'),auth['isAuthenticated'](),controller[_0x9b2b('0x11')]);router[_0x9b2b('0x12')](_0x9b2b('0xb'),auth[_0x9b2b('0xc')](),controller[_0x9b2b('0x13')]);module[_0x9b2b('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 00c2c6c..f3d327b 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 _0x79c8=['7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','IAX','KHOMP','SIP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x274c88,_0x5dcc9e){var _0x54b164=function(_0xffd377){while(--_0xffd377){_0x274c88['push'](_0x274c88['shift']());}};_0x54b164(++_0x5dcc9e);}(_0x79c8,0x10c));var _0x879c=function(_0x487ca5,_0x46e781){_0x487ca5=_0x487ca5-0x0;var _0x48bf89=_0x79c8[_0x487ca5];return _0x48bf89;};'use strict';var Sequelize=require(_0x879c('0x0'));module[_0x879c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x879c('0x2')]},'ecm':{'type':Sequelize[_0x879c('0x3')]('yes','no'),'defaultValue':_0x879c('0x4')},'headerinfo':{'type':Sequelize[_0x879c('0x2')],'defaultValue':_0x879c('0x5')},'localstationid':{'type':Sequelize[_0x879c('0x2')],'unique':_0x879c('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x879c('0x7'),'4800',_0x879c('0x8'),_0x879c('0x9'),_0x879c('0xa'),_0x879c('0xb')),'defaultValue':_0x879c('0xc')},'maxrate':{'type':Sequelize[_0x879c('0x3')](_0x879c('0x7'),_0x879c('0xc'),'7200',_0x879c('0x9'),_0x879c('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x879c('0x2')],'defaultValue':_0x879c('0xd')},'gateway':{'type':Sequelize[_0x879c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x879c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x879c('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x879c('0x3')]('SIP',_0x879c('0xf'),'DADHI',_0x879c('0x10')),'defaultValue':_0x879c('0x11')},'key':{'type':Sequelize[_0x879c('0x2')],'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[_0x879c('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x879c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x879c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x879c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x879c('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x879c('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x879c('0x14'),'set':function(_0x10165a){if(!_0x10165a)this[_0x879c('0x15')](_0x879c('0x16'),null);this[_0x879c('0x15')]('mandatoryDisposition',_0x10165a);}}}; \ No newline at end of file +var _0x45e0=['mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x363403,_0x12bd6e){var _0xbc980a=function(_0x4d26db){while(--_0x4d26db){_0x363403['push'](_0x363403['shift']());}};_0xbc980a(++_0x12bd6e);}(_0x45e0,0x171));var _0x045e=function(_0x1d494f,_0x4ce2a5){_0x1d494f=_0x1d494f-0x0;var _0x3709cb=_0x45e0[_0x1d494f];return _0x3709cb;};'use strict';var Sequelize=require('sequelize');module[_0x045e('0x0')]={'name':{'type':Sequelize[_0x045e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x045e('0x1')]},'ecm':{'type':Sequelize[_0x045e('0x2')](_0x045e('0x3'),'no'),'defaultValue':_0x045e('0x3')},'headerinfo':{'type':Sequelize[_0x045e('0x1')],'defaultValue':_0x045e('0x4')},'localstationid':{'type':Sequelize[_0x045e('0x1')],'unique':_0x045e('0x5')},'minrate':{'type':Sequelize[_0x045e('0x2')](_0x045e('0x6'),_0x045e('0x7'),_0x045e('0x8'),_0x045e('0x9'),_0x045e('0xa'),_0x045e('0xb')),'defaultValue':_0x045e('0x7')},'maxrate':{'type':Sequelize[_0x045e('0x2')]('2400',_0x045e('0x7'),'7200','9600',_0x045e('0xa'),_0x045e('0xb')),'defaultValue':_0x045e('0xb')},'modem':{'type':Sequelize[_0x045e('0x1')],'defaultValue':_0x045e('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x045e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x045e('0x2')](_0x045e('0xd'),'IAX',_0x045e('0xe'),_0x045e('0xf')),'defaultValue':_0x045e('0xd')},'key':{'type':Sequelize[_0x045e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x045e('0x10')],'defaultValue':function(){return _0x045e('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x045e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x045e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x045e('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x045e('0x12')],'defaultValue':![],'comment':_0x045e('0x14'),'set':function(_0x1fb6e9){if(!_0x1fb6e9)this[_0x045e('0x15')]('mandatoryDispositionPauseId',null);this[_0x045e('0x15')](_0x045e('0x16'),_0x1fb6e9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b90413f..acc6cc5 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 _0x5f85=['getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','Contacts','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','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','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById'];(function(_0x265e5b,_0x311756){var _0x1996a1=function(_0x159448){while(--_0x159448){_0x265e5b['push'](_0x265e5b['shift']());}};_0x1996a1(++_0x311756);}(_0x5f85,0x1b0));var _0x55f8=function(_0x201422,_0x4a4f49){_0x201422=_0x201422-0x0;var _0x5fb769=_0x5f85[_0x201422];return _0x5fb769;};'use strict';var emlformat=require(_0x55f8('0x0'));var rimraf=require(_0x55f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55f8('0x2'));var rp=require(_0x55f8('0x3'));var moment=require(_0x55f8('0x4'));var BPromise=require(_0x55f8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x55f8('0x6'));var sox=require('sox');var csv=require(_0x55f8('0x7'));var ejs=require(_0x55f8('0x8'));var fs=require('fs');var fs_extra=require(_0x55f8('0x9'));var _=require(_0x55f8('0xa'));var squel=require(_0x55f8('0xb'));var crypto=require(_0x55f8('0xc'));var jsforce=require(_0x55f8('0xd'));var deskjs=require(_0x55f8('0xe'));var toCsv=require(_0x55f8('0x7'));var querystring=require(_0x55f8('0xf'));var Papa=require('papaparse');var Redis=require(_0x55f8('0x10'));var authService=require(_0x55f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x55f8('0x12'));var hardwareService=require(_0x55f8('0x13'));var logger=require(_0x55f8('0x14'))(_0x55f8('0x15'));var utils=require(_0x55f8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x55f8('0x17'));var db=require(_0x55f8('0x18'))['db'];config[_0x55f8('0x19')]=_[_0x55f8('0x1a')](config[_0x55f8('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x55f8('0x1b'))(new Redis(config[_0x55f8('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x55f8('0x1c'));var client=jayson[_0x55f8('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x55f8('0x1d')][_0x55f8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2b05b8,_0x27750a,_0x3d343f,_0x427674){return new BPromise(function(_0x21ca55,_0x528e45){var _0x1988f1=_0x427674||client;return _0x1988f1['request'](_0x2b05b8,_0x3d343f)[_0x55f8('0x1f')](function(_0x1ac36a){logger[_0x55f8('0x20')](_0x55f8('0x21'),_0x27750a,_0x55f8('0x22'));logger[_0x55f8('0x23')](_0x55f8('0x24'),_0x27750a,_0x55f8('0x22'),JSON[_0x55f8('0x25')](_0x1ac36a));if(_0x1ac36a[_0x55f8('0x26')]){if(_0x1ac36a[_0x55f8('0x26')][_0x55f8('0x27')]===0x1f4){logger[_0x55f8('0x26')]('FaxAccount,\x20%s,\x20%s',_0x27750a,_0x1ac36a[_0x55f8('0x26')][_0x55f8('0x28')]);return _0x528e45(_0x1ac36a[_0x55f8('0x26')][_0x55f8('0x28')]);}logger[_0x55f8('0x26')](_0x55f8('0x21'),_0x27750a,_0x1ac36a['error'][_0x55f8('0x28')]);return _0x21ca55(_0x1ac36a[_0x55f8('0x26')]['message']);}else{logger[_0x55f8('0x20')](_0x55f8('0x21'),_0x27750a,'request\x20sent');_0x21ca55(_0x1ac36a[_0x55f8('0x29')][_0x55f8('0x28')]);}})[_0x55f8('0x2a')](function(_0x39b84d){logger[_0x55f8('0x26')](_0x55f8('0x21'),_0x27750a,_0x39b84d);_0x528e45(_0x39b84d);});});}function respondWithStatusCode(_0x554903,_0x1ea993){_0x1ea993=_0x1ea993||0xcc;return function(_0x23e902){if(_0x23e902){return _0x554903['sendStatus'](_0x1ea993);}return _0x554903[_0x55f8('0x2b')](_0x1ea993)[_0x55f8('0x2c')]();};}function respondWithResult(_0x39f3e1,_0x527e01){_0x527e01=_0x527e01||0xc8;return function(_0x80c111){if(_0x80c111){return _0x39f3e1['status'](_0x527e01)[_0x55f8('0x2d')](_0x80c111);}};}function respondWithFilteredResult(_0x5ad585,_0x506e32){return function(_0x7cf279){if(_0x7cf279){var _0x465e21=typeof _0x506e32['offset']===_0x55f8('0x2e')&&typeof _0x506e32[_0x55f8('0x2f')]===_0x55f8('0x2e');var _0x48f9a0=_0x7cf279[_0x55f8('0x30')];var _0x65e48e=_0x465e21?0x0:_0x506e32[_0x55f8('0x31')];var _0x376ec3=_0x465e21?_0x7cf279[_0x55f8('0x30')]:_0x506e32[_0x55f8('0x31')]+_0x506e32[_0x55f8('0x2f')];var _0x5e69fe;if(_0x376ec3>=_0x48f9a0){_0x376ec3=_0x48f9a0;_0x5e69fe=0xc8;}else{_0x5e69fe=0xce;}_0x5ad585[_0x55f8('0x2b')](_0x5e69fe);return _0x5ad585[_0x55f8('0x32')](_0x55f8('0x33'),_0x65e48e+'-'+_0x376ec3+'/'+_0x48f9a0)['json'](_0x7cf279);}return null;};}function patchUpdates(_0x2a6025){return function(_0x19e366){try{jsonpatch[_0x55f8('0x34')](_0x19e366,_0x2a6025,!![]);}catch(_0x17cc80){return BPromise['reject'](_0x17cc80);}return _0x19e366[_0x55f8('0x35')]();};}function saveUpdates(_0x144a5f,_0x599e40){return function(_0x2739ac){if(_0x2739ac){return _0x2739ac[_0x55f8('0x36')](_0x144a5f)['then'](function(_0x395988){return _0x395988;});}return null;};}function removeEntity(_0x40aac2,_0x33bbed){return function(_0x28d226){if(_0x28d226){return _0x28d226[_0x55f8('0x37')]()['then'](function(){var _0x519bd0=_0x28d226[_0x55f8('0x38')]({'plain':!![]});var _0x3defad=_0x55f8('0x39');return db[_0x55f8('0x3a')]['destroy']({'where':{'type':_0x3defad,'resourceId':_0x519bd0['id']}})['then'](function(){return _0x28d226;});})[_0x55f8('0x1f')](function(){_0x40aac2[_0x55f8('0x2b')](0xcc)[_0x55f8('0x2c')]();});}};}function handleEntityNotFound(_0x1621f8,_0x5dbaae){return function(_0x61eece){if(!_0x61eece){_0x1621f8[_0x55f8('0x3b')](0x194);}return _0x61eece;};}function handleError(_0x40b5d1,_0x4dfa2e){_0x4dfa2e=_0x4dfa2e||0x1f4;return function(_0x1d76a4){logger[_0x55f8('0x26')](_0x1d76a4['stack']);if(_0x1d76a4[_0x55f8('0x3c')]){delete _0x1d76a4[_0x55f8('0x3c')];}_0x40b5d1['status'](_0x4dfa2e)[_0x55f8('0x3d')](_0x1d76a4);};}exports['index']=function(_0x4cf928,_0x199900){var _0x55093a={'include':[{'model':db[_0x55f8('0x3e')],'as':_0x55f8('0x3f')}]},_0x2ca689={},_0x3ba0e2={'count':0x0,'rows':[]};var _0xe4347e=_['map'](db[_0x55f8('0x40')][_0x55f8('0x41')],function(_0x1487e8){return{'name':_0x1487e8[_0x55f8('0x42')],'type':_0x1487e8[_0x55f8('0x43')][_0x55f8('0x44')]};});_0x2ca689[_0x55f8('0x45')]=_[_0x55f8('0x46')](_0xe4347e,_0x55f8('0x3c'));_0x2ca689[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x4cf928[_0x55f8('0x47')]);_0x2ca689['filters']=_[_0x55f8('0x49')](_0x2ca689['model'],_0x2ca689[_0x55f8('0x47')]);_0x55093a[_0x55f8('0x4a')]=_[_0x55f8('0x49')](_0x2ca689[_0x55f8('0x45')],qs[_0x55f8('0x4b')](_0x4cf928[_0x55f8('0x47')][_0x55f8('0x4b')]));_0x55093a[_0x55f8('0x4a')]=_0x55093a[_0x55f8('0x4a')][_0x55f8('0x4c')]?_0x55093a[_0x55f8('0x4a')]:_0x2ca689[_0x55f8('0x45')];if(!_0x4cf928['query'][_0x55f8('0x4d')]('nolimit')){_0x55093a[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x4cf928[_0x55f8('0x47')][_0x55f8('0x2f')]);_0x55093a[_0x55f8('0x31')]=qs[_0x55f8('0x31')](_0x4cf928[_0x55f8('0x47')][_0x55f8('0x31')]);}_0x55093a[_0x55f8('0x4e')]=qs[_0x55f8('0x4f')](_0x4cf928[_0x55f8('0x47')][_0x55f8('0x4f')]);_0x55093a[_0x55f8('0x50')]=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x4cf928[_0x55f8('0x47')],_0x2ca689[_0x55f8('0x51')]),_0xe4347e);if(_0x4cf928['query'][_0x55f8('0x53')]){_0x55093a[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x55093a[_0x55f8('0x50')],{'$or':_['map'](_0xe4347e,function(_0x852858){if(_0x852858[_0x55f8('0x43')]!==_0x55f8('0x55')){var _0x3b0699={};_0x3b0699[_0x852858[_0x55f8('0x3c')]]={'$like':'%'+_0x4cf928[_0x55f8('0x47')][_0x55f8('0x53')]+'%'};return _0x3b0699;}})});}_0x55093a=_['merge']({},_0x55093a,_0x4cf928[_0x55f8('0x56')]);var _0x3f4f23={'where':_0x55093a[_0x55f8('0x50')]};return db[_0x55f8('0x40')][_0x55f8('0x30')](_0x3f4f23)[_0x55f8('0x1f')](function(_0x142795){_0x3ba0e2[_0x55f8('0x30')]=_0x142795;if(_0x4cf928[_0x55f8('0x47')][_0x55f8('0x57')]){_0x55093a[_0x55f8('0x58')]=[{'all':!![]}];}return db[_0x55f8('0x40')]['findAll'](_0x55093a);})['then'](function(_0x7479bb){_0x3ba0e2[_0x55f8('0x59')]=_0x7479bb;return _0x3ba0e2;})[_0x55f8('0x1f')](respondWithFilteredResult(_0x199900,_0x55093a))[_0x55f8('0x2a')](handleError(_0x199900,null));};exports['show']=function(_0x30f6fd,_0x16077b){var _0x131ff0={'raw':![],'where':{'id':_0x30f6fd['params']['id']},'include':[{'model':db['Pause'],'as':_0x55f8('0x3f')}]},_0x207c8d={};_0x207c8d[_0x55f8('0x45')]=_[_0x55f8('0x48')](db[_0x55f8('0x40')][_0x55f8('0x41')]);_0x207c8d[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x30f6fd[_0x55f8('0x47')]);_0x207c8d['filters']=_['intersection'](_0x207c8d[_0x55f8('0x45')],_0x207c8d[_0x55f8('0x47')]);_0x131ff0['attributes']=_[_0x55f8('0x49')](_0x207c8d[_0x55f8('0x45')],qs[_0x55f8('0x4b')](_0x30f6fd[_0x55f8('0x47')][_0x55f8('0x4b')]));_0x131ff0[_0x55f8('0x4a')]=_0x131ff0['attributes'][_0x55f8('0x4c')]?_0x131ff0[_0x55f8('0x4a')]:_0x207c8d[_0x55f8('0x45')];if(_0x30f6fd['query'][_0x55f8('0x57')]){_0x131ff0['include']=[{'all':!![]}];}_0x131ff0=_['merge']({},_0x131ff0,_0x30f6fd['options']);return db[_0x55f8('0x40')]['find'](_0x131ff0)[_0x55f8('0x1f')](handleEntityNotFound(_0x16077b,null))[_0x55f8('0x1f')](respondWithResult(_0x16077b,null))[_0x55f8('0x2a')](handleError(_0x16077b,null));};exports[_0x55f8('0x5a')]=function(_0x1295fd,_0x134d1c){return db['FaxAccount'][_0x55f8('0x5a')](_0x1295fd[_0x55f8('0x5b')],{})[_0x55f8('0x1f')](function(_0x96aa10){var _0xc65bf1=_0x1295fd['user'][_0x55f8('0x38')]({'plain':!![]});if(!_0xc65bf1)throw new Error(_0x55f8('0x5c'));if(_0xc65bf1[_0x55f8('0x5d')]===_0x55f8('0x5e')){var _0x3eab4a=_0x96aa10['get']({'plain':!![]});var _0x2946ff='FaxAccounts';return db[_0x55f8('0x5f')][_0x55f8('0x60')]({'where':{'name':_0x2946ff,'userProfileId':_0xc65bf1[_0x55f8('0x61')]},'raw':!![]})[_0x55f8('0x1f')](function(_0x1fd854){if(_0x1fd854&&_0x1fd854[_0x55f8('0x62')]===0x0){return db['UserProfileResource'][_0x55f8('0x5a')]({'name':_0x3eab4a[_0x55f8('0x3c')],'resourceId':_0x3eab4a['id'],'type':_0x1fd854[_0x55f8('0x3c')],'sectionId':_0x1fd854['id']},{})['then'](function(){return _0x96aa10;});}else{return _0x96aa10;}})['catch'](function(_0x5db5d0){logger[_0x55f8('0x26')](_0x55f8('0x63'),_0x5db5d0);throw _0x5db5d0;});}return _0x96aa10;})[_0x55f8('0x1f')](respondWithResult(_0x134d1c,0xc9))['catch'](handleError(_0x134d1c,null));};exports[_0x55f8('0x36')]=function(_0x348278,_0x538320){if(_0x348278[_0x55f8('0x5b')]['id']){delete _0x348278[_0x55f8('0x5b')]['id'];}return db[_0x55f8('0x40')][_0x55f8('0x60')]({'where':{'id':_0x348278[_0x55f8('0x64')]['id']},'include':[{'model':db[_0x55f8('0x3e')],'as':_0x55f8('0x3f')}]})[_0x55f8('0x1f')](handleEntityNotFound(_0x538320,null))[_0x55f8('0x1f')](saveUpdates(_0x348278['body'],null))[_0x55f8('0x1f')](respondWithResult(_0x538320,null))['catch'](handleError(_0x538320,null));};exports['destroy']=function(_0x1060f3,_0x4e8006){return db[_0x55f8('0x40')][_0x55f8('0x60')]({'where':{'id':_0x1060f3[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x4e8006,null))[_0x55f8('0x1f')](removeEntity(_0x4e8006,null))[_0x55f8('0x2a')](handleError(_0x4e8006,null));};exports['describe']=function(_0x78d88e,_0x1c5203){return db[_0x55f8('0x40')][_0x55f8('0x65')]()[_0x55f8('0x1f')](respondWithResult(_0x1c5203,null))[_0x55f8('0x2a')](handleError(_0x1c5203,null));};exports[_0x55f8('0x66')]=function(_0x230875,_0x12bbc7,_0x45cd35){if(_0x230875[_0x55f8('0x5b')]['id']){delete _0x230875[_0x55f8('0x5b')]['id'];}return db[_0x55f8('0x40')]['find']({'where':{'id':_0x230875[_0x55f8('0x64')]['id']}})['then'](handleEntityNotFound(_0x12bbc7,null))[_0x55f8('0x1f')](function(_0x2b68be){if(_0x2b68be){_0x230875[_0x55f8('0x5b')][_0x55f8('0x67')]=_0x2b68be['id'];return db[_0x55f8('0x68')][_0x55f8('0x5a')](_0x230875[_0x55f8('0x5b')]);}})['then'](respondWithResult(_0x12bbc7,null))[_0x55f8('0x2a')](handleError(_0x12bbc7,null));};exports[_0x55f8('0x69')]=function(_0x3e1bd5,_0x58b9ae,_0x453ff1){var _0x4d28ef={'raw':![],'where':{}};var _0x2ffea6={};var _0x5f4587={'count':0x0,'rows':[]};return db[_0x55f8('0x40')][_0x55f8('0x6a')]({'where':{'id':_0x3e1bd5[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x58b9ae,null))['then'](function(_0xb66810){if(_0xb66810){_0x2ffea6[_0x55f8('0x45')]=_[_0x55f8('0x48')](db[_0x55f8('0x68')][_0x55f8('0x41')]);_0x2ffea6[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x3e1bd5[_0x55f8('0x47')]);_0x2ffea6['filters']=_[_0x55f8('0x49')](_0x2ffea6['model'],_0x2ffea6[_0x55f8('0x47')]);_0x4d28ef[_0x55f8('0x4a')]=_[_0x55f8('0x49')](_0x2ffea6[_0x55f8('0x45')],qs['fields'](_0x3e1bd5[_0x55f8('0x47')][_0x55f8('0x4b')]));_0x4d28ef['attributes']=_0x4d28ef[_0x55f8('0x4a')][_0x55f8('0x4c')]?_0x4d28ef['attributes']:_0x2ffea6['model'];if(!_0x3e1bd5[_0x55f8('0x47')][_0x55f8('0x4d')](_0x55f8('0x6b'))){_0x4d28ef[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x3e1bd5[_0x55f8('0x47')][_0x55f8('0x2f')]);_0x4d28ef['offset']=qs[_0x55f8('0x31')](_0x3e1bd5['query'][_0x55f8('0x31')]);}_0x4d28ef['order']=qs[_0x55f8('0x4f')](_0x3e1bd5['query']['sort']);_0x4d28ef[_0x55f8('0x50')]=qs['filters'](_[_0x55f8('0x52')](_0x3e1bd5[_0x55f8('0x47')],_0x2ffea6[_0x55f8('0x51')]));_0x4d28ef[_0x55f8('0x50')]['FaxAccountId']=_0xb66810['id'];if(_0x3e1bd5[_0x55f8('0x47')]['filter']){_0x4d28ef[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x4d28ef[_0x55f8('0x50')],{'$or':_['map'](_0x4d28ef[_0x55f8('0x4a')],function(_0x33a813){var _0x25cc22={};_0x25cc22[_0x33a813]={'$like':'%'+_0x3e1bd5[_0x55f8('0x47')][_0x55f8('0x53')]+'%'};return _0x25cc22;})});}_0x4d28ef=_['merge']({},_0x4d28ef,_0x3e1bd5['options']);return db[_0x55f8('0x68')][_0x55f8('0x30')]({'where':_0x4d28ef['where']})[_0x55f8('0x1f')](function(_0x3dccae){_0x5f4587[_0x55f8('0x30')]=_0x3dccae;if(_0x3e1bd5[_0x55f8('0x47')][_0x55f8('0x57')]){_0x4d28ef[_0x55f8('0x58')]=[{'all':!![]}];}return db[_0x55f8('0x68')][_0x55f8('0x6c')](_0x4d28ef);})[_0x55f8('0x1f')](function(_0x4beb42){_0x5f4587[_0x55f8('0x59')]=_0x4beb42;return _0x5f4587;});}})[_0x55f8('0x1f')](respondWithFilteredResult(_0x58b9ae,_0x4d28ef))[_0x55f8('0x2a')](handleError(_0x58b9ae,null));};exports[_0x55f8('0x6d')]=function(_0x16259e,_0x3dc068,_0x54c462){return db['FaxAccount'][_0x55f8('0x60')]({'where':{'id':_0x16259e['params']['id']}})['then'](handleEntityNotFound(_0x3dc068,null))[_0x55f8('0x1f')](function(_0x5e7161){if(_0x5e7161){return _0x5e7161['removeDispositions'](_0x16259e[_0x55f8('0x47')][_0x55f8('0x6e')]);}})['then'](respondWithStatusCode(_0x3dc068,null))[_0x55f8('0x2a')](handleError(_0x3dc068,null));};exports[_0x55f8('0x6f')]=function(_0x3912ae,_0x2e0f59,_0x2357b3){if(_0x3912ae[_0x55f8('0x5b')]['id']){delete _0x3912ae[_0x55f8('0x5b')]['id'];}return db[_0x55f8('0x40')][_0x55f8('0x60')]({'where':{'id':_0x3912ae[_0x55f8('0x64')]['id']}})['then'](handleEntityNotFound(_0x2e0f59,null))[_0x55f8('0x1f')](function(_0x9526b2){if(_0x9526b2){_0x3912ae['body'][_0x55f8('0x67')]=_0x9526b2['id'];return db[_0x55f8('0x70')]['create'](_0x3912ae[_0x55f8('0x5b')]);}})[_0x55f8('0x1f')](respondWithResult(_0x2e0f59,null))[_0x55f8('0x2a')](handleError(_0x2e0f59,null));};exports['getAnswers']=function(_0x25201f,_0x939631,_0x398af9){var _0x331ee0={'raw':![],'where':{}};var _0x5ed176={};var _0x5e506c={'count':0x0,'rows':[]};return db[_0x55f8('0x40')][_0x55f8('0x6a')]({'where':{'id':_0x25201f[_0x55f8('0x64')]['id']}})['then'](handleEntityNotFound(_0x939631,null))['then'](function(_0x32a089){if(_0x32a089){_0x5ed176[_0x55f8('0x45')]=_[_0x55f8('0x48')](db[_0x55f8('0x70')][_0x55f8('0x41')]);_0x5ed176['query']=_[_0x55f8('0x48')](_0x25201f['query']);_0x5ed176['filters']=_[_0x55f8('0x49')](_0x5ed176['model'],_0x5ed176[_0x55f8('0x47')]);_0x331ee0['attributes']=_['intersection'](_0x5ed176['model'],qs[_0x55f8('0x4b')](_0x25201f[_0x55f8('0x47')]['fields']));_0x331ee0[_0x55f8('0x4a')]=_0x331ee0[_0x55f8('0x4a')][_0x55f8('0x4c')]?_0x331ee0['attributes']:_0x5ed176['model'];if(!_0x25201f['query']['hasOwnProperty']('nolimit')){_0x331ee0[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x25201f[_0x55f8('0x47')][_0x55f8('0x2f')]);_0x331ee0[_0x55f8('0x31')]=qs['offset'](_0x25201f[_0x55f8('0x47')][_0x55f8('0x31')]);}_0x331ee0['order']=qs['sort'](_0x25201f[_0x55f8('0x47')][_0x55f8('0x4f')]);_0x331ee0[_0x55f8('0x50')]=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x25201f[_0x55f8('0x47')],_0x5ed176['filters']));_0x331ee0[_0x55f8('0x50')][_0x55f8('0x67')]=_0x32a089['id'];if(_0x25201f[_0x55f8('0x47')]['filter']){_0x331ee0[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x331ee0[_0x55f8('0x50')],{'$or':_[_0x55f8('0x46')](_0x331ee0[_0x55f8('0x4a')],function(_0x5acbe3){var _0x5ce8d9={};_0x5ce8d9[_0x5acbe3]={'$like':'%'+_0x25201f['query'][_0x55f8('0x53')]+'%'};return _0x5ce8d9;})});}_0x331ee0=_[_0x55f8('0x54')]({},_0x331ee0,_0x25201f[_0x55f8('0x56')]);return db['CannedAnswer'][_0x55f8('0x30')]({'where':_0x331ee0['where']})[_0x55f8('0x1f')](function(_0x333565){_0x5e506c[_0x55f8('0x30')]=_0x333565;if(_0x25201f[_0x55f8('0x47')][_0x55f8('0x57')]){_0x331ee0[_0x55f8('0x58')]=[{'all':!![]}];}return db[_0x55f8('0x70')][_0x55f8('0x6c')](_0x331ee0);})['then'](function(_0x5b7467){_0x5e506c[_0x55f8('0x59')]=_0x5b7467;return _0x5e506c;});}})[_0x55f8('0x1f')](respondWithFilteredResult(_0x939631,_0x331ee0))[_0x55f8('0x2a')](handleError(_0x939631,null));};exports['removeAnswers']=function(_0x58197f,_0x46720a,_0x66b4a4){return db[_0x55f8('0x40')][_0x55f8('0x60')]({'where':{'id':_0x58197f[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x46720a,null))['then'](function(_0x10541b){if(_0x10541b){return _0x10541b[_0x55f8('0x71')](_0x58197f['query'][_0x55f8('0x6e')]);}})['then'](respondWithStatusCode(_0x46720a,null))[_0x55f8('0x2a')](handleError(_0x46720a,null));};exports[_0x55f8('0x72')]=function(_0x10276d,_0x1c34d6,_0x55aa99){return db['FaxInteraction'][_0x55f8('0x60')]({'where':{'id':_0x10276d['params']['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x1c34d6,null))['then'](function(_0xb451bd){if(_0xb451bd){return _0xb451bd['addInteraction'](_0x10276d[_0x55f8('0x5b')][_0x55f8('0x6e')],_[_0x55f8('0x73')](_0x10276d[_0x55f8('0x5b')],[_0x55f8('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x1c34d6,null))[_0x55f8('0x2a')](handleError(_0x1c34d6,null));};exports[_0x55f8('0x74')]=function(_0x14041f,_0x1a785a,_0xa101e0){var _0x3ad15f={'raw':![],'where':{}};var _0x4da1b0={};var _0x5b3e4a={'count':0x0,'rows':[]};return db[_0x55f8('0x40')][_0x55f8('0x6a')]({'where':{'id':_0x14041f[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x1a785a,null))[_0x55f8('0x1f')](function(_0x1e10de){if(_0x1e10de){_0x4da1b0[_0x55f8('0x45')]=_[_0x55f8('0x48')](db[_0x55f8('0x75')][_0x55f8('0x41')]);_0x4da1b0[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x14041f['query']);_0x4da1b0[_0x55f8('0x51')]=_[_0x55f8('0x49')](_0x4da1b0[_0x55f8('0x45')],_0x4da1b0[_0x55f8('0x47')]);_0x3ad15f[_0x55f8('0x4a')]=_[_0x55f8('0x49')](_0x4da1b0[_0x55f8('0x45')],qs[_0x55f8('0x4b')](_0x14041f[_0x55f8('0x47')][_0x55f8('0x4b')]));_0x3ad15f['attributes']=_0x3ad15f[_0x55f8('0x4a')]['length']?_0x3ad15f['attributes']:_0x4da1b0[_0x55f8('0x45')];if(!_0x14041f[_0x55f8('0x47')][_0x55f8('0x4d')](_0x55f8('0x6b'))){_0x3ad15f['limit']=qs['limit'](_0x14041f['query']['limit']);_0x3ad15f[_0x55f8('0x31')]=qs[_0x55f8('0x31')](_0x14041f[_0x55f8('0x47')]['offset']);}_0x3ad15f[_0x55f8('0x4e')]=qs['sort'](_0x14041f[_0x55f8('0x47')]['sort']);_0x3ad15f[_0x55f8('0x50')]=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x14041f[_0x55f8('0x47')],_0x4da1b0[_0x55f8('0x51')]));_0x3ad15f[_0x55f8('0x50')][_0x55f8('0x67')]=_0x1e10de['id'];if(_0x14041f[_0x55f8('0x47')][_0x55f8('0x53')]){_0x3ad15f[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x3ad15f[_0x55f8('0x50')],{'$or':_['map'](_0x3ad15f['attributes'],function(_0x2a5133){var _0x1c93d3={};_0x1c93d3[_0x2a5133]={'$like':'%'+_0x14041f[_0x55f8('0x47')][_0x55f8('0x53')]+'%'};return _0x1c93d3;})});}_0x3ad15f=_[_0x55f8('0x54')]({},_0x3ad15f,_0x14041f[_0x55f8('0x56')]);return db['FaxInteraction'][_0x55f8('0x30')]({'where':_0x3ad15f[_0x55f8('0x50')]})[_0x55f8('0x1f')](function(_0x214f95){_0x5b3e4a[_0x55f8('0x30')]=_0x214f95;if(_0x14041f[_0x55f8('0x47')][_0x55f8('0x57')]){_0x3ad15f[_0x55f8('0x58')]=[{'model':db[_0x55f8('0x76')],'as':'Contact','required':![]},{'model':db[_0x55f8('0x77')],'as':_0x55f8('0x78'),'attributes':[_0x55f8('0x3c'),'fullname',_0x55f8('0x79')],'required':![]},{'model':db['Tag'],'as':_0x55f8('0x7a'),'attributes':['id',_0x55f8('0x3c'),'color'],'where':_0x14041f[_0x55f8('0x47')][_0x55f8('0x7b')]?{'id':_0x14041f[_0x55f8('0x47')][_0x55f8('0x7b')]}:undefined,'required':_0x14041f[_0x55f8('0x47')][_0x55f8('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0x55f8('0x6c')](_0x3ad15f);})[_0x55f8('0x1f')](function(_0x173b86){_0x5b3e4a[_0x55f8('0x59')]=_0x173b86;return _0x5b3e4a;});}})[_0x55f8('0x1f')](respondWithFilteredResult(_0x1a785a,_0x3ad15f))[_0x55f8('0x2a')](handleError(_0x1a785a,null));};exports[_0x55f8('0x7c')]=function(_0x12d724,_0x86c9e4){var _0x4098a7=_0x12d724[_0x55f8('0x64')]['id'];var _0x156396=_0x12d724[_0x55f8('0x5b')];var _0x421cd8=0xc8;var _0x31c432=null;return db[_0x55f8('0x7d')][_0x55f8('0x7e')]({'isolationLevel':db[_0x55f8('0x7d')][_0x55f8('0x7f')][_0x55f8('0x80')][_0x55f8('0x81')]},function(_0x23b9cd){return db['FaxAccount'][_0x55f8('0x6a')]({'where':{'id':_0x4098a7},'transaction':_0x23b9cd})[_0x55f8('0x1f')](function(_0x4c3cb2){if(_0x4c3cb2){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x4098a7},'transaction':_0x23b9cd})['then'](function(){var _0x36f6c5=_[_0x55f8('0x46')](_0x156396,function(_0x54d8f9){_0x54d8f9[_0x55f8('0x67')]=_0x4098a7;return _0x54d8f9;});return db[_0x55f8('0x82')][_0x55f8('0x83')](_0x36f6c5,{'transaction':_0x23b9cd});});}else{_0x421cd8=0x194;_0x31c432=[];}});})[_0x55f8('0x1f')](function(){if(_0x421cd8!==0x194){return db['FaxApplication'][_0x55f8('0x84')]({'where':{'FaxAccountId':_0x4098a7},'order':_0x55f8('0x85')})[_0x55f8('0x1f')](function(_0x534da3){_0x31c432=_0x534da3;});}})[_0x55f8('0x2a')](function(_0x13df75){_0x421cd8=0x1f4;logger[_0x55f8('0x26')](_0x13df75[_0x55f8('0x86')]);if(_0x13df75['name']){delete _0x13df75[_0x55f8('0x3c')];}_0x31c432=_0x13df75;})[_0x55f8('0x87')](function(){if(_0x31c432===null){_0x86c9e4[_0x55f8('0x3b')](_0x421cd8);}else{if(_0x421cd8===0x1f4){_0x86c9e4[_0x55f8('0x2b')](_0x421cd8)[_0x55f8('0x3d')](_0x31c432);}else{_0x86c9e4[_0x55f8('0x2b')](_0x421cd8)[_0x55f8('0x2d')](_0x31c432);}}});};exports['getApplications']=function(_0x3d5535,_0x2eac1e,_0x37a1fa){var _0xc47cb7={};var _0x75d0e7={};var _0xc384c8;var _0x3a7ef4;return db['FaxAccount'][_0x55f8('0x6a')]({'where':{'id':_0x3d5535[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x2eac1e,null))[_0x55f8('0x1f')](function(_0x36cb48){if(_0x36cb48){_0xc384c8=_0x36cb48;_0x75d0e7[_0x55f8('0x45')]=_[_0x55f8('0x48')](db['FaxApplication']['rawAttributes']);_0x75d0e7[_0x55f8('0x47')]=_['keys'](_0x3d5535[_0x55f8('0x47')]);_0x75d0e7[_0x55f8('0x51')]=_[_0x55f8('0x49')](_0x75d0e7[_0x55f8('0x45')],_0x75d0e7[_0x55f8('0x47')]);_0xc47cb7['attributes']=_['intersection'](_0x75d0e7['model'],qs[_0x55f8('0x4b')](_0x3d5535[_0x55f8('0x47')][_0x55f8('0x4b')]));_0xc47cb7[_0x55f8('0x4a')]=_0xc47cb7[_0x55f8('0x4a')][_0x55f8('0x4c')]?_0xc47cb7[_0x55f8('0x4a')]:_0x75d0e7[_0x55f8('0x45')];_0xc47cb7[_0x55f8('0x4e')]=qs[_0x55f8('0x4f')](_0x3d5535[_0x55f8('0x47')][_0x55f8('0x4f')]);_0xc47cb7[_0x55f8('0x50')]=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x3d5535[_0x55f8('0x47')],_0x75d0e7['filters']));if(_0x3d5535[_0x55f8('0x47')][_0x55f8('0x53')]){_0xc47cb7[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0xc47cb7[_0x55f8('0x50')],{'$or':_['map'](_0xc47cb7['attributes'],function(_0x25b8c7){var _0x55d154={};_0x55d154[_0x25b8c7]={'$like':'%'+_0x3d5535[_0x55f8('0x47')][_0x55f8('0x53')]+'%'};return _0x55d154;})});}_0xc47cb7=_[_0x55f8('0x54')]({},_0xc47cb7,_0x3d5535[_0x55f8('0x56')]);return _0xc384c8['getApplications'](_0xc47cb7);}})[_0x55f8('0x1f')](function(_0x5f2459){if(_0x5f2459){_0x3a7ef4=_0x5f2459['length'];if(!_0x3d5535[_0x55f8('0x47')]['hasOwnProperty'](_0x55f8('0x6b'))){_0xc47cb7[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x3d5535[_0x55f8('0x47')]['limit']);_0xc47cb7[_0x55f8('0x31')]=qs['offset'](_0x3d5535[_0x55f8('0x47')][_0x55f8('0x31')]);}return _0xc384c8[_0x55f8('0x88')](_0xc47cb7);}})[_0x55f8('0x1f')](function(_0xe24eb2){if(_0xe24eb2){return _0xe24eb2?{'count':_0x3a7ef4,'rows':_0xe24eb2}:null;}})[_0x55f8('0x1f')](respondWithResult(_0x2eac1e,null))[_0x55f8('0x2a')](handleError(_0x2eac1e,null));};function Extension(_0x38b190,_0x3b7f0e,_0x3cc0d0,_0x2cf448){this[_0x55f8('0x89')]=_0x55f8('0x8a');this['exten']=_0x38b190[_0x55f8('0x8b')];this[_0x55f8('0x8c')]=_0x2cf448;this[_0x55f8('0x43')]='system';this[_0x55f8('0x8d')]=_0x55f8('0x8e');this['FaxAccountId']=_0x38b190['id'];this['priority']=_0x3b7f0e;this[_0x55f8('0x8f')]=_0x3cc0d0;}function createExtensionsReciveFax(_0x47f607){var _0x17381c=0x1;var _0x1fb95d=[];_0x1fb95d[_0x55f8('0x90')](new Extension(_0x47f607,_0x17381c,'',_0x55f8('0x91')));_0x17381c+=0x1;_0x1fb95d[_0x55f8('0x90')](new Extension(_0x47f607,_0x17381c,_0x55f8('0x92'),_0x55f8('0x93')));_0x17381c+=0x1;for(var _0x3c40b9 in _0x47f607){if(_0x47f607[_0x55f8('0x4d')](_0x3c40b9)&&(_0x3c40b9===_0x55f8('0x94')||_0x3c40b9===_0x55f8('0x8b')||_0x3c40b9===_0x55f8('0x95')||_0x3c40b9===_0x55f8('0x96')||_0x3c40b9==='headerinfo'||_0x3c40b9===_0x55f8('0x97')||_0x3c40b9===_0x55f8('0x98')||_0x3c40b9===_0x55f8('0x99')||_0x3c40b9===_0x55f8('0x9a'))){_0x1fb95d['push'](new Extension(_0x47f607,_0x17381c,_0x55f8('0x9b')+_0x3c40b9+')='+_0x47f607[_0x3c40b9],_0x55f8('0x93')));_0x17381c+=0x1;}}_0x1fb95d[_0x55f8('0x90')](new Extension(_0x47f607,_0x17381c,'6',_0x55f8('0x9c')));_0x17381c+=0x1;_0x1fb95d[_0x55f8('0x90')](new Extension(_0x47f607,_0x17381c,_0x55f8('0x9d'),_0x55f8('0x9e')));_0x17381c=0x0;return _0x1fb95d;}exports[_0x55f8('0x9f')]=function(_0x50fc68,_0x3e52d3,_0x19776b){var _0x19494;return db[_0x55f8('0x7d')][_0x55f8('0x7e')](function(_0x2d4386){return db['FaxAccount'][_0x55f8('0x5a')](_0x50fc68[_0x55f8('0x5b')],{'transaction':_0x2d4386})[_0x55f8('0x1f')](function(_0x3cddc7){_0x19494=_0x3cddc7['get']({'plain':!![]});return db[_0x55f8('0xa0')]['bulkCreate'](createExtensionsReciveFax(_0x19494),{'transaction':_0x2d4386});});})[_0x55f8('0x1f')](function(){return _0x19494;})['then'](respondWithResult(_0x3e52d3,null))[_0x55f8('0x2a')](handleError(_0x3e52d3,null));};exports[_0x55f8('0xa1')]=function(_0x576344,_0x23c773,_0x44f12e){var _0x29f6e2;return db[_0x55f8('0x7d')][_0x55f8('0x7e')](function(_0x2b8509){return db[_0x55f8('0x40')]['update'](_0x576344['body'],{'where':{'id':_0x576344['body']['id']},'transaction':_0x2b8509})[_0x55f8('0x1f')](function(_0x3161dc){return db[_0x55f8('0xa0')]['destroy']({'where':{'FaxAccountId':_0x576344[_0x55f8('0x5b')]['id']},'transaction':_0x2b8509})[_0x55f8('0x1f')](function(_0x3aa5e6){return db[_0x55f8('0xa0')][_0x55f8('0x83')](createExtensionsReciveFax(_['omit'](_0x576344['body'],[_0x55f8('0xa2'),'key',_0x55f8('0xa3'),_0x55f8('0xa4'),_0x55f8('0xa5'),_0x55f8('0xa6')])),{'transaction':_0x2b8509});});});})['then'](function(){return db['FaxAccount'][_0x55f8('0xa7')](_0x576344[_0x55f8('0x5b')]['id']);})[_0x55f8('0x1f')](respondWithResult(_0x23c773,null))[_0x55f8('0x2a')](handleError(_0x23c773,null));};exports[_0x55f8('0xa8')]=function(_0x5ad6b3,_0xed7791,_0x4c6f9a){var _0x48ef26={'raw':!![],'where':{}};var _0x2b9003={};var _0x1c9b23={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5ad6b3[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0xed7791,null))[_0x55f8('0x1f')](function(_0x552fec){if(_0x552fec){_0x2b9003[_0x55f8('0x45')]=_['keys'](db[_0x55f8('0xa9')]['rawAttributes']);_0x2b9003['query']=_[_0x55f8('0x48')](_0x5ad6b3[_0x55f8('0x47')]);_0x2b9003[_0x55f8('0x51')]=_['intersection'](_0x2b9003['model'],_0x2b9003['query']);_0x48ef26[_0x55f8('0x4a')]=_[_0x55f8('0x49')](_0x2b9003['model'],qs[_0x55f8('0x4b')](_0x5ad6b3[_0x55f8('0x47')][_0x55f8('0x4b')]));_0x48ef26[_0x55f8('0x4a')]=_0x48ef26[_0x55f8('0x4a')]['length']?_0x48ef26['attributes']:_0x2b9003[_0x55f8('0x45')];if(!_0x5ad6b3[_0x55f8('0x47')][_0x55f8('0x4d')](_0x55f8('0x6b'))){_0x48ef26[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x5ad6b3[_0x55f8('0x47')][_0x55f8('0x2f')]);_0x48ef26['offset']=qs['offset'](_0x5ad6b3['query'][_0x55f8('0x31')]);}_0x48ef26[_0x55f8('0x4e')]=qs['sort'](_0x5ad6b3['query'][_0x55f8('0x4f')]);_0x48ef26['where']=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x5ad6b3[_0x55f8('0x47')],_0x2b9003[_0x55f8('0x51')]));_0x48ef26[_0x55f8('0x50')][_0x55f8('0x67')]=_0x552fec['id'];if(_0x5ad6b3['query'][_0x55f8('0x53')]){_0x48ef26[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x48ef26['where'],{'$or':_[_0x55f8('0x46')](_0x48ef26['attributes'],function(_0x15c901){var _0x24c8ba={};_0x24c8ba[_0x15c901]={'$like':'%'+_0x5ad6b3['query'][_0x55f8('0x53')]+'%'};return _0x24c8ba;})});}if(_0x5ad6b3[_0x55f8('0x47')][_0x55f8('0xaa')]){var _0x4326c3=_0x5ad6b3[_0x55f8('0x47')][_0x55f8('0xaa')][_0x55f8('0xab')](',');var _0x31ceff={};_0x31ceff[_0x4326c3[0x0]]={'$gte':moment(_0x4326c3[0x1])['format'](_0x55f8('0xac'))};_0x48ef26[_0x55f8('0x50')]=_[_0x55f8('0x54')](_0x48ef26[_0x55f8('0x50')],_0x31ceff);}_0x48ef26=_[_0x55f8('0x54')]({},_0x48ef26,_0x5ad6b3[_0x55f8('0x56')]);return db[_0x55f8('0xa9')][_0x55f8('0x30')]({'where':_0x48ef26[_0x55f8('0x50')]})['then'](function(_0x2fc453){_0x1c9b23[_0x55f8('0x30')]=_0x2fc453;if(_0x5ad6b3['query'][_0x55f8('0x57')]){_0x48ef26[_0x55f8('0x58')]=[{'all':!![]}];}return db[_0x55f8('0xa9')]['findAll'](_0x48ef26);})[_0x55f8('0x1f')](function(_0xbae05b){_0x1c9b23[_0x55f8('0x59')]=_0xbae05b;return _0x1c9b23;});}})['then'](respondWithFilteredResult(_0xed7791,_0x48ef26))[_0x55f8('0x2a')](handleError(_0xed7791,null));};exports[_0x55f8('0x3d')]=function(_0x1d0925,_0x298f87,_0x45635b){var _0x1fbd69,_0x55322e={},_0x27aba2;if(_0x1d0925['body']['to']){_0x27aba2=_0x1d0925['body']['to'][0x0];}return db[_0x55f8('0x40')]['find']({'where':{'id':_0x1d0925[_0x55f8('0x64')]['id']},'include':[{'model':db[_0x55f8('0xad')],'as':_0x55f8('0xae'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x27aba2},'limit':0x1,'order':[[_0x55f8('0xa4'),_0x55f8('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x298f87,null))[_0x55f8('0x1f')](function(_0x251296){_0x1fbd69=_0x251296;if(_0x1d0925['body'][_0x55f8('0xb0')]&&_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][_0x55f8('0x4c')]){for(var _0x3fe5a8=0x0;_0x3fe5a8<_0x1d0925[_0x55f8('0x5b')]['attachments'][_0x55f8('0x4c')];_0x3fe5a8+=0x1){_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][_0x3fe5a8]={'filename':_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][_0x3fe5a8][_0x55f8('0x3c')],'id':_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][_0x3fe5a8]['id'],'path':path[_0x55f8('0xb1')](config[_0x55f8('0xb2')],'server/files/attachments',_0x1d0925[_0x55f8('0x5b')]['attachments'][_0x3fe5a8][_0x55f8('0xb3')])};}}return respondWithRpcPromise('CheckAfterSend',_0x55f8('0xb4'),{'FaxAccountId':_[_0x55f8('0xb5')](_0x1d0925[_0x55f8('0x64')]['id'])?undefined:_0x1d0925['params']['id'],'path':_[_0x55f8('0xb5')](_0x1d0925[_0x55f8('0x5b')]['attachments'][0x0][_0x55f8('0x6')])?undefined:_0x1d0925[_0x55f8('0x5b')]['attachments'][0x0]['path'],'fax':_[_0x55f8('0xb5')](_0x1d0925[_0x55f8('0x5b')]['to'][0x0])?undefined:_0x1d0925[_0x55f8('0x5b')]['to'][0x0]},client9002);})[_0x55f8('0x1f')](function(){if(_0x1fbd69){if(_[_0x55f8('0xb5')](_0x1d0925['body'][_0x55f8('0xb6')])){_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb6')]=util['format']('\x22%s\x22\x20<%s>',_0x1fbd69[_0x55f8('0x3c')],_0x1fbd69[_0x55f8('0xb7')]);}if(_0x1fbd69[_0x55f8('0xae')]){if(_0x1fbd69['List'][_0x55f8('0xb8')][_0x55f8('0x4c')]){return _0x1fbd69[_0x55f8('0xae')][_0x55f8('0xb8')][0x0];}else{return db['CmContact'][_0x55f8('0x5a')](_[_0x55f8('0x1a')](_0x1d0925[_0x55f8('0x5b')],{'firstName':_0x1d0925[_0x55f8('0x5b')]['to'][0x0],'phone':_0x1d0925[_0x55f8('0x5b')]['to'][0x0],'fax':_0x1d0925['body']['to'][0x0],'ListId':_0x1fbd69['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x55f8('0xb9'));}})[_0x55f8('0x1f')](function(_0x3df563){if(_0x3df563){return db[_0x55f8('0x75')][_0x55f8('0x60')]({'where':{'ContactId':_0x3df563['id'],'closed':![],'FaxAccountId':_0x1fbd69['id']}})[_0x55f8('0x1f')](function(_0x2147fb){if(_0x2147fb){return[_0x2147fb,![]];}return db[_0x55f8('0x75')][_0x55f8('0x5a')]({'UserId':_0x1d0925[_0x55f8('0x5e')]['id'],'ContactId':_0x3df563['id'],'FaxAccountId':_0x1fbd69['id'],'fax':_0x1d0925['body']['to'][0x0],'firstMsgDirection':_0x55f8('0xba'),'Messages':[_['merge'](_0x1d0925[_0x55f8('0x5b')],{'read':![],'body':_0x1d0925[_0x55f8('0x5b')]['attachments'][0x0][_0x55f8('0xbb')],'FaxAccountId':_0x1fbd69['id'],'UserId':_0x1d0925['user']['id'],'ContactId':_0x3df563['id'],'AttachmentId':_0x1d0925[_0x55f8('0x5b')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x55f8('0xa9')],'as':_0x55f8('0xbc')}]})[_0x55f8('0x1f')](function(_0x3e9c6b){return[_0x3e9c6b,!![]];});});}else{throw new Error(_0x55f8('0xbd'));}})['spread'](function(_0x47f217,_0x4f9e60){if(_0x4f9e60){return _0x47f217;}return db[_0x55f8('0xa9')][_0x55f8('0x5a')]({'direction':'out','read':![],'body':_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][0x0]['filename'],'FaxAccountId':_0x1fbd69['id'],'FaxInteractionId':_0x47f217['id'],'UserId':_0x1d0925[_0x55f8('0x5e')]['id'],'ContactId':_0x47f217[_0x55f8('0xbe')],'AttachmentId':_0x1d0925['body'][_0x55f8('0xb0')][0x0]['id']})[_0x55f8('0x1f')](function(_0x4f0a29){_0x47f217[_0x55f8('0xbf')][_0x55f8('0xbc')]=[];_0x47f217['dataValues']['Messages'][_0x55f8('0x90')](_0x4f0a29[_0x55f8('0xbf')]);return _0x47f217;});})[_0x55f8('0x1f')](function(_0x1648e8){respondWithRpcPromise(_0x55f8('0xc0'),_0x55f8('0xc0'),{'FaxAccountId':_[_0x55f8('0xb5')](_0x1d0925['params']['id'])?undefined:_0x1d0925[_0x55f8('0x64')]['id'],'path':_[_0x55f8('0xb5')](_0x1d0925['body'][_0x55f8('0xb0')][0x0]['path'])?undefined:_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][0x0][_0x55f8('0x6')],'fax':_[_0x55f8('0xb5')](_0x1d0925['body']['to'][0x0])?undefined:_0x1d0925[_0x55f8('0x5b')]['to'][0x0],'AttachmentId':_0x1d0925[_0x55f8('0x5b')][_0x55f8('0xb0')][0x0]['id']},client9002)[_0x55f8('0x1f')](function(_0x896153){logger[_0x55f8('0x20')](_0x55f8('0xc1'),_0x896153);})[_0x55f8('0x2a')](function(_0x5f3dff){logger[_0x55f8('0x20')](_0x55f8('0xc1'),_0x5f3dff);});return _0x1648e8;})[_0x55f8('0x1f')](respondWithResult(_0x298f87,null))[_0x55f8('0x2a')](handleError(_0x298f87,null));};exports[_0x55f8('0xc2')]=function(_0x47c4ef,_0x459eec,_0x5d0fbd){return db['FaxAccount'][_0x55f8('0x60')]({'where':{'id':_0x47c4ef[_0x55f8('0x64')]['id']}})['then'](handleEntityNotFound(_0x459eec,null))['then'](function(_0x39e231){if(_0x39e231){return _0x39e231[_0x55f8('0xc2')](_0x47c4ef['body'][_0x55f8('0x6e')],_[_0x55f8('0x73')](_0x47c4ef['body'],[_0x55f8('0x6e'),'id'])||{})['spread'](function(_0x10091b){for(var _0xdb7309=0x0;_0xdb7309<_0x47c4ef[_0x55f8('0x5b')]['ids'][_0x55f8('0x4c')];_0xdb7309+=0x1){socket[_0x55f8('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x47c4ef[_0x55f8('0x5b')][_0x55f8('0x6e')][_0xdb7309]),'FaxAccountId':Number(_0x47c4ef[_0x55f8('0x64')]['id'])});}return _0x10091b;});}})[_0x55f8('0x1f')](respondWithResult(_0x459eec,null))[_0x55f8('0x2a')](handleError(_0x459eec,null));};exports[_0x55f8('0xc4')]=function(_0x300acf,_0x80e895,_0x36afd9){return db[_0x55f8('0x40')][_0x55f8('0x60')]({'where':{'id':_0x300acf[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x80e895,null))[_0x55f8('0x1f')](function(_0x1ea899){if(_0x1ea899){return _0x1ea899[_0x55f8('0xc4')](_0x300acf[_0x55f8('0x47')][_0x55f8('0x6e')])['then'](function(){if(_[_0x55f8('0xc5')](_0x300acf[_0x55f8('0x47')]['ids'])){for(var _0x432957=0x0;_0x432957<_0x300acf[_0x55f8('0x47')][_0x55f8('0x6e')]['length'];_0x432957+=0x1){socket[_0x55f8('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x300acf[_0x55f8('0x47')][_0x55f8('0x6e')][_0x432957]),'FaxAccountId':Number(_0x300acf['params']['id'])});}}else{socket[_0x55f8('0xc3')](_0x55f8('0xc6'),{'UserId':Number(_0x300acf['query'][_0x55f8('0x6e')]),'FaxAccountId':Number(_0x300acf['params']['id'])});}});}})[_0x55f8('0x1f')](respondWithStatusCode(_0x80e895,null))[_0x55f8('0x2a')](handleError(_0x80e895,null));};exports['getAgents']=function(_0x14a37a,_0x5085ba,_0x3819ee){var _0x2a08d8={};var _0x5496db={};var _0x2c13fa;var _0x29caa8;return db[_0x55f8('0x40')]['findOne']({'where':{'id':_0x14a37a[_0x55f8('0x64')]['id']}})[_0x55f8('0x1f')](handleEntityNotFound(_0x5085ba,null))[_0x55f8('0x1f')](function(_0x58b05b){if(_0x58b05b){_0x2c13fa=_0x58b05b;_0x5496db[_0x55f8('0x45')]=_['keys'](db['User'][_0x55f8('0x41')]);_0x5496db[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x14a37a[_0x55f8('0x47')]);_0x5496db[_0x55f8('0x51')]=_['intersection'](_0x5496db[_0x55f8('0x45')],_0x5496db['query']);_0x2a08d8[_0x55f8('0x4a')]=_['intersection'](_0x5496db[_0x55f8('0x45')],qs[_0x55f8('0x4b')](_0x14a37a[_0x55f8('0x47')]['fields']));_0x2a08d8[_0x55f8('0x4a')]=_0x2a08d8[_0x55f8('0x4a')]['length']?_0x2a08d8[_0x55f8('0x4a')]:_0x5496db[_0x55f8('0x45')];_0x2a08d8[_0x55f8('0x4e')]=qs['sort'](_0x14a37a['query'][_0x55f8('0x4f')]);_0x2a08d8[_0x55f8('0x50')]=qs[_0x55f8('0x51')](_[_0x55f8('0x52')](_0x14a37a['query'],_0x5496db[_0x55f8('0x51')]));if(_0x14a37a['query'][_0x55f8('0x53')]){_0x2a08d8['where']=_['merge'](_0x2a08d8['where'],{'$or':_[_0x55f8('0x46')](_0x2a08d8[_0x55f8('0x4a')],function(_0x279323){var _0x513b0b={};_0x513b0b[_0x279323]={'$like':'%'+_0x14a37a[_0x55f8('0x47')][_0x55f8('0x53')]+'%'};return _0x513b0b;})});}_0x2a08d8=_[_0x55f8('0x54')]({},_0x2a08d8,_0x14a37a[_0x55f8('0x56')]);return _0x2c13fa['getAgents'](_0x2a08d8);}})[_0x55f8('0x1f')](function(_0x39a286){if(_0x39a286){_0x29caa8=_0x39a286[_0x55f8('0x4c')];if(!_0x14a37a[_0x55f8('0x47')]['hasOwnProperty'](_0x55f8('0x6b'))){_0x2a08d8[_0x55f8('0x2f')]=qs[_0x55f8('0x2f')](_0x14a37a[_0x55f8('0x47')]['limit']);_0x2a08d8['offset']=qs[_0x55f8('0x31')](_0x14a37a[_0x55f8('0x47')][_0x55f8('0x31')]);}return _0x2c13fa[_0x55f8('0xc7')](_0x2a08d8);}})[_0x55f8('0x1f')](function(_0x4d9093){if(_0x4d9093){return _0x4d9093?{'count':_0x29caa8,'rows':_0x4d9093}:null;}})[_0x55f8('0x1f')](respondWithResult(_0x5085ba,null))[_0x55f8('0x2a')](handleError(_0x5085ba,null));}; \ No newline at end of file +var _0x1403=['ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','jayson/promise','http','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','get','destroy','stack','name','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','FaxAccount','findAll','rows','show','params','Pause','fields','create','body','user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','ids','FaxInteraction','Contact','User','Owner','internal','Tag','tag','addApplications','sequelize','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','maxrate','t38timeout','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','updatedAt','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','ListId','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1403,0x179));var _0x3140=function(_0x3276dc,_0x37f471){_0x3276dc=_0x3276dc-0x0;var _0x480bc6=_0x1403[_0x3276dc];return _0x480bc6;};'use strict';var emlformat=require(_0x3140('0x0'));var rimraf=require(_0x3140('0x1'));var zipdir=require(_0x3140('0x2'));var jsonpatch=require(_0x3140('0x3'));var rp=require('request-promise');var moment=require(_0x3140('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3140('0x5'));var sox=require('sox');var csv=require(_0x3140('0x6'));var ejs=require(_0x3140('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3140('0x8'));var squel=require('squel');var crypto=require(_0x3140('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3140('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3140('0xb'));var Redis=require(_0x3140('0xc'));var authService=require(_0x3140('0xd'));var qs=require(_0x3140('0xe'));var as=require(_0x3140('0xf'));var hardwareService=require(_0x3140('0x10'));var logger=require(_0x3140('0x11'))(_0x3140('0x12'));var utils=require(_0x3140('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3140('0x14'));var db=require(_0x3140('0x15'))['db'];config[_0x3140('0x16')]=_['defaults'](config[_0x3140('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3140('0x17'))(new Redis(config[_0x3140('0x16')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x3140('0x18'));var client=jayson['client'][_0x3140('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x3140('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x39e20f,_0x203992,_0x70ea05,_0x598f74){return new BPromise(function(_0x49342a,_0x2f1809){var _0x392f2e=_0x598f74||client;return _0x392f2e['request'](_0x39e20f,_0x70ea05)[_0x3140('0x1a')](function(_0x1da11d){logger['info']('FaxAccount,\x20%s,\x20%s',_0x203992,_0x3140('0x1b'));logger['debug'](_0x3140('0x1c'),_0x203992,'request\x20sent',JSON['stringify'](_0x1da11d));if(_0x1da11d['error']){if(_0x1da11d['error'][_0x3140('0x1d')]===0x1f4){logger[_0x3140('0x1e')](_0x3140('0x1f'),_0x203992,_0x1da11d[_0x3140('0x1e')][_0x3140('0x20')]);return _0x2f1809(_0x1da11d[_0x3140('0x1e')]['message']);}logger[_0x3140('0x1e')](_0x3140('0x1f'),_0x203992,_0x1da11d[_0x3140('0x1e')][_0x3140('0x20')]);return _0x49342a(_0x1da11d[_0x3140('0x1e')][_0x3140('0x20')]);}else{logger[_0x3140('0x21')]('FaxAccount,\x20%s,\x20%s',_0x203992,_0x3140('0x1b'));_0x49342a(_0x1da11d[_0x3140('0x22')][_0x3140('0x20')]);}})[_0x3140('0x23')](function(_0x2f48a7){logger['error']('FaxAccount,\x20%s,\x20%s',_0x203992,_0x2f48a7);_0x2f1809(_0x2f48a7);});});}function respondWithStatusCode(_0x21fc9b,_0x3899e9){_0x3899e9=_0x3899e9||0xcc;return function(_0x1fe1f8){if(_0x1fe1f8){return _0x21fc9b[_0x3140('0x24')](_0x3899e9);}return _0x21fc9b['status'](_0x3899e9)[_0x3140('0x25')]();};}function respondWithResult(_0x37d516,_0x20287a){_0x20287a=_0x20287a||0xc8;return function(_0xdaf87c){if(_0xdaf87c){return _0x37d516[_0x3140('0x26')](_0x20287a)['json'](_0xdaf87c);}};}function respondWithFilteredResult(_0x4d7077,_0x4151f2){return function(_0x3853e5){if(_0x3853e5){var _0x2a221b=typeof _0x4151f2[_0x3140('0x27')]===_0x3140('0x28')&&typeof _0x4151f2[_0x3140('0x29')]==='undefined';var _0x3ccc23=_0x3853e5[_0x3140('0x2a')];var _0x39922e=_0x2a221b?0x0:_0x4151f2[_0x3140('0x27')];var _0x4bb245=_0x2a221b?_0x3853e5[_0x3140('0x2a')]:_0x4151f2[_0x3140('0x27')]+_0x4151f2['limit'];var _0x389283;if(_0x4bb245>=_0x3ccc23){_0x4bb245=_0x3ccc23;_0x389283=0xc8;}else{_0x389283=0xce;}_0x4d7077[_0x3140('0x26')](_0x389283);return _0x4d7077['set'](_0x3140('0x2b'),_0x39922e+'-'+_0x4bb245+'/'+_0x3ccc23)[_0x3140('0x2c')](_0x3853e5);}return null;};}function patchUpdates(_0x3cfe39){return function(_0x44d57e){try{jsonpatch[_0x3140('0x2d')](_0x44d57e,_0x3cfe39,!![]);}catch(_0xef395e){return BPromise[_0x3140('0x2e')](_0xef395e);}return _0x44d57e[_0x3140('0x2f')]();};}function saveUpdates(_0x4a0d74,_0xffb39f){return function(_0x304db4){if(_0x304db4){return _0x304db4[_0x3140('0x30')](_0x4a0d74)[_0x3140('0x1a')](function(_0x36bddf){return _0x36bddf;});}return null;};}function removeEntity(_0x360887,_0x3f041a){return function(_0x3819eb){if(_0x3819eb){return _0x3819eb['destroy']()[_0x3140('0x1a')](function(){var _0x5c29f2=_0x3819eb[_0x3140('0x31')]({'plain':!![]});var _0x49c460='FaxAccounts';return db['UserProfileResource'][_0x3140('0x32')]({'where':{'type':_0x49c460,'resourceId':_0x5c29f2['id']}})['then'](function(){return _0x3819eb;});})[_0x3140('0x1a')](function(){_0x360887['status'](0xcc)[_0x3140('0x25')]();});}};}function handleEntityNotFound(_0x7f8186,_0x4390a7){return function(_0x313941){if(!_0x313941){_0x7f8186[_0x3140('0x24')](0x194);}return _0x313941;};}function handleError(_0x31d88d,_0x357a8d){_0x357a8d=_0x357a8d||0x1f4;return function(_0x4a7c0d){logger[_0x3140('0x1e')](_0x4a7c0d[_0x3140('0x33')]);if(_0x4a7c0d[_0x3140('0x34')]){delete _0x4a7c0d[_0x3140('0x34')];}_0x31d88d[_0x3140('0x26')](_0x357a8d)['send'](_0x4a7c0d);};}exports['index']=function(_0x2a6ac1,_0x1442bb){var _0x4daad8={'include':[{'model':db['Pause'],'as':_0x3140('0x35')}]},_0x6f766f={},_0x16afa4={'count':0x0,'rows':[]};var _0x591cfe=_['map'](db['FaxAccount'][_0x3140('0x36')],function(_0x2a0550){return{'name':_0x2a0550[_0x3140('0x37')],'type':_0x2a0550[_0x3140('0x38')][_0x3140('0x39')]};});_0x6f766f[_0x3140('0x3a')]=_[_0x3140('0x3b')](_0x591cfe,_0x3140('0x34'));_0x6f766f[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x2a6ac1[_0x3140('0x3c')]);_0x6f766f['filters']=_['intersection'](_0x6f766f[_0x3140('0x3a')],_0x6f766f[_0x3140('0x3c')]);_0x4daad8[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x6f766f[_0x3140('0x3a')],qs['fields'](_0x2a6ac1[_0x3140('0x3c')]['fields']));_0x4daad8[_0x3140('0x3e')]=_0x4daad8[_0x3140('0x3e')][_0x3140('0x40')]?_0x4daad8[_0x3140('0x3e')]:_0x6f766f[_0x3140('0x3a')];if(!_0x2a6ac1[_0x3140('0x3c')][_0x3140('0x41')](_0x3140('0x42'))){_0x4daad8[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x2a6ac1['query'][_0x3140('0x29')]);_0x4daad8[_0x3140('0x27')]=qs[_0x3140('0x27')](_0x2a6ac1['query'][_0x3140('0x27')]);}_0x4daad8[_0x3140('0x43')]=qs[_0x3140('0x44')](_0x2a6ac1[_0x3140('0x3c')]['sort']);_0x4daad8[_0x3140('0x45')]=qs[_0x3140('0x46')](_[_0x3140('0x47')](_0x2a6ac1['query'],_0x6f766f['filters']),_0x591cfe);if(_0x2a6ac1['query'][_0x3140('0x48')]){_0x4daad8[_0x3140('0x45')]=_['merge'](_0x4daad8['where'],{'$or':_[_0x3140('0x3b')](_0x591cfe,function(_0x576671){if(_0x576671[_0x3140('0x38')]!==_0x3140('0x49')){var _0x2fcbe4={};_0x2fcbe4[_0x576671[_0x3140('0x34')]]={'$like':'%'+_0x2a6ac1[_0x3140('0x3c')]['filter']+'%'};return _0x2fcbe4;}})});}_0x4daad8=_[_0x3140('0x4a')]({},_0x4daad8,_0x2a6ac1[_0x3140('0x4b')]);var _0x1c71e2={'where':_0x4daad8[_0x3140('0x45')]};return db['FaxAccount'][_0x3140('0x2a')](_0x1c71e2)['then'](function(_0x1580ef){_0x16afa4['count']=_0x1580ef;if(_0x2a6ac1[_0x3140('0x3c')][_0x3140('0x4c')]){_0x4daad8[_0x3140('0x4d')]=[{'all':!![]}];}return db[_0x3140('0x4e')][_0x3140('0x4f')](_0x4daad8);})[_0x3140('0x1a')](function(_0x37b3d4){_0x16afa4[_0x3140('0x50')]=_0x37b3d4;return _0x16afa4;})[_0x3140('0x1a')](respondWithFilteredResult(_0x1442bb,_0x4daad8))['catch'](handleError(_0x1442bb,null));};exports[_0x3140('0x51')]=function(_0x42fee3,_0x1d88f8){var _0x334514={'raw':![],'where':{'id':_0x42fee3[_0x3140('0x52')]['id']},'include':[{'model':db[_0x3140('0x53')],'as':_0x3140('0x35')}]},_0x244dc2={};_0x244dc2[_0x3140('0x3a')]=_['keys'](db[_0x3140('0x4e')][_0x3140('0x36')]);_0x244dc2[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x42fee3[_0x3140('0x3c')]);_0x244dc2[_0x3140('0x46')]=_[_0x3140('0x3f')](_0x244dc2['model'],_0x244dc2[_0x3140('0x3c')]);_0x334514[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x244dc2[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x42fee3[_0x3140('0x3c')][_0x3140('0x54')]));_0x334514[_0x3140('0x3e')]=_0x334514[_0x3140('0x3e')]['length']?_0x334514[_0x3140('0x3e')]:_0x244dc2[_0x3140('0x3a')];if(_0x42fee3['query']['includeAll']){_0x334514[_0x3140('0x4d')]=[{'all':!![]}];}_0x334514=_['merge']({},_0x334514,_0x42fee3[_0x3140('0x4b')]);return db[_0x3140('0x4e')]['find'](_0x334514)[_0x3140('0x1a')](handleEntityNotFound(_0x1d88f8,null))['then'](respondWithResult(_0x1d88f8,null))[_0x3140('0x23')](handleError(_0x1d88f8,null));};exports[_0x3140('0x55')]=function(_0x598281,_0x150fd9){return db[_0x3140('0x4e')][_0x3140('0x55')](_0x598281[_0x3140('0x56')],{})['then'](function(_0x43264f){var _0x7360e5=_0x598281['user'][_0x3140('0x31')]({'plain':!![]});if(!_0x7360e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7360e5['role']===_0x3140('0x57')){var _0x31ef44=_0x43264f[_0x3140('0x31')]({'plain':!![]});var _0x22a610='FaxAccounts';return db['UserProfileSection'][_0x3140('0x58')]({'where':{'name':_0x22a610,'userProfileId':_0x7360e5[_0x3140('0x59')]},'raw':!![]})[_0x3140('0x1a')](function(_0x20a1e4){if(_0x20a1e4&&_0x20a1e4['autoAssociation']===0x0){return db[_0x3140('0x5a')]['create']({'name':_0x31ef44[_0x3140('0x34')],'resourceId':_0x31ef44['id'],'type':_0x20a1e4['name'],'sectionId':_0x20a1e4['id']},{})[_0x3140('0x1a')](function(){return _0x43264f;});}else{return _0x43264f;}})['catch'](function(_0x3a2213){logger['error'](_0x3140('0x5b'),_0x3a2213);throw _0x3a2213;});}return _0x43264f;})[_0x3140('0x1a')](respondWithResult(_0x150fd9,0xc9))[_0x3140('0x23')](handleError(_0x150fd9,null));};exports[_0x3140('0x30')]=function(_0x5b5581,_0x1d9e11){if(_0x5b5581[_0x3140('0x56')]['id']){delete _0x5b5581[_0x3140('0x56')]['id'];}return db['FaxAccount'][_0x3140('0x58')]({'where':{'id':_0x5b5581[_0x3140('0x52')]['id']},'include':[{'model':db[_0x3140('0x53')],'as':_0x3140('0x35')}]})[_0x3140('0x1a')](handleEntityNotFound(_0x1d9e11,null))['then'](saveUpdates(_0x5b5581[_0x3140('0x56')],null))[_0x3140('0x1a')](respondWithResult(_0x1d9e11,null))[_0x3140('0x23')](handleError(_0x1d9e11,null));};exports['destroy']=function(_0x2ed829,_0x189909){return db[_0x3140('0x4e')][_0x3140('0x58')]({'where':{'id':_0x2ed829[_0x3140('0x52')]['id']}})['then'](handleEntityNotFound(_0x189909,null))[_0x3140('0x1a')](removeEntity(_0x189909,null))[_0x3140('0x23')](handleError(_0x189909,null));};exports[_0x3140('0x5c')]=function(_0x3681a0,_0x3f6721){return db[_0x3140('0x4e')][_0x3140('0x5c')]()['then'](respondWithResult(_0x3f6721,null))[_0x3140('0x23')](handleError(_0x3f6721,null));};exports[_0x3140('0x5d')]=function(_0x132a46,_0x4132e0,_0xf8606c){if(_0x132a46[_0x3140('0x56')]['id']){delete _0x132a46[_0x3140('0x56')]['id'];}return db[_0x3140('0x4e')][_0x3140('0x58')]({'where':{'id':_0x132a46['params']['id']}})['then'](handleEntityNotFound(_0x4132e0,null))[_0x3140('0x1a')](function(_0xf96601){if(_0xf96601){_0x132a46[_0x3140('0x56')][_0x3140('0x5e')]=_0xf96601['id'];return db[_0x3140('0x5f')][_0x3140('0x55')](_0x132a46[_0x3140('0x56')]);}})[_0x3140('0x1a')](respondWithResult(_0x4132e0,null))[_0x3140('0x23')](handleError(_0x4132e0,null));};exports['getDispositions']=function(_0x455712,_0x28d622,_0x1d4150){var _0x336985={'raw':![],'where':{}};var _0x1b59a4={};var _0x5e51cc={'count':0x0,'rows':[]};return db[_0x3140('0x4e')][_0x3140('0x60')]({'where':{'id':_0x455712[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x28d622,null))[_0x3140('0x1a')](function(_0x235840){if(_0x235840){_0x1b59a4['model']=_[_0x3140('0x3d')](db[_0x3140('0x5f')][_0x3140('0x36')]);_0x1b59a4[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x455712[_0x3140('0x3c')]);_0x1b59a4[_0x3140('0x46')]=_[_0x3140('0x3f')](_0x1b59a4[_0x3140('0x3a')],_0x1b59a4[_0x3140('0x3c')]);_0x336985['attributes']=_[_0x3140('0x3f')](_0x1b59a4[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x455712[_0x3140('0x3c')][_0x3140('0x54')]));_0x336985[_0x3140('0x3e')]=_0x336985[_0x3140('0x3e')]['length']?_0x336985[_0x3140('0x3e')]:_0x1b59a4[_0x3140('0x3a')];if(!_0x455712['query'][_0x3140('0x41')](_0x3140('0x42'))){_0x336985[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x455712[_0x3140('0x3c')]['limit']);_0x336985[_0x3140('0x27')]=qs['offset'](_0x455712[_0x3140('0x3c')][_0x3140('0x27')]);}_0x336985[_0x3140('0x43')]=qs[_0x3140('0x44')](_0x455712[_0x3140('0x3c')][_0x3140('0x44')]);_0x336985[_0x3140('0x45')]=qs[_0x3140('0x46')](_[_0x3140('0x47')](_0x455712[_0x3140('0x3c')],_0x1b59a4[_0x3140('0x46')]));_0x336985[_0x3140('0x45')]['FaxAccountId']=_0x235840['id'];if(_0x455712[_0x3140('0x3c')][_0x3140('0x48')]){_0x336985[_0x3140('0x45')]=_[_0x3140('0x4a')](_0x336985[_0x3140('0x45')],{'$or':_[_0x3140('0x3b')](_0x336985[_0x3140('0x3e')],function(_0x41d345){var _0x39068e={};_0x39068e[_0x41d345]={'$like':'%'+_0x455712[_0x3140('0x3c')][_0x3140('0x48')]+'%'};return _0x39068e;})});}_0x336985=_[_0x3140('0x4a')]({},_0x336985,_0x455712['options']);return db[_0x3140('0x5f')]['count']({'where':_0x336985[_0x3140('0x45')]})[_0x3140('0x1a')](function(_0x4d9d26){_0x5e51cc[_0x3140('0x2a')]=_0x4d9d26;if(_0x455712[_0x3140('0x3c')]['includeAll']){_0x336985['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x336985);})['then'](function(_0xc8c7ad){_0x5e51cc[_0x3140('0x50')]=_0xc8c7ad;return _0x5e51cc;});}})[_0x3140('0x1a')](respondWithFilteredResult(_0x28d622,_0x336985))[_0x3140('0x23')](handleError(_0x28d622,null));};exports[_0x3140('0x61')]=function(_0x2bee25,_0x5a563d,_0x1897f2){return db['FaxAccount']['find']({'where':{'id':_0x2bee25[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x5a563d,null))[_0x3140('0x1a')](function(_0x506861){if(_0x506861){return _0x506861[_0x3140('0x61')](_0x2bee25[_0x3140('0x3c')]['ids']);}})[_0x3140('0x1a')](respondWithStatusCode(_0x5a563d,null))[_0x3140('0x23')](handleError(_0x5a563d,null));};exports[_0x3140('0x62')]=function(_0x11dfbc,_0x47d3f7,_0x26a015){if(_0x11dfbc[_0x3140('0x56')]['id']){delete _0x11dfbc[_0x3140('0x56')]['id'];}return db['FaxAccount'][_0x3140('0x58')]({'where':{'id':_0x11dfbc[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x47d3f7,null))[_0x3140('0x1a')](function(_0x200144){if(_0x200144){_0x11dfbc[_0x3140('0x56')][_0x3140('0x5e')]=_0x200144['id'];return db[_0x3140('0x63')]['create'](_0x11dfbc[_0x3140('0x56')]);}})['then'](respondWithResult(_0x47d3f7,null))[_0x3140('0x23')](handleError(_0x47d3f7,null));};exports[_0x3140('0x64')]=function(_0x337f23,_0x18eac9,_0x1aed62){var _0x1c90c5={'raw':![],'where':{}};var _0x1d7b57={};var _0x166518={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3140('0x60')]({'where':{'id':_0x337f23[_0x3140('0x52')]['id']}})['then'](handleEntityNotFound(_0x18eac9,null))['then'](function(_0x21527a){if(_0x21527a){_0x1d7b57[_0x3140('0x3a')]=_[_0x3140('0x3d')](db[_0x3140('0x63')]['rawAttributes']);_0x1d7b57[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x337f23[_0x3140('0x3c')]);_0x1d7b57[_0x3140('0x46')]=_[_0x3140('0x3f')](_0x1d7b57[_0x3140('0x3a')],_0x1d7b57[_0x3140('0x3c')]);_0x1c90c5[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x1d7b57[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x337f23[_0x3140('0x3c')]['fields']));_0x1c90c5[_0x3140('0x3e')]=_0x1c90c5[_0x3140('0x3e')][_0x3140('0x40')]?_0x1c90c5[_0x3140('0x3e')]:_0x1d7b57[_0x3140('0x3a')];if(!_0x337f23[_0x3140('0x3c')][_0x3140('0x41')]('nolimit')){_0x1c90c5[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x337f23['query']['limit']);_0x1c90c5['offset']=qs['offset'](_0x337f23[_0x3140('0x3c')][_0x3140('0x27')]);}_0x1c90c5[_0x3140('0x43')]=qs['sort'](_0x337f23[_0x3140('0x3c')][_0x3140('0x44')]);_0x1c90c5[_0x3140('0x45')]=qs[_0x3140('0x46')](_[_0x3140('0x47')](_0x337f23[_0x3140('0x3c')],_0x1d7b57[_0x3140('0x46')]));_0x1c90c5[_0x3140('0x45')][_0x3140('0x5e')]=_0x21527a['id'];if(_0x337f23[_0x3140('0x3c')][_0x3140('0x48')]){_0x1c90c5[_0x3140('0x45')]=_[_0x3140('0x4a')](_0x1c90c5[_0x3140('0x45')],{'$or':_[_0x3140('0x3b')](_0x1c90c5[_0x3140('0x3e')],function(_0x4c0b7f){var _0x321f7e={};_0x321f7e[_0x4c0b7f]={'$like':'%'+_0x337f23[_0x3140('0x3c')]['filter']+'%'};return _0x321f7e;})});}_0x1c90c5=_[_0x3140('0x4a')]({},_0x1c90c5,_0x337f23[_0x3140('0x4b')]);return db[_0x3140('0x63')][_0x3140('0x2a')]({'where':_0x1c90c5[_0x3140('0x45')]})[_0x3140('0x1a')](function(_0x1a04aa){_0x166518[_0x3140('0x2a')]=_0x1a04aa;if(_0x337f23[_0x3140('0x3c')][_0x3140('0x4c')]){_0x1c90c5[_0x3140('0x4d')]=[{'all':!![]}];}return db[_0x3140('0x63')][_0x3140('0x4f')](_0x1c90c5);})[_0x3140('0x1a')](function(_0x5ea62e){_0x166518[_0x3140('0x50')]=_0x5ea62e;return _0x166518;});}})['then'](respondWithFilteredResult(_0x18eac9,_0x1c90c5))[_0x3140('0x23')](handleError(_0x18eac9,null));};exports[_0x3140('0x65')]=function(_0x30666d,_0x5f556f,_0x376f53){return db['FaxAccount']['find']({'where':{'id':_0x30666d['params']['id']}})['then'](handleEntityNotFound(_0x5f556f,null))['then'](function(_0x3ce688){if(_0x3ce688){return _0x3ce688['removeAnswers'](_0x30666d[_0x3140('0x3c')]['ids']);}})[_0x3140('0x1a')](respondWithStatusCode(_0x5f556f,null))[_0x3140('0x23')](handleError(_0x5f556f,null));};exports[_0x3140('0x66')]=function(_0x1c4bb1,_0xcb64d0,_0x41a96b){return db['FaxInteraction'][_0x3140('0x58')]({'where':{'id':_0x1c4bb1[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0xcb64d0,null))[_0x3140('0x1a')](function(_0x32b692){if(_0x32b692){return _0x32b692[_0x3140('0x66')](_0x1c4bb1[_0x3140('0x56')]['ids'],_[_0x3140('0x67')](_0x1c4bb1[_0x3140('0x56')],[_0x3140('0x68'),'id'])||{});}})[_0x3140('0x1a')](respondWithResult(_0xcb64d0,null))[_0x3140('0x23')](handleError(_0xcb64d0,null));};exports['getInteractions']=function(_0x65a83c,_0x1eeb0a,_0x37c028){var _0x43ec27={'raw':![],'where':{}};var _0x6b387b={};var _0x1da8ce={'count':0x0,'rows':[]};return db[_0x3140('0x4e')][_0x3140('0x60')]({'where':{'id':_0x65a83c[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x1eeb0a,null))[_0x3140('0x1a')](function(_0x599474){if(_0x599474){_0x6b387b[_0x3140('0x3a')]=_['keys'](db[_0x3140('0x69')][_0x3140('0x36')]);_0x6b387b[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x65a83c[_0x3140('0x3c')]);_0x6b387b['filters']=_[_0x3140('0x3f')](_0x6b387b['model'],_0x6b387b[_0x3140('0x3c')]);_0x43ec27[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x6b387b[_0x3140('0x3a')],qs['fields'](_0x65a83c['query'][_0x3140('0x54')]));_0x43ec27[_0x3140('0x3e')]=_0x43ec27[_0x3140('0x3e')][_0x3140('0x40')]?_0x43ec27[_0x3140('0x3e')]:_0x6b387b[_0x3140('0x3a')];if(!_0x65a83c[_0x3140('0x3c')][_0x3140('0x41')](_0x3140('0x42'))){_0x43ec27[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x65a83c[_0x3140('0x3c')][_0x3140('0x29')]);_0x43ec27[_0x3140('0x27')]=qs[_0x3140('0x27')](_0x65a83c[_0x3140('0x3c')][_0x3140('0x27')]);}_0x43ec27[_0x3140('0x43')]=qs[_0x3140('0x44')](_0x65a83c[_0x3140('0x3c')]['sort']);_0x43ec27[_0x3140('0x45')]=qs[_0x3140('0x46')](_[_0x3140('0x47')](_0x65a83c[_0x3140('0x3c')],_0x6b387b[_0x3140('0x46')]));_0x43ec27[_0x3140('0x45')][_0x3140('0x5e')]=_0x599474['id'];if(_0x65a83c[_0x3140('0x3c')]['filter']){_0x43ec27[_0x3140('0x45')]=_[_0x3140('0x4a')](_0x43ec27['where'],{'$or':_['map'](_0x43ec27[_0x3140('0x3e')],function(_0x2317a7){var _0x1a3461={};_0x1a3461[_0x2317a7]={'$like':'%'+_0x65a83c[_0x3140('0x3c')][_0x3140('0x48')]+'%'};return _0x1a3461;})});}_0x43ec27=_['merge']({},_0x43ec27,_0x65a83c[_0x3140('0x4b')]);return db[_0x3140('0x69')]['count']({'where':_0x43ec27['where']})['then'](function(_0x518994){_0x1da8ce[_0x3140('0x2a')]=_0x518994;if(_0x65a83c['query'][_0x3140('0x4c')]){_0x43ec27[_0x3140('0x4d')]=[{'model':db['CmContact'],'as':_0x3140('0x6a'),'required':![]},{'model':db[_0x3140('0x6b')],'as':_0x3140('0x6c'),'attributes':[_0x3140('0x34'),'fullname',_0x3140('0x6d')],'required':![]},{'model':db[_0x3140('0x6e')],'as':'Tags','attributes':['id',_0x3140('0x34'),'color'],'where':_0x65a83c['query'][_0x3140('0x6f')]?{'id':_0x65a83c['query'][_0x3140('0x6f')]}:undefined,'required':_0x65a83c[_0x3140('0x3c')][_0x3140('0x6f')]?!![]:![]}];}return db['FaxInteraction'][_0x3140('0x4f')](_0x43ec27);})[_0x3140('0x1a')](function(_0x5f087a){_0x1da8ce[_0x3140('0x50')]=_0x5f087a;return _0x1da8ce;});}})[_0x3140('0x1a')](respondWithFilteredResult(_0x1eeb0a,_0x43ec27))[_0x3140('0x23')](handleError(_0x1eeb0a,null));};exports[_0x3140('0x70')]=function(_0x4493bb,_0x536c7c){var _0xf6bc7a=_0x4493bb[_0x3140('0x52')]['id'];var _0x24b309=_0x4493bb[_0x3140('0x56')];var _0x29078b=0xc8;var _0x3d9c2e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3140('0x71')]['Transaction']['ISOLATION_LEVELS'][_0x3140('0x72')]},function(_0x4bca5f){return db[_0x3140('0x4e')][_0x3140('0x60')]({'where':{'id':_0xf6bc7a},'transaction':_0x4bca5f})['then'](function(_0x6792c4){if(_0x6792c4){return db[_0x3140('0x73')][_0x3140('0x32')]({'where':{'FaxAccountId':_0xf6bc7a},'transaction':_0x4bca5f})[_0x3140('0x1a')](function(){var _0x46844f=_[_0x3140('0x3b')](_0x24b309,function(_0x175c76){_0x175c76[_0x3140('0x5e')]=_0xf6bc7a;return _0x175c76;});return db[_0x3140('0x73')][_0x3140('0x74')](_0x46844f,{'transaction':_0x4bca5f});});}else{_0x29078b=0x194;_0x3d9c2e=[];}});})[_0x3140('0x1a')](function(){if(_0x29078b!==0x194){return db[_0x3140('0x73')][_0x3140('0x75')]({'where':{'FaxAccountId':_0xf6bc7a},'order':_0x3140('0x76')})[_0x3140('0x1a')](function(_0x5d5c12){_0x3d9c2e=_0x5d5c12;});}})[_0x3140('0x23')](function(_0x3d695f){_0x29078b=0x1f4;logger['error'](_0x3d695f['stack']);if(_0x3d695f[_0x3140('0x34')]){delete _0x3d695f[_0x3140('0x34')];}_0x3d9c2e=_0x3d695f;})[_0x3140('0x77')](function(){if(_0x3d9c2e===null){_0x536c7c[_0x3140('0x24')](_0x29078b);}else{if(_0x29078b===0x1f4){_0x536c7c['status'](_0x29078b)[_0x3140('0x78')](_0x3d9c2e);}else{_0x536c7c[_0x3140('0x26')](_0x29078b)['json'](_0x3d9c2e);}}});};exports[_0x3140('0x79')]=function(_0x1dc7df,_0x47e569,_0x39bb40){var _0x4bad17={};var _0x5d39ba={};var _0x160de2;var _0x127017;return db[_0x3140('0x4e')]['findOne']({'where':{'id':_0x1dc7df['params']['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x47e569,null))[_0x3140('0x1a')](function(_0x1d3682){if(_0x1d3682){_0x160de2=_0x1d3682;_0x5d39ba['model']=_[_0x3140('0x3d')](db[_0x3140('0x73')]['rawAttributes']);_0x5d39ba[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x1dc7df[_0x3140('0x3c')]);_0x5d39ba[_0x3140('0x46')]=_[_0x3140('0x3f')](_0x5d39ba[_0x3140('0x3a')],_0x5d39ba[_0x3140('0x3c')]);_0x4bad17[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x5d39ba[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x1dc7df[_0x3140('0x3c')][_0x3140('0x54')]));_0x4bad17[_0x3140('0x3e')]=_0x4bad17['attributes']['length']?_0x4bad17['attributes']:_0x5d39ba[_0x3140('0x3a')];_0x4bad17['order']=qs[_0x3140('0x44')](_0x1dc7df[_0x3140('0x3c')][_0x3140('0x44')]);_0x4bad17[_0x3140('0x45')]=qs[_0x3140('0x46')](_[_0x3140('0x47')](_0x1dc7df['query'],_0x5d39ba[_0x3140('0x46')]));if(_0x1dc7df[_0x3140('0x3c')][_0x3140('0x48')]){_0x4bad17[_0x3140('0x45')]=_['merge'](_0x4bad17['where'],{'$or':_[_0x3140('0x3b')](_0x4bad17[_0x3140('0x3e')],function(_0xe89566){var _0x4bcd81={};_0x4bcd81[_0xe89566]={'$like':'%'+_0x1dc7df['query'][_0x3140('0x48')]+'%'};return _0x4bcd81;})});}_0x4bad17=_[_0x3140('0x4a')]({},_0x4bad17,_0x1dc7df[_0x3140('0x4b')]);return _0x160de2[_0x3140('0x79')](_0x4bad17);}})[_0x3140('0x1a')](function(_0x5c9faf){if(_0x5c9faf){_0x127017=_0x5c9faf[_0x3140('0x40')];if(!_0x1dc7df[_0x3140('0x3c')][_0x3140('0x41')](_0x3140('0x42'))){_0x4bad17[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x1dc7df['query']['limit']);_0x4bad17[_0x3140('0x27')]=qs['offset'](_0x1dc7df[_0x3140('0x3c')][_0x3140('0x27')]);}return _0x160de2['getApplications'](_0x4bad17);}})[_0x3140('0x1a')](function(_0x35b695){if(_0x35b695){return _0x35b695?{'count':_0x127017,'rows':_0x35b695}:null;}})[_0x3140('0x1a')](respondWithResult(_0x47e569,null))[_0x3140('0x23')](handleError(_0x47e569,null));};function Extension(_0x351d7e,_0x255367,_0xbde1b9,_0x294a65){this['context']=_0x3140('0x7a');this[_0x3140('0x7b')]=_0x351d7e['localstationid'];this[_0x3140('0x7c')]=_0x294a65;this['type']=_0x3140('0x7d');this[_0x3140('0x7e')]=_0x3140('0x7f');this[_0x3140('0x5e')]=_0x351d7e['id'];this['priority']=_0x255367;this[_0x3140('0x80')]=_0xbde1b9;}function createExtensionsReciveFax(_0x3cea3b){var _0x353920=0x1;var _0x454701=[];_0x454701[_0x3140('0x81')](new Extension(_0x3cea3b,_0x353920,'',_0x3140('0x82')));_0x353920+=0x1;_0x454701[_0x3140('0x81')](new Extension(_0x3cea3b,_0x353920,_0x3140('0x83'),'Set'));_0x353920+=0x1;for(var _0x4d03b0 in _0x3cea3b){if(_0x3cea3b[_0x3140('0x41')](_0x4d03b0)&&(_0x4d03b0==='ecm'||_0x4d03b0==='localstationid'||_0x4d03b0===_0x3140('0x84')||_0x4d03b0===_0x3140('0x85')||_0x4d03b0==='headerinfo'||_0x4d03b0===_0x3140('0x86')||_0x4d03b0==='minrate'||_0x4d03b0==='modem'||_0x4d03b0===_0x3140('0x87'))){_0x454701[_0x3140('0x81')](new Extension(_0x3cea3b,_0x353920,'FAXOPT('+_0x4d03b0+')='+_0x3cea3b[_0x4d03b0],_0x3140('0x88')));_0x353920+=0x1;}}_0x454701[_0x3140('0x81')](new Extension(_0x3cea3b,_0x353920,'6','Wait'));_0x353920+=0x1;_0x454701[_0x3140('0x81')](new Extension(_0x3cea3b,_0x353920,_0x3140('0x89'),_0x3140('0x8a')));_0x353920=0x0;return _0x454701;}exports[_0x3140('0x8b')]=function(_0xf8e65b,_0x3c5d13,_0x411c39){var _0x47fa7c;return db[_0x3140('0x71')][_0x3140('0x8c')](function(_0x59ab62){return db[_0x3140('0x4e')][_0x3140('0x55')](_0xf8e65b[_0x3140('0x56')],{'transaction':_0x59ab62})[_0x3140('0x1a')](function(_0x285f01){_0x47fa7c=_0x285f01['get']({'plain':!![]});return db[_0x3140('0x8d')][_0x3140('0x74')](createExtensionsReciveFax(_0x47fa7c),{'transaction':_0x59ab62});});})[_0x3140('0x1a')](function(){return _0x47fa7c;})[_0x3140('0x1a')](respondWithResult(_0x3c5d13,null))[_0x3140('0x23')](handleError(_0x3c5d13,null));};exports[_0x3140('0x8e')]=function(_0x32c682,_0xa9b5d8,_0x2d498a){var _0x193c9d;return db[_0x3140('0x71')][_0x3140('0x8c')](function(_0x17d2b8){return db[_0x3140('0x4e')][_0x3140('0x30')](_0x32c682[_0x3140('0x56')],{'where':{'id':_0x32c682[_0x3140('0x56')]['id']},'transaction':_0x17d2b8})[_0x3140('0x1a')](function(_0x2cffdc){return db[_0x3140('0x8d')][_0x3140('0x32')]({'where':{'FaxAccountId':_0x32c682['body']['id']},'transaction':_0x17d2b8})[_0x3140('0x1a')](function(_0x12a3b6){return db[_0x3140('0x8d')]['bulkCreate'](createExtensionsReciveFax(_[_0x3140('0x67')](_0x32c682[_0x3140('0x56')],[_0x3140('0x8f'),_0x3140('0x39'),_0x3140('0x90'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x17d2b8});});});})['then'](function(){return db[_0x3140('0x4e')][_0x3140('0x91')](_0x32c682['body']['id']);})[_0x3140('0x1a')](respondWithResult(_0xa9b5d8,null))['catch'](handleError(_0xa9b5d8,null));};exports['getMessages']=function(_0x5d554c,_0x730729,_0x11128b){var _0x45bce6={'raw':!![],'where':{}};var _0x30f403={};var _0x21555a={'count':0x0,'rows':[]};return db[_0x3140('0x4e')]['findOne']({'where':{'id':_0x5d554c[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x730729,null))[_0x3140('0x1a')](function(_0x20ac7e){if(_0x20ac7e){_0x30f403[_0x3140('0x3a')]=_[_0x3140('0x3d')](db[_0x3140('0x92')][_0x3140('0x36')]);_0x30f403['query']=_[_0x3140('0x3d')](_0x5d554c[_0x3140('0x3c')]);_0x30f403[_0x3140('0x46')]=_[_0x3140('0x3f')](_0x30f403[_0x3140('0x3a')],_0x30f403['query']);_0x45bce6[_0x3140('0x3e')]=_[_0x3140('0x3f')](_0x30f403[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x5d554c[_0x3140('0x3c')][_0x3140('0x54')]));_0x45bce6[_0x3140('0x3e')]=_0x45bce6[_0x3140('0x3e')][_0x3140('0x40')]?_0x45bce6[_0x3140('0x3e')]:_0x30f403['model'];if(!_0x5d554c['query'][_0x3140('0x41')]('nolimit')){_0x45bce6[_0x3140('0x29')]=qs[_0x3140('0x29')](_0x5d554c[_0x3140('0x3c')][_0x3140('0x29')]);_0x45bce6[_0x3140('0x27')]=qs['offset'](_0x5d554c[_0x3140('0x3c')][_0x3140('0x27')]);}_0x45bce6['order']=qs['sort'](_0x5d554c[_0x3140('0x3c')][_0x3140('0x44')]);_0x45bce6['where']=qs[_0x3140('0x46')](_['pick'](_0x5d554c[_0x3140('0x3c')],_0x30f403[_0x3140('0x46')]));_0x45bce6[_0x3140('0x45')][_0x3140('0x5e')]=_0x20ac7e['id'];if(_0x5d554c[_0x3140('0x3c')][_0x3140('0x48')]){_0x45bce6[_0x3140('0x45')]=_[_0x3140('0x4a')](_0x45bce6[_0x3140('0x45')],{'$or':_[_0x3140('0x3b')](_0x45bce6[_0x3140('0x3e')],function(_0x3b16b0){var _0x22bd10={};_0x22bd10[_0x3b16b0]={'$like':'%'+_0x5d554c['query'][_0x3140('0x48')]+'%'};return _0x22bd10;})});}if(_0x5d554c[_0x3140('0x3c')][_0x3140('0x93')]){var _0x809a4b=_0x5d554c[_0x3140('0x3c')][_0x3140('0x93')][_0x3140('0x94')](',');var _0x20c511={};_0x20c511[_0x809a4b[0x0]]={'$gte':moment(_0x809a4b[0x1])[_0x3140('0x95')](_0x3140('0x96'))};_0x45bce6['where']=_[_0x3140('0x4a')](_0x45bce6[_0x3140('0x45')],_0x20c511);}_0x45bce6=_['merge']({},_0x45bce6,_0x5d554c[_0x3140('0x4b')]);return db[_0x3140('0x92')][_0x3140('0x2a')]({'where':_0x45bce6['where']})[_0x3140('0x1a')](function(_0x105ef6){_0x21555a[_0x3140('0x2a')]=_0x105ef6;if(_0x5d554c[_0x3140('0x3c')]['includeAll']){_0x45bce6[_0x3140('0x4d')]=[{'all':!![]}];}return db[_0x3140('0x92')][_0x3140('0x4f')](_0x45bce6);})[_0x3140('0x1a')](function(_0xf29f77){_0x21555a['rows']=_0xf29f77;return _0x21555a;});}})[_0x3140('0x1a')](respondWithFilteredResult(_0x730729,_0x45bce6))[_0x3140('0x23')](handleError(_0x730729,null));};exports[_0x3140('0x78')]=function(_0xd7e186,_0x240585,_0x24cbb8){var _0x5cbc26,_0x2cb334={},_0x23d530;if(_0xd7e186[_0x3140('0x56')]['to']){_0x23d530=_0xd7e186['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xd7e186[_0x3140('0x52')]['id']},'include':[{'model':db[_0x3140('0x97')],'as':_0x3140('0x98'),'include':[{'model':db[_0x3140('0x99')],'as':_0x3140('0x9a'),'where':{'fax':_0x23d530},'limit':0x1,'order':[[_0x3140('0x9b'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x240585,null))['then'](function(_0x376c18){_0x5cbc26=_0x376c18;if(_0xd7e186[_0x3140('0x56')]['attachments']&&_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][_0x3140('0x40')]){for(var _0x5799a0=0x0;_0x5799a0<_0xd7e186[_0x3140('0x56')]['attachments'][_0x3140('0x40')];_0x5799a0+=0x1){_0xd7e186[_0x3140('0x56')]['attachments'][_0x5799a0]={'filename':_0xd7e186['body'][_0x3140('0x9c')][_0x5799a0]['name'],'id':_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][_0x5799a0]['id'],'path':path[_0x3140('0x9d')](config['root'],_0x3140('0x9e'),_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][_0x5799a0][_0x3140('0x9f')])};}}return respondWithRpcPromise('CheckAfterSend',_0x3140('0xa0'),{'FaxAccountId':_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x52')]['id'])?undefined:_0xd7e186[_0x3140('0x52')]['id'],'path':_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][0x0][_0x3140('0x5')])?undefined:_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][0x0][_0x3140('0x5')],'fax':_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x56')]['to'][0x0])?undefined:_0xd7e186['body']['to'][0x0]},client9002);})[_0x3140('0x1a')](function(){if(_0x5cbc26){if(_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x56')]['from'])){_0xd7e186[_0x3140('0x56')][_0x3140('0xa2')]=util[_0x3140('0x95')](_0x3140('0xa3'),_0x5cbc26['name'],_0x5cbc26['fax']);}if(_0x5cbc26[_0x3140('0x98')]){if(_0x5cbc26[_0x3140('0x98')]['Contacts'][_0x3140('0x40')]){return _0x5cbc26[_0x3140('0x98')]['Contacts'][0x0];}else{return db['CmContact'][_0x3140('0x55')](_[_0x3140('0xa4')](_0xd7e186[_0x3140('0x56')],{'firstName':_0xd7e186[_0x3140('0x56')]['to'][0x0],'phone':_0xd7e186[_0x3140('0x56')]['to'][0x0],'fax':_0xd7e186[_0x3140('0x56')]['to'][0x0],'ListId':_0x5cbc26[_0x3140('0xa5')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x3140('0xa6'));}})['then'](function(_0x289846){if(_0x289846){return db[_0x3140('0x69')]['find']({'where':{'ContactId':_0x289846['id'],'closed':![],'FaxAccountId':_0x5cbc26['id']}})[_0x3140('0x1a')](function(_0x11e4c5){if(_0x11e4c5){return[_0x11e4c5,![]];}return db[_0x3140('0x69')][_0x3140('0x55')]({'UserId':_0xd7e186['user']['id'],'ContactId':_0x289846['id'],'FaxAccountId':_0x5cbc26['id'],'fax':_0xd7e186[_0x3140('0x56')]['to'][0x0],'firstMsgDirection':_0x3140('0xa7'),'Messages':[_[_0x3140('0x4a')](_0xd7e186[_0x3140('0x56')],{'read':![],'body':_0xd7e186[_0x3140('0x56')]['attachments'][0x0]['filename'],'FaxAccountId':_0x5cbc26['id'],'UserId':_0xd7e186[_0x3140('0x57')]['id'],'ContactId':_0x289846['id'],'AttachmentId':_0xd7e186[_0x3140('0x56')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x3140('0x92')],'as':_0x3140('0xa8')}]})[_0x3140('0x1a')](function(_0x4c68f5){return[_0x4c68f5,!![]];});});}else{throw new Error(_0x3140('0xa9'));}})[_0x3140('0xaa')](function(_0x5a99c4,_0xcbaa14){if(_0xcbaa14){return _0x5a99c4;}return db[_0x3140('0x92')][_0x3140('0x55')]({'direction':_0x3140('0xa7'),'read':![],'body':_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][0x0][_0x3140('0xab')],'FaxAccountId':_0x5cbc26['id'],'FaxInteractionId':_0x5a99c4['id'],'UserId':_0xd7e186[_0x3140('0x57')]['id'],'ContactId':_0x5a99c4[_0x3140('0xac')],'AttachmentId':_0xd7e186[_0x3140('0x56')]['attachments'][0x0]['id']})[_0x3140('0x1a')](function(_0x264cdc){_0x5a99c4[_0x3140('0xad')]['Messages']=[];_0x5a99c4[_0x3140('0xad')]['Messages'][_0x3140('0x81')](_0x264cdc[_0x3140('0xad')]);return _0x5a99c4;});})[_0x3140('0x1a')](function(_0x2625fc){respondWithRpcPromise('SendFax',_0x3140('0xae'),{'FaxAccountId':_[_0x3140('0xa1')](_0xd7e186['params']['id'])?undefined:_0xd7e186[_0x3140('0x52')]['id'],'path':_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][0x0][_0x3140('0x5')])?undefined:_0xd7e186[_0x3140('0x56')][_0x3140('0x9c')][0x0][_0x3140('0x5')],'fax':_[_0x3140('0xa1')](_0xd7e186[_0x3140('0x56')]['to'][0x0])?undefined:_0xd7e186[_0x3140('0x56')]['to'][0x0],'AttachmentId':_0xd7e186[_0x3140('0x56')]['attachments'][0x0]['id']},client9002)[_0x3140('0x1a')](function(_0x455ce2){logger[_0x3140('0x21')](_0x3140('0xaf'),_0x455ce2);})[_0x3140('0x23')](function(_0xe5c99e){logger['info'](_0x3140('0xaf'),_0xe5c99e);});return _0x2625fc;})[_0x3140('0x1a')](respondWithResult(_0x240585,null))['catch'](handleError(_0x240585,null));};exports[_0x3140('0xb0')]=function(_0x148c34,_0x3f0aba,_0x402005){return db['FaxAccount'][_0x3140('0x58')]({'where':{'id':_0x148c34[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x3f0aba,null))[_0x3140('0x1a')](function(_0x586198){if(_0x586198){return _0x586198[_0x3140('0xb0')](_0x148c34[_0x3140('0x56')][_0x3140('0x68')],_[_0x3140('0x67')](_0x148c34[_0x3140('0x56')],[_0x3140('0x68'),'id'])||{})[_0x3140('0xaa')](function(_0x3768dd){for(var _0x527d9c=0x0;_0x527d9c<_0x148c34['body'][_0x3140('0x68')]['length'];_0x527d9c+=0x1){socket['emit'](_0x3140('0xb1'),{'UserId':Number(_0x148c34['body'][_0x3140('0x68')][_0x527d9c]),'FaxAccountId':Number(_0x148c34[_0x3140('0x52')]['id'])});}return _0x3768dd;});}})[_0x3140('0x1a')](respondWithResult(_0x3f0aba,null))[_0x3140('0x23')](handleError(_0x3f0aba,null));};exports[_0x3140('0xb2')]=function(_0x2e747c,_0x5f3ead,_0x499524){return db[_0x3140('0x4e')][_0x3140('0x58')]({'where':{'id':_0x2e747c[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x5f3ead,null))['then'](function(_0xca2a98){if(_0xca2a98){return _0xca2a98[_0x3140('0xb2')](_0x2e747c['query'][_0x3140('0x68')])[_0x3140('0x1a')](function(){if(_[_0x3140('0xb3')](_0x2e747c[_0x3140('0x3c')][_0x3140('0x68')])){for(var _0x17d71e=0x0;_0x17d71e<_0x2e747c[_0x3140('0x3c')][_0x3140('0x68')][_0x3140('0x40')];_0x17d71e+=0x1){socket[_0x3140('0xb4')](_0x3140('0xb5'),{'UserId':Number(_0x2e747c[_0x3140('0x3c')]['ids'][_0x17d71e]),'FaxAccountId':Number(_0x2e747c[_0x3140('0x52')]['id'])});}}else{socket[_0x3140('0xb4')](_0x3140('0xb5'),{'UserId':Number(_0x2e747c[_0x3140('0x3c')][_0x3140('0x68')]),'FaxAccountId':Number(_0x2e747c[_0x3140('0x52')]['id'])});}});}})[_0x3140('0x1a')](respondWithStatusCode(_0x5f3ead,null))[_0x3140('0x23')](handleError(_0x5f3ead,null));};exports[_0x3140('0xb6')]=function(_0x553e10,_0x25f889,_0x17cb29){var _0x2753f2={};var _0x4d270e={};var _0x4793ff;var _0x15a717;return db[_0x3140('0x4e')][_0x3140('0x60')]({'where':{'id':_0x553e10[_0x3140('0x52')]['id']}})[_0x3140('0x1a')](handleEntityNotFound(_0x25f889,null))[_0x3140('0x1a')](function(_0x1a830a){if(_0x1a830a){_0x4793ff=_0x1a830a;_0x4d270e[_0x3140('0x3a')]=_[_0x3140('0x3d')](db['User']['rawAttributes']);_0x4d270e[_0x3140('0x3c')]=_[_0x3140('0x3d')](_0x553e10[_0x3140('0x3c')]);_0x4d270e[_0x3140('0x46')]=_['intersection'](_0x4d270e[_0x3140('0x3a')],_0x4d270e[_0x3140('0x3c')]);_0x2753f2['attributes']=_[_0x3140('0x3f')](_0x4d270e[_0x3140('0x3a')],qs[_0x3140('0x54')](_0x553e10[_0x3140('0x3c')][_0x3140('0x54')]));_0x2753f2[_0x3140('0x3e')]=_0x2753f2[_0x3140('0x3e')]['length']?_0x2753f2[_0x3140('0x3e')]:_0x4d270e['model'];_0x2753f2[_0x3140('0x43')]=qs['sort'](_0x553e10[_0x3140('0x3c')][_0x3140('0x44')]);_0x2753f2[_0x3140('0x45')]=qs[_0x3140('0x46')](_['pick'](_0x553e10[_0x3140('0x3c')],_0x4d270e['filters']));if(_0x553e10['query'][_0x3140('0x48')]){_0x2753f2[_0x3140('0x45')]=_[_0x3140('0x4a')](_0x2753f2[_0x3140('0x45')],{'$or':_[_0x3140('0x3b')](_0x2753f2[_0x3140('0x3e')],function(_0xc057e){var _0x268a16={};_0x268a16[_0xc057e]={'$like':'%'+_0x553e10['query']['filter']+'%'};return _0x268a16;})});}_0x2753f2=_[_0x3140('0x4a')]({},_0x2753f2,_0x553e10[_0x3140('0x4b')]);return _0x4793ff[_0x3140('0xb6')](_0x2753f2);}})[_0x3140('0x1a')](function(_0x5805e4){if(_0x5805e4){_0x15a717=_0x5805e4[_0x3140('0x40')];if(!_0x553e10['query']['hasOwnProperty']('nolimit')){_0x2753f2[_0x3140('0x29')]=qs['limit'](_0x553e10['query'][_0x3140('0x29')]);_0x2753f2[_0x3140('0x27')]=qs[_0x3140('0x27')](_0x553e10[_0x3140('0x3c')][_0x3140('0x27')]);}return _0x4793ff[_0x3140('0xb6')](_0x2753f2);}})['then'](function(_0x87fd51){if(_0x87fd51){return _0x87fd51?{'count':_0x15a717,'rows':_0x87fd51}:null;}})[_0x3140('0x1a')](respondWithResult(_0x25f889,null))[_0x3140('0x23')](handleError(_0x25f889,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 402af36..653c351 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 _0xcb62=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','remove'];(function(_0x3960a3,_0x5e59b8){var _0x2e103b=function(_0x1255a1){while(--_0x1255a1){_0x3960a3['push'](_0x3960a3['shift']());}};_0x2e103b(++_0x5e59b8);}(_0xcb62,0xf7));var _0x2cb6=function(_0x3250ae,_0x5a3024){_0x3250ae=_0x3250ae-0x0;var _0x2ceb90=_0xcb62[_0x3250ae];return _0x2ceb90;};'use strict';var EventEmitter=require(_0x2cb6('0x0'));var FaxAccount=require(_0x2cb6('0x1'))['db'][_0x2cb6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2cb6('0x3'),'afterUpdate':'update','afterDestroy':_0x2cb6('0x4')};function emitEvent(_0x74c8be){return function(_0xe5fe50,_0x5e072f,_0x22b975){FaxAccountEvents['emit'](_0x74c8be+':'+_0xe5fe50['id'],_0xe5fe50);FaxAccountEvents[_0x2cb6('0x5')](_0x74c8be,_0xe5fe50);_0x22b975(null);};}for(var e in events){if(events[_0x2cb6('0x6')](e)){var event=events[e];FaxAccount[_0x2cb6('0x7')](e,emitEvent(event));}}module[_0x2cb6('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x4d4d=['exports','events','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x42fce4,_0x39207c){var _0x28ff77=function(_0x185dad){while(--_0x185dad){_0x42fce4['push'](_0x42fce4['shift']());}};_0x28ff77(++_0x39207c);}(_0x4d4d,0x196));var _0xd4d4=function(_0x194b7c,_0x5529d5){_0x194b7c=_0x194b7c-0x0;var _0x49830e=_0x4d4d[_0x194b7c];return _0x49830e;};'use strict';var EventEmitter=require(_0xd4d4('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xd4d4('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd4d4('0x2')](0x0);var events={'afterCreate':_0xd4d4('0x3'),'afterUpdate':_0xd4d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x253424){return function(_0x1cbfd2,_0x92684c,_0x3ee13d){FaxAccountEvents[_0xd4d4('0x5')](_0x253424+':'+_0x1cbfd2['id'],_0x1cbfd2);FaxAccountEvents[_0xd4d4('0x5')](_0x253424,_0x1cbfd2);_0x3ee13d(null);};}for(var e in events){if(events[_0xd4d4('0x6')](e)){var event=events[e];FaxAccount[_0xd4d4('0x7')](e,emitEvent(event));}}module[_0xd4d4('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e5885ea..e1c635a 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 _0xdae8=['lodash','../../config/logger','api','moment','request-promise','rimraf','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xdae8,0x1d6));var _0x8dae=function(_0x3e148f,_0x544059){_0x3e148f=_0x3e148f-0x0;var _0x524b4e=_0xdae8[_0x3e148f];return _0x524b4e;};'use strict';var _=require(_0x8dae('0x0'));var util=require('util');var logger=require(_0x8dae('0x1'))(_0x8dae('0x2'));var moment=require(_0x8dae('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dae('0x5'));var config=require('../../config/environment');var attributes=require(_0x8dae('0x6'));module[_0x8dae('0x7')]=function(_0x377c5b,_0x15787b){return _0x377c5b[_0x8dae('0x8')]('FaxAccount',attributes,{'tableName':_0x8dae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe365=['fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount'];(function(_0x54b788,_0x523ff7){var _0x36d8dd=function(_0x41fdde){while(--_0x41fdde){_0x54b788['push'](_0x54b788['shift']());}};_0x36d8dd(++_0x523ff7);}(_0xe365,0x151));var _0x5e36=function(_0x7e832b,_0x29ef76){_0x7e832b=_0x7e832b-0x0;var _0x11e8db=_0xe365[_0x7e832b];return _0x11e8db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e36('0x0'))(_0x5e36('0x1'));var moment=require(_0x5e36('0x2'));var BPromise=require(_0x5e36('0x3'));var rp=require(_0x5e36('0x4'));var fs=require('fs');var path=require(_0x5e36('0x5'));var rimraf=require(_0x5e36('0x6'));var config=require(_0x5e36('0x7'));var attributes=require('./faxAccount.attributes');module[_0x5e36('0x8')]=function(_0x5e1c26,_0x123945){return _0x5e1c26[_0x5e36('0x9')](_0x5e36('0xa'),attributes,{'tableName':_0x5e36('0xb'),'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 0f1470a..7957b38 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 _0xf644=['createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys'];(function(_0x53c9a8,_0x5f3e3f){var _0x54b73a=function(_0x280408){while(--_0x280408){_0x53c9a8['push'](_0x53c9a8['shift']());}};_0x54b73a(++_0x5f3e3f);}(_0xf644,0x138));var _0x4f64=function(_0x347bc9,_0x271f88){_0x347bc9=_0x347bc9-0x0;var _0x16dd1e=_0xf644[_0x347bc9];return _0x16dd1e;};'use strict';var _=require(_0x4f64('0x0'));var util=require('util');var moment=require(_0x4f64('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f64('0x2'))['db'];var utils=require(_0x4f64('0x3'));var logger=require(_0x4f64('0x4'))(_0x4f64('0x5'));var config=require(_0x4f64('0x6'));var jayson=require(_0x4f64('0x7'));var client=jayson[_0x4f64('0x8')]['http']({'port':0x232c});config['redis']=_[_0x4f64('0x9')](config[_0x4f64('0xa')],{'host':_0x4f64('0xb'),'port':0x18eb});var socket=require(_0x4f64('0xc'))(new Redis(config[_0x4f64('0xa')]));require(_0x4f64('0xd'))[_0x4f64('0xe')](socket);function respondWithRpcPromise(_0x1831be,_0x2c8f75,_0xedfc30){return new BPromise(function(_0x56868c,_0x2759e1){return client['request'](_0x1831be,_0xedfc30)['then'](function(_0x275ad2){logger['info'](_0x4f64('0xf'),_0x2c8f75,_0x4f64('0x10'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2c8f75,_0x4f64('0x10'),JSON['stringify'](_0x275ad2));if(_0x275ad2[_0x4f64('0x11')]){if(_0x275ad2[_0x4f64('0x11')][_0x4f64('0x12')]===0x1f4){logger['error'](_0x4f64('0xf'),_0x2c8f75,_0x275ad2[_0x4f64('0x11')][_0x4f64('0x13')]);return _0x2759e1(_0x275ad2['error'][_0x4f64('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x2c8f75,_0x275ad2[_0x4f64('0x11')][_0x4f64('0x13')]);return _0x56868c(_0x275ad2[_0x4f64('0x11')][_0x4f64('0x13')]);}else{logger['info'](_0x4f64('0xf'),_0x2c8f75,_0x4f64('0x10'));_0x56868c(_0x275ad2[_0x4f64('0x14')][_0x4f64('0x13')]);}})[_0x4f64('0x15')](function(_0x1bbf2a){logger[_0x4f64('0x11')](_0x4f64('0xf'),_0x2c8f75,_0x1bbf2a);_0x2759e1(_0x1bbf2a);});});}exports[_0x4f64('0x16')]=function(_0x3d05a2){var _0x301c6c=this;return new Promise(function(_0x15bbe7,_0x26859b){return db['FaxAccount'][_0x4f64('0x17')]({'raw':_0x3d05a2[_0x4f64('0x18')]?_0x3d05a2['options'][_0x4f64('0x19')]===undefined?!![]:![]:!![],'where':_0x3d05a2['options']?_0x3d05a2[_0x4f64('0x18')][_0x4f64('0x1a')]||null:null,'attributes':_0x3d05a2[_0x4f64('0x18')]?_0x3d05a2[_0x4f64('0x18')][_0x4f64('0x1b')]||null:null,'limit':_0x3d05a2[_0x4f64('0x18')]?_0x3d05a2[_0x4f64('0x18')][_0x4f64('0x1c')]||null:null,'include':_0x3d05a2[_0x4f64('0x18')]?_0x3d05a2[_0x4f64('0x18')][_0x4f64('0x1d')]?_[_0x4f64('0x1e')](_0x3d05a2[_0x4f64('0x18')][_0x4f64('0x1d')],function(_0x198fee){return{'model':db[_0x198fee['model']],'as':_0x198fee['as'],'attributes':_0x198fee[_0x4f64('0x1b')],'include':_0x198fee[_0x4f64('0x1d')]?_[_0x4f64('0x1e')](_0x198fee[_0x4f64('0x1d')],function(_0x12fe2e){return{'model':db[_0x12fe2e[_0x4f64('0x1f')]],'as':_0x12fe2e['as'],'attributes':_0x12fe2e['attributes'],'include':_0x12fe2e['include']?_[_0x4f64('0x1e')](_0x12fe2e['include'],function(_0x4afac5){return{'model':db[_0x4afac5[_0x4f64('0x1f')]],'as':_0x4afac5['as'],'attributes':_0x4afac5[_0x4f64('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f64('0x20')](function(_0x1ef3b0){logger['info']('GetFaxAccount',_0x3d05a2);logger[_0x4f64('0x21')](_0x4f64('0x16'),_0x3d05a2,JSON[_0x4f64('0x22')](_0x1ef3b0));_0x15bbe7(_0x1ef3b0);})[_0x4f64('0x15')](function(_0x4a1f49){logger[_0x4f64('0x11')]('GetFaxAccount',_0x4a1f49['message'],_0x3d05a2);_0x26859b(_0x301c6c[_0x4f64('0x11')](0x1f4,_0x4a1f49[_0x4f64('0x13')]));});});};exports[_0x4f64('0x23')]=function(_0x387880,_0x3dbc96,_0x52667d){var _0x2e37f8=this;return new Promise(function(_0x7a32d3,_0x2a7090){var _0xf73926={'body':_0x387880[_0x4f64('0x24')],'channel':'fax'};var _0x17ec67=[];var _0x1da7d2=[];var _0x1bbfc8={};return db[_0x4f64('0x25')][_0x4f64('0x26')]()[_0x4f64('0x20')](function(_0x2cff50){if(!_0x2cff50){throw new db[(_0x4f64('0x27'))][(_0x4f64('0x28'))](_0x4f64('0x29'));}_0x17ec67=_[_0x4f64('0x2a')](_[_0x4f64('0x2b')](_0x2cff50),[_0x4f64('0x2c'),'updatedAt']);_0x1da7d2=_[_0x4f64('0x2a')](_[_0x4f64('0x2b')](_0x2cff50),['createdAt',_0x4f64('0x2d'),_0x4f64('0x2e'),_0x4f64('0x2f')]);if(_0x387880[_0x4f64('0x24')]['id']){delete _0x387880[_0x4f64('0x24')]['id'];}if(_[_0x4f64('0x30')](_0x387880[_0x4f64('0x24')][_0x4f64('0x31')])){throw new db['Sequelize']['ValidationError'](_0x4f64('0x32'));}if(_['isNil'](_0x387880[_0x4f64('0x24')][_0x4f64('0x24')])||_0x387880['body']['body']===''){throw new db[(_0x4f64('0x27'))][(_0x4f64('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4f64('0x30')](_0x387880[_0x4f64('0x24')]['mapKey'])){throw new db['Sequelize'][(_0x4f64('0x28'))](_0x4f64('0x33')+_0x1da7d2);}if(!_[_0x4f64('0x34')](_0x1da7d2,_0x387880[_0x4f64('0x24')][_0x4f64('0x35')])){throw new db[(_0x4f64('0x27'))][(_0x4f64('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1da7d2);}_0x1bbfc8[_0x387880[_0x4f64('0x24')][_0x4f64('0x35')]]=_0x387880['body'][_0x4f64('0x31')];})['then'](function(){return db[_0x4f64('0x36')][_0x4f64('0x37')]({'where':{'id':_0x387880[_0x4f64('0x38')]['id']},'include':[{'model':db[_0x4f64('0x39')],'as':_0x4f64('0x3a'),'include':[{'model':db['CmContact'],'as':_0x4f64('0x3b'),'where':_0x1bbfc8,'limit':0x1,'order':[[_0x4f64('0x2d'),_0x4f64('0x3c')]]}]},{'model':db[_0x4f64('0x3d')],'as':_0x4f64('0x3e')}]});})['then'](function(_0x31299a){if(_0x31299a&&_0x31299a[_0x4f64('0x3a')]){var _0x58cf2a=_0x31299a[_0x4f64('0x3f')]({'plain':!![]});_0xf73926[_0x4f64('0x38')]=_0x58cf2a;_0xf73926[_0x4f64('0x40')]=_0x58cf2a[_0x4f64('0x3e')];_0xf73926['list']=_0x58cf2a[_0x4f64('0x3a')];_0xf73926[_0x4f64('0x40')]=_['orderBy'](_0xf73926[_0x4f64('0x40')],[_0x4f64('0x41')],[_0x4f64('0x42')]);if(_0xf73926[_0x4f64('0x38')][_0x4f64('0x3e')]){delete _0xf73926[_0x4f64('0x38')][_0x4f64('0x3e')];}if(_0xf73926['account'][_0x4f64('0x3a')]&&_0xf73926[_0x4f64('0x38')][_0x4f64('0x3a')]['Contacts']['length']){return _0xf73926['account'][_0x4f64('0x3a')]['Contacts'][0x0];}var _0x1f3789=_[_0x4f64('0x9')](_0x387880['body'],{'firstName':_0x387880['body'][_0x4f64('0x31')],'ListId':_0x58cf2a[_0x4f64('0x2f')]});_0x1f3789[_0x387880[_0x4f64('0x24')][_0x4f64('0x35')]]=_0x387880[_0x4f64('0x24')][_0x4f64('0x31')];return db['CmContact'][_0x4f64('0x43')](_0x1f3789,{'fields':_0x17ec67,'raw':!![]});}})[_0x4f64('0x20')](function(_0xee7267){_0xf73926[_0x4f64('0x44')]=_0xee7267;if(_0xee7267){var _0x1e6c36={'ContactId':_0xee7267['id'],'FaxAccountId':_0x387880[_0x4f64('0x38')]['id'],'fax':_0xee7267['fax']};return db[_0x4f64('0x45')][_0x4f64('0x37')]({'where':{'ContactId':_0xee7267['id'],'closed':![],'FaxAccountId':_0x387880[_0x4f64('0x38')]['id']}})[_0x4f64('0x20')](function(_0x18d4f9){if(_0x18d4f9){return[_0x18d4f9,![]];}return db[_0x4f64('0x45')][_0x4f64('0x43')](_0x1e6c36)[_0x4f64('0x20')](function(_0x370c81){return[_0x370c81,!![]];});});}else{throw new Error(_0x4f64('0x46'));}})[_0x4f64('0x47')](function(_0x3595da,_0x4ffea7){var _0xa35282=_0x3595da[_0x4f64('0x3f')]({'plain':!![]});if(_0x4ffea7){if(_0xf73926[_0x4f64('0x38')]['autoclose']){_0xf73926[_0x4f64('0x40')][_0x4f64('0x48')]({'id':0x0,'priority':_0xf73926[_0x4f64('0x40')][_0x4f64('0x49')]+0x1,'app':_0x4f64('0x4a'),'appdata':_0x4f64('0x4b'),'interval':'*,*,*,*'});}_0xa35282['created']=!![];}else{_0xa35282[_0x4f64('0x4c')]=![];}_0xf73926[_0x4f64('0x4d')]=_0xa35282;return db[_0x4f64('0x4e')]['create']({'body':_0x387880[_0x4f64('0x24')][_0x4f64('0x24')],'FaxAccountId':_0x387880[_0x4f64('0x38')]['id'],'FaxInteractionId':_0x3595da['id'],'direction':'in','ContactId':_0x3595da[_0x4f64('0x4f')],'AttachmentId':_0x387880[_0x4f64('0x24')][_0x4f64('0x50')]});})[_0x4f64('0x20')](function(_0x3bdb01){_0xf73926[_0x4f64('0x13')]=_0x3bdb01;if(_0xf73926[_0x4f64('0x4d')][_0x4f64('0x51')]){return db[_0x4f64('0x52')][_0x4f64('0x37')]({'attributes':['id','name'],'where':{'id':_0xf73926[_0x4f64('0x4d')]['UserId']}})['then'](function(_0x56375f){if(_0x56375f){_0xf73926[_0x4f64('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4f64('0x53'),'appdata':_0x56375f[_0x4f64('0x54')]+','+(_0xf73926[_0x4f64('0x38')][_0x4f64('0x55')]||0xa),'interval':_0x4f64('0x56')});}return respondWithRpcPromise(_0x4f64('0x57'),'startRouting',_0xf73926);});}return respondWithRpcPromise(_0x4f64('0x57'),_0x4f64('0x58'),_0xf73926);})[_0x4f64('0x20')](function(_0x566640){_0x7a32d3(_0x566640);})[_0x4f64('0x15')](function(_0x556a91){_0x2a7090(_0x2e37f8[_0x4f64('0x11')](0x1f4,_0x556a91[_0x4f64('0x13')]));});});}; \ No newline at end of file +var _0x8513=['mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','FaxApplication','Applications','applications','list','orderBy','priority','asc','Contacts','length','ListId','create','FaxInteraction','find','spread','get','autoclose','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','isNil'];(function(_0x4cfe4b,_0x45474c){var _0x3ab57a=function(_0x2fe642){while(--_0x2fe642){_0x4cfe4b['push'](_0x4cfe4b['shift']());}};_0x3ab57a(++_0x45474c);}(_0x8513,0x79));var _0x3851=function(_0x5331c0,_0x32fbec){_0x5331c0=_0x5331c0-0x0;var _0x46aebd=_0x8513[_0x5331c0];return _0x46aebd;};'use strict';var _=require(_0x3851('0x0'));var util=require(_0x3851('0x1'));var moment=require(_0x3851('0x2'));var BPromise=require(_0x3851('0x3'));var rs=require(_0x3851('0x4'));var fs=require('fs');var Redis=require(_0x3851('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3851('0x6'));var logger=require('../../config/logger')(_0x3851('0x7'));var config=require(_0x3851('0x8'));var jayson=require(_0x3851('0x9'));var client=jayson[_0x3851('0xa')][_0x3851('0xb')]({'port':0x232c});config[_0x3851('0xc')]=_[_0x3851('0xd')](config[_0x3851('0xc')],{'host':_0x3851('0xe'),'port':0x18eb});var socket=require(_0x3851('0xf'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x3851('0x10')](socket);function respondWithRpcPromise(_0x20d312,_0xde5716,_0x564d67){return new BPromise(function(_0x349de1,_0x5c4650){return client[_0x3851('0x11')](_0x20d312,_0x564d67)[_0x3851('0x12')](function(_0x5d8330){logger[_0x3851('0x13')]('FaxAccount,\x20%s,\x20%s',_0xde5716,_0x3851('0x14'));logger[_0x3851('0x15')](_0x3851('0x16'),_0xde5716,_0x3851('0x14'),JSON[_0x3851('0x17')](_0x5d8330));if(_0x5d8330['error']){if(_0x5d8330['error']['code']===0x1f4){logger[_0x3851('0x18')](_0x3851('0x19'),_0xde5716,_0x5d8330['error'][_0x3851('0x1a')]);return _0x5c4650(_0x5d8330[_0x3851('0x18')][_0x3851('0x1a')]);}logger['error'](_0x3851('0x19'),_0xde5716,_0x5d8330[_0x3851('0x18')][_0x3851('0x1a')]);return _0x349de1(_0x5d8330[_0x3851('0x18')][_0x3851('0x1a')]);}else{logger[_0x3851('0x13')](_0x3851('0x19'),_0xde5716,'request\x20sent');_0x349de1(_0x5d8330[_0x3851('0x1b')][_0x3851('0x1a')]);}})[_0x3851('0x1c')](function(_0x183040){logger[_0x3851('0x18')](_0x3851('0x19'),_0xde5716,_0x183040);_0x5c4650(_0x183040);});});}exports[_0x3851('0x1d')]=function(_0x59565e){var _0x24d631=this;return new Promise(function(_0x48c7b9,_0x3d7c71){return db[_0x3851('0x1e')]['findAll']({'raw':_0x59565e[_0x3851('0x1f')]?_0x59565e[_0x3851('0x1f')][_0x3851('0x20')]===undefined?!![]:![]:!![],'where':_0x59565e[_0x3851('0x1f')]?_0x59565e[_0x3851('0x1f')][_0x3851('0x21')]||null:null,'attributes':_0x59565e[_0x3851('0x1f')]?_0x59565e[_0x3851('0x1f')]['attributes']||null:null,'limit':_0x59565e[_0x3851('0x1f')]?_0x59565e[_0x3851('0x1f')][_0x3851('0x22')]||null:null,'include':_0x59565e[_0x3851('0x1f')]?_0x59565e[_0x3851('0x1f')][_0x3851('0x23')]?_[_0x3851('0x24')](_0x59565e[_0x3851('0x1f')]['include'],function(_0x5a8129){return{'model':db[_0x5a8129[_0x3851('0x25')]],'as':_0x5a8129['as'],'attributes':_0x5a8129[_0x3851('0x26')],'include':_0x5a8129[_0x3851('0x23')]?_[_0x3851('0x24')](_0x5a8129[_0x3851('0x23')],function(_0x5ca808){return{'model':db[_0x5ca808['model']],'as':_0x5ca808['as'],'attributes':_0x5ca808['attributes'],'include':_0x5ca808[_0x3851('0x23')]?_[_0x3851('0x24')](_0x5ca808['include'],function(_0x1ea273){return{'model':db[_0x1ea273[_0x3851('0x25')]],'as':_0x1ea273['as'],'attributes':_0x1ea273[_0x3851('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b8936){logger['info'](_0x3851('0x1d'),_0x59565e);logger[_0x3851('0x15')](_0x3851('0x1d'),_0x59565e,JSON[_0x3851('0x17')](_0x5b8936));_0x48c7b9(_0x5b8936);})[_0x3851('0x1c')](function(_0x39c72a){logger[_0x3851('0x18')]('GetFaxAccount',_0x39c72a[_0x3851('0x1a')],_0x59565e);_0x3d7c71(_0x24d631['error'](0x1f4,_0x39c72a[_0x3851('0x1a')]));});});};exports[_0x3851('0x27')]=function(_0x1ddf9f,_0x409099,_0x56aebd){var _0x231bd6=this;return new Promise(function(_0x5437e5,_0x5e2e25){var _0x55af39={'body':_0x1ddf9f[_0x3851('0x28')],'channel':_0x3851('0x29')};var _0x1f4b1b=[];var _0x2bfa69=[];var _0xf9bc49={};return db[_0x3851('0x2a')][_0x3851('0x2b')]()[_0x3851('0x12')](function(_0x204999){if(!_0x204999){throw new db[(_0x3851('0x2c'))][(_0x3851('0x2d'))](_0x3851('0x2e'));}_0x1f4b1b=_['difference'](_[_0x3851('0x2f')](_0x204999),[_0x3851('0x30'),_0x3851('0x31')]);_0x2bfa69=_[_0x3851('0x32')](_['keys'](_0x204999),['createdAt',_0x3851('0x31'),_0x3851('0x33'),'ListId']);if(_0x1ddf9f[_0x3851('0x28')]['id']){delete _0x1ddf9f[_0x3851('0x28')]['id'];}if(_[_0x3851('0x34')](_0x1ddf9f['body']['from'])){throw new db[(_0x3851('0x2c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x3851('0x34')](_0x1ddf9f[_0x3851('0x28')][_0x3851('0x28')])||_0x1ddf9f[_0x3851('0x28')][_0x3851('0x28')]===''){throw new db[(_0x3851('0x2c'))][(_0x3851('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3851('0x34')](_0x1ddf9f[_0x3851('0x28')][_0x3851('0x35')])){throw new db[(_0x3851('0x2c'))][(_0x3851('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bfa69);}if(!_['includes'](_0x2bfa69,_0x1ddf9f[_0x3851('0x28')]['mapKey'])){throw new db[(_0x3851('0x2c'))][(_0x3851('0x2d'))](_0x3851('0x36')+_0x2bfa69);}_0xf9bc49[_0x1ddf9f['body'][_0x3851('0x35')]]=_0x1ddf9f['body']['from'];})[_0x3851('0x12')](function(){return db[_0x3851('0x1e')]['find']({'where':{'id':_0x1ddf9f[_0x3851('0x37')]['id']},'include':[{'model':db[_0x3851('0x38')],'as':_0x3851('0x39'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf9bc49,'limit':0x1,'order':[[_0x3851('0x31'),'DESC']]}]},{'model':db[_0x3851('0x3a')],'as':_0x3851('0x3b')}]});})[_0x3851('0x12')](function(_0x4703fd){if(_0x4703fd&&_0x4703fd[_0x3851('0x39')]){var _0x151ed1=_0x4703fd['get']({'plain':!![]});_0x55af39[_0x3851('0x37')]=_0x151ed1;_0x55af39[_0x3851('0x3c')]=_0x151ed1['Applications'];_0x55af39[_0x3851('0x3d')]=_0x151ed1[_0x3851('0x39')];_0x55af39[_0x3851('0x3c')]=_[_0x3851('0x3e')](_0x55af39[_0x3851('0x3c')],[_0x3851('0x3f')],[_0x3851('0x40')]);if(_0x55af39['account'][_0x3851('0x3b')]){delete _0x55af39[_0x3851('0x37')]['Applications'];}if(_0x55af39[_0x3851('0x37')][_0x3851('0x39')]&&_0x55af39[_0x3851('0x37')]['List'][_0x3851('0x41')][_0x3851('0x42')]){return _0x55af39[_0x3851('0x37')][_0x3851('0x39')][_0x3851('0x41')][0x0];}var _0x370abc=_['defaults'](_0x1ddf9f[_0x3851('0x28')],{'firstName':_0x1ddf9f[_0x3851('0x28')]['from'],'ListId':_0x151ed1[_0x3851('0x43')]});_0x370abc[_0x1ddf9f['body'][_0x3851('0x35')]]=_0x1ddf9f['body']['from'];return db[_0x3851('0x2a')][_0x3851('0x44')](_0x370abc,{'fields':_0x1f4b1b,'raw':!![]});}})[_0x3851('0x12')](function(_0x4e61fe){_0x55af39['contact']=_0x4e61fe;if(_0x4e61fe){var _0x5110fa={'ContactId':_0x4e61fe['id'],'FaxAccountId':_0x1ddf9f['account']['id'],'fax':_0x4e61fe[_0x3851('0x29')]};return db[_0x3851('0x45')][_0x3851('0x46')]({'where':{'ContactId':_0x4e61fe['id'],'closed':![],'FaxAccountId':_0x1ddf9f['account']['id']}})['then'](function(_0x301c6d){if(_0x301c6d){return[_0x301c6d,![]];}return db[_0x3851('0x45')][_0x3851('0x44')](_0x5110fa)[_0x3851('0x12')](function(_0xab1caf){return[_0xab1caf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3851('0x47')](function(_0x58c8b5,_0x2797f4){var _0x1400e6=_0x58c8b5[_0x3851('0x48')]({'plain':!![]});if(_0x2797f4){if(_0x55af39[_0x3851('0x37')][_0x3851('0x49')]){_0x55af39[_0x3851('0x3c')]['push']({'id':0x0,'priority':_0x55af39[_0x3851('0x3c')][_0x3851('0x42')]+0x1,'app':'close','appdata':_0x3851('0x4a'),'interval':'*,*,*,*'});}_0x1400e6[_0x3851('0x4b')]=!![];}else{_0x1400e6[_0x3851('0x4b')]=![];}_0x55af39[_0x3851('0x4c')]=_0x1400e6;return db[_0x3851('0x4d')]['create']({'body':_0x1ddf9f[_0x3851('0x28')][_0x3851('0x28')],'FaxAccountId':_0x1ddf9f[_0x3851('0x37')]['id'],'FaxInteractionId':_0x58c8b5['id'],'direction':'in','ContactId':_0x58c8b5[_0x3851('0x4e')],'AttachmentId':_0x1ddf9f[_0x3851('0x28')][_0x3851('0x4f')]});})[_0x3851('0x12')](function(_0x2532f3){_0x55af39[_0x3851('0x1a')]=_0x2532f3;if(_0x55af39['interaction'][_0x3851('0x50')]){return db[_0x3851('0x51')][_0x3851('0x46')]({'attributes':['id',_0x3851('0x52')],'where':{'id':_0x55af39[_0x3851('0x4c')]['UserId']}})['then'](function(_0x211c49){if(_0x211c49){_0x55af39[_0x3851('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x211c49[_0x3851('0x52')]+','+(_0x55af39['account'][_0x3851('0x53')]||0xa),'interval':_0x3851('0x54')});}return respondWithRpcPromise('Start','startRouting',_0x55af39);});}return respondWithRpcPromise(_0x3851('0x55'),_0x3851('0x56'),_0x55af39);})[_0x3851('0x12')](function(_0x4a002a){_0x5437e5(_0x4a002a);})[_0x3851('0x1c')](function(_0x32e8f4){_0x5e2e25(_0x231bd6[_0x3851('0x18')](0x1f4,_0x32e8f4[_0x3851('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index aa9ea93..598c01f 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 _0xfa3d=['remove','update','emit','faxAccount:','./faxAccount.events','save'];(function(_0x16c990,_0x4c0da9){var _0x1743f5=function(_0x52329b){while(--_0x52329b){_0x16c990['push'](_0x16c990['shift']());}};_0x1743f5(++_0x4c0da9);}(_0xfa3d,0x154));var _0xdfa3=function(_0x18362e,_0x14e274){_0x18362e=_0x18362e-0x0;var _0x30111b=_0xfa3d[_0x18362e];return _0x30111b;};'use strict';var FaxAccountEvents=require(_0xdfa3('0x0'));var events=[_0xdfa3('0x1'),_0xdfa3('0x2'),_0xdfa3('0x3')];function createListener(_0x5e53ff,_0x9457a1){return function(_0x51ad1d){_0x9457a1[_0xdfa3('0x4')](_0x5e53ff,_0x51ad1d);};}function removeListener(_0x3b383a,_0xa9012f){return function(){FaxAccountEvents['removeListener'](_0x3b383a,_0xa9012f);};}exports['register']=function(_0x5ec056){for(var _0x1e4989=0x0,_0x400c08=events['length'];_0x1e4989<_0x400c08;_0x1e4989++){var _0x1fc00b=events[_0x1e4989];var _0x48843e=createListener(_0xdfa3('0x5')+_0x1fc00b,_0x5ec056);FaxAccountEvents['on'](_0x1fc00b,_0x48843e);}}; \ No newline at end of file +var _0xa6ba=['./faxAccount.events','remove','removeListener','register'];(function(_0x3d3602,_0x1bae3c){var _0x3bf8e5=function(_0x171d41){while(--_0x171d41){_0x3d3602['push'](_0x3d3602['shift']());}};_0x3bf8e5(++_0x1bae3c);}(_0xa6ba,0xb4));var _0xaa6b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa6ba[_0x28947d];return _0x12d2ee;};'use strict';var FaxAccountEvents=require(_0xaa6b('0x0'));var events=['save',_0xaa6b('0x1'),'update'];function createListener(_0xab5fe3,_0x59200e){return function(_0x33283c){_0x59200e['emit'](_0xab5fe3,_0x33283c);};}function removeListener(_0x5ac652,_0x14f214){return function(){FaxAccountEvents[_0xaa6b('0x2')](_0x5ac652,_0x14f214);};}exports[_0xaa6b('0x3')]=function(_0x28c220){for(var _0x3a6784=0x0,_0x4fd720=events['length'];_0x3a6784<_0x4fd720;_0x3a6784++){var _0x3ff247=events[_0x3a6784];var _0x3c9ab8=createListener('faxAccount:'+_0x3ff247,_0x28c220);FaxAccountEvents['on'](_0x3ff247,_0x3c9ab8);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8dde3bd..d6d2fda 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(_0x561d8f,_0x457076){var _0x21d9f0=function(_0xf1681f){while(--_0xf1681f){_0x561d8f['push'](_0x561d8f['shift']());}};_0x21d9f0(++_0x457076);}(_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/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(_0x1a98d1,_0x24de96){var _0x365be1=function(_0x23435e){while(--_0x23435e){_0x1a98d1['push'](_0x1a98d1['shift']());}};_0x365be1(++_0x24de96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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 46d3907..5a45380 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 _0xc8ae=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x127f09,_0x20dd27){var _0x45892f=function(_0x42fe8a){while(--_0x42fe8a){_0x127f09['push'](_0x127f09['shift']());}};_0x45892f(++_0x20dd27);}(_0xc8ae,0x1c1));var _0xec8a=function(_0x50de2c,_0x4a133b){_0x50de2c=_0x50de2c-0x0;var _0x1bdbe0=_0xc8ae[_0x50de2c];return _0x1bdbe0;};'use strict';var Sequelize=require(_0xec8a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xec8a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xec8a('0x2')],'allowNull':![],'defaultValue':_0xec8a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xec8a('0x2')]},'interval':{'type':Sequelize[_0xec8a('0x2')],'defaultValue':_0xec8a('0x4')}}; \ No newline at end of file +var _0x6ca7=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x130c43,_0x4b4fa8){var _0x1951e0=function(_0x535068){while(--_0x535068){_0x130c43['push'](_0x130c43['shift']());}};_0x1951e0(++_0x4b4fa8);}(_0x6ca7,0x1bc));var _0x76ca=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x6ca7[_0x1f5a63];return _0x30bb7a;};'use strict';var Sequelize=require(_0x76ca('0x0'));module[_0x76ca('0x1')]={'priority':{'type':Sequelize[_0x76ca('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x76ca('0x3')],'allowNull':![],'defaultValue':_0x76ca('0x4')},'appdata':{'type':Sequelize[_0x76ca('0x5')]()},'description':{'type':Sequelize[_0x76ca('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0f02c2e..1e94df5 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 _0x4517=['mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4d8171,_0x4cc6a1){var _0x282bfa=function(_0x36d783){while(--_0x36d783){_0x4d8171['push'](_0x4d8171['shift']());}};_0x282bfa(++_0x4cc6a1);}(_0x4517,0x12e));var _0x7451=function(_0x567216,_0x4ba184){_0x567216=_0x567216-0x0;var _0x652d13=_0x4517[_0x567216];return _0x652d13;};'use strict';var emlformat=require(_0x7451('0x0'));var rimraf=require(_0x7451('0x1'));var zipdir=require(_0x7451('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7451('0x3'));var moment=require(_0x7451('0x4'));var BPromise=require(_0x7451('0x5'));var Mustache=require(_0x7451('0x6'));var util=require(_0x7451('0x7'));var path=require(_0x7451('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7451('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7451('0xa'));var squel=require(_0x7451('0xb'));var crypto=require(_0x7451('0xc'));var jsforce=require(_0x7451('0xd'));var deskjs=require(_0x7451('0xe'));var toCsv=require(_0x7451('0xf'));var querystring=require(_0x7451('0x10'));var Papa=require(_0x7451('0x11'));var Redis=require('ioredis');var authService=require(_0x7451('0x12'));var qs=require(_0x7451('0x13'));var as=require(_0x7451('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7451('0x15'))(_0x7451('0x16'));var utils=require(_0x7451('0x17'));var config=require(_0x7451('0x18'));var licenseUtil=require(_0x7451('0x19'));var db=require(_0x7451('0x1a'))['db'];function respondWithStatusCode(_0x28f6e0,_0x42149a){_0x42149a=_0x42149a||0xcc;return function(_0x198e5a){if(_0x198e5a){return _0x28f6e0['sendStatus'](_0x42149a);}return _0x28f6e0['status'](_0x42149a)[_0x7451('0x1b')]();};}function respondWithResult(_0x5b2f4c,_0x10e0c1){_0x10e0c1=_0x10e0c1||0xc8;return function(_0x6deea2){if(_0x6deea2){return _0x5b2f4c[_0x7451('0x1c')](_0x10e0c1)[_0x7451('0x1d')](_0x6deea2);}};}function respondWithFilteredResult(_0x57513f,_0x284a6d){return function(_0x4cb475){if(_0x4cb475){var _0x3f6c70=typeof _0x284a6d[_0x7451('0x1e')]===_0x7451('0x1f')&&typeof _0x284a6d[_0x7451('0x20')]===_0x7451('0x1f');var _0x23b3b8=_0x4cb475[_0x7451('0x21')];var _0x5f130e=_0x3f6c70?0x0:_0x284a6d[_0x7451('0x1e')];var _0x19ff93=_0x3f6c70?_0x4cb475[_0x7451('0x21')]:_0x284a6d[_0x7451('0x1e')]+_0x284a6d[_0x7451('0x20')];var _0x1e108e;if(_0x19ff93>=_0x23b3b8){_0x19ff93=_0x23b3b8;_0x1e108e=0xc8;}else{_0x1e108e=0xce;}_0x57513f['status'](_0x1e108e);return _0x57513f[_0x7451('0x22')]('Content-Range',_0x5f130e+'-'+_0x19ff93+'/'+_0x23b3b8)['json'](_0x4cb475);}return null;};}function patchUpdates(_0xb00148){return function(_0x4fa5cd){try{jsonpatch[_0x7451('0x23')](_0x4fa5cd,_0xb00148,!![]);}catch(_0x1320e2){return BPromise[_0x7451('0x24')](_0x1320e2);}return _0x4fa5cd[_0x7451('0x25')]();};}function saveUpdates(_0x10b590,_0x56d7d7){return function(_0x325cec){if(_0x325cec){return _0x325cec[_0x7451('0x26')](_0x10b590)[_0x7451('0x27')](function(_0x5ab3f0){return _0x5ab3f0;});}return null;};}function removeEntity(_0x58b85d,_0x1b8fab){return function(_0x1cca7d){if(_0x1cca7d){return _0x1cca7d['destroy']()['then'](function(){_0x58b85d['status'](0xcc)[_0x7451('0x1b')]();});}};}function handleEntityNotFound(_0x49107e,_0x1f2c98){return function(_0x5e69fb){if(!_0x5e69fb){_0x49107e[_0x7451('0x28')](0x194);}return _0x5e69fb;};}function handleError(_0xbff360,_0x37a709){_0x37a709=_0x37a709||0x1f4;return function(_0x2bb71a){logger[_0x7451('0x29')](_0x2bb71a['stack']);if(_0x2bb71a[_0x7451('0x2a')]){delete _0x2bb71a[_0x7451('0x2a')];}_0xbff360[_0x7451('0x1c')](_0x37a709)[_0x7451('0x2b')](_0x2bb71a);};}exports[_0x7451('0x2c')]=function(_0xc0e5b2,_0x2bd67f){var _0x1c13d4={},_0xa98638={},_0x5226b1={'count':0x0,'rows':[]};var _0x267671=_[_0x7451('0x2d')](db[_0x7451('0x2e')]['rawAttributes'],function(_0x24dde2){return{'name':_0x24dde2[_0x7451('0x2f')],'type':_0x24dde2[_0x7451('0x30')][_0x7451('0x31')]};});_0xa98638[_0x7451('0x32')]=_[_0x7451('0x2d')](_0x267671,_0x7451('0x2a'));_0xa98638[_0x7451('0x33')]=_[_0x7451('0x34')](_0xc0e5b2['query']);_0xa98638[_0x7451('0x35')]=_[_0x7451('0x36')](_0xa98638[_0x7451('0x32')],_0xa98638[_0x7451('0x33')]);_0x1c13d4['attributes']=_[_0x7451('0x36')](_0xa98638[_0x7451('0x32')],qs[_0x7451('0x37')](_0xc0e5b2[_0x7451('0x33')][_0x7451('0x37')]));_0x1c13d4['attributes']=_0x1c13d4['attributes'][_0x7451('0x38')]?_0x1c13d4[_0x7451('0x39')]:_0xa98638[_0x7451('0x32')];if(!_0xc0e5b2[_0x7451('0x33')]['hasOwnProperty'](_0x7451('0x3a'))){_0x1c13d4['limit']=qs[_0x7451('0x20')](_0xc0e5b2[_0x7451('0x33')][_0x7451('0x20')]);_0x1c13d4[_0x7451('0x1e')]=qs[_0x7451('0x1e')](_0xc0e5b2[_0x7451('0x33')][_0x7451('0x1e')]);}_0x1c13d4[_0x7451('0x3b')]=qs['sort'](_0xc0e5b2[_0x7451('0x33')][_0x7451('0x3c')]);_0x1c13d4[_0x7451('0x3d')]=qs[_0x7451('0x35')](_[_0x7451('0x3e')](_0xc0e5b2['query'],_0xa98638[_0x7451('0x35')]),_0x267671);if(_0xc0e5b2[_0x7451('0x33')][_0x7451('0x3f')]){_0x1c13d4['where']=_[_0x7451('0x40')](_0x1c13d4[_0x7451('0x3d')],{'$or':_[_0x7451('0x2d')](_0x267671,function(_0x57f38f){if(_0x57f38f[_0x7451('0x30')]!=='VIRTUAL'){var _0x58839a={};_0x58839a[_0x57f38f[_0x7451('0x2a')]]={'$like':'%'+_0xc0e5b2['query']['filter']+'%'};return _0x58839a;}})});}_0x1c13d4=_[_0x7451('0x40')]({},_0x1c13d4,_0xc0e5b2[_0x7451('0x41')]);var _0x53f458={'where':_0x1c13d4['where']};return db[_0x7451('0x2e')]['count'](_0x53f458)['then'](function(_0x381d80){_0x5226b1['count']=_0x381d80;if(_0xc0e5b2[_0x7451('0x33')][_0x7451('0x42')]){_0x1c13d4['include']=[{'all':!![]}];}return db[_0x7451('0x2e')][_0x7451('0x43')](_0x1c13d4);})[_0x7451('0x27')](function(_0x4a60bb){_0x5226b1[_0x7451('0x44')]=_0x4a60bb;return _0x5226b1;})[_0x7451('0x27')](respondWithFilteredResult(_0x2bd67f,_0x1c13d4))[_0x7451('0x45')](handleError(_0x2bd67f,null));};exports[_0x7451('0x46')]=function(_0x48ce43,_0x5f41f5){var _0x103bfc={'raw':!![],'where':{'id':_0x48ce43['params']['id']}},_0x19a57e={};_0x19a57e[_0x7451('0x32')]=_[_0x7451('0x34')](db['FaxApplication']['rawAttributes']);_0x19a57e[_0x7451('0x33')]=_[_0x7451('0x34')](_0x48ce43[_0x7451('0x33')]);_0x19a57e[_0x7451('0x35')]=_[_0x7451('0x36')](_0x19a57e[_0x7451('0x32')],_0x19a57e[_0x7451('0x33')]);_0x103bfc['attributes']=_[_0x7451('0x36')](_0x19a57e[_0x7451('0x32')],qs['fields'](_0x48ce43[_0x7451('0x33')][_0x7451('0x37')]));_0x103bfc[_0x7451('0x39')]=_0x103bfc['attributes'][_0x7451('0x38')]?_0x103bfc[_0x7451('0x39')]:_0x19a57e['model'];if(_0x48ce43[_0x7451('0x33')][_0x7451('0x42')]){_0x103bfc[_0x7451('0x47')]=[{'all':!![]}];}_0x103bfc=_['merge']({},_0x103bfc,_0x48ce43[_0x7451('0x41')]);return db['FaxApplication'][_0x7451('0x48')](_0x103bfc)[_0x7451('0x27')](handleEntityNotFound(_0x5f41f5,null))[_0x7451('0x27')](respondWithResult(_0x5f41f5,null))[_0x7451('0x45')](handleError(_0x5f41f5,null));};exports[_0x7451('0x49')]=function(_0x3007b2,_0x5e1858){return db[_0x7451('0x2e')][_0x7451('0x49')](_0x3007b2[_0x7451('0x4a')],{})['then'](respondWithResult(_0x5e1858,0xc9))[_0x7451('0x45')](handleError(_0x5e1858,null));};exports[_0x7451('0x26')]=function(_0x344b2b,_0x2507c0){if(_0x344b2b[_0x7451('0x4a')]['id']){delete _0x344b2b[_0x7451('0x4a')]['id'];}return db[_0x7451('0x2e')][_0x7451('0x48')]({'where':{'id':_0x344b2b[_0x7451('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2507c0,null))[_0x7451('0x27')](saveUpdates(_0x344b2b['body'],null))[_0x7451('0x27')](respondWithResult(_0x2507c0,null))[_0x7451('0x45')](handleError(_0x2507c0,null));};exports[_0x7451('0x4c')]=function(_0x487419,_0x2b7b1b){return db[_0x7451('0x2e')][_0x7451('0x48')]({'where':{'id':_0x487419[_0x7451('0x4b')]['id']}})[_0x7451('0x27')](handleEntityNotFound(_0x2b7b1b,null))[_0x7451('0x27')](removeEntity(_0x2b7b1b,null))[_0x7451('0x45')](handleError(_0x2b7b1b,null));}; \ No newline at end of file +var _0x679d=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','rows','catch','show','intersection','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x375384,_0x1b2ea9){var _0x527cd6=function(_0x223999){while(--_0x223999){_0x375384['push'](_0x375384['shift']());}};_0x527cd6(++_0x1b2ea9);}(_0x679d,0x13e));var _0xd679=function(_0x29b1e0,_0x3dc36b){_0x29b1e0=_0x29b1e0-0x0;var _0x3453ff=_0x679d[_0x29b1e0];return _0x3453ff;};'use strict';var emlformat=require(_0xd679('0x0'));var rimraf=require(_0xd679('0x1'));var zipdir=require(_0xd679('0x2'));var jsonpatch=require(_0xd679('0x3'));var rp=require('request-promise');var moment=require(_0xd679('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd679('0x5'));var util=require('util');var path=require(_0xd679('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd679('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd679('0x8'));var squel=require(_0xd679('0x9'));var crypto=require('crypto');var jsforce=require(_0xd679('0xa'));var deskjs=require(_0xd679('0xb'));var toCsv=require(_0xd679('0xc'));var querystring=require(_0xd679('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd679('0xe'));var qs=require(_0xd679('0xf'));var as=require(_0xd679('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd679('0x11'));var utils=require(_0xd679('0x12'));var config=require(_0xd679('0x13'));var licenseUtil=require(_0xd679('0x14'));var db=require(_0xd679('0x15'))['db'];function respondWithStatusCode(_0x2cccb8,_0x9ed79b){_0x9ed79b=_0x9ed79b||0xcc;return function(_0x28c4b2){if(_0x28c4b2){return _0x2cccb8['sendStatus'](_0x9ed79b);}return _0x2cccb8[_0xd679('0x16')](_0x9ed79b)[_0xd679('0x17')]();};}function respondWithResult(_0xd549f2,_0xb35032){_0xb35032=_0xb35032||0xc8;return function(_0x1d1227){if(_0x1d1227){return _0xd549f2['status'](_0xb35032)[_0xd679('0x18')](_0x1d1227);}};}function respondWithFilteredResult(_0x38cc74,_0x422392){return function(_0x35b241){if(_0x35b241){var _0x5a4f9b=typeof _0x422392[_0xd679('0x19')]==='undefined'&&typeof _0x422392[_0xd679('0x1a')]===_0xd679('0x1b');var _0x184ffc=_0x35b241[_0xd679('0x1c')];var _0x547056=_0x5a4f9b?0x0:_0x422392[_0xd679('0x19')];var _0x1cb788=_0x5a4f9b?_0x35b241['count']:_0x422392['offset']+_0x422392[_0xd679('0x1a')];var _0x4efc21;if(_0x1cb788>=_0x184ffc){_0x1cb788=_0x184ffc;_0x4efc21=0xc8;}else{_0x4efc21=0xce;}_0x38cc74[_0xd679('0x16')](_0x4efc21);return _0x38cc74[_0xd679('0x1d')]('Content-Range',_0x547056+'-'+_0x1cb788+'/'+_0x184ffc)[_0xd679('0x18')](_0x35b241);}return null;};}function patchUpdates(_0x38d2d6){return function(_0xbf0b72){try{jsonpatch[_0xd679('0x1e')](_0xbf0b72,_0x38d2d6,!![]);}catch(_0x525f95){return BPromise['reject'](_0x525f95);}return _0xbf0b72[_0xd679('0x1f')]();};}function saveUpdates(_0x27be91,_0xa0dc52){return function(_0x6765b1){if(_0x6765b1){return _0x6765b1[_0xd679('0x20')](_0x27be91)['then'](function(_0x1e8316){return _0x1e8316;});}return null;};}function removeEntity(_0x51ed08,_0x2fbf5d){return function(_0x14a839){if(_0x14a839){return _0x14a839[_0xd679('0x21')]()['then'](function(){_0x51ed08[_0xd679('0x16')](0xcc)[_0xd679('0x17')]();});}};}function handleEntityNotFound(_0x56691c,_0x5d3ece){return function(_0x2f427b){if(!_0x2f427b){_0x56691c[_0xd679('0x22')](0x194);}return _0x2f427b;};}function handleError(_0x3849ff,_0x12b3e0){_0x12b3e0=_0x12b3e0||0x1f4;return function(_0xc6848f){logger[_0xd679('0x23')](_0xc6848f[_0xd679('0x24')]);if(_0xc6848f['name']){delete _0xc6848f[_0xd679('0x25')];}_0x3849ff[_0xd679('0x16')](_0x12b3e0)[_0xd679('0x26')](_0xc6848f);};}exports[_0xd679('0x27')]=function(_0x1f8384,_0x3fa696){var _0x12e8e4={},_0x4632fc={},_0x4975bf={'count':0x0,'rows':[]};var _0x5b0648=_[_0xd679('0x28')](db[_0xd679('0x29')][_0xd679('0x2a')],function(_0x465399){return{'name':_0x465399[_0xd679('0x2b')],'type':_0x465399[_0xd679('0x2c')][_0xd679('0x2d')]};});_0x4632fc[_0xd679('0x2e')]=_['map'](_0x5b0648,'name');_0x4632fc[_0xd679('0x2f')]=_[_0xd679('0x30')](_0x1f8384[_0xd679('0x2f')]);_0x4632fc[_0xd679('0x31')]=_['intersection'](_0x4632fc[_0xd679('0x2e')],_0x4632fc[_0xd679('0x2f')]);_0x12e8e4[_0xd679('0x32')]=_['intersection'](_0x4632fc[_0xd679('0x2e')],qs[_0xd679('0x33')](_0x1f8384[_0xd679('0x2f')][_0xd679('0x33')]));_0x12e8e4[_0xd679('0x32')]=_0x12e8e4[_0xd679('0x32')][_0xd679('0x34')]?_0x12e8e4[_0xd679('0x32')]:_0x4632fc[_0xd679('0x2e')];if(!_0x1f8384[_0xd679('0x2f')][_0xd679('0x35')](_0xd679('0x36'))){_0x12e8e4[_0xd679('0x1a')]=qs[_0xd679('0x1a')](_0x1f8384[_0xd679('0x2f')][_0xd679('0x1a')]);_0x12e8e4[_0xd679('0x19')]=qs[_0xd679('0x19')](_0x1f8384[_0xd679('0x2f')][_0xd679('0x19')]);}_0x12e8e4[_0xd679('0x37')]=qs[_0xd679('0x38')](_0x1f8384[_0xd679('0x2f')][_0xd679('0x38')]);_0x12e8e4[_0xd679('0x39')]=qs[_0xd679('0x31')](_[_0xd679('0x3a')](_0x1f8384['query'],_0x4632fc['filters']),_0x5b0648);if(_0x1f8384[_0xd679('0x2f')][_0xd679('0x3b')]){_0x12e8e4[_0xd679('0x39')]=_[_0xd679('0x3c')](_0x12e8e4[_0xd679('0x39')],{'$or':_[_0xd679('0x28')](_0x5b0648,function(_0x187b69){if(_0x187b69['type']!==_0xd679('0x3d')){var _0x564dca={};_0x564dca[_0x187b69[_0xd679('0x25')]]={'$like':'%'+_0x1f8384[_0xd679('0x2f')][_0xd679('0x3b')]+'%'};return _0x564dca;}})});}_0x12e8e4=_[_0xd679('0x3c')]({},_0x12e8e4,_0x1f8384[_0xd679('0x3e')]);var _0x52de20={'where':_0x12e8e4[_0xd679('0x39')]};return db['FaxApplication'][_0xd679('0x1c')](_0x52de20)[_0xd679('0x3f')](function(_0x11fdee){_0x4975bf[_0xd679('0x1c')]=_0x11fdee;if(_0x1f8384[_0xd679('0x2f')]['includeAll']){_0x12e8e4[_0xd679('0x40')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x12e8e4);})['then'](function(_0x48e620){_0x4975bf[_0xd679('0x41')]=_0x48e620;return _0x4975bf;})['then'](respondWithFilteredResult(_0x3fa696,_0x12e8e4))[_0xd679('0x42')](handleError(_0x3fa696,null));};exports[_0xd679('0x43')]=function(_0x3649bb,_0x140cad){var _0x158d99={'raw':!![],'where':{'id':_0x3649bb['params']['id']}},_0x3176fa={};_0x3176fa['model']=_['keys'](db[_0xd679('0x29')]['rawAttributes']);_0x3176fa[_0xd679('0x2f')]=_[_0xd679('0x30')](_0x3649bb[_0xd679('0x2f')]);_0x3176fa[_0xd679('0x31')]=_[_0xd679('0x44')](_0x3176fa[_0xd679('0x2e')],_0x3176fa[_0xd679('0x2f')]);_0x158d99[_0xd679('0x32')]=_[_0xd679('0x44')](_0x3176fa[_0xd679('0x2e')],qs[_0xd679('0x33')](_0x3649bb[_0xd679('0x2f')][_0xd679('0x33')]));_0x158d99[_0xd679('0x32')]=_0x158d99[_0xd679('0x32')]['length']?_0x158d99[_0xd679('0x32')]:_0x3176fa['model'];if(_0x3649bb['query'][_0xd679('0x45')]){_0x158d99[_0xd679('0x40')]=[{'all':!![]}];}_0x158d99=_[_0xd679('0x3c')]({},_0x158d99,_0x3649bb[_0xd679('0x3e')]);return db['FaxApplication'][_0xd679('0x46')](_0x158d99)[_0xd679('0x3f')](handleEntityNotFound(_0x140cad,null))[_0xd679('0x3f')](respondWithResult(_0x140cad,null))[_0xd679('0x42')](handleError(_0x140cad,null));};exports[_0xd679('0x47')]=function(_0x2c967f,_0x551546){return db['FaxApplication'][_0xd679('0x47')](_0x2c967f[_0xd679('0x48')],{})[_0xd679('0x3f')](respondWithResult(_0x551546,0xc9))[_0xd679('0x42')](handleError(_0x551546,null));};exports[_0xd679('0x20')]=function(_0x3f4f1d,_0x242004){if(_0x3f4f1d[_0xd679('0x48')]['id']){delete _0x3f4f1d[_0xd679('0x48')]['id'];}return db[_0xd679('0x29')]['find']({'where':{'id':_0x3f4f1d['params']['id']}})[_0xd679('0x3f')](handleEntityNotFound(_0x242004,null))['then'](saveUpdates(_0x3f4f1d[_0xd679('0x48')],null))['then'](respondWithResult(_0x242004,null))[_0xd679('0x42')](handleError(_0x242004,null));};exports[_0xd679('0x21')]=function(_0x49e9bd,_0x2db397){return db[_0xd679('0x29')][_0xd679('0x46')]({'where':{'id':_0x49e9bd[_0xd679('0x49')]['id']}})[_0xd679('0x3f')](handleEntityNotFound(_0x2db397,null))[_0xd679('0x3f')](removeEntity(_0x2db397,null))['catch'](handleError(_0x2db397,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 111c76c..8f5793c 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 _0xa15c=['FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0xa15c,0x92));var _0xca15=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa15c[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xca15('0x0'));var util=require('util');var logger=require(_0xca15('0x1'))(_0xca15('0x2'));var moment=require(_0xca15('0x3'));var BPromise=require(_0xca15('0x4'));var rp=require(_0xca15('0x5'));var fs=require('fs');var path=require(_0xca15('0x6'));var rimraf=require('rimraf');var config=require(_0xca15('0x7'));var attributes=require(_0xca15('0x8'));module['exports']=function(_0x374fd2,_0x46751c){return _0x374fd2[_0xca15('0x9')](_0xca15('0xa'),attributes,{'tableName':_0xca15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca15('0xc')});}; \ No newline at end of file +var _0x90fc=['util','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','lodash'];(function(_0xb46c3d,_0x5bf083){var _0x249a61=function(_0x18e500){while(--_0x18e500){_0xb46c3d['push'](_0xb46c3d['shift']());}};_0x249a61(++_0x5bf083);}(_0x90fc,0x74));var _0xc90f=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x90fc[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xc90f('0x0'));var util=require(_0xc90f('0x1'));var logger=require('../../config/logger')(_0xc90f('0x2'));var moment=require(_0xc90f('0x3'));var BPromise=require(_0xc90f('0x4'));var rp=require(_0xc90f('0x5'));var fs=require('fs');var path=require(_0xc90f('0x6'));var rimraf=require(_0xc90f('0x7'));var config=require('../../config/environment');var attributes=require(_0xc90f('0x8'));module[_0xc90f('0x9')]=function(_0x54264b,_0x40b1b8){return _0x54264b['define'](_0xc90f('0xa'),attributes,{'tableName':_0xc90f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc90f('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f1c5f59..4f87925 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 _0x711b=['client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x591fa7,_0x25ff93){var _0xe44234=function(_0x29ce19){while(--_0x29ce19){_0x591fa7['push'](_0x591fa7['shift']());}};_0xe44234(++_0x25ff93);}(_0x711b,0x13e));var _0xb711=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x711b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb711('0x0'));var util=require(_0xb711('0x1'));var moment=require(_0xb711('0x2'));var BPromise=require(_0xb711('0x3'));var rs=require(_0xb711('0x4'));var fs=require('fs');var Redis=require(_0xb711('0x5'));var db=require(_0xb711('0x6'))['db'];var utils=require(_0xb711('0x7'));var logger=require(_0xb711('0x8'))(_0xb711('0x9'));var config=require(_0xb711('0xa'));var jayson=require(_0xb711('0xb'));var client=jayson[_0xb711('0xc')][_0xb711('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42c643,_0x10b9c6,_0x96e83d){return new BPromise(function(_0x325db4,_0x1c2743){return client[_0xb711('0xe')](_0x42c643,_0x96e83d)[_0xb711('0xf')](function(_0x5bda6e){logger[_0xb711('0x10')](_0xb711('0x11'),_0x10b9c6,'request\x20sent');logger[_0xb711('0x12')](_0xb711('0x13'),_0x10b9c6,'request\x20sent',JSON[_0xb711('0x14')](_0x5bda6e));if(_0x5bda6e[_0xb711('0x15')]){if(_0x5bda6e[_0xb711('0x15')][_0xb711('0x16')]===0x1f4){logger['error'](_0xb711('0x11'),_0x10b9c6,_0x5bda6e[_0xb711('0x15')]['message']);return _0x1c2743(_0x5bda6e[_0xb711('0x15')][_0xb711('0x17')]);}logger[_0xb711('0x15')](_0xb711('0x11'),_0x10b9c6,_0x5bda6e[_0xb711('0x15')]['message']);return _0x325db4(_0x5bda6e[_0xb711('0x15')]['message']);}else{logger[_0xb711('0x10')]('FaxApplication,\x20%s,\x20%s',_0x10b9c6,'request\x20sent');_0x325db4(_0x5bda6e['result'][_0xb711('0x17')]);}})[_0xb711('0x18')](function(_0x4d8c69){logger[_0xb711('0x15')](_0xb711('0x11'),_0x10b9c6,_0x4d8c69);_0x1c2743(_0x4d8c69);});});}exports['UpdateFaxApplication']=function(_0x522904){var _0x5dd815=this;return new Promise(function(_0x362723,_0x29a027){return db[_0xb711('0x19')]['update'](_0x522904[_0xb711('0x1a')],{'raw':_0x522904[_0xb711('0x1b')]?_0x522904[_0xb711('0x1b')][_0xb711('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522904[_0xb711('0x1b')]?_0x522904['options'][_0xb711('0x1d')]||null:null,'attributes':_0x522904[_0xb711('0x1b')]?_0x522904[_0xb711('0x1b')][_0xb711('0x1e')]||null:null,'limit':_0x522904[_0xb711('0x1b')]?_0x522904['options'][_0xb711('0x1f')]||null:null})[_0xb711('0xf')](function(_0x41bcc3){logger['info'](_0xb711('0x20'),_0x522904);logger[_0xb711('0x12')](_0xb711('0x20'),_0x522904,JSON[_0xb711('0x14')](_0x41bcc3));_0x362723(_0x41bcc3);})['catch'](function(_0x576ebb){logger['error'](_0xb711('0x20'),_0x576ebb[_0xb711('0x17')],_0x522904);_0x29a027(_0x5dd815[_0xb711('0x15')](0x1f4,_0x576ebb[_0xb711('0x17')]));});});}; \ No newline at end of file +var _0xa79c=['result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','info','util','bluebird','../../mysqldb','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x311aae,_0x13497e){var _0x153b75=function(_0x3c8751){while(--_0x3c8751){_0x311aae['push'](_0x311aae['shift']());}};_0x153b75(++_0x13497e);}(_0xa79c,0x11e));var _0xca79=function(_0x139a49,_0x4507a0){_0x139a49=_0x139a49-0x0;var _0x410258=_0xa79c[_0x139a49];return _0x410258;};'use strict';var _=require('lodash');var util=require(_0xca79('0x0'));var moment=require('moment');var BPromise=require(_0xca79('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca79('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xca79('0x3')][_0xca79('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x16be7e,_0x406310,_0x909dc9){return new BPromise(function(_0x3cfed9,_0x3a1efd){return client['request'](_0x16be7e,_0x909dc9)[_0xca79('0x5')](function(_0x1a6ddd){logger['info'](_0xca79('0x6'),_0x406310,_0xca79('0x7'));logger['debug'](_0xca79('0x8'),_0x406310,'request\x20sent',JSON[_0xca79('0x9')](_0x1a6ddd));if(_0x1a6ddd['error']){if(_0x1a6ddd[_0xca79('0xa')][_0xca79('0xb')]===0x1f4){logger[_0xca79('0xa')](_0xca79('0x6'),_0x406310,_0x1a6ddd[_0xca79('0xa')][_0xca79('0xc')]);return _0x3a1efd(_0x1a6ddd[_0xca79('0xa')][_0xca79('0xc')]);}logger[_0xca79('0xa')](_0xca79('0x6'),_0x406310,_0x1a6ddd[_0xca79('0xa')]['message']);return _0x3cfed9(_0x1a6ddd['error']['message']);}else{logger['info'](_0xca79('0x6'),_0x406310,'request\x20sent');_0x3cfed9(_0x1a6ddd[_0xca79('0xd')]['message']);}})[_0xca79('0xe')](function(_0x9ccd05){logger[_0xca79('0xa')](_0xca79('0x6'),_0x406310,_0x9ccd05);_0x3a1efd(_0x9ccd05);});});}exports[_0xca79('0xf')]=function(_0x5e348a){var _0x52e1bb=this;return new Promise(function(_0x489b47,_0x59b5aa){return db[_0xca79('0x10')][_0xca79('0x11')](_0x5e348a[_0xca79('0x12')],{'raw':_0x5e348a[_0xca79('0x13')]?_0x5e348a[_0xca79('0x13')][_0xca79('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e348a[_0xca79('0x13')]?_0x5e348a[_0xca79('0x13')][_0xca79('0x15')]||null:null,'attributes':_0x5e348a[_0xca79('0x13')]?_0x5e348a[_0xca79('0x13')]['attributes']||null:null,'limit':_0x5e348a[_0xca79('0x13')]?_0x5e348a['options']['limit']||null:null})[_0xca79('0x5')](function(_0x7117f2){logger[_0xca79('0x16')]('UpdateFaxApplication',_0x5e348a);logger['debug'](_0xca79('0xf'),_0x5e348a,JSON['stringify'](_0x7117f2));_0x489b47(_0x7117f2);})['catch'](function(_0x4321e2){logger[_0xca79('0xa')](_0xca79('0xf'),_0x4321e2['message'],_0x5e348a);_0x59b5aa(_0x52e1bb[_0xca79('0xa')](0x1f4,_0x4321e2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1f4f6a5..63b6d4f 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 _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x2ba123,_0x23e0a8){var _0x4ac854=function(_0x59999e){while(--_0x59999e){_0x2ba123['push'](_0x2ba123['shift']());}};_0x4ac854(++_0x23e0a8);}(_0x9354,0x96));var _0x4935=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x9354[_0x2a5b3b];return _0xae665a;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2235891..5b028bc 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 _0x56d3=['STRING','out','ENUM','exports','DATE'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x56d3,0x134));var _0x356d=function(_0x512bdc,_0x2fcdcb){_0x512bdc=_0x512bdc-0x0;var _0x51a7f0=_0x56d3[_0x512bdc];return _0x51a7f0;};'use strict';var Sequelize=require('sequelize');module[_0x356d('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x356d('0x1')]},'disposition':{'type':Sequelize[_0x356d('0x2')]},'secondDisposition':{'type':Sequelize[_0x356d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x356d('0x2')]},'note':{'type':Sequelize[_0x356d('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x356d('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x356d('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x356d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2fad=['sequelize','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x4c6d6d,_0x285648){var _0x3e6bbc=function(_0x359de6){while(--_0x359de6){_0x4c6d6d['push'](_0x4c6d6d['shift']());}};_0x3e6bbc(++_0x285648);}(_0x2fad,0x1da));var _0xd2fa=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x2fad[_0x4c7d8b];return _0x187158;};'use strict';var Sequelize=require(_0xd2fa('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd2fa('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd2fa('0x2')]},'secondDisposition':{'type':Sequelize[_0xd2fa('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd2fa('0x2')]},'note':{'type':Sequelize[_0xd2fa('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd2fa('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd2fa('0x3')]('in',_0xd2fa('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd2fa('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xd2fa('0x3')]('in',_0xd2fa('0x4')),'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 5ae8e31..ae0f0af 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 _0x6ae3=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','FaxInteraction','rawAttributes','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','keys','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','show','params','includeAll','include','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','files','join','server','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','ejs','fs-extra','squel','crypto','jsforce','to-csv'];(function(_0x239b8f,_0x520346){var _0x19b381=function(_0x1e5a5a){while(--_0x1e5a5a){_0x239b8f['push'](_0x239b8f['shift']());}};_0x19b381(++_0x520346);}(_0x6ae3,0x19e));var _0x36ae=function(_0x619d61,_0x289e0b){_0x619d61=_0x619d61-0x0;var _0x1984c6=_0x6ae3[_0x619d61];return _0x1984c6;};'use strict';var emlformat=require(_0x36ae('0x0'));var rimraf=require(_0x36ae('0x1'));var zipdir=require(_0x36ae('0x2'));var jsonpatch=require(_0x36ae('0x3'));var rp=require(_0x36ae('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36ae('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36ae('0x6'));var fs=require('fs');var fs_extra=require(_0x36ae('0x7'));var _=require('lodash');var squel=require(_0x36ae('0x8'));var crypto=require(_0x36ae('0x9'));var jsforce=require(_0x36ae('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x36ae('0xb'));var querystring=require(_0x36ae('0xc'));var Papa=require(_0x36ae('0xd'));var Redis=require(_0x36ae('0xe'));var authService=require(_0x36ae('0xf'));var qs=require(_0x36ae('0x10'));var as=require(_0x36ae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36ae('0x12'));var utils=require(_0x36ae('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x36ae('0x14'))['db'];config[_0x36ae('0x15')]=_[_0x36ae('0x16')](config[_0x36ae('0x15')],{'host':_0x36ae('0x17'),'port':0x18eb});var socket=require(_0x36ae('0x18'))(new Redis(config[_0x36ae('0x15')]));require(_0x36ae('0x19'))['register'](socket);function respondWithStatusCode(_0x20b2a5,_0x33a837){_0x33a837=_0x33a837||0xcc;return function(_0x44cb4f){if(_0x44cb4f){return _0x20b2a5[_0x36ae('0x1a')](_0x33a837);}return _0x20b2a5[_0x36ae('0x1b')](_0x33a837)[_0x36ae('0x1c')]();};}function respondWithResult(_0x2b683b,_0x211434){_0x211434=_0x211434||0xc8;return function(_0x5d9ea7){if(_0x5d9ea7){return _0x2b683b[_0x36ae('0x1b')](_0x211434)[_0x36ae('0x1d')](_0x5d9ea7);}};}function respondWithFilteredResult(_0x5b7442,_0x871273){return function(_0x5d248a){if(_0x5d248a){var _0x143aaa=typeof _0x871273[_0x36ae('0x1e')]===_0x36ae('0x1f')&&typeof _0x871273[_0x36ae('0x20')]==='undefined';var _0x45d3dd=_0x5d248a[_0x36ae('0x21')];var _0x8b9c0d=_0x143aaa?0x0:_0x871273[_0x36ae('0x1e')];var _0x4b02df=_0x143aaa?_0x5d248a['count']:_0x871273[_0x36ae('0x1e')]+_0x871273[_0x36ae('0x20')];var _0x32ba7b;if(_0x4b02df>=_0x45d3dd){_0x4b02df=_0x45d3dd;_0x32ba7b=0xc8;}else{_0x32ba7b=0xce;}_0x5b7442[_0x36ae('0x1b')](_0x32ba7b);return _0x5b7442[_0x36ae('0x22')]('Content-Range',_0x8b9c0d+'-'+_0x4b02df+'/'+_0x45d3dd)[_0x36ae('0x1d')](_0x5d248a);}return null;};}function patchUpdates(_0x4b1f0a){return function(_0x2780e7){try{jsonpatch['apply'](_0x2780e7,_0x4b1f0a,!![]);}catch(_0x42bce6){return BPromise[_0x36ae('0x23')](_0x42bce6);}return _0x2780e7[_0x36ae('0x24')]();};}function saveUpdates(_0x56b83e,_0x2c97f3){return function(_0x1ae427){if(_0x1ae427){return _0x1ae427[_0x36ae('0x25')](_0x56b83e)[_0x36ae('0x26')](function(_0x5e46f4){return _0x5e46f4;});}return null;};}function removeEntity(_0x3524cd,_0x123063){return function(_0xda6693){if(_0xda6693){return _0xda6693[_0x36ae('0x27')]()['then'](function(){_0x3524cd[_0x36ae('0x1b')](0xcc)[_0x36ae('0x1c')]();});}};}function handleEntityNotFound(_0x1cc045,_0x52d959){return function(_0x4aff65){if(!_0x4aff65){_0x1cc045[_0x36ae('0x1a')](0x194);}return _0x4aff65;};}function handleError(_0x588c7b,_0x518eac){_0x518eac=_0x518eac||0x1f4;return function(_0x5ed74e){logger[_0x36ae('0x28')](_0x5ed74e[_0x36ae('0x29')]);if(_0x5ed74e[_0x36ae('0x2a')]){delete _0x5ed74e[_0x36ae('0x2a')];}_0x588c7b['status'](_0x518eac)['send'](_0x5ed74e);};}function getInteractionUsers(_0x3cfa6b,_0x4d91c1){return new BPromise(function(_0x544573,_0xddf2b2){try{if(_0x4d91c1[_0x3cfa6b['id']]){_0x3cfa6b[_0x36ae('0x2b')]=_[_0x36ae('0x2c')](_0x4d91c1[_0x3cfa6b['id']],function(_0x190df8){return{'id':_0x190df8['id'],'fullname':_0x190df8['fullname']};});}}catch(_0x5056e7){_0xddf2b2(_0x5056e7);}_0x544573(_0x3cfa6b);});}function getInteractionTags(_0x42432d,_0x49f135){return new BPromise(function(_0x5c87e1,_0x3b3ee5){try{if(_0x42432d[_0x36ae('0x2d')]){_0x42432d[_0x36ae('0x2e')]=[];_0x42432d[_0x36ae('0x2d')][_0x36ae('0x2f')](',')[_0x36ae('0x30')](function(_0x176e55){_0x42432d[_0x36ae('0x2e')][_0x36ae('0x31')](_0x49f135[_0x176e55]);});}delete _0x42432d['TagIds'];}catch(_0x47ab5b){_0x3b3ee5(_0x47ab5b);}_0x5c87e1(_0x42432d);});}function updateFaxInteraction(_0x40a6a5,_0x46974b,_0x3709a8){return new BPromise(function(_0x5d7557,_0x2530dd){return getInteractionUsers(_0x40a6a5,_0x3709a8)['then'](function(_0x202ddf){return getInteractionTags(_0x202ddf,_0x46974b);})['then'](function(_0x46c1b5){return getStateInteraction(_0x46c1b5);})[_0x36ae('0x26')](function(_0x27c921){_0x5d7557(_0x27c921);})['catch'](function(_0x34d8fa){_0x2530dd(_0x34d8fa);});});}function getStateInteraction(_0x9c8bdf){return new BPromise(function(_0x31fd87){_0x9c8bdf[_0x36ae('0x32')]=0x0;_0x9c8bdf[_0x36ae('0x33')]=0x0;_0x9c8bdf[_0x36ae('0x34')]=0x0;_0x9c8bdf[_0x36ae('0x35')]=0x0;_0x9c8bdf[_0x36ae('0x36')]=0x0;if(!_0x9c8bdf['closed']&&!_0x9c8bdf['UserId']){_0x9c8bdf['waiting']+=0x1;}if(!_0x9c8bdf[_0x36ae('0x37')]&&_0x9c8bdf[_0x36ae('0x38')]){_0x9c8bdf['talking']+=0x1;if(_0x9c8bdf[_0x36ae('0x32')]){_0x9c8bdf['waiting']-=0x1;}}if(_0x9c8bdf['closed']&&_0x9c8bdf[_0x36ae('0x38')]){_0x9c8bdf[_0x36ae('0x34')]+=0x1;if(_0x9c8bdf[_0x36ae('0x33')]){_0x9c8bdf['talking']-=0x1;}}if(_0x9c8bdf['closed']&&!_0x9c8bdf[_0x36ae('0x38')]){_0x9c8bdf[_0x36ae('0x35')]+=0x1;if(_0x9c8bdf[_0x36ae('0x32')]){_0x9c8bdf[_0x36ae('0x32')]-=0x1;}}_0x9c8bdf[_0x36ae('0x36')]+=0x1;_0x31fd87(_0x9c8bdf);});}exports['index']=function(_0x485cfe,_0x45ce69){var _0x410cbd={},_0x30bf55={},_0x1b712c={'count':0x0,'rows':[]};var _0x1140f2=_[_0x36ae('0x2c')](db[_0x36ae('0x39')][_0x36ae('0x3a')],function(_0x2cc637){return{'name':_0x2cc637['fieldName'],'type':_0x2cc637['type'][_0x36ae('0x3b')]};});_0x30bf55['model']=_[_0x36ae('0x2c')](_0x1140f2,_0x36ae('0x2a'));_0x30bf55['query']=_['keys'](_0x485cfe[_0x36ae('0x3c')]);_0x30bf55[_0x36ae('0x3d')]=_['intersection'](_0x30bf55[_0x36ae('0x3e')],_0x30bf55[_0x36ae('0x3c')]);_0x410cbd['attributes']=_[_0x36ae('0x3f')](_0x30bf55['model'],qs['fields'](_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x40')]));_0x410cbd[_0x36ae('0x41')]=_0x410cbd[_0x36ae('0x41')][_0x36ae('0x42')]?_0x410cbd['attributes']:_0x30bf55[_0x36ae('0x3e')];if(!_0x485cfe['query']['hasOwnProperty'](_0x36ae('0x43'))){_0x410cbd[_0x36ae('0x20')]=qs['limit'](_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x20')]);_0x410cbd[_0x36ae('0x1e')]=qs[_0x36ae('0x1e')](_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x1e')]);}_0x410cbd[_0x36ae('0x44')]=qs[_0x36ae('0x45')](_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x45')]);_0x410cbd[_0x36ae('0x46')]=qs[_0x36ae('0x3d')](_[_0x36ae('0x47')](_0x485cfe['query'],_0x30bf55[_0x36ae('0x3d')]),_0x1140f2);var _0x23a09e=[];var _0x439b58=squel['select']()[_0x36ae('0x48')]('id')[_0x36ae('0x48')](_0x36ae('0x2a'))['field'](_0x36ae('0x49'))[_0x36ae('0x4a')](_0x36ae('0x4b'));var _0x52390a=squel[_0x36ae('0x4c')]()[_0x36ae('0x48')](_0x36ae('0x4d'))['field'](_0x36ae('0x4e'))['field'](_0x36ae('0x4f'))['from'](_0x36ae('0x50'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x58f54d=squel[_0x36ae('0x4c')]()[_0x36ae('0x4a')](_0x36ae('0x51'),'i')[_0x36ae('0x52')](_0x36ae('0x53'),'c',_0x36ae('0x54'))[_0x36ae('0x52')]('users','o',_0x36ae('0x55'))['left_join']('fax_accounts','a',_0x36ae('0x56'))['left_join'](_0x36ae('0x57'),'me',_0x36ae('0x58'))['left_join'](_0x36ae('0x59'),'it',_0x36ae('0x5a'))[_0x36ae('0x52')](_0x36ae('0x4b'),'t',_0x36ae('0x5b'));var _0x393206=squel['expr']();var _0x28ec2c=[];var _0x2d1ff8=squel['expr']();var _0x3faa5d;if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x5c')]){_0x3faa5d=as[_0x36ae('0x5d')](_0x485cfe['query'][_0x36ae('0x5c')]);var _0x3f3655=_0x3faa5d['sqlOperator'];for(var _0x46d075=0x0;_0x46d075<_0x3faa5d[_0x36ae('0x5e')][_0x36ae('0x42')];_0x46d075++){var _0x5183d3=_0x3faa5d[_0x36ae('0x5e')][_0x46d075];var _0x53e0b1='i';var _0x510e61=_['find'](_0x1140f2,['name',_0x5183d3[_0x36ae('0x48')]]);if(!_0x510e61){switch(_0x5183d3['field']){case _0x36ae('0x5f'):if(_0x5183d3[_0x36ae('0x60')]==0x1){_0x58f54d[_0x36ae('0x61')]('`'+_0x5183d3[_0x36ae('0x48')]+'`\x20=\x200');}else{_0x58f54d['having']('`'+_0x5183d3['field']+_0x36ae('0x62'));}break;case _0x36ae('0x63'):if(_0x5183d3[_0x36ae('0x64')]===_0x36ae('0x65')){if(_0x5183d3[_0x36ae('0x60')][_0x36ae('0x2f')]('\x20')[_0x36ae('0x42')]>0x1){_0x393206[_0x3f3655](_0x36ae('0x66'),qs['getFullTextValue'](_0x5183d3['value']),null);}else{var _0x36a492='%'+_0x5183d3[_0x36ae('0x60')]+'%';_0x393206[_0x3f3655](_0x36ae('0x67'),_0x36a492,_0x36a492,_0x36a492);}}else{_0x510e61=_[_0x36ae('0x68')](_0x1140f2,[_0x36ae('0x2a'),_0x36ae('0x69')]);_0x5183d3['field']=_0x36ae('0x69');_0x9e081a=as['buildExpression'](_0x53e0b1,_0x510e61[_0x36ae('0x6a')],_0x5183d3);_0x393206[_0x3f3655](_0x9e081a[_0x36ae('0x6b')],_0x9e081a['value']['start'],_0x9e081a[_0x36ae('0x60')][_0x36ae('0x1c')]);}break;case _0x36ae('0x6c'):var _0x1ecd8e=_0x5183d3[_0x36ae('0x60')][_0x36ae('0x2f')](',')[_0x36ae('0x2c')](function(_0x548f2c){return Number(_0x548f2c);});_0x1ecd8e[_0x36ae('0x30')](function(_0x141b80){_0x2d1ff8['or'](_0x36ae('0x6d'),'%,'+_0x141b80+',%');});_0x28ec2c=_[_0x36ae('0x6e')](_0x28ec2c,_0x1ecd8e);break;case _0x36ae('0x6f'):if(_0x5183d3[_0x36ae('0x64')]===_0x36ae('0x65')){_0x393206[_0x3f3655](_0x36ae('0x70'),'%'+_0x5183d3['value']+'%',null);}else{_0x510e61=_[_0x36ae('0x68')](_0x1140f2,[_0x36ae('0x2a'),_0x36ae('0x38')]);_0x5183d3[_0x36ae('0x48')]=_0x36ae('0x38');_0x9e081a=as['buildExpression'](_0x53e0b1,_0x510e61[_0x36ae('0x6a')],_0x5183d3);_0x393206[_0x3f3655](_0x9e081a[_0x36ae('0x6b')],_0x9e081a['value'][_0x36ae('0x71')],_0x9e081a[_0x36ae('0x60')][_0x36ae('0x1c')]);}break;case'body':_0x9e081a=as['buildExpression']('me',null,_0x5183d3);_0x393206[_0x3f3655](_0x9e081a[_0x36ae('0x6b')],_0x9e081a[_0x36ae('0x60')][_0x36ae('0x71')],_0x9e081a[_0x36ae('0x60')][_0x36ae('0x1c')]);break;}}else{var _0x9e081a=as['buildExpression'](_0x53e0b1,_0x510e61['type'],_0x5183d3);_0x393206[_0x3f3655](_0x9e081a[_0x36ae('0x6b')],_0x9e081a['value'][_0x36ae('0x71')],_0x9e081a[_0x36ae('0x60')]['end']);}}}else{var _0x29d3fb=_(_0x485cfe[_0x36ae('0x3c')])[_0x36ae('0x72')]()[_0x36ae('0x2c')](function(_0x18e82b){return _[_0x36ae('0x73')](_0x1140f2,[_0x36ae('0x2a'),_0x18e82b])?_0x18e82b:undefined;})['compact']()[_0x36ae('0x60')]();if(!_[_0x36ae('0x74')](_0x29d3fb)){_0x29d3fb[_0x36ae('0x30')](function(_0x140a1a){if(_0x140a1a===_0x36ae('0x75')){_0x58f54d[_0x36ae('0x46')](_0x36ae('0x76'),[]['concat'](_0x485cfe[_0x36ae('0x3c')][_0x140a1a]));}else if(_0x140a1a===_0x36ae('0x77')){var _0x2df8cf=JSON[_0x36ae('0x78')](_0x485cfe[_0x36ae('0x3c')][_0x140a1a])[_0x36ae('0x79')];var _0x339cb6=JSON[_0x36ae('0x78')](_0x485cfe['query'][_0x140a1a])[_0x36ae('0x7a')];_0x58f54d[_0x36ae('0x46')](_0x36ae('0x7b'),_0x2df8cf,_0x339cb6);}else{if(_0x485cfe['query'][_0x140a1a]==='null'){_0x58f54d[_0x36ae('0x46')]('i.'+_0x140a1a+_0x36ae('0x7c'));}else{_0x58f54d['where']('i.'+_0x140a1a+_0x36ae('0x7d'),_0x485cfe[_0x36ae('0x3c')][_0x140a1a]);}}});}if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x7e')]){if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x7e')]==0x1){_0x58f54d[_0x36ae('0x61')](_0x36ae('0x7f'));}else{_0x58f54d['having'](_0x36ae('0x80'));}}if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x81')]){_0x28ec2c=_[_0x36ae('0x82')](_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x81')])?_0x485cfe['query']['tag']:new Array(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x81')]);_0x28ec2c[_0x36ae('0x30')](function(_0x1440e1){_0x2d1ff8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1440e1+',%');});}if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x83')]){var _0xca8335=_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x83')][_0x36ae('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0xca8335)){_0x393206['or'](_0x36ae('0x85'),_0xca8335+'%')['or'](_0x36ae('0x86'),_0xca8335+'%');}_0x393206['or'](_0x36ae('0x87'),_0xca8335+'%');}}_0x58f54d['where'](_0x393206);_0x58f54d['group']('i.id');var _0x5a506b={'type':db[_0x36ae('0x88')][_0x36ae('0x89')][_0x36ae('0x8a')],'raw':!![]};var _0x553fe8=_0x58f54d['clone']();_0x553fe8[_0x36ae('0x48')](_0x36ae('0x8b'));_0x553fe8['field'](_0x36ae('0x8c'),_0x36ae('0x5f'));if(_0x410cbd['order']){_0x410cbd[_0x36ae('0x44')][_0x36ae('0x30')](function(_0x7d4c27){var _0x43b7b4=_0x7d4c27[0x0]===_0x36ae('0x8d')?_0x7d4c27[0x0]:'i.'+_0x7d4c27[0x0];_0x58f54d[_0x36ae('0x44')](_0x43b7b4,_0x7d4c27[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x28ec2c)){_0x58f54d['having'](_0x2d1ff8);_0x553fe8[_0x36ae('0x46')](_0x36ae('0x8e'),_0x28ec2c);}BPromise['resolve']()[_0x36ae('0x26')](function(){if(!_0x3faa5d){if(_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x75')])return;_0x553fe8[_0x36ae('0x46')](_0x36ae('0x8f'));_0x58f54d[_0x36ae('0x46')](_0x36ae('0x8f'));return;}if(_0x485cfe['user']['role']!==_0x36ae('0x90'))return;return _0x485cfe['user'][_0x36ae('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c2ae8){if(_[_0x36ae('0x74')](_0x2c2ae8)){_0x553fe8[_0x36ae('0x46')](_0x36ae('0x92'));_0x58f54d[_0x36ae('0x46')](_0x36ae('0x92'));}else{_0x553fe8[_0x36ae('0x46')](_0x36ae('0x76'),_['map'](_0x2c2ae8,'id'));_0x58f54d[_0x36ae('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x36ae('0x2c')](_0x2c2ae8,'id'));}});})[_0x36ae('0x26')](function(){if(_0x485cfe[_0x36ae('0x93')]['role']===_0x36ae('0x90')&&!_0x3faa5d&&!_0x485cfe[_0x36ae('0x3c')][_0x36ae('0x75')])return[];return db[_0x36ae('0x94')][_0x36ae('0x3c')](_0x553fe8[_0x36ae('0x95')](),_0x5a506b);})[_0x36ae('0x26')](function(_0x30d5aa){_0x1b712c['count']=_0x30d5aa[_0x36ae('0x42')];if(_0x1b712c['count']===0x0)return[];return db[_0x36ae('0x94')][_0x36ae('0x3c')](_0x439b58['toString'](),_0x5a506b)[_0x36ae('0x26')](function(_0x58918d){_0x23a09e=_['keyBy'](_0x58918d,'id');_0x5a506b=_[_0x36ae('0x96')](_0x5a506b,{'model':db[_0x36ae('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x485cfe['query']['fields']){_0x410cbd[_0x36ae('0x41')][_0x36ae('0x30')](function(_0x3ab689){_0x58f54d[_0x36ae('0x48')]('i.'+_0x3ab689);});}else{_0x58f54d[_0x36ae('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x36ae('0x5f'));_0x58f54d[_0x36ae('0x48')]('a.key',_0x36ae('0x97'));_0x58f54d[_0x36ae('0x48')](_0x36ae('0x98'),_0x36ae('0x99'));_0x58f54d['field'](_0x36ae('0x9a'),'contactName');_0x58f54d[_0x36ae('0x48')](_0x36ae('0x9b'));_0x58f54d[_0x36ae('0x48')]('c.firstName',_0x36ae('0x9c'));_0x58f54d[_0x36ae('0x48')]('c.lastName',_0x36ae('0x9d'));_0x58f54d['field']('c.email',_0x36ae('0x9e'));_0x58f54d[_0x36ae('0x48')](_0x36ae('0x9f'),_0x36ae('0xa0'));_0x58f54d[_0x36ae('0x48')](_0x36ae('0xa1'),_0x36ae('0xa2'));_0x58f54d[_0x36ae('0x48')](_0x36ae('0xa3'),'Contact.fax');_0x58f54d[_0x36ae('0x48')](_0x36ae('0xa4'),'Owner.fullname');_0x58f54d[_0x36ae('0x48')](_0x36ae('0xa5'),_0x36ae('0xa6'));_0x58f54d[_0x36ae('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x36ae('0x2d'));}if(_0x410cbd[_0x36ae('0x20')])_0x58f54d[_0x36ae('0x20')](_0x410cbd[_0x36ae('0x20')]);if(_0x410cbd[_0x36ae('0x1e')])_0x58f54d[_0x36ae('0x1e')](_0x410cbd[_0x36ae('0x1e')]);return db[_0x36ae('0x94')]['query'](_0x58f54d['toString'](),_0x5a506b);})['then'](function(_0x160be8){if(_0x160be8[_0x36ae('0x42')]>0x0)_0x52390a['where'](_0x36ae('0xa7'),_[_0x36ae('0x2c')](_0x160be8,'id'));return db[_0x36ae('0x94')][_0x36ae('0x3c')](_0x52390a[_0x36ae('0x95')](),_0x5a506b)[_0x36ae('0x26')](function(_0x16fdaa){var _0x54a523=_[_0x36ae('0xa8')](_0x16fdaa,_0x36ae('0xa9'));var _0x58ece2=[];_0x160be8[_0x36ae('0x30')](function(_0x255cc8){_0x58ece2[_0x36ae('0x31')](updateFaxInteraction(_0x255cc8,_0x23a09e,_0x54a523));});return BPromise['all'](_0x58ece2);});});})[_0x36ae('0x26')](function(_0x45f3e7){_0x1b712c[_0x36ae('0xaa')]=_0x45f3e7;return _0x1b712c;})[_0x36ae('0x26')](respondWithFilteredResult(_0x45ce69,_0x410cbd))[_0x36ae('0xab')](handleError(_0x45ce69,null));};exports[_0x36ae('0xac')]=function(_0x5ba2f6,_0x4d59c0){var _0x403699={'raw':![],'where':{'id':_0x5ba2f6[_0x36ae('0xad')]['id']}},_0x3ef758={};_0x3ef758[_0x36ae('0x3e')]=_['keys'](db[_0x36ae('0x39')][_0x36ae('0x3a')]);_0x3ef758[_0x36ae('0x3c')]=_[_0x36ae('0x72')](_0x5ba2f6[_0x36ae('0x3c')]);_0x3ef758[_0x36ae('0x3d')]=_['intersection'](_0x3ef758['model'],_0x3ef758['query']);_0x403699[_0x36ae('0x41')]=_['intersection'](_0x3ef758[_0x36ae('0x3e')],qs[_0x36ae('0x40')](_0x5ba2f6['query'][_0x36ae('0x40')]));_0x403699[_0x36ae('0x41')]=_0x403699[_0x36ae('0x41')][_0x36ae('0x42')]?_0x403699[_0x36ae('0x41')]:_0x3ef758[_0x36ae('0x3e')];if(_0x5ba2f6[_0x36ae('0x3c')][_0x36ae('0xae')]){_0x403699[_0x36ae('0xaf')]=[{'all':!![]}];}_0x403699=_[_0x36ae('0x96')]({},_0x403699,_0x5ba2f6['options']);return db[_0x36ae('0x39')][_0x36ae('0x68')](_0x403699)['then'](handleEntityNotFound(_0x4d59c0,null))['then'](respondWithResult(_0x4d59c0,null))[_0x36ae('0xab')](handleError(_0x4d59c0,null));};exports[_0x36ae('0xb0')]=function(_0x5dfcc1,_0x508e67){return db['FaxInteraction'][_0x36ae('0xb0')](_0x5dfcc1[_0x36ae('0xb1')],{})[_0x36ae('0x26')](respondWithResult(_0x508e67,0xc9))[_0x36ae('0xab')](handleError(_0x508e67,null));};exports[_0x36ae('0x25')]=function(_0x1ccf09,_0x2ffe1f){if(_0x1ccf09[_0x36ae('0xb1')]['id']){delete _0x1ccf09[_0x36ae('0xb1')]['id'];}return db[_0x36ae('0x39')][_0x36ae('0x68')]({'where':{'id':_0x1ccf09[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x2ffe1f,null))[_0x36ae('0x26')](saveUpdates(_0x1ccf09[_0x36ae('0xb1')],null))[_0x36ae('0x26')](respondWithResult(_0x2ffe1f,null))['catch'](handleError(_0x2ffe1f,null));};exports[_0x36ae('0x27')]=function(_0x4ddbd8,_0x389a53){return db[_0x36ae('0x39')]['find']({'where':{'id':_0x4ddbd8[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x389a53,null))[_0x36ae('0x26')](removeEntity(_0x389a53,null))[_0x36ae('0xab')](handleError(_0x389a53,null));};exports['describe']=function(_0x23e55f,_0x4df2da){return db[_0x36ae('0x39')][_0x36ae('0xb2')]()[_0x36ae('0x26')](respondWithResult(_0x4df2da,null))['catch'](handleError(_0x4df2da,null));};exports[_0x36ae('0xb3')]=function(_0x4a6dc1,_0x2c318d,_0xcc81c){return db[_0x36ae('0xb4')][_0x36ae('0x68')]({'where':{'id':_0x4a6dc1[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x2c318d,null))['then'](function(_0x7cfbf5){if(_0x7cfbf5){return _0x7cfbf5[_0x36ae('0xb3')](_0x4a6dc1[_0x36ae('0xb1')][_0x36ae('0xb5')],_[_0x36ae('0xb6')](_0x4a6dc1['body'],[_0x36ae('0xb5'),'id'])||{});}})[_0x36ae('0x26')](respondWithResult(_0x2c318d,null))[_0x36ae('0xab')](handleError(_0x2c318d,null));};exports[_0x36ae('0xb7')]=function(_0x5de841,_0x30890c,_0x4cc283){var _0x9811f5={'raw':![],'where':{}};var _0x3d6d72={};var _0xef8896={'count':0x0,'rows':[]};return db[_0x36ae('0x39')][_0x36ae('0xb8')]({'where':{'id':_0x5de841[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x30890c,null))[_0x36ae('0x26')](function(_0x237ba3){if(_0x237ba3){_0x3d6d72[_0x36ae('0x3e')]=_[_0x36ae('0x72')](db[_0x36ae('0xb4')][_0x36ae('0x3a')]);_0x3d6d72[_0x36ae('0x3c')]=_[_0x36ae('0x72')](_0x5de841['query']);_0x3d6d72[_0x36ae('0x3d')]=_[_0x36ae('0x3f')](_0x3d6d72[_0x36ae('0x3e')],_0x3d6d72[_0x36ae('0x3c')]);_0x9811f5[_0x36ae('0x41')]=_[_0x36ae('0x3f')](_0x3d6d72[_0x36ae('0x3e')],qs[_0x36ae('0x40')](_0x5de841[_0x36ae('0x3c')][_0x36ae('0x40')]));_0x9811f5[_0x36ae('0x41')]=_0x9811f5['attributes'][_0x36ae('0x42')]?_0x9811f5[_0x36ae('0x41')]:_0x3d6d72['model'];if(!_0x5de841[_0x36ae('0x3c')][_0x36ae('0xb9')](_0x36ae('0x43'))){_0x9811f5['limit']=qs['limit'](_0x5de841[_0x36ae('0x3c')]['limit']);_0x9811f5[_0x36ae('0x1e')]=qs[_0x36ae('0x1e')](_0x5de841[_0x36ae('0x3c')][_0x36ae('0x1e')]);}_0x9811f5[_0x36ae('0x44')]=qs['sort'](_0x5de841[_0x36ae('0x3c')][_0x36ae('0x45')]);_0x9811f5[_0x36ae('0x46')]=qs[_0x36ae('0x3d')](_['pick'](_0x5de841[_0x36ae('0x3c')],_0x3d6d72['filters']));_0x9811f5['where'][_0x36ae('0xa9')]=_0x237ba3['id'];if(_0x5de841['query'][_0x36ae('0x83')]){_0x9811f5[_0x36ae('0x46')]=_[_0x36ae('0x96')](_0x9811f5[_0x36ae('0x46')],{'$or':_[_0x36ae('0x2c')](_0x9811f5[_0x36ae('0x41')],function(_0x544972){var _0x3548a9={};_0x3548a9[_0x544972]={'$like':'%'+_0x5de841[_0x36ae('0x3c')][_0x36ae('0x83')]+'%'};return _0x3548a9;})});}if(_0x5de841[_0x36ae('0x3c')]['$gte']){var _0x2f2841=_0x5de841[_0x36ae('0x3c')]['$gte'][_0x36ae('0x2f')](',');var _0x2a4e0c={};_0x2a4e0c[_0x2f2841[0x0]]={'$gte':moment(_0x2f2841[0x1])[_0x36ae('0xba')](_0x36ae('0xbb'))};_0x9811f5[_0x36ae('0x46')]=_[_0x36ae('0x96')](_0x9811f5[_0x36ae('0x46')],_0x2a4e0c);}_0x9811f5=_['merge']({},_0x9811f5,_0x5de841[_0x36ae('0xbc')]);return db[_0x36ae('0xb4')][_0x36ae('0x21')]({'where':_0x9811f5[_0x36ae('0x46')]})[_0x36ae('0x26')](function(_0x5f146a){_0xef8896['count']=_0x5f146a;if(_0x5de841[_0x36ae('0x3c')][_0x36ae('0xae')]){_0x9811f5[_0x36ae('0xaf')]=[{'all':!![]}];}return db[_0x36ae('0xb4')][_0x36ae('0xbd')](_0x9811f5);})[_0x36ae('0x26')](function(_0x2007df){_0xef8896[_0x36ae('0xaa')]=_0x2007df;return _0xef8896;});}})[_0x36ae('0x26')](respondWithFilteredResult(_0x30890c,_0x9811f5))[_0x36ae('0xab')](handleError(_0x30890c,null));};exports[_0x36ae('0xbe')]=function(_0x19ee0c,_0x4c0064,_0x530980){return db[_0x36ae('0x39')][_0x36ae('0x68')]({'where':{'id':_0x19ee0c[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x4c0064,null))[_0x36ae('0x26')](function(_0x2ebcf4){if(_0x2ebcf4){return _0x2ebcf4[_0x36ae('0xbf')](_0x19ee0c[_0x36ae('0xb1')][_0x36ae('0xb5')],_[_0x36ae('0xb6')](_0x19ee0c[_0x36ae('0xb1')],[_0x36ae('0xb5'),'id'])||{})[_0x36ae('0xc0')](function(){return db['Tag'][_0x36ae('0xbd')]({'attributes':['id',_0x36ae('0x2a'),_0x36ae('0x49')],'where':{'id':_0x19ee0c[_0x36ae('0xb1')][_0x36ae('0xb5')]}});})[_0x36ae('0x26')](function(_0x2a4aac){socket[_0x36ae('0xc1')](_0x36ae('0xc2'),{'id':Number(_0x19ee0c['params']['id']),'tags':_0x2a4aac||[]});return{'id':Number(_0x19ee0c[_0x36ae('0xad')]['id']),'tags':_0x2a4aac||[]};});}})['then'](respondWithResult(_0x4c0064,null))[_0x36ae('0xab')](handleError(_0x4c0064,null));};exports[_0x36ae('0xc3')]=function(_0x44aa44,_0x55b9c3,_0x3eb629){return db[_0x36ae('0x39')][_0x36ae('0x68')]({'where':{'id':_0x44aa44[_0x36ae('0xad')]['id']}})[_0x36ae('0x26')](handleEntityNotFound(_0x55b9c3,null))[_0x36ae('0x26')](function(_0x24effc){if(_0x24effc){return _0x24effc[_0x36ae('0xc3')](_0x44aa44[_0x36ae('0x3c')][_0x36ae('0xb5')]);}})[_0x36ae('0x26')](respondWithStatusCode(_0x55b9c3,null))[_0x36ae('0xab')](handleError(_0x55b9c3,null));};exports[_0x36ae('0xc4')]=function(_0x5adf24,_0x484c49){var _0x231299=moment()[_0x36ae('0xc5')]()[_0x36ae('0x95')]();var _0x98d1db=path['join'](config[_0x36ae('0xc6')],'server',_0x36ae('0xc7'),'tmp');var _0x2bf891=path[_0x36ae('0xc8')](config[_0x36ae('0xc6')],_0x36ae('0xc9'),'files','attachments');var _0x3bdb4c=path[_0x36ae('0xc8')](_0x98d1db,_0x231299);var _0x59d3f7=util[_0x36ae('0xba')](_0x36ae('0xca'),_0x5adf24[_0x36ae('0xad')]['id'],_0x231299);var _0x4abd6b=path[_0x36ae('0xc8')](_0x98d1db,_0x59d3f7);var _0x594848=[];_0x594848[_0x36ae('0x31')]({'model':db[_0x36ae('0xcb')],'as':_0x36ae('0xcb'),'raw':!![]});var _0x34aa89=[{'model':db[_0x36ae('0xb4')],'as':_0x36ae('0xcc'),'attributes':['id',_0x36ae('0xb1'),_0x36ae('0x77')],'include':_0x594848}];return db[_0x36ae('0x39')][_0x36ae('0x68')]({'where':{'id':_0x5adf24['params']['id']},'include':_0x34aa89})[_0x36ae('0x26')](handleEntityNotFound(_0x484c49,null))[_0x36ae('0x26')](function(_0x4d5ccb){if(_0x4d5ccb&&_0x4d5ccb[_0x36ae('0xcc')]){var _0x196eb4=_0x4d5ccb[_0x36ae('0xcd')]({'plain':!![]});fs[_0x36ae('0xce')](_0x3bdb4c);for(var _0xe9f291=0x0;_0xe9f291<_0x196eb4[_0x36ae('0xcc')]['length'];_0xe9f291++){var _0x3e2531=_0x196eb4[_0x36ae('0xcc')][_0xe9f291]['Attachment'];if(_0x3e2531){var _0x36f77d=path[_0x36ae('0xc8')](_0x2bf891,_0x3e2531[_0x36ae('0xcf')]);if(fs[_0x36ae('0xd0')](_0x36f77d)){fs[_0x36ae('0xd1')](_0x36f77d)[_0x36ae('0xd2')](fs['createWriteStream'](path[_0x36ae('0xc8')](_0x3bdb4c,_0x3e2531['basename'])));}}}return BPromise['resolve']()[_0x36ae('0x26')](function(){return new BPromise(function(_0x2baba8,_0x514a5c){zipdir(_0x3bdb4c,{'saveTo':_0x4abd6b},function(_0x2554ba,_0x48a425){if(_0x2554ba)return _0x514a5c(_0x2554ba);return _0x2baba8(_0x48a425);});})[_0x36ae('0x26')](function(){return new BPromise(function(_0x4f1540,_0x5c80bd){rimraf(_0x3bdb4c,function(_0xf58cee){if(_0xf58cee)_0x5c80bd(_0xf58cee);return _0x4f1540();});});})[_0x36ae('0x26')](function(){return _0x484c49['download'](_0x4abd6b,_0x59d3f7,function(_0x32d8ef){if(_0x32d8ef){console[_0x36ae('0xd3')](_0x36ae('0xd4'),_0x32d8ef);}else{fs['unlinkSync'](_0x4abd6b);}});});});}else{return _0x484c49[_0x36ae('0x1a')](0xc8);}})[_0x36ae('0xab')](handleError(_0x484c49,null));}; \ No newline at end of file +var _0xa6fc=['i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','groupBy','rows','show','params','includeAll','merge','options','create','body','destroy','addMessage','FaxMessage','ids','findOne','intersection','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','setTags','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','pipe','log','err','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','answered','unmanaged','closed','waiting','UserId','talking','total','index','FaxInteraction','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','type','text','value','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.fax\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent'];(function(_0x5c0a6b,_0x9e66ff){var _0x4cb00d=function(_0x55812c){while(--_0x55812c){_0x5c0a6b['push'](_0x5c0a6b['shift']());}};_0x4cb00d(++_0x9e66ff);}(_0xa6fc,0x10f));var _0xca6f=function(_0x49240e,_0x374c08){_0x49240e=_0x49240e-0x0;var _0x519358=_0xa6fc[_0x49240e];return _0x519358;};'use strict';var emlformat=require(_0xca6f('0x0'));var rimraf=require(_0xca6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca6f('0x2'));var moment=require(_0xca6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xca6f('0x4'));var util=require('util');var path=require(_0xca6f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6f('0x6'));var _=require('lodash');var squel=require(_0xca6f('0x7'));var crypto=require(_0xca6f('0x8'));var jsforce=require(_0xca6f('0x9'));var deskjs=require(_0xca6f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xca6f('0xb'));var Papa=require(_0xca6f('0xc'));var Redis=require(_0xca6f('0xd'));var authService=require(_0xca6f('0xe'));var qs=require(_0xca6f('0xf'));var as=require(_0xca6f('0x10'));var hardwareService=require(_0xca6f('0x11'));var logger=require(_0xca6f('0x12'))(_0xca6f('0x13'));var utils=require('../../config/utils');var config=require(_0xca6f('0x14'));var licenseUtil=require(_0xca6f('0x15'));var db=require('../../mysqldb')['db'];config[_0xca6f('0x16')]=_[_0xca6f('0x17')](config[_0xca6f('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xca6f('0x18'))[_0xca6f('0x19')](socket);function respondWithStatusCode(_0x55047d,_0x2c98c3){_0x2c98c3=_0x2c98c3||0xcc;return function(_0x4fc3e3){if(_0x4fc3e3){return _0x55047d[_0xca6f('0x1a')](_0x2c98c3);}return _0x55047d[_0xca6f('0x1b')](_0x2c98c3)[_0xca6f('0x1c')]();};}function respondWithResult(_0x5de5ae,_0x15dde4){_0x15dde4=_0x15dde4||0xc8;return function(_0x4f2de0){if(_0x4f2de0){return _0x5de5ae[_0xca6f('0x1b')](_0x15dde4)[_0xca6f('0x1d')](_0x4f2de0);}};}function respondWithFilteredResult(_0x267657,_0x59db2f){return function(_0x3627da){if(_0x3627da){var _0x3941d1=typeof _0x59db2f[_0xca6f('0x1e')]===_0xca6f('0x1f')&&typeof _0x59db2f[_0xca6f('0x20')]===_0xca6f('0x1f');var _0x447e49=_0x3627da['count'];var _0x57bf61=_0x3941d1?0x0:_0x59db2f[_0xca6f('0x1e')];var _0x1b3f2e=_0x3941d1?_0x3627da[_0xca6f('0x21')]:_0x59db2f[_0xca6f('0x1e')]+_0x59db2f[_0xca6f('0x20')];var _0x20f525;if(_0x1b3f2e>=_0x447e49){_0x1b3f2e=_0x447e49;_0x20f525=0xc8;}else{_0x20f525=0xce;}_0x267657[_0xca6f('0x1b')](_0x20f525);return _0x267657[_0xca6f('0x22')](_0xca6f('0x23'),_0x57bf61+'-'+_0x1b3f2e+'/'+_0x447e49)[_0xca6f('0x1d')](_0x3627da);}return null;};}function patchUpdates(_0x18af40){return function(_0x458b7b){try{jsonpatch[_0xca6f('0x24')](_0x458b7b,_0x18af40,!![]);}catch(_0x42475d){return BPromise[_0xca6f('0x25')](_0x42475d);}return _0x458b7b['save']();};}function saveUpdates(_0x4acd64,_0x1b5237){return function(_0x33d73a){if(_0x33d73a){return _0x33d73a[_0xca6f('0x26')](_0x4acd64)[_0xca6f('0x27')](function(_0x3b17a3){return _0x3b17a3;});}return null;};}function removeEntity(_0x1d52bd,_0x17e8d7){return function(_0x1a5c52){if(_0x1a5c52){return _0x1a5c52['destroy']()[_0xca6f('0x27')](function(){_0x1d52bd['status'](0xcc)[_0xca6f('0x1c')]();});}};}function handleEntityNotFound(_0x18ab79,_0x348e72){return function(_0x119b1e){if(!_0x119b1e){_0x18ab79[_0xca6f('0x1a')](0x194);}return _0x119b1e;};}function handleError(_0x3b0fd3,_0x17ee5d){_0x17ee5d=_0x17ee5d||0x1f4;return function(_0x2268c2){logger[_0xca6f('0x28')](_0x2268c2[_0xca6f('0x29')]);if(_0x2268c2[_0xca6f('0x2a')]){delete _0x2268c2[_0xca6f('0x2a')];}_0x3b0fd3[_0xca6f('0x1b')](_0x17ee5d)[_0xca6f('0x2b')](_0x2268c2);};}function getInteractionUsers(_0x495d52,_0x4ad57d){return new BPromise(function(_0x2616e7,_0x5dc5c2){try{if(_0x4ad57d[_0x495d52['id']]){_0x495d52['Users']=_[_0xca6f('0x2c')](_0x4ad57d[_0x495d52['id']],function(_0x7270da){return{'id':_0x7270da['id'],'fullname':_0x7270da[_0xca6f('0x2d')]};});}}catch(_0x5bfb72){_0x5dc5c2(_0x5bfb72);}_0x2616e7(_0x495d52);});}function getInteractionTags(_0x81b234,_0x3950c8){return new BPromise(function(_0x2a8808,_0x38c07c){try{if(_0x81b234[_0xca6f('0x2e')]){_0x81b234[_0xca6f('0x2f')]=[];_0x81b234['TagIds']['split'](',')[_0xca6f('0x30')](function(_0x191aed){_0x81b234[_0xca6f('0x2f')][_0xca6f('0x31')](_0x3950c8[_0x191aed]);});}delete _0x81b234['TagIds'];}catch(_0x56740d){_0x38c07c(_0x56740d);}_0x2a8808(_0x81b234);});}function updateFaxInteraction(_0x43e4a6,_0x54e0fb,_0x1083ad){return new BPromise(function(_0x2dab94,_0x29d7e2){return getInteractionUsers(_0x43e4a6,_0x1083ad)[_0xca6f('0x27')](function(_0x245b91){return getInteractionTags(_0x245b91,_0x54e0fb);})[_0xca6f('0x27')](function(_0x1760ce){return getStateInteraction(_0x1760ce);})['then'](function(_0x4305a7){_0x2dab94(_0x4305a7);})[_0xca6f('0x32')](function(_0x51cc2a){_0x29d7e2(_0x51cc2a);});});}function getStateInteraction(_0x312afe){return new BPromise(function(_0x6e1c60){_0x312afe['waiting']=0x0;_0x312afe['talking']=0x0;_0x312afe[_0xca6f('0x33')]=0x0;_0x312afe[_0xca6f('0x34')]=0x0;_0x312afe['total']=0x0;if(!_0x312afe[_0xca6f('0x35')]&&!_0x312afe['UserId']){_0x312afe[_0xca6f('0x36')]+=0x1;}if(!_0x312afe[_0xca6f('0x35')]&&_0x312afe[_0xca6f('0x37')]){_0x312afe[_0xca6f('0x38')]+=0x1;if(_0x312afe[_0xca6f('0x36')]){_0x312afe[_0xca6f('0x36')]-=0x1;}}if(_0x312afe[_0xca6f('0x35')]&&_0x312afe[_0xca6f('0x37')]){_0x312afe[_0xca6f('0x33')]+=0x1;if(_0x312afe['talking']){_0x312afe[_0xca6f('0x38')]-=0x1;}}if(_0x312afe['closed']&&!_0x312afe[_0xca6f('0x37')]){_0x312afe[_0xca6f('0x34')]+=0x1;if(_0x312afe[_0xca6f('0x36')]){_0x312afe[_0xca6f('0x36')]-=0x1;}}_0x312afe[_0xca6f('0x39')]+=0x1;_0x6e1c60(_0x312afe);});}exports[_0xca6f('0x3a')]=function(_0x4dac1b,_0x1d59c5){var _0x434e76={},_0x497ca7={},_0x4a8561={'count':0x0,'rows':[]};var _0x1cff5c=_[_0xca6f('0x2c')](db[_0xca6f('0x3b')][_0xca6f('0x3c')],function(_0x3d1564){return{'name':_0x3d1564[_0xca6f('0x3d')],'type':_0x3d1564['type']['key']};});_0x497ca7[_0xca6f('0x3e')]=_[_0xca6f('0x2c')](_0x1cff5c,_0xca6f('0x2a'));_0x497ca7[_0xca6f('0x3f')]=_[_0xca6f('0x40')](_0x4dac1b[_0xca6f('0x3f')]);_0x497ca7[_0xca6f('0x41')]=_['intersection'](_0x497ca7[_0xca6f('0x3e')],_0x497ca7[_0xca6f('0x3f')]);_0x434e76[_0xca6f('0x42')]=_['intersection'](_0x497ca7[_0xca6f('0x3e')],qs[_0xca6f('0x43')](_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x43')]));_0x434e76[_0xca6f('0x42')]=_0x434e76['attributes'][_0xca6f('0x44')]?_0x434e76[_0xca6f('0x42')]:_0x497ca7[_0xca6f('0x3e')];if(!_0x4dac1b['query'][_0xca6f('0x45')](_0xca6f('0x46'))){_0x434e76[_0xca6f('0x20')]=qs['limit'](_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x20')]);_0x434e76['offset']=qs[_0xca6f('0x1e')](_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x1e')]);}_0x434e76['order']=qs[_0xca6f('0x47')](_0x4dac1b['query']['sort']);_0x434e76[_0xca6f('0x48')]=qs[_0xca6f('0x41')](_[_0xca6f('0x49')](_0x4dac1b['query'],_0x497ca7[_0xca6f('0x41')]),_0x1cff5c);var _0x5243b2=[];var _0x20e66e=squel[_0xca6f('0x4a')]()[_0xca6f('0x4b')]('id')['field'](_0xca6f('0x2a'))[_0xca6f('0x4b')](_0xca6f('0x4c'))[_0xca6f('0x4d')]('tools_tags');var _0x38a7a5=squel[_0xca6f('0x4a')]()[_0xca6f('0x4b')]('u.id')[_0xca6f('0x4b')](_0xca6f('0x4e'))['field']('ui.FaxInteractionId')[_0xca6f('0x4d')]('user_has_fax_interactions','ui')[_0xca6f('0x4f')](_0xca6f('0x50'),'u',_0xca6f('0x51'));var _0xe68efa=squel[_0xca6f('0x4a')]()[_0xca6f('0x4d')](_0xca6f('0x52'),'i')['left_join'](_0xca6f('0x53'),'c',_0xca6f('0x54'))[_0xca6f('0x4f')](_0xca6f('0x50'),'o',_0xca6f('0x55'))[_0xca6f('0x4f')](_0xca6f('0x56'),'a',_0xca6f('0x57'))['left_join'](_0xca6f('0x58'),'me',_0xca6f('0x59'))[_0xca6f('0x4f')](_0xca6f('0x5a'),'it',_0xca6f('0x5b'))['left_join'](_0xca6f('0x5c'),'t',_0xca6f('0x5d'));var _0x7e57ec=squel[_0xca6f('0x5e')]();var _0x420158=[];var _0x1c4419=squel['expr']();var _0x10b8da;if(_0x4dac1b[_0xca6f('0x3f')]['search']){_0x10b8da=as['parseSearch'](_0x4dac1b['query']['search']);var _0x8a4ac2=_0x10b8da[_0xca6f('0x5f')];for(var _0x2e9640=0x0;_0x2e9640<_0x10b8da[_0xca6f('0x60')][_0xca6f('0x44')];_0x2e9640++){var _0x37e9f0=_0x10b8da[_0xca6f('0x60')][_0x2e9640];var _0x3ae2c8='i';var _0x228731=_[_0xca6f('0x61')](_0x1cff5c,[_0xca6f('0x2a'),_0x37e9f0[_0xca6f('0x4b')]]);if(!_0x228731){switch(_0x37e9f0[_0xca6f('0x4b')]){case _0xca6f('0x62'):if(_0x37e9f0['value']==0x1){_0xe68efa['having']('`'+_0x37e9f0[_0xca6f('0x4b')]+_0xca6f('0x63'));}else{_0xe68efa[_0xca6f('0x64')]('`'+_0x37e9f0[_0xca6f('0x4b')]+_0xca6f('0x65'));}break;case _0xca6f('0x66'):if(_0x37e9f0[_0xca6f('0x67')]===_0xca6f('0x68')){if(_0x37e9f0['value']['split']('\x20')['length']>0x1){_0x7e57ec[_0x8a4ac2](_0xca6f('0x69'),qs[_0xca6f('0x6a')](_0x37e9f0['value']),null);}else{var _0x18540d='%'+_0x37e9f0['value']+'%';_0x7e57ec[_0x8a4ac2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x18540d,_0x18540d,_0x18540d);}}else{_0x228731=_[_0xca6f('0x61')](_0x1cff5c,['name','ContactId']);_0x37e9f0['field']='ContactId';_0xd24d42=as['buildExpression'](_0x3ae2c8,_0x228731[_0xca6f('0x6b')],_0x37e9f0);_0x7e57ec[_0x8a4ac2](_0xd24d42[_0xca6f('0x6c')],_0xd24d42['value']['start'],_0xd24d42[_0xca6f('0x6d')][_0xca6f('0x1c')]);}break;case _0xca6f('0x6e'):var _0x5ae80f=_0x37e9f0[_0xca6f('0x6d')][_0xca6f('0x6f')](',')['map'](function(_0x352277){return Number(_0x352277);});_0x5ae80f[_0xca6f('0x30')](function(_0x4bf09c){_0x1c4419['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bf09c+',%');});_0x420158=_[_0xca6f('0x70')](_0x420158,_0x5ae80f);break;case _0xca6f('0x71'):if(_0x37e9f0[_0xca6f('0x67')]===_0xca6f('0x68')){_0x7e57ec[_0x8a4ac2](_0xca6f('0x72'),'%'+_0x37e9f0[_0xca6f('0x6d')]+'%',null);}else{_0x228731=_[_0xca6f('0x61')](_0x1cff5c,[_0xca6f('0x2a'),_0xca6f('0x37')]);_0x37e9f0[_0xca6f('0x4b')]='UserId';_0xd24d42=as[_0xca6f('0x73')](_0x3ae2c8,_0x228731[_0xca6f('0x6b')],_0x37e9f0);_0x7e57ec[_0x8a4ac2](_0xd24d42[_0xca6f('0x6c')],_0xd24d42[_0xca6f('0x6d')][_0xca6f('0x74')],_0xd24d42['value']['end']);}break;case'body':_0xd24d42=as[_0xca6f('0x73')]('me',null,_0x37e9f0);_0x7e57ec[_0x8a4ac2](_0xd24d42[_0xca6f('0x6c')],_0xd24d42[_0xca6f('0x6d')][_0xca6f('0x74')],_0xd24d42[_0xca6f('0x6d')]['end']);break;}}else{var _0xd24d42=as['buildExpression'](_0x3ae2c8,_0x228731['type'],_0x37e9f0);_0x7e57ec[_0x8a4ac2](_0xd24d42[_0xca6f('0x6c')],_0xd24d42[_0xca6f('0x6d')]['start'],_0xd24d42['value'][_0xca6f('0x1c')]);}}}else{var _0x5df477=_(_0x4dac1b[_0xca6f('0x3f')])[_0xca6f('0x40')]()[_0xca6f('0x2c')](function(_0x5e3686){return _[_0xca6f('0x75')](_0x1cff5c,[_0xca6f('0x2a'),_0x5e3686])?_0x5e3686:undefined;})['compact']()['value']();if(!_[_0xca6f('0x76')](_0x5df477)){_0x5df477[_0xca6f('0x30')](function(_0x13a934){if(_0x13a934===_0xca6f('0x77')){_0xe68efa[_0xca6f('0x48')](_0xca6f('0x78'),[][_0xca6f('0x79')](_0x4dac1b[_0xca6f('0x3f')][_0x13a934]));}else if(_0x13a934===_0xca6f('0x7a')){var _0xd6f245=JSON[_0xca6f('0x7b')](_0x4dac1b[_0xca6f('0x3f')][_0x13a934])[_0xca6f('0x7c')];var _0x15197e=JSON[_0xca6f('0x7b')](_0x4dac1b[_0xca6f('0x3f')][_0x13a934])['$lte'];_0xe68efa[_0xca6f('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xd6f245,_0x15197e);}else{if(_0x4dac1b['query'][_0x13a934]==='null'){_0xe68efa[_0xca6f('0x48')]('i.'+_0x13a934+'\x20IS\x20NULL');}else{_0xe68efa[_0xca6f('0x48')]('i.'+_0x13a934+'\x20=\x20?',_0x4dac1b[_0xca6f('0x3f')][_0x13a934]);}}});}if(_0x4dac1b['query'][_0xca6f('0x7d')]){if(_0x4dac1b['query'][_0xca6f('0x7d')]==0x1){_0xe68efa[_0xca6f('0x64')](_0xca6f('0x7e'));}else{_0xe68efa[_0xca6f('0x64')](_0xca6f('0x7f'));}}if(_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x80')]){_0x420158=_[_0xca6f('0x81')](_0x4dac1b[_0xca6f('0x3f')]['tag'])?_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x80')]:new Array(_0x4dac1b[_0xca6f('0x3f')]['tag']);_0x420158[_0xca6f('0x30')](function(_0x75a4f3){_0x1c4419['or'](_0xca6f('0x82'),'%,'+_0x75a4f3+',%');});}if(_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x83')]){var _0x37cd27=_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x83')][_0xca6f('0x84')]('\x5c','\x5c\x5c')[_0xca6f('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x37cd27)){_0x7e57ec['or']('i.id\x20LIKE\x20?',_0x37cd27+'%')['or'](_0xca6f('0x85'),_0x37cd27+'%');}_0x7e57ec['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x37cd27+'%');}}_0xe68efa['where'](_0x7e57ec);_0xe68efa[_0xca6f('0x86')](_0xca6f('0x87'));var _0x32d812={'type':db[_0xca6f('0x88')]['QueryTypes'][_0xca6f('0x89')],'raw':!![]};var _0x4fb024=_0xe68efa[_0xca6f('0x8a')]();_0x4fb024[_0xca6f('0x4b')](_0xca6f('0x87'));_0x4fb024[_0xca6f('0x4b')](_0xca6f('0x8b'),_0xca6f('0x62'));if(_0x434e76['order']){_0x434e76[_0xca6f('0x8c')][_0xca6f('0x30')](function(_0x314f17){var _0x265368=_0x314f17[0x0]===_0xca6f('0x8d')?_0x314f17[0x0]:'i.'+_0x314f17[0x0];_0xe68efa[_0xca6f('0x8c')](_0x265368,_0x314f17[0x1]===_0xca6f('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x420158)){_0xe68efa[_0xca6f('0x64')](_0x1c4419);_0x4fb024[_0xca6f('0x48')](_0xca6f('0x8f'),_0x420158);}BPromise[_0xca6f('0x90')]()[_0xca6f('0x27')](function(){if(!_0x10b8da){if(_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x77')])return;_0x4fb024[_0xca6f('0x48')](_0xca6f('0x91'));_0xe68efa[_0xca6f('0x48')](_0xca6f('0x91'));return;}if(_0x4dac1b[_0xca6f('0x92')][_0xca6f('0x93')]!==_0xca6f('0x94'))return;return _0x4dac1b[_0xca6f('0x92')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xca6f('0x27')](function(_0x162e9e){if(_[_0xca6f('0x76')](_0x162e9e)){_0x4fb024[_0xca6f('0x48')](_0xca6f('0x95'));_0xe68efa['where'](_0xca6f('0x95'));}else{_0x4fb024[_0xca6f('0x48')](_0xca6f('0x78'),_[_0xca6f('0x2c')](_0x162e9e,'id'));_0xe68efa[_0xca6f('0x48')](_0xca6f('0x78'),_['map'](_0x162e9e,'id'));}});})[_0xca6f('0x27')](function(){if(_0x4dac1b['user'][_0xca6f('0x93')]===_0xca6f('0x94')&&!_0x10b8da&&!_0x4dac1b[_0xca6f('0x3f')]['FaxAccountId'])return[];return db[_0xca6f('0x96')][_0xca6f('0x3f')](_0x4fb024[_0xca6f('0x97')](),_0x32d812);})[_0xca6f('0x27')](function(_0x302877){_0x4a8561[_0xca6f('0x21')]=_0x302877[_0xca6f('0x44')];if(_0x4a8561['count']===0x0)return[];return db[_0xca6f('0x96')][_0xca6f('0x3f')](_0x20e66e[_0xca6f('0x97')](),_0x32d812)[_0xca6f('0x27')](function(_0x3a27c3){_0x5243b2=_[_0xca6f('0x98')](_0x3a27c3,'id');_0x32d812=_['merge'](_0x32d812,{'model':db[_0xca6f('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4dac1b[_0xca6f('0x3f')][_0xca6f('0x43')]){_0x434e76['attributes'][_0xca6f('0x30')](function(_0x41d076){_0xe68efa['field']('i.'+_0x41d076);});}else{_0xe68efa[_0xca6f('0x4b')](_0xca6f('0x8b'),_0xca6f('0x62'));_0xe68efa[_0xca6f('0x4b')]('a.key',_0xca6f('0x99'));_0xe68efa['field'](_0xca6f('0x9a'),_0xca6f('0x9b'));_0xe68efa[_0xca6f('0x4b')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xe68efa[_0xca6f('0x4b')]('i.*');_0xe68efa[_0xca6f('0x4b')](_0xca6f('0x9c'),_0xca6f('0x9d'));_0xe68efa[_0xca6f('0x4b')](_0xca6f('0x9e'),_0xca6f('0x9f'));_0xe68efa[_0xca6f('0x4b')](_0xca6f('0xa0'),_0xca6f('0xa1'));_0xe68efa[_0xca6f('0x4b')]('c.phone',_0xca6f('0xa2'));_0xe68efa['field']('c.mobile','Contact.mobile');_0xe68efa['field'](_0xca6f('0xa3'),'Contact.fax');_0xe68efa[_0xca6f('0x4b')](_0xca6f('0xa4'),'Owner.fullname');_0xe68efa[_0xca6f('0x4b')](_0xca6f('0xa5'),_0xca6f('0xa6'));_0xe68efa['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xca6f('0x2e'));}if(_0x434e76[_0xca6f('0x20')])_0xe68efa['limit'](_0x434e76[_0xca6f('0x20')]);if(_0x434e76[_0xca6f('0x1e')])_0xe68efa['offset'](_0x434e76[_0xca6f('0x1e')]);return db[_0xca6f('0x96')][_0xca6f('0x3f')](_0xe68efa['toString'](),_0x32d812);})[_0xca6f('0x27')](function(_0xa4353){if(_0xa4353[_0xca6f('0x44')]>0x0)_0x38a7a5[_0xca6f('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0xca6f('0x2c')](_0xa4353,'id'));return db['sequelize'][_0xca6f('0x3f')](_0x38a7a5[_0xca6f('0x97')](),_0x32d812)[_0xca6f('0x27')](function(_0x275f6a){var _0x3f29c1=_[_0xca6f('0xa7')](_0x275f6a,'FaxInteractionId');var _0x1203dd=[];_0xa4353[_0xca6f('0x30')](function(_0x22942a){_0x1203dd['push'](updateFaxInteraction(_0x22942a,_0x5243b2,_0x3f29c1));});return BPromise['all'](_0x1203dd);});});})[_0xca6f('0x27')](function(_0x24eb08){_0x4a8561[_0xca6f('0xa8')]=_0x24eb08;return _0x4a8561;})[_0xca6f('0x27')](respondWithFilteredResult(_0x1d59c5,_0x434e76))[_0xca6f('0x32')](handleError(_0x1d59c5,null));};exports[_0xca6f('0xa9')]=function(_0x46cb69,_0x5efebd){var _0x589e03={'raw':![],'where':{'id':_0x46cb69[_0xca6f('0xaa')]['id']}},_0x55f600={};_0x55f600['model']=_['keys'](db['FaxInteraction'][_0xca6f('0x3c')]);_0x55f600[_0xca6f('0x3f')]=_[_0xca6f('0x40')](_0x46cb69['query']);_0x55f600[_0xca6f('0x41')]=_['intersection'](_0x55f600[_0xca6f('0x3e')],_0x55f600[_0xca6f('0x3f')]);_0x589e03[_0xca6f('0x42')]=_['intersection'](_0x55f600[_0xca6f('0x3e')],qs[_0xca6f('0x43')](_0x46cb69['query']['fields']));_0x589e03[_0xca6f('0x42')]=_0x589e03['attributes'][_0xca6f('0x44')]?_0x589e03[_0xca6f('0x42')]:_0x55f600['model'];if(_0x46cb69[_0xca6f('0x3f')][_0xca6f('0xab')]){_0x589e03['include']=[{'all':!![]}];}_0x589e03=_[_0xca6f('0xac')]({},_0x589e03,_0x46cb69[_0xca6f('0xad')]);return db[_0xca6f('0x3b')][_0xca6f('0x61')](_0x589e03)[_0xca6f('0x27')](handleEntityNotFound(_0x5efebd,null))[_0xca6f('0x27')](respondWithResult(_0x5efebd,null))[_0xca6f('0x32')](handleError(_0x5efebd,null));};exports['create']=function(_0x2de13c,_0x1cd835){return db[_0xca6f('0x3b')][_0xca6f('0xae')](_0x2de13c['body'],{})[_0xca6f('0x27')](respondWithResult(_0x1cd835,0xc9))['catch'](handleError(_0x1cd835,null));};exports[_0xca6f('0x26')]=function(_0x5f50ab,_0x494d98){if(_0x5f50ab['body']['id']){delete _0x5f50ab[_0xca6f('0xaf')]['id'];}return db['FaxInteraction'][_0xca6f('0x61')]({'where':{'id':_0x5f50ab[_0xca6f('0xaa')]['id']}})[_0xca6f('0x27')](handleEntityNotFound(_0x494d98,null))['then'](saveUpdates(_0x5f50ab['body'],null))[_0xca6f('0x27')](respondWithResult(_0x494d98,null))[_0xca6f('0x32')](handleError(_0x494d98,null));};exports[_0xca6f('0xb0')]=function(_0x3ce0af,_0x368679){return db[_0xca6f('0x3b')][_0xca6f('0x61')]({'where':{'id':_0x3ce0af['params']['id']}})[_0xca6f('0x27')](handleEntityNotFound(_0x368679,null))[_0xca6f('0x27')](removeEntity(_0x368679,null))[_0xca6f('0x32')](handleError(_0x368679,null));};exports['describe']=function(_0x54230a,_0x3bae19){return db[_0xca6f('0x3b')]['describe']()['then'](respondWithResult(_0x3bae19,null))['catch'](handleError(_0x3bae19,null));};exports[_0xca6f('0xb1')]=function(_0x3f4c17,_0x53ab73,_0x3025c3){return db[_0xca6f('0xb2')][_0xca6f('0x61')]({'where':{'id':_0x3f4c17[_0xca6f('0xaa')]['id']}})[_0xca6f('0x27')](handleEntityNotFound(_0x53ab73,null))[_0xca6f('0x27')](function(_0x37c0fc){if(_0x37c0fc){return _0x37c0fc['addMessage'](_0x3f4c17['body'][_0xca6f('0xb3')],_['omit'](_0x3f4c17[_0xca6f('0xaf')],['ids','id'])||{});}})[_0xca6f('0x27')](respondWithResult(_0x53ab73,null))[_0xca6f('0x32')](handleError(_0x53ab73,null));};exports['getMessages']=function(_0x3daa3d,_0x447b32,_0x215fc5){var _0x997848={'raw':![],'where':{}};var _0x467801={};var _0x8d98d8={'count':0x0,'rows':[]};return db[_0xca6f('0x3b')][_0xca6f('0xb4')]({'where':{'id':_0x3daa3d[_0xca6f('0xaa')]['id']}})['then'](handleEntityNotFound(_0x447b32,null))['then'](function(_0x4388ff){if(_0x4388ff){_0x467801['model']=_[_0xca6f('0x40')](db[_0xca6f('0xb2')][_0xca6f('0x3c')]);_0x467801['query']=_[_0xca6f('0x40')](_0x3daa3d[_0xca6f('0x3f')]);_0x467801[_0xca6f('0x41')]=_[_0xca6f('0xb5')](_0x467801['model'],_0x467801['query']);_0x997848[_0xca6f('0x42')]=_['intersection'](_0x467801['model'],qs['fields'](_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x43')]));_0x997848[_0xca6f('0x42')]=_0x997848[_0xca6f('0x42')][_0xca6f('0x44')]?_0x997848[_0xca6f('0x42')]:_0x467801[_0xca6f('0x3e')];if(!_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x45')](_0xca6f('0x46'))){_0x997848[_0xca6f('0x20')]=qs[_0xca6f('0x20')](_0x3daa3d['query'][_0xca6f('0x20')]);_0x997848['offset']=qs[_0xca6f('0x1e')](_0x3daa3d[_0xca6f('0x3f')]['offset']);}_0x997848['order']=qs[_0xca6f('0x47')](_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x47')]);_0x997848[_0xca6f('0x48')]=qs[_0xca6f('0x41')](_[_0xca6f('0x49')](_0x3daa3d[_0xca6f('0x3f')],_0x467801[_0xca6f('0x41')]));_0x997848[_0xca6f('0x48')][_0xca6f('0xb6')]=_0x4388ff['id'];if(_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x83')]){_0x997848[_0xca6f('0x48')]=_[_0xca6f('0xac')](_0x997848[_0xca6f('0x48')],{'$or':_[_0xca6f('0x2c')](_0x997848[_0xca6f('0x42')],function(_0x28a72a){var _0xa5b73a={};_0xa5b73a[_0x28a72a]={'$like':'%'+_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x83')]+'%'};return _0xa5b73a;})});}if(_0x3daa3d['query'][_0xca6f('0x7c')]){var _0x400fa5=_0x3daa3d[_0xca6f('0x3f')][_0xca6f('0x7c')][_0xca6f('0x6f')](',');var _0x173d3c={};_0x173d3c[_0x400fa5[0x0]]={'$gte':moment(_0x400fa5[0x1])[_0xca6f('0xb7')](_0xca6f('0xb8'))};_0x997848[_0xca6f('0x48')]=_[_0xca6f('0xac')](_0x997848['where'],_0x173d3c);}_0x997848=_[_0xca6f('0xac')]({},_0x997848,_0x3daa3d[_0xca6f('0xad')]);return db[_0xca6f('0xb2')]['count']({'where':_0x997848['where']})[_0xca6f('0x27')](function(_0x306f63){_0x8d98d8[_0xca6f('0x21')]=_0x306f63;if(_0x3daa3d['query'][_0xca6f('0xab')]){_0x997848[_0xca6f('0xb9')]=[{'all':!![]}];}return db[_0xca6f('0xb2')]['findAll'](_0x997848);})[_0xca6f('0x27')](function(_0x1673e){_0x8d98d8[_0xca6f('0xa8')]=_0x1673e;return _0x8d98d8;});}})['then'](respondWithFilteredResult(_0x447b32,_0x997848))[_0xca6f('0x32')](handleError(_0x447b32,null));};exports['addTags']=function(_0xa4f97f,_0x24ab78,_0x129ec8){return db['FaxInteraction']['find']({'where':{'id':_0xa4f97f[_0xca6f('0xaa')]['id']}})[_0xca6f('0x27')](handleEntityNotFound(_0x24ab78,null))[_0xca6f('0x27')](function(_0x3ac733){if(_0x3ac733){return _0x3ac733[_0xca6f('0xba')](_0xa4f97f[_0xca6f('0xaf')][_0xca6f('0xb3')],_[_0xca6f('0xbb')](_0xa4f97f[_0xca6f('0xaf')],[_0xca6f('0xb3'),'id'])||{})[_0xca6f('0xbc')](function(){return db[_0xca6f('0x6e')][_0xca6f('0xbd')]({'attributes':['id',_0xca6f('0x2a'),'color'],'where':{'id':_0xa4f97f[_0xca6f('0xaf')]['ids']}});})['then'](function(_0x4632bc){socket[_0xca6f('0xbe')](_0xca6f('0xbf'),{'id':Number(_0xa4f97f[_0xca6f('0xaa')]['id']),'tags':_0x4632bc||[]});return{'id':Number(_0xa4f97f[_0xca6f('0xaa')]['id']),'tags':_0x4632bc||[]};});}})[_0xca6f('0x27')](respondWithResult(_0x24ab78,null))[_0xca6f('0x32')](handleError(_0x24ab78,null));};exports[_0xca6f('0xc0')]=function(_0x55d338,_0x467530,_0x8c49dc){return db['FaxInteraction'][_0xca6f('0x61')]({'where':{'id':_0x55d338[_0xca6f('0xaa')]['id']}})['then'](handleEntityNotFound(_0x467530,null))['then'](function(_0x5aa694){if(_0x5aa694){return _0x5aa694[_0xca6f('0xc0')](_0x55d338[_0xca6f('0x3f')][_0xca6f('0xb3')]);}})[_0xca6f('0x27')](respondWithStatusCode(_0x467530,null))[_0xca6f('0x32')](handleError(_0x467530,null));};exports[_0xca6f('0xc1')]=function(_0x27c6cf,_0x52ac90){var _0x2a6a43=moment()[_0xca6f('0xc2')]()['toString']();var _0x3d95f=path[_0xca6f('0xc3')](config[_0xca6f('0xc4')],'server',_0xca6f('0xc5'),_0xca6f('0xc6'));var _0x5bf610=path[_0xca6f('0xc3')](config[_0xca6f('0xc4')],_0xca6f('0xc7'),_0xca6f('0xc5'),_0xca6f('0xc8'));var _0x63ba48=path['join'](_0x3d95f,_0x2a6a43);var _0x133283=util['format'](_0xca6f('0xc9'),_0x27c6cf[_0xca6f('0xaa')]['id'],_0x2a6a43);var _0x2cbffd=path[_0xca6f('0xc3')](_0x3d95f,_0x133283);var _0x3ac4ba=[];_0x3ac4ba[_0xca6f('0x31')]({'model':db[_0xca6f('0xca')],'as':_0xca6f('0xca'),'raw':!![]});var _0x44dce2=[{'model':db[_0xca6f('0xb2')],'as':'Messages','attributes':['id',_0xca6f('0xaf'),_0xca6f('0x7a')],'include':_0x3ac4ba}];return db[_0xca6f('0x3b')][_0xca6f('0x61')]({'where':{'id':_0x27c6cf[_0xca6f('0xaa')]['id']},'include':_0x44dce2})[_0xca6f('0x27')](handleEntityNotFound(_0x52ac90,null))['then'](function(_0x5a2a01){if(_0x5a2a01&&_0x5a2a01[_0xca6f('0xcb')]){var _0x48c132=_0x5a2a01[_0xca6f('0xcc')]({'plain':!![]});fs['mkdirSync'](_0x63ba48);for(var _0x5cc307=0x0;_0x5cc307<_0x48c132[_0xca6f('0xcb')][_0xca6f('0x44')];_0x5cc307++){var _0x303e1b=_0x48c132[_0xca6f('0xcb')][_0x5cc307][_0xca6f('0xca')];if(_0x303e1b){var _0x5f5321=path[_0xca6f('0xc3')](_0x5bf610,_0x303e1b['basename']);if(fs[_0xca6f('0xcd')](_0x5f5321)){fs['createReadStream'](_0x5f5321)[_0xca6f('0xce')](fs['createWriteStream'](path['join'](_0x63ba48,_0x303e1b['basename'])));}}}return BPromise[_0xca6f('0x90')]()['then'](function(){return new BPromise(function(_0xd05855,_0x603772){zipdir(_0x63ba48,{'saveTo':_0x2cbffd},function(_0x40ff35,_0x330025){if(_0x40ff35)return _0x603772(_0x40ff35);return _0xd05855(_0x330025);});})[_0xca6f('0x27')](function(){return new BPromise(function(_0x288301,_0x1a87cd){rimraf(_0x63ba48,function(_0xd0d1b){if(_0xd0d1b)_0x1a87cd(_0xd0d1b);return _0x288301();});});})['then'](function(){return _0x52ac90['download'](_0x2cbffd,_0x133283,function(_0x3e30a8){if(_0x3e30a8){console[_0xca6f('0xcf')](_0xca6f('0xd0'),_0x3e30a8);}else{fs[_0xca6f('0xd1')](_0x2cbffd);}});});});}else{return _0x52ac90[_0xca6f('0x1a')](0xc8);}})['catch'](handleError(_0x52ac90,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index efa4bce..d573800 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 _0xe020=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x2aa092,_0x4e1f69){var _0x41998a=function(_0xe9db49){while(--_0xe9db49){_0x2aa092['push'](_0x2aa092['shift']());}};_0x41998a(++_0x4e1f69);}(_0xe020,0x1b9));var _0x0e02=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xe020[_0x1beef3];return _0x5af964;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x0e02('0x0')];var FaxMessage=require('../../mysqldb')['db'][_0x0e02('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0e02('0x2')](0x0);var events={'afterCreate':_0x0e02('0x3'),'afterUpdate':_0x0e02('0x4'),'afterDestroy':_0x0e02('0x5')};function emitEvent(_0x113f43){return function(_0x29834d,_0x5b7fb6,_0x23fbea){_0x29834d[_0x0e02('0x6')]({'attributes':['id'],'raw':!![]})[_0x0e02('0x7')](function(_0x19c067){_0x29834d[_0x0e02('0x8')](_0x0e02('0x9'),_0x19c067[_0x0e02('0xa')](function(_0xf0a910){return{'id':_0xf0a910['id']};}));return FaxMessage[_0x0e02('0xb')]({'where':{'FaxInteractionId':_0x29834d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x11ab5e){_0x29834d['setDataValue'](_0x0e02('0xc'),_0x11ab5e['length']);FaxInteractionEvents['emit'](_0x113f43+':'+_0x29834d['id'],_0x29834d);FaxInteractionEvents[_0x0e02('0xd')](_0x113f43,_0x29834d);_0x23fbea(null);})[_0x0e02('0xe')](_0x23fbea(null));};}for(var e in events){if(events[_0x0e02('0xf')](e)){var event=events[e];FaxInteraction[_0x0e02('0x10')](e,emitEvent(event));}}module[_0x0e02('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xda1d=['emit','catch','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x17a0a0,_0x1befaa){var _0x4da752=function(_0x429829){while(--_0x429829){_0x17a0a0['push'](_0x17a0a0['shift']());}};_0x4da752(++_0x1befaa);}(_0xda1d,0x1f1));var _0xdda1=function(_0x1c62a9,_0x374488){_0x1c62a9=_0x1c62a9-0x0;var _0x20ac7b=_0xda1d[_0x1c62a9];return _0x20ac7b;};'use strict';var EventEmitter=require(_0xdda1('0x0'));var FaxInteraction=require(_0xdda1('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xdda1('0x1'))['db'][_0xdda1('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xdda1('0x3')](0x0);var events={'afterCreate':_0xdda1('0x4'),'afterUpdate':'update','afterDestroy':_0xdda1('0x5')};function emitEvent(_0x3d2c20){return function(_0x450934,_0x5c8198,_0x2cca5f){_0x450934[_0xdda1('0x6')]({'attributes':['id'],'raw':!![]})[_0xdda1('0x7')](function(_0x138586){_0x450934[_0xdda1('0x8')]('Users',_0x138586[_0xdda1('0x9')](function(_0x1dcd1e){return{'id':_0x1dcd1e['id']};}));return FaxMessage[_0xdda1('0xa')]({'where':{'FaxInteractionId':_0x450934['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdda1('0x7')](function(_0x2b5366){_0x450934['setDataValue'](_0xdda1('0xb'),_0x2b5366[_0xdda1('0xc')]);FaxInteractionEvents[_0xdda1('0xd')](_0x3d2c20+':'+_0x450934['id'],_0x450934);FaxInteractionEvents['emit'](_0x3d2c20,_0x450934);_0x2cca5f(null);})[_0xdda1('0xe')](_0x2cca5f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xdda1('0xf')](e,emitEvent(event));}}module[_0xdda1('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 870db52..a1f6d15 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 _0xd89d=['api','moment','bluebird','path','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x394af8,_0x390a27){var _0x5bc5b3=function(_0x20a631){while(--_0x20a631){_0x394af8['push'](_0x394af8['shift']());}};_0x5bc5b3(++_0x390a27);}(_0xd89d,0xce));var _0xdd89=function(_0x12b011,_0x4df445){_0x12b011=_0x12b011-0x0;var _0x55ba6c=_0xd89d[_0x12b011];return _0x55ba6c;};'use strict';var _=require(_0xdd89('0x0'));var util=require('util');var logger=require(_0xdd89('0x1'))(_0xdd89('0x2'));var moment=require(_0xdd89('0x3'));var BPromise=require(_0xdd89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd89('0x5'));var rimraf=require('rimraf');var config=require(_0xdd89('0x6'));var attributes=require(_0xdd89('0x7'));module['exports']=function(_0x5f628,_0x3c9435){return _0x5f628['define'](_0xdd89('0x8'),attributes,{'tableName':_0xdd89('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xad895,_0xc63263,_0x14a1c3){if(_0xad895[_0xdd89('0xa')]('closed')){_0xad895[_0xdd89('0xb')]=moment()['format'](_0xdd89('0xc'));}_0x14a1c3(null,_0xad895);}}});}; \ No newline at end of file +var _0x4049=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a148f,_0x114dfa){var _0x5af2d4=function(_0x6a9ba4){while(--_0x6a9ba4){_0x5a148f['push'](_0x5a148f['shift']());}};_0x5af2d4(++_0x114dfa);}(_0x4049,0x177));var _0x9404=function(_0x30e899,_0x127f10){_0x30e899=_0x30e899-0x0;var _0x462e0f=_0x4049[_0x30e899];return _0x462e0f;};'use strict';var _=require(_0x9404('0x0'));var util=require(_0x9404('0x1'));var logger=require(_0x9404('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9404('0x3'));var rp=require(_0x9404('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9404('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x9404('0x6')]=function(_0x60a82e,_0x2f42c7){return _0x60a82e[_0x9404('0x7')](_0x9404('0x8'),attributes,{'tableName':_0x9404('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40d475,_0x3d15a6,_0x3b93a1){if(_0x40d475[_0x9404('0xa')](_0x9404('0xb'))){_0x40d475[_0x9404('0xc')]=moment()[_0x9404('0xd')](_0x9404('0xe'));}_0x3b93a1(null,_0x40d475);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 746e1ac..377107d 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 _0x182e=['client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','debug','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1eb9d0,_0x527c15){var _0x1818c4=function(_0x524224){while(--_0x524224){_0x1eb9d0['push'](_0x1eb9d0['shift']());}};_0x1818c4(++_0x527c15);}(_0x182e,0x1af));var _0xe182=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x182e[_0x45c981];return _0x4f62c8;};'use strict';var _=require(_0xe182('0x0'));var util=require(_0xe182('0x1'));var moment=require(_0xe182('0x2'));var BPromise=require('bluebird');var rs=require(_0xe182('0x3'));var fs=require('fs');var Redis=require(_0xe182('0x4'));var db=require(_0xe182('0x5'))['db'];var utils=require(_0xe182('0x6'));var logger=require('../../config/logger')(_0xe182('0x7'));var config=require(_0xe182('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe182('0x9')][_0xe182('0xa')]({'port':0x232a});config['redis']=_[_0xe182('0xb')](config[_0xe182('0xc')],{'host':_0xe182('0xd'),'port':0x18eb});var socket=require(_0xe182('0xe'))(new Redis(config[_0xe182('0xc')]));require(_0xe182('0xf'))['register'](socket);function respondWithRpcPromise(_0x4adc8a,_0x402feb,_0x2d797c){return new BPromise(function(_0x376903,_0x1e04b7){return client[_0xe182('0x10')](_0x4adc8a,_0x2d797c)['then'](function(_0x7be8a1){logger[_0xe182('0x11')](_0xe182('0x12'),_0x402feb,_0xe182('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x402feb,_0xe182('0x13'),JSON[_0xe182('0x14')](_0x7be8a1));if(_0x7be8a1[_0xe182('0x15')]){if(_0x7be8a1[_0xe182('0x15')][_0xe182('0x16')]===0x1f4){logger['error'](_0xe182('0x12'),_0x402feb,_0x7be8a1['error'][_0xe182('0x17')]);return _0x1e04b7(_0x7be8a1[_0xe182('0x15')][_0xe182('0x17')]);}logger[_0xe182('0x15')](_0xe182('0x12'),_0x402feb,_0x7be8a1[_0xe182('0x15')][_0xe182('0x17')]);return _0x376903(_0x7be8a1['error']['message']);}else{logger[_0xe182('0x11')](_0xe182('0x12'),_0x402feb,_0xe182('0x13'));_0x376903(_0x7be8a1[_0xe182('0x18')][_0xe182('0x17')]);}})[_0xe182('0x19')](function(_0x583be4){logger[_0xe182('0x15')](_0xe182('0x12'),_0x402feb,_0x583be4);_0x1e04b7(_0x583be4);});});}exports[_0xe182('0x1a')]=function(_0x5a5ba7){var _0x2d0036=this;return new Promise(function(_0x20fd12,_0x2c738e){return db[_0xe182('0x1b')][_0xe182('0x1c')](_0x5a5ba7[_0xe182('0x1d')],{'raw':_0x5a5ba7[_0xe182('0x1e')]?_0x5a5ba7[_0xe182('0x1e')][_0xe182('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5ba7[_0xe182('0x1e')]?_0x5a5ba7[_0xe182('0x1e')][_0xe182('0x20')]||null:null,'attributes':_0x5a5ba7[_0xe182('0x1e')]?_0x5a5ba7[_0xe182('0x1e')][_0xe182('0x21')]||null:null,'limit':_0x5a5ba7['options']?_0x5a5ba7['options'][_0xe182('0x22')]||null:null})[_0xe182('0x23')](function(_0x5d2950){logger[_0xe182('0x11')](_0xe182('0x1a'),_0x5a5ba7);logger[_0xe182('0x24')](_0xe182('0x1a'),_0x5a5ba7,JSON[_0xe182('0x14')](_0x5d2950));_0x20fd12(_0x5d2950);})[_0xe182('0x19')](function(_0x503d90){logger[_0xe182('0x15')]('UpdateFaxInteraction',_0x503d90['message'],_0x5a5ba7);_0x2c738e(_0x2d0036[_0xe182('0x15')](0x1f4,_0x503d90['message']));});});};exports[_0xe182('0x25')]=function(_0x11bd9d){return new Promise(function(_0x2ca57c,_0x2485a9){return db[_0xe182('0x1b')][_0xe182('0x26')]({'where':_0x11bd9d[_0xe182('0x1e')]?_0x11bd9d[_0xe182('0x1e')][_0xe182('0x20')]||null:null})['then'](function(_0x2b4f5d){if(_0x2b4f5d){return _0x2b4f5d[_0xe182('0x27')](_0x11bd9d[_0xe182('0x1d')]['ids'],_[_0xe182('0x28')](_0x11bd9d['body'],[_0xe182('0x29'),'id'])||{});}})[_0xe182('0x2a')](function(_0x584536){logger[_0xe182('0x11')](_0xe182('0x2b'),_0x11bd9d);logger[_0xe182('0x24')](_0xe182('0x2b'),_0x11bd9d,JSON[_0xe182('0x14')](_0x584536));_0x2ca57c(_0x584536);})[_0xe182('0x19')](function(_0x1a16d9){logger[_0xe182('0x15')](_0xe182('0x2b'),_0x1a16d9[_0xe182('0x17')],_0x11bd9d);_0x2485a9(_this[_0xe182('0x15')](0x1f4,_0x1a16d9[_0xe182('0x17')]));});});}; \ No newline at end of file +var _0x7cf2=['code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','AddTagsToFaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x73029b,_0x3df32d){var _0x4ef368=function(_0x106423){while(--_0x106423){_0x73029b['push'](_0x73029b['shift']());}};_0x4ef368(++_0x3df32d);}(_0x7cf2,0x102));var _0x27cf=function(_0x42b789,_0x46d8d4){_0x42b789=_0x42b789-0x0;var _0x3dee14=_0x7cf2[_0x42b789];return _0x3dee14;};'use strict';var _=require(_0x27cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x27cf('0x1'));var rs=require(_0x27cf('0x2'));var fs=require('fs');var Redis=require(_0x27cf('0x3'));var db=require(_0x27cf('0x4'))['db'];var utils=require(_0x27cf('0x5'));var logger=require(_0x27cf('0x6'))(_0x27cf('0x7'));var config=require(_0x27cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x27cf('0x9')][_0x27cf('0xa')]({'port':0x232a});config[_0x27cf('0xb')]=_['defaults'](config[_0x27cf('0xb')],{'host':_0x27cf('0xc'),'port':0x18eb});var socket=require(_0x27cf('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x27cf('0xe')](socket);function respondWithRpcPromise(_0x5252e2,_0x5b5744,_0x18feb6){return new BPromise(function(_0x2e26c7,_0x4738a5){return client['request'](_0x5252e2,_0x18feb6)[_0x27cf('0xf')](function(_0x3e3f9a){logger['info'](_0x27cf('0x10'),_0x5b5744,_0x27cf('0x11'));logger[_0x27cf('0x12')](_0x27cf('0x13'),_0x5b5744,_0x27cf('0x11'),JSON[_0x27cf('0x14')](_0x3e3f9a));if(_0x3e3f9a['error']){if(_0x3e3f9a[_0x27cf('0x15')][_0x27cf('0x16')]===0x1f4){logger['error'](_0x27cf('0x10'),_0x5b5744,_0x3e3f9a[_0x27cf('0x15')][_0x27cf('0x17')]);return _0x4738a5(_0x3e3f9a[_0x27cf('0x15')][_0x27cf('0x17')]);}logger['error'](_0x27cf('0x10'),_0x5b5744,_0x3e3f9a[_0x27cf('0x15')][_0x27cf('0x17')]);return _0x2e26c7(_0x3e3f9a[_0x27cf('0x15')]['message']);}else{logger[_0x27cf('0x18')](_0x27cf('0x10'),_0x5b5744,_0x27cf('0x11'));_0x2e26c7(_0x3e3f9a[_0x27cf('0x19')][_0x27cf('0x17')]);}})[_0x27cf('0x1a')](function(_0x1c4985){logger[_0x27cf('0x15')](_0x27cf('0x10'),_0x5b5744,_0x1c4985);_0x4738a5(_0x1c4985);});});}exports[_0x27cf('0x1b')]=function(_0x472bce){var _0x1fe812=this;return new Promise(function(_0x58bea6,_0x5605f3){return db[_0x27cf('0x1c')][_0x27cf('0x1d')](_0x472bce['body'],{'raw':_0x472bce['options']?_0x472bce[_0x27cf('0x1e')][_0x27cf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x472bce[_0x27cf('0x1e')]?_0x472bce[_0x27cf('0x1e')]['where']||null:null,'attributes':_0x472bce[_0x27cf('0x1e')]?_0x472bce[_0x27cf('0x1e')][_0x27cf('0x20')]||null:null,'limit':_0x472bce[_0x27cf('0x1e')]?_0x472bce[_0x27cf('0x1e')]['limit']||null:null})[_0x27cf('0xf')](function(_0x8b2ae9){logger[_0x27cf('0x18')](_0x27cf('0x1b'),_0x472bce);logger['debug'](_0x27cf('0x1b'),_0x472bce,JSON[_0x27cf('0x14')](_0x8b2ae9));_0x58bea6(_0x8b2ae9);})[_0x27cf('0x1a')](function(_0x4f8210){logger[_0x27cf('0x15')](_0x27cf('0x1b'),_0x4f8210['message'],_0x472bce);_0x5605f3(_0x1fe812['error'](0x1f4,_0x4f8210['message']));});});};exports[_0x27cf('0x21')]=function(_0x20545c){return new Promise(function(_0xdda066,_0x4f7d9b){return db[_0x27cf('0x1c')][_0x27cf('0x22')]({'where':_0x20545c['options']?_0x20545c['options']['where']||null:null})[_0x27cf('0xf')](function(_0x362ab4){if(_0x362ab4){return _0x362ab4[_0x27cf('0x23')](_0x20545c[_0x27cf('0x24')][_0x27cf('0x25')],_['omit'](_0x20545c[_0x27cf('0x24')],[_0x27cf('0x25'),'id'])||{});}})[_0x27cf('0x26')](function(_0x2d26f3){logger[_0x27cf('0x18')](_0x27cf('0x27'),_0x20545c);logger[_0x27cf('0x12')](_0x27cf('0x27'),_0x20545c,JSON[_0x27cf('0x14')](_0x2d26f3));_0xdda066(_0x2d26f3);})[_0x27cf('0x1a')](function(_0x484794){logger['error'](_0x27cf('0x27'),_0x484794[_0x27cf('0x17')],_0x20545c);_0x4f7d9b(_this[_0x27cf('0x15')](0x1f4,_0x484794[_0x27cf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ab32e90..1bd855b 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 _0x76cd=['register','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x534a02,_0x288eef){var _0x30f7c1=function(_0x593734){while(--_0x593734){_0x534a02['push'](_0x534a02['shift']());}};_0x30f7c1(++_0x288eef);}(_0x76cd,0x174));var _0xd76c=function(_0x11aa4e,_0x4f1ee2){_0x11aa4e=_0x11aa4e-0x0;var _0x1b897b=_0x76cd[_0x11aa4e];return _0x1b897b;};'use strict';var FaxInteractionEvents=require(_0xd76c('0x0'));var events=[_0xd76c('0x1'),_0xd76c('0x2'),_0xd76c('0x3')];function createListener(_0x9495d8,_0x164d6c){return function(_0x2d5aa5){_0x164d6c[_0xd76c('0x4')](_0x9495d8,_0x2d5aa5);};}function removeListener(_0x80f396,_0x5ce072){return function(){FaxInteractionEvents[_0xd76c('0x5')](_0x80f396,_0x5ce072);};}exports[_0xd76c('0x6')]=function(_0x449558){for(var _0x3766f8=0x0,_0x4d01da=events['length'];_0x3766f8<_0x4d01da;_0x3766f8++){var _0x3caeae=events[_0x3766f8];var _0x4af349=createListener('faxInteraction:'+_0x3caeae,_0x449558);FaxInteractionEvents['on'](_0x3caeae,_0x4af349);}}; \ No newline at end of file +var _0xce22=['remove','emit','removeListener','faxInteraction:'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xce22,0xb4));var _0x2ce2=function(_0x4e0863,_0x1ec822){_0x4e0863=_0x4e0863-0x0;var _0x3133d7=_0xce22[_0x4e0863];return _0x3133d7;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x2ce2('0x0'),'update'];function createListener(_0x3c4725,_0x1dcc6b){return function(_0x4649da){_0x1dcc6b[_0x2ce2('0x1')](_0x3c4725,_0x4649da);};}function removeListener(_0x5a5a95,_0xff4aeb){return function(){FaxInteractionEvents[_0x2ce2('0x2')](_0x5a5a95,_0xff4aeb);};}exports['register']=function(_0xc3249){for(var _0xe80ba2=0x0,_0x5c477d=events['length'];_0xe80ba2<_0x5c477d;_0xe80ba2++){var _0x4a56ac=events[_0xe80ba2];var _0x1b503c=createListener(_0x2ce2('0x3')+_0x4a56ac,_0xc3249);FaxInteractionEvents['on'](_0x4a56ac,_0x1b503c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 873b457..ffd61f9 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 _0x1413=['addTags','put','/:id/tags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','fax'];(function(_0x5521d8,_0x2571b3){var _0x6723c5=function(_0x24ed57){while(--_0x24ed57){_0x5521d8['push'](_0x5521d8['shift']());}};_0x6723c5(++_0x2571b3);}(_0x1413,0x170));var _0x3141=function(_0x221d29,_0x47f0ac){_0x221d29=_0x221d29-0x0;var _0x4b6a6b=_0x1413[_0x221d29];return _0x4b6a6b;};'use strict';var multer=require('multer');var util=require(_0x3141('0x0'));var path=require(_0x3141('0x1'));var timeout=require(_0x3141('0x2'));var express=require(_0x3141('0x3'));var router=express['Router']();var fs_extra=require(_0x3141('0x4'));var auth=require(_0x3141('0x5'));var interaction=require(_0x3141('0x6'));var config=require(_0x3141('0x7'));var controller=require(_0x3141('0x8'));router['get']('/',auth[_0x3141('0x9')](),controller['index']);router[_0x3141('0xa')](_0x3141('0xb'),auth[_0x3141('0x9')](),controller['describe']);router[_0x3141('0xa')](_0x3141('0xc'),auth['isAuthenticated'](),controller[_0x3141('0xd')]);router[_0x3141('0xa')](_0x3141('0xe'),auth[_0x3141('0x9')](),controller[_0x3141('0xf')]);router['get'](_0x3141('0x10'),auth[_0x3141('0x9')](),controller[_0x3141('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3141('0x12')]);router[_0x3141('0x13')](_0x3141('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3141('0x13')]('/:id/tags',auth[_0x3141('0x9')](),interaction[_0x3141('0x14')](_0x3141('0x15'),'faxinteraction:addtags'),controller[_0x3141('0x16')]);router[_0x3141('0x17')]('/:id',auth[_0x3141('0x9')](),interaction[_0x3141('0x14')](_0x3141('0x15'),'faxinteraction:update'),controller['update']);router['delete'](_0x3141('0xc'),auth[_0x3141('0x9')](),interaction['tracked'](_0x3141('0x15'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0x3141('0x18'),auth[_0x3141('0x9')](),controller['removeTags']);module[_0x3141('0x19')]=router; \ No newline at end of file +var _0xf541=['removeTags','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy'];(function(_0x8bfc39,_0x3987bf){var _0x36c3de=function(_0x101a97){while(--_0x101a97){_0x8bfc39['push'](_0x8bfc39['shift']());}};_0x36c3de(++_0x3987bf);}(_0xf541,0x176));var _0x1f54=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xf541[_0x2ff4bd];return _0x28edc6;};'use strict';var multer=require(_0x1f54('0x0'));var util=require(_0x1f54('0x1'));var path=require(_0x1f54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f54('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1f54('0x4'));var config=require(_0x1f54('0x5'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1f54('0x6')]);router[_0x1f54('0x7')](_0x1f54('0x8'),auth[_0x1f54('0x9')](),controller['describe']);router[_0x1f54('0x7')]('/:id',auth[_0x1f54('0x9')](),controller[_0x1f54('0xa')]);router[_0x1f54('0x7')](_0x1f54('0xb'),auth[_0x1f54('0x9')](),controller['getMessages']);router['get'](_0x1f54('0xc'),auth[_0x1f54('0x9')](),controller[_0x1f54('0xd')]);router['post']('/',auth[_0x1f54('0x9')](),controller[_0x1f54('0xe')]);router[_0x1f54('0xf')](_0x1f54('0xb'),auth[_0x1f54('0x9')](),controller[_0x1f54('0x10')]);router['post'](_0x1f54('0x11'),auth[_0x1f54('0x9')](),interaction[_0x1f54('0x12')](_0x1f54('0x13'),_0x1f54('0x14')),controller[_0x1f54('0x15')]);router[_0x1f54('0x16')](_0x1f54('0x17'),auth[_0x1f54('0x9')](),interaction['tracked']('fax',_0x1f54('0x18')),controller[_0x1f54('0x19')]);router[_0x1f54('0x1a')](_0x1f54('0x17'),auth['isAuthenticated'](),interaction[_0x1f54('0x12')](_0x1f54('0x13'),_0x1f54('0x1b')),controller[_0x1f54('0x1c')]);router['delete']('/:id/tags',auth[_0x1f54('0x9')](),controller[_0x1f54('0x1d')]);module[_0x1f54('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d975b76..79e7ec5 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 _0x3e74=['DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x339849,_0x561091){var _0x5436a3=function(_0x506c65){while(--_0x506c65){_0x339849['push'](_0x339849['shift']());}};_0x5436a3(++_0x561091);}(_0x3e74,0x175));var _0x43e7=function(_0x5c5334,_0x1ce468){_0x5c5334=_0x5c5334-0x0;var _0x1a85a8=_0x3e74[_0x5c5334];return _0x1a85a8;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'body':{'type':Sequelize[_0x43e7('0x1')](_0x43e7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x43e7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x43e7('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x43e7('0x5')]}}; \ No newline at end of file +var _0x3685=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x4cf437,_0x2112b9){var _0x5cd8ab=function(_0xfa10c8){while(--_0xfa10c8){_0x4cf437['push'](_0x4cf437['shift']());}};_0x5cd8ab(++_0x2112b9);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x5368('0x0'));module['exports']={'body':{'type':Sequelize[_0x5368('0x1')](_0x5368('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5368('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5368('0x4')]('in',_0x5368('0x5')),'defaultValue':_0x5368('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5368('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5368('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5be7503..2251181 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 _0x4f2e=['Attachment','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','options','includeAll','findAll','rows','params','fields','body','find','describe','fax-interactions','fax','read','format','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','email','rejectmessage','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','root','server','files','attachments'];(function(_0x172739,_0x391008){var _0x20ff3f=function(_0x33e7a6){while(--_0x33e7a6){_0x172739['push'](_0x172739['shift']());}};_0x20ff3f(++_0x391008);}(_0x4f2e,0x1b1));var _0xe4f2=function(_0x25c4f6,_0x1d79a6){_0x25c4f6=_0x25c4f6-0x0;var _0x1279a7=_0x4f2e[_0x25c4f6];return _0x1279a7;};'use strict';var emlformat=require(_0xe4f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4f2('0x1'));var jsonpatch=require(_0xe4f2('0x2'));var rp=require('request-promise');var moment=require(_0xe4f2('0x3'));var BPromise=require(_0xe4f2('0x4'));var Mustache=require(_0xe4f2('0x5'));var util=require('util');var path=require(_0xe4f2('0x6'));var sox=require('sox');var csv=require(_0xe4f2('0x7'));var ejs=require(_0xe4f2('0x8'));var fs=require('fs');var fs_extra=require(_0xe4f2('0x9'));var _=require(_0xe4f2('0xa'));var squel=require(_0xe4f2('0xb'));var crypto=require(_0xe4f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4f2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe4f2('0xe'));var Papa=require(_0xe4f2('0xf'));var Redis=require(_0xe4f2('0x10'));var authService=require(_0xe4f2('0x11'));var qs=require(_0xe4f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4f2('0x13'));var logger=require(_0xe4f2('0x14'))(_0xe4f2('0x15'));var utils=require(_0xe4f2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe4f2('0x17')]=_[_0xe4f2('0x18')](config[_0xe4f2('0x17')],{'host':_0xe4f2('0x19'),'port':0x18eb});var socket=require(_0xe4f2('0x1a'))(new Redis(config[_0xe4f2('0x17')]));require(_0xe4f2('0x1b'))[_0xe4f2('0x1c')](socket);var jayson=require(_0xe4f2('0x1d'));var client=jayson[_0xe4f2('0x1e')][_0xe4f2('0x1f')]({'port':0x232c});var client9002=jayson[_0xe4f2('0x1e')][_0xe4f2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5bcea7,_0x5bbba2,_0x5211fb,_0x552d63){return new BPromise(function(_0x5af72f,_0x3eb5e5){var _0x1631ec=_0x552d63||client;return _0x1631ec[_0xe4f2('0x20')](_0x5bcea7,_0x5211fb)[_0xe4f2('0x21')](function(_0x4e76b2){logger[_0xe4f2('0x22')](_0xe4f2('0x23'),_0x5bbba2,'request\x20sent');logger[_0xe4f2('0x24')](_0xe4f2('0x25'),_0x5bbba2,'request\x20sent',JSON[_0xe4f2('0x26')](_0x4e76b2));if(_0x4e76b2[_0xe4f2('0x27')]){if(_0x4e76b2['error'][_0xe4f2('0x28')]===0x1f4){logger[_0xe4f2('0x27')](_0xe4f2('0x23'),_0x5bbba2,_0x4e76b2[_0xe4f2('0x27')][_0xe4f2('0x29')]);return _0x3eb5e5(_0x4e76b2[_0xe4f2('0x27')]['message']);}logger[_0xe4f2('0x27')]('FaxMessage,\x20%s,\x20%s',_0x5bbba2,_0x4e76b2[_0xe4f2('0x27')][_0xe4f2('0x29')]);return _0x5af72f(_0x4e76b2[_0xe4f2('0x27')]['message']);}else{logger[_0xe4f2('0x22')]('FaxMessage,\x20%s,\x20%s',_0x5bbba2,_0xe4f2('0x2a'));_0x5af72f(_0x4e76b2[_0xe4f2('0x2b')][_0xe4f2('0x29')]);}})[_0xe4f2('0x2c')](function(_0x37d2a1){logger[_0xe4f2('0x27')](_0xe4f2('0x23'),_0x5bbba2,_0x37d2a1);_0x3eb5e5(_0x37d2a1);});});}function respondWithStatusCode(_0x35e49f,_0x42c609){_0x42c609=_0x42c609||0xcc;return function(_0x1b8c7c){if(_0x1b8c7c){return _0x35e49f[_0xe4f2('0x2d')](_0x42c609);}return _0x35e49f[_0xe4f2('0x2e')](_0x42c609)[_0xe4f2('0x2f')]();};}function respondWithResult(_0x574270,_0x552a2b){_0x552a2b=_0x552a2b||0xc8;return function(_0x356af5){if(_0x356af5){return _0x574270[_0xe4f2('0x2e')](_0x552a2b)[_0xe4f2('0x30')](_0x356af5);}};}function respondWithFilteredResult(_0x71502d,_0x28c38b){return function(_0x14f3f3){if(_0x14f3f3){var _0x10d937=typeof _0x28c38b[_0xe4f2('0x31')]===_0xe4f2('0x32')&&typeof _0x28c38b[_0xe4f2('0x33')]===_0xe4f2('0x32');var _0x3712dc=_0x14f3f3[_0xe4f2('0x34')];var _0x46916e=_0x10d937?0x0:_0x28c38b[_0xe4f2('0x31')];var _0x4f7e96=_0x10d937?_0x14f3f3[_0xe4f2('0x34')]:_0x28c38b['offset']+_0x28c38b[_0xe4f2('0x33')];var _0x174844;if(_0x4f7e96>=_0x3712dc){_0x4f7e96=_0x3712dc;_0x174844=0xc8;}else{_0x174844=0xce;}_0x71502d[_0xe4f2('0x2e')](_0x174844);return _0x71502d[_0xe4f2('0x35')](_0xe4f2('0x36'),_0x46916e+'-'+_0x4f7e96+'/'+_0x3712dc)[_0xe4f2('0x30')](_0x14f3f3);}return null;};}function patchUpdates(_0x58c240){return function(_0x351997){try{jsonpatch[_0xe4f2('0x37')](_0x351997,_0x58c240,!![]);}catch(_0x3a50de){return BPromise[_0xe4f2('0x38')](_0x3a50de);}return _0x351997[_0xe4f2('0x39')]();};}function saveUpdates(_0x1920ef,_0x4f16c7){return function(_0x2e1df7){if(_0x2e1df7){return _0x2e1df7[_0xe4f2('0x3a')](_0x1920ef)['then'](function(_0x1dea7f){return _0x1dea7f;});}return null;};}function removeEntity(_0x15c7a4,_0x3cc031){return function(_0x2310d4){if(_0x2310d4){return _0x2310d4[_0xe4f2('0x3b')]()['then'](function(){_0x15c7a4[_0xe4f2('0x2e')](0xcc)[_0xe4f2('0x2f')]();});}};}function handleEntityNotFound(_0x1c1eb6,_0x527ea7){return function(_0x4a72da){if(!_0x4a72da){_0x1c1eb6[_0xe4f2('0x2d')](0x194);}return _0x4a72da;};}function handleError(_0x8bcdb5,_0xef8766){_0xef8766=_0xef8766||0x1f4;return function(_0x56b45c){logger[_0xe4f2('0x27')](_0x56b45c[_0xe4f2('0x3c')]);if(_0x56b45c[_0xe4f2('0x3d')]){delete _0x56b45c[_0xe4f2('0x3d')];}_0x8bcdb5[_0xe4f2('0x2e')](_0xef8766)[_0xe4f2('0x3e')](_0x56b45c);};}exports[_0xe4f2('0x3f')]=function(_0x57f418,_0x3e027e){var _0x2f4444={},_0x21663e={},_0x2b11a9={'count':0x0,'rows':[]};var _0xfe5278=_[_0xe4f2('0x40')](db[_0xe4f2('0x41')][_0xe4f2('0x42')],function(_0x49678f){return{'name':_0x49678f[_0xe4f2('0x43')],'type':_0x49678f[_0xe4f2('0x44')][_0xe4f2('0x45')]};});_0x21663e[_0xe4f2('0x46')]=_[_0xe4f2('0x40')](_0xfe5278,_0xe4f2('0x3d'));_0x21663e['query']=_[_0xe4f2('0x47')](_0x57f418['query']);_0x21663e[_0xe4f2('0x48')]=_[_0xe4f2('0x49')](_0x21663e['model'],_0x21663e[_0xe4f2('0x4a')]);_0x2f4444[_0xe4f2('0x4b')]=_['intersection'](_0x21663e[_0xe4f2('0x46')],qs['fields'](_0x57f418[_0xe4f2('0x4a')]['fields']));_0x2f4444['attributes']=_0x2f4444[_0xe4f2('0x4b')][_0xe4f2('0x4c')]?_0x2f4444[_0xe4f2('0x4b')]:_0x21663e[_0xe4f2('0x46')];if(!_0x57f418[_0xe4f2('0x4a')][_0xe4f2('0x4d')](_0xe4f2('0x4e'))){_0x2f4444[_0xe4f2('0x33')]=qs[_0xe4f2('0x33')](_0x57f418[_0xe4f2('0x4a')][_0xe4f2('0x33')]);_0x2f4444['offset']=qs['offset'](_0x57f418[_0xe4f2('0x4a')][_0xe4f2('0x31')]);}_0x2f4444['order']=qs['sort'](_0x57f418[_0xe4f2('0x4a')][_0xe4f2('0x4f')]);_0x2f4444['where']=qs[_0xe4f2('0x48')](_[_0xe4f2('0x50')](_0x57f418[_0xe4f2('0x4a')],_0x21663e[_0xe4f2('0x48')]),_0xfe5278);if(_0x57f418[_0xe4f2('0x4a')]['filter']){_0x2f4444['where']=_[_0xe4f2('0x51')](_0x2f4444[_0xe4f2('0x52')],{'$or':_['map'](_0xfe5278,function(_0x31a6e8){if(_0x31a6e8['type']!==_0xe4f2('0x53')){var _0x7c8a97={};_0x7c8a97[_0x31a6e8['name']]={'$like':'%'+_0x57f418[_0xe4f2('0x4a')]['filter']+'%'};return _0x7c8a97;}})});}_0x2f4444=_[_0xe4f2('0x51')]({},_0x2f4444,_0x57f418[_0xe4f2('0x54')]);var _0x444ef0={'where':_0x2f4444['where']};return db['FaxMessage'][_0xe4f2('0x34')](_0x444ef0)['then'](function(_0x357803){_0x2b11a9[_0xe4f2('0x34')]=_0x357803;if(_0x57f418[_0xe4f2('0x4a')][_0xe4f2('0x55')]){_0x2f4444['include']=[{'all':!![]}];}return db[_0xe4f2('0x41')][_0xe4f2('0x56')](_0x2f4444);})[_0xe4f2('0x21')](function(_0x333c78){_0x2b11a9[_0xe4f2('0x57')]=_0x333c78;return _0x2b11a9;})[_0xe4f2('0x21')](respondWithFilteredResult(_0x3e027e,_0x2f4444))['catch'](handleError(_0x3e027e,null));};exports['show']=function(_0x5686fb,_0x119645){var _0x4c65be={'raw':!![],'where':{'id':_0x5686fb[_0xe4f2('0x58')]['id']}},_0x284653={};_0x284653['model']=_[_0xe4f2('0x47')](db['FaxMessage']['rawAttributes']);_0x284653[_0xe4f2('0x4a')]=_[_0xe4f2('0x47')](_0x5686fb[_0xe4f2('0x4a')]);_0x284653[_0xe4f2('0x48')]=_['intersection'](_0x284653['model'],_0x284653[_0xe4f2('0x4a')]);_0x4c65be[_0xe4f2('0x4b')]=_['intersection'](_0x284653[_0xe4f2('0x46')],qs[_0xe4f2('0x59')](_0x5686fb[_0xe4f2('0x4a')][_0xe4f2('0x59')]));_0x4c65be['attributes']=_0x4c65be['attributes'][_0xe4f2('0x4c')]?_0x4c65be[_0xe4f2('0x4b')]:_0x284653[_0xe4f2('0x46')];if(_0x5686fb[_0xe4f2('0x4a')][_0xe4f2('0x55')]){_0x4c65be['include']=[{'all':!![]}];}_0x4c65be=_['merge']({},_0x4c65be,_0x5686fb[_0xe4f2('0x54')]);return db[_0xe4f2('0x41')]['find'](_0x4c65be)[_0xe4f2('0x21')](handleEntityNotFound(_0x119645,null))[_0xe4f2('0x21')](respondWithResult(_0x119645,null))[_0xe4f2('0x2c')](handleError(_0x119645,null));};exports[_0xe4f2('0x3a')]=function(_0x2e40fb,_0xf1df08){if(_0x2e40fb[_0xe4f2('0x5a')]['id']){delete _0x2e40fb['body']['id'];}return db[_0xe4f2('0x41')][_0xe4f2('0x5b')]({'where':{'id':_0x2e40fb[_0xe4f2('0x58')]['id']}})['then'](handleEntityNotFound(_0xf1df08,null))[_0xe4f2('0x21')](saveUpdates(_0x2e40fb[_0xe4f2('0x5a')],null))[_0xe4f2('0x21')](respondWithResult(_0xf1df08,null))[_0xe4f2('0x2c')](handleError(_0xf1df08,null));};exports[_0xe4f2('0x3b')]=function(_0x2985da,_0x41fd07){return db[_0xe4f2('0x41')]['find']({'where':{'id':_0x2985da[_0xe4f2('0x58')]['id']}})[_0xe4f2('0x21')](handleEntityNotFound(_0x41fd07,null))['then'](removeEntity(_0x41fd07,null))[_0xe4f2('0x2c')](handleError(_0x41fd07,null));};exports[_0xe4f2('0x5c')]=function(_0x10c789,_0x327e49){return db[_0xe4f2('0x41')][_0xe4f2('0x5c')]()[_0xe4f2('0x21')](respondWithResult(_0x327e49,null))[_0xe4f2('0x2c')](handleError(_0x327e49,null));};var interaction_log=require(_0xe4f2('0x14'))(_0xe4f2('0x5d'));exports['accept']=function(_0x260f9a,_0x3da3a5,_0x16b500){var _0x1d5802={'agent':{},'channel':_0xe4f2('0x5e')};if(_0x260f9a[_0xe4f2('0x5a')]['id']){delete _0x260f9a[_0xe4f2('0x5a')]['id'];}_0x260f9a[_0xe4f2('0x5a')][_0xe4f2('0x5f')]=!![];_0x260f9a['body']['readAt']=moment()[_0xe4f2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x260f9a[_0xe4f2('0x5a')]['UserId']=_0x260f9a[_0xe4f2('0x5a')][_0xe4f2('0x61')]||_0x260f9a[_0xe4f2('0x62')]['id'];_0x1d5802[_0xe4f2('0x63')]['id']=_0x260f9a['body'][_0xe4f2('0x61')];return db[_0xe4f2('0x41')][_0xe4f2('0x5b')]({'where':{'id':_0x260f9a[_0xe4f2('0x58')]['id'],'UserId':null}})[_0xe4f2('0x21')](handleEntityNotFound(_0x3da3a5,null))[_0xe4f2('0x21')](saveUpdates(_0x260f9a[_0xe4f2('0x5a')],null))[_0xe4f2('0x21')](function(_0x846c1f){if(_0x846c1f){_0x1d5802[_0xe4f2('0x29')]=_0x846c1f[_0xe4f2('0x64')]({'plain':!![]});return db[_0xe4f2('0x65')][_0xe4f2('0x5b')]({'where':{'id':_0x846c1f['FaxInteractionId']}});}return null;})[_0xe4f2('0x21')](handleEntityNotFound(_0x3da3a5,null))[_0xe4f2('0x21')](function(_0x3a2331){if(_0x3a2331){return _0x3a2331[_0xe4f2('0x3a')]({'UserId':_0x260f9a['body'][_0xe4f2('0x61')],'read1stAt':_[_0xe4f2('0x66')](_0x3a2331[_0xe4f2('0x67')])?moment()[_0xe4f2('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x552126){if(_0x552126){_0x1d5802[_0xe4f2('0x68')]=_0x552126[_0xe4f2('0x64')]({'plain':!![]});interaction_log[_0xe4f2('0x22')](_0xe4f2('0x69'),_0x260f9a[_0xe4f2('0x62')]['id'],_0x260f9a[_0xe4f2('0x62')][_0xe4f2('0x3d')],_0x260f9a[_0xe4f2('0x62')][_0xe4f2('0x6a')],_0x1d5802['interaction']['id'],_0x260f9a[_0xe4f2('0x5a')]?JSON['stringify'](_0x260f9a['body']):_0xe4f2('0x6b'));return respondWithRpcPromise(_0xe4f2('0x6c'),_0xe4f2('0x6d'),_0x1d5802);}return null;})[_0xe4f2('0x21')](function(_0x4a0c49){var _0x3ece35=_0xe4f2('0x6e')+_0x4a0c49[_0xe4f2('0x29')][_0xe4f2('0x6f')];return db['sequelize'][_0xe4f2('0x4a')](_0x3ece35,{'type':db['Sequelize'][_0xe4f2('0x70')][_0xe4f2('0x71')],'raw':!![]})[_0xe4f2('0x21')](function(_0x4229c1){return _0x4229c1;});})[_0xe4f2('0x21')](function(_0x9305c9){if(_0x9305c9){_0x1d5802['message']['contact']=_0x9305c9[0x0];if(!_0x260f9a['body']['UserId'])return;return db[_0xe4f2('0x72')][_0xe4f2('0x5b')]({'where':{'id':_0x260f9a[_0xe4f2('0x5a')][_0xe4f2('0x61')],'role':_0xe4f2('0x63')},'attributes':['id',_0xe4f2('0x3d'),_0xe4f2('0x73'),'email',_0xe4f2('0x74')],'raw':!![]});}return null;})[_0xe4f2('0x21')](function(_0x2af417){if(!_0x2af417)return null;_0x1d5802[_0xe4f2('0x29')][_0xe4f2('0x63')]=_0x2af417;return _0x1d5802;})['then'](function(_0x5c96b2){if(_0x5c96b2){if(_0x260f9a['body'][_0xe4f2('0x75')]){_0x1d5802[_0xe4f2('0x29')][_0xe4f2('0x76')]=util[_0xe4f2('0x60')](_0xe4f2('0x77'),_0x260f9a[_0xe4f2('0x62')][_0xe4f2('0x3d')]);_0x1d5802[_0xe4f2('0x29')][_0xe4f2('0x78')]=_0x1d5802['channel'];_0x1d5802[_0xe4f2('0x29')][_0xe4f2('0x79')]=_0x1d5802['channel'];_0x1d5802[_0xe4f2('0x29')][_0xe4f2('0x7a')]=_0xe4f2('0x7b');return respondWithRpcPromise(_0xe4f2('0x7c'),_0xe4f2('0x7c'),{'event':_0xe4f2('0x7d'),'message':_0x1d5802[_0xe4f2('0x29')]},client9002)[_0xe4f2('0x21')](function(){return _0x1d5802;});}return _0x1d5802;}return null;})['then'](respondWithResult(_0x3da3a5,null))[_0xe4f2('0x2c')](handleError(_0x3da3a5,null));};var interaction_log=require(_0xe4f2('0x14'))('fax-interactions');exports[_0xe4f2('0x38')]=function(_0x34c26d,_0x296c04,_0x4deeeb){var _0x2c325f={'agent':{},'channel':'fax'};if(_0x34c26d[_0xe4f2('0x5a')]['id']){delete _0x34c26d[_0xe4f2('0x5a')]['id'];}_0x34c26d[_0xe4f2('0x5a')][_0xe4f2('0x61')]=_0x34c26d['body']['UserId']||_0x34c26d[_0xe4f2('0x62')]['id'];_0x2c325f[_0xe4f2('0x63')]['id']=_0x34c26d['body'][_0xe4f2('0x61')];return db['FaxMessage'][_0xe4f2('0x5b')]({'where':{'id':_0x34c26d[_0xe4f2('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x296c04,null))['then'](function(_0x15ff16){if(_0x15ff16){_0x2c325f[_0xe4f2('0x29')]=_0x15ff16[_0xe4f2('0x64')]({'plain':!![]});return db['FaxInteraction'][_0xe4f2('0x5b')]({'where':{'id':_0x15ff16[_0xe4f2('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x296c04,null))[_0xe4f2('0x21')](function(_0x240524){if(_0x240524){_0x2c325f[_0xe4f2('0x68')]=_0x240524[_0xe4f2('0x64')]({'plain':!![]});interaction_log[_0xe4f2('0x22')](_0xe4f2('0x7f'),_0x34c26d['user']['id'],_0x34c26d['user'][_0xe4f2('0x3d')],_0x34c26d[_0xe4f2('0x62')][_0xe4f2('0x6a')],_0x2c325f[_0xe4f2('0x68')]['id'],_0x34c26d[_0xe4f2('0x5a')]?JSON[_0xe4f2('0x26')](_0x34c26d['body']):_0xe4f2('0x6b'));return respondWithRpcPromise(_0xe4f2('0x80'),'rejectMessage',_0x2c325f);}return null;})[_0xe4f2('0x21')](function(_0x3638c2){var _0xe80070=_0xe4f2('0x6e')+_0x3638c2[_0xe4f2('0x29')][_0xe4f2('0x6f')];return db[_0xe4f2('0x81')][_0xe4f2('0x4a')](_0xe80070,{'type':db['Sequelize']['QueryTypes'][_0xe4f2('0x71')],'raw':!![]})[_0xe4f2('0x21')](function(_0x159be2){return _0x159be2;});})[_0xe4f2('0x21')](function(_0x4f4065){if(_0x4f4065){_0x2c325f[_0xe4f2('0x29')]['contact']=_0x4f4065[0x0];if(!_0x34c26d[_0xe4f2('0x5a')][_0xe4f2('0x61')])return;return db[_0xe4f2('0x72')][_0xe4f2('0x5b')]({'where':{'id':_0x34c26d[_0xe4f2('0x5a')][_0xe4f2('0x61')],'role':_0xe4f2('0x63')},'attributes':['id',_0xe4f2('0x3d'),_0xe4f2('0x73'),_0xe4f2('0x82'),'internal'],'raw':!![]});}return null;})[_0xe4f2('0x21')](function(_0x75af00){if(!_0x75af00)return null;_0x2c325f[_0xe4f2('0x29')][_0xe4f2('0x63')]=_0x75af00;return _0x2c325f;})[_0xe4f2('0x21')](function(_0x178dff){if(_0x178dff){_0x178dff[_0xe4f2('0x29')]['interface']=util[_0xe4f2('0x60')](_0xe4f2('0x77'),_0x34c26d[_0xe4f2('0x62')][_0xe4f2('0x3d')]);_0x178dff['message'][_0xe4f2('0x78')]=_0x2c325f['channel'];_0x178dff['message'][_0xe4f2('0x79')]=_0x2c325f[_0xe4f2('0x78')];_0x178dff[_0xe4f2('0x29')][_0xe4f2('0x7a')]=_0xe4f2('0x38');respondWithRpcPromise(_0xe4f2('0x7c'),_0xe4f2('0x7c'),{'event':_0xe4f2('0x83'),'message':_0x178dff['message']},client9002);return _0x2c325f;}return null;})[_0xe4f2('0x21')](respondWithResult(_0x296c04,null))[_0xe4f2('0x2c')](handleError(_0x296c04,null));};exports['create']=function(_0xbda05d,_0x4009d0){var _0x5d8b0b;return db[_0xe4f2('0x41')]['create'](_0xbda05d[_0xe4f2('0x5a')],{})['then'](function(_0x50bafc){_0x5d8b0b=_0x50bafc;return db[_0xe4f2('0x84')][_0xe4f2('0x85')]({'where':{'id':_0x5d8b0b[_0xe4f2('0x6f')]}});})[_0xe4f2('0x21')](function(_0x1c3b62){if(_[_0xe4f2('0x66')](_0x1c3b62)){return;}else{_0x5d8b0b[_0xe4f2('0x5e')]=_0x1c3b62[_0xe4f2('0x5e')];return db['Attachment']['findOne']({'where':{'id':_0x5d8b0b[_0xe4f2('0x86')]}});}})['then'](function(_0x1ed169){return respondWithRpcPromise(_0xe4f2('0x87'),_0xe4f2('0x87'),{'FaxAccountId':_['isNil'](_0xbda05d[_0xe4f2('0x5a')])?undefined:_0xbda05d[_0xe4f2('0x5a')][_0xe4f2('0x88')],'path':_[_0xe4f2('0x66')](_0x1ed169)?undefined:util[_0xe4f2('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x1ed169[_0xe4f2('0x89')]),'fax':_[_0xe4f2('0x66')](_0x5d8b0b[_0xe4f2('0x5e')])?undefined:_0x5d8b0b[_0xe4f2('0x5e')],'AttachmentId':_0x5d8b0b[_0xe4f2('0x86')]},client9002);})[_0xe4f2('0x21')](respondWithResult(_0x4009d0,0xc9))['catch'](handleError(_0x4009d0,null));};exports[_0xe4f2('0x8a')]=function(_0x514951,_0x310299){var _0x529931=path['join'](config[_0xe4f2('0x8b')],_0xe4f2('0x8c'),_0xe4f2('0x8d'),_0xe4f2('0x8e'));return db['FaxMessage'][_0xe4f2('0x5b')]({'where':{'id':_0x514951[_0xe4f2('0x58')]['id']},'include':[{'model':db[_0xe4f2('0x8f')],'as':'Attachment'}]})[_0xe4f2('0x21')](handleEntityNotFound(_0x310299,null))[_0xe4f2('0x21')](function(_0x2f5c3e){if(_0x2f5c3e){return _0x310299[_0xe4f2('0x8a')](path['join'](_0x529931,_0x2f5c3e[_0xe4f2('0x8f')][_0xe4f2('0x89')]));}})[_0xe4f2('0x2c')](handleError(_0x310299,null));}; \ No newline at end of file +var _0xa404=['sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params','keys','includeAll','find','body','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','info','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','null','rejectMessage','User','internal','motionChannel','create','CmContact','findOne','fax','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','client','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','end','stack','name','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa404,0x1d9));var _0x4a40=function(_0x426d1e,_0x8c2966){_0x426d1e=_0x426d1e-0x0;var _0xad223a=_0xa404[_0x426d1e];return _0xad223a;};'use strict';var emlformat=require(_0x4a40('0x0'));var rimraf=require(_0x4a40('0x1'));var zipdir=require(_0x4a40('0x2'));var jsonpatch=require(_0x4a40('0x3'));var rp=require('request-promise');var moment=require(_0x4a40('0x4'));var BPromise=require(_0x4a40('0x5'));var Mustache=require(_0x4a40('0x6'));var util=require(_0x4a40('0x7'));var path=require('path');var sox=require(_0x4a40('0x8'));var csv=require('to-csv');var ejs=require(_0x4a40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a40('0xa'));var squel=require(_0x4a40('0xb'));var crypto=require(_0x4a40('0xc'));var jsforce=require(_0x4a40('0xd'));var deskjs=require(_0x4a40('0xe'));var toCsv=require(_0x4a40('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a40('0x10'));var authService=require(_0x4a40('0x11'));var qs=require(_0x4a40('0x12'));var as=require(_0x4a40('0x13'));var hardwareService=require(_0x4a40('0x14'));var logger=require('../../config/logger')(_0x4a40('0x15'));var utils=require('../../config/utils');var config=require(_0x4a40('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a40('0x17'))['db'];config[_0x4a40('0x18')]=_['defaults'](config[_0x4a40('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a40('0x19'))(new Redis(config[_0x4a40('0x18')]));require(_0x4a40('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4a40('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x4a40('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3afec3,_0x17bce7,_0x5a652f,_0x33df9f){return new BPromise(function(_0x39fa5a,_0x4c4e3f){var _0x1e529e=_0x33df9f||client;return _0x1e529e[_0x4a40('0x1c')](_0x3afec3,_0x5a652f)['then'](function(_0x3c3bcc){logger['info'](_0x4a40('0x1d'),_0x17bce7,_0x4a40('0x1e'));logger[_0x4a40('0x1f')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17bce7,_0x4a40('0x1e'),JSON['stringify'](_0x3c3bcc));if(_0x3c3bcc[_0x4a40('0x20')]){if(_0x3c3bcc[_0x4a40('0x20')]['code']===0x1f4){logger[_0x4a40('0x20')](_0x4a40('0x1d'),_0x17bce7,_0x3c3bcc['error'][_0x4a40('0x21')]);return _0x4c4e3f(_0x3c3bcc['error'][_0x4a40('0x21')]);}logger[_0x4a40('0x20')](_0x4a40('0x1d'),_0x17bce7,_0x3c3bcc['error'][_0x4a40('0x21')]);return _0x39fa5a(_0x3c3bcc['error'][_0x4a40('0x21')]);}else{logger['info'](_0x4a40('0x1d'),_0x17bce7,_0x4a40('0x1e'));_0x39fa5a(_0x3c3bcc[_0x4a40('0x22')][_0x4a40('0x21')]);}})[_0x4a40('0x23')](function(_0x687275){logger[_0x4a40('0x20')](_0x4a40('0x1d'),_0x17bce7,_0x687275);_0x4c4e3f(_0x687275);});});}function respondWithStatusCode(_0x5373f5,_0x500136){_0x500136=_0x500136||0xcc;return function(_0x42caf7){if(_0x42caf7){return _0x5373f5[_0x4a40('0x24')](_0x500136);}return _0x5373f5[_0x4a40('0x25')](_0x500136)['end']();};}function respondWithResult(_0x523c66,_0x2bf8ea){_0x2bf8ea=_0x2bf8ea||0xc8;return function(_0x149362){if(_0x149362){return _0x523c66[_0x4a40('0x25')](_0x2bf8ea)[_0x4a40('0x26')](_0x149362);}};}function respondWithFilteredResult(_0x3a1c81,_0x207bed){return function(_0x5ec135){if(_0x5ec135){var _0x37e435=typeof _0x207bed[_0x4a40('0x27')]==='undefined'&&typeof _0x207bed['limit']===_0x4a40('0x28');var _0x1e532e=_0x5ec135['count'];var _0x5cf8d7=_0x37e435?0x0:_0x207bed[_0x4a40('0x27')];var _0xfe0735=_0x37e435?_0x5ec135[_0x4a40('0x29')]:_0x207bed[_0x4a40('0x27')]+_0x207bed[_0x4a40('0x2a')];var _0x10f3b7;if(_0xfe0735>=_0x1e532e){_0xfe0735=_0x1e532e;_0x10f3b7=0xc8;}else{_0x10f3b7=0xce;}_0x3a1c81[_0x4a40('0x25')](_0x10f3b7);return _0x3a1c81[_0x4a40('0x2b')]('Content-Range',_0x5cf8d7+'-'+_0xfe0735+'/'+_0x1e532e)[_0x4a40('0x26')](_0x5ec135);}return null;};}function patchUpdates(_0x321a64){return function(_0x51bcc8){try{jsonpatch[_0x4a40('0x2c')](_0x51bcc8,_0x321a64,!![]);}catch(_0x263328){return BPromise['reject'](_0x263328);}return _0x51bcc8[_0x4a40('0x2d')]();};}function saveUpdates(_0x457b9c,_0x16fb3b){return function(_0x383fd8){if(_0x383fd8){return _0x383fd8[_0x4a40('0x2e')](_0x457b9c)['then'](function(_0x200ab0){return _0x200ab0;});}return null;};}function removeEntity(_0x20d141,_0x57c90d){return function(_0x5cc64b){if(_0x5cc64b){return _0x5cc64b[_0x4a40('0x2f')]()[_0x4a40('0x30')](function(){_0x20d141[_0x4a40('0x25')](0xcc)[_0x4a40('0x31')]();});}};}function handleEntityNotFound(_0x34c449,_0xd00358){return function(_0xcf4082){if(!_0xcf4082){_0x34c449['sendStatus'](0x194);}return _0xcf4082;};}function handleError(_0x34bf46,_0x4fd0cc){_0x4fd0cc=_0x4fd0cc||0x1f4;return function(_0x4f97d5){logger[_0x4a40('0x20')](_0x4f97d5[_0x4a40('0x32')]);if(_0x4f97d5[_0x4a40('0x33')]){delete _0x4f97d5[_0x4a40('0x33')];}_0x34bf46[_0x4a40('0x25')](_0x4fd0cc)['send'](_0x4f97d5);};}exports[_0x4a40('0x34')]=function(_0x162c9e,_0x46d68b){var _0x5d6480={},_0x12858b={},_0x5d915c={'count':0x0,'rows':[]};var _0x475f5e=_['map'](db[_0x4a40('0x35')][_0x4a40('0x36')],function(_0x28fa9b){return{'name':_0x28fa9b[_0x4a40('0x37')],'type':_0x28fa9b[_0x4a40('0x38')][_0x4a40('0x39')]};});_0x12858b[_0x4a40('0x3a')]=_[_0x4a40('0x3b')](_0x475f5e,'name');_0x12858b['query']=_['keys'](_0x162c9e[_0x4a40('0x3c')]);_0x12858b[_0x4a40('0x3d')]=_[_0x4a40('0x3e')](_0x12858b[_0x4a40('0x3a')],_0x12858b[_0x4a40('0x3c')]);_0x5d6480[_0x4a40('0x3f')]=_[_0x4a40('0x3e')](_0x12858b[_0x4a40('0x3a')],qs[_0x4a40('0x40')](_0x162c9e[_0x4a40('0x3c')][_0x4a40('0x40')]));_0x5d6480[_0x4a40('0x3f')]=_0x5d6480[_0x4a40('0x3f')][_0x4a40('0x41')]?_0x5d6480[_0x4a40('0x3f')]:_0x12858b['model'];if(!_0x162c9e[_0x4a40('0x3c')]['hasOwnProperty']('nolimit')){_0x5d6480['limit']=qs[_0x4a40('0x2a')](_0x162c9e['query'][_0x4a40('0x2a')]);_0x5d6480[_0x4a40('0x27')]=qs['offset'](_0x162c9e[_0x4a40('0x3c')][_0x4a40('0x27')]);}_0x5d6480[_0x4a40('0x42')]=qs[_0x4a40('0x43')](_0x162c9e[_0x4a40('0x3c')][_0x4a40('0x43')]);_0x5d6480['where']=qs['filters'](_['pick'](_0x162c9e[_0x4a40('0x3c')],_0x12858b[_0x4a40('0x3d')]),_0x475f5e);if(_0x162c9e[_0x4a40('0x3c')][_0x4a40('0x44')]){_0x5d6480[_0x4a40('0x45')]=_[_0x4a40('0x46')](_0x5d6480[_0x4a40('0x45')],{'$or':_[_0x4a40('0x3b')](_0x475f5e,function(_0x1c909e){if(_0x1c909e[_0x4a40('0x38')]!==_0x4a40('0x47')){var _0x24d211={};_0x24d211[_0x1c909e['name']]={'$like':'%'+_0x162c9e[_0x4a40('0x3c')][_0x4a40('0x44')]+'%'};return _0x24d211;}})});}_0x5d6480=_[_0x4a40('0x46')]({},_0x5d6480,_0x162c9e[_0x4a40('0x48')]);var _0x440ded={'where':_0x5d6480[_0x4a40('0x45')]};return db[_0x4a40('0x35')][_0x4a40('0x29')](_0x440ded)['then'](function(_0x596894){_0x5d915c[_0x4a40('0x29')]=_0x596894;if(_0x162c9e[_0x4a40('0x3c')]['includeAll']){_0x5d6480[_0x4a40('0x49')]=[{'all':!![]}];}return db[_0x4a40('0x35')][_0x4a40('0x4a')](_0x5d6480);})[_0x4a40('0x30')](function(_0x100143){_0x5d915c['rows']=_0x100143;return _0x5d915c;})['then'](respondWithFilteredResult(_0x46d68b,_0x5d6480))['catch'](handleError(_0x46d68b,null));};exports[_0x4a40('0x4b')]=function(_0x290905,_0xb47e45){var _0x129de7={'raw':!![],'where':{'id':_0x290905[_0x4a40('0x4c')]['id']}},_0x57b4ed={};_0x57b4ed['model']=_[_0x4a40('0x4d')](db[_0x4a40('0x35')]['rawAttributes']);_0x57b4ed[_0x4a40('0x3c')]=_[_0x4a40('0x4d')](_0x290905[_0x4a40('0x3c')]);_0x57b4ed['filters']=_[_0x4a40('0x3e')](_0x57b4ed[_0x4a40('0x3a')],_0x57b4ed[_0x4a40('0x3c')]);_0x129de7[_0x4a40('0x3f')]=_['intersection'](_0x57b4ed[_0x4a40('0x3a')],qs['fields'](_0x290905[_0x4a40('0x3c')]['fields']));_0x129de7[_0x4a40('0x3f')]=_0x129de7[_0x4a40('0x3f')][_0x4a40('0x41')]?_0x129de7[_0x4a40('0x3f')]:_0x57b4ed[_0x4a40('0x3a')];if(_0x290905[_0x4a40('0x3c')][_0x4a40('0x4e')]){_0x129de7['include']=[{'all':!![]}];}_0x129de7=_[_0x4a40('0x46')]({},_0x129de7,_0x290905[_0x4a40('0x48')]);return db[_0x4a40('0x35')][_0x4a40('0x4f')](_0x129de7)[_0x4a40('0x30')](handleEntityNotFound(_0xb47e45,null))[_0x4a40('0x30')](respondWithResult(_0xb47e45,null))[_0x4a40('0x23')](handleError(_0xb47e45,null));};exports['update']=function(_0x217042,_0x4472c4){if(_0x217042[_0x4a40('0x50')]['id']){delete _0x217042[_0x4a40('0x50')]['id'];}return db[_0x4a40('0x35')][_0x4a40('0x4f')]({'where':{'id':_0x217042[_0x4a40('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4472c4,null))[_0x4a40('0x30')](saveUpdates(_0x217042[_0x4a40('0x50')],null))[_0x4a40('0x30')](respondWithResult(_0x4472c4,null))[_0x4a40('0x23')](handleError(_0x4472c4,null));};exports[_0x4a40('0x2f')]=function(_0x4d1f20,_0x5d2c6d){return db[_0x4a40('0x35')][_0x4a40('0x4f')]({'where':{'id':_0x4d1f20[_0x4a40('0x4c')]['id']}})[_0x4a40('0x30')](handleEntityNotFound(_0x5d2c6d,null))[_0x4a40('0x30')](removeEntity(_0x5d2c6d,null))[_0x4a40('0x23')](handleError(_0x5d2c6d,null));};exports[_0x4a40('0x51')]=function(_0x46687c,_0x55baa3){return db['FaxMessage'][_0x4a40('0x51')]()[_0x4a40('0x30')](respondWithResult(_0x55baa3,null))[_0x4a40('0x23')](handleError(_0x55baa3,null));};var interaction_log=require('../../config/logger')(_0x4a40('0x52'));exports[_0x4a40('0x53')]=function(_0xbec687,_0x1783d7,_0x3a69c9){var _0x331698={'agent':{},'channel':'fax'};if(_0xbec687[_0x4a40('0x50')]['id']){delete _0xbec687[_0x4a40('0x50')]['id'];}_0xbec687[_0x4a40('0x50')]['read']=!![];_0xbec687[_0x4a40('0x50')][_0x4a40('0x54')]=moment()[_0x4a40('0x55')](_0x4a40('0x56'));_0xbec687[_0x4a40('0x50')][_0x4a40('0x57')]=_0xbec687[_0x4a40('0x50')]['UserId']||_0xbec687[_0x4a40('0x58')]['id'];_0x331698[_0x4a40('0x59')]['id']=_0xbec687[_0x4a40('0x50')][_0x4a40('0x57')];return db['FaxMessage']['find']({'where':{'id':_0xbec687[_0x4a40('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1783d7,null))['then'](saveUpdates(_0xbec687['body'],null))[_0x4a40('0x30')](function(_0x17fa97){if(_0x17fa97){_0x331698[_0x4a40('0x21')]=_0x17fa97[_0x4a40('0x5a')]({'plain':!![]});return db[_0x4a40('0x5b')][_0x4a40('0x4f')]({'where':{'id':_0x17fa97[_0x4a40('0x5c')]}});}return null;})[_0x4a40('0x30')](handleEntityNotFound(_0x1783d7,null))[_0x4a40('0x30')](function(_0x4e97b5){if(_0x4e97b5){return _0x4e97b5['update']({'UserId':_0xbec687[_0x4a40('0x50')][_0x4a40('0x57')],'read1stAt':_[_0x4a40('0x5d')](_0x4e97b5[_0x4a40('0x5e')])?moment()[_0x4a40('0x55')](_0x4a40('0x56')):undefined});}return null;})[_0x4a40('0x30')](function(_0x134a8d){if(_0x134a8d){_0x331698[_0x4a40('0x5f')]=_0x134a8d[_0x4a40('0x5a')]({'plain':!![]});interaction_log[_0x4a40('0x60')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xbec687[_0x4a40('0x58')]['id'],_0xbec687[_0x4a40('0x58')]['name'],_0xbec687[_0x4a40('0x58')][_0x4a40('0x61')],_0x331698[_0x4a40('0x5f')]['id'],_0xbec687[_0x4a40('0x50')]?JSON[_0x4a40('0x62')](_0xbec687['body']):'null');return respondWithRpcPromise(_0x4a40('0x63'),_0x4a40('0x64'),_0x331698);}return null;})[_0x4a40('0x30')](function(_0x9fb8de){var _0x79b85d=_0x4a40('0x65')+_0x9fb8de[_0x4a40('0x21')][_0x4a40('0x66')];return db[_0x4a40('0x67')][_0x4a40('0x3c')](_0x79b85d,{'type':db[_0x4a40('0x68')][_0x4a40('0x69')][_0x4a40('0x6a')],'raw':!![]})['then'](function(_0x122ecc){return _0x122ecc;});})[_0x4a40('0x30')](function(_0x194294){if(_0x194294){_0x331698[_0x4a40('0x21')][_0x4a40('0x6b')]=_0x194294[0x0];if(!_0xbec687['body']['UserId'])return;return db['User'][_0x4a40('0x4f')]({'where':{'id':_0xbec687[_0x4a40('0x50')][_0x4a40('0x57')],'role':_0x4a40('0x59')},'attributes':['id',_0x4a40('0x33'),'fullname',_0x4a40('0x6c'),'internal'],'raw':!![]});}return null;})[_0x4a40('0x30')](function(_0x527147){if(!_0x527147)return null;_0x331698[_0x4a40('0x21')][_0x4a40('0x59')]=_0x527147;return _0x331698;})['then'](function(_0x1b2ba6){if(_0x1b2ba6){if(_0xbec687[_0x4a40('0x50')][_0x4a40('0x6d')]){_0x331698[_0x4a40('0x21')][_0x4a40('0x6e')]=util['format'](_0x4a40('0x6f'),_0xbec687[_0x4a40('0x58')][_0x4a40('0x33')]);_0x331698['message'][_0x4a40('0x70')]=_0x331698[_0x4a40('0x70')];_0x331698[_0x4a40('0x21')]['motionChannel']=_0x331698[_0x4a40('0x70')];_0x331698[_0x4a40('0x21')][_0x4a40('0x71')]=_0x4a40('0x53');return respondWithRpcPromise(_0x4a40('0x72'),'EventManager',{'event':_0x4a40('0x73'),'message':_0x331698[_0x4a40('0x21')]},client9002)[_0x4a40('0x30')](function(){return _0x331698;});}return _0x331698;}return null;})[_0x4a40('0x30')](respondWithResult(_0x1783d7,null))[_0x4a40('0x23')](handleError(_0x1783d7,null));};var interaction_log=require(_0x4a40('0x74'))(_0x4a40('0x52'));exports['reject']=function(_0x17376f,_0x4052ef,_0x2db5ed){var _0x235b0b={'agent':{},'channel':'fax'};if(_0x17376f[_0x4a40('0x50')]['id']){delete _0x17376f['body']['id'];}_0x17376f[_0x4a40('0x50')][_0x4a40('0x57')]=_0x17376f[_0x4a40('0x50')][_0x4a40('0x57')]||_0x17376f['user']['id'];_0x235b0b[_0x4a40('0x59')]['id']=_0x17376f[_0x4a40('0x50')][_0x4a40('0x57')];return db[_0x4a40('0x35')]['find']({'where':{'id':_0x17376f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4052ef,null))[_0x4a40('0x30')](function(_0x19384f){if(_0x19384f){_0x235b0b['message']=_0x19384f[_0x4a40('0x5a')]({'plain':!![]});return db[_0x4a40('0x5b')][_0x4a40('0x4f')]({'where':{'id':_0x19384f['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4052ef,null))[_0x4a40('0x30')](function(_0x342983){if(_0x342983){_0x235b0b[_0x4a40('0x5f')]=_0x342983[_0x4a40('0x5a')]({'plain':!![]});interaction_log[_0x4a40('0x60')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17376f[_0x4a40('0x58')]['id'],_0x17376f[_0x4a40('0x58')][_0x4a40('0x33')],_0x17376f[_0x4a40('0x58')][_0x4a40('0x61')],_0x235b0b[_0x4a40('0x5f')]['id'],_0x17376f['body']?JSON[_0x4a40('0x62')](_0x17376f[_0x4a40('0x50')]):_0x4a40('0x75'));return respondWithRpcPromise('RejectMessage',_0x4a40('0x76'),_0x235b0b);}return null;})[_0x4a40('0x30')](function(_0x431ea2){var _0x5a09cf=_0x4a40('0x65')+_0x431ea2['message'][_0x4a40('0x66')];return db[_0x4a40('0x67')][_0x4a40('0x3c')](_0x5a09cf,{'type':db['Sequelize'][_0x4a40('0x69')][_0x4a40('0x6a')],'raw':!![]})['then'](function(_0x40de76){return _0x40de76;});})[_0x4a40('0x30')](function(_0x3ae1c6){if(_0x3ae1c6){_0x235b0b[_0x4a40('0x21')]['contact']=_0x3ae1c6[0x0];if(!_0x17376f[_0x4a40('0x50')][_0x4a40('0x57')])return;return db[_0x4a40('0x77')][_0x4a40('0x4f')]({'where':{'id':_0x17376f[_0x4a40('0x50')]['UserId'],'role':_0x4a40('0x59')},'attributes':['id',_0x4a40('0x33'),'fullname',_0x4a40('0x6c'),_0x4a40('0x78')],'raw':!![]});}return null;})[_0x4a40('0x30')](function(_0x4babf){if(!_0x4babf)return null;_0x235b0b[_0x4a40('0x21')][_0x4a40('0x59')]=_0x4babf;return _0x235b0b;})[_0x4a40('0x30')](function(_0x119a84){if(_0x119a84){_0x119a84['message'][_0x4a40('0x6e')]=util['format'](_0x4a40('0x6f'),_0x17376f['user'][_0x4a40('0x33')]);_0x119a84[_0x4a40('0x21')]['channel']=_0x235b0b[_0x4a40('0x70')];_0x119a84[_0x4a40('0x21')][_0x4a40('0x79')]=_0x235b0b[_0x4a40('0x70')];_0x119a84[_0x4a40('0x21')][_0x4a40('0x71')]='reject';respondWithRpcPromise(_0x4a40('0x72'),_0x4a40('0x72'),{'event':'rejectmessage','message':_0x119a84['message']},client9002);return _0x235b0b;}return null;})[_0x4a40('0x30')](respondWithResult(_0x4052ef,null))[_0x4a40('0x23')](handleError(_0x4052ef,null));};exports['create']=function(_0x109974,_0xa242c8){var _0x453a28;return db[_0x4a40('0x35')][_0x4a40('0x7a')](_0x109974[_0x4a40('0x50')],{})['then'](function(_0x464d3a){_0x453a28=_0x464d3a;return db[_0x4a40('0x7b')][_0x4a40('0x7c')]({'where':{'id':_0x453a28[_0x4a40('0x66')]}});})['then'](function(_0x507130){if(_['isNil'](_0x507130)){return;}else{_0x453a28[_0x4a40('0x7d')]=_0x507130[_0x4a40('0x7d')];return db[_0x4a40('0x7e')][_0x4a40('0x7c')]({'where':{'id':_0x453a28[_0x4a40('0x7f')]}});}})[_0x4a40('0x30')](function(_0x4c6eae){return respondWithRpcPromise(_0x4a40('0x80'),_0x4a40('0x80'),{'FaxAccountId':_[_0x4a40('0x5d')](_0x109974['body'])?undefined:_0x109974[_0x4a40('0x50')]['FaxAccountId'],'path':_[_0x4a40('0x5d')](_0x4c6eae)?undefined:util[_0x4a40('0x55')](_0x4a40('0x81'),_0x4c6eae[_0x4a40('0x82')]),'fax':_[_0x4a40('0x5d')](_0x453a28[_0x4a40('0x7d')])?undefined:_0x453a28[_0x4a40('0x7d')],'AttachmentId':_0x453a28['AttachmentId']},client9002);})['then'](respondWithResult(_0xa242c8,0xc9))[_0x4a40('0x23')](handleError(_0xa242c8,null));};exports[_0x4a40('0x83')]=function(_0x5571d1,_0x12dcb7){var _0x505f70=path[_0x4a40('0x84')](config[_0x4a40('0x85')],'server','files',_0x4a40('0x86'));return db[_0x4a40('0x35')][_0x4a40('0x4f')]({'where':{'id':_0x5571d1['params']['id']},'include':[{'model':db['Attachment'],'as':_0x4a40('0x7e')}]})[_0x4a40('0x30')](handleEntityNotFound(_0x12dcb7,null))[_0x4a40('0x30')](function(_0x29a90d){if(_0x29a90d){return _0x12dcb7['download'](path['join'](_0x505f70,_0x29a90d[_0x4a40('0x7e')][_0x4a40('0x82')]));}})[_0x4a40('0x23')](handleError(_0x12dcb7,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1813e3a..cf24607 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 _0x8b0e=['FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x8b0e,0x166));var _0xe8b0=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0x8b0e[_0x3d90b4];return _0x4c65d3;};'use strict';var EventEmitter=require(_0xe8b0('0x0'));var FaxMessage=require(_0xe8b0('0x1'))['db'][_0xe8b0('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe8b0('0x3')](0x0);var events={'afterCreate':_0xe8b0('0x4'),'afterUpdate':_0xe8b0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2036fd){return function(_0x5ba48e,_0x34ccc7,_0x240513){FaxMessageEvents[_0xe8b0('0x6')](_0x2036fd+':'+_0x5ba48e['id'],_0x5ba48e);FaxMessageEvents[_0xe8b0('0x6')](_0x2036fd,_0x5ba48e);_0x240513(null);};}for(var e in events){if(events[_0xe8b0('0x7')](e)){var event=events[e];FaxMessage[_0xe8b0('0x8')](e,emitEvent(event));}}module[_0xe8b0('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x8fcd=['events','../../mysqldb','FaxMessage','setMaxListeners','save','emit','exports'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x8fcd,0xa1));var _0xd8fc=function(_0xb591f0,_0x319160){_0xb591f0=_0xb591f0-0x0;var _0x3055ae=_0x8fcd[_0xb591f0];return _0x3055ae;};'use strict';var EventEmitter=require(_0xd8fc('0x0'));var FaxMessage=require(_0xd8fc('0x1'))['db'][_0xd8fc('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd8fc('0x3')](0x0);var events={'afterCreate':_0xd8fc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x353592){return function(_0x36d5ad,_0x41aaf1,_0x2d5000){FaxMessageEvents[_0xd8fc('0x5')](_0x353592+':'+_0x36d5ad['id'],_0x36d5ad);FaxMessageEvents[_0xd8fc('0x5')](_0x353592,_0x36d5ad);_0x2d5000(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd8fc('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0698905..1bbbe8c 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 _0xded9=['request-promise','path','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x59ae56,_0x1a1aaf){var _0x839b0f=function(_0x56cc1c){while(--_0x56cc1c){_0x59ae56['push'](_0x59ae56['shift']());}};_0x839b0f(++_0x1a1aaf);}(_0xded9,0xaa));var _0x9ded=function(_0x2719cf,_0x3e644c){_0x2719cf=_0x2719cf-0x0;var _0x2c265d=_0xded9[_0x2719cf];return _0x2c265d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ded('0x0'))(_0x9ded('0x1'));var moment=require(_0x9ded('0x2'));var BPromise=require(_0x9ded('0x3'));var rp=require(_0x9ded('0x4'));var fs=require('fs');var path=require(_0x9ded('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9ded('0x6'));module[_0x9ded('0x7')]=function(_0x4c718e,_0x10b594){return _0x4c718e['define'](_0x9ded('0x8'),attributes,{'tableName':_0x9ded('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9ded('0xa')],'type':_0x9ded('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ad906,_0x5f230e,_0x507ec1){var _0x5042de=_0x4c718e[_0x9ded('0xc')];var _0x48a619=_0x5ad906[_0x9ded('0xd')]({'plain':!![]});if(_0x48a619[_0x9ded('0xe')][_0x9ded('0xf')]()==='in'||_0x48a619[_0x9ded('0xe')][_0x9ded('0xf')]()==='out'&&!_0x48a619[_0x9ded('0x10')]&&!_[_0x9ded('0x11')](_0x48a619[_0x9ded('0x12')])){_0x5042de[_0x9ded('0x13')][_0x9ded('0x14')]({'where':{'id':_0x48a619[_0x9ded('0x15')]}})[_0x9ded('0x16')](function(_0x1a235d){if(_0x1a235d){_0x1a235d[_0x9ded('0x17')]({'lastMsgAt':_0x48a619[_0x9ded('0x18')],'lastMsgDirection':_0x48a619[_0x9ded('0xe')][_0x9ded('0xf')]()});}})[_0x9ded('0x19')](function(_0x19f82e){console[_0x9ded('0x1a')](_0x19f82e);});}_0x507ec1();}},'charset':_0x9ded('0x1b'),'collate':_0x9ded('0x1c')});}; \ No newline at end of file +var _0x9053=['catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','then','update','createdAt'];(function(_0x441cf1,_0x2621c7){var _0x523ca5=function(_0x63cb93){while(--_0x63cb93){_0x441cf1['push'](_0x441cf1['shift']());}};_0x523ca5(++_0x2621c7);}(_0x9053,0xc7));var _0x3905=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x9053[_0x51ab83];return _0x14b6de;};'use strict';var _=require(_0x3905('0x0'));var util=require('util');var logger=require(_0x3905('0x1'))(_0x3905('0x2'));var moment=require(_0x3905('0x3'));var BPromise=require(_0x3905('0x4'));var rp=require(_0x3905('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3905('0x6'));var config=require('../../config/environment');var attributes=require(_0x3905('0x7'));module[_0x3905('0x8')]=function(_0x2cda70,_0x4d4792){return _0x2cda70['define'](_0x3905('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3905('0xa'),'fields':[_0x3905('0xb')],'type':_0x3905('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fa358,_0x823c1b,_0x13ae55){var _0x2fecb0=_0x2cda70[_0x3905('0xd')];var _0x5223e9=_0x1fa358[_0x3905('0xe')]({'plain':!![]});if(_0x5223e9[_0x3905('0xf')]['toLowerCase']()==='in'||_0x5223e9[_0x3905('0xf')][_0x3905('0x10')]()==='out'&&!_0x5223e9[_0x3905('0x11')]&&!_[_0x3905('0x12')](_0x5223e9[_0x3905('0x13')])){_0x2fecb0[_0x3905('0x14')][_0x3905('0x15')]({'where':{'id':_0x5223e9['FaxInteractionId']}})[_0x3905('0x16')](function(_0x3ab48a){if(_0x3ab48a){_0x3ab48a[_0x3905('0x17')]({'lastMsgAt':_0x5223e9[_0x3905('0x18')],'lastMsgDirection':_0x5223e9['direction'][_0x3905('0x10')]()});}})[_0x3905('0x19')](function(_0xf308ae){console[_0x3905('0x1a')](_0xf308ae);});}_0x13ae55();}},'charset':_0x3905('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a154903..af5d30d 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 _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xed1f,0x6a));var _0xfed1=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xed1f[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file +var _0x34e8=['request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x126408,_0x2658ae){var _0x210387=function(_0x15fd57){while(--_0x15fd57){_0x126408['push'](_0x126408['shift']());}};_0x210387(++_0x2658ae);}(_0x34e8,0x12c));var _0x834e=function(_0x5cee74,_0x4941f6){_0x5cee74=_0x5cee74-0x0;var _0x8358e9=_0x34e8[_0x5cee74];return _0x8358e9;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});config['redis']=_[_0x834e('0xc')](config[_0x834e('0xd')],{'host':_0x834e('0xe'),'port':0x18eb});var socket=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xd')]));require(_0x834e('0x10'))[_0x834e('0x11')](socket);function respondWithRpcPromise(_0x1af45a,_0x3bdda9,_0x186b3b){return new BPromise(function(_0x1e41fe,_0x36e124){return client[_0x834e('0x12')](_0x1af45a,_0x186b3b)[_0x834e('0x13')](function(_0x293514){logger[_0x834e('0x14')](_0x834e('0x15'),_0x3bdda9,'request\x20sent');logger[_0x834e('0x16')](_0x834e('0x17'),_0x3bdda9,'request\x20sent',JSON[_0x834e('0x18')](_0x293514));if(_0x293514[_0x834e('0x19')]){if(_0x293514[_0x834e('0x19')][_0x834e('0x1a')]===0x1f4){logger['error'](_0x834e('0x15'),_0x3bdda9,_0x293514[_0x834e('0x19')]['message']);return _0x36e124(_0x293514[_0x834e('0x19')]['message']);}logger[_0x834e('0x19')](_0x834e('0x15'),_0x3bdda9,_0x293514['error'][_0x834e('0x1b')]);return _0x1e41fe(_0x293514[_0x834e('0x19')][_0x834e('0x1b')]);}else{logger['info'](_0x834e('0x15'),_0x3bdda9,_0x834e('0x1c'));_0x1e41fe(_0x293514[_0x834e('0x1d')][_0x834e('0x1b')]);}})[_0x834e('0x1e')](function(_0x254677){logger[_0x834e('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3bdda9,_0x254677);_0x36e124(_0x254677);});});}exports[_0x834e('0x1f')]=function(_0x1fd2c6){var _0x113ff4=this;return new Promise(function(_0x325a99,_0x4ab05d){return db[_0x834e('0x20')][_0x834e('0x21')](_0x1fd2c6['body'],{'raw':_0x1fd2c6[_0x834e('0x22')]?_0x1fd2c6[_0x834e('0x22')][_0x834e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3f48){logger[_0x834e('0x14')](_0x834e('0x1f'),_0x1fd2c6);logger['debug'](_0x834e('0x1f'),_0x1fd2c6,JSON[_0x834e('0x18')](_0x4e3f48));_0x325a99(_0x4e3f48);})['catch'](function(_0x3bc4f7){logger[_0x834e('0x19')](_0x834e('0x1f'),_0x3bc4f7['message'],_0x1fd2c6);_0x4ab05d(_0x113ff4[_0x834e('0x19')](0x1f4,_0x3bc4f7[_0x834e('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x5bef62){var _0x1e713a=this;return new Promise(function(_0x508a1d,_0x2826ec){return db[_0x834e('0x20')][_0x834e('0x24')](_0x5bef62[_0x834e('0x25')],{'raw':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bef62['options']?_0x5bef62['options']['where']||null:null,'attributes':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')][_0x834e('0x26')]||null:null,'limit':_0x5bef62['options']?_0x5bef62[_0x834e('0x22')][_0x834e('0x27')]||null:null})[_0x834e('0x13')](function(_0x1e026a){logger[_0x834e('0x14')](_0x834e('0x28'),_0x5bef62);logger[_0x834e('0x16')](_0x834e('0x28'),_0x5bef62,JSON[_0x834e('0x18')](_0x1e026a));_0x508a1d(_0x1e026a);})['catch'](function(_0xef9ec2){logger['error'](_0x834e('0x28'),_0xef9ec2[_0x834e('0x1b')],_0x5bef62);_0x2826ec(_0x1e713a[_0x834e('0x19')](0x1f4,_0xef9ec2[_0x834e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3cd1de1..ea32ae2 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 _0xce89=['faxMessage:','./faxMessage.events','save','remove','update','register'];(function(_0x35a4e8,_0x2e8f5d){var _0x4220fb=function(_0x26cc14){while(--_0x26cc14){_0x35a4e8['push'](_0x35a4e8['shift']());}};_0x4220fb(++_0x2e8f5d);}(_0xce89,0xc7));var _0x9ce8=function(_0x5b37f9,_0x311ec1){_0x5b37f9=_0x5b37f9-0x0;var _0x5945e2=_0xce89[_0x5b37f9];return _0x5945e2;};'use strict';var FaxMessageEvents=require(_0x9ce8('0x0'));var events=[_0x9ce8('0x1'),_0x9ce8('0x2'),_0x9ce8('0x3')];function createListener(_0x23d39c,_0x18f628){return function(_0x254f35){_0x18f628['emit'](_0x23d39c,_0x254f35);};}function removeListener(_0x3be86d,_0x1f24b4){return function(){FaxMessageEvents['removeListener'](_0x3be86d,_0x1f24b4);};}exports[_0x9ce8('0x4')]=function(_0x926ab2){for(var _0x4f4728=0x0,_0x55bbeb=events['length'];_0x4f4728<_0x55bbeb;_0x4f4728++){var _0x347ea2=events[_0x4f4728];var _0xd1371a=createListener(_0x9ce8('0x5')+_0x347ea2,_0x926ab2);FaxMessageEvents['on'](_0x347ea2,_0xd1371a);}}; \ No newline at end of file +var _0xa48a=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x4810c9,_0x544af4){var _0x2ec381=function(_0x4c640e){while(--_0x4c640e){_0x4810c9['push'](_0x4810c9['shift']());}};_0x2ec381(++_0x544af4);}(_0xa48a,0x11c));var _0xaa48=function(_0x5e325a,_0x543cec){_0x5e325a=_0x5e325a-0x0;var _0x4ff975=_0xa48a[_0x5e325a];return _0x4ff975;};'use strict';var FaxMessageEvents=require(_0xaa48('0x0'));var events=[_0xaa48('0x1'),_0xaa48('0x2'),_0xaa48('0x3')];function createListener(_0x508419,_0x3a2f4c){return function(_0x2918a3){_0x3a2f4c[_0xaa48('0x4')](_0x508419,_0x2918a3);};}function removeListener(_0xf170ad,_0x1c5666){return function(){FaxMessageEvents[_0xaa48('0x5')](_0xf170ad,_0x1c5666);};}exports[_0xaa48('0x6')]=function(_0x49557f){for(var _0x2365bc=0x0,_0x3850a8=events[_0xaa48('0x7')];_0x2365bc<_0x3850a8;_0x2365bc++){var _0x347884=events[_0x2365bc];var _0x403e84=createListener(_0xaa48('0x8')+_0x347884,_0x49557f);FaxMessageEvents['on'](_0x347884,_0x403e84);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 97fcc84..5d24562 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 _0x76dc=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util'];(function(_0x355f43,_0x1df5ae){var _0x102c5a=function(_0x2c5e5d){while(--_0x2c5e5d){_0x355f43['push'](_0x355f43['shift']());}};_0x102c5a(++_0x1df5ae);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2a3567,_0x16f237){_0x2a3567=_0x2a3567-0x0;var _0x48ac06=_0x76dc[_0x2a3567];return _0x48ac06;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var fs_extra=require(_0xc76d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc76d('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xc76d('0x7')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['get']('/describe',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc76d('0xb')]);router[_0xc76d('0x7')]('/:id/download',auth[_0xc76d('0x8')](),controller['download']);router[_0xc76d('0xc')]('/',auth[_0xc76d('0x8')](),interaction[_0xc76d('0xd')](_0xc76d('0xe'),_0xc76d('0xf')),controller[_0xc76d('0x10')]);router[_0xc76d('0x11')](_0xc76d('0x12'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x13')]);router[_0xc76d('0x11')](_0xc76d('0x14'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x15')]);router['put'](_0xc76d('0x16'),auth[_0xc76d('0x8')](),controller['reject']);router[_0xc76d('0x17')](_0xc76d('0x12'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x542f94,_0x16d9d2){var _0x56fd31=function(_0x9e6f42){while(--_0x9e6f42){_0x542f94['push'](_0x542f94['shift']());}};_0x56fd31(++_0x16d9d2);}(_0xd404,0x15b));var _0x4d40=function(_0x79d1f1,_0x3ced1b){_0x79d1f1=_0x79d1f1-0x0;var _0x4549e9=_0xd404[_0x79d1f1];return _0x4549e9;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 158bd54..00c0007 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 _0x8eb7=['STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x34f824,_0x365417){var _0x7cd8bd=function(_0x2cc4a8){while(--_0x2cc4a8){_0x34f824['push'](_0x34f824['shift']());}};_0x7cd8bd(++_0x365417);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x78eb('0x1')],'unique':_0x78eb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78eb('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78eb('0x4')](_0x78eb('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x78eb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7899=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x470574,_0x263498){var _0x59bd79=function(_0x31a2c9){while(--_0x31a2c9){_0x470574['push'](_0x470574['shift']());}};_0x59bd79(++_0x263498);}(_0x7899,0x167));var _0x9789=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7899[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module[_0x9789('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9789('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9789('0x2')]},'timeout':{'type':Sequelize[_0x9789('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9789('0x4')]('rrmemory',_0x9789('0x5'),_0x9789('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9789('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 3f5c568..d251f1b 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 _0x1831=['select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','isEmpty','emit','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','removeAgents','getAgents','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','get','FaxQueues','UserProfileResource','destroy','end','error','stack','name','send','FaxQueue','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','findAll','catch','params','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','faxPause','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x1831,0x134));var _0x1183=function(_0x6b81ad,_0x42702b){_0x6b81ad=_0x6b81ad-0x0;var _0xbfdd24=_0x1831[_0x6b81ad];return _0xbfdd24;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1183('0x0'));var jsonpatch=require(_0x1183('0x1'));var rp=require('request-promise');var moment=require(_0x1183('0x2'));var BPromise=require(_0x1183('0x3'));var Mustache=require(_0x1183('0x4'));var util=require(_0x1183('0x5'));var path=require(_0x1183('0x6'));var sox=require(_0x1183('0x7'));var csv=require('to-csv');var ejs=require(_0x1183('0x8'));var fs=require('fs');var fs_extra=require(_0x1183('0x9'));var _=require(_0x1183('0xa'));var squel=require('squel');var crypto=require(_0x1183('0xb'));var jsforce=require(_0x1183('0xc'));var deskjs=require(_0x1183('0xd'));var toCsv=require(_0x1183('0xe'));var querystring=require(_0x1183('0xf'));var Papa=require(_0x1183('0x10'));var Redis=require(_0x1183('0x11'));var authService=require(_0x1183('0x12'));var qs=require(_0x1183('0x13'));var as=require(_0x1183('0x14'));var hardwareService=require(_0x1183('0x15'));var logger=require(_0x1183('0x16'))(_0x1183('0x17'));var utils=require(_0x1183('0x18'));var config=require(_0x1183('0x19'));var licenseUtil=require(_0x1183('0x1a'));var db=require('../../mysqldb')['db'];config[_0x1183('0x1b')]=_['defaults'](config[_0x1183('0x1b')],{'host':_0x1183('0x1c'),'port':0x18eb});var socket=require(_0x1183('0x1d'))(new Redis(config['redis']));require(_0x1183('0x1e'))[_0x1183('0x1f')](socket);function respondWithStatusCode(_0x15fa82,_0x1e74f1){_0x1e74f1=_0x1e74f1||0xcc;return function(_0x39f62e){if(_0x39f62e){return _0x15fa82[_0x1183('0x20')](_0x1e74f1);}return _0x15fa82[_0x1183('0x21')](_0x1e74f1)['end']();};}function respondWithResult(_0x1f63b7,_0x14014a){_0x14014a=_0x14014a||0xc8;return function(_0x21ec5c){if(_0x21ec5c){return _0x1f63b7[_0x1183('0x21')](_0x14014a)[_0x1183('0x22')](_0x21ec5c);}};}function respondWithFilteredResult(_0x1236fd,_0x3c833f){return function(_0x283e33){if(_0x283e33){var _0x284f39=typeof _0x3c833f['offset']===_0x1183('0x23')&&typeof _0x3c833f[_0x1183('0x24')]===_0x1183('0x23');var _0x161cd7=_0x283e33['count'];var _0x11e495=_0x284f39?0x0:_0x3c833f[_0x1183('0x25')];var _0x43b25b=_0x284f39?_0x283e33[_0x1183('0x26')]:_0x3c833f[_0x1183('0x25')]+_0x3c833f[_0x1183('0x24')];var _0x50dd08;if(_0x43b25b>=_0x161cd7){_0x43b25b=_0x161cd7;_0x50dd08=0xc8;}else{_0x50dd08=0xce;}_0x1236fd['status'](_0x50dd08);return _0x1236fd[_0x1183('0x27')](_0x1183('0x28'),_0x11e495+'-'+_0x43b25b+'/'+_0x161cd7)[_0x1183('0x22')](_0x283e33);}return null;};}function patchUpdates(_0x1d1caf){return function(_0x4d646a){try{jsonpatch[_0x1183('0x29')](_0x4d646a,_0x1d1caf,!![]);}catch(_0x5d8530){return BPromise['reject'](_0x5d8530);}return _0x4d646a['save']();};}function saveUpdates(_0x48770f,_0x2369c5){return function(_0x23bf8e){if(_0x23bf8e){return _0x23bf8e[_0x1183('0x2a')](_0x48770f)[_0x1183('0x2b')](function(_0x5691fa){return _0x5691fa;});}return null;};}function removeEntity(_0x1e9d17,_0x434e94){return function(_0x11f543){if(_0x11f543){return _0x11f543['destroy']()[_0x1183('0x2b')](function(){var _0x3c3218=_0x11f543[_0x1183('0x2c')]({'plain':!![]});var _0x3afa56=_0x1183('0x2d');return db[_0x1183('0x2e')][_0x1183('0x2f')]({'where':{'type':_0x3afa56,'resourceId':_0x3c3218['id']}})[_0x1183('0x2b')](function(){return _0x11f543;});})[_0x1183('0x2b')](function(){_0x1e9d17[_0x1183('0x21')](0xcc)[_0x1183('0x30')]();});}};}function handleEntityNotFound(_0x16fe53,_0x53f6fd){return function(_0x29e59f){if(!_0x29e59f){_0x16fe53[_0x1183('0x20')](0x194);}return _0x29e59f;};}function handleError(_0x4749f9,_0x2b55ea){_0x2b55ea=_0x2b55ea||0x1f4;return function(_0x39784c){logger[_0x1183('0x31')](_0x39784c[_0x1183('0x32')]);if(_0x39784c['name']){delete _0x39784c[_0x1183('0x33')];}_0x4749f9[_0x1183('0x21')](_0x2b55ea)[_0x1183('0x34')](_0x39784c);};}exports['index']=function(_0x287c13,_0x55fc12){var _0x3e4abe={},_0x48bce6={},_0x59479e={'count':0x0,'rows':[]};var _0x3e9ccb=_['map'](db[_0x1183('0x35')][_0x1183('0x36')],function(_0x3a539a){return{'name':_0x3a539a[_0x1183('0x37')],'type':_0x3a539a['type']['key']};});_0x48bce6[_0x1183('0x38')]=_[_0x1183('0x39')](_0x3e9ccb,_0x1183('0x33'));_0x48bce6[_0x1183('0x3a')]=_[_0x1183('0x3b')](_0x287c13[_0x1183('0x3a')]);_0x48bce6[_0x1183('0x3c')]=_[_0x1183('0x3d')](_0x48bce6[_0x1183('0x38')],_0x48bce6['query']);_0x3e4abe['attributes']=_[_0x1183('0x3d')](_0x48bce6['model'],qs[_0x1183('0x3e')](_0x287c13[_0x1183('0x3a')][_0x1183('0x3e')]));_0x3e4abe[_0x1183('0x3f')]=_0x3e4abe[_0x1183('0x3f')][_0x1183('0x40')]?_0x3e4abe['attributes']:_0x48bce6[_0x1183('0x38')];if(!_0x287c13[_0x1183('0x3a')][_0x1183('0x41')](_0x1183('0x42'))){_0x3e4abe[_0x1183('0x24')]=qs[_0x1183('0x24')](_0x287c13[_0x1183('0x3a')]['limit']);_0x3e4abe[_0x1183('0x25')]=qs[_0x1183('0x25')](_0x287c13[_0x1183('0x3a')][_0x1183('0x25')]);}_0x3e4abe[_0x1183('0x43')]=qs[_0x1183('0x44')](_0x287c13[_0x1183('0x3a')][_0x1183('0x44')]);_0x3e4abe[_0x1183('0x45')]=qs[_0x1183('0x3c')](_[_0x1183('0x46')](_0x287c13[_0x1183('0x3a')],_0x48bce6[_0x1183('0x3c')]),_0x3e9ccb);if(_0x287c13[_0x1183('0x3a')][_0x1183('0x47')]){_0x3e4abe[_0x1183('0x45')]=_['merge'](_0x3e4abe[_0x1183('0x45')],{'$or':_[_0x1183('0x39')](_0x3e9ccb,function(_0x92d72){if(_0x92d72[_0x1183('0x48')]!==_0x1183('0x49')){var _0x52c144={};_0x52c144[_0x92d72[_0x1183('0x33')]]={'$like':'%'+_0x287c13['query'][_0x1183('0x47')]+'%'};return _0x52c144;}})});}_0x3e4abe=_['merge']({},_0x3e4abe,_0x287c13['options']);var _0x2c4a83={'where':_0x3e4abe[_0x1183('0x45')]};return db[_0x1183('0x35')][_0x1183('0x26')](_0x2c4a83)[_0x1183('0x2b')](function(_0x16c773){_0x59479e[_0x1183('0x26')]=_0x16c773;if(_0x287c13[_0x1183('0x3a')][_0x1183('0x4a')]){_0x3e4abe['include']=[{'all':!![]}];}return db[_0x1183('0x35')][_0x1183('0x4b')](_0x3e4abe);})[_0x1183('0x2b')](function(_0x14d172){_0x59479e['rows']=_0x14d172;return _0x59479e;})[_0x1183('0x2b')](respondWithFilteredResult(_0x55fc12,_0x3e4abe))[_0x1183('0x4c')](handleError(_0x55fc12,null));};exports['show']=function(_0x1d157a,_0x51a341){var _0x13074e={'raw':!![],'where':{'id':_0x1d157a[_0x1183('0x4d')]['id']}},_0x827d06={};_0x827d06['model']=_[_0x1183('0x3b')](db['FaxQueue'][_0x1183('0x36')]);_0x827d06[_0x1183('0x3a')]=_['keys'](_0x1d157a[_0x1183('0x3a')]);_0x827d06[_0x1183('0x3c')]=_[_0x1183('0x3d')](_0x827d06[_0x1183('0x38')],_0x827d06[_0x1183('0x3a')]);_0x13074e[_0x1183('0x3f')]=_[_0x1183('0x3d')](_0x827d06[_0x1183('0x38')],qs[_0x1183('0x3e')](_0x1d157a[_0x1183('0x3a')][_0x1183('0x3e')]));_0x13074e[_0x1183('0x3f')]=_0x13074e[_0x1183('0x3f')][_0x1183('0x40')]?_0x13074e[_0x1183('0x3f')]:_0x827d06[_0x1183('0x38')];if(_0x1d157a[_0x1183('0x3a')]['includeAll']){_0x13074e[_0x1183('0x4e')]=[{'all':!![]}];}_0x13074e=_[_0x1183('0x4f')]({},_0x13074e,_0x1d157a[_0x1183('0x50')]);return db[_0x1183('0x35')][_0x1183('0x51')](_0x13074e)['then'](handleEntityNotFound(_0x51a341,null))['then'](respondWithResult(_0x51a341,null))[_0x1183('0x4c')](handleError(_0x51a341,null));};exports[_0x1183('0x52')]=function(_0xeaedb0,_0x1eb941){return db[_0x1183('0x35')][_0x1183('0x52')](_0xeaedb0[_0x1183('0x53')],{})['then'](function(_0x222a5c){var _0x595397=_0xeaedb0[_0x1183('0x54')][_0x1183('0x2c')]({'plain':!![]});if(!_0x595397)throw new Error(_0x1183('0x55'));if(_0x595397[_0x1183('0x56')]===_0x1183('0x54')){var _0x5e4941=_0x222a5c[_0x1183('0x2c')]({'plain':!![]});var _0x177478='FaxQueues';return db[_0x1183('0x57')]['find']({'where':{'name':_0x177478,'userProfileId':_0x595397[_0x1183('0x58')]},'raw':!![]})['then'](function(_0x5b9524){if(_0x5b9524&&_0x5b9524[_0x1183('0x59')]===0x0){return db[_0x1183('0x2e')]['create']({'name':_0x5e4941[_0x1183('0x33')],'resourceId':_0x5e4941['id'],'type':_0x5b9524[_0x1183('0x33')],'sectionId':_0x5b9524['id']},{})[_0x1183('0x2b')](function(){return _0x222a5c;});}else{return _0x222a5c;}})[_0x1183('0x4c')](function(_0x174869){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x174869);throw _0x174869;});}return _0x222a5c;})[_0x1183('0x2b')](respondWithResult(_0x1eb941,0xc9))[_0x1183('0x4c')](handleError(_0x1eb941,null));};exports[_0x1183('0x2a')]=function(_0xebcd52,_0x269dc8){if(_0xebcd52['body']['id']){delete _0xebcd52[_0x1183('0x53')]['id'];}return db[_0x1183('0x35')][_0x1183('0x51')]({'where':{'id':_0xebcd52[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x269dc8,null))['then'](saveUpdates(_0xebcd52[_0x1183('0x53')],null))['then'](respondWithResult(_0x269dc8,null))[_0x1183('0x4c')](handleError(_0x269dc8,null));};exports[_0x1183('0x2f')]=function(_0x33e63e,_0x4d42b1){return db[_0x1183('0x35')][_0x1183('0x51')]({'where':{'id':_0x33e63e[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x4d42b1,null))[_0x1183('0x2b')](removeEntity(_0x4d42b1,null))[_0x1183('0x4c')](handleError(_0x4d42b1,null));};exports[_0x1183('0x5a')]=function(_0x54026a,_0x3b5d69){return db[_0x1183('0x35')][_0x1183('0x5a')]()[_0x1183('0x2b')](respondWithResult(_0x3b5d69,null))[_0x1183('0x4c')](handleError(_0x3b5d69,null));};exports[_0x1183('0x5b')]=function(_0x4f29a0,_0x181369,_0x98d91b){var _0x5ea202={'raw':!![],'where':{}},_0x5a54f9={},_0x34c1e2;return db['FaxQueue']['findOne']({'where':{'id':_0x4f29a0['params']['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x181369,null))['then'](function(_0xdc9789){if(_0xdc9789){_0x34c1e2=_0xdc9789['get']({'plain':!![]});_0x5a54f9[_0x1183('0x38')]=_[_0x1183('0x3b')](db[_0x1183('0x5c')][_0x1183('0x36')]);_0x5a54f9[_0x1183('0x3a')]=_[_0x1183('0x3b')](_0x4f29a0[_0x1183('0x3a')]);_0x5a54f9['filters']=_[_0x1183('0x3d')](_0x5a54f9[_0x1183('0x38')],_0x5a54f9['query']);_0x5ea202[_0x1183('0x3f')]=_['intersection'](_0x5a54f9[_0x1183('0x38')],qs[_0x1183('0x3e')](_0x4f29a0[_0x1183('0x3a')]['fields']));_0x5ea202[_0x1183('0x3f')]=_0x5ea202[_0x1183('0x3f')][_0x1183('0x40')]?_0x5ea202[_0x1183('0x3f')]:_0x5a54f9[_0x1183('0x38')];if(!_0x4f29a0[_0x1183('0x3a')][_0x1183('0x41')](_0x1183('0x42'))){_0x5ea202[_0x1183('0x24')]=qs[_0x1183('0x24')](_0x4f29a0['query'][_0x1183('0x24')]);_0x5ea202[_0x1183('0x25')]=qs[_0x1183('0x25')](_0x4f29a0[_0x1183('0x3a')][_0x1183('0x25')]);}_0x5ea202['order']=qs['sort'](_0x4f29a0[_0x1183('0x3a')]['sort']);_0x5ea202[_0x1183('0x45')]=qs[_0x1183('0x3c')](_[_0x1183('0x46')](_0x4f29a0[_0x1183('0x3a')],_0x5a54f9[_0x1183('0x3c')]));_0x5ea202[_0x1183('0x45')]['FaxQueueId']=_0xdc9789['id'];if(_0x4f29a0[_0x1183('0x3a')]['filter']){_0x5ea202[_0x1183('0x45')]=_['merge'](_0x5ea202[_0x1183('0x45')],{'$or':_[_0x1183('0x39')](_0x5ea202['attributes'],function(_0xea8fb8){var _0x3f3d44={};_0x3f3d44[_0xea8fb8]={'$like':'%'+_0x4f29a0[_0x1183('0x3a')][_0x1183('0x47')]+'%'};return _0x3f3d44;})});}_0x5ea202=_['merge']({},_0x5ea202,_0x4f29a0[_0x1183('0x50')]);return db['UserFaxQueue']['findAll'](_0x5ea202);}})[_0x1183('0x2b')](function(_0x51b66e){if(_0x51b66e){return db[_0x1183('0x5d')][_0x1183('0x5e')]({'where':{'id':_[_0x1183('0x39')](_0x51b66e,_0x1183('0x5f')),'role':_0x1183('0x60')},'attributes':['id',_0x1183('0x33'),'faxPause',_0x1183('0x61'),_0x1183('0x62')]});}})[_0x1183('0x2b')](function(_0x1483d0){if(_0x1483d0){return{'count':_0x1483d0[_0x1183('0x26')],'rows':_[_0x1183('0x39')](_0x1483d0[_0x1183('0x63')],function(_0xa85787){return{'membername':_0xa85787[_0x1183('0x33')],'UserId':_0xa85787['id'],'queue_name':_0x34c1e2[_0x1183('0x33')],'FaxQueueId':_0x34c1e2['id'],'interface':util[_0x1183('0x64')]('%s/%s','SIP',_0xa85787[_0x1183('0x33')]),'penalty':0x0,'paused':_0xa85787[_0x1183('0x65')],'createdAt':_0xa85787[_0x1183('0x62')],'updatedAt':_0xa85787[_0x1183('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1183('0x2b')](respondWithFilteredResult(_0x181369,_0x5ea202))[_0x1183('0x4c')](handleError(_0x181369,null));};exports['getTeams']=function(_0x4003d4,_0x1fe7a1,_0x591847){var _0x959699={};var _0x526276={};var _0x2aec03;var _0x5eeb9c;return db[_0x1183('0x35')][_0x1183('0x66')]({'where':{'id':_0x4003d4[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x1fe7a1,null))[_0x1183('0x2b')](function(_0x3ee6ab){if(_0x3ee6ab){_0x2aec03=_0x3ee6ab;_0x526276['model']=_[_0x1183('0x3b')](db[_0x1183('0x67')][_0x1183('0x36')]);_0x526276['query']=_[_0x1183('0x3b')](_0x4003d4[_0x1183('0x3a')]);_0x526276[_0x1183('0x3c')]=_[_0x1183('0x3d')](_0x526276[_0x1183('0x38')],_0x526276[_0x1183('0x3a')]);_0x959699['attributes']=_[_0x1183('0x3d')](_0x526276['model'],qs['fields'](_0x4003d4['query'][_0x1183('0x3e')]));_0x959699[_0x1183('0x3f')]=_0x959699[_0x1183('0x3f')][_0x1183('0x40')]?_0x959699[_0x1183('0x3f')]:_0x526276[_0x1183('0x38')];_0x959699['order']=qs[_0x1183('0x44')](_0x4003d4['query'][_0x1183('0x44')]);_0x959699[_0x1183('0x45')]=qs[_0x1183('0x3c')](_[_0x1183('0x46')](_0x4003d4[_0x1183('0x3a')],_0x526276['filters']));if(_0x4003d4[_0x1183('0x3a')][_0x1183('0x47')]){_0x959699[_0x1183('0x45')]=_[_0x1183('0x4f')](_0x959699['where'],{'$or':_[_0x1183('0x39')](_0x959699[_0x1183('0x3f')],function(_0xe05309){var _0x2d1baa={};_0x2d1baa[_0xe05309]={'$like':'%'+_0x4003d4[_0x1183('0x3a')][_0x1183('0x47')]+'%'};return _0x2d1baa;})});}_0x959699=_[_0x1183('0x4f')]({},_0x959699,_0x4003d4[_0x1183('0x50')]);return _0x2aec03[_0x1183('0x68')](_0x959699);}})[_0x1183('0x2b')](function(_0x351690){if(_0x351690){_0x5eeb9c=_0x351690[_0x1183('0x40')];if(!_0x4003d4[_0x1183('0x3a')]['hasOwnProperty'](_0x1183('0x42'))){_0x959699[_0x1183('0x24')]=qs[_0x1183('0x24')](_0x4003d4[_0x1183('0x3a')][_0x1183('0x24')]);_0x959699[_0x1183('0x25')]=qs[_0x1183('0x25')](_0x4003d4[_0x1183('0x3a')]['offset']);}return _0x2aec03[_0x1183('0x68')](_0x959699);}})[_0x1183('0x2b')](function(_0x2ebd15){if(_0x2ebd15){return _0x2ebd15?{'count':_0x5eeb9c,'rows':_0x2ebd15}:null;}})[_0x1183('0x2b')](respondWithResult(_0x1fe7a1,null))['catch'](handleError(_0x1fe7a1,null));};exports[_0x1183('0x69')]=function(_0x2d0433,_0x5c900b,_0x4b3039){var _0x169a33=_0x2d0433['body'][_0x1183('0x6a')];return db[_0x1183('0x67')][_0x1183('0x4b')]({'where':{'id':_0x169a33},'attributes':['id'],'include':[{'model':db[_0x1183('0x5d')],'as':_0x1183('0x6b'),'attributes':['id',_0x1183('0x33'),_0x1183('0x6c'),_0x1183('0x6d'),_0x1183('0x6e')],'raw':!![]}]})['then'](function(_0x2da4df){if(_0x2da4df){var _0x5a566e=_[_0x1183('0x6f')](_0x2da4df,function(_0x2db2bf){var _0x39dab0=_0x2db2bf['get']({'plain':!![]});return _0x39dab0[_0x1183('0x6b')];});return db[_0x1183('0x35')][_0x1183('0x51')]({'where':{'id':_0x2d0433[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](function(_0x3d58be){return db[_0x1183('0x70')][_0x1183('0x71')](function(_0x310fdf){return _0x3d58be[_0x1183('0x69')](_0x169a33,{'transaction':_0x310fdf})[_0x1183('0x2b')](function(){return BPromise[_0x1183('0x72')](_0x5a566e,function(_0x5da80e){return db[_0x1183('0x5c')][_0x1183('0x73')]({'where':{'UserId':_0x5da80e['id'],'FaxQueueId':_0x2d0433[_0x1183('0x4d')]['id']},'transaction':_0x310fdf});});})[_0x1183('0x2b')](function(){_0x5a566e[_0x1183('0x74')](function(_0x311726){socket['emit']('userFaxQueue:save',{'UserId':_0x311726['id'],'FaxQueueId':_0x3d58be['id']});});});});});}})[_0x1183('0x2b')](respondWithStatusCode(_0x5c900b,null))[_0x1183('0x4c')](handleError(_0x5c900b,null));};exports[_0x1183('0x75')]=function(_0xc03486,_0x20cc69,_0x40de9b){return db[_0x1183('0x67')]['findAll']({'where':{'id':_0xc03486['query'][_0x1183('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x1183('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1183('0x2b')](handleEntityNotFound(_0x20cc69,null))[_0x1183('0x2b')](function(_0x24971d){var _0x29934a=_[_0x1183('0x39')](_0x24971d,'id');var _0x2c3b3a=[];var _0x5e34a2=[];var _0x29e00e=squel[_0x1183('0x76')]();_0x29e00e['field'](_0x1183('0x77'))[_0x1183('0x78')](_0x1183('0x79'),'tq')[_0x1183('0x7a')]('user_has_teams','ut',_0x1183('0x7b'))[_0x1183('0x45')](_0x1183('0x7c'),_0xc03486[_0x1183('0x4d')]['id']);for(var _0x420326=0x0;_0x420326<_0x24971d['length'];_0x420326+=0x1){let _0x3ed01a=_0x24971d[_0x420326];for(var _0x5cedb3=0x0;_0x5cedb3<_0x3ed01a['Agents'][_0x1183('0x40')];_0x5cedb3+=0x1){let _0x51f1ea=_0x3ed01a[_0x1183('0x6b')][_0x5cedb3];var _0x126e9d=_0x29e00e[_0x1183('0x7d')]();_0x126e9d[_0x1183('0x45')](_0x1183('0x7e'),_0x51f1ea['id']);_0x5e34a2[_0x1183('0x7f')](db[_0x1183('0x70')][_0x1183('0x3a')](_0x126e9d[_0x1183('0x80')](),{'type':db[_0x1183('0x70')][_0x1183('0x81')][_0x1183('0x82')]})[_0x1183('0x2b')](function(_0x1fa182){if(_0x1fa182['length']===0x1){return _0x51f1ea['id'];}else{var _0x1cec39=_['every'](_['map'](_0x1fa182,_0x1183('0x83')),function(_0x2dadca){return _[_0x1183('0x84')](_0x29934a,_0x2dadca);});if(_0x1cec39){return _0x51f1ea['id'];}}}));}}return BPromise[_0x1183('0x85')](_0x5e34a2)[_0x1183('0x2b')](function(_0x32f5f2){_0x2c3b3a=_(_0x2c3b3a)['union'](_0x32f5f2)['compact']()['value']();return db[_0x1183('0x35')][_0x1183('0x51')]({'where':{'id':_0xc03486[_0x1183('0x4d')]['id']}})['then'](function(_0x388029){return db[_0x1183('0x70')][_0x1183('0x71')](function(_0x5d5cfe){return _0x388029[_0x1183('0x75')](_0xc03486['query'][_0x1183('0x6a')],{'transaction':_0x5d5cfe})[_0x1183('0x2b')](function(){if(!_[_0x1183('0x86')](_0x2c3b3a)){return _0x388029['removeAgents'](_0x2c3b3a,{'transaction':_0x5d5cfe});}})['then'](function(){_0x2c3b3a['forEach'](function(_0x3421bc){socket[_0x1183('0x87')](_0x1183('0x88'),{'UserId':_0x3421bc,'FaxQueueId':_0x388029['id']});});});});});});})[_0x1183('0x2b')](respondWithStatusCode(_0x20cc69,null))[_0x1183('0x4c')](handleError(_0x20cc69,null));};exports[_0x1183('0x89')]=function(_0x2c7b92,_0x4153b1,_0x4e86b2){return db['FaxQueue'][_0x1183('0x51')]({'where':{'id':_0x2c7b92[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x4153b1,null))['then'](function(_0x2797ed){if(_0x2797ed){return _0x2797ed[_0x1183('0x89')](_0x2c7b92[_0x1183('0x53')][_0x1183('0x6a')],_['omit'](_0x2c7b92[_0x1183('0x53')],[_0x1183('0x6a'),'id'])||{})[_0x1183('0x8a')](function(_0x3194a1){for(var _0xd5690f=0x0;_0xd5690f<_0x2c7b92[_0x1183('0x53')]['ids'][_0x1183('0x40')];_0xd5690f+=0x1){socket['emit'](_0x1183('0x8b'),{'UserId':Number(_0x2c7b92['body'][_0x1183('0x6a')][_0xd5690f]),'FaxQueueId':Number(_0x2c7b92['params']['id'])});}return _0x3194a1;});}})['then'](respondWithResult(_0x4153b1,null))[_0x1183('0x4c')](handleError(_0x4153b1,null));};exports[_0x1183('0x8c')]=function(_0x53fccd,_0x31d2a9,_0x1cf78b){return db[_0x1183('0x35')][_0x1183('0x51')]({'where':{'id':_0x53fccd[_0x1183('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31d2a9,null))[_0x1183('0x2b')](function(_0x18d670){if(_0x18d670){return _0x18d670[_0x1183('0x8c')](_0x53fccd[_0x1183('0x3a')][_0x1183('0x6a')])[_0x1183('0x2b')](function(){if(_['isArray'](_0x53fccd['query'][_0x1183('0x6a')])){for(var _0x3730cb=0x0;_0x3730cb<_0x53fccd['query'][_0x1183('0x6a')][_0x1183('0x40')];_0x3730cb+=0x1){socket[_0x1183('0x87')]('userFaxQueue:remove',{'UserId':Number(_0x53fccd[_0x1183('0x3a')]['ids'][_0x3730cb]),'FaxQueueId':Number(_0x53fccd[_0x1183('0x4d')]['id'])});}}else{socket[_0x1183('0x87')](_0x1183('0x88'),{'UserId':Number(_0x53fccd[_0x1183('0x3a')][_0x1183('0x6a')]),'FaxQueueId':Number(_0x53fccd[_0x1183('0x4d')]['id'])});}});}})[_0x1183('0x2b')](respondWithStatusCode(_0x31d2a9,null))[_0x1183('0x4c')](handleError(_0x31d2a9,null));};exports[_0x1183('0x8d')]=function(_0x405716,_0x20b762,_0x597f5d){var _0x31f8c0={};var _0x2eb97a={};var _0x388bdb;var _0x288d69;return db[_0x1183('0x35')][_0x1183('0x66')]({'where':{'id':_0x405716[_0x1183('0x4d')]['id']}})[_0x1183('0x2b')](handleEntityNotFound(_0x20b762,null))[_0x1183('0x2b')](function(_0x2fbe7e){if(_0x2fbe7e){_0x388bdb=_0x2fbe7e;_0x2eb97a[_0x1183('0x38')]=_['keys'](db['User'][_0x1183('0x36')]);_0x2eb97a['query']=_[_0x1183('0x3b')](_0x405716[_0x1183('0x3a')]);_0x2eb97a['filters']=_[_0x1183('0x3d')](_0x2eb97a[_0x1183('0x38')],_0x2eb97a[_0x1183('0x3a')]);_0x31f8c0['attributes']=_['intersection'](_0x2eb97a['model'],qs[_0x1183('0x3e')](_0x405716[_0x1183('0x3a')][_0x1183('0x3e')]));_0x31f8c0[_0x1183('0x3f')]=_0x31f8c0[_0x1183('0x3f')][_0x1183('0x40')]?_0x31f8c0[_0x1183('0x3f')]:_0x2eb97a[_0x1183('0x38')];_0x31f8c0[_0x1183('0x43')]=qs[_0x1183('0x44')](_0x405716[_0x1183('0x3a')][_0x1183('0x44')]);_0x31f8c0['where']=qs['filters'](_[_0x1183('0x46')](_0x405716[_0x1183('0x3a')],_0x2eb97a[_0x1183('0x3c')]));if(_0x405716[_0x1183('0x3a')]['filter']){_0x31f8c0[_0x1183('0x45')]=_[_0x1183('0x4f')](_0x31f8c0['where'],{'$or':_[_0x1183('0x39')](_0x31f8c0[_0x1183('0x3f')],function(_0x488322){var _0x3ea39c={};_0x3ea39c[_0x488322]={'$like':'%'+_0x405716[_0x1183('0x3a')][_0x1183('0x47')]+'%'};return _0x3ea39c;})});}_0x31f8c0=_[_0x1183('0x4f')]({},_0x31f8c0,_0x405716[_0x1183('0x50')]);return _0x388bdb[_0x1183('0x8d')](_0x31f8c0);}})[_0x1183('0x2b')](function(_0x32f0fc){if(_0x32f0fc){_0x288d69=_0x32f0fc[_0x1183('0x40')];if(!_0x405716['query'][_0x1183('0x41')](_0x1183('0x42'))){_0x31f8c0[_0x1183('0x24')]=qs[_0x1183('0x24')](_0x405716['query'][_0x1183('0x24')]);_0x31f8c0[_0x1183('0x25')]=qs[_0x1183('0x25')](_0x405716[_0x1183('0x3a')][_0x1183('0x25')]);}return _0x388bdb[_0x1183('0x8d')](_0x31f8c0);}})[_0x1183('0x2b')](function(_0x272d4c){if(_0x272d4c){return _0x272d4c?{'count':_0x288d69,'rows':_0x272d4c}:null;}})[_0x1183('0x2b')](respondWithResult(_0x20b762,null))['catch'](handleError(_0x20b762,null));}; \ No newline at end of file +var _0x1398=['offset','limit','undefined','count','set','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','order','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','online','interface','flatMap','Agents','transaction','each','UserFaxQueue','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','omit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x1398,0x6c));var _0x8139=function(_0x540d1b,_0x299918){_0x540d1b=_0x540d1b-0x0;var _0xbc547b=_0x1398[_0x540d1b];return _0xbc547b;};'use strict';var emlformat=require(_0x8139('0x0'));var rimraf=require(_0x8139('0x1'));var zipdir=require(_0x8139('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8139('0x3'));var moment=require(_0x8139('0x4'));var BPromise=require(_0x8139('0x5'));var Mustache=require(_0x8139('0x6'));var util=require(_0x8139('0x7'));var path=require('path');var sox=require(_0x8139('0x8'));var csv=require(_0x8139('0x9'));var ejs=require(_0x8139('0xa'));var fs=require('fs');var fs_extra=require(_0x8139('0xb'));var _=require(_0x8139('0xc'));var squel=require(_0x8139('0xd'));var crypto=require('crypto');var jsforce=require(_0x8139('0xe'));var deskjs=require(_0x8139('0xf'));var toCsv=require(_0x8139('0x9'));var querystring=require(_0x8139('0x10'));var Papa=require(_0x8139('0x11'));var Redis=require(_0x8139('0x12'));var authService=require(_0x8139('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8139('0x14'));var logger=require(_0x8139('0x15'))(_0x8139('0x16'));var utils=require(_0x8139('0x17'));var config=require(_0x8139('0x18'));var licenseUtil=require(_0x8139('0x19'));var db=require(_0x8139('0x1a'))['db'];config[_0x8139('0x1b')]=_[_0x8139('0x1c')](config[_0x8139('0x1b')],{'host':_0x8139('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8139('0x1e'))[_0x8139('0x1f')](socket);function respondWithStatusCode(_0xafd665,_0x3954a8){_0x3954a8=_0x3954a8||0xcc;return function(_0x2a71d7){if(_0x2a71d7){return _0xafd665[_0x8139('0x20')](_0x3954a8);}return _0xafd665[_0x8139('0x21')](_0x3954a8)[_0x8139('0x22')]();};}function respondWithResult(_0x1b598c,_0x56f1f6){_0x56f1f6=_0x56f1f6||0xc8;return function(_0x3e215f){if(_0x3e215f){return _0x1b598c[_0x8139('0x21')](_0x56f1f6)[_0x8139('0x23')](_0x3e215f);}};}function respondWithFilteredResult(_0x1fc000,_0x1dfad2){return function(_0x1282f6){if(_0x1282f6){var _0x3f0d3a=typeof _0x1dfad2[_0x8139('0x24')]==='undefined'&&typeof _0x1dfad2[_0x8139('0x25')]===_0x8139('0x26');var _0xd57ba5=_0x1282f6['count'];var _0x1853ad=_0x3f0d3a?0x0:_0x1dfad2['offset'];var _0x5638b6=_0x3f0d3a?_0x1282f6[_0x8139('0x27')]:_0x1dfad2['offset']+_0x1dfad2[_0x8139('0x25')];var _0x57fa1e;if(_0x5638b6>=_0xd57ba5){_0x5638b6=_0xd57ba5;_0x57fa1e=0xc8;}else{_0x57fa1e=0xce;}_0x1fc000[_0x8139('0x21')](_0x57fa1e);return _0x1fc000[_0x8139('0x28')]('Content-Range',_0x1853ad+'-'+_0x5638b6+'/'+_0xd57ba5)[_0x8139('0x23')](_0x1282f6);}return null;};}function patchUpdates(_0x1f2d43){return function(_0x21a7a0){try{jsonpatch['apply'](_0x21a7a0,_0x1f2d43,!![]);}catch(_0x1445a5){return BPromise[_0x8139('0x29')](_0x1445a5);}return _0x21a7a0[_0x8139('0x2a')]();};}function saveUpdates(_0x4eaf51,_0x2302c5){return function(_0x297876){if(_0x297876){return _0x297876[_0x8139('0x2b')](_0x4eaf51)[_0x8139('0x2c')](function(_0x28af43){return _0x28af43;});}return null;};}function removeEntity(_0x44e71c,_0x2b3a44){return function(_0x508ab8){if(_0x508ab8){return _0x508ab8[_0x8139('0x2d')]()[_0x8139('0x2c')](function(){var _0x19b21e=_0x508ab8[_0x8139('0x2e')]({'plain':!![]});var _0x9e3460=_0x8139('0x2f');return db['UserProfileResource'][_0x8139('0x2d')]({'where':{'type':_0x9e3460,'resourceId':_0x19b21e['id']}})[_0x8139('0x2c')](function(){return _0x508ab8;});})[_0x8139('0x2c')](function(){_0x44e71c[_0x8139('0x21')](0xcc)[_0x8139('0x22')]();});}};}function handleEntityNotFound(_0x460a1a,_0x357907){return function(_0x52a4ca){if(!_0x52a4ca){_0x460a1a[_0x8139('0x20')](0x194);}return _0x52a4ca;};}function handleError(_0x55a22a,_0x186e8d){_0x186e8d=_0x186e8d||0x1f4;return function(_0x20ec5d){logger[_0x8139('0x30')](_0x20ec5d[_0x8139('0x31')]);if(_0x20ec5d[_0x8139('0x32')]){delete _0x20ec5d[_0x8139('0x32')];}_0x55a22a['status'](_0x186e8d)[_0x8139('0x33')](_0x20ec5d);};}exports[_0x8139('0x34')]=function(_0x17ed84,_0x1f309d){var _0x26db2f={},_0x5a897d={},_0x560f79={'count':0x0,'rows':[]};var _0x28a514=_[_0x8139('0x35')](db[_0x8139('0x36')][_0x8139('0x37')],function(_0x22c125){return{'name':_0x22c125[_0x8139('0x38')],'type':_0x22c125['type'][_0x8139('0x39')]};});_0x5a897d['model']=_[_0x8139('0x35')](_0x28a514,'name');_0x5a897d[_0x8139('0x3a')]=_[_0x8139('0x3b')](_0x17ed84['query']);_0x5a897d[_0x8139('0x3c')]=_['intersection'](_0x5a897d[_0x8139('0x3d')],_0x5a897d[_0x8139('0x3a')]);_0x26db2f[_0x8139('0x3e')]=_['intersection'](_0x5a897d[_0x8139('0x3d')],qs['fields'](_0x17ed84['query'][_0x8139('0x3f')]));_0x26db2f[_0x8139('0x3e')]=_0x26db2f['attributes'][_0x8139('0x40')]?_0x26db2f['attributes']:_0x5a897d['model'];if(!_0x17ed84['query'][_0x8139('0x41')](_0x8139('0x42'))){_0x26db2f[_0x8139('0x25')]=qs['limit'](_0x17ed84[_0x8139('0x3a')][_0x8139('0x25')]);_0x26db2f[_0x8139('0x24')]=qs['offset'](_0x17ed84[_0x8139('0x3a')][_0x8139('0x24')]);}_0x26db2f['order']=qs['sort'](_0x17ed84[_0x8139('0x3a')][_0x8139('0x43')]);_0x26db2f[_0x8139('0x44')]=qs[_0x8139('0x3c')](_[_0x8139('0x45')](_0x17ed84[_0x8139('0x3a')],_0x5a897d['filters']),_0x28a514);if(_0x17ed84[_0x8139('0x3a')][_0x8139('0x46')]){_0x26db2f[_0x8139('0x44')]=_[_0x8139('0x47')](_0x26db2f[_0x8139('0x44')],{'$or':_[_0x8139('0x35')](_0x28a514,function(_0x5666af){if(_0x5666af['type']!==_0x8139('0x48')){var _0x784889={};_0x784889[_0x5666af[_0x8139('0x32')]]={'$like':'%'+_0x17ed84[_0x8139('0x3a')]['filter']+'%'};return _0x784889;}})});}_0x26db2f=_[_0x8139('0x47')]({},_0x26db2f,_0x17ed84[_0x8139('0x49')]);var _0x7f6e={'where':_0x26db2f['where']};return db[_0x8139('0x36')][_0x8139('0x27')](_0x7f6e)[_0x8139('0x2c')](function(_0x565075){_0x560f79['count']=_0x565075;if(_0x17ed84[_0x8139('0x3a')][_0x8139('0x4a')]){_0x26db2f[_0x8139('0x4b')]=[{'all':!![]}];}return db[_0x8139('0x36')][_0x8139('0x4c')](_0x26db2f);})[_0x8139('0x2c')](function(_0x551089){_0x560f79[_0x8139('0x4d')]=_0x551089;return _0x560f79;})[_0x8139('0x2c')](respondWithFilteredResult(_0x1f309d,_0x26db2f))['catch'](handleError(_0x1f309d,null));};exports[_0x8139('0x4e')]=function(_0x48a6f6,_0x7188ee){var _0x43f6df={'raw':!![],'where':{'id':_0x48a6f6['params']['id']}},_0x3547f5={};_0x3547f5[_0x8139('0x3d')]=_[_0x8139('0x3b')](db[_0x8139('0x36')]['rawAttributes']);_0x3547f5[_0x8139('0x3a')]=_[_0x8139('0x3b')](_0x48a6f6['query']);_0x3547f5[_0x8139('0x3c')]=_[_0x8139('0x4f')](_0x3547f5[_0x8139('0x3d')],_0x3547f5[_0x8139('0x3a')]);_0x43f6df[_0x8139('0x3e')]=_[_0x8139('0x4f')](_0x3547f5[_0x8139('0x3d')],qs[_0x8139('0x3f')](_0x48a6f6[_0x8139('0x3a')][_0x8139('0x3f')]));_0x43f6df[_0x8139('0x3e')]=_0x43f6df['attributes']['length']?_0x43f6df[_0x8139('0x3e')]:_0x3547f5[_0x8139('0x3d')];if(_0x48a6f6[_0x8139('0x3a')][_0x8139('0x4a')]){_0x43f6df['include']=[{'all':!![]}];}_0x43f6df=_[_0x8139('0x47')]({},_0x43f6df,_0x48a6f6[_0x8139('0x49')]);return db[_0x8139('0x36')]['find'](_0x43f6df)[_0x8139('0x2c')](handleEntityNotFound(_0x7188ee,null))[_0x8139('0x2c')](respondWithResult(_0x7188ee,null))[_0x8139('0x50')](handleError(_0x7188ee,null));};exports['create']=function(_0x569292,_0x306c47){return db['FaxQueue']['create'](_0x569292[_0x8139('0x51')],{})['then'](function(_0x2ed5df){var _0x3239e6=_0x569292[_0x8139('0x52')][_0x8139('0x2e')]({'plain':!![]});if(!_0x3239e6)throw new Error(_0x8139('0x53'));if(_0x3239e6['role']===_0x8139('0x52')){var _0x8e691a=_0x2ed5df[_0x8139('0x2e')]({'plain':!![]});var _0x25dcbd='FaxQueues';return db[_0x8139('0x54')][_0x8139('0x55')]({'where':{'name':_0x25dcbd,'userProfileId':_0x3239e6[_0x8139('0x56')]},'raw':!![]})[_0x8139('0x2c')](function(_0x517eb4){if(_0x517eb4&&_0x517eb4['autoAssociation']===0x0){return db[_0x8139('0x57')]['create']({'name':_0x8e691a[_0x8139('0x32')],'resourceId':_0x8e691a['id'],'type':_0x517eb4[_0x8139('0x32')],'sectionId':_0x517eb4['id']},{})['then'](function(){return _0x2ed5df;});}else{return _0x2ed5df;}})[_0x8139('0x50')](function(_0x10bab3){logger['error'](_0x8139('0x58'),_0x10bab3);throw _0x10bab3;});}return _0x2ed5df;})[_0x8139('0x2c')](respondWithResult(_0x306c47,0xc9))[_0x8139('0x50')](handleError(_0x306c47,null));};exports[_0x8139('0x2b')]=function(_0x584311,_0x23299d){if(_0x584311['body']['id']){delete _0x584311[_0x8139('0x51')]['id'];}return db[_0x8139('0x36')]['find']({'where':{'id':_0x584311[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x23299d,null))[_0x8139('0x2c')](saveUpdates(_0x584311[_0x8139('0x51')],null))[_0x8139('0x2c')](respondWithResult(_0x23299d,null))[_0x8139('0x50')](handleError(_0x23299d,null));};exports[_0x8139('0x2d')]=function(_0x392b9a,_0x37d454){return db[_0x8139('0x36')][_0x8139('0x55')]({'where':{'id':_0x392b9a[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x37d454,null))[_0x8139('0x2c')](removeEntity(_0x37d454,null))[_0x8139('0x50')](handleError(_0x37d454,null));};exports[_0x8139('0x5a')]=function(_0x494548,_0x16dad2){return db['FaxQueue'][_0x8139('0x5a')]()[_0x8139('0x2c')](respondWithResult(_0x16dad2,null))['catch'](handleError(_0x16dad2,null));};exports[_0x8139('0x5b')]=function(_0x5a97c,_0x11a892,_0x52775c){var _0x558160={'raw':!![],'where':{}},_0x1eeffd={},_0x19bd2b;return db['FaxQueue'][_0x8139('0x5c')]({'where':{'id':_0x5a97c[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x11a892,null))[_0x8139('0x2c')](function(_0x3b7757){if(_0x3b7757){_0x19bd2b=_0x3b7757[_0x8139('0x2e')]({'plain':!![]});_0x1eeffd['model']=_[_0x8139('0x3b')](db['UserFaxQueue'][_0x8139('0x37')]);_0x1eeffd[_0x8139('0x3a')]=_[_0x8139('0x3b')](_0x5a97c[_0x8139('0x3a')]);_0x1eeffd[_0x8139('0x3c')]=_[_0x8139('0x4f')](_0x1eeffd[_0x8139('0x3d')],_0x1eeffd[_0x8139('0x3a')]);_0x558160[_0x8139('0x3e')]=_[_0x8139('0x4f')](_0x1eeffd[_0x8139('0x3d')],qs[_0x8139('0x3f')](_0x5a97c[_0x8139('0x3a')]['fields']));_0x558160[_0x8139('0x3e')]=_0x558160[_0x8139('0x3e')][_0x8139('0x40')]?_0x558160[_0x8139('0x3e')]:_0x1eeffd['model'];if(!_0x5a97c[_0x8139('0x3a')][_0x8139('0x41')](_0x8139('0x42'))){_0x558160['limit']=qs[_0x8139('0x25')](_0x5a97c[_0x8139('0x3a')][_0x8139('0x25')]);_0x558160[_0x8139('0x24')]=qs[_0x8139('0x24')](_0x5a97c['query']['offset']);}_0x558160[_0x8139('0x5d')]=qs['sort'](_0x5a97c['query'][_0x8139('0x43')]);_0x558160[_0x8139('0x44')]=qs[_0x8139('0x3c')](_['pick'](_0x5a97c[_0x8139('0x3a')],_0x1eeffd[_0x8139('0x3c')]));_0x558160[_0x8139('0x44')][_0x8139('0x5e')]=_0x3b7757['id'];if(_0x5a97c[_0x8139('0x3a')][_0x8139('0x46')]){_0x558160[_0x8139('0x44')]=_[_0x8139('0x47')](_0x558160[_0x8139('0x44')],{'$or':_[_0x8139('0x35')](_0x558160[_0x8139('0x3e')],function(_0x12e6c6){var _0x1176a7={};_0x1176a7[_0x12e6c6]={'$like':'%'+_0x5a97c[_0x8139('0x3a')][_0x8139('0x46')]+'%'};return _0x1176a7;})});}_0x558160=_['merge']({},_0x558160,_0x5a97c['options']);return db['UserFaxQueue']['findAll'](_0x558160);}})[_0x8139('0x2c')](function(_0x200eed){if(_0x200eed){return db[_0x8139('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x200eed,_0x8139('0x60')),'role':_0x8139('0x61')},'attributes':['id',_0x8139('0x32'),_0x8139('0x62'),_0x8139('0x63'),_0x8139('0x64')]});}})[_0x8139('0x2c')](function(_0x4fcd23){if(_0x4fcd23){return{'count':_0x4fcd23['count'],'rows':_[_0x8139('0x35')](_0x4fcd23[_0x8139('0x4d')],function(_0xa620df){return{'membername':_0xa620df[_0x8139('0x32')],'UserId':_0xa620df['id'],'queue_name':_0x19bd2b[_0x8139('0x32')],'FaxQueueId':_0x19bd2b['id'],'interface':util['format'](_0x8139('0x65'),_0x8139('0x66'),_0xa620df[_0x8139('0x32')]),'penalty':0x0,'paused':_0xa620df[_0x8139('0x62')],'createdAt':_0xa620df['createdAt'],'updatedAt':_0xa620df[_0x8139('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x11a892,_0x558160))['catch'](handleError(_0x11a892,null));};exports[_0x8139('0x67')]=function(_0x566337,_0x4a70d8,_0x1443c9){var _0x5ee8df={};var _0x45ddda={};var _0x3602a2;var _0x3ead72;return db['FaxQueue'][_0x8139('0x5c')]({'where':{'id':_0x566337[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x4a70d8,null))[_0x8139('0x2c')](function(_0xc9b957){if(_0xc9b957){_0x3602a2=_0xc9b957;_0x45ddda[_0x8139('0x3d')]=_[_0x8139('0x3b')](db[_0x8139('0x68')][_0x8139('0x37')]);_0x45ddda[_0x8139('0x3a')]=_[_0x8139('0x3b')](_0x566337[_0x8139('0x3a')]);_0x45ddda[_0x8139('0x3c')]=_['intersection'](_0x45ddda[_0x8139('0x3d')],_0x45ddda[_0x8139('0x3a')]);_0x5ee8df['attributes']=_['intersection'](_0x45ddda[_0x8139('0x3d')],qs[_0x8139('0x3f')](_0x566337[_0x8139('0x3a')][_0x8139('0x3f')]));_0x5ee8df[_0x8139('0x3e')]=_0x5ee8df[_0x8139('0x3e')]['length']?_0x5ee8df[_0x8139('0x3e')]:_0x45ddda[_0x8139('0x3d')];_0x5ee8df[_0x8139('0x5d')]=qs[_0x8139('0x43')](_0x566337[_0x8139('0x3a')][_0x8139('0x43')]);_0x5ee8df['where']=qs[_0x8139('0x3c')](_[_0x8139('0x45')](_0x566337[_0x8139('0x3a')],_0x45ddda[_0x8139('0x3c')]));if(_0x566337[_0x8139('0x3a')][_0x8139('0x46')]){_0x5ee8df[_0x8139('0x44')]=_[_0x8139('0x47')](_0x5ee8df[_0x8139('0x44')],{'$or':_[_0x8139('0x35')](_0x5ee8df[_0x8139('0x3e')],function(_0x8a43eb){var _0x231b6f={};_0x231b6f[_0x8a43eb]={'$like':'%'+_0x566337['query']['filter']+'%'};return _0x231b6f;})});}_0x5ee8df=_[_0x8139('0x47')]({},_0x5ee8df,_0x566337[_0x8139('0x49')]);return _0x3602a2[_0x8139('0x67')](_0x5ee8df);}})[_0x8139('0x2c')](function(_0x35100e){if(_0x35100e){_0x3ead72=_0x35100e[_0x8139('0x40')];if(!_0x566337[_0x8139('0x3a')][_0x8139('0x41')](_0x8139('0x42'))){_0x5ee8df[_0x8139('0x25')]=qs[_0x8139('0x25')](_0x566337[_0x8139('0x3a')][_0x8139('0x25')]);_0x5ee8df['offset']=qs['offset'](_0x566337['query'][_0x8139('0x24')]);}return _0x3602a2['getTeams'](_0x5ee8df);}})['then'](function(_0x89ee93){if(_0x89ee93){return _0x89ee93?{'count':_0x3ead72,'rows':_0x89ee93}:null;}})[_0x8139('0x2c')](respondWithResult(_0x4a70d8,null))[_0x8139('0x50')](handleError(_0x4a70d8,null));};exports[_0x8139('0x69')]=function(_0x2c8ce0,_0x573b7e,_0x579e3b){var _0x34f66a=_0x2c8ce0[_0x8139('0x51')]['ids'];return db[_0x8139('0x68')][_0x8139('0x4c')]({'where':{'id':_0x34f66a},'attributes':['id'],'include':[{'model':db[_0x8139('0x5f')],'as':'Agents','attributes':['id',_0x8139('0x32'),_0x8139('0x6a'),'voicePause',_0x8139('0x6b')],'raw':!![]}]})[_0x8139('0x2c')](function(_0x29c88b){if(_0x29c88b){var _0x35c045=_[_0x8139('0x6c')](_0x29c88b,function(_0x11d670){var _0x263e61=_0x11d670[_0x8139('0x2e')]({'plain':!![]});return _0x263e61[_0x8139('0x6d')];});return db['FaxQueue'][_0x8139('0x55')]({'where':{'id':_0x2c8ce0[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](function(_0x1f5f78){return db['sequelize'][_0x8139('0x6e')](function(_0x5bbf9e){return _0x1f5f78[_0x8139('0x69')](_0x34f66a,{'transaction':_0x5bbf9e})[_0x8139('0x2c')](function(){return BPromise[_0x8139('0x6f')](_0x35c045,function(_0x583e74){return db[_0x8139('0x70')][_0x8139('0x71')]({'where':{'UserId':_0x583e74['id'],'FaxQueueId':_0x2c8ce0[_0x8139('0x59')]['id']},'transaction':_0x5bbf9e});});})[_0x8139('0x2c')](function(){_0x35c045['forEach'](function(_0x88a264){socket[_0x8139('0x72')](_0x8139('0x73'),{'UserId':_0x88a264['id'],'FaxQueueId':_0x1f5f78['id']});});});});});}})[_0x8139('0x2c')](respondWithStatusCode(_0x573b7e,null))['catch'](handleError(_0x573b7e,null));};exports[_0x8139('0x74')]=function(_0x372fe6,_0x57b35c,_0xcfa97c){return db[_0x8139('0x68')]['findAll']({'where':{'id':_0x372fe6[_0x8139('0x3a')][_0x8139('0x75')]},'attributes':['id'],'include':[{'model':db[_0x8139('0x5f')],'as':_0x8139('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x57b35c,null))[_0x8139('0x2c')](function(_0x3807a9){var _0x195d02=_[_0x8139('0x35')](_0x3807a9,'id');var _0x1f8d39=[];var _0x579b69=[];var _0x2445b0=squel[_0x8139('0x76')]();_0x2445b0[_0x8139('0x77')]('tq.TeamId')['from'](_0x8139('0x78'),'tq')[_0x8139('0x79')](_0x8139('0x7a'),'ut',_0x8139('0x7b'))[_0x8139('0x44')](_0x8139('0x7c'),_0x372fe6[_0x8139('0x59')]['id']);for(var _0x5c0217=0x0;_0x5c0217<_0x3807a9[_0x8139('0x40')];_0x5c0217+=0x1){let _0x53897b=_0x3807a9[_0x5c0217];for(var _0x2fb06a=0x0;_0x2fb06a<_0x53897b[_0x8139('0x6d')][_0x8139('0x40')];_0x2fb06a+=0x1){let _0x3d1439=_0x53897b[_0x8139('0x6d')][_0x2fb06a];var _0x190ad7=_0x2445b0[_0x8139('0x7d')]();_0x190ad7[_0x8139('0x44')](_0x8139('0x7e'),_0x3d1439['id']);_0x579b69[_0x8139('0x7f')](db[_0x8139('0x80')][_0x8139('0x3a')](_0x190ad7[_0x8139('0x81')](),{'type':db[_0x8139('0x80')][_0x8139('0x82')][_0x8139('0x83')]})[_0x8139('0x2c')](function(_0xad817c){if(_0xad817c[_0x8139('0x40')]===0x1){return _0x3d1439['id'];}else{var _0x44386e=_[_0x8139('0x84')](_[_0x8139('0x35')](_0xad817c,_0x8139('0x85')),function(_0xe71e45){return _[_0x8139('0x86')](_0x195d02,_0xe71e45);});if(_0x44386e){return _0x3d1439['id'];}}}));}}return BPromise[_0x8139('0x87')](_0x579b69)['then'](function(_0x46f0d7){_0x1f8d39=_(_0x1f8d39)[_0x8139('0x88')](_0x46f0d7)[_0x8139('0x89')]()[_0x8139('0x8a')]();return db[_0x8139('0x36')]['find']({'where':{'id':_0x372fe6['params']['id']}})[_0x8139('0x2c')](function(_0x4de3d4){return db[_0x8139('0x80')][_0x8139('0x6e')](function(_0x53eb9e){return _0x4de3d4[_0x8139('0x74')](_0x372fe6[_0x8139('0x3a')][_0x8139('0x75')],{'transaction':_0x53eb9e})[_0x8139('0x2c')](function(){if(!_[_0x8139('0x8b')](_0x1f8d39)){return _0x4de3d4[_0x8139('0x8c')](_0x1f8d39,{'transaction':_0x53eb9e});}})[_0x8139('0x2c')](function(){_0x1f8d39['forEach'](function(_0x2d90f0){socket[_0x8139('0x72')](_0x8139('0x8d'),{'UserId':_0x2d90f0,'FaxQueueId':_0x4de3d4['id']});});});});});});})['then'](respondWithStatusCode(_0x57b35c,null))[_0x8139('0x50')](handleError(_0x57b35c,null));};exports['addAgents']=function(_0x171637,_0x379857,_0x3b7336){return db[_0x8139('0x36')][_0x8139('0x55')]({'where':{'id':_0x171637[_0x8139('0x59')]['id']}})['then'](handleEntityNotFound(_0x379857,null))['then'](function(_0x575d00){if(_0x575d00){return _0x575d00['addAgents'](_0x171637[_0x8139('0x51')]['ids'],_[_0x8139('0x8e')](_0x171637[_0x8139('0x51')],['ids','id'])||{})['spread'](function(_0x4f7435){for(var _0x303dc1=0x0;_0x303dc1<_0x171637[_0x8139('0x51')][_0x8139('0x75')]['length'];_0x303dc1+=0x1){socket[_0x8139('0x72')](_0x8139('0x73'),{'UserId':Number(_0x171637[_0x8139('0x51')][_0x8139('0x75')][_0x303dc1]),'FaxQueueId':Number(_0x171637[_0x8139('0x59')]['id'])});}return _0x4f7435;});}})[_0x8139('0x2c')](respondWithResult(_0x379857,null))[_0x8139('0x50')](handleError(_0x379857,null));};exports[_0x8139('0x8c')]=function(_0x55b263,_0x465dbb,_0x302715){return db[_0x8139('0x36')][_0x8139('0x55')]({'where':{'id':_0x55b263[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x465dbb,null))[_0x8139('0x2c')](function(_0xa43a0a){if(_0xa43a0a){return _0xa43a0a[_0x8139('0x8c')](_0x55b263[_0x8139('0x3a')]['ids'])[_0x8139('0x2c')](function(){if(_['isArray'](_0x55b263[_0x8139('0x3a')][_0x8139('0x75')])){for(var _0x3c4888=0x0;_0x3c4888<_0x55b263[_0x8139('0x3a')][_0x8139('0x75')][_0x8139('0x40')];_0x3c4888+=0x1){socket['emit'](_0x8139('0x8d'),{'UserId':Number(_0x55b263[_0x8139('0x3a')]['ids'][_0x3c4888]),'FaxQueueId':Number(_0x55b263[_0x8139('0x59')]['id'])});}}else{socket[_0x8139('0x72')](_0x8139('0x8d'),{'UserId':Number(_0x55b263[_0x8139('0x3a')]['ids']),'FaxQueueId':Number(_0x55b263['params']['id'])});}});}})['then'](respondWithStatusCode(_0x465dbb,null))[_0x8139('0x50')](handleError(_0x465dbb,null));};exports[_0x8139('0x8f')]=function(_0x1d1997,_0x45be41,_0x5a6c86){var _0x263581={};var _0x591f1e={};var _0x4e953c;var _0x4a413d;return db[_0x8139('0x36')][_0x8139('0x5c')]({'where':{'id':_0x1d1997[_0x8139('0x59')]['id']}})[_0x8139('0x2c')](handleEntityNotFound(_0x45be41,null))[_0x8139('0x2c')](function(_0x411376){if(_0x411376){_0x4e953c=_0x411376;_0x591f1e['model']=_[_0x8139('0x3b')](db['User'][_0x8139('0x37')]);_0x591f1e[_0x8139('0x3a')]=_['keys'](_0x1d1997[_0x8139('0x3a')]);_0x591f1e[_0x8139('0x3c')]=_[_0x8139('0x4f')](_0x591f1e[_0x8139('0x3d')],_0x591f1e[_0x8139('0x3a')]);_0x263581[_0x8139('0x3e')]=_[_0x8139('0x4f')](_0x591f1e['model'],qs['fields'](_0x1d1997[_0x8139('0x3a')][_0x8139('0x3f')]));_0x263581['attributes']=_0x263581[_0x8139('0x3e')][_0x8139('0x40')]?_0x263581[_0x8139('0x3e')]:_0x591f1e[_0x8139('0x3d')];_0x263581[_0x8139('0x5d')]=qs[_0x8139('0x43')](_0x1d1997[_0x8139('0x3a')][_0x8139('0x43')]);_0x263581[_0x8139('0x44')]=qs[_0x8139('0x3c')](_[_0x8139('0x45')](_0x1d1997[_0x8139('0x3a')],_0x591f1e[_0x8139('0x3c')]));if(_0x1d1997[_0x8139('0x3a')]['filter']){_0x263581[_0x8139('0x44')]=_[_0x8139('0x47')](_0x263581[_0x8139('0x44')],{'$or':_['map'](_0x263581[_0x8139('0x3e')],function(_0x2f27cf){var _0x251fcf={};_0x251fcf[_0x2f27cf]={'$like':'%'+_0x1d1997[_0x8139('0x3a')][_0x8139('0x46')]+'%'};return _0x251fcf;})});}_0x263581=_[_0x8139('0x47')]({},_0x263581,_0x1d1997['options']);return _0x4e953c['getAgents'](_0x263581);}})[_0x8139('0x2c')](function(_0x58378a){if(_0x58378a){_0x4a413d=_0x58378a[_0x8139('0x40')];if(!_0x1d1997[_0x8139('0x3a')][_0x8139('0x41')]('nolimit')){_0x263581[_0x8139('0x25')]=qs[_0x8139('0x25')](_0x1d1997[_0x8139('0x3a')][_0x8139('0x25')]);_0x263581[_0x8139('0x24')]=qs[_0x8139('0x24')](_0x1d1997[_0x8139('0x3a')][_0x8139('0x24')]);}return _0x4e953c[_0x8139('0x8f')](_0x263581);}})[_0x8139('0x2c')](function(_0x19501e){if(_0x19501e){return _0x19501e?{'count':_0x4a413d,'rows':_0x19501e}:null;}})[_0x8139('0x2c')](respondWithResult(_0x45be41,null))[_0x8139('0x50')](handleError(_0x45be41,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ef2c72f..3e8d543 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 _0x7c08=['remove','emit','hasOwnProperty','exports','FaxQueue','update'];(function(_0x30bd3b,_0x4c2538){var _0x17aacd=function(_0x3d4716){while(--_0x3d4716){_0x30bd3b['push'](_0x30bd3b['shift']());}};_0x17aacd(++_0x4c2538);}(_0x7c08,0x94));var _0x87c0=function(_0xc901d,_0x110fe6){_0xc901d=_0xc901d-0x0;var _0x164dad=_0x7c08[_0xc901d];return _0x164dad;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x87c0('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x87c0('0x1'),'afterDestroy':_0x87c0('0x2')};function emitEvent(_0x4b94bb){return function(_0x2f24e6,_0xd71189,_0x396ef7){FaxQueueEvents[_0x87c0('0x3')](_0x4b94bb+':'+_0x2f24e6['id'],_0x2f24e6);FaxQueueEvents[_0x87c0('0x3')](_0x4b94bb,_0x2f24e6);_0x396ef7(null);};}for(var e in events){if(events[_0x87c0('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x87c0('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0x6a64=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x1ee5be,_0x5f46e3){var _0x177140=function(_0x162779){while(--_0x162779){_0x1ee5be['push'](_0x1ee5be['shift']());}};_0x177140(++_0x5f46e3);}(_0x6a64,0x1ca));var _0x46a6=function(_0x4b9404,_0xd41274){_0x4b9404=_0x4b9404-0x0;var _0x42d444=_0x6a64[_0x4b9404];return _0x42d444;};'use strict';var EventEmitter=require(_0x46a6('0x0'));var FaxQueue=require(_0x46a6('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x46a6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x46a6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e02be){return function(_0x263735,_0x567ab2,_0x159a55){FaxQueueEvents[_0x46a6('0x4')](_0x1e02be+':'+_0x263735['id'],_0x263735);FaxQueueEvents[_0x46a6('0x4')](_0x1e02be,_0x263735);_0x159a55(null);};}for(var e in events){if(events[_0x46a6('0x5')](e)){var event=events[e];FaxQueue[_0x46a6('0x6')](e,emitEvent(event));}}module[_0x46a6('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0ea9d7e..d267c8a 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 _0x810a=['exports','define','FaxQueue','fax_queues','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e8e7b,_0x290559){var _0x5b54ec=function(_0x507c35){while(--_0x507c35){_0x1e8e7b['push'](_0x1e8e7b['shift']());}};_0x5b54ec(++_0x290559);}(_0x810a,0xbf));var _0xa810=function(_0x56bd89,_0x1544da){_0x56bd89=_0x56bd89-0x0;var _0x4ee244=_0x810a[_0x56bd89];return _0x4ee244;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa810('0x0'))(_0xa810('0x1'));var moment=require('moment');var BPromise=require(_0xa810('0x2'));var rp=require(_0xa810('0x3'));var fs=require('fs');var path=require(_0xa810('0x4'));var rimraf=require(_0xa810('0x5'));var config=require(_0xa810('0x6'));var attributes=require('./faxQueue.attributes');module[_0xa810('0x7')]=function(_0x4ffab3,_0x3862d1){return _0x4ffab3[_0xa810('0x8')](_0xa810('0x9'),attributes,{'tableName':_0xa810('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7ad=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','fax_queues','util','../../config/logger','bluebird'];(function(_0x515278,_0xd33e7b){var _0x5692fd=function(_0x26cc49){while(--_0x26cc49){_0x515278['push'](_0x515278['shift']());}};_0x5692fd(++_0xd33e7b);}(_0xc7ad,0xde));var _0xdc7a=function(_0x15d90b,_0x5e7b73){_0x15d90b=_0x15d90b-0x0;var _0x36b795=_0xc7ad[_0x15d90b];return _0x36b795;};'use strict';var _=require('lodash');var util=require(_0xdc7a('0x0'));var logger=require(_0xdc7a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdc7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc7a('0x3'));var rimraf=require(_0xdc7a('0x4'));var config=require(_0xdc7a('0x5'));var attributes=require(_0xdc7a('0x6'));module[_0xdc7a('0x7')]=function(_0x396733,_0x2a8365){return _0x396733['define']('FaxQueue',attributes,{'tableName':_0xdc7a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index e84914b..11ad6c2 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 _0x9ce7=['limit','include','map','model','attributes','find','where','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw'];(function(_0x21b767,_0x477421){var _0x327592=function(_0x4a1887){while(--_0x4a1887){_0x21b767['push'](_0x21b767['shift']());}};_0x327592(++_0x477421);}(_0x9ce7,0x10a));var _0x79ce=function(_0x174aac,_0x31f40f){_0x174aac=_0x174aac-0x0;var _0xeb695c=_0x9ce7[_0x174aac];return _0xeb695c;};'use strict';var _=require(_0x79ce('0x0'));var util=require(_0x79ce('0x1'));var moment=require(_0x79ce('0x2'));var BPromise=require(_0x79ce('0x3'));var rs=require(_0x79ce('0x4'));var fs=require('fs');var Redis=require(_0x79ce('0x5'));var db=require(_0x79ce('0x6'))['db'];var utils=require(_0x79ce('0x7'));var logger=require(_0x79ce('0x8'))(_0x79ce('0x9'));var config=require(_0x79ce('0xa'));var jayson=require(_0x79ce('0xb'));var client=jayson[_0x79ce('0xc')][_0x79ce('0xd')]({'port':0x232a});config[_0x79ce('0xe')]=_['defaults'](config[_0x79ce('0xe')],{'host':_0x79ce('0xf'),'port':0x18eb});var socket=require(_0x79ce('0x10'))(new Redis(config['redis']));require(_0x79ce('0x11'))[_0x79ce('0x12')](socket);function respondWithRpcPromise(_0x2aa40f,_0x37b20e,_0x14d51b){return new BPromise(function(_0x12786c,_0x1120ef){return client[_0x79ce('0x13')](_0x2aa40f,_0x14d51b)[_0x79ce('0x14')](function(_0x15b7d3){logger[_0x79ce('0x15')](_0x79ce('0x16'),_0x37b20e,_0x79ce('0x17'));logger[_0x79ce('0x18')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x37b20e,_0x79ce('0x17'),JSON[_0x79ce('0x19')](_0x15b7d3));if(_0x15b7d3['error']){if(_0x15b7d3[_0x79ce('0x1a')][_0x79ce('0x1b')]===0x1f4){logger['error'](_0x79ce('0x16'),_0x37b20e,_0x15b7d3[_0x79ce('0x1a')]['message']);return _0x1120ef(_0x15b7d3[_0x79ce('0x1a')][_0x79ce('0x1c')]);}logger[_0x79ce('0x1a')](_0x79ce('0x16'),_0x37b20e,_0x15b7d3[_0x79ce('0x1a')]['message']);return _0x12786c(_0x15b7d3[_0x79ce('0x1a')][_0x79ce('0x1c')]);}else{logger[_0x79ce('0x15')](_0x79ce('0x16'),_0x37b20e,_0x79ce('0x17'));_0x12786c(_0x15b7d3['result'][_0x79ce('0x1c')]);}})[_0x79ce('0x1d')](function(_0x5472f6){logger[_0x79ce('0x1a')](_0x79ce('0x16'),_0x37b20e,_0x5472f6);_0x1120ef(_0x5472f6);});});}exports[_0x79ce('0x1e')]=function(_0x45751d){var _0x369ae6=this;return new Promise(function(_0x566ae7,_0x3dc772){return db[_0x79ce('0x1f')][_0x79ce('0x20')]({'raw':_0x45751d[_0x79ce('0x21')]?_0x45751d[_0x79ce('0x21')][_0x79ce('0x22')]===undefined?!![]:![]:!![],'where':_0x45751d[_0x79ce('0x21')]?_0x45751d[_0x79ce('0x21')]['where']||null:null,'attributes':_0x45751d[_0x79ce('0x21')]?_0x45751d['options']['attributes']||null:null,'limit':_0x45751d['options']?_0x45751d[_0x79ce('0x21')][_0x79ce('0x23')]||null:null,'include':_0x45751d['options']?_0x45751d[_0x79ce('0x21')][_0x79ce('0x24')]?_[_0x79ce('0x25')](_0x45751d[_0x79ce('0x21')]['include'],function(_0x1f7597){return{'model':db[_0x1f7597[_0x79ce('0x26')]],'as':_0x1f7597['as'],'attributes':_0x1f7597[_0x79ce('0x27')],'include':_0x1f7597[_0x79ce('0x24')]?_[_0x79ce('0x25')](_0x1f7597[_0x79ce('0x24')],function(_0x3a13ba){return{'model':db[_0x3a13ba[_0x79ce('0x26')]],'as':_0x3a13ba['as'],'attributes':_0x3a13ba[_0x79ce('0x27')],'include':_0x3a13ba[_0x79ce('0x24')]?_[_0x79ce('0x25')](_0x3a13ba['include'],function(_0x53ddc4){return{'model':db[_0x53ddc4[_0x79ce('0x26')]],'as':_0x53ddc4['as'],'attributes':_0x53ddc4[_0x79ce('0x27')]};}):[]};}):[]};}):[]:[]})[_0x79ce('0x14')](function(_0x40ca9f){logger[_0x79ce('0x15')]('GetFaxQueue',_0x45751d);logger[_0x79ce('0x18')](_0x79ce('0x1e'),_0x45751d,JSON[_0x79ce('0x19')](_0x40ca9f));_0x566ae7(_0x40ca9f);})[_0x79ce('0x1d')](function(_0x4738bc){logger[_0x79ce('0x1a')](_0x79ce('0x1e'),_0x4738bc[_0x79ce('0x1c')],_0x45751d);_0x3dc772(_0x369ae6[_0x79ce('0x1a')](0x1f4,_0x4738bc[_0x79ce('0x1c')]));});});};exports['ShowFaxQueue']=function(_0x21d570){var _0x3f55bf=this;return new Promise(function(_0x1c6918,_0x2962d8){return db[_0x79ce('0x1f')][_0x79ce('0x28')]({'raw':_0x21d570['options']?_0x21d570[_0x79ce('0x21')][_0x79ce('0x22')]===undefined?!![]:![]:!![],'where':_0x21d570['options']?_0x21d570['options'][_0x79ce('0x29')]||null:null,'attributes':_0x21d570[_0x79ce('0x21')]?_0x21d570[_0x79ce('0x21')][_0x79ce('0x27')]||null:null,'include':_0x21d570[_0x79ce('0x21')]?_0x21d570[_0x79ce('0x21')][_0x79ce('0x24')]?_[_0x79ce('0x25')](_0x21d570[_0x79ce('0x21')][_0x79ce('0x24')],function(_0x30222c){return{'model':db[_0x30222c[_0x79ce('0x26')]],'as':_0x30222c['as'],'attributes':_0x30222c[_0x79ce('0x27')],'include':_0x30222c[_0x79ce('0x24')]?_['map'](_0x30222c[_0x79ce('0x24')],function(_0x1fac24){return{'model':db[_0x1fac24[_0x79ce('0x26')]],'as':_0x1fac24['as'],'attributes':_0x1fac24[_0x79ce('0x27')],'include':_0x1fac24['include']?_[_0x79ce('0x25')](_0x1fac24[_0x79ce('0x24')],function(_0xcbd211){return{'model':db[_0xcbd211[_0x79ce('0x26')]],'as':_0xcbd211['as'],'attributes':_0xcbd211['attributes']};}):[]};}):[]};}):[]:[]})[_0x79ce('0x14')](function(_0x353e8b){logger[_0x79ce('0x15')](_0x79ce('0x2a'),_0x21d570);logger[_0x79ce('0x18')]('ShowFaxQueue',_0x21d570,JSON[_0x79ce('0x19')](_0x353e8b));_0x1c6918(_0x353e8b);})[_0x79ce('0x1d')](function(_0x201418){logger['error'](_0x79ce('0x2a'),_0x201418[_0x79ce('0x1c')],_0x21d570);_0x2962d8(_0x3f55bf['error'](0x1f4,_0x201418[_0x79ce('0x1c')]));});});}; \ No newline at end of file +var _0xba83=['model','map','debug','ShowFaxQueue','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x2c4f25,_0x57d0b7){var _0x5da873=function(_0x11e05f){while(--_0x11e05f){_0x2c4f25['push'](_0x2c4f25['shift']());}};_0x5da873(++_0x57d0b7);}(_0xba83,0x7d));var _0x3ba8=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0xba83[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0x3ba8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ba8('0x1'));var fs=require('fs');var Redis=require(_0x3ba8('0x2'));var db=require(_0x3ba8('0x3'))['db'];var utils=require(_0x3ba8('0x4'));var logger=require(_0x3ba8('0x5'))(_0x3ba8('0x6'));var config=require(_0x3ba8('0x7'));var jayson=require(_0x3ba8('0x8'));var client=jayson[_0x3ba8('0x9')]['http']({'port':0x232a});config[_0x3ba8('0xa')]=_['defaults'](config['redis'],{'host':_0x3ba8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ba8('0xa')]));require(_0x3ba8('0xc'))[_0x3ba8('0xd')](socket);function respondWithRpcPromise(_0x48e195,_0xb919c2,_0x51d20c){return new BPromise(function(_0xd5ad5d,_0x1c2da5){return client[_0x3ba8('0xe')](_0x48e195,_0x51d20c)[_0x3ba8('0xf')](function(_0x20482a){logger[_0x3ba8('0x10')](_0x3ba8('0x11'),_0xb919c2,_0x3ba8('0x12'));logger['debug'](_0x3ba8('0x13'),_0xb919c2,'request\x20sent',JSON[_0x3ba8('0x14')](_0x20482a));if(_0x20482a[_0x3ba8('0x15')]){if(_0x20482a[_0x3ba8('0x15')][_0x3ba8('0x16')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0xb919c2,_0x20482a[_0x3ba8('0x15')]['message']);return _0x1c2da5(_0x20482a['error'][_0x3ba8('0x17')]);}logger[_0x3ba8('0x15')](_0x3ba8('0x11'),_0xb919c2,_0x20482a[_0x3ba8('0x15')][_0x3ba8('0x17')]);return _0xd5ad5d(_0x20482a[_0x3ba8('0x15')]['message']);}else{logger[_0x3ba8('0x10')]('FaxQueue,\x20%s,\x20%s',_0xb919c2,_0x3ba8('0x12'));_0xd5ad5d(_0x20482a[_0x3ba8('0x18')][_0x3ba8('0x17')]);}})[_0x3ba8('0x19')](function(_0x3fd0b3){logger[_0x3ba8('0x15')]('FaxQueue,\x20%s,\x20%s',_0xb919c2,_0x3fd0b3);_0x1c2da5(_0x3fd0b3);});});}exports[_0x3ba8('0x1a')]=function(_0x123db5){var _0x23315d=this;return new Promise(function(_0x4c8c68,_0x6fd481){return db[_0x3ba8('0x1b')][_0x3ba8('0x1c')]({'raw':_0x123db5[_0x3ba8('0x1d')]?_0x123db5[_0x3ba8('0x1d')][_0x3ba8('0x1e')]===undefined?!![]:![]:!![],'where':_0x123db5['options']?_0x123db5[_0x3ba8('0x1d')][_0x3ba8('0x1f')]||null:null,'attributes':_0x123db5[_0x3ba8('0x1d')]?_0x123db5[_0x3ba8('0x1d')][_0x3ba8('0x20')]||null:null,'limit':_0x123db5[_0x3ba8('0x1d')]?_0x123db5['options'][_0x3ba8('0x21')]||null:null,'include':_0x123db5[_0x3ba8('0x1d')]?_0x123db5[_0x3ba8('0x1d')][_0x3ba8('0x22')]?_['map'](_0x123db5[_0x3ba8('0x1d')][_0x3ba8('0x22')],function(_0x14b63b){return{'model':db[_0x14b63b[_0x3ba8('0x23')]],'as':_0x14b63b['as'],'attributes':_0x14b63b[_0x3ba8('0x20')],'include':_0x14b63b[_0x3ba8('0x22')]?_[_0x3ba8('0x24')](_0x14b63b[_0x3ba8('0x22')],function(_0x336d4f){return{'model':db[_0x336d4f['model']],'as':_0x336d4f['as'],'attributes':_0x336d4f['attributes'],'include':_0x336d4f[_0x3ba8('0x22')]?_[_0x3ba8('0x24')](_0x336d4f[_0x3ba8('0x22')],function(_0x2df59c){return{'model':db[_0x2df59c[_0x3ba8('0x23')]],'as':_0x2df59c['as'],'attributes':_0x2df59c[_0x3ba8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ba8('0xf')](function(_0x80deab){logger[_0x3ba8('0x10')](_0x3ba8('0x1a'),_0x123db5);logger[_0x3ba8('0x25')](_0x3ba8('0x1a'),_0x123db5,JSON[_0x3ba8('0x14')](_0x80deab));_0x4c8c68(_0x80deab);})[_0x3ba8('0x19')](function(_0x5d9c1c){logger[_0x3ba8('0x15')]('GetFaxQueue',_0x5d9c1c['message'],_0x123db5);_0x6fd481(_0x23315d[_0x3ba8('0x15')](0x1f4,_0x5d9c1c[_0x3ba8('0x17')]));});});};exports[_0x3ba8('0x26')]=function(_0x53df7a){var _0x554dd4=this;return new Promise(function(_0x5109b9,_0x35c68e){return db[_0x3ba8('0x1b')][_0x3ba8('0x27')]({'raw':_0x53df7a[_0x3ba8('0x1d')]?_0x53df7a[_0x3ba8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x53df7a['options']?_0x53df7a[_0x3ba8('0x1d')][_0x3ba8('0x1f')]||null:null,'attributes':_0x53df7a[_0x3ba8('0x1d')]?_0x53df7a['options'][_0x3ba8('0x20')]||null:null,'include':_0x53df7a[_0x3ba8('0x1d')]?_0x53df7a['options'][_0x3ba8('0x22')]?_[_0x3ba8('0x24')](_0x53df7a[_0x3ba8('0x1d')]['include'],function(_0xb709e8){return{'model':db[_0xb709e8['model']],'as':_0xb709e8['as'],'attributes':_0xb709e8[_0x3ba8('0x20')],'include':_0xb709e8[_0x3ba8('0x22')]?_[_0x3ba8('0x24')](_0xb709e8[_0x3ba8('0x22')],function(_0x18757d){return{'model':db[_0x18757d['model']],'as':_0x18757d['as'],'attributes':_0x18757d['attributes'],'include':_0x18757d[_0x3ba8('0x22')]?_[_0x3ba8('0x24')](_0x18757d['include'],function(_0x5aaa84){return{'model':db[_0x5aaa84[_0x3ba8('0x23')]],'as':_0x5aaa84['as'],'attributes':_0x5aaa84[_0x3ba8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16ab2b){logger[_0x3ba8('0x10')](_0x3ba8('0x26'),_0x53df7a);logger[_0x3ba8('0x25')](_0x3ba8('0x26'),_0x53df7a,JSON[_0x3ba8('0x14')](_0x16ab2b));_0x5109b9(_0x16ab2b);})['catch'](function(_0x3b8390){logger['error']('ShowFaxQueue',_0x3b8390[_0x3ba8('0x17')],_0x53df7a);_0x35c68e(_0x554dd4[_0x3ba8('0x15')](0x1f4,_0x3b8390['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 591613f..9035b24 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 _0xec39=['length','faxQueue:','./faxQueue.events','save','remove','update','removeListener'];(function(_0x5942d9,_0x569c84){var _0x4aa2b0=function(_0x27c941){while(--_0x27c941){_0x5942d9['push'](_0x5942d9['shift']());}};_0x4aa2b0(++_0x569c84);}(_0xec39,0x19f));var _0x9ec3=function(_0x4da9ac,_0x5b5550){_0x4da9ac=_0x4da9ac-0x0;var _0x18fe37=_0xec39[_0x4da9ac];return _0x18fe37;};'use strict';var FaxQueueEvents=require(_0x9ec3('0x0'));var events=[_0x9ec3('0x1'),_0x9ec3('0x2'),_0x9ec3('0x3')];function createListener(_0x1fc7a7,_0xb3d117){return function(_0x3d481c){_0xb3d117['emit'](_0x1fc7a7,_0x3d481c);};}function removeListener(_0x1f43fb,_0x1c944d){return function(){FaxQueueEvents[_0x9ec3('0x4')](_0x1f43fb,_0x1c944d);};}exports['register']=function(_0x49ddff){for(var _0x55adba=0x0,_0x3742c5=events[_0x9ec3('0x5')];_0x55adba<_0x3742c5;_0x55adba++){var _0x29a6a2=events[_0x55adba];var _0x595e3a=createListener(_0x9ec3('0x6')+_0x29a6a2,_0x49ddff);FaxQueueEvents['on'](_0x29a6a2,_0x595e3a);}}; \ No newline at end of file +var _0x2fbc=['update','removeListener','./faxQueue.events','save','remove'];(function(_0x4780d9,_0x1369c9){var _0x14cbac=function(_0x3d8255){while(--_0x3d8255){_0x4780d9['push'](_0x4780d9['shift']());}};_0x14cbac(++_0x1369c9);}(_0x2fbc,0x106));var _0xc2fb=function(_0x391bf0,_0x5080c4){_0x391bf0=_0x391bf0-0x0;var _0x92671e=_0x2fbc[_0x391bf0];return _0x92671e;};'use strict';var FaxQueueEvents=require(_0xc2fb('0x0'));var events=[_0xc2fb('0x1'),_0xc2fb('0x2'),_0xc2fb('0x3')];function createListener(_0x8ccfac,_0x118b84){return function(_0x200345){_0x118b84['emit'](_0x8ccfac,_0x200345);};}function removeListener(_0x5be756,_0x2cf307){return function(){FaxQueueEvents[_0xc2fb('0x4')](_0x5be756,_0x2cf307);};}exports['register']=function(_0x42131d){for(var _0xe92640=0x0,_0x5162a4=events['length'];_0xe92640<_0x5162a4;_0xe92640++){var _0x3e79e9=events[_0xe92640];var _0x35cc7c=createListener('faxQueue:'+_0x3e79e9,_0x42131d);FaxQueueEvents['on'](_0x3e79e9,_0x35cc7c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e3ca9a8..84e6c79 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 _0x7096=['addAgents','/:id','update','delete','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams'];(function(_0x493eae,_0x4cc2d4){var _0x1dc975=function(_0x83c465){while(--_0x83c465){_0x493eae['push'](_0x493eae['shift']());}};_0x1dc975(++_0x4cc2d4);}(_0x7096,0x10c));var _0x6709=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7096[_0x2bf141];return _0x48277b;};'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',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/teams',auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router[_0x6709('0x8')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller[_0x6709('0x12')]);router[_0x6709('0x13')]('/',auth[_0x6709('0x9')](),controller['create']);router[_0x6709('0x13')](_0x6709('0x14'),auth[_0x6709('0x9')](),controller[_0x6709('0x15')]);router['post'](_0x6709('0x11'),auth['isAuthenticated'](),controller[_0x6709('0x16')]);router['put'](_0x6709('0x17'),auth[_0x6709('0x9')](),controller[_0x6709('0x18')]);router[_0x6709('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x6709('0x19')](_0x6709('0x14'),auth['isAuthenticated'](),controller[_0x6709('0x1a')]);router[_0x6709('0x19')](_0x6709('0x11'),auth['isAuthenticated'](),controller[_0x6709('0x1b')]);module[_0x6709('0x1c')]=router; \ No newline at end of file +var _0xadb5=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x24845c,_0x3cffe3){var _0x2509e4=function(_0x573d2d){while(--_0x573d2d){_0x24845c['push'](_0x24845c['shift']());}};_0x2509e4(++_0x3cffe3);}(_0xadb5,0xad));var _0x5adb=function(_0x5281de,_0x2e2dad){_0x5281de=_0x5281de-0x0;var _0x43df4a=_0xadb5[_0x5281de];return _0x43df4a;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./faxQueue.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getMembers']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')]('/:id/users',auth[_0x5adb('0x8')](),controller['addAgents']);router[_0x5adb('0x16')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x18')]('/:id/teams',auth[_0x5adb('0x8')](),controller['removeTeams']);router[_0x5adb('0x18')]('/:id/users',auth[_0x5adb('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index e6201b6..03097b9 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 _0x3182=['moment','sequelize','DATE'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x3182,0x1b6));var _0x2318=function(_0x57d8bf,_0x11f4fd){_0x57d8bf=_0x57d8bf-0x0;var _0x398839=_0x3182[_0x57d8bf];return _0x398839;};'use strict';var moment=require(_0x2318('0x0'));var Sequelize=require(_0x2318('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2318('0x2')]},'leaveAt':{'type':Sequelize[_0x2318('0x2')]},'acceptAt':{'type':Sequelize[_0x2318('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6408=['sequelize','exports','STRING','DATE','moment'];(function(_0x409582,_0x1f0415){var _0xc9369d=function(_0x18dddf){while(--_0x18dddf){_0x409582['push'](_0x409582['shift']());}};_0xc9369d(++_0x1f0415);}(_0x6408,0x194));var _0x8640=function(_0x456f21,_0x58ce45){_0x456f21=_0x456f21-0x0;var _0x17a99d=_0x6408[_0x456f21];return _0x17a99d;};'use strict';var moment=require(_0x8640('0x0'));var Sequelize=require(_0x8640('0x1'));module[_0x8640('0x2')]={'uniqueid':{'type':Sequelize[_0x8640('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8640('0x3')]},'joinAt':{'type':Sequelize[_0x8640('0x4')]},'leaveAt':{'type':Sequelize[_0x8640('0x4')]},'acceptAt':{'type':Sequelize[_0x8640('0x4')]},'exitAt':{'type':Sequelize[_0x8640('0x4')]},'reason':{'type':Sequelize[_0x8640('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2238668..a8b0983 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 _0x0911=['index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','FaxQueueReport','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0911,0x1a9));var _0x1091=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x0911[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0x1091('0x0'));var rimraf=require(_0x1091('0x1'));var zipdir=require(_0x1091('0x2'));var jsonpatch=require(_0x1091('0x3'));var rp=require(_0x1091('0x4'));var moment=require('moment');var BPromise=require(_0x1091('0x5'));var Mustache=require('mustache');var util=require(_0x1091('0x6'));var path=require(_0x1091('0x7'));var sox=require(_0x1091('0x8'));var csv=require(_0x1091('0x9'));var ejs=require(_0x1091('0xa'));var fs=require('fs');var fs_extra=require(_0x1091('0xb'));var _=require(_0x1091('0xc'));var squel=require(_0x1091('0xd'));var crypto=require(_0x1091('0xe'));var jsforce=require(_0x1091('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1091('0x9'));var querystring=require(_0x1091('0x10'));var Papa=require(_0x1091('0x11'));var Redis=require(_0x1091('0x12'));var authService=require(_0x1091('0x13'));var qs=require(_0x1091('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1091('0x15'));var logger=require(_0x1091('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1091('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1091('0x18'))['db'];function respondWithStatusCode(_0x5176bd,_0x3e9a52){_0x3e9a52=_0x3e9a52||0xcc;return function(_0x37a27c){if(_0x37a27c){return _0x5176bd[_0x1091('0x19')](_0x3e9a52);}return _0x5176bd[_0x1091('0x1a')](_0x3e9a52)['end']();};}function respondWithResult(_0x36aff0,_0x11c894){_0x11c894=_0x11c894||0xc8;return function(_0x5d34e7){if(_0x5d34e7){return _0x36aff0['status'](_0x11c894)['json'](_0x5d34e7);}};}function respondWithFilteredResult(_0x5c3b99,_0x4483c4){return function(_0x9c92e5){if(_0x9c92e5){var _0x3607e5=typeof _0x4483c4['offset']===_0x1091('0x1b')&&typeof _0x4483c4[_0x1091('0x1c')]===_0x1091('0x1b');var _0x27cae2=_0x9c92e5[_0x1091('0x1d')];var _0x5c01c3=_0x3607e5?0x0:_0x4483c4[_0x1091('0x1e')];var _0x46e3d5=_0x3607e5?_0x9c92e5[_0x1091('0x1d')]:_0x4483c4[_0x1091('0x1e')]+_0x4483c4[_0x1091('0x1c')];var _0x5bfc62;if(_0x46e3d5>=_0x27cae2){_0x46e3d5=_0x27cae2;_0x5bfc62=0xc8;}else{_0x5bfc62=0xce;}_0x5c3b99[_0x1091('0x1a')](_0x5bfc62);return _0x5c3b99[_0x1091('0x1f')]('Content-Range',_0x5c01c3+'-'+_0x46e3d5+'/'+_0x27cae2)['json'](_0x9c92e5);}return null;};}function patchUpdates(_0x4bbf0b){return function(_0x250718){try{jsonpatch[_0x1091('0x20')](_0x250718,_0x4bbf0b,!![]);}catch(_0x17ecab){return BPromise[_0x1091('0x21')](_0x17ecab);}return _0x250718[_0x1091('0x22')]();};}function saveUpdates(_0x4682f9,_0x30792f){return function(_0xfb48c6){if(_0xfb48c6){return _0xfb48c6[_0x1091('0x23')](_0x4682f9)[_0x1091('0x24')](function(_0x39c4d1){return _0x39c4d1;});}return null;};}function removeEntity(_0x197355,_0x1925fc){return function(_0x142597){if(_0x142597){return _0x142597[_0x1091('0x25')]()[_0x1091('0x24')](function(){_0x197355['status'](0xcc)[_0x1091('0x26')]();});}};}function handleEntityNotFound(_0x3667a7,_0x266d34){return function(_0x5a4886){if(!_0x5a4886){_0x3667a7[_0x1091('0x19')](0x194);}return _0x5a4886;};}function handleError(_0x598216,_0x26c91b){_0x26c91b=_0x26c91b||0x1f4;return function(_0x306165){logger[_0x1091('0x27')](_0x306165[_0x1091('0x28')]);if(_0x306165['name']){delete _0x306165[_0x1091('0x29')];}_0x598216[_0x1091('0x1a')](_0x26c91b)[_0x1091('0x2a')](_0x306165);};}exports[_0x1091('0x2b')]=function(_0x17e118,_0x40a8b4){var _0x56dc27={},_0x2be598={},_0x2068b6={'count':0x0,'rows':[]};var _0x170684=_[_0x1091('0x2c')](db['FaxQueueReport']['rawAttributes'],function(_0x447f15){return{'name':_0x447f15[_0x1091('0x2d')],'type':_0x447f15[_0x1091('0x2e')][_0x1091('0x2f')]};});_0x2be598['model']=_['map'](_0x170684,_0x1091('0x29'));_0x2be598['query']=_['keys'](_0x17e118[_0x1091('0x30')]);_0x2be598[_0x1091('0x31')]=_[_0x1091('0x32')](_0x2be598[_0x1091('0x33')],_0x2be598[_0x1091('0x30')]);_0x56dc27[_0x1091('0x34')]=_['intersection'](_0x2be598[_0x1091('0x33')],qs[_0x1091('0x35')](_0x17e118[_0x1091('0x30')][_0x1091('0x35')]));_0x56dc27['attributes']=_0x56dc27[_0x1091('0x34')][_0x1091('0x36')]?_0x56dc27['attributes']:_0x2be598[_0x1091('0x33')];if(!_0x17e118[_0x1091('0x30')][_0x1091('0x37')]('nolimit')){_0x56dc27[_0x1091('0x1c')]=qs[_0x1091('0x1c')](_0x17e118['query'][_0x1091('0x1c')]);_0x56dc27[_0x1091('0x1e')]=qs[_0x1091('0x1e')](_0x17e118[_0x1091('0x30')]['offset']);}_0x56dc27[_0x1091('0x38')]=qs[_0x1091('0x39')](_0x17e118[_0x1091('0x30')]['sort']);_0x56dc27[_0x1091('0x3a')]=qs[_0x1091('0x31')](_[_0x1091('0x3b')](_0x17e118['query'],_0x2be598[_0x1091('0x31')]),_0x170684);if(_0x17e118[_0x1091('0x30')][_0x1091('0x3c')]){_0x56dc27[_0x1091('0x3a')]=_[_0x1091('0x3d')](_0x56dc27[_0x1091('0x3a')],{'$or':_['map'](_0x170684,function(_0x2d00c8){if(_0x2d00c8[_0x1091('0x2e')]!==_0x1091('0x3e')){var _0x5edbe2={};_0x5edbe2[_0x2d00c8[_0x1091('0x29')]]={'$like':'%'+_0x17e118[_0x1091('0x30')][_0x1091('0x3c')]+'%'};return _0x5edbe2;}})});}_0x56dc27=_[_0x1091('0x3d')]({},_0x56dc27,_0x17e118[_0x1091('0x3f')]);var _0x3cf136={'where':_0x56dc27[_0x1091('0x3a')]};return db['FaxQueueReport'][_0x1091('0x1d')](_0x3cf136)[_0x1091('0x24')](function(_0x882cb5){_0x2068b6['count']=_0x882cb5;if(_0x17e118[_0x1091('0x30')]['includeAll']){_0x56dc27[_0x1091('0x40')]=[{'all':!![]}];}return db[_0x1091('0x41')][_0x1091('0x42')](_0x56dc27);})[_0x1091('0x24')](function(_0x3eb4da){_0x2068b6[_0x1091('0x43')]=_0x3eb4da;return _0x2068b6;})[_0x1091('0x24')](respondWithFilteredResult(_0x40a8b4,_0x56dc27))['catch'](handleError(_0x40a8b4,null));};exports[_0x1091('0x44')]=function(_0x19a08c,_0x4b2048){var _0x8985f7={'raw':!![],'where':{'id':_0x19a08c[_0x1091('0x45')]['id']}},_0x1f29ea={};_0x1f29ea['model']=_[_0x1091('0x46')](db[_0x1091('0x41')][_0x1091('0x47')]);_0x1f29ea[_0x1091('0x30')]=_[_0x1091('0x46')](_0x19a08c['query']);_0x1f29ea['filters']=_['intersection'](_0x1f29ea['model'],_0x1f29ea[_0x1091('0x30')]);_0x8985f7[_0x1091('0x34')]=_[_0x1091('0x32')](_0x1f29ea[_0x1091('0x33')],qs[_0x1091('0x35')](_0x19a08c[_0x1091('0x30')][_0x1091('0x35')]));_0x8985f7[_0x1091('0x34')]=_0x8985f7['attributes']['length']?_0x8985f7[_0x1091('0x34')]:_0x1f29ea[_0x1091('0x33')];if(_0x19a08c[_0x1091('0x30')][_0x1091('0x48')]){_0x8985f7[_0x1091('0x40')]=[{'all':!![]}];}_0x8985f7=_['merge']({},_0x8985f7,_0x19a08c[_0x1091('0x3f')]);return db['FaxQueueReport'][_0x1091('0x49')](_0x8985f7)[_0x1091('0x24')](handleEntityNotFound(_0x4b2048,null))[_0x1091('0x24')](respondWithResult(_0x4b2048,null))[_0x1091('0x4a')](handleError(_0x4b2048,null));};exports[_0x1091('0x4b')]=function(_0x142760,_0x4fc761){return db[_0x1091('0x41')][_0x1091('0x4b')](_0x142760[_0x1091('0x4c')],{})[_0x1091('0x24')](respondWithResult(_0x4fc761,0xc9))[_0x1091('0x4a')](handleError(_0x4fc761,null));};exports[_0x1091('0x23')]=function(_0x4bc74f,_0x36f93a){if(_0x4bc74f[_0x1091('0x4c')]['id']){delete _0x4bc74f[_0x1091('0x4c')]['id'];}return db[_0x1091('0x41')][_0x1091('0x49')]({'where':{'id':_0x4bc74f[_0x1091('0x45')]['id']}})[_0x1091('0x24')](handleEntityNotFound(_0x36f93a,null))[_0x1091('0x24')](saveUpdates(_0x4bc74f[_0x1091('0x4c')],null))[_0x1091('0x24')](respondWithResult(_0x36f93a,null))[_0x1091('0x4a')](handleError(_0x36f93a,null));};exports[_0x1091('0x25')]=function(_0x1fcf02,_0x33816a){return db[_0x1091('0x41')][_0x1091('0x49')]({'where':{'id':_0x1fcf02[_0x1091('0x45')]['id']}})[_0x1091('0x24')](handleEntityNotFound(_0x33816a,null))[_0x1091('0x24')](removeEntity(_0x33816a,null))['catch'](handleError(_0x33816a,null));};exports['describe']=function(_0xe062cf,_0x9a9747){return db[_0x1091('0x41')][_0x1091('0x4d')]()[_0x1091('0x24')](respondWithResult(_0x9a9747,null))['catch'](handleError(_0x9a9747,null));}; \ No newline at end of file +var _0xaf80=['status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0xaf80,0x1ef));var _0x0af8=function(_0x5b55f0,_0x24977c){_0x5b55f0=_0x5b55f0-0x0;var _0x1ca60f=_0xaf80[_0x5b55f0];return _0x1ca60f;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){_0x300474['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6306,_0x3b2a80){return function(_0x359583){if(!_0x359583){_0x1c6306[_0x0af8('0x16')](0x194);}return _0x359583;};}function handleError(_0x510efc,_0x500fd5){_0x500fd5=_0x500fd5||0x1f4;return function(_0x315ad){logger[_0x0af8('0x23')](_0x315ad[_0x0af8('0x24')]);if(_0x315ad[_0x0af8('0x25')]){delete _0x315ad[_0x0af8('0x25')];}_0x510efc[_0x0af8('0x17')](_0x500fd5)[_0x0af8('0x26')](_0x315ad);};}exports['index']=function(_0x34aa8b,_0xf898cc){var _0x1a7fdf={},_0x20eab4={},_0x1b94cf={'count':0x0,'rows':[]};var _0x231230=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x270b49){return{'name':_0x270b49[_0x0af8('0x2a')],'type':_0x270b49['type'][_0x0af8('0x2b')]};});_0x20eab4['model']=_[_0x0af8('0x27')](_0x231230,'name');_0x20eab4[_0x0af8('0x2c')]=_[_0x0af8('0x2d')](_0x34aa8b['query']);_0x20eab4[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],_0x20eab4['query']);_0x1a7fdf[_0x0af8('0x31')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],qs['fields'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x32')]));_0x1a7fdf[_0x0af8('0x31')]=_0x1a7fdf[_0x0af8('0x31')][_0x0af8('0x33')]?_0x1a7fdf[_0x0af8('0x31')]:_0x20eab4['model'];if(!_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x34')](_0x0af8('0x35'))){_0x1a7fdf[_0x0af8('0x36')]=qs[_0x0af8('0x36')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x36')]);_0x1a7fdf[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x1a')]);}_0x1a7fdf[_0x0af8('0x37')]=qs['sort'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x38')]);_0x1a7fdf[_0x0af8('0x39')]=qs[_0x0af8('0x2e')](_[_0x0af8('0x3a')](_0x34aa8b[_0x0af8('0x2c')],_0x20eab4[_0x0af8('0x2e')]),_0x231230);if(_0x34aa8b['query'][_0x0af8('0x3b')]){_0x1a7fdf[_0x0af8('0x39')]=_[_0x0af8('0x3c')](_0x1a7fdf['where'],{'$or':_[_0x0af8('0x27')](_0x231230,function(_0x1082de){if(_0x1082de[_0x0af8('0x3d')]!=='VIRTUAL'){var _0x6781fe={};_0x6781fe[_0x1082de[_0x0af8('0x25')]]={'$like':'%'+_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x3b')]+'%'};return _0x6781fe;}})});}_0x1a7fdf=_[_0x0af8('0x3c')]({},_0x1a7fdf,_0x34aa8b[_0x0af8('0x3e')]);var _0x258872={'where':_0x1a7fdf['where']};return db['FaxQueueReport'][_0x0af8('0x1b')](_0x258872)[_0x0af8('0x21')](function(_0x5bc8f5){_0x1b94cf[_0x0af8('0x1b')]=_0x5bc8f5;if(_0x34aa8b[_0x0af8('0x2c')]['includeAll']){_0x1a7fdf[_0x0af8('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x0af8('0x40')](_0x1a7fdf);})[_0x0af8('0x21')](function(_0x510bec){_0x1b94cf[_0x0af8('0x41')]=_0x510bec;return _0x1b94cf;})[_0x0af8('0x21')](respondWithFilteredResult(_0xf898cc,_0x1a7fdf))['catch'](handleError(_0xf898cc,null));};exports[_0x0af8('0x42')]=function(_0x496ea4,_0x2e15ec){var _0x423eee={'raw':!![],'where':{'id':_0x496ea4['params']['id']}},_0x141d2f={};_0x141d2f['model']=_[_0x0af8('0x2d')](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x141d2f[_0x0af8('0x2c')]=_['keys'](_0x496ea4[_0x0af8('0x2c')]);_0x141d2f[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x141d2f['model'],_0x141d2f[_0x0af8('0x2c')]);_0x423eee[_0x0af8('0x31')]=_['intersection'](_0x141d2f[_0x0af8('0x30')],qs['fields'](_0x496ea4[_0x0af8('0x2c')]['fields']));_0x423eee['attributes']=_0x423eee['attributes'][_0x0af8('0x33')]?_0x423eee['attributes']:_0x141d2f[_0x0af8('0x30')];if(_0x496ea4['query'][_0x0af8('0x43')]){_0x423eee[_0x0af8('0x3f')]=[{'all':!![]}];}_0x423eee=_[_0x0af8('0x3c')]({},_0x423eee,_0x496ea4[_0x0af8('0x3e')]);return db[_0x0af8('0x28')]['find'](_0x423eee)['then'](handleEntityNotFound(_0x2e15ec,null))[_0x0af8('0x21')](respondWithResult(_0x2e15ec,null))[_0x0af8('0x44')](handleError(_0x2e15ec,null));};exports[_0x0af8('0x45')]=function(_0x24a104,_0x3d86e2){return db[_0x0af8('0x28')][_0x0af8('0x45')](_0x24a104['body'],{})['then'](respondWithResult(_0x3d86e2,0xc9))[_0x0af8('0x44')](handleError(_0x3d86e2,null));};exports[_0x0af8('0x20')]=function(_0x394525,_0x3c57dd){if(_0x394525['body']['id']){delete _0x394525[_0x0af8('0x46')]['id'];}return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x394525[_0x0af8('0x48')]['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x21')](saveUpdates(_0x394525['body'],null))[_0x0af8('0x21')](respondWithResult(_0x3c57dd,null))['catch'](handleError(_0x3c57dd,null));};exports[_0x0af8('0x22')]=function(_0x4a43e3,_0xeddce9){return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x4a43e3['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0xeddce9,null))[_0x0af8('0x21')](removeEntity(_0xeddce9,null))['catch'](handleError(_0xeddce9,null));};exports[_0x0af8('0x49')]=function(_0x1237d6,_0x2ae5cc){return db[_0x0af8('0x28')][_0x0af8('0x49')]()[_0x0af8('0x21')](respondWithResult(_0x2ae5cc,null))[_0x0af8('0x44')](handleError(_0x2ae5cc,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ea0d19d..9caaa21 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x177af8,_0x2b4075){var _0xac63f0=function(_0x5b4d2f){while(--_0x5b4d2f){_0x177af8['push'](_0x177af8['shift']());}};_0xac63f0(++_0x2b4075);}(_0x326f,0xd1));var _0xf326=function(_0x506c89,_0x2feaa1){_0x506c89=_0x506c89-0x0;var _0x554a82=_0x326f[_0x506c89];return _0x554a82;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('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(_0x22cf50,_0x292ac2){var _0x5126d6=function(_0x13450a){while(--_0x13450a){_0x22cf50['push'](_0x22cf50['shift']());}};_0x5126d6(++_0x292ac2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x292893,_0x3cd21e){_0x292893=_0x292893-0x0;var _0x5a55ac=_0x7fbe[_0x292893];return _0x5a55ac;};'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 1a8a163..75106c9 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 _0x3801=['create','options','raw','catch','UpdateFaxQueueReport','update','body','where','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport'];(function(_0x36c3e3,_0x407e37){var _0x1fd38e=function(_0x175c24){while(--_0x175c24){_0x36c3e3['push'](_0x36c3e3['shift']());}};_0x1fd38e(++_0x407e37);}(_0x3801,0x100));var _0x1380=function(_0x4b2a8f,_0x5277ac){_0x4b2a8f=_0x4b2a8f-0x0;var _0x311556=_0x3801[_0x4b2a8f];return _0x311556;};'use strict';var _=require(_0x1380('0x0'));var util=require('util');var moment=require(_0x1380('0x1'));var BPromise=require(_0x1380('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1380('0x3'))['db'];var utils=require(_0x1380('0x4'));var logger=require(_0x1380('0x5'))(_0x1380('0x6'));var config=require(_0x1380('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1380('0x8')][_0x1380('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27226c,_0x5cea71,_0xe2323c){return new BPromise(function(_0x1e7ab2,_0x2cdc85){return client[_0x1380('0xa')](_0x27226c,_0xe2323c)[_0x1380('0xb')](function(_0x3d70c1){logger[_0x1380('0xc')](_0x1380('0xd'),_0x5cea71,_0x1380('0xe'));logger[_0x1380('0xf')](_0x1380('0x10'),_0x5cea71,_0x1380('0xe'),JSON[_0x1380('0x11')](_0x3d70c1));if(_0x3d70c1[_0x1380('0x12')]){if(_0x3d70c1[_0x1380('0x12')][_0x1380('0x13')]===0x1f4){logger[_0x1380('0x12')](_0x1380('0xd'),_0x5cea71,_0x3d70c1[_0x1380('0x12')][_0x1380('0x14')]);return _0x2cdc85(_0x3d70c1['error'][_0x1380('0x14')]);}logger[_0x1380('0x12')](_0x1380('0xd'),_0x5cea71,_0x3d70c1[_0x1380('0x12')][_0x1380('0x14')]);return _0x1e7ab2(_0x3d70c1[_0x1380('0x12')][_0x1380('0x14')]);}else{logger['info'](_0x1380('0xd'),_0x5cea71,_0x1380('0xe'));_0x1e7ab2(_0x3d70c1['result'][_0x1380('0x14')]);}})['catch'](function(_0x3b8924){logger[_0x1380('0x12')](_0x1380('0xd'),_0x5cea71,_0x3b8924);_0x2cdc85(_0x3b8924);});});}exports[_0x1380('0x15')]=function(_0x2b9eaf){var _0x107ac2=this;return new Promise(function(_0x172b27,_0x364a36){return db[_0x1380('0x16')][_0x1380('0x17')](_0x2b9eaf['body'],{'raw':_0x2b9eaf['options']?_0x2b9eaf[_0x1380('0x18')][_0x1380('0x19')]===undefined?!![]:![]:!![]})[_0x1380('0xb')](function(_0x1d62c9){logger[_0x1380('0xc')](_0x1380('0x15'),_0x2b9eaf);logger[_0x1380('0xf')](_0x1380('0x15'),_0x2b9eaf,JSON[_0x1380('0x11')](_0x1d62c9));_0x172b27(_0x1d62c9);})[_0x1380('0x1a')](function(_0x3fa018){logger['error'](_0x1380('0x15'),_0x3fa018[_0x1380('0x14')],_0x2b9eaf);_0x364a36(_0x107ac2['error'](0x1f4,_0x3fa018['message']));});});};exports[_0x1380('0x1b')]=function(_0x249d10){var _0x1671ac=this;return new Promise(function(_0xea4d69,_0x2ed490){return db[_0x1380('0x16')][_0x1380('0x1c')](_0x249d10[_0x1380('0x1d')],{'raw':_0x249d10['options']?_0x249d10['options'][_0x1380('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x249d10[_0x1380('0x18')]?_0x249d10['options'][_0x1380('0x1e')]||null:null,'attributes':_0x249d10[_0x1380('0x18')]?_0x249d10[_0x1380('0x18')]['attributes']||null:null,'limit':_0x249d10[_0x1380('0x18')]?_0x249d10[_0x1380('0x18')]['limit']||null:null})['then'](function(_0x4e2b6c){logger[_0x1380('0xc')](_0x1380('0x1b'),_0x249d10);logger['debug'](_0x1380('0x1b'),_0x249d10,JSON[_0x1380('0x11')](_0x4e2b6c));_0xea4d69(_0x4e2b6c);})[_0x1380('0x1a')](function(_0x11ae52){logger[_0x1380('0x12')](_0x1380('0x1b'),_0x11ae52[_0x1380('0x14')],_0x249d10);_0x2ed490(_0x1671ac[_0x1380('0x12')](0x1f4,_0x11ae52[_0x1380('0x14')]));});});}; \ No newline at end of file +var _0xf8ba=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','debug','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','where','limit','lodash','util','moment','bluebird'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xf8ba,0xb6));var _0xaf8b=function(_0x2bbc5a,_0x2d77d0){_0x2bbc5a=_0x2bbc5a-0x0;var _0x5e4fc0=_0xf8ba[_0x2bbc5a];return _0x5e4fc0;};'use strict';var _=require(_0xaf8b('0x0'));var util=require(_0xaf8b('0x1'));var moment=require(_0xaf8b('0x2'));var BPromise=require(_0xaf8b('0x3'));var rs=require(_0xaf8b('0x4'));var fs=require('fs');var Redis=require(_0xaf8b('0x5'));var db=require(_0xaf8b('0x6'))['db'];var utils=require(_0xaf8b('0x7'));var logger=require(_0xaf8b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf8b('0x9')][_0xaf8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c0b43,_0x583fdf,_0x313219){return new BPromise(function(_0x22dcec,_0x1fdfe9){return client[_0xaf8b('0xb')](_0x1c0b43,_0x313219)['then'](function(_0x42691d){logger[_0xaf8b('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x583fdf,_0xaf8b('0xd'));logger[_0xaf8b('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x583fdf,'request\x20sent',JSON['stringify'](_0x42691d));if(_0x42691d[_0xaf8b('0xf')]){if(_0x42691d[_0xaf8b('0xf')][_0xaf8b('0x10')]===0x1f4){logger[_0xaf8b('0xf')](_0xaf8b('0x11'),_0x583fdf,_0x42691d[_0xaf8b('0xf')][_0xaf8b('0x12')]);return _0x1fdfe9(_0x42691d['error'][_0xaf8b('0x12')]);}logger[_0xaf8b('0xf')](_0xaf8b('0x11'),_0x583fdf,_0x42691d[_0xaf8b('0xf')]['message']);return _0x22dcec(_0x42691d[_0xaf8b('0xf')]['message']);}else{logger[_0xaf8b('0xc')](_0xaf8b('0x11'),_0x583fdf,_0xaf8b('0xd'));_0x22dcec(_0x42691d[_0xaf8b('0x13')][_0xaf8b('0x12')]);}})[_0xaf8b('0x14')](function(_0x254b4e){logger[_0xaf8b('0xf')](_0xaf8b('0x11'),_0x583fdf,_0x254b4e);_0x1fdfe9(_0x254b4e);});});}exports[_0xaf8b('0x15')]=function(_0x20e226){var _0x1a918f=this;return new Promise(function(_0xda1bdc,_0x5cce74){return db[_0xaf8b('0x16')][_0xaf8b('0x17')](_0x20e226[_0xaf8b('0x18')],{'raw':_0x20e226[_0xaf8b('0x19')]?_0x20e226[_0xaf8b('0x19')][_0xaf8b('0x1a')]===undefined?!![]:![]:!![]})[_0xaf8b('0x1b')](function(_0x5d14a2){logger[_0xaf8b('0xc')]('CreateFaxQueueReport',_0x20e226);logger[_0xaf8b('0xe')](_0xaf8b('0x15'),_0x20e226,JSON['stringify'](_0x5d14a2));_0xda1bdc(_0x5d14a2);})['catch'](function(_0x4a14fd){logger[_0xaf8b('0xf')](_0xaf8b('0x15'),_0x4a14fd[_0xaf8b('0x12')],_0x20e226);_0x5cce74(_0x1a918f['error'](0x1f4,_0x4a14fd[_0xaf8b('0x12')]));});});};exports[_0xaf8b('0x1c')]=function(_0x4e007b){var _0x575d71=this;return new Promise(function(_0x165e87,_0x3e2c4d){return db['FaxQueueReport']['update'](_0x4e007b['body'],{'raw':_0x4e007b[_0xaf8b('0x19')]?_0x4e007b[_0xaf8b('0x19')][_0xaf8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e007b[_0xaf8b('0x19')]?_0x4e007b[_0xaf8b('0x19')][_0xaf8b('0x1d')]||null:null,'attributes':_0x4e007b[_0xaf8b('0x19')]?_0x4e007b['options']['attributes']||null:null,'limit':_0x4e007b['options']?_0x4e007b[_0xaf8b('0x19')][_0xaf8b('0x1e')]||null:null})[_0xaf8b('0x1b')](function(_0x175115){logger[_0xaf8b('0xc')](_0xaf8b('0x1c'),_0x4e007b);logger['debug'](_0xaf8b('0x1c'),_0x4e007b,JSON['stringify'](_0x175115));_0x165e87(_0x175115);})[_0xaf8b('0x14')](function(_0x5bb315){logger[_0xaf8b('0xf')](_0xaf8b('0x1c'),_0x5bb315[_0xaf8b('0x12')],_0x4e007b);_0x3e2c4d(_0x575d71['error'](0x1f4,_0x5bb315[_0xaf8b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 23250f0..0f3378e 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 _0x7c14=['show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id'];(function(_0xa7c05d,_0x312374){var _0x47b002=function(_0x44aa2f){while(--_0x44aa2f){_0xa7c05d['push'](_0xa7c05d['shift']());}};_0x47b002(++_0x312374);}(_0x7c14,0xf6));var _0x47c1=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7c14[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x47c1('0x0'));var util=require(_0x47c1('0x1'));var path=require('path');var timeout=require(_0x47c1('0x2'));var express=require(_0x47c1('0x3'));var router=express[_0x47c1('0x4')]();var fs_extra=require(_0x47c1('0x5'));var auth=require(_0x47c1('0x6'));var interaction=require(_0x47c1('0x7'));var config=require(_0x47c1('0x8'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x47c1('0x9')](),controller[_0x47c1('0xa')]);router['get'](_0x47c1('0xb'),auth[_0x47c1('0x9')](),controller['describe']);router[_0x47c1('0xc')](_0x47c1('0xd'),auth['isAuthenticated'](),controller[_0x47c1('0xe')]);router[_0x47c1('0xf')]('/',auth[_0x47c1('0x9')](),controller['create']);router[_0x47c1('0x10')](_0x47c1('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x47c1('0x11')]('/:id',auth[_0x47c1('0x9')](),controller[_0x47c1('0x12')]);module[_0x47c1('0x13')]=router; \ No newline at end of file +var _0x2e2b=['index','get','/describe','describe','/:id','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x2e2b,0x81));var _0xb2e2=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x2e2b[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require(_0xb2e2('0x0'));var util=require(_0xb2e2('0x1'));var path=require('path');var timeout=require(_0xb2e2('0x2'));var express=require(_0xb2e2('0x3'));var router=express[_0xb2e2('0x4')]();var fs_extra=require(_0xb2e2('0x5'));var auth=require(_0xb2e2('0x6'));var interaction=require(_0xb2e2('0x7'));var config=require(_0xb2e2('0x8'));var controller=require(_0xb2e2('0x9'));router['get']('/',auth[_0xb2e2('0xa')](),controller[_0xb2e2('0xb')]);router[_0xb2e2('0xc')](_0xb2e2('0xd'),auth[_0xb2e2('0xa')](),controller[_0xb2e2('0xe')]);router[_0xb2e2('0xc')](_0xb2e2('0xf'),auth[_0xb2e2('0xa')](),controller['show']);router['post']('/',auth[_0xb2e2('0xa')](),controller['create']);router[_0xb2e2('0x10')](_0xb2e2('0xf'),auth[_0xb2e2('0xa')](),controller[_0xb2e2('0x11')]);router['delete'](_0xb2e2('0xf'),auth[_0xb2e2('0xa')](),controller[_0xb2e2('0x12')]);module[_0xb2e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3017882..762702e 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x481f94,_0x1ec6a2){var _0x5dfc0c=function(_0x362aa9){while(--_0x362aa9){_0x481f94['push'](_0x481f94['shift']());}};_0x5dfc0c(++_0x1ec6a2);}(_0xaa88,0x137));var _0x8aa8=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xaa88[_0x81f000];return _0x337aa2;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1e1ecd,_0x2c0ade){var _0x2cc59f=function(_0x3106ca){while(--_0x3106ca){_0x1e1ecd['push'](_0x1e1ecd['shift']());}};_0x2cc59f(++_0x2c0ade);}(_0xaa88,0x137));var _0x8aa8=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xaa88[_0x2b0a86];return _0x955940;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e3a6f09..3d65157 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 _0x9c7b=['status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','fields','includeAll','find','create','body','catch','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x46d3fa,_0xce5845){var _0x20d1b7=function(_0xa02df1){while(--_0xa02df1){_0x46d3fa['push'](_0x46d3fa['shift']());}};_0x20d1b7(++_0xce5845);}(_0x9c7b,0x85));var _0xb9c7=function(_0x3e548f,_0x2b0136){_0x3e548f=_0x3e548f-0x0;var _0x51f563=_0x9c7b[_0x3e548f];return _0x51f563;};'use strict';var emlformat=require(_0xb9c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb9c7('0x1'));var rp=require(_0xb9c7('0x2'));var moment=require(_0xb9c7('0x3'));var BPromise=require(_0xb9c7('0x4'));var Mustache=require(_0xb9c7('0x5'));var util=require(_0xb9c7('0x6'));var path=require(_0xb9c7('0x7'));var sox=require(_0xb9c7('0x8'));var csv=require(_0xb9c7('0x9'));var ejs=require(_0xb9c7('0xa'));var fs=require('fs');var fs_extra=require(_0xb9c7('0xb'));var _=require('lodash');var squel=require(_0xb9c7('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9c7('0xd'));var deskjs=require(_0xb9c7('0xe'));var toCsv=require(_0xb9c7('0x9'));var querystring=require('querystring');var Papa=require(_0xb9c7('0xf'));var Redis=require(_0xb9c7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb9c7('0x11'));var as=require(_0xb9c7('0x12'));var hardwareService=require(_0xb9c7('0x13'));var logger=require(_0xb9c7('0x14'))('api');var utils=require(_0xb9c7('0x15'));var config=require(_0xb9c7('0x16'));var licenseUtil=require(_0xb9c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48344e,_0x43da15){_0x43da15=_0x43da15||0xcc;return function(_0x10868e){if(_0x10868e){return _0x48344e[_0xb9c7('0x18')](_0x43da15);}return _0x48344e[_0xb9c7('0x19')](_0x43da15)['end']();};}function respondWithResult(_0x591d9e,_0x100cc4){_0x100cc4=_0x100cc4||0xc8;return function(_0x2d427d){if(_0x2d427d){return _0x591d9e[_0xb9c7('0x19')](_0x100cc4)[_0xb9c7('0x1a')](_0x2d427d);}};}function respondWithFilteredResult(_0x7c9519,_0x31a54e){return function(_0x1a9b23){if(_0x1a9b23){var _0x4066bf=typeof _0x31a54e[_0xb9c7('0x1b')]==='undefined'&&typeof _0x31a54e['limit']==='undefined';var _0x548c02=_0x1a9b23[_0xb9c7('0x1c')];var _0x4ea85e=_0x4066bf?0x0:_0x31a54e[_0xb9c7('0x1b')];var _0x158c10=_0x4066bf?_0x1a9b23['count']:_0x31a54e[_0xb9c7('0x1b')]+_0x31a54e[_0xb9c7('0x1d')];var _0x556f1a;if(_0x158c10>=_0x548c02){_0x158c10=_0x548c02;_0x556f1a=0xc8;}else{_0x556f1a=0xce;}_0x7c9519[_0xb9c7('0x19')](_0x556f1a);return _0x7c9519[_0xb9c7('0x1e')](_0xb9c7('0x1f'),_0x4ea85e+'-'+_0x158c10+'/'+_0x548c02)['json'](_0x1a9b23);}return null;};}function patchUpdates(_0x3240eb){return function(_0x2f56c7){try{jsonpatch[_0xb9c7('0x20')](_0x2f56c7,_0x3240eb,!![]);}catch(_0x1cffb0){return BPromise[_0xb9c7('0x21')](_0x1cffb0);}return _0x2f56c7[_0xb9c7('0x22')]();};}function saveUpdates(_0x1796ff,_0x698e33){return function(_0x132aa4){if(_0x132aa4){return _0x132aa4[_0xb9c7('0x23')](_0x1796ff)[_0xb9c7('0x24')](function(_0x5d4c11){return _0x5d4c11;});}return null;};}function removeEntity(_0x419e91,_0x10d7bb){return function(_0x27c832){if(_0x27c832){return _0x27c832[_0xb9c7('0x25')]()['then'](function(){_0x419e91[_0xb9c7('0x19')](0xcc)[_0xb9c7('0x26')]();});}};}function handleEntityNotFound(_0x341611,_0x1cf5ee){return function(_0x5ec46e){if(!_0x5ec46e){_0x341611[_0xb9c7('0x18')](0x194);}return _0x5ec46e;};}function handleError(_0x26e398,_0xa181ee){_0xa181ee=_0xa181ee||0x1f4;return function(_0x1fca83){logger[_0xb9c7('0x27')](_0x1fca83[_0xb9c7('0x28')]);if(_0x1fca83[_0xb9c7('0x29')]){delete _0x1fca83[_0xb9c7('0x29')];}_0x26e398[_0xb9c7('0x19')](_0xa181ee)[_0xb9c7('0x2a')](_0x1fca83);};}exports[_0xb9c7('0x2b')]=function(_0xe0e4a7,_0xc66fe2){var _0x7207a4={},_0x237dca={},_0x4ad930={'count':0x0,'rows':[]};var _0x2a7356=_[_0xb9c7('0x2c')](db[_0xb9c7('0x2d')][_0xb9c7('0x2e')],function(_0x2b596d){return{'name':_0x2b596d[_0xb9c7('0x2f')],'type':_0x2b596d[_0xb9c7('0x30')][_0xb9c7('0x31')]};});_0x237dca['model']=_['map'](_0x2a7356,_0xb9c7('0x29'));_0x237dca[_0xb9c7('0x32')]=_[_0xb9c7('0x33')](_0xe0e4a7['query']);_0x237dca[_0xb9c7('0x34')]=_['intersection'](_0x237dca[_0xb9c7('0x35')],_0x237dca[_0xb9c7('0x32')]);_0x7207a4[_0xb9c7('0x36')]=_[_0xb9c7('0x37')](_0x237dca[_0xb9c7('0x35')],qs['fields'](_0xe0e4a7[_0xb9c7('0x32')]['fields']));_0x7207a4[_0xb9c7('0x36')]=_0x7207a4[_0xb9c7('0x36')][_0xb9c7('0x38')]?_0x7207a4['attributes']:_0x237dca[_0xb9c7('0x35')];if(!_0xe0e4a7['query'][_0xb9c7('0x39')](_0xb9c7('0x3a'))){_0x7207a4[_0xb9c7('0x1d')]=qs[_0xb9c7('0x1d')](_0xe0e4a7[_0xb9c7('0x32')][_0xb9c7('0x1d')]);_0x7207a4['offset']=qs[_0xb9c7('0x1b')](_0xe0e4a7[_0xb9c7('0x32')][_0xb9c7('0x1b')]);}_0x7207a4[_0xb9c7('0x3b')]=qs['sort'](_0xe0e4a7['query'][_0xb9c7('0x3c')]);_0x7207a4[_0xb9c7('0x3d')]=qs[_0xb9c7('0x34')](_[_0xb9c7('0x3e')](_0xe0e4a7['query'],_0x237dca[_0xb9c7('0x34')]),_0x2a7356);if(_0xe0e4a7['query'][_0xb9c7('0x3f')]){_0x7207a4[_0xb9c7('0x3d')]=_[_0xb9c7('0x40')](_0x7207a4[_0xb9c7('0x3d')],{'$or':_['map'](_0x2a7356,function(_0xdbf72f){if(_0xdbf72f['type']!==_0xb9c7('0x41')){var _0x522131={};_0x522131[_0xdbf72f['name']]={'$like':'%'+_0xe0e4a7[_0xb9c7('0x32')][_0xb9c7('0x3f')]+'%'};return _0x522131;}})});}_0x7207a4=_[_0xb9c7('0x40')]({},_0x7207a4,_0xe0e4a7[_0xb9c7('0x42')]);var _0x5c06db={'where':_0x7207a4[_0xb9c7('0x3d')]};return db[_0xb9c7('0x2d')][_0xb9c7('0x1c')](_0x5c06db)[_0xb9c7('0x24')](function(_0x5ae228){_0x4ad930[_0xb9c7('0x1c')]=_0x5ae228;if(_0xe0e4a7[_0xb9c7('0x32')]['includeAll']){_0x7207a4[_0xb9c7('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xb9c7('0x44')](_0x7207a4);})[_0xb9c7('0x24')](function(_0xce5dc8){_0x4ad930[_0xb9c7('0x45')]=_0xce5dc8;return _0x4ad930;})[_0xb9c7('0x24')](respondWithFilteredResult(_0xc66fe2,_0x7207a4))['catch'](handleError(_0xc66fe2,null));};exports[_0xb9c7('0x46')]=function(_0xaeebf6,_0x4a63c9){var _0x542aac={'raw':!![],'where':{'id':_0xaeebf6[_0xb9c7('0x47')]['id']}},_0x1242a3={};_0x1242a3[_0xb9c7('0x35')]=_[_0xb9c7('0x33')](db[_0xb9c7('0x2d')]['rawAttributes']);_0x1242a3[_0xb9c7('0x32')]=_[_0xb9c7('0x33')](_0xaeebf6[_0xb9c7('0x32')]);_0x1242a3[_0xb9c7('0x34')]=_[_0xb9c7('0x37')](_0x1242a3[_0xb9c7('0x35')],_0x1242a3['query']);_0x542aac[_0xb9c7('0x36')]=_['intersection'](_0x1242a3[_0xb9c7('0x35')],qs[_0xb9c7('0x48')](_0xaeebf6[_0xb9c7('0x32')][_0xb9c7('0x48')]));_0x542aac[_0xb9c7('0x36')]=_0x542aac[_0xb9c7('0x36')][_0xb9c7('0x38')]?_0x542aac[_0xb9c7('0x36')]:_0x1242a3[_0xb9c7('0x35')];if(_0xaeebf6[_0xb9c7('0x32')][_0xb9c7('0x49')]){_0x542aac['include']=[{'all':!![]}];}_0x542aac=_[_0xb9c7('0x40')]({},_0x542aac,_0xaeebf6[_0xb9c7('0x42')]);return db[_0xb9c7('0x2d')][_0xb9c7('0x4a')](_0x542aac)[_0xb9c7('0x24')](handleEntityNotFound(_0x4a63c9,null))[_0xb9c7('0x24')](respondWithResult(_0x4a63c9,null))['catch'](handleError(_0x4a63c9,null));};exports[_0xb9c7('0x4b')]=function(_0x283f93,_0x40d80f){return db[_0xb9c7('0x2d')][_0xb9c7('0x4b')](_0x283f93[_0xb9c7('0x4c')],{})[_0xb9c7('0x24')](respondWithResult(_0x40d80f,0xc9))[_0xb9c7('0x4d')](handleError(_0x40d80f,null));};exports[_0xb9c7('0x23')]=function(_0x285d24,_0x149149){if(_0x285d24[_0xb9c7('0x4c')]['id']){delete _0x285d24[_0xb9c7('0x4c')]['id'];}return db[_0xb9c7('0x2d')][_0xb9c7('0x4a')]({'where':{'id':_0x285d24[_0xb9c7('0x47')]['id']}})[_0xb9c7('0x24')](handleEntityNotFound(_0x149149,null))['then'](saveUpdates(_0x285d24['body'],null))['then'](respondWithResult(_0x149149,null))[_0xb9c7('0x4d')](handleError(_0x149149,null));};exports['destroy']=function(_0x401f80,_0x46691c){return db[_0xb9c7('0x2d')][_0xb9c7('0x4a')]({'where':{'id':_0x401f80[_0xb9c7('0x47')]['id']}})[_0xb9c7('0x24')](handleEntityNotFound(_0x46691c,null))[_0xb9c7('0x24')](removeEntity(_0x46691c,null))[_0xb9c7('0x4d')](handleError(_0x46691c,null));};exports[_0xb9c7('0x4e')]=function(_0x54fcab,_0x18351c){return db['FaxTransferReport'][_0xb9c7('0x4e')]()[_0xb9c7('0x24')](respondWithResult(_0x18351c,null))['catch'](handleError(_0x18351c,null));}; \ No newline at end of file +var _0xd847=['order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x44912a,_0x266423){var _0x15a566=function(_0x2bb0e6){while(--_0x2bb0e6){_0x44912a['push'](_0x44912a['shift']());}};_0x15a566(++_0x266423);}(_0xd847,0x1f2));var _0x7d84=function(_0x364220,_0x34ce6a){_0x364220=_0x364220-0x0;var _0x4a6928=_0xd847[_0x364220];return _0x4a6928;};'use strict';var emlformat=require(_0x7d84('0x0'));var rimraf=require(_0x7d84('0x1'));var zipdir=require(_0x7d84('0x2'));var jsonpatch=require(_0x7d84('0x3'));var rp=require(_0x7d84('0x4'));var moment=require(_0x7d84('0x5'));var BPromise=require(_0x7d84('0x6'));var Mustache=require(_0x7d84('0x7'));var util=require(_0x7d84('0x8'));var path=require('path');var sox=require(_0x7d84('0x9'));var csv=require('to-csv');var ejs=require(_0x7d84('0xa'));var fs=require('fs');var fs_extra=require(_0x7d84('0xb'));var _=require(_0x7d84('0xc'));var squel=require(_0x7d84('0xd'));var crypto=require(_0x7d84('0xe'));var jsforce=require(_0x7d84('0xf'));var deskjs=require(_0x7d84('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7d84('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7d84('0x12'));var as=require(_0x7d84('0x13'));var hardwareService=require(_0x7d84('0x14'));var logger=require('../../config/logger')(_0x7d84('0x15'));var utils=require(_0x7d84('0x16'));var config=require(_0x7d84('0x17'));var licenseUtil=require(_0x7d84('0x18'));var db=require(_0x7d84('0x19'))['db'];function respondWithStatusCode(_0x5c0572,_0x42f53a){_0x42f53a=_0x42f53a||0xcc;return function(_0x88aef0){if(_0x88aef0){return _0x5c0572['sendStatus'](_0x42f53a);}return _0x5c0572[_0x7d84('0x1a')](_0x42f53a)[_0x7d84('0x1b')]();};}function respondWithResult(_0x3926b5,_0x3fcc01){_0x3fcc01=_0x3fcc01||0xc8;return function(_0x43ce87){if(_0x43ce87){return _0x3926b5[_0x7d84('0x1a')](_0x3fcc01)[_0x7d84('0x1c')](_0x43ce87);}};}function respondWithFilteredResult(_0x204acf,_0x30c846){return function(_0x4db341){if(_0x4db341){var _0x4714e8=typeof _0x30c846[_0x7d84('0x1d')]==='undefined'&&typeof _0x30c846[_0x7d84('0x1e')]===_0x7d84('0x1f');var _0x3eef55=_0x4db341[_0x7d84('0x20')];var _0x9f822b=_0x4714e8?0x0:_0x30c846[_0x7d84('0x1d')];var _0x288ecb=_0x4714e8?_0x4db341['count']:_0x30c846['offset']+_0x30c846[_0x7d84('0x1e')];var _0x41b14b;if(_0x288ecb>=_0x3eef55){_0x288ecb=_0x3eef55;_0x41b14b=0xc8;}else{_0x41b14b=0xce;}_0x204acf[_0x7d84('0x1a')](_0x41b14b);return _0x204acf[_0x7d84('0x21')](_0x7d84('0x22'),_0x9f822b+'-'+_0x288ecb+'/'+_0x3eef55)[_0x7d84('0x1c')](_0x4db341);}return null;};}function patchUpdates(_0x5b46e5){return function(_0x296d0){try{jsonpatch[_0x7d84('0x23')](_0x296d0,_0x5b46e5,!![]);}catch(_0x26ecd6){return BPromise[_0x7d84('0x24')](_0x26ecd6);}return _0x296d0[_0x7d84('0x25')]();};}function saveUpdates(_0x453cfc,_0x6da5cd){return function(_0xbd5935){if(_0xbd5935){return _0xbd5935['update'](_0x453cfc)[_0x7d84('0x26')](function(_0x69d1a8){return _0x69d1a8;});}return null;};}function removeEntity(_0x132a2f,_0x38b464){return function(_0x1debd0){if(_0x1debd0){return _0x1debd0[_0x7d84('0x27')]()[_0x7d84('0x26')](function(){_0x132a2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b284a,_0x33b022){return function(_0x41e8b5){if(!_0x41e8b5){_0x1b284a[_0x7d84('0x28')](0x194);}return _0x41e8b5;};}function handleError(_0x4420fd,_0x1e0f0f){_0x1e0f0f=_0x1e0f0f||0x1f4;return function(_0x21096c){logger[_0x7d84('0x29')](_0x21096c[_0x7d84('0x2a')]);if(_0x21096c[_0x7d84('0x2b')]){delete _0x21096c['name'];}_0x4420fd[_0x7d84('0x1a')](_0x1e0f0f)[_0x7d84('0x2c')](_0x21096c);};}exports[_0x7d84('0x2d')]=function(_0x2be0e5,_0x4dceb0){var _0x44a5b4={},_0x2f271c={},_0x37c88b={'count':0x0,'rows':[]};var _0x55ea26=_[_0x7d84('0x2e')](db[_0x7d84('0x2f')][_0x7d84('0x30')],function(_0x3fdf18){return{'name':_0x3fdf18[_0x7d84('0x31')],'type':_0x3fdf18[_0x7d84('0x32')][_0x7d84('0x33')]};});_0x2f271c['model']=_[_0x7d84('0x2e')](_0x55ea26,_0x7d84('0x2b'));_0x2f271c[_0x7d84('0x34')]=_[_0x7d84('0x35')](_0x2be0e5[_0x7d84('0x34')]);_0x2f271c[_0x7d84('0x36')]=_['intersection'](_0x2f271c[_0x7d84('0x37')],_0x2f271c[_0x7d84('0x34')]);_0x44a5b4[_0x7d84('0x38')]=_[_0x7d84('0x39')](_0x2f271c[_0x7d84('0x37')],qs[_0x7d84('0x3a')](_0x2be0e5['query'][_0x7d84('0x3a')]));_0x44a5b4['attributes']=_0x44a5b4[_0x7d84('0x38')][_0x7d84('0x3b')]?_0x44a5b4[_0x7d84('0x38')]:_0x2f271c[_0x7d84('0x37')];if(!_0x2be0e5[_0x7d84('0x34')][_0x7d84('0x3c')](_0x7d84('0x3d'))){_0x44a5b4[_0x7d84('0x1e')]=qs[_0x7d84('0x1e')](_0x2be0e5['query'][_0x7d84('0x1e')]);_0x44a5b4[_0x7d84('0x1d')]=qs[_0x7d84('0x1d')](_0x2be0e5[_0x7d84('0x34')][_0x7d84('0x1d')]);}_0x44a5b4[_0x7d84('0x3e')]=qs[_0x7d84('0x3f')](_0x2be0e5[_0x7d84('0x34')]['sort']);_0x44a5b4[_0x7d84('0x40')]=qs[_0x7d84('0x36')](_[_0x7d84('0x41')](_0x2be0e5['query'],_0x2f271c[_0x7d84('0x36')]),_0x55ea26);if(_0x2be0e5[_0x7d84('0x34')]['filter']){_0x44a5b4[_0x7d84('0x40')]=_[_0x7d84('0x42')](_0x44a5b4[_0x7d84('0x40')],{'$or':_[_0x7d84('0x2e')](_0x55ea26,function(_0x43340f){if(_0x43340f['type']!=='VIRTUAL'){var _0x1b8c38={};_0x1b8c38[_0x43340f[_0x7d84('0x2b')]]={'$like':'%'+_0x2be0e5[_0x7d84('0x34')][_0x7d84('0x43')]+'%'};return _0x1b8c38;}})});}_0x44a5b4=_[_0x7d84('0x42')]({},_0x44a5b4,_0x2be0e5[_0x7d84('0x44')]);var _0x1099ce={'where':_0x44a5b4[_0x7d84('0x40')]};return db[_0x7d84('0x2f')][_0x7d84('0x20')](_0x1099ce)[_0x7d84('0x26')](function(_0x5ce018){_0x37c88b[_0x7d84('0x20')]=_0x5ce018;if(_0x2be0e5['query'][_0x7d84('0x45')]){_0x44a5b4[_0x7d84('0x46')]=[{'all':!![]}];}return db[_0x7d84('0x2f')][_0x7d84('0x47')](_0x44a5b4);})['then'](function(_0x5582f3){_0x37c88b[_0x7d84('0x48')]=_0x5582f3;return _0x37c88b;})['then'](respondWithFilteredResult(_0x4dceb0,_0x44a5b4))[_0x7d84('0x49')](handleError(_0x4dceb0,null));};exports['show']=function(_0x445400,_0x1c796a){var _0x17553a={'raw':!![],'where':{'id':_0x445400[_0x7d84('0x4a')]['id']}},_0x5ca686={};_0x5ca686['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x5ca686[_0x7d84('0x34')]=_[_0x7d84('0x35')](_0x445400[_0x7d84('0x34')]);_0x5ca686['filters']=_[_0x7d84('0x39')](_0x5ca686[_0x7d84('0x37')],_0x5ca686['query']);_0x17553a[_0x7d84('0x38')]=_[_0x7d84('0x39')](_0x5ca686[_0x7d84('0x37')],qs[_0x7d84('0x3a')](_0x445400['query'][_0x7d84('0x3a')]));_0x17553a[_0x7d84('0x38')]=_0x17553a['attributes'][_0x7d84('0x3b')]?_0x17553a[_0x7d84('0x38')]:_0x5ca686['model'];if(_0x445400['query']['includeAll']){_0x17553a[_0x7d84('0x46')]=[{'all':!![]}];}_0x17553a=_[_0x7d84('0x42')]({},_0x17553a,_0x445400['options']);return db['FaxTransferReport'][_0x7d84('0x4b')](_0x17553a)[_0x7d84('0x26')](handleEntityNotFound(_0x1c796a,null))[_0x7d84('0x26')](respondWithResult(_0x1c796a,null))['catch'](handleError(_0x1c796a,null));};exports[_0x7d84('0x4c')]=function(_0x582bc9,_0x17241b){return db[_0x7d84('0x2f')][_0x7d84('0x4c')](_0x582bc9[_0x7d84('0x4d')],{})[_0x7d84('0x26')](respondWithResult(_0x17241b,0xc9))[_0x7d84('0x49')](handleError(_0x17241b,null));};exports[_0x7d84('0x4e')]=function(_0x548c08,_0x48ffb1){if(_0x548c08[_0x7d84('0x4d')]['id']){delete _0x548c08[_0x7d84('0x4d')]['id'];}return db[_0x7d84('0x2f')][_0x7d84('0x4b')]({'where':{'id':_0x548c08[_0x7d84('0x4a')]['id']}})[_0x7d84('0x26')](handleEntityNotFound(_0x48ffb1,null))['then'](saveUpdates(_0x548c08[_0x7d84('0x4d')],null))[_0x7d84('0x26')](respondWithResult(_0x48ffb1,null))[_0x7d84('0x49')](handleError(_0x48ffb1,null));};exports[_0x7d84('0x27')]=function(_0x3cb8f9,_0x355e5d){return db[_0x7d84('0x2f')][_0x7d84('0x4b')]({'where':{'id':_0x3cb8f9['params']['id']}})[_0x7d84('0x26')](handleEntityNotFound(_0x355e5d,null))[_0x7d84('0x26')](removeEntity(_0x355e5d,null))[_0x7d84('0x49')](handleError(_0x355e5d,null));};exports[_0x7d84('0x4f')]=function(_0x1c6583,_0x36a13d){return db['FaxTransferReport'][_0x7d84('0x4f')]()[_0x7d84('0x26')](respondWithResult(_0x36a13d,null))[_0x7d84('0x49')](handleError(_0x36a13d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2414e5e..ad08053 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 _0x69c3=['path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x12af70,_0x5e64be){var _0x87fca1=function(_0x136a83){while(--_0x136a83){_0x12af70['push'](_0x12af70['shift']());}};_0x87fca1(++_0x5e64be);}(_0x69c3,0xd3));var _0x369c=function(_0x43de6e,_0x1e9b02){_0x43de6e=_0x43de6e-0x0;var _0x761619=_0x69c3[_0x43de6e];return _0x761619;};'use strict';var _=require('lodash');var util=require(_0x369c('0x0'));var logger=require(_0x369c('0x1'))(_0x369c('0x2'));var moment=require(_0x369c('0x3'));var BPromise=require(_0x369c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x369c('0x5'));var rimraf=require('rimraf');var config=require(_0x369c('0x6'));var attributes=require(_0x369c('0x7'));module[_0x369c('0x8')]=function(_0x3a5a7b,_0x56d69c){return _0x3a5a7b[_0x369c('0x9')]('FaxTransferReport',attributes,{'tableName':_0x369c('0xa'),'paranoid':![],'indexes':[{'name':_0x369c('0xb'),'fields':[_0x369c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3166=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x1575e4,_0x305ef7){var _0x19e463=function(_0x1630fa){while(--_0x1630fa){_0x1575e4['push'](_0x1575e4['shift']());}};_0x19e463(++_0x305ef7);}(_0x3166,0x8f));var _0x6316=function(_0x39db22,_0x5b695f){_0x39db22=_0x39db22-0x0;var _0x20edaf=_0x3166[_0x39db22];return _0x20edaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6316('0x0'))(_0x6316('0x1'));var moment=require(_0x6316('0x2'));var BPromise=require(_0x6316('0x3'));var rp=require(_0x6316('0x4'));var fs=require('fs');var path=require(_0x6316('0x5'));var rimraf=require('rimraf');var config=require(_0x6316('0x6'));var attributes=require(_0x6316('0x7'));module[_0x6316('0x8')]=function(_0x454ee6,_0x591aba){return _0x454ee6[_0x6316('0x9')](_0x6316('0xa'),attributes,{'tableName':_0x6316('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6316('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1c0268f..9e639ab 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 _0x8d48=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','../../config/utils','rpc','../../config/environment','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20fdfb,_0x2e5a5d){var _0x23b4fb=function(_0x87a8e0){while(--_0x87a8e0){_0x20fdfb['push'](_0x20fdfb['shift']());}};_0x23b4fb(++_0x2e5a5d);}(_0x8d48,0x9c));var _0x88d4=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x8d48[_0x581af1];return _0x54c22e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88d4('0x0'));var BPromise=require('bluebird');var rs=require(_0x88d4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88d4('0x2'));var logger=require('../../config/logger')(_0x88d4('0x3'));var config=require(_0x88d4('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16eefe,_0x10f3f7,_0x2d4630){return new BPromise(function(_0x3f7686,_0x3e8d0b){return client['request'](_0x16eefe,_0x2d4630)['then'](function(_0x95fd2e){logger[_0x88d4('0x5')](_0x88d4('0x6'),_0x10f3f7,_0x88d4('0x7'));logger[_0x88d4('0x8')](_0x88d4('0x9'),_0x10f3f7,_0x88d4('0x7'),JSON[_0x88d4('0xa')](_0x95fd2e));if(_0x95fd2e[_0x88d4('0xb')]){if(_0x95fd2e['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x10f3f7,_0x95fd2e[_0x88d4('0xb')][_0x88d4('0xc')]);return _0x3e8d0b(_0x95fd2e[_0x88d4('0xb')][_0x88d4('0xc')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x10f3f7,_0x95fd2e[_0x88d4('0xb')]['message']);return _0x3f7686(_0x95fd2e[_0x88d4('0xb')][_0x88d4('0xc')]);}else{logger[_0x88d4('0x5')](_0x88d4('0x6'),_0x10f3f7,_0x88d4('0x7'));_0x3f7686(_0x95fd2e[_0x88d4('0xd')][_0x88d4('0xc')]);}})[_0x88d4('0xe')](function(_0x19b29a){logger['error'](_0x88d4('0x6'),_0x10f3f7,_0x19b29a);_0x3e8d0b(_0x19b29a);});});} \ No newline at end of file +var _0xeebe=['result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','FaxTransferReport,\x20%s,\x20%s'];(function(_0x105913,_0x4771de){var _0x57eed2=function(_0x44f237){while(--_0x44f237){_0x105913['push'](_0x105913['shift']());}};_0x57eed2(++_0x4771de);}(_0xeebe,0x121));var _0xeeeb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeebe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xeeeb('0x0'));var moment=require('moment');var BPromise=require(_0xeeeb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeeb('0x2'));var db=require(_0xeeeb('0x3'))['db'];var utils=require(_0xeeeb('0x4'));var logger=require(_0xeeeb('0x5'))(_0xeeeb('0x6'));var config=require(_0xeeeb('0x7'));var jayson=require(_0xeeeb('0x8'));var client=jayson[_0xeeeb('0x9')][_0xeeeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536eab,_0x54866e,_0x56b0d0){return new BPromise(function(_0x1fc40c,_0x35c178){return client['request'](_0x536eab,_0x56b0d0)['then'](function(_0x246969){logger[_0xeeeb('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x54866e,_0xeeeb('0xc'));logger['debug'](_0xeeeb('0xd'),_0x54866e,'request\x20sent',JSON['stringify'](_0x246969));if(_0x246969[_0xeeeb('0xe')]){if(_0x246969[_0xeeeb('0xe')]['code']===0x1f4){logger[_0xeeeb('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x54866e,_0x246969[_0xeeeb('0xe')]['message']);return _0x35c178(_0x246969[_0xeeeb('0xe')][_0xeeeb('0xf')]);}logger['error'](_0xeeeb('0x10'),_0x54866e,_0x246969[_0xeeeb('0xe')][_0xeeeb('0xf')]);return _0x1fc40c(_0x246969['error'][_0xeeeb('0xf')]);}else{logger[_0xeeeb('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x54866e,'request\x20sent');_0x1fc40c(_0x246969[_0xeeeb('0x11')][_0xeeeb('0xf')]);}})['catch'](function(_0x53e380){logger[_0xeeeb('0xe')](_0xeeeb('0x10'),_0x54866e,_0x53e380);_0x35c178(_0x53e380);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index acab7c4..f170c4f 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 _0x680a=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x5067ed,_0x46b64c){var _0x4cf3b0=function(_0x19108c){while(--_0x19108c){_0x5067ed['push'](_0x5067ed['shift']());}};_0x4cf3b0(++_0x46b64c);}(_0x680a,0x70));var _0xa680=function(_0x2e06f9,_0x2623bb){_0x2e06f9=_0x2e06f9-0x0;var _0x4e342b=_0x680a[_0x2e06f9];return _0x4e342b;};'use strict';var multer=require(_0xa680('0x0'));var util=require(_0xa680('0x1'));var path=require(_0xa680('0x2'));var timeout=require(_0xa680('0x3'));var express=require(_0xa680('0x4'));var router=express[_0xa680('0x5')]();var fs_extra=require(_0xa680('0x6'));var auth=require(_0xa680('0x7'));var interaction=require(_0xa680('0x8'));var config=require('../../config/environment');var controller=require(_0xa680('0x9'));router[_0xa680('0xa')]('/',auth[_0xa680('0xb')](),controller['index']);router[_0xa680('0xa')](_0xa680('0xc'),auth[_0xa680('0xb')](),controller[_0xa680('0xd')]);router[_0xa680('0xa')](_0xa680('0xe'),auth[_0xa680('0xb')](),controller[_0xa680('0xf')]);router[_0xa680('0x10')]('/',auth[_0xa680('0xb')](),controller['create']);router[_0xa680('0x11')](_0xa680('0xe'),auth['isAuthenticated'](),controller[_0xa680('0x12')]);router[_0xa680('0x13')](_0xa680('0xe'),auth[_0xa680('0xb')](),controller[_0xa680('0x14')]);module[_0xa680('0x15')]=router; \ No newline at end of file +var _0xd303=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x3f83db,_0x4606c2){var _0x55e771=function(_0x4600b1){while(--_0x4600b1){_0x3f83db['push'](_0x3f83db['shift']());}};_0x55e771(++_0x4606c2);}(_0xd303,0x158));var _0x3d30=function(_0x2a30e4,_0x5dc2b9){_0x2a30e4=_0x2a30e4-0x0;var _0x15e52d=_0xd303[_0x2a30e4];return _0x15e52d;};'use strict';var multer=require(_0x3d30('0x0'));var util=require(_0x3d30('0x1'));var path=require(_0x3d30('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d30('0x3'));var router=express[_0x3d30('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d30('0x5'));var interaction=require(_0x3d30('0x6'));var config=require('../../config/environment');var controller=require(_0x3d30('0x7'));router[_0x3d30('0x8')]('/',auth[_0x3d30('0x9')](),controller[_0x3d30('0xa')]);router[_0x3d30('0x8')]('/describe',auth[_0x3d30('0x9')](),controller['describe']);router[_0x3d30('0x8')](_0x3d30('0xb'),auth['isAuthenticated'](),controller[_0x3d30('0xc')]);router[_0x3d30('0xd')]('/',auth[_0x3d30('0x9')](),controller[_0x3d30('0xe')]);router[_0x3d30('0xf')](_0x3d30('0xb'),auth[_0x3d30('0x9')](),controller['update']);router[_0x3d30('0x10')](_0x3d30('0xb'),auth[_0x3d30('0x9')](),controller[_0x3d30('0x11')]);module[_0x3d30('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b07f77f..a11d661 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 _0x490b=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x539b64,_0x5ed361){var _0x3ad8e7=function(_0x42dd62){while(--_0x42dd62){_0x539b64['push'](_0x539b64['shift']());}};_0x3ad8e7(++_0x5ed361);}(_0x490b,0x9e));var _0xb490=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x490b[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0xb490('0x0'));var util=require(_0xb490('0x1'));var path=require('path');var timeout=require(_0xb490('0x2'));var express=require(_0xb490('0x3'));var router=express[_0xb490('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb490('0x5'));var config=require(_0xb490('0x6'));var controller=require('./intDeskAccount.controller');router[_0xb490('0x7')]('/',auth[_0xb490('0x8')](),controller[_0xb490('0x9')]);router[_0xb490('0x7')](_0xb490('0xa'),auth[_0xb490('0x8')](),controller[_0xb490('0xb')]);router[_0xb490('0x7')](_0xb490('0xc'),auth[_0xb490('0x8')](),controller[_0xb490('0xd')]);router['get']('/:id/fields',auth[_0xb490('0x8')](),controller[_0xb490('0xe')]);router[_0xb490('0xf')]('/',auth[_0xb490('0x8')](),controller[_0xb490('0x10')]);router[_0xb490('0xf')](_0xb490('0xc'),auth[_0xb490('0x8')](),controller[_0xb490('0x11')]);router[_0xb490('0x12')](_0xb490('0xa'),auth[_0xb490('0x8')](),controller[_0xb490('0x13')]);router[_0xb490('0x14')](_0xb490('0xa'),auth[_0xb490('0x8')](),controller[_0xb490('0x15')]);module[_0xb490('0x16')]=router; \ No newline at end of file +var _0x73f2=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x569bfb,_0x5a2070){var _0x176cb3=function(_0x56b9cd){while(--_0x56b9cd){_0x569bfb['push'](_0x569bfb['shift']());}};_0x176cb3(++_0x5a2070);}(_0x73f2,0xca));var _0x273f=function(_0x50444d,_0x284091){_0x50444d=_0x50444d-0x0;var _0x1107ea=_0x73f2[_0x50444d];return _0x1107ea;};'use strict';var multer=require('multer');var util=require(_0x273f('0x0'));var path=require(_0x273f('0x1'));var timeout=require(_0x273f('0x2'));var express=require('express');var router=express[_0x273f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x273f('0x4'));var interaction=require(_0x273f('0x5'));var config=require(_0x273f('0x6'));var controller=require(_0x273f('0x7'));router[_0x273f('0x8')]('/',auth[_0x273f('0x9')](),controller[_0x273f('0xa')]);router[_0x273f('0x8')](_0x273f('0xb'),auth[_0x273f('0x9')](),controller[_0x273f('0xc')]);router['get'](_0x273f('0xd'),auth[_0x273f('0x9')](),controller['getConfigurations']);router[_0x273f('0x8')](_0x273f('0xe'),auth[_0x273f('0x9')](),controller[_0x273f('0xf')]);router[_0x273f('0x10')]('/',auth[_0x273f('0x9')](),controller[_0x273f('0x11')]);router[_0x273f('0x10')](_0x273f('0xd'),auth[_0x273f('0x9')](),controller[_0x273f('0x12')]);router[_0x273f('0x13')](_0x273f('0xb'),auth[_0x273f('0x9')](),controller[_0x273f('0x14')]);router[_0x273f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x273f('0x16')]);module[_0x273f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 44990bd..c9de37f 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 _0xef1e=['STRING','ENUM','basic','newTab','sequelize','exports'];(function(_0x140c0b,_0x47d5d6){var _0x444a31=function(_0x3954eb){while(--_0x3954eb){_0x140c0b['push'](_0x140c0b['shift']());}};_0x444a31(++_0x47d5d6);}(_0xef1e,0x19c));var _0xeef1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef1e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xeef1('0x0'));module[_0xeef1('0x1')]={'name':{'type':Sequelize[_0xeef1('0x2')]},'description':{'type':Sequelize[_0xeef1('0x2')]},'username':{'type':Sequelize[_0xeef1('0x2')]},'remoteUri':{'type':Sequelize[_0xeef1('0x2')]},'authType':{'type':Sequelize[_0xeef1('0x3')](_0xeef1('0x4')),'defaultValue':_0xeef1('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xeef1('0x2')]},'consumerSecret':{'type':Sequelize[_0xeef1('0x2')]},'token':{'type':Sequelize[_0xeef1('0x2')]},'tokenSecret':{'type':Sequelize[_0xeef1('0x2')]},'serverUrl':{'type':Sequelize[_0xeef1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeef1('0x3')]('integrationTab',_0xeef1('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7d01=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x6c500f,_0x2290ed){var _0x4b627b=function(_0x30e8a3){while(--_0x30e8a3){_0x6c500f['push'](_0x6c500f['shift']());}};_0x4b627b(++_0x2290ed);}(_0x7d01,0x186));var _0x17d0=function(_0x150a53,_0x1a1bbe){_0x150a53=_0x150a53-0x0;var _0x1fafee=_0x7d01[_0x150a53];return _0x1fafee;};'use strict';var Sequelize=require(_0x17d0('0x0'));module[_0x17d0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x17d0('0x2')]},'username':{'type':Sequelize[_0x17d0('0x2')]},'remoteUri':{'type':Sequelize[_0x17d0('0x2')]},'authType':{'type':Sequelize[_0x17d0('0x3')](_0x17d0('0x4')),'defaultValue':_0x17d0('0x4')},'password':{'type':Sequelize[_0x17d0('0x2')]},'consumerKey':{'type':Sequelize[_0x17d0('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x17d0('0x2')]},'tokenSecret':{'type':Sequelize[_0x17d0('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x17d0('0x5')),'defaultValue':_0x17d0('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b4b377f..b4935b7 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 _0xbe1c=['end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','include','find','create','body','params','destroy','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','channel','DeskField','Descriptions','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x369bf0,_0x144619){var _0x40ae8b=function(_0x5caf6d){while(--_0x5caf6d){_0x369bf0['push'](_0x369bf0['shift']());}};_0x40ae8b(++_0x144619);}(_0xbe1c,0x13c));var _0xcbe1=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0xbe1c[_0x25d6ce];return _0x1aef15;};'use strict';var emlformat=require(_0xcbe1('0x0'));var rimraf=require(_0xcbe1('0x1'));var zipdir=require(_0xcbe1('0x2'));var jsonpatch=require(_0xcbe1('0x3'));var rp=require(_0xcbe1('0x4'));var moment=require(_0xcbe1('0x5'));var BPromise=require(_0xcbe1('0x6'));var Mustache=require(_0xcbe1('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcbe1('0x8'));var csv=require(_0xcbe1('0x9'));var ejs=require(_0xcbe1('0xa'));var fs=require('fs');var fs_extra=require(_0xcbe1('0xb'));var _=require(_0xcbe1('0xc'));var squel=require(_0xcbe1('0xd'));var crypto=require(_0xcbe1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcbe1('0xf'));var toCsv=require(_0xcbe1('0x9'));var querystring=require('querystring');var Papa=require(_0xcbe1('0x10'));var Redis=require(_0xcbe1('0x11'));var authService=require(_0xcbe1('0x12'));var qs=require(_0xcbe1('0x13'));var as=require(_0xcbe1('0x14'));var hardwareService=require(_0xcbe1('0x15'));var logger=require('../../config/logger')(_0xcbe1('0x16'));var utils=require(_0xcbe1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcbe1('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5aeccc,_0x48c247){_0x48c247=_0x48c247||0xcc;return function(_0x16fb1c){if(_0x16fb1c){return _0x5aeccc[_0xcbe1('0x19')](_0x48c247);}return _0x5aeccc['status'](_0x48c247)[_0xcbe1('0x1a')]();};}function respondWithResult(_0x3b54e8,_0x2291b8){_0x2291b8=_0x2291b8||0xc8;return function(_0x518b80){if(_0x518b80){return _0x3b54e8[_0xcbe1('0x1b')](_0x2291b8)[_0xcbe1('0x1c')](_0x518b80);}};}function respondWithFilteredResult(_0x37ca79,_0x37ead4){return function(_0x33b020){if(_0x33b020){var _0x33f1f7=typeof _0x37ead4['offset']===_0xcbe1('0x1d')&&typeof _0x37ead4[_0xcbe1('0x1e')]===_0xcbe1('0x1d');var _0x58b077=_0x33b020[_0xcbe1('0x1f')];var _0x43b055=_0x33f1f7?0x0:_0x37ead4[_0xcbe1('0x20')];var _0x58e9d0=_0x33f1f7?_0x33b020['count']:_0x37ead4[_0xcbe1('0x20')]+_0x37ead4[_0xcbe1('0x1e')];var _0x5046ab;if(_0x58e9d0>=_0x58b077){_0x58e9d0=_0x58b077;_0x5046ab=0xc8;}else{_0x5046ab=0xce;}_0x37ca79[_0xcbe1('0x1b')](_0x5046ab);return _0x37ca79[_0xcbe1('0x21')](_0xcbe1('0x22'),_0x43b055+'-'+_0x58e9d0+'/'+_0x58b077)[_0xcbe1('0x1c')](_0x33b020);}return null;};}function patchUpdates(_0x3efa74){return function(_0x5d8299){try{jsonpatch['apply'](_0x5d8299,_0x3efa74,!![]);}catch(_0x4a9cf0){return BPromise[_0xcbe1('0x23')](_0x4a9cf0);}return _0x5d8299['save']();};}function saveUpdates(_0x38dcab,_0x5139ca){return function(_0x4577c7){if(_0x4577c7){return _0x4577c7[_0xcbe1('0x24')](_0x38dcab)[_0xcbe1('0x25')](function(_0x1a1513){return _0x1a1513;});}return null;};}function removeEntity(_0x552a86,_0xd790ce){return function(_0x169cca){if(_0x169cca){return _0x169cca['destroy']()[_0xcbe1('0x25')](function(){_0x552a86['status'](0xcc)[_0xcbe1('0x1a')]();});}};}function handleEntityNotFound(_0x4c3dcf,_0x4742e2){return function(_0xfdb35){if(!_0xfdb35){_0x4c3dcf[_0xcbe1('0x19')](0x194);}return _0xfdb35;};}function handleError(_0x5d922f,_0x7dce40){_0x7dce40=_0x7dce40||0x1f4;return function(_0x49a139){logger[_0xcbe1('0x26')](_0x49a139[_0xcbe1('0x27')]);if(_0x49a139[_0xcbe1('0x28')]){delete _0x49a139[_0xcbe1('0x28')];}_0x5d922f[_0xcbe1('0x1b')](_0x7dce40)[_0xcbe1('0x29')](_0x49a139);};}exports[_0xcbe1('0x2a')]=function(_0x346f7b,_0x2f90c5){var _0x11997c={},_0x1a3626={},_0x178dff={'count':0x0,'rows':[]};var _0x3a8b42=_[_0xcbe1('0x2b')](db[_0xcbe1('0x2c')][_0xcbe1('0x2d')],function(_0x5df9ca){return{'name':_0x5df9ca[_0xcbe1('0x2e')],'type':_0x5df9ca[_0xcbe1('0x2f')][_0xcbe1('0x30')]};});_0x1a3626['model']=_[_0xcbe1('0x2b')](_0x3a8b42,_0xcbe1('0x28'));_0x1a3626[_0xcbe1('0x31')]=_[_0xcbe1('0x32')](_0x346f7b[_0xcbe1('0x31')]);_0x1a3626[_0xcbe1('0x33')]=_[_0xcbe1('0x34')](_0x1a3626[_0xcbe1('0x35')],_0x1a3626['query']);_0x11997c[_0xcbe1('0x36')]=_[_0xcbe1('0x34')](_0x1a3626[_0xcbe1('0x35')],qs[_0xcbe1('0x37')](_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x37')]));_0x11997c[_0xcbe1('0x36')]=_0x11997c[_0xcbe1('0x36')][_0xcbe1('0x38')]?_0x11997c[_0xcbe1('0x36')]:_0x1a3626[_0xcbe1('0x35')];if(!_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x39')](_0xcbe1('0x3a'))){_0x11997c[_0xcbe1('0x1e')]=qs[_0xcbe1('0x1e')](_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x1e')]);_0x11997c[_0xcbe1('0x20')]=qs[_0xcbe1('0x20')](_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x20')]);}_0x11997c['order']=qs[_0xcbe1('0x3b')](_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x3b')]);_0x11997c['where']=qs[_0xcbe1('0x33')](_[_0xcbe1('0x3c')](_0x346f7b[_0xcbe1('0x31')],_0x1a3626[_0xcbe1('0x33')]),_0x3a8b42);if(_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x3d')]){_0x11997c['where']=_['merge'](_0x11997c[_0xcbe1('0x3e')],{'$or':_[_0xcbe1('0x2b')](_0x3a8b42,function(_0x5655ee){if(_0x5655ee['type']!==_0xcbe1('0x3f')){var _0x657ec9={};_0x657ec9[_0x5655ee['name']]={'$like':'%'+_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x3d')]+'%'};return _0x657ec9;}})});}_0x11997c=_[_0xcbe1('0x40')]({},_0x11997c,_0x346f7b[_0xcbe1('0x41')]);var _0x28aa6f={'where':_0x11997c[_0xcbe1('0x3e')]};return db[_0xcbe1('0x2c')][_0xcbe1('0x1f')](_0x28aa6f)[_0xcbe1('0x25')](function(_0x59e23e){_0x178dff[_0xcbe1('0x1f')]=_0x59e23e;if(_0x346f7b[_0xcbe1('0x31')][_0xcbe1('0x42')]){_0x11997c['include']=[{'all':!![]}];}return db['DeskAccount'][_0xcbe1('0x43')](_0x11997c);})[_0xcbe1('0x25')](function(_0x5008d9){_0x178dff['rows']=_0x5008d9;return _0x178dff;})[_0xcbe1('0x25')](respondWithFilteredResult(_0x2f90c5,_0x11997c))[_0xcbe1('0x44')](handleError(_0x2f90c5,null));};exports[_0xcbe1('0x45')]=function(_0x5b4773,_0x358f1d){var _0x59aaf6={'raw':![],'where':{'id':_0x5b4773['params']['id']}},_0x4741cd={};_0x4741cd['model']=_[_0xcbe1('0x32')](db[_0xcbe1('0x2c')]['rawAttributes']);_0x4741cd['query']=_[_0xcbe1('0x32')](_0x5b4773[_0xcbe1('0x31')]);_0x4741cd[_0xcbe1('0x33')]=_['intersection'](_0x4741cd[_0xcbe1('0x35')],_0x4741cd[_0xcbe1('0x31')]);_0x59aaf6['attributes']=_[_0xcbe1('0x34')](_0x4741cd[_0xcbe1('0x35')],qs[_0xcbe1('0x37')](_0x5b4773[_0xcbe1('0x31')][_0xcbe1('0x37')]));_0x59aaf6[_0xcbe1('0x36')]=_0x59aaf6['attributes'][_0xcbe1('0x38')]?_0x59aaf6['attributes']:_0x4741cd[_0xcbe1('0x35')];if(_0x5b4773['query']['includeAll']){_0x59aaf6[_0xcbe1('0x46')]=[{'all':!![]}];}_0x59aaf6=_[_0xcbe1('0x40')]({},_0x59aaf6,_0x5b4773[_0xcbe1('0x41')]);return db[_0xcbe1('0x2c')][_0xcbe1('0x47')](_0x59aaf6)[_0xcbe1('0x25')](handleEntityNotFound(_0x358f1d,null))['then'](respondWithResult(_0x358f1d,null))['catch'](handleError(_0x358f1d,null));};exports[_0xcbe1('0x48')]=function(_0x18cf2e,_0x52aad5){return db['DeskAccount'][_0xcbe1('0x48')](_0x18cf2e[_0xcbe1('0x49')],{})[_0xcbe1('0x25')](respondWithResult(_0x52aad5,0xc9))[_0xcbe1('0x44')](handleError(_0x52aad5,null));};exports[_0xcbe1('0x24')]=function(_0xe861ae,_0x7649cb){if(_0xe861ae[_0xcbe1('0x49')]['id']){delete _0xe861ae[_0xcbe1('0x49')]['id'];}return db[_0xcbe1('0x2c')]['find']({'where':{'id':_0xe861ae[_0xcbe1('0x4a')]['id']}})[_0xcbe1('0x25')](handleEntityNotFound(_0x7649cb,null))[_0xcbe1('0x25')](saveUpdates(_0xe861ae[_0xcbe1('0x49')],null))['then'](respondWithResult(_0x7649cb,null))[_0xcbe1('0x44')](handleError(_0x7649cb,null));};exports[_0xcbe1('0x4b')]=function(_0x39ce15,_0x12e953){return db[_0xcbe1('0x2c')]['find']({'where':{'id':_0x39ce15[_0xcbe1('0x4a')]['id']}})[_0xcbe1('0x25')](handleEntityNotFound(_0x12e953,null))['then'](removeEntity(_0x12e953,null))[_0xcbe1('0x44')](handleError(_0x12e953,null));};exports['getConfigurations']=function(_0x419b9e,_0x5bdf66,_0x288f58){var _0x5ad4c6={};var _0x64c20e={};var _0x4c2f01;var _0x1a882d;return db['DeskAccount'][_0xcbe1('0x4c')]({'where':{'id':_0x419b9e[_0xcbe1('0x4a')]['id']}})[_0xcbe1('0x25')](handleEntityNotFound(_0x5bdf66,null))[_0xcbe1('0x25')](function(_0x9495d7){if(_0x9495d7){_0x4c2f01=_0x9495d7;_0x64c20e[_0xcbe1('0x35')]=_[_0xcbe1('0x32')](db[_0xcbe1('0x4d')][_0xcbe1('0x2d')]);_0x64c20e[_0xcbe1('0x31')]=_[_0xcbe1('0x32')](_0x419b9e[_0xcbe1('0x31')]);_0x64c20e[_0xcbe1('0x33')]=_['intersection'](_0x64c20e[_0xcbe1('0x35')],_0x64c20e[_0xcbe1('0x31')]);_0x5ad4c6[_0xcbe1('0x36')]=_['intersection'](_0x64c20e[_0xcbe1('0x35')],qs['fields'](_0x419b9e[_0xcbe1('0x31')]['fields']));_0x5ad4c6[_0xcbe1('0x36')]=_0x5ad4c6['attributes'][_0xcbe1('0x38')]?_0x5ad4c6[_0xcbe1('0x36')]:_0x64c20e['model'];_0x5ad4c6['order']=qs[_0xcbe1('0x3b')](_0x419b9e[_0xcbe1('0x31')][_0xcbe1('0x3b')]);_0x5ad4c6[_0xcbe1('0x3e')]=qs[_0xcbe1('0x33')](_[_0xcbe1('0x3c')](_0x419b9e[_0xcbe1('0x31')],_0x64c20e['filters']));if(_0x419b9e[_0xcbe1('0x31')]['filter']){_0x5ad4c6['where']=_[_0xcbe1('0x40')](_0x5ad4c6[_0xcbe1('0x3e')],{'$or':_[_0xcbe1('0x2b')](_0x5ad4c6[_0xcbe1('0x36')],function(_0x52b878){var _0x2e88c4={};_0x2e88c4[_0x52b878]={'$like':'%'+_0x419b9e[_0xcbe1('0x31')][_0xcbe1('0x3d')]+'%'};return _0x2e88c4;})});}_0x5ad4c6=_['merge']({},_0x5ad4c6,_0x419b9e[_0xcbe1('0x41')]);return _0x4c2f01[_0xcbe1('0x4e')](_0x5ad4c6);}})[_0xcbe1('0x25')](function(_0x467341){if(_0x467341){_0x1a882d=_0x467341['length'];if(!_0x419b9e['query'][_0xcbe1('0x39')](_0xcbe1('0x3a'))){_0x5ad4c6[_0xcbe1('0x1e')]=qs[_0xcbe1('0x1e')](_0x419b9e[_0xcbe1('0x31')]['limit']);_0x5ad4c6[_0xcbe1('0x20')]=qs[_0xcbe1('0x20')](_0x419b9e['query']['offset']);}return _0x4c2f01[_0xcbe1('0x4e')](_0x5ad4c6);}})[_0xcbe1('0x25')](function(_0x323074){if(_0x323074){return _0x323074?{'count':_0x1a882d,'rows':_0x323074}:null;}})['then'](respondWithResult(_0x5bdf66,null))[_0xcbe1('0x44')](handleError(_0x5bdf66,null));};exports[_0xcbe1('0x4f')]=function(_0x344be1,_0x318d57,_0x3d2fe2){if(_0x344be1[_0xcbe1('0x49')]['id']){delete _0x344be1[_0xcbe1('0x49')]['id'];}return db[_0xcbe1('0x2c')]['findOne']({'where':{'id':_0x344be1['params']['id']}})[_0xcbe1('0x25')](handleEntityNotFound(_0x318d57,null))[_0xcbe1('0x25')](function(_0x4edbbf){if(_0x4edbbf){_0x344be1['body'][_0xcbe1('0x50')]=_0x4edbbf['id'];_0x344be1['body'][_0xcbe1('0x51')]=integrations['getSubjects'](_0x344be1[_0xcbe1('0x49')]['channel'],_0x344be1[_0xcbe1('0x49')]['type']);_0x344be1['body']['Descriptions']=integrations[_0xcbe1('0x52')](_0x344be1[_0xcbe1('0x49')][_0xcbe1('0x53')],_0x344be1[_0xcbe1('0x49')][_0xcbe1('0x2f')]);return db[_0xcbe1('0x4d')][_0xcbe1('0x48')](_0x344be1[_0xcbe1('0x49')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xcbe1('0x54')],'as':_0xcbe1('0x55')}]});}return null;})[_0xcbe1('0x25')](respondWithResult(_0x318d57,null))[_0xcbe1('0x44')](handleError(_0x318d57,null));};exports['getFields']=function(_0x3123ed,_0x104a6f,_0x29f713){var _0x421eff=[{'name':_0xcbe1('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4ce53e='';return db[_0xcbe1('0x2c')]['findOne']({'where':{'id':_0x3123ed[_0xcbe1('0x4a')]['id']},'attributes':['id',_0xcbe1('0x57'),_0xcbe1('0x58'),_0xcbe1('0x59'),'password','consumerKey',_0xcbe1('0x5a'),_0xcbe1('0x5b'),_0xcbe1('0x5c')]})[_0xcbe1('0x25')](handleEntityNotFound(_0x104a6f,null))[_0xcbe1('0x25')](function(_0x3db8ea){if(_0x3db8ea){_0x4ce53e=_0x3db8ea[_0xcbe1('0x57')];var _0x78947d=_0x4ce53e[_0xcbe1('0x5d')](-0x1);if(_0x78947d==='/'){_0x4ce53e=_0x4ce53e['substring'](0x0,_0x4ce53e['lastIndexOf'](_0x78947d));}var _0x833a97={'method':_0xcbe1('0x5e'),'uri':util[_0xcbe1('0x5f')](_0xcbe1('0x60'),_0x4ce53e),'headers':{'Content-Type':_0xcbe1('0x61'),'Accept':_0xcbe1('0x61')},'json':!![]};if(_0x3db8ea[_0xcbe1('0x58')]===_0xcbe1('0x62')){_0x833a97[_0xcbe1('0x63')][_0xcbe1('0x64')]=util[_0xcbe1('0x5f')]('Basic\x20%s',new Buffer(util['format'](_0xcbe1('0x65'),_0x3db8ea[_0xcbe1('0x59')],_0x3db8ea['password']))[_0xcbe1('0x66')](_0xcbe1('0x67')));}return rp(_0x833a97)[_0xcbe1('0x25')](function(_0x20e778){return _0x421eff[_0xcbe1('0x68')](_[_0xcbe1('0x2b')](_0x20e778[_0xcbe1('0x69')]['entries'],function(_0x560b18){return{'id':_0x560b18[_0xcbe1('0x28')],'name':_0x560b18[_0xcbe1('0x28')],'type':_0x560b18['type'],'active':_0x560b18[_0xcbe1('0x6a')],'label':_0x560b18[_0xcbe1('0x6b')],'custom':!![]};}));});}})[_0xcbe1('0x25')](function(_0x2dac41){return{'count':_0x2dac41['length'],'rows':_0x2dac41};})[_0xcbe1('0x25')](respondWithResult(_0x104a6f,null))[_0xcbe1('0x44')](function(_0x3a2451){var _0x2c6772=_0x3123ed['query'][_0xcbe1('0x6c')]?0x1f4:_0x3a2451[_0xcbe1('0x6d')]||0x1f4;logger[_0xcbe1('0x26')](_0xcbe1('0x6e'),_0xcbe1('0x6f'),_0x2c6772,JSON[_0xcbe1('0x70')](_0x3a2451));delete _0x3a2451[_0xcbe1('0x28')];if(_0x2c6772===0x191){_0x2c6772=0x190;}_0x104a6f[_0xcbe1('0x1b')](_0x2c6772)[_0xcbe1('0x29')](_0x3123ed[_0xcbe1('0x31')]['test']?{'message':_0xcbe1('0x71'),'statusCode':_0x3a2451[_0xcbe1('0x6d')]}:_0x3a2451);});}; \ No newline at end of file +var _0x3f5b=['filter','merge','VIRTUAL','include','rows','catch','show','params','fields','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','pick','options','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','Authorization','toString','base64','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','apply','save','then','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x481028,_0xf09e2b){var _0x221731=function(_0x17e57c){while(--_0x17e57c){_0x481028['push'](_0x481028['shift']());}};_0x221731(++_0xf09e2b);}(_0x3f5b,0x10b));var _0xb3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb3f5('0x0'));var rimraf=require(_0xb3f5('0x1'));var zipdir=require(_0xb3f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3f5('0x3'));var BPromise=require(_0xb3f5('0x4'));var Mustache=require(_0xb3f5('0x5'));var util=require('util');var path=require(_0xb3f5('0x6'));var sox=require(_0xb3f5('0x7'));var csv=require('to-csv');var ejs=require(_0xb3f5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb3f5('0x9'));var toCsv=require(_0xb3f5('0xa'));var querystring=require(_0xb3f5('0xb'));var Papa=require(_0xb3f5('0xc'));var Redis=require(_0xb3f5('0xd'));var authService=require(_0xb3f5('0xe'));var qs=require(_0xb3f5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3f5('0x10'))(_0xb3f5('0x11'));var utils=require(_0xb3f5('0x12'));var config=require(_0xb3f5('0x13'));var licenseUtil=require(_0xb3f5('0x14'));var db=require(_0xb3f5('0x15'))['db'];var integrations=require(_0xb3f5('0x16'));function respondWithStatusCode(_0x3ee47e,_0x4db37a){_0x4db37a=_0x4db37a||0xcc;return function(_0x1da6c3){if(_0x1da6c3){return _0x3ee47e['sendStatus'](_0x4db37a);}return _0x3ee47e[_0xb3f5('0x17')](_0x4db37a)[_0xb3f5('0x18')]();};}function respondWithResult(_0x291638,_0x225959){_0x225959=_0x225959||0xc8;return function(_0x3b7d35){if(_0x3b7d35){return _0x291638[_0xb3f5('0x17')](_0x225959)[_0xb3f5('0x19')](_0x3b7d35);}};}function respondWithFilteredResult(_0x1c0d7f,_0x5ec7b6){return function(_0x480e09){if(_0x480e09){var _0x33b4f8=typeof _0x5ec7b6[_0xb3f5('0x1a')]==='undefined'&&typeof _0x5ec7b6[_0xb3f5('0x1b')]===_0xb3f5('0x1c');var _0x3ed5bf=_0x480e09[_0xb3f5('0x1d')];var _0xe0ffc6=_0x33b4f8?0x0:_0x5ec7b6[_0xb3f5('0x1a')];var _0x3a3d6d=_0x33b4f8?_0x480e09[_0xb3f5('0x1d')]:_0x5ec7b6[_0xb3f5('0x1a')]+_0x5ec7b6[_0xb3f5('0x1b')];var _0x2f2bcf;if(_0x3a3d6d>=_0x3ed5bf){_0x3a3d6d=_0x3ed5bf;_0x2f2bcf=0xc8;}else{_0x2f2bcf=0xce;}_0x1c0d7f[_0xb3f5('0x17')](_0x2f2bcf);return _0x1c0d7f['set']('Content-Range',_0xe0ffc6+'-'+_0x3a3d6d+'/'+_0x3ed5bf)[_0xb3f5('0x19')](_0x480e09);}return null;};}function patchUpdates(_0xc3df46){return function(_0x151b32){try{jsonpatch[_0xb3f5('0x1e')](_0x151b32,_0xc3df46,!![]);}catch(_0x38e5fe){return BPromise['reject'](_0x38e5fe);}return _0x151b32[_0xb3f5('0x1f')]();};}function saveUpdates(_0x5e903c,_0x41de5b){return function(_0xab16a2){if(_0xab16a2){return _0xab16a2['update'](_0x5e903c)[_0xb3f5('0x20')](function(_0x331a94){return _0x331a94;});}return null;};}function removeEntity(_0x7bf85a,_0x1f3730){return function(_0x2c59f6){if(_0x2c59f6){return _0x2c59f6['destroy']()[_0xb3f5('0x20')](function(){_0x7bf85a[_0xb3f5('0x17')](0xcc)[_0xb3f5('0x18')]();});}};}function handleEntityNotFound(_0xe70f43,_0xe92354){return function(_0x345f2c){if(!_0x345f2c){_0xe70f43[_0xb3f5('0x21')](0x194);}return _0x345f2c;};}function handleError(_0x2dd526,_0x2151f9){_0x2151f9=_0x2151f9||0x1f4;return function(_0x1aa8af){logger[_0xb3f5('0x22')](_0x1aa8af[_0xb3f5('0x23')]);if(_0x1aa8af[_0xb3f5('0x24')]){delete _0x1aa8af[_0xb3f5('0x24')];}_0x2dd526[_0xb3f5('0x17')](_0x2151f9)[_0xb3f5('0x25')](_0x1aa8af);};}exports[_0xb3f5('0x26')]=function(_0x5ed462,_0x5c264a){var _0x1ef77a={},_0x1485ab={},_0x1aedd5={'count':0x0,'rows':[]};var _0x9671de=_[_0xb3f5('0x27')](db[_0xb3f5('0x28')][_0xb3f5('0x29')],function(_0x4ad53b){return{'name':_0x4ad53b[_0xb3f5('0x2a')],'type':_0x4ad53b[_0xb3f5('0x2b')][_0xb3f5('0x2c')]};});_0x1485ab[_0xb3f5('0x2d')]=_[_0xb3f5('0x27')](_0x9671de,_0xb3f5('0x24'));_0x1485ab[_0xb3f5('0x2e')]=_[_0xb3f5('0x2f')](_0x5ed462[_0xb3f5('0x2e')]);_0x1485ab[_0xb3f5('0x30')]=_['intersection'](_0x1485ab['model'],_0x1485ab[_0xb3f5('0x2e')]);_0x1ef77a[_0xb3f5('0x31')]=_[_0xb3f5('0x32')](_0x1485ab['model'],qs['fields'](_0x5ed462[_0xb3f5('0x2e')]['fields']));_0x1ef77a[_0xb3f5('0x31')]=_0x1ef77a[_0xb3f5('0x31')][_0xb3f5('0x33')]?_0x1ef77a[_0xb3f5('0x31')]:_0x1485ab['model'];if(!_0x5ed462[_0xb3f5('0x2e')][_0xb3f5('0x34')](_0xb3f5('0x35'))){_0x1ef77a[_0xb3f5('0x1b')]=qs[_0xb3f5('0x1b')](_0x5ed462['query'][_0xb3f5('0x1b')]);_0x1ef77a[_0xb3f5('0x1a')]=qs[_0xb3f5('0x1a')](_0x5ed462[_0xb3f5('0x2e')]['offset']);}_0x1ef77a[_0xb3f5('0x36')]=qs[_0xb3f5('0x37')](_0x5ed462['query']['sort']);_0x1ef77a[_0xb3f5('0x38')]=qs[_0xb3f5('0x30')](_['pick'](_0x5ed462['query'],_0x1485ab[_0xb3f5('0x30')]),_0x9671de);if(_0x5ed462[_0xb3f5('0x2e')][_0xb3f5('0x39')]){_0x1ef77a[_0xb3f5('0x38')]=_[_0xb3f5('0x3a')](_0x1ef77a['where'],{'$or':_['map'](_0x9671de,function(_0x38ba8c){if(_0x38ba8c[_0xb3f5('0x2b')]!==_0xb3f5('0x3b')){var _0x8936b7={};_0x8936b7[_0x38ba8c['name']]={'$like':'%'+_0x5ed462[_0xb3f5('0x2e')]['filter']+'%'};return _0x8936b7;}})});}_0x1ef77a=_[_0xb3f5('0x3a')]({},_0x1ef77a,_0x5ed462['options']);var _0x7efac2={'where':_0x1ef77a[_0xb3f5('0x38')]};return db['DeskAccount'][_0xb3f5('0x1d')](_0x7efac2)[_0xb3f5('0x20')](function(_0x1a87ea){_0x1aedd5[_0xb3f5('0x1d')]=_0x1a87ea;if(_0x5ed462[_0xb3f5('0x2e')]['includeAll']){_0x1ef77a[_0xb3f5('0x3c')]=[{'all':!![]}];}return db[_0xb3f5('0x28')]['findAll'](_0x1ef77a);})[_0xb3f5('0x20')](function(_0x30d6a9){_0x1aedd5[_0xb3f5('0x3d')]=_0x30d6a9;return _0x1aedd5;})[_0xb3f5('0x20')](respondWithFilteredResult(_0x5c264a,_0x1ef77a))[_0xb3f5('0x3e')](handleError(_0x5c264a,null));};exports[_0xb3f5('0x3f')]=function(_0x4a0818,_0x211108){var _0x1adeb5={'raw':![],'where':{'id':_0x4a0818[_0xb3f5('0x40')]['id']}},_0x206c93={};_0x206c93[_0xb3f5('0x2d')]=_[_0xb3f5('0x2f')](db['DeskAccount'][_0xb3f5('0x29')]);_0x206c93['query']=_['keys'](_0x4a0818[_0xb3f5('0x2e')]);_0x206c93[_0xb3f5('0x30')]=_['intersection'](_0x206c93['model'],_0x206c93[_0xb3f5('0x2e')]);_0x1adeb5[_0xb3f5('0x31')]=_['intersection'](_0x206c93[_0xb3f5('0x2d')],qs[_0xb3f5('0x41')](_0x4a0818['query'][_0xb3f5('0x41')]));_0x1adeb5[_0xb3f5('0x31')]=_0x1adeb5['attributes'][_0xb3f5('0x33')]?_0x1adeb5[_0xb3f5('0x31')]:_0x206c93['model'];if(_0x4a0818[_0xb3f5('0x2e')]['includeAll']){_0x1adeb5[_0xb3f5('0x3c')]=[{'all':!![]}];}_0x1adeb5=_[_0xb3f5('0x3a')]({},_0x1adeb5,_0x4a0818['options']);return db['DeskAccount'][_0xb3f5('0x42')](_0x1adeb5)[_0xb3f5('0x20')](handleEntityNotFound(_0x211108,null))[_0xb3f5('0x20')](respondWithResult(_0x211108,null))['catch'](handleError(_0x211108,null));};exports[_0xb3f5('0x43')]=function(_0xe5430,_0xa31583){return db[_0xb3f5('0x28')]['create'](_0xe5430[_0xb3f5('0x44')],{})[_0xb3f5('0x20')](respondWithResult(_0xa31583,0xc9))[_0xb3f5('0x3e')](handleError(_0xa31583,null));};exports['update']=function(_0x227b24,_0xc75de9){if(_0x227b24[_0xb3f5('0x44')]['id']){delete _0x227b24[_0xb3f5('0x44')]['id'];}return db[_0xb3f5('0x28')]['find']({'where':{'id':_0x227b24[_0xb3f5('0x40')]['id']}})[_0xb3f5('0x20')](handleEntityNotFound(_0xc75de9,null))[_0xb3f5('0x20')](saveUpdates(_0x227b24[_0xb3f5('0x44')],null))[_0xb3f5('0x20')](respondWithResult(_0xc75de9,null))['catch'](handleError(_0xc75de9,null));};exports[_0xb3f5('0x45')]=function(_0x49949e,_0x5b1d41){return db['DeskAccount'][_0xb3f5('0x42')]({'where':{'id':_0x49949e[_0xb3f5('0x40')]['id']}})[_0xb3f5('0x20')](handleEntityNotFound(_0x5b1d41,null))[_0xb3f5('0x20')](removeEntity(_0x5b1d41,null))[_0xb3f5('0x3e')](handleError(_0x5b1d41,null));};exports[_0xb3f5('0x46')]=function(_0x3fadc1,_0xf38305,_0x3affbd){var _0x30db61={};var _0x58f928={};var _0x39c191;var _0x2137e7;return db[_0xb3f5('0x28')][_0xb3f5('0x47')]({'where':{'id':_0x3fadc1[_0xb3f5('0x40')]['id']}})['then'](handleEntityNotFound(_0xf38305,null))[_0xb3f5('0x20')](function(_0x595225){if(_0x595225){_0x39c191=_0x595225;_0x58f928[_0xb3f5('0x2d')]=_[_0xb3f5('0x2f')](db[_0xb3f5('0x48')][_0xb3f5('0x29')]);_0x58f928[_0xb3f5('0x2e')]=_[_0xb3f5('0x2f')](_0x3fadc1[_0xb3f5('0x2e')]);_0x58f928[_0xb3f5('0x30')]=_[_0xb3f5('0x32')](_0x58f928['model'],_0x58f928[_0xb3f5('0x2e')]);_0x30db61['attributes']=_[_0xb3f5('0x32')](_0x58f928[_0xb3f5('0x2d')],qs[_0xb3f5('0x41')](_0x3fadc1[_0xb3f5('0x2e')][_0xb3f5('0x41')]));_0x30db61[_0xb3f5('0x31')]=_0x30db61[_0xb3f5('0x31')][_0xb3f5('0x33')]?_0x30db61[_0xb3f5('0x31')]:_0x58f928[_0xb3f5('0x2d')];_0x30db61[_0xb3f5('0x36')]=qs['sort'](_0x3fadc1[_0xb3f5('0x2e')][_0xb3f5('0x37')]);_0x30db61['where']=qs[_0xb3f5('0x30')](_[_0xb3f5('0x49')](_0x3fadc1[_0xb3f5('0x2e')],_0x58f928[_0xb3f5('0x30')]));if(_0x3fadc1['query'][_0xb3f5('0x39')]){_0x30db61[_0xb3f5('0x38')]=_[_0xb3f5('0x3a')](_0x30db61[_0xb3f5('0x38')],{'$or':_[_0xb3f5('0x27')](_0x30db61[_0xb3f5('0x31')],function(_0x4e8aac){var _0x533d71={};_0x533d71[_0x4e8aac]={'$like':'%'+_0x3fadc1[_0xb3f5('0x2e')]['filter']+'%'};return _0x533d71;})});}_0x30db61=_[_0xb3f5('0x3a')]({},_0x30db61,_0x3fadc1[_0xb3f5('0x4a')]);return _0x39c191[_0xb3f5('0x46')](_0x30db61);}})['then'](function(_0x4f7aea){if(_0x4f7aea){_0x2137e7=_0x4f7aea[_0xb3f5('0x33')];if(!_0x3fadc1[_0xb3f5('0x2e')]['hasOwnProperty'](_0xb3f5('0x35'))){_0x30db61[_0xb3f5('0x1b')]=qs[_0xb3f5('0x1b')](_0x3fadc1[_0xb3f5('0x2e')][_0xb3f5('0x1b')]);_0x30db61[_0xb3f5('0x1a')]=qs[_0xb3f5('0x1a')](_0x3fadc1[_0xb3f5('0x2e')][_0xb3f5('0x1a')]);}return _0x39c191[_0xb3f5('0x46')](_0x30db61);}})[_0xb3f5('0x20')](function(_0x5de2fc){if(_0x5de2fc){return _0x5de2fc?{'count':_0x2137e7,'rows':_0x5de2fc}:null;}})['then'](respondWithResult(_0xf38305,null))[_0xb3f5('0x3e')](handleError(_0xf38305,null));};exports[_0xb3f5('0x4b')]=function(_0x47bd51,_0x5c7d7d,_0x2e0f74){if(_0x47bd51['body']['id']){delete _0x47bd51['body']['id'];}return db[_0xb3f5('0x28')][_0xb3f5('0x47')]({'where':{'id':_0x47bd51[_0xb3f5('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c7d7d,null))[_0xb3f5('0x20')](function(_0x2695ef){if(_0x2695ef){_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x4c')]=_0x2695ef['id'];_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x4d')]=integrations['getSubjects'](_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x4e')],_0x47bd51['body'][_0xb3f5('0x2b')]);_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x4f')]=integrations[_0xb3f5('0x50')](_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x4e')],_0x47bd51[_0xb3f5('0x44')][_0xb3f5('0x2b')]);return db[_0xb3f5('0x48')]['create'](_0x47bd51['body'],{'include':[{'model':db[_0xb3f5('0x51')],'as':_0xb3f5('0x4d')},{'model':db[_0xb3f5('0x51')],'as':_0xb3f5('0x4f')}]});}return null;})[_0xb3f5('0x20')](respondWithResult(_0x5c7d7d,null))[_0xb3f5('0x3e')](handleError(_0x5c7d7d,null));};exports[_0xb3f5('0x52')]=function(_0x354fb1,_0x61d557,_0xf71c9b){var _0x5e07e1=[{'name':_0xb3f5('0x53'),'label':_0xb3f5('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 _0x5476a5='';return db[_0xb3f5('0x28')][_0xb3f5('0x47')]({'where':{'id':_0x354fb1[_0xb3f5('0x40')]['id']},'attributes':['id',_0xb3f5('0x54'),_0xb3f5('0x55'),_0xb3f5('0x56'),_0xb3f5('0x57'),_0xb3f5('0x58'),_0xb3f5('0x59'),_0xb3f5('0x5a'),'tokenSecret']})['then'](handleEntityNotFound(_0x61d557,null))[_0xb3f5('0x20')](function(_0xb35d0f){if(_0xb35d0f){_0x5476a5=_0xb35d0f[_0xb3f5('0x54')];var _0x1907aa=_0x5476a5[_0xb3f5('0x5b')](-0x1);if(_0x1907aa==='/'){_0x5476a5=_0x5476a5[_0xb3f5('0x5c')](0x0,_0x5476a5[_0xb3f5('0x5d')](_0x1907aa));}var _0x590c0b={'method':'GET','uri':util[_0xb3f5('0x5e')](_0xb3f5('0x5f'),_0x5476a5),'headers':{'Content-Type':_0xb3f5('0x60'),'Accept':_0xb3f5('0x60')},'json':!![]};if(_0xb35d0f[_0xb3f5('0x55')]==='basic'){_0x590c0b['headers'][_0xb3f5('0x61')]=util[_0xb3f5('0x5e')]('Basic\x20%s',new Buffer(util[_0xb3f5('0x5e')]('%s:%s',_0xb35d0f[_0xb3f5('0x56')],_0xb35d0f[_0xb3f5('0x57')]))[_0xb3f5('0x62')](_0xb3f5('0x63')));}return rp(_0x590c0b)[_0xb3f5('0x20')](function(_0x49de93){return _0x5e07e1['concat'](_['map'](_0x49de93[_0xb3f5('0x64')][_0xb3f5('0x65')],function(_0xb56208){return{'id':_0xb56208[_0xb3f5('0x24')],'name':_0xb56208[_0xb3f5('0x24')],'type':_0xb56208['type'],'active':_0xb56208[_0xb3f5('0x66')],'label':_0xb56208[_0xb3f5('0x67')],'custom':!![]};}));});}})[_0xb3f5('0x20')](function(_0x422f84){return{'count':_0x422f84[_0xb3f5('0x33')],'rows':_0x422f84};})['then'](respondWithResult(_0x61d557,null))[_0xb3f5('0x3e')](function(_0x40a4b3){var _0x2ed58e=_0x354fb1[_0xb3f5('0x2e')][_0xb3f5('0x68')]?0x1f4:_0x40a4b3[_0xb3f5('0x69')]||0x1f4;logger[_0xb3f5('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xb3f5('0x52'),_0x2ed58e,JSON[_0xb3f5('0x6a')](_0x40a4b3));delete _0x40a4b3['name'];if(_0x2ed58e===0x191){_0x2ed58e=0x190;}_0x61d557[_0xb3f5('0x17')](_0x2ed58e)['send'](_0x354fb1['query'][_0xb3f5('0x68')]?{'message':_0xb3f5('0x6b'),'statusCode':_0x40a4b3['statusCode']}:_0x40a4b3);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 87a1eed..a94d13e 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 _0x1caa=['request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x17acf9,_0x57cd6d){var _0xb35d4d=function(_0x2e2b75){while(--_0x2e2b75){_0x17acf9['push'](_0x17acf9['shift']());}};_0xb35d4d(++_0x57cd6d);}(_0x1caa,0x1e9));var _0xa1ca=function(_0x1752a3,_0x376563){_0x1752a3=_0x1752a3-0x0;var _0x572296=_0x1caa[_0x1752a3];return _0x572296;};'use strict';var _=require('lodash');var util=require(_0xa1ca('0x0'));var logger=require(_0xa1ca('0x1'))(_0xa1ca('0x2'));var moment=require(_0xa1ca('0x3'));var BPromise=require(_0xa1ca('0x4'));var rp=require(_0xa1ca('0x5'));var fs=require('fs');var path=require(_0xa1ca('0x6'));var rimraf=require('rimraf');var config=require(_0xa1ca('0x7'));var attributes=require(_0xa1ca('0x8'));var integrations=require(_0xa1ca('0x9'));module[_0xa1ca('0xa')]=function(_0x4812db,_0x162557){return _0x4812db[_0xa1ca('0xb')]('DeskAccount',attributes,{'tableName':_0xa1ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x269c=['api','moment','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','DeskAccount','lodash'];(function(_0x5d5a71,_0x28c3c1){var _0x136d16=function(_0x479e51){while(--_0x479e51){_0x5d5a71['push'](_0x5d5a71['shift']());}};_0x136d16(++_0x28c3c1);}(_0x269c,0x1ee));var _0xc269=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x269c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc269('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc269('0x1'));var moment=require(_0xc269('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc269('0x3'));var rimraf=require(_0xc269('0x4'));var config=require(_0xc269('0x5'));var attributes=require(_0xc269('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xc269('0x7')]=function(_0x3f6d6d,_0x540b38){return _0x3f6d6d['define'](_0xc269('0x8'),attributes,{'tableName':'int_desk_accounts','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 35e0f35..45777c2 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 _0x729d=['DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','DeskAccount','findAll','raw','options','where','attributes','limit','model','map','include','GetDeskAccount','catch','ShowDeskAccount','find','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','info'];(function(_0x5db5f5,_0x2d1172){var _0xe755a7=function(_0x1411c1){while(--_0x1411c1){_0x5db5f5['push'](_0x5db5f5['shift']());}};_0xe755a7(++_0x2d1172);}(_0x729d,0xe9));var _0xd729=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x729d[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xd729('0x0'));var util=require(_0xd729('0x1'));var moment=require(_0xd729('0x2'));var BPromise=require(_0xd729('0x3'));var rs=require(_0xd729('0x4'));var fs=require('fs');var Redis=require(_0xd729('0x5'));var db=require(_0xd729('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd729('0x7'))(_0xd729('0x8'));var config=require(_0xd729('0x9'));var jayson=require(_0xd729('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x219d41,_0x16128a,_0x484c74){return new BPromise(function(_0x5528e2,_0x508f4a){return client['request'](_0x219d41,_0x484c74)['then'](function(_0x3e3a69){logger[_0xd729('0xb')](_0xd729('0xc'),_0x16128a,_0xd729('0xd'));logger['debug'](_0xd729('0xe'),_0x16128a,_0xd729('0xd'),JSON[_0xd729('0xf')](_0x3e3a69));if(_0x3e3a69[_0xd729('0x10')]){if(_0x3e3a69[_0xd729('0x10')]['code']===0x1f4){logger[_0xd729('0x10')](_0xd729('0xc'),_0x16128a,_0x3e3a69[_0xd729('0x10')]['message']);return _0x508f4a(_0x3e3a69[_0xd729('0x10')][_0xd729('0x11')]);}logger[_0xd729('0x10')](_0xd729('0xc'),_0x16128a,_0x3e3a69[_0xd729('0x10')][_0xd729('0x11')]);return _0x5528e2(_0x3e3a69[_0xd729('0x10')][_0xd729('0x11')]);}else{logger[_0xd729('0xb')](_0xd729('0xc'),_0x16128a,_0xd729('0xd'));_0x5528e2(_0x3e3a69[_0xd729('0x12')][_0xd729('0x11')]);}})['catch'](function(_0x2830e8){logger[_0xd729('0x10')](_0xd729('0xc'),_0x16128a,_0x2830e8);_0x508f4a(_0x2830e8);});});}exports['GetDeskAccount']=function(_0x41abb5){var _0x1a8ef2=this;return new Promise(function(_0x673c95,_0x166d26){return db[_0xd729('0x13')][_0xd729('0x14')]({'raw':_0x41abb5['options']?_0x41abb5['options'][_0xd729('0x15')]===undefined?!![]:![]:!![],'where':_0x41abb5[_0xd729('0x16')]?_0x41abb5[_0xd729('0x16')][_0xd729('0x17')]||null:null,'attributes':_0x41abb5[_0xd729('0x16')]?_0x41abb5[_0xd729('0x16')][_0xd729('0x18')]||null:null,'limit':_0x41abb5[_0xd729('0x16')]?_0x41abb5['options'][_0xd729('0x19')]||null:null,'include':_0x41abb5[_0xd729('0x16')]?_0x41abb5[_0xd729('0x16')]['include']?_['map'](_0x41abb5['options']['include'],function(_0x4e98fb){return{'model':db[_0x4e98fb[_0xd729('0x1a')]],'as':_0x4e98fb['as'],'attributes':_0x4e98fb[_0xd729('0x18')],'include':_0x4e98fb['include']?_[_0xd729('0x1b')](_0x4e98fb[_0xd729('0x1c')],function(_0x4a72fa){return{'model':db[_0x4a72fa[_0xd729('0x1a')]],'as':_0x4a72fa['as'],'attributes':_0x4a72fa[_0xd729('0x18')],'include':_0x4a72fa[_0xd729('0x1c')]?_[_0xd729('0x1b')](_0x4a72fa[_0xd729('0x1c')],function(_0x5f3643){return{'model':db[_0x5f3643['model']],'as':_0x5f3643['as'],'attributes':_0x5f3643[_0xd729('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48c212){logger[_0xd729('0xb')](_0xd729('0x1d'),_0x41abb5);logger['debug'](_0xd729('0x1d'),_0x41abb5,JSON[_0xd729('0xf')](_0x48c212));_0x673c95(_0x48c212);})[_0xd729('0x1e')](function(_0x319694){logger[_0xd729('0x10')](_0xd729('0x1d'),_0x319694['message'],_0x41abb5);_0x166d26(_0x1a8ef2[_0xd729('0x10')](0x1f4,_0x319694[_0xd729('0x11')]));});});};exports[_0xd729('0x1f')]=function(_0x40264b){var _0x3de3a4=this;return new Promise(function(_0xa3872d,_0x3edf1d){return db[_0xd729('0x13')][_0xd729('0x20')]({'raw':_0x40264b[_0xd729('0x16')]?_0x40264b['options'][_0xd729('0x15')]===undefined?!![]:![]:!![],'where':_0x40264b[_0xd729('0x16')]?_0x40264b[_0xd729('0x16')][_0xd729('0x17')]||null:null,'attributes':_0x40264b[_0xd729('0x16')]?_0x40264b[_0xd729('0x16')][_0xd729('0x18')]||null:null,'include':_0x40264b[_0xd729('0x16')]?_0x40264b[_0xd729('0x16')][_0xd729('0x1c')]?_[_0xd729('0x1b')](_0x40264b[_0xd729('0x16')]['include'],function(_0x7d46a3){return{'model':db[_0x7d46a3[_0xd729('0x1a')]],'as':_0x7d46a3['as'],'attributes':_0x7d46a3[_0xd729('0x18')],'include':_0x7d46a3[_0xd729('0x1c')]?_[_0xd729('0x1b')](_0x7d46a3[_0xd729('0x1c')],function(_0x42fc78){return{'model':db[_0x42fc78['model']],'as':_0x42fc78['as'],'attributes':_0x42fc78[_0xd729('0x18')],'include':_0x42fc78[_0xd729('0x1c')]?_[_0xd729('0x1b')](_0x42fc78[_0xd729('0x1c')],function(_0x44185b){return{'model':db[_0x44185b['model']],'as':_0x44185b['as'],'attributes':_0x44185b[_0xd729('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd729('0x21')](function(_0x5d4699){logger['info'](_0xd729('0x1f'),_0x40264b);logger[_0xd729('0x22')]('ShowDeskAccount',_0x40264b,JSON['stringify'](_0x5d4699));_0xa3872d(_0x5d4699);})[_0xd729('0x1e')](function(_0x2a6935){logger[_0xd729('0x10')]('ShowDeskAccount',_0x2a6935[_0xd729('0x11')],_0x40264b);_0x3edf1d(_0x3de3a4[_0xd729('0x10')](0x1f4,_0x2a6935[_0xd729('0x11')]));});});}; \ No newline at end of file +var _0x77e8=['options','raw','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','DeskAccount','findAll'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0x77e8,0x176));var _0x877e=function(_0x4554c1,_0x589649){_0x4554c1=_0x4554c1-0x0;var _0x1dfa5c=_0x77e8[_0x4554c1];return _0x1dfa5c;};'use strict';var _=require(_0x877e('0x0'));var util=require(_0x877e('0x1'));var moment=require(_0x877e('0x2'));var BPromise=require(_0x877e('0x3'));var rs=require(_0x877e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x877e('0x5'));var logger=require(_0x877e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x877e('0x7'));var client=jayson[_0x877e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29062e,_0x3024aa,_0x10645a){return new BPromise(function(_0xe7766f,_0x3a7f61){return client[_0x877e('0x9')](_0x29062e,_0x10645a)['then'](function(_0x4d9a31){logger['info'](_0x877e('0xa'),_0x3024aa,'request\x20sent');logger[_0x877e('0xb')](_0x877e('0xc'),_0x3024aa,_0x877e('0xd'),JSON[_0x877e('0xe')](_0x4d9a31));if(_0x4d9a31[_0x877e('0xf')]){if(_0x4d9a31[_0x877e('0xf')][_0x877e('0x10')]===0x1f4){logger[_0x877e('0xf')](_0x877e('0xa'),_0x3024aa,_0x4d9a31[_0x877e('0xf')][_0x877e('0x11')]);return _0x3a7f61(_0x4d9a31['error'][_0x877e('0x11')]);}logger[_0x877e('0xf')](_0x877e('0xa'),_0x3024aa,_0x4d9a31[_0x877e('0xf')][_0x877e('0x11')]);return _0xe7766f(_0x4d9a31[_0x877e('0xf')]['message']);}else{logger[_0x877e('0x12')](_0x877e('0xa'),_0x3024aa,_0x877e('0xd'));_0xe7766f(_0x4d9a31['result']['message']);}})[_0x877e('0x13')](function(_0x182eff){logger[_0x877e('0xf')](_0x877e('0xa'),_0x3024aa,_0x182eff);_0x3a7f61(_0x182eff);});});}exports['GetDeskAccount']=function(_0x99207a){var _0x4c8e4c=this;return new Promise(function(_0x236aac,_0x3a4a12){return db[_0x877e('0x14')][_0x877e('0x15')]({'raw':_0x99207a['options']?_0x99207a[_0x877e('0x16')][_0x877e('0x17')]===undefined?!![]:![]:!![],'where':_0x99207a['options']?_0x99207a[_0x877e('0x16')]['where']||null:null,'attributes':_0x99207a['options']?_0x99207a['options'][_0x877e('0x18')]||null:null,'limit':_0x99207a['options']?_0x99207a[_0x877e('0x16')][_0x877e('0x19')]||null:null,'include':_0x99207a[_0x877e('0x16')]?_0x99207a[_0x877e('0x16')][_0x877e('0x1a')]?_[_0x877e('0x1b')](_0x99207a[_0x877e('0x16')][_0x877e('0x1a')],function(_0x6d6fe8){return{'model':db[_0x6d6fe8[_0x877e('0x1c')]],'as':_0x6d6fe8['as'],'attributes':_0x6d6fe8[_0x877e('0x18')],'include':_0x6d6fe8[_0x877e('0x1a')]?_[_0x877e('0x1b')](_0x6d6fe8[_0x877e('0x1a')],function(_0x588802){return{'model':db[_0x588802[_0x877e('0x1c')]],'as':_0x588802['as'],'attributes':_0x588802[_0x877e('0x18')],'include':_0x588802[_0x877e('0x1a')]?_[_0x877e('0x1b')](_0x588802[_0x877e('0x1a')],function(_0x3f81fb){return{'model':db[_0x3f81fb[_0x877e('0x1c')]],'as':_0x3f81fb['as'],'attributes':_0x3f81fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x877e('0x1d')](function(_0x428736){logger[_0x877e('0x12')](_0x877e('0x1e'),_0x99207a);logger[_0x877e('0xb')](_0x877e('0x1e'),_0x99207a,JSON[_0x877e('0xe')](_0x428736));_0x236aac(_0x428736);})[_0x877e('0x13')](function(_0x1fc93e){logger[_0x877e('0xf')](_0x877e('0x1e'),_0x1fc93e[_0x877e('0x11')],_0x99207a);_0x3a4a12(_0x4c8e4c['error'](0x1f4,_0x1fc93e[_0x877e('0x11')]));});});};exports[_0x877e('0x1f')]=function(_0x12130f){var _0x3c3c0a=this;return new Promise(function(_0x18d0cf,_0x14e55e){return db['DeskAccount']['find']({'raw':_0x12130f[_0x877e('0x16')]?_0x12130f[_0x877e('0x16')][_0x877e('0x17')]===undefined?!![]:![]:!![],'where':_0x12130f[_0x877e('0x16')]?_0x12130f[_0x877e('0x16')][_0x877e('0x20')]||null:null,'attributes':_0x12130f[_0x877e('0x16')]?_0x12130f[_0x877e('0x16')]['attributes']||null:null,'include':_0x12130f[_0x877e('0x16')]?_0x12130f[_0x877e('0x16')]['include']?_[_0x877e('0x1b')](_0x12130f['options'][_0x877e('0x1a')],function(_0x580fa0){return{'model':db[_0x580fa0['model']],'as':_0x580fa0['as'],'attributes':_0x580fa0[_0x877e('0x18')],'include':_0x580fa0['include']?_[_0x877e('0x1b')](_0x580fa0[_0x877e('0x1a')],function(_0x593ac2){return{'model':db[_0x593ac2[_0x877e('0x1c')]],'as':_0x593ac2['as'],'attributes':_0x593ac2[_0x877e('0x18')],'include':_0x593ac2[_0x877e('0x1a')]?_[_0x877e('0x1b')](_0x593ac2['include'],function(_0x2983e8){return{'model':db[_0x2983e8[_0x877e('0x1c')]],'as':_0x2983e8['as'],'attributes':_0x2983e8[_0x877e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xee326a){logger[_0x877e('0x12')](_0x877e('0x1f'),_0x12130f);logger['debug'](_0x877e('0x1f'),_0x12130f,JSON[_0x877e('0xe')](_0xee326a));_0x18d0cf(_0xee326a);})['catch'](function(_0x2453b2){logger['error']('ShowDeskAccount',_0x2453b2[_0x877e('0x11')],_0x12130f);_0x14e55e(_0x3c3c0a[_0x877e('0xf')](0x1f4,_0x2453b2[_0x877e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cfd1ea3..c364c48 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 _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(_0x50a4d7,_0x1ff795){var _0x4cc098=function(_0xaf8fd8){while(--_0xaf8fd8){_0x50a4d7['push'](_0x50a4d7['shift']());}};_0x4cc098(++_0x1ff795);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'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 +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35df55,_0x5173e4){var _0x43f2b7=function(_0x2b8507){while(--_0x2b8507){_0x35df55['push'](_0x35df55['shift']());}};_0x43f2b7(++_0x5173e4);}(_0x008c,0x188));var _0xc008=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x008c[_0x34b821];return _0x5e00a0;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2a1dfd7..b0b75b3 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 _0xd7d5=['exports','STRING','sequelize'];(function(_0x2bf7d4,_0x28a4e3){var _0x44a011=function(_0x49a1e6){while(--_0x49a1e6){_0x2bf7d4['push'](_0x2bf7d4['shift']());}};_0x44a011(++_0x28a4e3);}(_0xd7d5,0x14c));var _0x5d7d=function(_0x434b8e,_0x29820e){_0x434b8e=_0x434b8e-0x0;var _0x1d6e25=_0xd7d5[_0x434b8e];return _0x1d6e25;};'use strict';var Sequelize=require(_0x5d7d('0x0'));module[_0x5d7d('0x1')]={'name':{'type':Sequelize[_0x5d7d('0x2')]},'description':{'type':Sequelize[_0x5d7d('0x2')]}}; \ No newline at end of file +var _0x0983=['STRING','sequelize','exports'];(function(_0x18e3ed,_0x5c8389){var _0x6269d6=function(_0x546f76){while(--_0x546f76){_0x18e3ed['push'](_0x18e3ed['shift']());}};_0x6269d6(++_0x5c8389);}(_0x0983,0x181));var _0x3098=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x0983[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x3098('0x0'));module[_0x3098('0x1')]={'name':{'type':Sequelize[_0x3098('0x2')]},'description':{'type':Sequelize[_0x3098('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ebc30e1..66f9ef9 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 _0x6c0a=['ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','include','findAll','rows','params','includeAll','options','find','catch','create','body','DeskField','getFields','getSubjects','findOne','pick','nolimit','getDescriptions','getTags','Tag','setTags'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6c0a,0x191));var _0xa6c0=function(_0x978568,_0x30d0b1){_0x978568=_0x978568-0x0;var _0x1a5014=_0x6c0a[_0x978568];return _0x1a5014;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa6c0('0x0'));var jsonpatch=require(_0xa6c0('0x1'));var rp=require(_0xa6c0('0x2'));var moment=require(_0xa6c0('0x3'));var BPromise=require(_0xa6c0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa6c0('0x5'));var sox=require(_0xa6c0('0x6'));var csv=require(_0xa6c0('0x7'));var ejs=require(_0xa6c0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6c0('0x9'));var squel=require('squel');var crypto=require(_0xa6c0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa6c0('0xb'));var toCsv=require(_0xa6c0('0x7'));var querystring=require(_0xa6c0('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6c0('0xd'));var qs=require(_0xa6c0('0xe'));var as=require(_0xa6c0('0xf'));var hardwareService=require(_0xa6c0('0x10'));var logger=require(_0xa6c0('0x11'))(_0xa6c0('0x12'));var utils=require(_0xa6c0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa6c0('0x14'));var db=require(_0xa6c0('0x15'))['db'];function respondWithStatusCode(_0x1a29ee,_0x57ff0a){_0x57ff0a=_0x57ff0a||0xcc;return function(_0x433883){if(_0x433883){return _0x1a29ee[_0xa6c0('0x16')](_0x57ff0a);}return _0x1a29ee[_0xa6c0('0x17')](_0x57ff0a)[_0xa6c0('0x18')]();};}function respondWithResult(_0x5d23a3,_0x52c0da){_0x52c0da=_0x52c0da||0xc8;return function(_0x31b5f9){if(_0x31b5f9){return _0x5d23a3['status'](_0x52c0da)[_0xa6c0('0x19')](_0x31b5f9);}};}function respondWithFilteredResult(_0x4dd0d7,_0x9cc721){return function(_0x3f4c26){if(_0x3f4c26){var _0x48eee3=typeof _0x9cc721[_0xa6c0('0x1a')]==='undefined'&&typeof _0x9cc721[_0xa6c0('0x1b')]===_0xa6c0('0x1c');var _0x49beaa=_0x3f4c26[_0xa6c0('0x1d')];var _0x5240ee=_0x48eee3?0x0:_0x9cc721[_0xa6c0('0x1a')];var _0x94e8c7=_0x48eee3?_0x3f4c26[_0xa6c0('0x1d')]:_0x9cc721[_0xa6c0('0x1a')]+_0x9cc721[_0xa6c0('0x1b')];var _0x503ea4;if(_0x94e8c7>=_0x49beaa){_0x94e8c7=_0x49beaa;_0x503ea4=0xc8;}else{_0x503ea4=0xce;}_0x4dd0d7[_0xa6c0('0x17')](_0x503ea4);return _0x4dd0d7[_0xa6c0('0x1e')]('Content-Range',_0x5240ee+'-'+_0x94e8c7+'/'+_0x49beaa)[_0xa6c0('0x19')](_0x3f4c26);}return null;};}function patchUpdates(_0x228450){return function(_0x12bf43){try{jsonpatch[_0xa6c0('0x1f')](_0x12bf43,_0x228450,!![]);}catch(_0x4f1883){return BPromise['reject'](_0x4f1883);}return _0x12bf43['save']();};}function saveUpdates(_0x1c555f,_0x16612d){return function(_0x3b3d08){if(_0x3b3d08){return _0x3b3d08[_0xa6c0('0x20')](_0x1c555f)[_0xa6c0('0x21')](function(_0x2c8130){return _0x2c8130;});}return null;};}function removeEntity(_0x1e5870,_0x1c3d02){return function(_0xb860e2){if(_0xb860e2){return _0xb860e2[_0xa6c0('0x22')]()[_0xa6c0('0x21')](function(){_0x1e5870[_0xa6c0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18041f,_0x47f942){return function(_0x448f39){if(!_0x448f39){_0x18041f[_0xa6c0('0x16')](0x194);}return _0x448f39;};}function handleError(_0x30a7be,_0x1553da){_0x1553da=_0x1553da||0x1f4;return function(_0xc3e9fb){logger['error'](_0xc3e9fb[_0xa6c0('0x23')]);if(_0xc3e9fb[_0xa6c0('0x24')]){delete _0xc3e9fb[_0xa6c0('0x24')];}_0x30a7be[_0xa6c0('0x17')](_0x1553da)[_0xa6c0('0x25')](_0xc3e9fb);};}exports[_0xa6c0('0x26')]=function(_0x521ba6,_0x449fde){var _0x23bb23={},_0x39573d={},_0xfd98e8={'count':0x0,'rows':[]};var _0x2e30c3=_['map'](db[_0xa6c0('0x27')][_0xa6c0('0x28')],function(_0x4c4dfa){return{'name':_0x4c4dfa[_0xa6c0('0x29')],'type':_0x4c4dfa[_0xa6c0('0x2a')]['key']};});_0x39573d[_0xa6c0('0x2b')]=_[_0xa6c0('0x2c')](_0x2e30c3,'name');_0x39573d[_0xa6c0('0x2d')]=_[_0xa6c0('0x2e')](_0x521ba6[_0xa6c0('0x2d')]);_0x39573d[_0xa6c0('0x2f')]=_[_0xa6c0('0x30')](_0x39573d[_0xa6c0('0x2b')],_0x39573d[_0xa6c0('0x2d')]);_0x23bb23['attributes']=_[_0xa6c0('0x30')](_0x39573d['model'],qs['fields'](_0x521ba6['query'][_0xa6c0('0x31')]));_0x23bb23[_0xa6c0('0x32')]=_0x23bb23[_0xa6c0('0x32')][_0xa6c0('0x33')]?_0x23bb23[_0xa6c0('0x32')]:_0x39573d[_0xa6c0('0x2b')];if(!_0x521ba6[_0xa6c0('0x2d')][_0xa6c0('0x34')]('nolimit')){_0x23bb23[_0xa6c0('0x1b')]=qs[_0xa6c0('0x1b')](_0x521ba6[_0xa6c0('0x2d')][_0xa6c0('0x1b')]);_0x23bb23[_0xa6c0('0x1a')]=qs[_0xa6c0('0x1a')](_0x521ba6[_0xa6c0('0x2d')][_0xa6c0('0x1a')]);}_0x23bb23[_0xa6c0('0x35')]=qs[_0xa6c0('0x36')](_0x521ba6[_0xa6c0('0x2d')]['sort']);_0x23bb23[_0xa6c0('0x37')]=qs['filters'](_['pick'](_0x521ba6[_0xa6c0('0x2d')],_0x39573d[_0xa6c0('0x2f')]),_0x2e30c3);if(_0x521ba6['query']['filter']){_0x23bb23[_0xa6c0('0x37')]=_['merge'](_0x23bb23[_0xa6c0('0x37')],{'$or':_[_0xa6c0('0x2c')](_0x2e30c3,function(_0x5b7058){if(_0x5b7058[_0xa6c0('0x2a')]!==_0xa6c0('0x38')){var _0x1af263={};_0x1af263[_0x5b7058['name']]={'$like':'%'+_0x521ba6['query'][_0xa6c0('0x39')]+'%'};return _0x1af263;}})});}_0x23bb23=_[_0xa6c0('0x3a')]({},_0x23bb23,_0x521ba6['options']);var _0x1367a9={'where':_0x23bb23[_0xa6c0('0x37')]};return db[_0xa6c0('0x27')][_0xa6c0('0x1d')](_0x1367a9)[_0xa6c0('0x21')](function(_0x5c966f){_0xfd98e8[_0xa6c0('0x1d')]=_0x5c966f;if(_0x521ba6[_0xa6c0('0x2d')]['includeAll']){_0x23bb23[_0xa6c0('0x3b')]=[{'all':!![]}];}return db[_0xa6c0('0x27')][_0xa6c0('0x3c')](_0x23bb23);})[_0xa6c0('0x21')](function(_0x150862){_0xfd98e8[_0xa6c0('0x3d')]=_0x150862;return _0xfd98e8;})['then'](respondWithFilteredResult(_0x449fde,_0x23bb23))['catch'](handleError(_0x449fde,null));};exports['show']=function(_0x52e932,_0x51b9f0){var _0x5ccc51={'raw':![],'where':{'id':_0x52e932[_0xa6c0('0x3e')]['id']}},_0x1696fb={};_0x1696fb[_0xa6c0('0x2b')]=_[_0xa6c0('0x2e')](db[_0xa6c0('0x27')][_0xa6c0('0x28')]);_0x1696fb[_0xa6c0('0x2d')]=_['keys'](_0x52e932[_0xa6c0('0x2d')]);_0x1696fb['filters']=_[_0xa6c0('0x30')](_0x1696fb[_0xa6c0('0x2b')],_0x1696fb[_0xa6c0('0x2d')]);_0x5ccc51['attributes']=_[_0xa6c0('0x30')](_0x1696fb[_0xa6c0('0x2b')],qs['fields'](_0x52e932[_0xa6c0('0x2d')][_0xa6c0('0x31')]));_0x5ccc51[_0xa6c0('0x32')]=_0x5ccc51['attributes'][_0xa6c0('0x33')]?_0x5ccc51[_0xa6c0('0x32')]:_0x1696fb[_0xa6c0('0x2b')];if(_0x52e932['query'][_0xa6c0('0x3f')]){_0x5ccc51[_0xa6c0('0x3b')]=[{'all':!![]}];}_0x5ccc51=_[_0xa6c0('0x3a')]({},_0x5ccc51,_0x52e932[_0xa6c0('0x40')]);return db['DeskConfiguration'][_0xa6c0('0x41')](_0x5ccc51)[_0xa6c0('0x21')](handleEntityNotFound(_0x51b9f0,null))[_0xa6c0('0x21')](respondWithResult(_0x51b9f0,null))[_0xa6c0('0x42')](handleError(_0x51b9f0,null));};exports[_0xa6c0('0x43')]=function(_0x25a72b,_0x4064c2){return db[_0xa6c0('0x27')][_0xa6c0('0x43')](_0x25a72b[_0xa6c0('0x44')],{})[_0xa6c0('0x21')](respondWithResult(_0x4064c2,0xc9))['catch'](handleError(_0x4064c2,null));};exports[_0xa6c0('0x20')]=function(_0x1b01c5,_0x4ff548){if(_0x1b01c5[_0xa6c0('0x44')]['id']){delete _0x1b01c5[_0xa6c0('0x44')]['id'];}return db['DeskConfiguration'][_0xa6c0('0x41')]({'where':{'id':_0x1b01c5[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x4ff548,null))[_0xa6c0('0x21')](saveUpdates(_0x1b01c5[_0xa6c0('0x44')],null))['then'](respondWithResult(_0x4ff548,null))[_0xa6c0('0x42')](handleError(_0x4ff548,null));};exports[_0xa6c0('0x22')]=function(_0x2e3a9b,_0x29dec1){return db[_0xa6c0('0x27')][_0xa6c0('0x41')]({'where':{'id':_0x2e3a9b['params']['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x29dec1,null))[_0xa6c0('0x21')](removeEntity(_0x29dec1,null))[_0xa6c0('0x42')](handleError(_0x29dec1,null));};exports['getFields']=function(_0x40affe,_0x179bcd,_0x4a7cf9){var _0x1696be={};var _0x3af025={};var _0x42390e;var _0x3e2f48;return db[_0xa6c0('0x27')]['findOne']({'where':{'id':_0x40affe[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x179bcd,null))[_0xa6c0('0x21')](function(_0xb96366){if(_0xb96366){_0x42390e=_0xb96366;_0x3af025[_0xa6c0('0x2b')]=_[_0xa6c0('0x2e')](db[_0xa6c0('0x45')][_0xa6c0('0x28')]);_0x3af025['query']=_[_0xa6c0('0x2e')](_0x40affe[_0xa6c0('0x2d')]);_0x3af025[_0xa6c0('0x2f')]=_['intersection'](_0x3af025[_0xa6c0('0x2b')],_0x3af025[_0xa6c0('0x2d')]);_0x1696be[_0xa6c0('0x32')]=_['intersection'](_0x3af025[_0xa6c0('0x2b')],qs['fields'](_0x40affe[_0xa6c0('0x2d')][_0xa6c0('0x31')]));_0x1696be['attributes']=_0x1696be[_0xa6c0('0x32')][_0xa6c0('0x33')]?_0x1696be[_0xa6c0('0x32')]:_0x3af025['model'];_0x1696be['order']=qs[_0xa6c0('0x36')](_0x40affe['query']['sort']);_0x1696be['where']=qs[_0xa6c0('0x2f')](_['pick'](_0x40affe[_0xa6c0('0x2d')],_0x3af025[_0xa6c0('0x2f')]));if(_0x40affe[_0xa6c0('0x2d')][_0xa6c0('0x39')]){_0x1696be[_0xa6c0('0x37')]=_[_0xa6c0('0x3a')](_0x1696be[_0xa6c0('0x37')],{'$or':_['map'](_0x1696be[_0xa6c0('0x32')],function(_0x20bc72){var _0x4fa90e={};_0x4fa90e[_0x20bc72]={'$like':'%'+_0x40affe[_0xa6c0('0x2d')]['filter']+'%'};return _0x4fa90e;})});}_0x1696be=_['merge']({},_0x1696be,_0x40affe[_0xa6c0('0x40')]);return _0x42390e[_0xa6c0('0x46')](_0x1696be);}})[_0xa6c0('0x21')](function(_0x39f4f0){if(_0x39f4f0){_0x3e2f48=_0x39f4f0[_0xa6c0('0x33')];if(!_0x40affe[_0xa6c0('0x2d')][_0xa6c0('0x34')]('nolimit')){_0x1696be[_0xa6c0('0x1b')]=qs[_0xa6c0('0x1b')](_0x40affe[_0xa6c0('0x2d')][_0xa6c0('0x1b')]);_0x1696be[_0xa6c0('0x1a')]=qs['offset'](_0x40affe[_0xa6c0('0x2d')][_0xa6c0('0x1a')]);}return _0x42390e[_0xa6c0('0x46')](_0x1696be);}})['then'](function(_0x82f321){if(_0x82f321){return _0x82f321?{'count':_0x3e2f48,'rows':_0x82f321}:null;}})[_0xa6c0('0x21')](respondWithResult(_0x179bcd,null))['catch'](handleError(_0x179bcd,null));};exports[_0xa6c0('0x47')]=function(_0x2a4c7b,_0x2e1ba3,_0x35317d){var _0x43399f={};var _0x23d6f6={};var _0x30a009;var _0x357a5d;return db['DeskConfiguration'][_0xa6c0('0x48')]({'where':{'id':_0x2a4c7b[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x2e1ba3,null))[_0xa6c0('0x21')](function(_0x5c7ba7){if(_0x5c7ba7){_0x30a009=_0x5c7ba7;_0x23d6f6[_0xa6c0('0x2b')]=_['keys'](db[_0xa6c0('0x45')]['rawAttributes']);_0x23d6f6[_0xa6c0('0x2d')]=_[_0xa6c0('0x2e')](_0x2a4c7b[_0xa6c0('0x2d')]);_0x23d6f6[_0xa6c0('0x2f')]=_[_0xa6c0('0x30')](_0x23d6f6['model'],_0x23d6f6[_0xa6c0('0x2d')]);_0x43399f[_0xa6c0('0x32')]=_['intersection'](_0x23d6f6[_0xa6c0('0x2b')],qs[_0xa6c0('0x31')](_0x2a4c7b[_0xa6c0('0x2d')][_0xa6c0('0x31')]));_0x43399f[_0xa6c0('0x32')]=_0x43399f[_0xa6c0('0x32')][_0xa6c0('0x33')]?_0x43399f[_0xa6c0('0x32')]:_0x23d6f6[_0xa6c0('0x2b')];_0x43399f['order']=qs['sort'](_0x2a4c7b[_0xa6c0('0x2d')]['sort']);_0x43399f['where']=qs[_0xa6c0('0x2f')](_[_0xa6c0('0x49')](_0x2a4c7b[_0xa6c0('0x2d')],_0x23d6f6[_0xa6c0('0x2f')]));if(_0x2a4c7b[_0xa6c0('0x2d')][_0xa6c0('0x39')]){_0x43399f[_0xa6c0('0x37')]=_['merge'](_0x43399f[_0xa6c0('0x37')],{'$or':_[_0xa6c0('0x2c')](_0x43399f[_0xa6c0('0x32')],function(_0x194a7e){var _0x1931ff={};_0x1931ff[_0x194a7e]={'$like':'%'+_0x2a4c7b[_0xa6c0('0x2d')][_0xa6c0('0x39')]+'%'};return _0x1931ff;})});}_0x43399f=_[_0xa6c0('0x3a')]({},_0x43399f,_0x2a4c7b[_0xa6c0('0x40')]);return _0x30a009[_0xa6c0('0x47')](_0x43399f);}})[_0xa6c0('0x21')](function(_0x112f6d){if(_0x112f6d){_0x357a5d=_0x112f6d[_0xa6c0('0x33')];if(!_0x2a4c7b[_0xa6c0('0x2d')][_0xa6c0('0x34')](_0xa6c0('0x4a'))){_0x43399f[_0xa6c0('0x1b')]=qs[_0xa6c0('0x1b')](_0x2a4c7b['query'][_0xa6c0('0x1b')]);_0x43399f[_0xa6c0('0x1a')]=qs[_0xa6c0('0x1a')](_0x2a4c7b['query'][_0xa6c0('0x1a')]);}return _0x30a009[_0xa6c0('0x47')](_0x43399f);}})[_0xa6c0('0x21')](function(_0x3823ab){if(_0x3823ab){return _0x3823ab?{'count':_0x357a5d,'rows':_0x3823ab}:null;}})[_0xa6c0('0x21')](respondWithResult(_0x2e1ba3,null))['catch'](handleError(_0x2e1ba3,null));};exports[_0xa6c0('0x4b')]=function(_0x580aaa,_0x2d1d19,_0x2db761){var _0x276572={};var _0x537164={};var _0x31682a;var _0x52e459;return db['DeskConfiguration'][_0xa6c0('0x48')]({'where':{'id':_0x580aaa[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x2d1d19,null))[_0xa6c0('0x21')](function(_0x5003c3){if(_0x5003c3){_0x31682a=_0x5003c3;_0x537164[_0xa6c0('0x2b')]=_[_0xa6c0('0x2e')](db[_0xa6c0('0x45')][_0xa6c0('0x28')]);_0x537164[_0xa6c0('0x2d')]=_[_0xa6c0('0x2e')](_0x580aaa[_0xa6c0('0x2d')]);_0x537164['filters']=_[_0xa6c0('0x30')](_0x537164['model'],_0x537164[_0xa6c0('0x2d')]);_0x276572[_0xa6c0('0x32')]=_[_0xa6c0('0x30')](_0x537164[_0xa6c0('0x2b')],qs[_0xa6c0('0x31')](_0x580aaa[_0xa6c0('0x2d')]['fields']));_0x276572[_0xa6c0('0x32')]=_0x276572[_0xa6c0('0x32')][_0xa6c0('0x33')]?_0x276572[_0xa6c0('0x32')]:_0x537164['model'];_0x276572['order']=qs['sort'](_0x580aaa['query']['sort']);_0x276572[_0xa6c0('0x37')]=qs[_0xa6c0('0x2f')](_[_0xa6c0('0x49')](_0x580aaa['query'],_0x537164[_0xa6c0('0x2f')]));if(_0x580aaa[_0xa6c0('0x2d')][_0xa6c0('0x39')]){_0x276572['where']=_[_0xa6c0('0x3a')](_0x276572['where'],{'$or':_['map'](_0x276572[_0xa6c0('0x32')],function(_0x586dcd){var _0x5f4df6={};_0x5f4df6[_0x586dcd]={'$like':'%'+_0x580aaa[_0xa6c0('0x2d')][_0xa6c0('0x39')]+'%'};return _0x5f4df6;})});}_0x276572=_[_0xa6c0('0x3a')]({},_0x276572,_0x580aaa[_0xa6c0('0x40')]);return _0x31682a[_0xa6c0('0x4b')](_0x276572);}})[_0xa6c0('0x21')](function(_0x1e8a25){if(_0x1e8a25){_0x52e459=_0x1e8a25[_0xa6c0('0x33')];if(!_0x580aaa[_0xa6c0('0x2d')][_0xa6c0('0x34')](_0xa6c0('0x4a'))){_0x276572['limit']=qs['limit'](_0x580aaa[_0xa6c0('0x2d')]['limit']);_0x276572[_0xa6c0('0x1a')]=qs['offset'](_0x580aaa['query'][_0xa6c0('0x1a')]);}return _0x31682a[_0xa6c0('0x4b')](_0x276572);}})[_0xa6c0('0x21')](function(_0x51385a){if(_0x51385a){return _0x51385a?{'count':_0x52e459,'rows':_0x51385a}:null;}})[_0xa6c0('0x21')](respondWithResult(_0x2d1d19,null))[_0xa6c0('0x42')](handleError(_0x2d1d19,null));};exports[_0xa6c0('0x4c')]=function(_0xeb2c77,_0x481fcc,_0x3fa253){var _0x1587ee={};var _0x568add={};var _0x17461e;var _0x5afc0b;return db[_0xa6c0('0x27')][_0xa6c0('0x48')]({'where':{'id':_0xeb2c77[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x481fcc,null))[_0xa6c0('0x21')](function(_0x33fdf2){if(_0x33fdf2){_0x17461e=_0x33fdf2;_0x568add['model']=_['keys'](db[_0xa6c0('0x4d')]['rawAttributes']);_0x568add['query']=_[_0xa6c0('0x2e')](_0xeb2c77[_0xa6c0('0x2d')]);_0x568add[_0xa6c0('0x2f')]=_['intersection'](_0x568add[_0xa6c0('0x2b')],_0x568add['query']);_0x1587ee['attributes']=_[_0xa6c0('0x30')](_0x568add[_0xa6c0('0x2b')],qs[_0xa6c0('0x31')](_0xeb2c77[_0xa6c0('0x2d')][_0xa6c0('0x31')]));_0x1587ee['attributes']=_0x1587ee[_0xa6c0('0x32')][_0xa6c0('0x33')]?_0x1587ee[_0xa6c0('0x32')]:_0x568add[_0xa6c0('0x2b')];_0x1587ee[_0xa6c0('0x35')]=qs[_0xa6c0('0x36')](_0xeb2c77[_0xa6c0('0x2d')]['sort']);_0x1587ee[_0xa6c0('0x37')]=qs[_0xa6c0('0x2f')](_[_0xa6c0('0x49')](_0xeb2c77[_0xa6c0('0x2d')],_0x568add[_0xa6c0('0x2f')]));if(_0xeb2c77['query'][_0xa6c0('0x39')]){_0x1587ee[_0xa6c0('0x37')]=_[_0xa6c0('0x3a')](_0x1587ee[_0xa6c0('0x37')],{'$or':_[_0xa6c0('0x2c')](_0x1587ee[_0xa6c0('0x32')],function(_0x3e856d){var _0x4b054f={};_0x4b054f[_0x3e856d]={'$like':'%'+_0xeb2c77[_0xa6c0('0x2d')][_0xa6c0('0x39')]+'%'};return _0x4b054f;})});}_0x1587ee=_[_0xa6c0('0x3a')]({},_0x1587ee,_0xeb2c77['options']);return _0x17461e[_0xa6c0('0x4c')](_0x1587ee);}})[_0xa6c0('0x21')](function(_0x5bfa1f){if(_0x5bfa1f){_0x5afc0b=_0x5bfa1f[_0xa6c0('0x33')];if(!_0xeb2c77[_0xa6c0('0x2d')]['hasOwnProperty'](_0xa6c0('0x4a'))){_0x1587ee['limit']=qs[_0xa6c0('0x1b')](_0xeb2c77[_0xa6c0('0x2d')]['limit']);_0x1587ee[_0xa6c0('0x1a')]=qs[_0xa6c0('0x1a')](_0xeb2c77[_0xa6c0('0x2d')][_0xa6c0('0x1a')]);}return _0x17461e['getTags'](_0x1587ee);}})[_0xa6c0('0x21')](function(_0x565e43){if(_0x565e43){return _0x565e43?{'count':_0x5afc0b,'rows':_0x565e43}:null;}})['then'](respondWithResult(_0x481fcc,null))[_0xa6c0('0x42')](handleError(_0x481fcc,null));};exports[_0xa6c0('0x4e')]=function(_0x4c3222,_0x27477c,_0x423d7b){if(_0x4c3222[_0xa6c0('0x44')]['id']){delete _0x4c3222[_0xa6c0('0x44')]['id'];}return db[_0xa6c0('0x27')][_0xa6c0('0x48')]({'where':{'id':_0x4c3222[_0xa6c0('0x3e')]['id']}})[_0xa6c0('0x21')](handleEntityNotFound(_0x27477c,null))[_0xa6c0('0x21')](function(_0x42660c){if(_0x42660c){return _0x42660c[_0xa6c0('0x4e')](_0x4c3222['body'][_0xa6c0('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x27477c,null))[_0xa6c0('0x42')](handleError(_0x27477c,null));}; \ No newline at end of file +var _0xafb4=['set','Content-Range','reject','then','destroy','error','name','send','index','map','DeskConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','update','body','getFields','findOne','DeskField','sort','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0xafb4,0x11f));var _0x4afb=function(_0x169878,_0x563094){_0x169878=_0x169878-0x0;var _0x3f1461=_0xafb4[_0x169878];return _0x3f1461;};'use strict';var emlformat=require(_0x4afb('0x0'));var rimraf=require(_0x4afb('0x1'));var zipdir=require(_0x4afb('0x2'));var jsonpatch=require(_0x4afb('0x3'));var rp=require(_0x4afb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4afb('0x5'));var util=require(_0x4afb('0x6'));var path=require(_0x4afb('0x7'));var sox=require(_0x4afb('0x8'));var csv=require(_0x4afb('0x9'));var ejs=require(_0x4afb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4afb('0xb'));var crypto=require(_0x4afb('0xc'));var jsforce=require(_0x4afb('0xd'));var deskjs=require(_0x4afb('0xe'));var toCsv=require(_0x4afb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4afb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4afb('0x10'));var as=require(_0x4afb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4afb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4afb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4afb('0x14'))['db'];function respondWithStatusCode(_0x594655,_0x5df28b){_0x5df28b=_0x5df28b||0xcc;return function(_0x478c62){if(_0x478c62){return _0x594655[_0x4afb('0x15')](_0x5df28b);}return _0x594655['status'](_0x5df28b)[_0x4afb('0x16')]();};}function respondWithResult(_0x15d60c,_0x42ab39){_0x42ab39=_0x42ab39||0xc8;return function(_0x386e6c){if(_0x386e6c){return _0x15d60c[_0x4afb('0x17')](_0x42ab39)[_0x4afb('0x18')](_0x386e6c);}};}function respondWithFilteredResult(_0x4f8ce3,_0x4df5c0){return function(_0x1ec293){if(_0x1ec293){var _0x14e8d6=typeof _0x4df5c0[_0x4afb('0x19')]===_0x4afb('0x1a')&&typeof _0x4df5c0['limit']===_0x4afb('0x1a');var _0x2071a4=_0x1ec293['count'];var _0x540efd=_0x14e8d6?0x0:_0x4df5c0[_0x4afb('0x19')];var _0x549731=_0x14e8d6?_0x1ec293[_0x4afb('0x1b')]:_0x4df5c0[_0x4afb('0x19')]+_0x4df5c0[_0x4afb('0x1c')];var _0x27a914;if(_0x549731>=_0x2071a4){_0x549731=_0x2071a4;_0x27a914=0xc8;}else{_0x27a914=0xce;}_0x4f8ce3['status'](_0x27a914);return _0x4f8ce3[_0x4afb('0x1d')](_0x4afb('0x1e'),_0x540efd+'-'+_0x549731+'/'+_0x2071a4)['json'](_0x1ec293);}return null;};}function patchUpdates(_0x3b76dd){return function(_0xd48d5d){try{jsonpatch['apply'](_0xd48d5d,_0x3b76dd,!![]);}catch(_0x15f4a9){return BPromise[_0x4afb('0x1f')](_0x15f4a9);}return _0xd48d5d['save']();};}function saveUpdates(_0x3a237c,_0x5de25f){return function(_0x156ad9){if(_0x156ad9){return _0x156ad9['update'](_0x3a237c)[_0x4afb('0x20')](function(_0x38d8aa){return _0x38d8aa;});}return null;};}function removeEntity(_0x2ce94a,_0x541f4e){return function(_0xd6bc87){if(_0xd6bc87){return _0xd6bc87[_0x4afb('0x21')]()['then'](function(){_0x2ce94a[_0x4afb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa9f1,_0x3f821a){return function(_0x2d4bb3){if(!_0x2d4bb3){_0x3aa9f1[_0x4afb('0x15')](0x194);}return _0x2d4bb3;};}function handleError(_0x20ef99,_0x24259){_0x24259=_0x24259||0x1f4;return function(_0x458611){logger[_0x4afb('0x22')](_0x458611['stack']);if(_0x458611[_0x4afb('0x23')]){delete _0x458611[_0x4afb('0x23')];}_0x20ef99[_0x4afb('0x17')](_0x24259)[_0x4afb('0x24')](_0x458611);};}exports[_0x4afb('0x25')]=function(_0x2da4ef,_0x12a7fc){var _0x3af850={},_0xffa53={},_0x3258bc={'count':0x0,'rows':[]};var _0x1a0644=_[_0x4afb('0x26')](db[_0x4afb('0x27')][_0x4afb('0x28')],function(_0x4e8aae){return{'name':_0x4e8aae['fieldName'],'type':_0x4e8aae[_0x4afb('0x29')]['key']};});_0xffa53[_0x4afb('0x2a')]=_[_0x4afb('0x26')](_0x1a0644,_0x4afb('0x23'));_0xffa53[_0x4afb('0x2b')]=_[_0x4afb('0x2c')](_0x2da4ef[_0x4afb('0x2b')]);_0xffa53['filters']=_['intersection'](_0xffa53['model'],_0xffa53[_0x4afb('0x2b')]);_0x3af850[_0x4afb('0x2d')]=_[_0x4afb('0x2e')](_0xffa53['model'],qs[_0x4afb('0x2f')](_0x2da4ef[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0x3af850[_0x4afb('0x2d')]=_0x3af850[_0x4afb('0x2d')][_0x4afb('0x30')]?_0x3af850[_0x4afb('0x2d')]:_0xffa53['model'];if(!_0x2da4ef['query'][_0x4afb('0x31')]('nolimit')){_0x3af850[_0x4afb('0x1c')]=qs[_0x4afb('0x1c')](_0x2da4ef['query']['limit']);_0x3af850[_0x4afb('0x19')]=qs[_0x4afb('0x19')](_0x2da4ef['query'][_0x4afb('0x19')]);}_0x3af850[_0x4afb('0x32')]=qs['sort'](_0x2da4ef[_0x4afb('0x2b')]['sort']);_0x3af850[_0x4afb('0x33')]=qs[_0x4afb('0x34')](_[_0x4afb('0x35')](_0x2da4ef[_0x4afb('0x2b')],_0xffa53['filters']),_0x1a0644);if(_0x2da4ef['query'][_0x4afb('0x36')]){_0x3af850[_0x4afb('0x33')]=_['merge'](_0x3af850['where'],{'$or':_['map'](_0x1a0644,function(_0x22d06c){if(_0x22d06c[_0x4afb('0x29')]!==_0x4afb('0x37')){var _0x50b042={};_0x50b042[_0x22d06c['name']]={'$like':'%'+_0x2da4ef[_0x4afb('0x2b')][_0x4afb('0x36')]+'%'};return _0x50b042;}})});}_0x3af850=_[_0x4afb('0x38')]({},_0x3af850,_0x2da4ef['options']);var _0x3905a9={'where':_0x3af850['where']};return db[_0x4afb('0x27')][_0x4afb('0x1b')](_0x3905a9)[_0x4afb('0x20')](function(_0x455194){_0x3258bc[_0x4afb('0x1b')]=_0x455194;if(_0x2da4ef[_0x4afb('0x2b')][_0x4afb('0x39')]){_0x3af850[_0x4afb('0x3a')]=[{'all':!![]}];}return db[_0x4afb('0x27')][_0x4afb('0x3b')](_0x3af850);})['then'](function(_0x37a96e){_0x3258bc[_0x4afb('0x3c')]=_0x37a96e;return _0x3258bc;})['then'](respondWithFilteredResult(_0x12a7fc,_0x3af850))[_0x4afb('0x3d')](handleError(_0x12a7fc,null));};exports[_0x4afb('0x3e')]=function(_0x5d3dbe,_0x3f8154){var _0xffb10e={'raw':![],'where':{'id':_0x5d3dbe[_0x4afb('0x3f')]['id']}},_0x1b7c65={};_0x1b7c65[_0x4afb('0x2a')]=_[_0x4afb('0x2c')](db[_0x4afb('0x27')]['rawAttributes']);_0x1b7c65[_0x4afb('0x2b')]=_[_0x4afb('0x2c')](_0x5d3dbe[_0x4afb('0x2b')]);_0x1b7c65['filters']=_[_0x4afb('0x2e')](_0x1b7c65['model'],_0x1b7c65[_0x4afb('0x2b')]);_0xffb10e[_0x4afb('0x2d')]=_[_0x4afb('0x2e')](_0x1b7c65[_0x4afb('0x2a')],qs['fields'](_0x5d3dbe[_0x4afb('0x2b')]['fields']));_0xffb10e[_0x4afb('0x2d')]=_0xffb10e['attributes'][_0x4afb('0x30')]?_0xffb10e[_0x4afb('0x2d')]:_0x1b7c65['model'];if(_0x5d3dbe[_0x4afb('0x2b')][_0x4afb('0x39')]){_0xffb10e[_0x4afb('0x3a')]=[{'all':!![]}];}_0xffb10e=_['merge']({},_0xffb10e,_0x5d3dbe[_0x4afb('0x40')]);return db[_0x4afb('0x27')][_0x4afb('0x41')](_0xffb10e)[_0x4afb('0x20')](handleEntityNotFound(_0x3f8154,null))[_0x4afb('0x20')](respondWithResult(_0x3f8154,null))[_0x4afb('0x3d')](handleError(_0x3f8154,null));};exports[_0x4afb('0x42')]=function(_0x4c7c5f,_0x1f8b17){return db[_0x4afb('0x27')][_0x4afb('0x42')](_0x4c7c5f['body'],{})[_0x4afb('0x20')](respondWithResult(_0x1f8b17,0xc9))['catch'](handleError(_0x1f8b17,null));};exports[_0x4afb('0x43')]=function(_0x5cf676,_0xfa806e){if(_0x5cf676[_0x4afb('0x44')]['id']){delete _0x5cf676[_0x4afb('0x44')]['id'];}return db[_0x4afb('0x27')][_0x4afb('0x41')]({'where':{'id':_0x5cf676[_0x4afb('0x3f')]['id']}})[_0x4afb('0x20')](handleEntityNotFound(_0xfa806e,null))['then'](saveUpdates(_0x5cf676[_0x4afb('0x44')],null))[_0x4afb('0x20')](respondWithResult(_0xfa806e,null))['catch'](handleError(_0xfa806e,null));};exports[_0x4afb('0x21')]=function(_0x3e724c,_0x17958b){return db[_0x4afb('0x27')][_0x4afb('0x41')]({'where':{'id':_0x3e724c['params']['id']}})[_0x4afb('0x20')](handleEntityNotFound(_0x17958b,null))[_0x4afb('0x20')](removeEntity(_0x17958b,null))['catch'](handleError(_0x17958b,null));};exports[_0x4afb('0x45')]=function(_0x46be0f,_0x1a7f15,_0x4a34e9){var _0x38b81f={};var _0x3fa3b0={};var _0x474cb4;var _0x23553b;return db[_0x4afb('0x27')][_0x4afb('0x46')]({'where':{'id':_0x46be0f[_0x4afb('0x3f')]['id']}})[_0x4afb('0x20')](handleEntityNotFound(_0x1a7f15,null))[_0x4afb('0x20')](function(_0x5db44b){if(_0x5db44b){_0x474cb4=_0x5db44b;_0x3fa3b0['model']=_[_0x4afb('0x2c')](db[_0x4afb('0x47')]['rawAttributes']);_0x3fa3b0[_0x4afb('0x2b')]=_[_0x4afb('0x2c')](_0x46be0f[_0x4afb('0x2b')]);_0x3fa3b0[_0x4afb('0x34')]=_[_0x4afb('0x2e')](_0x3fa3b0[_0x4afb('0x2a')],_0x3fa3b0[_0x4afb('0x2b')]);_0x38b81f[_0x4afb('0x2d')]=_[_0x4afb('0x2e')](_0x3fa3b0[_0x4afb('0x2a')],qs[_0x4afb('0x2f')](_0x46be0f[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0x38b81f[_0x4afb('0x2d')]=_0x38b81f[_0x4afb('0x2d')][_0x4afb('0x30')]?_0x38b81f['attributes']:_0x3fa3b0[_0x4afb('0x2a')];_0x38b81f[_0x4afb('0x32')]=qs['sort'](_0x46be0f[_0x4afb('0x2b')][_0x4afb('0x48')]);_0x38b81f[_0x4afb('0x33')]=qs[_0x4afb('0x34')](_[_0x4afb('0x35')](_0x46be0f[_0x4afb('0x2b')],_0x3fa3b0[_0x4afb('0x34')]));if(_0x46be0f['query'][_0x4afb('0x36')]){_0x38b81f[_0x4afb('0x33')]=_[_0x4afb('0x38')](_0x38b81f[_0x4afb('0x33')],{'$or':_['map'](_0x38b81f['attributes'],function(_0x1c97c8){var _0x3cb4ec={};_0x3cb4ec[_0x1c97c8]={'$like':'%'+_0x46be0f['query'][_0x4afb('0x36')]+'%'};return _0x3cb4ec;})});}_0x38b81f=_['merge']({},_0x38b81f,_0x46be0f['options']);return _0x474cb4['getFields'](_0x38b81f);}})[_0x4afb('0x20')](function(_0x4fea26){if(_0x4fea26){_0x23553b=_0x4fea26[_0x4afb('0x30')];if(!_0x46be0f[_0x4afb('0x2b')][_0x4afb('0x31')](_0x4afb('0x49'))){_0x38b81f[_0x4afb('0x1c')]=qs[_0x4afb('0x1c')](_0x46be0f[_0x4afb('0x2b')][_0x4afb('0x1c')]);_0x38b81f[_0x4afb('0x19')]=qs['offset'](_0x46be0f[_0x4afb('0x2b')]['offset']);}return _0x474cb4['getFields'](_0x38b81f);}})[_0x4afb('0x20')](function(_0xfcf87d){if(_0xfcf87d){return _0xfcf87d?{'count':_0x23553b,'rows':_0xfcf87d}:null;}})[_0x4afb('0x20')](respondWithResult(_0x1a7f15,null))[_0x4afb('0x3d')](handleError(_0x1a7f15,null));};exports[_0x4afb('0x4a')]=function(_0x1c5767,_0x270c99,_0x34b117){var _0x17ce2f={};var _0x1b3e25={};var _0x1d6e6f;var _0x357650;return db[_0x4afb('0x27')][_0x4afb('0x46')]({'where':{'id':_0x1c5767[_0x4afb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x270c99,null))[_0x4afb('0x20')](function(_0x46de3e){if(_0x46de3e){_0x1d6e6f=_0x46de3e;_0x1b3e25[_0x4afb('0x2a')]=_[_0x4afb('0x2c')](db[_0x4afb('0x47')]['rawAttributes']);_0x1b3e25[_0x4afb('0x2b')]=_[_0x4afb('0x2c')](_0x1c5767['query']);_0x1b3e25[_0x4afb('0x34')]=_[_0x4afb('0x2e')](_0x1b3e25['model'],_0x1b3e25['query']);_0x17ce2f[_0x4afb('0x2d')]=_[_0x4afb('0x2e')](_0x1b3e25[_0x4afb('0x2a')],qs['fields'](_0x1c5767[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0x17ce2f['attributes']=_0x17ce2f[_0x4afb('0x2d')][_0x4afb('0x30')]?_0x17ce2f[_0x4afb('0x2d')]:_0x1b3e25[_0x4afb('0x2a')];_0x17ce2f['order']=qs['sort'](_0x1c5767['query'][_0x4afb('0x48')]);_0x17ce2f[_0x4afb('0x33')]=qs[_0x4afb('0x34')](_[_0x4afb('0x35')](_0x1c5767[_0x4afb('0x2b')],_0x1b3e25[_0x4afb('0x34')]));if(_0x1c5767[_0x4afb('0x2b')][_0x4afb('0x36')]){_0x17ce2f['where']=_[_0x4afb('0x38')](_0x17ce2f[_0x4afb('0x33')],{'$or':_[_0x4afb('0x26')](_0x17ce2f[_0x4afb('0x2d')],function(_0x37c276){var _0x54bd35={};_0x54bd35[_0x37c276]={'$like':'%'+_0x1c5767[_0x4afb('0x2b')][_0x4afb('0x36')]+'%'};return _0x54bd35;})});}_0x17ce2f=_[_0x4afb('0x38')]({},_0x17ce2f,_0x1c5767[_0x4afb('0x40')]);return _0x1d6e6f['getSubjects'](_0x17ce2f);}})[_0x4afb('0x20')](function(_0x5981c6){if(_0x5981c6){_0x357650=_0x5981c6['length'];if(!_0x1c5767['query']['hasOwnProperty'](_0x4afb('0x49'))){_0x17ce2f[_0x4afb('0x1c')]=qs[_0x4afb('0x1c')](_0x1c5767[_0x4afb('0x2b')]['limit']);_0x17ce2f[_0x4afb('0x19')]=qs[_0x4afb('0x19')](_0x1c5767[_0x4afb('0x2b')][_0x4afb('0x19')]);}return _0x1d6e6f[_0x4afb('0x4a')](_0x17ce2f);}})[_0x4afb('0x20')](function(_0x333848){if(_0x333848){return _0x333848?{'count':_0x357650,'rows':_0x333848}:null;}})[_0x4afb('0x20')](respondWithResult(_0x270c99,null))[_0x4afb('0x3d')](handleError(_0x270c99,null));};exports[_0x4afb('0x4b')]=function(_0x5687f1,_0x56b0f3,_0x3784cb){var _0x2538a3={};var _0x237d8a={};var _0x43ab37;var _0x2b9bc3;return db[_0x4afb('0x27')][_0x4afb('0x46')]({'where':{'id':_0x5687f1['params']['id']}})['then'](handleEntityNotFound(_0x56b0f3,null))[_0x4afb('0x20')](function(_0x3e8f4b){if(_0x3e8f4b){_0x43ab37=_0x3e8f4b;_0x237d8a[_0x4afb('0x2a')]=_[_0x4afb('0x2c')](db[_0x4afb('0x47')]['rawAttributes']);_0x237d8a[_0x4afb('0x2b')]=_[_0x4afb('0x2c')](_0x5687f1[_0x4afb('0x2b')]);_0x237d8a[_0x4afb('0x34')]=_[_0x4afb('0x2e')](_0x237d8a[_0x4afb('0x2a')],_0x237d8a['query']);_0x2538a3[_0x4afb('0x2d')]=_[_0x4afb('0x2e')](_0x237d8a['model'],qs['fields'](_0x5687f1[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0x2538a3[_0x4afb('0x2d')]=_0x2538a3[_0x4afb('0x2d')][_0x4afb('0x30')]?_0x2538a3[_0x4afb('0x2d')]:_0x237d8a[_0x4afb('0x2a')];_0x2538a3[_0x4afb('0x32')]=qs[_0x4afb('0x48')](_0x5687f1['query'][_0x4afb('0x48')]);_0x2538a3[_0x4afb('0x33')]=qs[_0x4afb('0x34')](_[_0x4afb('0x35')](_0x5687f1[_0x4afb('0x2b')],_0x237d8a[_0x4afb('0x34')]));if(_0x5687f1[_0x4afb('0x2b')][_0x4afb('0x36')]){_0x2538a3['where']=_[_0x4afb('0x38')](_0x2538a3[_0x4afb('0x33')],{'$or':_[_0x4afb('0x26')](_0x2538a3[_0x4afb('0x2d')],function(_0x46d6f2){var _0x28a676={};_0x28a676[_0x46d6f2]={'$like':'%'+_0x5687f1['query']['filter']+'%'};return _0x28a676;})});}_0x2538a3=_[_0x4afb('0x38')]({},_0x2538a3,_0x5687f1[_0x4afb('0x40')]);return _0x43ab37[_0x4afb('0x4b')](_0x2538a3);}})[_0x4afb('0x20')](function(_0xbc1769){if(_0xbc1769){_0x2b9bc3=_0xbc1769['length'];if(!_0x5687f1[_0x4afb('0x2b')]['hasOwnProperty']('nolimit')){_0x2538a3[_0x4afb('0x1c')]=qs[_0x4afb('0x1c')](_0x5687f1['query']['limit']);_0x2538a3[_0x4afb('0x19')]=qs[_0x4afb('0x19')](_0x5687f1[_0x4afb('0x2b')][_0x4afb('0x19')]);}return _0x43ab37['getDescriptions'](_0x2538a3);}})[_0x4afb('0x20')](function(_0x467e11){if(_0x467e11){return _0x467e11?{'count':_0x2b9bc3,'rows':_0x467e11}:null;}})['then'](respondWithResult(_0x56b0f3,null))[_0x4afb('0x3d')](handleError(_0x56b0f3,null));};exports[_0x4afb('0x4c')]=function(_0xbe3ea4,_0x355719,_0x1c7017){var _0x24d9fa={};var _0x2083b4={};var _0x40c2c4;var _0x4266f2;return db[_0x4afb('0x27')][_0x4afb('0x46')]({'where':{'id':_0xbe3ea4[_0x4afb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x355719,null))[_0x4afb('0x20')](function(_0x36fd49){if(_0x36fd49){_0x40c2c4=_0x36fd49;_0x2083b4['model']=_['keys'](db['Tag'][_0x4afb('0x28')]);_0x2083b4['query']=_[_0x4afb('0x2c')](_0xbe3ea4[_0x4afb('0x2b')]);_0x2083b4['filters']=_['intersection'](_0x2083b4[_0x4afb('0x2a')],_0x2083b4[_0x4afb('0x2b')]);_0x24d9fa[_0x4afb('0x2d')]=_['intersection'](_0x2083b4[_0x4afb('0x2a')],qs['fields'](_0xbe3ea4[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0x24d9fa['attributes']=_0x24d9fa['attributes'][_0x4afb('0x30')]?_0x24d9fa[_0x4afb('0x2d')]:_0x2083b4[_0x4afb('0x2a')];_0x24d9fa[_0x4afb('0x32')]=qs[_0x4afb('0x48')](_0xbe3ea4['query'][_0x4afb('0x48')]);_0x24d9fa[_0x4afb('0x33')]=qs[_0x4afb('0x34')](_['pick'](_0xbe3ea4[_0x4afb('0x2b')],_0x2083b4[_0x4afb('0x34')]));if(_0xbe3ea4[_0x4afb('0x2b')][_0x4afb('0x36')]){_0x24d9fa[_0x4afb('0x33')]=_['merge'](_0x24d9fa[_0x4afb('0x33')],{'$or':_[_0x4afb('0x26')](_0x24d9fa[_0x4afb('0x2d')],function(_0xca2c64){var _0x357ad9={};_0x357ad9[_0xca2c64]={'$like':'%'+_0xbe3ea4['query']['filter']+'%'};return _0x357ad9;})});}_0x24d9fa=_['merge']({},_0x24d9fa,_0xbe3ea4[_0x4afb('0x40')]);return _0x40c2c4[_0x4afb('0x4c')](_0x24d9fa);}})[_0x4afb('0x20')](function(_0x353b38){if(_0x353b38){_0x4266f2=_0x353b38['length'];if(!_0xbe3ea4['query']['hasOwnProperty'](_0x4afb('0x49'))){_0x24d9fa[_0x4afb('0x1c')]=qs[_0x4afb('0x1c')](_0xbe3ea4[_0x4afb('0x2b')][_0x4afb('0x1c')]);_0x24d9fa[_0x4afb('0x19')]=qs[_0x4afb('0x19')](_0xbe3ea4['query'][_0x4afb('0x19')]);}return _0x40c2c4['getTags'](_0x24d9fa);}})['then'](function(_0x3d1a86){if(_0x3d1a86){return _0x3d1a86?{'count':_0x4266f2,'rows':_0x3d1a86}:null;}})[_0x4afb('0x20')](respondWithResult(_0x355719,null))[_0x4afb('0x3d')](handleError(_0x355719,null));};exports[_0x4afb('0x4d')]=function(_0x2681a9,_0x5637fb,_0x5d5f3d){if(_0x2681a9[_0x4afb('0x44')]['id']){delete _0x2681a9['body']['id'];}return db['DeskConfiguration'][_0x4afb('0x46')]({'where':{'id':_0x2681a9[_0x4afb('0x3f')]['id']}})[_0x4afb('0x20')](handleEntityNotFound(_0x5637fb,null))[_0x4afb('0x20')](function(_0x53e952){if(_0x53e952){return _0x53e952['setTags'](_0x2681a9['body'][_0x4afb('0x4e')]||[]);}return null;})[_0x4afb('0x20')](respondWithResult(_0x5637fb,null))[_0x4afb('0x3d')](handleError(_0x5637fb,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7bfc13d..0170948 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 _0x777d=['./intDeskConfiguration.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x297300,_0x2531c4){var _0x4c1179=function(_0x346097){while(--_0x346097){_0x297300['push'](_0x297300['shift']());}};_0x4c1179(++_0x2531c4);}(_0x777d,0xe9));var _0xd777=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x777d[_0x2ade6c];return _0x2cb372;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc288=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x34f3d4,_0x5ae214){var _0x17f899=function(_0x14a5a2){while(--_0x14a5a2){_0x34f3d4['push'](_0x34f3d4['shift']());}};_0x17f899(++_0x5ae214);}(_0xc288,0x1d3));var _0x8c28=function(_0xb5b18c,_0x3cf5e8){_0xb5b18c=_0xb5b18c-0x0;var _0x6de48b=_0xc288[_0xb5b18c];return _0x6de48b;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var rp=require(_0x8c28('0x6'));var fs=require('fs');var path=require(_0x8c28('0x7'));var rimraf=require(_0x8c28('0x8'));var config=require(_0x8c28('0x9'));var attributes=require(_0x8c28('0xa'));module[_0x8c28('0xb')]=function(_0x3d124c,_0x2240c7){return _0x3d124c[_0x8c28('0xc')](_0x8c28('0xd'),attributes,{'tableName':_0x8c28('0xe'),'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 ee07e6b..74e6f53 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 _0x4cf5=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x4cf5,0x12e));var _0x54cf=function(_0x2433ce,_0xb32257){_0x2433ce=_0x2433ce-0x0;var _0x7cfeb9=_0x4cf5[_0x2433ce];return _0x7cfeb9;};'use strict';var _=require(_0x54cf('0x0'));var util=require(_0x54cf('0x1'));var moment=require(_0x54cf('0x2'));var BPromise=require(_0x54cf('0x3'));var rs=require(_0x54cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54cf('0x5'));var logger=require(_0x54cf('0x6'))(_0x54cf('0x7'));var config=require('../../config/environment');var jayson=require(_0x54cf('0x8'));var client=jayson['client'][_0x54cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4308fb,_0x3807b9,_0x3342d9){return new BPromise(function(_0x446671,_0x5781a6){return client['request'](_0x4308fb,_0x3342d9)['then'](function(_0x3cca5e){logger['info'](_0x54cf('0xa'),_0x3807b9,_0x54cf('0xb'));logger[_0x54cf('0xc')](_0x54cf('0xd'),_0x3807b9,'request\x20sent',JSON[_0x54cf('0xe')](_0x3cca5e));if(_0x3cca5e[_0x54cf('0xf')]){if(_0x3cca5e[_0x54cf('0xf')][_0x54cf('0x10')]===0x1f4){logger[_0x54cf('0xf')](_0x54cf('0xa'),_0x3807b9,_0x3cca5e['error'][_0x54cf('0x11')]);return _0x5781a6(_0x3cca5e[_0x54cf('0xf')][_0x54cf('0x11')]);}logger[_0x54cf('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x3807b9,_0x3cca5e[_0x54cf('0xf')][_0x54cf('0x11')]);return _0x446671(_0x3cca5e[_0x54cf('0xf')][_0x54cf('0x11')]);}else{logger['info'](_0x54cf('0xa'),_0x3807b9,_0x54cf('0xb'));_0x446671(_0x3cca5e['result'][_0x54cf('0x11')]);}})[_0x54cf('0x12')](function(_0x51a789){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3807b9,_0x51a789);_0x5781a6(_0x51a789);});});} \ No newline at end of file +var _0xa30a=['stringify','error','code','message','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2d6053,_0x5cc665){var _0x17a79b=function(_0x573afd){while(--_0x573afd){_0x2d6053['push'](_0x2d6053['shift']());}};_0x17a79b(++_0x5cc665);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3686b84..31639a1 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 _0xb086=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x1955cc,_0x438376){var _0x3ec0a2=function(_0x5ef3e3){while(--_0x5ef3e3){_0x1955cc['push'](_0x1955cc['shift']());}};_0x3ec0a2(++_0x438376);}(_0xb086,0xb8));var _0x6b08=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb086[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x6b08('0x0'));var util=require(_0x6b08('0x1'));var path=require(_0x6b08('0x2'));var timeout=require(_0x6b08('0x3'));var express=require(_0x6b08('0x4'));var router=express['Router']();var fs_extra=require(_0x6b08('0x5'));var auth=require(_0x6b08('0x6'));var interaction=require(_0x6b08('0x7'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x6b08('0x8')]('/',auth[_0x6b08('0x9')](),controller[_0x6b08('0xa')]);router[_0x6b08('0x8')]('/:id',auth[_0x6b08('0x9')](),controller[_0x6b08('0xb')]);router[_0x6b08('0xc')]('/',auth[_0x6b08('0x9')](),controller[_0x6b08('0xd')]);router[_0x6b08('0xe')](_0x6b08('0xf'),auth[_0x6b08('0x9')](),controller[_0x6b08('0x10')]);router[_0x6b08('0x11')](_0x6b08('0xf'),auth[_0x6b08('0x9')](),controller[_0x6b08('0x12')]);module[_0x6b08('0x13')]=router; \ No newline at end of file +var _0x8e6b=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2a4c3a,_0x338cb0){var _0x2f41cb=function(_0x55c499){while(--_0x55c499){_0x2a4c3a['push'](_0x2a4c3a['shift']());}};_0x2f41cb(++_0x338cb0);}(_0x8e6b,0x66));var _0xb8e6=function(_0x414388,_0x5bdf02){_0x414388=_0x414388-0x0;var _0x1e621b=_0x8e6b[_0x414388];return _0x1e621b;};'use strict';var multer=require(_0xb8e6('0x0'));var util=require(_0xb8e6('0x1'));var path=require(_0xb8e6('0x2'));var timeout=require(_0xb8e6('0x3'));var express=require('express');var router=express[_0xb8e6('0x4')]();var fs_extra=require(_0xb8e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb8e6('0x6'));var config=require(_0xb8e6('0x7'));var controller=require(_0xb8e6('0x8'));router[_0xb8e6('0x9')]('/',auth[_0xb8e6('0xa')](),controller[_0xb8e6('0xb')]);router[_0xb8e6('0x9')]('/:id',auth[_0xb8e6('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb8e6('0xc')]);router['put']('/:id',auth[_0xb8e6('0xa')](),controller[_0xb8e6('0xd')]);router[_0xb8e6('0xe')](_0xb8e6('0xf'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0x10')]);module[_0xb8e6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index cbf2113..dece447 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 _0x93bc=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x31d1c9,_0x5f0afc){var _0xbc976d=function(_0x4cd6d5){while(--_0x4cd6d5){_0x31d1c9['push'](_0x31d1c9['shift']());}};_0xbc976d(++_0x5f0afc);}(_0x93bc,0xd6));var _0xc93b=function(_0x3e6ac0,_0x1cb5f6){_0x3e6ac0=_0x3e6ac0-0x0;var _0x28f675=_0x93bc[_0x3e6ac0];return _0x28f675;};'use strict';var Sequelize=require(_0xc93b('0x0'));module['exports']={'type':{'type':Sequelize[_0xc93b('0x1')](_0xc93b('0x2'),_0xc93b('0x3'),_0xc93b('0x4'),_0xc93b('0x5'),_0xc93b('0x6')),'defaultValue':_0xc93b('0x2')},'content':{'type':Sequelize[_0xc93b('0x7')]},'key':{'type':Sequelize[_0xc93b('0x7')]},'keyType':{'type':Sequelize[_0xc93b('0x1')](_0xc93b('0x2'),'variable',_0xc93b('0x4'))},'keyContent':{'type':Sequelize[_0xc93b('0x7')]},'idField':{'type':Sequelize[_0xc93b('0x7')]},'nameField':{'type':Sequelize[_0xc93b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd94=['exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xbd94,0x13a));var _0x4bd9=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xbd94[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x4bd9('0x0'));module[_0x4bd9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4bd9('0x2'),'variable',_0x4bd9('0x3'),_0x4bd9('0x4'),'picklist'),'defaultValue':_0x4bd9('0x2')},'content':{'type':Sequelize[_0x4bd9('0x5')]},'key':{'type':Sequelize[_0x4bd9('0x5')]},'keyType':{'type':Sequelize[_0x4bd9('0x6')]('string',_0x4bd9('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x4bd9('0x5')]},'idField':{'type':Sequelize[_0x4bd9('0x5')]},'nameField':{'type':Sequelize[_0x4bd9('0x5')]},'customField':{'type':Sequelize[_0x4bd9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4bd9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1847334..519b7d4 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 _0x2842=['options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../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','save','update','destroy','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','rows','catch','params','rawAttributes','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2842,0x1ba));var _0x2284=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2842[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2284('0x0'));var zipdir=require(_0x2284('0x1'));var jsonpatch=require(_0x2284('0x2'));var rp=require(_0x2284('0x3'));var moment=require(_0x2284('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2284('0x5'));var util=require(_0x2284('0x6'));var path=require('path');var sox=require(_0x2284('0x7'));var csv=require(_0x2284('0x8'));var ejs=require(_0x2284('0x9'));var fs=require('fs');var fs_extra=require(_0x2284('0xa'));var _=require(_0x2284('0xb'));var squel=require(_0x2284('0xc'));var crypto=require('crypto');var jsforce=require(_0x2284('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2284('0x8'));var querystring=require(_0x2284('0xe'));var Papa=require(_0x2284('0xf'));var Redis=require('ioredis');var authService=require(_0x2284('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2284('0x11'));var hardwareService=require(_0x2284('0x12'));var logger=require(_0x2284('0x13'))(_0x2284('0x14'));var utils=require(_0x2284('0x15'));var config=require(_0x2284('0x16'));var licenseUtil=require(_0x2284('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3523ef,_0x554894){_0x554894=_0x554894||0xcc;return function(_0xf35d2c){if(_0xf35d2c){return _0x3523ef[_0x2284('0x18')](_0x554894);}return _0x3523ef[_0x2284('0x19')](_0x554894)[_0x2284('0x1a')]();};}function respondWithResult(_0x56b45b,_0xe9f93d){_0xe9f93d=_0xe9f93d||0xc8;return function(_0x281dd5){if(_0x281dd5){return _0x56b45b['status'](_0xe9f93d)[_0x2284('0x1b')](_0x281dd5);}};}function respondWithFilteredResult(_0x5cb2a7,_0x4e09ba){return function(_0x390719){if(_0x390719){var _0x18b7a0=typeof _0x4e09ba[_0x2284('0x1c')]===_0x2284('0x1d')&&typeof _0x4e09ba[_0x2284('0x1e')]==='undefined';var _0xfa1008=_0x390719[_0x2284('0x1f')];var _0xb7935d=_0x18b7a0?0x0:_0x4e09ba['offset'];var _0x2e688c=_0x18b7a0?_0x390719[_0x2284('0x1f')]:_0x4e09ba[_0x2284('0x1c')]+_0x4e09ba[_0x2284('0x1e')];var _0x499a9a;if(_0x2e688c>=_0xfa1008){_0x2e688c=_0xfa1008;_0x499a9a=0xc8;}else{_0x499a9a=0xce;}_0x5cb2a7[_0x2284('0x19')](_0x499a9a);return _0x5cb2a7[_0x2284('0x20')]('Content-Range',_0xb7935d+'-'+_0x2e688c+'/'+_0xfa1008)[_0x2284('0x1b')](_0x390719);}return null;};}function patchUpdates(_0x55733f){return function(_0x367527){try{jsonpatch['apply'](_0x367527,_0x55733f,!![]);}catch(_0x34f1d4){return BPromise['reject'](_0x34f1d4);}return _0x367527[_0x2284('0x21')]();};}function saveUpdates(_0x132b87,_0x9ba6fc){return function(_0x428231){if(_0x428231){return _0x428231[_0x2284('0x22')](_0x132b87)['then'](function(_0x3e8f59){return _0x3e8f59;});}return null;};}function removeEntity(_0x43b99d,_0x173303){return function(_0x3bf787){if(_0x3bf787){return _0x3bf787[_0x2284('0x23')]()['then'](function(){_0x43b99d[_0x2284('0x19')](0xcc)[_0x2284('0x1a')]();});}};}function handleEntityNotFound(_0x2ee84c,_0x26e87d){return function(_0x11aede){if(!_0x11aede){_0x2ee84c[_0x2284('0x18')](0x194);}return _0x11aede;};}function handleError(_0x1976c4,_0xe1e5e3){_0xe1e5e3=_0xe1e5e3||0x1f4;return function(_0x3aa78d){logger['error'](_0x3aa78d[_0x2284('0x24')]);if(_0x3aa78d[_0x2284('0x25')]){delete _0x3aa78d[_0x2284('0x25')];}_0x1976c4[_0x2284('0x19')](_0xe1e5e3)[_0x2284('0x26')](_0x3aa78d);};}exports[_0x2284('0x27')]=function(_0x4e0e0b,_0x16c5a5){var _0x31e2bc={},_0x515276={},_0x58afe8={'count':0x0,'rows':[]};var _0x3ade9c=_[_0x2284('0x28')](db[_0x2284('0x29')]['rawAttributes'],function(_0x2299f0){return{'name':_0x2299f0[_0x2284('0x2a')],'type':_0x2299f0[_0x2284('0x2b')][_0x2284('0x2c')]};});_0x515276[_0x2284('0x2d')]=_['map'](_0x3ade9c,_0x2284('0x25'));_0x515276[_0x2284('0x2e')]=_[_0x2284('0x2f')](_0x4e0e0b[_0x2284('0x2e')]);_0x515276[_0x2284('0x30')]=_[_0x2284('0x31')](_0x515276[_0x2284('0x2d')],_0x515276[_0x2284('0x2e')]);_0x31e2bc[_0x2284('0x32')]=_[_0x2284('0x31')](_0x515276['model'],qs[_0x2284('0x33')](_0x4e0e0b['query'][_0x2284('0x33')]));_0x31e2bc['attributes']=_0x31e2bc[_0x2284('0x32')][_0x2284('0x34')]?_0x31e2bc[_0x2284('0x32')]:_0x515276[_0x2284('0x2d')];if(!_0x4e0e0b[_0x2284('0x2e')][_0x2284('0x35')](_0x2284('0x36'))){_0x31e2bc[_0x2284('0x1e')]=qs[_0x2284('0x1e')](_0x4e0e0b[_0x2284('0x2e')][_0x2284('0x1e')]);_0x31e2bc[_0x2284('0x1c')]=qs[_0x2284('0x1c')](_0x4e0e0b[_0x2284('0x2e')]['offset']);}_0x31e2bc[_0x2284('0x37')]=qs[_0x2284('0x38')](_0x4e0e0b['query'][_0x2284('0x38')]);_0x31e2bc[_0x2284('0x39')]=qs['filters'](_[_0x2284('0x3a')](_0x4e0e0b[_0x2284('0x2e')],_0x515276[_0x2284('0x30')]),_0x3ade9c);if(_0x4e0e0b['query'][_0x2284('0x3b')]){_0x31e2bc[_0x2284('0x39')]=_[_0x2284('0x3c')](_0x31e2bc[_0x2284('0x39')],{'$or':_[_0x2284('0x28')](_0x3ade9c,function(_0x3601c1){if(_0x3601c1[_0x2284('0x2b')]!==_0x2284('0x3d')){var _0x47c4b4={};_0x47c4b4[_0x3601c1[_0x2284('0x25')]]={'$like':'%'+_0x4e0e0b[_0x2284('0x2e')]['filter']+'%'};return _0x47c4b4;}})});}_0x31e2bc=_[_0x2284('0x3c')]({},_0x31e2bc,_0x4e0e0b['options']);var _0x475bf9={'where':_0x31e2bc[_0x2284('0x39')]};return db[_0x2284('0x29')]['count'](_0x475bf9)[_0x2284('0x3e')](function(_0x542dd2){_0x58afe8[_0x2284('0x1f')]=_0x542dd2;if(_0x4e0e0b[_0x2284('0x2e')]['includeAll']){_0x31e2bc[_0x2284('0x3f')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x31e2bc);})[_0x2284('0x3e')](function(_0x40dec3){_0x58afe8[_0x2284('0x40')]=_0x40dec3;return _0x58afe8;})[_0x2284('0x3e')](respondWithFilteredResult(_0x16c5a5,_0x31e2bc))[_0x2284('0x41')](handleError(_0x16c5a5,null));};exports['show']=function(_0x554351,_0x4776d4){var _0x6c5e60={'raw':!![],'where':{'id':_0x554351[_0x2284('0x42')]['id']}},_0x22b420={};_0x22b420[_0x2284('0x2d')]=_[_0x2284('0x2f')](db[_0x2284('0x29')][_0x2284('0x43')]);_0x22b420['query']=_[_0x2284('0x2f')](_0x554351['query']);_0x22b420[_0x2284('0x30')]=_[_0x2284('0x31')](_0x22b420[_0x2284('0x2d')],_0x22b420[_0x2284('0x2e')]);_0x6c5e60[_0x2284('0x32')]=_[_0x2284('0x31')](_0x22b420['model'],qs[_0x2284('0x33')](_0x554351['query'][_0x2284('0x33')]));_0x6c5e60[_0x2284('0x32')]=_0x6c5e60[_0x2284('0x32')][_0x2284('0x34')]?_0x6c5e60['attributes']:_0x22b420[_0x2284('0x2d')];if(_0x554351[_0x2284('0x2e')][_0x2284('0x44')]){_0x6c5e60['include']=[{'all':!![]}];}_0x6c5e60=_[_0x2284('0x3c')]({},_0x6c5e60,_0x554351[_0x2284('0x45')]);return db['DeskField'][_0x2284('0x46')](_0x6c5e60)['then'](handleEntityNotFound(_0x4776d4,null))[_0x2284('0x3e')](respondWithResult(_0x4776d4,null))['catch'](handleError(_0x4776d4,null));};exports[_0x2284('0x47')]=function(_0x4b324b,_0x33ca34){return db[_0x2284('0x29')]['create'](_0x4b324b[_0x2284('0x48')],{})['then'](respondWithResult(_0x33ca34,0xc9))['catch'](handleError(_0x33ca34,null));};exports[_0x2284('0x22')]=function(_0x59fbb6,_0x5178cb){if(_0x59fbb6[_0x2284('0x48')]['id']){delete _0x59fbb6[_0x2284('0x48')]['id'];}return db[_0x2284('0x29')][_0x2284('0x46')]({'where':{'id':_0x59fbb6[_0x2284('0x42')]['id']}})['then'](handleEntityNotFound(_0x5178cb,null))[_0x2284('0x3e')](saveUpdates(_0x59fbb6[_0x2284('0x48')],null))[_0x2284('0x3e')](respondWithResult(_0x5178cb,null))[_0x2284('0x41')](handleError(_0x5178cb,null));};exports['destroy']=function(_0x24964e,_0x58bea3){return db[_0x2284('0x29')]['find']({'where':{'id':_0x24964e['params']['id']}})[_0x2284('0x3e')](handleEntityNotFound(_0x58bea3,null))['then'](removeEntity(_0x58bea3,null))['catch'](handleError(_0x58bea3,null));}; \ No newline at end of file +var _0x7fd6=['end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','DeskField','findAll','catch','show','params','keys','length','includeAll','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2f978d,_0x41674b){var _0x5801ee=function(_0x78c1c4){while(--_0x78c1c4){_0x2f978d['push'](_0x2f978d['shift']());}};_0x5801ee(++_0x41674b);}(_0x7fd6,0x157));var _0x67fd=function(_0x194c1f,_0x1403f6){_0x194c1f=_0x194c1f-0x0;var _0x2cae97=_0x7fd6[_0x194c1f];return _0x2cae97;};'use strict';var emlformat=require(_0x67fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67fd('0x1'));var jsonpatch=require(_0x67fd('0x2'));var rp=require(_0x67fd('0x3'));var moment=require(_0x67fd('0x4'));var BPromise=require(_0x67fd('0x5'));var Mustache=require(_0x67fd('0x6'));var util=require('util');var path=require(_0x67fd('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(_0x67fd('0x8'));var squel=require(_0x67fd('0x9'));var crypto=require(_0x67fd('0xa'));var jsforce=require(_0x67fd('0xb'));var deskjs=require(_0x67fd('0xc'));var toCsv=require(_0x67fd('0xd'));var querystring=require(_0x67fd('0xe'));var Papa=require(_0x67fd('0xf'));var Redis=require('ioredis');var authService=require(_0x67fd('0x10'));var qs=require(_0x67fd('0x11'));var as=require(_0x67fd('0x12'));var hardwareService=require(_0x67fd('0x13'));var logger=require(_0x67fd('0x14'))(_0x67fd('0x15'));var utils=require('../../config/utils');var config=require(_0x67fd('0x16'));var licenseUtil=require(_0x67fd('0x17'));var db=require(_0x67fd('0x18'))['db'];function respondWithStatusCode(_0x133c2f,_0x13dd7c){_0x13dd7c=_0x13dd7c||0xcc;return function(_0x41876c){if(_0x41876c){return _0x133c2f[_0x67fd('0x19')](_0x13dd7c);}return _0x133c2f[_0x67fd('0x1a')](_0x13dd7c)[_0x67fd('0x1b')]();};}function respondWithResult(_0x79379c,_0x9e1983){_0x9e1983=_0x9e1983||0xc8;return function(_0x5e7d9f){if(_0x5e7d9f){return _0x79379c[_0x67fd('0x1a')](_0x9e1983)[_0x67fd('0x1c')](_0x5e7d9f);}};}function respondWithFilteredResult(_0x468b9c,_0x1cf79b){return function(_0x520bbf){if(_0x520bbf){var _0x16fd3a=typeof _0x1cf79b[_0x67fd('0x1d')]==='undefined'&&typeof _0x1cf79b[_0x67fd('0x1e')]===_0x67fd('0x1f');var _0x1d5a3c=_0x520bbf[_0x67fd('0x20')];var _0x412a1c=_0x16fd3a?0x0:_0x1cf79b[_0x67fd('0x1d')];var _0x1f019e=_0x16fd3a?_0x520bbf[_0x67fd('0x20')]:_0x1cf79b['offset']+_0x1cf79b[_0x67fd('0x1e')];var _0x4d7fa8;if(_0x1f019e>=_0x1d5a3c){_0x1f019e=_0x1d5a3c;_0x4d7fa8=0xc8;}else{_0x4d7fa8=0xce;}_0x468b9c[_0x67fd('0x1a')](_0x4d7fa8);return _0x468b9c['set'](_0x67fd('0x21'),_0x412a1c+'-'+_0x1f019e+'/'+_0x1d5a3c)[_0x67fd('0x1c')](_0x520bbf);}return null;};}function patchUpdates(_0x118169){return function(_0x581ed6){try{jsonpatch[_0x67fd('0x22')](_0x581ed6,_0x118169,!![]);}catch(_0x1f3a48){return BPromise['reject'](_0x1f3a48);}return _0x581ed6[_0x67fd('0x23')]();};}function saveUpdates(_0x20f8b6,_0x2cface){return function(_0x5faffc){if(_0x5faffc){return _0x5faffc[_0x67fd('0x24')](_0x20f8b6)[_0x67fd('0x25')](function(_0x24d5c9){return _0x24d5c9;});}return null;};}function removeEntity(_0x186b9a,_0x311c1d){return function(_0x424447){if(_0x424447){return _0x424447['destroy']()[_0x67fd('0x25')](function(){_0x186b9a[_0x67fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce47b,_0x365252){return function(_0x7daaa8){if(!_0x7daaa8){_0x5ce47b[_0x67fd('0x19')](0x194);}return _0x7daaa8;};}function handleError(_0x166e94,_0x43aee0){_0x43aee0=_0x43aee0||0x1f4;return function(_0x8d4eff){logger['error'](_0x8d4eff[_0x67fd('0x26')]);if(_0x8d4eff[_0x67fd('0x27')]){delete _0x8d4eff[_0x67fd('0x27')];}_0x166e94['status'](_0x43aee0)['send'](_0x8d4eff);};}exports[_0x67fd('0x28')]=function(_0x3b3393,_0x39c569){var _0x1b4aad={},_0x383ef={},_0x327480={'count':0x0,'rows':[]};var _0x5d24e2=_[_0x67fd('0x29')](db['DeskField'][_0x67fd('0x2a')],function(_0x9b424b){return{'name':_0x9b424b[_0x67fd('0x2b')],'type':_0x9b424b[_0x67fd('0x2c')]['key']};});_0x383ef['model']=_[_0x67fd('0x29')](_0x5d24e2,'name');_0x383ef[_0x67fd('0x2d')]=_['keys'](_0x3b3393['query']);_0x383ef[_0x67fd('0x2e')]=_[_0x67fd('0x2f')](_0x383ef[_0x67fd('0x30')],_0x383ef[_0x67fd('0x2d')]);_0x1b4aad[_0x67fd('0x31')]=_[_0x67fd('0x2f')](_0x383ef[_0x67fd('0x30')],qs['fields'](_0x3b3393['query'][_0x67fd('0x32')]));_0x1b4aad[_0x67fd('0x31')]=_0x1b4aad['attributes']['length']?_0x1b4aad[_0x67fd('0x31')]:_0x383ef[_0x67fd('0x30')];if(!_0x3b3393[_0x67fd('0x2d')][_0x67fd('0x33')](_0x67fd('0x34'))){_0x1b4aad[_0x67fd('0x1e')]=qs[_0x67fd('0x1e')](_0x3b3393[_0x67fd('0x2d')][_0x67fd('0x1e')]);_0x1b4aad[_0x67fd('0x1d')]=qs[_0x67fd('0x1d')](_0x3b3393['query'][_0x67fd('0x1d')]);}_0x1b4aad[_0x67fd('0x35')]=qs['sort'](_0x3b3393['query'][_0x67fd('0x36')]);_0x1b4aad['where']=qs[_0x67fd('0x2e')](_[_0x67fd('0x37')](_0x3b3393['query'],_0x383ef[_0x67fd('0x2e')]),_0x5d24e2);if(_0x3b3393[_0x67fd('0x2d')][_0x67fd('0x38')]){_0x1b4aad[_0x67fd('0x39')]=_[_0x67fd('0x3a')](_0x1b4aad[_0x67fd('0x39')],{'$or':_[_0x67fd('0x29')](_0x5d24e2,function(_0x356032){if(_0x356032[_0x67fd('0x2c')]!==_0x67fd('0x3b')){var _0x5c78f6={};_0x5c78f6[_0x356032[_0x67fd('0x27')]]={'$like':'%'+_0x3b3393[_0x67fd('0x2d')][_0x67fd('0x38')]+'%'};return _0x5c78f6;}})});}_0x1b4aad=_[_0x67fd('0x3a')]({},_0x1b4aad,_0x3b3393[_0x67fd('0x3c')]);var _0x18de55={'where':_0x1b4aad['where']};return db['DeskField'][_0x67fd('0x20')](_0x18de55)[_0x67fd('0x25')](function(_0x332add){_0x327480[_0x67fd('0x20')]=_0x332add;if(_0x3b3393[_0x67fd('0x2d')]['includeAll']){_0x1b4aad[_0x67fd('0x3d')]=[{'all':!![]}];}return db[_0x67fd('0x3e')][_0x67fd('0x3f')](_0x1b4aad);})[_0x67fd('0x25')](function(_0x5a2e53){_0x327480['rows']=_0x5a2e53;return _0x327480;})['then'](respondWithFilteredResult(_0x39c569,_0x1b4aad))[_0x67fd('0x40')](handleError(_0x39c569,null));};exports[_0x67fd('0x41')]=function(_0x56fc7f,_0x7d4916){var _0xc17f69={'raw':!![],'where':{'id':_0x56fc7f[_0x67fd('0x42')]['id']}},_0x1ada05={};_0x1ada05[_0x67fd('0x30')]=_[_0x67fd('0x43')](db[_0x67fd('0x3e')][_0x67fd('0x2a')]);_0x1ada05[_0x67fd('0x2d')]=_[_0x67fd('0x43')](_0x56fc7f['query']);_0x1ada05[_0x67fd('0x2e')]=_[_0x67fd('0x2f')](_0x1ada05['model'],_0x1ada05[_0x67fd('0x2d')]);_0xc17f69[_0x67fd('0x31')]=_[_0x67fd('0x2f')](_0x1ada05['model'],qs[_0x67fd('0x32')](_0x56fc7f[_0x67fd('0x2d')][_0x67fd('0x32')]));_0xc17f69[_0x67fd('0x31')]=_0xc17f69[_0x67fd('0x31')][_0x67fd('0x44')]?_0xc17f69['attributes']:_0x1ada05[_0x67fd('0x30')];if(_0x56fc7f['query'][_0x67fd('0x45')]){_0xc17f69[_0x67fd('0x3d')]=[{'all':!![]}];}_0xc17f69=_[_0x67fd('0x3a')]({},_0xc17f69,_0x56fc7f['options']);return db[_0x67fd('0x3e')]['find'](_0xc17f69)[_0x67fd('0x25')](handleEntityNotFound(_0x7d4916,null))[_0x67fd('0x25')](respondWithResult(_0x7d4916,null))[_0x67fd('0x40')](handleError(_0x7d4916,null));};exports[_0x67fd('0x46')]=function(_0x4a3154,_0x24966b){return db[_0x67fd('0x3e')][_0x67fd('0x46')](_0x4a3154[_0x67fd('0x47')],{})[_0x67fd('0x25')](respondWithResult(_0x24966b,0xc9))[_0x67fd('0x40')](handleError(_0x24966b,null));};exports[_0x67fd('0x24')]=function(_0x39f8cc,_0x2062a0){if(_0x39f8cc[_0x67fd('0x47')]['id']){delete _0x39f8cc[_0x67fd('0x47')]['id'];}return db[_0x67fd('0x3e')][_0x67fd('0x48')]({'where':{'id':_0x39f8cc[_0x67fd('0x42')]['id']}})[_0x67fd('0x25')](handleEntityNotFound(_0x2062a0,null))['then'](saveUpdates(_0x39f8cc['body'],null))['then'](respondWithResult(_0x2062a0,null))[_0x67fd('0x40')](handleError(_0x2062a0,null));};exports[_0x67fd('0x49')]=function(_0x443d82,_0x35a80c){return db['DeskField']['find']({'where':{'id':_0x443d82['params']['id']}})[_0x67fd('0x25')](handleEntityNotFound(_0x35a80c,null))[_0x67fd('0x25')](removeEntity(_0x35a80c,null))[_0x67fd('0x40')](handleError(_0x35a80c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f4e0843..39ccc82 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 _0xf059=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util'];(function(_0x39a5cb,_0xa3e631){var _0xad0eaf=function(_0x50670d){while(--_0x50670d){_0x39a5cb['push'](_0x39a5cb['shift']());}};_0xad0eaf(++_0xa3e631);}(_0xf059,0x1ee));var _0x9f05=function(_0x4bd696,_0x1c6275){_0x4bd696=_0x4bd696-0x0;var _0x1d5a2d=_0xf059[_0x4bd696];return _0x1d5a2d;};'use strict';var _=require(_0x9f05('0x0'));var util=require(_0x9f05('0x1'));var logger=require(_0x9f05('0x2'))(_0x9f05('0x3'));var moment=require(_0x9f05('0x4'));var BPromise=require(_0x9f05('0x5'));var rp=require(_0x9f05('0x6'));var fs=require('fs');var path=require(_0x9f05('0x7'));var rimraf=require(_0x9f05('0x8'));var config=require('../../config/environment');var attributes=require(_0x9f05('0x9'));module[_0x9f05('0xa')]=function(_0xac09fb,_0x58be58){return _0xac09fb[_0x9f05('0xb')](_0x9f05('0xc'),attributes,{'tableName':_0x9f05('0xd'),'paranoid':![],'indexes':[{'name':_0x9f05('0xe'),'fields':[_0x9f05('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4292=['desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0x4292,0x83));var _0x2429=function(_0x4d3681,_0x136f19){_0x4d3681=_0x4d3681-0x0;var _0x22c7ac=_0x4292[_0x4d3681];return _0x22c7ac;};'use strict';var _=require(_0x2429('0x0'));var util=require('util');var logger=require(_0x2429('0x1'))(_0x2429('0x2'));var moment=require(_0x2429('0x3'));var BPromise=require(_0x2429('0x4'));var rp=require(_0x2429('0x5'));var fs=require('fs');var path=require(_0x2429('0x6'));var rimraf=require(_0x2429('0x7'));var config=require('../../config/environment');var attributes=require(_0x2429('0x8'));module[_0x2429('0x9')]=function(_0x5cd1f7,_0x1f02be){return _0x5cd1f7[_0x2429('0xa')](_0x2429('0xb'),attributes,{'tableName':_0x2429('0xc'),'paranoid':![],'indexes':[{'name':_0x2429('0xd'),'fields':[_0x2429('0xe'),_0x2429('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 89302ba..b4faeae 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 _0x3456=['rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3456,0x120));var _0x6345=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x3456[_0x2ff762];return _0x158b02;};'use strict';var _=require(_0x6345('0x0'));var util=require(_0x6345('0x1'));var moment=require(_0x6345('0x2'));var BPromise=require(_0x6345('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6345('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6345('0x5'));var logger=require('../../config/logger')(_0x6345('0x6'));var config=require(_0x6345('0x7'));var jayson=require(_0x6345('0x8'));var client=jayson[_0x6345('0x9')][_0x6345('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1809a2,_0x1ec8cc,_0x1cd64d){return new BPromise(function(_0x89175d,_0x501850){return client[_0x6345('0xb')](_0x1809a2,_0x1cd64d)['then'](function(_0x1af71a){logger[_0x6345('0xc')](_0x6345('0xd'),_0x1ec8cc,_0x6345('0xe'));logger['debug'](_0x6345('0xf'),_0x1ec8cc,'request\x20sent',JSON[_0x6345('0x10')](_0x1af71a));if(_0x1af71a[_0x6345('0x11')]){if(_0x1af71a[_0x6345('0x11')][_0x6345('0x12')]===0x1f4){logger[_0x6345('0x11')](_0x6345('0xd'),_0x1ec8cc,_0x1af71a[_0x6345('0x11')][_0x6345('0x13')]);return _0x501850(_0x1af71a[_0x6345('0x11')][_0x6345('0x13')]);}logger[_0x6345('0x11')](_0x6345('0xd'),_0x1ec8cc,_0x1af71a['error'][_0x6345('0x13')]);return _0x89175d(_0x1af71a[_0x6345('0x11')][_0x6345('0x13')]);}else{logger[_0x6345('0xc')]('DeskField,\x20%s,\x20%s',_0x1ec8cc,_0x6345('0xe'));_0x89175d(_0x1af71a['result'][_0x6345('0x13')]);}})[_0x6345('0x14')](function(_0x221350){logger['error']('DeskField,\x20%s,\x20%s',_0x1ec8cc,_0x221350);_0x501850(_0x221350);});});} \ No newline at end of file +var _0x51bd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x75aaf5,_0x2cbeee){var _0x2fb6d3=function(_0x1cea68){while(--_0x1cea68){_0x75aaf5['push'](_0x75aaf5['shift']());}};_0x2fb6d3(++_0x2cbeee);}(_0x51bd,0x181));var _0xd51b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x51bd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd51b('0x0'));var util=require(_0xd51b('0x1'));var moment=require(_0xd51b('0x2'));var BPromise=require(_0xd51b('0x3'));var rs=require(_0xd51b('0x4'));var fs=require('fs');var Redis=require(_0xd51b('0x5'));var db=require(_0xd51b('0x6'))['db'];var utils=require(_0xd51b('0x7'));var logger=require(_0xd51b('0x8'))(_0xd51b('0x9'));var config=require(_0xd51b('0xa'));var jayson=require(_0xd51b('0xb'));var client=jayson['client'][_0xd51b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6eddd5,_0x4cd5aa,_0x28c907){return new BPromise(function(_0x53749d,_0x5af440){return client[_0xd51b('0xd')](_0x6eddd5,_0x28c907)[_0xd51b('0xe')](function(_0x2dffba){logger[_0xd51b('0xf')](_0xd51b('0x10'),_0x4cd5aa,_0xd51b('0x11'));logger[_0xd51b('0x12')](_0xd51b('0x13'),_0x4cd5aa,_0xd51b('0x11'),JSON[_0xd51b('0x14')](_0x2dffba));if(_0x2dffba[_0xd51b('0x15')]){if(_0x2dffba[_0xd51b('0x15')][_0xd51b('0x16')]===0x1f4){logger['error'](_0xd51b('0x10'),_0x4cd5aa,_0x2dffba[_0xd51b('0x15')][_0xd51b('0x17')]);return _0x5af440(_0x2dffba[_0xd51b('0x15')][_0xd51b('0x17')]);}logger[_0xd51b('0x15')](_0xd51b('0x10'),_0x4cd5aa,_0x2dffba[_0xd51b('0x15')][_0xd51b('0x17')]);return _0x53749d(_0x2dffba['error'][_0xd51b('0x17')]);}else{logger[_0xd51b('0xf')](_0xd51b('0x10'),_0x4cd5aa,_0xd51b('0x11'));_0x53749d(_0x2dffba[_0xd51b('0x18')][_0xd51b('0x17')]);}})[_0xd51b('0x19')](function(_0x3701a4){logger['error'](_0xd51b('0x10'),_0x4cd5aa,_0x3701a4);_0x5af440(_0x3701a4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 30b68c6..3327656 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 _0x52de=['addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x5b6c74,_0x7bce92){var _0x50718c=function(_0x9b106c){while(--_0x9b106c){_0x5b6c74['push'](_0x5b6c74['shift']());}};_0x50718c(++_0x7bce92);}(_0x52de,0x78));var _0xe52d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x52de[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xe52d('0x0'));var util=require(_0xe52d('0x1'));var path=require(_0xe52d('0x2'));var timeout=require(_0xe52d('0x3'));var express=require(_0xe52d('0x4'));var router=express['Router']();var fs_extra=require(_0xe52d('0x5'));var auth=require(_0xe52d('0x6'));var interaction=require(_0xe52d('0x7'));var config=require(_0xe52d('0x8'));var controller=require(_0xe52d('0x9'));router['get']('/',auth[_0xe52d('0xa')](),controller['index']);router[_0xe52d('0xb')](_0xe52d('0xc'),auth[_0xe52d('0xa')](),controller[_0xe52d('0xd')]);router[_0xe52d('0xb')](_0xe52d('0xe'),auth[_0xe52d('0xa')](),controller[_0xe52d('0xf')]);router[_0xe52d('0xb')]('/:id/fields',auth[_0xe52d('0xa')](),controller[_0xe52d('0x10')]);router[_0xe52d('0x11')]('/',auth[_0xe52d('0xa')](),controller['create']);router[_0xe52d('0x11')](_0xe52d('0xe'),auth['isAuthenticated'](),controller[_0xe52d('0x12')]);router['put'](_0xe52d('0xc'),auth[_0xe52d('0xa')](),controller[_0xe52d('0x13')]);router[_0xe52d('0x14')](_0xe52d('0xc'),auth[_0xe52d('0xa')](),controller[_0xe52d('0x15')]);module[_0xe52d('0x16')]=router; \ No newline at end of file +var _0x05d1=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util'];(function(_0x4d2124,_0x2dbed5){var _0x228c0b=function(_0x43209e){while(--_0x43209e){_0x4d2124['push'](_0x4d2124['shift']());}};_0x228c0b(++_0x2dbed5);}(_0x05d1,0xbe));var _0x105d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x05d1[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x105d('0x0'));var util=require(_0x105d('0x1'));var path=require('path');var timeout=require(_0x105d('0x2'));var express=require('express');var router=express[_0x105d('0x3')]();var fs_extra=require(_0x105d('0x4'));var auth=require(_0x105d('0x5'));var interaction=require(_0x105d('0x6'));var config=require(_0x105d('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x105d('0x8')]('/',auth['isAuthenticated'](),controller[_0x105d('0x9')]);router[_0x105d('0x8')](_0x105d('0xa'),auth[_0x105d('0xb')](),controller[_0x105d('0xc')]);router[_0x105d('0x8')](_0x105d('0xd'),auth[_0x105d('0xb')](),controller[_0x105d('0xe')]);router['get'](_0x105d('0xf'),auth['isAuthenticated'](),controller[_0x105d('0x10')]);router[_0x105d('0x11')]('/',auth['isAuthenticated'](),controller[_0x105d('0x12')]);router[_0x105d('0x11')](_0x105d('0xd'),auth[_0x105d('0xb')](),controller[_0x105d('0x13')]);router[_0x105d('0x14')](_0x105d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x105d('0x15')](_0x105d('0xa'),auth['isAuthenticated'](),controller[_0x105d('0x16')]);module[_0x105d('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 f59c937..ef3b983 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 _0xe7de=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3c974f,_0x33a7db){var _0x157515=function(_0x504eb8){while(--_0x504eb8){_0x3c974f['push'](_0x3c974f['shift']());}};_0x157515(++_0x33a7db);}(_0xe7de,0x165));var _0xee7d=function(_0x45c1f4,_0x545c04){_0x45c1f4=_0x45c1f4-0x0;var _0x58a61a=_0xe7de[_0x45c1f4];return _0x58a61a;};'use strict';var Sequelize=require(_0xee7d('0x0'));module[_0xee7d('0x1')]={'name':{'type':Sequelize[_0xee7d('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xee7d('0x2')]},'tenantId':{'type':Sequelize[_0xee7d('0x2')]},'clientId':{'type':Sequelize[_0xee7d('0x2')]},'clientSecret':{'type':Sequelize[_0xee7d('0x2')]},'serverUrl':{'type':Sequelize[_0xee7d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xee7d('0x2')]},'modernAuthentication':{'type':Sequelize[_0xee7d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2e88=['BOOLEAN','sequelize','exports','STRING'];(function(_0x27fb50,_0x33a207){var _0x24a89a=function(_0x501e28){while(--_0x501e28){_0x27fb50['push'](_0x27fb50['shift']());}};_0x24a89a(++_0x33a207);}(_0x2e88,0x95));var _0x82e8=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x2e88[_0x576d8a];return _0x3dc3ef;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'name':{'type':Sequelize[_0x82e8('0x2')]},'username':{'type':Sequelize[_0x82e8('0x2')]},'password':{'type':Sequelize[_0x82e8('0x2')]},'remoteUri':{'type':Sequelize[_0x82e8('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x82e8('0x2')]},'clientSecret':{'type':Sequelize[_0x82e8('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x82e8('0x2')]},'modernAuthentication':{'type':Sequelize[_0x82e8('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 f14aa65..ee4f351 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 _0x3d09=['include','findAll','rows','params','intersection','options','find','catch','create','body','sort','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','Incident','title','description','customerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','4.0','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','limit','update','then','destroy','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','Dynamics365Account'];(function(_0x2d999a,_0x5e14c4){var _0x47bb97=function(_0x2b43e8){while(--_0x2b43e8){_0x2d999a['push'](_0x2d999a['shift']());}};_0x47bb97(++_0x5e14c4);}(_0x3d09,0x8c));var _0x93d0=function(_0x224b1f,_0x54b99d){_0x224b1f=_0x224b1f-0x0;var _0x2c176a=_0x3d09[_0x224b1f];return _0x2c176a;};'use strict';var rp=require(_0x93d0('0x0'));var util=require('util');var _=require(_0x93d0('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x93d0('0x2'));var db=require(_0x93d0('0x3'))['db'];var integrations=require(_0x93d0('0x4'));function respondWithResult(_0x296422,_0x14a206){_0x14a206=_0x14a206||0xc8;return function(_0x184ebf){if(_0x184ebf){return _0x296422[_0x93d0('0x5')](_0x14a206)[_0x93d0('0x6')](_0x184ebf);}};}function respondWithFilteredResult(_0x562278,_0x5e68f2){return function(_0x33f55f){if(_0x33f55f){var _0xd9caea=typeof _0x5e68f2['offset']===_0x93d0('0x7')&&typeof _0x5e68f2['limit']===_0x93d0('0x7');var _0x560a28=_0x33f55f[_0x93d0('0x8')];var _0x43b1e7=_0xd9caea?0x0:_0x5e68f2[_0x93d0('0x9')];var _0x56ebce=_0xd9caea?_0x33f55f[_0x93d0('0x8')]:_0x5e68f2[_0x93d0('0x9')]+_0x5e68f2[_0x93d0('0xa')];var _0x12fac6;if(_0x56ebce>=_0x560a28){_0x56ebce=_0x560a28;_0x12fac6=0xc8;}else{_0x12fac6=0xce;}_0x562278[_0x93d0('0x5')](_0x12fac6);return _0x562278['set']('Content-Range',_0x43b1e7+'-'+_0x56ebce+'/'+_0x560a28)[_0x93d0('0x6')](_0x33f55f);}return null;};}function saveUpdates(_0x4a1607){return function(_0x20a463){if(_0x20a463){return _0x20a463[_0x93d0('0xb')](_0x4a1607)[_0x93d0('0xc')](function(_0x2e7945){return _0x2e7945;});}return null;};}function removeEntity(_0x3decb2){return function(_0x2b566a){if(_0x2b566a){return _0x2b566a[_0x93d0('0xd')]()[_0x93d0('0xc')](function(){_0x3decb2['status'](0xcc)[_0x93d0('0xe')]();});}};}function handleEntityNotFound(_0x17d545){return function(_0x3703ed){if(!_0x3703ed){_0x17d545['sendStatus'](0x194);}return _0x3703ed;};}function handleError(_0x1b6831,_0x50467a){_0x50467a=_0x50467a||0x1f4;return function(_0x1645b7){logger[_0x93d0('0xf')](_0x1645b7[_0x93d0('0x10')]);if(_0x1645b7[_0x93d0('0x11')]){delete _0x1645b7[_0x93d0('0x11')];}_0x1b6831[_0x93d0('0x5')](_0x50467a)[_0x93d0('0x12')](_0x1645b7);};}exports[_0x93d0('0x13')]=function(_0xea1abb,_0xbb2c28){var _0x2fb66a={},_0x349923={},_0x47b701={'count':0x0,'rows':[]};var _0x34eed1=_['map'](db['Dynamics365Account'][_0x93d0('0x14')],function(_0x139512){return{'name':_0x139512['fieldName'],'type':_0x139512[_0x93d0('0x15')][_0x93d0('0x16')]};});_0x349923[_0x93d0('0x17')]=_[_0x93d0('0x18')](_0x34eed1,'name');_0x349923[_0x93d0('0x19')]=_[_0x93d0('0x1a')](_0xea1abb[_0x93d0('0x19')]);_0x349923[_0x93d0('0x1b')]=_['intersection'](_0x349923['model'],_0x349923[_0x93d0('0x19')]);_0x2fb66a['attributes']=_['intersection'](_0x349923[_0x93d0('0x17')],qs[_0x93d0('0x1c')](_0xea1abb['query'][_0x93d0('0x1c')]));_0x2fb66a[_0x93d0('0x1d')]=_0x2fb66a[_0x93d0('0x1d')][_0x93d0('0x1e')]?_0x2fb66a['attributes']:_0x349923[_0x93d0('0x17')];if(!_0xea1abb[_0x93d0('0x19')][_0x93d0('0x1f')](_0x93d0('0x20'))){_0x2fb66a[_0x93d0('0xa')]=qs[_0x93d0('0xa')](_0xea1abb[_0x93d0('0x19')][_0x93d0('0xa')]);_0x2fb66a[_0x93d0('0x9')]=qs[_0x93d0('0x9')](_0xea1abb[_0x93d0('0x19')]['offset']);}_0x2fb66a[_0x93d0('0x21')]=qs['sort'](_0xea1abb['query']['sort']);_0x2fb66a['where']=qs[_0x93d0('0x1b')](_[_0x93d0('0x22')](_0xea1abb[_0x93d0('0x19')],_0x349923[_0x93d0('0x1b')]),_0x34eed1);if(_0xea1abb[_0x93d0('0x19')][_0x93d0('0x23')]){_0x2fb66a['where']=_['merge'](_0x2fb66a[_0x93d0('0x24')],{'$or':_['map'](_0x34eed1,function(_0x4a74ee){if(_0x4a74ee['type']!==_0x93d0('0x25')){var _0x5e1ca8={};_0x5e1ca8[_0x4a74ee[_0x93d0('0x11')]]={'$like':'%'+_0xea1abb[_0x93d0('0x19')][_0x93d0('0x23')]+'%'};return _0x5e1ca8;}})});}_0x2fb66a=_[_0x93d0('0x26')]({},_0x2fb66a,_0xea1abb['options']);var _0x2edd51={'where':_0x2fb66a['where']};return db[_0x93d0('0x27')][_0x93d0('0x8')](_0x2edd51)['then'](function(_0x49ad6c){_0x47b701[_0x93d0('0x8')]=_0x49ad6c;if(_0xea1abb['query']['includeAll']){_0x2fb66a[_0x93d0('0x28')]=[{'all':!![]}];}return db[_0x93d0('0x27')][_0x93d0('0x29')](_0x2fb66a);})['then'](function(_0x28fc53){_0x47b701[_0x93d0('0x2a')]=_0x28fc53;return _0x47b701;})['then'](respondWithFilteredResult(_0xbb2c28,_0x2fb66a))['catch'](handleError(_0xbb2c28,null));};exports['show']=function(_0x1fbcbb,_0x1e4a7f){var _0x389cda={'raw':![],'where':{'id':_0x1fbcbb[_0x93d0('0x2b')]['id']}},_0x55547a={};_0x55547a[_0x93d0('0x17')]=_[_0x93d0('0x1a')](db['Dynamics365Account'][_0x93d0('0x14')]);_0x55547a[_0x93d0('0x19')]=_[_0x93d0('0x1a')](_0x1fbcbb[_0x93d0('0x19')]);_0x55547a['filters']=_[_0x93d0('0x2c')](_0x55547a['model'],_0x55547a[_0x93d0('0x19')]);_0x389cda['attributes']=_[_0x93d0('0x2c')](_0x55547a[_0x93d0('0x17')],qs[_0x93d0('0x1c')](_0x1fbcbb[_0x93d0('0x19')][_0x93d0('0x1c')]));_0x389cda['attributes']=_0x389cda['attributes'][_0x93d0('0x1e')]?_0x389cda['attributes']:_0x55547a[_0x93d0('0x17')];if(_0x1fbcbb[_0x93d0('0x19')]['includeAll']){_0x389cda['include']=[{'all':!![]}];}_0x389cda=_[_0x93d0('0x26')]({},_0x389cda,_0x1fbcbb[_0x93d0('0x2d')]);return db[_0x93d0('0x27')][_0x93d0('0x2e')](_0x389cda)['then'](handleEntityNotFound(_0x1e4a7f,null))[_0x93d0('0xc')](respondWithResult(_0x1e4a7f,null))[_0x93d0('0x2f')](handleError(_0x1e4a7f,null));};exports['create']=function(_0x4b138b,_0x12ad81){return db['Dynamics365Account'][_0x93d0('0x30')](_0x4b138b['body'],{})[_0x93d0('0xc')](respondWithResult(_0x12ad81,0xc9))['catch'](handleError(_0x12ad81,null));};exports[_0x93d0('0xb')]=function(_0xdb516f,_0x4ed32a){if(_0xdb516f[_0x93d0('0x31')]['id']){delete _0xdb516f['body']['id'];}return db[_0x93d0('0x27')]['find']({'where':{'id':_0xdb516f[_0x93d0('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4ed32a,null))['then'](saveUpdates(_0xdb516f[_0x93d0('0x31')],null))['then'](respondWithResult(_0x4ed32a,null))[_0x93d0('0x2f')](handleError(_0x4ed32a,null));};exports[_0x93d0('0xd')]=function(_0x491004,_0x331df5){return db['Dynamics365Account'][_0x93d0('0x2e')]({'where':{'id':_0x491004[_0x93d0('0x2b')]['id']}})[_0x93d0('0xc')](handleEntityNotFound(_0x331df5,null))[_0x93d0('0xc')](removeEntity(_0x331df5,null))[_0x93d0('0x2f')](handleError(_0x331df5,null));};exports['getConfigurations']=function(_0xe4206,_0x1276bb){var _0x249dc2={};var _0x36f9b7={};var _0x3a48ff;var _0x5276e1;return db['Dynamics365Account']['findOne']({'where':{'id':_0xe4206[_0x93d0('0x2b')]['id']}})[_0x93d0('0xc')](handleEntityNotFound(_0x1276bb,null))[_0x93d0('0xc')](function(_0x4e074d){if(_0x4e074d){_0x3a48ff=_0x4e074d;_0x36f9b7['model']=_[_0x93d0('0x1a')](db['Dynamics365Configuration'][_0x93d0('0x14')]);_0x36f9b7[_0x93d0('0x19')]=_[_0x93d0('0x1a')](_0xe4206['query']);_0x36f9b7[_0x93d0('0x1b')]=_['intersection'](_0x36f9b7[_0x93d0('0x17')],_0x36f9b7[_0x93d0('0x19')]);_0x249dc2[_0x93d0('0x1d')]=_[_0x93d0('0x2c')](_0x36f9b7[_0x93d0('0x17')],qs[_0x93d0('0x1c')](_0xe4206[_0x93d0('0x19')]['fields']));_0x249dc2[_0x93d0('0x1d')]=_0x249dc2['attributes'][_0x93d0('0x1e')]?_0x249dc2['attributes']:_0x36f9b7[_0x93d0('0x17')];_0x249dc2[_0x93d0('0x21')]=qs[_0x93d0('0x32')](_0xe4206[_0x93d0('0x19')]['sort']);_0x249dc2[_0x93d0('0x24')]=qs[_0x93d0('0x1b')](_['pick'](_0xe4206['query'],_0x36f9b7[_0x93d0('0x1b')]));if(_0xe4206['query'][_0x93d0('0x23')]){_0x249dc2[_0x93d0('0x24')]=_[_0x93d0('0x26')](_0x249dc2[_0x93d0('0x24')],{'$or':_[_0x93d0('0x18')](_0x249dc2[_0x93d0('0x1d')],function(_0x210746){var _0x2c467a={};_0x2c467a[_0x210746]={'$like':'%'+_0xe4206[_0x93d0('0x19')][_0x93d0('0x23')]+'%'};return _0x2c467a;})});}_0x249dc2=_[_0x93d0('0x26')]({},_0x249dc2,_0xe4206['options']);return _0x3a48ff[_0x93d0('0x33')](_0x249dc2);}})[_0x93d0('0xc')](function(_0x5225d5){if(_0x5225d5){_0x5276e1=_0x5225d5['length'];if(!_0xe4206[_0x93d0('0x19')]['hasOwnProperty']('nolimit')){_0x249dc2['limit']=qs[_0x93d0('0xa')](_0xe4206['query'][_0x93d0('0xa')]);_0x249dc2['offset']=qs[_0x93d0('0x9')](_0xe4206[_0x93d0('0x19')]['offset']);}return _0x3a48ff[_0x93d0('0x33')](_0x249dc2);}})[_0x93d0('0xc')](function(_0x3f20b2){if(_0x3f20b2){return _0x3f20b2?{'count':_0x5276e1,'rows':_0x3f20b2}:null;}})['then'](respondWithResult(_0x1276bb,null))[_0x93d0('0x2f')](handleError(_0x1276bb,null));};exports[_0x93d0('0x34')]=function(_0x100f84,_0x5495ec){if(_0x100f84[_0x93d0('0x31')]['id']){delete _0x100f84[_0x93d0('0x31')]['id'];}return db[_0x93d0('0x27')][_0x93d0('0x35')]({'where':{'id':_0x100f84[_0x93d0('0x2b')]['id']}})[_0x93d0('0xc')](handleEntityNotFound(_0x5495ec,null))['then'](function(_0x4fac6b){if(_0x4fac6b){_0x100f84[_0x93d0('0x31')][_0x93d0('0x36')]=_0x4fac6b['id'];_0x100f84[_0x93d0('0x31')][_0x93d0('0x37')]=integrations[_0x93d0('0x38')](_0x100f84['body']['channel'],_0x100f84['body']['type']);_0x100f84[_0x93d0('0x31')][_0x93d0('0x39')]=integrations[_0x93d0('0x3a')](_0x100f84[_0x93d0('0x31')][_0x93d0('0x3b')],_0x100f84[_0x93d0('0x31')][_0x93d0('0x15')]);return db[_0x93d0('0x3c')][_0x93d0('0x30')](_0x100f84['body'],{'include':[{'model':db[_0x93d0('0x3d')],'as':_0x93d0('0x37')},{'model':db[_0x93d0('0x3d')],'as':_0x93d0('0x39')}]});}return null;})[_0x93d0('0xc')](respondWithResult(_0x5495ec,null))['catch'](handleError(_0x5495ec,null));};function sanitizeRemoteUri(_0x48cff1){var _0x5cc45e=_0x48cff1[_0x93d0('0x3e')](-0x1);if(_0x5cc45e==='/')return _0x48cff1[_0x93d0('0x3f')](0x0,_0x48cff1[_0x93d0('0x40')](_0x5cc45e));return _0x48cff1;}function getWebApiUrl(_0x2e941b){return util['format'](_0x93d0('0x41'),_0x2e941b);}exports['getFields']=function(_0x22e9ab,_0xe6537f){var _0x5ad1e4=_0x22e9ab[_0x93d0('0x19')][_0x93d0('0x42')];var _0x154f4f=_0x5ad1e4==='incident'?_0x93d0('0x43'):'PhoneCall';var _0x397950='';var _0x17513e='';var _0x4c45ce='';var _0x281780='';var _0x3de49e='';var _0x406127='';var _0x48e649='';var _0x384321='';var _0x3650a2=[_0x93d0('0x44'),_0x93d0('0x45'),_0x93d0('0x46'),'ownerid',_0x93d0('0x47'),_0x93d0('0x48'),_0x93d0('0x49'),'regardingobjectid','directioncode',_0x93d0('0x4a')];var _0x4a301c=[_0x93d0('0x4b'),'accountidyominame',_0x93d0('0x4c'),_0x93d0('0x4d'),'contactidname','contactidyominame',_0x93d0('0x4e'),'contractidname',_0x93d0('0x4f'),_0x93d0('0x50'),'createdbyname',_0x93d0('0x51'),'createdon',_0x93d0('0x52'),_0x93d0('0x53'),'customeridname',_0x93d0('0x54'),_0x93d0('0x55'),'emailaddress',_0x93d0('0x56'),'entityimage_timestamp',_0x93d0('0x57'),'escalatedon',_0x93d0('0x58'),_0x93d0('0x59'),'followupby',_0x93d0('0x5a'),_0x93d0('0x5b'),_0x93d0('0x5c'),_0x93d0('0x5d'),'masteridname',_0x93d0('0x5e'),_0x93d0('0x5f'),_0x93d0('0x60'),_0x93d0('0x61'),_0x93d0('0x62'),_0x93d0('0x63'),_0x93d0('0x64'),_0x93d0('0x65'),_0x93d0('0x66'),_0x93d0('0x67'),'onholdtime',_0x93d0('0x68'),_0x93d0('0x69'),'owneridtype',_0x93d0('0x6a'),_0x93d0('0x6b'),_0x93d0('0x6c'),_0x93d0('0x6d'),_0x93d0('0x6e'),_0x93d0('0x6f'),_0x93d0('0x70'),_0x93d0('0x71'),_0x93d0('0x72'),'responseby',_0x93d0('0x73'),_0x93d0('0x74'),_0x93d0('0x75'),_0x93d0('0x76'),_0x93d0('0x77'),_0x93d0('0x78'),_0x93d0('0x79'),_0x93d0('0x7a'),_0x93d0('0x7b'),_0x93d0('0x7c'),_0x93d0('0x7d'),'transactioncurrencyidname',_0x93d0('0x7e'),'utcconversiontimezonecode',_0x93d0('0x7f')];var _0x23f7a2=_0x3650a2[_0x93d0('0x80')](_0x4a301c);return db[_0x93d0('0x27')]['findOne']({'where':{'id':_0x22e9ab['params']['id']},'attributes':['id',_0x93d0('0x81'),_0x93d0('0x82'),_0x93d0('0x83'),_0x93d0('0x84'),_0x93d0('0x85'),'clientSecret',_0x93d0('0x86')],'include':[{'model':db['CloudProvider'],'as':_0x93d0('0x87'),'attributes':['id',_0x93d0('0x88'),_0x93d0('0x89')]}]})[_0x93d0('0xc')](handleEntityNotFound(_0xe6537f,null))[_0x93d0('0xc')](function(_0x175ff3){if(_0x175ff3){if(_0x175ff3[_0x93d0('0x86')]){_0x175ff3['access_token']=_0x175ff3['CloudProvider']['data5'];_0x384321=sanitizeRemoteUri(_0x175ff3[_0x93d0('0x87')][_0x93d0('0x89')]);_0x48e649=getWebApiUrl(_0x384321);return _0x175ff3;}_0x384321=sanitizeRemoteUri(_0x175ff3[_0x93d0('0x83')]);_0x48e649=getWebApiUrl(_0x384321);var _0x59c242={'method':'POST','uri':_0x93d0('0x8a')+_0x175ff3['tenantId']+'/oauth2/token','form':{'client_id':_0x175ff3[_0x93d0('0x85')],'resource':_0x384321,'username':_0x175ff3[_0x93d0('0x81')],'password':_0x175ff3[_0x93d0('0x82')],'grant_type':_0x93d0('0x82'),'client_secret':_0x175ff3[_0x93d0('0x8b')]},'json':!![]};return rp(_0x59c242);}})[_0x93d0('0xc')](function(_0x2b80ca){_0x406127=_0x2b80ca['access_token'];var _0x2c3c92={'method':_0x93d0('0x8c'),'uri':encodeURI(_0x48e649+_0x93d0('0x8d')+_0x154f4f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x406127,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c3c92);})[_0x93d0('0xc')](function(_0x33fe5b){var _0x5b958d=_0x33fe5b[_0x93d0('0x8e')][0x0];var _0x542c3a=_0x5b958d[_0x93d0('0x8f')];var _0x419c15={'method':_0x93d0('0x8c'),'uri':_0x48e649+_0x93d0('0x90')+_0x542c3a+_0x93d0('0x91'),'headers':{'Authorization':_0x93d0('0x92')+_0x406127,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x419c15);})[_0x93d0('0xc')](function(_0x91affb){_0x397950=_0x91affb;_0x17513e=_0x397950[_0x93d0('0x93')];_0x17513e=_[_0x93d0('0x94')](_0x17513e,function(_0x4533b2){return!_0x23f7a2[_0x93d0('0x95')](_0x4533b2[_0x93d0('0x96')]);});var _0x1274b5=[];var _0x504e0f=[];_0x17513e[_0x93d0('0x97')](function(_0x3143b3){if(_0x3143b3[_0x93d0('0x98')]){var _0x22738e=_0x3143b3[_0x93d0('0x98')][_0x93d0('0x3f')](_0x3143b3[_0x93d0('0x98')][_0x93d0('0x40')]('.')+0x1);if(_0x22738e===_0x93d0('0x99')){_0x1274b5[_0x93d0('0x9a')](getSelectList(_0x48e649,_0x5ad1e4,_0x504e0f,_0x397950['MetadataId'],_0x3143b3['MetadataId'],_0x406127));}}});return Promise['all'](_0x1274b5);})[_0x93d0('0xc')](function(_0x3d2bdc){_0x4c45ce=_0x3d2bdc[0x0];var _0x11393a=[];var _0x109c42=[];_0x17513e[_0x93d0('0x97')](function(_0x44d563){if(!_[_0x93d0('0x9b')](_0x44d563[_0x93d0('0x98')])){var _0x4c1273=_0x44d563[_0x93d0('0x98')][_0x93d0('0x3f')](_0x44d563[_0x93d0('0x98')][_0x93d0('0x40')]('.')+0x1);if(_0x4c1273===_0x93d0('0x9c')){_0x11393a[_0x93d0('0x9a')](getBooleanList(_0x48e649,_0x5ad1e4,_0x109c42,_0x397950[_0x93d0('0x8f')],_0x44d563['MetadataId'],_0x406127));}}});return Promise[_0x93d0('0x9d')](_0x11393a);})['then'](function(_0x5c1556){_0x281780=_0x5c1556[0x0];var _0x1f3aee=[];var _0x1c9790=[];_0x17513e[_0x93d0('0x97')](function(_0x246c45){if(_0x246c45[_0x93d0('0x98')]){var _0x42e278=_0x246c45[_0x93d0('0x98')]['substring'](_0x246c45[_0x93d0('0x98')][_0x93d0('0x40')]('.')+0x1);if(_0x42e278===_0x93d0('0x9e')||_0x42e278==='DoubleAttributeMetadata'||_0x42e278===_0x93d0('0x9f')||_0x42e278==='IntegerAttributeMetadata'||_0x42e278===_0x93d0('0xa0')||_0x42e278===_0x93d0('0xa1')||_0x42e278==='StatusAttributeMetadata'||_0x42e278===_0x93d0('0xa2')||_0x42e278==='StateAttributeMetadata'||_0x42e278===_0x93d0('0xa3')){_0x1f3aee[_0x93d0('0x9a')](getInputList(_0x48e649,_0x5ad1e4,_0x42e278,_0x1c9790,_0x397950[_0x93d0('0x8f')],_0x246c45[_0x93d0('0x8f')],_0x406127));}}});return Promise['all'](_0x1f3aee);})[_0x93d0('0xc')](function(_0x4f7d1f){_0x3de49e=_0x4f7d1f[0x0];var _0x43093f=_0x4c45ce[_0x93d0('0x80')](_0x281780)['concat'](_0x3de49e);var _0x31825c={'count':_0x43093f[_0x93d0('0x1e')],'rows':_0x43093f};return _0x31825c;})['then'](respondWithResult(_0xe6537f,null))[_0x93d0('0x2f')](function(_0x3e26d3){var _0x215be6=_0x22e9ab['query'][_0x93d0('0xa4')]?0x1f4:_0x3e26d3[_0x93d0('0xa5')]||0x1f4;logger['error'](_0x3e26d3[_0x93d0('0x10')]);delete _0x3e26d3[_0x93d0('0x11')];if(_0x215be6===0x191){_0x215be6=0x190;}_0xe6537f['status'](_0x215be6)[_0x93d0('0x12')](_0x22e9ab[_0x93d0('0x19')]['test']?{'message':_0x93d0('0xa6'),'statusCode':_0x3e26d3[_0x93d0('0xa5')]}:_0x3e26d3);});};function getSelectList(_0x489327,_0x10415a,_0x39609e,_0x2556f5,_0x482737,_0x5b37d0){var _0x5d248c={'method':_0x93d0('0x8c'),'uri':_0x489327+_0x93d0('0x90')+_0x2556f5+_0x93d0('0xa7')+_0x482737+_0x93d0('0xa8')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x5b37d0,'If-None-Match':null,'OData-Version':_0x93d0('0xa9')},'json':!![]};return rp(_0x5d248c)[_0x93d0('0xc')](function(_0x2d9db7){var _0x32c26d=[];var _0x333479=_0x2d9db7[_0x93d0('0xaa')][_0x93d0('0xab')];_0x333479[_0x93d0('0x97')](function(_0x1d5978){_0x32c26d['push']({'name':_0x1d5978[_0x93d0('0xac')][_0x93d0('0xad')][_0x93d0('0xac')],'value':String(_0x1d5978['Value'])});});var _0x16e372={'id':_0x10415a+'_'+_0x2d9db7[_0x93d0('0x96')],'name':_0x2d9db7[_0x93d0('0xae')][_0x93d0('0xad')][_0x93d0('0xac')],'custom':![],'options':_0x32c26d};_0x39609e[_0x93d0('0x9a')](_0x16e372);return _0x39609e;});}function getBooleanList(_0x5b949e,_0x230e5c,_0x409fd2,_0x57e063,_0x1333ca,_0x2c37bc){var _0x1c145c={'method':_0x93d0('0x8c'),'uri':_0x5b949e+_0x93d0('0x90')+_0x57e063+_0x93d0('0xa7')+_0x1333ca+_0x93d0('0xaf'),'headers':{'Authorization':'Bearer\x20'+_0x2c37bc,'If-None-Match':null,'OData-Version':_0x93d0('0xa9')},'json':!![]};return rp(_0x1c145c)['then'](function(_0x41beb9){var _0x1a3d6d=[];_0x1a3d6d['push']({'name':_0x41beb9['OptionSet']['TrueOption'][_0x93d0('0xac')][_0x93d0('0xad')][_0x93d0('0xac')],'value':_0x93d0('0xb0')},{'name':_0x41beb9[_0x93d0('0xaa')][_0x93d0('0xb1')][_0x93d0('0xac')][_0x93d0('0xad')][_0x93d0('0xac')],'value':'false'});var _0x3c07df={'id':_0x230e5c+'_'+_0x41beb9[_0x93d0('0x96')],'name':_0x41beb9['DisplayName']['UserLocalizedLabel'][_0x93d0('0xac')],'custom':![],'options':_0x1a3d6d};_0x409fd2[_0x93d0('0x9a')](_0x3c07df);return _0x409fd2;});}function getInputList(_0x33f16c,_0x4481e3,_0x29ffea,_0x28873f,_0x1d8428,_0x160484,_0x34cf50){var _0x1bca3d={'method':_0x93d0('0x8c'),'uri':_0x33f16c+_0x93d0('0x90')+_0x1d8428+_0x93d0('0xa7')+_0x160484+_0x93d0('0xb2')+_0x29ffea+_0x93d0('0xb3'),'headers':{'Authorization':_0x93d0('0x92')+_0x34cf50,'If-None-Match':null,'OData-Version':_0x93d0('0xa9')},'json':!![]};return rp(_0x1bca3d)[_0x93d0('0xc')](function(_0x110cb8){var _0x26acf2={'id':_0x4481e3+'_'+_0x110cb8[_0x93d0('0x96')],'name':_0x110cb8[_0x93d0('0xae')]['UserLocalizedLabel']?_0x110cb8[_0x93d0('0xae')][_0x93d0('0xad')]['Label']:_0x110cb8[_0x93d0('0x96')],'custom':![],'options':[]};_0x28873f[_0x93d0('0x9a')](_0x26acf2);return _0x28873f;});} \ No newline at end of file +var _0x5433=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','create','catch','update','body','params','findOne','Dynamics365Configuration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','forEach','@odata.type','substring','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x49b48b,_0x313a85){var _0x398600=function(_0x15d493){while(--_0x15d493){_0x49b48b['push'](_0x49b48b['shift']());}};_0x398600(++_0x313a85);}(_0x5433,0x9f));var _0x3543=function(_0x5da8ca,_0x23a13e){_0x5da8ca=_0x5da8ca-0x0;var _0xab1cbe=_0x5433[_0x5da8ca];return _0xab1cbe;};'use strict';var rp=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var _=require(_0x3543('0x2'));var qs=require(_0x3543('0x3'));var logger=require(_0x3543('0x4'))(_0x3543('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3543('0x6'));function respondWithResult(_0x25b3bc,_0x50e695){_0x50e695=_0x50e695||0xc8;return function(_0x4a111b){if(_0x4a111b){return _0x25b3bc[_0x3543('0x7')](_0x50e695)[_0x3543('0x8')](_0x4a111b);}};}function respondWithFilteredResult(_0x174902,_0x34abfe){return function(_0x5e8b5d){if(_0x5e8b5d){var _0x24794a=typeof _0x34abfe[_0x3543('0x9')]==='undefined'&&typeof _0x34abfe[_0x3543('0xa')]===_0x3543('0xb');var _0x382389=_0x5e8b5d[_0x3543('0xc')];var _0x5316a2=_0x24794a?0x0:_0x34abfe[_0x3543('0x9')];var _0x5b097f=_0x24794a?_0x5e8b5d[_0x3543('0xc')]:_0x34abfe[_0x3543('0x9')]+_0x34abfe[_0x3543('0xa')];var _0x1da35c;if(_0x5b097f>=_0x382389){_0x5b097f=_0x382389;_0x1da35c=0xc8;}else{_0x1da35c=0xce;}_0x174902[_0x3543('0x7')](_0x1da35c);return _0x174902[_0x3543('0xd')](_0x3543('0xe'),_0x5316a2+'-'+_0x5b097f+'/'+_0x382389)['json'](_0x5e8b5d);}return null;};}function saveUpdates(_0x519093){return function(_0x435b1f){if(_0x435b1f){return _0x435b1f['update'](_0x519093)[_0x3543('0xf')](function(_0xfc8986){return _0xfc8986;});}return null;};}function removeEntity(_0x2b981b){return function(_0x589823){if(_0x589823){return _0x589823[_0x3543('0x10')]()['then'](function(){_0x2b981b[_0x3543('0x7')](0xcc)[_0x3543('0x11')]();});}};}function handleEntityNotFound(_0xc9c970){return function(_0x1a1f7d){if(!_0x1a1f7d){_0xc9c970['sendStatus'](0x194);}return _0x1a1f7d;};}function handleError(_0x545e65,_0x39b8f2){_0x39b8f2=_0x39b8f2||0x1f4;return function(_0xb315bb){logger['error'](_0xb315bb[_0x3543('0x12')]);if(_0xb315bb[_0x3543('0x13')]){delete _0xb315bb[_0x3543('0x13')];}_0x545e65[_0x3543('0x7')](_0x39b8f2)['send'](_0xb315bb);};}exports[_0x3543('0x14')]=function(_0x50480b,_0x97a8ba){var _0x12eb8b={},_0x52794d={},_0xbf94f6={'count':0x0,'rows':[]};var _0x325ac6=_[_0x3543('0x15')](db[_0x3543('0x16')][_0x3543('0x17')],function(_0x33f065){return{'name':_0x33f065[_0x3543('0x18')],'type':_0x33f065[_0x3543('0x19')]['key']};});_0x52794d[_0x3543('0x1a')]=_[_0x3543('0x15')](_0x325ac6,'name');_0x52794d[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x50480b[_0x3543('0x1b')]);_0x52794d[_0x3543('0x1d')]=_[_0x3543('0x1e')](_0x52794d['model'],_0x52794d[_0x3543('0x1b')]);_0x12eb8b[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x52794d[_0x3543('0x1a')],qs['fields'](_0x50480b[_0x3543('0x1b')][_0x3543('0x20')]));_0x12eb8b[_0x3543('0x1f')]=_0x12eb8b[_0x3543('0x1f')][_0x3543('0x21')]?_0x12eb8b['attributes']:_0x52794d[_0x3543('0x1a')];if(!_0x50480b[_0x3543('0x1b')][_0x3543('0x22')](_0x3543('0x23'))){_0x12eb8b['limit']=qs['limit'](_0x50480b[_0x3543('0x1b')]['limit']);_0x12eb8b[_0x3543('0x9')]=qs['offset'](_0x50480b['query'][_0x3543('0x9')]);}_0x12eb8b[_0x3543('0x24')]=qs[_0x3543('0x25')](_0x50480b['query'][_0x3543('0x25')]);_0x12eb8b[_0x3543('0x26')]=qs[_0x3543('0x1d')](_[_0x3543('0x27')](_0x50480b[_0x3543('0x1b')],_0x52794d[_0x3543('0x1d')]),_0x325ac6);if(_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]){_0x12eb8b[_0x3543('0x26')]=_['merge'](_0x12eb8b['where'],{'$or':_[_0x3543('0x15')](_0x325ac6,function(_0x3a8522){if(_0x3a8522[_0x3543('0x19')]!==_0x3543('0x29')){var _0x282b58={};_0x282b58[_0x3a8522[_0x3543('0x13')]]={'$like':'%'+_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]+'%'};return _0x282b58;}})});}_0x12eb8b=_[_0x3543('0x2a')]({},_0x12eb8b,_0x50480b[_0x3543('0x2b')]);var _0x326395={'where':_0x12eb8b[_0x3543('0x26')]};return db[_0x3543('0x16')][_0x3543('0xc')](_0x326395)[_0x3543('0xf')](function(_0x164ef8){_0xbf94f6[_0x3543('0xc')]=_0x164ef8;if(_0x50480b[_0x3543('0x1b')]['includeAll']){_0x12eb8b[_0x3543('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3543('0x2d')](_0x12eb8b);})[_0x3543('0xf')](function(_0x225bc2){_0xbf94f6[_0x3543('0x2e')]=_0x225bc2;return _0xbf94f6;})[_0x3543('0xf')](respondWithFilteredResult(_0x97a8ba,_0x12eb8b))['catch'](handleError(_0x97a8ba,null));};exports[_0x3543('0x2f')]=function(_0x52a302,_0x4d7c8){var _0x32cbe2={'raw':![],'where':{'id':_0x52a302['params']['id']}},_0x462b45={};_0x462b45[_0x3543('0x1a')]=_[_0x3543('0x1c')](db[_0x3543('0x16')][_0x3543('0x17')]);_0x462b45['query']=_[_0x3543('0x1c')](_0x52a302['query']);_0x462b45[_0x3543('0x1d')]=_['intersection'](_0x462b45['model'],_0x462b45['query']);_0x32cbe2[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x462b45['model'],qs[_0x3543('0x20')](_0x52a302[_0x3543('0x1b')]['fields']));_0x32cbe2['attributes']=_0x32cbe2['attributes'][_0x3543('0x21')]?_0x32cbe2[_0x3543('0x1f')]:_0x462b45['model'];if(_0x52a302['query'][_0x3543('0x30')]){_0x32cbe2[_0x3543('0x2c')]=[{'all':!![]}];}_0x32cbe2=_['merge']({},_0x32cbe2,_0x52a302['options']);return db[_0x3543('0x16')][_0x3543('0x31')](_0x32cbe2)[_0x3543('0xf')](handleEntityNotFound(_0x4d7c8,null))[_0x3543('0xf')](respondWithResult(_0x4d7c8,null))['catch'](handleError(_0x4d7c8,null));};exports['create']=function(_0x5c47bb,_0x478405){return db[_0x3543('0x16')][_0x3543('0x32')](_0x5c47bb['body'],{})['then'](respondWithResult(_0x478405,0xc9))[_0x3543('0x33')](handleError(_0x478405,null));};exports[_0x3543('0x34')]=function(_0x300fae,_0x76417a){if(_0x300fae[_0x3543('0x35')]['id']){delete _0x300fae[_0x3543('0x35')]['id'];}return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x300fae[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x76417a,null))[_0x3543('0xf')](saveUpdates(_0x300fae['body'],null))[_0x3543('0xf')](respondWithResult(_0x76417a,null))[_0x3543('0x33')](handleError(_0x76417a,null));};exports[_0x3543('0x10')]=function(_0x2b89e4,_0x39afb6){return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x2b89e4[_0x3543('0x36')]['id']}})['then'](handleEntityNotFound(_0x39afb6,null))[_0x3543('0xf')](removeEntity(_0x39afb6,null))[_0x3543('0x33')](handleError(_0x39afb6,null));};exports['getConfigurations']=function(_0x4c7ce6,_0x561141){var _0x2f9b44={};var _0x5b7b83={};var _0x5dc169;var _0x20aa2d;return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x4c7ce6[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x561141,null))['then'](function(_0x50736c){if(_0x50736c){_0x5dc169=_0x50736c;_0x5b7b83['model']=_[_0x3543('0x1c')](db[_0x3543('0x38')][_0x3543('0x17')]);_0x5b7b83[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x4c7ce6[_0x3543('0x1b')]);_0x5b7b83['filters']=_[_0x3543('0x1e')](_0x5b7b83['model'],_0x5b7b83[_0x3543('0x1b')]);_0x2f9b44['attributes']=_[_0x3543('0x1e')](_0x5b7b83[_0x3543('0x1a')],qs[_0x3543('0x20')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x20')]));_0x2f9b44[_0x3543('0x1f')]=_0x2f9b44[_0x3543('0x1f')][_0x3543('0x21')]?_0x2f9b44[_0x3543('0x1f')]:_0x5b7b83['model'];_0x2f9b44[_0x3543('0x24')]=qs['sort'](_0x4c7ce6[_0x3543('0x1b')]['sort']);_0x2f9b44['where']=qs['filters'](_[_0x3543('0x27')](_0x4c7ce6[_0x3543('0x1b')],_0x5b7b83[_0x3543('0x1d')]));if(_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x28')]){_0x2f9b44[_0x3543('0x26')]=_[_0x3543('0x2a')](_0x2f9b44[_0x3543('0x26')],{'$or':_[_0x3543('0x15')](_0x2f9b44[_0x3543('0x1f')],function(_0x527427){var _0x33a474={};_0x33a474[_0x527427]={'$like':'%'+_0x4c7ce6['query'][_0x3543('0x28')]+'%'};return _0x33a474;})});}_0x2f9b44=_[_0x3543('0x2a')]({},_0x2f9b44,_0x4c7ce6[_0x3543('0x2b')]);return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})[_0x3543('0xf')](function(_0x5d67c3){if(_0x5d67c3){_0x20aa2d=_0x5d67c3[_0x3543('0x21')];if(!_0x4c7ce6[_0x3543('0x1b')]['hasOwnProperty'](_0x3543('0x23'))){_0x2f9b44['limit']=qs['limit'](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0xa')]);_0x2f9b44[_0x3543('0x9')]=qs[_0x3543('0x9')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x9')]);}return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})['then'](function(_0x4fc5cc){if(_0x4fc5cc){return _0x4fc5cc?{'count':_0x20aa2d,'rows':_0x4fc5cc}:null;}})[_0x3543('0xf')](respondWithResult(_0x561141,null))[_0x3543('0x33')](handleError(_0x561141,null));};exports['addConfiguration']=function(_0x5738d8,_0x45e291){if(_0x5738d8['body']['id']){delete _0x5738d8['body']['id'];}return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x5738d8['params']['id']}})['then'](handleEntityNotFound(_0x45e291,null))[_0x3543('0xf')](function(_0x20dd04){if(_0x20dd04){_0x5738d8['body'][_0x3543('0x3a')]=_0x20dd04['id'];_0x5738d8[_0x3543('0x35')][_0x3543('0x3b')]=integrations['getSubjects'](_0x5738d8['body'][_0x3543('0x3c')],_0x5738d8[_0x3543('0x35')]['type']);_0x5738d8[_0x3543('0x35')][_0x3543('0x3d')]=integrations[_0x3543('0x3e')](_0x5738d8[_0x3543('0x35')][_0x3543('0x3c')],_0x5738d8['body'][_0x3543('0x19')]);return db['Dynamics365Configuration']['create'](_0x5738d8[_0x3543('0x35')],{'include':[{'model':db[_0x3543('0x3f')],'as':_0x3543('0x3b')},{'model':db[_0x3543('0x3f')],'as':'Descriptions'}]});}return null;})[_0x3543('0xf')](respondWithResult(_0x45e291,null))[_0x3543('0x33')](handleError(_0x45e291,null));};function sanitizeRemoteUri(_0x45ae19){var _0xd70658=_0x45ae19[_0x3543('0x40')](-0x1);if(_0xd70658==='/')return _0x45ae19['substring'](0x0,_0x45ae19[_0x3543('0x41')](_0xd70658));return _0x45ae19;}function getWebApiUrl(_0x150f0f){return util[_0x3543('0x42')](_0x3543('0x43'),_0x150f0f);}exports[_0x3543('0x44')]=function(_0x49755a,_0x4a6e10){var _0x844aea=_0x49755a[_0x3543('0x1b')][_0x3543('0x45')];var _0x2c9602=_0x844aea==='incident'?_0x3543('0x46'):'PhoneCall';var _0x2c6581='';var _0x16e304='';var _0x30f50e='';var _0x626193='';var _0x188d49='';var _0x39a64d='';var _0x3bd391='';var _0x1621ad='';var _0x57f676=[_0x3543('0x47'),_0x3543('0x48'),_0x3543('0x49'),_0x3543('0x4a'),_0x3543('0x4b'),_0x3543('0x4c'),'phonenumber',_0x3543('0x4d'),'directioncode',_0x3543('0x4e')];var _0x33b17a=[_0x3543('0x4f'),_0x3543('0x50'),_0x3543('0x51'),_0x3543('0x52'),_0x3543('0x53'),_0x3543('0x54'),_0x3543('0x55'),_0x3543('0x56'),'createdbyexternalpartyname',_0x3543('0x57'),'createdbyname',_0x3543('0x58'),'createdon',_0x3543('0x59'),_0x3543('0x5a'),_0x3543('0x5b'),'customeridtype',_0x3543('0x5c'),_0x3543('0x5d'),'entitlementidname',_0x3543('0x5e'),_0x3543('0x5f'),_0x3543('0x60'),_0x3543('0x61'),_0x3543('0x62'),_0x3543('0x63'),'importsequencenumber',_0x3543('0x64'),_0x3543('0x65'),'lastonholdtime',_0x3543('0x66'),_0x3543('0x67'),_0x3543('0x68'),_0x3543('0x69'),_0x3543('0x6a'),'modifiedon',_0x3543('0x6b'),_0x3543('0x6c'),_0x3543('0x6d'),_0x3543('0x6e'),'numberofchildincidents',_0x3543('0x6f'),_0x3543('0x70'),_0x3543('0x71'),_0x3543('0x72'),_0x3543('0x73'),'parentcaseidname',_0x3543('0x74'),_0x3543('0x75'),'prioritycodename',_0x3543('0x76'),_0x3543('0x77'),_0x3543('0x78'),_0x3543('0x79'),_0x3543('0x7a'),_0x3543('0x7b'),_0x3543('0x7c'),_0x3543('0x7d'),'slainvokedidname',_0x3543('0x7e'),'socialprofileidname','statecode',_0x3543('0x7f'),_0x3543('0x80'),'ticketnumber',_0x3543('0x81'),'transactioncurrencyidname',_0x3543('0x82'),_0x3543('0x83'),'versionnumber'];var _0x5a3894=_0x57f676['concat'](_0x33b17a);return db['Dynamics365Account'][_0x3543('0x37')]({'where':{'id':_0x49755a['params']['id']},'attributes':['id',_0x3543('0x84'),_0x3543('0x85'),_0x3543('0x86'),_0x3543('0x87'),_0x3543('0x88'),_0x3543('0x89'),'modernAuthentication'],'include':[{'model':db[_0x3543('0x8a')],'as':_0x3543('0x8a'),'attributes':['id',_0x3543('0x8b'),'data7']}]})['then'](handleEntityNotFound(_0x4a6e10,null))[_0x3543('0xf')](function(_0x3d605d){if(_0x3d605d){if(_0x3d605d[_0x3543('0x8c')]){_0x3d605d[_0x3543('0x8d')]=_0x3d605d[_0x3543('0x8a')][_0x3543('0x8b')];_0x1621ad=sanitizeRemoteUri(_0x3d605d['CloudProvider'][_0x3543('0x8e')]);_0x3bd391=getWebApiUrl(_0x1621ad);return _0x3d605d;}_0x1621ad=sanitizeRemoteUri(_0x3d605d[_0x3543('0x86')]);_0x3bd391=getWebApiUrl(_0x1621ad);var _0x305728={'method':_0x3543('0x8f'),'uri':_0x3543('0x90')+_0x3d605d[_0x3543('0x87')]+_0x3543('0x91'),'form':{'client_id':_0x3d605d[_0x3543('0x88')],'resource':_0x1621ad,'username':_0x3d605d[_0x3543('0x84')],'password':_0x3d605d['password'],'grant_type':_0x3543('0x85'),'client_secret':_0x3d605d[_0x3543('0x89')]},'json':!![]};return rp(_0x305728);}})['then'](function(_0x32973b){_0x39a64d=_0x32973b[_0x3543('0x8d')];var _0x5c8958={'method':_0x3543('0x92'),'uri':encodeURI(_0x3bd391+_0x3543('0x93')+_0x2c9602+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c8958);})[_0x3543('0xf')](function(_0x2f76e0){var _0x142c2f=_0x2f76e0[_0x3543('0x94')][0x0];var _0x3dec45=_0x142c2f[_0x3543('0x95')];var _0x2fc627={'method':_0x3543('0x92'),'uri':_0x3bd391+'EntityDefinitions('+_0x3dec45+_0x3543('0x96'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x2fc627);})[_0x3543('0xf')](function(_0x236b43){_0x2c6581=_0x236b43;_0x16e304=_0x2c6581['Attributes'];_0x16e304=_[_0x3543('0x98')](_0x16e304,function(_0x1bbdd3){return!_0x5a3894['includes'](_0x1bbdd3['LogicalName']);});var _0x5681b1=[];var _0x21e4f9=[];_0x16e304[_0x3543('0x99')](function(_0x41e74b){if(_0x41e74b['@odata.type']){var _0x5ee8cf=_0x41e74b[_0x3543('0x9a')][_0x3543('0x9b')](_0x41e74b['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ee8cf==='PicklistAttributeMetadata'){_0x5681b1[_0x3543('0x9c')](getSelectList(_0x3bd391,_0x844aea,_0x21e4f9,_0x2c6581[_0x3543('0x95')],_0x41e74b[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x5681b1);})['then'](function(_0x13cf42){_0x30f50e=_0x13cf42[0x0];var _0x26cae6=[];var _0x338cb1=[];_0x16e304[_0x3543('0x99')](function(_0x3ad4b4){if(!_['isNil'](_0x3ad4b4['@odata.type'])){var _0x2a4f8f=_0x3ad4b4[_0x3543('0x9a')]['substring'](_0x3ad4b4[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x2a4f8f===_0x3543('0x9e')){_0x26cae6[_0x3543('0x9c')](getBooleanList(_0x3bd391,_0x844aea,_0x338cb1,_0x2c6581[_0x3543('0x95')],_0x3ad4b4['MetadataId'],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x26cae6);})[_0x3543('0xf')](function(_0x15b6e5){_0x626193=_0x15b6e5[0x0];var _0x272885=[];var _0x1445cc=[];_0x16e304[_0x3543('0x99')](function(_0x28dd46){if(_0x28dd46['@odata.type']){var _0x1e0bb5=_0x28dd46[_0x3543('0x9a')][_0x3543('0x9b')](_0x28dd46[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x1e0bb5===_0x3543('0x9f')||_0x1e0bb5===_0x3543('0xa0')||_0x1e0bb5===_0x3543('0xa1')||_0x1e0bb5==='IntegerAttributeMetadata'||_0x1e0bb5===_0x3543('0xa2')||_0x1e0bb5===_0x3543('0xa3')||_0x1e0bb5==='StatusAttributeMetadata'||_0x1e0bb5==='EntityNameAttributeMetadata'||_0x1e0bb5===_0x3543('0xa4')||_0x1e0bb5===_0x3543('0xa5')){_0x272885[_0x3543('0x9c')](getInputList(_0x3bd391,_0x844aea,_0x1e0bb5,_0x1445cc,_0x2c6581[_0x3543('0x95')],_0x28dd46[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x272885);})['then'](function(_0x3fe65c){_0x188d49=_0x3fe65c[0x0];var _0x4f4fcb=_0x30f50e[_0x3543('0xa6')](_0x626193)[_0x3543('0xa6')](_0x188d49);var _0x3881ff={'count':_0x4f4fcb[_0x3543('0x21')],'rows':_0x4f4fcb};return _0x3881ff;})[_0x3543('0xf')](respondWithResult(_0x4a6e10,null))[_0x3543('0x33')](function(_0x2410ff){var _0x4ec0b1=_0x49755a[_0x3543('0x1b')]['test']?0x1f4:_0x2410ff[_0x3543('0xa7')]||0x1f4;logger[_0x3543('0xa8')](_0x2410ff[_0x3543('0x12')]);delete _0x2410ff[_0x3543('0x13')];if(_0x4ec0b1===0x191){_0x4ec0b1=0x190;}_0x4a6e10['status'](_0x4ec0b1)[_0x3543('0xa9')](_0x49755a[_0x3543('0x1b')]['test']?{'message':_0x3543('0xaa'),'statusCode':_0x2410ff['statusCode']}:_0x2410ff);});};function getSelectList(_0x2d94c9,_0x50fc06,_0x4b4578,_0x140808,_0x103c54,_0x254e66){var _0x1c6c97={'method':_0x3543('0x92'),'uri':_0x2d94c9+_0x3543('0xab')+_0x140808+_0x3543('0xac')+_0x103c54+_0x3543('0xad')+_0x3543('0xae'),'headers':{'Authorization':_0x3543('0xaf')+_0x254e66,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c6c97)[_0x3543('0xf')](function(_0x40672c){var _0x2712b6=[];var _0xed25e4=_0x40672c['OptionSet'][_0x3543('0xb0')];_0xed25e4[_0x3543('0x99')](function(_0x1bd640){_0x2712b6['push']({'name':_0x1bd640['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':String(_0x1bd640[_0x3543('0xb3')])});});var _0x4cc16d={'id':_0x50fc06+'_'+_0x40672c[_0x3543('0xb4')],'name':_0x40672c[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x2712b6};_0x4b4578['push'](_0x4cc16d);return _0x4b4578;});}function getBooleanList(_0x390a02,_0x5b32ef,_0x5f285a,_0x54dda1,_0x4f6a52,_0x122858){var _0x46384e={'method':_0x3543('0x92'),'uri':_0x390a02+_0x3543('0xab')+_0x54dda1+')/Attributes('+_0x4f6a52+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x122858,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x46384e)[_0x3543('0xf')](function(_0x41c441){var _0x3d5467=[];_0x3d5467[_0x3543('0x9c')]({'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb7')][_0x3543('0xb2')]['UserLocalizedLabel']['Label'],'value':_0x3543('0xb8')},{'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb9')]['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':_0x3543('0xba')});var _0x21a43d={'id':_0x5b32ef+'_'+_0x41c441['LogicalName'],'name':_0x41c441[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x3d5467};_0x5f285a[_0x3543('0x9c')](_0x21a43d);return _0x5f285a;});}function getInputList(_0x2970f4,_0x2453bc,_0x1e06a5,_0x301330,_0x55ab7b,_0x439ecc,_0x42f181){var _0x502096={'method':_0x3543('0x92'),'uri':_0x2970f4+_0x3543('0xab')+_0x55ab7b+_0x3543('0xac')+_0x439ecc+_0x3543('0xbb')+_0x1e06a5+_0x3543('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x42f181,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x502096)['then'](function(_0x3e0122){var _0x156d03={'id':_0x2453bc+'_'+_0x3e0122[_0x3543('0xb4')],'name':_0x3e0122['DisplayName'][_0x3543('0xb1')]?_0x3e0122[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')]:_0x3e0122['LogicalName'],'custom':![],'options':[]};_0x301330[_0x3543('0x9c')](_0x156d03);return _0x301330;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6c86bf8..2600b8f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5e19ab,_0x49c8ea){var _0x33b5bf=function(_0x15d4b9){while(--_0x15d4b9){_0x5e19ab['push'](_0x5e19ab['shift']());}};_0x33b5bf(++_0x49c8ea);}(_0x757a,0xde));var _0xa757=function(_0x202157,_0x458157){_0x202157=_0x202157-0x0;var _0x40a1bb=_0x757a[_0x202157];return _0x40a1bb;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x126ed4,_0x3ac22f){var _0x5a7075=function(_0x3a7cd9){while(--_0x3a7cd9){_0x126ed4['push'](_0x126ed4['shift']());}};_0x5a7075(++_0x3ac22f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 1835b91..5b4a4d3 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 _0xdb7b=['options','attributes','limit','include','map','model','then','ShowDynamics365Account','find','raw','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll'];(function(_0x4028e7,_0x3fc237){var _0x2784bc=function(_0xe20ed4){while(--_0xe20ed4){_0x4028e7['push'](_0x4028e7['shift']());}};_0x2784bc(++_0x3fc237);}(_0xdb7b,0xba));var _0xbdb7=function(_0x4e93ed,_0x308f30){_0x4e93ed=_0x4e93ed-0x0;var _0x421734=_0xdb7b[_0x4e93ed];return _0x421734;};'use strict';var _=require(_0xbdb7('0x0'));var util=require(_0xbdb7('0x1'));var moment=require('moment');var BPromise=require(_0xbdb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb7('0x3'))['db'];var utils=require(_0xbdb7('0x4'));var logger=require(_0xbdb7('0x5'))(_0xbdb7('0x6'));var config=require(_0xbdb7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbdb7('0x8')][_0xbdb7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfcade6,_0x49b884,_0x24997a){return new BPromise(function(_0x3e860c,_0xb3139a){return client['request'](_0xfcade6,_0x24997a)['then'](function(_0x430601){logger[_0xbdb7('0xa')](_0xbdb7('0xb'),_0x49b884,_0xbdb7('0xc'));logger[_0xbdb7('0xd')](_0xbdb7('0xe'),_0x49b884,'request\x20sent',JSON[_0xbdb7('0xf')](_0x430601));if(_0x430601['error']){if(_0x430601[_0xbdb7('0x10')][_0xbdb7('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x49b884,_0x430601[_0xbdb7('0x10')][_0xbdb7('0x12')]);return _0xb3139a(_0x430601['error']['message']);}logger['error'](_0xbdb7('0xb'),_0x49b884,_0x430601[_0xbdb7('0x10')][_0xbdb7('0x12')]);return _0x3e860c(_0x430601['error'][_0xbdb7('0x12')]);}else{logger[_0xbdb7('0xa')](_0xbdb7('0xb'),_0x49b884,'request\x20sent');_0x3e860c(_0x430601[_0xbdb7('0x13')][_0xbdb7('0x12')]);}})[_0xbdb7('0x14')](function(_0x1ba0e8){logger[_0xbdb7('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x49b884,_0x1ba0e8);_0xb3139a(_0x1ba0e8);});});}exports[_0xbdb7('0x15')]=function(_0x4cc9b7){var _0x199f93=this;return new Promise(function(_0x93e6a6,_0x1c1842){return db[_0xbdb7('0x16')][_0xbdb7('0x17')]({'raw':_0x4cc9b7[_0xbdb7('0x18')]?_0x4cc9b7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cc9b7[_0xbdb7('0x18')]?_0x4cc9b7[_0xbdb7('0x18')]['where']||null:null,'attributes':_0x4cc9b7[_0xbdb7('0x18')]?_0x4cc9b7['options'][_0xbdb7('0x19')]||null:null,'limit':_0x4cc9b7['options']?_0x4cc9b7[_0xbdb7('0x18')][_0xbdb7('0x1a')]||null:null,'include':_0x4cc9b7[_0xbdb7('0x18')]?_0x4cc9b7['options'][_0xbdb7('0x1b')]?_['map'](_0x4cc9b7[_0xbdb7('0x18')][_0xbdb7('0x1b')],function(_0x451604){return{'model':db[_0x451604['model']],'as':_0x451604['as'],'attributes':_0x451604[_0xbdb7('0x19')],'include':_0x451604[_0xbdb7('0x1b')]?_[_0xbdb7('0x1c')](_0x451604[_0xbdb7('0x1b')],function(_0x1c2c44){return{'model':db[_0x1c2c44[_0xbdb7('0x1d')]],'as':_0x1c2c44['as'],'attributes':_0x1c2c44[_0xbdb7('0x19')],'include':_0x1c2c44['include']?_[_0xbdb7('0x1c')](_0x1c2c44[_0xbdb7('0x1b')],function(_0x6b4f0a){return{'model':db[_0x6b4f0a[_0xbdb7('0x1d')]],'as':_0x6b4f0a['as'],'attributes':_0x6b4f0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdb7('0x1e')](function(_0x32dd09){logger[_0xbdb7('0xa')](_0xbdb7('0x15'),_0x4cc9b7);logger[_0xbdb7('0xd')]('GetDynamics365Account',_0x4cc9b7,JSON[_0xbdb7('0xf')](_0x32dd09));_0x93e6a6(_0x32dd09);})[_0xbdb7('0x14')](function(_0x43e3c9){logger['error'](_0xbdb7('0x15'),_0x43e3c9[_0xbdb7('0x12')],_0x4cc9b7);_0x1c1842(_0x199f93[_0xbdb7('0x10')](0x1f4,_0x43e3c9[_0xbdb7('0x12')]));});});};exports[_0xbdb7('0x1f')]=function(_0x18c32e){var _0x2f2a6f=this;return new Promise(function(_0x151c68,_0x3571c8){return db[_0xbdb7('0x16')][_0xbdb7('0x20')]({'raw':_0x18c32e[_0xbdb7('0x18')]?_0x18c32e['options'][_0xbdb7('0x21')]===undefined?!![]:![]:!![],'where':_0x18c32e['options']?_0x18c32e[_0xbdb7('0x18')][_0xbdb7('0x22')]||null:null,'attributes':_0x18c32e[_0xbdb7('0x18')]?_0x18c32e['options'][_0xbdb7('0x19')]||null:null,'include':_0x18c32e[_0xbdb7('0x18')]?_0x18c32e[_0xbdb7('0x18')]['include']?_[_0xbdb7('0x1c')](_0x18c32e[_0xbdb7('0x18')][_0xbdb7('0x1b')],function(_0x328c61){return{'model':db[_0x328c61[_0xbdb7('0x1d')]],'as':_0x328c61['as'],'attributes':_0x328c61['attributes'],'include':_0x328c61['include']?_[_0xbdb7('0x1c')](_0x328c61['include'],function(_0x1cb989){return{'model':db[_0x1cb989[_0xbdb7('0x1d')]],'as':_0x1cb989['as'],'attributes':_0x1cb989[_0xbdb7('0x19')],'include':_0x1cb989[_0xbdb7('0x1b')]?_[_0xbdb7('0x1c')](_0x1cb989[_0xbdb7('0x1b')],function(_0xa83658){return{'model':db[_0xa83658[_0xbdb7('0x1d')]],'as':_0xa83658['as'],'attributes':_0xa83658[_0xbdb7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbdb7('0x1e')](function(_0x1b543d){logger['info'](_0xbdb7('0x1f'),_0x18c32e);logger[_0xbdb7('0xd')](_0xbdb7('0x1f'),_0x18c32e,JSON[_0xbdb7('0xf')](_0x1b543d));_0x151c68(_0x1b543d);})['catch'](function(_0x523375){logger[_0xbdb7('0x10')]('ShowDynamics365Account',_0x523375[_0xbdb7('0x12')],_0x18c32e);_0x3571c8(_0x2f2a6f[_0xbdb7('0x10')](0x1f4,_0x523375[_0xbdb7('0x12')]));});});}; \ No newline at end of file +var _0xe12c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowDynamics365Account','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe12c,0xb3));var _0xce12=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xe12c[_0x13187a];return _0x65b85f;};'use strict';var _=require(_0xce12('0x0'));var util=require('util');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});function respondWithRpcPromise(_0x375b8b,_0x309916,_0x33a6df){return new BPromise(function(_0x4e1163,_0x224c1e){return client[_0xce12('0xc')](_0x375b8b,_0x33a6df)[_0xce12('0xd')](function(_0x321057){logger[_0xce12('0xe')](_0xce12('0xf'),_0x309916,_0xce12('0x10'));logger[_0xce12('0x11')](_0xce12('0x12'),_0x309916,_0xce12('0x10'),JSON[_0xce12('0x13')](_0x321057));if(_0x321057[_0xce12('0x14')]){if(_0x321057[_0xce12('0x14')]['code']===0x1f4){logger[_0xce12('0x14')](_0xce12('0xf'),_0x309916,_0x321057[_0xce12('0x14')]['message']);return _0x224c1e(_0x321057[_0xce12('0x14')]['message']);}logger[_0xce12('0x14')](_0xce12('0xf'),_0x309916,_0x321057[_0xce12('0x14')][_0xce12('0x15')]);return _0x4e1163(_0x321057[_0xce12('0x14')][_0xce12('0x15')]);}else{logger[_0xce12('0xe')](_0xce12('0xf'),_0x309916,_0xce12('0x10'));_0x4e1163(_0x321057[_0xce12('0x16')]['message']);}})['catch'](function(_0x33a349){logger[_0xce12('0x14')](_0xce12('0xf'),_0x309916,_0x33a349);_0x224c1e(_0x33a349);});});}exports[_0xce12('0x17')]=function(_0x413faa){var _0x36724c=this;return new Promise(function(_0x40548f,_0x14b5a9){return db[_0xce12('0x18')][_0xce12('0x19')]({'raw':_0x413faa[_0xce12('0x1a')]?_0x413faa[_0xce12('0x1a')][_0xce12('0x1b')]===undefined?!![]:![]:!![],'where':_0x413faa['options']?_0x413faa['options'][_0xce12('0x1c')]||null:null,'attributes':_0x413faa[_0xce12('0x1a')]?_0x413faa[_0xce12('0x1a')][_0xce12('0x1d')]||null:null,'limit':_0x413faa[_0xce12('0x1a')]?_0x413faa[_0xce12('0x1a')][_0xce12('0x1e')]||null:null,'include':_0x413faa[_0xce12('0x1a')]?_0x413faa[_0xce12('0x1a')]['include']?_[_0xce12('0x1f')](_0x413faa[_0xce12('0x1a')][_0xce12('0x20')],function(_0x2829f1){return{'model':db[_0x2829f1[_0xce12('0x21')]],'as':_0x2829f1['as'],'attributes':_0x2829f1[_0xce12('0x1d')],'include':_0x2829f1[_0xce12('0x20')]?_[_0xce12('0x1f')](_0x2829f1[_0xce12('0x20')],function(_0x2445c6){return{'model':db[_0x2445c6['model']],'as':_0x2445c6['as'],'attributes':_0x2445c6[_0xce12('0x1d')],'include':_0x2445c6[_0xce12('0x20')]?_['map'](_0x2445c6[_0xce12('0x20')],function(_0x14787a){return{'model':db[_0x14787a['model']],'as':_0x14787a['as'],'attributes':_0x14787a[_0xce12('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11040c){logger['info']('GetDynamics365Account',_0x413faa);logger['debug'](_0xce12('0x17'),_0x413faa,JSON['stringify'](_0x11040c));_0x40548f(_0x11040c);})[_0xce12('0x22')](function(_0x3dbe47){logger[_0xce12('0x14')](_0xce12('0x17'),_0x3dbe47['message'],_0x413faa);_0x14b5a9(_0x36724c[_0xce12('0x14')](0x1f4,_0x3dbe47[_0xce12('0x15')]));});});};exports[_0xce12('0x23')]=function(_0x11ba62){var _0x273e1a=this;return new Promise(function(_0x18ae7c,_0x1f647f){return db[_0xce12('0x18')]['find']({'raw':_0x11ba62[_0xce12('0x1a')]?_0x11ba62[_0xce12('0x1a')][_0xce12('0x1b')]===undefined?!![]:![]:!![],'where':_0x11ba62[_0xce12('0x1a')]?_0x11ba62[_0xce12('0x1a')][_0xce12('0x1c')]||null:null,'attributes':_0x11ba62['options']?_0x11ba62[_0xce12('0x1a')][_0xce12('0x1d')]||null:null,'include':_0x11ba62[_0xce12('0x1a')]?_0x11ba62[_0xce12('0x1a')]['include']?_[_0xce12('0x1f')](_0x11ba62[_0xce12('0x1a')][_0xce12('0x20')],function(_0x4c1dfd){return{'model':db[_0x4c1dfd[_0xce12('0x21')]],'as':_0x4c1dfd['as'],'attributes':_0x4c1dfd[_0xce12('0x1d')],'include':_0x4c1dfd['include']?_[_0xce12('0x1f')](_0x4c1dfd[_0xce12('0x20')],function(_0x43dc21){return{'model':db[_0x43dc21[_0xce12('0x21')]],'as':_0x43dc21['as'],'attributes':_0x43dc21[_0xce12('0x1d')],'include':_0x43dc21['include']?_[_0xce12('0x1f')](_0x43dc21[_0xce12('0x20')],function(_0x556b8d){return{'model':db[_0x556b8d[_0xce12('0x21')]],'as':_0x556b8d['as'],'attributes':_0x556b8d[_0xce12('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xce12('0xd')](function(_0x3572bb){logger['info'](_0xce12('0x23'),_0x11ba62);logger[_0xce12('0x11')](_0xce12('0x23'),_0x11ba62,JSON[_0xce12('0x13')](_0x3572bb));_0x18ae7c(_0x3572bb);})[_0xce12('0x22')](function(_0x38bc36){logger[_0xce12('0x14')](_0xce12('0x23'),_0x38bc36[_0xce12('0x15')],_0x11ba62);_0x1f647f(_0x273e1a[_0xce12('0x14')](0x1f4,_0x38bc36['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 493d58c..0546e76 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 _0x46ec=['put','update','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x411c5b,_0x123603){var _0x39b37c=function(_0x785f30){while(--_0x785f30){_0x411c5b['push'](_0x411c5b['shift']());}};_0x39b37c(++_0x123603);}(_0x46ec,0x145));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc46e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc46e('0x1'));var express=require(_0xc46e('0x2'));var router=express[_0xc46e('0x3')]();var fs_extra=require(_0xc46e('0x4'));var auth=require(_0xc46e('0x5'));var interaction=require(_0xc46e('0x6'));var config=require('../../config/environment');var controller=require(_0xc46e('0x7'));router[_0xc46e('0x8')]('/',auth[_0xc46e('0x9')](),controller[_0xc46e('0xa')]);router['get'](_0xc46e('0xb'),auth[_0xc46e('0x9')](),controller['show']);router['get'](_0xc46e('0xc'),auth[_0xc46e('0x9')](),controller['getFields']);router[_0xc46e('0x8')](_0xc46e('0xd'),auth[_0xc46e('0x9')](),controller[_0xc46e('0xe')]);router[_0xc46e('0x8')](_0xc46e('0xf'),auth['isAuthenticated'](),controller[_0xc46e('0x10')]);router['post']('/',auth[_0xc46e('0x9')](),controller['create']);router[_0xc46e('0x11')](_0xc46e('0xb'),auth[_0xc46e('0x9')](),controller[_0xc46e('0x12')]);router['delete'](_0xc46e('0xb'),auth[_0xc46e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2a84=['/:id/fields','getFields','getSubjects','getDescriptions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated'];(function(_0x1c948c,_0x36dc58){var _0xd6365=function(_0x38ddcd){while(--_0x38ddcd){_0x1c948c['push'](_0x1c948c['shift']());}};_0xd6365(++_0x36dc58);}(_0x2a84,0x170));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var path=require('path');var timeout=require(_0x42a8('0x2'));var express=require(_0x42a8('0x3'));var router=express[_0x42a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x42a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42a8('0x6'));var controller=require(_0x42a8('0x7'));router[_0x42a8('0x8')]('/',auth['isAuthenticated'](),controller[_0x42a8('0x9')]);router['get'](_0x42a8('0xa'),auth[_0x42a8('0xb')](),controller['show']);router[_0x42a8('0x8')](_0x42a8('0xc'),auth['isAuthenticated'](),controller[_0x42a8('0xd')]);router[_0x42a8('0x8')]('/:id/subjects',auth[_0x42a8('0xb')](),controller[_0x42a8('0xe')]);router[_0x42a8('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x42a8('0xf')]);router['post']('/',auth[_0x42a8('0xb')](),controller['create']);router['put'](_0x42a8('0xa'),auth[_0x42a8('0xb')](),controller[_0x42a8('0x10')]);router[_0x42a8('0x11')](_0x42a8('0xa'),auth[_0x42a8('0xb')](),controller[_0x42a8('0x12')]);module[_0x42a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9a6bae2..d3bd817 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 _0xa4e8=['contact','sequelize','STRING','ENUM','phonecall','incident'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4e8,0x12d));var _0x8a4e=function(_0x13c308,_0x2e9fc6){_0x13c308=_0x13c308-0x0;var _0x101038=_0xa4e8[_0x13c308];return _0x101038;};'use strict';var Sequelize=require(_0x8a4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a4e('0x1')]},'description':{'type':Sequelize[_0x8a4e('0x1')]},'ticketType':{'type':Sequelize[_0x8a4e('0x2')]('incident',_0x8a4e('0x3')),'defaultValue':_0x8a4e('0x4')},'moduleCreate':{'type':Sequelize[_0x8a4e('0x2')]('contact','nothing'),'defaultValue':_0x8a4e('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x16a9=['nothing','contact','sequelize','STRING','ENUM','incident'];(function(_0x1cba2d,_0x2e4a62){var _0x19a313=function(_0x35e478){while(--_0x35e478){_0x1cba2d['push'](_0x1cba2d['shift']());}};_0x19a313(++_0x2e4a62);}(_0x16a9,0x86));var _0x916a=function(_0x484deb,_0x5467fb){_0x484deb=_0x484deb-0x0;var _0x2ae7b3=_0x16a9[_0x484deb];return _0x2ae7b3;};'use strict';var Sequelize=require(_0x916a('0x0'));module['exports']={'name':{'type':Sequelize[_0x916a('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x916a('0x2')](_0x916a('0x3'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x916a('0x4')),'defaultValue':_0x916a('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a5ebe2b..a19f109 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 _0x1be3=['status','end','offset','limit','count','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','show','keys','includeAll','find','create','update','body','params','destroy','getFields','findOne','pick','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be3,0x12e));var _0x31be=function(_0x5e30a4,_0x41d043){_0x5e30a4=_0x5e30a4-0x0;var _0x15c4eb=_0x1be3[_0x5e30a4];return _0x15c4eb;};'use strict';var emlformat=require(_0x31be('0x0'));var rimraf=require(_0x31be('0x1'));var zipdir=require(_0x31be('0x2'));var jsonpatch=require(_0x31be('0x3'));var rp=require(_0x31be('0x4'));var moment=require(_0x31be('0x5'));var BPromise=require(_0x31be('0x6'));var Mustache=require(_0x31be('0x7'));var util=require('util');var path=require(_0x31be('0x8'));var sox=require(_0x31be('0x9'));var csv=require(_0x31be('0xa'));var ejs=require(_0x31be('0xb'));var fs=require('fs');var fs_extra=require(_0x31be('0xc'));var _=require(_0x31be('0xd'));var squel=require('squel');var crypto=require(_0x31be('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x31be('0xf'));var toCsv=require('to-csv');var querystring=require(_0x31be('0x10'));var Papa=require(_0x31be('0x11'));var Redis=require(_0x31be('0x12'));var authService=require(_0x31be('0x13'));var qs=require(_0x31be('0x14'));var as=require(_0x31be('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31be('0x16'))(_0x31be('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x31be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eeb73,_0x80a013){_0x80a013=_0x80a013||0xcc;return function(_0x46f474){if(_0x46f474){return _0x5eeb73[_0x31be('0x19')](_0x80a013);}return _0x5eeb73[_0x31be('0x1a')](_0x80a013)[_0x31be('0x1b')]();};}function respondWithResult(_0x4c1a9a,_0xee2b65){_0xee2b65=_0xee2b65||0xc8;return function(_0x3bc092){if(_0x3bc092){return _0x4c1a9a['status'](_0xee2b65)['json'](_0x3bc092);}};}function respondWithFilteredResult(_0x584c23,_0x27ac31){return function(_0x4fed19){if(_0x4fed19){var _0x329462=typeof _0x27ac31[_0x31be('0x1c')]==='undefined'&&typeof _0x27ac31[_0x31be('0x1d')]==='undefined';var _0x65cdc0=_0x4fed19[_0x31be('0x1e')];var _0x4f0806=_0x329462?0x0:_0x27ac31[_0x31be('0x1c')];var _0x55c67b=_0x329462?_0x4fed19[_0x31be('0x1e')]:_0x27ac31['offset']+_0x27ac31[_0x31be('0x1d')];var _0x5eff57;if(_0x55c67b>=_0x65cdc0){_0x55c67b=_0x65cdc0;_0x5eff57=0xc8;}else{_0x5eff57=0xce;}_0x584c23[_0x31be('0x1a')](_0x5eff57);return _0x584c23[_0x31be('0x1f')](_0x31be('0x20'),_0x4f0806+'-'+_0x55c67b+'/'+_0x65cdc0)[_0x31be('0x21')](_0x4fed19);}return null;};}function patchUpdates(_0x349ee9){return function(_0x52cd0c){try{jsonpatch[_0x31be('0x22')](_0x52cd0c,_0x349ee9,!![]);}catch(_0x249a4d){return BPromise['reject'](_0x249a4d);}return _0x52cd0c[_0x31be('0x23')]();};}function saveUpdates(_0x422bd3,_0x562f63){return function(_0x3b5ba3){if(_0x3b5ba3){return _0x3b5ba3['update'](_0x422bd3)[_0x31be('0x24')](function(_0x4cdeeb){return _0x4cdeeb;});}return null;};}function removeEntity(_0x296b64,_0x1f0672){return function(_0x242d41){if(_0x242d41){return _0x242d41['destroy']()[_0x31be('0x24')](function(){_0x296b64[_0x31be('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5edf,_0x2bf9d3){return function(_0x2f5171){if(!_0x2f5171){_0x2d5edf[_0x31be('0x19')](0x194);}return _0x2f5171;};}function handleError(_0x1bbee5,_0x2b853e){_0x2b853e=_0x2b853e||0x1f4;return function(_0x11a6bb){logger[_0x31be('0x25')](_0x11a6bb[_0x31be('0x26')]);if(_0x11a6bb['name']){delete _0x11a6bb[_0x31be('0x27')];}_0x1bbee5[_0x31be('0x1a')](_0x2b853e)[_0x31be('0x28')](_0x11a6bb);};}exports[_0x31be('0x29')]=function(_0x4b5f41,_0x538ddb){var _0x5741ad={},_0x302125={},_0x364232={'count':0x0,'rows':[]};var _0x1961ba=_[_0x31be('0x2a')](db[_0x31be('0x2b')][_0x31be('0x2c')],function(_0x50cef0){return{'name':_0x50cef0[_0x31be('0x2d')],'type':_0x50cef0[_0x31be('0x2e')][_0x31be('0x2f')]};});_0x302125[_0x31be('0x30')]=_[_0x31be('0x2a')](_0x1961ba,_0x31be('0x27'));_0x302125['query']=_['keys'](_0x4b5f41[_0x31be('0x31')]);_0x302125[_0x31be('0x32')]=_[_0x31be('0x33')](_0x302125['model'],_0x302125['query']);_0x5741ad[_0x31be('0x34')]=_[_0x31be('0x33')](_0x302125[_0x31be('0x30')],qs[_0x31be('0x35')](_0x4b5f41[_0x31be('0x31')][_0x31be('0x35')]));_0x5741ad[_0x31be('0x34')]=_0x5741ad['attributes'][_0x31be('0x36')]?_0x5741ad[_0x31be('0x34')]:_0x302125[_0x31be('0x30')];if(!_0x4b5f41['query'][_0x31be('0x37')](_0x31be('0x38'))){_0x5741ad['limit']=qs['limit'](_0x4b5f41[_0x31be('0x31')][_0x31be('0x1d')]);_0x5741ad['offset']=qs[_0x31be('0x1c')](_0x4b5f41[_0x31be('0x31')][_0x31be('0x1c')]);}_0x5741ad[_0x31be('0x39')]=qs[_0x31be('0x3a')](_0x4b5f41[_0x31be('0x31')]['sort']);_0x5741ad['where']=qs['filters'](_['pick'](_0x4b5f41[_0x31be('0x31')],_0x302125[_0x31be('0x32')]),_0x1961ba);if(_0x4b5f41[_0x31be('0x31')]['filter']){_0x5741ad[_0x31be('0x3b')]=_[_0x31be('0x3c')](_0x5741ad[_0x31be('0x3b')],{'$or':_[_0x31be('0x2a')](_0x1961ba,function(_0x35ba43){if(_0x35ba43[_0x31be('0x2e')]!==_0x31be('0x3d')){var _0x123645={};_0x123645[_0x35ba43[_0x31be('0x27')]]={'$like':'%'+_0x4b5f41[_0x31be('0x31')][_0x31be('0x3e')]+'%'};return _0x123645;}})});}_0x5741ad=_[_0x31be('0x3c')]({},_0x5741ad,_0x4b5f41[_0x31be('0x3f')]);var _0x18c227={'where':_0x5741ad['where']};return db[_0x31be('0x2b')][_0x31be('0x1e')](_0x18c227)[_0x31be('0x24')](function(_0x9254bf){_0x364232[_0x31be('0x1e')]=_0x9254bf;if(_0x4b5f41[_0x31be('0x31')]['includeAll']){_0x5741ad[_0x31be('0x40')]=[{'all':!![]}];}return db[_0x31be('0x2b')]['findAll'](_0x5741ad);})[_0x31be('0x24')](function(_0x5d8a77){_0x364232[_0x31be('0x41')]=_0x5d8a77;return _0x364232;})[_0x31be('0x24')](respondWithFilteredResult(_0x538ddb,_0x5741ad))[_0x31be('0x42')](handleError(_0x538ddb,null));};exports[_0x31be('0x43')]=function(_0x1ec855,_0x2f4aa9){var _0x3ed6bc={'raw':![],'where':{'id':_0x1ec855['params']['id']}},_0x60b38b={};_0x60b38b[_0x31be('0x30')]=_[_0x31be('0x44')](db[_0x31be('0x2b')]['rawAttributes']);_0x60b38b[_0x31be('0x31')]=_['keys'](_0x1ec855['query']);_0x60b38b['filters']=_[_0x31be('0x33')](_0x60b38b[_0x31be('0x30')],_0x60b38b[_0x31be('0x31')]);_0x3ed6bc[_0x31be('0x34')]=_[_0x31be('0x33')](_0x60b38b['model'],qs[_0x31be('0x35')](_0x1ec855[_0x31be('0x31')][_0x31be('0x35')]));_0x3ed6bc[_0x31be('0x34')]=_0x3ed6bc[_0x31be('0x34')][_0x31be('0x36')]?_0x3ed6bc[_0x31be('0x34')]:_0x60b38b[_0x31be('0x30')];if(_0x1ec855[_0x31be('0x31')][_0x31be('0x45')]){_0x3ed6bc[_0x31be('0x40')]=[{'all':!![]}];}_0x3ed6bc=_[_0x31be('0x3c')]({},_0x3ed6bc,_0x1ec855['options']);return db['Dynamics365Configuration'][_0x31be('0x46')](_0x3ed6bc)[_0x31be('0x24')](handleEntityNotFound(_0x2f4aa9,null))[_0x31be('0x24')](respondWithResult(_0x2f4aa9,null))[_0x31be('0x42')](handleError(_0x2f4aa9,null));};exports[_0x31be('0x47')]=function(_0x4c7306,_0x4d892a){return db[_0x31be('0x2b')][_0x31be('0x47')](_0x4c7306['body'],{})['then'](respondWithResult(_0x4d892a,0xc9))[_0x31be('0x42')](handleError(_0x4d892a,null));};exports[_0x31be('0x48')]=function(_0x4a60af,_0x2a55ee){if(_0x4a60af['body']['id']){delete _0x4a60af[_0x31be('0x49')]['id'];}return db['Dynamics365Configuration'][_0x31be('0x46')]({'where':{'id':_0x4a60af[_0x31be('0x4a')]['id']}})[_0x31be('0x24')](handleEntityNotFound(_0x2a55ee,null))['then'](saveUpdates(_0x4a60af[_0x31be('0x49')],null))[_0x31be('0x24')](respondWithResult(_0x2a55ee,null))[_0x31be('0x42')](handleError(_0x2a55ee,null));};exports[_0x31be('0x4b')]=function(_0x1102a0,_0x43381b){return db[_0x31be('0x2b')]['find']({'where':{'id':_0x1102a0[_0x31be('0x4a')]['id']}})[_0x31be('0x24')](handleEntityNotFound(_0x43381b,null))[_0x31be('0x24')](removeEntity(_0x43381b,null))[_0x31be('0x42')](handleError(_0x43381b,null));};exports[_0x31be('0x4c')]=function(_0x1e853d,_0x4c04f3,_0x4bb528){var _0x4cbfe2={};var _0x1903e4={};var _0x5f2a49;var _0x44fe5e;return db[_0x31be('0x2b')][_0x31be('0x4d')]({'where':{'id':_0x1e853d[_0x31be('0x4a')]['id']}})[_0x31be('0x24')](handleEntityNotFound(_0x4c04f3,null))[_0x31be('0x24')](function(_0x5e1e34){if(_0x5e1e34){_0x5f2a49=_0x5e1e34;_0x1903e4[_0x31be('0x30')]=_[_0x31be('0x44')](db['Dynamics365Field'][_0x31be('0x2c')]);_0x1903e4[_0x31be('0x31')]=_[_0x31be('0x44')](_0x1e853d[_0x31be('0x31')]);_0x1903e4['filters']=_[_0x31be('0x33')](_0x1903e4[_0x31be('0x30')],_0x1903e4['query']);_0x4cbfe2[_0x31be('0x34')]=_[_0x31be('0x33')](_0x1903e4['model'],qs[_0x31be('0x35')](_0x1e853d[_0x31be('0x31')][_0x31be('0x35')]));_0x4cbfe2[_0x31be('0x34')]=_0x4cbfe2[_0x31be('0x34')][_0x31be('0x36')]?_0x4cbfe2[_0x31be('0x34')]:_0x1903e4[_0x31be('0x30')];_0x4cbfe2[_0x31be('0x39')]=qs[_0x31be('0x3a')](_0x1e853d[_0x31be('0x31')][_0x31be('0x3a')]);_0x4cbfe2[_0x31be('0x3b')]=qs[_0x31be('0x32')](_[_0x31be('0x4e')](_0x1e853d['query'],_0x1903e4[_0x31be('0x32')]));if(_0x1e853d[_0x31be('0x31')][_0x31be('0x3e')]){_0x4cbfe2['where']=_[_0x31be('0x3c')](_0x4cbfe2['where'],{'$or':_[_0x31be('0x2a')](_0x4cbfe2[_0x31be('0x34')],function(_0x420a54){var _0xda87f6={};_0xda87f6[_0x420a54]={'$like':'%'+_0x1e853d['query'][_0x31be('0x3e')]+'%'};return _0xda87f6;})});}_0x4cbfe2=_['merge']({},_0x4cbfe2,_0x1e853d[_0x31be('0x3f')]);return _0x5f2a49['getFields'](_0x4cbfe2);}})['then'](function(_0x48caf3){if(_0x48caf3){_0x44fe5e=_0x48caf3[_0x31be('0x36')];if(!_0x1e853d[_0x31be('0x31')][_0x31be('0x37')](_0x31be('0x38'))){_0x4cbfe2[_0x31be('0x1d')]=qs['limit'](_0x1e853d[_0x31be('0x31')][_0x31be('0x1d')]);_0x4cbfe2[_0x31be('0x1c')]=qs['offset'](_0x1e853d[_0x31be('0x31')][_0x31be('0x1c')]);}return _0x5f2a49['getFields'](_0x4cbfe2);}})[_0x31be('0x24')](function(_0x5c7888){if(_0x5c7888){return _0x5c7888?{'count':_0x44fe5e,'rows':_0x5c7888}:null;}})[_0x31be('0x24')](respondWithResult(_0x4c04f3,null))['catch'](handleError(_0x4c04f3,null));};exports[_0x31be('0x4f')]=function(_0x4644f4,_0x1cc8c6,_0x5c778c){var _0x4f004d={};var _0x259f50={};var _0x5ca296;var _0x8129d;return db[_0x31be('0x2b')]['findOne']({'where':{'id':_0x4644f4[_0x31be('0x4a')]['id']}})[_0x31be('0x24')](handleEntityNotFound(_0x1cc8c6,null))['then'](function(_0x3a7441){if(_0x3a7441){_0x5ca296=_0x3a7441;_0x259f50[_0x31be('0x30')]=_[_0x31be('0x44')](db[_0x31be('0x50')]['rawAttributes']);_0x259f50[_0x31be('0x31')]=_[_0x31be('0x44')](_0x4644f4[_0x31be('0x31')]);_0x259f50['filters']=_[_0x31be('0x33')](_0x259f50['model'],_0x259f50[_0x31be('0x31')]);_0x4f004d['attributes']=_[_0x31be('0x33')](_0x259f50[_0x31be('0x30')],qs[_0x31be('0x35')](_0x4644f4[_0x31be('0x31')][_0x31be('0x35')]));_0x4f004d['attributes']=_0x4f004d['attributes'][_0x31be('0x36')]?_0x4f004d[_0x31be('0x34')]:_0x259f50['model'];_0x4f004d[_0x31be('0x39')]=qs['sort'](_0x4644f4['query'][_0x31be('0x3a')]);_0x4f004d['where']=qs[_0x31be('0x32')](_['pick'](_0x4644f4[_0x31be('0x31')],_0x259f50['filters']));if(_0x4644f4[_0x31be('0x31')][_0x31be('0x3e')]){_0x4f004d[_0x31be('0x3b')]=_['merge'](_0x4f004d[_0x31be('0x3b')],{'$or':_['map'](_0x4f004d[_0x31be('0x34')],function(_0x2624a9){var _0x34d1df={};_0x34d1df[_0x2624a9]={'$like':'%'+_0x4644f4[_0x31be('0x31')][_0x31be('0x3e')]+'%'};return _0x34d1df;})});}_0x4f004d=_[_0x31be('0x3c')]({},_0x4f004d,_0x4644f4['options']);return _0x5ca296[_0x31be('0x4f')](_0x4f004d);}})[_0x31be('0x24')](function(_0x5cc79f){if(_0x5cc79f){_0x8129d=_0x5cc79f['length'];if(!_0x4644f4[_0x31be('0x31')][_0x31be('0x37')]('nolimit')){_0x4f004d[_0x31be('0x1d')]=qs[_0x31be('0x1d')](_0x4644f4['query'][_0x31be('0x1d')]);_0x4f004d[_0x31be('0x1c')]=qs[_0x31be('0x1c')](_0x4644f4[_0x31be('0x31')]['offset']);}return _0x5ca296[_0x31be('0x4f')](_0x4f004d);}})[_0x31be('0x24')](function(_0x33f4ab){if(_0x33f4ab){return _0x33f4ab?{'count':_0x8129d,'rows':_0x33f4ab}:null;}})['then'](respondWithResult(_0x1cc8c6,null))[_0x31be('0x42')](handleError(_0x1cc8c6,null));};exports[_0x31be('0x51')]=function(_0x33103d,_0x335dc1,_0xc51969){var _0xd1dea={};var _0x5084fd={};var _0x10ce42;var _0x206f4c;return db[_0x31be('0x2b')]['findOne']({'where':{'id':_0x33103d[_0x31be('0x4a')]['id']}})[_0x31be('0x24')](handleEntityNotFound(_0x335dc1,null))[_0x31be('0x24')](function(_0x449226){if(_0x449226){_0x10ce42=_0x449226;_0x5084fd[_0x31be('0x30')]=_[_0x31be('0x44')](db['Dynamics365Field'][_0x31be('0x2c')]);_0x5084fd[_0x31be('0x31')]=_[_0x31be('0x44')](_0x33103d['query']);_0x5084fd['filters']=_[_0x31be('0x33')](_0x5084fd['model'],_0x5084fd[_0x31be('0x31')]);_0xd1dea[_0x31be('0x34')]=_[_0x31be('0x33')](_0x5084fd[_0x31be('0x30')],qs['fields'](_0x33103d[_0x31be('0x31')]['fields']));_0xd1dea[_0x31be('0x34')]=_0xd1dea[_0x31be('0x34')][_0x31be('0x36')]?_0xd1dea['attributes']:_0x5084fd[_0x31be('0x30')];_0xd1dea[_0x31be('0x39')]=qs[_0x31be('0x3a')](_0x33103d[_0x31be('0x31')][_0x31be('0x3a')]);_0xd1dea[_0x31be('0x3b')]=qs[_0x31be('0x32')](_[_0x31be('0x4e')](_0x33103d['query'],_0x5084fd[_0x31be('0x32')]));if(_0x33103d[_0x31be('0x31')]['filter']){_0xd1dea[_0x31be('0x3b')]=_['merge'](_0xd1dea[_0x31be('0x3b')],{'$or':_['map'](_0xd1dea[_0x31be('0x34')],function(_0x1f10ee){var _0x343640={};_0x343640[_0x1f10ee]={'$like':'%'+_0x33103d[_0x31be('0x31')][_0x31be('0x3e')]+'%'};return _0x343640;})});}_0xd1dea=_['merge']({},_0xd1dea,_0x33103d[_0x31be('0x3f')]);return _0x10ce42[_0x31be('0x51')](_0xd1dea);}})[_0x31be('0x24')](function(_0x562356){if(_0x562356){_0x206f4c=_0x562356[_0x31be('0x36')];if(!_0x33103d['query']['hasOwnProperty'](_0x31be('0x38'))){_0xd1dea['limit']=qs[_0x31be('0x1d')](_0x33103d[_0x31be('0x31')][_0x31be('0x1d')]);_0xd1dea[_0x31be('0x1c')]=qs[_0x31be('0x1c')](_0x33103d[_0x31be('0x31')][_0x31be('0x1c')]);}return _0x10ce42[_0x31be('0x51')](_0xd1dea);}})[_0x31be('0x24')](function(_0x2b8f98){if(_0x2b8f98){return _0x2b8f98?{'count':_0x206f4c,'rows':_0x2b8f98}:null;}})['then'](respondWithResult(_0x335dc1,null))['catch'](handleError(_0x335dc1,null));}; \ No newline at end of file +var _0xaec0=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','destroy','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','create','body','find','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x522918,_0x33b2b5){var _0x9f1d9c=function(_0x50cb99){while(--_0x50cb99){_0x522918['push'](_0x522918['shift']());}};_0x9f1d9c(++_0x33b2b5);}(_0xaec0,0x17e));var _0x0aec=function(_0x156e8f,_0x58c491){_0x156e8f=_0x156e8f-0x0;var _0xb3a674=_0xaec0[_0x156e8f];return _0xb3a674;};'use strict';var emlformat=require(_0x0aec('0x0'));var rimraf=require(_0x0aec('0x1'));var zipdir=require(_0x0aec('0x2'));var jsonpatch=require(_0x0aec('0x3'));var rp=require(_0x0aec('0x4'));var moment=require(_0x0aec('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0aec('0x6'));var path=require(_0x0aec('0x7'));var sox=require(_0x0aec('0x8'));var csv=require(_0x0aec('0x9'));var ejs=require(_0x0aec('0xa'));var fs=require('fs');var fs_extra=require(_0x0aec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0aec('0xc'));var jsforce=require(_0x0aec('0xd'));var deskjs=require(_0x0aec('0xe'));var toCsv=require(_0x0aec('0x9'));var querystring=require('querystring');var Papa=require(_0x0aec('0xf'));var Redis=require(_0x0aec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0aec('0x11'));var as=require(_0x0aec('0x12'));var hardwareService=require(_0x0aec('0x13'));var logger=require(_0x0aec('0x14'))('api');var utils=require(_0x0aec('0x15'));var config=require(_0x0aec('0x16'));var licenseUtil=require(_0x0aec('0x17'));var db=require(_0x0aec('0x18'))['db'];function respondWithStatusCode(_0x5b84bc,_0x5e8bd8){_0x5e8bd8=_0x5e8bd8||0xcc;return function(_0x455f8c){if(_0x455f8c){return _0x5b84bc[_0x0aec('0x19')](_0x5e8bd8);}return _0x5b84bc[_0x0aec('0x1a')](_0x5e8bd8)[_0x0aec('0x1b')]();};}function respondWithResult(_0xf5ed89,_0x356fd8){_0x356fd8=_0x356fd8||0xc8;return function(_0x39cbed){if(_0x39cbed){return _0xf5ed89[_0x0aec('0x1a')](_0x356fd8)[_0x0aec('0x1c')](_0x39cbed);}};}function respondWithFilteredResult(_0x5096c3,_0x1fec7f){return function(_0x4b098d){if(_0x4b098d){var _0x39c2d2=typeof _0x1fec7f[_0x0aec('0x1d')]===_0x0aec('0x1e')&&typeof _0x1fec7f[_0x0aec('0x1f')]===_0x0aec('0x1e');var _0x477629=_0x4b098d['count'];var _0x295322=_0x39c2d2?0x0:_0x1fec7f[_0x0aec('0x1d')];var _0x35e3ae=_0x39c2d2?_0x4b098d[_0x0aec('0x20')]:_0x1fec7f[_0x0aec('0x1d')]+_0x1fec7f['limit'];var _0x1a9a09;if(_0x35e3ae>=_0x477629){_0x35e3ae=_0x477629;_0x1a9a09=0xc8;}else{_0x1a9a09=0xce;}_0x5096c3['status'](_0x1a9a09);return _0x5096c3['set'](_0x0aec('0x21'),_0x295322+'-'+_0x35e3ae+'/'+_0x477629)[_0x0aec('0x1c')](_0x4b098d);}return null;};}function patchUpdates(_0x11dda6){return function(_0x2196d2){try{jsonpatch[_0x0aec('0x22')](_0x2196d2,_0x11dda6,!![]);}catch(_0x307cca){return BPromise['reject'](_0x307cca);}return _0x2196d2['save']();};}function saveUpdates(_0x4de4b9,_0x1cb554){return function(_0x550abe){if(_0x550abe){return _0x550abe['update'](_0x4de4b9)[_0x0aec('0x23')](function(_0x3eae73){return _0x3eae73;});}return null;};}function removeEntity(_0x27df2d,_0xd6e0b3){return function(_0x377db3){if(_0x377db3){return _0x377db3[_0x0aec('0x24')]()[_0x0aec('0x23')](function(){_0x27df2d[_0x0aec('0x1a')](0xcc)[_0x0aec('0x1b')]();});}};}function handleEntityNotFound(_0x591db0,_0x5ee958){return function(_0x1e7b5e){if(!_0x1e7b5e){_0x591db0[_0x0aec('0x19')](0x194);}return _0x1e7b5e;};}function handleError(_0x19c677,_0x472a11){_0x472a11=_0x472a11||0x1f4;return function(_0x288ea8){logger['error'](_0x288ea8[_0x0aec('0x25')]);if(_0x288ea8[_0x0aec('0x26')]){delete _0x288ea8[_0x0aec('0x26')];}_0x19c677[_0x0aec('0x1a')](_0x472a11)[_0x0aec('0x27')](_0x288ea8);};}exports[_0x0aec('0x28')]=function(_0x414d1b,_0x3ee6cb){var _0x2fb278={},_0x11b518={},_0xa091cc={'count':0x0,'rows':[]};var _0x395dc2=_[_0x0aec('0x29')](db[_0x0aec('0x2a')]['rawAttributes'],function(_0x5d307f){return{'name':_0x5d307f[_0x0aec('0x2b')],'type':_0x5d307f[_0x0aec('0x2c')][_0x0aec('0x2d')]};});_0x11b518[_0x0aec('0x2e')]=_['map'](_0x395dc2,_0x0aec('0x26'));_0x11b518[_0x0aec('0x2f')]=_[_0x0aec('0x30')](_0x414d1b[_0x0aec('0x2f')]);_0x11b518['filters']=_[_0x0aec('0x31')](_0x11b518[_0x0aec('0x2e')],_0x11b518['query']);_0x2fb278[_0x0aec('0x32')]=_[_0x0aec('0x31')](_0x11b518[_0x0aec('0x2e')],qs['fields'](_0x414d1b[_0x0aec('0x2f')][_0x0aec('0x33')]));_0x2fb278[_0x0aec('0x32')]=_0x2fb278[_0x0aec('0x32')][_0x0aec('0x34')]?_0x2fb278[_0x0aec('0x32')]:_0x11b518[_0x0aec('0x2e')];if(!_0x414d1b[_0x0aec('0x2f')]['hasOwnProperty']('nolimit')){_0x2fb278['limit']=qs[_0x0aec('0x1f')](_0x414d1b[_0x0aec('0x2f')][_0x0aec('0x1f')]);_0x2fb278[_0x0aec('0x1d')]=qs[_0x0aec('0x1d')](_0x414d1b[_0x0aec('0x2f')][_0x0aec('0x1d')]);}_0x2fb278[_0x0aec('0x35')]=qs[_0x0aec('0x36')](_0x414d1b[_0x0aec('0x2f')]['sort']);_0x2fb278[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_[_0x0aec('0x39')](_0x414d1b[_0x0aec('0x2f')],_0x11b518[_0x0aec('0x38')]),_0x395dc2);if(_0x414d1b['query'][_0x0aec('0x3a')]){_0x2fb278[_0x0aec('0x37')]=_['merge'](_0x2fb278['where'],{'$or':_[_0x0aec('0x29')](_0x395dc2,function(_0x2622ee){if(_0x2622ee[_0x0aec('0x2c')]!==_0x0aec('0x3b')){var _0xc4c65c={};_0xc4c65c[_0x2622ee[_0x0aec('0x26')]]={'$like':'%'+_0x414d1b[_0x0aec('0x2f')][_0x0aec('0x3a')]+'%'};return _0xc4c65c;}})});}_0x2fb278=_[_0x0aec('0x3c')]({},_0x2fb278,_0x414d1b['options']);var _0xa69f6f={'where':_0x2fb278[_0x0aec('0x37')]};return db[_0x0aec('0x2a')][_0x0aec('0x20')](_0xa69f6f)[_0x0aec('0x23')](function(_0x38aa3e){_0xa091cc[_0x0aec('0x20')]=_0x38aa3e;if(_0x414d1b[_0x0aec('0x2f')][_0x0aec('0x3d')]){_0x2fb278[_0x0aec('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x2fb278);})['then'](function(_0x6daecc){_0xa091cc[_0x0aec('0x3f')]=_0x6daecc;return _0xa091cc;})[_0x0aec('0x23')](respondWithFilteredResult(_0x3ee6cb,_0x2fb278))[_0x0aec('0x40')](handleError(_0x3ee6cb,null));};exports[_0x0aec('0x41')]=function(_0x4b8612,_0x58f721){var _0x12532e={'raw':![],'where':{'id':_0x4b8612[_0x0aec('0x42')]['id']}},_0x11ab5f={};_0x11ab5f[_0x0aec('0x2e')]=_[_0x0aec('0x30')](db['Dynamics365Configuration'][_0x0aec('0x43')]);_0x11ab5f[_0x0aec('0x2f')]=_[_0x0aec('0x30')](_0x4b8612[_0x0aec('0x2f')]);_0x11ab5f[_0x0aec('0x38')]=_[_0x0aec('0x31')](_0x11ab5f[_0x0aec('0x2e')],_0x11ab5f[_0x0aec('0x2f')]);_0x12532e[_0x0aec('0x32')]=_[_0x0aec('0x31')](_0x11ab5f[_0x0aec('0x2e')],qs[_0x0aec('0x33')](_0x4b8612[_0x0aec('0x2f')]['fields']));_0x12532e[_0x0aec('0x32')]=_0x12532e['attributes'][_0x0aec('0x34')]?_0x12532e[_0x0aec('0x32')]:_0x11ab5f['model'];if(_0x4b8612['query'][_0x0aec('0x3d')]){_0x12532e[_0x0aec('0x3e')]=[{'all':!![]}];}_0x12532e=_[_0x0aec('0x3c')]({},_0x12532e,_0x4b8612[_0x0aec('0x44')]);return db[_0x0aec('0x2a')]['find'](_0x12532e)[_0x0aec('0x23')](handleEntityNotFound(_0x58f721,null))['then'](respondWithResult(_0x58f721,null))['catch'](handleError(_0x58f721,null));};exports[_0x0aec('0x45')]=function(_0x13f2ac,_0x39e787){return db[_0x0aec('0x2a')][_0x0aec('0x45')](_0x13f2ac['body'],{})[_0x0aec('0x23')](respondWithResult(_0x39e787,0xc9))['catch'](handleError(_0x39e787,null));};exports['update']=function(_0x391306,_0xd5a7d4){if(_0x391306[_0x0aec('0x46')]['id']){delete _0x391306[_0x0aec('0x46')]['id'];}return db[_0x0aec('0x2a')][_0x0aec('0x47')]({'where':{'id':_0x391306['params']['id']}})[_0x0aec('0x23')](handleEntityNotFound(_0xd5a7d4,null))[_0x0aec('0x23')](saveUpdates(_0x391306[_0x0aec('0x46')],null))[_0x0aec('0x23')](respondWithResult(_0xd5a7d4,null))[_0x0aec('0x40')](handleError(_0xd5a7d4,null));};exports[_0x0aec('0x24')]=function(_0x426e69,_0x3ab859){return db[_0x0aec('0x2a')][_0x0aec('0x47')]({'where':{'id':_0x426e69[_0x0aec('0x42')]['id']}})[_0x0aec('0x23')](handleEntityNotFound(_0x3ab859,null))[_0x0aec('0x23')](removeEntity(_0x3ab859,null))[_0x0aec('0x40')](handleError(_0x3ab859,null));};exports[_0x0aec('0x48')]=function(_0x1e8a09,_0x17c106,_0x1ace64){var _0x4fef88={};var _0x6aaab7={};var _0x5f00a3;var _0x187f2f;return db['Dynamics365Configuration'][_0x0aec('0x49')]({'where':{'id':_0x1e8a09[_0x0aec('0x42')]['id']}})[_0x0aec('0x23')](handleEntityNotFound(_0x17c106,null))[_0x0aec('0x23')](function(_0x3b8f80){if(_0x3b8f80){_0x5f00a3=_0x3b8f80;_0x6aaab7['model']=_[_0x0aec('0x30')](db[_0x0aec('0x4a')]['rawAttributes']);_0x6aaab7[_0x0aec('0x2f')]=_[_0x0aec('0x30')](_0x1e8a09[_0x0aec('0x2f')]);_0x6aaab7[_0x0aec('0x38')]=_[_0x0aec('0x31')](_0x6aaab7[_0x0aec('0x2e')],_0x6aaab7[_0x0aec('0x2f')]);_0x4fef88[_0x0aec('0x32')]=_[_0x0aec('0x31')](_0x6aaab7[_0x0aec('0x2e')],qs[_0x0aec('0x33')](_0x1e8a09[_0x0aec('0x2f')]['fields']));_0x4fef88[_0x0aec('0x32')]=_0x4fef88[_0x0aec('0x32')][_0x0aec('0x34')]?_0x4fef88[_0x0aec('0x32')]:_0x6aaab7[_0x0aec('0x2e')];_0x4fef88[_0x0aec('0x35')]=qs['sort'](_0x1e8a09['query'][_0x0aec('0x36')]);_0x4fef88[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_['pick'](_0x1e8a09['query'],_0x6aaab7[_0x0aec('0x38')]));if(_0x1e8a09[_0x0aec('0x2f')][_0x0aec('0x3a')]){_0x4fef88[_0x0aec('0x37')]=_[_0x0aec('0x3c')](_0x4fef88[_0x0aec('0x37')],{'$or':_[_0x0aec('0x29')](_0x4fef88[_0x0aec('0x32')],function(_0x53f118){var _0x36ef16={};_0x36ef16[_0x53f118]={'$like':'%'+_0x1e8a09[_0x0aec('0x2f')][_0x0aec('0x3a')]+'%'};return _0x36ef16;})});}_0x4fef88=_[_0x0aec('0x3c')]({},_0x4fef88,_0x1e8a09[_0x0aec('0x44')]);return _0x5f00a3[_0x0aec('0x48')](_0x4fef88);}})['then'](function(_0x5075d6){if(_0x5075d6){_0x187f2f=_0x5075d6[_0x0aec('0x34')];if(!_0x1e8a09[_0x0aec('0x2f')][_0x0aec('0x4b')]('nolimit')){_0x4fef88['limit']=qs[_0x0aec('0x1f')](_0x1e8a09[_0x0aec('0x2f')][_0x0aec('0x1f')]);_0x4fef88['offset']=qs[_0x0aec('0x1d')](_0x1e8a09['query'][_0x0aec('0x1d')]);}return _0x5f00a3[_0x0aec('0x48')](_0x4fef88);}})['then'](function(_0x44531b){if(_0x44531b){return _0x44531b?{'count':_0x187f2f,'rows':_0x44531b}:null;}})[_0x0aec('0x23')](respondWithResult(_0x17c106,null))[_0x0aec('0x40')](handleError(_0x17c106,null));};exports[_0x0aec('0x4c')]=function(_0x4bfca2,_0x467492,_0x1ad12b){var _0xf65dcc={};var _0x4a908c={};var _0x41dbda;var _0x53f1a3;return db[_0x0aec('0x2a')][_0x0aec('0x49')]({'where':{'id':_0x4bfca2[_0x0aec('0x42')]['id']}})[_0x0aec('0x23')](handleEntityNotFound(_0x467492,null))['then'](function(_0x41f376){if(_0x41f376){_0x41dbda=_0x41f376;_0x4a908c[_0x0aec('0x2e')]=_[_0x0aec('0x30')](db[_0x0aec('0x4a')][_0x0aec('0x43')]);_0x4a908c[_0x0aec('0x2f')]=_[_0x0aec('0x30')](_0x4bfca2['query']);_0x4a908c[_0x0aec('0x38')]=_[_0x0aec('0x31')](_0x4a908c[_0x0aec('0x2e')],_0x4a908c[_0x0aec('0x2f')]);_0xf65dcc[_0x0aec('0x32')]=_[_0x0aec('0x31')](_0x4a908c['model'],qs[_0x0aec('0x33')](_0x4bfca2['query'][_0x0aec('0x33')]));_0xf65dcc[_0x0aec('0x32')]=_0xf65dcc[_0x0aec('0x32')][_0x0aec('0x34')]?_0xf65dcc[_0x0aec('0x32')]:_0x4a908c[_0x0aec('0x2e')];_0xf65dcc['order']=qs[_0x0aec('0x36')](_0x4bfca2[_0x0aec('0x2f')][_0x0aec('0x36')]);_0xf65dcc[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_[_0x0aec('0x39')](_0x4bfca2[_0x0aec('0x2f')],_0x4a908c[_0x0aec('0x38')]));if(_0x4bfca2[_0x0aec('0x2f')][_0x0aec('0x3a')]){_0xf65dcc[_0x0aec('0x37')]=_[_0x0aec('0x3c')](_0xf65dcc[_0x0aec('0x37')],{'$or':_[_0x0aec('0x29')](_0xf65dcc[_0x0aec('0x32')],function(_0x518a67){var _0x46f096={};_0x46f096[_0x518a67]={'$like':'%'+_0x4bfca2[_0x0aec('0x2f')][_0x0aec('0x3a')]+'%'};return _0x46f096;})});}_0xf65dcc=_['merge']({},_0xf65dcc,_0x4bfca2[_0x0aec('0x44')]);return _0x41dbda[_0x0aec('0x4c')](_0xf65dcc);}})[_0x0aec('0x23')](function(_0x3a65a7){if(_0x3a65a7){_0x53f1a3=_0x3a65a7[_0x0aec('0x34')];if(!_0x4bfca2['query'][_0x0aec('0x4b')](_0x0aec('0x4d'))){_0xf65dcc[_0x0aec('0x1f')]=qs['limit'](_0x4bfca2['query']['limit']);_0xf65dcc[_0x0aec('0x1d')]=qs[_0x0aec('0x1d')](_0x4bfca2[_0x0aec('0x2f')]['offset']);}return _0x41dbda['getSubjects'](_0xf65dcc);}})[_0x0aec('0x23')](function(_0x391099){if(_0x391099){return _0x391099?{'count':_0x53f1a3,'rows':_0x391099}:null;}})[_0x0aec('0x23')](respondWithResult(_0x467492,null))[_0x0aec('0x40')](handleError(_0x467492,null));};exports['getDescriptions']=function(_0x251628,_0x5e84ad,_0x6db1eb){var _0xab69ac={};var _0x1db7d2={};var _0x4b3738;var _0x24ff69;return db[_0x0aec('0x2a')][_0x0aec('0x49')]({'where':{'id':_0x251628['params']['id']}})['then'](handleEntityNotFound(_0x5e84ad,null))[_0x0aec('0x23')](function(_0x904e57){if(_0x904e57){_0x4b3738=_0x904e57;_0x1db7d2[_0x0aec('0x2e')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x1db7d2[_0x0aec('0x2f')]=_[_0x0aec('0x30')](_0x251628['query']);_0x1db7d2[_0x0aec('0x38')]=_[_0x0aec('0x31')](_0x1db7d2[_0x0aec('0x2e')],_0x1db7d2[_0x0aec('0x2f')]);_0xab69ac[_0x0aec('0x32')]=_[_0x0aec('0x31')](_0x1db7d2['model'],qs[_0x0aec('0x33')](_0x251628['query'][_0x0aec('0x33')]));_0xab69ac[_0x0aec('0x32')]=_0xab69ac['attributes'][_0x0aec('0x34')]?_0xab69ac[_0x0aec('0x32')]:_0x1db7d2[_0x0aec('0x2e')];_0xab69ac[_0x0aec('0x35')]=qs[_0x0aec('0x36')](_0x251628[_0x0aec('0x2f')][_0x0aec('0x36')]);_0xab69ac['where']=qs['filters'](_[_0x0aec('0x39')](_0x251628['query'],_0x1db7d2['filters']));if(_0x251628[_0x0aec('0x2f')][_0x0aec('0x3a')]){_0xab69ac[_0x0aec('0x37')]=_['merge'](_0xab69ac['where'],{'$or':_[_0x0aec('0x29')](_0xab69ac['attributes'],function(_0xb17b40){var _0x18f3af={};_0x18f3af[_0xb17b40]={'$like':'%'+_0x251628[_0x0aec('0x2f')][_0x0aec('0x3a')]+'%'};return _0x18f3af;})});}_0xab69ac=_['merge']({},_0xab69ac,_0x251628[_0x0aec('0x44')]);return _0x4b3738[_0x0aec('0x4e')](_0xab69ac);}})[_0x0aec('0x23')](function(_0x3318b6){if(_0x3318b6){_0x24ff69=_0x3318b6[_0x0aec('0x34')];if(!_0x251628[_0x0aec('0x2f')]['hasOwnProperty'](_0x0aec('0x4d'))){_0xab69ac[_0x0aec('0x1f')]=qs[_0x0aec('0x1f')](_0x251628[_0x0aec('0x2f')][_0x0aec('0x1f')]);_0xab69ac[_0x0aec('0x1d')]=qs[_0x0aec('0x1d')](_0x251628[_0x0aec('0x2f')][_0x0aec('0x1d')]);}return _0x4b3738['getDescriptions'](_0xab69ac);}})[_0x0aec('0x23')](function(_0x25f785){if(_0x25f785){return _0x25f785?{'count':_0x24ff69,'rows':_0x25f785}:null;}})['then'](respondWithResult(_0x5e84ad,null))[_0x0aec('0x40')](handleError(_0x5e84ad,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index db7b4a0..45b4b7e 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x5c7c95,_0x5de436){var _0xe68ca3=function(_0x3f5083){while(--_0x3f5083){_0x5c7c95['push'](_0x5c7c95['shift']());}};_0xe68ca3(++_0x5de436);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5a22d9,_0x11e68f){_0x5a22d9=_0x5a22d9-0x0;var _0x1272b8=_0xb43b[_0x5a22d9];return _0x1272b8;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x5d73c8,_0x5c7e96){var _0x425edf=function(_0x10be9f){while(--_0x10be9f){_0x5d73c8['push'](_0x5d73c8['shift']());}};_0x425edf(++_0x5c7e96);}(_0xbec5,0xe5));var _0x5bec=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0xbec5[_0x26e727];return _0x563800;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 3b08b07..85f3386 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 _0x0024=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2aa62e,_0x530a59){var _0x1c6fad=function(_0x3c4ef6){while(--_0x3c4ef6){_0x2aa62e['push'](_0x2aa62e['shift']());}};_0x1c6fad(++_0x530a59);}(_0x0024,0x1d0));var _0x4002=function(_0x408762,_0x1e2f39){_0x408762=_0x408762-0x0;var _0x5e9e3e=_0x0024[_0x408762];return _0x5e9e3e;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require(_0x4002('0x3'))['db'];var utils=require(_0x4002('0x4'));var logger=require(_0x4002('0x5'))(_0x4002('0x6'));var config=require(_0x4002('0x7'));var jayson=require(_0x4002('0x8'));var client=jayson[_0x4002('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5978e6,_0x5e9ed8,_0x238a11){return new BPromise(function(_0x3c88fd,_0x277263){return client['request'](_0x5978e6,_0x238a11)[_0x4002('0xa')](function(_0x35c9ce){logger[_0x4002('0xb')](_0x4002('0xc'),_0x5e9ed8,'request\x20sent');logger[_0x4002('0xd')](_0x4002('0xe'),_0x5e9ed8,_0x4002('0xf'),JSON[_0x4002('0x10')](_0x35c9ce));if(_0x35c9ce[_0x4002('0x11')]){if(_0x35c9ce['error'][_0x4002('0x12')]===0x1f4){logger[_0x4002('0x11')](_0x4002('0xc'),_0x5e9ed8,_0x35c9ce[_0x4002('0x11')]['message']);return _0x277263(_0x35c9ce[_0x4002('0x11')][_0x4002('0x13')]);}logger[_0x4002('0x11')](_0x4002('0xc'),_0x5e9ed8,_0x35c9ce[_0x4002('0x11')][_0x4002('0x13')]);return _0x3c88fd(_0x35c9ce[_0x4002('0x11')][_0x4002('0x13')]);}else{logger[_0x4002('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5e9ed8,'request\x20sent');_0x3c88fd(_0x35c9ce[_0x4002('0x14')][_0x4002('0x13')]);}})[_0x4002('0x15')](function(_0x16b6cf){logger['error'](_0x4002('0xc'),_0x5e9ed8,_0x16b6cf);_0x277263(_0x16b6cf);});});} \ No newline at end of file +var _0x0d35=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3eea50,_0x54d651){var _0x3f1f0e=function(_0x1f50f7){while(--_0x1f50f7){_0x3eea50['push'](_0x3eea50['shift']());}};_0x3f1f0e(++_0x54d651);}(_0x0d35,0x14d));var _0x50d3=function(_0x12e013,_0xdba9f){_0x12e013=_0x12e013-0x0;var _0xdaa31a=_0x0d35[_0x12e013];return _0xdaa31a;};'use strict';var _=require(_0x50d3('0x0'));var util=require(_0x50d3('0x1'));var moment=require(_0x50d3('0x2'));var BPromise=require(_0x50d3('0x3'));var rs=require(_0x50d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50d3('0x5'));var logger=require('../../config/logger')(_0x50d3('0x6'));var config=require(_0x50d3('0x7'));var jayson=require(_0x50d3('0x8'));var client=jayson['client'][_0x50d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xee6c2,_0xdc1b8d,_0x34f277){return new BPromise(function(_0x38f33d,_0x18ad30){return client[_0x50d3('0xa')](_0xee6c2,_0x34f277)[_0x50d3('0xb')](function(_0xa98dd7){logger[_0x50d3('0xc')](_0x50d3('0xd'),_0xdc1b8d,_0x50d3('0xe'));logger[_0x50d3('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xdc1b8d,_0x50d3('0xe'),JSON[_0x50d3('0x10')](_0xa98dd7));if(_0xa98dd7['error']){if(_0xa98dd7[_0x50d3('0x11')][_0x50d3('0x12')]===0x1f4){logger[_0x50d3('0x11')](_0x50d3('0xd'),_0xdc1b8d,_0xa98dd7[_0x50d3('0x11')]['message']);return _0x18ad30(_0xa98dd7[_0x50d3('0x11')][_0x50d3('0x13')]);}logger['error'](_0x50d3('0xd'),_0xdc1b8d,_0xa98dd7['error'][_0x50d3('0x13')]);return _0x38f33d(_0xa98dd7['error'][_0x50d3('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0xdc1b8d,_0x50d3('0xe'));_0x38f33d(_0xa98dd7[_0x50d3('0x14')][_0x50d3('0x13')]);}})[_0x50d3('0x15')](function(_0x1676a8){logger[_0x50d3('0x11')](_0x50d3('0xd'),_0xdc1b8d,_0x1676a8);_0x18ad30(_0x1676a8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e2e3072..c809b4f 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 _0x0449=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','connect-timeout','express','Router','fs-extra'];(function(_0x164101,_0x41225f){var _0x2f70c4=function(_0x204a8a){while(--_0x204a8a){_0x164101['push'](_0x164101['shift']());}};_0x2f70c4(++_0x41225f);}(_0x0449,0xf8));var _0x9044=function(_0x4808d7,_0x2e6f8f){_0x4808d7=_0x4808d7-0x0;var _0xf7cc74=_0x0449[_0x4808d7];return _0xf7cc74;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9044('0x0'));var express=require(_0x9044('0x1'));var router=express[_0x9044('0x2')]();var fs_extra=require(_0x9044('0x3'));var auth=require(_0x9044('0x4'));var interaction=require(_0x9044('0x5'));var config=require(_0x9044('0x6'));var controller=require(_0x9044('0x7'));router['get']('/',auth[_0x9044('0x8')](),controller[_0x9044('0x9')]);router[_0x9044('0xa')](_0x9044('0xb'),auth[_0x9044('0x8')](),controller[_0x9044('0xc')]);router[_0x9044('0xd')]('/',auth[_0x9044('0x8')](),controller[_0x9044('0xe')]);router[_0x9044('0xf')]('/:id',auth[_0x9044('0x8')](),controller[_0x9044('0x10')]);router['delete'](_0x9044('0xb'),auth['isAuthenticated'](),controller[_0x9044('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4f1e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0xe6eca0,_0x55c89f){var _0x55ed0f=function(_0x405849){while(--_0x405849){_0xe6eca0['push'](_0xe6eca0['shift']());}};_0x55ed0f(++_0x55c89f);}(_0x4f1e,0x103));var _0xe4f1=function(_0x58775a,_0x34c02e){_0x58775a=_0x58775a-0x0;var _0x25c0b0=_0x4f1e[_0x58775a];return _0x25c0b0;};'use strict';var multer=require(_0xe4f1('0x0'));var util=require('util');var path=require(_0xe4f1('0x1'));var timeout=require(_0xe4f1('0x2'));var express=require(_0xe4f1('0x3'));var router=express[_0xe4f1('0x4')]();var fs_extra=require(_0xe4f1('0x5'));var auth=require(_0xe4f1('0x6'));var interaction=require(_0xe4f1('0x7'));var config=require(_0xe4f1('0x8'));var controller=require(_0xe4f1('0x9'));router[_0xe4f1('0xa')]('/',auth[_0xe4f1('0xb')](),controller[_0xe4f1('0xc')]);router[_0xe4f1('0xa')](_0xe4f1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4f1('0xe')]('/',auth[_0xe4f1('0xb')](),controller[_0xe4f1('0xf')]);router[_0xe4f1('0x10')](_0xe4f1('0xd'),auth[_0xe4f1('0xb')](),controller[_0xe4f1('0x11')]);router[_0xe4f1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe4f1('0x13')]);module[_0xe4f1('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 dd760e7..a5fb9cc 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 _0xc283=['sequelize','string','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xc283,0x126));var _0x3c28=function(_0x5e77c1,_0x434085){_0x5e77c1=_0x5e77c1-0x0;var _0x468ad4=_0xc283[_0x5e77c1];return _0x468ad4;};'use strict';var Sequelize=require(_0x3c28('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3c28('0x1'),'variable',_0x3c28('0x2'),'keyValue',_0x3c28('0x3')),'defaultValue':_0x3c28('0x1')},'content':{'type':Sequelize[_0x3c28('0x4')]},'key':{'type':Sequelize[_0x3c28('0x4')]},'keyType':{'type':Sequelize[_0x3c28('0x5')]('string','variable',_0x3c28('0x2'))},'keyContent':{'type':Sequelize[_0x3c28('0x4')]},'idField':{'type':Sequelize[_0x3c28('0x4')]},'nameField':{'type':Sequelize[_0x3c28('0x4')]},'customField':{'type':Sequelize[_0x3c28('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c28('0x4')]}}; \ No newline at end of file +var _0xd9ae=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','STRING'];(function(_0x504dc3,_0x547139){var _0x2d352c=function(_0x3cb526){while(--_0x3cb526){_0x504dc3['push'](_0x504dc3['shift']());}};_0x2d352c(++_0x547139);}(_0xd9ae,0x121));var _0xed9a=function(_0x18b2ab,_0x3ce33a){_0x18b2ab=_0x18b2ab-0x0;var _0x1c0b94=_0xd9ae[_0x18b2ab];return _0x1c0b94;};'use strict';var Sequelize=require(_0xed9a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xed9a('0x1'),_0xed9a('0x2'),_0xed9a('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xed9a('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xed9a('0x5')](_0xed9a('0x1'),'variable',_0xed9a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xed9a('0x4')]},'nameField':{'type':Sequelize[_0xed9a('0x4')]},'customField':{'type':Sequelize[_0xed9a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed9a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 46fcd01..ccfa3dd 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 _0x8a7b=['Dynamics365Field','includeAll','include','rows','catch','show','params','keys','filters','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','options'];(function(_0x4b1314,_0xbdac65){var _0x3a25ca=function(_0x2be3b0){while(--_0x2be3b0){_0x4b1314['push'](_0x4b1314['shift']());}};_0x3a25ca(++_0xbdac65);}(_0x8a7b,0xe2));var _0xb8a7=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x8a7b[_0xcf5436];return _0xc4f5c8;};'use strict';var emlformat=require(_0xb8a7('0x0'));var rimraf=require(_0xb8a7('0x1'));var zipdir=require(_0xb8a7('0x2'));var jsonpatch=require(_0xb8a7('0x3'));var rp=require(_0xb8a7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8a7('0x5'));var util=require(_0xb8a7('0x6'));var path=require('path');var sox=require(_0xb8a7('0x7'));var csv=require(_0xb8a7('0x8'));var ejs=require(_0xb8a7('0x9'));var fs=require('fs');var fs_extra=require(_0xb8a7('0xa'));var _=require('lodash');var squel=require(_0xb8a7('0xb'));var crypto=require(_0xb8a7('0xc'));var jsforce=require(_0xb8a7('0xd'));var deskjs=require(_0xb8a7('0xe'));var toCsv=require(_0xb8a7('0x8'));var querystring=require(_0xb8a7('0xf'));var Papa=require(_0xb8a7('0x10'));var Redis=require(_0xb8a7('0x11'));var authService=require(_0xb8a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb8a7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8a7('0x14'))(_0xb8a7('0x15'));var utils=require('../../config/utils');var config=require(_0xb8a7('0x16'));var licenseUtil=require(_0xb8a7('0x17'));var db=require(_0xb8a7('0x18'))['db'];function respondWithStatusCode(_0x12f22a,_0x2aa6d0){_0x2aa6d0=_0x2aa6d0||0xcc;return function(_0x24dacc){if(_0x24dacc){return _0x12f22a[_0xb8a7('0x19')](_0x2aa6d0);}return _0x12f22a['status'](_0x2aa6d0)['end']();};}function respondWithResult(_0x38ba69,_0x577632){_0x577632=_0x577632||0xc8;return function(_0xe7834b){if(_0xe7834b){return _0x38ba69[_0xb8a7('0x1a')](_0x577632)[_0xb8a7('0x1b')](_0xe7834b);}};}function respondWithFilteredResult(_0x22194d,_0x373ee1){return function(_0xf21e8d){if(_0xf21e8d){var _0x456bb6=typeof _0x373ee1['offset']===_0xb8a7('0x1c')&&typeof _0x373ee1[_0xb8a7('0x1d')]===_0xb8a7('0x1c');var _0x105f11=_0xf21e8d['count'];var _0x112370=_0x456bb6?0x0:_0x373ee1['offset'];var _0x51e975=_0x456bb6?_0xf21e8d[_0xb8a7('0x1e')]:_0x373ee1[_0xb8a7('0x1f')]+_0x373ee1[_0xb8a7('0x1d')];var _0x3c00d2;if(_0x51e975>=_0x105f11){_0x51e975=_0x105f11;_0x3c00d2=0xc8;}else{_0x3c00d2=0xce;}_0x22194d[_0xb8a7('0x1a')](_0x3c00d2);return _0x22194d[_0xb8a7('0x20')](_0xb8a7('0x21'),_0x112370+'-'+_0x51e975+'/'+_0x105f11)[_0xb8a7('0x1b')](_0xf21e8d);}return null;};}function patchUpdates(_0x65a2bd){return function(_0xcfa75f){try{jsonpatch['apply'](_0xcfa75f,_0x65a2bd,!![]);}catch(_0x46c855){return BPromise[_0xb8a7('0x22')](_0x46c855);}return _0xcfa75f['save']();};}function saveUpdates(_0x52da81,_0x10a45f){return function(_0x4fb2fa){if(_0x4fb2fa){return _0x4fb2fa[_0xb8a7('0x23')](_0x52da81)[_0xb8a7('0x24')](function(_0x4830f1){return _0x4830f1;});}return null;};}function removeEntity(_0x5c1636,_0x43491f){return function(_0x10c699){if(_0x10c699){return _0x10c699[_0xb8a7('0x25')]()[_0xb8a7('0x24')](function(){_0x5c1636['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f29b6,_0x5367a8){return function(_0x4e5bfb){if(!_0x4e5bfb){_0x1f29b6[_0xb8a7('0x19')](0x194);}return _0x4e5bfb;};}function handleError(_0x30f671,_0x3d33b4){_0x3d33b4=_0x3d33b4||0x1f4;return function(_0x19cd75){logger[_0xb8a7('0x26')](_0x19cd75[_0xb8a7('0x27')]);if(_0x19cd75[_0xb8a7('0x28')]){delete _0x19cd75[_0xb8a7('0x28')];}_0x30f671[_0xb8a7('0x1a')](_0x3d33b4)[_0xb8a7('0x29')](_0x19cd75);};}exports['index']=function(_0x1e4e76,_0x5b392c){var _0x2862f2={},_0x1c6301={},_0x48e88b={'count':0x0,'rows':[]};var _0x45a490=_['map'](db['Dynamics365Field'][_0xb8a7('0x2a')],function(_0x19393b){return{'name':_0x19393b[_0xb8a7('0x2b')],'type':_0x19393b[_0xb8a7('0x2c')][_0xb8a7('0x2d')]};});_0x1c6301[_0xb8a7('0x2e')]=_['map'](_0x45a490,'name');_0x1c6301['query']=_['keys'](_0x1e4e76[_0xb8a7('0x2f')]);_0x1c6301['filters']=_[_0xb8a7('0x30')](_0x1c6301['model'],_0x1c6301[_0xb8a7('0x2f')]);_0x2862f2['attributes']=_[_0xb8a7('0x30')](_0x1c6301[_0xb8a7('0x2e')],qs[_0xb8a7('0x31')](_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x31')]));_0x2862f2[_0xb8a7('0x32')]=_0x2862f2[_0xb8a7('0x32')]['length']?_0x2862f2[_0xb8a7('0x32')]:_0x1c6301[_0xb8a7('0x2e')];if(!_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x33')]('nolimit')){_0x2862f2[_0xb8a7('0x1d')]=qs[_0xb8a7('0x1d')](_0x1e4e76['query'][_0xb8a7('0x1d')]);_0x2862f2['offset']=qs[_0xb8a7('0x1f')](_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x1f')]);}_0x2862f2['order']=qs['sort'](_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x34')]);_0x2862f2[_0xb8a7('0x35')]=qs['filters'](_[_0xb8a7('0x36')](_0x1e4e76['query'],_0x1c6301['filters']),_0x45a490);if(_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x37')]){_0x2862f2[_0xb8a7('0x35')]=_[_0xb8a7('0x38')](_0x2862f2[_0xb8a7('0x35')],{'$or':_['map'](_0x45a490,function(_0xf4908c){if(_0xf4908c['type']!=='VIRTUAL'){var _0x27bda1={};_0x27bda1[_0xf4908c[_0xb8a7('0x28')]]={'$like':'%'+_0x1e4e76[_0xb8a7('0x2f')][_0xb8a7('0x37')]+'%'};return _0x27bda1;}})});}_0x2862f2=_[_0xb8a7('0x38')]({},_0x2862f2,_0x1e4e76[_0xb8a7('0x39')]);var _0x3c8f83={'where':_0x2862f2[_0xb8a7('0x35')]};return db[_0xb8a7('0x3a')]['count'](_0x3c8f83)[_0xb8a7('0x24')](function(_0x57771d){_0x48e88b[_0xb8a7('0x1e')]=_0x57771d;if(_0x1e4e76['query'][_0xb8a7('0x3b')]){_0x2862f2[_0xb8a7('0x3c')]=[{'all':!![]}];}return db[_0xb8a7('0x3a')]['findAll'](_0x2862f2);})[_0xb8a7('0x24')](function(_0x4c4980){_0x48e88b[_0xb8a7('0x3d')]=_0x4c4980;return _0x48e88b;})[_0xb8a7('0x24')](respondWithFilteredResult(_0x5b392c,_0x2862f2))[_0xb8a7('0x3e')](handleError(_0x5b392c,null));};exports[_0xb8a7('0x3f')]=function(_0xeea2e6,_0x1f1bba){var _0x2a900c={'raw':!![],'where':{'id':_0xeea2e6[_0xb8a7('0x40')]['id']}},_0x12971e={};_0x12971e['model']=_[_0xb8a7('0x41')](db['Dynamics365Field'][_0xb8a7('0x2a')]);_0x12971e[_0xb8a7('0x2f')]=_[_0xb8a7('0x41')](_0xeea2e6[_0xb8a7('0x2f')]);_0x12971e[_0xb8a7('0x42')]=_[_0xb8a7('0x30')](_0x12971e[_0xb8a7('0x2e')],_0x12971e[_0xb8a7('0x2f')]);_0x2a900c[_0xb8a7('0x32')]=_[_0xb8a7('0x30')](_0x12971e['model'],qs[_0xb8a7('0x31')](_0xeea2e6[_0xb8a7('0x2f')][_0xb8a7('0x31')]));_0x2a900c[_0xb8a7('0x32')]=_0x2a900c[_0xb8a7('0x32')][_0xb8a7('0x43')]?_0x2a900c['attributes']:_0x12971e[_0xb8a7('0x2e')];if(_0xeea2e6[_0xb8a7('0x2f')][_0xb8a7('0x3b')]){_0x2a900c[_0xb8a7('0x3c')]=[{'all':!![]}];}_0x2a900c=_[_0xb8a7('0x38')]({},_0x2a900c,_0xeea2e6['options']);return db['Dynamics365Field'][_0xb8a7('0x44')](_0x2a900c)['then'](handleEntityNotFound(_0x1f1bba,null))['then'](respondWithResult(_0x1f1bba,null))['catch'](handleError(_0x1f1bba,null));};exports[_0xb8a7('0x45')]=function(_0x23111c,_0x47d64c){return db[_0xb8a7('0x3a')]['create'](_0x23111c[_0xb8a7('0x46')],{})['then'](respondWithResult(_0x47d64c,0xc9))[_0xb8a7('0x3e')](handleError(_0x47d64c,null));};exports[_0xb8a7('0x23')]=function(_0x53fcad,_0x3b93f1){if(_0x53fcad['body']['id']){delete _0x53fcad['body']['id'];}return db[_0xb8a7('0x3a')]['find']({'where':{'id':_0x53fcad[_0xb8a7('0x40')]['id']}})[_0xb8a7('0x24')](handleEntityNotFound(_0x3b93f1,null))[_0xb8a7('0x24')](saveUpdates(_0x53fcad[_0xb8a7('0x46')],null))[_0xb8a7('0x24')](respondWithResult(_0x3b93f1,null))[_0xb8a7('0x3e')](handleError(_0x3b93f1,null));};exports[_0xb8a7('0x25')]=function(_0x3cd995,_0x2b1589){return db['Dynamics365Field'][_0xb8a7('0x44')]({'where':{'id':_0x3cd995['params']['id']}})[_0xb8a7('0x24')](handleEntityNotFound(_0x2b1589,null))[_0xb8a7('0x24')](removeEntity(_0x2b1589,null))[_0xb8a7('0x3e')](handleError(_0x2b1589,null));}; \ No newline at end of file +var _0xfd17=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xfd17,0x15b));var _0x7fd1=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0xfd17[_0x272ea6];return _0x43ef03;};'use strict';var emlformat=require(_0x7fd1('0x0'));var rimraf=require(_0x7fd1('0x1'));var zipdir=require(_0x7fd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fd1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fd1('0x4'));var util=require(_0x7fd1('0x5'));var path=require(_0x7fd1('0x6'));var sox=require('sox');var csv=require(_0x7fd1('0x7'));var ejs=require(_0x7fd1('0x8'));var fs=require('fs');var fs_extra=require(_0x7fd1('0x9'));var _=require('lodash');var squel=require(_0x7fd1('0xa'));var crypto=require(_0x7fd1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fd1('0xc'));var toCsv=require(_0x7fd1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fd1('0xd'));var authService=require(_0x7fd1('0xe'));var qs=require(_0x7fd1('0xf'));var as=require(_0x7fd1('0x10'));var hardwareService=require(_0x7fd1('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7fd1('0x12'));var config=require(_0x7fd1('0x13'));var licenseUtil=require(_0x7fd1('0x14'));var db=require(_0x7fd1('0x15'))['db'];function respondWithStatusCode(_0x14f24f,_0x47fee0){_0x47fee0=_0x47fee0||0xcc;return function(_0x2c924f){if(_0x2c924f){return _0x14f24f['sendStatus'](_0x47fee0);}return _0x14f24f[_0x7fd1('0x16')](_0x47fee0)['end']();};}function respondWithResult(_0x6a859,_0x467bb7){_0x467bb7=_0x467bb7||0xc8;return function(_0x22ff95){if(_0x22ff95){return _0x6a859[_0x7fd1('0x16')](_0x467bb7)[_0x7fd1('0x17')](_0x22ff95);}};}function respondWithFilteredResult(_0x459217,_0x3c3b15){return function(_0x215f89){if(_0x215f89){var _0x1b270d=typeof _0x3c3b15['offset']===_0x7fd1('0x18')&&typeof _0x3c3b15['limit']==='undefined';var _0xc0e78=_0x215f89[_0x7fd1('0x19')];var _0x46c7e2=_0x1b270d?0x0:_0x3c3b15['offset'];var _0x933e46=_0x1b270d?_0x215f89[_0x7fd1('0x19')]:_0x3c3b15['offset']+_0x3c3b15['limit'];var _0x30a25c;if(_0x933e46>=_0xc0e78){_0x933e46=_0xc0e78;_0x30a25c=0xc8;}else{_0x30a25c=0xce;}_0x459217['status'](_0x30a25c);return _0x459217[_0x7fd1('0x1a')](_0x7fd1('0x1b'),_0x46c7e2+'-'+_0x933e46+'/'+_0xc0e78)[_0x7fd1('0x17')](_0x215f89);}return null;};}function patchUpdates(_0x1262b8){return function(_0x317d0b){try{jsonpatch[_0x7fd1('0x1c')](_0x317d0b,_0x1262b8,!![]);}catch(_0x178dd3){return BPromise[_0x7fd1('0x1d')](_0x178dd3);}return _0x317d0b[_0x7fd1('0x1e')]();};}function saveUpdates(_0x2bd808,_0x217554){return function(_0x1f047d){if(_0x1f047d){return _0x1f047d[_0x7fd1('0x1f')](_0x2bd808)[_0x7fd1('0x20')](function(_0x31a950){return _0x31a950;});}return null;};}function removeEntity(_0x489179,_0x44f787){return function(_0x3fa817){if(_0x3fa817){return _0x3fa817[_0x7fd1('0x21')]()[_0x7fd1('0x20')](function(){_0x489179[_0x7fd1('0x16')](0xcc)[_0x7fd1('0x22')]();});}};}function handleEntityNotFound(_0x80b387,_0x45e181){return function(_0x59bc9e){if(!_0x59bc9e){_0x80b387[_0x7fd1('0x23')](0x194);}return _0x59bc9e;};}function handleError(_0x5ad797,_0x4cf595){_0x4cf595=_0x4cf595||0x1f4;return function(_0x105ea5){logger[_0x7fd1('0x24')](_0x105ea5[_0x7fd1('0x25')]);if(_0x105ea5[_0x7fd1('0x26')]){delete _0x105ea5[_0x7fd1('0x26')];}_0x5ad797[_0x7fd1('0x16')](_0x4cf595)[_0x7fd1('0x27')](_0x105ea5);};}exports[_0x7fd1('0x28')]=function(_0x349882,_0x6057ec){var _0x478110={},_0x703fcb={},_0x5d5078={'count':0x0,'rows':[]};var _0x45d215=_[_0x7fd1('0x29')](db[_0x7fd1('0x2a')][_0x7fd1('0x2b')],function(_0x2f50de){return{'name':_0x2f50de[_0x7fd1('0x2c')],'type':_0x2f50de[_0x7fd1('0x2d')][_0x7fd1('0x2e')]};});_0x703fcb[_0x7fd1('0x2f')]=_[_0x7fd1('0x29')](_0x45d215,_0x7fd1('0x26'));_0x703fcb[_0x7fd1('0x30')]=_[_0x7fd1('0x31')](_0x349882['query']);_0x703fcb[_0x7fd1('0x32')]=_[_0x7fd1('0x33')](_0x703fcb[_0x7fd1('0x2f')],_0x703fcb[_0x7fd1('0x30')]);_0x478110[_0x7fd1('0x34')]=_[_0x7fd1('0x33')](_0x703fcb[_0x7fd1('0x2f')],qs[_0x7fd1('0x35')](_0x349882[_0x7fd1('0x30')][_0x7fd1('0x35')]));_0x478110['attributes']=_0x478110[_0x7fd1('0x34')][_0x7fd1('0x36')]?_0x478110['attributes']:_0x703fcb['model'];if(!_0x349882[_0x7fd1('0x30')]['hasOwnProperty'](_0x7fd1('0x37'))){_0x478110[_0x7fd1('0x38')]=qs[_0x7fd1('0x38')](_0x349882[_0x7fd1('0x30')]['limit']);_0x478110[_0x7fd1('0x39')]=qs[_0x7fd1('0x39')](_0x349882['query'][_0x7fd1('0x39')]);}_0x478110['order']=qs[_0x7fd1('0x3a')](_0x349882[_0x7fd1('0x30')][_0x7fd1('0x3a')]);_0x478110[_0x7fd1('0x3b')]=qs[_0x7fd1('0x32')](_[_0x7fd1('0x3c')](_0x349882['query'],_0x703fcb[_0x7fd1('0x32')]),_0x45d215);if(_0x349882['query'][_0x7fd1('0x3d')]){_0x478110[_0x7fd1('0x3b')]=_[_0x7fd1('0x3e')](_0x478110[_0x7fd1('0x3b')],{'$or':_[_0x7fd1('0x29')](_0x45d215,function(_0x4a04e5){if(_0x4a04e5[_0x7fd1('0x2d')]!==_0x7fd1('0x3f')){var _0xb0fac9={};_0xb0fac9[_0x4a04e5[_0x7fd1('0x26')]]={'$like':'%'+_0x349882[_0x7fd1('0x30')][_0x7fd1('0x3d')]+'%'};return _0xb0fac9;}})});}_0x478110=_[_0x7fd1('0x3e')]({},_0x478110,_0x349882[_0x7fd1('0x40')]);var _0x22cf5e={'where':_0x478110['where']};return db[_0x7fd1('0x2a')]['count'](_0x22cf5e)[_0x7fd1('0x20')](function(_0x1f92d3){_0x5d5078[_0x7fd1('0x19')]=_0x1f92d3;if(_0x349882[_0x7fd1('0x30')][_0x7fd1('0x41')]){_0x478110[_0x7fd1('0x42')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x478110);})[_0x7fd1('0x20')](function(_0x3d417c){_0x5d5078['rows']=_0x3d417c;return _0x5d5078;})[_0x7fd1('0x20')](respondWithFilteredResult(_0x6057ec,_0x478110))['catch'](handleError(_0x6057ec,null));};exports['show']=function(_0x4583a1,_0x227b2b){var _0x2f0088={'raw':!![],'where':{'id':_0x4583a1['params']['id']}},_0x5165e0={};_0x5165e0['model']=_[_0x7fd1('0x31')](db[_0x7fd1('0x2a')]['rawAttributes']);_0x5165e0[_0x7fd1('0x30')]=_[_0x7fd1('0x31')](_0x4583a1[_0x7fd1('0x30')]);_0x5165e0['filters']=_[_0x7fd1('0x33')](_0x5165e0[_0x7fd1('0x2f')],_0x5165e0[_0x7fd1('0x30')]);_0x2f0088[_0x7fd1('0x34')]=_[_0x7fd1('0x33')](_0x5165e0[_0x7fd1('0x2f')],qs[_0x7fd1('0x35')](_0x4583a1[_0x7fd1('0x30')][_0x7fd1('0x35')]));_0x2f0088[_0x7fd1('0x34')]=_0x2f0088[_0x7fd1('0x34')][_0x7fd1('0x36')]?_0x2f0088[_0x7fd1('0x34')]:_0x5165e0[_0x7fd1('0x2f')];if(_0x4583a1[_0x7fd1('0x30')]['includeAll']){_0x2f0088['include']=[{'all':!![]}];}_0x2f0088=_[_0x7fd1('0x3e')]({},_0x2f0088,_0x4583a1[_0x7fd1('0x40')]);return db[_0x7fd1('0x2a')]['find'](_0x2f0088)[_0x7fd1('0x20')](handleEntityNotFound(_0x227b2b,null))[_0x7fd1('0x20')](respondWithResult(_0x227b2b,null))[_0x7fd1('0x43')](handleError(_0x227b2b,null));};exports[_0x7fd1('0x44')]=function(_0x5303a9,_0x14f693){return db[_0x7fd1('0x2a')][_0x7fd1('0x44')](_0x5303a9[_0x7fd1('0x45')],{})[_0x7fd1('0x20')](respondWithResult(_0x14f693,0xc9))[_0x7fd1('0x43')](handleError(_0x14f693,null));};exports[_0x7fd1('0x1f')]=function(_0x260700,_0x292065){if(_0x260700[_0x7fd1('0x45')]['id']){delete _0x260700[_0x7fd1('0x45')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x260700['params']['id']}})[_0x7fd1('0x20')](handleEntityNotFound(_0x292065,null))[_0x7fd1('0x20')](saveUpdates(_0x260700[_0x7fd1('0x45')],null))[_0x7fd1('0x20')](respondWithResult(_0x292065,null))[_0x7fd1('0x43')](handleError(_0x292065,null));};exports[_0x7fd1('0x21')]=function(_0x317f48,_0x3cac4c){return db[_0x7fd1('0x2a')][_0x7fd1('0x46')]({'where':{'id':_0x317f48[_0x7fd1('0x47')]['id']}})[_0x7fd1('0x20')](handleEntityNotFound(_0x3cac4c,null))[_0x7fd1('0x20')](removeEntity(_0x3cac4c,null))[_0x7fd1('0x43')](handleError(_0x3cac4c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 346bac2..51a8ef9 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 _0x88f6=['request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','idField','util','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88f6,0x15b));var _0x688f=function(_0x4d9c60,_0x4dc094){_0x4d9c60=_0x4d9c60-0x0;var _0x5511d0=_0x88f6[_0x4d9c60];return _0x5511d0;};'use strict';var _=require('lodash');var util=require(_0x688f('0x0'));var logger=require('../../config/logger')(_0x688f('0x1'));var moment=require(_0x688f('0x2'));var BPromise=require(_0x688f('0x3'));var rp=require(_0x688f('0x4'));var fs=require('fs');var path=require(_0x688f('0x5'));var rimraf=require(_0x688f('0x6'));var config=require(_0x688f('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x688f('0x8')]=function(_0x476308,_0x4cf9bb){return _0x476308[_0x688f('0x9')](_0x688f('0xa'),attributes,{'tableName':_0x688f('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x688f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4baa=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4baa,0x114));var _0xa4ba=function(_0x50f17d,_0x260de1){_0x50f17d=_0x50f17d-0x0;var _0x207fb8=_0x4baa[_0x50f17d];return _0x207fb8;};'use strict';var _=require(_0xa4ba('0x0'));var util=require('util');var logger=require(_0xa4ba('0x1'))(_0xa4ba('0x2'));var moment=require('moment');var BPromise=require(_0xa4ba('0x3'));var rp=require(_0xa4ba('0x4'));var fs=require('fs');var path=require(_0xa4ba('0x5'));var rimraf=require(_0xa4ba('0x6'));var config=require(_0xa4ba('0x7'));var attributes=require(_0xa4ba('0x8'));module[_0xa4ba('0x9')]=function(_0x208e69,_0x2658f7){return _0x208e69[_0xa4ba('0xa')](_0xa4ba('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa4ba('0xc'),'fields':['idField',_0xa4ba('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index eb0b02b..f0999b2 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 _0xedcb=['stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xedcb,0x15d));var _0xbedc=function(_0x1d1252,_0x574109){_0x1d1252=_0x1d1252-0x0;var _0x3cb5ef=_0xedcb[_0x1d1252];return _0x3cb5ef;};'use strict';var _=require('lodash');var util=require(_0xbedc('0x0'));var moment=require(_0xbedc('0x1'));var BPromise=require(_0xbedc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbedc('0x3'));var db=require(_0xbedc('0x4'))['db'];var utils=require(_0xbedc('0x5'));var logger=require(_0xbedc('0x6'))(_0xbedc('0x7'));var config=require(_0xbedc('0x8'));var jayson=require(_0xbedc('0x9'));var client=jayson[_0xbedc('0xa')][_0xbedc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460ffb,_0x28c200,_0x515943){return new BPromise(function(_0x174e13,_0x330051){return client[_0xbedc('0xc')](_0x460ffb,_0x515943)[_0xbedc('0xd')](function(_0x14a0b0){logger[_0xbedc('0xe')](_0xbedc('0xf'),_0x28c200,_0xbedc('0x10'));logger[_0xbedc('0x11')](_0xbedc('0x12'),_0x28c200,'request\x20sent',JSON[_0xbedc('0x13')](_0x14a0b0));if(_0x14a0b0[_0xbedc('0x14')]){if(_0x14a0b0[_0xbedc('0x14')]['code']===0x1f4){logger['error'](_0xbedc('0xf'),_0x28c200,_0x14a0b0[_0xbedc('0x14')][_0xbedc('0x15')]);return _0x330051(_0x14a0b0[_0xbedc('0x14')][_0xbedc('0x15')]);}logger[_0xbedc('0x14')](_0xbedc('0xf'),_0x28c200,_0x14a0b0[_0xbedc('0x14')]['message']);return _0x174e13(_0x14a0b0[_0xbedc('0x14')][_0xbedc('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x28c200,_0xbedc('0x10'));_0x174e13(_0x14a0b0['result'][_0xbedc('0x15')]);}})[_0xbedc('0x16')](function(_0x5317db){logger['error'](_0xbedc('0xf'),_0x28c200,_0x5317db);_0x330051(_0x5317db);});});} \ No newline at end of file +var _0x42a5=['../../config/logger','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54f06a,_0x552dfc){var _0x121c5a=function(_0x59343e){while(--_0x59343e){_0x54f06a['push'](_0x54f06a['shift']());}};_0x121c5a(++_0x552dfc);}(_0x42a5,0x142));var _0x542a=function(_0x1c0c8c,_0x55e140){_0x1c0c8c=_0x1c0c8c-0x0;var _0xb1af04=_0x42a5[_0x1c0c8c];return _0xb1af04;};'use strict';var _=require(_0x542a('0x0'));var util=require(_0x542a('0x1'));var moment=require(_0x542a('0x2'));var BPromise=require(_0x542a('0x3'));var rs=require(_0x542a('0x4'));var fs=require('fs');var Redis=require(_0x542a('0x5'));var db=require(_0x542a('0x6'))['db'];var utils=require(_0x542a('0x7'));var logger=require(_0x542a('0x8'))('rpc');var config=require(_0x542a('0x9'));var jayson=require(_0x542a('0xa'));var client=jayson[_0x542a('0xb')][_0x542a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59c921,_0x6c90c7,_0x291e3a){return new BPromise(function(_0x2cdec8,_0x3c5395){return client['request'](_0x59c921,_0x291e3a)[_0x542a('0xd')](function(_0x515cc2){logger['info'](_0x542a('0xe'),_0x6c90c7,'request\x20sent');logger[_0x542a('0xf')](_0x542a('0x10'),_0x6c90c7,'request\x20sent',JSON[_0x542a('0x11')](_0x515cc2));if(_0x515cc2['error']){if(_0x515cc2['error'][_0x542a('0x12')]===0x1f4){logger[_0x542a('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x6c90c7,_0x515cc2[_0x542a('0x13')][_0x542a('0x14')]);return _0x3c5395(_0x515cc2['error'][_0x542a('0x14')]);}logger['error'](_0x542a('0xe'),_0x6c90c7,_0x515cc2[_0x542a('0x13')][_0x542a('0x14')]);return _0x2cdec8(_0x515cc2[_0x542a('0x13')]['message']);}else{logger['info'](_0x542a('0xe'),_0x6c90c7,'request\x20sent');_0x2cdec8(_0x515cc2['result']['message']);}})[_0x542a('0x15')](function(_0x12176d){logger[_0x542a('0x13')](_0x542a('0xe'),_0x6c90c7,_0x12176d);_0x3c5395(_0x12176d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 88f3d3c..3c3f369 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 _0x7608=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x2ee02c,_0x653558){var _0x7ece60=function(_0x459cae){while(--_0x459cae){_0x2ee02c['push'](_0x2ee02c['shift']());}};_0x7ece60(++_0x653558);}(_0x7608,0x1f0));var _0x8760=function(_0x464b1c,_0x38fa45){_0x464b1c=_0x464b1c-0x0;var _0x4187c3=_0x7608[_0x464b1c];return _0x4187c3;};'use strict';var multer=require(_0x8760('0x0'));var util=require(_0x8760('0x1'));var path=require(_0x8760('0x2'));var timeout=require(_0x8760('0x3'));var express=require('express');var router=express[_0x8760('0x4')]();var fs_extra=require(_0x8760('0x5'));var auth=require(_0x8760('0x6'));var interaction=require(_0x8760('0x7'));var config=require(_0x8760('0x8'));var controller=require(_0x8760('0x9'));router[_0x8760('0xa')]('/',auth[_0x8760('0xb')](),controller[_0x8760('0xc')]);router[_0x8760('0xa')](_0x8760('0xd'),auth[_0x8760('0xb')](),controller[_0x8760('0xe')]);router['get']('/:id/configurations',auth[_0x8760('0xb')](),controller['getConfigurations']);router['get'](_0x8760('0xf'),auth[_0x8760('0xb')](),controller[_0x8760('0x10')]);router[_0x8760('0x11')]('/',auth[_0x8760('0xb')](),controller[_0x8760('0x12')]);router[_0x8760('0x11')]('/:id/configurations',auth[_0x8760('0xb')](),controller[_0x8760('0x13')]);router['put'](_0x8760('0xd'),auth['isAuthenticated'](),controller[_0x8760('0x14')]);router[_0x8760('0x15')](_0x8760('0xd'),auth[_0x8760('0xb')](),controller['destroy']);module[_0x8760('0x16')]=router; \ No newline at end of file +var _0x6031=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration'];(function(_0x4de8e5,_0x225e24){var _0x5c1570=function(_0x544c3){while(--_0x544c3){_0x4de8e5['push'](_0x4de8e5['shift']());}};_0x5c1570(++_0x225e24);}(_0x6031,0x16b));var _0x1603=function(_0x350da2,_0x5eed30){_0x350da2=_0x350da2-0x0;var _0x2f8fa8=_0x6031[_0x350da2];return _0x2f8fa8;};'use strict';var multer=require(_0x1603('0x0'));var util=require('util');var path=require(_0x1603('0x1'));var timeout=require(_0x1603('0x2'));var express=require(_0x1603('0x3'));var router=express[_0x1603('0x4')]();var fs_extra=require(_0x1603('0x5'));var auth=require(_0x1603('0x6'));var interaction=require(_0x1603('0x7'));var config=require('../../config/environment');var controller=require(_0x1603('0x8'));router[_0x1603('0x9')]('/',auth['isAuthenticated'](),controller[_0x1603('0xa')]);router[_0x1603('0x9')](_0x1603('0xb'),auth[_0x1603('0xc')](),controller[_0x1603('0xd')]);router[_0x1603('0x9')]('/:id/configurations',auth[_0x1603('0xc')](),controller[_0x1603('0xe')]);router['get'](_0x1603('0xf'),auth['isAuthenticated'](),controller[_0x1603('0x10')]);router['post']('/',auth[_0x1603('0xc')](),controller[_0x1603('0x11')]);router[_0x1603('0x12')](_0x1603('0x13'),auth['isAuthenticated'](),controller[_0x1603('0x14')]);router['put'](_0x1603('0xb'),auth['isAuthenticated'](),controller[_0x1603('0x15')]);router[_0x1603('0x16')]('/:id',auth[_0x1603('0xc')](),controller['destroy']);module[_0x1603('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 310652b..d8b9844 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0x3d087b,_0x4c19b8){var _0x33dff8=function(_0x2ca270){while(--_0x2ca270){_0x3d087b['push'](_0x3d087b['shift']());}};_0x33dff8(++_0x4c19b8);}(_0x583c,0x12b));var _0xc583=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x583c[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0x53c788,_0xf56e59){var _0x4878c6=function(_0x419c25){while(--_0x419c25){_0x53c788['push'](_0x53c788['shift']());}};_0x4878c6(++_0xf56e59);}(_0x583c,0x12b));var _0xc583=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0x583c[_0x3ab928];return _0xf47692;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('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 323ea46..9839372 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 _0x122a=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes'];(function(_0x1cdfac,_0x175366){var _0x31235f=function(_0x6a2840){while(--_0x6a2840){_0x1cdfac['push'](_0x1cdfac['shift']());}};_0x31235f(++_0x175366);}(_0x122a,0xba));var _0xa122=function(_0x512628,_0x116830){_0x512628=_0x512628-0x0;var _0x17b356=_0x122a[_0x512628];return _0x17b356;};'use strict';var emlformat=require(_0xa122('0x0'));var rimraf=require(_0xa122('0x1'));var zipdir=require(_0xa122('0x2'));var jsonpatch=require(_0xa122('0x3'));var rp=require(_0xa122('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa122('0x5'));var util=require('util');var path=require(_0xa122('0x6'));var sox=require(_0xa122('0x7'));var csv=require(_0xa122('0x8'));var ejs=require(_0xa122('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa122('0xa'));var jsforce=require(_0xa122('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa122('0x8'));var querystring=require(_0xa122('0xc'));var Papa=require(_0xa122('0xd'));var Redis=require(_0xa122('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa122('0xf'));var logger=require('../../config/logger')(_0xa122('0x10'));var utils=require(_0xa122('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa122('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18fd6b,_0x3d0912){_0x3d0912=_0x3d0912||0xcc;return function(_0x4a87ce){if(_0x4a87ce){return _0x18fd6b[_0xa122('0x13')](_0x3d0912);}return _0x18fd6b[_0xa122('0x14')](_0x3d0912)[_0xa122('0x15')]();};}function respondWithResult(_0x524ae3,_0xdc178a){_0xdc178a=_0xdc178a||0xc8;return function(_0xc56de4){if(_0xc56de4){return _0x524ae3[_0xa122('0x14')](_0xdc178a)[_0xa122('0x16')](_0xc56de4);}};}function respondWithFilteredResult(_0x3896e3,_0x317817){return function(_0x5ec92a){if(_0x5ec92a){var _0x6dce00=typeof _0x317817[_0xa122('0x17')]===_0xa122('0x18')&&typeof _0x317817[_0xa122('0x19')]===_0xa122('0x18');var _0x2068a4=_0x5ec92a[_0xa122('0x1a')];var _0x25d093=_0x6dce00?0x0:_0x317817[_0xa122('0x17')];var _0x5096cb=_0x6dce00?_0x5ec92a[_0xa122('0x1a')]:_0x317817[_0xa122('0x17')]+_0x317817[_0xa122('0x19')];var _0x3a0ae3;if(_0x5096cb>=_0x2068a4){_0x5096cb=_0x2068a4;_0x3a0ae3=0xc8;}else{_0x3a0ae3=0xce;}_0x3896e3[_0xa122('0x14')](_0x3a0ae3);return _0x3896e3[_0xa122('0x1b')](_0xa122('0x1c'),_0x25d093+'-'+_0x5096cb+'/'+_0x2068a4)[_0xa122('0x16')](_0x5ec92a);}return null;};}function patchUpdates(_0x319836){return function(_0x4fd8a7){try{jsonpatch[_0xa122('0x1d')](_0x4fd8a7,_0x319836,!![]);}catch(_0x244645){return BPromise[_0xa122('0x1e')](_0x244645);}return _0x4fd8a7[_0xa122('0x1f')]();};}function saveUpdates(_0x303914,_0x2a41df){return function(_0x57c1ed){if(_0x57c1ed){return _0x57c1ed[_0xa122('0x20')](_0x303914)[_0xa122('0x21')](function(_0x443268){return _0x443268;});}return null;};}function removeEntity(_0x1e53e1,_0x15742e){return function(_0x43ce34){if(_0x43ce34){return _0x43ce34[_0xa122('0x22')]()[_0xa122('0x21')](function(){_0x1e53e1[_0xa122('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbe03,_0x163531){return function(_0x515935){if(!_0x515935){_0x2dbe03[_0xa122('0x13')](0x194);}return _0x515935;};}function handleError(_0x5866f4,_0x5f2185){_0x5f2185=_0x5f2185||0x1f4;return function(_0x20efd9){logger['error'](_0x20efd9[_0xa122('0x23')]);if(_0x20efd9[_0xa122('0x24')]){delete _0x20efd9[_0xa122('0x24')];}_0x5866f4[_0xa122('0x14')](_0x5f2185)[_0xa122('0x25')](_0x20efd9);};}exports[_0xa122('0x26')]=function(_0x57bfa4,_0xe37991){var _0x3c8455={},_0x400988={},_0x5ea21a={'count':0x0,'rows':[]};var _0x57af51=_[_0xa122('0x27')](db[_0xa122('0x28')][_0xa122('0x29')],function(_0x190f9d){return{'name':_0x190f9d['fieldName'],'type':_0x190f9d['type'][_0xa122('0x2a')]};});_0x400988[_0xa122('0x2b')]=_['map'](_0x57af51,_0xa122('0x24'));_0x400988[_0xa122('0x2c')]=_[_0xa122('0x2d')](_0x57bfa4[_0xa122('0x2c')]);_0x400988[_0xa122('0x2e')]=_[_0xa122('0x2f')](_0x400988['model'],_0x400988[_0xa122('0x2c')]);_0x3c8455['attributes']=_[_0xa122('0x2f')](_0x400988['model'],qs[_0xa122('0x30')](_0x57bfa4[_0xa122('0x2c')][_0xa122('0x30')]));_0x3c8455[_0xa122('0x31')]=_0x3c8455['attributes'][_0xa122('0x32')]?_0x3c8455['attributes']:_0x400988[_0xa122('0x2b')];if(!_0x57bfa4[_0xa122('0x2c')][_0xa122('0x33')]('nolimit')){_0x3c8455['limit']=qs[_0xa122('0x19')](_0x57bfa4[_0xa122('0x2c')][_0xa122('0x19')]);_0x3c8455[_0xa122('0x17')]=qs[_0xa122('0x17')](_0x57bfa4[_0xa122('0x2c')]['offset']);}_0x3c8455[_0xa122('0x34')]=qs[_0xa122('0x35')](_0x57bfa4['query'][_0xa122('0x35')]);_0x3c8455[_0xa122('0x36')]=qs[_0xa122('0x2e')](_[_0xa122('0x37')](_0x57bfa4[_0xa122('0x2c')],_0x400988['filters']),_0x57af51);if(_0x57bfa4[_0xa122('0x2c')][_0xa122('0x38')]){_0x3c8455['where']=_[_0xa122('0x39')](_0x3c8455['where'],{'$or':_[_0xa122('0x27')](_0x57af51,function(_0x65f956){if(_0x65f956[_0xa122('0x3a')]!==_0xa122('0x3b')){var _0x2a65bf={};_0x2a65bf[_0x65f956[_0xa122('0x24')]]={'$like':'%'+_0x57bfa4[_0xa122('0x2c')][_0xa122('0x38')]+'%'};return _0x2a65bf;}})});}_0x3c8455=_[_0xa122('0x39')]({},_0x3c8455,_0x57bfa4['options']);var _0x2de6c6={'where':_0x3c8455['where']};return db[_0xa122('0x28')][_0xa122('0x1a')](_0x2de6c6)[_0xa122('0x21')](function(_0x5dc97c){_0x5ea21a[_0xa122('0x1a')]=_0x5dc97c;if(_0x57bfa4[_0xa122('0x2c')][_0xa122('0x3c')]){_0x3c8455['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa122('0x3d')](_0x3c8455);})[_0xa122('0x21')](function(_0x43c2e7){_0x5ea21a[_0xa122('0x3e')]=_0x43c2e7;return _0x5ea21a;})[_0xa122('0x21')](respondWithFilteredResult(_0xe37991,_0x3c8455))['catch'](handleError(_0xe37991,null));};exports[_0xa122('0x3f')]=function(_0x24f6d6,_0xfd565){var _0x4306ff={'raw':![],'where':{'id':_0x24f6d6[_0xa122('0x40')]['id']}},_0x268245={};_0x268245[_0xa122('0x2b')]=_[_0xa122('0x2d')](db['FreshdeskAccount'][_0xa122('0x29')]);_0x268245[_0xa122('0x2c')]=_[_0xa122('0x2d')](_0x24f6d6['query']);_0x268245[_0xa122('0x2e')]=_[_0xa122('0x2f')](_0x268245[_0xa122('0x2b')],_0x268245[_0xa122('0x2c')]);_0x4306ff[_0xa122('0x31')]=_[_0xa122('0x2f')](_0x268245[_0xa122('0x2b')],qs['fields'](_0x24f6d6[_0xa122('0x2c')][_0xa122('0x30')]));_0x4306ff['attributes']=_0x4306ff['attributes'][_0xa122('0x32')]?_0x4306ff['attributes']:_0x268245[_0xa122('0x2b')];if(_0x24f6d6[_0xa122('0x2c')][_0xa122('0x3c')]){_0x4306ff[_0xa122('0x41')]=[{'all':!![]}];}_0x4306ff=_['merge']({},_0x4306ff,_0x24f6d6['options']);return db[_0xa122('0x28')][_0xa122('0x42')](_0x4306ff)['then'](handleEntityNotFound(_0xfd565,null))['then'](respondWithResult(_0xfd565,null))[_0xa122('0x43')](handleError(_0xfd565,null));};exports[_0xa122('0x44')]=function(_0x280648,_0x322997){return db[_0xa122('0x28')]['create'](_0x280648[_0xa122('0x45')],{})[_0xa122('0x21')](respondWithResult(_0x322997,0xc9))[_0xa122('0x43')](handleError(_0x322997,null));};exports['update']=function(_0x2e9c27,_0x27f69a){if(_0x2e9c27[_0xa122('0x45')]['id']){delete _0x2e9c27['body']['id'];}return db[_0xa122('0x28')][_0xa122('0x42')]({'where':{'id':_0x2e9c27[_0xa122('0x40')]['id']}})[_0xa122('0x21')](handleEntityNotFound(_0x27f69a,null))['then'](saveUpdates(_0x2e9c27[_0xa122('0x45')],null))['then'](respondWithResult(_0x27f69a,null))[_0xa122('0x43')](handleError(_0x27f69a,null));};exports[_0xa122('0x22')]=function(_0x304a70,_0xf32a34){return db[_0xa122('0x28')][_0xa122('0x42')]({'where':{'id':_0x304a70[_0xa122('0x40')]['id']}})[_0xa122('0x21')](handleEntityNotFound(_0xf32a34,null))[_0xa122('0x21')](removeEntity(_0xf32a34,null))[_0xa122('0x43')](handleError(_0xf32a34,null));};exports[_0xa122('0x46')]=function(_0x410bbb,_0x3931db,_0xbbd6d1){var _0x22e89c={};var _0x3bb697={};var _0xc635e;var _0x178be2;return db[_0xa122('0x28')][_0xa122('0x47')]({'where':{'id':_0x410bbb[_0xa122('0x40')]['id']}})[_0xa122('0x21')](handleEntityNotFound(_0x3931db,null))['then'](function(_0x552f22){if(_0x552f22){_0xc635e=_0x552f22;_0x3bb697[_0xa122('0x2b')]=_[_0xa122('0x2d')](db[_0xa122('0x48')][_0xa122('0x29')]);_0x3bb697[_0xa122('0x2c')]=_['keys'](_0x410bbb[_0xa122('0x2c')]);_0x3bb697['filters']=_[_0xa122('0x2f')](_0x3bb697[_0xa122('0x2b')],_0x3bb697[_0xa122('0x2c')]);_0x22e89c[_0xa122('0x31')]=_[_0xa122('0x2f')](_0x3bb697[_0xa122('0x2b')],qs[_0xa122('0x30')](_0x410bbb['query'][_0xa122('0x30')]));_0x22e89c[_0xa122('0x31')]=_0x22e89c[_0xa122('0x31')][_0xa122('0x32')]?_0x22e89c[_0xa122('0x31')]:_0x3bb697[_0xa122('0x2b')];_0x22e89c[_0xa122('0x34')]=qs[_0xa122('0x35')](_0x410bbb[_0xa122('0x2c')][_0xa122('0x35')]);_0x22e89c[_0xa122('0x36')]=qs[_0xa122('0x2e')](_[_0xa122('0x37')](_0x410bbb['query'],_0x3bb697[_0xa122('0x2e')]));if(_0x410bbb[_0xa122('0x2c')][_0xa122('0x38')]){_0x22e89c[_0xa122('0x36')]=_[_0xa122('0x39')](_0x22e89c['where'],{'$or':_[_0xa122('0x27')](_0x22e89c[_0xa122('0x31')],function(_0x13c917){var _0x46f683={};_0x46f683[_0x13c917]={'$like':'%'+_0x410bbb[_0xa122('0x2c')]['filter']+'%'};return _0x46f683;})});}_0x22e89c=_[_0xa122('0x39')]({},_0x22e89c,_0x410bbb[_0xa122('0x49')]);return _0xc635e[_0xa122('0x46')](_0x22e89c);}})[_0xa122('0x21')](function(_0x5cba56){if(_0x5cba56){_0x178be2=_0x5cba56[_0xa122('0x32')];if(!_0x410bbb['query'][_0xa122('0x33')](_0xa122('0x4a'))){_0x22e89c[_0xa122('0x19')]=qs[_0xa122('0x19')](_0x410bbb['query'][_0xa122('0x19')]);_0x22e89c[_0xa122('0x17')]=qs[_0xa122('0x17')](_0x410bbb[_0xa122('0x2c')][_0xa122('0x17')]);}return _0xc635e[_0xa122('0x46')](_0x22e89c);}})[_0xa122('0x21')](function(_0x365e64){if(_0x365e64){return _0x365e64?{'count':_0x178be2,'rows':_0x365e64}:null;}})['then'](respondWithResult(_0x3931db,null))[_0xa122('0x43')](handleError(_0x3931db,null));};exports[_0xa122('0x4b')]=function(_0x56c19b,_0x50067e,_0x53d93a){if(_0x56c19b[_0xa122('0x45')]['id']){delete _0x56c19b[_0xa122('0x45')]['id'];}return db['FreshdeskAccount'][_0xa122('0x47')]({'where':{'id':_0x56c19b[_0xa122('0x40')]['id']}})[_0xa122('0x21')](handleEntityNotFound(_0x50067e,null))['then'](function(_0x275a58){if(_0x275a58){_0x56c19b['body'][_0xa122('0x4c')]=_0x275a58['id'];_0x56c19b[_0xa122('0x45')][_0xa122('0x4d')]=integrations[_0xa122('0x4e')](_0x56c19b[_0xa122('0x45')]['channel'],_0x56c19b[_0xa122('0x45')][_0xa122('0x3a')]);_0x56c19b['body'][_0xa122('0x4f')]=integrations[_0xa122('0x50')](_0x56c19b['body'][_0xa122('0x51')],_0x56c19b['body']['type']);return db[_0xa122('0x48')]['create'](_0x56c19b['body'],{'include':[{'model':db[_0xa122('0x52')],'as':_0xa122('0x4d')},{'model':db[_0xa122('0x52')],'as':_0xa122('0x4f')}]});}return null;})['then'](respondWithResult(_0x50067e,null))[_0xa122('0x43')](handleError(_0x50067e,null));};exports[_0xa122('0x53')]=function(_0x5e74b4,_0x42ab34,_0x57a5fe){var _0x5ad638='';return db['FreshdeskAccount'][_0xa122('0x47')]({'where':{'id':_0x5e74b4[_0xa122('0x40')]['id']},'attributes':['id',_0xa122('0x54'),_0xa122('0x55')]})[_0xa122('0x21')](handleEntityNotFound(_0x42ab34,null))['then'](function(_0x31fe20){if(_0x31fe20){_0x5ad638=_0x31fe20[_0xa122('0x54')];var _0x4cddb7=_0x5ad638[_0xa122('0x56')](-0x1);if(_0x4cddb7==='/'){_0x5ad638=_0x5ad638[_0xa122('0x57')](0x0,_0x5ad638[_0xa122('0x58')](_0x4cddb7));}return rp({'method':_0xa122('0x59'),'uri':util[_0xa122('0x5a')](_0xa122('0x5b'),_0x5ad638,_0xa122('0x5c')),'headers':{'Authorization':util[_0xa122('0x5a')]('Basic\x20%s',new Buffer(util[_0xa122('0x5a')](_0xa122('0x5d'),_0x31fe20[_0xa122('0x55')]))[_0xa122('0x5e')](_0xa122('0x5f')))},'json':!![]});}})['then'](function(_0x3b0fa8){if(_0x3b0fa8){var _0x349326=[_0xa122('0x60'),'subject',_0xa122('0x61'),_0xa122('0x62'),_0xa122('0x14'),_0xa122('0x63'),_0xa122('0x64'),_0xa122('0x65'),_0xa122('0x66'),_0xa122('0x64'),'company'];_[_0xa122('0x67')](_0x3b0fa8,function(_0x5a8538){return _0x349326[_0xa122('0x68')](_0x5a8538[_0xa122('0x24')])||!_0x5a8538[_0xa122('0x69')]&&_0x5a8538[_0xa122('0x3a')]!==_0xa122('0x6a')&&_0x5a8538[_0xa122('0x3a')]!==_0xa122('0x6b');});return{'count':_0x3b0fa8[_0xa122('0x32')],'rows':_[_0xa122('0x27')](_0x3b0fa8,function(_0x4bf622){return{'id':_0x4bf622[_0xa122('0x24')],'name':_0x4bf622['label'],'custom':!_0x4bf622['default'],'options':_0x4bf622['choices']?_[_0xa122('0x27')](_0x4bf622[_0xa122('0x6c')],function(_0x5d9295){return{'name':_[_0xa122('0x6d')](_0x5d9295),'value':_0x5d9295};}):[]};})};}})[_0xa122('0x21')](respondWithResult(_0x42ab34,null))[_0xa122('0x43')](function(_0x484260){var _0x34243c=_0x5e74b4[_0xa122('0x2c')][_0xa122('0x6e')]?0x1f4:_0x484260[_0xa122('0x6f')]||0x1f4;logger['error'](_0xa122('0x70'),_0xa122('0x53'),_0x34243c,JSON['stringify'](_0x484260));delete _0x484260[_0xa122('0x24')];if(_0x34243c===0x191){_0x34243c=0x190;}_0x42ab34[_0xa122('0x14')](_0x34243c)['send'](_0x5e74b4[_0xa122('0x2c')][_0xa122('0x6e')]?{'message':_0xa122('0x71'),'statusCode':_0x484260[_0xa122('0x6f')]}:_0x484260);});}; \ No newline at end of file +var _0x58d6=['description','priority','group','source','ticket_type','includes','default','custom_text','label','choices','capitalize','test','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../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','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject'];(function(_0x3100fc,_0x471423){var _0xa195cf=function(_0xc4b7c8){while(--_0xc4b7c8){_0x3100fc['push'](_0x3100fc['shift']());}};_0xa195cf(++_0x471423);}(_0x58d6,0x1d3));var _0x658d=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0x58d6[_0x4b33ff];return _0x24c2f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x658d('0x0'));var zipdir=require(_0x658d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x658d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x658d('0x3'));var util=require(_0x658d('0x4'));var path=require(_0x658d('0x5'));var sox=require(_0x658d('0x6'));var csv=require('to-csv');var ejs=require(_0x658d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x658d('0x8'));var squel=require(_0x658d('0x9'));var crypto=require(_0x658d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0xb'));var toCsv=require(_0x658d('0xc'));var querystring=require(_0x658d('0xd'));var Papa=require('papaparse');var Redis=require(_0x658d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x658d('0xf'));var as=require(_0x658d('0x10'));var hardwareService=require(_0x658d('0x11'));var logger=require('../../config/logger')(_0x658d('0x12'));var utils=require(_0x658d('0x13'));var config=require(_0x658d('0x14'));var licenseUtil=require(_0x658d('0x15'));var db=require(_0x658d('0x16'))['db'];var integrations=require(_0x658d('0x17'));function respondWithStatusCode(_0x9efc8c,_0x51295b){_0x51295b=_0x51295b||0xcc;return function(_0x2134dd){if(_0x2134dd){return _0x9efc8c[_0x658d('0x18')](_0x51295b);}return _0x9efc8c[_0x658d('0x19')](_0x51295b)[_0x658d('0x1a')]();};}function respondWithResult(_0x43de3d,_0x28a2d0){_0x28a2d0=_0x28a2d0||0xc8;return function(_0x4aebaa){if(_0x4aebaa){return _0x43de3d[_0x658d('0x19')](_0x28a2d0)[_0x658d('0x1b')](_0x4aebaa);}};}function respondWithFilteredResult(_0x17b20f,_0x284431){return function(_0x42aae9){if(_0x42aae9){var _0x2d8968=typeof _0x284431['offset']===_0x658d('0x1c')&&typeof _0x284431[_0x658d('0x1d')]===_0x658d('0x1c');var _0x61cfa6=_0x42aae9[_0x658d('0x1e')];var _0x25769e=_0x2d8968?0x0:_0x284431[_0x658d('0x1f')];var _0x3cdc74=_0x2d8968?_0x42aae9[_0x658d('0x1e')]:_0x284431['offset']+_0x284431['limit'];var _0x247ff7;if(_0x3cdc74>=_0x61cfa6){_0x3cdc74=_0x61cfa6;_0x247ff7=0xc8;}else{_0x247ff7=0xce;}_0x17b20f[_0x658d('0x19')](_0x247ff7);return _0x17b20f[_0x658d('0x20')](_0x658d('0x21'),_0x25769e+'-'+_0x3cdc74+'/'+_0x61cfa6)[_0x658d('0x1b')](_0x42aae9);}return null;};}function patchUpdates(_0x1c0271){return function(_0x13a9a6){try{jsonpatch[_0x658d('0x22')](_0x13a9a6,_0x1c0271,!![]);}catch(_0x3b4a1f){return BPromise['reject'](_0x3b4a1f);}return _0x13a9a6['save']();};}function saveUpdates(_0x408996,_0x3ac068){return function(_0x5bb5cc){if(_0x5bb5cc){return _0x5bb5cc[_0x658d('0x23')](_0x408996)[_0x658d('0x24')](function(_0x3e95f5){return _0x3e95f5;});}return null;};}function removeEntity(_0x56dd20,_0x4f9418){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x658d('0x25')]()['then'](function(){_0x56dd20[_0x658d('0x19')](0xcc)[_0x658d('0x1a')]();});}};}function handleEntityNotFound(_0x5445b8,_0x2088bd){return function(_0x17e5b8){if(!_0x17e5b8){_0x5445b8[_0x658d('0x18')](0x194);}return _0x17e5b8;};}function handleError(_0x4a6a9c,_0x3e2759){_0x3e2759=_0x3e2759||0x1f4;return function(_0x12107d){logger[_0x658d('0x26')](_0x12107d[_0x658d('0x27')]);if(_0x12107d[_0x658d('0x28')]){delete _0x12107d[_0x658d('0x28')];}_0x4a6a9c[_0x658d('0x19')](_0x3e2759)[_0x658d('0x29')](_0x12107d);};}exports[_0x658d('0x2a')]=function(_0x27cccb,_0x38cd62){var _0x323042={},_0x4c5176={},_0x2c5afb={'count':0x0,'rows':[]};var _0x29fb2e=_['map'](db[_0x658d('0x2b')][_0x658d('0x2c')],function(_0x17db1a){return{'name':_0x17db1a[_0x658d('0x2d')],'type':_0x17db1a[_0x658d('0x2e')][_0x658d('0x2f')]};});_0x4c5176[_0x658d('0x30')]=_[_0x658d('0x31')](_0x29fb2e,_0x658d('0x28'));_0x4c5176['query']=_[_0x658d('0x32')](_0x27cccb['query']);_0x4c5176[_0x658d('0x33')]=_[_0x658d('0x34')](_0x4c5176[_0x658d('0x30')],_0x4c5176[_0x658d('0x35')]);_0x323042[_0x658d('0x36')]=_[_0x658d('0x34')](_0x4c5176[_0x658d('0x30')],qs[_0x658d('0x37')](_0x27cccb[_0x658d('0x35')][_0x658d('0x37')]));_0x323042[_0x658d('0x36')]=_0x323042[_0x658d('0x36')][_0x658d('0x38')]?_0x323042[_0x658d('0x36')]:_0x4c5176[_0x658d('0x30')];if(!_0x27cccb[_0x658d('0x35')]['hasOwnProperty']('nolimit')){_0x323042[_0x658d('0x1d')]=qs['limit'](_0x27cccb[_0x658d('0x35')][_0x658d('0x1d')]);_0x323042[_0x658d('0x1f')]=qs[_0x658d('0x1f')](_0x27cccb[_0x658d('0x35')][_0x658d('0x1f')]);}_0x323042[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x27cccb[_0x658d('0x35')]['sort']);_0x323042['where']=qs[_0x658d('0x33')](_[_0x658d('0x3b')](_0x27cccb[_0x658d('0x35')],_0x4c5176[_0x658d('0x33')]),_0x29fb2e);if(_0x27cccb[_0x658d('0x35')][_0x658d('0x3c')]){_0x323042[_0x658d('0x3d')]=_[_0x658d('0x3e')](_0x323042[_0x658d('0x3d')],{'$or':_[_0x658d('0x31')](_0x29fb2e,function(_0x14f084){if(_0x14f084['type']!==_0x658d('0x3f')){var _0x2ac68c={};_0x2ac68c[_0x14f084[_0x658d('0x28')]]={'$like':'%'+_0x27cccb[_0x658d('0x35')][_0x658d('0x3c')]+'%'};return _0x2ac68c;}})});}_0x323042=_[_0x658d('0x3e')]({},_0x323042,_0x27cccb[_0x658d('0x40')]);var _0x40d9e2={'where':_0x323042[_0x658d('0x3d')]};return db['FreshdeskAccount'][_0x658d('0x1e')](_0x40d9e2)[_0x658d('0x24')](function(_0x1ce3f4){_0x2c5afb[_0x658d('0x1e')]=_0x1ce3f4;if(_0x27cccb[_0x658d('0x35')][_0x658d('0x41')]){_0x323042[_0x658d('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x658d('0x43')](_0x323042);})[_0x658d('0x24')](function(_0x285283){_0x2c5afb[_0x658d('0x44')]=_0x285283;return _0x2c5afb;})[_0x658d('0x24')](respondWithFilteredResult(_0x38cd62,_0x323042))['catch'](handleError(_0x38cd62,null));};exports[_0x658d('0x45')]=function(_0x5be04f,_0x47971b){var _0xce7485={'raw':![],'where':{'id':_0x5be04f[_0x658d('0x46')]['id']}},_0x3b894d={};_0x3b894d['model']=_[_0x658d('0x32')](db['FreshdeskAccount'][_0x658d('0x2c')]);_0x3b894d[_0x658d('0x35')]=_[_0x658d('0x32')](_0x5be04f['query']);_0x3b894d[_0x658d('0x33')]=_['intersection'](_0x3b894d[_0x658d('0x30')],_0x3b894d[_0x658d('0x35')]);_0xce7485[_0x658d('0x36')]=_[_0x658d('0x34')](_0x3b894d['model'],qs[_0x658d('0x37')](_0x5be04f['query'][_0x658d('0x37')]));_0xce7485[_0x658d('0x36')]=_0xce7485['attributes']['length']?_0xce7485[_0x658d('0x36')]:_0x3b894d[_0x658d('0x30')];if(_0x5be04f['query'][_0x658d('0x41')]){_0xce7485[_0x658d('0x42')]=[{'all':!![]}];}_0xce7485=_[_0x658d('0x3e')]({},_0xce7485,_0x5be04f[_0x658d('0x40')]);return db['FreshdeskAccount']['find'](_0xce7485)[_0x658d('0x24')](handleEntityNotFound(_0x47971b,null))[_0x658d('0x24')](respondWithResult(_0x47971b,null))[_0x658d('0x47')](handleError(_0x47971b,null));};exports[_0x658d('0x48')]=function(_0x39ae6a,_0xf0067){return db['FreshdeskAccount']['create'](_0x39ae6a[_0x658d('0x49')],{})[_0x658d('0x24')](respondWithResult(_0xf0067,0xc9))['catch'](handleError(_0xf0067,null));};exports[_0x658d('0x23')]=function(_0x3e4fc1,_0x341107){if(_0x3e4fc1[_0x658d('0x49')]['id']){delete _0x3e4fc1['body']['id'];}return db['FreshdeskAccount'][_0x658d('0x4a')]({'where':{'id':_0x3e4fc1[_0x658d('0x46')]['id']}})[_0x658d('0x24')](handleEntityNotFound(_0x341107,null))[_0x658d('0x24')](saveUpdates(_0x3e4fc1[_0x658d('0x49')],null))[_0x658d('0x24')](respondWithResult(_0x341107,null))[_0x658d('0x47')](handleError(_0x341107,null));};exports[_0x658d('0x25')]=function(_0x54d0b0,_0x1b30b8){return db['FreshdeskAccount'][_0x658d('0x4a')]({'where':{'id':_0x54d0b0[_0x658d('0x46')]['id']}})[_0x658d('0x24')](handleEntityNotFound(_0x1b30b8,null))[_0x658d('0x24')](removeEntity(_0x1b30b8,null))[_0x658d('0x47')](handleError(_0x1b30b8,null));};exports[_0x658d('0x4b')]=function(_0x55f81d,_0x8afddd,_0x1ddc49){var _0x3393cf={};var _0x253dd0={};var _0x47b889;var _0x5ec0d0;return db[_0x658d('0x2b')][_0x658d('0x4c')]({'where':{'id':_0x55f81d['params']['id']}})[_0x658d('0x24')](handleEntityNotFound(_0x8afddd,null))['then'](function(_0x49106b){if(_0x49106b){_0x47b889=_0x49106b;_0x253dd0[_0x658d('0x30')]=_[_0x658d('0x32')](db[_0x658d('0x4d')][_0x658d('0x2c')]);_0x253dd0[_0x658d('0x35')]=_[_0x658d('0x32')](_0x55f81d[_0x658d('0x35')]);_0x253dd0[_0x658d('0x33')]=_[_0x658d('0x34')](_0x253dd0[_0x658d('0x30')],_0x253dd0[_0x658d('0x35')]);_0x3393cf[_0x658d('0x36')]=_[_0x658d('0x34')](_0x253dd0[_0x658d('0x30')],qs[_0x658d('0x37')](_0x55f81d[_0x658d('0x35')][_0x658d('0x37')]));_0x3393cf[_0x658d('0x36')]=_0x3393cf[_0x658d('0x36')][_0x658d('0x38')]?_0x3393cf[_0x658d('0x36')]:_0x253dd0[_0x658d('0x30')];_0x3393cf[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x55f81d[_0x658d('0x35')]['sort']);_0x3393cf['where']=qs[_0x658d('0x33')](_[_0x658d('0x3b')](_0x55f81d['query'],_0x253dd0[_0x658d('0x33')]));if(_0x55f81d['query'][_0x658d('0x3c')]){_0x3393cf[_0x658d('0x3d')]=_['merge'](_0x3393cf['where'],{'$or':_[_0x658d('0x31')](_0x3393cf[_0x658d('0x36')],function(_0x10bf70){var _0x59f528={};_0x59f528[_0x10bf70]={'$like':'%'+_0x55f81d[_0x658d('0x35')][_0x658d('0x3c')]+'%'};return _0x59f528;})});}_0x3393cf=_[_0x658d('0x3e')]({},_0x3393cf,_0x55f81d['options']);return _0x47b889[_0x658d('0x4b')](_0x3393cf);}})[_0x658d('0x24')](function(_0x579ee2){if(_0x579ee2){_0x5ec0d0=_0x579ee2[_0x658d('0x38')];if(!_0x55f81d[_0x658d('0x35')]['hasOwnProperty'](_0x658d('0x4e'))){_0x3393cf['limit']=qs[_0x658d('0x1d')](_0x55f81d[_0x658d('0x35')][_0x658d('0x1d')]);_0x3393cf[_0x658d('0x1f')]=qs[_0x658d('0x1f')](_0x55f81d['query'][_0x658d('0x1f')]);}return _0x47b889[_0x658d('0x4b')](_0x3393cf);}})[_0x658d('0x24')](function(_0x4715e0){if(_0x4715e0){return _0x4715e0?{'count':_0x5ec0d0,'rows':_0x4715e0}:null;}})[_0x658d('0x24')](respondWithResult(_0x8afddd,null))[_0x658d('0x47')](handleError(_0x8afddd,null));};exports[_0x658d('0x4f')]=function(_0x530c10,_0x4d0656,_0x56d08a){if(_0x530c10[_0x658d('0x49')]['id']){delete _0x530c10[_0x658d('0x49')]['id'];}return db[_0x658d('0x2b')][_0x658d('0x4c')]({'where':{'id':_0x530c10[_0x658d('0x46')]['id']}})[_0x658d('0x24')](handleEntityNotFound(_0x4d0656,null))[_0x658d('0x24')](function(_0x1b15af){if(_0x1b15af){_0x530c10[_0x658d('0x49')][_0x658d('0x50')]=_0x1b15af['id'];_0x530c10[_0x658d('0x49')][_0x658d('0x51')]=integrations[_0x658d('0x52')](_0x530c10[_0x658d('0x49')][_0x658d('0x53')],_0x530c10['body'][_0x658d('0x2e')]);_0x530c10[_0x658d('0x49')][_0x658d('0x54')]=integrations['getDescriptions'](_0x530c10[_0x658d('0x49')][_0x658d('0x53')],_0x530c10[_0x658d('0x49')][_0x658d('0x2e')]);return db[_0x658d('0x4d')][_0x658d('0x48')](_0x530c10[_0x658d('0x49')],{'include':[{'model':db[_0x658d('0x55')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4d0656,null))[_0x658d('0x47')](handleError(_0x4d0656,null));};exports[_0x658d('0x56')]=function(_0x2b5295,_0x440711,_0x30905b){var _0x3b1d41='';return db[_0x658d('0x2b')][_0x658d('0x4c')]({'where':{'id':_0x2b5295[_0x658d('0x46')]['id']},'attributes':['id',_0x658d('0x57'),_0x658d('0x58')]})['then'](handleEntityNotFound(_0x440711,null))[_0x658d('0x24')](function(_0x1c661d){if(_0x1c661d){_0x3b1d41=_0x1c661d[_0x658d('0x57')];var _0x85c666=_0x3b1d41[_0x658d('0x59')](-0x1);if(_0x85c666==='/'){_0x3b1d41=_0x3b1d41[_0x658d('0x5a')](0x0,_0x3b1d41['lastIndexOf'](_0x85c666));}return rp({'method':'GET','uri':util[_0x658d('0x5b')](_0x658d('0x5c'),_0x3b1d41,_0x658d('0x5d')),'headers':{'Authorization':util[_0x658d('0x5b')](_0x658d('0x5e'),new Buffer(util['format'](_0x658d('0x5f'),_0x1c661d[_0x658d('0x58')]))['toString']('base64'))},'json':!![]});}})[_0x658d('0x24')](function(_0x828d77){if(_0x828d77){var _0x149eec=[_0x658d('0x60'),_0x658d('0x61'),'agent',_0x658d('0x62'),_0x658d('0x19'),_0x658d('0x63'),_0x658d('0x64'),_0x658d('0x65'),_0x658d('0x66'),_0x658d('0x64'),'company'];_['remove'](_0x828d77,function(_0x3cc340){return _0x149eec[_0x658d('0x67')](_0x3cc340[_0x658d('0x28')])||!_0x3cc340[_0x658d('0x68')]&&_0x3cc340[_0x658d('0x2e')]!==_0x658d('0x69')&&_0x3cc340[_0x658d('0x2e')]!=='custom_dropdown';});return{'count':_0x828d77[_0x658d('0x38')],'rows':_['map'](_0x828d77,function(_0x6267b9){return{'id':_0x6267b9[_0x658d('0x28')],'name':_0x6267b9[_0x658d('0x6a')],'custom':!_0x6267b9[_0x658d('0x68')],'options':_0x6267b9[_0x658d('0x6b')]?_[_0x658d('0x31')](_0x6267b9[_0x658d('0x6b')],function(_0x935e9a){return{'name':_[_0x658d('0x6c')](_0x935e9a),'value':_0x935e9a};}):[]};})};}})['then'](respondWithResult(_0x440711,null))[_0x658d('0x47')](function(_0x56e484){var _0x4b152f=_0x2b5295[_0x658d('0x35')][_0x658d('0x6d')]?0x1f4:_0x56e484['statusCode']||0x1f4;logger[_0x658d('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x658d('0x56'),_0x4b152f,JSON[_0x658d('0x6e')](_0x56e484));delete _0x56e484[_0x658d('0x28')];if(_0x4b152f===0x191){_0x4b152f=0x190;}_0x440711[_0x658d('0x19')](_0x4b152f)[_0x658d('0x29')](_0x2b5295[_0x658d('0x35')][_0x658d('0x6d')]?{'message':_0x658d('0x6f'),'statusCode':_0x56e484[_0x658d('0x70')]}:_0x56e484);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 43ea49c..4207272 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 _0xc0ce=['bluebird','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment'];(function(_0x42f5d5,_0x5b70b9){var _0x5e9214=function(_0x304aad){while(--_0x304aad){_0x42f5d5['push'](_0x42f5d5['shift']());}};_0x5e9214(++_0x5b70b9);}(_0xc0ce,0x18f));var _0xec0c=function(_0x48e415,_0xa718b4){_0x48e415=_0x48e415-0x0;var _0x137487=_0xc0ce[_0x48e415];return _0x137487;};'use strict';var _=require(_0xec0c('0x0'));var util=require('util');var logger=require(_0xec0c('0x1'))(_0xec0c('0x2'));var moment=require(_0xec0c('0x3'));var BPromise=require(_0xec0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec0c('0x5'));var rimraf=require('rimraf');var config=require(_0xec0c('0x6'));var attributes=require(_0xec0c('0x7'));var integrations=require(_0xec0c('0x8'));module[_0xec0c('0x9')]=function(_0x19642a,_0x47a127){return _0x19642a[_0xec0c('0xa')](_0xec0c('0xb'),attributes,{'tableName':_0xec0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb137=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2fbdb3,_0x435bfb){var _0x19a6c4=function(_0x1370d6){while(--_0x1370d6){_0x2fbdb3['push'](_0x2fbdb3['shift']());}};_0x19a6c4(++_0x435bfb);}(_0xb137,0xf3));var _0x7b13=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0xb137[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0x7b13('0x0'));var util=require(_0x7b13('0x1'));var logger=require(_0x7b13('0x2'))(_0x7b13('0x3'));var moment=require(_0x7b13('0x4'));var BPromise=require(_0x7b13('0x5'));var rp=require(_0x7b13('0x6'));var fs=require('fs');var path=require(_0x7b13('0x7'));var rimraf=require(_0x7b13('0x8'));var config=require(_0x7b13('0x9'));var attributes=require(_0x7b13('0xa'));var integrations=require(_0x7b13('0xb'));module[_0x7b13('0xc')]=function(_0x28a5ee,_0x3e5f0b){return _0x28a5ee[_0x7b13('0xd')](_0x7b13('0xe'),attributes,{'tableName':_0x7b13('0xf'),'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 d471b3e..56ef7af 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 _0x962c=['debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x2c1a14,_0x50cee8){var _0x3282ff=function(_0x3aa411){while(--_0x3aa411){_0x2c1a14['push'](_0x2c1a14['shift']());}};_0x3282ff(++_0x50cee8);}(_0x962c,0x1a0));var _0xc962=function(_0x5de40c,_0x13d678){_0x5de40c=_0x5de40c-0x0;var _0x2e59ee=_0x962c[_0x5de40c];return _0x2e59ee;};'use strict';var _=require('lodash');var util=require(_0xc962('0x0'));var moment=require(_0xc962('0x1'));var BPromise=require('bluebird');var rs=require(_0xc962('0x2'));var fs=require('fs');var Redis=require(_0xc962('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc962('0x4'));var logger=require(_0xc962('0x5'))('rpc');var config=require(_0xc962('0x6'));var jayson=require(_0xc962('0x7'));var client=jayson[_0xc962('0x8')][_0xc962('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32ea1a,_0x319f71,_0x290aa5){return new BPromise(function(_0x1c3bf7,_0x36dedb){return client['request'](_0x32ea1a,_0x290aa5)[_0xc962('0xa')](function(_0x332e2c){logger[_0xc962('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x319f71,_0xc962('0xc'));logger[_0xc962('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x319f71,'request\x20sent',JSON[_0xc962('0xe')](_0x332e2c));if(_0x332e2c[_0xc962('0xf')]){if(_0x332e2c[_0xc962('0xf')][_0xc962('0x10')]===0x1f4){logger[_0xc962('0xf')](_0xc962('0x11'),_0x319f71,_0x332e2c[_0xc962('0xf')][_0xc962('0x12')]);return _0x36dedb(_0x332e2c[_0xc962('0xf')][_0xc962('0x12')]);}logger['error'](_0xc962('0x11'),_0x319f71,_0x332e2c[_0xc962('0xf')][_0xc962('0x12')]);return _0x1c3bf7(_0x332e2c[_0xc962('0xf')][_0xc962('0x12')]);}else{logger['info'](_0xc962('0x11'),_0x319f71,_0xc962('0xc'));_0x1c3bf7(_0x332e2c[_0xc962('0x13')][_0xc962('0x12')]);}})[_0xc962('0x14')](function(_0x4175c9){logger[_0xc962('0xf')](_0xc962('0x11'),_0x319f71,_0x4175c9);_0x36dedb(_0x4175c9);});});}exports['GetFreshdeskAccount']=function(_0xb20bcd){var _0x2e6429=this;return new Promise(function(_0x182442,_0x761a6a){return db[_0xc962('0x15')][_0xc962('0x16')]({'raw':_0xb20bcd[_0xc962('0x17')]?_0xb20bcd[_0xc962('0x17')][_0xc962('0x18')]===undefined?!![]:![]:!![],'where':_0xb20bcd['options']?_0xb20bcd['options'][_0xc962('0x19')]||null:null,'attributes':_0xb20bcd[_0xc962('0x17')]?_0xb20bcd['options'][_0xc962('0x1a')]||null:null,'limit':_0xb20bcd['options']?_0xb20bcd[_0xc962('0x17')][_0xc962('0x1b')]||null:null,'include':_0xb20bcd['options']?_0xb20bcd[_0xc962('0x17')][_0xc962('0x1c')]?_['map'](_0xb20bcd['options']['include'],function(_0x10112d){return{'model':db[_0x10112d[_0xc962('0x1d')]],'as':_0x10112d['as'],'attributes':_0x10112d[_0xc962('0x1a')],'include':_0x10112d['include']?_[_0xc962('0x1e')](_0x10112d[_0xc962('0x1c')],function(_0x1e9892){return{'model':db[_0x1e9892[_0xc962('0x1d')]],'as':_0x1e9892['as'],'attributes':_0x1e9892[_0xc962('0x1a')],'include':_0x1e9892[_0xc962('0x1c')]?_[_0xc962('0x1e')](_0x1e9892[_0xc962('0x1c')],function(_0x1a0f97){return{'model':db[_0x1a0f97[_0xc962('0x1d')]],'as':_0x1a0f97['as'],'attributes':_0x1a0f97['attributes']};}):[]};}):[]};}):[]:[]})[_0xc962('0xa')](function(_0x49d83e){logger[_0xc962('0xb')](_0xc962('0x1f'),_0xb20bcd);logger['debug']('GetFreshdeskAccount',_0xb20bcd,JSON[_0xc962('0xe')](_0x49d83e));_0x182442(_0x49d83e);})[_0xc962('0x14')](function(_0x133f5e){logger[_0xc962('0xf')](_0xc962('0x1f'),_0x133f5e[_0xc962('0x12')],_0xb20bcd);_0x761a6a(_0x2e6429[_0xc962('0xf')](0x1f4,_0x133f5e[_0xc962('0x12')]));});});};exports[_0xc962('0x20')]=function(_0x39e732){var _0x31e4db=this;return new Promise(function(_0x1e9119,_0x4da7d6){return db[_0xc962('0x15')]['find']({'raw':_0x39e732['options']?_0x39e732[_0xc962('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x39e732['options']?_0x39e732[_0xc962('0x17')][_0xc962('0x19')]||null:null,'attributes':_0x39e732[_0xc962('0x17')]?_0x39e732[_0xc962('0x17')][_0xc962('0x1a')]||null:null,'include':_0x39e732[_0xc962('0x17')]?_0x39e732[_0xc962('0x17')][_0xc962('0x1c')]?_['map'](_0x39e732['options']['include'],function(_0x36e1ec){return{'model':db[_0x36e1ec['model']],'as':_0x36e1ec['as'],'attributes':_0x36e1ec[_0xc962('0x1a')],'include':_0x36e1ec[_0xc962('0x1c')]?_[_0xc962('0x1e')](_0x36e1ec['include'],function(_0x4e03e0){return{'model':db[_0x4e03e0['model']],'as':_0x4e03e0['as'],'attributes':_0x4e03e0['attributes'],'include':_0x4e03e0[_0xc962('0x1c')]?_[_0xc962('0x1e')](_0x4e03e0[_0xc962('0x1c')],function(_0x581f06){return{'model':db[_0x581f06[_0xc962('0x1d')]],'as':_0x581f06['as'],'attributes':_0x581f06[_0xc962('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc962('0xa')](function(_0x26d01a){logger[_0xc962('0xb')](_0xc962('0x20'),_0x39e732);logger['debug'](_0xc962('0x20'),_0x39e732,JSON[_0xc962('0xe')](_0x26d01a));_0x1e9119(_0x26d01a);})[_0xc962('0x14')](function(_0x3b4e21){logger[_0xc962('0xf')](_0xc962('0x20'),_0x3b4e21[_0xc962('0x12')],_0x39e732);_0x4da7d6(_0x31e4db['error'](0x1f4,_0x3b4e21[_0xc962('0x12')]));});});}; \ No newline at end of file +var _0xe16f=['map','model','stringify','ShowFreshdeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','include'];(function(_0x27df65,_0x1bbc3e){var _0x42b4a6=function(_0x39c104){while(--_0x39c104){_0x27df65['push'](_0x27df65['shift']());}};_0x42b4a6(++_0x1bbc3e);}(_0xe16f,0x9f));var _0xfe16=function(_0x29189c,_0x216fb6){_0x29189c=_0x29189c-0x0;var _0x25f495=_0xe16f[_0x29189c];return _0x25f495;};'use strict';var _=require('lodash');var util=require(_0xfe16('0x0'));var moment=require(_0xfe16('0x1'));var BPromise=require(_0xfe16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe16('0x3'));var db=require(_0xfe16('0x4'))['db'];var utils=require(_0xfe16('0x5'));var logger=require('../../config/logger')(_0xfe16('0x6'));var config=require(_0xfe16('0x7'));var jayson=require(_0xfe16('0x8'));var client=jayson[_0xfe16('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f88d,_0x28d121,_0x5b503c){return new BPromise(function(_0x8109a2,_0x1ba1b0){return client[_0xfe16('0xa')](_0x35f88d,_0x5b503c)[_0xfe16('0xb')](function(_0x5f09a5){logger[_0xfe16('0xc')](_0xfe16('0xd'),_0x28d121,'request\x20sent');logger[_0xfe16('0xe')](_0xfe16('0xf'),_0x28d121,_0xfe16('0x10'),JSON['stringify'](_0x5f09a5));if(_0x5f09a5['error']){if(_0x5f09a5[_0xfe16('0x11')]['code']===0x1f4){logger[_0xfe16('0x11')](_0xfe16('0xd'),_0x28d121,_0x5f09a5[_0xfe16('0x11')]['message']);return _0x1ba1b0(_0x5f09a5['error']['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x28d121,_0x5f09a5[_0xfe16('0x11')][_0xfe16('0x12')]);return _0x8109a2(_0x5f09a5[_0xfe16('0x11')][_0xfe16('0x12')]);}else{logger[_0xfe16('0xc')](_0xfe16('0xd'),_0x28d121,_0xfe16('0x10'));_0x8109a2(_0x5f09a5['result'][_0xfe16('0x12')]);}})[_0xfe16('0x13')](function(_0x41d52b){logger[_0xfe16('0x11')](_0xfe16('0xd'),_0x28d121,_0x41d52b);_0x1ba1b0(_0x41d52b);});});}exports[_0xfe16('0x14')]=function(_0x692303){var _0x5bfeb7=this;return new Promise(function(_0xc5ff40,_0x4590d1){return db['FreshdeskAccount']['findAll']({'raw':_0x692303[_0xfe16('0x15')]?_0x692303[_0xfe16('0x15')][_0xfe16('0x16')]===undefined?!![]:![]:!![],'where':_0x692303['options']?_0x692303[_0xfe16('0x15')][_0xfe16('0x17')]||null:null,'attributes':_0x692303['options']?_0x692303[_0xfe16('0x15')][_0xfe16('0x18')]||null:null,'limit':_0x692303[_0xfe16('0x15')]?_0x692303[_0xfe16('0x15')][_0xfe16('0x19')]||null:null,'include':_0x692303[_0xfe16('0x15')]?_0x692303[_0xfe16('0x15')][_0xfe16('0x1a')]?_[_0xfe16('0x1b')](_0x692303[_0xfe16('0x15')]['include'],function(_0x12e69d){return{'model':db[_0x12e69d['model']],'as':_0x12e69d['as'],'attributes':_0x12e69d[_0xfe16('0x18')],'include':_0x12e69d[_0xfe16('0x1a')]?_[_0xfe16('0x1b')](_0x12e69d[_0xfe16('0x1a')],function(_0x1f9316){return{'model':db[_0x1f9316[_0xfe16('0x1c')]],'as':_0x1f9316['as'],'attributes':_0x1f9316[_0xfe16('0x18')],'include':_0x1f9316[_0xfe16('0x1a')]?_[_0xfe16('0x1b')](_0x1f9316[_0xfe16('0x1a')],function(_0x319654){return{'model':db[_0x319654[_0xfe16('0x1c')]],'as':_0x319654['as'],'attributes':_0x319654[_0xfe16('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfe16('0xb')](function(_0x441d3a){logger['info'](_0xfe16('0x14'),_0x692303);logger[_0xfe16('0xe')](_0xfe16('0x14'),_0x692303,JSON[_0xfe16('0x1d')](_0x441d3a));_0xc5ff40(_0x441d3a);})[_0xfe16('0x13')](function(_0x36aa39){logger[_0xfe16('0x11')](_0xfe16('0x14'),_0x36aa39['message'],_0x692303);_0x4590d1(_0x5bfeb7[_0xfe16('0x11')](0x1f4,_0x36aa39['message']));});});};exports[_0xfe16('0x1e')]=function(_0x39d66f){var _0x4c915e=this;return new Promise(function(_0x13497b,_0x662df9){return db['FreshdeskAccount']['find']({'raw':_0x39d66f[_0xfe16('0x15')]?_0x39d66f[_0xfe16('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x39d66f[_0xfe16('0x15')]?_0x39d66f[_0xfe16('0x15')][_0xfe16('0x17')]||null:null,'attributes':_0x39d66f[_0xfe16('0x15')]?_0x39d66f[_0xfe16('0x15')]['attributes']||null:null,'include':_0x39d66f[_0xfe16('0x15')]?_0x39d66f[_0xfe16('0x15')][_0xfe16('0x1a')]?_[_0xfe16('0x1b')](_0x39d66f[_0xfe16('0x15')][_0xfe16('0x1a')],function(_0x5de257){return{'model':db[_0x5de257[_0xfe16('0x1c')]],'as':_0x5de257['as'],'attributes':_0x5de257[_0xfe16('0x18')],'include':_0x5de257[_0xfe16('0x1a')]?_['map'](_0x5de257[_0xfe16('0x1a')],function(_0x338e2f){return{'model':db[_0x338e2f['model']],'as':_0x338e2f['as'],'attributes':_0x338e2f[_0xfe16('0x18')],'include':_0x338e2f[_0xfe16('0x1a')]?_[_0xfe16('0x1b')](_0x338e2f['include'],function(_0xe7186c){return{'model':db[_0xe7186c['model']],'as':_0xe7186c['as'],'attributes':_0xe7186c[_0xfe16('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfe16('0xb')](function(_0x1dc263){logger[_0xfe16('0xc')]('ShowFreshdeskAccount',_0x39d66f);logger[_0xfe16('0xe')](_0xfe16('0x1e'),_0x39d66f,JSON[_0xfe16('0x1d')](_0x1dc263));_0x13497b(_0x1dc263);})[_0xfe16('0x13')](function(_0xe79db4){logger[_0xfe16('0x11')](_0xfe16('0x1e'),_0xe79db4[_0xfe16('0x12')],_0x39d66f);_0x662df9(_0x4c915e[_0xfe16('0x11')](0x1f4,_0xe79db4['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0475424..ba1f35e 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 _0x14d7=['setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x14d7,0xde));var _0x714d=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0x14d7[_0x35468d];return _0x30da52;};'use strict';var multer=require(_0x714d('0x0'));var util=require('util');var path=require(_0x714d('0x1'));var timeout=require(_0x714d('0x2'));var express=require(_0x714d('0x3'));var router=express[_0x714d('0x4')]();var fs_extra=require(_0x714d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x714d('0x6'));var controller=require(_0x714d('0x7'));router['get']('/',auth[_0x714d('0x8')](),controller[_0x714d('0x9')]);router[_0x714d('0xa')](_0x714d('0xb'),auth[_0x714d('0x8')](),controller[_0x714d('0xc')]);router['get'](_0x714d('0xd'),auth[_0x714d('0x8')](),controller[_0x714d('0xe')]);router[_0x714d('0xa')]('/:id/subjects',auth[_0x714d('0x8')](),controller[_0x714d('0xf')]);router[_0x714d('0xa')](_0x714d('0x10'),auth[_0x714d('0x8')](),controller[_0x714d('0x11')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x714d('0x12')]('/',auth['isAuthenticated'](),controller[_0x714d('0x13')]);router['post'](_0x714d('0x14'),auth[_0x714d('0x8')](),controller[_0x714d('0x15')]);router[_0x714d('0x16')](_0x714d('0xb'),auth[_0x714d('0x8')](),controller[_0x714d('0x17')]);router[_0x714d('0x18')](_0x714d('0xb'),auth[_0x714d('0x8')](),controller[_0x714d('0x19')]);module[_0x714d('0x1a')]=router; \ No newline at end of file +var _0xad9c=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','setTags','put','update','delete','exports','path','connect-timeout','Router'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xad9c,0xfa));var _0xcad9=function(_0x1e3402,_0x3cc406){_0x1e3402=_0x1e3402-0x0;var _0x360ced=_0xad9c[_0x1e3402];return _0x360ced;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcad9('0x0'));var timeout=require(_0xcad9('0x1'));var express=require('express');var router=express[_0xcad9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcad9('0x3'));var interaction=require(_0xcad9('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xcad9('0x5')]('/',auth[_0xcad9('0x6')](),controller[_0xcad9('0x7')]);router[_0xcad9('0x5')](_0xcad9('0x8'),auth['isAuthenticated'](),controller[_0xcad9('0x9')]);router[_0xcad9('0x5')](_0xcad9('0xa'),auth[_0xcad9('0x6')](),controller[_0xcad9('0xb')]);router['get'](_0xcad9('0xc'),auth[_0xcad9('0x6')](),controller[_0xcad9('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xcad9('0xe')]);router['get']('/:id/tags',auth[_0xcad9('0x6')](),controller[_0xcad9('0xf')]);router[_0xcad9('0x10')]('/',auth[_0xcad9('0x6')](),controller[_0xcad9('0x11')]);router[_0xcad9('0x10')]('/:id/tags',auth[_0xcad9('0x6')](),controller[_0xcad9('0x12')]);router[_0xcad9('0x13')](_0xcad9('0x8'),auth[_0xcad9('0x6')](),controller[_0xcad9('0x14')]);router[_0xcad9('0x15')](_0xcad9('0x8'),auth[_0xcad9('0x6')](),controller['destroy']);module[_0xcad9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b95919a..de82e9c 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 _0x99de=['exports','STRING','sequelize'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x99de,0xda));var _0xe99d=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x99de[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0xe99d('0x0'));module[_0xe99d('0x1')]={'name':{'type':Sequelize[_0xe99d('0x2')]},'description':{'type':Sequelize[_0xe99d('0x2')]}}; \ No newline at end of file +var _0x96d3=['sequelize','exports'];(function(_0x48b9e8,_0x12c1ae){var _0x4cf746=function(_0x402879){while(--_0x402879){_0x48b9e8['push'](_0x48b9e8['shift']());}};_0x4cf746(++_0x12c1ae);}(_0x96d3,0x13e));var _0x396d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x96d3[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x396d('0x0'));module[_0x396d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b18ecfc..c7a9873 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 _0xc567=['nolimit','getDescriptions','Tag','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','FreshdeskField','keys','findOne','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc567,0x101));var _0x7c56=function(_0x1d1ec2,_0x54694b){_0x1d1ec2=_0x1d1ec2-0x0;var _0x5ee4b5=_0xc567[_0x1d1ec2];return _0x5ee4b5;};'use strict';var emlformat=require(_0x7c56('0x0'));var rimraf=require(_0x7c56('0x1'));var zipdir=require(_0x7c56('0x2'));var jsonpatch=require(_0x7c56('0x3'));var rp=require('request-promise');var moment=require(_0x7c56('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c56('0x5'));var path=require('path');var sox=require(_0x7c56('0x6'));var csv=require(_0x7c56('0x7'));var ejs=require(_0x7c56('0x8'));var fs=require('fs');var fs_extra=require(_0x7c56('0x9'));var _=require(_0x7c56('0xa'));var squel=require('squel');var crypto=require(_0x7c56('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c56('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c56('0xd'));var Papa=require(_0x7c56('0xe'));var Redis=require(_0x7c56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c56('0x10'));var as=require(_0x7c56('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c56('0x12'))('api');var utils=require(_0x7c56('0x13'));var config=require(_0x7c56('0x14'));var licenseUtil=require(_0x7c56('0x15'));var db=require(_0x7c56('0x16'))['db'];function respondWithStatusCode(_0x3b07c7,_0x41a1a0){_0x41a1a0=_0x41a1a0||0xcc;return function(_0x582d11){if(_0x582d11){return _0x3b07c7[_0x7c56('0x17')](_0x41a1a0);}return _0x3b07c7[_0x7c56('0x18')](_0x41a1a0)[_0x7c56('0x19')]();};}function respondWithResult(_0x4a4d6a,_0x1edc6b){_0x1edc6b=_0x1edc6b||0xc8;return function(_0x246263){if(_0x246263){return _0x4a4d6a[_0x7c56('0x18')](_0x1edc6b)[_0x7c56('0x1a')](_0x246263);}};}function respondWithFilteredResult(_0x298093,_0x164abd){return function(_0x4aab45){if(_0x4aab45){var _0x4a924f=typeof _0x164abd[_0x7c56('0x1b')]===_0x7c56('0x1c')&&typeof _0x164abd[_0x7c56('0x1d')]===_0x7c56('0x1c');var _0x5937e3=_0x4aab45['count'];var _0xe950da=_0x4a924f?0x0:_0x164abd['offset'];var _0x1430b9=_0x4a924f?_0x4aab45['count']:_0x164abd['offset']+_0x164abd['limit'];var _0x517644;if(_0x1430b9>=_0x5937e3){_0x1430b9=_0x5937e3;_0x517644=0xc8;}else{_0x517644=0xce;}_0x298093['status'](_0x517644);return _0x298093[_0x7c56('0x1e')](_0x7c56('0x1f'),_0xe950da+'-'+_0x1430b9+'/'+_0x5937e3)[_0x7c56('0x1a')](_0x4aab45);}return null;};}function patchUpdates(_0x47f8c6){return function(_0x4c65e5){try{jsonpatch[_0x7c56('0x20')](_0x4c65e5,_0x47f8c6,!![]);}catch(_0x1fd179){return BPromise[_0x7c56('0x21')](_0x1fd179);}return _0x4c65e5[_0x7c56('0x22')]();};}function saveUpdates(_0x5a0b3c,_0x4ea012){return function(_0x468a99){if(_0x468a99){return _0x468a99[_0x7c56('0x23')](_0x5a0b3c)[_0x7c56('0x24')](function(_0x13a674){return _0x13a674;});}return null;};}function removeEntity(_0x39af30,_0x5ccff9){return function(_0x35f5bb){if(_0x35f5bb){return _0x35f5bb[_0x7c56('0x25')]()['then'](function(){_0x39af30[_0x7c56('0x18')](0xcc)[_0x7c56('0x19')]();});}};}function handleEntityNotFound(_0x5d0725,_0x34c997){return function(_0x446327){if(!_0x446327){_0x5d0725['sendStatus'](0x194);}return _0x446327;};}function handleError(_0x4a9b18,_0x19a480){_0x19a480=_0x19a480||0x1f4;return function(_0x668899){logger[_0x7c56('0x26')](_0x668899[_0x7c56('0x27')]);if(_0x668899[_0x7c56('0x28')]){delete _0x668899[_0x7c56('0x28')];}_0x4a9b18[_0x7c56('0x18')](_0x19a480)['send'](_0x668899);};}exports[_0x7c56('0x29')]=function(_0x42a6ea,_0x3396ce){var _0x706a25={},_0x54ba23={},_0x5a6f90={'count':0x0,'rows':[]};var _0x38a609=_[_0x7c56('0x2a')](db[_0x7c56('0x2b')][_0x7c56('0x2c')],function(_0xb977d6){return{'name':_0xb977d6[_0x7c56('0x2d')],'type':_0xb977d6[_0x7c56('0x2e')]['key']};});_0x54ba23['model']=_[_0x7c56('0x2a')](_0x38a609,_0x7c56('0x28'));_0x54ba23[_0x7c56('0x2f')]=_['keys'](_0x42a6ea['query']);_0x54ba23[_0x7c56('0x30')]=_[_0x7c56('0x31')](_0x54ba23[_0x7c56('0x32')],_0x54ba23[_0x7c56('0x2f')]);_0x706a25[_0x7c56('0x33')]=_[_0x7c56('0x31')](_0x54ba23[_0x7c56('0x32')],qs['fields'](_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x34')]));_0x706a25[_0x7c56('0x33')]=_0x706a25['attributes']['length']?_0x706a25[_0x7c56('0x33')]:_0x54ba23['model'];if(!_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x35')]('nolimit')){_0x706a25[_0x7c56('0x1d')]=qs['limit'](_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x1d')]);_0x706a25[_0x7c56('0x1b')]=qs[_0x7c56('0x1b')](_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x1b')]);}_0x706a25[_0x7c56('0x36')]=qs[_0x7c56('0x37')](_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x37')]);_0x706a25[_0x7c56('0x38')]=qs[_0x7c56('0x30')](_[_0x7c56('0x39')](_0x42a6ea[_0x7c56('0x2f')],_0x54ba23[_0x7c56('0x30')]),_0x38a609);if(_0x42a6ea['query'][_0x7c56('0x3a')]){_0x706a25[_0x7c56('0x38')]=_[_0x7c56('0x3b')](_0x706a25[_0x7c56('0x38')],{'$or':_[_0x7c56('0x2a')](_0x38a609,function(_0x1fa5e6){if(_0x1fa5e6[_0x7c56('0x2e')]!==_0x7c56('0x3c')){var _0x41bfcf={};_0x41bfcf[_0x1fa5e6['name']]={'$like':'%'+_0x42a6ea['query']['filter']+'%'};return _0x41bfcf;}})});}_0x706a25=_['merge']({},_0x706a25,_0x42a6ea[_0x7c56('0x3d')]);var _0x458220={'where':_0x706a25[_0x7c56('0x38')]};return db[_0x7c56('0x2b')][_0x7c56('0x3e')](_0x458220)[_0x7c56('0x24')](function(_0x568d1c){_0x5a6f90[_0x7c56('0x3e')]=_0x568d1c;if(_0x42a6ea[_0x7c56('0x2f')][_0x7c56('0x3f')]){_0x706a25[_0x7c56('0x40')]=[{'all':!![]}];}return db[_0x7c56('0x2b')][_0x7c56('0x41')](_0x706a25);})['then'](function(_0x5ca8ba){_0x5a6f90[_0x7c56('0x42')]=_0x5ca8ba;return _0x5a6f90;})['then'](respondWithFilteredResult(_0x3396ce,_0x706a25))[_0x7c56('0x43')](handleError(_0x3396ce,null));};exports[_0x7c56('0x44')]=function(_0x50ba47,_0x50b2c0){var _0x5430a3={'raw':![],'where':{'id':_0x50ba47[_0x7c56('0x45')]['id']}},_0x49210b={};_0x49210b[_0x7c56('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0x7c56('0x2c')]);_0x49210b[_0x7c56('0x2f')]=_['keys'](_0x50ba47[_0x7c56('0x2f')]);_0x49210b[_0x7c56('0x30')]=_['intersection'](_0x49210b['model'],_0x49210b['query']);_0x5430a3[_0x7c56('0x33')]=_['intersection'](_0x49210b['model'],qs[_0x7c56('0x34')](_0x50ba47[_0x7c56('0x2f')][_0x7c56('0x34')]));_0x5430a3[_0x7c56('0x33')]=_0x5430a3[_0x7c56('0x33')][_0x7c56('0x46')]?_0x5430a3[_0x7c56('0x33')]:_0x49210b[_0x7c56('0x32')];if(_0x50ba47[_0x7c56('0x2f')][_0x7c56('0x3f')]){_0x5430a3[_0x7c56('0x40')]=[{'all':!![]}];}_0x5430a3=_['merge']({},_0x5430a3,_0x50ba47[_0x7c56('0x3d')]);return db[_0x7c56('0x2b')][_0x7c56('0x47')](_0x5430a3)[_0x7c56('0x24')](handleEntityNotFound(_0x50b2c0,null))[_0x7c56('0x24')](respondWithResult(_0x50b2c0,null))[_0x7c56('0x43')](handleError(_0x50b2c0,null));};exports[_0x7c56('0x48')]=function(_0x22aaa5,_0x14202f){return db['FreshdeskConfiguration'][_0x7c56('0x48')](_0x22aaa5[_0x7c56('0x49')],{})[_0x7c56('0x24')](respondWithResult(_0x14202f,0xc9))['catch'](handleError(_0x14202f,null));};exports[_0x7c56('0x23')]=function(_0x102d04,_0x10006d){if(_0x102d04[_0x7c56('0x49')]['id']){delete _0x102d04[_0x7c56('0x49')]['id'];}return db[_0x7c56('0x2b')][_0x7c56('0x47')]({'where':{'id':_0x102d04[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x10006d,null))[_0x7c56('0x24')](saveUpdates(_0x102d04['body'],null))[_0x7c56('0x24')](respondWithResult(_0x10006d,null))[_0x7c56('0x43')](handleError(_0x10006d,null));};exports[_0x7c56('0x25')]=function(_0x317060,_0x1e0640){return db[_0x7c56('0x2b')][_0x7c56('0x47')]({'where':{'id':_0x317060[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x1e0640,null))['then'](removeEntity(_0x1e0640,null))[_0x7c56('0x43')](handleError(_0x1e0640,null));};exports[_0x7c56('0x4a')]=function(_0x41d7fd,_0x111c8b,_0x38352d){var _0x3d5268={};var _0x34ffbb={};var _0x178214;var _0x1f06a7;return db[_0x7c56('0x2b')]['findOne']({'where':{'id':_0x41d7fd[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x111c8b,null))[_0x7c56('0x24')](function(_0x400711){if(_0x400711){_0x178214=_0x400711;_0x34ffbb[_0x7c56('0x32')]=_['keys'](db[_0x7c56('0x4b')][_0x7c56('0x2c')]);_0x34ffbb[_0x7c56('0x2f')]=_[_0x7c56('0x4c')](_0x41d7fd[_0x7c56('0x2f')]);_0x34ffbb[_0x7c56('0x30')]=_[_0x7c56('0x31')](_0x34ffbb[_0x7c56('0x32')],_0x34ffbb['query']);_0x3d5268[_0x7c56('0x33')]=_['intersection'](_0x34ffbb[_0x7c56('0x32')],qs[_0x7c56('0x34')](_0x41d7fd['query'][_0x7c56('0x34')]));_0x3d5268[_0x7c56('0x33')]=_0x3d5268[_0x7c56('0x33')][_0x7c56('0x46')]?_0x3d5268[_0x7c56('0x33')]:_0x34ffbb[_0x7c56('0x32')];_0x3d5268[_0x7c56('0x36')]=qs[_0x7c56('0x37')](_0x41d7fd[_0x7c56('0x2f')][_0x7c56('0x37')]);_0x3d5268[_0x7c56('0x38')]=qs['filters'](_['pick'](_0x41d7fd['query'],_0x34ffbb[_0x7c56('0x30')]));if(_0x41d7fd[_0x7c56('0x2f')]['filter']){_0x3d5268[_0x7c56('0x38')]=_[_0x7c56('0x3b')](_0x3d5268[_0x7c56('0x38')],{'$or':_['map'](_0x3d5268[_0x7c56('0x33')],function(_0x2db0d6){var _0x870ef={};_0x870ef[_0x2db0d6]={'$like':'%'+_0x41d7fd[_0x7c56('0x2f')][_0x7c56('0x3a')]+'%'};return _0x870ef;})});}_0x3d5268=_[_0x7c56('0x3b')]({},_0x3d5268,_0x41d7fd['options']);return _0x178214['getFields'](_0x3d5268);}})[_0x7c56('0x24')](function(_0x245c93){if(_0x245c93){_0x1f06a7=_0x245c93[_0x7c56('0x46')];if(!_0x41d7fd['query'][_0x7c56('0x35')]('nolimit')){_0x3d5268[_0x7c56('0x1d')]=qs[_0x7c56('0x1d')](_0x41d7fd[_0x7c56('0x2f')]['limit']);_0x3d5268[_0x7c56('0x1b')]=qs[_0x7c56('0x1b')](_0x41d7fd[_0x7c56('0x2f')][_0x7c56('0x1b')]);}return _0x178214['getFields'](_0x3d5268);}})[_0x7c56('0x24')](function(_0xe0679e){if(_0xe0679e){return _0xe0679e?{'count':_0x1f06a7,'rows':_0xe0679e}:null;}})[_0x7c56('0x24')](respondWithResult(_0x111c8b,null))['catch'](handleError(_0x111c8b,null));};exports['getSubjects']=function(_0x294841,_0x4296b9,_0x4ad364){var _0x1da991={};var _0x466926={};var _0x299284;var _0x18165b;return db[_0x7c56('0x2b')][_0x7c56('0x4d')]({'where':{'id':_0x294841['params']['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x4296b9,null))[_0x7c56('0x24')](function(_0x77a537){if(_0x77a537){_0x299284=_0x77a537;_0x466926[_0x7c56('0x32')]=_[_0x7c56('0x4c')](db[_0x7c56('0x4b')][_0x7c56('0x2c')]);_0x466926[_0x7c56('0x2f')]=_['keys'](_0x294841[_0x7c56('0x2f')]);_0x466926[_0x7c56('0x30')]=_['intersection'](_0x466926['model'],_0x466926[_0x7c56('0x2f')]);_0x1da991[_0x7c56('0x33')]=_['intersection'](_0x466926[_0x7c56('0x32')],qs[_0x7c56('0x34')](_0x294841[_0x7c56('0x2f')][_0x7c56('0x34')]));_0x1da991[_0x7c56('0x33')]=_0x1da991[_0x7c56('0x33')][_0x7c56('0x46')]?_0x1da991[_0x7c56('0x33')]:_0x466926[_0x7c56('0x32')];_0x1da991['order']=qs[_0x7c56('0x37')](_0x294841[_0x7c56('0x2f')]['sort']);_0x1da991['where']=qs['filters'](_['pick'](_0x294841[_0x7c56('0x2f')],_0x466926[_0x7c56('0x30')]));if(_0x294841[_0x7c56('0x2f')]['filter']){_0x1da991[_0x7c56('0x38')]=_['merge'](_0x1da991[_0x7c56('0x38')],{'$or':_['map'](_0x1da991['attributes'],function(_0x49b295){var _0x201f09={};_0x201f09[_0x49b295]={'$like':'%'+_0x294841[_0x7c56('0x2f')][_0x7c56('0x3a')]+'%'};return _0x201f09;})});}_0x1da991=_['merge']({},_0x1da991,_0x294841[_0x7c56('0x3d')]);return _0x299284[_0x7c56('0x4e')](_0x1da991);}})['then'](function(_0x1150f9){if(_0x1150f9){_0x18165b=_0x1150f9[_0x7c56('0x46')];if(!_0x294841[_0x7c56('0x2f')][_0x7c56('0x35')](_0x7c56('0x4f'))){_0x1da991[_0x7c56('0x1d')]=qs[_0x7c56('0x1d')](_0x294841['query'][_0x7c56('0x1d')]);_0x1da991[_0x7c56('0x1b')]=qs['offset'](_0x294841[_0x7c56('0x2f')]['offset']);}return _0x299284[_0x7c56('0x4e')](_0x1da991);}})[_0x7c56('0x24')](function(_0x2245b2){if(_0x2245b2){return _0x2245b2?{'count':_0x18165b,'rows':_0x2245b2}:null;}})[_0x7c56('0x24')](respondWithResult(_0x4296b9,null))[_0x7c56('0x43')](handleError(_0x4296b9,null));};exports[_0x7c56('0x50')]=function(_0x3042c4,_0x1ec810,_0x10d07e){var _0x5cc286={};var _0x4af56a={};var _0x40f314;var _0x40fd22;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3042c4[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x1ec810,null))[_0x7c56('0x24')](function(_0xc166ab){if(_0xc166ab){_0x40f314=_0xc166ab;_0x4af56a[_0x7c56('0x32')]=_[_0x7c56('0x4c')](db[_0x7c56('0x4b')][_0x7c56('0x2c')]);_0x4af56a[_0x7c56('0x2f')]=_[_0x7c56('0x4c')](_0x3042c4['query']);_0x4af56a[_0x7c56('0x30')]=_[_0x7c56('0x31')](_0x4af56a[_0x7c56('0x32')],_0x4af56a[_0x7c56('0x2f')]);_0x5cc286[_0x7c56('0x33')]=_['intersection'](_0x4af56a[_0x7c56('0x32')],qs['fields'](_0x3042c4[_0x7c56('0x2f')]['fields']));_0x5cc286[_0x7c56('0x33')]=_0x5cc286[_0x7c56('0x33')][_0x7c56('0x46')]?_0x5cc286['attributes']:_0x4af56a['model'];_0x5cc286[_0x7c56('0x36')]=qs[_0x7c56('0x37')](_0x3042c4[_0x7c56('0x2f')][_0x7c56('0x37')]);_0x5cc286['where']=qs[_0x7c56('0x30')](_['pick'](_0x3042c4[_0x7c56('0x2f')],_0x4af56a[_0x7c56('0x30')]));if(_0x3042c4[_0x7c56('0x2f')][_0x7c56('0x3a')]){_0x5cc286[_0x7c56('0x38')]=_[_0x7c56('0x3b')](_0x5cc286[_0x7c56('0x38')],{'$or':_[_0x7c56('0x2a')](_0x5cc286['attributes'],function(_0x21836b){var _0x5262c3={};_0x5262c3[_0x21836b]={'$like':'%'+_0x3042c4[_0x7c56('0x2f')]['filter']+'%'};return _0x5262c3;})});}_0x5cc286=_[_0x7c56('0x3b')]({},_0x5cc286,_0x3042c4[_0x7c56('0x3d')]);return _0x40f314[_0x7c56('0x50')](_0x5cc286);}})[_0x7c56('0x24')](function(_0x1a5e56){if(_0x1a5e56){_0x40fd22=_0x1a5e56['length'];if(!_0x3042c4[_0x7c56('0x2f')]['hasOwnProperty'](_0x7c56('0x4f'))){_0x5cc286[_0x7c56('0x1d')]=qs[_0x7c56('0x1d')](_0x3042c4[_0x7c56('0x2f')][_0x7c56('0x1d')]);_0x5cc286['offset']=qs[_0x7c56('0x1b')](_0x3042c4['query']['offset']);}return _0x40f314[_0x7c56('0x50')](_0x5cc286);}})[_0x7c56('0x24')](function(_0x1e01f7){if(_0x1e01f7){return _0x1e01f7?{'count':_0x40fd22,'rows':_0x1e01f7}:null;}})[_0x7c56('0x24')](respondWithResult(_0x1ec810,null))[_0x7c56('0x43')](handleError(_0x1ec810,null));};exports['getTags']=function(_0x27c3aa,_0x47fe92,_0x5772d9){var _0x3b44b0={};var _0x53b8a3={};var _0xf69eff;var _0x4e7100;return db[_0x7c56('0x2b')][_0x7c56('0x4d')]({'where':{'id':_0x27c3aa[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x47fe92,null))['then'](function(_0x442415){if(_0x442415){_0xf69eff=_0x442415;_0x53b8a3[_0x7c56('0x32')]=_[_0x7c56('0x4c')](db[_0x7c56('0x51')][_0x7c56('0x2c')]);_0x53b8a3[_0x7c56('0x2f')]=_[_0x7c56('0x4c')](_0x27c3aa[_0x7c56('0x2f')]);_0x53b8a3[_0x7c56('0x30')]=_['intersection'](_0x53b8a3[_0x7c56('0x32')],_0x53b8a3['query']);_0x3b44b0['attributes']=_[_0x7c56('0x31')](_0x53b8a3[_0x7c56('0x32')],qs[_0x7c56('0x34')](_0x27c3aa['query'][_0x7c56('0x34')]));_0x3b44b0[_0x7c56('0x33')]=_0x3b44b0[_0x7c56('0x33')][_0x7c56('0x46')]?_0x3b44b0['attributes']:_0x53b8a3[_0x7c56('0x32')];_0x3b44b0[_0x7c56('0x36')]=qs[_0x7c56('0x37')](_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x37')]);_0x3b44b0[_0x7c56('0x38')]=qs[_0x7c56('0x30')](_['pick'](_0x27c3aa['query'],_0x53b8a3[_0x7c56('0x30')]));if(_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x3a')]){_0x3b44b0['where']=_[_0x7c56('0x3b')](_0x3b44b0[_0x7c56('0x38')],{'$or':_[_0x7c56('0x2a')](_0x3b44b0[_0x7c56('0x33')],function(_0x8154d9){var _0x2c87ff={};_0x2c87ff[_0x8154d9]={'$like':'%'+_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x3a')]+'%'};return _0x2c87ff;})});}_0x3b44b0=_[_0x7c56('0x3b')]({},_0x3b44b0,_0x27c3aa['options']);return _0xf69eff[_0x7c56('0x52')](_0x3b44b0);}})[_0x7c56('0x24')](function(_0x24fc4f){if(_0x24fc4f){_0x4e7100=_0x24fc4f[_0x7c56('0x46')];if(!_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x35')](_0x7c56('0x4f'))){_0x3b44b0[_0x7c56('0x1d')]=qs[_0x7c56('0x1d')](_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x1d')]);_0x3b44b0[_0x7c56('0x1b')]=qs['offset'](_0x27c3aa[_0x7c56('0x2f')][_0x7c56('0x1b')]);}return _0xf69eff[_0x7c56('0x52')](_0x3b44b0);}})[_0x7c56('0x24')](function(_0x298d97){if(_0x298d97){return _0x298d97?{'count':_0x4e7100,'rows':_0x298d97}:null;}})[_0x7c56('0x24')](respondWithResult(_0x47fe92,null))[_0x7c56('0x43')](handleError(_0x47fe92,null));};exports['setTags']=function(_0xfbe26c,_0x266799,_0x4b940e){if(_0xfbe26c[_0x7c56('0x49')]['id']){delete _0xfbe26c[_0x7c56('0x49')]['id'];}return db['FreshdeskConfiguration'][_0x7c56('0x4d')]({'where':{'id':_0xfbe26c[_0x7c56('0x45')]['id']}})[_0x7c56('0x24')](handleEntityNotFound(_0x266799,null))[_0x7c56('0x24')](function(_0x2109cf){if(_0x2109cf){return _0x2109cf['setTags'](_0xfbe26c[_0x7c56('0x49')][_0x7c56('0x53')]||[]);}return null;})[_0x7c56('0x24')](respondWithResult(_0x266799,null))[_0x7c56('0x43')](handleError(_0x266799,null));}; \ No newline at end of file +var _0x60e9=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','filters','pick','where','VIRTUAL','merge','options','findAll','rows','catch','params','includeAll','include','find','create','body','getFields','findOne','FreshdeskField','filter','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0x60e9,0x13d));var _0x960e=function(_0x46293e,_0x55fd36){_0x46293e=_0x46293e-0x0;var _0x6cc314=_0x60e9[_0x46293e];return _0x6cc314;};'use strict';var emlformat=require(_0x960e('0x0'));var rimraf=require(_0x960e('0x1'));var zipdir=require(_0x960e('0x2'));var jsonpatch=require(_0x960e('0x3'));var rp=require(_0x960e('0x4'));var moment=require('moment');var BPromise=require(_0x960e('0x5'));var Mustache=require(_0x960e('0x6'));var util=require(_0x960e('0x7'));var path=require(_0x960e('0x8'));var sox=require(_0x960e('0x9'));var csv=require(_0x960e('0xa'));var ejs=require(_0x960e('0xb'));var fs=require('fs');var fs_extra=require(_0x960e('0xc'));var _=require(_0x960e('0xd'));var squel=require('squel');var crypto=require(_0x960e('0xe'));var jsforce=require(_0x960e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x960e('0xa'));var querystring=require('querystring');var Papa=require(_0x960e('0x10'));var Redis=require('ioredis');var authService=require(_0x960e('0x11'));var qs=require(_0x960e('0x12'));var as=require(_0x960e('0x13'));var hardwareService=require(_0x960e('0x14'));var logger=require(_0x960e('0x15'))(_0x960e('0x16'));var utils=require(_0x960e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x960e('0x18'));var db=require(_0x960e('0x19'))['db'];function respondWithStatusCode(_0x4ccc5f,_0x4f5d52){_0x4f5d52=_0x4f5d52||0xcc;return function(_0x38f3aa){if(_0x38f3aa){return _0x4ccc5f[_0x960e('0x1a')](_0x4f5d52);}return _0x4ccc5f[_0x960e('0x1b')](_0x4f5d52)[_0x960e('0x1c')]();};}function respondWithResult(_0x250ff7,_0x1b8317){_0x1b8317=_0x1b8317||0xc8;return function(_0x99fbee){if(_0x99fbee){return _0x250ff7[_0x960e('0x1b')](_0x1b8317)[_0x960e('0x1d')](_0x99fbee);}};}function respondWithFilteredResult(_0x3058f9,_0x20f32c){return function(_0x5226a8){if(_0x5226a8){var _0x445900=typeof _0x20f32c['offset']===_0x960e('0x1e')&&typeof _0x20f32c[_0x960e('0x1f')]===_0x960e('0x1e');var _0x5f7257=_0x5226a8[_0x960e('0x20')];var _0x4b6605=_0x445900?0x0:_0x20f32c['offset'];var _0x432dd8=_0x445900?_0x5226a8[_0x960e('0x20')]:_0x20f32c[_0x960e('0x21')]+_0x20f32c[_0x960e('0x1f')];var _0x5a6320;if(_0x432dd8>=_0x5f7257){_0x432dd8=_0x5f7257;_0x5a6320=0xc8;}else{_0x5a6320=0xce;}_0x3058f9[_0x960e('0x1b')](_0x5a6320);return _0x3058f9['set'](_0x960e('0x22'),_0x4b6605+'-'+_0x432dd8+'/'+_0x5f7257)['json'](_0x5226a8);}return null;};}function patchUpdates(_0x43f52e){return function(_0x4cc12a){try{jsonpatch[_0x960e('0x23')](_0x4cc12a,_0x43f52e,!![]);}catch(_0x57169d){return BPromise[_0x960e('0x24')](_0x57169d);}return _0x4cc12a[_0x960e('0x25')]();};}function saveUpdates(_0x3cd9a4,_0x5b22c7){return function(_0x225a43){if(_0x225a43){return _0x225a43[_0x960e('0x26')](_0x3cd9a4)[_0x960e('0x27')](function(_0x1ca7c1){return _0x1ca7c1;});}return null;};}function removeEntity(_0x278379,_0x3a2998){return function(_0x398f13){if(_0x398f13){return _0x398f13[_0x960e('0x28')]()[_0x960e('0x27')](function(){_0x278379[_0x960e('0x1b')](0xcc)[_0x960e('0x1c')]();});}};}function handleEntityNotFound(_0x2a8185,_0x965b0a){return function(_0x519c49){if(!_0x519c49){_0x2a8185['sendStatus'](0x194);}return _0x519c49;};}function handleError(_0x2f47b6,_0x4a1ece){_0x4a1ece=_0x4a1ece||0x1f4;return function(_0x36b3e6){logger[_0x960e('0x29')](_0x36b3e6[_0x960e('0x2a')]);if(_0x36b3e6[_0x960e('0x2b')]){delete _0x36b3e6[_0x960e('0x2b')];}_0x2f47b6[_0x960e('0x1b')](_0x4a1ece)['send'](_0x36b3e6);};}exports[_0x960e('0x2c')]=function(_0x359e88,_0x16df28){var _0x648220={},_0x4a676c={},_0x46963c={'count':0x0,'rows':[]};var _0x181a9a=_[_0x960e('0x2d')](db[_0x960e('0x2e')][_0x960e('0x2f')],function(_0x4eafbd){return{'name':_0x4eafbd[_0x960e('0x30')],'type':_0x4eafbd[_0x960e('0x31')][_0x960e('0x32')]};});_0x4a676c['model']=_[_0x960e('0x2d')](_0x181a9a,_0x960e('0x2b'));_0x4a676c[_0x960e('0x33')]=_[_0x960e('0x34')](_0x359e88['query']);_0x4a676c['filters']=_['intersection'](_0x4a676c['model'],_0x4a676c[_0x960e('0x33')]);_0x648220['attributes']=_[_0x960e('0x35')](_0x4a676c[_0x960e('0x36')],qs[_0x960e('0x37')](_0x359e88['query']['fields']));_0x648220['attributes']=_0x648220[_0x960e('0x38')][_0x960e('0x39')]?_0x648220['attributes']:_0x4a676c[_0x960e('0x36')];if(!_0x359e88[_0x960e('0x33')]['hasOwnProperty'](_0x960e('0x3a'))){_0x648220['limit']=qs[_0x960e('0x1f')](_0x359e88[_0x960e('0x33')][_0x960e('0x1f')]);_0x648220[_0x960e('0x21')]=qs[_0x960e('0x21')](_0x359e88[_0x960e('0x33')]['offset']);}_0x648220[_0x960e('0x3b')]=qs[_0x960e('0x3c')](_0x359e88[_0x960e('0x33')][_0x960e('0x3c')]);_0x648220['where']=qs[_0x960e('0x3d')](_[_0x960e('0x3e')](_0x359e88[_0x960e('0x33')],_0x4a676c['filters']),_0x181a9a);if(_0x359e88[_0x960e('0x33')]['filter']){_0x648220[_0x960e('0x3f')]=_['merge'](_0x648220[_0x960e('0x3f')],{'$or':_[_0x960e('0x2d')](_0x181a9a,function(_0x5835e2){if(_0x5835e2[_0x960e('0x31')]!==_0x960e('0x40')){var _0x45d8f9={};_0x45d8f9[_0x5835e2[_0x960e('0x2b')]]={'$like':'%'+_0x359e88[_0x960e('0x33')]['filter']+'%'};return _0x45d8f9;}})});}_0x648220=_[_0x960e('0x41')]({},_0x648220,_0x359e88[_0x960e('0x42')]);var _0x53c014={'where':_0x648220[_0x960e('0x3f')]};return db[_0x960e('0x2e')]['count'](_0x53c014)[_0x960e('0x27')](function(_0x495f6d){_0x46963c[_0x960e('0x20')]=_0x495f6d;if(_0x359e88[_0x960e('0x33')]['includeAll']){_0x648220['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x960e('0x43')](_0x648220);})[_0x960e('0x27')](function(_0x2e5738){_0x46963c[_0x960e('0x44')]=_0x2e5738;return _0x46963c;})['then'](respondWithFilteredResult(_0x16df28,_0x648220))[_0x960e('0x45')](handleError(_0x16df28,null));};exports['show']=function(_0x53196e,_0xda698f){var _0xe464cd={'raw':![],'where':{'id':_0x53196e[_0x960e('0x46')]['id']}},_0x2d919e={};_0x2d919e[_0x960e('0x36')]=_['keys'](db[_0x960e('0x2e')]['rawAttributes']);_0x2d919e['query']=_[_0x960e('0x34')](_0x53196e[_0x960e('0x33')]);_0x2d919e[_0x960e('0x3d')]=_['intersection'](_0x2d919e[_0x960e('0x36')],_0x2d919e[_0x960e('0x33')]);_0xe464cd[_0x960e('0x38')]=_[_0x960e('0x35')](_0x2d919e[_0x960e('0x36')],qs[_0x960e('0x37')](_0x53196e[_0x960e('0x33')]['fields']));_0xe464cd[_0x960e('0x38')]=_0xe464cd['attributes']['length']?_0xe464cd['attributes']:_0x2d919e[_0x960e('0x36')];if(_0x53196e[_0x960e('0x33')][_0x960e('0x47')]){_0xe464cd[_0x960e('0x48')]=[{'all':!![]}];}_0xe464cd=_['merge']({},_0xe464cd,_0x53196e['options']);return db[_0x960e('0x2e')][_0x960e('0x49')](_0xe464cd)['then'](handleEntityNotFound(_0xda698f,null))[_0x960e('0x27')](respondWithResult(_0xda698f,null))[_0x960e('0x45')](handleError(_0xda698f,null));};exports[_0x960e('0x4a')]=function(_0x3359e8,_0x48d562){return db[_0x960e('0x2e')][_0x960e('0x4a')](_0x3359e8['body'],{})[_0x960e('0x27')](respondWithResult(_0x48d562,0xc9))['catch'](handleError(_0x48d562,null));};exports[_0x960e('0x26')]=function(_0x457c48,_0xa9cc16){if(_0x457c48[_0x960e('0x4b')]['id']){delete _0x457c48['body']['id'];}return db['FreshdeskConfiguration'][_0x960e('0x49')]({'where':{'id':_0x457c48[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0xa9cc16,null))['then'](saveUpdates(_0x457c48[_0x960e('0x4b')],null))[_0x960e('0x27')](respondWithResult(_0xa9cc16,null))[_0x960e('0x45')](handleError(_0xa9cc16,null));};exports['destroy']=function(_0x6ec61a,_0x38f53b){return db[_0x960e('0x2e')][_0x960e('0x49')]({'where':{'id':_0x6ec61a['params']['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x38f53b,null))[_0x960e('0x27')](removeEntity(_0x38f53b,null))[_0x960e('0x45')](handleError(_0x38f53b,null));};exports[_0x960e('0x4c')]=function(_0x5538e8,_0x569d6f,_0x2c0e18){var _0x1b7899={};var _0x8cdaf7={};var _0x1406ca;var _0x48db55;return db[_0x960e('0x2e')][_0x960e('0x4d')]({'where':{'id':_0x5538e8[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x569d6f,null))[_0x960e('0x27')](function(_0x34f66a){if(_0x34f66a){_0x1406ca=_0x34f66a;_0x8cdaf7[_0x960e('0x36')]=_[_0x960e('0x34')](db[_0x960e('0x4e')][_0x960e('0x2f')]);_0x8cdaf7['query']=_[_0x960e('0x34')](_0x5538e8[_0x960e('0x33')]);_0x8cdaf7[_0x960e('0x3d')]=_['intersection'](_0x8cdaf7['model'],_0x8cdaf7['query']);_0x1b7899[_0x960e('0x38')]=_[_0x960e('0x35')](_0x8cdaf7['model'],qs[_0x960e('0x37')](_0x5538e8['query'][_0x960e('0x37')]));_0x1b7899[_0x960e('0x38')]=_0x1b7899[_0x960e('0x38')]['length']?_0x1b7899[_0x960e('0x38')]:_0x8cdaf7[_0x960e('0x36')];_0x1b7899[_0x960e('0x3b')]=qs[_0x960e('0x3c')](_0x5538e8[_0x960e('0x33')][_0x960e('0x3c')]);_0x1b7899[_0x960e('0x3f')]=qs[_0x960e('0x3d')](_[_0x960e('0x3e')](_0x5538e8[_0x960e('0x33')],_0x8cdaf7[_0x960e('0x3d')]));if(_0x5538e8[_0x960e('0x33')][_0x960e('0x4f')]){_0x1b7899[_0x960e('0x3f')]=_[_0x960e('0x41')](_0x1b7899[_0x960e('0x3f')],{'$or':_[_0x960e('0x2d')](_0x1b7899['attributes'],function(_0xd5092e){var _0x196947={};_0x196947[_0xd5092e]={'$like':'%'+_0x5538e8[_0x960e('0x33')][_0x960e('0x4f')]+'%'};return _0x196947;})});}_0x1b7899=_['merge']({},_0x1b7899,_0x5538e8['options']);return _0x1406ca[_0x960e('0x4c')](_0x1b7899);}})[_0x960e('0x27')](function(_0x4c19b9){if(_0x4c19b9){_0x48db55=_0x4c19b9[_0x960e('0x39')];if(!_0x5538e8[_0x960e('0x33')][_0x960e('0x50')](_0x960e('0x3a'))){_0x1b7899[_0x960e('0x1f')]=qs[_0x960e('0x1f')](_0x5538e8[_0x960e('0x33')]['limit']);_0x1b7899[_0x960e('0x21')]=qs[_0x960e('0x21')](_0x5538e8[_0x960e('0x33')][_0x960e('0x21')]);}return _0x1406ca[_0x960e('0x4c')](_0x1b7899);}})[_0x960e('0x27')](function(_0x10cf6e){if(_0x10cf6e){return _0x10cf6e?{'count':_0x48db55,'rows':_0x10cf6e}:null;}})[_0x960e('0x27')](respondWithResult(_0x569d6f,null))[_0x960e('0x45')](handleError(_0x569d6f,null));};exports[_0x960e('0x51')]=function(_0x201e87,_0x3a5438,_0x5760c2){var _0x2b2929={};var _0x31bf31={};var _0x8b06ef;var _0x27c84f;return db['FreshdeskConfiguration'][_0x960e('0x4d')]({'where':{'id':_0x201e87[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x3a5438,null))[_0x960e('0x27')](function(_0x2feb35){if(_0x2feb35){_0x8b06ef=_0x2feb35;_0x31bf31[_0x960e('0x36')]=_[_0x960e('0x34')](db[_0x960e('0x4e')][_0x960e('0x2f')]);_0x31bf31['query']=_['keys'](_0x201e87[_0x960e('0x33')]);_0x31bf31['filters']=_[_0x960e('0x35')](_0x31bf31[_0x960e('0x36')],_0x31bf31[_0x960e('0x33')]);_0x2b2929['attributes']=_[_0x960e('0x35')](_0x31bf31[_0x960e('0x36')],qs[_0x960e('0x37')](_0x201e87['query']['fields']));_0x2b2929[_0x960e('0x38')]=_0x2b2929[_0x960e('0x38')][_0x960e('0x39')]?_0x2b2929[_0x960e('0x38')]:_0x31bf31[_0x960e('0x36')];_0x2b2929['order']=qs['sort'](_0x201e87[_0x960e('0x33')][_0x960e('0x3c')]);_0x2b2929['where']=qs[_0x960e('0x3d')](_[_0x960e('0x3e')](_0x201e87[_0x960e('0x33')],_0x31bf31[_0x960e('0x3d')]));if(_0x201e87['query'][_0x960e('0x4f')]){_0x2b2929[_0x960e('0x3f')]=_[_0x960e('0x41')](_0x2b2929['where'],{'$or':_[_0x960e('0x2d')](_0x2b2929[_0x960e('0x38')],function(_0x4f6ca2){var _0x27c0b9={};_0x27c0b9[_0x4f6ca2]={'$like':'%'+_0x201e87[_0x960e('0x33')][_0x960e('0x4f')]+'%'};return _0x27c0b9;})});}_0x2b2929=_[_0x960e('0x41')]({},_0x2b2929,_0x201e87[_0x960e('0x42')]);return _0x8b06ef[_0x960e('0x51')](_0x2b2929);}})['then'](function(_0x37a17d){if(_0x37a17d){_0x27c84f=_0x37a17d['length'];if(!_0x201e87['query'][_0x960e('0x50')](_0x960e('0x3a'))){_0x2b2929[_0x960e('0x1f')]=qs[_0x960e('0x1f')](_0x201e87[_0x960e('0x33')][_0x960e('0x1f')]);_0x2b2929[_0x960e('0x21')]=qs[_0x960e('0x21')](_0x201e87[_0x960e('0x33')]['offset']);}return _0x8b06ef[_0x960e('0x51')](_0x2b2929);}})[_0x960e('0x27')](function(_0x449c53){if(_0x449c53){return _0x449c53?{'count':_0x27c84f,'rows':_0x449c53}:null;}})['then'](respondWithResult(_0x3a5438,null))['catch'](handleError(_0x3a5438,null));};exports['getDescriptions']=function(_0x1fdbe6,_0x213b62,_0x36ebc5){var _0x4fbb61={};var _0x1fead5={};var _0x47d182;var _0x13ff9d;return db[_0x960e('0x2e')][_0x960e('0x4d')]({'where':{'id':_0x1fdbe6[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x213b62,null))[_0x960e('0x27')](function(_0x29e5c9){if(_0x29e5c9){_0x47d182=_0x29e5c9;_0x1fead5[_0x960e('0x36')]=_[_0x960e('0x34')](db[_0x960e('0x4e')][_0x960e('0x2f')]);_0x1fead5[_0x960e('0x33')]=_[_0x960e('0x34')](_0x1fdbe6[_0x960e('0x33')]);_0x1fead5['filters']=_[_0x960e('0x35')](_0x1fead5[_0x960e('0x36')],_0x1fead5[_0x960e('0x33')]);_0x4fbb61[_0x960e('0x38')]=_[_0x960e('0x35')](_0x1fead5[_0x960e('0x36')],qs['fields'](_0x1fdbe6['query']['fields']));_0x4fbb61[_0x960e('0x38')]=_0x4fbb61[_0x960e('0x38')][_0x960e('0x39')]?_0x4fbb61[_0x960e('0x38')]:_0x1fead5[_0x960e('0x36')];_0x4fbb61[_0x960e('0x3b')]=qs['sort'](_0x1fdbe6[_0x960e('0x33')][_0x960e('0x3c')]);_0x4fbb61[_0x960e('0x3f')]=qs[_0x960e('0x3d')](_[_0x960e('0x3e')](_0x1fdbe6[_0x960e('0x33')],_0x1fead5[_0x960e('0x3d')]));if(_0x1fdbe6[_0x960e('0x33')][_0x960e('0x4f')]){_0x4fbb61[_0x960e('0x3f')]=_[_0x960e('0x41')](_0x4fbb61[_0x960e('0x3f')],{'$or':_[_0x960e('0x2d')](_0x4fbb61['attributes'],function(_0x52d9a2){var _0xda1aff={};_0xda1aff[_0x52d9a2]={'$like':'%'+_0x1fdbe6[_0x960e('0x33')][_0x960e('0x4f')]+'%'};return _0xda1aff;})});}_0x4fbb61=_[_0x960e('0x41')]({},_0x4fbb61,_0x1fdbe6[_0x960e('0x42')]);return _0x47d182[_0x960e('0x52')](_0x4fbb61);}})[_0x960e('0x27')](function(_0x1783cc){if(_0x1783cc){_0x13ff9d=_0x1783cc['length'];if(!_0x1fdbe6['query'][_0x960e('0x50')]('nolimit')){_0x4fbb61['limit']=qs['limit'](_0x1fdbe6[_0x960e('0x33')][_0x960e('0x1f')]);_0x4fbb61[_0x960e('0x21')]=qs[_0x960e('0x21')](_0x1fdbe6[_0x960e('0x33')][_0x960e('0x21')]);}return _0x47d182[_0x960e('0x52')](_0x4fbb61);}})[_0x960e('0x27')](function(_0x5733cf){if(_0x5733cf){return _0x5733cf?{'count':_0x13ff9d,'rows':_0x5733cf}:null;}})[_0x960e('0x27')](respondWithResult(_0x213b62,null))[_0x960e('0x45')](handleError(_0x213b62,null));};exports[_0x960e('0x53')]=function(_0x2ec0a2,_0x3873a1,_0x2e0f3b){var _0x42dab2={};var _0x2df797={};var _0x28b5ef;var _0x40a206;return db[_0x960e('0x2e')][_0x960e('0x4d')]({'where':{'id':_0x2ec0a2[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x3873a1,null))[_0x960e('0x27')](function(_0x2abc4d){if(_0x2abc4d){_0x28b5ef=_0x2abc4d;_0x2df797[_0x960e('0x36')]=_[_0x960e('0x34')](db[_0x960e('0x54')][_0x960e('0x2f')]);_0x2df797[_0x960e('0x33')]=_[_0x960e('0x34')](_0x2ec0a2[_0x960e('0x33')]);_0x2df797['filters']=_[_0x960e('0x35')](_0x2df797[_0x960e('0x36')],_0x2df797['query']);_0x42dab2[_0x960e('0x38')]=_[_0x960e('0x35')](_0x2df797['model'],qs['fields'](_0x2ec0a2[_0x960e('0x33')][_0x960e('0x37')]));_0x42dab2[_0x960e('0x38')]=_0x42dab2[_0x960e('0x38')][_0x960e('0x39')]?_0x42dab2[_0x960e('0x38')]:_0x2df797[_0x960e('0x36')];_0x42dab2[_0x960e('0x3b')]=qs[_0x960e('0x3c')](_0x2ec0a2[_0x960e('0x33')][_0x960e('0x3c')]);_0x42dab2[_0x960e('0x3f')]=qs[_0x960e('0x3d')](_['pick'](_0x2ec0a2[_0x960e('0x33')],_0x2df797[_0x960e('0x3d')]));if(_0x2ec0a2[_0x960e('0x33')][_0x960e('0x4f')]){_0x42dab2[_0x960e('0x3f')]=_['merge'](_0x42dab2[_0x960e('0x3f')],{'$or':_['map'](_0x42dab2[_0x960e('0x38')],function(_0x31737b){var _0x189948={};_0x189948[_0x31737b]={'$like':'%'+_0x2ec0a2['query']['filter']+'%'};return _0x189948;})});}_0x42dab2=_[_0x960e('0x41')]({},_0x42dab2,_0x2ec0a2['options']);return _0x28b5ef[_0x960e('0x53')](_0x42dab2);}})[_0x960e('0x27')](function(_0x442f80){if(_0x442f80){_0x40a206=_0x442f80['length'];if(!_0x2ec0a2[_0x960e('0x33')][_0x960e('0x50')](_0x960e('0x3a'))){_0x42dab2[_0x960e('0x1f')]=qs[_0x960e('0x1f')](_0x2ec0a2['query'][_0x960e('0x1f')]);_0x42dab2[_0x960e('0x21')]=qs[_0x960e('0x21')](_0x2ec0a2[_0x960e('0x33')][_0x960e('0x21')]);}return _0x28b5ef[_0x960e('0x53')](_0x42dab2);}})[_0x960e('0x27')](function(_0x1fe991){if(_0x1fe991){return _0x1fe991?{'count':_0x40a206,'rows':_0x1fe991}:null;}})[_0x960e('0x27')](respondWithResult(_0x3873a1,null))['catch'](handleError(_0x3873a1,null));};exports[_0x960e('0x55')]=function(_0x4d357c,_0x28232d,_0xf75f68){if(_0x4d357c['body']['id']){delete _0x4d357c[_0x960e('0x4b')]['id'];}return db[_0x960e('0x2e')][_0x960e('0x4d')]({'where':{'id':_0x4d357c[_0x960e('0x46')]['id']}})[_0x960e('0x27')](handleEntityNotFound(_0x28232d,null))['then'](function(_0x6ce160){if(_0x6ce160){return _0x6ce160[_0x960e('0x55')](_0x4d357c[_0x960e('0x4b')][_0x960e('0x56')]||[]);}return null;})[_0x960e('0x27')](respondWithResult(_0x28232d,null))[_0x960e('0x45')](handleError(_0x28232d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a017564..a06ac90 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 _0x4f51=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','bluebird','request-promise'];(function(_0x48dbf2,_0x39e8c1){var _0x12d880=function(_0x91c972){while(--_0x91c972){_0x48dbf2['push'](_0x48dbf2['shift']());}};_0x12d880(++_0x39e8c1);}(_0x4f51,0x110));var _0x14f5=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x4f51[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require(_0x14f5('0x0'));var logger=require(_0x14f5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x14f5('0x2'));var rp=require(_0x14f5('0x3'));var fs=require('fs');var path=require(_0x14f5('0x4'));var rimraf=require(_0x14f5('0x5'));var config=require(_0x14f5('0x6'));var attributes=require(_0x14f5('0x7'));module[_0x14f5('0x8')]=function(_0x204c15,_0xcac930){return _0x204c15[_0x14f5('0x9')](_0x14f5('0xa'),attributes,{'tableName':_0x14f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28fb=['util','../../config/logger','api','path','rimraf','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations','lodash'];(function(_0x23cb7d,_0x516fcb){var _0x3c8fe1=function(_0x416120){while(--_0x416120){_0x23cb7d['push'](_0x23cb7d['shift']());}};_0x3c8fe1(++_0x516fcb);}(_0x28fb,0xbc));var _0xb28f=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x28fb[_0x5a99db];return _0x3aad62;};'use strict';var _=require(_0xb28f('0x0'));var util=require(_0xb28f('0x1'));var logger=require(_0xb28f('0x2'))(_0xb28f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb28f('0x4'));var rimraf=require(_0xb28f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb28f('0x6'));module[_0xb28f('0x7')]=function(_0x238cbb,_0x470543){return _0x238cbb['define']('FreshdeskConfiguration',attributes,{'tableName':_0xb28f('0x8'),'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 7e47a79..52a1b46 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 _0xa380=['http','request','info','request\x20sent','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x419bb8,_0x409a98){var _0x325c7a=function(_0x1009fe){while(--_0x1009fe){_0x419bb8['push'](_0x419bb8['shift']());}};_0x325c7a(++_0x409a98);}(_0xa380,0x19b));var _0x0a38=function(_0x1b9c19,_0x416e3d){_0x1b9c19=_0x1b9c19-0x0;var _0x4e49a1=_0xa380[_0x1b9c19];return _0x4e49a1;};'use strict';var _=require(_0x0a38('0x0'));var util=require(_0x0a38('0x1'));var moment=require(_0x0a38('0x2'));var BPromise=require(_0x0a38('0x3'));var rs=require(_0x0a38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a38('0x5'));var logger=require('../../config/logger')(_0x0a38('0x6'));var config=require(_0x0a38('0x7'));var jayson=require(_0x0a38('0x8'));var client=jayson['client'][_0x0a38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4441fc,_0x38354d,_0x4ae16e){return new BPromise(function(_0x18097d,_0x53ce7b){return client[_0x0a38('0xa')](_0x4441fc,_0x4ae16e)['then'](function(_0x4d5c9f){logger[_0x0a38('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38354d,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x38354d,_0x0a38('0xc'),JSON[_0x0a38('0xd')](_0x4d5c9f));if(_0x4d5c9f['error']){if(_0x4d5c9f[_0x0a38('0xe')][_0x0a38('0xf')]===0x1f4){logger[_0x0a38('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38354d,_0x4d5c9f[_0x0a38('0xe')][_0x0a38('0x10')]);return _0x53ce7b(_0x4d5c9f[_0x0a38('0xe')][_0x0a38('0x10')]);}logger[_0x0a38('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38354d,_0x4d5c9f[_0x0a38('0xe')][_0x0a38('0x10')]);return _0x18097d(_0x4d5c9f[_0x0a38('0xe')][_0x0a38('0x10')]);}else{logger[_0x0a38('0xb')](_0x0a38('0x11'),_0x38354d,_0x0a38('0xc'));_0x18097d(_0x4d5c9f[_0x0a38('0x12')][_0x0a38('0x10')]);}})[_0x0a38('0x13')](function(_0x360450){logger[_0x0a38('0xe')](_0x0a38('0x11'),_0x38354d,_0x360450);_0x53ce7b(_0x360450);});});} \ No newline at end of file +var _0x30eb=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4aef30,_0x4b9e66){var _0x15fa17=function(_0x18ca5e){while(--_0x18ca5e){_0x4aef30['push'](_0x4aef30['shift']());}};_0x15fa17(++_0x4b9e66);}(_0x30eb,0xfb));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb30e('0x0'));var util=require(_0xb30e('0x1'));var moment=require('moment');var BPromise=require(_0xb30e('0x2'));var rs=require(_0xb30e('0x3'));var fs=require('fs');var Redis=require(_0xb30e('0x4'));var db=require(_0xb30e('0x5'))['db'];var utils=require(_0xb30e('0x6'));var logger=require(_0xb30e('0x7'))(_0xb30e('0x8'));var config=require(_0xb30e('0x9'));var jayson=require(_0xb30e('0xa'));var client=jayson['client'][_0xb30e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f4560,_0x1dedfc,_0x538586){return new BPromise(function(_0x8bb21e,_0x1c38de){return client[_0xb30e('0xc')](_0x3f4560,_0x538586)[_0xb30e('0xd')](function(_0x45393f){logger[_0xb30e('0xe')](_0xb30e('0xf'),_0x1dedfc,'request\x20sent');logger[_0xb30e('0x10')](_0xb30e('0x11'),_0x1dedfc,_0xb30e('0x12'),JSON['stringify'](_0x45393f));if(_0x45393f['error']){if(_0x45393f[_0xb30e('0x13')][_0xb30e('0x14')]===0x1f4){logger[_0xb30e('0x13')](_0xb30e('0xf'),_0x1dedfc,_0x45393f[_0xb30e('0x13')][_0xb30e('0x15')]);return _0x1c38de(_0x45393f['error'][_0xb30e('0x15')]);}logger[_0xb30e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1dedfc,_0x45393f[_0xb30e('0x13')][_0xb30e('0x15')]);return _0x8bb21e(_0x45393f[_0xb30e('0x13')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1dedfc,'request\x20sent');_0x8bb21e(_0x45393f[_0xb30e('0x16')][_0xb30e('0x15')]);}})[_0xb30e('0x17')](function(_0x1b3efd){logger[_0xb30e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1dedfc,_0x1b3efd);_0x1c38de(_0x1b3efd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6e31710..993faa1 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 _0xb0ae=['get','/:id','isAuthenticated','show','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller'];(function(_0x39b4d0,_0x206249){var _0x18531a=function(_0x482f27){while(--_0x482f27){_0x39b4d0['push'](_0x39b4d0['shift']());}};_0x18531a(++_0x206249);}(_0xb0ae,0x107));var _0xeb0a=function(_0x116395,_0x2e4548){_0x116395=_0x116395-0x0;var _0x3f4d20=_0xb0ae[_0x116395];return _0x3f4d20;};'use strict';var multer=require(_0xeb0a('0x0'));var util=require(_0xeb0a('0x1'));var path=require(_0xeb0a('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb0a('0x3'));var router=express[_0xeb0a('0x4')]();var fs_extra=require(_0xeb0a('0x5'));var auth=require(_0xeb0a('0x6'));var interaction=require(_0xeb0a('0x7'));var config=require('../../config/environment');var controller=require(_0xeb0a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xeb0a('0x9')](_0xeb0a('0xa'),auth[_0xeb0a('0xb')](),controller[_0xeb0a('0xc')]);router['post']('/',auth[_0xeb0a('0xb')](),controller['create']);router[_0xeb0a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xeb0a('0xe')]);router[_0xeb0a('0xf')](_0xeb0a('0xa'),auth[_0xeb0a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x16f1=['connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','delete','multer','util'];(function(_0x3c2b8a,_0x208d0e){var _0x3cf821=function(_0x5845f3){while(--_0x5845f3){_0x3c2b8a['push'](_0x3c2b8a['shift']());}};_0x3cf821(++_0x208d0e);}(_0x16f1,0x1be));var _0x116f=function(_0x41c4a6,_0x2f1461){_0x41c4a6=_0x41c4a6-0x0;var _0x4b92da=_0x16f1[_0x41c4a6];return _0x4b92da;};'use strict';var multer=require(_0x116f('0x0'));var util=require(_0x116f('0x1'));var path=require('path');var timeout=require(_0x116f('0x2'));var express=require(_0x116f('0x3'));var router=express[_0x116f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x116f('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x116f('0x6')]('/',auth[_0x116f('0x7')](),controller[_0x116f('0x8')]);router[_0x116f('0x6')](_0x116f('0x9'),auth['isAuthenticated'](),controller[_0x116f('0xa')]);router[_0x116f('0xb')]('/',auth['isAuthenticated'](),controller[_0x116f('0xc')]);router['put'](_0x116f('0x9'),auth[_0x116f('0x7')](),controller['update']);router[_0x116f('0xd')]('/:id',auth[_0x116f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ac15cda..7baf6b4 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 _0x68cc=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x68cc,0x168));var _0xc68c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x68cc[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xc68c('0x0'));module['exports']={'type':{'type':Sequelize[_0xc68c('0x1')](_0xc68c('0x2'),'variable',_0xc68c('0x3'),_0xc68c('0x4'),_0xc68c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc68c('0x6')]},'key':{'type':Sequelize[_0xc68c('0x6')]},'keyType':{'type':Sequelize[_0xc68c('0x1')]('string','variable',_0xc68c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc68c('0x6')]},'nameField':{'type':Sequelize[_0xc68c('0x6')]},'customField':{'type':Sequelize[_0xc68c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc68c('0x6')]}}; \ No newline at end of file +var _0xa04a=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5ef972,_0x466cea){var _0x3094e4=function(_0x31e44d){while(--_0x31e44d){_0x5ef972['push'](_0x5ef972['shift']());}};_0x3094e4(++_0x466cea);}(_0xa04a,0x16b));var _0xaa04=function(_0x1f8292,_0x3eb418){_0x1f8292=_0x1f8292-0x0;var _0x3a9bf2=_0xa04a[_0x1f8292];return _0x3a9bf2;};'use strict';var Sequelize=require(_0xaa04('0x0'));module[_0xaa04('0x1')]={'type':{'type':Sequelize[_0xaa04('0x2')](_0xaa04('0x3'),_0xaa04('0x4'),_0xaa04('0x5'),_0xaa04('0x6'),_0xaa04('0x7')),'defaultValue':_0xaa04('0x3')},'content':{'type':Sequelize[_0xaa04('0x8')]},'key':{'type':Sequelize[_0xaa04('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xaa04('0x3'),_0xaa04('0x4'),_0xaa04('0x5'))},'keyContent':{'type':Sequelize[_0xaa04('0x8')]},'idField':{'type':Sequelize[_0xaa04('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa04('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 67c3d1e..eb36f83 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 _0x1152=['stack','name','index','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','keys','include','merge','create','body','catch','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x252b21,_0x585c6f){var _0xaa2df3=function(_0x708bc4){while(--_0x708bc4){_0x252b21['push'](_0x252b21['shift']());}};_0xaa2df3(++_0x585c6f);}(_0x1152,0x182));var _0x2115=function(_0x1e7382,_0x44937e){_0x1e7382=_0x1e7382-0x0;var _0x16debf=_0x1152[_0x1e7382];return _0x16debf;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){_0x40d19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x201c94,_0x5e9d07){return function(_0x1a2ec3){if(!_0x1a2ec3){_0x201c94['sendStatus'](0x194);}return _0x1a2ec3;};}function handleError(_0x1283ec,_0x115800){_0x115800=_0x115800||0x1f4;return function(_0x1b7f47){logger[_0x2115('0x21')](_0x1b7f47[_0x2115('0x22')]);if(_0x1b7f47['name']){delete _0x1b7f47[_0x2115('0x23')];}_0x1283ec[_0x2115('0x14')](_0x115800)['send'](_0x1b7f47);};}exports[_0x2115('0x24')]=function(_0x33d81c,_0x26eff7){var _0x1262e7={},_0x59ca70={},_0x19c595={'count':0x0,'rows':[]};var _0x15229e=_[_0x2115('0x25')](db[_0x2115('0x26')][_0x2115('0x27')],function(_0x27969d){return{'name':_0x27969d['fieldName'],'type':_0x27969d['type'][_0x2115('0x28')]};});_0x59ca70[_0x2115('0x29')]=_[_0x2115('0x25')](_0x15229e,_0x2115('0x23'));_0x59ca70[_0x2115('0x2a')]=_['keys'](_0x33d81c[_0x2115('0x2a')]);_0x59ca70[_0x2115('0x2b')]=_[_0x2115('0x2c')](_0x59ca70['model'],_0x59ca70[_0x2115('0x2a')]);_0x1262e7['attributes']=_[_0x2115('0x2c')](_0x59ca70['model'],qs[_0x2115('0x2d')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x2d')]));_0x1262e7['attributes']=_0x1262e7['attributes'][_0x2115('0x2e')]?_0x1262e7[_0x2115('0x2f')]:_0x59ca70['model'];if(!_0x33d81c[_0x2115('0x2a')][_0x2115('0x30')](_0x2115('0x31'))){_0x1262e7[_0x2115('0x18')]=qs['limit'](_0x33d81c[_0x2115('0x2a')][_0x2115('0x18')]);_0x1262e7[_0x2115('0x16')]=qs[_0x2115('0x16')](_0x33d81c['query'][_0x2115('0x16')]);}_0x1262e7[_0x2115('0x32')]=qs[_0x2115('0x33')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x33')]);_0x1262e7[_0x2115('0x34')]=qs['filters'](_[_0x2115('0x35')](_0x33d81c[_0x2115('0x2a')],_0x59ca70[_0x2115('0x2b')]),_0x15229e);if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]){_0x1262e7[_0x2115('0x34')]=_['merge'](_0x1262e7[_0x2115('0x34')],{'$or':_['map'](_0x15229e,function(_0x59b531){if(_0x59b531[_0x2115('0x37')]!==_0x2115('0x38')){var _0x4572f3={};_0x4572f3[_0x59b531[_0x2115('0x23')]]={'$like':'%'+_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]+'%'};return _0x4572f3;}})});}_0x1262e7=_['merge']({},_0x1262e7,_0x33d81c[_0x2115('0x39')]);var _0x1c2508={'where':_0x1262e7[_0x2115('0x34')]};return db[_0x2115('0x26')][_0x2115('0x19')](_0x1c2508)[_0x2115('0x1f')](function(_0x1aa165){_0x19c595[_0x2115('0x19')]=_0x1aa165;if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x3a')]){_0x1262e7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2115('0x3b')](_0x1262e7);})['then'](function(_0xa652de){_0x19c595['rows']=_0xa652de;return _0x19c595;})['then'](respondWithFilteredResult(_0x26eff7,_0x1262e7))['catch'](handleError(_0x26eff7,null));};exports[_0x2115('0x3c')]=function(_0x40d5d6,_0x11b840){var _0x96847d={'raw':!![],'where':{'id':_0x40d5d6['params']['id']}},_0x16f022={};_0x16f022[_0x2115('0x29')]=_['keys'](db[_0x2115('0x26')][_0x2115('0x27')]);_0x16f022['query']=_[_0x2115('0x3d')](_0x40d5d6[_0x2115('0x2a')]);_0x16f022['filters']=_['intersection'](_0x16f022[_0x2115('0x29')],_0x16f022[_0x2115('0x2a')]);_0x96847d['attributes']=_['intersection'](_0x16f022[_0x2115('0x29')],qs[_0x2115('0x2d')](_0x40d5d6['query']['fields']));_0x96847d[_0x2115('0x2f')]=_0x96847d[_0x2115('0x2f')][_0x2115('0x2e')]?_0x96847d['attributes']:_0x16f022[_0x2115('0x29')];if(_0x40d5d6['query'][_0x2115('0x3a')]){_0x96847d[_0x2115('0x3e')]=[{'all':!![]}];}_0x96847d=_[_0x2115('0x3f')]({},_0x96847d,_0x40d5d6[_0x2115('0x39')]);return db[_0x2115('0x26')]['find'](_0x96847d)[_0x2115('0x1f')](handleEntityNotFound(_0x11b840,null))['then'](respondWithResult(_0x11b840,null))['catch'](handleError(_0x11b840,null));};exports[_0x2115('0x40')]=function(_0xa67937,_0x583575){return db[_0x2115('0x26')][_0x2115('0x40')](_0xa67937[_0x2115('0x41')],{})[_0x2115('0x1f')](respondWithResult(_0x583575,0xc9))[_0x2115('0x42')](handleError(_0x583575,null));};exports[_0x2115('0x43')]=function(_0x41d1a4,_0x347f16){if(_0x41d1a4[_0x2115('0x41')]['id']){delete _0x41d1a4['body']['id'];}return db[_0x2115('0x26')][_0x2115('0x44')]({'where':{'id':_0x41d1a4[_0x2115('0x45')]['id']}})['then'](handleEntityNotFound(_0x347f16,null))[_0x2115('0x1f')](saveUpdates(_0x41d1a4['body'],null))['then'](respondWithResult(_0x347f16,null))['catch'](handleError(_0x347f16,null));};exports[_0x2115('0x20')]=function(_0x24d601,_0x4820c7){return db['FreshdeskField'][_0x2115('0x44')]({'where':{'id':_0x24d601[_0x2115('0x45')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x4820c7,null))[_0x2115('0x1f')](removeEntity(_0x4820c7,null))[_0x2115('0x42')](handleError(_0x4820c7,null));}; \ No newline at end of file +var _0xc6d8=['params','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','path','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','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','catch','show'];(function(_0x1554fb,_0x532aea){var _0x981df9=function(_0xa872b){while(--_0xa872b){_0x1554fb['push'](_0x1554fb['shift']());}};_0x981df9(++_0x532aea);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x4d7988,_0x4c62e3){_0x4d7988=_0x4d7988-0x0;var _0x97e287=_0xc6d8[_0x4d7988];return _0x97e287;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9c4,_0x490b46){return function(_0x23c893){if(!_0x23c893){_0x15a9c4[_0x8c6d('0x16')](0x194);}return _0x23c893;};}function handleError(_0x353ba5,_0x2b6d18){_0x2b6d18=_0x2b6d18||0x1f4;return function(_0x1e6755){logger[_0x8c6d('0x22')](_0x1e6755[_0x8c6d('0x23')]);if(_0x1e6755[_0x8c6d('0x24')]){delete _0x1e6755[_0x8c6d('0x24')];}_0x353ba5['status'](_0x2b6d18)['send'](_0x1e6755);};}exports[_0x8c6d('0x25')]=function(_0x93a094,_0xfc6000){var _0x42a7db={},_0x370626={},_0x316ca7={'count':0x0,'rows':[]};var _0x2bc94a=_[_0x8c6d('0x26')](db[_0x8c6d('0x27')][_0x8c6d('0x28')],function(_0x3375dd){return{'name':_0x3375dd[_0x8c6d('0x29')],'type':_0x3375dd['type'][_0x8c6d('0x2a')]};});_0x370626[_0x8c6d('0x2b')]=_[_0x8c6d('0x26')](_0x2bc94a,_0x8c6d('0x24'));_0x370626[_0x8c6d('0x2c')]=_[_0x8c6d('0x2d')](_0x93a094[_0x8c6d('0x2c')]);_0x370626[_0x8c6d('0x2e')]=_[_0x8c6d('0x2f')](_0x370626['model'],_0x370626[_0x8c6d('0x2c')]);_0x42a7db['attributes']=_[_0x8c6d('0x2f')](_0x370626[_0x8c6d('0x2b')],qs[_0x8c6d('0x30')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x30')]));_0x42a7db[_0x8c6d('0x31')]=_0x42a7db['attributes']['length']?_0x42a7db[_0x8c6d('0x31')]:_0x370626[_0x8c6d('0x2b')];if(!_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x32')]('nolimit')){_0x42a7db[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x1c')]);_0x42a7db[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x93a094['query'][_0x8c6d('0x19')]);}_0x42a7db[_0x8c6d('0x33')]=qs[_0x8c6d('0x34')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x34')]);_0x42a7db[_0x8c6d('0x35')]=qs[_0x8c6d('0x2e')](_[_0x8c6d('0x36')](_0x93a094[_0x8c6d('0x2c')],_0x370626[_0x8c6d('0x2e')]),_0x2bc94a);if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x37')]){_0x42a7db['where']=_[_0x8c6d('0x38')](_0x42a7db[_0x8c6d('0x35')],{'$or':_[_0x8c6d('0x26')](_0x2bc94a,function(_0x454e96){if(_0x454e96[_0x8c6d('0x39')]!=='VIRTUAL'){var _0x26027f={};_0x26027f[_0x454e96[_0x8c6d('0x24')]]={'$like':'%'+_0x93a094['query'][_0x8c6d('0x37')]+'%'};return _0x26027f;}})});}_0x42a7db=_[_0x8c6d('0x38')]({},_0x42a7db,_0x93a094[_0x8c6d('0x3a')]);var _0x4869dc={'where':_0x42a7db[_0x8c6d('0x35')]};return db[_0x8c6d('0x27')][_0x8c6d('0x1b')](_0x4869dc)[_0x8c6d('0x3b')](function(_0x2f54a2){_0x316ca7[_0x8c6d('0x1b')]=_0x2f54a2;if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x42a7db[_0x8c6d('0x3d')]=[{'all':!![]}];}return db[_0x8c6d('0x27')][_0x8c6d('0x3e')](_0x42a7db);})['then'](function(_0x58af06){_0x316ca7['rows']=_0x58af06;return _0x316ca7;})[_0x8c6d('0x3b')](respondWithFilteredResult(_0xfc6000,_0x42a7db))[_0x8c6d('0x3f')](handleError(_0xfc6000,null));};exports[_0x8c6d('0x40')]=function(_0x3d69c3,_0x3409eb){var _0x546f04={'raw':!![],'where':{'id':_0x3d69c3[_0x8c6d('0x41')]['id']}},_0x274d01={};_0x274d01[_0x8c6d('0x2b')]=_['keys'](db[_0x8c6d('0x27')][_0x8c6d('0x28')]);_0x274d01['query']=_['keys'](_0x3d69c3['query']);_0x274d01['filters']=_['intersection'](_0x274d01[_0x8c6d('0x2b')],_0x274d01[_0x8c6d('0x2c')]);_0x546f04[_0x8c6d('0x31')]=_[_0x8c6d('0x2f')](_0x274d01[_0x8c6d('0x2b')],qs['fields'](_0x3d69c3['query']['fields']));_0x546f04['attributes']=_0x546f04[_0x8c6d('0x31')]['length']?_0x546f04[_0x8c6d('0x31')]:_0x274d01[_0x8c6d('0x2b')];if(_0x3d69c3[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x546f04[_0x8c6d('0x3d')]=[{'all':!![]}];}_0x546f04=_[_0x8c6d('0x38')]({},_0x546f04,_0x3d69c3['options']);return db[_0x8c6d('0x27')][_0x8c6d('0x42')](_0x546f04)['then'](handleEntityNotFound(_0x3409eb,null))[_0x8c6d('0x3b')](respondWithResult(_0x3409eb,null))[_0x8c6d('0x3f')](handleError(_0x3409eb,null));};exports['create']=function(_0x2fd4ea,_0xb6e94){return db[_0x8c6d('0x27')][_0x8c6d('0x43')](_0x2fd4ea[_0x8c6d('0x44')],{})[_0x8c6d('0x3b')](respondWithResult(_0xb6e94,0xc9))[_0x8c6d('0x3f')](handleError(_0xb6e94,null));};exports[_0x8c6d('0x45')]=function(_0x1f1609,_0x1d6c29){if(_0x1f1609[_0x8c6d('0x44')]['id']){delete _0x1f1609[_0x8c6d('0x44')]['id'];}return db[_0x8c6d('0x27')][_0x8c6d('0x42')]({'where':{'id':_0x1f1609[_0x8c6d('0x41')]['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x1d6c29,null))['then'](saveUpdates(_0x1f1609['body'],null))['then'](respondWithResult(_0x1d6c29,null))[_0x8c6d('0x3f')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x21')]=function(_0x4919b8,_0x574b08){return db['FreshdeskField'][_0x8c6d('0x42')]({'where':{'id':_0x4919b8['params']['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x574b08,null))[_0x8c6d('0x3b')](removeEntity(_0x574b08,null))[_0x8c6d('0x3f')](handleError(_0x574b08,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 896ad1b..53c2f49 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 _0xb258=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x111e84,_0x177c63){var _0x1579fb=function(_0x2c2060){while(--_0x2c2060){_0x111e84['push'](_0x111e84['shift']());}};_0x1579fb(++_0x177c63);}(_0xb258,0x12b));var _0x8b25=function(_0x8a5e9e,_0x482a80){_0x8a5e9e=_0x8a5e9e-0x0;var _0x3b56fd=_0xb258[_0x8a5e9e];return _0x3b56fd;};'use strict';var _=require(_0x8b25('0x0'));var util=require('util');var logger=require(_0x8b25('0x1'))(_0x8b25('0x2'));var moment=require('moment');var BPromise=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var fs=require('fs');var path=require(_0x8b25('0x5'));var rimraf=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var attributes=require(_0x8b25('0x8'));module['exports']=function(_0x40d293,_0x3e10a5){return _0x40d293[_0x8b25('0x9')](_0x8b25('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x8b25('0xb'),'fields':[_0x8b25('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14ee=['./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe14e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe14e('0x1'));var moment=require(_0xe14e('0x2'));var BPromise=require(_0xe14e('0x3'));var rp=require(_0xe14e('0x4'));var fs=require('fs');var path=require(_0xe14e('0x5'));var rimraf=require(_0xe14e('0x6'));var config=require(_0xe14e('0x7'));var attributes=require(_0xe14e('0x8'));module['exports']=function(_0x55d396,_0x4c78d1){return _0x55d396[_0xe14e('0x9')](_0xe14e('0xa'),attributes,{'tableName':_0xe14e('0xb'),'paranoid':![],'indexes':[{'name':_0xe14e('0xc'),'fields':[_0xe14e('0xd'),_0xe14e('0xe')],'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 f641443..4f91883 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 _0xe8e0=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x25dea1,_0x57495d){var _0x3d131d=function(_0x50387e){while(--_0x50387e){_0x25dea1['push'](_0x25dea1['shift']());}};_0x3d131d(++_0x57495d);}(_0xe8e0,0xc4));var _0x0e8e=function(_0x1601df,_0x214530){_0x1601df=_0x1601df-0x0;var _0x1d1451=_0xe8e0[_0x1601df];return _0x1d1451;};'use strict';var _=require('lodash');var util=require(_0x0e8e('0x0'));var moment=require('moment');var BPromise=require(_0x0e8e('0x1'));var rs=require(_0x0e8e('0x2'));var fs=require('fs');var Redis=require(_0x0e8e('0x3'));var db=require(_0x0e8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e8e('0x5'))(_0x0e8e('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e8e('0x7'));var client=jayson['client'][_0x0e8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2b79,_0xd55464,_0x510733){return new BPromise(function(_0x441aac,_0x540f0c){return client[_0x0e8e('0x9')](_0x1e2b79,_0x510733)[_0x0e8e('0xa')](function(_0x4de622){logger[_0x0e8e('0xb')](_0x0e8e('0xc'),_0xd55464,_0x0e8e('0xd'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xd55464,_0x0e8e('0xd'),JSON['stringify'](_0x4de622));if(_0x4de622['error']){if(_0x4de622[_0x0e8e('0xe')][_0x0e8e('0xf')]===0x1f4){logger[_0x0e8e('0xe')]('FreshdeskField,\x20%s,\x20%s',_0xd55464,_0x4de622[_0x0e8e('0xe')]['message']);return _0x540f0c(_0x4de622[_0x0e8e('0xe')][_0x0e8e('0x10')]);}logger[_0x0e8e('0xe')](_0x0e8e('0xc'),_0xd55464,_0x4de622[_0x0e8e('0xe')][_0x0e8e('0x10')]);return _0x441aac(_0x4de622['error'][_0x0e8e('0x10')]);}else{logger[_0x0e8e('0xb')](_0x0e8e('0xc'),_0xd55464,_0x0e8e('0xd'));_0x441aac(_0x4de622['result'][_0x0e8e('0x10')]);}})['catch'](function(_0x557459){logger[_0x0e8e('0xe')](_0x0e8e('0xc'),_0xd55464,_0x557459);_0x540f0c(_0x557459);});});} \ No newline at end of file +var _0x135a=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','util','moment','randomstring','ioredis'];(function(_0x21c547,_0x3e205d){var _0x1cc1f2=function(_0x13b55a){while(--_0x13b55a){_0x21c547['push'](_0x21c547['shift']());}};_0x1cc1f2(++_0x3e205d);}(_0x135a,0x119));var _0xa135=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x135a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xa135('0x0'));var moment=require(_0xa135('0x1'));var BPromise=require('bluebird');var rs=require(_0xa135('0x2'));var fs=require('fs');var Redis=require(_0xa135('0x3'));var db=require(_0xa135('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa135('0x5'))(_0xa135('0x6'));var config=require(_0xa135('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa135('0x8')][_0xa135('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a28f9,_0x25701a,_0x12082f){return new BPromise(function(_0x28079d,_0x40860c){return client[_0xa135('0xa')](_0x5a28f9,_0x12082f)['then'](function(_0x13e245){logger[_0xa135('0xb')](_0xa135('0xc'),_0x25701a,'request\x20sent');logger['debug'](_0xa135('0xd'),_0x25701a,_0xa135('0xe'),JSON[_0xa135('0xf')](_0x13e245));if(_0x13e245['error']){if(_0x13e245['error'][_0xa135('0x10')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x25701a,_0x13e245[_0xa135('0x11')][_0xa135('0x12')]);return _0x40860c(_0x13e245[_0xa135('0x11')][_0xa135('0x12')]);}logger[_0xa135('0x11')](_0xa135('0xc'),_0x25701a,_0x13e245[_0xa135('0x11')][_0xa135('0x12')]);return _0x28079d(_0x13e245['error']['message']);}else{logger['info'](_0xa135('0xc'),_0x25701a,_0xa135('0xe'));_0x28079d(_0x13e245['result'][_0xa135('0x12')]);}})['catch'](function(_0x7906bd){logger[_0xa135('0x11')](_0xa135('0xc'),_0x25701a,_0x7906bd);_0x40860c(_0x7906bd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ff1a4dd..0d09a0b 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 _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x4c5ffa,_0x3ae5a1){var _0x5e14f1=function(_0x18818d){while(--_0x18818d){_0x4c5ffa['push'](_0x4c5ffa['shift']());}};_0x5e14f1(++_0x3ae5a1);}(_0x44a3,0x1a9));var _0x344a=function(_0x505a7d,_0x25e11f){_0x505a7d=_0x505a7d-0x0;var _0x17d880=_0x44a3[_0x505a7d];return _0x17d880;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x58a4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer'];(function(_0x1fd652,_0x7c2bf8){var _0x38af47=function(_0x517744){while(--_0x517744){_0x1fd652['push'](_0x1fd652['shift']());}};_0x38af47(++_0x7c2bf8);}(_0x58a4,0xbf));var _0x458a=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x58a4[_0x1c3c59];return _0x1100b7;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var fs_extra=require(_0x458a('0x6'));var auth=require(_0x458a('0x7'));var interaction=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var controller=require(_0x458a('0xa'));router[_0x458a('0xb')]('/',auth[_0x458a('0xc')](),controller['index']);router['get'](_0x458a('0xd'),auth[_0x458a('0xc')](),controller[_0x458a('0xe')]);router[_0x458a('0xb')](_0x458a('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x458a('0xb')](_0x458a('0x10'),auth[_0x458a('0xc')](),controller[_0x458a('0x11')]);router[_0x458a('0x12')]('/',auth['isAuthenticated'](),controller[_0x458a('0x13')]);router[_0x458a('0x12')]('/:id/configurations',auth[_0x458a('0xc')](),controller[_0x458a('0x14')]);router[_0x458a('0x15')](_0x458a('0xd'),auth[_0x458a('0xc')](),controller['update']);router['delete'](_0x458a('0xd'),auth['isAuthenticated'](),controller[_0x458a('0x16')]);module[_0x458a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9469782..10ef2ec 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 _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4f134a,_0x8e90c){var _0x3c3ead=function(_0x57cdff){while(--_0x57cdff){_0x4f134a['push'](_0x4f134a['shift']());}};_0x3c3ead(++_0x8e90c);}(_0x25e7,0x1d6));var _0x725e=function(_0x347862,_0x339566){_0x347862=_0x347862-0x0;var _0x2ec88b=_0x25e7[_0x347862];return _0x2ec88b;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5fdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x119e4a,_0x1c87aa){var _0xe18cb0=function(_0x4685f9){while(--_0x4685f9){_0x119e4a['push'](_0x119e4a['shift']());}};_0xe18cb0(++_0x1c87aa);}(_0x5fdc,0x127));var _0xc5fd=function(_0x2555cb,_0x5c9bf4){_0x2555cb=_0x2555cb-0x0;var _0xe0a4a7=_0x5fdc[_0x2555cb];return _0xe0a4a7;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'apiKey':{'type':Sequelize[_0xc5fd('0x2')]},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x4')},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fedabdf..e6ac9f6 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 _0x4982=['where','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','length','order','sort','AccountId','Descriptions','getDescriptions','channel','FreshsalesField','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','merge'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0x4982,0xe8));var _0x2498=function(_0x51bd64,_0x1c8850){_0x51bd64=_0x51bd64-0x0;var _0x2c7ee4=_0x4982[_0x51bd64];return _0x2c7ee4;};'use strict';var emlformat=require(_0x2498('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2498('0x1'));var jsonpatch=require(_0x2498('0x2'));var rp=require(_0x2498('0x3'));var moment=require(_0x2498('0x4'));var BPromise=require(_0x2498('0x5'));var Mustache=require('mustache');var util=require(_0x2498('0x6'));var path=require(_0x2498('0x7'));var sox=require(_0x2498('0x8'));var csv=require('to-csv');var ejs=require(_0x2498('0x9'));var fs=require('fs');var fs_extra=require(_0x2498('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2498('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2498('0xc'));var querystring=require(_0x2498('0xd'));var Papa=require(_0x2498('0xe'));var Redis=require(_0x2498('0xf'));var authService=require(_0x2498('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2498('0x11'));var logger=require(_0x2498('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2498('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2498('0x14'))['db'];var integrations=require(_0x2498('0x15'));function respondWithStatusCode(_0x12158e,_0x5f13ca){_0x5f13ca=_0x5f13ca||0xcc;return function(_0x277574){if(_0x277574){return _0x12158e[_0x2498('0x16')](_0x5f13ca);}return _0x12158e[_0x2498('0x17')](_0x5f13ca)['end']();};}function respondWithResult(_0x5e1b4d,_0x467701){_0x467701=_0x467701||0xc8;return function(_0x4d1092){if(_0x4d1092){return _0x5e1b4d[_0x2498('0x17')](_0x467701)[_0x2498('0x18')](_0x4d1092);}};}function respondWithFilteredResult(_0x5f039d,_0x1bd46f){return function(_0x2958d1){if(_0x2958d1){var _0x2f2081=typeof _0x1bd46f[_0x2498('0x19')]===_0x2498('0x1a')&&typeof _0x1bd46f[_0x2498('0x1b')]===_0x2498('0x1a');var _0x4109a9=_0x2958d1['count'];var _0x67cb64=_0x2f2081?0x0:_0x1bd46f[_0x2498('0x19')];var _0x361b83=_0x2f2081?_0x2958d1[_0x2498('0x1c')]:_0x1bd46f[_0x2498('0x19')]+_0x1bd46f[_0x2498('0x1b')];var _0x1e9f81;if(_0x361b83>=_0x4109a9){_0x361b83=_0x4109a9;_0x1e9f81=0xc8;}else{_0x1e9f81=0xce;}_0x5f039d[_0x2498('0x17')](_0x1e9f81);return _0x5f039d['set']('Content-Range',_0x67cb64+'-'+_0x361b83+'/'+_0x4109a9)[_0x2498('0x18')](_0x2958d1);}return null;};}function patchUpdates(_0x12e193){return function(_0x40de61){try{jsonpatch[_0x2498('0x1d')](_0x40de61,_0x12e193,!![]);}catch(_0x21e160){return BPromise[_0x2498('0x1e')](_0x21e160);}return _0x40de61[_0x2498('0x1f')]();};}function saveUpdates(_0x38e5bc,_0x29b4b4){return function(_0x52d3f7){if(_0x52d3f7){return _0x52d3f7[_0x2498('0x20')](_0x38e5bc)['then'](function(_0x38ed79){return _0x38ed79;});}return null;};}function removeEntity(_0x46593f,_0x6d51d1){return function(_0x1e24f0){if(_0x1e24f0){return _0x1e24f0[_0x2498('0x21')]()[_0x2498('0x22')](function(){_0x46593f['status'](0xcc)[_0x2498('0x23')]();});}};}function handleEntityNotFound(_0xc73cb6,_0x5ad2cf){return function(_0x2c0fc5){if(!_0x2c0fc5){_0xc73cb6['sendStatus'](0x194);}return _0x2c0fc5;};}function handleError(_0x5f1c5c,_0x186983){_0x186983=_0x186983||0x1f4;return function(_0x408d6e){logger['error'](_0x408d6e['stack']);if(_0x408d6e['name']){delete _0x408d6e[_0x2498('0x24')];}_0x5f1c5c[_0x2498('0x17')](_0x186983)['send'](_0x408d6e);};}exports[_0x2498('0x25')]=function(_0x5147ed,_0x2ae31f){var _0x4b6dda={},_0xc1178e={},_0x459335={'count':0x0,'rows':[]};var _0x18d2a3=_[_0x2498('0x26')](db[_0x2498('0x27')][_0x2498('0x28')],function(_0x575006){return{'name':_0x575006[_0x2498('0x29')],'type':_0x575006[_0x2498('0x2a')][_0x2498('0x2b')]};});_0xc1178e[_0x2498('0x2c')]=_[_0x2498('0x26')](_0x18d2a3,_0x2498('0x24'));_0xc1178e[_0x2498('0x2d')]=_[_0x2498('0x2e')](_0x5147ed[_0x2498('0x2d')]);_0xc1178e['filters']=_[_0x2498('0x2f')](_0xc1178e[_0x2498('0x2c')],_0xc1178e[_0x2498('0x2d')]);_0x4b6dda[_0x2498('0x30')]=_[_0x2498('0x2f')](_0xc1178e['model'],qs[_0x2498('0x31')](_0x5147ed[_0x2498('0x2d')][_0x2498('0x31')]));_0x4b6dda[_0x2498('0x30')]=_0x4b6dda[_0x2498('0x30')]['length']?_0x4b6dda['attributes']:_0xc1178e[_0x2498('0x2c')];if(!_0x5147ed[_0x2498('0x2d')][_0x2498('0x32')](_0x2498('0x33'))){_0x4b6dda[_0x2498('0x1b')]=qs[_0x2498('0x1b')](_0x5147ed[_0x2498('0x2d')]['limit']);_0x4b6dda['offset']=qs['offset'](_0x5147ed[_0x2498('0x2d')][_0x2498('0x19')]);}_0x4b6dda['order']=qs['sort'](_0x5147ed['query']['sort']);_0x4b6dda['where']=qs[_0x2498('0x34')](_[_0x2498('0x35')](_0x5147ed[_0x2498('0x2d')],_0xc1178e['filters']),_0x18d2a3);if(_0x5147ed[_0x2498('0x2d')][_0x2498('0x36')]){_0x4b6dda['where']=_[_0x2498('0x37')](_0x4b6dda[_0x2498('0x38')],{'$or':_[_0x2498('0x26')](_0x18d2a3,function(_0x5d3c2b){if(_0x5d3c2b[_0x2498('0x2a')]!=='VIRTUAL'){var _0x50b128={};_0x50b128[_0x5d3c2b[_0x2498('0x24')]]={'$like':'%'+_0x5147ed['query']['filter']+'%'};return _0x50b128;}})});}_0x4b6dda=_[_0x2498('0x37')]({},_0x4b6dda,_0x5147ed['options']);var _0x13db16={'where':_0x4b6dda[_0x2498('0x38')]};return db[_0x2498('0x27')][_0x2498('0x1c')](_0x13db16)[_0x2498('0x22')](function(_0x493afc){_0x459335[_0x2498('0x1c')]=_0x493afc;if(_0x5147ed['query'][_0x2498('0x39')]){_0x4b6dda[_0x2498('0x3a')]=[{'all':!![]}];}return db[_0x2498('0x27')][_0x2498('0x3b')](_0x4b6dda);})[_0x2498('0x22')](function(_0x2c0eb3){_0x459335[_0x2498('0x3c')]=_0x2c0eb3;return _0x459335;})[_0x2498('0x22')](respondWithFilteredResult(_0x2ae31f,_0x4b6dda))[_0x2498('0x3d')](handleError(_0x2ae31f,null));};exports[_0x2498('0x3e')]=function(_0xbd175e,_0x5ec8a7){var _0x3d246f={'raw':![],'where':{'id':_0xbd175e['params']['id']}},_0x25bf35={};_0x25bf35[_0x2498('0x2c')]=_[_0x2498('0x2e')](db['FreshsalesAccount']['rawAttributes']);_0x25bf35[_0x2498('0x2d')]=_[_0x2498('0x2e')](_0xbd175e['query']);_0x25bf35[_0x2498('0x34')]=_[_0x2498('0x2f')](_0x25bf35[_0x2498('0x2c')],_0x25bf35[_0x2498('0x2d')]);_0x3d246f[_0x2498('0x30')]=_['intersection'](_0x25bf35[_0x2498('0x2c')],qs[_0x2498('0x31')](_0xbd175e[_0x2498('0x2d')][_0x2498('0x31')]));_0x3d246f[_0x2498('0x30')]=_0x3d246f[_0x2498('0x30')]['length']?_0x3d246f['attributes']:_0x25bf35[_0x2498('0x2c')];if(_0xbd175e[_0x2498('0x2d')][_0x2498('0x39')]){_0x3d246f['include']=[{'all':!![]}];}_0x3d246f=_['merge']({},_0x3d246f,_0xbd175e[_0x2498('0x3f')]);return db[_0x2498('0x27')][_0x2498('0x40')](_0x3d246f)['then'](handleEntityNotFound(_0x5ec8a7,null))[_0x2498('0x22')](respondWithResult(_0x5ec8a7,null))[_0x2498('0x3d')](handleError(_0x5ec8a7,null));};exports[_0x2498('0x41')]=function(_0x220969,_0x42856d){return db[_0x2498('0x27')][_0x2498('0x41')](_0x220969[_0x2498('0x42')],{})[_0x2498('0x22')](respondWithResult(_0x42856d,0xc9))[_0x2498('0x3d')](handleError(_0x42856d,null));};exports['update']=function(_0x24477d,_0x2e62d6){if(_0x24477d[_0x2498('0x42')]['id']){delete _0x24477d[_0x2498('0x42')]['id'];}return db['FreshsalesAccount'][_0x2498('0x40')]({'where':{'id':_0x24477d[_0x2498('0x43')]['id']}})[_0x2498('0x22')](handleEntityNotFound(_0x2e62d6,null))[_0x2498('0x22')](saveUpdates(_0x24477d['body'],null))[_0x2498('0x22')](respondWithResult(_0x2e62d6,null))[_0x2498('0x3d')](handleError(_0x2e62d6,null));};exports[_0x2498('0x21')]=function(_0x457413,_0x291522){return db[_0x2498('0x27')][_0x2498('0x40')]({'where':{'id':_0x457413[_0x2498('0x43')]['id']}})['then'](handleEntityNotFound(_0x291522,null))[_0x2498('0x22')](removeEntity(_0x291522,null))[_0x2498('0x3d')](handleError(_0x291522,null));};exports[_0x2498('0x44')]=function(_0x1bba3e,_0x4d8a40,_0x19252f){var _0x1e3be0={};var _0x580cf7={};var _0x3d33f8;var _0xcb2918;return db['FreshsalesAccount'][_0x2498('0x45')]({'where':{'id':_0x1bba3e[_0x2498('0x43')]['id']}})[_0x2498('0x22')](handleEntityNotFound(_0x4d8a40,null))[_0x2498('0x22')](function(_0x4a5ef0){if(_0x4a5ef0){_0x3d33f8=_0x4a5ef0;_0x580cf7['model']=_[_0x2498('0x2e')](db[_0x2498('0x46')][_0x2498('0x28')]);_0x580cf7['query']=_['keys'](_0x1bba3e[_0x2498('0x2d')]);_0x580cf7[_0x2498('0x34')]=_[_0x2498('0x2f')](_0x580cf7[_0x2498('0x2c')],_0x580cf7[_0x2498('0x2d')]);_0x1e3be0[_0x2498('0x30')]=_[_0x2498('0x2f')](_0x580cf7[_0x2498('0x2c')],qs[_0x2498('0x31')](_0x1bba3e[_0x2498('0x2d')][_0x2498('0x31')]));_0x1e3be0[_0x2498('0x30')]=_0x1e3be0[_0x2498('0x30')][_0x2498('0x47')]?_0x1e3be0['attributes']:_0x580cf7['model'];_0x1e3be0[_0x2498('0x48')]=qs[_0x2498('0x49')](_0x1bba3e['query'][_0x2498('0x49')]);_0x1e3be0[_0x2498('0x38')]=qs['filters'](_[_0x2498('0x35')](_0x1bba3e[_0x2498('0x2d')],_0x580cf7[_0x2498('0x34')]));if(_0x1bba3e[_0x2498('0x2d')][_0x2498('0x36')]){_0x1e3be0[_0x2498('0x38')]=_[_0x2498('0x37')](_0x1e3be0['where'],{'$or':_['map'](_0x1e3be0[_0x2498('0x30')],function(_0x36b8fe){var _0x4521af={};_0x4521af[_0x36b8fe]={'$like':'%'+_0x1bba3e[_0x2498('0x2d')][_0x2498('0x36')]+'%'};return _0x4521af;})});}_0x1e3be0=_[_0x2498('0x37')]({},_0x1e3be0,_0x1bba3e['options']);return _0x3d33f8[_0x2498('0x44')](_0x1e3be0);}})['then'](function(_0xad2053){if(_0xad2053){_0xcb2918=_0xad2053[_0x2498('0x47')];if(!_0x1bba3e[_0x2498('0x2d')]['hasOwnProperty'](_0x2498('0x33'))){_0x1e3be0['limit']=qs[_0x2498('0x1b')](_0x1bba3e[_0x2498('0x2d')][_0x2498('0x1b')]);_0x1e3be0[_0x2498('0x19')]=qs[_0x2498('0x19')](_0x1bba3e[_0x2498('0x2d')][_0x2498('0x19')]);}return _0x3d33f8[_0x2498('0x44')](_0x1e3be0);}})[_0x2498('0x22')](function(_0x2617ab){if(_0x2617ab){return _0x2617ab?{'count':_0xcb2918,'rows':_0x2617ab}:null;}})[_0x2498('0x22')](respondWithResult(_0x4d8a40,null))[_0x2498('0x3d')](handleError(_0x4d8a40,null));};exports['addConfiguration']=function(_0x4cef8a,_0x120ecf,_0x4abcb2){if(_0x4cef8a[_0x2498('0x42')]['id']){delete _0x4cef8a[_0x2498('0x42')]['id'];}return db[_0x2498('0x27')]['findOne']({'where':{'id':_0x4cef8a[_0x2498('0x43')]['id']}})[_0x2498('0x22')](handleEntityNotFound(_0x120ecf,null))[_0x2498('0x22')](function(_0x500e29){if(_0x500e29){_0x4cef8a[_0x2498('0x42')][_0x2498('0x4a')]=_0x500e29['id'];_0x4cef8a[_0x2498('0x42')]['Subjects']=integrations['getSubjects'](_0x4cef8a[_0x2498('0x42')]['channel'],_0x4cef8a['body']['type']);_0x4cef8a['body'][_0x2498('0x4b')]=integrations[_0x2498('0x4c')](_0x4cef8a[_0x2498('0x42')][_0x2498('0x4d')],_0x4cef8a[_0x2498('0x42')][_0x2498('0x2a')]);return db['FreshsalesConfiguration'][_0x2498('0x41')](_0x4cef8a[_0x2498('0x42')],{'include':[{'model':db[_0x2498('0x4e')],'as':'Subjects'},{'model':db[_0x2498('0x4e')],'as':_0x2498('0x4b')}]});}return null;})[_0x2498('0x22')](respondWithResult(_0x120ecf,null))['catch'](handleError(_0x120ecf,null));};exports[_0x2498('0x4f')]=function(_0x115ece,_0x1c4d7e,_0x5ca766){var _0x3f0afb='';var _0x535963='';return db[_0x2498('0x27')][_0x2498('0x45')]({'where':{'id':_0x115ece['params']['id']},'attributes':['id','username','remoteUri',_0x2498('0x50')]})['then'](handleEntityNotFound(_0x1c4d7e,null))[_0x2498('0x22')](function(_0x25f328){if(_0x25f328){_0x535963=_0x25f328['username'];_0x3f0afb=_0x25f328['remoteUri'];var _0x22aacc=_0x25f328[_0x2498('0x51')]['slice'](-0x1);if(_0x22aacc==='/'){_0x3f0afb=_0x3f0afb[_0x2498('0x52')](0x0,_0x3f0afb[_0x2498('0x53')](_0x22aacc));}return rp({'method':_0x2498('0x54'),'uri':util[_0x2498('0x55')]('%s%s',_0x3f0afb,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x25f328[_0x2498('0x50')]},'json':!![]});}})[_0x2498('0x22')](function(_0x18dbbf){if(_0x18dbbf){var _0x480082=_0x18dbbf[_0x2498('0x56')];var _0x51cdd5=![];var _0x5a2b3d=null;for(_0x5a2b3d=0x0;_0x5a2b3d<_0x480082['length'];_0x5a2b3d++){if(_0x480082[_0x5a2b3d][_0x2498('0x57')]===_0x535963){_0x51cdd5=!![];}}if(_0x51cdd5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2498('0x58')});}}})['then'](respondWithResult(_0x1c4d7e,null))[_0x2498('0x3d')](function(_0x10b9b8){var _0x32864e=_0x115ece['query'][_0x2498('0x59')]?0x1f4:_0x10b9b8[_0x2498('0x5a')]||0x1f4;logger[_0x2498('0x5b')](_0x2498('0x5c'),_0x2498('0x4f'),_0x32864e,JSON[_0x2498('0x5d')](_0x10b9b8));delete _0x10b9b8['name'];if(_0x32864e===0x191){_0x32864e=0x190;}_0x1c4d7e[_0x2498('0x17')](_0x32864e)[_0x2498('0x5e')](_0x115ece[_0x2498('0x2d')][_0x2498('0x59')]?{'message':_0x2498('0x5f'),'statusCode':_0x10b9b8[_0x2498('0x5a')]}:_0x10b9b8);});}; \ No newline at end of file +var _0xf9c7=['remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','end','undefined','limit','count','offset','status','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','rawAttributes','fields','length','includeAll','find','catch','create','body','update','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesField','Descriptions','getFields','username'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xf9c7,0x74));var _0x7f9c=function(_0x1f51c2,_0xf8c3da){_0x1f51c2=_0x1f51c2-0x0;var _0x474c24=_0xf9c7[_0x1f51c2];return _0x474c24;};'use strict';var emlformat=require(_0x7f9c('0x0'));var rimraf=require(_0x7f9c('0x1'));var zipdir=require(_0x7f9c('0x2'));var jsonpatch=require(_0x7f9c('0x3'));var rp=require(_0x7f9c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f9c('0x5'));var util=require('util');var path=require(_0x7f9c('0x6'));var sox=require(_0x7f9c('0x7'));var csv=require(_0x7f9c('0x8'));var ejs=require(_0x7f9c('0x9'));var fs=require('fs');var fs_extra=require(_0x7f9c('0xa'));var _=require(_0x7f9c('0xb'));var squel=require(_0x7f9c('0xc'));var crypto=require(_0x7f9c('0xd'));var jsforce=require(_0x7f9c('0xe'));var deskjs=require(_0x7f9c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f9c('0x10'));var Redis=require(_0x7f9c('0x11'));var authService=require(_0x7f9c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f9c('0x13'));var hardwareService=require(_0x7f9c('0x14'));var logger=require(_0x7f9c('0x15'))(_0x7f9c('0x16'));var utils=require(_0x7f9c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x7f9c('0x18'));function respondWithStatusCode(_0x1880f0,_0xbd70d5){_0xbd70d5=_0xbd70d5||0xcc;return function(_0x2d834d){if(_0x2d834d){return _0x1880f0['sendStatus'](_0xbd70d5);}return _0x1880f0['status'](_0xbd70d5)[_0x7f9c('0x19')]();};}function respondWithResult(_0x44b961,_0x1bc173){_0x1bc173=_0x1bc173||0xc8;return function(_0x4dec7f){if(_0x4dec7f){return _0x44b961['status'](_0x1bc173)['json'](_0x4dec7f);}};}function respondWithFilteredResult(_0x472840,_0x4a70e6){return function(_0x18558f){if(_0x18558f){var _0x42e4bb=typeof _0x4a70e6['offset']===_0x7f9c('0x1a')&&typeof _0x4a70e6[_0x7f9c('0x1b')]===_0x7f9c('0x1a');var _0xd19fd4=_0x18558f[_0x7f9c('0x1c')];var _0x28219d=_0x42e4bb?0x0:_0x4a70e6[_0x7f9c('0x1d')];var _0x411f25=_0x42e4bb?_0x18558f[_0x7f9c('0x1c')]:_0x4a70e6[_0x7f9c('0x1d')]+_0x4a70e6[_0x7f9c('0x1b')];var _0x3c2ed3;if(_0x411f25>=_0xd19fd4){_0x411f25=_0xd19fd4;_0x3c2ed3=0xc8;}else{_0x3c2ed3=0xce;}_0x472840[_0x7f9c('0x1e')](_0x3c2ed3);return _0x472840['set'](_0x7f9c('0x1f'),_0x28219d+'-'+_0x411f25+'/'+_0xd19fd4)[_0x7f9c('0x20')](_0x18558f);}return null;};}function patchUpdates(_0x57427e){return function(_0xe92407){try{jsonpatch[_0x7f9c('0x21')](_0xe92407,_0x57427e,!![]);}catch(_0x1319c6){return BPromise[_0x7f9c('0x22')](_0x1319c6);}return _0xe92407[_0x7f9c('0x23')]();};}function saveUpdates(_0x220c7a,_0x7d2708){return function(_0x582772){if(_0x582772){return _0x582772['update'](_0x220c7a)[_0x7f9c('0x24')](function(_0x24a3d){return _0x24a3d;});}return null;};}function removeEntity(_0x144e78,_0x1004c4){return function(_0x512acd){if(_0x512acd){return _0x512acd['destroy']()[_0x7f9c('0x24')](function(){_0x144e78[_0x7f9c('0x1e')](0xcc)[_0x7f9c('0x19')]();});}};}function handleEntityNotFound(_0x2d665b,_0x27e58d){return function(_0x31aba4){if(!_0x31aba4){_0x2d665b['sendStatus'](0x194);}return _0x31aba4;};}function handleError(_0x302b68,_0x59acc0){_0x59acc0=_0x59acc0||0x1f4;return function(_0x50d4c3){logger[_0x7f9c('0x25')](_0x50d4c3[_0x7f9c('0x26')]);if(_0x50d4c3[_0x7f9c('0x27')]){delete _0x50d4c3['name'];}_0x302b68[_0x7f9c('0x1e')](_0x59acc0)[_0x7f9c('0x28')](_0x50d4c3);};}exports[_0x7f9c('0x29')]=function(_0x3a0a77,_0x3af6c4){var _0x4e002c={},_0x2be8db={},_0x57d01c={'count':0x0,'rows':[]};var _0x504ba6=_[_0x7f9c('0x2a')](db[_0x7f9c('0x2b')]['rawAttributes'],function(_0x4a6526){return{'name':_0x4a6526[_0x7f9c('0x2c')],'type':_0x4a6526[_0x7f9c('0x2d')][_0x7f9c('0x2e')]};});_0x2be8db['model']=_['map'](_0x504ba6,_0x7f9c('0x27'));_0x2be8db[_0x7f9c('0x2f')]=_[_0x7f9c('0x30')](_0x3a0a77[_0x7f9c('0x2f')]);_0x2be8db[_0x7f9c('0x31')]=_[_0x7f9c('0x32')](_0x2be8db[_0x7f9c('0x33')],_0x2be8db[_0x7f9c('0x2f')]);_0x4e002c[_0x7f9c('0x34')]=_[_0x7f9c('0x32')](_0x2be8db[_0x7f9c('0x33')],qs['fields'](_0x3a0a77['query']['fields']));_0x4e002c[_0x7f9c('0x34')]=_0x4e002c[_0x7f9c('0x34')]['length']?_0x4e002c[_0x7f9c('0x34')]:_0x2be8db['model'];if(!_0x3a0a77[_0x7f9c('0x2f')][_0x7f9c('0x35')](_0x7f9c('0x36'))){_0x4e002c['limit']=qs[_0x7f9c('0x1b')](_0x3a0a77[_0x7f9c('0x2f')][_0x7f9c('0x1b')]);_0x4e002c[_0x7f9c('0x1d')]=qs['offset'](_0x3a0a77[_0x7f9c('0x2f')][_0x7f9c('0x1d')]);}_0x4e002c[_0x7f9c('0x37')]=qs[_0x7f9c('0x38')](_0x3a0a77['query'][_0x7f9c('0x38')]);_0x4e002c[_0x7f9c('0x39')]=qs['filters'](_[_0x7f9c('0x3a')](_0x3a0a77[_0x7f9c('0x2f')],_0x2be8db[_0x7f9c('0x31')]),_0x504ba6);if(_0x3a0a77[_0x7f9c('0x2f')][_0x7f9c('0x3b')]){_0x4e002c[_0x7f9c('0x39')]=_[_0x7f9c('0x3c')](_0x4e002c['where'],{'$or':_[_0x7f9c('0x2a')](_0x504ba6,function(_0x6321f5){if(_0x6321f5['type']!=='VIRTUAL'){var _0x256d97={};_0x256d97[_0x6321f5['name']]={'$like':'%'+_0x3a0a77['query']['filter']+'%'};return _0x256d97;}})});}_0x4e002c=_[_0x7f9c('0x3c')]({},_0x4e002c,_0x3a0a77[_0x7f9c('0x3d')]);var _0x322c12={'where':_0x4e002c[_0x7f9c('0x39')]};return db['FreshsalesAccount'][_0x7f9c('0x1c')](_0x322c12)[_0x7f9c('0x24')](function(_0x25a698){_0x57d01c['count']=_0x25a698;if(_0x3a0a77['query']['includeAll']){_0x4e002c[_0x7f9c('0x3e')]=[{'all':!![]}];}return db[_0x7f9c('0x2b')][_0x7f9c('0x3f')](_0x4e002c);})[_0x7f9c('0x24')](function(_0x3fa766){_0x57d01c['rows']=_0x3fa766;return _0x57d01c;})[_0x7f9c('0x24')](respondWithFilteredResult(_0x3af6c4,_0x4e002c))['catch'](handleError(_0x3af6c4,null));};exports[_0x7f9c('0x40')]=function(_0x8c8869,_0x3bd073){var _0x7d4b4={'raw':![],'where':{'id':_0x8c8869[_0x7f9c('0x41')]['id']}},_0x58e1aa={};_0x58e1aa[_0x7f9c('0x33')]=_[_0x7f9c('0x30')](db['FreshsalesAccount'][_0x7f9c('0x42')]);_0x58e1aa['query']=_[_0x7f9c('0x30')](_0x8c8869['query']);_0x58e1aa[_0x7f9c('0x31')]=_[_0x7f9c('0x32')](_0x58e1aa[_0x7f9c('0x33')],_0x58e1aa[_0x7f9c('0x2f')]);_0x7d4b4['attributes']=_[_0x7f9c('0x32')](_0x58e1aa['model'],qs[_0x7f9c('0x43')](_0x8c8869['query'][_0x7f9c('0x43')]));_0x7d4b4['attributes']=_0x7d4b4[_0x7f9c('0x34')][_0x7f9c('0x44')]?_0x7d4b4[_0x7f9c('0x34')]:_0x58e1aa[_0x7f9c('0x33')];if(_0x8c8869[_0x7f9c('0x2f')][_0x7f9c('0x45')]){_0x7d4b4[_0x7f9c('0x3e')]=[{'all':!![]}];}_0x7d4b4=_[_0x7f9c('0x3c')]({},_0x7d4b4,_0x8c8869['options']);return db[_0x7f9c('0x2b')][_0x7f9c('0x46')](_0x7d4b4)[_0x7f9c('0x24')](handleEntityNotFound(_0x3bd073,null))['then'](respondWithResult(_0x3bd073,null))[_0x7f9c('0x47')](handleError(_0x3bd073,null));};exports[_0x7f9c('0x48')]=function(_0x1dc292,_0x1b3d1a){return db[_0x7f9c('0x2b')]['create'](_0x1dc292[_0x7f9c('0x49')],{})[_0x7f9c('0x24')](respondWithResult(_0x1b3d1a,0xc9))[_0x7f9c('0x47')](handleError(_0x1b3d1a,null));};exports[_0x7f9c('0x4a')]=function(_0x42a928,_0x515aa2){if(_0x42a928[_0x7f9c('0x49')]['id']){delete _0x42a928[_0x7f9c('0x49')]['id'];}return db[_0x7f9c('0x2b')][_0x7f9c('0x46')]({'where':{'id':_0x42a928[_0x7f9c('0x41')]['id']}})[_0x7f9c('0x24')](handleEntityNotFound(_0x515aa2,null))[_0x7f9c('0x24')](saveUpdates(_0x42a928[_0x7f9c('0x49')],null))[_0x7f9c('0x24')](respondWithResult(_0x515aa2,null))[_0x7f9c('0x47')](handleError(_0x515aa2,null));};exports[_0x7f9c('0x4b')]=function(_0xa3850d,_0xaa60d){return db[_0x7f9c('0x2b')][_0x7f9c('0x46')]({'where':{'id':_0xa3850d[_0x7f9c('0x41')]['id']}})[_0x7f9c('0x24')](handleEntityNotFound(_0xaa60d,null))['then'](removeEntity(_0xaa60d,null))[_0x7f9c('0x47')](handleError(_0xaa60d,null));};exports[_0x7f9c('0x4c')]=function(_0x2f0d24,_0x1ae69b,_0x206f7a){var _0x5891a2={};var _0x23753d={};var _0x1ce682;var _0x55e1b6;return db['FreshsalesAccount'][_0x7f9c('0x4d')]({'where':{'id':_0x2f0d24['params']['id']}})['then'](handleEntityNotFound(_0x1ae69b,null))[_0x7f9c('0x24')](function(_0x3d1e1f){if(_0x3d1e1f){_0x1ce682=_0x3d1e1f;_0x23753d[_0x7f9c('0x33')]=_['keys'](db[_0x7f9c('0x4e')][_0x7f9c('0x42')]);_0x23753d[_0x7f9c('0x2f')]=_['keys'](_0x2f0d24[_0x7f9c('0x2f')]);_0x23753d[_0x7f9c('0x31')]=_['intersection'](_0x23753d[_0x7f9c('0x33')],_0x23753d['query']);_0x5891a2[_0x7f9c('0x34')]=_[_0x7f9c('0x32')](_0x23753d[_0x7f9c('0x33')],qs[_0x7f9c('0x43')](_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x43')]));_0x5891a2[_0x7f9c('0x34')]=_0x5891a2[_0x7f9c('0x34')][_0x7f9c('0x44')]?_0x5891a2[_0x7f9c('0x34')]:_0x23753d['model'];_0x5891a2[_0x7f9c('0x37')]=qs[_0x7f9c('0x38')](_0x2f0d24['query'][_0x7f9c('0x38')]);_0x5891a2['where']=qs[_0x7f9c('0x31')](_[_0x7f9c('0x3a')](_0x2f0d24[_0x7f9c('0x2f')],_0x23753d[_0x7f9c('0x31')]));if(_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x3b')]){_0x5891a2[_0x7f9c('0x39')]=_[_0x7f9c('0x3c')](_0x5891a2[_0x7f9c('0x39')],{'$or':_[_0x7f9c('0x2a')](_0x5891a2[_0x7f9c('0x34')],function(_0x1980fc){var _0x3709cc={};_0x3709cc[_0x1980fc]={'$like':'%'+_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x3b')]+'%'};return _0x3709cc;})});}_0x5891a2=_['merge']({},_0x5891a2,_0x2f0d24[_0x7f9c('0x3d')]);return _0x1ce682[_0x7f9c('0x4c')](_0x5891a2);}})[_0x7f9c('0x24')](function(_0x522c5e){if(_0x522c5e){_0x55e1b6=_0x522c5e[_0x7f9c('0x44')];if(!_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x35')](_0x7f9c('0x36'))){_0x5891a2[_0x7f9c('0x1b')]=qs[_0x7f9c('0x1b')](_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x1b')]);_0x5891a2[_0x7f9c('0x1d')]=qs['offset'](_0x2f0d24[_0x7f9c('0x2f')][_0x7f9c('0x1d')]);}return _0x1ce682['getConfigurations'](_0x5891a2);}})['then'](function(_0x3944b5){if(_0x3944b5){return _0x3944b5?{'count':_0x55e1b6,'rows':_0x3944b5}:null;}})[_0x7f9c('0x24')](respondWithResult(_0x1ae69b,null))[_0x7f9c('0x47')](handleError(_0x1ae69b,null));};exports[_0x7f9c('0x4f')]=function(_0x326c0a,_0x3eba15,_0x323903){if(_0x326c0a[_0x7f9c('0x49')]['id']){delete _0x326c0a[_0x7f9c('0x49')]['id'];}return db['FreshsalesAccount'][_0x7f9c('0x4d')]({'where':{'id':_0x326c0a['params']['id']}})[_0x7f9c('0x24')](handleEntityNotFound(_0x3eba15,null))['then'](function(_0x45a241){if(_0x45a241){_0x326c0a[_0x7f9c('0x49')][_0x7f9c('0x50')]=_0x45a241['id'];_0x326c0a[_0x7f9c('0x49')][_0x7f9c('0x51')]=integrations[_0x7f9c('0x52')](_0x326c0a[_0x7f9c('0x49')][_0x7f9c('0x53')],_0x326c0a[_0x7f9c('0x49')][_0x7f9c('0x2d')]);_0x326c0a[_0x7f9c('0x49')]['Descriptions']=integrations['getDescriptions'](_0x326c0a[_0x7f9c('0x49')]['channel'],_0x326c0a[_0x7f9c('0x49')][_0x7f9c('0x2d')]);return db[_0x7f9c('0x4e')]['create'](_0x326c0a[_0x7f9c('0x49')],{'include':[{'model':db[_0x7f9c('0x54')],'as':_0x7f9c('0x51')},{'model':db[_0x7f9c('0x54')],'as':_0x7f9c('0x55')}]});}return null;})[_0x7f9c('0x24')](respondWithResult(_0x3eba15,null))[_0x7f9c('0x47')](handleError(_0x3eba15,null));};exports[_0x7f9c('0x56')]=function(_0x26317b,_0x2c3551,_0x747323){var _0x55c0b1='';var _0x517183='';return db[_0x7f9c('0x2b')][_0x7f9c('0x4d')]({'where':{'id':_0x26317b[_0x7f9c('0x41')]['id']},'attributes':['id',_0x7f9c('0x57'),_0x7f9c('0x58'),_0x7f9c('0x59')]})[_0x7f9c('0x24')](handleEntityNotFound(_0x2c3551,null))[_0x7f9c('0x24')](function(_0x2965e7){if(_0x2965e7){_0x517183=_0x2965e7[_0x7f9c('0x57')];_0x55c0b1=_0x2965e7[_0x7f9c('0x58')];var _0x244746=_0x2965e7[_0x7f9c('0x58')][_0x7f9c('0x5a')](-0x1);if(_0x244746==='/'){_0x55c0b1=_0x55c0b1[_0x7f9c('0x5b')](0x0,_0x55c0b1[_0x7f9c('0x5c')](_0x244746));}return rp({'method':_0x7f9c('0x5d'),'uri':util['format'](_0x7f9c('0x5e'),_0x55c0b1,_0x7f9c('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x2965e7[_0x7f9c('0x59')]},'json':!![]});}})[_0x7f9c('0x24')](function(_0x3c5493){if(_0x3c5493){var _0x2bfc5e=_0x3c5493[_0x7f9c('0x60')];var _0x3dbc39=![];var _0x58ffab=null;for(_0x58ffab=0x0;_0x58ffab<_0x2bfc5e[_0x7f9c('0x44')];_0x58ffab++){if(_0x2bfc5e[_0x58ffab][_0x7f9c('0x61')]===_0x517183){_0x3dbc39=!![];}}if(_0x3dbc39){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x2c3551,null))[_0x7f9c('0x47')](function(_0x584320){var _0x48ec63=_0x26317b[_0x7f9c('0x2f')][_0x7f9c('0x62')]?0x1f4:_0x584320['statusCode']||0x1f4;logger[_0x7f9c('0x25')](_0x7f9c('0x63'),_0x7f9c('0x56'),_0x48ec63,JSON[_0x7f9c('0x64')](_0x584320));delete _0x584320[_0x7f9c('0x27')];if(_0x48ec63===0x191){_0x48ec63=0x190;}_0x2c3551['status'](_0x48ec63)[_0x7f9c('0x28')](_0x26317b['query'][_0x7f9c('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x584320[_0x7f9c('0x65')]}:_0x584320);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 51131d5..64ee7de 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 _0x1893=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xdbdb01,_0x4994b8){var _0x12905f=function(_0x42ee53){while(--_0x42ee53){_0xdbdb01['push'](_0xdbdb01['shift']());}};_0x12905f(++_0x4994b8);}(_0x1893,0xa2));var _0x3189=function(_0x2fa9ef,_0x11eb49){_0x2fa9ef=_0x2fa9ef-0x0;var _0x40a7db=_0x1893[_0x2fa9ef];return _0x40a7db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));var integrations=require(_0x3189('0x8'));module[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return _0x4080a9[_0x3189('0xa')](_0x3189('0xb'),attributes,{'tableName':_0x3189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ace=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0x8ace[_0x529587];return _0x4ea039;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));var integrations=require(_0xe8ac('0xb'));module[_0xe8ac('0xc')]=function(_0x2b48ec,_0x4eb087){return _0x2b48ec[_0xe8ac('0xd')](_0xe8ac('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 887ec6e..b3c00a3 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 _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x51ad19,_0x1852d8){var _0x480af9=function(_0x279e74){while(--_0x279e74){_0x51ad19['push'](_0x51ad19['shift']());}};_0x480af9(++_0x1852d8);}(_0x68b3,0x1d8));var _0x368b=function(_0xd2a84,_0x45bd01){_0xd2a84=_0xd2a84-0x0;var _0x147e9d=_0x68b3[_0xd2a84];return _0x147e9d;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file +var _0xdf55=['FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdf55,0x83));var _0x5df5=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xdf55[_0x3cb530];return _0x4168ea;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['FreshsalesAccount'][_0x5df5('0x17')]({'raw':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'attributes':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1c')]||null:null,'include':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2['options'][_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x5ca542){return{'model':db[_0x5ca542[_0x5df5('0x1f')]],'as':_0x5ca542['as'],'attributes':_0x5ca542[_0x5df5('0x1b')],'include':_0x5ca542[_0x5df5('0x1d')]?_['map'](_0x5ca542['include'],function(_0x532923){return{'model':db[_0x532923[_0x5df5('0x1f')]],'as':_0x532923['as'],'attributes':_0x532923[_0x5df5('0x1b')],'include':_0x532923[_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0x532923[_0x5df5('0x1d')],function(_0x1fd83c){return{'model':db[_0x1fd83c[_0x5df5('0x1f')]],'as':_0x1fd83c['as'],'attributes':_0x1fd83c[_0x5df5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bb61){logger['info'](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x20')]('GetFreshsalesAccount',_0xb7e1c2,JSON[_0x5df5('0x21')](_0x18bb61));_0x215d59(_0x18bb61);})['catch'](function(_0xd2b213){logger['error'](_0x5df5('0x16'),_0xd2b213['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0xd2b213['message']));});});};exports[_0x5df5('0x22')]=function(_0x47bebb){var _0x4784ca=this;return new Promise(function(_0x485484,_0xf445de){return db[_0x5df5('0x23')][_0x5df5('0x24')]({'raw':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0x47bebb[_0x5df5('0x18')]?_0x47bebb['options']['where']||null:null,'attributes':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'include':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')]?_['map'](_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x2f1001){return{'model':db[_0x2f1001[_0x5df5('0x1f')]],'as':_0x2f1001['as'],'attributes':_0x2f1001['attributes'],'include':_0x2f1001[_0x5df5('0x1d')]?_['map'](_0x2f1001[_0x5df5('0x1d')],function(_0x394676){return{'model':db[_0x394676['model']],'as':_0x394676['as'],'attributes':_0x394676[_0x5df5('0x1b')],'include':_0x394676['include']?_[_0x5df5('0x1e')](_0x394676[_0x5df5('0x1d')],function(_0x4697c2){return{'model':db[_0x4697c2[_0x5df5('0x1f')]],'as':_0x4697c2['as'],'attributes':_0x4697c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5df5('0xc')](function(_0x2e7e64){logger[_0x5df5('0x13')](_0x5df5('0x22'),_0x47bebb);logger['debug'](_0x5df5('0x22'),_0x47bebb,JSON[_0x5df5('0x21')](_0x2e7e64));_0x485484(_0x2e7e64);})[_0x5df5('0x15')](function(_0x18b597){logger[_0x5df5('0xf')](_0x5df5('0x22'),_0x18b597[_0x5df5('0x12')],_0x47bebb);_0xf445de(_0x4784ca['error'](0x1f4,_0x18b597[_0x5df5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 903bb4a..a960a1f 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 _0xa622=['/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','show','isAuthenticated','getSubjects','getDescriptions'];(function(_0x4d2a48,_0x3bd78d){var _0xda1fb=function(_0x2a1471){while(--_0x2a1471){_0x4d2a48['push'](_0x4d2a48['shift']());}};_0xda1fb(++_0x3bd78d);}(_0xa622,0x117));var _0x2a62=function(_0x3d6e26,_0xfe88d){_0x3d6e26=_0x3d6e26-0x0;var _0x11ee90=_0xa622[_0x3d6e26];return _0x11ee90;};'use strict';var multer=require(_0x2a62('0x0'));var util=require(_0x2a62('0x1'));var path=require(_0x2a62('0x2'));var timeout=require(_0x2a62('0x3'));var express=require(_0x2a62('0x4'));var router=express[_0x2a62('0x5')]();var fs_extra=require(_0x2a62('0x6'));var auth=require(_0x2a62('0x7'));var interaction=require(_0x2a62('0x8'));var config=require(_0x2a62('0x9'));var controller=require(_0x2a62('0xa'));router[_0x2a62('0xb')]('/',auth['isAuthenticated'](),controller[_0x2a62('0xc')]);router[_0x2a62('0xb')](_0x2a62('0xd'),auth['isAuthenticated'](),controller[_0x2a62('0xe')]);router[_0x2a62('0xb')]('/:id/subjects',auth[_0x2a62('0xf')](),controller[_0x2a62('0x10')]);router[_0x2a62('0xb')]('/:id/descriptions',auth[_0x2a62('0xf')](),controller[_0x2a62('0x11')]);router['get'](_0x2a62('0x12'),auth[_0x2a62('0xf')](),controller[_0x2a62('0x13')]);router[_0x2a62('0x14')]('/',auth['isAuthenticated'](),controller[_0x2a62('0x15')]);router[_0x2a62('0x16')](_0x2a62('0xd'),auth[_0x2a62('0xf')](),controller[_0x2a62('0x17')]);router[_0x2a62('0x18')](_0x2a62('0xd'),auth['isAuthenticated'](),controller[_0x2a62('0x19')]);module[_0x2a62('0x1a')]=router; \ No newline at end of file +var _0xb307=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','show','/:id/subjects','isAuthenticated','/:id/descriptions','getFields','post','create','put','destroy','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb307,0x152));var _0x7b30=function(_0x3e2675,_0x1b9a98){_0x3e2675=_0x3e2675-0x0;var _0x540520=_0xb307[_0x3e2675];return _0x540520;};'use strict';var multer=require(_0x7b30('0x0'));var util=require(_0x7b30('0x1'));var path=require(_0x7b30('0x2'));var timeout=require(_0x7b30('0x3'));var express=require(_0x7b30('0x4'));var router=express[_0x7b30('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b30('0x6'));var config=require(_0x7b30('0x7'));var controller=require(_0x7b30('0x8'));router[_0x7b30('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7b30('0xa')]);router[_0x7b30('0x9')](_0x7b30('0xb'),auth[_0x7b30('0xc')](),controller['getSubjects']);router['get'](_0x7b30('0xd'),auth[_0x7b30('0xc')](),controller['getDescriptions']);router[_0x7b30('0x9')]('/:id/fields',auth[_0x7b30('0xc')](),controller[_0x7b30('0xe')]);router[_0x7b30('0xf')]('/',auth[_0x7b30('0xc')](),controller[_0x7b30('0x10')]);router[_0x7b30('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x7b30('0xc')](),controller[_0x7b30('0x12')]);module[_0x7b30('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fbda1cd..b0bf452 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 _0xf3e9=['exports','STRING','sequelize'];(function(_0x307459,_0x22d009){var _0x1488cb=function(_0x3ae164){while(--_0x3ae164){_0x307459['push'](_0x307459['shift']());}};_0x1488cb(++_0x22d009);}(_0xf3e9,0x13d));var _0x9f3e=function(_0x563346,_0x3fdd37){_0x563346=_0x563346-0x0;var _0x4c0882=_0xf3e9[_0x563346];return _0x4c0882;};'use strict';var Sequelize=require(_0x9f3e('0x0'));module[_0x9f3e('0x1')]={'name':{'type':Sequelize[_0x9f3e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d17=['exports','STRING','sequelize'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3d17,0xad));var _0x73d1=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x3d17[_0x179c4a];return _0x5d1879;};'use strict';var Sequelize=require(_0x73d1('0x0'));module[_0x73d1('0x1')]={'name':{'type':Sequelize[_0x73d1('0x2')]},'description':{'type':Sequelize[_0x73d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b24c16b..e7c141a 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 _0xbfcf=['count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x5bc974,_0x4c61e1){var _0x537040=function(_0x26c784){while(--_0x26c784){_0x5bc974['push'](_0x5bc974['shift']());}};_0x537040(++_0x4c61e1);}(_0xbfcf,0x122));var _0xfbfc=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xbfcf[_0x211632];return _0x5a1da1;};'use strict';var emlformat=require(_0xfbfc('0x0'));var rimraf=require(_0xfbfc('0x1'));var zipdir=require(_0xfbfc('0x2'));var jsonpatch=require(_0xfbfc('0x3'));var rp=require(_0xfbfc('0x4'));var moment=require(_0xfbfc('0x5'));var BPromise=require(_0xfbfc('0x6'));var Mustache=require(_0xfbfc('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfbfc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbfc('0x9'));var _=require('lodash');var squel=require(_0xfbfc('0xa'));var crypto=require(_0xfbfc('0xb'));var jsforce=require(_0xfbfc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfbfc('0xd'));var querystring=require(_0xfbfc('0xe'));var Papa=require('papaparse');var Redis=require(_0xfbfc('0xf'));var authService=require(_0xfbfc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbfc('0x11'));var logger=require(_0xfbfc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfbfc('0x13'));var licenseUtil=require(_0xfbfc('0x14'));var db=require(_0xfbfc('0x15'))['db'];function respondWithStatusCode(_0x3f0ae8,_0x106030){_0x106030=_0x106030||0xcc;return function(_0xb399fa){if(_0xb399fa){return _0x3f0ae8['sendStatus'](_0x106030);}return _0x3f0ae8[_0xfbfc('0x16')](_0x106030)['end']();};}function respondWithResult(_0x556fae,_0x71274d){_0x71274d=_0x71274d||0xc8;return function(_0x3613e1){if(_0x3613e1){return _0x556fae[_0xfbfc('0x16')](_0x71274d)[_0xfbfc('0x17')](_0x3613e1);}};}function respondWithFilteredResult(_0x4fcbc3,_0x56f3dc){return function(_0x5ee8b3){if(_0x5ee8b3){var _0x5b72c1=typeof _0x56f3dc[_0xfbfc('0x18')]===_0xfbfc('0x19')&&typeof _0x56f3dc['limit']===_0xfbfc('0x19');var _0x1015e7=_0x5ee8b3[_0xfbfc('0x1a')];var _0x68b7ed=_0x5b72c1?0x0:_0x56f3dc[_0xfbfc('0x18')];var _0x41c97d=_0x5b72c1?_0x5ee8b3[_0xfbfc('0x1a')]:_0x56f3dc[_0xfbfc('0x18')]+_0x56f3dc[_0xfbfc('0x1b')];var _0x20bc63;if(_0x41c97d>=_0x1015e7){_0x41c97d=_0x1015e7;_0x20bc63=0xc8;}else{_0x20bc63=0xce;}_0x4fcbc3[_0xfbfc('0x16')](_0x20bc63);return _0x4fcbc3[_0xfbfc('0x1c')](_0xfbfc('0x1d'),_0x68b7ed+'-'+_0x41c97d+'/'+_0x1015e7)[_0xfbfc('0x17')](_0x5ee8b3);}return null;};}function patchUpdates(_0x30f2f6){return function(_0xcfccb){try{jsonpatch[_0xfbfc('0x1e')](_0xcfccb,_0x30f2f6,!![]);}catch(_0x5a08d0){return BPromise['reject'](_0x5a08d0);}return _0xcfccb[_0xfbfc('0x1f')]();};}function saveUpdates(_0xfd71c3,_0x16b752){return function(_0x860a49){if(_0x860a49){return _0x860a49[_0xfbfc('0x20')](_0xfd71c3)[_0xfbfc('0x21')](function(_0x20690a){return _0x20690a;});}return null;};}function removeEntity(_0x19d39e,_0x582553){return function(_0x20e1ec){if(_0x20e1ec){return _0x20e1ec['destroy']()['then'](function(){_0x19d39e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x583c82,_0x3819c7){return function(_0x47e8e2){if(!_0x47e8e2){_0x583c82[_0xfbfc('0x22')](0x194);}return _0x47e8e2;};}function handleError(_0x44da41,_0x11b9dd){_0x11b9dd=_0x11b9dd||0x1f4;return function(_0x537a47){logger[_0xfbfc('0x23')](_0x537a47[_0xfbfc('0x24')]);if(_0x537a47[_0xfbfc('0x25')]){delete _0x537a47[_0xfbfc('0x25')];}_0x44da41[_0xfbfc('0x16')](_0x11b9dd)[_0xfbfc('0x26')](_0x537a47);};}exports[_0xfbfc('0x27')]=function(_0xc24e6,_0x267f00){var _0x463b01={},_0x4ce005={},_0x2fec15={'count':0x0,'rows':[]};var _0x22307e=_[_0xfbfc('0x28')](db[_0xfbfc('0x29')][_0xfbfc('0x2a')],function(_0x4fb47d){return{'name':_0x4fb47d['fieldName'],'type':_0x4fb47d[_0xfbfc('0x2b')][_0xfbfc('0x2c')]};});_0x4ce005[_0xfbfc('0x2d')]=_[_0xfbfc('0x28')](_0x22307e,_0xfbfc('0x25'));_0x4ce005[_0xfbfc('0x2e')]=_[_0xfbfc('0x2f')](_0xc24e6[_0xfbfc('0x2e')]);_0x4ce005[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x4ce005[_0xfbfc('0x2d')],_0x4ce005[_0xfbfc('0x2e')]);_0x463b01['attributes']=_[_0xfbfc('0x31')](_0x4ce005['model'],qs[_0xfbfc('0x32')](_0xc24e6['query'][_0xfbfc('0x32')]));_0x463b01[_0xfbfc('0x33')]=_0x463b01[_0xfbfc('0x33')]['length']?_0x463b01[_0xfbfc('0x33')]:_0x4ce005['model'];if(!_0xc24e6[_0xfbfc('0x2e')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x463b01['limit']=qs[_0xfbfc('0x1b')](_0xc24e6[_0xfbfc('0x2e')][_0xfbfc('0x1b')]);_0x463b01[_0xfbfc('0x18')]=qs[_0xfbfc('0x18')](_0xc24e6[_0xfbfc('0x2e')][_0xfbfc('0x18')]);}_0x463b01[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0xc24e6['query']['sort']);_0x463b01['where']=qs[_0xfbfc('0x30')](_['pick'](_0xc24e6[_0xfbfc('0x2e')],_0x4ce005[_0xfbfc('0x30')]),_0x22307e);if(_0xc24e6[_0xfbfc('0x2e')]['filter']){_0x463b01[_0xfbfc('0x38')]=_['merge'](_0x463b01[_0xfbfc('0x38')],{'$or':_['map'](_0x22307e,function(_0x1dfe7e){if(_0x1dfe7e[_0xfbfc('0x2b')]!==_0xfbfc('0x39')){var _0x4e9648={};_0x4e9648[_0x1dfe7e['name']]={'$like':'%'+_0xc24e6['query'][_0xfbfc('0x3a')]+'%'};return _0x4e9648;}})});}_0x463b01=_[_0xfbfc('0x3b')]({},_0x463b01,_0xc24e6[_0xfbfc('0x3c')]);var _0x2144fc={'where':_0x463b01[_0xfbfc('0x38')]};return db[_0xfbfc('0x29')]['count'](_0x2144fc)[_0xfbfc('0x21')](function(_0x54fb9d){_0x2fec15[_0xfbfc('0x1a')]=_0x54fb9d;if(_0xc24e6[_0xfbfc('0x2e')][_0xfbfc('0x3d')]){_0x463b01[_0xfbfc('0x3e')]=[{'all':!![]}];}return db[_0xfbfc('0x29')][_0xfbfc('0x3f')](_0x463b01);})[_0xfbfc('0x21')](function(_0xb1e5d3){_0x2fec15[_0xfbfc('0x40')]=_0xb1e5d3;return _0x2fec15;})['then'](respondWithFilteredResult(_0x267f00,_0x463b01))[_0xfbfc('0x41')](handleError(_0x267f00,null));};exports[_0xfbfc('0x42')]=function(_0x28d66a,_0x2cf14c){var _0x5ea7ce={'raw':![],'where':{'id':_0x28d66a[_0xfbfc('0x43')]['id']}},_0x295c4a={};_0x295c4a[_0xfbfc('0x2d')]=_[_0xfbfc('0x2f')](db[_0xfbfc('0x29')][_0xfbfc('0x2a')]);_0x295c4a['query']=_[_0xfbfc('0x2f')](_0x28d66a[_0xfbfc('0x2e')]);_0x295c4a[_0xfbfc('0x30')]=_['intersection'](_0x295c4a[_0xfbfc('0x2d')],_0x295c4a[_0xfbfc('0x2e')]);_0x5ea7ce[_0xfbfc('0x33')]=_[_0xfbfc('0x31')](_0x295c4a[_0xfbfc('0x2d')],qs['fields'](_0x28d66a[_0xfbfc('0x2e')][_0xfbfc('0x32')]));_0x5ea7ce[_0xfbfc('0x33')]=_0x5ea7ce['attributes'][_0xfbfc('0x44')]?_0x5ea7ce[_0xfbfc('0x33')]:_0x295c4a[_0xfbfc('0x2d')];if(_0x28d66a[_0xfbfc('0x2e')][_0xfbfc('0x3d')]){_0x5ea7ce[_0xfbfc('0x3e')]=[{'all':!![]}];}_0x5ea7ce=_[_0xfbfc('0x3b')]({},_0x5ea7ce,_0x28d66a[_0xfbfc('0x3c')]);return db[_0xfbfc('0x29')][_0xfbfc('0x45')](_0x5ea7ce)[_0xfbfc('0x21')](handleEntityNotFound(_0x2cf14c,null))[_0xfbfc('0x21')](respondWithResult(_0x2cf14c,null))['catch'](handleError(_0x2cf14c,null));};exports[_0xfbfc('0x46')]=function(_0x43fd5b,_0x5e9dbc){return db[_0xfbfc('0x29')][_0xfbfc('0x46')](_0x43fd5b['body'],{})[_0xfbfc('0x21')](respondWithResult(_0x5e9dbc,0xc9))[_0xfbfc('0x41')](handleError(_0x5e9dbc,null));};exports[_0xfbfc('0x20')]=function(_0x26d58b,_0x260ecc){if(_0x26d58b[_0xfbfc('0x47')]['id']){delete _0x26d58b['body']['id'];}return db['FreshsalesConfiguration'][_0xfbfc('0x45')]({'where':{'id':_0x26d58b['params']['id']}})[_0xfbfc('0x21')](handleEntityNotFound(_0x260ecc,null))[_0xfbfc('0x21')](saveUpdates(_0x26d58b[_0xfbfc('0x47')],null))['then'](respondWithResult(_0x260ecc,null))[_0xfbfc('0x41')](handleError(_0x260ecc,null));};exports[_0xfbfc('0x48')]=function(_0x3026bf,_0x43a3dc){return db[_0xfbfc('0x29')][_0xfbfc('0x45')]({'where':{'id':_0x3026bf[_0xfbfc('0x43')]['id']}})['then'](handleEntityNotFound(_0x43a3dc,null))[_0xfbfc('0x21')](removeEntity(_0x43a3dc,null))[_0xfbfc('0x41')](handleError(_0x43a3dc,null));};exports[_0xfbfc('0x49')]=function(_0x1f0999,_0x68b07,_0x587e92){var _0xd57ed3={};var _0x26bb8c={};var _0x293872;var _0x48b496;return db['FreshsalesConfiguration'][_0xfbfc('0x4a')]({'where':{'id':_0x1f0999[_0xfbfc('0x43')]['id']}})['then'](handleEntityNotFound(_0x68b07,null))['then'](function(_0x2c13b7){if(_0x2c13b7){_0x293872=_0x2c13b7;_0x26bb8c[_0xfbfc('0x2d')]=_['keys'](db[_0xfbfc('0x4b')][_0xfbfc('0x2a')]);_0x26bb8c[_0xfbfc('0x2e')]=_['keys'](_0x1f0999[_0xfbfc('0x2e')]);_0x26bb8c['filters']=_[_0xfbfc('0x31')](_0x26bb8c['model'],_0x26bb8c[_0xfbfc('0x2e')]);_0xd57ed3[_0xfbfc('0x33')]=_[_0xfbfc('0x31')](_0x26bb8c[_0xfbfc('0x2d')],qs[_0xfbfc('0x32')](_0x1f0999[_0xfbfc('0x2e')]['fields']));_0xd57ed3['attributes']=_0xd57ed3[_0xfbfc('0x33')][_0xfbfc('0x44')]?_0xd57ed3[_0xfbfc('0x33')]:_0x26bb8c[_0xfbfc('0x2d')];_0xd57ed3['order']=qs[_0xfbfc('0x37')](_0x1f0999[_0xfbfc('0x2e')][_0xfbfc('0x37')]);_0xd57ed3[_0xfbfc('0x38')]=qs[_0xfbfc('0x30')](_[_0xfbfc('0x4c')](_0x1f0999[_0xfbfc('0x2e')],_0x26bb8c[_0xfbfc('0x30')]));if(_0x1f0999[_0xfbfc('0x2e')][_0xfbfc('0x3a')]){_0xd57ed3['where']=_['merge'](_0xd57ed3[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x28')](_0xd57ed3[_0xfbfc('0x33')],function(_0xdf90fc){var _0x18ece2={};_0x18ece2[_0xdf90fc]={'$like':'%'+_0x1f0999[_0xfbfc('0x2e')]['filter']+'%'};return _0x18ece2;})});}_0xd57ed3=_[_0xfbfc('0x3b')]({},_0xd57ed3,_0x1f0999[_0xfbfc('0x3c')]);return _0x293872[_0xfbfc('0x49')](_0xd57ed3);}})[_0xfbfc('0x21')](function(_0x501892){if(_0x501892){_0x48b496=_0x501892[_0xfbfc('0x44')];if(!_0x1f0999['query'][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0xd57ed3[_0xfbfc('0x1b')]=qs['limit'](_0x1f0999[_0xfbfc('0x2e')]['limit']);_0xd57ed3[_0xfbfc('0x18')]=qs[_0xfbfc('0x18')](_0x1f0999['query'][_0xfbfc('0x18')]);}return _0x293872[_0xfbfc('0x49')](_0xd57ed3);}})[_0xfbfc('0x21')](function(_0x31efc6){if(_0x31efc6){return _0x31efc6?{'count':_0x48b496,'rows':_0x31efc6}:null;}})[_0xfbfc('0x21')](respondWithResult(_0x68b07,null))[_0xfbfc('0x41')](handleError(_0x68b07,null));};exports[_0xfbfc('0x4d')]=function(_0x453aa3,_0x16c2ef,_0xca0acc){var _0x1d7f25={};var _0x32a4cc={};var _0x15937e;var _0x5c4ade;return db[_0xfbfc('0x29')][_0xfbfc('0x4a')]({'where':{'id':_0x453aa3['params']['id']}})['then'](handleEntityNotFound(_0x16c2ef,null))[_0xfbfc('0x21')](function(_0x5427eb){if(_0x5427eb){_0x15937e=_0x5427eb;_0x32a4cc['model']=_[_0xfbfc('0x2f')](db[_0xfbfc('0x4b')][_0xfbfc('0x2a')]);_0x32a4cc[_0xfbfc('0x2e')]=_['keys'](_0x453aa3[_0xfbfc('0x2e')]);_0x32a4cc[_0xfbfc('0x30')]=_['intersection'](_0x32a4cc[_0xfbfc('0x2d')],_0x32a4cc[_0xfbfc('0x2e')]);_0x1d7f25[_0xfbfc('0x33')]=_[_0xfbfc('0x31')](_0x32a4cc[_0xfbfc('0x2d')],qs[_0xfbfc('0x32')](_0x453aa3[_0xfbfc('0x2e')]['fields']));_0x1d7f25[_0xfbfc('0x33')]=_0x1d7f25[_0xfbfc('0x33')][_0xfbfc('0x44')]?_0x1d7f25[_0xfbfc('0x33')]:_0x32a4cc[_0xfbfc('0x2d')];_0x1d7f25['order']=qs[_0xfbfc('0x37')](_0x453aa3[_0xfbfc('0x2e')]['sort']);_0x1d7f25[_0xfbfc('0x38')]=qs[_0xfbfc('0x30')](_[_0xfbfc('0x4c')](_0x453aa3[_0xfbfc('0x2e')],_0x32a4cc[_0xfbfc('0x30')]));if(_0x453aa3['query'][_0xfbfc('0x3a')]){_0x1d7f25[_0xfbfc('0x38')]=_[_0xfbfc('0x3b')](_0x1d7f25[_0xfbfc('0x38')],{'$or':_['map'](_0x1d7f25[_0xfbfc('0x33')],function(_0x2588ae){var _0x1c73f1={};_0x1c73f1[_0x2588ae]={'$like':'%'+_0x453aa3[_0xfbfc('0x2e')]['filter']+'%'};return _0x1c73f1;})});}_0x1d7f25=_[_0xfbfc('0x3b')]({},_0x1d7f25,_0x453aa3[_0xfbfc('0x3c')]);return _0x15937e[_0xfbfc('0x4d')](_0x1d7f25);}})['then'](function(_0x5bcf7e){if(_0x5bcf7e){_0x5c4ade=_0x5bcf7e['length'];if(!_0x453aa3['query'][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x1d7f25['limit']=qs[_0xfbfc('0x1b')](_0x453aa3['query']['limit']);_0x1d7f25[_0xfbfc('0x18')]=qs[_0xfbfc('0x18')](_0x453aa3[_0xfbfc('0x2e')]['offset']);}return _0x15937e[_0xfbfc('0x4d')](_0x1d7f25);}})[_0xfbfc('0x21')](function(_0x3abbd3){if(_0x3abbd3){return _0x3abbd3?{'count':_0x5c4ade,'rows':_0x3abbd3}:null;}})['then'](respondWithResult(_0x16c2ef,null))[_0xfbfc('0x41')](handleError(_0x16c2ef,null));};exports['getFields']=function(_0x43581b,_0x4b3c8b,_0x424e08){var _0x29c8b0={};var _0x3ea9de={};var _0x28b0a8;var _0xd4a93b;return db[_0xfbfc('0x29')]['findOne']({'where':{'id':_0x43581b[_0xfbfc('0x43')]['id']}})[_0xfbfc('0x21')](handleEntityNotFound(_0x4b3c8b,null))[_0xfbfc('0x21')](function(_0x5c04dc){if(_0x5c04dc){_0x28b0a8=_0x5c04dc;_0x3ea9de[_0xfbfc('0x2d')]=_[_0xfbfc('0x2f')](db['FreshsalesField'][_0xfbfc('0x2a')]);_0x3ea9de['query']=_[_0xfbfc('0x2f')](_0x43581b[_0xfbfc('0x2e')]);_0x3ea9de[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x3ea9de['model'],_0x3ea9de[_0xfbfc('0x2e')]);_0x29c8b0['attributes']=_['intersection'](_0x3ea9de[_0xfbfc('0x2d')],qs[_0xfbfc('0x32')](_0x43581b[_0xfbfc('0x2e')]['fields']));_0x29c8b0[_0xfbfc('0x33')]=_0x29c8b0[_0xfbfc('0x33')][_0xfbfc('0x44')]?_0x29c8b0[_0xfbfc('0x33')]:_0x3ea9de[_0xfbfc('0x2d')];_0x29c8b0[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x43581b['query']['sort']);_0x29c8b0[_0xfbfc('0x38')]=qs[_0xfbfc('0x30')](_['pick'](_0x43581b[_0xfbfc('0x2e')],_0x3ea9de['filters']));if(_0x43581b[_0xfbfc('0x2e')][_0xfbfc('0x3a')]){_0x29c8b0['where']=_[_0xfbfc('0x3b')](_0x29c8b0['where'],{'$or':_[_0xfbfc('0x28')](_0x29c8b0[_0xfbfc('0x33')],function(_0x111047){var _0x4bc9d0={};_0x4bc9d0[_0x111047]={'$like':'%'+_0x43581b[_0xfbfc('0x2e')][_0xfbfc('0x3a')]+'%'};return _0x4bc9d0;})});}_0x29c8b0=_['merge']({},_0x29c8b0,_0x43581b['options']);return _0x28b0a8['getFields'](_0x29c8b0);}})[_0xfbfc('0x21')](function(_0x256575){if(_0x256575){_0xd4a93b=_0x256575[_0xfbfc('0x44')];if(!_0x43581b[_0xfbfc('0x2e')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x29c8b0['limit']=qs[_0xfbfc('0x1b')](_0x43581b[_0xfbfc('0x2e')]['limit']);_0x29c8b0[_0xfbfc('0x18')]=qs[_0xfbfc('0x18')](_0x43581b[_0xfbfc('0x2e')]['offset']);}return _0x28b0a8[_0xfbfc('0x4e')](_0x29c8b0);}})[_0xfbfc('0x21')](function(_0x5d0c36){if(_0x5d0c36){return _0x5d0c36?{'count':_0xd4a93b,'rows':_0x5d0c36}:null;}})[_0xfbfc('0x21')](respondWithResult(_0x4b3c8b,null))['catch'](handleError(_0x4b3c8b,null));}; \ No newline at end of file +var _0xc4e2=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','end','error','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','update','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','nolimit','getDescriptions','order','getFields','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0xbc1d77,_0x1591a6){var _0x9173c7=function(_0x1ba4f0){while(--_0x1ba4f0){_0xbc1d77['push'](_0xbc1d77['shift']());}};_0x9173c7(++_0x1591a6);}(_0xc4e2,0xd7));var _0x2c4e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc4e2[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x2c4e('0x0'));var rimraf=require(_0x2c4e('0x1'));var zipdir=require(_0x2c4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c4e('0x3'));var moment=require(_0x2c4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c4e('0x5'));var util=require(_0x2c4e('0x6'));var path=require(_0x2c4e('0x7'));var sox=require(_0x2c4e('0x8'));var csv=require('to-csv');var ejs=require(_0x2c4e('0x9'));var fs=require('fs');var fs_extra=require(_0x2c4e('0xa'));var _=require('lodash');var squel=require(_0x2c4e('0xb'));var crypto=require(_0x2c4e('0xc'));var jsforce=require(_0x2c4e('0xd'));var deskjs=require(_0x2c4e('0xe'));var toCsv=require(_0x2c4e('0xf'));var querystring=require(_0x2c4e('0x10'));var Papa=require(_0x2c4e('0x11'));var Redis=require(_0x2c4e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c4e('0x13'));var logger=require('../../config/logger')(_0x2c4e('0x14'));var utils=require(_0x2c4e('0x15'));var config=require(_0x2c4e('0x16'));var licenseUtil=require(_0x2c4e('0x17'));var db=require(_0x2c4e('0x18'))['db'];function respondWithStatusCode(_0x3d07a1,_0x119f7c){_0x119f7c=_0x119f7c||0xcc;return function(_0x5d1dbd){if(_0x5d1dbd){return _0x3d07a1['sendStatus'](_0x119f7c);}return _0x3d07a1[_0x2c4e('0x19')](_0x119f7c)['end']();};}function respondWithResult(_0x4aad0b,_0x579179){_0x579179=_0x579179||0xc8;return function(_0x191f31){if(_0x191f31){return _0x4aad0b['status'](_0x579179)[_0x2c4e('0x1a')](_0x191f31);}};}function respondWithFilteredResult(_0x403d3d,_0x1dd6f6){return function(_0x4971d1){if(_0x4971d1){var _0x14e009=typeof _0x1dd6f6[_0x2c4e('0x1b')]===_0x2c4e('0x1c')&&typeof _0x1dd6f6[_0x2c4e('0x1d')]===_0x2c4e('0x1c');var _0x5b0c16=_0x4971d1['count'];var _0x383e37=_0x14e009?0x0:_0x1dd6f6[_0x2c4e('0x1b')];var _0x522e36=_0x14e009?_0x4971d1[_0x2c4e('0x1e')]:_0x1dd6f6[_0x2c4e('0x1b')]+_0x1dd6f6[_0x2c4e('0x1d')];var _0x2ca140;if(_0x522e36>=_0x5b0c16){_0x522e36=_0x5b0c16;_0x2ca140=0xc8;}else{_0x2ca140=0xce;}_0x403d3d[_0x2c4e('0x19')](_0x2ca140);return _0x403d3d['set'](_0x2c4e('0x1f'),_0x383e37+'-'+_0x522e36+'/'+_0x5b0c16)[_0x2c4e('0x1a')](_0x4971d1);}return null;};}function patchUpdates(_0xb48c40){return function(_0x3ef0ca){try{jsonpatch[_0x2c4e('0x20')](_0x3ef0ca,_0xb48c40,!![]);}catch(_0x131b24){return BPromise[_0x2c4e('0x21')](_0x131b24);}return _0x3ef0ca[_0x2c4e('0x22')]();};}function saveUpdates(_0x20be5b,_0x23b9c0){return function(_0x4eeae0){if(_0x4eeae0){return _0x4eeae0['update'](_0x20be5b)['then'](function(_0x30b2ac){return _0x30b2ac;});}return null;};}function removeEntity(_0x55c96b,_0x56ad58){return function(_0x56a257){if(_0x56a257){return _0x56a257['destroy']()['then'](function(){_0x55c96b[_0x2c4e('0x19')](0xcc)[_0x2c4e('0x23')]();});}};}function handleEntityNotFound(_0x159279,_0x466b1a){return function(_0x533efc){if(!_0x533efc){_0x159279['sendStatus'](0x194);}return _0x533efc;};}function handleError(_0x2892c3,_0x321007){_0x321007=_0x321007||0x1f4;return function(_0x4ac107){logger[_0x2c4e('0x24')](_0x4ac107['stack']);if(_0x4ac107[_0x2c4e('0x25')]){delete _0x4ac107['name'];}_0x2892c3[_0x2c4e('0x19')](_0x321007)['send'](_0x4ac107);};}exports['index']=function(_0x813bbb,_0x59a207){var _0x2108c1={},_0x309987={},_0x19d79b={'count':0x0,'rows':[]};var _0xc429bb=_[_0x2c4e('0x26')](db[_0x2c4e('0x27')][_0x2c4e('0x28')],function(_0x100e71){return{'name':_0x100e71[_0x2c4e('0x29')],'type':_0x100e71[_0x2c4e('0x2a')][_0x2c4e('0x2b')]};});_0x309987[_0x2c4e('0x2c')]=_[_0x2c4e('0x26')](_0xc429bb,'name');_0x309987[_0x2c4e('0x2d')]=_[_0x2c4e('0x2e')](_0x813bbb[_0x2c4e('0x2d')]);_0x309987[_0x2c4e('0x2f')]=_[_0x2c4e('0x30')](_0x309987[_0x2c4e('0x2c')],_0x309987[_0x2c4e('0x2d')]);_0x2108c1[_0x2c4e('0x31')]=_[_0x2c4e('0x30')](_0x309987[_0x2c4e('0x2c')],qs[_0x2c4e('0x32')](_0x813bbb[_0x2c4e('0x2d')]['fields']));_0x2108c1[_0x2c4e('0x31')]=_0x2108c1[_0x2c4e('0x31')][_0x2c4e('0x33')]?_0x2108c1['attributes']:_0x309987[_0x2c4e('0x2c')];if(!_0x813bbb['query']['hasOwnProperty']('nolimit')){_0x2108c1[_0x2c4e('0x1d')]=qs[_0x2c4e('0x1d')](_0x813bbb[_0x2c4e('0x2d')][_0x2c4e('0x1d')]);_0x2108c1[_0x2c4e('0x1b')]=qs[_0x2c4e('0x1b')](_0x813bbb[_0x2c4e('0x2d')]['offset']);}_0x2108c1['order']=qs[_0x2c4e('0x34')](_0x813bbb[_0x2c4e('0x2d')][_0x2c4e('0x34')]);_0x2108c1[_0x2c4e('0x35')]=qs[_0x2c4e('0x2f')](_['pick'](_0x813bbb[_0x2c4e('0x2d')],_0x309987['filters']),_0xc429bb);if(_0x813bbb[_0x2c4e('0x2d')]['filter']){_0x2108c1[_0x2c4e('0x35')]=_[_0x2c4e('0x36')](_0x2108c1['where'],{'$or':_[_0x2c4e('0x26')](_0xc429bb,function(_0x48167a){if(_0x48167a['type']!==_0x2c4e('0x37')){var _0xc73da={};_0xc73da[_0x48167a[_0x2c4e('0x25')]]={'$like':'%'+_0x813bbb['query'][_0x2c4e('0x38')]+'%'};return _0xc73da;}})});}_0x2108c1=_[_0x2c4e('0x36')]({},_0x2108c1,_0x813bbb[_0x2c4e('0x39')]);var _0xd0728e={'where':_0x2108c1[_0x2c4e('0x35')]};return db['FreshsalesConfiguration']['count'](_0xd0728e)[_0x2c4e('0x3a')](function(_0xfec992){_0x19d79b[_0x2c4e('0x1e')]=_0xfec992;if(_0x813bbb['query'][_0x2c4e('0x3b')]){_0x2108c1[_0x2c4e('0x3c')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2c4e('0x3d')](_0x2108c1);})[_0x2c4e('0x3a')](function(_0x528dca){_0x19d79b[_0x2c4e('0x3e')]=_0x528dca;return _0x19d79b;})[_0x2c4e('0x3a')](respondWithFilteredResult(_0x59a207,_0x2108c1))[_0x2c4e('0x3f')](handleError(_0x59a207,null));};exports['show']=function(_0x4b5eb4,_0x259719){var _0x2eab73={'raw':![],'where':{'id':_0x4b5eb4[_0x2c4e('0x40')]['id']}},_0x38ca52={};_0x38ca52[_0x2c4e('0x2c')]=_[_0x2c4e('0x2e')](db['FreshsalesConfiguration'][_0x2c4e('0x28')]);_0x38ca52[_0x2c4e('0x2d')]=_[_0x2c4e('0x2e')](_0x4b5eb4[_0x2c4e('0x2d')]);_0x38ca52[_0x2c4e('0x2f')]=_[_0x2c4e('0x30')](_0x38ca52[_0x2c4e('0x2c')],_0x38ca52[_0x2c4e('0x2d')]);_0x2eab73[_0x2c4e('0x31')]=_[_0x2c4e('0x30')](_0x38ca52[_0x2c4e('0x2c')],qs[_0x2c4e('0x32')](_0x4b5eb4['query'][_0x2c4e('0x32')]));_0x2eab73[_0x2c4e('0x31')]=_0x2eab73[_0x2c4e('0x31')][_0x2c4e('0x33')]?_0x2eab73[_0x2c4e('0x31')]:_0x38ca52[_0x2c4e('0x2c')];if(_0x4b5eb4[_0x2c4e('0x2d')][_0x2c4e('0x3b')]){_0x2eab73[_0x2c4e('0x3c')]=[{'all':!![]}];}_0x2eab73=_[_0x2c4e('0x36')]({},_0x2eab73,_0x4b5eb4[_0x2c4e('0x39')]);return db['FreshsalesConfiguration'][_0x2c4e('0x41')](_0x2eab73)[_0x2c4e('0x3a')](handleEntityNotFound(_0x259719,null))[_0x2c4e('0x3a')](respondWithResult(_0x259719,null))[_0x2c4e('0x3f')](handleError(_0x259719,null));};exports['create']=function(_0x11fcb5,_0x44a541){return db['FreshsalesConfiguration'][_0x2c4e('0x42')](_0x11fcb5[_0x2c4e('0x43')],{})[_0x2c4e('0x3a')](respondWithResult(_0x44a541,0xc9))[_0x2c4e('0x3f')](handleError(_0x44a541,null));};exports[_0x2c4e('0x44')]=function(_0x3d5a64,_0x5c08db){if(_0x3d5a64[_0x2c4e('0x43')]['id']){delete _0x3d5a64[_0x2c4e('0x43')]['id'];}return db[_0x2c4e('0x27')]['find']({'where':{'id':_0x3d5a64[_0x2c4e('0x40')]['id']}})[_0x2c4e('0x3a')](handleEntityNotFound(_0x5c08db,null))['then'](saveUpdates(_0x3d5a64['body'],null))['then'](respondWithResult(_0x5c08db,null))[_0x2c4e('0x3f')](handleError(_0x5c08db,null));};exports['destroy']=function(_0x16428d,_0x3dff31){return db[_0x2c4e('0x27')][_0x2c4e('0x41')]({'where':{'id':_0x16428d[_0x2c4e('0x40')]['id']}})[_0x2c4e('0x3a')](handleEntityNotFound(_0x3dff31,null))[_0x2c4e('0x3a')](removeEntity(_0x3dff31,null))['catch'](handleError(_0x3dff31,null));};exports[_0x2c4e('0x45')]=function(_0x38a0eb,_0x5c5a24,_0x129540){var _0x4951e2={};var _0xb2fc1b={};var _0xda56b7;var _0x1e0e0c;return db[_0x2c4e('0x27')][_0x2c4e('0x46')]({'where':{'id':_0x38a0eb['params']['id']}})[_0x2c4e('0x3a')](handleEntityNotFound(_0x5c5a24,null))[_0x2c4e('0x3a')](function(_0x1e9183){if(_0x1e9183){_0xda56b7=_0x1e9183;_0xb2fc1b[_0x2c4e('0x2c')]=_[_0x2c4e('0x2e')](db[_0x2c4e('0x47')][_0x2c4e('0x28')]);_0xb2fc1b[_0x2c4e('0x2d')]=_['keys'](_0x38a0eb['query']);_0xb2fc1b['filters']=_['intersection'](_0xb2fc1b['model'],_0xb2fc1b[_0x2c4e('0x2d')]);_0x4951e2[_0x2c4e('0x31')]=_['intersection'](_0xb2fc1b[_0x2c4e('0x2c')],qs['fields'](_0x38a0eb['query'][_0x2c4e('0x32')]));_0x4951e2[_0x2c4e('0x31')]=_0x4951e2['attributes']['length']?_0x4951e2[_0x2c4e('0x31')]:_0xb2fc1b[_0x2c4e('0x2c')];_0x4951e2['order']=qs[_0x2c4e('0x34')](_0x38a0eb[_0x2c4e('0x2d')][_0x2c4e('0x34')]);_0x4951e2[_0x2c4e('0x35')]=qs['filters'](_[_0x2c4e('0x48')](_0x38a0eb['query'],_0xb2fc1b[_0x2c4e('0x2f')]));if(_0x38a0eb[_0x2c4e('0x2d')]['filter']){_0x4951e2[_0x2c4e('0x35')]=_['merge'](_0x4951e2[_0x2c4e('0x35')],{'$or':_[_0x2c4e('0x26')](_0x4951e2[_0x2c4e('0x31')],function(_0x1d67d5){var _0x16ab7d={};_0x16ab7d[_0x1d67d5]={'$like':'%'+_0x38a0eb['query'][_0x2c4e('0x38')]+'%'};return _0x16ab7d;})});}_0x4951e2=_[_0x2c4e('0x36')]({},_0x4951e2,_0x38a0eb[_0x2c4e('0x39')]);return _0xda56b7[_0x2c4e('0x45')](_0x4951e2);}})[_0x2c4e('0x3a')](function(_0x42ece8){if(_0x42ece8){_0x1e0e0c=_0x42ece8[_0x2c4e('0x33')];if(!_0x38a0eb[_0x2c4e('0x2d')][_0x2c4e('0x49')](_0x2c4e('0x4a'))){_0x4951e2[_0x2c4e('0x1d')]=qs['limit'](_0x38a0eb[_0x2c4e('0x2d')][_0x2c4e('0x1d')]);_0x4951e2['offset']=qs[_0x2c4e('0x1b')](_0x38a0eb[_0x2c4e('0x2d')]['offset']);}return _0xda56b7[_0x2c4e('0x45')](_0x4951e2);}})[_0x2c4e('0x3a')](function(_0x5c6bd3){if(_0x5c6bd3){return _0x5c6bd3?{'count':_0x1e0e0c,'rows':_0x5c6bd3}:null;}})[_0x2c4e('0x3a')](respondWithResult(_0x5c5a24,null))[_0x2c4e('0x3f')](handleError(_0x5c5a24,null));};exports[_0x2c4e('0x4b')]=function(_0x5eacf,_0x48af77,_0x1b97ab){var _0x43b49a={};var _0x464ec7={};var _0x189938;var _0x9d8da3;return db['FreshsalesConfiguration'][_0x2c4e('0x46')]({'where':{'id':_0x5eacf[_0x2c4e('0x40')]['id']}})[_0x2c4e('0x3a')](handleEntityNotFound(_0x48af77,null))[_0x2c4e('0x3a')](function(_0x228862){if(_0x228862){_0x189938=_0x228862;_0x464ec7[_0x2c4e('0x2c')]=_[_0x2c4e('0x2e')](db[_0x2c4e('0x47')][_0x2c4e('0x28')]);_0x464ec7[_0x2c4e('0x2d')]=_[_0x2c4e('0x2e')](_0x5eacf['query']);_0x464ec7['filters']=_[_0x2c4e('0x30')](_0x464ec7[_0x2c4e('0x2c')],_0x464ec7['query']);_0x43b49a[_0x2c4e('0x31')]=_[_0x2c4e('0x30')](_0x464ec7[_0x2c4e('0x2c')],qs[_0x2c4e('0x32')](_0x5eacf['query'][_0x2c4e('0x32')]));_0x43b49a[_0x2c4e('0x31')]=_0x43b49a[_0x2c4e('0x31')][_0x2c4e('0x33')]?_0x43b49a[_0x2c4e('0x31')]:_0x464ec7[_0x2c4e('0x2c')];_0x43b49a['order']=qs['sort'](_0x5eacf[_0x2c4e('0x2d')][_0x2c4e('0x34')]);_0x43b49a[_0x2c4e('0x35')]=qs[_0x2c4e('0x2f')](_[_0x2c4e('0x48')](_0x5eacf[_0x2c4e('0x2d')],_0x464ec7[_0x2c4e('0x2f')]));if(_0x5eacf[_0x2c4e('0x2d')]['filter']){_0x43b49a[_0x2c4e('0x35')]=_[_0x2c4e('0x36')](_0x43b49a[_0x2c4e('0x35')],{'$or':_[_0x2c4e('0x26')](_0x43b49a[_0x2c4e('0x31')],function(_0x3d74eb){var _0xab71ce={};_0xab71ce[_0x3d74eb]={'$like':'%'+_0x5eacf[_0x2c4e('0x2d')][_0x2c4e('0x38')]+'%'};return _0xab71ce;})});}_0x43b49a=_[_0x2c4e('0x36')]({},_0x43b49a,_0x5eacf['options']);return _0x189938[_0x2c4e('0x4b')](_0x43b49a);}})[_0x2c4e('0x3a')](function(_0x448df6){if(_0x448df6){_0x9d8da3=_0x448df6[_0x2c4e('0x33')];if(!_0x5eacf[_0x2c4e('0x2d')][_0x2c4e('0x49')](_0x2c4e('0x4a'))){_0x43b49a[_0x2c4e('0x1d')]=qs['limit'](_0x5eacf[_0x2c4e('0x2d')]['limit']);_0x43b49a['offset']=qs[_0x2c4e('0x1b')](_0x5eacf[_0x2c4e('0x2d')]['offset']);}return _0x189938[_0x2c4e('0x4b')](_0x43b49a);}})[_0x2c4e('0x3a')](function(_0x559704){if(_0x559704){return _0x559704?{'count':_0x9d8da3,'rows':_0x559704}:null;}})[_0x2c4e('0x3a')](respondWithResult(_0x48af77,null))[_0x2c4e('0x3f')](handleError(_0x48af77,null));};exports['getFields']=function(_0x148ba7,_0xe0e178,_0x3337d5){var _0x3d32a2={};var _0x27ac63={};var _0x363b59;var _0x541d70;return db[_0x2c4e('0x27')][_0x2c4e('0x46')]({'where':{'id':_0x148ba7[_0x2c4e('0x40')]['id']}})[_0x2c4e('0x3a')](handleEntityNotFound(_0xe0e178,null))['then'](function(_0x4b68e2){if(_0x4b68e2){_0x363b59=_0x4b68e2;_0x27ac63['model']=_[_0x2c4e('0x2e')](db['FreshsalesField']['rawAttributes']);_0x27ac63[_0x2c4e('0x2d')]=_[_0x2c4e('0x2e')](_0x148ba7[_0x2c4e('0x2d')]);_0x27ac63[_0x2c4e('0x2f')]=_[_0x2c4e('0x30')](_0x27ac63['model'],_0x27ac63[_0x2c4e('0x2d')]);_0x3d32a2[_0x2c4e('0x31')]=_[_0x2c4e('0x30')](_0x27ac63['model'],qs[_0x2c4e('0x32')](_0x148ba7['query']['fields']));_0x3d32a2['attributes']=_0x3d32a2[_0x2c4e('0x31')][_0x2c4e('0x33')]?_0x3d32a2[_0x2c4e('0x31')]:_0x27ac63['model'];_0x3d32a2[_0x2c4e('0x4c')]=qs[_0x2c4e('0x34')](_0x148ba7[_0x2c4e('0x2d')][_0x2c4e('0x34')]);_0x3d32a2['where']=qs['filters'](_[_0x2c4e('0x48')](_0x148ba7[_0x2c4e('0x2d')],_0x27ac63[_0x2c4e('0x2f')]));if(_0x148ba7[_0x2c4e('0x2d')][_0x2c4e('0x38')]){_0x3d32a2[_0x2c4e('0x35')]=_[_0x2c4e('0x36')](_0x3d32a2['where'],{'$or':_[_0x2c4e('0x26')](_0x3d32a2[_0x2c4e('0x31')],function(_0x5acb00){var _0x4c71ba={};_0x4c71ba[_0x5acb00]={'$like':'%'+_0x148ba7[_0x2c4e('0x2d')][_0x2c4e('0x38')]+'%'};return _0x4c71ba;})});}_0x3d32a2=_[_0x2c4e('0x36')]({},_0x3d32a2,_0x148ba7[_0x2c4e('0x39')]);return _0x363b59['getFields'](_0x3d32a2);}})[_0x2c4e('0x3a')](function(_0x467c6f){if(_0x467c6f){_0x541d70=_0x467c6f[_0x2c4e('0x33')];if(!_0x148ba7[_0x2c4e('0x2d')][_0x2c4e('0x49')](_0x2c4e('0x4a'))){_0x3d32a2[_0x2c4e('0x1d')]=qs[_0x2c4e('0x1d')](_0x148ba7[_0x2c4e('0x2d')][_0x2c4e('0x1d')]);_0x3d32a2[_0x2c4e('0x1b')]=qs[_0x2c4e('0x1b')](_0x148ba7['query']['offset']);}return _0x363b59[_0x2c4e('0x4d')](_0x3d32a2);}})[_0x2c4e('0x3a')](function(_0x16f5f9){if(_0x16f5f9){return _0x16f5f9?{'count':_0x541d70,'rows':_0x16f5f9}:null;}})[_0x2c4e('0x3a')](respondWithResult(_0xe0e178,null))[_0x2c4e('0x3f')](handleError(_0xe0e178,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 974d43c..a0a6308 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 _0xac31=['request-promise','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','bluebird'];(function(_0x148e14,_0x1fe25f){var _0x4bff7c=function(_0x4c131f){while(--_0x4c131f){_0x148e14['push'](_0x148e14['shift']());}};_0x4bff7c(++_0x1fe25f);}(_0xac31,0x1ed));var _0x1ac3=function(_0x368d7b,_0x1033e7){_0x368d7b=_0x368d7b-0x0;var _0x158bf1=_0xac31[_0x368d7b];return _0x158bf1;};'use strict';var _=require('lodash');var util=require(_0x1ac3('0x0'));var logger=require(_0x1ac3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1ac3('0x2'));var rp=require(_0x1ac3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ac3('0x4'));module['exports']=function(_0x2eb752,_0x3d85dd){return _0x2eb752[_0x1ac3('0x5')](_0x1ac3('0x6'),attributes,{'tableName':_0x1ac3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c7b=['path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4c9c63,_0x398050){var _0x4ed698=function(_0x1ff260){while(--_0x1ff260){_0x4c9c63['push'](_0x4c9c63['shift']());}};_0x4ed698(++_0x398050);}(_0x9c7b,0x1db));var _0xb9c7=function(_0x328696,_0x252c27){_0x328696=_0x328696-0x0;var _0x372519=_0x9c7b[_0x328696];return _0x372519;};'use strict';var _=require(_0xb9c7('0x0'));var util=require(_0xb9c7('0x1'));var logger=require(_0xb9c7('0x2'))('api');var moment=require(_0xb9c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb9c7('0x4'));var fs=require('fs');var path=require(_0xb9c7('0x5'));var rimraf=require(_0xb9c7('0x6'));var config=require(_0xb9c7('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xb9c7('0x8')]=function(_0x12c2e3,_0x4de06d){return _0x12c2e3[_0xb9c7('0x9')](_0xb9c7('0xa'),attributes,{'tableName':_0xb9c7('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 3ef49ee..3cbbd7a 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 _0xf569=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x894992,_0x22624d){var _0x3fa77e=function(_0x257a0f){while(--_0x257a0f){_0x894992['push'](_0x894992['shift']());}};_0x3fa77e(++_0x22624d);}(_0xf569,0x16c));var _0x9f56=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf569[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x9f56('0x0'));var util=require(_0x9f56('0x1'));var moment=require('moment');var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f56('0x5'))('rpc');var config=require(_0x9f56('0x6'));var jayson=require(_0x9f56('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358834,_0x824d58,_0x3bcf92){return new BPromise(function(_0x3470b4,_0x24997a){return client[_0x9f56('0x8')](_0x358834,_0x3bcf92)[_0x9f56('0x9')](function(_0x20f4fd){logger['info'](_0x9f56('0xa'),_0x824d58,_0x9f56('0xb'));logger['debug'](_0x9f56('0xc'),_0x824d58,_0x9f56('0xb'),JSON['stringify'](_0x20f4fd));if(_0x20f4fd[_0x9f56('0xd')]){if(_0x20f4fd[_0x9f56('0xd')][_0x9f56('0xe')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x824d58,_0x20f4fd[_0x9f56('0xd')]['message']);return _0x24997a(_0x20f4fd[_0x9f56('0xd')][_0x9f56('0xf')]);}logger['error'](_0x9f56('0xa'),_0x824d58,_0x20f4fd[_0x9f56('0xd')][_0x9f56('0xf')]);return _0x3470b4(_0x20f4fd[_0x9f56('0xd')]['message']);}else{logger['info'](_0x9f56('0xa'),_0x824d58,_0x9f56('0xb'));_0x3470b4(_0x20f4fd['result']['message']);}})[_0x9f56('0x10')](function(_0x24b7f4){logger[_0x9f56('0xd')](_0x9f56('0xa'),_0x824d58,_0x24b7f4);_0x24997a(_0x24b7f4);});});} \ No newline at end of file +var _0x7098=['client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a37d4,_0x5ef414){var _0x592b69=function(_0x530315){while(--_0x530315){_0x2a37d4['push'](_0x2a37d4['shift']());}};_0x592b69(++_0x5ef414);}(_0x7098,0x15e));var _0x8709=function(_0x51d276,_0x4df2f1){_0x51d276=_0x51d276-0x0;var _0x419502=_0x7098[_0x51d276];return _0x419502;};'use strict';var _=require(_0x8709('0x0'));var util=require('util');var moment=require(_0x8709('0x1'));var BPromise=require(_0x8709('0x2'));var rs=require(_0x8709('0x3'));var fs=require('fs');var Redis=require(_0x8709('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8709('0x5'));var logger=require(_0x8709('0x6'))(_0x8709('0x7'));var config=require(_0x8709('0x8'));var jayson=require(_0x8709('0x9'));var client=jayson[_0x8709('0xa')][_0x8709('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8d9a,_0x3dcc9d,_0x16151c){return new BPromise(function(_0x5d79c3,_0x4f0b3e){return client[_0x8709('0xc')](_0x4a8d9a,_0x16151c)[_0x8709('0xd')](function(_0x4683a9){logger['info'](_0x8709('0xe'),_0x3dcc9d,_0x8709('0xf'));logger[_0x8709('0x10')](_0x8709('0x11'),_0x3dcc9d,_0x8709('0xf'),JSON[_0x8709('0x12')](_0x4683a9));if(_0x4683a9[_0x8709('0x13')]){if(_0x4683a9[_0x8709('0x13')]['code']===0x1f4){logger[_0x8709('0x13')](_0x8709('0xe'),_0x3dcc9d,_0x4683a9[_0x8709('0x13')][_0x8709('0x14')]);return _0x4f0b3e(_0x4683a9[_0x8709('0x13')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3dcc9d,_0x4683a9[_0x8709('0x13')][_0x8709('0x14')]);return _0x5d79c3(_0x4683a9[_0x8709('0x13')][_0x8709('0x14')]);}else{logger[_0x8709('0x15')](_0x8709('0xe'),_0x3dcc9d,_0x8709('0xf'));_0x5d79c3(_0x4683a9[_0x8709('0x16')]['message']);}})[_0x8709('0x17')](function(_0x5f1610){logger[_0x8709('0x13')](_0x8709('0xe'),_0x3dcc9d,_0x5f1610);_0x4f0b3e(_0x5f1610);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8c61574..ff36c50 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 _0x4849=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x4fa3b3,_0x3c7487){var _0x3a37f8=function(_0x5334db){while(--_0x5334db){_0x4fa3b3['push'](_0x4fa3b3['shift']());}};_0x3a37f8(++_0x3c7487);}(_0x4849,0x86));var _0x9484=function(_0x50e399,_0xdecafa){_0x50e399=_0x50e399-0x0;var _0xae6b28=_0x4849[_0x50e399];return _0xae6b28;};'use strict';var multer=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var path=require('path');var timeout=require(_0x9484('0x2'));var express=require(_0x9484('0x3'));var router=express[_0x9484('0x4')]();var fs_extra=require(_0x9484('0x5'));var auth=require(_0x9484('0x6'));var interaction=require(_0x9484('0x7'));var config=require(_0x9484('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x9484('0x9')]('/',auth[_0x9484('0xa')](),controller['index']);router[_0x9484('0x9')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0xc')]);router[_0x9484('0xd')]('/',auth['isAuthenticated'](),controller[_0x9484('0xe')]);router[_0x9484('0xf')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller['update']);router[_0x9484('0x10')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0x11')]);module[_0x9484('0x12')]=router; \ No newline at end of file +var _0x04d0=['fs-extra','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x04d0,0x10a));var _0x004d=function(_0x14baa4,_0x331fde){_0x14baa4=_0x14baa4-0x0;var _0x50e9cb=_0x04d0[_0x14baa4];return _0x50e9cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x004d('0x0'));var timeout=require(_0x004d('0x1'));var express=require(_0x004d('0x2'));var router=express[_0x004d('0x3')]();var fs_extra=require(_0x004d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x004d('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x004d('0x6')]('/',auth[_0x004d('0x7')](),controller['index']);router[_0x004d('0x6')](_0x004d('0x8'),auth['isAuthenticated'](),controller[_0x004d('0x9')]);router['post']('/',auth[_0x004d('0x7')](),controller[_0x004d('0xa')]);router[_0x004d('0xb')]('/:id',auth[_0x004d('0x7')](),controller[_0x004d('0xc')]);router['delete'](_0x004d('0x8'),auth['isAuthenticated'](),controller[_0x004d('0xd')]);module[_0x004d('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c2f3dd3..6f02cb6 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 _0x73e4=['keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x58a3b9,_0x1e2246){var _0xee1194=function(_0x16a791){while(--_0x16a791){_0x58a3b9['push'](_0x58a3b9['shift']());}};_0xee1194(++_0x1e2246);}(_0x73e4,0x163));var _0x473e=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x73e4[_0x6dd5c];return _0x5a87fa;};'use strict';var Sequelize=require(_0x473e('0x0'));module[_0x473e('0x1')]={'type':{'type':Sequelize[_0x473e('0x2')](_0x473e('0x3'),_0x473e('0x4'),'customVariable',_0x473e('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x473e('0x6')]},'key':{'type':Sequelize[_0x473e('0x6')]},'keyType':{'type':Sequelize[_0x473e('0x2')](_0x473e('0x3'),_0x473e('0x4'),_0x473e('0x7'))},'keyContent':{'type':Sequelize[_0x473e('0x6')]},'idField':{'type':Sequelize[_0x473e('0x6')]},'nameField':{'type':Sequelize[_0x473e('0x6')]},'customField':{'type':Sequelize[_0x473e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x473e('0x6')]}}; \ No newline at end of file +var _0xf871=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xf871,0x1a6));var _0x1f87=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xf871[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0x1f87('0x0'));module[_0x1f87('0x1')]={'type':{'type':Sequelize[_0x1f87('0x2')](_0x1f87('0x3'),_0x1f87('0x4'),_0x1f87('0x5'),_0x1f87('0x6'),'picklist'),'defaultValue':_0x1f87('0x3')},'content':{'type':Sequelize[_0x1f87('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1f87('0x2')](_0x1f87('0x3'),_0x1f87('0x4'),_0x1f87('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1f87('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f87('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c42a3e9..09800a6 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 _0xaf65=['key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FreshsalesField','findAll','rows','show','params','intersection','include','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','destroy','then','name','index','map','rawAttributes'];(function(_0xab6d05,_0x395cdd){var _0x262e35=function(_0x129b0b){while(--_0x129b0b){_0xab6d05['push'](_0xab6d05['shift']());}};_0x262e35(++_0x395cdd);}(_0xaf65,0x18b));var _0x5af6=function(_0x51ead8,_0x10c093){_0x51ead8=_0x51ead8-0x0;var _0x56321a=_0xaf65[_0x51ead8];return _0x56321a;};'use strict';var emlformat=require(_0x5af6('0x0'));var rimraf=require(_0x5af6('0x1'));var zipdir=require(_0x5af6('0x2'));var jsonpatch=require(_0x5af6('0x3'));var rp=require('request-promise');var moment=require(_0x5af6('0x4'));var BPromise=require(_0x5af6('0x5'));var Mustache=require(_0x5af6('0x6'));var util=require(_0x5af6('0x7'));var path=require(_0x5af6('0x8'));var sox=require(_0x5af6('0x9'));var csv=require('to-csv');var ejs=require(_0x5af6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5af6('0xb'));var squel=require(_0x5af6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5af6('0xd'));var deskjs=require(_0x5af6('0xe'));var toCsv=require(_0x5af6('0xf'));var querystring=require(_0x5af6('0x10'));var Papa=require(_0x5af6('0x11'));var Redis=require('ioredis');var authService=require(_0x5af6('0x12'));var qs=require(_0x5af6('0x13'));var as=require(_0x5af6('0x14'));var hardwareService=require(_0x5af6('0x15'));var logger=require('../../config/logger')(_0x5af6('0x16'));var utils=require('../../config/utils');var config=require(_0x5af6('0x17'));var licenseUtil=require(_0x5af6('0x18'));var db=require(_0x5af6('0x19'))['db'];function respondWithStatusCode(_0x3a30ee,_0xdbd0c5){_0xdbd0c5=_0xdbd0c5||0xcc;return function(_0x58fb7e){if(_0x58fb7e){return _0x3a30ee[_0x5af6('0x1a')](_0xdbd0c5);}return _0x3a30ee[_0x5af6('0x1b')](_0xdbd0c5)[_0x5af6('0x1c')]();};}function respondWithResult(_0x1c23cd,_0x218598){_0x218598=_0x218598||0xc8;return function(_0x50651c){if(_0x50651c){return _0x1c23cd[_0x5af6('0x1b')](_0x218598)['json'](_0x50651c);}};}function respondWithFilteredResult(_0x122ec3,_0x2adb08){return function(_0xc39cd4){if(_0xc39cd4){var _0x1f5568=typeof _0x2adb08['offset']===_0x5af6('0x1d')&&typeof _0x2adb08[_0x5af6('0x1e')]===_0x5af6('0x1d');var _0x163d38=_0xc39cd4['count'];var _0x127fc1=_0x1f5568?0x0:_0x2adb08['offset'];var _0x490a68=_0x1f5568?_0xc39cd4[_0x5af6('0x1f')]:_0x2adb08[_0x5af6('0x20')]+_0x2adb08['limit'];var _0x2319d4;if(_0x490a68>=_0x163d38){_0x490a68=_0x163d38;_0x2319d4=0xc8;}else{_0x2319d4=0xce;}_0x122ec3[_0x5af6('0x1b')](_0x2319d4);return _0x122ec3[_0x5af6('0x21')](_0x5af6('0x22'),_0x127fc1+'-'+_0x490a68+'/'+_0x163d38)[_0x5af6('0x23')](_0xc39cd4);}return null;};}function patchUpdates(_0x4240e6){return function(_0x124e67){try{jsonpatch['apply'](_0x124e67,_0x4240e6,!![]);}catch(_0x450193){return BPromise[_0x5af6('0x24')](_0x450193);}return _0x124e67['save']();};}function saveUpdates(_0x2457eb,_0x245be4){return function(_0x2785b0){if(_0x2785b0){return _0x2785b0['update'](_0x2457eb)['then'](function(_0x3bdaff){return _0x3bdaff;});}return null;};}function removeEntity(_0x534054,_0x39fa64){return function(_0x5997d4){if(_0x5997d4){return _0x5997d4[_0x5af6('0x25')]()[_0x5af6('0x26')](function(){_0x534054[_0x5af6('0x1b')](0xcc)[_0x5af6('0x1c')]();});}};}function handleEntityNotFound(_0x3d604b,_0x46cff3){return function(_0x370475){if(!_0x370475){_0x3d604b[_0x5af6('0x1a')](0x194);}return _0x370475;};}function handleError(_0x2c340f,_0x1c31a0){_0x1c31a0=_0x1c31a0||0x1f4;return function(_0x35eed7){logger['error'](_0x35eed7['stack']);if(_0x35eed7['name']){delete _0x35eed7[_0x5af6('0x27')];}_0x2c340f['status'](_0x1c31a0)['send'](_0x35eed7);};}exports[_0x5af6('0x28')]=function(_0x47e0ed,_0x8b669f){var _0x35973f={},_0x2a3c51={},_0x2f8ff2={'count':0x0,'rows':[]};var _0x3d52c3=_[_0x5af6('0x29')](db['FreshsalesField'][_0x5af6('0x2a')],function(_0x342489){return{'name':_0x342489['fieldName'],'type':_0x342489['type'][_0x5af6('0x2b')]};});_0x2a3c51[_0x5af6('0x2c')]=_['map'](_0x3d52c3,_0x5af6('0x27'));_0x2a3c51[_0x5af6('0x2d')]=_[_0x5af6('0x2e')](_0x47e0ed[_0x5af6('0x2d')]);_0x2a3c51[_0x5af6('0x2f')]=_['intersection'](_0x2a3c51[_0x5af6('0x2c')],_0x2a3c51[_0x5af6('0x2d')]);_0x35973f[_0x5af6('0x30')]=_['intersection'](_0x2a3c51[_0x5af6('0x2c')],qs[_0x5af6('0x31')](_0x47e0ed[_0x5af6('0x2d')][_0x5af6('0x31')]));_0x35973f[_0x5af6('0x30')]=_0x35973f['attributes'][_0x5af6('0x32')]?_0x35973f['attributes']:_0x2a3c51[_0x5af6('0x2c')];if(!_0x47e0ed['query'][_0x5af6('0x33')](_0x5af6('0x34'))){_0x35973f[_0x5af6('0x1e')]=qs[_0x5af6('0x1e')](_0x47e0ed[_0x5af6('0x2d')][_0x5af6('0x1e')]);_0x35973f['offset']=qs[_0x5af6('0x20')](_0x47e0ed[_0x5af6('0x2d')][_0x5af6('0x20')]);}_0x35973f['order']=qs[_0x5af6('0x35')](_0x47e0ed['query'][_0x5af6('0x35')]);_0x35973f[_0x5af6('0x36')]=qs['filters'](_[_0x5af6('0x37')](_0x47e0ed[_0x5af6('0x2d')],_0x2a3c51[_0x5af6('0x2f')]),_0x3d52c3);if(_0x47e0ed[_0x5af6('0x2d')][_0x5af6('0x38')]){_0x35973f[_0x5af6('0x36')]=_[_0x5af6('0x39')](_0x35973f['where'],{'$or':_['map'](_0x3d52c3,function(_0x3c13d){if(_0x3c13d['type']!==_0x5af6('0x3a')){var _0x3016c3={};_0x3016c3[_0x3c13d[_0x5af6('0x27')]]={'$like':'%'+_0x47e0ed[_0x5af6('0x2d')][_0x5af6('0x38')]+'%'};return _0x3016c3;}})});}_0x35973f=_['merge']({},_0x35973f,_0x47e0ed[_0x5af6('0x3b')]);var _0x56cd9d={'where':_0x35973f[_0x5af6('0x36')]};return db['FreshsalesField'][_0x5af6('0x1f')](_0x56cd9d)[_0x5af6('0x26')](function(_0xc7c6c5){_0x2f8ff2[_0x5af6('0x1f')]=_0xc7c6c5;if(_0x47e0ed['query'][_0x5af6('0x3c')]){_0x35973f['include']=[{'all':!![]}];}return db[_0x5af6('0x3d')][_0x5af6('0x3e')](_0x35973f);})['then'](function(_0x2f4dab){_0x2f8ff2[_0x5af6('0x3f')]=_0x2f4dab;return _0x2f8ff2;})['then'](respondWithFilteredResult(_0x8b669f,_0x35973f))['catch'](handleError(_0x8b669f,null));};exports[_0x5af6('0x40')]=function(_0xf558a1,_0x224fc4){var _0xbf5445={'raw':!![],'where':{'id':_0xf558a1[_0x5af6('0x41')]['id']}},_0x47328f={};_0x47328f[_0x5af6('0x2c')]=_[_0x5af6('0x2e')](db['FreshsalesField']['rawAttributes']);_0x47328f[_0x5af6('0x2d')]=_[_0x5af6('0x2e')](_0xf558a1[_0x5af6('0x2d')]);_0x47328f['filters']=_[_0x5af6('0x42')](_0x47328f[_0x5af6('0x2c')],_0x47328f[_0x5af6('0x2d')]);_0xbf5445[_0x5af6('0x30')]=_[_0x5af6('0x42')](_0x47328f[_0x5af6('0x2c')],qs[_0x5af6('0x31')](_0xf558a1[_0x5af6('0x2d')][_0x5af6('0x31')]));_0xbf5445[_0x5af6('0x30')]=_0xbf5445[_0x5af6('0x30')]['length']?_0xbf5445['attributes']:_0x47328f['model'];if(_0xf558a1[_0x5af6('0x2d')][_0x5af6('0x3c')]){_0xbf5445[_0x5af6('0x43')]=[{'all':!![]}];}_0xbf5445=_[_0x5af6('0x39')]({},_0xbf5445,_0xf558a1['options']);return db[_0x5af6('0x3d')]['find'](_0xbf5445)[_0x5af6('0x26')](handleEntityNotFound(_0x224fc4,null))['then'](respondWithResult(_0x224fc4,null))[_0x5af6('0x44')](handleError(_0x224fc4,null));};exports[_0x5af6('0x45')]=function(_0x2634c9,_0xc5c8c6){return db[_0x5af6('0x3d')]['create'](_0x2634c9[_0x5af6('0x46')],{})[_0x5af6('0x26')](respondWithResult(_0xc5c8c6,0xc9))[_0x5af6('0x44')](handleError(_0xc5c8c6,null));};exports[_0x5af6('0x47')]=function(_0x19b29c,_0x1839be){if(_0x19b29c[_0x5af6('0x46')]['id']){delete _0x19b29c[_0x5af6('0x46')]['id'];}return db[_0x5af6('0x3d')][_0x5af6('0x48')]({'where':{'id':_0x19b29c['params']['id']}})[_0x5af6('0x26')](handleEntityNotFound(_0x1839be,null))['then'](saveUpdates(_0x19b29c[_0x5af6('0x46')],null))[_0x5af6('0x26')](respondWithResult(_0x1839be,null))[_0x5af6('0x44')](handleError(_0x1839be,null));};exports[_0x5af6('0x25')]=function(_0x1d3874,_0x23299d){return db[_0x5af6('0x3d')]['find']({'where':{'id':_0x1d3874['params']['id']}})[_0x5af6('0x26')](handleEntityNotFound(_0x23299d,null))[_0x5af6('0x26')](removeEntity(_0x23299d,null))['catch'](handleError(_0x23299d,null));}; \ No newline at end of file +var _0xb1d6=['to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','filters','intersection','fields','length','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce'];(function(_0x3d60e4,_0x2a4db3){var _0x5c927d=function(_0x500232){while(--_0x500232){_0x3d60e4['push'](_0x3d60e4['shift']());}};_0x5c927d(++_0x2a4db3);}(_0xb1d6,0x152));var _0x6b1d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1d6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x6b1d('0x0'));var rimraf=require(_0x6b1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b1d('0x2'));var BPromise=require(_0x6b1d('0x3'));var Mustache=require(_0x6b1d('0x4'));var util=require(_0x6b1d('0x5'));var path=require(_0x6b1d('0x6'));var sox=require(_0x6b1d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b1d('0x8'));var _=require('lodash');var squel=require(_0x6b1d('0x9'));var crypto=require(_0x6b1d('0xa'));var jsforce=require(_0x6b1d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6b1d('0xc'));var querystring=require('querystring');var Papa=require(_0x6b1d('0xd'));var Redis=require('ioredis');var authService=require(_0x6b1d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6b1d('0xf'));var hardwareService=require(_0x6b1d('0x10'));var logger=require(_0x6b1d('0x11'))(_0x6b1d('0x12'));var utils=require(_0x6b1d('0x13'));var config=require(_0x6b1d('0x14'));var licenseUtil=require(_0x6b1d('0x15'));var db=require(_0x6b1d('0x16'))['db'];function respondWithStatusCode(_0x3b20dc,_0x304aba){_0x304aba=_0x304aba||0xcc;return function(_0xdd6685){if(_0xdd6685){return _0x3b20dc[_0x6b1d('0x17')](_0x304aba);}return _0x3b20dc[_0x6b1d('0x18')](_0x304aba)[_0x6b1d('0x19')]();};}function respondWithResult(_0x4eefec,_0x15e400){_0x15e400=_0x15e400||0xc8;return function(_0x49a61f){if(_0x49a61f){return _0x4eefec['status'](_0x15e400)[_0x6b1d('0x1a')](_0x49a61f);}};}function respondWithFilteredResult(_0x11d89e,_0x56c856){return function(_0x5e3948){if(_0x5e3948){var _0x1a4b2c=typeof _0x56c856['offset']===_0x6b1d('0x1b')&&typeof _0x56c856[_0x6b1d('0x1c')]==='undefined';var _0x36ee02=_0x5e3948[_0x6b1d('0x1d')];var _0x3d19be=_0x1a4b2c?0x0:_0x56c856[_0x6b1d('0x1e')];var _0x2bd16b=_0x1a4b2c?_0x5e3948['count']:_0x56c856[_0x6b1d('0x1e')]+_0x56c856['limit'];var _0x2364ad;if(_0x2bd16b>=_0x36ee02){_0x2bd16b=_0x36ee02;_0x2364ad=0xc8;}else{_0x2364ad=0xce;}_0x11d89e[_0x6b1d('0x18')](_0x2364ad);return _0x11d89e['set'](_0x6b1d('0x1f'),_0x3d19be+'-'+_0x2bd16b+'/'+_0x36ee02)[_0x6b1d('0x1a')](_0x5e3948);}return null;};}function patchUpdates(_0x4129e8){return function(_0x241e66){try{jsonpatch[_0x6b1d('0x20')](_0x241e66,_0x4129e8,!![]);}catch(_0x305544){return BPromise[_0x6b1d('0x21')](_0x305544);}return _0x241e66['save']();};}function saveUpdates(_0x1df1ac,_0x1471b0){return function(_0x55cd2f){if(_0x55cd2f){return _0x55cd2f[_0x6b1d('0x22')](_0x1df1ac)[_0x6b1d('0x23')](function(_0x2485c1){return _0x2485c1;});}return null;};}function removeEntity(_0x3ee683,_0x1215df){return function(_0x4f1d59){if(_0x4f1d59){return _0x4f1d59[_0x6b1d('0x24')]()[_0x6b1d('0x23')](function(){_0x3ee683['status'](0xcc)[_0x6b1d('0x19')]();});}};}function handleEntityNotFound(_0x5b6f72,_0x117558){return function(_0x446c86){if(!_0x446c86){_0x5b6f72[_0x6b1d('0x17')](0x194);}return _0x446c86;};}function handleError(_0x471015,_0x3894de){_0x3894de=_0x3894de||0x1f4;return function(_0x27fc43){logger[_0x6b1d('0x25')](_0x27fc43[_0x6b1d('0x26')]);if(_0x27fc43[_0x6b1d('0x27')]){delete _0x27fc43['name'];}_0x471015[_0x6b1d('0x18')](_0x3894de)['send'](_0x27fc43);};}exports[_0x6b1d('0x28')]=function(_0x13394c,_0x302749){var _0x5ace9e={},_0x51c7f6={},_0x3f6261={'count':0x0,'rows':[]};var _0x2bb58b=_[_0x6b1d('0x29')](db[_0x6b1d('0x2a')][_0x6b1d('0x2b')],function(_0x4ab79f){return{'name':_0x4ab79f['fieldName'],'type':_0x4ab79f[_0x6b1d('0x2c')][_0x6b1d('0x2d')]};});_0x51c7f6[_0x6b1d('0x2e')]=_[_0x6b1d('0x29')](_0x2bb58b,'name');_0x51c7f6[_0x6b1d('0x2f')]=_['keys'](_0x13394c[_0x6b1d('0x2f')]);_0x51c7f6[_0x6b1d('0x30')]=_['intersection'](_0x51c7f6[_0x6b1d('0x2e')],_0x51c7f6[_0x6b1d('0x2f')]);_0x5ace9e['attributes']=_[_0x6b1d('0x31')](_0x51c7f6[_0x6b1d('0x2e')],qs[_0x6b1d('0x32')](_0x13394c[_0x6b1d('0x2f')]['fields']));_0x5ace9e['attributes']=_0x5ace9e['attributes'][_0x6b1d('0x33')]?_0x5ace9e[_0x6b1d('0x34')]:_0x51c7f6[_0x6b1d('0x2e')];if(!_0x13394c['query']['hasOwnProperty'](_0x6b1d('0x35'))){_0x5ace9e['limit']=qs[_0x6b1d('0x1c')](_0x13394c[_0x6b1d('0x2f')][_0x6b1d('0x1c')]);_0x5ace9e[_0x6b1d('0x1e')]=qs[_0x6b1d('0x1e')](_0x13394c[_0x6b1d('0x2f')][_0x6b1d('0x1e')]);}_0x5ace9e['order']=qs[_0x6b1d('0x36')](_0x13394c[_0x6b1d('0x2f')][_0x6b1d('0x36')]);_0x5ace9e[_0x6b1d('0x37')]=qs['filters'](_['pick'](_0x13394c['query'],_0x51c7f6['filters']),_0x2bb58b);if(_0x13394c[_0x6b1d('0x2f')][_0x6b1d('0x38')]){_0x5ace9e[_0x6b1d('0x37')]=_[_0x6b1d('0x39')](_0x5ace9e[_0x6b1d('0x37')],{'$or':_[_0x6b1d('0x29')](_0x2bb58b,function(_0x4fcbb4){if(_0x4fcbb4['type']!==_0x6b1d('0x3a')){var _0x13abff={};_0x13abff[_0x4fcbb4['name']]={'$like':'%'+_0x13394c[_0x6b1d('0x2f')][_0x6b1d('0x38')]+'%'};return _0x13abff;}})});}_0x5ace9e=_['merge']({},_0x5ace9e,_0x13394c[_0x6b1d('0x3b')]);var _0x425542={'where':_0x5ace9e[_0x6b1d('0x37')]};return db[_0x6b1d('0x2a')][_0x6b1d('0x1d')](_0x425542)[_0x6b1d('0x23')](function(_0x51b89d){_0x3f6261['count']=_0x51b89d;if(_0x13394c[_0x6b1d('0x2f')]['includeAll']){_0x5ace9e[_0x6b1d('0x3c')]=[{'all':!![]}];}return db[_0x6b1d('0x2a')][_0x6b1d('0x3d')](_0x5ace9e);})[_0x6b1d('0x23')](function(_0x380bce){_0x3f6261[_0x6b1d('0x3e')]=_0x380bce;return _0x3f6261;})['then'](respondWithFilteredResult(_0x302749,_0x5ace9e))[_0x6b1d('0x3f')](handleError(_0x302749,null));};exports[_0x6b1d('0x40')]=function(_0x2edc2a,_0x100439){var _0x42e485={'raw':!![],'where':{'id':_0x2edc2a['params']['id']}},_0x2f4a33={};_0x2f4a33['model']=_[_0x6b1d('0x41')](db['FreshsalesField']['rawAttributes']);_0x2f4a33[_0x6b1d('0x2f')]=_['keys'](_0x2edc2a['query']);_0x2f4a33[_0x6b1d('0x30')]=_[_0x6b1d('0x31')](_0x2f4a33[_0x6b1d('0x2e')],_0x2f4a33[_0x6b1d('0x2f')]);_0x42e485[_0x6b1d('0x34')]=_[_0x6b1d('0x31')](_0x2f4a33[_0x6b1d('0x2e')],qs[_0x6b1d('0x32')](_0x2edc2a[_0x6b1d('0x2f')][_0x6b1d('0x32')]));_0x42e485['attributes']=_0x42e485[_0x6b1d('0x34')][_0x6b1d('0x33')]?_0x42e485[_0x6b1d('0x34')]:_0x2f4a33[_0x6b1d('0x2e')];if(_0x2edc2a[_0x6b1d('0x2f')]['includeAll']){_0x42e485[_0x6b1d('0x3c')]=[{'all':!![]}];}_0x42e485=_[_0x6b1d('0x39')]({},_0x42e485,_0x2edc2a[_0x6b1d('0x3b')]);return db[_0x6b1d('0x2a')][_0x6b1d('0x42')](_0x42e485)['then'](handleEntityNotFound(_0x100439,null))['then'](respondWithResult(_0x100439,null))['catch'](handleError(_0x100439,null));};exports[_0x6b1d('0x43')]=function(_0x3ca7ac,_0x20980c){return db[_0x6b1d('0x2a')][_0x6b1d('0x43')](_0x3ca7ac[_0x6b1d('0x44')],{})[_0x6b1d('0x23')](respondWithResult(_0x20980c,0xc9))[_0x6b1d('0x3f')](handleError(_0x20980c,null));};exports[_0x6b1d('0x22')]=function(_0xfec39d,_0x1fd214){if(_0xfec39d[_0x6b1d('0x44')]['id']){delete _0xfec39d[_0x6b1d('0x44')]['id'];}return db[_0x6b1d('0x2a')][_0x6b1d('0x42')]({'where':{'id':_0xfec39d['params']['id']}})[_0x6b1d('0x23')](handleEntityNotFound(_0x1fd214,null))[_0x6b1d('0x23')](saveUpdates(_0xfec39d['body'],null))['then'](respondWithResult(_0x1fd214,null))[_0x6b1d('0x3f')](handleError(_0x1fd214,null));};exports[_0x6b1d('0x24')]=function(_0x243a9d,_0x29021d){return db[_0x6b1d('0x2a')][_0x6b1d('0x42')]({'where':{'id':_0x243a9d[_0x6b1d('0x45')]['id']}})[_0x6b1d('0x23')](handleEntityNotFound(_0x29021d,null))[_0x6b1d('0x23')](removeEntity(_0x29021d,null))[_0x6b1d('0x3f')](handleError(_0x29021d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3e1eea0..2350870 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 _0xeb3b=['../../config/logger','api','moment','path','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5418ad,_0x40742f){_0x5418ad=_0x5418ad-0x0;var _0x2cae56=_0xeb3b[_0x5418ad];return _0x2cae56;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xbeb3('0xb'),_0xbeb3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11c1=['path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x218100,_0x1fa0fe){var _0xbe5920=function(_0x579d1c){while(--_0x579d1c){_0x218100['push'](_0x218100['shift']());}};_0xbe5920(++_0x1fa0fe);}(_0x11c1,0x1cb));var _0x111c=function(_0x3cfd6a,_0x4ad515){_0x3cfd6a=_0x3cfd6a-0x0;var _0x18ef8c=_0x11c1[_0x3cfd6a];return _0x18ef8c;};'use strict';var _=require(_0x111c('0x0'));var util=require('util');var logger=require(_0x111c('0x1'))(_0x111c('0x2'));var moment=require(_0x111c('0x3'));var BPromise=require(_0x111c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x111c('0x5'));var rimraf=require(_0x111c('0x6'));var config=require(_0x111c('0x7'));var attributes=require(_0x111c('0x8'));module[_0x111c('0x9')]=function(_0x190036,_0x487ac7){return _0x190036[_0x111c('0xa')](_0x111c('0xb'),attributes,{'tableName':_0x111c('0xc'),'paranoid':![],'indexes':[{'name':_0x111c('0xd'),'fields':[_0x111c('0xe'),_0x111c('0xf')],'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 2b1c768..8f4ef93 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 _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(_0x445ad9,_0x14ffcf){var _0x18c778=function(_0xc95684){while(--_0xc95684){_0x445ad9['push'](_0x445ad9['shift']());}};_0x18c778(++_0x14ffcf);}(_0x1261,0x144));var _0x1126=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x1261[_0x32efcb];return _0x1dae88;};'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 +var _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x2cde74,_0x55cf68){var _0x39ee49=function(_0x1e312e){while(--_0x1e312e){_0x2cde74['push'](_0x2cde74['shift']());}};_0x39ee49(++_0x55cf68);}(_0xd8fb,0x99));var _0xbd8f=function(_0xfa1b3c,_0x2ef9a5){_0xfa1b3c=_0xfa1b3c-0x0;var _0x4f60ad=_0xd8fb[_0xfa1b3c];return _0x4f60ad;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 54f2402..de51e34 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27f2f8,_0xd4c6e9){var _0x4a99ff=function(_0xf0a414){while(--_0xf0a414){_0x27f2f8['push'](_0x27f2f8['shift']());}};_0x4a99ff(++_0xd4c6e9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3efa4d,_0xb6beb8){var _0x18b2d6=function(_0x36b9c7){while(--_0x36b9c7){_0x3efa4d['push'](_0x3efa4d['shift']());}};_0x18b2d6(++_0xb6beb8);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 968590d..16a1f03 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 _0x72a1=['username','integrationTab','exports','STRING'];(function(_0x44216f,_0x187779){var _0x3b6d3c=function(_0x391cee){while(--_0x391cee){_0x44216f['push'](_0x44216f['shift']());}};_0x3b6d3c(++_0x187779);}(_0x72a1,0x1ce));var _0x172a=function(_0x46909c,_0x2508c0){_0x46909c=_0x46909c-0x0;var _0x1d80aa=_0x72a1[_0x46909c];return _0x1d80aa;};'use strict';var Sequelize=require('sequelize');module[_0x172a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x172a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x172a('0x2')},'remoteUri':{'type':Sequelize[_0x172a('0x1')]},'password':{'type':Sequelize[_0x172a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x172a('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x172a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x172a('0x3'),'newTab'),'defaultValue':_0x172a('0x3')}}; \ No newline at end of file +var _0x66d8=['integrationTab','sequelize','exports','STRING','username','ENUM','newTab'];(function(_0x55bb7a,_0x4293c8){var _0x37300f=function(_0x9b0826){while(--_0x9b0826){_0x55bb7a['push'](_0x55bb7a['shift']());}};_0x37300f(++_0x4293c8);}(_0x66d8,0x1c1));var _0x866d=function(_0x41d9e7,_0x33ef4a){_0x41d9e7=_0x41d9e7-0x0;var _0x282c36=_0x66d8[_0x41d9e7];return _0x282c36;};'use strict';var Sequelize=require(_0x866d('0x0'));module[_0x866d('0x1')]={'name':{'type':Sequelize[_0x866d('0x2')]},'description':{'type':Sequelize[_0x866d('0x2')]},'username':{'type':Sequelize[_0x866d('0x2')],'unique':_0x866d('0x3')},'remoteUri':{'type':Sequelize[_0x866d('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x866d('0x2')]},'clientSecret':{'type':Sequelize[_0x866d('0x2')]},'securityToken':{'type':Sequelize[_0x866d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x866d('0x4')]('integrationTab',_0x866d('0x5')),'defaultValue':_0x866d('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0f1f09b..d8d73f3 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 _0x3218=['filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','merge','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','true','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x3218,0x1b6));var _0x8321=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x3218[_0x53fe97];return _0x5c49a2;};'use strict';var emlformat=require(_0x8321('0x0'));var rimraf=require(_0x8321('0x1'));var zipdir=require(_0x8321('0x2'));var jsonpatch=require(_0x8321('0x3'));var rp=require(_0x8321('0x4'));var moment=require(_0x8321('0x5'));var BPromise=require(_0x8321('0x6'));var Mustache=require(_0x8321('0x7'));var util=require(_0x8321('0x8'));var path=require(_0x8321('0x9'));var sox=require(_0x8321('0xa'));var csv=require('to-csv');var ejs=require(_0x8321('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8321('0xc'));var squel=require(_0x8321('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8321('0xe'));var toCsv=require(_0x8321('0xf'));var querystring=require(_0x8321('0x10'));var Papa=require(_0x8321('0x11'));var Redis=require(_0x8321('0x12'));var authService=require(_0x8321('0x13'));var qs=require(_0x8321('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8321('0x15'));var utils=require(_0x8321('0x16'));var config=require(_0x8321('0x17'));var licenseUtil=require(_0x8321('0x18'));var db=require(_0x8321('0x19'))['db'];var integrations=require(_0x8321('0x1a'));function respondWithStatusCode(_0x3b0ce3,_0x15a4cc){_0x15a4cc=_0x15a4cc||0xcc;return function(_0x131a33){if(_0x131a33){return _0x3b0ce3[_0x8321('0x1b')](_0x15a4cc);}return _0x3b0ce3[_0x8321('0x1c')](_0x15a4cc)[_0x8321('0x1d')]();};}function respondWithResult(_0x32c11d,_0xfeb416){_0xfeb416=_0xfeb416||0xc8;return function(_0x4bb659){if(_0x4bb659){return _0x32c11d['status'](_0xfeb416)[_0x8321('0x1e')](_0x4bb659);}};}function respondWithFilteredResult(_0x2a2a81,_0x29e246){return function(_0xea8026){if(_0xea8026){var _0x34eb13=typeof _0x29e246['offset']===_0x8321('0x1f')&&typeof _0x29e246[_0x8321('0x20')]===_0x8321('0x1f');var _0x43ce3e=_0xea8026[_0x8321('0x21')];var _0x3d8838=_0x34eb13?0x0:_0x29e246['offset'];var _0x47428e=_0x34eb13?_0xea8026[_0x8321('0x21')]:_0x29e246[_0x8321('0x22')]+_0x29e246['limit'];var _0x22861b;if(_0x47428e>=_0x43ce3e){_0x47428e=_0x43ce3e;_0x22861b=0xc8;}else{_0x22861b=0xce;}_0x2a2a81[_0x8321('0x1c')](_0x22861b);return _0x2a2a81['set']('Content-Range',_0x3d8838+'-'+_0x47428e+'/'+_0x43ce3e)[_0x8321('0x1e')](_0xea8026);}return null;};}function patchUpdates(_0x350f4c){return function(_0xafa471){try{jsonpatch[_0x8321('0x23')](_0xafa471,_0x350f4c,!![]);}catch(_0x45015a){return BPromise[_0x8321('0x24')](_0x45015a);}return _0xafa471[_0x8321('0x25')]();};}function saveUpdates(_0x10a113,_0x496913){return function(_0x4f3b89){if(_0x4f3b89){return _0x4f3b89[_0x8321('0x26')](_0x10a113)[_0x8321('0x27')](function(_0x10007d){return _0x10007d;});}return null;};}function removeEntity(_0x441101,_0x11d24d){return function(_0x55ca1c){if(_0x55ca1c){return _0x55ca1c[_0x8321('0x28')]()[_0x8321('0x27')](function(){_0x441101[_0x8321('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2976ae,_0x2a0fb1){return function(_0x205e27){if(!_0x205e27){_0x2976ae[_0x8321('0x1b')](0x194);}return _0x205e27;};}function handleError(_0x17d520,_0x53bf03){_0x53bf03=_0x53bf03||0x1f4;return function(_0x3b9496){logger[_0x8321('0x29')](_0x3b9496[_0x8321('0x2a')]);if(_0x3b9496['name']){delete _0x3b9496[_0x8321('0x2b')];}_0x17d520[_0x8321('0x1c')](_0x53bf03)[_0x8321('0x2c')](_0x3b9496);};}exports[_0x8321('0x2d')]=function(_0x159eb5,_0x95f2bc){var _0x1928b4={},_0x171382={},_0x449a01={'count':0x0,'rows':[]};var _0x33e7ef=_[_0x8321('0x2e')](db[_0x8321('0x2f')][_0x8321('0x30')],function(_0x4c2384){return{'name':_0x4c2384[_0x8321('0x31')],'type':_0x4c2384[_0x8321('0x32')][_0x8321('0x33')]};});_0x171382['model']=_['map'](_0x33e7ef,'name');_0x171382[_0x8321('0x34')]=_[_0x8321('0x35')](_0x159eb5['query']);_0x171382[_0x8321('0x36')]=_['intersection'](_0x171382[_0x8321('0x37')],_0x171382[_0x8321('0x34')]);_0x1928b4['attributes']=_['intersection'](_0x171382[_0x8321('0x37')],qs[_0x8321('0x38')](_0x159eb5[_0x8321('0x34')]['fields']));_0x1928b4[_0x8321('0x39')]=_0x1928b4[_0x8321('0x39')][_0x8321('0x3a')]?_0x1928b4['attributes']:_0x171382[_0x8321('0x37')];if(!_0x159eb5[_0x8321('0x34')][_0x8321('0x3b')]('nolimit')){_0x1928b4[_0x8321('0x20')]=qs['limit'](_0x159eb5[_0x8321('0x34')][_0x8321('0x20')]);_0x1928b4[_0x8321('0x22')]=qs['offset'](_0x159eb5[_0x8321('0x34')][_0x8321('0x22')]);}_0x1928b4[_0x8321('0x3c')]=qs[_0x8321('0x3d')](_0x159eb5[_0x8321('0x34')][_0x8321('0x3d')]);_0x1928b4[_0x8321('0x3e')]=qs[_0x8321('0x36')](_[_0x8321('0x3f')](_0x159eb5[_0x8321('0x34')],_0x171382[_0x8321('0x36')]),_0x33e7ef);if(_0x159eb5['query'][_0x8321('0x40')]){_0x1928b4[_0x8321('0x3e')]=_['merge'](_0x1928b4[_0x8321('0x3e')],{'$or':_[_0x8321('0x2e')](_0x33e7ef,function(_0x38aeae){if(_0x38aeae[_0x8321('0x32')]!==_0x8321('0x41')){var _0x310378={};_0x310378[_0x38aeae[_0x8321('0x2b')]]={'$like':'%'+_0x159eb5[_0x8321('0x34')][_0x8321('0x40')]+'%'};return _0x310378;}})});}_0x1928b4=_['merge']({},_0x1928b4,_0x159eb5[_0x8321('0x42')]);var _0x148f0a={'where':_0x1928b4['where']};return db[_0x8321('0x2f')]['count'](_0x148f0a)[_0x8321('0x27')](function(_0xfb35bd){_0x449a01['count']=_0xfb35bd;if(_0x159eb5[_0x8321('0x34')][_0x8321('0x43')]){_0x1928b4[_0x8321('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8321('0x45')](_0x1928b4);})[_0x8321('0x27')](function(_0x5338bb){_0x449a01[_0x8321('0x46')]=_0x5338bb;return _0x449a01;})['then'](respondWithFilteredResult(_0x95f2bc,_0x1928b4))[_0x8321('0x47')](handleError(_0x95f2bc,null));};exports[_0x8321('0x48')]=function(_0x3ee1ed,_0x3cb181){var _0x55e075={'raw':![],'where':{'id':_0x3ee1ed[_0x8321('0x49')]['id']}},_0x4a1e8b={};_0x4a1e8b[_0x8321('0x37')]=_['keys'](db['SalesforceAccount'][_0x8321('0x30')]);_0x4a1e8b['query']=_[_0x8321('0x35')](_0x3ee1ed['query']);_0x4a1e8b['filters']=_[_0x8321('0x4a')](_0x4a1e8b[_0x8321('0x37')],_0x4a1e8b['query']);_0x55e075[_0x8321('0x39')]=_[_0x8321('0x4a')](_0x4a1e8b[_0x8321('0x37')],qs[_0x8321('0x38')](_0x3ee1ed[_0x8321('0x34')][_0x8321('0x38')]));_0x55e075[_0x8321('0x39')]=_0x55e075[_0x8321('0x39')][_0x8321('0x3a')]?_0x55e075[_0x8321('0x39')]:_0x4a1e8b['model'];if(_0x3ee1ed[_0x8321('0x34')][_0x8321('0x43')]){_0x55e075[_0x8321('0x44')]=[{'all':!![]}];}_0x55e075=_[_0x8321('0x4b')]({},_0x55e075,_0x3ee1ed[_0x8321('0x42')]);return db[_0x8321('0x2f')][_0x8321('0x4c')](_0x55e075)['then'](handleEntityNotFound(_0x3cb181,null))['then'](respondWithResult(_0x3cb181,null))[_0x8321('0x47')](handleError(_0x3cb181,null));};exports[_0x8321('0x4d')]=function(_0x16ed25,_0xb82f7){return db[_0x8321('0x2f')][_0x8321('0x4d')](_0x16ed25[_0x8321('0x4e')],{})[_0x8321('0x27')](respondWithResult(_0xb82f7,0xc9))[_0x8321('0x47')](handleError(_0xb82f7,null));};exports[_0x8321('0x26')]=function(_0xad2c43,_0x1a49d6){if(_0xad2c43[_0x8321('0x4e')]['id']){delete _0xad2c43['body']['id'];}return db['SalesforceAccount'][_0x8321('0x4c')]({'where':{'id':_0xad2c43['params']['id']}})[_0x8321('0x27')](handleEntityNotFound(_0x1a49d6,null))[_0x8321('0x27')](saveUpdates(_0xad2c43[_0x8321('0x4e')],null))[_0x8321('0x27')](respondWithResult(_0x1a49d6,null))[_0x8321('0x47')](handleError(_0x1a49d6,null));};exports[_0x8321('0x28')]=function(_0x1ffbd7,_0x43f783){return db[_0x8321('0x2f')][_0x8321('0x4c')]({'where':{'id':_0x1ffbd7['params']['id']}})[_0x8321('0x27')](handleEntityNotFound(_0x43f783,null))['then'](removeEntity(_0x43f783,null))[_0x8321('0x47')](handleError(_0x43f783,null));};exports[_0x8321('0x4f')]=function(_0x409b02,_0x13d6e7,_0x3ec75b){var _0x106bdb={};var _0x57dc44={};var _0x3a4871;var _0x30f0e7;return db['SalesforceAccount'][_0x8321('0x50')]({'where':{'id':_0x409b02[_0x8321('0x49')]['id']}})['then'](handleEntityNotFound(_0x13d6e7,null))[_0x8321('0x27')](function(_0x158d46){if(_0x158d46){_0x3a4871=_0x158d46;_0x57dc44[_0x8321('0x37')]=_[_0x8321('0x35')](db[_0x8321('0x51')][_0x8321('0x30')]);_0x57dc44[_0x8321('0x34')]=_[_0x8321('0x35')](_0x409b02['query']);_0x57dc44[_0x8321('0x36')]=_[_0x8321('0x4a')](_0x57dc44[_0x8321('0x37')],_0x57dc44[_0x8321('0x34')]);_0x106bdb['attributes']=_[_0x8321('0x4a')](_0x57dc44[_0x8321('0x37')],qs[_0x8321('0x38')](_0x409b02['query'][_0x8321('0x38')]));_0x106bdb['attributes']=_0x106bdb[_0x8321('0x39')][_0x8321('0x3a')]?_0x106bdb[_0x8321('0x39')]:_0x57dc44['model'];_0x106bdb[_0x8321('0x3c')]=qs[_0x8321('0x3d')](_0x409b02[_0x8321('0x34')]['sort']);_0x106bdb[_0x8321('0x3e')]=qs[_0x8321('0x36')](_[_0x8321('0x3f')](_0x409b02[_0x8321('0x34')],_0x57dc44[_0x8321('0x36')]));if(_0x409b02[_0x8321('0x34')][_0x8321('0x40')]){_0x106bdb['where']=_[_0x8321('0x4b')](_0x106bdb['where'],{'$or':_[_0x8321('0x2e')](_0x106bdb['attributes'],function(_0x270c20){var _0x197df6={};_0x197df6[_0x270c20]={'$like':'%'+_0x409b02[_0x8321('0x34')][_0x8321('0x40')]+'%'};return _0x197df6;})});}_0x106bdb=_[_0x8321('0x4b')]({},_0x106bdb,_0x409b02[_0x8321('0x42')]);return _0x3a4871[_0x8321('0x4f')](_0x106bdb);}})[_0x8321('0x27')](function(_0x21c989){if(_0x21c989){_0x30f0e7=_0x21c989['length'];if(!_0x409b02['query'][_0x8321('0x3b')](_0x8321('0x52'))){_0x106bdb[_0x8321('0x20')]=qs['limit'](_0x409b02[_0x8321('0x34')][_0x8321('0x20')]);_0x106bdb[_0x8321('0x22')]=qs[_0x8321('0x22')](_0x409b02['query'][_0x8321('0x22')]);}return _0x3a4871[_0x8321('0x4f')](_0x106bdb);}})[_0x8321('0x27')](function(_0x47c370){if(_0x47c370){return _0x47c370?{'count':_0x30f0e7,'rows':_0x47c370}:null;}})[_0x8321('0x27')](respondWithResult(_0x13d6e7,null))[_0x8321('0x47')](handleError(_0x13d6e7,null));};exports[_0x8321('0x53')]=function(_0x3cecef,_0x29d8ed,_0x3c52f9){if(_0x3cecef['body']['id']){delete _0x3cecef[_0x8321('0x4e')]['id'];}return db[_0x8321('0x2f')][_0x8321('0x50')]({'where':{'id':_0x3cecef[_0x8321('0x49')]['id']}})[_0x8321('0x27')](handleEntityNotFound(_0x29d8ed,null))[_0x8321('0x27')](function(_0xf00892){if(_0xf00892){_0x3cecef['body']['AccountId']=_0xf00892['id'];_0x3cecef[_0x8321('0x4e')][_0x8321('0x54')]=integrations[_0x8321('0x55')](_0x3cecef[_0x8321('0x4e')][_0x8321('0x56')],_0x3cecef[_0x8321('0x4e')][_0x8321('0x32')]);_0x3cecef['body'][_0x8321('0x57')]=integrations['getDescriptions'](_0x3cecef[_0x8321('0x4e')][_0x8321('0x56')],_0x3cecef[_0x8321('0x4e')]['type']);return db[_0x8321('0x51')][_0x8321('0x4d')](_0x3cecef[_0x8321('0x4e')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x8321('0x58')],'as':_0x8321('0x57')}]});}return null;})[_0x8321('0x27')](respondWithResult(_0x29d8ed,null))['catch'](handleError(_0x29d8ed,null));};exports[_0x8321('0x59')]=function(_0x4e63e6,_0x4bfc90,_0x376233){var _0x15a444;var _0x2e61a6='';var _0x542bd0=_0x8321('0x5a');return db[_0x8321('0x2f')][_0x8321('0x50')]({'where':{'id':_0x4e63e6[_0x8321('0x49')]['id']},'attributes':['id','remoteUri',_0x8321('0x5b'),_0x8321('0x5c'),_0x8321('0x5d'),_0x8321('0x5e'),_0x8321('0x5f')]})[_0x8321('0x27')](handleEntityNotFound(_0x4bfc90,null))['then'](function(_0x68f980){if(_0x68f980){_0x2e61a6=_0x68f980['remoteUri'];var _0x2e9316=_0x2e61a6['slice'](-0x1);if(_0x2e9316==='/'){_0x2e61a6=_0x2e61a6['substring'](0x0,_0x2e61a6[_0x8321('0x60')](_0x2e9316));}_0x15a444=new jsforce[(_0x8321('0x61'))]({'oauth2':{'loginUrl':_0x2e61a6,'clientId':_0x68f980[_0x8321('0x5b')],'clientSecret':_0x68f980[_0x8321('0x5c')]}});return _0x15a444[_0x8321('0x62')](_0x68f980[_0x8321('0x5d')],_0x68f980[_0x8321('0x5e')][_0x8321('0x63')](_0x68f980[_0x8321('0x5f')]));}})['then'](function(_0x46101f){if(_0x46101f){if(!_[_0x8321('0x64')](_0x4e63e6[_0x8321('0x34')]['ticketType'])){_0x542bd0=_0x4e63e6[_0x8321('0x34')][_0x8321('0x65')];}return _0x15a444[_0x8321('0x66')](_0x542bd0)[_0x8321('0x67')]();}})[_0x8321('0x27')](function(_0xaf3fc5){var _0x4de229=[_0x8321('0x68'),'ActivityDate',_0x8321('0x69'),_0x8321('0x6a'),'Subject',_0x8321('0x6b')];var _0x4a1f4b=['string',_0x8321('0x6c'),_0x8321('0x6d'),_0x8321('0x6e'),_0x8321('0x6f'),_0x8321('0x70'),_0x8321('0x71')];if(_0xaf3fc5){_[_0x8321('0x72')](_0xaf3fc5[_0x8321('0x38')],function(_0xc5447){return _0x4de229[_0x8321('0x73')](_0xc5447[_0x8321('0x2b')])||!_0x4a1f4b[_0x8321('0x73')](_0xc5447[_0x8321('0x32')]);});return{'count':_0xaf3fc5['fields']['length'],'rows':_[_0x8321('0x2e')](_0xaf3fc5['fields'],function(_0x51bb32){return{'id':_0x51bb32[_0x8321('0x2b')],'name':_0x51bb32[_0x8321('0x74')],'custom':_0x51bb32['custom'],'options':_0x51bb32[_0x8321('0x75')][_0x8321('0x3a')]>0x0?_[_0x8321('0x2e')](_0x51bb32[_0x8321('0x75')],function(_0x235e62){return{'name':_0x235e62[_0x8321('0x74')],'value':_0x235e62[_0x8321('0x76')]};}):_0x51bb32['type']==_0x8321('0x6e')?[{'name':'True','value':_0x8321('0x77')},{'name':'False','value':'false'}]:[]};})};}})[_0x8321('0x27')](respondWithResult(_0x4bfc90,null))[_0x8321('0x47')](function(_0x522473){var _0x4c234f=_0x4e63e6[_0x8321('0x34')][_0x8321('0x78')]?0x1f4:_0x522473[_0x8321('0x79')]||0x1f4;logger[_0x8321('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4c234f,JSON['stringify'](_0x522473));delete _0x522473[_0x8321('0x2b')];if(_0x4c234f===0x191){_0x4c234f=0x190;}_0x4bfc90[_0x8321('0x1c')](_0x4c234f)[_0x8321('0x2c')](_0x4e63e6[_0x8321('0x34')]['test']?{'message':_0x8321('0x7a'),'statusCode':_0x522473['statusCode']}:_0x522473);});}; \ No newline at end of file +var _0x85d1=['concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','value','boolean','True','true','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','then','show','keys','merge','find','catch','create','body','params','destroy','findOne','SalesforceConfiguration','options','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x85d1,0x18b));var _0x185d=function(_0xff8595,_0x39341d){_0xff8595=_0xff8595-0x0;var _0x31e49e=_0x85d1[_0xff8595];return _0x31e49e;};'use strict';var emlformat=require(_0x185d('0x0'));var rimraf=require(_0x185d('0x1'));var zipdir=require(_0x185d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x185d('0x3'));var moment=require(_0x185d('0x4'));var BPromise=require(_0x185d('0x5'));var Mustache=require('mustache');var util=require(_0x185d('0x6'));var path=require(_0x185d('0x7'));var sox=require(_0x185d('0x8'));var csv=require(_0x185d('0x9'));var ejs=require(_0x185d('0xa'));var fs=require('fs');var fs_extra=require(_0x185d('0xb'));var _=require('lodash');var squel=require(_0x185d('0xc'));var crypto=require(_0x185d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x185d('0xe'));var toCsv=require(_0x185d('0x9'));var querystring=require(_0x185d('0xf'));var Papa=require('papaparse');var Redis=require(_0x185d('0x10'));var authService=require(_0x185d('0x11'));var qs=require(_0x185d('0x12'));var as=require(_0x185d('0x13'));var hardwareService=require(_0x185d('0x14'));var logger=require(_0x185d('0x15'))(_0x185d('0x16'));var utils=require('../../config/utils');var config=require(_0x185d('0x17'));var licenseUtil=require(_0x185d('0x18'));var db=require(_0x185d('0x19'))['db'];var integrations=require(_0x185d('0x1a'));function respondWithStatusCode(_0x39d2b6,_0x18708c){_0x18708c=_0x18708c||0xcc;return function(_0x2be256){if(_0x2be256){return _0x39d2b6[_0x185d('0x1b')](_0x18708c);}return _0x39d2b6[_0x185d('0x1c')](_0x18708c)[_0x185d('0x1d')]();};}function respondWithResult(_0x33bbec,_0x126f8a){_0x126f8a=_0x126f8a||0xc8;return function(_0x27413c){if(_0x27413c){return _0x33bbec[_0x185d('0x1c')](_0x126f8a)[_0x185d('0x1e')](_0x27413c);}};}function respondWithFilteredResult(_0x3cadb6,_0x4d0209){return function(_0x8ca99f){if(_0x8ca99f){var _0x1a89bc=typeof _0x4d0209[_0x185d('0x1f')]===_0x185d('0x20')&&typeof _0x4d0209[_0x185d('0x21')]===_0x185d('0x20');var _0x4b4207=_0x8ca99f[_0x185d('0x22')];var _0x59390e=_0x1a89bc?0x0:_0x4d0209[_0x185d('0x1f')];var _0x2d6105=_0x1a89bc?_0x8ca99f['count']:_0x4d0209[_0x185d('0x1f')]+_0x4d0209[_0x185d('0x21')];var _0x4e8f0a;if(_0x2d6105>=_0x4b4207){_0x2d6105=_0x4b4207;_0x4e8f0a=0xc8;}else{_0x4e8f0a=0xce;}_0x3cadb6[_0x185d('0x1c')](_0x4e8f0a);return _0x3cadb6[_0x185d('0x23')]('Content-Range',_0x59390e+'-'+_0x2d6105+'/'+_0x4b4207)[_0x185d('0x1e')](_0x8ca99f);}return null;};}function patchUpdates(_0x553537){return function(_0x471539){try{jsonpatch['apply'](_0x471539,_0x553537,!![]);}catch(_0x126ac7){return BPromise['reject'](_0x126ac7);}return _0x471539[_0x185d('0x24')]();};}function saveUpdates(_0x40bc9a,_0x86f9ea){return function(_0x3f6afc){if(_0x3f6afc){return _0x3f6afc[_0x185d('0x25')](_0x40bc9a)['then'](function(_0xdc76a4){return _0xdc76a4;});}return null;};}function removeEntity(_0x569de0,_0x394e9f){return function(_0x3a7bc6){if(_0x3a7bc6){return _0x3a7bc6['destroy']()['then'](function(){_0x569de0['status'](0xcc)[_0x185d('0x1d')]();});}};}function handleEntityNotFound(_0x5612dd,_0x50fc5a){return function(_0x1d8664){if(!_0x1d8664){_0x5612dd[_0x185d('0x1b')](0x194);}return _0x1d8664;};}function handleError(_0x545efd,_0x2c0544){_0x2c0544=_0x2c0544||0x1f4;return function(_0x1a708f){logger['error'](_0x1a708f[_0x185d('0x26')]);if(_0x1a708f['name']){delete _0x1a708f[_0x185d('0x27')];}_0x545efd[_0x185d('0x1c')](_0x2c0544)[_0x185d('0x28')](_0x1a708f);};}exports[_0x185d('0x29')]=function(_0x322dc7,_0xa56f8c){var _0x5770c3={},_0x392ee3={},_0x4b90db={'count':0x0,'rows':[]};var _0x3b4c21=_[_0x185d('0x2a')](db[_0x185d('0x2b')][_0x185d('0x2c')],function(_0x4a844b){return{'name':_0x4a844b['fieldName'],'type':_0x4a844b[_0x185d('0x2d')]['key']};});_0x392ee3[_0x185d('0x2e')]=_[_0x185d('0x2a')](_0x3b4c21,_0x185d('0x27'));_0x392ee3[_0x185d('0x2f')]=_['keys'](_0x322dc7['query']);_0x392ee3[_0x185d('0x30')]=_[_0x185d('0x31')](_0x392ee3[_0x185d('0x2e')],_0x392ee3[_0x185d('0x2f')]);_0x5770c3['attributes']=_[_0x185d('0x31')](_0x392ee3[_0x185d('0x2e')],qs[_0x185d('0x32')](_0x322dc7[_0x185d('0x2f')][_0x185d('0x32')]));_0x5770c3[_0x185d('0x33')]=_0x5770c3[_0x185d('0x33')][_0x185d('0x34')]?_0x5770c3[_0x185d('0x33')]:_0x392ee3['model'];if(!_0x322dc7[_0x185d('0x2f')]['hasOwnProperty'](_0x185d('0x35'))){_0x5770c3[_0x185d('0x21')]=qs['limit'](_0x322dc7[_0x185d('0x2f')]['limit']);_0x5770c3[_0x185d('0x1f')]=qs[_0x185d('0x1f')](_0x322dc7[_0x185d('0x2f')][_0x185d('0x1f')]);}_0x5770c3[_0x185d('0x36')]=qs[_0x185d('0x37')](_0x322dc7[_0x185d('0x2f')][_0x185d('0x37')]);_0x5770c3[_0x185d('0x38')]=qs[_0x185d('0x30')](_[_0x185d('0x39')](_0x322dc7['query'],_0x392ee3['filters']),_0x3b4c21);if(_0x322dc7[_0x185d('0x2f')][_0x185d('0x3a')]){_0x5770c3[_0x185d('0x38')]=_['merge'](_0x5770c3['where'],{'$or':_[_0x185d('0x2a')](_0x3b4c21,function(_0x40f22f){if(_0x40f22f[_0x185d('0x2d')]!==_0x185d('0x3b')){var _0x36e39a={};_0x36e39a[_0x40f22f[_0x185d('0x27')]]={'$like':'%'+_0x322dc7[_0x185d('0x2f')]['filter']+'%'};return _0x36e39a;}})});}_0x5770c3=_['merge']({},_0x5770c3,_0x322dc7['options']);var _0x3079ad={'where':_0x5770c3[_0x185d('0x38')]};return db[_0x185d('0x2b')][_0x185d('0x22')](_0x3079ad)['then'](function(_0x106432){_0x4b90db[_0x185d('0x22')]=_0x106432;if(_0x322dc7[_0x185d('0x2f')][_0x185d('0x3c')]){_0x5770c3[_0x185d('0x3d')]=[{'all':!![]}];}return db[_0x185d('0x2b')][_0x185d('0x3e')](_0x5770c3);})[_0x185d('0x3f')](function(_0x59c035){_0x4b90db['rows']=_0x59c035;return _0x4b90db;})[_0x185d('0x3f')](respondWithFilteredResult(_0xa56f8c,_0x5770c3))['catch'](handleError(_0xa56f8c,null));};exports[_0x185d('0x40')]=function(_0x269718,_0x36b522){var _0x2ad5f1={'raw':![],'where':{'id':_0x269718['params']['id']}},_0x495720={};_0x495720['model']=_['keys'](db[_0x185d('0x2b')][_0x185d('0x2c')]);_0x495720['query']=_[_0x185d('0x41')](_0x269718[_0x185d('0x2f')]);_0x495720[_0x185d('0x30')]=_[_0x185d('0x31')](_0x495720[_0x185d('0x2e')],_0x495720[_0x185d('0x2f')]);_0x2ad5f1[_0x185d('0x33')]=_[_0x185d('0x31')](_0x495720[_0x185d('0x2e')],qs[_0x185d('0x32')](_0x269718[_0x185d('0x2f')][_0x185d('0x32')]));_0x2ad5f1['attributes']=_0x2ad5f1[_0x185d('0x33')]['length']?_0x2ad5f1[_0x185d('0x33')]:_0x495720[_0x185d('0x2e')];if(_0x269718['query'][_0x185d('0x3c')]){_0x2ad5f1[_0x185d('0x3d')]=[{'all':!![]}];}_0x2ad5f1=_[_0x185d('0x42')]({},_0x2ad5f1,_0x269718['options']);return db[_0x185d('0x2b')][_0x185d('0x43')](_0x2ad5f1)[_0x185d('0x3f')](handleEntityNotFound(_0x36b522,null))[_0x185d('0x3f')](respondWithResult(_0x36b522,null))[_0x185d('0x44')](handleError(_0x36b522,null));};exports[_0x185d('0x45')]=function(_0x370341,_0x24a1dc){return db[_0x185d('0x2b')][_0x185d('0x45')](_0x370341[_0x185d('0x46')],{})[_0x185d('0x3f')](respondWithResult(_0x24a1dc,0xc9))[_0x185d('0x44')](handleError(_0x24a1dc,null));};exports[_0x185d('0x25')]=function(_0x1cb1c3,_0x4e35e4){if(_0x1cb1c3[_0x185d('0x46')]['id']){delete _0x1cb1c3[_0x185d('0x46')]['id'];}return db[_0x185d('0x2b')][_0x185d('0x43')]({'where':{'id':_0x1cb1c3[_0x185d('0x47')]['id']}})[_0x185d('0x3f')](handleEntityNotFound(_0x4e35e4,null))['then'](saveUpdates(_0x1cb1c3[_0x185d('0x46')],null))[_0x185d('0x3f')](respondWithResult(_0x4e35e4,null))['catch'](handleError(_0x4e35e4,null));};exports[_0x185d('0x48')]=function(_0x2da1ff,_0x26ae28){return db[_0x185d('0x2b')][_0x185d('0x43')]({'where':{'id':_0x2da1ff[_0x185d('0x47')]['id']}})['then'](handleEntityNotFound(_0x26ae28,null))[_0x185d('0x3f')](removeEntity(_0x26ae28,null))[_0x185d('0x44')](handleError(_0x26ae28,null));};exports['getConfigurations']=function(_0x287604,_0x33a6b1,_0x1b5493){var _0x3b3129={};var _0xbab7ef={};var _0x5827c9;var _0x20915e;return db[_0x185d('0x2b')][_0x185d('0x49')]({'where':{'id':_0x287604['params']['id']}})[_0x185d('0x3f')](handleEntityNotFound(_0x33a6b1,null))[_0x185d('0x3f')](function(_0x548f6e){if(_0x548f6e){_0x5827c9=_0x548f6e;_0xbab7ef['model']=_[_0x185d('0x41')](db[_0x185d('0x4a')][_0x185d('0x2c')]);_0xbab7ef[_0x185d('0x2f')]=_[_0x185d('0x41')](_0x287604[_0x185d('0x2f')]);_0xbab7ef['filters']=_[_0x185d('0x31')](_0xbab7ef['model'],_0xbab7ef[_0x185d('0x2f')]);_0x3b3129[_0x185d('0x33')]=_[_0x185d('0x31')](_0xbab7ef[_0x185d('0x2e')],qs['fields'](_0x287604[_0x185d('0x2f')][_0x185d('0x32')]));_0x3b3129[_0x185d('0x33')]=_0x3b3129['attributes'][_0x185d('0x34')]?_0x3b3129[_0x185d('0x33')]:_0xbab7ef[_0x185d('0x2e')];_0x3b3129['order']=qs['sort'](_0x287604[_0x185d('0x2f')][_0x185d('0x37')]);_0x3b3129[_0x185d('0x38')]=qs[_0x185d('0x30')](_['pick'](_0x287604[_0x185d('0x2f')],_0xbab7ef[_0x185d('0x30')]));if(_0x287604['query'][_0x185d('0x3a')]){_0x3b3129[_0x185d('0x38')]=_['merge'](_0x3b3129[_0x185d('0x38')],{'$or':_[_0x185d('0x2a')](_0x3b3129[_0x185d('0x33')],function(_0x526096){var _0x2e91d2={};_0x2e91d2[_0x526096]={'$like':'%'+_0x287604[_0x185d('0x2f')][_0x185d('0x3a')]+'%'};return _0x2e91d2;})});}_0x3b3129=_[_0x185d('0x42')]({},_0x3b3129,_0x287604[_0x185d('0x4b')]);return _0x5827c9[_0x185d('0x4c')](_0x3b3129);}})[_0x185d('0x3f')](function(_0x5259cf){if(_0x5259cf){_0x20915e=_0x5259cf[_0x185d('0x34')];if(!_0x287604[_0x185d('0x2f')][_0x185d('0x4d')](_0x185d('0x35'))){_0x3b3129[_0x185d('0x21')]=qs[_0x185d('0x21')](_0x287604[_0x185d('0x2f')][_0x185d('0x21')]);_0x3b3129[_0x185d('0x1f')]=qs[_0x185d('0x1f')](_0x287604[_0x185d('0x2f')]['offset']);}return _0x5827c9[_0x185d('0x4c')](_0x3b3129);}})[_0x185d('0x3f')](function(_0x4e3258){if(_0x4e3258){return _0x4e3258?{'count':_0x20915e,'rows':_0x4e3258}:null;}})[_0x185d('0x3f')](respondWithResult(_0x33a6b1,null))[_0x185d('0x44')](handleError(_0x33a6b1,null));};exports[_0x185d('0x4e')]=function(_0x2ef468,_0x4f8fd7,_0x63d609){if(_0x2ef468['body']['id']){delete _0x2ef468['body']['id'];}return db['SalesforceAccount'][_0x185d('0x49')]({'where':{'id':_0x2ef468[_0x185d('0x47')]['id']}})[_0x185d('0x3f')](handleEntityNotFound(_0x4f8fd7,null))[_0x185d('0x3f')](function(_0x4fc0a8){if(_0x4fc0a8){_0x2ef468['body'][_0x185d('0x4f')]=_0x4fc0a8['id'];_0x2ef468[_0x185d('0x46')][_0x185d('0x50')]=integrations['getSubjects'](_0x2ef468['body'][_0x185d('0x51')],_0x2ef468[_0x185d('0x46')][_0x185d('0x2d')]);_0x2ef468[_0x185d('0x46')][_0x185d('0x52')]=integrations[_0x185d('0x53')](_0x2ef468[_0x185d('0x46')]['channel'],_0x2ef468[_0x185d('0x46')]['type']);return db[_0x185d('0x4a')][_0x185d('0x45')](_0x2ef468[_0x185d('0x46')],{'include':[{'model':db['SalesforceField'],'as':_0x185d('0x50')},{'model':db[_0x185d('0x54')],'as':_0x185d('0x52')}]});}return null;})[_0x185d('0x3f')](respondWithResult(_0x4f8fd7,null))[_0x185d('0x44')](handleError(_0x4f8fd7,null));};exports[_0x185d('0x55')]=function(_0x570126,_0x4fcd26,_0x41e6d1){var _0x739a93;var _0x1374ff='';var _0x4ff838=_0x185d('0x56');return db[_0x185d('0x2b')][_0x185d('0x49')]({'where':{'id':_0x570126['params']['id']},'attributes':['id',_0x185d('0x57'),_0x185d('0x58'),_0x185d('0x59'),_0x185d('0x5a'),_0x185d('0x5b'),_0x185d('0x5c')]})['then'](handleEntityNotFound(_0x4fcd26,null))['then'](function(_0x5b8c4b){if(_0x5b8c4b){_0x1374ff=_0x5b8c4b[_0x185d('0x57')];var _0x2288f6=_0x1374ff[_0x185d('0x5d')](-0x1);if(_0x2288f6==='/'){_0x1374ff=_0x1374ff[_0x185d('0x5e')](0x0,_0x1374ff[_0x185d('0x5f')](_0x2288f6));}_0x739a93=new jsforce[(_0x185d('0x60'))]({'oauth2':{'loginUrl':_0x1374ff,'clientId':_0x5b8c4b[_0x185d('0x58')],'clientSecret':_0x5b8c4b['clientSecret']}});return _0x739a93['login'](_0x5b8c4b['username'],_0x5b8c4b[_0x185d('0x5b')][_0x185d('0x61')](_0x5b8c4b['securityToken']));}})[_0x185d('0x3f')](function(_0x3d99d4){if(_0x3d99d4){if(!_['isNil'](_0x570126[_0x185d('0x2f')][_0x185d('0x62')])){_0x4ff838=_0x570126['query'][_0x185d('0x62')];}return _0x739a93[_0x185d('0x63')](_0x4ff838)['describe']();}})[_0x185d('0x3f')](function(_0x1c4d37){var _0x348abc=[_0x185d('0x64'),_0x185d('0x65'),_0x185d('0x66'),'IsRecurrence',_0x185d('0x67'),_0x185d('0x68')];var _0x346bda=[_0x185d('0x69'),_0x185d('0x6a'),_0x185d('0x6b'),'boolean',_0x185d('0x6c'),'textarea',_0x185d('0x6d')];if(_0x1c4d37){_[_0x185d('0x6e')](_0x1c4d37[_0x185d('0x32')],function(_0xb8e3bf){return _0x348abc[_0x185d('0x6f')](_0xb8e3bf['name'])||!_0x346bda[_0x185d('0x6f')](_0xb8e3bf[_0x185d('0x2d')]);});return{'count':_0x1c4d37[_0x185d('0x32')][_0x185d('0x34')],'rows':_['map'](_0x1c4d37['fields'],function(_0x226a46){return{'id':_0x226a46[_0x185d('0x27')],'name':_0x226a46[_0x185d('0x70')],'custom':_0x226a46[_0x185d('0x71')],'options':_0x226a46['picklistValues'][_0x185d('0x34')]>0x0?_[_0x185d('0x2a')](_0x226a46[_0x185d('0x72')],function(_0x4ebd1b){return{'name':_0x4ebd1b[_0x185d('0x70')],'value':_0x4ebd1b[_0x185d('0x73')]};}):_0x226a46[_0x185d('0x2d')]==_0x185d('0x74')?[{'name':_0x185d('0x75'),'value':_0x185d('0x76')},{'name':'False','value':'false'}]:[]};})};}})[_0x185d('0x3f')](respondWithResult(_0x4fcd26,null))[_0x185d('0x44')](function(_0x4acbe8){var _0x5db0bd=_0x570126[_0x185d('0x2f')][_0x185d('0x77')]?0x1f4:_0x4acbe8['statusCode']||0x1f4;logger['error'](_0x185d('0x78'),_0x185d('0x55'),_0x5db0bd,JSON['stringify'](_0x4acbe8));delete _0x4acbe8[_0x185d('0x27')];if(_0x5db0bd===0x191){_0x5db0bd=0x190;}_0x4fcd26[_0x185d('0x1c')](_0x5db0bd)['send'](_0x570126[_0x185d('0x2f')]['test']?{'message':_0x185d('0x79'),'statusCode':_0x4acbe8[_0x185d('0x7a')]}:_0x4acbe8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 04183ab..68fcc71 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 _0xdab3=['lodash','util','bluebird','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x217259,_0x4d7eaf){var _0x3d2372=function(_0x20dbf1){while(--_0x20dbf1){_0x217259['push'](_0x217259['shift']());}};_0x3d2372(++_0x4d7eaf);}(_0xdab3,0x1d6));var _0x3dab=function(_0x65cb67,_0x1c7ab4){_0x65cb67=_0x65cb67-0x0;var _0x219ed8=_0xdab3[_0x65cb67];return _0x219ed8;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3dab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dab('0x3'));var rimraf=require(_0x3dab('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x3dab('0x5'));module[_0x3dab('0x6')]=function(_0x143dae,_0x443b52){return _0x143dae[_0x3dab('0x7')](_0x3dab('0x8'),attributes,{'tableName':_0x3dab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d6=['request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x1a872c,_0x32b595){var _0x56e7e6=function(_0xcecb05){while(--_0xcecb05){_0x1a872c['push'](_0x1a872c['shift']());}};_0x56e7e6(++_0x32b595);}(_0x83d6,0xd8));var _0x683d=function(_0x516753,_0x97b8ea){_0x516753=_0x516753-0x0;var _0x283965=_0x83d6[_0x516753];return _0x283965;};'use strict';var _=require(_0x683d('0x0'));var util=require(_0x683d('0x1'));var logger=require(_0x683d('0x2'))(_0x683d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x683d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x683d('0x5'));var integrations=require(_0x683d('0x6'));module['exports']=function(_0x1f7e8b,_0xda6194){return _0x1f7e8b[_0x683d('0x7')](_0x683d('0x8'),attributes,{'tableName':_0x683d('0x9'),'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 bbe4d9b..36d1b9b 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 _0xb697=['include','map','model','then','stringify','ShowSalesforceAccount','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit'];(function(_0x20d7bc,_0x5cab39){var _0x143a2f=function(_0x21fc13){while(--_0x21fc13){_0x20d7bc['push'](_0x20d7bc['shift']());}};_0x143a2f(++_0x5cab39);}(_0xb697,0x142));var _0x7b69=function(_0x2eb0ea,_0x542349){_0x2eb0ea=_0x2eb0ea-0x0;var _0x26a7fc=_0xb697[_0x2eb0ea];return _0x26a7fc;};'use strict';var _=require(_0x7b69('0x0'));var util=require(_0x7b69('0x1'));var moment=require(_0x7b69('0x2'));var BPromise=require(_0x7b69('0x3'));var rs=require(_0x7b69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b69('0x5'))['db'];var utils=require(_0x7b69('0x6'));var logger=require(_0x7b69('0x7'))(_0x7b69('0x8'));var config=require(_0x7b69('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b69('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3045c5,_0x500f65,_0x872b7d){return new BPromise(function(_0x5b74c8,_0x363599){return client['request'](_0x3045c5,_0x872b7d)['then'](function(_0x6470e4){logger['info'](_0x7b69('0xb'),_0x500f65,'request\x20sent');logger[_0x7b69('0xc')](_0x7b69('0xd'),_0x500f65,'request\x20sent',JSON['stringify'](_0x6470e4));if(_0x6470e4[_0x7b69('0xe')]){if(_0x6470e4[_0x7b69('0xe')][_0x7b69('0xf')]===0x1f4){logger['error'](_0x7b69('0xb'),_0x500f65,_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);return _0x363599(_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);}logger[_0x7b69('0xe')](_0x7b69('0xb'),_0x500f65,_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);return _0x5b74c8(_0x6470e4['error'][_0x7b69('0x10')]);}else{logger[_0x7b69('0x11')](_0x7b69('0xb'),_0x500f65,_0x7b69('0x12'));_0x5b74c8(_0x6470e4[_0x7b69('0x13')][_0x7b69('0x10')]);}})[_0x7b69('0x14')](function(_0xd9cc4a){logger[_0x7b69('0xe')](_0x7b69('0xb'),_0x500f65,_0xd9cc4a);_0x363599(_0xd9cc4a);});});}exports[_0x7b69('0x15')]=function(_0x13b433){var _0x358bed=this;return new Promise(function(_0x4cc8ee,_0x5f1b9c){return db[_0x7b69('0x16')][_0x7b69('0x17')]({'raw':_0x13b433[_0x7b69('0x18')]?_0x13b433[_0x7b69('0x18')][_0x7b69('0x19')]===undefined?!![]:![]:!![],'where':_0x13b433[_0x7b69('0x18')]?_0x13b433[_0x7b69('0x18')]['where']||null:null,'attributes':_0x13b433['options']?_0x13b433[_0x7b69('0x18')][_0x7b69('0x1a')]||null:null,'limit':_0x13b433[_0x7b69('0x18')]?_0x13b433['options'][_0x7b69('0x1b')]||null:null,'include':_0x13b433[_0x7b69('0x18')]?_0x13b433['options'][_0x7b69('0x1c')]?_[_0x7b69('0x1d')](_0x13b433['options'][_0x7b69('0x1c')],function(_0x1dbcc0){return{'model':db[_0x1dbcc0[_0x7b69('0x1e')]],'as':_0x1dbcc0['as'],'attributes':_0x1dbcc0[_0x7b69('0x1a')],'include':_0x1dbcc0[_0x7b69('0x1c')]?_[_0x7b69('0x1d')](_0x1dbcc0['include'],function(_0x526548){return{'model':db[_0x526548['model']],'as':_0x526548['as'],'attributes':_0x526548[_0x7b69('0x1a')],'include':_0x526548[_0x7b69('0x1c')]?_[_0x7b69('0x1d')](_0x526548[_0x7b69('0x1c')],function(_0x259f20){return{'model':db[_0x259f20[_0x7b69('0x1e')]],'as':_0x259f20['as'],'attributes':_0x259f20[_0x7b69('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7b69('0x1f')](function(_0x297370){logger[_0x7b69('0x11')](_0x7b69('0x15'),_0x13b433);logger[_0x7b69('0xc')](_0x7b69('0x15'),_0x13b433,JSON[_0x7b69('0x20')](_0x297370));_0x4cc8ee(_0x297370);})[_0x7b69('0x14')](function(_0x330873){logger[_0x7b69('0xe')](_0x7b69('0x15'),_0x330873[_0x7b69('0x10')],_0x13b433);_0x5f1b9c(_0x358bed['error'](0x1f4,_0x330873['message']));});});};exports[_0x7b69('0x21')]=function(_0x142431){var _0x2431ea=this;return new Promise(function(_0xb53d58,_0x1b0c8d){return db[_0x7b69('0x16')]['find']({'raw':_0x142431[_0x7b69('0x18')]?_0x142431[_0x7b69('0x18')][_0x7b69('0x19')]===undefined?!![]:![]:!![],'where':_0x142431[_0x7b69('0x18')]?_0x142431[_0x7b69('0x18')][_0x7b69('0x22')]||null:null,'attributes':_0x142431[_0x7b69('0x18')]?_0x142431[_0x7b69('0x18')][_0x7b69('0x1a')]||null:null,'include':_0x142431[_0x7b69('0x18')]?_0x142431[_0x7b69('0x18')][_0x7b69('0x1c')]?_[_0x7b69('0x1d')](_0x142431[_0x7b69('0x18')]['include'],function(_0x3293b3){return{'model':db[_0x3293b3['model']],'as':_0x3293b3['as'],'attributes':_0x3293b3[_0x7b69('0x1a')],'include':_0x3293b3[_0x7b69('0x1c')]?_['map'](_0x3293b3[_0x7b69('0x1c')],function(_0x1ba3d7){return{'model':db[_0x1ba3d7[_0x7b69('0x1e')]],'as':_0x1ba3d7['as'],'attributes':_0x1ba3d7[_0x7b69('0x1a')],'include':_0x1ba3d7[_0x7b69('0x1c')]?_['map'](_0x1ba3d7[_0x7b69('0x1c')],function(_0x2efe35){return{'model':db[_0x2efe35[_0x7b69('0x1e')]],'as':_0x2efe35['as'],'attributes':_0x2efe35['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b69('0x1f')](function(_0x5c1858){logger[_0x7b69('0x11')](_0x7b69('0x21'),_0x142431);logger[_0x7b69('0xc')]('ShowSalesforceAccount',_0x142431,JSON[_0x7b69('0x20')](_0x5c1858));_0xb53d58(_0x5c1858);})[_0x7b69('0x14')](function(_0x186d1a){logger[_0x7b69('0xe')]('ShowSalesforceAccount',_0x186d1a[_0x7b69('0x10')],_0x142431);_0x1b0c8d(_0x2431ea[_0x7b69('0xe')](0x1f4,_0x186d1a[_0x7b69('0x10')]));});});}; \ No newline at end of file +var _0x5032=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','model','map','ShowSalesforceAccount','find','raw'];(function(_0x3ed992,_0x401584){var _0x9ea1c0=function(_0x974c1e){while(--_0x974c1e){_0x3ed992['push'](_0x3ed992['shift']());}};_0x9ea1c0(++_0x401584);}(_0x5032,0x90));var _0x2503=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5032[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x2503('0x0'));var util=require(_0x2503('0x1'));var moment=require(_0x2503('0x2'));var BPromise=require(_0x2503('0x3'));var rs=require(_0x2503('0x4'));var fs=require('fs');var Redis=require(_0x2503('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2503('0x6'));var logger=require('../../config/logger')(_0x2503('0x7'));var config=require(_0x2503('0x8'));var jayson=require(_0x2503('0x9'));var client=jayson[_0x2503('0xa')][_0x2503('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4adc13,_0x363b6f,_0x42f2c2){return new BPromise(function(_0x3bb861,_0x12756c){return client[_0x2503('0xc')](_0x4adc13,_0x42f2c2)[_0x2503('0xd')](function(_0x2545f9){logger[_0x2503('0xe')](_0x2503('0xf'),_0x363b6f,_0x2503('0x10'));logger[_0x2503('0x11')](_0x2503('0x12'),_0x363b6f,_0x2503('0x10'),JSON[_0x2503('0x13')](_0x2545f9));if(_0x2545f9[_0x2503('0x14')]){if(_0x2545f9[_0x2503('0x14')][_0x2503('0x15')]===0x1f4){logger[_0x2503('0x14')](_0x2503('0xf'),_0x363b6f,_0x2545f9[_0x2503('0x14')]['message']);return _0x12756c(_0x2545f9[_0x2503('0x14')]['message']);}logger[_0x2503('0x14')](_0x2503('0xf'),_0x363b6f,_0x2545f9[_0x2503('0x14')][_0x2503('0x16')]);return _0x3bb861(_0x2545f9[_0x2503('0x14')][_0x2503('0x16')]);}else{logger[_0x2503('0xe')](_0x2503('0xf'),_0x363b6f,_0x2503('0x10'));_0x3bb861(_0x2545f9[_0x2503('0x17')][_0x2503('0x16')]);}})[_0x2503('0x18')](function(_0x594e04){logger[_0x2503('0x14')](_0x2503('0xf'),_0x363b6f,_0x594e04);_0x12756c(_0x594e04);});});}exports[_0x2503('0x19')]=function(_0x5e0f57){var _0x1d3325=this;return new Promise(function(_0x479aab,_0x15c877){return db[_0x2503('0x1a')]['findAll']({'raw':_0x5e0f57['options']?_0x5e0f57[_0x2503('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5e0f57['options']?_0x5e0f57[_0x2503('0x1b')][_0x2503('0x1c')]||null:null,'attributes':_0x5e0f57[_0x2503('0x1b')]?_0x5e0f57['options'][_0x2503('0x1d')]||null:null,'limit':_0x5e0f57[_0x2503('0x1b')]?_0x5e0f57[_0x2503('0x1b')]['limit']||null:null,'include':_0x5e0f57['options']?_0x5e0f57[_0x2503('0x1b')]['include']?_['map'](_0x5e0f57[_0x2503('0x1b')][_0x2503('0x1e')],function(_0x63859c){return{'model':db[_0x63859c[_0x2503('0x1f')]],'as':_0x63859c['as'],'attributes':_0x63859c['attributes'],'include':_0x63859c[_0x2503('0x1e')]?_[_0x2503('0x20')](_0x63859c[_0x2503('0x1e')],function(_0x15e362){return{'model':db[_0x15e362['model']],'as':_0x15e362['as'],'attributes':_0x15e362[_0x2503('0x1d')],'include':_0x15e362[_0x2503('0x1e')]?_[_0x2503('0x20')](_0x15e362['include'],function(_0xcab761){return{'model':db[_0xcab761[_0x2503('0x1f')]],'as':_0xcab761['as'],'attributes':_0xcab761[_0x2503('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2503('0xd')](function(_0x35cb7f){logger[_0x2503('0xe')]('GetSalesforceAccount',_0x5e0f57);logger['debug']('GetSalesforceAccount',_0x5e0f57,JSON[_0x2503('0x13')](_0x35cb7f));_0x479aab(_0x35cb7f);})['catch'](function(_0x32ae80){logger[_0x2503('0x14')](_0x2503('0x19'),_0x32ae80[_0x2503('0x16')],_0x5e0f57);_0x15c877(_0x1d3325[_0x2503('0x14')](0x1f4,_0x32ae80[_0x2503('0x16')]));});});};exports[_0x2503('0x21')]=function(_0x44e449){var _0x250785=this;return new Promise(function(_0x1d854b,_0x374454){return db[_0x2503('0x1a')][_0x2503('0x22')]({'raw':_0x44e449[_0x2503('0x1b')]?_0x44e449[_0x2503('0x1b')][_0x2503('0x23')]===undefined?!![]:![]:!![],'where':_0x44e449['options']?_0x44e449[_0x2503('0x1b')][_0x2503('0x1c')]||null:null,'attributes':_0x44e449['options']?_0x44e449['options'][_0x2503('0x1d')]||null:null,'include':_0x44e449['options']?_0x44e449[_0x2503('0x1b')][_0x2503('0x1e')]?_[_0x2503('0x20')](_0x44e449[_0x2503('0x1b')][_0x2503('0x1e')],function(_0x5d021c){return{'model':db[_0x5d021c[_0x2503('0x1f')]],'as':_0x5d021c['as'],'attributes':_0x5d021c['attributes'],'include':_0x5d021c[_0x2503('0x1e')]?_[_0x2503('0x20')](_0x5d021c[_0x2503('0x1e')],function(_0x246283){return{'model':db[_0x246283['model']],'as':_0x246283['as'],'attributes':_0x246283[_0x2503('0x1d')],'include':_0x246283['include']?_[_0x2503('0x20')](_0x246283[_0x2503('0x1e')],function(_0x50085d){return{'model':db[_0x50085d[_0x2503('0x1f')]],'as':_0x50085d['as'],'attributes':_0x50085d[_0x2503('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2503('0xd')](function(_0x13b9fc){logger['info']('ShowSalesforceAccount',_0x44e449);logger[_0x2503('0x11')](_0x2503('0x21'),_0x44e449,JSON[_0x2503('0x13')](_0x13b9fc));_0x1d854b(_0x13b9fc);})[_0x2503('0x18')](function(_0x2f0a04){logger['error'](_0x2503('0x21'),_0x2f0a04[_0x2503('0x16')],_0x44e449);_0x374454(_0x250785[_0x2503('0x14')](0x1f4,_0x2f0a04['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0e4faec..7d79033 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0xbeab34,_0x5a2dd6){var _0x1965f2=function(_0x35e7de){while(--_0x35e7de){_0xbeab34['push'](_0xbeab34['shift']());}};_0x1965f2(++_0x5a2dd6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x53a12c,_0x41af3b){var _0x32d6f4=function(_0x1ef47a){while(--_0x1ef47a){_0x53a12c['push'](_0x53a12c['shift']());}};_0x32d6f4(++_0x41af3b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5205ed,_0x5d8a07){_0x5205ed=_0x5205ed-0x0;var _0x3e8465=_0x5f2f[_0x5205ed];return _0x3e8465;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('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 21ebce1..6ab126c 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 _0x2e3a=['contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','STRING','ENUM','Task','Case'];(function(_0x440fde,_0x445ce0){var _0x11052c=function(_0x49f547){while(--_0x49f547){_0x440fde['push'](_0x440fde['shift']());}};_0x11052c(++_0x445ce0);}(_0x2e3a,0x145));var _0xa2e3=function(_0x663b7f,_0x54fb07){_0x663b7f=_0x663b7f-0x0;var _0x566246=_0x2e3a[_0x663b7f];return _0x566246;};'use strict';var Sequelize=require(_0xa2e3('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2e3('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa2e3('0x2')](_0xa2e3('0x3'),_0xa2e3('0x4')),'defaultValue':_0xa2e3('0x3')},'moduleSearch':{'type':Sequelize[_0xa2e3('0x2')](_0xa2e3('0x5'),_0xa2e3('0x6'),_0xa2e3('0x7'),_0xa2e3('0x8'),_0xa2e3('0x9')),'defaultValue':_0xa2e3('0x5')},'moduleCreate':{'type':Sequelize[_0xa2e3('0x2')](_0xa2e3('0xa'),_0xa2e3('0x6'),'lead',_0xa2e3('0x9')),'defaultValue':_0xa2e3('0x7')},'leadId':{'type':Sequelize[_0xa2e3('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xa2e3('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xa2e3('0x1')]}}; \ No newline at end of file +var _0xbfce=['lead','account_contact_lead','account','sequelize','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x277b84,_0x25fa3f){var _0x26cad7=function(_0x4d91a3){while(--_0x4d91a3){_0x277b84['push'](_0x277b84['shift']());}};_0x26cad7(++_0x25fa3f);}(_0xbfce,0xcb));var _0xebfc=function(_0x30d3c1,_0xa3da89){_0x30d3c1=_0x30d3c1-0x0;var _0x571ee9=_0xbfce[_0x30d3c1];return _0x571ee9;};'use strict';var Sequelize=require(_0xebfc('0x0'));module['exports']={'name':{'type':Sequelize[_0xebfc('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xebfc('0x2')](_0xebfc('0x3'),_0xebfc('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xebfc('0x5'),_0xebfc('0x6'),_0xebfc('0x7'),_0xebfc('0x8'),_0xebfc('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xebfc('0x2')]('nothing','contact',_0xebfc('0x7'),_0xebfc('0x9')),'defaultValue':_0xebfc('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xebfc('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xebfc('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xebfc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index dbd167b..172d964 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 _0xaab2=['json','apply','reject','save','update','then','destroy','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','findAll','rows','catch','show','length','include','options','find','create','body','params','getFields','SalesforceField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x54f057,_0x29a988){var _0x37e956=function(_0x4eb396){while(--_0x4eb396){_0x54f057['push'](_0x54f057['shift']());}};_0x37e956(++_0x29a988);}(_0xaab2,0xca));var _0x2aab=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xaab2[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2aab('0x0'));var zipdir=require(_0x2aab('0x1'));var jsonpatch=require(_0x2aab('0x2'));var rp=require('request-promise');var moment=require(_0x2aab('0x3'));var BPromise=require(_0x2aab('0x4'));var Mustache=require(_0x2aab('0x5'));var util=require(_0x2aab('0x6'));var path=require(_0x2aab('0x7'));var sox=require('sox');var csv=require(_0x2aab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2aab('0x9'));var _=require(_0x2aab('0xa'));var squel=require(_0x2aab('0xb'));var crypto=require(_0x2aab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2aab('0xd'));var toCsv=require(_0x2aab('0x8'));var querystring=require(_0x2aab('0xe'));var Papa=require(_0x2aab('0xf'));var Redis=require(_0x2aab('0x10'));var authService=require(_0x2aab('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2aab('0x12'));var logger=require(_0x2aab('0x13'))('api');var utils=require(_0x2aab('0x14'));var config=require(_0x2aab('0x15'));var licenseUtil=require(_0x2aab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32754a,_0x3d2c09){_0x3d2c09=_0x3d2c09||0xcc;return function(_0x32d7ef){if(_0x32d7ef){return _0x32754a[_0x2aab('0x17')](_0x3d2c09);}return _0x32754a[_0x2aab('0x18')](_0x3d2c09)[_0x2aab('0x19')]();};}function respondWithResult(_0x536a85,_0x490240){_0x490240=_0x490240||0xc8;return function(_0x3039f1){if(_0x3039f1){return _0x536a85['status'](_0x490240)['json'](_0x3039f1);}};}function respondWithFilteredResult(_0x135345,_0xcabe88){return function(_0x2e5c20){if(_0x2e5c20){var _0xb0ff8c=typeof _0xcabe88[_0x2aab('0x1a')]===_0x2aab('0x1b')&&typeof _0xcabe88[_0x2aab('0x1c')]===_0x2aab('0x1b');var _0x4ebce7=_0x2e5c20[_0x2aab('0x1d')];var _0x332d6b=_0xb0ff8c?0x0:_0xcabe88[_0x2aab('0x1a')];var _0x10af82=_0xb0ff8c?_0x2e5c20[_0x2aab('0x1d')]:_0xcabe88[_0x2aab('0x1a')]+_0xcabe88[_0x2aab('0x1c')];var _0x42c628;if(_0x10af82>=_0x4ebce7){_0x10af82=_0x4ebce7;_0x42c628=0xc8;}else{_0x42c628=0xce;}_0x135345[_0x2aab('0x18')](_0x42c628);return _0x135345[_0x2aab('0x1e')](_0x2aab('0x1f'),_0x332d6b+'-'+_0x10af82+'/'+_0x4ebce7)[_0x2aab('0x20')](_0x2e5c20);}return null;};}function patchUpdates(_0x1ec2d8){return function(_0x1b4367){try{jsonpatch[_0x2aab('0x21')](_0x1b4367,_0x1ec2d8,!![]);}catch(_0x2c243f){return BPromise[_0x2aab('0x22')](_0x2c243f);}return _0x1b4367[_0x2aab('0x23')]();};}function saveUpdates(_0x1bb2bb,_0x118021){return function(_0x58aad7){if(_0x58aad7){return _0x58aad7[_0x2aab('0x24')](_0x1bb2bb)[_0x2aab('0x25')](function(_0x42544d){return _0x42544d;});}return null;};}function removeEntity(_0x4d20ab,_0x163a50){return function(_0x11bef2){if(_0x11bef2){return _0x11bef2[_0x2aab('0x26')]()[_0x2aab('0x25')](function(){_0x4d20ab[_0x2aab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429481,_0xde364){return function(_0x77ca0c){if(!_0x77ca0c){_0x429481[_0x2aab('0x17')](0x194);}return _0x77ca0c;};}function handleError(_0x52993a,_0x18ec3f){_0x18ec3f=_0x18ec3f||0x1f4;return function(_0x117bbb){logger['error'](_0x117bbb[_0x2aab('0x27')]);if(_0x117bbb[_0x2aab('0x28')]){delete _0x117bbb[_0x2aab('0x28')];}_0x52993a[_0x2aab('0x18')](_0x18ec3f)['send'](_0x117bbb);};}exports['index']=function(_0x1942bd,_0x2c98aa){var _0x3e7746={},_0x308ceb={},_0x617733={'count':0x0,'rows':[]};var _0x1a5af5=_[_0x2aab('0x29')](db[_0x2aab('0x2a')][_0x2aab('0x2b')],function(_0x2986b9){return{'name':_0x2986b9[_0x2aab('0x2c')],'type':_0x2986b9['type'][_0x2aab('0x2d')]};});_0x308ceb[_0x2aab('0x2e')]=_[_0x2aab('0x29')](_0x1a5af5,_0x2aab('0x28'));_0x308ceb['query']=_[_0x2aab('0x2f')](_0x1942bd[_0x2aab('0x30')]);_0x308ceb[_0x2aab('0x31')]=_[_0x2aab('0x32')](_0x308ceb[_0x2aab('0x2e')],_0x308ceb['query']);_0x3e7746[_0x2aab('0x33')]=_['intersection'](_0x308ceb[_0x2aab('0x2e')],qs[_0x2aab('0x34')](_0x1942bd[_0x2aab('0x30')][_0x2aab('0x34')]));_0x3e7746['attributes']=_0x3e7746[_0x2aab('0x33')]['length']?_0x3e7746[_0x2aab('0x33')]:_0x308ceb[_0x2aab('0x2e')];if(!_0x1942bd[_0x2aab('0x30')][_0x2aab('0x35')](_0x2aab('0x36'))){_0x3e7746[_0x2aab('0x1c')]=qs[_0x2aab('0x1c')](_0x1942bd[_0x2aab('0x30')][_0x2aab('0x1c')]);_0x3e7746[_0x2aab('0x1a')]=qs[_0x2aab('0x1a')](_0x1942bd['query'][_0x2aab('0x1a')]);}_0x3e7746[_0x2aab('0x37')]=qs['sort'](_0x1942bd['query'][_0x2aab('0x38')]);_0x3e7746[_0x2aab('0x39')]=qs[_0x2aab('0x31')](_['pick'](_0x1942bd['query'],_0x308ceb[_0x2aab('0x31')]),_0x1a5af5);if(_0x1942bd[_0x2aab('0x30')][_0x2aab('0x3a')]){_0x3e7746['where']=_['merge'](_0x3e7746['where'],{'$or':_[_0x2aab('0x29')](_0x1a5af5,function(_0x1f7bb6){if(_0x1f7bb6[_0x2aab('0x3b')]!==_0x2aab('0x3c')){var _0x710965={};_0x710965[_0x1f7bb6[_0x2aab('0x28')]]={'$like':'%'+_0x1942bd['query']['filter']+'%'};return _0x710965;}})});}_0x3e7746=_[_0x2aab('0x3d')]({},_0x3e7746,_0x1942bd['options']);var _0x1b864c={'where':_0x3e7746[_0x2aab('0x39')]};return db[_0x2aab('0x2a')]['count'](_0x1b864c)[_0x2aab('0x25')](function(_0x5292e9){_0x617733[_0x2aab('0x1d')]=_0x5292e9;if(_0x1942bd[_0x2aab('0x30')]['includeAll']){_0x3e7746['include']=[{'all':!![]}];}return db[_0x2aab('0x2a')][_0x2aab('0x3e')](_0x3e7746);})[_0x2aab('0x25')](function(_0x55d8f6){_0x617733[_0x2aab('0x3f')]=_0x55d8f6;return _0x617733;})[_0x2aab('0x25')](respondWithFilteredResult(_0x2c98aa,_0x3e7746))[_0x2aab('0x40')](handleError(_0x2c98aa,null));};exports[_0x2aab('0x41')]=function(_0x135a06,_0x370393){var _0x484ee7={'raw':![],'where':{'id':_0x135a06['params']['id']}},_0xdb9a44={};_0xdb9a44['model']=_[_0x2aab('0x2f')](db[_0x2aab('0x2a')]['rawAttributes']);_0xdb9a44[_0x2aab('0x30')]=_[_0x2aab('0x2f')](_0x135a06[_0x2aab('0x30')]);_0xdb9a44['filters']=_[_0x2aab('0x32')](_0xdb9a44[_0x2aab('0x2e')],_0xdb9a44[_0x2aab('0x30')]);_0x484ee7[_0x2aab('0x33')]=_['intersection'](_0xdb9a44[_0x2aab('0x2e')],qs[_0x2aab('0x34')](_0x135a06[_0x2aab('0x30')][_0x2aab('0x34')]));_0x484ee7[_0x2aab('0x33')]=_0x484ee7[_0x2aab('0x33')][_0x2aab('0x42')]?_0x484ee7[_0x2aab('0x33')]:_0xdb9a44[_0x2aab('0x2e')];if(_0x135a06[_0x2aab('0x30')]['includeAll']){_0x484ee7[_0x2aab('0x43')]=[{'all':!![]}];}_0x484ee7=_[_0x2aab('0x3d')]({},_0x484ee7,_0x135a06[_0x2aab('0x44')]);return db['SalesforceConfiguration'][_0x2aab('0x45')](_0x484ee7)[_0x2aab('0x25')](handleEntityNotFound(_0x370393,null))[_0x2aab('0x25')](respondWithResult(_0x370393,null))[_0x2aab('0x40')](handleError(_0x370393,null));};exports['create']=function(_0x368f54,_0x36fde2){return db[_0x2aab('0x2a')][_0x2aab('0x46')](_0x368f54[_0x2aab('0x47')],{})['then'](respondWithResult(_0x36fde2,0xc9))['catch'](handleError(_0x36fde2,null));};exports[_0x2aab('0x24')]=function(_0x2fe0b5,_0xaed168){if(_0x2fe0b5['body']['id']){delete _0x2fe0b5[_0x2aab('0x47')]['id'];}return db[_0x2aab('0x2a')]['find']({'where':{'id':_0x2fe0b5[_0x2aab('0x48')]['id']}})['then'](handleEntityNotFound(_0xaed168,null))['then'](saveUpdates(_0x2fe0b5['body'],null))[_0x2aab('0x25')](respondWithResult(_0xaed168,null))[_0x2aab('0x40')](handleError(_0xaed168,null));};exports[_0x2aab('0x26')]=function(_0x24852b,_0x234786){return db[_0x2aab('0x2a')][_0x2aab('0x45')]({'where':{'id':_0x24852b['params']['id']}})[_0x2aab('0x25')](handleEntityNotFound(_0x234786,null))[_0x2aab('0x25')](removeEntity(_0x234786,null))[_0x2aab('0x40')](handleError(_0x234786,null));};exports[_0x2aab('0x49')]=function(_0xae7c6b,_0x3a02db,_0x116aec){var _0x1ebfef={};var _0x3985ea={};var _0xb43934;var _0x509677;return db[_0x2aab('0x2a')]['findOne']({'where':{'id':_0xae7c6b[_0x2aab('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a02db,null))['then'](function(_0x3ec198){if(_0x3ec198){_0xb43934=_0x3ec198;_0x3985ea['model']=_['keys'](db[_0x2aab('0x4a')][_0x2aab('0x2b')]);_0x3985ea[_0x2aab('0x30')]=_[_0x2aab('0x2f')](_0xae7c6b['query']);_0x3985ea[_0x2aab('0x31')]=_[_0x2aab('0x32')](_0x3985ea[_0x2aab('0x2e')],_0x3985ea['query']);_0x1ebfef['attributes']=_['intersection'](_0x3985ea[_0x2aab('0x2e')],qs['fields'](_0xae7c6b['query']['fields']));_0x1ebfef[_0x2aab('0x33')]=_0x1ebfef[_0x2aab('0x33')][_0x2aab('0x42')]?_0x1ebfef[_0x2aab('0x33')]:_0x3985ea['model'];_0x1ebfef[_0x2aab('0x37')]=qs[_0x2aab('0x38')](_0xae7c6b['query']['sort']);_0x1ebfef[_0x2aab('0x39')]=qs['filters'](_[_0x2aab('0x4b')](_0xae7c6b[_0x2aab('0x30')],_0x3985ea[_0x2aab('0x31')]));if(_0xae7c6b['query']['filter']){_0x1ebfef['where']=_['merge'](_0x1ebfef[_0x2aab('0x39')],{'$or':_['map'](_0x1ebfef[_0x2aab('0x33')],function(_0x3a0529){var _0x2a848f={};_0x2a848f[_0x3a0529]={'$like':'%'+_0xae7c6b[_0x2aab('0x30')][_0x2aab('0x3a')]+'%'};return _0x2a848f;})});}_0x1ebfef=_[_0x2aab('0x3d')]({},_0x1ebfef,_0xae7c6b[_0x2aab('0x44')]);return _0xb43934[_0x2aab('0x49')](_0x1ebfef);}})[_0x2aab('0x25')](function(_0x20af78){if(_0x20af78){_0x509677=_0x20af78[_0x2aab('0x42')];if(!_0xae7c6b[_0x2aab('0x30')][_0x2aab('0x35')]('nolimit')){_0x1ebfef[_0x2aab('0x1c')]=qs[_0x2aab('0x1c')](_0xae7c6b[_0x2aab('0x30')][_0x2aab('0x1c')]);_0x1ebfef[_0x2aab('0x1a')]=qs['offset'](_0xae7c6b[_0x2aab('0x30')]['offset']);}return _0xb43934[_0x2aab('0x49')](_0x1ebfef);}})[_0x2aab('0x25')](function(_0x148e6d){if(_0x148e6d){return _0x148e6d?{'count':_0x509677,'rows':_0x148e6d}:null;}})[_0x2aab('0x25')](respondWithResult(_0x3a02db,null))[_0x2aab('0x40')](handleError(_0x3a02db,null));};exports[_0x2aab('0x4c')]=function(_0x4fee34,_0xd5e1df,_0x3a9812){var _0x3d8993={};var _0x22e7ac={};var _0x2b79fe;var _0x2c7a55;return db[_0x2aab('0x2a')]['findOne']({'where':{'id':_0x4fee34[_0x2aab('0x48')]['id']}})[_0x2aab('0x25')](handleEntityNotFound(_0xd5e1df,null))[_0x2aab('0x25')](function(_0x21870d){if(_0x21870d){_0x2b79fe=_0x21870d;_0x22e7ac[_0x2aab('0x2e')]=_[_0x2aab('0x2f')](db['SalesforceField'][_0x2aab('0x2b')]);_0x22e7ac['query']=_[_0x2aab('0x2f')](_0x4fee34[_0x2aab('0x30')]);_0x22e7ac[_0x2aab('0x31')]=_[_0x2aab('0x32')](_0x22e7ac[_0x2aab('0x2e')],_0x22e7ac[_0x2aab('0x30')]);_0x3d8993[_0x2aab('0x33')]=_[_0x2aab('0x32')](_0x22e7ac[_0x2aab('0x2e')],qs[_0x2aab('0x34')](_0x4fee34['query'][_0x2aab('0x34')]));_0x3d8993[_0x2aab('0x33')]=_0x3d8993[_0x2aab('0x33')]['length']?_0x3d8993[_0x2aab('0x33')]:_0x22e7ac[_0x2aab('0x2e')];_0x3d8993[_0x2aab('0x37')]=qs[_0x2aab('0x38')](_0x4fee34['query'][_0x2aab('0x38')]);_0x3d8993[_0x2aab('0x39')]=qs[_0x2aab('0x31')](_[_0x2aab('0x4b')](_0x4fee34['query'],_0x22e7ac[_0x2aab('0x31')]));if(_0x4fee34[_0x2aab('0x30')]['filter']){_0x3d8993[_0x2aab('0x39')]=_[_0x2aab('0x3d')](_0x3d8993['where'],{'$or':_['map'](_0x3d8993[_0x2aab('0x33')],function(_0x1494c1){var _0x570ebd={};_0x570ebd[_0x1494c1]={'$like':'%'+_0x4fee34['query']['filter']+'%'};return _0x570ebd;})});}_0x3d8993=_['merge']({},_0x3d8993,_0x4fee34[_0x2aab('0x44')]);return _0x2b79fe[_0x2aab('0x4c')](_0x3d8993);}})['then'](function(_0x35acc7){if(_0x35acc7){_0x2c7a55=_0x35acc7[_0x2aab('0x42')];if(!_0x4fee34[_0x2aab('0x30')][_0x2aab('0x35')](_0x2aab('0x36'))){_0x3d8993[_0x2aab('0x1c')]=qs['limit'](_0x4fee34['query'][_0x2aab('0x1c')]);_0x3d8993[_0x2aab('0x1a')]=qs[_0x2aab('0x1a')](_0x4fee34[_0x2aab('0x30')][_0x2aab('0x1a')]);}return _0x2b79fe['getSubjects'](_0x3d8993);}})[_0x2aab('0x25')](function(_0x5d9328){if(_0x5d9328){return _0x5d9328?{'count':_0x2c7a55,'rows':_0x5d9328}:null;}})[_0x2aab('0x25')](respondWithResult(_0xd5e1df,null))[_0x2aab('0x40')](handleError(_0xd5e1df,null));};exports[_0x2aab('0x4d')]=function(_0x4e4388,_0x171232,_0xeba33c){var _0x2ba58a={};var _0x20f01b={};var _0x176b8c;var _0x16b666;return db[_0x2aab('0x2a')]['findOne']({'where':{'id':_0x4e4388['params']['id']}})[_0x2aab('0x25')](handleEntityNotFound(_0x171232,null))['then'](function(_0x1cc1e8){if(_0x1cc1e8){_0x176b8c=_0x1cc1e8;_0x20f01b[_0x2aab('0x2e')]=_[_0x2aab('0x2f')](db['SalesforceField'][_0x2aab('0x2b')]);_0x20f01b[_0x2aab('0x30')]=_[_0x2aab('0x2f')](_0x4e4388[_0x2aab('0x30')]);_0x20f01b[_0x2aab('0x31')]=_['intersection'](_0x20f01b[_0x2aab('0x2e')],_0x20f01b['query']);_0x2ba58a['attributes']=_[_0x2aab('0x32')](_0x20f01b['model'],qs[_0x2aab('0x34')](_0x4e4388[_0x2aab('0x30')][_0x2aab('0x34')]));_0x2ba58a[_0x2aab('0x33')]=_0x2ba58a[_0x2aab('0x33')][_0x2aab('0x42')]?_0x2ba58a[_0x2aab('0x33')]:_0x20f01b['model'];_0x2ba58a['order']=qs['sort'](_0x4e4388[_0x2aab('0x30')]['sort']);_0x2ba58a[_0x2aab('0x39')]=qs['filters'](_[_0x2aab('0x4b')](_0x4e4388[_0x2aab('0x30')],_0x20f01b['filters']));if(_0x4e4388[_0x2aab('0x30')][_0x2aab('0x3a')]){_0x2ba58a['where']=_[_0x2aab('0x3d')](_0x2ba58a[_0x2aab('0x39')],{'$or':_['map'](_0x2ba58a[_0x2aab('0x33')],function(_0x45b889){var _0x50f5d0={};_0x50f5d0[_0x45b889]={'$like':'%'+_0x4e4388[_0x2aab('0x30')]['filter']+'%'};return _0x50f5d0;})});}_0x2ba58a=_['merge']({},_0x2ba58a,_0x4e4388['options']);return _0x176b8c[_0x2aab('0x4d')](_0x2ba58a);}})[_0x2aab('0x25')](function(_0x5a98c5){if(_0x5a98c5){_0x16b666=_0x5a98c5[_0x2aab('0x42')];if(!_0x4e4388[_0x2aab('0x30')][_0x2aab('0x35')](_0x2aab('0x36'))){_0x2ba58a['limit']=qs[_0x2aab('0x1c')](_0x4e4388[_0x2aab('0x30')][_0x2aab('0x1c')]);_0x2ba58a[_0x2aab('0x1a')]=qs[_0x2aab('0x1a')](_0x4e4388[_0x2aab('0x30')][_0x2aab('0x1a')]);}return _0x176b8c['getDescriptions'](_0x2ba58a);}})[_0x2aab('0x25')](function(_0x416f5e){if(_0x416f5e){return _0x416f5e?{'count':_0x16b666,'rows':_0x416f5e}:null;}})[_0x2aab('0x25')](respondWithResult(_0x171232,null))[_0x2aab('0x40')](handleError(_0x171232,null));}; \ No newline at end of file +var _0xc826=['save','update','then','destroy','sendStatus','error','stack','send','map','rawAttributes','fieldName','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','SalesforceConfiguration','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','getFields','SalesforceField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0xa7991d,_0x32459c){var _0x459970=function(_0x5f536f){while(--_0x5f536f){_0xa7991d['push'](_0xa7991d['shift']());}};_0x459970(++_0x32459c);}(_0xc826,0x12e));var _0x6c82=function(_0x478242,_0x3e96d3){_0x478242=_0x478242-0x0;var _0x44567d=_0xc826[_0x478242];return _0x44567d;};'use strict';var emlformat=require(_0x6c82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c82('0x1'));var jsonpatch=require(_0x6c82('0x2'));var rp=require(_0x6c82('0x3'));var moment=require(_0x6c82('0x4'));var BPromise=require(_0x6c82('0x5'));var Mustache=require(_0x6c82('0x6'));var util=require(_0x6c82('0x7'));var path=require(_0x6c82('0x8'));var sox=require(_0x6c82('0x9'));var csv=require('to-csv');var ejs=require(_0x6c82('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c82('0xb'));var squel=require(_0x6c82('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6c82('0xd'));var toCsv=require(_0x6c82('0xe'));var querystring=require(_0x6c82('0xf'));var Papa=require(_0x6c82('0x10'));var Redis=require(_0x6c82('0x11'));var authService=require(_0x6c82('0x12'));var qs=require(_0x6c82('0x13'));var as=require(_0x6c82('0x14'));var hardwareService=require(_0x6c82('0x15'));var logger=require(_0x6c82('0x16'))(_0x6c82('0x17'));var utils=require(_0x6c82('0x18'));var config=require(_0x6c82('0x19'));var licenseUtil=require(_0x6c82('0x1a'));var db=require(_0x6c82('0x1b'))['db'];function respondWithStatusCode(_0x596aba,_0x57ccbe){_0x57ccbe=_0x57ccbe||0xcc;return function(_0xab4115){if(_0xab4115){return _0x596aba['sendStatus'](_0x57ccbe);}return _0x596aba[_0x6c82('0x1c')](_0x57ccbe)[_0x6c82('0x1d')]();};}function respondWithResult(_0xcf101,_0x1e4fb1){_0x1e4fb1=_0x1e4fb1||0xc8;return function(_0x96fbff){if(_0x96fbff){return _0xcf101[_0x6c82('0x1c')](_0x1e4fb1)[_0x6c82('0x1e')](_0x96fbff);}};}function respondWithFilteredResult(_0x155be3,_0x141baf){return function(_0x2b3721){if(_0x2b3721){var _0x500fe0=typeof _0x141baf['offset']===_0x6c82('0x1f')&&typeof _0x141baf[_0x6c82('0x20')]===_0x6c82('0x1f');var _0x146eec=_0x2b3721[_0x6c82('0x21')];var _0x5d7b7b=_0x500fe0?0x0:_0x141baf[_0x6c82('0x22')];var _0x607cf4=_0x500fe0?_0x2b3721[_0x6c82('0x21')]:_0x141baf[_0x6c82('0x22')]+_0x141baf[_0x6c82('0x20')];var _0x420ed5;if(_0x607cf4>=_0x146eec){_0x607cf4=_0x146eec;_0x420ed5=0xc8;}else{_0x420ed5=0xce;}_0x155be3['status'](_0x420ed5);return _0x155be3['set'](_0x6c82('0x23'),_0x5d7b7b+'-'+_0x607cf4+'/'+_0x146eec)[_0x6c82('0x1e')](_0x2b3721);}return null;};}function patchUpdates(_0x4780ab){return function(_0x3ddbff){try{jsonpatch[_0x6c82('0x24')](_0x3ddbff,_0x4780ab,!![]);}catch(_0x5ae23a){return BPromise[_0x6c82('0x25')](_0x5ae23a);}return _0x3ddbff[_0x6c82('0x26')]();};}function saveUpdates(_0x42755c,_0x506d9c){return function(_0x52c105){if(_0x52c105){return _0x52c105[_0x6c82('0x27')](_0x42755c)[_0x6c82('0x28')](function(_0x5957bb){return _0x5957bb;});}return null;};}function removeEntity(_0x3fd3d8,_0x2084d0){return function(_0x2ed778){if(_0x2ed778){return _0x2ed778[_0x6c82('0x29')]()[_0x6c82('0x28')](function(){_0x3fd3d8[_0x6c82('0x1c')](0xcc)[_0x6c82('0x1d')]();});}};}function handleEntityNotFound(_0xa2f02a,_0x5b59c9){return function(_0x10be54){if(!_0x10be54){_0xa2f02a[_0x6c82('0x2a')](0x194);}return _0x10be54;};}function handleError(_0x1dac37,_0x3f9cc2){_0x3f9cc2=_0x3f9cc2||0x1f4;return function(_0x3ec9f1){logger[_0x6c82('0x2b')](_0x3ec9f1[_0x6c82('0x2c')]);if(_0x3ec9f1['name']){delete _0x3ec9f1['name'];}_0x1dac37['status'](_0x3f9cc2)[_0x6c82('0x2d')](_0x3ec9f1);};}exports['index']=function(_0x18e332,_0x4c1bf2){var _0x522938={},_0x43b999={},_0xb061b0={'count':0x0,'rows':[]};var _0x3443fa=_[_0x6c82('0x2e')](db['SalesforceConfiguration'][_0x6c82('0x2f')],function(_0x5c1ba4){return{'name':_0x5c1ba4[_0x6c82('0x30')],'type':_0x5c1ba4['type'][_0x6c82('0x31')]};});_0x43b999[_0x6c82('0x32')]=_[_0x6c82('0x2e')](_0x3443fa,_0x6c82('0x33'));_0x43b999[_0x6c82('0x34')]=_['keys'](_0x18e332[_0x6c82('0x34')]);_0x43b999['filters']=_[_0x6c82('0x35')](_0x43b999[_0x6c82('0x32')],_0x43b999[_0x6c82('0x34')]);_0x522938[_0x6c82('0x36')]=_['intersection'](_0x43b999[_0x6c82('0x32')],qs['fields'](_0x18e332['query'][_0x6c82('0x37')]));_0x522938['attributes']=_0x522938[_0x6c82('0x36')][_0x6c82('0x38')]?_0x522938[_0x6c82('0x36')]:_0x43b999['model'];if(!_0x18e332[_0x6c82('0x34')][_0x6c82('0x39')](_0x6c82('0x3a'))){_0x522938['limit']=qs[_0x6c82('0x20')](_0x18e332[_0x6c82('0x34')][_0x6c82('0x20')]);_0x522938[_0x6c82('0x22')]=qs['offset'](_0x18e332[_0x6c82('0x34')][_0x6c82('0x22')]);}_0x522938[_0x6c82('0x3b')]=qs[_0x6c82('0x3c')](_0x18e332[_0x6c82('0x34')][_0x6c82('0x3c')]);_0x522938[_0x6c82('0x3d')]=qs[_0x6c82('0x3e')](_[_0x6c82('0x3f')](_0x18e332['query'],_0x43b999[_0x6c82('0x3e')]),_0x3443fa);if(_0x18e332[_0x6c82('0x34')][_0x6c82('0x40')]){_0x522938['where']=_[_0x6c82('0x41')](_0x522938[_0x6c82('0x3d')],{'$or':_[_0x6c82('0x2e')](_0x3443fa,function(_0x10dd22){if(_0x10dd22[_0x6c82('0x42')]!=='VIRTUAL'){var _0x430e7b={};_0x430e7b[_0x10dd22[_0x6c82('0x33')]]={'$like':'%'+_0x18e332[_0x6c82('0x34')][_0x6c82('0x40')]+'%'};return _0x430e7b;}})});}_0x522938=_[_0x6c82('0x41')]({},_0x522938,_0x18e332[_0x6c82('0x43')]);var _0x186419={'where':_0x522938['where']};return db[_0x6c82('0x44')][_0x6c82('0x21')](_0x186419)[_0x6c82('0x28')](function(_0x34d7f4){_0xb061b0['count']=_0x34d7f4;if(_0x18e332[_0x6c82('0x34')]['includeAll']){_0x522938[_0x6c82('0x45')]=[{'all':!![]}];}return db[_0x6c82('0x44')][_0x6c82('0x46')](_0x522938);})[_0x6c82('0x28')](function(_0x2640d8){_0xb061b0[_0x6c82('0x47')]=_0x2640d8;return _0xb061b0;})[_0x6c82('0x28')](respondWithFilteredResult(_0x4c1bf2,_0x522938))['catch'](handleError(_0x4c1bf2,null));};exports[_0x6c82('0x48')]=function(_0x5c61da,_0x1c544c){var _0x5a6844={'raw':![],'where':{'id':_0x5c61da[_0x6c82('0x49')]['id']}},_0x5ac3ba={};_0x5ac3ba[_0x6c82('0x32')]=_['keys'](db[_0x6c82('0x44')][_0x6c82('0x2f')]);_0x5ac3ba[_0x6c82('0x34')]=_[_0x6c82('0x4a')](_0x5c61da[_0x6c82('0x34')]);_0x5ac3ba[_0x6c82('0x3e')]=_[_0x6c82('0x35')](_0x5ac3ba[_0x6c82('0x32')],_0x5ac3ba[_0x6c82('0x34')]);_0x5a6844[_0x6c82('0x36')]=_['intersection'](_0x5ac3ba[_0x6c82('0x32')],qs['fields'](_0x5c61da[_0x6c82('0x34')][_0x6c82('0x37')]));_0x5a6844[_0x6c82('0x36')]=_0x5a6844[_0x6c82('0x36')]['length']?_0x5a6844[_0x6c82('0x36')]:_0x5ac3ba[_0x6c82('0x32')];if(_0x5c61da['query'][_0x6c82('0x4b')]){_0x5a6844[_0x6c82('0x45')]=[{'all':!![]}];}_0x5a6844=_[_0x6c82('0x41')]({},_0x5a6844,_0x5c61da[_0x6c82('0x43')]);return db['SalesforceConfiguration'][_0x6c82('0x4c')](_0x5a6844)[_0x6c82('0x28')](handleEntityNotFound(_0x1c544c,null))['then'](respondWithResult(_0x1c544c,null))[_0x6c82('0x4d')](handleError(_0x1c544c,null));};exports[_0x6c82('0x4e')]=function(_0x1147e6,_0x348bb5){return db['SalesforceConfiguration'][_0x6c82('0x4e')](_0x1147e6[_0x6c82('0x4f')],{})[_0x6c82('0x28')](respondWithResult(_0x348bb5,0xc9))[_0x6c82('0x4d')](handleError(_0x348bb5,null));};exports['update']=function(_0x15e4bb,_0x30c688){if(_0x15e4bb[_0x6c82('0x4f')]['id']){delete _0x15e4bb[_0x6c82('0x4f')]['id'];}return db[_0x6c82('0x44')]['find']({'where':{'id':_0x15e4bb[_0x6c82('0x49')]['id']}})[_0x6c82('0x28')](handleEntityNotFound(_0x30c688,null))['then'](saveUpdates(_0x15e4bb[_0x6c82('0x4f')],null))['then'](respondWithResult(_0x30c688,null))[_0x6c82('0x4d')](handleError(_0x30c688,null));};exports[_0x6c82('0x29')]=function(_0x352aca,_0x1f147c){return db['SalesforceConfiguration'][_0x6c82('0x4c')]({'where':{'id':_0x352aca[_0x6c82('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f147c,null))[_0x6c82('0x28')](removeEntity(_0x1f147c,null))[_0x6c82('0x4d')](handleError(_0x1f147c,null));};exports[_0x6c82('0x50')]=function(_0x3deef5,_0xf29eb9,_0x17d297){var _0x1f0aed={};var _0x42f813={};var _0xd4f761;var _0x14aaad;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3deef5[_0x6c82('0x49')]['id']}})[_0x6c82('0x28')](handleEntityNotFound(_0xf29eb9,null))[_0x6c82('0x28')](function(_0x3a0a17){if(_0x3a0a17){_0xd4f761=_0x3a0a17;_0x42f813['model']=_[_0x6c82('0x4a')](db[_0x6c82('0x51')][_0x6c82('0x2f')]);_0x42f813[_0x6c82('0x34')]=_[_0x6c82('0x4a')](_0x3deef5['query']);_0x42f813['filters']=_[_0x6c82('0x35')](_0x42f813['model'],_0x42f813[_0x6c82('0x34')]);_0x1f0aed['attributes']=_['intersection'](_0x42f813[_0x6c82('0x32')],qs[_0x6c82('0x37')](_0x3deef5['query'][_0x6c82('0x37')]));_0x1f0aed[_0x6c82('0x36')]=_0x1f0aed['attributes'][_0x6c82('0x38')]?_0x1f0aed[_0x6c82('0x36')]:_0x42f813[_0x6c82('0x32')];_0x1f0aed[_0x6c82('0x3b')]=qs[_0x6c82('0x3c')](_0x3deef5['query'][_0x6c82('0x3c')]);_0x1f0aed[_0x6c82('0x3d')]=qs[_0x6c82('0x3e')](_[_0x6c82('0x3f')](_0x3deef5[_0x6c82('0x34')],_0x42f813[_0x6c82('0x3e')]));if(_0x3deef5[_0x6c82('0x34')][_0x6c82('0x40')]){_0x1f0aed[_0x6c82('0x3d')]=_[_0x6c82('0x41')](_0x1f0aed['where'],{'$or':_[_0x6c82('0x2e')](_0x1f0aed[_0x6c82('0x36')],function(_0x207d70){var _0x5779a1={};_0x5779a1[_0x207d70]={'$like':'%'+_0x3deef5[_0x6c82('0x34')][_0x6c82('0x40')]+'%'};return _0x5779a1;})});}_0x1f0aed=_[_0x6c82('0x41')]({},_0x1f0aed,_0x3deef5[_0x6c82('0x43')]);return _0xd4f761[_0x6c82('0x50')](_0x1f0aed);}})['then'](function(_0x46d92d){if(_0x46d92d){_0x14aaad=_0x46d92d['length'];if(!_0x3deef5[_0x6c82('0x34')][_0x6c82('0x39')](_0x6c82('0x3a'))){_0x1f0aed[_0x6c82('0x20')]=qs['limit'](_0x3deef5['query'][_0x6c82('0x20')]);_0x1f0aed[_0x6c82('0x22')]=qs[_0x6c82('0x22')](_0x3deef5[_0x6c82('0x34')][_0x6c82('0x22')]);}return _0xd4f761[_0x6c82('0x50')](_0x1f0aed);}})[_0x6c82('0x28')](function(_0x1796b5){if(_0x1796b5){return _0x1796b5?{'count':_0x14aaad,'rows':_0x1796b5}:null;}})['then'](respondWithResult(_0xf29eb9,null))['catch'](handleError(_0xf29eb9,null));};exports[_0x6c82('0x52')]=function(_0x291ac0,_0x9aa11e,_0x38f720){var _0x1bf4cc={};var _0x517afb={};var _0x50ffe0;var _0x516c19;return db[_0x6c82('0x44')]['findOne']({'where':{'id':_0x291ac0[_0x6c82('0x49')]['id']}})[_0x6c82('0x28')](handleEntityNotFound(_0x9aa11e,null))[_0x6c82('0x28')](function(_0x353bdc){if(_0x353bdc){_0x50ffe0=_0x353bdc;_0x517afb[_0x6c82('0x32')]=_[_0x6c82('0x4a')](db[_0x6c82('0x51')][_0x6c82('0x2f')]);_0x517afb['query']=_['keys'](_0x291ac0[_0x6c82('0x34')]);_0x517afb['filters']=_[_0x6c82('0x35')](_0x517afb[_0x6c82('0x32')],_0x517afb[_0x6c82('0x34')]);_0x1bf4cc[_0x6c82('0x36')]=_[_0x6c82('0x35')](_0x517afb[_0x6c82('0x32')],qs[_0x6c82('0x37')](_0x291ac0[_0x6c82('0x34')][_0x6c82('0x37')]));_0x1bf4cc[_0x6c82('0x36')]=_0x1bf4cc[_0x6c82('0x36')][_0x6c82('0x38')]?_0x1bf4cc[_0x6c82('0x36')]:_0x517afb[_0x6c82('0x32')];_0x1bf4cc[_0x6c82('0x3b')]=qs[_0x6c82('0x3c')](_0x291ac0[_0x6c82('0x34')][_0x6c82('0x3c')]);_0x1bf4cc[_0x6c82('0x3d')]=qs['filters'](_[_0x6c82('0x3f')](_0x291ac0['query'],_0x517afb['filters']));if(_0x291ac0['query'][_0x6c82('0x40')]){_0x1bf4cc[_0x6c82('0x3d')]=_[_0x6c82('0x41')](_0x1bf4cc[_0x6c82('0x3d')],{'$or':_[_0x6c82('0x2e')](_0x1bf4cc[_0x6c82('0x36')],function(_0x484541){var _0x26d864={};_0x26d864[_0x484541]={'$like':'%'+_0x291ac0[_0x6c82('0x34')][_0x6c82('0x40')]+'%'};return _0x26d864;})});}_0x1bf4cc=_[_0x6c82('0x41')]({},_0x1bf4cc,_0x291ac0[_0x6c82('0x43')]);return _0x50ffe0[_0x6c82('0x52')](_0x1bf4cc);}})['then'](function(_0x21b227){if(_0x21b227){_0x516c19=_0x21b227[_0x6c82('0x38')];if(!_0x291ac0[_0x6c82('0x34')][_0x6c82('0x39')]('nolimit')){_0x1bf4cc[_0x6c82('0x20')]=qs[_0x6c82('0x20')](_0x291ac0[_0x6c82('0x34')][_0x6c82('0x20')]);_0x1bf4cc[_0x6c82('0x22')]=qs[_0x6c82('0x22')](_0x291ac0[_0x6c82('0x34')][_0x6c82('0x22')]);}return _0x50ffe0[_0x6c82('0x52')](_0x1bf4cc);}})[_0x6c82('0x28')](function(_0x35d4ac){if(_0x35d4ac){return _0x35d4ac?{'count':_0x516c19,'rows':_0x35d4ac}:null;}})[_0x6c82('0x28')](respondWithResult(_0x9aa11e,null))[_0x6c82('0x4d')](handleError(_0x9aa11e,null));};exports[_0x6c82('0x53')]=function(_0x39b03f,_0x5cfe9d,_0x3fb8eb){var _0x3449ab={};var _0x5bfac9={};var _0x2c5478;var _0x5ee7ce;return db['SalesforceConfiguration'][_0x6c82('0x54')]({'where':{'id':_0x39b03f[_0x6c82('0x49')]['id']}})[_0x6c82('0x28')](handleEntityNotFound(_0x5cfe9d,null))[_0x6c82('0x28')](function(_0x37d9fc){if(_0x37d9fc){_0x2c5478=_0x37d9fc;_0x5bfac9[_0x6c82('0x32')]=_[_0x6c82('0x4a')](db[_0x6c82('0x51')][_0x6c82('0x2f')]);_0x5bfac9[_0x6c82('0x34')]=_[_0x6c82('0x4a')](_0x39b03f[_0x6c82('0x34')]);_0x5bfac9[_0x6c82('0x3e')]=_['intersection'](_0x5bfac9[_0x6c82('0x32')],_0x5bfac9[_0x6c82('0x34')]);_0x3449ab[_0x6c82('0x36')]=_[_0x6c82('0x35')](_0x5bfac9[_0x6c82('0x32')],qs[_0x6c82('0x37')](_0x39b03f['query'][_0x6c82('0x37')]));_0x3449ab[_0x6c82('0x36')]=_0x3449ab[_0x6c82('0x36')]['length']?_0x3449ab[_0x6c82('0x36')]:_0x5bfac9[_0x6c82('0x32')];_0x3449ab[_0x6c82('0x3b')]=qs['sort'](_0x39b03f[_0x6c82('0x34')][_0x6c82('0x3c')]);_0x3449ab[_0x6c82('0x3d')]=qs['filters'](_['pick'](_0x39b03f['query'],_0x5bfac9[_0x6c82('0x3e')]));if(_0x39b03f['query']['filter']){_0x3449ab[_0x6c82('0x3d')]=_[_0x6c82('0x41')](_0x3449ab[_0x6c82('0x3d')],{'$or':_['map'](_0x3449ab['attributes'],function(_0x1a66c6){var _0x4a4ab6={};_0x4a4ab6[_0x1a66c6]={'$like':'%'+_0x39b03f[_0x6c82('0x34')][_0x6c82('0x40')]+'%'};return _0x4a4ab6;})});}_0x3449ab=_['merge']({},_0x3449ab,_0x39b03f[_0x6c82('0x43')]);return _0x2c5478[_0x6c82('0x53')](_0x3449ab);}})[_0x6c82('0x28')](function(_0x2015fe){if(_0x2015fe){_0x5ee7ce=_0x2015fe[_0x6c82('0x38')];if(!_0x39b03f[_0x6c82('0x34')]['hasOwnProperty']('nolimit')){_0x3449ab[_0x6c82('0x20')]=qs[_0x6c82('0x20')](_0x39b03f[_0x6c82('0x34')][_0x6c82('0x20')]);_0x3449ab[_0x6c82('0x22')]=qs[_0x6c82('0x22')](_0x39b03f['query'][_0x6c82('0x22')]);}return _0x2c5478['getDescriptions'](_0x3449ab);}})[_0x6c82('0x28')](function(_0x815c44){if(_0x815c44){return _0x815c44?{'count':_0x5ee7ce,'rows':_0x815c44}:null;}})[_0x6c82('0x28')](respondWithResult(_0x5cfe9d,null))[_0x6c82('0x4d')](handleError(_0x5cfe9d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a4fe8c3..2b2cd05 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 _0xf54d=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x10785c,_0x351b22){var _0x20899c=function(_0x3f9f84){while(--_0x3f9f84){_0x10785c['push'](_0x10785c['shift']());}};_0x20899c(++_0x351b22);}(_0xf54d,0xa3));var _0xdf54=function(_0x3b1b14,_0x448554){_0x3b1b14=_0x3b1b14-0x0;var _0x2c3fc5=_0xf54d[_0x3b1b14];return _0x2c3fc5;};'use strict';var _=require(_0xdf54('0x0'));var util=require(_0xdf54('0x1'));var logger=require('../../config/logger')(_0xdf54('0x2'));var moment=require(_0xdf54('0x3'));var BPromise=require(_0xdf54('0x4'));var rp=require(_0xdf54('0x5'));var fs=require('fs');var path=require(_0xdf54('0x6'));var rimraf=require(_0xdf54('0x7'));var config=require(_0xdf54('0x8'));var attributes=require(_0xdf54('0x9'));module['exports']=function(_0x144b1b,_0x381fcb){return _0x144b1b[_0xdf54('0xa')](_0xdf54('0xb'),attributes,{'tableName':_0xdf54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ee6=['exports','define','int_salesforce_configurations','lodash','util','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1702d5,_0x2f7dc6){var _0x5ff5d3=function(_0x5d7683){while(--_0x5d7683){_0x1702d5['push'](_0x1702d5['shift']());}};_0x5ff5d3(++_0x2f7dc6);}(_0x0ee6,0xc9));var _0x60ee=function(_0x32758e,_0x269e0b){_0x32758e=_0x32758e-0x0;var _0x14b647=_0x0ee6[_0x32758e];return _0x14b647;};'use strict';var _=require(_0x60ee('0x0'));var util=require(_0x60ee('0x1'));var logger=require('../../config/logger')(_0x60ee('0x2'));var moment=require(_0x60ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x60ee('0x4'));var fs=require('fs');var path=require(_0x60ee('0x5'));var rimraf=require('rimraf');var config=require(_0x60ee('0x6'));var attributes=require(_0x60ee('0x7'));module[_0x60ee('0x8')]=function(_0x3f6e45,_0x42de21){return _0x3f6e45[_0x60ee('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x60ee('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 9b11b4c..576eca4 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 _0x17ee=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x3bc5a1,_0x530b19){var _0x5d23a3=function(_0x25253f){while(--_0x25253f){_0x3bc5a1['push'](_0x3bc5a1['shift']());}};_0x5d23a3(++_0x530b19);}(_0x17ee,0x67));var _0xe17e=function(_0x39e5a1,_0x3c80e5){_0x39e5a1=_0x39e5a1-0x0;var _0x29f7bf=_0x17ee[_0x39e5a1];return _0x29f7bf;};'use strict';var _=require('lodash');var util=require(_0xe17e('0x0'));var moment=require('moment');var BPromise=require(_0xe17e('0x1'));var rs=require(_0xe17e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe17e('0x3'))(_0xe17e('0x4'));var config=require(_0xe17e('0x5'));var jayson=require(_0xe17e('0x6'));var client=jayson[_0xe17e('0x7')][_0xe17e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44a52f,_0x230bba,_0x342c48){return new BPromise(function(_0xaf784e,_0x528aa7){return client['request'](_0x44a52f,_0x342c48)[_0xe17e('0x9')](function(_0x21a091){logger[_0xe17e('0xa')](_0xe17e('0xb'),_0x230bba,_0xe17e('0xc'));logger[_0xe17e('0xd')](_0xe17e('0xe'),_0x230bba,_0xe17e('0xc'),JSON[_0xe17e('0xf')](_0x21a091));if(_0x21a091['error']){if(_0x21a091[_0xe17e('0x10')][_0xe17e('0x11')]===0x1f4){logger[_0xe17e('0x10')](_0xe17e('0xb'),_0x230bba,_0x21a091[_0xe17e('0x10')][_0xe17e('0x12')]);return _0x528aa7(_0x21a091[_0xe17e('0x10')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x230bba,_0x21a091[_0xe17e('0x10')][_0xe17e('0x12')]);return _0xaf784e(_0x21a091[_0xe17e('0x10')][_0xe17e('0x12')]);}else{logger['info'](_0xe17e('0xb'),_0x230bba,_0xe17e('0xc'));_0xaf784e(_0x21a091[_0xe17e('0x13')]['message']);}})[_0xe17e('0x14')](function(_0x54ba20){logger[_0xe17e('0x10')](_0xe17e('0xb'),_0x230bba,_0x54ba20);_0x528aa7(_0x54ba20);});});} \ No newline at end of file +var _0xc001=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc001,0x9c));var _0x1c00=function(_0x161a44,_0x362901){_0x161a44=_0x161a44-0x0;var _0x3fff0a=_0xc001[_0x161a44];return _0x3fff0a;};'use strict';var _=require(_0x1c00('0x0'));var util=require(_0x1c00('0x1'));var moment=require(_0x1c00('0x2'));var BPromise=require(_0x1c00('0x3'));var rs=require(_0x1c00('0x4'));var fs=require('fs');var Redis=require(_0x1c00('0x5'));var db=require(_0x1c00('0x6'))['db'];var utils=require(_0x1c00('0x7'));var logger=require(_0x1c00('0x8'))(_0x1c00('0x9'));var config=require(_0x1c00('0xa'));var jayson=require(_0x1c00('0xb'));var client=jayson[_0x1c00('0xc')][_0x1c00('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a7db2,_0x124400,_0x6354bf){return new BPromise(function(_0x55ebfb,_0x326514){return client['request'](_0x3a7db2,_0x6354bf)[_0x1c00('0xe')](function(_0x4c7c05){logger[_0x1c00('0xf')](_0x1c00('0x10'),_0x124400,_0x1c00('0x11'));logger[_0x1c00('0x12')](_0x1c00('0x13'),_0x124400,_0x1c00('0x11'),JSON[_0x1c00('0x14')](_0x4c7c05));if(_0x4c7c05[_0x1c00('0x15')]){if(_0x4c7c05[_0x1c00('0x15')][_0x1c00('0x16')]===0x1f4){logger[_0x1c00('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x124400,_0x4c7c05['error'][_0x1c00('0x17')]);return _0x326514(_0x4c7c05[_0x1c00('0x15')]['message']);}logger['error'](_0x1c00('0x10'),_0x124400,_0x4c7c05['error'][_0x1c00('0x17')]);return _0x55ebfb(_0x4c7c05['error'][_0x1c00('0x17')]);}else{logger['info'](_0x1c00('0x10'),_0x124400,'request\x20sent');_0x55ebfb(_0x4c7c05[_0x1c00('0x18')][_0x1c00('0x17')]);}})['catch'](function(_0x353dc8){logger[_0x1c00('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x124400,_0x353dc8);_0x326514(_0x353dc8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 04ee8a7..d5d875c 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 _0x8372=['/:id','show','post','isAuthenticated','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','get'];(function(_0x14740d,_0xd2e03a){var _0x3b0455=function(_0x29bf6b){while(--_0x29bf6b){_0x14740d['push'](_0x14740d['shift']());}};_0x3b0455(++_0xd2e03a);}(_0x8372,0x85));var _0x2837=function(_0xa899eb,_0x186495){_0xa899eb=_0xa899eb-0x0;var _0x4952a2=_0x8372[_0xa899eb];return _0x4952a2;};'use strict';var multer=require(_0x2837('0x0'));var util=require(_0x2837('0x1'));var path=require(_0x2837('0x2'));var timeout=require(_0x2837('0x3'));var express=require(_0x2837('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2837('0x5'));var interaction=require(_0x2837('0x6'));var config=require(_0x2837('0x7'));var controller=require(_0x2837('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2837('0x9')]);router[_0x2837('0xa')](_0x2837('0xb'),auth['isAuthenticated'](),controller[_0x2837('0xc')]);router[_0x2837('0xd')]('/',auth[_0x2837('0xe')](),controller['create']);router[_0x2837('0xf')](_0x2837('0xb'),auth[_0x2837('0xe')](),controller[_0x2837('0x10')]);router[_0x2837('0x11')](_0x2837('0xb'),auth[_0x2837('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c3c=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','show','create','/:id','update'];(function(_0x1d93de,_0x4e102e){var _0x2a7e9a=function(_0x343cf4){while(--_0x343cf4){_0x1d93de['push'](_0x1d93de['shift']());}};_0x2a7e9a(++_0x4e102e);}(_0x8c3c,0x6f));var _0xc8c3=function(_0x9f9788,_0x33bd7b){_0x9f9788=_0x9f9788-0x0;var _0x18138a=_0x8c3c[_0x9f9788];return _0x18138a;};'use strict';var multer=require(_0xc8c3('0x0'));var util=require(_0xc8c3('0x1'));var path=require('path');var timeout=require(_0xc8c3('0x2'));var express=require('express');var router=express[_0xc8c3('0x3')]();var fs_extra=require(_0xc8c3('0x4'));var auth=require(_0xc8c3('0x5'));var interaction=require(_0xc8c3('0x6'));var config=require('../../config/environment');var controller=require(_0xc8c3('0x7'));router['get']('/',auth[_0xc8c3('0x8')](),controller[_0xc8c3('0x9')]);router[_0xc8c3('0xa')]('/:id',auth[_0xc8c3('0x8')](),controller[_0xc8c3('0xb')]);router['post']('/',auth[_0xc8c3('0x8')](),controller[_0xc8c3('0xc')]);router['put'](_0xc8c3('0xd'),auth[_0xc8c3('0x8')](),controller[_0xc8c3('0xe')]);router[_0xc8c3('0xf')](_0xc8c3('0xd'),auth['isAuthenticated'](),controller[_0xc8c3('0x10')]);module[_0xc8c3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cb52632..91159db 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 _0x54eb=['exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xab11ef,_0x516fa3){var _0x2966b7=function(_0x239ae6){while(--_0x239ae6){_0xab11ef['push'](_0xab11ef['shift']());}};_0x2966b7(++_0x516fa3);}(_0x54eb,0x10a));var _0xb54e=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x54eb[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0xb54e('0x0')]={'type':{'type':Sequelize[_0xb54e('0x1')](_0xb54e('0x2'),_0xb54e('0x3'),_0xb54e('0x4'),_0xb54e('0x5'),'picklist'),'defaultValue':_0xb54e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb54e('0x6')]},'keyType':{'type':Sequelize[_0xb54e('0x1')](_0xb54e('0x2'),_0xb54e('0x3'),_0xb54e('0x4'))},'keyContent':{'type':Sequelize[_0xb54e('0x6')]},'idField':{'type':Sequelize[_0xb54e('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x585b=['picklist','STRING','string','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x4c96c8,_0x301176){var _0x8fb696=function(_0x20d8b9){while(--_0x20d8b9){_0x4c96c8['push'](_0x4c96c8['shift']());}};_0x8fb696(++_0x301176);}(_0x585b,0x73));var _0xb585=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x585b[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xb585('0x0'));module['exports']={'type':{'type':Sequelize[_0xb585('0x1')]('string',_0xb585('0x2'),_0xb585('0x3'),_0xb585('0x4'),_0xb585('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb585('0x6')]},'key':{'type':Sequelize[_0xb585('0x6')]},'keyType':{'type':Sequelize[_0xb585('0x1')](_0xb585('0x7'),'variable',_0xb585('0x3'))},'keyContent':{'type':Sequelize[_0xb585('0x6')]},'idField':{'type':Sequelize[_0xb585('0x6')]},'variableName':{'type':Sequelize[_0xb585('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c9eebcf..84769f5 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 _0x78de=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','attributes','include','options','find','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4820b8,_0x12fb64){var _0x2cebd4=function(_0x330163){while(--_0x330163){_0x4820b8['push'](_0x4820b8['shift']());}};_0x2cebd4(++_0x12fb64);}(_0x78de,0x7d));var _0xe78d=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x78de[_0x3f00ee];return _0x18a07e;};'use strict';var emlformat=require(_0xe78d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe78d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe78d('0x2'));var moment=require(_0xe78d('0x3'));var BPromise=require(_0xe78d('0x4'));var Mustache=require(_0xe78d('0x5'));var util=require(_0xe78d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe78d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe78d('0x8'));var _=require('lodash');var squel=require(_0xe78d('0x9'));var crypto=require(_0xe78d('0xa'));var jsforce=require(_0xe78d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe78d('0x7'));var querystring=require('querystring');var Papa=require(_0xe78d('0xc'));var Redis=require(_0xe78d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe78d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe78d('0xf'));var logger=require(_0xe78d('0x10'))(_0xe78d('0x11'));var utils=require(_0xe78d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe78d('0x13'));var db=require(_0xe78d('0x14'))['db'];function respondWithStatusCode(_0x33e3a8,_0x3059b2){_0x3059b2=_0x3059b2||0xcc;return function(_0x4cc161){if(_0x4cc161){return _0x33e3a8[_0xe78d('0x15')](_0x3059b2);}return _0x33e3a8[_0xe78d('0x16')](_0x3059b2)[_0xe78d('0x17')]();};}function respondWithResult(_0x32d502,_0x41feb7){_0x41feb7=_0x41feb7||0xc8;return function(_0x36b00d){if(_0x36b00d){return _0x32d502[_0xe78d('0x16')](_0x41feb7)['json'](_0x36b00d);}};}function respondWithFilteredResult(_0x2abde,_0x1c116f){return function(_0x39e3ec){if(_0x39e3ec){var _0xc88012=typeof _0x1c116f[_0xe78d('0x18')]===_0xe78d('0x19')&&typeof _0x1c116f[_0xe78d('0x1a')]==='undefined';var _0x153ac6=_0x39e3ec['count'];var _0x28cda3=_0xc88012?0x0:_0x1c116f['offset'];var _0x356e13=_0xc88012?_0x39e3ec[_0xe78d('0x1b')]:_0x1c116f[_0xe78d('0x18')]+_0x1c116f[_0xe78d('0x1a')];var _0x5c942c;if(_0x356e13>=_0x153ac6){_0x356e13=_0x153ac6;_0x5c942c=0xc8;}else{_0x5c942c=0xce;}_0x2abde[_0xe78d('0x16')](_0x5c942c);return _0x2abde[_0xe78d('0x1c')](_0xe78d('0x1d'),_0x28cda3+'-'+_0x356e13+'/'+_0x153ac6)[_0xe78d('0x1e')](_0x39e3ec);}return null;};}function patchUpdates(_0x1e0319){return function(_0x4157ef){try{jsonpatch[_0xe78d('0x1f')](_0x4157ef,_0x1e0319,!![]);}catch(_0x153827){return BPromise[_0xe78d('0x20')](_0x153827);}return _0x4157ef['save']();};}function saveUpdates(_0x26647b,_0x2716c4){return function(_0x34a1e6){if(_0x34a1e6){return _0x34a1e6[_0xe78d('0x21')](_0x26647b)[_0xe78d('0x22')](function(_0x4bfd42){return _0x4bfd42;});}return null;};}function removeEntity(_0x4114c7,_0x3243c1){return function(_0x5d54cf){if(_0x5d54cf){return _0x5d54cf['destroy']()['then'](function(){_0x4114c7[_0xe78d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e587,_0x3aba57){return function(_0x4f358b){if(!_0x4f358b){_0x51e587[_0xe78d('0x15')](0x194);}return _0x4f358b;};}function handleError(_0x10994a,_0x462eb2){_0x462eb2=_0x462eb2||0x1f4;return function(_0x9cdeb7){logger['error'](_0x9cdeb7[_0xe78d('0x23')]);if(_0x9cdeb7[_0xe78d('0x24')]){delete _0x9cdeb7[_0xe78d('0x24')];}_0x10994a[_0xe78d('0x16')](_0x462eb2)[_0xe78d('0x25')](_0x9cdeb7);};}exports['index']=function(_0x5c6bc3,_0x68eb87){var _0x1488a6={},_0x50cd08={},_0x31e3c9={'count':0x0,'rows':[]};var _0x4c0c68=_[_0xe78d('0x26')](db[_0xe78d('0x27')][_0xe78d('0x28')],function(_0x12c500){return{'name':_0x12c500[_0xe78d('0x29')],'type':_0x12c500[_0xe78d('0x2a')][_0xe78d('0x2b')]};});_0x50cd08[_0xe78d('0x2c')]=_['map'](_0x4c0c68,_0xe78d('0x24'));_0x50cd08[_0xe78d('0x2d')]=_[_0xe78d('0x2e')](_0x5c6bc3['query']);_0x50cd08[_0xe78d('0x2f')]=_[_0xe78d('0x30')](_0x50cd08[_0xe78d('0x2c')],_0x50cd08[_0xe78d('0x2d')]);_0x1488a6['attributes']=_[_0xe78d('0x30')](_0x50cd08[_0xe78d('0x2c')],qs[_0xe78d('0x31')](_0x5c6bc3[_0xe78d('0x2d')][_0xe78d('0x31')]));_0x1488a6['attributes']=_0x1488a6['attributes'][_0xe78d('0x32')]?_0x1488a6['attributes']:_0x50cd08[_0xe78d('0x2c')];if(!_0x5c6bc3[_0xe78d('0x2d')]['hasOwnProperty'](_0xe78d('0x33'))){_0x1488a6['limit']=qs[_0xe78d('0x1a')](_0x5c6bc3[_0xe78d('0x2d')][_0xe78d('0x1a')]);_0x1488a6[_0xe78d('0x18')]=qs[_0xe78d('0x18')](_0x5c6bc3[_0xe78d('0x2d')][_0xe78d('0x18')]);}_0x1488a6[_0xe78d('0x34')]=qs[_0xe78d('0x35')](_0x5c6bc3[_0xe78d('0x2d')][_0xe78d('0x35')]);_0x1488a6[_0xe78d('0x36')]=qs['filters'](_['pick'](_0x5c6bc3['query'],_0x50cd08[_0xe78d('0x2f')]),_0x4c0c68);if(_0x5c6bc3[_0xe78d('0x2d')][_0xe78d('0x37')]){_0x1488a6[_0xe78d('0x36')]=_[_0xe78d('0x38')](_0x1488a6['where'],{'$or':_[_0xe78d('0x26')](_0x4c0c68,function(_0x4112d4){if(_0x4112d4['type']!==_0xe78d('0x39')){var _0x4bf089={};_0x4bf089[_0x4112d4[_0xe78d('0x24')]]={'$like':'%'+_0x5c6bc3[_0xe78d('0x2d')]['filter']+'%'};return _0x4bf089;}})});}_0x1488a6=_[_0xe78d('0x38')]({},_0x1488a6,_0x5c6bc3['options']);var _0x534baa={'where':_0x1488a6[_0xe78d('0x36')]};return db[_0xe78d('0x27')][_0xe78d('0x1b')](_0x534baa)[_0xe78d('0x22')](function(_0x35c91c){_0x31e3c9[_0xe78d('0x1b')]=_0x35c91c;if(_0x5c6bc3['query'][_0xe78d('0x3a')]){_0x1488a6['include']=[{'all':!![]}];}return db[_0xe78d('0x27')][_0xe78d('0x3b')](_0x1488a6);})['then'](function(_0xb88604){_0x31e3c9[_0xe78d('0x3c')]=_0xb88604;return _0x31e3c9;})[_0xe78d('0x22')](respondWithFilteredResult(_0x68eb87,_0x1488a6))[_0xe78d('0x3d')](handleError(_0x68eb87,null));};exports[_0xe78d('0x3e')]=function(_0x35e95a,_0x576182){var _0x28dc27={'raw':!![],'where':{'id':_0x35e95a[_0xe78d('0x3f')]['id']}},_0x204821={};_0x204821[_0xe78d('0x2c')]=_['keys'](db[_0xe78d('0x27')][_0xe78d('0x28')]);_0x204821['query']=_[_0xe78d('0x2e')](_0x35e95a[_0xe78d('0x2d')]);_0x204821[_0xe78d('0x2f')]=_['intersection'](_0x204821['model'],_0x204821[_0xe78d('0x2d')]);_0x28dc27[_0xe78d('0x40')]=_['intersection'](_0x204821[_0xe78d('0x2c')],qs[_0xe78d('0x31')](_0x35e95a['query'][_0xe78d('0x31')]));_0x28dc27[_0xe78d('0x40')]=_0x28dc27[_0xe78d('0x40')][_0xe78d('0x32')]?_0x28dc27[_0xe78d('0x40')]:_0x204821[_0xe78d('0x2c')];if(_0x35e95a['query'][_0xe78d('0x3a')]){_0x28dc27[_0xe78d('0x41')]=[{'all':!![]}];}_0x28dc27=_['merge']({},_0x28dc27,_0x35e95a[_0xe78d('0x42')]);return db[_0xe78d('0x27')][_0xe78d('0x43')](_0x28dc27)[_0xe78d('0x22')](handleEntityNotFound(_0x576182,null))[_0xe78d('0x22')](respondWithResult(_0x576182,null))[_0xe78d('0x3d')](handleError(_0x576182,null));};exports[_0xe78d('0x44')]=function(_0x3b5243,_0x5e3903){return db[_0xe78d('0x27')][_0xe78d('0x44')](_0x3b5243[_0xe78d('0x45')],{})[_0xe78d('0x22')](respondWithResult(_0x5e3903,0xc9))[_0xe78d('0x3d')](handleError(_0x5e3903,null));};exports[_0xe78d('0x21')]=function(_0xf1838b,_0x33c1a7){if(_0xf1838b['body']['id']){delete _0xf1838b[_0xe78d('0x45')]['id'];}return db[_0xe78d('0x27')][_0xe78d('0x43')]({'where':{'id':_0xf1838b[_0xe78d('0x3f')]['id']}})[_0xe78d('0x22')](handleEntityNotFound(_0x33c1a7,null))[_0xe78d('0x22')](saveUpdates(_0xf1838b[_0xe78d('0x45')],null))[_0xe78d('0x22')](respondWithResult(_0x33c1a7,null))['catch'](handleError(_0x33c1a7,null));};exports[_0xe78d('0x46')]=function(_0xead77f,_0x19f1d1){return db[_0xe78d('0x27')][_0xe78d('0x43')]({'where':{'id':_0xead77f['params']['id']}})[_0xe78d('0x22')](handleEntityNotFound(_0x19f1d1,null))['then'](removeEntity(_0x19f1d1,null))[_0xe78d('0x3d')](handleError(_0x19f1d1,null));}; \ No newline at end of file +var _0x7127=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','options','includeAll','include','SalesforceField','rows','show','params','length','body','catch','find','eml-format'];(function(_0x533a68,_0x18c38d){var _0x2536a6=function(_0x243293){while(--_0x243293){_0x533a68['push'](_0x533a68['shift']());}};_0x2536a6(++_0x18c38d);}(_0x7127,0xd1));var _0x7712=function(_0x3af1e7,_0x3d904d){_0x3af1e7=_0x3af1e7-0x0;var _0x27c5bb=_0x7127[_0x3af1e7];return _0x27c5bb;};'use strict';var emlformat=require(_0x7712('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7712('0x1'));var jsonpatch=require(_0x7712('0x2'));var rp=require(_0x7712('0x3'));var moment=require(_0x7712('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7712('0x5'));var path=require(_0x7712('0x6'));var sox=require(_0x7712('0x7'));var csv=require(_0x7712('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7712('0x9'));var _=require(_0x7712('0xa'));var squel=require(_0x7712('0xb'));var crypto=require(_0x7712('0xc'));var jsforce=require(_0x7712('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7712('0xe'));var Redis=require(_0x7712('0xf'));var authService=require(_0x7712('0x10'));var qs=require(_0x7712('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7712('0x12'));var logger=require(_0x7712('0x13'))(_0x7712('0x14'));var utils=require(_0x7712('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7712('0x16'))['db'];function respondWithStatusCode(_0x18903b,_0x3b2afd){_0x3b2afd=_0x3b2afd||0xcc;return function(_0x1a6a0b){if(_0x1a6a0b){return _0x18903b[_0x7712('0x17')](_0x3b2afd);}return _0x18903b['status'](_0x3b2afd)['end']();};}function respondWithResult(_0xd3ce4d,_0x3c6eca){_0x3c6eca=_0x3c6eca||0xc8;return function(_0x32fb04){if(_0x32fb04){return _0xd3ce4d[_0x7712('0x18')](_0x3c6eca)[_0x7712('0x19')](_0x32fb04);}};}function respondWithFilteredResult(_0x5c6036,_0x5e8ea3){return function(_0x58cfb2){if(_0x58cfb2){var _0x433223=typeof _0x5e8ea3['offset']===_0x7712('0x1a')&&typeof _0x5e8ea3[_0x7712('0x1b')]===_0x7712('0x1a');var _0x5dedfb=_0x58cfb2[_0x7712('0x1c')];var _0x555a12=_0x433223?0x0:_0x5e8ea3[_0x7712('0x1d')];var _0x1aa150=_0x433223?_0x58cfb2['count']:_0x5e8ea3['offset']+_0x5e8ea3[_0x7712('0x1b')];var _0x111c01;if(_0x1aa150>=_0x5dedfb){_0x1aa150=_0x5dedfb;_0x111c01=0xc8;}else{_0x111c01=0xce;}_0x5c6036['status'](_0x111c01);return _0x5c6036[_0x7712('0x1e')]('Content-Range',_0x555a12+'-'+_0x1aa150+'/'+_0x5dedfb)[_0x7712('0x19')](_0x58cfb2);}return null;};}function patchUpdates(_0x40a63b){return function(_0x1c381f){try{jsonpatch[_0x7712('0x1f')](_0x1c381f,_0x40a63b,!![]);}catch(_0x579eaf){return BPromise[_0x7712('0x20')](_0x579eaf);}return _0x1c381f[_0x7712('0x21')]();};}function saveUpdates(_0x3a731e,_0x4f6cc9){return function(_0x56a771){if(_0x56a771){return _0x56a771[_0x7712('0x22')](_0x3a731e)[_0x7712('0x23')](function(_0xf1dcae){return _0xf1dcae;});}return null;};}function removeEntity(_0x2dfac4,_0x10c304){return function(_0x3d5b88){if(_0x3d5b88){return _0x3d5b88[_0x7712('0x24')]()[_0x7712('0x23')](function(){_0x2dfac4[_0x7712('0x18')](0xcc)[_0x7712('0x25')]();});}};}function handleEntityNotFound(_0x2db0a2,_0x1d5788){return function(_0x38c6b5){if(!_0x38c6b5){_0x2db0a2[_0x7712('0x17')](0x194);}return _0x38c6b5;};}function handleError(_0x27d993,_0x436def){_0x436def=_0x436def||0x1f4;return function(_0x3ee716){logger[_0x7712('0x26')](_0x3ee716['stack']);if(_0x3ee716['name']){delete _0x3ee716[_0x7712('0x27')];}_0x27d993['status'](_0x436def)[_0x7712('0x28')](_0x3ee716);};}exports[_0x7712('0x29')]=function(_0x331573,_0x2a2876){var _0x5c5550={},_0x4fbf17={},_0x4d818e={'count':0x0,'rows':[]};var _0x395d62=_[_0x7712('0x2a')](db['SalesforceField'][_0x7712('0x2b')],function(_0x16b385){return{'name':_0x16b385[_0x7712('0x2c')],'type':_0x16b385[_0x7712('0x2d')]['key']};});_0x4fbf17[_0x7712('0x2e')]=_[_0x7712('0x2a')](_0x395d62,_0x7712('0x27'));_0x4fbf17[_0x7712('0x2f')]=_[_0x7712('0x30')](_0x331573[_0x7712('0x2f')]);_0x4fbf17[_0x7712('0x31')]=_['intersection'](_0x4fbf17[_0x7712('0x2e')],_0x4fbf17[_0x7712('0x2f')]);_0x5c5550['attributes']=_[_0x7712('0x32')](_0x4fbf17[_0x7712('0x2e')],qs[_0x7712('0x33')](_0x331573[_0x7712('0x2f')][_0x7712('0x33')]));_0x5c5550[_0x7712('0x34')]=_0x5c5550[_0x7712('0x34')]['length']?_0x5c5550[_0x7712('0x34')]:_0x4fbf17['model'];if(!_0x331573['query']['hasOwnProperty']('nolimit')){_0x5c5550[_0x7712('0x1b')]=qs[_0x7712('0x1b')](_0x331573[_0x7712('0x2f')][_0x7712('0x1b')]);_0x5c5550[_0x7712('0x1d')]=qs[_0x7712('0x1d')](_0x331573['query']['offset']);}_0x5c5550[_0x7712('0x35')]=qs[_0x7712('0x36')](_0x331573['query'][_0x7712('0x36')]);_0x5c5550[_0x7712('0x37')]=qs[_0x7712('0x31')](_[_0x7712('0x38')](_0x331573[_0x7712('0x2f')],_0x4fbf17['filters']),_0x395d62);if(_0x331573[_0x7712('0x2f')][_0x7712('0x39')]){_0x5c5550[_0x7712('0x37')]=_[_0x7712('0x3a')](_0x5c5550[_0x7712('0x37')],{'$or':_[_0x7712('0x2a')](_0x395d62,function(_0x11e28b){if(_0x11e28b[_0x7712('0x2d')]!=='VIRTUAL'){var _0x5a38a4={};_0x5a38a4[_0x11e28b[_0x7712('0x27')]]={'$like':'%'+_0x331573['query'][_0x7712('0x39')]+'%'};return _0x5a38a4;}})});}_0x5c5550=_['merge']({},_0x5c5550,_0x331573[_0x7712('0x3b')]);var _0x39e2c6={'where':_0x5c5550[_0x7712('0x37')]};return db['SalesforceField'][_0x7712('0x1c')](_0x39e2c6)[_0x7712('0x23')](function(_0xe68017){_0x4d818e[_0x7712('0x1c')]=_0xe68017;if(_0x331573[_0x7712('0x2f')][_0x7712('0x3c')]){_0x5c5550[_0x7712('0x3d')]=[{'all':!![]}];}return db[_0x7712('0x3e')]['findAll'](_0x5c5550);})[_0x7712('0x23')](function(_0x12095e){_0x4d818e[_0x7712('0x3f')]=_0x12095e;return _0x4d818e;})[_0x7712('0x23')](respondWithFilteredResult(_0x2a2876,_0x5c5550))['catch'](handleError(_0x2a2876,null));};exports[_0x7712('0x40')]=function(_0x468349,_0x22d539){var _0x2bad87={'raw':!![],'where':{'id':_0x468349[_0x7712('0x41')]['id']}},_0x2b536d={};_0x2b536d[_0x7712('0x2e')]=_['keys'](db[_0x7712('0x3e')][_0x7712('0x2b')]);_0x2b536d['query']=_[_0x7712('0x30')](_0x468349['query']);_0x2b536d[_0x7712('0x31')]=_['intersection'](_0x2b536d[_0x7712('0x2e')],_0x2b536d['query']);_0x2bad87[_0x7712('0x34')]=_[_0x7712('0x32')](_0x2b536d[_0x7712('0x2e')],qs[_0x7712('0x33')](_0x468349['query'][_0x7712('0x33')]));_0x2bad87[_0x7712('0x34')]=_0x2bad87[_0x7712('0x34')][_0x7712('0x42')]?_0x2bad87[_0x7712('0x34')]:_0x2b536d[_0x7712('0x2e')];if(_0x468349[_0x7712('0x2f')][_0x7712('0x3c')]){_0x2bad87[_0x7712('0x3d')]=[{'all':!![]}];}_0x2bad87=_[_0x7712('0x3a')]({},_0x2bad87,_0x468349[_0x7712('0x3b')]);return db[_0x7712('0x3e')]['find'](_0x2bad87)[_0x7712('0x23')](handleEntityNotFound(_0x22d539,null))['then'](respondWithResult(_0x22d539,null))['catch'](handleError(_0x22d539,null));};exports['create']=function(_0x36687b,_0x3cb7b9){return db['SalesforceField']['create'](_0x36687b[_0x7712('0x43')],{})[_0x7712('0x23')](respondWithResult(_0x3cb7b9,0xc9))[_0x7712('0x44')](handleError(_0x3cb7b9,null));};exports[_0x7712('0x22')]=function(_0x8312d0,_0x331a1c){if(_0x8312d0[_0x7712('0x43')]['id']){delete _0x8312d0[_0x7712('0x43')]['id'];}return db['SalesforceField'][_0x7712('0x45')]({'where':{'id':_0x8312d0['params']['id']}})[_0x7712('0x23')](handleEntityNotFound(_0x331a1c,null))[_0x7712('0x23')](saveUpdates(_0x8312d0[_0x7712('0x43')],null))['then'](respondWithResult(_0x331a1c,null))[_0x7712('0x44')](handleError(_0x331a1c,null));};exports['destroy']=function(_0x5e0f67,_0x41f1df){return db[_0x7712('0x3e')][_0x7712('0x45')]({'where':{'id':_0x5e0f67[_0x7712('0x41')]['id']}})[_0x7712('0x23')](handleEntityNotFound(_0x41f1df,null))['then'](removeEntity(_0x41f1df,null))[_0x7712('0x44')](handleError(_0x41f1df,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 609aaba..d9f81f1 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 _0x910b=['FieldId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0xbf1b78,_0x273edc){var _0x4cbcd7=function(_0x50f2de){while(--_0x50f2de){_0xbf1b78['push'](_0xbf1b78['shift']());}};_0x4cbcd7(++_0x273edc);}(_0x910b,0x7a));var _0xb910=function(_0x40e1be,_0x553cd6){_0x40e1be=_0x40e1be-0x0;var _0x59908d=_0x910b[_0x40e1be];return _0x59908d;};'use strict';var _=require(_0xb910('0x0'));var util=require('util');var logger=require(_0xb910('0x1'))('api');var moment=require(_0xb910('0x2'));var BPromise=require(_0xb910('0x3'));var rp=require(_0xb910('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb910('0x5'));var config=require(_0xb910('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x4ffeb8,_0x155c68){return _0x4ffeb8['define'](_0xb910('0x7'),attributes,{'tableName':_0xb910('0x8'),'paranoid':![],'indexes':[{'name':_0xb910('0x9'),'fields':['idField',_0xb910('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5dc6=['exports','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes'];(function(_0x3241bb,_0x3791a3){var _0x3eb742=function(_0x357e6b){while(--_0x357e6b){_0x3241bb['push'](_0x3241bb['shift']());}};_0x3eb742(++_0x3791a3);}(_0x5dc6,0xf3));var _0x65dc=function(_0x3150f6,_0x4f883b){_0x3150f6=_0x3150f6-0x0;var _0x93af91=_0x5dc6[_0x3150f6];return _0x93af91;};'use strict';var _=require(_0x65dc('0x0'));var util=require(_0x65dc('0x1'));var logger=require(_0x65dc('0x2'))('api');var moment=require(_0x65dc('0x3'));var BPromise=require(_0x65dc('0x4'));var rp=require(_0x65dc('0x5'));var fs=require('fs');var path=require(_0x65dc('0x6'));var rimraf=require(_0x65dc('0x7'));var config=require('../../config/environment');var attributes=require(_0x65dc('0x8'));module[_0x65dc('0x9')]=function(_0x32afdc,_0x5ebf15){return _0x32afdc['define'](_0x65dc('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x65dc('0xb'),'fields':[_0x65dc('0xc'),_0x65dc('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 379e3da..b371cb9 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 _0xeab7=['client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1689fc,_0x4f1103){var _0x87365a=function(_0x8b042a){while(--_0x8b042a){_0x1689fc['push'](_0x1689fc['shift']());}};_0x87365a(++_0x4f1103);}(_0xeab7,0x176));var _0x7eab=function(_0x10a6b3,_0xe2111b){_0x10a6b3=_0x10a6b3-0x0;var _0xa884f6=_0xeab7[_0x10a6b3];return _0xa884f6;};'use strict';var _=require(_0x7eab('0x0'));var util=require(_0x7eab('0x1'));var moment=require(_0x7eab('0x2'));var BPromise=require(_0x7eab('0x3'));var rs=require(_0x7eab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7eab('0x5'))['db'];var utils=require(_0x7eab('0x6'));var logger=require(_0x7eab('0x7'))(_0x7eab('0x8'));var config=require('../../config/environment');var jayson=require(_0x7eab('0x9'));var client=jayson[_0x7eab('0xa')][_0x7eab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ad6d8,_0x4a85ac,_0x2af00b){return new BPromise(function(_0x56406b,_0x1681b0){return client['request'](_0x1ad6d8,_0x2af00b)[_0x7eab('0xc')](function(_0x1943b9){logger[_0x7eab('0xd')](_0x7eab('0xe'),_0x4a85ac,_0x7eab('0xf'));logger[_0x7eab('0x10')](_0x7eab('0x11'),_0x4a85ac,_0x7eab('0xf'),JSON[_0x7eab('0x12')](_0x1943b9));if(_0x1943b9[_0x7eab('0x13')]){if(_0x1943b9[_0x7eab('0x13')][_0x7eab('0x14')]===0x1f4){logger[_0x7eab('0x13')](_0x7eab('0xe'),_0x4a85ac,_0x1943b9[_0x7eab('0x13')]['message']);return _0x1681b0(_0x1943b9['error'][_0x7eab('0x15')]);}logger[_0x7eab('0x13')](_0x7eab('0xe'),_0x4a85ac,_0x1943b9['error'][_0x7eab('0x15')]);return _0x56406b(_0x1943b9[_0x7eab('0x13')][_0x7eab('0x15')]);}else{logger['info'](_0x7eab('0xe'),_0x4a85ac,_0x7eab('0xf'));_0x56406b(_0x1943b9[_0x7eab('0x16')]['message']);}})[_0x7eab('0x17')](function(_0xfb9266){logger[_0x7eab('0x13')]('SalesforceField,\x20%s,\x20%s',_0x4a85ac,_0xfb9266);_0x1681b0(_0xfb9266);});});} \ No newline at end of file +var _0xb24d=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x50a542,_0x3337d8){var _0x12ab00=function(_0x4da446){while(--_0x4da446){_0x50a542['push'](_0x50a542['shift']());}};_0x12ab00(++_0x3337d8);}(_0xb24d,0x1ba));var _0xdb24=function(_0x3913e3,_0x1fd0bf){_0x3913e3=_0x3913e3-0x0;var _0x980523=_0xb24d[_0x3913e3];return _0x980523;};'use strict';var _=require(_0xdb24('0x0'));var util=require('util');var moment=require(_0xdb24('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb24('0x2'));var fs=require('fs');var Redis=require(_0xdb24('0x3'));var db=require(_0xdb24('0x4'))['db'];var utils=require(_0xdb24('0x5'));var logger=require(_0xdb24('0x6'))(_0xdb24('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb24('0x8'));var client=jayson[_0xdb24('0x9')][_0xdb24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6bfdc8,_0x39c54e,_0x48aa40){return new BPromise(function(_0x2b0302,_0x2eb9ab){return client['request'](_0x6bfdc8,_0x48aa40)[_0xdb24('0xb')](function(_0x285781){logger[_0xdb24('0xc')](_0xdb24('0xd'),_0x39c54e,_0xdb24('0xe'));logger[_0xdb24('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x39c54e,_0xdb24('0xe'),JSON[_0xdb24('0x10')](_0x285781));if(_0x285781[_0xdb24('0x11')]){if(_0x285781['error'][_0xdb24('0x12')]===0x1f4){logger[_0xdb24('0x11')](_0xdb24('0xd'),_0x39c54e,_0x285781[_0xdb24('0x11')][_0xdb24('0x13')]);return _0x2eb9ab(_0x285781[_0xdb24('0x11')][_0xdb24('0x13')]);}logger[_0xdb24('0x11')](_0xdb24('0xd'),_0x39c54e,_0x285781[_0xdb24('0x11')][_0xdb24('0x13')]);return _0x2b0302(_0x285781['error'][_0xdb24('0x13')]);}else{logger[_0xdb24('0xc')]('SalesforceField,\x20%s,\x20%s',_0x39c54e,_0xdb24('0xe'));_0x2b0302(_0x285781[_0xdb24('0x14')][_0xdb24('0x13')]);}})['catch'](function(_0x518c3c){logger[_0xdb24('0x11')](_0xdb24('0xd'),_0x39c54e,_0x518c3c);_0x2eb9ab(_0x518c3c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 863327c..e8f28dd 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 _0x44f8=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getConfigurations','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util'];(function(_0x2080bb,_0x5e9f1c){var _0x5bb969=function(_0x50a5c5){while(--_0x50a5c5){_0x2080bb['push'](_0x2080bb['shift']());}};_0x5bb969(++_0x5e9f1c);}(_0x44f8,0x1de));var _0x844f=function(_0x215172,_0x180467){_0x215172=_0x215172-0x0;var _0x341291=_0x44f8[_0x215172];return _0x341291;};'use strict';var multer=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var path=require(_0x844f('0x2'));var timeout=require(_0x844f('0x3'));var express=require(_0x844f('0x4'));var router=express[_0x844f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x844f('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x844f('0x7')](),controller[_0x844f('0x8')]);router[_0x844f('0x9')](_0x844f('0xa'),auth[_0x844f('0x7')](),controller[_0x844f('0xb')]);router[_0x844f('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x844f('0xc')]);router['get']('/:id/fields',auth[_0x844f('0x7')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x844f('0xd')](_0x844f('0xe'),auth['isAuthenticated'](),controller[_0x844f('0xf')]);router[_0x844f('0x10')](_0x844f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x844f('0x11')]('/:id',auth[_0x844f('0x7')](),controller[_0x844f('0x12')]);module[_0x844f('0x13')]=router; \ No newline at end of file +var _0x6a55=['isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6a55,0x154));var _0x56a5=function(_0x12c34e,_0x39287a){_0x12c34e=_0x12c34e-0x0;var _0x244e88=_0x6a55[_0x12c34e];return _0x244e88;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require(_0x56a5('0x1'));var timeout=require(_0x56a5('0x2'));var express=require('express');var router=express[_0x56a5('0x3')]();var fs_extra=require(_0x56a5('0x4'));var auth=require(_0x56a5('0x5'));var interaction=require(_0x56a5('0x6'));var config=require(_0x56a5('0x7'));var controller=require(_0x56a5('0x8'));router[_0x56a5('0x9')]('/',auth[_0x56a5('0xa')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x9')](_0x56a5('0xc'),auth[_0x56a5('0xa')](),controller[_0x56a5('0xd')]);router[_0x56a5('0x9')]('/:id/configurations',auth[_0x56a5('0xa')](),controller[_0x56a5('0xe')]);router['get'](_0x56a5('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x56a5('0x10')]('/',auth[_0x56a5('0xa')](),controller[_0x56a5('0x11')]);router[_0x56a5('0x10')](_0x56a5('0x12'),auth[_0x56a5('0xa')](),controller[_0x56a5('0x13')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth['isAuthenticated'](),controller[_0x56a5('0x15')]);router[_0x56a5('0x16')]('/:id',auth[_0x56a5('0xa')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b23af7f..51a7bdb 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 _0x3f50=['exports','STRING','username','remoteUri','sequelize'];(function(_0x10271e,_0x528413){var _0x12501f=function(_0x274695){while(--_0x274695){_0x10271e['push'](_0x10271e['shift']());}};_0x12501f(++_0x528413);}(_0x3f50,0x103));var _0x03f5=function(_0x3ec53c,_0x3a7fe6){_0x3ec53c=_0x3ec53c-0x0;var _0x411a99=_0x3f50[_0x3ec53c];return _0x411a99;};'use strict';var Sequelize=require(_0x03f5('0x0'));module[_0x03f5('0x1')]={'name':{'type':Sequelize[_0x03f5('0x2')]},'description':{'type':Sequelize[_0x03f5('0x2')]},'username':{'type':Sequelize[_0x03f5('0x2')],'unique':_0x03f5('0x3')},'password':{'type':Sequelize[_0x03f5('0x2')]},'email':{'type':Sequelize[_0x03f5('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x03f5('0x4')},'serverUrl':{'type':Sequelize[_0x03f5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeece=['exports','STRING','username','remoteUri','sequelize'];(function(_0x236f63,_0x423d5c){var _0x9e09bd=function(_0x2b81dc){while(--_0x2b81dc){_0x236f63['push'](_0x236f63['shift']());}};_0x9e09bd(++_0x423d5c);}(_0xeece,0x18f));var _0xeeec=function(_0x10924a,_0x3d3fac){_0x10924a=_0x10924a-0x0;var _0x47774c=_0xeece[_0x10924a];return _0x47774c;};'use strict';var Sequelize=require(_0xeeec('0x0'));module[_0xeeec('0x1')]={'name':{'type':Sequelize[_0xeeec('0x2')]},'description':{'type':Sequelize[_0xeeec('0x2')]},'username':{'type':Sequelize[_0xeeec('0x2')],'unique':_0xeeec('0x3')},'password':{'type':Sequelize[_0xeeec('0x2')]},'email':{'type':Sequelize[_0xeeec('0x2')]},'remoteUri':{'type':Sequelize[_0xeeec('0x2')],'unique':_0xeeec('0x4')},'serverUrl':{'type':Sequelize[_0xeeec('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 3610f18..3d891aa 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 _0x6523=['%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','forEach','push','all','assign','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','ServiceNow\x20error:\x20','error','test','Wrong\x20credentials','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','moment','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','close_code','severity','category','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','group_list','work_end','resolved_at','approval_set','work_notes','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','upon_approval','location','password','email','remoteUri','serverUrl','slice','substring'];(function(_0x29a8a8,_0x3d9927){var _0x2bfcb0=function(_0x565102){while(--_0x565102){_0x29a8a8['push'](_0x29a8a8['shift']());}};_0x2bfcb0(++_0x3d9927);}(_0x6523,0xd2));var _0x3652=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0x6523[_0x5c049a];return _0x168e70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3652('0x0'));var zipdir=require(_0x3652('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3652('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3652('0x3'));var path=require('path');var sox=require(_0x3652('0x4'));var csv=require('to-csv');var ejs=require(_0x3652('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3652('0x6'));var squel=require('squel');var crypto=require(_0x3652('0x7'));var jsforce=require(_0x3652('0x8'));var deskjs=require(_0x3652('0x9'));var toCsv=require(_0x3652('0xa'));var querystring=require(_0x3652('0xb'));var Papa=require(_0x3652('0xc'));var Redis=require('ioredis');var authService=require(_0x3652('0xd'));var qs=require(_0x3652('0xe'));var as=require(_0x3652('0xf'));var hardwareService=require(_0x3652('0x10'));var logger=require('../../config/logger')(_0x3652('0x11'));var utils=require(_0x3652('0x12'));var config=require(_0x3652('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3652('0x14'));function respondWithStatusCode(_0x2c48da,_0x5419d3){_0x5419d3=_0x5419d3||0xcc;return function(_0x25565e){if(_0x25565e){return _0x2c48da[_0x3652('0x15')](_0x5419d3);}return _0x2c48da[_0x3652('0x16')](_0x5419d3)[_0x3652('0x17')]();};}function respondWithResult(_0x28d769,_0x2b8341){_0x2b8341=_0x2b8341||0xc8;return function(_0x58c2d2){if(_0x58c2d2){return _0x28d769[_0x3652('0x16')](_0x2b8341)[_0x3652('0x18')](_0x58c2d2);}};}function respondWithFilteredResult(_0x207bbc,_0x131c41){return function(_0x11b225){if(_0x11b225){var _0x3f7c40=typeof _0x131c41[_0x3652('0x19')]==='undefined'&&typeof _0x131c41[_0x3652('0x1a')]===_0x3652('0x1b');var _0x49d8a4=_0x11b225['count'];var _0x229f8a=_0x3f7c40?0x0:_0x131c41['offset'];var _0x414ba2=_0x3f7c40?_0x11b225[_0x3652('0x1c')]:_0x131c41[_0x3652('0x19')]+_0x131c41[_0x3652('0x1a')];var _0x5aecc4;if(_0x414ba2>=_0x49d8a4){_0x414ba2=_0x49d8a4;_0x5aecc4=0xc8;}else{_0x5aecc4=0xce;}_0x207bbc[_0x3652('0x16')](_0x5aecc4);return _0x207bbc[_0x3652('0x1d')](_0x3652('0x1e'),_0x229f8a+'-'+_0x414ba2+'/'+_0x49d8a4)[_0x3652('0x18')](_0x11b225);}return null;};}function patchUpdates(_0x19fe63){return function(_0x200f04){try{jsonpatch[_0x3652('0x1f')](_0x200f04,_0x19fe63,!![]);}catch(_0x27619e){return BPromise[_0x3652('0x20')](_0x27619e);}return _0x200f04[_0x3652('0x21')]();};}function saveUpdates(_0x484047,_0x50a47a){return function(_0x5a7bfb){if(_0x5a7bfb){return _0x5a7bfb['update'](_0x484047)['then'](function(_0x407e8f){return _0x407e8f;});}return null;};}function removeEntity(_0x184937,_0x276a43){return function(_0x4110b7){if(_0x4110b7){return _0x4110b7[_0x3652('0x22')]()[_0x3652('0x23')](function(){_0x184937[_0x3652('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23c6a1,_0x5a14a2){return function(_0x2ea19e){if(!_0x2ea19e){_0x23c6a1['sendStatus'](0x194);}return _0x2ea19e;};}function handleError(_0xa475f,_0x86ae69){_0x86ae69=_0x86ae69||0x1f4;return function(_0x599a8c){logger['error'](_0x599a8c[_0x3652('0x24')]);if(_0x599a8c[_0x3652('0x25')]){delete _0x599a8c[_0x3652('0x25')];}_0xa475f[_0x3652('0x16')](_0x86ae69)[_0x3652('0x26')](_0x599a8c);};}exports[_0x3652('0x27')]=function(_0x26a0f3,_0x58e80f){var _0x5025ae={},_0x43441e={},_0x73e288={'count':0x0,'rows':[]};var _0x15bbf1=_['map'](db['ServicenowAccount'][_0x3652('0x28')],function(_0xc44dbd){return{'name':_0xc44dbd['fieldName'],'type':_0xc44dbd[_0x3652('0x29')][_0x3652('0x2a')]};});_0x43441e[_0x3652('0x2b')]=_[_0x3652('0x2c')](_0x15bbf1,_0x3652('0x25'));_0x43441e[_0x3652('0x2d')]=_[_0x3652('0x2e')](_0x26a0f3[_0x3652('0x2d')]);_0x43441e['filters']=_[_0x3652('0x2f')](_0x43441e[_0x3652('0x2b')],_0x43441e[_0x3652('0x2d')]);_0x5025ae['attributes']=_['intersection'](_0x43441e[_0x3652('0x2b')],qs[_0x3652('0x30')](_0x26a0f3['query'][_0x3652('0x30')]));_0x5025ae[_0x3652('0x31')]=_0x5025ae[_0x3652('0x31')]['length']?_0x5025ae[_0x3652('0x31')]:_0x43441e['model'];if(!_0x26a0f3[_0x3652('0x2d')][_0x3652('0x32')](_0x3652('0x33'))){_0x5025ae[_0x3652('0x1a')]=qs[_0x3652('0x1a')](_0x26a0f3[_0x3652('0x2d')][_0x3652('0x1a')]);_0x5025ae['offset']=qs[_0x3652('0x19')](_0x26a0f3[_0x3652('0x2d')][_0x3652('0x19')]);}_0x5025ae[_0x3652('0x34')]=qs['sort'](_0x26a0f3[_0x3652('0x2d')][_0x3652('0x35')]);_0x5025ae[_0x3652('0x36')]=qs[_0x3652('0x37')](_[_0x3652('0x38')](_0x26a0f3[_0x3652('0x2d')],_0x43441e[_0x3652('0x37')]),_0x15bbf1);if(_0x26a0f3[_0x3652('0x2d')][_0x3652('0x39')]){_0x5025ae[_0x3652('0x36')]=_[_0x3652('0x3a')](_0x5025ae[_0x3652('0x36')],{'$or':_[_0x3652('0x2c')](_0x15bbf1,function(_0x183ca3){if(_0x183ca3[_0x3652('0x29')]!==_0x3652('0x3b')){var _0x4f6e38={};_0x4f6e38[_0x183ca3[_0x3652('0x25')]]={'$like':'%'+_0x26a0f3[_0x3652('0x2d')]['filter']+'%'};return _0x4f6e38;}})});}_0x5025ae=_[_0x3652('0x3a')]({},_0x5025ae,_0x26a0f3[_0x3652('0x3c')]);var _0x5e2ccc={'where':_0x5025ae['where']};return db[_0x3652('0x3d')][_0x3652('0x1c')](_0x5e2ccc)[_0x3652('0x23')](function(_0x421715){_0x73e288[_0x3652('0x1c')]=_0x421715;if(_0x26a0f3[_0x3652('0x2d')][_0x3652('0x3e')]){_0x5025ae[_0x3652('0x3f')]=[{'all':!![]}];}return db[_0x3652('0x3d')][_0x3652('0x40')](_0x5025ae);})[_0x3652('0x23')](function(_0x464289){_0x73e288[_0x3652('0x41')]=_0x464289;return _0x73e288;})['then'](respondWithFilteredResult(_0x58e80f,_0x5025ae))[_0x3652('0x42')](handleError(_0x58e80f,null));};exports['show']=function(_0x50a2ec,_0x462bd6){var _0x51a1d6={'raw':![],'where':{'id':_0x50a2ec[_0x3652('0x43')]['id']}},_0x169495={};_0x169495[_0x3652('0x2b')]=_[_0x3652('0x2e')](db[_0x3652('0x3d')]['rawAttributes']);_0x169495['query']=_[_0x3652('0x2e')](_0x50a2ec[_0x3652('0x2d')]);_0x169495[_0x3652('0x37')]=_[_0x3652('0x2f')](_0x169495[_0x3652('0x2b')],_0x169495[_0x3652('0x2d')]);_0x51a1d6[_0x3652('0x31')]=_['intersection'](_0x169495['model'],qs[_0x3652('0x30')](_0x50a2ec['query'][_0x3652('0x30')]));_0x51a1d6[_0x3652('0x31')]=_0x51a1d6['attributes'][_0x3652('0x44')]?_0x51a1d6[_0x3652('0x31')]:_0x169495['model'];if(_0x50a2ec['query']['includeAll']){_0x51a1d6[_0x3652('0x3f')]=[{'all':!![]}];}_0x51a1d6=_['merge']({},_0x51a1d6,_0x50a2ec[_0x3652('0x3c')]);return db[_0x3652('0x3d')][_0x3652('0x45')](_0x51a1d6)[_0x3652('0x23')](handleEntityNotFound(_0x462bd6,null))[_0x3652('0x23')](respondWithResult(_0x462bd6,null))[_0x3652('0x42')](handleError(_0x462bd6,null));};exports[_0x3652('0x46')]=function(_0x39418d,_0x3932b6){return db[_0x3652('0x3d')][_0x3652('0x46')](_0x39418d[_0x3652('0x47')],{})[_0x3652('0x23')](respondWithResult(_0x3932b6,0xc9))[_0x3652('0x42')](handleError(_0x3932b6,null));};exports[_0x3652('0x48')]=function(_0xdaa404,_0x4057be){if(_0xdaa404['body']['id']){delete _0xdaa404[_0x3652('0x47')]['id'];}return db[_0x3652('0x3d')][_0x3652('0x45')]({'where':{'id':_0xdaa404[_0x3652('0x43')]['id']}})[_0x3652('0x23')](handleEntityNotFound(_0x4057be,null))['then'](saveUpdates(_0xdaa404[_0x3652('0x47')],null))['then'](respondWithResult(_0x4057be,null))[_0x3652('0x42')](handleError(_0x4057be,null));};exports['destroy']=function(_0x3f3b85,_0xb8313b){return db[_0x3652('0x3d')][_0x3652('0x45')]({'where':{'id':_0x3f3b85['params']['id']}})['then'](handleEntityNotFound(_0xb8313b,null))[_0x3652('0x23')](removeEntity(_0xb8313b,null))['catch'](handleError(_0xb8313b,null));};exports[_0x3652('0x49')]=function(_0x1b7495,_0x5c7e1b,_0x235650){var _0x4da6e2={};var _0x46823b={};var _0x2d4855;var _0x104bec;return db[_0x3652('0x3d')][_0x3652('0x4a')]({'where':{'id':_0x1b7495[_0x3652('0x43')]['id']}})[_0x3652('0x23')](handleEntityNotFound(_0x5c7e1b,null))[_0x3652('0x23')](function(_0x509f08){if(_0x509f08){_0x2d4855=_0x509f08;_0x46823b[_0x3652('0x2b')]=_[_0x3652('0x2e')](db[_0x3652('0x4b')][_0x3652('0x28')]);_0x46823b[_0x3652('0x2d')]=_[_0x3652('0x2e')](_0x1b7495[_0x3652('0x2d')]);_0x46823b[_0x3652('0x37')]=_[_0x3652('0x2f')](_0x46823b[_0x3652('0x2b')],_0x46823b[_0x3652('0x2d')]);_0x4da6e2[_0x3652('0x31')]=_['intersection'](_0x46823b[_0x3652('0x2b')],qs[_0x3652('0x30')](_0x1b7495[_0x3652('0x2d')][_0x3652('0x30')]));_0x4da6e2['attributes']=_0x4da6e2['attributes'][_0x3652('0x44')]?_0x4da6e2['attributes']:_0x46823b['model'];_0x4da6e2['order']=qs[_0x3652('0x35')](_0x1b7495[_0x3652('0x2d')][_0x3652('0x35')]);_0x4da6e2[_0x3652('0x36')]=qs[_0x3652('0x37')](_[_0x3652('0x38')](_0x1b7495[_0x3652('0x2d')],_0x46823b[_0x3652('0x37')]));if(_0x1b7495[_0x3652('0x2d')][_0x3652('0x39')]){_0x4da6e2[_0x3652('0x36')]=_[_0x3652('0x3a')](_0x4da6e2[_0x3652('0x36')],{'$or':_[_0x3652('0x2c')](_0x4da6e2['attributes'],function(_0x53adfe){var _0x264287={};_0x264287[_0x53adfe]={'$like':'%'+_0x1b7495[_0x3652('0x2d')][_0x3652('0x39')]+'%'};return _0x264287;})});}_0x4da6e2=_[_0x3652('0x3a')]({},_0x4da6e2,_0x1b7495['options']);return _0x2d4855[_0x3652('0x49')](_0x4da6e2);}})[_0x3652('0x23')](function(_0x42265c){if(_0x42265c){_0x104bec=_0x42265c['length'];if(!_0x1b7495['query'][_0x3652('0x32')](_0x3652('0x33'))){_0x4da6e2[_0x3652('0x1a')]=qs['limit'](_0x1b7495['query'][_0x3652('0x1a')]);_0x4da6e2[_0x3652('0x19')]=qs[_0x3652('0x19')](_0x1b7495[_0x3652('0x2d')][_0x3652('0x19')]);}return _0x2d4855[_0x3652('0x49')](_0x4da6e2);}})['then'](function(_0x1823b5){if(_0x1823b5){return _0x1823b5?{'count':_0x104bec,'rows':_0x1823b5}:null;}})[_0x3652('0x23')](respondWithResult(_0x5c7e1b,null))[_0x3652('0x42')](handleError(_0x5c7e1b,null));};exports[_0x3652('0x4c')]=function(_0x2cc89d,_0x51ee31,_0x28ee36){if(_0x2cc89d[_0x3652('0x47')]['id']){delete _0x2cc89d[_0x3652('0x47')]['id'];}return db[_0x3652('0x3d')][_0x3652('0x4a')]({'where':{'id':_0x2cc89d[_0x3652('0x43')]['id']}})['then'](handleEntityNotFound(_0x51ee31,null))[_0x3652('0x23')](function(_0x4ff1e9){if(_0x4ff1e9){_0x2cc89d[_0x3652('0x47')][_0x3652('0x4d')]=_0x4ff1e9['id'];_0x2cc89d[_0x3652('0x47')][_0x3652('0x4e')]=integrations[_0x3652('0x4f')](_0x2cc89d[_0x3652('0x47')][_0x3652('0x50')],_0x2cc89d['body'][_0x3652('0x29')]);_0x2cc89d[_0x3652('0x47')][_0x3652('0x51')]=integrations[_0x3652('0x52')](_0x2cc89d[_0x3652('0x47')][_0x3652('0x50')],_0x2cc89d[_0x3652('0x47')]['type']);return db[_0x3652('0x4b')]['create'](_0x2cc89d[_0x3652('0x47')],{'include':[{'model':db[_0x3652('0x53')],'as':_0x3652('0x4e')},{'model':db[_0x3652('0x53')],'as':_0x3652('0x51')}]});}return null;})[_0x3652('0x23')](respondWithResult(_0x51ee31,null))[_0x3652('0x42')](handleError(_0x51ee31,null));};exports[_0x3652('0x54')]=function(_0x1d55fd,_0x17223d,_0x1727a7){var _0x4a89b4=['made_sla',_0x3652('0x55'),_0x3652('0x56'),'subcategory',_0x3652('0x57'),'notify','incident_state',_0x3652('0x58'),_0x3652('0x59')];var _0x521bb3=['parent','made_sla',_0x3652('0x5a'),'watch_list',_0x3652('0x5b'),_0x3652('0x5c'),'child_incidents','hold_reason',_0x3652('0x5d'),_0x3652('0x5e'),_0x3652('0x5f'),_0x3652('0x60'),_0x3652('0x61'),_0x3652('0x62'),'sys_created_on',_0x3652('0x63'),_0x3652('0x64'),'sys_created_by',_0x3652('0x56'),_0x3652('0x34'),'calendar_stc','closed_at','cmdb_ci',_0x3652('0x65'),_0x3652('0x66'),_0x3652('0x67'),'work_notes_list',_0x3652('0x68'),_0x3652('0x69'),_0x3652('0x6a'),_0x3652('0x6b'),'time_worked',_0x3652('0x6c'),_0x3652('0x6d'),'business_duration',_0x3652('0x6e'),_0x3652('0x6f'),'reopened_time',_0x3652('0x70'),'caller_id',_0x3652('0x71'),'subcategory',_0x3652('0x72'),'short_description',_0x3652('0x57'),_0x3652('0x73'),_0x3652('0x74'),'work_start',_0x3652('0x75'),_0x3652('0x76'),_0x3652('0x77'),_0x3652('0x78'),_0x3652('0x79'),_0x3652('0x7a'),'sys_class_name','close_notes',_0x3652('0x7b'),_0x3652('0x7c'),_0x3652('0x7d'),'sys_id',_0x3652('0x7e'),_0x3652('0x7f'),_0x3652('0x80'),_0x3652('0x81'),_0x3652('0x82'),_0x3652('0x83'),_0x3652('0x84'),_0x3652('0x85'),_0x3652('0x86'),_0x3652('0x58'),_0x3652('0x87'),_0x3652('0x88'),_0x3652('0x89'),_0x3652('0x8a'),'due_date',_0x3652('0x8b'),_0x3652('0x8c'),_0x3652('0x8d'),'escalation',_0x3652('0x8e'),'correlation_id',_0x3652('0x8f'),_0x3652('0x59')];var _0x481541='';var _0x13b2aa='';var _0x584e04=[];var _0x19c73f='';var _0x47a693='';var _0x7b26cf=[];var _0x5771f4='';var _0x246fe9='';var _0x41b68a={};var _0x30bd35='';return db[_0x3652('0x3d')][_0x3652('0x4a')]({'where':{'id':_0x1d55fd['params']['id']},'attributes':['id','username',_0x3652('0x90'),_0x3652('0x91'),_0x3652('0x92'),_0x3652('0x93')]})[_0x3652('0x23')](handleEntityNotFound(_0x17223d,null))[_0x3652('0x23')](function(_0x9e0952){if(_0x9e0952){_0x30bd35=_0x9e0952[_0x3652('0x92')];var _0x99174f=_0x30bd35[_0x3652('0x94')](-0x1);if(_0x99174f==='/'){_0x30bd35=_0x30bd35[_0x3652('0x95')](0x0,_0x30bd35['lastIndexOf'](_0x99174f));}_0x246fe9=util['format'](_0x3652('0x96'),_0x30bd35);_0x5771f4=util[_0x3652('0x97')](_0x3652('0x98'),_0x30bd35);_0x41b68a={'user':_0x9e0952[_0x3652('0x99')],'pass':_0x9e0952[_0x3652('0x90')]};var _0x3cb8dc={'method':'GET','uri':_0x246fe9+_0x3652('0x9a'),'auth':_0x41b68a,'json':!![]};return rp(_0x3cb8dc);}})[_0x3652('0x23')](function(_0x3f2f00){if(_0x3f2f00[_0x3652('0x9b')]['length']>0x0){_0x481541=_0x3f2f00['result'];}console[_0x3652('0x9c')](_0x3652('0x9d'),_0x481541);_0x7b26cf=[];_0x13b2aa=Object['assign']([],_0x481541);_['remove'](_0x13b2aa,function(_0x34d927){return!_0x4a89b4[_0x3652('0x9e')](_0x34d927[_0x3652('0x25')]);});_0x13b2aa[_0x3652('0x9f')](function(_0x10a1d5){var _0x5d9452=createFieldObject(_0x5771f4,_0x41b68a,_0x10a1d5['internalType'],_0x10a1d5['name'],_0x10a1d5['label'],![]);_0x7b26cf[_0x3652('0xa0')](_0x5d9452);});return Promise[_0x3652('0xa1')](_0x7b26cf);})['then'](function(_0x535aa4){_0x584e04=_0x535aa4;_0x19c73f=Object[_0x3652('0xa2')]([],_0x481541);console[_0x3652('0x9c')](_0x3652('0xa3'),_0x481541);_[_0x3652('0xa4')](_0x19c73f,function(_0x272b1b){return _0x521bb3[_0x3652('0x9e')](_0x272b1b['name']);});console[_0x3652('0x9c')](_0x3652('0xa5'),_0x19c73f);_0x7b26cf=[];_0x19c73f[_0x3652('0x9f')](function(_0xd17d17){var _0x3fc670=createFieldObject(_0x5771f4,_0x41b68a,_0xd17d17[_0x3652('0xa6')],_0xd17d17['name'],_0xd17d17[_0x3652('0xa7')],!![]);_0x7b26cf[_0x3652('0xa0')](_0x3fc670);});return Promise['all'](_0x7b26cf);})[_0x3652('0x23')](function(_0x3ea3bb){_0x47a693=_0x3ea3bb;var _0x27bd42=_0x584e04['concat'](_0x47a693);return{'count':_0x27bd42[_0x3652('0x44')],'rows':_0x27bd42};})[_0x3652('0x23')](respondWithResult(_0x17223d,null))[_0x3652('0x42')](function(_0x11566a){console[_0x3652('0x9c')](_0x3652('0xa8')+_0x11566a);var _0x4cdc69=_0x1d55fd[_0x3652('0x2d')]['test']?0x1f4:_0x11566a['statusCode']||0x1f4;logger[_0x3652('0xa9')](_0x11566a['stack']);delete _0x11566a[_0x3652('0x25')];if(_0x4cdc69===0x191){_0x4cdc69=0x190;}_0x17223d[_0x3652('0x16')](_0x4cdc69)['send'](_0x1d55fd[_0x3652('0x2d')][_0x3652('0xaa')]?{'message':_0x3652('0xab'),'statusCode':_0x11566a[_0x3652('0xac')]}:_0x11566a);});};function createFieldObject(_0x58a457,_0x473b34,_0x19c7d2,_0x525160,_0x3dc471,_0x3ec490){return new Promise(function(_0x350c1d,_0x16b650){var _0xa665e6={'id':_0x525160,'name':_0x3dc471,'custom':_0x3ec490};if(_0x19c7d2===_0x3652('0xad')){_0xa665e6[_0x3652('0x3c')]=[{'name':_0x3652('0xae'),'value':_0x3652('0xaf')},{'name':_0x3652('0xb0'),'value':_0x3652('0xb1')}];_0x350c1d(_0xa665e6);}else{var _0x1e6acd={'method':'GET','uri':_0x58a457+_0x3652('0xb2')+_0x525160,'auth':_0x473b34,'json':!![]};return rp(_0x1e6acd)[_0x3652('0x23')](function(_0x120fdc){var _0x28ebc6=[];if(_0x120fdc[_0x3652('0x9b')][_0x3652('0x44')]>0x0){_0x120fdc[_0x3652('0x9b')][_0x3652('0x9f')](function(_0x3b07d7){if(_0x3b07d7[_0x3652('0xb3')]===_0x3652('0xb1')){var _0x1190da={'name':_0x3b07d7[_0x3652('0xa7')],'value':_0x3b07d7['value']};_0x28ebc6[_0x3652('0xa0')](_0x1190da);}});}_0xa665e6[_0x3652('0x3c')]=_0x28ebc6;if(_0xa665e6['options'][_0x3652('0x44')]>0x0){_0x350c1d(_0xa665e6);}else{if(_0x3ec490==![]){_0x350c1d();}else{_0x350c1d(_0xa665e6);}}});}});} \ No newline at end of file +var _0xa877=['save','then','destroy','end','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','catch','create','body','update','getConfigurations','findOne','ServicenowConfiguration','length','nolimit','addConfiguration','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','watch_list','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','password','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','includes','all','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','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','apply','reject'];(function(_0x103a1,_0x780f5e){var _0x1706fe=function(_0x37d896){while(--_0x37d896){_0x103a1['push'](_0x103a1['shift']());}};_0x1706fe(++_0x780f5e);}(_0xa877,0x143));var _0x7a87=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa877[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x7a87('0x0'));var rimraf=require(_0x7a87('0x1'));var zipdir=require(_0x7a87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a87('0x3'));var BPromise=require(_0x7a87('0x4'));var Mustache=require(_0x7a87('0x5'));var util=require(_0x7a87('0x6'));var path=require(_0x7a87('0x7'));var sox=require(_0x7a87('0x8'));var csv=require(_0x7a87('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a87('0xa'));var _=require(_0x7a87('0xb'));var squel=require('squel');var crypto=require(_0x7a87('0xc'));var jsforce=require(_0x7a87('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a87('0xe'));var Papa=require('papaparse');var Redis=require(_0x7a87('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a87('0x10'));var as=require(_0x7a87('0x11'));var hardwareService=require(_0x7a87('0x12'));var logger=require(_0x7a87('0x13'))(_0x7a87('0x14'));var utils=require(_0x7a87('0x15'));var config=require(_0x7a87('0x16'));var licenseUtil=require(_0x7a87('0x17'));var db=require(_0x7a87('0x18'))['db'];var integrations=require(_0x7a87('0x19'));function respondWithStatusCode(_0x218fea,_0x14b4e0){_0x14b4e0=_0x14b4e0||0xcc;return function(_0x1ce4d6){if(_0x1ce4d6){return _0x218fea[_0x7a87('0x1a')](_0x14b4e0);}return _0x218fea[_0x7a87('0x1b')](_0x14b4e0)['end']();};}function respondWithResult(_0x6aa5e5,_0x48aa40){_0x48aa40=_0x48aa40||0xc8;return function(_0x57847f){if(_0x57847f){return _0x6aa5e5[_0x7a87('0x1b')](_0x48aa40)[_0x7a87('0x1c')](_0x57847f);}};}function respondWithFilteredResult(_0x29b68b,_0xd793e3){return function(_0x4e418d){if(_0x4e418d){var _0x2edc70=typeof _0xd793e3[_0x7a87('0x1d')]===_0x7a87('0x1e')&&typeof _0xd793e3[_0x7a87('0x1f')]===_0x7a87('0x1e');var _0x4b31fe=_0x4e418d[_0x7a87('0x20')];var _0x52644c=_0x2edc70?0x0:_0xd793e3[_0x7a87('0x1d')];var _0x35b05e=_0x2edc70?_0x4e418d[_0x7a87('0x20')]:_0xd793e3[_0x7a87('0x1d')]+_0xd793e3[_0x7a87('0x1f')];var _0x3c3a7c;if(_0x35b05e>=_0x4b31fe){_0x35b05e=_0x4b31fe;_0x3c3a7c=0xc8;}else{_0x3c3a7c=0xce;}_0x29b68b[_0x7a87('0x1b')](_0x3c3a7c);return _0x29b68b['set']('Content-Range',_0x52644c+'-'+_0x35b05e+'/'+_0x4b31fe)[_0x7a87('0x1c')](_0x4e418d);}return null;};}function patchUpdates(_0x7adf28){return function(_0x3268a4){try{jsonpatch[_0x7a87('0x21')](_0x3268a4,_0x7adf28,!![]);}catch(_0x43c358){return BPromise[_0x7a87('0x22')](_0x43c358);}return _0x3268a4[_0x7a87('0x23')]();};}function saveUpdates(_0x2928f3,_0x235286){return function(_0x21b580){if(_0x21b580){return _0x21b580['update'](_0x2928f3)[_0x7a87('0x24')](function(_0x37b15c){return _0x37b15c;});}return null;};}function removeEntity(_0x17c10f,_0xf86b3){return function(_0xd21878){if(_0xd21878){return _0xd21878[_0x7a87('0x25')]()[_0x7a87('0x24')](function(){_0x17c10f[_0x7a87('0x1b')](0xcc)[_0x7a87('0x26')]();});}};}function handleEntityNotFound(_0x543d7c,_0x44ed7d){return function(_0x261568){if(!_0x261568){_0x543d7c[_0x7a87('0x1a')](0x194);}return _0x261568;};}function handleError(_0x19e240,_0xf220f){_0xf220f=_0xf220f||0x1f4;return function(_0x1ef503){logger[_0x7a87('0x27')](_0x1ef503[_0x7a87('0x28')]);if(_0x1ef503[_0x7a87('0x29')]){delete _0x1ef503[_0x7a87('0x29')];}_0x19e240['status'](_0xf220f)['send'](_0x1ef503);};}exports[_0x7a87('0x2a')]=function(_0x1394f4,_0x2b578c){var _0x5d49d4={},_0x5ce220={},_0xd167fa={'count':0x0,'rows':[]};var _0x2dc61f=_[_0x7a87('0x2b')](db[_0x7a87('0x2c')][_0x7a87('0x2d')],function(_0x35668a){return{'name':_0x35668a[_0x7a87('0x2e')],'type':_0x35668a[_0x7a87('0x2f')][_0x7a87('0x30')]};});_0x5ce220[_0x7a87('0x31')]=_[_0x7a87('0x2b')](_0x2dc61f,'name');_0x5ce220[_0x7a87('0x32')]=_[_0x7a87('0x33')](_0x1394f4[_0x7a87('0x32')]);_0x5ce220[_0x7a87('0x34')]=_[_0x7a87('0x35')](_0x5ce220[_0x7a87('0x31')],_0x5ce220[_0x7a87('0x32')]);_0x5d49d4['attributes']=_[_0x7a87('0x35')](_0x5ce220['model'],qs[_0x7a87('0x36')](_0x1394f4[_0x7a87('0x32')][_0x7a87('0x36')]));_0x5d49d4[_0x7a87('0x37')]=_0x5d49d4[_0x7a87('0x37')]['length']?_0x5d49d4['attributes']:_0x5ce220[_0x7a87('0x31')];if(!_0x1394f4[_0x7a87('0x32')][_0x7a87('0x38')]('nolimit')){_0x5d49d4[_0x7a87('0x1f')]=qs['limit'](_0x1394f4[_0x7a87('0x32')][_0x7a87('0x1f')]);_0x5d49d4[_0x7a87('0x1d')]=qs[_0x7a87('0x1d')](_0x1394f4[_0x7a87('0x32')][_0x7a87('0x1d')]);}_0x5d49d4[_0x7a87('0x39')]=qs[_0x7a87('0x3a')](_0x1394f4[_0x7a87('0x32')][_0x7a87('0x3a')]);_0x5d49d4[_0x7a87('0x3b')]=qs[_0x7a87('0x34')](_[_0x7a87('0x3c')](_0x1394f4[_0x7a87('0x32')],_0x5ce220['filters']),_0x2dc61f);if(_0x1394f4[_0x7a87('0x32')][_0x7a87('0x3d')]){_0x5d49d4[_0x7a87('0x3b')]=_['merge'](_0x5d49d4[_0x7a87('0x3b')],{'$or':_[_0x7a87('0x2b')](_0x2dc61f,function(_0x4ee11b){if(_0x4ee11b[_0x7a87('0x2f')]!==_0x7a87('0x3e')){var _0x501dc0={};_0x501dc0[_0x4ee11b[_0x7a87('0x29')]]={'$like':'%'+_0x1394f4[_0x7a87('0x32')][_0x7a87('0x3d')]+'%'};return _0x501dc0;}})});}_0x5d49d4=_['merge']({},_0x5d49d4,_0x1394f4[_0x7a87('0x3f')]);var _0x18253a={'where':_0x5d49d4[_0x7a87('0x3b')]};return db[_0x7a87('0x2c')][_0x7a87('0x20')](_0x18253a)[_0x7a87('0x24')](function(_0x315042){_0xd167fa[_0x7a87('0x20')]=_0x315042;if(_0x1394f4[_0x7a87('0x32')][_0x7a87('0x40')]){_0x5d49d4[_0x7a87('0x41')]=[{'all':!![]}];}return db[_0x7a87('0x2c')]['findAll'](_0x5d49d4);})[_0x7a87('0x24')](function(_0x240c31){_0xd167fa[_0x7a87('0x42')]=_0x240c31;return _0xd167fa;})['then'](respondWithFilteredResult(_0x2b578c,_0x5d49d4))['catch'](handleError(_0x2b578c,null));};exports[_0x7a87('0x43')]=function(_0x589a60,_0x37cfca){var _0x24e758={'raw':![],'where':{'id':_0x589a60[_0x7a87('0x44')]['id']}},_0x30da81={};_0x30da81[_0x7a87('0x31')]=_[_0x7a87('0x33')](db[_0x7a87('0x2c')][_0x7a87('0x2d')]);_0x30da81[_0x7a87('0x32')]=_[_0x7a87('0x33')](_0x589a60[_0x7a87('0x32')]);_0x30da81['filters']=_['intersection'](_0x30da81[_0x7a87('0x31')],_0x30da81[_0x7a87('0x32')]);_0x24e758[_0x7a87('0x37')]=_[_0x7a87('0x35')](_0x30da81[_0x7a87('0x31')],qs[_0x7a87('0x36')](_0x589a60['query'][_0x7a87('0x36')]));_0x24e758[_0x7a87('0x37')]=_0x24e758[_0x7a87('0x37')]['length']?_0x24e758[_0x7a87('0x37')]:_0x30da81[_0x7a87('0x31')];if(_0x589a60[_0x7a87('0x32')][_0x7a87('0x40')]){_0x24e758['include']=[{'all':!![]}];}_0x24e758=_[_0x7a87('0x45')]({},_0x24e758,_0x589a60[_0x7a87('0x3f')]);return db[_0x7a87('0x2c')][_0x7a87('0x46')](_0x24e758)[_0x7a87('0x24')](handleEntityNotFound(_0x37cfca,null))['then'](respondWithResult(_0x37cfca,null))[_0x7a87('0x47')](handleError(_0x37cfca,null));};exports[_0x7a87('0x48')]=function(_0x5a0046,_0x4ef4d7){return db['ServicenowAccount'][_0x7a87('0x48')](_0x5a0046[_0x7a87('0x49')],{})['then'](respondWithResult(_0x4ef4d7,0xc9))[_0x7a87('0x47')](handleError(_0x4ef4d7,null));};exports[_0x7a87('0x4a')]=function(_0x4f090f,_0x47904c){if(_0x4f090f[_0x7a87('0x49')]['id']){delete _0x4f090f['body']['id'];}return db[_0x7a87('0x2c')]['find']({'where':{'id':_0x4f090f['params']['id']}})[_0x7a87('0x24')](handleEntityNotFound(_0x47904c,null))[_0x7a87('0x24')](saveUpdates(_0x4f090f['body'],null))[_0x7a87('0x24')](respondWithResult(_0x47904c,null))[_0x7a87('0x47')](handleError(_0x47904c,null));};exports[_0x7a87('0x25')]=function(_0x3e63e8,_0x3a23be){return db['ServicenowAccount'][_0x7a87('0x46')]({'where':{'id':_0x3e63e8[_0x7a87('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a23be,null))[_0x7a87('0x24')](removeEntity(_0x3a23be,null))[_0x7a87('0x47')](handleError(_0x3a23be,null));};exports[_0x7a87('0x4b')]=function(_0x22d183,_0x173f68,_0x3fa890){var _0x5f4565={};var _0x22ac29={};var _0x2e5f7a;var _0x4cecf4;return db[_0x7a87('0x2c')][_0x7a87('0x4c')]({'where':{'id':_0x22d183[_0x7a87('0x44')]['id']}})[_0x7a87('0x24')](handleEntityNotFound(_0x173f68,null))[_0x7a87('0x24')](function(_0x567d2f){if(_0x567d2f){_0x2e5f7a=_0x567d2f;_0x22ac29[_0x7a87('0x31')]=_['keys'](db[_0x7a87('0x4d')][_0x7a87('0x2d')]);_0x22ac29[_0x7a87('0x32')]=_[_0x7a87('0x33')](_0x22d183[_0x7a87('0x32')]);_0x22ac29[_0x7a87('0x34')]=_[_0x7a87('0x35')](_0x22ac29[_0x7a87('0x31')],_0x22ac29['query']);_0x5f4565[_0x7a87('0x37')]=_['intersection'](_0x22ac29[_0x7a87('0x31')],qs['fields'](_0x22d183[_0x7a87('0x32')]['fields']));_0x5f4565[_0x7a87('0x37')]=_0x5f4565[_0x7a87('0x37')][_0x7a87('0x4e')]?_0x5f4565[_0x7a87('0x37')]:_0x22ac29[_0x7a87('0x31')];_0x5f4565[_0x7a87('0x39')]=qs['sort'](_0x22d183[_0x7a87('0x32')][_0x7a87('0x3a')]);_0x5f4565[_0x7a87('0x3b')]=qs[_0x7a87('0x34')](_[_0x7a87('0x3c')](_0x22d183['query'],_0x22ac29['filters']));if(_0x22d183['query'][_0x7a87('0x3d')]){_0x5f4565[_0x7a87('0x3b')]=_[_0x7a87('0x45')](_0x5f4565[_0x7a87('0x3b')],{'$or':_[_0x7a87('0x2b')](_0x5f4565[_0x7a87('0x37')],function(_0x205fce){var _0x2fd00c={};_0x2fd00c[_0x205fce]={'$like':'%'+_0x22d183[_0x7a87('0x32')][_0x7a87('0x3d')]+'%'};return _0x2fd00c;})});}_0x5f4565=_[_0x7a87('0x45')]({},_0x5f4565,_0x22d183[_0x7a87('0x3f')]);return _0x2e5f7a['getConfigurations'](_0x5f4565);}})['then'](function(_0xa9035f){if(_0xa9035f){_0x4cecf4=_0xa9035f[_0x7a87('0x4e')];if(!_0x22d183[_0x7a87('0x32')][_0x7a87('0x38')](_0x7a87('0x4f'))){_0x5f4565['limit']=qs['limit'](_0x22d183[_0x7a87('0x32')]['limit']);_0x5f4565[_0x7a87('0x1d')]=qs[_0x7a87('0x1d')](_0x22d183[_0x7a87('0x32')]['offset']);}return _0x2e5f7a[_0x7a87('0x4b')](_0x5f4565);}})['then'](function(_0x29a54a){if(_0x29a54a){return _0x29a54a?{'count':_0x4cecf4,'rows':_0x29a54a}:null;}})[_0x7a87('0x24')](respondWithResult(_0x173f68,null))[_0x7a87('0x47')](handleError(_0x173f68,null));};exports[_0x7a87('0x50')]=function(_0x539aed,_0x393ebf,_0x44702b){if(_0x539aed['body']['id']){delete _0x539aed[_0x7a87('0x49')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x539aed[_0x7a87('0x44')]['id']}})[_0x7a87('0x24')](handleEntityNotFound(_0x393ebf,null))[_0x7a87('0x24')](function(_0x50c108){if(_0x50c108){_0x539aed[_0x7a87('0x49')]['AccountId']=_0x50c108['id'];_0x539aed[_0x7a87('0x49')]['Subjects']=integrations['getSubjects'](_0x539aed[_0x7a87('0x49')][_0x7a87('0x51')],_0x539aed['body'][_0x7a87('0x2f')]);_0x539aed[_0x7a87('0x49')][_0x7a87('0x52')]=integrations[_0x7a87('0x53')](_0x539aed['body']['channel'],_0x539aed[_0x7a87('0x49')][_0x7a87('0x2f')]);return db[_0x7a87('0x4d')][_0x7a87('0x48')](_0x539aed[_0x7a87('0x49')],{'include':[{'model':db[_0x7a87('0x54')],'as':_0x7a87('0x55')},{'model':db['ServicenowField'],'as':_0x7a87('0x52')}]});}return null;})['then'](respondWithResult(_0x393ebf,null))[_0x7a87('0x47')](handleError(_0x393ebf,null));};exports[_0x7a87('0x56')]=function(_0x41c77e,_0x5249d4,_0x753889){var _0x4dfd1f=[_0x7a87('0x57'),_0x7a87('0x58'),'knowledge',_0x7a87('0x59'),_0x7a87('0x5a'),_0x7a87('0x5b'),_0x7a87('0x5c'),'severity',_0x7a87('0x5d')];var _0x1cf85b=[_0x7a87('0x5e'),_0x7a87('0x57'),'caused_by',_0x7a87('0x5f'),'upon_reject','sys_updated_on',_0x7a87('0x60'),_0x7a87('0x58'),'approval_history',_0x7a87('0x61'),_0x7a87('0x62'),_0x7a87('0x63'),_0x7a87('0x64'),_0x7a87('0x65'),_0x7a87('0x66'),_0x7a87('0x67'),_0x7a87('0x68'),_0x7a87('0x69'),_0x7a87('0x6a'),_0x7a87('0x39'),_0x7a87('0x6b'),_0x7a87('0x6c'),_0x7a87('0x6d'),_0x7a87('0x6e'),_0x7a87('0x6f'),_0x7a87('0x70'),_0x7a87('0x71'),'business_service','priority','sys_domain_path','rfc',_0x7a87('0x72'),'expected_start',_0x7a87('0x73'),_0x7a87('0x74'),_0x7a87('0x75'),_0x7a87('0x76'),_0x7a87('0x77'),_0x7a87('0x78'),_0x7a87('0x79'),'approval_set',_0x7a87('0x59'),'work_notes','short_description',_0x7a87('0x5a'),_0x7a87('0x7a'),_0x7a87('0x7b'),_0x7a87('0x7c'),_0x7a87('0x7d'),_0x7a87('0x7e'),_0x7a87('0x7f'),'description',_0x7a87('0x80'),_0x7a87('0x5b'),'sys_class_name',_0x7a87('0x81'),'closed_by',_0x7a87('0x82'),_0x7a87('0x83'),_0x7a87('0x84'),_0x7a87('0x85'),'reopened_by','incident_state',_0x7a87('0x86'),_0x7a87('0x87'),_0x7a87('0x88'),_0x7a87('0x89'),'activity_due','assigned_to',_0x7a87('0x8a'),_0x7a87('0x8b'),_0x7a87('0x8c'),'approval',_0x7a87('0x8d'),_0x7a87('0x8e'),_0x7a87('0x8f'),'reopen_count',_0x7a87('0x90'),_0x7a87('0x91'),_0x7a87('0x92'),_0x7a87('0x93'),'location',_0x7a87('0x5d')];var _0x11093c='';var _0x2fa1fa='';var _0x31e801=[];var _0x5cb546='';var _0xef00e0='';var _0x1859cd=[];var _0x58e4b2='';var _0x56ec6c='';var _0x2a6a91={};var _0x29bc39='';return db[_0x7a87('0x2c')][_0x7a87('0x4c')]({'where':{'id':_0x41c77e['params']['id']},'attributes':['id','username',_0x7a87('0x94'),'email',_0x7a87('0x95'),_0x7a87('0x96')]})['then'](handleEntityNotFound(_0x5249d4,null))['then'](function(_0x2263ff){if(_0x2263ff){_0x29bc39=_0x2263ff[_0x7a87('0x95')];var _0x42eb42=_0x29bc39[_0x7a87('0x97')](-0x1);if(_0x42eb42==='/'){_0x29bc39=_0x29bc39['substring'](0x0,_0x29bc39[_0x7a87('0x98')](_0x42eb42));}_0x56ec6c=util[_0x7a87('0x99')](_0x7a87('0x9a'),_0x29bc39);_0x58e4b2=util['format']('%s/api/now/table/',_0x29bc39);_0x2a6a91={'user':_0x2263ff['username'],'pass':_0x2263ff[_0x7a87('0x94')]};var _0x132eca={'method':_0x7a87('0x9b'),'uri':_0x56ec6c+_0x7a87('0x9c'),'auth':_0x2a6a91,'json':!![]};return rp(_0x132eca);}})[_0x7a87('0x24')](function(_0x2823fa){if(_0x2823fa[_0x7a87('0x9d')][_0x7a87('0x4e')]>0x0){_0x11093c=_0x2823fa['result'];}console[_0x7a87('0x9e')](_0x7a87('0x9f'),_0x11093c);_0x1859cd=[];_0x2fa1fa=Object[_0x7a87('0xa0')]([],_0x11093c);_['remove'](_0x2fa1fa,function(_0x526072){return!_0x4dfd1f['includes'](_0x526072[_0x7a87('0x29')]);});_0x2fa1fa[_0x7a87('0xa1')](function(_0x8753bd){var _0x132e44=createFieldObject(_0x58e4b2,_0x2a6a91,_0x8753bd[_0x7a87('0xa2')],_0x8753bd['name'],_0x8753bd[_0x7a87('0xa3')],![]);_0x1859cd[_0x7a87('0xa4')](_0x132e44);});return Promise['all'](_0x1859cd);})[_0x7a87('0x24')](function(_0x1db96e){_0x31e801=_0x1db96e;_0x5cb546=Object[_0x7a87('0xa0')]([],_0x11093c);console[_0x7a87('0x9e')]('TCL:\x20_object',_0x11093c);_['remove'](_0x5cb546,function(_0x3b91ed){return _0x1cf85b[_0x7a87('0xa5')](_0x3b91ed[_0x7a87('0x29')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5cb546);_0x1859cd=[];_0x5cb546[_0x7a87('0xa1')](function(_0x56f635){var _0x1e660a=createFieldObject(_0x58e4b2,_0x2a6a91,_0x56f635['internalType'],_0x56f635[_0x7a87('0x29')],_0x56f635[_0x7a87('0xa3')],!![]);_0x1859cd[_0x7a87('0xa4')](_0x1e660a);});return Promise[_0x7a87('0xa6')](_0x1859cd);})[_0x7a87('0x24')](function(_0x48e543){_0xef00e0=_0x48e543;var _0x39e241=_0x31e801[_0x7a87('0xa7')](_0xef00e0);return{'count':_0x39e241[_0x7a87('0x4e')],'rows':_0x39e241};})[_0x7a87('0x24')](respondWithResult(_0x5249d4,null))[_0x7a87('0x47')](function(_0x31e88a){console[_0x7a87('0x9e')]('ServiceNow\x20error:\x20'+_0x31e88a);var _0x2921ed=_0x41c77e[_0x7a87('0x32')][_0x7a87('0xa8')]?0x1f4:_0x31e88a[_0x7a87('0xa9')]||0x1f4;logger['error'](_0x31e88a[_0x7a87('0x28')]);delete _0x31e88a[_0x7a87('0x29')];if(_0x2921ed===0x191){_0x2921ed=0x190;}_0x5249d4[_0x7a87('0x1b')](_0x2921ed)['send'](_0x41c77e[_0x7a87('0x32')][_0x7a87('0xa8')]?{'message':_0x7a87('0xaa'),'statusCode':_0x31e88a['statusCode']}:_0x31e88a);});};function createFieldObject(_0x169a5e,_0x5b8427,_0x29336b,_0xb0e5ad,_0x6df0cd,_0x517443){return new Promise(function(_0x139ffa,_0x414711){var _0x1fb3d1={'id':_0xb0e5ad,'name':_0x6df0cd,'custom':_0x517443};if(_0x29336b===_0x7a87('0xab')){_0x1fb3d1['options']=[{'name':_0x7a87('0xac'),'value':_0x7a87('0xad')},{'name':_0x7a87('0xae'),'value':_0x7a87('0xaf')}];_0x139ffa(_0x1fb3d1);}else{var _0x2c8c9c={'method':_0x7a87('0x9b'),'uri':_0x169a5e+_0x7a87('0xb0')+_0xb0e5ad,'auth':_0x5b8427,'json':!![]};return rp(_0x2c8c9c)[_0x7a87('0x24')](function(_0x550757){var _0x4b5897=[];if(_0x550757[_0x7a87('0x9d')]['length']>0x0){_0x550757[_0x7a87('0x9d')][_0x7a87('0xa1')](function(_0x518d3d){if(_0x518d3d[_0x7a87('0xb1')]===_0x7a87('0xaf')){var _0x2d18c3={'name':_0x518d3d['label'],'value':_0x518d3d[_0x7a87('0xb2')]};_0x4b5897[_0x7a87('0xa4')](_0x2d18c3);}});}_0x1fb3d1['options']=_0x4b5897;if(_0x1fb3d1[_0x7a87('0x3f')][_0x7a87('0x4e')]>0x0){_0x139ffa(_0x1fb3d1);}else{if(_0x517443==![]){_0x139ffa();}else{_0x139ffa(_0x1fb3d1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f42aed6..a0ccaa2 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x5a75a6,_0x357b0e){var _0x1180d2=function(_0x1115eb){while(--_0x1115eb){_0x5a75a6['push'](_0x5a75a6['shift']());}};_0x1180d2(++_0x357b0e);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'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'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x41d6b7,_0x4dde77){var _0x257ce8=function(_0x19e513){while(--_0x19e513){_0x41d6b7['push'](_0x41d6b7['shift']());}};_0x257ce8(++_0x4dde77);}(_0x687b,0x14a));var _0xb687=function(_0x38b0a1,_0x29da11){_0x38b0a1=_0x38b0a1-0x0;var _0x27d217=_0x687b[_0x38b0a1];return _0x27d217;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index be99a80..4a7c7e2 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 _0x8679=['ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','stringify','find'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8679,0xb5));var _0x9867=function(_0x2b975f,_0xf9e707){_0x2b975f=_0x2b975f-0x0;var _0xb9d4db=_0x8679[_0x2b975f];return _0xb9d4db;};'use strict';var _=require(_0x9867('0x0'));var util=require(_0x9867('0x1'));var moment=require(_0x9867('0x2'));var BPromise=require(_0x9867('0x3'));var rs=require(_0x9867('0x4'));var fs=require('fs');var Redis=require(_0x9867('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9867('0x6'));var logger=require(_0x9867('0x7'))(_0x9867('0x8'));var config=require(_0x9867('0x9'));var jayson=require(_0x9867('0xa'));var client=jayson[_0x9867('0xb')][_0x9867('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f7ccd,_0x258c85,_0x95d4b5){return new BPromise(function(_0x2b0732,_0x3d48d9){return client[_0x9867('0xd')](_0x3f7ccd,_0x95d4b5)[_0x9867('0xe')](function(_0x572672){logger['info'](_0x9867('0xf'),_0x258c85,'request\x20sent');logger['debug'](_0x9867('0x10'),_0x258c85,_0x9867('0x11'),JSON['stringify'](_0x572672));if(_0x572672[_0x9867('0x12')]){if(_0x572672[_0x9867('0x12')][_0x9867('0x13')]===0x1f4){logger[_0x9867('0x12')](_0x9867('0xf'),_0x258c85,_0x572672[_0x9867('0x12')][_0x9867('0x14')]);return _0x3d48d9(_0x572672[_0x9867('0x12')]['message']);}logger[_0x9867('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x258c85,_0x572672[_0x9867('0x12')]['message']);return _0x2b0732(_0x572672[_0x9867('0x12')][_0x9867('0x14')]);}else{logger[_0x9867('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x258c85,'request\x20sent');_0x2b0732(_0x572672[_0x9867('0x16')][_0x9867('0x14')]);}})[_0x9867('0x17')](function(_0x4435a7){logger[_0x9867('0x12')](_0x9867('0xf'),_0x258c85,_0x4435a7);_0x3d48d9(_0x4435a7);});});}exports['GetServicenowAccount']=function(_0x5b40f0){var _0x5717ad=this;return new Promise(function(_0x2b97bb,_0x38514d){return db['ServicenowAccount'][_0x9867('0x18')]({'raw':_0x5b40f0[_0x9867('0x19')]?_0x5b40f0[_0x9867('0x19')][_0x9867('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b40f0[_0x9867('0x19')]?_0x5b40f0[_0x9867('0x19')][_0x9867('0x1b')]||null:null,'attributes':_0x5b40f0[_0x9867('0x19')]?_0x5b40f0[_0x9867('0x19')][_0x9867('0x1c')]||null:null,'limit':_0x5b40f0[_0x9867('0x19')]?_0x5b40f0[_0x9867('0x19')]['limit']||null:null,'include':_0x5b40f0[_0x9867('0x19')]?_0x5b40f0[_0x9867('0x19')][_0x9867('0x1d')]?_['map'](_0x5b40f0[_0x9867('0x19')][_0x9867('0x1d')],function(_0x8a9cc){return{'model':db[_0x8a9cc['model']],'as':_0x8a9cc['as'],'attributes':_0x8a9cc[_0x9867('0x1c')],'include':_0x8a9cc[_0x9867('0x1d')]?_[_0x9867('0x1e')](_0x8a9cc[_0x9867('0x1d')],function(_0x49204b){return{'model':db[_0x49204b['model']],'as':_0x49204b['as'],'attributes':_0x49204b[_0x9867('0x1c')],'include':_0x49204b['include']?_[_0x9867('0x1e')](_0x49204b[_0x9867('0x1d')],function(_0x2b1e43){return{'model':db[_0x2b1e43[_0x9867('0x1f')]],'as':_0x2b1e43['as'],'attributes':_0x2b1e43[_0x9867('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x227ae0){logger[_0x9867('0x15')](_0x9867('0x20'),_0x5b40f0);logger['debug']('GetServicenowAccount',_0x5b40f0,JSON[_0x9867('0x21')](_0x227ae0));_0x2b97bb(_0x227ae0);})[_0x9867('0x17')](function(_0x257102){logger[_0x9867('0x12')](_0x9867('0x20'),_0x257102[_0x9867('0x14')],_0x5b40f0);_0x38514d(_0x5717ad[_0x9867('0x12')](0x1f4,_0x257102[_0x9867('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x1647b2){var _0x146af4=this;return new Promise(function(_0x449a74,_0x22331b){return db['ServicenowAccount'][_0x9867('0x22')]({'raw':_0x1647b2[_0x9867('0x19')]?_0x1647b2[_0x9867('0x19')][_0x9867('0x1a')]===undefined?!![]:![]:!![],'where':_0x1647b2[_0x9867('0x19')]?_0x1647b2[_0x9867('0x19')]['where']||null:null,'attributes':_0x1647b2[_0x9867('0x19')]?_0x1647b2[_0x9867('0x19')][_0x9867('0x1c')]||null:null,'include':_0x1647b2['options']?_0x1647b2[_0x9867('0x19')][_0x9867('0x1d')]?_[_0x9867('0x1e')](_0x1647b2[_0x9867('0x19')][_0x9867('0x1d')],function(_0x94711b){return{'model':db[_0x94711b[_0x9867('0x1f')]],'as':_0x94711b['as'],'attributes':_0x94711b[_0x9867('0x1c')],'include':_0x94711b[_0x9867('0x1d')]?_[_0x9867('0x1e')](_0x94711b[_0x9867('0x1d')],function(_0x1a2c30){return{'model':db[_0x1a2c30['model']],'as':_0x1a2c30['as'],'attributes':_0x1a2c30[_0x9867('0x1c')],'include':_0x1a2c30[_0x9867('0x1d')]?_[_0x9867('0x1e')](_0x1a2c30[_0x9867('0x1d')],function(_0x4c6618){return{'model':db[_0x4c6618[_0x9867('0x1f')]],'as':_0x4c6618['as'],'attributes':_0x4c6618[_0x9867('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53801b){logger['info'](_0x9867('0x23'),_0x1647b2);logger['debug'](_0x9867('0x23'),_0x1647b2,JSON[_0x9867('0x21')](_0x53801b));_0x449a74(_0x53801b);})[_0x9867('0x17')](function(_0x41da0b){logger[_0x9867('0x12')]('ShowServicenowAccount',_0x41da0b['message'],_0x1647b2);_0x22331b(_0x146af4[_0x9867('0x12')](0x1f4,_0x41da0b['message']));});});}; \ No newline at end of file +var _0x3be7=['stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','ShowServicenowAccount','find','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x3be7,0x16a));var _0x73be=function(_0x4477f8,_0x3d38ef){_0x4477f8=_0x4477f8-0x0;var _0x9e15b3=_0x3be7[_0x4477f8];return _0x9e15b3;};'use strict';var _=require(_0x73be('0x0'));var util=require('util');var moment=require(_0x73be('0x1'));var BPromise=require(_0x73be('0x2'));var rs=require(_0x73be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73be('0x4'))['db'];var utils=require(_0x73be('0x5'));var logger=require(_0x73be('0x6'))(_0x73be('0x7'));var config=require(_0x73be('0x8'));var jayson=require(_0x73be('0x9'));var client=jayson[_0x73be('0xa')][_0x73be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea3e9,_0x32f2bf,_0x19c615){return new BPromise(function(_0x1cc45b,_0x19bfa0){return client[_0x73be('0xc')](_0x1ea3e9,_0x19c615)[_0x73be('0xd')](function(_0x39a431){logger[_0x73be('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x32f2bf,_0x73be('0xf'));logger[_0x73be('0x10')](_0x73be('0x11'),_0x32f2bf,_0x73be('0xf'),JSON[_0x73be('0x12')](_0x39a431));if(_0x39a431[_0x73be('0x13')]){if(_0x39a431[_0x73be('0x13')][_0x73be('0x14')]===0x1f4){logger[_0x73be('0x13')](_0x73be('0x15'),_0x32f2bf,_0x39a431[_0x73be('0x13')][_0x73be('0x16')]);return _0x19bfa0(_0x39a431[_0x73be('0x13')][_0x73be('0x16')]);}logger[_0x73be('0x13')](_0x73be('0x15'),_0x32f2bf,_0x39a431[_0x73be('0x13')][_0x73be('0x16')]);return _0x1cc45b(_0x39a431['error'][_0x73be('0x16')]);}else{logger[_0x73be('0xe')](_0x73be('0x15'),_0x32f2bf,'request\x20sent');_0x1cc45b(_0x39a431[_0x73be('0x17')][_0x73be('0x16')]);}})[_0x73be('0x18')](function(_0x3bb30e){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x32f2bf,_0x3bb30e);_0x19bfa0(_0x3bb30e);});});}exports[_0x73be('0x19')]=function(_0x5e5886){var _0x187deb=this;return new Promise(function(_0x10ed38,_0x1f7169){return db[_0x73be('0x1a')][_0x73be('0x1b')]({'raw':_0x5e5886[_0x73be('0x1c')]?_0x5e5886[_0x73be('0x1c')][_0x73be('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e5886['options']?_0x5e5886['options']['where']||null:null,'attributes':_0x5e5886[_0x73be('0x1c')]?_0x5e5886[_0x73be('0x1c')]['attributes']||null:null,'limit':_0x5e5886[_0x73be('0x1c')]?_0x5e5886[_0x73be('0x1c')][_0x73be('0x1e')]||null:null,'include':_0x5e5886[_0x73be('0x1c')]?_0x5e5886['options'][_0x73be('0x1f')]?_[_0x73be('0x20')](_0x5e5886[_0x73be('0x1c')][_0x73be('0x1f')],function(_0x50309d){return{'model':db[_0x50309d[_0x73be('0x21')]],'as':_0x50309d['as'],'attributes':_0x50309d[_0x73be('0x22')],'include':_0x50309d[_0x73be('0x1f')]?_[_0x73be('0x20')](_0x50309d[_0x73be('0x1f')],function(_0x29044a){return{'model':db[_0x29044a['model']],'as':_0x29044a['as'],'attributes':_0x29044a[_0x73be('0x22')],'include':_0x29044a['include']?_['map'](_0x29044a['include'],function(_0x3fcc41){return{'model':db[_0x3fcc41['model']],'as':_0x3fcc41['as'],'attributes':_0x3fcc41['attributes']};}):[]};}):[]};}):[]:[]})[_0x73be('0xd')](function(_0x190dd8){logger[_0x73be('0xe')](_0x73be('0x19'),_0x5e5886);logger[_0x73be('0x10')](_0x73be('0x19'),_0x5e5886,JSON[_0x73be('0x12')](_0x190dd8));_0x10ed38(_0x190dd8);})[_0x73be('0x18')](function(_0x42618a){logger['error'](_0x73be('0x19'),_0x42618a['message'],_0x5e5886);_0x1f7169(_0x187deb[_0x73be('0x13')](0x1f4,_0x42618a[_0x73be('0x16')]));});});};exports[_0x73be('0x23')]=function(_0x5d54ed){var _0xcc39e3=this;return new Promise(function(_0x1f4e01,_0x5dcaf8){return db[_0x73be('0x1a')][_0x73be('0x24')]({'raw':_0x5d54ed[_0x73be('0x1c')]?_0x5d54ed[_0x73be('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5d54ed['options']?_0x5d54ed[_0x73be('0x1c')][_0x73be('0x25')]||null:null,'attributes':_0x5d54ed[_0x73be('0x1c')]?_0x5d54ed['options'][_0x73be('0x22')]||null:null,'include':_0x5d54ed['options']?_0x5d54ed['options'][_0x73be('0x1f')]?_[_0x73be('0x20')](_0x5d54ed[_0x73be('0x1c')][_0x73be('0x1f')],function(_0x83082d){return{'model':db[_0x83082d[_0x73be('0x21')]],'as':_0x83082d['as'],'attributes':_0x83082d[_0x73be('0x22')],'include':_0x83082d[_0x73be('0x1f')]?_[_0x73be('0x20')](_0x83082d[_0x73be('0x1f')],function(_0x515728){return{'model':db[_0x515728[_0x73be('0x21')]],'as':_0x515728['as'],'attributes':_0x515728[_0x73be('0x22')],'include':_0x515728[_0x73be('0x1f')]?_[_0x73be('0x20')](_0x515728['include'],function(_0x30a76b){return{'model':db[_0x30a76b[_0x73be('0x21')]],'as':_0x30a76b['as'],'attributes':_0x30a76b[_0x73be('0x22')]};}):[]};}):[]};}):[]:[]})[_0x73be('0xd')](function(_0x1220bd){logger[_0x73be('0xe')](_0x73be('0x23'),_0x5d54ed);logger[_0x73be('0x10')](_0x73be('0x23'),_0x5d54ed,JSON[_0x73be('0x12')](_0x1220bd));_0x1f4e01(_0x1220bd);})[_0x73be('0x18')](function(_0x4eb632){logger[_0x73be('0x13')](_0x73be('0x23'),_0x4eb632['message'],_0x5d54ed);_0x5dcaf8(_0xcc39e3[_0x73be('0x13')](0x1f4,_0x4eb632[_0x73be('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3339293..e897900 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 _0x55ee=['get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','express','Router','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x55ee,0xff));var _0xe55e=function(_0x131232,_0x1ec36c){_0x131232=_0x131232-0x0;var _0x50110e=_0x55ee[_0x131232];return _0x50110e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe55e('0x0'));var router=express[_0xe55e('0x1')]();var fs_extra=require(_0xe55e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe55e('0x3'));var config=require('../../config/environment');var controller=require(_0xe55e('0x4'));router[_0xe55e('0x5')]('/',auth[_0xe55e('0x6')](),controller[_0xe55e('0x7')]);router[_0xe55e('0x5')](_0xe55e('0x8'),auth[_0xe55e('0x6')](),controller['show']);router[_0xe55e('0x5')](_0xe55e('0x9'),auth[_0xe55e('0x6')](),controller[_0xe55e('0xa')]);router[_0xe55e('0x5')]('/:id/subjects',auth[_0xe55e('0x6')](),controller[_0xe55e('0xb')]);router['get'](_0xe55e('0xc'),auth[_0xe55e('0x6')](),controller[_0xe55e('0xd')]);router[_0xe55e('0xe')]('/',auth[_0xe55e('0x6')](),controller[_0xe55e('0xf')]);router[_0xe55e('0x10')](_0xe55e('0x8'),auth[_0xe55e('0x6')](),controller[_0xe55e('0x11')]);router[_0xe55e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe55e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1038=['isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','put','destroy','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller'];(function(_0x38a5ed,_0x497f2d){var _0x629a6c=function(_0x52dc97){while(--_0x52dc97){_0x38a5ed['push'](_0x38a5ed['shift']());}};_0x629a6c(++_0x497f2d);}(_0x1038,0x10b));var _0x8103=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x1038[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8103('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8103('0x1'));var auth=require(_0x8103('0x2'));var interaction=require(_0x8103('0x3'));var config=require('../../config/environment');var controller=require(_0x8103('0x4'));router['get']('/',auth[_0x8103('0x5')](),controller[_0x8103('0x6')]);router[_0x8103('0x7')](_0x8103('0x8'),auth[_0x8103('0x5')](),controller['show']);router[_0x8103('0x7')](_0x8103('0x9'),auth[_0x8103('0x5')](),controller[_0x8103('0xa')]);router[_0x8103('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8103('0xb')]);router['get'](_0x8103('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x8103('0x5')](),controller['create']);router[_0x8103('0xd')]('/:id',auth[_0x8103('0x5')](),controller['update']);router['delete'](_0x8103('0x8'),auth[_0x8103('0x5')](),controller[_0x8103('0xe')]);module[_0x8103('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5afb1c2..4e5b592 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 _0xd6d3=['exports','STRING','sequelize'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xd6d3,0x158));var _0x3d6d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd6d3[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x3d6d('0x0'));module[_0x3d6d('0x1')]={'name':{'type':Sequelize[_0x3d6d('0x2')]},'description':{'type':Sequelize[_0x3d6d('0x2')]}}; \ No newline at end of file +var _0xa57f=['exports','STRING','sequelize'];(function(_0x217d72,_0x3f5082){var _0x4aa168=function(_0x42aeec){while(--_0x42aeec){_0x217d72['push'](_0x217d72['shift']());}};_0x4aa168(++_0x3f5082);}(_0xa57f,0xe9));var _0xfa57=function(_0x46cf62,_0x27111e){_0x46cf62=_0x46cf62-0x0;var _0x2b24fa=_0xa57f[_0x46cf62];return _0x2b24fa;};'use strict';var Sequelize=require(_0xfa57('0x0'));module[_0xfa57('0x1')]={'name':{'type':Sequelize[_0xfa57('0x2')]},'description':{'type':Sequelize[_0xfa57('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9f147a3..4be1d6a 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 _0x4c6d=['model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','catch','show','params','intersection','create','body','find','destroy','getFields','findOne','ServicenowField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2c9f51,_0x2eec01){var _0x12abf9=function(_0x2d463f){while(--_0x2d463f){_0x2c9f51['push'](_0x2c9f51['shift']());}};_0x12abf9(++_0x2eec01);}(_0x4c6d,0x171));var _0xd4c6=function(_0x2250d0,_0xd3c319){_0x2250d0=_0x2250d0-0x0;var _0xe2ca52=_0x4c6d[_0x2250d0];return _0xe2ca52;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require(_0xd4c6('0x5'));var BPromise=require(_0xd4c6('0x6'));var Mustache=require('mustache');var util=require(_0xd4c6('0x7'));var path=require(_0xd4c6('0x8'));var sox=require(_0xd4c6('0x9'));var csv=require(_0xd4c6('0xa'));var ejs=require(_0xd4c6('0xb'));var fs=require('fs');var fs_extra=require(_0xd4c6('0xc'));var _=require(_0xd4c6('0xd'));var squel=require('squel');var crypto=require(_0xd4c6('0xe'));var jsforce=require(_0xd4c6('0xf'));var deskjs=require(_0xd4c6('0x10'));var toCsv=require(_0xd4c6('0xa'));var querystring=require('querystring');var Papa=require(_0xd4c6('0x11'));var Redis=require(_0xd4c6('0x12'));var authService=require(_0xd4c6('0x13'));var qs=require(_0xd4c6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4c6('0x15'));var logger=require('../../config/logger')(_0xd4c6('0x16'));var utils=require(_0xd4c6('0x17'));var config=require(_0xd4c6('0x18'));var licenseUtil=require(_0xd4c6('0x19'));var db=require(_0xd4c6('0x1a'))['db'];function respondWithStatusCode(_0x4af138,_0x977217){_0x977217=_0x977217||0xcc;return function(_0x7567f1){if(_0x7567f1){return _0x4af138[_0xd4c6('0x1b')](_0x977217);}return _0x4af138[_0xd4c6('0x1c')](_0x977217)[_0xd4c6('0x1d')]();};}function respondWithResult(_0x546fc3,_0x2d5b75){_0x2d5b75=_0x2d5b75||0xc8;return function(_0x5a3a72){if(_0x5a3a72){return _0x546fc3[_0xd4c6('0x1c')](_0x2d5b75)[_0xd4c6('0x1e')](_0x5a3a72);}};}function respondWithFilteredResult(_0x1b16b,_0x285d41){return function(_0x1b3245){if(_0x1b3245){var _0x7d8fc3=typeof _0x285d41[_0xd4c6('0x1f')]===_0xd4c6('0x20')&&typeof _0x285d41['limit']===_0xd4c6('0x20');var _0x473f81=_0x1b3245[_0xd4c6('0x21')];var _0x21a5ab=_0x7d8fc3?0x0:_0x285d41['offset'];var _0x216168=_0x7d8fc3?_0x1b3245[_0xd4c6('0x21')]:_0x285d41[_0xd4c6('0x1f')]+_0x285d41[_0xd4c6('0x22')];var _0x4c7f35;if(_0x216168>=_0x473f81){_0x216168=_0x473f81;_0x4c7f35=0xc8;}else{_0x4c7f35=0xce;}_0x1b16b['status'](_0x4c7f35);return _0x1b16b[_0xd4c6('0x23')]('Content-Range',_0x21a5ab+'-'+_0x216168+'/'+_0x473f81)[_0xd4c6('0x1e')](_0x1b3245);}return null;};}function patchUpdates(_0x5953a5){return function(_0x1ed2b6){try{jsonpatch[_0xd4c6('0x24')](_0x1ed2b6,_0x5953a5,!![]);}catch(_0x58a025){return BPromise[_0xd4c6('0x25')](_0x58a025);}return _0x1ed2b6[_0xd4c6('0x26')]();};}function saveUpdates(_0x3fcd5f,_0x277e7c){return function(_0x36239e){if(_0x36239e){return _0x36239e[_0xd4c6('0x27')](_0x3fcd5f)[_0xd4c6('0x28')](function(_0x11b30c){return _0x11b30c;});}return null;};}function removeEntity(_0x7a1018,_0x106f4a){return function(_0x26dcf8){if(_0x26dcf8){return _0x26dcf8['destroy']()[_0xd4c6('0x28')](function(){_0x7a1018[_0xd4c6('0x1c')](0xcc)[_0xd4c6('0x1d')]();});}};}function handleEntityNotFound(_0x5a5953,_0x184f2a){return function(_0x57ed88){if(!_0x57ed88){_0x5a5953['sendStatus'](0x194);}return _0x57ed88;};}function handleError(_0x5cc0bf,_0x244367){_0x244367=_0x244367||0x1f4;return function(_0xc51e0a){logger[_0xd4c6('0x29')](_0xc51e0a[_0xd4c6('0x2a')]);if(_0xc51e0a[_0xd4c6('0x2b')]){delete _0xc51e0a[_0xd4c6('0x2b')];}_0x5cc0bf[_0xd4c6('0x1c')](_0x244367)[_0xd4c6('0x2c')](_0xc51e0a);};}exports[_0xd4c6('0x2d')]=function(_0x57825f,_0x32714d){var _0x3e5aef={},_0x508934={},_0x1a74ee={'count':0x0,'rows':[]};var _0x5e0a21=_[_0xd4c6('0x2e')](db['ServicenowConfiguration'][_0xd4c6('0x2f')],function(_0x18e153){return{'name':_0x18e153[_0xd4c6('0x30')],'type':_0x18e153[_0xd4c6('0x31')][_0xd4c6('0x32')]};});_0x508934[_0xd4c6('0x33')]=_[_0xd4c6('0x2e')](_0x5e0a21,_0xd4c6('0x2b'));_0x508934['query']=_[_0xd4c6('0x34')](_0x57825f['query']);_0x508934[_0xd4c6('0x35')]=_['intersection'](_0x508934['model'],_0x508934[_0xd4c6('0x36')]);_0x3e5aef[_0xd4c6('0x37')]=_['intersection'](_0x508934['model'],qs[_0xd4c6('0x38')](_0x57825f[_0xd4c6('0x36')]['fields']));_0x3e5aef[_0xd4c6('0x37')]=_0x3e5aef[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x3e5aef[_0xd4c6('0x37')]:_0x508934[_0xd4c6('0x33')];if(!_0x57825f['query']['hasOwnProperty'](_0xd4c6('0x3a'))){_0x3e5aef[_0xd4c6('0x22')]=qs['limit'](_0x57825f[_0xd4c6('0x36')][_0xd4c6('0x22')]);_0x3e5aef[_0xd4c6('0x1f')]=qs['offset'](_0x57825f[_0xd4c6('0x36')][_0xd4c6('0x1f')]);}_0x3e5aef['order']=qs[_0xd4c6('0x3b')](_0x57825f[_0xd4c6('0x36')][_0xd4c6('0x3b')]);_0x3e5aef[_0xd4c6('0x3c')]=qs[_0xd4c6('0x35')](_[_0xd4c6('0x3d')](_0x57825f[_0xd4c6('0x36')],_0x508934[_0xd4c6('0x35')]),_0x5e0a21);if(_0x57825f['query'][_0xd4c6('0x3e')]){_0x3e5aef[_0xd4c6('0x3c')]=_[_0xd4c6('0x3f')](_0x3e5aef[_0xd4c6('0x3c')],{'$or':_[_0xd4c6('0x2e')](_0x5e0a21,function(_0x891a7f){if(_0x891a7f['type']!==_0xd4c6('0x40')){var _0x21f252={};_0x21f252[_0x891a7f[_0xd4c6('0x2b')]]={'$like':'%'+_0x57825f['query']['filter']+'%'};return _0x21f252;}})});}_0x3e5aef=_[_0xd4c6('0x3f')]({},_0x3e5aef,_0x57825f[_0xd4c6('0x41')]);var _0x58b218={'where':_0x3e5aef[_0xd4c6('0x3c')]};return db[_0xd4c6('0x42')]['count'](_0x58b218)['then'](function(_0x5be24a){_0x1a74ee[_0xd4c6('0x21')]=_0x5be24a;if(_0x57825f[_0xd4c6('0x36')][_0xd4c6('0x43')]){_0x3e5aef[_0xd4c6('0x44')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x3e5aef);})['then'](function(_0x2ebf02){_0x1a74ee['rows']=_0x2ebf02;return _0x1a74ee;})['then'](respondWithFilteredResult(_0x32714d,_0x3e5aef))[_0xd4c6('0x45')](handleError(_0x32714d,null));};exports[_0xd4c6('0x46')]=function(_0x368905,_0x513743){var _0xbb6217={'raw':![],'where':{'id':_0x368905[_0xd4c6('0x47')]['id']}},_0x1bf20e={};_0x1bf20e['model']=_[_0xd4c6('0x34')](db[_0xd4c6('0x42')][_0xd4c6('0x2f')]);_0x1bf20e['query']=_['keys'](_0x368905[_0xd4c6('0x36')]);_0x1bf20e[_0xd4c6('0x35')]=_[_0xd4c6('0x48')](_0x1bf20e[_0xd4c6('0x33')],_0x1bf20e['query']);_0xbb6217['attributes']=_['intersection'](_0x1bf20e[_0xd4c6('0x33')],qs[_0xd4c6('0x38')](_0x368905[_0xd4c6('0x36')]['fields']));_0xbb6217[_0xd4c6('0x37')]=_0xbb6217[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0xbb6217[_0xd4c6('0x37')]:_0x1bf20e[_0xd4c6('0x33')];if(_0x368905['query'][_0xd4c6('0x43')]){_0xbb6217[_0xd4c6('0x44')]=[{'all':!![]}];}_0xbb6217=_['merge']({},_0xbb6217,_0x368905[_0xd4c6('0x41')]);return db[_0xd4c6('0x42')]['find'](_0xbb6217)[_0xd4c6('0x28')](handleEntityNotFound(_0x513743,null))[_0xd4c6('0x28')](respondWithResult(_0x513743,null))['catch'](handleError(_0x513743,null));};exports[_0xd4c6('0x49')]=function(_0xd25771,_0x2059c4){return db[_0xd4c6('0x42')][_0xd4c6('0x49')](_0xd25771[_0xd4c6('0x4a')],{})[_0xd4c6('0x28')](respondWithResult(_0x2059c4,0xc9))[_0xd4c6('0x45')](handleError(_0x2059c4,null));};exports[_0xd4c6('0x27')]=function(_0x3da0fa,_0x42c7d6){if(_0x3da0fa[_0xd4c6('0x4a')]['id']){delete _0x3da0fa['body']['id'];}return db[_0xd4c6('0x42')][_0xd4c6('0x4b')]({'where':{'id':_0x3da0fa[_0xd4c6('0x47')]['id']}})[_0xd4c6('0x28')](handleEntityNotFound(_0x42c7d6,null))['then'](saveUpdates(_0x3da0fa[_0xd4c6('0x4a')],null))['then'](respondWithResult(_0x42c7d6,null))['catch'](handleError(_0x42c7d6,null));};exports[_0xd4c6('0x4c')]=function(_0x1f9473,_0x4c3183){return db[_0xd4c6('0x42')][_0xd4c6('0x4b')]({'where':{'id':_0x1f9473[_0xd4c6('0x47')]['id']}})[_0xd4c6('0x28')](handleEntityNotFound(_0x4c3183,null))['then'](removeEntity(_0x4c3183,null))[_0xd4c6('0x45')](handleError(_0x4c3183,null));};exports[_0xd4c6('0x4d')]=function(_0x1dc027,_0x1f0901,_0x2b8a6b){var _0x1bd8ce={};var _0x55a5b6={};var _0x2bab37;var _0xbe1793;return db[_0xd4c6('0x42')][_0xd4c6('0x4e')]({'where':{'id':_0x1dc027[_0xd4c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f0901,null))[_0xd4c6('0x28')](function(_0x4b83e3){if(_0x4b83e3){_0x2bab37=_0x4b83e3;_0x55a5b6['model']=_['keys'](db[_0xd4c6('0x4f')][_0xd4c6('0x2f')]);_0x55a5b6['query']=_['keys'](_0x1dc027['query']);_0x55a5b6[_0xd4c6('0x35')]=_[_0xd4c6('0x48')](_0x55a5b6[_0xd4c6('0x33')],_0x55a5b6['query']);_0x1bd8ce[_0xd4c6('0x37')]=_[_0xd4c6('0x48')](_0x55a5b6['model'],qs[_0xd4c6('0x38')](_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x38')]));_0x1bd8ce['attributes']=_0x1bd8ce[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x1bd8ce['attributes']:_0x55a5b6[_0xd4c6('0x33')];_0x1bd8ce[_0xd4c6('0x50')]=qs['sort'](_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x3b')]);_0x1bd8ce['where']=qs[_0xd4c6('0x35')](_[_0xd4c6('0x3d')](_0x1dc027[_0xd4c6('0x36')],_0x55a5b6[_0xd4c6('0x35')]));if(_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x3e')]){_0x1bd8ce['where']=_[_0xd4c6('0x3f')](_0x1bd8ce['where'],{'$or':_[_0xd4c6('0x2e')](_0x1bd8ce['attributes'],function(_0x10b272){var _0x28810a={};_0x28810a[_0x10b272]={'$like':'%'+_0x1dc027[_0xd4c6('0x36')]['filter']+'%'};return _0x28810a;})});}_0x1bd8ce=_[_0xd4c6('0x3f')]({},_0x1bd8ce,_0x1dc027[_0xd4c6('0x41')]);return _0x2bab37[_0xd4c6('0x4d')](_0x1bd8ce);}})[_0xd4c6('0x28')](function(_0x57dc16){if(_0x57dc16){_0xbe1793=_0x57dc16[_0xd4c6('0x39')];if(!_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x51')](_0xd4c6('0x3a'))){_0x1bd8ce[_0xd4c6('0x22')]=qs['limit'](_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x22')]);_0x1bd8ce['offset']=qs[_0xd4c6('0x1f')](_0x1dc027[_0xd4c6('0x36')][_0xd4c6('0x1f')]);}return _0x2bab37['getFields'](_0x1bd8ce);}})[_0xd4c6('0x28')](function(_0x2e0b19){if(_0x2e0b19){return _0x2e0b19?{'count':_0xbe1793,'rows':_0x2e0b19}:null;}})[_0xd4c6('0x28')](respondWithResult(_0x1f0901,null))[_0xd4c6('0x45')](handleError(_0x1f0901,null));};exports[_0xd4c6('0x52')]=function(_0x231076,_0x2da194,_0x256a6a){var _0x5e1b2d={};var _0x5129b7={};var _0x5cf7fc;var _0x450a71;return db['ServicenowConfiguration'][_0xd4c6('0x4e')]({'where':{'id':_0x231076[_0xd4c6('0x47')]['id']}})[_0xd4c6('0x28')](handleEntityNotFound(_0x2da194,null))[_0xd4c6('0x28')](function(_0x3f3a6b){if(_0x3f3a6b){_0x5cf7fc=_0x3f3a6b;_0x5129b7[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x4f')]['rawAttributes']);_0x5129b7[_0xd4c6('0x36')]=_[_0xd4c6('0x34')](_0x231076['query']);_0x5129b7[_0xd4c6('0x35')]=_[_0xd4c6('0x48')](_0x5129b7['model'],_0x5129b7['query']);_0x5e1b2d[_0xd4c6('0x37')]=_['intersection'](_0x5129b7['model'],qs[_0xd4c6('0x38')](_0x231076['query'][_0xd4c6('0x38')]));_0x5e1b2d[_0xd4c6('0x37')]=_0x5e1b2d[_0xd4c6('0x37')]['length']?_0x5e1b2d[_0xd4c6('0x37')]:_0x5129b7[_0xd4c6('0x33')];_0x5e1b2d['order']=qs['sort'](_0x231076['query'][_0xd4c6('0x3b')]);_0x5e1b2d[_0xd4c6('0x3c')]=qs[_0xd4c6('0x35')](_['pick'](_0x231076[_0xd4c6('0x36')],_0x5129b7['filters']));if(_0x231076[_0xd4c6('0x36')][_0xd4c6('0x3e')]){_0x5e1b2d[_0xd4c6('0x3c')]=_[_0xd4c6('0x3f')](_0x5e1b2d[_0xd4c6('0x3c')],{'$or':_[_0xd4c6('0x2e')](_0x5e1b2d[_0xd4c6('0x37')],function(_0xc00191){var _0x3fbc54={};_0x3fbc54[_0xc00191]={'$like':'%'+_0x231076[_0xd4c6('0x36')]['filter']+'%'};return _0x3fbc54;})});}_0x5e1b2d=_[_0xd4c6('0x3f')]({},_0x5e1b2d,_0x231076['options']);return _0x5cf7fc[_0xd4c6('0x52')](_0x5e1b2d);}})[_0xd4c6('0x28')](function(_0x305d96){if(_0x305d96){_0x450a71=_0x305d96[_0xd4c6('0x39')];if(!_0x231076[_0xd4c6('0x36')]['hasOwnProperty'](_0xd4c6('0x3a'))){_0x5e1b2d['limit']=qs[_0xd4c6('0x22')](_0x231076['query']['limit']);_0x5e1b2d[_0xd4c6('0x1f')]=qs[_0xd4c6('0x1f')](_0x231076['query'][_0xd4c6('0x1f')]);}return _0x5cf7fc['getSubjects'](_0x5e1b2d);}})['then'](function(_0xef9ef9){if(_0xef9ef9){return _0xef9ef9?{'count':_0x450a71,'rows':_0xef9ef9}:null;}})[_0xd4c6('0x28')](respondWithResult(_0x2da194,null))[_0xd4c6('0x45')](handleError(_0x2da194,null));};exports[_0xd4c6('0x53')]=function(_0x4cc375,_0x34c558,_0x1eb2b8){var _0x4fab2a={};var _0x1c88c9={};var _0x136aa7;var _0x32b90e;return db[_0xd4c6('0x42')]['findOne']({'where':{'id':_0x4cc375['params']['id']}})[_0xd4c6('0x28')](handleEntityNotFound(_0x34c558,null))[_0xd4c6('0x28')](function(_0x3be48a){if(_0x3be48a){_0x136aa7=_0x3be48a;_0x1c88c9[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](db['ServicenowField'][_0xd4c6('0x2f')]);_0x1c88c9[_0xd4c6('0x36')]=_[_0xd4c6('0x34')](_0x4cc375[_0xd4c6('0x36')]);_0x1c88c9['filters']=_[_0xd4c6('0x48')](_0x1c88c9[_0xd4c6('0x33')],_0x1c88c9['query']);_0x4fab2a[_0xd4c6('0x37')]=_[_0xd4c6('0x48')](_0x1c88c9['model'],qs[_0xd4c6('0x38')](_0x4cc375['query'][_0xd4c6('0x38')]));_0x4fab2a[_0xd4c6('0x37')]=_0x4fab2a['attributes'][_0xd4c6('0x39')]?_0x4fab2a[_0xd4c6('0x37')]:_0x1c88c9[_0xd4c6('0x33')];_0x4fab2a[_0xd4c6('0x50')]=qs[_0xd4c6('0x3b')](_0x4cc375[_0xd4c6('0x36')][_0xd4c6('0x3b')]);_0x4fab2a[_0xd4c6('0x3c')]=qs[_0xd4c6('0x35')](_[_0xd4c6('0x3d')](_0x4cc375[_0xd4c6('0x36')],_0x1c88c9[_0xd4c6('0x35')]));if(_0x4cc375['query'][_0xd4c6('0x3e')]){_0x4fab2a[_0xd4c6('0x3c')]=_[_0xd4c6('0x3f')](_0x4fab2a[_0xd4c6('0x3c')],{'$or':_[_0xd4c6('0x2e')](_0x4fab2a[_0xd4c6('0x37')],function(_0x3952cd){var _0x5ac063={};_0x5ac063[_0x3952cd]={'$like':'%'+_0x4cc375[_0xd4c6('0x36')][_0xd4c6('0x3e')]+'%'};return _0x5ac063;})});}_0x4fab2a=_[_0xd4c6('0x3f')]({},_0x4fab2a,_0x4cc375[_0xd4c6('0x41')]);return _0x136aa7[_0xd4c6('0x53')](_0x4fab2a);}})['then'](function(_0x7340d7){if(_0x7340d7){_0x32b90e=_0x7340d7['length'];if(!_0x4cc375[_0xd4c6('0x36')]['hasOwnProperty'](_0xd4c6('0x3a'))){_0x4fab2a[_0xd4c6('0x22')]=qs[_0xd4c6('0x22')](_0x4cc375[_0xd4c6('0x36')][_0xd4c6('0x22')]);_0x4fab2a[_0xd4c6('0x1f')]=qs[_0xd4c6('0x1f')](_0x4cc375[_0xd4c6('0x36')][_0xd4c6('0x1f')]);}return _0x136aa7[_0xd4c6('0x53')](_0x4fab2a);}})[_0xd4c6('0x28')](function(_0xcb8176){if(_0xcb8176){return _0xcb8176?{'count':_0x32b90e,'rows':_0xcb8176}:null;}})[_0xd4c6('0x28')](respondWithResult(_0x34c558,null))['catch'](handleError(_0x34c558,null));}; \ No newline at end of file +var _0x8c99=['name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','options','include','rows','catch','params','find','create','body','getFields','findOne','ServicenowField','pick','hasOwnProperty','nolimit','getSubjects','filter','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack'];(function(_0x53bfe6,_0x18a92c){var _0x1f6289=function(_0x2d5ba5){while(--_0x2d5ba5){_0x53bfe6['push'](_0x53bfe6['shift']());}};_0x1f6289(++_0x18a92c);}(_0x8c99,0x1e7));var _0x98c9=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x8c99[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98c9('0x0'));var zipdir=require(_0x98c9('0x1'));var jsonpatch=require(_0x98c9('0x2'));var rp=require(_0x98c9('0x3'));var moment=require('moment');var BPromise=require(_0x98c9('0x4'));var Mustache=require(_0x98c9('0x5'));var util=require(_0x98c9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98c9('0x7'));var fs=require('fs');var fs_extra=require(_0x98c9('0x8'));var _=require('lodash');var squel=require(_0x98c9('0x9'));var crypto=require(_0x98c9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x98c9('0xb'));var toCsv=require('to-csv');var querystring=require(_0x98c9('0xc'));var Papa=require(_0x98c9('0xd'));var Redis=require(_0x98c9('0xe'));var authService=require(_0x98c9('0xf'));var qs=require(_0x98c9('0x10'));var as=require(_0x98c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98c9('0x12'))('api');var utils=require(_0x98c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x98c9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265ff9,_0x48a153){_0x48a153=_0x48a153||0xcc;return function(_0x5d074d){if(_0x5d074d){return _0x265ff9['sendStatus'](_0x48a153);}return _0x265ff9['status'](_0x48a153)[_0x98c9('0x15')]();};}function respondWithResult(_0x458862,_0x530124){_0x530124=_0x530124||0xc8;return function(_0x2a29d9){if(_0x2a29d9){return _0x458862[_0x98c9('0x16')](_0x530124)[_0x98c9('0x17')](_0x2a29d9);}};}function respondWithFilteredResult(_0xa6cdb0,_0x524b0f){return function(_0x5ee4f1){if(_0x5ee4f1){var _0x20a94=typeof _0x524b0f[_0x98c9('0x18')]===_0x98c9('0x19')&&typeof _0x524b0f[_0x98c9('0x1a')]===_0x98c9('0x19');var _0x640dba=_0x5ee4f1[_0x98c9('0x1b')];var _0x5bacab=_0x20a94?0x0:_0x524b0f[_0x98c9('0x18')];var _0x4f280b=_0x20a94?_0x5ee4f1['count']:_0x524b0f[_0x98c9('0x18')]+_0x524b0f['limit'];var _0x2ccb81;if(_0x4f280b>=_0x640dba){_0x4f280b=_0x640dba;_0x2ccb81=0xc8;}else{_0x2ccb81=0xce;}_0xa6cdb0[_0x98c9('0x16')](_0x2ccb81);return _0xa6cdb0[_0x98c9('0x1c')](_0x98c9('0x1d'),_0x5bacab+'-'+_0x4f280b+'/'+_0x640dba)[_0x98c9('0x17')](_0x5ee4f1);}return null;};}function patchUpdates(_0x4912a5){return function(_0x3cf8f5){try{jsonpatch[_0x98c9('0x1e')](_0x3cf8f5,_0x4912a5,!![]);}catch(_0x3ce6c7){return BPromise[_0x98c9('0x1f')](_0x3ce6c7);}return _0x3cf8f5[_0x98c9('0x20')]();};}function saveUpdates(_0x37b484,_0x163952){return function(_0x538136){if(_0x538136){return _0x538136[_0x98c9('0x21')](_0x37b484)['then'](function(_0x614dc3){return _0x614dc3;});}return null;};}function removeEntity(_0x40dfce,_0x24d9fe){return function(_0x44dd98){if(_0x44dd98){return _0x44dd98[_0x98c9('0x22')]()[_0x98c9('0x23')](function(){_0x40dfce[_0x98c9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177faf,_0x3142db){return function(_0x27e631){if(!_0x27e631){_0x177faf[_0x98c9('0x24')](0x194);}return _0x27e631;};}function handleError(_0x11dd0e,_0x248f08){_0x248f08=_0x248f08||0x1f4;return function(_0x4c9ad0){logger['error'](_0x4c9ad0[_0x98c9('0x25')]);if(_0x4c9ad0[_0x98c9('0x26')]){delete _0x4c9ad0['name'];}_0x11dd0e[_0x98c9('0x16')](_0x248f08)[_0x98c9('0x27')](_0x4c9ad0);};}exports[_0x98c9('0x28')]=function(_0x53d56b,_0x53d3c9){var _0x357961={},_0x82831f={},_0x311b5e={'count':0x0,'rows':[]};var _0xa5ce6a=_[_0x98c9('0x29')](db[_0x98c9('0x2a')][_0x98c9('0x2b')],function(_0x2f84ab){return{'name':_0x2f84ab[_0x98c9('0x2c')],'type':_0x2f84ab[_0x98c9('0x2d')][_0x98c9('0x2e')]};});_0x82831f[_0x98c9('0x2f')]=_[_0x98c9('0x29')](_0xa5ce6a,'name');_0x82831f[_0x98c9('0x30')]=_[_0x98c9('0x31')](_0x53d56b['query']);_0x82831f[_0x98c9('0x32')]=_[_0x98c9('0x33')](_0x82831f[_0x98c9('0x2f')],_0x82831f[_0x98c9('0x30')]);_0x357961[_0x98c9('0x34')]=_[_0x98c9('0x33')](_0x82831f['model'],qs[_0x98c9('0x35')](_0x53d56b[_0x98c9('0x30')]['fields']));_0x357961[_0x98c9('0x34')]=_0x357961[_0x98c9('0x34')][_0x98c9('0x36')]?_0x357961['attributes']:_0x82831f['model'];if(!_0x53d56b[_0x98c9('0x30')]['hasOwnProperty']('nolimit')){_0x357961[_0x98c9('0x1a')]=qs[_0x98c9('0x1a')](_0x53d56b[_0x98c9('0x30')]['limit']);_0x357961['offset']=qs[_0x98c9('0x18')](_0x53d56b['query']['offset']);}_0x357961[_0x98c9('0x37')]=qs[_0x98c9('0x38')](_0x53d56b[_0x98c9('0x30')][_0x98c9('0x38')]);_0x357961[_0x98c9('0x39')]=qs[_0x98c9('0x32')](_['pick'](_0x53d56b[_0x98c9('0x30')],_0x82831f['filters']),_0xa5ce6a);if(_0x53d56b[_0x98c9('0x30')]['filter']){_0x357961[_0x98c9('0x39')]=_[_0x98c9('0x3a')](_0x357961[_0x98c9('0x39')],{'$or':_[_0x98c9('0x29')](_0xa5ce6a,function(_0x9513b8){if(_0x9513b8[_0x98c9('0x2d')]!=='VIRTUAL'){var _0x2c93e9={};_0x2c93e9[_0x9513b8[_0x98c9('0x26')]]={'$like':'%'+_0x53d56b[_0x98c9('0x30')]['filter']+'%'};return _0x2c93e9;}})});}_0x357961=_[_0x98c9('0x3a')]({},_0x357961,_0x53d56b[_0x98c9('0x3b')]);var _0x3876b5={'where':_0x357961['where']};return db['ServicenowConfiguration'][_0x98c9('0x1b')](_0x3876b5)['then'](function(_0x4d8f80){_0x311b5e['count']=_0x4d8f80;if(_0x53d56b[_0x98c9('0x30')]['includeAll']){_0x357961[_0x98c9('0x3c')]=[{'all':!![]}];}return db[_0x98c9('0x2a')]['findAll'](_0x357961);})[_0x98c9('0x23')](function(_0x1b48f2){_0x311b5e[_0x98c9('0x3d')]=_0x1b48f2;return _0x311b5e;})[_0x98c9('0x23')](respondWithFilteredResult(_0x53d3c9,_0x357961))[_0x98c9('0x3e')](handleError(_0x53d3c9,null));};exports['show']=function(_0x2a2d4d,_0x2fdc48){var _0x359103={'raw':![],'where':{'id':_0x2a2d4d[_0x98c9('0x3f')]['id']}},_0x511d83={};_0x511d83['model']=_[_0x98c9('0x31')](db[_0x98c9('0x2a')][_0x98c9('0x2b')]);_0x511d83[_0x98c9('0x30')]=_['keys'](_0x2a2d4d[_0x98c9('0x30')]);_0x511d83['filters']=_['intersection'](_0x511d83['model'],_0x511d83[_0x98c9('0x30')]);_0x359103[_0x98c9('0x34')]=_[_0x98c9('0x33')](_0x511d83[_0x98c9('0x2f')],qs['fields'](_0x2a2d4d[_0x98c9('0x30')][_0x98c9('0x35')]));_0x359103['attributes']=_0x359103['attributes'][_0x98c9('0x36')]?_0x359103['attributes']:_0x511d83['model'];if(_0x2a2d4d[_0x98c9('0x30')]['includeAll']){_0x359103[_0x98c9('0x3c')]=[{'all':!![]}];}_0x359103=_[_0x98c9('0x3a')]({},_0x359103,_0x2a2d4d[_0x98c9('0x3b')]);return db[_0x98c9('0x2a')][_0x98c9('0x40')](_0x359103)[_0x98c9('0x23')](handleEntityNotFound(_0x2fdc48,null))[_0x98c9('0x23')](respondWithResult(_0x2fdc48,null))[_0x98c9('0x3e')](handleError(_0x2fdc48,null));};exports[_0x98c9('0x41')]=function(_0x3e81e1,_0x4afeeb){return db['ServicenowConfiguration'][_0x98c9('0x41')](_0x3e81e1[_0x98c9('0x42')],{})[_0x98c9('0x23')](respondWithResult(_0x4afeeb,0xc9))[_0x98c9('0x3e')](handleError(_0x4afeeb,null));};exports[_0x98c9('0x21')]=function(_0xc33cf2,_0x22cfec){if(_0xc33cf2[_0x98c9('0x42')]['id']){delete _0xc33cf2['body']['id'];}return db[_0x98c9('0x2a')][_0x98c9('0x40')]({'where':{'id':_0xc33cf2[_0x98c9('0x3f')]['id']}})[_0x98c9('0x23')](handleEntityNotFound(_0x22cfec,null))[_0x98c9('0x23')](saveUpdates(_0xc33cf2[_0x98c9('0x42')],null))[_0x98c9('0x23')](respondWithResult(_0x22cfec,null))['catch'](handleError(_0x22cfec,null));};exports[_0x98c9('0x22')]=function(_0x36d200,_0x10e10c){return db[_0x98c9('0x2a')][_0x98c9('0x40')]({'where':{'id':_0x36d200[_0x98c9('0x3f')]['id']}})[_0x98c9('0x23')](handleEntityNotFound(_0x10e10c,null))[_0x98c9('0x23')](removeEntity(_0x10e10c,null))['catch'](handleError(_0x10e10c,null));};exports[_0x98c9('0x43')]=function(_0x4a417b,_0x5b6b33,_0x3c0ac2){var _0x4996c2={};var _0x5a0fba={};var _0x84a026;var _0x131d1e;return db[_0x98c9('0x2a')][_0x98c9('0x44')]({'where':{'id':_0x4a417b['params']['id']}})[_0x98c9('0x23')](handleEntityNotFound(_0x5b6b33,null))['then'](function(_0x3932b7){if(_0x3932b7){_0x84a026=_0x3932b7;_0x5a0fba[_0x98c9('0x2f')]=_[_0x98c9('0x31')](db[_0x98c9('0x45')][_0x98c9('0x2b')]);_0x5a0fba[_0x98c9('0x30')]=_['keys'](_0x4a417b['query']);_0x5a0fba[_0x98c9('0x32')]=_['intersection'](_0x5a0fba['model'],_0x5a0fba[_0x98c9('0x30')]);_0x4996c2[_0x98c9('0x34')]=_[_0x98c9('0x33')](_0x5a0fba[_0x98c9('0x2f')],qs['fields'](_0x4a417b[_0x98c9('0x30')][_0x98c9('0x35')]));_0x4996c2[_0x98c9('0x34')]=_0x4996c2[_0x98c9('0x34')]['length']?_0x4996c2['attributes']:_0x5a0fba[_0x98c9('0x2f')];_0x4996c2[_0x98c9('0x37')]=qs[_0x98c9('0x38')](_0x4a417b[_0x98c9('0x30')][_0x98c9('0x38')]);_0x4996c2[_0x98c9('0x39')]=qs[_0x98c9('0x32')](_[_0x98c9('0x46')](_0x4a417b[_0x98c9('0x30')],_0x5a0fba[_0x98c9('0x32')]));if(_0x4a417b[_0x98c9('0x30')]['filter']){_0x4996c2[_0x98c9('0x39')]=_[_0x98c9('0x3a')](_0x4996c2[_0x98c9('0x39')],{'$or':_[_0x98c9('0x29')](_0x4996c2[_0x98c9('0x34')],function(_0x26112b){var _0x535c89={};_0x535c89[_0x26112b]={'$like':'%'+_0x4a417b[_0x98c9('0x30')]['filter']+'%'};return _0x535c89;})});}_0x4996c2=_['merge']({},_0x4996c2,_0x4a417b[_0x98c9('0x3b')]);return _0x84a026[_0x98c9('0x43')](_0x4996c2);}})[_0x98c9('0x23')](function(_0x5158cf){if(_0x5158cf){_0x131d1e=_0x5158cf[_0x98c9('0x36')];if(!_0x4a417b['query'][_0x98c9('0x47')](_0x98c9('0x48'))){_0x4996c2[_0x98c9('0x1a')]=qs[_0x98c9('0x1a')](_0x4a417b['query']['limit']);_0x4996c2[_0x98c9('0x18')]=qs[_0x98c9('0x18')](_0x4a417b[_0x98c9('0x30')][_0x98c9('0x18')]);}return _0x84a026['getFields'](_0x4996c2);}})[_0x98c9('0x23')](function(_0x3b7d59){if(_0x3b7d59){return _0x3b7d59?{'count':_0x131d1e,'rows':_0x3b7d59}:null;}})[_0x98c9('0x23')](respondWithResult(_0x5b6b33,null))['catch'](handleError(_0x5b6b33,null));};exports[_0x98c9('0x49')]=function(_0x137499,_0x30fab7,_0x4a3d06){var _0x3cb136={};var _0x5c7d6b={};var _0x475050;var _0x57811e;return db[_0x98c9('0x2a')]['findOne']({'where':{'id':_0x137499[_0x98c9('0x3f')]['id']}})[_0x98c9('0x23')](handleEntityNotFound(_0x30fab7,null))[_0x98c9('0x23')](function(_0x30bf6b){if(_0x30bf6b){_0x475050=_0x30bf6b;_0x5c7d6b[_0x98c9('0x2f')]=_[_0x98c9('0x31')](db[_0x98c9('0x45')]['rawAttributes']);_0x5c7d6b[_0x98c9('0x30')]=_[_0x98c9('0x31')](_0x137499[_0x98c9('0x30')]);_0x5c7d6b[_0x98c9('0x32')]=_['intersection'](_0x5c7d6b[_0x98c9('0x2f')],_0x5c7d6b[_0x98c9('0x30')]);_0x3cb136[_0x98c9('0x34')]=_[_0x98c9('0x33')](_0x5c7d6b['model'],qs[_0x98c9('0x35')](_0x137499[_0x98c9('0x30')]['fields']));_0x3cb136[_0x98c9('0x34')]=_0x3cb136[_0x98c9('0x34')][_0x98c9('0x36')]?_0x3cb136[_0x98c9('0x34')]:_0x5c7d6b['model'];_0x3cb136[_0x98c9('0x37')]=qs[_0x98c9('0x38')](_0x137499[_0x98c9('0x30')][_0x98c9('0x38')]);_0x3cb136[_0x98c9('0x39')]=qs[_0x98c9('0x32')](_[_0x98c9('0x46')](_0x137499[_0x98c9('0x30')],_0x5c7d6b[_0x98c9('0x32')]));if(_0x137499['query'][_0x98c9('0x4a')]){_0x3cb136[_0x98c9('0x39')]=_[_0x98c9('0x3a')](_0x3cb136[_0x98c9('0x39')],{'$or':_[_0x98c9('0x29')](_0x3cb136[_0x98c9('0x34')],function(_0x36968b){var _0x4b1a0d={};_0x4b1a0d[_0x36968b]={'$like':'%'+_0x137499['query'][_0x98c9('0x4a')]+'%'};return _0x4b1a0d;})});}_0x3cb136=_[_0x98c9('0x3a')]({},_0x3cb136,_0x137499['options']);return _0x475050['getSubjects'](_0x3cb136);}})[_0x98c9('0x23')](function(_0x86140f){if(_0x86140f){_0x57811e=_0x86140f[_0x98c9('0x36')];if(!_0x137499[_0x98c9('0x30')][_0x98c9('0x47')](_0x98c9('0x48'))){_0x3cb136[_0x98c9('0x1a')]=qs[_0x98c9('0x1a')](_0x137499[_0x98c9('0x30')]['limit']);_0x3cb136[_0x98c9('0x18')]=qs[_0x98c9('0x18')](_0x137499[_0x98c9('0x30')][_0x98c9('0x18')]);}return _0x475050['getSubjects'](_0x3cb136);}})[_0x98c9('0x23')](function(_0x565c5e){if(_0x565c5e){return _0x565c5e?{'count':_0x57811e,'rows':_0x565c5e}:null;}})['then'](respondWithResult(_0x30fab7,null))[_0x98c9('0x3e')](handleError(_0x30fab7,null));};exports['getDescriptions']=function(_0x3e6213,_0x5f7883,_0x50606e){var _0x2bc503={};var _0xa50c9e={};var _0x28f8dd;var _0x47e19c;return db[_0x98c9('0x2a')][_0x98c9('0x44')]({'where':{'id':_0x3e6213[_0x98c9('0x3f')]['id']}})[_0x98c9('0x23')](handleEntityNotFound(_0x5f7883,null))[_0x98c9('0x23')](function(_0x3252d5){if(_0x3252d5){_0x28f8dd=_0x3252d5;_0xa50c9e['model']=_[_0x98c9('0x31')](db['ServicenowField'][_0x98c9('0x2b')]);_0xa50c9e[_0x98c9('0x30')]=_['keys'](_0x3e6213['query']);_0xa50c9e[_0x98c9('0x32')]=_[_0x98c9('0x33')](_0xa50c9e[_0x98c9('0x2f')],_0xa50c9e['query']);_0x2bc503[_0x98c9('0x34')]=_['intersection'](_0xa50c9e[_0x98c9('0x2f')],qs[_0x98c9('0x35')](_0x3e6213['query'][_0x98c9('0x35')]));_0x2bc503[_0x98c9('0x34')]=_0x2bc503[_0x98c9('0x34')][_0x98c9('0x36')]?_0x2bc503['attributes']:_0xa50c9e[_0x98c9('0x2f')];_0x2bc503[_0x98c9('0x37')]=qs['sort'](_0x3e6213[_0x98c9('0x30')][_0x98c9('0x38')]);_0x2bc503['where']=qs['filters'](_[_0x98c9('0x46')](_0x3e6213[_0x98c9('0x30')],_0xa50c9e[_0x98c9('0x32')]));if(_0x3e6213[_0x98c9('0x30')][_0x98c9('0x4a')]){_0x2bc503[_0x98c9('0x39')]=_['merge'](_0x2bc503[_0x98c9('0x39')],{'$or':_[_0x98c9('0x29')](_0x2bc503[_0x98c9('0x34')],function(_0x5db280){var _0x5b9c88={};_0x5b9c88[_0x5db280]={'$like':'%'+_0x3e6213[_0x98c9('0x30')][_0x98c9('0x4a')]+'%'};return _0x5b9c88;})});}_0x2bc503=_[_0x98c9('0x3a')]({},_0x2bc503,_0x3e6213['options']);return _0x28f8dd['getDescriptions'](_0x2bc503);}})[_0x98c9('0x23')](function(_0x3810ef){if(_0x3810ef){_0x47e19c=_0x3810ef[_0x98c9('0x36')];if(!_0x3e6213[_0x98c9('0x30')]['hasOwnProperty'](_0x98c9('0x48'))){_0x2bc503[_0x98c9('0x1a')]=qs[_0x98c9('0x1a')](_0x3e6213[_0x98c9('0x30')][_0x98c9('0x1a')]);_0x2bc503[_0x98c9('0x18')]=qs[_0x98c9('0x18')](_0x3e6213[_0x98c9('0x30')]['offset']);}return _0x28f8dd['getDescriptions'](_0x2bc503);}})['then'](function(_0x79ad7d){if(_0x79ad7d){return _0x79ad7d?{'count':_0x47e19c,'rows':_0x79ad7d}:null;}})[_0x98c9('0x23')](respondWithResult(_0x5f7883,null))[_0x98c9('0x3e')](handleError(_0x5f7883,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f9c9c7d..d45a976 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 _0x0b0e=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x228f95,_0x55325e){var _0x2bd85e=function(_0x33f893){while(--_0x33f893){_0x228f95['push'](_0x228f95['shift']());}};_0x2bd85e(++_0x55325e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x0b0e[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13cc=['int_servicenow_configurations','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x17bb3d,_0x2aea65){var _0x3cd7df=function(_0x9d743d){while(--_0x9d743d){_0x17bb3d['push'](_0x17bb3d['shift']());}};_0x3cd7df(++_0x2aea65);}(_0x13cc,0x161));var _0xc13c=function(_0x30084b,_0x26b6c8){_0x30084b=_0x30084b-0x0;var _0x52fec7=_0x13cc[_0x30084b];return _0x52fec7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc13c('0x0'))(_0xc13c('0x1'));var moment=require('moment');var BPromise=require(_0xc13c('0x2'));var rp=require(_0xc13c('0x3'));var fs=require('fs');var path=require(_0xc13c('0x4'));var rimraf=require(_0xc13c('0x5'));var config=require(_0xc13c('0x6'));var attributes=require(_0xc13c('0x7'));module['exports']=function(_0x98e54d,_0x4c9afa){return _0x98e54d[_0xc13c('0x8')](_0xc13c('0x9'),attributes,{'tableName':_0xc13c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 4e217f2..a5f3be0 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 _0x7c23=['message','ServicenowConfiguration,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','code','error'];(function(_0x5277d9,_0x1d8515){var _0x185fa5=function(_0x3feb28){while(--_0x3feb28){_0x5277d9['push'](_0x5277d9['shift']());}};_0x185fa5(++_0x1d8515);}(_0x7c23,0xad));var _0x37c2=function(_0x56fe8d,_0x217e07){_0x56fe8d=_0x56fe8d-0x0;var _0x256602=_0x7c23[_0x56fe8d];return _0x256602;};'use strict';var _=require('lodash');var util=require(_0x37c2('0x0'));var moment=require(_0x37c2('0x1'));var BPromise=require(_0x37c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37c2('0x3'));var db=require(_0x37c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x37c2('0x5'))('rpc');var config=require(_0x37c2('0x6'));var jayson=require(_0x37c2('0x7'));var client=jayson[_0x37c2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9969e9,_0x5b6993,_0x1e1ebe){return new BPromise(function(_0x30a429,_0x1b8e26){return client[_0x37c2('0x9')](_0x9969e9,_0x1e1ebe)[_0x37c2('0xa')](function(_0x15e05e){logger[_0x37c2('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b6993,_0x37c2('0xc'));logger[_0x37c2('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5b6993,_0x37c2('0xc'),JSON[_0x37c2('0xe')](_0x15e05e));if(_0x15e05e['error']){if(_0x15e05e['error'][_0x37c2('0xf')]===0x1f4){logger[_0x37c2('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b6993,_0x15e05e[_0x37c2('0x10')][_0x37c2('0x11')]);return _0x1b8e26(_0x15e05e['error'][_0x37c2('0x11')]);}logger['error'](_0x37c2('0x12'),_0x5b6993,_0x15e05e['error'][_0x37c2('0x11')]);return _0x30a429(_0x15e05e[_0x37c2('0x10')][_0x37c2('0x11')]);}else{logger['info'](_0x37c2('0x12'),_0x5b6993,_0x37c2('0xc'));_0x30a429(_0x15e05e['result'][_0x37c2('0x11')]);}})['catch'](function(_0x124c6d){logger[_0x37c2('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b6993,_0x124c6d);_0x1b8e26(_0x124c6d);});});} \ No newline at end of file +var _0x2264=['request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x28e0ff,_0x5bb56c){var _0x23f7be=function(_0x40fff5){while(--_0x40fff5){_0x28e0ff['push'](_0x28e0ff['shift']());}};_0x23f7be(++_0x5bb56c);}(_0x2264,0x125));var _0x4226=function(_0x20e8df,_0x2400c0){_0x20e8df=_0x20e8df-0x0;var _0x12d90b=_0x2264[_0x20e8df];return _0x12d90b;};'use strict';var _=require(_0x4226('0x0'));var util=require(_0x4226('0x1'));var moment=require(_0x4226('0x2'));var BPromise=require('bluebird');var rs=require(_0x4226('0x3'));var fs=require('fs');var Redis=require(_0x4226('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4226('0x5'));var logger=require('../../config/logger')(_0x4226('0x6'));var config=require(_0x4226('0x7'));var jayson=require(_0x4226('0x8'));var client=jayson[_0x4226('0x9')][_0x4226('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9db4,_0x4ae370,_0x36ccb6){return new BPromise(function(_0x458b57,_0x58f552){return client[_0x4226('0xb')](_0x3c9db4,_0x36ccb6)[_0x4226('0xc')](function(_0x206593){logger[_0x4226('0xd')](_0x4226('0xe'),_0x4ae370,_0x4226('0xf'));logger['debug'](_0x4226('0x10'),_0x4ae370,_0x4226('0xf'),JSON[_0x4226('0x11')](_0x206593));if(_0x206593[_0x4226('0x12')]){if(_0x206593[_0x4226('0x12')][_0x4226('0x13')]===0x1f4){logger[_0x4226('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ae370,_0x206593[_0x4226('0x12')]['message']);return _0x58f552(_0x206593[_0x4226('0x12')]['message']);}logger[_0x4226('0x12')](_0x4226('0xe'),_0x4ae370,_0x206593[_0x4226('0x12')][_0x4226('0x14')]);return _0x458b57(_0x206593[_0x4226('0x12')][_0x4226('0x14')]);}else{logger[_0x4226('0xd')](_0x4226('0xe'),_0x4ae370,_0x4226('0xf'));_0x458b57(_0x206593['result'][_0x4226('0x14')]);}})[_0x4226('0x15')](function(_0x167420){logger['error'](_0x4226('0xe'),_0x4ae370,_0x167420);_0x58f552(_0x167420);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ccdab4b..1cf870c 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 _0xbfdd=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x20240e,_0x2f29de){var _0x26ed7c=function(_0x19120c){while(--_0x19120c){_0x20240e['push'](_0x20240e['shift']());}};_0x26ed7c(++_0x2f29de);}(_0xbfdd,0x1eb));var _0xdbfd=function(_0x3b7fb7,_0x30abbb){_0x3b7fb7=_0x3b7fb7-0x0;var _0x34da82=_0xbfdd[_0x3b7fb7];return _0x34da82;};'use strict';var multer=require(_0xdbfd('0x0'));var util=require(_0xdbfd('0x1'));var path=require('path');var timeout=require(_0xdbfd('0x2'));var express=require(_0xdbfd('0x3'));var router=express['Router']();var fs_extra=require(_0xdbfd('0x4'));var auth=require(_0xdbfd('0x5'));var interaction=require(_0xdbfd('0x6'));var config=require(_0xdbfd('0x7'));var controller=require(_0xdbfd('0x8'));router[_0xdbfd('0x9')]('/',auth[_0xdbfd('0xa')](),controller['index']);router[_0xdbfd('0x9')](_0xdbfd('0xb'),auth[_0xdbfd('0xa')](),controller[_0xdbfd('0xc')]);router[_0xdbfd('0xd')]('/',auth[_0xdbfd('0xa')](),controller[_0xdbfd('0xe')]);router[_0xdbfd('0xf')]('/:id',auth[_0xdbfd('0xa')](),controller[_0xdbfd('0x10')]);router['delete']('/:id',auth[_0xdbfd('0xa')](),controller[_0xdbfd('0x11')]);module[_0xdbfd('0x12')]=router; \ No newline at end of file +var _0x42c2=['destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x42c2,0x102));var _0x242c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x42c2[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0x242c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x242c('0x1')]();var fs_extra=require(_0x242c('0x2'));var auth=require(_0x242c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x242c('0x4'));var controller=require(_0x242c('0x5'));router['get']('/',auth[_0x242c('0x6')](),controller[_0x242c('0x7')]);router['get'](_0x242c('0x8'),auth['isAuthenticated'](),controller[_0x242c('0x9')]);router[_0x242c('0xa')]('/',auth['isAuthenticated'](),controller[_0x242c('0xb')]);router[_0x242c('0xc')](_0x242c('0x8'),auth[_0x242c('0x6')](),controller[_0x242c('0xd')]);router['delete']('/:id',auth[_0x242c('0x6')](),controller[_0x242c('0xe')]);module[_0x242c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 8955e39..6d80fc2 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 _0x3890=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x1cbcb2,_0x1237a3){var _0x41ac9f=function(_0xe32e6f){while(--_0xe32e6f){_0x1cbcb2['push'](_0x1cbcb2['shift']());}};_0x41ac9f(++_0x1237a3);}(_0x3890,0x130));var _0x0389=function(_0x315ccc,_0x1bf127){_0x315ccc=_0x315ccc-0x0;var _0xbf3223=_0x3890[_0x315ccc];return _0xbf3223;};'use strict';var Sequelize=require('sequelize');module[_0x0389('0x0')]={'type':{'type':Sequelize['ENUM'](_0x0389('0x1'),_0x0389('0x2'),_0x0389('0x3'),_0x0389('0x4'),'picklist'),'defaultValue':_0x0389('0x1')},'content':{'type':Sequelize[_0x0389('0x5')]},'key':{'type':Sequelize[_0x0389('0x5')]},'keyType':{'type':Sequelize[_0x0389('0x6')]('string',_0x0389('0x2'),_0x0389('0x3'))},'keyContent':{'type':Sequelize[_0x0389('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0389('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0389('0x5')]}}; \ No newline at end of file +var _0x3b1a=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0xe8d631,_0x3d89f4){var _0x4e9099=function(_0x5e9a2e){while(--_0x5e9a2e){_0xe8d631['push'](_0xe8d631['shift']());}};_0x4e9099(++_0x3d89f4);}(_0x3b1a,0x19b));var _0xa3b1=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x3b1a[_0x56756b];return _0xa3002;};'use strict';var Sequelize=require(_0xa3b1('0x0'));module['exports']={'type':{'type':Sequelize[_0xa3b1('0x1')](_0xa3b1('0x2'),_0xa3b1('0x3'),_0xa3b1('0x4'),_0xa3b1('0x5'),_0xa3b1('0x6')),'defaultValue':_0xa3b1('0x2')},'content':{'type':Sequelize[_0xa3b1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa3b1('0x1')](_0xa3b1('0x2'),_0xa3b1('0x3'),_0xa3b1('0x4'))},'keyContent':{'type':Sequelize[_0xa3b1('0x7')]},'idField':{'type':Sequelize[_0xa3b1('0x7')]},'nameField':{'type':Sequelize[_0xa3b1('0x7')]},'customField':{'type':Sequelize[_0xa3b1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa3b1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f723b7d..3391239 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 _0x3973=['findAll','show','params','includeAll','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include'];(function(_0x45828a,_0x2283ef){var _0x4d464d=function(_0x418b03){while(--_0x418b03){_0x45828a['push'](_0x45828a['shift']());}};_0x4d464d(++_0x2283ef);}(_0x3973,0xeb));var _0x3397=function(_0x49c6f0,_0x27de8e){_0x49c6f0=_0x49c6f0-0x0;var _0x213b17=_0x3973[_0x49c6f0];return _0x213b17;};'use strict';var emlformat=require(_0x3397('0x0'));var rimraf=require(_0x3397('0x1'));var zipdir=require(_0x3397('0x2'));var jsonpatch=require(_0x3397('0x3'));var rp=require(_0x3397('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3397('0x5'));var util=require(_0x3397('0x6'));var path=require(_0x3397('0x7'));var sox=require(_0x3397('0x8'));var csv=require(_0x3397('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3397('0xa'));var squel=require(_0x3397('0xb'));var crypto=require(_0x3397('0xc'));var jsforce=require(_0x3397('0xd'));var deskjs=require(_0x3397('0xe'));var toCsv=require(_0x3397('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3397('0xf'));var authService=require(_0x3397('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3397('0x11'));var hardwareService=require(_0x3397('0x12'));var logger=require(_0x3397('0x13'))('api');var utils=require(_0x3397('0x14'));var config=require(_0x3397('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3397('0x16'))['db'];function respondWithStatusCode(_0xf67eaa,_0x590f94){_0x590f94=_0x590f94||0xcc;return function(_0x4f5bab){if(_0x4f5bab){return _0xf67eaa['sendStatus'](_0x590f94);}return _0xf67eaa[_0x3397('0x17')](_0x590f94)[_0x3397('0x18')]();};}function respondWithResult(_0x2db215,_0x58b8da){_0x58b8da=_0x58b8da||0xc8;return function(_0x592ac6){if(_0x592ac6){return _0x2db215['status'](_0x58b8da)['json'](_0x592ac6);}};}function respondWithFilteredResult(_0x4efc41,_0x1fe6be){return function(_0x544672){if(_0x544672){var _0x46c34e=typeof _0x1fe6be[_0x3397('0x19')]===_0x3397('0x1a')&&typeof _0x1fe6be[_0x3397('0x1b')]===_0x3397('0x1a');var _0x2b9458=_0x544672[_0x3397('0x1c')];var _0x3dd948=_0x46c34e?0x0:_0x1fe6be[_0x3397('0x19')];var _0x16fc95=_0x46c34e?_0x544672[_0x3397('0x1c')]:_0x1fe6be['offset']+_0x1fe6be[_0x3397('0x1b')];var _0x29bda4;if(_0x16fc95>=_0x2b9458){_0x16fc95=_0x2b9458;_0x29bda4=0xc8;}else{_0x29bda4=0xce;}_0x4efc41[_0x3397('0x17')](_0x29bda4);return _0x4efc41[_0x3397('0x1d')](_0x3397('0x1e'),_0x3dd948+'-'+_0x16fc95+'/'+_0x2b9458)[_0x3397('0x1f')](_0x544672);}return null;};}function patchUpdates(_0x217512){return function(_0x356a23){try{jsonpatch[_0x3397('0x20')](_0x356a23,_0x217512,!![]);}catch(_0x450073){return BPromise['reject'](_0x450073);}return _0x356a23[_0x3397('0x21')]();};}function saveUpdates(_0x988782,_0x3a7e90){return function(_0x316ae0){if(_0x316ae0){return _0x316ae0['update'](_0x988782)['then'](function(_0x135380){return _0x135380;});}return null;};}function removeEntity(_0x357eea,_0x43e015){return function(_0x3e725c){if(_0x3e725c){return _0x3e725c['destroy']()[_0x3397('0x22')](function(){_0x357eea['status'](0xcc)[_0x3397('0x18')]();});}};}function handleEntityNotFound(_0x6ec6b4,_0x1b9b1b){return function(_0x3077bb){if(!_0x3077bb){_0x6ec6b4['sendStatus'](0x194);}return _0x3077bb;};}function handleError(_0x3b4cd1,_0x4a781e){_0x4a781e=_0x4a781e||0x1f4;return function(_0xb60286){logger[_0x3397('0x23')](_0xb60286[_0x3397('0x24')]);if(_0xb60286[_0x3397('0x25')]){delete _0xb60286[_0x3397('0x25')];}_0x3b4cd1['status'](_0x4a781e)[_0x3397('0x26')](_0xb60286);};}exports[_0x3397('0x27')]=function(_0x55c1df,_0x2837e9){var _0x28a0f5={},_0x31339b={},_0x6a7a95={'count':0x0,'rows':[]};var _0x55557e=_[_0x3397('0x28')](db[_0x3397('0x29')][_0x3397('0x2a')],function(_0x10623e){return{'name':_0x10623e[_0x3397('0x2b')],'type':_0x10623e['type'][_0x3397('0x2c')]};});_0x31339b[_0x3397('0x2d')]=_[_0x3397('0x28')](_0x55557e,'name');_0x31339b[_0x3397('0x2e')]=_[_0x3397('0x2f')](_0x55c1df[_0x3397('0x2e')]);_0x31339b['filters']=_[_0x3397('0x30')](_0x31339b[_0x3397('0x2d')],_0x31339b['query']);_0x28a0f5[_0x3397('0x31')]=_[_0x3397('0x30')](_0x31339b[_0x3397('0x2d')],qs[_0x3397('0x32')](_0x55c1df[_0x3397('0x2e')][_0x3397('0x32')]));_0x28a0f5[_0x3397('0x31')]=_0x28a0f5[_0x3397('0x31')][_0x3397('0x33')]?_0x28a0f5[_0x3397('0x31')]:_0x31339b['model'];if(!_0x55c1df[_0x3397('0x2e')][_0x3397('0x34')](_0x3397('0x35'))){_0x28a0f5['limit']=qs[_0x3397('0x1b')](_0x55c1df['query'][_0x3397('0x1b')]);_0x28a0f5['offset']=qs[_0x3397('0x19')](_0x55c1df[_0x3397('0x2e')]['offset']);}_0x28a0f5[_0x3397('0x36')]=qs[_0x3397('0x37')](_0x55c1df[_0x3397('0x2e')][_0x3397('0x37')]);_0x28a0f5[_0x3397('0x38')]=qs[_0x3397('0x39')](_[_0x3397('0x3a')](_0x55c1df[_0x3397('0x2e')],_0x31339b['filters']),_0x55557e);if(_0x55c1df[_0x3397('0x2e')][_0x3397('0x3b')]){_0x28a0f5['where']=_[_0x3397('0x3c')](_0x28a0f5['where'],{'$or':_[_0x3397('0x28')](_0x55557e,function(_0x2c2477){if(_0x2c2477[_0x3397('0x3d')]!==_0x3397('0x3e')){var _0xaa3f43={};_0xaa3f43[_0x2c2477['name']]={'$like':'%'+_0x55c1df[_0x3397('0x2e')][_0x3397('0x3b')]+'%'};return _0xaa3f43;}})});}_0x28a0f5=_[_0x3397('0x3c')]({},_0x28a0f5,_0x55c1df[_0x3397('0x3f')]);var _0x265141={'where':_0x28a0f5[_0x3397('0x38')]};return db['ServicenowField'][_0x3397('0x1c')](_0x265141)['then'](function(_0x5c2b7d){_0x6a7a95[_0x3397('0x1c')]=_0x5c2b7d;if(_0x55c1df[_0x3397('0x2e')]['includeAll']){_0x28a0f5[_0x3397('0x40')]=[{'all':!![]}];}return db[_0x3397('0x29')][_0x3397('0x41')](_0x28a0f5);})[_0x3397('0x22')](function(_0xb0fd25){_0x6a7a95['rows']=_0xb0fd25;return _0x6a7a95;})[_0x3397('0x22')](respondWithFilteredResult(_0x2837e9,_0x28a0f5))['catch'](handleError(_0x2837e9,null));};exports[_0x3397('0x42')]=function(_0x166b4f,_0x269ced){var _0x203041={'raw':!![],'where':{'id':_0x166b4f[_0x3397('0x43')]['id']}},_0x19b2c2={};_0x19b2c2['model']=_['keys'](db[_0x3397('0x29')][_0x3397('0x2a')]);_0x19b2c2['query']=_[_0x3397('0x2f')](_0x166b4f['query']);_0x19b2c2[_0x3397('0x39')]=_[_0x3397('0x30')](_0x19b2c2[_0x3397('0x2d')],_0x19b2c2[_0x3397('0x2e')]);_0x203041[_0x3397('0x31')]=_[_0x3397('0x30')](_0x19b2c2[_0x3397('0x2d')],qs[_0x3397('0x32')](_0x166b4f[_0x3397('0x2e')]['fields']));_0x203041[_0x3397('0x31')]=_0x203041['attributes'][_0x3397('0x33')]?_0x203041['attributes']:_0x19b2c2['model'];if(_0x166b4f[_0x3397('0x2e')][_0x3397('0x44')]){_0x203041['include']=[{'all':!![]}];}_0x203041=_[_0x3397('0x3c')]({},_0x203041,_0x166b4f[_0x3397('0x3f')]);return db[_0x3397('0x29')]['find'](_0x203041)[_0x3397('0x22')](handleEntityNotFound(_0x269ced,null))['then'](respondWithResult(_0x269ced,null))[_0x3397('0x45')](handleError(_0x269ced,null));};exports[_0x3397('0x46')]=function(_0x278a4a,_0x5de9db){return db[_0x3397('0x29')]['create'](_0x278a4a[_0x3397('0x47')],{})['then'](respondWithResult(_0x5de9db,0xc9))['catch'](handleError(_0x5de9db,null));};exports[_0x3397('0x48')]=function(_0x31b7dc,_0x1fc147){if(_0x31b7dc[_0x3397('0x47')]['id']){delete _0x31b7dc[_0x3397('0x47')]['id'];}return db[_0x3397('0x29')][_0x3397('0x49')]({'where':{'id':_0x31b7dc['params']['id']}})[_0x3397('0x22')](handleEntityNotFound(_0x1fc147,null))[_0x3397('0x22')](saveUpdates(_0x31b7dc[_0x3397('0x47')],null))[_0x3397('0x22')](respondWithResult(_0x1fc147,null))['catch'](handleError(_0x1fc147,null));};exports[_0x3397('0x4a')]=function(_0x486e11,_0x4272ea){return db[_0x3397('0x29')]['find']({'where':{'id':_0x486e11[_0x3397('0x43')]['id']}})[_0x3397('0x22')](handleEntityNotFound(_0x4272ea,null))[_0x3397('0x22')](removeEntity(_0x4272ea,null))[_0x3397('0x45')](handleError(_0x4272ea,null));}; \ No newline at end of file +var _0x4455=['sort','filters','pick','where','VIRTUAL','options','include','rows','catch','params','keys','attributes','length','includeAll','merge','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ServicenowField','rawAttributes','fieldName','key','model','query','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x3e50d3,_0xaa491e){var _0x46224e=function(_0x56f988){while(--_0x56f988){_0x3e50d3['push'](_0x3e50d3['shift']());}};_0x46224e(++_0xaa491e);}(_0x4455,0x17b));var _0x5445=function(_0x5866f7,_0xfeb077){_0x5866f7=_0x5866f7-0x0;var _0x39507c=_0x4455[_0x5866f7];return _0x39507c;};'use strict';var emlformat=require(_0x5445('0x0'));var rimraf=require(_0x5445('0x1'));var zipdir=require(_0x5445('0x2'));var jsonpatch=require(_0x5445('0x3'));var rp=require('request-promise');var moment=require(_0x5445('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5445('0x5'));var util=require(_0x5445('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5445('0x7'));var ejs=require(_0x5445('0x8'));var fs=require('fs');var fs_extra=require(_0x5445('0x9'));var _=require(_0x5445('0xa'));var squel=require('squel');var crypto=require(_0x5445('0xb'));var jsforce=require(_0x5445('0xc'));var deskjs=require(_0x5445('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5445('0xe'));var Papa=require(_0x5445('0xf'));var Redis=require(_0x5445('0x10'));var authService=require(_0x5445('0x11'));var qs=require(_0x5445('0x12'));var as=require(_0x5445('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5445('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5445('0x15'));var licenseUtil=require(_0x5445('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15cbe7,_0x139e1e){_0x139e1e=_0x139e1e||0xcc;return function(_0x35aab2){if(_0x35aab2){return _0x15cbe7[_0x5445('0x17')](_0x139e1e);}return _0x15cbe7['status'](_0x139e1e)[_0x5445('0x18')]();};}function respondWithResult(_0x25e075,_0x52f198){_0x52f198=_0x52f198||0xc8;return function(_0xdeb86){if(_0xdeb86){return _0x25e075[_0x5445('0x19')](_0x52f198)[_0x5445('0x1a')](_0xdeb86);}};}function respondWithFilteredResult(_0x220fc2,_0x6cae0c){return function(_0x52b492){if(_0x52b492){var _0x3bbc29=typeof _0x6cae0c['offset']===_0x5445('0x1b')&&typeof _0x6cae0c[_0x5445('0x1c')]==='undefined';var _0x532a84=_0x52b492[_0x5445('0x1d')];var _0x1b19b4=_0x3bbc29?0x0:_0x6cae0c[_0x5445('0x1e')];var _0x19809a=_0x3bbc29?_0x52b492[_0x5445('0x1d')]:_0x6cae0c[_0x5445('0x1e')]+_0x6cae0c[_0x5445('0x1c')];var _0x46826b;if(_0x19809a>=_0x532a84){_0x19809a=_0x532a84;_0x46826b=0xc8;}else{_0x46826b=0xce;}_0x220fc2[_0x5445('0x19')](_0x46826b);return _0x220fc2[_0x5445('0x1f')](_0x5445('0x20'),_0x1b19b4+'-'+_0x19809a+'/'+_0x532a84)[_0x5445('0x1a')](_0x52b492);}return null;};}function patchUpdates(_0x5411ec){return function(_0x2ebf41){try{jsonpatch[_0x5445('0x21')](_0x2ebf41,_0x5411ec,!![]);}catch(_0x28b86f){return BPromise[_0x5445('0x22')](_0x28b86f);}return _0x2ebf41[_0x5445('0x23')]();};}function saveUpdates(_0x30d9f4,_0x17a6d8){return function(_0x4edbb4){if(_0x4edbb4){return _0x4edbb4[_0x5445('0x24')](_0x30d9f4)[_0x5445('0x25')](function(_0x1bc101){return _0x1bc101;});}return null;};}function removeEntity(_0xb40550,_0x2ccab6){return function(_0x471875){if(_0x471875){return _0x471875['destroy']()[_0x5445('0x25')](function(){_0xb40550[_0x5445('0x19')](0xcc)[_0x5445('0x18')]();});}};}function handleEntityNotFound(_0x596bc9,_0x1ad5ba){return function(_0x39551d){if(!_0x39551d){_0x596bc9['sendStatus'](0x194);}return _0x39551d;};}function handleError(_0x1d53f3,_0x19132b){_0x19132b=_0x19132b||0x1f4;return function(_0x3088d9){logger[_0x5445('0x26')](_0x3088d9[_0x5445('0x27')]);if(_0x3088d9[_0x5445('0x28')]){delete _0x3088d9['name'];}_0x1d53f3[_0x5445('0x19')](_0x19132b)['send'](_0x3088d9);};}exports['index']=function(_0x521d48,_0x2edf18){var _0x423ae3={},_0x4f6b1d={},_0x317eb2={'count':0x0,'rows':[]};var _0x443d79=_[_0x5445('0x29')](db[_0x5445('0x2a')][_0x5445('0x2b')],function(_0xbb3bf4){return{'name':_0xbb3bf4[_0x5445('0x2c')],'type':_0xbb3bf4['type'][_0x5445('0x2d')]};});_0x4f6b1d['model']=_['map'](_0x443d79,_0x5445('0x28'));_0x4f6b1d['query']=_['keys'](_0x521d48['query']);_0x4f6b1d['filters']=_['intersection'](_0x4f6b1d[_0x5445('0x2e')],_0x4f6b1d[_0x5445('0x2f')]);_0x423ae3['attributes']=_[_0x5445('0x30')](_0x4f6b1d[_0x5445('0x2e')],qs['fields'](_0x521d48[_0x5445('0x2f')][_0x5445('0x31')]));_0x423ae3['attributes']=_0x423ae3['attributes']['length']?_0x423ae3['attributes']:_0x4f6b1d[_0x5445('0x2e')];if(!_0x521d48['query'][_0x5445('0x32')](_0x5445('0x33'))){_0x423ae3[_0x5445('0x1c')]=qs[_0x5445('0x1c')](_0x521d48['query'][_0x5445('0x1c')]);_0x423ae3[_0x5445('0x1e')]=qs[_0x5445('0x1e')](_0x521d48['query'][_0x5445('0x1e')]);}_0x423ae3[_0x5445('0x34')]=qs[_0x5445('0x35')](_0x521d48['query']['sort']);_0x423ae3['where']=qs[_0x5445('0x36')](_[_0x5445('0x37')](_0x521d48[_0x5445('0x2f')],_0x4f6b1d[_0x5445('0x36')]),_0x443d79);if(_0x521d48[_0x5445('0x2f')]['filter']){_0x423ae3[_0x5445('0x38')]=_['merge'](_0x423ae3[_0x5445('0x38')],{'$or':_[_0x5445('0x29')](_0x443d79,function(_0x9baf95){if(_0x9baf95['type']!==_0x5445('0x39')){var _0x4dc19b={};_0x4dc19b[_0x9baf95['name']]={'$like':'%'+_0x521d48[_0x5445('0x2f')]['filter']+'%'};return _0x4dc19b;}})});}_0x423ae3=_['merge']({},_0x423ae3,_0x521d48[_0x5445('0x3a')]);var _0x3fcd35={'where':_0x423ae3[_0x5445('0x38')]};return db['ServicenowField'][_0x5445('0x1d')](_0x3fcd35)[_0x5445('0x25')](function(_0x4e34c7){_0x317eb2[_0x5445('0x1d')]=_0x4e34c7;if(_0x521d48['query']['includeAll']){_0x423ae3[_0x5445('0x3b')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x423ae3);})[_0x5445('0x25')](function(_0x3af552){_0x317eb2[_0x5445('0x3c')]=_0x3af552;return _0x317eb2;})[_0x5445('0x25')](respondWithFilteredResult(_0x2edf18,_0x423ae3))[_0x5445('0x3d')](handleError(_0x2edf18,null));};exports['show']=function(_0x21b390,_0x415df5){var _0x21f213={'raw':!![],'where':{'id':_0x21b390[_0x5445('0x3e')]['id']}},_0xf98465={};_0xf98465[_0x5445('0x2e')]=_[_0x5445('0x3f')](db[_0x5445('0x2a')][_0x5445('0x2b')]);_0xf98465[_0x5445('0x2f')]=_[_0x5445('0x3f')](_0x21b390[_0x5445('0x2f')]);_0xf98465[_0x5445('0x36')]=_[_0x5445('0x30')](_0xf98465[_0x5445('0x2e')],_0xf98465['query']);_0x21f213[_0x5445('0x40')]=_[_0x5445('0x30')](_0xf98465['model'],qs['fields'](_0x21b390[_0x5445('0x2f')][_0x5445('0x31')]));_0x21f213[_0x5445('0x40')]=_0x21f213[_0x5445('0x40')][_0x5445('0x41')]?_0x21f213[_0x5445('0x40')]:_0xf98465[_0x5445('0x2e')];if(_0x21b390[_0x5445('0x2f')][_0x5445('0x42')]){_0x21f213[_0x5445('0x3b')]=[{'all':!![]}];}_0x21f213=_[_0x5445('0x43')]({},_0x21f213,_0x21b390[_0x5445('0x3a')]);return db[_0x5445('0x2a')]['find'](_0x21f213)[_0x5445('0x25')](handleEntityNotFound(_0x415df5,null))[_0x5445('0x25')](respondWithResult(_0x415df5,null))['catch'](handleError(_0x415df5,null));};exports[_0x5445('0x44')]=function(_0x3bbaf7,_0x5885fe){return db[_0x5445('0x2a')][_0x5445('0x44')](_0x3bbaf7[_0x5445('0x45')],{})[_0x5445('0x25')](respondWithResult(_0x5885fe,0xc9))[_0x5445('0x3d')](handleError(_0x5885fe,null));};exports[_0x5445('0x24')]=function(_0x3410fa,_0xf787f2){if(_0x3410fa['body']['id']){delete _0x3410fa['body']['id'];}return db['ServicenowField'][_0x5445('0x46')]({'where':{'id':_0x3410fa[_0x5445('0x3e')]['id']}})[_0x5445('0x25')](handleEntityNotFound(_0xf787f2,null))[_0x5445('0x25')](saveUpdates(_0x3410fa['body'],null))[_0x5445('0x25')](respondWithResult(_0xf787f2,null))[_0x5445('0x3d')](handleError(_0xf787f2,null));};exports[_0x5445('0x47')]=function(_0x589472,_0x5b3327){return db[_0x5445('0x2a')][_0x5445('0x46')]({'where':{'id':_0x589472[_0x5445('0x3e')]['id']}})[_0x5445('0x25')](handleEntityNotFound(_0x5b3327,null))[_0x5445('0x25')](removeEntity(_0x5b3327,null))[_0x5445('0x3d')](handleError(_0x5b3327,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d2f11f8..88e0348 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 _0xacfb=['FieldId','lodash','util','api','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x143fca,_0x3e18ac){var _0x5726b5=function(_0x4a778b){while(--_0x4a778b){_0x143fca['push'](_0x143fca['shift']());}};_0x5726b5(++_0x3e18ac);}(_0xacfb,0x11f));var _0xbacf=function(_0x3a36ab,_0x3a4ac8){_0x3a36ab=_0x3a36ab-0x0;var _0x6c6b95=_0xacfb[_0x3a36ab];return _0x6c6b95;};'use strict';var _=require(_0xbacf('0x0'));var util=require(_0xbacf('0x1'));var logger=require('../../config/logger')(_0xbacf('0x2'));var moment=require('moment');var BPromise=require(_0xbacf('0x3'));var rp=require(_0xbacf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbacf('0x5'));var attributes=require(_0xbacf('0x6'));module['exports']=function(_0x55e40e,_0x3fe80c){return _0x55e40e[_0xbacf('0x7')](_0xbacf('0x8'),attributes,{'tableName':_0xbacf('0x9'),'paranoid':![],'indexes':[{'name':_0xbacf('0xa'),'fields':[_0xbacf('0xb'),_0xbacf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f9f=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4f9f,0x1b6));var _0xf4f9=function(_0x3a194f,_0x4964bf){_0x3a194f=_0x3a194f-0x0;var _0x43c8de=_0x4f9f[_0x3a194f];return _0x43c8de;};'use strict';var _=require(_0xf4f9('0x0'));var util=require(_0xf4f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf4f9('0x2'));var BPromise=require(_0xf4f9('0x3'));var rp=require(_0xf4f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4f9('0x5'));var config=require(_0xf4f9('0x6'));var attributes=require(_0xf4f9('0x7'));module[_0xf4f9('0x8')]=function(_0x49a78d,_0x108baf){return _0x49a78d['define'](_0xf4f9('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xf4f9('0xa'),'fields':[_0xf4f9('0xb'),_0xf4f9('0xc')],'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 220b572..ff149f3 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x2ed320,_0x167e41){var _0x346898=function(_0x374947){while(--_0x374947){_0x2ed320['push'](_0x2ed320['shift']());}};_0x346898(++_0x167e41);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xcb91[_0x43f881];return _0x365c14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xf4eb,0xec));var _0xbf4e=function(_0x498da4,_0x23f728){_0x498da4=_0x498da4-0x0;var _0x432865=_0xf4eb[_0x498da4];return _0x432865;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b7abacd..14b7838 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1cb073,_0x2fdba1){var _0x50db36=function(_0xee01ab){while(--_0xee01ab){_0x1cb073['push'](_0x1cb073['shift']());}};_0x50db36(++_0x2fdba1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x53fc36,_0x34a510){var _0x511dff=function(_0x1b2312){while(--_0x1b2312){_0x53fc36['push'](_0x53fc36['shift']());}};_0x511dff(++_0x34a510);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 13a2beb..2886873 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(_0x4eee0b,_0x243e88){var _0x16629b=function(_0x588647){while(--_0x588647){_0x4eee0b['push'](_0x4eee0b['shift']());}};_0x16629b(++_0x243e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x4deab6,_0x48fd11){var _0x14a9e0=function(_0x128aed){while(--_0x128aed){_0x4deab6['push'](_0x4deab6['shift']());}};_0x14a9e0(++_0x48fd11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 2a4fcd3..95edb8d 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 _0xe8da=['getDescriptions','channel','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','type','Descriptions'];(function(_0x2328fb,_0x1993be){var _0x42cf51=function(_0x139508){while(--_0x139508){_0x2328fb['push'](_0x2328fb['shift']());}};_0x42cf51(++_0x1993be);}(_0xe8da,0xa4));var _0xae8d=function(_0x5843e7,_0x1019ec){_0x5843e7=_0x5843e7-0x0;var _0x240fd6=_0xe8da[_0x5843e7];return _0x240fd6;};'use strict';var emlformat=require(_0xae8d('0x0'));var rimraf=require(_0xae8d('0x1'));var zipdir=require(_0xae8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae8d('0x3'));var moment=require(_0xae8d('0x4'));var BPromise=require(_0xae8d('0x5'));var Mustache=require(_0xae8d('0x6'));var util=require(_0xae8d('0x7'));var path=require(_0xae8d('0x8'));var sox=require(_0xae8d('0x9'));var csv=require(_0xae8d('0xa'));var ejs=require(_0xae8d('0xb'));var fs=require('fs');var fs_extra=require(_0xae8d('0xc'));var _=require(_0xae8d('0xd'));var squel=require(_0xae8d('0xe'));var crypto=require('crypto');var jsforce=require(_0xae8d('0xf'));var deskjs=require(_0xae8d('0x10'));var toCsv=require(_0xae8d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xae8d('0x11'));var authService=require(_0xae8d('0x12'));var qs=require(_0xae8d('0x13'));var as=require(_0xae8d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae8d('0x15'))(_0xae8d('0x16'));var utils=require(_0xae8d('0x17'));var config=require(_0xae8d('0x18'));var licenseUtil=require(_0xae8d('0x19'));var db=require(_0xae8d('0x1a'))['db'];var integrations=require(_0xae8d('0x1b'));function respondWithStatusCode(_0xcbbf7a,_0x2c5cfc){_0x2c5cfc=_0x2c5cfc||0xcc;return function(_0x57f0f4){if(_0x57f0f4){return _0xcbbf7a[_0xae8d('0x1c')](_0x2c5cfc);}return _0xcbbf7a[_0xae8d('0x1d')](_0x2c5cfc)[_0xae8d('0x1e')]();};}function respondWithResult(_0x36095f,_0x5920d5){_0x5920d5=_0x5920d5||0xc8;return function(_0x251c9e){if(_0x251c9e){return _0x36095f[_0xae8d('0x1d')](_0x5920d5)['json'](_0x251c9e);}};}function respondWithFilteredResult(_0x1b43dd,_0x272c4b){return function(_0x1a5cbf){if(_0x1a5cbf){var _0x560f1f=typeof _0x272c4b[_0xae8d('0x1f')]==='undefined'&&typeof _0x272c4b['limit']==='undefined';var _0x2024df=_0x1a5cbf[_0xae8d('0x20')];var _0x40755a=_0x560f1f?0x0:_0x272c4b[_0xae8d('0x1f')];var _0x3ec6fa=_0x560f1f?_0x1a5cbf[_0xae8d('0x20')]:_0x272c4b[_0xae8d('0x1f')]+_0x272c4b[_0xae8d('0x21')];var _0x4a33ec;if(_0x3ec6fa>=_0x2024df){_0x3ec6fa=_0x2024df;_0x4a33ec=0xc8;}else{_0x4a33ec=0xce;}_0x1b43dd[_0xae8d('0x1d')](_0x4a33ec);return _0x1b43dd['set'](_0xae8d('0x22'),_0x40755a+'-'+_0x3ec6fa+'/'+_0x2024df)[_0xae8d('0x23')](_0x1a5cbf);}return null;};}function patchUpdates(_0x2506b){return function(_0x5cd07b){try{jsonpatch[_0xae8d('0x24')](_0x5cd07b,_0x2506b,!![]);}catch(_0x176055){return BPromise[_0xae8d('0x25')](_0x176055);}return _0x5cd07b[_0xae8d('0x26')]();};}function saveUpdates(_0x2a7f99,_0x5f4101){return function(_0x5853c5){if(_0x5853c5){return _0x5853c5[_0xae8d('0x27')](_0x2a7f99)[_0xae8d('0x28')](function(_0x66fffd){return _0x66fffd;});}return null;};}function removeEntity(_0x2b238e,_0x359a28){return function(_0x41bebb){if(_0x41bebb){return _0x41bebb[_0xae8d('0x29')]()[_0xae8d('0x28')](function(){_0x2b238e[_0xae8d('0x1d')](0xcc)[_0xae8d('0x1e')]();});}};}function handleEntityNotFound(_0x258c43,_0x5cdf8e){return function(_0x2d10c2){if(!_0x2d10c2){_0x258c43['sendStatus'](0x194);}return _0x2d10c2;};}function handleError(_0x156dad,_0x49693f){_0x49693f=_0x49693f||0x1f4;return function(_0xd87be7){logger[_0xae8d('0x2a')](_0xd87be7[_0xae8d('0x2b')]);if(_0xd87be7['name']){delete _0xd87be7[_0xae8d('0x2c')];}_0x156dad[_0xae8d('0x1d')](_0x49693f)[_0xae8d('0x2d')](_0xd87be7);};}exports[_0xae8d('0x2e')]=function(_0x14c829,_0x32e066){var _0x1cf892={},_0x458b01={},_0x540e1b={'count':0x0,'rows':[]};var _0x365956=_[_0xae8d('0x2f')](db[_0xae8d('0x30')][_0xae8d('0x31')],function(_0x1c2f8b){return{'name':_0x1c2f8b['fieldName'],'type':_0x1c2f8b['type']['key']};});_0x458b01['model']=_[_0xae8d('0x2f')](_0x365956,_0xae8d('0x2c'));_0x458b01[_0xae8d('0x32')]=_[_0xae8d('0x33')](_0x14c829['query']);_0x458b01['filters']=_[_0xae8d('0x34')](_0x458b01['model'],_0x458b01[_0xae8d('0x32')]);_0x1cf892[_0xae8d('0x35')]=_[_0xae8d('0x34')](_0x458b01['model'],qs[_0xae8d('0x36')](_0x14c829[_0xae8d('0x32')]['fields']));_0x1cf892[_0xae8d('0x35')]=_0x1cf892[_0xae8d('0x35')][_0xae8d('0x37')]?_0x1cf892['attributes']:_0x458b01[_0xae8d('0x38')];if(!_0x14c829[_0xae8d('0x32')][_0xae8d('0x39')](_0xae8d('0x3a'))){_0x1cf892['limit']=qs['limit'](_0x14c829[_0xae8d('0x32')]['limit']);_0x1cf892['offset']=qs[_0xae8d('0x1f')](_0x14c829[_0xae8d('0x32')]['offset']);}_0x1cf892[_0xae8d('0x3b')]=qs[_0xae8d('0x3c')](_0x14c829[_0xae8d('0x32')][_0xae8d('0x3c')]);_0x1cf892['where']=qs['filters'](_['pick'](_0x14c829['query'],_0x458b01[_0xae8d('0x3d')]),_0x365956);if(_0x14c829[_0xae8d('0x32')][_0xae8d('0x3e')]){_0x1cf892['where']=_['merge'](_0x1cf892[_0xae8d('0x3f')],{'$or':_['map'](_0x365956,function(_0x58b033){if(_0x58b033['type']!==_0xae8d('0x40')){var _0x4924ca={};_0x4924ca[_0x58b033[_0xae8d('0x2c')]]={'$like':'%'+_0x14c829[_0xae8d('0x32')][_0xae8d('0x3e')]+'%'};return _0x4924ca;}})});}_0x1cf892=_[_0xae8d('0x41')]({},_0x1cf892,_0x14c829[_0xae8d('0x42')]);var _0x283b28={'where':_0x1cf892[_0xae8d('0x3f')]};return db[_0xae8d('0x30')]['count'](_0x283b28)[_0xae8d('0x28')](function(_0x1d0185){_0x540e1b[_0xae8d('0x20')]=_0x1d0185;if(_0x14c829[_0xae8d('0x32')][_0xae8d('0x43')]){_0x1cf892[_0xae8d('0x44')]=[{'all':!![]}];}return db[_0xae8d('0x30')][_0xae8d('0x45')](_0x1cf892);})[_0xae8d('0x28')](function(_0x431922){_0x540e1b[_0xae8d('0x46')]=_0x431922;return _0x540e1b;})[_0xae8d('0x28')](respondWithFilteredResult(_0x32e066,_0x1cf892))[_0xae8d('0x47')](handleError(_0x32e066,null));};exports[_0xae8d('0x48')]=function(_0x5ad80a,_0x58f023){var _0x177ac3={'raw':![],'where':{'id':_0x5ad80a[_0xae8d('0x49')]['id']}},_0x2de0af={};_0x2de0af['model']=_[_0xae8d('0x33')](db[_0xae8d('0x30')][_0xae8d('0x31')]);_0x2de0af['query']=_['keys'](_0x5ad80a[_0xae8d('0x32')]);_0x2de0af[_0xae8d('0x3d')]=_[_0xae8d('0x34')](_0x2de0af[_0xae8d('0x38')],_0x2de0af['query']);_0x177ac3[_0xae8d('0x35')]=_[_0xae8d('0x34')](_0x2de0af[_0xae8d('0x38')],qs[_0xae8d('0x36')](_0x5ad80a['query'][_0xae8d('0x36')]));_0x177ac3[_0xae8d('0x35')]=_0x177ac3[_0xae8d('0x35')]['length']?_0x177ac3[_0xae8d('0x35')]:_0x2de0af[_0xae8d('0x38')];if(_0x5ad80a[_0xae8d('0x32')]['includeAll']){_0x177ac3[_0xae8d('0x44')]=[{'all':!![]}];}_0x177ac3=_['merge']({},_0x177ac3,_0x5ad80a[_0xae8d('0x42')]);return db[_0xae8d('0x30')]['find'](_0x177ac3)['then'](handleEntityNotFound(_0x58f023,null))[_0xae8d('0x28')](respondWithResult(_0x58f023,null))[_0xae8d('0x47')](handleError(_0x58f023,null));};exports['create']=function(_0x478636,_0xf14eba){return db['SugarcrmAccount'][_0xae8d('0x4a')](_0x478636['body'],{})['then'](respondWithResult(_0xf14eba,0xc9))['catch'](handleError(_0xf14eba,null));};exports[_0xae8d('0x27')]=function(_0x173b6e,_0x5e6ef5){if(_0x173b6e[_0xae8d('0x4b')]['id']){delete _0x173b6e[_0xae8d('0x4b')]['id'];}return db[_0xae8d('0x30')][_0xae8d('0x4c')]({'where':{'id':_0x173b6e[_0xae8d('0x49')]['id']}})[_0xae8d('0x28')](handleEntityNotFound(_0x5e6ef5,null))[_0xae8d('0x28')](saveUpdates(_0x173b6e[_0xae8d('0x4b')],null))[_0xae8d('0x28')](respondWithResult(_0x5e6ef5,null))[_0xae8d('0x47')](handleError(_0x5e6ef5,null));};exports[_0xae8d('0x29')]=function(_0x562f99,_0xf8954){return db[_0xae8d('0x30')][_0xae8d('0x4c')]({'where':{'id':_0x562f99[_0xae8d('0x49')]['id']}})[_0xae8d('0x28')](handleEntityNotFound(_0xf8954,null))['then'](removeEntity(_0xf8954,null))[_0xae8d('0x47')](handleError(_0xf8954,null));};exports[_0xae8d('0x4d')]=function(_0x3b5d13,_0x364816,_0x3a2e75){var _0x3179a4={};var _0x4f4d07={};var _0x493ab5;var _0x5dd2f6;return db[_0xae8d('0x30')][_0xae8d('0x4e')]({'where':{'id':_0x3b5d13[_0xae8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x364816,null))[_0xae8d('0x28')](function(_0x314241){if(_0x314241){_0x493ab5=_0x314241;_0x4f4d07[_0xae8d('0x38')]=_[_0xae8d('0x33')](db[_0xae8d('0x4f')]['rawAttributes']);_0x4f4d07[_0xae8d('0x32')]=_[_0xae8d('0x33')](_0x3b5d13[_0xae8d('0x32')]);_0x4f4d07[_0xae8d('0x3d')]=_[_0xae8d('0x34')](_0x4f4d07[_0xae8d('0x38')],_0x4f4d07['query']);_0x3179a4[_0xae8d('0x35')]=_[_0xae8d('0x34')](_0x4f4d07[_0xae8d('0x38')],qs[_0xae8d('0x36')](_0x3b5d13[_0xae8d('0x32')]['fields']));_0x3179a4[_0xae8d('0x35')]=_0x3179a4['attributes'][_0xae8d('0x37')]?_0x3179a4[_0xae8d('0x35')]:_0x4f4d07['model'];_0x3179a4['order']=qs['sort'](_0x3b5d13[_0xae8d('0x32')][_0xae8d('0x3c')]);_0x3179a4['where']=qs[_0xae8d('0x3d')](_[_0xae8d('0x50')](_0x3b5d13['query'],_0x4f4d07[_0xae8d('0x3d')]));if(_0x3b5d13[_0xae8d('0x32')][_0xae8d('0x3e')]){_0x3179a4[_0xae8d('0x3f')]=_[_0xae8d('0x41')](_0x3179a4['where'],{'$or':_[_0xae8d('0x2f')](_0x3179a4[_0xae8d('0x35')],function(_0x46be6e){var _0x4842cf={};_0x4842cf[_0x46be6e]={'$like':'%'+_0x3b5d13[_0xae8d('0x32')]['filter']+'%'};return _0x4842cf;})});}_0x3179a4=_[_0xae8d('0x41')]({},_0x3179a4,_0x3b5d13['options']);return _0x493ab5['getConfigurations'](_0x3179a4);}})[_0xae8d('0x28')](function(_0x1cd83b){if(_0x1cd83b){_0x5dd2f6=_0x1cd83b[_0xae8d('0x37')];if(!_0x3b5d13[_0xae8d('0x32')][_0xae8d('0x39')](_0xae8d('0x3a'))){_0x3179a4['limit']=qs[_0xae8d('0x21')](_0x3b5d13['query'][_0xae8d('0x21')]);_0x3179a4[_0xae8d('0x1f')]=qs['offset'](_0x3b5d13[_0xae8d('0x32')][_0xae8d('0x1f')]);}return _0x493ab5[_0xae8d('0x4d')](_0x3179a4);}})[_0xae8d('0x28')](function(_0x2847e3){if(_0x2847e3){return _0x2847e3?{'count':_0x5dd2f6,'rows':_0x2847e3}:null;}})['then'](respondWithResult(_0x364816,null))[_0xae8d('0x47')](handleError(_0x364816,null));};exports[_0xae8d('0x51')]=function(_0x2cb320,_0x449c5c,_0x20f3d5){if(_0x2cb320['body']['id']){delete _0x2cb320[_0xae8d('0x4b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2cb320[_0xae8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x449c5c,null))[_0xae8d('0x28')](function(_0x59844e){if(_0x59844e){_0x2cb320[_0xae8d('0x4b')][_0xae8d('0x52')]=_0x59844e['id'];_0x2cb320[_0xae8d('0x4b')][_0xae8d('0x53')]=integrations['getSubjects'](_0x2cb320[_0xae8d('0x4b')]['channel'],_0x2cb320['body'][_0xae8d('0x54')]);_0x2cb320['body'][_0xae8d('0x55')]=integrations[_0xae8d('0x56')](_0x2cb320[_0xae8d('0x4b')][_0xae8d('0x57')],_0x2cb320['body'][_0xae8d('0x54')]);return db['SugarcrmConfiguration'][_0xae8d('0x4a')](_0x2cb320['body'],{'include':[{'model':db[_0xae8d('0x58')],'as':_0xae8d('0x53')},{'model':db[_0xae8d('0x58')],'as':_0xae8d('0x55')}]});}return null;})[_0xae8d('0x28')](respondWithResult(_0x449c5c,null))[_0xae8d('0x47')](handleError(_0x449c5c,null));};exports[_0xae8d('0x59')]=function(_0xaebc9f,_0x4d8eca,_0x32633e){var _0x54f578='';var _0x192563=['id',_0xae8d('0x2c'),'assigned_user_id','created_by',_0xae8d('0x5a'),_0xae8d('0x5b'),_0xae8d('0x5c'),_0xae8d('0x5d'),_0xae8d('0x5e'),_0xae8d('0x5f'),_0xae8d('0x60'),_0xae8d('0x61')];return db[_0xae8d('0x30')][_0xae8d('0x4e')]({'where':{'id':_0xaebc9f[_0xae8d('0x49')]['id']},'attributes':['id',_0xae8d('0x62'),_0xae8d('0x63'),'remoteUri']})['then'](handleEntityNotFound(_0x4d8eca,null))[_0xae8d('0x28')](function(_0x1a5629){if(_0x1a5629){_0x54f578=_0x1a5629[_0xae8d('0x64')];var _0x1202ec=_0x54f578[_0xae8d('0x65')](-0x1);if(_0x1202ec==='/'){_0x54f578=_0x54f578[_0xae8d('0x66')](0x0,_0x54f578[_0xae8d('0x67')](_0x1202ec));}return rp({'method':'POST','uri':util[_0xae8d('0x68')](_0xae8d('0x69'),_0x54f578,_0xae8d('0x6a')),'json':!![],'form':{'method':_0xae8d('0x6b'),'input_type':_0xae8d('0x6c'),'response_type':_0xae8d('0x6c'),'rest_data':JSON[_0xae8d('0x6d')]({'user_auth':{'user_name':_0x1a5629['username'],'password':_0x1a5629[_0xae8d('0x63')],'encryption':_0xae8d('0x6e')},'application':_0xae8d('0x6f')})}});}})[_0xae8d('0x28')](function(_0x126171){if(_0x126171&&_0x126171['name']!==_0xae8d('0x70')&&_0x126171[_0xae8d('0x2c')]!==_0xae8d('0x71')){return rp({'method':'POST','uri':util[_0xae8d('0x68')](_0xae8d('0x69'),_0x54f578,_0xae8d('0x6a')),'json':!![],'form':{'method':_0xae8d('0x72'),'input_type':_0xae8d('0x6c'),'response_type':_0xae8d('0x6c'),'rest_data':JSON[_0xae8d('0x6d')]({'session':_0x126171['id'],'module_name':_0xae8d('0x73')})}})[_0xae8d('0x28')](function(_0x5efc04){if(_0x5efc04){var _0x36a5af=_['values'](_0x5efc04[_0xae8d('0x74')]);_[_0xae8d('0x75')](_0x36a5af,function(_0x1691e1){return _0x192563['includes'](_0x1691e1['name']);});return{'count':_0x36a5af['length'],'rows':_[_0xae8d('0x2f')](_0x36a5af,function(_0x5bc218){return{'id':_0x5bc218['name'],'name':_0x5bc218['label'],'custom':_[_0xae8d('0x76')](_0x5bc218[_0xae8d('0x2c')],'_c')?!![]:![],'options':_0x5bc218['options']?_[_0xae8d('0x2f')](_[_0xae8d('0x77')](_0x5bc218[_0xae8d('0x42')]),function(_0x4fc5fb){return{'name':_0x4fc5fb[_0xae8d('0x78')],'value':_0x4fc5fb['name']};}):[]};})};}})[_0xae8d('0x28')](respondWithResult(_0x4d8eca,null))[_0xae8d('0x47')](function(_0x5a49d4){var _0x3a09a3=_0xaebc9f[_0xae8d('0x32')][_0xae8d('0x79')]?0x1f4:_0x5a49d4[_0xae8d('0x7a')]||0x1f4;logger['error'](_0xae8d('0x7b'),_0xae8d('0x59'),_0x3a09a3,JSON['stringify'](_0x5a49d4));delete _0x5a49d4[_0xae8d('0x2c')];if(_0x3a09a3===0x191){_0x3a09a3=0x190;}_0x4d8eca[_0xae8d('0x1d')](_0x3a09a3)['send'](_0xaebc9f[_0xae8d('0x32')][_0xae8d('0x79')]?{'message':_0xae8d('0x7c'),'statusCode':_0x5a49d4['statusCode']}:_0x5a49d4);});}else{var _0x34a620=0x1f4;_0x4d8eca[_0xae8d('0x1d')](_0x34a620)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x0396=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','reject','save','then','error','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','sort','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','includes','label','endsWith','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel'];(function(_0x5832fa,_0x40381f){var _0x55982c=function(_0x428fda){while(--_0x428fda){_0x5832fa['push'](_0x5832fa['shift']());}};_0x55982c(++_0x40381f);}(_0x0396,0x149));var _0x6039=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x0396[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6039('0x0'));var zipdir=require(_0x6039('0x1'));var jsonpatch=require(_0x6039('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6039('0x3'));var Mustache=require(_0x6039('0x4'));var util=require('util');var path=require(_0x6039('0x5'));var sox=require('sox');var csv=require(_0x6039('0x6'));var ejs=require(_0x6039('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6039('0x8'));var squel=require(_0x6039('0x9'));var crypto=require('crypto');var jsforce=require(_0x6039('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6039('0x6'));var querystring=require('querystring');var Papa=require(_0x6039('0xb'));var Redis=require(_0x6039('0xc'));var authService=require(_0x6039('0xd'));var qs=require(_0x6039('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6039('0xf'));var logger=require(_0x6039('0x10'))(_0x6039('0x11'));var utils=require('../../config/utils');var config=require(_0x6039('0x12'));var licenseUtil=require(_0x6039('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6039('0x14'));function respondWithStatusCode(_0x4adb80,_0x3eda64){_0x3eda64=_0x3eda64||0xcc;return function(_0x2c353f){if(_0x2c353f){return _0x4adb80['sendStatus'](_0x3eda64);}return _0x4adb80[_0x6039('0x15')](_0x3eda64)[_0x6039('0x16')]();};}function respondWithResult(_0x47ccd3,_0x253cd1){_0x253cd1=_0x253cd1||0xc8;return function(_0x18f291){if(_0x18f291){return _0x47ccd3[_0x6039('0x15')](_0x253cd1)[_0x6039('0x17')](_0x18f291);}};}function respondWithFilteredResult(_0x25c818,_0x550d30){return function(_0x2094bb){if(_0x2094bb){var _0x27d6f1=typeof _0x550d30[_0x6039('0x18')]===_0x6039('0x19')&&typeof _0x550d30[_0x6039('0x1a')]===_0x6039('0x19');var _0xd5a21b=_0x2094bb['count'];var _0x4f96d7=_0x27d6f1?0x0:_0x550d30['offset'];var _0x5f4743=_0x27d6f1?_0x2094bb['count']:_0x550d30['offset']+_0x550d30[_0x6039('0x1a')];var _0x3b715f;if(_0x5f4743>=_0xd5a21b){_0x5f4743=_0xd5a21b;_0x3b715f=0xc8;}else{_0x3b715f=0xce;}_0x25c818[_0x6039('0x15')](_0x3b715f);return _0x25c818[_0x6039('0x1b')]('Content-Range',_0x4f96d7+'-'+_0x5f4743+'/'+_0xd5a21b)[_0x6039('0x17')](_0x2094bb);}return null;};}function patchUpdates(_0x46526c){return function(_0x3ee97b){try{jsonpatch['apply'](_0x3ee97b,_0x46526c,!![]);}catch(_0x1289e7){return BPromise[_0x6039('0x1c')](_0x1289e7);}return _0x3ee97b[_0x6039('0x1d')]();};}function saveUpdates(_0x542e59,_0x42d46e){return function(_0x114597){if(_0x114597){return _0x114597['update'](_0x542e59)['then'](function(_0x252a4a){return _0x252a4a;});}return null;};}function removeEntity(_0x131431,_0x472962){return function(_0x80ce97){if(_0x80ce97){return _0x80ce97['destroy']()[_0x6039('0x1e')](function(){_0x131431[_0x6039('0x15')](0xcc)[_0x6039('0x16')]();});}};}function handleEntityNotFound(_0x28f14f,_0x14ff48){return function(_0x1b68d7){if(!_0x1b68d7){_0x28f14f['sendStatus'](0x194);}return _0x1b68d7;};}function handleError(_0x4dd277,_0x5cf69d){_0x5cf69d=_0x5cf69d||0x1f4;return function(_0x19240a){logger[_0x6039('0x1f')](_0x19240a['stack']);if(_0x19240a[_0x6039('0x20')]){delete _0x19240a['name'];}_0x4dd277['status'](_0x5cf69d)[_0x6039('0x21')](_0x19240a);};}exports[_0x6039('0x22')]=function(_0x202c69,_0xcd0837){var _0x1ab763={},_0x4b7594={},_0x273bba={'count':0x0,'rows':[]};var _0x19f6c4=_[_0x6039('0x23')](db[_0x6039('0x24')][_0x6039('0x25')],function(_0x1d08da){return{'name':_0x1d08da['fieldName'],'type':_0x1d08da[_0x6039('0x26')][_0x6039('0x27')]};});_0x4b7594['model']=_['map'](_0x19f6c4,_0x6039('0x20'));_0x4b7594[_0x6039('0x28')]=_[_0x6039('0x29')](_0x202c69[_0x6039('0x28')]);_0x4b7594[_0x6039('0x2a')]=_['intersection'](_0x4b7594[_0x6039('0x2b')],_0x4b7594[_0x6039('0x28')]);_0x1ab763['attributes']=_[_0x6039('0x2c')](_0x4b7594[_0x6039('0x2b')],qs[_0x6039('0x2d')](_0x202c69[_0x6039('0x28')]['fields']));_0x1ab763[_0x6039('0x2e')]=_0x1ab763[_0x6039('0x2e')][_0x6039('0x2f')]?_0x1ab763[_0x6039('0x2e')]:_0x4b7594['model'];if(!_0x202c69['query']['hasOwnProperty'](_0x6039('0x30'))){_0x1ab763[_0x6039('0x1a')]=qs['limit'](_0x202c69['query']['limit']);_0x1ab763[_0x6039('0x18')]=qs[_0x6039('0x18')](_0x202c69[_0x6039('0x28')][_0x6039('0x18')]);}_0x1ab763['order']=qs['sort'](_0x202c69[_0x6039('0x28')]['sort']);_0x1ab763[_0x6039('0x31')]=qs['filters'](_[_0x6039('0x32')](_0x202c69['query'],_0x4b7594[_0x6039('0x2a')]),_0x19f6c4);if(_0x202c69[_0x6039('0x28')]['filter']){_0x1ab763[_0x6039('0x31')]=_[_0x6039('0x33')](_0x1ab763[_0x6039('0x31')],{'$or':_[_0x6039('0x23')](_0x19f6c4,function(_0x2da8af){if(_0x2da8af[_0x6039('0x26')]!==_0x6039('0x34')){var _0x4bfc43={};_0x4bfc43[_0x2da8af[_0x6039('0x20')]]={'$like':'%'+_0x202c69[_0x6039('0x28')][_0x6039('0x35')]+'%'};return _0x4bfc43;}})});}_0x1ab763=_[_0x6039('0x33')]({},_0x1ab763,_0x202c69['options']);var _0xd3f889={'where':_0x1ab763[_0x6039('0x31')]};return db[_0x6039('0x24')]['count'](_0xd3f889)[_0x6039('0x1e')](function(_0x1d38ec){_0x273bba[_0x6039('0x36')]=_0x1d38ec;if(_0x202c69[_0x6039('0x28')][_0x6039('0x37')]){_0x1ab763[_0x6039('0x38')]=[{'all':!![]}];}return db[_0x6039('0x24')][_0x6039('0x39')](_0x1ab763);})[_0x6039('0x1e')](function(_0x4d6a1e){_0x273bba[_0x6039('0x3a')]=_0x4d6a1e;return _0x273bba;})['then'](respondWithFilteredResult(_0xcd0837,_0x1ab763))[_0x6039('0x3b')](handleError(_0xcd0837,null));};exports[_0x6039('0x3c')]=function(_0x50ddea,_0x527921){var _0x2be3e5={'raw':![],'where':{'id':_0x50ddea[_0x6039('0x3d')]['id']}},_0x1cb8ff={};_0x1cb8ff[_0x6039('0x2b')]=_[_0x6039('0x29')](db[_0x6039('0x24')]['rawAttributes']);_0x1cb8ff[_0x6039('0x28')]=_[_0x6039('0x29')](_0x50ddea[_0x6039('0x28')]);_0x1cb8ff['filters']=_[_0x6039('0x2c')](_0x1cb8ff[_0x6039('0x2b')],_0x1cb8ff[_0x6039('0x28')]);_0x2be3e5[_0x6039('0x2e')]=_[_0x6039('0x2c')](_0x1cb8ff[_0x6039('0x2b')],qs['fields'](_0x50ddea[_0x6039('0x28')][_0x6039('0x2d')]));_0x2be3e5[_0x6039('0x2e')]=_0x2be3e5[_0x6039('0x2e')][_0x6039('0x2f')]?_0x2be3e5[_0x6039('0x2e')]:_0x1cb8ff[_0x6039('0x2b')];if(_0x50ddea['query'][_0x6039('0x37')]){_0x2be3e5[_0x6039('0x38')]=[{'all':!![]}];}_0x2be3e5=_[_0x6039('0x33')]({},_0x2be3e5,_0x50ddea[_0x6039('0x3e')]);return db[_0x6039('0x24')][_0x6039('0x3f')](_0x2be3e5)['then'](handleEntityNotFound(_0x527921,null))[_0x6039('0x1e')](respondWithResult(_0x527921,null))['catch'](handleError(_0x527921,null));};exports[_0x6039('0x40')]=function(_0x2d493b,_0x42cfa6){return db[_0x6039('0x24')][_0x6039('0x40')](_0x2d493b[_0x6039('0x41')],{})[_0x6039('0x1e')](respondWithResult(_0x42cfa6,0xc9))[_0x6039('0x3b')](handleError(_0x42cfa6,null));};exports[_0x6039('0x42')]=function(_0x50bed7,_0x5e4fba){if(_0x50bed7[_0x6039('0x41')]['id']){delete _0x50bed7['body']['id'];}return db[_0x6039('0x24')][_0x6039('0x3f')]({'where':{'id':_0x50bed7[_0x6039('0x3d')]['id']}})[_0x6039('0x1e')](handleEntityNotFound(_0x5e4fba,null))[_0x6039('0x1e')](saveUpdates(_0x50bed7[_0x6039('0x41')],null))[_0x6039('0x1e')](respondWithResult(_0x5e4fba,null))[_0x6039('0x3b')](handleError(_0x5e4fba,null));};exports[_0x6039('0x43')]=function(_0x55ddeb,_0x47a542){return db[_0x6039('0x24')][_0x6039('0x3f')]({'where':{'id':_0x55ddeb[_0x6039('0x3d')]['id']}})['then'](handleEntityNotFound(_0x47a542,null))[_0x6039('0x1e')](removeEntity(_0x47a542,null))[_0x6039('0x3b')](handleError(_0x47a542,null));};exports[_0x6039('0x44')]=function(_0x5ea465,_0x28e409,_0x57cd5b){var _0x54a3da={};var _0x389651={};var _0x447a53;var _0x407ad3;return db[_0x6039('0x24')][_0x6039('0x45')]({'where':{'id':_0x5ea465[_0x6039('0x3d')]['id']}})['then'](handleEntityNotFound(_0x28e409,null))[_0x6039('0x1e')](function(_0x24cec0){if(_0x24cec0){_0x447a53=_0x24cec0;_0x389651[_0x6039('0x2b')]=_[_0x6039('0x29')](db[_0x6039('0x46')][_0x6039('0x25')]);_0x389651['query']=_[_0x6039('0x29')](_0x5ea465[_0x6039('0x28')]);_0x389651[_0x6039('0x2a')]=_['intersection'](_0x389651[_0x6039('0x2b')],_0x389651[_0x6039('0x28')]);_0x54a3da[_0x6039('0x2e')]=_[_0x6039('0x2c')](_0x389651[_0x6039('0x2b')],qs[_0x6039('0x2d')](_0x5ea465['query'][_0x6039('0x2d')]));_0x54a3da[_0x6039('0x2e')]=_0x54a3da[_0x6039('0x2e')][_0x6039('0x2f')]?_0x54a3da[_0x6039('0x2e')]:_0x389651[_0x6039('0x2b')];_0x54a3da[_0x6039('0x47')]=qs['sort'](_0x5ea465['query'][_0x6039('0x48')]);_0x54a3da[_0x6039('0x31')]=qs[_0x6039('0x2a')](_[_0x6039('0x32')](_0x5ea465[_0x6039('0x28')],_0x389651[_0x6039('0x2a')]));if(_0x5ea465['query'][_0x6039('0x35')]){_0x54a3da[_0x6039('0x31')]=_[_0x6039('0x33')](_0x54a3da[_0x6039('0x31')],{'$or':_[_0x6039('0x23')](_0x54a3da[_0x6039('0x2e')],function(_0x2614f6){var _0x7b4983={};_0x7b4983[_0x2614f6]={'$like':'%'+_0x5ea465['query'][_0x6039('0x35')]+'%'};return _0x7b4983;})});}_0x54a3da=_[_0x6039('0x33')]({},_0x54a3da,_0x5ea465[_0x6039('0x3e')]);return _0x447a53[_0x6039('0x44')](_0x54a3da);}})[_0x6039('0x1e')](function(_0x2f0911){if(_0x2f0911){_0x407ad3=_0x2f0911['length'];if(!_0x5ea465[_0x6039('0x28')][_0x6039('0x49')](_0x6039('0x30'))){_0x54a3da[_0x6039('0x1a')]=qs[_0x6039('0x1a')](_0x5ea465[_0x6039('0x28')][_0x6039('0x1a')]);_0x54a3da['offset']=qs[_0x6039('0x18')](_0x5ea465[_0x6039('0x28')][_0x6039('0x18')]);}return _0x447a53['getConfigurations'](_0x54a3da);}})[_0x6039('0x1e')](function(_0x28f8c6){if(_0x28f8c6){return _0x28f8c6?{'count':_0x407ad3,'rows':_0x28f8c6}:null;}})['then'](respondWithResult(_0x28e409,null))['catch'](handleError(_0x28e409,null));};exports['addConfiguration']=function(_0xbacdbe,_0x39bbaa,_0x5a4be8){if(_0xbacdbe[_0x6039('0x41')]['id']){delete _0xbacdbe[_0x6039('0x41')]['id'];}return db[_0x6039('0x24')]['findOne']({'where':{'id':_0xbacdbe['params']['id']}})[_0x6039('0x1e')](handleEntityNotFound(_0x39bbaa,null))[_0x6039('0x1e')](function(_0x116bf3){if(_0x116bf3){_0xbacdbe['body'][_0x6039('0x4a')]=_0x116bf3['id'];_0xbacdbe['body'][_0x6039('0x4b')]=integrations[_0x6039('0x4c')](_0xbacdbe[_0x6039('0x41')][_0x6039('0x4d')],_0xbacdbe[_0x6039('0x41')][_0x6039('0x26')]);_0xbacdbe['body'][_0x6039('0x4e')]=integrations[_0x6039('0x4f')](_0xbacdbe[_0x6039('0x41')]['channel'],_0xbacdbe['body']['type']);return db[_0x6039('0x46')][_0x6039('0x40')](_0xbacdbe[_0x6039('0x41')],{'include':[{'model':db[_0x6039('0x50')],'as':_0x6039('0x4b')},{'model':db[_0x6039('0x50')],'as':_0x6039('0x4e')}]});}return null;})[_0x6039('0x1e')](respondWithResult(_0x39bbaa,null))[_0x6039('0x3b')](handleError(_0x39bbaa,null));};exports['getFields']=function(_0x19c69a,_0x4fd108,_0x11e129){var _0x58883c='';var _0x2bbcaf=['id',_0x6039('0x20'),_0x6039('0x51'),_0x6039('0x52'),_0x6039('0x53'),_0x6039('0x54'),_0x6039('0x55'),_0x6039('0x56'),_0x6039('0x57'),_0x6039('0x58'),_0x6039('0x59'),_0x6039('0x5a')];return db[_0x6039('0x24')]['findOne']({'where':{'id':_0x19c69a[_0x6039('0x3d')]['id']},'attributes':['id','username','password','remoteUri']})[_0x6039('0x1e')](handleEntityNotFound(_0x4fd108,null))[_0x6039('0x1e')](function(_0x4f3c96){if(_0x4f3c96){_0x58883c=_0x4f3c96[_0x6039('0x5b')];var _0x83b9c8=_0x58883c[_0x6039('0x5c')](-0x1);if(_0x83b9c8==='/'){_0x58883c=_0x58883c[_0x6039('0x5d')](0x0,_0x58883c[_0x6039('0x5e')](_0x83b9c8));}return rp({'method':_0x6039('0x5f'),'uri':util[_0x6039('0x60')](_0x6039('0x61'),_0x58883c,_0x6039('0x62')),'json':!![],'form':{'method':'login','input_type':_0x6039('0x63'),'response_type':_0x6039('0x63'),'rest_data':JSON[_0x6039('0x64')]({'user_auth':{'user_name':_0x4f3c96['username'],'password':_0x4f3c96[_0x6039('0x65')],'encryption':'PLAIN'},'application':_0x6039('0x66')})}});}})[_0x6039('0x1e')](function(_0x39f71f){if(_0x39f71f&&_0x39f71f[_0x6039('0x20')]!==_0x6039('0x67')&&_0x39f71f['name']!==_0x6039('0x68')){return rp({'method':_0x6039('0x5f'),'uri':util['format'](_0x6039('0x61'),_0x58883c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6039('0x63'),'response_type':_0x6039('0x63'),'rest_data':JSON[_0x6039('0x64')]({'session':_0x39f71f['id'],'module_name':_0x6039('0x69')})}})[_0x6039('0x1e')](function(_0x3be97e){if(_0x3be97e){var _0x58a1f9=_[_0x6039('0x6a')](_0x3be97e['module_fields']);_['remove'](_0x58a1f9,function(_0x4557aa){return _0x2bbcaf[_0x6039('0x6b')](_0x4557aa['name']);});return{'count':_0x58a1f9['length'],'rows':_['map'](_0x58a1f9,function(_0x146e8f){return{'id':_0x146e8f['name'],'name':_0x146e8f[_0x6039('0x6c')],'custom':_[_0x6039('0x6d')](_0x146e8f['name'],'_c')?!![]:![],'options':_0x146e8f[_0x6039('0x3e')]?_['map'](_[_0x6039('0x6a')](_0x146e8f['options']),function(_0x599224){return{'name':_0x599224['value'],'value':_0x599224[_0x6039('0x20')]};}):[]};})};}})[_0x6039('0x1e')](respondWithResult(_0x4fd108,null))[_0x6039('0x3b')](function(_0x30a46f){var _0x2d3058=_0x19c69a[_0x6039('0x28')][_0x6039('0x6e')]?0x1f4:_0x30a46f[_0x6039('0x6f')]||0x1f4;logger[_0x6039('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2d3058,JSON[_0x6039('0x64')](_0x30a46f));delete _0x30a46f[_0x6039('0x20')];if(_0x2d3058===0x191){_0x2d3058=0x190;}_0x4fd108[_0x6039('0x15')](_0x2d3058)[_0x6039('0x21')](_0x19c69a[_0x6039('0x28')][_0x6039('0x6e')]?{'message':_0x6039('0x70'),'statusCode':_0x30a46f[_0x6039('0x6f')]}:_0x30a46f);});}else{var _0x407458=0x1f4;_0x4fd108[_0x6039('0x15')](_0x407458)[_0x6039('0x21')]({'message':_0x6039('0x70'),'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 9f61ee9..f35defe 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 _0x751c=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x5ef505,_0x48fdbb){var _0x2cb059=function(_0x1a4108){while(--_0x1a4108){_0x5ef505['push'](_0x5ef505['shift']());}};_0x2cb059(++_0x48fdbb);}(_0x751c,0x69));var _0xc751=function(_0x1ba644,_0x166269){_0x1ba644=_0x1ba644-0x0;var _0x5e3f79=_0x751c[_0x1ba644];return _0x5e3f79;};'use strict';var _=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var logger=require(_0xc751('0x2'))('api');var moment=require(_0xc751('0x3'));var BPromise=require('bluebird');var rp=require(_0xc751('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc751('0x5'));var config=require(_0xc751('0x6'));var attributes=require(_0xc751('0x7'));var integrations=require(_0xc751('0x8'));module[_0xc751('0x9')]=function(_0x562b89,_0x12d079){return _0x562b89[_0xc751('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xc751('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2558=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ad9,_0x14fc03){var _0x3cd350=function(_0x3ca109){while(--_0x3ca109){_0x122ad9['push'](_0x122ad9['shift']());}};_0x3cd350(++_0x14fc03);}(_0x2558,0x126));var _0x8255=function(_0x1caf0a,_0x16df0f){_0x1caf0a=_0x1caf0a-0x0;var _0x2509cc=_0x2558[_0x1caf0a];return _0x2509cc;};'use strict';var _=require('lodash');var util=require(_0x8255('0x0'));var logger=require(_0x8255('0x1'))(_0x8255('0x2'));var moment=require(_0x8255('0x3'));var BPromise=require(_0x8255('0x4'));var rp=require(_0x8255('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8255('0x6'));var config=require(_0x8255('0x7'));var attributes=require(_0x8255('0x8'));var integrations=require(_0x8255('0x9'));module[_0x8255('0xa')]=function(_0x31853a,_0x4a4fa2){return _0x31853a['define'](_0x8255('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 200e990..33cc6af 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 _0x2f6b=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f6b,0x118));var _0xb2f6=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0x2f6b[_0x12a57d];return _0x4b26f6;};'use strict';var _=require(_0xb2f6('0x0'));var util=require(_0xb2f6('0x1'));var moment=require(_0xb2f6('0x2'));var BPromise=require(_0xb2f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2f6('0x4'));var logger=require(_0xb2f6('0x5'))(_0xb2f6('0x6'));var config=require(_0xb2f6('0x7'));var jayson=require(_0xb2f6('0x8'));var client=jayson['client'][_0xb2f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2483c1,_0x5f2d69,_0x9c188b){return new BPromise(function(_0x29c5b8,_0xa36ecf){return client[_0xb2f6('0xa')](_0x2483c1,_0x9c188b)[_0xb2f6('0xb')](function(_0x4684a2){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5f2d69,_0xb2f6('0xc'));logger[_0xb2f6('0xd')](_0xb2f6('0xe'),_0x5f2d69,_0xb2f6('0xc'),JSON[_0xb2f6('0xf')](_0x4684a2));if(_0x4684a2[_0xb2f6('0x10')]){if(_0x4684a2['error'][_0xb2f6('0x11')]===0x1f4){logger[_0xb2f6('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5f2d69,_0x4684a2[_0xb2f6('0x10')][_0xb2f6('0x12')]);return _0xa36ecf(_0x4684a2[_0xb2f6('0x10')][_0xb2f6('0x12')]);}logger[_0xb2f6('0x10')](_0xb2f6('0x13'),_0x5f2d69,_0x4684a2[_0xb2f6('0x10')][_0xb2f6('0x12')]);return _0x29c5b8(_0x4684a2['error'][_0xb2f6('0x12')]);}else{logger['info'](_0xb2f6('0x13'),_0x5f2d69,'request\x20sent');_0x29c5b8(_0x4684a2[_0xb2f6('0x14')]['message']);}})[_0xb2f6('0x15')](function(_0x21ff10){logger[_0xb2f6('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5f2d69,_0x21ff10);_0xa36ecf(_0x21ff10);});});}exports[_0xb2f6('0x16')]=function(_0x1a8dd5){var _0x66605d=this;return new Promise(function(_0x21c0de,_0x3523ad){return db[_0xb2f6('0x17')][_0xb2f6('0x18')]({'raw':_0x1a8dd5[_0xb2f6('0x19')]?_0x1a8dd5['options'][_0xb2f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a8dd5[_0xb2f6('0x19')]?_0x1a8dd5[_0xb2f6('0x19')][_0xb2f6('0x1b')]||null:null,'attributes':_0x1a8dd5[_0xb2f6('0x19')]?_0x1a8dd5[_0xb2f6('0x19')][_0xb2f6('0x1c')]||null:null,'limit':_0x1a8dd5[_0xb2f6('0x19')]?_0x1a8dd5[_0xb2f6('0x19')]['limit']||null:null,'include':_0x1a8dd5[_0xb2f6('0x19')]?_0x1a8dd5['options'][_0xb2f6('0x1d')]?_[_0xb2f6('0x1e')](_0x1a8dd5[_0xb2f6('0x19')][_0xb2f6('0x1d')],function(_0x50414e){return{'model':db[_0x50414e[_0xb2f6('0x1f')]],'as':_0x50414e['as'],'attributes':_0x50414e[_0xb2f6('0x1c')],'include':_0x50414e[_0xb2f6('0x1d')]?_[_0xb2f6('0x1e')](_0x50414e[_0xb2f6('0x1d')],function(_0x4474fe){return{'model':db[_0x4474fe[_0xb2f6('0x1f')]],'as':_0x4474fe['as'],'attributes':_0x4474fe[_0xb2f6('0x1c')],'include':_0x4474fe[_0xb2f6('0x1d')]?_[_0xb2f6('0x1e')](_0x4474fe[_0xb2f6('0x1d')],function(_0x4089ed){return{'model':db[_0x4089ed[_0xb2f6('0x1f')]],'as':_0x4089ed['as'],'attributes':_0x4089ed['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2f6('0xb')](function(_0x5d41a8){logger['info'](_0xb2f6('0x16'),_0x1a8dd5);logger[_0xb2f6('0xd')]('GetSugarcrmAccount',_0x1a8dd5,JSON[_0xb2f6('0xf')](_0x5d41a8));_0x21c0de(_0x5d41a8);})['catch'](function(_0x122147){logger['error'](_0xb2f6('0x16'),_0x122147[_0xb2f6('0x12')],_0x1a8dd5);_0x3523ad(_0x66605d[_0xb2f6('0x10')](0x1f4,_0x122147[_0xb2f6('0x12')]));});});};exports[_0xb2f6('0x20')]=function(_0x5d443b){var _0x78b396=this;return new Promise(function(_0xbbf995,_0x43dcbd){return db[_0xb2f6('0x17')][_0xb2f6('0x21')]({'raw':_0x5d443b[_0xb2f6('0x19')]?_0x5d443b['options'][_0xb2f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d443b[_0xb2f6('0x19')]?_0x5d443b[_0xb2f6('0x19')][_0xb2f6('0x1b')]||null:null,'attributes':_0x5d443b[_0xb2f6('0x19')]?_0x5d443b['options'][_0xb2f6('0x1c')]||null:null,'include':_0x5d443b['options']?_0x5d443b['options'][_0xb2f6('0x1d')]?_['map'](_0x5d443b[_0xb2f6('0x19')]['include'],function(_0x58d128){return{'model':db[_0x58d128[_0xb2f6('0x1f')]],'as':_0x58d128['as'],'attributes':_0x58d128[_0xb2f6('0x1c')],'include':_0x58d128[_0xb2f6('0x1d')]?_[_0xb2f6('0x1e')](_0x58d128['include'],function(_0x560efa){return{'model':db[_0x560efa['model']],'as':_0x560efa['as'],'attributes':_0x560efa['attributes'],'include':_0x560efa[_0xb2f6('0x1d')]?_[_0xb2f6('0x1e')](_0x560efa[_0xb2f6('0x1d')],function(_0x368a73){return{'model':db[_0x368a73[_0xb2f6('0x1f')]],'as':_0x368a73['as'],'attributes':_0x368a73[_0xb2f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb2f6('0xb')](function(_0x4c8fdf){logger[_0xb2f6('0x22')]('ShowSugarcrmAccount',_0x5d443b);logger[_0xb2f6('0xd')]('ShowSugarcrmAccount',_0x5d443b,JSON[_0xb2f6('0xf')](_0x4c8fdf));_0xbbf995(_0x4c8fdf);})[_0xb2f6('0x15')](function(_0x3aa3af){logger[_0xb2f6('0x10')]('ShowSugarcrmAccount',_0x3aa3af[_0xb2f6('0x12')],_0x5d443b);_0x43dcbd(_0x78b396['error'](0x1f4,_0x3aa3af[_0xb2f6('0x12')]));});});}; \ No newline at end of file +var _0xb15a=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetSugarcrmAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowSugarcrmAccount','SugarcrmAccount','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xb15a,0x12c));var _0xab15=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0xb15a[_0x43b06b];return _0x2c555b;};'use strict';var _=require('lodash');var util=require(_0xab15('0x0'));var moment=require('moment');var BPromise=require(_0xab15('0x1'));var rs=require(_0xab15('0x2'));var fs=require('fs');var Redis=require(_0xab15('0x3'));var db=require(_0xab15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab15('0x5'))(_0xab15('0x6'));var config=require(_0xab15('0x7'));var jayson=require(_0xab15('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37b41f,_0x1a62dc,_0x5c8fec){return new BPromise(function(_0x56e2a9,_0x509a37){return client[_0xab15('0x9')](_0x37b41f,_0x5c8fec)['then'](function(_0x2d4c6f){logger['info'](_0xab15('0xa'),_0x1a62dc,_0xab15('0xb'));logger[_0xab15('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1a62dc,'request\x20sent',JSON[_0xab15('0xd')](_0x2d4c6f));if(_0x2d4c6f[_0xab15('0xe')]){if(_0x2d4c6f[_0xab15('0xe')][_0xab15('0xf')]===0x1f4){logger[_0xab15('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a62dc,_0x2d4c6f['error'][_0xab15('0x10')]);return _0x509a37(_0x2d4c6f[_0xab15('0xe')]['message']);}logger[_0xab15('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a62dc,_0x2d4c6f[_0xab15('0xe')]['message']);return _0x56e2a9(_0x2d4c6f['error'][_0xab15('0x10')]);}else{logger[_0xab15('0x11')](_0xab15('0xa'),_0x1a62dc,_0xab15('0xb'));_0x56e2a9(_0x2d4c6f['result'][_0xab15('0x10')]);}})['catch'](function(_0x5baa66){logger['error'](_0xab15('0xa'),_0x1a62dc,_0x5baa66);_0x509a37(_0x5baa66);});});}exports[_0xab15('0x12')]=function(_0x180c1b){var _0x403e31=this;return new Promise(function(_0x20dce4,_0x415e57){return db['SugarcrmAccount'][_0xab15('0x13')]({'raw':_0x180c1b['options']?_0x180c1b[_0xab15('0x14')][_0xab15('0x15')]===undefined?!![]:![]:!![],'where':_0x180c1b[_0xab15('0x14')]?_0x180c1b[_0xab15('0x14')][_0xab15('0x16')]||null:null,'attributes':_0x180c1b[_0xab15('0x14')]?_0x180c1b[_0xab15('0x14')]['attributes']||null:null,'limit':_0x180c1b[_0xab15('0x14')]?_0x180c1b[_0xab15('0x14')]['limit']||null:null,'include':_0x180c1b[_0xab15('0x14')]?_0x180c1b[_0xab15('0x14')][_0xab15('0x17')]?_[_0xab15('0x18')](_0x180c1b[_0xab15('0x14')][_0xab15('0x17')],function(_0x2e1d33){return{'model':db[_0x2e1d33[_0xab15('0x19')]],'as':_0x2e1d33['as'],'attributes':_0x2e1d33[_0xab15('0x1a')],'include':_0x2e1d33[_0xab15('0x17')]?_[_0xab15('0x18')](_0x2e1d33[_0xab15('0x17')],function(_0x562073){return{'model':db[_0x562073[_0xab15('0x19')]],'as':_0x562073['as'],'attributes':_0x562073['attributes'],'include':_0x562073[_0xab15('0x17')]?_[_0xab15('0x18')](_0x562073['include'],function(_0x28bcff){return{'model':db[_0x28bcff['model']],'as':_0x28bcff['as'],'attributes':_0x28bcff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2df01c){logger['info'](_0xab15('0x12'),_0x180c1b);logger[_0xab15('0xc')](_0xab15('0x12'),_0x180c1b,JSON['stringify'](_0x2df01c));_0x20dce4(_0x2df01c);})[_0xab15('0x1b')](function(_0x310b52){logger['error'](_0xab15('0x12'),_0x310b52[_0xab15('0x10')],_0x180c1b);_0x415e57(_0x403e31[_0xab15('0xe')](0x1f4,_0x310b52[_0xab15('0x10')]));});});};exports[_0xab15('0x1c')]=function(_0x13b917){var _0x3bade1=this;return new Promise(function(_0x495cc0,_0x1aaa7e){return db[_0xab15('0x1d')]['find']({'raw':_0x13b917[_0xab15('0x14')]?_0x13b917[_0xab15('0x14')][_0xab15('0x15')]===undefined?!![]:![]:!![],'where':_0x13b917[_0xab15('0x14')]?_0x13b917['options']['where']||null:null,'attributes':_0x13b917[_0xab15('0x14')]?_0x13b917[_0xab15('0x14')][_0xab15('0x1a')]||null:null,'include':_0x13b917[_0xab15('0x14')]?_0x13b917[_0xab15('0x14')][_0xab15('0x17')]?_[_0xab15('0x18')](_0x13b917['options']['include'],function(_0x4d04ad){return{'model':db[_0x4d04ad['model']],'as':_0x4d04ad['as'],'attributes':_0x4d04ad[_0xab15('0x1a')],'include':_0x4d04ad[_0xab15('0x17')]?_[_0xab15('0x18')](_0x4d04ad['include'],function(_0x18757e){return{'model':db[_0x18757e[_0xab15('0x19')]],'as':_0x18757e['as'],'attributes':_0x18757e[_0xab15('0x1a')],'include':_0x18757e[_0xab15('0x17')]?_[_0xab15('0x18')](_0x18757e[_0xab15('0x17')],function(_0x53c2dc){return{'model':db[_0x53c2dc[_0xab15('0x19')]],'as':_0x53c2dc['as'],'attributes':_0x53c2dc[_0xab15('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xab15('0x1e')](function(_0x4c75ef){logger[_0xab15('0x11')](_0xab15('0x1c'),_0x13b917);logger[_0xab15('0xc')]('ShowSugarcrmAccount',_0x13b917,JSON['stringify'](_0x4c75ef));_0x495cc0(_0x4c75ef);})[_0xab15('0x1b')](function(_0x188f17){logger[_0xab15('0xe')](_0xab15('0x1c'),_0x188f17[_0xab15('0x10')],_0x13b917);_0x1aaa7e(_0x3bade1['error'](0x1f4,_0x188f17['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 215f428..1a554c5 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 _0xedfe=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x15f26c,_0x520873){var _0x396c66=function(_0x58ce43){while(--_0x58ce43){_0x15f26c['push'](_0x15f26c['shift']());}};_0x396c66(++_0x520873);}(_0xedfe,0x1a9));var _0xeedf=function(_0x799283,_0x331a5e){_0x799283=_0x799283-0x0;var _0x465b2c=_0xedfe[_0x799283];return _0x465b2c;};'use strict';var multer=require(_0xeedf('0x0'));var util=require(_0xeedf('0x1'));var path=require('path');var timeout=require(_0xeedf('0x2'));var express=require(_0xeedf('0x3'));var router=express['Router']();var fs_extra=require(_0xeedf('0x4'));var auth=require(_0xeedf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeedf('0x6'));router[_0xeedf('0x7')]('/',auth[_0xeedf('0x8')](),controller[_0xeedf('0x9')]);router['get'](_0xeedf('0xa'),auth['isAuthenticated'](),controller[_0xeedf('0xb')]);router[_0xeedf('0x7')](_0xeedf('0xc'),auth[_0xeedf('0x8')](),controller[_0xeedf('0xd')]);router[_0xeedf('0x7')](_0xeedf('0xe'),auth[_0xeedf('0x8')](),controller[_0xeedf('0xf')]);router[_0xeedf('0x7')](_0xeedf('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xeedf('0x8')](),controller[_0xeedf('0x11')]);router[_0xeedf('0x12')](_0xeedf('0xa'),auth[_0xeedf('0x8')](),controller[_0xeedf('0x13')]);router[_0xeedf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xeedf('0x15')]);module[_0xeedf('0x16')]=router; \ No newline at end of file +var _0xfffb=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xae66b1,_0x381fd6){var _0x515611=function(_0x2e3678){while(--_0x2e3678){_0xae66b1['push'](_0xae66b1['shift']());}};_0x515611(++_0x381fd6);}(_0xfffb,0xc5));var _0xbfff=function(_0x305fe9,_0x308805){_0x305fe9=_0x305fe9-0x0;var _0x2cfd13=_0xfffb[_0x305fe9];return _0x2cfd13;};'use strict';var multer=require(_0xbfff('0x0'));var util=require(_0xbfff('0x1'));var path=require(_0xbfff('0x2'));var timeout=require(_0xbfff('0x3'));var express=require('express');var router=express[_0xbfff('0x4')]();var fs_extra=require(_0xbfff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbfff('0x6'));var config=require(_0xbfff('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xbfff('0x8')]('/',auth[_0xbfff('0x9')](),controller[_0xbfff('0xa')]);router['get'](_0xbfff('0xb'),auth[_0xbfff('0x9')](),controller[_0xbfff('0xc')]);router[_0xbfff('0x8')](_0xbfff('0xd'),auth[_0xbfff('0x9')](),controller[_0xbfff('0xe')]);router[_0xbfff('0x8')](_0xbfff('0xf'),auth[_0xbfff('0x9')](),controller[_0xbfff('0x10')]);router[_0xbfff('0x8')](_0xbfff('0x11'),auth[_0xbfff('0x9')](),controller[_0xbfff('0x12')]);router['post']('/',auth[_0xbfff('0x9')](),controller[_0xbfff('0x13')]);router[_0xbfff('0x14')](_0xbfff('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xbfff('0xb'),auth[_0xbfff('0x9')](),controller[_0xbfff('0x15')]);module[_0xbfff('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f5a7133..fdbf974 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 _0x808d=['exports','STRING','sequelize'];(function(_0x33e9ea,_0x21bf49){var _0x59e712=function(_0x1f5f76){while(--_0x1f5f76){_0x33e9ea['push'](_0x33e9ea['shift']());}};_0x59e712(++_0x21bf49);}(_0x808d,0x65));var _0xd808=function(_0x5dff6f,_0x214d57){_0x5dff6f=_0x5dff6f-0x0;var _0x492aeb=_0x808d[_0x5dff6f];return _0x492aeb;};'use strict';var Sequelize=require(_0xd808('0x0'));module[_0xd808('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd808('0x2')]}}; \ No newline at end of file +var _0x70b3=['sequelize','STRING'];(function(_0x46cba4,_0x56ea40){var _0x119093=function(_0x550932){while(--_0x550932){_0x46cba4['push'](_0x46cba4['shift']());}};_0x119093(++_0x56ea40);}(_0x70b3,0x1da));var _0x370b=function(_0x26beb,_0x114abb){_0x26beb=_0x26beb-0x0;var _0x1b0694=_0x70b3[_0x26beb];return _0x1b0694;};'use strict';var Sequelize=require(_0x370b('0x0'));module['exports']={'name':{'type':Sequelize[_0x370b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fc37756..f6bd33d 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 _0xc07c=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','set','Content-Range','reject','save','update','then','name','send','SugarcrmConfiguration','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','order','getSubjects','getDescriptions','SugarcrmField','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc07c,0x173));var _0xcc07=function(_0x38b5ad,_0x5aed10){_0x38b5ad=_0x38b5ad-0x0;var _0x2b0c4c=_0xc07c[_0x38b5ad];return _0x2b0c4c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc07('0x0'));var jsonpatch=require(_0xcc07('0x1'));var rp=require(_0xcc07('0x2'));var moment=require('moment');var BPromise=require(_0xcc07('0x3'));var Mustache=require(_0xcc07('0x4'));var util=require(_0xcc07('0x5'));var path=require(_0xcc07('0x6'));var sox=require(_0xcc07('0x7'));var csv=require('to-csv');var ejs=require(_0xcc07('0x8'));var fs=require('fs');var fs_extra=require(_0xcc07('0x9'));var _=require(_0xcc07('0xa'));var squel=require(_0xcc07('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc07('0xc'));var toCsv=require(_0xcc07('0xd'));var querystring=require(_0xcc07('0xe'));var Papa=require(_0xcc07('0xf'));var Redis=require('ioredis');var authService=require(_0xcc07('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcc07('0x11'));var hardwareService=require(_0xcc07('0x12'));var logger=require(_0xcc07('0x13'))(_0xcc07('0x14'));var utils=require(_0xcc07('0x15'));var config=require(_0xcc07('0x16'));var licenseUtil=require(_0xcc07('0x17'));var db=require(_0xcc07('0x18'))['db'];function respondWithStatusCode(_0x52a8f1,_0x1bec44){_0x1bec44=_0x1bec44||0xcc;return function(_0x2a4c1c){if(_0x2a4c1c){return _0x52a8f1[_0xcc07('0x19')](_0x1bec44);}return _0x52a8f1[_0xcc07('0x1a')](_0x1bec44)[_0xcc07('0x1b')]();};}function respondWithResult(_0x5501c3,_0x2f3567){_0x2f3567=_0x2f3567||0xc8;return function(_0x30828a){if(_0x30828a){return _0x5501c3[_0xcc07('0x1a')](_0x2f3567)[_0xcc07('0x1c')](_0x30828a);}};}function respondWithFilteredResult(_0x47e3bb,_0x3ed865){return function(_0x1e9e18){if(_0x1e9e18){var _0x20eadb=typeof _0x3ed865['offset']==='undefined'&&typeof _0x3ed865[_0xcc07('0x1d')]==='undefined';var _0x1123dc=_0x1e9e18['count'];var _0x53aa4c=_0x20eadb?0x0:_0x3ed865['offset'];var _0x34c41c=_0x20eadb?_0x1e9e18['count']:_0x3ed865[_0xcc07('0x1e')]+_0x3ed865[_0xcc07('0x1d')];var _0x28be72;if(_0x34c41c>=_0x1123dc){_0x34c41c=_0x1123dc;_0x28be72=0xc8;}else{_0x28be72=0xce;}_0x47e3bb['status'](_0x28be72);return _0x47e3bb[_0xcc07('0x1f')](_0xcc07('0x20'),_0x53aa4c+'-'+_0x34c41c+'/'+_0x1123dc)[_0xcc07('0x1c')](_0x1e9e18);}return null;};}function patchUpdates(_0x1504c2){return function(_0x4660d5){try{jsonpatch['apply'](_0x4660d5,_0x1504c2,!![]);}catch(_0xdbdfb4){return BPromise[_0xcc07('0x21')](_0xdbdfb4);}return _0x4660d5[_0xcc07('0x22')]();};}function saveUpdates(_0x544f5a,_0x170deb){return function(_0x2e8c53){if(_0x2e8c53){return _0x2e8c53[_0xcc07('0x23')](_0x544f5a)[_0xcc07('0x24')](function(_0x127b11){return _0x127b11;});}return null;};}function removeEntity(_0x51a20d,_0x404bac){return function(_0xa458d2){if(_0xa458d2){return _0xa458d2['destroy']()['then'](function(){_0x51a20d['status'](0xcc)[_0xcc07('0x1b')]();});}};}function handleEntityNotFound(_0x135ead,_0x5958d6){return function(_0x4f8be1){if(!_0x4f8be1){_0x135ead[_0xcc07('0x19')](0x194);}return _0x4f8be1;};}function handleError(_0x1d3d86,_0x5b07e1){_0x5b07e1=_0x5b07e1||0x1f4;return function(_0x3c08ee){logger['error'](_0x3c08ee['stack']);if(_0x3c08ee[_0xcc07('0x25')]){delete _0x3c08ee[_0xcc07('0x25')];}_0x1d3d86[_0xcc07('0x1a')](_0x5b07e1)[_0xcc07('0x26')](_0x3c08ee);};}exports['index']=function(_0x318048,_0x39efc9){var _0x4b4388={},_0x195eab={},_0x4ce6b3={'count':0x0,'rows':[]};var _0xb3534a=_['map'](db[_0xcc07('0x27')]['rawAttributes'],function(_0x461d6c){return{'name':_0x461d6c[_0xcc07('0x28')],'type':_0x461d6c[_0xcc07('0x29')]['key']};});_0x195eab[_0xcc07('0x2a')]=_['map'](_0xb3534a,_0xcc07('0x25'));_0x195eab[_0xcc07('0x2b')]=_['keys'](_0x318048[_0xcc07('0x2b')]);_0x195eab[_0xcc07('0x2c')]=_[_0xcc07('0x2d')](_0x195eab[_0xcc07('0x2a')],_0x195eab[_0xcc07('0x2b')]);_0x4b4388[_0xcc07('0x2e')]=_['intersection'](_0x195eab[_0xcc07('0x2a')],qs[_0xcc07('0x2f')](_0x318048['query'][_0xcc07('0x2f')]));_0x4b4388['attributes']=_0x4b4388['attributes'][_0xcc07('0x30')]?_0x4b4388[_0xcc07('0x2e')]:_0x195eab[_0xcc07('0x2a')];if(!_0x318048[_0xcc07('0x2b')][_0xcc07('0x31')](_0xcc07('0x32'))){_0x4b4388['limit']=qs['limit'](_0x318048[_0xcc07('0x2b')]['limit']);_0x4b4388[_0xcc07('0x1e')]=qs['offset'](_0x318048[_0xcc07('0x2b')][_0xcc07('0x1e')]);}_0x4b4388['order']=qs[_0xcc07('0x33')](_0x318048[_0xcc07('0x2b')]['sort']);_0x4b4388['where']=qs[_0xcc07('0x2c')](_[_0xcc07('0x34')](_0x318048[_0xcc07('0x2b')],_0x195eab['filters']),_0xb3534a);if(_0x318048[_0xcc07('0x2b')][_0xcc07('0x35')]){_0x4b4388[_0xcc07('0x36')]=_[_0xcc07('0x37')](_0x4b4388[_0xcc07('0x36')],{'$or':_[_0xcc07('0x38')](_0xb3534a,function(_0x1f6caf){if(_0x1f6caf[_0xcc07('0x29')]!==_0xcc07('0x39')){var _0x1ecee1={};_0x1ecee1[_0x1f6caf['name']]={'$like':'%'+_0x318048[_0xcc07('0x2b')][_0xcc07('0x35')]+'%'};return _0x1ecee1;}})});}_0x4b4388=_[_0xcc07('0x37')]({},_0x4b4388,_0x318048[_0xcc07('0x3a')]);var _0x23dcc3={'where':_0x4b4388[_0xcc07('0x36')]};return db[_0xcc07('0x27')][_0xcc07('0x3b')](_0x23dcc3)[_0xcc07('0x24')](function(_0x27785f){_0x4ce6b3[_0xcc07('0x3b')]=_0x27785f;if(_0x318048[_0xcc07('0x2b')][_0xcc07('0x3c')]){_0x4b4388[_0xcc07('0x3d')]=[{'all':!![]}];}return db[_0xcc07('0x27')][_0xcc07('0x3e')](_0x4b4388);})[_0xcc07('0x24')](function(_0x236c94){_0x4ce6b3['rows']=_0x236c94;return _0x4ce6b3;})[_0xcc07('0x24')](respondWithFilteredResult(_0x39efc9,_0x4b4388))[_0xcc07('0x3f')](handleError(_0x39efc9,null));};exports[_0xcc07('0x40')]=function(_0x44097e,_0x12db5b){var _0x287730={'raw':![],'where':{'id':_0x44097e[_0xcc07('0x41')]['id']}},_0x4f4bb1={};_0x4f4bb1[_0xcc07('0x2a')]=_[_0xcc07('0x42')](db[_0xcc07('0x27')][_0xcc07('0x43')]);_0x4f4bb1['query']=_[_0xcc07('0x42')](_0x44097e[_0xcc07('0x2b')]);_0x4f4bb1['filters']=_['intersection'](_0x4f4bb1['model'],_0x4f4bb1[_0xcc07('0x2b')]);_0x287730['attributes']=_[_0xcc07('0x2d')](_0x4f4bb1[_0xcc07('0x2a')],qs[_0xcc07('0x2f')](_0x44097e[_0xcc07('0x2b')][_0xcc07('0x2f')]));_0x287730[_0xcc07('0x2e')]=_0x287730[_0xcc07('0x2e')][_0xcc07('0x30')]?_0x287730[_0xcc07('0x2e')]:_0x4f4bb1[_0xcc07('0x2a')];if(_0x44097e[_0xcc07('0x2b')][_0xcc07('0x3c')]){_0x287730['include']=[{'all':!![]}];}_0x287730=_[_0xcc07('0x37')]({},_0x287730,_0x44097e[_0xcc07('0x3a')]);return db['SugarcrmConfiguration'][_0xcc07('0x44')](_0x287730)[_0xcc07('0x24')](handleEntityNotFound(_0x12db5b,null))[_0xcc07('0x24')](respondWithResult(_0x12db5b,null))[_0xcc07('0x3f')](handleError(_0x12db5b,null));};exports[_0xcc07('0x45')]=function(_0x53e6b0,_0x567b71){return db[_0xcc07('0x27')][_0xcc07('0x45')](_0x53e6b0['body'],{})[_0xcc07('0x24')](respondWithResult(_0x567b71,0xc9))[_0xcc07('0x3f')](handleError(_0x567b71,null));};exports['update']=function(_0x3459a4,_0x198a92){if(_0x3459a4['body']['id']){delete _0x3459a4[_0xcc07('0x46')]['id'];}return db[_0xcc07('0x27')][_0xcc07('0x44')]({'where':{'id':_0x3459a4[_0xcc07('0x41')]['id']}})[_0xcc07('0x24')](handleEntityNotFound(_0x198a92,null))[_0xcc07('0x24')](saveUpdates(_0x3459a4['body'],null))['then'](respondWithResult(_0x198a92,null))[_0xcc07('0x3f')](handleError(_0x198a92,null));};exports[_0xcc07('0x47')]=function(_0x5e7901,_0x519f52){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5e7901[_0xcc07('0x41')]['id']}})[_0xcc07('0x24')](handleEntityNotFound(_0x519f52,null))['then'](removeEntity(_0x519f52,null))[_0xcc07('0x3f')](handleError(_0x519f52,null));};exports[_0xcc07('0x48')]=function(_0xa6d905,_0x12c514,_0x3f814a){var _0x3bf2fc={};var _0x30013c={};var _0x2e99d1;var _0x10a66e;return db['SugarcrmConfiguration'][_0xcc07('0x49')]({'where':{'id':_0xa6d905[_0xcc07('0x41')]['id']}})[_0xcc07('0x24')](handleEntityNotFound(_0x12c514,null))['then'](function(_0x2e3409){if(_0x2e3409){_0x2e99d1=_0x2e3409;_0x30013c[_0xcc07('0x2a')]=_['keys'](db['SugarcrmField'][_0xcc07('0x43')]);_0x30013c[_0xcc07('0x2b')]=_[_0xcc07('0x42')](_0xa6d905[_0xcc07('0x2b')]);_0x30013c[_0xcc07('0x2c')]=_[_0xcc07('0x2d')](_0x30013c['model'],_0x30013c[_0xcc07('0x2b')]);_0x3bf2fc[_0xcc07('0x2e')]=_[_0xcc07('0x2d')](_0x30013c[_0xcc07('0x2a')],qs[_0xcc07('0x2f')](_0xa6d905['query'][_0xcc07('0x2f')]));_0x3bf2fc[_0xcc07('0x2e')]=_0x3bf2fc[_0xcc07('0x2e')][_0xcc07('0x30')]?_0x3bf2fc['attributes']:_0x30013c['model'];_0x3bf2fc[_0xcc07('0x4a')]=qs[_0xcc07('0x33')](_0xa6d905[_0xcc07('0x2b')][_0xcc07('0x33')]);_0x3bf2fc[_0xcc07('0x36')]=qs['filters'](_[_0xcc07('0x34')](_0xa6d905[_0xcc07('0x2b')],_0x30013c[_0xcc07('0x2c')]));if(_0xa6d905[_0xcc07('0x2b')][_0xcc07('0x35')]){_0x3bf2fc[_0xcc07('0x36')]=_[_0xcc07('0x37')](_0x3bf2fc['where'],{'$or':_[_0xcc07('0x38')](_0x3bf2fc[_0xcc07('0x2e')],function(_0x4742f7){var _0x58c2f0={};_0x58c2f0[_0x4742f7]={'$like':'%'+_0xa6d905[_0xcc07('0x2b')][_0xcc07('0x35')]+'%'};return _0x58c2f0;})});}_0x3bf2fc=_[_0xcc07('0x37')]({},_0x3bf2fc,_0xa6d905[_0xcc07('0x3a')]);return _0x2e99d1[_0xcc07('0x48')](_0x3bf2fc);}})[_0xcc07('0x24')](function(_0x4d958c){if(_0x4d958c){_0x10a66e=_0x4d958c[_0xcc07('0x30')];if(!_0xa6d905[_0xcc07('0x2b')]['hasOwnProperty'](_0xcc07('0x32'))){_0x3bf2fc[_0xcc07('0x1d')]=qs[_0xcc07('0x1d')](_0xa6d905[_0xcc07('0x2b')][_0xcc07('0x1d')]);_0x3bf2fc[_0xcc07('0x1e')]=qs[_0xcc07('0x1e')](_0xa6d905[_0xcc07('0x2b')][_0xcc07('0x1e')]);}return _0x2e99d1['getFields'](_0x3bf2fc);}})[_0xcc07('0x24')](function(_0xa77bbf){if(_0xa77bbf){return _0xa77bbf?{'count':_0x10a66e,'rows':_0xa77bbf}:null;}})[_0xcc07('0x24')](respondWithResult(_0x12c514,null))['catch'](handleError(_0x12c514,null));};exports[_0xcc07('0x4b')]=function(_0x58090c,_0x386698,_0x57898a){var _0x58c724={};var _0x10686a={};var _0x279f32;var _0x15e847;return db[_0xcc07('0x27')][_0xcc07('0x49')]({'where':{'id':_0x58090c[_0xcc07('0x41')]['id']}})[_0xcc07('0x24')](handleEntityNotFound(_0x386698,null))[_0xcc07('0x24')](function(_0x3dd6d4){if(_0x3dd6d4){_0x279f32=_0x3dd6d4;_0x10686a[_0xcc07('0x2a')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x10686a[_0xcc07('0x2b')]=_[_0xcc07('0x42')](_0x58090c[_0xcc07('0x2b')]);_0x10686a[_0xcc07('0x2c')]=_[_0xcc07('0x2d')](_0x10686a[_0xcc07('0x2a')],_0x10686a[_0xcc07('0x2b')]);_0x58c724[_0xcc07('0x2e')]=_[_0xcc07('0x2d')](_0x10686a[_0xcc07('0x2a')],qs[_0xcc07('0x2f')](_0x58090c['query'][_0xcc07('0x2f')]));_0x58c724[_0xcc07('0x2e')]=_0x58c724[_0xcc07('0x2e')]['length']?_0x58c724[_0xcc07('0x2e')]:_0x10686a[_0xcc07('0x2a')];_0x58c724[_0xcc07('0x4a')]=qs[_0xcc07('0x33')](_0x58090c[_0xcc07('0x2b')][_0xcc07('0x33')]);_0x58c724[_0xcc07('0x36')]=qs['filters'](_['pick'](_0x58090c['query'],_0x10686a['filters']));if(_0x58090c['query'][_0xcc07('0x35')]){_0x58c724[_0xcc07('0x36')]=_[_0xcc07('0x37')](_0x58c724[_0xcc07('0x36')],{'$or':_[_0xcc07('0x38')](_0x58c724['attributes'],function(_0x4dab04){var _0x697cca={};_0x697cca[_0x4dab04]={'$like':'%'+_0x58090c[_0xcc07('0x2b')]['filter']+'%'};return _0x697cca;})});}_0x58c724=_[_0xcc07('0x37')]({},_0x58c724,_0x58090c[_0xcc07('0x3a')]);return _0x279f32[_0xcc07('0x4b')](_0x58c724);}})[_0xcc07('0x24')](function(_0x36aeee){if(_0x36aeee){_0x15e847=_0x36aeee[_0xcc07('0x30')];if(!_0x58090c[_0xcc07('0x2b')][_0xcc07('0x31')](_0xcc07('0x32'))){_0x58c724[_0xcc07('0x1d')]=qs[_0xcc07('0x1d')](_0x58090c[_0xcc07('0x2b')][_0xcc07('0x1d')]);_0x58c724[_0xcc07('0x1e')]=qs['offset'](_0x58090c[_0xcc07('0x2b')][_0xcc07('0x1e')]);}return _0x279f32['getSubjects'](_0x58c724);}})[_0xcc07('0x24')](function(_0x860588){if(_0x860588){return _0x860588?{'count':_0x15e847,'rows':_0x860588}:null;}})[_0xcc07('0x24')](respondWithResult(_0x386698,null))[_0xcc07('0x3f')](handleError(_0x386698,null));};exports[_0xcc07('0x4c')]=function(_0xfd4a1b,_0x364037,_0x20da97){var _0x554418={};var _0x3b5874={};var _0x32ce7d;var _0xce0a83;return db[_0xcc07('0x27')]['findOne']({'where':{'id':_0xfd4a1b['params']['id']}})['then'](handleEntityNotFound(_0x364037,null))[_0xcc07('0x24')](function(_0x2ad119){if(_0x2ad119){_0x32ce7d=_0x2ad119;_0x3b5874[_0xcc07('0x2a')]=_[_0xcc07('0x42')](db[_0xcc07('0x4d')]['rawAttributes']);_0x3b5874[_0xcc07('0x2b')]=_[_0xcc07('0x42')](_0xfd4a1b[_0xcc07('0x2b')]);_0x3b5874['filters']=_[_0xcc07('0x2d')](_0x3b5874['model'],_0x3b5874[_0xcc07('0x2b')]);_0x554418[_0xcc07('0x2e')]=_['intersection'](_0x3b5874[_0xcc07('0x2a')],qs['fields'](_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x2f')]));_0x554418[_0xcc07('0x2e')]=_0x554418[_0xcc07('0x2e')][_0xcc07('0x30')]?_0x554418[_0xcc07('0x2e')]:_0x3b5874[_0xcc07('0x2a')];_0x554418[_0xcc07('0x4a')]=qs[_0xcc07('0x33')](_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x33')]);_0x554418[_0xcc07('0x36')]=qs[_0xcc07('0x2c')](_['pick'](_0xfd4a1b[_0xcc07('0x2b')],_0x3b5874['filters']));if(_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x35')]){_0x554418[_0xcc07('0x36')]=_[_0xcc07('0x37')](_0x554418[_0xcc07('0x36')],{'$or':_[_0xcc07('0x38')](_0x554418[_0xcc07('0x2e')],function(_0x555629){var _0x310619={};_0x310619[_0x555629]={'$like':'%'+_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x35')]+'%'};return _0x310619;})});}_0x554418=_[_0xcc07('0x37')]({},_0x554418,_0xfd4a1b[_0xcc07('0x3a')]);return _0x32ce7d[_0xcc07('0x4c')](_0x554418);}})[_0xcc07('0x24')](function(_0x212d4a){if(_0x212d4a){_0xce0a83=_0x212d4a[_0xcc07('0x30')];if(!_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x31')](_0xcc07('0x32'))){_0x554418[_0xcc07('0x1d')]=qs[_0xcc07('0x1d')](_0xfd4a1b[_0xcc07('0x2b')]['limit']);_0x554418[_0xcc07('0x1e')]=qs[_0xcc07('0x1e')](_0xfd4a1b[_0xcc07('0x2b')][_0xcc07('0x1e')]);}return _0x32ce7d[_0xcc07('0x4c')](_0x554418);}})[_0xcc07('0x24')](function(_0x22fa65){if(_0x22fa65){return _0x22fa65?{'count':_0xce0a83,'rows':_0x22fa65}:null;}})[_0xcc07('0x24')](respondWithResult(_0x364037,null))['catch'](handleError(_0x364037,null));}; \ No newline at end of file +var _0xd50c=['include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll'];(function(_0x190a27,_0x5c4787){var _0x3e1e42=function(_0x7e2517){while(--_0x7e2517){_0x190a27['push'](_0x190a27['shift']());}};_0x3e1e42(++_0x5c4787);}(_0xd50c,0xb1));var _0xcd50=function(_0x396d39,_0x3c21e3){_0x396d39=_0x396d39-0x0;var _0xe950ba=_0xd50c[_0x396d39];return _0xe950ba;};'use strict';var emlformat=require(_0xcd50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd50('0x1'));var jsonpatch=require(_0xcd50('0x2'));var rp=require(_0xcd50('0x3'));var moment=require(_0xcd50('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd50('0x5'));var path=require(_0xcd50('0x6'));var sox=require('sox');var csv=require(_0xcd50('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd50('0x8'));var _=require(_0xcd50('0x9'));var squel=require(_0xcd50('0xa'));var crypto=require('crypto');var jsforce=require(_0xcd50('0xb'));var deskjs=require(_0xcd50('0xc'));var toCsv=require(_0xcd50('0x7'));var querystring=require(_0xcd50('0xd'));var Papa=require(_0xcd50('0xe'));var Redis=require('ioredis');var authService=require(_0xcd50('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcd50('0x10'));var hardwareService=require(_0xcd50('0x11'));var logger=require('../../config/logger')(_0xcd50('0x12'));var utils=require(_0xcd50('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcd50('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d7dc,_0x45de12){_0x45de12=_0x45de12||0xcc;return function(_0x4d9246){if(_0x4d9246){return _0x19d7dc[_0xcd50('0x15')](_0x45de12);}return _0x19d7dc['status'](_0x45de12)['end']();};}function respondWithResult(_0x48c3e2,_0x121791){_0x121791=_0x121791||0xc8;return function(_0x1a57f5){if(_0x1a57f5){return _0x48c3e2[_0xcd50('0x16')](_0x121791)[_0xcd50('0x17')](_0x1a57f5);}};}function respondWithFilteredResult(_0x14c61a,_0x258a58){return function(_0xb7359){if(_0xb7359){var _0x5f4bda=typeof _0x258a58['offset']===_0xcd50('0x18')&&typeof _0x258a58[_0xcd50('0x19')]===_0xcd50('0x18');var _0x446c9d=_0xb7359[_0xcd50('0x1a')];var _0x81ee56=_0x5f4bda?0x0:_0x258a58['offset'];var _0x10afb5=_0x5f4bda?_0xb7359[_0xcd50('0x1a')]:_0x258a58[_0xcd50('0x1b')]+_0x258a58['limit'];var _0x50139c;if(_0x10afb5>=_0x446c9d){_0x10afb5=_0x446c9d;_0x50139c=0xc8;}else{_0x50139c=0xce;}_0x14c61a[_0xcd50('0x16')](_0x50139c);return _0x14c61a[_0xcd50('0x1c')](_0xcd50('0x1d'),_0x81ee56+'-'+_0x10afb5+'/'+_0x446c9d)['json'](_0xb7359);}return null;};}function patchUpdates(_0x3cf1fc){return function(_0x3f53e9){try{jsonpatch[_0xcd50('0x1e')](_0x3f53e9,_0x3cf1fc,!![]);}catch(_0x124b9d){return BPromise[_0xcd50('0x1f')](_0x124b9d);}return _0x3f53e9[_0xcd50('0x20')]();};}function saveUpdates(_0x4473f1,_0x372d2b){return function(_0x20dea1){if(_0x20dea1){return _0x20dea1[_0xcd50('0x21')](_0x4473f1)[_0xcd50('0x22')](function(_0x3f2b38){return _0x3f2b38;});}return null;};}function removeEntity(_0x895f8f,_0x237088){return function(_0x4f9c00){if(_0x4f9c00){return _0x4f9c00[_0xcd50('0x23')]()[_0xcd50('0x22')](function(){_0x895f8f[_0xcd50('0x16')](0xcc)[_0xcd50('0x24')]();});}};}function handleEntityNotFound(_0x1755be,_0x3cd087){return function(_0x6ee165){if(!_0x6ee165){_0x1755be['sendStatus'](0x194);}return _0x6ee165;};}function handleError(_0x10d94d,_0xf91f8c){_0xf91f8c=_0xf91f8c||0x1f4;return function(_0x4ab4a4){logger[_0xcd50('0x25')](_0x4ab4a4[_0xcd50('0x26')]);if(_0x4ab4a4['name']){delete _0x4ab4a4[_0xcd50('0x27')];}_0x10d94d[_0xcd50('0x16')](_0xf91f8c)[_0xcd50('0x28')](_0x4ab4a4);};}exports[_0xcd50('0x29')]=function(_0x17e9c4,_0x3177f9){var _0x56faa5={},_0x3748de={},_0x505dbe={'count':0x0,'rows':[]};var _0x81bddb=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x4e0425){return{'name':_0x4e0425[_0xcd50('0x2a')],'type':_0x4e0425[_0xcd50('0x2b')][_0xcd50('0x2c')]};});_0x3748de[_0xcd50('0x2d')]=_[_0xcd50('0x2e')](_0x81bddb,_0xcd50('0x27'));_0x3748de['query']=_[_0xcd50('0x2f')](_0x17e9c4[_0xcd50('0x30')]);_0x3748de['filters']=_[_0xcd50('0x31')](_0x3748de[_0xcd50('0x2d')],_0x3748de[_0xcd50('0x30')]);_0x56faa5[_0xcd50('0x32')]=_[_0xcd50('0x31')](_0x3748de['model'],qs[_0xcd50('0x33')](_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x33')]));_0x56faa5[_0xcd50('0x32')]=_0x56faa5[_0xcd50('0x32')][_0xcd50('0x34')]?_0x56faa5['attributes']:_0x3748de[_0xcd50('0x2d')];if(!_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x35')](_0xcd50('0x36'))){_0x56faa5['limit']=qs[_0xcd50('0x19')](_0x17e9c4['query']['limit']);_0x56faa5[_0xcd50('0x1b')]=qs[_0xcd50('0x1b')](_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x1b')]);}_0x56faa5[_0xcd50('0x37')]=qs['sort'](_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x38')]);_0x56faa5[_0xcd50('0x39')]=qs['filters'](_[_0xcd50('0x3a')](_0x17e9c4[_0xcd50('0x30')],_0x3748de[_0xcd50('0x3b')]),_0x81bddb);if(_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x3c')]){_0x56faa5[_0xcd50('0x39')]=_[_0xcd50('0x3d')](_0x56faa5[_0xcd50('0x39')],{'$or':_['map'](_0x81bddb,function(_0x1cafea){if(_0x1cafea['type']!==_0xcd50('0x3e')){var _0x3f61e7={};_0x3f61e7[_0x1cafea[_0xcd50('0x27')]]={'$like':'%'+_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x3c')]+'%'};return _0x3f61e7;}})});}_0x56faa5=_[_0xcd50('0x3d')]({},_0x56faa5,_0x17e9c4[_0xcd50('0x3f')]);var _0x85e2f6={'where':_0x56faa5['where']};return db[_0xcd50('0x40')][_0xcd50('0x1a')](_0x85e2f6)[_0xcd50('0x22')](function(_0x2afb98){_0x505dbe[_0xcd50('0x1a')]=_0x2afb98;if(_0x17e9c4[_0xcd50('0x30')][_0xcd50('0x41')]){_0x56faa5[_0xcd50('0x42')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xcd50('0x43')](_0x56faa5);})[_0xcd50('0x22')](function(_0x571cb0){_0x505dbe[_0xcd50('0x44')]=_0x571cb0;return _0x505dbe;})[_0xcd50('0x22')](respondWithFilteredResult(_0x3177f9,_0x56faa5))[_0xcd50('0x45')](handleError(_0x3177f9,null));};exports[_0xcd50('0x46')]=function(_0x5b4749,_0x56c2f4){var _0x1e8dc7={'raw':![],'where':{'id':_0x5b4749[_0xcd50('0x47')]['id']}},_0x2c0c6f={};_0x2c0c6f[_0xcd50('0x2d')]=_['keys'](db[_0xcd50('0x40')][_0xcd50('0x48')]);_0x2c0c6f[_0xcd50('0x30')]=_['keys'](_0x5b4749['query']);_0x2c0c6f[_0xcd50('0x3b')]=_[_0xcd50('0x31')](_0x2c0c6f[_0xcd50('0x2d')],_0x2c0c6f['query']);_0x1e8dc7[_0xcd50('0x32')]=_['intersection'](_0x2c0c6f['model'],qs[_0xcd50('0x33')](_0x5b4749[_0xcd50('0x30')][_0xcd50('0x33')]));_0x1e8dc7[_0xcd50('0x32')]=_0x1e8dc7[_0xcd50('0x32')][_0xcd50('0x34')]?_0x1e8dc7[_0xcd50('0x32')]:_0x2c0c6f[_0xcd50('0x2d')];if(_0x5b4749[_0xcd50('0x30')][_0xcd50('0x41')]){_0x1e8dc7['include']=[{'all':!![]}];}_0x1e8dc7=_[_0xcd50('0x3d')]({},_0x1e8dc7,_0x5b4749[_0xcd50('0x3f')]);return db[_0xcd50('0x40')]['find'](_0x1e8dc7)[_0xcd50('0x22')](handleEntityNotFound(_0x56c2f4,null))[_0xcd50('0x22')](respondWithResult(_0x56c2f4,null))[_0xcd50('0x45')](handleError(_0x56c2f4,null));};exports[_0xcd50('0x49')]=function(_0x519654,_0x281ffe){return db[_0xcd50('0x40')][_0xcd50('0x49')](_0x519654[_0xcd50('0x4a')],{})['then'](respondWithResult(_0x281ffe,0xc9))[_0xcd50('0x45')](handleError(_0x281ffe,null));};exports[_0xcd50('0x21')]=function(_0x1acd3e,_0x41c70e){if(_0x1acd3e[_0xcd50('0x4a')]['id']){delete _0x1acd3e['body']['id'];}return db[_0xcd50('0x40')]['find']({'where':{'id':_0x1acd3e[_0xcd50('0x47')]['id']}})['then'](handleEntityNotFound(_0x41c70e,null))[_0xcd50('0x22')](saveUpdates(_0x1acd3e[_0xcd50('0x4a')],null))['then'](respondWithResult(_0x41c70e,null))[_0xcd50('0x45')](handleError(_0x41c70e,null));};exports['destroy']=function(_0x5769f5,_0x65f416){return db[_0xcd50('0x40')][_0xcd50('0x4b')]({'where':{'id':_0x5769f5[_0xcd50('0x47')]['id']}})[_0xcd50('0x22')](handleEntityNotFound(_0x65f416,null))['then'](removeEntity(_0x65f416,null))[_0xcd50('0x45')](handleError(_0x65f416,null));};exports[_0xcd50('0x4c')]=function(_0x327a8b,_0x585b5a,_0x245cc6){var _0x3a32a5={};var _0x405b38={};var _0x529809;var _0x34e3d8;return db[_0xcd50('0x40')][_0xcd50('0x4d')]({'where':{'id':_0x327a8b['params']['id']}})[_0xcd50('0x22')](handleEntityNotFound(_0x585b5a,null))['then'](function(_0x8ba9c6){if(_0x8ba9c6){_0x529809=_0x8ba9c6;_0x405b38[_0xcd50('0x2d')]=_['keys'](db['SugarcrmField'][_0xcd50('0x48')]);_0x405b38[_0xcd50('0x30')]=_[_0xcd50('0x2f')](_0x327a8b['query']);_0x405b38[_0xcd50('0x3b')]=_['intersection'](_0x405b38[_0xcd50('0x2d')],_0x405b38['query']);_0x3a32a5[_0xcd50('0x32')]=_['intersection'](_0x405b38[_0xcd50('0x2d')],qs[_0xcd50('0x33')](_0x327a8b[_0xcd50('0x30')][_0xcd50('0x33')]));_0x3a32a5['attributes']=_0x3a32a5[_0xcd50('0x32')][_0xcd50('0x34')]?_0x3a32a5['attributes']:_0x405b38['model'];_0x3a32a5['order']=qs[_0xcd50('0x38')](_0x327a8b[_0xcd50('0x30')]['sort']);_0x3a32a5[_0xcd50('0x39')]=qs[_0xcd50('0x3b')](_[_0xcd50('0x3a')](_0x327a8b[_0xcd50('0x30')],_0x405b38['filters']));if(_0x327a8b['query'][_0xcd50('0x3c')]){_0x3a32a5[_0xcd50('0x39')]=_[_0xcd50('0x3d')](_0x3a32a5[_0xcd50('0x39')],{'$or':_[_0xcd50('0x2e')](_0x3a32a5['attributes'],function(_0x1e60f2){var _0x1bf782={};_0x1bf782[_0x1e60f2]={'$like':'%'+_0x327a8b[_0xcd50('0x30')]['filter']+'%'};return _0x1bf782;})});}_0x3a32a5=_[_0xcd50('0x3d')]({},_0x3a32a5,_0x327a8b[_0xcd50('0x3f')]);return _0x529809[_0xcd50('0x4c')](_0x3a32a5);}})['then'](function(_0x5d0faa){if(_0x5d0faa){_0x34e3d8=_0x5d0faa[_0xcd50('0x34')];if(!_0x327a8b['query'][_0xcd50('0x35')](_0xcd50('0x36'))){_0x3a32a5[_0xcd50('0x19')]=qs[_0xcd50('0x19')](_0x327a8b['query'][_0xcd50('0x19')]);_0x3a32a5[_0xcd50('0x1b')]=qs[_0xcd50('0x1b')](_0x327a8b[_0xcd50('0x30')][_0xcd50('0x1b')]);}return _0x529809[_0xcd50('0x4c')](_0x3a32a5);}})['then'](function(_0x487796){if(_0x487796){return _0x487796?{'count':_0x34e3d8,'rows':_0x487796}:null;}})['then'](respondWithResult(_0x585b5a,null))[_0xcd50('0x45')](handleError(_0x585b5a,null));};exports[_0xcd50('0x4e')]=function(_0x6e0cb7,_0xa6bcd8,_0x416c01){var _0x1acbce={};var _0xde369e={};var _0x3a4de7;var _0x22f5da;return db[_0xcd50('0x40')][_0xcd50('0x4d')]({'where':{'id':_0x6e0cb7['params']['id']}})[_0xcd50('0x22')](handleEntityNotFound(_0xa6bcd8,null))['then'](function(_0x4d5fab){if(_0x4d5fab){_0x3a4de7=_0x4d5fab;_0xde369e[_0xcd50('0x2d')]=_[_0xcd50('0x2f')](db[_0xcd50('0x4f')][_0xcd50('0x48')]);_0xde369e[_0xcd50('0x30')]=_['keys'](_0x6e0cb7['query']);_0xde369e['filters']=_['intersection'](_0xde369e[_0xcd50('0x2d')],_0xde369e[_0xcd50('0x30')]);_0x1acbce[_0xcd50('0x32')]=_['intersection'](_0xde369e[_0xcd50('0x2d')],qs['fields'](_0x6e0cb7[_0xcd50('0x30')][_0xcd50('0x33')]));_0x1acbce[_0xcd50('0x32')]=_0x1acbce['attributes'][_0xcd50('0x34')]?_0x1acbce[_0xcd50('0x32')]:_0xde369e[_0xcd50('0x2d')];_0x1acbce[_0xcd50('0x37')]=qs[_0xcd50('0x38')](_0x6e0cb7['query']['sort']);_0x1acbce[_0xcd50('0x39')]=qs['filters'](_['pick'](_0x6e0cb7[_0xcd50('0x30')],_0xde369e['filters']));if(_0x6e0cb7[_0xcd50('0x30')][_0xcd50('0x3c')]){_0x1acbce['where']=_[_0xcd50('0x3d')](_0x1acbce[_0xcd50('0x39')],{'$or':_[_0xcd50('0x2e')](_0x1acbce['attributes'],function(_0x158e77){var _0x52476d={};_0x52476d[_0x158e77]={'$like':'%'+_0x6e0cb7[_0xcd50('0x30')][_0xcd50('0x3c')]+'%'};return _0x52476d;})});}_0x1acbce=_[_0xcd50('0x3d')]({},_0x1acbce,_0x6e0cb7[_0xcd50('0x3f')]);return _0x3a4de7[_0xcd50('0x4e')](_0x1acbce);}})[_0xcd50('0x22')](function(_0x4e1fae){if(_0x4e1fae){_0x22f5da=_0x4e1fae[_0xcd50('0x34')];if(!_0x6e0cb7['query']['hasOwnProperty'](_0xcd50('0x36'))){_0x1acbce['limit']=qs['limit'](_0x6e0cb7[_0xcd50('0x30')][_0xcd50('0x19')]);_0x1acbce[_0xcd50('0x1b')]=qs[_0xcd50('0x1b')](_0x6e0cb7[_0xcd50('0x30')][_0xcd50('0x1b')]);}return _0x3a4de7[_0xcd50('0x4e')](_0x1acbce);}})[_0xcd50('0x22')](function(_0x30118b){if(_0x30118b){return _0x30118b?{'count':_0x22f5da,'rows':_0x30118b}:null;}})[_0xcd50('0x22')](respondWithResult(_0xa6bcd8,null))[_0xcd50('0x45')](handleError(_0xa6bcd8,null));};exports[_0xcd50('0x50')]=function(_0x4bcece,_0x506529,_0x4fce2f){var _0x2ff2c5={};var _0x1505df={};var _0x37f529;var _0x23233a;return db[_0xcd50('0x40')][_0xcd50('0x4d')]({'where':{'id':_0x4bcece[_0xcd50('0x47')]['id']}})[_0xcd50('0x22')](handleEntityNotFound(_0x506529,null))[_0xcd50('0x22')](function(_0x131655){if(_0x131655){_0x37f529=_0x131655;_0x1505df[_0xcd50('0x2d')]=_[_0xcd50('0x2f')](db[_0xcd50('0x4f')][_0xcd50('0x48')]);_0x1505df['query']=_['keys'](_0x4bcece[_0xcd50('0x30')]);_0x1505df[_0xcd50('0x3b')]=_[_0xcd50('0x31')](_0x1505df['model'],_0x1505df[_0xcd50('0x30')]);_0x2ff2c5[_0xcd50('0x32')]=_[_0xcd50('0x31')](_0x1505df[_0xcd50('0x2d')],qs[_0xcd50('0x33')](_0x4bcece[_0xcd50('0x30')][_0xcd50('0x33')]));_0x2ff2c5[_0xcd50('0x32')]=_0x2ff2c5[_0xcd50('0x32')][_0xcd50('0x34')]?_0x2ff2c5['attributes']:_0x1505df[_0xcd50('0x2d')];_0x2ff2c5[_0xcd50('0x37')]=qs[_0xcd50('0x38')](_0x4bcece['query'][_0xcd50('0x38')]);_0x2ff2c5[_0xcd50('0x39')]=qs['filters'](_[_0xcd50('0x3a')](_0x4bcece[_0xcd50('0x30')],_0x1505df[_0xcd50('0x3b')]));if(_0x4bcece[_0xcd50('0x30')][_0xcd50('0x3c')]){_0x2ff2c5['where']=_[_0xcd50('0x3d')](_0x2ff2c5['where'],{'$or':_[_0xcd50('0x2e')](_0x2ff2c5[_0xcd50('0x32')],function(_0x39f180){var _0x3f0b8f={};_0x3f0b8f[_0x39f180]={'$like':'%'+_0x4bcece[_0xcd50('0x30')][_0xcd50('0x3c')]+'%'};return _0x3f0b8f;})});}_0x2ff2c5=_[_0xcd50('0x3d')]({},_0x2ff2c5,_0x4bcece[_0xcd50('0x3f')]);return _0x37f529['getDescriptions'](_0x2ff2c5);}})[_0xcd50('0x22')](function(_0x2b8bce){if(_0x2b8bce){_0x23233a=_0x2b8bce[_0xcd50('0x34')];if(!_0x4bcece[_0xcd50('0x30')]['hasOwnProperty']('nolimit')){_0x2ff2c5['limit']=qs[_0xcd50('0x19')](_0x4bcece[_0xcd50('0x30')][_0xcd50('0x19')]);_0x2ff2c5['offset']=qs['offset'](_0x4bcece[_0xcd50('0x30')]['offset']);}return _0x37f529[_0xcd50('0x50')](_0x2ff2c5);}})['then'](function(_0x3be5b8){if(_0x3be5b8){return _0x3be5b8?{'count':_0x23233a,'rows':_0x3be5b8}:null;}})['then'](respondWithResult(_0x506529,null))['catch'](handleError(_0x506529,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 09a3c1a..b3eefb8 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 _0x02cf=['bluebird','request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x02cf,0x1aa));var _0xf02c=function(_0x707646,_0x2d38e2){_0x707646=_0x707646-0x0;var _0x3e8113=_0x02cf[_0x707646];return _0x3e8113;};'use strict';var _=require(_0xf02c('0x0'));var util=require('util');var logger=require(_0xf02c('0x1'))('api');var moment=require(_0xf02c('0x2'));var BPromise=require(_0xf02c('0x3'));var rp=require(_0xf02c('0x4'));var fs=require('fs');var path=require(_0xf02c('0x5'));var rimraf=require(_0xf02c('0x6'));var config=require(_0xf02c('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x5eec3a,_0x60e245){return _0x5eec3a[_0xf02c('0x8')](_0xf02c('0x9'),attributes,{'tableName':_0xf02c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8c9=['./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e2272,_0x2e1ae0){var _0x45511c=function(_0x285414){while(--_0x285414){_0x4e2272['push'](_0x4e2272['shift']());}};_0x45511c(++_0x2e1ae0);}(_0xd8c9,0x1d2));var _0x9d8c=function(_0x5bed24,_0x3bd05b){_0x5bed24=_0x5bed24-0x0;var _0x3d3865=_0xd8c9[_0x5bed24];return _0x3d3865;};'use strict';var _=require(_0x9d8c('0x0'));var util=require('util');var logger=require(_0x9d8c('0x1'))(_0x9d8c('0x2'));var moment=require(_0x9d8c('0x3'));var BPromise=require(_0x9d8c('0x4'));var rp=require(_0x9d8c('0x5'));var fs=require('fs');var path=require(_0x9d8c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d8c('0x7'));module[_0x9d8c('0x8')]=function(_0x398435,_0x463477){return _0x398435[_0x9d8c('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x9d8c('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 3529ca5..f3aee49 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 _0xea81=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xea81,0x1f1));var _0x1ea8=function(_0x4caccc,_0x37eea9){_0x4caccc=_0x4caccc-0x0;var _0x4ed9cf=_0xea81[_0x4caccc];return _0x4ed9cf;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var moment=require('moment');var BPromise=require(_0x1ea8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ea8('0x3'));var logger=require(_0x1ea8('0x4'))(_0x1ea8('0x5'));var config=require(_0x1ea8('0x6'));var jayson=require(_0x1ea8('0x7'));var client=jayson[_0x1ea8('0x8')][_0x1ea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bfa7a,_0xb1d63f,_0x5755e9){return new BPromise(function(_0x58e216,_0x37f5c9){return client[_0x1ea8('0xa')](_0x2bfa7a,_0x5755e9)[_0x1ea8('0xb')](function(_0x461f34){logger[_0x1ea8('0xc')](_0x1ea8('0xd'),_0xb1d63f,_0x1ea8('0xe'));logger[_0x1ea8('0xf')](_0x1ea8('0x10'),_0xb1d63f,'request\x20sent',JSON[_0x1ea8('0x11')](_0x461f34));if(_0x461f34[_0x1ea8('0x12')]){if(_0x461f34['error'][_0x1ea8('0x13')]===0x1f4){logger[_0x1ea8('0x12')](_0x1ea8('0xd'),_0xb1d63f,_0x461f34[_0x1ea8('0x12')]['message']);return _0x37f5c9(_0x461f34[_0x1ea8('0x12')]['message']);}logger[_0x1ea8('0x12')](_0x1ea8('0xd'),_0xb1d63f,_0x461f34[_0x1ea8('0x12')]['message']);return _0x58e216(_0x461f34['error']['message']);}else{logger[_0x1ea8('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xb1d63f,_0x1ea8('0xe'));_0x58e216(_0x461f34[_0x1ea8('0x14')][_0x1ea8('0x15')]);}})[_0x1ea8('0x16')](function(_0x2507f6){logger[_0x1ea8('0x12')](_0x1ea8('0xd'),_0xb1d63f,_0x2507f6);_0x37f5c9(_0x2507f6);});});} \ No newline at end of file +var _0x69ac=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment'];(function(_0x2d9b64,_0x38a553){var _0x25d895=function(_0xedfa2f){while(--_0xedfa2f){_0x2d9b64['push'](_0x2d9b64['shift']());}};_0x25d895(++_0x38a553);}(_0x69ac,0x1af));var _0xc69a=function(_0x8dd99d,_0x3c9434){_0x8dd99d=_0x8dd99d-0x0;var _0x53d46d=_0x69ac[_0x8dd99d];return _0x53d46d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc69a('0x0'));var BPromise=require(_0xc69a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc69a('0x2'));var db=require(_0xc69a('0x3'))['db'];var utils=require(_0xc69a('0x4'));var logger=require(_0xc69a('0x5'))(_0xc69a('0x6'));var config=require(_0xc69a('0x7'));var jayson=require(_0xc69a('0x8'));var client=jayson[_0xc69a('0x9')][_0xc69a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ffcaf,_0x1d2f7d,_0xc43783){return new BPromise(function(_0x1ede61,_0x56970e){return client[_0xc69a('0xb')](_0x1ffcaf,_0xc43783)[_0xc69a('0xc')](function(_0x36c30e){logger[_0xc69a('0xd')](_0xc69a('0xe'),_0x1d2f7d,'request\x20sent');logger[_0xc69a('0xf')](_0xc69a('0x10'),_0x1d2f7d,_0xc69a('0x11'),JSON[_0xc69a('0x12')](_0x36c30e));if(_0x36c30e[_0xc69a('0x13')]){if(_0x36c30e[_0xc69a('0x13')][_0xc69a('0x14')]===0x1f4){logger[_0xc69a('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2f7d,_0x36c30e[_0xc69a('0x13')][_0xc69a('0x15')]);return _0x56970e(_0x36c30e['error'][_0xc69a('0x15')]);}logger[_0xc69a('0x13')](_0xc69a('0xe'),_0x1d2f7d,_0x36c30e['error'][_0xc69a('0x15')]);return _0x1ede61(_0x36c30e['error'][_0xc69a('0x15')]);}else{logger[_0xc69a('0xd')](_0xc69a('0xe'),_0x1d2f7d,_0xc69a('0x11'));_0x1ede61(_0x36c30e[_0xc69a('0x16')][_0xc69a('0x15')]);}})[_0xc69a('0x17')](function(_0x1b9cf2){logger[_0xc69a('0x13')](_0xc69a('0xe'),_0x1d2f7d,_0x1b9cf2);_0x56970e(_0x1b9cf2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1f3a7ba..c164c55 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 _0xe5b2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x4eb0ca,_0xcd2573){var _0x5cb527=function(_0x435430){while(--_0x435430){_0x4eb0ca['push'](_0x4eb0ca['shift']());}};_0x5cb527(++_0xcd2573);}(_0xe5b2,0x9d));var _0x2e5b=function(_0x17db61,_0x364236){_0x17db61=_0x17db61-0x0;var _0x7ac96b=_0xe5b2[_0x17db61];return _0x7ac96b;};'use strict';var multer=require(_0x2e5b('0x0'));var util=require(_0x2e5b('0x1'));var path=require('path');var timeout=require(_0x2e5b('0x2'));var express=require(_0x2e5b('0x3'));var router=express['Router']();var fs_extra=require(_0x2e5b('0x4'));var auth=require(_0x2e5b('0x5'));var interaction=require(_0x2e5b('0x6'));var config=require(_0x2e5b('0x7'));var controller=require(_0x2e5b('0x8'));router[_0x2e5b('0x9')]('/',auth[_0x2e5b('0xa')](),controller[_0x2e5b('0xb')]);router[_0x2e5b('0x9')](_0x2e5b('0xc'),auth[_0x2e5b('0xa')](),controller[_0x2e5b('0xd')]);router[_0x2e5b('0xe')]('/',auth[_0x2e5b('0xa')](),controller['create']);router['put'](_0x2e5b('0xc'),auth[_0x2e5b('0xa')](),controller['update']);router[_0x2e5b('0xf')](_0x2e5b('0xc'),auth[_0x2e5b('0xa')](),controller[_0x2e5b('0x10')]);module[_0x2e5b('0x11')]=router; \ No newline at end of file +var _0xe2b2=['index','get','/:id','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','isAuthenticated'];(function(_0xa741fa,_0x14b888){var _0xfa882c=function(_0x53339d){while(--_0x53339d){_0xa741fa['push'](_0xa741fa['shift']());}};_0xfa882c(++_0x14b888);}(_0xe2b2,0x129));var _0x2e2b=function(_0x3d2be7,_0x461849){_0x3d2be7=_0x3d2be7-0x0;var _0x2aac73=_0xe2b2[_0x3d2be7];return _0x2aac73;};'use strict';var multer=require(_0x2e2b('0x0'));var util=require(_0x2e2b('0x1'));var path=require(_0x2e2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e2b('0x3'));var router=express[_0x2e2b('0x4')]();var fs_extra=require(_0x2e2b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e2b('0x6'));var controller=require(_0x2e2b('0x7'));router['get']('/',auth[_0x2e2b('0x8')](),controller[_0x2e2b('0x9')]);router[_0x2e2b('0xa')](_0x2e2b('0xb'),auth[_0x2e2b('0x8')](),controller['show']);router['post']('/',auth[_0x2e2b('0x8')](),controller[_0x2e2b('0xc')]);router[_0x2e2b('0xd')](_0x2e2b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2e2b('0xe')](_0x2e2b('0xb'),auth[_0x2e2b('0x8')](),controller[_0x2e2b('0xf')]);module[_0x2e2b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5a22c92..c1b4e37 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 _0x520f=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4e43bb,_0x25c13f){var _0xa7a9e2=function(_0xf2be14){while(--_0xf2be14){_0x4e43bb['push'](_0x4e43bb['shift']());}};_0xa7a9e2(++_0x25c13f);}(_0x520f,0xbf));var _0xf520=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x520f[_0x511b76];return _0x5424ff;};'use strict';var Sequelize=require(_0xf520('0x0'));module[_0xf520('0x1')]={'type':{'type':Sequelize[_0xf520('0x2')](_0xf520('0x3'),_0xf520('0x4'),_0xf520('0x5'),_0xf520('0x6'),_0xf520('0x7')),'defaultValue':_0xf520('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf520('0x8')]},'keyType':{'type':Sequelize[_0xf520('0x2')](_0xf520('0x3'),_0xf520('0x4'),_0xf520('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf520('0x8')]},'nameField':{'type':Sequelize[_0xf520('0x8')]},'customField':{'type':Sequelize[_0xf520('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf520('0x8')]}}; \ No newline at end of file +var _0xf4f1=['exports','ENUM','customVariable','keyValue','picklist','STRING','string','variable','BOOLEAN'];(function(_0x16e4c4,_0x1e67a1){var _0x2896fe=function(_0x47429a){while(--_0x47429a){_0x16e4c4['push'](_0x16e4c4['shift']());}};_0x2896fe(++_0x1e67a1);}(_0xf4f1,0x1c2));var _0x1f4f=function(_0x273dec,_0x54a677){_0x273dec=_0x273dec-0x0;var _0x37f4ec=_0xf4f1[_0x273dec];return _0x37f4ec;};'use strict';var Sequelize=require('sequelize');module[_0x1f4f('0x0')]={'type':{'type':Sequelize[_0x1f4f('0x1')]('string','variable',_0x1f4f('0x2'),_0x1f4f('0x3'),_0x1f4f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1f4f('0x5')]},'key':{'type':Sequelize[_0x1f4f('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x1f4f('0x6'),_0x1f4f('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x1f4f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1f4f('0x5')]},'customField':{'type':Sequelize[_0x1f4f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4d377a1..62800c8 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 _0xe5eb=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','SugarcrmField','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x3640e2,_0x562103){var _0x277415=function(_0x1b2c89){while(--_0x1b2c89){_0x3640e2['push'](_0x3640e2['shift']());}};_0x277415(++_0x562103);}(_0xe5eb,0xe2));var _0xbe5e=function(_0x278c35,_0x320e43){_0x278c35=_0x278c35-0x0;var _0xb4e9bb=_0xe5eb[_0x278c35];return _0xb4e9bb;};'use strict';var emlformat=require(_0xbe5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe5e('0x1'));var moment=require(_0xbe5e('0x2'));var BPromise=require(_0xbe5e('0x3'));var Mustache=require(_0xbe5e('0x4'));var util=require(_0xbe5e('0x5'));var path=require(_0xbe5e('0x6'));var sox=require('sox');var csv=require(_0xbe5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe5e('0x8'));var _=require('lodash');var squel=require(_0xbe5e('0x9'));var crypto=require(_0xbe5e('0xa'));var jsforce=require(_0xbe5e('0xb'));var deskjs=require(_0xbe5e('0xc'));var toCsv=require(_0xbe5e('0x7'));var querystring=require(_0xbe5e('0xd'));var Papa=require('papaparse');var Redis=require(_0xbe5e('0xe'));var authService=require(_0xbe5e('0xf'));var qs=require(_0xbe5e('0x10'));var as=require(_0xbe5e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe5e('0x12'))('api');var utils=require(_0xbe5e('0x13'));var config=require(_0xbe5e('0x14'));var licenseUtil=require(_0xbe5e('0x15'));var db=require(_0xbe5e('0x16'))['db'];function respondWithStatusCode(_0x3dbd30,_0x2affb8){_0x2affb8=_0x2affb8||0xcc;return function(_0x133e71){if(_0x133e71){return _0x3dbd30[_0xbe5e('0x17')](_0x2affb8);}return _0x3dbd30['status'](_0x2affb8)[_0xbe5e('0x18')]();};}function respondWithResult(_0x570fc5,_0x353a94){_0x353a94=_0x353a94||0xc8;return function(_0x3170d8){if(_0x3170d8){return _0x570fc5[_0xbe5e('0x19')](_0x353a94)[_0xbe5e('0x1a')](_0x3170d8);}};}function respondWithFilteredResult(_0x2314f9,_0x1d3957){return function(_0x497f60){if(_0x497f60){var _0x2c9539=typeof _0x1d3957[_0xbe5e('0x1b')]===_0xbe5e('0x1c')&&typeof _0x1d3957['limit']==='undefined';var _0xcc1fcf=_0x497f60[_0xbe5e('0x1d')];var _0x511392=_0x2c9539?0x0:_0x1d3957[_0xbe5e('0x1b')];var _0x1997d9=_0x2c9539?_0x497f60['count']:_0x1d3957['offset']+_0x1d3957[_0xbe5e('0x1e')];var _0x332397;if(_0x1997d9>=_0xcc1fcf){_0x1997d9=_0xcc1fcf;_0x332397=0xc8;}else{_0x332397=0xce;}_0x2314f9[_0xbe5e('0x19')](_0x332397);return _0x2314f9[_0xbe5e('0x1f')]('Content-Range',_0x511392+'-'+_0x1997d9+'/'+_0xcc1fcf)[_0xbe5e('0x1a')](_0x497f60);}return null;};}function patchUpdates(_0x29e9ef){return function(_0x47c454){try{jsonpatch[_0xbe5e('0x20')](_0x47c454,_0x29e9ef,!![]);}catch(_0x219f03){return BPromise[_0xbe5e('0x21')](_0x219f03);}return _0x47c454[_0xbe5e('0x22')]();};}function saveUpdates(_0x3b7eb6,_0x483f2a){return function(_0xca891c){if(_0xca891c){return _0xca891c[_0xbe5e('0x23')](_0x3b7eb6)[_0xbe5e('0x24')](function(_0x43b415){return _0x43b415;});}return null;};}function removeEntity(_0x38a8c6,_0x4e80d0){return function(_0x536fe6){if(_0x536fe6){return _0x536fe6[_0xbe5e('0x25')]()[_0xbe5e('0x24')](function(){_0x38a8c6[_0xbe5e('0x19')](0xcc)[_0xbe5e('0x18')]();});}};}function handleEntityNotFound(_0x53f60d,_0x20a858){return function(_0x5cc6b3){if(!_0x5cc6b3){_0x53f60d[_0xbe5e('0x17')](0x194);}return _0x5cc6b3;};}function handleError(_0x5dba2a,_0xecfb87){_0xecfb87=_0xecfb87||0x1f4;return function(_0x18c57d){logger[_0xbe5e('0x26')](_0x18c57d['stack']);if(_0x18c57d[_0xbe5e('0x27')]){delete _0x18c57d[_0xbe5e('0x27')];}_0x5dba2a[_0xbe5e('0x19')](_0xecfb87)['send'](_0x18c57d);};}exports[_0xbe5e('0x28')]=function(_0x45d172,_0x21c994){var _0x3f534b={},_0x55118c={},_0x131034={'count':0x0,'rows':[]};var _0x26f451=_[_0xbe5e('0x29')](db[_0xbe5e('0x2a')]['rawAttributes'],function(_0x4d78c5){return{'name':_0x4d78c5[_0xbe5e('0x2b')],'type':_0x4d78c5[_0xbe5e('0x2c')]['key']};});_0x55118c[_0xbe5e('0x2d')]=_[_0xbe5e('0x29')](_0x26f451,_0xbe5e('0x27'));_0x55118c['query']=_[_0xbe5e('0x2e')](_0x45d172[_0xbe5e('0x2f')]);_0x55118c[_0xbe5e('0x30')]=_[_0xbe5e('0x31')](_0x55118c[_0xbe5e('0x2d')],_0x55118c['query']);_0x3f534b[_0xbe5e('0x32')]=_[_0xbe5e('0x31')](_0x55118c[_0xbe5e('0x2d')],qs[_0xbe5e('0x33')](_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x33')]));_0x3f534b[_0xbe5e('0x32')]=_0x3f534b['attributes'][_0xbe5e('0x34')]?_0x3f534b[_0xbe5e('0x32')]:_0x55118c[_0xbe5e('0x2d')];if(!_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x35')]('nolimit')){_0x3f534b[_0xbe5e('0x1e')]=qs[_0xbe5e('0x1e')](_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x1e')]);_0x3f534b[_0xbe5e('0x1b')]=qs[_0xbe5e('0x1b')](_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x1b')]);}_0x3f534b['order']=qs[_0xbe5e('0x36')](_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x36')]);_0x3f534b[_0xbe5e('0x37')]=qs[_0xbe5e('0x30')](_[_0xbe5e('0x38')](_0x45d172[_0xbe5e('0x2f')],_0x55118c[_0xbe5e('0x30')]),_0x26f451);if(_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x39')]){_0x3f534b[_0xbe5e('0x37')]=_[_0xbe5e('0x3a')](_0x3f534b[_0xbe5e('0x37')],{'$or':_['map'](_0x26f451,function(_0x152acf){if(_0x152acf[_0xbe5e('0x2c')]!==_0xbe5e('0x3b')){var _0x50721d={};_0x50721d[_0x152acf[_0xbe5e('0x27')]]={'$like':'%'+_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x39')]+'%'};return _0x50721d;}})});}_0x3f534b=_[_0xbe5e('0x3a')]({},_0x3f534b,_0x45d172[_0xbe5e('0x3c')]);var _0x199b7c={'where':_0x3f534b[_0xbe5e('0x37')]};return db['SugarcrmField'][_0xbe5e('0x1d')](_0x199b7c)[_0xbe5e('0x24')](function(_0x51ea1c){_0x131034['count']=_0x51ea1c;if(_0x45d172[_0xbe5e('0x2f')][_0xbe5e('0x3d')]){_0x3f534b[_0xbe5e('0x3e')]=[{'all':!![]}];}return db[_0xbe5e('0x2a')][_0xbe5e('0x3f')](_0x3f534b);})[_0xbe5e('0x24')](function(_0x200cf5){_0x131034[_0xbe5e('0x40')]=_0x200cf5;return _0x131034;})[_0xbe5e('0x24')](respondWithFilteredResult(_0x21c994,_0x3f534b))[_0xbe5e('0x41')](handleError(_0x21c994,null));};exports[_0xbe5e('0x42')]=function(_0x3ece26,_0x48afe5){var _0x3c6cf3={'raw':!![],'where':{'id':_0x3ece26[_0xbe5e('0x43')]['id']}},_0x2c2391={};_0x2c2391[_0xbe5e('0x2d')]=_[_0xbe5e('0x2e')](db[_0xbe5e('0x2a')]['rawAttributes']);_0x2c2391['query']=_[_0xbe5e('0x2e')](_0x3ece26['query']);_0x2c2391[_0xbe5e('0x30')]=_['intersection'](_0x2c2391['model'],_0x2c2391[_0xbe5e('0x2f')]);_0x3c6cf3[_0xbe5e('0x32')]=_['intersection'](_0x2c2391['model'],qs['fields'](_0x3ece26[_0xbe5e('0x2f')][_0xbe5e('0x33')]));_0x3c6cf3[_0xbe5e('0x32')]=_0x3c6cf3['attributes'][_0xbe5e('0x34')]?_0x3c6cf3[_0xbe5e('0x32')]:_0x2c2391[_0xbe5e('0x2d')];if(_0x3ece26[_0xbe5e('0x2f')][_0xbe5e('0x3d')]){_0x3c6cf3[_0xbe5e('0x3e')]=[{'all':!![]}];}_0x3c6cf3=_[_0xbe5e('0x3a')]({},_0x3c6cf3,_0x3ece26[_0xbe5e('0x3c')]);return db[_0xbe5e('0x2a')][_0xbe5e('0x44')](_0x3c6cf3)[_0xbe5e('0x24')](handleEntityNotFound(_0x48afe5,null))[_0xbe5e('0x24')](respondWithResult(_0x48afe5,null))['catch'](handleError(_0x48afe5,null));};exports[_0xbe5e('0x45')]=function(_0x1835c1,_0x5e4261){return db['SugarcrmField'][_0xbe5e('0x45')](_0x1835c1[_0xbe5e('0x46')],{})['then'](respondWithResult(_0x5e4261,0xc9))[_0xbe5e('0x41')](handleError(_0x5e4261,null));};exports[_0xbe5e('0x23')]=function(_0x2b721b,_0x208892){if(_0x2b721b['body']['id']){delete _0x2b721b[_0xbe5e('0x46')]['id'];}return db[_0xbe5e('0x2a')][_0xbe5e('0x44')]({'where':{'id':_0x2b721b[_0xbe5e('0x43')]['id']}})[_0xbe5e('0x24')](handleEntityNotFound(_0x208892,null))[_0xbe5e('0x24')](saveUpdates(_0x2b721b[_0xbe5e('0x46')],null))['then'](respondWithResult(_0x208892,null))[_0xbe5e('0x41')](handleError(_0x208892,null));};exports[_0xbe5e('0x25')]=function(_0x49c39b,_0x1029aa){return db[_0xbe5e('0x2a')]['find']({'where':{'id':_0x49c39b[_0xbe5e('0x43')]['id']}})[_0xbe5e('0x24')](handleEntityNotFound(_0x1029aa,null))[_0xbe5e('0x24')](removeEntity(_0x1029aa,null))[_0xbe5e('0x41')](handleError(_0x1029aa,null));}; \ No newline at end of file +var _0x2ce2=['save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','find','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x20e7f5,_0x515297){var _0x290856=function(_0x1fc6e2){while(--_0x1fc6e2){_0x20e7f5['push'](_0x20e7f5['shift']());}};_0x290856(++_0x515297);}(_0x2ce2,0xb6));var _0x22ce=function(_0x5eb874,_0x3d849f){_0x5eb874=_0x5eb874-0x0;var _0x5bbbd0=_0x2ce2[_0x5eb874];return _0x5bbbd0;};'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(_0x22ce('0x0'));var moment=require(_0x22ce('0x1'));var BPromise=require(_0x22ce('0x2'));var Mustache=require(_0x22ce('0x3'));var util=require(_0x22ce('0x4'));var path=require('path');var sox=require(_0x22ce('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22ce('0x6'));var squel=require(_0x22ce('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x22ce('0x8'));var toCsv=require(_0x22ce('0x9'));var querystring=require(_0x22ce('0xa'));var Papa=require(_0x22ce('0xb'));var Redis=require(_0x22ce('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x22ce('0xd'));var logger=require(_0x22ce('0xe'))(_0x22ce('0xf'));var utils=require(_0x22ce('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x22ce('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bcec3,_0x3045c2){_0x3045c2=_0x3045c2||0xcc;return function(_0x14081f){if(_0x14081f){return _0x5bcec3['sendStatus'](_0x3045c2);}return _0x5bcec3[_0x22ce('0x12')](_0x3045c2)[_0x22ce('0x13')]();};}function respondWithResult(_0x41aa97,_0x22c6bc){_0x22c6bc=_0x22c6bc||0xc8;return function(_0x5407aa){if(_0x5407aa){return _0x41aa97[_0x22ce('0x12')](_0x22c6bc)[_0x22ce('0x14')](_0x5407aa);}};}function respondWithFilteredResult(_0x4b1bce,_0x559eac){return function(_0x3a1021){if(_0x3a1021){var _0x29bd2c=typeof _0x559eac[_0x22ce('0x15')]===_0x22ce('0x16')&&typeof _0x559eac[_0x22ce('0x17')]===_0x22ce('0x16');var _0x4ffcf1=_0x3a1021['count'];var _0x265e84=_0x29bd2c?0x0:_0x559eac[_0x22ce('0x15')];var _0x158985=_0x29bd2c?_0x3a1021[_0x22ce('0x18')]:_0x559eac[_0x22ce('0x15')]+_0x559eac[_0x22ce('0x17')];var _0x2df6fb;if(_0x158985>=_0x4ffcf1){_0x158985=_0x4ffcf1;_0x2df6fb=0xc8;}else{_0x2df6fb=0xce;}_0x4b1bce['status'](_0x2df6fb);return _0x4b1bce[_0x22ce('0x19')](_0x22ce('0x1a'),_0x265e84+'-'+_0x158985+'/'+_0x4ffcf1)[_0x22ce('0x14')](_0x3a1021);}return null;};}function patchUpdates(_0x495205){return function(_0x2b7d64){try{jsonpatch[_0x22ce('0x1b')](_0x2b7d64,_0x495205,!![]);}catch(_0x528ba6){return BPromise['reject'](_0x528ba6);}return _0x2b7d64[_0x22ce('0x1c')]();};}function saveUpdates(_0x51ee65,_0x6ac2c0){return function(_0x5b4e5e){if(_0x5b4e5e){return _0x5b4e5e[_0x22ce('0x1d')](_0x51ee65)[_0x22ce('0x1e')](function(_0x49d77c){return _0x49d77c;});}return null;};}function removeEntity(_0x173034,_0x41b5aa){return function(_0x2257b9){if(_0x2257b9){return _0x2257b9[_0x22ce('0x1f')]()[_0x22ce('0x1e')](function(){_0x173034[_0x22ce('0x12')](0xcc)[_0x22ce('0x13')]();});}};}function handleEntityNotFound(_0x113e4b,_0x493d9b){return function(_0x520091){if(!_0x520091){_0x113e4b[_0x22ce('0x20')](0x194);}return _0x520091;};}function handleError(_0x53bbda,_0x3185be){_0x3185be=_0x3185be||0x1f4;return function(_0x19fa8d){logger['error'](_0x19fa8d[_0x22ce('0x21')]);if(_0x19fa8d['name']){delete _0x19fa8d[_0x22ce('0x22')];}_0x53bbda[_0x22ce('0x12')](_0x3185be)[_0x22ce('0x23')](_0x19fa8d);};}exports[_0x22ce('0x24')]=function(_0x4bb65c,_0x203b40){var _0x207e13={},_0x3b1add={},_0x4275a5={'count':0x0,'rows':[]};var _0x41b974=_[_0x22ce('0x25')](db[_0x22ce('0x26')][_0x22ce('0x27')],function(_0x439116){return{'name':_0x439116[_0x22ce('0x28')],'type':_0x439116['type'][_0x22ce('0x29')]};});_0x3b1add[_0x22ce('0x2a')]=_[_0x22ce('0x25')](_0x41b974,_0x22ce('0x22'));_0x3b1add[_0x22ce('0x2b')]=_[_0x22ce('0x2c')](_0x4bb65c[_0x22ce('0x2b')]);_0x3b1add[_0x22ce('0x2d')]=_[_0x22ce('0x2e')](_0x3b1add[_0x22ce('0x2a')],_0x3b1add[_0x22ce('0x2b')]);_0x207e13[_0x22ce('0x2f')]=_[_0x22ce('0x2e')](_0x3b1add['model'],qs[_0x22ce('0x30')](_0x4bb65c[_0x22ce('0x2b')][_0x22ce('0x30')]));_0x207e13[_0x22ce('0x2f')]=_0x207e13['attributes'][_0x22ce('0x31')]?_0x207e13[_0x22ce('0x2f')]:_0x3b1add[_0x22ce('0x2a')];if(!_0x4bb65c['query'][_0x22ce('0x32')](_0x22ce('0x33'))){_0x207e13[_0x22ce('0x17')]=qs[_0x22ce('0x17')](_0x4bb65c[_0x22ce('0x2b')]['limit']);_0x207e13[_0x22ce('0x15')]=qs[_0x22ce('0x15')](_0x4bb65c[_0x22ce('0x2b')][_0x22ce('0x15')]);}_0x207e13[_0x22ce('0x34')]=qs[_0x22ce('0x35')](_0x4bb65c['query'][_0x22ce('0x35')]);_0x207e13[_0x22ce('0x36')]=qs[_0x22ce('0x2d')](_[_0x22ce('0x37')](_0x4bb65c[_0x22ce('0x2b')],_0x3b1add[_0x22ce('0x2d')]),_0x41b974);if(_0x4bb65c[_0x22ce('0x2b')][_0x22ce('0x38')]){_0x207e13[_0x22ce('0x36')]=_[_0x22ce('0x39')](_0x207e13[_0x22ce('0x36')],{'$or':_[_0x22ce('0x25')](_0x41b974,function(_0x40afc7){if(_0x40afc7[_0x22ce('0x3a')]!==_0x22ce('0x3b')){var _0x2ca3b8={};_0x2ca3b8[_0x40afc7['name']]={'$like':'%'+_0x4bb65c[_0x22ce('0x2b')][_0x22ce('0x38')]+'%'};return _0x2ca3b8;}})});}_0x207e13=_[_0x22ce('0x39')]({},_0x207e13,_0x4bb65c[_0x22ce('0x3c')]);var _0x2c747e={'where':_0x207e13[_0x22ce('0x36')]};return db[_0x22ce('0x26')][_0x22ce('0x18')](_0x2c747e)['then'](function(_0x2b0dca){_0x4275a5[_0x22ce('0x18')]=_0x2b0dca;if(_0x4bb65c['query'][_0x22ce('0x3d')]){_0x207e13[_0x22ce('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0x22ce('0x3f')](_0x207e13);})[_0x22ce('0x1e')](function(_0x41afc6){_0x4275a5['rows']=_0x41afc6;return _0x4275a5;})[_0x22ce('0x1e')](respondWithFilteredResult(_0x203b40,_0x207e13))['catch'](handleError(_0x203b40,null));};exports[_0x22ce('0x40')]=function(_0x46c8dc,_0x325765){var _0x2d0338={'raw':!![],'where':{'id':_0x46c8dc[_0x22ce('0x41')]['id']}},_0x36e9c8={};_0x36e9c8[_0x22ce('0x2a')]=_['keys'](db[_0x22ce('0x26')][_0x22ce('0x27')]);_0x36e9c8[_0x22ce('0x2b')]=_[_0x22ce('0x2c')](_0x46c8dc[_0x22ce('0x2b')]);_0x36e9c8[_0x22ce('0x2d')]=_[_0x22ce('0x2e')](_0x36e9c8[_0x22ce('0x2a')],_0x36e9c8[_0x22ce('0x2b')]);_0x2d0338[_0x22ce('0x2f')]=_[_0x22ce('0x2e')](_0x36e9c8[_0x22ce('0x2a')],qs[_0x22ce('0x30')](_0x46c8dc[_0x22ce('0x2b')][_0x22ce('0x30')]));_0x2d0338[_0x22ce('0x2f')]=_0x2d0338[_0x22ce('0x2f')]['length']?_0x2d0338['attributes']:_0x36e9c8['model'];if(_0x46c8dc[_0x22ce('0x2b')]['includeAll']){_0x2d0338[_0x22ce('0x3e')]=[{'all':!![]}];}_0x2d0338=_['merge']({},_0x2d0338,_0x46c8dc[_0x22ce('0x3c')]);return db[_0x22ce('0x26')]['find'](_0x2d0338)[_0x22ce('0x1e')](handleEntityNotFound(_0x325765,null))[_0x22ce('0x1e')](respondWithResult(_0x325765,null))[_0x22ce('0x42')](handleError(_0x325765,null));};exports['create']=function(_0x574a3a,_0x4a2850){return db[_0x22ce('0x26')][_0x22ce('0x43')](_0x574a3a[_0x22ce('0x44')],{})[_0x22ce('0x1e')](respondWithResult(_0x4a2850,0xc9))['catch'](handleError(_0x4a2850,null));};exports['update']=function(_0x3fe863,_0x491157){if(_0x3fe863[_0x22ce('0x44')]['id']){delete _0x3fe863[_0x22ce('0x44')]['id'];}return db[_0x22ce('0x26')][_0x22ce('0x45')]({'where':{'id':_0x3fe863[_0x22ce('0x41')]['id']}})[_0x22ce('0x1e')](handleEntityNotFound(_0x491157,null))['then'](saveUpdates(_0x3fe863[_0x22ce('0x44')],null))[_0x22ce('0x1e')](respondWithResult(_0x491157,null))[_0x22ce('0x42')](handleError(_0x491157,null));};exports['destroy']=function(_0x26a5c8,_0x325432){return db[_0x22ce('0x26')][_0x22ce('0x45')]({'where':{'id':_0x26a5c8[_0x22ce('0x41')]['id']}})[_0x22ce('0x1e')](handleEntityNotFound(_0x325432,null))[_0x22ce('0x1e')](removeEntity(_0x325432,null))[_0x22ce('0x42')](handleError(_0x325432,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7ad456d..e2069a1 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 _0x5506=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x5506,0x157));var _0x6550=function(_0x268a33,_0x38be08){_0x268a33=_0x268a33-0x0;var _0x209003=_0x5506[_0x268a33];return _0x209003;};'use strict';var _=require(_0x6550('0x0'));var util=require(_0x6550('0x1'));var logger=require(_0x6550('0x2'))(_0x6550('0x3'));var moment=require(_0x6550('0x4'));var BPromise=require(_0x6550('0x5'));var rp=require(_0x6550('0x6'));var fs=require('fs');var path=require(_0x6550('0x7'));var rimraf=require(_0x6550('0x8'));var config=require(_0x6550('0x9'));var attributes=require(_0x6550('0xa'));module[_0x6550('0xb')]=function(_0x3ffd3e,_0x267856){return _0x3ffd3e[_0x6550('0xc')](_0x6550('0xd'),attributes,{'tableName':_0x6550('0xe'),'paranoid':![],'indexes':[{'name':_0x6550('0xf'),'fields':[_0x6550('0x10'),_0x6550('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xffa8=['../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x140205,_0x8d5201){var _0x2bcf84=function(_0x2a7725){while(--_0x2a7725){_0x140205['push'](_0x140205['shift']());}};_0x2bcf84(++_0x8d5201);}(_0xffa8,0xf7));var _0x8ffa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xffa8[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8ffa('0x0'));var logger=require(_0x8ffa('0x1'))(_0x8ffa('0x2'));var moment=require(_0x8ffa('0x3'));var BPromise=require(_0x8ffa('0x4'));var rp=require(_0x8ffa('0x5'));var fs=require('fs');var path=require(_0x8ffa('0x6'));var rimraf=require(_0x8ffa('0x7'));var config=require(_0x8ffa('0x8'));var attributes=require(_0x8ffa('0x9'));module[_0x8ffa('0xa')]=function(_0x53548b,_0x56313e){return _0x53548b[_0x8ffa('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8ffa('0xc'),'fields':[_0x8ffa('0xd'),_0x8ffa('0xe')],'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 d36cd88..16e266c 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 _0x407d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x1f1e92,_0x50f1a8){var _0x865099=function(_0x4f1b9f){while(--_0x4f1b9f){_0x1f1e92['push'](_0x1f1e92['shift']());}};_0x865099(++_0x50f1a8);}(_0x407d,0xd7));var _0xd407=function(_0x31c284,_0x1c4b1d){_0x31c284=_0x31c284-0x0;var _0x239794=_0x407d[_0x31c284];return _0x239794;};'use strict';var _=require('lodash');var util=require(_0xd407('0x0'));var moment=require(_0xd407('0x1'));var BPromise=require(_0xd407('0x2'));var rs=require(_0xd407('0x3'));var fs=require('fs');var Redis=require(_0xd407('0x4'));var db=require(_0xd407('0x5'))['db'];var utils=require(_0xd407('0x6'));var logger=require(_0xd407('0x7'))('rpc');var config=require(_0xd407('0x8'));var jayson=require(_0xd407('0x9'));var client=jayson[_0xd407('0xa')][_0xd407('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a63,_0x47cb3c,_0x5a811d){return new BPromise(function(_0x444121,_0x6304c6){return client[_0xd407('0xc')](_0x5c5a63,_0x5a811d)[_0xd407('0xd')](function(_0x4183ad){logger[_0xd407('0xe')](_0xd407('0xf'),_0x47cb3c,_0xd407('0x10'));logger['debug'](_0xd407('0x11'),_0x47cb3c,_0xd407('0x10'),JSON[_0xd407('0x12')](_0x4183ad));if(_0x4183ad['error']){if(_0x4183ad[_0xd407('0x13')][_0xd407('0x14')]===0x1f4){logger[_0xd407('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x47cb3c,_0x4183ad[_0xd407('0x13')][_0xd407('0x15')]);return _0x6304c6(_0x4183ad[_0xd407('0x13')]['message']);}logger[_0xd407('0x13')](_0xd407('0xf'),_0x47cb3c,_0x4183ad[_0xd407('0x13')][_0xd407('0x15')]);return _0x444121(_0x4183ad[_0xd407('0x13')][_0xd407('0x15')]);}else{logger[_0xd407('0xe')](_0xd407('0xf'),_0x47cb3c,_0xd407('0x10'));_0x444121(_0x4183ad[_0xd407('0x16')]['message']);}})[_0xd407('0x17')](function(_0x192208){logger[_0xd407('0x13')](_0xd407('0xf'),_0x47cb3c,_0x192208);_0x6304c6(_0x192208);});});} \ No newline at end of file +var _0xb89b=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','util','moment','bluebird','ioredis'];(function(_0x101094,_0x5d3900){var _0x3d6d75=function(_0x10aa02){while(--_0x10aa02){_0x101094['push'](_0x101094['shift']());}};_0x3d6d75(++_0x5d3900);}(_0xb89b,0x176));var _0xbb89=function(_0x5bfa42,_0x46ec12){_0x5bfa42=_0x5bfa42-0x0;var _0x5b1a31=_0xb89b[_0x5bfa42];return _0x5b1a31;};'use strict';var _=require('lodash');var util=require(_0xbb89('0x0'));var moment=require(_0xbb89('0x1'));var BPromise=require(_0xbb89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb89('0x3'));var db=require(_0xbb89('0x4'))['db'];var utils=require(_0xbb89('0x5'));var logger=require('../../config/logger')(_0xbb89('0x6'));var config=require(_0xbb89('0x7'));var jayson=require(_0xbb89('0x8'));var client=jayson[_0xbb89('0x9')][_0xbb89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc72fef,_0x27df0d,_0x2ec84e){return new BPromise(function(_0x48b737,_0x29b77d){return client[_0xbb89('0xb')](_0xc72fef,_0x2ec84e)[_0xbb89('0xc')](function(_0x2632aa){logger[_0xbb89('0xd')](_0xbb89('0xe'),_0x27df0d,'request\x20sent');logger['debug'](_0xbb89('0xf'),_0x27df0d,_0xbb89('0x10'),JSON[_0xbb89('0x11')](_0x2632aa));if(_0x2632aa['error']){if(_0x2632aa['error'][_0xbb89('0x12')]===0x1f4){logger[_0xbb89('0x13')](_0xbb89('0xe'),_0x27df0d,_0x2632aa[_0xbb89('0x13')][_0xbb89('0x14')]);return _0x29b77d(_0x2632aa[_0xbb89('0x13')][_0xbb89('0x14')]);}logger[_0xbb89('0x13')](_0xbb89('0xe'),_0x27df0d,_0x2632aa[_0xbb89('0x13')]['message']);return _0x48b737(_0x2632aa[_0xbb89('0x13')][_0xbb89('0x14')]);}else{logger['info'](_0xbb89('0xe'),_0x27df0d,'request\x20sent');_0x48b737(_0x2632aa['result']['message']);}})['catch'](function(_0x3e6359){logger[_0xbb89('0x13')](_0xbb89('0xe'),_0x27df0d,_0x3e6359);_0x29b77d(_0x3e6359);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 67c96f0..0ed9330 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 _0xcc73=['../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcc73[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x3cc7('0x0'));var path=require(_0x3cc7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cc7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3cc7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3cc7('0x4'));router[_0x3cc7('0x5')]('/',auth[_0x3cc7('0x6')](),controller[_0x3cc7('0x7')]);router[_0x3cc7('0x5')]('/:id',auth[_0x3cc7('0x6')](),controller[_0x3cc7('0x8')]);router[_0x3cc7('0x5')](_0x3cc7('0x9'),auth['isAuthenticated'](),controller[_0x3cc7('0xa')]);router[_0x3cc7('0x5')](_0x3cc7('0xb'),auth[_0x3cc7('0x6')](),controller[_0x3cc7('0xc')]);router[_0x3cc7('0xd')]('/',auth[_0x3cc7('0x6')](),controller['create']);router['post'](_0x3cc7('0x9'),auth['isAuthenticated'](),controller[_0x3cc7('0xe')]);router[_0x3cc7('0xf')](_0x3cc7('0x10'),auth[_0x3cc7('0x6')](),controller[_0x3cc7('0x11')]);router[_0x3cc7('0x12')](_0x3cc7('0x10'),auth[_0x3cc7('0x6')](),controller[_0x3cc7('0x13')]);module[_0x3cc7('0x14')]=router; \ No newline at end of file +var _0x2d9b=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports'];(function(_0x22bd78,_0x2b0a96){var _0x5da655=function(_0x568dac){while(--_0x568dac){_0x22bd78['push'](_0x22bd78['shift']());}};_0x5da655(++_0x2b0a96);}(_0x2d9b,0xb0));var _0xb2d9=function(_0x2c0689,_0x24601c){_0x2c0689=_0x2c0689-0x0;var _0x2d9f85=_0x2d9b[_0x2c0689];return _0x2d9f85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2d9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb2d9('0x1'));var router=express[_0xb2d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb2d9('0x3'));var interaction=require(_0xb2d9('0x4'));var config=require(_0xb2d9('0x5'));var controller=require(_0xb2d9('0x6'));router[_0xb2d9('0x7')]('/',auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x9')]);router[_0xb2d9('0x7')](_0xb2d9('0xa'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0xb')]);router[_0xb2d9('0x7')](_0xb2d9('0xc'),auth['isAuthenticated'](),controller[_0xb2d9('0xd')]);router[_0xb2d9('0x7')](_0xb2d9('0xe'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0xf')]);router[_0xb2d9('0x10')]('/',auth[_0xb2d9('0x8')](),controller['create']);router['post'](_0xb2d9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb2d9('0x11')](_0xb2d9('0xa'),auth['isAuthenticated'](),controller[_0xb2d9('0x12')]);router[_0xb2d9('0x13')](_0xb2d9('0xa'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x14')]);module[_0xb2d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b9883a0..664d79d 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 _0x0d21=['sequelize','STRING','HelpDesk'];(function(_0x3b64de,_0x5c45e5){var _0xed6ffd=function(_0xa300a8){while(--_0xa300a8){_0x3b64de['push'](_0x3b64de['shift']());}};_0xed6ffd(++_0x5c45e5);}(_0x0d21,0xf6));var _0x10d2=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x0d21[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x10d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x10d2('0x1')]},'username':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![],'defaultValue':_0x10d2('0x2')},'remoteUri':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x10d2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0d99=['sequelize','exports','STRING','HelpDesk'];(function(_0x5cf262,_0x15e4c5){var _0x389d44=function(_0x423720){while(--_0x423720){_0x5cf262['push'](_0x5cf262['shift']());}};_0x389d44(++_0x15e4c5);}(_0x0d99,0x8c));var _0x90d9=function(_0x216112,_0x3a57f4){_0x216112=_0x216112-0x0;var _0x578c6f=_0x0d99[_0x216112];return _0x578c6f;};'use strict';var Sequelize=require(_0x90d9('0x0'));module[_0x90d9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x90d9('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x90d9('0x2')],'allowNull':![],'defaultValue':_0x90d9('0x3')},'remoteUri':{'type':Sequelize[_0x90d9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x90d9('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x90d9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 29fc065..4f69d2f 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 _0xfa97=['getchallenge','POST','describe','success','autogenerated','owner','remove','result','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','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','undefined','limit','count','set','Content-Range','reject','save','update','error','stack','name','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','VtigerAccount','show','params','rawAttributes','length','find','catch','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','description','remoteUri','accessKey','username','moduleName','slice','substring','lastIndexOf','GET'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xfa97,0x92));var _0x7fa9=function(_0x1fcf8d,_0x1a1328){_0x1fcf8d=_0x1fcf8d-0x0;var _0x36384f=_0xfa97[_0x1fcf8d];return _0x36384f;};'use strict';var emlformat=require(_0x7fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fa9('0x2'));var moment=require(_0x7fa9('0x3'));var BPromise=require(_0x7fa9('0x4'));var Mustache=require(_0x7fa9('0x5'));var util=require(_0x7fa9('0x6'));var path=require(_0x7fa9('0x7'));var sox=require(_0x7fa9('0x8'));var csv=require(_0x7fa9('0x9'));var ejs=require(_0x7fa9('0xa'));var fs=require('fs');var fs_extra=require(_0x7fa9('0xb'));var _=require('lodash');var squel=require(_0x7fa9('0xc'));var crypto=require(_0x7fa9('0xd'));var jsforce=require(_0x7fa9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7fa9('0x9'));var querystring=require(_0x7fa9('0xf'));var Papa=require(_0x7fa9('0x10'));var Redis=require(_0x7fa9('0x11'));var authService=require(_0x7fa9('0x12'));var qs=require(_0x7fa9('0x13'));var as=require(_0x7fa9('0x14'));var hardwareService=require(_0x7fa9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7fa9('0x16'));var config=require(_0x7fa9('0x17'));var licenseUtil=require(_0x7fa9('0x18'));var db=require(_0x7fa9('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ed0c4,_0x3232ae){_0x3232ae=_0x3232ae||0xcc;return function(_0x4aab83){if(_0x4aab83){return _0x2ed0c4[_0x7fa9('0x1a')](_0x3232ae);}return _0x2ed0c4[_0x7fa9('0x1b')](_0x3232ae)[_0x7fa9('0x1c')]();};}function respondWithResult(_0xf91d12,_0x5bb3f4){_0x5bb3f4=_0x5bb3f4||0xc8;return function(_0x1372ae){if(_0x1372ae){return _0xf91d12['status'](_0x5bb3f4)[_0x7fa9('0x1d')](_0x1372ae);}};}function respondWithFilteredResult(_0x4afbad,_0x232c38){return function(_0x5a24df){if(_0x5a24df){var _0x1e3604=typeof _0x232c38[_0x7fa9('0x1e')]===_0x7fa9('0x1f')&&typeof _0x232c38[_0x7fa9('0x20')]==='undefined';var _0x8a7359=_0x5a24df[_0x7fa9('0x21')];var _0x5f5308=_0x1e3604?0x0:_0x232c38['offset'];var _0x42d258=_0x1e3604?_0x5a24df['count']:_0x232c38[_0x7fa9('0x1e')]+_0x232c38[_0x7fa9('0x20')];var _0x6309a8;if(_0x42d258>=_0x8a7359){_0x42d258=_0x8a7359;_0x6309a8=0xc8;}else{_0x6309a8=0xce;}_0x4afbad['status'](_0x6309a8);return _0x4afbad[_0x7fa9('0x22')](_0x7fa9('0x23'),_0x5f5308+'-'+_0x42d258+'/'+_0x8a7359)[_0x7fa9('0x1d')](_0x5a24df);}return null;};}function patchUpdates(_0x1615e2){return function(_0x181dac){try{jsonpatch['apply'](_0x181dac,_0x1615e2,!![]);}catch(_0x502f47){return BPromise[_0x7fa9('0x24')](_0x502f47);}return _0x181dac[_0x7fa9('0x25')]();};}function saveUpdates(_0x53cd98,_0x5a05b4){return function(_0xd02846){if(_0xd02846){return _0xd02846[_0x7fa9('0x26')](_0x53cd98)['then'](function(_0x40ea68){return _0x40ea68;});}return null;};}function removeEntity(_0x36514e,_0x128f00){return function(_0x44d0b6){if(_0x44d0b6){return _0x44d0b6['destroy']()['then'](function(){_0x36514e[_0x7fa9('0x1b')](0xcc)[_0x7fa9('0x1c')]();});}};}function handleEntityNotFound(_0x4e6ec6,_0x1d22fc){return function(_0x50d5d5){if(!_0x50d5d5){_0x4e6ec6[_0x7fa9('0x1a')](0x194);}return _0x50d5d5;};}function handleError(_0x2f0559,_0x9b14a9){_0x9b14a9=_0x9b14a9||0x1f4;return function(_0x581383){logger[_0x7fa9('0x27')](_0x581383[_0x7fa9('0x28')]);if(_0x581383['name']){delete _0x581383[_0x7fa9('0x29')];}_0x2f0559[_0x7fa9('0x1b')](_0x9b14a9)['send'](_0x581383);};}exports[_0x7fa9('0x2a')]=function(_0x1700ab,_0x50c0f5){var _0x41cd8b={},_0x3a13fd={},_0xb3636f={'count':0x0,'rows':[]};var _0x468530=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x4fef24){return{'name':_0x4fef24[_0x7fa9('0x2b')],'type':_0x4fef24[_0x7fa9('0x2c')][_0x7fa9('0x2d')]};});_0x3a13fd[_0x7fa9('0x2e')]=_[_0x7fa9('0x2f')](_0x468530,_0x7fa9('0x29'));_0x3a13fd['query']=_[_0x7fa9('0x30')](_0x1700ab[_0x7fa9('0x31')]);_0x3a13fd['filters']=_[_0x7fa9('0x32')](_0x3a13fd[_0x7fa9('0x2e')],_0x3a13fd[_0x7fa9('0x31')]);_0x41cd8b[_0x7fa9('0x33')]=_['intersection'](_0x3a13fd[_0x7fa9('0x2e')],qs[_0x7fa9('0x34')](_0x1700ab[_0x7fa9('0x31')][_0x7fa9('0x34')]));_0x41cd8b[_0x7fa9('0x33')]=_0x41cd8b[_0x7fa9('0x33')]['length']?_0x41cd8b[_0x7fa9('0x33')]:_0x3a13fd['model'];if(!_0x1700ab['query']['hasOwnProperty']('nolimit')){_0x41cd8b[_0x7fa9('0x20')]=qs[_0x7fa9('0x20')](_0x1700ab[_0x7fa9('0x31')][_0x7fa9('0x20')]);_0x41cd8b['offset']=qs['offset'](_0x1700ab[_0x7fa9('0x31')][_0x7fa9('0x1e')]);}_0x41cd8b['order']=qs[_0x7fa9('0x35')](_0x1700ab[_0x7fa9('0x31')]['sort']);_0x41cd8b[_0x7fa9('0x36')]=qs[_0x7fa9('0x37')](_[_0x7fa9('0x38')](_0x1700ab[_0x7fa9('0x31')],_0x3a13fd[_0x7fa9('0x37')]),_0x468530);if(_0x1700ab['query'][_0x7fa9('0x39')]){_0x41cd8b[_0x7fa9('0x36')]=_[_0x7fa9('0x3a')](_0x41cd8b[_0x7fa9('0x36')],{'$or':_['map'](_0x468530,function(_0x4662d2){if(_0x4662d2[_0x7fa9('0x2c')]!==_0x7fa9('0x3b')){var _0x1ee03a={};_0x1ee03a[_0x4662d2[_0x7fa9('0x29')]]={'$like':'%'+_0x1700ab[_0x7fa9('0x31')][_0x7fa9('0x39')]+'%'};return _0x1ee03a;}})});}_0x41cd8b=_[_0x7fa9('0x3a')]({},_0x41cd8b,_0x1700ab[_0x7fa9('0x3c')]);var _0x26ec44={'where':_0x41cd8b[_0x7fa9('0x36')]};return db['VtigerAccount'][_0x7fa9('0x21')](_0x26ec44)[_0x7fa9('0x3d')](function(_0x495c45){_0xb3636f[_0x7fa9('0x21')]=_0x495c45;if(_0x1700ab[_0x7fa9('0x31')][_0x7fa9('0x3e')]){_0x41cd8b[_0x7fa9('0x3f')]=[{'all':!![]}];}return db[_0x7fa9('0x40')]['findAll'](_0x41cd8b);})['then'](function(_0x1a32ab){_0xb3636f['rows']=_0x1a32ab;return _0xb3636f;})[_0x7fa9('0x3d')](respondWithFilteredResult(_0x50c0f5,_0x41cd8b))['catch'](handleError(_0x50c0f5,null));};exports[_0x7fa9('0x41')]=function(_0x25e02d,_0x683926){var _0x4fe851={'raw':![],'where':{'id':_0x25e02d[_0x7fa9('0x42')]['id']}},_0x501e3e={};_0x501e3e[_0x7fa9('0x2e')]=_['keys'](db[_0x7fa9('0x40')][_0x7fa9('0x43')]);_0x501e3e[_0x7fa9('0x31')]=_['keys'](_0x25e02d['query']);_0x501e3e['filters']=_['intersection'](_0x501e3e[_0x7fa9('0x2e')],_0x501e3e[_0x7fa9('0x31')]);_0x4fe851[_0x7fa9('0x33')]=_[_0x7fa9('0x32')](_0x501e3e[_0x7fa9('0x2e')],qs[_0x7fa9('0x34')](_0x25e02d[_0x7fa9('0x31')][_0x7fa9('0x34')]));_0x4fe851[_0x7fa9('0x33')]=_0x4fe851[_0x7fa9('0x33')][_0x7fa9('0x44')]?_0x4fe851['attributes']:_0x501e3e['model'];if(_0x25e02d[_0x7fa9('0x31')][_0x7fa9('0x3e')]){_0x4fe851[_0x7fa9('0x3f')]=[{'all':!![]}];}_0x4fe851=_[_0x7fa9('0x3a')]({},_0x4fe851,_0x25e02d['options']);return db['VtigerAccount'][_0x7fa9('0x45')](_0x4fe851)[_0x7fa9('0x3d')](handleEntityNotFound(_0x683926,null))[_0x7fa9('0x3d')](respondWithResult(_0x683926,null))[_0x7fa9('0x46')](handleError(_0x683926,null));};exports['create']=function(_0x429a49,_0x5566ec){return db['VtigerAccount'][_0x7fa9('0x47')](_0x429a49['body'],{})[_0x7fa9('0x3d')](respondWithResult(_0x5566ec,0xc9))[_0x7fa9('0x46')](handleError(_0x5566ec,null));};exports['update']=function(_0x1ae3b0,_0x358417){if(_0x1ae3b0[_0x7fa9('0x48')]['id']){delete _0x1ae3b0[_0x7fa9('0x48')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x1ae3b0['params']['id']}})[_0x7fa9('0x3d')](handleEntityNotFound(_0x358417,null))['then'](saveUpdates(_0x1ae3b0[_0x7fa9('0x48')],null))[_0x7fa9('0x3d')](respondWithResult(_0x358417,null))[_0x7fa9('0x46')](handleError(_0x358417,null));};exports[_0x7fa9('0x49')]=function(_0x213a3b,_0x800534){return db[_0x7fa9('0x40')][_0x7fa9('0x45')]({'where':{'id':_0x213a3b[_0x7fa9('0x42')]['id']}})[_0x7fa9('0x3d')](handleEntityNotFound(_0x800534,null))[_0x7fa9('0x3d')](removeEntity(_0x800534,null))[_0x7fa9('0x46')](handleError(_0x800534,null));};exports[_0x7fa9('0x4a')]=function(_0x30f2f4,_0x4e6bd1,_0x53357f){var _0x4496d1={};var _0x4752f5={};var _0x54b156;var _0x2f07c3;return db[_0x7fa9('0x40')][_0x7fa9('0x4b')]({'where':{'id':_0x30f2f4['params']['id']}})[_0x7fa9('0x3d')](handleEntityNotFound(_0x4e6bd1,null))['then'](function(_0x22ec55){if(_0x22ec55){_0x54b156=_0x22ec55;_0x4752f5[_0x7fa9('0x2e')]=_[_0x7fa9('0x30')](db[_0x7fa9('0x4c')][_0x7fa9('0x43')]);_0x4752f5[_0x7fa9('0x31')]=_[_0x7fa9('0x30')](_0x30f2f4[_0x7fa9('0x31')]);_0x4752f5[_0x7fa9('0x37')]=_[_0x7fa9('0x32')](_0x4752f5[_0x7fa9('0x2e')],_0x4752f5[_0x7fa9('0x31')]);_0x4496d1[_0x7fa9('0x33')]=_[_0x7fa9('0x32')](_0x4752f5[_0x7fa9('0x2e')],qs[_0x7fa9('0x34')](_0x30f2f4['query'][_0x7fa9('0x34')]));_0x4496d1[_0x7fa9('0x33')]=_0x4496d1[_0x7fa9('0x33')][_0x7fa9('0x44')]?_0x4496d1[_0x7fa9('0x33')]:_0x4752f5[_0x7fa9('0x2e')];_0x4496d1[_0x7fa9('0x4d')]=qs[_0x7fa9('0x35')](_0x30f2f4[_0x7fa9('0x31')]['sort']);_0x4496d1[_0x7fa9('0x36')]=qs[_0x7fa9('0x37')](_[_0x7fa9('0x38')](_0x30f2f4['query'],_0x4752f5[_0x7fa9('0x37')]));if(_0x30f2f4['query'][_0x7fa9('0x39')]){_0x4496d1[_0x7fa9('0x36')]=_[_0x7fa9('0x3a')](_0x4496d1['where'],{'$or':_[_0x7fa9('0x2f')](_0x4496d1[_0x7fa9('0x33')],function(_0x21953e){var _0xf94e45={};_0xf94e45[_0x21953e]={'$like':'%'+_0x30f2f4[_0x7fa9('0x31')][_0x7fa9('0x39')]+'%'};return _0xf94e45;})});}_0x4496d1=_[_0x7fa9('0x3a')]({},_0x4496d1,_0x30f2f4['options']);return _0x54b156[_0x7fa9('0x4a')](_0x4496d1);}})[_0x7fa9('0x3d')](function(_0x2934f9){if(_0x2934f9){_0x2f07c3=_0x2934f9[_0x7fa9('0x44')];if(!_0x30f2f4['query'][_0x7fa9('0x4e')](_0x7fa9('0x4f'))){_0x4496d1[_0x7fa9('0x20')]=qs[_0x7fa9('0x20')](_0x30f2f4[_0x7fa9('0x31')]['limit']);_0x4496d1[_0x7fa9('0x1e')]=qs[_0x7fa9('0x1e')](_0x30f2f4['query']['offset']);}return _0x54b156[_0x7fa9('0x4a')](_0x4496d1);}})['then'](function(_0x5765c8){if(_0x5765c8){return _0x5765c8?{'count':_0x2f07c3,'rows':_0x5765c8}:null;}})['then'](respondWithResult(_0x4e6bd1,null))[_0x7fa9('0x46')](handleError(_0x4e6bd1,null));};exports[_0x7fa9('0x50')]=function(_0x24b686,_0x5b8aac,_0xcd1c97){if(_0x24b686[_0x7fa9('0x48')]['id']){delete _0x24b686['body']['id'];}return db[_0x7fa9('0x40')][_0x7fa9('0x4b')]({'where':{'id':_0x24b686['params']['id']}})[_0x7fa9('0x3d')](handleEntityNotFound(_0x5b8aac,null))[_0x7fa9('0x3d')](function(_0xb23929){if(_0xb23929){_0x24b686['body'][_0x7fa9('0x51')]=_0xb23929['id'];_0x24b686[_0x7fa9('0x48')]['Subjects']=integrations['getSubjects'](_0x24b686[_0x7fa9('0x48')][_0x7fa9('0x52')],_0x24b686[_0x7fa9('0x48')][_0x7fa9('0x2c')]);_0x24b686[_0x7fa9('0x48')][_0x7fa9('0x53')]=integrations[_0x7fa9('0x54')](_0x24b686[_0x7fa9('0x48')][_0x7fa9('0x52')],_0x24b686[_0x7fa9('0x48')]['type']);return db['VtigerConfiguration'][_0x7fa9('0x47')](_0x24b686[_0x7fa9('0x48')],{'include':[{'model':db[_0x7fa9('0x55')],'as':_0x7fa9('0x56')},{'model':db[_0x7fa9('0x55')],'as':'Descriptions'}]});}return null;})[_0x7fa9('0x3d')](respondWithResult(_0x5b8aac,null))[_0x7fa9('0x46')](handleError(_0x5b8aac,null));};var md5=require(_0x7fa9('0x57'));exports[_0x7fa9('0x58')]=function(_0x149588,_0x4d7405,_0x241079){var _0x4ca1bb=null;var _0x37aa5e=null;var _0xd275c3=null;var _0x45aab5=null;var _0x439c16='';return db[_0x7fa9('0x40')]['findOne']({'where':{'id':_0x149588[_0x7fa9('0x42')]['id']},'attributes':['id',_0x7fa9('0x29'),'username',_0x7fa9('0x59'),'moduleName',_0x7fa9('0x5a'),'serverUrl',_0x7fa9('0x5b')]})['then'](handleEntityNotFound(_0x4d7405,null))['then'](function(_0x5d7910){if(_0x5d7910){_0x4ca1bb=_0x5d7910[_0x7fa9('0x5c')];_0x37aa5e=_0x5d7910['accessKey'];_0xd275c3=_0x5d7910[_0x7fa9('0x5d')];_0x439c16=_0x5d7910['remoteUri'];var _0x527760=_0x439c16[_0x7fa9('0x5e')](-0x1);if(_0x527760==='/'){_0x439c16=_0x439c16[_0x7fa9('0x5f')](0x0,_0x439c16[_0x7fa9('0x60')](_0x527760));}_0x45aab5=util['format']('%s/webservice.php',_0x439c16);var _0x567db4={'method':_0x7fa9('0x61'),'uri':_0x45aab5,'qs':{'operation':_0x7fa9('0x62'),'username':_0x5d7910[_0x7fa9('0x5c')]},'json':!![]};return rp(_0x567db4);}})[_0x7fa9('0x3d')](function(_0x5048c2){if(_0x5048c2['success']){var _0x2514fd={'method':_0x7fa9('0x63'),'uri':_0x45aab5,'form':{'operation':'login','username':_0x4ca1bb,'accessKey':md5(_0x5048c2['result']['token']+_0x37aa5e)},'json':!![]};return rp(_0x2514fd);}})[_0x7fa9('0x3d')](function(_0x5882f9){if(_0x5882f9['success']){var _0x136cd2={'method':_0x7fa9('0x61'),'uri':_0x45aab5,'qs':{'operation':_0x7fa9('0x64'),'username':_0x4ca1bb,'sessionName':_0x5882f9['result']['sessionName'],'elementType':_0xd275c3},'json':!![]};return rp(_0x136cd2);}})[_0x7fa9('0x3d')](function(_0x254491){if(_0x254491[_0x7fa9('0x65')]){var _0x5c29be=[_0x7fa9('0x66'),'reference',_0x7fa9('0x67')];_[_0x7fa9('0x68')](_0x254491[_0x7fa9('0x69')][_0x7fa9('0x34')],function(_0x45891a){return _0x5c29be[_0x7fa9('0x6a')](_0x45891a[_0x7fa9('0x2c')][_0x7fa9('0x29')]);});_['remove'](_0x254491[_0x7fa9('0x69')]['fields'],function(_0x4d29ae){return _0x4d29ae[_0x7fa9('0x6b')]===_0x7fa9('0x6c');});return{'count':_0x254491['result'][_0x7fa9('0x34')][_0x7fa9('0x44')],'rows':_[_0x7fa9('0x2f')](_0x254491[_0x7fa9('0x69')][_0x7fa9('0x34')],function(_0x556a53){return{'id':_0x556a53['name'],'name':_0x556a53[_0x7fa9('0x6d')],'custom':_[_0x7fa9('0x6e')](_0x556a53['name'],'cf_')?!![]:![],'options':_0x556a53['type'][_0x7fa9('0x29')]===_0x7fa9('0x6f')&&_0x556a53['type'][_0x7fa9('0x70')][_0x7fa9('0x44')]>0x0?_[_0x7fa9('0x2f')](_0x556a53[_0x7fa9('0x2c')][_0x7fa9('0x70')],function(_0x5b5c9b){return{'name':_0x5b5c9b[_0x7fa9('0x6d')],'value':_0x5b5c9b[_0x7fa9('0x71')]};}):[]};})};}})[_0x7fa9('0x3d')](respondWithResult(_0x4d7405,null))[_0x7fa9('0x46')](function(_0xc97afd){console[_0x7fa9('0x72')](_0x7fa9('0x73')+_0xc97afd);var _0x369c5a=_0x149588[_0x7fa9('0x31')][_0x7fa9('0x74')]?0x1f4:_0xc97afd[_0x7fa9('0x75')]||0x1f4;logger[_0x7fa9('0x27')](_0x7fa9('0x76'),_0x7fa9('0x58'),_0x369c5a,JSON[_0x7fa9('0x77')](_0xc97afd));delete _0xc97afd[_0x7fa9('0x29')];if(_0x369c5a===0x191){_0x369c5a=0x190;}_0x4d7405[_0x7fa9('0x1b')](_0x369c5a)[_0x7fa9('0x78')](_0x149588[_0x7fa9('0x31')][_0x7fa9('0x74')]?{'message':_0x7fa9('0x79'),'statusCode':_0xc97afd[_0x7fa9('0x75')]}:_0xc97afd);});}; \ No newline at end of file +var _0xbd49=['serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','autogenerated','reference','remove','includes','editable','label','startsWith','cf_','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','destroy','error','name','index','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','show','params','fields','options','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName'];(function(_0x17544d,_0x3f421c){var _0x2ed2a8=function(_0x1d7229){while(--_0x1d7229){_0x17544d['push'](_0x17544d['shift']());}};_0x2ed2a8(++_0x3f421c);}(_0xbd49,0x1ef));var _0x9bd4=function(_0x4d2d0c,_0x41e1f5){_0x4d2d0c=_0x4d2d0c-0x0;var _0x404e4e=_0xbd49[_0x4d2d0c];return _0x404e4e;};'use strict';var emlformat=require(_0x9bd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9bd4('0x1'));var moment=require(_0x9bd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9bd4('0x3'));var util=require(_0x9bd4('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9bd4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bd4('0x6'));var _=require(_0x9bd4('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9bd4('0x8'));var deskjs=require(_0x9bd4('0x9'));var toCsv=require(_0x9bd4('0x5'));var querystring=require(_0x9bd4('0xa'));var Papa=require(_0x9bd4('0xb'));var Redis=require(_0x9bd4('0xc'));var authService=require(_0x9bd4('0xd'));var qs=require(_0x9bd4('0xe'));var as=require(_0x9bd4('0xf'));var hardwareService=require(_0x9bd4('0x10'));var logger=require(_0x9bd4('0x11'))(_0x9bd4('0x12'));var utils=require(_0x9bd4('0x13'));var config=require(_0x9bd4('0x14'));var licenseUtil=require(_0x9bd4('0x15'));var db=require(_0x9bd4('0x16'))['db'];var integrations=require(_0x9bd4('0x17'));function respondWithStatusCode(_0x4e3dd7,_0x4cf124){_0x4cf124=_0x4cf124||0xcc;return function(_0xf009be){if(_0xf009be){return _0x4e3dd7[_0x9bd4('0x18')](_0x4cf124);}return _0x4e3dd7[_0x9bd4('0x19')](_0x4cf124)[_0x9bd4('0x1a')]();};}function respondWithResult(_0x43c5da,_0x21e1c2){_0x21e1c2=_0x21e1c2||0xc8;return function(_0x2f18e0){if(_0x2f18e0){return _0x43c5da[_0x9bd4('0x19')](_0x21e1c2)[_0x9bd4('0x1b')](_0x2f18e0);}};}function respondWithFilteredResult(_0x52b842,_0x243d7c){return function(_0x4515f6){if(_0x4515f6){var _0x429b54=typeof _0x243d7c['offset']===_0x9bd4('0x1c')&&typeof _0x243d7c[_0x9bd4('0x1d')]===_0x9bd4('0x1c');var _0x4bb034=_0x4515f6[_0x9bd4('0x1e')];var _0x544863=_0x429b54?0x0:_0x243d7c[_0x9bd4('0x1f')];var _0x1647ae=_0x429b54?_0x4515f6[_0x9bd4('0x1e')]:_0x243d7c[_0x9bd4('0x1f')]+_0x243d7c[_0x9bd4('0x1d')];var _0x5653b1;if(_0x1647ae>=_0x4bb034){_0x1647ae=_0x4bb034;_0x5653b1=0xc8;}else{_0x5653b1=0xce;}_0x52b842[_0x9bd4('0x19')](_0x5653b1);return _0x52b842['set']('Content-Range',_0x544863+'-'+_0x1647ae+'/'+_0x4bb034)[_0x9bd4('0x1b')](_0x4515f6);}return null;};}function patchUpdates(_0x1d6614){return function(_0x468f84){try{jsonpatch[_0x9bd4('0x20')](_0x468f84,_0x1d6614,!![]);}catch(_0x27ed73){return BPromise[_0x9bd4('0x21')](_0x27ed73);}return _0x468f84['save']();};}function saveUpdates(_0x80f76e,_0x281a08){return function(_0x948c0f){if(_0x948c0f){return _0x948c0f[_0x9bd4('0x22')](_0x80f76e)[_0x9bd4('0x23')](function(_0x5d3a42){return _0x5d3a42;});}return null;};}function removeEntity(_0x39d33e,_0x571256){return function(_0x5dc000){if(_0x5dc000){return _0x5dc000[_0x9bd4('0x24')]()[_0x9bd4('0x23')](function(){_0x39d33e[_0x9bd4('0x19')](0xcc)[_0x9bd4('0x1a')]();});}};}function handleEntityNotFound(_0x161a87,_0x5337e1){return function(_0x56e5b8){if(!_0x56e5b8){_0x161a87[_0x9bd4('0x18')](0x194);}return _0x56e5b8;};}function handleError(_0x498424,_0x4a37c9){_0x4a37c9=_0x4a37c9||0x1f4;return function(_0x167509){logger[_0x9bd4('0x25')](_0x167509['stack']);if(_0x167509[_0x9bd4('0x26')]){delete _0x167509['name'];}_0x498424[_0x9bd4('0x19')](_0x4a37c9)['send'](_0x167509);};}exports[_0x9bd4('0x27')]=function(_0x306775,_0x194214){var _0x14cbdf={},_0x4d3492={},_0x13f078={'count':0x0,'rows':[]};var _0x20d21d=_[_0x9bd4('0x28')](db[_0x9bd4('0x29')][_0x9bd4('0x2a')],function(_0x2bd2d4){return{'name':_0x2bd2d4['fieldName'],'type':_0x2bd2d4[_0x9bd4('0x2b')][_0x9bd4('0x2c')]};});_0x4d3492[_0x9bd4('0x2d')]=_[_0x9bd4('0x28')](_0x20d21d,_0x9bd4('0x26'));_0x4d3492[_0x9bd4('0x2e')]=_[_0x9bd4('0x2f')](_0x306775[_0x9bd4('0x2e')]);_0x4d3492[_0x9bd4('0x30')]=_[_0x9bd4('0x31')](_0x4d3492['model'],_0x4d3492['query']);_0x14cbdf[_0x9bd4('0x32')]=_['intersection'](_0x4d3492[_0x9bd4('0x2d')],qs['fields'](_0x306775[_0x9bd4('0x2e')]['fields']));_0x14cbdf[_0x9bd4('0x32')]=_0x14cbdf[_0x9bd4('0x32')][_0x9bd4('0x33')]?_0x14cbdf[_0x9bd4('0x32')]:_0x4d3492[_0x9bd4('0x2d')];if(!_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x34')](_0x9bd4('0x35'))){_0x14cbdf[_0x9bd4('0x1d')]=qs[_0x9bd4('0x1d')](_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x1d')]);_0x14cbdf[_0x9bd4('0x1f')]=qs[_0x9bd4('0x1f')](_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x1f')]);}_0x14cbdf[_0x9bd4('0x36')]=qs[_0x9bd4('0x37')](_0x306775['query'][_0x9bd4('0x37')]);_0x14cbdf[_0x9bd4('0x38')]=qs[_0x9bd4('0x30')](_['pick'](_0x306775[_0x9bd4('0x2e')],_0x4d3492['filters']),_0x20d21d);if(_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x39')]){_0x14cbdf[_0x9bd4('0x38')]=_['merge'](_0x14cbdf['where'],{'$or':_[_0x9bd4('0x28')](_0x20d21d,function(_0x592c8b){if(_0x592c8b[_0x9bd4('0x2b')]!==_0x9bd4('0x3a')){var _0x3a49b2={};_0x3a49b2[_0x592c8b[_0x9bd4('0x26')]]={'$like':'%'+_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x39')]+'%'};return _0x3a49b2;}})});}_0x14cbdf=_[_0x9bd4('0x3b')]({},_0x14cbdf,_0x306775['options']);var _0x5b828c={'where':_0x14cbdf['where']};return db['VtigerAccount'][_0x9bd4('0x1e')](_0x5b828c)[_0x9bd4('0x23')](function(_0x251bdb){_0x13f078['count']=_0x251bdb;if(_0x306775[_0x9bd4('0x2e')][_0x9bd4('0x3c')]){_0x14cbdf[_0x9bd4('0x3d')]=[{'all':!![]}];}return db[_0x9bd4('0x29')]['findAll'](_0x14cbdf);})['then'](function(_0x134053){_0x13f078[_0x9bd4('0x3e')]=_0x134053;return _0x13f078;})[_0x9bd4('0x23')](respondWithFilteredResult(_0x194214,_0x14cbdf))['catch'](handleError(_0x194214,null));};exports[_0x9bd4('0x3f')]=function(_0x4e8542,_0x69f4e){var _0x530bda={'raw':![],'where':{'id':_0x4e8542[_0x9bd4('0x40')]['id']}},_0x11a084={};_0x11a084[_0x9bd4('0x2d')]=_[_0x9bd4('0x2f')](db['VtigerAccount']['rawAttributes']);_0x11a084[_0x9bd4('0x2e')]=_[_0x9bd4('0x2f')](_0x4e8542[_0x9bd4('0x2e')]);_0x11a084['filters']=_[_0x9bd4('0x31')](_0x11a084[_0x9bd4('0x2d')],_0x11a084[_0x9bd4('0x2e')]);_0x530bda[_0x9bd4('0x32')]=_[_0x9bd4('0x31')](_0x11a084[_0x9bd4('0x2d')],qs['fields'](_0x4e8542[_0x9bd4('0x2e')][_0x9bd4('0x41')]));_0x530bda[_0x9bd4('0x32')]=_0x530bda[_0x9bd4('0x32')]['length']?_0x530bda[_0x9bd4('0x32')]:_0x11a084[_0x9bd4('0x2d')];if(_0x4e8542[_0x9bd4('0x2e')][_0x9bd4('0x3c')]){_0x530bda[_0x9bd4('0x3d')]=[{'all':!![]}];}_0x530bda=_[_0x9bd4('0x3b')]({},_0x530bda,_0x4e8542[_0x9bd4('0x42')]);return db[_0x9bd4('0x29')][_0x9bd4('0x43')](_0x530bda)[_0x9bd4('0x23')](handleEntityNotFound(_0x69f4e,null))[_0x9bd4('0x23')](respondWithResult(_0x69f4e,null))[_0x9bd4('0x44')](handleError(_0x69f4e,null));};exports[_0x9bd4('0x45')]=function(_0x7b2868,_0x2ff303){return db['VtigerAccount'][_0x9bd4('0x45')](_0x7b2868[_0x9bd4('0x46')],{})['then'](respondWithResult(_0x2ff303,0xc9))['catch'](handleError(_0x2ff303,null));};exports[_0x9bd4('0x22')]=function(_0x2b3c09,_0x3fdb82){if(_0x2b3c09['body']['id']){delete _0x2b3c09['body']['id'];}return db[_0x9bd4('0x29')][_0x9bd4('0x43')]({'where':{'id':_0x2b3c09['params']['id']}})[_0x9bd4('0x23')](handleEntityNotFound(_0x3fdb82,null))[_0x9bd4('0x23')](saveUpdates(_0x2b3c09[_0x9bd4('0x46')],null))[_0x9bd4('0x23')](respondWithResult(_0x3fdb82,null))[_0x9bd4('0x44')](handleError(_0x3fdb82,null));};exports['destroy']=function(_0x1d65ef,_0x24f7f0){return db['VtigerAccount'][_0x9bd4('0x43')]({'where':{'id':_0x1d65ef[_0x9bd4('0x40')]['id']}})[_0x9bd4('0x23')](handleEntityNotFound(_0x24f7f0,null))[_0x9bd4('0x23')](removeEntity(_0x24f7f0,null))[_0x9bd4('0x44')](handleError(_0x24f7f0,null));};exports[_0x9bd4('0x47')]=function(_0x4295cd,_0x52eea8,_0xdf3197){var _0xb70f79={};var _0x3f6acb={};var _0x1c3eb9;var _0x16a61c;return db[_0x9bd4('0x29')][_0x9bd4('0x48')]({'where':{'id':_0x4295cd[_0x9bd4('0x40')]['id']}})[_0x9bd4('0x23')](handleEntityNotFound(_0x52eea8,null))[_0x9bd4('0x23')](function(_0x3062bb){if(_0x3062bb){_0x1c3eb9=_0x3062bb;_0x3f6acb[_0x9bd4('0x2d')]=_['keys'](db['VtigerConfiguration'][_0x9bd4('0x2a')]);_0x3f6acb[_0x9bd4('0x2e')]=_[_0x9bd4('0x2f')](_0x4295cd[_0x9bd4('0x2e')]);_0x3f6acb['filters']=_['intersection'](_0x3f6acb[_0x9bd4('0x2d')],_0x3f6acb['query']);_0xb70f79[_0x9bd4('0x32')]=_[_0x9bd4('0x31')](_0x3f6acb['model'],qs[_0x9bd4('0x41')](_0x4295cd['query'][_0x9bd4('0x41')]));_0xb70f79['attributes']=_0xb70f79[_0x9bd4('0x32')][_0x9bd4('0x33')]?_0xb70f79[_0x9bd4('0x32')]:_0x3f6acb[_0x9bd4('0x2d')];_0xb70f79[_0x9bd4('0x36')]=qs[_0x9bd4('0x37')](_0x4295cd[_0x9bd4('0x2e')][_0x9bd4('0x37')]);_0xb70f79['where']=qs[_0x9bd4('0x30')](_['pick'](_0x4295cd[_0x9bd4('0x2e')],_0x3f6acb[_0x9bd4('0x30')]));if(_0x4295cd[_0x9bd4('0x2e')][_0x9bd4('0x39')]){_0xb70f79[_0x9bd4('0x38')]=_[_0x9bd4('0x3b')](_0xb70f79['where'],{'$or':_[_0x9bd4('0x28')](_0xb70f79['attributes'],function(_0x51c120){var _0x7567ed={};_0x7567ed[_0x51c120]={'$like':'%'+_0x4295cd[_0x9bd4('0x2e')][_0x9bd4('0x39')]+'%'};return _0x7567ed;})});}_0xb70f79=_['merge']({},_0xb70f79,_0x4295cd[_0x9bd4('0x42')]);return _0x1c3eb9[_0x9bd4('0x47')](_0xb70f79);}})[_0x9bd4('0x23')](function(_0x503b32){if(_0x503b32){_0x16a61c=_0x503b32[_0x9bd4('0x33')];if(!_0x4295cd[_0x9bd4('0x2e')][_0x9bd4('0x34')](_0x9bd4('0x35'))){_0xb70f79['limit']=qs['limit'](_0x4295cd['query']['limit']);_0xb70f79[_0x9bd4('0x1f')]=qs[_0x9bd4('0x1f')](_0x4295cd[_0x9bd4('0x2e')][_0x9bd4('0x1f')]);}return _0x1c3eb9['getConfigurations'](_0xb70f79);}})[_0x9bd4('0x23')](function(_0x1f7b8f){if(_0x1f7b8f){return _0x1f7b8f?{'count':_0x16a61c,'rows':_0x1f7b8f}:null;}})[_0x9bd4('0x23')](respondWithResult(_0x52eea8,null))['catch'](handleError(_0x52eea8,null));};exports[_0x9bd4('0x49')]=function(_0x324f5d,_0x41fcf5,_0x525765){if(_0x324f5d[_0x9bd4('0x46')]['id']){delete _0x324f5d[_0x9bd4('0x46')]['id'];}return db[_0x9bd4('0x29')][_0x9bd4('0x48')]({'where':{'id':_0x324f5d['params']['id']}})[_0x9bd4('0x23')](handleEntityNotFound(_0x41fcf5,null))[_0x9bd4('0x23')](function(_0x2e6057){if(_0x2e6057){_0x324f5d['body'][_0x9bd4('0x4a')]=_0x2e6057['id'];_0x324f5d[_0x9bd4('0x46')][_0x9bd4('0x4b')]=integrations['getSubjects'](_0x324f5d['body'][_0x9bd4('0x4c')],_0x324f5d['body'][_0x9bd4('0x2b')]);_0x324f5d['body'][_0x9bd4('0x4d')]=integrations[_0x9bd4('0x4e')](_0x324f5d[_0x9bd4('0x46')]['channel'],_0x324f5d['body'][_0x9bd4('0x2b')]);return db[_0x9bd4('0x4f')][_0x9bd4('0x45')](_0x324f5d[_0x9bd4('0x46')],{'include':[{'model':db[_0x9bd4('0x50')],'as':_0x9bd4('0x4b')},{'model':db[_0x9bd4('0x50')],'as':'Descriptions'}]});}return null;})[_0x9bd4('0x23')](respondWithResult(_0x41fcf5,null))[_0x9bd4('0x44')](handleError(_0x41fcf5,null));};var md5=require(_0x9bd4('0x51'));exports['getFields']=function(_0x30aae2,_0x3f6b8f,_0x9f47ac){var _0x11cd81=null;var _0x3473ae=null;var _0xc9361c=null;var _0x252431=null;var _0x210d23='';return db[_0x9bd4('0x29')][_0x9bd4('0x48')]({'where':{'id':_0x30aae2['params']['id']},'attributes':['id',_0x9bd4('0x26'),_0x9bd4('0x52'),_0x9bd4('0x53'),_0x9bd4('0x54'),'remoteUri',_0x9bd4('0x55'),'accessKey']})[_0x9bd4('0x23')](handleEntityNotFound(_0x3f6b8f,null))[_0x9bd4('0x23')](function(_0x3bfb0c){if(_0x3bfb0c){_0x11cd81=_0x3bfb0c[_0x9bd4('0x52')];_0x3473ae=_0x3bfb0c[_0x9bd4('0x56')];_0xc9361c=_0x3bfb0c['moduleName'];_0x210d23=_0x3bfb0c['remoteUri'];var _0x5081e0=_0x210d23[_0x9bd4('0x57')](-0x1);if(_0x5081e0==='/'){_0x210d23=_0x210d23[_0x9bd4('0x58')](0x0,_0x210d23[_0x9bd4('0x59')](_0x5081e0));}_0x252431=util['format'](_0x9bd4('0x5a'),_0x210d23);var _0xcdf1ec={'method':_0x9bd4('0x5b'),'uri':_0x252431,'qs':{'operation':_0x9bd4('0x5c'),'username':_0x3bfb0c[_0x9bd4('0x52')]},'json':!![]};return rp(_0xcdf1ec);}})['then'](function(_0x4e72e3){if(_0x4e72e3[_0x9bd4('0x5d')]){var _0x11e150={'method':_0x9bd4('0x5e'),'uri':_0x252431,'form':{'operation':_0x9bd4('0x5f'),'username':_0x11cd81,'accessKey':md5(_0x4e72e3[_0x9bd4('0x60')][_0x9bd4('0x61')]+_0x3473ae)},'json':!![]};return rp(_0x11e150);}})[_0x9bd4('0x23')](function(_0x2cabd1){if(_0x2cabd1['success']){var _0x22df69={'method':'GET','uri':_0x252431,'qs':{'operation':_0x9bd4('0x62'),'username':_0x11cd81,'sessionName':_0x2cabd1[_0x9bd4('0x60')]['sessionName'],'elementType':_0xc9361c},'json':!![]};return rp(_0x22df69);}})['then'](function(_0x9ed056){if(_0x9ed056['success']){var _0x59d688=[_0x9bd4('0x63'),_0x9bd4('0x64'),'owner'];_[_0x9bd4('0x65')](_0x9ed056[_0x9bd4('0x60')][_0x9bd4('0x41')],function(_0x311897){return _0x59d688[_0x9bd4('0x66')](_0x311897[_0x9bd4('0x2b')][_0x9bd4('0x26')]);});_[_0x9bd4('0x65')](_0x9ed056[_0x9bd4('0x60')]['fields'],function(_0x384394){return _0x384394[_0x9bd4('0x67')]==='false';});return{'count':_0x9ed056[_0x9bd4('0x60')][_0x9bd4('0x41')][_0x9bd4('0x33')],'rows':_[_0x9bd4('0x28')](_0x9ed056[_0x9bd4('0x60')][_0x9bd4('0x41')],function(_0x4d8778){return{'id':_0x4d8778[_0x9bd4('0x26')],'name':_0x4d8778[_0x9bd4('0x68')],'custom':_[_0x9bd4('0x69')](_0x4d8778[_0x9bd4('0x26')],_0x9bd4('0x6a'))?!![]:![],'options':_0x4d8778[_0x9bd4('0x2b')][_0x9bd4('0x26')]==='picklist'&&_0x4d8778['type']['picklistValues'][_0x9bd4('0x33')]>0x0?_[_0x9bd4('0x28')](_0x4d8778['type'][_0x9bd4('0x6b')],function(_0x44afeb){return{'name':_0x44afeb[_0x9bd4('0x68')],'value':_0x44afeb[_0x9bd4('0x6c')]};}):[]};})};}})[_0x9bd4('0x23')](respondWithResult(_0x3f6b8f,null))[_0x9bd4('0x44')](function(_0x4c2c0a){console[_0x9bd4('0x6d')]('vTiger\x20error:\x20'+_0x4c2c0a);var _0x58f335=_0x30aae2[_0x9bd4('0x2e')][_0x9bd4('0x6e')]?0x1f4:_0x4c2c0a['statusCode']||0x1f4;logger['error'](_0x9bd4('0x6f'),_0x9bd4('0x70'),_0x58f335,JSON['stringify'](_0x4c2c0a));delete _0x4c2c0a[_0x9bd4('0x26')];if(_0x58f335===0x191){_0x58f335=0x190;}_0x3f6b8f[_0x9bd4('0x19')](_0x58f335)[_0x9bd4('0x71')](_0x30aae2[_0x9bd4('0x2e')][_0x9bd4('0x6e')]?{'message':_0x9bd4('0x72'),'statusCode':_0x4c2c0a[_0x9bd4('0x73')]}:_0x4c2c0a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2bbea14..53cdd73 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 _0xd927=['exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x25826d,_0x5d5d43){var _0x4aa6d5=function(_0x2bd8d1){while(--_0x2bd8d1){_0x25826d['push'](_0x25826d['shift']());}};_0x4aa6d5(++_0x5d5d43);}(_0xd927,0x17a));var _0x7d92=function(_0x3e5b15,_0x4346fc){_0x3e5b15=_0x3e5b15-0x0;var _0x242e54=_0xd927[_0x3e5b15];return _0x242e54;};'use strict';var _=require(_0x7d92('0x0'));var util=require(_0x7d92('0x1'));var logger=require(_0x7d92('0x2'))(_0x7d92('0x3'));var moment=require(_0x7d92('0x4'));var BPromise=require(_0x7d92('0x5'));var rp=require(_0x7d92('0x6'));var fs=require('fs');var path=require(_0x7d92('0x7'));var rimraf=require(_0x7d92('0x8'));var config=require(_0x7d92('0x9'));var attributes=require(_0x7d92('0xa'));var integrations=require(_0x7d92('0xb'));module[_0x7d92('0xc')]=function(_0x498f1b,_0x4dca6d){return _0x498f1b['define'](_0x7d92('0xd'),attributes,{'tableName':_0x7d92('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf321=['path','VtigerAccount','int_vtiger_accounts','util','api','moment','bluebird','request-promise'];(function(_0x1af7af,_0x5e64c5){var _0x1a59be=function(_0x443fa7){while(--_0x443fa7){_0x1af7af['push'](_0x1af7af['shift']());}};_0x1a59be(++_0x5e64c5);}(_0xf321,0x14b));var _0x1f32=function(_0xc15654,_0x26f5da){_0xc15654=_0xc15654-0x0;var _0x2ea802=_0xf321[_0xc15654];return _0x2ea802;};'use strict';var _=require('lodash');var util=require(_0x1f32('0x0'));var logger=require('../../config/logger')(_0x1f32('0x1'));var moment=require(_0x1f32('0x2'));var BPromise=require(_0x1f32('0x3'));var rp=require(_0x1f32('0x4'));var fs=require('fs');var path=require(_0x1f32('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xed0396,_0x50d89e){return _0xed0396['define'](_0x1f32('0x6'),attributes,{'tableName':_0x1f32('0x7'),'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 f837cf4..f606cd7 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 _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2d284c,_0x5e799b){var _0x1a3afa=function(_0x39bf13){while(--_0x39bf13){_0x2d284c['push'](_0x2d284c['shift']());}};_0x1a3afa(++_0x5e799b);}(_0x065e,0x1a7));var _0xe065=function(_0x113566,_0x78c52a){_0x113566=_0x113566-0x0;var _0x359407=_0x065e[_0x113566];return _0x359407;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file +var _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x572637,_0x216d95){var _0xb6748=function(_0x3eeb8c){while(--_0x3eeb8c){_0x572637['push'](_0x572637['shift']());}};_0xb6748(++_0x216d95);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ff6d663..c127db4 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 _0xd3a6=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x5530bf,_0x5c0708){var _0x5600c4=function(_0x34506c){while(--_0x34506c){_0x5530bf['push'](_0x5530bf['shift']());}};_0x5600c4(++_0x5c0708);}(_0xd3a6,0x126));var _0x6d3a=function(_0x1657a0,_0x39129c){_0x1657a0=_0x1657a0-0x0;var _0x5246bb=_0xd3a6[_0x1657a0];return _0x5246bb;};'use strict';var multer=require(_0x6d3a('0x0'));var util=require('util');var path=require(_0x6d3a('0x1'));var timeout=require(_0x6d3a('0x2'));var express=require('express');var router=express[_0x6d3a('0x3')]();var fs_extra=require(_0x6d3a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6d3a('0x5'));var config=require(_0x6d3a('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x6d3a('0x7')]('/',auth[_0x6d3a('0x8')](),controller[_0x6d3a('0x9')]);router[_0x6d3a('0x7')](_0x6d3a('0xa'),auth[_0x6d3a('0x8')](),controller['show']);router[_0x6d3a('0x7')](_0x6d3a('0xb'),auth[_0x6d3a('0x8')](),controller[_0x6d3a('0xc')]);router['get'](_0x6d3a('0xd'),auth[_0x6d3a('0x8')](),controller[_0x6d3a('0xe')]);router[_0x6d3a('0x7')](_0x6d3a('0xf'),auth[_0x6d3a('0x8')](),controller[_0x6d3a('0x10')]);router[_0x6d3a('0x11')]('/',auth[_0x6d3a('0x8')](),controller[_0x6d3a('0x12')]);router['put'](_0x6d3a('0xa'),auth['isAuthenticated'](),controller[_0x6d3a('0x13')]);router[_0x6d3a('0x14')](_0x6d3a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d3a('0x15')]=router; \ No newline at end of file +var _0x2edb=['delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','/:id/fields','isAuthenticated','getFields','/:id/descriptions','getDescriptions','post','put','/:id'];(function(_0x110f07,_0x523a8d){var _0x390dec=function(_0x16905d){while(--_0x16905d){_0x110f07['push'](_0x110f07['shift']());}};_0x390dec(++_0x523a8d);}(_0x2edb,0x18e));var _0xb2ed=function(_0x28d175,_0x5449c6){_0x28d175=_0x28d175-0x0;var _0x1ad2b0=_0x2edb[_0x28d175];return _0x1ad2b0;};'use strict';var multer=require('multer');var util=require(_0xb2ed('0x0'));var path=require(_0xb2ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2ed('0x2'));var router=express['Router']();var fs_extra=require(_0xb2ed('0x3'));var auth=require(_0xb2ed('0x4'));var interaction=require(_0xb2ed('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xb2ed('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb2ed('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb2ed('0x7')]);router[_0xb2ed('0x6')](_0xb2ed('0x8'),auth[_0xb2ed('0x9')](),controller[_0xb2ed('0xa')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xb2ed('0x6')](_0xb2ed('0xb'),auth[_0xb2ed('0x9')](),controller[_0xb2ed('0xc')]);router[_0xb2ed('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb2ed('0xe')](_0xb2ed('0xf'),auth[_0xb2ed('0x9')](),controller['update']);router[_0xb2ed('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb2ed('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2b73c96..c7844af 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 _0x7240=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7240,0x111));var _0x0724=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x7240[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require(_0x0724('0x0'));module[_0x0724('0x1')]={'name':{'type':Sequelize[_0x0724('0x2')]},'description':{'type':Sequelize[_0x0724('0x2')]}}; \ No newline at end of file +var _0xc366=['STRING','sequelize','exports'];(function(_0x168c41,_0x4d5871){var _0xed0f90=function(_0xb220fd){while(--_0xb220fd){_0x168c41['push'](_0x168c41['shift']());}};_0xed0f90(++_0x4d5871);}(_0xc366,0x64));var _0x6c36=function(_0x327fa2,_0xc7fdc5){_0x327fa2=_0x327fa2-0x0;var _0x4365a8=_0xc366[_0x327fa2];return _0x4365a8;};'use strict';var Sequelize=require(_0x6c36('0x0'));module[_0x6c36('0x1')]={'name':{'type':Sequelize[_0x6c36('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f528166..3273123 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 _0xee53=['find','getFields','findOne','VtigerField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','VIRTUAL','filter','includeAll','catch','params','include','options','create','body'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xee53,0xa8));var _0x3ee5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xee53[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ee5('0x0'));var jsonpatch=require(_0x3ee5('0x1'));var rp=require(_0x3ee5('0x2'));var moment=require('moment');var BPromise=require(_0x3ee5('0x3'));var Mustache=require(_0x3ee5('0x4'));var util=require(_0x3ee5('0x5'));var path=require(_0x3ee5('0x6'));var sox=require(_0x3ee5('0x7'));var csv=require(_0x3ee5('0x8'));var ejs=require(_0x3ee5('0x9'));var fs=require('fs');var fs_extra=require(_0x3ee5('0xa'));var _=require(_0x3ee5('0xb'));var squel=require(_0x3ee5('0xc'));var crypto=require(_0x3ee5('0xd'));var jsforce=require(_0x3ee5('0xe'));var deskjs=require(_0x3ee5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3ee5('0x10'));var Papa=require(_0x3ee5('0x11'));var Redis=require(_0x3ee5('0x12'));var authService=require(_0x3ee5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3ee5('0x14'));var hardwareService=require(_0x3ee5('0x15'));var logger=require(_0x3ee5('0x16'))(_0x3ee5('0x17'));var utils=require('../../config/utils');var config=require(_0x3ee5('0x18'));var licenseUtil=require(_0x3ee5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf85a3,_0x509a41){_0x509a41=_0x509a41||0xcc;return function(_0x10da9f){if(_0x10da9f){return _0xbf85a3['sendStatus'](_0x509a41);}return _0xbf85a3['status'](_0x509a41)[_0x3ee5('0x1a')]();};}function respondWithResult(_0x27816b,_0x244ca2){_0x244ca2=_0x244ca2||0xc8;return function(_0x21c9b6){if(_0x21c9b6){return _0x27816b[_0x3ee5('0x1b')](_0x244ca2)[_0x3ee5('0x1c')](_0x21c9b6);}};}function respondWithFilteredResult(_0x3ee06d,_0x1452b5){return function(_0x4023a9){if(_0x4023a9){var _0x5568f3=typeof _0x1452b5[_0x3ee5('0x1d')]==='undefined'&&typeof _0x1452b5[_0x3ee5('0x1e')]===_0x3ee5('0x1f');var _0x245aa9=_0x4023a9[_0x3ee5('0x20')];var _0x3a7356=_0x5568f3?0x0:_0x1452b5[_0x3ee5('0x1d')];var _0x6a8b6b=_0x5568f3?_0x4023a9['count']:_0x1452b5[_0x3ee5('0x1d')]+_0x1452b5[_0x3ee5('0x1e')];var _0x150187;if(_0x6a8b6b>=_0x245aa9){_0x6a8b6b=_0x245aa9;_0x150187=0xc8;}else{_0x150187=0xce;}_0x3ee06d[_0x3ee5('0x1b')](_0x150187);return _0x3ee06d['set'](_0x3ee5('0x21'),_0x3a7356+'-'+_0x6a8b6b+'/'+_0x245aa9)[_0x3ee5('0x1c')](_0x4023a9);}return null;};}function patchUpdates(_0x203a60){return function(_0xa872c4){try{jsonpatch[_0x3ee5('0x22')](_0xa872c4,_0x203a60,!![]);}catch(_0x5d6c3e){return BPromise[_0x3ee5('0x23')](_0x5d6c3e);}return _0xa872c4[_0x3ee5('0x24')]();};}function saveUpdates(_0x591bde,_0x4a3b83){return function(_0x1b5139){if(_0x1b5139){return _0x1b5139[_0x3ee5('0x25')](_0x591bde)[_0x3ee5('0x26')](function(_0x4f3d8c){return _0x4f3d8c;});}return null;};}function removeEntity(_0x1f5871,_0x4d7114){return function(_0x318c36){if(_0x318c36){return _0x318c36[_0x3ee5('0x27')]()['then'](function(){_0x1f5871[_0x3ee5('0x1b')](0xcc)[_0x3ee5('0x1a')]();});}};}function handleEntityNotFound(_0x31d980,_0x11db5c){return function(_0x388b58){if(!_0x388b58){_0x31d980[_0x3ee5('0x28')](0x194);}return _0x388b58;};}function handleError(_0x2e0794,_0x482593){_0x482593=_0x482593||0x1f4;return function(_0x415f50){logger[_0x3ee5('0x29')](_0x415f50[_0x3ee5('0x2a')]);if(_0x415f50['name']){delete _0x415f50[_0x3ee5('0x2b')];}_0x2e0794['status'](_0x482593)[_0x3ee5('0x2c')](_0x415f50);};}exports[_0x3ee5('0x2d')]=function(_0x2ec4ac,_0x47f620){var _0xb8f45f={},_0x10cd45={},_0x44faa4={'count':0x0,'rows':[]};var _0x1b7356=_['map'](db[_0x3ee5('0x2e')][_0x3ee5('0x2f')],function(_0x3f4cd2){return{'name':_0x3f4cd2[_0x3ee5('0x30')],'type':_0x3f4cd2[_0x3ee5('0x31')]['key']};});_0x10cd45[_0x3ee5('0x32')]=_['map'](_0x1b7356,'name');_0x10cd45[_0x3ee5('0x33')]=_[_0x3ee5('0x34')](_0x2ec4ac[_0x3ee5('0x33')]);_0x10cd45['filters']=_[_0x3ee5('0x35')](_0x10cd45[_0x3ee5('0x32')],_0x10cd45[_0x3ee5('0x33')]);_0xb8f45f[_0x3ee5('0x36')]=_['intersection'](_0x10cd45[_0x3ee5('0x32')],qs[_0x3ee5('0x37')](_0x2ec4ac[_0x3ee5('0x33')][_0x3ee5('0x37')]));_0xb8f45f[_0x3ee5('0x36')]=_0xb8f45f[_0x3ee5('0x36')][_0x3ee5('0x38')]?_0xb8f45f[_0x3ee5('0x36')]:_0x10cd45[_0x3ee5('0x32')];if(!_0x2ec4ac['query'][_0x3ee5('0x39')](_0x3ee5('0x3a'))){_0xb8f45f[_0x3ee5('0x1e')]=qs[_0x3ee5('0x1e')](_0x2ec4ac[_0x3ee5('0x33')][_0x3ee5('0x1e')]);_0xb8f45f[_0x3ee5('0x1d')]=qs[_0x3ee5('0x1d')](_0x2ec4ac[_0x3ee5('0x33')][_0x3ee5('0x1d')]);}_0xb8f45f[_0x3ee5('0x3b')]=qs['sort'](_0x2ec4ac['query'][_0x3ee5('0x3c')]);_0xb8f45f['where']=qs[_0x3ee5('0x3d')](_[_0x3ee5('0x3e')](_0x2ec4ac['query'],_0x10cd45[_0x3ee5('0x3d')]),_0x1b7356);if(_0x2ec4ac[_0x3ee5('0x33')]['filter']){_0xb8f45f[_0x3ee5('0x3f')]=_[_0x3ee5('0x40')](_0xb8f45f[_0x3ee5('0x3f')],{'$or':_[_0x3ee5('0x41')](_0x1b7356,function(_0x546109){if(_0x546109[_0x3ee5('0x31')]!==_0x3ee5('0x42')){var _0x4a3da8={};_0x4a3da8[_0x546109['name']]={'$like':'%'+_0x2ec4ac[_0x3ee5('0x33')][_0x3ee5('0x43')]+'%'};return _0x4a3da8;}})});}_0xb8f45f=_[_0x3ee5('0x40')]({},_0xb8f45f,_0x2ec4ac['options']);var _0x2afec2={'where':_0xb8f45f['where']};return db[_0x3ee5('0x2e')][_0x3ee5('0x20')](_0x2afec2)['then'](function(_0x1e9206){_0x44faa4[_0x3ee5('0x20')]=_0x1e9206;if(_0x2ec4ac[_0x3ee5('0x33')][_0x3ee5('0x44')]){_0xb8f45f['include']=[{'all':!![]}];}return db[_0x3ee5('0x2e')]['findAll'](_0xb8f45f);})[_0x3ee5('0x26')](function(_0x3c8565){_0x44faa4['rows']=_0x3c8565;return _0x44faa4;})[_0x3ee5('0x26')](respondWithFilteredResult(_0x47f620,_0xb8f45f))[_0x3ee5('0x45')](handleError(_0x47f620,null));};exports['show']=function(_0x4fac0f,_0x397de2){var _0x3badab={'raw':![],'where':{'id':_0x4fac0f[_0x3ee5('0x46')]['id']}},_0x368871={};_0x368871['model']=_['keys'](db['VtigerConfiguration'][_0x3ee5('0x2f')]);_0x368871['query']=_[_0x3ee5('0x34')](_0x4fac0f[_0x3ee5('0x33')]);_0x368871['filters']=_[_0x3ee5('0x35')](_0x368871[_0x3ee5('0x32')],_0x368871[_0x3ee5('0x33')]);_0x3badab[_0x3ee5('0x36')]=_['intersection'](_0x368871[_0x3ee5('0x32')],qs[_0x3ee5('0x37')](_0x4fac0f['query'][_0x3ee5('0x37')]));_0x3badab[_0x3ee5('0x36')]=_0x3badab[_0x3ee5('0x36')][_0x3ee5('0x38')]?_0x3badab[_0x3ee5('0x36')]:_0x368871[_0x3ee5('0x32')];if(_0x4fac0f[_0x3ee5('0x33')][_0x3ee5('0x44')]){_0x3badab[_0x3ee5('0x47')]=[{'all':!![]}];}_0x3badab=_[_0x3ee5('0x40')]({},_0x3badab,_0x4fac0f[_0x3ee5('0x48')]);return db['VtigerConfiguration']['find'](_0x3badab)[_0x3ee5('0x26')](handleEntityNotFound(_0x397de2,null))['then'](respondWithResult(_0x397de2,null))[_0x3ee5('0x45')](handleError(_0x397de2,null));};exports[_0x3ee5('0x49')]=function(_0x441fee,_0x1d8cdb){return db[_0x3ee5('0x2e')]['create'](_0x441fee[_0x3ee5('0x4a')],{})[_0x3ee5('0x26')](respondWithResult(_0x1d8cdb,0xc9))[_0x3ee5('0x45')](handleError(_0x1d8cdb,null));};exports[_0x3ee5('0x25')]=function(_0x57c738,_0x1b4bef){if(_0x57c738[_0x3ee5('0x4a')]['id']){delete _0x57c738[_0x3ee5('0x4a')]['id'];}return db[_0x3ee5('0x2e')][_0x3ee5('0x4b')]({'where':{'id':_0x57c738[_0x3ee5('0x46')]['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x1b4bef,null))[_0x3ee5('0x26')](saveUpdates(_0x57c738[_0x3ee5('0x4a')],null))[_0x3ee5('0x26')](respondWithResult(_0x1b4bef,null))[_0x3ee5('0x45')](handleError(_0x1b4bef,null));};exports[_0x3ee5('0x27')]=function(_0x240e6f,_0x576461){return db[_0x3ee5('0x2e')][_0x3ee5('0x4b')]({'where':{'id':_0x240e6f[_0x3ee5('0x46')]['id']}})['then'](handleEntityNotFound(_0x576461,null))[_0x3ee5('0x26')](removeEntity(_0x576461,null))[_0x3ee5('0x45')](handleError(_0x576461,null));};exports[_0x3ee5('0x4c')]=function(_0x765394,_0x23669f,_0x4cbdba){var _0x516423={};var _0x85b933={};var _0x19d063;var _0x4244b5;return db[_0x3ee5('0x2e')][_0x3ee5('0x4d')]({'where':{'id':_0x765394[_0x3ee5('0x46')]['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x23669f,null))[_0x3ee5('0x26')](function(_0x54bef5){if(_0x54bef5){_0x19d063=_0x54bef5;_0x85b933['model']=_[_0x3ee5('0x34')](db[_0x3ee5('0x4e')][_0x3ee5('0x2f')]);_0x85b933['query']=_[_0x3ee5('0x34')](_0x765394[_0x3ee5('0x33')]);_0x85b933['filters']=_[_0x3ee5('0x35')](_0x85b933['model'],_0x85b933['query']);_0x516423[_0x3ee5('0x36')]=_['intersection'](_0x85b933[_0x3ee5('0x32')],qs[_0x3ee5('0x37')](_0x765394[_0x3ee5('0x33')][_0x3ee5('0x37')]));_0x516423[_0x3ee5('0x36')]=_0x516423[_0x3ee5('0x36')][_0x3ee5('0x38')]?_0x516423[_0x3ee5('0x36')]:_0x85b933[_0x3ee5('0x32')];_0x516423[_0x3ee5('0x3b')]=qs[_0x3ee5('0x3c')](_0x765394[_0x3ee5('0x33')][_0x3ee5('0x3c')]);_0x516423[_0x3ee5('0x3f')]=qs[_0x3ee5('0x3d')](_[_0x3ee5('0x3e')](_0x765394[_0x3ee5('0x33')],_0x85b933[_0x3ee5('0x3d')]));if(_0x765394[_0x3ee5('0x33')][_0x3ee5('0x43')]){_0x516423['where']=_[_0x3ee5('0x40')](_0x516423[_0x3ee5('0x3f')],{'$or':_[_0x3ee5('0x41')](_0x516423[_0x3ee5('0x36')],function(_0x53ee82){var _0x4e4538={};_0x4e4538[_0x53ee82]={'$like':'%'+_0x765394[_0x3ee5('0x33')][_0x3ee5('0x43')]+'%'};return _0x4e4538;})});}_0x516423=_[_0x3ee5('0x40')]({},_0x516423,_0x765394[_0x3ee5('0x48')]);return _0x19d063[_0x3ee5('0x4c')](_0x516423);}})[_0x3ee5('0x26')](function(_0x3ffd3d){if(_0x3ffd3d){_0x4244b5=_0x3ffd3d[_0x3ee5('0x38')];if(!_0x765394['query'][_0x3ee5('0x39')](_0x3ee5('0x3a'))){_0x516423[_0x3ee5('0x1e')]=qs[_0x3ee5('0x1e')](_0x765394[_0x3ee5('0x33')]['limit']);_0x516423[_0x3ee5('0x1d')]=qs['offset'](_0x765394['query'][_0x3ee5('0x1d')]);}return _0x19d063[_0x3ee5('0x4c')](_0x516423);}})[_0x3ee5('0x26')](function(_0xe69183){if(_0xe69183){return _0xe69183?{'count':_0x4244b5,'rows':_0xe69183}:null;}})[_0x3ee5('0x26')](respondWithResult(_0x23669f,null))[_0x3ee5('0x45')](handleError(_0x23669f,null));};exports[_0x3ee5('0x4f')]=function(_0x4d883a,_0x5ba2cb,_0x2d1387){var _0x495c8b={};var _0x25458b={};var _0x5dc8de;var _0x3034ef;return db[_0x3ee5('0x2e')][_0x3ee5('0x4d')]({'where':{'id':_0x4d883a[_0x3ee5('0x46')]['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x5ba2cb,null))['then'](function(_0x2d7b2c){if(_0x2d7b2c){_0x5dc8de=_0x2d7b2c;_0x25458b[_0x3ee5('0x32')]=_[_0x3ee5('0x34')](db['VtigerField'][_0x3ee5('0x2f')]);_0x25458b[_0x3ee5('0x33')]=_[_0x3ee5('0x34')](_0x4d883a[_0x3ee5('0x33')]);_0x25458b[_0x3ee5('0x3d')]=_[_0x3ee5('0x35')](_0x25458b['model'],_0x25458b['query']);_0x495c8b[_0x3ee5('0x36')]=_['intersection'](_0x25458b[_0x3ee5('0x32')],qs[_0x3ee5('0x37')](_0x4d883a['query'][_0x3ee5('0x37')]));_0x495c8b['attributes']=_0x495c8b[_0x3ee5('0x36')][_0x3ee5('0x38')]?_0x495c8b[_0x3ee5('0x36')]:_0x25458b[_0x3ee5('0x32')];_0x495c8b[_0x3ee5('0x3b')]=qs[_0x3ee5('0x3c')](_0x4d883a['query']['sort']);_0x495c8b[_0x3ee5('0x3f')]=qs[_0x3ee5('0x3d')](_[_0x3ee5('0x3e')](_0x4d883a['query'],_0x25458b[_0x3ee5('0x3d')]));if(_0x4d883a['query'][_0x3ee5('0x43')]){_0x495c8b['where']=_[_0x3ee5('0x40')](_0x495c8b['where'],{'$or':_[_0x3ee5('0x41')](_0x495c8b[_0x3ee5('0x36')],function(_0xc583be){var _0x25d199={};_0x25d199[_0xc583be]={'$like':'%'+_0x4d883a['query'][_0x3ee5('0x43')]+'%'};return _0x25d199;})});}_0x495c8b=_[_0x3ee5('0x40')]({},_0x495c8b,_0x4d883a[_0x3ee5('0x48')]);return _0x5dc8de[_0x3ee5('0x4f')](_0x495c8b);}})['then'](function(_0x52a261){if(_0x52a261){_0x3034ef=_0x52a261[_0x3ee5('0x38')];if(!_0x4d883a['query']['hasOwnProperty'](_0x3ee5('0x3a'))){_0x495c8b['limit']=qs['limit'](_0x4d883a[_0x3ee5('0x33')]['limit']);_0x495c8b[_0x3ee5('0x1d')]=qs[_0x3ee5('0x1d')](_0x4d883a[_0x3ee5('0x33')][_0x3ee5('0x1d')]);}return _0x5dc8de[_0x3ee5('0x4f')](_0x495c8b);}})[_0x3ee5('0x26')](function(_0x1501c5){if(_0x1501c5){return _0x1501c5?{'count':_0x3034ef,'rows':_0x1501c5}:null;}})['then'](respondWithResult(_0x5ba2cb,null))['catch'](handleError(_0x5ba2cb,null));};exports[_0x3ee5('0x50')]=function(_0x15153d,_0x54c3e1,_0x22e424){var _0x4afca0={};var _0x25c645={};var _0x2bae35;var _0x4d6a83;return db[_0x3ee5('0x2e')][_0x3ee5('0x4d')]({'where':{'id':_0x15153d['params']['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x54c3e1,null))[_0x3ee5('0x26')](function(_0x2bd5b2){if(_0x2bd5b2){_0x2bae35=_0x2bd5b2;_0x25c645[_0x3ee5('0x32')]=_[_0x3ee5('0x34')](db[_0x3ee5('0x4e')]['rawAttributes']);_0x25c645['query']=_['keys'](_0x15153d[_0x3ee5('0x33')]);_0x25c645['filters']=_['intersection'](_0x25c645['model'],_0x25c645['query']);_0x4afca0['attributes']=_[_0x3ee5('0x35')](_0x25c645[_0x3ee5('0x32')],qs[_0x3ee5('0x37')](_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x37')]));_0x4afca0[_0x3ee5('0x36')]=_0x4afca0['attributes'][_0x3ee5('0x38')]?_0x4afca0[_0x3ee5('0x36')]:_0x25c645['model'];_0x4afca0[_0x3ee5('0x3b')]=qs[_0x3ee5('0x3c')](_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x3c')]);_0x4afca0[_0x3ee5('0x3f')]=qs['filters'](_[_0x3ee5('0x3e')](_0x15153d[_0x3ee5('0x33')],_0x25c645[_0x3ee5('0x3d')]));if(_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x43')]){_0x4afca0[_0x3ee5('0x3f')]=_[_0x3ee5('0x40')](_0x4afca0['where'],{'$or':_[_0x3ee5('0x41')](_0x4afca0[_0x3ee5('0x36')],function(_0x19ca06){var _0x481265={};_0x481265[_0x19ca06]={'$like':'%'+_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x43')]+'%'};return _0x481265;})});}_0x4afca0=_[_0x3ee5('0x40')]({},_0x4afca0,_0x15153d[_0x3ee5('0x48')]);return _0x2bae35[_0x3ee5('0x50')](_0x4afca0);}})[_0x3ee5('0x26')](function(_0xb53c00){if(_0xb53c00){_0x4d6a83=_0xb53c00[_0x3ee5('0x38')];if(!_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x39')](_0x3ee5('0x3a'))){_0x4afca0[_0x3ee5('0x1e')]=qs['limit'](_0x15153d[_0x3ee5('0x33')][_0x3ee5('0x1e')]);_0x4afca0[_0x3ee5('0x1d')]=qs[_0x3ee5('0x1d')](_0x15153d['query']['offset']);}return _0x2bae35[_0x3ee5('0x50')](_0x4afca0);}})['then'](function(_0x4b89d5){if(_0x4b89d5){return _0x4b89d5?{'count':_0x4d6a83,'rows':_0x4b89d5}:null;}})[_0x3ee5('0x26')](respondWithResult(_0x54c3e1,null))[_0x3ee5('0x45')](handleError(_0x54c3e1,null));}; \ No newline at end of file +var _0x0dcf=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','VtigerField','length','order','pick','getFields','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x0dcf,0x179));var _0xf0dc=function(_0x47b413,_0x2327ac){_0x47b413=_0x47b413-0x0;var _0x286091=_0x0dcf[_0x47b413];return _0x286091;};'use strict';var emlformat=require(_0xf0dc('0x0'));var rimraf=require(_0xf0dc('0x1'));var zipdir=require(_0xf0dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0dc('0x3'));var moment=require(_0xf0dc('0x4'));var BPromise=require(_0xf0dc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf0dc('0x6'));var csv=require(_0xf0dc('0x7'));var ejs=require(_0xf0dc('0x8'));var fs=require('fs');var fs_extra=require(_0xf0dc('0x9'));var _=require('lodash');var squel=require(_0xf0dc('0xa'));var crypto=require(_0xf0dc('0xb'));var jsforce=require(_0xf0dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf0dc('0x7'));var querystring=require(_0xf0dc('0xd'));var Papa=require(_0xf0dc('0xe'));var Redis=require(_0xf0dc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf0dc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0dc('0x11'))(_0xf0dc('0x12'));var utils=require('../../config/utils');var config=require(_0xf0dc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0dc('0x14'))['db'];function respondWithStatusCode(_0x4b14cc,_0x19b104){_0x19b104=_0x19b104||0xcc;return function(_0x28fb1e){if(_0x28fb1e){return _0x4b14cc[_0xf0dc('0x15')](_0x19b104);}return _0x4b14cc[_0xf0dc('0x16')](_0x19b104)[_0xf0dc('0x17')]();};}function respondWithResult(_0xc6c898,_0x12a32e){_0x12a32e=_0x12a32e||0xc8;return function(_0x7220f1){if(_0x7220f1){return _0xc6c898[_0xf0dc('0x16')](_0x12a32e)[_0xf0dc('0x18')](_0x7220f1);}};}function respondWithFilteredResult(_0x316dc7,_0x3ae1ba){return function(_0x19b063){if(_0x19b063){var _0x53c25d=typeof _0x3ae1ba[_0xf0dc('0x19')]===_0xf0dc('0x1a')&&typeof _0x3ae1ba['limit']==='undefined';var _0x383b6e=_0x19b063[_0xf0dc('0x1b')];var _0x333fcc=_0x53c25d?0x0:_0x3ae1ba[_0xf0dc('0x19')];var _0x42e4c6=_0x53c25d?_0x19b063[_0xf0dc('0x1b')]:_0x3ae1ba[_0xf0dc('0x19')]+_0x3ae1ba['limit'];var _0x384b2d;if(_0x42e4c6>=_0x383b6e){_0x42e4c6=_0x383b6e;_0x384b2d=0xc8;}else{_0x384b2d=0xce;}_0x316dc7['status'](_0x384b2d);return _0x316dc7[_0xf0dc('0x1c')](_0xf0dc('0x1d'),_0x333fcc+'-'+_0x42e4c6+'/'+_0x383b6e)[_0xf0dc('0x18')](_0x19b063);}return null;};}function patchUpdates(_0x2ff443){return function(_0x5d1eb8){try{jsonpatch[_0xf0dc('0x1e')](_0x5d1eb8,_0x2ff443,!![]);}catch(_0x319656){return BPromise[_0xf0dc('0x1f')](_0x319656);}return _0x5d1eb8['save']();};}function saveUpdates(_0x1494fa,_0x4ee113){return function(_0x384f2c){if(_0x384f2c){return _0x384f2c[_0xf0dc('0x20')](_0x1494fa)[_0xf0dc('0x21')](function(_0x5644a4){return _0x5644a4;});}return null;};}function removeEntity(_0xdf394e,_0x4a5058){return function(_0x5593e2){if(_0x5593e2){return _0x5593e2[_0xf0dc('0x22')]()[_0xf0dc('0x21')](function(){_0xdf394e[_0xf0dc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8066,_0x68ef77){return function(_0x26cfe5){if(!_0x26cfe5){_0x1b8066[_0xf0dc('0x15')](0x194);}return _0x26cfe5;};}function handleError(_0x727c99,_0x579204){_0x579204=_0x579204||0x1f4;return function(_0xbfc302){logger[_0xf0dc('0x23')](_0xbfc302[_0xf0dc('0x24')]);if(_0xbfc302['name']){delete _0xbfc302[_0xf0dc('0x25')];}_0x727c99['status'](_0x579204)[_0xf0dc('0x26')](_0xbfc302);};}exports[_0xf0dc('0x27')]=function(_0x110ae7,_0x321997){var _0x34fb49={},_0x466233={},_0x17fe44={'count':0x0,'rows':[]};var _0x254bc1=_[_0xf0dc('0x28')](db[_0xf0dc('0x29')][_0xf0dc('0x2a')],function(_0x4573fe){return{'name':_0x4573fe[_0xf0dc('0x2b')],'type':_0x4573fe[_0xf0dc('0x2c')]['key']};});_0x466233[_0xf0dc('0x2d')]=_[_0xf0dc('0x28')](_0x254bc1,_0xf0dc('0x25'));_0x466233[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x110ae7[_0xf0dc('0x2e')]);_0x466233[_0xf0dc('0x30')]=_[_0xf0dc('0x31')](_0x466233[_0xf0dc('0x2d')],_0x466233[_0xf0dc('0x2e')]);_0x34fb49[_0xf0dc('0x32')]=_[_0xf0dc('0x31')](_0x466233['model'],qs[_0xf0dc('0x33')](_0x110ae7['query'][_0xf0dc('0x33')]));_0x34fb49['attributes']=_0x34fb49['attributes']['length']?_0x34fb49[_0xf0dc('0x32')]:_0x466233[_0xf0dc('0x2d')];if(!_0x110ae7['query'][_0xf0dc('0x34')]('nolimit')){_0x34fb49['limit']=qs[_0xf0dc('0x35')](_0x110ae7[_0xf0dc('0x2e')][_0xf0dc('0x35')]);_0x34fb49[_0xf0dc('0x19')]=qs[_0xf0dc('0x19')](_0x110ae7['query'][_0xf0dc('0x19')]);}_0x34fb49['order']=qs[_0xf0dc('0x36')](_0x110ae7[_0xf0dc('0x2e')][_0xf0dc('0x36')]);_0x34fb49['where']=qs[_0xf0dc('0x30')](_['pick'](_0x110ae7[_0xf0dc('0x2e')],_0x466233[_0xf0dc('0x30')]),_0x254bc1);if(_0x110ae7[_0xf0dc('0x2e')][_0xf0dc('0x37')]){_0x34fb49[_0xf0dc('0x38')]=_['merge'](_0x34fb49['where'],{'$or':_[_0xf0dc('0x28')](_0x254bc1,function(_0x2e1838){if(_0x2e1838[_0xf0dc('0x2c')]!==_0xf0dc('0x39')){var _0x52d516={};_0x52d516[_0x2e1838['name']]={'$like':'%'+_0x110ae7['query'][_0xf0dc('0x37')]+'%'};return _0x52d516;}})});}_0x34fb49=_[_0xf0dc('0x3a')]({},_0x34fb49,_0x110ae7[_0xf0dc('0x3b')]);var _0x460afc={'where':_0x34fb49['where']};return db['VtigerConfiguration']['count'](_0x460afc)[_0xf0dc('0x21')](function(_0x597300){_0x17fe44[_0xf0dc('0x1b')]=_0x597300;if(_0x110ae7[_0xf0dc('0x2e')][_0xf0dc('0x3c')]){_0x34fb49[_0xf0dc('0x3d')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xf0dc('0x3e')](_0x34fb49);})[_0xf0dc('0x21')](function(_0x413d04){_0x17fe44[_0xf0dc('0x3f')]=_0x413d04;return _0x17fe44;})[_0xf0dc('0x21')](respondWithFilteredResult(_0x321997,_0x34fb49))[_0xf0dc('0x40')](handleError(_0x321997,null));};exports['show']=function(_0x501131,_0x29a0ae){var _0x4a7d8f={'raw':![],'where':{'id':_0x501131[_0xf0dc('0x41')]['id']}},_0x4b8579={};_0x4b8579[_0xf0dc('0x2d')]=_[_0xf0dc('0x2f')](db['VtigerConfiguration'][_0xf0dc('0x2a')]);_0x4b8579[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x501131[_0xf0dc('0x2e')]);_0x4b8579[_0xf0dc('0x30')]=_['intersection'](_0x4b8579['model'],_0x4b8579['query']);_0x4a7d8f[_0xf0dc('0x32')]=_[_0xf0dc('0x31')](_0x4b8579[_0xf0dc('0x2d')],qs['fields'](_0x501131[_0xf0dc('0x2e')][_0xf0dc('0x33')]));_0x4a7d8f['attributes']=_0x4a7d8f[_0xf0dc('0x32')]['length']?_0x4a7d8f['attributes']:_0x4b8579['model'];if(_0x501131[_0xf0dc('0x2e')][_0xf0dc('0x3c')]){_0x4a7d8f[_0xf0dc('0x3d')]=[{'all':!![]}];}_0x4a7d8f=_[_0xf0dc('0x3a')]({},_0x4a7d8f,_0x501131['options']);return db[_0xf0dc('0x29')]['find'](_0x4a7d8f)[_0xf0dc('0x21')](handleEntityNotFound(_0x29a0ae,null))[_0xf0dc('0x21')](respondWithResult(_0x29a0ae,null))[_0xf0dc('0x40')](handleError(_0x29a0ae,null));};exports[_0xf0dc('0x42')]=function(_0x399e25,_0x48c42d){return db['VtigerConfiguration'][_0xf0dc('0x42')](_0x399e25['body'],{})[_0xf0dc('0x21')](respondWithResult(_0x48c42d,0xc9))[_0xf0dc('0x40')](handleError(_0x48c42d,null));};exports[_0xf0dc('0x20')]=function(_0x6220f6,_0x362cdb){if(_0x6220f6['body']['id']){delete _0x6220f6[_0xf0dc('0x43')]['id'];}return db[_0xf0dc('0x29')][_0xf0dc('0x44')]({'where':{'id':_0x6220f6[_0xf0dc('0x41')]['id']}})['then'](handleEntityNotFound(_0x362cdb,null))[_0xf0dc('0x21')](saveUpdates(_0x6220f6[_0xf0dc('0x43')],null))[_0xf0dc('0x21')](respondWithResult(_0x362cdb,null))[_0xf0dc('0x40')](handleError(_0x362cdb,null));};exports[_0xf0dc('0x22')]=function(_0x4ccb04,_0x512879){return db[_0xf0dc('0x29')]['find']({'where':{'id':_0x4ccb04[_0xf0dc('0x41')]['id']}})[_0xf0dc('0x21')](handleEntityNotFound(_0x512879,null))[_0xf0dc('0x21')](removeEntity(_0x512879,null))[_0xf0dc('0x40')](handleError(_0x512879,null));};exports['getFields']=function(_0x191e34,_0x4366bf,_0x53db72){var _0x4e1669={};var _0x39b037={};var _0x4a568e;var _0x460698;return db[_0xf0dc('0x29')]['findOne']({'where':{'id':_0x191e34[_0xf0dc('0x41')]['id']}})[_0xf0dc('0x21')](handleEntityNotFound(_0x4366bf,null))['then'](function(_0x509fcb){if(_0x509fcb){_0x4a568e=_0x509fcb;_0x39b037['model']=_[_0xf0dc('0x2f')](db[_0xf0dc('0x45')][_0xf0dc('0x2a')]);_0x39b037['query']=_['keys'](_0x191e34[_0xf0dc('0x2e')]);_0x39b037[_0xf0dc('0x30')]=_['intersection'](_0x39b037['model'],_0x39b037[_0xf0dc('0x2e')]);_0x4e1669['attributes']=_[_0xf0dc('0x31')](_0x39b037['model'],qs[_0xf0dc('0x33')](_0x191e34[_0xf0dc('0x2e')]['fields']));_0x4e1669[_0xf0dc('0x32')]=_0x4e1669[_0xf0dc('0x32')][_0xf0dc('0x46')]?_0x4e1669[_0xf0dc('0x32')]:_0x39b037[_0xf0dc('0x2d')];_0x4e1669[_0xf0dc('0x47')]=qs['sort'](_0x191e34[_0xf0dc('0x2e')][_0xf0dc('0x36')]);_0x4e1669[_0xf0dc('0x38')]=qs['filters'](_[_0xf0dc('0x48')](_0x191e34[_0xf0dc('0x2e')],_0x39b037[_0xf0dc('0x30')]));if(_0x191e34[_0xf0dc('0x2e')][_0xf0dc('0x37')]){_0x4e1669[_0xf0dc('0x38')]=_[_0xf0dc('0x3a')](_0x4e1669[_0xf0dc('0x38')],{'$or':_['map'](_0x4e1669[_0xf0dc('0x32')],function(_0x609b97){var _0x523853={};_0x523853[_0x609b97]={'$like':'%'+_0x191e34[_0xf0dc('0x2e')][_0xf0dc('0x37')]+'%'};return _0x523853;})});}_0x4e1669=_[_0xf0dc('0x3a')]({},_0x4e1669,_0x191e34['options']);return _0x4a568e[_0xf0dc('0x49')](_0x4e1669);}})[_0xf0dc('0x21')](function(_0x1902e6){if(_0x1902e6){_0x460698=_0x1902e6[_0xf0dc('0x46')];if(!_0x191e34['query']['hasOwnProperty'](_0xf0dc('0x4a'))){_0x4e1669['limit']=qs[_0xf0dc('0x35')](_0x191e34['query']['limit']);_0x4e1669[_0xf0dc('0x19')]=qs[_0xf0dc('0x19')](_0x191e34[_0xf0dc('0x2e')]['offset']);}return _0x4a568e[_0xf0dc('0x49')](_0x4e1669);}})[_0xf0dc('0x21')](function(_0x5662b9){if(_0x5662b9){return _0x5662b9?{'count':_0x460698,'rows':_0x5662b9}:null;}})[_0xf0dc('0x21')](respondWithResult(_0x4366bf,null))[_0xf0dc('0x40')](handleError(_0x4366bf,null));};exports['getSubjects']=function(_0x2e4456,_0xedd345,_0x1ec472){var _0x212c11={};var _0x5f42b5={};var _0x2e9dbc;var _0x3c6569;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x2e4456[_0xf0dc('0x41')]['id']}})[_0xf0dc('0x21')](handleEntityNotFound(_0xedd345,null))[_0xf0dc('0x21')](function(_0x5a94b5){if(_0x5a94b5){_0x2e9dbc=_0x5a94b5;_0x5f42b5[_0xf0dc('0x2d')]=_[_0xf0dc('0x2f')](db[_0xf0dc('0x45')]['rawAttributes']);_0x5f42b5['query']=_[_0xf0dc('0x2f')](_0x2e4456['query']);_0x5f42b5[_0xf0dc('0x30')]=_[_0xf0dc('0x31')](_0x5f42b5[_0xf0dc('0x2d')],_0x5f42b5[_0xf0dc('0x2e')]);_0x212c11[_0xf0dc('0x32')]=_[_0xf0dc('0x31')](_0x5f42b5[_0xf0dc('0x2d')],qs['fields'](_0x2e4456[_0xf0dc('0x2e')][_0xf0dc('0x33')]));_0x212c11[_0xf0dc('0x32')]=_0x212c11[_0xf0dc('0x32')][_0xf0dc('0x46')]?_0x212c11[_0xf0dc('0x32')]:_0x5f42b5[_0xf0dc('0x2d')];_0x212c11[_0xf0dc('0x47')]=qs['sort'](_0x2e4456[_0xf0dc('0x2e')][_0xf0dc('0x36')]);_0x212c11['where']=qs[_0xf0dc('0x30')](_[_0xf0dc('0x48')](_0x2e4456[_0xf0dc('0x2e')],_0x5f42b5['filters']));if(_0x2e4456['query'][_0xf0dc('0x37')]){_0x212c11[_0xf0dc('0x38')]=_[_0xf0dc('0x3a')](_0x212c11[_0xf0dc('0x38')],{'$or':_[_0xf0dc('0x28')](_0x212c11[_0xf0dc('0x32')],function(_0x54875a){var _0x5db00d={};_0x5db00d[_0x54875a]={'$like':'%'+_0x2e4456[_0xf0dc('0x2e')][_0xf0dc('0x37')]+'%'};return _0x5db00d;})});}_0x212c11=_[_0xf0dc('0x3a')]({},_0x212c11,_0x2e4456[_0xf0dc('0x3b')]);return _0x2e9dbc['getSubjects'](_0x212c11);}})['then'](function(_0x301540){if(_0x301540){_0x3c6569=_0x301540[_0xf0dc('0x46')];if(!_0x2e4456[_0xf0dc('0x2e')]['hasOwnProperty']('nolimit')){_0x212c11[_0xf0dc('0x35')]=qs[_0xf0dc('0x35')](_0x2e4456[_0xf0dc('0x2e')]['limit']);_0x212c11[_0xf0dc('0x19')]=qs[_0xf0dc('0x19')](_0x2e4456[_0xf0dc('0x2e')][_0xf0dc('0x19')]);}return _0x2e9dbc[_0xf0dc('0x4b')](_0x212c11);}})[_0xf0dc('0x21')](function(_0x2963ba){if(_0x2963ba){return _0x2963ba?{'count':_0x3c6569,'rows':_0x2963ba}:null;}})['then'](respondWithResult(_0xedd345,null))['catch'](handleError(_0xedd345,null));};exports['getDescriptions']=function(_0x55950f,_0x3e8730,_0x2ea077){var _0x4a0dfd={};var _0x11e334={};var _0x23c131;var _0x475eac;return db[_0xf0dc('0x29')][_0xf0dc('0x4c')]({'where':{'id':_0x55950f[_0xf0dc('0x41')]['id']}})[_0xf0dc('0x21')](handleEntityNotFound(_0x3e8730,null))['then'](function(_0x3be4dd){if(_0x3be4dd){_0x23c131=_0x3be4dd;_0x11e334[_0xf0dc('0x2d')]=_[_0xf0dc('0x2f')](db[_0xf0dc('0x45')]['rawAttributes']);_0x11e334['query']=_[_0xf0dc('0x2f')](_0x55950f[_0xf0dc('0x2e')]);_0x11e334['filters']=_['intersection'](_0x11e334[_0xf0dc('0x2d')],_0x11e334[_0xf0dc('0x2e')]);_0x4a0dfd[_0xf0dc('0x32')]=_[_0xf0dc('0x31')](_0x11e334[_0xf0dc('0x2d')],qs[_0xf0dc('0x33')](_0x55950f['query'][_0xf0dc('0x33')]));_0x4a0dfd[_0xf0dc('0x32')]=_0x4a0dfd[_0xf0dc('0x32')][_0xf0dc('0x46')]?_0x4a0dfd[_0xf0dc('0x32')]:_0x11e334[_0xf0dc('0x2d')];_0x4a0dfd[_0xf0dc('0x47')]=qs[_0xf0dc('0x36')](_0x55950f[_0xf0dc('0x2e')]['sort']);_0x4a0dfd[_0xf0dc('0x38')]=qs[_0xf0dc('0x30')](_[_0xf0dc('0x48')](_0x55950f['query'],_0x11e334[_0xf0dc('0x30')]));if(_0x55950f[_0xf0dc('0x2e')][_0xf0dc('0x37')]){_0x4a0dfd[_0xf0dc('0x38')]=_['merge'](_0x4a0dfd[_0xf0dc('0x38')],{'$or':_['map'](_0x4a0dfd[_0xf0dc('0x32')],function(_0x198ad0){var _0xf92db4={};_0xf92db4[_0x198ad0]={'$like':'%'+_0x55950f['query'][_0xf0dc('0x37')]+'%'};return _0xf92db4;})});}_0x4a0dfd=_[_0xf0dc('0x3a')]({},_0x4a0dfd,_0x55950f[_0xf0dc('0x3b')]);return _0x23c131[_0xf0dc('0x4d')](_0x4a0dfd);}})[_0xf0dc('0x21')](function(_0x13a74f){if(_0x13a74f){_0x475eac=_0x13a74f[_0xf0dc('0x46')];if(!_0x55950f[_0xf0dc('0x2e')]['hasOwnProperty'](_0xf0dc('0x4a'))){_0x4a0dfd[_0xf0dc('0x35')]=qs[_0xf0dc('0x35')](_0x55950f[_0xf0dc('0x2e')][_0xf0dc('0x35')]);_0x4a0dfd[_0xf0dc('0x19')]=qs[_0xf0dc('0x19')](_0x55950f[_0xf0dc('0x2e')][_0xf0dc('0x19')]);}return _0x23c131[_0xf0dc('0x4d')](_0x4a0dfd);}})[_0xf0dc('0x21')](function(_0x4943bd){if(_0x4943bd){return _0x4943bd?{'count':_0x475eac,'rows':_0x4943bd}:null;}})['then'](respondWithResult(_0x3e8730,null))[_0xf0dc('0x40')](handleError(_0x3e8730,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d3ca3d1..b4a22de 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 _0x05e0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x3127eb,_0x288ae3){var _0x5461ed=function(_0x5aee78){while(--_0x5aee78){_0x3127eb['push'](_0x3127eb['shift']());}};_0x5461ed(++_0x288ae3);}(_0x05e0,0xd0));var _0x005e=function(_0x428c50,_0x49dc7a){_0x428c50=_0x428c50-0x0;var _0x3779b6=_0x05e0[_0x428c50];return _0x3779b6;};'use strict';var _=require(_0x005e('0x0'));var util=require(_0x005e('0x1'));var logger=require(_0x005e('0x2'))(_0x005e('0x3'));var moment=require(_0x005e('0x4'));var BPromise=require(_0x005e('0x5'));var rp=require(_0x005e('0x6'));var fs=require('fs');var path=require(_0x005e('0x7'));var rimraf=require(_0x005e('0x8'));var config=require('../../config/environment');var attributes=require(_0x005e('0x9'));module[_0x005e('0xa')]=function(_0x3589b7,_0x501c26){return _0x3589b7[_0x005e('0xb')](_0x005e('0xc'),attributes,{'tableName':_0x005e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ee=['define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x33ee,0xa8));var _0xe33e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x33ee[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe33e('0x0'))('api');var moment=require(_0xe33e('0x1'));var BPromise=require('bluebird');var rp=require(_0xe33e('0x2'));var fs=require('fs');var path=require(_0xe33e('0x3'));var rimraf=require(_0xe33e('0x4'));var config=require(_0xe33e('0x5'));var attributes=require(_0xe33e('0x6'));module[_0xe33e('0x7')]=function(_0x1e61e4,_0x5a4d5f){return _0x1e61e4[_0xe33e('0x8')](_0xe33e('0x9'),attributes,{'tableName':_0xe33e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 82d244e..c1957b8 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 _0xb579=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xb579,0x169));var _0x9b57=function(_0x5937b6,_0x1ea041){_0x5937b6=_0x5937b6-0x0;var _0x405e4e=_0xb579[_0x5937b6];return _0x405e4e;};'use strict';var _=require(_0x9b57('0x0'));var util=require(_0x9b57('0x1'));var moment=require('moment');var BPromise=require(_0x9b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b57('0x3'))['db'];var utils=require(_0x9b57('0x4'));var logger=require(_0x9b57('0x5'))(_0x9b57('0x6'));var config=require('../../config/environment');var jayson=require(_0x9b57('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44c5e6,_0x3a3f8c,_0x344948){return new BPromise(function(_0x2981f9,_0x1ec4ac){return client[_0x9b57('0x8')](_0x44c5e6,_0x344948)[_0x9b57('0x9')](function(_0x2324d4){logger[_0x9b57('0xa')](_0x9b57('0xb'),_0x3a3f8c,'request\x20sent');logger[_0x9b57('0xc')](_0x9b57('0xd'),_0x3a3f8c,_0x9b57('0xe'),JSON['stringify'](_0x2324d4));if(_0x2324d4['error']){if(_0x2324d4[_0x9b57('0xf')][_0x9b57('0x10')]===0x1f4){logger[_0x9b57('0xf')](_0x9b57('0xb'),_0x3a3f8c,_0x2324d4[_0x9b57('0xf')][_0x9b57('0x11')]);return _0x1ec4ac(_0x2324d4[_0x9b57('0xf')][_0x9b57('0x11')]);}logger[_0x9b57('0xf')](_0x9b57('0xb'),_0x3a3f8c,_0x2324d4['error']['message']);return _0x2981f9(_0x2324d4[_0x9b57('0xf')][_0x9b57('0x11')]);}else{logger[_0x9b57('0xa')](_0x9b57('0xb'),_0x3a3f8c,_0x9b57('0xe'));_0x2981f9(_0x2324d4['result'][_0x9b57('0x11')]);}})[_0x9b57('0x12')](function(_0x21ee92){logger[_0x9b57('0xf')](_0x9b57('0xb'),_0x3a3f8c,_0x21ee92);_0x1ec4ac(_0x21ee92);});});} \ No newline at end of file +var _0x43fc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x43fc,0x102));var _0xc43f=function(_0xbcd9bf,_0x206ac4){_0xbcd9bf=_0xbcd9bf-0x0;var _0x2d26cd=_0x43fc[_0xbcd9bf];return _0x2d26cd;};'use strict';var _=require(_0xc43f('0x0'));var util=require(_0xc43f('0x1'));var moment=require(_0xc43f('0x2'));var BPromise=require(_0xc43f('0x3'));var rs=require(_0xc43f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc43f('0x5'))['db'];var utils=require(_0xc43f('0x6'));var logger=require(_0xc43f('0x7'))(_0xc43f('0x8'));var config=require(_0xc43f('0x9'));var jayson=require(_0xc43f('0xa'));var client=jayson[_0xc43f('0xb')][_0xc43f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e8a95,_0x4b8680,_0x3be44d){return new BPromise(function(_0x20bab3,_0x3b7e18){return client['request'](_0x1e8a95,_0x3be44d)['then'](function(_0x53507f){logger[_0xc43f('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b8680,_0xc43f('0xe'));logger[_0xc43f('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4b8680,_0xc43f('0xe'),JSON[_0xc43f('0x10')](_0x53507f));if(_0x53507f[_0xc43f('0x11')]){if(_0x53507f['error']['code']===0x1f4){logger['error'](_0xc43f('0x12'),_0x4b8680,_0x53507f[_0xc43f('0x11')][_0xc43f('0x13')]);return _0x3b7e18(_0x53507f[_0xc43f('0x11')][_0xc43f('0x13')]);}logger[_0xc43f('0x11')](_0xc43f('0x12'),_0x4b8680,_0x53507f[_0xc43f('0x11')][_0xc43f('0x13')]);return _0x20bab3(_0x53507f[_0xc43f('0x11')][_0xc43f('0x13')]);}else{logger[_0xc43f('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b8680,'request\x20sent');_0x20bab3(_0x53507f[_0xc43f('0x14')][_0xc43f('0x13')]);}})[_0xc43f('0x15')](function(_0x5ba905){logger[_0xc43f('0x11')](_0xc43f('0x12'),_0x4b8680,_0x5ba905);_0x3b7e18(_0x5ba905);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fc30ba3..e22bd07 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 _0x53d5=['isAuthenticated','/:id','show','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2a1aa3,_0x47ca05){var _0x5bb234=function(_0x4a95fe){while(--_0x4a95fe){_0x2a1aa3['push'](_0x2a1aa3['shift']());}};_0x5bb234(++_0x47ca05);}(_0x53d5,0x11f));var _0x553d=function(_0xcffae0,_0x1f70ca){_0xcffae0=_0xcffae0-0x0;var _0x24f329=_0x53d5[_0xcffae0];return _0x24f329;};'use strict';var multer=require('multer');var util=require(_0x553d('0x0'));var path=require('path');var timeout=require(_0x553d('0x1'));var express=require(_0x553d('0x2'));var router=express[_0x553d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x553d('0x4'));var config=require(_0x553d('0x5'));var controller=require('./intVtigerField.controller');router[_0x553d('0x6')]('/',auth[_0x553d('0x7')](),controller['index']);router[_0x553d('0x6')](_0x553d('0x8'),auth['isAuthenticated'](),controller[_0x553d('0x9')]);router['post']('/',auth[_0x553d('0x7')](),controller['create']);router[_0x553d('0xa')](_0x553d('0x8'),auth[_0x553d('0x7')](),controller[_0x553d('0xb')]);router['delete'](_0x553d('0x8'),auth[_0x553d('0x7')](),controller[_0x553d('0xc')]);module[_0x553d('0xd')]=router; \ No newline at end of file +var _0x25d6=['../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x23baaa,_0x49d074){var _0x17bf19=function(_0x489d72){while(--_0x489d72){_0x23baaa['push'](_0x23baaa['shift']());}};_0x17bf19(++_0x49d074);}(_0x25d6,0x67));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x625d('0x0'));var util=require(_0x625d('0x1'));var path=require('path');var timeout=require(_0x625d('0x2'));var express=require(_0x625d('0x3'));var router=express[_0x625d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x625d('0x5'));var interaction=require(_0x625d('0x6'));var config=require('../../config/environment');var controller=require(_0x625d('0x7'));router[_0x625d('0x8')]('/',auth[_0x625d('0x9')](),controller[_0x625d('0xa')]);router[_0x625d('0x8')](_0x625d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x625d('0xc')]('/',auth['isAuthenticated'](),controller[_0x625d('0xd')]);router[_0x625d('0xe')](_0x625d('0xb'),auth['isAuthenticated'](),controller[_0x625d('0xf')]);router[_0x625d('0x10')](_0x625d('0xb'),auth[_0x625d('0x9')](),controller[_0x625d('0x11')]);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 c5c761c..693fb96 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 _0xd75a=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x549b69,_0x3ffc30){var _0x250071=function(_0x243d6d){while(--_0x243d6d){_0x549b69['push'](_0x549b69['shift']());}};_0x250071(++_0x3ffc30);}(_0xd75a,0xef));var _0xad75=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd75a[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xad75('0x0'));module[_0xad75('0x1')]={'type':{'type':Sequelize[_0xad75('0x2')](_0xad75('0x3'),_0xad75('0x4'),_0xad75('0x5'),'keyValue',_0xad75('0x6')),'defaultValue':_0xad75('0x3')},'content':{'type':Sequelize[_0xad75('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xad75('0x2')]('string',_0xad75('0x4'),_0xad75('0x5'))},'keyContent':{'type':Sequelize[_0xad75('0x7')]},'idField':{'type':Sequelize[_0xad75('0x7')]},'nameField':{'type':Sequelize[_0xad75('0x7')]},'customField':{'type':Sequelize[_0xad75('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9b4=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x429a56,_0x24fcb6){var _0x2a4091=function(_0x5d4df6){while(--_0x5d4df6){_0x429a56['push'](_0x429a56['shift']());}};_0x2a4091(++_0x24fcb6);}(_0xf9b4,0x17e));var _0x4f9b=function(_0x12c7e3,_0x417a84){_0x12c7e3=_0x12c7e3-0x0;var _0x348f08=_0xf9b4[_0x12c7e3];return _0x348f08;};'use strict';var Sequelize=require(_0x4f9b('0x0'));module['exports']={'type':{'type':Sequelize[_0x4f9b('0x1')](_0x4f9b('0x2'),_0x4f9b('0x3'),_0x4f9b('0x4'),'keyValue',_0x4f9b('0x5')),'defaultValue':_0x4f9b('0x2')},'content':{'type':Sequelize[_0x4f9b('0x6')]},'key':{'type':Sequelize[_0x4f9b('0x6')]},'keyType':{'type':Sequelize[_0x4f9b('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x4f9b('0x6')]},'idField':{'type':Sequelize[_0x4f9b('0x6')]},'nameField':{'type':Sequelize[_0x4f9b('0x6')]},'customField':{'type':Sequelize[_0x4f9b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cfc9b74..9e7dfce 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 _0x7192=['index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','name','include','findAll','rows','catch','show','includeAll','options','find','create','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','Content-Range','json','apply','save','update','then','destroy','error','stack'];(function(_0x527eb3,_0x358d66){var _0x2bea82=function(_0x31fda3){while(--_0x31fda3){_0x527eb3['push'](_0x527eb3['shift']());}};_0x2bea82(++_0x358d66);}(_0x7192,0x17e));var _0x2719=function(_0x98ee65,_0x10c131){_0x98ee65=_0x98ee65-0x0;var _0x17f56b=_0x7192[_0x98ee65];return _0x17f56b;};'use strict';var emlformat=require(_0x2719('0x0'));var rimraf=require(_0x2719('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2719('0x2'));var moment=require(_0x2719('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2719('0x4'));var path=require(_0x2719('0x5'));var sox=require(_0x2719('0x6'));var csv=require(_0x2719('0x7'));var ejs=require(_0x2719('0x8'));var fs=require('fs');var fs_extra=require(_0x2719('0x9'));var _=require(_0x2719('0xa'));var squel=require('squel');var crypto=require(_0x2719('0xb'));var jsforce=require(_0x2719('0xc'));var deskjs=require(_0x2719('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2719('0xe'));var Papa=require('papaparse');var Redis=require(_0x2719('0xf'));var authService=require(_0x2719('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2719('0x11'));var logger=require(_0x2719('0x12'))(_0x2719('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2719('0x14'));var db=require(_0x2719('0x15'))['db'];function respondWithStatusCode(_0x287751,_0x159f8e){_0x159f8e=_0x159f8e||0xcc;return function(_0x3407e4){if(_0x3407e4){return _0x287751[_0x2719('0x16')](_0x159f8e);}return _0x287751['status'](_0x159f8e)[_0x2719('0x17')]();};}function respondWithResult(_0x34a0e6,_0x59ea14){_0x59ea14=_0x59ea14||0xc8;return function(_0x357843){if(_0x357843){return _0x34a0e6[_0x2719('0x18')](_0x59ea14)['json'](_0x357843);}};}function respondWithFilteredResult(_0xcf8eef,_0x5066cc){return function(_0x5238ac){if(_0x5238ac){var _0x561b3c=typeof _0x5066cc['offset']===_0x2719('0x19')&&typeof _0x5066cc[_0x2719('0x1a')]===_0x2719('0x19');var _0x546bb8=_0x5238ac['count'];var _0x2c1661=_0x561b3c?0x0:_0x5066cc[_0x2719('0x1b')];var _0x4728fd=_0x561b3c?_0x5238ac[_0x2719('0x1c')]:_0x5066cc[_0x2719('0x1b')]+_0x5066cc[_0x2719('0x1a')];var _0x3084f2;if(_0x4728fd>=_0x546bb8){_0x4728fd=_0x546bb8;_0x3084f2=0xc8;}else{_0x3084f2=0xce;}_0xcf8eef['status'](_0x3084f2);return _0xcf8eef['set'](_0x2719('0x1d'),_0x2c1661+'-'+_0x4728fd+'/'+_0x546bb8)[_0x2719('0x1e')](_0x5238ac);}return null;};}function patchUpdates(_0x52ab54){return function(_0x5ecafd){try{jsonpatch[_0x2719('0x1f')](_0x5ecafd,_0x52ab54,!![]);}catch(_0x1be954){return BPromise['reject'](_0x1be954);}return _0x5ecafd[_0x2719('0x20')]();};}function saveUpdates(_0x2a79f,_0xa706d0){return function(_0x214742){if(_0x214742){return _0x214742[_0x2719('0x21')](_0x2a79f)[_0x2719('0x22')](function(_0x3feea2){return _0x3feea2;});}return null;};}function removeEntity(_0x1ee40a,_0x2ecb6f){return function(_0x5b41a7){if(_0x5b41a7){return _0x5b41a7[_0x2719('0x23')]()[_0x2719('0x22')](function(){_0x1ee40a[_0x2719('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1829,_0x2c7126){return function(_0x3e0ebf){if(!_0x3e0ebf){_0x1c1829[_0x2719('0x16')](0x194);}return _0x3e0ebf;};}function handleError(_0x3cb6f9,_0x51792e){_0x51792e=_0x51792e||0x1f4;return function(_0x485633){logger[_0x2719('0x24')](_0x485633[_0x2719('0x25')]);if(_0x485633['name']){delete _0x485633['name'];}_0x3cb6f9[_0x2719('0x18')](_0x51792e)['send'](_0x485633);};}exports[_0x2719('0x26')]=function(_0x21aef1,_0x5859a4){var _0x1f567c={},_0x493eaa={},_0x47aa0c={'count':0x0,'rows':[]};var _0x535f3c=_[_0x2719('0x27')](db[_0x2719('0x28')][_0x2719('0x29')],function(_0x5f6cd3){return{'name':_0x5f6cd3[_0x2719('0x2a')],'type':_0x5f6cd3[_0x2719('0x2b')]['key']};});_0x493eaa[_0x2719('0x2c')]=_[_0x2719('0x27')](_0x535f3c,'name');_0x493eaa[_0x2719('0x2d')]=_[_0x2719('0x2e')](_0x21aef1['query']);_0x493eaa['filters']=_[_0x2719('0x2f')](_0x493eaa['model'],_0x493eaa[_0x2719('0x2d')]);_0x1f567c[_0x2719('0x30')]=_['intersection'](_0x493eaa[_0x2719('0x2c')],qs[_0x2719('0x31')](_0x21aef1[_0x2719('0x2d')]['fields']));_0x1f567c['attributes']=_0x1f567c[_0x2719('0x30')][_0x2719('0x32')]?_0x1f567c['attributes']:_0x493eaa[_0x2719('0x2c')];if(!_0x21aef1[_0x2719('0x2d')][_0x2719('0x33')](_0x2719('0x34'))){_0x1f567c['limit']=qs['limit'](_0x21aef1[_0x2719('0x2d')][_0x2719('0x1a')]);_0x1f567c[_0x2719('0x1b')]=qs[_0x2719('0x1b')](_0x21aef1[_0x2719('0x2d')][_0x2719('0x1b')]);}_0x1f567c[_0x2719('0x35')]=qs['sort'](_0x21aef1[_0x2719('0x2d')]['sort']);_0x1f567c[_0x2719('0x36')]=qs['filters'](_[_0x2719('0x37')](_0x21aef1[_0x2719('0x2d')],_0x493eaa[_0x2719('0x38')]),_0x535f3c);if(_0x21aef1['query'][_0x2719('0x39')]){_0x1f567c[_0x2719('0x36')]=_[_0x2719('0x3a')](_0x1f567c[_0x2719('0x36')],{'$or':_[_0x2719('0x27')](_0x535f3c,function(_0x5e7a97){if(_0x5e7a97[_0x2719('0x2b')]!=='VIRTUAL'){var _0x149477={};_0x149477[_0x5e7a97[_0x2719('0x3b')]]={'$like':'%'+_0x21aef1['query'][_0x2719('0x39')]+'%'};return _0x149477;}})});}_0x1f567c=_[_0x2719('0x3a')]({},_0x1f567c,_0x21aef1['options']);var _0x5aff81={'where':_0x1f567c[_0x2719('0x36')]};return db['VtigerField'][_0x2719('0x1c')](_0x5aff81)['then'](function(_0x21df03){_0x47aa0c[_0x2719('0x1c')]=_0x21df03;if(_0x21aef1[_0x2719('0x2d')]['includeAll']){_0x1f567c[_0x2719('0x3c')]=[{'all':!![]}];}return db[_0x2719('0x28')][_0x2719('0x3d')](_0x1f567c);})['then'](function(_0x95a9bb){_0x47aa0c[_0x2719('0x3e')]=_0x95a9bb;return _0x47aa0c;})['then'](respondWithFilteredResult(_0x5859a4,_0x1f567c))[_0x2719('0x3f')](handleError(_0x5859a4,null));};exports[_0x2719('0x40')]=function(_0x46d081,_0x5782b7){var _0x2c426d={'raw':!![],'where':{'id':_0x46d081['params']['id']}},_0x4b1a83={};_0x4b1a83[_0x2719('0x2c')]=_[_0x2719('0x2e')](db['VtigerField'][_0x2719('0x29')]);_0x4b1a83[_0x2719('0x2d')]=_[_0x2719('0x2e')](_0x46d081[_0x2719('0x2d')]);_0x4b1a83[_0x2719('0x38')]=_[_0x2719('0x2f')](_0x4b1a83[_0x2719('0x2c')],_0x4b1a83[_0x2719('0x2d')]);_0x2c426d[_0x2719('0x30')]=_[_0x2719('0x2f')](_0x4b1a83[_0x2719('0x2c')],qs[_0x2719('0x31')](_0x46d081['query'][_0x2719('0x31')]));_0x2c426d[_0x2719('0x30')]=_0x2c426d[_0x2719('0x30')][_0x2719('0x32')]?_0x2c426d[_0x2719('0x30')]:_0x4b1a83[_0x2719('0x2c')];if(_0x46d081[_0x2719('0x2d')][_0x2719('0x41')]){_0x2c426d['include']=[{'all':!![]}];}_0x2c426d=_[_0x2719('0x3a')]({},_0x2c426d,_0x46d081[_0x2719('0x42')]);return db['VtigerField'][_0x2719('0x43')](_0x2c426d)['then'](handleEntityNotFound(_0x5782b7,null))['then'](respondWithResult(_0x5782b7,null))[_0x2719('0x3f')](handleError(_0x5782b7,null));};exports['create']=function(_0xf18714,_0x2c5b25){return db[_0x2719('0x28')][_0x2719('0x44')](_0xf18714['body'],{})[_0x2719('0x22')](respondWithResult(_0x2c5b25,0xc9))[_0x2719('0x3f')](handleError(_0x2c5b25,null));};exports[_0x2719('0x21')]=function(_0x405dbb,_0x2a93dd){if(_0x405dbb[_0x2719('0x45')]['id']){delete _0x405dbb[_0x2719('0x45')]['id'];}return db[_0x2719('0x28')][_0x2719('0x43')]({'where':{'id':_0x405dbb['params']['id']}})[_0x2719('0x22')](handleEntityNotFound(_0x2a93dd,null))['then'](saveUpdates(_0x405dbb[_0x2719('0x45')],null))['then'](respondWithResult(_0x2a93dd,null))[_0x2719('0x3f')](handleError(_0x2a93dd,null));};exports[_0x2719('0x23')]=function(_0x39e91a,_0x1354a3){return db['VtigerField']['find']({'where':{'id':_0x39e91a['params']['id']}})['then'](handleEntityNotFound(_0x1354a3,null))[_0x2719('0x22')](removeEntity(_0x1354a3,null))[_0x2719('0x3f')](handleError(_0x1354a3,null));}; \ No newline at end of file +var _0x5a5b=['fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','catch','show','params','filters','merge','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes'];(function(_0x38c182,_0x5c251c){var _0x371fbc=function(_0x161807){while(--_0x161807){_0x38c182['push'](_0x38c182['shift']());}};_0x371fbc(++_0x5c251c);}(_0x5a5b,0x13d));var _0xb5a5=function(_0x463012,_0x117b92){_0x463012=_0x463012-0x0;var _0x1f809e=_0x5a5b[_0x463012];return _0x1f809e;};'use strict';var emlformat=require(_0xb5a5('0x0'));var rimraf=require(_0xb5a5('0x1'));var zipdir=require(_0xb5a5('0x2'));var jsonpatch=require(_0xb5a5('0x3'));var rp=require('request-promise');var moment=require(_0xb5a5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb5a5('0x5'));var path=require(_0xb5a5('0x6'));var sox=require(_0xb5a5('0x7'));var csv=require(_0xb5a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5a5('0x9'));var _=require(_0xb5a5('0xa'));var squel=require(_0xb5a5('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb5a5('0x8'));var querystring=require(_0xb5a5('0xd'));var Papa=require(_0xb5a5('0xe'));var Redis=require(_0xb5a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb5a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5a5('0x11'));var logger=require(_0xb5a5('0x12'))(_0xb5a5('0x13'));var utils=require(_0xb5a5('0x14'));var config=require(_0xb5a5('0x15'));var licenseUtil=require(_0xb5a5('0x16'));var db=require(_0xb5a5('0x17'))['db'];function respondWithStatusCode(_0x34731e,_0x163895){_0x163895=_0x163895||0xcc;return function(_0x4a58dd){if(_0x4a58dd){return _0x34731e[_0xb5a5('0x18')](_0x163895);}return _0x34731e[_0xb5a5('0x19')](_0x163895)[_0xb5a5('0x1a')]();};}function respondWithResult(_0x4a89ec,_0x27d499){_0x27d499=_0x27d499||0xc8;return function(_0x156b9c){if(_0x156b9c){return _0x4a89ec[_0xb5a5('0x19')](_0x27d499)['json'](_0x156b9c);}};}function respondWithFilteredResult(_0x4ee535,_0x44248e){return function(_0x56b951){if(_0x56b951){var _0x29ab63=typeof _0x44248e[_0xb5a5('0x1b')]===_0xb5a5('0x1c')&&typeof _0x44248e[_0xb5a5('0x1d')]===_0xb5a5('0x1c');var _0x33796f=_0x56b951[_0xb5a5('0x1e')];var _0xc33db6=_0x29ab63?0x0:_0x44248e[_0xb5a5('0x1b')];var _0x74843c=_0x29ab63?_0x56b951[_0xb5a5('0x1e')]:_0x44248e[_0xb5a5('0x1b')]+_0x44248e[_0xb5a5('0x1d')];var _0x31666e;if(_0x74843c>=_0x33796f){_0x74843c=_0x33796f;_0x31666e=0xc8;}else{_0x31666e=0xce;}_0x4ee535[_0xb5a5('0x19')](_0x31666e);return _0x4ee535[_0xb5a5('0x1f')]('Content-Range',_0xc33db6+'-'+_0x74843c+'/'+_0x33796f)[_0xb5a5('0x20')](_0x56b951);}return null;};}function patchUpdates(_0x231395){return function(_0x308da2){try{jsonpatch['apply'](_0x308da2,_0x231395,!![]);}catch(_0x4f412e){return BPromise['reject'](_0x4f412e);}return _0x308da2[_0xb5a5('0x21')]();};}function saveUpdates(_0x35aba1,_0x277131){return function(_0x1e076c){if(_0x1e076c){return _0x1e076c[_0xb5a5('0x22')](_0x35aba1)[_0xb5a5('0x23')](function(_0xa9379d){return _0xa9379d;});}return null;};}function removeEntity(_0x2cf452,_0x2a38af){return function(_0x36e9fe){if(_0x36e9fe){return _0x36e9fe[_0xb5a5('0x24')]()['then'](function(){_0x2cf452['status'](0xcc)[_0xb5a5('0x1a')]();});}};}function handleEntityNotFound(_0x41adbe,_0x3ae793){return function(_0x4fb43a){if(!_0x4fb43a){_0x41adbe[_0xb5a5('0x18')](0x194);}return _0x4fb43a;};}function handleError(_0x215331,_0x1c4f69){_0x1c4f69=_0x1c4f69||0x1f4;return function(_0x20b462){logger[_0xb5a5('0x25')](_0x20b462[_0xb5a5('0x26')]);if(_0x20b462[_0xb5a5('0x27')]){delete _0x20b462['name'];}_0x215331[_0xb5a5('0x19')](_0x1c4f69)['send'](_0x20b462);};}exports[_0xb5a5('0x28')]=function(_0x5bb199,_0x3b3075){var _0x2c3dd3={},_0x55957b={},_0x5c2262={'count':0x0,'rows':[]};var _0x178a17=_['map'](db[_0xb5a5('0x29')][_0xb5a5('0x2a')],function(_0x4f832f){return{'name':_0x4f832f[_0xb5a5('0x2b')],'type':_0x4f832f['type'][_0xb5a5('0x2c')]};});_0x55957b[_0xb5a5('0x2d')]=_[_0xb5a5('0x2e')](_0x178a17,_0xb5a5('0x27'));_0x55957b['query']=_[_0xb5a5('0x2f')](_0x5bb199[_0xb5a5('0x30')]);_0x55957b['filters']=_[_0xb5a5('0x31')](_0x55957b[_0xb5a5('0x2d')],_0x55957b[_0xb5a5('0x30')]);_0x2c3dd3[_0xb5a5('0x32')]=_['intersection'](_0x55957b[_0xb5a5('0x2d')],qs[_0xb5a5('0x33')](_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x33')]));_0x2c3dd3[_0xb5a5('0x32')]=_0x2c3dd3[_0xb5a5('0x32')][_0xb5a5('0x34')]?_0x2c3dd3[_0xb5a5('0x32')]:_0x55957b[_0xb5a5('0x2d')];if(!_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x35')](_0xb5a5('0x36'))){_0x2c3dd3['limit']=qs[_0xb5a5('0x1d')](_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x1d')]);_0x2c3dd3[_0xb5a5('0x1b')]=qs[_0xb5a5('0x1b')](_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x1b')]);}_0x2c3dd3[_0xb5a5('0x37')]=qs[_0xb5a5('0x38')](_0x5bb199['query']['sort']);_0x2c3dd3[_0xb5a5('0x39')]=qs['filters'](_[_0xb5a5('0x3a')](_0x5bb199[_0xb5a5('0x30')],_0x55957b['filters']),_0x178a17);if(_0x5bb199['query'][_0xb5a5('0x3b')]){_0x2c3dd3[_0xb5a5('0x39')]=_['merge'](_0x2c3dd3[_0xb5a5('0x39')],{'$or':_['map'](_0x178a17,function(_0x3320fc){if(_0x3320fc[_0xb5a5('0x3c')]!=='VIRTUAL'){var _0x2c9a88={};_0x2c9a88[_0x3320fc['name']]={'$like':'%'+_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x3b')]+'%'};return _0x2c9a88;}})});}_0x2c3dd3=_['merge']({},_0x2c3dd3,_0x5bb199[_0xb5a5('0x3d')]);var _0x380c22={'where':_0x2c3dd3[_0xb5a5('0x39')]};return db[_0xb5a5('0x29')][_0xb5a5('0x1e')](_0x380c22)[_0xb5a5('0x23')](function(_0x9238e3){_0x5c2262[_0xb5a5('0x1e')]=_0x9238e3;if(_0x5bb199[_0xb5a5('0x30')][_0xb5a5('0x3e')]){_0x2c3dd3[_0xb5a5('0x3f')]=[{'all':!![]}];}return db[_0xb5a5('0x29')][_0xb5a5('0x40')](_0x2c3dd3);})['then'](function(_0x10f493){_0x5c2262['rows']=_0x10f493;return _0x5c2262;})[_0xb5a5('0x23')](respondWithFilteredResult(_0x3b3075,_0x2c3dd3))[_0xb5a5('0x41')](handleError(_0x3b3075,null));};exports[_0xb5a5('0x42')]=function(_0x56460c,_0x59bed4){var _0x3ebb3c={'raw':!![],'where':{'id':_0x56460c[_0xb5a5('0x43')]['id']}},_0x1a1a5c={};_0x1a1a5c[_0xb5a5('0x2d')]=_[_0xb5a5('0x2f')](db[_0xb5a5('0x29')][_0xb5a5('0x2a')]);_0x1a1a5c[_0xb5a5('0x30')]=_[_0xb5a5('0x2f')](_0x56460c[_0xb5a5('0x30')]);_0x1a1a5c[_0xb5a5('0x44')]=_[_0xb5a5('0x31')](_0x1a1a5c[_0xb5a5('0x2d')],_0x1a1a5c[_0xb5a5('0x30')]);_0x3ebb3c[_0xb5a5('0x32')]=_['intersection'](_0x1a1a5c[_0xb5a5('0x2d')],qs[_0xb5a5('0x33')](_0x56460c[_0xb5a5('0x30')][_0xb5a5('0x33')]));_0x3ebb3c[_0xb5a5('0x32')]=_0x3ebb3c[_0xb5a5('0x32')]['length']?_0x3ebb3c['attributes']:_0x1a1a5c[_0xb5a5('0x2d')];if(_0x56460c[_0xb5a5('0x30')][_0xb5a5('0x3e')]){_0x3ebb3c[_0xb5a5('0x3f')]=[{'all':!![]}];}_0x3ebb3c=_[_0xb5a5('0x45')]({},_0x3ebb3c,_0x56460c[_0xb5a5('0x3d')]);return db[_0xb5a5('0x29')][_0xb5a5('0x46')](_0x3ebb3c)[_0xb5a5('0x23')](handleEntityNotFound(_0x59bed4,null))[_0xb5a5('0x23')](respondWithResult(_0x59bed4,null))[_0xb5a5('0x41')](handleError(_0x59bed4,null));};exports['create']=function(_0x37e030,_0x11f955){return db['VtigerField']['create'](_0x37e030['body'],{})[_0xb5a5('0x23')](respondWithResult(_0x11f955,0xc9))['catch'](handleError(_0x11f955,null));};exports['update']=function(_0x3e9304,_0x4c6b4f){if(_0x3e9304['body']['id']){delete _0x3e9304[_0xb5a5('0x47')]['id'];}return db['VtigerField'][_0xb5a5('0x46')]({'where':{'id':_0x3e9304[_0xb5a5('0x43')]['id']}})[_0xb5a5('0x23')](handleEntityNotFound(_0x4c6b4f,null))['then'](saveUpdates(_0x3e9304[_0xb5a5('0x47')],null))[_0xb5a5('0x23')](respondWithResult(_0x4c6b4f,null))[_0xb5a5('0x41')](handleError(_0x4c6b4f,null));};exports[_0xb5a5('0x24')]=function(_0xa60894,_0x53dbf3){return db[_0xb5a5('0x29')][_0xb5a5('0x46')]({'where':{'id':_0xa60894['params']['id']}})[_0xb5a5('0x23')](handleEntityNotFound(_0x53dbf3,null))[_0xb5a5('0x23')](removeEntity(_0x53dbf3,null))[_0xb5a5('0x41')](handleError(_0x53dbf3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6870982..21b956a 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 _0x0a51=['request-promise','path','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b6465,_0xf3e14a){var _0x478160=function(_0x3cef2b){while(--_0x3cef2b){_0x5b6465['push'](_0x5b6465['shift']());}};_0x478160(++_0xf3e14a);}(_0x0a51,0x18a));var _0x10a5=function(_0x3ddd35,_0x2298a3){_0x3ddd35=_0x3ddd35-0x0;var _0x1cf914=_0x0a51[_0x3ddd35];return _0x1cf914;};'use strict';var _=require(_0x10a5('0x0'));var util=require(_0x10a5('0x1'));var logger=require(_0x10a5('0x2'))(_0x10a5('0x3'));var moment=require(_0x10a5('0x4'));var BPromise=require(_0x10a5('0x5'));var rp=require(_0x10a5('0x6'));var fs=require('fs');var path=require(_0x10a5('0x7'));var rimraf=require('rimraf');var config=require(_0x10a5('0x8'));var attributes=require(_0x10a5('0x9'));module['exports']=function(_0x567e4c,_0x4b9140){return _0x567e4c[_0x10a5('0xa')](_0x10a5('0xb'),attributes,{'tableName':_0x10a5('0xc'),'paranoid':![],'indexes':[{'name':_0x10a5('0xd'),'fields':[_0x10a5('0xe'),_0x10a5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22ef=['request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22ef,0x1cc));var _0xf22e=function(_0xe2f58,_0x43d306){_0xe2f58=_0xe2f58-0x0;var _0x59d7cc=_0x22ef[_0xe2f58];return _0x59d7cc;};'use strict';var _=require(_0xf22e('0x0'));var util=require(_0xf22e('0x1'));var logger=require(_0xf22e('0x2'))('api');var moment=require(_0xf22e('0x3'));var BPromise=require(_0xf22e('0x4'));var rp=require(_0xf22e('0x5'));var fs=require('fs');var path=require(_0xf22e('0x6'));var rimraf=require(_0xf22e('0x7'));var config=require(_0xf22e('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xf22e('0x9')]=function(_0xcb4a09,_0x3840b1){return _0xcb4a09[_0xf22e('0xa')](_0xf22e('0xb'),attributes,{'tableName':_0xf22e('0xc'),'paranoid':![],'indexes':[{'name':_0xf22e('0xd'),'fields':[_0xf22e('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 976bcf1..dfc8ed1 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 _0x419b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','util','bluebird'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0x419b,0x18d));var _0xb419=function(_0x34e703,_0x141ada){_0x34e703=_0x34e703-0x0;var _0x2af631=_0x419b[_0x34e703];return _0x2af631;};'use strict';var _=require(_0xb419('0x0'));var util=require(_0xb419('0x1'));var moment=require('moment');var BPromise=require(_0xb419('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb419('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb419('0x4'));var logger=require(_0xb419('0x5'))(_0xb419('0x6'));var config=require(_0xb419('0x7'));var jayson=require(_0xb419('0x8'));var client=jayson['client'][_0xb419('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a2c66,_0x57291d,_0x272dd5){return new BPromise(function(_0x59b5a2,_0x20bb9e){return client['request'](_0x5a2c66,_0x272dd5)['then'](function(_0x33915b){logger[_0xb419('0xa')]('VtigerField,\x20%s,\x20%s',_0x57291d,'request\x20sent');logger[_0xb419('0xb')](_0xb419('0xc'),_0x57291d,_0xb419('0xd'),JSON[_0xb419('0xe')](_0x33915b));if(_0x33915b[_0xb419('0xf')]){if(_0x33915b[_0xb419('0xf')][_0xb419('0x10')]===0x1f4){logger['error'](_0xb419('0x11'),_0x57291d,_0x33915b[_0xb419('0xf')]['message']);return _0x20bb9e(_0x33915b[_0xb419('0xf')]['message']);}logger[_0xb419('0xf')](_0xb419('0x11'),_0x57291d,_0x33915b['error'][_0xb419('0x12')]);return _0x59b5a2(_0x33915b[_0xb419('0xf')][_0xb419('0x12')]);}else{logger[_0xb419('0xa')]('VtigerField,\x20%s,\x20%s',_0x57291d,'request\x20sent');_0x59b5a2(_0x33915b[_0xb419('0x13')][_0xb419('0x12')]);}})['catch'](function(_0x274325){logger['error']('VtigerField,\x20%s,\x20%s',_0x57291d,_0x274325);_0x20bb9e(_0x274325);});});} \ No newline at end of file +var _0x991b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x76faa4,_0x4a8b9c){var _0x5cab58=function(_0x159033){while(--_0x159033){_0x76faa4['push'](_0x76faa4['shift']());}};_0x5cab58(++_0x4a8b9c);}(_0x991b,0xf6));var _0xb991=function(_0x3c34e2,_0x25961d){_0x3c34e2=_0x3c34e2-0x0;var _0x4c2aff=_0x991b[_0x3c34e2];return _0x4c2aff;};'use strict';var _=require(_0xb991('0x0'));var util=require(_0xb991('0x1'));var moment=require(_0xb991('0x2'));var BPromise=require(_0xb991('0x3'));var rs=require(_0xb991('0x4'));var fs=require('fs');var Redis=require(_0xb991('0x5'));var db=require(_0xb991('0x6'))['db'];var utils=require(_0xb991('0x7'));var logger=require('../../config/logger')(_0xb991('0x8'));var config=require(_0xb991('0x9'));var jayson=require(_0xb991('0xa'));var client=jayson[_0xb991('0xb')][_0xb991('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46baf7,_0x1a190e,_0x1489e3){return new BPromise(function(_0x323453,_0x4a3108){return client[_0xb991('0xd')](_0x46baf7,_0x1489e3)[_0xb991('0xe')](function(_0x262075){logger[_0xb991('0xf')](_0xb991('0x10'),_0x1a190e,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x1a190e,_0xb991('0x11'),JSON['stringify'](_0x262075));if(_0x262075['error']){if(_0x262075['error'][_0xb991('0x12')]===0x1f4){logger[_0xb991('0x13')](_0xb991('0x10'),_0x1a190e,_0x262075[_0xb991('0x13')]['message']);return _0x4a3108(_0x262075[_0xb991('0x13')][_0xb991('0x14')]);}logger[_0xb991('0x13')]('VtigerField,\x20%s,\x20%s',_0x1a190e,_0x262075['error'][_0xb991('0x14')]);return _0x323453(_0x262075[_0xb991('0x13')]['message']);}else{logger['info'](_0xb991('0x10'),_0x1a190e,_0xb991('0x11'));_0x323453(_0x262075[_0xb991('0x15')][_0xb991('0x14')]);}})[_0xb991('0x16')](function(_0x5e0f12){logger[_0xb991('0x13')]('VtigerField,\x20%s,\x20%s',_0x1a190e,_0x5e0f12);_0x4a3108(_0x5e0f12);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 39c7b7d..1cce1e7 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 _0xe83c=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x22c42b,_0x1cbe79){var _0xff22ef=function(_0x31137a){while(--_0x31137a){_0x22c42b['push'](_0x22c42b['shift']());}};_0xff22ef(++_0x1cbe79);}(_0xe83c,0x1a6));var _0xce83=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xe83c[_0x387dc1];return _0x17567c;};'use strict';var multer=require(_0xce83('0x0'));var util=require(_0xce83('0x1'));var path=require(_0xce83('0x2'));var timeout=require('connect-timeout');var express=require(_0xce83('0x3'));var router=express[_0xce83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xce83('0x5'));var interaction=require(_0xce83('0x6'));var config=require('../../config/environment');var controller=require(_0xce83('0x7'));router[_0xce83('0x8')]('/',auth[_0xce83('0x9')](),controller[_0xce83('0xa')]);router['get'](_0xce83('0xb'),auth[_0xce83('0x9')](),controller[_0xce83('0xc')]);router[_0xce83('0x8')](_0xce83('0xd'),auth[_0xce83('0x9')](),controller[_0xce83('0xe')]);router[_0xce83('0x8')](_0xce83('0xf'),auth[_0xce83('0x9')](),controller[_0xce83('0x10')]);router[_0xce83('0x11')]('/',auth[_0xce83('0x9')](),controller[_0xce83('0x12')]);router[_0xce83('0x11')](_0xce83('0xd'),auth[_0xce83('0x9')](),controller[_0xce83('0x13')]);router[_0xce83('0x14')]('/:id',auth[_0xce83('0x9')](),controller[_0xce83('0x15')]);router[_0xce83('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xce83('0x17')]);module['exports']=router; \ No newline at end of file +var _0x60b7=['delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','update'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x60b7,0x1ef));var _0x760b=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x60b7[_0x48b5e0];return _0x4287ea;};'use strict';var multer=require(_0x760b('0x0'));var util=require('util');var path=require(_0x760b('0x1'));var timeout=require(_0x760b('0x2'));var express=require(_0x760b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x760b('0x4'));var interaction=require(_0x760b('0x5'));var config=require('../../config/environment');var controller=require(_0x760b('0x6'));router[_0x760b('0x7')]('/',auth[_0x760b('0x8')](),controller[_0x760b('0x9')]);router['get'](_0x760b('0xa'),auth['isAuthenticated'](),controller[_0x760b('0xb')]);router[_0x760b('0x7')]('/:id/configurations',auth[_0x760b('0x8')](),controller[_0x760b('0xc')]);router[_0x760b('0x7')]('/:id/fields',auth[_0x760b('0x8')](),controller['getFields']);router[_0x760b('0xd')]('/',auth[_0x760b('0x8')](),controller[_0x760b('0xe')]);router[_0x760b('0xd')](_0x760b('0xf'),auth[_0x760b('0x8')](),controller[_0x760b('0x10')]);router['put'](_0x760b('0xa'),auth[_0x760b('0x8')](),controller[_0x760b('0x11')]);router[_0x760b('0x12')]('/:id',auth[_0x760b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9fb0965..63615af 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 _0xd9eb=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd9eb,0xca));var _0xbd9e=function(_0x1c53e1,_0x2f11a8){_0x1c53e1=_0x1c53e1-0x0;var _0x1f5b1f=_0xd9eb[_0x1c53e1];return _0x1f5b1f;};'use strict';var Sequelize=require(_0xbd9e('0x0'));module[_0xbd9e('0x1')]={'name':{'type':Sequelize[_0xbd9e('0x2')]},'description':{'type':Sequelize[_0xbd9e('0x2')]},'username':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x3')},'password':{'type':Sequelize[_0xbd9e('0x2')]},'token':{'type':Sequelize[_0xbd9e('0x2')]},'remoteUri':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x4')},'authType':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x6'),_0xbd9e('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xbd9e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x8'),_0xbd9e('0x9')),'defaultValue':_0xbd9e('0x8')}}; \ No newline at end of file +var _0xf2e3=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','token','password'];(function(_0x31600c,_0x16295b){var _0x295cc1=function(_0x1e84cf){while(--_0x1e84cf){_0x31600c['push'](_0x31600c['shift']());}};_0x295cc1(++_0x16295b);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xf2e3[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'password':{'type':Sequelize[_0x3f2e('0x1')]},'token':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'authType':{'type':Sequelize[_0x3f2e('0x4')]('password',_0x3f2e('0x5')),'defaultValue':_0x3f2e('0x6')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3f2e('0x4')](_0x3f2e('0x7'),_0x3f2e('0x8')),'defaultValue':_0x3f2e('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9d70a2e..9428849 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 _0xb688=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','create','params','body','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','getFields','username','password','token','remoteUri','slice','substring','%s/%s','authType','format','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xb688,0xcf));var _0x8b68=function(_0x3653bc,_0x2f9eec){_0x3653bc=_0x3653bc-0x0;var _0x2a19fd=_0xb688[_0x3653bc];return _0x2a19fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var integrations=require(_0x8b68('0x1b'));function respondWithStatusCode(_0x2f3af4,_0xaa8725){_0xaa8725=_0xaa8725||0xcc;return function(_0x137c8e){if(_0x137c8e){return _0x2f3af4[_0x8b68('0x1c')](_0xaa8725);}return _0x2f3af4['status'](_0xaa8725)[_0x8b68('0x1d')]();};}function respondWithResult(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xc8;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x1e')](_0x5e3c66)[_0x8b68('0x1f')](_0x22f75b);}};}function respondWithFilteredResult(_0x5d3468,_0x5c8d0e){return function(_0x23bd52){if(_0x23bd52){var _0x5c1e44=typeof _0x5c8d0e[_0x8b68('0x20')]===_0x8b68('0x21')&&typeof _0x5c8d0e[_0x8b68('0x22')]===_0x8b68('0x21');var _0x491695=_0x23bd52[_0x8b68('0x23')];var _0x203dd4=_0x5c1e44?0x0:_0x5c8d0e['offset'];var _0x42b3bd=_0x5c1e44?_0x23bd52[_0x8b68('0x23')]:_0x5c8d0e[_0x8b68('0x20')]+_0x5c8d0e[_0x8b68('0x22')];var _0x38b7a7;if(_0x42b3bd>=_0x491695){_0x42b3bd=_0x491695;_0x38b7a7=0xc8;}else{_0x38b7a7=0xce;}_0x5d3468['status'](_0x38b7a7);return _0x5d3468[_0x8b68('0x24')](_0x8b68('0x25'),_0x203dd4+'-'+_0x42b3bd+'/'+_0x491695)[_0x8b68('0x1f')](_0x23bd52);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x26')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x27')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x28')](_0x59cb26)[_0x8b68('0x29')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2a')]()['then'](function(){_0x173524[_0x8b68('0x1e')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2b')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x1e')](_0x448e43)['send'](_0x2ba2a3);};}exports[_0x8b68('0x2c')]=function(_0x3ac356,_0x48e2c8){var _0x494ce4={},_0x357635={},_0x1cd230={'count':0x0,'rows':[]};var _0x1e7c06=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')],function(_0x460c37){return{'name':_0x460c37['fieldName'],'type':_0x460c37[_0x8b68('0x30')]['key']};});_0x357635[_0x8b68('0x31')]=_[_0x8b68('0x2d')](_0x1e7c06,'name');_0x357635[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ac356[_0x8b68('0x32')]);_0x357635['filters']=_['intersection'](_0x357635[_0x8b68('0x31')],_0x357635[_0x8b68('0x32')]);_0x494ce4[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x357635[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x36')]));_0x494ce4[_0x8b68('0x34')]=_0x494ce4[_0x8b68('0x34')][_0x8b68('0x37')]?_0x494ce4[_0x8b68('0x34')]:_0x357635[_0x8b68('0x31')];if(!_0x3ac356[_0x8b68('0x32')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x494ce4[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x22')]);_0x494ce4[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3ac356['query']['offset']);}_0x494ce4[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x494ce4[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x3ac356[_0x8b68('0x32')],_0x357635['filters']),_0x1e7c06);if(_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x494ce4[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x494ce4[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x1e7c06,function(_0xff4080){if(_0xff4080[_0x8b68('0x30')]!=='VIRTUAL'){var _0x3f874c={};_0x3f874c[_0xff4080[_0x8b68('0x41')]]={'$like':'%'+_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]+'%'};return _0x3f874c;}})});}_0x494ce4=_[_0x8b68('0x40')]({},_0x494ce4,_0x3ac356[_0x8b68('0x42')]);var _0xa748c2={'where':_0x494ce4['where']};return db[_0x8b68('0x2e')][_0x8b68('0x23')](_0xa748c2)['then'](function(_0x14ec40){_0x1cd230[_0x8b68('0x23')]=_0x14ec40;if(_0x3ac356['query']['includeAll']){_0x494ce4['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8b68('0x43')](_0x494ce4);})[_0x8b68('0x29')](function(_0x515815){_0x1cd230[_0x8b68('0x44')]=_0x515815;return _0x1cd230;})['then'](respondWithFilteredResult(_0x48e2c8,_0x494ce4))[_0x8b68('0x45')](handleError(_0x48e2c8,null));};exports[_0x8b68('0x46')]=function(_0x5a3193,_0x2f90d9){var _0x5ae345={'raw':![],'where':{'id':_0x5a3193['params']['id']}},_0x4a718c={};_0x4a718c[_0x8b68('0x31')]=_[_0x8b68('0x33')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x4a718c['query']=_[_0x8b68('0x33')](_0x5a3193['query']);_0x4a718c[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x4a718c['model'],_0x4a718c[_0x8b68('0x32')]);_0x5ae345[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x4a718c[_0x8b68('0x31')],qs['fields'](_0x5a3193[_0x8b68('0x32')][_0x8b68('0x36')]));_0x5ae345[_0x8b68('0x34')]=_0x5ae345[_0x8b68('0x34')][_0x8b68('0x37')]?_0x5ae345[_0x8b68('0x34')]:_0x4a718c[_0x8b68('0x31')];if(_0x5a3193[_0x8b68('0x32')][_0x8b68('0x47')]){_0x5ae345[_0x8b68('0x48')]=[{'all':!![]}];}_0x5ae345=_[_0x8b68('0x40')]({},_0x5ae345,_0x5a3193[_0x8b68('0x42')]);return db[_0x8b68('0x2e')][_0x8b68('0x49')](_0x5ae345)[_0x8b68('0x29')](handleEntityNotFound(_0x2f90d9,null))[_0x8b68('0x29')](respondWithResult(_0x2f90d9,null))['catch'](handleError(_0x2f90d9,null));};exports[_0x8b68('0x4a')]=function(_0x20681a,_0x5dd099){return db[_0x8b68('0x2e')]['create'](_0x20681a['body'],{})['then'](respondWithResult(_0x5dd099,0xc9))[_0x8b68('0x45')](handleError(_0x5dd099,null));};exports[_0x8b68('0x28')]=function(_0x34047c,_0x6da48b){if(_0x34047c['body']['id']){delete _0x34047c['body']['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x49')]({'where':{'id':_0x34047c[_0x8b68('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6da48b,null))[_0x8b68('0x29')](saveUpdates(_0x34047c[_0x8b68('0x4c')],null))['then'](respondWithResult(_0x6da48b,null))[_0x8b68('0x45')](handleError(_0x6da48b,null));};exports[_0x8b68('0x2a')]=function(_0x595942,_0x18a9ae){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0x595942[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x18a9ae,null))['then'](removeEntity(_0x18a9ae,null))['catch'](handleError(_0x18a9ae,null));};exports['getConfigurations']=function(_0x28f82d,_0x42eabd,_0x3718b2){var _0x3d4b4f={};var _0x55aad3={};var _0x5a1711;var _0x4492fd;return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x28f82d['params']['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x42eabd,null))[_0x8b68('0x29')](function(_0x3f9d34){if(_0x3f9d34){_0x5a1711=_0x3f9d34;_0x55aad3['model']=_[_0x8b68('0x33')](db['ZendeskConfiguration'][_0x8b68('0x2f')]);_0x55aad3[_0x8b68('0x32')]=_['keys'](_0x28f82d[_0x8b68('0x32')]);_0x55aad3[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],_0x55aad3[_0x8b68('0x32')]);_0x3d4b4f['attributes']=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x36')]));_0x3d4b4f[_0x8b68('0x34')]=_0x3d4b4f[_0x8b68('0x34')][_0x8b68('0x37')]?_0x3d4b4f['attributes']:_0x55aad3[_0x8b68('0x31')];_0x3d4b4f[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x3d4b4f[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x28f82d[_0x8b68('0x32')],_0x55aad3[_0x8b68('0x3d')]));if(_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x3d4b4f[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x3d4b4f[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x3d4b4f[_0x8b68('0x34')],function(_0x3da7b4){var _0xae90f0={};_0xae90f0[_0x3da7b4]={'$like':'%'+_0x28f82d[_0x8b68('0x32')]['filter']+'%'};return _0xae90f0;})});}_0x3d4b4f=_[_0x8b68('0x40')]({},_0x3d4b4f,_0x28f82d['options']);return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x5d2476){if(_0x5d2476){_0x4492fd=_0x5d2476[_0x8b68('0x37')];if(!_0x28f82d[_0x8b68('0x32')][_0x8b68('0x38')]('nolimit')){_0x3d4b4f[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x22')]);_0x3d4b4f[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x28f82d[_0x8b68('0x32')]['offset']);}return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5?{'count':_0x4492fd,'rows':_0x4224f5}:null;}})[_0x8b68('0x29')](respondWithResult(_0x42eabd,null))[_0x8b68('0x45')](handleError(_0x42eabd,null));};exports[_0x8b68('0x4e')]=function(_0x37da34,_0x2d1519,_0x314f1e){if(_0x37da34[_0x8b68('0x4c')]['id']){delete _0x37da34[_0x8b68('0x4c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x37da34[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x2d1519,null))[_0x8b68('0x29')](function(_0x414096){if(_0x414096){_0x37da34[_0x8b68('0x4c')][_0x8b68('0x4f')]=_0x414096['id'];_0x37da34['body']['Subjects']=integrations[_0x8b68('0x50')](_0x37da34[_0x8b68('0x4c')]['channel'],_0x37da34['body']['type']);_0x37da34[_0x8b68('0x4c')][_0x8b68('0x51')]=integrations[_0x8b68('0x52')](_0x37da34[_0x8b68('0x4c')][_0x8b68('0x53')],_0x37da34['body'][_0x8b68('0x30')]);return db[_0x8b68('0x54')]['create'](_0x37da34[_0x8b68('0x4c')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x8b68('0x51')}]});}return null;})[_0x8b68('0x29')](respondWithResult(_0x2d1519,null))[_0x8b68('0x45')](handleError(_0x2d1519,null));};exports[_0x8b68('0x55')]=function(_0x864b6b,_0x1fc24c,_0x35b22b){var _0x34456d='';return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x864b6b['params']['id']},'attributes':['id',_0x8b68('0x56'),_0x8b68('0x57'),_0x8b68('0x58'),'authType','remoteUri']})[_0x8b68('0x29')](handleEntityNotFound(_0x1fc24c,null))[_0x8b68('0x29')](function(_0x525b41){if(_0x525b41){_0x34456d=_0x525b41[_0x8b68('0x59')];var _0x2c1c96=_0x34456d[_0x8b68('0x5a')](-0x1);if(_0x2c1c96==='/'){_0x34456d=_0x34456d[_0x8b68('0x5b')](0x0,_0x34456d['lastIndexOf'](_0x2c1c96));}var _0x96e526={'method':'GET','uri':util['format'](_0x8b68('0x5c'),_0x34456d,'ticket_fields'),'json':!![]};switch(_0x525b41[_0x8b68('0x5d')]){case _0x8b68('0x57'):_0x96e526['headers']={'Authorization':util[_0x8b68('0x5e')](_0x8b68('0x5f'),new Buffer(util[_0x8b68('0x5e')](_0x8b68('0x60'),_0x525b41[_0x8b68('0x56')],_0x525b41['password']))[_0x8b68('0x61')](_0x8b68('0x62')))};break;case _0x8b68('0x58'):_0x96e526[_0x8b68('0x63')]={'Authorization':util[_0x8b68('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x8b68('0x64'),_0x525b41['username'],_0x525b41[_0x8b68('0x58')]))[_0x8b68('0x61')](_0x8b68('0x62')))};break;default:throw new db[(_0x8b68('0x65'))][(_0x8b68('0x66'))](_0x8b68('0x67'));}return rp(_0x96e526);}})[_0x8b68('0x29')](function(_0x486be8){if(_0x486be8){var _0x3033b4=['subject',_0x8b68('0x68'),_0x8b68('0x69'),_0x8b68('0x6a')];_['remove'](_0x486be8[_0x8b68('0x6b')],function(_0x50d0b9){return _0x3033b4[_0x8b68('0x6c')](_0x50d0b9['type']);});return{'count':_0x486be8[_0x8b68('0x6b')][_0x8b68('0x37')],'rows':_[_0x8b68('0x2d')](_0x486be8['ticket_fields'],function(_0x33b775){return{'id':_0x33b775['id'],'name':_0x33b775[_0x8b68('0x6d')]>0x7?_0x33b775[_0x8b68('0x6e')]:_0x33b775[_0x8b68('0x30')],'custom':_0x33b775[_0x8b68('0x6d')]>0x7?!![]:![],'options':_0x33b775[_0x8b68('0x6f')]?_0x33b775[_0x8b68('0x6f')]:_0x33b775[_0x8b68('0x70')]?_0x33b775[_0x8b68('0x70')]:[]};})};}})['then'](respondWithResult(_0x1fc24c,null))[_0x8b68('0x45')](function(_0x3cb970){var _0x9a5bec=_0x864b6b[_0x8b68('0x32')][_0x8b68('0x71')]?0x1f4:_0x3cb970['statusCode']||0x1f4;logger[_0x8b68('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b68('0x55'),_0x9a5bec,JSON[_0x8b68('0x73')](_0x3cb970));delete _0x3cb970['name'];if(_0x9a5bec===0x191){_0x9a5bec=0x190;}_0x1fc24c[_0x8b68('0x1e')](_0x9a5bec)[_0x8b68('0x74')](_0x864b6b[_0x8b68('0x32')]['test']?{'message':_0x8b68('0x75'),'statusCode':_0x3cb970[_0x8b68('0x76')]}:_0x3cb970);});}; \ No newline at end of file +var _0xe605=['password','token','authType','remoteUri','slice','GET','format','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username'];(function(_0x6fae04,_0x33078d){var _0x546f87=function(_0xf771a0){while(--_0xf771a0){_0x6fae04['push'](_0x6fae04['shift']());}};_0x546f87(++_0x33078d);}(_0xe605,0x92));var _0x5e60=function(_0x8f92f4,_0x1de9e9){_0x8f92f4=_0x8f92f4-0x0;var _0x8424fc=_0xe605[_0x8f92f4];return _0x8424fc;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e60('0x19'));function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x1a')](_0x1f4e14);}return _0x178782[_0x5e60('0x1b')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1b')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=typeof _0x529ffe['offset']===_0x5e60('0x1c')&&typeof _0x529ffe[_0x5e60('0x1d')]===_0x5e60('0x1c');var _0x43045a=_0x1ffd77['count'];var _0xdd0a71=_0x3bc7d8?0x0:_0x529ffe[_0x5e60('0x1e')];var _0x52cc15=_0x3bc7d8?_0x1ffd77[_0x5e60('0x1f')]:_0x529ffe[_0x5e60('0x1e')]+_0x529ffe[_0x5e60('0x1d')];var _0x311fef;if(_0x52cc15>=_0x43045a){_0x52cc15=_0x43045a;_0x311fef=0xc8;}else{_0x311fef=0xce;}_0x20af5f[_0x5e60('0x1b')](_0x311fef);return _0x20af5f[_0x5e60('0x20')](_0x5e60('0x21'),_0xdd0a71+'-'+_0x52cc15+'/'+_0x43045a)[_0x5e60('0x22')](_0x1ffd77);}return null;};}function patchUpdates(_0x3282e4){return function(_0x45f1a6){try{jsonpatch[_0x5e60('0x23')](_0x45f1a6,_0x3282e4,!![]);}catch(_0x578437){return BPromise[_0x5e60('0x24')](_0x578437);}return _0x45f1a6['save']();};}function saveUpdates(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x25')](_0x376069)[_0x5e60('0x26')](function(_0x2a499e){return _0x2a499e;});}return null;};}function removeEntity(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){return _0x18d527[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2636f1['status'](0xcc)[_0x5e60('0x28')]();});}};}function handleEntityNotFound(_0x56e3a5,_0x2d8aac){return function(_0x153459){if(!_0x153459){_0x56e3a5['sendStatus'](0x194);}return _0x153459;};}function handleError(_0x3bedea,_0x5712f7){_0x5712f7=_0x5712f7||0x1f4;return function(_0x23d187){logger[_0x5e60('0x29')](_0x23d187['stack']);if(_0x23d187[_0x5e60('0x2a')]){delete _0x23d187[_0x5e60('0x2a')];}_0x3bedea['status'](_0x5712f7)[_0x5e60('0x2b')](_0x23d187);};}exports[_0x5e60('0x2c')]=function(_0x52c97c,_0x5431a8){var _0x52f668={},_0xf25956={},_0x235cc7={'count':0x0,'rows':[]};var _0x2e8e9e=_[_0x5e60('0x2d')](db[_0x5e60('0x2e')]['rawAttributes'],function(_0x168ce6){return{'name':_0x168ce6[_0x5e60('0x2f')],'type':_0x168ce6['type'][_0x5e60('0x30')]};});_0xf25956['model']=_['map'](_0x2e8e9e,_0x5e60('0x2a'));_0xf25956[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x52c97c[_0x5e60('0x31')]);_0xf25956[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0xf25956[_0x5e60('0x35')],_0xf25956[_0x5e60('0x31')]);_0x52f668[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0xf25956['model'],qs[_0x5e60('0x37')](_0x52c97c['query']['fields']));_0x52f668[_0x5e60('0x36')]=_0x52f668[_0x5e60('0x36')]['length']?_0x52f668[_0x5e60('0x36')]:_0xf25956['model'];if(!_0x52c97c[_0x5e60('0x31')][_0x5e60('0x38')](_0x5e60('0x39'))){_0x52f668[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x52f668[_0x5e60('0x1e')]=qs['offset'](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1e')]);}_0x52f668[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x52f668[_0x5e60('0x3c')]=qs['filters'](_[_0x5e60('0x3d')](_0x52c97c[_0x5e60('0x31')],_0xf25956['filters']),_0x2e8e9e);if(_0x52c97c['query'][_0x5e60('0x3e')]){_0x52f668[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x52f668[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x2e8e9e,function(_0x4d2cd0){if(_0x4d2cd0[_0x5e60('0x40')]!==_0x5e60('0x41')){var _0x415208={};_0x415208[_0x4d2cd0[_0x5e60('0x2a')]]={'$like':'%'+_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3e')]+'%'};return _0x415208;}})});}_0x52f668=_[_0x5e60('0x3f')]({},_0x52f668,_0x52c97c['options']);var _0x401bf1={'where':_0x52f668[_0x5e60('0x3c')]};return db['ZendeskAccount']['count'](_0x401bf1)['then'](function(_0x15a97b){_0x235cc7[_0x5e60('0x1f')]=_0x15a97b;if(_0x52c97c[_0x5e60('0x31')][_0x5e60('0x42')]){_0x52f668['include']=[{'all':!![]}];}return db[_0x5e60('0x2e')][_0x5e60('0x43')](_0x52f668);})['then'](function(_0x5bda22){_0x235cc7[_0x5e60('0x44')]=_0x5bda22;return _0x235cc7;})[_0x5e60('0x26')](respondWithFilteredResult(_0x5431a8,_0x52f668))[_0x5e60('0x45')](handleError(_0x5431a8,null));};exports[_0x5e60('0x46')]=function(_0x39ab09,_0x3899ae){var _0x2522d2={'raw':![],'where':{'id':_0x39ab09[_0x5e60('0x47')]['id']}},_0x2812e1={};_0x2812e1['model']=_[_0x5e60('0x32')](db[_0x5e60('0x2e')]['rawAttributes']);_0x2812e1[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x39ab09[_0x5e60('0x31')]);_0x2812e1[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2812e1['model'],_0x2812e1[_0x5e60('0x31')]);_0x2522d2[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0x2812e1[_0x5e60('0x35')],qs['fields'](_0x39ab09['query']['fields']));_0x2522d2[_0x5e60('0x36')]=_0x2522d2[_0x5e60('0x36')][_0x5e60('0x48')]?_0x2522d2[_0x5e60('0x36')]:_0x2812e1[_0x5e60('0x35')];if(_0x39ab09[_0x5e60('0x31')]['includeAll']){_0x2522d2[_0x5e60('0x49')]=[{'all':!![]}];}_0x2522d2=_[_0x5e60('0x3f')]({},_0x2522d2,_0x39ab09[_0x5e60('0x4a')]);return db[_0x5e60('0x2e')][_0x5e60('0x4b')](_0x2522d2)[_0x5e60('0x26')](handleEntityNotFound(_0x3899ae,null))[_0x5e60('0x26')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x5e60('0x4c')]=function(_0x3ed45d,_0x21a116){return db[_0x5e60('0x2e')][_0x5e60('0x4c')](_0x3ed45d[_0x5e60('0x4d')],{})[_0x5e60('0x26')](respondWithResult(_0x21a116,0xc9))[_0x5e60('0x45')](handleError(_0x21a116,null));};exports[_0x5e60('0x25')]=function(_0x350d6d,_0xe5e675){if(_0x350d6d[_0x5e60('0x4d')]['id']){delete _0x350d6d[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x350d6d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0xe5e675,null))[_0x5e60('0x26')](saveUpdates(_0x350d6d['body'],null))['then'](respondWithResult(_0xe5e675,null))[_0x5e60('0x45')](handleError(_0xe5e675,null));};exports['destroy']=function(_0x3525d,_0x1d247e){return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x3525d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x1d247e,null))['then'](removeEntity(_0x1d247e,null))['catch'](handleError(_0x1d247e,null));};exports[_0x5e60('0x4e')]=function(_0x1e4e41,_0x457c37,_0x4a2d67){var _0x594068={};var _0x31ced8={};var _0x46f3ba;var _0x179cc6;return db['ZendeskAccount'][_0x5e60('0x4f')]({'where':{'id':_0x1e4e41[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x457c37,null))[_0x5e60('0x26')](function(_0x17d002){if(_0x17d002){_0x46f3ba=_0x17d002;_0x31ced8[_0x5e60('0x35')]=_['keys'](db[_0x5e60('0x50')][_0x5e60('0x51')]);_0x31ced8['query']=_[_0x5e60('0x32')](_0x1e4e41[_0x5e60('0x31')]);_0x31ced8[_0x5e60('0x33')]=_['intersection'](_0x31ced8[_0x5e60('0x35')],_0x31ced8[_0x5e60('0x31')]);_0x594068['attributes']=_[_0x5e60('0x34')](_0x31ced8[_0x5e60('0x35')],qs[_0x5e60('0x37')](_0x1e4e41[_0x5e60('0x31')]['fields']));_0x594068[_0x5e60('0x36')]=_0x594068[_0x5e60('0x36')]['length']?_0x594068[_0x5e60('0x36')]:_0x31ced8['model'];_0x594068[_0x5e60('0x3a')]=qs['sort'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x594068['where']=qs[_0x5e60('0x33')](_['pick'](_0x1e4e41[_0x5e60('0x31')],_0x31ced8['filters']));if(_0x1e4e41[_0x5e60('0x31')]['filter']){_0x594068[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x594068[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x594068[_0x5e60('0x36')],function(_0x2b8343){var _0x3d1e35={};_0x3d1e35[_0x2b8343]={'$like':'%'+_0x1e4e41['query'][_0x5e60('0x3e')]+'%'};return _0x3d1e35;})});}_0x594068=_[_0x5e60('0x3f')]({},_0x594068,_0x1e4e41[_0x5e60('0x4a')]);return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0x35aad7){if(_0x35aad7){_0x179cc6=_0x35aad7['length'];if(!_0x1e4e41['query']['hasOwnProperty'](_0x5e60('0x39'))){_0x594068[_0x5e60('0x1d')]=qs['limit'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x594068['offset']=qs[_0x5e60('0x1e')](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1e')]);}return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232?{'count':_0x179cc6,'rows':_0xcd2232}:null;}})[_0x5e60('0x26')](respondWithResult(_0x457c37,null))[_0x5e60('0x45')](handleError(_0x457c37,null));};exports[_0x5e60('0x52')]=function(_0x406c3a,_0x157aad,_0x15921d){if(_0x406c3a[_0x5e60('0x4d')]['id']){delete _0x406c3a[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4f')]({'where':{'id':_0x406c3a[_0x5e60('0x47')]['id']}})['then'](handleEntityNotFound(_0x157aad,null))[_0x5e60('0x26')](function(_0x1706d6){if(_0x1706d6){_0x406c3a[_0x5e60('0x4d')]['AccountId']=_0x1706d6['id'];_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x53')]=integrations['getSubjects'](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a['body'][_0x5e60('0x40')]);_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x40')]);return db[_0x5e60('0x50')]['create'](_0x406c3a[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x53')},{'model':db['ZendeskField'],'as':_0x5e60('0x55')}]});}return null;})[_0x5e60('0x26')](respondWithResult(_0x157aad,null))[_0x5e60('0x45')](handleError(_0x157aad,null));};exports[_0x5e60('0x58')]=function(_0x3e85fe,_0x559f8c,_0x4560e1){var _0x213c7e='';return db[_0x5e60('0x2e')]['findOne']({'where':{'id':_0x3e85fe['params']['id']},'attributes':['id',_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d')]})[_0x5e60('0x26')](handleEntityNotFound(_0x559f8c,null))[_0x5e60('0x26')](function(_0x563e69){if(_0x563e69){_0x213c7e=_0x563e69[_0x5e60('0x5d')];var _0x199edd=_0x213c7e[_0x5e60('0x5e')](-0x1);if(_0x199edd==='/'){_0x213c7e=_0x213c7e['substring'](0x0,_0x213c7e['lastIndexOf'](_0x199edd));}var _0x447bd3={'method':_0x5e60('0x5f'),'uri':util[_0x5e60('0x60')]('%s/%s',_0x213c7e,'ticket_fields'),'json':!![]};switch(_0x563e69[_0x5e60('0x5c')]){case _0x5e60('0x5a'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5a')]))[_0x5e60('0x63')](_0x5e60('0x64')))};break;case _0x5e60('0x5b'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s/token:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5b')]))['toString'](_0x5e60('0x64')))};break;default:throw new db[(_0x5e60('0x65'))]['ValidationError'](_0x5e60('0x66'));}return rp(_0x447bd3);}})[_0x5e60('0x26')](function(_0x391505){if(_0x391505){var _0x1b4aee=[_0x5e60('0x67'),_0x5e60('0x68'),'group',_0x5e60('0x69')];_[_0x5e60('0x6a')](_0x391505[_0x5e60('0x6b')],function(_0x222d94){return _0x1b4aee[_0x5e60('0x6c')](_0x222d94[_0x5e60('0x40')]);});return{'count':_0x391505[_0x5e60('0x6b')][_0x5e60('0x48')],'rows':_[_0x5e60('0x2d')](_0x391505['ticket_fields'],function(_0x10b77b){return{'id':_0x10b77b['id'],'name':_0x10b77b[_0x5e60('0x6d')]>0x7?_0x10b77b[_0x5e60('0x6e')]:_0x10b77b[_0x5e60('0x40')],'custom':_0x10b77b[_0x5e60('0x6d')]>0x7?!![]:![],'options':_0x10b77b[_0x5e60('0x6f')]?_0x10b77b[_0x5e60('0x6f')]:_0x10b77b[_0x5e60('0x70')]?_0x10b77b[_0x5e60('0x70')]:[]};})};}})[_0x5e60('0x26')](respondWithResult(_0x559f8c,null))['catch'](function(_0x5ab78f){var _0x5d2839=_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?0x1f4:_0x5ab78f[_0x5e60('0x72')]||0x1f4;logger[_0x5e60('0x29')](_0x5e60('0x73'),_0x5e60('0x58'),_0x5d2839,JSON[_0x5e60('0x74')](_0x5ab78f));delete _0x5ab78f[_0x5e60('0x2a')];if(_0x5d2839===0x191){_0x5d2839=0x190;}_0x559f8c[_0x5e60('0x1b')](_0x5d2839)['send'](_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?{'message':_0x5e60('0x75'),'statusCode':_0x5ab78f['statusCode']}:_0x5ab78f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4349573..0604787 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 _0x3350=['api','moment','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x15d4d8,_0x283fa1){var _0x435739=function(_0x13d686){while(--_0x13d686){_0x15d4d8['push'](_0x15d4d8['shift']());}};_0x435739(++_0x283fa1);}(_0x3350,0xc9));var _0x0335=function(_0x2315d7,_0x14806d){_0x2315d7=_0x2315d7-0x0;var _0x49b9a1=_0x3350[_0x2315d7];return _0x49b9a1;};'use strict';var _=require(_0x0335('0x0'));var util=require(_0x0335('0x1'));var logger=require(_0x0335('0x2'))(_0x0335('0x3'));var moment=require(_0x0335('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0335('0x5'));var rimraf=require(_0x0335('0x6'));var config=require('../../config/environment');var attributes=require(_0x0335('0x7'));var integrations=require(_0x0335('0x8'));module[_0x0335('0x9')]=function(_0x1cf63d,_0x421539){return _0x1cf63d[_0x0335('0xa')]('ZendeskAccount',attributes,{'tableName':_0x0335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdec8=['int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount'];(function(_0xc1f0d2,_0x1f1305){var _0x4245cd=function(_0x5d9dcf){while(--_0x5d9dcf){_0xc1f0d2['push'](_0xc1f0d2['shift']());}};_0x4245cd(++_0x1f1305);}(_0xdec8,0xef));var _0x8dec=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xdec8[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x8dec('0x0'));var util=require(_0x8dec('0x1'));var logger=require('../../config/logger')(_0x8dec('0x2'));var moment=require(_0x8dec('0x3'));var BPromise=require(_0x8dec('0x4'));var rp=require(_0x8dec('0x5'));var fs=require('fs');var path=require(_0x8dec('0x6'));var rimraf=require(_0x8dec('0x7'));var config=require(_0x8dec('0x8'));var attributes=require(_0x8dec('0x9'));var integrations=require(_0x8dec('0xa'));module[_0x8dec('0xb')]=function(_0x281075,_0x34143d){return _0x281075['define'](_0x8dec('0xc'),attributes,{'tableName':_0x8dec('0xd'),'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 7add447..cac6441 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 _0xbc85=['jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ZendeskAccount','find','where','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0xbc85,0x7d));var _0x5bc8=function(_0xa288ab,_0x465375){_0xa288ab=_0xa288ab-0x0;var _0x11e9f2=_0xbc85[_0xa288ab];return _0x11e9f2;};'use strict';var _=require('lodash');var util=require(_0x5bc8('0x0'));var moment=require('moment');var BPromise=require(_0x5bc8('0x1'));var rs=require(_0x5bc8('0x2'));var fs=require('fs');var Redis=require(_0x5bc8('0x3'));var db=require(_0x5bc8('0x4'))['db'];var utils=require(_0x5bc8('0x5'));var logger=require(_0x5bc8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bc8('0x7'));var client=jayson[_0x5bc8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9f9a,_0x590e43,_0x4b56ce){return new BPromise(function(_0x51d6df,_0x1c07e5){return client[_0x5bc8('0x9')](_0x1a9f9a,_0x4b56ce)[_0x5bc8('0xa')](function(_0x41a5a4){logger[_0x5bc8('0xb')](_0x5bc8('0xc'),_0x590e43,'request\x20sent');logger[_0x5bc8('0xd')](_0x5bc8('0xe'),_0x590e43,_0x5bc8('0xf'),JSON[_0x5bc8('0x10')](_0x41a5a4));if(_0x41a5a4[_0x5bc8('0x11')]){if(_0x41a5a4[_0x5bc8('0x11')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x590e43,_0x41a5a4[_0x5bc8('0x11')][_0x5bc8('0x12')]);return _0x1c07e5(_0x41a5a4[_0x5bc8('0x11')][_0x5bc8('0x12')]);}logger[_0x5bc8('0x11')](_0x5bc8('0xc'),_0x590e43,_0x41a5a4['error'][_0x5bc8('0x12')]);return _0x51d6df(_0x41a5a4[_0x5bc8('0x11')][_0x5bc8('0x12')]);}else{logger[_0x5bc8('0xb')](_0x5bc8('0xc'),_0x590e43,'request\x20sent');_0x51d6df(_0x41a5a4['result'][_0x5bc8('0x12')]);}})[_0x5bc8('0x13')](function(_0x46529a){logger[_0x5bc8('0x11')](_0x5bc8('0xc'),_0x590e43,_0x46529a);_0x1c07e5(_0x46529a);});});}exports[_0x5bc8('0x14')]=function(_0x4c48b6){var _0xd12cac=this;return new Promise(function(_0x181881,_0x2786d9){return db['ZendeskAccount'][_0x5bc8('0x15')]({'raw':_0x4c48b6[_0x5bc8('0x16')]?_0x4c48b6[_0x5bc8('0x16')][_0x5bc8('0x17')]===undefined?!![]:![]:!![],'where':_0x4c48b6[_0x5bc8('0x16')]?_0x4c48b6[_0x5bc8('0x16')]['where']||null:null,'attributes':_0x4c48b6['options']?_0x4c48b6[_0x5bc8('0x16')][_0x5bc8('0x18')]||null:null,'limit':_0x4c48b6['options']?_0x4c48b6[_0x5bc8('0x16')][_0x5bc8('0x19')]||null:null,'include':_0x4c48b6[_0x5bc8('0x16')]?_0x4c48b6['options'][_0x5bc8('0x1a')]?_[_0x5bc8('0x1b')](_0x4c48b6['options']['include'],function(_0x671dca){return{'model':db[_0x671dca['model']],'as':_0x671dca['as'],'attributes':_0x671dca[_0x5bc8('0x18')],'include':_0x671dca['include']?_[_0x5bc8('0x1b')](_0x671dca[_0x5bc8('0x1a')],function(_0x1a124f){return{'model':db[_0x1a124f[_0x5bc8('0x1c')]],'as':_0x1a124f['as'],'attributes':_0x1a124f[_0x5bc8('0x18')],'include':_0x1a124f[_0x5bc8('0x1a')]?_[_0x5bc8('0x1b')](_0x1a124f['include'],function(_0x4e6d80){return{'model':db[_0x4e6d80[_0x5bc8('0x1c')]],'as':_0x4e6d80['as'],'attributes':_0x4e6d80[_0x5bc8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5bc8('0xa')](function(_0x29e2c2){logger[_0x5bc8('0xb')](_0x5bc8('0x14'),_0x4c48b6);logger['debug'](_0x5bc8('0x14'),_0x4c48b6,JSON[_0x5bc8('0x10')](_0x29e2c2));_0x181881(_0x29e2c2);})[_0x5bc8('0x13')](function(_0x122f8a){logger['error']('GetZendeskAccount',_0x122f8a['message'],_0x4c48b6);_0x2786d9(_0xd12cac['error'](0x1f4,_0x122f8a[_0x5bc8('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x3684a2){var _0x50df5e=this;return new Promise(function(_0x2258ef,_0x2977bb){return db[_0x5bc8('0x1d')][_0x5bc8('0x1e')]({'raw':_0x3684a2[_0x5bc8('0x16')]?_0x3684a2[_0x5bc8('0x16')][_0x5bc8('0x17')]===undefined?!![]:![]:!![],'where':_0x3684a2[_0x5bc8('0x16')]?_0x3684a2[_0x5bc8('0x16')][_0x5bc8('0x1f')]||null:null,'attributes':_0x3684a2[_0x5bc8('0x16')]?_0x3684a2['options']['attributes']||null:null,'include':_0x3684a2[_0x5bc8('0x16')]?_0x3684a2[_0x5bc8('0x16')]['include']?_['map'](_0x3684a2[_0x5bc8('0x16')][_0x5bc8('0x1a')],function(_0x472586){return{'model':db[_0x472586[_0x5bc8('0x1c')]],'as':_0x472586['as'],'attributes':_0x472586['attributes'],'include':_0x472586[_0x5bc8('0x1a')]?_[_0x5bc8('0x1b')](_0x472586['include'],function(_0x3fe3eb){return{'model':db[_0x3fe3eb[_0x5bc8('0x1c')]],'as':_0x3fe3eb['as'],'attributes':_0x3fe3eb[_0x5bc8('0x18')],'include':_0x3fe3eb['include']?_['map'](_0x3fe3eb[_0x5bc8('0x1a')],function(_0x74aa5b){return{'model':db[_0x74aa5b['model']],'as':_0x74aa5b['as'],'attributes':_0x74aa5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bc8('0xa')](function(_0x5d6e34){logger[_0x5bc8('0xb')]('ShowZendeskAccount',_0x3684a2);logger['debug'](_0x5bc8('0x20'),_0x3684a2,JSON[_0x5bc8('0x10')](_0x5d6e34));_0x2258ef(_0x5d6e34);})[_0x5bc8('0x13')](function(_0x22fbe2){logger[_0x5bc8('0x11')](_0x5bc8('0x20'),_0x22fbe2['message'],_0x3684a2);_0x2977bb(_0x50df5e['error'](0x1f4,_0x22fbe2[_0x5bc8('0x12')]));});});}; \ No newline at end of file +var _0x7670=['GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','find','then','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x44051e,_0xfdce41){var _0x57a6d0=function(_0x210a21){while(--_0x210a21){_0x44051e['push'](_0x44051e['shift']());}};_0x57a6d0(++_0xfdce41);}(_0x7670,0x162));var _0x0767=function(_0x3d6084,_0x4b738b){_0x3d6084=_0x3d6084-0x0;var _0x342378=_0x7670[_0x3d6084];return _0x342378;};'use strict';var _=require(_0x0767('0x0'));var util=require(_0x0767('0x1'));var moment=require(_0x0767('0x2'));var BPromise=require('bluebird');var rs=require(_0x0767('0x3'));var fs=require('fs');var Redis=require(_0x0767('0x4'));var db=require(_0x0767('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0767('0x6'))('rpc');var config=require(_0x0767('0x7'));var jayson=require(_0x0767('0x8'));var client=jayson['client'][_0x0767('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x172bc1,_0x2e8eb0,_0x38c263){return new BPromise(function(_0x3246c7,_0x5e1da8){return client['request'](_0x172bc1,_0x38c263)['then'](function(_0x230a22){logger['info'](_0x0767('0xa'),_0x2e8eb0,_0x0767('0xb'));logger[_0x0767('0xc')](_0x0767('0xd'),_0x2e8eb0,_0x0767('0xb'),JSON[_0x0767('0xe')](_0x230a22));if(_0x230a22['error']){if(_0x230a22[_0x0767('0xf')]['code']===0x1f4){logger[_0x0767('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2e8eb0,_0x230a22['error'][_0x0767('0x10')]);return _0x5e1da8(_0x230a22['error']['message']);}logger['error'](_0x0767('0xa'),_0x2e8eb0,_0x230a22[_0x0767('0xf')][_0x0767('0x10')]);return _0x3246c7(_0x230a22[_0x0767('0xf')][_0x0767('0x10')]);}else{logger[_0x0767('0x11')](_0x0767('0xa'),_0x2e8eb0,'request\x20sent');_0x3246c7(_0x230a22[_0x0767('0x12')][_0x0767('0x10')]);}})[_0x0767('0x13')](function(_0x314f0b){logger[_0x0767('0xf')](_0x0767('0xa'),_0x2e8eb0,_0x314f0b);_0x5e1da8(_0x314f0b);});});}exports[_0x0767('0x14')]=function(_0xf6d910){var _0x41bb6f=this;return new Promise(function(_0x5224c4,_0x44e9d0){return db[_0x0767('0x15')][_0x0767('0x16')]({'raw':_0xf6d910['options']?_0xf6d910['options'][_0x0767('0x17')]===undefined?!![]:![]:!![],'where':_0xf6d910[_0x0767('0x18')]?_0xf6d910['options'][_0x0767('0x19')]||null:null,'attributes':_0xf6d910['options']?_0xf6d910[_0x0767('0x18')][_0x0767('0x1a')]||null:null,'limit':_0xf6d910[_0x0767('0x18')]?_0xf6d910[_0x0767('0x18')][_0x0767('0x1b')]||null:null,'include':_0xf6d910[_0x0767('0x18')]?_0xf6d910[_0x0767('0x18')][_0x0767('0x1c')]?_[_0x0767('0x1d')](_0xf6d910[_0x0767('0x18')][_0x0767('0x1c')],function(_0x1440c3){return{'model':db[_0x1440c3[_0x0767('0x1e')]],'as':_0x1440c3['as'],'attributes':_0x1440c3[_0x0767('0x1a')],'include':_0x1440c3[_0x0767('0x1c')]?_['map'](_0x1440c3[_0x0767('0x1c')],function(_0x1fa190){return{'model':db[_0x1fa190['model']],'as':_0x1fa190['as'],'attributes':_0x1fa190[_0x0767('0x1a')],'include':_0x1fa190[_0x0767('0x1c')]?_['map'](_0x1fa190[_0x0767('0x1c')],function(_0x890a89){return{'model':db[_0x890a89[_0x0767('0x1e')]],'as':_0x890a89['as'],'attributes':_0x890a89[_0x0767('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4afa19){logger[_0x0767('0x11')](_0x0767('0x14'),_0xf6d910);logger[_0x0767('0xc')]('GetZendeskAccount',_0xf6d910,JSON[_0x0767('0xe')](_0x4afa19));_0x5224c4(_0x4afa19);})[_0x0767('0x13')](function(_0x2050b1){logger['error'](_0x0767('0x14'),_0x2050b1[_0x0767('0x10')],_0xf6d910);_0x44e9d0(_0x41bb6f[_0x0767('0xf')](0x1f4,_0x2050b1[_0x0767('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x5335df){var _0x98224a=this;return new Promise(function(_0x49be5a,_0x569600){return db['ZendeskAccount'][_0x0767('0x1f')]({'raw':_0x5335df[_0x0767('0x18')]?_0x5335df['options'][_0x0767('0x17')]===undefined?!![]:![]:!![],'where':_0x5335df['options']?_0x5335df[_0x0767('0x18')][_0x0767('0x19')]||null:null,'attributes':_0x5335df[_0x0767('0x18')]?_0x5335df[_0x0767('0x18')][_0x0767('0x1a')]||null:null,'include':_0x5335df[_0x0767('0x18')]?_0x5335df[_0x0767('0x18')][_0x0767('0x1c')]?_[_0x0767('0x1d')](_0x5335df['options'][_0x0767('0x1c')],function(_0x22f4b7){return{'model':db[_0x22f4b7[_0x0767('0x1e')]],'as':_0x22f4b7['as'],'attributes':_0x22f4b7[_0x0767('0x1a')],'include':_0x22f4b7['include']?_['map'](_0x22f4b7[_0x0767('0x1c')],function(_0x295a88){return{'model':db[_0x295a88['model']],'as':_0x295a88['as'],'attributes':_0x295a88[_0x0767('0x1a')],'include':_0x295a88[_0x0767('0x1c')]?_[_0x0767('0x1d')](_0x295a88[_0x0767('0x1c')],function(_0x7be88){return{'model':db[_0x7be88[_0x0767('0x1e')]],'as':_0x7be88['as'],'attributes':_0x7be88['attributes']};}):[]};}):[]};}):[]:[]})[_0x0767('0x20')](function(_0x5d65c5){logger[_0x0767('0x11')](_0x0767('0x21'),_0x5335df);logger[_0x0767('0xc')](_0x0767('0x21'),_0x5335df,JSON[_0x0767('0xe')](_0x5d65c5));_0x49be5a(_0x5d65c5);})[_0x0767('0x13')](function(_0x29f8cf){logger[_0x0767('0xf')](_0x0767('0x21'),_0x29f8cf['message'],_0x5335df);_0x569600(_0x98224a['error'](0x1f4,_0x29f8cf[_0x0767('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6f8ba12..6ca8ce3 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0xb51272,_0xbe3a11){var _0x42b54e=function(_0x12f7d9){while(--_0x12f7d9){_0xb51272['push'](_0xb51272['shift']());}};_0x42b54e(++_0xbe3a11);}(_0x0bb5,0x148));var _0x50bb=function(_0x3106da,_0x33fa31){_0x3106da=_0x3106da-0x0;var _0x2fb16f=_0x0bb5[_0x3106da];return _0x2fb16f;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xcb91[_0x282a1f];return _0x296ea7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e225da5..277193a 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 _0x452b=['STRING','exports'];(function(_0x479dda,_0x2942a7){var _0x5f2130=function(_0x20082a){while(--_0x20082a){_0x479dda['push'](_0x479dda['shift']());}};_0x5f2130(++_0x2942a7);}(_0x452b,0x83));var _0xb452=function(_0x102659,_0x157f5f){_0x102659=_0x102659-0x0;var _0x103179=_0x452b[_0x102659];return _0x103179;};'use strict';var Sequelize=require('sequelize');module[_0xb452('0x0')]={'name':{'type':Sequelize[_0xb452('0x1')]},'description':{'type':Sequelize[_0xb452('0x1')]}}; \ No newline at end of file +var _0x55ef=['STRING','sequelize'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x55ef,0x1df));var _0xf55e=function(_0x3d27ac,_0x59a539){_0x3d27ac=_0x3d27ac-0x0;var _0x1ac3c6=_0x55ef[_0x3d27ac];return _0x1ac3c6;};'use strict';var Sequelize=require(_0xf55e('0x0'));module['exports']={'name':{'type':Sequelize[_0xf55e('0x1')]},'description':{'type':Sequelize[_0xf55e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3e152e5..f5913ba 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 _0x8bd3=['status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','name','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','getFields','findOne','keys','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x17ca76,_0x2c72f2){var _0x2fe307=function(_0x3d4e4f){while(--_0x3d4e4f){_0x17ca76['push'](_0x17ca76['shift']());}};_0x2fe307(++_0x2c72f2);}(_0x8bd3,0x135));var _0x38bd=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x8bd3[_0x523adf];return _0x283870;};'use strict';var emlformat=require(_0x38bd('0x0'));var rimraf=require(_0x38bd('0x1'));var zipdir=require(_0x38bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38bd('0x3'));var moment=require('moment');var BPromise=require(_0x38bd('0x4'));var Mustache=require(_0x38bd('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x38bd('0x6'));var ejs=require(_0x38bd('0x7'));var fs=require('fs');var fs_extra=require(_0x38bd('0x8'));var _=require('lodash');var squel=require(_0x38bd('0x9'));var crypto=require(_0x38bd('0xa'));var jsforce=require(_0x38bd('0xb'));var deskjs=require(_0x38bd('0xc'));var toCsv=require(_0x38bd('0x6'));var querystring=require(_0x38bd('0xd'));var Papa=require(_0x38bd('0xe'));var Redis=require(_0x38bd('0xf'));var authService=require(_0x38bd('0x10'));var qs=require(_0x38bd('0x11'));var as=require(_0x38bd('0x12'));var hardwareService=require(_0x38bd('0x13'));var logger=require(_0x38bd('0x14'))(_0x38bd('0x15'));var utils=require(_0x38bd('0x16'));var config=require(_0x38bd('0x17'));var licenseUtil=require(_0x38bd('0x18'));var db=require(_0x38bd('0x19'))['db'];function respondWithStatusCode(_0x496a18,_0x120dcc){_0x120dcc=_0x120dcc||0xcc;return function(_0x20c370){if(_0x20c370){return _0x496a18[_0x38bd('0x1a')](_0x120dcc);}return _0x496a18[_0x38bd('0x1b')](_0x120dcc)[_0x38bd('0x1c')]();};}function respondWithResult(_0x26a991,_0x50f63a){_0x50f63a=_0x50f63a||0xc8;return function(_0x46493e){if(_0x46493e){return _0x26a991[_0x38bd('0x1b')](_0x50f63a)['json'](_0x46493e);}};}function respondWithFilteredResult(_0x553e08,_0x5d07f5){return function(_0x51a8a5){if(_0x51a8a5){var _0xda2956=typeof _0x5d07f5[_0x38bd('0x1d')]===_0x38bd('0x1e')&&typeof _0x5d07f5['limit']===_0x38bd('0x1e');var _0x53654e=_0x51a8a5[_0x38bd('0x1f')];var _0x44a5a9=_0xda2956?0x0:_0x5d07f5[_0x38bd('0x1d')];var _0x53b6dc=_0xda2956?_0x51a8a5['count']:_0x5d07f5[_0x38bd('0x1d')]+_0x5d07f5[_0x38bd('0x20')];var _0x182de6;if(_0x53b6dc>=_0x53654e){_0x53b6dc=_0x53654e;_0x182de6=0xc8;}else{_0x182de6=0xce;}_0x553e08[_0x38bd('0x1b')](_0x182de6);return _0x553e08[_0x38bd('0x21')](_0x38bd('0x22'),_0x44a5a9+'-'+_0x53b6dc+'/'+_0x53654e)[_0x38bd('0x23')](_0x51a8a5);}return null;};}function patchUpdates(_0xd8697b){return function(_0x928009){try{jsonpatch['apply'](_0x928009,_0xd8697b,!![]);}catch(_0x3868a6){return BPromise['reject'](_0x3868a6);}return _0x928009[_0x38bd('0x24')]();};}function saveUpdates(_0x1e4319,_0x5c251d){return function(_0x5ca41c){if(_0x5ca41c){return _0x5ca41c[_0x38bd('0x25')](_0x1e4319)[_0x38bd('0x26')](function(_0xc1ca2e){return _0xc1ca2e;});}return null;};}function removeEntity(_0x1a56d1,_0x7f80fe){return function(_0x1765b0){if(_0x1765b0){return _0x1765b0[_0x38bd('0x27')]()[_0x38bd('0x26')](function(){_0x1a56d1[_0x38bd('0x1b')](0xcc)[_0x38bd('0x1c')]();});}};}function handleEntityNotFound(_0x3960b6,_0x4e0bd6){return function(_0x259b6f){if(!_0x259b6f){_0x3960b6[_0x38bd('0x1a')](0x194);}return _0x259b6f;};}function handleError(_0x4f855f,_0x13c736){_0x13c736=_0x13c736||0x1f4;return function(_0x31aa73){logger[_0x38bd('0x28')](_0x31aa73['stack']);if(_0x31aa73['name']){delete _0x31aa73['name'];}_0x4f855f['status'](_0x13c736)['send'](_0x31aa73);};}exports[_0x38bd('0x29')]=function(_0x3bcfd1,_0x145f09){var _0x19000f={},_0x236f64={},_0x4c1bfb={'count':0x0,'rows':[]};var _0x4e54f4=_['map'](db[_0x38bd('0x2a')][_0x38bd('0x2b')],function(_0x5d0ea8){return{'name':_0x5d0ea8[_0x38bd('0x2c')],'type':_0x5d0ea8[_0x38bd('0x2d')][_0x38bd('0x2e')]};});_0x236f64['model']=_[_0x38bd('0x2f')](_0x4e54f4,_0x38bd('0x30'));_0x236f64[_0x38bd('0x31')]=_['keys'](_0x3bcfd1['query']);_0x236f64['filters']=_[_0x38bd('0x32')](_0x236f64[_0x38bd('0x33')],_0x236f64[_0x38bd('0x31')]);_0x19000f[_0x38bd('0x34')]=_['intersection'](_0x236f64[_0x38bd('0x33')],qs['fields'](_0x3bcfd1[_0x38bd('0x31')][_0x38bd('0x35')]));_0x19000f[_0x38bd('0x34')]=_0x19000f[_0x38bd('0x34')][_0x38bd('0x36')]?_0x19000f[_0x38bd('0x34')]:_0x236f64[_0x38bd('0x33')];if(!_0x3bcfd1[_0x38bd('0x31')]['hasOwnProperty'](_0x38bd('0x37'))){_0x19000f[_0x38bd('0x20')]=qs[_0x38bd('0x20')](_0x3bcfd1[_0x38bd('0x31')][_0x38bd('0x20')]);_0x19000f[_0x38bd('0x1d')]=qs[_0x38bd('0x1d')](_0x3bcfd1[_0x38bd('0x31')]['offset']);}_0x19000f[_0x38bd('0x38')]=qs[_0x38bd('0x39')](_0x3bcfd1['query'][_0x38bd('0x39')]);_0x19000f[_0x38bd('0x3a')]=qs[_0x38bd('0x3b')](_[_0x38bd('0x3c')](_0x3bcfd1[_0x38bd('0x31')],_0x236f64[_0x38bd('0x3b')]),_0x4e54f4);if(_0x3bcfd1[_0x38bd('0x31')][_0x38bd('0x3d')]){_0x19000f[_0x38bd('0x3a')]=_[_0x38bd('0x3e')](_0x19000f[_0x38bd('0x3a')],{'$or':_[_0x38bd('0x2f')](_0x4e54f4,function(_0x3e1fbe){if(_0x3e1fbe[_0x38bd('0x2d')]!==_0x38bd('0x3f')){var _0x90e5ca={};_0x90e5ca[_0x3e1fbe[_0x38bd('0x30')]]={'$like':'%'+_0x3bcfd1[_0x38bd('0x31')][_0x38bd('0x3d')]+'%'};return _0x90e5ca;}})});}_0x19000f=_[_0x38bd('0x3e')]({},_0x19000f,_0x3bcfd1[_0x38bd('0x40')]);var _0x277c0a={'where':_0x19000f[_0x38bd('0x3a')]};return db[_0x38bd('0x2a')]['count'](_0x277c0a)[_0x38bd('0x26')](function(_0x5b3a4f){_0x4c1bfb[_0x38bd('0x1f')]=_0x5b3a4f;if(_0x3bcfd1[_0x38bd('0x31')][_0x38bd('0x41')]){_0x19000f['include']=[{'all':!![]}];}return db[_0x38bd('0x2a')][_0x38bd('0x42')](_0x19000f);})[_0x38bd('0x26')](function(_0x15b85a){_0x4c1bfb[_0x38bd('0x43')]=_0x15b85a;return _0x4c1bfb;})[_0x38bd('0x26')](respondWithFilteredResult(_0x145f09,_0x19000f))[_0x38bd('0x44')](handleError(_0x145f09,null));};exports[_0x38bd('0x45')]=function(_0x1d4525,_0x3be551){var _0x19efa6={'raw':![],'where':{'id':_0x1d4525[_0x38bd('0x46')]['id']}},_0x30925f={};_0x30925f[_0x38bd('0x33')]=_['keys'](db[_0x38bd('0x2a')][_0x38bd('0x2b')]);_0x30925f['query']=_['keys'](_0x1d4525[_0x38bd('0x31')]);_0x30925f['filters']=_[_0x38bd('0x32')](_0x30925f['model'],_0x30925f[_0x38bd('0x31')]);_0x19efa6[_0x38bd('0x34')]=_[_0x38bd('0x32')](_0x30925f[_0x38bd('0x33')],qs[_0x38bd('0x35')](_0x1d4525[_0x38bd('0x31')][_0x38bd('0x35')]));_0x19efa6['attributes']=_0x19efa6['attributes'][_0x38bd('0x36')]?_0x19efa6[_0x38bd('0x34')]:_0x30925f[_0x38bd('0x33')];if(_0x1d4525[_0x38bd('0x31')][_0x38bd('0x41')]){_0x19efa6['include']=[{'all':!![]}];}_0x19efa6=_[_0x38bd('0x3e')]({},_0x19efa6,_0x1d4525[_0x38bd('0x40')]);return db['ZendeskConfiguration'][_0x38bd('0x47')](_0x19efa6)['then'](handleEntityNotFound(_0x3be551,null))[_0x38bd('0x26')](respondWithResult(_0x3be551,null))[_0x38bd('0x44')](handleError(_0x3be551,null));};exports[_0x38bd('0x48')]=function(_0x24c3ca,_0x2ed17c){return db[_0x38bd('0x2a')][_0x38bd('0x48')](_0x24c3ca['body'],{})[_0x38bd('0x26')](respondWithResult(_0x2ed17c,0xc9))['catch'](handleError(_0x2ed17c,null));};exports['update']=function(_0x4ad92b,_0x572ff6){if(_0x4ad92b[_0x38bd('0x49')]['id']){delete _0x4ad92b['body']['id'];}return db[_0x38bd('0x2a')][_0x38bd('0x47')]({'where':{'id':_0x4ad92b['params']['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x572ff6,null))[_0x38bd('0x26')](saveUpdates(_0x4ad92b[_0x38bd('0x49')],null))[_0x38bd('0x26')](respondWithResult(_0x572ff6,null))[_0x38bd('0x44')](handleError(_0x572ff6,null));};exports['destroy']=function(_0x428d2f,_0x42cb81){return db['ZendeskConfiguration'][_0x38bd('0x47')]({'where':{'id':_0x428d2f['params']['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x42cb81,null))['then'](removeEntity(_0x42cb81,null))[_0x38bd('0x44')](handleError(_0x42cb81,null));};exports[_0x38bd('0x4a')]=function(_0x5b45aa,_0x37940c,_0x8a9532){var _0x626218={};var _0x291a50={};var _0x4dc86c;var _0x396a3d;return db[_0x38bd('0x2a')][_0x38bd('0x4b')]({'where':{'id':_0x5b45aa[_0x38bd('0x46')]['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x37940c,null))[_0x38bd('0x26')](function(_0xe0bac6){if(_0xe0bac6){_0x4dc86c=_0xe0bac6;_0x291a50[_0x38bd('0x33')]=_[_0x38bd('0x4c')](db['ZendeskField'][_0x38bd('0x2b')]);_0x291a50['query']=_[_0x38bd('0x4c')](_0x5b45aa[_0x38bd('0x31')]);_0x291a50[_0x38bd('0x3b')]=_['intersection'](_0x291a50[_0x38bd('0x33')],_0x291a50[_0x38bd('0x31')]);_0x626218[_0x38bd('0x34')]=_['intersection'](_0x291a50[_0x38bd('0x33')],qs['fields'](_0x5b45aa[_0x38bd('0x31')][_0x38bd('0x35')]));_0x626218['attributes']=_0x626218[_0x38bd('0x34')][_0x38bd('0x36')]?_0x626218[_0x38bd('0x34')]:_0x291a50['model'];_0x626218[_0x38bd('0x38')]=qs[_0x38bd('0x39')](_0x5b45aa[_0x38bd('0x31')][_0x38bd('0x39')]);_0x626218[_0x38bd('0x3a')]=qs[_0x38bd('0x3b')](_[_0x38bd('0x3c')](_0x5b45aa['query'],_0x291a50[_0x38bd('0x3b')]));if(_0x5b45aa[_0x38bd('0x31')][_0x38bd('0x3d')]){_0x626218[_0x38bd('0x3a')]=_[_0x38bd('0x3e')](_0x626218[_0x38bd('0x3a')],{'$or':_['map'](_0x626218[_0x38bd('0x34')],function(_0x376b2d){var _0x431798={};_0x431798[_0x376b2d]={'$like':'%'+_0x5b45aa['query'][_0x38bd('0x3d')]+'%'};return _0x431798;})});}_0x626218=_[_0x38bd('0x3e')]({},_0x626218,_0x5b45aa[_0x38bd('0x40')]);return _0x4dc86c[_0x38bd('0x4a')](_0x626218);}})[_0x38bd('0x26')](function(_0x261665){if(_0x261665){_0x396a3d=_0x261665[_0x38bd('0x36')];if(!_0x5b45aa[_0x38bd('0x31')][_0x38bd('0x4d')](_0x38bd('0x37'))){_0x626218[_0x38bd('0x20')]=qs[_0x38bd('0x20')](_0x5b45aa['query'][_0x38bd('0x20')]);_0x626218['offset']=qs[_0x38bd('0x1d')](_0x5b45aa[_0x38bd('0x31')][_0x38bd('0x1d')]);}return _0x4dc86c[_0x38bd('0x4a')](_0x626218);}})[_0x38bd('0x26')](function(_0x1d4392){if(_0x1d4392){return _0x1d4392?{'count':_0x396a3d,'rows':_0x1d4392}:null;}})[_0x38bd('0x26')](respondWithResult(_0x37940c,null))[_0x38bd('0x44')](handleError(_0x37940c,null));};exports[_0x38bd('0x4e')]=function(_0x502f95,_0x391262,_0x2be0e1){var _0x266576={};var _0x2295aa={};var _0x4d783f;var _0x329d62;return db[_0x38bd('0x2a')]['findOne']({'where':{'id':_0x502f95[_0x38bd('0x46')]['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x391262,null))[_0x38bd('0x26')](function(_0x3d7b4b){if(_0x3d7b4b){_0x4d783f=_0x3d7b4b;_0x2295aa[_0x38bd('0x33')]=_[_0x38bd('0x4c')](db[_0x38bd('0x4f')]['rawAttributes']);_0x2295aa[_0x38bd('0x31')]=_[_0x38bd('0x4c')](_0x502f95[_0x38bd('0x31')]);_0x2295aa[_0x38bd('0x3b')]=_[_0x38bd('0x32')](_0x2295aa[_0x38bd('0x33')],_0x2295aa['query']);_0x266576['attributes']=_['intersection'](_0x2295aa[_0x38bd('0x33')],qs[_0x38bd('0x35')](_0x502f95[_0x38bd('0x31')][_0x38bd('0x35')]));_0x266576[_0x38bd('0x34')]=_0x266576[_0x38bd('0x34')][_0x38bd('0x36')]?_0x266576[_0x38bd('0x34')]:_0x2295aa[_0x38bd('0x33')];_0x266576['order']=qs['sort'](_0x502f95[_0x38bd('0x31')][_0x38bd('0x39')]);_0x266576[_0x38bd('0x3a')]=qs['filters'](_[_0x38bd('0x3c')](_0x502f95['query'],_0x2295aa['filters']));if(_0x502f95[_0x38bd('0x31')][_0x38bd('0x3d')]){_0x266576[_0x38bd('0x3a')]=_[_0x38bd('0x3e')](_0x266576[_0x38bd('0x3a')],{'$or':_[_0x38bd('0x2f')](_0x266576[_0x38bd('0x34')],function(_0x13b1b1){var _0x503278={};_0x503278[_0x13b1b1]={'$like':'%'+_0x502f95[_0x38bd('0x31')][_0x38bd('0x3d')]+'%'};return _0x503278;})});}_0x266576=_[_0x38bd('0x3e')]({},_0x266576,_0x502f95[_0x38bd('0x40')]);return _0x4d783f[_0x38bd('0x4e')](_0x266576);}})[_0x38bd('0x26')](function(_0x3cc4eb){if(_0x3cc4eb){_0x329d62=_0x3cc4eb['length'];if(!_0x502f95[_0x38bd('0x31')][_0x38bd('0x4d')](_0x38bd('0x37'))){_0x266576[_0x38bd('0x20')]=qs[_0x38bd('0x20')](_0x502f95['query'][_0x38bd('0x20')]);_0x266576[_0x38bd('0x1d')]=qs[_0x38bd('0x1d')](_0x502f95[_0x38bd('0x31')]['offset']);}return _0x4d783f[_0x38bd('0x4e')](_0x266576);}})[_0x38bd('0x26')](function(_0xf22ddf){if(_0xf22ddf){return _0xf22ddf?{'count':_0x329d62,'rows':_0xf22ddf}:null;}})['then'](respondWithResult(_0x391262,null))[_0x38bd('0x44')](handleError(_0x391262,null));};exports[_0x38bd('0x50')]=function(_0x2409db,_0x4414ed,_0x2cd42b){var _0x4dc619={};var _0x5affc2={};var _0x2cbcbe;var _0x51678b;return db[_0x38bd('0x2a')][_0x38bd('0x4b')]({'where':{'id':_0x2409db[_0x38bd('0x46')]['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x4414ed,null))[_0x38bd('0x26')](function(_0x2817e9){if(_0x2817e9){_0x2cbcbe=_0x2817e9;_0x5affc2[_0x38bd('0x33')]=_[_0x38bd('0x4c')](db['ZendeskField']['rawAttributes']);_0x5affc2[_0x38bd('0x31')]=_['keys'](_0x2409db[_0x38bd('0x31')]);_0x5affc2[_0x38bd('0x3b')]=_['intersection'](_0x5affc2[_0x38bd('0x33')],_0x5affc2['query']);_0x4dc619[_0x38bd('0x34')]=_['intersection'](_0x5affc2['model'],qs[_0x38bd('0x35')](_0x2409db[_0x38bd('0x31')][_0x38bd('0x35')]));_0x4dc619[_0x38bd('0x34')]=_0x4dc619[_0x38bd('0x34')]['length']?_0x4dc619['attributes']:_0x5affc2[_0x38bd('0x33')];_0x4dc619[_0x38bd('0x38')]=qs[_0x38bd('0x39')](_0x2409db[_0x38bd('0x31')]['sort']);_0x4dc619[_0x38bd('0x3a')]=qs[_0x38bd('0x3b')](_[_0x38bd('0x3c')](_0x2409db[_0x38bd('0x31')],_0x5affc2['filters']));if(_0x2409db[_0x38bd('0x31')]['filter']){_0x4dc619[_0x38bd('0x3a')]=_[_0x38bd('0x3e')](_0x4dc619[_0x38bd('0x3a')],{'$or':_[_0x38bd('0x2f')](_0x4dc619[_0x38bd('0x34')],function(_0xcf6622){var _0x50ee7a={};_0x50ee7a[_0xcf6622]={'$like':'%'+_0x2409db['query'][_0x38bd('0x3d')]+'%'};return _0x50ee7a;})});}_0x4dc619=_[_0x38bd('0x3e')]({},_0x4dc619,_0x2409db[_0x38bd('0x40')]);return _0x2cbcbe[_0x38bd('0x50')](_0x4dc619);}})[_0x38bd('0x26')](function(_0x3e80e7){if(_0x3e80e7){_0x51678b=_0x3e80e7[_0x38bd('0x36')];if(!_0x2409db['query'][_0x38bd('0x4d')](_0x38bd('0x37'))){_0x4dc619[_0x38bd('0x20')]=qs[_0x38bd('0x20')](_0x2409db['query']['limit']);_0x4dc619[_0x38bd('0x1d')]=qs[_0x38bd('0x1d')](_0x2409db[_0x38bd('0x31')]['offset']);}return _0x2cbcbe[_0x38bd('0x50')](_0x4dc619);}})['then'](function(_0x5a96c6){if(_0x5a96c6){return _0x5a96c6?{'count':_0x51678b,'rows':_0x5a96c6}:null;}})['then'](respondWithResult(_0x4414ed,null))['catch'](handleError(_0x4414ed,null));};exports['getTags']=function(_0x45e33d,_0x198e7e,_0x6137b5){var _0x5eaa7f={};var _0x439668={};var _0x13384f;var _0x24bbf6;return db[_0x38bd('0x2a')][_0x38bd('0x4b')]({'where':{'id':_0x45e33d[_0x38bd('0x46')]['id']}})[_0x38bd('0x26')](handleEntityNotFound(_0x198e7e,null))[_0x38bd('0x26')](function(_0xc6c751){if(_0xc6c751){_0x13384f=_0xc6c751;_0x439668[_0x38bd('0x33')]=_[_0x38bd('0x4c')](db[_0x38bd('0x51')][_0x38bd('0x2b')]);_0x439668[_0x38bd('0x31')]=_['keys'](_0x45e33d['query']);_0x439668['filters']=_['intersection'](_0x439668[_0x38bd('0x33')],_0x439668[_0x38bd('0x31')]);_0x5eaa7f['attributes']=_[_0x38bd('0x32')](_0x439668[_0x38bd('0x33')],qs['fields'](_0x45e33d['query'][_0x38bd('0x35')]));_0x5eaa7f[_0x38bd('0x34')]=_0x5eaa7f[_0x38bd('0x34')][_0x38bd('0x36')]?_0x5eaa7f[_0x38bd('0x34')]:_0x439668['model'];_0x5eaa7f[_0x38bd('0x38')]=qs[_0x38bd('0x39')](_0x45e33d['query'][_0x38bd('0x39')]);_0x5eaa7f[_0x38bd('0x3a')]=qs[_0x38bd('0x3b')](_[_0x38bd('0x3c')](_0x45e33d[_0x38bd('0x31')],_0x439668[_0x38bd('0x3b')]));if(_0x45e33d[_0x38bd('0x31')][_0x38bd('0x3d')]){_0x5eaa7f[_0x38bd('0x3a')]=_[_0x38bd('0x3e')](_0x5eaa7f['where'],{'$or':_[_0x38bd('0x2f')](_0x5eaa7f[_0x38bd('0x34')],function(_0x3f62a7){var _0x22dd1a={};_0x22dd1a[_0x3f62a7]={'$like':'%'+_0x45e33d[_0x38bd('0x31')][_0x38bd('0x3d')]+'%'};return _0x22dd1a;})});}_0x5eaa7f=_[_0x38bd('0x3e')]({},_0x5eaa7f,_0x45e33d['options']);return _0x13384f[_0x38bd('0x52')](_0x5eaa7f);}})[_0x38bd('0x26')](function(_0x220bf4){if(_0x220bf4){_0x24bbf6=_0x220bf4[_0x38bd('0x36')];if(!_0x45e33d[_0x38bd('0x31')]['hasOwnProperty']('nolimit')){_0x5eaa7f[_0x38bd('0x20')]=qs[_0x38bd('0x20')](_0x45e33d[_0x38bd('0x31')][_0x38bd('0x20')]);_0x5eaa7f[_0x38bd('0x1d')]=qs[_0x38bd('0x1d')](_0x45e33d[_0x38bd('0x31')]['offset']);}return _0x13384f[_0x38bd('0x52')](_0x5eaa7f);}})[_0x38bd('0x26')](function(_0x32627a){if(_0x32627a){return _0x32627a?{'count':_0x24bbf6,'rows':_0x32627a}:null;}})[_0x38bd('0x26')](respondWithResult(_0x198e7e,null))[_0x38bd('0x44')](handleError(_0x198e7e,null));};exports[_0x38bd('0x53')]=function(_0x1e9efd,_0x312d20,_0x5a5a3d){if(_0x1e9efd[_0x38bd('0x49')]['id']){delete _0x1e9efd[_0x38bd('0x49')]['id'];}return db['ZendeskConfiguration'][_0x38bd('0x4b')]({'where':{'id':_0x1e9efd['params']['id']}})['then'](handleEntityNotFound(_0x312d20,null))[_0x38bd('0x26')](function(_0x3465ba){if(_0x3465ba){return _0x3465ba[_0x38bd('0x53')](_0x1e9efd[_0x38bd('0x49')]['ids']||[]);}return null;})[_0x38bd('0x26')](respondWithResult(_0x312d20,null))[_0x38bd('0x44')](handleError(_0x312d20,null));}; \ No newline at end of file +var _0x06ae=['count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','getFields','nolimit','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x180201,_0x41d6fe){var _0x1ac53b=function(_0xf378c0){while(--_0xf378c0){_0x180201['push'](_0x180201['shift']());}};_0x1ac53b(++_0x41d6fe);}(_0x06ae,0x183));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe06a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe06a('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe06a('0x2'));var path=require(_0xe06a('0x3'));var sox=require(_0xe06a('0x4'));var csv=require(_0xe06a('0x5'));var ejs=require(_0xe06a('0x6'));var fs=require('fs');var fs_extra=require(_0xe06a('0x7'));var _=require(_0xe06a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe06a('0x9'));var deskjs=require(_0xe06a('0xa'));var toCsv=require(_0xe06a('0x5'));var querystring=require(_0xe06a('0xb'));var Papa=require('papaparse');var Redis=require(_0xe06a('0xc'));var authService=require(_0xe06a('0xd'));var qs=require(_0xe06a('0xe'));var as=require(_0xe06a('0xf'));var hardwareService=require(_0xe06a('0x10'));var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require(_0xe06a('0x13'));var config=require(_0xe06a('0x14'));var licenseUtil=require(_0xe06a('0x15'));var db=require(_0xe06a('0x16'))['db'];function respondWithStatusCode(_0x33127e,_0x513a4f){_0x513a4f=_0x513a4f||0xcc;return function(_0x5a6dd4){if(_0x5a6dd4){return _0x33127e[_0xe06a('0x17')](_0x513a4f);}return _0x33127e[_0xe06a('0x18')](_0x513a4f)[_0xe06a('0x19')]();};}function respondWithResult(_0x3121e4,_0x324474){_0x324474=_0x324474||0xc8;return function(_0x3c4ea7){if(_0x3c4ea7){return _0x3121e4[_0xe06a('0x18')](_0x324474)['json'](_0x3c4ea7);}};}function respondWithFilteredResult(_0x250dac,_0x22f7bd){return function(_0x249aef){if(_0x249aef){var _0x5f4171=typeof _0x22f7bd[_0xe06a('0x1a')]==='undefined'&&typeof _0x22f7bd[_0xe06a('0x1b')]==='undefined';var _0x48cd9a=_0x249aef['count'];var _0x5f10ab=_0x5f4171?0x0:_0x22f7bd[_0xe06a('0x1a')];var _0x26d3c5=_0x5f4171?_0x249aef[_0xe06a('0x1c')]:_0x22f7bd[_0xe06a('0x1a')]+_0x22f7bd[_0xe06a('0x1b')];var _0x311759;if(_0x26d3c5>=_0x48cd9a){_0x26d3c5=_0x48cd9a;_0x311759=0xc8;}else{_0x311759=0xce;}_0x250dac['status'](_0x311759);return _0x250dac['set'](_0xe06a('0x1d'),_0x5f10ab+'-'+_0x26d3c5+'/'+_0x48cd9a)[_0xe06a('0x1e')](_0x249aef);}return null;};}function patchUpdates(_0x34176b){return function(_0x34c513){try{jsonpatch[_0xe06a('0x1f')](_0x34c513,_0x34176b,!![]);}catch(_0x24e96a){return BPromise[_0xe06a('0x20')](_0x24e96a);}return _0x34c513['save']();};}function saveUpdates(_0x5b5ed4,_0x38fb60){return function(_0x41962f){if(_0x41962f){return _0x41962f[_0xe06a('0x21')](_0x5b5ed4)[_0xe06a('0x22')](function(_0xbda21e){return _0xbda21e;});}return null;};}function removeEntity(_0x3255de,_0x2a135a){return function(_0x47e276){if(_0x47e276){return _0x47e276[_0xe06a('0x23')]()[_0xe06a('0x22')](function(){_0x3255de[_0xe06a('0x18')](0xcc)[_0xe06a('0x19')]();});}};}function handleEntityNotFound(_0x140dce,_0x13d46e){return function(_0x147ff6){if(!_0x147ff6){_0x140dce[_0xe06a('0x17')](0x194);}return _0x147ff6;};}function handleError(_0x1e6f5a,_0x1ae3f5){_0x1ae3f5=_0x1ae3f5||0x1f4;return function(_0x3abc59){logger[_0xe06a('0x24')](_0x3abc59[_0xe06a('0x25')]);if(_0x3abc59[_0xe06a('0x26')]){delete _0x3abc59[_0xe06a('0x26')];}_0x1e6f5a[_0xe06a('0x18')](_0x1ae3f5)[_0xe06a('0x27')](_0x3abc59);};}exports[_0xe06a('0x28')]=function(_0x973f73,_0x2c5862){var _0x4631ea={},_0x233caa={},_0x37d8d4={'count':0x0,'rows':[]};var _0x4e3788=_[_0xe06a('0x29')](db[_0xe06a('0x2a')][_0xe06a('0x2b')],function(_0x2dfd09){return{'name':_0x2dfd09[_0xe06a('0x2c')],'type':_0x2dfd09[_0xe06a('0x2d')][_0xe06a('0x2e')]};});_0x233caa[_0xe06a('0x2f')]=_[_0xe06a('0x29')](_0x4e3788,'name');_0x233caa['query']=_['keys'](_0x973f73[_0xe06a('0x30')]);_0x233caa[_0xe06a('0x31')]=_[_0xe06a('0x32')](_0x233caa['model'],_0x233caa[_0xe06a('0x30')]);_0x4631ea[_0xe06a('0x33')]=_[_0xe06a('0x32')](_0x233caa['model'],qs[_0xe06a('0x34')](_0x973f73['query'][_0xe06a('0x34')]));_0x4631ea['attributes']=_0x4631ea[_0xe06a('0x33')][_0xe06a('0x35')]?_0x4631ea[_0xe06a('0x33')]:_0x233caa[_0xe06a('0x2f')];if(!_0x973f73['query'][_0xe06a('0x36')]('nolimit')){_0x4631ea['limit']=qs[_0xe06a('0x1b')](_0x973f73[_0xe06a('0x30')][_0xe06a('0x1b')]);_0x4631ea[_0xe06a('0x1a')]=qs[_0xe06a('0x1a')](_0x973f73[_0xe06a('0x30')]['offset']);}_0x4631ea[_0xe06a('0x37')]=qs['sort'](_0x973f73[_0xe06a('0x30')][_0xe06a('0x38')]);_0x4631ea[_0xe06a('0x39')]=qs[_0xe06a('0x31')](_[_0xe06a('0x3a')](_0x973f73[_0xe06a('0x30')],_0x233caa['filters']),_0x4e3788);if(_0x973f73[_0xe06a('0x30')][_0xe06a('0x3b')]){_0x4631ea[_0xe06a('0x39')]=_[_0xe06a('0x3c')](_0x4631ea['where'],{'$or':_['map'](_0x4e3788,function(_0x2cdc0a){if(_0x2cdc0a[_0xe06a('0x2d')]!=='VIRTUAL'){var _0x197127={};_0x197127[_0x2cdc0a['name']]={'$like':'%'+_0x973f73[_0xe06a('0x30')][_0xe06a('0x3b')]+'%'};return _0x197127;}})});}_0x4631ea=_[_0xe06a('0x3c')]({},_0x4631ea,_0x973f73['options']);var _0xb8705a={'where':_0x4631ea[_0xe06a('0x39')]};return db[_0xe06a('0x2a')][_0xe06a('0x1c')](_0xb8705a)['then'](function(_0x1caf6b){_0x37d8d4[_0xe06a('0x1c')]=_0x1caf6b;if(_0x973f73[_0xe06a('0x30')]['includeAll']){_0x4631ea[_0xe06a('0x3d')]=[{'all':!![]}];}return db[_0xe06a('0x2a')][_0xe06a('0x3e')](_0x4631ea);})[_0xe06a('0x22')](function(_0x5d02c7){_0x37d8d4[_0xe06a('0x3f')]=_0x5d02c7;return _0x37d8d4;})[_0xe06a('0x22')](respondWithFilteredResult(_0x2c5862,_0x4631ea))[_0xe06a('0x40')](handleError(_0x2c5862,null));};exports[_0xe06a('0x41')]=function(_0x99e1b9,_0x378205){var _0x10a512={'raw':![],'where':{'id':_0x99e1b9[_0xe06a('0x42')]['id']}},_0x4059b9={};_0x4059b9[_0xe06a('0x2f')]=_[_0xe06a('0x43')](db[_0xe06a('0x2a')][_0xe06a('0x2b')]);_0x4059b9[_0xe06a('0x30')]=_[_0xe06a('0x43')](_0x99e1b9[_0xe06a('0x30')]);_0x4059b9[_0xe06a('0x31')]=_[_0xe06a('0x32')](_0x4059b9[_0xe06a('0x2f')],_0x4059b9[_0xe06a('0x30')]);_0x10a512[_0xe06a('0x33')]=_[_0xe06a('0x32')](_0x4059b9[_0xe06a('0x2f')],qs[_0xe06a('0x34')](_0x99e1b9['query'][_0xe06a('0x34')]));_0x10a512[_0xe06a('0x33')]=_0x10a512[_0xe06a('0x33')]['length']?_0x10a512['attributes']:_0x4059b9[_0xe06a('0x2f')];if(_0x99e1b9[_0xe06a('0x30')][_0xe06a('0x44')]){_0x10a512[_0xe06a('0x3d')]=[{'all':!![]}];}_0x10a512=_[_0xe06a('0x3c')]({},_0x10a512,_0x99e1b9[_0xe06a('0x45')]);return db[_0xe06a('0x2a')][_0xe06a('0x46')](_0x10a512)[_0xe06a('0x22')](handleEntityNotFound(_0x378205,null))[_0xe06a('0x22')](respondWithResult(_0x378205,null))[_0xe06a('0x40')](handleError(_0x378205,null));};exports[_0xe06a('0x47')]=function(_0x63c665,_0x3e266e){return db[_0xe06a('0x2a')]['create'](_0x63c665[_0xe06a('0x48')],{})[_0xe06a('0x22')](respondWithResult(_0x3e266e,0xc9))[_0xe06a('0x40')](handleError(_0x3e266e,null));};exports[_0xe06a('0x21')]=function(_0x101a96,_0x467aec){if(_0x101a96[_0xe06a('0x48')]['id']){delete _0x101a96[_0xe06a('0x48')]['id'];}return db[_0xe06a('0x2a')]['find']({'where':{'id':_0x101a96[_0xe06a('0x42')]['id']}})[_0xe06a('0x22')](handleEntityNotFound(_0x467aec,null))[_0xe06a('0x22')](saveUpdates(_0x101a96['body'],null))[_0xe06a('0x22')](respondWithResult(_0x467aec,null))[_0xe06a('0x40')](handleError(_0x467aec,null));};exports['destroy']=function(_0x21abc6,_0xd30be2){return db[_0xe06a('0x2a')]['find']({'where':{'id':_0x21abc6[_0xe06a('0x42')]['id']}})['then'](handleEntityNotFound(_0xd30be2,null))[_0xe06a('0x22')](removeEntity(_0xd30be2,null))['catch'](handleError(_0xd30be2,null));};exports[_0xe06a('0x49')]=function(_0x40b47c,_0x5a999e,_0x1cacfa){var _0x1de751={};var _0x4f175f={};var _0x50d131;var _0x8fa2f;return db[_0xe06a('0x2a')]['findOne']({'where':{'id':_0x40b47c['params']['id']}})['then'](handleEntityNotFound(_0x5a999e,null))[_0xe06a('0x22')](function(_0x244d68){if(_0x244d68){_0x50d131=_0x244d68;_0x4f175f[_0xe06a('0x2f')]=_['keys'](db['ZendeskField'][_0xe06a('0x2b')]);_0x4f175f[_0xe06a('0x30')]=_[_0xe06a('0x43')](_0x40b47c['query']);_0x4f175f[_0xe06a('0x31')]=_['intersection'](_0x4f175f[_0xe06a('0x2f')],_0x4f175f[_0xe06a('0x30')]);_0x1de751[_0xe06a('0x33')]=_['intersection'](_0x4f175f[_0xe06a('0x2f')],qs[_0xe06a('0x34')](_0x40b47c[_0xe06a('0x30')][_0xe06a('0x34')]));_0x1de751[_0xe06a('0x33')]=_0x1de751[_0xe06a('0x33')][_0xe06a('0x35')]?_0x1de751[_0xe06a('0x33')]:_0x4f175f[_0xe06a('0x2f')];_0x1de751['order']=qs[_0xe06a('0x38')](_0x40b47c[_0xe06a('0x30')][_0xe06a('0x38')]);_0x1de751[_0xe06a('0x39')]=qs[_0xe06a('0x31')](_[_0xe06a('0x3a')](_0x40b47c[_0xe06a('0x30')],_0x4f175f[_0xe06a('0x31')]));if(_0x40b47c['query'][_0xe06a('0x3b')]){_0x1de751[_0xe06a('0x39')]=_['merge'](_0x1de751['where'],{'$or':_[_0xe06a('0x29')](_0x1de751['attributes'],function(_0x78f972){var _0x54278d={};_0x54278d[_0x78f972]={'$like':'%'+_0x40b47c['query'][_0xe06a('0x3b')]+'%'};return _0x54278d;})});}_0x1de751=_[_0xe06a('0x3c')]({},_0x1de751,_0x40b47c[_0xe06a('0x45')]);return _0x50d131[_0xe06a('0x49')](_0x1de751);}})['then'](function(_0x118b25){if(_0x118b25){_0x8fa2f=_0x118b25[_0xe06a('0x35')];if(!_0x40b47c[_0xe06a('0x30')][_0xe06a('0x36')](_0xe06a('0x4a'))){_0x1de751[_0xe06a('0x1b')]=qs['limit'](_0x40b47c[_0xe06a('0x30')]['limit']);_0x1de751[_0xe06a('0x1a')]=qs[_0xe06a('0x1a')](_0x40b47c[_0xe06a('0x30')]['offset']);}return _0x50d131[_0xe06a('0x49')](_0x1de751);}})['then'](function(_0x90376f){if(_0x90376f){return _0x90376f?{'count':_0x8fa2f,'rows':_0x90376f}:null;}})['then'](respondWithResult(_0x5a999e,null))['catch'](handleError(_0x5a999e,null));};exports[_0xe06a('0x4b')]=function(_0x363521,_0x1c68c6,_0x2f5e96){var _0x1a8dc6={};var _0x2eb6aa={};var _0x11c277;var _0x5a95b4;return db[_0xe06a('0x2a')][_0xe06a('0x4c')]({'where':{'id':_0x363521[_0xe06a('0x42')]['id']}})[_0xe06a('0x22')](handleEntityNotFound(_0x1c68c6,null))[_0xe06a('0x22')](function(_0x6d7ab3){if(_0x6d7ab3){_0x11c277=_0x6d7ab3;_0x2eb6aa[_0xe06a('0x2f')]=_[_0xe06a('0x43')](db[_0xe06a('0x4d')][_0xe06a('0x2b')]);_0x2eb6aa['query']=_[_0xe06a('0x43')](_0x363521[_0xe06a('0x30')]);_0x2eb6aa[_0xe06a('0x31')]=_[_0xe06a('0x32')](_0x2eb6aa[_0xe06a('0x2f')],_0x2eb6aa[_0xe06a('0x30')]);_0x1a8dc6[_0xe06a('0x33')]=_[_0xe06a('0x32')](_0x2eb6aa['model'],qs[_0xe06a('0x34')](_0x363521[_0xe06a('0x30')]['fields']));_0x1a8dc6[_0xe06a('0x33')]=_0x1a8dc6[_0xe06a('0x33')][_0xe06a('0x35')]?_0x1a8dc6[_0xe06a('0x33')]:_0x2eb6aa['model'];_0x1a8dc6[_0xe06a('0x37')]=qs[_0xe06a('0x38')](_0x363521['query']['sort']);_0x1a8dc6[_0xe06a('0x39')]=qs[_0xe06a('0x31')](_['pick'](_0x363521[_0xe06a('0x30')],_0x2eb6aa[_0xe06a('0x31')]));if(_0x363521[_0xe06a('0x30')][_0xe06a('0x3b')]){_0x1a8dc6[_0xe06a('0x39')]=_['merge'](_0x1a8dc6[_0xe06a('0x39')],{'$or':_['map'](_0x1a8dc6['attributes'],function(_0x19e191){var _0x225ff7={};_0x225ff7[_0x19e191]={'$like':'%'+_0x363521['query'][_0xe06a('0x3b')]+'%'};return _0x225ff7;})});}_0x1a8dc6=_[_0xe06a('0x3c')]({},_0x1a8dc6,_0x363521[_0xe06a('0x45')]);return _0x11c277[_0xe06a('0x4b')](_0x1a8dc6);}})[_0xe06a('0x22')](function(_0x476104){if(_0x476104){_0x5a95b4=_0x476104[_0xe06a('0x35')];if(!_0x363521['query'][_0xe06a('0x36')]('nolimit')){_0x1a8dc6[_0xe06a('0x1b')]=qs[_0xe06a('0x1b')](_0x363521[_0xe06a('0x30')][_0xe06a('0x1b')]);_0x1a8dc6[_0xe06a('0x1a')]=qs[_0xe06a('0x1a')](_0x363521['query'][_0xe06a('0x1a')]);}return _0x11c277[_0xe06a('0x4b')](_0x1a8dc6);}})[_0xe06a('0x22')](function(_0x197efe){if(_0x197efe){return _0x197efe?{'count':_0x5a95b4,'rows':_0x197efe}:null;}})['then'](respondWithResult(_0x1c68c6,null))[_0xe06a('0x40')](handleError(_0x1c68c6,null));};exports['getDescriptions']=function(_0xc6b1a5,_0x1ee762,_0x364dc9){var _0x49f094={};var _0x2aa5af={};var _0x280e90;var _0x32cb51;return db['ZendeskConfiguration'][_0xe06a('0x4c')]({'where':{'id':_0xc6b1a5[_0xe06a('0x42')]['id']}})[_0xe06a('0x22')](handleEntityNotFound(_0x1ee762,null))[_0xe06a('0x22')](function(_0x4a887a){if(_0x4a887a){_0x280e90=_0x4a887a;_0x2aa5af[_0xe06a('0x2f')]=_[_0xe06a('0x43')](db[_0xe06a('0x4d')][_0xe06a('0x2b')]);_0x2aa5af['query']=_[_0xe06a('0x43')](_0xc6b1a5[_0xe06a('0x30')]);_0x2aa5af[_0xe06a('0x31')]=_[_0xe06a('0x32')](_0x2aa5af[_0xe06a('0x2f')],_0x2aa5af[_0xe06a('0x30')]);_0x49f094[_0xe06a('0x33')]=_['intersection'](_0x2aa5af[_0xe06a('0x2f')],qs['fields'](_0xc6b1a5[_0xe06a('0x30')][_0xe06a('0x34')]));_0x49f094[_0xe06a('0x33')]=_0x49f094[_0xe06a('0x33')]['length']?_0x49f094[_0xe06a('0x33')]:_0x2aa5af[_0xe06a('0x2f')];_0x49f094[_0xe06a('0x37')]=qs[_0xe06a('0x38')](_0xc6b1a5['query'][_0xe06a('0x38')]);_0x49f094['where']=qs['filters'](_[_0xe06a('0x3a')](_0xc6b1a5[_0xe06a('0x30')],_0x2aa5af['filters']));if(_0xc6b1a5[_0xe06a('0x30')][_0xe06a('0x3b')]){_0x49f094[_0xe06a('0x39')]=_[_0xe06a('0x3c')](_0x49f094[_0xe06a('0x39')],{'$or':_[_0xe06a('0x29')](_0x49f094[_0xe06a('0x33')],function(_0x37d98d){var _0x2252dd={};_0x2252dd[_0x37d98d]={'$like':'%'+_0xc6b1a5[_0xe06a('0x30')][_0xe06a('0x3b')]+'%'};return _0x2252dd;})});}_0x49f094=_[_0xe06a('0x3c')]({},_0x49f094,_0xc6b1a5[_0xe06a('0x45')]);return _0x280e90[_0xe06a('0x4e')](_0x49f094);}})[_0xe06a('0x22')](function(_0x41266d){if(_0x41266d){_0x32cb51=_0x41266d[_0xe06a('0x35')];if(!_0xc6b1a5['query'][_0xe06a('0x36')]('nolimit')){_0x49f094[_0xe06a('0x1b')]=qs[_0xe06a('0x1b')](_0xc6b1a5[_0xe06a('0x30')][_0xe06a('0x1b')]);_0x49f094[_0xe06a('0x1a')]=qs[_0xe06a('0x1a')](_0xc6b1a5[_0xe06a('0x30')]['offset']);}return _0x280e90[_0xe06a('0x4e')](_0x49f094);}})[_0xe06a('0x22')](function(_0x55b387){if(_0x55b387){return _0x55b387?{'count':_0x32cb51,'rows':_0x55b387}:null;}})['then'](respondWithResult(_0x1ee762,null))[_0xe06a('0x40')](handleError(_0x1ee762,null));};exports[_0xe06a('0x4f')]=function(_0xfa4bd7,_0x19cb10,_0x5609ce){var _0x2978a={};var _0x315be5={};var _0x4e47cd;var _0x36db79;return db[_0xe06a('0x2a')][_0xe06a('0x4c')]({'where':{'id':_0xfa4bd7[_0xe06a('0x42')]['id']}})[_0xe06a('0x22')](handleEntityNotFound(_0x19cb10,null))['then'](function(_0x3dff14){if(_0x3dff14){_0x4e47cd=_0x3dff14;_0x315be5['model']=_['keys'](db[_0xe06a('0x50')][_0xe06a('0x2b')]);_0x315be5['query']=_[_0xe06a('0x43')](_0xfa4bd7['query']);_0x315be5[_0xe06a('0x31')]=_[_0xe06a('0x32')](_0x315be5['model'],_0x315be5[_0xe06a('0x30')]);_0x2978a[_0xe06a('0x33')]=_[_0xe06a('0x32')](_0x315be5[_0xe06a('0x2f')],qs['fields'](_0xfa4bd7['query'][_0xe06a('0x34')]));_0x2978a[_0xe06a('0x33')]=_0x2978a[_0xe06a('0x33')][_0xe06a('0x35')]?_0x2978a['attributes']:_0x315be5[_0xe06a('0x2f')];_0x2978a[_0xe06a('0x37')]=qs['sort'](_0xfa4bd7['query'][_0xe06a('0x38')]);_0x2978a[_0xe06a('0x39')]=qs['filters'](_[_0xe06a('0x3a')](_0xfa4bd7[_0xe06a('0x30')],_0x315be5[_0xe06a('0x31')]));if(_0xfa4bd7[_0xe06a('0x30')][_0xe06a('0x3b')]){_0x2978a[_0xe06a('0x39')]=_[_0xe06a('0x3c')](_0x2978a[_0xe06a('0x39')],{'$or':_[_0xe06a('0x29')](_0x2978a[_0xe06a('0x33')],function(_0x28fad9){var _0x3fdff8={};_0x3fdff8[_0x28fad9]={'$like':'%'+_0xfa4bd7[_0xe06a('0x30')][_0xe06a('0x3b')]+'%'};return _0x3fdff8;})});}_0x2978a=_[_0xe06a('0x3c')]({},_0x2978a,_0xfa4bd7[_0xe06a('0x45')]);return _0x4e47cd[_0xe06a('0x4f')](_0x2978a);}})[_0xe06a('0x22')](function(_0x1c05d2){if(_0x1c05d2){_0x36db79=_0x1c05d2['length'];if(!_0xfa4bd7[_0xe06a('0x30')][_0xe06a('0x36')]('nolimit')){_0x2978a[_0xe06a('0x1b')]=qs[_0xe06a('0x1b')](_0xfa4bd7[_0xe06a('0x30')][_0xe06a('0x1b')]);_0x2978a['offset']=qs[_0xe06a('0x1a')](_0xfa4bd7[_0xe06a('0x30')][_0xe06a('0x1a')]);}return _0x4e47cd['getTags'](_0x2978a);}})[_0xe06a('0x22')](function(_0x3293b4){if(_0x3293b4){return _0x3293b4?{'count':_0x36db79,'rows':_0x3293b4}:null;}})['then'](respondWithResult(_0x19cb10,null))[_0xe06a('0x40')](handleError(_0x19cb10,null));};exports[_0xe06a('0x51')]=function(_0x58360e,_0x1f2d97,_0xf1d5df){if(_0x58360e[_0xe06a('0x48')]['id']){delete _0x58360e[_0xe06a('0x48')]['id'];}return db[_0xe06a('0x2a')][_0xe06a('0x4c')]({'where':{'id':_0x58360e[_0xe06a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f2d97,null))[_0xe06a('0x22')](function(_0x148b93){if(_0x148b93){return _0x148b93['setTags'](_0x58360e[_0xe06a('0x48')][_0xe06a('0x52')]||[]);}return null;})['then'](respondWithResult(_0x1f2d97,null))['catch'](handleError(_0x1f2d97,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 45e10bf..892a54b 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x351d=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5134f9,_0x5d1abd){var _0x30c75f=function(_0x67ea00){while(--_0x67ea00){_0x5134f9['push'](_0x5134f9['shift']());}};_0x30c75f(++_0x5d1abd);}(_0x351d,0x90));var _0xd351=function(_0x1a7f0c,_0x41799e){_0x1a7f0c=_0x1a7f0c-0x0;var _0x498328=_0x351d[_0x1a7f0c];return _0x498328;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0x5e4a5f,_0x2d860f){var _0x1cffd6=function(_0x576ac4){while(--_0x576ac4){_0x5e4a5f['push'](_0x5e4a5f['shift']());}};_0x1cffd6(++_0x2d860f);}(_0x32b6,0x1d1));var _0x632b=function(_0x3c0c4b,_0x5f4591){_0x3c0c4b=_0x3c0c4b-0x0;var _0x55aff7=_0x32b6[_0x3c0c4b];return _0x55aff7;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 079c0b3..5a069ae 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 _0xc564=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x402d00,_0x46761f){var _0x23df42=function(_0x55eac8){while(--_0x55eac8){_0x402d00['push'](_0x402d00['shift']());}};_0x23df42(++_0x46761f);}(_0xc564,0x1e3));var _0x4c56=function(_0x2d0b02,_0x822ede){_0x2d0b02=_0x2d0b02-0x0;var _0xef8b57=_0xc564[_0x2d0b02];return _0xef8b57;};'use strict';var _=require(_0x4c56('0x0'));var util=require(_0x4c56('0x1'));var moment=require(_0x4c56('0x2'));var BPromise=require(_0x4c56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c56('0x5'));var logger=require(_0x4c56('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c56('0x7'));var client=jayson['client'][_0x4c56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e9419,_0x55dab9,_0x1ac01d){return new BPromise(function(_0x246891,_0x5a02c3){return client[_0x4c56('0x9')](_0x5e9419,_0x1ac01d)[_0x4c56('0xa')](function(_0x156e9b){logger[_0x4c56('0xb')](_0x4c56('0xc'),_0x55dab9,'request\x20sent');logger[_0x4c56('0xd')](_0x4c56('0xe'),_0x55dab9,_0x4c56('0xf'),JSON[_0x4c56('0x10')](_0x156e9b));if(_0x156e9b['error']){if(_0x156e9b[_0x4c56('0x11')][_0x4c56('0x12')]===0x1f4){logger[_0x4c56('0x11')](_0x4c56('0xc'),_0x55dab9,_0x156e9b['error']['message']);return _0x5a02c3(_0x156e9b['error'][_0x4c56('0x13')]);}logger[_0x4c56('0x11')](_0x4c56('0xc'),_0x55dab9,_0x156e9b[_0x4c56('0x11')][_0x4c56('0x13')]);return _0x246891(_0x156e9b[_0x4c56('0x11')][_0x4c56('0x13')]);}else{logger[_0x4c56('0xb')](_0x4c56('0xc'),_0x55dab9,_0x4c56('0xf'));_0x246891(_0x156e9b[_0x4c56('0x14')]['message']);}})['catch'](function(_0x39cc19){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x55dab9,_0x39cc19);_0x5a02c3(_0x39cc19);});});} \ No newline at end of file +var _0x5041=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5041,0x157));var _0x1504=function(_0x2d239f,_0x167856){_0x2d239f=_0x2d239f-0x0;var _0x1ca993=_0x5041[_0x2d239f];return _0x1ca993;};'use strict';var _=require(_0x1504('0x0'));var util=require(_0x1504('0x1'));var moment=require('moment');var BPromise=require(_0x1504('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1504('0x3'));var db=require(_0x1504('0x4'))['db'];var utils=require(_0x1504('0x5'));var logger=require(_0x1504('0x6'))(_0x1504('0x7'));var config=require(_0x1504('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1504('0x9')][_0x1504('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d7012,_0x4ccccb,_0x1a5512){return new BPromise(function(_0x46ecfe,_0x15d3ea){return client[_0x1504('0xb')](_0x1d7012,_0x1a5512)[_0x1504('0xc')](function(_0x4c78b5){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x4ccccb,_0x1504('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4ccccb,_0x1504('0xd'),JSON[_0x1504('0xe')](_0x4c78b5));if(_0x4c78b5[_0x1504('0xf')]){if(_0x4c78b5['error']['code']===0x1f4){logger[_0x1504('0xf')](_0x1504('0x10'),_0x4ccccb,_0x4c78b5['error']['message']);return _0x15d3ea(_0x4c78b5[_0x1504('0xf')][_0x1504('0x11')]);}logger[_0x1504('0xf')](_0x1504('0x10'),_0x4ccccb,_0x4c78b5[_0x1504('0xf')][_0x1504('0x11')]);return _0x46ecfe(_0x4c78b5[_0x1504('0xf')][_0x1504('0x11')]);}else{logger['info'](_0x1504('0x10'),_0x4ccccb,_0x1504('0xd'));_0x46ecfe(_0x4c78b5[_0x1504('0x12')][_0x1504('0x11')]);}})['catch'](function(_0x4b680b){logger['error'](_0x1504('0x10'),_0x4ccccb,_0x4b680b);_0x15d3ea(_0x4b680b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8f7d4fe..19127a8 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 _0x778c=['get','isAuthenticated','/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x240c47,_0x5ed496){var _0x1a2bf9=function(_0x57f2f2){while(--_0x57f2f2){_0x240c47['push'](_0x240c47['shift']());}};_0x1a2bf9(++_0x5ed496);}(_0x778c,0xe0));var _0xc778=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x778c[_0x1dac7a];return _0x4cb363;};'use strict';var multer=require(_0xc778('0x0'));var util=require(_0xc778('0x1'));var path=require(_0xc778('0x2'));var timeout=require(_0xc778('0x3'));var express=require('express');var router=express[_0xc778('0x4')]();var fs_extra=require(_0xc778('0x5'));var auth=require(_0xc778('0x6'));var interaction=require(_0xc778('0x7'));var config=require(_0xc778('0x8'));var controller=require(_0xc778('0x9'));router[_0xc778('0xa')]('/',auth[_0xc778('0xb')](),controller['index']);router[_0xc778('0xa')](_0xc778('0xc'),auth[_0xc778('0xb')](),controller[_0xc778('0xd')]);router['post']('/',auth[_0xc778('0xb')](),controller[_0xc778('0xe')]);router[_0xc778('0xf')](_0xc778('0xc'),auth[_0xc778('0xb')](),controller['update']);router[_0xc778('0x10')](_0xc778('0xc'),auth[_0xc778('0xb')](),controller['destroy']);module[_0xc778('0x11')]=router; \ No newline at end of file +var _0x09d9=['exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','update','destroy'];(function(_0x2dfaf5,_0x12d893){var _0x4bb977=function(_0xfef658){while(--_0xfef658){_0x2dfaf5['push'](_0x2dfaf5['shift']());}};_0x4bb977(++_0x12d893);}(_0x09d9,0x119));var _0x909d=function(_0x5cbe57,_0x2af0cf){_0x5cbe57=_0x5cbe57-0x0;var _0x14cca4=_0x09d9[_0x5cbe57];return _0x14cca4;};'use strict';var multer=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var path=require('path');var timeout=require(_0x909d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x909d('0x3'));var interaction=require(_0x909d('0x4'));var config=require('../../config/environment');var controller=require(_0x909d('0x5'));router[_0x909d('0x6')]('/',auth[_0x909d('0x7')](),controller[_0x909d('0x8')]);router[_0x909d('0x6')](_0x909d('0x9'),auth[_0x909d('0x7')](),controller[_0x909d('0xa')]);router['post']('/',auth[_0x909d('0x7')](),controller['create']);router['put'](_0x909d('0x9'),auth[_0x909d('0x7')](),controller[_0x909d('0xb')]);router['delete']('/:id',auth[_0x909d('0x7')](),controller[_0x909d('0xc')]);module[_0x909d('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index fad1235..6b9b1b9 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 _0x41a2=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x7026aa,_0x174e96){var _0x35a685=function(_0xf607ef){while(--_0xf607ef){_0x7026aa['push'](_0x7026aa['shift']());}};_0x35a685(++_0x174e96);}(_0x41a2,0x177));var _0x241a=function(_0x38539e,_0x13633a){_0x38539e=_0x38539e-0x0;var _0x2bb3fa=_0x41a2[_0x38539e];return _0x2bb3fa;};'use strict';var Sequelize=require(_0x241a('0x0'));module[_0x241a('0x1')]={'type':{'type':Sequelize[_0x241a('0x2')](_0x241a('0x3'),_0x241a('0x4'),'customVariable',_0x241a('0x5'),_0x241a('0x6')),'defaultValue':_0x241a('0x3')},'content':{'type':Sequelize[_0x241a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x241a('0x8'))},'keyContent':{'type':Sequelize[_0x241a('0x7')]},'idField':{'type':Sequelize[_0x241a('0x7')]},'nameField':{'type':Sequelize[_0x241a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x241a('0x7')]}}; \ No newline at end of file +var _0xc11f=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x7a3878,_0x1a2887){var _0x4a8799=function(_0x5bc74d){while(--_0x5bc74d){_0x7a3878['push'](_0x7a3878['shift']());}};_0x4a8799(++_0x1a2887);}(_0xc11f,0x1b1));var _0xfc11=function(_0x1c491e,_0x95d2b9){_0x1c491e=_0x1c491e-0x0;var _0x3401eb=_0xc11f[_0x1c491e];return _0x3401eb;};'use strict';var Sequelize=require(_0xfc11('0x0'));module[_0xfc11('0x1')]={'type':{'type':Sequelize[_0xfc11('0x2')]('string',_0xfc11('0x3'),'customVariable',_0xfc11('0x4'),_0xfc11('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc11('0x6')]},'key':{'type':Sequelize[_0xfc11('0x6')]},'keyType':{'type':Sequelize[_0xfc11('0x2')](_0xfc11('0x7'),_0xfc11('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfc11('0x6')]},'nameField':{'type':Sequelize[_0xfc11('0x6')]},'customField':{'type':Sequelize[_0xfc11('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b3b61a4..b02d884 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 _0x94f9=['save','then','destroy','sendStatus','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x578c48,_0x565de6){var _0x260a57=function(_0x4c0110){while(--_0x4c0110){_0x578c48['push'](_0x578c48['shift']());}};_0x260a57(++_0x565de6);}(_0x94f9,0x19a));var _0x994f=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0x94f9[_0x404f13];return _0x1f9dbb;};'use strict';var emlformat=require(_0x994f('0x0'));var rimraf=require(_0x994f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x994f('0x2'));var rp=require(_0x994f('0x3'));var moment=require(_0x994f('0x4'));var BPromise=require(_0x994f('0x5'));var Mustache=require(_0x994f('0x6'));var util=require(_0x994f('0x7'));var path=require(_0x994f('0x8'));var sox=require('sox');var csv=require(_0x994f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x994f('0xa'));var squel=require(_0x994f('0xb'));var crypto=require('crypto');var jsforce=require(_0x994f('0xc'));var deskjs=require(_0x994f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x994f('0xe'));var Papa=require(_0x994f('0xf'));var Redis=require(_0x994f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x994f('0x11'));var hardwareService=require(_0x994f('0x12'));var logger=require(_0x994f('0x13'))(_0x994f('0x14'));var utils=require(_0x994f('0x15'));var config=require(_0x994f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec2b59,_0x47d892){_0x47d892=_0x47d892||0xcc;return function(_0x69c0b0){if(_0x69c0b0){return _0xec2b59['sendStatus'](_0x47d892);}return _0xec2b59[_0x994f('0x17')](_0x47d892)[_0x994f('0x18')]();};}function respondWithResult(_0x294221,_0x4472bc){_0x4472bc=_0x4472bc||0xc8;return function(_0x3b21d7){if(_0x3b21d7){return _0x294221[_0x994f('0x17')](_0x4472bc)[_0x994f('0x19')](_0x3b21d7);}};}function respondWithFilteredResult(_0x101efb,_0x3baa92){return function(_0x3c8862){if(_0x3c8862){var _0x433289=typeof _0x3baa92[_0x994f('0x1a')]==='undefined'&&typeof _0x3baa92[_0x994f('0x1b')]===_0x994f('0x1c');var _0xdfc808=_0x3c8862[_0x994f('0x1d')];var _0x359118=_0x433289?0x0:_0x3baa92[_0x994f('0x1a')];var _0x836ffd=_0x433289?_0x3c8862[_0x994f('0x1d')]:_0x3baa92[_0x994f('0x1a')]+_0x3baa92[_0x994f('0x1b')];var _0x20b299;if(_0x836ffd>=_0xdfc808){_0x836ffd=_0xdfc808;_0x20b299=0xc8;}else{_0x20b299=0xce;}_0x101efb[_0x994f('0x17')](_0x20b299);return _0x101efb[_0x994f('0x1e')](_0x994f('0x1f'),_0x359118+'-'+_0x836ffd+'/'+_0xdfc808)[_0x994f('0x19')](_0x3c8862);}return null;};}function patchUpdates(_0x1bfde4){return function(_0x50f32b){try{jsonpatch[_0x994f('0x20')](_0x50f32b,_0x1bfde4,!![]);}catch(_0x28389d){return BPromise[_0x994f('0x21')](_0x28389d);}return _0x50f32b[_0x994f('0x22')]();};}function saveUpdates(_0x5d6840,_0x4589ed){return function(_0x35c4c2){if(_0x35c4c2){return _0x35c4c2['update'](_0x5d6840)[_0x994f('0x23')](function(_0x99e072){return _0x99e072;});}return null;};}function removeEntity(_0x230950,_0x2360b6){return function(_0x1b0c39){if(_0x1b0c39){return _0x1b0c39[_0x994f('0x24')]()[_0x994f('0x23')](function(){_0x230950[_0x994f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x175681,_0x149bea){return function(_0x233d4d){if(!_0x233d4d){_0x175681[_0x994f('0x25')](0x194);}return _0x233d4d;};}function handleError(_0xc87b47,_0x55c014){_0x55c014=_0x55c014||0x1f4;return function(_0x1ed6b2){logger[_0x994f('0x26')](_0x1ed6b2[_0x994f('0x27')]);if(_0x1ed6b2[_0x994f('0x28')]){delete _0x1ed6b2[_0x994f('0x28')];}_0xc87b47[_0x994f('0x17')](_0x55c014)['send'](_0x1ed6b2);};}exports[_0x994f('0x29')]=function(_0x560261,_0xb9d09d){var _0x30b6c1={},_0x23d57b={},_0x5e310f={'count':0x0,'rows':[]};var _0x2f9d3f=_[_0x994f('0x2a')](db[_0x994f('0x2b')][_0x994f('0x2c')],function(_0x6a6662){return{'name':_0x6a6662[_0x994f('0x2d')],'type':_0x6a6662[_0x994f('0x2e')][_0x994f('0x2f')]};});_0x23d57b[_0x994f('0x30')]=_[_0x994f('0x2a')](_0x2f9d3f,_0x994f('0x28'));_0x23d57b[_0x994f('0x31')]=_[_0x994f('0x32')](_0x560261[_0x994f('0x31')]);_0x23d57b[_0x994f('0x33')]=_[_0x994f('0x34')](_0x23d57b['model'],_0x23d57b[_0x994f('0x31')]);_0x30b6c1[_0x994f('0x35')]=_['intersection'](_0x23d57b['model'],qs[_0x994f('0x36')](_0x560261[_0x994f('0x31')][_0x994f('0x36')]));_0x30b6c1[_0x994f('0x35')]=_0x30b6c1['attributes'][_0x994f('0x37')]?_0x30b6c1[_0x994f('0x35')]:_0x23d57b[_0x994f('0x30')];if(!_0x560261[_0x994f('0x31')]['hasOwnProperty'](_0x994f('0x38'))){_0x30b6c1['limit']=qs[_0x994f('0x1b')](_0x560261[_0x994f('0x31')][_0x994f('0x1b')]);_0x30b6c1[_0x994f('0x1a')]=qs['offset'](_0x560261[_0x994f('0x31')][_0x994f('0x1a')]);}_0x30b6c1[_0x994f('0x39')]=qs[_0x994f('0x3a')](_0x560261[_0x994f('0x31')][_0x994f('0x3a')]);_0x30b6c1[_0x994f('0x3b')]=qs[_0x994f('0x33')](_['pick'](_0x560261[_0x994f('0x31')],_0x23d57b[_0x994f('0x33')]),_0x2f9d3f);if(_0x560261['query']['filter']){_0x30b6c1[_0x994f('0x3b')]=_[_0x994f('0x3c')](_0x30b6c1[_0x994f('0x3b')],{'$or':_[_0x994f('0x2a')](_0x2f9d3f,function(_0x270947){if(_0x270947[_0x994f('0x2e')]!==_0x994f('0x3d')){var _0x5b4573={};_0x5b4573[_0x270947['name']]={'$like':'%'+_0x560261['query'][_0x994f('0x3e')]+'%'};return _0x5b4573;}})});}_0x30b6c1=_[_0x994f('0x3c')]({},_0x30b6c1,_0x560261[_0x994f('0x3f')]);var _0x4de75e={'where':_0x30b6c1[_0x994f('0x3b')]};return db[_0x994f('0x2b')][_0x994f('0x1d')](_0x4de75e)['then'](function(_0xb07e4a){_0x5e310f[_0x994f('0x1d')]=_0xb07e4a;if(_0x560261[_0x994f('0x31')][_0x994f('0x40')]){_0x30b6c1[_0x994f('0x41')]=[{'all':!![]}];}return db['ZendeskField'][_0x994f('0x42')](_0x30b6c1);})[_0x994f('0x23')](function(_0x4cd89d){_0x5e310f['rows']=_0x4cd89d;return _0x5e310f;})['then'](respondWithFilteredResult(_0xb9d09d,_0x30b6c1))[_0x994f('0x43')](handleError(_0xb9d09d,null));};exports[_0x994f('0x44')]=function(_0x15aeee,_0x30e507){var _0x55984f={'raw':!![],'where':{'id':_0x15aeee[_0x994f('0x45')]['id']}},_0xe8d01d={};_0xe8d01d['model']=_[_0x994f('0x32')](db[_0x994f('0x2b')][_0x994f('0x2c')]);_0xe8d01d[_0x994f('0x31')]=_[_0x994f('0x32')](_0x15aeee[_0x994f('0x31')]);_0xe8d01d[_0x994f('0x33')]=_['intersection'](_0xe8d01d[_0x994f('0x30')],_0xe8d01d['query']);_0x55984f[_0x994f('0x35')]=_[_0x994f('0x34')](_0xe8d01d[_0x994f('0x30')],qs[_0x994f('0x36')](_0x15aeee[_0x994f('0x31')]['fields']));_0x55984f[_0x994f('0x35')]=_0x55984f['attributes']['length']?_0x55984f[_0x994f('0x35')]:_0xe8d01d[_0x994f('0x30')];if(_0x15aeee[_0x994f('0x31')]['includeAll']){_0x55984f[_0x994f('0x41')]=[{'all':!![]}];}_0x55984f=_[_0x994f('0x3c')]({},_0x55984f,_0x15aeee[_0x994f('0x3f')]);return db['ZendeskField'][_0x994f('0x46')](_0x55984f)[_0x994f('0x23')](handleEntityNotFound(_0x30e507,null))[_0x994f('0x23')](respondWithResult(_0x30e507,null))[_0x994f('0x43')](handleError(_0x30e507,null));};exports[_0x994f('0x47')]=function(_0x4b1b2d,_0x5b60a5){return db[_0x994f('0x2b')][_0x994f('0x47')](_0x4b1b2d[_0x994f('0x48')],{})[_0x994f('0x23')](respondWithResult(_0x5b60a5,0xc9))[_0x994f('0x43')](handleError(_0x5b60a5,null));};exports[_0x994f('0x49')]=function(_0x7a8654,_0x4b7cc6){if(_0x7a8654['body']['id']){delete _0x7a8654[_0x994f('0x48')]['id'];}return db[_0x994f('0x2b')][_0x994f('0x46')]({'where':{'id':_0x7a8654[_0x994f('0x45')]['id']}})[_0x994f('0x23')](handleEntityNotFound(_0x4b7cc6,null))[_0x994f('0x23')](saveUpdates(_0x7a8654['body'],null))[_0x994f('0x23')](respondWithResult(_0x4b7cc6,null))[_0x994f('0x43')](handleError(_0x4b7cc6,null));};exports[_0x994f('0x24')]=function(_0x54bea4,_0x599a3){return db[_0x994f('0x2b')][_0x994f('0x46')]({'where':{'id':_0x54bea4['params']['id']}})[_0x994f('0x23')](handleEntityNotFound(_0x599a3,null))[_0x994f('0x23')](removeEntity(_0x599a3,null))[_0x994f('0x43')](handleError(_0x599a3,null));}; \ No newline at end of file +var _0x249a=['lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','name','send','index','map','rawAttributes','type','key','model','keys','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','options','ZendeskField','findAll','catch','params','includeAll','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x11490a,_0x325f82){var _0x37ea5e=function(_0xe68b42){while(--_0xe68b42){_0x11490a['push'](_0x11490a['shift']());}};_0x37ea5e(++_0x325f82);}(_0x249a,0x105));var _0xa249=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x249a[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require(_0xa249('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa249('0x1'));var jsonpatch=require(_0xa249('0x2'));var rp=require(_0xa249('0x3'));var moment=require(_0xa249('0x4'));var BPromise=require(_0xa249('0x5'));var Mustache=require(_0xa249('0x6'));var util=require(_0xa249('0x7'));var path=require(_0xa249('0x8'));var sox=require('sox');var csv=require(_0xa249('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa249('0xa'));var _=require(_0xa249('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa249('0xc'));var toCsv=require(_0xa249('0x9'));var querystring=require(_0xa249('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa249('0xe'));var qs=require(_0xa249('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa249('0x10'));var logger=require(_0xa249('0x11'))(_0xa249('0x12'));var utils=require(_0xa249('0x13'));var config=require(_0xa249('0x14'));var licenseUtil=require(_0xa249('0x15'));var db=require(_0xa249('0x16'))['db'];function respondWithStatusCode(_0x4d7684,_0x23d475){_0x23d475=_0x23d475||0xcc;return function(_0x54ad8b){if(_0x54ad8b){return _0x4d7684[_0xa249('0x17')](_0x23d475);}return _0x4d7684[_0xa249('0x18')](_0x23d475)[_0xa249('0x19')]();};}function respondWithResult(_0x2dc178,_0xef75f0){_0xef75f0=_0xef75f0||0xc8;return function(_0x50cf8e){if(_0x50cf8e){return _0x2dc178[_0xa249('0x18')](_0xef75f0)[_0xa249('0x1a')](_0x50cf8e);}};}function respondWithFilteredResult(_0xfa0bfc,_0x153c68){return function(_0x1901fb){if(_0x1901fb){var _0x39da06=typeof _0x153c68[_0xa249('0x1b')]==='undefined'&&typeof _0x153c68['limit']===_0xa249('0x1c');var _0x947bf2=_0x1901fb['count'];var _0x1e3c01=_0x39da06?0x0:_0x153c68[_0xa249('0x1b')];var _0x5976c3=_0x39da06?_0x1901fb[_0xa249('0x1d')]:_0x153c68[_0xa249('0x1b')]+_0x153c68['limit'];var _0xc52d8;if(_0x5976c3>=_0x947bf2){_0x5976c3=_0x947bf2;_0xc52d8=0xc8;}else{_0xc52d8=0xce;}_0xfa0bfc[_0xa249('0x18')](_0xc52d8);return _0xfa0bfc[_0xa249('0x1e')](_0xa249('0x1f'),_0x1e3c01+'-'+_0x5976c3+'/'+_0x947bf2)[_0xa249('0x1a')](_0x1901fb);}return null;};}function patchUpdates(_0xce4b8c){return function(_0x20e54d){try{jsonpatch[_0xa249('0x20')](_0x20e54d,_0xce4b8c,!![]);}catch(_0x23088a){return BPromise['reject'](_0x23088a);}return _0x20e54d['save']();};}function saveUpdates(_0x588739,_0x23a0d6){return function(_0x4613e4){if(_0x4613e4){return _0x4613e4[_0xa249('0x21')](_0x588739)[_0xa249('0x22')](function(_0x80584){return _0x80584;});}return null;};}function removeEntity(_0x2b6aaa,_0x3b157d){return function(_0x1af5e9){if(_0x1af5e9){return _0x1af5e9['destroy']()[_0xa249('0x22')](function(){_0x2b6aaa[_0xa249('0x18')](0xcc)[_0xa249('0x19')]();});}};}function handleEntityNotFound(_0x2c3b63,_0x3c0997){return function(_0x420aa0){if(!_0x420aa0){_0x2c3b63[_0xa249('0x17')](0x194);}return _0x420aa0;};}function handleError(_0x462d85,_0xf72438){_0xf72438=_0xf72438||0x1f4;return function(_0x449110){logger['error'](_0x449110['stack']);if(_0x449110[_0xa249('0x23')]){delete _0x449110['name'];}_0x462d85[_0xa249('0x18')](_0xf72438)[_0xa249('0x24')](_0x449110);};}exports[_0xa249('0x25')]=function(_0x1b5ca4,_0x1d4cdd){var _0x222e2f={},_0x536e5b={},_0x2ad050={'count':0x0,'rows':[]};var _0x46d254=_[_0xa249('0x26')](db['ZendeskField'][_0xa249('0x27')],function(_0x37bdb4){return{'name':_0x37bdb4['fieldName'],'type':_0x37bdb4[_0xa249('0x28')][_0xa249('0x29')]};});_0x536e5b[_0xa249('0x2a')]=_[_0xa249('0x26')](_0x46d254,_0xa249('0x23'));_0x536e5b['query']=_[_0xa249('0x2b')](_0x1b5ca4['query']);_0x536e5b['filters']=_['intersection'](_0x536e5b[_0xa249('0x2a')],_0x536e5b['query']);_0x222e2f['attributes']=_[_0xa249('0x2c')](_0x536e5b[_0xa249('0x2a')],qs['fields'](_0x1b5ca4['query'][_0xa249('0x2d')]));_0x222e2f['attributes']=_0x222e2f[_0xa249('0x2e')][_0xa249('0x2f')]?_0x222e2f[_0xa249('0x2e')]:_0x536e5b[_0xa249('0x2a')];if(!_0x1b5ca4[_0xa249('0x30')][_0xa249('0x31')](_0xa249('0x32'))){_0x222e2f[_0xa249('0x33')]=qs['limit'](_0x1b5ca4[_0xa249('0x30')][_0xa249('0x33')]);_0x222e2f[_0xa249('0x1b')]=qs[_0xa249('0x1b')](_0x1b5ca4[_0xa249('0x30')]['offset']);}_0x222e2f[_0xa249('0x34')]=qs[_0xa249('0x35')](_0x1b5ca4[_0xa249('0x30')]['sort']);_0x222e2f[_0xa249('0x36')]=qs[_0xa249('0x37')](_['pick'](_0x1b5ca4['query'],_0x536e5b[_0xa249('0x37')]),_0x46d254);if(_0x1b5ca4[_0xa249('0x30')][_0xa249('0x38')]){_0x222e2f['where']=_['merge'](_0x222e2f['where'],{'$or':_[_0xa249('0x26')](_0x46d254,function(_0x11456b){if(_0x11456b['type']!==_0xa249('0x39')){var _0x5b8ac6={};_0x5b8ac6[_0x11456b[_0xa249('0x23')]]={'$like':'%'+_0x1b5ca4['query'][_0xa249('0x38')]+'%'};return _0x5b8ac6;}})});}_0x222e2f=_['merge']({},_0x222e2f,_0x1b5ca4[_0xa249('0x3a')]);var _0x2c5a07={'where':_0x222e2f[_0xa249('0x36')]};return db[_0xa249('0x3b')]['count'](_0x2c5a07)['then'](function(_0x5a84ee){_0x2ad050[_0xa249('0x1d')]=_0x5a84ee;if(_0x1b5ca4[_0xa249('0x30')]['includeAll']){_0x222e2f['include']=[{'all':!![]}];}return db['ZendeskField'][_0xa249('0x3c')](_0x222e2f);})[_0xa249('0x22')](function(_0x4ed386){_0x2ad050['rows']=_0x4ed386;return _0x2ad050;})[_0xa249('0x22')](respondWithFilteredResult(_0x1d4cdd,_0x222e2f))[_0xa249('0x3d')](handleError(_0x1d4cdd,null));};exports['show']=function(_0x3f5424,_0x523c3e){var _0x53486a={'raw':!![],'where':{'id':_0x3f5424[_0xa249('0x3e')]['id']}},_0x3de473={};_0x3de473['model']=_[_0xa249('0x2b')](db[_0xa249('0x3b')][_0xa249('0x27')]);_0x3de473['query']=_[_0xa249('0x2b')](_0x3f5424['query']);_0x3de473[_0xa249('0x37')]=_[_0xa249('0x2c')](_0x3de473[_0xa249('0x2a')],_0x3de473[_0xa249('0x30')]);_0x53486a[_0xa249('0x2e')]=_['intersection'](_0x3de473[_0xa249('0x2a')],qs[_0xa249('0x2d')](_0x3f5424[_0xa249('0x30')][_0xa249('0x2d')]));_0x53486a[_0xa249('0x2e')]=_0x53486a[_0xa249('0x2e')]['length']?_0x53486a['attributes']:_0x3de473['model'];if(_0x3f5424['query'][_0xa249('0x3f')]){_0x53486a[_0xa249('0x40')]=[{'all':!![]}];}_0x53486a=_['merge']({},_0x53486a,_0x3f5424[_0xa249('0x3a')]);return db[_0xa249('0x3b')][_0xa249('0x41')](_0x53486a)[_0xa249('0x22')](handleEntityNotFound(_0x523c3e,null))[_0xa249('0x22')](respondWithResult(_0x523c3e,null))[_0xa249('0x3d')](handleError(_0x523c3e,null));};exports[_0xa249('0x42')]=function(_0x32ca17,_0x213d70){return db[_0xa249('0x3b')][_0xa249('0x42')](_0x32ca17['body'],{})[_0xa249('0x22')](respondWithResult(_0x213d70,0xc9))['catch'](handleError(_0x213d70,null));};exports[_0xa249('0x21')]=function(_0x35d7af,_0x119aac){if(_0x35d7af[_0xa249('0x43')]['id']){delete _0x35d7af[_0xa249('0x43')]['id'];}return db[_0xa249('0x3b')][_0xa249('0x41')]({'where':{'id':_0x35d7af[_0xa249('0x3e')]['id']}})[_0xa249('0x22')](handleEntityNotFound(_0x119aac,null))[_0xa249('0x22')](saveUpdates(_0x35d7af[_0xa249('0x43')],null))[_0xa249('0x22')](respondWithResult(_0x119aac,null))[_0xa249('0x3d')](handleError(_0x119aac,null));};exports['destroy']=function(_0x4c4486,_0x28b446){return db[_0xa249('0x3b')][_0xa249('0x41')]({'where':{'id':_0x4c4486[_0xa249('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28b446,null))[_0xa249('0x22')](removeEntity(_0x28b446,null))[_0xa249('0x3d')](handleError(_0x28b446,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 8a36c3a..9310786 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 _0xe10d=['rimraf','../../config/environment','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xe10d,0xda));var _0xde10=function(_0x51a6ab,_0x5cb923){_0x51a6ab=_0x51a6ab-0x0;var _0x472f60=_0xe10d[_0x51a6ab];return _0x472f60;};'use strict';var _=require('lodash');var util=require(_0xde10('0x0'));var logger=require(_0xde10('0x1'))(_0xde10('0x2'));var moment=require(_0xde10('0x3'));var BPromise=require(_0xde10('0x4'));var rp=require(_0xde10('0x5'));var fs=require('fs');var path=require(_0xde10('0x6'));var rimraf=require(_0xde10('0x7'));var config=require(_0xde10('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xde10('0x9')]=function(_0x16c1ba,_0x3d9f5f){return _0x16c1ba[_0xde10('0xa')]('ZendeskField',attributes,{'tableName':_0xde10('0xb'),'paranoid':![],'indexes':[{'name':_0xde10('0xc'),'fields':[_0xde10('0xd'),_0xde10('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd0=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','api','moment'];(function(_0x57bcdd,_0x355465){var _0x426352=function(_0x1d0a1b){while(--_0x1d0a1b){_0x57bcdd['push'](_0x57bcdd['shift']());}};_0x426352(++_0x355465);}(_0x4bd0,0x10c));var _0x04bd=function(_0x42676f,_0x4c3299){_0x42676f=_0x42676f-0x0;var _0x2b884e=_0x4bd0[_0x42676f];return _0x2b884e;};'use strict';var _=require(_0x04bd('0x0'));var util=require('util');var logger=require(_0x04bd('0x1'))(_0x04bd('0x2'));var moment=require(_0x04bd('0x3'));var BPromise=require(_0x04bd('0x4'));var rp=require(_0x04bd('0x5'));var fs=require('fs');var path=require(_0x04bd('0x6'));var rimraf=require(_0x04bd('0x7'));var config=require(_0x04bd('0x8'));var attributes=require(_0x04bd('0x9'));module[_0x04bd('0xa')]=function(_0x4b1dc8,_0xeb23c6){return _0x4b1dc8[_0x04bd('0xb')](_0x04bd('0xc'),attributes,{'tableName':_0x04bd('0xd'),'paranoid':![],'indexes':[{'name':_0x04bd('0xe'),'fields':['idField',_0x04bd('0xf')],'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 d62f176..0cd7a41 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 _0x31d1=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x31d1,0x143));var _0x131d=function(_0x12ce7a,_0x4255c7){_0x12ce7a=_0x12ce7a-0x0;var _0x3f6a3d=_0x31d1[_0x12ce7a];return _0x3f6a3d;};'use strict';var _=require('lodash');var util=require(_0x131d('0x0'));var moment=require(_0x131d('0x1'));var BPromise=require(_0x131d('0x2'));var rs=require(_0x131d('0x3'));var fs=require('fs');var Redis=require(_0x131d('0x4'));var db=require(_0x131d('0x5'))['db'];var utils=require(_0x131d('0x6'));var logger=require(_0x131d('0x7'))(_0x131d('0x8'));var config=require(_0x131d('0x9'));var jayson=require(_0x131d('0xa'));var client=jayson[_0x131d('0xb')][_0x131d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52fa14,_0x50bf41,_0x2a4ccf){return new BPromise(function(_0x58186b,_0x1b3293){return client[_0x131d('0xd')](_0x52fa14,_0x2a4ccf)[_0x131d('0xe')](function(_0x53b16f){logger[_0x131d('0xf')](_0x131d('0x10'),_0x50bf41,_0x131d('0x11'));logger['debug'](_0x131d('0x12'),_0x50bf41,'request\x20sent',JSON[_0x131d('0x13')](_0x53b16f));if(_0x53b16f[_0x131d('0x14')]){if(_0x53b16f[_0x131d('0x14')][_0x131d('0x15')]===0x1f4){logger[_0x131d('0x14')](_0x131d('0x10'),_0x50bf41,_0x53b16f[_0x131d('0x14')][_0x131d('0x16')]);return _0x1b3293(_0x53b16f[_0x131d('0x14')][_0x131d('0x16')]);}logger[_0x131d('0x14')](_0x131d('0x10'),_0x50bf41,_0x53b16f['error'][_0x131d('0x16')]);return _0x58186b(_0x53b16f[_0x131d('0x14')][_0x131d('0x16')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x50bf41,_0x131d('0x11'));_0x58186b(_0x53b16f[_0x131d('0x17')][_0x131d('0x16')]);}})['catch'](function(_0x38366e){logger[_0x131d('0x14')](_0x131d('0x10'),_0x50bf41,_0x38366e);_0x1b3293(_0x38366e);});});} \ No newline at end of file +var _0xac58=['request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0xac58,0x17c));var _0x8ac5=function(_0x4033f0,_0x326490){_0x4033f0=_0x4033f0-0x0;var _0x2b81d2=_0xac58[_0x4033f0];return _0x2b81d2;};'use strict';var _=require(_0x8ac5('0x0'));var util=require(_0x8ac5('0x1'));var moment=require('moment');var BPromise=require(_0x8ac5('0x2'));var rs=require(_0x8ac5('0x3'));var fs=require('fs');var Redis=require(_0x8ac5('0x4'));var db=require(_0x8ac5('0x5'))['db'];var utils=require(_0x8ac5('0x6'));var logger=require(_0x8ac5('0x7'))(_0x8ac5('0x8'));var config=require(_0x8ac5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ac5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13eb5,_0x2f08e7,_0x5d6eb8){return new BPromise(function(_0x26c872,_0x5d9601){return client[_0x8ac5('0xb')](_0x13eb5,_0x5d6eb8)[_0x8ac5('0xc')](function(_0x366ec2){logger[_0x8ac5('0xd')](_0x8ac5('0xe'),_0x2f08e7,'request\x20sent');logger[_0x8ac5('0xf')](_0x8ac5('0x10'),_0x2f08e7,'request\x20sent',JSON[_0x8ac5('0x11')](_0x366ec2));if(_0x366ec2['error']){if(_0x366ec2[_0x8ac5('0x12')][_0x8ac5('0x13')]===0x1f4){logger['error'](_0x8ac5('0xe'),_0x2f08e7,_0x366ec2['error'][_0x8ac5('0x14')]);return _0x5d9601(_0x366ec2[_0x8ac5('0x12')][_0x8ac5('0x14')]);}logger[_0x8ac5('0x12')](_0x8ac5('0xe'),_0x2f08e7,_0x366ec2[_0x8ac5('0x12')][_0x8ac5('0x14')]);return _0x26c872(_0x366ec2[_0x8ac5('0x12')][_0x8ac5('0x14')]);}else{logger[_0x8ac5('0xd')]('ZendeskField,\x20%s,\x20%s',_0x2f08e7,'request\x20sent');_0x26c872(_0x366ec2[_0x8ac5('0x15')][_0x8ac5('0x14')]);}})[_0x8ac5('0x16')](function(_0x1106a7){logger[_0x8ac5('0x12')]('ZendeskField,\x20%s,\x20%s',_0x2f08e7,_0x1106a7);_0x5d9601(_0x1106a7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2f019c7..20f624d 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 _0x706c=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','delete','destroy'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x706c,0x176));var _0xc706=function(_0x4c1ad8,_0x55e28d){_0x4c1ad8=_0x4c1ad8-0x0;var _0x2c617b=_0x706c[_0x4c1ad8];return _0x2c617b;};'use strict';var multer=require(_0xc706('0x0'));var util=require('util');var path=require(_0xc706('0x1'));var timeout=require(_0xc706('0x2'));var express=require('express');var router=express[_0xc706('0x3')]();var fs_extra=require(_0xc706('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc706('0x5'));var config=require(_0xc706('0x6'));var controller=require(_0xc706('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc706('0x8')]);router[_0xc706('0x9')]('/:id',auth[_0xc706('0xa')](),controller[_0xc706('0xb')]);router['get'](_0xc706('0xc'),auth[_0xc706('0xa')](),controller[_0xc706('0xd')]);router['get'](_0xc706('0xe'),auth[_0xc706('0xa')](),controller[_0xc706('0xf')]);router[_0xc706('0x10')]('/',auth[_0xc706('0xa')](),controller[_0xc706('0x11')]);router[_0xc706('0x10')](_0xc706('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc706('0x12')](_0xc706('0x13'),auth[_0xc706('0xa')](),controller['update']);router[_0xc706('0x14')]('/:id',auth[_0xc706('0xa')](),controller[_0xc706('0x15')]);module['exports']=router; \ No newline at end of file +var _0x737d=['./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x36c500,_0x5a4042){var _0x41a7a9=function(_0x153c67){while(--_0x153c67){_0x36c500['push'](_0x36c500['shift']());}};_0x41a7a9(++_0x5a4042);}(_0x737d,0xea));var _0xd737=function(_0x4802a3,_0x10d66a){_0x4802a3=_0x4802a3-0x0;var _0x5b8b76=_0x737d[_0x4802a3];return _0x5b8b76;};'use strict';var multer=require('multer');var util=require(_0xd737('0x0'));var path=require(_0xd737('0x1'));var timeout=require('connect-timeout');var express=require(_0xd737('0x2'));var router=express[_0xd737('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd737('0x4'));var config=require(_0xd737('0x5'));var controller=require(_0xd737('0x6'));router[_0xd737('0x7')]('/',auth[_0xd737('0x8')](),controller[_0xd737('0x9')]);router['get'](_0xd737('0xa'),auth[_0xd737('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xd737('0x8')](),controller['getConfigurations']);router[_0xd737('0x7')](_0xd737('0xb'),auth[_0xd737('0x8')](),controller[_0xd737('0xc')]);router[_0xd737('0xd')]('/',auth[_0xd737('0x8')](),controller[_0xd737('0xe')]);router[_0xd737('0xd')](_0xd737('0xf'),auth[_0xd737('0x8')](),controller[_0xd737('0x10')]);router[_0xd737('0x11')](_0xd737('0xa'),auth[_0xd737('0x8')](),controller['update']);router[_0xd737('0x12')](_0xd737('0xa'),auth[_0xd737('0x8')](),controller['destroy']);module[_0xd737('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 67cb6ef..52fa6a3 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 _0x22fb=['STRING'];(function(_0x5c1504,_0x54dc2f){var _0x5b40dc=function(_0x2536cb){while(--_0x2536cb){_0x5c1504['push'](_0x5c1504['shift']());}};_0x5b40dc(++_0x54dc2f);}(_0x22fb,0x192));var _0xb22f=function(_0x19350d,_0x4e1995){_0x19350d=_0x19350d-0x0;var _0x5532a2=_0x22fb[_0x19350d];return _0x5532a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0xda55=['STRING','sequelize','exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xda55,0x6d));var _0x5da5=function(_0x381e4e,_0x4d46c6){_0x381e4e=_0x381e4e-0x0;var _0x52fc95=_0xda55[_0x381e4e];return _0x52fc95;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5da5('0x2')]},'zone':{'type':Sequelize[_0x5da5('0x2')]},'clientId':{'type':Sequelize[_0x5da5('0x2')]},'clientSecret':{'type':Sequelize[_0x5da5('0x2')]},'serverUrl':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x5da5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 868d441..5a93d57 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 _0xeca5=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','name','map','ZohoAccount','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xeca5,0xec));var _0x5eca=function(_0xbdd359,_0xc16403){_0xbdd359=_0xbdd359-0x0;var _0x4b215c=_0xeca5[_0xbdd359];return _0x4b215c;};'use strict';var emlformat=require(_0x5eca('0x0'));var rimraf=require(_0x5eca('0x1'));var zipdir=require(_0x5eca('0x2'));var jsonpatch=require(_0x5eca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5eca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5eca('0x5'));var sox=require('sox');var csv=require(_0x5eca('0x6'));var ejs=require(_0x5eca('0x7'));var fs=require('fs');var fs_extra=require(_0x5eca('0x8'));var _=require(_0x5eca('0x9'));var squel=require(_0x5eca('0xa'));var crypto=require(_0x5eca('0xb'));var jsforce=require(_0x5eca('0xc'));var deskjs=require(_0x5eca('0xd'));var toCsv=require(_0x5eca('0x6'));var querystring=require(_0x5eca('0xe'));var Papa=require(_0x5eca('0xf'));var Redis=require(_0x5eca('0x10'));var authService=require(_0x5eca('0x11'));var qs=require(_0x5eca('0x12'));var as=require(_0x5eca('0x13'));var hardwareService=require(_0x5eca('0x14'));var logger=require(_0x5eca('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5eca('0x16'));var db=require(_0x5eca('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2959d7,_0x93d6f5){_0x93d6f5=_0x93d6f5||0xcc;return function(_0x3f97d6){if(_0x3f97d6){return _0x2959d7[_0x5eca('0x18')](_0x93d6f5);}return _0x2959d7[_0x5eca('0x19')](_0x93d6f5)['end']();};}function respondWithResult(_0x1bba31,_0x29ceb8){_0x29ceb8=_0x29ceb8||0xc8;return function(_0x3a4e55){if(_0x3a4e55){return _0x1bba31[_0x5eca('0x19')](_0x29ceb8)[_0x5eca('0x1a')](_0x3a4e55);}};}function respondWithFilteredResult(_0x3ab8ac,_0x123de1){return function(_0x2f3cf1){if(_0x2f3cf1){var _0x2bcbae=typeof _0x123de1[_0x5eca('0x1b')]==='undefined'&&typeof _0x123de1[_0x5eca('0x1c')]===_0x5eca('0x1d');var _0x392d0a=_0x2f3cf1['count'];var _0x119c3b=_0x2bcbae?0x0:_0x123de1[_0x5eca('0x1b')];var _0x3272fc=_0x2bcbae?_0x2f3cf1[_0x5eca('0x1e')]:_0x123de1['offset']+_0x123de1[_0x5eca('0x1c')];var _0x263392;if(_0x3272fc>=_0x392d0a){_0x3272fc=_0x392d0a;_0x263392=0xc8;}else{_0x263392=0xce;}_0x3ab8ac['status'](_0x263392);return _0x3ab8ac[_0x5eca('0x1f')]('Content-Range',_0x119c3b+'-'+_0x3272fc+'/'+_0x392d0a)[_0x5eca('0x1a')](_0x2f3cf1);}return null;};}function patchUpdates(_0x574e63){return function(_0x2dc659){try{jsonpatch['apply'](_0x2dc659,_0x574e63,!![]);}catch(_0x58102a){return BPromise[_0x5eca('0x20')](_0x58102a);}return _0x2dc659[_0x5eca('0x21')]();};}function saveUpdates(_0xa6e511,_0x1d6a5e){return function(_0x4f4c2a){if(_0x4f4c2a){return _0x4f4c2a[_0x5eca('0x22')](_0xa6e511)[_0x5eca('0x23')](function(_0x14bcea){return _0x14bcea;});}return null;};}function removeEntity(_0xa2e242,_0x24e942){return function(_0x2dab6b){if(_0x2dab6b){return _0x2dab6b[_0x5eca('0x24')]()[_0x5eca('0x23')](function(){_0xa2e242[_0x5eca('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249960,_0x16f54f){return function(_0x1b1edb){if(!_0x1b1edb){_0x249960[_0x5eca('0x18')](0x194);}return _0x1b1edb;};}function handleError(_0xef7cdb,_0xe3a990){_0xe3a990=_0xe3a990||0x1f4;return function(_0x7faf37){logger[_0x5eca('0x25')](_0x7faf37['stack']);if(_0x7faf37[_0x5eca('0x26')]){delete _0x7faf37[_0x5eca('0x26')];}_0xef7cdb[_0x5eca('0x19')](_0xe3a990)['send'](_0x7faf37);};}exports['index']=function(_0x22b4a9,_0x26b4d2){var _0x217a1b={},_0x477285={},_0x56238f={'count':0x0,'rows':[]};var _0x341c64=_[_0x5eca('0x27')](db[_0x5eca('0x28')][_0x5eca('0x29')],function(_0xaa2891){return{'name':_0xaa2891[_0x5eca('0x2a')],'type':_0xaa2891['type'][_0x5eca('0x2b')]};});_0x477285[_0x5eca('0x2c')]=_[_0x5eca('0x27')](_0x341c64,_0x5eca('0x26'));_0x477285[_0x5eca('0x2d')]=_['keys'](_0x22b4a9['query']);_0x477285['filters']=_[_0x5eca('0x2e')](_0x477285[_0x5eca('0x2c')],_0x477285[_0x5eca('0x2d')]);_0x217a1b['attributes']=_[_0x5eca('0x2e')](_0x477285[_0x5eca('0x2c')],qs[_0x5eca('0x2f')](_0x22b4a9[_0x5eca('0x2d')][_0x5eca('0x2f')]));_0x217a1b[_0x5eca('0x30')]=_0x217a1b['attributes'][_0x5eca('0x31')]?_0x217a1b[_0x5eca('0x30')]:_0x477285[_0x5eca('0x2c')];if(!_0x22b4a9['query'][_0x5eca('0x32')](_0x5eca('0x33'))){_0x217a1b[_0x5eca('0x1c')]=qs['limit'](_0x22b4a9['query'][_0x5eca('0x1c')]);_0x217a1b[_0x5eca('0x1b')]=qs[_0x5eca('0x1b')](_0x22b4a9[_0x5eca('0x2d')][_0x5eca('0x1b')]);}_0x217a1b[_0x5eca('0x34')]=qs[_0x5eca('0x35')](_0x22b4a9['query'][_0x5eca('0x35')]);_0x217a1b['where']=qs['filters'](_['pick'](_0x22b4a9[_0x5eca('0x2d')],_0x477285[_0x5eca('0x36')]),_0x341c64);if(_0x22b4a9[_0x5eca('0x2d')][_0x5eca('0x37')]){_0x217a1b[_0x5eca('0x38')]=_[_0x5eca('0x39')](_0x217a1b['where'],{'$or':_[_0x5eca('0x27')](_0x341c64,function(_0x5dff10){if(_0x5dff10[_0x5eca('0x3a')]!==_0x5eca('0x3b')){var _0x547638={};_0x547638[_0x5dff10[_0x5eca('0x26')]]={'$like':'%'+_0x22b4a9[_0x5eca('0x2d')][_0x5eca('0x37')]+'%'};return _0x547638;}})});}_0x217a1b=_[_0x5eca('0x39')]({},_0x217a1b,_0x22b4a9[_0x5eca('0x3c')]);var _0x1c153c={'where':_0x217a1b[_0x5eca('0x38')]};return db[_0x5eca('0x28')][_0x5eca('0x1e')](_0x1c153c)['then'](function(_0x6e23c4){_0x56238f[_0x5eca('0x1e')]=_0x6e23c4;if(_0x22b4a9[_0x5eca('0x2d')][_0x5eca('0x3d')]){_0x217a1b[_0x5eca('0x3e')]=[{'all':!![]}];}return db[_0x5eca('0x28')][_0x5eca('0x3f')](_0x217a1b);})[_0x5eca('0x23')](function(_0x2d5cfd){_0x56238f[_0x5eca('0x40')]=_0x2d5cfd;return _0x56238f;})['then'](respondWithFilteredResult(_0x26b4d2,_0x217a1b))['catch'](handleError(_0x26b4d2,null));};exports['show']=function(_0x457886,_0x3fafb4){var _0x1bf810={'raw':![],'where':{'id':_0x457886[_0x5eca('0x41')]['id']}},_0x52a821={};_0x52a821[_0x5eca('0x2c')]=_[_0x5eca('0x42')](db[_0x5eca('0x28')][_0x5eca('0x29')]);_0x52a821['query']=_[_0x5eca('0x42')](_0x457886[_0x5eca('0x2d')]);_0x52a821['filters']=_[_0x5eca('0x2e')](_0x52a821[_0x5eca('0x2c')],_0x52a821['query']);_0x1bf810[_0x5eca('0x30')]=_[_0x5eca('0x2e')](_0x52a821[_0x5eca('0x2c')],qs[_0x5eca('0x2f')](_0x457886[_0x5eca('0x2d')][_0x5eca('0x2f')]));_0x1bf810[_0x5eca('0x30')]=_0x1bf810[_0x5eca('0x30')]['length']?_0x1bf810['attributes']:_0x52a821[_0x5eca('0x2c')];if(_0x457886[_0x5eca('0x2d')][_0x5eca('0x3d')]){_0x1bf810[_0x5eca('0x3e')]=[{'all':!![]}];}_0x1bf810=_['merge']({},_0x1bf810,_0x457886[_0x5eca('0x3c')]);return db['ZohoAccount'][_0x5eca('0x43')](_0x1bf810)['then'](handleEntityNotFound(_0x3fafb4,null))[_0x5eca('0x23')](respondWithResult(_0x3fafb4,null))[_0x5eca('0x44')](handleError(_0x3fafb4,null));};exports[_0x5eca('0x45')]=function(_0x715233,_0x101fa6){return db[_0x5eca('0x28')][_0x5eca('0x45')](_0x715233[_0x5eca('0x46')],{})['then'](respondWithResult(_0x101fa6,0xc9))[_0x5eca('0x44')](handleError(_0x101fa6,null));};exports[_0x5eca('0x22')]=function(_0x2ff2c8,_0x286cc2){if(_0x2ff2c8['body']['id']){delete _0x2ff2c8['body']['id'];}return db[_0x5eca('0x28')]['find']({'where':{'id':_0x2ff2c8['params']['id']}})[_0x5eca('0x23')](handleEntityNotFound(_0x286cc2,null))[_0x5eca('0x23')](saveUpdates(_0x2ff2c8['body'],null))[_0x5eca('0x23')](respondWithResult(_0x286cc2,null))['catch'](handleError(_0x286cc2,null));};exports[_0x5eca('0x24')]=function(_0x35f0b9,_0x186276){return db[_0x5eca('0x28')][_0x5eca('0x43')]({'where':{'id':_0x35f0b9[_0x5eca('0x41')]['id']}})[_0x5eca('0x23')](handleEntityNotFound(_0x186276,null))[_0x5eca('0x23')](removeEntity(_0x186276,null))[_0x5eca('0x44')](handleError(_0x186276,null));};exports[_0x5eca('0x47')]=function(_0x5345e2,_0x3232bc,_0x2fca36){var _0x3950cd={};var _0x1bb9e4={};var _0x443d29;var _0x353498;return db[_0x5eca('0x28')][_0x5eca('0x48')]({'where':{'id':_0x5345e2['params']['id']}})[_0x5eca('0x23')](handleEntityNotFound(_0x3232bc,null))[_0x5eca('0x23')](function(_0x349959){if(_0x349959){_0x443d29=_0x349959;_0x1bb9e4[_0x5eca('0x2c')]=_[_0x5eca('0x42')](db[_0x5eca('0x49')][_0x5eca('0x29')]);_0x1bb9e4[_0x5eca('0x2d')]=_[_0x5eca('0x42')](_0x5345e2[_0x5eca('0x2d')]);_0x1bb9e4[_0x5eca('0x36')]=_[_0x5eca('0x2e')](_0x1bb9e4[_0x5eca('0x2c')],_0x1bb9e4[_0x5eca('0x2d')]);_0x3950cd['attributes']=_[_0x5eca('0x2e')](_0x1bb9e4[_0x5eca('0x2c')],qs[_0x5eca('0x2f')](_0x5345e2[_0x5eca('0x2d')][_0x5eca('0x2f')]));_0x3950cd[_0x5eca('0x30')]=_0x3950cd[_0x5eca('0x30')][_0x5eca('0x31')]?_0x3950cd[_0x5eca('0x30')]:_0x1bb9e4[_0x5eca('0x2c')];_0x3950cd[_0x5eca('0x34')]=qs[_0x5eca('0x35')](_0x5345e2[_0x5eca('0x2d')][_0x5eca('0x35')]);_0x3950cd[_0x5eca('0x38')]=qs[_0x5eca('0x36')](_[_0x5eca('0x4a')](_0x5345e2[_0x5eca('0x2d')],_0x1bb9e4['filters']));if(_0x5345e2[_0x5eca('0x2d')][_0x5eca('0x37')]){_0x3950cd[_0x5eca('0x38')]=_['merge'](_0x3950cd[_0x5eca('0x38')],{'$or':_[_0x5eca('0x27')](_0x3950cd['attributes'],function(_0x33ab00){var _0x11551f={};_0x11551f[_0x33ab00]={'$like':'%'+_0x5345e2['query']['filter']+'%'};return _0x11551f;})});}_0x3950cd=_['merge']({},_0x3950cd,_0x5345e2[_0x5eca('0x3c')]);return _0x443d29['getConfigurations'](_0x3950cd);}})[_0x5eca('0x23')](function(_0x2487fc){if(_0x2487fc){_0x353498=_0x2487fc[_0x5eca('0x31')];if(!_0x5345e2[_0x5eca('0x2d')]['hasOwnProperty'](_0x5eca('0x33'))){_0x3950cd[_0x5eca('0x1c')]=qs[_0x5eca('0x1c')](_0x5345e2[_0x5eca('0x2d')][_0x5eca('0x1c')]);_0x3950cd[_0x5eca('0x1b')]=qs[_0x5eca('0x1b')](_0x5345e2[_0x5eca('0x2d')][_0x5eca('0x1b')]);}return _0x443d29[_0x5eca('0x47')](_0x3950cd);}})[_0x5eca('0x23')](function(_0x2f6bd4){if(_0x2f6bd4){return _0x2f6bd4?{'count':_0x353498,'rows':_0x2f6bd4}:null;}})[_0x5eca('0x23')](respondWithResult(_0x3232bc,null))[_0x5eca('0x44')](handleError(_0x3232bc,null));};exports[_0x5eca('0x4b')]=function(_0x373d7a,_0x4c3aa2,_0x5b5d83){if(_0x373d7a[_0x5eca('0x46')]['id']){delete _0x373d7a[_0x5eca('0x46')]['id'];}return db[_0x5eca('0x28')]['findOne']({'where':{'id':_0x373d7a[_0x5eca('0x41')]['id']}})[_0x5eca('0x23')](handleEntityNotFound(_0x4c3aa2,null))['then'](function(_0x2ba45e){if(_0x2ba45e){_0x373d7a[_0x5eca('0x46')][_0x5eca('0x4c')]=_0x2ba45e['id'];_0x373d7a[_0x5eca('0x46')][_0x5eca('0x4d')]=integrations['getSubjects'](_0x373d7a[_0x5eca('0x46')][_0x5eca('0x4e')],_0x373d7a[_0x5eca('0x46')][_0x5eca('0x3a')]);_0x373d7a[_0x5eca('0x46')][_0x5eca('0x4f')]=integrations[_0x5eca('0x50')](_0x373d7a['body'][_0x5eca('0x4e')],_0x373d7a[_0x5eca('0x46')][_0x5eca('0x3a')]);return db[_0x5eca('0x49')][_0x5eca('0x45')](_0x373d7a[_0x5eca('0x46')],{'include':[{'model':db[_0x5eca('0x51')],'as':_0x5eca('0x4d')},{'model':db[_0x5eca('0x51')],'as':_0x5eca('0x4f')}]});}return null;})[_0x5eca('0x23')](respondWithResult(_0x4c3aa2,null))[_0x5eca('0x44')](handleError(_0x4c3aa2,null));};function getAccessToken(_0x866510){return new Promise(function(_0x4fc79b,_0x39d31e){var _0x40ddfa;switch(_0x866510[_0x5eca('0x52')]){case'US':_0x40ddfa='https://accounts.zoho.com';break;case'AU':_0x40ddfa='https://accounts.zoho.com.au';break;case'EU':_0x40ddfa=_0x5eca('0x53');break;case'IN':_0x40ddfa=_0x5eca('0x54');break;case'CN':_0x40ddfa=_0x5eca('0x55');break;default:_0x40ddfa='https://accounts.zoho.eu';break;}var _0x1aaab9={'method':_0x5eca('0x56'),'uri':_0x40ddfa+'/oauth/v2/token','qs':{'refresh_token':_0x866510['refreshToken'],'client_id':_0x866510[_0x5eca('0x57')],'client_secret':_0x866510[_0x5eca('0x58')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1aaab9)[_0x5eca('0x23')](function(_0x5baf60){if(_0x5baf60[_0x5eca('0x59')]){_0x4fc79b(_0x5baf60['access_token']);}else{_0x39d31e(_0x5eca('0x5a'));}})[_0x5eca('0x44')](function(_0x28ca47){_0x39d31e(_0x28ca47);});});}exports[_0x5eca('0x5b')]=function(_0x334781,_0x14774b,_0x3ab469){var _0xd7df43,_0x38c6eb,_0x412e09,_0x264042,_0xb2103f;return db[_0x5eca('0x28')]['findOne']({'where':{'id':_0x334781['params']['id']},'attributes':['id',_0x5eca('0x5c'),_0x5eca('0x52'),'clientId',_0x5eca('0x58'),_0x5eca('0x5d'),_0x5eca('0x5e'),_0x5eca('0x5f')]})['then'](handleEntityNotFound(_0x14774b,null))[_0x5eca('0x23')](function(_0x37cd3d){_0xb2103f=_0x37cd3d;_0xd7df43=_0xb2103f[_0x5eca('0x5c')];_0x38c6eb=_0xd7df43==='zoho.eu'?'eu':'com';_0x412e09=_0xb2103f['serverUrl'];var _0x794527=_0x412e09['slice'](-0x1);if(_0x794527==='/'||_0x794527==='\x5c'||_0x794527===':'){_0x412e09=_0x412e09[_0x5eca('0x60')](0x0,_0x412e09[_0x5eca('0x61')](_0x794527));}if(!_0xb2103f[_0x5eca('0x5f')]){throw new Error(_0x5eca('0x62'));}return getAccessToken(_0xb2103f);})[_0x5eca('0x23')](function(_0x686b0e){if(_0x686b0e){return rp({'method':_0x5eca('0x63'),'uri':util[_0x5eca('0x64')](_0x5eca('0x65'),_0x38c6eb),'qs':{'module':'Calls'},'headers':{'Authorization':_0x5eca('0x66')+_0x686b0e},'json':!![]});}})[_0x5eca('0x23')](function(_0x47fc4e){if(_0x47fc4e){if(_0x47fc4e['response']&&_0x47fc4e[_0x5eca('0x67')]['error']){throw new Error(_0x47fc4e[_0x5eca('0x67')][_0x5eca('0x25')][_0x5eca('0x68')]);}var _0x14b59a=[];var _0x43b732=[];var _0xf26d55=[_0x5eca('0x69'),_0x5eca('0x6a'),'Description',_0x5eca('0x6b'),_0x5eca('0x6c'),_0x5eca('0x6d'),_0x5eca('0x6e'),_0x5eca('0x6f')];_0x43b732=_[_0x5eca('0x70')](_0x47fc4e['fields'],function(_0x372f98){return _0xf26d55[_0x5eca('0x71')](_0x372f98[_0x5eca('0x72')]);});for(var _0x555227=0x0;_0x555227<_0x43b732[_0x5eca('0x31')];_0x555227++){if(_0x43b732[_0x555227][_0x5eca('0x73')]===![]){_0x14b59a[_0x5eca('0x74')]({'id':_0x43b732[_0x555227]['id'],'name':_0x43b732[_0x555227]['display_label'],'custom':_0x43b732[_0x555227][_0x5eca('0x75')],'options':_0x43b732[_0x555227]['data_type']===_0x5eca('0x76')&&_0x43b732[_0x555227][_0x5eca('0x77')][_0x5eca('0x31')]>-0x1?_[_0x5eca('0x27')](_0x43b732[_0x555227][_0x5eca('0x77')],function(_0x270546){return{'name':_0x270546,'value':_0x270546};}):[]});}}return{'count':_0x14b59a[_0x5eca('0x31')],'rows':_0x14b59a};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x14774b,null))[_0x5eca('0x44')](function(_0x3c46d9){var _0x12405a=_0x334781['query'][_0x5eca('0x78')]?0x1f4:_0x3c46d9[_0x5eca('0x79')]||0x1f4;logger[_0x5eca('0x25')](_0x5eca('0x7a'),_0x5eca('0x5b'),_0x12405a,JSON['stringify'](_0x3c46d9));delete _0x3c46d9[_0x5eca('0x26')];if(_0x12405a===0x191){_0x12405a=0x190;}_0x14774b[_0x5eca('0x19')](_0x12405a)[_0x5eca('0x7b')](_0x334781['query'][_0x5eca('0x78')]?{'message':_0x5eca('0x7c'),'statusCode':_0x3c46d9[_0x5eca('0x79')]}:_0x3c46d9);});}; \ No newline at end of file +var _0x533d=['VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','findOne','ZohoConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','limit','order','where','pick','filter','merge','type'];(function(_0x377ef2,_0xa85fe6){var _0x3ab87f=function(_0x23a52f){while(--_0x23a52f){_0x377ef2['push'](_0x377ef2['shift']());}};_0x3ab87f(++_0xa85fe6);}(_0x533d,0xc5));var _0xd533=function(_0x5811c9,_0x53aa8c){_0x5811c9=_0x5811c9-0x0;var _0x353260=_0x533d[_0x5811c9];return _0x353260;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd533('0x0'));var zipdir=require(_0xd533('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd533('0x2'));var moment=require(_0xd533('0x3'));var BPromise=require(_0xd533('0x4'));var Mustache=require('mustache');var util=require(_0xd533('0x5'));var path=require(_0xd533('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd533('0x7'));var _=require(_0xd533('0x8'));var squel=require(_0xd533('0x9'));var crypto=require(_0xd533('0xa'));var jsforce=require(_0xd533('0xb'));var deskjs=require(_0xd533('0xc'));var toCsv=require(_0xd533('0xd'));var querystring=require(_0xd533('0xe'));var Papa=require('papaparse');var Redis=require(_0xd533('0xf'));var authService=require(_0xd533('0x10'));var qs=require(_0xd533('0x11'));var as=require(_0xd533('0x12'));var hardwareService=require(_0xd533('0x13'));var logger=require(_0xd533('0x14'))(_0xd533('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd533('0x16'));var db=require(_0xd533('0x17'))['db'];var integrations=require(_0xd533('0x18'));function respondWithStatusCode(_0x570db8,_0x2805b3){_0x2805b3=_0x2805b3||0xcc;return function(_0x266ca0){if(_0x266ca0){return _0x570db8[_0xd533('0x19')](_0x2805b3);}return _0x570db8[_0xd533('0x1a')](_0x2805b3)[_0xd533('0x1b')]();};}function respondWithResult(_0x199b4f,_0x4fbaf1){_0x4fbaf1=_0x4fbaf1||0xc8;return function(_0x4faa0f){if(_0x4faa0f){return _0x199b4f[_0xd533('0x1a')](_0x4fbaf1)[_0xd533('0x1c')](_0x4faa0f);}};}function respondWithFilteredResult(_0x20bb90,_0x5d6297){return function(_0x42a9a2){if(_0x42a9a2){var _0x30aa3a=typeof _0x5d6297[_0xd533('0x1d')]===_0xd533('0x1e')&&typeof _0x5d6297['limit']==='undefined';var _0x43e8d7=_0x42a9a2[_0xd533('0x1f')];var _0x46e90f=_0x30aa3a?0x0:_0x5d6297[_0xd533('0x1d')];var _0x15e3c4=_0x30aa3a?_0x42a9a2[_0xd533('0x1f')]:_0x5d6297[_0xd533('0x1d')]+_0x5d6297['limit'];var _0x102a0f;if(_0x15e3c4>=_0x43e8d7){_0x15e3c4=_0x43e8d7;_0x102a0f=0xc8;}else{_0x102a0f=0xce;}_0x20bb90[_0xd533('0x1a')](_0x102a0f);return _0x20bb90[_0xd533('0x20')](_0xd533('0x21'),_0x46e90f+'-'+_0x15e3c4+'/'+_0x43e8d7)[_0xd533('0x1c')](_0x42a9a2);}return null;};}function patchUpdates(_0x372951){return function(_0x45f1b2){try{jsonpatch[_0xd533('0x22')](_0x45f1b2,_0x372951,!![]);}catch(_0x17f440){return BPromise[_0xd533('0x23')](_0x17f440);}return _0x45f1b2[_0xd533('0x24')]();};}function saveUpdates(_0x5c8474,_0x38949b){return function(_0x1e41e6){if(_0x1e41e6){return _0x1e41e6[_0xd533('0x25')](_0x5c8474)[_0xd533('0x26')](function(_0x1463a2){return _0x1463a2;});}return null;};}function removeEntity(_0x3238a1,_0x3edc50){return function(_0x479b39){if(_0x479b39){return _0x479b39[_0xd533('0x27')]()[_0xd533('0x26')](function(){_0x3238a1[_0xd533('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1568f3,_0x47e8ec){return function(_0x283068){if(!_0x283068){_0x1568f3['sendStatus'](0x194);}return _0x283068;};}function handleError(_0x474eb5,_0x34732d){_0x34732d=_0x34732d||0x1f4;return function(_0x5991af){logger[_0xd533('0x28')](_0x5991af['stack']);if(_0x5991af[_0xd533('0x29')]){delete _0x5991af[_0xd533('0x29')];}_0x474eb5[_0xd533('0x1a')](_0x34732d)[_0xd533('0x2a')](_0x5991af);};}exports[_0xd533('0x2b')]=function(_0x3a97dd,_0x4b7420){var _0x3f40fc={},_0x49b7af={},_0x131176={'count':0x0,'rows':[]};var _0x4e7b01=_[_0xd533('0x2c')](db[_0xd533('0x2d')][_0xd533('0x2e')],function(_0x3e1a2c){return{'name':_0x3e1a2c[_0xd533('0x2f')],'type':_0x3e1a2c['type'][_0xd533('0x30')]};});_0x49b7af['model']=_['map'](_0x4e7b01,_0xd533('0x29'));_0x49b7af[_0xd533('0x31')]=_[_0xd533('0x32')](_0x3a97dd[_0xd533('0x31')]);_0x49b7af[_0xd533('0x33')]=_['intersection'](_0x49b7af['model'],_0x49b7af[_0xd533('0x31')]);_0x3f40fc[_0xd533('0x34')]=_[_0xd533('0x35')](_0x49b7af[_0xd533('0x36')],qs['fields'](_0x3a97dd[_0xd533('0x31')][_0xd533('0x37')]));_0x3f40fc[_0xd533('0x34')]=_0x3f40fc['attributes'][_0xd533('0x38')]?_0x3f40fc['attributes']:_0x49b7af[_0xd533('0x36')];if(!_0x3a97dd[_0xd533('0x31')]['hasOwnProperty'](_0xd533('0x39'))){_0x3f40fc[_0xd533('0x3a')]=qs[_0xd533('0x3a')](_0x3a97dd[_0xd533('0x31')][_0xd533('0x3a')]);_0x3f40fc[_0xd533('0x1d')]=qs[_0xd533('0x1d')](_0x3a97dd['query'][_0xd533('0x1d')]);}_0x3f40fc[_0xd533('0x3b')]=qs['sort'](_0x3a97dd[_0xd533('0x31')]['sort']);_0x3f40fc[_0xd533('0x3c')]=qs['filters'](_[_0xd533('0x3d')](_0x3a97dd[_0xd533('0x31')],_0x49b7af[_0xd533('0x33')]),_0x4e7b01);if(_0x3a97dd[_0xd533('0x31')][_0xd533('0x3e')]){_0x3f40fc[_0xd533('0x3c')]=_[_0xd533('0x3f')](_0x3f40fc[_0xd533('0x3c')],{'$or':_[_0xd533('0x2c')](_0x4e7b01,function(_0x59149f){if(_0x59149f[_0xd533('0x40')]!==_0xd533('0x41')){var _0x12b6c7={};_0x12b6c7[_0x59149f[_0xd533('0x29')]]={'$like':'%'+_0x3a97dd[_0xd533('0x31')][_0xd533('0x3e')]+'%'};return _0x12b6c7;}})});}_0x3f40fc=_[_0xd533('0x3f')]({},_0x3f40fc,_0x3a97dd['options']);var _0x42f852={'where':_0x3f40fc[_0xd533('0x3c')]};return db[_0xd533('0x2d')][_0xd533('0x1f')](_0x42f852)['then'](function(_0x5c530a){_0x131176[_0xd533('0x1f')]=_0x5c530a;if(_0x3a97dd[_0xd533('0x31')][_0xd533('0x42')]){_0x3f40fc[_0xd533('0x43')]=[{'all':!![]}];}return db[_0xd533('0x2d')][_0xd533('0x44')](_0x3f40fc);})[_0xd533('0x26')](function(_0x481576){_0x131176['rows']=_0x481576;return _0x131176;})[_0xd533('0x26')](respondWithFilteredResult(_0x4b7420,_0x3f40fc))[_0xd533('0x45')](handleError(_0x4b7420,null));};exports[_0xd533('0x46')]=function(_0x5c52f0,_0x47cc1c){var _0x432d67={'raw':![],'where':{'id':_0x5c52f0[_0xd533('0x47')]['id']}},_0x830b86={};_0x830b86[_0xd533('0x36')]=_[_0xd533('0x32')](db[_0xd533('0x2d')][_0xd533('0x2e')]);_0x830b86[_0xd533('0x31')]=_['keys'](_0x5c52f0['query']);_0x830b86['filters']=_['intersection'](_0x830b86[_0xd533('0x36')],_0x830b86[_0xd533('0x31')]);_0x432d67['attributes']=_[_0xd533('0x35')](_0x830b86[_0xd533('0x36')],qs[_0xd533('0x37')](_0x5c52f0[_0xd533('0x31')][_0xd533('0x37')]));_0x432d67[_0xd533('0x34')]=_0x432d67[_0xd533('0x34')][_0xd533('0x38')]?_0x432d67[_0xd533('0x34')]:_0x830b86[_0xd533('0x36')];if(_0x5c52f0['query']['includeAll']){_0x432d67[_0xd533('0x43')]=[{'all':!![]}];}_0x432d67=_[_0xd533('0x3f')]({},_0x432d67,_0x5c52f0['options']);return db[_0xd533('0x2d')][_0xd533('0x48')](_0x432d67)[_0xd533('0x26')](handleEntityNotFound(_0x47cc1c,null))['then'](respondWithResult(_0x47cc1c,null))[_0xd533('0x45')](handleError(_0x47cc1c,null));};exports['create']=function(_0x695b31,_0x49d0b8){return db[_0xd533('0x2d')][_0xd533('0x49')](_0x695b31[_0xd533('0x4a')],{})[_0xd533('0x26')](respondWithResult(_0x49d0b8,0xc9))[_0xd533('0x45')](handleError(_0x49d0b8,null));};exports['update']=function(_0x2146dd,_0x4cf7e3){if(_0x2146dd[_0xd533('0x4a')]['id']){delete _0x2146dd[_0xd533('0x4a')]['id'];}return db['ZohoAccount'][_0xd533('0x48')]({'where':{'id':_0x2146dd[_0xd533('0x47')]['id']}})[_0xd533('0x26')](handleEntityNotFound(_0x4cf7e3,null))['then'](saveUpdates(_0x2146dd[_0xd533('0x4a')],null))['then'](respondWithResult(_0x4cf7e3,null))[_0xd533('0x45')](handleError(_0x4cf7e3,null));};exports['destroy']=function(_0x154b14,_0x37bf98){return db['ZohoAccount'][_0xd533('0x48')]({'where':{'id':_0x154b14[_0xd533('0x47')]['id']}})[_0xd533('0x26')](handleEntityNotFound(_0x37bf98,null))[_0xd533('0x26')](removeEntity(_0x37bf98,null))[_0xd533('0x45')](handleError(_0x37bf98,null));};exports['getConfigurations']=function(_0x36a63e,_0x84b232,_0x226ef1){var _0x592bb7={};var _0x3829c0={};var _0x1005fa;var _0x3fbe89;return db[_0xd533('0x2d')][_0xd533('0x4b')]({'where':{'id':_0x36a63e[_0xd533('0x47')]['id']}})[_0xd533('0x26')](handleEntityNotFound(_0x84b232,null))[_0xd533('0x26')](function(_0x32d034){if(_0x32d034){_0x1005fa=_0x32d034;_0x3829c0[_0xd533('0x36')]=_['keys'](db[_0xd533('0x4c')][_0xd533('0x2e')]);_0x3829c0[_0xd533('0x31')]=_[_0xd533('0x32')](_0x36a63e[_0xd533('0x31')]);_0x3829c0[_0xd533('0x33')]=_['intersection'](_0x3829c0[_0xd533('0x36')],_0x3829c0['query']);_0x592bb7[_0xd533('0x34')]=_[_0xd533('0x35')](_0x3829c0['model'],qs[_0xd533('0x37')](_0x36a63e[_0xd533('0x31')][_0xd533('0x37')]));_0x592bb7[_0xd533('0x34')]=_0x592bb7[_0xd533('0x34')][_0xd533('0x38')]?_0x592bb7[_0xd533('0x34')]:_0x3829c0[_0xd533('0x36')];_0x592bb7[_0xd533('0x3b')]=qs['sort'](_0x36a63e[_0xd533('0x31')][_0xd533('0x4d')]);_0x592bb7[_0xd533('0x3c')]=qs[_0xd533('0x33')](_['pick'](_0x36a63e['query'],_0x3829c0[_0xd533('0x33')]));if(_0x36a63e[_0xd533('0x31')][_0xd533('0x3e')]){_0x592bb7[_0xd533('0x3c')]=_[_0xd533('0x3f')](_0x592bb7['where'],{'$or':_['map'](_0x592bb7[_0xd533('0x34')],function(_0x1a28c7){var _0x1da70b={};_0x1da70b[_0x1a28c7]={'$like':'%'+_0x36a63e[_0xd533('0x31')][_0xd533('0x3e')]+'%'};return _0x1da70b;})});}_0x592bb7=_['merge']({},_0x592bb7,_0x36a63e['options']);return _0x1005fa['getConfigurations'](_0x592bb7);}})[_0xd533('0x26')](function(_0x16c612){if(_0x16c612){_0x3fbe89=_0x16c612[_0xd533('0x38')];if(!_0x36a63e[_0xd533('0x31')][_0xd533('0x4e')](_0xd533('0x39'))){_0x592bb7[_0xd533('0x3a')]=qs[_0xd533('0x3a')](_0x36a63e[_0xd533('0x31')][_0xd533('0x3a')]);_0x592bb7['offset']=qs[_0xd533('0x1d')](_0x36a63e[_0xd533('0x31')][_0xd533('0x1d')]);}return _0x1005fa['getConfigurations'](_0x592bb7);}})[_0xd533('0x26')](function(_0x39347f){if(_0x39347f){return _0x39347f?{'count':_0x3fbe89,'rows':_0x39347f}:null;}})[_0xd533('0x26')](respondWithResult(_0x84b232,null))['catch'](handleError(_0x84b232,null));};exports[_0xd533('0x4f')]=function(_0x546ebf,_0x15c63e,_0x40c3dc){if(_0x546ebf[_0xd533('0x4a')]['id']){delete _0x546ebf[_0xd533('0x4a')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x546ebf[_0xd533('0x47')]['id']}})[_0xd533('0x26')](handleEntityNotFound(_0x15c63e,null))[_0xd533('0x26')](function(_0x39a224){if(_0x39a224){_0x546ebf[_0xd533('0x4a')][_0xd533('0x50')]=_0x39a224['id'];_0x546ebf[_0xd533('0x4a')][_0xd533('0x51')]=integrations[_0xd533('0x52')](_0x546ebf[_0xd533('0x4a')][_0xd533('0x53')],_0x546ebf[_0xd533('0x4a')][_0xd533('0x40')]);_0x546ebf[_0xd533('0x4a')][_0xd533('0x54')]=integrations['getDescriptions'](_0x546ebf['body'][_0xd533('0x53')],_0x546ebf[_0xd533('0x4a')][_0xd533('0x40')]);return db[_0xd533('0x4c')][_0xd533('0x49')](_0x546ebf['body'],{'include':[{'model':db[_0xd533('0x55')],'as':_0xd533('0x51')},{'model':db[_0xd533('0x55')],'as':_0xd533('0x54')}]});}return null;})[_0xd533('0x26')](respondWithResult(_0x15c63e,null))[_0xd533('0x45')](handleError(_0x15c63e,null));};function getAccessToken(_0x515c02){return new Promise(function(_0x27be39,_0x579d4e){var _0x1af5ba;switch(_0x515c02[_0xd533('0x56')]){case'US':_0x1af5ba=_0xd533('0x57');break;case'AU':_0x1af5ba='https://accounts.zoho.com.au';break;case'EU':_0x1af5ba='https://accounts.zoho.eu';break;case'IN':_0x1af5ba=_0xd533('0x58');break;case'CN':_0x1af5ba='https://accounts.zoho.com.cn';break;default:_0x1af5ba=_0xd533('0x59');break;}var _0x5aa5e6={'method':_0xd533('0x5a'),'uri':_0x1af5ba+_0xd533('0x5b'),'qs':{'refresh_token':_0x515c02[_0xd533('0x5c')],'client_id':_0x515c02[_0xd533('0x5d')],'client_secret':_0x515c02['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5aa5e6)['then'](function(_0x441c27){if(_0x441c27[_0xd533('0x5e')]){_0x27be39(_0x441c27[_0xd533('0x5e')]);}else{_0x579d4e(_0xd533('0x5f'));}})[_0xd533('0x45')](function(_0x67439e){_0x579d4e(_0x67439e);});});}exports[_0xd533('0x60')]=function(_0x4604d3,_0x314433,_0x3e7f7a){var _0x43d15d,_0x4a7e2d,_0x4f71d0,_0x1cb561,_0xf00bbb;return db['ZohoAccount']['findOne']({'where':{'id':_0x4604d3[_0xd533('0x47')]['id']},'attributes':['id','host',_0xd533('0x56'),_0xd533('0x5d'),_0xd533('0x61'),'serverUrl','code',_0xd533('0x5c')]})['then'](handleEntityNotFound(_0x314433,null))[_0xd533('0x26')](function(_0x2e38ba){_0xf00bbb=_0x2e38ba;_0x43d15d=_0xf00bbb[_0xd533('0x62')];_0x4a7e2d=_0x43d15d===_0xd533('0x63')?'eu':_0xd533('0x64');_0x4f71d0=_0xf00bbb[_0xd533('0x65')];var _0x60a1c1=_0x4f71d0[_0xd533('0x66')](-0x1);if(_0x60a1c1==='/'||_0x60a1c1==='\x5c'||_0x60a1c1===':'){_0x4f71d0=_0x4f71d0[_0xd533('0x67')](0x0,_0x4f71d0[_0xd533('0x68')](_0x60a1c1));}if(!_0xf00bbb[_0xd533('0x5c')]){throw new Error(_0xd533('0x69'));}return getAccessToken(_0xf00bbb);})[_0xd533('0x26')](function(_0x296897){if(_0x296897){return rp({'method':_0xd533('0x6a'),'uri':util[_0xd533('0x6b')](_0xd533('0x6c'),_0x4a7e2d),'qs':{'module':_0xd533('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x296897},'json':!![]});}})[_0xd533('0x26')](function(_0x27c336){if(_0x27c336){if(_0x27c336['response']&&_0x27c336['response']['error']){throw new Error(_0x27c336[_0xd533('0x6e')][_0xd533('0x28')][_0xd533('0x6f')]);}var _0x10bc46=[];var _0x45306e=[];var _0x43037c=[_0xd533('0x70'),_0xd533('0x71'),'Description',_0xd533('0x72'),_0xd533('0x73'),_0xd533('0x74'),_0xd533('0x75'),_0xd533('0x76')];_0x45306e=_[_0xd533('0x77')](_0x27c336[_0xd533('0x37')],function(_0x3dcb2f){return _0x43037c[_0xd533('0x78')](_0x3dcb2f['api_name']);});for(var _0x2c2ac7=0x0;_0x2c2ac7<_0x45306e['length'];_0x2c2ac7++){if(_0x45306e[_0x2c2ac7]['system_mandatory']===![]){_0x10bc46[_0xd533('0x79')]({'id':_0x45306e[_0x2c2ac7]['id'],'name':_0x45306e[_0x2c2ac7][_0xd533('0x7a')],'custom':_0x45306e[_0x2c2ac7][_0xd533('0x7b')],'options':_0x45306e[_0x2c2ac7][_0xd533('0x7c')]==='picklist'&&_0x45306e[_0x2c2ac7]['pick_list_values'][_0xd533('0x38')]>-0x1?_[_0xd533('0x2c')](_0x45306e[_0x2c2ac7][_0xd533('0x7d')],function(_0x2abc44){return{'name':_0x2abc44,'value':_0x2abc44};}):[]});}}return{'count':_0x10bc46[_0xd533('0x38')],'rows':_0x10bc46};}else{return{'count':0x0,'rows':[]};}})[_0xd533('0x26')](respondWithResult(_0x314433,null))[_0xd533('0x45')](function(_0x232d8b){var _0x368a79=_0x4604d3['query']['test']?0x1f4:_0x232d8b[_0xd533('0x7e')]||0x1f4;logger[_0xd533('0x28')](_0xd533('0x7f'),_0xd533('0x60'),_0x368a79,JSON[_0xd533('0x80')](_0x232d8b));delete _0x232d8b['name'];if(_0x368a79===0x191){_0x368a79=0x190;}_0x314433['status'](_0x368a79)['send'](_0x4604d3[_0xd533('0x31')][_0xd533('0x81')]?{'message':_0xd533('0x82'),'statusCode':_0x232d8b[_0xd533('0x7e')]}:_0x232d8b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6064996..4d37676 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 _0xe336=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','https://accounts.zoho.com.au','catch'];(function(_0x1e8c4e,_0x4b6ba5){var _0x19088a=function(_0x33116a){while(--_0x33116a){_0x1e8c4e['push'](_0x1e8c4e['shift']());}};_0x19088a(++_0x4b6ba5);}(_0xe336,0x1b8));var _0x6e33=function(_0x231661,_0x188cb3){_0x231661=_0x231661-0x0;var _0x2d70c9=_0xe336[_0x231661];return _0x2d70c9;};'use strict';var _=require('lodash');var util=require(_0x6e33('0x0'));var logger=require(_0x6e33('0x1'))(_0x6e33('0x2'));var moment=require(_0x6e33('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e33('0x4'));var fs=require('fs');var path=require(_0x6e33('0x5'));var rimraf=require(_0x6e33('0x6'));var config=require(_0x6e33('0x7'));var attributes=require(_0x6e33('0x8'));var integrations=require(_0x6e33('0x9'));module[_0x6e33('0xa')]=function(_0x585e85,_0x126f7d){return _0x585e85[_0x6e33('0xb')](_0x6e33('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15b818,_0x35596d,_0x51a86b){if(_0x15b818[_0x6e33('0xd')](_0x6e33('0xe'))||_0x15b818[_0x6e33('0xd')](_0x6e33('0xf'))||_0x15b818['changed'](_0x6e33('0x10'))||_0x15b818['changed'](_0x6e33('0x11'))||_0x15b818['changed'](_0x6e33('0x12'))||_0x15b818[_0x6e33('0xd')]('host')){var _0x5f3f99,_0x4afc16;_0x5f3f99=_0x15b818[_0x6e33('0xf')];var _0x455482=_0x5f3f99[_0x6e33('0x13')](-0x1);if(_0x455482==='/'||_0x455482==='\x5c'||_0x455482===':'){_0x5f3f99=_0x5f3f99[_0x6e33('0x14')](0x0,_0x5f3f99[_0x6e33('0x15')](_0x455482));}switch(_0x15b818[_0x6e33('0xe')]){case'US':_0x4afc16=_0x6e33('0x16');break;case'AU':_0x4afc16='https://accounts.zoho.com.au';break;case'IN':_0x4afc16=_0x6e33('0x17');break;case'CN':_0x4afc16=_0x6e33('0x18');break;default:_0x4afc16=_0x6e33('0x19');break;}var _0x2634d3={'method':_0x6e33('0x1a'),'uri':_0x4afc16+_0x6e33('0x1b'),'form':{'grant_type':_0x6e33('0x1c'),'client_id':_0x15b818['clientId'],'client_secret':_0x15b818[_0x6e33('0x11')],'redirect_uri':_0x15b818['serverUrl'],'code':_0x15b818[_0x6e33('0x12')]},'headers':{'Content-Type':_0x6e33('0x1d')}};return rp(_0x2634d3)[_0x6e33('0x1e')](function(_0x38af61){var _0x343a85=JSON[_0x6e33('0x1f')](_0x38af61);if(_0x343a85[_0x6e33('0x20')]){_0x15b818[_0x6e33('0x21')]=_0x343a85[_0x6e33('0x20')];logger[_0x6e33('0x22')](util[_0x6e33('0x23')](_0x6e33('0x24'),_0x15b818[_0x6e33('0x25')],_0x15b818['id']));}else{logger[_0x6e33('0x26')](util[_0x6e33('0x23')](_0x6e33('0x27'),_0x15b818[_0x6e33('0x25')],_0x15b818['id']),util[_0x6e33('0x28')](_0x343a85,{'showHidden':![],'depth':null}));}return _0x51a86b(null,_0x35596d);})['catch'](function(_0x429282){logger[_0x6e33('0x26')](util[_0x6e33('0x23')](_0x6e33('0x27'),_0x15b818['name'],_0x15b818['id']),util[_0x6e33('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x51a86b(_0x429282);});}else{return _0x51a86b(null,_0x35596d);}},'beforeUpdate':function(_0x274aaa,_0x3d8b40,_0x55d3fc){if(_0x274aaa[_0x6e33('0xd')](_0x6e33('0xe'))||_0x274aaa['changed'](_0x6e33('0xf'))||_0x274aaa[_0x6e33('0xd')](_0x6e33('0x10'))||_0x274aaa[_0x6e33('0xd')](_0x6e33('0x11'))||_0x274aaa[_0x6e33('0xd')](_0x6e33('0x12'))||_0x274aaa[_0x6e33('0xd')](_0x6e33('0x29'))){var _0x467e7a,_0x5bbeb3;_0x467e7a=_0x274aaa['serverUrl'];var _0x2d4e16=_0x467e7a[_0x6e33('0x13')](-0x1);if(_0x2d4e16==='/'||_0x2d4e16==='\x5c'||_0x2d4e16===':'){_0x467e7a=_0x467e7a[_0x6e33('0x14')](0x0,_0x467e7a['lastIndexOf'](_0x2d4e16));}switch(_0x274aaa['zone']){case'US':_0x5bbeb3=_0x6e33('0x16');break;case'AU':_0x5bbeb3=_0x6e33('0x2a');break;case'IN':_0x5bbeb3='https://accounts.zoho.in';break;case'CN':_0x5bbeb3=_0x6e33('0x18');break;default:_0x5bbeb3=_0x6e33('0x19');break;}var _0x262b72={'method':'POST','uri':_0x5bbeb3+_0x6e33('0x1b'),'form':{'grant_type':_0x6e33('0x1c'),'client_id':_0x274aaa[_0x6e33('0x10')],'client_secret':_0x274aaa[_0x6e33('0x11')],'redirect_uri':_0x274aaa[_0x6e33('0xf')],'code':_0x274aaa[_0x6e33('0x12')]},'headers':{'Content-Type':_0x6e33('0x1d')}};return rp(_0x262b72)[_0x6e33('0x1e')](function(_0x19eb38){var _0x418d6e=JSON[_0x6e33('0x1f')](_0x19eb38);if(_0x418d6e[_0x6e33('0x20')]){_0x274aaa[_0x6e33('0x21')]=_0x418d6e[_0x6e33('0x20')];logger[_0x6e33('0x22')](util[_0x6e33('0x23')](_0x6e33('0x24'),_0x274aaa[_0x6e33('0x25')],_0x274aaa['id']));}else{logger[_0x6e33('0x26')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x274aaa['name'],_0x274aaa['id']),util[_0x6e33('0x28')](_0x418d6e,{'showHidden':![],'depth':null}));}return _0x55d3fc(null,_0x3d8b40);})[_0x6e33('0x2b')](function(_0x1c34bd){logger[_0x6e33('0x26')](util[_0x6e33('0x23')](_0x6e33('0x27'),_0x274aaa[_0x6e33('0x25')],_0x274aaa['id']),util[_0x6e33('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x55d3fc(_0x1c34bd);});}else{return _0x55d3fc(null,_0x3d8b40);}}}});}; \ No newline at end of file +var _0x3e57=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','substring','https://accounts.zoho.in','https://accounts.zoho.eu','parse','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','lastIndexOf'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3e57,0x13c));var _0x73e5=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x3e57[_0x5ca5bc];return _0x26ca86;};'use strict';var _=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var logger=require(_0x73e5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x73e5('0x3'));var rp=require(_0x73e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73e5('0x5'));var config=require(_0x73e5('0x6'));var attributes=require(_0x73e5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x73e5('0x8')]=function(_0x759a5a,_0x4e8716){return _0x759a5a[_0x73e5('0x9')](_0x73e5('0xa'),attributes,{'tableName':_0x73e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x22ecb9,_0x54558c,_0xc21b5){if(_0x22ecb9[_0x73e5('0xc')](_0x73e5('0xd'))||_0x22ecb9[_0x73e5('0xc')](_0x73e5('0xe'))||_0x22ecb9[_0x73e5('0xc')](_0x73e5('0xf'))||_0x22ecb9[_0x73e5('0xc')](_0x73e5('0x10'))||_0x22ecb9['changed'](_0x73e5('0x11'))||_0x22ecb9[_0x73e5('0xc')]('host')){var _0x319550,_0x1f085c;_0x319550=_0x22ecb9[_0x73e5('0xe')];var _0x31ad5b=_0x319550[_0x73e5('0x12')](-0x1);if(_0x31ad5b==='/'||_0x31ad5b==='\x5c'||_0x31ad5b===':'){_0x319550=_0x319550['substring'](0x0,_0x319550[_0x73e5('0x13')](_0x31ad5b));}switch(_0x22ecb9[_0x73e5('0xd')]){case'US':_0x1f085c=_0x73e5('0x14');break;case'AU':_0x1f085c=_0x73e5('0x15');break;case'IN':_0x1f085c='https://accounts.zoho.in';break;case'CN':_0x1f085c=_0x73e5('0x16');break;default:_0x1f085c='https://accounts.zoho.eu';break;}var _0xcc7ca={'method':_0x73e5('0x17'),'uri':_0x1f085c+'/oauth/v2/token','form':{'grant_type':_0x73e5('0x18'),'client_id':_0x22ecb9[_0x73e5('0xf')],'client_secret':_0x22ecb9[_0x73e5('0x10')],'redirect_uri':_0x22ecb9[_0x73e5('0xe')],'code':_0x22ecb9[_0x73e5('0x11')]},'headers':{'Content-Type':_0x73e5('0x19')}};return rp(_0xcc7ca)[_0x73e5('0x1a')](function(_0x2f17c){var _0x4e7fd9=JSON['parse'](_0x2f17c);if(_0x4e7fd9[_0x73e5('0x1b')]){_0x22ecb9[_0x73e5('0x1c')]=_0x4e7fd9[_0x73e5('0x1b')];logger[_0x73e5('0x1d')](util['format'](_0x73e5('0x1e'),_0x22ecb9[_0x73e5('0x1f')],_0x22ecb9['id']));}else{logger[_0x73e5('0x20')](util[_0x73e5('0x21')](_0x73e5('0x22'),_0x22ecb9['name'],_0x22ecb9['id']),util[_0x73e5('0x23')](_0x4e7fd9,{'showHidden':![],'depth':null}));}return _0xc21b5(null,_0x54558c);})[_0x73e5('0x24')](function(_0x35f3a2){logger['error'](util[_0x73e5('0x21')](_0x73e5('0x22'),_0x22ecb9[_0x73e5('0x1f')],_0x22ecb9['id']),util[_0x73e5('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xc21b5(_0x35f3a2);});}else{return _0xc21b5(null,_0x54558c);}},'beforeUpdate':function(_0x5028a6,_0x2184a6,_0xefc2a4){if(_0x5028a6['changed'](_0x73e5('0xd'))||_0x5028a6['changed'](_0x73e5('0xe'))||_0x5028a6['changed']('clientId')||_0x5028a6[_0x73e5('0xc')]('clientSecret')||_0x5028a6['changed'](_0x73e5('0x11'))||_0x5028a6[_0x73e5('0xc')](_0x73e5('0x25'))){var _0x529cfb,_0x325a43;_0x529cfb=_0x5028a6[_0x73e5('0xe')];var _0x3bb65d=_0x529cfb[_0x73e5('0x12')](-0x1);if(_0x3bb65d==='/'||_0x3bb65d==='\x5c'||_0x3bb65d===':'){_0x529cfb=_0x529cfb[_0x73e5('0x26')](0x0,_0x529cfb[_0x73e5('0x13')](_0x3bb65d));}switch(_0x5028a6[_0x73e5('0xd')]){case'US':_0x325a43=_0x73e5('0x14');break;case'AU':_0x325a43=_0x73e5('0x15');break;case'IN':_0x325a43=_0x73e5('0x27');break;case'CN':_0x325a43='https://accounts.zoho.com.cn';break;default:_0x325a43=_0x73e5('0x28');break;}var _0x2636b9={'method':'POST','uri':_0x325a43+'/oauth/v2/token','form':{'grant_type':_0x73e5('0x18'),'client_id':_0x5028a6['clientId'],'client_secret':_0x5028a6[_0x73e5('0x10')],'redirect_uri':_0x5028a6[_0x73e5('0xe')],'code':_0x5028a6[_0x73e5('0x11')]},'headers':{'Content-Type':_0x73e5('0x19')}};return rp(_0x2636b9)['then'](function(_0x118d40){var _0x208f97=JSON[_0x73e5('0x29')](_0x118d40);if(_0x208f97[_0x73e5('0x1b')]){_0x5028a6['refreshToken']=_0x208f97[_0x73e5('0x1b')];logger[_0x73e5('0x1d')](util['format'](_0x73e5('0x1e'),_0x5028a6[_0x73e5('0x1f')],_0x5028a6['id']));}else{logger[_0x73e5('0x20')](util[_0x73e5('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5028a6[_0x73e5('0x1f')],_0x5028a6['id']),util[_0x73e5('0x23')](_0x208f97,{'showHidden':![],'depth':null}));}return _0xefc2a4(null,_0x2184a6);})[_0x73e5('0x24')](function(_0x36be6c){logger[_0x73e5('0x20')](util[_0x73e5('0x21')](_0x73e5('0x22'),_0x5028a6[_0x73e5('0x1f')],_0x5028a6['id']),util[_0x73e5('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xefc2a4(_0x36be6c);});}else{return _0xefc2a4(null,_0x2184a6);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c8264b3..ea1a19b 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 _0x7e74=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','map','include','model','where','ShowZohoAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4f4e9d,_0x343c05){var _0x4a8136=function(_0x48111a){while(--_0x48111a){_0x4f4e9d['push'](_0x4f4e9d['shift']());}};_0x4a8136(++_0x343c05);}(_0x7e74,0xbd));var _0x47e7=function(_0x1499d0,_0x3fdde1){_0x1499d0=_0x1499d0-0x0;var _0x176a26=_0x7e74[_0x1499d0];return _0x176a26;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rs=require(_0x47e7('0x3'));var fs=require('fs');var Redis=require(_0x47e7('0x4'));var db=require(_0x47e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e7('0x6'))(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var jayson=require(_0x47e7('0x9'));var client=jayson[_0x47e7('0xa')][_0x47e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d3e,_0x50fc6c,_0x29cd0a){return new BPromise(function(_0x4dc1ee,_0x14fe2f){return client[_0x47e7('0xc')](_0x412d3e,_0x29cd0a)[_0x47e7('0xd')](function(_0x2f66c0){logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,_0x47e7('0x10'));logger[_0x47e7('0x11')](_0x47e7('0x12'),_0x50fc6c,_0x47e7('0x10'),JSON[_0x47e7('0x13')](_0x2f66c0));if(_0x2f66c0[_0x47e7('0x14')]){if(_0x2f66c0[_0x47e7('0x14')]['code']===0x1f4){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0[_0x47e7('0x14')]['message']);return _0x14fe2f(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0['error'][_0x47e7('0x15')]);return _0x4dc1ee(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}else{logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,'request\x20sent');_0x4dc1ee(_0x2f66c0[_0x47e7('0x16')]['message']);}})[_0x47e7('0x17')](function(_0x8c320e){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x8c320e);_0x14fe2f(_0x8c320e);});});}exports[_0x47e7('0x18')]=function(_0x4429e6){var _0x6a3682=this;return new Promise(function(_0x42d837,_0x25d0f0){return db[_0x47e7('0x19')][_0x47e7('0x1a')]({'raw':_0x4429e6[_0x47e7('0x1b')]?_0x4429e6[_0x47e7('0x1b')][_0x47e7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4429e6['options']?_0x4429e6['options']['where']||null:null,'attributes':_0x4429e6['options']?_0x4429e6[_0x47e7('0x1b')][_0x47e7('0x1d')]||null:null,'limit':_0x4429e6[_0x47e7('0x1b')]?_0x4429e6[_0x47e7('0x1b')]['limit']||null:null,'include':_0x4429e6['options']?_0x4429e6[_0x47e7('0x1b')]['include']?_[_0x47e7('0x1e')](_0x4429e6['options'][_0x47e7('0x1f')],function(_0x8e7237){return{'model':db[_0x8e7237[_0x47e7('0x20')]],'as':_0x8e7237['as'],'attributes':_0x8e7237[_0x47e7('0x1d')],'include':_0x8e7237['include']?_['map'](_0x8e7237[_0x47e7('0x1f')],function(_0x25c0ca){return{'model':db[_0x25c0ca[_0x47e7('0x20')]],'as':_0x25c0ca['as'],'attributes':_0x25c0ca[_0x47e7('0x1d')],'include':_0x25c0ca['include']?_[_0x47e7('0x1e')](_0x25c0ca[_0x47e7('0x1f')],function(_0x28f414){return{'model':db[_0x28f414[_0x47e7('0x20')]],'as':_0x28f414['as'],'attributes':_0x28f414['attributes']};}):[]};}):[]};}):[]:[]})[_0x47e7('0xd')](function(_0x1bdb4c){logger[_0x47e7('0xe')](_0x47e7('0x18'),_0x4429e6);logger[_0x47e7('0x11')](_0x47e7('0x18'),_0x4429e6,JSON[_0x47e7('0x13')](_0x1bdb4c));_0x42d837(_0x1bdb4c);})[_0x47e7('0x17')](function(_0x172c80){logger[_0x47e7('0x14')](_0x47e7('0x18'),_0x172c80[_0x47e7('0x15')],_0x4429e6);_0x25d0f0(_0x6a3682[_0x47e7('0x14')](0x1f4,_0x172c80[_0x47e7('0x15')]));});});};exports['ShowZohoAccount']=function(_0x2bc66d){var _0x193a9a=this;return new Promise(function(_0x4078bd,_0x2f8f2d){return db[_0x47e7('0x19')]['find']({'raw':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d[_0x47e7('0x1b')][_0x47e7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d[_0x47e7('0x1b')][_0x47e7('0x21')]||null:null,'attributes':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d['options']['attributes']||null:null,'include':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d['options'][_0x47e7('0x1f')]?_[_0x47e7('0x1e')](_0x2bc66d['options'][_0x47e7('0x1f')],function(_0x228a56){return{'model':db[_0x228a56[_0x47e7('0x20')]],'as':_0x228a56['as'],'attributes':_0x228a56['attributes'],'include':_0x228a56['include']?_[_0x47e7('0x1e')](_0x228a56[_0x47e7('0x1f')],function(_0x4a4667){return{'model':db[_0x4a4667[_0x47e7('0x20')]],'as':_0x4a4667['as'],'attributes':_0x4a4667[_0x47e7('0x1d')],'include':_0x4a4667[_0x47e7('0x1f')]?_['map'](_0x4a4667[_0x47e7('0x1f')],function(_0x5711eb){return{'model':db[_0x5711eb[_0x47e7('0x20')]],'as':_0x5711eb['as'],'attributes':_0x5711eb[_0x47e7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47e7('0xd')](function(_0x47ecc9){logger[_0x47e7('0xe')](_0x47e7('0x22'),_0x2bc66d);logger[_0x47e7('0x11')](_0x47e7('0x22'),_0x2bc66d,JSON[_0x47e7('0x13')](_0x47ecc9));_0x4078bd(_0x47ecc9);})[_0x47e7('0x17')](function(_0x4a551a){logger['error'](_0x47e7('0x22'),_0x4a551a['message'],_0x2bc66d);_0x2f8f2d(_0x193a9a[_0x47e7('0x14')](0x1f4,_0x4a551a[_0x47e7('0x15')]));});});}; \ No newline at end of file +var _0x3e4d=['catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','map','include','model','ShowZohoAccount','info'];(function(_0x4d0faa,_0x160d02){var _0x58f65c=function(_0x54abfd){while(--_0x54abfd){_0x4d0faa['push'](_0x4d0faa['shift']());}};_0x58f65c(++_0x160d02);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x48e652,_0x4119dc){_0x48e652=_0x48e652-0x0;var _0x460aff=_0x3e4d[_0x48e652];return _0x460aff;};'use strict';var _=require(_0xd3e4('0x0'));var util=require('util');var moment=require(_0xd3e4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3e4('0x2'))['db'];var utils=require(_0xd3e4('0x3'));var logger=require(_0xd3e4('0x4'))('rpc');var config=require(_0xd3e4('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3e4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41d37a,_0x2b3e19,_0x381eeb){return new BPromise(function(_0xd1a5bf,_0x4b3954){return client[_0xd3e4('0x7')](_0x41d37a,_0x381eeb)[_0xd3e4('0x8')](function(_0x279f4c){logger['info'](_0xd3e4('0x9'),_0x2b3e19,_0xd3e4('0xa'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2b3e19,_0xd3e4('0xa'),JSON[_0xd3e4('0xb')](_0x279f4c));if(_0x279f4c[_0xd3e4('0xc')]){if(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xd')]===0x1f4){logger[_0xd3e4('0xc')](_0xd3e4('0x9'),_0x2b3e19,_0x279f4c['error'][_0xd3e4('0xe')]);return _0x4b3954(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xe')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2b3e19,_0x279f4c[_0xd3e4('0xc')]['message']);return _0xd1a5bf(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xe')]);}else{logger['info'](_0xd3e4('0x9'),_0x2b3e19,_0xd3e4('0xa'));_0xd1a5bf(_0x279f4c['result']['message']);}})['catch'](function(_0x353f84){logger[_0xd3e4('0xc')](_0xd3e4('0x9'),_0x2b3e19,_0x353f84);_0x4b3954(_0x353f84);});});}exports[_0xd3e4('0xf')]=function(_0xcf261b){var _0x48d143=this;return new Promise(function(_0x1a6d65,_0x210540){return db[_0xd3e4('0x10')]['findAll']({'raw':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x12')]===undefined?!![]:![]:!![],'where':_0xcf261b['options']?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x13')]||null:null,'attributes':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x14')]||null:null,'limit':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x15')]||null:null,'include':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')]['include']?_[_0xd3e4('0x16')](_0xcf261b['options'][_0xd3e4('0x17')],function(_0x4281e5){return{'model':db[_0x4281e5[_0xd3e4('0x18')]],'as':_0x4281e5['as'],'attributes':_0x4281e5[_0xd3e4('0x14')],'include':_0x4281e5[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x4281e5[_0xd3e4('0x17')],function(_0x4d24ab){return{'model':db[_0x4d24ab['model']],'as':_0x4d24ab['as'],'attributes':_0x4d24ab[_0xd3e4('0x14')],'include':_0x4d24ab[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x4d24ab[_0xd3e4('0x17')],function(_0x868020){return{'model':db[_0x868020[_0xd3e4('0x18')]],'as':_0x868020['as'],'attributes':_0x868020[_0xd3e4('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bfec1){logger['info'](_0xd3e4('0xf'),_0xcf261b);logger['debug'](_0xd3e4('0xf'),_0xcf261b,JSON[_0xd3e4('0xb')](_0x4bfec1));_0x1a6d65(_0x4bfec1);})['catch'](function(_0x250e70){logger[_0xd3e4('0xc')](_0xd3e4('0xf'),_0x250e70[_0xd3e4('0xe')],_0xcf261b);_0x210540(_0x48d143[_0xd3e4('0xc')](0x1f4,_0x250e70[_0xd3e4('0xe')]));});});};exports[_0xd3e4('0x19')]=function(_0x2f0571){var _0x2ba847=this;return new Promise(function(_0x5c384f,_0x5548ef){return db[_0xd3e4('0x10')]['find']({'raw':_0x2f0571[_0xd3e4('0x11')]?_0x2f0571['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0571['options']?_0x2f0571[_0xd3e4('0x11')][_0xd3e4('0x13')]||null:null,'attributes':_0x2f0571[_0xd3e4('0x11')]?_0x2f0571['options'][_0xd3e4('0x14')]||null:null,'include':_0x2f0571[_0xd3e4('0x11')]?_0x2f0571[_0xd3e4('0x11')][_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x2f0571[_0xd3e4('0x11')]['include'],function(_0x4affa6){return{'model':db[_0x4affa6[_0xd3e4('0x18')]],'as':_0x4affa6['as'],'attributes':_0x4affa6['attributes'],'include':_0x4affa6[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x4affa6[_0xd3e4('0x17')],function(_0x58c9b1){return{'model':db[_0x58c9b1[_0xd3e4('0x18')]],'as':_0x58c9b1['as'],'attributes':_0x58c9b1['attributes'],'include':_0x58c9b1[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x58c9b1[_0xd3e4('0x17')],function(_0x132bbe){return{'model':db[_0x132bbe['model']],'as':_0x132bbe['as'],'attributes':_0x132bbe[_0xd3e4('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf070fe){logger[_0xd3e4('0x1a')](_0xd3e4('0x19'),_0x2f0571);logger['debug'](_0xd3e4('0x19'),_0x2f0571,JSON[_0xd3e4('0xb')](_0xf070fe));_0x5c384f(_0xf070fe);})[_0xd3e4('0x1b')](function(_0x1eb466){logger[_0xd3e4('0xc')](_0xd3e4('0x19'),_0x1eb466[_0xd3e4('0xe')],_0x2f0571);_0x5548ef(_0x2ba847[_0xd3e4('0xc')](0x1f4,_0x1eb466[_0xd3e4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 097d8fa..269ce21 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 _0x3556=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','update','delete'];(function(_0x3e3fd8,_0x23e13e){var _0x2393c2=function(_0x49ed3b){while(--_0x49ed3b){_0x3e3fd8['push'](_0x3e3fd8['shift']());}};_0x2393c2(++_0x23e13e);}(_0x3556,0x176));var _0x6355=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3556[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x6355('0x0'));var util=require(_0x6355('0x1'));var path=require(_0x6355('0x2'));var timeout=require(_0x6355('0x3'));var express=require(_0x6355('0x4'));var router=express[_0x6355('0x5')]();var fs_extra=require(_0x6355('0x6'));var auth=require(_0x6355('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6355('0x8'));var controller=require(_0x6355('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6355('0xa')]);router[_0x6355('0xb')](_0x6355('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6355('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6355('0xd')]);router[_0x6355('0xb')](_0x6355('0xe'),auth[_0x6355('0xf')](),controller[_0x6355('0x10')]);router[_0x6355('0xb')](_0x6355('0x11'),auth[_0x6355('0xf')](),controller[_0x6355('0x12')]);router[_0x6355('0x13')]('/',auth[_0x6355('0xf')](),controller['create']);router['put'](_0x6355('0xc'),auth[_0x6355('0xf')](),controller[_0x6355('0x14')]);router[_0x6355('0x15')](_0x6355('0xc'),auth[_0x6355('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe240=['delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0xe240,0x87));var _0x0e24=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xe240[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require('multer');var util=require(_0x0e24('0x0'));var path=require(_0x0e24('0x1'));var timeout=require(_0x0e24('0x2'));var express=require('express');var router=express[_0x0e24('0x3')]();var fs_extra=require(_0x0e24('0x4'));var auth=require(_0x0e24('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e24('0x6'));router[_0x0e24('0x7')]('/',auth[_0x0e24('0x8')](),controller[_0x0e24('0x9')]);router[_0x0e24('0x7')](_0x0e24('0xa'),auth[_0x0e24('0x8')](),controller['show']);router[_0x0e24('0x7')]('/:id/fields',auth[_0x0e24('0x8')](),controller['getFields']);router['get'](_0x0e24('0xb'),auth[_0x0e24('0x8')](),controller['getSubjects']);router[_0x0e24('0x7')](_0x0e24('0xc'),auth[_0x0e24('0x8')](),controller[_0x0e24('0xd')]);router[_0x0e24('0xe')]('/',auth[_0x0e24('0x8')](),controller[_0x0e24('0xf')]);router['put'](_0x0e24('0xa'),auth[_0x0e24('0x8')](),controller[_0x0e24('0x10')]);router[_0x0e24('0x11')]('/:id',auth[_0x0e24('0x8')](),controller['destroy']);module[_0x0e24('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b9bfd19..64d39fb 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 _0x35c8=['STRING','ENUM','lead','contact_lead','contact','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x35c8,0xa6));var _0x835c=function(_0x2a0079,_0x80d52f){_0x2a0079=_0x2a0079-0x0;var _0x251fb2=_0x35c8[_0x2a0079];return _0x251fb2;};'use strict';var Sequelize=require(_0x835c('0x0'));module[_0x835c('0x1')]={'name':{'type':Sequelize[_0x835c('0x2')]},'moduleCreate':{'type':Sequelize[_0x835c('0x3')](_0x835c('0x4'),'contact','nothing'),'defaultValue':_0x835c('0x4')},'moduleSearch':{'type':Sequelize[_0x835c('0x3')](_0x835c('0x5'),_0x835c('0x6'),_0x835c('0x4')),'defaultValue':_0x835c('0x5')},'description':{'type':Sequelize[_0x835c('0x2')]}}; \ No newline at end of file +var _0xd348=['contact_lead','STRING','sequelize','ENUM','lead','contact','nothing'];(function(_0x2d0dbf,_0x55b18b){var _0x5f559d=function(_0x41d9ff){while(--_0x41d9ff){_0x2d0dbf['push'](_0x2d0dbf['shift']());}};_0x5f559d(++_0x55b18b);}(_0xd348,0xdb));var _0x8d34=function(_0x3f7c07,_0x38fb6e){_0x3f7c07=_0x3f7c07-0x0;var _0x4fe10d=_0xd348[_0x3f7c07];return _0x4fe10d;};'use strict';var Sequelize=require(_0x8d34('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0x2'),_0x8d34('0x3'),_0x8d34('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0x5'),_0x8d34('0x3'),_0x8d34('0x2')),'defaultValue':_0x8d34('0x5')},'description':{'type':Sequelize[_0x8d34('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9eacfe3..e5163cb 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 _0x1ada=['findAll','rows','catch','show','params','find','create','update','body','getFields','findOne','ZohoField','rawAttributes','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','ZohoConfiguration','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include'];(function(_0x1b5bf6,_0x2e1208){var _0x4fc601=function(_0x3c159e){while(--_0x3c159e){_0x1b5bf6['push'](_0x1b5bf6['shift']());}};_0x4fc601(++_0x2e1208);}(_0x1ada,0xb6));var _0xa1ad=function(_0x7c569d,_0x3680b5){_0x7c569d=_0x7c569d-0x0;var _0xe180e8=_0x1ada[_0x7c569d];return _0xe180e8;};'use strict';var emlformat=require(_0xa1ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1ad('0x1'));var jsonpatch=require(_0xa1ad('0x2'));var rp=require(_0xa1ad('0x3'));var moment=require(_0xa1ad('0x4'));var BPromise=require(_0xa1ad('0x5'));var Mustache=require(_0xa1ad('0x6'));var util=require(_0xa1ad('0x7'));var path=require('path');var sox=require(_0xa1ad('0x8'));var csv=require(_0xa1ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1ad('0xa'));var _=require(_0xa1ad('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa1ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa1ad('0xd'));var Papa=require(_0xa1ad('0xe'));var Redis=require(_0xa1ad('0xf'));var authService=require(_0xa1ad('0x10'));var qs=require(_0xa1ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1ad('0x12'));var logger=require(_0xa1ad('0x13'))(_0xa1ad('0x14'));var utils=require(_0xa1ad('0x15'));var config=require(_0xa1ad('0x16'));var licenseUtil=require(_0xa1ad('0x17'));var db=require(_0xa1ad('0x18'))['db'];function respondWithStatusCode(_0x5280cd,_0x293082){_0x293082=_0x293082||0xcc;return function(_0x57a323){if(_0x57a323){return _0x5280cd[_0xa1ad('0x19')](_0x293082);}return _0x5280cd['status'](_0x293082)[_0xa1ad('0x1a')]();};}function respondWithResult(_0x315c01,_0x9367b8){_0x9367b8=_0x9367b8||0xc8;return function(_0xe59d31){if(_0xe59d31){return _0x315c01[_0xa1ad('0x1b')](_0x9367b8)[_0xa1ad('0x1c')](_0xe59d31);}};}function respondWithFilteredResult(_0x597722,_0x4c5cd8){return function(_0x51b648){if(_0x51b648){var _0x4c72b7=typeof _0x4c5cd8[_0xa1ad('0x1d')]===_0xa1ad('0x1e')&&typeof _0x4c5cd8[_0xa1ad('0x1f')]===_0xa1ad('0x1e');var _0x5d4dfa=_0x51b648[_0xa1ad('0x20')];var _0x51de46=_0x4c72b7?0x0:_0x4c5cd8[_0xa1ad('0x1d')];var _0x32ab2c=_0x4c72b7?_0x51b648[_0xa1ad('0x20')]:_0x4c5cd8[_0xa1ad('0x1d')]+_0x4c5cd8[_0xa1ad('0x1f')];var _0x7271f6;if(_0x32ab2c>=_0x5d4dfa){_0x32ab2c=_0x5d4dfa;_0x7271f6=0xc8;}else{_0x7271f6=0xce;}_0x597722[_0xa1ad('0x1b')](_0x7271f6);return _0x597722[_0xa1ad('0x21')](_0xa1ad('0x22'),_0x51de46+'-'+_0x32ab2c+'/'+_0x5d4dfa)[_0xa1ad('0x1c')](_0x51b648);}return null;};}function patchUpdates(_0x143ba9){return function(_0x2de0b9){try{jsonpatch[_0xa1ad('0x23')](_0x2de0b9,_0x143ba9,!![]);}catch(_0x4bbdc4){return BPromise[_0xa1ad('0x24')](_0x4bbdc4);}return _0x2de0b9[_0xa1ad('0x25')]();};}function saveUpdates(_0x4d6dfe,_0x2e9ae0){return function(_0x106ec9){if(_0x106ec9){return _0x106ec9['update'](_0x4d6dfe)['then'](function(_0x1a1994){return _0x1a1994;});}return null;};}function removeEntity(_0x37e7c9,_0x3b2ce2){return function(_0x20ea98){if(_0x20ea98){return _0x20ea98[_0xa1ad('0x26')]()[_0xa1ad('0x27')](function(){_0x37e7c9[_0xa1ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee750,_0x4b7c1f){return function(_0x45ea3d){if(!_0x45ea3d){_0x1ee750[_0xa1ad('0x19')](0x194);}return _0x45ea3d;};}function handleError(_0x49433c,_0x1c2339){_0x1c2339=_0x1c2339||0x1f4;return function(_0xe96ef7){logger['error'](_0xe96ef7[_0xa1ad('0x28')]);if(_0xe96ef7[_0xa1ad('0x29')]){delete _0xe96ef7[_0xa1ad('0x29')];}_0x49433c['status'](_0x1c2339)[_0xa1ad('0x2a')](_0xe96ef7);};}exports[_0xa1ad('0x2b')]=function(_0x3d84ef,_0x36ecc8){var _0x502d5a={},_0x1ea884={},_0x336951={'count':0x0,'rows':[]};var _0xe34342=_[_0xa1ad('0x2c')](db[_0xa1ad('0x2d')]['rawAttributes'],function(_0x245182){return{'name':_0x245182['fieldName'],'type':_0x245182[_0xa1ad('0x2e')][_0xa1ad('0x2f')]};});_0x1ea884['model']=_[_0xa1ad('0x2c')](_0xe34342,_0xa1ad('0x29'));_0x1ea884[_0xa1ad('0x30')]=_[_0xa1ad('0x31')](_0x3d84ef[_0xa1ad('0x30')]);_0x1ea884[_0xa1ad('0x32')]=_[_0xa1ad('0x33')](_0x1ea884[_0xa1ad('0x34')],_0x1ea884[_0xa1ad('0x30')]);_0x502d5a[_0xa1ad('0x35')]=_[_0xa1ad('0x33')](_0x1ea884['model'],qs[_0xa1ad('0x36')](_0x3d84ef[_0xa1ad('0x30')]['fields']));_0x502d5a[_0xa1ad('0x35')]=_0x502d5a[_0xa1ad('0x35')][_0xa1ad('0x37')]?_0x502d5a['attributes']:_0x1ea884[_0xa1ad('0x34')];if(!_0x3d84ef[_0xa1ad('0x30')]['hasOwnProperty'](_0xa1ad('0x38'))){_0x502d5a[_0xa1ad('0x1f')]=qs[_0xa1ad('0x1f')](_0x3d84ef[_0xa1ad('0x30')][_0xa1ad('0x1f')]);_0x502d5a['offset']=qs[_0xa1ad('0x1d')](_0x3d84ef[_0xa1ad('0x30')]['offset']);}_0x502d5a[_0xa1ad('0x39')]=qs['sort'](_0x3d84ef[_0xa1ad('0x30')][_0xa1ad('0x3a')]);_0x502d5a['where']=qs[_0xa1ad('0x32')](_[_0xa1ad('0x3b')](_0x3d84ef[_0xa1ad('0x30')],_0x1ea884[_0xa1ad('0x32')]),_0xe34342);if(_0x3d84ef[_0xa1ad('0x30')][_0xa1ad('0x3c')]){_0x502d5a['where']=_[_0xa1ad('0x3d')](_0x502d5a[_0xa1ad('0x3e')],{'$or':_['map'](_0xe34342,function(_0x4d45dc){if(_0x4d45dc[_0xa1ad('0x2e')]!==_0xa1ad('0x3f')){var _0x180055={};_0x180055[_0x4d45dc[_0xa1ad('0x29')]]={'$like':'%'+_0x3d84ef[_0xa1ad('0x30')]['filter']+'%'};return _0x180055;}})});}_0x502d5a=_[_0xa1ad('0x3d')]({},_0x502d5a,_0x3d84ef[_0xa1ad('0x40')]);var _0x32cf32={'where':_0x502d5a[_0xa1ad('0x3e')]};return db[_0xa1ad('0x2d')][_0xa1ad('0x20')](_0x32cf32)[_0xa1ad('0x27')](function(_0x383048){_0x336951[_0xa1ad('0x20')]=_0x383048;if(_0x3d84ef[_0xa1ad('0x30')][_0xa1ad('0x41')]){_0x502d5a[_0xa1ad('0x42')]=[{'all':!![]}];}return db[_0xa1ad('0x2d')][_0xa1ad('0x43')](_0x502d5a);})[_0xa1ad('0x27')](function(_0x26c27d){_0x336951[_0xa1ad('0x44')]=_0x26c27d;return _0x336951;})[_0xa1ad('0x27')](respondWithFilteredResult(_0x36ecc8,_0x502d5a))[_0xa1ad('0x45')](handleError(_0x36ecc8,null));};exports[_0xa1ad('0x46')]=function(_0x436a72,_0x359981){var _0x365531={'raw':![],'where':{'id':_0x436a72[_0xa1ad('0x47')]['id']}},_0x4d8fab={};_0x4d8fab[_0xa1ad('0x34')]=_[_0xa1ad('0x31')](db[_0xa1ad('0x2d')]['rawAttributes']);_0x4d8fab[_0xa1ad('0x30')]=_[_0xa1ad('0x31')](_0x436a72[_0xa1ad('0x30')]);_0x4d8fab[_0xa1ad('0x32')]=_['intersection'](_0x4d8fab[_0xa1ad('0x34')],_0x4d8fab[_0xa1ad('0x30')]);_0x365531[_0xa1ad('0x35')]=_['intersection'](_0x4d8fab[_0xa1ad('0x34')],qs[_0xa1ad('0x36')](_0x436a72[_0xa1ad('0x30')][_0xa1ad('0x36')]));_0x365531[_0xa1ad('0x35')]=_0x365531[_0xa1ad('0x35')][_0xa1ad('0x37')]?_0x365531['attributes']:_0x4d8fab[_0xa1ad('0x34')];if(_0x436a72[_0xa1ad('0x30')][_0xa1ad('0x41')]){_0x365531['include']=[{'all':!![]}];}_0x365531=_['merge']({},_0x365531,_0x436a72[_0xa1ad('0x40')]);return db[_0xa1ad('0x2d')][_0xa1ad('0x48')](_0x365531)[_0xa1ad('0x27')](handleEntityNotFound(_0x359981,null))['then'](respondWithResult(_0x359981,null))['catch'](handleError(_0x359981,null));};exports[_0xa1ad('0x49')]=function(_0x4f20e1,_0x25fc0f){return db['ZohoConfiguration'][_0xa1ad('0x49')](_0x4f20e1['body'],{})['then'](respondWithResult(_0x25fc0f,0xc9))[_0xa1ad('0x45')](handleError(_0x25fc0f,null));};exports[_0xa1ad('0x4a')]=function(_0x3aeddd,_0x19a66c){if(_0x3aeddd[_0xa1ad('0x4b')]['id']){delete _0x3aeddd[_0xa1ad('0x4b')]['id'];}return db[_0xa1ad('0x2d')]['find']({'where':{'id':_0x3aeddd[_0xa1ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x19a66c,null))[_0xa1ad('0x27')](saveUpdates(_0x3aeddd['body'],null))[_0xa1ad('0x27')](respondWithResult(_0x19a66c,null))[_0xa1ad('0x45')](handleError(_0x19a66c,null));};exports[_0xa1ad('0x26')]=function(_0x4b0813,_0x34d6c8){return db[_0xa1ad('0x2d')][_0xa1ad('0x48')]({'where':{'id':_0x4b0813[_0xa1ad('0x47')]['id']}})[_0xa1ad('0x27')](handleEntityNotFound(_0x34d6c8,null))['then'](removeEntity(_0x34d6c8,null))['catch'](handleError(_0x34d6c8,null));};exports[_0xa1ad('0x4c')]=function(_0x32d5ba,_0x24e219,_0x14f3c5){var _0x5ee38d={};var _0x42e25d={};var _0x4693e8;var _0x1b9ace;return db[_0xa1ad('0x2d')][_0xa1ad('0x4d')]({'where':{'id':_0x32d5ba['params']['id']}})[_0xa1ad('0x27')](handleEntityNotFound(_0x24e219,null))[_0xa1ad('0x27')](function(_0x3ecb24){if(_0x3ecb24){_0x4693e8=_0x3ecb24;_0x42e25d[_0xa1ad('0x34')]=_[_0xa1ad('0x31')](db[_0xa1ad('0x4e')][_0xa1ad('0x4f')]);_0x42e25d[_0xa1ad('0x30')]=_[_0xa1ad('0x31')](_0x32d5ba[_0xa1ad('0x30')]);_0x42e25d[_0xa1ad('0x32')]=_['intersection'](_0x42e25d[_0xa1ad('0x34')],_0x42e25d['query']);_0x5ee38d[_0xa1ad('0x35')]=_[_0xa1ad('0x33')](_0x42e25d[_0xa1ad('0x34')],qs[_0xa1ad('0x36')](_0x32d5ba[_0xa1ad('0x30')][_0xa1ad('0x36')]));_0x5ee38d['attributes']=_0x5ee38d['attributes'][_0xa1ad('0x37')]?_0x5ee38d['attributes']:_0x42e25d['model'];_0x5ee38d[_0xa1ad('0x39')]=qs[_0xa1ad('0x3a')](_0x32d5ba[_0xa1ad('0x30')][_0xa1ad('0x3a')]);_0x5ee38d[_0xa1ad('0x3e')]=qs[_0xa1ad('0x32')](_['pick'](_0x32d5ba[_0xa1ad('0x30')],_0x42e25d[_0xa1ad('0x32')]));if(_0x32d5ba[_0xa1ad('0x30')]['filter']){_0x5ee38d[_0xa1ad('0x3e')]=_[_0xa1ad('0x3d')](_0x5ee38d[_0xa1ad('0x3e')],{'$or':_['map'](_0x5ee38d[_0xa1ad('0x35')],function(_0x51f44f){var _0x267cdf={};_0x267cdf[_0x51f44f]={'$like':'%'+_0x32d5ba[_0xa1ad('0x30')]['filter']+'%'};return _0x267cdf;})});}_0x5ee38d=_[_0xa1ad('0x3d')]({},_0x5ee38d,_0x32d5ba['options']);return _0x4693e8[_0xa1ad('0x4c')](_0x5ee38d);}})[_0xa1ad('0x27')](function(_0x42b690){if(_0x42b690){_0x1b9ace=_0x42b690[_0xa1ad('0x37')];if(!_0x32d5ba[_0xa1ad('0x30')]['hasOwnProperty'](_0xa1ad('0x38'))){_0x5ee38d['limit']=qs['limit'](_0x32d5ba[_0xa1ad('0x30')][_0xa1ad('0x1f')]);_0x5ee38d[_0xa1ad('0x1d')]=qs['offset'](_0x32d5ba[_0xa1ad('0x30')][_0xa1ad('0x1d')]);}return _0x4693e8[_0xa1ad('0x4c')](_0x5ee38d);}})[_0xa1ad('0x27')](function(_0x31a7b7){if(_0x31a7b7){return _0x31a7b7?{'count':_0x1b9ace,'rows':_0x31a7b7}:null;}})[_0xa1ad('0x27')](respondWithResult(_0x24e219,null))[_0xa1ad('0x45')](handleError(_0x24e219,null));};exports[_0xa1ad('0x50')]=function(_0x45ddc5,_0x8996d5,_0x28a6a4){var _0x19396a={};var _0x3b8ca6={};var _0x4cb203;var _0x5dee93;return db[_0xa1ad('0x2d')][_0xa1ad('0x4d')]({'where':{'id':_0x45ddc5[_0xa1ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x8996d5,null))['then'](function(_0x1b5ae8){if(_0x1b5ae8){_0x4cb203=_0x1b5ae8;_0x3b8ca6[_0xa1ad('0x34')]=_[_0xa1ad('0x31')](db['ZohoField'][_0xa1ad('0x4f')]);_0x3b8ca6['query']=_[_0xa1ad('0x31')](_0x45ddc5['query']);_0x3b8ca6[_0xa1ad('0x32')]=_[_0xa1ad('0x33')](_0x3b8ca6['model'],_0x3b8ca6['query']);_0x19396a['attributes']=_['intersection'](_0x3b8ca6[_0xa1ad('0x34')],qs[_0xa1ad('0x36')](_0x45ddc5['query'][_0xa1ad('0x36')]));_0x19396a[_0xa1ad('0x35')]=_0x19396a[_0xa1ad('0x35')][_0xa1ad('0x37')]?_0x19396a[_0xa1ad('0x35')]:_0x3b8ca6[_0xa1ad('0x34')];_0x19396a['order']=qs[_0xa1ad('0x3a')](_0x45ddc5[_0xa1ad('0x30')][_0xa1ad('0x3a')]);_0x19396a[_0xa1ad('0x3e')]=qs[_0xa1ad('0x32')](_[_0xa1ad('0x3b')](_0x45ddc5[_0xa1ad('0x30')],_0x3b8ca6[_0xa1ad('0x32')]));if(_0x45ddc5[_0xa1ad('0x30')][_0xa1ad('0x3c')]){_0x19396a[_0xa1ad('0x3e')]=_['merge'](_0x19396a[_0xa1ad('0x3e')],{'$or':_[_0xa1ad('0x2c')](_0x19396a[_0xa1ad('0x35')],function(_0x2858a2){var _0x4017c5={};_0x4017c5[_0x2858a2]={'$like':'%'+_0x45ddc5[_0xa1ad('0x30')]['filter']+'%'};return _0x4017c5;})});}_0x19396a=_[_0xa1ad('0x3d')]({},_0x19396a,_0x45ddc5['options']);return _0x4cb203[_0xa1ad('0x50')](_0x19396a);}})[_0xa1ad('0x27')](function(_0x27e8bc){if(_0x27e8bc){_0x5dee93=_0x27e8bc['length'];if(!_0x45ddc5[_0xa1ad('0x30')][_0xa1ad('0x51')](_0xa1ad('0x38'))){_0x19396a['limit']=qs[_0xa1ad('0x1f')](_0x45ddc5[_0xa1ad('0x30')][_0xa1ad('0x1f')]);_0x19396a[_0xa1ad('0x1d')]=qs[_0xa1ad('0x1d')](_0x45ddc5[_0xa1ad('0x30')][_0xa1ad('0x1d')]);}return _0x4cb203[_0xa1ad('0x50')](_0x19396a);}})['then'](function(_0xd4b919){if(_0xd4b919){return _0xd4b919?{'count':_0x5dee93,'rows':_0xd4b919}:null;}})[_0xa1ad('0x27')](respondWithResult(_0x8996d5,null))[_0xa1ad('0x45')](handleError(_0x8996d5,null));};exports['getDescriptions']=function(_0x342194,_0x1dfd10,_0x11c8c2){var _0x3cfb39={};var _0x209a8e={};var _0x218700;var _0x446baa;return db[_0xa1ad('0x2d')]['findOne']({'where':{'id':_0x342194['params']['id']}})[_0xa1ad('0x27')](handleEntityNotFound(_0x1dfd10,null))[_0xa1ad('0x27')](function(_0x3cb44b){if(_0x3cb44b){_0x218700=_0x3cb44b;_0x209a8e[_0xa1ad('0x34')]=_[_0xa1ad('0x31')](db[_0xa1ad('0x4e')]['rawAttributes']);_0x209a8e['query']=_[_0xa1ad('0x31')](_0x342194[_0xa1ad('0x30')]);_0x209a8e['filters']=_[_0xa1ad('0x33')](_0x209a8e[_0xa1ad('0x34')],_0x209a8e[_0xa1ad('0x30')]);_0x3cfb39[_0xa1ad('0x35')]=_[_0xa1ad('0x33')](_0x209a8e[_0xa1ad('0x34')],qs[_0xa1ad('0x36')](_0x342194[_0xa1ad('0x30')][_0xa1ad('0x36')]));_0x3cfb39[_0xa1ad('0x35')]=_0x3cfb39[_0xa1ad('0x35')][_0xa1ad('0x37')]?_0x3cfb39[_0xa1ad('0x35')]:_0x209a8e[_0xa1ad('0x34')];_0x3cfb39[_0xa1ad('0x39')]=qs[_0xa1ad('0x3a')](_0x342194['query']['sort']);_0x3cfb39['where']=qs['filters'](_[_0xa1ad('0x3b')](_0x342194['query'],_0x209a8e['filters']));if(_0x342194[_0xa1ad('0x30')][_0xa1ad('0x3c')]){_0x3cfb39['where']=_[_0xa1ad('0x3d')](_0x3cfb39[_0xa1ad('0x3e')],{'$or':_[_0xa1ad('0x2c')](_0x3cfb39['attributes'],function(_0x39ac18){var _0x40d256={};_0x40d256[_0x39ac18]={'$like':'%'+_0x342194[_0xa1ad('0x30')][_0xa1ad('0x3c')]+'%'};return _0x40d256;})});}_0x3cfb39=_['merge']({},_0x3cfb39,_0x342194[_0xa1ad('0x40')]);return _0x218700[_0xa1ad('0x52')](_0x3cfb39);}})[_0xa1ad('0x27')](function(_0x20b312){if(_0x20b312){_0x446baa=_0x20b312['length'];if(!_0x342194[_0xa1ad('0x30')][_0xa1ad('0x51')](_0xa1ad('0x38'))){_0x3cfb39[_0xa1ad('0x1f')]=qs['limit'](_0x342194[_0xa1ad('0x30')][_0xa1ad('0x1f')]);_0x3cfb39[_0xa1ad('0x1d')]=qs[_0xa1ad('0x1d')](_0x342194[_0xa1ad('0x30')][_0xa1ad('0x1d')]);}return _0x218700['getDescriptions'](_0x3cfb39);}})['then'](function(_0x40f62c){if(_0x40f62c){return _0x40f62c?{'count':_0x446baa,'rows':_0x40f62c}:null;}})['then'](respondWithResult(_0x1dfd10,null))['catch'](handleError(_0x1dfd10,null));}; \ No newline at end of file +var _0xe4b8=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','keys','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','find','catch','create','body','findOne','ZohoField','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e27c3,_0x4f890f){var _0x12d23d=function(_0x2b1d62){while(--_0x2b1d62){_0x4e27c3['push'](_0x4e27c3['shift']());}};_0x12d23d(++_0x4f890f);}(_0xe4b8,0xd5));var _0x8e4b=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe4b8[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x8e4b('0x0'));var rimraf=require(_0x8e4b('0x1'));var zipdir=require(_0x8e4b('0x2'));var jsonpatch=require(_0x8e4b('0x3'));var rp=require(_0x8e4b('0x4'));var moment=require('moment');var BPromise=require(_0x8e4b('0x5'));var Mustache=require(_0x8e4b('0x6'));var util=require(_0x8e4b('0x7'));var path=require(_0x8e4b('0x8'));var sox=require('sox');var csv=require(_0x8e4b('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(_0x8e4b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8e4b('0xb'));var toCsv=require(_0x8e4b('0x9'));var querystring=require(_0x8e4b('0xc'));var Papa=require('papaparse');var Redis=require(_0x8e4b('0xd'));var authService=require(_0x8e4b('0xe'));var qs=require(_0x8e4b('0xf'));var as=require(_0x8e4b('0x10'));var hardwareService=require(_0x8e4b('0x11'));var logger=require(_0x8e4b('0x12'))(_0x8e4b('0x13'));var utils=require('../../config/utils');var config=require(_0x8e4b('0x14'));var licenseUtil=require(_0x8e4b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x312f95,_0x50b487){_0x50b487=_0x50b487||0xcc;return function(_0x378826){if(_0x378826){return _0x312f95[_0x8e4b('0x16')](_0x50b487);}return _0x312f95[_0x8e4b('0x17')](_0x50b487)['end']();};}function respondWithResult(_0x30dc35,_0xc47971){_0xc47971=_0xc47971||0xc8;return function(_0x4cd963){if(_0x4cd963){return _0x30dc35[_0x8e4b('0x17')](_0xc47971)[_0x8e4b('0x18')](_0x4cd963);}};}function respondWithFilteredResult(_0x73ae44,_0x5954ff){return function(_0x4488b4){if(_0x4488b4){var _0x48be0c=typeof _0x5954ff[_0x8e4b('0x19')]===_0x8e4b('0x1a')&&typeof _0x5954ff[_0x8e4b('0x1b')]==='undefined';var _0x4ec0c6=_0x4488b4[_0x8e4b('0x1c')];var _0xfca5d8=_0x48be0c?0x0:_0x5954ff[_0x8e4b('0x19')];var _0x454d57=_0x48be0c?_0x4488b4['count']:_0x5954ff[_0x8e4b('0x19')]+_0x5954ff[_0x8e4b('0x1b')];var _0x8df57;if(_0x454d57>=_0x4ec0c6){_0x454d57=_0x4ec0c6;_0x8df57=0xc8;}else{_0x8df57=0xce;}_0x73ae44['status'](_0x8df57);return _0x73ae44[_0x8e4b('0x1d')]('Content-Range',_0xfca5d8+'-'+_0x454d57+'/'+_0x4ec0c6)['json'](_0x4488b4);}return null;};}function patchUpdates(_0x343ad4){return function(_0x482002){try{jsonpatch[_0x8e4b('0x1e')](_0x482002,_0x343ad4,!![]);}catch(_0x3b8323){return BPromise[_0x8e4b('0x1f')](_0x3b8323);}return _0x482002['save']();};}function saveUpdates(_0x309b22,_0x7e2d03){return function(_0x450721){if(_0x450721){return _0x450721[_0x8e4b('0x20')](_0x309b22)[_0x8e4b('0x21')](function(_0x28ee92){return _0x28ee92;});}return null;};}function removeEntity(_0x213902,_0x51f460){return function(_0x3f9cf8){if(_0x3f9cf8){return _0x3f9cf8['destroy']()[_0x8e4b('0x21')](function(){_0x213902[_0x8e4b('0x17')](0xcc)[_0x8e4b('0x22')]();});}};}function handleEntityNotFound(_0x537f08,_0x3d6db3){return function(_0x3c0415){if(!_0x3c0415){_0x537f08['sendStatus'](0x194);}return _0x3c0415;};}function handleError(_0x464b02,_0x47dcef){_0x47dcef=_0x47dcef||0x1f4;return function(_0xfec441){logger[_0x8e4b('0x23')](_0xfec441[_0x8e4b('0x24')]);if(_0xfec441[_0x8e4b('0x25')]){delete _0xfec441[_0x8e4b('0x25')];}_0x464b02[_0x8e4b('0x17')](_0x47dcef)[_0x8e4b('0x26')](_0xfec441);};}exports[_0x8e4b('0x27')]=function(_0x1182cc,_0x269562){var _0x43ce9e={},_0x15323e={},_0x1277fe={'count':0x0,'rows':[]};var _0x43b8c8=_[_0x8e4b('0x28')](db[_0x8e4b('0x29')][_0x8e4b('0x2a')],function(_0x4a9b5e){return{'name':_0x4a9b5e['fieldName'],'type':_0x4a9b5e[_0x8e4b('0x2b')][_0x8e4b('0x2c')]};});_0x15323e[_0x8e4b('0x2d')]=_[_0x8e4b('0x28')](_0x43b8c8,_0x8e4b('0x25'));_0x15323e['query']=_[_0x8e4b('0x2e')](_0x1182cc[_0x8e4b('0x2f')]);_0x15323e['filters']=_['intersection'](_0x15323e[_0x8e4b('0x2d')],_0x15323e[_0x8e4b('0x2f')]);_0x43ce9e[_0x8e4b('0x30')]=_['intersection'](_0x15323e['model'],qs[_0x8e4b('0x31')](_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x31')]));_0x43ce9e['attributes']=_0x43ce9e[_0x8e4b('0x30')][_0x8e4b('0x32')]?_0x43ce9e[_0x8e4b('0x30')]:_0x15323e[_0x8e4b('0x2d')];if(!_0x1182cc['query']['hasOwnProperty'](_0x8e4b('0x33'))){_0x43ce9e[_0x8e4b('0x1b')]=qs['limit'](_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x1b')]);_0x43ce9e[_0x8e4b('0x19')]=qs['offset'](_0x1182cc['query'][_0x8e4b('0x19')]);}_0x43ce9e[_0x8e4b('0x34')]=qs[_0x8e4b('0x35')](_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x35')]);_0x43ce9e[_0x8e4b('0x36')]=qs[_0x8e4b('0x37')](_[_0x8e4b('0x38')](_0x1182cc[_0x8e4b('0x2f')],_0x15323e[_0x8e4b('0x37')]),_0x43b8c8);if(_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x39')]){_0x43ce9e['where']=_[_0x8e4b('0x3a')](_0x43ce9e[_0x8e4b('0x36')],{'$or':_['map'](_0x43b8c8,function(_0x26f793){if(_0x26f793[_0x8e4b('0x2b')]!==_0x8e4b('0x3b')){var _0x342ff0={};_0x342ff0[_0x26f793[_0x8e4b('0x25')]]={'$like':'%'+_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x39')]+'%'};return _0x342ff0;}})});}_0x43ce9e=_[_0x8e4b('0x3a')]({},_0x43ce9e,_0x1182cc[_0x8e4b('0x3c')]);var _0x3c255d={'where':_0x43ce9e[_0x8e4b('0x36')]};return db['ZohoConfiguration'][_0x8e4b('0x1c')](_0x3c255d)[_0x8e4b('0x21')](function(_0x511a86){_0x1277fe['count']=_0x511a86;if(_0x1182cc[_0x8e4b('0x2f')][_0x8e4b('0x3d')]){_0x43ce9e[_0x8e4b('0x3e')]=[{'all':!![]}];}return db[_0x8e4b('0x29')][_0x8e4b('0x3f')](_0x43ce9e);})[_0x8e4b('0x21')](function(_0x455cfa){_0x1277fe[_0x8e4b('0x40')]=_0x455cfa;return _0x1277fe;})['then'](respondWithFilteredResult(_0x269562,_0x43ce9e))['catch'](handleError(_0x269562,null));};exports['show']=function(_0x8724b7,_0x16767d){var _0x3d0979={'raw':![],'where':{'id':_0x8724b7[_0x8e4b('0x41')]['id']}},_0x1d2518={};_0x1d2518[_0x8e4b('0x2d')]=_[_0x8e4b('0x2e')](db[_0x8e4b('0x29')][_0x8e4b('0x2a')]);_0x1d2518[_0x8e4b('0x2f')]=_[_0x8e4b('0x2e')](_0x8724b7[_0x8e4b('0x2f')]);_0x1d2518[_0x8e4b('0x37')]=_['intersection'](_0x1d2518[_0x8e4b('0x2d')],_0x1d2518[_0x8e4b('0x2f')]);_0x3d0979[_0x8e4b('0x30')]=_[_0x8e4b('0x42')](_0x1d2518['model'],qs[_0x8e4b('0x31')](_0x8724b7[_0x8e4b('0x2f')][_0x8e4b('0x31')]));_0x3d0979[_0x8e4b('0x30')]=_0x3d0979['attributes'][_0x8e4b('0x32')]?_0x3d0979[_0x8e4b('0x30')]:_0x1d2518[_0x8e4b('0x2d')];if(_0x8724b7[_0x8e4b('0x2f')][_0x8e4b('0x3d')]){_0x3d0979['include']=[{'all':!![]}];}_0x3d0979=_[_0x8e4b('0x3a')]({},_0x3d0979,_0x8724b7['options']);return db[_0x8e4b('0x29')][_0x8e4b('0x43')](_0x3d0979)[_0x8e4b('0x21')](handleEntityNotFound(_0x16767d,null))['then'](respondWithResult(_0x16767d,null))[_0x8e4b('0x44')](handleError(_0x16767d,null));};exports[_0x8e4b('0x45')]=function(_0xe4857a,_0x4b2641){return db[_0x8e4b('0x29')][_0x8e4b('0x45')](_0xe4857a[_0x8e4b('0x46')],{})[_0x8e4b('0x21')](respondWithResult(_0x4b2641,0xc9))['catch'](handleError(_0x4b2641,null));};exports[_0x8e4b('0x20')]=function(_0x581abc,_0x571e4b){if(_0x581abc[_0x8e4b('0x46')]['id']){delete _0x581abc[_0x8e4b('0x46')]['id'];}return db[_0x8e4b('0x29')]['find']({'where':{'id':_0x581abc['params']['id']}})[_0x8e4b('0x21')](handleEntityNotFound(_0x571e4b,null))[_0x8e4b('0x21')](saveUpdates(_0x581abc[_0x8e4b('0x46')],null))[_0x8e4b('0x21')](respondWithResult(_0x571e4b,null))[_0x8e4b('0x44')](handleError(_0x571e4b,null));};exports['destroy']=function(_0x4a3794,_0x542a01){return db[_0x8e4b('0x29')]['find']({'where':{'id':_0x4a3794[_0x8e4b('0x41')]['id']}})[_0x8e4b('0x21')](handleEntityNotFound(_0x542a01,null))[_0x8e4b('0x21')](removeEntity(_0x542a01,null))[_0x8e4b('0x44')](handleError(_0x542a01,null));};exports['getFields']=function(_0xb4d9c0,_0x55fbe7,_0x42f7f1){var _0xb547d2={};var _0x3960e3={};var _0x5f1f14;var _0x7dc570;return db['ZohoConfiguration'][_0x8e4b('0x47')]({'where':{'id':_0xb4d9c0['params']['id']}})['then'](handleEntityNotFound(_0x55fbe7,null))[_0x8e4b('0x21')](function(_0x28b599){if(_0x28b599){_0x5f1f14=_0x28b599;_0x3960e3['model']=_[_0x8e4b('0x2e')](db[_0x8e4b('0x48')][_0x8e4b('0x2a')]);_0x3960e3[_0x8e4b('0x2f')]=_[_0x8e4b('0x2e')](_0xb4d9c0['query']);_0x3960e3[_0x8e4b('0x37')]=_[_0x8e4b('0x42')](_0x3960e3['model'],_0x3960e3['query']);_0xb547d2[_0x8e4b('0x30')]=_[_0x8e4b('0x42')](_0x3960e3['model'],qs[_0x8e4b('0x31')](_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x31')]));_0xb547d2[_0x8e4b('0x30')]=_0xb547d2['attributes'][_0x8e4b('0x32')]?_0xb547d2[_0x8e4b('0x30')]:_0x3960e3[_0x8e4b('0x2d')];_0xb547d2[_0x8e4b('0x34')]=qs[_0x8e4b('0x35')](_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x35')]);_0xb547d2[_0x8e4b('0x36')]=qs['filters'](_[_0x8e4b('0x38')](_0xb4d9c0[_0x8e4b('0x2f')],_0x3960e3['filters']));if(_0xb4d9c0['query']['filter']){_0xb547d2[_0x8e4b('0x36')]=_[_0x8e4b('0x3a')](_0xb547d2['where'],{'$or':_[_0x8e4b('0x28')](_0xb547d2['attributes'],function(_0x3e2517){var _0x4b9592={};_0x4b9592[_0x3e2517]={'$like':'%'+_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x39')]+'%'};return _0x4b9592;})});}_0xb547d2=_['merge']({},_0xb547d2,_0xb4d9c0[_0x8e4b('0x3c')]);return _0x5f1f14[_0x8e4b('0x49')](_0xb547d2);}})[_0x8e4b('0x21')](function(_0x5cc343){if(_0x5cc343){_0x7dc570=_0x5cc343['length'];if(!_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x4a')]('nolimit')){_0xb547d2['limit']=qs[_0x8e4b('0x1b')](_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x1b')]);_0xb547d2['offset']=qs[_0x8e4b('0x19')](_0xb4d9c0[_0x8e4b('0x2f')][_0x8e4b('0x19')]);}return _0x5f1f14[_0x8e4b('0x49')](_0xb547d2);}})[_0x8e4b('0x21')](function(_0x23e927){if(_0x23e927){return _0x23e927?{'count':_0x7dc570,'rows':_0x23e927}:null;}})[_0x8e4b('0x21')](respondWithResult(_0x55fbe7,null))[_0x8e4b('0x44')](handleError(_0x55fbe7,null));};exports[_0x8e4b('0x4b')]=function(_0x398f4b,_0x19eb9c,_0x134910){var _0x566820={};var _0x165937={};var _0x19bf0c;var _0x294a25;return db['ZohoConfiguration'][_0x8e4b('0x47')]({'where':{'id':_0x398f4b[_0x8e4b('0x41')]['id']}})[_0x8e4b('0x21')](handleEntityNotFound(_0x19eb9c,null))[_0x8e4b('0x21')](function(_0x12136f){if(_0x12136f){_0x19bf0c=_0x12136f;_0x165937[_0x8e4b('0x2d')]=_[_0x8e4b('0x2e')](db[_0x8e4b('0x48')][_0x8e4b('0x2a')]);_0x165937[_0x8e4b('0x2f')]=_['keys'](_0x398f4b['query']);_0x165937['filters']=_[_0x8e4b('0x42')](_0x165937['model'],_0x165937[_0x8e4b('0x2f')]);_0x566820[_0x8e4b('0x30')]=_[_0x8e4b('0x42')](_0x165937[_0x8e4b('0x2d')],qs[_0x8e4b('0x31')](_0x398f4b[_0x8e4b('0x2f')]['fields']));_0x566820['attributes']=_0x566820['attributes'][_0x8e4b('0x32')]?_0x566820['attributes']:_0x165937['model'];_0x566820[_0x8e4b('0x34')]=qs['sort'](_0x398f4b[_0x8e4b('0x2f')][_0x8e4b('0x35')]);_0x566820['where']=qs[_0x8e4b('0x37')](_[_0x8e4b('0x38')](_0x398f4b[_0x8e4b('0x2f')],_0x165937[_0x8e4b('0x37')]));if(_0x398f4b[_0x8e4b('0x2f')][_0x8e4b('0x39')]){_0x566820[_0x8e4b('0x36')]=_[_0x8e4b('0x3a')](_0x566820[_0x8e4b('0x36')],{'$or':_[_0x8e4b('0x28')](_0x566820[_0x8e4b('0x30')],function(_0x24b209){var _0xa3ba2f={};_0xa3ba2f[_0x24b209]={'$like':'%'+_0x398f4b[_0x8e4b('0x2f')][_0x8e4b('0x39')]+'%'};return _0xa3ba2f;})});}_0x566820=_[_0x8e4b('0x3a')]({},_0x566820,_0x398f4b[_0x8e4b('0x3c')]);return _0x19bf0c['getSubjects'](_0x566820);}})['then'](function(_0x296483){if(_0x296483){_0x294a25=_0x296483['length'];if(!_0x398f4b['query'][_0x8e4b('0x4a')](_0x8e4b('0x33'))){_0x566820[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x398f4b[_0x8e4b('0x2f')][_0x8e4b('0x1b')]);_0x566820[_0x8e4b('0x19')]=qs[_0x8e4b('0x19')](_0x398f4b[_0x8e4b('0x2f')][_0x8e4b('0x19')]);}return _0x19bf0c[_0x8e4b('0x4b')](_0x566820);}})[_0x8e4b('0x21')](function(_0x391c56){if(_0x391c56){return _0x391c56?{'count':_0x294a25,'rows':_0x391c56}:null;}})['then'](respondWithResult(_0x19eb9c,null))[_0x8e4b('0x44')](handleError(_0x19eb9c,null));};exports[_0x8e4b('0x4c')]=function(_0x4ed0a3,_0xf25980,_0x19ee97){var _0x3c92dd={};var _0x435274={};var _0x1b4987;var _0x43be25;return db['ZohoConfiguration'][_0x8e4b('0x47')]({'where':{'id':_0x4ed0a3[_0x8e4b('0x41')]['id']}})[_0x8e4b('0x21')](handleEntityNotFound(_0xf25980,null))[_0x8e4b('0x21')](function(_0xf2013e){if(_0xf2013e){_0x1b4987=_0xf2013e;_0x435274['model']=_[_0x8e4b('0x2e')](db[_0x8e4b('0x48')][_0x8e4b('0x2a')]);_0x435274['query']=_[_0x8e4b('0x2e')](_0x4ed0a3['query']);_0x435274[_0x8e4b('0x37')]=_[_0x8e4b('0x42')](_0x435274['model'],_0x435274[_0x8e4b('0x2f')]);_0x3c92dd[_0x8e4b('0x30')]=_[_0x8e4b('0x42')](_0x435274[_0x8e4b('0x2d')],qs['fields'](_0x4ed0a3[_0x8e4b('0x2f')][_0x8e4b('0x31')]));_0x3c92dd[_0x8e4b('0x30')]=_0x3c92dd['attributes'][_0x8e4b('0x32')]?_0x3c92dd[_0x8e4b('0x30')]:_0x435274[_0x8e4b('0x2d')];_0x3c92dd[_0x8e4b('0x34')]=qs[_0x8e4b('0x35')](_0x4ed0a3[_0x8e4b('0x2f')][_0x8e4b('0x35')]);_0x3c92dd[_0x8e4b('0x36')]=qs['filters'](_[_0x8e4b('0x38')](_0x4ed0a3[_0x8e4b('0x2f')],_0x435274[_0x8e4b('0x37')]));if(_0x4ed0a3[_0x8e4b('0x2f')][_0x8e4b('0x39')]){_0x3c92dd[_0x8e4b('0x36')]=_[_0x8e4b('0x3a')](_0x3c92dd['where'],{'$or':_['map'](_0x3c92dd['attributes'],function(_0x34746a){var _0x17fcc9={};_0x17fcc9[_0x34746a]={'$like':'%'+_0x4ed0a3[_0x8e4b('0x2f')][_0x8e4b('0x39')]+'%'};return _0x17fcc9;})});}_0x3c92dd=_['merge']({},_0x3c92dd,_0x4ed0a3[_0x8e4b('0x3c')]);return _0x1b4987[_0x8e4b('0x4c')](_0x3c92dd);}})[_0x8e4b('0x21')](function(_0x44d39b){if(_0x44d39b){_0x43be25=_0x44d39b['length'];if(!_0x4ed0a3[_0x8e4b('0x2f')]['hasOwnProperty'](_0x8e4b('0x33'))){_0x3c92dd['limit']=qs[_0x8e4b('0x1b')](_0x4ed0a3[_0x8e4b('0x2f')][_0x8e4b('0x1b')]);_0x3c92dd[_0x8e4b('0x19')]=qs[_0x8e4b('0x19')](_0x4ed0a3[_0x8e4b('0x2f')]['offset']);}return _0x1b4987[_0x8e4b('0x4c')](_0x3c92dd);}})[_0x8e4b('0x21')](function(_0x1d0d37){if(_0x1d0d37){return _0x1d0d37?{'count':_0x43be25,'rows':_0x1d0d37}:null;}})[_0x8e4b('0x21')](respondWithResult(_0xf25980,null))[_0x8e4b('0x44')](handleError(_0xf25980,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index eb8f3ce..7d9e5fb 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 _0xeb64=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xeb64,0x11e));var _0x4eb6=function(_0x1b6626,_0x5c6f93){_0x1b6626=_0x1b6626-0x0;var _0x5892d2=_0xeb64[_0x1b6626];return _0x5892d2;};'use strict';var _=require(_0x4eb6('0x0'));var util=require(_0x4eb6('0x1'));var logger=require('../../config/logger')(_0x4eb6('0x2'));var moment=require('moment');var BPromise=require(_0x4eb6('0x3'));var rp=require(_0x4eb6('0x4'));var fs=require('fs');var path=require(_0x4eb6('0x5'));var rimraf=require(_0x4eb6('0x6'));var config=require(_0x4eb6('0x7'));var attributes=require(_0x4eb6('0x8'));module[_0x4eb6('0x9')]=function(_0x50e387,_0x5e3c38){return _0x50e387[_0x4eb6('0xa')](_0x4eb6('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e6=['../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','int_zoho_configurations','lodash','util'];(function(_0x1125b0,_0x3f0f96){var _0x565a17=function(_0x213dd3){while(--_0x213dd3){_0x1125b0['push'](_0x1125b0['shift']());}};_0x565a17(++_0x3f0f96);}(_0x55e6,0x1db));var _0x655e=function(_0x170e42,_0x2975e3){_0x170e42=_0x170e42-0x0;var _0x41ff43=_0x55e6[_0x170e42];return _0x41ff43;};'use strict';var _=require(_0x655e('0x0'));var util=require(_0x655e('0x1'));var logger=require(_0x655e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x655e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x655e('0x4'));var rimraf=require(_0x655e('0x5'));var config=require(_0x655e('0x6'));var attributes=require(_0x655e('0x7'));module['exports']=function(_0x13a79a,_0x3ca18a){return _0x13a79a['define']('ZohoConfiguration',attributes,{'tableName':_0x655e('0x8'),'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 a98520e..1732030 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 _0xdfc1=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xdfc1,0x1ba));var _0x1dfc=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xdfc1[_0x17730a];return _0x485db1;};'use strict';var _=require(_0x1dfc('0x0'));var util=require(_0x1dfc('0x1'));var moment=require(_0x1dfc('0x2'));var BPromise=require(_0x1dfc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dfc('0x4'));var db=require(_0x1dfc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dfc('0x6'))(_0x1dfc('0x7'));var config=require(_0x1dfc('0x8'));var jayson=require(_0x1dfc('0x9'));var client=jayson[_0x1dfc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536e1d,_0x3a0efb,_0xb3c9dd){return new BPromise(function(_0x147321,_0x5928ed){return client[_0x1dfc('0xb')](_0x536e1d,_0xb3c9dd)['then'](function(_0x5f5d12){logger[_0x1dfc('0xc')](_0x1dfc('0xd'),_0x3a0efb,_0x1dfc('0xe'));logger[_0x1dfc('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3a0efb,'request\x20sent',JSON[_0x1dfc('0x10')](_0x5f5d12));if(_0x5f5d12[_0x1dfc('0x11')]){if(_0x5f5d12[_0x1dfc('0x11')][_0x1dfc('0x12')]===0x1f4){logger[_0x1dfc('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3a0efb,_0x5f5d12[_0x1dfc('0x11')][_0x1dfc('0x13')]);return _0x5928ed(_0x5f5d12[_0x1dfc('0x11')][_0x1dfc('0x13')]);}logger['error'](_0x1dfc('0xd'),_0x3a0efb,_0x5f5d12[_0x1dfc('0x11')][_0x1dfc('0x13')]);return _0x147321(_0x5f5d12[_0x1dfc('0x11')]['message']);}else{logger[_0x1dfc('0xc')](_0x1dfc('0xd'),_0x3a0efb,_0x1dfc('0xe'));_0x147321(_0x5f5d12[_0x1dfc('0x14')][_0x1dfc('0x13')]);}})[_0x1dfc('0x15')](function(_0x4487d9){logger[_0x1dfc('0x11')](_0x1dfc('0xd'),_0x3a0efb,_0x4487d9);_0x5928ed(_0x4487d9);});});} \ No newline at end of file +var _0x48ae=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','info'];(function(_0xc7c78d,_0x1dd9fb){var _0x175f3d=function(_0x1966cf){while(--_0x1966cf){_0xc7c78d['push'](_0xc7c78d['shift']());}};_0x175f3d(++_0x1dd9fb);}(_0x48ae,0x149));var _0xe48a=function(_0x4f9a7e,_0x1b5400){_0x4f9a7e=_0x4f9a7e-0x0;var _0x2e50ee=_0x48ae[_0x4f9a7e];return _0x2e50ee;};'use strict';var _=require(_0xe48a('0x0'));var util=require(_0xe48a('0x1'));var moment=require(_0xe48a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe48a('0x3'));var fs=require('fs');var Redis=require(_0xe48a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe48a('0x5'));var logger=require('../../config/logger')(_0xe48a('0x6'));var config=require('../../config/environment');var jayson=require(_0xe48a('0x7'));var client=jayson['client'][_0xe48a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aa20e,_0x1cc235,_0x257946){return new BPromise(function(_0x5081e2,_0x1701ac){return client[_0xe48a('0x9')](_0x4aa20e,_0x257946)['then'](function(_0x3e69e2){logger[_0xe48a('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x1cc235,_0xe48a('0xb'));logger[_0xe48a('0xc')](_0xe48a('0xd'),_0x1cc235,_0xe48a('0xb'),JSON[_0xe48a('0xe')](_0x3e69e2));if(_0x3e69e2[_0xe48a('0xf')]){if(_0x3e69e2[_0xe48a('0xf')][_0xe48a('0x10')]===0x1f4){logger[_0xe48a('0xf')](_0xe48a('0x11'),_0x1cc235,_0x3e69e2[_0xe48a('0xf')][_0xe48a('0x12')]);return _0x1701ac(_0x3e69e2[_0xe48a('0xf')][_0xe48a('0x12')]);}logger[_0xe48a('0xf')](_0xe48a('0x11'),_0x1cc235,_0x3e69e2[_0xe48a('0xf')][_0xe48a('0x12')]);return _0x5081e2(_0x3e69e2[_0xe48a('0xf')][_0xe48a('0x12')]);}else{logger[_0xe48a('0xa')](_0xe48a('0x11'),_0x1cc235,_0xe48a('0xb'));_0x5081e2(_0x3e69e2['result'][_0xe48a('0x12')]);}})[_0xe48a('0x13')](function(_0x266a48){logger[_0xe48a('0xf')](_0xe48a('0x11'),_0x1cc235,_0x266a48);_0x1701ac(_0x266a48);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index cd5667c..f83a14e 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 _0x7aa6=['destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x4d3a1c,_0x5752b5){var _0x1c4a32=function(_0x36a2d3){while(--_0x36a2d3){_0x4d3a1c['push'](_0x4d3a1c['shift']());}};_0x1c4a32(++_0x5752b5);}(_0x7aa6,0xd3));var _0x67aa=function(_0x2ce02c,_0x455f90){_0x2ce02c=_0x2ce02c-0x0;var _0x2e83fe=_0x7aa6[_0x2ce02c];return _0x2e83fe;};'use strict';var multer=require('multer');var util=require(_0x67aa('0x0'));var path=require(_0x67aa('0x1'));var timeout=require(_0x67aa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x67aa('0x3'));var auth=require(_0x67aa('0x4'));var interaction=require(_0x67aa('0x5'));var config=require(_0x67aa('0x6'));var controller=require('./intZohoField.controller');router[_0x67aa('0x7')]('/',auth[_0x67aa('0x8')](),controller[_0x67aa('0x9')]);router[_0x67aa('0x7')](_0x67aa('0xa'),auth[_0x67aa('0x8')](),controller[_0x67aa('0xb')]);router[_0x67aa('0xc')]('/',auth[_0x67aa('0x8')](),controller[_0x67aa('0xd')]);router[_0x67aa('0xe')](_0x67aa('0xa'),auth[_0x67aa('0x8')](),controller[_0x67aa('0xf')]);router[_0x67aa('0x10')](_0x67aa('0xa'),auth[_0x67aa('0x8')](),controller[_0x67aa('0x11')]);module[_0x67aa('0x12')]=router; \ No newline at end of file +var _0x2bcc=['show','post','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0xaf959e,_0x3082c4){var _0x28be7e=function(_0x4c7135){while(--_0x4c7135){_0xaf959e['push'](_0xaf959e['shift']());}};_0x28be7e(++_0x3082c4);}(_0x2bcc,0x1c8));var _0xc2bc=function(_0x1ea24d,_0x3f517a){_0x1ea24d=_0x1ea24d-0x0;var _0x2e76fb=_0x2bcc[_0x1ea24d];return _0x2e76fb;};'use strict';var multer=require(_0xc2bc('0x0'));var util=require(_0xc2bc('0x1'));var path=require(_0xc2bc('0x2'));var timeout=require(_0xc2bc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc2bc('0x4'));var auth=require(_0xc2bc('0x5'));var interaction=require(_0xc2bc('0x6'));var config=require(_0xc2bc('0x7'));var controller=require(_0xc2bc('0x8'));router[_0xc2bc('0x9')]('/',auth[_0xc2bc('0xa')](),controller[_0xc2bc('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc2bc('0xc')]);router[_0xc2bc('0xd')]('/',auth[_0xc2bc('0xa')](),controller['create']);router['put'](_0xc2bc('0xe'),auth[_0xc2bc('0xa')](),controller[_0xc2bc('0xf')]);router[_0xc2bc('0x10')](_0xc2bc('0xe'),auth[_0xc2bc('0xa')](),controller['destroy']);module[_0xc2bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8090e65..8ee533c 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 _0xba44=['customVariable','BOOLEAN','sequelize','picklist','STRING','ENUM','string','variable'];(function(_0x51a061,_0x65e095){var _0x4705c7=function(_0x2c6994){while(--_0x2c6994){_0x51a061['push'](_0x51a061['shift']());}};_0x4705c7(++_0x65e095);}(_0xba44,0x192));var _0x4ba4=function(_0xc45025,_0x5999a6){_0xc45025=_0xc45025-0x0;var _0xeb336a=_0xba44[_0xc45025];return _0xeb336a;};'use strict';var Sequelize=require(_0x4ba4('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue',_0x4ba4('0x1')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4ba4('0x2')]},'key':{'type':Sequelize[_0x4ba4('0x2')]},'keyType':{'type':Sequelize[_0x4ba4('0x3')](_0x4ba4('0x4'),_0x4ba4('0x5'),_0x4ba4('0x6'))},'keyContent':{'type':Sequelize[_0x4ba4('0x2')]},'idField':{'type':Sequelize[_0x4ba4('0x2')]},'nameField':{'type':Sequelize[_0x4ba4('0x2')]},'customField':{'type':Sequelize[_0x4ba4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb566=['string','variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x4b432a,_0x578c42){var _0x505158=function(_0x336497){while(--_0x336497){_0x4b432a['push'](_0x4b432a['shift']());}};_0x505158(++_0x578c42);}(_0xb566,0x16e));var _0x6b56=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xb566[_0x96f74c];return _0x379222;};'use strict';var Sequelize=require('sequelize');module[_0x6b56('0x0')]={'type':{'type':Sequelize[_0x6b56('0x1')](_0x6b56('0x2'),_0x6b56('0x3'),_0x6b56('0x4'),'keyValue',_0x6b56('0x5')),'defaultValue':_0x6b56('0x2')},'content':{'type':Sequelize[_0x6b56('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6b56('0x1')]('string',_0x6b56('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6b56('0x6')]},'idField':{'type':Sequelize[_0x6b56('0x6')]},'nameField':{'type':Sequelize[_0x6b56('0x6')]},'customField':{'type':Sequelize[_0x6b56('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b56('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fb1b842..7b8e6c4 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 _0x00c4=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x00c4,0x15a));var _0x400c=function(_0x268832,_0x315138){_0x268832=_0x268832-0x0;var _0x2007e6=_0x00c4[_0x268832];return _0x2007e6;};'use strict';var emlformat=require(_0x400c('0x0'));var rimraf=require(_0x400c('0x1'));var zipdir=require(_0x400c('0x2'));var jsonpatch=require(_0x400c('0x3'));var rp=require(_0x400c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x400c('0x5'));var util=require(_0x400c('0x6'));var path=require(_0x400c('0x7'));var sox=require('sox');var csv=require(_0x400c('0x8'));var ejs=require(_0x400c('0x9'));var fs=require('fs');var fs_extra=require(_0x400c('0xa'));var _=require(_0x400c('0xb'));var squel=require(_0x400c('0xc'));var crypto=require(_0x400c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x400c('0xe'));var toCsv=require(_0x400c('0x8'));var querystring=require(_0x400c('0xf'));var Papa=require('papaparse');var Redis=require(_0x400c('0x10'));var authService=require(_0x400c('0x11'));var qs=require(_0x400c('0x12'));var as=require(_0x400c('0x13'));var hardwareService=require(_0x400c('0x14'));var logger=require('../../config/logger')(_0x400c('0x15'));var utils=require(_0x400c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x400c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ab7fa,_0x1ee010){_0x1ee010=_0x1ee010||0xcc;return function(_0x546657){if(_0x546657){return _0x3ab7fa['sendStatus'](_0x1ee010);}return _0x3ab7fa[_0x400c('0x18')](_0x1ee010)[_0x400c('0x19')]();};}function respondWithResult(_0x1093e6,_0x1bfe7a){_0x1bfe7a=_0x1bfe7a||0xc8;return function(_0x5b65c0){if(_0x5b65c0){return _0x1093e6['status'](_0x1bfe7a)[_0x400c('0x1a')](_0x5b65c0);}};}function respondWithFilteredResult(_0x3d183f,_0x49039d){return function(_0x232062){if(_0x232062){var _0x2c27a7=typeof _0x49039d[_0x400c('0x1b')]===_0x400c('0x1c')&&typeof _0x49039d[_0x400c('0x1d')]==='undefined';var _0x5c6aa3=_0x232062['count'];var _0x22e76f=_0x2c27a7?0x0:_0x49039d[_0x400c('0x1b')];var _0x403a64=_0x2c27a7?_0x232062[_0x400c('0x1e')]:_0x49039d[_0x400c('0x1b')]+_0x49039d[_0x400c('0x1d')];var _0x33ae3b;if(_0x403a64>=_0x5c6aa3){_0x403a64=_0x5c6aa3;_0x33ae3b=0xc8;}else{_0x33ae3b=0xce;}_0x3d183f[_0x400c('0x18')](_0x33ae3b);return _0x3d183f[_0x400c('0x1f')](_0x400c('0x20'),_0x22e76f+'-'+_0x403a64+'/'+_0x5c6aa3)[_0x400c('0x1a')](_0x232062);}return null;};}function patchUpdates(_0x17c507){return function(_0x4e137d){try{jsonpatch[_0x400c('0x21')](_0x4e137d,_0x17c507,!![]);}catch(_0x2dc5f1){return BPromise[_0x400c('0x22')](_0x2dc5f1);}return _0x4e137d[_0x400c('0x23')]();};}function saveUpdates(_0x6b1209,_0x125e72){return function(_0x2ca177){if(_0x2ca177){return _0x2ca177[_0x400c('0x24')](_0x6b1209)[_0x400c('0x25')](function(_0x9790e8){return _0x9790e8;});}return null;};}function removeEntity(_0x5efe65,_0x143470){return function(_0x237035){if(_0x237035){return _0x237035[_0x400c('0x26')]()[_0x400c('0x25')](function(){_0x5efe65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ca35,_0x38fe32){return function(_0x401e84){if(!_0x401e84){_0x28ca35[_0x400c('0x27')](0x194);}return _0x401e84;};}function handleError(_0x53b3fb,_0xcf2cb1){_0xcf2cb1=_0xcf2cb1||0x1f4;return function(_0x12905f){logger['error'](_0x12905f[_0x400c('0x28')]);if(_0x12905f[_0x400c('0x29')]){delete _0x12905f['name'];}_0x53b3fb['status'](_0xcf2cb1)[_0x400c('0x2a')](_0x12905f);};}exports[_0x400c('0x2b')]=function(_0x373247,_0x5228bb){var _0x50d11e={},_0x569778={},_0x19acc9={'count':0x0,'rows':[]};var _0x19d338=_[_0x400c('0x2c')](db[_0x400c('0x2d')][_0x400c('0x2e')],function(_0x528ced){return{'name':_0x528ced[_0x400c('0x2f')],'type':_0x528ced[_0x400c('0x30')]['key']};});_0x569778[_0x400c('0x31')]=_[_0x400c('0x2c')](_0x19d338,_0x400c('0x29'));_0x569778[_0x400c('0x32')]=_[_0x400c('0x33')](_0x373247[_0x400c('0x32')]);_0x569778[_0x400c('0x34')]=_['intersection'](_0x569778[_0x400c('0x31')],_0x569778[_0x400c('0x32')]);_0x50d11e[_0x400c('0x35')]=_[_0x400c('0x36')](_0x569778[_0x400c('0x31')],qs[_0x400c('0x37')](_0x373247[_0x400c('0x32')][_0x400c('0x37')]));_0x50d11e[_0x400c('0x35')]=_0x50d11e[_0x400c('0x35')][_0x400c('0x38')]?_0x50d11e[_0x400c('0x35')]:_0x569778[_0x400c('0x31')];if(!_0x373247[_0x400c('0x32')]['hasOwnProperty'](_0x400c('0x39'))){_0x50d11e[_0x400c('0x1d')]=qs[_0x400c('0x1d')](_0x373247[_0x400c('0x32')]['limit']);_0x50d11e[_0x400c('0x1b')]=qs[_0x400c('0x1b')](_0x373247[_0x400c('0x32')][_0x400c('0x1b')]);}_0x50d11e['order']=qs[_0x400c('0x3a')](_0x373247[_0x400c('0x32')][_0x400c('0x3a')]);_0x50d11e[_0x400c('0x3b')]=qs[_0x400c('0x34')](_[_0x400c('0x3c')](_0x373247[_0x400c('0x32')],_0x569778[_0x400c('0x34')]),_0x19d338);if(_0x373247[_0x400c('0x32')]['filter']){_0x50d11e[_0x400c('0x3b')]=_[_0x400c('0x3d')](_0x50d11e[_0x400c('0x3b')],{'$or':_['map'](_0x19d338,function(_0x4d663c){if(_0x4d663c[_0x400c('0x30')]!==_0x400c('0x3e')){var _0x5ee50f={};_0x5ee50f[_0x4d663c[_0x400c('0x29')]]={'$like':'%'+_0x373247[_0x400c('0x32')][_0x400c('0x3f')]+'%'};return _0x5ee50f;}})});}_0x50d11e=_['merge']({},_0x50d11e,_0x373247[_0x400c('0x40')]);var _0xa34771={'where':_0x50d11e[_0x400c('0x3b')]};return db[_0x400c('0x2d')][_0x400c('0x1e')](_0xa34771)[_0x400c('0x25')](function(_0x4b4769){_0x19acc9[_0x400c('0x1e')]=_0x4b4769;if(_0x373247[_0x400c('0x32')]['includeAll']){_0x50d11e[_0x400c('0x41')]=[{'all':!![]}];}return db[_0x400c('0x2d')][_0x400c('0x42')](_0x50d11e);})[_0x400c('0x25')](function(_0x4b2882){_0x19acc9[_0x400c('0x43')]=_0x4b2882;return _0x19acc9;})[_0x400c('0x25')](respondWithFilteredResult(_0x5228bb,_0x50d11e))[_0x400c('0x44')](handleError(_0x5228bb,null));};exports[_0x400c('0x45')]=function(_0x57d009,_0x6a8cbc){var _0x371938={'raw':!![],'where':{'id':_0x57d009['params']['id']}},_0x420864={};_0x420864[_0x400c('0x31')]=_[_0x400c('0x33')](db['ZohoField'][_0x400c('0x2e')]);_0x420864[_0x400c('0x32')]=_[_0x400c('0x33')](_0x57d009['query']);_0x420864[_0x400c('0x34')]=_['intersection'](_0x420864[_0x400c('0x31')],_0x420864[_0x400c('0x32')]);_0x371938[_0x400c('0x35')]=_[_0x400c('0x36')](_0x420864[_0x400c('0x31')],qs[_0x400c('0x37')](_0x57d009[_0x400c('0x32')][_0x400c('0x37')]));_0x371938['attributes']=_0x371938['attributes'][_0x400c('0x38')]?_0x371938[_0x400c('0x35')]:_0x420864[_0x400c('0x31')];if(_0x57d009[_0x400c('0x32')][_0x400c('0x46')]){_0x371938['include']=[{'all':!![]}];}_0x371938=_[_0x400c('0x3d')]({},_0x371938,_0x57d009[_0x400c('0x40')]);return db[_0x400c('0x2d')][_0x400c('0x47')](_0x371938)[_0x400c('0x25')](handleEntityNotFound(_0x6a8cbc,null))[_0x400c('0x25')](respondWithResult(_0x6a8cbc,null))['catch'](handleError(_0x6a8cbc,null));};exports[_0x400c('0x48')]=function(_0xa26417,_0xefa73){return db[_0x400c('0x2d')][_0x400c('0x48')](_0xa26417[_0x400c('0x49')],{})['then'](respondWithResult(_0xefa73,0xc9))[_0x400c('0x44')](handleError(_0xefa73,null));};exports[_0x400c('0x24')]=function(_0x586770,_0x3bd367){if(_0x586770[_0x400c('0x49')]['id']){delete _0x586770['body']['id'];}return db['ZohoField'][_0x400c('0x47')]({'where':{'id':_0x586770[_0x400c('0x4a')]['id']}})[_0x400c('0x25')](handleEntityNotFound(_0x3bd367,null))[_0x400c('0x25')](saveUpdates(_0x586770[_0x400c('0x49')],null))['then'](respondWithResult(_0x3bd367,null))[_0x400c('0x44')](handleError(_0x3bd367,null));};exports['destroy']=function(_0x4c5c78,_0x5c8cd1){return db[_0x400c('0x2d')]['find']({'where':{'id':_0x4c5c78[_0x400c('0x4a')]['id']}})[_0x400c('0x25')](handleEntityNotFound(_0x5c8cd1,null))[_0x400c('0x25')](removeEntity(_0x5c8cd1,null))[_0x400c('0x44')](handleError(_0x5c8cd1,null));}; \ No newline at end of file +var _0xa79a=['set','Content-Range','apply','save','update','then','error','name','send','ZohoField','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x763e8e,_0x3800d2){var _0x130ee2=function(_0x483b9c){while(--_0x483b9c){_0x763e8e['push'](_0x763e8e['shift']());}};_0x130ee2(++_0x3800d2);}(_0xa79a,0x1df));var _0xaa79=function(_0x1422f7,_0x463084){_0x1422f7=_0x1422f7-0x0;var _0x1e9995=_0xa79a[_0x1422f7];return _0x1e9995;};'use strict';var emlformat=require(_0xaa79('0x0'));var rimraf=require(_0xaa79('0x1'));var zipdir=require(_0xaa79('0x2'));var jsonpatch=require(_0xaa79('0x3'));var rp=require(_0xaa79('0x4'));var moment=require(_0xaa79('0x5'));var BPromise=require(_0xaa79('0x6'));var Mustache=require('mustache');var util=require(_0xaa79('0x7'));var path=require(_0xaa79('0x8'));var sox=require(_0xaa79('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa79('0xa'));var squel=require(_0xaa79('0xb'));var crypto=require(_0xaa79('0xc'));var jsforce=require(_0xaa79('0xd'));var deskjs=require(_0xaa79('0xe'));var toCsv=require(_0xaa79('0xf'));var querystring=require(_0xaa79('0x10'));var Papa=require(_0xaa79('0x11'));var Redis=require('ioredis');var authService=require(_0xaa79('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaa79('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaa79('0x14'));var config=require(_0xaa79('0x15'));var licenseUtil=require(_0xaa79('0x16'));var db=require(_0xaa79('0x17'))['db'];function respondWithStatusCode(_0x549580,_0xcc9418){_0xcc9418=_0xcc9418||0xcc;return function(_0x4d450a){if(_0x4d450a){return _0x549580[_0xaa79('0x18')](_0xcc9418);}return _0x549580[_0xaa79('0x19')](_0xcc9418)[_0xaa79('0x1a')]();};}function respondWithResult(_0x4fb40e,_0x2f862e){_0x2f862e=_0x2f862e||0xc8;return function(_0x5e6395){if(_0x5e6395){return _0x4fb40e[_0xaa79('0x19')](_0x2f862e)[_0xaa79('0x1b')](_0x5e6395);}};}function respondWithFilteredResult(_0x4ff9d2,_0x2407ba){return function(_0x5cdcb7){if(_0x5cdcb7){var _0x515721=typeof _0x2407ba[_0xaa79('0x1c')]===_0xaa79('0x1d')&&typeof _0x2407ba[_0xaa79('0x1e')]===_0xaa79('0x1d');var _0x110e9a=_0x5cdcb7['count'];var _0xd9f148=_0x515721?0x0:_0x2407ba['offset'];var _0x4d2b01=_0x515721?_0x5cdcb7[_0xaa79('0x1f')]:_0x2407ba[_0xaa79('0x1c')]+_0x2407ba['limit'];var _0x480cb4;if(_0x4d2b01>=_0x110e9a){_0x4d2b01=_0x110e9a;_0x480cb4=0xc8;}else{_0x480cb4=0xce;}_0x4ff9d2[_0xaa79('0x19')](_0x480cb4);return _0x4ff9d2[_0xaa79('0x20')](_0xaa79('0x21'),_0xd9f148+'-'+_0x4d2b01+'/'+_0x110e9a)[_0xaa79('0x1b')](_0x5cdcb7);}return null;};}function patchUpdates(_0x105fec){return function(_0x10c0ee){try{jsonpatch[_0xaa79('0x22')](_0x10c0ee,_0x105fec,!![]);}catch(_0x45778a){return BPromise['reject'](_0x45778a);}return _0x10c0ee[_0xaa79('0x23')]();};}function saveUpdates(_0x3b4a67,_0x48b3ff){return function(_0x1b49da){if(_0x1b49da){return _0x1b49da[_0xaa79('0x24')](_0x3b4a67)[_0xaa79('0x25')](function(_0x171931){return _0x171931;});}return null;};}function removeEntity(_0x157123,_0x3461db){return function(_0x35e6d3){if(_0x35e6d3){return _0x35e6d3['destroy']()['then'](function(){_0x157123[_0xaa79('0x19')](0xcc)[_0xaa79('0x1a')]();});}};}function handleEntityNotFound(_0x468f65,_0x3d2a62){return function(_0x47cb92){if(!_0x47cb92){_0x468f65[_0xaa79('0x18')](0x194);}return _0x47cb92;};}function handleError(_0x3ba8c,_0x4a4045){_0x4a4045=_0x4a4045||0x1f4;return function(_0x2301da){logger[_0xaa79('0x26')](_0x2301da['stack']);if(_0x2301da[_0xaa79('0x27')]){delete _0x2301da[_0xaa79('0x27')];}_0x3ba8c[_0xaa79('0x19')](_0x4a4045)[_0xaa79('0x28')](_0x2301da);};}exports['index']=function(_0x2bf2d9,_0x27f3a2){var _0x23be59={},_0x43c467={},_0x4784d3={'count':0x0,'rows':[]};var _0x134429=_['map'](db[_0xaa79('0x29')][_0xaa79('0x2a')],function(_0x91ab17){return{'name':_0x91ab17[_0xaa79('0x2b')],'type':_0x91ab17[_0xaa79('0x2c')]['key']};});_0x43c467[_0xaa79('0x2d')]=_[_0xaa79('0x2e')](_0x134429,_0xaa79('0x27'));_0x43c467['query']=_['keys'](_0x2bf2d9[_0xaa79('0x2f')]);_0x43c467[_0xaa79('0x30')]=_[_0xaa79('0x31')](_0x43c467[_0xaa79('0x2d')],_0x43c467[_0xaa79('0x2f')]);_0x23be59[_0xaa79('0x32')]=_[_0xaa79('0x31')](_0x43c467[_0xaa79('0x2d')],qs[_0xaa79('0x33')](_0x2bf2d9[_0xaa79('0x2f')][_0xaa79('0x33')]));_0x23be59['attributes']=_0x23be59[_0xaa79('0x32')][_0xaa79('0x34')]?_0x23be59[_0xaa79('0x32')]:_0x43c467[_0xaa79('0x2d')];if(!_0x2bf2d9[_0xaa79('0x2f')][_0xaa79('0x35')](_0xaa79('0x36'))){_0x23be59[_0xaa79('0x1e')]=qs['limit'](_0x2bf2d9['query'][_0xaa79('0x1e')]);_0x23be59[_0xaa79('0x1c')]=qs[_0xaa79('0x1c')](_0x2bf2d9['query'][_0xaa79('0x1c')]);}_0x23be59[_0xaa79('0x37')]=qs[_0xaa79('0x38')](_0x2bf2d9['query']['sort']);_0x23be59[_0xaa79('0x39')]=qs['filters'](_[_0xaa79('0x3a')](_0x2bf2d9[_0xaa79('0x2f')],_0x43c467[_0xaa79('0x30')]),_0x134429);if(_0x2bf2d9[_0xaa79('0x2f')][_0xaa79('0x3b')]){_0x23be59['where']=_['merge'](_0x23be59[_0xaa79('0x39')],{'$or':_['map'](_0x134429,function(_0x330388){if(_0x330388[_0xaa79('0x2c')]!==_0xaa79('0x3c')){var _0x47a023={};_0x47a023[_0x330388[_0xaa79('0x27')]]={'$like':'%'+_0x2bf2d9[_0xaa79('0x2f')][_0xaa79('0x3b')]+'%'};return _0x47a023;}})});}_0x23be59=_['merge']({},_0x23be59,_0x2bf2d9[_0xaa79('0x3d')]);var _0xf9d58f={'where':_0x23be59[_0xaa79('0x39')]};return db['ZohoField'][_0xaa79('0x1f')](_0xf9d58f)['then'](function(_0x1f39d5){_0x4784d3[_0xaa79('0x1f')]=_0x1f39d5;if(_0x2bf2d9['query'][_0xaa79('0x3e')]){_0x23be59[_0xaa79('0x3f')]=[{'all':!![]}];}return db[_0xaa79('0x29')]['findAll'](_0x23be59);})[_0xaa79('0x25')](function(_0x339f42){_0x4784d3[_0xaa79('0x40')]=_0x339f42;return _0x4784d3;})[_0xaa79('0x25')](respondWithFilteredResult(_0x27f3a2,_0x23be59))[_0xaa79('0x41')](handleError(_0x27f3a2,null));};exports[_0xaa79('0x42')]=function(_0xaa6984,_0x9cd65e){var _0x221fac={'raw':!![],'where':{'id':_0xaa6984[_0xaa79('0x43')]['id']}},_0x309cc1={};_0x309cc1[_0xaa79('0x2d')]=_[_0xaa79('0x44')](db['ZohoField']['rawAttributes']);_0x309cc1[_0xaa79('0x2f')]=_[_0xaa79('0x44')](_0xaa6984[_0xaa79('0x2f')]);_0x309cc1[_0xaa79('0x30')]=_[_0xaa79('0x31')](_0x309cc1[_0xaa79('0x2d')],_0x309cc1[_0xaa79('0x2f')]);_0x221fac[_0xaa79('0x32')]=_[_0xaa79('0x31')](_0x309cc1[_0xaa79('0x2d')],qs[_0xaa79('0x33')](_0xaa6984[_0xaa79('0x2f')][_0xaa79('0x33')]));_0x221fac[_0xaa79('0x32')]=_0x221fac[_0xaa79('0x32')][_0xaa79('0x34')]?_0x221fac[_0xaa79('0x32')]:_0x309cc1[_0xaa79('0x2d')];if(_0xaa6984[_0xaa79('0x2f')][_0xaa79('0x3e')]){_0x221fac[_0xaa79('0x3f')]=[{'all':!![]}];}_0x221fac=_[_0xaa79('0x45')]({},_0x221fac,_0xaa6984['options']);return db[_0xaa79('0x29')][_0xaa79('0x46')](_0x221fac)[_0xaa79('0x25')](handleEntityNotFound(_0x9cd65e,null))[_0xaa79('0x25')](respondWithResult(_0x9cd65e,null))[_0xaa79('0x41')](handleError(_0x9cd65e,null));};exports[_0xaa79('0x47')]=function(_0x339bab,_0x3d7e68){return db[_0xaa79('0x29')]['create'](_0x339bab[_0xaa79('0x48')],{})['then'](respondWithResult(_0x3d7e68,0xc9))[_0xaa79('0x41')](handleError(_0x3d7e68,null));};exports[_0xaa79('0x24')]=function(_0x36e39c,_0x5bdcbc){if(_0x36e39c[_0xaa79('0x48')]['id']){delete _0x36e39c[_0xaa79('0x48')]['id'];}return db[_0xaa79('0x29')]['find']({'where':{'id':_0x36e39c['params']['id']}})['then'](handleEntityNotFound(_0x5bdcbc,null))['then'](saveUpdates(_0x36e39c[_0xaa79('0x48')],null))[_0xaa79('0x25')](respondWithResult(_0x5bdcbc,null))['catch'](handleError(_0x5bdcbc,null));};exports['destroy']=function(_0x584180,_0x12ec03){return db[_0xaa79('0x29')][_0xaa79('0x46')]({'where':{'id':_0x584180[_0xaa79('0x43')]['id']}})[_0xaa79('0x25')](handleEntityNotFound(_0x12ec03,null))['then'](removeEntity(_0x12ec03,null))['catch'](handleError(_0x12ec03,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ba95544..13a5e60 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['int_zoho_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x32b6,0x1d1));var _0x632b=function(_0x1f38e0,_0x33e598){_0x1f38e0=_0x1f38e0-0x0;var _0x15c07e=_0x32b6[_0x1f38e0];return _0x15c07e;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x632b('0xc'),_0x632b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x19fa9b,_0x2a6bf6){var _0x406eb=function(_0x30b5da){while(--_0x30b5da){_0x19fa9b['push'](_0x19fa9b['shift']());}};_0x406eb(++_0x2a6bf6);}(_0x82c4,0x1ca));var _0x482c=function(_0x1f0714,_0xde0530){_0x1f0714=_0x1f0714-0x0;var _0x33669d=_0x82c4[_0x1f0714];return _0x33669d;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 687a6f6..a493cb3 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 _0xefc3=['jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0xefc3,0x80));var _0x3efc=function(_0x155cb2,_0x46daf2){_0x155cb2=_0x155cb2-0x0;var _0x341ba4=_0xefc3[_0x155cb2];return _0x341ba4;};'use strict';var _=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var moment=require(_0x3efc('0x2'));var BPromise=require(_0x3efc('0x3'));var rs=require(_0x3efc('0x4'));var fs=require('fs');var Redis=require(_0x3efc('0x5'));var db=require(_0x3efc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3efc('0x7'))(_0x3efc('0x8'));var config=require(_0x3efc('0x9'));var jayson=require(_0x3efc('0xa'));var client=jayson[_0x3efc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab9728,_0x58e2c8,_0x1d39eb){return new BPromise(function(_0x3b2fac,_0x2ce1a9){return client[_0x3efc('0xc')](_0xab9728,_0x1d39eb)[_0x3efc('0xd')](function(_0xeb76a1){logger[_0x3efc('0xe')](_0x3efc('0xf'),_0x58e2c8,'request\x20sent');logger['debug'](_0x3efc('0x10'),_0x58e2c8,_0x3efc('0x11'),JSON[_0x3efc('0x12')](_0xeb76a1));if(_0xeb76a1[_0x3efc('0x13')]){if(_0xeb76a1[_0x3efc('0x13')][_0x3efc('0x14')]===0x1f4){logger['error'](_0x3efc('0xf'),_0x58e2c8,_0xeb76a1[_0x3efc('0x13')][_0x3efc('0x15')]);return _0x2ce1a9(_0xeb76a1['error'][_0x3efc('0x15')]);}logger[_0x3efc('0x13')]('ZohoField,\x20%s,\x20%s',_0x58e2c8,_0xeb76a1[_0x3efc('0x13')][_0x3efc('0x15')]);return _0x3b2fac(_0xeb76a1[_0x3efc('0x13')][_0x3efc('0x15')]);}else{logger['info'](_0x3efc('0xf'),_0x58e2c8,'request\x20sent');_0x3b2fac(_0xeb76a1[_0x3efc('0x16')][_0x3efc('0x15')]);}})['catch'](function(_0x201f51){logger[_0x3efc('0x13')](_0x3efc('0xf'),_0x58e2c8,_0x201f51);_0x2ce1a9(_0x201f51);});});} \ No newline at end of file +var _0x304d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message'];(function(_0x3ec741,_0x1970b4){var _0x24a6b8=function(_0x58360b){while(--_0x58360b){_0x3ec741['push'](_0x3ec741['shift']());}};_0x24a6b8(++_0x1970b4);}(_0x304d,0x1b7));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd304('0x7'));var config=require(_0xd304('0x8'));var jayson=require(_0xd304('0x9'));var client=jayson[_0xd304('0xa')][_0xd304('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1411d4,_0x46a3f1,_0xee24f7){return new BPromise(function(_0x876f79,_0x2332ad){return client[_0xd304('0xc')](_0x1411d4,_0xee24f7)[_0xd304('0xd')](function(_0x2c3b5b){logger[_0xd304('0xe')]('ZohoField,\x20%s,\x20%s',_0x46a3f1,_0xd304('0xf'));logger['debug'](_0xd304('0x10'),_0x46a3f1,_0xd304('0xf'),JSON[_0xd304('0x11')](_0x2c3b5b));if(_0x2c3b5b[_0xd304('0x12')]){if(_0x2c3b5b[_0xd304('0x12')]['code']===0x1f4){logger[_0xd304('0x12')](_0xd304('0x13'),_0x46a3f1,_0x2c3b5b[_0xd304('0x12')][_0xd304('0x14')]);return _0x2332ad(_0x2c3b5b[_0xd304('0x12')][_0xd304('0x14')]);}logger[_0xd304('0x12')](_0xd304('0x13'),_0x46a3f1,_0x2c3b5b['error'][_0xd304('0x14')]);return _0x876f79(_0x2c3b5b['error'][_0xd304('0x14')]);}else{logger[_0xd304('0xe')](_0xd304('0x13'),_0x46a3f1,'request\x20sent');_0x876f79(_0x2c3b5b[_0xd304('0x15')][_0xd304('0x14')]);}})[_0xd304('0x16')](function(_0x2eeb48){logger[_0xd304('0x12')](_0xd304('0x13'),_0x46a3f1,_0x2eeb48);_0x2332ad(_0x2eeb48);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 311fd00..42ba248 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x167b19,_0x2a07a9){var _0x45dbba=function(_0x4e26de){while(--_0x4e26de){_0x167b19['push'](_0x167b19['shift']());}};_0x45dbba(++_0x2a07a9);}(_0xe706,0xa3));var _0x6e70=function(_0x456b45,_0x273834){_0x456b45=_0x456b45-0x0;var _0xe3627d=_0xe706[_0x456b45];return _0xe3627d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x34a3e2,_0x2fa1a2){var _0x128917=function(_0x3a81df){while(--_0x3a81df){_0x34a3e2['push'](_0x34a3e2['shift']());}};_0x128917(++_0x2fa1a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xcb91[_0x3a04ab];return _0x4bff6d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8afc215..08b5526 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 _0xe9f6=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state','sequelize'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xe9f6,0x11e));var _0x6e9f=function(_0x168259,_0x1cae81){_0x168259=_0x168259-0x0;var _0x5d564c=_0xe9f6[_0x168259];return _0x5d564c;};'use strict';var Sequelize=require(_0x6e9f('0x0'));module[_0x6e9f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x6e9f('0x2')],'allowNull':![],'unique':_0x6e9f('0x3')},'main':{'type':Sequelize[_0x6e9f('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6e9f('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x6e9f('0x4')]},'active':{'type':Sequelize[_0x6e9f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x6e9f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x6e9f('0x2')],'unique':_0x6e9f('0x6')},'description':{'type':Sequelize[_0x6e9f('0x2')]},'title':{'type':Sequelize[_0x6e9f('0x2')]},'remoteUri':{'type':Sequelize[_0x6e9f('0x2')]},'link':{'type':Sequelize[_0x6e9f('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4998=['STRING','INTEGER','state','sequelize','exports','unique_name_and_version','app.js'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x4998,0x168));var _0x8499=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x4998[_0xcfeda9];return _0x4826c7;};'use strict';var Sequelize=require(_0x8499('0x0'));module[_0x8499('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8499('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8499('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x8499('0x3')},'filename':{'type':Sequelize[_0x8499('0x4')]},'path':{'type':Sequelize[_0x8499('0x4')]},'type':{'type':Sequelize[_0x8499('0x4')]},'size':{'type':Sequelize[_0x8499('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x8499('0x4')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x8499('0x4')],'unique':_0x8499('0x6')},'description':{'type':Sequelize[_0x8499('0x4')]},'title':{'type':Sequelize[_0x8499('0x4')]},'remoteUri':{'type':Sequelize[_0x8499('0x4')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a81ccbe..01b5e02 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x25de03,_0x437169){var _0x5a9d67=function(_0x29b06e){while(--_0x29b06e){_0x25de03['push'](_0x25de03['shift']());}};_0x5a9d67(++_0x437169);}(_0x33af,0xec));var _0xf33a=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x33af[_0x1a21ff];return _0x25afc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['Integration'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file +var _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x5a42a0,_0x1f7de9){var _0x49c03d=function(_0x3dd324){while(--_0x3dd324){_0x5a42a0['push'](_0x5a42a0['shift']());}};_0x49c03d(++_0x1f7de9);}(_0x33af,0xec));var _0xf33a=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x33af[_0xd299c3];return _0x376574;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['Integration'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0bb5a67..a349bdd 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 _0x84de=['./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x84de,0xf4));var _0xe84d=function(_0x5654ef,_0x1ddf03){_0x5654ef=_0x5654ef-0x0;var _0x40fee1=_0x84de[_0x5654ef];return _0x40fee1;};'use strict';var _=require(_0xe84d('0x0'));var util=require('util');var logger=require(_0xe84d('0x1'))('api');var moment=require(_0xe84d('0x2'));var BPromise=require(_0xe84d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe84d('0x4'));var rimraf=require('rimraf');var config=require(_0xe84d('0x5'));var attributes=require(_0xe84d('0x6'));module[_0xe84d('0x7')]=function(_0x4921f6,_0x3767b1){return _0x4921f6['define'](_0xe84d('0x8'),attributes,{'tableName':_0xe84d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d81=['api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','../../config/logger'];(function(_0x5bee71,_0xd6aa70){var _0x194444=function(_0x47c148){while(--_0x47c148){_0x5bee71['push'](_0x5bee71['shift']());}};_0x194444(++_0xd6aa70);}(_0x0d81,0x12a));var _0x10d8=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0x0d81[_0x48a96f];return _0x3ff3ef;};'use strict';var _=require(_0x10d8('0x0'));var util=require('util');var logger=require(_0x10d8('0x1'))(_0x10d8('0x2'));var moment=require('moment');var BPromise=require(_0x10d8('0x3'));var rp=require(_0x10d8('0x4'));var fs=require('fs');var path=require(_0x10d8('0x5'));var rimraf=require(_0x10d8('0x6'));var config=require(_0x10d8('0x7'));var attributes=require(_0x10d8('0x8'));module[_0x10d8('0x9')]=function(_0x4a2bc3,_0x4555ae){return _0x4a2bc3['define'](_0x10d8('0xa'),attributes,{'tableName':_0x10d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a189421..7473be6 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4efd89,_0x1457db){var _0x64a2b3=function(_0x3f4a1f){while(--_0x3f4a1f){_0x4efd89['push'](_0x4efd89['shift']());}};_0x64a2b3(++_0x1457db);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4ccfd3,_0x377b24){var _0x1b5ce7=function(_0x220db0){while(--_0x220db0){_0x4ccfd3['push'](_0x4ccfd3['shift']());}};_0x1b5ce7(++_0x377b24);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3341d2,_0x2dac28){_0x3341d2=_0x3341d2-0x0;var _0x5367ef=_0x5f2f[_0x3341d2];return _0x5367ef;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index baa9ed2..9546db0 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x3559c4,_0x47580b){var _0x124053=function(_0x2edf1){while(--_0x2edf1){_0x3559c4['push'](_0x3559c4['shift']());}};_0x124053(++_0x47580b);}(_0x1a85,0x178));var _0x51a8=function(_0x4d62bc,_0x393272){_0x4d62bc=_0x4d62bc-0x0;var _0x1dea32=_0x1a85[_0x4d62bc];return _0x1dea32;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 31f33da..e75e7b5 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 _0x1fdf=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x1fdf,0x18f));var _0xf1fd=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x1fdf[_0x5380cd];return _0x25dd61;};'use strict';var Sequelize=require(_0xf1fd('0x0'));module[_0xf1fd('0x1')]={'integration':{'type':Sequelize[_0xf1fd('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xf1fd('0x2')]},'ticketId':{'type':Sequelize[_0xf1fd('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xf1fd('0x2')]},'uniqueid':{'type':Sequelize[_0xf1fd('0x2')]},'calleridnum':{'type':Sequelize[_0xf1fd('0x2')]},'calleridname':{'type':Sequelize[_0xf1fd('0x2')]},'queue':{'type':Sequelize[_0xf1fd('0x2')]},'interface':{'type':Sequelize[_0xf1fd('0x2')]},'membername':{'type':Sequelize[_0xf1fd('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf1fd('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf1fd('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf1fd('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf1fd('0x3')]},'talktime':{'type':Sequelize[_0xf1fd('0x5')]},'agentacw':{'type':Sequelize[_0xf1fd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf1fd('0x5')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf1fd('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf1fd('0x3')]},'agentdump':{'type':Sequelize[_0xf1fd('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf1fd('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf1fd('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf1fd('0x2')]},'connectedlinename':{'type':Sequelize[_0xf1fd('0x2')]},'language':{'type':Sequelize[_0xf1fd('0x2')]},'accountcode':{'type':Sequelize[_0xf1fd('0x2')]},'context':{'type':Sequelize[_0xf1fd('0x2')]},'exten':{'type':Sequelize[_0xf1fd('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf1fd('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf1fd('0x2')]},'destcalleridname':{'type':Sequelize[_0xf1fd('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf1fd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf1fd('0x2')]},'destlanguage':{'type':Sequelize[_0xf1fd('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf1fd('0x2')]},'destpriority':{'type':Sequelize[_0xf1fd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf1fd('0x2')]},'inReplyTo':{'type':Sequelize[_0xf1fd('0x2')]},'subject':{'type':Sequelize[_0xf1fd('0x2')]},'from':{'type':Sequelize[_0xf1fd('0x2')]},'to':{'type':Sequelize[_0xf1fd('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf1fd('0x6')]},'html':{'type':Sequelize[_0xf1fd('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf1fd('0x7')]('SENT',_0xf1fd('0x8'),_0xf1fd('0x9'),_0xf1fd('0xa'))},'url':{'type':Sequelize[_0xf1fd('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf1fd('0x2')]},'projectId':{'type':Sequelize[_0xf1fd('0x5')]}}; \ No newline at end of file +var _0xa715=['TEXT','ENUM','SENT','RECEIVED','FAILED','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xa715,0xe6));var _0x5a71=function(_0x207f4f,_0x28daee){_0x207f4f=_0x207f4f-0x0;var _0x2c0a7a=_0xa715[_0x207f4f];return _0x2c0a7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x5a71('0x0')]},'eventChannel':{'type':Sequelize[_0x5a71('0x0')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5a71('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x5a71('0x0')]},'uniqueid':{'type':Sequelize[_0x5a71('0x0')]},'calleridnum':{'type':Sequelize[_0x5a71('0x0')]},'calleridname':{'type':Sequelize[_0x5a71('0x0')]},'queue':{'type':Sequelize[_0x5a71('0x0')]},'interface':{'type':Sequelize[_0x5a71('0x0')]},'membername':{'type':Sequelize[_0x5a71('0x0')]},'agentcalledAt':{'type':Sequelize[_0x5a71('0x1')]},'agentconnectAt':{'type':Sequelize[_0x5a71('0x1')]},'holdtime':{'type':Sequelize[_0x5a71('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5a71('0x1')]},'talktime':{'type':Sequelize[_0x5a71('0x2')]},'agentacw':{'type':Sequelize[_0x5a71('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5a71('0x2')]},'reason':{'type':Sequelize[_0x5a71('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5a71('0x1')]},'agentdump':{'type':Sequelize[_0x5a71('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5a71('0x1')]},'lastevent':{'type':Sequelize[_0x5a71('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5a71('0x0')]},'connectedlinenum':{'type':Sequelize[_0x5a71('0x0')]},'connectedlinename':{'type':Sequelize[_0x5a71('0x0')]},'language':{'type':Sequelize[_0x5a71('0x0')]},'accountcode':{'type':Sequelize[_0x5a71('0x0')]},'context':{'type':Sequelize[_0x5a71('0x0')]},'exten':{'type':Sequelize[_0x5a71('0x0')]},'priority':{'type':Sequelize[_0x5a71('0x0')]},'destchannel':{'type':Sequelize[_0x5a71('0x0')]},'destchannelstate':{'type':Sequelize[_0x5a71('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x5a71('0x0')]},'destcalleridnum':{'type':Sequelize[_0x5a71('0x0')]},'destcalleridname':{'type':Sequelize[_0x5a71('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x5a71('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x5a71('0x0')]},'destlanguage':{'type':Sequelize[_0x5a71('0x0')]},'destaccountcode':{'type':Sequelize[_0x5a71('0x0')]},'destcontext':{'type':Sequelize[_0x5a71('0x0')]},'destexten':{'type':Sequelize[_0x5a71('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5a71('0x0')]},'messageId':{'type':Sequelize[_0x5a71('0x0')]},'inReplyTo':{'type':Sequelize[_0x5a71('0x0')]},'subject':{'type':Sequelize[_0x5a71('0x0')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5a71('0x0')]},'cc':{'type':Sequelize[_0x5a71('0x0')]},'attachment':{'type':Sequelize[_0x5a71('0x4')]},'html':{'type':Sequelize[_0x5a71('0x4')]},'text':{'type':Sequelize[_0x5a71('0x4')]},'status':{'type':Sequelize[_0x5a71('0x5')](_0x5a71('0x6'),'SENDING',_0x5a71('0x7'),_0x5a71('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5a71('0x0')]},'appdata':{'type':Sequelize[_0x5a71('0x0')]},'projectId':{'type':Sequelize[_0x5a71('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 465547a..23c9710 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 _0xf66d=['save','then','destroy','sendStatus','error','stack','send','map','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','eml-format','rimraf','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','set','json','apply','reject'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xf66d,0x1e6));var _0xdf66=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf66d[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0xdf66('0x0'));var rimraf=require(_0xdf66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf66('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf66('0x3'));var path=require('path');var sox=require(_0xdf66('0x4'));var csv=require(_0xdf66('0x5'));var ejs=require(_0xdf66('0x6'));var fs=require('fs');var fs_extra=require(_0xdf66('0x7'));var _=require(_0xdf66('0x8'));var squel=require(_0xdf66('0x9'));var crypto=require(_0xdf66('0xa'));var jsforce=require(_0xdf66('0xb'));var deskjs=require(_0xdf66('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdf66('0xd'));var Papa=require(_0xdf66('0xe'));var Redis=require(_0xdf66('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdf66('0x10'));var as=require(_0xdf66('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf66('0x12'))(_0xdf66('0x13'));var utils=require(_0xdf66('0x14'));var config=require(_0xdf66('0x15'));var licenseUtil=require(_0xdf66('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x495a97,_0x551437){_0x551437=_0x551437||0xcc;return function(_0x4f910a){if(_0x4f910a){return _0x495a97['sendStatus'](_0x551437);}return _0x495a97[_0xdf66('0x17')](_0x551437)[_0xdf66('0x18')]();};}function respondWithResult(_0x86eb0a,_0x3e6319){_0x3e6319=_0x3e6319||0xc8;return function(_0x2d5ebf){if(_0x2d5ebf){return _0x86eb0a['status'](_0x3e6319)['json'](_0x2d5ebf);}};}function respondWithFilteredResult(_0x84d9f1,_0x28d4ab){return function(_0x1c03b5){if(_0x1c03b5){var _0x3e8d66=typeof _0x28d4ab['offset']===_0xdf66('0x19')&&typeof _0x28d4ab[_0xdf66('0x1a')]===_0xdf66('0x19');var _0x1f6c55=_0x1c03b5[_0xdf66('0x1b')];var _0x30345e=_0x3e8d66?0x0:_0x28d4ab['offset'];var _0x139284=_0x3e8d66?_0x1c03b5[_0xdf66('0x1b')]:_0x28d4ab['offset']+_0x28d4ab[_0xdf66('0x1a')];var _0xb2fd5b;if(_0x139284>=_0x1f6c55){_0x139284=_0x1f6c55;_0xb2fd5b=0xc8;}else{_0xb2fd5b=0xce;}_0x84d9f1[_0xdf66('0x17')](_0xb2fd5b);return _0x84d9f1[_0xdf66('0x1c')]('Content-Range',_0x30345e+'-'+_0x139284+'/'+_0x1f6c55)[_0xdf66('0x1d')](_0x1c03b5);}return null;};}function patchUpdates(_0x41c879){return function(_0x216286){try{jsonpatch[_0xdf66('0x1e')](_0x216286,_0x41c879,!![]);}catch(_0x26cd0a){return BPromise[_0xdf66('0x1f')](_0x26cd0a);}return _0x216286[_0xdf66('0x20')]();};}function saveUpdates(_0x237d0f,_0x5b5a50){return function(_0x38019c){if(_0x38019c){return _0x38019c['update'](_0x237d0f)[_0xdf66('0x21')](function(_0x2514a2){return _0x2514a2;});}return null;};}function removeEntity(_0x362c74,_0x1e7314){return function(_0x167dd7){if(_0x167dd7){return _0x167dd7[_0xdf66('0x22')]()['then'](function(){_0x362c74[_0xdf66('0x17')](0xcc)[_0xdf66('0x18')]();});}};}function handleEntityNotFound(_0x1e4f44,_0x258b6c){return function(_0x4bca85){if(!_0x4bca85){_0x1e4f44[_0xdf66('0x23')](0x194);}return _0x4bca85;};}function handleError(_0x2f626f,_0x2d4303){_0x2d4303=_0x2d4303||0x1f4;return function(_0x36c208){logger[_0xdf66('0x24')](_0x36c208[_0xdf66('0x25')]);if(_0x36c208['name']){delete _0x36c208['name'];}_0x2f626f[_0xdf66('0x17')](_0x2d4303)[_0xdf66('0x26')](_0x36c208);};}exports['index']=function(_0x24e615,_0x4e7f7c){var _0x14e226={},_0x38e07d={},_0x297dc5={'count':0x0,'rows':[]};var _0x265886=_[_0xdf66('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x189cf3){return{'name':_0x189cf3[_0xdf66('0x28')],'type':_0x189cf3['type'][_0xdf66('0x29')]};});_0x38e07d[_0xdf66('0x2a')]=_['map'](_0x265886,_0xdf66('0x2b'));_0x38e07d[_0xdf66('0x2c')]=_[_0xdf66('0x2d')](_0x24e615[_0xdf66('0x2c')]);_0x38e07d[_0xdf66('0x2e')]=_[_0xdf66('0x2f')](_0x38e07d['model'],_0x38e07d[_0xdf66('0x2c')]);_0x14e226[_0xdf66('0x30')]=_[_0xdf66('0x2f')](_0x38e07d[_0xdf66('0x2a')],qs[_0xdf66('0x31')](_0x24e615[_0xdf66('0x2c')]['fields']));_0x14e226[_0xdf66('0x30')]=_0x14e226[_0xdf66('0x30')][_0xdf66('0x32')]?_0x14e226[_0xdf66('0x30')]:_0x38e07d['model'];if(!_0x24e615[_0xdf66('0x2c')][_0xdf66('0x33')](_0xdf66('0x34'))){_0x14e226[_0xdf66('0x1a')]=qs[_0xdf66('0x1a')](_0x24e615[_0xdf66('0x2c')]['limit']);_0x14e226[_0xdf66('0x35')]=qs[_0xdf66('0x35')](_0x24e615[_0xdf66('0x2c')]['offset']);}_0x14e226[_0xdf66('0x36')]=qs['sort'](_0x24e615[_0xdf66('0x2c')]['sort']);_0x14e226[_0xdf66('0x37')]=qs['filters'](_[_0xdf66('0x38')](_0x24e615[_0xdf66('0x2c')],_0x38e07d['filters']),_0x265886);if(_0x24e615[_0xdf66('0x2c')][_0xdf66('0x39')]){_0x14e226[_0xdf66('0x37')]=_[_0xdf66('0x3a')](_0x14e226[_0xdf66('0x37')],{'$or':_['map'](_0x265886,function(_0x1e4a35){if(_0x1e4a35[_0xdf66('0x3b')]!==_0xdf66('0x3c')){var _0x1ad1e8={};_0x1ad1e8[_0x1e4a35[_0xdf66('0x2b')]]={'$like':'%'+_0x24e615[_0xdf66('0x2c')][_0xdf66('0x39')]+'%'};return _0x1ad1e8;}})});}_0x14e226=_[_0xdf66('0x3a')]({},_0x14e226,_0x24e615[_0xdf66('0x3d')]);var _0x164426={'where':_0x14e226[_0xdf66('0x37')]};return db[_0xdf66('0x3e')]['count'](_0x164426)[_0xdf66('0x21')](function(_0x14b221){_0x297dc5['count']=_0x14b221;if(_0x24e615[_0xdf66('0x2c')][_0xdf66('0x3f')]){_0x14e226['include']=[{'all':!![]}];}return db[_0xdf66('0x3e')][_0xdf66('0x40')](_0x14e226);})[_0xdf66('0x21')](function(_0x3408ad){_0x297dc5[_0xdf66('0x41')]=_0x3408ad;return _0x297dc5;})[_0xdf66('0x21')](respondWithFilteredResult(_0x4e7f7c,_0x14e226))[_0xdf66('0x42')](handleError(_0x4e7f7c,null));};exports['show']=function(_0x1de232,_0x11fa85){var _0x575c9={'raw':![],'where':{'id':_0x1de232[_0xdf66('0x43')]['id']}},_0x1f2bc0={};_0x1f2bc0[_0xdf66('0x2a')]=_[_0xdf66('0x2d')](db[_0xdf66('0x3e')]['rawAttributes']);_0x1f2bc0[_0xdf66('0x2c')]=_[_0xdf66('0x2d')](_0x1de232['query']);_0x1f2bc0[_0xdf66('0x2e')]=_['intersection'](_0x1f2bc0['model'],_0x1f2bc0[_0xdf66('0x2c')]);_0x575c9['attributes']=_[_0xdf66('0x2f')](_0x1f2bc0[_0xdf66('0x2a')],qs[_0xdf66('0x31')](_0x1de232['query']['fields']));_0x575c9[_0xdf66('0x30')]=_0x575c9[_0xdf66('0x30')]['length']?_0x575c9[_0xdf66('0x30')]:_0x1f2bc0[_0xdf66('0x2a')];if(_0x1de232[_0xdf66('0x2c')][_0xdf66('0x3f')]){_0x575c9[_0xdf66('0x44')]=[{'all':!![]}];}_0x575c9=_[_0xdf66('0x3a')]({},_0x575c9,_0x1de232[_0xdf66('0x3d')]);return db[_0xdf66('0x3e')][_0xdf66('0x45')](_0x575c9)[_0xdf66('0x21')](handleEntityNotFound(_0x11fa85,null))[_0xdf66('0x21')](respondWithResult(_0x11fa85,null))['catch'](handleError(_0x11fa85,null));};exports[_0xdf66('0x46')]=function(_0x3d959c,_0x6f989d){return db[_0xdf66('0x3e')][_0xdf66('0x46')](_0x3d959c[_0xdf66('0x47')],{})[_0xdf66('0x21')](respondWithResult(_0x6f989d,0xc9))[_0xdf66('0x42')](handleError(_0x6f989d,null));};exports[_0xdf66('0x48')]=function(_0x8fc677,_0x5b2706){if(_0x8fc677['body']['id']){delete _0x8fc677[_0xdf66('0x47')]['id'];}return db[_0xdf66('0x3e')][_0xdf66('0x45')]({'where':{'id':_0x8fc677['params']['id']}})['then'](handleEntityNotFound(_0x5b2706,null))[_0xdf66('0x21')](saveUpdates(_0x8fc677[_0xdf66('0x47')],null))[_0xdf66('0x21')](respondWithResult(_0x5b2706,null))[_0xdf66('0x42')](handleError(_0x5b2706,null));};exports[_0xdf66('0x22')]=function(_0x4eabc1,_0x3e1ee5){return db[_0xdf66('0x3e')]['find']({'where':{'id':_0x4eabc1['params']['id']}})[_0xdf66('0x21')](handleEntityNotFound(_0x3e1ee5,null))[_0xdf66('0x21')](removeEntity(_0x3e1ee5,null))[_0xdf66('0x42')](handleError(_0x3e1ee5,null));};exports[_0xdf66('0x49')]=function(_0x45c04c,_0x1f0453){return db[_0xdf66('0x3e')][_0xdf66('0x49')]()[_0xdf66('0x21')](respondWithResult(_0x1f0453,null))['catch'](handleError(_0x1f0453,null));}; \ No newline at end of file +var _0xb5d8=['includeAll','include','findAll','rows','catch','show','params','length','create','body','find','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','pick','where','merge','map','VIRTUAL','filter','options'];(function(_0x122fdc,_0x12510a){var _0x54f372=function(_0x3590f0){while(--_0x3590f0){_0x122fdc['push'](_0x122fdc['shift']());}};_0x54f372(++_0x12510a);}(_0xb5d8,0x13b));var _0x8b5d=function(_0x3adec8,_0x197d5d){_0x3adec8=_0x3adec8-0x0;var _0x390fdf=_0xb5d8[_0x3adec8];return _0x390fdf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b5d('0x0'));var jsonpatch=require(_0x8b5d('0x1'));var rp=require(_0x8b5d('0x2'));var moment=require('moment');var BPromise=require(_0x8b5d('0x3'));var Mustache=require(_0x8b5d('0x4'));var util=require(_0x8b5d('0x5'));var path=require(_0x8b5d('0x6'));var sox=require(_0x8b5d('0x7'));var csv=require(_0x8b5d('0x8'));var ejs=require(_0x8b5d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b5d('0xa'));var _=require(_0x8b5d('0xb'));var squel=require(_0x8b5d('0xc'));var crypto=require(_0x8b5d('0xd'));var jsforce=require(_0x8b5d('0xe'));var deskjs=require(_0x8b5d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b5d('0x10'));var Redis=require(_0x8b5d('0x11'));var authService=require(_0x8b5d('0x12'));var qs=require(_0x8b5d('0x13'));var as=require(_0x8b5d('0x14'));var hardwareService=require(_0x8b5d('0x15'));var logger=require(_0x8b5d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8b5d('0x17'));var licenseUtil=require(_0x8b5d('0x18'));var db=require(_0x8b5d('0x19'))['db'];function respondWithStatusCode(_0x3e5208,_0x308b09){_0x308b09=_0x308b09||0xcc;return function(_0x241deb){if(_0x241deb){return _0x3e5208[_0x8b5d('0x1a')](_0x308b09);}return _0x3e5208['status'](_0x308b09)['end']();};}function respondWithResult(_0x634895,_0x42a9a6){_0x42a9a6=_0x42a9a6||0xc8;return function(_0x4074f7){if(_0x4074f7){return _0x634895[_0x8b5d('0x1b')](_0x42a9a6)[_0x8b5d('0x1c')](_0x4074f7);}};}function respondWithFilteredResult(_0x154a50,_0x2a12a4){return function(_0x4c0004){if(_0x4c0004){var _0x378451=typeof _0x2a12a4[_0x8b5d('0x1d')]==='undefined'&&typeof _0x2a12a4[_0x8b5d('0x1e')]===_0x8b5d('0x1f');var _0x27fad3=_0x4c0004[_0x8b5d('0x20')];var _0x4d9155=_0x378451?0x0:_0x2a12a4[_0x8b5d('0x1d')];var _0x585313=_0x378451?_0x4c0004[_0x8b5d('0x20')]:_0x2a12a4[_0x8b5d('0x1d')]+_0x2a12a4[_0x8b5d('0x1e')];var _0x4ae1e4;if(_0x585313>=_0x27fad3){_0x585313=_0x27fad3;_0x4ae1e4=0xc8;}else{_0x4ae1e4=0xce;}_0x154a50[_0x8b5d('0x1b')](_0x4ae1e4);return _0x154a50[_0x8b5d('0x21')](_0x8b5d('0x22'),_0x4d9155+'-'+_0x585313+'/'+_0x27fad3)[_0x8b5d('0x1c')](_0x4c0004);}return null;};}function patchUpdates(_0x29f20d){return function(_0x1fbac2){try{jsonpatch[_0x8b5d('0x23')](_0x1fbac2,_0x29f20d,!![]);}catch(_0x5870b5){return BPromise[_0x8b5d('0x24')](_0x5870b5);}return _0x1fbac2[_0x8b5d('0x25')]();};}function saveUpdates(_0x225966,_0x2b93ef){return function(_0x1068db){if(_0x1068db){return _0x1068db[_0x8b5d('0x26')](_0x225966)['then'](function(_0x5625e1){return _0x5625e1;});}return null;};}function removeEntity(_0x4381c7,_0x3fda72){return function(_0xe8144e){if(_0xe8144e){return _0xe8144e[_0x8b5d('0x27')]()[_0x8b5d('0x28')](function(){_0x4381c7[_0x8b5d('0x1b')](0xcc)[_0x8b5d('0x29')]();});}};}function handleEntityNotFound(_0x51a40c,_0x2c6285){return function(_0xa1ccf1){if(!_0xa1ccf1){_0x51a40c['sendStatus'](0x194);}return _0xa1ccf1;};}function handleError(_0x5629f4,_0x4d9354){_0x4d9354=_0x4d9354||0x1f4;return function(_0x2bb2c8){logger[_0x8b5d('0x2a')](_0x2bb2c8['stack']);if(_0x2bb2c8[_0x8b5d('0x2b')]){delete _0x2bb2c8[_0x8b5d('0x2b')];}_0x5629f4[_0x8b5d('0x1b')](_0x4d9354)[_0x8b5d('0x2c')](_0x2bb2c8);};}exports['index']=function(_0x364b70,_0x4c3b78){var _0x134f62={},_0x5be6d0={},_0x1fb484={'count':0x0,'rows':[]};var _0x57fc2c=_['map'](db[_0x8b5d('0x2d')][_0x8b5d('0x2e')],function(_0x55dc78){return{'name':_0x55dc78['fieldName'],'type':_0x55dc78[_0x8b5d('0x2f')][_0x8b5d('0x30')]};});_0x5be6d0[_0x8b5d('0x31')]=_['map'](_0x57fc2c,_0x8b5d('0x2b'));_0x5be6d0[_0x8b5d('0x32')]=_[_0x8b5d('0x33')](_0x364b70['query']);_0x5be6d0[_0x8b5d('0x34')]=_[_0x8b5d('0x35')](_0x5be6d0[_0x8b5d('0x31')],_0x5be6d0[_0x8b5d('0x32')]);_0x134f62['attributes']=_[_0x8b5d('0x35')](_0x5be6d0[_0x8b5d('0x31')],qs[_0x8b5d('0x36')](_0x364b70[_0x8b5d('0x32')]['fields']));_0x134f62[_0x8b5d('0x37')]=_0x134f62[_0x8b5d('0x37')]['length']?_0x134f62[_0x8b5d('0x37')]:_0x5be6d0[_0x8b5d('0x31')];if(!_0x364b70[_0x8b5d('0x32')][_0x8b5d('0x38')]('nolimit')){_0x134f62['limit']=qs[_0x8b5d('0x1e')](_0x364b70['query'][_0x8b5d('0x1e')]);_0x134f62[_0x8b5d('0x1d')]=qs['offset'](_0x364b70['query'][_0x8b5d('0x1d')]);}_0x134f62[_0x8b5d('0x39')]=qs['sort'](_0x364b70[_0x8b5d('0x32')]['sort']);_0x134f62['where']=qs[_0x8b5d('0x34')](_[_0x8b5d('0x3a')](_0x364b70['query'],_0x5be6d0['filters']),_0x57fc2c);if(_0x364b70[_0x8b5d('0x32')]['filter']){_0x134f62[_0x8b5d('0x3b')]=_[_0x8b5d('0x3c')](_0x134f62[_0x8b5d('0x3b')],{'$or':_[_0x8b5d('0x3d')](_0x57fc2c,function(_0x3814bf){if(_0x3814bf[_0x8b5d('0x2f')]!==_0x8b5d('0x3e')){var _0x4fc890={};_0x4fc890[_0x3814bf[_0x8b5d('0x2b')]]={'$like':'%'+_0x364b70[_0x8b5d('0x32')][_0x8b5d('0x3f')]+'%'};return _0x4fc890;}})});}_0x134f62=_['merge']({},_0x134f62,_0x364b70[_0x8b5d('0x40')]);var _0x36008b={'where':_0x134f62[_0x8b5d('0x3b')]};return db[_0x8b5d('0x2d')][_0x8b5d('0x20')](_0x36008b)[_0x8b5d('0x28')](function(_0x10eb7a){_0x1fb484[_0x8b5d('0x20')]=_0x10eb7a;if(_0x364b70[_0x8b5d('0x32')][_0x8b5d('0x41')]){_0x134f62[_0x8b5d('0x42')]=[{'all':!![]}];}return db[_0x8b5d('0x2d')][_0x8b5d('0x43')](_0x134f62);})['then'](function(_0x2483a8){_0x1fb484[_0x8b5d('0x44')]=_0x2483a8;return _0x1fb484;})[_0x8b5d('0x28')](respondWithFilteredResult(_0x4c3b78,_0x134f62))[_0x8b5d('0x45')](handleError(_0x4c3b78,null));};exports[_0x8b5d('0x46')]=function(_0x16711e,_0x523db2){var _0x27e0d3={'raw':![],'where':{'id':_0x16711e[_0x8b5d('0x47')]['id']}},_0x41d987={};_0x41d987[_0x8b5d('0x31')]=_[_0x8b5d('0x33')](db[_0x8b5d('0x2d')][_0x8b5d('0x2e')]);_0x41d987[_0x8b5d('0x32')]=_[_0x8b5d('0x33')](_0x16711e[_0x8b5d('0x32')]);_0x41d987['filters']=_[_0x8b5d('0x35')](_0x41d987[_0x8b5d('0x31')],_0x41d987[_0x8b5d('0x32')]);_0x27e0d3[_0x8b5d('0x37')]=_[_0x8b5d('0x35')](_0x41d987[_0x8b5d('0x31')],qs[_0x8b5d('0x36')](_0x16711e['query']['fields']));_0x27e0d3[_0x8b5d('0x37')]=_0x27e0d3['attributes'][_0x8b5d('0x48')]?_0x27e0d3[_0x8b5d('0x37')]:_0x41d987['model'];if(_0x16711e[_0x8b5d('0x32')][_0x8b5d('0x41')]){_0x27e0d3[_0x8b5d('0x42')]=[{'all':!![]}];}_0x27e0d3=_[_0x8b5d('0x3c')]({},_0x27e0d3,_0x16711e[_0x8b5d('0x40')]);return db[_0x8b5d('0x2d')]['find'](_0x27e0d3)[_0x8b5d('0x28')](handleEntityNotFound(_0x523db2,null))['then'](respondWithResult(_0x523db2,null))[_0x8b5d('0x45')](handleError(_0x523db2,null));};exports['create']=function(_0x911099,_0x109f16){return db[_0x8b5d('0x2d')][_0x8b5d('0x49')](_0x911099['body'],{})['then'](respondWithResult(_0x109f16,0xc9))[_0x8b5d('0x45')](handleError(_0x109f16,null));};exports['update']=function(_0x3e1e8c,_0x539445){if(_0x3e1e8c[_0x8b5d('0x4a')]['id']){delete _0x3e1e8c[_0x8b5d('0x4a')]['id'];}return db[_0x8b5d('0x2d')]['find']({'where':{'id':_0x3e1e8c['params']['id']}})[_0x8b5d('0x28')](handleEntityNotFound(_0x539445,null))[_0x8b5d('0x28')](saveUpdates(_0x3e1e8c['body'],null))['then'](respondWithResult(_0x539445,null))[_0x8b5d('0x45')](handleError(_0x539445,null));};exports[_0x8b5d('0x27')]=function(_0x4fba35,_0x2abf5a){return db[_0x8b5d('0x2d')][_0x8b5d('0x4b')]({'where':{'id':_0x4fba35[_0x8b5d('0x47')]['id']}})[_0x8b5d('0x28')](handleEntityNotFound(_0x2abf5a,null))[_0x8b5d('0x28')](removeEntity(_0x2abf5a,null))['catch'](handleError(_0x2abf5a,null));};exports['describe']=function(_0x234f1a,_0x595b3c){return db[_0x8b5d('0x2d')]['describe']()['then'](respondWithResult(_0x595b3c,null))[_0x8b5d('0x45')](handleError(_0x595b3c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 496864d..7211dbf 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 _0xda9d=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','api','bluebird','request-promise'];(function(_0x2d8c9b,_0x55c0d3){var _0x3e6b9f=function(_0x2f7068){while(--_0x2f7068){_0x2d8c9b['push'](_0x2d8c9b['shift']());}};_0x3e6b9f(++_0x55c0d3);}(_0xda9d,0x73));var _0xdda9=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0xda9d[_0x43dc7e];return _0x21e12d;};'use strict';var _=require(_0xdda9('0x0'));var util=require(_0xdda9('0x1'));var logger=require('../../config/logger')(_0xdda9('0x2'));var moment=require('moment');var BPromise=require(_0xdda9('0x3'));var rp=require(_0xdda9('0x4'));var fs=require('fs');var path=require(_0xdda9('0x5'));var rimraf=require(_0xdda9('0x6'));var config=require(_0xdda9('0x7'));var attributes=require(_0xdda9('0x8'));module[_0xdda9('0x9')]=function(_0x859108,_0x17805c){return _0x859108[_0xdda9('0xa')](_0xdda9('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc022=['report_integration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc022,0x16d));var _0x2c02=function(_0xc2c13a,_0x1070d3){_0xc2c13a=_0xc2c13a-0x0;var _0x2b8e2f=_0xc022[_0xc2c13a];return _0x2b8e2f;};'use strict';var _=require(_0x2c02('0x0'));var util=require(_0x2c02('0x1'));var logger=require(_0x2c02('0x2'))(_0x2c02('0x3'));var moment=require(_0x2c02('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c02('0x5'));var fs=require('fs');var path=require(_0x2c02('0x6'));var rimraf=require(_0x2c02('0x7'));var config=require(_0x2c02('0x8'));var attributes=require('./integrationReport.attributes');module[_0x2c02('0x9')]=function(_0x5d6f58,_0x552061){return _0x5d6f58[_0x2c02('0xa')](_0x2c02('0xb'),attributes,{'tableName':_0x2c02('0xc'),'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 8e2cf41..3260044 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 _0x326f=['info','IntegrationReport,\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(_0x59d16a,_0x3a84a6){var _0x49c973=function(_0x344a0f){while(--_0x344a0f){_0x59d16a['push'](_0x59d16a['shift']());}};_0x49c973(++_0x3a84a6);}(_0x326f,0xd1));var _0xf326=function(_0x388eb5,_0x645783){_0x388eb5=_0x388eb5-0x0;var _0x328eb3=_0x326f[_0x388eb5];return _0x328eb3;};'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')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0xac0d54,_0x144889){var _0x35020c=function(_0x22f8dc){while(--_0x22f8dc){_0xac0d54['push'](_0xac0d54['shift']());}};_0x35020c(++_0x144889);}(_0x4819,0xcd));var _0x9481=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0x4819[_0x25ad66];return _0x141bc4;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c190bac..acc0a04 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 _0x0298=['../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','show','get','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b9edd,_0x66b166){var _0x4907c4=function(_0x538091){while(--_0x538091){_0x1b9edd['push'](_0x1b9edd['shift']());}};_0x4907c4(++_0x66b166);}(_0x0298,0x95));var _0x8029=function(_0x1db76,_0x1e047c){_0x1db76=_0x1db76-0x0;var _0x49f54d=_0x0298[_0x1db76];return _0x49f54d;};'use strict';var multer=require(_0x8029('0x0'));var util=require('util');var path=require(_0x8029('0x1'));var timeout=require(_0x8029('0x2'));var express=require(_0x8029('0x3'));var router=express[_0x8029('0x4')]();var fs_extra=require(_0x8029('0x5'));var auth=require(_0x8029('0x6'));var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router['get']('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router['get'](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0xd')]);router[_0x8029('0xe')](_0x8029('0xf'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x8029('0x10')]('/',auth[_0x8029('0xa')](),controller[_0x8029('0x11')]);router['post']('/:id/sub_intervals',auth[_0x8029('0xa')](),controller[_0x8029('0x12')]);router['post'](_0x8029('0x13'),auth['isAuthenticated'](),controller[_0x8029('0x14')]);router[_0x8029('0x15')](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0x16')]);router[_0x8029('0x17')]('/:id',auth[_0x8029('0xa')](),controller[_0x8029('0x18')]);module[_0x8029('0x19')]=router; \ No newline at end of file +var _0xf715=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','post','create','addInterval','addIntervals','/:id','delete','destroy','exports','util','connect-timeout','express'];(function(_0x7331bc,_0x248471){var _0x1fc12a=function(_0x313b2e){while(--_0x313b2e){_0x7331bc['push'](_0x7331bc['shift']());}};_0x1fc12a(++_0x248471);}(_0xf715,0x90));var _0x5f71=function(_0x1cf742,_0x417ad6){_0x1cf742=_0x1cf742-0x0;var _0x56d125=_0xf715[_0x1cf742];return _0x56d125;};'use strict';var multer=require('multer');var util=require(_0x5f71('0x0'));var path=require('path');var timeout=require(_0x5f71('0x1'));var express=require(_0x5f71('0x2'));var router=express[_0x5f71('0x3')]();var fs_extra=require(_0x5f71('0x4'));var auth=require(_0x5f71('0x5'));var interaction=require(_0x5f71('0x6'));var config=require('../../config/environment');var controller=require(_0x5f71('0x7'));router[_0x5f71('0x8')]('/',auth[_0x5f71('0x9')](),controller[_0x5f71('0xa')]);router[_0x5f71('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5f71('0xb')]);router[_0x5f71('0x8')](_0x5f71('0xc'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x5f71('0xd')]('/',auth['isAuthenticated'](),controller[_0x5f71('0xe')]);router['post']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x5f71('0xf')]);router['post']('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x5f71('0x10')]);router['put'](_0x5f71('0x11'),auth[_0x5f71('0x9')](),controller['update']);router[_0x5f71('0x12')](_0x5f71('0x11'),auth[_0x5f71('0x9')](),controller[_0x5f71('0x13')]);module[_0x5f71('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 568a3c0..d107059 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 _0x89e2=['sequelize','STRING'];(function(_0x355250,_0x46287f){var _0x5d3c8d=function(_0x596523){while(--_0x596523){_0x355250['push'](_0x355250['shift']());}};_0x5d3c8d(++_0x46287f);}(_0x89e2,0xc6));var _0x289e=function(_0x27e774,_0x145e78){_0x27e774=_0x27e774-0x0;var _0x386b0e=_0x89e2[_0x27e774];return _0x386b0e;};'use strict';var Sequelize=require(_0x289e('0x0'));module['exports']={'name':{'type':Sequelize[_0x289e('0x1')]},'description':{'type':Sequelize[_0x289e('0x1')]},'interval':{'type':Sequelize[_0x289e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xced5=['sequelize','exports','STRING'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0xced5,0xcf));var _0x5ced=function(_0xb1011c,_0x144d3c){_0xb1011c=_0xb1011c-0x0;var _0x1a39b3=_0xced5[_0xb1011c];return _0x1a39b3;};'use strict';var Sequelize=require(_0x5ced('0x0'));module[_0x5ced('0x1')]={'name':{'type':Sequelize[_0x5ced('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5ced('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 709f086..c27a365 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 _0xf907=['get','Intervals','UserProfileResource','status','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Interval','includeAll','include','findAll','show','params','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','addIntervals','findOne','transaction','eml-format','zip-dir','request-promise','moment','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','limit','count','set','save','update','then','destroy'];(function(_0x46d468,_0xed4581){var _0x5955db=function(_0x988680){while(--_0x988680){_0x46d468['push'](_0x46d468['shift']());}};_0x5955db(++_0xed4581);}(_0xf907,0x139));var _0x7f90=function(_0x5c7ff5,_0x50506a){_0x5c7ff5=_0x5c7ff5-0x0;var _0x29824c=_0xf907[_0x5c7ff5];return _0x29824c;};'use strict';var emlformat=require(_0x7f90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f90('0x2'));var moment=require(_0x7f90('0x3'));var BPromise=require(_0x7f90('0x4'));var Mustache=require('mustache');var util=require(_0x7f90('0x5'));var path=require(_0x7f90('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f90('0x7'));var _=require('lodash');var squel=require(_0x7f90('0x8'));var crypto=require(_0x7f90('0x9'));var jsforce=require(_0x7f90('0xa'));var deskjs=require(_0x7f90('0xb'));var toCsv=require(_0x7f90('0xc'));var querystring=require('querystring');var Papa=require(_0x7f90('0xd'));var Redis=require(_0x7f90('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f90('0xf'));var as=require(_0x7f90('0x10'));var hardwareService=require(_0x7f90('0x11'));var logger=require('../../config/logger')(_0x7f90('0x12'));var utils=require(_0x7f90('0x13'));var config=require(_0x7f90('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f90('0x15'))['db'];var extensions=require(_0x7f90('0x16'));function respondWithStatusCode(_0x31e24a,_0x4d4aa6){_0x4d4aa6=_0x4d4aa6||0xcc;return function(_0x2d7710){if(_0x2d7710){return _0x31e24a[_0x7f90('0x17')](_0x4d4aa6);}return _0x31e24a['status'](_0x4d4aa6)[_0x7f90('0x18')]();};}function respondWithResult(_0x2ff382,_0x15816b){_0x15816b=_0x15816b||0xc8;return function(_0xb4f3a0){if(_0xb4f3a0){return _0x2ff382['status'](_0x15816b)[_0x7f90('0x19')](_0xb4f3a0);}};}function respondWithFilteredResult(_0x44068f,_0x1a2b32){return function(_0x2893f8){if(_0x2893f8){var _0x404c8e=typeof _0x1a2b32[_0x7f90('0x1a')]===_0x7f90('0x1b')&&typeof _0x1a2b32[_0x7f90('0x1c')]===_0x7f90('0x1b');var _0x4740e7=_0x2893f8[_0x7f90('0x1d')];var _0x41b230=_0x404c8e?0x0:_0x1a2b32[_0x7f90('0x1a')];var _0x592cad=_0x404c8e?_0x2893f8[_0x7f90('0x1d')]:_0x1a2b32[_0x7f90('0x1a')]+_0x1a2b32[_0x7f90('0x1c')];var _0x1dcb2b;if(_0x592cad>=_0x4740e7){_0x592cad=_0x4740e7;_0x1dcb2b=0xc8;}else{_0x1dcb2b=0xce;}_0x44068f['status'](_0x1dcb2b);return _0x44068f[_0x7f90('0x1e')]('Content-Range',_0x41b230+'-'+_0x592cad+'/'+_0x4740e7)[_0x7f90('0x19')](_0x2893f8);}return null;};}function patchUpdates(_0x1240ee){return function(_0x34594e){try{jsonpatch['apply'](_0x34594e,_0x1240ee,!![]);}catch(_0x2f19c2){return BPromise['reject'](_0x2f19c2);}return _0x34594e[_0x7f90('0x1f')]();};}function saveUpdates(_0x280fc0,_0x2b0bd9){return function(_0x5b3b49){if(_0x5b3b49){return _0x5b3b49[_0x7f90('0x20')](_0x280fc0)[_0x7f90('0x21')](function(_0x139507){return _0x139507;});}return null;};}function removeEntity(_0x481cff,_0x30d73f){return function(_0x565f76){if(_0x565f76){return _0x565f76[_0x7f90('0x22')]()['then'](function(){var _0x5e7155=_0x565f76[_0x7f90('0x23')]({'plain':!![]});var _0x169d86=_0x7f90('0x24');return db[_0x7f90('0x25')]['destroy']({'where':{'type':_0x169d86,'resourceId':_0x5e7155['id']}})[_0x7f90('0x21')](function(){return _0x565f76;});})[_0x7f90('0x21')](function(){_0x481cff[_0x7f90('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115307,_0xc29b45){return function(_0x36d5bc){if(!_0x36d5bc){_0x115307['sendStatus'](0x194);}return _0x36d5bc;};}function handleError(_0x4fd143,_0x4f465e){_0x4f465e=_0x4f465e||0x1f4;return function(_0x568736){logger[_0x7f90('0x27')](_0x568736['stack']);if(_0x568736[_0x7f90('0x28')]){delete _0x568736['name'];}_0x4fd143[_0x7f90('0x26')](_0x4f465e)[_0x7f90('0x29')](_0x568736);};}exports[_0x7f90('0x2a')]=function(_0x2306d3,_0x293546){var _0x540c1c={},_0x24f7d9={},_0x4ab3d1={'count':0x0,'rows':[]};var _0x40bedf=_[_0x7f90('0x2b')](db['Interval'][_0x7f90('0x2c')],function(_0x3d1945){return{'name':_0x3d1945[_0x7f90('0x2d')],'type':_0x3d1945[_0x7f90('0x2e')][_0x7f90('0x2f')]};});_0x24f7d9[_0x7f90('0x30')]=_[_0x7f90('0x2b')](_0x40bedf,_0x7f90('0x28'));_0x24f7d9[_0x7f90('0x31')]=_[_0x7f90('0x32')](_0x2306d3[_0x7f90('0x31')]);_0x24f7d9[_0x7f90('0x33')]=_[_0x7f90('0x34')](_0x24f7d9[_0x7f90('0x30')],_0x24f7d9[_0x7f90('0x31')]);_0x540c1c[_0x7f90('0x35')]=_[_0x7f90('0x34')](_0x24f7d9[_0x7f90('0x30')],qs[_0x7f90('0x36')](_0x2306d3[_0x7f90('0x31')][_0x7f90('0x36')]));_0x540c1c[_0x7f90('0x35')]=_0x540c1c['attributes'][_0x7f90('0x37')]?_0x540c1c[_0x7f90('0x35')]:_0x24f7d9['model'];if(!_0x2306d3['query'][_0x7f90('0x38')](_0x7f90('0x39'))){_0x540c1c[_0x7f90('0x1c')]=qs[_0x7f90('0x1c')](_0x2306d3['query']['limit']);_0x540c1c[_0x7f90('0x1a')]=qs['offset'](_0x2306d3[_0x7f90('0x31')]['offset']);}_0x540c1c[_0x7f90('0x3a')]=qs[_0x7f90('0x3b')](_0x2306d3[_0x7f90('0x31')][_0x7f90('0x3b')]);_0x540c1c['where']=qs[_0x7f90('0x33')](_[_0x7f90('0x3c')](_0x2306d3['query'],_0x24f7d9[_0x7f90('0x33')]),_0x40bedf);if(_0x2306d3[_0x7f90('0x31')][_0x7f90('0x3d')]){_0x540c1c[_0x7f90('0x3e')]=_['merge'](_0x540c1c[_0x7f90('0x3e')],{'$or':_[_0x7f90('0x2b')](_0x40bedf,function(_0x142f83){if(_0x142f83[_0x7f90('0x2e')]!==_0x7f90('0x3f')){var _0x3848f1={};_0x3848f1[_0x142f83['name']]={'$like':'%'+_0x2306d3[_0x7f90('0x31')]['filter']+'%'};return _0x3848f1;}})});}_0x540c1c=_[_0x7f90('0x40')]({},_0x540c1c,_0x2306d3[_0x7f90('0x41')]);var _0x5a0c5c={'where':_0x540c1c['where']};return db[_0x7f90('0x42')]['count'](_0x5a0c5c)[_0x7f90('0x21')](function(_0x3abc4f){_0x4ab3d1[_0x7f90('0x1d')]=_0x3abc4f;if(_0x2306d3['query'][_0x7f90('0x43')]){_0x540c1c[_0x7f90('0x44')]=[{'all':!![]}];}return db[_0x7f90('0x42')][_0x7f90('0x45')](_0x540c1c);})['then'](function(_0x30172a){_0x4ab3d1['rows']=_0x30172a;return _0x4ab3d1;})[_0x7f90('0x21')](respondWithFilteredResult(_0x293546,_0x540c1c))['catch'](handleError(_0x293546,null));};exports[_0x7f90('0x46')]=function(_0x2f10b2,_0xc43ded){var _0x55e946={'raw':!![],'where':{'id':_0x2f10b2[_0x7f90('0x47')]['id']}},_0xa58afd={};_0xa58afd['model']=_[_0x7f90('0x32')](db[_0x7f90('0x42')][_0x7f90('0x2c')]);_0xa58afd[_0x7f90('0x31')]=_[_0x7f90('0x32')](_0x2f10b2[_0x7f90('0x31')]);_0xa58afd['filters']=_[_0x7f90('0x34')](_0xa58afd[_0x7f90('0x30')],_0xa58afd['query']);_0x55e946[_0x7f90('0x35')]=_['intersection'](_0xa58afd['model'],qs[_0x7f90('0x36')](_0x2f10b2[_0x7f90('0x31')][_0x7f90('0x36')]));_0x55e946[_0x7f90('0x35')]=_0x55e946[_0x7f90('0x35')]['length']?_0x55e946[_0x7f90('0x35')]:_0xa58afd['model'];if(_0x2f10b2['query'][_0x7f90('0x43')]){_0x55e946[_0x7f90('0x44')]=[{'all':!![]}];}_0x55e946=_[_0x7f90('0x40')]({},_0x55e946,_0x2f10b2[_0x7f90('0x41')]);return db[_0x7f90('0x42')]['find'](_0x55e946)[_0x7f90('0x21')](handleEntityNotFound(_0xc43ded,null))[_0x7f90('0x21')](respondWithResult(_0xc43ded,null))[_0x7f90('0x48')](handleError(_0xc43ded,null));};exports[_0x7f90('0x49')]=function(_0x2bedcd,_0x369bd9){return db[_0x7f90('0x42')][_0x7f90('0x49')](_0x2bedcd['body'],{})[_0x7f90('0x21')](function(_0x13a41a){var _0x1dcd55=_0x2bedcd['user']['get']({'plain':!![]});if(!_0x1dcd55)throw new Error(_0x7f90('0x4a'));if(_0x1dcd55[_0x7f90('0x4b')]===_0x7f90('0x4c')){var _0x1fe5a6=_0x13a41a[_0x7f90('0x23')]({'plain':!![]});var _0x588003='Intervals';return db['UserProfileSection'][_0x7f90('0x4d')]({'where':{'name':_0x588003,'userProfileId':_0x1dcd55[_0x7f90('0x4e')]},'raw':!![]})[_0x7f90('0x21')](function(_0x3aa523){if(_0x3aa523&&_0x3aa523['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1fe5a6[_0x7f90('0x28')],'resourceId':_0x1fe5a6['id'],'type':_0x3aa523[_0x7f90('0x28')],'sectionId':_0x3aa523['id']},{})[_0x7f90('0x21')](function(){return _0x13a41a;});}else{return _0x13a41a;}})[_0x7f90('0x48')](function(_0x561b9b){logger[_0x7f90('0x27')](_0x7f90('0x4f'),_0x561b9b);throw _0x561b9b;});}return _0x13a41a;})['then'](respondWithResult(_0x369bd9,0xc9))['catch'](handleError(_0x369bd9,null));};exports[_0x7f90('0x20')]=function(_0x2feee1,_0x249ca1){if(_0x2feee1['body']['id']){delete _0x2feee1[_0x7f90('0x50')]['id'];}return db[_0x7f90('0x42')]['find']({'where':{'id':_0x2feee1[_0x7f90('0x47')]['id']}})[_0x7f90('0x21')](handleEntityNotFound(_0x249ca1,null))['then'](saveUpdates(_0x2feee1[_0x7f90('0x50')],null))[_0x7f90('0x21')](respondWithResult(_0x249ca1,null))[_0x7f90('0x48')](handleError(_0x249ca1,null));};exports[_0x7f90('0x22')]=function(_0x23d9b1,_0x4447b3){return db['Interval'][_0x7f90('0x4d')]({'where':{'id':_0x23d9b1[_0x7f90('0x47')]['id']}})[_0x7f90('0x21')](handleEntityNotFound(_0x4447b3,null))[_0x7f90('0x21')](removeEntity(_0x4447b3,null))[_0x7f90('0x48')](handleError(_0x4447b3,null));};exports[_0x7f90('0x51')]=function(_0x96b2be,_0x1b091b,_0x4215ee){if(_0x96b2be[_0x7f90('0x50')]['id']){delete _0x96b2be[_0x7f90('0x50')]['id'];}return db[_0x7f90('0x42')]['find']({'where':{'id':_0x96b2be[_0x7f90('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b091b,null))[_0x7f90('0x21')](function(_0xf04ac3){if(_0xf04ac3){_0x96b2be[_0x7f90('0x50')][_0x7f90('0x52')]=_0xf04ac3['id'];return db['Interval'][_0x7f90('0x49')](_0x96b2be[_0x7f90('0x50')]);}})[_0x7f90('0x21')](respondWithResult(_0x1b091b,null))[_0x7f90('0x48')](handleError(_0x1b091b,null));};exports[_0x7f90('0x53')]=function(_0xbafd44,_0x47194b,_0x188cff){var _0x33d38c={};var _0x105045={};var _0x27d8c9;var _0x1e68c4;return db[_0x7f90('0x42')]['findOne']({'where':{'id':_0xbafd44[_0x7f90('0x47')]['id']}})[_0x7f90('0x21')](handleEntityNotFound(_0x47194b,null))[_0x7f90('0x21')](function(_0x42b892){if(_0x42b892){_0x27d8c9=_0x42b892;_0x105045[_0x7f90('0x30')]=_[_0x7f90('0x32')](db[_0x7f90('0x42')][_0x7f90('0x2c')]);_0x105045[_0x7f90('0x31')]=_[_0x7f90('0x32')](_0xbafd44[_0x7f90('0x31')]);_0x105045[_0x7f90('0x33')]=_[_0x7f90('0x34')](_0x105045[_0x7f90('0x30')],_0x105045[_0x7f90('0x31')]);_0x33d38c['attributes']=_[_0x7f90('0x34')](_0x105045[_0x7f90('0x30')],qs[_0x7f90('0x36')](_0xbafd44[_0x7f90('0x31')][_0x7f90('0x36')]));_0x33d38c[_0x7f90('0x35')]=_0x33d38c[_0x7f90('0x35')][_0x7f90('0x37')]?_0x33d38c[_0x7f90('0x35')]:_0x105045[_0x7f90('0x30')];_0x33d38c[_0x7f90('0x3a')]=qs['sort'](_0xbafd44['query'][_0x7f90('0x3b')]);_0x33d38c['where']=qs[_0x7f90('0x33')](_[_0x7f90('0x3c')](_0xbafd44[_0x7f90('0x31')],_0x105045['filters']));if(_0xbafd44['query'][_0x7f90('0x3d')]){_0x33d38c[_0x7f90('0x3e')]=_[_0x7f90('0x40')](_0x33d38c[_0x7f90('0x3e')],{'$or':_[_0x7f90('0x2b')](_0x33d38c[_0x7f90('0x35')],function(_0x2cbd4f){var _0x5224b6={};_0x5224b6[_0x2cbd4f]={'$like':'%'+_0xbafd44['query'][_0x7f90('0x3d')]+'%'};return _0x5224b6;})});}_0x33d38c=_[_0x7f90('0x40')]({},_0x33d38c,_0xbafd44[_0x7f90('0x41')]);return _0x27d8c9[_0x7f90('0x53')](_0x33d38c);}})[_0x7f90('0x21')](function(_0x3bc466){if(_0x3bc466){_0x1e68c4=_0x3bc466['length'];if(!_0xbafd44['query']['hasOwnProperty']('nolimit')){_0x33d38c[_0x7f90('0x1c')]=qs[_0x7f90('0x1c')](_0xbafd44[_0x7f90('0x31')]['limit']);_0x33d38c[_0x7f90('0x1a')]=qs[_0x7f90('0x1a')](_0xbafd44[_0x7f90('0x31')][_0x7f90('0x1a')]);}return _0x27d8c9[_0x7f90('0x53')](_0x33d38c);}})[_0x7f90('0x21')](function(_0x2c6578){if(_0x2c6578){return _0x2c6578?{'count':_0x1e68c4,'rows':_0x2c6578}:null;}})[_0x7f90('0x21')](respondWithResult(_0x47194b,null))[_0x7f90('0x48')](handleError(_0x47194b,null));};exports[_0x7f90('0x54')]=function(_0x5aa004,_0x69a984,_0x387fe9){return db[_0x7f90('0x42')][_0x7f90('0x55')]({'where':{'id':_0x5aa004[_0x7f90('0x47')]['id']}})[_0x7f90('0x21')](handleEntityNotFound(_0x69a984,null))[_0x7f90('0x21')](function(_0x3af3a6){if(_0x3af3a6){return db['sequelize'][_0x7f90('0x56')](function(_0xe6360c){return db['Interval']['destroy']({'where':{'IntervalId':_0x5aa004[_0x7f90('0x47')]['id']},'transaction':_0xe6360c})[_0x7f90('0x21')](function(_0x405cde){var _0x6bc2d7=_['map'](_0x5aa004[_0x7f90('0x50')],function(_0x3f93d7){delete _0x3f93d7['id'];_0x3f93d7['IntervalId']=_0x5aa004[_0x7f90('0x47')]['id'];return _0x3f93d7;});return db[_0x7f90('0x42')]['bulkCreate'](_0x6bc2d7,{'transaction':_0xe6360c});});})['then'](function(){return db[_0x7f90('0x42')][_0x7f90('0x45')]({'where':{'IntervalId':_0x5aa004['params']['id']}});});}})['then'](respondWithResult(_0x69a984,null))[_0x7f90('0x48')](handleError(_0x69a984,null));}; \ No newline at end of file +var _0x3687=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Intervals','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','Interval','includeAll','findAll','rows','catch','show','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x13d106,_0x395ce6){var _0x2e15fb=function(_0x1e1bf8){while(--_0x1e1bf8){_0x13d106['push'](_0x13d106['shift']());}};_0x2e15fb(++_0x395ce6);}(_0x3687,0x1da));var _0x7368=function(_0x199985,_0x5c0e3e){_0x199985=_0x199985-0x0;var _0x37293a=_0x3687[_0x199985];return _0x37293a;};'use strict';var emlformat=require(_0x7368('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7368('0x1'));var rp=require(_0x7368('0x2'));var moment=require(_0x7368('0x3'));var BPromise=require(_0x7368('0x4'));var Mustache=require(_0x7368('0x5'));var util=require(_0x7368('0x6'));var path=require(_0x7368('0x7'));var sox=require('sox');var csv=require(_0x7368('0x8'));var ejs=require(_0x7368('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7368('0xa'));var squel=require(_0x7368('0xb'));var crypto=require(_0x7368('0xc'));var jsforce=require(_0x7368('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7368('0x8'));var querystring=require(_0x7368('0xe'));var Papa=require(_0x7368('0xf'));var Redis=require(_0x7368('0x10'));var authService=require(_0x7368('0x11'));var qs=require(_0x7368('0x12'));var as=require(_0x7368('0x13'));var hardwareService=require(_0x7368('0x14'));var logger=require(_0x7368('0x15'))('api');var utils=require(_0x7368('0x16'));var config=require(_0x7368('0x17'));var licenseUtil=require(_0x7368('0x18'));var db=require(_0x7368('0x19'))['db'];var extensions=require(_0x7368('0x1a'));function respondWithStatusCode(_0x45a132,_0x4e942a){_0x4e942a=_0x4e942a||0xcc;return function(_0x116ac0){if(_0x116ac0){return _0x45a132[_0x7368('0x1b')](_0x4e942a);}return _0x45a132[_0x7368('0x1c')](_0x4e942a)[_0x7368('0x1d')]();};}function respondWithResult(_0x410d92,_0x258974){_0x258974=_0x258974||0xc8;return function(_0x256d97){if(_0x256d97){return _0x410d92[_0x7368('0x1c')](_0x258974)['json'](_0x256d97);}};}function respondWithFilteredResult(_0x17c8b0,_0x162126){return function(_0x37fb29){if(_0x37fb29){var _0x46baa2=typeof _0x162126['offset']===_0x7368('0x1e')&&typeof _0x162126[_0x7368('0x1f')]==='undefined';var _0x151bb1=_0x37fb29[_0x7368('0x20')];var _0x365a07=_0x46baa2?0x0:_0x162126[_0x7368('0x21')];var _0x8dc8ef=_0x46baa2?_0x37fb29['count']:_0x162126[_0x7368('0x21')]+_0x162126[_0x7368('0x1f')];var _0x24338b;if(_0x8dc8ef>=_0x151bb1){_0x8dc8ef=_0x151bb1;_0x24338b=0xc8;}else{_0x24338b=0xce;}_0x17c8b0[_0x7368('0x1c')](_0x24338b);return _0x17c8b0[_0x7368('0x22')](_0x7368('0x23'),_0x365a07+'-'+_0x8dc8ef+'/'+_0x151bb1)[_0x7368('0x24')](_0x37fb29);}return null;};}function patchUpdates(_0x2bfca4){return function(_0x4f5b6f){try{jsonpatch[_0x7368('0x25')](_0x4f5b6f,_0x2bfca4,!![]);}catch(_0x5c4cd1){return BPromise[_0x7368('0x26')](_0x5c4cd1);}return _0x4f5b6f[_0x7368('0x27')]();};}function saveUpdates(_0x288ca5,_0x17a27d){return function(_0x2f860e){if(_0x2f860e){return _0x2f860e[_0x7368('0x28')](_0x288ca5)[_0x7368('0x29')](function(_0x412079){return _0x412079;});}return null;};}function removeEntity(_0x234745,_0x38da41){return function(_0x23a3f3){if(_0x23a3f3){return _0x23a3f3[_0x7368('0x2a')]()[_0x7368('0x29')](function(){var _0x55c4f8=_0x23a3f3['get']({'plain':!![]});var _0x3e7725=_0x7368('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3e7725,'resourceId':_0x55c4f8['id']}})['then'](function(){return _0x23a3f3;});})['then'](function(){_0x234745[_0x7368('0x1c')](0xcc)[_0x7368('0x1d')]();});}};}function handleEntityNotFound(_0x25ca8b,_0x475cc6){return function(_0x391122){if(!_0x391122){_0x25ca8b['sendStatus'](0x194);}return _0x391122;};}function handleError(_0x5838c2,_0x4f40e8){_0x4f40e8=_0x4f40e8||0x1f4;return function(_0x174595){logger[_0x7368('0x2c')](_0x174595[_0x7368('0x2d')]);if(_0x174595[_0x7368('0x2e')]){delete _0x174595[_0x7368('0x2e')];}_0x5838c2[_0x7368('0x1c')](_0x4f40e8)[_0x7368('0x2f')](_0x174595);};}exports[_0x7368('0x30')]=function(_0x33ead4,_0x577577){var _0x425afc={},_0x2dd356={},_0x56419e={'count':0x0,'rows':[]};var _0x45230f=_['map'](db['Interval'][_0x7368('0x31')],function(_0x4405ec){return{'name':_0x4405ec[_0x7368('0x32')],'type':_0x4405ec[_0x7368('0x33')][_0x7368('0x34')]};});_0x2dd356[_0x7368('0x35')]=_[_0x7368('0x36')](_0x45230f,'name');_0x2dd356[_0x7368('0x37')]=_[_0x7368('0x38')](_0x33ead4[_0x7368('0x37')]);_0x2dd356[_0x7368('0x39')]=_[_0x7368('0x3a')](_0x2dd356[_0x7368('0x35')],_0x2dd356[_0x7368('0x37')]);_0x425afc[_0x7368('0x3b')]=_[_0x7368('0x3a')](_0x2dd356[_0x7368('0x35')],qs[_0x7368('0x3c')](_0x33ead4[_0x7368('0x37')][_0x7368('0x3c')]));_0x425afc[_0x7368('0x3b')]=_0x425afc[_0x7368('0x3b')][_0x7368('0x3d')]?_0x425afc['attributes']:_0x2dd356[_0x7368('0x35')];if(!_0x33ead4[_0x7368('0x37')][_0x7368('0x3e')](_0x7368('0x3f'))){_0x425afc[_0x7368('0x1f')]=qs[_0x7368('0x1f')](_0x33ead4[_0x7368('0x37')][_0x7368('0x1f')]);_0x425afc[_0x7368('0x21')]=qs[_0x7368('0x21')](_0x33ead4[_0x7368('0x37')][_0x7368('0x21')]);}_0x425afc['order']=qs[_0x7368('0x40')](_0x33ead4['query'][_0x7368('0x40')]);_0x425afc[_0x7368('0x41')]=qs[_0x7368('0x39')](_['pick'](_0x33ead4[_0x7368('0x37')],_0x2dd356[_0x7368('0x39')]),_0x45230f);if(_0x33ead4[_0x7368('0x37')]['filter']){_0x425afc[_0x7368('0x41')]=_[_0x7368('0x42')](_0x425afc[_0x7368('0x41')],{'$or':_['map'](_0x45230f,function(_0x1b221e){if(_0x1b221e['type']!=='VIRTUAL'){var _0x5c2100={};_0x5c2100[_0x1b221e[_0x7368('0x2e')]]={'$like':'%'+_0x33ead4[_0x7368('0x37')][_0x7368('0x43')]+'%'};return _0x5c2100;}})});}_0x425afc=_['merge']({},_0x425afc,_0x33ead4[_0x7368('0x44')]);var _0x25ac85={'where':_0x425afc[_0x7368('0x41')]};return db[_0x7368('0x45')][_0x7368('0x20')](_0x25ac85)[_0x7368('0x29')](function(_0xd3372c){_0x56419e[_0x7368('0x20')]=_0xd3372c;if(_0x33ead4[_0x7368('0x37')][_0x7368('0x46')]){_0x425afc['include']=[{'all':!![]}];}return db[_0x7368('0x45')][_0x7368('0x47')](_0x425afc);})[_0x7368('0x29')](function(_0x108108){_0x56419e[_0x7368('0x48')]=_0x108108;return _0x56419e;})[_0x7368('0x29')](respondWithFilteredResult(_0x577577,_0x425afc))[_0x7368('0x49')](handleError(_0x577577,null));};exports[_0x7368('0x4a')]=function(_0x535af7,_0x9de46f){var _0x20d823={'raw':!![],'where':{'id':_0x535af7['params']['id']}},_0x5eaccc={};_0x5eaccc[_0x7368('0x35')]=_['keys'](db[_0x7368('0x45')][_0x7368('0x31')]);_0x5eaccc[_0x7368('0x37')]=_[_0x7368('0x38')](_0x535af7[_0x7368('0x37')]);_0x5eaccc[_0x7368('0x39')]=_[_0x7368('0x3a')](_0x5eaccc[_0x7368('0x35')],_0x5eaccc['query']);_0x20d823[_0x7368('0x3b')]=_['intersection'](_0x5eaccc['model'],qs[_0x7368('0x3c')](_0x535af7[_0x7368('0x37')][_0x7368('0x3c')]));_0x20d823[_0x7368('0x3b')]=_0x20d823['attributes'][_0x7368('0x3d')]?_0x20d823[_0x7368('0x3b')]:_0x5eaccc[_0x7368('0x35')];if(_0x535af7[_0x7368('0x37')]['includeAll']){_0x20d823[_0x7368('0x4b')]=[{'all':!![]}];}_0x20d823=_[_0x7368('0x42')]({},_0x20d823,_0x535af7[_0x7368('0x44')]);return db[_0x7368('0x45')][_0x7368('0x4c')](_0x20d823)[_0x7368('0x29')](handleEntityNotFound(_0x9de46f,null))[_0x7368('0x29')](respondWithResult(_0x9de46f,null))[_0x7368('0x49')](handleError(_0x9de46f,null));};exports[_0x7368('0x4d')]=function(_0xfa47a,_0x3c7944){return db['Interval'][_0x7368('0x4d')](_0xfa47a[_0x7368('0x4e')],{})[_0x7368('0x29')](function(_0x12b0da){var _0x3ac8de=_0xfa47a[_0x7368('0x4f')][_0x7368('0x50')]({'plain':!![]});if(!_0x3ac8de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ac8de[_0x7368('0x51')]===_0x7368('0x4f')){var _0x3ff09d=_0x12b0da[_0x7368('0x50')]({'plain':!![]});var _0x459b33='Intervals';return db[_0x7368('0x52')][_0x7368('0x4c')]({'where':{'name':_0x459b33,'userProfileId':_0x3ac8de['userProfileId']},'raw':!![]})[_0x7368('0x29')](function(_0x3c16fc){if(_0x3c16fc&&_0x3c16fc[_0x7368('0x53')]===0x0){return db[_0x7368('0x54')]['create']({'name':_0x3ff09d[_0x7368('0x2e')],'resourceId':_0x3ff09d['id'],'type':_0x3c16fc[_0x7368('0x2e')],'sectionId':_0x3c16fc['id']},{})['then'](function(){return _0x12b0da;});}else{return _0x12b0da;}})[_0x7368('0x49')](function(_0x3da5ac){logger[_0x7368('0x2c')](_0x7368('0x55'),_0x3da5ac);throw _0x3da5ac;});}return _0x12b0da;})[_0x7368('0x29')](respondWithResult(_0x3c7944,0xc9))[_0x7368('0x49')](handleError(_0x3c7944,null));};exports[_0x7368('0x28')]=function(_0x17e52a,_0x229982){if(_0x17e52a['body']['id']){delete _0x17e52a[_0x7368('0x4e')]['id'];}return db[_0x7368('0x45')][_0x7368('0x4c')]({'where':{'id':_0x17e52a[_0x7368('0x56')]['id']}})[_0x7368('0x29')](handleEntityNotFound(_0x229982,null))['then'](saveUpdates(_0x17e52a[_0x7368('0x4e')],null))[_0x7368('0x29')](respondWithResult(_0x229982,null))['catch'](handleError(_0x229982,null));};exports[_0x7368('0x2a')]=function(_0x1759a6,_0x3cb641){return db[_0x7368('0x45')]['find']({'where':{'id':_0x1759a6['params']['id']}})[_0x7368('0x29')](handleEntityNotFound(_0x3cb641,null))['then'](removeEntity(_0x3cb641,null))[_0x7368('0x49')](handleError(_0x3cb641,null));};exports[_0x7368('0x57')]=function(_0x1750ca,_0x42e797,_0x58f7db){if(_0x1750ca[_0x7368('0x4e')]['id']){delete _0x1750ca[_0x7368('0x4e')]['id'];}return db[_0x7368('0x45')][_0x7368('0x4c')]({'where':{'id':_0x1750ca[_0x7368('0x56')]['id']}})[_0x7368('0x29')](handleEntityNotFound(_0x42e797,null))[_0x7368('0x29')](function(_0x2edd16){if(_0x2edd16){_0x1750ca['body'][_0x7368('0x58')]=_0x2edd16['id'];return db['Interval']['create'](_0x1750ca[_0x7368('0x4e')]);}})[_0x7368('0x29')](respondWithResult(_0x42e797,null))[_0x7368('0x49')](handleError(_0x42e797,null));};exports[_0x7368('0x59')]=function(_0x10322c,_0x189ac7,_0xce563c){var _0x218412={};var _0x29a71e={};var _0x2a1e6c;var _0x5e3cf7;return db[_0x7368('0x45')][_0x7368('0x5a')]({'where':{'id':_0x10322c[_0x7368('0x56')]['id']}})[_0x7368('0x29')](handleEntityNotFound(_0x189ac7,null))[_0x7368('0x29')](function(_0x368ed4){if(_0x368ed4){_0x2a1e6c=_0x368ed4;_0x29a71e['model']=_[_0x7368('0x38')](db[_0x7368('0x45')][_0x7368('0x31')]);_0x29a71e[_0x7368('0x37')]=_['keys'](_0x10322c[_0x7368('0x37')]);_0x29a71e[_0x7368('0x39')]=_[_0x7368('0x3a')](_0x29a71e['model'],_0x29a71e[_0x7368('0x37')]);_0x218412[_0x7368('0x3b')]=_[_0x7368('0x3a')](_0x29a71e[_0x7368('0x35')],qs[_0x7368('0x3c')](_0x10322c[_0x7368('0x37')][_0x7368('0x3c')]));_0x218412[_0x7368('0x3b')]=_0x218412[_0x7368('0x3b')]['length']?_0x218412['attributes']:_0x29a71e['model'];_0x218412[_0x7368('0x5b')]=qs[_0x7368('0x40')](_0x10322c[_0x7368('0x37')][_0x7368('0x40')]);_0x218412[_0x7368('0x41')]=qs[_0x7368('0x39')](_['pick'](_0x10322c[_0x7368('0x37')],_0x29a71e[_0x7368('0x39')]));if(_0x10322c[_0x7368('0x37')][_0x7368('0x43')]){_0x218412[_0x7368('0x41')]=_['merge'](_0x218412[_0x7368('0x41')],{'$or':_[_0x7368('0x36')](_0x218412['attributes'],function(_0x2c5f5b){var _0x1d14b4={};_0x1d14b4[_0x2c5f5b]={'$like':'%'+_0x10322c['query'][_0x7368('0x43')]+'%'};return _0x1d14b4;})});}_0x218412=_[_0x7368('0x42')]({},_0x218412,_0x10322c[_0x7368('0x44')]);return _0x2a1e6c[_0x7368('0x59')](_0x218412);}})[_0x7368('0x29')](function(_0x50b8a0){if(_0x50b8a0){_0x5e3cf7=_0x50b8a0[_0x7368('0x3d')];if(!_0x10322c[_0x7368('0x37')][_0x7368('0x3e')](_0x7368('0x3f'))){_0x218412[_0x7368('0x1f')]=qs[_0x7368('0x1f')](_0x10322c[_0x7368('0x37')][_0x7368('0x1f')]);_0x218412[_0x7368('0x21')]=qs['offset'](_0x10322c[_0x7368('0x37')][_0x7368('0x21')]);}return _0x2a1e6c[_0x7368('0x59')](_0x218412);}})[_0x7368('0x29')](function(_0x477e68){if(_0x477e68){return _0x477e68?{'count':_0x5e3cf7,'rows':_0x477e68}:null;}})[_0x7368('0x29')](respondWithResult(_0x189ac7,null))['catch'](handleError(_0x189ac7,null));};exports[_0x7368('0x5c')]=function(_0x43a4d1,_0x2db7e7,_0x37b042){return db['Interval']['findOne']({'where':{'id':_0x43a4d1[_0x7368('0x56')]['id']}})[_0x7368('0x29')](handleEntityNotFound(_0x2db7e7,null))[_0x7368('0x29')](function(_0x73bf96){if(_0x73bf96){return db[_0x7368('0x5d')][_0x7368('0x5e')](function(_0x40a138){return db[_0x7368('0x45')]['destroy']({'where':{'IntervalId':_0x43a4d1['params']['id']},'transaction':_0x40a138})['then'](function(_0x101a7c){var _0x4e66c0=_[_0x7368('0x36')](_0x43a4d1['body'],function(_0x8448dc){delete _0x8448dc['id'];_0x8448dc['IntervalId']=_0x43a4d1[_0x7368('0x56')]['id'];return _0x8448dc;});return db['Interval'][_0x7368('0x5f')](_0x4e66c0,{'transaction':_0x40a138});});})[_0x7368('0x29')](function(){return db[_0x7368('0x45')][_0x7368('0x47')]({'where':{'IntervalId':_0x43a4d1[_0x7368('0x56')]['id']}});});}})[_0x7368('0x29')](respondWithResult(_0x2db7e7,null))[_0x7368('0x49')](handleError(_0x2db7e7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2bfdd30..4d7e5a8 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 _0x565e=['rewrite','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x36b14e,_0x4ff331){var _0x403a14=function(_0x278b97){while(--_0x278b97){_0x36b14e['push'](_0x36b14e['shift']());}};_0x403a14(++_0x4ff331);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var logger=require(_0xe565('0x1'))(_0xe565('0x2'));var moment=require(_0xe565('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe565('0x4'));var rimraf=require(_0xe565('0x5'));var config=require(_0xe565('0x6'));var attributes=require(_0xe565('0x7'));var extensions=require(_0xe565('0x8'));module[_0xe565('0x9')]=function(_0xe4af03,_0x1a9d48){return _0xe4af03[_0xe565('0xa')](_0xe565('0xb'),attributes,{'tableName':_0xe565('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x14f3df,_0x449b7a){extensions[_0xe565('0xd')](_0xe4af03,_0x14f3df);},'afterBulkCreate':function(_0x1d3d48,_0x41640f,_0x5b82c1){_0x5b82c1();extensions[_0xe565('0xd')](_0xe4af03,_0x1d3d48[0x0]);},'afterUpdate':function(_0x36c827,_0x9fd021){extensions['rewrite'](_0xe4af03,_0x36c827);},'afterDestroy':function(_0x434187,_0x9f674){extensions[_0xe565('0xd')](_0xe4af03,_0x434187);}}});}; \ No newline at end of file +var _0x4bc8=['api','moment','request-promise','path','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger'];(function(_0x373a67,_0x5af5ff){var _0x15d61b=function(_0x226d35){while(--_0x226d35){_0x373a67['push'](_0x373a67['shift']());}};_0x15d61b(++_0x5af5ff);}(_0x4bc8,0xce));var _0x84bc=function(_0x5f526e,_0x57c030){_0x5f526e=_0x5f526e-0x0;var _0x34c2e3=_0x4bc8[_0x5f526e];return _0x34c2e3;};'use strict';var _=require(_0x84bc('0x0'));var util=require('util');var logger=require(_0x84bc('0x1'))(_0x84bc('0x2'));var moment=require(_0x84bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x84bc('0x4'));var fs=require('fs');var path=require(_0x84bc('0x5'));var rimraf=require('rimraf');var config=require(_0x84bc('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x84bc('0x7'));module[_0x84bc('0x8')]=function(_0xd2c6b8,_0x95de2c){return _0xd2c6b8[_0x84bc('0x9')](_0x84bc('0xa'),attributes,{'tableName':_0x84bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x528b60,_0x411f6c){extensions['rewrite'](_0xd2c6b8,_0x528b60);},'afterBulkCreate':function(_0x320592,_0x525551,_0x3fa65c){_0x3fa65c();extensions[_0x84bc('0xc')](_0xd2c6b8,_0x320592[0x0]);},'afterUpdate':function(_0x44ec86,_0x2d2ab4){extensions[_0x84bc('0xc')](_0xd2c6b8,_0x44ec86);},'afterDestroy':function(_0x3853dc,_0x55dc99){extensions['rewrite'](_0xd2c6b8,_0x3853dc);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5f3d7c8..fed9f7a 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ad19e86..b73face 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x0b0e,0x187));var _0xe0b0=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x0b0e[_0x209ec9];return _0x129b1b;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4dbd82a..eafccb2 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 _0x7b58=['\x20from\x20','description','Bug','customfield_11500','email','fields','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','data','status','statusCode','json','error','api.jira','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','Report'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b58,0x100));var _0x87b5=function(_0x37dac2,_0xdb5e75){_0x37dac2=_0x37dac2-0x0;var _0x351e15=_0x7b58[_0x37dac2];return _0x351e15;};'use strict';var BPromise=require(_0x87b5('0x0'));var https=require(_0x87b5('0x1'));var logger=require('../../config/logger')(_0x87b5('0x2'));var USERNAME=_0x87b5('0x3');var PASSWORD=_0x87b5('0x4');function openIssue(_0x380ae4,_0x3bfe8d){var _0x2c5f7c={'fields':{'project':{'key':_0x380ae4[_0x87b5('0x5')]||_0x87b5('0x6')},'summary':(_0x380ae4['summary']||_0x87b5('0x7'))+_0x87b5('0x8')+_0x380ae4['ip'],'description':_0x380ae4[_0x87b5('0x9')]||JSON['stringify'](_0x380ae4),'issuetype':{'name':_0x380ae4['issuetype']||_0x87b5('0xa')}}};_0x2c5f7c['fields'][_0x87b5('0xb')]=_0x380ae4[_0x87b5('0xc')];_0x2c5f7c[_0x87b5('0xd')]['customfield_11501']=_0x380ae4[_0x87b5('0xe')];_0x2c5f7c[_0x87b5('0xd')][_0x87b5('0xf')]=_0x380ae4['newToken'];_0x2c5f7c['fields'][_0x87b5('0x10')]=_0x380ae4[_0x87b5('0x11')];_0x2c5f7c['fields'][_0x87b5('0x12')]=_0x380ae4[_0x87b5('0x13')];_0x2c5f7c[_0x87b5('0xd')][_0x87b5('0x14')]=_0x380ae4['ip'];var _0x2a7d07={'host':_0x87b5('0x15'),'port':0x1bb,'path':_0x87b5('0x16'),'method':_0x87b5('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x87b5('0x18'),'Authorization':_0x87b5('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x87b5('0x1a')](_0x87b5('0x1b'))}};var _0x5b57f8=JSON[_0x87b5('0x1c')](_0x2c5f7c);var _0x5b77ae=https[_0x87b5('0x1d')](_0x2a7d07,function(_0x10d292){_0x10d292[_0x87b5('0x1e')]('utf8');var _0xe0b72e='';_0x10d292['on'](_0x87b5('0x1f'),function(_0x495631){_0xe0b72e+=_0x495631;});_0x10d292['on']('end',function(){if(_0x3bfe8d){return _0x3bfe8d[_0x87b5('0x20')](_0x10d292[_0x87b5('0x21')])[_0x87b5('0x22')](JSON['parse'](_0xe0b72e));}});});_0x5b77ae['on'](_0x87b5('0x23'),function(_0x317829){if(_0x3bfe8d){return _0x3bfe8d[_0x87b5('0x20')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x87b5('0x24')}]});}});_0x5b77ae['write'](_0x5b57f8);_0x5b77ae['end']();}exports['openIssue']=openIssue;exports[_0x87b5('0x25')]=function(_0x700e15,_0x102ad9){_0x700e15[_0x87b5('0x26')]['ip']=_0x700e15[_0x87b5('0x27')][_0x87b5('0x28')]||_0x700e15[_0x87b5('0x29')][_0x87b5('0x2a')]||_0x700e15[_0x87b5('0x2b')][_0x87b5('0x2a')]||_0x700e15['connection']['socket'][_0x87b5('0x2a')];return openIssue(_0x700e15[_0x87b5('0x26')],_0x102ad9);}; \ No newline at end of file +var _0x00f1=['json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','request','setEncoding','data','end','statusCode'];(function(_0x66ddd3,_0x29d8d1){var _0x380940=function(_0x44e159){while(--_0x44e159){_0x66ddd3['push'](_0x66ddd3['shift']());}};_0x380940(++_0x29d8d1);}(_0x00f1,0x16d));var _0x100f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x00f1[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x100f('0x0'));var https=require(_0x100f('0x1'));var logger=require(_0x100f('0x2'))(_0x100f('0x3'));var USERNAME='support';var PASSWORD=_0x100f('0x4');function openIssue(_0x4f4285,_0x3b533c){var _0x5127df={'fields':{'project':{'key':_0x4f4285[_0x100f('0x5')]||_0x100f('0x6')},'summary':(_0x4f4285[_0x100f('0x7')]||_0x100f('0x8'))+_0x100f('0x9')+_0x4f4285['ip'],'description':_0x4f4285['description']||JSON[_0x100f('0xa')](_0x4f4285),'issuetype':{'name':_0x4f4285[_0x100f('0xb')]||_0x100f('0xc')}}};_0x5127df['fields'][_0x100f('0xd')]=_0x4f4285[_0x100f('0xe')];_0x5127df[_0x100f('0xf')][_0x100f('0x10')]=_0x4f4285['oldToken'];_0x5127df['fields'][_0x100f('0x11')]=_0x4f4285['newToken'];_0x5127df[_0x100f('0xf')]['customfield_11503']=_0x4f4285[_0x100f('0x12')];_0x5127df[_0x100f('0xf')][_0x100f('0x13')]=_0x4f4285[_0x100f('0x14')];_0x5127df[_0x100f('0xf')][_0x100f('0x15')]=_0x4f4285['ip'];var _0x43669b={'host':_0x100f('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x100f('0x17'),'Authorization':_0x100f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x100f('0x19')]('base64')}};var _0x3cba5c=JSON['stringify'](_0x5127df);var _0xd41a2c=https[_0x100f('0x1a')](_0x43669b,function(_0x582970){_0x582970[_0x100f('0x1b')]('utf8');var _0xe63f48='';_0x582970['on'](_0x100f('0x1c'),function(_0x16a16a){_0xe63f48+=_0x16a16a;});_0x582970['on'](_0x100f('0x1d'),function(){if(_0x3b533c){return _0x3b533c['status'](_0x582970[_0x100f('0x1e')])[_0x100f('0x1f')](JSON[_0x100f('0x20')](_0xe63f48));}});});_0xd41a2c['on']('error',function(_0x363466){if(_0x3b533c){return _0x3b533c[_0x100f('0x21')](0x1f4)['json']({'errors':[{'message':_0x100f('0x22'),'type':_0x100f('0x23')}]});}});_0xd41a2c[_0x100f('0x24')](_0x3cba5c);_0xd41a2c[_0x100f('0x1d')]();}exports[_0x100f('0x25')]=openIssue;exports['send']=function(_0x3e35e9,_0x542140){_0x3e35e9['body']['ip']=_0x3e35e9[_0x100f('0x26')][_0x100f('0x27')]||_0x3e35e9[_0x100f('0x28')][_0x100f('0x29')]||_0x3e35e9[_0x100f('0x2a')]['remoteAddress']||_0x3e35e9[_0x100f('0x28')][_0x100f('0x2a')]['remoteAddress'];return openIssue(_0x3e35e9[_0x100f('0x2b')],_0x542140);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1a7632f..85e266e 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x4ce637,_0x463346){var _0x2e9cba=function(_0x11f3d1){while(--_0x11f3d1){_0x4ce637['push'](_0x4ce637['shift']());}};_0x2e9cba(++_0x463346);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x492b38,_0x3a5cbc){var _0x2b857e=function(_0x24deff){while(--_0x24deff){_0x492b38['push'](_0x492b38['shift']());}};_0x2b857e(++_0x3a5cbc);}(_0x5b02,0xe9));var _0x25b0=function(_0x55452f,_0x1e1147){_0x55452f=_0x55452f-0x0;var _0xa0a2ca=_0x5b02[_0x55452f];return _0xa0a2ca;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 38b9943..be79e2c 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x19bf29,_0x469f93){_0x19bf29=_0x19bf29-0x0;var _0x5dd635=_0x7a54[_0x19bf29];return _0x5dd635;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x201474,_0x193276){_0x201474=_0x201474-0x0;var _0x1a47a1=_0x7a54[_0x201474];return _0x1a47a1;};'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 73385ae..451ff5e 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 _0x294b=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','catch','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters'];(function(_0x2d636c,_0x3e5b35){var _0x2ae5b6=function(_0x14a03a){while(--_0x14a03a){_0x2d636c['push'](_0x2d636c['shift']());}};_0x2ae5b6(++_0x3e5b35);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={},_0x3c2aa5={},_0x1efdb6={'count':0x0,'rows':[]};var _0x127ddd=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0xbb4a10){return{'name':_0xbb4a10[_0xb294('0x26')],'type':_0xbb4a10[_0xb294('0x27')][_0xb294('0x28')]};});_0x3c2aa5[_0xb294('0x29')]=_[_0xb294('0x2a')](_0x127ddd,_0xb294('0x23'));_0x3c2aa5[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x47fca9[_0xb294('0x2b')]);_0x3c2aa5[_0xb294('0x2d')]=_[_0xb294('0x2e')](_0x3c2aa5[_0xb294('0x29')],_0x3c2aa5['query']);_0x1167e5['attributes']=_[_0xb294('0x2e')](_0x3c2aa5['model'],qs[_0xb294('0x2f')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x2f')]));_0x1167e5[_0xb294('0x30')]=_0x1167e5['attributes'][_0xb294('0x31')]?_0x1167e5[_0xb294('0x30')]:_0x3c2aa5[_0xb294('0x29')];if(!_0x47fca9[_0xb294('0x2b')][_0xb294('0x32')]('nolimit')){_0x1167e5['limit']=qs['limit'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1c')]);_0x1167e5[_0xb294('0x1a')]=qs[_0xb294('0x1a')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1a')]);}_0x1167e5[_0xb294('0x33')]=qs['sort'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x34')]);_0x1167e5[_0xb294('0x35')]=qs[_0xb294('0x2d')](_[_0xb294('0x36')](_0x47fca9[_0xb294('0x2b')],_0x3c2aa5[_0xb294('0x2d')]),_0x127ddd);if(_0x47fca9[_0xb294('0x2b')]['filter']){_0x1167e5['where']=_[_0xb294('0x37')](_0x1167e5['where'],{'$or':_[_0xb294('0x2a')](_0x127ddd,function(_0x565546){if(_0x565546[_0xb294('0x27')]!==_0xb294('0x38')){var _0x2c92cb={};_0x2c92cb[_0x565546[_0xb294('0x23')]]={'$like':'%'+_0x47fca9[_0xb294('0x2b')]['filter']+'%'};return _0x2c92cb;}})});}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x39')]);var _0x2693ec={'where':_0x1167e5[_0xb294('0x35')]};return db[_0xb294('0x3a')][_0xb294('0x1d')](_0x2693ec)[_0xb294('0x20')](function(_0x4ef87e){_0x1efdb6['count']=_0x4ef87e;if(_0x47fca9[_0xb294('0x2b')][_0xb294('0x3b')]){_0x1167e5[_0xb294('0x3c')]=[{'all':!![]}];}return db[_0xb294('0x3a')]['findAll'](_0x1167e5);})['then'](function(_0x1da557){_0x1efdb6['rows']=_0x1da557;return _0x1efdb6;})[_0xb294('0x20')](respondWithFilteredResult(_0x59fbde,_0x1167e5))[_0xb294('0x3d')](handleError(_0x59fbde,null));};exports['show']=function(_0x572e98,_0x4c1f43){var _0x20b1a2={'raw':!![],'where':{'id':_0x572e98[_0xb294('0x3e')]['id']}},_0x164556={};_0x164556['model']=_[_0xb294('0x2c')](db[_0xb294('0x3a')][_0xb294('0x3f')]);_0x164556[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x572e98[_0xb294('0x2b')]);_0x164556[_0xb294('0x2d')]=_['intersection'](_0x164556['model'],_0x164556[_0xb294('0x2b')]);_0x20b1a2[_0xb294('0x30')]=_['intersection'](_0x164556['model'],qs[_0xb294('0x2f')](_0x572e98[_0xb294('0x2b')][_0xb294('0x2f')]));_0x20b1a2[_0xb294('0x30')]=_0x20b1a2['attributes'][_0xb294('0x31')]?_0x20b1a2['attributes']:_0x164556['model'];if(_0x572e98[_0xb294('0x2b')][_0xb294('0x3b')]){_0x20b1a2[_0xb294('0x3c')]=[{'all':!![]}];}_0x20b1a2=_[_0xb294('0x37')]({},_0x20b1a2,_0x572e98[_0xb294('0x39')]);return db['JscriptyAnswerReport'][_0xb294('0x40')](_0x20b1a2)[_0xb294('0x20')](handleEntityNotFound(_0x4c1f43,null))[_0xb294('0x20')](respondWithResult(_0x4c1f43,null))['catch'](handleError(_0x4c1f43,null));};exports['create']=function(_0xce4f4,_0x3cdc29){return db[_0xb294('0x3a')][_0xb294('0x41')](_0xce4f4[_0xb294('0x42')],{})['then'](respondWithResult(_0x3cdc29,0xc9))[_0xb294('0x3d')](handleError(_0x3cdc29,null));};exports[_0xb294('0x43')]=function(_0x459a69,_0x3156e2){if(_0x459a69[_0xb294('0x42')]['id']){delete _0x459a69[_0xb294('0x42')]['id'];}return db[_0xb294('0x3a')][_0xb294('0x40')]({'where':{'id':_0x459a69[_0xb294('0x3e')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3156e2,null))['then'](saveUpdates(_0x459a69[_0xb294('0x42')],null))['then'](respondWithResult(_0x3156e2,null))[_0xb294('0x3d')](handleError(_0x3156e2,null));};exports[_0xb294('0x44')]=function(_0x249b59,_0xd64380){return db[_0xb294('0x3a')]['find']({'where':{'id':_0x249b59['params']['id']}})[_0xb294('0x20')](handleEntityNotFound(_0xd64380,null))[_0xb294('0x20')](removeEntity(_0xd64380,null))[_0xb294('0x3d')](handleError(_0xd64380,null));};exports[_0xb294('0x45')]=function(_0x5589c3,_0x10b068){return db[_0xb294('0x3a')][_0xb294('0x45')]()[_0xb294('0x20')](respondWithResult(_0x10b068,null))[_0xb294('0x3d')](handleError(_0x10b068,null));}; \ No newline at end of file +var _0x1354=['moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x466fed,_0x3e63b7){var _0x21945f=function(_0x5233e4){while(--_0x5233e4){_0x466fed['push'](_0x466fed['shift']());}};_0x21945f(++_0x3e63b7);}(_0x1354,0x95));var _0x4135=function(_0x1e6e39,_0x3c98ed){_0x1e6e39=_0x1e6e39-0x0;var _0x2d9029=_0x1354[_0x1e6e39];return _0x2d9029;};'use strict';var emlformat=require(_0x4135('0x0'));var rimraf=require(_0x4135('0x1'));var zipdir=require(_0x4135('0x2'));var jsonpatch=require(_0x4135('0x3'));var rp=require(_0x4135('0x4'));var moment=require(_0x4135('0x5'));var BPromise=require(_0x4135('0x6'));var Mustache=require('mustache');var util=require(_0x4135('0x7'));var path=require(_0x4135('0x8'));var sox=require(_0x4135('0x9'));var csv=require('to-csv');var ejs=require(_0x4135('0xa'));var fs=require('fs');var fs_extra=require(_0x4135('0xb'));var _=require('lodash');var squel=require(_0x4135('0xc'));var crypto=require(_0x4135('0xd'));var jsforce=require(_0x4135('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4135('0xf'));var querystring=require('querystring');var Papa=require(_0x4135('0x10'));var Redis=require(_0x4135('0x11'));var authService=require(_0x4135('0x12'));var qs=require(_0x4135('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4135('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4135('0x15'));var config=require(_0x4135('0x16'));var licenseUtil=require(_0x4135('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307e6f,_0x838d6f){_0x838d6f=_0x838d6f||0xcc;return function(_0xb825cb){if(_0xb825cb){return _0x307e6f[_0x4135('0x18')](_0x838d6f);}return _0x307e6f[_0x4135('0x19')](_0x838d6f)[_0x4135('0x1a')]();};}function respondWithResult(_0x54f954,_0x50dd01){_0x50dd01=_0x50dd01||0xc8;return function(_0x249c86){if(_0x249c86){return _0x54f954[_0x4135('0x19')](_0x50dd01)[_0x4135('0x1b')](_0x249c86);}};}function respondWithFilteredResult(_0x17179a,_0x4b7609){return function(_0x34fd82){if(_0x34fd82){var _0x2e8733=typeof _0x4b7609['offset']==='undefined'&&typeof _0x4b7609[_0x4135('0x1c')]==='undefined';var _0x2f2600=_0x34fd82['count'];var _0x53f54e=_0x2e8733?0x0:_0x4b7609['offset'];var _0x53f5a7=_0x2e8733?_0x34fd82[_0x4135('0x1d')]:_0x4b7609['offset']+_0x4b7609[_0x4135('0x1c')];var _0xf81757;if(_0x53f5a7>=_0x2f2600){_0x53f5a7=_0x2f2600;_0xf81757=0xc8;}else{_0xf81757=0xce;}_0x17179a[_0x4135('0x19')](_0xf81757);return _0x17179a['set'](_0x4135('0x1e'),_0x53f54e+'-'+_0x53f5a7+'/'+_0x2f2600)[_0x4135('0x1b')](_0x34fd82);}return null;};}function patchUpdates(_0x398294){return function(_0x485395){try{jsonpatch[_0x4135('0x1f')](_0x485395,_0x398294,!![]);}catch(_0x58bdb1){return BPromise[_0x4135('0x20')](_0x58bdb1);}return _0x485395[_0x4135('0x21')]();};}function saveUpdates(_0x314f11,_0x188707){return function(_0x5a3777){if(_0x5a3777){return _0x5a3777[_0x4135('0x22')](_0x314f11)[_0x4135('0x23')](function(_0x32dcf6){return _0x32dcf6;});}return null;};}function removeEntity(_0x3912e9,_0x83a794){return function(_0x2c604b){if(_0x2c604b){return _0x2c604b[_0x4135('0x24')]()[_0x4135('0x23')](function(){_0x3912e9[_0x4135('0x19')](0xcc)[_0x4135('0x1a')]();});}};}function handleEntityNotFound(_0x12a9fd,_0x192126){return function(_0x212228){if(!_0x212228){_0x12a9fd[_0x4135('0x18')](0x194);}return _0x212228;};}function handleError(_0x4b448f,_0x1a3d30){_0x1a3d30=_0x1a3d30||0x1f4;return function(_0x3e40bc){logger[_0x4135('0x25')](_0x3e40bc[_0x4135('0x26')]);if(_0x3e40bc[_0x4135('0x27')]){delete _0x3e40bc[_0x4135('0x27')];}_0x4b448f['status'](_0x1a3d30)[_0x4135('0x28')](_0x3e40bc);};}exports[_0x4135('0x29')]=function(_0x31b508,_0x2c06d0){var _0x284121={},_0x511fce={},_0x411ee0={'count':0x0,'rows':[]};var _0x381e86=_['map'](db[_0x4135('0x2a')]['rawAttributes'],function(_0x2438d2){return{'name':_0x2438d2[_0x4135('0x2b')],'type':_0x2438d2[_0x4135('0x2c')][_0x4135('0x2d')]};});_0x511fce['model']=_[_0x4135('0x2e')](_0x381e86,_0x4135('0x27'));_0x511fce[_0x4135('0x2f')]=_[_0x4135('0x30')](_0x31b508[_0x4135('0x2f')]);_0x511fce[_0x4135('0x31')]=_['intersection'](_0x511fce[_0x4135('0x32')],_0x511fce[_0x4135('0x2f')]);_0x284121['attributes']=_[_0x4135('0x33')](_0x511fce['model'],qs[_0x4135('0x34')](_0x31b508[_0x4135('0x2f')]['fields']));_0x284121['attributes']=_0x284121[_0x4135('0x35')][_0x4135('0x36')]?_0x284121[_0x4135('0x35')]:_0x511fce['model'];if(!_0x31b508[_0x4135('0x2f')][_0x4135('0x37')](_0x4135('0x38'))){_0x284121['limit']=qs[_0x4135('0x1c')](_0x31b508[_0x4135('0x2f')]['limit']);_0x284121[_0x4135('0x39')]=qs[_0x4135('0x39')](_0x31b508['query'][_0x4135('0x39')]);}_0x284121['order']=qs[_0x4135('0x3a')](_0x31b508[_0x4135('0x2f')][_0x4135('0x3a')]);_0x284121[_0x4135('0x3b')]=qs[_0x4135('0x31')](_[_0x4135('0x3c')](_0x31b508['query'],_0x511fce[_0x4135('0x31')]),_0x381e86);if(_0x31b508[_0x4135('0x2f')]['filter']){_0x284121[_0x4135('0x3b')]=_['merge'](_0x284121[_0x4135('0x3b')],{'$or':_[_0x4135('0x2e')](_0x381e86,function(_0x14f353){if(_0x14f353[_0x4135('0x2c')]!==_0x4135('0x3d')){var _0x41ce9e={};_0x41ce9e[_0x14f353[_0x4135('0x27')]]={'$like':'%'+_0x31b508[_0x4135('0x2f')][_0x4135('0x3e')]+'%'};return _0x41ce9e;}})});}_0x284121=_[_0x4135('0x3f')]({},_0x284121,_0x31b508[_0x4135('0x40')]);var _0x53689f={'where':_0x284121['where']};return db[_0x4135('0x2a')][_0x4135('0x1d')](_0x53689f)[_0x4135('0x23')](function(_0x2dfd11){_0x411ee0[_0x4135('0x1d')]=_0x2dfd11;if(_0x31b508['query'][_0x4135('0x41')]){_0x284121[_0x4135('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4135('0x43')](_0x284121);})[_0x4135('0x23')](function(_0x1ddad4){_0x411ee0[_0x4135('0x44')]=_0x1ddad4;return _0x411ee0;})['then'](respondWithFilteredResult(_0x2c06d0,_0x284121))['catch'](handleError(_0x2c06d0,null));};exports[_0x4135('0x45')]=function(_0x58c6e1,_0x166ecb){var _0x5894fb={'raw':!![],'where':{'id':_0x58c6e1['params']['id']}},_0x25d1c4={};_0x25d1c4[_0x4135('0x32')]=_['keys'](db[_0x4135('0x2a')][_0x4135('0x46')]);_0x25d1c4[_0x4135('0x2f')]=_['keys'](_0x58c6e1[_0x4135('0x2f')]);_0x25d1c4[_0x4135('0x31')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],_0x25d1c4[_0x4135('0x2f')]);_0x5894fb[_0x4135('0x35')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],qs[_0x4135('0x34')](_0x58c6e1[_0x4135('0x2f')]['fields']));_0x5894fb[_0x4135('0x35')]=_0x5894fb[_0x4135('0x35')][_0x4135('0x36')]?_0x5894fb[_0x4135('0x35')]:_0x25d1c4[_0x4135('0x32')];if(_0x58c6e1['query'][_0x4135('0x41')]){_0x5894fb['include']=[{'all':!![]}];}_0x5894fb=_['merge']({},_0x5894fb,_0x58c6e1[_0x4135('0x40')]);return db[_0x4135('0x2a')][_0x4135('0x47')](_0x5894fb)[_0x4135('0x23')](handleEntityNotFound(_0x166ecb,null))[_0x4135('0x23')](respondWithResult(_0x166ecb,null))[_0x4135('0x48')](handleError(_0x166ecb,null));};exports[_0x4135('0x49')]=function(_0x18aed5,_0x13f1f1){return db[_0x4135('0x2a')][_0x4135('0x49')](_0x18aed5[_0x4135('0x4a')],{})[_0x4135('0x23')](respondWithResult(_0x13f1f1,0xc9))[_0x4135('0x48')](handleError(_0x13f1f1,null));};exports[_0x4135('0x22')]=function(_0x74a924,_0x540029){if(_0x74a924[_0x4135('0x4a')]['id']){delete _0x74a924['body']['id'];}return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x74a924[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x540029,null))[_0x4135('0x23')](saveUpdates(_0x74a924[_0x4135('0x4a')],null))[_0x4135('0x23')](respondWithResult(_0x540029,null))['catch'](handleError(_0x540029,null));};exports['destroy']=function(_0x1b98e8,_0x5b6255){return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x1b98e8[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5b6255,null))[_0x4135('0x23')](removeEntity(_0x5b6255,null))[_0x4135('0x48')](handleError(_0x5b6255,null));};exports['describe']=function(_0x1c4049,_0x31c532){return db[_0x4135('0x2a')][_0x4135('0x4c')]()[_0x4135('0x23')](respondWithResult(_0x31c532,null))[_0x4135('0x48')](handleError(_0x31c532,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index dedf33c..2421440 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 _0xdf2d=['exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0xdf2d,0x9f));var _0xddf2=function(_0x3e7b3b,_0x14d240){_0x3e7b3b=_0x3e7b3b-0x0;var _0x2aa720=_0xdf2d[_0x3e7b3b];return _0x2aa720;};'use strict';var _=require(_0xddf2('0x0'));var util=require(_0xddf2('0x1'));var logger=require(_0xddf2('0x2'))(_0xddf2('0x3'));var moment=require(_0xddf2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xddf2('0x5'));var rimraf=require(_0xddf2('0x6'));var config=require(_0xddf2('0x7'));var attributes=require(_0xddf2('0x8'));module[_0xddf2('0x9')]=function(_0x489a5b,_0x5d501f){return _0x489a5b[_0xddf2('0xa')](_0xddf2('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x713c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x1c9680,_0x356cd9){var _0x266f3d=function(_0x5bc378){while(--_0x5bc378){_0x1c9680['push'](_0x1c9680['shift']());}};_0x266f3d(++_0x356cd9);}(_0x713c,0x1e1));var _0xc713=function(_0xce53c8,_0xe8e7dd){_0xce53c8=_0xce53c8-0x0;var _0x45b31d=_0x713c[_0xce53c8];return _0x45b31d;};'use strict';var _=require(_0xc713('0x0'));var util=require(_0xc713('0x1'));var logger=require(_0xc713('0x2'))(_0xc713('0x3'));var moment=require(_0xc713('0x4'));var BPromise=require(_0xc713('0x5'));var rp=require(_0xc713('0x6'));var fs=require('fs');var path=require(_0xc713('0x7'));var rimraf=require(_0xc713('0x8'));var config=require(_0xc713('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xc713('0xa')]=function(_0x3e4370,_0x350ff8){return _0x3e4370['define'](_0xc713('0xb'),attributes,{'tableName':_0xc713('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 930a3c8..78761dd 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 _0xae47=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xae47,0x162));var _0x7ae4=function(_0x51924c,_0x13d407){_0x51924c=_0x51924c-0x0;var _0x49ea2f=_0xae47[_0x51924c];return _0x49ea2f;};'use strict';var _=require(_0x7ae4('0x0'));var util=require(_0x7ae4('0x1'));var moment=require('moment');var BPromise=require(_0x7ae4('0x2'));var rs=require(_0x7ae4('0x3'));var fs=require('fs');var Redis=require(_0x7ae4('0x4'));var db=require(_0x7ae4('0x5'))['db'];var utils=require(_0x7ae4('0x6'));var logger=require('../../config/logger')(_0x7ae4('0x7'));var config=require(_0x7ae4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ae4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43364a,_0x9f1e31,_0xa9c597){return new BPromise(function(_0x17d28c,_0x22be6c){return client[_0x7ae4('0xa')](_0x43364a,_0xa9c597)[_0x7ae4('0xb')](function(_0x247a6e){logger[_0x7ae4('0xc')](_0x7ae4('0xd'),_0x9f1e31,_0x7ae4('0xe'));logger[_0x7ae4('0xf')](_0x7ae4('0x10'),_0x9f1e31,_0x7ae4('0xe'),JSON[_0x7ae4('0x11')](_0x247a6e));if(_0x247a6e[_0x7ae4('0x12')]){if(_0x247a6e[_0x7ae4('0x12')]['code']===0x1f4){logger[_0x7ae4('0x12')](_0x7ae4('0xd'),_0x9f1e31,_0x247a6e[_0x7ae4('0x12')][_0x7ae4('0x13')]);return _0x22be6c(_0x247a6e[_0x7ae4('0x12')]['message']);}logger[_0x7ae4('0x12')](_0x7ae4('0xd'),_0x9f1e31,_0x247a6e['error'][_0x7ae4('0x13')]);return _0x17d28c(_0x247a6e[_0x7ae4('0x12')][_0x7ae4('0x13')]);}else{logger['info'](_0x7ae4('0xd'),_0x9f1e31,'request\x20sent');_0x17d28c(_0x247a6e[_0x7ae4('0x14')][_0x7ae4('0x13')]);}})[_0x7ae4('0x15')](function(_0xee4502){logger['error'](_0x7ae4('0xd'),_0x9f1e31,_0xee4502);_0x22be6c(_0xee4502);});});} \ No newline at end of file +var _0xc959=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2fea0b,_0x1427b2){var _0x80f5ec=function(_0x3070c2){while(--_0x3070c2){_0x2fea0b['push'](_0x2fea0b['shift']());}};_0x80f5ec(++_0x1427b2);}(_0xc959,0x1d2));var _0x9c95=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc959[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x9c95('0x0'));var util=require(_0x9c95('0x1'));var moment=require(_0x9c95('0x2'));var BPromise=require(_0x9c95('0x3'));var rs=require(_0x9c95('0x4'));var fs=require('fs');var Redis=require(_0x9c95('0x5'));var db=require(_0x9c95('0x6'))['db'];var utils=require(_0x9c95('0x7'));var logger=require(_0x9c95('0x8'))(_0x9c95('0x9'));var config=require(_0x9c95('0xa'));var jayson=require(_0x9c95('0xb'));var client=jayson[_0x9c95('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2b6b,_0x2b991e,_0x308663){return new BPromise(function(_0x517e1b,_0xf42903){return client[_0x9c95('0xd')](_0x1f2b6b,_0x308663)[_0x9c95('0xe')](function(_0x4cc49f){logger[_0x9c95('0xf')](_0x9c95('0x10'),_0x2b991e,_0x9c95('0x11'));logger[_0x9c95('0x12')](_0x9c95('0x13'),_0x2b991e,'request\x20sent',JSON[_0x9c95('0x14')](_0x4cc49f));if(_0x4cc49f[_0x9c95('0x15')]){if(_0x4cc49f['error'][_0x9c95('0x16')]===0x1f4){logger[_0x9c95('0x15')](_0x9c95('0x10'),_0x2b991e,_0x4cc49f['error'][_0x9c95('0x17')]);return _0xf42903(_0x4cc49f[_0x9c95('0x15')]['message']);}logger[_0x9c95('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b991e,_0x4cc49f[_0x9c95('0x15')][_0x9c95('0x17')]);return _0x517e1b(_0x4cc49f['error']['message']);}else{logger[_0x9c95('0xf')](_0x9c95('0x10'),_0x2b991e,'request\x20sent');_0x517e1b(_0x4cc49f[_0x9c95('0x18')]['message']);}})[_0x9c95('0x19')](function(_0x1b9399){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b991e,_0x1b9399);_0xf42903(_0x1b9399);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d5c9dd0..9533fbe 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 _0x0a15=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4ed675,_0x4824d8){var _0x32c39a=function(_0x14ff48){while(--_0x14ff48){_0x4ed675['push'](_0x4ed675['shift']());}};_0x32c39a(++_0x4824d8);}(_0x0a15,0xb1));var _0x50a1=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x0a15[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0x50a1('0x0'));var util=require(_0x50a1('0x1'));var path=require('path');var timeout=require(_0x50a1('0x2'));var express=require(_0x50a1('0x3'));var router=express['Router']();var fs_extra=require(_0x50a1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x50a1('0x5'));var config=require(_0x50a1('0x6'));var controller=require('./jscriptyProject.controller');router[_0x50a1('0x7')]('/',auth[_0x50a1('0x8')](),controller[_0x50a1('0x9')]);router['get'](_0x50a1('0xa'),auth[_0x50a1('0x8')](),controller[_0x50a1('0xb')]);router['get'](_0x50a1('0xc'),auth[_0x50a1('0x8')](),controller[_0x50a1('0xd')]);router[_0x50a1('0x7')](_0x50a1('0xe'),auth['isAuthenticated'](),controller[_0x50a1('0xf')]);router['get'](_0x50a1('0x10'),auth[_0x50a1('0x8')](),timeout('30s'),controller[_0x50a1('0x11')]);router['post']('/',auth[_0x50a1('0x8')](),controller[_0x50a1('0x12')]);router[_0x50a1('0x13')]('/:id/clone',auth[_0x50a1('0x8')](),controller['clone']);router[_0x50a1('0x14')](_0x50a1('0xa'),auth[_0x50a1('0x8')](),controller[_0x50a1('0x15')]);router['delete']('/:id',auth[_0x50a1('0x8')](),controller['destroy']);module[_0x50a1('0x16')]=router; \ No newline at end of file +var _0x5cb3=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','getSummary','post','create','put','update'];(function(_0x80a0,_0x373af1){var _0x2e78e3=function(_0x3cda32){while(--_0x3cda32){_0x80a0['push'](_0x80a0['shift']());}};_0x2e78e3(++_0x373af1);}(_0x5cb3,0x1ba));var _0x35cb=function(_0x6b8dcf,_0x2c3fd3){_0x6b8dcf=_0x6b8dcf-0x0;var _0x1e79d=_0x5cb3[_0x6b8dcf];return _0x1e79d;};'use strict';var multer=require('multer');var util=require(_0x35cb('0x0'));var path=require(_0x35cb('0x1'));var timeout=require(_0x35cb('0x2'));var express=require(_0x35cb('0x3'));var router=express[_0x35cb('0x4')]();var fs_extra=require(_0x35cb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x35cb('0x6'));var controller=require(_0x35cb('0x7'));router[_0x35cb('0x8')]('/',auth['isAuthenticated'](),controller[_0x35cb('0x9')]);router[_0x35cb('0x8')](_0x35cb('0xa'),auth[_0x35cb('0xb')](),controller[_0x35cb('0xc')]);router[_0x35cb('0x8')](_0x35cb('0xd'),auth['isAuthenticated'](),controller[_0x35cb('0xe')]);router['get']('/:id/answers',auth[_0x35cb('0xb')](),controller['getAnswers']);router['get']('/:id/summary',auth[_0x35cb('0xb')](),timeout('30s'),controller[_0x35cb('0xf')]);router[_0x35cb('0x10')]('/',auth[_0x35cb('0xb')](),controller[_0x35cb('0x11')]);router['post']('/:id/clone',auth[_0x35cb('0xb')](),controller['clone']);router[_0x35cb('0x12')](_0x35cb('0xa'),auth['isAuthenticated'](),controller[_0x35cb('0x13')]);router[_0x35cb('0x14')](_0x35cb('0xa'),auth[_0x35cb('0xb')](),controller[_0x35cb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e3d0f91..ce0e55e 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 _0x8aaf=['sequelize','lodash','util','exports','STRING','name','isObjectLike','setDataValue','formData','isString','format','getDataValue','BOOLEAN'];(function(_0x430282,_0x4936a1){var _0x3330c2=function(_0x343d8b){while(--_0x343d8b){_0x430282['push'](_0x430282['shift']());}};_0x3330c2(++_0x4936a1);}(_0x8aaf,0x12b));var _0xf8aa=function(_0x5d868f,_0x5cea17){_0x5d868f=_0x5d868f-0x0;var _0x30fb38=_0x8aaf[_0x5d868f];return _0x30fb38;};'use strict';var Sequelize=require(_0xf8aa('0x0'));var _=require(_0xf8aa('0x1'));var util=require(_0xf8aa('0x2'));module[_0xf8aa('0x3')]={'name':{'type':Sequelize[_0xf8aa('0x4')],'unique':_0xf8aa('0x5')},'description':{'type':Sequelize[_0xf8aa('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x5a9e05){if(_[_0xf8aa('0x6')](_0x5a9e05)){this[_0xf8aa('0x7')](_0xf8aa('0x8'),JSON['stringify'](_0x5a9e05));}else if(_[_0xf8aa('0x9')](_0x5a9e05)){this[_0xf8aa('0x7')](_0xf8aa('0x8'),_0x5a9e05);}else{this[_0xf8aa('0x7')](_0xf8aa('0x8'),util[_0xf8aa('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf8aa('0xb')](_0xf8aa('0x5'))||'',this[_0xf8aa('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf8aa('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf8aa('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xd0cc=['formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','isString'];(function(_0x4fa40f,_0x44ae7d){var _0x32d7e1=function(_0x22cba3){while(--_0x22cba3){_0x4fa40f['push'](_0x4fa40f['shift']());}};_0x32d7e1(++_0x44ae7d);}(_0xd0cc,0x76));var _0xcd0c=function(_0x54f46e,_0x41ef7b){_0x54f46e=_0x54f46e-0x0;var _0xb9421=_0xd0cc[_0x54f46e];return _0xb9421;};'use strict';var Sequelize=require(_0xcd0c('0x0'));var _=require(_0xcd0c('0x1'));var util=require(_0xcd0c('0x2'));module[_0xcd0c('0x3')]={'name':{'type':Sequelize[_0xcd0c('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xcd0c('0x4')]},'formData':{'type':Sequelize[_0xcd0c('0x5')](_0xcd0c('0x6')),'set':function(_0x2ce1f6){if(_[_0xcd0c('0x7')](_0x2ce1f6)){this[_0xcd0c('0x8')]('formData',JSON['stringify'](_0x2ce1f6));}else if(_[_0xcd0c('0x9')](_0x2ce1f6)){this[_0xcd0c('0x8')](_0xcd0c('0xa'),_0x2ce1f6);}else{this['setDataValue'](_0xcd0c('0xa'),util['format'](_0xcd0c('0xb'),this[_0xcd0c('0xc')](_0xcd0c('0xd'))||'',this['getDataValue'](_0xcd0c('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcd0c('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd0c('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 76b41dc..eb4d55f 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 _0x8cce=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','reject','update','destroy','then','get','Projects','UserProfileResource','end','sendStatus','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','length','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','JscriptySessionReport','ProjectId','count','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','setHeader','Content-type','text/csv','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x8cce,0xd6));var _0xe8cc=function(_0x18bc57,_0x4d41c6){_0x18bc57=_0x18bc57-0x0;var _0x1ec94b=_0x8cce[_0x18bc57];return _0x1ec94b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe8cc('0x1'));var moment=require(_0xe8cc('0x2'));var BPromise=require(_0xe8cc('0x3'));var Mustache=require(_0xe8cc('0x4'));var util=require(_0xe8cc('0x5'));var path=require(_0xe8cc('0x6'));var sox=require(_0xe8cc('0x7'));var csv=require(_0xe8cc('0x8'));var ejs=require(_0xe8cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8cc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe8cc('0xb'));var toCsv=require(_0xe8cc('0x8'));var querystring=require('querystring');var Papa=require(_0xe8cc('0xc'));var Redis=require('ioredis');var authService=require(_0xe8cc('0xd'));var qs=require(_0xe8cc('0xe'));var as=require(_0xe8cc('0xf'));var hardwareService=require(_0xe8cc('0x10'));var logger=require(_0xe8cc('0x11'))(_0xe8cc('0x12'));var utils=require('../../config/utils');var config=require(_0xe8cc('0x13'));var licenseUtil=require(_0xe8cc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ca304,_0x3a047f){_0x3a047f=_0x3a047f||0xcc;return function(_0x5d6c68){if(_0x5d6c68){return _0x4ca304['sendStatus'](_0x3a047f);}return _0x4ca304[_0xe8cc('0x15')](_0x3a047f)['end']();};}function respondWithResult(_0x2bafa2,_0x3e79dc){_0x3e79dc=_0x3e79dc||0xc8;return function(_0x141b81){if(_0x141b81){return _0x2bafa2['status'](_0x3e79dc)[_0xe8cc('0x16')](_0x141b81);}};}function respondWithFilteredResult(_0x3c4a50,_0x3728a2){return function(_0x19e100){if(_0x19e100){var _0xe2003b=typeof _0x3728a2[_0xe8cc('0x17')]===_0xe8cc('0x18')&&typeof _0x3728a2[_0xe8cc('0x19')]===_0xe8cc('0x18');var _0x9dd2ae=_0x19e100['count'];var _0x53656f=_0xe2003b?0x0:_0x3728a2[_0xe8cc('0x17')];var _0xb703cc=_0xe2003b?_0x19e100['count']:_0x3728a2['offset']+_0x3728a2[_0xe8cc('0x19')];var _0xcd967b;if(_0xb703cc>=_0x9dd2ae){_0xb703cc=_0x9dd2ae;_0xcd967b=0xc8;}else{_0xcd967b=0xce;}_0x3c4a50[_0xe8cc('0x15')](_0xcd967b);return _0x3c4a50[_0xe8cc('0x1a')](_0xe8cc('0x1b'),_0x53656f+'-'+_0xb703cc+'/'+_0x9dd2ae)[_0xe8cc('0x16')](_0x19e100);}return null;};}function patchUpdates(_0x445f4f){return function(_0x3cece3){try{jsonpatch['apply'](_0x3cece3,_0x445f4f,!![]);}catch(_0x5a15c4){return BPromise[_0xe8cc('0x1c')](_0x5a15c4);}return _0x3cece3['save']();};}function saveUpdates(_0x528c4a,_0x342829){return function(_0xf79d53){if(_0xf79d53){return _0xf79d53[_0xe8cc('0x1d')](_0x528c4a)['then'](function(_0x121444){return _0x121444;});}return null;};}function removeEntity(_0x370172,_0x2360ce){return function(_0xf27cbc){if(_0xf27cbc){return _0xf27cbc[_0xe8cc('0x1e')]()[_0xe8cc('0x1f')](function(){var _0x2106d4=_0xf27cbc[_0xe8cc('0x20')]({'plain':!![]});var _0x58cd29=_0xe8cc('0x21');return db[_0xe8cc('0x22')][_0xe8cc('0x1e')]({'where':{'type':_0x58cd29,'resourceId':_0x2106d4['id']}})[_0xe8cc('0x1f')](function(){return _0xf27cbc;});})[_0xe8cc('0x1f')](function(){_0x370172[_0xe8cc('0x15')](0xcc)[_0xe8cc('0x23')]();});}};}function handleEntityNotFound(_0x2c5fb2,_0x2eb672){return function(_0x3a69fe){if(!_0x3a69fe){_0x2c5fb2[_0xe8cc('0x24')](0x194);}return _0x3a69fe;};}function handleError(_0x242597,_0x205c47){_0x205c47=_0x205c47||0x1f4;return function(_0x35029c){logger['error'](_0x35029c[_0xe8cc('0x25')]);if(_0x35029c[_0xe8cc('0x26')]){delete _0x35029c['name'];}_0x242597[_0xe8cc('0x15')](_0x205c47)[_0xe8cc('0x27')](_0x35029c);};}exports[_0xe8cc('0x28')]=function(_0xc86b7c,_0x2df31){var _0x45a0a2={},_0xdc9b1b={},_0x407137={'count':0x0,'rows':[]};var _0x2bab8d=_['map'](db[_0xe8cc('0x29')][_0xe8cc('0x2a')],function(_0x3341e2){return{'name':_0x3341e2[_0xe8cc('0x2b')],'type':_0x3341e2[_0xe8cc('0x2c')][_0xe8cc('0x2d')]};});_0xdc9b1b[_0xe8cc('0x2e')]=_[_0xe8cc('0x2f')](_0x2bab8d,_0xe8cc('0x26'));_0xdc9b1b[_0xe8cc('0x30')]=_[_0xe8cc('0x31')](_0xc86b7c[_0xe8cc('0x30')]);_0xdc9b1b['filters']=_['intersection'](_0xdc9b1b['model'],_0xdc9b1b['query']);_0x45a0a2[_0xe8cc('0x32')]=_[_0xe8cc('0x33')](_0xdc9b1b[_0xe8cc('0x2e')],qs['fields'](_0xc86b7c[_0xe8cc('0x30')][_0xe8cc('0x34')]));_0x45a0a2[_0xe8cc('0x32')]=_0x45a0a2[_0xe8cc('0x32')]['length']?_0x45a0a2[_0xe8cc('0x32')]:_0xdc9b1b['model'];if(!_0xc86b7c[_0xe8cc('0x30')][_0xe8cc('0x35')]('nolimit')){_0x45a0a2[_0xe8cc('0x19')]=qs[_0xe8cc('0x19')](_0xc86b7c[_0xe8cc('0x30')]['limit']);_0x45a0a2[_0xe8cc('0x17')]=qs[_0xe8cc('0x17')](_0xc86b7c['query'][_0xe8cc('0x17')]);}_0x45a0a2[_0xe8cc('0x36')]=qs[_0xe8cc('0x37')](_0xc86b7c[_0xe8cc('0x30')][_0xe8cc('0x37')]);_0x45a0a2[_0xe8cc('0x38')]=qs[_0xe8cc('0x39')](_[_0xe8cc('0x3a')](_0xc86b7c[_0xe8cc('0x30')],_0xdc9b1b[_0xe8cc('0x39')]),_0x2bab8d);if(_0xc86b7c[_0xe8cc('0x30')][_0xe8cc('0x3b')]){_0x45a0a2[_0xe8cc('0x38')]=_[_0xe8cc('0x3c')](_0x45a0a2[_0xe8cc('0x38')],{'$or':_['map'](_0x2bab8d,function(_0x1fb9f4){if(_0x1fb9f4['type']!==_0xe8cc('0x3d')){var _0x35a433={};_0x35a433[_0x1fb9f4[_0xe8cc('0x26')]]={'$like':'%'+_0xc86b7c[_0xe8cc('0x30')][_0xe8cc('0x3b')]+'%'};return _0x35a433;}})});}_0x45a0a2=_['merge']({},_0x45a0a2,_0xc86b7c['options']);var _0x4ebfb7={'where':_0x45a0a2[_0xe8cc('0x38')]};return db['JscriptyProject']['count'](_0x4ebfb7)['then'](function(_0xf1c50e){_0x407137['count']=_0xf1c50e;if(_0xc86b7c['query']['includeAll']){_0x45a0a2[_0xe8cc('0x3e')]=[{'all':!![]}];}return db[_0xe8cc('0x29')]['findAll'](_0x45a0a2);})[_0xe8cc('0x1f')](function(_0x36546c){_0x407137[_0xe8cc('0x3f')]=_0x36546c;return _0x407137;})[_0xe8cc('0x1f')](respondWithFilteredResult(_0x2df31,_0x45a0a2))[_0xe8cc('0x40')](handleError(_0x2df31,null));};exports['show']=function(_0x460810,_0x5b9524){var _0xff80d8={'raw':![],'where':{'id':_0x460810['params']['id']}},_0xeb3bc6={};_0xeb3bc6['model']=_[_0xe8cc('0x31')](db[_0xe8cc('0x29')]['rawAttributes']);_0xeb3bc6[_0xe8cc('0x30')]=_['keys'](_0x460810[_0xe8cc('0x30')]);_0xeb3bc6[_0xe8cc('0x39')]=_[_0xe8cc('0x33')](_0xeb3bc6[_0xe8cc('0x2e')],_0xeb3bc6['query']);_0xff80d8[_0xe8cc('0x32')]=_['intersection'](_0xeb3bc6['model'],qs[_0xe8cc('0x34')](_0x460810[_0xe8cc('0x30')][_0xe8cc('0x34')]));_0xff80d8['attributes']=_0xff80d8[_0xe8cc('0x32')]['length']?_0xff80d8[_0xe8cc('0x32')]:_0xeb3bc6['model'];if(_0x460810[_0xe8cc('0x30')]['includeAll']){_0xff80d8[_0xe8cc('0x3e')]=[{'all':!![]}];}_0xff80d8=_[_0xe8cc('0x3c')]({},_0xff80d8,_0x460810[_0xe8cc('0x41')]);return db[_0xe8cc('0x29')][_0xe8cc('0x42')](_0xff80d8)[_0xe8cc('0x1f')](handleEntityNotFound(_0x5b9524,null))['then'](respondWithResult(_0x5b9524,null))[_0xe8cc('0x40')](handleError(_0x5b9524,null));};exports[_0xe8cc('0x43')]=function(_0x171498,_0x3c1acd){return db[_0xe8cc('0x29')]['create'](_0x171498[_0xe8cc('0x44')],{})['then'](function(_0x2b9da0){var _0x205ac5=_0x171498[_0xe8cc('0x45')]['get']({'plain':!![]});if(!_0x205ac5)throw new Error(_0xe8cc('0x46'));if(_0x205ac5[_0xe8cc('0x47')]==='user'){var _0x52d9ea=_0x2b9da0[_0xe8cc('0x20')]({'plain':!![]});var _0x1e6417=_0xe8cc('0x21');return db[_0xe8cc('0x48')][_0xe8cc('0x42')]({'where':{'name':_0x1e6417,'userProfileId':_0x205ac5[_0xe8cc('0x49')]},'raw':!![]})['then'](function(_0xa2c22){if(_0xa2c22&&_0xa2c22['autoAssociation']===0x0){return db[_0xe8cc('0x22')][_0xe8cc('0x43')]({'name':_0x52d9ea[_0xe8cc('0x26')],'resourceId':_0x52d9ea['id'],'type':_0xa2c22[_0xe8cc('0x26')],'sectionId':_0xa2c22['id']},{})['then'](function(){return _0x2b9da0;});}else{return _0x2b9da0;}})[_0xe8cc('0x40')](function(_0x451c2c){logger[_0xe8cc('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x451c2c);throw _0x451c2c;});}return _0x2b9da0;})[_0xe8cc('0x1f')](respondWithResult(_0x3c1acd,0xc9))[_0xe8cc('0x40')](handleError(_0x3c1acd,null));};exports['clone']=function(_0x618251,_0x45bee8){var _0x556c62={'where':{'id':_0x618251['params']['id']}},_0x5a9a46={};_0x5a9a46[_0xe8cc('0x2e')]=_[_0xe8cc('0x31')](db[_0xe8cc('0x29')][_0xe8cc('0x2a')]);_0x556c62[_0xe8cc('0x32')]=_['intersection'](_0x5a9a46['model'],qs[_0xe8cc('0x34')](_0x618251[_0xe8cc('0x30')]['fields']));_0x556c62[_0xe8cc('0x32')]=_0x556c62[_0xe8cc('0x32')][_0xe8cc('0x4b')]?_0x556c62[_0xe8cc('0x32')]:_0x5a9a46['model'];if(_0x618251['query'][_0xe8cc('0x4c')]){_0x556c62[_0xe8cc('0x3e')]=[{'all':!![]}];}_0x556c62=_[_0xe8cc('0x3c')]({},_0x556c62,_0x618251[_0xe8cc('0x41')]);return db[_0xe8cc('0x29')]['find'](_0x556c62)[_0xe8cc('0x1f')](handleEntityNotFound(_0x45bee8,null))[_0xe8cc('0x1f')](function(_0x26aaee){if(_0x26aaee){var _0x43ceb2=_0x26aaee['get']({'plain':!![]});_0x43ceb2=qs[_0xe8cc('0x4d')](_0x43ceb2,['id',_0xe8cc('0x4e'),_0xe8cc('0x4f')]);_0x618251[_0xe8cc('0x44')]=_[_0xe8cc('0x4d')](_0x618251[_0xe8cc('0x44')],['id',_0xe8cc('0x4e'),_0xe8cc('0x4f')]);return db['JscriptyProject'][_0xe8cc('0x43')](_[_0xe8cc('0x3c')](_0x43ceb2,_0x618251['body']),{'include':_0x618251[_0xe8cc('0x30')][_0xe8cc('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x2d8c05){var _0x143821=_0x618251['user'][_0xe8cc('0x20')]({'plain':!![]});if(!_0x143821)throw new Error(_0xe8cc('0x46'));if(_0x143821[_0xe8cc('0x47')]===_0xe8cc('0x45')){var _0x455b85=_0x2d8c05['get']({'plain':!![]});var _0x1ae878=_0xe8cc('0x21');return db[_0xe8cc('0x48')][_0xe8cc('0x42')]({'where':{'name':_0x1ae878,'userProfileId':_0x143821[_0xe8cc('0x49')]},'raw':!![]})['then'](function(_0x321580){if(_0x321580&&_0x321580['autoAssociation']===0x0){return db['UserProfileResource'][_0xe8cc('0x43')]({'name':_0x455b85[_0xe8cc('0x26')],'resourceId':_0x455b85['id'],'type':_0x321580[_0xe8cc('0x26')],'sectionId':_0x321580['id']},{})[_0xe8cc('0x1f')](function(){return _0x2d8c05;});}else{return _0x2d8c05;}})[_0xe8cc('0x40')](function(_0x4df695){logger[_0xe8cc('0x4a')](_0xe8cc('0x50'),_0x4df695);throw _0x4df695;});}return _0x2d8c05;});}})[_0xe8cc('0x1f')](respondWithResult(_0x45bee8,0xc9))[_0xe8cc('0x40')](handleError(_0x45bee8,null));};exports['update']=function(_0x4452ee,_0x456d7e){if(_0x4452ee[_0xe8cc('0x44')]['id']){delete _0x4452ee[_0xe8cc('0x44')]['id'];}return db[_0xe8cc('0x29')][_0xe8cc('0x42')]({'where':{'id':_0x4452ee[_0xe8cc('0x51')]['id']}})['then'](handleEntityNotFound(_0x456d7e,null))['then'](saveUpdates(_0x4452ee[_0xe8cc('0x44')],null))[_0xe8cc('0x1f')](respondWithResult(_0x456d7e,null))['catch'](handleError(_0x456d7e,null));};exports[_0xe8cc('0x1e')]=function(_0xaea2b6,_0x54d802){return db['JscriptyProject'][_0xe8cc('0x42')]({'where':{'id':_0xaea2b6[_0xe8cc('0x51')]['id']}})[_0xe8cc('0x1f')](handleEntityNotFound(_0x54d802,null))[_0xe8cc('0x1f')](removeEntity(_0x54d802,null))[_0xe8cc('0x40')](handleError(_0x54d802,null));};exports['getSessions']=function(_0x490230,_0x4bb1ed,_0x325218){var _0x5aab44={'raw':!![],'where':{}};var _0x5e1369={};var _0x5e4195={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe8cc('0x52')]({'where':{'id':_0x490230[_0xe8cc('0x51')]['id']}})['then'](handleEntityNotFound(_0x4bb1ed,null))[_0xe8cc('0x1f')](function(_0x4e2f61){if(_0x4e2f61){_0x5e1369[_0xe8cc('0x2e')]=_[_0xe8cc('0x31')](db[_0xe8cc('0x53')][_0xe8cc('0x2a')]);_0x5e1369['query']=_[_0xe8cc('0x31')](_0x490230[_0xe8cc('0x30')]);_0x5e1369[_0xe8cc('0x39')]=_[_0xe8cc('0x33')](_0x5e1369['model'],_0x5e1369[_0xe8cc('0x30')]);_0x5aab44[_0xe8cc('0x32')]=_[_0xe8cc('0x33')](_0x5e1369['model'],qs[_0xe8cc('0x34')](_0x490230[_0xe8cc('0x30')]['fields']));_0x5aab44['attributes']=_0x5aab44['attributes'][_0xe8cc('0x4b')]?_0x5aab44['attributes']:_0x5e1369['model'];if(!_0x490230[_0xe8cc('0x30')][_0xe8cc('0x35')]('nolimit')){_0x5aab44[_0xe8cc('0x19')]=qs['limit'](_0x490230['query'][_0xe8cc('0x19')]);_0x5aab44[_0xe8cc('0x17')]=qs[_0xe8cc('0x17')](_0x490230[_0xe8cc('0x30')][_0xe8cc('0x17')]);}_0x5aab44['order']=qs[_0xe8cc('0x37')](_0x490230['query']['sort']);_0x5aab44[_0xe8cc('0x38')]=qs[_0xe8cc('0x39')](_[_0xe8cc('0x3a')](_0x490230['query'],_0x5e1369[_0xe8cc('0x39')]));_0x5aab44[_0xe8cc('0x38')][_0xe8cc('0x54')]=_0x4e2f61['id'];if(_0x490230[_0xe8cc('0x30')][_0xe8cc('0x3b')]){_0x5aab44[_0xe8cc('0x38')]=_['merge'](_0x5aab44[_0xe8cc('0x38')],{'$or':_['map'](_0x5aab44[_0xe8cc('0x32')],function(_0x1e2cd2){var _0x2698db={};_0x2698db[_0x1e2cd2]={'$like':'%'+_0x490230[_0xe8cc('0x30')][_0xe8cc('0x3b')]+'%'};return _0x2698db;})});}_0x5aab44=_[_0xe8cc('0x3c')]({},_0x5aab44,_0x490230['options']);return db[_0xe8cc('0x53')]['count']({'where':_0x5aab44['where']})[_0xe8cc('0x1f')](function(_0x1eba18){_0x5e4195[_0xe8cc('0x55')]=_0x1eba18;if(_0x490230[_0xe8cc('0x30')][_0xe8cc('0x4c')]){_0x5aab44[_0xe8cc('0x3e')]=[{'all':!![]}];}return db[_0xe8cc('0x53')]['findAll'](_0x5aab44);})[_0xe8cc('0x1f')](function(_0x19a08b){_0x5e4195[_0xe8cc('0x3f')]=_0x19a08b;return _0x5e4195;});}})[_0xe8cc('0x1f')](respondWithFilteredResult(_0x4bb1ed,_0x5aab44))[_0xe8cc('0x40')](handleError(_0x4bb1ed,null));};exports[_0xe8cc('0x56')]=function(_0x2c1e2f,_0x55663a,_0x4ceef7){var _0x12c29c={'raw':!![],'where':{}};var _0x210516={};var _0x120f0d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe8cc('0x52')]({'where':{'id':_0x2c1e2f[_0xe8cc('0x51')]['id']}})[_0xe8cc('0x1f')](handleEntityNotFound(_0x55663a,null))[_0xe8cc('0x1f')](function(_0xe4d4bc){if(_0xe4d4bc){_0x210516[_0xe8cc('0x2e')]=_[_0xe8cc('0x31')](db[_0xe8cc('0x57')][_0xe8cc('0x2a')]);_0x210516[_0xe8cc('0x30')]=_[_0xe8cc('0x31')](_0x2c1e2f[_0xe8cc('0x30')]);_0x210516['filters']=_[_0xe8cc('0x33')](_0x210516['model'],_0x210516[_0xe8cc('0x30')]);_0x12c29c[_0xe8cc('0x32')]=_['intersection'](_0x210516['model'],qs[_0xe8cc('0x34')](_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x34')]));_0x12c29c[_0xe8cc('0x32')]=_0x12c29c[_0xe8cc('0x32')][_0xe8cc('0x4b')]?_0x12c29c[_0xe8cc('0x32')]:_0x210516['model'];if(!_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x35')]('nolimit')){_0x12c29c[_0xe8cc('0x19')]=qs[_0xe8cc('0x19')](_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x19')]);_0x12c29c['offset']=qs[_0xe8cc('0x17')](_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x17')]);}_0x12c29c[_0xe8cc('0x36')]=qs[_0xe8cc('0x37')](_0x2c1e2f['query'][_0xe8cc('0x37')]);_0x12c29c[_0xe8cc('0x38')]=qs[_0xe8cc('0x39')](_[_0xe8cc('0x3a')](_0x2c1e2f['query'],_0x210516[_0xe8cc('0x39')]));_0x12c29c[_0xe8cc('0x38')][_0xe8cc('0x54')]=_0xe4d4bc['id'];if(_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x3b')]){_0x12c29c[_0xe8cc('0x38')]=_[_0xe8cc('0x3c')](_0x12c29c[_0xe8cc('0x38')],{'$or':_[_0xe8cc('0x2f')](_0x12c29c[_0xe8cc('0x32')],function(_0x129ac4){var _0x2d9a6b={};_0x2d9a6b[_0x129ac4]={'$like':'%'+_0x2c1e2f[_0xe8cc('0x30')][_0xe8cc('0x3b')]+'%'};return _0x2d9a6b;})});}_0x12c29c=_[_0xe8cc('0x3c')]({},_0x12c29c,_0x2c1e2f['options']);return db[_0xe8cc('0x57')][_0xe8cc('0x55')]({'where':_0x12c29c[_0xe8cc('0x38')]})[_0xe8cc('0x1f')](function(_0x2c087d){_0x120f0d[_0xe8cc('0x55')]=_0x2c087d;if(_0x2c1e2f[_0xe8cc('0x30')]['includeAll']){_0x12c29c['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe8cc('0x58')](_0x12c29c);})[_0xe8cc('0x1f')](function(_0x2f1443){_0x120f0d[_0xe8cc('0x3f')]=_0x2f1443;return _0x120f0d;});}})['then'](respondWithFilteredResult(_0x55663a,_0x12c29c))[_0xe8cc('0x40')](handleError(_0x55663a,null));};function char(_0x45e46d){return _0xe8cc('0x59')===typeof _0x45e46d?String[_0xe8cc('0x5a')][_0xe8cc('0x5b')](null,arguments):_0x45e46d;}function needsEncapsulation(_0x56ff73){return!!_0x56ff73&&(_0x56ff73[_0xe8cc('0x5c')]()['indexOf'](char(0xd))>=0x0||_0x56ff73[_0xe8cc('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x56ff73[_0xe8cc('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x56ff73[_0xe8cc('0x5c')]()[_0xe8cc('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x55f8eb){var _0x2d0dc7=char(0x22),_0x1c9795='\x5c'+char(0x22),_0x349cb2=_0x55f8eb['toString']()[_0xe8cc('0x5e')](new RegExp(_0x2d0dc7,'g'),_0x1c9795);return _0x2d0dc7+_0x349cb2+_0x2d0dc7;}exports[_0xe8cc('0x5f')]=function(_0x373d97,_0x459a45,_0x2311a4){var _0x518636,_0x1fface;var _0x3184f3={'where':{'ProjectId':_0x373d97['params']['id']}};if(_0x373d97['query'][_0xe8cc('0x60')]){_0x3184f3[_0xe8cc('0x38')][_0xe8cc('0x61')]=JSON[_0xe8cc('0x62')](_0x373d97[_0xe8cc('0x30')][_0xe8cc('0x60')]);}return db['JscriptySessionReport'][_0xe8cc('0x58')](_0x3184f3)[_0xe8cc('0x1f')](handleEntityNotFound(_0x459a45,null))[_0xe8cc('0x1f')](function(_0x595ba0){if(_0x595ba0){_0x518636=_0x595ba0;return db[_0xe8cc('0x63')]['findAll']({'where':{'SessionId':{'$in':_[_0xe8cc('0x2f')](_0x518636,'id')},'ProjectId':_0x373d97['params']['id']},'order':_0xe8cc('0x64')});}})[_0xe8cc('0x1f')](handleEntityNotFound(_0x459a45,null))[_0xe8cc('0x1f')](function(_0x2081df){if(_0x2081df){_0x1fface=_0x2081df;var _0x57e438={};for(var _0x4f10f8=0x0,_0x4f7ba8=_0x1fface[_0xe8cc('0x4b')];_0x4f10f8<_0x4f7ba8;_0x4f10f8++){if(!_0x57e438[_0xe8cc('0x35')](_0x1fface[_0x4f10f8][_0xe8cc('0x65')])){_0x57e438[_0x1fface[_0x4f10f8][_0xe8cc('0x65')]]=needsEncapsulation(_0x1fface[_0x4f10f8][_0xe8cc('0x66')])?encapsulate(_0x1fface[_0x4f10f8][_0xe8cc('0x66')]):_0x1fface[_0x4f10f8][_0xe8cc('0x66')];}}var _0x1fc51d=[],_0x36020b={};for(var _0x28c72d=0x0,_0x2ae76e=_0x518636[_0xe8cc('0x4b')];_0x28c72d<_0x2ae76e;_0x28c72d++){_0x36020b={'ProjectId':_0x373d97['params']['id'],'SessionId':_0x518636[_0x28c72d]['id'],'StartTime':moment(_0x518636[_0x28c72d][_0xe8cc('0x61')])['format'](_0xe8cc('0x67'))};for(var _0x3f908a=0x0,_0x201e73=_0x1fface[_0xe8cc('0x4b')];_0x3f908a<_0x201e73;_0x3f908a++){if(_0x1fface[_0x3f908a]['SessionId']==_0x518636[_0x28c72d]['id']&&_0x57e438[_0xe8cc('0x35')](_0x1fface[_0x3f908a]['questionId'])){_0x36020b[_0x57e438[_0x1fface[_0x3f908a]['questionId']]]=_0x1fface[_0x3f908a][_0xe8cc('0x68')];}}for(var _0xc7210c in _0x57e438){if(!_0x36020b['hasOwnProperty'](_0x57e438[_0xc7210c])){_0x36020b[_0x57e438[_0xc7210c]]=null;}}_0x1fc51d['push'](_0x36020b);}return _0x1fc51d;}})[_0xe8cc('0x1f')](function(_0x3ca586){if(!_[_0xe8cc('0x69')](_0x3ca586)){var _0x518bae=toCsv(_0x3ca586);var _0x1e06e0=Date[_0xe8cc('0x6a')]();fs[_0xe8cc('0x6b')](util['format'](_0xe8cc('0x6c'),_0x373d97[_0xe8cc('0x51')]['id'],_0x1e06e0),_0x518bae);_0x459a45['setHeader'](_0xe8cc('0x6d'),_0xe8cc('0x6e')+util[_0xe8cc('0x6f')]('Jscripty_Project_%d_Summary_%s.csv',_0x373d97[_0xe8cc('0x51')]['id'],_0x1e06e0));_0x459a45[_0xe8cc('0x70')](_0xe8cc('0x71'),_0xe8cc('0x72'));return _0x459a45['download'](util[_0xe8cc('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x373d97['params']['id'],_0x1e06e0));}else{return _0x459a45[_0xe8cc('0x24')](0xcc);}})[_0xe8cc('0x40')](handleError(_0x459a45,null));}; \ No newline at end of file +var _0x6b47=['Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','keys','intersection','model','fields','query','length','attributes','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','autoAssociation','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','setHeader'];(function(_0x309991,_0x457e73){var _0x4ca94d=function(_0x294acc){while(--_0x294acc){_0x309991['push'](_0x309991['shift']());}};_0x4ca94d(++_0x457e73);}(_0x6b47,0xe9));var _0x76b4=function(_0x142a07,_0x251e3c){_0x142a07=_0x142a07-0x0;var _0x101b6d=_0x6b47[_0x142a07];return _0x101b6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76b4('0x1'));var rp=require(_0x76b4('0x2'));var moment=require(_0x76b4('0x3'));var BPromise=require(_0x76b4('0x4'));var Mustache=require('mustache');var util=require(_0x76b4('0x5'));var path=require(_0x76b4('0x6'));var sox=require(_0x76b4('0x7'));var csv=require(_0x76b4('0x8'));var ejs=require(_0x76b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76b4('0xa'));var squel=require(_0x76b4('0xb'));var crypto=require(_0x76b4('0xc'));var jsforce=require(_0x76b4('0xd'));var deskjs=require(_0x76b4('0xe'));var toCsv=require(_0x76b4('0x8'));var querystring=require(_0x76b4('0xf'));var Papa=require(_0x76b4('0x10'));var Redis=require(_0x76b4('0x11'));var authService=require(_0x76b4('0x12'));var qs=require(_0x76b4('0x13'));var as=require(_0x76b4('0x14'));var hardwareService=require(_0x76b4('0x15'));var logger=require('../../config/logger')(_0x76b4('0x16'));var utils=require(_0x76b4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x76b4('0x18'));var db=require(_0x76b4('0x19'))['db'];function respondWithStatusCode(_0xf62e19,_0x5c7cb6){_0x5c7cb6=_0x5c7cb6||0xcc;return function(_0x4dddac){if(_0x4dddac){return _0xf62e19[_0x76b4('0x1a')](_0x5c7cb6);}return _0xf62e19[_0x76b4('0x1b')](_0x5c7cb6)[_0x76b4('0x1c')]();};}function respondWithResult(_0x94f8e7,_0x389092){_0x389092=_0x389092||0xc8;return function(_0xada02b){if(_0xada02b){return _0x94f8e7[_0x76b4('0x1b')](_0x389092)[_0x76b4('0x1d')](_0xada02b);}};}function respondWithFilteredResult(_0x3f10d6,_0x3a0508){return function(_0x507542){if(_0x507542){var _0x5ebc74=typeof _0x3a0508[_0x76b4('0x1e')]===_0x76b4('0x1f')&&typeof _0x3a0508['limit']==='undefined';var _0x12efb4=_0x507542[_0x76b4('0x20')];var _0x2bf42a=_0x5ebc74?0x0:_0x3a0508[_0x76b4('0x1e')];var _0x19feeb=_0x5ebc74?_0x507542['count']:_0x3a0508[_0x76b4('0x1e')]+_0x3a0508[_0x76b4('0x21')];var _0xe074f9;if(_0x19feeb>=_0x12efb4){_0x19feeb=_0x12efb4;_0xe074f9=0xc8;}else{_0xe074f9=0xce;}_0x3f10d6[_0x76b4('0x1b')](_0xe074f9);return _0x3f10d6[_0x76b4('0x22')]('Content-Range',_0x2bf42a+'-'+_0x19feeb+'/'+_0x12efb4)[_0x76b4('0x1d')](_0x507542);}return null;};}function patchUpdates(_0x4ee840){return function(_0x5c9a79){try{jsonpatch[_0x76b4('0x23')](_0x5c9a79,_0x4ee840,!![]);}catch(_0x1e8e95){return BPromise[_0x76b4('0x24')](_0x1e8e95);}return _0x5c9a79['save']();};}function saveUpdates(_0x35956a,_0x56bfcd){return function(_0x43ccf7){if(_0x43ccf7){return _0x43ccf7[_0x76b4('0x25')](_0x35956a)[_0x76b4('0x26')](function(_0xc7b013){return _0xc7b013;});}return null;};}function removeEntity(_0x41b614,_0x40e25a){return function(_0x1d263b){if(_0x1d263b){return _0x1d263b[_0x76b4('0x27')]()['then'](function(){var _0x1ffb52=_0x1d263b['get']({'plain':!![]});var _0x458b60='Projects';return db[_0x76b4('0x28')]['destroy']({'where':{'type':_0x458b60,'resourceId':_0x1ffb52['id']}})[_0x76b4('0x26')](function(){return _0x1d263b;});})[_0x76b4('0x26')](function(){_0x41b614['status'](0xcc)[_0x76b4('0x1c')]();});}};}function handleEntityNotFound(_0x173edb,_0x6887ae){return function(_0x56b805){if(!_0x56b805){_0x173edb[_0x76b4('0x1a')](0x194);}return _0x56b805;};}function handleError(_0x7d687,_0x3e8b9a){_0x3e8b9a=_0x3e8b9a||0x1f4;return function(_0x5f0443){logger[_0x76b4('0x29')](_0x5f0443['stack']);if(_0x5f0443[_0x76b4('0x2a')]){delete _0x5f0443[_0x76b4('0x2a')];}_0x7d687[_0x76b4('0x1b')](_0x3e8b9a)[_0x76b4('0x2b')](_0x5f0443);};}exports[_0x76b4('0x2c')]=function(_0x3f8d87,_0x316a2a){var _0x1330b5={},_0xc7e753={},_0x455b4a={'count':0x0,'rows':[]};var _0x4e6b42=_[_0x76b4('0x2d')](db[_0x76b4('0x2e')][_0x76b4('0x2f')],function(_0x5ba568){return{'name':_0x5ba568[_0x76b4('0x30')],'type':_0x5ba568['type'][_0x76b4('0x31')]};});_0xc7e753['model']=_[_0x76b4('0x2d')](_0x4e6b42,_0x76b4('0x2a'));_0xc7e753['query']=_[_0x76b4('0x32')](_0x3f8d87['query']);_0xc7e753['filters']=_[_0x76b4('0x33')](_0xc7e753[_0x76b4('0x34')],_0xc7e753['query']);_0x1330b5['attributes']=_[_0x76b4('0x33')](_0xc7e753[_0x76b4('0x34')],qs[_0x76b4('0x35')](_0x3f8d87[_0x76b4('0x36')][_0x76b4('0x35')]));_0x1330b5['attributes']=_0x1330b5['attributes'][_0x76b4('0x37')]?_0x1330b5[_0x76b4('0x38')]:_0xc7e753['model'];if(!_0x3f8d87[_0x76b4('0x36')]['hasOwnProperty'](_0x76b4('0x39'))){_0x1330b5[_0x76b4('0x21')]=qs[_0x76b4('0x21')](_0x3f8d87[_0x76b4('0x36')]['limit']);_0x1330b5[_0x76b4('0x1e')]=qs[_0x76b4('0x1e')](_0x3f8d87[_0x76b4('0x36')][_0x76b4('0x1e')]);}_0x1330b5[_0x76b4('0x3a')]=qs[_0x76b4('0x3b')](_0x3f8d87[_0x76b4('0x36')][_0x76b4('0x3b')]);_0x1330b5['where']=qs[_0x76b4('0x3c')](_[_0x76b4('0x3d')](_0x3f8d87[_0x76b4('0x36')],_0xc7e753['filters']),_0x4e6b42);if(_0x3f8d87['query'][_0x76b4('0x3e')]){_0x1330b5[_0x76b4('0x3f')]=_[_0x76b4('0x40')](_0x1330b5['where'],{'$or':_['map'](_0x4e6b42,function(_0x5e368c){if(_0x5e368c['type']!==_0x76b4('0x41')){var _0xe6bdda={};_0xe6bdda[_0x5e368c[_0x76b4('0x2a')]]={'$like':'%'+_0x3f8d87[_0x76b4('0x36')][_0x76b4('0x3e')]+'%'};return _0xe6bdda;}})});}_0x1330b5=_['merge']({},_0x1330b5,_0x3f8d87[_0x76b4('0x42')]);var _0x3d65c7={'where':_0x1330b5[_0x76b4('0x3f')]};return db[_0x76b4('0x2e')][_0x76b4('0x20')](_0x3d65c7)['then'](function(_0x536fd6){_0x455b4a['count']=_0x536fd6;if(_0x3f8d87['query'][_0x76b4('0x43')]){_0x1330b5[_0x76b4('0x44')]=[{'all':!![]}];}return db[_0x76b4('0x2e')][_0x76b4('0x45')](_0x1330b5);})[_0x76b4('0x26')](function(_0x31f3ce){_0x455b4a[_0x76b4('0x46')]=_0x31f3ce;return _0x455b4a;})[_0x76b4('0x26')](respondWithFilteredResult(_0x316a2a,_0x1330b5))[_0x76b4('0x47')](handleError(_0x316a2a,null));};exports[_0x76b4('0x48')]=function(_0xbea460,_0x145c1f){var _0x4ba841={'raw':![],'where':{'id':_0xbea460[_0x76b4('0x49')]['id']}},_0x1cbf07={};_0x1cbf07[_0x76b4('0x34')]=_['keys'](db[_0x76b4('0x2e')][_0x76b4('0x2f')]);_0x1cbf07[_0x76b4('0x36')]=_[_0x76b4('0x32')](_0xbea460['query']);_0x1cbf07[_0x76b4('0x3c')]=_[_0x76b4('0x33')](_0x1cbf07['model'],_0x1cbf07[_0x76b4('0x36')]);_0x4ba841[_0x76b4('0x38')]=_[_0x76b4('0x33')](_0x1cbf07['model'],qs['fields'](_0xbea460['query'][_0x76b4('0x35')]));_0x4ba841['attributes']=_0x4ba841[_0x76b4('0x38')][_0x76b4('0x37')]?_0x4ba841[_0x76b4('0x38')]:_0x1cbf07[_0x76b4('0x34')];if(_0xbea460[_0x76b4('0x36')][_0x76b4('0x43')]){_0x4ba841['include']=[{'all':!![]}];}_0x4ba841=_[_0x76b4('0x40')]({},_0x4ba841,_0xbea460[_0x76b4('0x42')]);return db[_0x76b4('0x2e')][_0x76b4('0x4a')](_0x4ba841)[_0x76b4('0x26')](handleEntityNotFound(_0x145c1f,null))[_0x76b4('0x26')](respondWithResult(_0x145c1f,null))[_0x76b4('0x47')](handleError(_0x145c1f,null));};exports[_0x76b4('0x4b')]=function(_0x7e3be1,_0x2bc1e8){return db[_0x76b4('0x2e')]['create'](_0x7e3be1[_0x76b4('0x4c')],{})['then'](function(_0x60cbb){var _0x27c0e8=_0x7e3be1[_0x76b4('0x4d')][_0x76b4('0x4e')]({'plain':!![]});if(!_0x27c0e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27c0e8[_0x76b4('0x4f')]==='user'){var _0x27150d=_0x60cbb[_0x76b4('0x4e')]({'plain':!![]});var _0x3a6931='Projects';return db[_0x76b4('0x50')][_0x76b4('0x4a')]({'where':{'name':_0x3a6931,'userProfileId':_0x27c0e8[_0x76b4('0x51')]},'raw':!![]})[_0x76b4('0x26')](function(_0x34ce1b){if(_0x34ce1b&&_0x34ce1b['autoAssociation']===0x0){return db[_0x76b4('0x28')]['create']({'name':_0x27150d[_0x76b4('0x2a')],'resourceId':_0x27150d['id'],'type':_0x34ce1b[_0x76b4('0x2a')],'sectionId':_0x34ce1b['id']},{})[_0x76b4('0x26')](function(){return _0x60cbb;});}else{return _0x60cbb;}})[_0x76b4('0x47')](function(_0xfc2e7f){logger[_0x76b4('0x29')](_0x76b4('0x52'),_0xfc2e7f);throw _0xfc2e7f;});}return _0x60cbb;})[_0x76b4('0x26')](respondWithResult(_0x2bc1e8,0xc9))[_0x76b4('0x47')](handleError(_0x2bc1e8,null));};exports['clone']=function(_0x201fc4,_0x3ab37a){var _0x3899f6={'where':{'id':_0x201fc4[_0x76b4('0x49')]['id']}},_0x5b38de={};_0x5b38de['model']=_[_0x76b4('0x32')](db[_0x76b4('0x2e')][_0x76b4('0x2f')]);_0x3899f6[_0x76b4('0x38')]=_[_0x76b4('0x33')](_0x5b38de[_0x76b4('0x34')],qs['fields'](_0x201fc4[_0x76b4('0x36')][_0x76b4('0x35')]));_0x3899f6[_0x76b4('0x38')]=_0x3899f6['attributes'][_0x76b4('0x37')]?_0x3899f6[_0x76b4('0x38')]:_0x5b38de[_0x76b4('0x34')];if(_0x201fc4[_0x76b4('0x36')][_0x76b4('0x43')]){_0x3899f6[_0x76b4('0x44')]=[{'all':!![]}];}_0x3899f6=_['merge']({},_0x3899f6,_0x201fc4[_0x76b4('0x42')]);return db[_0x76b4('0x2e')]['find'](_0x3899f6)[_0x76b4('0x26')](handleEntityNotFound(_0x3ab37a,null))[_0x76b4('0x26')](function(_0x32bbec){if(_0x32bbec){var _0x3e1663=_0x32bbec[_0x76b4('0x4e')]({'plain':!![]});_0x3e1663=qs['omit'](_0x3e1663,['id',_0x76b4('0x53'),_0x76b4('0x54')]);_0x201fc4['body']=_['omit'](_0x201fc4[_0x76b4('0x4c')],['id','createdAt',_0x76b4('0x54')]);return db[_0x76b4('0x2e')]['create'](_[_0x76b4('0x40')](_0x3e1663,_0x201fc4[_0x76b4('0x4c')]),{'include':_0x201fc4[_0x76b4('0x36')][_0x76b4('0x43')]?[{'all':!![]}]:undefined})[_0x76b4('0x26')](function(_0x2a4429){var _0x3d695f=_0x201fc4[_0x76b4('0x4d')]['get']({'plain':!![]});if(!_0x3d695f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d695f[_0x76b4('0x4f')]==='user'){var _0x58f75a=_0x2a4429[_0x76b4('0x4e')]({'plain':!![]});var _0x53a80c='Projects';return db[_0x76b4('0x50')][_0x76b4('0x4a')]({'where':{'name':_0x53a80c,'userProfileId':_0x3d695f[_0x76b4('0x51')]},'raw':!![]})[_0x76b4('0x26')](function(_0x5a8508){if(_0x5a8508&&_0x5a8508[_0x76b4('0x55')]===0x0){return db[_0x76b4('0x28')][_0x76b4('0x4b')]({'name':_0x58f75a['name'],'resourceId':_0x58f75a['id'],'type':_0x5a8508[_0x76b4('0x2a')],'sectionId':_0x5a8508['id']},{})[_0x76b4('0x26')](function(){return _0x2a4429;});}else{return _0x2a4429;}})['catch'](function(_0x318d08){logger[_0x76b4('0x29')](_0x76b4('0x52'),_0x318d08);throw _0x318d08;});}return _0x2a4429;});}})[_0x76b4('0x26')](respondWithResult(_0x3ab37a,0xc9))[_0x76b4('0x47')](handleError(_0x3ab37a,null));};exports['update']=function(_0x3e4a85,_0x295368){if(_0x3e4a85[_0x76b4('0x4c')]['id']){delete _0x3e4a85[_0x76b4('0x4c')]['id'];}return db[_0x76b4('0x2e')][_0x76b4('0x4a')]({'where':{'id':_0x3e4a85[_0x76b4('0x49')]['id']}})[_0x76b4('0x26')](handleEntityNotFound(_0x295368,null))[_0x76b4('0x26')](saveUpdates(_0x3e4a85['body'],null))[_0x76b4('0x26')](respondWithResult(_0x295368,null))[_0x76b4('0x47')](handleError(_0x295368,null));};exports['destroy']=function(_0x4f3bea,_0x57520c){return db[_0x76b4('0x2e')]['find']({'where':{'id':_0x4f3bea[_0x76b4('0x49')]['id']}})[_0x76b4('0x26')](handleEntityNotFound(_0x57520c,null))[_0x76b4('0x26')](removeEntity(_0x57520c,null))[_0x76b4('0x47')](handleError(_0x57520c,null));};exports[_0x76b4('0x56')]=function(_0x9848eb,_0x55ba3b,_0x31105e){var _0x5d4b70={'raw':!![],'where':{}};var _0x22baeb={};var _0x3d66ae={'count':0x0,'rows':[]};return db[_0x76b4('0x2e')][_0x76b4('0x57')]({'where':{'id':_0x9848eb[_0x76b4('0x49')]['id']}})[_0x76b4('0x26')](handleEntityNotFound(_0x55ba3b,null))[_0x76b4('0x26')](function(_0x2d3601){if(_0x2d3601){_0x22baeb[_0x76b4('0x34')]=_[_0x76b4('0x32')](db[_0x76b4('0x58')][_0x76b4('0x2f')]);_0x22baeb[_0x76b4('0x36')]=_[_0x76b4('0x32')](_0x9848eb[_0x76b4('0x36')]);_0x22baeb[_0x76b4('0x3c')]=_[_0x76b4('0x33')](_0x22baeb[_0x76b4('0x34')],_0x22baeb[_0x76b4('0x36')]);_0x5d4b70['attributes']=_[_0x76b4('0x33')](_0x22baeb[_0x76b4('0x34')],qs[_0x76b4('0x35')](_0x9848eb[_0x76b4('0x36')]['fields']));_0x5d4b70[_0x76b4('0x38')]=_0x5d4b70[_0x76b4('0x38')][_0x76b4('0x37')]?_0x5d4b70[_0x76b4('0x38')]:_0x22baeb[_0x76b4('0x34')];if(!_0x9848eb[_0x76b4('0x36')][_0x76b4('0x59')]('nolimit')){_0x5d4b70[_0x76b4('0x21')]=qs[_0x76b4('0x21')](_0x9848eb['query']['limit']);_0x5d4b70[_0x76b4('0x1e')]=qs[_0x76b4('0x1e')](_0x9848eb[_0x76b4('0x36')][_0x76b4('0x1e')]);}_0x5d4b70[_0x76b4('0x3a')]=qs[_0x76b4('0x3b')](_0x9848eb[_0x76b4('0x36')][_0x76b4('0x3b')]);_0x5d4b70[_0x76b4('0x3f')]=qs[_0x76b4('0x3c')](_['pick'](_0x9848eb[_0x76b4('0x36')],_0x22baeb[_0x76b4('0x3c')]));_0x5d4b70[_0x76b4('0x3f')][_0x76b4('0x5a')]=_0x2d3601['id'];if(_0x9848eb[_0x76b4('0x36')][_0x76b4('0x3e')]){_0x5d4b70[_0x76b4('0x3f')]=_['merge'](_0x5d4b70[_0x76b4('0x3f')],{'$or':_[_0x76b4('0x2d')](_0x5d4b70[_0x76b4('0x38')],function(_0x4a8559){var _0x450d9c={};_0x450d9c[_0x4a8559]={'$like':'%'+_0x9848eb[_0x76b4('0x36')][_0x76b4('0x3e')]+'%'};return _0x450d9c;})});}_0x5d4b70=_[_0x76b4('0x40')]({},_0x5d4b70,_0x9848eb[_0x76b4('0x42')]);return db[_0x76b4('0x58')][_0x76b4('0x20')]({'where':_0x5d4b70[_0x76b4('0x3f')]})[_0x76b4('0x26')](function(_0x51b218){_0x3d66ae[_0x76b4('0x20')]=_0x51b218;if(_0x9848eb[_0x76b4('0x36')]['includeAll']){_0x5d4b70['include']=[{'all':!![]}];}return db[_0x76b4('0x58')][_0x76b4('0x45')](_0x5d4b70);})['then'](function(_0x39f441){_0x3d66ae[_0x76b4('0x46')]=_0x39f441;return _0x3d66ae;});}})[_0x76b4('0x26')](respondWithFilteredResult(_0x55ba3b,_0x5d4b70))[_0x76b4('0x47')](handleError(_0x55ba3b,null));};exports[_0x76b4('0x5b')]=function(_0x1400ef,_0x346f2b,_0x1d03dd){var _0x2fad4d={'raw':!![],'where':{}};var _0x5145c1={};var _0x4f5e41={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x76b4('0x57')]({'where':{'id':_0x1400ef['params']['id']}})[_0x76b4('0x26')](handleEntityNotFound(_0x346f2b,null))[_0x76b4('0x26')](function(_0x2a7d27){if(_0x2a7d27){_0x5145c1['model']=_[_0x76b4('0x32')](db[_0x76b4('0x5c')][_0x76b4('0x2f')]);_0x5145c1[_0x76b4('0x36')]=_[_0x76b4('0x32')](_0x1400ef[_0x76b4('0x36')]);_0x5145c1[_0x76b4('0x3c')]=_[_0x76b4('0x33')](_0x5145c1['model'],_0x5145c1[_0x76b4('0x36')]);_0x2fad4d['attributes']=_[_0x76b4('0x33')](_0x5145c1['model'],qs[_0x76b4('0x35')](_0x1400ef[_0x76b4('0x36')][_0x76b4('0x35')]));_0x2fad4d['attributes']=_0x2fad4d[_0x76b4('0x38')][_0x76b4('0x37')]?_0x2fad4d['attributes']:_0x5145c1[_0x76b4('0x34')];if(!_0x1400ef[_0x76b4('0x36')][_0x76b4('0x59')](_0x76b4('0x39'))){_0x2fad4d['limit']=qs[_0x76b4('0x21')](_0x1400ef[_0x76b4('0x36')][_0x76b4('0x21')]);_0x2fad4d[_0x76b4('0x1e')]=qs[_0x76b4('0x1e')](_0x1400ef[_0x76b4('0x36')][_0x76b4('0x1e')]);}_0x2fad4d[_0x76b4('0x3a')]=qs['sort'](_0x1400ef[_0x76b4('0x36')]['sort']);_0x2fad4d['where']=qs['filters'](_['pick'](_0x1400ef[_0x76b4('0x36')],_0x5145c1['filters']));_0x2fad4d[_0x76b4('0x3f')][_0x76b4('0x5a')]=_0x2a7d27['id'];if(_0x1400ef[_0x76b4('0x36')][_0x76b4('0x3e')]){_0x2fad4d[_0x76b4('0x3f')]=_[_0x76b4('0x40')](_0x2fad4d[_0x76b4('0x3f')],{'$or':_[_0x76b4('0x2d')](_0x2fad4d[_0x76b4('0x38')],function(_0x3cf0dc){var _0x5a3b6f={};_0x5a3b6f[_0x3cf0dc]={'$like':'%'+_0x1400ef[_0x76b4('0x36')][_0x76b4('0x3e')]+'%'};return _0x5a3b6f;})});}_0x2fad4d=_[_0x76b4('0x40')]({},_0x2fad4d,_0x1400ef[_0x76b4('0x42')]);return db[_0x76b4('0x5c')][_0x76b4('0x20')]({'where':_0x2fad4d[_0x76b4('0x3f')]})['then'](function(_0x40c85e){_0x4f5e41[_0x76b4('0x20')]=_0x40c85e;if(_0x1400ef[_0x76b4('0x36')][_0x76b4('0x43')]){_0x2fad4d['include']=[{'all':!![]}];}return db[_0x76b4('0x5c')][_0x76b4('0x45')](_0x2fad4d);})[_0x76b4('0x26')](function(_0x31832c){_0x4f5e41[_0x76b4('0x46')]=_0x31832c;return _0x4f5e41;});}})['then'](respondWithFilteredResult(_0x346f2b,_0x2fad4d))['catch'](handleError(_0x346f2b,null));};function char(_0x197a57){return'number'===typeof _0x197a57?String[_0x76b4('0x5d')]['apply'](null,arguments):_0x197a57;}function needsEncapsulation(_0x1f81c6){return!!_0x1f81c6&&(_0x1f81c6[_0x76b4('0x5e')]()[_0x76b4('0x5f')](char(0xd))>=0x0||_0x1f81c6['toString']()[_0x76b4('0x5f')](char(0xa))>=0x0||_0x1f81c6['toString']()[_0x76b4('0x5f')](char(0x2c))>=0x0||_0x1f81c6[_0x76b4('0x5e')]()[_0x76b4('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x1da363){var _0x4c5c8e=char(0x22),_0x111082='\x5c'+char(0x22),_0xe1ce07=_0x1da363[_0x76b4('0x5e')]()[_0x76b4('0x60')](new RegExp(_0x4c5c8e,'g'),_0x111082);return _0x4c5c8e+_0xe1ce07+_0x4c5c8e;}exports['getSummary']=function(_0x4eb451,_0x3598c5,_0x1c3b5c){var _0x401104,_0x5e17cf;var _0x4bd08e={'where':{'ProjectId':_0x4eb451[_0x76b4('0x49')]['id']}};if(_0x4eb451[_0x76b4('0x36')][_0x76b4('0x61')]){_0x4bd08e['where'][_0x76b4('0x62')]=JSON[_0x76b4('0x63')](_0x4eb451[_0x76b4('0x36')][_0x76b4('0x61')]);}return db[_0x76b4('0x58')]['findAll'](_0x4bd08e)[_0x76b4('0x26')](handleEntityNotFound(_0x3598c5,null))['then'](function(_0x345c12){if(_0x345c12){_0x401104=_0x345c12;return db[_0x76b4('0x64')][_0x76b4('0x45')]({'where':{'SessionId':{'$in':_[_0x76b4('0x2d')](_0x401104,'id')},'ProjectId':_0x4eb451[_0x76b4('0x49')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x3598c5,null))[_0x76b4('0x26')](function(_0x41fd33){if(_0x41fd33){_0x5e17cf=_0x41fd33;var _0x1bb269={};for(var _0x2f13fe=0x0,_0x45dff3=_0x5e17cf['length'];_0x2f13fe<_0x45dff3;_0x2f13fe++){if(!_0x1bb269[_0x76b4('0x59')](_0x5e17cf[_0x2f13fe]['questionId'])){_0x1bb269[_0x5e17cf[_0x2f13fe][_0x76b4('0x65')]]=needsEncapsulation(_0x5e17cf[_0x2f13fe][_0x76b4('0x66')])?encapsulate(_0x5e17cf[_0x2f13fe][_0x76b4('0x66')]):_0x5e17cf[_0x2f13fe][_0x76b4('0x66')];}}var _0x1b5f30=[],_0xd716fb={};for(var _0x1b4c81=0x0,_0x3d80aa=_0x401104['length'];_0x1b4c81<_0x3d80aa;_0x1b4c81++){_0xd716fb={'ProjectId':_0x4eb451[_0x76b4('0x49')]['id'],'SessionId':_0x401104[_0x1b4c81]['id'],'StartTime':moment(_0x401104[_0x1b4c81][_0x76b4('0x62')])[_0x76b4('0x67')](_0x76b4('0x68'))};for(var _0x5e8bcc=0x0,_0x12074b=_0x5e17cf[_0x76b4('0x37')];_0x5e8bcc<_0x12074b;_0x5e8bcc++){if(_0x5e17cf[_0x5e8bcc]['SessionId']==_0x401104[_0x1b4c81]['id']&&_0x1bb269[_0x76b4('0x59')](_0x5e17cf[_0x5e8bcc]['questionId'])){_0xd716fb[_0x1bb269[_0x5e17cf[_0x5e8bcc][_0x76b4('0x65')]]]=_0x5e17cf[_0x5e8bcc]['answer'];}}for(var _0xcfa709 in _0x1bb269){if(!_0xd716fb[_0x76b4('0x59')](_0x1bb269[_0xcfa709])){_0xd716fb[_0x1bb269[_0xcfa709]]=null;}}_0x1b5f30[_0x76b4('0x69')](_0xd716fb);}return _0x1b5f30;}})[_0x76b4('0x26')](function(_0x49e122){if(!_[_0x76b4('0x6a')](_0x49e122)){var _0x27ad0a=toCsv(_0x49e122);var _0x538f66=Date[_0x76b4('0x6b')]();fs['writeFileSync'](util[_0x76b4('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4eb451[_0x76b4('0x49')]['id'],_0x538f66),_0x27ad0a);_0x3598c5[_0x76b4('0x6c')](_0x76b4('0x6d'),'attachment;\x20filename='+util['format'](_0x76b4('0x6e'),_0x4eb451['params']['id'],_0x538f66));_0x3598c5['setHeader'](_0x76b4('0x6f'),_0x76b4('0x70'));return _0x3598c5[_0x76b4('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4eb451['params']['id'],_0x538f66));}else{return _0x3598c5[_0x76b4('0x1a')](0xcc);}})[_0x76b4('0x47')](handleError(_0x3598c5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 6886cf0..2ffb083 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 _0x6753=['bluebird','request-promise','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x10c1b8,_0x5ef9d5){var _0x1f3cab=function(_0x3a00af){while(--_0x3a00af){_0x10c1b8['push'](_0x10c1b8['shift']());}};_0x1f3cab(++_0x5ef9d5);}(_0x6753,0xa1));var _0x3675=function(_0xce1bfa,_0x79a34b){_0xce1bfa=_0xce1bfa-0x0;var _0x1f6e65=_0x6753[_0xce1bfa];return _0x1f6e65;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48e3=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x30f51f,_0x1e11bc){var _0x4207b7=function(_0x9ce102){while(--_0x9ce102){_0x30f51f['push'](_0x30f51f['shift']());}};_0x4207b7(++_0x1e11bc);}(_0x48e3,0xe9));var _0x348e=function(_0x6029fb,_0x415268){_0x6029fb=_0x6029fb-0x0;var _0x5d8e33=_0x48e3[_0x6029fb];return _0x5d8e33;};'use strict';var _=require(_0x348e('0x0'));var util=require(_0x348e('0x1'));var logger=require('../../config/logger')(_0x348e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x348e('0x3'));var fs=require('fs');var path=require(_0x348e('0x4'));var rimraf=require(_0x348e('0x5'));var config=require(_0x348e('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x348e('0x7')]=function(_0x5201ec,_0x5902cd){return _0x5201ec[_0x348e('0x8')]('JscriptyProject',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 885b45a..8a9c807 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x426363,_0x582dba){_0x426363=_0x426363-0x0;var _0x438642=_0xac4a[_0x426363];return _0x438642;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x13f5e7,_0x560ce5){var _0x54504a=function(_0x4f5acf){while(--_0x4f5acf){_0x13f5e7['push'](_0x13f5e7['shift']());}};_0x54504a(++_0x560ce5);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 76ae2d2..c62f515 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 _0x5353=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','util','connect-timeout'];(function(_0x552c84,_0xe7f3b2){var _0xc59706=function(_0x453336){while(--_0x453336){_0x552c84['push'](_0x552c84['shift']());}};_0xc59706(++_0xe7f3b2);}(_0x5353,0x97));var _0x3535=function(_0x2bed65,_0x48142c){_0x2bed65=_0x2bed65-0x0;var _0x5a9306=_0x5353[_0x2bed65];return _0x5a9306;};'use strict';var multer=require('multer');var util=require(_0x3535('0x0'));var path=require('path');var timeout=require(_0x3535('0x1'));var express=require(_0x3535('0x2'));var router=express['Router']();var fs_extra=require(_0x3535('0x3'));var auth=require(_0x3535('0x4'));var interaction=require(_0x3535('0x5'));var config=require(_0x3535('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x3535('0x7')]('/',auth[_0x3535('0x8')](),controller[_0x3535('0x9')]);router['get'](_0x3535('0xa'),auth[_0x3535('0x8')](),controller['describe']);router[_0x3535('0x7')](_0x3535('0xb'),auth[_0x3535('0x8')](),controller['show']);router[_0x3535('0xc')]('/',auth[_0x3535('0x8')](),controller[_0x3535('0xd')]);router['put'](_0x3535('0xb'),auth[_0x3535('0x8')](),controller[_0x3535('0xe')]);router[_0x3535('0xf')]('/:id',auth[_0x3535('0x8')](),controller['destroy']);module[_0x3535('0x10')]=router; \ No newline at end of file +var _0x63ec=['/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get'];(function(_0x43ef5d,_0x3f0b32){var _0x34a1c7=function(_0x5a5c7a){while(--_0x5a5c7a){_0x43ef5d['push'](_0x43ef5d['shift']());}};_0x34a1c7(++_0x3f0b32);}(_0x63ec,0xa9));var _0xc63e=function(_0x2e4ad8,_0x22e669){_0x2e4ad8=_0x2e4ad8-0x0;var _0x1a1c57=_0x63ec[_0x2e4ad8];return _0x1a1c57;};'use strict';var multer=require(_0xc63e('0x0'));var util=require(_0xc63e('0x1'));var path=require(_0xc63e('0x2'));var timeout=require(_0xc63e('0x3'));var express=require('express');var router=express[_0xc63e('0x4')]();var fs_extra=require(_0xc63e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc63e('0x6'));var config=require('../../config/environment');var controller=require(_0xc63e('0x7'));router['get']('/',auth[_0xc63e('0x8')](),controller[_0xc63e('0x9')]);router[_0xc63e('0xa')](_0xc63e('0xb'),auth[_0xc63e('0x8')](),controller[_0xc63e('0xc')]);router[_0xc63e('0xa')](_0xc63e('0xd'),auth[_0xc63e('0x8')](),controller[_0xc63e('0xe')]);router['post']('/',auth[_0xc63e('0x8')](),controller[_0xc63e('0xf')]);router[_0xc63e('0x10')]('/:id',auth[_0xc63e('0x8')](),controller['update']);router[_0xc63e('0x11')](_0xc63e('0xd'),auth[_0xc63e('0x8')](),controller[_0xc63e('0x12')]);module[_0xc63e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b4af85c..ec972d3 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x33a961,_0x2b5522){_0x33a961=_0x33a961-0x0;var _0x3be1b9=_0x7a54[_0x33a961];return _0x3be1b9;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x534059,_0x2f3ea6){_0x534059=_0x534059-0x0;var _0x997673=_0x7a54[_0x534059];return _0x997673;};'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 ed5b84a..6137ca6 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 _0x9199=['destroy','error','stack','name','send','JscriptyQuestionReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9199,0x76));var _0x9919=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x9199[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0x9919('0x0'));var rimraf=require(_0x9919('0x1'));var zipdir=require(_0x9919('0x2'));var jsonpatch=require(_0x9919('0x3'));var rp=require(_0x9919('0x4'));var moment=require(_0x9919('0x5'));var BPromise=require(_0x9919('0x6'));var Mustache=require(_0x9919('0x7'));var util=require(_0x9919('0x8'));var path=require(_0x9919('0x9'));var sox=require(_0x9919('0xa'));var csv=require(_0x9919('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9919('0xc'));var _=require('lodash');var squel=require(_0x9919('0xd'));var crypto=require(_0x9919('0xe'));var jsforce=require(_0x9919('0xf'));var deskjs=require(_0x9919('0x10'));var toCsv=require(_0x9919('0xb'));var querystring=require(_0x9919('0x11'));var Papa=require(_0x9919('0x12'));var Redis=require(_0x9919('0x13'));var authService=require(_0x9919('0x14'));var qs=require(_0x9919('0x15'));var as=require(_0x9919('0x16'));var hardwareService=require(_0x9919('0x17'));var logger=require(_0x9919('0x18'))(_0x9919('0x19'));var utils=require(_0x9919('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9919('0x1b'));var db=require(_0x9919('0x1c'))['db'];function respondWithStatusCode(_0x325477,_0x530207){_0x530207=_0x530207||0xcc;return function(_0x1d0aef){if(_0x1d0aef){return _0x325477['sendStatus'](_0x530207);}return _0x325477[_0x9919('0x1d')](_0x530207)[_0x9919('0x1e')]();};}function respondWithResult(_0x4c9d4d,_0x17d131){_0x17d131=_0x17d131||0xc8;return function(_0x45732b){if(_0x45732b){return _0x4c9d4d[_0x9919('0x1d')](_0x17d131)[_0x9919('0x1f')](_0x45732b);}};}function respondWithFilteredResult(_0x2b24ff,_0x21d97c){return function(_0x4d6346){if(_0x4d6346){var _0x56966c=typeof _0x21d97c['offset']===_0x9919('0x20')&&typeof _0x21d97c[_0x9919('0x21')]===_0x9919('0x20');var _0x4bdb00=_0x4d6346[_0x9919('0x22')];var _0x5292a2=_0x56966c?0x0:_0x21d97c['offset'];var _0x17b116=_0x56966c?_0x4d6346[_0x9919('0x22')]:_0x21d97c[_0x9919('0x23')]+_0x21d97c[_0x9919('0x21')];var _0x351e6e;if(_0x17b116>=_0x4bdb00){_0x17b116=_0x4bdb00;_0x351e6e=0xc8;}else{_0x351e6e=0xce;}_0x2b24ff[_0x9919('0x1d')](_0x351e6e);return _0x2b24ff['set'](_0x9919('0x24'),_0x5292a2+'-'+_0x17b116+'/'+_0x4bdb00)[_0x9919('0x1f')](_0x4d6346);}return null;};}function patchUpdates(_0x3fc128){return function(_0x449550){try{jsonpatch['apply'](_0x449550,_0x3fc128,!![]);}catch(_0x39a770){return BPromise['reject'](_0x39a770);}return _0x449550[_0x9919('0x25')]();};}function saveUpdates(_0x5895ae,_0x5a1bfd){return function(_0x5c1bbb){if(_0x5c1bbb){return _0x5c1bbb[_0x9919('0x26')](_0x5895ae)[_0x9919('0x27')](function(_0x2a2aa5){return _0x2a2aa5;});}return null;};}function removeEntity(_0x1a7bbf,_0x3a1ff0){return function(_0x38275e){if(_0x38275e){return _0x38275e[_0x9919('0x28')]()[_0x9919('0x27')](function(){_0x1a7bbf['status'](0xcc)[_0x9919('0x1e')]();});}};}function handleEntityNotFound(_0x25cabc,_0x27ad41){return function(_0x2a43fb){if(!_0x2a43fb){_0x25cabc['sendStatus'](0x194);}return _0x2a43fb;};}function handleError(_0x130fc3,_0x259a2d){_0x259a2d=_0x259a2d||0x1f4;return function(_0xe44880){logger[_0x9919('0x29')](_0xe44880[_0x9919('0x2a')]);if(_0xe44880['name']){delete _0xe44880[_0x9919('0x2b')];}_0x130fc3['status'](_0x259a2d)[_0x9919('0x2c')](_0xe44880);};}exports['index']=function(_0x5e7d8f,_0x1f2286){var _0x19703f={},_0x278ed1={},_0xba478b={'count':0x0,'rows':[]};var _0x386708=_['map'](db[_0x9919('0x2d')][_0x9919('0x2e')],function(_0x4242c2){return{'name':_0x4242c2['fieldName'],'type':_0x4242c2[_0x9919('0x2f')][_0x9919('0x30')]};});_0x278ed1[_0x9919('0x31')]=_['map'](_0x386708,_0x9919('0x2b'));_0x278ed1['query']=_[_0x9919('0x32')](_0x5e7d8f[_0x9919('0x33')]);_0x278ed1['filters']=_[_0x9919('0x34')](_0x278ed1[_0x9919('0x31')],_0x278ed1[_0x9919('0x33')]);_0x19703f[_0x9919('0x35')]=_['intersection'](_0x278ed1[_0x9919('0x31')],qs[_0x9919('0x36')](_0x5e7d8f[_0x9919('0x33')][_0x9919('0x36')]));_0x19703f['attributes']=_0x19703f[_0x9919('0x35')][_0x9919('0x37')]?_0x19703f[_0x9919('0x35')]:_0x278ed1[_0x9919('0x31')];if(!_0x5e7d8f[_0x9919('0x33')][_0x9919('0x38')](_0x9919('0x39'))){_0x19703f['limit']=qs[_0x9919('0x21')](_0x5e7d8f[_0x9919('0x33')][_0x9919('0x21')]);_0x19703f[_0x9919('0x23')]=qs[_0x9919('0x23')](_0x5e7d8f[_0x9919('0x33')]['offset']);}_0x19703f[_0x9919('0x3a')]=qs[_0x9919('0x3b')](_0x5e7d8f[_0x9919('0x33')][_0x9919('0x3b')]);_0x19703f[_0x9919('0x3c')]=qs[_0x9919('0x3d')](_[_0x9919('0x3e')](_0x5e7d8f[_0x9919('0x33')],_0x278ed1['filters']),_0x386708);if(_0x5e7d8f[_0x9919('0x33')][_0x9919('0x3f')]){_0x19703f[_0x9919('0x3c')]=_['merge'](_0x19703f[_0x9919('0x3c')],{'$or':_[_0x9919('0x40')](_0x386708,function(_0x2679c8){if(_0x2679c8[_0x9919('0x2f')]!==_0x9919('0x41')){var _0xc3482a={};_0xc3482a[_0x2679c8[_0x9919('0x2b')]]={'$like':'%'+_0x5e7d8f['query'][_0x9919('0x3f')]+'%'};return _0xc3482a;}})});}_0x19703f=_['merge']({},_0x19703f,_0x5e7d8f[_0x9919('0x42')]);var _0x469a52={'where':_0x19703f[_0x9919('0x3c')]};return db['JscriptyQuestionReport'][_0x9919('0x22')](_0x469a52)[_0x9919('0x27')](function(_0x52680b){_0xba478b['count']=_0x52680b;if(_0x5e7d8f[_0x9919('0x33')][_0x9919('0x43')]){_0x19703f[_0x9919('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9919('0x45')](_0x19703f);})['then'](function(_0x1f0e07){_0xba478b[_0x9919('0x46')]=_0x1f0e07;return _0xba478b;})['then'](respondWithFilteredResult(_0x1f2286,_0x19703f))[_0x9919('0x47')](handleError(_0x1f2286,null));};exports[_0x9919('0x48')]=function(_0x491250,_0x202a6c){var _0x5990d8={'raw':!![],'where':{'id':_0x491250[_0x9919('0x49')]['id']}},_0x260fc4={};_0x260fc4[_0x9919('0x31')]=_['keys'](db[_0x9919('0x2d')][_0x9919('0x2e')]);_0x260fc4[_0x9919('0x33')]=_['keys'](_0x491250[_0x9919('0x33')]);_0x260fc4[_0x9919('0x3d')]=_['intersection'](_0x260fc4['model'],_0x260fc4['query']);_0x5990d8['attributes']=_[_0x9919('0x34')](_0x260fc4['model'],qs[_0x9919('0x36')](_0x491250[_0x9919('0x33')][_0x9919('0x36')]));_0x5990d8[_0x9919('0x35')]=_0x5990d8[_0x9919('0x35')][_0x9919('0x37')]?_0x5990d8[_0x9919('0x35')]:_0x260fc4[_0x9919('0x31')];if(_0x491250[_0x9919('0x33')][_0x9919('0x43')]){_0x5990d8[_0x9919('0x44')]=[{'all':!![]}];}_0x5990d8=_[_0x9919('0x4a')]({},_0x5990d8,_0x491250[_0x9919('0x42')]);return db[_0x9919('0x2d')][_0x9919('0x4b')](_0x5990d8)['then'](handleEntityNotFound(_0x202a6c,null))[_0x9919('0x27')](respondWithResult(_0x202a6c,null))[_0x9919('0x47')](handleError(_0x202a6c,null));};exports[_0x9919('0x4c')]=function(_0x232314,_0x3928f0){return db[_0x9919('0x2d')][_0x9919('0x4c')](_0x232314[_0x9919('0x4d')],{})['then'](respondWithResult(_0x3928f0,0xc9))['catch'](handleError(_0x3928f0,null));};exports['update']=function(_0x48e057,_0x4c807f){if(_0x48e057[_0x9919('0x4d')]['id']){delete _0x48e057['body']['id'];}return db['JscriptyQuestionReport'][_0x9919('0x4b')]({'where':{'id':_0x48e057[_0x9919('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c807f,null))['then'](saveUpdates(_0x48e057['body'],null))[_0x9919('0x27')](respondWithResult(_0x4c807f,null))[_0x9919('0x47')](handleError(_0x4c807f,null));};exports[_0x9919('0x28')]=function(_0x57c609,_0x423696){return db[_0x9919('0x2d')]['find']({'where':{'id':_0x57c609['params']['id']}})[_0x9919('0x27')](handleEntityNotFound(_0x423696,null))['then'](removeEntity(_0x423696,null))[_0x9919('0x47')](handleError(_0x423696,null));};exports['describe']=function(_0x427b45,_0x5eacb7){return db[_0x9919('0x2d')][_0x9919('0x4e')]()['then'](respondWithResult(_0x5eacb7,null))[_0x9919('0x47')](handleError(_0x5eacb7,null));}; \ No newline at end of file +var _0x4dec=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x34ba15,_0x1cef52){var _0x286d94=function(_0xf9edb2){while(--_0xf9edb2){_0x34ba15['push'](_0x34ba15['shift']());}};_0x286d94(++_0x1cef52);}(_0x4dec,0xd9));var _0xc4de=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4dec[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xc4de('0x0'));var rimraf=require(_0xc4de('0x1'));var zipdir=require(_0xc4de('0x2'));var jsonpatch=require(_0xc4de('0x3'));var rp=require(_0xc4de('0x4'));var moment=require(_0xc4de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4de('0x6'));var util=require(_0xc4de('0x7'));var path=require(_0xc4de('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4de('0x9'));var fs=require('fs');var fs_extra=require(_0xc4de('0xa'));var _=require(_0xc4de('0xb'));var squel=require(_0xc4de('0xc'));var crypto=require(_0xc4de('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc4de('0xe'));var toCsv=require(_0xc4de('0xf'));var querystring=require(_0xc4de('0x10'));var Papa=require(_0xc4de('0x11'));var Redis=require(_0xc4de('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc4de('0x13'));var hardwareService=require(_0xc4de('0x14'));var logger=require(_0xc4de('0x15'))(_0xc4de('0x16'));var utils=require('../../config/utils');var config=require(_0xc4de('0x17'));var licenseUtil=require(_0xc4de('0x18'));var db=require(_0xc4de('0x19'))['db'];function respondWithStatusCode(_0x43dd7b,_0x41f3a1){_0x41f3a1=_0x41f3a1||0xcc;return function(_0x4cc05d){if(_0x4cc05d){return _0x43dd7b[_0xc4de('0x1a')](_0x41f3a1);}return _0x43dd7b['status'](_0x41f3a1)[_0xc4de('0x1b')]();};}function respondWithResult(_0x191ff1,_0x294e50){_0x294e50=_0x294e50||0xc8;return function(_0x1328bc){if(_0x1328bc){return _0x191ff1[_0xc4de('0x1c')](_0x294e50)[_0xc4de('0x1d')](_0x1328bc);}};}function respondWithFilteredResult(_0x5a60f9,_0x227b95){return function(_0x3dd4db){if(_0x3dd4db){var _0x4fe54b=typeof _0x227b95[_0xc4de('0x1e')]===_0xc4de('0x1f')&&typeof _0x227b95[_0xc4de('0x20')]===_0xc4de('0x1f');var _0x5bbf22=_0x3dd4db['count'];var _0x1ee08e=_0x4fe54b?0x0:_0x227b95[_0xc4de('0x1e')];var _0x37ab51=_0x4fe54b?_0x3dd4db[_0xc4de('0x21')]:_0x227b95[_0xc4de('0x1e')]+_0x227b95[_0xc4de('0x20')];var _0x4c3b69;if(_0x37ab51>=_0x5bbf22){_0x37ab51=_0x5bbf22;_0x4c3b69=0xc8;}else{_0x4c3b69=0xce;}_0x5a60f9[_0xc4de('0x1c')](_0x4c3b69);return _0x5a60f9[_0xc4de('0x22')](_0xc4de('0x23'),_0x1ee08e+'-'+_0x37ab51+'/'+_0x5bbf22)[_0xc4de('0x1d')](_0x3dd4db);}return null;};}function patchUpdates(_0x590fd9){return function(_0x49f879){try{jsonpatch[_0xc4de('0x24')](_0x49f879,_0x590fd9,!![]);}catch(_0x5084c9){return BPromise[_0xc4de('0x25')](_0x5084c9);}return _0x49f879[_0xc4de('0x26')]();};}function saveUpdates(_0x160580,_0x490a0c){return function(_0x4f65d0){if(_0x4f65d0){return _0x4f65d0['update'](_0x160580)['then'](function(_0x435b2b){return _0x435b2b;});}return null;};}function removeEntity(_0xcadfe2,_0x419588){return function(_0x51e046){if(_0x51e046){return _0x51e046[_0xc4de('0x27')]()[_0xc4de('0x28')](function(){_0xcadfe2['status'](0xcc)[_0xc4de('0x1b')]();});}};}function handleEntityNotFound(_0x3b2adc,_0x2869f1){return function(_0x3725b7){if(!_0x3725b7){_0x3b2adc[_0xc4de('0x1a')](0x194);}return _0x3725b7;};}function handleError(_0x2a25cd,_0x2d75cd){_0x2d75cd=_0x2d75cd||0x1f4;return function(_0x4cb1f1){logger[_0xc4de('0x29')](_0x4cb1f1['stack']);if(_0x4cb1f1['name']){delete _0x4cb1f1['name'];}_0x2a25cd[_0xc4de('0x1c')](_0x2d75cd)[_0xc4de('0x2a')](_0x4cb1f1);};}exports[_0xc4de('0x2b')]=function(_0x15ec5b,_0x305c6a){var _0x145d23={},_0x406322={},_0x3a4467={'count':0x0,'rows':[]};var _0x1a149e=_[_0xc4de('0x2c')](db[_0xc4de('0x2d')][_0xc4de('0x2e')],function(_0x1f9192){return{'name':_0x1f9192[_0xc4de('0x2f')],'type':_0x1f9192[_0xc4de('0x30')]['key']};});_0x406322[_0xc4de('0x31')]=_['map'](_0x1a149e,'name');_0x406322[_0xc4de('0x32')]=_[_0xc4de('0x33')](_0x15ec5b['query']);_0x406322[_0xc4de('0x34')]=_[_0xc4de('0x35')](_0x406322['model'],_0x406322['query']);_0x145d23['attributes']=_['intersection'](_0x406322[_0xc4de('0x31')],qs[_0xc4de('0x36')](_0x15ec5b['query'][_0xc4de('0x36')]));_0x145d23[_0xc4de('0x37')]=_0x145d23[_0xc4de('0x37')][_0xc4de('0x38')]?_0x145d23[_0xc4de('0x37')]:_0x406322['model'];if(!_0x15ec5b[_0xc4de('0x32')][_0xc4de('0x39')](_0xc4de('0x3a'))){_0x145d23['limit']=qs[_0xc4de('0x20')](_0x15ec5b[_0xc4de('0x32')][_0xc4de('0x20')]);_0x145d23[_0xc4de('0x1e')]=qs[_0xc4de('0x1e')](_0x15ec5b[_0xc4de('0x32')][_0xc4de('0x1e')]);}_0x145d23[_0xc4de('0x3b')]=qs['sort'](_0x15ec5b[_0xc4de('0x32')][_0xc4de('0x3c')]);_0x145d23[_0xc4de('0x3d')]=qs['filters'](_[_0xc4de('0x3e')](_0x15ec5b['query'],_0x406322[_0xc4de('0x34')]),_0x1a149e);if(_0x15ec5b['query']['filter']){_0x145d23[_0xc4de('0x3d')]=_[_0xc4de('0x3f')](_0x145d23['where'],{'$or':_[_0xc4de('0x2c')](_0x1a149e,function(_0x38a273){if(_0x38a273[_0xc4de('0x30')]!==_0xc4de('0x40')){var _0x4f0c5c={};_0x4f0c5c[_0x38a273[_0xc4de('0x41')]]={'$like':'%'+_0x15ec5b[_0xc4de('0x32')]['filter']+'%'};return _0x4f0c5c;}})});}_0x145d23=_[_0xc4de('0x3f')]({},_0x145d23,_0x15ec5b[_0xc4de('0x42')]);var _0x220f46={'where':_0x145d23[_0xc4de('0x3d')]};return db[_0xc4de('0x2d')][_0xc4de('0x21')](_0x220f46)[_0xc4de('0x28')](function(_0x4b2d00){_0x3a4467[_0xc4de('0x21')]=_0x4b2d00;if(_0x15ec5b[_0xc4de('0x32')][_0xc4de('0x43')]){_0x145d23[_0xc4de('0x44')]=[{'all':!![]}];}return db[_0xc4de('0x2d')][_0xc4de('0x45')](_0x145d23);})[_0xc4de('0x28')](function(_0x4e30d2){_0x3a4467[_0xc4de('0x46')]=_0x4e30d2;return _0x3a4467;})[_0xc4de('0x28')](respondWithFilteredResult(_0x305c6a,_0x145d23))[_0xc4de('0x47')](handleError(_0x305c6a,null));};exports[_0xc4de('0x48')]=function(_0x8bf7a,_0x398eb7){var _0x45259b={'raw':!![],'where':{'id':_0x8bf7a['params']['id']}},_0x42f8b5={};_0x42f8b5[_0xc4de('0x31')]=_[_0xc4de('0x33')](db['JscriptyQuestionReport'][_0xc4de('0x2e')]);_0x42f8b5['query']=_[_0xc4de('0x33')](_0x8bf7a['query']);_0x42f8b5[_0xc4de('0x34')]=_[_0xc4de('0x35')](_0x42f8b5[_0xc4de('0x31')],_0x42f8b5[_0xc4de('0x32')]);_0x45259b[_0xc4de('0x37')]=_[_0xc4de('0x35')](_0x42f8b5[_0xc4de('0x31')],qs[_0xc4de('0x36')](_0x8bf7a[_0xc4de('0x32')]['fields']));_0x45259b['attributes']=_0x45259b[_0xc4de('0x37')][_0xc4de('0x38')]?_0x45259b['attributes']:_0x42f8b5['model'];if(_0x8bf7a[_0xc4de('0x32')][_0xc4de('0x43')]){_0x45259b['include']=[{'all':!![]}];}_0x45259b=_[_0xc4de('0x3f')]({},_0x45259b,_0x8bf7a[_0xc4de('0x42')]);return db['JscriptyQuestionReport'][_0xc4de('0x49')](_0x45259b)[_0xc4de('0x28')](handleEntityNotFound(_0x398eb7,null))['then'](respondWithResult(_0x398eb7,null))['catch'](handleError(_0x398eb7,null));};exports['create']=function(_0x3a2ae0,_0x49f257){return db[_0xc4de('0x2d')][_0xc4de('0x4a')](_0x3a2ae0['body'],{})[_0xc4de('0x28')](respondWithResult(_0x49f257,0xc9))[_0xc4de('0x47')](handleError(_0x49f257,null));};exports[_0xc4de('0x4b')]=function(_0x5c736e,_0x260d47){if(_0x5c736e[_0xc4de('0x4c')]['id']){delete _0x5c736e['body']['id'];}return db[_0xc4de('0x2d')]['find']({'where':{'id':_0x5c736e[_0xc4de('0x4d')]['id']}})[_0xc4de('0x28')](handleEntityNotFound(_0x260d47,null))[_0xc4de('0x28')](saveUpdates(_0x5c736e[_0xc4de('0x4c')],null))[_0xc4de('0x28')](respondWithResult(_0x260d47,null))[_0xc4de('0x47')](handleError(_0x260d47,null));};exports[_0xc4de('0x27')]=function(_0x4af726,_0x25fc25){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x4af726[_0xc4de('0x4d')]['id']}})[_0xc4de('0x28')](handleEntityNotFound(_0x25fc25,null))[_0xc4de('0x28')](removeEntity(_0x25fc25,null))['catch'](handleError(_0x25fc25,null));};exports[_0xc4de('0x4e')]=function(_0x155957,_0x2ed677){return db['JscriptyQuestionReport']['describe']()[_0xc4de('0x28')](respondWithResult(_0x2ed677,null))['catch'](handleError(_0x2ed677,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8fbd633..92d18cf 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 _0x642e=['../../config/environment','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e1245,_0x21f8e6){var _0x257a6a=function(_0x256c71){while(--_0x256c71){_0x4e1245['push'](_0x4e1245['shift']());}};_0x257a6a(++_0x21f8e6);}(_0x642e,0xba));var _0xe642=function(_0x1258db,_0x4b51b5){_0x1258db=_0x1258db-0x0;var _0x4f46a5=_0x642e[_0x1258db];return _0x4f46a5;};'use strict';var _=require(_0xe642('0x0'));var util=require(_0xe642('0x1'));var logger=require(_0xe642('0x2'))(_0xe642('0x3'));var moment=require(_0xe642('0x4'));var BPromise=require(_0xe642('0x5'));var rp=require(_0xe642('0x6'));var fs=require('fs');var path=require(_0xe642('0x7'));var rimraf=require(_0xe642('0x8'));var config=require(_0xe642('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe642('0xa')]=function(_0x56b071,_0x223f64){return _0x56b071[_0xe642('0xb')](_0xe642('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f92=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2d4240,_0x35316b){var _0x5978b0=function(_0x1aeabb){while(--_0x1aeabb){_0x2d4240['push'](_0x2d4240['shift']());}};_0x5978b0(++_0x35316b);}(_0x9f92,0x1d1));var _0x29f9=function(_0x5e07a7,_0x1438b3){_0x5e07a7=_0x5e07a7-0x0;var _0x22ced5=_0x9f92[_0x5e07a7];return _0x22ced5;};'use strict';var _=require(_0x29f9('0x0'));var util=require(_0x29f9('0x1'));var logger=require(_0x29f9('0x2'))(_0x29f9('0x3'));var moment=require(_0x29f9('0x4'));var BPromise=require(_0x29f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29f9('0x6'));var rimraf=require(_0x29f9('0x7'));var config=require(_0x29f9('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x29f9('0x9')]=function(_0xa520b9,_0x598583){return _0xa520b9[_0x29f9('0xa')]('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 6ed47a6..9bebaf1 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 _0x03b4=['code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56b3a3,_0x77b2d){var _0x5315cf=function(_0x30622e){while(--_0x30622e){_0x56b3a3['push'](_0x56b3a3['shift']());}};_0x5315cf(++_0x77b2d);}(_0x03b4,0x1cc));var _0x403b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x03b4[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x403b('0x0'));var moment=require('moment');var BPromise=require(_0x403b('0x1'));var rs=require(_0x403b('0x2'));var fs=require('fs');var Redis=require(_0x403b('0x3'));var db=require(_0x403b('0x4'))['db'];var utils=require(_0x403b('0x5'));var logger=require(_0x403b('0x6'))(_0x403b('0x7'));var config=require(_0x403b('0x8'));var jayson=require(_0x403b('0x9'));var client=jayson[_0x403b('0xa')][_0x403b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdbaeb7,_0x4247b6,_0x5d233d){return new BPromise(function(_0x24c84e,_0x2a604b){return client[_0x403b('0xc')](_0xdbaeb7,_0x5d233d)[_0x403b('0xd')](function(_0x1fd734){logger['info'](_0x403b('0xe'),_0x4247b6,_0x403b('0xf'));logger[_0x403b('0x10')](_0x403b('0x11'),_0x4247b6,'request\x20sent',JSON[_0x403b('0x12')](_0x1fd734));if(_0x1fd734[_0x403b('0x13')]){if(_0x1fd734[_0x403b('0x13')][_0x403b('0x14')]===0x1f4){logger['error'](_0x403b('0xe'),_0x4247b6,_0x1fd734[_0x403b('0x13')][_0x403b('0x15')]);return _0x2a604b(_0x1fd734[_0x403b('0x13')][_0x403b('0x15')]);}logger[_0x403b('0x13')](_0x403b('0xe'),_0x4247b6,_0x1fd734[_0x403b('0x13')][_0x403b('0x15')]);return _0x24c84e(_0x1fd734[_0x403b('0x13')]['message']);}else{logger[_0x403b('0x16')](_0x403b('0xe'),_0x4247b6,_0x403b('0xf'));_0x24c84e(_0x1fd734[_0x403b('0x17')][_0x403b('0x15')]);}})['catch'](function(_0x35030f){logger[_0x403b('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4247b6,_0x35030f);_0x2a604b(_0x35030f);});});} \ No newline at end of file +var _0x9df7=['catch','util','moment','ioredis','../../mysqldb','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xdd598a,_0x2f4169){var _0x18c8d7=function(_0x52be9c){while(--_0x52be9c){_0xdd598a['push'](_0xdd598a['shift']());}};_0x18c8d7(++_0x2f4169);}(_0x9df7,0x73));var _0x79df=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9df7[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x79df('0x0'));var moment=require(_0x79df('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79df('0x2'));var db=require(_0x79df('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x79df('0x4'));var client=jayson[_0x79df('0x5')][_0x79df('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x36f76d,_0x4cb195,_0x734d63){return new BPromise(function(_0x3d237a,_0x311e0b){return client['request'](_0x36f76d,_0x734d63)[_0x79df('0x7')](function(_0x2e744e){logger[_0x79df('0x8')](_0x79df('0x9'),_0x4cb195,'request\x20sent');logger[_0x79df('0xa')](_0x79df('0xb'),_0x4cb195,_0x79df('0xc'),JSON[_0x79df('0xd')](_0x2e744e));if(_0x2e744e[_0x79df('0xe')]){if(_0x2e744e['error'][_0x79df('0xf')]===0x1f4){logger['error'](_0x79df('0x9'),_0x4cb195,_0x2e744e['error'][_0x79df('0x10')]);return _0x311e0b(_0x2e744e[_0x79df('0xe')]['message']);}logger[_0x79df('0xe')](_0x79df('0x9'),_0x4cb195,_0x2e744e[_0x79df('0xe')]['message']);return _0x3d237a(_0x2e744e[_0x79df('0xe')]['message']);}else{logger['info'](_0x79df('0x9'),_0x4cb195,'request\x20sent');_0x3d237a(_0x2e744e[_0x79df('0x11')]['message']);}})[_0x79df('0x12')](function(_0x228ed3){logger['error'](_0x79df('0x9'),_0x4cb195,_0x228ed3);_0x311e0b(_0x228ed3);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e305602..7f7ee96 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 _0xa649=['/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','show','/:id/questions','post','put'];(function(_0x25ee0f,_0x4b50a4){var _0x3ca76e=function(_0x14e6be){while(--_0x14e6be){_0x25ee0f['push'](_0x25ee0f['shift']());}};_0x3ca76e(++_0x4b50a4);}(_0xa649,0x18f));var _0x9a64=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa649[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x9a64('0x0'));var util=require(_0x9a64('0x1'));var path=require(_0x9a64('0x2'));var timeout=require(_0x9a64('0x3'));var express=require(_0x9a64('0x4'));var router=express[_0x9a64('0x5')]();var fs_extra=require(_0x9a64('0x6'));var auth=require(_0x9a64('0x7'));var interaction=require(_0x9a64('0x8'));var config=require(_0x9a64('0x9'));var controller=require(_0x9a64('0xa'));router[_0x9a64('0xb')]('/',auth[_0x9a64('0xc')](),controller[_0x9a64('0xd')]);router[_0x9a64('0xb')](_0x9a64('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x9a64('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9a64('0xf')]);router[_0x9a64('0xb')](_0x9a64('0x10'),auth['isAuthenticated'](),controller['getQuestions']);router[_0x9a64('0x11')]('/',auth[_0x9a64('0xc')](),controller['create']);router[_0x9a64('0x12')](_0x9a64('0x13'),auth[_0x9a64('0xc')](),controller['update']);router[_0x9a64('0x14')](_0x9a64('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a64('0x15')]=router; \ No newline at end of file +var _0x2f3f=['../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','put','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3b3762,_0x492219){var _0x1b8007=function(_0x1d2d83){while(--_0x1d2d83){_0x3b3762['push'](_0x3b3762['shift']());}};_0x1b8007(++_0x492219);}(_0x2f3f,0x79));var _0xf2f3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2f3f[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xf2f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf2f3('0x1'));var express=require(_0xf2f3('0x2'));var router=express[_0xf2f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf2f3('0x4'));var interaction=require(_0xf2f3('0x5'));var config=require('../../config/environment');var controller=require(_0xf2f3('0x6'));router[_0xf2f3('0x7')]('/',auth[_0xf2f3('0x8')](),controller[_0xf2f3('0x9')]);router[_0xf2f3('0x7')]('/describe',auth[_0xf2f3('0x8')](),controller[_0xf2f3('0xa')]);router[_0xf2f3('0x7')](_0xf2f3('0xb'),auth[_0xf2f3('0x8')](),controller[_0xf2f3('0xc')]);router['get'](_0xf2f3('0xd'),auth['isAuthenticated'](),controller[_0xf2f3('0xe')]);router[_0xf2f3('0xf')]('/',auth[_0xf2f3('0x8')](),controller['create']);router[_0xf2f3('0x10')](_0xf2f3('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf2f3('0xb'),auth[_0xf2f3('0x8')](),controller['destroy']);module[_0xf2f3('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b44b0c1..da63717 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 _0x4451=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x4451,0xf4));var _0x1445=function(_0x1a8d28,_0x1de7be){_0x1a8d28=_0x1a8d28-0x0;var _0x311b71=_0x4451[_0x1a8d28];return _0x311b71;};'use strict';var moment=require(_0x1445('0x0'));var Sequelize=require(_0x1445('0x1'));module[_0x1445('0x2')]={'starttime':{'type':Sequelize[_0x1445('0x3')],'set':function(_0x577e7f){this[_0x1445('0x4')](_0x1445('0x5'),_0x577e7f);this[_0x1445('0x4')](_0x1445('0x6'),moment()[_0x1445('0x7')](_0x1445('0x8')));}},'endtime':{'type':Sequelize[_0x1445('0x3')]},'membername':{'type':Sequelize[_0x1445('0x9')]},'projectname':{'type':Sequelize[_0x1445('0x9')]},'queue':{'type':Sequelize[_0x1445('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1445('0x9')]},'calleridnum':{'type':Sequelize[_0x1445('0x9')]},'completed':{'type':Sequelize[_0x1445('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x3988=['BOOLEAN','moment','sequelize','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x46884f,_0x2b5c5a){var _0x78c6c0=function(_0x43ba0a){while(--_0x43ba0a){_0x46884f['push'](_0x46884f['shift']());}};_0x78c6c0(++_0x2b5c5a);}(_0x3988,0x1cc));var _0x8398=function(_0x42a950,_0x2ca1f2){_0x42a950=_0x42a950-0x0;var _0x3581ed=_0x3988[_0x42a950];return _0x3581ed;};'use strict';var moment=require(_0x8398('0x0'));var Sequelize=require(_0x8398('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x8398('0x2')],'set':function(_0x407622){this[_0x8398('0x3')]('starttime',_0x407622);this['setDataValue'](_0x8398('0x4'),moment()[_0x8398('0x5')](_0x8398('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x8398('0x7')]},'queue':{'type':Sequelize[_0x8398('0x7')]},'uniqueid':{'type':Sequelize[_0x8398('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8398('0x7')]},'completed':{'type':Sequelize[_0x8398('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 018b3b3..f804465 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 _0x92ba=['limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','sort','where','filters','pick','filter','merge','options','params','length','includeAll','include','catch','create','body','describe','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','order','SessionId','findAll','rows','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined'];(function(_0x1f7909,_0x1aefbd){var _0x2cb51f=function(_0x37635b){while(--_0x37635b){_0x1f7909['push'](_0x1f7909['shift']());}};_0x2cb51f(++_0x1aefbd);}(_0x92ba,0x1b3));var _0xa92b=function(_0x3e384,_0x1a987b){_0x3e384=_0x3e384-0x0;var _0x98c085=_0x92ba[_0x3e384];return _0x98c085;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa92b('0x0'));var jsonpatch=require(_0xa92b('0x1'));var rp=require('request-promise');var moment=require(_0xa92b('0x2'));var BPromise=require(_0xa92b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa92b('0x4'));var sox=require('sox');var csv=require(_0xa92b('0x5'));var ejs=require(_0xa92b('0x6'));var fs=require('fs');var fs_extra=require(_0xa92b('0x7'));var _=require(_0xa92b('0x8'));var squel=require(_0xa92b('0x9'));var crypto=require(_0xa92b('0xa'));var jsforce=require(_0xa92b('0xb'));var deskjs=require(_0xa92b('0xc'));var toCsv=require(_0xa92b('0x5'));var querystring=require(_0xa92b('0xd'));var Papa=require(_0xa92b('0xe'));var Redis=require(_0xa92b('0xf'));var authService=require(_0xa92b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa92b('0x11'));var hardwareService=require(_0xa92b('0x12'));var logger=require(_0xa92b('0x13'))('api');var utils=require(_0xa92b('0x14'));var config=require(_0xa92b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8484b4,_0x1732fd){_0x1732fd=_0x1732fd||0xcc;return function(_0x59a5a4){if(_0x59a5a4){return _0x8484b4[_0xa92b('0x16')](_0x1732fd);}return _0x8484b4[_0xa92b('0x17')](_0x1732fd)[_0xa92b('0x18')]();};}function respondWithResult(_0x4f9f15,_0x93bb4b){_0x93bb4b=_0x93bb4b||0xc8;return function(_0x4bf59f){if(_0x4bf59f){return _0x4f9f15[_0xa92b('0x17')](_0x93bb4b)[_0xa92b('0x19')](_0x4bf59f);}};}function respondWithFilteredResult(_0x437cac,_0x5796b8){return function(_0x36545d){if(_0x36545d){var _0x22f0fb=typeof _0x5796b8['offset']===_0xa92b('0x1a')&&typeof _0x5796b8[_0xa92b('0x1b')]==='undefined';var _0x58ec2a=_0x36545d[_0xa92b('0x1c')];var _0x2aa0f5=_0x22f0fb?0x0:_0x5796b8['offset'];var _0x320083=_0x22f0fb?_0x36545d[_0xa92b('0x1c')]:_0x5796b8[_0xa92b('0x1d')]+_0x5796b8[_0xa92b('0x1b')];var _0x3dcbd9;if(_0x320083>=_0x58ec2a){_0x320083=_0x58ec2a;_0x3dcbd9=0xc8;}else{_0x3dcbd9=0xce;}_0x437cac['status'](_0x3dcbd9);return _0x437cac[_0xa92b('0x1e')](_0xa92b('0x1f'),_0x2aa0f5+'-'+_0x320083+'/'+_0x58ec2a)['json'](_0x36545d);}return null;};}function patchUpdates(_0x531b60){return function(_0x2adc91){try{jsonpatch[_0xa92b('0x20')](_0x2adc91,_0x531b60,!![]);}catch(_0x35b666){return BPromise[_0xa92b('0x21')](_0x35b666);}return _0x2adc91[_0xa92b('0x22')]();};}function saveUpdates(_0x25d2b0,_0x39a887){return function(_0x3835c7){if(_0x3835c7){return _0x3835c7[_0xa92b('0x23')](_0x25d2b0)[_0xa92b('0x24')](function(_0x23fd1a){return _0x23fd1a;});}return null;};}function removeEntity(_0x4c6b75,_0x4f5778){return function(_0xff2249){if(_0xff2249){return _0xff2249[_0xa92b('0x25')]()[_0xa92b('0x24')](function(){_0x4c6b75[_0xa92b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54720f,_0x59e870){return function(_0x3d95ee){if(!_0x3d95ee){_0x54720f[_0xa92b('0x16')](0x194);}return _0x3d95ee;};}function handleError(_0x1c2a56,_0x39ece2){_0x39ece2=_0x39ece2||0x1f4;return function(_0x4d6ed5){logger['error'](_0x4d6ed5[_0xa92b('0x26')]);if(_0x4d6ed5[_0xa92b('0x27')]){delete _0x4d6ed5['name'];}_0x1c2a56[_0xa92b('0x17')](_0x39ece2)[_0xa92b('0x28')](_0x4d6ed5);};}exports[_0xa92b('0x29')]=function(_0x554c12,_0x22ebad){var _0x2f929d={},_0x283728={},_0x2af750={'count':0x0,'rows':[]};var _0x3d2709=_[_0xa92b('0x2a')](db[_0xa92b('0x2b')][_0xa92b('0x2c')],function(_0x375708){return{'name':_0x375708[_0xa92b('0x2d')],'type':_0x375708[_0xa92b('0x2e')][_0xa92b('0x2f')]};});_0x283728[_0xa92b('0x30')]=_[_0xa92b('0x2a')](_0x3d2709,_0xa92b('0x27'));_0x283728[_0xa92b('0x31')]=_[_0xa92b('0x32')](_0x554c12[_0xa92b('0x31')]);_0x283728['filters']=_[_0xa92b('0x33')](_0x283728[_0xa92b('0x30')],_0x283728['query']);_0x2f929d[_0xa92b('0x34')]=_[_0xa92b('0x33')](_0x283728[_0xa92b('0x30')],qs[_0xa92b('0x35')](_0x554c12[_0xa92b('0x31')][_0xa92b('0x35')]));_0x2f929d[_0xa92b('0x34')]=_0x2f929d[_0xa92b('0x34')]['length']?_0x2f929d['attributes']:_0x283728['model'];if(!_0x554c12['query']['hasOwnProperty']('nolimit')){_0x2f929d[_0xa92b('0x1b')]=qs['limit'](_0x554c12['query'][_0xa92b('0x1b')]);_0x2f929d[_0xa92b('0x1d')]=qs[_0xa92b('0x1d')](_0x554c12['query'][_0xa92b('0x1d')]);}_0x2f929d['order']=qs[_0xa92b('0x36')](_0x554c12[_0xa92b('0x31')][_0xa92b('0x36')]);_0x2f929d[_0xa92b('0x37')]=qs[_0xa92b('0x38')](_[_0xa92b('0x39')](_0x554c12[_0xa92b('0x31')],_0x283728[_0xa92b('0x38')]),_0x3d2709);if(_0x554c12[_0xa92b('0x31')][_0xa92b('0x3a')]){_0x2f929d[_0xa92b('0x37')]=_[_0xa92b('0x3b')](_0x2f929d[_0xa92b('0x37')],{'$or':_[_0xa92b('0x2a')](_0x3d2709,function(_0x32ea54){if(_0x32ea54['type']!=='VIRTUAL'){var _0x3bee1a={};_0x3bee1a[_0x32ea54[_0xa92b('0x27')]]={'$like':'%'+_0x554c12[_0xa92b('0x31')]['filter']+'%'};return _0x3bee1a;}})});}_0x2f929d=_[_0xa92b('0x3b')]({},_0x2f929d,_0x554c12[_0xa92b('0x3c')]);var _0x53041a={'where':_0x2f929d['where']};return db[_0xa92b('0x2b')][_0xa92b('0x1c')](_0x53041a)[_0xa92b('0x24')](function(_0x2374e9){_0x2af750[_0xa92b('0x1c')]=_0x2374e9;if(_0x554c12['query']['includeAll']){_0x2f929d['include']=[{'all':!![]}];}return db[_0xa92b('0x2b')]['findAll'](_0x2f929d);})['then'](function(_0x52e64b){_0x2af750['rows']=_0x52e64b;return _0x2af750;})['then'](respondWithFilteredResult(_0x22ebad,_0x2f929d))['catch'](handleError(_0x22ebad,null));};exports['show']=function(_0x642bc7,_0xfa3a4b){var _0x3b01f4={'raw':!![],'where':{'id':_0x642bc7[_0xa92b('0x3d')]['id']}},_0x5d80d7={};_0x5d80d7[_0xa92b('0x30')]=_[_0xa92b('0x32')](db[_0xa92b('0x2b')][_0xa92b('0x2c')]);_0x5d80d7[_0xa92b('0x31')]=_[_0xa92b('0x32')](_0x642bc7[_0xa92b('0x31')]);_0x5d80d7[_0xa92b('0x38')]=_[_0xa92b('0x33')](_0x5d80d7[_0xa92b('0x30')],_0x5d80d7[_0xa92b('0x31')]);_0x3b01f4[_0xa92b('0x34')]=_[_0xa92b('0x33')](_0x5d80d7['model'],qs['fields'](_0x642bc7['query'][_0xa92b('0x35')]));_0x3b01f4[_0xa92b('0x34')]=_0x3b01f4[_0xa92b('0x34')][_0xa92b('0x3e')]?_0x3b01f4[_0xa92b('0x34')]:_0x5d80d7[_0xa92b('0x30')];if(_0x642bc7[_0xa92b('0x31')][_0xa92b('0x3f')]){_0x3b01f4[_0xa92b('0x40')]=[{'all':!![]}];}_0x3b01f4=_['merge']({},_0x3b01f4,_0x642bc7['options']);return db[_0xa92b('0x2b')]['find'](_0x3b01f4)['then'](handleEntityNotFound(_0xfa3a4b,null))[_0xa92b('0x24')](respondWithResult(_0xfa3a4b,null))[_0xa92b('0x41')](handleError(_0xfa3a4b,null));};exports['create']=function(_0xee91a5,_0x9e154c){return db[_0xa92b('0x2b')][_0xa92b('0x42')](_0xee91a5[_0xa92b('0x43')],{})[_0xa92b('0x24')](respondWithResult(_0x9e154c,0xc9))[_0xa92b('0x41')](handleError(_0x9e154c,null));};exports[_0xa92b('0x23')]=function(_0x2664e9,_0x3f3752){if(_0x2664e9[_0xa92b('0x43')]['id']){delete _0x2664e9['body']['id'];}return db[_0xa92b('0x2b')]['find']({'where':{'id':_0x2664e9[_0xa92b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3f3752,null))[_0xa92b('0x24')](saveUpdates(_0x2664e9[_0xa92b('0x43')],null))[_0xa92b('0x24')](respondWithResult(_0x3f3752,null))['catch'](handleError(_0x3f3752,null));};exports[_0xa92b('0x25')]=function(_0x17e710,_0x34f735){return db[_0xa92b('0x2b')]['find']({'where':{'id':_0x17e710['params']['id']}})[_0xa92b('0x24')](handleEntityNotFound(_0x34f735,null))['then'](removeEntity(_0x34f735,null))['catch'](handleError(_0x34f735,null));};exports[_0xa92b('0x44')]=function(_0x8bbff6,_0x32945e){return db[_0xa92b('0x2b')]['describe']()[_0xa92b('0x24')](respondWithResult(_0x32945e,null))[_0xa92b('0x41')](handleError(_0x32945e,null));};exports['getQuestions']=function(_0x5ed275,_0x402a6b,_0x2eed63){var _0x4267c6={'raw':!![],'where':{}};var _0x27c521={};var _0x1d4a63={'count':0x0,'rows':[]};return db[_0xa92b('0x2b')][_0xa92b('0x45')]({'where':{'id':_0x5ed275[_0xa92b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x402a6b,null))[_0xa92b('0x24')](function(_0x2c346d){if(_0x2c346d){_0x27c521['model']=_['keys'](db[_0xa92b('0x46')][_0xa92b('0x2c')]);_0x27c521[_0xa92b('0x31')]=_['keys'](_0x5ed275[_0xa92b('0x31')]);_0x27c521[_0xa92b('0x38')]=_[_0xa92b('0x33')](_0x27c521['model'],_0x27c521[_0xa92b('0x31')]);_0x4267c6[_0xa92b('0x34')]=_['intersection'](_0x27c521[_0xa92b('0x30')],qs[_0xa92b('0x35')](_0x5ed275['query'][_0xa92b('0x35')]));_0x4267c6[_0xa92b('0x34')]=_0x4267c6[_0xa92b('0x34')][_0xa92b('0x3e')]?_0x4267c6['attributes']:_0x27c521[_0xa92b('0x30')];if(!_0x5ed275[_0xa92b('0x31')][_0xa92b('0x47')](_0xa92b('0x48'))){_0x4267c6['limit']=qs[_0xa92b('0x1b')](_0x5ed275[_0xa92b('0x31')][_0xa92b('0x1b')]);_0x4267c6[_0xa92b('0x1d')]=qs[_0xa92b('0x1d')](_0x5ed275[_0xa92b('0x31')][_0xa92b('0x1d')]);}_0x4267c6[_0xa92b('0x49')]=qs[_0xa92b('0x36')](_0x5ed275[_0xa92b('0x31')][_0xa92b('0x36')]);_0x4267c6[_0xa92b('0x37')]=qs[_0xa92b('0x38')](_[_0xa92b('0x39')](_0x5ed275[_0xa92b('0x31')],_0x27c521[_0xa92b('0x38')]));_0x4267c6['where'][_0xa92b('0x4a')]=_0x2c346d['id'];if(_0x5ed275[_0xa92b('0x31')][_0xa92b('0x3a')]){_0x4267c6[_0xa92b('0x37')]=_[_0xa92b('0x3b')](_0x4267c6[_0xa92b('0x37')],{'$or':_['map'](_0x4267c6[_0xa92b('0x34')],function(_0x67db1){var _0x454394={};_0x454394[_0x67db1]={'$like':'%'+_0x5ed275[_0xa92b('0x31')][_0xa92b('0x3a')]+'%'};return _0x454394;})});}_0x4267c6=_['merge']({},_0x4267c6,_0x5ed275[_0xa92b('0x3c')]);return db[_0xa92b('0x46')]['count']({'where':_0x4267c6[_0xa92b('0x37')]})[_0xa92b('0x24')](function(_0x1d2b4d){_0x1d4a63[_0xa92b('0x1c')]=_0x1d2b4d;if(_0x5ed275['query']['includeAll']){_0x4267c6[_0xa92b('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa92b('0x4b')](_0x4267c6);})[_0xa92b('0x24')](function(_0x4e4a9c){_0x1d4a63[_0xa92b('0x4c')]=_0x4e4a9c;return _0x1d4a63;});}})[_0xa92b('0x24')](respondWithFilteredResult(_0x402a6b,_0x4267c6))[_0xa92b('0x41')](handleError(_0x402a6b,null));}; \ No newline at end of file +var _0xca49=['body','destroy','describe','JscriptyQuestionReport','length','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x328f6c,_0x624cce){var _0x57f639=function(_0x281872){while(--_0x281872){_0x328f6c['push'](_0x328f6c['shift']());}};_0x57f639(++_0x624cce);}(_0xca49,0x196));var _0x9ca4=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0xca49[_0x57643b];return _0x53a35b;};'use strict';var emlformat=require(_0x9ca4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ca4('0x1'));var jsonpatch=require(_0x9ca4('0x2'));var rp=require(_0x9ca4('0x3'));var moment=require(_0x9ca4('0x4'));var BPromise=require(_0x9ca4('0x5'));var Mustache=require('mustache');var util=require(_0x9ca4('0x6'));var path=require(_0x9ca4('0x7'));var sox=require('sox');var csv=require(_0x9ca4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ca4('0x9'));var _=require('lodash');var squel=require(_0x9ca4('0xa'));var crypto=require(_0x9ca4('0xb'));var jsforce=require(_0x9ca4('0xc'));var deskjs=require(_0x9ca4('0xd'));var toCsv=require(_0x9ca4('0x8'));var querystring=require(_0x9ca4('0xe'));var Papa=require(_0x9ca4('0xf'));var Redis=require(_0x9ca4('0x10'));var authService=require(_0x9ca4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ca4('0x12'));var hardwareService=require(_0x9ca4('0x13'));var logger=require(_0x9ca4('0x14'))(_0x9ca4('0x15'));var utils=require(_0x9ca4('0x16'));var config=require(_0x9ca4('0x17'));var licenseUtil=require(_0x9ca4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4ac1,_0xc7f4d8){_0xc7f4d8=_0xc7f4d8||0xcc;return function(_0x34e90d){if(_0x34e90d){return _0x4a4ac1[_0x9ca4('0x19')](_0xc7f4d8);}return _0x4a4ac1[_0x9ca4('0x1a')](_0xc7f4d8)[_0x9ca4('0x1b')]();};}function respondWithResult(_0x2b643b,_0x295e70){_0x295e70=_0x295e70||0xc8;return function(_0xf3610b){if(_0xf3610b){return _0x2b643b[_0x9ca4('0x1a')](_0x295e70)['json'](_0xf3610b);}};}function respondWithFilteredResult(_0x1c85dd,_0x8e30c4){return function(_0x3ba8d4){if(_0x3ba8d4){var _0x509acc=typeof _0x8e30c4[_0x9ca4('0x1c')]===_0x9ca4('0x1d')&&typeof _0x8e30c4[_0x9ca4('0x1e')]===_0x9ca4('0x1d');var _0x44db51=_0x3ba8d4['count'];var _0x4d25c8=_0x509acc?0x0:_0x8e30c4[_0x9ca4('0x1c')];var _0x398033=_0x509acc?_0x3ba8d4[_0x9ca4('0x1f')]:_0x8e30c4[_0x9ca4('0x1c')]+_0x8e30c4[_0x9ca4('0x1e')];var _0x5b76da;if(_0x398033>=_0x44db51){_0x398033=_0x44db51;_0x5b76da=0xc8;}else{_0x5b76da=0xce;}_0x1c85dd[_0x9ca4('0x1a')](_0x5b76da);return _0x1c85dd[_0x9ca4('0x20')](_0x9ca4('0x21'),_0x4d25c8+'-'+_0x398033+'/'+_0x44db51)[_0x9ca4('0x22')](_0x3ba8d4);}return null;};}function patchUpdates(_0x28c720){return function(_0x3eac04){try{jsonpatch[_0x9ca4('0x23')](_0x3eac04,_0x28c720,!![]);}catch(_0x5553ff){return BPromise[_0x9ca4('0x24')](_0x5553ff);}return _0x3eac04['save']();};}function saveUpdates(_0x9e5b7a,_0x5a0b48){return function(_0x4c9835){if(_0x4c9835){return _0x4c9835[_0x9ca4('0x25')](_0x9e5b7a)[_0x9ca4('0x26')](function(_0x45a9d9){return _0x45a9d9;});}return null;};}function removeEntity(_0x4adafa,_0x57b1ad){return function(_0x2f26a9){if(_0x2f26a9){return _0x2f26a9['destroy']()[_0x9ca4('0x26')](function(){_0x4adafa['status'](0xcc)[_0x9ca4('0x1b')]();});}};}function handleEntityNotFound(_0x17cace,_0x132dce){return function(_0x2e96bf){if(!_0x2e96bf){_0x17cace['sendStatus'](0x194);}return _0x2e96bf;};}function handleError(_0x2e097b,_0x222212){_0x222212=_0x222212||0x1f4;return function(_0x50557f){logger['error'](_0x50557f[_0x9ca4('0x27')]);if(_0x50557f['name']){delete _0x50557f[_0x9ca4('0x28')];}_0x2e097b[_0x9ca4('0x1a')](_0x222212)[_0x9ca4('0x29')](_0x50557f);};}exports[_0x9ca4('0x2a')]=function(_0x599337,_0x45b891){var _0x5a2895={},_0x408aa7={},_0x271f11={'count':0x0,'rows':[]};var _0x1ab093=_[_0x9ca4('0x2b')](db[_0x9ca4('0x2c')][_0x9ca4('0x2d')],function(_0x25c131){return{'name':_0x25c131[_0x9ca4('0x2e')],'type':_0x25c131['type'][_0x9ca4('0x2f')]};});_0x408aa7[_0x9ca4('0x30')]=_[_0x9ca4('0x2b')](_0x1ab093,_0x9ca4('0x28'));_0x408aa7['query']=_[_0x9ca4('0x31')](_0x599337[_0x9ca4('0x32')]);_0x408aa7['filters']=_['intersection'](_0x408aa7[_0x9ca4('0x30')],_0x408aa7[_0x9ca4('0x32')]);_0x5a2895[_0x9ca4('0x33')]=_['intersection'](_0x408aa7['model'],qs[_0x9ca4('0x34')](_0x599337['query'][_0x9ca4('0x34')]));_0x5a2895['attributes']=_0x5a2895[_0x9ca4('0x33')]['length']?_0x5a2895[_0x9ca4('0x33')]:_0x408aa7[_0x9ca4('0x30')];if(!_0x599337[_0x9ca4('0x32')][_0x9ca4('0x35')](_0x9ca4('0x36'))){_0x5a2895[_0x9ca4('0x1e')]=qs[_0x9ca4('0x1e')](_0x599337[_0x9ca4('0x32')]['limit']);_0x5a2895[_0x9ca4('0x1c')]=qs[_0x9ca4('0x1c')](_0x599337['query']['offset']);}_0x5a2895['order']=qs[_0x9ca4('0x37')](_0x599337[_0x9ca4('0x32')][_0x9ca4('0x37')]);_0x5a2895['where']=qs['filters'](_[_0x9ca4('0x38')](_0x599337['query'],_0x408aa7[_0x9ca4('0x39')]),_0x1ab093);if(_0x599337[_0x9ca4('0x32')][_0x9ca4('0x3a')]){_0x5a2895['where']=_[_0x9ca4('0x3b')](_0x5a2895[_0x9ca4('0x3c')],{'$or':_[_0x9ca4('0x2b')](_0x1ab093,function(_0x536fd5){if(_0x536fd5[_0x9ca4('0x3d')]!==_0x9ca4('0x3e')){var _0x15ebbe={};_0x15ebbe[_0x536fd5[_0x9ca4('0x28')]]={'$like':'%'+_0x599337[_0x9ca4('0x32')]['filter']+'%'};return _0x15ebbe;}})});}_0x5a2895=_[_0x9ca4('0x3b')]({},_0x5a2895,_0x599337[_0x9ca4('0x3f')]);var _0x170290={'where':_0x5a2895['where']};return db[_0x9ca4('0x2c')][_0x9ca4('0x1f')](_0x170290)['then'](function(_0x16bd36){_0x271f11['count']=_0x16bd36;if(_0x599337[_0x9ca4('0x32')][_0x9ca4('0x40')]){_0x5a2895[_0x9ca4('0x41')]=[{'all':!![]}];}return db[_0x9ca4('0x2c')][_0x9ca4('0x42')](_0x5a2895);})['then'](function(_0x35ffaa){_0x271f11[_0x9ca4('0x43')]=_0x35ffaa;return _0x271f11;})[_0x9ca4('0x26')](respondWithFilteredResult(_0x45b891,_0x5a2895))[_0x9ca4('0x44')](handleError(_0x45b891,null));};exports[_0x9ca4('0x45')]=function(_0x1c3fee,_0x22bb64){var _0x1408e3={'raw':!![],'where':{'id':_0x1c3fee[_0x9ca4('0x46')]['id']}},_0x8b1594={};_0x8b1594[_0x9ca4('0x30')]=_[_0x9ca4('0x31')](db[_0x9ca4('0x2c')][_0x9ca4('0x2d')]);_0x8b1594[_0x9ca4('0x32')]=_['keys'](_0x1c3fee[_0x9ca4('0x32')]);_0x8b1594[_0x9ca4('0x39')]=_[_0x9ca4('0x47')](_0x8b1594[_0x9ca4('0x30')],_0x8b1594[_0x9ca4('0x32')]);_0x1408e3[_0x9ca4('0x33')]=_[_0x9ca4('0x47')](_0x8b1594[_0x9ca4('0x30')],qs['fields'](_0x1c3fee[_0x9ca4('0x32')][_0x9ca4('0x34')]));_0x1408e3['attributes']=_0x1408e3['attributes']['length']?_0x1408e3[_0x9ca4('0x33')]:_0x8b1594[_0x9ca4('0x30')];if(_0x1c3fee[_0x9ca4('0x32')][_0x9ca4('0x40')]){_0x1408e3[_0x9ca4('0x41')]=[{'all':!![]}];}_0x1408e3=_['merge']({},_0x1408e3,_0x1c3fee[_0x9ca4('0x3f')]);return db[_0x9ca4('0x2c')][_0x9ca4('0x48')](_0x1408e3)[_0x9ca4('0x26')](handleEntityNotFound(_0x22bb64,null))['then'](respondWithResult(_0x22bb64,null))[_0x9ca4('0x44')](handleError(_0x22bb64,null));};exports[_0x9ca4('0x49')]=function(_0x1096e7,_0x250eb5){return db[_0x9ca4('0x2c')][_0x9ca4('0x49')](_0x1096e7[_0x9ca4('0x4a')],{})[_0x9ca4('0x26')](respondWithResult(_0x250eb5,0xc9))[_0x9ca4('0x44')](handleError(_0x250eb5,null));};exports[_0x9ca4('0x25')]=function(_0x893419,_0x5ca119){if(_0x893419[_0x9ca4('0x4a')]['id']){delete _0x893419['body']['id'];}return db[_0x9ca4('0x2c')][_0x9ca4('0x48')]({'where':{'id':_0x893419[_0x9ca4('0x46')]['id']}})[_0x9ca4('0x26')](handleEntityNotFound(_0x5ca119,null))[_0x9ca4('0x26')](saveUpdates(_0x893419[_0x9ca4('0x4a')],null))[_0x9ca4('0x26')](respondWithResult(_0x5ca119,null))[_0x9ca4('0x44')](handleError(_0x5ca119,null));};exports[_0x9ca4('0x4b')]=function(_0x4f515b,_0x52732e){return db[_0x9ca4('0x2c')][_0x9ca4('0x48')]({'where':{'id':_0x4f515b[_0x9ca4('0x46')]['id']}})[_0x9ca4('0x26')](handleEntityNotFound(_0x52732e,null))[_0x9ca4('0x26')](removeEntity(_0x52732e,null))[_0x9ca4('0x44')](handleError(_0x52732e,null));};exports[_0x9ca4('0x4c')]=function(_0x354210,_0x5ee925){return db[_0x9ca4('0x2c')][_0x9ca4('0x4c')]()[_0x9ca4('0x26')](respondWithResult(_0x5ee925,null))['catch'](handleError(_0x5ee925,null));};exports['getQuestions']=function(_0x27a824,_0x5672d7,_0x10dda7){var _0xf6fd28={'raw':!![],'where':{}};var _0x16ff61={};var _0xe9b58d={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x27a824[_0x9ca4('0x46')]['id']}})[_0x9ca4('0x26')](handleEntityNotFound(_0x5672d7,null))['then'](function(_0x299032){if(_0x299032){_0x16ff61[_0x9ca4('0x30')]=_[_0x9ca4('0x31')](db[_0x9ca4('0x4d')][_0x9ca4('0x2d')]);_0x16ff61['query']=_['keys'](_0x27a824[_0x9ca4('0x32')]);_0x16ff61[_0x9ca4('0x39')]=_['intersection'](_0x16ff61[_0x9ca4('0x30')],_0x16ff61['query']);_0xf6fd28['attributes']=_['intersection'](_0x16ff61[_0x9ca4('0x30')],qs[_0x9ca4('0x34')](_0x27a824[_0x9ca4('0x32')]['fields']));_0xf6fd28['attributes']=_0xf6fd28[_0x9ca4('0x33')][_0x9ca4('0x4e')]?_0xf6fd28[_0x9ca4('0x33')]:_0x16ff61[_0x9ca4('0x30')];if(!_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x35')](_0x9ca4('0x36'))){_0xf6fd28[_0x9ca4('0x1e')]=qs[_0x9ca4('0x1e')](_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x1e')]);_0xf6fd28[_0x9ca4('0x1c')]=qs[_0x9ca4('0x1c')](_0x27a824['query']['offset']);}_0xf6fd28[_0x9ca4('0x4f')]=qs[_0x9ca4('0x37')](_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x37')]);_0xf6fd28[_0x9ca4('0x3c')]=qs['filters'](_[_0x9ca4('0x38')](_0x27a824[_0x9ca4('0x32')],_0x16ff61[_0x9ca4('0x39')]));_0xf6fd28[_0x9ca4('0x3c')]['SessionId']=_0x299032['id'];if(_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x3a')]){_0xf6fd28['where']=_[_0x9ca4('0x3b')](_0xf6fd28[_0x9ca4('0x3c')],{'$or':_[_0x9ca4('0x2b')](_0xf6fd28['attributes'],function(_0x2c607d){var _0x589713={};_0x589713[_0x2c607d]={'$like':'%'+_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x3a')]+'%'};return _0x589713;})});}_0xf6fd28=_['merge']({},_0xf6fd28,_0x27a824['options']);return db[_0x9ca4('0x4d')][_0x9ca4('0x1f')]({'where':_0xf6fd28[_0x9ca4('0x3c')]})[_0x9ca4('0x26')](function(_0x4769a1){_0xe9b58d[_0x9ca4('0x1f')]=_0x4769a1;if(_0x27a824[_0x9ca4('0x32')][_0x9ca4('0x40')]){_0xf6fd28[_0x9ca4('0x41')]=[{'all':!![]}];}return db[_0x9ca4('0x4d')][_0x9ca4('0x42')](_0xf6fd28);})[_0x9ca4('0x26')](function(_0x8b5ee6){_0xe9b58d[_0x9ca4('0x43')]=_0x8b5ee6;return _0xe9b58d;});}})[_0x9ca4('0x26')](respondWithFilteredResult(_0x5672d7,_0xf6fd28))[_0x9ca4('0x44')](handleError(_0x5672d7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 97a7318..1a9923d 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 _0xa630=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x3a4822,_0x4f0c42){_0x3a4822=_0x3a4822-0x0;var _0x5cc458=_0xa630[_0x3a4822];return _0x5cc458;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xafc4,0x69));var _0x4afc=function(_0xdef206,_0x485b8b){_0xdef206=_0xdef206-0x0;var _0x5da631=_0xafc4[_0xdef206];return _0x5da631;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4eae10d..9dc8a3a 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x22e312,_0x26fb2b){var _0x3d718f=function(_0x414baf){while(--_0x414baf){_0x22e312['push'](_0x22e312['shift']());}};_0x3d718f(++_0x26fb2b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d1135,_0x4a9b27){var _0x4b5ce9=function(_0xc74fd2){while(--_0xc74fd2){_0x5d1135['push'](_0x5d1135['shift']());}};_0x4b5ce9(++_0x4a9b27);}(_0x90b1,0x1bb));var _0x190b=function(_0x1fee29,_0x1aa1b5){_0x1fee29=_0x1fee29-0x0;var _0x2d2c2b=_0x90b1[_0x1fee29];return _0x2d2c2b;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 87a4078..6443d77 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 _0x2e7d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x3c99f1,_0x39fe9b){var _0x3f154d=function(_0x3f2e7c){while(--_0x3f2e7c){_0x3c99f1['push'](_0x3c99f1['shift']());}};_0x3f154d(++_0x39fe9b);}(_0x2e7d,0x182));var _0xd2e7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x2e7d[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xd2e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd2e7('0x1'));var express=require(_0xd2e7('0x2'));var router=express[_0xd2e7('0x3')]();var fs_extra=require(_0xd2e7('0x4'));var auth=require(_0xd2e7('0x5'));var interaction=require(_0xd2e7('0x6'));var config=require(_0xd2e7('0x7'));var controller=require(_0xd2e7('0x8'));router[_0xd2e7('0x9')]('/',controller['index']);router[_0xd2e7('0xa')](_0xd2e7('0xb'),auth[_0xd2e7('0xc')](),controller[_0xd2e7('0xd')]);router['get'](_0xd2e7('0xe'),auth[_0xd2e7('0xc')](),controller[_0xd2e7('0xf')]);module[_0xd2e7('0x10')]=router; \ No newline at end of file +var _0x17f6=['/download_log_file','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','isAuthenticated','update'];(function(_0x335a77,_0x2e5607){var _0x504384=function(_0xc1491a){while(--_0xc1491a){_0x335a77['push'](_0x335a77['shift']());}};_0x504384(++_0x2e5607);}(_0x17f6,0x1b4));var _0x617f=function(_0x5c731e,_0x22113f){_0x5c731e=_0x5c731e-0x0;var _0x30c565=_0x17f6[_0x5c731e];return _0x30c565;};'use strict';var multer=require('multer');var util=require(_0x617f('0x0'));var path=require('path');var timeout=require(_0x617f('0x1'));var express=require(_0x617f('0x2'));var router=express[_0x617f('0x3')]();var fs_extra=require(_0x617f('0x4'));var auth=require(_0x617f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x617f('0x6'));var controller=require(_0x617f('0x7'));router[_0x617f('0x8')]('/',controller[_0x617f('0x9')]);router['put']('/:id',auth[_0x617f('0xa')](),controller[_0x617f('0xb')]);router[_0x617f('0x8')](_0x617f('0xc'),auth[_0x617f('0xa')](),controller['downloadLogFile']);module[_0x617f('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8845a99..b161c48 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 _0xb7fd=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x550a7f,_0x1e53fb){var _0xab0a27=function(_0x3e63e1){while(--_0x3e63e1){_0x550a7f['push'](_0x550a7f['shift']());}};_0xab0a27(++_0x1e53fb);}(_0xb7fd,0x171));var _0xdb7f=function(_0x1e5c22,_0x246a05){_0x1e5c22=_0x1e5c22-0x0;var _0x1dd9a0=_0xb7fd[_0x1e5c22];return _0x1dd9a0;};'use strict';var Sequelize=require(_0xdb7f('0x0'));module[_0xdb7f('0x1')]={'license':{'type':Sequelize[_0xdb7f('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xdb7f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xdb7f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f7b=['exports','TEXT','STRING','sequelize'];(function(_0x2f124a,_0x39cb5e){var _0x1e7142=function(_0x1f71b9){while(--_0x1f71b9){_0x2f124a['push'](_0x2f124a['shift']());}};_0x1e7142(++_0x39cb5e);}(_0x7f7b,0x18f));var _0xb7f7=function(_0x419f2,_0x27db6b){_0x419f2=_0x419f2-0x0;var _0x246685=_0x7f7b[_0x419f2];return _0x246685;};'use strict';var Sequelize=require(_0xb7f7('0x0'));module[_0xb7f7('0x1')]={'license':{'type':Sequelize[_0xb7f7('0x2')]},'data1':{'type':Sequelize[_0xb7f7('0x3')]},'data2':{'type':Sequelize[_0xb7f7('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a3a1578..a888ca7 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 _0x31b0=['status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','License','query','intersection','attributes','fields','merge','options','getLicense','catch','body','params','get','key','downloadLogFile','license-info.log','/var','setHeader','Content-disposition','attachment;\x20filename=','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x8e6c92,_0x58f473){var _0x3668d8=function(_0x38869b){while(--_0x38869b){_0x8e6c92['push'](_0x8e6c92['shift']());}};_0x3668d8(++_0x58f473);}(_0x31b0,0x12b));var _0x031b=function(_0xf05781,_0x52338e){_0xf05781=_0xf05781-0x0;var _0x9788b4=_0x31b0[_0xf05781];return _0x9788b4;};'use strict';var emlformat=require(_0x031b('0x0'));var rimraf=require(_0x031b('0x1'));var zipdir=require(_0x031b('0x2'));var jsonpatch=require(_0x031b('0x3'));var rp=require(_0x031b('0x4'));var moment=require(_0x031b('0x5'));var BPromise=require(_0x031b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x031b('0x7'));var csv=require(_0x031b('0x8'));var ejs=require(_0x031b('0x9'));var fs=require('fs');var fs_extra=require(_0x031b('0xa'));var _=require(_0x031b('0xb'));var squel=require(_0x031b('0xc'));var crypto=require(_0x031b('0xd'));var jsforce=require(_0x031b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x031b('0xf'));var Papa=require(_0x031b('0x10'));var Redis=require('ioredis');var authService=require(_0x031b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x031b('0x12'));var hardwareService=require(_0x031b('0x13'));var logger=require('../../config/logger')(_0x031b('0x14'));var utils=require(_0x031b('0x15'));var config=require(_0x031b('0x16'));var licenseUtil=require(_0x031b('0x17'));var db=require(_0x031b('0x18'))['db'];function respondWithStatusCode(_0x5a708f,_0x4d93b0){_0x4d93b0=_0x4d93b0||0xcc;return function(_0x2ae93e){if(_0x2ae93e){return _0x5a708f[_0x031b('0x19')](_0x4d93b0);}return _0x5a708f[_0x031b('0x1a')](_0x4d93b0)[_0x031b('0x1b')]();};}function respondWithResult(_0x2297f2,_0x27a343){_0x27a343=_0x27a343||0xc8;return function(_0x502688){if(_0x502688){return _0x2297f2[_0x031b('0x1a')](_0x27a343)[_0x031b('0x1c')](_0x502688);}};}function respondWithFilteredResult(_0x5a9682,_0x13ffcd){return function(_0x22aa96){if(_0x22aa96){var _0xf5cc27=typeof _0x13ffcd[_0x031b('0x1d')]==='undefined'&&typeof _0x13ffcd[_0x031b('0x1e')]==='undefined';var _0x90f7fb=_0x22aa96[_0x031b('0x1f')];var _0x5af88c=_0xf5cc27?0x0:_0x13ffcd[_0x031b('0x1d')];var _0x5a5430=_0xf5cc27?_0x22aa96['count']:_0x13ffcd['offset']+_0x13ffcd[_0x031b('0x1e')];var _0xce4780;if(_0x5a5430>=_0x90f7fb){_0x5a5430=_0x90f7fb;_0xce4780=0xc8;}else{_0xce4780=0xce;}_0x5a9682[_0x031b('0x1a')](_0xce4780);return _0x5a9682['set'](_0x031b('0x20'),_0x5af88c+'-'+_0x5a5430+'/'+_0x90f7fb)[_0x031b('0x1c')](_0x22aa96);}return null;};}function patchUpdates(_0x253cbb){return function(_0x25c1f0){try{jsonpatch[_0x031b('0x21')](_0x25c1f0,_0x253cbb,!![]);}catch(_0x518241){return BPromise[_0x031b('0x22')](_0x518241);}return _0x25c1f0[_0x031b('0x23')]();};}function saveUpdates(_0x27a9eb,_0x63d717){return function(_0x4e3451){if(_0x4e3451){return _0x4e3451['update'](_0x27a9eb)[_0x031b('0x24')](function(_0x33e6c4){return _0x33e6c4;});}return null;};}function removeEntity(_0x132551,_0xb3eb8c){return function(_0x1ac1d6){if(_0x1ac1d6){return _0x1ac1d6[_0x031b('0x25')]()[_0x031b('0x24')](function(){_0x132551[_0x031b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d09cc,_0x56e695){return function(_0x3fe1c4){if(!_0x3fe1c4){_0x9d09cc[_0x031b('0x19')](0x194);}return _0x3fe1c4;};}function handleError(_0x1feaeb,_0x6b66fc){_0x6b66fc=_0x6b66fc||0x1f4;return function(_0x26610b){logger[_0x031b('0x26')](_0x26610b[_0x031b('0x27')]);if(_0x26610b[_0x031b('0x28')]){delete _0x26610b['name'];}_0x1feaeb['status'](_0x6b66fc)[_0x031b('0x29')](_0x26610b);};}var utilLicense=require('../../config/license/util');exports[_0x031b('0x2a')]=function(_0x2a9986,_0x4f4043){var _0x506577={'raw':!![],'where':{'id':0x1}},_0x14b19d={};_0x14b19d[_0x031b('0x2b')]=_[_0x031b('0x2c')](db[_0x031b('0x2d')]['rawAttributes']);_0x14b19d[_0x031b('0x2e')]=_[_0x031b('0x2c')](_0x2a9986[_0x031b('0x2e')]);_0x14b19d['filters']=_[_0x031b('0x2f')](_0x14b19d[_0x031b('0x2b')],_0x14b19d[_0x031b('0x2e')]);_0x506577[_0x031b('0x30')]=_[_0x031b('0x2f')](_0x14b19d[_0x031b('0x2b')],qs[_0x031b('0x31')](_0x2a9986[_0x031b('0x2e')][_0x031b('0x31')]));_0x506577[_0x031b('0x30')]=_0x506577[_0x031b('0x30')]['length']?_0x506577[_0x031b('0x30')]:_0x14b19d[_0x031b('0x2b')];_0x506577=_[_0x031b('0x32')]({},_0x506577,_0x2a9986[_0x031b('0x33')]);return utilLicense[_0x031b('0x34')](_0x506577)[_0x031b('0x24')](respondWithResult(_0x4f4043,null))[_0x031b('0x35')](handleError(_0x4f4043,null));};exports['update']=function(_0x2bc3da,_0x29cf91){if(_0x2bc3da[_0x031b('0x36')]['id']){delete _0x2bc3da['body']['id'];}return db[_0x031b('0x2d')]['find']({'where':{'id':_0x2bc3da[_0x031b('0x37')]['id']}})['then'](handleEntityNotFound(_0x29cf91,null))[_0x031b('0x24')](function(_0xfdb2cd){var _0x2f07d2=_0xfdb2cd[_0x031b('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x2f07d2,_0x2bc3da[_0x031b('0x36')][_0x031b('0x39')]);})[_0x031b('0x24')](function(_0x9f483c){if(!_0x9f483c['demo']){return saveUpdates(_0x2bc3da[_0x031b('0x36')],null);}return _0x9f483c;})[_0x031b('0x24')](respondWithResult(_0x29cf91,null))['catch'](handleError(_0x29cf91,null));};exports[_0x031b('0x3a')]=function(_0x10b36d,_0x511342){var _0x5b7cfc=_0x031b('0x3b');var _0x14ba47=path['join'](_0x031b('0x3c'),'log','xcally',_0x5b7cfc);_0x511342[_0x031b('0x3d')](_0x031b('0x3e'),_0x031b('0x3f')+_0x5b7cfc);_0x511342[_0x031b('0x40')]('Content-Type','text/plain');_0x511342['download'](_0x14ba47);}; \ No newline at end of file +var _0x25ab=['log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','sendStatus','error','name','send','keys','rawAttributes','query','intersection','model','attributes','fields','length','merge','options','then','catch','body','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var'];(function(_0x381976,_0x57180b){var _0x7db79f=function(_0x1e4c9c){while(--_0x1e4c9c){_0x381976['push'](_0x381976['shift']());}};_0x7db79f(++_0x57180b);}(_0x25ab,0xe7));var _0xb25a=function(_0x4e5d81,_0x31b629){_0x4e5d81=_0x4e5d81-0x0;var _0x49b38b=_0x25ab[_0x4e5d81];return _0x49b38b;};'use strict';var emlformat=require(_0xb25a('0x0'));var rimraf=require(_0xb25a('0x1'));var zipdir=require(_0xb25a('0x2'));var jsonpatch=require(_0xb25a('0x3'));var rp=require(_0xb25a('0x4'));var moment=require(_0xb25a('0x5'));var BPromise=require(_0xb25a('0x6'));var Mustache=require(_0xb25a('0x7'));var util=require(_0xb25a('0x8'));var path=require(_0xb25a('0x9'));var sox=require(_0xb25a('0xa'));var csv=require(_0xb25a('0xb'));var ejs=require(_0xb25a('0xc'));var fs=require('fs');var fs_extra=require(_0xb25a('0xd'));var _=require(_0xb25a('0xe'));var squel=require(_0xb25a('0xf'));var crypto=require(_0xb25a('0x10'));var jsforce=require(_0xb25a('0x11'));var deskjs=require(_0xb25a('0x12'));var toCsv=require(_0xb25a('0xb'));var querystring=require(_0xb25a('0x13'));var Papa=require(_0xb25a('0x14'));var Redis=require(_0xb25a('0x15'));var authService=require(_0xb25a('0x16'));var qs=require(_0xb25a('0x17'));var as=require(_0xb25a('0x18'));var hardwareService=require(_0xb25a('0x19'));var logger=require('../../config/logger')(_0xb25a('0x1a'));var utils=require(_0xb25a('0x1b'));var config=require(_0xb25a('0x1c'));var licenseUtil=require(_0xb25a('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b36db,_0x51f00f){_0x51f00f=_0x51f00f||0xcc;return function(_0x562000){if(_0x562000){return _0x4b36db['sendStatus'](_0x51f00f);}return _0x4b36db[_0xb25a('0x1e')](_0x51f00f)[_0xb25a('0x1f')]();};}function respondWithResult(_0x354e13,_0x3f8837){_0x3f8837=_0x3f8837||0xc8;return function(_0x4a3319){if(_0x4a3319){return _0x354e13[_0xb25a('0x1e')](_0x3f8837)[_0xb25a('0x20')](_0x4a3319);}};}function respondWithFilteredResult(_0x43e151,_0x4f1c10){return function(_0xac86c1){if(_0xac86c1){var _0x2e1fec=typeof _0x4f1c10['offset']===_0xb25a('0x21')&&typeof _0x4f1c10[_0xb25a('0x22')]===_0xb25a('0x21');var _0xd880de=_0xac86c1[_0xb25a('0x23')];var _0x208159=_0x2e1fec?0x0:_0x4f1c10[_0xb25a('0x24')];var _0x33b7da=_0x2e1fec?_0xac86c1[_0xb25a('0x23')]:_0x4f1c10[_0xb25a('0x24')]+_0x4f1c10[_0xb25a('0x22')];var _0x569281;if(_0x33b7da>=_0xd880de){_0x33b7da=_0xd880de;_0x569281=0xc8;}else{_0x569281=0xce;}_0x43e151[_0xb25a('0x1e')](_0x569281);return _0x43e151[_0xb25a('0x25')]('Content-Range',_0x208159+'-'+_0x33b7da+'/'+_0xd880de)[_0xb25a('0x20')](_0xac86c1);}return null;};}function patchUpdates(_0x586317){return function(_0x22de33){try{jsonpatch[_0xb25a('0x26')](_0x22de33,_0x586317,!![]);}catch(_0x55f259){return BPromise['reject'](_0x55f259);}return _0x22de33[_0xb25a('0x27')]();};}function saveUpdates(_0x37de98,_0x647640){return function(_0x3a3ed2){if(_0x3a3ed2){return _0x3a3ed2[_0xb25a('0x28')](_0x37de98)['then'](function(_0x5d6530){return _0x5d6530;});}return null;};}function removeEntity(_0x491ac0,_0x1cf6dd){return function(_0xa103e1){if(_0xa103e1){return _0xa103e1[_0xb25a('0x29')]()['then'](function(){_0x491ac0[_0xb25a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83da8e,_0x4c996f){return function(_0x5e17b2){if(!_0x5e17b2){_0x83da8e[_0xb25a('0x2a')](0x194);}return _0x5e17b2;};}function handleError(_0x54e94d,_0x37dbfc){_0x37dbfc=_0x37dbfc||0x1f4;return function(_0x3ee486){logger[_0xb25a('0x2b')](_0x3ee486['stack']);if(_0x3ee486[_0xb25a('0x2c')]){delete _0x3ee486[_0xb25a('0x2c')];}_0x54e94d[_0xb25a('0x1e')](_0x37dbfc)[_0xb25a('0x2d')](_0x3ee486);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4b0bbf,_0x1f4298){var _0x1ca885={'raw':!![],'where':{'id':0x1}},_0x1bc7a4={};_0x1bc7a4['model']=_[_0xb25a('0x2e')](db['License'][_0xb25a('0x2f')]);_0x1bc7a4[_0xb25a('0x30')]=_[_0xb25a('0x2e')](_0x4b0bbf[_0xb25a('0x30')]);_0x1bc7a4['filters']=_[_0xb25a('0x31')](_0x1bc7a4[_0xb25a('0x32')],_0x1bc7a4[_0xb25a('0x30')]);_0x1ca885[_0xb25a('0x33')]=_[_0xb25a('0x31')](_0x1bc7a4[_0xb25a('0x32')],qs[_0xb25a('0x34')](_0x4b0bbf[_0xb25a('0x30')][_0xb25a('0x34')]));_0x1ca885['attributes']=_0x1ca885[_0xb25a('0x33')][_0xb25a('0x35')]?_0x1ca885['attributes']:_0x1bc7a4['model'];_0x1ca885=_[_0xb25a('0x36')]({},_0x1ca885,_0x4b0bbf[_0xb25a('0x37')]);return utilLicense['getLicense'](_0x1ca885)[_0xb25a('0x38')](respondWithResult(_0x1f4298,null))[_0xb25a('0x39')](handleError(_0x1f4298,null));};exports['update']=function(_0x1c2c41,_0x4a60be){if(_0x1c2c41['body']['id']){delete _0x1c2c41[_0xb25a('0x3a')]['id'];}return db['License'][_0xb25a('0x3b')]({'where':{'id':_0x1c2c41[_0xb25a('0x3c')]['id']}})[_0xb25a('0x38')](handleEntityNotFound(_0x4a60be,null))[_0xb25a('0x38')](function(_0x4a40f9){var _0x29f0e2=_0x4a40f9[_0xb25a('0x3d')]({'plain':!![]});return utilLicense[_0xb25a('0x3e')](_0x29f0e2,_0x1c2c41[_0xb25a('0x3a')][_0xb25a('0x3f')]);})[_0xb25a('0x38')](function(_0x33f159){if(!_0x33f159[_0xb25a('0x40')]){return saveUpdates(_0x1c2c41[_0xb25a('0x3a')],null);}return _0x33f159;})['then'](respondWithResult(_0x4a60be,null))[_0xb25a('0x39')](handleError(_0x4a60be,null));};exports[_0xb25a('0x41')]=function(_0x54b4ed,_0x249775){var _0x139019=_0xb25a('0x42');var _0x2fc7da=path[_0xb25a('0x43')](_0xb25a('0x44'),_0xb25a('0x45'),_0xb25a('0x46'),_0x139019);_0x249775[_0xb25a('0x47')](_0xb25a('0x48'),_0xb25a('0x49')+_0x139019);_0x249775[_0xb25a('0x25')]('Content-Type',_0xb25a('0x4a'));_0x249775['download'](_0x2fc7da);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7bed41d..b9ff70e 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 _0xea5e=['License','license','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x45b190,_0x6297da){var _0x46234d=function(_0x41f5ad){while(--_0x41f5ad){_0x45b190['push'](_0x45b190['shift']());}};_0x46234d(++_0x6297da);}(_0xea5e,0x1e2));var _0xeea5=function(_0x9cff0e,_0x4cbcee){_0x9cff0e=_0x9cff0e-0x0;var _0x3fb20c=_0xea5e[_0x9cff0e];return _0x3fb20c;};'use strict';var _=require(_0xeea5('0x0'));var util=require('util');var logger=require(_0xeea5('0x1'))(_0xeea5('0x2'));var moment=require('moment');var BPromise=require(_0xeea5('0x3'));var rp=require(_0xeea5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeea5('0x5'));var config=require(_0xeea5('0x6'));var attributes=require(_0xeea5('0x7'));module[_0xeea5('0x8')]=function(_0x4c467c,_0x390190){return _0x4c467c[_0xeea5('0x9')](_0xeea5('0xa'),attributes,{'tableName':_0xeea5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ec=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','License','lodash','util'];(function(_0x5361ce,_0x3351d4){var _0x3ffcc4=function(_0x1b5c92){while(--_0x1b5c92){_0x5361ce['push'](_0x5361ce['shift']());}};_0x3ffcc4(++_0x3351d4);}(_0x71ec,0xbe));var _0xc71e=function(_0x51227e,_0x21f277){_0x51227e=_0x51227e-0x0;var _0x457194=_0x71ec[_0x51227e];return _0x457194;};'use strict';var _=require(_0xc71e('0x0'));var util=require(_0xc71e('0x1'));var logger=require(_0xc71e('0x2'))(_0xc71e('0x3'));var moment=require(_0xc71e('0x4'));var BPromise=require(_0xc71e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc71e('0x6'));var rimraf=require(_0xc71e('0x7'));var config=require(_0xc71e('0x8'));var attributes=require(_0xc71e('0x9'));module[_0xc71e('0xa')]=function(_0x58910b,_0x244b9d){return _0x58910b['define'](_0xc71e('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 567dc2b..a902f28 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 _0x3f51=['catch','lodash','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2fff85,_0x16a461){var _0x31aef0=function(_0x4ca281){while(--_0x4ca281){_0x2fff85['push'](_0x2fff85['shift']());}};_0x31aef0(++_0x16a461);}(_0x3f51,0x79));var _0x13f5=function(_0x147e24,_0x278a93){_0x147e24=_0x147e24-0x0;var _0x5372f8=_0x3f51[_0x147e24];return _0x5372f8;};'use strict';var _=require(_0x13f5('0x0'));var util=require('util');var moment=require(_0x13f5('0x1'));var BPromise=require(_0x13f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13f5('0x3'))('rpc');var config=require(_0x13f5('0x4'));var jayson=require(_0x13f5('0x5'));var client=jayson[_0x13f5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68e8cc,_0x12cbbc,_0x4fa8cb){return new BPromise(function(_0x381e65,_0x2de338){return client[_0x13f5('0x7')](_0x68e8cc,_0x4fa8cb)[_0x13f5('0x8')](function(_0x5aa307){logger[_0x13f5('0x9')](_0x13f5('0xa'),_0x12cbbc,'request\x20sent');logger[_0x13f5('0xb')](_0x13f5('0xc'),_0x12cbbc,_0x13f5('0xd'),JSON[_0x13f5('0xe')](_0x5aa307));if(_0x5aa307[_0x13f5('0xf')]){if(_0x5aa307[_0x13f5('0xf')][_0x13f5('0x10')]===0x1f4){logger[_0x13f5('0xf')](_0x13f5('0xa'),_0x12cbbc,_0x5aa307[_0x13f5('0xf')][_0x13f5('0x11')]);return _0x2de338(_0x5aa307[_0x13f5('0xf')][_0x13f5('0x11')]);}logger['error'](_0x13f5('0xa'),_0x12cbbc,_0x5aa307[_0x13f5('0xf')][_0x13f5('0x11')]);return _0x381e65(_0x5aa307[_0x13f5('0xf')]['message']);}else{logger[_0x13f5('0x9')](_0x13f5('0xa'),_0x12cbbc,_0x13f5('0xd'));_0x381e65(_0x5aa307[_0x13f5('0x12')][_0x13f5('0x11')]);}})[_0x13f5('0x13')](function(_0x39ea1e){logger[_0x13f5('0xf')](_0x13f5('0xa'),_0x12cbbc,_0x39ea1e);_0x2de338(_0x39ea1e);});});} \ No newline at end of file +var _0x394b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5cc0e8,_0x5c68dd){var _0x5a81f8=function(_0x374bd1){while(--_0x374bd1){_0x5cc0e8['push'](_0x5cc0e8['shift']());}};_0x5a81f8(++_0x5c68dd);}(_0x394b,0xc1));var _0xb394=function(_0x5ea12c,_0x58685d){_0x5ea12c=_0x5ea12c-0x0;var _0x4e3711=_0x394b[_0x5ea12c];return _0x4e3711;};'use strict';var _=require(_0xb394('0x0'));var util=require(_0xb394('0x1'));var moment=require(_0xb394('0x2'));var BPromise=require(_0xb394('0x3'));var rs=require(_0xb394('0x4'));var fs=require('fs');var Redis=require(_0xb394('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb394('0x6'));var logger=require('../../config/logger')(_0xb394('0x7'));var config=require(_0xb394('0x8'));var jayson=require(_0xb394('0x9'));var client=jayson[_0xb394('0xa')][_0xb394('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45503a,_0x52de75,_0x38c970){return new BPromise(function(_0x534bb3,_0x5b3c7f){return client[_0xb394('0xc')](_0x45503a,_0x38c970)[_0xb394('0xd')](function(_0x4f2563){logger[_0xb394('0xe')](_0xb394('0xf'),_0x52de75,_0xb394('0x10'));logger[_0xb394('0x11')](_0xb394('0x12'),_0x52de75,_0xb394('0x10'),JSON[_0xb394('0x13')](_0x4f2563));if(_0x4f2563[_0xb394('0x14')]){if(_0x4f2563['error'][_0xb394('0x15')]===0x1f4){logger[_0xb394('0x14')]('License,\x20%s,\x20%s',_0x52de75,_0x4f2563[_0xb394('0x14')][_0xb394('0x16')]);return _0x5b3c7f(_0x4f2563[_0xb394('0x14')][_0xb394('0x16')]);}logger[_0xb394('0x14')](_0xb394('0xf'),_0x52de75,_0x4f2563[_0xb394('0x14')][_0xb394('0x16')]);return _0x534bb3(_0x4f2563[_0xb394('0x14')][_0xb394('0x16')]);}else{logger[_0xb394('0xe')](_0xb394('0xf'),_0x52de75,_0xb394('0x10'));_0x534bb3(_0x4f2563[_0xb394('0x17')]['message']);}})[_0xb394('0x18')](function(_0x3760ad){logger[_0xb394('0x14')](_0xb394('0xf'),_0x52de75,_0x3760ad);_0x5b3c7f(_0x3760ad);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8d83c38..abecc23 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 _0x438f=['Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','send','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','util','connect-timeout'];(function(_0x4e7b37,_0x33b1fa){var _0x20b707=function(_0x1fb9ff){while(--_0x1fb9ff){_0x4e7b37['push'](_0x4e7b37['shift']());}};_0x20b707(++_0x33b1fa);}(_0x438f,0x79));var _0xf438=function(_0x2faa78,_0x4da4ee){_0x2faa78=_0x2faa78-0x0;var _0x4bc9df=_0x438f[_0x2faa78];return _0x4bc9df;};'use strict';var multer=require('multer');var util=require(_0xf438('0x0'));var path=require('path');var timeout=require(_0xf438('0x1'));var express=require('express');var router=express[_0xf438('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf438('0x3'));var interaction=require(_0xf438('0x4'));var config=require('../../config/environment');var controller=require(_0xf438('0x5'));router[_0xf438('0x6')]('/',auth['isAuthenticated'](),controller[_0xf438('0x7')]);router[_0xf438('0x6')](_0xf438('0x8'),auth[_0xf438('0x9')](),controller['describe']);router[_0xf438('0x6')](_0xf438('0xa'),auth[_0xf438('0x9')](),controller[_0xf438('0xb')]);router[_0xf438('0x6')](_0xf438('0xc'),auth['isAuthenticated'](),controller[_0xf438('0xd')]);router[_0xf438('0x6')]('/:id/canned_answers',auth[_0xf438('0x9')](),controller[_0xf438('0xe')]);router[_0xf438('0x6')](_0xf438('0xf'),auth[_0xf438('0x9')](),controller[_0xf438('0x10')]);router[_0xf438('0x6')](_0xf438('0x11'),auth[_0xf438('0x9')](),controller[_0xf438('0x12')]);router[_0xf438('0x6')](_0xf438('0x13'),auth['isAuthenticated'](),controller[_0xf438('0x14')]);router['get'](_0xf438('0x15'),auth[_0xf438('0x9')](),controller[_0xf438('0x16')]);router[_0xf438('0x6')]('/:id/messages',auth[_0xf438('0x9')](),controller['getMessages']);router[_0xf438('0x6')](_0xf438('0x17'),auth['isAuthenticated'](),controller[_0xf438('0x18')]);router[_0xf438('0x6')](_0xf438('0x19'),auth[_0xf438('0x9')](),controller[_0xf438('0x1a')]);router[_0xf438('0x1b')]('/:id/dispositions',auth[_0xf438('0x9')](),controller['addDisposition']);router[_0xf438('0x1b')](_0xf438('0x1c'),auth[_0xf438('0x9')](),controller[_0xf438('0x1d')]);router['post']('/',auth[_0xf438('0x9')](),controller[_0xf438('0x1e')]);router[_0xf438('0x1b')]('/:id/in_servers',auth[_0xf438('0x9')](),controller[_0xf438('0x1f')]);router['post']('/:id/out_servers',auth[_0xf438('0x9')](),controller[_0xf438('0x20')]);router['post'](_0xf438('0x13'),auth[_0xf438('0x9')](),controller[_0xf438('0x21')]);router[_0xf438('0x1b')](_0xf438('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/send',auth[_0xf438('0x9')](),controller[_0xf438('0x22')]);router[_0xf438('0x1b')](_0xf438('0x19'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xf438('0xa'),auth[_0xf438('0x9')](),controller[_0xf438('0x23')]);router[_0xf438('0x24')](_0xf438('0xc'),auth['isAuthenticated'](),controller[_0xf438('0x25')]);router[_0xf438('0x24')](_0xf438('0x1c'),auth[_0xf438('0x9')](),controller[_0xf438('0x26')]);router[_0xf438('0x24')](_0xf438('0xf'),auth[_0xf438('0x9')](),controller[_0xf438('0x27')]);router[_0xf438('0x24')](_0xf438('0x11'),auth[_0xf438('0x9')](),controller['removeSmtp']);router[_0xf438('0x24')](_0xf438('0xa'),auth[_0xf438('0x9')](),controller['destroy']);router[_0xf438('0x24')](_0xf438('0x19'),auth['isAuthenticated'](),controller[_0xf438('0x28')]);module['exports']=router; \ No newline at end of file +var _0x5adb=['../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addAnswer','post','/:id/in_servers','addApplications','/:id/send','send','addAgents','/:id','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x5adb,0x118));var _0xb5ad=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x5adb[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0xb5ad('0x0'));var util=require(_0xb5ad('0x1'));var path=require(_0xb5ad('0x2'));var timeout=require(_0xb5ad('0x3'));var express=require(_0xb5ad('0x4'));var router=express[_0xb5ad('0x5')]();var fs_extra=require(_0xb5ad('0x6'));var auth=require(_0xb5ad('0x7'));var interaction=require(_0xb5ad('0x8'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0xb5ad('0x9')](),controller['index']);router[_0xb5ad('0xa')](_0xb5ad('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb5ad('0xa')]('/:id',auth[_0xb5ad('0x9')](),controller[_0xb5ad('0xc')]);router[_0xb5ad('0xa')](_0xb5ad('0xd'),auth[_0xb5ad('0x9')](),controller['getDispositions']);router[_0xb5ad('0xa')](_0xb5ad('0xe'),auth['isAuthenticated'](),controller[_0xb5ad('0xf')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router['get'](_0xb5ad('0x10'),auth[_0xb5ad('0x9')](),controller['getSmtp']);router[_0xb5ad('0xa')](_0xb5ad('0x11'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x12')]);router[_0xb5ad('0xa')](_0xb5ad('0x13'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x14')]);router[_0xb5ad('0xa')]('/:id/messages',auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x15')]);router[_0xb5ad('0xa')](_0xb5ad('0x16'),auth['isAuthenticated'](),controller[_0xb5ad('0x17')]);router[_0xb5ad('0xa')](_0xb5ad('0x18'),auth['isAuthenticated'](),controller[_0xb5ad('0x19')]);router['post'](_0xb5ad('0xd'),auth[_0xb5ad('0x9')](),controller['addDisposition']);router['post'](_0xb5ad('0xe'),auth['isAuthenticated'](),controller[_0xb5ad('0x1a')]);router[_0xb5ad('0x1b')]('/',auth[_0xb5ad('0x9')](),controller['create']);router[_0xb5ad('0x1b')](_0xb5ad('0x1c'),auth[_0xb5ad('0x9')](),controller['addImap']);router[_0xb5ad('0x1b')](_0xb5ad('0x10'),auth[_0xb5ad('0x9')](),controller['addSmtp']);router['post'](_0xb5ad('0x11'),auth[_0xb5ad('0x9')](),controller['addInteraction']);router[_0xb5ad('0x1b')](_0xb5ad('0x13'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x1d')]);router['post'](_0xb5ad('0x1e'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x1f')]);router[_0xb5ad('0x1b')](_0xb5ad('0x18'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x20')]);router['put'](_0xb5ad('0x21'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x22')]);router[_0xb5ad('0x23')](_0xb5ad('0xd'),auth[_0xb5ad('0x9')](),controller['removeDispositions']);router[_0xb5ad('0x23')](_0xb5ad('0xe'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x24')]);router[_0xb5ad('0x23')](_0xb5ad('0x1c'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x25')]);router['delete']('/:id/out_servers',auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x26')]);router[_0xb5ad('0x23')]('/:id',auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x27')]);router['delete'](_0xb5ad('0x18'),auth[_0xb5ad('0x9')](),controller[_0xb5ad('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f9f9fd3..d3c8e12 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 _0xc9a8=['provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','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','getDataValue'];(function(_0x20a299,_0x55e78f){var _0x57db7b=function(_0x2af6a9){while(--_0x2af6a9){_0x20a299['push'](_0x20a299['shift']());}};_0x57db7b(++_0x55e78f);}(_0xc9a8,0x1d6));var _0x8c9a=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xc9a8[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x8c9a('0x0')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x8c9a('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8c9a('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x8c9a('0x2')]},'markAsUnread':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8c9a('0x0')],'allowNull':![],'defaultValue':_0x8c9a('0x3')},'fontSize':{'type':Sequelize[_0x8c9a('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8c9a('0x5');}},'notificationSound':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c9a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c9a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c9a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8c9a('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x8c9a('0x1')],'defaultValue':![],'comment':_0x8c9a('0x7'),'set':function(_0x243af7){if(!_0x243af7)this[_0x8c9a('0x8')](_0x8c9a('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x243af7);}},'provider':{'type':Sequelize[_0x8c9a('0xa')](_0x8c9a('0xb'),_0x8c9a('0xc'),_0x8c9a('0xd'),_0x8c9a('0xe')),'defaultValue':null,'get':function(){if(!this[_0x8c9a('0xf')](_0x8c9a('0x10')))return _0x8c9a('0x11');return this[_0x8c9a('0xf')](_0x8c9a('0x10'));},'set':function(_0x30027c){if(_0x30027c===_0x8c9a('0x11'))_0x30027c=null;return this[_0x8c9a('0x8')](_0x8c9a('0x10'),_0x30027c);}}}; \ No newline at end of file +var _0x53ac=['provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','setDataValue','ENUM','yahoo','getDataValue'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x53ac,0x18e));var _0xc53a=function(_0x537df7,_0x31f400){_0x537df7=_0x537df7-0x0;var _0x315899=_0x53ac[_0x537df7];return _0x315899;};'use strict';var Sequelize=require(_0xc53a('0x0'));module[_0xc53a('0x1')]={'description':{'type':Sequelize[_0xc53a('0x2')]},'name':{'type':Sequelize[_0xc53a('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc53a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc53a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc53a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc53a('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc53a('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc53a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc53a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc53a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc53a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc53a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc53a('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e6108){if(!_0x1e6108)this[_0xc53a('0x6')]('mandatoryDispositionPauseId',null);this[_0xc53a('0x6')]('mandatoryDisposition',_0x1e6108);}},'provider':{'type':Sequelize[_0xc53a('0x7')]('gmail','hotmail',_0xc53a('0x8'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xc53a('0x9')](_0xc53a('0xa')))return _0xc53a('0xb');return this[_0xc53a('0x9')]('provider');},'set':function(_0x58929b){if(_0x58929b===_0xc53a('0xb'))_0x58929b=null;return this[_0xc53a('0x6')]('provider',_0x58929b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index e42cf98..332d86a 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 _0x7ba9=['authentication','Smtp','index','Imap','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','MailServerIn','MailServerOut','Pause','keys','find','body','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','pick','removeAnswers','provider','custom','email','isNil','active','get','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','fullname','internal','Tag','Tags','color','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','send','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','updatedAt','DESC','CloudProvider','from','attachments','join','root','server/files/attachments','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','messageId','attach','out','format','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','http','request','then','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','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','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7ba9,0x148));var _0x97ba=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x7ba9[_0x3a07d4];return _0x2c352;};'use strict';var moment=require(_0x97ba('0x0'));var BPromise=require(_0x97ba('0x1'));var util=require(_0x97ba('0x2'));var path=require('path');var _=require(_0x97ba('0x3'));var juice=require('juice');var Redis=require(_0x97ba('0x4'));var qs=require(_0x97ba('0x5'));var logger=require(_0x97ba('0x6'))(_0x97ba('0x7'));var config=require(_0x97ba('0x8'));var db=require(_0x97ba('0x9'))['db'];config['redis']=_[_0x97ba('0xa')](config['redis'],{'host':_0x97ba('0xb'),'port':0x18eb});var socket=require(_0x97ba('0xc'))(new Redis(config[_0x97ba('0xd')]));require(_0x97ba('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x97ba('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x1c1f36,_0x3a787a,_0x2d2f14,_0x543fac){return new BPromise(function(_0x54fc4e,_0x397e89){var _0x112481=_0x543fac||client;return _0x112481[_0x97ba('0x10')](_0x1c1f36,_0x2d2f14)[_0x97ba('0x11')](function(_0x581feb){logger['info']('MailAccount,\x20%s,\x20%s',_0x3a787a,_0x97ba('0x12'));logger[_0x97ba('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3a787a,'request\x20sent',JSON[_0x97ba('0x14')](_0x581feb));if(_0x581feb['error']){if(_0x581feb[_0x97ba('0x15')][_0x97ba('0x16')]===0x1f4){logger[_0x97ba('0x15')](_0x97ba('0x17'),_0x3a787a,_0x581feb[_0x97ba('0x15')]['message']);return _0x397e89(_0x581feb[_0x97ba('0x15')][_0x97ba('0x18')]);}logger[_0x97ba('0x15')](_0x97ba('0x17'),_0x3a787a,_0x581feb['error'][_0x97ba('0x18')]);return _0x54fc4e(_0x581feb['error'][_0x97ba('0x18')]);}else{logger[_0x97ba('0x19')](_0x97ba('0x17'),_0x3a787a,_0x97ba('0x12'));_0x54fc4e(_0x581feb[_0x97ba('0x1a')][_0x97ba('0x18')]);}})['catch'](function(_0x4d1006){logger[_0x97ba('0x15')]('MailAccount,\x20%s,\x20%s',_0x3a787a,_0x4d1006);_0x397e89(_0x4d1006);});});}function respondWithStatusCode(_0xb3414,_0x592425){_0x592425=_0x592425||0xcc;return function(_0x7af073){if(_0x7af073){return _0xb3414[_0x97ba('0x1b')](_0x592425);}return _0xb3414[_0x97ba('0x1c')](_0x592425)[_0x97ba('0x1d')]();};}function respondWithResult(_0x207ada,_0x5c8a42){_0x5c8a42=_0x5c8a42||0xc8;return function(_0x485132){if(_0x485132){return _0x207ada[_0x97ba('0x1c')](_0x5c8a42)[_0x97ba('0x1e')](_0x485132);}};}function respondWithFilteredResult(_0x1defc3,_0x293870){return function(_0x3c5690){if(_0x3c5690){var _0x1bd384=typeof _0x293870[_0x97ba('0x1f')]==='undefined'&&typeof _0x293870[_0x97ba('0x20')]===_0x97ba('0x21');var _0x35b7e0=_0x3c5690['count'];var _0x2ec76b=_0x1bd384?0x0:_0x293870['offset'];var _0x518257=_0x1bd384?_0x3c5690['count']:_0x293870[_0x97ba('0x1f')]+_0x293870[_0x97ba('0x20')];var _0x451e7b;if(_0x518257>=_0x35b7e0){_0x518257=_0x35b7e0;_0x451e7b=0xc8;}else{_0x451e7b=0xce;}_0x1defc3[_0x97ba('0x1c')](_0x451e7b);return _0x1defc3[_0x97ba('0x22')](_0x97ba('0x23'),_0x2ec76b+'-'+_0x518257+'/'+_0x35b7e0)[_0x97ba('0x1e')](_0x3c5690);}return null;};}function saveUpdates(_0x1b0b1d){return function(_0x51e5d5){if(_0x51e5d5){return _0x51e5d5[_0x97ba('0x24')](_0x1b0b1d)[_0x97ba('0x11')](function(_0x19583c){return _0x19583c;});}return null;};}function removeEntity(_0x361ba0){return function(_0x3a143e){if(_0x3a143e){return _0x3a143e[_0x97ba('0x25')]()[_0x97ba('0x11')](function(){var _0x5d592e=_0x3a143e['get']({'plain':!![]});var _0xc526d6=_0x97ba('0x26');return db[_0x97ba('0x27')]['destroy']({'where':{'type':_0xc526d6,'resourceId':_0x5d592e['id']}})[_0x97ba('0x11')](function(){return _0x3a143e;});})[_0x97ba('0x11')](function(){_0x361ba0['status'](0xcc)[_0x97ba('0x1d')]();});}};}function handleEntityNotFound(_0x340c69){return function(_0x4d18c1){if(!_0x4d18c1){_0x340c69[_0x97ba('0x1b')](0x194);}return _0x4d18c1;};}function handleError(_0x4679a2,_0x1c9a89){_0x1c9a89=_0x1c9a89||0x1f4;return function(_0x29cf8a){logger[_0x97ba('0x15')](_0x29cf8a['stack']);if(_0x29cf8a[_0x97ba('0x28')]){delete _0x29cf8a[_0x97ba('0x28')];}_0x4679a2['status'](_0x1c9a89)['send'](_0x29cf8a);};}function getImapHost(_0x3bf90e){switch(_0x3bf90e){case _0x97ba('0x29'):return _0x97ba('0x2a');case _0x97ba('0x2b'):return _0x97ba('0x2c');case _0x97ba('0x2d'):return _0x97ba('0x2e');case _0x97ba('0x2f'):return'outlook.office365.com';}throw new Error(_0x97ba('0x30'),_0x3bf90e);}function getSmtpHost(_0x3cdfb7){switch(_0x3cdfb7){case _0x97ba('0x29'):return _0x97ba('0x31');case _0x97ba('0x2b'):return _0x97ba('0x32');case _0x97ba('0x2d'):return _0x97ba('0x33');case'outlook365':return'smtp.office365.com';}throw new Error(_0x97ba('0x30'),_0x3cdfb7);}function getAuthenticationOptions(_0x3ed8bf,_0x315aeb){var _0x1e3b24={};var _0x1a0a39={};if(_0x3ed8bf){_0x1e3b24[_0x97ba('0x34')]=_0x1a0a39[_0x97ba('0x34')]=_0x315aeb[_0x97ba('0x35')];_0x1e3b24[_0x97ba('0x36')]=_0x1a0a39[_0x97ba('0x37')]=_0x315aeb['password'];if(_0x315aeb[_0x97ba('0x38')]){_0x1e3b24[_0x97ba('0x38')]=_0x1a0a39[_0x97ba('0x38')]=!![];_0x1e3b24['CloudProviderId']=_0x1a0a39[_0x97ba('0x39')]=_0x315aeb[_0x97ba('0x39')];_0x1e3b24[_0x97ba('0x36')]=_0x1a0a39['pass']=null;}else{_0x1e3b24[_0x97ba('0x39')]=_0x1a0a39[_0x97ba('0x39')]=null;}_0x1e3b24['host']=getImapHost(_0x3ed8bf);_0x1e3b24[_0x97ba('0x3a')]=0x3e1;_0x1a0a39[_0x97ba('0x3b')]=getSmtpHost(_0x3ed8bf);_0x1a0a39[_0x97ba('0x3a')]=0x24b;_0x1a0a39[_0x97ba('0x3c')]=![];_0x1e3b24[_0x97ba('0x3d')]=_0x1a0a39[_0x97ba('0x3d')]=null;}else{if(_0x315aeb['authentication']){_0x1e3b24[_0x97ba('0x34')]=_0x1a0a39[_0x97ba('0x34')]=_0x315aeb[_0x97ba('0x35')];_0x1e3b24[_0x97ba('0x36')]=_0x1a0a39['pass']=_0x315aeb[_0x97ba('0x36')];}else{_0x1e3b24[_0x97ba('0x3e')]=_0x1a0a39[_0x97ba('0x3e')]=![];_0x1e3b24[_0x97ba('0x34')]=_0x1a0a39['user']=null;_0x1e3b24[_0x97ba('0x36')]=_0x1a0a39[_0x97ba('0x37')]=null;}_0x1e3b24[_0x97ba('0x3b')]=_0x315aeb['Imap'][_0x97ba('0x3b')];_0x1e3b24[_0x97ba('0x3a')]=_0x315aeb['Imap']['port'];_0x1a0a39[_0x97ba('0x3b')]=_0x315aeb['Smtp']['host'];_0x1a0a39[_0x97ba('0x3a')]=_0x315aeb[_0x97ba('0x3f')][_0x97ba('0x3a')];}return{'Imap':_0x1e3b24,'Smtp':_0x1a0a39};}exports[_0x97ba('0x40')]=function(_0x5ac5ec,_0x1a53c5){var _0x25d6ef={'include':[{'model':db['MailServerIn'],'as':_0x97ba('0x41')},{'model':db['MailServerOut'],'as':_0x97ba('0x3f')},{'model':db['Pause'],'as':_0x97ba('0x42')}]},_0x1359b6={},_0x1a85c7={'count':0x0,'rows':[]};var _0x1a0db3=_['map'](db[_0x97ba('0x43')][_0x97ba('0x44')],function(_0x12ccf8){return{'name':_0x12ccf8[_0x97ba('0x45')],'type':_0x12ccf8[_0x97ba('0x46')][_0x97ba('0x47')]};});_0x1359b6[_0x97ba('0x48')]=_[_0x97ba('0x49')](_0x1a0db3,_0x97ba('0x28'));_0x1359b6['query']=_['keys'](_0x5ac5ec[_0x97ba('0x4a')]);_0x1359b6[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0x1359b6[_0x97ba('0x48')],_0x1359b6['query']);_0x25d6ef[_0x97ba('0x4d')]=_[_0x97ba('0x4c')](_0x1359b6[_0x97ba('0x48')],qs[_0x97ba('0x4e')](_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x4e')]));_0x25d6ef[_0x97ba('0x4d')]=_0x25d6ef[_0x97ba('0x4d')][_0x97ba('0x4f')]?_0x25d6ef[_0x97ba('0x4d')]:_0x1359b6[_0x97ba('0x48')];if(!_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x50')](_0x97ba('0x51'))){_0x25d6ef['limit']=qs[_0x97ba('0x20')](_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x20')]);_0x25d6ef[_0x97ba('0x1f')]=qs[_0x97ba('0x1f')](_0x5ac5ec[_0x97ba('0x4a')]['offset']);}_0x25d6ef['order']=qs[_0x97ba('0x52')](_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x52')]);_0x25d6ef[_0x97ba('0x53')]=qs[_0x97ba('0x4b')](_['pick'](_0x5ac5ec[_0x97ba('0x4a')],_0x1359b6[_0x97ba('0x4b')]),_0x1a0db3);if(_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x25d6ef['where']=_[_0x97ba('0x55')](_0x25d6ef[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x1a0db3,function(_0x5dd170){if(_0x5dd170[_0x97ba('0x46')]!==_0x97ba('0x56')){var _0x39521e={};_0x39521e[_0x5dd170[_0x97ba('0x28')]]={'$like':'%'+_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x54')]+'%'};return _0x39521e;}})});}_0x25d6ef=_[_0x97ba('0x55')]({},_0x25d6ef,_0x5ac5ec[_0x97ba('0x57')]);var _0x50ba89={'where':_0x25d6ef[_0x97ba('0x53')]};return db[_0x97ba('0x43')][_0x97ba('0x58')](_0x50ba89)[_0x97ba('0x11')](function(_0x3e5d2e){_0x1a85c7[_0x97ba('0x58')]=_0x3e5d2e;if(_0x5ac5ec[_0x97ba('0x4a')][_0x97ba('0x59')]){_0x25d6ef[_0x97ba('0x5a')]=[{'all':!![]}];}return db[_0x97ba('0x43')][_0x97ba('0x5b')](_0x25d6ef);})[_0x97ba('0x11')](function(_0x3bb025){_0x1a85c7[_0x97ba('0x5c')]=_0x3bb025;return _0x1a85c7;})[_0x97ba('0x11')](respondWithFilteredResult(_0x1a53c5,_0x25d6ef))[_0x97ba('0x5d')](handleError(_0x1a53c5,null));};exports['show']=function(_0x1219b3,_0x1993f4){var _0xc1ac68={'raw':![],'where':{'id':_0x1219b3[_0x97ba('0x5e')]['id']},'include':[{'model':db[_0x97ba('0x5f')],'as':_0x97ba('0x41')},{'model':db[_0x97ba('0x60')],'as':_0x97ba('0x3f')},{'model':db[_0x97ba('0x61')],'as':_0x97ba('0x42')}]},_0x4e8641={};_0x4e8641[_0x97ba('0x48')]=_['keys'](db['MailAccount'][_0x97ba('0x44')]);_0x4e8641[_0x97ba('0x4a')]=_[_0x97ba('0x62')](_0x1219b3['query']);_0x4e8641[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0x4e8641[_0x97ba('0x48')],_0x4e8641[_0x97ba('0x4a')]);_0xc1ac68[_0x97ba('0x4d')]=_[_0x97ba('0x4c')](_0x4e8641[_0x97ba('0x48')],qs[_0x97ba('0x4e')](_0x1219b3[_0x97ba('0x4a')]['fields']));_0xc1ac68[_0x97ba('0x4d')]=_0xc1ac68['attributes'][_0x97ba('0x4f')]?_0xc1ac68[_0x97ba('0x4d')]:_0x4e8641[_0x97ba('0x48')];if(_0x1219b3[_0x97ba('0x4a')][_0x97ba('0x59')]){_0xc1ac68[_0x97ba('0x5a')]=[{'all':!![]}];}_0xc1ac68=_[_0x97ba('0x55')]({},_0xc1ac68,_0x1219b3[_0x97ba('0x57')]);return db[_0x97ba('0x43')][_0x97ba('0x63')](_0xc1ac68)['then'](handleEntityNotFound(_0x1993f4,null))[_0x97ba('0x11')](respondWithResult(_0x1993f4,null))['catch'](handleError(_0x1993f4,null));};exports[_0x97ba('0x24')]=function(_0x5a8564,_0x4414ba){if(_0x5a8564[_0x97ba('0x64')]['id']){delete _0x5a8564[_0x97ba('0x64')]['id'];}var _0x41376e=_0x5a8564['body']['provider']==='custom'?null:_0x5a8564[_0x97ba('0x64')]['provider'];var _0x572a31=_0x5a8564['body'][_0x97ba('0x41')]||{};var _0x297058=_0x5a8564[_0x97ba('0x64')][_0x97ba('0x3f')]||{};if(_0x41376e){_0x572a31[_0x97ba('0x3b')]=getImapHost(_0x41376e);_0x572a31[_0x97ba('0x3a')]=0x3e1;_0x297058['host']=getSmtpHost(_0x41376e);_0x297058['port']=0x24b;_0x297058[_0x97ba('0x3c')]=![];}if(_0x297058[_0x97ba('0x38')]){_0x297058[_0x97ba('0x3c')]=![];}else{_0x297058[_0x97ba('0x39')]=null;}if(!_0x572a31[_0x97ba('0x38')])_0x572a31[_0x97ba('0x39')]=null;_0x5a8564['body'][_0x97ba('0x41')]=_0x572a31;_0x5a8564['body'][_0x97ba('0x3f')]=_0x297058;return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x5a8564[_0x97ba('0x5e')]['id']},'include':[{'model':db[_0x97ba('0x5f')],'as':_0x97ba('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x97ba('0x61')],'as':'mandatoryDispositionPause'}]})[_0x97ba('0x11')](handleEntityNotFound(_0x4414ba,null))[_0x97ba('0x11')](function(_0x4318d6){if(!_0x4318d6)throw new Error(_0x97ba('0x65'));if(_0x4318d6[_0x97ba('0x3d')])delete _0x5a8564[_0x97ba('0x64')][_0x97ba('0x41')];return _0x4318d6;})[_0x97ba('0x11')](saveUpdates(_0x5a8564[_0x97ba('0x64')],null))[_0x97ba('0x11')](function(_0x11fb46){if(!_0x5a8564[_0x97ba('0x64')]['Imap'])return _0x11fb46;return db['MailServerIn'][_0x97ba('0x24')](_0x5a8564[_0x97ba('0x64')][_0x97ba('0x41')],{'where':{'MailAccountId':_0x11fb46['id']}})[_0x97ba('0x11')](function(){return _0x11fb46;});})[_0x97ba('0x11')](function(_0x4b8686){if(!_0x5a8564['body']['Smtp'])return _0x4b8686;return db[_0x97ba('0x60')][_0x97ba('0x24')](_0x5a8564[_0x97ba('0x64')]['Smtp'],{'where':{'MailAccountId':_0x4b8686['id']}})['then'](function(){return _0x4b8686;});})[_0x97ba('0x11')](respondWithResult(_0x4414ba,null))[_0x97ba('0x5d')](handleError(_0x4414ba,null));};exports['describe']=function(_0xb06b82,_0x53d8ae){return db[_0x97ba('0x43')][_0x97ba('0x66')]()[_0x97ba('0x11')](respondWithResult(_0x53d8ae,null))['catch'](handleError(_0x53d8ae,null));};exports['addDisposition']=function(_0x5e3aaa,_0x3869bc){if(_0x5e3aaa[_0x97ba('0x64')]['id']){delete _0x5e3aaa[_0x97ba('0x64')]['id'];}return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x5e3aaa[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3869bc,null))[_0x97ba('0x11')](function(_0x427f94){if(_0x427f94){_0x5e3aaa['body'][_0x97ba('0x67')]=_0x427f94['id'];return db[_0x97ba('0x68')][_0x97ba('0x69')](_0x5e3aaa[_0x97ba('0x64')]);}})[_0x97ba('0x11')](respondWithResult(_0x3869bc,null))[_0x97ba('0x5d')](handleError(_0x3869bc,null));};exports[_0x97ba('0x6a')]=function(_0x2a81f4,_0x48d5c5){var _0x499254={'raw':![],'where':{}};var _0xd736ad={};var _0x3b79c8={'count':0x0,'rows':[]};return db[_0x97ba('0x43')]['findOne']({'where':{'id':_0x2a81f4[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x48d5c5,null))[_0x97ba('0x11')](function(_0x131d17){if(_0x131d17){_0xd736ad[_0x97ba('0x48')]=_[_0x97ba('0x62')](db[_0x97ba('0x68')][_0x97ba('0x44')]);_0xd736ad['query']=_[_0x97ba('0x62')](_0x2a81f4['query']);_0xd736ad[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0xd736ad[_0x97ba('0x48')],_0xd736ad[_0x97ba('0x4a')]);_0x499254[_0x97ba('0x4d')]=_[_0x97ba('0x4c')](_0xd736ad[_0x97ba('0x48')],qs['fields'](_0x2a81f4['query'][_0x97ba('0x4e')]));_0x499254[_0x97ba('0x4d')]=_0x499254[_0x97ba('0x4d')][_0x97ba('0x4f')]?_0x499254['attributes']:_0xd736ad[_0x97ba('0x48')];if(!_0x2a81f4['query'][_0x97ba('0x50')](_0x97ba('0x51'))){_0x499254[_0x97ba('0x20')]=qs['limit'](_0x2a81f4['query']['limit']);_0x499254[_0x97ba('0x1f')]=qs['offset'](_0x2a81f4['query']['offset']);}_0x499254['order']=qs[_0x97ba('0x52')](_0x2a81f4['query']['sort']);_0x499254[_0x97ba('0x53')]=qs['filters'](_['pick'](_0x2a81f4[_0x97ba('0x4a')],_0xd736ad[_0x97ba('0x4b')]));_0x499254['where'][_0x97ba('0x67')]=_0x131d17['id'];if(_0x2a81f4[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x499254[_0x97ba('0x53')]=_[_0x97ba('0x55')](_0x499254[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x499254['attributes'],function(_0x3d19e8){var _0x316b67={};_0x316b67[_0x3d19e8]={'$like':'%'+_0x2a81f4[_0x97ba('0x4a')][_0x97ba('0x54')]+'%'};return _0x316b67;})});}_0x499254=_[_0x97ba('0x55')]({},_0x499254,_0x2a81f4[_0x97ba('0x57')]);return db[_0x97ba('0x68')][_0x97ba('0x58')]({'where':_0x499254[_0x97ba('0x53')]})[_0x97ba('0x11')](function(_0x352081){_0x3b79c8[_0x97ba('0x58')]=_0x352081;if(_0x2a81f4[_0x97ba('0x4a')][_0x97ba('0x59')]){_0x499254[_0x97ba('0x5a')]=[{'all':!![]}];}return db[_0x97ba('0x68')][_0x97ba('0x5b')](_0x499254);})[_0x97ba('0x11')](function(_0x3b4ac7){_0x3b79c8['rows']=_0x3b4ac7;return _0x3b79c8;});}})[_0x97ba('0x11')](respondWithFilteredResult(_0x48d5c5,_0x499254))[_0x97ba('0x5d')](handleError(_0x48d5c5,null));};exports[_0x97ba('0x6b')]=function(_0x3cd768,_0x1eb431){return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x3cd768[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1eb431,null))[_0x97ba('0x11')](function(_0x4a1286){if(_0x4a1286){return _0x4a1286['removeDispositions'](_0x3cd768[_0x97ba('0x4a')][_0x97ba('0x6c')]);}})[_0x97ba('0x11')](respondWithStatusCode(_0x1eb431,null))[_0x97ba('0x5d')](handleError(_0x1eb431,null));};exports[_0x97ba('0x6d')]=function(_0x2ee66b,_0xe5de0c){if(_0x2ee66b['body']['id']){delete _0x2ee66b[_0x97ba('0x64')]['id'];}return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x2ee66b[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0xe5de0c,null))[_0x97ba('0x11')](function(_0x2c74e4){if(_0x2c74e4){_0x2ee66b['body'][_0x97ba('0x67')]=_0x2c74e4['id'];return db[_0x97ba('0x6e')][_0x97ba('0x69')](_0x2ee66b[_0x97ba('0x64')]);}})[_0x97ba('0x11')](respondWithResult(_0xe5de0c,null))[_0x97ba('0x5d')](handleError(_0xe5de0c,null));};exports[_0x97ba('0x6f')]=function(_0xf7ce96,_0x905b5){var _0x445078={'raw':![],'where':{}};var _0xe2c706={};var _0x407c08={'count':0x0,'rows':[]};return db['MailAccount'][_0x97ba('0x70')]({'where':{'id':_0xf7ce96[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x905b5,null))[_0x97ba('0x11')](function(_0x3ada25){if(_0x3ada25){_0xe2c706[_0x97ba('0x48')]=_[_0x97ba('0x62')](db['CannedAnswer'][_0x97ba('0x44')]);_0xe2c706[_0x97ba('0x4a')]=_[_0x97ba('0x62')](_0xf7ce96[_0x97ba('0x4a')]);_0xe2c706['filters']=_[_0x97ba('0x4c')](_0xe2c706[_0x97ba('0x48')],_0xe2c706[_0x97ba('0x4a')]);_0x445078[_0x97ba('0x4d')]=_[_0x97ba('0x4c')](_0xe2c706[_0x97ba('0x48')],qs[_0x97ba('0x4e')](_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x4e')]));_0x445078[_0x97ba('0x4d')]=_0x445078[_0x97ba('0x4d')]['length']?_0x445078['attributes']:_0xe2c706[_0x97ba('0x48')];if(!_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x50')](_0x97ba('0x51'))){_0x445078['limit']=qs[_0x97ba('0x20')](_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x20')]);_0x445078[_0x97ba('0x1f')]=qs[_0x97ba('0x1f')](_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x1f')]);}_0x445078[_0x97ba('0x71')]=qs[_0x97ba('0x52')](_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x52')]);_0x445078['where']=qs[_0x97ba('0x4b')](_[_0x97ba('0x72')](_0xf7ce96[_0x97ba('0x4a')],_0xe2c706[_0x97ba('0x4b')]));_0x445078['where']['MailAccountId']=_0x3ada25['id'];if(_0xf7ce96[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x445078[_0x97ba('0x53')]=_['merge'](_0x445078[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x445078['attributes'],function(_0x2f288b){var _0x260530={};_0x260530[_0x2f288b]={'$like':'%'+_0xf7ce96[_0x97ba('0x4a')]['filter']+'%'};return _0x260530;})});}_0x445078=_[_0x97ba('0x55')]({},_0x445078,_0xf7ce96[_0x97ba('0x57')]);return db[_0x97ba('0x6e')][_0x97ba('0x58')]({'where':_0x445078[_0x97ba('0x53')]})[_0x97ba('0x11')](function(_0x432e5e){_0x407c08[_0x97ba('0x58')]=_0x432e5e;if(_0xf7ce96['query']['includeAll']){_0x445078[_0x97ba('0x5a')]=[{'all':!![]}];}return db[_0x97ba('0x6e')]['findAll'](_0x445078);})['then'](function(_0x410986){_0x407c08[_0x97ba('0x5c')]=_0x410986;return _0x407c08;});}})[_0x97ba('0x11')](respondWithFilteredResult(_0x905b5,_0x445078))[_0x97ba('0x5d')](handleError(_0x905b5,null));};exports[_0x97ba('0x73')]=function(_0x427ee7,_0x1c08f5){return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x427ee7[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1c08f5,null))[_0x97ba('0x11')](function(_0x4f5f73){if(_0x4f5f73){return _0x4f5f73[_0x97ba('0x73')](_0x427ee7[_0x97ba('0x4a')][_0x97ba('0x6c')]);}})[_0x97ba('0x11')](respondWithStatusCode(_0x1c08f5,null))['catch'](handleError(_0x1c08f5,null));};exports[_0x97ba('0x69')]=function(_0x381326,_0x29981c){var _0x23633d={'name':_0x381326['body']['name'],'key':_0x381326['body'][_0x97ba('0x47')],'provider':_0x381326[_0x97ba('0x64')][_0x97ba('0x74')]===_0x97ba('0x75')?null:_0x381326[_0x97ba('0x64')][_0x97ba('0x74')],'email':_0x381326['body'][_0x97ba('0x76')],'ListId':_0x381326[_0x97ba('0x64')]['ListId'],'active':!_[_0x97ba('0x77')](_0x381326[_0x97ba('0x64')][_0x97ba('0x78')])?_0x381326[_0x97ba('0x64')]['active']:!![],'description':_0x381326[_0x97ba('0x64')]['description']||null};var _0x7c11d9=getAuthenticationOptions(_0x23633d[_0x97ba('0x74')],_0x381326[_0x97ba('0x64')]);_0x23633d['Imap']=_0x7c11d9[_0x97ba('0x41')];_0x23633d[_0x97ba('0x3f')]=_0x7c11d9[_0x97ba('0x3f')];return db[_0x97ba('0x43')][_0x97ba('0x69')](_0x23633d,{'include':[{'model':db['MailServerOut'],'as':_0x97ba('0x3f')},{'model':db[_0x97ba('0x5f')],'as':_0x97ba('0x41')}]})['then'](function(_0x111d75){var _0x4a8755=_0x381326[_0x97ba('0x34')][_0x97ba('0x79')]({'plain':!![]});if(!_0x4a8755)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a8755[_0x97ba('0x7a')]===_0x97ba('0x34')){var _0x16872b=_0x111d75[_0x97ba('0x79')]({'plain':!![]});return db[_0x97ba('0x7b')]['find']({'where':{'name':_0x97ba('0x26'),'userProfileId':_0x4a8755['userProfileId']},'raw':!![]})[_0x97ba('0x11')](function(_0x49a9d2){if(_0x49a9d2&&_0x49a9d2[_0x97ba('0x7c')]===0x0){return db['UserProfileResource'][_0x97ba('0x69')]({'name':_0x16872b[_0x97ba('0x28')],'resourceId':_0x16872b['id'],'type':_0x49a9d2[_0x97ba('0x28')],'sectionId':_0x49a9d2['id']},{})[_0x97ba('0x11')](function(){return _0x111d75;});}else{return _0x111d75;}})[_0x97ba('0x5d')](function(_0x48a306){logger[_0x97ba('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a306);throw _0x48a306;});}return _0x111d75;})[_0x97ba('0x11')](respondWithResult(_0x29981c,0xc9))[_0x97ba('0x5d')](handleError(_0x29981c,null));};exports[_0x97ba('0x7d')]=function(_0x3c36e4,_0x488cf6){return db[_0x97ba('0x43')][_0x97ba('0x70')]({'where':{'id':_0x3c36e4['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x488cf6,null))['then'](function(_0x46c37b){if(_0x46c37b){return _0x46c37b[_0x97ba('0x7d')]();}return null;})[_0x97ba('0x11')](respondWithResult(_0x488cf6,null))[_0x97ba('0x5d')](handleError(_0x488cf6,null));};exports[_0x97ba('0x7e')]=function(_0x3ab9e8,_0x2e3cf8){if(_0x3ab9e8[_0x97ba('0x64')]['id']){delete _0x3ab9e8[_0x97ba('0x64')]['id'];}return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x3ab9e8[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x2e3cf8,null))[_0x97ba('0x11')](function(_0x323256){if(_0x323256){_0x3ab9e8[_0x97ba('0x64')]['MailAccountId']=_0x323256['id'];return db['MailServerIn'][_0x97ba('0x69')](_0x3ab9e8['body']);}})[_0x97ba('0x11')](respondWithResult(_0x2e3cf8,null))[_0x97ba('0x5d')](handleError(_0x2e3cf8,null));};exports[_0x97ba('0x7f')]=function(_0x1f56e8,_0x8dd21f){return db[_0x97ba('0x43')][_0x97ba('0x70')]({'where':{'id':_0x1f56e8['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x8dd21f,null))['then'](function(_0x460f35){if(_0x460f35){return _0x460f35[_0x97ba('0x80')](null);}return null;})[_0x97ba('0x11')](respondWithStatusCode(_0x8dd21f,null))['catch'](handleError(_0x8dd21f,null));};exports[_0x97ba('0x81')]=function(_0x25bb59,_0x41c3b3){return db['MailAccount'][_0x97ba('0x70')]({'where':{'id':_0x25bb59[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x41c3b3,null))[_0x97ba('0x11')](function(_0xbdd99c){if(_0xbdd99c){return _0xbdd99c[_0x97ba('0x81')]();}return null;})[_0x97ba('0x11')](respondWithResult(_0x41c3b3,null))['catch'](handleError(_0x41c3b3,null));};exports['addSmtp']=function(_0x103b04,_0x55ca5c){if(_0x103b04[_0x97ba('0x64')]['id']){delete _0x103b04[_0x97ba('0x64')]['id'];}return db['MailAccount'][_0x97ba('0x63')]({'where':{'id':_0x103b04['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x55ca5c,null))[_0x97ba('0x11')](function(_0x2c8c88){if(_0x2c8c88){_0x103b04[_0x97ba('0x64')][_0x97ba('0x67')]=_0x2c8c88['id'];return db[_0x97ba('0x60')][_0x97ba('0x69')](_0x103b04[_0x97ba('0x64')]);}})['then'](respondWithResult(_0x55ca5c,null))['catch'](handleError(_0x55ca5c,null));};exports[_0x97ba('0x82')]=function(_0x4fa378,_0x349062){return db['MailAccount'][_0x97ba('0x70')]({'where':{'id':_0x4fa378[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x349062,null))[_0x97ba('0x11')](function(_0x47b50a){if(_0x47b50a){return _0x47b50a[_0x97ba('0x83')](null);}return null;})[_0x97ba('0x11')](respondWithStatusCode(_0x349062,null))[_0x97ba('0x5d')](handleError(_0x349062,null));};exports[_0x97ba('0x84')]=function(_0x3115b3,_0x5cdef0){return db[_0x97ba('0x85')]['find']({'where':{'id':_0x3115b3['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x5cdef0,null))['then'](function(_0x3bb4bc){if(_0x3bb4bc){return _0x3bb4bc['addInteraction'](_0x3115b3[_0x97ba('0x64')][_0x97ba('0x6c')],_[_0x97ba('0x86')](_0x3115b3[_0x97ba('0x64')],[_0x97ba('0x6c'),'id'])||{});}})[_0x97ba('0x11')](respondWithResult(_0x5cdef0,null))[_0x97ba('0x5d')](handleError(_0x5cdef0,null));};exports['getInteractions']=function(_0x549192,_0x29415d){var _0x452f8f={'raw':![],'where':{}};var _0xe00ef2={};var _0x204a9c={'count':0x0,'rows':[]};return db[_0x97ba('0x43')][_0x97ba('0x70')]({'where':{'id':_0x549192[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x29415d,null))[_0x97ba('0x11')](function(_0x41b910){if(_0x41b910){_0xe00ef2[_0x97ba('0x48')]=_[_0x97ba('0x62')](db[_0x97ba('0x85')][_0x97ba('0x44')]);_0xe00ef2['query']=_[_0x97ba('0x62')](_0x549192[_0x97ba('0x4a')]);_0xe00ef2[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0xe00ef2[_0x97ba('0x48')],_0xe00ef2[_0x97ba('0x4a')]);_0x452f8f['attributes']=_[_0x97ba('0x4c')](_0xe00ef2[_0x97ba('0x48')],qs['fields'](_0x549192[_0x97ba('0x4a')]['fields']));_0x452f8f[_0x97ba('0x4d')]=_0x452f8f[_0x97ba('0x4d')][_0x97ba('0x4f')]?_0x452f8f[_0x97ba('0x4d')]:_0xe00ef2[_0x97ba('0x48')];if(!_0x549192[_0x97ba('0x4a')][_0x97ba('0x50')](_0x97ba('0x51'))){_0x452f8f['limit']=qs['limit'](_0x549192[_0x97ba('0x4a')]['limit']);_0x452f8f[_0x97ba('0x1f')]=qs[_0x97ba('0x1f')](_0x549192['query']['offset']);}_0x452f8f[_0x97ba('0x71')]=qs[_0x97ba('0x52')](_0x549192[_0x97ba('0x4a')][_0x97ba('0x52')]);_0x452f8f['where']=qs['filters'](_[_0x97ba('0x72')](_0x549192[_0x97ba('0x4a')],_0xe00ef2['filters']));_0x452f8f[_0x97ba('0x53')][_0x97ba('0x67')]=_0x41b910['id'];if(_0x549192[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x452f8f[_0x97ba('0x53')]=_[_0x97ba('0x55')](_0x452f8f[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x452f8f[_0x97ba('0x4d')],function(_0x217d05){var _0x2cc433={};_0x2cc433[_0x217d05]={'$like':'%'+_0x549192[_0x97ba('0x4a')][_0x97ba('0x54')]+'%'};return _0x2cc433;})});}_0x452f8f=_[_0x97ba('0x55')]({},_0x452f8f,_0x549192[_0x97ba('0x57')]);return db[_0x97ba('0x85')][_0x97ba('0x58')]({'where':_0x452f8f[_0x97ba('0x53')]})['then'](function(_0x219551){_0x204a9c[_0x97ba('0x58')]=_0x219551;if(_0x549192['query'][_0x97ba('0x59')]){_0x452f8f[_0x97ba('0x5a')]=[{'model':db[_0x97ba('0x87')],'as':_0x97ba('0x88'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x97ba('0x28'),_0x97ba('0x89'),_0x97ba('0x8a')],'required':![]},{'model':db[_0x97ba('0x8b')],'as':_0x97ba('0x8c'),'attributes':['id',_0x97ba('0x28'),_0x97ba('0x8d')],'where':_0x549192[_0x97ba('0x4a')]['tag']?{'id':_0x549192[_0x97ba('0x4a')]['tag']}:undefined,'required':_0x549192[_0x97ba('0x4a')]['tag']?!![]:![]}];}return db[_0x97ba('0x85')][_0x97ba('0x5b')](_0x452f8f);})[_0x97ba('0x11')](function(_0x52b251){_0x204a9c['rows']=_0x52b251;return _0x204a9c;});}})['then'](respondWithFilteredResult(_0x29415d,_0x452f8f))['catch'](handleError(_0x29415d,null));};exports[_0x97ba('0x8e')]=function addApplications(_0x11d898,_0x53f5c2){var _0x36bcf1=_0x11d898['params']['id'];var _0x22341a=_0x11d898[_0x97ba('0x64')];var _0x217fb2=0xc8;var _0x1d61b9=null;return db[_0x97ba('0x8f')][_0x97ba('0x90')]({'isolationLevel':db[_0x97ba('0x8f')][_0x97ba('0x91')][_0x97ba('0x92')][_0x97ba('0x93')]},function(_0x136e2f){return db[_0x97ba('0x43')]['findOne']({'where':{'id':_0x36bcf1},'transaction':_0x136e2f})['then'](function(_0x5a03c9){if(_0x5a03c9){return db[_0x97ba('0x94')][_0x97ba('0x25')]({'where':{'MailAccountId':_0x36bcf1},'transaction':_0x136e2f})[_0x97ba('0x11')](function(){var _0x27043e=_[_0x97ba('0x49')](_0x22341a,function(_0xa70f46){_0xa70f46[_0x97ba('0x67')]=_0x36bcf1;return _0xa70f46;});return db['MailApplication']['bulkCreate'](_0x27043e,{'transaction':_0x136e2f});});}else{_0x217fb2=0x194;_0x1d61b9=[];}});})[_0x97ba('0x11')](function(){if(_0x217fb2!==0x194){return db[_0x97ba('0x94')][_0x97ba('0x95')]({'where':{'MailAccountId':_0x36bcf1},'order':_0x97ba('0x96')})['then'](function(_0x19cc3b){_0x1d61b9=_0x19cc3b;});}})['catch'](function(_0x32ebeb){_0x217fb2=0x1f4;logger['error'](_0x32ebeb[_0x97ba('0x97')]);if(_0x32ebeb[_0x97ba('0x28')]){delete _0x32ebeb['name'];}_0x1d61b9=_0x32ebeb;})[_0x97ba('0x98')](function(){if(_0x1d61b9===null){_0x53f5c2[_0x97ba('0x1b')](_0x217fb2);}else{if(_0x217fb2===0x1f4){_0x53f5c2[_0x97ba('0x1c')](_0x217fb2)[_0x97ba('0x99')](_0x1d61b9);}else{_0x53f5c2['status'](_0x217fb2)[_0x97ba('0x1e')](_0x1d61b9);}}});};exports[_0x97ba('0x9a')]=function(_0x433c8a,_0xf12739){var _0x493173={};var _0x1e0868={};var _0x129208;var _0x68a450;return db[_0x97ba('0x43')]['findOne']({'where':{'id':_0x433c8a[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0xf12739,null))[_0x97ba('0x11')](function(_0x28d8e0){if(_0x28d8e0){_0x129208=_0x28d8e0;_0x1e0868[_0x97ba('0x48')]=_['keys'](db['MailApplication'][_0x97ba('0x44')]);_0x1e0868['query']=_[_0x97ba('0x62')](_0x433c8a['query']);_0x1e0868[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0x1e0868['model'],_0x1e0868[_0x97ba('0x4a')]);_0x493173[_0x97ba('0x4d')]=_['intersection'](_0x1e0868[_0x97ba('0x48')],qs[_0x97ba('0x4e')](_0x433c8a[_0x97ba('0x4a')][_0x97ba('0x4e')]));_0x493173['attributes']=_0x493173[_0x97ba('0x4d')][_0x97ba('0x4f')]?_0x493173[_0x97ba('0x4d')]:_0x1e0868[_0x97ba('0x48')];_0x493173[_0x97ba('0x71')]=qs['sort'](_0x433c8a['query']['sort']);_0x493173[_0x97ba('0x53')]=qs[_0x97ba('0x4b')](_[_0x97ba('0x72')](_0x433c8a[_0x97ba('0x4a')],_0x1e0868[_0x97ba('0x4b')]));if(_0x433c8a[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x493173[_0x97ba('0x53')]=_[_0x97ba('0x55')](_0x493173[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x493173[_0x97ba('0x4d')],function(_0x4501c6){var _0x422511={};_0x422511[_0x4501c6]={'$like':'%'+_0x433c8a['query'][_0x97ba('0x54')]+'%'};return _0x422511;})});}_0x493173=_[_0x97ba('0x55')]({},_0x493173,_0x433c8a[_0x97ba('0x57')]);return _0x129208[_0x97ba('0x9a')](_0x493173);}})[_0x97ba('0x11')](function(_0x13ecb4){if(_0x13ecb4){_0x68a450=_0x13ecb4[_0x97ba('0x4f')];if(!_0x433c8a[_0x97ba('0x4a')][_0x97ba('0x50')](_0x97ba('0x51'))){_0x493173[_0x97ba('0x20')]=qs['limit'](_0x433c8a[_0x97ba('0x4a')][_0x97ba('0x20')]);_0x493173[_0x97ba('0x1f')]=qs[_0x97ba('0x1f')](_0x433c8a[_0x97ba('0x4a')][_0x97ba('0x1f')]);}return _0x129208['getApplications'](_0x493173);}})[_0x97ba('0x11')](function(_0x2a3a99){if(_0x2a3a99){return _0x2a3a99?{'count':_0x68a450,'rows':_0x2a3a99}:null;}})[_0x97ba('0x11')](respondWithResult(_0xf12739,null))[_0x97ba('0x5d')](handleError(_0xf12739,null));};exports['getMessages']=function(_0x62e0e,_0x14fe03){var _0x5cbdbb={'raw':!![],'where':{}};var _0x3b7cab={};var _0x469677={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x62e0e[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x14fe03,null))[_0x97ba('0x11')](function(_0x18f7b3){if(_0x18f7b3){_0x3b7cab[_0x97ba('0x48')]=_['keys'](db[_0x97ba('0x9b')][_0x97ba('0x44')]);_0x3b7cab[_0x97ba('0x4a')]=_[_0x97ba('0x62')](_0x62e0e[_0x97ba('0x4a')]);_0x3b7cab[_0x97ba('0x4b')]=_[_0x97ba('0x4c')](_0x3b7cab[_0x97ba('0x48')],_0x3b7cab[_0x97ba('0x4a')]);_0x5cbdbb[_0x97ba('0x4d')]=_[_0x97ba('0x4c')](_0x3b7cab['model'],qs[_0x97ba('0x4e')](_0x62e0e['query']['fields']));_0x5cbdbb[_0x97ba('0x4d')]=_0x5cbdbb['attributes']['length']?_0x5cbdbb[_0x97ba('0x4d')]:_0x3b7cab[_0x97ba('0x48')];if(!_0x62e0e[_0x97ba('0x4a')]['hasOwnProperty'](_0x97ba('0x51'))){_0x5cbdbb[_0x97ba('0x20')]=qs[_0x97ba('0x20')](_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x20')]);_0x5cbdbb['offset']=qs[_0x97ba('0x1f')](_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x1f')]);}_0x5cbdbb[_0x97ba('0x71')]=qs[_0x97ba('0x52')](_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x52')]);_0x5cbdbb[_0x97ba('0x53')]=qs['filters'](_['pick'](_0x62e0e['query'],_0x3b7cab[_0x97ba('0x4b')]));_0x5cbdbb[_0x97ba('0x53')][_0x97ba('0x67')]=_0x18f7b3['id'];if(_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x54')]){_0x5cbdbb['where']=_[_0x97ba('0x55')](_0x5cbdbb[_0x97ba('0x53')],{'$or':_[_0x97ba('0x49')](_0x5cbdbb['attributes'],function(_0x16f0a4){var _0x2737c1={};_0x2737c1[_0x16f0a4]={'$like':'%'+_0x62e0e[_0x97ba('0x4a')]['filter']+'%'};return _0x2737c1;})});}if(_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x9c')]){var _0x2fb816=_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x9c')][_0x97ba('0x9d')](',');var _0x1a905f={};_0x1a905f[_0x2fb816[0x0]]={'$gte':moment(_0x2fb816[0x1])['format'](_0x97ba('0x9e'))};_0x5cbdbb[_0x97ba('0x53')]=_[_0x97ba('0x55')](_0x5cbdbb[_0x97ba('0x53')],_0x1a905f);}_0x5cbdbb=_['merge']({},_0x5cbdbb,_0x62e0e[_0x97ba('0x57')]);return db['MailMessage']['count']({'where':_0x5cbdbb[_0x97ba('0x53')]})[_0x97ba('0x11')](function(_0x2bc26f){_0x469677[_0x97ba('0x58')]=_0x2bc26f;if(_0x62e0e['query'][_0x97ba('0x59')]){_0x5cbdbb[_0x97ba('0x5a')]=[{'all':!![]}];}return db[_0x97ba('0x9b')]['findAll'](_0x5cbdbb);})[_0x97ba('0x11')](function(_0x21453e){if(_0x62e0e[_0x97ba('0x4a')][_0x97ba('0x9f')]==='true'){for(var _0x261e6a=0x0;_0x261e6a<_0x21453e[_0x97ba('0x4f')];_0x261e6a++){_0x21453e[_0x261e6a][_0x97ba('0x64')]=juice(_0x21453e[_0x261e6a][_0x97ba('0x64')]);}}_0x469677[_0x97ba('0x5c')]=_0x21453e;return _0x469677;});}})['then'](respondWithFilteredResult(_0x14fe03,_0x5cbdbb))[_0x97ba('0x5d')](handleError(_0x14fe03,null));};exports[_0x97ba('0x99')]=function(_0x399992,_0x1de983){var _0x168c01,_0x23b8fd={},_0x2e2970;if(_0x399992[_0x97ba('0x64')]['to']){_0x2e2970=_0x399992['body']['to'][_0x97ba('0x9d')](',')[0x0];}return db[_0x97ba('0x43')]['find']({'where':{'id':_0x399992[_0x97ba('0x5e')]['id']},'include':[{'model':db[_0x97ba('0xa0')],'as':_0x97ba('0xa1'),'include':[{'model':db[_0x97ba('0x87')],'as':'Contacts','where':{'email':_0x2e2970},'limit':0x1,'order':[[_0x97ba('0xa2'),_0x97ba('0xa3')]]}]},{'model':db['MailServerOut'],'as':_0x97ba('0x3f'),'raw':!![],'include':[{'model':db[_0x97ba('0xa4')],'as':_0x97ba('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1de983,null))[_0x97ba('0x11')](function(_0x40c4d0){if(!_0x40c4d0)return;_0x168c01=_0x40c4d0;if(!_0x40c4d0[_0x97ba('0x3f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x399992['body'][_0x97ba('0xa5')])){_0x399992[_0x97ba('0x64')][_0x97ba('0xa5')]=util['format']('%s\x20<%s>',_0x40c4d0[_0x97ba('0x28')],_0x40c4d0[_0x97ba('0x76')]||_0x40c4d0[_0x97ba('0x3f')][_0x97ba('0x34')]);}if(_0x399992[_0x97ba('0x64')]['attachments']&&_0x399992[_0x97ba('0x64')][_0x97ba('0xa6')][_0x97ba('0x4f')]){for(var _0x2bb140=0x0;_0x2bb140<_0x399992[_0x97ba('0x64')][_0x97ba('0xa6')]['length'];_0x2bb140+=0x1){_0x399992[_0x97ba('0x64')][_0x97ba('0xa6')][_0x2bb140]={'filename':_0x399992[_0x97ba('0x64')][_0x97ba('0xa6')][_0x2bb140]['name'],'path':path[_0x97ba('0xa7')](config[_0x97ba('0xa8')],_0x97ba('0xa9'),_0x399992[_0x97ba('0x64')][_0x97ba('0xa6')][_0x2bb140]['basename'])};}}var _0xe2e4e8=_0x40c4d0['getSmtpOptions']();return respondWithRpcPromise(_0x97ba('0xaa'),_0x97ba('0xab'),{'account':_0xe2e4e8,'message':_0x399992[_0x97ba('0x64')]});})[_0x97ba('0x11')](function(_0x454da7){if(!_0x454da7)return;_0x23b8fd=_0x454da7;if(!_0x168c01[_0x97ba('0xa1')])throw new Error(_0x97ba('0xac'));if(_0x168c01['List'][_0x97ba('0xad')]['length'])return _0x168c01[_0x97ba('0xa1')]['Contacts'][0x0];return db[_0x97ba('0x87')][_0x97ba('0x69')](_['defaults'](_0x399992['body'],{'firstName':_0x399992[_0x97ba('0x64')]['to'],'email':_0x399992[_0x97ba('0x64')]['to'],'phone':_0x399992[_0x97ba('0x64')]['to'],'ListId':_0x168c01[_0x97ba('0xae')]}));})[_0x97ba('0x11')](function(_0x127785){if(!_0x127785)return;var _0x2685ea={'UserId':_0x399992['user']['id'],'ContactId':_0x127785['id'],'MailAccountId':_0x168c01['id'],'inReplyTo':_0x23b8fd[_0x97ba('0xaf')],'to':_0x399992[_0x97ba('0x64')][_0x97ba('0xa5')],'cc':_0x399992['body']['cc'],'subject':_0x399992[_0x97ba('0x64')]['subject'],'attach':_0x399992[_0x97ba('0x64')][_0x97ba('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x97ba('0x9e')),'lastMsgDirection':_0x97ba('0xb1'),'Messages':[_[_0x97ba('0x55')](_0x399992[_0x97ba('0x64')],{'messageId':_0x23b8fd['messageId'],'sentAt':moment()[_0x97ba('0xb2')](_0x97ba('0x9e')),'read':!![],'MailAccountId':_0x168c01['id'],'UserId':_0x399992[_0x97ba('0x34')]['id'],'ContactId':_0x127785['id']})]};if(_0x399992[_0x97ba('0x64')][_0x97ba('0xb3')]){_0x2685ea=_[_0x97ba('0x55')](_0x2685ea,_0x399992[_0x97ba('0x64')][_0x97ba('0xb3')]);}return db[_0x97ba('0x85')]['create'](_0x2685ea,{'include':[{'model':db[_0x97ba('0x9b')],'as':_0x97ba('0xb4')}]});})[_0x97ba('0x11')](respondWithResult(_0x1de983,null))['catch'](handleError(_0x1de983,null));};exports[_0x97ba('0xb5')]=function(_0x54fedb,_0x302879){return db['MailAccount'][_0x97ba('0x63')]({'where':{'id':_0x54fedb[_0x97ba('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x97ba('0x3f'),'raw':!![],'include':[{'model':db[_0x97ba('0xa4')],'as':_0x97ba('0xa4'),'raw':!![]}]}]})[_0x97ba('0x11')](handleEntityNotFound(_0x302879,null))[_0x97ba('0x11')](function(_0x10836b){if(!_0x10836b[_0x97ba('0x3f')])return;var _0x4d8de5=_0x10836b[_0x97ba('0xb6')]();return respondWithRpcPromise(_0x97ba('0xb7'),_0x97ba('0xb5'),{'account':_0x4d8de5});})[_0x97ba('0x11')](respondWithResult(_0x302879,null))['catch'](handleError(_0x302879,null));};exports[_0x97ba('0x25')]=function(_0x399fb3,_0x5dbda4){return db['MailAccount'][_0x97ba('0x63')]({'where':{'id':_0x399fb3[_0x97ba('0x5e')]['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x5dbda4,null))[_0x97ba('0x11')](function(_0xaa6266){if(_0xaa6266&&_0xaa6266[_0x97ba('0x3d')]){throw new db[(_0x97ba('0xb8'))][(_0x97ba('0xb9'))](_0x97ba('0xba'));}return _0xaa6266;})[_0x97ba('0x11')](removeEntity(_0x5dbda4,null))['catch'](handleError(_0x5dbda4,null));};exports[_0x97ba('0xbb')]=function(_0x56e84b,_0x5c94f3){return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x56e84b['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x5c94f3,null))[_0x97ba('0x11')](function(_0x45a06b){if(_0x45a06b){return _0x45a06b[_0x97ba('0xbb')](_0x56e84b[_0x97ba('0x64')][_0x97ba('0x6c')],_[_0x97ba('0x86')](_0x56e84b['body'],[_0x97ba('0x6c'),'id'])||{})['spread'](function(_0x5abf9e){for(var _0x5d8756=0x0;_0x5d8756<_0x56e84b['body'][_0x97ba('0x6c')][_0x97ba('0x4f')];_0x5d8756+=0x1){socket[_0x97ba('0xbc')](_0x97ba('0xbd'),{'UserId':Number(_0x56e84b['body']['ids'][_0x5d8756]),'MailAccountId':Number(_0x56e84b[_0x97ba('0x5e')]['id'])});}return _0x5abf9e;});}})['then'](respondWithResult(_0x5c94f3,null))[_0x97ba('0x5d')](handleError(_0x5c94f3,null));};exports[_0x97ba('0xbe')]=function(_0x1f7090,_0x2b2260){return db[_0x97ba('0x43')][_0x97ba('0x63')]({'where':{'id':_0x1f7090[_0x97ba('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b2260,null))[_0x97ba('0x11')](function(_0x389feb){if(_0x389feb){return _0x389feb[_0x97ba('0xbe')](_0x1f7090[_0x97ba('0x4a')]['ids'])[_0x97ba('0x11')](function(){if(_[_0x97ba('0xbf')](_0x1f7090['query'][_0x97ba('0x6c')])){for(var _0xa4b1aa=0x0;_0xa4b1aa<_0x1f7090[_0x97ba('0x4a')][_0x97ba('0x6c')][_0x97ba('0x4f')];_0xa4b1aa+=0x1){socket[_0x97ba('0xbc')](_0x97ba('0xc0'),{'UserId':Number(_0x1f7090[_0x97ba('0x4a')][_0x97ba('0x6c')][_0xa4b1aa]),'MailAccountId':Number(_0x1f7090[_0x97ba('0x5e')]['id'])});}}else{socket[_0x97ba('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x1f7090['query'][_0x97ba('0x6c')]),'MailAccountId':Number(_0x1f7090['params']['id'])});}});}})[_0x97ba('0x11')](respondWithStatusCode(_0x2b2260,null))[_0x97ba('0x5d')](handleError(_0x2b2260,null));};exports['getAgents']=function(_0x1582ac,_0x455f65){var _0x23e8c2={};var _0x49a16e={};var _0x5c3dda;var _0x2d8d33;return db[_0x97ba('0x43')][_0x97ba('0x70')]({'where':{'id':_0x1582ac['params']['id']}})[_0x97ba('0x11')](handleEntityNotFound(_0x455f65,null))[_0x97ba('0x11')](function(_0x3447b4){if(_0x3447b4){_0x5c3dda=_0x3447b4;_0x49a16e[_0x97ba('0x48')]=_[_0x97ba('0x62')](db[_0x97ba('0xc1')]['rawAttributes']);_0x49a16e[_0x97ba('0x4a')]=_[_0x97ba('0x62')](_0x1582ac['query']);_0x49a16e[_0x97ba('0x4b')]=_['intersection'](_0x49a16e[_0x97ba('0x48')],_0x49a16e[_0x97ba('0x4a')]);_0x23e8c2[_0x97ba('0x4d')]=_['intersection'](_0x49a16e['model'],qs[_0x97ba('0x4e')](_0x1582ac[_0x97ba('0x4a')][_0x97ba('0x4e')]));_0x23e8c2[_0x97ba('0x4d')]=_0x23e8c2[_0x97ba('0x4d')][_0x97ba('0x4f')]?_0x23e8c2[_0x97ba('0x4d')]:_0x49a16e[_0x97ba('0x48')];_0x23e8c2[_0x97ba('0x71')]=qs[_0x97ba('0x52')](_0x1582ac[_0x97ba('0x4a')][_0x97ba('0x52')]);_0x23e8c2[_0x97ba('0x53')]=qs[_0x97ba('0x4b')](_[_0x97ba('0x72')](_0x1582ac[_0x97ba('0x4a')],_0x49a16e['filters']));if(_0x1582ac['query'][_0x97ba('0x54')]){_0x23e8c2[_0x97ba('0x53')]=_[_0x97ba('0x55')](_0x23e8c2[_0x97ba('0x53')],{'$or':_['map'](_0x23e8c2[_0x97ba('0x4d')],function(_0x1c807e){var _0x301e83={};_0x301e83[_0x1c807e]={'$like':'%'+_0x1582ac[_0x97ba('0x4a')]['filter']+'%'};return _0x301e83;})});}_0x23e8c2=_[_0x97ba('0x55')]({},_0x23e8c2,_0x1582ac[_0x97ba('0x57')]);return _0x5c3dda[_0x97ba('0xc2')](_0x23e8c2);}})[_0x97ba('0x11')](function(_0x337700){if(_0x337700){_0x2d8d33=_0x337700[_0x97ba('0x4f')];if(!_0x1582ac[_0x97ba('0x4a')][_0x97ba('0x50')](_0x97ba('0x51'))){_0x23e8c2[_0x97ba('0x20')]=qs[_0x97ba('0x20')](_0x1582ac[_0x97ba('0x4a')]['limit']);_0x23e8c2['offset']=qs[_0x97ba('0x1f')](_0x1582ac[_0x97ba('0x4a')][_0x97ba('0x1f')]);}return _0x5c3dda[_0x97ba('0xc2')](_0x23e8c2);}})[_0x97ba('0x11')](function(_0x218b23){if(_0x218b23){return _0x218b23?{'count':_0x2d8d33,'rows':_0x218b23}:null;}})[_0x97ba('0x11')](respondWithResult(_0x455f65,null))['catch'](handleError(_0x455f65,null));}; \ No newline at end of file +var _0x5883=['attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','getAgents','bluebird','util','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','params','Pause','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','findOne','Disposition','nolimit','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','key','email','isNil','active','description','role','UserProfileSection','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','ListId','messageId'];(function(_0x456ce0,_0x284725){var _0x4fe64e=function(_0x17a113){while(--_0x17a113){_0x456ce0['push'](_0x456ce0['shift']());}};_0x4fe64e(++_0x284725);}(_0x5883,0xcd));var _0x3588=function(_0x3438ac,_0x154a2b){_0x3438ac=_0x3438ac-0x0;var _0x48aeeb=_0x5883[_0x3438ac];return _0x48aeeb;};'use strict';var moment=require('moment');var BPromise=require(_0x3588('0x0'));var util=require(_0x3588('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x3588('0x2'));var Redis=require('ioredis');var qs=require(_0x3588('0x3'));var logger=require('../../config/logger')(_0x3588('0x4'));var config=require(_0x3588('0x5'));var db=require(_0x3588('0x6'))['db'];config[_0x3588('0x7')]=_['defaults'](config[_0x3588('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x3588('0x8'))(new Redis(config[_0x3588('0x7')]));require(_0x3588('0x9'))[_0x3588('0xa')](socket);var jayson=require(_0x3588('0xb'));var client=jayson[_0x3588('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x227d34,_0x3c19fe,_0x1be4f9,_0x3d2cdd){return new BPromise(function(_0x59429b,_0x2d4d1d){var _0x4f53f4=_0x3d2cdd||client;return _0x4f53f4[_0x3588('0xd')](_0x227d34,_0x1be4f9)[_0x3588('0xe')](function(_0x461401){logger[_0x3588('0xf')](_0x3588('0x10'),_0x3c19fe,_0x3588('0x11'));logger['debug'](_0x3588('0x12'),_0x3c19fe,'request\x20sent',JSON[_0x3588('0x13')](_0x461401));if(_0x461401['error']){if(_0x461401[_0x3588('0x14')][_0x3588('0x15')]===0x1f4){logger[_0x3588('0x14')](_0x3588('0x10'),_0x3c19fe,_0x461401[_0x3588('0x14')][_0x3588('0x16')]);return _0x2d4d1d(_0x461401[_0x3588('0x14')][_0x3588('0x16')]);}logger[_0x3588('0x14')](_0x3588('0x10'),_0x3c19fe,_0x461401[_0x3588('0x14')][_0x3588('0x16')]);return _0x59429b(_0x461401['error']['message']);}else{logger[_0x3588('0xf')](_0x3588('0x10'),_0x3c19fe,_0x3588('0x11'));_0x59429b(_0x461401[_0x3588('0x17')][_0x3588('0x16')]);}})[_0x3588('0x18')](function(_0x15f770){logger[_0x3588('0x14')](_0x3588('0x10'),_0x3c19fe,_0x15f770);_0x2d4d1d(_0x15f770);});});}function respondWithStatusCode(_0x686218,_0x476c03){_0x476c03=_0x476c03||0xcc;return function(_0xe0871f){if(_0xe0871f){return _0x686218[_0x3588('0x19')](_0x476c03);}return _0x686218[_0x3588('0x1a')](_0x476c03)[_0x3588('0x1b')]();};}function respondWithResult(_0x11df69,_0x526f95){_0x526f95=_0x526f95||0xc8;return function(_0xebd7cc){if(_0xebd7cc){return _0x11df69[_0x3588('0x1a')](_0x526f95)[_0x3588('0x1c')](_0xebd7cc);}};}function respondWithFilteredResult(_0x110137,_0x32056e){return function(_0x5261e3){if(_0x5261e3){var _0x40cec0=typeof _0x32056e[_0x3588('0x1d')]===_0x3588('0x1e')&&typeof _0x32056e[_0x3588('0x1f')]===_0x3588('0x1e');var _0x2d00fe=_0x5261e3[_0x3588('0x20')];var _0x204e5f=_0x40cec0?0x0:_0x32056e[_0x3588('0x1d')];var _0x32e5c7=_0x40cec0?_0x5261e3['count']:_0x32056e[_0x3588('0x1d')]+_0x32056e[_0x3588('0x1f')];var _0x1e611a;if(_0x32e5c7>=_0x2d00fe){_0x32e5c7=_0x2d00fe;_0x1e611a=0xc8;}else{_0x1e611a=0xce;}_0x110137['status'](_0x1e611a);return _0x110137[_0x3588('0x21')]('Content-Range',_0x204e5f+'-'+_0x32e5c7+'/'+_0x2d00fe)[_0x3588('0x1c')](_0x5261e3);}return null;};}function saveUpdates(_0x5ae3cc){return function(_0x5e9ddb){if(_0x5e9ddb){return _0x5e9ddb[_0x3588('0x22')](_0x5ae3cc)[_0x3588('0xe')](function(_0x380ea2){return _0x380ea2;});}return null;};}function removeEntity(_0x4f4d50){return function(_0x2bcbec){if(_0x2bcbec){return _0x2bcbec['destroy']()[_0x3588('0xe')](function(){var _0x3b3b25=_0x2bcbec[_0x3588('0x23')]({'plain':!![]});var _0x279bee=_0x3588('0x24');return db[_0x3588('0x25')][_0x3588('0x26')]({'where':{'type':_0x279bee,'resourceId':_0x3b3b25['id']}})['then'](function(){return _0x2bcbec;});})[_0x3588('0xe')](function(){_0x4f4d50[_0x3588('0x1a')](0xcc)[_0x3588('0x1b')]();});}};}function handleEntityNotFound(_0x385e82){return function(_0x47db90){if(!_0x47db90){_0x385e82['sendStatus'](0x194);}return _0x47db90;};}function handleError(_0x41d94a,_0x40f306){_0x40f306=_0x40f306||0x1f4;return function(_0x2adc7a){logger[_0x3588('0x14')](_0x2adc7a[_0x3588('0x27')]);if(_0x2adc7a[_0x3588('0x28')]){delete _0x2adc7a[_0x3588('0x28')];}_0x41d94a[_0x3588('0x1a')](_0x40f306)[_0x3588('0x29')](_0x2adc7a);};}function getImapHost(_0x347110){switch(_0x347110){case _0x3588('0x2a'):return'imap.gmail.com';case _0x3588('0x2b'):return'imap.mail.yahoo.com';case _0x3588('0x2c'):return _0x3588('0x2d');case _0x3588('0x2e'):return _0x3588('0x2f');}throw new Error(_0x3588('0x30'),_0x347110);}function getSmtpHost(_0x1f6094){switch(_0x1f6094){case _0x3588('0x2a'):return _0x3588('0x31');case _0x3588('0x2b'):return _0x3588('0x32');case _0x3588('0x2c'):return'smtp-mail.outlook.com';case _0x3588('0x2e'):return _0x3588('0x33');}throw new Error(_0x3588('0x30'),_0x1f6094);}function getAuthenticationOptions(_0x55dcb8,_0x1390c2){var _0x58292c={};var _0x35c4fa={};if(_0x55dcb8){_0x58292c['user']=_0x35c4fa[_0x3588('0x34')]=_0x1390c2[_0x3588('0x35')];_0x58292c[_0x3588('0x36')]=_0x35c4fa[_0x3588('0x37')]=_0x1390c2[_0x3588('0x36')];if(_0x1390c2[_0x3588('0x38')]){_0x58292c[_0x3588('0x38')]=_0x35c4fa[_0x3588('0x38')]=!![];_0x58292c['CloudProviderId']=_0x35c4fa[_0x3588('0x39')]=_0x1390c2[_0x3588('0x39')];_0x58292c[_0x3588('0x36')]=_0x35c4fa[_0x3588('0x37')]=null;}else{_0x58292c[_0x3588('0x39')]=_0x35c4fa['CloudProviderId']=null;}_0x58292c[_0x3588('0x3a')]=getImapHost(_0x55dcb8);_0x58292c[_0x3588('0x3b')]=0x3e1;_0x35c4fa[_0x3588('0x3a')]=getSmtpHost(_0x55dcb8);_0x35c4fa['port']=0x24b;_0x35c4fa['secure']=![];_0x58292c['service']=_0x35c4fa[_0x3588('0x3c')]=null;}else{if(_0x1390c2[_0x3588('0x3d')]){_0x58292c[_0x3588('0x34')]=_0x35c4fa[_0x3588('0x34')]=_0x1390c2[_0x3588('0x35')];_0x58292c[_0x3588('0x36')]=_0x35c4fa['pass']=_0x1390c2[_0x3588('0x36')];}else{_0x58292c[_0x3588('0x3d')]=_0x35c4fa[_0x3588('0x3d')]=![];_0x58292c[_0x3588('0x34')]=_0x35c4fa[_0x3588('0x34')]=null;_0x58292c[_0x3588('0x36')]=_0x35c4fa[_0x3588('0x37')]=null;}_0x58292c[_0x3588('0x3a')]=_0x1390c2['Imap']['host'];_0x58292c[_0x3588('0x3b')]=_0x1390c2[_0x3588('0x3e')][_0x3588('0x3b')];_0x35c4fa[_0x3588('0x3a')]=_0x1390c2[_0x3588('0x3f')][_0x3588('0x3a')];_0x35c4fa[_0x3588('0x3b')]=_0x1390c2[_0x3588('0x3f')][_0x3588('0x3b')];}return{'Imap':_0x58292c,'Smtp':_0x35c4fa};}exports[_0x3588('0x40')]=function(_0x576b88,_0x7a2128){var _0x499670={'include':[{'model':db[_0x3588('0x41')],'as':_0x3588('0x3e')},{'model':db[_0x3588('0x42')],'as':_0x3588('0x3f')},{'model':db['Pause'],'as':_0x3588('0x43')}]},_0x5b484d={},_0x3fd3b4={'count':0x0,'rows':[]};var _0x28edd3=_[_0x3588('0x44')](db[_0x3588('0x45')][_0x3588('0x46')],function(_0x182df6){return{'name':_0x182df6[_0x3588('0x47')],'type':_0x182df6[_0x3588('0x48')]['key']};});_0x5b484d[_0x3588('0x49')]=_[_0x3588('0x44')](_0x28edd3,'name');_0x5b484d[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x576b88[_0x3588('0x4a')]);_0x5b484d[_0x3588('0x4c')]=_[_0x3588('0x4d')](_0x5b484d[_0x3588('0x49')],_0x5b484d[_0x3588('0x4a')]);_0x499670[_0x3588('0x4e')]=_[_0x3588('0x4d')](_0x5b484d[_0x3588('0x49')],qs[_0x3588('0x4f')](_0x576b88[_0x3588('0x4a')][_0x3588('0x4f')]));_0x499670[_0x3588('0x4e')]=_0x499670[_0x3588('0x4e')][_0x3588('0x50')]?_0x499670[_0x3588('0x4e')]:_0x5b484d[_0x3588('0x49')];if(!_0x576b88[_0x3588('0x4a')][_0x3588('0x51')]('nolimit')){_0x499670[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x576b88[_0x3588('0x4a')][_0x3588('0x1f')]);_0x499670[_0x3588('0x1d')]=qs['offset'](_0x576b88[_0x3588('0x4a')][_0x3588('0x1d')]);}_0x499670[_0x3588('0x52')]=qs[_0x3588('0x53')](_0x576b88['query']['sort']);_0x499670['where']=qs[_0x3588('0x4c')](_[_0x3588('0x54')](_0x576b88['query'],_0x5b484d['filters']),_0x28edd3);if(_0x576b88[_0x3588('0x4a')][_0x3588('0x55')]){_0x499670[_0x3588('0x56')]=_['merge'](_0x499670[_0x3588('0x56')],{'$or':_['map'](_0x28edd3,function(_0x4e4e9b){if(_0x4e4e9b[_0x3588('0x48')]!==_0x3588('0x57')){var _0x56427f={};_0x56427f[_0x4e4e9b[_0x3588('0x28')]]={'$like':'%'+_0x576b88[_0x3588('0x4a')][_0x3588('0x55')]+'%'};return _0x56427f;}})});}_0x499670=_[_0x3588('0x58')]({},_0x499670,_0x576b88[_0x3588('0x59')]);var _0x5f3eff={'where':_0x499670[_0x3588('0x56')]};return db[_0x3588('0x45')][_0x3588('0x20')](_0x5f3eff)[_0x3588('0xe')](function(_0xd89f06){_0x3fd3b4[_0x3588('0x20')]=_0xd89f06;if(_0x576b88['query'][_0x3588('0x5a')]){_0x499670[_0x3588('0x5b')]=[{'all':!![]}];}return db[_0x3588('0x45')][_0x3588('0x5c')](_0x499670);})['then'](function(_0x536476){_0x3fd3b4['rows']=_0x536476;return _0x3fd3b4;})[_0x3588('0xe')](respondWithFilteredResult(_0x7a2128,_0x499670))[_0x3588('0x18')](handleError(_0x7a2128,null));};exports[_0x3588('0x5d')]=function(_0x55215a,_0x344044){var _0x1f0e3d={'raw':![],'where':{'id':_0x55215a[_0x3588('0x5e')]['id']},'include':[{'model':db[_0x3588('0x41')],'as':'Imap'},{'model':db[_0x3588('0x42')],'as':'Smtp'},{'model':db[_0x3588('0x5f')],'as':_0x3588('0x43')}]},_0x5f3746={};_0x5f3746['model']=_[_0x3588('0x4b')](db['MailAccount']['rawAttributes']);_0x5f3746[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x55215a[_0x3588('0x4a')]);_0x5f3746[_0x3588('0x4c')]=_[_0x3588('0x4d')](_0x5f3746['model'],_0x5f3746['query']);_0x1f0e3d['attributes']=_[_0x3588('0x4d')](_0x5f3746[_0x3588('0x49')],qs['fields'](_0x55215a[_0x3588('0x4a')][_0x3588('0x4f')]));_0x1f0e3d[_0x3588('0x4e')]=_0x1f0e3d[_0x3588('0x4e')][_0x3588('0x50')]?_0x1f0e3d['attributes']:_0x5f3746[_0x3588('0x49')];if(_0x55215a['query'][_0x3588('0x5a')]){_0x1f0e3d[_0x3588('0x5b')]=[{'all':!![]}];}_0x1f0e3d=_[_0x3588('0x58')]({},_0x1f0e3d,_0x55215a[_0x3588('0x59')]);return db[_0x3588('0x45')][_0x3588('0x60')](_0x1f0e3d)[_0x3588('0xe')](handleEntityNotFound(_0x344044,null))[_0x3588('0xe')](respondWithResult(_0x344044,null))[_0x3588('0x18')](handleError(_0x344044,null));};exports[_0x3588('0x22')]=function(_0x449175,_0x4f077f){if(_0x449175[_0x3588('0x61')]['id']){delete _0x449175[_0x3588('0x61')]['id'];}var _0x360da5=_0x449175[_0x3588('0x61')][_0x3588('0x62')]===_0x3588('0x63')?null:_0x449175['body'][_0x3588('0x62')];var _0x22b6a8=_0x449175['body'][_0x3588('0x3e')]||{};var _0x55ed3f=_0x449175['body'][_0x3588('0x3f')]||{};if(_0x360da5){_0x22b6a8[_0x3588('0x3a')]=getImapHost(_0x360da5);_0x22b6a8['port']=0x3e1;_0x55ed3f[_0x3588('0x3a')]=getSmtpHost(_0x360da5);_0x55ed3f['port']=0x24b;_0x55ed3f['secure']=![];}if(_0x55ed3f[_0x3588('0x38')]){_0x55ed3f[_0x3588('0x64')]=![];}else{_0x55ed3f[_0x3588('0x39')]=null;}if(!_0x22b6a8[_0x3588('0x38')])_0x22b6a8[_0x3588('0x39')]=null;_0x449175[_0x3588('0x61')][_0x3588('0x3e')]=_0x22b6a8;_0x449175[_0x3588('0x61')][_0x3588('0x3f')]=_0x55ed3f;return db[_0x3588('0x45')]['find']({'where':{'id':_0x449175[_0x3588('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3588('0x3e')},{'model':db[_0x3588('0x42')],'as':_0x3588('0x3f')},{'model':db[_0x3588('0x5f')],'as':_0x3588('0x43')}]})[_0x3588('0xe')](handleEntityNotFound(_0x4f077f,null))[_0x3588('0xe')](function(_0x831fc6){if(!_0x831fc6)throw new Error(_0x3588('0x65'));if(_0x831fc6[_0x3588('0x3c')])delete _0x449175[_0x3588('0x61')][_0x3588('0x3e')];return _0x831fc6;})[_0x3588('0xe')](saveUpdates(_0x449175[_0x3588('0x61')],null))[_0x3588('0xe')](function(_0xe0c53b){if(!_0x449175['body'][_0x3588('0x3e')])return _0xe0c53b;return db[_0x3588('0x41')][_0x3588('0x22')](_0x449175[_0x3588('0x61')]['Imap'],{'where':{'MailAccountId':_0xe0c53b['id']}})[_0x3588('0xe')](function(){return _0xe0c53b;});})['then'](function(_0x2e5132){if(!_0x449175['body'][_0x3588('0x3f')])return _0x2e5132;return db[_0x3588('0x42')][_0x3588('0x22')](_0x449175['body'][_0x3588('0x3f')],{'where':{'MailAccountId':_0x2e5132['id']}})[_0x3588('0xe')](function(){return _0x2e5132;});})['then'](respondWithResult(_0x4f077f,null))['catch'](handleError(_0x4f077f,null));};exports['describe']=function(_0x533ee9,_0x45ecc8){return db[_0x3588('0x45')][_0x3588('0x66')]()[_0x3588('0xe')](respondWithResult(_0x45ecc8,null))['catch'](handleError(_0x45ecc8,null));};exports[_0x3588('0x67')]=function(_0x3368ec,_0x573e4b){if(_0x3368ec[_0x3588('0x61')]['id']){delete _0x3368ec[_0x3588('0x61')]['id'];}return db['MailAccount'][_0x3588('0x60')]({'where':{'id':_0x3368ec[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x573e4b,null))['then'](function(_0x5ae270){if(_0x5ae270){_0x3368ec[_0x3588('0x61')][_0x3588('0x68')]=_0x5ae270['id'];return db['Disposition'][_0x3588('0x69')](_0x3368ec[_0x3588('0x61')]);}})['then'](respondWithResult(_0x573e4b,null))['catch'](handleError(_0x573e4b,null));};exports['getDispositions']=function(_0x47892e,_0x3eba94){var _0x576bb7={'raw':![],'where':{}};var _0x478b9f={};var _0x191292={'count':0x0,'rows':[]};return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x47892e[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x3eba94,null))[_0x3588('0xe')](function(_0x5daa38){if(_0x5daa38){_0x478b9f[_0x3588('0x49')]=_[_0x3588('0x4b')](db[_0x3588('0x6b')][_0x3588('0x46')]);_0x478b9f[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x47892e[_0x3588('0x4a')]);_0x478b9f[_0x3588('0x4c')]=_[_0x3588('0x4d')](_0x478b9f[_0x3588('0x49')],_0x478b9f[_0x3588('0x4a')]);_0x576bb7[_0x3588('0x4e')]=_[_0x3588('0x4d')](_0x478b9f['model'],qs[_0x3588('0x4f')](_0x47892e['query'][_0x3588('0x4f')]));_0x576bb7[_0x3588('0x4e')]=_0x576bb7[_0x3588('0x4e')][_0x3588('0x50')]?_0x576bb7[_0x3588('0x4e')]:_0x478b9f['model'];if(!_0x47892e[_0x3588('0x4a')][_0x3588('0x51')](_0x3588('0x6c'))){_0x576bb7[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x47892e[_0x3588('0x4a')][_0x3588('0x1f')]);_0x576bb7[_0x3588('0x1d')]=qs['offset'](_0x47892e[_0x3588('0x4a')][_0x3588('0x1d')]);}_0x576bb7['order']=qs[_0x3588('0x53')](_0x47892e[_0x3588('0x4a')][_0x3588('0x53')]);_0x576bb7[_0x3588('0x56')]=qs['filters'](_[_0x3588('0x54')](_0x47892e[_0x3588('0x4a')],_0x478b9f[_0x3588('0x4c')]));_0x576bb7['where'][_0x3588('0x68')]=_0x5daa38['id'];if(_0x47892e[_0x3588('0x4a')]['filter']){_0x576bb7[_0x3588('0x56')]=_[_0x3588('0x58')](_0x576bb7['where'],{'$or':_['map'](_0x576bb7[_0x3588('0x4e')],function(_0x4245f1){var _0x456e5b={};_0x456e5b[_0x4245f1]={'$like':'%'+_0x47892e[_0x3588('0x4a')]['filter']+'%'};return _0x456e5b;})});}_0x576bb7=_[_0x3588('0x58')]({},_0x576bb7,_0x47892e['options']);return db[_0x3588('0x6b')][_0x3588('0x20')]({'where':_0x576bb7[_0x3588('0x56')]})[_0x3588('0xe')](function(_0x194c72){_0x191292['count']=_0x194c72;if(_0x47892e[_0x3588('0x4a')][_0x3588('0x5a')]){_0x576bb7['include']=[{'all':!![]}];}return db[_0x3588('0x6b')][_0x3588('0x5c')](_0x576bb7);})[_0x3588('0xe')](function(_0xb03f0){_0x191292[_0x3588('0x6d')]=_0xb03f0;return _0x191292;});}})['then'](respondWithFilteredResult(_0x3eba94,_0x576bb7))[_0x3588('0x18')](handleError(_0x3eba94,null));};exports[_0x3588('0x6e')]=function(_0x159d3d,_0xf07378){return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0x159d3d[_0x3588('0x5e')]['id']}})['then'](handleEntityNotFound(_0xf07378,null))[_0x3588('0xe')](function(_0x5bfc18){if(_0x5bfc18){return _0x5bfc18[_0x3588('0x6e')](_0x159d3d[_0x3588('0x4a')][_0x3588('0x6f')]);}})[_0x3588('0xe')](respondWithStatusCode(_0xf07378,null))['catch'](handleError(_0xf07378,null));};exports['addAnswer']=function(_0x1539ff,_0xd56c50){if(_0x1539ff['body']['id']){delete _0x1539ff[_0x3588('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x1539ff['params']['id']}})['then'](handleEntityNotFound(_0xd56c50,null))[_0x3588('0xe')](function(_0x5baf67){if(_0x5baf67){_0x1539ff['body']['MailAccountId']=_0x5baf67['id'];return db['CannedAnswer'][_0x3588('0x69')](_0x1539ff['body']);}})[_0x3588('0xe')](respondWithResult(_0xd56c50,null))[_0x3588('0x18')](handleError(_0xd56c50,null));};exports[_0x3588('0x70')]=function(_0x311100,_0x37144c){var _0x9b5aad={'raw':![],'where':{}};var _0x4aa312={};var _0x38093d={'count':0x0,'rows':[]};return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x311100['params']['id']}})['then'](handleEntityNotFound(_0x37144c,null))[_0x3588('0xe')](function(_0x59b9c3){if(_0x59b9c3){_0x4aa312[_0x3588('0x49')]=_['keys'](db[_0x3588('0x71')][_0x3588('0x46')]);_0x4aa312[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x311100[_0x3588('0x4a')]);_0x4aa312[_0x3588('0x4c')]=_['intersection'](_0x4aa312[_0x3588('0x49')],_0x4aa312[_0x3588('0x4a')]);_0x9b5aad['attributes']=_['intersection'](_0x4aa312[_0x3588('0x49')],qs['fields'](_0x311100['query']['fields']));_0x9b5aad[_0x3588('0x4e')]=_0x9b5aad[_0x3588('0x4e')][_0x3588('0x50')]?_0x9b5aad[_0x3588('0x4e')]:_0x4aa312[_0x3588('0x49')];if(!_0x311100[_0x3588('0x4a')][_0x3588('0x51')](_0x3588('0x6c'))){_0x9b5aad[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x311100['query'][_0x3588('0x1f')]);_0x9b5aad[_0x3588('0x1d')]=qs['offset'](_0x311100[_0x3588('0x4a')]['offset']);}_0x9b5aad[_0x3588('0x52')]=qs[_0x3588('0x53')](_0x311100[_0x3588('0x4a')][_0x3588('0x53')]);_0x9b5aad[_0x3588('0x56')]=qs[_0x3588('0x4c')](_['pick'](_0x311100[_0x3588('0x4a')],_0x4aa312[_0x3588('0x4c')]));_0x9b5aad[_0x3588('0x56')][_0x3588('0x68')]=_0x59b9c3['id'];if(_0x311100[_0x3588('0x4a')]['filter']){_0x9b5aad[_0x3588('0x56')]=_[_0x3588('0x58')](_0x9b5aad[_0x3588('0x56')],{'$or':_[_0x3588('0x44')](_0x9b5aad[_0x3588('0x4e')],function(_0x5157d){var _0x104306={};_0x104306[_0x5157d]={'$like':'%'+_0x311100[_0x3588('0x4a')]['filter']+'%'};return _0x104306;})});}_0x9b5aad=_[_0x3588('0x58')]({},_0x9b5aad,_0x311100[_0x3588('0x59')]);return db['CannedAnswer'][_0x3588('0x20')]({'where':_0x9b5aad[_0x3588('0x56')]})[_0x3588('0xe')](function(_0x4c49c9){_0x38093d[_0x3588('0x20')]=_0x4c49c9;if(_0x311100['query'][_0x3588('0x5a')]){_0x9b5aad['include']=[{'all':!![]}];}return db[_0x3588('0x71')]['findAll'](_0x9b5aad);})[_0x3588('0xe')](function(_0x83cbfa){_0x38093d[_0x3588('0x6d')]=_0x83cbfa;return _0x38093d;});}})[_0x3588('0xe')](respondWithFilteredResult(_0x37144c,_0x9b5aad))[_0x3588('0x18')](handleError(_0x37144c,null));};exports[_0x3588('0x72')]=function(_0x4c4542,_0x6ab038){return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0x4c4542[_0x3588('0x5e')]['id']}})['then'](handleEntityNotFound(_0x6ab038,null))[_0x3588('0xe')](function(_0x2f0881){if(_0x2f0881){return _0x2f0881[_0x3588('0x72')](_0x4c4542['query'][_0x3588('0x6f')]);}})[_0x3588('0xe')](respondWithStatusCode(_0x6ab038,null))[_0x3588('0x18')](handleError(_0x6ab038,null));};exports[_0x3588('0x69')]=function(_0x5a92e0,_0x3740d7){var _0x383305={'name':_0x5a92e0['body'][_0x3588('0x28')],'key':_0x5a92e0['body'][_0x3588('0x73')],'provider':_0x5a92e0['body'][_0x3588('0x62')]==='custom'?null:_0x5a92e0['body'][_0x3588('0x62')],'email':_0x5a92e0['body'][_0x3588('0x74')],'ListId':_0x5a92e0[_0x3588('0x61')]['ListId'],'active':!_[_0x3588('0x75')](_0x5a92e0['body']['active'])?_0x5a92e0[_0x3588('0x61')][_0x3588('0x76')]:!![],'description':_0x5a92e0['body'][_0x3588('0x77')]||null};var _0x1b4a8b=getAuthenticationOptions(_0x383305[_0x3588('0x62')],_0x5a92e0['body']);_0x383305['Imap']=_0x1b4a8b['Imap'];_0x383305[_0x3588('0x3f')]=_0x1b4a8b['Smtp'];return db[_0x3588('0x45')]['create'](_0x383305,{'include':[{'model':db[_0x3588('0x42')],'as':'Smtp'},{'model':db[_0x3588('0x41')],'as':'Imap'}]})['then'](function(_0x313eab){var _0x43a06d=_0x5a92e0[_0x3588('0x34')][_0x3588('0x23')]({'plain':!![]});if(!_0x43a06d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a06d[_0x3588('0x78')]===_0x3588('0x34')){var _0x66d8ca=_0x313eab[_0x3588('0x23')]({'plain':!![]});return db[_0x3588('0x79')]['find']({'where':{'name':_0x3588('0x24'),'userProfileId':_0x43a06d[_0x3588('0x7a')]},'raw':!![]})[_0x3588('0xe')](function(_0x23eaa5){if(_0x23eaa5&&_0x23eaa5['autoAssociation']===0x0){return db['UserProfileResource'][_0x3588('0x69')]({'name':_0x66d8ca['name'],'resourceId':_0x66d8ca['id'],'type':_0x23eaa5[_0x3588('0x28')],'sectionId':_0x23eaa5['id']},{})[_0x3588('0xe')](function(){return _0x313eab;});}else{return _0x313eab;}})[_0x3588('0x18')](function(_0x502bbb){logger[_0x3588('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502bbb);throw _0x502bbb;});}return _0x313eab;})[_0x3588('0xe')](respondWithResult(_0x3740d7,0xc9))[_0x3588('0x18')](handleError(_0x3740d7,null));};exports['getImap']=function(_0x53d85b,_0x4fbd05){return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x53d85b['params']['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x4fbd05,null))[_0x3588('0xe')](function(_0x521ce4){if(_0x521ce4){return _0x521ce4[_0x3588('0x7b')]();}return null;})[_0x3588('0xe')](respondWithResult(_0x4fbd05,null))[_0x3588('0x18')](handleError(_0x4fbd05,null));};exports[_0x3588('0x7c')]=function(_0x29e3c1,_0x1c5077){if(_0x29e3c1[_0x3588('0x61')]['id']){delete _0x29e3c1[_0x3588('0x61')]['id'];}return db['MailAccount'][_0x3588('0x60')]({'where':{'id':_0x29e3c1[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x1c5077,null))[_0x3588('0xe')](function(_0x323991){if(_0x323991){_0x29e3c1[_0x3588('0x61')][_0x3588('0x68')]=_0x323991['id'];return db[_0x3588('0x41')][_0x3588('0x69')](_0x29e3c1['body']);}})[_0x3588('0xe')](respondWithResult(_0x1c5077,null))[_0x3588('0x18')](handleError(_0x1c5077,null));};exports[_0x3588('0x7d')]=function(_0x22c638,_0x38e3c4){return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x22c638[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x38e3c4,null))['then'](function(_0x546cd6){if(_0x546cd6){return _0x546cd6[_0x3588('0x7e')](null);}return null;})[_0x3588('0xe')](respondWithStatusCode(_0x38e3c4,null))['catch'](handleError(_0x38e3c4,null));};exports['getSmtp']=function(_0x37f4a2,_0x402376){return db[_0x3588('0x45')]['findOne']({'where':{'id':_0x37f4a2[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x402376,null))[_0x3588('0xe')](function(_0x3a90ab){if(_0x3a90ab){return _0x3a90ab[_0x3588('0x7f')]();}return null;})[_0x3588('0xe')](respondWithResult(_0x402376,null))[_0x3588('0x18')](handleError(_0x402376,null));};exports[_0x3588('0x80')]=function(_0x4d8316,_0x13a462){if(_0x4d8316[_0x3588('0x61')]['id']){delete _0x4d8316['body']['id'];}return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0x4d8316[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x13a462,null))[_0x3588('0xe')](function(_0x193320){if(_0x193320){_0x4d8316[_0x3588('0x61')][_0x3588('0x68')]=_0x193320['id'];return db['MailServerOut'][_0x3588('0x69')](_0x4d8316['body']);}})[_0x3588('0xe')](respondWithResult(_0x13a462,null))[_0x3588('0x18')](handleError(_0x13a462,null));};exports[_0x3588('0x81')]=function(_0x4da7d2,_0x105381){return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x4da7d2[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x105381,null))[_0x3588('0xe')](function(_0x13be11){if(_0x13be11){return _0x13be11['setSmtp'](null);}return null;})[_0x3588('0xe')](respondWithStatusCode(_0x105381,null))[_0x3588('0x18')](handleError(_0x105381,null));};exports['addInteraction']=function(_0x2320ef,_0x41e3ec){return db['MailInteraction'][_0x3588('0x60')]({'where':{'id':_0x2320ef[_0x3588('0x5e')]['id']}})['then'](handleEntityNotFound(_0x41e3ec,null))[_0x3588('0xe')](function(_0x12ae1c){if(_0x12ae1c){return _0x12ae1c['addInteraction'](_0x2320ef[_0x3588('0x61')]['ids'],_['omit'](_0x2320ef[_0x3588('0x61')],[_0x3588('0x6f'),'id'])||{});}})[_0x3588('0xe')](respondWithResult(_0x41e3ec,null))[_0x3588('0x18')](handleError(_0x41e3ec,null));};exports['getInteractions']=function(_0x51e337,_0x2c4b51){var _0x29b751={'raw':![],'where':{}};var _0x217f20={};var _0x302f55={'count':0x0,'rows':[]};return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x51e337['params']['id']}})['then'](handleEntityNotFound(_0x2c4b51,null))['then'](function(_0x511bca){if(_0x511bca){_0x217f20['model']=_[_0x3588('0x4b')](db[_0x3588('0x82')]['rawAttributes']);_0x217f20[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x51e337['query']);_0x217f20['filters']=_[_0x3588('0x4d')](_0x217f20[_0x3588('0x49')],_0x217f20[_0x3588('0x4a')]);_0x29b751[_0x3588('0x4e')]=_[_0x3588('0x4d')](_0x217f20[_0x3588('0x49')],qs[_0x3588('0x4f')](_0x51e337[_0x3588('0x4a')][_0x3588('0x4f')]));_0x29b751[_0x3588('0x4e')]=_0x29b751[_0x3588('0x4e')][_0x3588('0x50')]?_0x29b751['attributes']:_0x217f20['model'];if(!_0x51e337[_0x3588('0x4a')]['hasOwnProperty'](_0x3588('0x6c'))){_0x29b751[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x51e337['query'][_0x3588('0x1f')]);_0x29b751[_0x3588('0x1d')]=qs[_0x3588('0x1d')](_0x51e337[_0x3588('0x4a')]['offset']);}_0x29b751['order']=qs[_0x3588('0x53')](_0x51e337[_0x3588('0x4a')][_0x3588('0x53')]);_0x29b751[_0x3588('0x56')]=qs[_0x3588('0x4c')](_[_0x3588('0x54')](_0x51e337[_0x3588('0x4a')],_0x217f20[_0x3588('0x4c')]));_0x29b751[_0x3588('0x56')][_0x3588('0x68')]=_0x511bca['id'];if(_0x51e337['query'][_0x3588('0x55')]){_0x29b751[_0x3588('0x56')]=_[_0x3588('0x58')](_0x29b751[_0x3588('0x56')],{'$or':_[_0x3588('0x44')](_0x29b751[_0x3588('0x4e')],function(_0x338912){var _0x3ef7d2={};_0x3ef7d2[_0x338912]={'$like':'%'+_0x51e337[_0x3588('0x4a')][_0x3588('0x55')]+'%'};return _0x3ef7d2;})});}_0x29b751=_[_0x3588('0x58')]({},_0x29b751,_0x51e337[_0x3588('0x59')]);return db[_0x3588('0x82')][_0x3588('0x20')]({'where':_0x29b751[_0x3588('0x56')]})[_0x3588('0xe')](function(_0x3cadb3){_0x302f55[_0x3588('0x20')]=_0x3cadb3;if(_0x51e337[_0x3588('0x4a')][_0x3588('0x5a')]){_0x29b751['include']=[{'model':db[_0x3588('0x83')],'as':_0x3588('0x84'),'required':![]},{'model':db[_0x3588('0x85')],'as':'Owner','attributes':[_0x3588('0x28'),_0x3588('0x86'),'internal'],'required':![]},{'model':db[_0x3588('0x87')],'as':_0x3588('0x88'),'attributes':['id',_0x3588('0x28'),_0x3588('0x89')],'where':_0x51e337[_0x3588('0x4a')][_0x3588('0x8a')]?{'id':_0x51e337[_0x3588('0x4a')][_0x3588('0x8a')]}:undefined,'required':_0x51e337['query'][_0x3588('0x8a')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x29b751);})[_0x3588('0xe')](function(_0x2dcbc2){_0x302f55[_0x3588('0x6d')]=_0x2dcbc2;return _0x302f55;});}})[_0x3588('0xe')](respondWithFilteredResult(_0x2c4b51,_0x29b751))[_0x3588('0x18')](handleError(_0x2c4b51,null));};exports[_0x3588('0x8b')]=function addApplications(_0x32d7db,_0x17be26){var _0x52a3a2=_0x32d7db[_0x3588('0x5e')]['id'];var _0x5f3315=_0x32d7db[_0x3588('0x61')];var _0x11b028=0xc8;var _0x172d5b=null;return db[_0x3588('0x8c')][_0x3588('0x8d')]({'isolationLevel':db[_0x3588('0x8c')][_0x3588('0x8e')][_0x3588('0x8f')][_0x3588('0x90')]},function(_0x1daa78){return db['MailAccount'][_0x3588('0x6a')]({'where':{'id':_0x52a3a2},'transaction':_0x1daa78})[_0x3588('0xe')](function(_0x41ed50){if(_0x41ed50){return db[_0x3588('0x91')][_0x3588('0x26')]({'where':{'MailAccountId':_0x52a3a2},'transaction':_0x1daa78})['then'](function(){var _0x8ca39a=_[_0x3588('0x44')](_0x5f3315,function(_0x1d2d9a){_0x1d2d9a[_0x3588('0x68')]=_0x52a3a2;return _0x1d2d9a;});return db[_0x3588('0x91')]['bulkCreate'](_0x8ca39a,{'transaction':_0x1daa78});});}else{_0x11b028=0x194;_0x172d5b=[];}});})[_0x3588('0xe')](function(){if(_0x11b028!==0x194){return db[_0x3588('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x52a3a2},'order':_0x3588('0x92')})['then'](function(_0x1ae4d5){_0x172d5b=_0x1ae4d5;});}})['catch'](function(_0xb3adc5){_0x11b028=0x1f4;logger[_0x3588('0x14')](_0xb3adc5[_0x3588('0x27')]);if(_0xb3adc5[_0x3588('0x28')]){delete _0xb3adc5[_0x3588('0x28')];}_0x172d5b=_0xb3adc5;})[_0x3588('0x93')](function(){if(_0x172d5b===null){_0x17be26[_0x3588('0x19')](_0x11b028);}else{if(_0x11b028===0x1f4){_0x17be26[_0x3588('0x1a')](_0x11b028)['send'](_0x172d5b);}else{_0x17be26[_0x3588('0x1a')](_0x11b028)[_0x3588('0x1c')](_0x172d5b);}}});};exports[_0x3588('0x94')]=function(_0x41aafe,_0x307508){var _0xf29a56={};var _0x226949={};var _0x4790d6;var _0x3771c3;return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x41aafe[_0x3588('0x5e')]['id']}})['then'](handleEntityNotFound(_0x307508,null))['then'](function(_0x318ce3){if(_0x318ce3){_0x4790d6=_0x318ce3;_0x226949[_0x3588('0x49')]=_['keys'](db[_0x3588('0x91')]['rawAttributes']);_0x226949[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x41aafe[_0x3588('0x4a')]);_0x226949[_0x3588('0x4c')]=_[_0x3588('0x4d')](_0x226949[_0x3588('0x49')],_0x226949[_0x3588('0x4a')]);_0xf29a56[_0x3588('0x4e')]=_['intersection'](_0x226949[_0x3588('0x49')],qs[_0x3588('0x4f')](_0x41aafe['query']['fields']));_0xf29a56[_0x3588('0x4e')]=_0xf29a56[_0x3588('0x4e')][_0x3588('0x50')]?_0xf29a56[_0x3588('0x4e')]:_0x226949[_0x3588('0x49')];_0xf29a56['order']=qs['sort'](_0x41aafe[_0x3588('0x4a')][_0x3588('0x53')]);_0xf29a56['where']=qs[_0x3588('0x4c')](_[_0x3588('0x54')](_0x41aafe[_0x3588('0x4a')],_0x226949['filters']));if(_0x41aafe[_0x3588('0x4a')][_0x3588('0x55')]){_0xf29a56[_0x3588('0x56')]=_['merge'](_0xf29a56['where'],{'$or':_[_0x3588('0x44')](_0xf29a56[_0x3588('0x4e')],function(_0x568d89){var _0x1e2b36={};_0x1e2b36[_0x568d89]={'$like':'%'+_0x41aafe['query'][_0x3588('0x55')]+'%'};return _0x1e2b36;})});}_0xf29a56=_[_0x3588('0x58')]({},_0xf29a56,_0x41aafe[_0x3588('0x59')]);return _0x4790d6['getApplications'](_0xf29a56);}})[_0x3588('0xe')](function(_0x49e73c){if(_0x49e73c){_0x3771c3=_0x49e73c[_0x3588('0x50')];if(!_0x41aafe['query'][_0x3588('0x51')]('nolimit')){_0xf29a56[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x41aafe[_0x3588('0x4a')][_0x3588('0x1f')]);_0xf29a56[_0x3588('0x1d')]=qs[_0x3588('0x1d')](_0x41aafe[_0x3588('0x4a')][_0x3588('0x1d')]);}return _0x4790d6[_0x3588('0x94')](_0xf29a56);}})[_0x3588('0xe')](function(_0x26dbfc){if(_0x26dbfc){return _0x26dbfc?{'count':_0x3771c3,'rows':_0x26dbfc}:null;}})[_0x3588('0xe')](respondWithResult(_0x307508,null))[_0x3588('0x18')](handleError(_0x307508,null));};exports['getMessages']=function(_0x395fd2,_0x5d44cb){var _0xbc692d={'raw':!![],'where':{}};var _0x578fd8={};var _0x290029={'count':0x0,'rows':[]};return db['MailAccount'][_0x3588('0x6a')]({'where':{'id':_0x395fd2[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x5d44cb,null))[_0x3588('0xe')](function(_0x11e78e){if(_0x11e78e){_0x578fd8[_0x3588('0x49')]=_['keys'](db[_0x3588('0x95')][_0x3588('0x46')]);_0x578fd8[_0x3588('0x4a')]=_[_0x3588('0x4b')](_0x395fd2[_0x3588('0x4a')]);_0x578fd8['filters']=_[_0x3588('0x4d')](_0x578fd8['model'],_0x578fd8['query']);_0xbc692d[_0x3588('0x4e')]=_[_0x3588('0x4d')](_0x578fd8[_0x3588('0x49')],qs[_0x3588('0x4f')](_0x395fd2[_0x3588('0x4a')][_0x3588('0x4f')]));_0xbc692d[_0x3588('0x4e')]=_0xbc692d[_0x3588('0x4e')]['length']?_0xbc692d[_0x3588('0x4e')]:_0x578fd8[_0x3588('0x49')];if(!_0x395fd2['query'][_0x3588('0x51')]('nolimit')){_0xbc692d[_0x3588('0x1f')]=qs[_0x3588('0x1f')](_0x395fd2[_0x3588('0x4a')][_0x3588('0x1f')]);_0xbc692d['offset']=qs[_0x3588('0x1d')](_0x395fd2[_0x3588('0x4a')]['offset']);}_0xbc692d[_0x3588('0x52')]=qs[_0x3588('0x53')](_0x395fd2['query']['sort']);_0xbc692d[_0x3588('0x56')]=qs[_0x3588('0x4c')](_[_0x3588('0x54')](_0x395fd2[_0x3588('0x4a')],_0x578fd8[_0x3588('0x4c')]));_0xbc692d['where']['MailAccountId']=_0x11e78e['id'];if(_0x395fd2[_0x3588('0x4a')][_0x3588('0x55')]){_0xbc692d['where']=_[_0x3588('0x58')](_0xbc692d['where'],{'$or':_[_0x3588('0x44')](_0xbc692d[_0x3588('0x4e')],function(_0x406025){var _0x1a4844={};_0x1a4844[_0x406025]={'$like':'%'+_0x395fd2[_0x3588('0x4a')][_0x3588('0x55')]+'%'};return _0x1a4844;})});}if(_0x395fd2['query'][_0x3588('0x96')]){var _0x595c2b=_0x395fd2[_0x3588('0x4a')][_0x3588('0x96')][_0x3588('0x97')](',');var _0x5292a6={};_0x5292a6[_0x595c2b[0x0]]={'$gte':moment(_0x595c2b[0x1])[_0x3588('0x98')](_0x3588('0x99'))};_0xbc692d[_0x3588('0x56')]=_[_0x3588('0x58')](_0xbc692d['where'],_0x5292a6);}_0xbc692d=_[_0x3588('0x58')]({},_0xbc692d,_0x395fd2['options']);return db[_0x3588('0x95')][_0x3588('0x20')]({'where':_0xbc692d[_0x3588('0x56')]})[_0x3588('0xe')](function(_0x296f0b){_0x290029[_0x3588('0x20')]=_0x296f0b;if(_0x395fd2['query']['includeAll']){_0xbc692d[_0x3588('0x5b')]=[{'all':!![]}];}return db[_0x3588('0x95')][_0x3588('0x5c')](_0xbc692d);})[_0x3588('0xe')](function(_0x446d75){if(_0x395fd2[_0x3588('0x4a')][_0x3588('0x9a')]===_0x3588('0x9b')){for(var _0x58ffe1=0x0;_0x58ffe1<_0x446d75[_0x3588('0x50')];_0x58ffe1++){_0x446d75[_0x58ffe1][_0x3588('0x61')]=juice(_0x446d75[_0x58ffe1]['body']);}}_0x290029[_0x3588('0x6d')]=_0x446d75;return _0x290029;});}})[_0x3588('0xe')](respondWithFilteredResult(_0x5d44cb,_0xbc692d))[_0x3588('0x18')](handleError(_0x5d44cb,null));};exports[_0x3588('0x29')]=function(_0x28a1c8,_0x4736d1){var _0x39f9a7,_0x42633f={},_0x5ac6b6;if(_0x28a1c8[_0x3588('0x61')]['to']){_0x5ac6b6=_0x28a1c8[_0x3588('0x61')]['to'][_0x3588('0x97')](',')[0x0];}return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0x28a1c8[_0x3588('0x5e')]['id']},'include':[{'model':db[_0x3588('0x9c')],'as':_0x3588('0x9d'),'include':[{'model':db[_0x3588('0x83')],'as':_0x3588('0x9e'),'where':{'email':_0x5ac6b6},'limit':0x1,'order':[[_0x3588('0x9f'),'DESC']]}]},{'model':db[_0x3588('0x42')],'as':_0x3588('0x3f'),'raw':!![],'include':[{'model':db[_0x3588('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0x3588('0xe')](handleEntityNotFound(_0x4736d1,null))[_0x3588('0xe')](function(_0x20a5c3){if(!_0x20a5c3)return;_0x39f9a7=_0x20a5c3;if(!_0x20a5c3[_0x3588('0x3f')])throw new Error(_0x3588('0xa1'));if(_[_0x3588('0x75')](_0x28a1c8['body'][_0x3588('0xa2')])){_0x28a1c8[_0x3588('0x61')]['from']=util['format']('%s\x20<%s>',_0x20a5c3[_0x3588('0x28')],_0x20a5c3[_0x3588('0x74')]||_0x20a5c3[_0x3588('0x3f')][_0x3588('0x34')]);}if(_0x28a1c8[_0x3588('0x61')][_0x3588('0xa3')]&&_0x28a1c8[_0x3588('0x61')][_0x3588('0xa3')][_0x3588('0x50')]){for(var _0x4f6039=0x0;_0x4f6039<_0x28a1c8[_0x3588('0x61')][_0x3588('0xa3')][_0x3588('0x50')];_0x4f6039+=0x1){_0x28a1c8[_0x3588('0x61')]['attachments'][_0x4f6039]={'filename':_0x28a1c8['body'][_0x3588('0xa3')][_0x4f6039][_0x3588('0x28')],'path':path[_0x3588('0xa4')](config['root'],_0x3588('0xa5'),_0x28a1c8[_0x3588('0x61')][_0x3588('0xa3')][_0x4f6039][_0x3588('0xa6')])};}}var _0x33acad=_0x20a5c3[_0x3588('0xa7')]();return respondWithRpcPromise(_0x3588('0xa8'),_0x3588('0xa9'),{'account':_0x33acad,'message':_0x28a1c8['body']});})[_0x3588('0xe')](function(_0x4c930e){if(!_0x4c930e)return;_0x42633f=_0x4c930e;if(!_0x39f9a7[_0x3588('0x9d')])throw new Error(_0x3588('0xaa'));if(_0x39f9a7[_0x3588('0x9d')][_0x3588('0x9e')][_0x3588('0x50')])return _0x39f9a7['List'][_0x3588('0x9e')][0x0];return db[_0x3588('0x83')]['create'](_['defaults'](_0x28a1c8[_0x3588('0x61')],{'firstName':_0x28a1c8['body']['to'],'email':_0x28a1c8[_0x3588('0x61')]['to'],'phone':_0x28a1c8[_0x3588('0x61')]['to'],'ListId':_0x39f9a7[_0x3588('0xab')]}));})[_0x3588('0xe')](function(_0x10e089){if(!_0x10e089)return;var _0x150282={'UserId':_0x28a1c8['user']['id'],'ContactId':_0x10e089['id'],'MailAccountId':_0x39f9a7['id'],'inReplyTo':_0x42633f[_0x3588('0xac')],'to':_0x28a1c8[_0x3588('0x61')][_0x3588('0xa2')],'cc':_0x28a1c8[_0x3588('0x61')]['cc'],'subject':_0x28a1c8['body']['subject'],'attach':_0x28a1c8[_0x3588('0x61')][_0x3588('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x3588('0xae'),'Messages':[_[_0x3588('0x58')](_0x28a1c8[_0x3588('0x61')],{'messageId':_0x42633f[_0x3588('0xac')],'sentAt':moment()['format'](_0x3588('0x99')),'read':!![],'MailAccountId':_0x39f9a7['id'],'UserId':_0x28a1c8['user']['id'],'ContactId':_0x10e089['id']})]};if(_0x28a1c8['body'][_0x3588('0xaf')]){_0x150282=_[_0x3588('0x58')](_0x150282,_0x28a1c8[_0x3588('0x61')][_0x3588('0xaf')]);}return db[_0x3588('0x82')][_0x3588('0x69')](_0x150282,{'include':[{'model':db['MailMessage'],'as':_0x3588('0xb0')}]});})['then'](respondWithResult(_0x4736d1,null))[_0x3588('0x18')](handleError(_0x4736d1,null));};exports[_0x3588('0xb1')]=function(_0x485676,_0x4aa46b){return db[_0x3588('0x45')]['find']({'where':{'id':_0x485676['params']['id']},'include':[{'model':db[_0x3588('0x42')],'as':_0x3588('0x3f'),'raw':!![],'include':[{'model':db[_0x3588('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0x3588('0xe')](handleEntityNotFound(_0x4aa46b,null))[_0x3588('0xe')](function(_0x457f64){if(!_0x457f64[_0x3588('0x3f')])return;var _0x90847b=_0x457f64[_0x3588('0xa7')]();return respondWithRpcPromise(_0x3588('0xb2'),_0x3588('0xb1'),{'account':_0x90847b});})[_0x3588('0xe')](respondWithResult(_0x4aa46b,null))['catch'](handleError(_0x4aa46b,null));};exports[_0x3588('0x26')]=function(_0xa19cfb,_0x3118fc){return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0xa19cfb['params']['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x3118fc,null))[_0x3588('0xe')](function(_0x597b15){if(_0x597b15&&_0x597b15[_0x3588('0x3c')]){throw new db['Sequelize'][(_0x3588('0xb3'))](_0x3588('0xb4'));}return _0x597b15;})[_0x3588('0xe')](removeEntity(_0x3118fc,null))[_0x3588('0x18')](handleError(_0x3118fc,null));};exports[_0x3588('0xb5')]=function(_0x452874,_0x416e36){return db['MailAccount'][_0x3588('0x60')]({'where':{'id':_0x452874[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x416e36,null))[_0x3588('0xe')](function(_0x151ded){if(_0x151ded){return _0x151ded['addAgents'](_0x452874[_0x3588('0x61')][_0x3588('0x6f')],_[_0x3588('0xb6')](_0x452874[_0x3588('0x61')],[_0x3588('0x6f'),'id'])||{})[_0x3588('0xb7')](function(_0x3e25ba){for(var _0x18cde4=0x0;_0x18cde4<_0x452874[_0x3588('0x61')]['ids'][_0x3588('0x50')];_0x18cde4+=0x1){socket['emit'](_0x3588('0xb8'),{'UserId':Number(_0x452874[_0x3588('0x61')]['ids'][_0x18cde4]),'MailAccountId':Number(_0x452874[_0x3588('0x5e')]['id'])});}return _0x3e25ba;});}})[_0x3588('0xe')](respondWithResult(_0x416e36,null))[_0x3588('0x18')](handleError(_0x416e36,null));};exports[_0x3588('0xb9')]=function(_0x3d27fd,_0x4ff7e4){return db[_0x3588('0x45')][_0x3588('0x60')]({'where':{'id':_0x3d27fd[_0x3588('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4ff7e4,null))['then'](function(_0x2b2a1d){if(_0x2b2a1d){return _0x2b2a1d[_0x3588('0xb9')](_0x3d27fd[_0x3588('0x4a')][_0x3588('0x6f')])[_0x3588('0xe')](function(){if(_[_0x3588('0xba')](_0x3d27fd[_0x3588('0x4a')][_0x3588('0x6f')])){for(var _0x54d8e1=0x0;_0x54d8e1<_0x3d27fd[_0x3588('0x4a')]['ids']['length'];_0x54d8e1+=0x1){socket[_0x3588('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x3d27fd[_0x3588('0x4a')][_0x3588('0x6f')][_0x54d8e1]),'MailAccountId':Number(_0x3d27fd[_0x3588('0x5e')]['id'])});}}else{socket[_0x3588('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x3d27fd[_0x3588('0x4a')]['ids']),'MailAccountId':Number(_0x3d27fd[_0x3588('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ff7e4,null))[_0x3588('0x18')](handleError(_0x4ff7e4,null));};exports['getAgents']=function(_0x205d2e,_0x38a686){var _0x508b76={};var _0x1607aa={};var _0x575920;var _0x2b27e6;return db[_0x3588('0x45')][_0x3588('0x6a')]({'where':{'id':_0x205d2e[_0x3588('0x5e')]['id']}})[_0x3588('0xe')](handleEntityNotFound(_0x38a686,null))['then'](function(_0x1ffde8){if(_0x1ffde8){_0x575920=_0x1ffde8;_0x1607aa[_0x3588('0x49')]=_[_0x3588('0x4b')](db[_0x3588('0x85')][_0x3588('0x46')]);_0x1607aa[_0x3588('0x4a')]=_['keys'](_0x205d2e['query']);_0x1607aa[_0x3588('0x4c')]=_[_0x3588('0x4d')](_0x1607aa[_0x3588('0x49')],_0x1607aa[_0x3588('0x4a')]);_0x508b76[_0x3588('0x4e')]=_['intersection'](_0x1607aa[_0x3588('0x49')],qs['fields'](_0x205d2e[_0x3588('0x4a')]['fields']));_0x508b76['attributes']=_0x508b76[_0x3588('0x4e')]['length']?_0x508b76[_0x3588('0x4e')]:_0x1607aa['model'];_0x508b76[_0x3588('0x52')]=qs[_0x3588('0x53')](_0x205d2e['query']['sort']);_0x508b76[_0x3588('0x56')]=qs[_0x3588('0x4c')](_['pick'](_0x205d2e[_0x3588('0x4a')],_0x1607aa[_0x3588('0x4c')]));if(_0x205d2e['query'][_0x3588('0x55')]){_0x508b76[_0x3588('0x56')]=_[_0x3588('0x58')](_0x508b76[_0x3588('0x56')],{'$or':_[_0x3588('0x44')](_0x508b76[_0x3588('0x4e')],function(_0x1ce7e4){var _0x221c86={};_0x221c86[_0x1ce7e4]={'$like':'%'+_0x205d2e[_0x3588('0x4a')]['filter']+'%'};return _0x221c86;})});}_0x508b76=_[_0x3588('0x58')]({},_0x508b76,_0x205d2e[_0x3588('0x59')]);return _0x575920[_0x3588('0xbc')](_0x508b76);}})[_0x3588('0xe')](function(_0x5e481b){if(_0x5e481b){_0x2b27e6=_0x5e481b['length'];if(!_0x205d2e[_0x3588('0x4a')][_0x3588('0x51')](_0x3588('0x6c'))){_0x508b76[_0x3588('0x1f')]=qs['limit'](_0x205d2e[_0x3588('0x4a')][_0x3588('0x1f')]);_0x508b76[_0x3588('0x1d')]=qs[_0x3588('0x1d')](_0x205d2e[_0x3588('0x4a')]['offset']);}return _0x575920[_0x3588('0xbc')](_0x508b76);}})[_0x3588('0xe')](function(_0x560983){if(_0x560983){return _0x560983?{'count':_0x2b27e6,'rows':_0x560983}:null;}})['then'](respondWithResult(_0x38a686,null))['catch'](handleError(_0x38a686,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ec1e5bb..0517dfd 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 _0x72e4=['MailAccount','setMaxListeners','update','emit','hook','exports','events','../../mysqldb'];(function(_0x3dad86,_0x7b26a4){var _0x1e5d9d=function(_0x4e3841){while(--_0x4e3841){_0x3dad86['push'](_0x3dad86['shift']());}};_0x1e5d9d(++_0x7b26a4);}(_0x72e4,0xae));var _0x472e=function(_0x4175a2,_0x578016){_0x4175a2=_0x4175a2-0x0;var _0x48fafe=_0x72e4[_0x4175a2];return _0x48fafe;};'use strict';var EventEmitter=require(_0x472e('0x0'));var MailAccount=require(_0x472e('0x1'))['db'][_0x472e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x472e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x472e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4cbb43){return function(_0x36162d,_0x53f7c1,_0x122fa5){MailAccountEvents[_0x472e('0x5')](_0x4cbb43+':'+_0x36162d['id'],_0x36162d);MailAccountEvents[_0x472e('0x5')](_0x4cbb43,_0x36162d);_0x122fa5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x472e('0x6')](e,emitEvent(event));}}module[_0x472e('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x1c90=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','update','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1c90,0x104));var _0x01c9=function(_0x35625f,_0x93eb2b){_0x35625f=_0x35625f-0x0;var _0x3c6472=_0x1c90[_0x35625f];return _0x3c6472;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x01c9('0x0'))['db'][_0x01c9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x01c9('0x2'),'afterDestroy':_0x01c9('0x3')};function emitEvent(_0x5a84d9){return function(_0x77ec63,_0x3974f8,_0xd81ce7){MailAccountEvents['emit'](_0x5a84d9+':'+_0x77ec63['id'],_0x77ec63);MailAccountEvents[_0x01c9('0x4')](_0x5a84d9,_0x77ec63);_0xd81ce7(null);};}for(var e in events){if(events[_0x01c9('0x5')](e)){var event=events[e];MailAccount[_0x01c9('0x6')](e,emitEvent(event));}}module[_0x01c9('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 98d894e..53d9187 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 _0xbfa8=['mail_accounts','provider','custom','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','pass','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x3500db,_0x10fe32){var _0x51408a=function(_0x41fb19){while(--_0x41fb19){_0x3500db['push'](_0x3500db['shift']());}};_0x51408a(++_0x10fe32);}(_0xbfa8,0x1ea));var _0x8bfa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfa8[_0x4565bf];return _0x5610ba;};'use strict';var attributes=require(_0x8bfa('0x0'));module[_0x8bfa('0x1')]=function(_0x270f98){return _0x270f98[_0x8bfa('0x2')](_0x8bfa('0x3'),attributes,{'tableName':_0x8bfa('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2133e1=this;var _0x3001b0={'id':_0x2133e1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2133e1[_0x8bfa('0x5')]!==_0x8bfa('0x6')){_0x3001b0['service']=_0x2133e1[_0x8bfa('0x5')];}else{_0x3001b0[_0x8bfa('0x7')]=_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0x7')];_0x3001b0['port']=_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0x9')];_0x3001b0[_0x8bfa('0xa')]=_0x2133e1[_0x8bfa('0x8')]['secure'];}if(_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0xb')]){if(_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0xc')]){if(!_0x2133e1[_0x8bfa('0x8')]['CloudProvider'])throw new Error(_0x8bfa('0xd'));_0x3001b0[_0x8bfa('0xe')]={'type':_0x8bfa('0xf'),'user':_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0x10')],'accessToken':_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0x11')]['data5']};}else{_0x3001b0[_0x8bfa('0xe')]={'user':_0x2133e1['Smtp']['user'],'pass':_0x2133e1[_0x8bfa('0x8')][_0x8bfa('0x12')]};}}return _0x3001b0;}}});}; \ No newline at end of file +var _0x0496=['port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','host'];(function(_0x45ff67,_0x441b28){var _0x44cb49=function(_0x1eb715){while(--_0x1eb715){_0x45ff67['push'](_0x45ff67['shift']());}};_0x44cb49(++_0x441b28);}(_0x0496,0xa3));var _0x6049=function(_0x1030db,_0x1bb8b5){_0x1030db=_0x1030db-0x0;var _0x21888f=_0x0496[_0x1030db];return _0x21888f;};'use strict';var attributes=require(_0x6049('0x0'));module[_0x6049('0x1')]=function(_0x42a54c){return _0x42a54c[_0x6049('0x2')]('MailAccount',attributes,{'tableName':_0x6049('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x26d869=this;var _0x55ae61={'id':_0x26d869['id'],'tls':{'rejectUnauthorized':![]}};if(_0x26d869[_0x6049('0x4')]!==_0x6049('0x5')){_0x55ae61[_0x6049('0x6')]=_0x26d869['provider'];}else{_0x55ae61[_0x6049('0x7')]=_0x26d869['Smtp'][_0x6049('0x7')];_0x55ae61[_0x6049('0x8')]=_0x26d869[_0x6049('0x9')][_0x6049('0x8')];_0x55ae61[_0x6049('0xa')]=_0x26d869[_0x6049('0x9')][_0x6049('0xa')];}if(_0x26d869[_0x6049('0x9')][_0x6049('0xb')]){if(_0x26d869[_0x6049('0x9')][_0x6049('0xc')]){if(!_0x26d869['Smtp'][_0x6049('0xd')])throw new Error(_0x6049('0xe'));_0x55ae61[_0x6049('0xf')]={'type':_0x6049('0x10'),'user':_0x26d869[_0x6049('0x9')][_0x6049('0x11')],'accessToken':_0x26d869['Smtp'][_0x6049('0xd')][_0x6049('0x12')]};}else{_0x55ae61[_0x6049('0xf')]={'user':_0x26d869[_0x6049('0x9')][_0x6049('0x11')],'pass':_0x26d869[_0x6049('0x9')]['pass']};}}return _0x55ae61;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 8a92664..679ef9d 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 _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x2542,0x169));var _0x2254=function(_0x45ac03,_0x2390df){_0x45ac03=_0x45ac03-0x0;var _0x433e26=_0x2542[_0x45ac03];return _0x433e26;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file +var _0xc6ac=['update','interaction','created','contact','attachments','originTo','bcc','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','attributes','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','autoclose','length','*,*,*,*','Contacts','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread'];(function(_0x4b423a,_0x49113b){var _0x4b7d82=function(_0x22ff33){while(--_0x22ff33){_0x4b423a['push'](_0x4b423a['shift']());}};_0x4b7d82(++_0x49113b);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1dd928,_0x2dfbaf){_0x1dd928=_0x1dd928-0x0;var _0x4953a0=_0xc6ac[_0x1dd928];return _0x4953a0;};'use strict';var _=require(_0xcc6a('0x0'));var moment=require(_0xcc6a('0x1'));var BPromise=require(_0xcc6a('0x2'));var rs=require(_0xcc6a('0x3'));var Redis=require(_0xcc6a('0x4'));var db=require(_0xcc6a('0x5'))['db'];var logger=require(_0xcc6a('0x6'))(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var jayson=require(_0xcc6a('0x9'));var client=jayson[_0xcc6a('0xa')][_0xcc6a('0xb')]({'port':0x232c});config[_0xcc6a('0xc')]=_[_0xcc6a('0xd')](config['redis'],{'host':_0xcc6a('0xe'),'port':0x18eb});var socket=require(_0xcc6a('0xf'))(new Redis(config[_0xcc6a('0xc')]));require('./mailAccount.socket')[_0xcc6a('0x10')](socket);function respondWithRpcPromise(_0x210f63,_0x7806a0,_0x463ebb){return new BPromise(function(_0x3eb04a,_0x5e91a2){return client[_0xcc6a('0x11')](_0x210f63,_0x463ebb)[_0xcc6a('0x12')](function(_0x109693){logger['info'](_0xcc6a('0x13'),_0x7806a0,_0xcc6a('0x14'));logger[_0xcc6a('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x7806a0,'request\x20sent',JSON[_0xcc6a('0x16')](_0x109693));if(_0x109693[_0xcc6a('0x17')]){if(_0x109693[_0xcc6a('0x17')]['code']===0x1f4){logger['error'](_0xcc6a('0x13'),_0x7806a0,_0x109693[_0xcc6a('0x17')][_0xcc6a('0x18')]);return _0x5e91a2(_0x109693[_0xcc6a('0x17')][_0xcc6a('0x18')]);}logger[_0xcc6a('0x17')](_0xcc6a('0x13'),_0x7806a0,_0x109693[_0xcc6a('0x17')]['message']);return _0x3eb04a(_0x109693['error']['message']);}else{logger[_0xcc6a('0x19')](_0xcc6a('0x13'),_0x7806a0,_0xcc6a('0x14'));_0x3eb04a(_0x109693[_0xcc6a('0x1a')][_0xcc6a('0x18')]);}})[_0xcc6a('0x1b')](function(_0x2d9585){logger[_0xcc6a('0x17')](_0xcc6a('0x13'),_0x7806a0,_0x2d9585);_0x5e91a2(_0x2d9585);});});}exports[_0xcc6a('0x1c')]=function(_0x1d20a3){var _0x5b657e=this;return new Promise(function(_0xfec60f,_0x3e1fda){return db[_0xcc6a('0x1d')][_0xcc6a('0x1e')]({'raw':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x20')]===undefined?!![]:![]:!![],'where':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x21')]||null:null,'attributes':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')]['attributes']||null:null,'limit':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x22')]||null:null,'include':_0x1d20a3['options']?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x23')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x25')],'include':_0x5fc697[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x26')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes'],'include':_0x3afb3a[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x3afb3a[_0xcc6a('0x23')],function(_0x473f88){return{'model':db[_0x473f88['model']],'as':_0x473f88['as'],'attributes':_0x473f88[_0xcc6a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcc6a('0x12')](function(_0x2c6d88){logger['info'](_0xcc6a('0x1c'),_0x1d20a3);logger['debug']('GetMailAccount',_0x1d20a3,JSON[_0xcc6a('0x16')](_0x2c6d88));_0xfec60f(_0x2c6d88);})[_0xcc6a('0x1b')](function(_0x3aa315){logger[_0xcc6a('0x17')](_0xcc6a('0x1c'),_0x3aa315[_0xcc6a('0x18')],_0x1d20a3);_0x3e1fda(_0x5b657e['error'](0x1f4,_0x3aa315[_0xcc6a('0x18')]));});});};exports[_0xcc6a('0x27')]=function(_0x147aff){var _0x2faeb5=this;return new Promise(function(_0x211a8c,_0x152ebd){return db[_0xcc6a('0x1d')][_0xcc6a('0x28')]({'raw':_0x147aff['options']?_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x20')]===undefined?!![]:![]:!![],'where':_0x147aff[_0xcc6a('0x1f')]?_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x21')]||null:null,'attributes':_0x147aff[_0xcc6a('0x1f')]?_0x147aff[_0xcc6a('0x1f')]['attributes']||null:null,'include':_0x147aff[_0xcc6a('0x1f')]?_0x147aff['options']['include']?_['map'](_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x23')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x26')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x25')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x23')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x26')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes'],'include':_0x11173a[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x11173a[_0xcc6a('0x23')],function(_0xa326b2){return{'model':db[_0xa326b2[_0xcc6a('0x26')]],'as':_0xa326b2['as'],'attributes':_0xa326b2[_0xcc6a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcc6a('0x12')](function(_0x18a252){if(_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x29')]===!![])_0x18a252[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x18a252[_0xcc6a('0x2c')]());logger[_0xcc6a('0x19')](_0xcc6a('0x27'),_0x147aff);logger[_0xcc6a('0x15')](_0xcc6a('0x27'),_0x147aff,JSON[_0xcc6a('0x16')](_0x18a252));_0x211a8c(_0x18a252);})['catch'](function(_0x553e66){logger[_0xcc6a('0x17')](_0xcc6a('0x27'),_0x553e66[_0xcc6a('0x18')],_0x147aff);_0x152ebd(_0x2faeb5[_0xcc6a('0x17')](0x1f4,_0x553e66[_0xcc6a('0x18')]));});});};exports[_0xcc6a('0x2d')]=function(_0x3273bc){var _0x1199f1=this;return new Promise(function(_0x49b65c,_0x56bc7d){var _0x470e3b={'body':_0x3273bc['body'],'channel':'mail'};var _0x5cf1ba=_[_0xcc6a('0x2e')](_[_0xcc6a('0x2f')](db[_0xcc6a('0x30')][_0xcc6a('0x31')]),[_0xcc6a('0x32'),'updatedAt',_0xcc6a('0x33'),_0xcc6a('0x34')]);var _0x17e5a0=![];if(_0x3273bc[_0xcc6a('0x35')]['id']){delete _0x3273bc[_0xcc6a('0x35')]['id'];}if(_[_0xcc6a('0x36')](_0x3273bc['body'][_0xcc6a('0x37')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x38')));}if(_[_0xcc6a('0x36')](_0x3273bc['body'][_0xcc6a('0x35')])||_0x3273bc['body'][_0xcc6a('0x35')]===''){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x39')));}if(_['isNil'](_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x3a')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cf1ba));}if(!_['includes'](_0x5cf1ba,_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x3a')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x3b')+_0x5cf1ba));}var _0x345e94={};_0x345e94[_0x3273bc['body'][_0xcc6a('0x3a')]]=_0x3273bc[_0xcc6a('0x35')]['from'];return db[_0xcc6a('0x1d')][_0xcc6a('0x28')]({'where':{'id':_0x3273bc[_0xcc6a('0x3c')]['id']},'include':[{'model':db[_0xcc6a('0x3d')],'as':_0xcc6a('0x3e'),'include':[{'model':db[_0xcc6a('0x30')],'as':'Contacts','where':_0x345e94,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcc6a('0x3f')],'as':_0xcc6a('0x40')},{'model':db[_0xcc6a('0x41')],'as':_0xcc6a('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xcc6a('0x43')}]}]})['then'](function(_0x3aa7dd){if(_0x3aa7dd&&_0x3aa7dd[_0xcc6a('0x3e')]){var _0xcfc540=_0x3aa7dd[_0xcc6a('0x44')]({'plain':!![]});_0x470e3b[_0xcc6a('0x3c')]=_[_0xcc6a('0x45')](_0xcfc540,['Applications',_0xcc6a('0x3e')]);_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x2b')]=_0x3aa7dd[_0xcc6a('0x2c')]();_0x470e3b[_0xcc6a('0x46')]=_0xcfc540[_0xcc6a('0x40')];_0x470e3b[_0xcc6a('0x47')]=_0xcfc540[_0xcc6a('0x3e')];_0x470e3b[_0xcc6a('0x46')]=_[_0xcc6a('0x48')](_0x470e3b['applications'],[_0xcc6a('0x49')],[_0xcc6a('0x4a')]);if(_0x470e3b[_0xcc6a('0x3c')]&&_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x4b')]){_0x470e3b[_0xcc6a('0x46')]['push']({'id':0x0,'priority':_0x470e3b['applications'][_0xcc6a('0x4c')]+0x1,'app':'close','appdata':_0xcc6a('0x4b'),'interval':_0xcc6a('0x4d')});}if(_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x40')]){delete _0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x40')];}if(_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x3e')]){delete _0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x3e')];}if(_0xcfc540[_0xcc6a('0x3e')]['Contacts'][_0xcc6a('0x4c')]){return _0xcfc540['List'][_0xcc6a('0x4e')][0x0];}var _0x1570fe=_[_0xcc6a('0xd')](_0x3273bc['body'],{'firstName':_0x3273bc[_0xcc6a('0x35')]['from'],'ListId':_0xcfc540[_0xcc6a('0x34')]});_0x1570fe[_0x3273bc['body'][_0xcc6a('0x3a')]]=_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x37')];return db[_0xcc6a('0x30')][_0xcc6a('0x4f')](_0x1570fe);}else{throw new Error(_0xcc6a('0x50'));}})[_0xcc6a('0x12')](function(_0x11459f){_0x470e3b['contact']=_0x11459f;if(_0x11459f){if(!_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x51')]){_0x3273bc['body'][_0xcc6a('0x18')][_0xcc6a('0x51')]=rs[_0xcc6a('0x52')]()+'\x20'+_0x3273bc['body'][_0xcc6a('0x18')]['from'];}var _0x5e53e4={'ContactId':_0x11459f['id'],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id'],'inReplyTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x51')],'to':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x37')],'cc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['cc'],'subject':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x53')],'attach':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x54')],'lastMsgAt':moment()[_0xcc6a('0x55')](_0xcc6a('0x56')),'lastMsgDirection':'in'};return db[_0xcc6a('0x57')]['find']({'where':{'closed':![],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id']},'include':[{'model':db[_0xcc6a('0x58')],'as':_0xcc6a('0x59'),'attributes':[_0xcc6a('0x51')],'where':{'messageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x5a')]}}]})[_0xcc6a('0x12')](function(_0x2686c8){if(_0x2686c8){return[_0x2686c8,![]];}return db[_0xcc6a('0x57')]['create'](_0x5e53e4)['then'](function(_0x4fe041){return[_0x4fe041,!![]];});});}else{throw new Error(_0xcc6a('0x5b'));}})[_0xcc6a('0x5c')](function(_0x9c444,_0x4a9f34){if(_0x9c444){_0x17e5a0=_0x4a9f34;if(!_0x4a9f34){return _0x9c444[_0xcc6a('0x5d')]({'inReplyTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x51')],'to':_0x3273bc['body']['message'][_0xcc6a('0x37')],'cc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['cc'],'subject':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x53')],'attach':_0x9c444[_0xcc6a('0x54')]?_0x9c444[_0xcc6a('0x54')]:_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xcc6a('0x56')),'lastMsgAt':moment()[_0xcc6a('0x55')](_0xcc6a('0x56')),'lastMsgDirection':'in'});}else{return _0x9c444;}}})[_0xcc6a('0x12')](function(_0x56a3a0){_0x470e3b['interaction']=_0x56a3a0[_0xcc6a('0x44')]({'plain':!![]});_0x470e3b[_0xcc6a('0x5e')][_0xcc6a('0x5f')]=_0x17e5a0;return db[_0xcc6a('0x58')]['create']({'body':_0x3273bc['body']['body'],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id'],'MailInteractionId':_0x56a3a0['id'],'direction':'in','ContactId':_0x470e3b[_0xcc6a('0x60')]['id'],'messageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['messageId'],'from':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['from'],'to':_0x3273bc[_0xcc6a('0x35')]['message']['to'],'cc':_0x3273bc[_0xcc6a('0x35')]['message']['cc'],'subject':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x53')],'attach':_0x3273bc['body'][_0xcc6a('0x18')]['attach'],'Attachments':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x61')],'originTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x62')],'originCc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['originCc'],'bcc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x63')],'ChatWebsiteId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['ChatWebsiteId']||null,'originChannel':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x64')]||null},{'include':[{'model':db[_0xcc6a('0x65')],'as':_0xcc6a('0x66')}]});})[_0xcc6a('0x12')](function(_0x598833){_0x470e3b[_0xcc6a('0x18')]=_0x598833;if(_0x470e3b[_0xcc6a('0x5e')][_0xcc6a('0x67')]){return db[_0xcc6a('0x68')][_0xcc6a('0x28')]({'attributes':['id',_0xcc6a('0x69')],'where':{'id':_0x470e3b['interaction']['UserId']}})[_0xcc6a('0x12')](function(_0x43cbee){if(_0x43cbee){_0x470e3b[_0xcc6a('0x46')][_0xcc6a('0x6a')]({'id':0x0,'priority':0x0,'app':_0xcc6a('0x6b'),'appdata':_0x43cbee[_0xcc6a('0x69')]+','+(_0x470e3b[_0xcc6a('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xcc6a('0x4d')});}return respondWithRpcPromise(_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0x470e3b);});}return respondWithRpcPromise(_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0x470e3b);})[_0xcc6a('0x12')](function(_0x5e8e19){_0x49b65c(_0x5e8e19);})[_0xcc6a('0x1b')](function(_0x4688d3){_0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0x4688d3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f3f607a..972c97c 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 _0xf3e2=['./mailAccount.events','save','remove','update','emit','register','length','mailAccount:'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf3e2,0x168));var _0x2f3e=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xf3e2[_0x509c83];return _0x534626;};'use strict';var MailAccountEvents=require(_0x2f3e('0x0'));var events=[_0x2f3e('0x1'),_0x2f3e('0x2'),_0x2f3e('0x3')];function createListener(_0x2711c4,_0x154141){return function(_0x1736b6){_0x154141[_0x2f3e('0x4')](_0x2711c4,_0x1736b6);};}function removeListener(_0x56e4c4,_0x33742c){return function(){MailAccountEvents['removeListener'](_0x56e4c4,_0x33742c);};}exports[_0x2f3e('0x5')]=function(_0xd3f5b){for(var _0x3a0b5a=0x0,_0x392f91=events[_0x2f3e('0x6')];_0x3a0b5a<_0x392f91;_0x3a0b5a++){var _0x1ac142=events[_0x3a0b5a];var _0x30f939=createListener(_0x2f3e('0x7')+_0x1ac142,_0xd3f5b);MailAccountEvents['on'](_0x1ac142,_0x30f939);}}; \ No newline at end of file +var _0xecc8=['mailAccount:','emit','removeListener','register'];(function(_0x1629f3,_0x4411e1){var _0x12c47a=function(_0x57137c){while(--_0x57137c){_0x1629f3['push'](_0x1629f3['shift']());}};_0x12c47a(++_0x4411e1);}(_0xecc8,0x111));var _0x8ecc=function(_0x989aca,_0x152da2){_0x989aca=_0x989aca-0x0;var _0x1ac5db=_0xecc8[_0x989aca];return _0x1ac5db;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove','update'];function createListener(_0x1092f4,_0x5037fa){return function(_0x27c5ec){_0x5037fa[_0x8ecc('0x0')](_0x1092f4,_0x27c5ec);};}function removeListener(_0x592f21,_0x53876c){return function(){MailAccountEvents[_0x8ecc('0x1')](_0x592f21,_0x53876c);};}exports[_0x8ecc('0x2')]=function(_0x477e22){for(var _0x2ae669=0x0,_0x269c27=events['length'];_0x2ae669<_0x269c27;_0x2ae669++){var _0x40c4fc=events[_0x2ae669];var _0xc76845=createListener(_0x8ecc('0x3')+_0x40c4fc,_0x477e22);MailAccountEvents['on'](_0x40c4fc,_0xc76845);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index af41b42..69b92f4 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 _0x9cd4=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x48f5b6,_0x4c3778){var _0x4025a0=function(_0x1b67f5){while(--_0x1b67f5){_0x48f5b6['push'](_0x48f5b6['shift']());}};_0x4025a0(++_0x4c3778);}(_0x9cd4,0x1aa));var _0x49cd=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x9cd4[_0x2c3a88];return _0x4a7925;};'use strict';var multer=require(_0x49cd('0x0'));var util=require(_0x49cd('0x1'));var path=require(_0x49cd('0x2'));var timeout=require(_0x49cd('0x3'));var express=require(_0x49cd('0x4'));var router=express['Router']();var fs_extra=require(_0x49cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x49cd('0x6'));var config=require(_0x49cd('0x7'));var controller=require(_0x49cd('0x8'));router[_0x49cd('0x9')](_0x49cd('0xa'),auth[_0x49cd('0xb')](),controller[_0x49cd('0xc')]);router[_0x49cd('0xd')]('/:id',auth[_0x49cd('0xb')](),controller[_0x49cd('0xe')]);router[_0x49cd('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x49cd('0x10')]);module[_0x49cd('0x11')]=router; \ No newline at end of file +var _0x30e9=['./mailApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x407003,_0x20d64e){var _0x4f2d03=function(_0x539fdf){while(--_0x539fdf){_0x407003['push'](_0x407003['shift']());}};_0x4f2d03(++_0x20d64e);}(_0x30e9,0x1ef));var _0x930e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x30e9[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var path=require(_0x930e('0x2'));var timeout=require(_0x930e('0x3'));var express=require(_0x930e('0x4'));var router=express[_0x930e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x930e('0x6'));var interaction=require(_0x930e('0x7'));var config=require(_0x930e('0x8'));var controller=require(_0x930e('0x9'));router[_0x930e('0xa')]('/:id',auth[_0x930e('0xb')](),controller['show']);router[_0x930e('0xc')](_0x930e('0xd'),auth[_0x930e('0xb')](),controller[_0x930e('0xe')]);router[_0x930e('0xf')](_0x930e('0xd'),auth[_0x930e('0xb')](),controller[_0x930e('0x10')]);module[_0x930e('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a22f282..5dc4ffa 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 _0x1205=['exports','INTEGER','TEXT','STRING','sequelize'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x1205,0x108));var _0x5120=function(_0x2ae9c2,_0xaeab52){_0x2ae9c2=_0x2ae9c2-0x0;var _0x8fc040=_0x1205[_0x2ae9c2];return _0x8fc040;};'use strict';var Sequelize=require(_0x5120('0x0'));module[_0x5120('0x1')]={'priority':{'type':Sequelize[_0x5120('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5120('0x3')]()},'description':{'type':Sequelize[_0x5120('0x4')]},'interval':{'type':Sequelize[_0x5120('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfc03=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfc03,0xa4));var _0x3fc0=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfc03[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x3fc0('0x0'));module[_0x3fc0('0x1')]={'priority':{'type':Sequelize[_0x3fc0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3fc0('0x3')],'allowNull':![],'defaultValue':_0x3fc0('0x4')},'appdata':{'type':Sequelize[_0x3fc0('0x5')]()},'description':{'type':Sequelize[_0x3fc0('0x3')]},'interval':{'type':Sequelize[_0x3fc0('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6b16d89..22be0e9 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 _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(_0x178d9c,_0x3aaad3){var _0x9656c5=function(_0x3dfe99){while(--_0x3dfe99){_0x178d9c['push'](_0x178d9c['shift']());}};_0x9656c5(++_0x3aaad3);}(_0x70e0,0x17b));var _0x070e=function(_0x785910,_0x570474){_0x785910=_0x785910-0x0;var _0x799279=_0x70e0[_0x785910];return _0x799279;};'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 +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x85c45c,_0x4bfbca){var _0x3812d4=function(_0x14afc1){while(--_0x14afc1){_0x85c45c['push'](_0x85c45c['shift']());}};_0x3812d4(++_0x4bfbca);}(_0xf4eb,0xec));var _0xbf4e=function(_0x72b7cc,_0x18794b){_0x72b7cc=_0x72b7cc-0x0;var _0x1c084f=_0xf4eb[_0x72b7cc];return _0x1c084f;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5caf9c7..c408cb1 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 _0x3606=['request-promise','../../config/environment','./mailApplication.attributes','exports','mail_applications','utf8mb4','lodash','util','api','moment','bluebird'];(function(_0x2a7906,_0x2786be){var _0x12ffe1=function(_0x45770d){while(--_0x45770d){_0x2a7906['push'](_0x2a7906['shift']());}};_0x12ffe1(++_0x2786be);}(_0x3606,0xed));var _0x6360=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x3606[_0x46451c];return _0x12dce4;};'use strict';var _=require(_0x6360('0x0'));var util=require(_0x6360('0x1'));var logger=require('../../config/logger')(_0x6360('0x2'));var moment=require(_0x6360('0x3'));var BPromise=require(_0x6360('0x4'));var rp=require(_0x6360('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6360('0x6'));var attributes=require(_0x6360('0x7'));module[_0x6360('0x8')]=function(_0x2958c3,_0x23dfe7){return _0x2958c3['define']('MailApplication',attributes,{'tableName':_0x6360('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6360('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdfb0=['exports','define','mail_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x5618a4,_0x1651a4){var _0x526de8=function(_0x25ee15){while(--_0x25ee15){_0x5618a4['push'](_0x5618a4['shift']());}};_0x526de8(++_0x1651a4);}(_0xdfb0,0x74));var _0x0dfb=function(_0x4d744a,_0xecd3b3){_0x4d744a=_0x4d744a-0x0;var _0x1597c8=_0xdfb0[_0x4d744a];return _0x1597c8;};'use strict';var _=require(_0x0dfb('0x0'));var util=require(_0x0dfb('0x1'));var logger=require(_0x0dfb('0x2'))(_0x0dfb('0x3'));var moment=require('moment');var BPromise=require(_0x0dfb('0x4'));var rp=require(_0x0dfb('0x5'));var fs=require('fs');var path=require(_0x0dfb('0x6'));var rimraf=require(_0x0dfb('0x7'));var config=require(_0x0dfb('0x8'));var attributes=require(_0x0dfb('0x9'));module[_0x0dfb('0xa')]=function(_0x3fab75,_0x275f14){return _0x3fab75[_0x0dfb('0xb')]('MailApplication',attributes,{'tableName':_0x0dfb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dfb('0xd'),'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 837ea63..f10d7af 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 _0x9b7f=['then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x52aff0,_0x362c31){var _0x309139=function(_0x5227f9){while(--_0x5227f9){_0x52aff0['push'](_0x52aff0['shift']());}};_0x309139(++_0x362c31);}(_0x9b7f,0x1d4));var _0xf9b7=function(_0xc2fc17,_0x2b78be){_0xc2fc17=_0xc2fc17-0x0;var _0x5b4fe0=_0x9b7f[_0xc2fc17];return _0x5b4fe0;};'use strict';var _=require(_0xf9b7('0x0'));var util=require(_0xf9b7('0x1'));var moment=require(_0xf9b7('0x2'));var BPromise=require(_0xf9b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9b7('0x4'));var db=require(_0xf9b7('0x5'))['db'];var utils=require(_0xf9b7('0x6'));var logger=require('../../config/logger')(_0xf9b7('0x7'));var config=require(_0xf9b7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9b7('0x9')][_0xf9b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3a15,_0x4efc22,_0x688f6){return new BPromise(function(_0x4f5029,_0x45eeb1){return client[_0xf9b7('0xb')](_0x5b3a15,_0x688f6)[_0xf9b7('0xc')](function(_0x326363){logger['info'](_0xf9b7('0xd'),_0x4efc22,_0xf9b7('0xe'));logger[_0xf9b7('0xf')](_0xf9b7('0x10'),_0x4efc22,_0xf9b7('0xe'),JSON[_0xf9b7('0x11')](_0x326363));if(_0x326363[_0xf9b7('0x12')]){if(_0x326363[_0xf9b7('0x12')][_0xf9b7('0x13')]===0x1f4){logger[_0xf9b7('0x12')](_0xf9b7('0xd'),_0x4efc22,_0x326363['error'][_0xf9b7('0x14')]);return _0x45eeb1(_0x326363[_0xf9b7('0x12')][_0xf9b7('0x14')]);}logger[_0xf9b7('0x12')](_0xf9b7('0xd'),_0x4efc22,_0x326363[_0xf9b7('0x12')]['message']);return _0x4f5029(_0x326363[_0xf9b7('0x12')][_0xf9b7('0x14')]);}else{logger[_0xf9b7('0x15')](_0xf9b7('0xd'),_0x4efc22,'request\x20sent');_0x4f5029(_0x326363[_0xf9b7('0x16')][_0xf9b7('0x14')]);}})[_0xf9b7('0x17')](function(_0x4a255e){logger[_0xf9b7('0x12')](_0xf9b7('0xd'),_0x4efc22,_0x4a255e);_0x45eeb1(_0x4a255e);});});}exports[_0xf9b7('0x18')]=function(_0x5870b0){var _0x3ee776=this;return new Promise(function(_0x46de95,_0x1816e4){return db[_0xf9b7('0x19')]['update'](_0x5870b0[_0xf9b7('0x1a')],{'raw':_0x5870b0[_0xf9b7('0x1b')]?_0x5870b0['options'][_0xf9b7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5870b0[_0xf9b7('0x1b')]?_0x5870b0[_0xf9b7('0x1b')][_0xf9b7('0x1d')]||null:null,'attributes':_0x5870b0[_0xf9b7('0x1b')]?_0x5870b0[_0xf9b7('0x1b')][_0xf9b7('0x1e')]||null:null,'limit':_0x5870b0['options']?_0x5870b0['options'][_0xf9b7('0x1f')]||null:null})[_0xf9b7('0xc')](function(_0x49f276){logger['info'](_0xf9b7('0x18'),_0x5870b0);logger[_0xf9b7('0xf')](_0xf9b7('0x18'),_0x5870b0,JSON['stringify'](_0x49f276));_0x46de95(_0x49f276);})[_0xf9b7('0x17')](function(_0xdfe07a){logger[_0xf9b7('0x12')](_0xf9b7('0x18'),_0xdfe07a[_0xf9b7('0x14')],_0x5870b0);_0x1816e4(_0x3ee776[_0xf9b7('0x12')](0x1f4,_0xdfe07a[_0xf9b7('0x14')]));});});}; \ No newline at end of file +var _0x7938=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','limit','then','info','stringify','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x7caf30,_0x267457){var _0x52137d=function(_0x46ea1a){while(--_0x46ea1a){_0x7caf30['push'](_0x7caf30['shift']());}};_0x52137d(++_0x267457);}(_0x7938,0x1cb));var _0x8793=function(_0xab1a0b,_0x460bc6){_0xab1a0b=_0xab1a0b-0x0;var _0x1da8d8=_0x7938[_0xab1a0b];return _0x1da8d8;};'use strict';var _=require(_0x8793('0x0'));var util=require(_0x8793('0x1'));var moment=require('moment');var BPromise=require(_0x8793('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8793('0x3'));var db=require(_0x8793('0x4'))['db'];var utils=require(_0x8793('0x5'));var logger=require('../../config/logger')(_0x8793('0x6'));var config=require(_0x8793('0x7'));var jayson=require(_0x8793('0x8'));var client=jayson[_0x8793('0x9')][_0x8793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230ccb,_0x443a0f,_0x284d3f){return new BPromise(function(_0x4dee5f,_0x3780f0){return client[_0x8793('0xb')](_0x230ccb,_0x284d3f)['then'](function(_0x3196b3){logger['info'](_0x8793('0xc'),_0x443a0f,_0x8793('0xd'));logger[_0x8793('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x443a0f,'request\x20sent',JSON['stringify'](_0x3196b3));if(_0x3196b3[_0x8793('0xf')]){if(_0x3196b3[_0x8793('0xf')][_0x8793('0x10')]===0x1f4){logger[_0x8793('0xf')](_0x8793('0xc'),_0x443a0f,_0x3196b3[_0x8793('0xf')][_0x8793('0x11')]);return _0x3780f0(_0x3196b3[_0x8793('0xf')][_0x8793('0x11')]);}logger['error'](_0x8793('0xc'),_0x443a0f,_0x3196b3[_0x8793('0xf')][_0x8793('0x11')]);return _0x4dee5f(_0x3196b3['error'][_0x8793('0x11')]);}else{logger['info'](_0x8793('0xc'),_0x443a0f,_0x8793('0xd'));_0x4dee5f(_0x3196b3[_0x8793('0x12')][_0x8793('0x11')]);}})['catch'](function(_0x563df5){logger[_0x8793('0xf')](_0x8793('0xc'),_0x443a0f,_0x563df5);_0x3780f0(_0x563df5);});});}exports[_0x8793('0x13')]=function(_0x5cfbe7){var _0x5644c1=this;return new Promise(function(_0xb9d5ff,_0x50f4f1){return db[_0x8793('0x14')]['update'](_0x5cfbe7[_0x8793('0x15')],{'raw':_0x5cfbe7[_0x8793('0x16')]?_0x5cfbe7[_0x8793('0x16')][_0x8793('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cfbe7[_0x8793('0x16')]?_0x5cfbe7['options']['where']||null:null,'attributes':_0x5cfbe7[_0x8793('0x16')]?_0x5cfbe7['options']['attributes']||null:null,'limit':_0x5cfbe7[_0x8793('0x16')]?_0x5cfbe7[_0x8793('0x16')][_0x8793('0x18')]||null:null})[_0x8793('0x19')](function(_0x306753){logger[_0x8793('0x1a')](_0x8793('0x13'),_0x5cfbe7);logger[_0x8793('0xe')](_0x8793('0x13'),_0x5cfbe7,JSON[_0x8793('0x1b')](_0x306753));_0xb9d5ff(_0x306753);})[_0x8793('0x1c')](function(_0x5ada1c){logger[_0x8793('0xf')]('UpdateMailApplication',_0x5ada1c[_0x8793('0x11')],_0x5cfbe7);_0x50f4f1(_0x5644c1[_0x8793('0xf')](0x1f4,_0x5ada1c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9c560f5..88283e8 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 _0xdc5d=['mail','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','./mailInteraction.controller','isAuthenticated','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags'];(function(_0x9974b2,_0xcbbd69){var _0x5d98bb=function(_0x4a4fc0){while(--_0x4a4fc0){_0x9974b2['push'](_0x9974b2['shift']());}};_0x5d98bb(++_0xcbbd69);}(_0xdc5d,0x10e));var _0xddc5=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xdc5d[_0x1f9f37];return _0x21c080;};'use strict';var express=require(_0xddc5('0x0'));var router=express['Router']();var auth=require(_0xddc5('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xddc5('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xddc5('0x3')](),controller[_0xddc5('0x4')]);router[_0xddc5('0x5')](_0xddc5('0x6'),auth[_0xddc5('0x3')](),controller[_0xddc5('0x7')]);router[_0xddc5('0x5')](_0xddc5('0x8'),auth[_0xddc5('0x3')](),controller[_0xddc5('0x9')]);router['get'](_0xddc5('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xddc5('0xb')]('/',auth[_0xddc5('0x3')](),controller[_0xddc5('0xc')]);router[_0xddc5('0xb')](_0xddc5('0x8'),auth[_0xddc5('0x3')](),controller[_0xddc5('0xd')]);router[_0xddc5('0xb')](_0xddc5('0xe'),auth[_0xddc5('0x3')](),interaction[_0xddc5('0xf')]('mail',_0xddc5('0x10')),controller[_0xddc5('0x11')]);router['put'](_0xddc5('0x6'),auth['isAuthenticated'](),interaction[_0xddc5('0xf')](_0xddc5('0x12'),'mailinteraction:update'),controller[_0xddc5('0x13')]);router[_0xddc5('0x14')](_0xddc5('0x6'),auth[_0xddc5('0x3')](),interaction['tracked'](_0xddc5('0x12'),_0xddc5('0x15')),controller[_0xddc5('0x16')]);router[_0xddc5('0x14')](_0xddc5('0xe'),auth[_0xddc5('0x3')](),controller[_0xddc5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9fa9=['./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x9fa9,0x1c7));var _0x99fa=function(_0x1f78e5,_0x5644f2){_0x1f78e5=_0x1f78e5-0x0;var _0x121c19=_0x9fa9[_0x1f78e5];return _0x121c19;};'use strict';var express=require(_0x99fa('0x0'));var router=express[_0x99fa('0x1')]();var auth=require(_0x99fa('0x2'));var interaction=require(_0x99fa('0x3'));var controller=require(_0x99fa('0x4'));router[_0x99fa('0x5')]('/',auth[_0x99fa('0x6')](),controller['index']);router['get'](_0x99fa('0x7'),auth[_0x99fa('0x6')](),controller[_0x99fa('0x8')]);router[_0x99fa('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x99fa('0x5')](_0x99fa('0x9'),auth['isAuthenticated'](),controller[_0x99fa('0xa')]);router['get'](_0x99fa('0xb'),auth[_0x99fa('0x6')](),controller['download']);router[_0x99fa('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x99fa('0x9'),auth[_0x99fa('0x6')](),controller[_0x99fa('0xd')]);router[_0x99fa('0xc')](_0x99fa('0xe'),auth[_0x99fa('0x6')](),interaction[_0x99fa('0xf')]('mail',_0x99fa('0x10')),controller[_0x99fa('0x11')]);router[_0x99fa('0x12')](_0x99fa('0x13'),auth['isAuthenticated'](),interaction[_0x99fa('0xf')](_0x99fa('0x14'),_0x99fa('0x15')),controller[_0x99fa('0x16')]);router[_0x99fa('0x17')]('/:id',auth[_0x99fa('0x6')](),interaction[_0x99fa('0xf')]('mail','mailinteraction:destroy'),controller[_0x99fa('0x18')]);router[_0x99fa('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0x99fa('0x19')]);module[_0x99fa('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 9473e7b..4c00355 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 _0x5458=['out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM'];(function(_0x1a0981,_0x3bc99d){var _0x3f2fe3=function(_0x49b772){while(--_0x49b772){_0x1a0981['push'](_0x1a0981['shift']());}};_0x3f2fe3(++_0x3bc99d);}(_0x5458,0x1d7));var _0x8545=function(_0x1a39d3,_0x50bbbf){_0x1a39d3=_0x1a39d3-0x0;var _0x2881b5=_0x5458[_0x1a39d3];return _0x2881b5;};'use strict';var Sequelize=require(_0x8545('0x0'));var iconv=require(_0x8545('0x1'));module[_0x8545('0x2')]={'closed':{'type':Sequelize[_0x8545('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8545('0x4')]},'note':{'type':Sequelize[_0x8545('0x4')]},'inReplyTo':{'type':Sequelize[_0x8545('0x4')](0x1fe)},'to':{'type':Sequelize[_0x8545('0x4')]},'cc':{'type':Sequelize[_0x8545('0x5')](_0x8545('0x6'))},'subject':{'type':Sequelize[_0x8545('0x5')]()},'attach':{'type':Sequelize[_0x8545('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8545('0x7')]},'substatus':{'type':Sequelize[_0x8545('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x8545('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x8545('0x8')]('in',_0x8545('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8545('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8545('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c6f=['out','ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x3c6f,0x161));var _0xf3c6=function(_0x2ffb69,_0x21b207){_0x2ffb69=_0x2ffb69-0x0;var _0x39f338=_0x3c6f[_0x2ffb69];return _0x39f338;};'use strict';var Sequelize=require(_0xf3c6('0x0'));var iconv=require(_0xf3c6('0x1'));module[_0xf3c6('0x2')]={'closed':{'type':Sequelize[_0xf3c6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf3c6('0x4')]},'disposition':{'type':Sequelize[_0xf3c6('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xf3c6('0x5')](0x1fe)},'to':{'type':Sequelize[_0xf3c6('0x5')]},'cc':{'type':Sequelize[_0xf3c6('0x6')]('long')},'subject':{'type':Sequelize[_0xf3c6('0x6')]()},'attach':{'type':Sequelize[_0xf3c6('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf3c6('0x4')]},'substatus':{'type':Sequelize[_0xf3c6('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xf3c6('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf3c6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf3c6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf3c6('0x8')]('in',_0xf3c6('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf3c6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4386dbe..007dad0 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 _0xeda8=['mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','basename','existsSync','attachments','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','end','json','offset','limit','undefined','update','then','destroy','sendStatus','name','Users','map','fullname','TagIds','split','forEach','Tags','push','plainBody','-id','trimStart','catch','talking','answered','unmanaged','UserId','waiting','closed','total','MailInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','keys','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.secondDisposition','i.substatus','i.to','i.ContactId','i.UserId','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','params','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','MailMessage','pick','$gte','format','findAll','inlineCss','addTags','setTags','omit','color','emit'];(function(_0x15da7c,_0xaeb6a3){var _0x26146f=function(_0x15dbce){while(--_0x15dbce){_0x15da7c['push'](_0x15da7c['shift']());}};_0x26146f(++_0xaeb6a3);}(_0xeda8,0x104));var _0x8eda=function(_0x1342cf,_0x29e845){_0x1342cf=_0x1342cf-0x0;var _0x5164f2=_0xeda8[_0x1342cf];return _0x5164f2;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var moment=require(_0x8eda('0x2'));var BPromise=require(_0x8eda('0x3'));var util=require(_0x8eda('0x4'));var path=require(_0x8eda('0x5'));var fs=require('fs');var _=require(_0x8eda('0x6'));var squel=require(_0x8eda('0x7'));var juice=require(_0x8eda('0x8'));var Redis=require(_0x8eda('0x9'));var qs=require(_0x8eda('0xa'));var as=require(_0x8eda('0xb'));var logger=require(_0x8eda('0xc'))(_0x8eda('0xd'));var config=require('../../config/environment');var db=require(_0x8eda('0xe'))['db'];var htmlEntities=require(_0x8eda('0xf'));config[_0x8eda('0x10')]=_[_0x8eda('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8eda('0x12'))[_0x8eda('0x13')](socket);function respondWithStatusCode(_0x41442d,_0x515c63){_0x515c63=_0x515c63||0xcc;return function(_0x1ef0dc){if(_0x1ef0dc){return _0x41442d['sendStatus'](_0x515c63);}return _0x41442d[_0x8eda('0x14')](_0x515c63)[_0x8eda('0x15')]();};}function respondWithResult(_0x2fdec0,_0x1ad3df){_0x1ad3df=_0x1ad3df||0xc8;return function(_0x337573){if(_0x337573){return _0x2fdec0[_0x8eda('0x14')](_0x1ad3df)[_0x8eda('0x16')](_0x337573);}};}function respondWithFilteredResult(_0x24ea76,_0x57957c){return function(_0x500bd4){if(_0x500bd4){var _0xe04d90=typeof _0x57957c[_0x8eda('0x17')]==='undefined'&&typeof _0x57957c[_0x8eda('0x18')]===_0x8eda('0x19');var _0x123905=_0x500bd4['count'];var _0x3f2925=_0xe04d90?0x0:_0x57957c['offset'];var _0xf7d764=_0xe04d90?_0x500bd4['count']:_0x57957c[_0x8eda('0x17')]+_0x57957c['limit'];var _0x38a6a0;if(_0xf7d764>=_0x123905){_0xf7d764=_0x123905;_0x38a6a0=0xc8;}else{_0x38a6a0=0xce;}_0x24ea76[_0x8eda('0x14')](_0x38a6a0);return _0x24ea76['set']('Content-Range',_0x3f2925+'-'+_0xf7d764+'/'+_0x123905)[_0x8eda('0x16')](_0x500bd4);}return null;};}function saveUpdates(_0x1b7e94){return function(_0x1b089d){if(_0x1b089d){return _0x1b089d[_0x8eda('0x1a')](_0x1b7e94)[_0x8eda('0x1b')](function(_0x1b46ee){return _0x1b46ee;});}return null;};}function removeEntity(_0x4fb4ee){return function(_0x7081dd){if(_0x7081dd){return _0x7081dd[_0x8eda('0x1c')]()[_0x8eda('0x1b')](function(){_0x4fb4ee[_0x8eda('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33143e){return function(_0x4f8483){if(!_0x4f8483){_0x33143e[_0x8eda('0x1d')](0x194);}return _0x4f8483;};}function handleError(_0x5183bc,_0x1033d6){_0x1033d6=_0x1033d6||0x1f4;return function(_0x2dab25){logger['error'](_0x2dab25['stack']);if(_0x2dab25['name']){delete _0x2dab25[_0x8eda('0x1e')];}_0x5183bc[_0x8eda('0x14')](_0x1033d6)['send'](_0x2dab25);};}function getInteractionUsers(_0x978502,_0x37a8ab){return new BPromise(function(_0x54aa7f,_0x25e955){try{if(_0x37a8ab[_0x978502['id']]){_0x978502[_0x8eda('0x1f')]=_[_0x8eda('0x20')](_0x37a8ab[_0x978502['id']],function(_0x9b4450){return{'id':_0x9b4450['id'],'fullname':_0x9b4450[_0x8eda('0x21')]};});}}catch(_0x5c8488){_0x25e955(_0x5c8488);}_0x54aa7f(_0x978502);});}function getInteractionTags(_0x41b5a9,_0x5a8bed){return new BPromise(function(_0x35310c,_0x2e8b2b){try{if(_0x41b5a9[_0x8eda('0x22')]){_0x41b5a9['Tags']=[];_0x41b5a9[_0x8eda('0x22')][_0x8eda('0x23')](',')[_0x8eda('0x24')](function(_0x4cdd2e){_0x41b5a9[_0x8eda('0x25')][_0x8eda('0x26')](_0x5a8bed[_0x4cdd2e]);});}delete _0x41b5a9['TagIds'];}catch(_0x27d2ce){_0x2e8b2b(_0x27d2ce);}_0x35310c(_0x41b5a9);});}function getLastMessageText(_0x29e6f4){return new BPromise(function(_0x373ff6,_0x3cf3f7){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x29e6f4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8eda('0x27')],'order':_0x8eda('0x28'),'raw':!![]})[_0x8eda('0x1b')](function(_0x540690){if(_0x540690&&_0x540690['plainBody']){_0x29e6f4['lastMsgText']=_[_0x8eda('0x29')](_0x540690[_0x8eda('0x27')]);}_0x373ff6(_0x29e6f4);})[_0x8eda('0x2a')](function(_0x47b64f){_0x3cf3f7(_0x47b64f);});});}function updateMailInteraction(_0x55688c,_0x5cb636,_0x1cf2dd,_0x3e1431){return new BPromise(function(_0x142f67,_0x2a3cdc){return getInteractionUsers(_0x55688c,_0x1cf2dd)[_0x8eda('0x1b')](function(_0x32fb2d){return getInteractionTags(_0x32fb2d,_0x5cb636);})[_0x8eda('0x1b')](function(_0x2d4f9f){return getStateInteraction(_0x2d4f9f);})[_0x8eda('0x1b')](function(_0x11f40e){if(_0x3e1431){_0x142f67(getLastMessageText(_0x11f40e));}else{_0x142f67(_0x11f40e);}})[_0x8eda('0x2a')](function(_0x3132fd){_0x2a3cdc(_0x3132fd);});});}function getStateInteraction(_0xc354d9){return new BPromise(function(_0x34d24c){_0xc354d9['waiting']=0x0;_0xc354d9[_0x8eda('0x2b')]=0x0;_0xc354d9[_0x8eda('0x2c')]=0x0;_0xc354d9[_0x8eda('0x2d')]=0x0;_0xc354d9['total']=0x0;if(!_0xc354d9['closed']&&!_0xc354d9[_0x8eda('0x2e')]){_0xc354d9[_0x8eda('0x2f')]+=0x1;}if(!_0xc354d9[_0x8eda('0x30')]&&_0xc354d9[_0x8eda('0x2e')]){_0xc354d9['talking']+=0x1;if(_0xc354d9[_0x8eda('0x2f')]){_0xc354d9[_0x8eda('0x2f')]-=0x1;}}if(_0xc354d9[_0x8eda('0x30')]&&_0xc354d9[_0x8eda('0x2e')]){_0xc354d9[_0x8eda('0x2c')]+=0x1;if(_0xc354d9[_0x8eda('0x2b')]){_0xc354d9['talking']-=0x1;}}if(_0xc354d9[_0x8eda('0x30')]&&!_0xc354d9[_0x8eda('0x2e')]){_0xc354d9[_0x8eda('0x2d')]+=0x1;if(_0xc354d9[_0x8eda('0x2f')]){_0xc354d9[_0x8eda('0x2f')]-=0x1;}}_0xc354d9[_0x8eda('0x31')]+=0x1;_0x34d24c(_0xc354d9);});}exports['index']=function(_0x1067eb,_0x2007c3){var _0x322393={},_0x3b8527={},_0xa1e556={'count':0x0,'rows':[]};var _0x5cf565=_[_0x8eda('0x20')](db[_0x8eda('0x32')][_0x8eda('0x33')],function(_0x48f636){return{'name':_0x48f636[_0x8eda('0x34')],'type':_0x48f636['type'][_0x8eda('0x35')]};});_0x3b8527[_0x8eda('0x36')]=_[_0x8eda('0x20')](_0x5cf565,_0x8eda('0x1e'));_0x3b8527[_0x8eda('0x37')]=_['keys'](_0x1067eb['query']);_0x3b8527[_0x8eda('0x38')]=_[_0x8eda('0x39')](_0x3b8527[_0x8eda('0x36')],_0x3b8527[_0x8eda('0x37')]);_0x322393[_0x8eda('0x3a')]=_[_0x8eda('0x39')](_0x3b8527[_0x8eda('0x36')],qs[_0x8eda('0x3b')](_0x1067eb[_0x8eda('0x37')][_0x8eda('0x3b')]));_0x322393[_0x8eda('0x3a')]=_0x322393[_0x8eda('0x3a')][_0x8eda('0x3c')]?_0x322393[_0x8eda('0x3a')]:_0x3b8527[_0x8eda('0x36')];if(!_0x1067eb[_0x8eda('0x37')][_0x8eda('0x3d')](_0x8eda('0x3e'))){_0x322393[_0x8eda('0x18')]=qs['limit'](_0x1067eb[_0x8eda('0x37')][_0x8eda('0x18')]);_0x322393['offset']=qs[_0x8eda('0x17')](_0x1067eb[_0x8eda('0x37')]['offset']);}_0x322393[_0x8eda('0x3f')]=qs[_0x8eda('0x40')](_0x1067eb['query'][_0x8eda('0x40')]);_0x322393[_0x8eda('0x41')]=qs[_0x8eda('0x38')](_['pick'](_0x1067eb[_0x8eda('0x37')],_0x3b8527[_0x8eda('0x38')]),_0x5cf565);var _0x3996b7=[];var _0xd8b8f4=squel[_0x8eda('0x42')]()[_0x8eda('0x43')]('id')[_0x8eda('0x43')]('name')[_0x8eda('0x43')]('color')[_0x8eda('0x44')]('tools_tags');var _0x1a64e8=squel['select']()[_0x8eda('0x43')]('u.id')[_0x8eda('0x43')](_0x8eda('0x45'))[_0x8eda('0x43')](_0x8eda('0x46'))[_0x8eda('0x44')](_0x8eda('0x47'),'ui')[_0x8eda('0x48')](_0x8eda('0x49'),'u',_0x8eda('0x4a'));var _0x17518f=squel[_0x8eda('0x42')]()[_0x8eda('0x44')]('mail_interactions','i')[_0x8eda('0x48')](_0x8eda('0x4b'),'c',_0x8eda('0x4c'))[_0x8eda('0x48')](_0x8eda('0x49'),'o',_0x8eda('0x4d'))[_0x8eda('0x48')](_0x8eda('0x4e'),'a',_0x8eda('0x4f'))[_0x8eda('0x48')](_0x8eda('0x50'),'me',_0x8eda('0x51'))[_0x8eda('0x48')](_0x8eda('0x52'),'it',_0x8eda('0x53'))['left_join'](_0x8eda('0x54'),'t',_0x8eda('0x55'));var _0xabfddb=squel[_0x8eda('0x56')]();var _0x1a6bde=[];var _0x8a172a=squel['expr']();var _0xe77773;if(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x57')]){_0xe77773=as['parseSearch'](_0x1067eb[_0x8eda('0x37')]['search']);var _0x3d16b4=_0xe77773[_0x8eda('0x58')];for(var _0x12ccb4=0x0;_0x12ccb4<_0xe77773['conditions'][_0x8eda('0x3c')];_0x12ccb4++){var _0x557eed=_0xe77773[_0x8eda('0x59')][_0x12ccb4];var _0x4ce70c='i';var _0x3d6378=_[_0x8eda('0x5a')](_0x5cf565,[_0x8eda('0x1e'),_0x557eed[_0x8eda('0x43')]]);if(!_0x3d6378){switch(_0x557eed[_0x8eda('0x43')]){case _0x8eda('0x5b'):if(_0x557eed[_0x8eda('0x5c')]==0x1){_0x17518f[_0x8eda('0x5d')]('`'+_0x557eed[_0x8eda('0x43')]+_0x8eda('0x5e'));}else{_0x17518f['having']('`'+_0x557eed[_0x8eda('0x43')]+_0x8eda('0x5f'));}break;case'Contact':if(_0x557eed[_0x8eda('0x60')]==='$substring'){if(_0x557eed['value']['split']('\x20')['length']>0x1){_0xabfddb[_0x3d16b4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8eda('0x61')](_0x557eed['value']),null);}else{var _0x10745e='%'+_0x557eed[_0x8eda('0x5c')]+'%';_0xabfddb[_0x3d16b4](_0x8eda('0x62'),_0x10745e,_0x10745e,_0x10745e);}}else{_0x3d6378=_[_0x8eda('0x5a')](_0x5cf565,[_0x8eda('0x1e'),_0x8eda('0x63')]);_0x557eed[_0x8eda('0x43')]='ContactId';_0x2f90a4=as[_0x8eda('0x64')](_0x4ce70c,_0x3d6378['type'],_0x557eed);_0xabfddb[_0x3d16b4](_0x2f90a4[_0x8eda('0x65')],_0x2f90a4['value'][_0x8eda('0x66')],_0x2f90a4['value'][_0x8eda('0x15')]);}break;case _0x8eda('0x67'):var _0x2699f5=_0x557eed['value']['split'](',')['map'](function(_0x2650fe){return Number(_0x2650fe);});_0x2699f5[_0x8eda('0x24')](function(_0x4b9ace){_0x8a172a['or'](_0x8eda('0x68'),'%,'+_0x4b9ace+',%');});_0x1a6bde=_['union'](_0x1a6bde,_0x2699f5);break;case'User':if(_0x557eed[_0x8eda('0x60')]===_0x8eda('0x69')){_0xabfddb[_0x3d16b4](_0x8eda('0x6a'),'%'+_0x557eed[_0x8eda('0x5c')]+'%',null);}else{_0x3d6378=_['find'](_0x5cf565,['name',_0x8eda('0x2e')]);_0x557eed[_0x8eda('0x43')]=_0x8eda('0x2e');_0x2f90a4=as[_0x8eda('0x64')](_0x4ce70c,_0x3d6378['type'],_0x557eed);_0xabfddb[_0x3d16b4](_0x2f90a4[_0x8eda('0x65')],_0x2f90a4['value'][_0x8eda('0x66')],_0x2f90a4['value'][_0x8eda('0x15')]);}break;case'plainBody':_0x2f90a4=as[_0x8eda('0x64')]('me',null,_0x557eed);_0xabfddb[_0x3d16b4](_0x2f90a4[_0x8eda('0x65')],_0x2f90a4[_0x8eda('0x5c')][_0x8eda('0x66')],_0x2f90a4[_0x8eda('0x5c')][_0x8eda('0x15')]);break;}}else{var _0x2f90a4=as[_0x8eda('0x64')](_0x4ce70c,_0x3d6378[_0x8eda('0x6b')],_0x557eed);_0xabfddb[_0x3d16b4](_0x2f90a4['text'],_0x2f90a4['value'][_0x8eda('0x66')],_0x2f90a4['value'][_0x8eda('0x15')]);}}}else{var _0x117322=_(_0x1067eb[_0x8eda('0x37')])[_0x8eda('0x6c')]()[_0x8eda('0x20')](function(_0x53cc8a){return _['some'](_0x5cf565,[_0x8eda('0x1e'),_0x53cc8a])?_0x53cc8a:undefined;})[_0x8eda('0x6d')]()[_0x8eda('0x5c')]();if(!_[_0x8eda('0x6e')](_0x117322)){_0x117322[_0x8eda('0x24')](function(_0x3e9a87){if(_0x3e9a87===_0x8eda('0x6f')){_0x17518f['where'](_0x8eda('0x70'),[][_0x8eda('0x71')](_0x1067eb['query'][_0x3e9a87]));}else if(_0x3e9a87===_0x8eda('0x72')){var _0x5467e9=JSON['parse'](_0x1067eb['query'][_0x3e9a87])['$gte'];var _0x1e6e86=JSON[_0x8eda('0x73')](_0x1067eb[_0x8eda('0x37')][_0x3e9a87])[_0x8eda('0x74')];_0x17518f[_0x8eda('0x41')](_0x8eda('0x75'),_0x5467e9,_0x1e6e86);}else{if(_0x1067eb['query'][_0x3e9a87]===_0x8eda('0x76')){_0x17518f[_0x8eda('0x41')]('i.'+_0x3e9a87+_0x8eda('0x77'));}else{_0x17518f[_0x8eda('0x41')]('i.'+_0x3e9a87+'\x20=\x20?',_0x1067eb[_0x8eda('0x37')][_0x3e9a87]);}}});}if(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x78')]){if(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x78')]==0x1){_0x17518f[_0x8eda('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x17518f[_0x8eda('0x5d')](_0x8eda('0x79'));}}if(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x7a')]){_0x1a6bde=_[_0x8eda('0x7b')](_0x1067eb[_0x8eda('0x37')][_0x8eda('0x7a')])?_0x1067eb[_0x8eda('0x37')][_0x8eda('0x7a')]:new Array(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x7a')]);_0x1a6bde[_0x8eda('0x24')](function(_0x3afd40){_0x8a172a['or'](_0x8eda('0x68'),'%,'+_0x3afd40+',%');});}if(_0x1067eb['query']['filter']){var _0x2c721c=_0x1067eb[_0x8eda('0x37')][_0x8eda('0x7c')][_0x8eda('0x7d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8eda('0x7e')](_0x2c721c)){_0xabfddb['or'](_0x8eda('0x7f'),_0x2c721c+'%');}else if(qs['isEmail'](_0x2c721c)){_0xabfddb['or'](_0x8eda('0x80'),_0x2c721c+'%');}else{_0xabfddb['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8eda('0x61')](_0x2c721c))['or'](_0x8eda('0x81'),qs[_0x8eda('0x61')](_0x2c721c));}}}_0x17518f['where'](_0xabfddb);_0x17518f[_0x8eda('0x82')](_0x8eda('0x83'));var _0x316e41={'type':db['Sequelize'][_0x8eda('0x84')][_0x8eda('0x85')],'raw':!![]};var _0x10fcab=_0x17518f[_0x8eda('0x86')]();_0x10fcab['field']('i.id');_0x10fcab[_0x8eda('0x43')](_0x8eda('0x87'),_0x8eda('0x5b'));if(_0x322393[_0x8eda('0x3f')]){_0x322393['order'][_0x8eda('0x24')](function(_0x10f073){var _0x1aca01=_0x10f073[0x0]===_0x8eda('0x88')?_0x10f073[0x0]:'i.'+_0x10f073[0x0];_0x17518f[_0x8eda('0x3f')](_0x1aca01,_0x10f073[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8eda('0x6e')](_0x1a6bde)){_0x17518f[_0x8eda('0x5d')](_0x8a172a);_0x10fcab[_0x8eda('0x41')]('t.id\x20IN\x20?',_0x1a6bde);}BPromise['resolve']()['then'](function(){if(!_0xe77773){if(_0x1067eb[_0x8eda('0x37')][_0x8eda('0x6f')])return;_0x10fcab[_0x8eda('0x41')](_0x8eda('0x89'));_0x17518f[_0x8eda('0x41')](_0x8eda('0x89'));return;}if(_0x1067eb[_0x8eda('0x8a')][_0x8eda('0x8b')]!=='agent')return;return _0x1067eb[_0x8eda('0x8a')][_0x8eda('0x8c')]({'attributes':['id'],'raw':!![]})[_0x8eda('0x1b')](function(_0x53635b){if(_[_0x8eda('0x6e')](_0x53635b)){_0x10fcab[_0x8eda('0x41')](_0x8eda('0x8d'));_0x17518f[_0x8eda('0x41')](_0x8eda('0x8d'));}else{_0x10fcab[_0x8eda('0x41')](_0x8eda('0x70'),_[_0x8eda('0x20')](_0x53635b,'id'));_0x17518f[_0x8eda('0x41')](_0x8eda('0x70'),_[_0x8eda('0x20')](_0x53635b,'id'));}});})['then'](function(){if(_0x1067eb[_0x8eda('0x8a')][_0x8eda('0x8b')]===_0x8eda('0x8e')&&!_0xe77773&&!_0x1067eb[_0x8eda('0x37')][_0x8eda('0x6f')])return[];return db[_0x8eda('0x8f')][_0x8eda('0x37')](_0x10fcab[_0x8eda('0x90')](),_0x316e41);})[_0x8eda('0x1b')](function(_0x2c4ab4){_0xa1e556[_0x8eda('0x91')]=_0x2c4ab4['length'];if(_0xa1e556['count']===0x0)return[];return db['sequelize'][_0x8eda('0x37')](_0xd8b8f4[_0x8eda('0x90')](),_0x316e41)['then'](function(_0x294b79){_0x3996b7=_[_0x8eda('0x92')](_0x294b79,'id');_0x316e41=_[_0x8eda('0x93')](_0x316e41,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1067eb[_0x8eda('0x37')]['fields']){_0x322393[_0x8eda('0x3a')]['forEach'](function(_0x49a43){_0x17518f[_0x8eda('0x43')]('i.'+_0x49a43);});}else{_0x17518f['field'](_0x8eda('0x87'),_0x8eda('0x5b'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x94'),_0x8eda('0x95'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x96'),_0x8eda('0x97'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x98'),'contactName');_0x17518f['field']('i.id');_0x17518f['field'](_0x8eda('0x99'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x9a'));_0x17518f['field'](_0x8eda('0x9b'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x9c'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x9d'));_0x17518f[_0x8eda('0x43')](_0x8eda('0x9e'));_0x17518f[_0x8eda('0x43')]('i.lastMsgDirection');_0x17518f['field'](_0x8eda('0x9f'));_0x17518f[_0x8eda('0x43')]('i.disposition');_0x17518f[_0x8eda('0x43')](_0x8eda('0xa0'));_0x17518f[_0x8eda('0x43')]('i.thirdDisposition');_0x17518f[_0x8eda('0x43')](_0x8eda('0xa1'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xa2'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xa3'));_0x17518f[_0x8eda('0x43')]('i.MailAccountId');_0x17518f[_0x8eda('0x43')](_0x8eda('0xa4'));_0x17518f['field']('c.firstName','Contact.firstName');_0x17518f[_0x8eda('0x43')](_0x8eda('0xa5'),_0x8eda('0xa6'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xa7'),_0x8eda('0xa8'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xa9'),_0x8eda('0xaa'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xab'),_0x8eda('0xac'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xad'),'Contact.fax');_0x17518f[_0x8eda('0x43')](_0x8eda('0xae'),_0x8eda('0xaf'));_0x17518f[_0x8eda('0x43')]('o.internal',_0x8eda('0xb0'));_0x17518f[_0x8eda('0x43')](_0x8eda('0xb1'),_0x8eda('0x22'));}if(_0x322393[_0x8eda('0x18')])_0x17518f[_0x8eda('0x18')](_0x322393[_0x8eda('0x18')]);if(_0x322393[_0x8eda('0x17')])_0x17518f[_0x8eda('0x17')](_0x322393[_0x8eda('0x17')]);return db['sequelize']['query'](_0x17518f[_0x8eda('0x90')](),_0x316e41);})[_0x8eda('0x1b')](function(_0x1b5d1e){if(_0x1b5d1e[_0x8eda('0x3c')]>0x0)_0x1a64e8['where'](_0x8eda('0xb2'),_[_0x8eda('0x20')](_0x1b5d1e,'id'));return db[_0x8eda('0x8f')][_0x8eda('0x37')](_0x1a64e8[_0x8eda('0x90')](),_0x316e41)[_0x8eda('0x1b')](function(_0x9edfd9){var _0x302329=_['groupBy'](_0x9edfd9,_0x8eda('0xb3'));var _0x64426e=[];return db[_0x8eda('0xb4')][_0x8eda('0xb5')]({'attributes':[_0x8eda('0xb6')],'raw':!![]})[_0x8eda('0x1b')](function(_0x7f3ddd){var _0x1d09a9=_0x7f3ddd[_0x8eda('0xb6')];_0x1b5d1e[_0x8eda('0x24')](function(_0x4d1cbe){_0x64426e[_0x8eda('0x26')](updateMailInteraction(_0x4d1cbe,_0x3996b7,_0x302329,_0x1d09a9));});return BPromise[_0x8eda('0xb7')](_0x64426e);});});});})[_0x8eda('0x1b')](function(_0x4ce86d){_0xa1e556[_0x8eda('0xb8')]=_0x4ce86d;return _0xa1e556;})['then'](respondWithFilteredResult(_0x2007c3,_0x322393))['catch'](handleError(_0x2007c3,null));};exports['show']=function(_0x4497a3,_0x175b5a){var _0x51be1c={'raw':![],'where':{'id':_0x4497a3[_0x8eda('0xb9')]['id']}},_0x3923a5={};_0x3923a5['model']=_[_0x8eda('0x6c')](db[_0x8eda('0x32')]['rawAttributes']);_0x3923a5['query']=_[_0x8eda('0x6c')](_0x4497a3['query']);_0x3923a5['filters']=_[_0x8eda('0x39')](_0x3923a5[_0x8eda('0x36')],_0x3923a5['query']);_0x51be1c[_0x8eda('0x3a')]=_[_0x8eda('0x39')](_0x3923a5[_0x8eda('0x36')],qs['fields'](_0x4497a3['query'][_0x8eda('0x3b')]));_0x51be1c['attributes']=_0x51be1c['attributes']['length']?_0x51be1c[_0x8eda('0x3a')]:_0x3923a5['model'];if(_0x4497a3[_0x8eda('0x37')][_0x8eda('0xba')]){_0x51be1c[_0x8eda('0xbb')]=[{'all':!![]}];}_0x51be1c=_[_0x8eda('0x93')]({},_0x51be1c,_0x4497a3[_0x8eda('0xbc')]);return db[_0x8eda('0x32')][_0x8eda('0x5a')](_0x51be1c)[_0x8eda('0x1b')](handleEntityNotFound(_0x175b5a,null))[_0x8eda('0x1b')](respondWithResult(_0x175b5a,null))[_0x8eda('0x2a')](handleError(_0x175b5a,null));};exports['create']=function(_0x54fe2e,_0x3c7080){return db['MailInteraction'][_0x8eda('0xbd')](_0x54fe2e[_0x8eda('0xbe')],{})[_0x8eda('0x1b')](respondWithResult(_0x3c7080,0xc9))[_0x8eda('0x2a')](handleError(_0x3c7080,null));};exports[_0x8eda('0x1a')]=function(_0x183bf7,_0xea744a){if(_0x183bf7['body']['id']){delete _0x183bf7[_0x8eda('0xbe')]['id'];}return db[_0x8eda('0x32')]['find']({'where':{'id':_0x183bf7[_0x8eda('0xb9')]['id']}})[_0x8eda('0x1b')](handleEntityNotFound(_0xea744a,null))[_0x8eda('0x1b')](saveUpdates(_0x183bf7[_0x8eda('0xbe')],null))[_0x8eda('0x1b')](respondWithResult(_0xea744a,null))['catch'](handleError(_0xea744a,null));};exports[_0x8eda('0x1c')]=function(_0x4997aa,_0x38c2ab){return db[_0x8eda('0x32')]['find']({'where':{'id':_0x4997aa['params']['id']}})[_0x8eda('0x1b')](handleEntityNotFound(_0x38c2ab,null))[_0x8eda('0x1b')](removeEntity(_0x38c2ab,null))[_0x8eda('0x2a')](handleError(_0x38c2ab,null));};exports[_0x8eda('0xbf')]=function(_0x48e697,_0x50a22e){return db[_0x8eda('0x32')][_0x8eda('0xbf')]()[_0x8eda('0x1b')](respondWithResult(_0x50a22e,null))[_0x8eda('0x2a')](handleError(_0x50a22e,null));};exports[_0x8eda('0xc0')]=function(_0x2889fb,_0x1bb7a3){return db['MailMessage']['find']({'where':{'id':_0x2889fb[_0x8eda('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1bb7a3,null))['then'](function(_0x3aea54){if(_0x3aea54){return _0x3aea54[_0x8eda('0xc0')](_0x2889fb[_0x8eda('0xbe')][_0x8eda('0xc1')],_['omit'](_0x2889fb[_0x8eda('0xbe')],[_0x8eda('0xc1'),'id'])||{});}})[_0x8eda('0x1b')](respondWithResult(_0x1bb7a3,null))[_0x8eda('0x2a')](handleError(_0x1bb7a3,null));};exports[_0x8eda('0xc2')]=function(_0x33a4f4,_0x1514ee){var _0xa74ba2={'raw':![],'where':{}};var _0x1db309={};var _0x165d3b={'count':0x0,'rows':[]};return db[_0x8eda('0x32')][_0x8eda('0xb5')]({'where':{'id':_0x33a4f4[_0x8eda('0xb9')]['id']}})[_0x8eda('0x1b')](handleEntityNotFound(_0x1514ee,null))[_0x8eda('0x1b')](function(_0x1b6aa0){if(_0x1b6aa0){_0x1db309[_0x8eda('0x36')]=_[_0x8eda('0x6c')](db[_0x8eda('0xc3')]['rawAttributes']);_0x1db309[_0x8eda('0x37')]=_['keys'](_0x33a4f4[_0x8eda('0x37')]);_0x1db309[_0x8eda('0x38')]=_[_0x8eda('0x39')](_0x1db309[_0x8eda('0x36')],_0x1db309[_0x8eda('0x37')]);_0xa74ba2[_0x8eda('0x3a')]=_[_0x8eda('0x39')](_0x1db309['model'],qs[_0x8eda('0x3b')](_0x33a4f4[_0x8eda('0x37')][_0x8eda('0x3b')]));_0xa74ba2[_0x8eda('0x3a')]=_0xa74ba2[_0x8eda('0x3a')][_0x8eda('0x3c')]?_0xa74ba2['attributes']:_0x1db309['model'];if(!_0x33a4f4['query']['hasOwnProperty'](_0x8eda('0x3e'))){_0xa74ba2[_0x8eda('0x18')]=qs[_0x8eda('0x18')](_0x33a4f4[_0x8eda('0x37')]['limit']);_0xa74ba2[_0x8eda('0x17')]=qs[_0x8eda('0x17')](_0x33a4f4[_0x8eda('0x37')]['offset']);}_0xa74ba2[_0x8eda('0x3f')]=qs['sort'](_0x33a4f4[_0x8eda('0x37')][_0x8eda('0x40')]);_0xa74ba2['where']=qs['filters'](_[_0x8eda('0xc4')](_0x33a4f4[_0x8eda('0x37')],_0x1db309[_0x8eda('0x38')]));_0xa74ba2[_0x8eda('0x41')]['MailInteractionId']=_0x1b6aa0['id'];if(_0x33a4f4[_0x8eda('0x37')][_0x8eda('0x7c')]){_0xa74ba2[_0x8eda('0x41')]=_[_0x8eda('0x93')](_0xa74ba2[_0x8eda('0x41')],{'$or':_['map'](_0xa74ba2[_0x8eda('0x3a')],function(_0x4d6b1c){var _0x1bbabf={};_0x1bbabf[_0x4d6b1c]={'$like':'%'+_0x33a4f4[_0x8eda('0x37')][_0x8eda('0x7c')]+'%'};return _0x1bbabf;})});}if(_0x33a4f4['query'][_0x8eda('0xc5')]){var _0x733235=_0x33a4f4[_0x8eda('0x37')][_0x8eda('0xc5')][_0x8eda('0x23')](',');var _0xfe3faf={};_0xfe3faf[_0x733235[0x0]]={'$gte':moment(_0x733235[0x1])[_0x8eda('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0xa74ba2[_0x8eda('0x41')]=_[_0x8eda('0x93')](_0xa74ba2[_0x8eda('0x41')],_0xfe3faf);}_0xa74ba2=_[_0x8eda('0x93')]({},_0xa74ba2,_0x33a4f4[_0x8eda('0xbc')]);return db[_0x8eda('0xc3')][_0x8eda('0x91')]({'where':_0xa74ba2[_0x8eda('0x41')]})['then'](function(_0x13b7ec){_0x165d3b[_0x8eda('0x91')]=_0x13b7ec;if(_0x33a4f4[_0x8eda('0x37')][_0x8eda('0xba')]){_0xa74ba2[_0x8eda('0xbb')]=[{'all':!![]}];}return db[_0x8eda('0xc3')][_0x8eda('0xc7')](_0xa74ba2);})['then'](function(_0xa583a8){if(_0x33a4f4[_0x8eda('0x37')][_0x8eda('0xc8')]==='true'){for(var _0x473474=0x0;_0x473474<_0xa583a8[_0x8eda('0x3c')];_0x473474++){_0xa583a8[_0x473474][_0x8eda('0xbe')]=juice(_0xa583a8[_0x473474][_0x8eda('0xbe')]);}}_0x165d3b[_0x8eda('0xb8')]=_0xa583a8;return _0x165d3b;});}})[_0x8eda('0x1b')](respondWithFilteredResult(_0x1514ee,_0xa74ba2))[_0x8eda('0x2a')](handleError(_0x1514ee,null));};exports[_0x8eda('0xc9')]=function(_0x480739,_0x7e5f02){return db[_0x8eda('0x32')][_0x8eda('0x5a')]({'where':{'id':_0x480739['params']['id']}})['then'](handleEntityNotFound(_0x7e5f02,null))[_0x8eda('0x1b')](function(_0x38f628){if(_0x38f628){return _0x38f628[_0x8eda('0xca')](_0x480739[_0x8eda('0xbe')][_0x8eda('0xc1')],_[_0x8eda('0xcb')](_0x480739[_0x8eda('0xbe')],[_0x8eda('0xc1'),'id'])||{})['spread'](function(){return db['Tag'][_0x8eda('0xc7')]({'attributes':['id','name',_0x8eda('0xcc')],'where':{'id':_0x480739[_0x8eda('0xbe')][_0x8eda('0xc1')]}});})[_0x8eda('0x1b')](function(_0x148314){socket[_0x8eda('0xcd')](_0x8eda('0xce'),{'id':Number(_0x480739[_0x8eda('0xb9')]['id']),'tags':_0x148314||[]});return{'id':Number(_0x480739[_0x8eda('0xb9')]['id']),'tags':_0x148314||[]};});}})['then'](respondWithResult(_0x7e5f02,null))['catch'](handleError(_0x7e5f02,null));};exports[_0x8eda('0xcf')]=function(_0x76b5d5,_0x5941dc){return db[_0x8eda('0x32')][_0x8eda('0x5a')]({'where':{'id':_0x76b5d5[_0x8eda('0xb9')]['id']}})[_0x8eda('0x1b')](handleEntityNotFound(_0x5941dc,null))[_0x8eda('0x1b')](function(_0x17da23){if(_0x17da23){return _0x17da23[_0x8eda('0xcf')](_0x76b5d5[_0x8eda('0x37')][_0x8eda('0xc1')]);}})[_0x8eda('0x1b')](respondWithStatusCode(_0x5941dc,null))[_0x8eda('0x2a')](handleError(_0x5941dc,null));};exports[_0x8eda('0xd0')]=function(_0x578612,_0x3f5d0a){var _0x59d10b=moment()[_0x8eda('0xd1')]()[_0x8eda('0x90')]();var _0x1043c7=path[_0x8eda('0xd2')](config[_0x8eda('0xd3')],_0x8eda('0xd4'),'files',_0x8eda('0xd5'));var _0x1c2c31=path[_0x8eda('0xd2')](config[_0x8eda('0xd3')],_0x8eda('0xd4'),_0x8eda('0xd6'),'attachments');var _0x5aab62=path[_0x8eda('0xd2')](_0x1043c7,_0x59d10b);var _0x1485cd=util['format'](_0x8eda('0xd7'),_0x578612[_0x8eda('0xb9')]['id'],_0x59d10b);var _0xb0a6ee=path[_0x8eda('0xd2')](_0x1043c7,_0x1485cd);var _0x33fdf0=[];if(_0x578612['query']['attachments']){_0x33fdf0['push']({'model':db[_0x8eda('0xd8')],'as':_0x8eda('0xd9'),'raw':!![]});}var _0x437172=[{'model':db[_0x8eda('0xc3')],'as':_0x8eda('0xda'),'attributes':['id',_0x8eda('0xbe'),'from','to','cc','bcc',_0x8eda('0xdb'),_0x8eda('0x72')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x33fdf0}];return db['MailInteraction']['find']({'where':{'id':_0x578612[_0x8eda('0xb9')]['id']},'include':_0x437172})[_0x8eda('0x1b')](handleEntityNotFound(_0x3f5d0a,null))['then'](function(_0x4ffac8){if(_0x4ffac8&&_0x4ffac8['Messages']){var _0x476f98=_0x4ffac8[_0x8eda('0xdc')]({'plain':!![]});fs[_0x8eda('0xdd')](_0x5aab62);return BPromise[_0x8eda('0xde')](_0x476f98[_0x8eda('0xda')],function(_0x389058,_0x54381f){var _0x3bf6c4={'from':_0x389058[_0x8eda('0x44')],'to':_0x389058['to'],'subject':_0x389058[_0x8eda('0xdb')],'html':htmlEntities['decode'](_0x389058['body']),'headers':{'Date':moment(_0x389058[_0x8eda('0x72')])['format'](_0x8eda('0xdf'))},'attachments':[]};if(_0x389058['cc']){_0x3bf6c4['headers']['Cc']=_0x389058['cc'];}if(_0x389058[_0x8eda('0xe0')]){_0x3bf6c4[_0x8eda('0xe1')]['Bcc']=_0x389058['bcc'];}return new BPromise(function(_0x57d3e4,_0x428cdf){if(_0x389058['Attachments']){for(var _0x1d0ad3=0x0;_0x1d0ad3<_0x389058[_0x8eda('0xd9')][_0x8eda('0x3c')];_0x1d0ad3++){var _0x1d7cdd=_0x389058['Attachments'][_0x1d0ad3];var _0x1d4ab4=path['join'](_0x1c2c31,_0x1d7cdd[_0x8eda('0xe2')]);if(fs[_0x8eda('0xe3')](_0x1d4ab4)){_0x3bf6c4[_0x8eda('0xe4')][_0x8eda('0x26')]({'name':_0x1d7cdd[_0x8eda('0x1e')],'contentType':_0x1d7cdd[_0x8eda('0x6b')],'data':fs[_0x8eda('0xe5')](_0x1d4ab4)});}}}emlformat['build'](_0x3bf6c4,function(_0x1b54b5,_0x351e35){if(_0x1b54b5)return _0x428cdf(_0x1b54b5);fs[_0x8eda('0xe6')](path['join'](_0x5aab62,util[_0x8eda('0xc6')](_0x8eda('0xe7'),_0x54381f)),_0x351e35);return _0x57d3e4(_0x351e35);});});})[_0x8eda('0x1b')](function(){return new BPromise(function(_0x19b489,_0x1e439c){zipdir(_0x5aab62,{'saveTo':_0xb0a6ee},function(_0x28f83d,_0x1a7df6){if(_0x28f83d)return _0x1e439c(_0x28f83d);return _0x19b489(_0x1a7df6);});})[_0x8eda('0x1b')](function(){return new BPromise(function(_0x38be9b,_0x3429de){rimraf(_0x5aab62,function(_0x45a283){if(_0x45a283)_0x3429de(_0x45a283);return _0x38be9b();});});})[_0x8eda('0x1b')](function(){return _0x3f5d0a[_0x8eda('0xd0')](_0xb0a6ee,_0x1485cd,function(_0x393ef7){if(!_0x393ef7)fs[_0x8eda('0xe8')](_0xb0a6ee);});});});}else{return _0x3f5d0a[_0x8eda('0x1d')](0xc8);}})[_0x8eda('0x2a')](handleError(_0x3f5d0a,null));}; \ No newline at end of file +var _0x2c8f=['model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.MailInteractionId','left_join','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','unreadMessages','order','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','merge','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','all','show','keys','intersection','include','options','create','body','params','describe','addMessage','ids','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','setTags','omit','spread','findAll','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','decode','headers','Bcc','basename','existsSync','readFileSync','message%d.eml','unlinkSync','rimraf','util','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','rawAttributes','type','key'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x2c8f,0x192));var _0xf2c8=function(_0x382e51,_0x1af376){_0x382e51=_0x382e51-0x0;var _0x18ae59=_0x2c8f[_0x382e51];return _0x18ae59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2c8('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xf2c8('0x1'));var path=require(_0xf2c8('0x2'));var fs=require('fs');var _=require(_0xf2c8('0x3'));var squel=require('squel');var juice=require('juice');var Redis=require(_0xf2c8('0x4'));var qs=require(_0xf2c8('0x5'));var as=require(_0xf2c8('0x6'));var logger=require(_0xf2c8('0x7'))(_0xf2c8('0x8'));var config=require('../../config/environment');var db=require(_0xf2c8('0x9'))['db'];var htmlEntities=require(_0xf2c8('0xa'));config[_0xf2c8('0xb')]=_[_0xf2c8('0xc')](config[_0xf2c8('0xb')],{'host':_0xf2c8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2c8('0xb')]));require(_0xf2c8('0xe'))[_0xf2c8('0xf')](socket);function respondWithStatusCode(_0x22eacb,_0x174c79){_0x174c79=_0x174c79||0xcc;return function(_0x3ba8f5){if(_0x3ba8f5){return _0x22eacb[_0xf2c8('0x10')](_0x174c79);}return _0x22eacb[_0xf2c8('0x11')](_0x174c79)['end']();};}function respondWithResult(_0xd90704,_0x5ce572){_0x5ce572=_0x5ce572||0xc8;return function(_0x10bc2c){if(_0x10bc2c){return _0xd90704[_0xf2c8('0x11')](_0x5ce572)[_0xf2c8('0x12')](_0x10bc2c);}};}function respondWithFilteredResult(_0x46d0c6,_0x37db9b){return function(_0x40849c){if(_0x40849c){var _0x54dd36=typeof _0x37db9b[_0xf2c8('0x13')]===_0xf2c8('0x14')&&typeof _0x37db9b[_0xf2c8('0x15')]===_0xf2c8('0x14');var _0x3ed09e=_0x40849c[_0xf2c8('0x16')];var _0x1b8c5b=_0x54dd36?0x0:_0x37db9b['offset'];var _0x282094=_0x54dd36?_0x40849c[_0xf2c8('0x16')]:_0x37db9b[_0xf2c8('0x13')]+_0x37db9b[_0xf2c8('0x15')];var _0xe1ec71;if(_0x282094>=_0x3ed09e){_0x282094=_0x3ed09e;_0xe1ec71=0xc8;}else{_0xe1ec71=0xce;}_0x46d0c6['status'](_0xe1ec71);return _0x46d0c6['set'](_0xf2c8('0x17'),_0x1b8c5b+'-'+_0x282094+'/'+_0x3ed09e)[_0xf2c8('0x12')](_0x40849c);}return null;};}function saveUpdates(_0x2c6d7a){return function(_0x283ecf){if(_0x283ecf){return _0x283ecf['update'](_0x2c6d7a)[_0xf2c8('0x18')](function(_0x100542){return _0x100542;});}return null;};}function removeEntity(_0x197435){return function(_0x47b5e4){if(_0x47b5e4){return _0x47b5e4[_0xf2c8('0x19')]()[_0xf2c8('0x18')](function(){_0x197435['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43505f){return function(_0x3e7ceb){if(!_0x3e7ceb){_0x43505f[_0xf2c8('0x10')](0x194);}return _0x3e7ceb;};}function handleError(_0x57affa,_0xd2e728){_0xd2e728=_0xd2e728||0x1f4;return function(_0x43763e){logger[_0xf2c8('0x1a')](_0x43763e[_0xf2c8('0x1b')]);if(_0x43763e['name']){delete _0x43763e[_0xf2c8('0x1c')];}_0x57affa[_0xf2c8('0x11')](_0xd2e728)[_0xf2c8('0x1d')](_0x43763e);};}function getInteractionUsers(_0x440b41,_0x16938e){return new BPromise(function(_0x4d0e56,_0x93707c){try{if(_0x16938e[_0x440b41['id']]){_0x440b41['Users']=_[_0xf2c8('0x1e')](_0x16938e[_0x440b41['id']],function(_0x2e2305){return{'id':_0x2e2305['id'],'fullname':_0x2e2305[_0xf2c8('0x1f')]};});}}catch(_0x3bb777){_0x93707c(_0x3bb777);}_0x4d0e56(_0x440b41);});}function getInteractionTags(_0x1d2e74,_0x3160a5){return new BPromise(function(_0x3ffd20,_0x132343){try{if(_0x1d2e74[_0xf2c8('0x20')]){_0x1d2e74[_0xf2c8('0x21')]=[];_0x1d2e74[_0xf2c8('0x20')][_0xf2c8('0x22')](',')[_0xf2c8('0x23')](function(_0x4e12a2){_0x1d2e74[_0xf2c8('0x21')]['push'](_0x3160a5[_0x4e12a2]);});}delete _0x1d2e74['TagIds'];}catch(_0x3df45d){_0x132343(_0x3df45d);}_0x3ffd20(_0x1d2e74);});}function getLastMessageText(_0x48bcf9){return new BPromise(function(_0x3e9e8a,_0x3b7e23){return db[_0xf2c8('0x24')][_0xf2c8('0x25')]({'where':{'$and':[{'MailInteractionId':_0x48bcf9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf2c8('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf2c8('0x27')],'order':_0xf2c8('0x28'),'raw':!![]})['then'](function(_0x27c02e){if(_0x27c02e&&_0x27c02e[_0xf2c8('0x27')]){_0x48bcf9[_0xf2c8('0x29')]=_[_0xf2c8('0x2a')](_0x27c02e[_0xf2c8('0x27')]);}_0x3e9e8a(_0x48bcf9);})[_0xf2c8('0x2b')](function(_0x5e0b43){_0x3b7e23(_0x5e0b43);});});}function updateMailInteraction(_0x104b3e,_0x5d530b,_0x3a01db,_0x4abc1e){return new BPromise(function(_0x25238f,_0x1da275){return getInteractionUsers(_0x104b3e,_0x3a01db)[_0xf2c8('0x18')](function(_0xf58eb3){return getInteractionTags(_0xf58eb3,_0x5d530b);})[_0xf2c8('0x18')](function(_0x5b6e0b){return getStateInteraction(_0x5b6e0b);})[_0xf2c8('0x18')](function(_0x1927bd){if(_0x4abc1e){_0x25238f(getLastMessageText(_0x1927bd));}else{_0x25238f(_0x1927bd);}})['catch'](function(_0x309232){_0x1da275(_0x309232);});});}function getStateInteraction(_0x23f6be){return new BPromise(function(_0x4a24e8){_0x23f6be[_0xf2c8('0x2c')]=0x0;_0x23f6be[_0xf2c8('0x2d')]=0x0;_0x23f6be[_0xf2c8('0x2e')]=0x0;_0x23f6be[_0xf2c8('0x2f')]=0x0;_0x23f6be[_0xf2c8('0x30')]=0x0;if(!_0x23f6be['closed']&&!_0x23f6be['UserId']){_0x23f6be[_0xf2c8('0x2c')]+=0x1;}if(!_0x23f6be[_0xf2c8('0x31')]&&_0x23f6be[_0xf2c8('0x32')]){_0x23f6be[_0xf2c8('0x2d')]+=0x1;if(_0x23f6be[_0xf2c8('0x2c')]){_0x23f6be[_0xf2c8('0x2c')]-=0x1;}}if(_0x23f6be[_0xf2c8('0x31')]&&_0x23f6be[_0xf2c8('0x32')]){_0x23f6be['answered']+=0x1;if(_0x23f6be[_0xf2c8('0x2d')]){_0x23f6be[_0xf2c8('0x2d')]-=0x1;}}if(_0x23f6be[_0xf2c8('0x31')]&&!_0x23f6be['UserId']){_0x23f6be['unmanaged']+=0x1;if(_0x23f6be['waiting']){_0x23f6be['waiting']-=0x1;}}_0x23f6be[_0xf2c8('0x30')]+=0x1;_0x4a24e8(_0x23f6be);});}exports['index']=function(_0x219318,_0x4b312b){var _0x372733={},_0x4d06da={},_0x5ac2dc={'count':0x0,'rows':[]};var _0x5cff24=_[_0xf2c8('0x1e')](db['MailInteraction'][_0xf2c8('0x33')],function(_0x93284c){return{'name':_0x93284c['fieldName'],'type':_0x93284c[_0xf2c8('0x34')][_0xf2c8('0x35')]};});_0x4d06da[_0xf2c8('0x36')]=_[_0xf2c8('0x1e')](_0x5cff24,_0xf2c8('0x1c'));_0x4d06da[_0xf2c8('0x37')]=_['keys'](_0x219318['query']);_0x4d06da[_0xf2c8('0x38')]=_['intersection'](_0x4d06da[_0xf2c8('0x36')],_0x4d06da['query']);_0x372733[_0xf2c8('0x39')]=_['intersection'](_0x4d06da[_0xf2c8('0x36')],qs[_0xf2c8('0x3a')](_0x219318[_0xf2c8('0x37')][_0xf2c8('0x3a')]));_0x372733['attributes']=_0x372733[_0xf2c8('0x39')][_0xf2c8('0x3b')]?_0x372733['attributes']:_0x4d06da[_0xf2c8('0x36')];if(!_0x219318[_0xf2c8('0x37')][_0xf2c8('0x3c')](_0xf2c8('0x3d'))){_0x372733[_0xf2c8('0x15')]=qs[_0xf2c8('0x15')](_0x219318[_0xf2c8('0x37')]['limit']);_0x372733[_0xf2c8('0x13')]=qs[_0xf2c8('0x13')](_0x219318[_0xf2c8('0x37')][_0xf2c8('0x13')]);}_0x372733['order']=qs['sort'](_0x219318[_0xf2c8('0x37')][_0xf2c8('0x3e')]);_0x372733[_0xf2c8('0x3f')]=qs['filters'](_[_0xf2c8('0x40')](_0x219318[_0xf2c8('0x37')],_0x4d06da['filters']),_0x5cff24);var _0x574476=[];var _0x1ecb56=squel[_0xf2c8('0x41')]()[_0xf2c8('0x42')]('id')[_0xf2c8('0x42')]('name')[_0xf2c8('0x42')](_0xf2c8('0x43'))[_0xf2c8('0x44')]('tools_tags');var _0xc78712=squel[_0xf2c8('0x41')]()[_0xf2c8('0x42')]('u.id')[_0xf2c8('0x42')](_0xf2c8('0x45'))[_0xf2c8('0x42')](_0xf2c8('0x46'))[_0xf2c8('0x44')]('user_has_mail_interactions','ui')[_0xf2c8('0x47')]('users','u','u.id\x20=\x20ui.UserId');var _0x168acb=squel[_0xf2c8('0x41')]()[_0xf2c8('0x44')](_0xf2c8('0x48'),'i')[_0xf2c8('0x47')]('cm_contacts','c',_0xf2c8('0x49'))[_0xf2c8('0x47')](_0xf2c8('0x4a'),'o',_0xf2c8('0x4b'))[_0xf2c8('0x47')](_0xf2c8('0x4c'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0xf2c8('0x4d'),'me',_0xf2c8('0x4e'))[_0xf2c8('0x47')](_0xf2c8('0x4f'),'it',_0xf2c8('0x50'))[_0xf2c8('0x47')](_0xf2c8('0x51'),'t',_0xf2c8('0x52'));var _0x585cd3=squel[_0xf2c8('0x53')]();var _0x144483=[];var _0x5ebf58=squel['expr']();var _0x155fdb;if(_0x219318[_0xf2c8('0x37')]['search']){_0x155fdb=as[_0xf2c8('0x54')](_0x219318[_0xf2c8('0x37')][_0xf2c8('0x55')]);var _0x50ef02=_0x155fdb[_0xf2c8('0x56')];for(var _0x34cfc4=0x0;_0x34cfc4<_0x155fdb[_0xf2c8('0x57')][_0xf2c8('0x3b')];_0x34cfc4++){var _0x3b33fb=_0x155fdb[_0xf2c8('0x57')][_0x34cfc4];var _0x39e9e7='i';var _0x1b74e2=_['find'](_0x5cff24,[_0xf2c8('0x1c'),_0x3b33fb[_0xf2c8('0x42')]]);if(!_0x1b74e2){switch(_0x3b33fb[_0xf2c8('0x42')]){case'unreadMessages':if(_0x3b33fb['value']==0x1){_0x168acb[_0xf2c8('0x58')]('`'+_0x3b33fb[_0xf2c8('0x42')]+'`\x20=\x200');}else{_0x168acb[_0xf2c8('0x58')]('`'+_0x3b33fb['field']+'`\x20>\x200');}break;case _0xf2c8('0x59'):if(_0x3b33fb[_0xf2c8('0x5a')]==='$substring'){if(_0x3b33fb[_0xf2c8('0x5b')][_0xf2c8('0x22')]('\x20')[_0xf2c8('0x3b')]>0x1){_0x585cd3[_0x50ef02](_0xf2c8('0x5c'),qs[_0xf2c8('0x5d')](_0x3b33fb['value']),null);}else{var _0x19dc1b='%'+_0x3b33fb[_0xf2c8('0x5b')]+'%';_0x585cd3[_0x50ef02]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x19dc1b,_0x19dc1b,_0x19dc1b);}}else{_0x1b74e2=_[_0xf2c8('0x5e')](_0x5cff24,['name',_0xf2c8('0x5f')]);_0x3b33fb[_0xf2c8('0x42')]=_0xf2c8('0x5f');_0x443e06=as[_0xf2c8('0x60')](_0x39e9e7,_0x1b74e2[_0xf2c8('0x34')],_0x3b33fb);_0x585cd3[_0x50ef02](_0x443e06[_0xf2c8('0x61')],_0x443e06['value'][_0xf2c8('0x62')],_0x443e06[_0xf2c8('0x5b')][_0xf2c8('0x63')]);}break;case _0xf2c8('0x64'):var _0x3f8933=_0x3b33fb['value'][_0xf2c8('0x22')](',')[_0xf2c8('0x1e')](function(_0x10747d){return Number(_0x10747d);});_0x3f8933[_0xf2c8('0x23')](function(_0x4e11e5){_0x5ebf58['or'](_0xf2c8('0x65'),'%,'+_0x4e11e5+',%');});_0x144483=_[_0xf2c8('0x66')](_0x144483,_0x3f8933);break;case _0xf2c8('0x67'):if(_0x3b33fb[_0xf2c8('0x5a')]===_0xf2c8('0x68')){_0x585cd3[_0x50ef02](_0xf2c8('0x69'),'%'+_0x3b33fb[_0xf2c8('0x5b')]+'%',null);}else{_0x1b74e2=_[_0xf2c8('0x5e')](_0x5cff24,[_0xf2c8('0x1c'),'UserId']);_0x3b33fb[_0xf2c8('0x42')]=_0xf2c8('0x32');_0x443e06=as['buildExpression'](_0x39e9e7,_0x1b74e2[_0xf2c8('0x34')],_0x3b33fb);_0x585cd3[_0x50ef02](_0x443e06[_0xf2c8('0x61')],_0x443e06['value'][_0xf2c8('0x62')],_0x443e06[_0xf2c8('0x5b')][_0xf2c8('0x63')]);}break;case _0xf2c8('0x27'):_0x443e06=as['buildExpression']('me',null,_0x3b33fb);_0x585cd3[_0x50ef02](_0x443e06['text'],_0x443e06[_0xf2c8('0x5b')]['start'],_0x443e06[_0xf2c8('0x5b')][_0xf2c8('0x63')]);break;}}else{var _0x443e06=as[_0xf2c8('0x60')](_0x39e9e7,_0x1b74e2[_0xf2c8('0x34')],_0x3b33fb);_0x585cd3[_0x50ef02](_0x443e06[_0xf2c8('0x61')],_0x443e06['value'][_0xf2c8('0x62')],_0x443e06[_0xf2c8('0x5b')]['end']);}}}else{var _0x3fc45d=_(_0x219318[_0xf2c8('0x37')])['keys']()[_0xf2c8('0x1e')](function(_0x5c8557){return _[_0xf2c8('0x6a')](_0x5cff24,[_0xf2c8('0x1c'),_0x5c8557])?_0x5c8557:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x3fc45d)){_0x3fc45d[_0xf2c8('0x23')](function(_0x182df0){if(_0x182df0===_0xf2c8('0x6b')){_0x168acb[_0xf2c8('0x3f')](_0xf2c8('0x6c'),[][_0xf2c8('0x6d')](_0x219318['query'][_0x182df0]));}else if(_0x182df0===_0xf2c8('0x6e')){var _0x373d14=JSON[_0xf2c8('0x6f')](_0x219318[_0xf2c8('0x37')][_0x182df0])['$gte'];var _0x5b0b51=JSON[_0xf2c8('0x6f')](_0x219318[_0xf2c8('0x37')][_0x182df0])[_0xf2c8('0x70')];_0x168acb[_0xf2c8('0x3f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x373d14,_0x5b0b51);}else{if(_0x219318['query'][_0x182df0]===_0xf2c8('0x71')){_0x168acb[_0xf2c8('0x3f')]('i.'+_0x182df0+_0xf2c8('0x72'));}else{_0x168acb[_0xf2c8('0x3f')]('i.'+_0x182df0+'\x20=\x20?',_0x219318['query'][_0x182df0]);}}});}if(_0x219318[_0xf2c8('0x37')][_0xf2c8('0x73')]){if(_0x219318[_0xf2c8('0x37')][_0xf2c8('0x73')]==0x1){_0x168acb[_0xf2c8('0x58')](_0xf2c8('0x74'));}else{_0x168acb['having'](_0xf2c8('0x75'));}}if(_0x219318[_0xf2c8('0x37')]['tag']){_0x144483=_[_0xf2c8('0x76')](_0x219318['query'][_0xf2c8('0x77')])?_0x219318['query'][_0xf2c8('0x77')]:new Array(_0x219318[_0xf2c8('0x37')][_0xf2c8('0x77')]);_0x144483[_0xf2c8('0x23')](function(_0x2a3d84){_0x5ebf58['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a3d84+',%');});}if(_0x219318['query']['filter']){var _0xe24149=_0x219318[_0xf2c8('0x37')][_0xf2c8('0x78')]['replace']('\x5c','\x5c\x5c')[_0xf2c8('0x79')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xe24149)){_0x585cd3['or'](_0xf2c8('0x7a'),_0xe24149+'%');}else if(qs['isEmail'](_0xe24149)){_0x585cd3['or'](_0xf2c8('0x7b'),_0xe24149+'%');}else{_0x585cd3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf2c8('0x5d')](_0xe24149))['or'](_0xf2c8('0x7c'),qs[_0xf2c8('0x5d')](_0xe24149));}}}_0x168acb[_0xf2c8('0x3f')](_0x585cd3);_0x168acb[_0xf2c8('0x7d')](_0xf2c8('0x7e'));var _0xb3f69a={'type':db[_0xf2c8('0x7f')]['QueryTypes'][_0xf2c8('0x80')],'raw':!![]};var _0x4f3522=_0x168acb[_0xf2c8('0x81')]();_0x4f3522['field']('i.id');_0x4f3522['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf2c8('0x82'));if(_0x372733[_0xf2c8('0x83')]){_0x372733[_0xf2c8('0x83')][_0xf2c8('0x23')](function(_0x58529d){var _0x344b9d=_0x58529d[0x0]===_0xf2c8('0x84')?_0x58529d[0x0]:'i.'+_0x58529d[0x0];_0x168acb[_0xf2c8('0x83')](_0x344b9d,_0x58529d[0x1]===_0xf2c8('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x144483)){_0x168acb[_0xf2c8('0x58')](_0x5ebf58);_0x4f3522[_0xf2c8('0x3f')]('t.id\x20IN\x20?',_0x144483);}BPromise['resolve']()[_0xf2c8('0x18')](function(){if(!_0x155fdb){if(_0x219318[_0xf2c8('0x37')][_0xf2c8('0x6b')])return;_0x4f3522[_0xf2c8('0x3f')](_0xf2c8('0x86'));_0x168acb[_0xf2c8('0x3f')](_0xf2c8('0x86'));return;}if(_0x219318['user'][_0xf2c8('0x87')]!==_0xf2c8('0x88'))return;return _0x219318[_0xf2c8('0x89')][_0xf2c8('0x8a')]({'attributes':['id'],'raw':!![]})[_0xf2c8('0x18')](function(_0x9966cc){if(_['isEmpty'](_0x9966cc)){_0x4f3522[_0xf2c8('0x3f')](_0xf2c8('0x8b'));_0x168acb[_0xf2c8('0x3f')](_0xf2c8('0x8b'));}else{_0x4f3522[_0xf2c8('0x3f')](_0xf2c8('0x6c'),_['map'](_0x9966cc,'id'));_0x168acb[_0xf2c8('0x3f')](_0xf2c8('0x6c'),_[_0xf2c8('0x1e')](_0x9966cc,'id'));}});})[_0xf2c8('0x18')](function(){if(_0x219318[_0xf2c8('0x89')]['role']===_0xf2c8('0x88')&&!_0x155fdb&&!_0x219318[_0xf2c8('0x37')][_0xf2c8('0x6b')])return[];return db['sequelize'][_0xf2c8('0x37')](_0x4f3522[_0xf2c8('0x8c')](),_0xb3f69a);})[_0xf2c8('0x18')](function(_0x47bf36){_0x5ac2dc[_0xf2c8('0x16')]=_0x47bf36['length'];if(_0x5ac2dc['count']===0x0)return[];return db[_0xf2c8('0x8d')]['query'](_0x1ecb56[_0xf2c8('0x8c')](),_0xb3f69a)[_0xf2c8('0x18')](function(_0x295f52){_0x574476=_['keyBy'](_0x295f52,'id');_0xb3f69a=_[_0xf2c8('0x8e')](_0xb3f69a,{'model':db[_0xf2c8('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x219318[_0xf2c8('0x37')][_0xf2c8('0x3a')]){_0x372733[_0xf2c8('0x39')][_0xf2c8('0x23')](function(_0x8acd72){_0x168acb[_0xf2c8('0x42')]('i.'+_0x8acd72);});}else{_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x90'),_0xf2c8('0x82'));_0x168acb['field']('a.key',_0xf2c8('0x91'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x92'),_0xf2c8('0x93'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x94'),_0xf2c8('0x84'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x7e'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x95'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x96'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x97'));_0x168acb['field'](_0xf2c8('0x98'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x99'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9a'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9b'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9c'));_0x168acb[_0xf2c8('0x42')]('i.disposition');_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9d'));_0x168acb[_0xf2c8('0x42')]('i.thirdDisposition');_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9e'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0x9f'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xa0'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xa1'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xa2'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xa3'),'Contact.firstName');_0x168acb['field'](_0xf2c8('0xa4'),_0xf2c8('0xa5'));_0x168acb[_0xf2c8('0x42')]('c.email',_0xf2c8('0xa6'));_0x168acb[_0xf2c8('0x42')]('c.phone',_0xf2c8('0xa7'));_0x168acb['field']('c.mobile',_0xf2c8('0xa8'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xa9'),_0xf2c8('0xaa'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xab'),_0xf2c8('0xac'));_0x168acb['field'](_0xf2c8('0xad'),_0xf2c8('0xae'));_0x168acb[_0xf2c8('0x42')](_0xf2c8('0xaf'),_0xf2c8('0x20'));}if(_0x372733['limit'])_0x168acb[_0xf2c8('0x15')](_0x372733[_0xf2c8('0x15')]);if(_0x372733[_0xf2c8('0x13')])_0x168acb['offset'](_0x372733['offset']);return db[_0xf2c8('0x8d')][_0xf2c8('0x37')](_0x168acb[_0xf2c8('0x8c')](),_0xb3f69a);})[_0xf2c8('0x18')](function(_0x3c41d9){if(_0x3c41d9['length']>0x0)_0xc78712['where'](_0xf2c8('0xb0'),_['map'](_0x3c41d9,'id'));return db[_0xf2c8('0x8d')][_0xf2c8('0x37')](_0xc78712[_0xf2c8('0x8c')](),_0xb3f69a)[_0xf2c8('0x18')](function(_0x293299){var _0x249f73=_['groupBy'](_0x293299,_0xf2c8('0xb1'));var _0x11c173=[];return db[_0xf2c8('0xb2')]['findOne']({'attributes':[_0xf2c8('0xb3')],'raw':!![]})[_0xf2c8('0x18')](function(_0x1e5a35){var _0x14a486=_0x1e5a35['enableEmailPreview'];_0x3c41d9['forEach'](function(_0x42bdc4){_0x11c173[_0xf2c8('0xb4')](updateMailInteraction(_0x42bdc4,_0x574476,_0x249f73,_0x14a486));});return BPromise[_0xf2c8('0xb5')](_0x11c173);});});});})[_0xf2c8('0x18')](function(_0x7f1b1c){_0x5ac2dc['rows']=_0x7f1b1c;return _0x5ac2dc;})[_0xf2c8('0x18')](respondWithFilteredResult(_0x4b312b,_0x372733))['catch'](handleError(_0x4b312b,null));};exports[_0xf2c8('0xb6')]=function(_0x4087f5,_0x4935db){var _0x72b3da={'raw':![],'where':{'id':_0x4087f5['params']['id']}},_0x212c4a={};_0x212c4a[_0xf2c8('0x36')]=_['keys'](db[_0xf2c8('0x8f')][_0xf2c8('0x33')]);_0x212c4a[_0xf2c8('0x37')]=_[_0xf2c8('0xb7')](_0x4087f5[_0xf2c8('0x37')]);_0x212c4a[_0xf2c8('0x38')]=_[_0xf2c8('0xb8')](_0x212c4a[_0xf2c8('0x36')],_0x212c4a['query']);_0x72b3da['attributes']=_[_0xf2c8('0xb8')](_0x212c4a[_0xf2c8('0x36')],qs[_0xf2c8('0x3a')](_0x4087f5[_0xf2c8('0x37')]['fields']));_0x72b3da[_0xf2c8('0x39')]=_0x72b3da[_0xf2c8('0x39')][_0xf2c8('0x3b')]?_0x72b3da['attributes']:_0x212c4a['model'];if(_0x4087f5[_0xf2c8('0x37')]['includeAll']){_0x72b3da[_0xf2c8('0xb9')]=[{'all':!![]}];}_0x72b3da=_[_0xf2c8('0x8e')]({},_0x72b3da,_0x4087f5[_0xf2c8('0xba')]);return db['MailInteraction'][_0xf2c8('0x5e')](_0x72b3da)[_0xf2c8('0x18')](handleEntityNotFound(_0x4935db,null))['then'](respondWithResult(_0x4935db,null))[_0xf2c8('0x2b')](handleError(_0x4935db,null));};exports['create']=function(_0x15c5bc,_0x594dd2){return db[_0xf2c8('0x8f')][_0xf2c8('0xbb')](_0x15c5bc[_0xf2c8('0xbc')],{})[_0xf2c8('0x18')](respondWithResult(_0x594dd2,0xc9))[_0xf2c8('0x2b')](handleError(_0x594dd2,null));};exports['update']=function(_0x3084c4,_0x3beebf){if(_0x3084c4['body']['id']){delete _0x3084c4[_0xf2c8('0xbc')]['id'];}return db[_0xf2c8('0x8f')][_0xf2c8('0x5e')]({'where':{'id':_0x3084c4[_0xf2c8('0xbd')]['id']}})[_0xf2c8('0x18')](handleEntityNotFound(_0x3beebf,null))['then'](saveUpdates(_0x3084c4[_0xf2c8('0xbc')],null))[_0xf2c8('0x18')](respondWithResult(_0x3beebf,null))[_0xf2c8('0x2b')](handleError(_0x3beebf,null));};exports[_0xf2c8('0x19')]=function(_0x907478,_0x304a28){return db['MailInteraction'][_0xf2c8('0x5e')]({'where':{'id':_0x907478[_0xf2c8('0xbd')]['id']}})[_0xf2c8('0x18')](handleEntityNotFound(_0x304a28,null))['then'](removeEntity(_0x304a28,null))[_0xf2c8('0x2b')](handleError(_0x304a28,null));};exports['describe']=function(_0x4229b5,_0x3981a5){return db[_0xf2c8('0x8f')][_0xf2c8('0xbe')]()[_0xf2c8('0x18')](respondWithResult(_0x3981a5,null))['catch'](handleError(_0x3981a5,null));};exports[_0xf2c8('0xbf')]=function(_0x44b502,_0x4fb2c1){return db[_0xf2c8('0x24')][_0xf2c8('0x5e')]({'where':{'id':_0x44b502[_0xf2c8('0xbd')]['id']}})['then'](handleEntityNotFound(_0x4fb2c1,null))[_0xf2c8('0x18')](function(_0x3994ed){if(_0x3994ed){return _0x3994ed[_0xf2c8('0xbf')](_0x44b502[_0xf2c8('0xbc')][_0xf2c8('0xc0')],_['omit'](_0x44b502[_0xf2c8('0xbc')],[_0xf2c8('0xc0'),'id'])||{});}})[_0xf2c8('0x18')](respondWithResult(_0x4fb2c1,null))[_0xf2c8('0x2b')](handleError(_0x4fb2c1,null));};exports['getMessages']=function(_0x573f68,_0x5bc52a){var _0x58b68d={'raw':![],'where':{}};var _0x4dce83={};var _0x4db53d={'count':0x0,'rows':[]};return db[_0xf2c8('0x8f')][_0xf2c8('0x25')]({'where':{'id':_0x573f68[_0xf2c8('0xbd')]['id']}})['then'](handleEntityNotFound(_0x5bc52a,null))[_0xf2c8('0x18')](function(_0x3dd78c){if(_0x3dd78c){_0x4dce83[_0xf2c8('0x36')]=_[_0xf2c8('0xb7')](db[_0xf2c8('0x24')][_0xf2c8('0x33')]);_0x4dce83[_0xf2c8('0x37')]=_[_0xf2c8('0xb7')](_0x573f68[_0xf2c8('0x37')]);_0x4dce83[_0xf2c8('0x38')]=_[_0xf2c8('0xb8')](_0x4dce83['model'],_0x4dce83[_0xf2c8('0x37')]);_0x58b68d['attributes']=_[_0xf2c8('0xb8')](_0x4dce83[_0xf2c8('0x36')],qs['fields'](_0x573f68[_0xf2c8('0x37')][_0xf2c8('0x3a')]));_0x58b68d[_0xf2c8('0x39')]=_0x58b68d['attributes']['length']?_0x58b68d[_0xf2c8('0x39')]:_0x4dce83['model'];if(!_0x573f68['query']['hasOwnProperty']('nolimit')){_0x58b68d['limit']=qs[_0xf2c8('0x15')](_0x573f68[_0xf2c8('0x37')]['limit']);_0x58b68d['offset']=qs[_0xf2c8('0x13')](_0x573f68[_0xf2c8('0x37')]['offset']);}_0x58b68d[_0xf2c8('0x83')]=qs[_0xf2c8('0x3e')](_0x573f68[_0xf2c8('0x37')][_0xf2c8('0x3e')]);_0x58b68d[_0xf2c8('0x3f')]=qs[_0xf2c8('0x38')](_[_0xf2c8('0x40')](_0x573f68['query'],_0x4dce83[_0xf2c8('0x38')]));_0x58b68d[_0xf2c8('0x3f')][_0xf2c8('0xb1')]=_0x3dd78c['id'];if(_0x573f68['query'][_0xf2c8('0x78')]){_0x58b68d[_0xf2c8('0x3f')]=_[_0xf2c8('0x8e')](_0x58b68d[_0xf2c8('0x3f')],{'$or':_[_0xf2c8('0x1e')](_0x58b68d[_0xf2c8('0x39')],function(_0x329e4a){var _0x5bd56c={};_0x5bd56c[_0x329e4a]={'$like':'%'+_0x573f68[_0xf2c8('0x37')][_0xf2c8('0x78')]+'%'};return _0x5bd56c;})});}if(_0x573f68[_0xf2c8('0x37')][_0xf2c8('0xc1')]){var _0x4bc170=_0x573f68[_0xf2c8('0x37')][_0xf2c8('0xc1')][_0xf2c8('0x22')](',');var _0xc29c9b={};_0xc29c9b[_0x4bc170[0x0]]={'$gte':moment(_0x4bc170[0x1])[_0xf2c8('0xc2')](_0xf2c8('0xc3'))};_0x58b68d[_0xf2c8('0x3f')]=_[_0xf2c8('0x8e')](_0x58b68d[_0xf2c8('0x3f')],_0xc29c9b);}_0x58b68d=_[_0xf2c8('0x8e')]({},_0x58b68d,_0x573f68[_0xf2c8('0xba')]);return db[_0xf2c8('0x24')][_0xf2c8('0x16')]({'where':_0x58b68d['where']})[_0xf2c8('0x18')](function(_0x291d61){_0x4db53d[_0xf2c8('0x16')]=_0x291d61;if(_0x573f68['query'][_0xf2c8('0xc4')]){_0x58b68d[_0xf2c8('0xb9')]=[{'all':!![]}];}return db[_0xf2c8('0x24')]['findAll'](_0x58b68d);})[_0xf2c8('0x18')](function(_0x2daee9){if(_0x573f68['query'][_0xf2c8('0xc5')]===_0xf2c8('0xc6')){for(var _0x8554f7=0x0;_0x8554f7<_0x2daee9[_0xf2c8('0x3b')];_0x8554f7++){_0x2daee9[_0x8554f7][_0xf2c8('0xbc')]=juice(_0x2daee9[_0x8554f7]['body']);}}_0x4db53d[_0xf2c8('0xc7')]=_0x2daee9;return _0x4db53d;});}})[_0xf2c8('0x18')](respondWithFilteredResult(_0x5bc52a,_0x58b68d))[_0xf2c8('0x2b')](handleError(_0x5bc52a,null));};exports['addTags']=function(_0x1f8b25,_0x253ac3){return db[_0xf2c8('0x8f')][_0xf2c8('0x5e')]({'where':{'id':_0x1f8b25[_0xf2c8('0xbd')]['id']}})[_0xf2c8('0x18')](handleEntityNotFound(_0x253ac3,null))[_0xf2c8('0x18')](function(_0x2584f7){if(_0x2584f7){return _0x2584f7[_0xf2c8('0xc8')](_0x1f8b25['body'][_0xf2c8('0xc0')],_[_0xf2c8('0xc9')](_0x1f8b25['body'],[_0xf2c8('0xc0'),'id'])||{})[_0xf2c8('0xca')](function(){return db[_0xf2c8('0x64')][_0xf2c8('0xcb')]({'attributes':['id',_0xf2c8('0x1c'),_0xf2c8('0x43')],'where':{'id':_0x1f8b25[_0xf2c8('0xbc')][_0xf2c8('0xc0')]}});})['then'](function(_0x3583f8){socket['emit'](_0xf2c8('0xcc'),{'id':Number(_0x1f8b25[_0xf2c8('0xbd')]['id']),'tags':_0x3583f8||[]});return{'id':Number(_0x1f8b25[_0xf2c8('0xbd')]['id']),'tags':_0x3583f8||[]};});}})['then'](respondWithResult(_0x253ac3,null))['catch'](handleError(_0x253ac3,null));};exports[_0xf2c8('0xcd')]=function(_0x40893f,_0x48522c){return db[_0xf2c8('0x8f')]['find']({'where':{'id':_0x40893f[_0xf2c8('0xbd')]['id']}})['then'](handleEntityNotFound(_0x48522c,null))[_0xf2c8('0x18')](function(_0x24ef21){if(_0x24ef21){return _0x24ef21[_0xf2c8('0xcd')](_0x40893f[_0xf2c8('0x37')][_0xf2c8('0xc0')]);}})[_0xf2c8('0x18')](respondWithStatusCode(_0x48522c,null))[_0xf2c8('0x2b')](handleError(_0x48522c,null));};exports[_0xf2c8('0xce')]=function(_0x430e75,_0x2fa8a9){var _0x236754=moment()['unix']()['toString']();var _0x30b569=path[_0xf2c8('0xcf')](config[_0xf2c8('0xd0')],_0xf2c8('0xd1'),_0xf2c8('0xd2'),_0xf2c8('0xd3'));var _0x42bb2a=path[_0xf2c8('0xcf')](config[_0xf2c8('0xd0')],_0xf2c8('0xd1'),_0xf2c8('0xd2'),'attachments');var _0x48eeb5=path[_0xf2c8('0xcf')](_0x30b569,_0x236754);var _0x49eafa=util[_0xf2c8('0xc2')](_0xf2c8('0xd4'),_0x430e75[_0xf2c8('0xbd')]['id'],_0x236754);var _0x4dccc2=path['join'](_0x30b569,_0x49eafa);var _0x22785e=[];if(_0x430e75[_0xf2c8('0x37')]['attachments']){_0x22785e[_0xf2c8('0xb4')]({'model':db[_0xf2c8('0xd5')],'as':_0xf2c8('0xd6'),'raw':!![]});}var _0x4de363=[{'model':db['MailMessage'],'as':_0xf2c8('0xd7'),'attributes':['id','body',_0xf2c8('0x44'),'to','cc',_0xf2c8('0xd8'),_0xf2c8('0xd9'),_0xf2c8('0x6e')],'where':{'secret':![]},'order':qs[_0xf2c8('0x3e')]('id'),'include':_0x22785e}];return db['MailInteraction'][_0xf2c8('0x5e')]({'where':{'id':_0x430e75[_0xf2c8('0xbd')]['id']},'include':_0x4de363})[_0xf2c8('0x18')](handleEntityNotFound(_0x2fa8a9,null))[_0xf2c8('0x18')](function(_0x17bee3){if(_0x17bee3&&_0x17bee3[_0xf2c8('0xd7')]){var _0x41a4a9=_0x17bee3[_0xf2c8('0xda')]({'plain':!![]});fs[_0xf2c8('0xdb')](_0x48eeb5);return BPromise['each'](_0x41a4a9[_0xf2c8('0xd7')],function(_0x54944f,_0x360c7b){var _0x19d45e={'from':_0x54944f[_0xf2c8('0x44')],'to':_0x54944f['to'],'subject':_0x54944f[_0xf2c8('0xd9')],'html':htmlEntities[_0xf2c8('0xdc')](_0x54944f['body']),'headers':{'Date':moment(_0x54944f[_0xf2c8('0x6e')])[_0xf2c8('0xc2')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x54944f['cc']){_0x19d45e[_0xf2c8('0xdd')]['Cc']=_0x54944f['cc'];}if(_0x54944f[_0xf2c8('0xd8')]){_0x19d45e[_0xf2c8('0xdd')][_0xf2c8('0xde')]=_0x54944f[_0xf2c8('0xd8')];}return new BPromise(function(_0x28de3a,_0x25caa4){if(_0x54944f['Attachments']){for(var _0x1723c8=0x0;_0x1723c8<_0x54944f[_0xf2c8('0xd6')][_0xf2c8('0x3b')];_0x1723c8++){var _0x5569a1=_0x54944f[_0xf2c8('0xd6')][_0x1723c8];var _0x31882e=path[_0xf2c8('0xcf')](_0x42bb2a,_0x5569a1[_0xf2c8('0xdf')]);if(fs[_0xf2c8('0xe0')](_0x31882e)){_0x19d45e['attachments'][_0xf2c8('0xb4')]({'name':_0x5569a1[_0xf2c8('0x1c')],'contentType':_0x5569a1[_0xf2c8('0x34')],'data':fs[_0xf2c8('0xe1')](_0x31882e)});}}}emlformat['build'](_0x19d45e,function(_0x6bc3fd,_0x43eebe){if(_0x6bc3fd)return _0x25caa4(_0x6bc3fd);fs['writeFileSync'](path[_0xf2c8('0xcf')](_0x48eeb5,util[_0xf2c8('0xc2')](_0xf2c8('0xe2'),_0x360c7b)),_0x43eebe);return _0x28de3a(_0x43eebe);});});})[_0xf2c8('0x18')](function(){return new BPromise(function(_0x37f329,_0x5c1763){zipdir(_0x48eeb5,{'saveTo':_0x4dccc2},function(_0x3cf141,_0x210fcc){if(_0x3cf141)return _0x5c1763(_0x3cf141);return _0x37f329(_0x210fcc);});})['then'](function(){return new BPromise(function(_0x3cc479,_0xa34c18){rimraf(_0x48eeb5,function(_0xe6aa26){if(_0xe6aa26)_0xa34c18(_0xe6aa26);return _0x3cc479();});});})[_0xf2c8('0x18')](function(){return _0x2fa8a9[_0xf2c8('0xce')](_0x4dccc2,_0x49eafa,function(_0x2e888d){if(!_0x2e888d)fs[_0xf2c8('0xe3')](_0x4dccc2);});});});}else{return _0x2fa8a9[_0xf2c8('0x10')](0xc8);}})[_0xf2c8('0x2b')](handleError(_0x2fa8a9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d5266c9..317c58b 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 _0xd186=['remove','then','setDataValue','Users','map','findAll','unreadMessages','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save','update'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd186,0x17a));var _0x6d18=function(_0xdd2d1c,_0x3dc5f3){_0xdd2d1c=_0xdd2d1c-0x0;var _0x244e0f=_0xd186[_0xdd2d1c];return _0x244e0f;};'use strict';var EventEmitter=require(_0x6d18('0x0'));var MailInteraction=require(_0x6d18('0x1'))['db'][_0x6d18('0x2')];var MailMessage=require(_0x6d18('0x1'))['db'][_0x6d18('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d18('0x4'),'afterUpdate':_0x6d18('0x5'),'afterDestroy':_0x6d18('0x6')};function emitEvent(_0x479ee8){return function(_0x38a69e,_0x3d7b68,_0x900274){_0x38a69e['getUsers']({'attributes':['id'],'raw':!![]})[_0x6d18('0x7')](function(_0x1ee5f7){_0x38a69e[_0x6d18('0x8')](_0x6d18('0x9'),_0x1ee5f7[_0x6d18('0xa')](function(_0x433b9c){return{'id':_0x433b9c['id']};}));return MailMessage[_0x6d18('0xb')]({'where':{'MailInteractionId':_0x38a69e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6d18('0x7')](function(_0x3e17c9){_0x38a69e[_0x6d18('0x8')](_0x6d18('0xc'),_0x3e17c9['length']);MailInteractionEvents['emit'](_0x479ee8+':'+_0x38a69e['id'],_0x38a69e);MailInteractionEvents['emit'](_0x479ee8,_0x38a69e);_0x900274(null);})['catch'](_0x900274(null));};}for(var e in events){if(events[_0x6d18('0xd')](e)){var event=events[e];MailInteraction[_0x6d18('0xe')](e,emitEvent(event));}}module[_0x6d18('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x4d00=['MailMessage','save','update','remove','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x29edd4,_0x3f446f){var _0x91ed97=function(_0x1f5901){while(--_0x1f5901){_0x29edd4['push'](_0x29edd4['shift']());}};_0x91ed97(++_0x3f446f);}(_0x4d00,0x1ad));var _0x04d0=function(_0x1964d2,_0x2750c4){_0x1964d2=_0x1964d2-0x0;var _0x3996e7=_0x4d00[_0x1964d2];return _0x3996e7;};'use strict';var EventEmitter=require(_0x04d0('0x0'));var MailInteraction=require(_0x04d0('0x1'))['db'][_0x04d0('0x2')];var MailMessage=require(_0x04d0('0x1'))['db'][_0x04d0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x04d0('0x4'),'afterUpdate':_0x04d0('0x5'),'afterDestroy':_0x04d0('0x6')};function emitEvent(_0x48ea43){return function(_0xa3c88b,_0x5d8023,_0x2ca4b4){_0xa3c88b['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2c4a2e){_0xa3c88b['setDataValue'](_0x04d0('0x7'),_0x2c4a2e[_0x04d0('0x8')](function(_0x55cf29){return{'id':_0x55cf29['id']};}));return MailMessage[_0x04d0('0x9')]({'where':{'MailInteractionId':_0xa3c88b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5abd5d){_0xa3c88b['setDataValue']('unreadMessages',_0x5abd5d[_0x04d0('0xa')]);MailInteractionEvents[_0x04d0('0xb')](_0x48ea43+':'+_0xa3c88b['id'],_0xa3c88b);MailInteractionEvents['emit'](_0x48ea43,_0xa3c88b);_0x2ca4b4(null);})[_0x04d0('0xc')](_0x2ca4b4(null));};}for(var e in events){if(events[_0x04d0('0xd')](e)){var event=events[e];MailInteraction[_0x04d0('0xe')](e,emitEvent(event));}}module[_0x04d0('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4558d5f..62bffdf 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 _0xdaf5=['moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x3c788e,_0x2c1bb0){var _0x3c3dd2=function(_0x37adab){while(--_0x37adab){_0x3c788e['push'](_0x3c788e['shift']());}};_0x3c3dd2(++_0x2c1bb0);}(_0xdaf5,0xf9));var _0x5daf=function(_0x405d5b,_0x367d49){_0x405d5b=_0x405d5b-0x0;var _0x26b41c=_0xdaf5[_0x405d5b];return _0x26b41c;};'use strict';var _=require(_0x5daf('0x0'));var util=require(_0x5daf('0x1'));var logger=require('../../config/logger')(_0x5daf('0x2'));var moment=require(_0x5daf('0x3'));var BPromise=require(_0x5daf('0x4'));var rp=require(_0x5daf('0x5'));var fs=require('fs');var path=require(_0x5daf('0x6'));var rimraf=require(_0x5daf('0x7'));var config=require('../../config/environment');var attributes=require(_0x5daf('0x8'));module[_0x5daf('0x9')]=function(_0xb3df11,_0x361c32){return _0xb3df11[_0x5daf('0xa')](_0x5daf('0xb'),attributes,{'tableName':_0x5daf('0xc'),'paranoid':![],'indexes':[{'name':_0x5daf('0xd'),'fields':[_0x5daf('0xe'),'to'],'type':_0x5daf('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a5ac0,_0x4cf4b5,_0x2ed2f0){if(_0x4a5ac0[_0x5daf('0x10')]){_0x4a5ac0[_0x5daf('0x11')]=moment()[_0x5daf('0x12')](_0x5daf('0x13'));}if(_0x4a5ac0[_0x5daf('0x14')]){_0x4a5ac0['closedAt']=moment()[_0x5daf('0x12')](_0x5daf('0x13'));}_0x2ed2f0(null,_0x4cf4b5);},'beforeUpdate':function(_0x563262,_0x10d099,_0x5887fe){if(_0x563262['changed'](_0x5daf('0x10'))){_0x563262[_0x5daf('0x11')]=_0x563262[_0x5daf('0x10')]?moment()[_0x5daf('0x12')](_0x5daf('0x13')):null;}if(_0x563262[_0x5daf('0x15')]('closed')){_0x563262['closedAt']=moment()[_0x5daf('0x12')](_0x5daf('0x13'));_0x563262[_0x5daf('0x10')]=null;_0x563262[_0x5daf('0x11')]=null;}_0x5887fe(null,_0x563262);},'afterUpdate':function(_0x41bd55,_0x1d5215,_0x24e11a){var _0x4a5b7a=_0xb3df11[_0x5daf('0x16')];var _0x252433=_0x41bd55[_0x5daf('0x17')]({'plain':!![]});if(_0x252433[_0x5daf('0x14')]){return _0x4a5b7a['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x252433['id']}})[_0x5daf('0x18')](function(){_0x24e11a();})[_0x5daf('0x19')](function(_0x50fa0f){_0x24e11a(_0x50fa0f);});}else{_0x24e11a();}}},'charset':_0x5daf('0x1a'),'collate':_0x5daf('0x1b')});}; \ No newline at end of file +var _0xe50e=['changed','substatus','substatusAt','closedAt','models','get','MailMessage','then','catch','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0xe50e,0xfa));var _0xee50=function(_0x3bdc93,_0x4fdc0d){_0x3bdc93=_0x3bdc93-0x0;var _0x1ebbbe=_0xe50e[_0x3bdc93];return _0x1ebbbe;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require(_0xee50('0x1'))(_0xee50('0x2'));var moment=require(_0xee50('0x3'));var BPromise=require('bluebird');var rp=require(_0xee50('0x4'));var fs=require('fs');var path=require(_0xee50('0x5'));var rimraf=require('rimraf');var config=require(_0xee50('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xee50('0x7')]=function(_0x255d2f,_0x213ca3){return _0x255d2f['define']('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xee50('0x8'),'fields':[_0xee50('0x9'),'to'],'type':_0xee50('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24977f,_0x53b5a9,_0x10d682){if(_0x24977f['substatus']){_0x24977f['substatusAt']=moment()[_0xee50('0xb')](_0xee50('0xc'));}if(_0x24977f[_0xee50('0xd')]){_0x24977f['closedAt']=moment()['format'](_0xee50('0xc'));}_0x10d682(null,_0x53b5a9);},'beforeUpdate':function(_0x2b49fc,_0x4db5a8,_0x5a56ed){if(_0x2b49fc[_0xee50('0xe')](_0xee50('0xf'))){_0x2b49fc[_0xee50('0x10')]=_0x2b49fc[_0xee50('0xf')]?moment()[_0xee50('0xb')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2b49fc['changed'](_0xee50('0xd'))){_0x2b49fc[_0xee50('0x11')]=moment()[_0xee50('0xb')](_0xee50('0xc'));_0x2b49fc[_0xee50('0xf')]=null;_0x2b49fc['substatusAt']=null;}_0x5a56ed(null,_0x2b49fc);},'afterUpdate':function(_0xf2be60,_0x114bff,_0x344cb4){var _0x3578d3=_0x255d2f[_0xee50('0x12')];var _0x33af1b=_0xf2be60[_0xee50('0x13')]({'plain':!![]});if(_0x33af1b[_0xee50('0xd')]){return _0x3578d3[_0xee50('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x33af1b['id']}})[_0xee50('0x15')](function(){_0x344cb4();})[_0xee50('0x16')](function(_0x531673){_0x344cb4(_0x531673);});}else{_0x344cb4();}}},'charset':_0xee50('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 88de6ec..2c2bd2a 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 _0x30e9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','options','raw','attributes','limit','then','AddTagsToMailInteraction','find','where','ids','body','spread','AddTags','lodash','util','moment','randomstring','ioredis'];(function(_0x5b5a41,_0x1b1a62){var _0x2bb69c=function(_0x213c49){while(--_0x213c49){_0x5b5a41['push'](_0x5b5a41['shift']());}};_0x2bb69c(++_0x1b1a62);}(_0x30e9,0x121));var _0x930e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x30e9[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var moment=require(_0x930e('0x2'));var BPromise=require('bluebird');var rs=require(_0x930e('0x3'));var fs=require('fs');var Redis=require(_0x930e('0x4'));var db=require(_0x930e('0x5'))['db'];var utils=require(_0x930e('0x6'));var logger=require(_0x930e('0x7'))(_0x930e('0x8'));var config=require(_0x930e('0x9'));var jayson=require(_0x930e('0xa'));var client=jayson[_0x930e('0xb')][_0x930e('0xc')]({'port':0x232a});config[_0x930e('0xd')]=_['defaults'](config[_0x930e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x930e('0xe'))(new Redis(config[_0x930e('0xd')]));require(_0x930e('0xf'))[_0x930e('0x10')](socket);function respondWithRpcPromise(_0x20fe44,_0x3cadf8,_0xcba6c1){return new BPromise(function(_0x41f875,_0x3343dd){return client['request'](_0x20fe44,_0xcba6c1)['then'](function(_0x2c9e2f){logger[_0x930e('0x11')](_0x930e('0x12'),_0x3cadf8,_0x930e('0x13'));logger[_0x930e('0x14')](_0x930e('0x15'),_0x3cadf8,_0x930e('0x13'),JSON[_0x930e('0x16')](_0x2c9e2f));if(_0x2c9e2f['error']){if(_0x2c9e2f[_0x930e('0x17')][_0x930e('0x18')]===0x1f4){logger['error'](_0x930e('0x12'),_0x3cadf8,_0x2c9e2f[_0x930e('0x17')][_0x930e('0x19')]);return _0x3343dd(_0x2c9e2f[_0x930e('0x17')][_0x930e('0x19')]);}logger[_0x930e('0x17')]('MailInteraction,\x20%s,\x20%s',_0x3cadf8,_0x2c9e2f[_0x930e('0x17')][_0x930e('0x19')]);return _0x41f875(_0x2c9e2f['error'][_0x930e('0x19')]);}else{logger[_0x930e('0x11')](_0x930e('0x12'),_0x3cadf8,'request\x20sent');_0x41f875(_0x2c9e2f[_0x930e('0x1a')][_0x930e('0x19')]);}})[_0x930e('0x1b')](function(_0xa89d8){logger[_0x930e('0x17')](_0x930e('0x12'),_0x3cadf8,_0xa89d8);_0x3343dd(_0xa89d8);});});}exports[_0x930e('0x1c')]=function(_0xac722e){var _0xc727de=this;return new Promise(function(_0x1a8dfa,_0x468394){return db[_0x930e('0x1d')]['update'](_0xac722e['body'],{'raw':_0xac722e['options']?_0xac722e[_0x930e('0x1e')][_0x930e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xac722e[_0x930e('0x1e')]?_0xac722e[_0x930e('0x1e')]['where']||null:null,'attributes':_0xac722e[_0x930e('0x1e')]?_0xac722e[_0x930e('0x1e')][_0x930e('0x20')]||null:null,'limit':_0xac722e['options']?_0xac722e[_0x930e('0x1e')][_0x930e('0x21')]||null:null})[_0x930e('0x22')](function(_0x2e7434){logger[_0x930e('0x11')](_0x930e('0x1c'),_0xac722e);logger['debug'](_0x930e('0x1c'),_0xac722e,JSON[_0x930e('0x16')](_0x2e7434));_0x1a8dfa(_0x2e7434);})[_0x930e('0x1b')](function(_0x1cd9ea){logger[_0x930e('0x17')]('UpdateMailInteraction',_0x1cd9ea[_0x930e('0x19')],_0xac722e);_0x468394(_0xc727de[_0x930e('0x17')](0x1f4,_0x1cd9ea[_0x930e('0x19')]));});});};exports[_0x930e('0x23')]=function(_0x306c32){return new Promise(function(_0x3d2651,_0x5cfa85){return db[_0x930e('0x1d')][_0x930e('0x24')]({'where':_0x306c32['options']?_0x306c32[_0x930e('0x1e')][_0x930e('0x25')]||null:null})[_0x930e('0x22')](function(_0x42fdc5){if(_0x42fdc5){return _0x42fdc5['addTags'](_0x306c32['body'][_0x930e('0x26')],_['omit'](_0x306c32[_0x930e('0x27')],['ids','id'])||{});}})[_0x930e('0x28')](function(_0x1fbce8){logger[_0x930e('0x11')](_0x930e('0x29'),_0x306c32);logger[_0x930e('0x14')](_0x930e('0x29'),_0x306c32,JSON['stringify'](_0x1fbce8));_0x3d2651(_0x1fbce8);})[_0x930e('0x1b')](function(_0x59e109){logger[_0x930e('0x17')](_0x930e('0x29'),_0x59e109[_0x930e('0x19')],_0x306c32);_0x5cfa85(_this['error'](0x1f4,_0x59e109[_0x930e('0x19')]));});});}; \ No newline at end of file +var _0x53ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','body','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x8398a6,_0x56f357){var _0x2fb0c4=function(_0x1ad622){while(--_0x1ad622){_0x8398a6['push'](_0x8398a6['shift']());}};_0x2fb0c4(++_0x56f357);}(_0x53ae,0x133));var _0xe53a=function(_0x44a09e,_0x39d280){_0x44a09e=_0x44a09e-0x0;var _0x5d53f8=_0x53ae[_0x44a09e];return _0x5d53f8;};'use strict';var _=require(_0xe53a('0x0'));var util=require(_0xe53a('0x1'));var moment=require(_0xe53a('0x2'));var BPromise=require(_0xe53a('0x3'));var rs=require(_0xe53a('0x4'));var fs=require('fs');var Redis=require(_0xe53a('0x5'));var db=require(_0xe53a('0x6'))['db'];var utils=require(_0xe53a('0x7'));var logger=require(_0xe53a('0x8'))(_0xe53a('0x9'));var config=require(_0xe53a('0xa'));var jayson=require(_0xe53a('0xb'));var client=jayson[_0xe53a('0xc')][_0xe53a('0xd')]({'port':0x232a});config[_0xe53a('0xe')]=_['defaults'](config[_0xe53a('0xe')],{'host':_0xe53a('0xf'),'port':0x18eb});var socket=require(_0xe53a('0x10'))(new Redis(config['redis']));require(_0xe53a('0x11'))['register'](socket);function respondWithRpcPromise(_0x251c0f,_0x3415c3,_0x4658ca){return new BPromise(function(_0x5df4dd,_0x504cd1){return client['request'](_0x251c0f,_0x4658ca)['then'](function(_0x4ca5d2){logger['info'](_0xe53a('0x12'),_0x3415c3,_0xe53a('0x13'));logger[_0xe53a('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3415c3,_0xe53a('0x13'),JSON[_0xe53a('0x15')](_0x4ca5d2));if(_0x4ca5d2[_0xe53a('0x16')]){if(_0x4ca5d2[_0xe53a('0x16')][_0xe53a('0x17')]===0x1f4){logger[_0xe53a('0x16')](_0xe53a('0x12'),_0x3415c3,_0x4ca5d2[_0xe53a('0x16')][_0xe53a('0x18')]);return _0x504cd1(_0x4ca5d2['error'][_0xe53a('0x18')]);}logger[_0xe53a('0x16')](_0xe53a('0x12'),_0x3415c3,_0x4ca5d2[_0xe53a('0x16')][_0xe53a('0x18')]);return _0x5df4dd(_0x4ca5d2[_0xe53a('0x16')][_0xe53a('0x18')]);}else{logger[_0xe53a('0x19')]('MailInteraction,\x20%s,\x20%s',_0x3415c3,_0xe53a('0x13'));_0x5df4dd(_0x4ca5d2[_0xe53a('0x1a')][_0xe53a('0x18')]);}})[_0xe53a('0x1b')](function(_0x3babad){logger['error'](_0xe53a('0x12'),_0x3415c3,_0x3babad);_0x504cd1(_0x3babad);});});}exports['UpdateMailInteraction']=function(_0x7a4bec){var _0x28e7d4=this;return new Promise(function(_0x53145f,_0x2717f9){return db['MailInteraction']['update'](_0x7a4bec[_0xe53a('0x1c')],{'raw':_0x7a4bec[_0xe53a('0x1d')]?_0x7a4bec[_0xe53a('0x1d')][_0xe53a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a4bec[_0xe53a('0x1d')]?_0x7a4bec['options'][_0xe53a('0x1f')]||null:null,'attributes':_0x7a4bec[_0xe53a('0x1d')]?_0x7a4bec['options'][_0xe53a('0x20')]||null:null,'limit':_0x7a4bec[_0xe53a('0x1d')]?_0x7a4bec[_0xe53a('0x1d')]['limit']||null:null})['then'](function(_0x36add6){logger[_0xe53a('0x19')](_0xe53a('0x21'),_0x7a4bec);logger[_0xe53a('0x14')]('UpdateMailInteraction',_0x7a4bec,JSON[_0xe53a('0x15')](_0x36add6));_0x53145f(_0x36add6);})[_0xe53a('0x1b')](function(_0x24cbac){logger[_0xe53a('0x16')]('UpdateMailInteraction',_0x24cbac[_0xe53a('0x18')],_0x7a4bec);_0x2717f9(_0x28e7d4['error'](0x1f4,_0x24cbac[_0xe53a('0x18')]));});});};exports[_0xe53a('0x22')]=function(_0x3387a7){return new Promise(function(_0x297eeb,_0x230914){return db['MailInteraction']['find']({'where':_0x3387a7[_0xe53a('0x1d')]?_0x3387a7['options'][_0xe53a('0x1f')]||null:null})['then'](function(_0x5f5b3d){if(_0x5f5b3d){return _0x5f5b3d['addTags'](_0x3387a7[_0xe53a('0x1c')]['ids'],_[_0xe53a('0x23')](_0x3387a7[_0xe53a('0x1c')],[_0xe53a('0x24'),'id'])||{});}})[_0xe53a('0x25')](function(_0x2f1602){logger['info'](_0xe53a('0x26'),_0x3387a7);logger[_0xe53a('0x14')](_0xe53a('0x26'),_0x3387a7,JSON[_0xe53a('0x15')](_0x2f1602));_0x297eeb(_0x2f1602);})[_0xe53a('0x1b')](function(_0x342540){logger[_0xe53a('0x16')](_0xe53a('0x26'),_0x342540[_0xe53a('0x18')],_0x3387a7);_0x230914(_this[_0xe53a('0x16')](0x1f4,_0x342540['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d3750a3..4e8989f 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 _0xa477=['remove','emit','register','length','./mailInteraction.events'];(function(_0x43d19c,_0x2253be){var _0x2fde45=function(_0x3c2110){while(--_0x3c2110){_0x43d19c['push'](_0x43d19c['shift']());}};_0x2fde45(++_0x2253be);}(_0xa477,0x13a));var _0x7a47=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa477[_0x3e5086];return _0xfeb102;};'use strict';var MailInteractionEvents=require(_0x7a47('0x0'));var events=['save',_0x7a47('0x1'),'update'];function createListener(_0x5de531,_0x2ea0d6){return function(_0x3759f7){_0x2ea0d6[_0x7a47('0x2')](_0x5de531,_0x3759f7);};}function removeListener(_0x1794fa,_0x28480a){return function(){MailInteractionEvents['removeListener'](_0x1794fa,_0x28480a);};}exports[_0x7a47('0x3')]=function(_0x57aa40){for(var _0x17b2cd=0x0,_0x2954cc=events[_0x7a47('0x4')];_0x17b2cd<_0x2954cc;_0x17b2cd++){var _0x73ad8e=events[_0x17b2cd];var _0xf8a3e7=createListener('mailInteraction:'+_0x73ad8e,_0x57aa40);MailInteractionEvents['on'](_0x73ad8e,_0xf8a3e7);}}; \ No newline at end of file +var _0x9186=['emit','removeListener','register','length','./mailInteraction.events','save','remove','update'];(function(_0x583761,_0x119f81){var _0x4b72f0=function(_0x351cad){while(--_0x351cad){_0x583761['push'](_0x583761['shift']());}};_0x4b72f0(++_0x119f81);}(_0x9186,0x16c));var _0x6918=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x9186[_0x4c4037];return _0x357862;};'use strict';var MailInteractionEvents=require(_0x6918('0x0'));var events=[_0x6918('0x1'),_0x6918('0x2'),_0x6918('0x3')];function createListener(_0x449d11,_0x548cb6){return function(_0x5d74ea){_0x548cb6[_0x6918('0x4')](_0x449d11,_0x5d74ea);};}function removeListener(_0x502f8f,_0x24d521){return function(){MailInteractionEvents[_0x6918('0x5')](_0x502f8f,_0x24d521);};}exports[_0x6918('0x6')]=function(_0x473c1e){for(var _0x58062a=0x0,_0x151264=events[_0x6918('0x7')];_0x58062a<_0x151264;_0x58062a++){var _0x172caa=events[_0x58062a];var _0x5270e2=createListener('mailInteraction:'+_0x172caa,_0x473c1e);MailInteractionEvents['on'](_0x172caa,_0x5270e2);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 90261ce..7746d2d 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 _0x3d5d=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id/download','download','post','tracked','mail','mailmessage:create','/:id','put','accept','reject','delete'];(function(_0x4ae009,_0x3b0423){var _0x2fb7e3=function(_0x50795f){while(--_0x50795f){_0x4ae009['push'](_0x4ae009['shift']());}};_0x2fb7e3(++_0x3b0423);}(_0x3d5d,0xe2));var _0xd3d5=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x3d5d[_0x5b27da];return _0x3254f4;};'use strict';var multer=require(_0xd3d5('0x0'));var util=require('util');var path=require(_0xd3d5('0x1'));var timeout=require(_0xd3d5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3d5('0x3'));var auth=require(_0xd3d5('0x4'));var interaction=require(_0xd3d5('0x5'));var config=require(_0xd3d5('0x6'));var controller=require(_0xd3d5('0x7'));router[_0xd3d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3d5('0x9')]);router[_0xd3d5('0x8')](_0xd3d5('0xa'),auth[_0xd3d5('0xb')](),controller[_0xd3d5('0xc')]);router[_0xd3d5('0x8')]('/:id',auth[_0xd3d5('0xb')](),controller['show']);router[_0xd3d5('0x8')](_0xd3d5('0xd'),auth['isAuthenticated'](),controller[_0xd3d5('0xe')]);router[_0xd3d5('0xf')]('/',auth['isAuthenticated'](),interaction[_0xd3d5('0x10')](_0xd3d5('0x11'),_0xd3d5('0x12')),controller['create']);router['put'](_0xd3d5('0x13'),auth[_0xd3d5('0xb')](),controller['update']);router[_0xd3d5('0x14')]('/:id/accept',auth[_0xd3d5('0xb')](),controller[_0xd3d5('0x15')]);router[_0xd3d5('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xd3d5('0x16')]);router[_0xd3d5('0x17')]('/:id',auth[_0xd3d5('0xb')](),controller['destroy']);module[_0xd3d5('0x18')]=router; \ No newline at end of file +var _0x1789=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download','download','post','tracked','mail','put','/:id/accept','/:id/reject','reject'];(function(_0xf35b34,_0x11b9b1){var _0x23ee9e=function(_0x101add){while(--_0x101add){_0xf35b34['push'](_0xf35b34['shift']());}};_0x23ee9e(++_0x11b9b1);}(_0x1789,0x92));var _0x9178=function(_0x1cd2ac,_0x718d01){_0x1cd2ac=_0x1cd2ac-0x0;var _0x50164a=_0x1789[_0x1cd2ac];return _0x50164a;};'use strict';var multer=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var path=require(_0x9178('0x2'));var timeout=require('connect-timeout');var express=require(_0x9178('0x3'));var router=express[_0x9178('0x4')]();var fs_extra=require(_0x9178('0x5'));var auth=require(_0x9178('0x6'));var interaction=require(_0x9178('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x9178('0x8')]('/',auth[_0x9178('0x9')](),controller[_0x9178('0xa')]);router[_0x9178('0x8')]('/describe',auth[_0x9178('0x9')](),controller[_0x9178('0xb')]);router[_0x9178('0x8')](_0x9178('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9178('0xd'),auth[_0x9178('0x9')](),controller[_0x9178('0xe')]);router[_0x9178('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9178('0x10')](_0x9178('0x11'),'mailmessage:create'),controller['create']);router['put'](_0x9178('0xc'),auth[_0x9178('0x9')](),controller['update']);router[_0x9178('0x12')](_0x9178('0x13'),auth[_0x9178('0x9')](),controller['accept']);router[_0x9178('0x12')](_0x9178('0x14'),auth['isAuthenticated'](),controller[_0x9178('0x15')]);router['delete'](_0x9178('0xc'),auth[_0x9178('0x9')](),controller[_0x9178('0x16')]);module[_0x9178('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5153dde..d66e5fc 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 _0x8ada=['Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email'];(function(_0xe7f198,_0x37c0dd){var _0x4e6797=function(_0x2b5ae2){while(--_0x2b5ae2){_0xe7f198['push'](_0xe7f198['shift']());}};_0x4e6797(++_0x37c0dd);}(_0x8ada,0xd3));var _0xa8ad=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x8ada[_0x3747ae];return _0x339035;};'use strict';var Sequelize=require(_0xa8ad('0x0'));var _=require(_0xa8ad('0x1'));module[_0xa8ad('0x2')]={'body':{'type':Sequelize[_0xa8ad('0x3')](_0xa8ad('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa8ad('0x3')](_0xa8ad('0x5'))},'read':{'type':Sequelize[_0xa8ad('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa8ad('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa8ad('0x8')](0x1fe)},'from':{'type':Sequelize[_0xa8ad('0x8')]},'to':{'type':Sequelize[_0xa8ad('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0xa8ad('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0xa8ad('0x4'))},'subject':{'type':Sequelize[_0xa8ad('0x3')]},'sentAt':{'type':Sequelize[_0xa8ad('0x9')]},'attach':{'type':Sequelize[_0xa8ad('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa8ad('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa8ad('0x9')]},'originTo':{'type':Sequelize[_0xa8ad('0x3')]('long')},'originCc':{'type':Sequelize[_0xa8ad('0x3')]('long')},'originChannel':{'type':Sequelize[_0xa8ad('0xb')](_0xa8ad('0xc'),_0xa8ad('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xa1ba=['ENUM','out','STRING','TEXT','long','INTEGER','DATE','Email','Chat','sequelize','exports','medium'];(function(_0x1e5772,_0x183d74){var _0x32776b=function(_0x1a81b4){while(--_0x1a81b4){_0x1e5772['push'](_0x1e5772['shift']());}};_0x32776b(++_0x183d74);}(_0xa1ba,0x1b9));var _0xaa1b=function(_0xba37cd,_0x584c13){_0xba37cd=_0xba37cd-0x0;var _0x132dfb=_0xa1ba[_0xba37cd];return _0x132dfb;};'use strict';var Sequelize=require(_0xaa1b('0x0'));var _=require('lodash');module[_0xaa1b('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xaa1b('0x2'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa1b('0x3')]('in','out'),'defaultValue':_0xaa1b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa1b('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xaa1b('0x6')](_0xaa1b('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xaa1b('0x6')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xaa1b('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaa1b('0x9')]},'originTo':{'type':Sequelize[_0xaa1b('0x6')](_0xaa1b('0x7'))},'originCc':{'type':Sequelize[_0xaa1b('0x6')](_0xaa1b('0x7'))},'originChannel':{'type':Sequelize[_0xaa1b('0x3')](_0xaa1b('0xa'),_0xaa1b('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 79f57ec..1d69e11 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 _0x6cc2=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','SIP/%s','event','download','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachments','from','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','html-entities','register','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','Content-Range','json','update','destroy','end','sendStatus','name','send','map','MailMessage','rawAttributes','fieldName','type'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0x6cc2,0x69));var _0x26cc=function(_0x2bae0,_0x56595f){_0x2bae0=_0x2bae0-0x0;var _0x3110ae=_0x6cc2[_0x2bae0];return _0x3110ae;};'use strict';var emlformat=require(_0x26cc('0x0'));var moment=require('moment');var BPromise=require(_0x26cc('0x1'));var util=require('util');var path=require(_0x26cc('0x2'));var fs=require('fs');var _=require(_0x26cc('0x3'));var Redis=require(_0x26cc('0x4'));var htmlToText=require(_0x26cc('0x5'));var qs=require(_0x26cc('0x6'));var logger=require(_0x26cc('0x7'))(_0x26cc('0x8'));var interaction_log=require(_0x26cc('0x7'))('mail-interactions');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x26cc('0x9')]=_[_0x26cc('0xa')](config['redis'],{'host':_0x26cc('0xb'),'port':0x18eb});var socket=require(_0x26cc('0xc'))(new Redis(config[_0x26cc('0x9')]));var htmlEntities=require(_0x26cc('0xd'));require('./mailMessage.socket')[_0x26cc('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x26cc('0xf')]({'port':0x232c});var client9003=jayson[_0x26cc('0x10')][_0x26cc('0xf')]({'port':0x232b});var client9002=jayson[_0x26cc('0x10')][_0x26cc('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x2396b9,_0x6ae8a4,_0x1ed8fb,_0x5395db){return new BPromise(function(_0x1fc844,_0x5eeb44){var _0x16f7e9=_0x5395db||client;return _0x16f7e9[_0x26cc('0x11')](_0x2396b9,_0x1ed8fb)[_0x26cc('0x12')](function(_0x55a4ba){logger[_0x26cc('0x13')](_0x26cc('0x14'),_0x6ae8a4,_0x26cc('0x15'));logger[_0x26cc('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x6ae8a4,'request\x20sent',JSON[_0x26cc('0x17')](_0x55a4ba));if(_0x55a4ba[_0x26cc('0x18')]){if(_0x55a4ba['error'][_0x26cc('0x19')]===0x1f4){logger[_0x26cc('0x18')]('MailMessage,\x20%s,\x20%s',_0x6ae8a4,_0x55a4ba[_0x26cc('0x18')][_0x26cc('0x1a')]);return _0x5eeb44(_0x55a4ba['error'][_0x26cc('0x1a')]);}logger[_0x26cc('0x18')](_0x26cc('0x14'),_0x6ae8a4,_0x55a4ba[_0x26cc('0x18')][_0x26cc('0x1a')]);return _0x1fc844(_0x55a4ba['error'][_0x26cc('0x1a')]);}else{logger[_0x26cc('0x13')](_0x26cc('0x14'),_0x6ae8a4,'request\x20sent');_0x1fc844(_0x55a4ba[_0x26cc('0x1b')][_0x26cc('0x1a')]);}})[_0x26cc('0x1c')](function(_0x3c37fd){logger[_0x26cc('0x18')](_0x26cc('0x14'),_0x6ae8a4,_0x3c37fd);_0x5eeb44(_0x3c37fd);});});}function respondWithResult(_0x95bc78,_0x27748b){_0x27748b=_0x27748b||0xc8;return function(_0xa9b3ae){if(_0xa9b3ae){return _0x95bc78[_0x26cc('0x1d')](_0x27748b)['json'](_0xa9b3ae);}};}function respondWithFilteredResult(_0x57579d,_0x3ff958){return function(_0x466c08){if(_0x466c08){var _0x4b3b28=typeof _0x3ff958[_0x26cc('0x1e')]===_0x26cc('0x1f')&&typeof _0x3ff958[_0x26cc('0x20')]===_0x26cc('0x1f');var _0x23b93f=_0x466c08[_0x26cc('0x21')];var _0x5047bb=_0x4b3b28?0x0:_0x3ff958[_0x26cc('0x1e')];var _0x41ad7a=_0x4b3b28?_0x466c08[_0x26cc('0x21')]:_0x3ff958[_0x26cc('0x1e')]+_0x3ff958[_0x26cc('0x20')];var _0x4cf896;if(_0x41ad7a>=_0x23b93f){_0x41ad7a=_0x23b93f;_0x4cf896=0xc8;}else{_0x4cf896=0xce;}_0x57579d[_0x26cc('0x1d')](_0x4cf896);return _0x57579d['set'](_0x26cc('0x22'),_0x5047bb+'-'+_0x41ad7a+'/'+_0x23b93f)[_0x26cc('0x23')](_0x466c08);}return null;};}function saveUpdates(_0x20e600){return function(_0x1975ac){if(_0x1975ac){return _0x1975ac[_0x26cc('0x24')](_0x20e600)[_0x26cc('0x12')](function(_0x3f38a4){return _0x3f38a4;});}return null;};}function removeEntity(_0x3e6c68){return function(_0x4422bc){if(_0x4422bc){return _0x4422bc[_0x26cc('0x25')]()[_0x26cc('0x12')](function(){_0x3e6c68['status'](0xcc)[_0x26cc('0x26')]();});}};}function handleEntityNotFound(_0x3d4463){return function(_0x515a9e){if(!_0x515a9e){_0x3d4463[_0x26cc('0x27')](0x194);}return _0x515a9e;};}function handleError(_0xbe8f2a,_0x279e2f){_0x279e2f=_0x279e2f||0x1f4;return function(_0x21071a){logger['error'](_0x21071a['stack']);if(_0x21071a[_0x26cc('0x28')]){delete _0x21071a[_0x26cc('0x28')];}_0xbe8f2a[_0x26cc('0x1d')](_0x279e2f)[_0x26cc('0x29')](_0x21071a);};}exports['index']=function(_0x46a924,_0x27659b){var _0x277c7a={},_0x130cb={},_0x47e9b1={'count':0x0,'rows':[]};var _0x56012e=_[_0x26cc('0x2a')](db[_0x26cc('0x2b')][_0x26cc('0x2c')],function(_0x56036d){return{'name':_0x56036d[_0x26cc('0x2d')],'type':_0x56036d[_0x26cc('0x2e')][_0x26cc('0x2f')]};});_0x130cb[_0x26cc('0x30')]=_[_0x26cc('0x2a')](_0x56012e,_0x26cc('0x28'));_0x130cb[_0x26cc('0x31')]=_[_0x26cc('0x32')](_0x46a924['query']);_0x130cb[_0x26cc('0x33')]=_[_0x26cc('0x34')](_0x130cb['model'],_0x130cb[_0x26cc('0x31')]);_0x277c7a['attributes']=_[_0x26cc('0x34')](_0x130cb[_0x26cc('0x30')],qs['fields'](_0x46a924[_0x26cc('0x31')][_0x26cc('0x35')]));_0x277c7a[_0x26cc('0x36')]=_0x277c7a[_0x26cc('0x36')][_0x26cc('0x37')]?_0x277c7a[_0x26cc('0x36')]:_0x130cb[_0x26cc('0x30')];if(!_0x46a924[_0x26cc('0x31')][_0x26cc('0x38')](_0x26cc('0x39'))){_0x277c7a[_0x26cc('0x20')]=qs[_0x26cc('0x20')](_0x46a924['query'][_0x26cc('0x20')]);_0x277c7a['offset']=qs[_0x26cc('0x1e')](_0x46a924[_0x26cc('0x31')][_0x26cc('0x1e')]);}_0x277c7a['order']=qs[_0x26cc('0x3a')](_0x46a924[_0x26cc('0x31')]['sort']);_0x277c7a[_0x26cc('0x3b')]=qs[_0x26cc('0x33')](_[_0x26cc('0x3c')](_0x46a924['query'],_0x130cb[_0x26cc('0x33')]),_0x56012e);if(_0x46a924[_0x26cc('0x31')][_0x26cc('0x3d')]){_0x277c7a[_0x26cc('0x3b')]=_[_0x26cc('0x3e')](_0x277c7a[_0x26cc('0x3b')],{'$or':_[_0x26cc('0x2a')](_0x56012e,function(_0x20bc17){if(_0x20bc17[_0x26cc('0x2e')]!=='VIRTUAL'){var _0x1c7c68={};_0x1c7c68[_0x20bc17['name']]={'$like':'%'+_0x46a924['query'][_0x26cc('0x3d')]+'%'};return _0x1c7c68;}})});}_0x277c7a=_[_0x26cc('0x3e')]({},_0x277c7a,_0x46a924[_0x26cc('0x3f')]);var _0x50ed53={'where':_0x277c7a[_0x26cc('0x3b')]};return db['MailMessage'][_0x26cc('0x21')](_0x50ed53)[_0x26cc('0x12')](function(_0x301964){_0x47e9b1[_0x26cc('0x21')]=_0x301964;if(_0x46a924[_0x26cc('0x31')][_0x26cc('0x40')]){_0x277c7a[_0x26cc('0x41')]=[{'all':!![]}];}return db[_0x26cc('0x2b')][_0x26cc('0x42')](_0x277c7a);})[_0x26cc('0x12')](function(_0x4dfe93){_0x47e9b1[_0x26cc('0x43')]=_0x4dfe93;return _0x47e9b1;})[_0x26cc('0x12')](respondWithFilteredResult(_0x27659b,_0x277c7a))[_0x26cc('0x1c')](handleError(_0x27659b,null));};exports[_0x26cc('0x44')]=function(_0x41741c,_0x3c7de0){var _0xed77c8={'raw':!![],'where':{'id':_0x41741c[_0x26cc('0x45')]['id']}},_0x5d2c4d={};_0x5d2c4d[_0x26cc('0x30')]=_[_0x26cc('0x32')](db[_0x26cc('0x2b')][_0x26cc('0x2c')]);_0x5d2c4d[_0x26cc('0x31')]=_[_0x26cc('0x32')](_0x41741c[_0x26cc('0x31')]);_0x5d2c4d[_0x26cc('0x33')]=_[_0x26cc('0x34')](_0x5d2c4d['model'],_0x5d2c4d[_0x26cc('0x31')]);_0xed77c8[_0x26cc('0x36')]=_[_0x26cc('0x34')](_0x5d2c4d[_0x26cc('0x30')],qs[_0x26cc('0x35')](_0x41741c['query'][_0x26cc('0x35')]));_0xed77c8['attributes']=_0xed77c8[_0x26cc('0x36')][_0x26cc('0x37')]?_0xed77c8[_0x26cc('0x36')]:_0x5d2c4d[_0x26cc('0x30')];if(_0x41741c[_0x26cc('0x31')][_0x26cc('0x40')]){_0xed77c8[_0x26cc('0x41')]=[{'all':!![]}];}_0xed77c8=_[_0x26cc('0x3e')]({},_0xed77c8,_0x41741c['options']);return db[_0x26cc('0x2b')][_0x26cc('0x46')](_0xed77c8)[_0x26cc('0x12')](handleEntityNotFound(_0x3c7de0,null))[_0x26cc('0x12')](respondWithResult(_0x3c7de0,null))[_0x26cc('0x1c')](handleError(_0x3c7de0,null));};exports[_0x26cc('0x24')]=function(_0xb68f8e,_0x4016ac){if(_0xb68f8e[_0x26cc('0x47')]['id']){delete _0xb68f8e[_0x26cc('0x47')]['id'];}return db[_0x26cc('0x2b')][_0x26cc('0x46')]({'where':{'id':_0xb68f8e[_0x26cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x4016ac,null))['then'](saveUpdates(_0xb68f8e[_0x26cc('0x47')],null))[_0x26cc('0x12')](respondWithResult(_0x4016ac,null))[_0x26cc('0x1c')](handleError(_0x4016ac,null));};exports[_0x26cc('0x25')]=function(_0x1b336e,_0xb4f643){return db[_0x26cc('0x2b')][_0x26cc('0x46')]({'where':{'id':_0x1b336e[_0x26cc('0x45')]['id']}})['then'](handleEntityNotFound(_0xb4f643,null))[_0x26cc('0x12')](removeEntity(_0xb4f643,null))[_0x26cc('0x1c')](handleError(_0xb4f643,null));};exports[_0x26cc('0x48')]=function(_0x22335e,_0x564f6d){return db[_0x26cc('0x2b')][_0x26cc('0x48')]()[_0x26cc('0x12')](respondWithResult(_0x564f6d,null))['catch'](handleError(_0x564f6d,null));};exports[_0x26cc('0x49')]=function(_0x567640,_0x2a4ac4){return db[_0x26cc('0x2b')][_0x26cc('0x49')](_0x567640['body'])[_0x26cc('0x12')](function(_0x100565){if(_0x100565){if(_0x100565['direction']===_0x26cc('0x4a')&&!_0x100565['secret']){var _0x2a91cc,_0x4141f0,_0x3bd4a9;if(_0x567640[_0x26cc('0x47')]['to']){_0x4141f0=_0x567640[_0x26cc('0x47')]['to'][_0x26cc('0x4b')](',')[0x0];}return db[_0x26cc('0x4c')][_0x26cc('0x4d')]({'where':{'id':_0x100565[_0x26cc('0x4e')]},'include':[{'model':db[_0x26cc('0x4f')],'as':'List','include':[{'model':db[_0x26cc('0x50')],'as':_0x26cc('0x51'),'where':{'email':_0x4141f0},'limit':0x1,'order':[[_0x26cc('0x52'),'DESC']]}]},{'model':db[_0x26cc('0x53')],'as':_0x26cc('0x54'),'raw':!![],'include':[{'model':db[_0x26cc('0x55')],'as':_0x26cc('0x55'),'raw':!![]}]}]})[_0x26cc('0x12')](function(_0x4c34b3){_0x2a91cc=_0x4c34b3;if(!_0x2a91cc||!_0x2a91cc[_0x26cc('0x54')])return;var _0x44d5e4=_0x2a91cc[_0x26cc('0x56')]();if(_0x567640[_0x26cc('0x47')][_0x26cc('0x57')]&&_0x567640[_0x26cc('0x47')]['attachments']['length']){for(var _0x30a99d=0x0;_0x30a99d<_0x567640[_0x26cc('0x47')][_0x26cc('0x57')][_0x26cc('0x37')];_0x30a99d+=0x1){_0x567640[_0x26cc('0x47')][_0x26cc('0x57')][_0x30a99d]={'filename':_0x567640['body']['attachments'][_0x30a99d][_0x26cc('0x28')],'path':path[_0x26cc('0x58')](config[_0x26cc('0x59')],_0x26cc('0x5a'),_0x567640[_0x26cc('0x47')][_0x26cc('0x57')][_0x30a99d][_0x26cc('0x5b')])};}}_0x3bd4a9={'account':_0x44d5e4,'message':_0x567640[_0x26cc('0x47')]};return;})[_0x26cc('0x12')](function(){if(_0x2a91cc[_0x26cc('0x5c')]){if(_0x2a91cc[_0x26cc('0x5c')][_0x26cc('0x51')][_0x26cc('0x37')]){return _0x2a91cc[_0x26cc('0x5c')]['Contacts'][0x0];}else{return db['CmContact'][_0x26cc('0x49')](_[_0x26cc('0xa')](_0x567640[_0x26cc('0x47')],{'firstName':_0x567640[_0x26cc('0x47')]['to'],'email':_0x567640['body']['to'],'phone':_0x567640['body']['to'],'ListId':_0x2a91cc['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x26cc('0x12')](function(){if(_0x3bd4a9){return respondWithRpcPromise(_0x26cc('0x5d'),_0x26cc('0x5e'),_0x3bd4a9,client9003)[_0x26cc('0x12')](function(_0x22baef){return _0x100565[_0x26cc('0x24')]({'read':!![],'messageId':_0x22baef['messageId'],'sentAt':moment()[_0x26cc('0x5f')](_0x26cc('0x60'))});})[_0x26cc('0x1c')](function(_0x54a67f){logger[_0x26cc('0x18')]('%s',JSON['stringify'](_0x54a67f));return _0x100565;});}return _0x100565;});}return _0x100565;}})['then'](respondWithResult(_0x2a4ac4,0xc9))[_0x26cc('0x1c')](handleError(_0x2a4ac4,null));};exports['accept']=function(_0xee048d,_0x570592){var _0x41fa9a={'agent':{},'channel':_0x26cc('0x61')};if(_0xee048d[_0x26cc('0x47')]['id']){delete _0xee048d[_0x26cc('0x47')]['id'];}_0xee048d[_0x26cc('0x47')][_0x26cc('0x62')]=!![];_0xee048d[_0x26cc('0x47')][_0x26cc('0x63')]=moment()['format'](_0x26cc('0x60'));_0xee048d[_0x26cc('0x47')]['UserId']=_0xee048d[_0x26cc('0x47')][_0x26cc('0x64')]||_0xee048d[_0x26cc('0x65')]['id'];_0x41fa9a[_0x26cc('0x66')]['id']=_0xee048d[_0x26cc('0x47')][_0x26cc('0x64')];return db[_0x26cc('0x2b')][_0x26cc('0x46')]({'where':{'id':_0xee048d['params']['id'],'UserId':null}})[_0x26cc('0x12')](handleEntityNotFound(_0x570592,null))[_0x26cc('0x12')](saveUpdates(_0xee048d[_0x26cc('0x47')],null))[_0x26cc('0x12')](function(_0x3c3e1b){if(_0x3c3e1b){_0x41fa9a[_0x26cc('0x1a')]=_0x3c3e1b[_0x26cc('0x67')]({'plain':!![]});return db[_0x26cc('0x68')]['find']({'where':{'id':_0x3c3e1b[_0x26cc('0x69')]}});}return null;})[_0x26cc('0x12')](handleEntityNotFound(_0x570592,null))[_0x26cc('0x12')](function(_0x14cc06){if(_0x14cc06){return _0x14cc06['update']({'UserId':_0xee048d[_0x26cc('0x47')][_0x26cc('0x64')],'read1stAt':_[_0x26cc('0x6a')](_0x14cc06[_0x26cc('0x6b')])?moment()[_0x26cc('0x5f')](_0x26cc('0x60')):undefined});}return null;})[_0x26cc('0x12')](function(_0x3732b1){if(_0x3732b1){_0x41fa9a[_0x26cc('0x6c')]=_0x3732b1[_0x26cc('0x67')]({'plain':!![]});interaction_log['info'](_0x26cc('0x6d'),_0xee048d[_0x26cc('0x65')]['id'],_0xee048d[_0x26cc('0x65')][_0x26cc('0x28')],_0xee048d[_0x26cc('0x65')]['role'],_0x41fa9a[_0x26cc('0x6c')]['id'],_0xee048d[_0x26cc('0x47')]?JSON[_0x26cc('0x17')](_0xee048d['body']):'null');return respondWithRpcPromise(_0x26cc('0x6e'),'acceptMessage',_0x41fa9a);}return null;})[_0x26cc('0x12')](function(_0x38a9bc){var _0x340dd5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x38a9bc[_0x26cc('0x1a')]['ContactId'];return db[_0x26cc('0x6f')][_0x26cc('0x31')](_0x340dd5,{'type':db[_0x26cc('0x70')][_0x26cc('0x71')]['SELECT'],'raw':!![]})[_0x26cc('0x12')](function(_0x403d7d){return _0x403d7d;});})[_0x26cc('0x12')](function(_0x2288f6){if(_0x2288f6){_0x41fa9a[_0x26cc('0x1a')][_0x26cc('0x72')]=_0x2288f6[0x0];if(!_0xee048d['body'][_0x26cc('0x64')])return;return db[_0x26cc('0x73')][_0x26cc('0x46')]({'where':{'id':_0xee048d[_0x26cc('0x47')][_0x26cc('0x64')],'role':_0x26cc('0x66')},'attributes':['id',_0x26cc('0x28'),_0x26cc('0x74'),'email',_0x26cc('0x75')],'raw':!![]});}return null;})[_0x26cc('0x12')](function(_0x74244b){if(!_0x74244b)return null;_0x41fa9a[_0x26cc('0x1a')]['agent']=_0x74244b;return _0x41fa9a;})[_0x26cc('0x12')](function(_0x1a1494){if(_0x1a1494){if(_0xee048d[_0x26cc('0x47')][_0x26cc('0x76')]){_0x41fa9a['message'][_0x26cc('0x77')]=util[_0x26cc('0x5f')]('SIP/%s',_0xee048d[_0x26cc('0x65')]['name']);_0x41fa9a['message'][_0x26cc('0x78')]=_0x41fa9a[_0x26cc('0x78')];_0x41fa9a[_0x26cc('0x1a')][_0x26cc('0x79')]=_0x41fa9a[_0x26cc('0x78')];_0x41fa9a[_0x26cc('0x1a')]['event']=_0x26cc('0x7a');_0x41fa9a[_0x26cc('0x1a')][_0x26cc('0x47')]=htmlToText[_0x26cc('0x7b')](_0x41fa9a[_0x26cc('0x1a')]['body']);return respondWithRpcPromise(_0x26cc('0x7c'),_0x26cc('0x7c'),{'event':_0x26cc('0x7d'),'message':_0x41fa9a[_0x26cc('0x1a')]},client9002)['then'](function(){return _0x41fa9a;});}return _0x41fa9a;}return null;})[_0x26cc('0x12')](respondWithResult(_0x570592,null))[_0x26cc('0x1c')](handleError(_0x570592,null));};exports[_0x26cc('0x7e')]=function(_0x2ae14d,_0xc0ab70){var _0x30029d={'agent':{},'channel':'mail'};if(_0x2ae14d['body']['id']){delete _0x2ae14d['body']['id'];}_0x2ae14d[_0x26cc('0x47')][_0x26cc('0x64')]=_0x2ae14d['body'][_0x26cc('0x64')]||_0x2ae14d[_0x26cc('0x65')]['id'];_0x30029d['agent']['id']=_0x2ae14d[_0x26cc('0x47')][_0x26cc('0x64')];return db[_0x26cc('0x2b')][_0x26cc('0x46')]({'where':{'id':_0x2ae14d[_0x26cc('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc0ab70,null))[_0x26cc('0x12')](function(_0x3acdd9){if(_0x3acdd9){_0x30029d[_0x26cc('0x1a')]=_0x3acdd9['get']({'plain':!![]});return db[_0x26cc('0x68')][_0x26cc('0x46')]({'where':{'id':_0x3acdd9[_0x26cc('0x69')]}});}return null;})['then'](handleEntityNotFound(_0xc0ab70,null))[_0x26cc('0x12')](function(_0x2f16f3){if(_0x2f16f3){_0x30029d['interaction']=_0x2f16f3[_0x26cc('0x67')]({'plain':!![]});interaction_log[_0x26cc('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ae14d[_0x26cc('0x65')]['id'],_0x2ae14d['user']['name'],_0x2ae14d[_0x26cc('0x65')][_0x26cc('0x7f')],_0x30029d[_0x26cc('0x6c')]['id'],_0x2ae14d[_0x26cc('0x47')]?JSON['stringify'](_0x2ae14d['body']):_0x26cc('0x80'));return respondWithRpcPromise(_0x26cc('0x81'),'rejectMessage',_0x30029d);}return null;})[_0x26cc('0x12')](function(_0x13c491){var _0xe73619=_0x26cc('0x82')+_0x13c491[_0x26cc('0x1a')]['ContactId'];return db[_0x26cc('0x6f')]['query'](_0xe73619,{'type':db[_0x26cc('0x70')][_0x26cc('0x71')][_0x26cc('0x83')],'raw':!![]})[_0x26cc('0x12')](function(_0x5172c1){return _0x5172c1;});})[_0x26cc('0x12')](function(_0x351281){if(_0x351281){_0x30029d['message'][_0x26cc('0x72')]=_0x351281[0x0];if(!_0x2ae14d['body'][_0x26cc('0x64')])return;return db['User'][_0x26cc('0x46')]({'where':{'id':_0x2ae14d[_0x26cc('0x47')][_0x26cc('0x64')],'role':_0x26cc('0x66')},'attributes':['id','name',_0x26cc('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x26cc('0x12')](function(_0x24a1e1){if(!_0x24a1e1)return null;_0x30029d['message'][_0x26cc('0x66')]=_0x24a1e1;return _0x30029d;})['then'](function(_0x5e0691){if(_0x5e0691){_0x5e0691['message']['interface']=util[_0x26cc('0x5f')](_0x26cc('0x84'),_0x2ae14d[_0x26cc('0x65')][_0x26cc('0x28')]);_0x5e0691[_0x26cc('0x1a')]['channel']=_0x30029d['channel'];_0x5e0691[_0x26cc('0x1a')][_0x26cc('0x79')]=_0x30029d[_0x26cc('0x78')];_0x5e0691[_0x26cc('0x1a')][_0x26cc('0x85')]=_0x26cc('0x7e');_0x5e0691[_0x26cc('0x1a')][_0x26cc('0x47')]=htmlToText[_0x26cc('0x7b')](_0x30029d[_0x26cc('0x1a')][_0x26cc('0x47')]);respondWithRpcPromise(_0x26cc('0x7c'),_0x26cc('0x7c'),{'event':'rejectmessage','message':_0x5e0691[_0x26cc('0x1a')]},client9002);return _0x30029d;}return null;})['then'](respondWithResult(_0xc0ab70,null))['catch'](handleError(_0xc0ab70,null));};exports[_0x26cc('0x86')]=function(_0x5f22ee,_0x11e102){var _0x4cada6=moment()['unix']()[_0x26cc('0x87')]();var _0x1e20c4=path[_0x26cc('0x58')](config[_0x26cc('0x59')],'server','files','tmp');var _0x1478bf=path[_0x26cc('0x58')](config[_0x26cc('0x59')],_0x26cc('0x88'),_0x26cc('0x89'),'attachments');var _0x2b7bd6=util[_0x26cc('0x5f')](_0x26cc('0x8a'),_0x4cada6);return db[_0x26cc('0x2b')][_0x26cc('0x46')]({'where':{'id':_0x5f22ee[_0x26cc('0x45')]['id']},'attributes':['id',_0x26cc('0x47'),'from','to','cc',_0x26cc('0x8b'),_0x26cc('0x8c'),_0x26cc('0x8d')],'include':_0x5f22ee[_0x26cc('0x31')][_0x26cc('0x57')]?[{'model':db['Attachment'],'as':_0x26cc('0x8e')}]:undefined})[_0x26cc('0x12')](handleEntityNotFound(_0x11e102,null))[_0x26cc('0x12')](function(_0x430a26){if(_0x430a26){var _0x1ae065=_0x430a26;var _0x116846={'from':_0x1ae065[_0x26cc('0x8f')],'to':_0x1ae065['to'],'subject':_0x1ae065['subject'],'html':htmlEntities['decode'](_0x1ae065[_0x26cc('0x47')]),'headers':{'Date':moment(_0x1ae065[_0x26cc('0x8d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x430a26['cc']){_0x116846[_0x26cc('0x90')]['Cc']=_0x430a26['cc'];}if(_0x430a26[_0x26cc('0x8b')]){_0x116846[_0x26cc('0x90')][_0x26cc('0x91')]=_0x430a26[_0x26cc('0x8b')];}return new BPromise(function(_0xed4361,_0x24726d){if(_0x430a26[_0x26cc('0x8e')]){for(var _0xcc0497=0x0;_0xcc0497<_0x430a26[_0x26cc('0x8e')][_0x26cc('0x37')];_0xcc0497++){var _0x2d1a3f=_0x430a26[_0x26cc('0x8e')][_0xcc0497];var _0xfac683=path[_0x26cc('0x58')](_0x1478bf,_0x2d1a3f[_0x26cc('0x5b')]);if(fs[_0x26cc('0x92')](_0xfac683)){_0x116846['attachments'][_0x26cc('0x93')]({'name':_0x2d1a3f[_0x26cc('0x28')],'contentType':_0x2d1a3f[_0x26cc('0x2e')],'data':fs[_0x26cc('0x94')](_0xfac683)});}}}emlformat[_0x26cc('0x95')](_0x116846,function(_0x5d52c8,_0xcd359a){if(_0x5d52c8)return _0x24726d(_0x5d52c8);fs[_0x26cc('0x96')](path[_0x26cc('0x58')](_0x1e20c4,_0x2b7bd6),_0xcd359a);return _0xed4361(_0xcd359a);});});}})[_0x26cc('0x12')](function(_0x1e64cf){if(_0x1e64cf){return _0x11e102[_0x26cc('0x86')](path[_0x26cc('0x58')](_0x1e20c4,_0x2b7bd6),_0x2b7bd6,function(_0x42ae3){if(!_0x42ae3)fs[_0x26cc('0x97')](path['join'](_0x1e20c4,_0x2b7bd6));});}})[_0x26cc('0x1c')](handleError(_0x11e102,null));}; \ No newline at end of file +var _0x1a93=['event','EventManager','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','motionChannel','fromString','rejectmessage','unix','toString','join','root','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','existsSync','push','type','readFileSync','build','unlinkSync','eml-format','moment','bluebird','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','MailMessage,\x20%s,\x20%s','info','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','find','body','describe','create','split','MailAccount','findOne','CmList','List','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','basename','Contacts','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1a93,0xbe));var _0x31a9=function(_0x5b3bca,_0x373188){_0x5b3bca=_0x5b3bca-0x0;var _0x1510f4=_0x1a93[_0x5b3bca];return _0x1510f4;};'use strict';var emlformat=require(_0x31a9('0x0'));var moment=require(_0x31a9('0x1'));var BPromise=require(_0x31a9('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x31a9('0x3'));var Redis=require(_0x31a9('0x4'));var htmlToText=require(_0x31a9('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x31a9('0x6'));var interaction_log=require(_0x31a9('0x7'))(_0x31a9('0x8'));var config=require(_0x31a9('0x9'));var db=require(_0x31a9('0xa'))['db'];config[_0x31a9('0xb')]=_[_0x31a9('0xc')](config[_0x31a9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x31a9('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x31a9('0xe')](socket);var jayson=require(_0x31a9('0xf'));var client=jayson[_0x31a9('0x10')][_0x31a9('0x11')]({'port':0x232c});var client9003=jayson[_0x31a9('0x10')][_0x31a9('0x11')]({'port':0x232b});var client9002=jayson[_0x31a9('0x10')][_0x31a9('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x27cb9f,_0x3e9175,_0x69038a,_0xba0898){return new BPromise(function(_0x3991d9,_0x39d2fb){var _0x33423f=_0xba0898||client;return _0x33423f[_0x31a9('0x12')](_0x27cb9f,_0x69038a)[_0x31a9('0x13')](function(_0x41ae67){logger['info']('MailMessage,\x20%s,\x20%s',_0x3e9175,_0x31a9('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3e9175,_0x31a9('0x14'),JSON[_0x31a9('0x15')](_0x41ae67));if(_0x41ae67[_0x31a9('0x16')]){if(_0x41ae67[_0x31a9('0x16')][_0x31a9('0x17')]===0x1f4){logger[_0x31a9('0x16')]('MailMessage,\x20%s,\x20%s',_0x3e9175,_0x41ae67['error'][_0x31a9('0x18')]);return _0x39d2fb(_0x41ae67[_0x31a9('0x16')][_0x31a9('0x18')]);}logger[_0x31a9('0x16')](_0x31a9('0x19'),_0x3e9175,_0x41ae67[_0x31a9('0x16')][_0x31a9('0x18')]);return _0x3991d9(_0x41ae67[_0x31a9('0x16')]['message']);}else{logger[_0x31a9('0x1a')](_0x31a9('0x19'),_0x3e9175,_0x31a9('0x14'));_0x3991d9(_0x41ae67[_0x31a9('0x1b')][_0x31a9('0x18')]);}})[_0x31a9('0x1c')](function(_0x2909fd){logger[_0x31a9('0x16')](_0x31a9('0x19'),_0x3e9175,_0x2909fd);_0x39d2fb(_0x2909fd);});});}function respondWithResult(_0x2ca329,_0x39f3cd){_0x39f3cd=_0x39f3cd||0xc8;return function(_0x87b118){if(_0x87b118){return _0x2ca329[_0x31a9('0x1d')](_0x39f3cd)[_0x31a9('0x1e')](_0x87b118);}};}function respondWithFilteredResult(_0x351f0e,_0x34ce7f){return function(_0x2f68dc){if(_0x2f68dc){var _0x5e55a4=typeof _0x34ce7f[_0x31a9('0x1f')]==='undefined'&&typeof _0x34ce7f[_0x31a9('0x20')]===_0x31a9('0x21');var _0x4b3a2f=_0x2f68dc[_0x31a9('0x22')];var _0x2b1025=_0x5e55a4?0x0:_0x34ce7f['offset'];var _0x145648=_0x5e55a4?_0x2f68dc['count']:_0x34ce7f['offset']+_0x34ce7f[_0x31a9('0x20')];var _0x39b67e;if(_0x145648>=_0x4b3a2f){_0x145648=_0x4b3a2f;_0x39b67e=0xc8;}else{_0x39b67e=0xce;}_0x351f0e[_0x31a9('0x1d')](_0x39b67e);return _0x351f0e[_0x31a9('0x23')](_0x31a9('0x24'),_0x2b1025+'-'+_0x145648+'/'+_0x4b3a2f)['json'](_0x2f68dc);}return null;};}function saveUpdates(_0x451935){return function(_0x17cdf9){if(_0x17cdf9){return _0x17cdf9[_0x31a9('0x25')](_0x451935)['then'](function(_0x2af0b6){return _0x2af0b6;});}return null;};}function removeEntity(_0x523120){return function(_0xa26abf){if(_0xa26abf){return _0xa26abf[_0x31a9('0x26')]()[_0x31a9('0x13')](function(){_0x523120[_0x31a9('0x1d')](0xcc)[_0x31a9('0x27')]();});}};}function handleEntityNotFound(_0xfbcd4f){return function(_0x165301){if(!_0x165301){_0xfbcd4f['sendStatus'](0x194);}return _0x165301;};}function handleError(_0x5756e2,_0x9a06e1){_0x9a06e1=_0x9a06e1||0x1f4;return function(_0x199585){logger[_0x31a9('0x16')](_0x199585[_0x31a9('0x28')]);if(_0x199585[_0x31a9('0x29')]){delete _0x199585[_0x31a9('0x29')];}_0x5756e2[_0x31a9('0x1d')](_0x9a06e1)[_0x31a9('0x2a')](_0x199585);};}exports[_0x31a9('0x2b')]=function(_0x1ec7b1,_0x208d79){var _0x512687={},_0x1e48c2={},_0x5c45d4={'count':0x0,'rows':[]};var _0x5c333e=_[_0x31a9('0x2c')](db[_0x31a9('0x2d')][_0x31a9('0x2e')],function(_0x35a011){return{'name':_0x35a011[_0x31a9('0x2f')],'type':_0x35a011['type'][_0x31a9('0x30')]};});_0x1e48c2[_0x31a9('0x31')]=_[_0x31a9('0x2c')](_0x5c333e,_0x31a9('0x29'));_0x1e48c2[_0x31a9('0x32')]=_['keys'](_0x1ec7b1['query']);_0x1e48c2[_0x31a9('0x33')]=_['intersection'](_0x1e48c2[_0x31a9('0x31')],_0x1e48c2[_0x31a9('0x32')]);_0x512687[_0x31a9('0x34')]=_[_0x31a9('0x35')](_0x1e48c2[_0x31a9('0x31')],qs[_0x31a9('0x36')](_0x1ec7b1['query']['fields']));_0x512687[_0x31a9('0x34')]=_0x512687[_0x31a9('0x34')][_0x31a9('0x37')]?_0x512687[_0x31a9('0x34')]:_0x1e48c2[_0x31a9('0x31')];if(!_0x1ec7b1['query'][_0x31a9('0x38')](_0x31a9('0x39'))){_0x512687[_0x31a9('0x20')]=qs[_0x31a9('0x20')](_0x1ec7b1[_0x31a9('0x32')][_0x31a9('0x20')]);_0x512687[_0x31a9('0x1f')]=qs[_0x31a9('0x1f')](_0x1ec7b1[_0x31a9('0x32')]['offset']);}_0x512687['order']=qs['sort'](_0x1ec7b1['query'][_0x31a9('0x3a')]);_0x512687[_0x31a9('0x3b')]=qs[_0x31a9('0x33')](_[_0x31a9('0x3c')](_0x1ec7b1[_0x31a9('0x32')],_0x1e48c2['filters']),_0x5c333e);if(_0x1ec7b1[_0x31a9('0x32')][_0x31a9('0x3d')]){_0x512687[_0x31a9('0x3b')]=_['merge'](_0x512687['where'],{'$or':_['map'](_0x5c333e,function(_0x16c56e){if(_0x16c56e['type']!==_0x31a9('0x3e')){var _0x2096e1={};_0x2096e1[_0x16c56e['name']]={'$like':'%'+_0x1ec7b1[_0x31a9('0x32')][_0x31a9('0x3d')]+'%'};return _0x2096e1;}})});}_0x512687=_['merge']({},_0x512687,_0x1ec7b1['options']);var _0x53877f={'where':_0x512687[_0x31a9('0x3b')]};return db[_0x31a9('0x2d')][_0x31a9('0x22')](_0x53877f)[_0x31a9('0x13')](function(_0x18e74c){_0x5c45d4['count']=_0x18e74c;if(_0x1ec7b1[_0x31a9('0x32')][_0x31a9('0x3f')]){_0x512687[_0x31a9('0x40')]=[{'all':!![]}];}return db[_0x31a9('0x2d')][_0x31a9('0x41')](_0x512687);})[_0x31a9('0x13')](function(_0x228cd4){_0x5c45d4[_0x31a9('0x42')]=_0x228cd4;return _0x5c45d4;})[_0x31a9('0x13')](respondWithFilteredResult(_0x208d79,_0x512687))[_0x31a9('0x1c')](handleError(_0x208d79,null));};exports[_0x31a9('0x43')]=function(_0x47a806,_0x46b201){var _0x27c215={'raw':!![],'where':{'id':_0x47a806[_0x31a9('0x44')]['id']}},_0x586b8a={};_0x586b8a['model']=_['keys'](db[_0x31a9('0x2d')][_0x31a9('0x2e')]);_0x586b8a['query']=_['keys'](_0x47a806[_0x31a9('0x32')]);_0x586b8a[_0x31a9('0x33')]=_[_0x31a9('0x35')](_0x586b8a['model'],_0x586b8a[_0x31a9('0x32')]);_0x27c215[_0x31a9('0x34')]=_['intersection'](_0x586b8a[_0x31a9('0x31')],qs[_0x31a9('0x36')](_0x47a806['query'][_0x31a9('0x36')]));_0x27c215[_0x31a9('0x34')]=_0x27c215[_0x31a9('0x34')][_0x31a9('0x37')]?_0x27c215['attributes']:_0x586b8a['model'];if(_0x47a806[_0x31a9('0x32')][_0x31a9('0x3f')]){_0x27c215[_0x31a9('0x40')]=[{'all':!![]}];}_0x27c215=_[_0x31a9('0x45')]({},_0x27c215,_0x47a806['options']);return db[_0x31a9('0x2d')][_0x31a9('0x46')](_0x27c215)[_0x31a9('0x13')](handleEntityNotFound(_0x46b201,null))[_0x31a9('0x13')](respondWithResult(_0x46b201,null))[_0x31a9('0x1c')](handleError(_0x46b201,null));};exports[_0x31a9('0x25')]=function(_0x4e999c,_0x586dd3){if(_0x4e999c[_0x31a9('0x47')]['id']){delete _0x4e999c[_0x31a9('0x47')]['id'];}return db[_0x31a9('0x2d')][_0x31a9('0x46')]({'where':{'id':_0x4e999c['params']['id']}})['then'](handleEntityNotFound(_0x586dd3,null))[_0x31a9('0x13')](saveUpdates(_0x4e999c[_0x31a9('0x47')],null))[_0x31a9('0x13')](respondWithResult(_0x586dd3,null))['catch'](handleError(_0x586dd3,null));};exports['destroy']=function(_0xabfac,_0x3ddead){return db[_0x31a9('0x2d')][_0x31a9('0x46')]({'where':{'id':_0xabfac['params']['id']}})[_0x31a9('0x13')](handleEntityNotFound(_0x3ddead,null))[_0x31a9('0x13')](removeEntity(_0x3ddead,null))['catch'](handleError(_0x3ddead,null));};exports[_0x31a9('0x48')]=function(_0x3acf7a,_0xce8039){return db[_0x31a9('0x2d')][_0x31a9('0x48')]()[_0x31a9('0x13')](respondWithResult(_0xce8039,null))[_0x31a9('0x1c')](handleError(_0xce8039,null));};exports[_0x31a9('0x49')]=function(_0x599cdb,_0x46dbe4){return db[_0x31a9('0x2d')]['create'](_0x599cdb[_0x31a9('0x47')])[_0x31a9('0x13')](function(_0x3ce527){if(_0x3ce527){if(_0x3ce527['direction']==='out'&&!_0x3ce527['secret']){var _0x2dfc0f,_0x476eed,_0x2c5a91;if(_0x599cdb[_0x31a9('0x47')]['to']){_0x476eed=_0x599cdb[_0x31a9('0x47')]['to'][_0x31a9('0x4a')](',')[0x0];}return db[_0x31a9('0x4b')][_0x31a9('0x4c')]({'where':{'id':_0x3ce527['MailAccountId']},'include':[{'model':db[_0x31a9('0x4d')],'as':_0x31a9('0x4e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x476eed},'limit':0x1,'order':[[_0x31a9('0x4f'),_0x31a9('0x50')]]}]},{'model':db[_0x31a9('0x51')],'as':_0x31a9('0x52'),'raw':!![],'include':[{'model':db[_0x31a9('0x53')],'as':_0x31a9('0x53'),'raw':!![]}]}]})[_0x31a9('0x13')](function(_0x292594){_0x2dfc0f=_0x292594;if(!_0x2dfc0f||!_0x2dfc0f['Smtp'])return;var _0xf9015d=_0x2dfc0f[_0x31a9('0x54')]();if(_0x599cdb[_0x31a9('0x47')][_0x31a9('0x55')]&&_0x599cdb[_0x31a9('0x47')]['attachments'][_0x31a9('0x37')]){for(var _0x2aeb3c=0x0;_0x2aeb3c<_0x599cdb[_0x31a9('0x47')][_0x31a9('0x55')][_0x31a9('0x37')];_0x2aeb3c+=0x1){_0x599cdb[_0x31a9('0x47')]['attachments'][_0x2aeb3c]={'filename':_0x599cdb[_0x31a9('0x47')][_0x31a9('0x55')][_0x2aeb3c]['name'],'path':path['join'](config['root'],_0x31a9('0x56'),_0x599cdb[_0x31a9('0x47')][_0x31a9('0x55')][_0x2aeb3c][_0x31a9('0x57')])};}}_0x2c5a91={'account':_0xf9015d,'message':_0x599cdb[_0x31a9('0x47')]};return;})[_0x31a9('0x13')](function(){if(_0x2dfc0f['List']){if(_0x2dfc0f['List']['Contacts']['length']){return _0x2dfc0f[_0x31a9('0x4e')][_0x31a9('0x58')][0x0];}else{return db[_0x31a9('0x59')][_0x31a9('0x49')](_['defaults'](_0x599cdb['body'],{'firstName':_0x599cdb[_0x31a9('0x47')]['to'],'email':_0x599cdb[_0x31a9('0x47')]['to'],'phone':_0x599cdb['body']['to'],'ListId':_0x2dfc0f[_0x31a9('0x5a')]}));}}else{throw new Error(_0x31a9('0x5b'));}})[_0x31a9('0x13')](function(){if(_0x2c5a91){return respondWithRpcPromise(_0x31a9('0x5c'),_0x31a9('0x5d'),_0x2c5a91,client9003)['then'](function(_0xa57b1e){return _0x3ce527['update']({'read':!![],'messageId':_0xa57b1e[_0x31a9('0x5e')],'sentAt':moment()[_0x31a9('0x5f')](_0x31a9('0x60'))});})['catch'](function(_0x146c1c){logger[_0x31a9('0x16')]('%s',JSON[_0x31a9('0x15')](_0x146c1c));return _0x3ce527;});}return _0x3ce527;});}return _0x3ce527;}})[_0x31a9('0x13')](respondWithResult(_0x46dbe4,0xc9))[_0x31a9('0x1c')](handleError(_0x46dbe4,null));};exports[_0x31a9('0x61')]=function(_0x21dd5e,_0x31aff7){var _0x12e884={'agent':{},'channel':_0x31a9('0x62')};if(_0x21dd5e['body']['id']){delete _0x21dd5e[_0x31a9('0x47')]['id'];}_0x21dd5e['body'][_0x31a9('0x63')]=!![];_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x64')]=moment()[_0x31a9('0x5f')](_0x31a9('0x60'));_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x65')]=_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x65')]||_0x21dd5e[_0x31a9('0x66')]['id'];_0x12e884['agent']['id']=_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x65')];return db[_0x31a9('0x2d')]['find']({'where':{'id':_0x21dd5e['params']['id'],'UserId':null}})[_0x31a9('0x13')](handleEntityNotFound(_0x31aff7,null))['then'](saveUpdates(_0x21dd5e[_0x31a9('0x47')],null))['then'](function(_0x34dcb2){if(_0x34dcb2){_0x12e884['message']=_0x34dcb2[_0x31a9('0x67')]({'plain':!![]});return db[_0x31a9('0x68')][_0x31a9('0x46')]({'where':{'id':_0x34dcb2[_0x31a9('0x69')]}});}return null;})[_0x31a9('0x13')](handleEntityNotFound(_0x31aff7,null))[_0x31a9('0x13')](function(_0x52f742){if(_0x52f742){return _0x52f742[_0x31a9('0x25')]({'UserId':_0x21dd5e['body'][_0x31a9('0x65')],'read1stAt':_[_0x31a9('0x6a')](_0x52f742[_0x31a9('0x6b')])?moment()[_0x31a9('0x5f')](_0x31a9('0x60')):undefined});}return null;})[_0x31a9('0x13')](function(_0x3d0a75){if(_0x3d0a75){_0x12e884['interaction']=_0x3d0a75[_0x31a9('0x67')]({'plain':!![]});interaction_log[_0x31a9('0x1a')](_0x31a9('0x6c'),_0x21dd5e[_0x31a9('0x66')]['id'],_0x21dd5e[_0x31a9('0x66')][_0x31a9('0x29')],_0x21dd5e[_0x31a9('0x66')]['role'],_0x12e884['interaction']['id'],_0x21dd5e[_0x31a9('0x47')]?JSON[_0x31a9('0x15')](_0x21dd5e[_0x31a9('0x47')]):_0x31a9('0x6d'));return respondWithRpcPromise(_0x31a9('0x6e'),'acceptMessage',_0x12e884);}return null;})['then'](function(_0x5d047b){var _0x3173d3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d047b['message']['ContactId'];return db[_0x31a9('0x6f')][_0x31a9('0x32')](_0x3173d3,{'type':db['Sequelize'][_0x31a9('0x70')][_0x31a9('0x71')],'raw':!![]})[_0x31a9('0x13')](function(_0x142e12){return _0x142e12;});})[_0x31a9('0x13')](function(_0x1e6703){if(_0x1e6703){_0x12e884[_0x31a9('0x18')][_0x31a9('0x72')]=_0x1e6703[0x0];if(!_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x65')])return;return db[_0x31a9('0x73')][_0x31a9('0x46')]({'where':{'id':_0x21dd5e[_0x31a9('0x47')][_0x31a9('0x65')],'role':_0x31a9('0x74')},'attributes':['id','name',_0x31a9('0x75'),_0x31a9('0x76'),_0x31a9('0x77')],'raw':!![]});}return null;})[_0x31a9('0x13')](function(_0x50725c){if(!_0x50725c)return null;_0x12e884[_0x31a9('0x18')][_0x31a9('0x74')]=_0x50725c;return _0x12e884;})[_0x31a9('0x13')](function(_0x5511ed){if(_0x5511ed){if(_0x21dd5e['body'][_0x31a9('0x78')]){_0x12e884['message'][_0x31a9('0x79')]=util[_0x31a9('0x5f')](_0x31a9('0x7a'),_0x21dd5e[_0x31a9('0x66')][_0x31a9('0x29')]);_0x12e884['message'][_0x31a9('0x7b')]=_0x12e884['channel'];_0x12e884[_0x31a9('0x18')]['motionChannel']=_0x12e884['channel'];_0x12e884[_0x31a9('0x18')][_0x31a9('0x7c')]='accept';_0x12e884[_0x31a9('0x18')][_0x31a9('0x47')]=htmlToText['fromString'](_0x12e884[_0x31a9('0x18')][_0x31a9('0x47')]);return respondWithRpcPromise('EventManager',_0x31a9('0x7d'),{'event':'acceptmessage','message':_0x12e884[_0x31a9('0x18')]},client9002)[_0x31a9('0x13')](function(){return _0x12e884;});}return _0x12e884;}return null;})[_0x31a9('0x13')](respondWithResult(_0x31aff7,null))[_0x31a9('0x1c')](handleError(_0x31aff7,null));};exports['reject']=function(_0x4ab0e9,_0x354864){var _0x491bd5={'agent':{},'channel':_0x31a9('0x62')};if(_0x4ab0e9[_0x31a9('0x47')]['id']){delete _0x4ab0e9[_0x31a9('0x47')]['id'];}_0x4ab0e9['body']['UserId']=_0x4ab0e9[_0x31a9('0x47')][_0x31a9('0x65')]||_0x4ab0e9[_0x31a9('0x66')]['id'];_0x491bd5[_0x31a9('0x74')]['id']=_0x4ab0e9[_0x31a9('0x47')][_0x31a9('0x65')];return db['MailMessage'][_0x31a9('0x46')]({'where':{'id':_0x4ab0e9[_0x31a9('0x44')]['id'],'UserId':null}})[_0x31a9('0x13')](handleEntityNotFound(_0x354864,null))[_0x31a9('0x13')](function(_0x3c023a){if(_0x3c023a){_0x491bd5['message']=_0x3c023a[_0x31a9('0x67')]({'plain':!![]});return db['MailInteraction'][_0x31a9('0x46')]({'where':{'id':_0x3c023a[_0x31a9('0x69')]}});}return null;})[_0x31a9('0x13')](handleEntityNotFound(_0x354864,null))[_0x31a9('0x13')](function(_0x2f68c6){if(_0x2f68c6){_0x491bd5[_0x31a9('0x7e')]=_0x2f68c6[_0x31a9('0x67')]({'plain':!![]});interaction_log[_0x31a9('0x1a')](_0x31a9('0x7f'),_0x4ab0e9[_0x31a9('0x66')]['id'],_0x4ab0e9['user'][_0x31a9('0x29')],_0x4ab0e9[_0x31a9('0x66')][_0x31a9('0x80')],_0x491bd5[_0x31a9('0x7e')]['id'],_0x4ab0e9[_0x31a9('0x47')]?JSON['stringify'](_0x4ab0e9[_0x31a9('0x47')]):_0x31a9('0x6d'));return respondWithRpcPromise(_0x31a9('0x81'),_0x31a9('0x82'),_0x491bd5);}return null;})[_0x31a9('0x13')](function(_0x105b04){var _0x392573=_0x31a9('0x83')+_0x105b04[_0x31a9('0x18')]['ContactId'];return db[_0x31a9('0x6f')][_0x31a9('0x32')](_0x392573,{'type':db[_0x31a9('0x84')]['QueryTypes'][_0x31a9('0x71')],'raw':!![]})[_0x31a9('0x13')](function(_0x2c1548){return _0x2c1548;});})[_0x31a9('0x13')](function(_0x302dac){if(_0x302dac){_0x491bd5['message'][_0x31a9('0x72')]=_0x302dac[0x0];if(!_0x4ab0e9[_0x31a9('0x47')][_0x31a9('0x65')])return;return db[_0x31a9('0x73')][_0x31a9('0x46')]({'where':{'id':_0x4ab0e9['body'][_0x31a9('0x65')],'role':_0x31a9('0x74')},'attributes':['id','name',_0x31a9('0x75'),_0x31a9('0x76'),_0x31a9('0x77')],'raw':!![]});}return null;})['then'](function(_0x581370){if(!_0x581370)return null;_0x491bd5[_0x31a9('0x18')][_0x31a9('0x74')]=_0x581370;return _0x491bd5;})[_0x31a9('0x13')](function(_0x548f3e){if(_0x548f3e){_0x548f3e['message']['interface']=util[_0x31a9('0x5f')]('SIP/%s',_0x4ab0e9[_0x31a9('0x66')][_0x31a9('0x29')]);_0x548f3e[_0x31a9('0x18')][_0x31a9('0x7b')]=_0x491bd5['channel'];_0x548f3e[_0x31a9('0x18')][_0x31a9('0x85')]=_0x491bd5[_0x31a9('0x7b')];_0x548f3e[_0x31a9('0x18')][_0x31a9('0x7c')]='reject';_0x548f3e[_0x31a9('0x18')][_0x31a9('0x47')]=htmlToText[_0x31a9('0x86')](_0x491bd5[_0x31a9('0x18')][_0x31a9('0x47')]);respondWithRpcPromise(_0x31a9('0x7d'),_0x31a9('0x7d'),{'event':_0x31a9('0x87'),'message':_0x548f3e['message']},client9002);return _0x491bd5;}return null;})[_0x31a9('0x13')](respondWithResult(_0x354864,null))[_0x31a9('0x1c')](handleError(_0x354864,null));};exports['download']=function(_0x444b7b,_0x1e81a2){var _0x1383c5=moment()[_0x31a9('0x88')]()[_0x31a9('0x89')]();var _0x2d6fc0=path[_0x31a9('0x8a')](config[_0x31a9('0x8b')],_0x31a9('0x8c'),_0x31a9('0x8d'),_0x31a9('0x8e'));var _0x1e3c8a=path[_0x31a9('0x8a')](config['root'],_0x31a9('0x8c'),_0x31a9('0x8d'),_0x31a9('0x55'));var _0x55317a=util['format']('message-%s.eml',_0x1383c5);return db[_0x31a9('0x2d')][_0x31a9('0x46')]({'where':{'id':_0x444b7b[_0x31a9('0x44')]['id']},'attributes':['id',_0x31a9('0x47'),_0x31a9('0x8f'),'to','cc',_0x31a9('0x90'),_0x31a9('0x91'),_0x31a9('0x92')],'include':_0x444b7b[_0x31a9('0x32')]['attachments']?[{'model':db[_0x31a9('0x93')],'as':_0x31a9('0x94')}]:undefined})[_0x31a9('0x13')](handleEntityNotFound(_0x1e81a2,null))[_0x31a9('0x13')](function(_0x1442c0){if(_0x1442c0){var _0x44ecc4=_0x1442c0;var _0x82e7e8={'from':_0x44ecc4[_0x31a9('0x8f')],'to':_0x44ecc4['to'],'subject':_0x44ecc4[_0x31a9('0x91')],'html':htmlEntities[_0x31a9('0x95')](_0x44ecc4[_0x31a9('0x47')]),'headers':{'Date':moment(_0x44ecc4[_0x31a9('0x92')])[_0x31a9('0x5f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1442c0['cc']){_0x82e7e8[_0x31a9('0x96')]['Cc']=_0x1442c0['cc'];}if(_0x1442c0['bcc']){_0x82e7e8[_0x31a9('0x96')]['Bcc']=_0x1442c0[_0x31a9('0x90')];}return new BPromise(function(_0x50bd33,_0x3892d0){if(_0x1442c0[_0x31a9('0x94')]){for(var _0x10a2f7=0x0;_0x10a2f7<_0x1442c0[_0x31a9('0x94')][_0x31a9('0x37')];_0x10a2f7++){var _0xf692b=_0x1442c0[_0x31a9('0x94')][_0x10a2f7];var _0x4ef7ac=path[_0x31a9('0x8a')](_0x1e3c8a,_0xf692b[_0x31a9('0x57')]);if(fs[_0x31a9('0x97')](_0x4ef7ac)){_0x82e7e8[_0x31a9('0x55')][_0x31a9('0x98')]({'name':_0xf692b[_0x31a9('0x29')],'contentType':_0xf692b[_0x31a9('0x99')],'data':fs[_0x31a9('0x9a')](_0x4ef7ac)});}}}emlformat[_0x31a9('0x9b')](_0x82e7e8,function(_0x1d1863,_0x309253){if(_0x1d1863)return _0x3892d0(_0x1d1863);fs['writeFileSync'](path['join'](_0x2d6fc0,_0x55317a),_0x309253);return _0x50bd33(_0x309253);});});}})[_0x31a9('0x13')](function(_0x3d70b2){if(_0x3d70b2){return _0x1e81a2['download'](path[_0x31a9('0x8a')](_0x2d6fc0,_0x55317a),_0x55317a,function(_0x55c628){if(!_0x55c628)fs[_0x31a9('0x9c')](path[_0x31a9('0x8a')](_0x2d6fc0,_0x55317a));});}})[_0x31a9('0x1c')](handleError(_0x1e81a2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f41ce69..17fb8b0 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 _0x5145=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x1b5a9a,_0x1c56a7){var _0x1122ef=function(_0x81326b){while(--_0x81326b){_0x1b5a9a['push'](_0x1b5a9a['shift']());}};_0x1122ef(++_0x1c56a7);}(_0x5145,0xa2));var _0x5514=function(_0x45b1cf,_0x467f4c){_0x45b1cf=_0x45b1cf-0x0;var _0x1f3084=_0x5145[_0x45b1cf];return _0x1f3084;};'use strict';var EventEmitter=require(_0x5514('0x0'));var MailMessage=require(_0x5514('0x1'))['db'][_0x5514('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5514('0x3')](0x0);var events={'afterCreate':_0x5514('0x4'),'afterUpdate':_0x5514('0x5'),'afterDestroy':_0x5514('0x6')};function emitEvent(_0x2e2bab){return function(_0x59c74a,_0x35a6c0,_0x1f927a){MailMessageEvents[_0x5514('0x7')](_0x2e2bab+':'+_0x59c74a['id'],_0x59c74a);MailMessageEvents[_0x5514('0x7')](_0x2e2bab,_0x59c74a);_0x1f927a(null);};}for(var e in events){if(events[_0x5514('0x8')](e)){var event=events[e];MailMessage[_0x5514('0x9')](e,emitEvent(event));}}module[_0x5514('0xa')]=MailMessageEvents; \ No newline at end of file +var _0xb27b=['MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0xb27b,0x115));var _0xbb27=function(_0x55a763,_0x36fb18){_0x55a763=_0x55a763-0x0;var _0x1d3ad9=_0xb27b[_0x55a763];return _0x1d3ad9;};'use strict';var EventEmitter=require(_0xbb27('0x0'));var MailMessage=require(_0xbb27('0x1'))['db'][_0xbb27('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbb27('0x3')](0x0);var events={'afterCreate':_0xbb27('0x4'),'afterUpdate':'update','afterDestroy':_0xbb27('0x5')};function emitEvent(_0x5db9c7){return function(_0x17ca1a,_0x2a4031,_0x25e840){MailMessageEvents[_0xbb27('0x6')](_0x5db9c7+':'+_0x17ca1a['id'],_0x17ca1a);MailMessageEvents['emit'](_0x5db9c7,_0x17ca1a);_0x25e840(null);};}for(var e in events){if(events[_0xbb27('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xbb27('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 5c00e57..681ca55 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 _0x7a2a=['moment','bluebird','request-promise','html-to-text','path','rimraf','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','MailInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x55526a,_0x245c8e){var _0x4061fd=function(_0x41d067){while(--_0x41d067){_0x55526a['push'](_0x55526a['shift']());}};_0x4061fd(++_0x245c8e);}(_0x7a2a,0x7a));var _0xa7a2=function(_0x17ff3a,_0x584c36){_0x17ff3a=_0x17ff3a-0x0;var _0x532bd5=_0x7a2a[_0x17ff3a];return _0x532bd5;};'use strict';var _=require(_0xa7a2('0x0'));var util=require('util');var logger=require(_0xa7a2('0x1'))('api');var moment=require(_0xa7a2('0x2'));var BPromise=require(_0xa7a2('0x3'));var rp=require(_0xa7a2('0x4'));var htmlToText=require(_0xa7a2('0x5'));var fs=require('fs');var path=require(_0xa7a2('0x6'));var rimraf=require(_0xa7a2('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xa7a2('0x8')]=function(_0x302534,_0x14d701){return _0x302534[_0xa7a2('0x9')](_0xa7a2('0xa'),attributes,{'tableName':_0xa7a2('0xb'),'paranoid':![],'indexes':[{'name':_0xa7a2('0xc'),'fields':['messageId']},{'name':_0xa7a2('0xd'),'fields':[_0xa7a2('0xe'),_0xa7a2('0xf')],'type':_0xa7a2('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x56c3e0,_0x37f654,_0x1657c9){if(_0x56c3e0[_0xa7a2('0x11')]){_0x56c3e0[_0xa7a2('0xe')]=htmlToText['fromString'](_0x56c3e0['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1657c9(null,_0x37f654);},'afterCreate':function(_0x95c35d,_0x4a4c71,_0x214d8e){var _0x44e2bb=_0x302534[_0xa7a2('0x12')];var _0x345c67=_0x95c35d[_0xa7a2('0x13')]({'plain':!![]});if(_0x345c67[_0xa7a2('0x14')]['toLowerCase']()==='in'||_0x345c67[_0xa7a2('0x14')][_0xa7a2('0x15')]()==='out'&&!_0x345c67[_0xa7a2('0x16')]&&!_['isNil'](_0x345c67[_0xa7a2('0x17')])){_0x44e2bb[_0xa7a2('0x18')][_0xa7a2('0x19')]({'where':{'id':_0x345c67[_0xa7a2('0x1a')]}})['then'](function(_0x5eaa14){if(_0x5eaa14){_0x5eaa14['update']({'lastMsgAt':_0x345c67['createdAt'],'lastMsgDirection':_0x345c67['direction'][_0xa7a2('0x15')]()});}})[_0xa7a2('0x1b')](function(_0x2279a4){console[_0xa7a2('0x1c')](_0x2279a4);});}_0x214d8e();}},'charset':_0xa7a2('0x1d'),'collate':_0xa7a2('0x1e')});}; \ No newline at end of file +var _0xa954=['messageId','fti_mail_messages','plainBody','subject','body','models','direction','toLowerCase','secret','UserId','findOne','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','api','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xa954,0x1a0));var _0x4a95=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xa954[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require('lodash');var util=require(_0x4a95('0x0'));var logger=require('../../config/logger')(_0x4a95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x4a95('0x2'));var fs=require('fs');var path=require(_0x4a95('0x3'));var rimraf=require(_0x4a95('0x4'));var config=require(_0x4a95('0x5'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x214a54,_0x14e43b){return _0x214a54[_0x4a95('0x6')](_0x4a95('0x7'),attributes,{'tableName':_0x4a95('0x8'),'paranoid':![],'indexes':[{'name':_0x4a95('0x9'),'fields':[_0x4a95('0x9')]},{'name':_0x4a95('0xa'),'fields':[_0x4a95('0xb'),_0x4a95('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bd6a7,_0x161b4f,_0x2ded59){if(_0x2bd6a7[_0x4a95('0xd')]){_0x2bd6a7['plainBody']=htmlToText['fromString'](_0x2bd6a7[_0x4a95('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2ded59(null,_0x161b4f);},'afterCreate':function(_0x2e19e0,_0x156db6,_0x397720){var _0x414b87=_0x214a54[_0x4a95('0xe')];var _0xb6724a=_0x2e19e0['get']({'plain':!![]});if(_0xb6724a[_0x4a95('0xf')][_0x4a95('0x10')]()==='in'||_0xb6724a[_0x4a95('0xf')][_0x4a95('0x10')]()==='out'&&!_0xb6724a[_0x4a95('0x11')]&&!_['isNil'](_0xb6724a[_0x4a95('0x12')])){_0x414b87['MailInteraction'][_0x4a95('0x13')]({'where':{'id':_0xb6724a['MailInteractionId']}})['then'](function(_0x4686d6){if(_0x4686d6){_0x4686d6[_0x4a95('0x14')]({'lastMsgAt':_0xb6724a[_0x4a95('0x15')],'lastMsgDirection':_0xb6724a[_0x4a95('0xf')][_0x4a95('0x10')]()});}})[_0x4a95('0x16')](function(_0x5338a8){console['error'](_0x5338a8);});}_0x397720();}},'charset':_0x4a95('0x17'),'collate':_0x4a95('0x18')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f7f005c..7a77233 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 _0x5b12=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x5b12,0xa3));var _0x25b1=function(_0x268bc6,_0x3a0455){_0x268bc6=_0x268bc6-0x0;var _0x2135c0=_0x5b12[_0x268bc6];return _0x2135c0;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});config['redis']=_[_0x25b1('0x8')](config[_0x25b1('0x9')],{'host':_0x25b1('0xa'),'port':0x18eb});var socket=require(_0x25b1('0xb'))(new Redis(config[_0x25b1('0x9')]));require(_0x25b1('0xc'))[_0x25b1('0xd')](socket);function respondWithRpcPromise(_0x6235e2,_0x5b7224,_0x2b739e){return new BPromise(function(_0x1c28cf,_0x2cee35){return client[_0x25b1('0xe')](_0x6235e2,_0x2b739e)[_0x25b1('0xf')](function(_0x8a71af){logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));logger[_0x25b1('0x13')](_0x25b1('0x14'),_0x5b7224,_0x25b1('0x12'),JSON[_0x25b1('0x15')](_0x8a71af));if(_0x8a71af[_0x25b1('0x16')]){if(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x17')]===0x1f4){logger['error'](_0x25b1('0x11'),_0x5b7224,_0x8a71af[_0x25b1('0x16')]['message']);return _0x2cee35(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x18')]);}logger[_0x25b1('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x8a71af['error'][_0x25b1('0x18')]);return _0x1c28cf(_0x8a71af['error'][_0x25b1('0x18')]);}else{logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));_0x1c28cf(_0x8a71af[_0x25b1('0x19')][_0x25b1('0x18')]);}})[_0x25b1('0x1a')](function(_0x292463){logger['error']('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x292463);_0x2cee35(_0x292463);});});}exports[_0x25b1('0x1b')]=function(_0x501dc8){var _0x174f4a=this;return new Promise(function(_0x50ae0f,_0x3bfd7d){return db['MailMessage'][_0x25b1('0x1c')](_0x501dc8['body'],{'raw':_0x501dc8[_0x25b1('0x1d')]?_0x501dc8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bca9f){logger[_0x25b1('0x10')]('CreateMailMessage',_0x501dc8);logger[_0x25b1('0x13')](_0x25b1('0x1b'),_0x501dc8,JSON[_0x25b1('0x15')](_0x3bca9f));_0x50ae0f(_0x3bca9f);})[_0x25b1('0x1a')](function(_0x1aabbb){logger['error'](_0x25b1('0x1b'),_0x1aabbb[_0x25b1('0x18')],_0x501dc8);_0x3bfd7d(_0x174f4a[_0x25b1('0x16')](0x1f4,_0x1aabbb[_0x25b1('0x18')]));});});}; \ No newline at end of file +var _0x4888=['code','message','request\x20sent','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x131776,_0x8b1dc7){var _0x15a4e2=function(_0x428008){while(--_0x428008){_0x131776['push'](_0x131776['shift']());}};_0x15a4e2(++_0x8b1dc7);}(_0x4888,0x198));var _0x8488=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0x4888[_0x15bf58];return _0x5d6c96;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});}exports[_0x8488('0x1a')]=function(_0x3dd93e){var _0x554ec6=this;return new Promise(function(_0x4a1b45,_0x340d6b){return db[_0x8488('0x1b')][_0x8488('0x1c')](_0x3dd93e[_0x8488('0x1d')],{'raw':_0x3dd93e[_0x8488('0x1e')]?_0x3dd93e[_0x8488('0x1e')][_0x8488('0x1f')]===undefined?!![]:![]:!![]})[_0x8488('0xf')](function(_0x39dd43){logger['info'](_0x8488('0x1a'),_0x3dd93e);logger[_0x8488('0x12')](_0x8488('0x1a'),_0x3dd93e,JSON[_0x8488('0x20')](_0x39dd43));_0x4a1b45(_0x39dd43);})[_0x8488('0x19')](function(_0x54ecda){logger['error']('CreateMailMessage',_0x54ecda['message'],_0x3dd93e);_0x340d6b(_0x554ec6[_0x8488('0x14')](0x1f4,_0x54ecda['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 609a09a..d4558bf 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 _0x331c=['./mailMessage.events','remove','removeListener','register','mailMessage:'];(function(_0x284e85,_0x1bfec9){var _0x59ba3d=function(_0x559559){while(--_0x559559){_0x284e85['push'](_0x284e85['shift']());}};_0x59ba3d(++_0x1bfec9);}(_0x331c,0xf0));var _0xc331=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x331c[_0x46aff0];return _0x9d78cf;};'use strict';var MailMessageEvents=require(_0xc331('0x0'));var events=['save',_0xc331('0x1'),'update'];function createListener(_0x4ed262,_0x15f272){return function(_0x4f695b){_0x15f272['emit'](_0x4ed262,_0x4f695b);};}function removeListener(_0x2eaa9d,_0x54d8ca){return function(){MailMessageEvents[_0xc331('0x2')](_0x2eaa9d,_0x54d8ca);};}exports[_0xc331('0x3')]=function(_0x567fe9){for(var _0x14a44f=0x0,_0x200d28=events['length'];_0x14a44f<_0x200d28;_0x14a44f++){var _0x39a886=events[_0x14a44f];var _0x194bda=createListener(_0xc331('0x4')+_0x39a886,_0x567fe9);MailMessageEvents['on'](_0x39a886,_0x194bda);}}; \ No newline at end of file +var _0xc576=['./mailMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc576,0x1ea));var _0x6c57=function(_0x4dc0c8,_0x48d51f){_0x4dc0c8=_0x4dc0c8-0x0;var _0x26bf81=_0xc576[_0x4dc0c8];return _0x26bf81;};'use strict';var MailMessageEvents=require(_0x6c57('0x0'));var events=[_0x6c57('0x1'),_0x6c57('0x2'),_0x6c57('0x3')];function createListener(_0x187b99,_0x48e354){return function(_0x4fc60a){_0x48e354[_0x6c57('0x4')](_0x187b99,_0x4fc60a);};}function removeListener(_0x4e5df7,_0x31ab9f){return function(){MailMessageEvents[_0x6c57('0x5')](_0x4e5df7,_0x31ab9f);};}exports['register']=function(_0xa6e0c4){for(var _0x5e81a6=0x0,_0x95550a=events[_0x6c57('0x6')];_0x5e81a6<_0x95550a;_0x5e81a6++){var _0x599efc=events[_0x5e81a6];var _0x1b707a=createListener('mailMessage:'+_0x599efc,_0xa6e0c4);MailMessageEvents['on'](_0x599efc,_0x1b707a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index eccd929..281e1cb 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 _0x7af8=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams','exports','multer'];(function(_0x406619,_0x27f152){var _0x2ade5a=function(_0x2c9fe4){while(--_0x2c9fe4){_0x406619['push'](_0x406619['shift']());}};_0x2ade5a(++_0x27f152);}(_0x7af8,0x1e5));var _0x87af=function(_0x3e9041,_0x58ab0e){_0x3e9041=_0x3e9041-0x0;var _0xf111fe=_0x7af8[_0x3e9041];return _0xf111fe;};'use strict';var multer=require(_0x87af('0x0'));var util=require(_0x87af('0x1'));var path=require(_0x87af('0x2'));var timeout=require(_0x87af('0x3'));var express=require('express');var router=express[_0x87af('0x4')]();var fs_extra=require(_0x87af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x87af('0x6'));var config=require('../../config/environment');var controller=require(_0x87af('0x7'));router[_0x87af('0x8')]('/',auth[_0x87af('0x9')](),controller[_0x87af('0xa')]);router[_0x87af('0x8')](_0x87af('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x87af('0x8')](_0x87af('0xc'),auth[_0x87af('0x9')](),controller[_0x87af('0xd')]);router['get'](_0x87af('0xe'),auth[_0x87af('0x9')](),controller['getMembers']);router[_0x87af('0x8')](_0x87af('0xf'),auth[_0x87af('0x9')](),controller[_0x87af('0x10')]);router[_0x87af('0x8')](_0x87af('0x11'),auth[_0x87af('0x9')](),controller[_0x87af('0x12')]);router[_0x87af('0x13')]('/',auth[_0x87af('0x9')](),controller[_0x87af('0x14')]);router[_0x87af('0x13')](_0x87af('0xf'),auth[_0x87af('0x9')](),controller[_0x87af('0x15')]);router['post'](_0x87af('0x11'),auth[_0x87af('0x9')](),controller['addAgents']);router[_0x87af('0x16')](_0x87af('0xc'),auth['isAuthenticated'](),controller[_0x87af('0x17')]);router['delete'](_0x87af('0xc'),auth[_0x87af('0x9')](),controller['destroy']);router[_0x87af('0x18')](_0x87af('0xf'),auth[_0x87af('0x9')](),controller[_0x87af('0x19')]);router['delete'](_0x87af('0x11'),auth[_0x87af('0x9')](),controller['removeAgents']);module[_0x87af('0x1a')]=router; \ No newline at end of file +var _0x19dd=['addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x19dd,0x1c8));var _0xd19d=function(_0xd102f1,_0x9d4084){_0xd102f1=_0xd102f1-0x0;var _0x556d0e=_0x19dd[_0xd102f1];return _0x556d0e;};'use strict';var multer=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var path=require(_0xd19d('0x2'));var timeout=require(_0xd19d('0x3'));var express=require(_0xd19d('0x4'));var router=express[_0xd19d('0x5')]();var fs_extra=require(_0xd19d('0x6'));var auth=require(_0xd19d('0x7'));var interaction=require(_0xd19d('0x8'));var config=require(_0xd19d('0x9'));var controller=require(_0xd19d('0xa'));router[_0xd19d('0xb')]('/',auth[_0xd19d('0xc')](),controller[_0xd19d('0xd')]);router[_0xd19d('0xb')](_0xd19d('0xe'),auth[_0xd19d('0xc')](),controller['describe']);router[_0xd19d('0xb')](_0xd19d('0xf'),auth[_0xd19d('0xc')](),controller['show']);router[_0xd19d('0xb')](_0xd19d('0x10'),auth['isAuthenticated'](),controller[_0xd19d('0x11')]);router[_0xd19d('0xb')](_0xd19d('0x12'),auth[_0xd19d('0xc')](),controller[_0xd19d('0x13')]);router[_0xd19d('0xb')](_0xd19d('0x14'),auth[_0xd19d('0xc')](),controller['getAgents']);router[_0xd19d('0x15')]('/',auth[_0xd19d('0xc')](),controller[_0xd19d('0x16')]);router[_0xd19d('0x15')](_0xd19d('0x12'),auth['isAuthenticated'](),controller[_0xd19d('0x17')]);router[_0xd19d('0x15')](_0xd19d('0x14'),auth[_0xd19d('0xc')](),controller[_0xd19d('0x18')]);router[_0xd19d('0x19')]('/:id',auth[_0xd19d('0xc')](),controller[_0xd19d('0x1a')]);router['delete'](_0xd19d('0xf'),auth[_0xd19d('0xc')](),controller[_0xd19d('0x1b')]);router['delete'](_0xd19d('0x12'),auth[_0xd19d('0xc')](),controller[_0xd19d('0x1c')]);router[_0xd19d('0x1d')](_0xd19d('0x14'),auth[_0xd19d('0xc')](),controller[_0xd19d('0x1e')]);module[_0xd19d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e6cd189..cf1661b 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 _0x78ec=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x452c55,_0x1e27d7){var _0x40fc41=function(_0x304ecb){while(--_0x304ecb){_0x452c55['push'](_0x452c55['shift']());}};_0x40fc41(++_0x1e27d7);}(_0x78ec,0x11e));var _0xc78e=function(_0x260415,_0x28508b){_0x260415=_0x260415-0x0;var _0x5ea645=_0x78ec[_0x260415];return _0x5ea645;};'use strict';var Sequelize=require(_0xc78e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc78e('0x1')],'unique':_0xc78e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc78e('0x1')]},'timeout':{'type':Sequelize[_0xc78e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc78e('0x4')](_0xc78e('0x5'),_0xc78e('0x6'),_0xc78e('0x7'))}}; \ No newline at end of file +var _0x9d56=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0xb3c46e,_0x5c15f0){var _0x43ad16=function(_0x865238){while(--_0x865238){_0xb3c46e['push'](_0xb3c46e['shift']());}};_0x43ad16(++_0x5c15f0);}(_0x9d56,0x77));var _0x69d5=function(_0x38f97b,_0x2ef47e){_0x38f97b=_0x38f97b-0x0;var _0x14753c=_0x9d56[_0x38f97b];return _0x14753c;};'use strict';var Sequelize=require(_0x69d5('0x0'));module[_0x69d5('0x1')]={'name':{'type':Sequelize[_0x69d5('0x2')],'unique':_0x69d5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x69d5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x69d5('0x5')](_0x69d5('0x6'),_0x69d5('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4c5974d..60619ae 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 _0x7b05=['omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./mailQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','MailQueues','sendStatus','stack','send','MailQueue','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','name','merge','options','includeAll','include','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','pick','findAll','User','findAndCountAll','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','emit','userMailQueue:remove','addAgents'];(function(_0x223c26,_0x53099c){var _0x17a8b8=function(_0xecfcaa){while(--_0xecfcaa){_0x223c26['push'](_0x223c26['shift']());}};_0x17a8b8(++_0x53099c);}(_0x7b05,0x91));var _0x57b0=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x7b05[_0x46b22a];return _0x44c2e8;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];config[_0x57b0('0x15')]=_[_0x57b0('0x16')](config[_0x57b0('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57b0('0x15')]));require(_0x57b0('0x17'))[_0x57b0('0x18')](socket);function respondWithStatusCode(_0x3b48a3,_0x564b15){_0x564b15=_0x564b15||0xcc;return function(_0x3dca2d){if(_0x3dca2d){return _0x3b48a3['sendStatus'](_0x564b15);}return _0x3b48a3[_0x57b0('0x19')](_0x564b15)[_0x57b0('0x1a')]();};}function respondWithResult(_0x55fd9c,_0x1ad3c9){_0x1ad3c9=_0x1ad3c9||0xc8;return function(_0x3dfc35){if(_0x3dfc35){return _0x55fd9c[_0x57b0('0x19')](_0x1ad3c9)[_0x57b0('0x1b')](_0x3dfc35);}};}function respondWithFilteredResult(_0x3eb198,_0x545c29){return function(_0x37bd5d){if(_0x37bd5d){var _0x4ac304=typeof _0x545c29['offset']===_0x57b0('0x1c')&&typeof _0x545c29[_0x57b0('0x1d')]===_0x57b0('0x1c');var _0x3e14f5=_0x37bd5d[_0x57b0('0x1e')];var _0x28af98=_0x4ac304?0x0:_0x545c29['offset'];var _0x19fafd=_0x4ac304?_0x37bd5d[_0x57b0('0x1e')]:_0x545c29[_0x57b0('0x1f')]+_0x545c29['limit'];var _0x12f2f6;if(_0x19fafd>=_0x3e14f5){_0x19fafd=_0x3e14f5;_0x12f2f6=0xc8;}else{_0x12f2f6=0xce;}_0x3eb198[_0x57b0('0x19')](_0x12f2f6);return _0x3eb198[_0x57b0('0x20')](_0x57b0('0x21'),_0x28af98+'-'+_0x19fafd+'/'+_0x3e14f5)[_0x57b0('0x1b')](_0x37bd5d);}return null;};}function patchUpdates(_0x22b11e){return function(_0x29cf6f){try{jsonpatch[_0x57b0('0x22')](_0x29cf6f,_0x22b11e,!![]);}catch(_0x3497e4){return BPromise['reject'](_0x3497e4);}return _0x29cf6f['save']();};}function saveUpdates(_0x40c279,_0x59bdb8){return function(_0x1f16a8){if(_0x1f16a8){return _0x1f16a8[_0x57b0('0x23')](_0x40c279)[_0x57b0('0x24')](function(_0x38e3a0){return _0x38e3a0;});}return null;};}function removeEntity(_0x3e75e8,_0xbf54ac){return function(_0x1cf6ed){if(_0x1cf6ed){return _0x1cf6ed[_0x57b0('0x25')]()[_0x57b0('0x24')](function(){var _0x109678=_0x1cf6ed[_0x57b0('0x26')]({'plain':!![]});var _0x43b90f=_0x57b0('0x27');return db['UserProfileResource'][_0x57b0('0x25')]({'where':{'type':_0x43b90f,'resourceId':_0x109678['id']}})[_0x57b0('0x24')](function(){return _0x1cf6ed;});})[_0x57b0('0x24')](function(){_0x3e75e8[_0x57b0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552f3e,_0x325e39){return function(_0x3aaf57){if(!_0x3aaf57){_0x552f3e[_0x57b0('0x28')](0x194);}return _0x3aaf57;};}function handleError(_0x5958a8,_0x52d2bc){_0x52d2bc=_0x52d2bc||0x1f4;return function(_0x9d9195){logger['error'](_0x9d9195[_0x57b0('0x29')]);if(_0x9d9195['name']){delete _0x9d9195['name'];}_0x5958a8[_0x57b0('0x19')](_0x52d2bc)[_0x57b0('0x2a')](_0x9d9195);};}exports['index']=function(_0x17ac64,_0x32e03e){var _0x55ca86={},_0x16d6e1={},_0xc7ed11={'count':0x0,'rows':[]};var _0x36526a=_['map'](db[_0x57b0('0x2b')][_0x57b0('0x2c')],function(_0x46ccd7){return{'name':_0x46ccd7[_0x57b0('0x2d')],'type':_0x46ccd7[_0x57b0('0x2e')]['key']};});_0x16d6e1['model']=_['map'](_0x36526a,'name');_0x16d6e1[_0x57b0('0x2f')]=_[_0x57b0('0x30')](_0x17ac64[_0x57b0('0x2f')]);_0x16d6e1[_0x57b0('0x31')]=_[_0x57b0('0x32')](_0x16d6e1['model'],_0x16d6e1[_0x57b0('0x2f')]);_0x55ca86[_0x57b0('0x33')]=_[_0x57b0('0x32')](_0x16d6e1[_0x57b0('0x34')],qs['fields'](_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x35')]));_0x55ca86['attributes']=_0x55ca86[_0x57b0('0x33')][_0x57b0('0x36')]?_0x55ca86['attributes']:_0x16d6e1['model'];if(!_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x37')](_0x57b0('0x38'))){_0x55ca86[_0x57b0('0x1d')]=qs[_0x57b0('0x1d')](_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x1d')]);_0x55ca86[_0x57b0('0x1f')]=qs[_0x57b0('0x1f')](_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x1f')]);}_0x55ca86[_0x57b0('0x39')]=qs['sort'](_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x3a')]);_0x55ca86[_0x57b0('0x3b')]=qs['filters'](_['pick'](_0x17ac64['query'],_0x16d6e1[_0x57b0('0x31')]),_0x36526a);if(_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x3c')]){_0x55ca86[_0x57b0('0x3b')]=_['merge'](_0x55ca86[_0x57b0('0x3b')],{'$or':_[_0x57b0('0x3d')](_0x36526a,function(_0x5e1e9d){if(_0x5e1e9d[_0x57b0('0x2e')]!==_0x57b0('0x3e')){var _0x47241f={};_0x47241f[_0x5e1e9d[_0x57b0('0x3f')]]={'$like':'%'+_0x17ac64[_0x57b0('0x2f')]['filter']+'%'};return _0x47241f;}})});}_0x55ca86=_[_0x57b0('0x40')]({},_0x55ca86,_0x17ac64[_0x57b0('0x41')]);var _0xbf870b={'where':_0x55ca86[_0x57b0('0x3b')]};return db['MailQueue']['count'](_0xbf870b)[_0x57b0('0x24')](function(_0x344bc6){_0xc7ed11['count']=_0x344bc6;if(_0x17ac64[_0x57b0('0x2f')][_0x57b0('0x42')]){_0x55ca86[_0x57b0('0x43')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x55ca86);})[_0x57b0('0x24')](function(_0x3f3b1c){_0xc7ed11[_0x57b0('0x44')]=_0x3f3b1c;return _0xc7ed11;})[_0x57b0('0x24')](respondWithFilteredResult(_0x32e03e,_0x55ca86))[_0x57b0('0x45')](handleError(_0x32e03e,null));};exports['show']=function(_0x116acf,_0x188b7d){var _0x173220={'raw':!![],'where':{'id':_0x116acf[_0x57b0('0x46')]['id']}},_0x308c08={};_0x308c08['model']=_['keys'](db['MailQueue']['rawAttributes']);_0x308c08[_0x57b0('0x2f')]=_[_0x57b0('0x30')](_0x116acf[_0x57b0('0x2f')]);_0x308c08[_0x57b0('0x31')]=_[_0x57b0('0x32')](_0x308c08[_0x57b0('0x34')],_0x308c08[_0x57b0('0x2f')]);_0x173220['attributes']=_[_0x57b0('0x32')](_0x308c08[_0x57b0('0x34')],qs[_0x57b0('0x35')](_0x116acf[_0x57b0('0x2f')][_0x57b0('0x35')]));_0x173220[_0x57b0('0x33')]=_0x173220[_0x57b0('0x33')]['length']?_0x173220[_0x57b0('0x33')]:_0x308c08['model'];if(_0x116acf[_0x57b0('0x2f')]['includeAll']){_0x173220[_0x57b0('0x43')]=[{'all':!![]}];}_0x173220=_['merge']({},_0x173220,_0x116acf[_0x57b0('0x41')]);return db[_0x57b0('0x2b')]['find'](_0x173220)[_0x57b0('0x24')](handleEntityNotFound(_0x188b7d,null))[_0x57b0('0x24')](respondWithResult(_0x188b7d,null))[_0x57b0('0x45')](handleError(_0x188b7d,null));};exports['create']=function(_0x2111e9,_0xb8f21){return db['MailQueue'][_0x57b0('0x47')](_0x2111e9[_0x57b0('0x48')],{})['then'](function(_0x467731){var _0x35ed98=_0x2111e9[_0x57b0('0x49')][_0x57b0('0x26')]({'plain':!![]});if(!_0x35ed98)throw new Error(_0x57b0('0x4a'));if(_0x35ed98['role']==='user'){var _0x3696b5=_0x467731[_0x57b0('0x26')]({'plain':!![]});var _0x22f0ae='MailQueues';return db[_0x57b0('0x4b')][_0x57b0('0x4c')]({'where':{'name':_0x22f0ae,'userProfileId':_0x35ed98[_0x57b0('0x4d')]},'raw':!![]})[_0x57b0('0x24')](function(_0xe3c067){if(_0xe3c067&&_0xe3c067[_0x57b0('0x4e')]===0x0){return db[_0x57b0('0x4f')][_0x57b0('0x47')]({'name':_0x3696b5[_0x57b0('0x3f')],'resourceId':_0x3696b5['id'],'type':_0xe3c067[_0x57b0('0x3f')],'sectionId':_0xe3c067['id']},{})[_0x57b0('0x24')](function(){return _0x467731;});}else{return _0x467731;}})[_0x57b0('0x45')](function(_0xe5499f){logger[_0x57b0('0x50')](_0x57b0('0x51'),_0xe5499f);throw _0xe5499f;});}return _0x467731;})[_0x57b0('0x24')](respondWithResult(_0xb8f21,0xc9))[_0x57b0('0x45')](handleError(_0xb8f21,null));};exports[_0x57b0('0x23')]=function(_0x50c4eb,_0x41f57d){if(_0x50c4eb[_0x57b0('0x48')]['id']){delete _0x50c4eb[_0x57b0('0x48')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x50c4eb[_0x57b0('0x46')]['id']}})['then'](handleEntityNotFound(_0x41f57d,null))['then'](saveUpdates(_0x50c4eb[_0x57b0('0x48')],null))['then'](respondWithResult(_0x41f57d,null))[_0x57b0('0x45')](handleError(_0x41f57d,null));};exports['destroy']=function(_0x1ee98e,_0xa97db6){return db['MailQueue']['find']({'where':{'id':_0x1ee98e[_0x57b0('0x46')]['id']}})[_0x57b0('0x24')](handleEntityNotFound(_0xa97db6,null))['then'](removeEntity(_0xa97db6,null))[_0x57b0('0x45')](handleError(_0xa97db6,null));};exports[_0x57b0('0x52')]=function(_0x1740f5,_0x3f490f){return db['MailQueue'][_0x57b0('0x52')]()[_0x57b0('0x24')](respondWithResult(_0x3f490f,null))['catch'](handleError(_0x3f490f,null));};exports[_0x57b0('0x53')]=function(_0x1d87b1,_0x14f22f,_0x49675d){var _0x1f1fb6={'raw':!![],'where':{}},_0x18655b={},_0x358ded;return db['MailQueue']['findOne']({'where':{'id':_0x1d87b1[_0x57b0('0x46')]['id']}})['then'](handleEntityNotFound(_0x14f22f,null))[_0x57b0('0x24')](function(_0x539568){if(_0x539568){_0x358ded=_0x539568[_0x57b0('0x26')]({'plain':!![]});_0x18655b['model']=_['keys'](db[_0x57b0('0x54')][_0x57b0('0x2c')]);_0x18655b['query']=_['keys'](_0x1d87b1['query']);_0x18655b[_0x57b0('0x31')]=_[_0x57b0('0x32')](_0x18655b[_0x57b0('0x34')],_0x18655b[_0x57b0('0x2f')]);_0x1f1fb6['attributes']=_['intersection'](_0x18655b[_0x57b0('0x34')],qs[_0x57b0('0x35')](_0x1d87b1[_0x57b0('0x2f')][_0x57b0('0x35')]));_0x1f1fb6[_0x57b0('0x33')]=_0x1f1fb6[_0x57b0('0x33')]['length']?_0x1f1fb6[_0x57b0('0x33')]:_0x18655b[_0x57b0('0x34')];if(!_0x1d87b1[_0x57b0('0x2f')][_0x57b0('0x37')](_0x57b0('0x38'))){_0x1f1fb6['limit']=qs[_0x57b0('0x1d')](_0x1d87b1[_0x57b0('0x2f')][_0x57b0('0x1d')]);_0x1f1fb6[_0x57b0('0x1f')]=qs[_0x57b0('0x1f')](_0x1d87b1[_0x57b0('0x2f')]['offset']);}_0x1f1fb6['order']=qs['sort'](_0x1d87b1[_0x57b0('0x2f')][_0x57b0('0x3a')]);_0x1f1fb6['where']=qs[_0x57b0('0x31')](_[_0x57b0('0x55')](_0x1d87b1[_0x57b0('0x2f')],_0x18655b[_0x57b0('0x31')]));_0x1f1fb6['where']['MailQueueId']=_0x539568['id'];if(_0x1d87b1['query'][_0x57b0('0x3c')]){_0x1f1fb6[_0x57b0('0x3b')]=_[_0x57b0('0x40')](_0x1f1fb6['where'],{'$or':_[_0x57b0('0x3d')](_0x1f1fb6['attributes'],function(_0x59b874){var _0x5aa44b={};_0x5aa44b[_0x59b874]={'$like':'%'+_0x1d87b1[_0x57b0('0x2f')]['filter']+'%'};return _0x5aa44b;})});}_0x1f1fb6=_[_0x57b0('0x40')]({},_0x1f1fb6,_0x1d87b1[_0x57b0('0x41')]);return db[_0x57b0('0x54')][_0x57b0('0x56')](_0x1f1fb6);}})[_0x57b0('0x24')](function(_0x2ac799){if(_0x2ac799){return db[_0x57b0('0x57')][_0x57b0('0x58')]({'where':{'id':_[_0x57b0('0x3d')](_0x2ac799,'UserId'),'role':_0x57b0('0x59')},'attributes':['id',_0x57b0('0x3f'),_0x57b0('0x5a'),'updatedAt',_0x57b0('0x5b')]});}})[_0x57b0('0x24')](function(_0x2081d9){if(_0x2081d9){return{'count':_0x2081d9[_0x57b0('0x1e')],'rows':_[_0x57b0('0x3d')](_0x2081d9['rows'],function(_0x53164f){return{'membername':_0x53164f[_0x57b0('0x3f')],'UserId':_0x53164f['id'],'queue_name':_0x358ded[_0x57b0('0x3f')],'MailQueueId':_0x358ded['id'],'interface':util['format'](_0x57b0('0x5c'),_0x57b0('0x5d'),_0x53164f[_0x57b0('0x3f')]),'penalty':0x0,'paused':_0x53164f['mailPause'],'createdAt':_0x53164f['createdAt'],'updatedAt':_0x53164f[_0x57b0('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14f22f,_0x1f1fb6))[_0x57b0('0x45')](handleError(_0x14f22f,null));};exports[_0x57b0('0x5f')]=function(_0x371cd3,_0x199877,_0x32f519){var _0x44fa33={};var _0x247e35={};var _0x2d0bf4;var _0x5a8c41;return db[_0x57b0('0x2b')][_0x57b0('0x60')]({'where':{'id':_0x371cd3[_0x57b0('0x46')]['id']}})[_0x57b0('0x24')](handleEntityNotFound(_0x199877,null))['then'](function(_0x3e55f6){if(_0x3e55f6){_0x2d0bf4=_0x3e55f6;_0x247e35[_0x57b0('0x34')]=_['keys'](db[_0x57b0('0x61')][_0x57b0('0x2c')]);_0x247e35[_0x57b0('0x2f')]=_[_0x57b0('0x30')](_0x371cd3['query']);_0x247e35['filters']=_[_0x57b0('0x32')](_0x247e35[_0x57b0('0x34')],_0x247e35[_0x57b0('0x2f')]);_0x44fa33[_0x57b0('0x33')]=_[_0x57b0('0x32')](_0x247e35[_0x57b0('0x34')],qs[_0x57b0('0x35')](_0x371cd3[_0x57b0('0x2f')][_0x57b0('0x35')]));_0x44fa33[_0x57b0('0x33')]=_0x44fa33[_0x57b0('0x33')][_0x57b0('0x36')]?_0x44fa33['attributes']:_0x247e35[_0x57b0('0x34')];_0x44fa33['order']=qs[_0x57b0('0x3a')](_0x371cd3[_0x57b0('0x2f')][_0x57b0('0x3a')]);_0x44fa33[_0x57b0('0x3b')]=qs[_0x57b0('0x31')](_[_0x57b0('0x55')](_0x371cd3[_0x57b0('0x2f')],_0x247e35[_0x57b0('0x31')]));if(_0x371cd3['query'][_0x57b0('0x3c')]){_0x44fa33[_0x57b0('0x3b')]=_[_0x57b0('0x40')](_0x44fa33[_0x57b0('0x3b')],{'$or':_['map'](_0x44fa33[_0x57b0('0x33')],function(_0x55f024){var _0x35db52={};_0x35db52[_0x55f024]={'$like':'%'+_0x371cd3[_0x57b0('0x2f')]['filter']+'%'};return _0x35db52;})});}_0x44fa33=_[_0x57b0('0x40')]({},_0x44fa33,_0x371cd3['options']);return _0x2d0bf4['getTeams'](_0x44fa33);}})[_0x57b0('0x24')](function(_0x4fcfad){if(_0x4fcfad){_0x5a8c41=_0x4fcfad['length'];if(!_0x371cd3[_0x57b0('0x2f')][_0x57b0('0x37')](_0x57b0('0x38'))){_0x44fa33['limit']=qs['limit'](_0x371cd3[_0x57b0('0x2f')][_0x57b0('0x1d')]);_0x44fa33[_0x57b0('0x1f')]=qs[_0x57b0('0x1f')](_0x371cd3[_0x57b0('0x2f')][_0x57b0('0x1f')]);}return _0x2d0bf4[_0x57b0('0x5f')](_0x44fa33);}})['then'](function(_0x59bd57){if(_0x59bd57){return _0x59bd57?{'count':_0x5a8c41,'rows':_0x59bd57}:null;}})['then'](respondWithResult(_0x199877,null))['catch'](handleError(_0x199877,null));};exports[_0x57b0('0x62')]=function(_0x3c5008,_0x2e7ad6,_0x20cf7f){var _0x555095=_0x3c5008[_0x57b0('0x48')][_0x57b0('0x63')];return db[_0x57b0('0x61')]['findAll']({'where':{'id':_0x555095},'attributes':['id'],'include':[{'model':db['User'],'as':_0x57b0('0x64'),'attributes':['id','name','online',_0x57b0('0x65'),_0x57b0('0x66')],'raw':!![]}]})[_0x57b0('0x24')](function(_0x1abc06){if(_0x1abc06){var _0x274b34=_[_0x57b0('0x67')](_0x1abc06,function(_0x53e897){var _0x327164=_0x53e897[_0x57b0('0x26')]({'plain':!![]});return _0x327164['Agents'];});return db['MailQueue'][_0x57b0('0x4c')]({'where':{'id':_0x3c5008[_0x57b0('0x46')]['id']}})[_0x57b0('0x24')](function(_0x813b4c){return db[_0x57b0('0x68')][_0x57b0('0x69')](function(_0x13e054){return _0x813b4c[_0x57b0('0x62')](_0x555095,{'transaction':_0x13e054})[_0x57b0('0x24')](function(){return BPromise[_0x57b0('0x6a')](_0x274b34,function(_0x3e546){return db[_0x57b0('0x54')][_0x57b0('0x6b')]({'where':{'UserId':_0x3e546['id'],'MailQueueId':_0x3c5008['params']['id']},'transaction':_0x13e054});});})[_0x57b0('0x24')](function(){_0x274b34[_0x57b0('0x6c')](function(_0x4e15da){socket['emit'](_0x57b0('0x6d'),{'UserId':_0x4e15da['id'],'MailQueueId':_0x813b4c['id']});});});});});}})[_0x57b0('0x24')](respondWithStatusCode(_0x2e7ad6,null))[_0x57b0('0x45')](handleError(_0x2e7ad6,null));};exports[_0x57b0('0x6e')]=function(_0x3e52ce,_0x552ac3,_0x5935fa){return db[_0x57b0('0x61')][_0x57b0('0x56')]({'where':{'id':_0x3e52ce[_0x57b0('0x2f')][_0x57b0('0x63')]},'attributes':['id'],'include':[{'model':db[_0x57b0('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x57b0('0x24')](handleEntityNotFound(_0x552ac3,null))[_0x57b0('0x24')](function(_0x8ef4d6){var _0x4d5d64=_['map'](_0x8ef4d6,'id');var _0x5a7248=[];var _0x50d662=[];var _0x4e7fb3=squel[_0x57b0('0x6f')]();_0x4e7fb3[_0x57b0('0x70')]('tq.TeamId')[_0x57b0('0x71')](_0x57b0('0x72'),'tq')[_0x57b0('0x73')](_0x57b0('0x74'),'ut',_0x57b0('0x75'))['where'](_0x57b0('0x76'),_0x3e52ce[_0x57b0('0x46')]['id']);for(var _0x1ae887=0x0;_0x1ae887<_0x8ef4d6[_0x57b0('0x36')];_0x1ae887+=0x1){let _0x475a06=_0x8ef4d6[_0x1ae887];for(var _0x39cfc4=0x0;_0x39cfc4<_0x475a06[_0x57b0('0x64')]['length'];_0x39cfc4+=0x1){let _0x595e88=_0x475a06['Agents'][_0x39cfc4];var _0x562e8d=_0x4e7fb3[_0x57b0('0x77')]();_0x562e8d['where'](_0x57b0('0x78'),_0x595e88['id']);_0x50d662[_0x57b0('0x79')](db[_0x57b0('0x68')][_0x57b0('0x2f')](_0x562e8d[_0x57b0('0x7a')](),{'type':db['sequelize'][_0x57b0('0x7b')][_0x57b0('0x7c')]})[_0x57b0('0x24')](function(_0x3034f1){if(_0x3034f1[_0x57b0('0x36')]===0x1){return _0x595e88['id'];}else{var _0x21ce86=_[_0x57b0('0x7d')](_[_0x57b0('0x3d')](_0x3034f1,_0x57b0('0x7e')),function(_0x3cbaf1){return _[_0x57b0('0x7f')](_0x4d5d64,_0x3cbaf1);});if(_0x21ce86){return _0x595e88['id'];}}}));}}return BPromise['all'](_0x50d662)[_0x57b0('0x24')](function(_0x5c7d19){_0x5a7248=_(_0x5a7248)[_0x57b0('0x80')](_0x5c7d19)[_0x57b0('0x81')]()[_0x57b0('0x82')]();return db[_0x57b0('0x2b')][_0x57b0('0x4c')]({'where':{'id':_0x3e52ce['params']['id']}})[_0x57b0('0x24')](function(_0x2ade6d){return db[_0x57b0('0x68')]['transaction'](function(_0x70efe0){return _0x2ade6d[_0x57b0('0x6e')](_0x3e52ce['query'][_0x57b0('0x63')],{'transaction':_0x70efe0})[_0x57b0('0x24')](function(){if(!_[_0x57b0('0x83')](_0x5a7248)){return _0x2ade6d['removeAgents'](_0x5a7248,{'transaction':_0x70efe0});}})[_0x57b0('0x24')](function(){_0x5a7248[_0x57b0('0x6c')](function(_0x2e523f){socket[_0x57b0('0x84')](_0x57b0('0x85'),{'UserId':_0x2e523f,'MailQueueId':_0x2ade6d['id']});});});});});});})[_0x57b0('0x24')](respondWithStatusCode(_0x552ac3,null))[_0x57b0('0x45')](handleError(_0x552ac3,null));};exports[_0x57b0('0x86')]=function(_0x1ef61e,_0x5701a8,_0x4fc398){return db[_0x57b0('0x2b')]['find']({'where':{'id':_0x1ef61e[_0x57b0('0x46')]['id']}})[_0x57b0('0x24')](handleEntityNotFound(_0x5701a8,null))['then'](function(_0x3c50d8){if(_0x3c50d8){return _0x3c50d8['addAgents'](_0x1ef61e[_0x57b0('0x48')][_0x57b0('0x63')],_[_0x57b0('0x87')](_0x1ef61e[_0x57b0('0x48')],[_0x57b0('0x63'),'id'])||{})[_0x57b0('0x88')](function(_0x226fc8){for(var _0xacfee9=0x0;_0xacfee9<_0x1ef61e[_0x57b0('0x48')][_0x57b0('0x63')][_0x57b0('0x36')];_0xacfee9+=0x1){socket[_0x57b0('0x84')](_0x57b0('0x6d'),{'UserId':Number(_0x1ef61e[_0x57b0('0x48')][_0x57b0('0x63')][_0xacfee9]),'MailQueueId':Number(_0x1ef61e[_0x57b0('0x46')]['id'])});}return _0x226fc8;});}})['then'](respondWithResult(_0x5701a8,null))['catch'](handleError(_0x5701a8,null));};exports['removeAgents']=function(_0xb69a32,_0x164dd1,_0x4138eb){return db['MailQueue']['find']({'where':{'id':_0xb69a32['params']['id']}})[_0x57b0('0x24')](handleEntityNotFound(_0x164dd1,null))[_0x57b0('0x24')](function(_0xb8e12d){if(_0xb8e12d){return _0xb8e12d[_0x57b0('0x89')](_0xb69a32[_0x57b0('0x2f')][_0x57b0('0x63')])[_0x57b0('0x24')](function(){if(_[_0x57b0('0x8a')](_0xb69a32[_0x57b0('0x2f')]['ids'])){for(var _0x246cf3=0x0;_0x246cf3<_0xb69a32[_0x57b0('0x2f')][_0x57b0('0x63')][_0x57b0('0x36')];_0x246cf3+=0x1){socket[_0x57b0('0x84')]('userMailQueue:remove',{'UserId':Number(_0xb69a32[_0x57b0('0x2f')][_0x57b0('0x63')][_0x246cf3]),'MailQueueId':Number(_0xb69a32[_0x57b0('0x46')]['id'])});}}else{socket[_0x57b0('0x84')](_0x57b0('0x85'),{'UserId':Number(_0xb69a32[_0x57b0('0x2f')]['ids']),'MailQueueId':Number(_0xb69a32[_0x57b0('0x46')]['id'])});}});}})[_0x57b0('0x24')](respondWithStatusCode(_0x164dd1,null))[_0x57b0('0x45')](handleError(_0x164dd1,null));};exports[_0x57b0('0x8b')]=function(_0x3d31d7,_0x1049d7,_0x497d4e){var _0x12cac0={};var _0xdd63dc={};var _0x5014e2;var _0x4f7da0;return db[_0x57b0('0x2b')]['findOne']({'where':{'id':_0x3d31d7['params']['id']}})[_0x57b0('0x24')](handleEntityNotFound(_0x1049d7,null))['then'](function(_0x148898){if(_0x148898){_0x5014e2=_0x148898;_0xdd63dc[_0x57b0('0x34')]=_[_0x57b0('0x30')](db[_0x57b0('0x57')][_0x57b0('0x2c')]);_0xdd63dc[_0x57b0('0x2f')]=_[_0x57b0('0x30')](_0x3d31d7[_0x57b0('0x2f')]);_0xdd63dc[_0x57b0('0x31')]=_['intersection'](_0xdd63dc[_0x57b0('0x34')],_0xdd63dc[_0x57b0('0x2f')]);_0x12cac0[_0x57b0('0x33')]=_[_0x57b0('0x32')](_0xdd63dc['model'],qs[_0x57b0('0x35')](_0x3d31d7[_0x57b0('0x2f')][_0x57b0('0x35')]));_0x12cac0[_0x57b0('0x33')]=_0x12cac0[_0x57b0('0x33')][_0x57b0('0x36')]?_0x12cac0[_0x57b0('0x33')]:_0xdd63dc[_0x57b0('0x34')];_0x12cac0[_0x57b0('0x39')]=qs[_0x57b0('0x3a')](_0x3d31d7[_0x57b0('0x2f')][_0x57b0('0x3a')]);_0x12cac0[_0x57b0('0x3b')]=qs['filters'](_['pick'](_0x3d31d7[_0x57b0('0x2f')],_0xdd63dc[_0x57b0('0x31')]));if(_0x3d31d7['query'][_0x57b0('0x3c')]){_0x12cac0['where']=_[_0x57b0('0x40')](_0x12cac0[_0x57b0('0x3b')],{'$or':_['map'](_0x12cac0[_0x57b0('0x33')],function(_0x3242ea){var _0x575d60={};_0x575d60[_0x3242ea]={'$like':'%'+_0x3d31d7[_0x57b0('0x2f')]['filter']+'%'};return _0x575d60;})});}_0x12cac0=_[_0x57b0('0x40')]({},_0x12cac0,_0x3d31d7[_0x57b0('0x41')]);return _0x5014e2[_0x57b0('0x8b')](_0x12cac0);}})[_0x57b0('0x24')](function(_0x48e8fd){if(_0x48e8fd){_0x4f7da0=_0x48e8fd[_0x57b0('0x36')];if(!_0x3d31d7[_0x57b0('0x2f')]['hasOwnProperty'](_0x57b0('0x38'))){_0x12cac0[_0x57b0('0x1d')]=qs[_0x57b0('0x1d')](_0x3d31d7['query'][_0x57b0('0x1d')]);_0x12cac0[_0x57b0('0x1f')]=qs[_0x57b0('0x1f')](_0x3d31d7[_0x57b0('0x2f')]['offset']);}return _0x5014e2[_0x57b0('0x8b')](_0x12cac0);}})[_0x57b0('0x24')](function(_0x5a8353){if(_0x5a8353){return _0x5a8353?{'count':_0x4f7da0,'rows':_0x5a8353}:null;}})[_0x57b0('0x24')](respondWithResult(_0x1049d7,null))[_0x57b0('0x45')](handleError(_0x1049d7,null));}; \ No newline at end of file +var _0xf822=['removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','get','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','compact','value','isEmpty'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf822,0x19e));var _0x2f82=function(_0x151052,_0x174585){_0x151052=_0x151052-0x0;var _0x6c0ea1=_0xf822[_0x151052];return _0x6c0ea1;};'use strict';var emlformat=require(_0x2f82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f82('0x1'));var jsonpatch=require(_0x2f82('0x2'));var rp=require(_0x2f82('0x3'));var moment=require(_0x2f82('0x4'));var BPromise=require(_0x2f82('0x5'));var Mustache=require(_0x2f82('0x6'));var util=require('util');var path=require(_0x2f82('0x7'));var sox=require(_0x2f82('0x8'));var csv=require(_0x2f82('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f82('0xa'));var _=require('lodash');var squel=require(_0x2f82('0xb'));var crypto=require(_0x2f82('0xc'));var jsforce=require(_0x2f82('0xd'));var deskjs=require(_0x2f82('0xe'));var toCsv=require(_0x2f82('0x9'));var querystring=require(_0x2f82('0xf'));var Papa=require('papaparse');var Redis=require(_0x2f82('0x10'));var authService=require(_0x2f82('0x11'));var qs=require(_0x2f82('0x12'));var as=require(_0x2f82('0x13'));var hardwareService=require(_0x2f82('0x14'));var logger=require(_0x2f82('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2f82('0x16'));var licenseUtil=require(_0x2f82('0x17'));var db=require(_0x2f82('0x18'))['db'];config[_0x2f82('0x19')]=_['defaults'](config['redis'],{'host':_0x2f82('0x1a'),'port':0x18eb});var socket=require(_0x2f82('0x1b'))(new Redis(config[_0x2f82('0x19')]));require('./mailQueue.socket')[_0x2f82('0x1c')](socket);function respondWithStatusCode(_0x2df1bf,_0x5bdc8d){_0x5bdc8d=_0x5bdc8d||0xcc;return function(_0x5c846e){if(_0x5c846e){return _0x2df1bf['sendStatus'](_0x5bdc8d);}return _0x2df1bf[_0x2f82('0x1d')](_0x5bdc8d)[_0x2f82('0x1e')]();};}function respondWithResult(_0xe1a92f,_0x3e41ea){_0x3e41ea=_0x3e41ea||0xc8;return function(_0x574fee){if(_0x574fee){return _0xe1a92f[_0x2f82('0x1d')](_0x3e41ea)['json'](_0x574fee);}};}function respondWithFilteredResult(_0x216259,_0x5ec789){return function(_0x2ac8dc){if(_0x2ac8dc){var _0xccbee0=typeof _0x5ec789[_0x2f82('0x1f')]===_0x2f82('0x20')&&typeof _0x5ec789[_0x2f82('0x21')]===_0x2f82('0x20');var _0x47022b=_0x2ac8dc[_0x2f82('0x22')];var _0x5d16b7=_0xccbee0?0x0:_0x5ec789[_0x2f82('0x1f')];var _0x383e52=_0xccbee0?_0x2ac8dc[_0x2f82('0x22')]:_0x5ec789['offset']+_0x5ec789[_0x2f82('0x21')];var _0x2d9d89;if(_0x383e52>=_0x47022b){_0x383e52=_0x47022b;_0x2d9d89=0xc8;}else{_0x2d9d89=0xce;}_0x216259[_0x2f82('0x1d')](_0x2d9d89);return _0x216259[_0x2f82('0x23')](_0x2f82('0x24'),_0x5d16b7+'-'+_0x383e52+'/'+_0x47022b)['json'](_0x2ac8dc);}return null;};}function patchUpdates(_0x3e9b75){return function(_0x339335){try{jsonpatch[_0x2f82('0x25')](_0x339335,_0x3e9b75,!![]);}catch(_0x4a0a2a){return BPromise['reject'](_0x4a0a2a);}return _0x339335['save']();};}function saveUpdates(_0x3f2abc,_0x1bf504){return function(_0x5428ff){if(_0x5428ff){return _0x5428ff['update'](_0x3f2abc)[_0x2f82('0x26')](function(_0x452472){return _0x452472;});}return null;};}function removeEntity(_0x1525ac,_0x46222f){return function(_0x2efdf7){if(_0x2efdf7){return _0x2efdf7['destroy']()['then'](function(){var _0x30efa5=_0x2efdf7['get']({'plain':!![]});var _0x3fd978='MailQueues';return db[_0x2f82('0x27')][_0x2f82('0x28')]({'where':{'type':_0x3fd978,'resourceId':_0x30efa5['id']}})[_0x2f82('0x26')](function(){return _0x2efdf7;});})[_0x2f82('0x26')](function(){_0x1525ac[_0x2f82('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9a03,_0x3f2e84){return function(_0x41c9dd){if(!_0x41c9dd){_0x1f9a03[_0x2f82('0x29')](0x194);}return _0x41c9dd;};}function handleError(_0x101bf4,_0x4033ad){_0x4033ad=_0x4033ad||0x1f4;return function(_0x2213fe){logger[_0x2f82('0x2a')](_0x2213fe[_0x2f82('0x2b')]);if(_0x2213fe['name']){delete _0x2213fe[_0x2f82('0x2c')];}_0x101bf4[_0x2f82('0x1d')](_0x4033ad)[_0x2f82('0x2d')](_0x2213fe);};}exports[_0x2f82('0x2e')]=function(_0x333c6f,_0x248011){var _0x27fc92={},_0x5589b8={},_0x252275={'count':0x0,'rows':[]};var _0x42710c=_[_0x2f82('0x2f')](db[_0x2f82('0x30')][_0x2f82('0x31')],function(_0x21c3d3){return{'name':_0x21c3d3['fieldName'],'type':_0x21c3d3[_0x2f82('0x32')][_0x2f82('0x33')]};});_0x5589b8['model']=_['map'](_0x42710c,_0x2f82('0x2c'));_0x5589b8['query']=_[_0x2f82('0x34')](_0x333c6f[_0x2f82('0x35')]);_0x5589b8[_0x2f82('0x36')]=_['intersection'](_0x5589b8[_0x2f82('0x37')],_0x5589b8[_0x2f82('0x35')]);_0x27fc92[_0x2f82('0x38')]=_['intersection'](_0x5589b8[_0x2f82('0x37')],qs[_0x2f82('0x39')](_0x333c6f['query']['fields']));_0x27fc92[_0x2f82('0x38')]=_0x27fc92['attributes'][_0x2f82('0x3a')]?_0x27fc92['attributes']:_0x5589b8['model'];if(!_0x333c6f[_0x2f82('0x35')][_0x2f82('0x3b')](_0x2f82('0x3c'))){_0x27fc92[_0x2f82('0x21')]=qs[_0x2f82('0x21')](_0x333c6f[_0x2f82('0x35')][_0x2f82('0x21')]);_0x27fc92['offset']=qs['offset'](_0x333c6f[_0x2f82('0x35')][_0x2f82('0x1f')]);}_0x27fc92[_0x2f82('0x3d')]=qs[_0x2f82('0x3e')](_0x333c6f['query'][_0x2f82('0x3e')]);_0x27fc92[_0x2f82('0x3f')]=qs[_0x2f82('0x36')](_[_0x2f82('0x40')](_0x333c6f['query'],_0x5589b8[_0x2f82('0x36')]),_0x42710c);if(_0x333c6f[_0x2f82('0x35')][_0x2f82('0x41')]){_0x27fc92['where']=_[_0x2f82('0x42')](_0x27fc92[_0x2f82('0x3f')],{'$or':_[_0x2f82('0x2f')](_0x42710c,function(_0x9416ba){if(_0x9416ba[_0x2f82('0x32')]!=='VIRTUAL'){var _0x591074={};_0x591074[_0x9416ba['name']]={'$like':'%'+_0x333c6f['query']['filter']+'%'};return _0x591074;}})});}_0x27fc92=_[_0x2f82('0x42')]({},_0x27fc92,_0x333c6f[_0x2f82('0x43')]);var _0x38036b={'where':_0x27fc92[_0x2f82('0x3f')]};return db[_0x2f82('0x30')][_0x2f82('0x22')](_0x38036b)[_0x2f82('0x26')](function(_0x32b927){_0x252275[_0x2f82('0x22')]=_0x32b927;if(_0x333c6f[_0x2f82('0x35')][_0x2f82('0x44')]){_0x27fc92[_0x2f82('0x45')]=[{'all':!![]}];}return db[_0x2f82('0x30')][_0x2f82('0x46')](_0x27fc92);})[_0x2f82('0x26')](function(_0x119c39){_0x252275[_0x2f82('0x47')]=_0x119c39;return _0x252275;})[_0x2f82('0x26')](respondWithFilteredResult(_0x248011,_0x27fc92))[_0x2f82('0x48')](handleError(_0x248011,null));};exports[_0x2f82('0x49')]=function(_0x3d53e7,_0x539582){var _0x45a5ff={'raw':!![],'where':{'id':_0x3d53e7['params']['id']}},_0x42fb27={};_0x42fb27[_0x2f82('0x37')]=_[_0x2f82('0x34')](db['MailQueue'][_0x2f82('0x31')]);_0x42fb27[_0x2f82('0x35')]=_[_0x2f82('0x34')](_0x3d53e7[_0x2f82('0x35')]);_0x42fb27[_0x2f82('0x36')]=_[_0x2f82('0x4a')](_0x42fb27['model'],_0x42fb27[_0x2f82('0x35')]);_0x45a5ff[_0x2f82('0x38')]=_[_0x2f82('0x4a')](_0x42fb27[_0x2f82('0x37')],qs[_0x2f82('0x39')](_0x3d53e7[_0x2f82('0x35')]['fields']));_0x45a5ff[_0x2f82('0x38')]=_0x45a5ff[_0x2f82('0x38')]['length']?_0x45a5ff[_0x2f82('0x38')]:_0x42fb27[_0x2f82('0x37')];if(_0x3d53e7[_0x2f82('0x35')][_0x2f82('0x44')]){_0x45a5ff[_0x2f82('0x45')]=[{'all':!![]}];}_0x45a5ff=_['merge']({},_0x45a5ff,_0x3d53e7[_0x2f82('0x43')]);return db[_0x2f82('0x30')][_0x2f82('0x4b')](_0x45a5ff)[_0x2f82('0x26')](handleEntityNotFound(_0x539582,null))[_0x2f82('0x26')](respondWithResult(_0x539582,null))[_0x2f82('0x48')](handleError(_0x539582,null));};exports[_0x2f82('0x4c')]=function(_0x578b1c,_0xa597f1){return db['MailQueue'][_0x2f82('0x4c')](_0x578b1c[_0x2f82('0x4d')],{})[_0x2f82('0x26')](function(_0x5b5ef5){var _0x310623=_0x578b1c['user'][_0x2f82('0x4e')]({'plain':!![]});if(!_0x310623)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x310623[_0x2f82('0x4f')]===_0x2f82('0x50')){var _0xa12b90=_0x5b5ef5[_0x2f82('0x4e')]({'plain':!![]});var _0x2e6e44='MailQueues';return db['UserProfileSection'][_0x2f82('0x4b')]({'where':{'name':_0x2e6e44,'userProfileId':_0x310623['userProfileId']},'raw':!![]})[_0x2f82('0x26')](function(_0x5036d1){if(_0x5036d1&&_0x5036d1[_0x2f82('0x51')]===0x0){return db[_0x2f82('0x27')]['create']({'name':_0xa12b90[_0x2f82('0x2c')],'resourceId':_0xa12b90['id'],'type':_0x5036d1[_0x2f82('0x2c')],'sectionId':_0x5036d1['id']},{})[_0x2f82('0x26')](function(){return _0x5b5ef5;});}else{return _0x5b5ef5;}})[_0x2f82('0x48')](function(_0x4887e9){logger[_0x2f82('0x2a')](_0x2f82('0x52'),_0x4887e9);throw _0x4887e9;});}return _0x5b5ef5;})[_0x2f82('0x26')](respondWithResult(_0xa597f1,0xc9))[_0x2f82('0x48')](handleError(_0xa597f1,null));};exports['update']=function(_0x51478f,_0x579261){if(_0x51478f['body']['id']){delete _0x51478f[_0x2f82('0x4d')]['id'];}return db[_0x2f82('0x30')]['find']({'where':{'id':_0x51478f[_0x2f82('0x53')]['id']}})['then'](handleEntityNotFound(_0x579261,null))[_0x2f82('0x26')](saveUpdates(_0x51478f[_0x2f82('0x4d')],null))[_0x2f82('0x26')](respondWithResult(_0x579261,null))['catch'](handleError(_0x579261,null));};exports[_0x2f82('0x28')]=function(_0x121bd6,_0x39b566){return db[_0x2f82('0x30')][_0x2f82('0x4b')]({'where':{'id':_0x121bd6['params']['id']}})[_0x2f82('0x26')](handleEntityNotFound(_0x39b566,null))[_0x2f82('0x26')](removeEntity(_0x39b566,null))[_0x2f82('0x48')](handleError(_0x39b566,null));};exports['describe']=function(_0x38c342,_0x320b0a){return db[_0x2f82('0x30')][_0x2f82('0x54')]()[_0x2f82('0x26')](respondWithResult(_0x320b0a,null))[_0x2f82('0x48')](handleError(_0x320b0a,null));};exports[_0x2f82('0x55')]=function(_0x3abeb0,_0x326094,_0x1680b3){var _0x28b946={'raw':!![],'where':{}},_0x143950={},_0x512722;return db[_0x2f82('0x30')][_0x2f82('0x56')]({'where':{'id':_0x3abeb0['params']['id']}})[_0x2f82('0x26')](handleEntityNotFound(_0x326094,null))['then'](function(_0x7fad54){if(_0x7fad54){_0x512722=_0x7fad54[_0x2f82('0x4e')]({'plain':!![]});_0x143950[_0x2f82('0x37')]=_['keys'](db[_0x2f82('0x57')][_0x2f82('0x31')]);_0x143950[_0x2f82('0x35')]=_[_0x2f82('0x34')](_0x3abeb0['query']);_0x143950[_0x2f82('0x36')]=_[_0x2f82('0x4a')](_0x143950[_0x2f82('0x37')],_0x143950[_0x2f82('0x35')]);_0x28b946[_0x2f82('0x38')]=_[_0x2f82('0x4a')](_0x143950[_0x2f82('0x37')],qs[_0x2f82('0x39')](_0x3abeb0[_0x2f82('0x35')][_0x2f82('0x39')]));_0x28b946[_0x2f82('0x38')]=_0x28b946[_0x2f82('0x38')]['length']?_0x28b946['attributes']:_0x143950[_0x2f82('0x37')];if(!_0x3abeb0[_0x2f82('0x35')]['hasOwnProperty'](_0x2f82('0x3c'))){_0x28b946[_0x2f82('0x21')]=qs['limit'](_0x3abeb0[_0x2f82('0x35')]['limit']);_0x28b946['offset']=qs[_0x2f82('0x1f')](_0x3abeb0[_0x2f82('0x35')][_0x2f82('0x1f')]);}_0x28b946[_0x2f82('0x3d')]=qs[_0x2f82('0x3e')](_0x3abeb0[_0x2f82('0x35')]['sort']);_0x28b946[_0x2f82('0x3f')]=qs[_0x2f82('0x36')](_[_0x2f82('0x40')](_0x3abeb0[_0x2f82('0x35')],_0x143950['filters']));_0x28b946[_0x2f82('0x3f')][_0x2f82('0x58')]=_0x7fad54['id'];if(_0x3abeb0[_0x2f82('0x35')][_0x2f82('0x41')]){_0x28b946[_0x2f82('0x3f')]=_['merge'](_0x28b946[_0x2f82('0x3f')],{'$or':_['map'](_0x28b946[_0x2f82('0x38')],function(_0xf8a92a){var _0xa78a1e={};_0xa78a1e[_0xf8a92a]={'$like':'%'+_0x3abeb0[_0x2f82('0x35')][_0x2f82('0x41')]+'%'};return _0xa78a1e;})});}_0x28b946=_[_0x2f82('0x42')]({},_0x28b946,_0x3abeb0[_0x2f82('0x43')]);return db[_0x2f82('0x57')][_0x2f82('0x46')](_0x28b946);}})[_0x2f82('0x26')](function(_0x36d2b3){if(_0x36d2b3){return db[_0x2f82('0x59')][_0x2f82('0x5a')]({'where':{'id':_[_0x2f82('0x2f')](_0x36d2b3,_0x2f82('0x5b')),'role':_0x2f82('0x5c')},'attributes':['id','name',_0x2f82('0x5d'),'updatedAt',_0x2f82('0x5e')]});}})[_0x2f82('0x26')](function(_0x983d47){if(_0x983d47){return{'count':_0x983d47[_0x2f82('0x22')],'rows':_[_0x2f82('0x2f')](_0x983d47[_0x2f82('0x47')],function(_0xc9b29b){return{'membername':_0xc9b29b['name'],'UserId':_0xc9b29b['id'],'queue_name':_0x512722['name'],'MailQueueId':_0x512722['id'],'interface':util[_0x2f82('0x5f')](_0x2f82('0x60'),_0x2f82('0x61'),_0xc9b29b['name']),'penalty':0x0,'paused':_0xc9b29b[_0x2f82('0x5d')],'createdAt':_0xc9b29b[_0x2f82('0x5e')],'updatedAt':_0xc9b29b[_0x2f82('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f82('0x26')](respondWithFilteredResult(_0x326094,_0x28b946))['catch'](handleError(_0x326094,null));};exports[_0x2f82('0x63')]=function(_0x2ab328,_0x31ad65,_0x248980){var _0xeaad30={};var _0x49f686={};var _0x514d99;var _0x5e5231;return db['MailQueue'][_0x2f82('0x56')]({'where':{'id':_0x2ab328['params']['id']}})['then'](handleEntityNotFound(_0x31ad65,null))['then'](function(_0x529ba7){if(_0x529ba7){_0x514d99=_0x529ba7;_0x49f686[_0x2f82('0x37')]=_[_0x2f82('0x34')](db[_0x2f82('0x64')][_0x2f82('0x31')]);_0x49f686[_0x2f82('0x35')]=_['keys'](_0x2ab328[_0x2f82('0x35')]);_0x49f686[_0x2f82('0x36')]=_[_0x2f82('0x4a')](_0x49f686[_0x2f82('0x37')],_0x49f686[_0x2f82('0x35')]);_0xeaad30['attributes']=_[_0x2f82('0x4a')](_0x49f686[_0x2f82('0x37')],qs[_0x2f82('0x39')](_0x2ab328[_0x2f82('0x35')][_0x2f82('0x39')]));_0xeaad30[_0x2f82('0x38')]=_0xeaad30[_0x2f82('0x38')]['length']?_0xeaad30['attributes']:_0x49f686['model'];_0xeaad30[_0x2f82('0x3d')]=qs[_0x2f82('0x3e')](_0x2ab328[_0x2f82('0x35')]['sort']);_0xeaad30['where']=qs[_0x2f82('0x36')](_[_0x2f82('0x40')](_0x2ab328[_0x2f82('0x35')],_0x49f686[_0x2f82('0x36')]));if(_0x2ab328[_0x2f82('0x35')][_0x2f82('0x41')]){_0xeaad30[_0x2f82('0x3f')]=_[_0x2f82('0x42')](_0xeaad30[_0x2f82('0x3f')],{'$or':_['map'](_0xeaad30['attributes'],function(_0x2ef063){var _0xd2375={};_0xd2375[_0x2ef063]={'$like':'%'+_0x2ab328[_0x2f82('0x35')][_0x2f82('0x41')]+'%'};return _0xd2375;})});}_0xeaad30=_[_0x2f82('0x42')]({},_0xeaad30,_0x2ab328[_0x2f82('0x43')]);return _0x514d99[_0x2f82('0x63')](_0xeaad30);}})['then'](function(_0x29369e){if(_0x29369e){_0x5e5231=_0x29369e['length'];if(!_0x2ab328['query'][_0x2f82('0x3b')](_0x2f82('0x3c'))){_0xeaad30[_0x2f82('0x21')]=qs['limit'](_0x2ab328[_0x2f82('0x35')][_0x2f82('0x21')]);_0xeaad30[_0x2f82('0x1f')]=qs[_0x2f82('0x1f')](_0x2ab328[_0x2f82('0x35')][_0x2f82('0x1f')]);}return _0x514d99[_0x2f82('0x63')](_0xeaad30);}})[_0x2f82('0x26')](function(_0x3d0897){if(_0x3d0897){return _0x3d0897?{'count':_0x5e5231,'rows':_0x3d0897}:null;}})['then'](respondWithResult(_0x31ad65,null))[_0x2f82('0x48')](handleError(_0x31ad65,null));};exports[_0x2f82('0x65')]=function(_0x558cf9,_0x1a193a,_0x54bf03){var _0x7d9fa6=_0x558cf9['body'][_0x2f82('0x66')];return db[_0x2f82('0x64')][_0x2f82('0x46')]({'where':{'id':_0x7d9fa6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2f82('0x67'),'attributes':['id',_0x2f82('0x2c'),_0x2f82('0x68'),'voicePause',_0x2f82('0x69')],'raw':!![]}]})[_0x2f82('0x26')](function(_0x5cee98){if(_0x5cee98){var _0x55abf7=_['flatMap'](_0x5cee98,function(_0xa720c4){var _0xb4e8f8=_0xa720c4[_0x2f82('0x4e')]({'plain':!![]});return _0xb4e8f8[_0x2f82('0x67')];});return db[_0x2f82('0x30')][_0x2f82('0x4b')]({'where':{'id':_0x558cf9[_0x2f82('0x53')]['id']}})[_0x2f82('0x26')](function(_0x1a81c1){return db[_0x2f82('0x6a')][_0x2f82('0x6b')](function(_0x5b40e0){return _0x1a81c1[_0x2f82('0x65')](_0x7d9fa6,{'transaction':_0x5b40e0})['then'](function(){return BPromise[_0x2f82('0x6c')](_0x55abf7,function(_0x3d0852){return db['UserMailQueue'][_0x2f82('0x6d')]({'where':{'UserId':_0x3d0852['id'],'MailQueueId':_0x558cf9[_0x2f82('0x53')]['id']},'transaction':_0x5b40e0});});})['then'](function(){_0x55abf7[_0x2f82('0x6e')](function(_0x4d01f4){socket[_0x2f82('0x6f')]('userMailQueue:save',{'UserId':_0x4d01f4['id'],'MailQueueId':_0x1a81c1['id']});});});});});}})[_0x2f82('0x26')](respondWithStatusCode(_0x1a193a,null))[_0x2f82('0x48')](handleError(_0x1a193a,null));};exports[_0x2f82('0x70')]=function(_0x40865d,_0x27d4f9,_0x59b24e){return db['Team'][_0x2f82('0x46')]({'where':{'id':_0x40865d[_0x2f82('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2f82('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2f82('0x26')](handleEntityNotFound(_0x27d4f9,null))['then'](function(_0x22db44){var _0x13cb82=_[_0x2f82('0x2f')](_0x22db44,'id');var _0x4a7e3e=[];var _0x18147e=[];var _0x4971c2=squel[_0x2f82('0x71')]();_0x4971c2[_0x2f82('0x72')]('tq.TeamId')[_0x2f82('0x73')](_0x2f82('0x74'),'tq')[_0x2f82('0x75')]('user_has_teams','ut',_0x2f82('0x76'))[_0x2f82('0x3f')](_0x2f82('0x77'),_0x40865d[_0x2f82('0x53')]['id']);for(var _0x16cc97=0x0;_0x16cc97<_0x22db44[_0x2f82('0x3a')];_0x16cc97+=0x1){let _0x551b6a=_0x22db44[_0x16cc97];for(var _0x3b1e30=0x0;_0x3b1e30<_0x551b6a[_0x2f82('0x67')][_0x2f82('0x3a')];_0x3b1e30+=0x1){let _0x50be33=_0x551b6a[_0x2f82('0x67')][_0x3b1e30];var _0x24e632=_0x4971c2[_0x2f82('0x78')]();_0x24e632[_0x2f82('0x3f')](_0x2f82('0x79'),_0x50be33['id']);_0x18147e[_0x2f82('0x7a')](db[_0x2f82('0x6a')][_0x2f82('0x35')](_0x24e632['toString'](),{'type':db['sequelize']['QueryTypes'][_0x2f82('0x7b')]})[_0x2f82('0x26')](function(_0x5bfff9){if(_0x5bfff9[_0x2f82('0x3a')]===0x1){return _0x50be33['id'];}else{var _0x2a9317=_[_0x2f82('0x7c')](_[_0x2f82('0x2f')](_0x5bfff9,_0x2f82('0x7d')),function(_0xa7b38a){return _['includes'](_0x13cb82,_0xa7b38a);});if(_0x2a9317){return _0x50be33['id'];}}}));}}return BPromise[_0x2f82('0x7e')](_0x18147e)[_0x2f82('0x26')](function(_0x1a4123){_0x4a7e3e=_(_0x4a7e3e)['union'](_0x1a4123)[_0x2f82('0x7f')]()[_0x2f82('0x80')]();return db[_0x2f82('0x30')][_0x2f82('0x4b')]({'where':{'id':_0x40865d[_0x2f82('0x53')]['id']}})[_0x2f82('0x26')](function(_0xc4b658){return db[_0x2f82('0x6a')][_0x2f82('0x6b')](function(_0x50fc7b){return _0xc4b658[_0x2f82('0x70')](_0x40865d['query']['ids'],{'transaction':_0x50fc7b})[_0x2f82('0x26')](function(){if(!_[_0x2f82('0x81')](_0x4a7e3e)){return _0xc4b658[_0x2f82('0x82')](_0x4a7e3e,{'transaction':_0x50fc7b});}})[_0x2f82('0x26')](function(){_0x4a7e3e[_0x2f82('0x6e')](function(_0x200203){socket[_0x2f82('0x6f')](_0x2f82('0x83'),{'UserId':_0x200203,'MailQueueId':_0xc4b658['id']});});});});});});})['then'](respondWithStatusCode(_0x27d4f9,null))[_0x2f82('0x48')](handleError(_0x27d4f9,null));};exports[_0x2f82('0x84')]=function(_0x9a296d,_0x13fbca,_0x19b20d){return db[_0x2f82('0x30')]['find']({'where':{'id':_0x9a296d[_0x2f82('0x53')]['id']}})[_0x2f82('0x26')](handleEntityNotFound(_0x13fbca,null))[_0x2f82('0x26')](function(_0xe7844a){if(_0xe7844a){return _0xe7844a[_0x2f82('0x84')](_0x9a296d[_0x2f82('0x4d')][_0x2f82('0x66')],_[_0x2f82('0x85')](_0x9a296d['body'],[_0x2f82('0x66'),'id'])||{})[_0x2f82('0x86')](function(_0x566d30){for(var _0x1a4409=0x0;_0x1a4409<_0x9a296d[_0x2f82('0x4d')][_0x2f82('0x66')][_0x2f82('0x3a')];_0x1a4409+=0x1){socket[_0x2f82('0x6f')]('userMailQueue:save',{'UserId':Number(_0x9a296d[_0x2f82('0x4d')][_0x2f82('0x66')][_0x1a4409]),'MailQueueId':Number(_0x9a296d[_0x2f82('0x53')]['id'])});}return _0x566d30;});}})['then'](respondWithResult(_0x13fbca,null))['catch'](handleError(_0x13fbca,null));};exports['removeAgents']=function(_0xaf2195,_0x3632cc,_0x10f8b4){return db['MailQueue'][_0x2f82('0x4b')]({'where':{'id':_0xaf2195[_0x2f82('0x53')]['id']}})[_0x2f82('0x26')](handleEntityNotFound(_0x3632cc,null))[_0x2f82('0x26')](function(_0x2e671b){if(_0x2e671b){return _0x2e671b[_0x2f82('0x82')](_0xaf2195[_0x2f82('0x35')][_0x2f82('0x66')])[_0x2f82('0x26')](function(){if(_['isArray'](_0xaf2195[_0x2f82('0x35')][_0x2f82('0x66')])){for(var _0x3a7786=0x0;_0x3a7786<_0xaf2195[_0x2f82('0x35')]['ids'][_0x2f82('0x3a')];_0x3a7786+=0x1){socket['emit'](_0x2f82('0x83'),{'UserId':Number(_0xaf2195[_0x2f82('0x35')][_0x2f82('0x66')][_0x3a7786]),'MailQueueId':Number(_0xaf2195[_0x2f82('0x53')]['id'])});}}else{socket[_0x2f82('0x6f')](_0x2f82('0x83'),{'UserId':Number(_0xaf2195[_0x2f82('0x35')][_0x2f82('0x66')]),'MailQueueId':Number(_0xaf2195[_0x2f82('0x53')]['id'])});}});}})[_0x2f82('0x26')](respondWithStatusCode(_0x3632cc,null))[_0x2f82('0x48')](handleError(_0x3632cc,null));};exports[_0x2f82('0x87')]=function(_0x5d1634,_0x32ea56,_0x57f8a5){var _0x340026={};var _0xfd72b6={};var _0x147a52;var _0x18d028;return db[_0x2f82('0x30')]['findOne']({'where':{'id':_0x5d1634[_0x2f82('0x53')]['id']}})[_0x2f82('0x26')](handleEntityNotFound(_0x32ea56,null))['then'](function(_0x3fe9c9){if(_0x3fe9c9){_0x147a52=_0x3fe9c9;_0xfd72b6[_0x2f82('0x37')]=_[_0x2f82('0x34')](db[_0x2f82('0x59')][_0x2f82('0x31')]);_0xfd72b6['query']=_['keys'](_0x5d1634['query']);_0xfd72b6[_0x2f82('0x36')]=_[_0x2f82('0x4a')](_0xfd72b6[_0x2f82('0x37')],_0xfd72b6[_0x2f82('0x35')]);_0x340026[_0x2f82('0x38')]=_[_0x2f82('0x4a')](_0xfd72b6[_0x2f82('0x37')],qs[_0x2f82('0x39')](_0x5d1634['query'][_0x2f82('0x39')]));_0x340026[_0x2f82('0x38')]=_0x340026['attributes'][_0x2f82('0x3a')]?_0x340026['attributes']:_0xfd72b6[_0x2f82('0x37')];_0x340026[_0x2f82('0x3d')]=qs['sort'](_0x5d1634['query']['sort']);_0x340026[_0x2f82('0x3f')]=qs[_0x2f82('0x36')](_[_0x2f82('0x40')](_0x5d1634[_0x2f82('0x35')],_0xfd72b6['filters']));if(_0x5d1634[_0x2f82('0x35')][_0x2f82('0x41')]){_0x340026['where']=_['merge'](_0x340026[_0x2f82('0x3f')],{'$or':_[_0x2f82('0x2f')](_0x340026[_0x2f82('0x38')],function(_0x3244ac){var _0x2c9439={};_0x2c9439[_0x3244ac]={'$like':'%'+_0x5d1634[_0x2f82('0x35')][_0x2f82('0x41')]+'%'};return _0x2c9439;})});}_0x340026=_[_0x2f82('0x42')]({},_0x340026,_0x5d1634[_0x2f82('0x43')]);return _0x147a52[_0x2f82('0x87')](_0x340026);}})[_0x2f82('0x26')](function(_0x1c31a1){if(_0x1c31a1){_0x18d028=_0x1c31a1[_0x2f82('0x3a')];if(!_0x5d1634[_0x2f82('0x35')]['hasOwnProperty'](_0x2f82('0x3c'))){_0x340026[_0x2f82('0x21')]=qs[_0x2f82('0x21')](_0x5d1634['query'][_0x2f82('0x21')]);_0x340026[_0x2f82('0x1f')]=qs[_0x2f82('0x1f')](_0x5d1634['query'][_0x2f82('0x1f')]);}return _0x147a52[_0x2f82('0x87')](_0x340026);}})[_0x2f82('0x26')](function(_0x28918e){if(_0x28918e){return _0x28918e?{'count':_0x18d028,'rows':_0x28918e}:null;}})[_0x2f82('0x26')](respondWithResult(_0x32ea56,null))[_0x2f82('0x48')](handleError(_0x32ea56,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 71c5e6a..3caa88b 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 _0xc675=['../../mysqldb','MailQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x415488,_0x55f17c){var _0x560969=function(_0x5b4afc){while(--_0x5b4afc){_0x415488['push'](_0x415488['shift']());}};_0x560969(++_0x55f17c);}(_0xc675,0x8f));var _0x5c67=function(_0x465200,_0x502953){_0x465200=_0x465200-0x0;var _0x4ab4e0=_0xc675[_0x465200];return _0x4ab4e0;};'use strict';var EventEmitter=require(_0x5c67('0x0'));var MailQueue=require(_0x5c67('0x1'))['db'][_0x5c67('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5c67('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5c67('0x4'),'afterDestroy':'remove'};function emitEvent(_0x276b15){return function(_0x5f2dc8,_0x2f88f3,_0x82fc83){MailQueueEvents[_0x5c67('0x5')](_0x276b15+':'+_0x5f2dc8['id'],_0x5f2dc8);MailQueueEvents['emit'](_0x276b15,_0x5f2dc8);_0x82fc83(null);};}for(var e in events){if(events[_0x5c67('0x6')](e)){var event=events[e];MailQueue[_0x5c67('0x7')](e,emitEvent(event));}}module[_0x5c67('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x320c=['exports','events','../../mysqldb','MailQueue','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x453f66,_0x19eb27){var _0x5c7d32=function(_0x560e35){while(--_0x560e35){_0x453f66['push'](_0x453f66['shift']());}};_0x5c7d32(++_0x19eb27);}(_0x320c,0x12a));var _0xc320=function(_0x5969dc,_0x15cafa){_0x5969dc=_0x5969dc-0x0;var _0x6f423f=_0x320c[_0x5969dc];return _0x6f423f;};'use strict';var EventEmitter=require(_0xc320('0x0'));var MailQueue=require(_0xc320('0x1'))['db'][_0xc320('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc320('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc320('0x4')};function emitEvent(_0x1359a1){return function(_0xbbf226,_0x2cac91,_0x2ec6b1){MailQueueEvents['emit'](_0x1359a1+':'+_0xbbf226['id'],_0xbbf226);MailQueueEvents[_0xc320('0x5')](_0x1359a1,_0xbbf226);_0x2ec6b1(null);};}for(var e in events){if(events[_0xc320('0x6')](e)){var event=events[e];MailQueue[_0xc320('0x7')](e,emitEvent(event));}}module[_0xc320('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 fa2f8f2..35007b2 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 _0xf1e9=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./mailQueue.attributes'];(function(_0x1b2a62,_0x5ec05f){var _0x35e8d9=function(_0x85a418){while(--_0x85a418){_0x1b2a62['push'](_0x1b2a62['shift']());}};_0x35e8d9(++_0x5ec05f);}(_0xf1e9,0x70));var _0x9f1e=function(_0x27e9d4,_0x171f95){_0x27e9d4=_0x27e9d4-0x0;var _0x423f0f=_0xf1e9[_0x27e9d4];return _0x423f0f;};'use strict';var _=require(_0x9f1e('0x0'));var util=require(_0x9f1e('0x1'));var logger=require(_0x9f1e('0x2'))(_0x9f1e('0x3'));var moment=require(_0x9f1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f1e('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f1e('0x7'));module[_0x9f1e('0x8')]=function(_0x1ef47b,_0x174a2f){return _0x1ef47b[_0x9f1e('0x9')](_0x9f1e('0xa'),attributes,{'tableName':_0x9f1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x420e=['rimraf','../../config/environment','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','path'];(function(_0x2f466c,_0x5efef9){var _0x5da6c0=function(_0x38146c){while(--_0x38146c){_0x2f466c['push'](_0x2f466c['shift']());}};_0x5da6c0(++_0x5efef9);}(_0x420e,0x1d3));var _0xe420=function(_0x4a9af5,_0x556233){_0x4a9af5=_0x4a9af5-0x0;var _0x4411d7=_0x420e[_0x4a9af5];return _0x4411d7;};'use strict';var _=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var logger=require(_0xe420('0x2'))(_0xe420('0x3'));var moment=require(_0xe420('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe420('0x5'));var rimraf=require(_0xe420('0x6'));var config=require(_0xe420('0x7'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x16388d,_0x51f1d0){return _0x16388d[_0xe420('0x8')](_0xe420('0x9'),attributes,{'tableName':_0xe420('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 b33fe66..47bdff3 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 _0x3657=['stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x391bf7,_0x5b92f7){var _0x41c384=function(_0x13541a){while(--_0x13541a){_0x391bf7['push'](_0x391bf7['shift']());}};_0x41c384(++_0x5b92f7);}(_0x3657,0x183));var _0x7365=function(_0x33c663,_0x4416ed){_0x33c663=_0x33c663-0x0;var _0x4c6299=_0x3657[_0x33c663];return _0x4c6299;};'use strict';var _=require(_0x7365('0x0'));var util=require(_0x7365('0x1'));var moment=require(_0x7365('0x2'));var BPromise=require('bluebird');var rs=require(_0x7365('0x3'));var fs=require('fs');var Redis=require(_0x7365('0x4'));var db=require(_0x7365('0x5'))['db'];var utils=require(_0x7365('0x6'));var logger=require('../../config/logger')(_0x7365('0x7'));var config=require(_0x7365('0x8'));var jayson=require(_0x7365('0x9'));var client=jayson['client'][_0x7365('0xa')]({'port':0x232a});config[_0x7365('0xb')]=_[_0x7365('0xc')](config['redis'],{'host':_0x7365('0xd'),'port':0x18eb});var socket=require(_0x7365('0xe'))(new Redis(config[_0x7365('0xb')]));require('./mailQueue.socket')[_0x7365('0xf')](socket);function respondWithRpcPromise(_0x2d0ceb,_0x5b7533,_0x363a23){return new BPromise(function(_0x5dfda2,_0x25df5b){return client[_0x7365('0x10')](_0x2d0ceb,_0x363a23)[_0x7365('0x11')](function(_0x5f4b94){logger[_0x7365('0x12')](_0x7365('0x13'),_0x5b7533,'request\x20sent');logger[_0x7365('0x14')](_0x7365('0x15'),_0x5b7533,_0x7365('0x16'),JSON[_0x7365('0x17')](_0x5f4b94));if(_0x5f4b94[_0x7365('0x18')]){if(_0x5f4b94['error'][_0x7365('0x19')]===0x1f4){logger['error'](_0x7365('0x13'),_0x5b7533,_0x5f4b94['error']['message']);return _0x25df5b(_0x5f4b94[_0x7365('0x18')][_0x7365('0x1a')]);}logger[_0x7365('0x18')](_0x7365('0x13'),_0x5b7533,_0x5f4b94[_0x7365('0x18')]['message']);return _0x5dfda2(_0x5f4b94['error'][_0x7365('0x1a')]);}else{logger[_0x7365('0x12')]('MailQueue,\x20%s,\x20%s',_0x5b7533,_0x7365('0x16'));_0x5dfda2(_0x5f4b94[_0x7365('0x1b')][_0x7365('0x1a')]);}})[_0x7365('0x1c')](function(_0x271ad3){logger[_0x7365('0x18')](_0x7365('0x13'),_0x5b7533,_0x271ad3);_0x25df5b(_0x271ad3);});});}exports[_0x7365('0x1d')]=function(_0x89f228){var _0x465c20=this;return new Promise(function(_0x1547da,_0x463d01){return db[_0x7365('0x1e')][_0x7365('0x1f')]({'raw':_0x89f228[_0x7365('0x20')]?_0x89f228[_0x7365('0x20')][_0x7365('0x21')]===undefined?!![]:![]:!![],'where':_0x89f228['options']?_0x89f228['options'][_0x7365('0x22')]||null:null,'attributes':_0x89f228[_0x7365('0x20')]?_0x89f228[_0x7365('0x20')][_0x7365('0x23')]||null:null,'limit':_0x89f228[_0x7365('0x20')]?_0x89f228[_0x7365('0x20')]['limit']||null:null,'include':_0x89f228[_0x7365('0x20')]?_0x89f228[_0x7365('0x20')][_0x7365('0x24')]?_[_0x7365('0x25')](_0x89f228[_0x7365('0x20')]['include'],function(_0xc7f5fa){return{'model':db[_0xc7f5fa[_0x7365('0x26')]],'as':_0xc7f5fa['as'],'attributes':_0xc7f5fa[_0x7365('0x23')],'include':_0xc7f5fa[_0x7365('0x24')]?_['map'](_0xc7f5fa[_0x7365('0x24')],function(_0xf4cdb6){return{'model':db[_0xf4cdb6['model']],'as':_0xf4cdb6['as'],'attributes':_0xf4cdb6['attributes'],'include':_0xf4cdb6[_0x7365('0x24')]?_[_0x7365('0x25')](_0xf4cdb6['include'],function(_0x3d1e72){return{'model':db[_0x3d1e72['model']],'as':_0x3d1e72['as'],'attributes':_0x3d1e72[_0x7365('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7365('0x11')](function(_0x53bc37){logger[_0x7365('0x12')]('GetMailQueue',_0x89f228);logger[_0x7365('0x14')](_0x7365('0x1d'),_0x89f228,JSON[_0x7365('0x17')](_0x53bc37));_0x1547da(_0x53bc37);})[_0x7365('0x1c')](function(_0x2f1c40){logger[_0x7365('0x18')](_0x7365('0x1d'),_0x2f1c40[_0x7365('0x1a')],_0x89f228);_0x463d01(_0x465c20[_0x7365('0x18')](0x1f4,_0x2f1c40[_0x7365('0x1a')]));});});};exports[_0x7365('0x27')]=function(_0x19b2cb){var _0x47d2b3=this;return new Promise(function(_0x1753f4,_0x4c9db2){return db[_0x7365('0x1e')][_0x7365('0x28')]({'raw':_0x19b2cb[_0x7365('0x20')]?_0x19b2cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x19b2cb['options']?_0x19b2cb[_0x7365('0x20')][_0x7365('0x22')]||null:null,'attributes':_0x19b2cb[_0x7365('0x20')]?_0x19b2cb[_0x7365('0x20')][_0x7365('0x23')]||null:null,'include':_0x19b2cb[_0x7365('0x20')]?_0x19b2cb['options'][_0x7365('0x24')]?_[_0x7365('0x25')](_0x19b2cb[_0x7365('0x20')]['include'],function(_0x5e37cd){return{'model':db[_0x5e37cd['model']],'as':_0x5e37cd['as'],'attributes':_0x5e37cd[_0x7365('0x23')],'include':_0x5e37cd[_0x7365('0x24')]?_[_0x7365('0x25')](_0x5e37cd[_0x7365('0x24')],function(_0x4303a9){return{'model':db[_0x4303a9[_0x7365('0x26')]],'as':_0x4303a9['as'],'attributes':_0x4303a9[_0x7365('0x23')],'include':_0x4303a9[_0x7365('0x24')]?_[_0x7365('0x25')](_0x4303a9[_0x7365('0x24')],function(_0x71f7d1){return{'model':db[_0x71f7d1['model']],'as':_0x71f7d1['as'],'attributes':_0x71f7d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x7365('0x11')](function(_0x5f1816){logger[_0x7365('0x12')](_0x7365('0x27'),_0x19b2cb);logger['debug'](_0x7365('0x27'),_0x19b2cb,JSON['stringify'](_0x5f1816));_0x1753f4(_0x5f1816);})[_0x7365('0x1c')](function(_0x1ca227){logger[_0x7365('0x18')](_0x7365('0x27'),_0x1ca227[_0x7365('0x1a')],_0x19b2cb);_0x4c9db2(_0x47d2b3[_0x7365('0x18')](0x1f4,_0x1ca227[_0x7365('0x1a')]));});});}; \ No newline at end of file +var _0x0e24=['info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowMailQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request'];(function(_0x32585a,_0x28954a){var _0x28d602=function(_0x59244c){while(--_0x59244c){_0x32585a['push'](_0x32585a['shift']());}};_0x28d602(++_0x28954a);}(_0x0e24,0x1da));var _0x40e2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x0e24[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x40e2('0x0'));var BPromise=require(_0x40e2('0x1'));var rs=require(_0x40e2('0x2'));var fs=require('fs');var Redis=require(_0x40e2('0x3'));var db=require(_0x40e2('0x4'))['db'];var utils=require(_0x40e2('0x5'));var logger=require(_0x40e2('0x6'))(_0x40e2('0x7'));var config=require(_0x40e2('0x8'));var jayson=require(_0x40e2('0x9'));var client=jayson[_0x40e2('0xa')][_0x40e2('0xb')]({'port':0x232a});config[_0x40e2('0xc')]=_[_0x40e2('0xd')](config['redis'],{'host':_0x40e2('0xe'),'port':0x18eb});var socket=require(_0x40e2('0xf'))(new Redis(config['redis']));require(_0x40e2('0x10'))['register'](socket);function respondWithRpcPromise(_0x3666fb,_0x2f745c,_0x2f1678){return new BPromise(function(_0x616cb0,_0x1e70e4){return client[_0x40e2('0x11')](_0x3666fb,_0x2f1678)['then'](function(_0x330efd){logger[_0x40e2('0x12')](_0x40e2('0x13'),_0x2f745c,_0x40e2('0x14'));logger[_0x40e2('0x15')](_0x40e2('0x16'),_0x2f745c,_0x40e2('0x14'),JSON[_0x40e2('0x17')](_0x330efd));if(_0x330efd[_0x40e2('0x18')]){if(_0x330efd[_0x40e2('0x18')][_0x40e2('0x19')]===0x1f4){logger[_0x40e2('0x18')](_0x40e2('0x13'),_0x2f745c,_0x330efd[_0x40e2('0x18')][_0x40e2('0x1a')]);return _0x1e70e4(_0x330efd[_0x40e2('0x18')]['message']);}logger[_0x40e2('0x18')](_0x40e2('0x13'),_0x2f745c,_0x330efd[_0x40e2('0x18')][_0x40e2('0x1a')]);return _0x616cb0(_0x330efd[_0x40e2('0x18')][_0x40e2('0x1a')]);}else{logger[_0x40e2('0x12')](_0x40e2('0x13'),_0x2f745c,_0x40e2('0x14'));_0x616cb0(_0x330efd[_0x40e2('0x1b')][_0x40e2('0x1a')]);}})[_0x40e2('0x1c')](function(_0x27fa69){logger[_0x40e2('0x18')](_0x40e2('0x13'),_0x2f745c,_0x27fa69);_0x1e70e4(_0x27fa69);});});}exports[_0x40e2('0x1d')]=function(_0x28ebfe){var _0x3640e5=this;return new Promise(function(_0x520abe,_0x4f8782){return db[_0x40e2('0x1e')][_0x40e2('0x1f')]({'raw':_0x28ebfe[_0x40e2('0x20')]?_0x28ebfe['options']['raw']===undefined?!![]:![]:!![],'where':_0x28ebfe[_0x40e2('0x20')]?_0x28ebfe['options'][_0x40e2('0x21')]||null:null,'attributes':_0x28ebfe[_0x40e2('0x20')]?_0x28ebfe[_0x40e2('0x20')][_0x40e2('0x22')]||null:null,'limit':_0x28ebfe['options']?_0x28ebfe[_0x40e2('0x20')][_0x40e2('0x23')]||null:null,'include':_0x28ebfe[_0x40e2('0x20')]?_0x28ebfe[_0x40e2('0x20')][_0x40e2('0x24')]?_[_0x40e2('0x25')](_0x28ebfe['options'][_0x40e2('0x24')],function(_0x4517b3){return{'model':db[_0x4517b3[_0x40e2('0x26')]],'as':_0x4517b3['as'],'attributes':_0x4517b3[_0x40e2('0x22')],'include':_0x4517b3[_0x40e2('0x24')]?_['map'](_0x4517b3[_0x40e2('0x24')],function(_0x5df662){return{'model':db[_0x5df662[_0x40e2('0x26')]],'as':_0x5df662['as'],'attributes':_0x5df662[_0x40e2('0x22')],'include':_0x5df662['include']?_[_0x40e2('0x25')](_0x5df662['include'],function(_0x5954a2){return{'model':db[_0x5954a2['model']],'as':_0x5954a2['as'],'attributes':_0x5954a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x40e2('0x27')](function(_0x472007){logger['info']('GetMailQueue',_0x28ebfe);logger['debug'](_0x40e2('0x1d'),_0x28ebfe,JSON[_0x40e2('0x17')](_0x472007));_0x520abe(_0x472007);})[_0x40e2('0x1c')](function(_0x377651){logger[_0x40e2('0x18')](_0x40e2('0x1d'),_0x377651[_0x40e2('0x1a')],_0x28ebfe);_0x4f8782(_0x3640e5[_0x40e2('0x18')](0x1f4,_0x377651[_0x40e2('0x1a')]));});});};exports['ShowMailQueue']=function(_0x5bafa7){var _0xb2631f=this;return new Promise(function(_0x342662,_0x2f3ec3){return db[_0x40e2('0x1e')]['find']({'raw':_0x5bafa7['options']?_0x5bafa7['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bafa7['options']?_0x5bafa7[_0x40e2('0x20')][_0x40e2('0x21')]||null:null,'attributes':_0x5bafa7[_0x40e2('0x20')]?_0x5bafa7['options']['attributes']||null:null,'include':_0x5bafa7[_0x40e2('0x20')]?_0x5bafa7[_0x40e2('0x20')][_0x40e2('0x24')]?_['map'](_0x5bafa7['options']['include'],function(_0x5625ed){return{'model':db[_0x5625ed[_0x40e2('0x26')]],'as':_0x5625ed['as'],'attributes':_0x5625ed[_0x40e2('0x22')],'include':_0x5625ed[_0x40e2('0x24')]?_[_0x40e2('0x25')](_0x5625ed['include'],function(_0x31e4ab){return{'model':db[_0x31e4ab[_0x40e2('0x26')]],'as':_0x31e4ab['as'],'attributes':_0x31e4ab[_0x40e2('0x22')],'include':_0x31e4ab[_0x40e2('0x24')]?_[_0x40e2('0x25')](_0x31e4ab[_0x40e2('0x24')],function(_0x3fd7de){return{'model':db[_0x3fd7de['model']],'as':_0x3fd7de['as'],'attributes':_0x3fd7de[_0x40e2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x40e2('0x27')](function(_0x1e9a29){logger[_0x40e2('0x12')]('ShowMailQueue',_0x5bafa7);logger[_0x40e2('0x15')](_0x40e2('0x28'),_0x5bafa7,JSON[_0x40e2('0x17')](_0x1e9a29));_0x342662(_0x1e9a29);})[_0x40e2('0x1c')](function(_0x1ad214){logger['error'](_0x40e2('0x28'),_0x1ad214['message'],_0x5bafa7);_0x2f3ec3(_0xb2631f['error'](0x1f4,_0x1ad214[_0x40e2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ace91a1..4d3fd3a 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 _0x6afd=['mailQueue:','./mailQueue.events','remove','update','removeListener','length'];(function(_0x229bc7,_0x458698){var _0x444202=function(_0x3a6ba0){while(--_0x3a6ba0){_0x229bc7['push'](_0x229bc7['shift']());}};_0x444202(++_0x458698);}(_0x6afd,0x67));var _0xd6af=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x6afd[_0x13ea00];return _0x1f7347;};'use strict';var MailQueueEvents=require(_0xd6af('0x0'));var events=['save',_0xd6af('0x1'),_0xd6af('0x2')];function createListener(_0x721f3f,_0x56be3f){return function(_0x51c72b){_0x56be3f['emit'](_0x721f3f,_0x51c72b);};}function removeListener(_0xde0a3b,_0x544db1){return function(){MailQueueEvents[_0xd6af('0x3')](_0xde0a3b,_0x544db1);};}exports['register']=function(_0xaa8d5e){for(var _0x2f1bf1=0x0,_0x374345=events[_0xd6af('0x4')];_0x2f1bf1<_0x374345;_0x2f1bf1++){var _0x273ffc=events[_0x2f1bf1];var _0x54fb36=createListener(_0xd6af('0x5')+_0x273ffc,_0xaa8d5e);MailQueueEvents['on'](_0x273ffc,_0x54fb36);}}; \ No newline at end of file +var _0x557a=['removeListener','register','length','mailQueue:','./mailQueue.events','remove','update','emit'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x557a,0x1b4));var _0xa557=function(_0x53d05a,_0x5eef20){_0x53d05a=_0x53d05a-0x0;var _0xdcac71=_0x557a[_0x53d05a];return _0xdcac71;};'use strict';var MailQueueEvents=require(_0xa557('0x0'));var events=['save',_0xa557('0x1'),_0xa557('0x2')];function createListener(_0x24e2ad,_0x2b3a08){return function(_0x12d41f){_0x2b3a08[_0xa557('0x3')](_0x24e2ad,_0x12d41f);};}function removeListener(_0x36f63b,_0x22316f){return function(){MailQueueEvents[_0xa557('0x4')](_0x36f63b,_0x22316f);};}exports[_0xa557('0x5')]=function(_0x1da743){for(var _0xf7bce=0x0,_0x420c20=events[_0xa557('0x6')];_0xf7bce<_0x420c20;_0xf7bce++){var _0x1bcc89=events[_0xf7bce];var _0xd4351a=createListener(_0xa557('0x7')+_0x1bcc89,_0x1da743);MailQueueEvents['on'](_0x1bcc89,_0xd4351a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3ddea6b..27c17c9 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 _0xdf9e=['index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x2d0a1a,_0x1053cc){var _0x5b038c=function(_0x5369a9){while(--_0x5369a9){_0x2d0a1a['push'](_0x2d0a1a['shift']());}};_0x5b038c(++_0x1053cc);}(_0xdf9e,0x8f));var _0xedf9=function(_0x50f227,_0xfa0b64){_0x50f227=_0x50f227-0x0;var _0x532e44=_0xdf9e[_0x50f227];return _0x532e44;};'use strict';var multer=require('multer');var util=require(_0xedf9('0x0'));var path=require(_0xedf9('0x1'));var timeout=require(_0xedf9('0x2'));var express=require(_0xedf9('0x3'));var router=express[_0xedf9('0x4')]();var fs_extra=require(_0xedf9('0x5'));var auth=require(_0xedf9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xedf9('0x7'));var controller=require(_0xedf9('0x8'));router[_0xedf9('0x9')]('/',auth[_0xedf9('0xa')](),controller[_0xedf9('0xb')]);router[_0xedf9('0x9')](_0xedf9('0xc'),auth[_0xedf9('0xa')](),controller[_0xedf9('0xd')]);router['get'](_0xedf9('0xe'),auth[_0xedf9('0xa')](),controller[_0xedf9('0xf')]);router[_0xedf9('0x10')]('/',auth[_0xedf9('0xa')](),controller[_0xedf9('0x11')]);router[_0xedf9('0x12')](_0xedf9('0xe'),auth['isAuthenticated'](),controller[_0xedf9('0x13')]);router[_0xedf9('0x14')](_0xedf9('0xe'),auth[_0xedf9('0xa')](),controller['destroy']);module[_0xedf9('0x15')]=router; \ No newline at end of file +var _0x3452=['../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5cac79,_0x5f272d){var _0x4dba8c=function(_0x66543f){while(--_0x66543f){_0x5cac79['push'](_0x5cac79['shift']());}};_0x4dba8c(++_0x5f272d);}(_0x3452,0x104));var _0x2345=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3452[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x2345('0x0'));var path=require(_0x2345('0x1'));var timeout=require(_0x2345('0x2'));var express=require(_0x2345('0x3'));var router=express[_0x2345('0x4')]();var fs_extra=require(_0x2345('0x5'));var auth=require(_0x2345('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2345('0x7'));var controller=require(_0x2345('0x8'));router['get']('/',auth[_0x2345('0x9')](),controller['index']);router[_0x2345('0xa')](_0x2345('0xb'),auth['isAuthenticated'](),controller[_0x2345('0xc')]);router[_0x2345('0xa')](_0x2345('0xd'),auth[_0x2345('0x9')](),controller[_0x2345('0xe')]);router[_0x2345('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x2345('0x9')](),controller[_0x2345('0x10')]);router[_0x2345('0x11')](_0x2345('0xd'),auth[_0x2345('0x9')](),controller[_0x2345('0x12')]);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 05c728d..d6e6326 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 _0x7b48=['exports','STRING','DATE','moment','sequelize'];(function(_0x2e040d,_0x13cede){var _0x408695=function(_0x435460){while(--_0x435460){_0x2e040d['push'](_0x2e040d['shift']());}};_0x408695(++_0x13cede);}(_0x7b48,0xad));var _0x87b4=function(_0x4298af,_0x4bdefd){_0x4298af=_0x4298af-0x0;var _0x54589e=_0x7b48[_0x4298af];return _0x54589e;};'use strict';var moment=require(_0x87b4('0x0'));var Sequelize=require(_0x87b4('0x1'));module[_0x87b4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x87b4('0x3')]},'joinAt':{'type':Sequelize[_0x87b4('0x4')]},'leaveAt':{'type':Sequelize[_0x87b4('0x4')]},'acceptAt':{'type':Sequelize[_0x87b4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7395=['exports','STRING','DATE'];(function(_0x849d6,_0x56fb89){var _0x2d882d=function(_0x26374e){while(--_0x26374e){_0x849d6['push'](_0x849d6['shift']());}};_0x2d882d(++_0x56fb89);}(_0x7395,0xd5));var _0x5739=function(_0x7e718f,_0x273b3b){_0x7e718f=_0x7e718f-0x0;var _0x5139be=_0x7395[_0x7e718f];return _0x5139be;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5739('0x0')]={'uniqueid':{'type':Sequelize[_0x5739('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5739('0x1')]},'joinAt':{'type':Sequelize[_0x5739('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5739('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fea665e..139e26a 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 _0x1c9a=['eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe'];(function(_0x317257,_0x1677dc){var _0x1f235d=function(_0xda0ccf){while(--_0xda0ccf){_0x317257['push'](_0x317257['shift']());}};_0x1f235d(++_0x1677dc);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2e765f,_0xe601d){_0x2e765f=_0x2e765f-0x0;var _0x462c24=_0x1c9a[_0x2e765f];return _0x462c24;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];function respondWithStatusCode(_0x17ee28,_0x57e2a8){_0x57e2a8=_0x57e2a8||0xcc;return function(_0x341233){if(_0x341233){return _0x17ee28[_0xa1c9('0x19')](_0x57e2a8);}return _0x17ee28[_0xa1c9('0x1a')](_0x57e2a8)[_0xa1c9('0x1b')]();};}function respondWithResult(_0x13f4e9,_0x4c70dd){_0x4c70dd=_0x4c70dd||0xc8;return function(_0x335dda){if(_0x335dda){return _0x13f4e9[_0xa1c9('0x1a')](_0x4c70dd)[_0xa1c9('0x1c')](_0x335dda);}};}function respondWithFilteredResult(_0xd9bca1,_0x2d825c){return function(_0x1bbc94){if(_0x1bbc94){var _0x44ab5b=typeof _0x2d825c[_0xa1c9('0x1d')]===_0xa1c9('0x1e')&&typeof _0x2d825c[_0xa1c9('0x1f')]==='undefined';var _0x11ca10=_0x1bbc94[_0xa1c9('0x20')];var _0x224ae4=_0x44ab5b?0x0:_0x2d825c['offset'];var _0x2fb81e=_0x44ab5b?_0x1bbc94['count']:_0x2d825c[_0xa1c9('0x1d')]+_0x2d825c[_0xa1c9('0x1f')];var _0x204d54;if(_0x2fb81e>=_0x11ca10){_0x2fb81e=_0x11ca10;_0x204d54=0xc8;}else{_0x204d54=0xce;}_0xd9bca1['status'](_0x204d54);return _0xd9bca1[_0xa1c9('0x21')](_0xa1c9('0x22'),_0x224ae4+'-'+_0x2fb81e+'/'+_0x11ca10)[_0xa1c9('0x1c')](_0x1bbc94);}return null;};}function patchUpdates(_0x4edf37){return function(_0x41e6d2){try{jsonpatch[_0xa1c9('0x23')](_0x41e6d2,_0x4edf37,!![]);}catch(_0x4c6dbb){return BPromise[_0xa1c9('0x24')](_0x4c6dbb);}return _0x41e6d2[_0xa1c9('0x25')]();};}function saveUpdates(_0x9f201f,_0x4d05d0){return function(_0x29f1b1){if(_0x29f1b1){return _0x29f1b1[_0xa1c9('0x26')](_0x9f201f)[_0xa1c9('0x27')](function(_0x23a461){return _0x23a461;});}return null;};}function removeEntity(_0x24a5da,_0x4a0a0c){return function(_0x50b16b){if(_0x50b16b){return _0x50b16b[_0xa1c9('0x28')]()['then'](function(){_0x24a5da[_0xa1c9('0x1a')](0xcc)[_0xa1c9('0x1b')]();});}};}function handleEntityNotFound(_0x1c6f37,_0x3059eb){return function(_0x339ed1){if(!_0x339ed1){_0x1c6f37['sendStatus'](0x194);}return _0x339ed1;};}function handleError(_0x1925e7,_0x3ca2a8){_0x3ca2a8=_0x3ca2a8||0x1f4;return function(_0x20cbe1){logger['error'](_0x20cbe1[_0xa1c9('0x29')]);if(_0x20cbe1[_0xa1c9('0x2a')]){delete _0x20cbe1[_0xa1c9('0x2a')];}_0x1925e7['status'](_0x3ca2a8)[_0xa1c9('0x2b')](_0x20cbe1);};}exports[_0xa1c9('0x2c')]=function(_0x594137,_0x38936f){var _0x48ce34={},_0xdf6d0c={},_0x2404c3={'count':0x0,'rows':[]};var _0x88ba11=_[_0xa1c9('0x2d')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')],function(_0x42fcb2){return{'name':_0x42fcb2[_0xa1c9('0x30')],'type':_0x42fcb2['type']['key']};});_0xdf6d0c[_0xa1c9('0x31')]=_[_0xa1c9('0x2d')](_0x88ba11,_0xa1c9('0x2a'));_0xdf6d0c[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x594137['query']);_0xdf6d0c['filters']=_['intersection'](_0xdf6d0c[_0xa1c9('0x31')],_0xdf6d0c[_0xa1c9('0x32')]);_0x48ce34[_0xa1c9('0x34')]=_[_0xa1c9('0x35')](_0xdf6d0c[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x594137[_0xa1c9('0x32')]['fields']));_0x48ce34[_0xa1c9('0x34')]=_0x48ce34['attributes'][_0xa1c9('0x37')]?_0x48ce34['attributes']:_0xdf6d0c[_0xa1c9('0x31')];if(!_0x594137[_0xa1c9('0x32')][_0xa1c9('0x38')]('nolimit')){_0x48ce34[_0xa1c9('0x1f')]=qs[_0xa1c9('0x1f')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1f')]);_0x48ce34['offset']=qs['offset'](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1d')]);}_0x48ce34[_0xa1c9('0x39')]=qs[_0xa1c9('0x3a')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3a')]);_0x48ce34[_0xa1c9('0x3b')]=qs[_0xa1c9('0x3c')](_[_0xa1c9('0x3d')](_0x594137[_0xa1c9('0x32')],_0xdf6d0c['filters']),_0x88ba11);if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]){_0x48ce34[_0xa1c9('0x3b')]=_[_0xa1c9('0x3f')](_0x48ce34[_0xa1c9('0x3b')],{'$or':_[_0xa1c9('0x2d')](_0x88ba11,function(_0x5011a3){if(_0x5011a3[_0xa1c9('0x40')]!==_0xa1c9('0x41')){var _0x29d871={};_0x29d871[_0x5011a3['name']]={'$like':'%'+_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]+'%'};return _0x29d871;}})});}_0x48ce34=_['merge']({},_0x48ce34,_0x594137[_0xa1c9('0x42')]);var _0x25502f={'where':_0x48ce34['where']};return db['MailQueueReport'][_0xa1c9('0x20')](_0x25502f)[_0xa1c9('0x27')](function(_0x34a6b8){_0x2404c3[_0xa1c9('0x20')]=_0x34a6b8;if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x48ce34[_0xa1c9('0x44')]=[{'all':!![]}];}return db[_0xa1c9('0x2e')][_0xa1c9('0x45')](_0x48ce34);})[_0xa1c9('0x27')](function(_0x5ac71f){_0x2404c3['rows']=_0x5ac71f;return _0x2404c3;})[_0xa1c9('0x27')](respondWithFilteredResult(_0x38936f,_0x48ce34))[_0xa1c9('0x46')](handleError(_0x38936f,null));};exports['show']=function(_0x30ce3b,_0x102a33){var _0x43de42={'raw':!![],'where':{'id':_0x30ce3b[_0xa1c9('0x47')]['id']}},_0x36c846={};_0x36c846[_0xa1c9('0x31')]=_[_0xa1c9('0x33')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')]);_0x36c846[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x30ce3b['query']);_0x36c846[_0xa1c9('0x3c')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],_0x36c846['query']);_0x43de42[_0xa1c9('0x34')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x30ce3b['query'][_0xa1c9('0x36')]));_0x43de42[_0xa1c9('0x34')]=_0x43de42['attributes'][_0xa1c9('0x37')]?_0x43de42[_0xa1c9('0x34')]:_0x36c846[_0xa1c9('0x31')];if(_0x30ce3b[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x43de42[_0xa1c9('0x44')]=[{'all':!![]}];}_0x43de42=_['merge']({},_0x43de42,_0x30ce3b[_0xa1c9('0x42')]);return db[_0xa1c9('0x2e')][_0xa1c9('0x48')](_0x43de42)[_0xa1c9('0x27')](handleEntityNotFound(_0x102a33,null))[_0xa1c9('0x27')](respondWithResult(_0x102a33,null))['catch'](handleError(_0x102a33,null));};exports['create']=function(_0x4cf00a,_0x15329c){return db[_0xa1c9('0x2e')][_0xa1c9('0x49')](_0x4cf00a['body'],{})[_0xa1c9('0x27')](respondWithResult(_0x15329c,0xc9))[_0xa1c9('0x46')](handleError(_0x15329c,null));};exports['update']=function(_0x43ee79,_0x4bdf5d){if(_0x43ee79['body']['id']){delete _0x43ee79[_0xa1c9('0x4a')]['id'];}return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x43ee79[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x4bdf5d,null))[_0xa1c9('0x27')](saveUpdates(_0x43ee79[_0xa1c9('0x4a')],null))[_0xa1c9('0x27')](respondWithResult(_0x4bdf5d,null))[_0xa1c9('0x46')](handleError(_0x4bdf5d,null));};exports[_0xa1c9('0x28')]=function(_0x2b2065,_0x1bed85){return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x2b2065[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x1bed85,null))[_0xa1c9('0x27')](removeEntity(_0x1bed85,null))[_0xa1c9('0x46')](handleError(_0x1bed85,null));};exports[_0xa1c9('0x4b')]=function(_0x4a968e,_0x55dc05){return db[_0xa1c9('0x2e')][_0xa1c9('0x4b')]()[_0xa1c9('0x27')](respondWithResult(_0x55dc05,null))[_0xa1c9('0x46')](handleError(_0x55dc05,null));}; \ No newline at end of file +var _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','MailQueueReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['MailQueueReport'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':!![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['MailQueueReport'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['MailQueueReport'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0eba6ab..03c4d7c 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 _0x3573=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','MailQueueReport','uniqueid'];(function(_0x15e244,_0x5370a1){var _0x82164f=function(_0x113c5e){while(--_0x113c5e){_0x15e244['push'](_0x15e244['shift']());}};_0x82164f(++_0x5370a1);}(_0x3573,0x15e));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3357('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3357('0x1'));var moment=require(_0x3357('0x2'));var BPromise=require(_0x3357('0x3'));var rp=require(_0x3357('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3357('0x5'));var config=require(_0x3357('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x3357('0x7')]=function(_0x1cd7eb,_0x3787ff){return _0x1cd7eb['define'](_0x3357('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x3357('0x9'),'fields':[_0x3357('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f5d=['define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x53a7bf,_0x59ddd5){var _0x3caa37=function(_0x2370df){while(--_0x2370df){_0x53a7bf['push'](_0x53a7bf['shift']());}};_0x3caa37(++_0x59ddd5);}(_0x8f5d,0xc6));var _0xd8f5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8f5d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd8f5('0x0'));var util=require(_0xd8f5('0x1'));var logger=require(_0xd8f5('0x2'))(_0xd8f5('0x3'));var moment=require(_0xd8f5('0x4'));var BPromise=require(_0xd8f5('0x5'));var rp=require(_0xd8f5('0x6'));var fs=require('fs');var path=require(_0xd8f5('0x7'));var rimraf=require('rimraf');var config=require(_0xd8f5('0x8'));var attributes=require(_0xd8f5('0x9'));module['exports']=function(_0x2772da,_0x46503c){return _0x2772da[_0xd8f5('0xa')]('MailQueueReport',attributes,{'tableName':_0xd8f5('0xb'),'paranoid':![],'indexes':[{'name':_0xd8f5('0xc'),'fields':[_0xd8f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9fd61d1..c45ba9e 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2721e8,_0x436e5c){var _0x39769a=function(_0x5f29f7){while(--_0x5f29f7){_0x2721e8['push'](_0x2721e8['shift']());}};_0x39769a(++_0x436e5c);}(_0x326f,0xd1));var _0xf326=function(_0x40b181,_0x562da9){_0x40b181=_0x40b181-0x0;var _0x306c75=_0x326f[_0x40b181];return _0x306c75;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x5b4d06,_0x3edc8d){var _0xad4053=function(_0x1e2748){while(--_0x1e2748){_0x5b4d06['push'](_0x5b4d06['shift']());}};_0xad4053(++_0x3edc8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c7d38,_0x55c09c){_0x5c7d38=_0x5c7d38-0x0;var _0x3afd2a=_0x2ef3[_0x5c7d38];return _0x3afd2a;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 871a16f..c651f73 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5e608c,_0x453591){var _0x44d7fc=function(_0xc9de57){while(--_0xc9de57){_0x5e608c['push'](_0x5e608c['shift']());}};_0x44d7fc(++_0x453591);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xd73361,_0x1af4cb){var _0x394fc4=function(_0x89bb8f){while(--_0x89bb8f){_0xd73361['push'](_0xd73361['shift']());}};_0x394fc4(++_0x1af4cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xcb91[_0x18aaaf];return _0x52d892;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 49eb13c..d435c91 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 _0xff94=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x1175c2,_0x1c2457){var _0x9890f=function(_0x4e4951){while(--_0x4e4951){_0x1175c2['push'](_0x1175c2['shift']());}};_0x9890f(++_0x1c2457);}(_0xff94,0x1e6));var _0x4ff9=function(_0xcdb1d,_0x332d7a){_0xcdb1d=_0xcdb1d-0x0;var _0x4cac58=_0xff94[_0xcdb1d];return _0x4cac58;};'use strict';var Sequelize=require(_0x4ff9('0x0'));module[_0x4ff9('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4ff9('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4ff9('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4ff9('0x3')]},'tls':{'type':Sequelize[_0x4ff9('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4ff9('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4ff9('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4ff9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa205=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x3379b3,_0x1e327c){var _0x521f7e=function(_0x4f674e){while(--_0x4f674e){_0x3379b3['push'](_0x3379b3['shift']());}};_0x521f7e(++_0x1e327c);}(_0xa205,0x1f4));var _0x5a20=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xa205[_0x388b47];return _0x4859df;};'use strict';var Sequelize=require(_0x5a20('0x0'));module[_0x5a20('0x1')]={'description':{'type':Sequelize[_0x5a20('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x5a20('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5a20('0x2')]},'password':{'type':Sequelize[_0x5a20('0x2')]},'port':{'type':Sequelize[_0x5a20('0x4')]},'tls':{'type':Sequelize[_0x5a20('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5a20('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5a20('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0cb7187..3cc6696 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 _0xdc03=['bluebird','request-promise','path','rimraf','../../config/environment','exports','MailServerIn','../../config/logger','api','moment'];(function(_0x117a6b,_0x591f95){var _0x5d94b4=function(_0xb0a17e){while(--_0xb0a17e){_0x117a6b['push'](_0x117a6b['shift']());}};_0x5d94b4(++_0x591f95);}(_0xdc03,0xb1));var _0x3dc0=function(_0x3db546,_0x4d8320){_0x3db546=_0x3db546-0x0;var _0x530921=_0xdc03[_0x3db546];return _0x530921;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dc0('0x0'))(_0x3dc0('0x1'));var moment=require(_0x3dc0('0x2'));var BPromise=require(_0x3dc0('0x3'));var rp=require(_0x3dc0('0x4'));var fs=require('fs');var path=require(_0x3dc0('0x5'));var rimraf=require(_0x3dc0('0x6'));var config=require(_0x3dc0('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x3dc0('0x8')]=function(_0x3454d7,_0x27b7c3){return _0x3454d7['define'](_0x3dc0('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4382=['bluebird','request-promise','path','rimraf','../../config/environment','MailServerIn','mail_servers_in','util','../../config/logger','api'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0x4382,0xbb));var _0x2438=function(_0x5c0b3e,_0x5f0051){_0x5c0b3e=_0x5c0b3e-0x0;var _0x39d82f=_0x4382[_0x5c0b3e];return _0x39d82f;};'use strict';var _=require('lodash');var util=require(_0x2438('0x0'));var logger=require(_0x2438('0x1'))(_0x2438('0x2'));var moment=require('moment');var BPromise=require(_0x2438('0x3'));var rp=require(_0x2438('0x4'));var fs=require('fs');var path=require(_0x2438('0x5'));var rimraf=require(_0x2438('0x6'));var config=require(_0x2438('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x76df5f,_0x1ece3d){return _0x76df5f['define'](_0x2438('0x8'),attributes,{'tableName':_0x2438('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 348f152..3540348 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 _0x4e61=['map','model','GetMailServerIn','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','MailServerIn,\x20%s,\x20%s','result','catch','MailServerIn','options','raw','where','attributes','limit','include'];(function(_0x5b68af,_0x5bcf1b){var _0x29caf4=function(_0xaefbf){while(--_0xaefbf){_0x5b68af['push'](_0x5b68af['shift']());}};_0x29caf4(++_0x5bcf1b);}(_0x4e61,0x8c));var _0x14e6=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x4e61[_0x297c55];return _0x120389;};'use strict';var _=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var moment=require(_0x14e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e6('0x3'));var db=require(_0x14e6('0x4'))['db'];var utils=require(_0x14e6('0x5'));var logger=require(_0x14e6('0x6'))(_0x14e6('0x7'));var config=require(_0x14e6('0x8'));var jayson=require(_0x14e6('0x9'));var client=jayson[_0x14e6('0xa')][_0x14e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9f9c31,_0x2a5bc1,_0x91ca48){return new BPromise(function(_0x34b4eb,_0x1200e5){return client[_0x14e6('0xc')](_0x9f9c31,_0x91ca48)[_0x14e6('0xd')](function(_0x17eeed){logger[_0x14e6('0xe')]('MailServerIn,\x20%s,\x20%s',_0x2a5bc1,_0x14e6('0xf'));logger[_0x14e6('0x10')](_0x14e6('0x11'),_0x2a5bc1,_0x14e6('0xf'),JSON['stringify'](_0x17eeed));if(_0x17eeed['error']){if(_0x17eeed['error']['code']===0x1f4){logger[_0x14e6('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2a5bc1,_0x17eeed['error'][_0x14e6('0x13')]);return _0x1200e5(_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);}logger['error'](_0x14e6('0x14'),_0x2a5bc1,_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);return _0x34b4eb(_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);}else{logger['info'](_0x14e6('0x14'),_0x2a5bc1,_0x14e6('0xf'));_0x34b4eb(_0x17eeed[_0x14e6('0x15')][_0x14e6('0x13')]);}})[_0x14e6('0x16')](function(_0x4d6d42){logger[_0x14e6('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2a5bc1,_0x4d6d42);_0x1200e5(_0x4d6d42);});});}exports['GetMailServerIn']=function(_0x4f40b0){var _0x12fc87=this;return new Promise(function(_0x16b937,_0xbcf29e){return db[_0x14e6('0x17')]['findAll']({'raw':_0x4f40b0['options']?_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x19')]===undefined?!![]:![]:!![],'where':_0x4f40b0[_0x14e6('0x18')]?_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x1a')]||null:null,'attributes':_0x4f40b0[_0x14e6('0x18')]?_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x1b')]||null:null,'limit':_0x4f40b0[_0x14e6('0x18')]?_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x1c')]||null:null,'include':_0x4f40b0[_0x14e6('0x18')]?_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x1d')]?_[_0x14e6('0x1e')](_0x4f40b0[_0x14e6('0x18')][_0x14e6('0x1d')],function(_0x129e50){return{'model':db[_0x129e50[_0x14e6('0x1f')]],'as':_0x129e50['as'],'attributes':_0x129e50[_0x14e6('0x1b')],'include':_0x129e50[_0x14e6('0x1d')]?_['map'](_0x129e50[_0x14e6('0x1d')],function(_0x2a3807){return{'model':db[_0x2a3807[_0x14e6('0x1f')]],'as':_0x2a3807['as'],'attributes':_0x2a3807[_0x14e6('0x1b')],'include':_0x2a3807[_0x14e6('0x1d')]?_[_0x14e6('0x1e')](_0x2a3807[_0x14e6('0x1d')],function(_0x529bb7){return{'model':db[_0x529bb7[_0x14e6('0x1f')]],'as':_0x529bb7['as'],'attributes':_0x529bb7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a504){logger[_0x14e6('0xe')]('GetMailServerIn',_0x4f40b0);logger[_0x14e6('0x10')](_0x14e6('0x20'),_0x4f40b0,JSON[_0x14e6('0x21')](_0x57a504));_0x16b937(_0x57a504);})['catch'](function(_0x3395b1){logger[_0x14e6('0x12')](_0x14e6('0x20'),_0x3395b1['message'],_0x4f40b0);_0xbcf29e(_0x12fc87[_0x14e6('0x12')](0x1f4,_0x3395b1[_0x14e6('0x13')]));});});}; \ No newline at end of file +var _0xb95d=['debug','request\x20sent','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xb95d,0x1c5));var _0xdb95=function(_0x2d8efc,_0x58e635){_0x2d8efc=_0x2d8efc-0x0;var _0x4a7f2d=_0xb95d[_0x2d8efc];return _0x4a7f2d;};'use strict';var _=require(_0xdb95('0x0'));var util=require('util');var moment=require(_0xdb95('0x1'));var BPromise=require(_0xdb95('0x2'));var rs=require(_0xdb95('0x3'));var fs=require('fs');var Redis=require(_0xdb95('0x4'));var db=require(_0xdb95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb95('0x6'))(_0xdb95('0x7'));var config=require(_0xdb95('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f892,_0x526075,_0x43df2c){return new BPromise(function(_0x41a17b,_0x2e0fbd){return client[_0xdb95('0xa')](_0x52f892,_0x43df2c)['then'](function(_0x255352){logger[_0xdb95('0xb')]('MailServerIn,\x20%s,\x20%s',_0x526075,'request\x20sent');logger[_0xdb95('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x526075,_0xdb95('0xd'),JSON[_0xdb95('0xe')](_0x255352));if(_0x255352[_0xdb95('0xf')]){if(_0x255352[_0xdb95('0xf')][_0xdb95('0x10')]===0x1f4){logger[_0xdb95('0xf')](_0xdb95('0x11'),_0x526075,_0x255352[_0xdb95('0xf')][_0xdb95('0x12')]);return _0x2e0fbd(_0x255352['error']['message']);}logger[_0xdb95('0xf')](_0xdb95('0x11'),_0x526075,_0x255352['error'][_0xdb95('0x12')]);return _0x41a17b(_0x255352[_0xdb95('0xf')][_0xdb95('0x12')]);}else{logger['info'](_0xdb95('0x11'),_0x526075,_0xdb95('0xd'));_0x41a17b(_0x255352[_0xdb95('0x13')][_0xdb95('0x12')]);}})[_0xdb95('0x14')](function(_0x2ea38f){logger['error']('MailServerIn,\x20%s,\x20%s',_0x526075,_0x2ea38f);_0x2e0fbd(_0x2ea38f);});});}exports[_0xdb95('0x15')]=function(_0x1ac252){var _0x1416ab=this;return new Promise(function(_0xa8d1ac,_0x4f397c){return db[_0xdb95('0x16')][_0xdb95('0x17')]({'raw':_0x1ac252['options']?_0x1ac252[_0xdb95('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1ac252[_0xdb95('0x18')]?_0x1ac252[_0xdb95('0x18')]['where']||null:null,'attributes':_0x1ac252[_0xdb95('0x18')]?_0x1ac252[_0xdb95('0x18')][_0xdb95('0x19')]||null:null,'limit':_0x1ac252[_0xdb95('0x18')]?_0x1ac252[_0xdb95('0x18')][_0xdb95('0x1a')]||null:null,'include':_0x1ac252[_0xdb95('0x18')]?_0x1ac252[_0xdb95('0x18')][_0xdb95('0x1b')]?_[_0xdb95('0x1c')](_0x1ac252[_0xdb95('0x18')][_0xdb95('0x1b')],function(_0x10b300){return{'model':db[_0x10b300[_0xdb95('0x1d')]],'as':_0x10b300['as'],'attributes':_0x10b300[_0xdb95('0x19')],'include':_0x10b300[_0xdb95('0x1b')]?_[_0xdb95('0x1c')](_0x10b300[_0xdb95('0x1b')],function(_0x506452){return{'model':db[_0x506452[_0xdb95('0x1d')]],'as':_0x506452['as'],'attributes':_0x506452[_0xdb95('0x19')],'include':_0x506452[_0xdb95('0x1b')]?_[_0xdb95('0x1c')](_0x506452[_0xdb95('0x1b')],function(_0x2dda22){return{'model':db[_0x2dda22[_0xdb95('0x1d')]],'as':_0x2dda22['as'],'attributes':_0x2dda22['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb95('0x1e')](function(_0x5d6801){logger[_0xdb95('0xb')](_0xdb95('0x15'),_0x1ac252);logger[_0xdb95('0xc')](_0xdb95('0x15'),_0x1ac252,JSON[_0xdb95('0xe')](_0x5d6801));_0xa8d1ac(_0x5d6801);})[_0xdb95('0x14')](function(_0xe8bfc){logger['error'](_0xdb95('0x15'),_0xe8bfc[_0xdb95('0x12')],_0x1ac252);_0x4f397c(_0x1416ab[_0xdb95('0xf')](0x1f4,_0xe8bfc[_0xdb95('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9bd32ff..7bb99b9 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(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_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('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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x493364,_0x494cc8){_0x493364=_0x493364-0x0;var _0x27db5c=_0x7a54[_0x493364];return _0x27db5c;};'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 6e789e7..095d3a4 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 _0x9348=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5f170f,_0x553d8e){var _0x2419de=function(_0x2f54f9){while(--_0x2f54f9){_0x5f170f['push'](_0x5f170f['shift']());}};_0x2419de(++_0x553d8e);}(_0x9348,0x10d));var _0x8934=function(_0x223f88,_0x4bdede){_0x223f88=_0x223f88-0x0;var _0x2ecc84=_0x9348[_0x223f88];return _0x2ecc84;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'description':{'type':Sequelize[_0x8934('0x2')]},'host':{'type':Sequelize[_0x8934('0x2')]},'user':{'type':Sequelize[_0x8934('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8934('0x3')]},'secure':{'type':Sequelize[_0x8934('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8934('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8934('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x36ee=['BOOLEAN','STRING','INTEGER'];(function(_0x1e4d7e,_0x45e3ba){var _0x275eb3=function(_0x4c91e9){while(--_0x4c91e9){_0x1e4d7e['push'](_0x1e4d7e['shift']());}};_0x275eb3(++_0x45e3ba);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe36e('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe36e('0x0')]},'pass':{'type':Sequelize[_0xe36e('0x0')]},'port':{'type':Sequelize[_0xe36e('0x1')]},'secure':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xe36e('0x0')]},'authentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index cb0c4ab..efe58f5 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 _0x81b3=['util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','count','includeAll','include','findAll','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1fc1ee,_0x27bc3c){var _0x59c841=function(_0x490c80){while(--_0x490c80){_0x1fc1ee['push'](_0x1fc1ee['shift']());}};_0x59c841(++_0x27bc3c);}(_0x81b3,0x1b5));var _0x381b=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x81b3[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0x381b('0x0'));var rimraf=require(_0x381b('0x1'));var zipdir=require(_0x381b('0x2'));var jsonpatch=require(_0x381b('0x3'));var rp=require(_0x381b('0x4'));var moment=require('moment');var BPromise=require(_0x381b('0x5'));var Mustache=require(_0x381b('0x6'));var util=require(_0x381b('0x7'));var path=require(_0x381b('0x8'));var sox=require(_0x381b('0x9'));var csv=require(_0x381b('0xa'));var ejs=require(_0x381b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x381b('0xc'));var crypto=require('crypto');var jsforce=require(_0x381b('0xd'));var deskjs=require(_0x381b('0xe'));var toCsv=require(_0x381b('0xa'));var querystring=require(_0x381b('0xf'));var Papa=require(_0x381b('0x10'));var Redis=require(_0x381b('0x11'));var authService=require(_0x381b('0x12'));var qs=require(_0x381b('0x13'));var as=require(_0x381b('0x14'));var hardwareService=require(_0x381b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x381b('0x16'));var licenseUtil=require(_0x381b('0x17'));var db=require(_0x381b('0x18'))['db'];function respondWithStatusCode(_0x36552e,_0x2490e9){_0x2490e9=_0x2490e9||0xcc;return function(_0x1bc846){if(_0x1bc846){return _0x36552e[_0x381b('0x19')](_0x2490e9);}return _0x36552e[_0x381b('0x1a')](_0x2490e9)[_0x381b('0x1b')]();};}function respondWithResult(_0x1d76a9,_0x536912){_0x536912=_0x536912||0xc8;return function(_0x55752f){if(_0x55752f){return _0x1d76a9['status'](_0x536912)[_0x381b('0x1c')](_0x55752f);}};}function respondWithFilteredResult(_0x3dd15b,_0xa256c9){return function(_0x82e4c6){if(_0x82e4c6){var _0x3281dc=typeof _0xa256c9[_0x381b('0x1d')]===_0x381b('0x1e')&&typeof _0xa256c9[_0x381b('0x1f')]===_0x381b('0x1e');var _0x27b0da=_0x82e4c6['count'];var _0x582bfa=_0x3281dc?0x0:_0xa256c9['offset'];var _0x2d1867=_0x3281dc?_0x82e4c6['count']:_0xa256c9[_0x381b('0x1d')]+_0xa256c9[_0x381b('0x1f')];var _0x5e2dfa;if(_0x2d1867>=_0x27b0da){_0x2d1867=_0x27b0da;_0x5e2dfa=0xc8;}else{_0x5e2dfa=0xce;}_0x3dd15b[_0x381b('0x1a')](_0x5e2dfa);return _0x3dd15b[_0x381b('0x20')]('Content-Range',_0x582bfa+'-'+_0x2d1867+'/'+_0x27b0da)[_0x381b('0x1c')](_0x82e4c6);}return null;};}function patchUpdates(_0x1b4b9a){return function(_0x4be994){try{jsonpatch['apply'](_0x4be994,_0x1b4b9a,!![]);}catch(_0x37167d){return BPromise[_0x381b('0x21')](_0x37167d);}return _0x4be994[_0x381b('0x22')]();};}function saveUpdates(_0x157871,_0x318ee2){return function(_0x5088d1){if(_0x5088d1){return _0x5088d1[_0x381b('0x23')](_0x157871)[_0x381b('0x24')](function(_0xdd4e5c){return _0xdd4e5c;});}return null;};}function removeEntity(_0x3edac8,_0x1cd3ea){return function(_0x40efa9){if(_0x40efa9){return _0x40efa9[_0x381b('0x25')]()[_0x381b('0x24')](function(){_0x3edac8['status'](0xcc)[_0x381b('0x1b')]();});}};}function handleEntityNotFound(_0x2ec1ff,_0x2d1699){return function(_0x5c2292){if(!_0x5c2292){_0x2ec1ff[_0x381b('0x19')](0x194);}return _0x5c2292;};}function handleError(_0x26de25,_0x239662){_0x239662=_0x239662||0x1f4;return function(_0x3274af){logger[_0x381b('0x26')](_0x3274af['stack']);if(_0x3274af[_0x381b('0x27')]){delete _0x3274af[_0x381b('0x27')];}_0x26de25[_0x381b('0x1a')](_0x239662)[_0x381b('0x28')](_0x3274af);};}exports[_0x381b('0x29')]=function(_0x52c32f,_0x228f59){var _0x2942f6={},_0x158509={},_0x347e27={'count':0x0,'rows':[]};var _0x4a5173=_[_0x381b('0x2a')](db[_0x381b('0x2b')][_0x381b('0x2c')],function(_0x1bc5b7){return{'name':_0x1bc5b7[_0x381b('0x2d')],'type':_0x1bc5b7[_0x381b('0x2e')]['key']};});_0x158509[_0x381b('0x2f')]=_[_0x381b('0x2a')](_0x4a5173,'name');_0x158509['query']=_[_0x381b('0x30')](_0x52c32f['query']);_0x158509['filters']=_[_0x381b('0x31')](_0x158509[_0x381b('0x2f')],_0x158509[_0x381b('0x32')]);_0x2942f6[_0x381b('0x33')]=_[_0x381b('0x31')](_0x158509[_0x381b('0x2f')],qs[_0x381b('0x34')](_0x52c32f[_0x381b('0x32')][_0x381b('0x34')]));_0x2942f6[_0x381b('0x33')]=_0x2942f6['attributes'][_0x381b('0x35')]?_0x2942f6['attributes']:_0x158509['model'];if(!_0x52c32f[_0x381b('0x32')][_0x381b('0x36')](_0x381b('0x37'))){_0x2942f6[_0x381b('0x1f')]=qs[_0x381b('0x1f')](_0x52c32f[_0x381b('0x32')][_0x381b('0x1f')]);_0x2942f6['offset']=qs[_0x381b('0x1d')](_0x52c32f[_0x381b('0x32')][_0x381b('0x1d')]);}_0x2942f6[_0x381b('0x38')]=qs['sort'](_0x52c32f[_0x381b('0x32')][_0x381b('0x39')]);_0x2942f6['where']=qs[_0x381b('0x3a')](_[_0x381b('0x3b')](_0x52c32f[_0x381b('0x32')],_0x158509[_0x381b('0x3a')]),_0x4a5173);if(_0x52c32f['query'][_0x381b('0x3c')]){_0x2942f6[_0x381b('0x3d')]=_[_0x381b('0x3e')](_0x2942f6[_0x381b('0x3d')],{'$or':_['map'](_0x4a5173,function(_0x1b3cab){if(_0x1b3cab['type']!=='VIRTUAL'){var _0x69efcc={};_0x69efcc[_0x1b3cab[_0x381b('0x27')]]={'$like':'%'+_0x52c32f['query'][_0x381b('0x3c')]+'%'};return _0x69efcc;}})});}_0x2942f6=_[_0x381b('0x3e')]({},_0x2942f6,_0x52c32f[_0x381b('0x3f')]);var _0x495499={'where':_0x2942f6[_0x381b('0x3d')]};return db['MailServerOut'][_0x381b('0x40')](_0x495499)['then'](function(_0x5684bd){_0x347e27['count']=_0x5684bd;if(_0x52c32f[_0x381b('0x32')][_0x381b('0x41')]){_0x2942f6[_0x381b('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x381b('0x43')](_0x2942f6);})['then'](function(_0x5513d6){_0x347e27['rows']=_0x5513d6;return _0x347e27;})['then'](respondWithFilteredResult(_0x228f59,_0x2942f6))[_0x381b('0x44')](handleError(_0x228f59,null));};exports[_0x381b('0x45')]=function(_0x27356a,_0x52ebd0){var _0x43c49e={'raw':!![],'where':{'id':_0x27356a['params']['id']}},_0x227d3f={};_0x227d3f[_0x381b('0x2f')]=_[_0x381b('0x30')](db[_0x381b('0x2b')]['rawAttributes']);_0x227d3f[_0x381b('0x32')]=_[_0x381b('0x30')](_0x27356a[_0x381b('0x32')]);_0x227d3f['filters']=_[_0x381b('0x31')](_0x227d3f[_0x381b('0x2f')],_0x227d3f[_0x381b('0x32')]);_0x43c49e[_0x381b('0x33')]=_[_0x381b('0x31')](_0x227d3f[_0x381b('0x2f')],qs[_0x381b('0x34')](_0x27356a['query'][_0x381b('0x34')]));_0x43c49e[_0x381b('0x33')]=_0x43c49e[_0x381b('0x33')][_0x381b('0x35')]?_0x43c49e[_0x381b('0x33')]:_0x227d3f[_0x381b('0x2f')];if(_0x27356a[_0x381b('0x32')][_0x381b('0x41')]){_0x43c49e[_0x381b('0x42')]=[{'all':!![]}];}_0x43c49e=_[_0x381b('0x3e')]({},_0x43c49e,_0x27356a[_0x381b('0x3f')]);return db[_0x381b('0x2b')]['find'](_0x43c49e)['then'](handleEntityNotFound(_0x52ebd0,null))[_0x381b('0x24')](respondWithResult(_0x52ebd0,null))[_0x381b('0x44')](handleError(_0x52ebd0,null));};exports[_0x381b('0x46')]=function(_0x516c78,_0x3413c1){return db['MailServerOut'][_0x381b('0x46')](_0x516c78['body'],{})[_0x381b('0x24')](respondWithResult(_0x3413c1,0xc9))['catch'](handleError(_0x3413c1,null));};exports['update']=function(_0x2de118,_0x3a1f89){if(_0x2de118[_0x381b('0x47')]['id']){delete _0x2de118[_0x381b('0x47')]['id'];}return db[_0x381b('0x2b')][_0x381b('0x48')]({'where':{'id':_0x2de118[_0x381b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a1f89,null))[_0x381b('0x24')](saveUpdates(_0x2de118['body'],null))[_0x381b('0x24')](respondWithResult(_0x3a1f89,null))['catch'](handleError(_0x3a1f89,null));};exports[_0x381b('0x25')]=function(_0x212794,_0x30ce5e){return db[_0x381b('0x2b')][_0x381b('0x48')]({'where':{'id':_0x212794[_0x381b('0x49')]['id']}})[_0x381b('0x24')](handleEntityNotFound(_0x30ce5e,null))[_0x381b('0x24')](removeEntity(_0x30ce5e,null))[_0x381b('0x44')](handleError(_0x30ce5e,null));}; \ No newline at end of file +var _0xf934=['apply','reject','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','find','create','body','params','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','offset','limit','Content-Range','json'];(function(_0x5c47d8,_0x47eff2){var _0x5988c7=function(_0x4eb1db){while(--_0x4eb1db){_0x5c47d8['push'](_0x5c47d8['shift']());}};_0x5988c7(++_0x47eff2);}(_0xf934,0x19c));var _0x4f93=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf934[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f93('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f93('0x1'));var rp=require('request-promise');var moment=require(_0x4f93('0x2'));var BPromise=require(_0x4f93('0x3'));var Mustache=require(_0x4f93('0x4'));var util=require(_0x4f93('0x5'));var path=require(_0x4f93('0x6'));var sox=require(_0x4f93('0x7'));var csv=require('to-csv');var ejs=require(_0x4f93('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f93('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f93('0xa'));var deskjs=require(_0x4f93('0xb'));var toCsv=require(_0x4f93('0xc'));var querystring=require(_0x4f93('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f93('0xe'));var authService=require(_0x4f93('0xf'));var qs=require(_0x4f93('0x10'));var as=require(_0x4f93('0x11'));var hardwareService=require(_0x4f93('0x12'));var logger=require(_0x4f93('0x13'))(_0x4f93('0x14'));var utils=require(_0x4f93('0x15'));var config=require(_0x4f93('0x16'));var licenseUtil=require(_0x4f93('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e54d1,_0x2665f4){_0x2665f4=_0x2665f4||0xcc;return function(_0x5a557b){if(_0x5a557b){return _0x3e54d1[_0x4f93('0x18')](_0x2665f4);}return _0x3e54d1[_0x4f93('0x19')](_0x2665f4)[_0x4f93('0x1a')]();};}function respondWithResult(_0x4ac894,_0x311231){_0x311231=_0x311231||0xc8;return function(_0x3a3024){if(_0x3a3024){return _0x4ac894[_0x4f93('0x19')](_0x311231)['json'](_0x3a3024);}};}function respondWithFilteredResult(_0x2b63cb,_0x1aa234){return function(_0x582931){if(_0x582931){var _0x34a30f=typeof _0x1aa234['offset']==='undefined'&&typeof _0x1aa234['limit']===_0x4f93('0x1b');var _0x58898d=_0x582931['count'];var _0x1dd183=_0x34a30f?0x0:_0x1aa234[_0x4f93('0x1c')];var _0xb0e682=_0x34a30f?_0x582931['count']:_0x1aa234[_0x4f93('0x1c')]+_0x1aa234[_0x4f93('0x1d')];var _0x2eb657;if(_0xb0e682>=_0x58898d){_0xb0e682=_0x58898d;_0x2eb657=0xc8;}else{_0x2eb657=0xce;}_0x2b63cb[_0x4f93('0x19')](_0x2eb657);return _0x2b63cb['set'](_0x4f93('0x1e'),_0x1dd183+'-'+_0xb0e682+'/'+_0x58898d)[_0x4f93('0x1f')](_0x582931);}return null;};}function patchUpdates(_0x272364){return function(_0x3badcf){try{jsonpatch[_0x4f93('0x20')](_0x3badcf,_0x272364,!![]);}catch(_0x1fe9cc){return BPromise[_0x4f93('0x21')](_0x1fe9cc);}return _0x3badcf['save']();};}function saveUpdates(_0x3f7630,_0x4462a3){return function(_0x5c8531){if(_0x5c8531){return _0x5c8531[_0x4f93('0x22')](_0x3f7630)[_0x4f93('0x23')](function(_0x1fc53a){return _0x1fc53a;});}return null;};}function removeEntity(_0x15cb26,_0x4c05f4){return function(_0x4f0414){if(_0x4f0414){return _0x4f0414[_0x4f93('0x24')]()[_0x4f93('0x23')](function(){_0x15cb26[_0x4f93('0x19')](0xcc)[_0x4f93('0x1a')]();});}};}function handleEntityNotFound(_0x19d08b,_0x206756){return function(_0x23b9b8){if(!_0x23b9b8){_0x19d08b[_0x4f93('0x18')](0x194);}return _0x23b9b8;};}function handleError(_0x9557c4,_0x212c51){_0x212c51=_0x212c51||0x1f4;return function(_0xa84542){logger[_0x4f93('0x25')](_0xa84542[_0x4f93('0x26')]);if(_0xa84542[_0x4f93('0x27')]){delete _0xa84542[_0x4f93('0x27')];}_0x9557c4['status'](_0x212c51)[_0x4f93('0x28')](_0xa84542);};}exports[_0x4f93('0x29')]=function(_0x21a51c,_0x5009b9){var _0x49f5a4={},_0x1888e9={},_0x47a1cf={'count':0x0,'rows':[]};var _0x5cc92a=_['map'](db[_0x4f93('0x2a')][_0x4f93('0x2b')],function(_0x4dc270){return{'name':_0x4dc270[_0x4f93('0x2c')],'type':_0x4dc270['type']['key']};});_0x1888e9[_0x4f93('0x2d')]=_[_0x4f93('0x2e')](_0x5cc92a,_0x4f93('0x27'));_0x1888e9[_0x4f93('0x2f')]=_[_0x4f93('0x30')](_0x21a51c['query']);_0x1888e9['filters']=_[_0x4f93('0x31')](_0x1888e9[_0x4f93('0x2d')],_0x1888e9['query']);_0x49f5a4[_0x4f93('0x32')]=_[_0x4f93('0x31')](_0x1888e9[_0x4f93('0x2d')],qs[_0x4f93('0x33')](_0x21a51c[_0x4f93('0x2f')][_0x4f93('0x33')]));_0x49f5a4[_0x4f93('0x32')]=_0x49f5a4[_0x4f93('0x32')][_0x4f93('0x34')]?_0x49f5a4[_0x4f93('0x32')]:_0x1888e9[_0x4f93('0x2d')];if(!_0x21a51c['query'][_0x4f93('0x35')](_0x4f93('0x36'))){_0x49f5a4['limit']=qs[_0x4f93('0x1d')](_0x21a51c[_0x4f93('0x2f')][_0x4f93('0x1d')]);_0x49f5a4[_0x4f93('0x1c')]=qs[_0x4f93('0x1c')](_0x21a51c[_0x4f93('0x2f')]['offset']);}_0x49f5a4[_0x4f93('0x37')]=qs[_0x4f93('0x38')](_0x21a51c[_0x4f93('0x2f')][_0x4f93('0x38')]);_0x49f5a4[_0x4f93('0x39')]=qs[_0x4f93('0x3a')](_['pick'](_0x21a51c[_0x4f93('0x2f')],_0x1888e9[_0x4f93('0x3a')]),_0x5cc92a);if(_0x21a51c[_0x4f93('0x2f')]['filter']){_0x49f5a4[_0x4f93('0x39')]=_[_0x4f93('0x3b')](_0x49f5a4[_0x4f93('0x39')],{'$or':_[_0x4f93('0x2e')](_0x5cc92a,function(_0x11e5fb){if(_0x11e5fb[_0x4f93('0x3c')]!==_0x4f93('0x3d')){var _0x629ef7={};_0x629ef7[_0x11e5fb['name']]={'$like':'%'+_0x21a51c[_0x4f93('0x2f')][_0x4f93('0x3e')]+'%'};return _0x629ef7;}})});}_0x49f5a4=_[_0x4f93('0x3b')]({},_0x49f5a4,_0x21a51c[_0x4f93('0x3f')]);var _0x3a224f={'where':_0x49f5a4[_0x4f93('0x39')]};return db[_0x4f93('0x2a')][_0x4f93('0x40')](_0x3a224f)[_0x4f93('0x23')](function(_0x487f6d){_0x47a1cf[_0x4f93('0x40')]=_0x487f6d;if(_0x21a51c[_0x4f93('0x2f')][_0x4f93('0x41')]){_0x49f5a4['include']=[{'all':!![]}];}return db[_0x4f93('0x2a')][_0x4f93('0x42')](_0x49f5a4);})[_0x4f93('0x23')](function(_0x1c44fc){_0x47a1cf[_0x4f93('0x43')]=_0x1c44fc;return _0x47a1cf;})['then'](respondWithFilteredResult(_0x5009b9,_0x49f5a4))['catch'](handleError(_0x5009b9,null));};exports[_0x4f93('0x44')]=function(_0x530d81,_0x408ecd){var _0x3c6532={'raw':!![],'where':{'id':_0x530d81['params']['id']}},_0x30c0f1={};_0x30c0f1[_0x4f93('0x2d')]=_[_0x4f93('0x30')](db[_0x4f93('0x2a')]['rawAttributes']);_0x30c0f1['query']=_[_0x4f93('0x30')](_0x530d81[_0x4f93('0x2f')]);_0x30c0f1[_0x4f93('0x3a')]=_['intersection'](_0x30c0f1[_0x4f93('0x2d')],_0x30c0f1[_0x4f93('0x2f')]);_0x3c6532[_0x4f93('0x32')]=_[_0x4f93('0x31')](_0x30c0f1['model'],qs['fields'](_0x530d81[_0x4f93('0x2f')]['fields']));_0x3c6532[_0x4f93('0x32')]=_0x3c6532[_0x4f93('0x32')][_0x4f93('0x34')]?_0x3c6532[_0x4f93('0x32')]:_0x30c0f1['model'];if(_0x530d81[_0x4f93('0x2f')][_0x4f93('0x41')]){_0x3c6532['include']=[{'all':!![]}];}_0x3c6532=_[_0x4f93('0x3b')]({},_0x3c6532,_0x530d81[_0x4f93('0x3f')]);return db[_0x4f93('0x2a')][_0x4f93('0x45')](_0x3c6532)[_0x4f93('0x23')](handleEntityNotFound(_0x408ecd,null))[_0x4f93('0x23')](respondWithResult(_0x408ecd,null))['catch'](handleError(_0x408ecd,null));};exports[_0x4f93('0x46')]=function(_0x5ed267,_0x5b3425){return db['MailServerOut'][_0x4f93('0x46')](_0x5ed267[_0x4f93('0x47')],{})[_0x4f93('0x23')](respondWithResult(_0x5b3425,0xc9))['catch'](handleError(_0x5b3425,null));};exports[_0x4f93('0x22')]=function(_0x2fc551,_0x24ee63){if(_0x2fc551[_0x4f93('0x47')]['id']){delete _0x2fc551[_0x4f93('0x47')]['id'];}return db[_0x4f93('0x2a')][_0x4f93('0x45')]({'where':{'id':_0x2fc551[_0x4f93('0x48')]['id']}})[_0x4f93('0x23')](handleEntityNotFound(_0x24ee63,null))['then'](saveUpdates(_0x2fc551[_0x4f93('0x47')],null))[_0x4f93('0x23')](respondWithResult(_0x24ee63,null))['catch'](handleError(_0x24ee63,null));};exports[_0x4f93('0x24')]=function(_0x4d7cd4,_0x5b2aa7){return db[_0x4f93('0x2a')][_0x4f93('0x45')]({'where':{'id':_0x4d7cd4['params']['id']}})['then'](handleEntityNotFound(_0x5b2aa7,null))['then'](removeEntity(_0x5b2aa7,null))[_0x4f93('0x49')](handleError(_0x5b2aa7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 748fab3..5a6d9ee 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 _0xf3a2=['define','MailServerOut','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0xf3a2,0x185));var _0x2f3a=function(_0x5a2ef1,_0x5740c5){_0x5a2ef1=_0x5a2ef1-0x0;var _0x673b58=_0xf3a2[_0x5a2ef1];return _0x673b58;};'use strict';var _=require(_0x2f3a('0x0'));var util=require(_0x2f3a('0x1'));var logger=require('../../config/logger')(_0x2f3a('0x2'));var moment=require('moment');var BPromise=require(_0x2f3a('0x3'));var rp=require(_0x2f3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f3a('0x5'));var config=require(_0x2f3a('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x34c08f,_0x2fa2b4){return _0x34c08f[_0x2f3a('0x7')](_0x2f3a('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe434=['define','mail_servers_out','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x4aa7e2,_0x1373af){var _0x1effa9=function(_0xc9916f){while(--_0xc9916f){_0x4aa7e2['push'](_0x4aa7e2['shift']());}};_0x1effa9(++_0x1373af);}(_0xe434,0x70));var _0x4e43=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe434[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x4e43('0x0'));var util=require('util');var logger=require(_0x4e43('0x1'))(_0x4e43('0x2'));var moment=require('moment');var BPromise=require(_0x4e43('0x3'));var rp=require(_0x4e43('0x4'));var fs=require('fs');var path=require(_0x4e43('0x5'));var rimraf=require(_0x4e43('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e43('0x7'));module[_0x4e43('0x8')]=function(_0x34ecd9,_0x1f99d0){return _0x34ecd9[_0x4e43('0x9')]('MailServerOut',attributes,{'tableName':_0x4e43('0xa'),'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 7e1f89b..f9fc3bf 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 _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(_0x9212c5,_0x240d93){var _0xc1b087=function(_0x1d7f1f){while(--_0x1d7f1f){_0x9212c5['push'](_0x9212c5['shift']());}};_0xc1b087(++_0x240d93);}(_0xdb28,0x106));var _0x8db2=function(_0x2f825a,_0x1ac545){_0x2f825a=_0x2f825a-0x0;var _0x1ba495=_0xdb28[_0x2f825a];return _0x1ba495;};'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 +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x28c870,_0x1bf349){var _0x5e4de6=function(_0x418068){while(--_0x418068){_0x28c870['push'](_0x28c870['shift']());}};_0x5e4de6(++_0x1bf349);}(_0x2ef3,0xba));var _0x32ef=function(_0x338219,_0x129de8){_0x338219=_0x338219-0x0;var _0xdeae4=_0x2ef3[_0x338219];return _0xdeae4;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c518c60..47564ab 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 _0xbaf3=['./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x475c9c,_0x5ccb2f){var _0xb2113c=function(_0x401479){while(--_0x401479){_0x475c9c['push'](_0x475c9c['shift']());}};_0xb2113c(++_0x5ccb2f);}(_0xbaf3,0x1ce));var _0x3baf=function(_0x55c4db,_0x293304){_0x55c4db=_0x55c4db-0x0;var _0x58ba84=_0xbaf3[_0x55c4db];return _0x58ba84;};'use strict';var multer=require('multer');var util=require(_0x3baf('0x0'));var path=require('path');var timeout=require(_0x3baf('0x1'));var express=require(_0x3baf('0x2'));var router=express['Router']();var fs_extra=require(_0x3baf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3baf('0x4'));var config=require(_0x3baf('0x5'));var controller=require(_0x3baf('0x6'));router[_0x3baf('0x7')]('/',auth[_0x3baf('0x8')](),controller['index']);router['get'](_0x3baf('0x9'),auth['isAuthenticated'](),controller[_0x3baf('0xa')]);router['get'](_0x3baf('0xb'),auth[_0x3baf('0x8')](),controller['show']);router[_0x3baf('0xc')]('/',auth[_0x3baf('0x8')](),controller[_0x3baf('0xd')]);router[_0x3baf('0xe')](_0x3baf('0xb'),auth['isAuthenticated'](),controller[_0x3baf('0xf')]);router[_0x3baf('0x10')]('/:id',auth[_0x3baf('0x8')](),controller[_0x3baf('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5e69=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update'];(function(_0x5a25f6,_0x3db5cb){var _0x5a524d=function(_0x11f0fd){while(--_0x11f0fd){_0x5a25f6['push'](_0x5a25f6['shift']());}};_0x5a524d(++_0x3db5cb);}(_0x5e69,0xd2));var _0x95e6=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x5e69[_0xf72786];return _0x113f3e;};'use strict';var multer=require(_0x95e6('0x0'));var util=require('util');var path=require(_0x95e6('0x1'));var timeout=require(_0x95e6('0x2'));var express=require(_0x95e6('0x3'));var router=express[_0x95e6('0x4')]();var fs_extra=require(_0x95e6('0x5'));var auth=require(_0x95e6('0x6'));var interaction=require(_0x95e6('0x7'));var config=require(_0x95e6('0x8'));var controller=require(_0x95e6('0x9'));router['get']('/',auth[_0x95e6('0xa')](),controller[_0x95e6('0xb')]);router[_0x95e6('0xc')](_0x95e6('0xd'),auth[_0x95e6('0xa')](),controller[_0x95e6('0xe')]);router[_0x95e6('0xc')](_0x95e6('0xf'),auth[_0x95e6('0xa')](),controller[_0x95e6('0x10')]);router[_0x95e6('0x11')]('/',auth[_0x95e6('0xa')](),controller['create']);router[_0x95e6('0x12')]('/:id',auth[_0x95e6('0xa')](),controller[_0x95e6('0x13')]);router[_0x95e6('0x14')](_0x95e6('0xf'),auth[_0x95e6('0xa')](),controller[_0x95e6('0x15')]);module[_0x95e6('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 61682f9..97c15d4 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 _0x199c=['STRING','name'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x199c,0x1d8));var _0xc199=function(_0x34e878,_0x391d5e){_0x34e878=_0x34e878-0x0;var _0x492722=_0x199c[_0x34e878];return _0x492722;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc199('0x0')],'unique':_0xc199('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc199('0x0')]}}; \ No newline at end of file +var _0xc9c3=['STRING'];(function(_0x46de76,_0x4b7d4f){var _0xf82dbd=function(_0xe87b7a){while(--_0xe87b7a){_0x46de76['push'](_0x46de76['shift']());}};_0xf82dbd(++_0x4b7d4f);}(_0xc9c3,0x96));var _0x3c9c=function(_0x302314,_0xcd9be3){_0x302314=_0x302314-0x0;var _0x36646c=_0xc9c3[_0x302314];return _0x36646c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3c9c('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3c9c('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 4914181..862a0ce 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 _0x87d9=['model','map','query','keys','intersection','attributes','fields','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','findAll','catch','params','rawAttributes','length','include','options','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','undefined','count','offset','limit','set','apply','save','update','then','destroy','stack','name','MailSubstatus','fieldName','type','key'];(function(_0x494b7f,_0x353334){var _0x37daf9=function(_0x11786b){while(--_0x11786b){_0x494b7f['push'](_0x494b7f['shift']());}};_0x37daf9(++_0x353334);}(_0x87d9,0xe8));var _0x987d=function(_0x4fb73e,_0x17f37d){_0x4fb73e=_0x4fb73e-0x0;var _0x14de68=_0x87d9[_0x4fb73e];return _0x14de68;};'use strict';var emlformat=require(_0x987d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x987d('0x1'));var rp=require(_0x987d('0x2'));var moment=require(_0x987d('0x3'));var BPromise=require(_0x987d('0x4'));var Mustache=require(_0x987d('0x5'));var util=require(_0x987d('0x6'));var path=require(_0x987d('0x7'));var sox=require('sox');var csv=require(_0x987d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x987d('0x9'));var _=require(_0x987d('0xa'));var squel=require(_0x987d('0xb'));var crypto=require(_0x987d('0xc'));var jsforce=require(_0x987d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x987d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x987d('0xe'));var authService=require(_0x987d('0xf'));var qs=require(_0x987d('0x10'));var as=require(_0x987d('0x11'));var hardwareService=require(_0x987d('0x12'));var logger=require(_0x987d('0x13'))(_0x987d('0x14'));var utils=require('../../config/utils');var config=require(_0x987d('0x15'));var licenseUtil=require(_0x987d('0x16'));var db=require(_0x987d('0x17'))['db'];function respondWithStatusCode(_0x38ed3b,_0x5884d3){_0x5884d3=_0x5884d3||0xcc;return function(_0x22ff7e){if(_0x22ff7e){return _0x38ed3b[_0x987d('0x18')](_0x5884d3);}return _0x38ed3b[_0x987d('0x19')](_0x5884d3)[_0x987d('0x1a')]();};}function respondWithResult(_0x38184a,_0xdbf2cf){_0xdbf2cf=_0xdbf2cf||0xc8;return function(_0x1f36d3){if(_0x1f36d3){return _0x38184a[_0x987d('0x19')](_0xdbf2cf)[_0x987d('0x1b')](_0x1f36d3);}};}function respondWithFilteredResult(_0x3c1006,_0x180812){return function(_0x30ff50){if(_0x30ff50){var _0x2c32e1=typeof _0x180812['offset']===_0x987d('0x1c')&&typeof _0x180812['limit']===_0x987d('0x1c');var _0x58eb5c=_0x30ff50[_0x987d('0x1d')];var _0x310fff=_0x2c32e1?0x0:_0x180812['offset'];var _0x163e21=_0x2c32e1?_0x30ff50[_0x987d('0x1d')]:_0x180812[_0x987d('0x1e')]+_0x180812[_0x987d('0x1f')];var _0xdac4f5;if(_0x163e21>=_0x58eb5c){_0x163e21=_0x58eb5c;_0xdac4f5=0xc8;}else{_0xdac4f5=0xce;}_0x3c1006['status'](_0xdac4f5);return _0x3c1006[_0x987d('0x20')]('Content-Range',_0x310fff+'-'+_0x163e21+'/'+_0x58eb5c)[_0x987d('0x1b')](_0x30ff50);}return null;};}function patchUpdates(_0x445bf1){return function(_0x8a1673){try{jsonpatch[_0x987d('0x21')](_0x8a1673,_0x445bf1,!![]);}catch(_0x12239a){return BPromise['reject'](_0x12239a);}return _0x8a1673[_0x987d('0x22')]();};}function saveUpdates(_0x2ca35b,_0x36f01b){return function(_0x7036d6){if(_0x7036d6){return _0x7036d6[_0x987d('0x23')](_0x2ca35b)[_0x987d('0x24')](function(_0x152a95){return _0x152a95;});}return null;};}function removeEntity(_0x409673,_0x126d17){return function(_0x4b035f){if(_0x4b035f){return _0x4b035f[_0x987d('0x25')]()[_0x987d('0x24')](function(){_0x409673[_0x987d('0x19')](0xcc)[_0x987d('0x1a')]();});}};}function handleEntityNotFound(_0x40ab9a,_0x13398e){return function(_0x111903){if(!_0x111903){_0x40ab9a['sendStatus'](0x194);}return _0x111903;};}function handleError(_0x2fb955,_0x31a69d){_0x31a69d=_0x31a69d||0x1f4;return function(_0x506d6a){logger['error'](_0x506d6a[_0x987d('0x26')]);if(_0x506d6a['name']){delete _0x506d6a[_0x987d('0x27')];}_0x2fb955[_0x987d('0x19')](_0x31a69d)['send'](_0x506d6a);};}exports['index']=function(_0x3b6691,_0x504062){var _0x4c6f1c={},_0x1a9847={},_0x4c81a2={'count':0x0,'rows':[]};var _0x4980d0=_['map'](db[_0x987d('0x28')]['rawAttributes'],function(_0xef702e){return{'name':_0xef702e[_0x987d('0x29')],'type':_0xef702e[_0x987d('0x2a')][_0x987d('0x2b')]};});_0x1a9847[_0x987d('0x2c')]=_[_0x987d('0x2d')](_0x4980d0,'name');_0x1a9847[_0x987d('0x2e')]=_[_0x987d('0x2f')](_0x3b6691[_0x987d('0x2e')]);_0x1a9847['filters']=_[_0x987d('0x30')](_0x1a9847[_0x987d('0x2c')],_0x1a9847[_0x987d('0x2e')]);_0x4c6f1c[_0x987d('0x31')]=_[_0x987d('0x30')](_0x1a9847[_0x987d('0x2c')],qs[_0x987d('0x32')](_0x3b6691[_0x987d('0x2e')][_0x987d('0x32')]));_0x4c6f1c['attributes']=_0x4c6f1c[_0x987d('0x31')]['length']?_0x4c6f1c[_0x987d('0x31')]:_0x1a9847[_0x987d('0x2c')];if(!_0x3b6691[_0x987d('0x2e')]['hasOwnProperty']('nolimit')){_0x4c6f1c[_0x987d('0x1f')]=qs[_0x987d('0x1f')](_0x3b6691[_0x987d('0x2e')][_0x987d('0x1f')]);_0x4c6f1c[_0x987d('0x1e')]=qs[_0x987d('0x1e')](_0x3b6691[_0x987d('0x2e')][_0x987d('0x1e')]);}_0x4c6f1c[_0x987d('0x33')]=qs[_0x987d('0x34')](_0x3b6691[_0x987d('0x2e')][_0x987d('0x34')]);_0x4c6f1c['where']=qs['filters'](_['pick'](_0x3b6691[_0x987d('0x2e')],_0x1a9847[_0x987d('0x35')]),_0x4980d0);if(_0x3b6691['query'][_0x987d('0x36')]){_0x4c6f1c[_0x987d('0x37')]=_[_0x987d('0x38')](_0x4c6f1c[_0x987d('0x37')],{'$or':_[_0x987d('0x2d')](_0x4980d0,function(_0x31ca36){if(_0x31ca36['type']!==_0x987d('0x39')){var _0x2e18c5={};_0x2e18c5[_0x31ca36[_0x987d('0x27')]]={'$like':'%'+_0x3b6691[_0x987d('0x2e')][_0x987d('0x36')]+'%'};return _0x2e18c5;}})});}_0x4c6f1c=_[_0x987d('0x38')]({},_0x4c6f1c,_0x3b6691['options']);var _0x32f84d={'where':_0x4c6f1c['where']};return db['MailSubstatus'][_0x987d('0x1d')](_0x32f84d)[_0x987d('0x24')](function(_0x498d70){_0x4c81a2[_0x987d('0x1d')]=_0x498d70;if(_0x3b6691[_0x987d('0x2e')][_0x987d('0x3a')]){_0x4c6f1c['include']=[{'all':!![]}];}return db[_0x987d('0x28')][_0x987d('0x3b')](_0x4c6f1c);})[_0x987d('0x24')](function(_0x13b0e6){_0x4c81a2['rows']=_0x13b0e6;return _0x4c81a2;})[_0x987d('0x24')](respondWithFilteredResult(_0x504062,_0x4c6f1c))[_0x987d('0x3c')](handleError(_0x504062,null));};exports['show']=function(_0x57586e,_0x5d9329){var _0x5a3a0a={'raw':!![],'where':{'id':_0x57586e[_0x987d('0x3d')]['id']}},_0x2148fc={};_0x2148fc[_0x987d('0x2c')]=_[_0x987d('0x2f')](db[_0x987d('0x28')][_0x987d('0x3e')]);_0x2148fc[_0x987d('0x2e')]=_[_0x987d('0x2f')](_0x57586e['query']);_0x2148fc['filters']=_['intersection'](_0x2148fc[_0x987d('0x2c')],_0x2148fc['query']);_0x5a3a0a['attributes']=_[_0x987d('0x30')](_0x2148fc[_0x987d('0x2c')],qs['fields'](_0x57586e[_0x987d('0x2e')]['fields']));_0x5a3a0a[_0x987d('0x31')]=_0x5a3a0a[_0x987d('0x31')][_0x987d('0x3f')]?_0x5a3a0a[_0x987d('0x31')]:_0x2148fc[_0x987d('0x2c')];if(_0x57586e[_0x987d('0x2e')]['includeAll']){_0x5a3a0a[_0x987d('0x40')]=[{'all':!![]}];}_0x5a3a0a=_[_0x987d('0x38')]({},_0x5a3a0a,_0x57586e[_0x987d('0x41')]);return db[_0x987d('0x28')]['find'](_0x5a3a0a)[_0x987d('0x24')](handleEntityNotFound(_0x5d9329,null))[_0x987d('0x24')](respondWithResult(_0x5d9329,null))[_0x987d('0x3c')](handleError(_0x5d9329,null));};exports[_0x987d('0x42')]=function(_0x18b7d9,_0xbd4ee2){return db[_0x987d('0x28')]['create'](_0x18b7d9[_0x987d('0x43')],{})[_0x987d('0x24')](respondWithResult(_0xbd4ee2,0xc9))[_0x987d('0x3c')](handleError(_0xbd4ee2,null));};exports[_0x987d('0x23')]=function(_0x42c293,_0x6afa90){if(_0x42c293[_0x987d('0x43')]['id']){delete _0x42c293[_0x987d('0x43')]['id'];}return db[_0x987d('0x28')]['find']({'where':{'id':_0x42c293[_0x987d('0x3d')]['id']}})[_0x987d('0x24')](handleEntityNotFound(_0x6afa90,null))['then'](saveUpdates(_0x42c293[_0x987d('0x43')],null))[_0x987d('0x24')](respondWithResult(_0x6afa90,null))['catch'](handleError(_0x6afa90,null));};exports[_0x987d('0x25')]=function(_0x241486,_0x1352e5){return db[_0x987d('0x28')]['find']({'where':{'id':_0x241486[_0x987d('0x3d')]['id']}})[_0x987d('0x24')](handleEntityNotFound(_0x1352e5,null))['then'](removeEntity(_0x1352e5,null))[_0x987d('0x3c')](handleError(_0x1352e5,null));};exports[_0x987d('0x44')]=function(_0x409272,_0x6f3827){return db[_0x987d('0x28')][_0x987d('0x44')]()[_0x987d('0x24')](respondWithResult(_0x6f3827,null))[_0x987d('0x3c')](handleError(_0x6f3827,null));}; \ No newline at end of file +var _0x4969=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','where','type','options','includeAll','findAll','rows','show','rawAttributes','length','find','catch','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','stack','name','map','MailSubstatus','fieldName','query'];(function(_0x3afe77,_0x5e98d1){var _0x157163=function(_0x35e3db){while(--_0x35e3db){_0x3afe77['push'](_0x3afe77['shift']());}};_0x157163(++_0x5e98d1);}(_0x4969,0x133));var _0x9496=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x4969[_0xf6aec0];return _0x59a51b;};'use strict';var emlformat=require(_0x9496('0x0'));var rimraf=require(_0x9496('0x1'));var zipdir=require(_0x9496('0x2'));var jsonpatch=require(_0x9496('0x3'));var rp=require(_0x9496('0x4'));var moment=require(_0x9496('0x5'));var BPromise=require(_0x9496('0x6'));var Mustache=require('mustache');var util=require(_0x9496('0x7'));var path=require(_0x9496('0x8'));var sox=require(_0x9496('0x9'));var csv=require(_0x9496('0xa'));var ejs=require(_0x9496('0xb'));var fs=require('fs');var fs_extra=require(_0x9496('0xc'));var _=require(_0x9496('0xd'));var squel=require(_0x9496('0xe'));var crypto=require(_0x9496('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9496('0x10'));var toCsv=require(_0x9496('0xa'));var querystring=require('querystring');var Papa=require(_0x9496('0x11'));var Redis=require('ioredis');var authService=require(_0x9496('0x12'));var qs=require(_0x9496('0x13'));var as=require(_0x9496('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9496('0x15'));var utils=require(_0x9496('0x16'));var config=require(_0x9496('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9496('0x18'))['db'];function respondWithStatusCode(_0x3a2da1,_0x34e267){_0x34e267=_0x34e267||0xcc;return function(_0x30eb44){if(_0x30eb44){return _0x3a2da1[_0x9496('0x19')](_0x34e267);}return _0x3a2da1[_0x9496('0x1a')](_0x34e267)['end']();};}function respondWithResult(_0x120293,_0x469ebf){_0x469ebf=_0x469ebf||0xc8;return function(_0xc737b4){if(_0xc737b4){return _0x120293[_0x9496('0x1a')](_0x469ebf)[_0x9496('0x1b')](_0xc737b4);}};}function respondWithFilteredResult(_0xea1af0,_0x37e2a8){return function(_0x7e12){if(_0x7e12){var _0x296131=typeof _0x37e2a8[_0x9496('0x1c')]===_0x9496('0x1d')&&typeof _0x37e2a8[_0x9496('0x1e')]==='undefined';var _0x20764d=_0x7e12[_0x9496('0x1f')];var _0x525636=_0x296131?0x0:_0x37e2a8[_0x9496('0x1c')];var _0x1eb109=_0x296131?_0x7e12['count']:_0x37e2a8[_0x9496('0x1c')]+_0x37e2a8[_0x9496('0x1e')];var _0x3004c0;if(_0x1eb109>=_0x20764d){_0x1eb109=_0x20764d;_0x3004c0=0xc8;}else{_0x3004c0=0xce;}_0xea1af0['status'](_0x3004c0);return _0xea1af0[_0x9496('0x20')]('Content-Range',_0x525636+'-'+_0x1eb109+'/'+_0x20764d)['json'](_0x7e12);}return null;};}function patchUpdates(_0x174937){return function(_0x50fcf5){try{jsonpatch['apply'](_0x50fcf5,_0x174937,!![]);}catch(_0x5120f2){return BPromise[_0x9496('0x21')](_0x5120f2);}return _0x50fcf5[_0x9496('0x22')]();};}function saveUpdates(_0x9e98ec,_0x575378){return function(_0x272ffc){if(_0x272ffc){return _0x272ffc[_0x9496('0x23')](_0x9e98ec)[_0x9496('0x24')](function(_0x19d83d){return _0x19d83d;});}return null;};}function removeEntity(_0xb0cc59,_0x396c70){return function(_0x4c82f2){if(_0x4c82f2){return _0x4c82f2['destroy']()[_0x9496('0x24')](function(){_0xb0cc59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2196a6,_0x11b79c){return function(_0x1dbc4d){if(!_0x1dbc4d){_0x2196a6[_0x9496('0x19')](0x194);}return _0x1dbc4d;};}function handleError(_0x3dd90f,_0x3116ed){_0x3116ed=_0x3116ed||0x1f4;return function(_0x1dd3c4){logger['error'](_0x1dd3c4[_0x9496('0x25')]);if(_0x1dd3c4[_0x9496('0x26')]){delete _0x1dd3c4['name'];}_0x3dd90f[_0x9496('0x1a')](_0x3116ed)['send'](_0x1dd3c4);};}exports['index']=function(_0x378ff6,_0x13d61d){var _0x4d97b9={},_0x6a0804={},_0x2792df={'count':0x0,'rows':[]};var _0x48c873=_[_0x9496('0x27')](db[_0x9496('0x28')]['rawAttributes'],function(_0x49f349){return{'name':_0x49f349[_0x9496('0x29')],'type':_0x49f349['type']['key']};});_0x6a0804['model']=_[_0x9496('0x27')](_0x48c873,'name');_0x6a0804[_0x9496('0x2a')]=_[_0x9496('0x2b')](_0x378ff6['query']);_0x6a0804[_0x9496('0x2c')]=_[_0x9496('0x2d')](_0x6a0804[_0x9496('0x2e')],_0x6a0804[_0x9496('0x2a')]);_0x4d97b9[_0x9496('0x2f')]=_[_0x9496('0x2d')](_0x6a0804['model'],qs[_0x9496('0x30')](_0x378ff6[_0x9496('0x2a')][_0x9496('0x30')]));_0x4d97b9['attributes']=_0x4d97b9[_0x9496('0x2f')]['length']?_0x4d97b9[_0x9496('0x2f')]:_0x6a0804[_0x9496('0x2e')];if(!_0x378ff6[_0x9496('0x2a')][_0x9496('0x31')](_0x9496('0x32'))){_0x4d97b9[_0x9496('0x1e')]=qs[_0x9496('0x1e')](_0x378ff6[_0x9496('0x2a')]['limit']);_0x4d97b9['offset']=qs[_0x9496('0x1c')](_0x378ff6[_0x9496('0x2a')][_0x9496('0x1c')]);}_0x4d97b9['order']=qs['sort'](_0x378ff6[_0x9496('0x2a')][_0x9496('0x33')]);_0x4d97b9['where']=qs[_0x9496('0x2c')](_['pick'](_0x378ff6['query'],_0x6a0804[_0x9496('0x2c')]),_0x48c873);if(_0x378ff6[_0x9496('0x2a')][_0x9496('0x34')]){_0x4d97b9['where']=_[_0x9496('0x35')](_0x4d97b9[_0x9496('0x36')],{'$or':_[_0x9496('0x27')](_0x48c873,function(_0x49bc61){if(_0x49bc61[_0x9496('0x37')]!=='VIRTUAL'){var _0x167da2={};_0x167da2[_0x49bc61[_0x9496('0x26')]]={'$like':'%'+_0x378ff6['query'][_0x9496('0x34')]+'%'};return _0x167da2;}})});}_0x4d97b9=_['merge']({},_0x4d97b9,_0x378ff6[_0x9496('0x38')]);var _0x59ada0={'where':_0x4d97b9[_0x9496('0x36')]};return db['MailSubstatus'][_0x9496('0x1f')](_0x59ada0)[_0x9496('0x24')](function(_0x364a1a){_0x2792df[_0x9496('0x1f')]=_0x364a1a;if(_0x378ff6[_0x9496('0x2a')][_0x9496('0x39')]){_0x4d97b9['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x9496('0x3a')](_0x4d97b9);})[_0x9496('0x24')](function(_0x3c59d7){_0x2792df[_0x9496('0x3b')]=_0x3c59d7;return _0x2792df;})[_0x9496('0x24')](respondWithFilteredResult(_0x13d61d,_0x4d97b9))['catch'](handleError(_0x13d61d,null));};exports[_0x9496('0x3c')]=function(_0x45b72f,_0xecb148){var _0x39ab9c={'raw':!![],'where':{'id':_0x45b72f['params']['id']}},_0x1b7256={};_0x1b7256[_0x9496('0x2e')]=_[_0x9496('0x2b')](db[_0x9496('0x28')][_0x9496('0x3d')]);_0x1b7256[_0x9496('0x2a')]=_[_0x9496('0x2b')](_0x45b72f[_0x9496('0x2a')]);_0x1b7256[_0x9496('0x2c')]=_[_0x9496('0x2d')](_0x1b7256['model'],_0x1b7256[_0x9496('0x2a')]);_0x39ab9c['attributes']=_['intersection'](_0x1b7256[_0x9496('0x2e')],qs[_0x9496('0x30')](_0x45b72f['query'][_0x9496('0x30')]));_0x39ab9c['attributes']=_0x39ab9c['attributes'][_0x9496('0x3e')]?_0x39ab9c[_0x9496('0x2f')]:_0x1b7256['model'];if(_0x45b72f['query'][_0x9496('0x39')]){_0x39ab9c['include']=[{'all':!![]}];}_0x39ab9c=_[_0x9496('0x35')]({},_0x39ab9c,_0x45b72f['options']);return db[_0x9496('0x28')][_0x9496('0x3f')](_0x39ab9c)[_0x9496('0x24')](handleEntityNotFound(_0xecb148,null))[_0x9496('0x24')](respondWithResult(_0xecb148,null))[_0x9496('0x40')](handleError(_0xecb148,null));};exports[_0x9496('0x41')]=function(_0xc15047,_0x1611dd){return db[_0x9496('0x28')]['create'](_0xc15047[_0x9496('0x42')],{})[_0x9496('0x24')](respondWithResult(_0x1611dd,0xc9))[_0x9496('0x40')](handleError(_0x1611dd,null));};exports[_0x9496('0x23')]=function(_0x5e3104,_0x359b90){if(_0x5e3104['body']['id']){delete _0x5e3104[_0x9496('0x42')]['id'];}return db['MailSubstatus'][_0x9496('0x3f')]({'where':{'id':_0x5e3104['params']['id']}})['then'](handleEntityNotFound(_0x359b90,null))[_0x9496('0x24')](saveUpdates(_0x5e3104[_0x9496('0x42')],null))[_0x9496('0x24')](respondWithResult(_0x359b90,null))[_0x9496('0x40')](handleError(_0x359b90,null));};exports[_0x9496('0x43')]=function(_0x19fdcc,_0x14c4ef){return db[_0x9496('0x28')][_0x9496('0x3f')]({'where':{'id':_0x19fdcc[_0x9496('0x44')]['id']}})[_0x9496('0x24')](handleEntityNotFound(_0x14c4ef,null))[_0x9496('0x24')](removeEntity(_0x14c4ef,null))[_0x9496('0x40')](handleError(_0x14c4ef,null));};exports[_0x9496('0x45')]=function(_0x5931d3,_0x46c10d){return db[_0x9496('0x28')][_0x9496('0x45')]()[_0x9496('0x24')](respondWithResult(_0x46c10d,null))['catch'](handleError(_0x46c10d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 1bd976a..57b5f57 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 _0xbe86=['MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','events'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xbe86,0x137));var _0x6be8=function(_0x23c262,_0x74765a){_0x23c262=_0x23c262-0x0;var _0x9b913f=_0xbe86[_0x23c262];return _0x9b913f;};'use strict';var EventEmitter=require(_0x6be8('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x6be8('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6be8('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x82649c){return function(_0x20e3e8,_0x2335e2,_0x129af5){MailSubstatusEvents[_0x6be8('0x3')](_0x82649c+':'+_0x20e3e8['id'],_0x20e3e8);MailSubstatusEvents['emit'](_0x82649c,_0x20e3e8);_0x129af5(null);};}for(var e in events){if(events[_0x6be8('0x4')](e)){var event=events[e];MailSubstatus[_0x6be8('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xc1cb=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','hasOwnProperty','exports'];(function(_0x5757c6,_0x444a45){var _0x498d31=function(_0x2bb918){while(--_0x2bb918){_0x5757c6['push'](_0x5757c6['shift']());}};_0x498d31(++_0x444a45);}(_0xc1cb,0x1b2));var _0xbc1c=function(_0x2b34be,_0x8d6f5d){_0x2b34be=_0x2b34be-0x0;var _0x4b7987=_0xc1cb[_0x2b34be];return _0x4b7987;};'use strict';var EventEmitter=require(_0xbc1c('0x0'));var MailSubstatus=require(_0xbc1c('0x1'))['db'][_0xbc1c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xbc1c('0x3')](0x0);var events={'afterUpdate':_0xbc1c('0x4')};function emitEvent(_0x4cf0f6){return function(_0x26c634,_0x26a39b,_0x527310){MailSubstatusEvents['emit'](_0x4cf0f6+':'+_0x26c634['id'],_0x26c634);MailSubstatusEvents['emit'](_0x4cf0f6,_0x26c634);_0x527310(null);};}for(var e in events){if(events[_0xbc1c('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xbc1c('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a288b2c..fc8ad8d 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 _0x0ef3=['MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then','catch','exports'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x0ef3,0x194));var _0x30ef=function(_0x5e4a4c,_0x1b8d7e){_0x5e4a4c=_0x5e4a4c-0x0;var _0x1afefb=_0x0ef3[_0x5e4a4c];return _0x1afefb;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x30ef('0x0')]=function(_0x57d4ce){var _0x4b4ecb=_0x57d4ce['models'];return _0x57d4ce['define'](_0x30ef('0x1'),attributes,{'tableName':_0x30ef('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x231fdd,_0x4432c1,_0x4fe134){return _0x4b4ecb[_0x30ef('0x3')]['update']({'value':_0x231fdd['name']},{'where':{'field':_0x30ef('0x4'),'value':_0x231fdd[_0x30ef('0x5')][_0x30ef('0x6')]}})[_0x30ef('0x7')](function(){_0x4fe134();})[_0x30ef('0x8')](function(_0x36976e){_0x4fe134(_0x36976e);});}}});}; \ No newline at end of file +var _0x9785=['name','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','_previousDataValues'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9785,0x133));var _0x5978=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x9785[_0x5317b5];return _0x3b7ce2;};'use strict';var attributes=require(_0x5978('0x0'));module[_0x5978('0x1')]=function(_0x5da736){var _0x31ae7a=_0x5da736[_0x5978('0x2')];return _0x5da736[_0x5978('0x3')](_0x5978('0x4'),attributes,{'tableName':_0x5978('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2eaeb4,_0x591a22,_0x3aa0d8){return _0x31ae7a[_0x5978('0x6')]['update']({'value':_0x2eaeb4['name']},{'where':{'field':'mailSubstatus','value':_0x2eaeb4[_0x5978('0x7')][_0x5978('0x8')]}})['then'](function(){_0x3aa0d8();})['catch'](function(_0x2387b6){_0x3aa0d8(_0x2387b6);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index bfc7961..91d099b 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 _0x856b=['code','message','info','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x18d699,_0x165e23){var _0x509f0c=function(_0x167a57){while(--_0x167a57){_0x18d699['push'](_0x18d699['shift']());}};_0x509f0c(++_0x165e23);}(_0x856b,0x1d0));var _0xb856=function(_0x33e200,_0x4d13ab){_0x33e200=_0x33e200-0x0;var _0xc868bb=_0x856b[_0x33e200];return _0xc868bb;};'use strict';var _=require('lodash');var util=require(_0xb856('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb856('0x1'));var fs=require('fs');var Redis=require(_0xb856('0x2'));var db=require(_0xb856('0x3'))['db'];var utils=require(_0xb856('0x4'));var logger=require(_0xb856('0x5'))(_0xb856('0x6'));var config=require(_0xb856('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb856('0x8')][_0xb856('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5825ef,_0x4f9626,_0x5049f0){return new BPromise(function(_0x1fe1ec,_0x2c3683){return client['request'](_0x5825ef,_0x5049f0)['then'](function(_0xf992f2){logger['info'](_0xb856('0xa'),_0x4f9626,_0xb856('0xb'));logger[_0xb856('0xc')](_0xb856('0xd'),_0x4f9626,'request\x20sent',JSON[_0xb856('0xe')](_0xf992f2));if(_0xf992f2['error']){if(_0xf992f2[_0xb856('0xf')][_0xb856('0x10')]===0x1f4){logger[_0xb856('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x4f9626,_0xf992f2[_0xb856('0xf')]['message']);return _0x2c3683(_0xf992f2[_0xb856('0xf')]['message']);}logger[_0xb856('0xf')](_0xb856('0xa'),_0x4f9626,_0xf992f2['error'][_0xb856('0x11')]);return _0x1fe1ec(_0xf992f2[_0xb856('0xf')][_0xb856('0x11')]);}else{logger[_0xb856('0x12')](_0xb856('0xa'),_0x4f9626,'request\x20sent');_0x1fe1ec(_0xf992f2[_0xb856('0x13')][_0xb856('0x11')]);}})['catch'](function(_0x46e28e){logger[_0xb856('0xf')](_0xb856('0xa'),_0x4f9626,_0x46e28e);_0x2c3683(_0x46e28e);});});} \ No newline at end of file +var _0x7243=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20be6c,_0x544e09){var _0x117c8d=function(_0x25bed8){while(--_0x25bed8){_0x20be6c['push'](_0x20be6c['shift']());}};_0x117c8d(++_0x544e09);}(_0x7243,0x7d));var _0x3724=function(_0x506394,_0x1f6a9d){_0x506394=_0x506394-0x0;var _0x59f5fb=_0x7243[_0x506394];return _0x59f5fb;};'use strict';var _=require('lodash');var util=require(_0x3724('0x0'));var moment=require(_0x3724('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3724('0x2'));var db=require(_0x3724('0x3'))['db'];var utils=require(_0x3724('0x4'));var logger=require(_0x3724('0x5'))(_0x3724('0x6'));var config=require('../../config/environment');var jayson=require(_0x3724('0x7'));var client=jayson[_0x3724('0x8')][_0x3724('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c74cb,_0x2b43f3,_0x218d39){return new BPromise(function(_0x5457ba,_0x2d2931){return client[_0x3724('0xa')](_0x6c74cb,_0x218d39)[_0x3724('0xb')](function(_0x8f8d9b){logger[_0x3724('0xc')](_0x3724('0xd'),_0x2b43f3,_0x3724('0xe'));logger[_0x3724('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2b43f3,_0x3724('0xe'),JSON[_0x3724('0x10')](_0x8f8d9b));if(_0x8f8d9b[_0x3724('0x11')]){if(_0x8f8d9b[_0x3724('0x11')][_0x3724('0x12')]===0x1f4){logger[_0x3724('0x11')](_0x3724('0xd'),_0x2b43f3,_0x8f8d9b[_0x3724('0x11')][_0x3724('0x13')]);return _0x2d2931(_0x8f8d9b[_0x3724('0x11')]['message']);}logger['error'](_0x3724('0xd'),_0x2b43f3,_0x8f8d9b['error']['message']);return _0x5457ba(_0x8f8d9b[_0x3724('0x11')][_0x3724('0x13')]);}else{logger[_0x3724('0xc')](_0x3724('0xd'),_0x2b43f3,'request\x20sent');_0x5457ba(_0x8f8d9b[_0x3724('0x14')][_0x3724('0x13')]);}})[_0x3724('0x15')](function(_0x15d475){logger[_0x3724('0x11')](_0x3724('0xd'),_0x2b43f3,_0x15d475);_0x2d2931(_0x15d475);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e62c119..0fb89f2 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 _0xa129=['../../components/interaction/service','./mailTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x182e09,_0x5cb1f1){var _0x5bb657=function(_0x2e987b){while(--_0x2e987b){_0x182e09['push'](_0x182e09['shift']());}};_0x5bb657(++_0x5cb1f1);}(_0xa129,0x1d6));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var path=require('path');var timeout=require(_0x9a12('0x2'));var express=require(_0x9a12('0x3'));var router=express['Router']();var fs_extra=require(_0x9a12('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9a12('0x5'));var config=require('../../config/environment');var controller=require(_0x9a12('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9a12('0x7')](_0x9a12('0x8'),auth[_0x9a12('0x9')](),controller[_0x9a12('0xa')]);router[_0x9a12('0x7')](_0x9a12('0xb'),auth[_0x9a12('0x9')](),controller['show']);router[_0x9a12('0xc')]('/',auth[_0x9a12('0x9')](),controller[_0x9a12('0xd')]);router[_0x9a12('0xe')](_0x9a12('0xb'),auth[_0x9a12('0x9')](),controller[_0x9a12('0xf')]);router[_0x9a12('0x10')](_0x9a12('0xb'),auth['isAuthenticated'](),controller[_0x9a12('0x11')]);module[_0x9a12('0x12')]=router; \ No newline at end of file +var _0x33d3=['/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get'];(function(_0x386c0b,_0x25a98b){var _0x1ebc25=function(_0xfbc73d){while(--_0xfbc73d){_0x386c0b['push'](_0x386c0b['shift']());}};_0x1ebc25(++_0x25a98b);}(_0x33d3,0xf9));var _0x333d=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x33d3[_0xcb19e1];return _0x121872;};'use strict';var multer=require(_0x333d('0x0'));var util=require(_0x333d('0x1'));var path=require(_0x333d('0x2'));var timeout=require(_0x333d('0x3'));var express=require(_0x333d('0x4'));var router=express['Router']();var fs_extra=require(_0x333d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x333d('0x6'));var config=require(_0x333d('0x7'));var controller=require(_0x333d('0x8'));router['get']('/',auth[_0x333d('0x9')](),controller['index']);router[_0x333d('0xa')](_0x333d('0xb'),auth['isAuthenticated'](),controller[_0x333d('0xc')]);router[_0x333d('0xa')](_0x333d('0xd'),auth[_0x333d('0x9')](),controller[_0x333d('0xe')]);router[_0x333d('0xf')]('/',auth['isAuthenticated'](),controller[_0x333d('0x10')]);router[_0x333d('0x11')](_0x333d('0xd'),auth['isAuthenticated'](),controller[_0x333d('0x12')]);router['delete'](_0x333d('0xd'),auth[_0x333d('0x9')](),controller[_0x333d('0x13')]);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 65d0c22..f361fb9 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x18403c,_0x28b1ab){_0x18403c=_0x18403c-0x0;var _0x3e5b1f=_0xb43b[_0x18403c];return _0x3e5b1f;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x491e1a,_0x305a7c){var _0x142458=function(_0x2e10ca){while(--_0x2e10ca){_0x491e1a['push'](_0x491e1a['shift']());}};_0x142458(++_0x305a7c);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ad4c232..f90e560 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 _0x2e4b=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','update','then','end','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x12ea0f,_0x1533d8){var _0x177c81=function(_0x283f6e){while(--_0x283f6e){_0x12ea0f['push'](_0x12ea0f['shift']());}};_0x177c81(++_0x1533d8);}(_0x2e4b,0x82));var _0xb2e4=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x2e4b[_0x23b655];return _0x364b32;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2e4('0x0'));var jsonpatch=require(_0xb2e4('0x1'));var rp=require(_0xb2e4('0x2'));var moment=require(_0xb2e4('0x3'));var BPromise=require(_0xb2e4('0x4'));var Mustache=require(_0xb2e4('0x5'));var util=require(_0xb2e4('0x6'));var path=require(_0xb2e4('0x7'));var sox=require(_0xb2e4('0x8'));var csv=require(_0xb2e4('0x9'));var ejs=require(_0xb2e4('0xa'));var fs=require('fs');var fs_extra=require(_0xb2e4('0xb'));var _=require('lodash');var squel=require(_0xb2e4('0xc'));var crypto=require(_0xb2e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb2e4('0xe'));var toCsv=require(_0xb2e4('0x9'));var querystring=require(_0xb2e4('0xf'));var Papa=require(_0xb2e4('0x10'));var Redis=require(_0xb2e4('0x11'));var authService=require(_0xb2e4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2e4('0x14'));var utils=require(_0xb2e4('0x15'));var config=require(_0xb2e4('0x16'));var licenseUtil=require(_0xb2e4('0x17'));var db=require(_0xb2e4('0x18'))['db'];function respondWithStatusCode(_0x24cf6e,_0x1fc3f4){_0x1fc3f4=_0x1fc3f4||0xcc;return function(_0x231f3c){if(_0x231f3c){return _0x24cf6e['sendStatus'](_0x1fc3f4);}return _0x24cf6e[_0xb2e4('0x19')](_0x1fc3f4)['end']();};}function respondWithResult(_0x3c65fc,_0x56e12a){_0x56e12a=_0x56e12a||0xc8;return function(_0x2eb923){if(_0x2eb923){return _0x3c65fc[_0xb2e4('0x19')](_0x56e12a)[_0xb2e4('0x1a')](_0x2eb923);}};}function respondWithFilteredResult(_0x5d72ba,_0x594f65){return function(_0x4d031e){if(_0x4d031e){var _0x4aa5b9=typeof _0x594f65[_0xb2e4('0x1b')]===_0xb2e4('0x1c')&&typeof _0x594f65['limit']===_0xb2e4('0x1c');var _0x17863f=_0x4d031e[_0xb2e4('0x1d')];var _0x15fc49=_0x4aa5b9?0x0:_0x594f65[_0xb2e4('0x1b')];var _0x268d82=_0x4aa5b9?_0x4d031e[_0xb2e4('0x1d')]:_0x594f65[_0xb2e4('0x1b')]+_0x594f65['limit'];var _0x14995a;if(_0x268d82>=_0x17863f){_0x268d82=_0x17863f;_0x14995a=0xc8;}else{_0x14995a=0xce;}_0x5d72ba[_0xb2e4('0x19')](_0x14995a);return _0x5d72ba[_0xb2e4('0x1e')](_0xb2e4('0x1f'),_0x15fc49+'-'+_0x268d82+'/'+_0x17863f)[_0xb2e4('0x1a')](_0x4d031e);}return null;};}function patchUpdates(_0x521fdc){return function(_0x5d9d97){try{jsonpatch[_0xb2e4('0x20')](_0x5d9d97,_0x521fdc,!![]);}catch(_0x15ccba){return BPromise['reject'](_0x15ccba);}return _0x5d9d97['save']();};}function saveUpdates(_0x1c5784,_0x26d67f){return function(_0xe4de54){if(_0xe4de54){return _0xe4de54[_0xb2e4('0x21')](_0x1c5784)[_0xb2e4('0x22')](function(_0x1ddbfe){return _0x1ddbfe;});}return null;};}function removeEntity(_0x567c1a,_0x42e62a){return function(_0x5a9f78){if(_0x5a9f78){return _0x5a9f78['destroy']()['then'](function(){_0x567c1a[_0xb2e4('0x19')](0xcc)[_0xb2e4('0x23')]();});}};}function handleEntityNotFound(_0x2f44eb,_0x47edc9){return function(_0x49ff78){if(!_0x49ff78){_0x2f44eb[_0xb2e4('0x24')](0x194);}return _0x49ff78;};}function handleError(_0x35d078,_0x5266e9){_0x5266e9=_0x5266e9||0x1f4;return function(_0x33f795){logger[_0xb2e4('0x25')](_0x33f795['stack']);if(_0x33f795[_0xb2e4('0x26')]){delete _0x33f795[_0xb2e4('0x26')];}_0x35d078[_0xb2e4('0x19')](_0x5266e9)[_0xb2e4('0x27')](_0x33f795);};}exports['index']=function(_0x3c512e,_0x12c46e){var _0x3d4479={},_0x1ff0ba={},_0x29e819={'count':0x0,'rows':[]};var _0x2a3427=_[_0xb2e4('0x28')](db['MailTransferReport'][_0xb2e4('0x29')],function(_0x38167c){return{'name':_0x38167c['fieldName'],'type':_0x38167c[_0xb2e4('0x2a')][_0xb2e4('0x2b')]};});_0x1ff0ba[_0xb2e4('0x2c')]=_[_0xb2e4('0x28')](_0x2a3427,'name');_0x1ff0ba[_0xb2e4('0x2d')]=_['keys'](_0x3c512e['query']);_0x1ff0ba[_0xb2e4('0x2e')]=_[_0xb2e4('0x2f')](_0x1ff0ba[_0xb2e4('0x2c')],_0x1ff0ba[_0xb2e4('0x2d')]);_0x3d4479[_0xb2e4('0x30')]=_[_0xb2e4('0x2f')](_0x1ff0ba['model'],qs[_0xb2e4('0x31')](_0x3c512e[_0xb2e4('0x2d')][_0xb2e4('0x31')]));_0x3d4479[_0xb2e4('0x30')]=_0x3d4479['attributes'][_0xb2e4('0x32')]?_0x3d4479[_0xb2e4('0x30')]:_0x1ff0ba['model'];if(!_0x3c512e['query'][_0xb2e4('0x33')](_0xb2e4('0x34'))){_0x3d4479[_0xb2e4('0x35')]=qs['limit'](_0x3c512e[_0xb2e4('0x2d')][_0xb2e4('0x35')]);_0x3d4479[_0xb2e4('0x1b')]=qs['offset'](_0x3c512e['query']['offset']);}_0x3d4479[_0xb2e4('0x36')]=qs[_0xb2e4('0x37')](_0x3c512e[_0xb2e4('0x2d')][_0xb2e4('0x37')]);_0x3d4479[_0xb2e4('0x38')]=qs[_0xb2e4('0x2e')](_[_0xb2e4('0x39')](_0x3c512e[_0xb2e4('0x2d')],_0x1ff0ba[_0xb2e4('0x2e')]),_0x2a3427);if(_0x3c512e['query'][_0xb2e4('0x3a')]){_0x3d4479[_0xb2e4('0x38')]=_[_0xb2e4('0x3b')](_0x3d4479[_0xb2e4('0x38')],{'$or':_[_0xb2e4('0x28')](_0x2a3427,function(_0xd1e62f){if(_0xd1e62f[_0xb2e4('0x2a')]!==_0xb2e4('0x3c')){var _0x1899a9={};_0x1899a9[_0xd1e62f[_0xb2e4('0x26')]]={'$like':'%'+_0x3c512e[_0xb2e4('0x2d')][_0xb2e4('0x3a')]+'%'};return _0x1899a9;}})});}_0x3d4479=_[_0xb2e4('0x3b')]({},_0x3d4479,_0x3c512e[_0xb2e4('0x3d')]);var _0x493117={'where':_0x3d4479[_0xb2e4('0x38')]};return db[_0xb2e4('0x3e')][_0xb2e4('0x1d')](_0x493117)[_0xb2e4('0x22')](function(_0x5c4265){_0x29e819[_0xb2e4('0x1d')]=_0x5c4265;if(_0x3c512e[_0xb2e4('0x2d')][_0xb2e4('0x3f')]){_0x3d4479[_0xb2e4('0x40')]=[{'all':!![]}];}return db[_0xb2e4('0x3e')][_0xb2e4('0x41')](_0x3d4479);})[_0xb2e4('0x22')](function(_0x47cb64){_0x29e819['rows']=_0x47cb64;return _0x29e819;})[_0xb2e4('0x22')](respondWithFilteredResult(_0x12c46e,_0x3d4479))[_0xb2e4('0x42')](handleError(_0x12c46e,null));};exports[_0xb2e4('0x43')]=function(_0x11474a,_0x5c1a74){var _0x3d29a3={'raw':!![],'where':{'id':_0x11474a[_0xb2e4('0x44')]['id']}},_0x11b3fa={};_0x11b3fa[_0xb2e4('0x2c')]=_[_0xb2e4('0x45')](db[_0xb2e4('0x3e')]['rawAttributes']);_0x11b3fa[_0xb2e4('0x2d')]=_[_0xb2e4('0x45')](_0x11474a[_0xb2e4('0x2d')]);_0x11b3fa[_0xb2e4('0x2e')]=_[_0xb2e4('0x2f')](_0x11b3fa[_0xb2e4('0x2c')],_0x11b3fa[_0xb2e4('0x2d')]);_0x3d29a3[_0xb2e4('0x30')]=_[_0xb2e4('0x2f')](_0x11b3fa['model'],qs[_0xb2e4('0x31')](_0x11474a['query'][_0xb2e4('0x31')]));_0x3d29a3['attributes']=_0x3d29a3[_0xb2e4('0x30')][_0xb2e4('0x32')]?_0x3d29a3[_0xb2e4('0x30')]:_0x11b3fa[_0xb2e4('0x2c')];if(_0x11474a['query'][_0xb2e4('0x3f')]){_0x3d29a3[_0xb2e4('0x40')]=[{'all':!![]}];}_0x3d29a3=_['merge']({},_0x3d29a3,_0x11474a[_0xb2e4('0x3d')]);return db[_0xb2e4('0x3e')][_0xb2e4('0x46')](_0x3d29a3)[_0xb2e4('0x22')](handleEntityNotFound(_0x5c1a74,null))['then'](respondWithResult(_0x5c1a74,null))[_0xb2e4('0x42')](handleError(_0x5c1a74,null));};exports[_0xb2e4('0x47')]=function(_0x5c63b5,_0x479940){return db[_0xb2e4('0x3e')]['create'](_0x5c63b5['body'],{})[_0xb2e4('0x22')](respondWithResult(_0x479940,0xc9))['catch'](handleError(_0x479940,null));};exports[_0xb2e4('0x21')]=function(_0x4b1753,_0x104c44){if(_0x4b1753[_0xb2e4('0x48')]['id']){delete _0x4b1753[_0xb2e4('0x48')]['id'];}return db['MailTransferReport'][_0xb2e4('0x46')]({'where':{'id':_0x4b1753['params']['id']}})['then'](handleEntityNotFound(_0x104c44,null))[_0xb2e4('0x22')](saveUpdates(_0x4b1753[_0xb2e4('0x48')],null))[_0xb2e4('0x22')](respondWithResult(_0x104c44,null))[_0xb2e4('0x42')](handleError(_0x104c44,null));};exports[_0xb2e4('0x49')]=function(_0x15943e,_0xa182eb){return db['MailTransferReport'][_0xb2e4('0x46')]({'where':{'id':_0x15943e[_0xb2e4('0x44')]['id']}})[_0xb2e4('0x22')](handleEntityNotFound(_0xa182eb,null))[_0xb2e4('0x22')](removeEntity(_0xa182eb,null))[_0xb2e4('0x42')](handleError(_0xa182eb,null));};exports[_0xb2e4('0x4a')]=function(_0x21aebe,_0x321c2b){return db[_0xb2e4('0x3e')][_0xb2e4('0x4a')]()['then'](respondWithResult(_0x321c2b,null))[_0xb2e4('0x42')](handleError(_0x321c2b,null));}; \ No newline at end of file +var _0x1bc6=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','MailTransferReport','findAll','rows','show','length','include','find','catch','create','body','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x1c31f4,_0x8e8aeb){var _0x5a3f66=function(_0x3ff723){while(--_0x3ff723){_0x1c31f4['push'](_0x1c31f4['shift']());}};_0x5a3f66(++_0x8e8aeb);}(_0x1bc6,0x121));var _0x61bc=function(_0x1e535d,_0xe78a58){_0x1e535d=_0x1e535d-0x0;var _0x2f732a=_0x1bc6[_0x1e535d];return _0x2f732a;};'use strict';var emlformat=require(_0x61bc('0x0'));var rimraf=require(_0x61bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61bc('0x2'));var moment=require('moment');var BPromise=require(_0x61bc('0x3'));var Mustache=require(_0x61bc('0x4'));var util=require(_0x61bc('0x5'));var path=require(_0x61bc('0x6'));var sox=require('sox');var csv=require(_0x61bc('0x7'));var ejs=require(_0x61bc('0x8'));var fs=require('fs');var fs_extra=require(_0x61bc('0x9'));var _=require('lodash');var squel=require(_0x61bc('0xa'));var crypto=require(_0x61bc('0xb'));var jsforce=require(_0x61bc('0xc'));var deskjs=require(_0x61bc('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61bc('0xe'));var Redis=require(_0x61bc('0xf'));var authService=require(_0x61bc('0x10'));var qs=require(_0x61bc('0x11'));var as=require(_0x61bc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61bc('0x13'))(_0x61bc('0x14'));var utils=require(_0x61bc('0x15'));var config=require(_0x61bc('0x16'));var licenseUtil=require(_0x61bc('0x17'));var db=require(_0x61bc('0x18'))['db'];function respondWithStatusCode(_0x5e901c,_0x112ba1){_0x112ba1=_0x112ba1||0xcc;return function(_0x2dd592){if(_0x2dd592){return _0x5e901c[_0x61bc('0x19')](_0x112ba1);}return _0x5e901c[_0x61bc('0x1a')](_0x112ba1)[_0x61bc('0x1b')]();};}function respondWithResult(_0xf3324b,_0x31a2e8){_0x31a2e8=_0x31a2e8||0xc8;return function(_0x5f3ed5){if(_0x5f3ed5){return _0xf3324b[_0x61bc('0x1a')](_0x31a2e8)[_0x61bc('0x1c')](_0x5f3ed5);}};}function respondWithFilteredResult(_0x368886,_0x3168a3){return function(_0x214588){if(_0x214588){var _0x198ca2=typeof _0x3168a3[_0x61bc('0x1d')]==='undefined'&&typeof _0x3168a3[_0x61bc('0x1e')]==='undefined';var _0x470dbe=_0x214588[_0x61bc('0x1f')];var _0x4e6af6=_0x198ca2?0x0:_0x3168a3[_0x61bc('0x1d')];var _0x2c41ff=_0x198ca2?_0x214588[_0x61bc('0x1f')]:_0x3168a3[_0x61bc('0x1d')]+_0x3168a3[_0x61bc('0x1e')];var _0x140463;if(_0x2c41ff>=_0x470dbe){_0x2c41ff=_0x470dbe;_0x140463=0xc8;}else{_0x140463=0xce;}_0x368886['status'](_0x140463);return _0x368886[_0x61bc('0x20')]('Content-Range',_0x4e6af6+'-'+_0x2c41ff+'/'+_0x470dbe)[_0x61bc('0x1c')](_0x214588);}return null;};}function patchUpdates(_0x228f8c){return function(_0x36952a){try{jsonpatch[_0x61bc('0x21')](_0x36952a,_0x228f8c,!![]);}catch(_0x3cad4a){return BPromise['reject'](_0x3cad4a);}return _0x36952a[_0x61bc('0x22')]();};}function saveUpdates(_0x3703d2,_0x2ee152){return function(_0x2a2ac6){if(_0x2a2ac6){return _0x2a2ac6[_0x61bc('0x23')](_0x3703d2)[_0x61bc('0x24')](function(_0x5399d8){return _0x5399d8;});}return null;};}function removeEntity(_0x2f97b3,_0xfa8378){return function(_0x28b743){if(_0x28b743){return _0x28b743[_0x61bc('0x25')]()['then'](function(){_0x2f97b3[_0x61bc('0x1a')](0xcc)[_0x61bc('0x1b')]();});}};}function handleEntityNotFound(_0xa228fc,_0x4ccea3){return function(_0xf1d6dc){if(!_0xf1d6dc){_0xa228fc['sendStatus'](0x194);}return _0xf1d6dc;};}function handleError(_0xa2bb89,_0x1bfb42){_0x1bfb42=_0x1bfb42||0x1f4;return function(_0xc353d9){logger[_0x61bc('0x26')](_0xc353d9[_0x61bc('0x27')]);if(_0xc353d9[_0x61bc('0x28')]){delete _0xc353d9['name'];}_0xa2bb89[_0x61bc('0x1a')](_0x1bfb42)[_0x61bc('0x29')](_0xc353d9);};}exports[_0x61bc('0x2a')]=function(_0x481a9a,_0x426b14){var _0x557eb8={},_0x8fd7cd={},_0x76767b={'count':0x0,'rows':[]};var _0x24d85a=_[_0x61bc('0x2b')](db['MailTransferReport'][_0x61bc('0x2c')],function(_0x31b3a8){return{'name':_0x31b3a8[_0x61bc('0x2d')],'type':_0x31b3a8[_0x61bc('0x2e')][_0x61bc('0x2f')]};});_0x8fd7cd['model']=_[_0x61bc('0x2b')](_0x24d85a,'name');_0x8fd7cd[_0x61bc('0x30')]=_[_0x61bc('0x31')](_0x481a9a['query']);_0x8fd7cd[_0x61bc('0x32')]=_[_0x61bc('0x33')](_0x8fd7cd[_0x61bc('0x34')],_0x8fd7cd[_0x61bc('0x30')]);_0x557eb8['attributes']=_['intersection'](_0x8fd7cd[_0x61bc('0x34')],qs[_0x61bc('0x35')](_0x481a9a['query']['fields']));_0x557eb8[_0x61bc('0x36')]=_0x557eb8[_0x61bc('0x36')]['length']?_0x557eb8[_0x61bc('0x36')]:_0x8fd7cd['model'];if(!_0x481a9a[_0x61bc('0x30')]['hasOwnProperty'](_0x61bc('0x37'))){_0x557eb8[_0x61bc('0x1e')]=qs[_0x61bc('0x1e')](_0x481a9a[_0x61bc('0x30')][_0x61bc('0x1e')]);_0x557eb8['offset']=qs[_0x61bc('0x1d')](_0x481a9a[_0x61bc('0x30')][_0x61bc('0x1d')]);}_0x557eb8[_0x61bc('0x38')]=qs[_0x61bc('0x39')](_0x481a9a['query']['sort']);_0x557eb8[_0x61bc('0x3a')]=qs['filters'](_[_0x61bc('0x3b')](_0x481a9a['query'],_0x8fd7cd['filters']),_0x24d85a);if(_0x481a9a[_0x61bc('0x30')][_0x61bc('0x3c')]){_0x557eb8[_0x61bc('0x3a')]=_['merge'](_0x557eb8[_0x61bc('0x3a')],{'$or':_[_0x61bc('0x2b')](_0x24d85a,function(_0x5f332b){if(_0x5f332b[_0x61bc('0x2e')]!=='VIRTUAL'){var _0x47e8d6={};_0x47e8d6[_0x5f332b[_0x61bc('0x28')]]={'$like':'%'+_0x481a9a['query'][_0x61bc('0x3c')]+'%'};return _0x47e8d6;}})});}_0x557eb8=_[_0x61bc('0x3d')]({},_0x557eb8,_0x481a9a[_0x61bc('0x3e')]);var _0x4457c4={'where':_0x557eb8[_0x61bc('0x3a')]};return db[_0x61bc('0x3f')][_0x61bc('0x1f')](_0x4457c4)[_0x61bc('0x24')](function(_0x55c903){_0x76767b[_0x61bc('0x1f')]=_0x55c903;if(_0x481a9a[_0x61bc('0x30')]['includeAll']){_0x557eb8['include']=[{'all':!![]}];}return db[_0x61bc('0x3f')][_0x61bc('0x40')](_0x557eb8);})[_0x61bc('0x24')](function(_0x2ff142){_0x76767b[_0x61bc('0x41')]=_0x2ff142;return _0x76767b;})[_0x61bc('0x24')](respondWithFilteredResult(_0x426b14,_0x557eb8))['catch'](handleError(_0x426b14,null));};exports[_0x61bc('0x42')]=function(_0x1792ad,_0x2cdb05){var _0x1cbd8f={'raw':!![],'where':{'id':_0x1792ad['params']['id']}},_0x4d19e0={};_0x4d19e0['model']=_[_0x61bc('0x31')](db[_0x61bc('0x3f')][_0x61bc('0x2c')]);_0x4d19e0[_0x61bc('0x30')]=_[_0x61bc('0x31')](_0x1792ad['query']);_0x4d19e0[_0x61bc('0x32')]=_['intersection'](_0x4d19e0[_0x61bc('0x34')],_0x4d19e0['query']);_0x1cbd8f[_0x61bc('0x36')]=_[_0x61bc('0x33')](_0x4d19e0[_0x61bc('0x34')],qs['fields'](_0x1792ad['query'][_0x61bc('0x35')]));_0x1cbd8f[_0x61bc('0x36')]=_0x1cbd8f[_0x61bc('0x36')][_0x61bc('0x43')]?_0x1cbd8f[_0x61bc('0x36')]:_0x4d19e0['model'];if(_0x1792ad['query']['includeAll']){_0x1cbd8f[_0x61bc('0x44')]=[{'all':!![]}];}_0x1cbd8f=_[_0x61bc('0x3d')]({},_0x1cbd8f,_0x1792ad[_0x61bc('0x3e')]);return db[_0x61bc('0x3f')][_0x61bc('0x45')](_0x1cbd8f)[_0x61bc('0x24')](handleEntityNotFound(_0x2cdb05,null))[_0x61bc('0x24')](respondWithResult(_0x2cdb05,null))[_0x61bc('0x46')](handleError(_0x2cdb05,null));};exports[_0x61bc('0x47')]=function(_0x5888b2,_0xf3e729){return db[_0x61bc('0x3f')]['create'](_0x5888b2[_0x61bc('0x48')],{})[_0x61bc('0x24')](respondWithResult(_0xf3e729,0xc9))['catch'](handleError(_0xf3e729,null));};exports[_0x61bc('0x23')]=function(_0x2c0dd9,_0x37321d){if(_0x2c0dd9[_0x61bc('0x48')]['id']){delete _0x2c0dd9[_0x61bc('0x48')]['id'];}return db[_0x61bc('0x3f')][_0x61bc('0x45')]({'where':{'id':_0x2c0dd9[_0x61bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x37321d,null))[_0x61bc('0x24')](saveUpdates(_0x2c0dd9[_0x61bc('0x48')],null))[_0x61bc('0x24')](respondWithResult(_0x37321d,null))['catch'](handleError(_0x37321d,null));};exports[_0x61bc('0x25')]=function(_0x16e704,_0x2b60f6){return db[_0x61bc('0x3f')][_0x61bc('0x45')]({'where':{'id':_0x16e704[_0x61bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b60f6,null))[_0x61bc('0x24')](removeEntity(_0x2b60f6,null))[_0x61bc('0x46')](handleError(_0x2b60f6,null));};exports['describe']=function(_0x11df05,_0x31cf38){return db['MailTransferReport'][_0x61bc('0x4a')]()[_0x61bc('0x24')](respondWithResult(_0x31cf38,null))['catch'](handleError(_0x31cf38,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7623205..13a316f 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 _0xece0=['moment','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api'];(function(_0x4b2119,_0xaf829b){var _0x33d26e=function(_0x44ec50){while(--_0x44ec50){_0x4b2119['push'](_0x4b2119['shift']());}};_0x33d26e(++_0xaf829b);}(_0xece0,0xa5));var _0x0ece=function(_0x3c2852,_0x28a891){_0x3c2852=_0x3c2852-0x0;var _0x5073cc=_0xece0[_0x3c2852];return _0x5073cc;};'use strict';var _=require(_0x0ece('0x0'));var util=require(_0x0ece('0x1'));var logger=require('../../config/logger')(_0x0ece('0x2'));var moment=require(_0x0ece('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ece('0x4'));var fs=require('fs');var path=require(_0x0ece('0x5'));var rimraf=require(_0x0ece('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x0ece('0x7')]=function(_0x3a107d,_0xb736f9){return _0x3a107d[_0x0ece('0x8')](_0x0ece('0x9'),attributes,{'tableName':_0x0ece('0xa'),'paranoid':![],'indexes':[{'name':_0x0ece('0xb'),'fields':[_0x0ece('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb016,0x129));var _0x6b01=function(_0x4e3278,_0x5cdeb2){_0x4e3278=_0x4e3278-0x0;var _0x3b81ce=_0xb016[_0x4e3278];return _0x3b81ce;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var moment=require(_0x6b01('0x4'));var BPromise=require(_0x6b01('0x5'));var rp=require(_0x6b01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b01('0x7'));var config=require(_0x6b01('0x8'));var attributes=require(_0x6b01('0x9'));module[_0x6b01('0xa')]=function(_0x7bc7b1,_0xe5c773){return _0x7bc7b1[_0x6b01('0xb')]('MailTransferReport',attributes,{'tableName':_0x6b01('0xc'),'paranoid':![],'indexes':[{'name':_0x6b01('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b5a362b..4da3443 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 _0x87f3=['error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x56f532,_0x2c1a3c){var _0x1ffd25=function(_0x43341d){while(--_0x43341d){_0x56f532['push'](_0x56f532['shift']());}};_0x1ffd25(++_0x2c1a3c);}(_0x87f3,0x14f));var _0x387f=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x87f3[_0x11dc39];return _0x457277;};'use strict';var _=require('lodash');var util=require(_0x387f('0x0'));var moment=require(_0x387f('0x1'));var BPromise=require(_0x387f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x387f('0x3'))['db'];var utils=require(_0x387f('0x4'));var logger=require(_0x387f('0x5'))(_0x387f('0x6'));var config=require(_0x387f('0x7'));var jayson=require(_0x387f('0x8'));var client=jayson[_0x387f('0x9')][_0x387f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x303508,_0x1c447a,_0x4e5285){return new BPromise(function(_0x22f669,_0x3718a7){return client[_0x387f('0xb')](_0x303508,_0x4e5285)['then'](function(_0x125fca){logger[_0x387f('0xc')](_0x387f('0xd'),_0x1c447a,_0x387f('0xe'));logger[_0x387f('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x1c447a,'request\x20sent',JSON[_0x387f('0x10')](_0x125fca));if(_0x125fca[_0x387f('0x11')]){if(_0x125fca[_0x387f('0x11')][_0x387f('0x12')]===0x1f4){logger[_0x387f('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1c447a,_0x125fca[_0x387f('0x11')]['message']);return _0x3718a7(_0x125fca['error'][_0x387f('0x13')]);}logger[_0x387f('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1c447a,_0x125fca[_0x387f('0x11')][_0x387f('0x13')]);return _0x22f669(_0x125fca['error'][_0x387f('0x13')]);}else{logger[_0x387f('0xc')](_0x387f('0xd'),_0x1c447a,_0x387f('0xe'));_0x22f669(_0x125fca[_0x387f('0x14')][_0x387f('0x13')]);}})[_0x387f('0x15')](function(_0x90939d){logger[_0x387f('0x11')](_0x387f('0xd'),_0x1c447a,_0x90939d);_0x3718a7(_0x90939d);});});} \ No newline at end of file +var _0x60a4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x368616,_0x23641b){var _0x5687bb=function(_0x10817d){while(--_0x10817d){_0x368616['push'](_0x368616['shift']());}};_0x5687bb(++_0x23641b);}(_0x60a4,0x1a1));var _0x460a=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x60a4[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x460a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x460a('0x1'));var rs=require(_0x460a('0x2'));var fs=require('fs');var Redis=require(_0x460a('0x3'));var db=require(_0x460a('0x4'))['db'];var utils=require(_0x460a('0x5'));var logger=require(_0x460a('0x6'))(_0x460a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x460a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x448b55,_0x2b1b4b,_0x29809d){return new BPromise(function(_0x757186,_0x588969){return client[_0x460a('0x9')](_0x448b55,_0x29809d)['then'](function(_0x42375f){logger[_0x460a('0xa')](_0x460a('0xb'),_0x2b1b4b,_0x460a('0xc'));logger[_0x460a('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2b1b4b,_0x460a('0xc'),JSON[_0x460a('0xe')](_0x42375f));if(_0x42375f['error']){if(_0x42375f[_0x460a('0xf')][_0x460a('0x10')]===0x1f4){logger[_0x460a('0xf')](_0x460a('0xb'),_0x2b1b4b,_0x42375f['error'][_0x460a('0x11')]);return _0x588969(_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);}logger[_0x460a('0xf')](_0x460a('0xb'),_0x2b1b4b,_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);return _0x757186(_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);}else{logger[_0x460a('0xa')](_0x460a('0xb'),_0x2b1b4b,_0x460a('0xc'));_0x757186(_0x42375f[_0x460a('0x12')][_0x460a('0x11')]);}})['catch'](function(_0x11af41){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2b1b4b,_0x11af41);_0x588969(_0x11af41);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 52a29ef..24ce733 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 _0xe90b=['/describe','describe','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x4fe797,_0x2f4f9d){var _0x384bf9=function(_0x34c8bc){while(--_0x34c8bc){_0x4fe797['push'](_0x4fe797['shift']());}};_0x384bf9(++_0x2f4f9d);}(_0xe90b,0x1ec));var _0xbe90=function(_0x131eb1,_0x55b270){_0x131eb1=_0x131eb1-0x0;var _0x3a3b7a=_0xe90b[_0x131eb1];return _0x3a3b7a;};'use strict';var multer=require(_0xbe90('0x0'));var util=require(_0xbe90('0x1'));var path=require(_0xbe90('0x2'));var timeout=require(_0xbe90('0x3'));var express=require(_0xbe90('0x4'));var router=express[_0xbe90('0x5')]();var fs_extra=require(_0xbe90('0x6'));var auth=require(_0xbe90('0x7'));var interaction=require(_0xbe90('0x8'));var config=require(_0xbe90('0x9'));var controller=require(_0xbe90('0xa'));router[_0xbe90('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbe90('0xb')](_0xbe90('0xc'),auth['isAuthenticated'](),controller[_0xbe90('0xd')]);router[_0xbe90('0xb')]('/:id',auth[_0xbe90('0xe')](),controller[_0xbe90('0xf')]);router['post']('/',auth[_0xbe90('0xe')](),controller['create']);router[_0xbe90('0x10')]('/:id',auth[_0xbe90('0xe')](),controller[_0xbe90('0x11')]);router[_0xbe90('0x12')]('/:id',auth[_0xbe90('0xe')](),controller[_0xbe90('0x13')]);module[_0xbe90('0x14')]=router; \ No newline at end of file +var _0xf3f5=['./memberReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x571e5e,_0x119839){var _0x1586ee=function(_0x3a29ee){while(--_0x3a29ee){_0x571e5e['push'](_0x571e5e['shift']());}};_0x1586ee(++_0x119839);}(_0xf3f5,0x125));var _0x5f3f=function(_0x5a6171,_0x41aa71){_0x5a6171=_0x5a6171-0x0;var _0xddd293=_0xf3f5[_0x5a6171];return _0xddd293;};'use strict';var multer=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var path=require(_0x5f3f('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f3f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5f3f('0x4'));var interaction=require(_0x5f3f('0x5'));var config=require(_0x5f3f('0x6'));var controller=require(_0x5f3f('0x7'));router['get']('/',auth[_0x5f3f('0x8')](),controller[_0x5f3f('0x9')]);router[_0x5f3f('0xa')](_0x5f3f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x5f3f('0xa')](_0x5f3f('0xc'),auth[_0x5f3f('0x8')](),controller[_0x5f3f('0xd')]);router[_0x5f3f('0xe')]('/',auth['isAuthenticated'](),controller[_0x5f3f('0xf')]);router[_0x5f3f('0x10')]('/:id',auth[_0x5f3f('0x8')](),controller['update']);router[_0x5f3f('0x11')]('/:id',auth[_0x5f3f('0x8')](),controller[_0x5f3f('0x12')]);module[_0x5f3f('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 95e44b1..6d91803 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 _0xb085=['DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x54bceb,_0x412d35){var _0x169dd1=function(_0x58134c){while(--_0x58134c){_0x54bceb['push'](_0x54bceb['shift']());}};_0x169dd1(++_0x412d35);}(_0xb085,0x14a));var _0x5b08=function(_0x3e1f69,_0x56b287){_0x3e1f69=_0x3e1f69-0x0;var _0x25aeaf=_0xb085[_0x3e1f69];return _0x25aeaf;};'use strict';var Sequelize=require(_0x5b08('0x0'));var moment=require(_0x5b08('0x1'));module[_0x5b08('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5b08('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x5b08('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x5b08('0x5')]},'enterAt':{'type':Sequelize[_0x5b08('0x6')]},'exitAt':{'type':Sequelize[_0x5b08('0x6')],'set':function(_0x4b115c){var _0xb6820c=moment(_0x4b115c);var _0x61547b=moment(this['getDataValue'](_0x5b08('0x7')));var _0x1034fd=_0xb6820c[_0x5b08('0x8')](_0x61547b,_0x5b08('0x9'));this[_0x5b08('0xa')](_0x5b08('0xb'),_0x4b115c);this[_0x5b08('0xa')](_0x5b08('0xc'),_0x1034fd>=0x0?_0x1034fd:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x5b08('0x3')],'comment':_0x5b08('0xd')},'data4':{'type':Sequelize[_0x5b08('0x3')],'comment':_0x5b08('0xe')},'data5':{'type':Sequelize[_0x5b08('0x3')],'comment':_0x5b08('0xf')},'role':{'type':Sequelize[_0x5b08('0x3')]},'internal':{'type':Sequelize[_0x5b08('0x5')]},'uniqueid':{'type':Sequelize[_0x5b08('0x3')]}}; \ No newline at end of file +var _0x09d9=['getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE'];(function(_0x1e5e9c,_0x30f221){var _0x55bc20=function(_0x4707fa){while(--_0x4707fa){_0x1e5e9c['push'](_0x1e5e9c['shift']());}};_0x55bc20(++_0x30f221);}(_0x09d9,0x15b));var _0x909d=function(_0x271ce8,_0x4c3614){_0x271ce8=_0x271ce8-0x0;var _0x435b64=_0x09d9[_0x271ce8];return _0x435b64;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x909d('0x0')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x909d('0x1')]},'type':{'type':Sequelize[_0x909d('0x1')],'defaultValue':_0x909d('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x909d('0x3')]},'enterAt':{'type':Sequelize[_0x909d('0x4')]},'exitAt':{'type':Sequelize[_0x909d('0x4')],'set':function(_0x430293){var _0x47bd55=moment(_0x430293);var _0x2c8a4d=moment(this[_0x909d('0x5')](_0x909d('0x6')));var _0x5ec39d=_0x47bd55['diff'](_0x2c8a4d,_0x909d('0x7'));this[_0x909d('0x8')](_0x909d('0x9'),_0x430293);this[_0x909d('0x8')](_0x909d('0xa'),_0x5ec39d>=0x0?_0x5ec39d:null);}},'data1':{'type':Sequelize[_0x909d('0x1')],'comment':_0x909d('0xb')},'data2':{'type':Sequelize[_0x909d('0x1')],'comment':_0x909d('0xc')},'data3':{'type':Sequelize[_0x909d('0x1')],'comment':_0x909d('0xd')},'data4':{'type':Sequelize[_0x909d('0x1')],'comment':_0x909d('0xe')},'data5':{'type':Sequelize[_0x909d('0x1')],'comment':_0x909d('0xf')},'role':{'type':Sequelize[_0x909d('0x1')]},'internal':{'type':Sequelize[_0x909d('0x3')]},'uniqueid':{'type':Sequelize[_0x909d('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f73d316..1c0fa28 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 _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(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_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['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 +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x55ca[_0x301dab];return _0x2500a2;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e1fdfc0..74cfcd4 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 _0x0e1c=['define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x393ce4,_0x2b523c){var _0xdadc30=function(_0x42a1fc){while(--_0x42a1fc){_0x393ce4['push'](_0x393ce4['shift']());}};_0xdadc30(++_0x2b523c);}(_0x0e1c,0x140));var _0xc0e1=function(_0x3ce02c,_0x4e9953){_0x3ce02c=_0x3ce02c-0x0;var _0x1a4b59=_0x0e1c[_0x3ce02c];return _0x1a4b59;};'use strict';var _=require(_0xc0e1('0x0'));var util=require(_0xc0e1('0x1'));var logger=require(_0xc0e1('0x2'))('api');var moment=require(_0xc0e1('0x3'));var BPromise=require(_0xc0e1('0x4'));var rp=require(_0xc0e1('0x5'));var fs=require('fs');var path=require(_0xc0e1('0x6'));var rimraf=require(_0xc0e1('0x7'));var config=require(_0xc0e1('0x8'));var attributes=require('./memberReport.attributes');module[_0xc0e1('0x9')]=function(_0x538266,_0xcfdb23){return _0x538266[_0xc0e1('0xa')]('MemberReport',attributes,{'tableName':_0xc0e1('0xb'),'paranoid':![],'indexes':[{'name':_0xc0e1('0xc'),'fields':[_0xc0e1('0xd'),_0xc0e1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f00=['MemberReport','membername','interface','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x3ad8a7,_0x143517){var _0x5be4dc=function(_0x16f136){while(--_0x16f136){_0x3ad8a7['push'](_0x3ad8a7['shift']());}};_0x5be4dc(++_0x143517);}(_0x7f00,0x161));var _0x07f0=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7f00[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x07f0('0x0'));var util=require(_0x07f0('0x1'));var logger=require(_0x07f0('0x2'))(_0x07f0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x07f0('0x4'));var fs=require('fs');var path=require(_0x07f0('0x5'));var rimraf=require(_0x07f0('0x6'));var config=require(_0x07f0('0x7'));var attributes=require(_0x07f0('0x8'));module[_0x07f0('0x9')]=function(_0x4f57aa,_0xf1cf9c){return _0x4f57aa[_0x07f0('0xa')](_0x07f0('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x07f0('0xc'),_0x07f0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 3e8a82e..2b3e036 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 _0x5b20=['message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','model','map','CreateMemberReport','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3745d5,_0x3eb7dd){var _0xb2b92d=function(_0x35f5f9){while(--_0x35f5f9){_0x3745d5['push'](_0x3745d5['shift']());}};_0xb2b92d(++_0x3eb7dd);}(_0x5b20,0x86));var _0x05b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b20[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541855,_0x24f11f,_0x43cd94){return new BPromise(function(_0x3be69a,_0x1b66e4){return client[_0x05b2('0xd')](_0x541855,_0x43cd94)[_0x05b2('0xe')](function(_0xfe6680){logger[_0x05b2('0xf')](_0x05b2('0x10'),_0x24f11f,_0x05b2('0x11'));logger[_0x05b2('0x12')](_0x05b2('0x13'),_0x24f11f,_0x05b2('0x11'),JSON[_0x05b2('0x14')](_0xfe6680));if(_0xfe6680[_0x05b2('0x15')]){if(_0xfe6680[_0x05b2('0x15')]['code']===0x1f4){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);return _0x1b66e4(_0xfe6680['error'][_0x05b2('0x16')]);}logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680['error']['message']);return _0x3be69a(_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x24f11f,_0x05b2('0x11'));_0x3be69a(_0xfe6680[_0x05b2('0x17')][_0x05b2('0x16')]);}})[_0x05b2('0x18')](function(_0x234843){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0x234843);_0x1b66e4(_0x234843);});});}exports[_0x05b2('0x19')]=function(_0x468f42){var _0x1fd4b8=this;return new Promise(function(_0x8c390d,_0x3165b7){return db[_0x05b2('0x1a')][_0x05b2('0x1b')]({'raw':_0x468f42[_0x05b2('0x1c')]?_0x468f42[_0x05b2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x468f42[_0x05b2('0x1c')]?_0x468f42[_0x05b2('0x1c')][_0x05b2('0x1d')]||null:null,'attributes':_0x468f42[_0x05b2('0x1c')]?_0x468f42[_0x05b2('0x1c')][_0x05b2('0x1e')]||null:null,'limit':_0x468f42[_0x05b2('0x1c')]?_0x468f42['options'][_0x05b2('0x1f')]||null:null,'include':_0x468f42['options']?_0x468f42[_0x05b2('0x1c')][_0x05b2('0x20')]?_['map'](_0x468f42[_0x05b2('0x1c')][_0x05b2('0x20')],function(_0x3bc5a3){return{'model':db[_0x3bc5a3[_0x05b2('0x21')]],'as':_0x3bc5a3['as'],'attributes':_0x3bc5a3[_0x05b2('0x1e')],'include':_0x3bc5a3[_0x05b2('0x20')]?_[_0x05b2('0x22')](_0x3bc5a3[_0x05b2('0x20')],function(_0x4f1e20){return{'model':db[_0x4f1e20['model']],'as':_0x4f1e20['as'],'attributes':_0x4f1e20['attributes'],'include':_0x4f1e20[_0x05b2('0x20')]?_['map'](_0x4f1e20['include'],function(_0x35b6ba){return{'model':db[_0x35b6ba[_0x05b2('0x21')]],'as':_0x35b6ba['as'],'attributes':_0x35b6ba[_0x05b2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x05b2('0xe')](function(_0x14e31b){logger[_0x05b2('0xf')](_0x05b2('0x19'),_0x468f42);logger['debug'](_0x05b2('0x19'),_0x468f42,JSON[_0x05b2('0x14')](_0x14e31b));_0x8c390d(_0x14e31b);})[_0x05b2('0x18')](function(_0x121ada){logger['error'](_0x05b2('0x19'),_0x121ada['message'],_0x468f42);_0x3165b7(_0x1fd4b8[_0x05b2('0x15')](0x1f4,_0x121ada[_0x05b2('0x16')]));});});};exports[_0x05b2('0x23')]=function(_0x30f0db){var _0x5b83ca=this;return new Promise(function(_0x3fffe0,_0x571856){return db[_0x05b2('0x1a')]['create'](_0x30f0db[_0x05b2('0x24')],{'raw':_0x30f0db[_0x05b2('0x1c')]?_0x30f0db[_0x05b2('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1be4b3){logger[_0x05b2('0xf')](_0x05b2('0x23'),_0x30f0db);logger[_0x05b2('0x12')]('CreateMemberReport',_0x30f0db,JSON[_0x05b2('0x14')](_0x1be4b3));_0x3fffe0(_0x1be4b3);})['catch'](function(_0xe27816){logger[_0x05b2('0x15')]('CreateMemberReport',_0xe27816[_0x05b2('0x16')],_0x30f0db);_0x571856(_0x5b83ca[_0x05b2('0x15')](0x1f4,_0xe27816['message']));});});};exports['UpdateMemberReport']=function(_0x25c3f2){var _0x13560a=this;return new Promise(function(_0x5aa8d7,_0x3e9008){return db[_0x05b2('0x1a')][_0x05b2('0x25')](_0x25c3f2[_0x05b2('0x24')],{'raw':_0x25c3f2['options']?_0x25c3f2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c3f2[_0x05b2('0x1c')]?_0x25c3f2[_0x05b2('0x1c')]['where']||null:null,'attributes':_0x25c3f2[_0x05b2('0x1c')]?_0x25c3f2[_0x05b2('0x1c')][_0x05b2('0x1e')]||null:null,'limit':_0x25c3f2[_0x05b2('0x1c')]?_0x25c3f2[_0x05b2('0x1c')][_0x05b2('0x1f')]||null:null})[_0x05b2('0xe')](function(_0x47fc16){logger[_0x05b2('0xf')](_0x05b2('0x26'),_0x25c3f2);logger[_0x05b2('0x12')](_0x05b2('0x26'),_0x25c3f2,JSON['stringify'](_0x47fc16));_0x5aa8d7(_0x47fc16);})[_0x05b2('0x18')](function(_0x10cee1){logger['error']('UpdateMemberReport',_0x10cee1[_0x05b2('0x16')],_0x25c3f2);_0x3e9008(_0x13560a[_0x05b2('0x15')](0x1f4,_0x10cee1[_0x05b2('0x16')]));});});}; \ No newline at end of file +var _0x1c9a=['raw','CreateMemberReport','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','GetMemberReport','MemberReport','findAll','options','where','attributes','map','include','model','catch','create','body'];(function(_0x365d19,_0x52654f){var _0x107560=function(_0x3059d8){while(--_0x3059d8){_0x365d19['push'](_0x365d19['shift']());}};_0x107560(++_0x52654f);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0xdcb65b,_0x593529){_0xdcb65b=_0xdcb65b-0x0;var _0x311726=_0x1c9a[_0xdcb65b];return _0x311726;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var moment=require('moment');var BPromise=require(_0xa1c9('0x2'));var rs=require(_0xa1c9('0x3'));var fs=require('fs');var Redis=require(_0xa1c9('0x4'));var db=require(_0xa1c9('0x5'))['db'];var utils=require(_0xa1c9('0x6'));var logger=require('../../config/logger')(_0xa1c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x8'));var client=jayson[_0xa1c9('0x9')][_0xa1c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0c89,_0x1a0364,_0x46b19a){return new BPromise(function(_0x3b1a2c,_0xc8bc5a){return client[_0xa1c9('0xb')](_0x2b0c89,_0x46b19a)[_0xa1c9('0xc')](function(_0x2fcbcd){logger[_0xa1c9('0xd')]('MemberReport,\x20%s,\x20%s',_0x1a0364,'request\x20sent');logger[_0xa1c9('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1a0364,_0xa1c9('0xf'),JSON[_0xa1c9('0x10')](_0x2fcbcd));if(_0x2fcbcd[_0xa1c9('0x11')]){if(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0xc8bc5a(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0x3b1a2c(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xd')](_0xa1c9('0x13'),_0x1a0364,_0xa1c9('0xf'));_0x3b1a2c(_0x2fcbcd['result'][_0xa1c9('0x14')]);}})['catch'](function(_0x12d989){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x12d989);_0xc8bc5a(_0x12d989);});});}exports[_0xa1c9('0x15')]=function(_0x13086a){var _0x2d2ad4=this;return new Promise(function(_0x223932,_0x414d70){return db[_0xa1c9('0x16')][_0xa1c9('0x17')]({'raw':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x19')]||null:null,'attributes':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x1a')]||null:null,'limit':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['limit']||null:null,'include':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['include']?_[_0xa1c9('0x1b')](_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x1c')],function(_0x25418a){return{'model':db[_0x25418a[_0xa1c9('0x1d')]],'as':_0x25418a['as'],'attributes':_0x25418a['attributes'],'include':_0x25418a[_0xa1c9('0x1c')]?_[_0xa1c9('0x1b')](_0x25418a[_0xa1c9('0x1c')],function(_0x484a6b){return{'model':db[_0x484a6b[_0xa1c9('0x1d')]],'as':_0x484a6b['as'],'attributes':_0x484a6b[_0xa1c9('0x1a')],'include':_0x484a6b[_0xa1c9('0x1c')]?_[_0xa1c9('0x1b')](_0x484a6b[_0xa1c9('0x1c')],function(_0x339dee){return{'model':db[_0x339dee[_0xa1c9('0x1d')]],'as':_0x339dee['as'],'attributes':_0x339dee[_0xa1c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xc')](function(_0x177f9b){logger[_0xa1c9('0xd')](_0xa1c9('0x15'),_0x13086a);logger[_0xa1c9('0xe')](_0xa1c9('0x15'),_0x13086a,JSON[_0xa1c9('0x10')](_0x177f9b));_0x223932(_0x177f9b);})[_0xa1c9('0x1e')](function(_0x568996){logger[_0xa1c9('0x11')](_0xa1c9('0x15'),_0x568996[_0xa1c9('0x14')],_0x13086a);_0x414d70(_0x2d2ad4[_0xa1c9('0x11')](0x1f4,_0x568996[_0xa1c9('0x14')]));});});};exports['CreateMemberReport']=function(_0x42df4e){var _0x1e09f8=this;return new Promise(function(_0x48ec74,_0x4278cd){return db[_0xa1c9('0x16')][_0xa1c9('0x1f')](_0x42df4e[_0xa1c9('0x20')],{'raw':_0x42df4e[_0xa1c9('0x18')]?_0x42df4e[_0xa1c9('0x18')][_0xa1c9('0x21')]===undefined?!![]:![]:!![]})[_0xa1c9('0xc')](function(_0x2c391e){logger[_0xa1c9('0xd')](_0xa1c9('0x22'),_0x42df4e);logger[_0xa1c9('0xe')](_0xa1c9('0x22'),_0x42df4e,JSON[_0xa1c9('0x10')](_0x2c391e));_0x48ec74(_0x2c391e);})[_0xa1c9('0x1e')](function(_0x4abab8){logger[_0xa1c9('0x11')](_0xa1c9('0x22'),_0x4abab8[_0xa1c9('0x14')],_0x42df4e);_0x4278cd(_0x1e09f8[_0xa1c9('0x11')](0x1f4,_0x4abab8['message']));});});};exports[_0xa1c9('0x23')]=function(_0x365f46){var _0x4eb4fd=this;return new Promise(function(_0x5ab2f2,_0x1aae5d){return db[_0xa1c9('0x16')][_0xa1c9('0x24')](_0x365f46[_0xa1c9('0x20')],{'raw':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x19')]||null:null,'attributes':_0x365f46[_0xa1c9('0x18')]?_0x365f46['options'][_0xa1c9('0x1a')]||null:null,'limit':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x25')]||null:null})[_0xa1c9('0xc')](function(_0x3dc9fd){logger[_0xa1c9('0xd')](_0xa1c9('0x23'),_0x365f46);logger['debug'](_0xa1c9('0x23'),_0x365f46,JSON[_0xa1c9('0x10')](_0x3dc9fd));_0x5ab2f2(_0x3dc9fd);})[_0xa1c9('0x1e')](function(_0x5236fd){logger[_0xa1c9('0x11')](_0xa1c9('0x23'),_0x5236fd[_0xa1c9('0x14')],_0x365f46);_0x1aae5d(_0x4eb4fd[_0xa1c9('0x11')](0x1f4,_0x5236fd[_0xa1c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b001134..ebf68eb 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 _0xd60d=['index','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x11a17f,_0x387093){var _0x29e012=function(_0x39deca){while(--_0x39deca){_0x11a17f['push'](_0x11a17f['shift']());}};_0x29e012(++_0x387093);}(_0xd60d,0xff));var _0xdd60=function(_0x176710,_0x34f0b8){_0x176710=_0x176710-0x0;var _0x1eaf28=_0xd60d[_0x176710];return _0x1eaf28;};'use strict';var multer=require(_0xdd60('0x0'));var util=require(_0xdd60('0x1'));var path=require('path');var timeout=require(_0xdd60('0x2'));var express=require('express');var router=express[_0xdd60('0x3')]();var fs_extra=require(_0xdd60('0x4'));var auth=require(_0xdd60('0x5'));var interaction=require(_0xdd60('0x6'));var config=require(_0xdd60('0x7'));var controller=require('./migration.controller');router[_0xdd60('0x8')]('/',controller[_0xdd60('0x9')]);module[_0xdd60('0xa')]=router; \ No newline at end of file +var _0xa8fb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','connect-timeout'];(function(_0x4642d0,_0x1d5b64){var _0x22197f=function(_0x5b68b9){while(--_0x5b68b9){_0x4642d0['push'](_0x4642d0['shift']());}};_0x22197f(++_0x1d5b64);}(_0xa8fb,0x172));var _0xba8f=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xa8fb[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xba8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba8f('0x1'));var express=require(_0xba8f('0x2'));var router=express[_0xba8f('0x3')]();var fs_extra=require(_0xba8f('0x4'));var auth=require(_0xba8f('0x5'));var interaction=require(_0xba8f('0x6'));var config=require(_0xba8f('0x7'));var controller=require(_0xba8f('0x8'));router[_0xba8f('0x9')]('/',controller[_0xba8f('0xa')]);module[_0xba8f('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index eb57f78..04b4378 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 _0xfb87=['version','exports','STRING'];(function(_0x35ea01,_0x41b2a8){var _0x54964b=function(_0x7cf9a4){while(--_0x7cf9a4){_0x35ea01['push'](_0x35ea01['shift']());}};_0x54964b(++_0x41b2a8);}(_0xfb87,0xee));var _0x7fb8=function(_0x38f730,_0x2c7523){_0x38f730=_0x38f730-0x0;var _0x233bf4=_0xfb87[_0x38f730];return _0x233bf4;};'use strict';var Sequelize=require('sequelize');module[_0x7fb8('0x0')]={'version':{'type':Sequelize[_0x7fb8('0x1')],'unique':_0x7fb8('0x2')}}; \ No newline at end of file +var _0xe1af=['sequelize','STRING'];(function(_0x353f09,_0x2bf06e){var _0x25a2af=function(_0x5b1b26){while(--_0x5b1b26){_0x353f09['push'](_0x353f09['shift']());}};_0x25a2af(++_0x2bf06e);}(_0xe1af,0x1ac));var _0xfe1a=function(_0x5c54a8,_0x5273ff){_0x5c54a8=_0x5c54a8-0x0;var _0x4a159a=_0xe1af[_0x5c54a8];return _0x4a159a;};'use strict';var Sequelize=require(_0xfe1a('0x0'));module['exports']={'version':{'type':Sequelize[_0xfe1a('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 42b9df4..76e9080 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 _0x635e=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','Migration','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x581a91,_0x33d649){var _0x3e8d40=function(_0xde234b){while(--_0xde234b){_0x581a91['push'](_0x581a91['shift']());}};_0x3e8d40(++_0x33d649);}(_0x635e,0xff));var _0xe635=function(_0x13f554,_0x13e23a){_0x13f554=_0x13f554-0x0;var _0x552073=_0x635e[_0x13f554];return _0x552073;};'use strict';var emlformat=require(_0xe635('0x0'));var rimraf=require(_0xe635('0x1'));var zipdir=require(_0xe635('0x2'));var jsonpatch=require(_0xe635('0x3'));var rp=require('request-promise');var moment=require(_0xe635('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe635('0x5'));var path=require('path');var sox=require(_0xe635('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe635('0x7'));var _=require(_0xe635('0x8'));var squel=require(_0xe635('0x9'));var crypto=require('crypto');var jsforce=require(_0xe635('0xa'));var deskjs=require(_0xe635('0xb'));var toCsv=require(_0xe635('0xc'));var querystring=require(_0xe635('0xd'));var Papa=require(_0xe635('0xe'));var Redis=require('ioredis');var authService=require(_0xe635('0xf'));var qs=require(_0xe635('0x10'));var as=require(_0xe635('0x11'));var hardwareService=require(_0xe635('0x12'));var logger=require(_0xe635('0x13'))(_0xe635('0x14'));var utils=require('../../config/utils');var config=require(_0xe635('0x15'));var licenseUtil=require(_0xe635('0x16'));var db=require(_0xe635('0x17'))['db'];function respondWithStatusCode(_0x46f85d,_0x1f94e1){_0x1f94e1=_0x1f94e1||0xcc;return function(_0x3fc0ed){if(_0x3fc0ed){return _0x46f85d[_0xe635('0x18')](_0x1f94e1);}return _0x46f85d[_0xe635('0x19')](_0x1f94e1)[_0xe635('0x1a')]();};}function respondWithResult(_0x348164,_0xae0a83){_0xae0a83=_0xae0a83||0xc8;return function(_0x375f5a){if(_0x375f5a){return _0x348164[_0xe635('0x19')](_0xae0a83)['json'](_0x375f5a);}};}function respondWithFilteredResult(_0x1d5fdf,_0x459ae3){return function(_0x369bb1){if(_0x369bb1){var _0x1d871d=typeof _0x459ae3[_0xe635('0x1b')]===_0xe635('0x1c')&&typeof _0x459ae3[_0xe635('0x1d')]===_0xe635('0x1c');var _0x52c624=_0x369bb1[_0xe635('0x1e')];var _0x2277c0=_0x1d871d?0x0:_0x459ae3['offset'];var _0x3a1b3e=_0x1d871d?_0x369bb1['count']:_0x459ae3[_0xe635('0x1b')]+_0x459ae3[_0xe635('0x1d')];var _0x8da293;if(_0x3a1b3e>=_0x52c624){_0x3a1b3e=_0x52c624;_0x8da293=0xc8;}else{_0x8da293=0xce;}_0x1d5fdf[_0xe635('0x19')](_0x8da293);return _0x1d5fdf[_0xe635('0x1f')](_0xe635('0x20'),_0x2277c0+'-'+_0x3a1b3e+'/'+_0x52c624)['json'](_0x369bb1);}return null;};}function patchUpdates(_0x22230b){return function(_0x447dec){try{jsonpatch[_0xe635('0x21')](_0x447dec,_0x22230b,!![]);}catch(_0x19cd6a){return BPromise[_0xe635('0x22')](_0x19cd6a);}return _0x447dec['save']();};}function saveUpdates(_0x417d51,_0x5a01a8){return function(_0x3ba62b){if(_0x3ba62b){return _0x3ba62b[_0xe635('0x23')](_0x417d51)[_0xe635('0x24')](function(_0x564b2a){return _0x564b2a;});}return null;};}function removeEntity(_0x46314b,_0x4dfd04){return function(_0x46fcc5){if(_0x46fcc5){return _0x46fcc5['destroy']()['then'](function(){_0x46314b[_0xe635('0x19')](0xcc)[_0xe635('0x1a')]();});}};}function handleEntityNotFound(_0x4d2edd,_0x3f52f5){return function(_0x29887c){if(!_0x29887c){_0x4d2edd[_0xe635('0x18')](0x194);}return _0x29887c;};}function handleError(_0x137256,_0x32967f){_0x32967f=_0x32967f||0x1f4;return function(_0x2e669c){logger[_0xe635('0x25')](_0x2e669c[_0xe635('0x26')]);if(_0x2e669c[_0xe635('0x27')]){delete _0x2e669c[_0xe635('0x27')];}_0x137256[_0xe635('0x19')](_0x32967f)[_0xe635('0x28')](_0x2e669c);};}exports[_0xe635('0x29')]=function(_0x574e93,_0x5bdf7f){var _0xb1f75c={},_0x1ee77f={},_0x3ca10b={'count':0x0,'rows':[]};var _0x24982c=_['map'](db[_0xe635('0x2a')]['rawAttributes'],function(_0x5db4c9){return{'name':_0x5db4c9[_0xe635('0x2b')],'type':_0x5db4c9[_0xe635('0x2c')]['key']};});_0x1ee77f[_0xe635('0x2d')]=_[_0xe635('0x2e')](_0x24982c,'name');_0x1ee77f[_0xe635('0x2f')]=_['keys'](_0x574e93['query']);_0x1ee77f[_0xe635('0x30')]=_[_0xe635('0x31')](_0x1ee77f['model'],_0x1ee77f[_0xe635('0x2f')]);_0xb1f75c[_0xe635('0x32')]=_[_0xe635('0x31')](_0x1ee77f[_0xe635('0x2d')],qs[_0xe635('0x33')](_0x574e93[_0xe635('0x2f')]['fields']));_0xb1f75c[_0xe635('0x32')]=_0xb1f75c['attributes'][_0xe635('0x34')]?_0xb1f75c[_0xe635('0x32')]:_0x1ee77f['model'];if(!_0x574e93['query'][_0xe635('0x35')](_0xe635('0x36'))){_0xb1f75c[_0xe635('0x1d')]=qs[_0xe635('0x1d')](_0x574e93[_0xe635('0x2f')][_0xe635('0x1d')]);_0xb1f75c[_0xe635('0x1b')]=qs[_0xe635('0x1b')](_0x574e93['query'][_0xe635('0x1b')]);}_0xb1f75c[_0xe635('0x37')]=qs['sort'](_0x574e93[_0xe635('0x2f')][_0xe635('0x38')]);_0xb1f75c[_0xe635('0x39')]=qs[_0xe635('0x30')](_[_0xe635('0x3a')](_0x574e93[_0xe635('0x2f')],_0x1ee77f[_0xe635('0x30')]),_0x24982c);if(_0x574e93[_0xe635('0x2f')]['filter']){_0xb1f75c[_0xe635('0x39')]=_[_0xe635('0x3b')](_0xb1f75c[_0xe635('0x39')],{'$or':_['map'](_0x24982c,function(_0x4939ac){if(_0x4939ac[_0xe635('0x2c')]!==_0xe635('0x3c')){var _0x411181={};_0x411181[_0x4939ac[_0xe635('0x27')]]={'$like':'%'+_0x574e93[_0xe635('0x2f')][_0xe635('0x3d')]+'%'};return _0x411181;}})});}_0xb1f75c=_['merge']({},_0xb1f75c,_0x574e93[_0xe635('0x3e')]);var _0x220b3e={'where':_0xb1f75c[_0xe635('0x39')]};return db[_0xe635('0x2a')][_0xe635('0x1e')](_0x220b3e)['then'](function(_0x1dd97c){_0x3ca10b['count']=_0x1dd97c;if(_0x574e93['query'][_0xe635('0x3f')]){_0xb1f75c[_0xe635('0x40')]=[{'all':!![]}];}return db[_0xe635('0x2a')][_0xe635('0x41')](_0xb1f75c);})['then'](function(_0x3441d7){_0x3ca10b[_0xe635('0x42')]=_0x3441d7;return _0x3ca10b;})['then'](respondWithFilteredResult(_0x5bdf7f,_0xb1f75c))['catch'](handleError(_0x5bdf7f,null));}; \ No newline at end of file +var _0x4299=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service'];(function(_0x5efa46,_0x192cf2){var _0x177875=function(_0x50f0bc){while(--_0x50f0bc){_0x5efa46['push'](_0x5efa46['shift']());}};_0x177875(++_0x192cf2);}(_0x4299,0x1cd));var _0x9429=function(_0x4d300e,_0x273240){_0x4d300e=_0x4d300e-0x0;var _0x1b1e1c=_0x4299[_0x4d300e];return _0x1b1e1c;};'use strict';var emlformat=require(_0x9429('0x0'));var rimraf=require(_0x9429('0x1'));var zipdir=require(_0x9429('0x2'));var jsonpatch=require(_0x9429('0x3'));var rp=require(_0x9429('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9429('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9429('0x6'));var fs=require('fs');var fs_extra=require(_0x9429('0x7'));var _=require(_0x9429('0x8'));var squel=require(_0x9429('0x9'));var crypto=require(_0x9429('0xa'));var jsforce=require(_0x9429('0xb'));var deskjs=require(_0x9429('0xc'));var toCsv=require(_0x9429('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9429('0xe'));var qs=require(_0x9429('0xf'));var as=require(_0x9429('0x10'));var hardwareService=require(_0x9429('0x11'));var logger=require(_0x9429('0x12'))(_0x9429('0x13'));var utils=require(_0x9429('0x14'));var config=require(_0x9429('0x15'));var licenseUtil=require(_0x9429('0x16'));var db=require(_0x9429('0x17'))['db'];function respondWithStatusCode(_0x27e082,_0x4b8023){_0x4b8023=_0x4b8023||0xcc;return function(_0x389210){if(_0x389210){return _0x27e082[_0x9429('0x18')](_0x4b8023);}return _0x27e082[_0x9429('0x19')](_0x4b8023)[_0x9429('0x1a')]();};}function respondWithResult(_0x287203,_0x2c7337){_0x2c7337=_0x2c7337||0xc8;return function(_0x4de05b){if(_0x4de05b){return _0x287203[_0x9429('0x19')](_0x2c7337)[_0x9429('0x1b')](_0x4de05b);}};}function respondWithFilteredResult(_0xf8114a,_0x42e817){return function(_0x45dcc1){if(_0x45dcc1){var _0x44bd82=typeof _0x42e817['offset']===_0x9429('0x1c')&&typeof _0x42e817[_0x9429('0x1d')]===_0x9429('0x1c');var _0x17a007=_0x45dcc1[_0x9429('0x1e')];var _0x2064b7=_0x44bd82?0x0:_0x42e817[_0x9429('0x1f')];var _0x5c196d=_0x44bd82?_0x45dcc1[_0x9429('0x1e')]:_0x42e817[_0x9429('0x1f')]+_0x42e817[_0x9429('0x1d')];var _0x4084c6;if(_0x5c196d>=_0x17a007){_0x5c196d=_0x17a007;_0x4084c6=0xc8;}else{_0x4084c6=0xce;}_0xf8114a[_0x9429('0x19')](_0x4084c6);return _0xf8114a[_0x9429('0x20')](_0x9429('0x21'),_0x2064b7+'-'+_0x5c196d+'/'+_0x17a007)[_0x9429('0x1b')](_0x45dcc1);}return null;};}function patchUpdates(_0x460437){return function(_0x2f7dcb){try{jsonpatch[_0x9429('0x22')](_0x2f7dcb,_0x460437,!![]);}catch(_0x4f9181){return BPromise[_0x9429('0x23')](_0x4f9181);}return _0x2f7dcb['save']();};}function saveUpdates(_0x2821e1,_0x3f781c){return function(_0x511ead){if(_0x511ead){return _0x511ead[_0x9429('0x24')](_0x2821e1)[_0x9429('0x25')](function(_0x8e18d1){return _0x8e18d1;});}return null;};}function removeEntity(_0x42554b,_0xeccf1b){return function(_0x19277c){if(_0x19277c){return _0x19277c[_0x9429('0x26')]()[_0x9429('0x25')](function(){_0x42554b[_0x9429('0x19')](0xcc)[_0x9429('0x1a')]();});}};}function handleEntityNotFound(_0x1f93ed,_0x4036cb){return function(_0x55f06b){if(!_0x55f06b){_0x1f93ed['sendStatus'](0x194);}return _0x55f06b;};}function handleError(_0xab6996,_0x337ecb){_0x337ecb=_0x337ecb||0x1f4;return function(_0x563929){logger['error'](_0x563929[_0x9429('0x27')]);if(_0x563929[_0x9429('0x28')]){delete _0x563929[_0x9429('0x28')];}_0xab6996[_0x9429('0x19')](_0x337ecb)[_0x9429('0x29')](_0x563929);};}exports[_0x9429('0x2a')]=function(_0x94a7a9,_0x59e9be){var _0x44050f={},_0x5b97fa={},_0x4e75f3={'count':0x0,'rows':[]};var _0x11b55e=_[_0x9429('0x2b')](db[_0x9429('0x2c')][_0x9429('0x2d')],function(_0x79b84){return{'name':_0x79b84[_0x9429('0x2e')],'type':_0x79b84['type']['key']};});_0x5b97fa[_0x9429('0x2f')]=_[_0x9429('0x2b')](_0x11b55e,_0x9429('0x28'));_0x5b97fa['query']=_[_0x9429('0x30')](_0x94a7a9[_0x9429('0x31')]);_0x5b97fa[_0x9429('0x32')]=_[_0x9429('0x33')](_0x5b97fa[_0x9429('0x2f')],_0x5b97fa[_0x9429('0x31')]);_0x44050f[_0x9429('0x34')]=_[_0x9429('0x33')](_0x5b97fa[_0x9429('0x2f')],qs[_0x9429('0x35')](_0x94a7a9['query'][_0x9429('0x35')]));_0x44050f[_0x9429('0x34')]=_0x44050f[_0x9429('0x34')]['length']?_0x44050f[_0x9429('0x34')]:_0x5b97fa[_0x9429('0x2f')];if(!_0x94a7a9['query'][_0x9429('0x36')](_0x9429('0x37'))){_0x44050f[_0x9429('0x1d')]=qs[_0x9429('0x1d')](_0x94a7a9[_0x9429('0x31')][_0x9429('0x1d')]);_0x44050f[_0x9429('0x1f')]=qs[_0x9429('0x1f')](_0x94a7a9[_0x9429('0x31')]['offset']);}_0x44050f[_0x9429('0x38')]=qs[_0x9429('0x39')](_0x94a7a9[_0x9429('0x31')][_0x9429('0x39')]);_0x44050f[_0x9429('0x3a')]=qs['filters'](_[_0x9429('0x3b')](_0x94a7a9['query'],_0x5b97fa['filters']),_0x11b55e);if(_0x94a7a9[_0x9429('0x31')]['filter']){_0x44050f[_0x9429('0x3a')]=_[_0x9429('0x3c')](_0x44050f[_0x9429('0x3a')],{'$or':_[_0x9429('0x2b')](_0x11b55e,function(_0x347df7){if(_0x347df7[_0x9429('0x3d')]!==_0x9429('0x3e')){var _0x566e6a={};_0x566e6a[_0x347df7['name']]={'$like':'%'+_0x94a7a9[_0x9429('0x31')][_0x9429('0x3f')]+'%'};return _0x566e6a;}})});}_0x44050f=_['merge']({},_0x44050f,_0x94a7a9[_0x9429('0x40')]);var _0x560f7f={'where':_0x44050f[_0x9429('0x3a')]};return db[_0x9429('0x2c')][_0x9429('0x1e')](_0x560f7f)[_0x9429('0x25')](function(_0x2d076f){_0x4e75f3[_0x9429('0x1e')]=_0x2d076f;if(_0x94a7a9[_0x9429('0x31')][_0x9429('0x41')]){_0x44050f[_0x9429('0x42')]=[{'all':!![]}];}return db[_0x9429('0x2c')]['findAll'](_0x44050f);})['then'](function(_0xad622c){_0x4e75f3['rows']=_0xad622c;return _0x4e75f3;})['then'](respondWithFilteredResult(_0x59e9be,_0x44050f))[_0x9429('0x43')](handleError(_0x59e9be,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 56907cd..e92b24d 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 _0x0a25=['../../config/environment','./migration.attributes','exports','define','Migration','util','../../config/logger','api','path'];(function(_0x3f2487,_0x20d66e){var _0x14c79c=function(_0x5f26b1){while(--_0x5f26b1){_0x3f2487['push'](_0x3f2487['shift']());}};_0x14c79c(++_0x20d66e);}(_0x0a25,0xb0));var _0x50a2=function(_0x35fb7c,_0x4ee512){_0x35fb7c=_0x35fb7c-0x0;var _0x3b319e=_0x0a25[_0x35fb7c];return _0x3b319e;};'use strict';var _=require('lodash');var util=require(_0x50a2('0x0'));var logger=require(_0x50a2('0x1'))(_0x50a2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x50a2('0x3'));var rimraf=require('rimraf');var config=require(_0x50a2('0x4'));var attributes=require(_0x50a2('0x5'));module[_0x50a2('0x6')]=function(_0x45fcdd,_0x606be1){return _0x45fcdd[_0x50a2('0x7')](_0x50a2('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48d8=['./migration.attributes','exports','define','Migration','migrations','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d552a,_0x39763a){var _0x2aab89=function(_0x6d668a){while(--_0x6d668a){_0x4d552a['push'](_0x4d552a['shift']());}};_0x2aab89(++_0x39763a);}(_0x48d8,0x164));var _0x848d=function(_0x84a349,_0x5945dd){_0x84a349=_0x84a349-0x0;var _0x5e2153=_0x48d8[_0x84a349];return _0x5e2153;};'use strict';var _=require(_0x848d('0x0'));var util=require(_0x848d('0x1'));var logger=require('../../config/logger')(_0x848d('0x2'));var moment=require(_0x848d('0x3'));var BPromise=require(_0x848d('0x4'));var rp=require(_0x848d('0x5'));var fs=require('fs');var path=require(_0x848d('0x6'));var rimraf=require(_0x848d('0x7'));var config=require('../../config/environment');var attributes=require(_0x848d('0x8'));module[_0x848d('0x9')]=function(_0x1b74af,_0x23bbe5){return _0x1b74af[_0x848d('0xa')](_0x848d('0xb'),attributes,{'tableName':_0x848d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e0ee085..779b44d 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 _0x1b73=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1b73,0x1d5));var _0x31b7=function(_0x29f782,_0x40d54c){_0x29f782=_0x29f782-0x0;var _0x11a2cd=_0x1b73[_0x29f782];return _0x11a2cd;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('Migration,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('Migration,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});} \ No newline at end of file +var _0x95af=['info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x2c7f3f,_0x580388){var _0x754dea=function(_0x3f5b92){while(--_0x3f5b92){_0x2c7f3f['push'](_0x2c7f3f['shift']());}};_0x754dea(++_0x580388);}(_0x95af,0x173));var _0xf95a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x95af[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var moment=require('moment');var BPromise=require(_0xf95a('0x2'));var rs=require(_0xf95a('0x3'));var fs=require('fs');var Redis=require(_0xf95a('0x4'));var db=require(_0xf95a('0x5'))['db'];var utils=require(_0xf95a('0x6'));var logger=require(_0xf95a('0x7'))(_0xf95a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf95a('0x9'));var client=jayson['client'][_0xf95a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576610,_0x3f6950,_0x3217af){return new BPromise(function(_0x110ef8,_0x48d314){return client[_0xf95a('0xb')](_0x576610,_0x3217af)[_0xf95a('0xc')](function(_0x5afd05){logger[_0xf95a('0xd')]('Migration,\x20%s,\x20%s',_0x3f6950,_0xf95a('0xe'));logger[_0xf95a('0xf')](_0xf95a('0x10'),_0x3f6950,_0xf95a('0xe'),JSON[_0xf95a('0x11')](_0x5afd05));if(_0x5afd05[_0xf95a('0x12')]){if(_0x5afd05[_0xf95a('0x12')][_0xf95a('0x13')]===0x1f4){logger[_0xf95a('0x12')](_0xf95a('0x14'),_0x3f6950,_0x5afd05[_0xf95a('0x12')][_0xf95a('0x15')]);return _0x48d314(_0x5afd05['error'][_0xf95a('0x15')]);}logger[_0xf95a('0x12')](_0xf95a('0x14'),_0x3f6950,_0x5afd05['error'][_0xf95a('0x15')]);return _0x110ef8(_0x5afd05['error'][_0xf95a('0x15')]);}else{logger['info'](_0xf95a('0x14'),_0x3f6950,_0xf95a('0xe'));_0x110ef8(_0x5afd05[_0xf95a('0x16')]['message']);}})[_0xf95a('0x17')](function(_0x2fd8be){logger[_0xf95a('0x12')](_0xf95a('0x14'),_0x3f6950,_0x2fd8be);_0x48d314(_0x2fd8be);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6ad3923..6eb48e7 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 _0xd065=['isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./network.controller','index','get','/:id'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xd065,0xba));var _0x5d06=function(_0x4dd900,_0x513cfc){_0x4dd900=_0x4dd900-0x0;var _0x1f4874=_0xd065[_0x4dd900];return _0x1f4874;};'use strict';var multer=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var path=require(_0x5d06('0x2'));var timeout=require(_0x5d06('0x3'));var express=require(_0x5d06('0x4'));var router=express[_0x5d06('0x5')]();var fs_extra=require(_0x5d06('0x6'));var auth=require(_0x5d06('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d06('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d06('0x9')]);router[_0x5d06('0xa')](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d06('0xd')]);router[_0x5d06('0xe')](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller[_0x5d06('0xf')]);router['delete'](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller[_0x5d06('0x10')]);module[_0x5d06('0x11')]=router; \ No newline at end of file +var _0xdccd=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','create'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0xdccd,0x102));var _0xddcc=function(_0x4d4763,_0x572963){_0x4d4763=_0x4d4763-0x0;var _0x2a418e=_0xdccd[_0x4d4763];return _0x2a418e;};'use strict';var multer=require(_0xddcc('0x0'));var util=require(_0xddcc('0x1'));var path=require(_0xddcc('0x2'));var timeout=require(_0xddcc('0x3'));var express=require(_0xddcc('0x4'));var router=express['Router']();var fs_extra=require(_0xddcc('0x5'));var auth=require(_0xddcc('0x6'));var interaction=require(_0xddcc('0x7'));var config=require(_0xddcc('0x8'));var controller=require(_0xddcc('0x9'));router['get']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xb')]);router[_0xddcc('0xc')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0xd')]);router['post']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xe')]);router[_0xddcc('0xf')](_0xddcc('0x10'),auth[_0xddcc('0xa')](),controller[_0xddcc('0x11')]);router[_0xddcc('0x12')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0x13')]);module[_0xddcc('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c39c8a4..90561c2 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 _0xf847=['sequelize','ENUM','localnet','externip','stun','STRING'];(function(_0x268c2f,_0x16bb95){var _0x59afce=function(_0x157972){while(--_0x157972){_0x268c2f['push'](_0x268c2f['shift']());}};_0x59afce(++_0x16bb95);}(_0xf847,0xf0));var _0x7f84=function(_0x4f4720,_0x1f63f2){_0x4f4720=_0x4f4720-0x0;var _0x4d9733=_0xf847[_0x4f4720];return _0x4d9733;};'use strict';var Sequelize=require(_0x7f84('0x0'));module['exports']={'type':{'type':Sequelize[_0x7f84('0x1')](_0x7f84('0x2'),_0x7f84('0x3'),_0x7f84('0x4'),'turn')},'value':{'type':Sequelize[_0x7f84('0x5')]},'username':{'type':Sequelize[_0x7f84('0x5')]},'password':{'type':Sequelize[_0x7f84('0x5')]}}; \ No newline at end of file +var _0x7ee3=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x17815a,_0x4243e0){var _0x3882a4=function(_0xae120a){while(--_0xae120a){_0x17815a['push'](_0x17815a['shift']());}};_0x3882a4(++_0x4243e0);}(_0x7ee3,0xe8));var _0x37ee=function(_0x8cb592,_0x1d250d){_0x8cb592=_0x8cb592-0x0;var _0x108d23=_0x7ee3[_0x8cb592];return _0x108d23;};'use strict';var Sequelize=require(_0x37ee('0x0'));module[_0x37ee('0x1')]={'type':{'type':Sequelize[_0x37ee('0x2')](_0x37ee('0x3'),_0x37ee('0x4'),_0x37ee('0x5'),_0x37ee('0x6'))},'value':{'type':Sequelize[_0x37ee('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x37ee('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 594e670..2392f7f 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 _0x1beb=['sequelize','transaction','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','params','/etc/asterisk/sip_xcally_%s.conf','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','Network,\x20%s,\x20%s','message','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','send','index','map','Network','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','keys','includeAll'];(function(_0x218036,_0x810206){var _0x410dc5=function(_0x1fd5f4){while(--_0x1fd5f4){_0x218036['push'](_0x218036['shift']());}};_0x410dc5(++_0x810206);}(_0x1beb,0x1d2));var _0xb1be=function(_0x14a1f8,_0x2f604c){_0x14a1f8=_0x14a1f8-0x0;var _0xb3b162=_0x1beb[_0x14a1f8];return _0xb3b162;};'use strict';var emlformat=require(_0xb1be('0x0'));var rimraf=require(_0xb1be('0x1'));var zipdir=require(_0xb1be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1be('0x3'));var moment=require(_0xb1be('0x4'));var BPromise=require(_0xb1be('0x5'));var Mustache=require(_0xb1be('0x6'));var util=require(_0xb1be('0x7'));var path=require(_0xb1be('0x8'));var sox=require('sox');var csv=require(_0xb1be('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1be('0xa'));var squel=require(_0xb1be('0xb'));var crypto=require(_0xb1be('0xc'));var jsforce=require(_0xb1be('0xd'));var deskjs=require(_0xb1be('0xe'));var toCsv=require(_0xb1be('0x9'));var querystring=require(_0xb1be('0xf'));var Papa=require(_0xb1be('0x10'));var Redis=require(_0xb1be('0x11'));var authService=require(_0xb1be('0x12'));var qs=require(_0xb1be('0x13'));var as=require(_0xb1be('0x14'));var hardwareService=require(_0xb1be('0x15'));var logger=require('../../config/logger')(_0xb1be('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb1be('0x17'));var db=require(_0xb1be('0x18'))['db'];var jayson=require(_0xb1be('0x19'));var client=jayson[_0xb1be('0x1a')][_0xb1be('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x213ab4,_0x1a5fdf,_0x558a41,_0x255dd0){return new BPromise(function(_0x2faea9,_0x41e31e){var _0x5bab51=_0x255dd0||client;return _0x5bab51[_0xb1be('0x1c')](_0x213ab4,_0x558a41)[_0xb1be('0x1d')](function(_0x54eaf6){logger[_0xb1be('0x1e')]('Network,\x20%s,\x20%s',_0x1a5fdf,'request\x20sent');logger[_0xb1be('0x1f')](_0xb1be('0x20'),_0x1a5fdf,'request\x20sent',JSON[_0xb1be('0x21')](_0x54eaf6));if(_0x54eaf6['error']){if(_0x54eaf6['error'][_0xb1be('0x22')]===0x1f4){logger[_0xb1be('0x23')](_0xb1be('0x24'),_0x1a5fdf,_0x54eaf6[_0xb1be('0x23')][_0xb1be('0x25')]);return _0x41e31e(_0x54eaf6[_0xb1be('0x23')][_0xb1be('0x25')]);}logger[_0xb1be('0x23')](_0xb1be('0x24'),_0x1a5fdf,_0x54eaf6[_0xb1be('0x23')]['message']);return _0x2faea9(_0x54eaf6['error'][_0xb1be('0x25')]);}else{logger[_0xb1be('0x1e')](_0xb1be('0x24'),_0x1a5fdf,'request\x20sent');_0x2faea9(_0x54eaf6['result'][_0xb1be('0x25')]);}})['catch'](function(_0x342c83){logger[_0xb1be('0x23')](_0xb1be('0x24'),_0x1a5fdf,_0x342c83);_0x41e31e(_0x342c83);});});}function respondWithStatusCode(_0x7498c2,_0x1e8fe0){_0x1e8fe0=_0x1e8fe0||0xcc;return function(_0x4c5fd2){if(_0x4c5fd2){return _0x7498c2[_0xb1be('0x26')](_0x1e8fe0);}return _0x7498c2[_0xb1be('0x27')](_0x1e8fe0)[_0xb1be('0x28')]();};}function respondWithResult(_0x525607,_0xe50e4){_0xe50e4=_0xe50e4||0xc8;return function(_0x555b27){if(_0x555b27){return _0x525607[_0xb1be('0x27')](_0xe50e4)['json'](_0x555b27);}};}function respondWithFilteredResult(_0x41b212,_0x2e44e1){return function(_0xc0e635){if(_0xc0e635){var _0x5cffee=typeof _0x2e44e1['offset']===_0xb1be('0x29')&&typeof _0x2e44e1[_0xb1be('0x2a')]===_0xb1be('0x29');var _0x2eec58=_0xc0e635[_0xb1be('0x2b')];var _0x490729=_0x5cffee?0x0:_0x2e44e1[_0xb1be('0x2c')];var _0x50ab8b=_0x5cffee?_0xc0e635['count']:_0x2e44e1[_0xb1be('0x2c')]+_0x2e44e1[_0xb1be('0x2a')];var _0x40d8ed;if(_0x50ab8b>=_0x2eec58){_0x50ab8b=_0x2eec58;_0x40d8ed=0xc8;}else{_0x40d8ed=0xce;}_0x41b212['status'](_0x40d8ed);return _0x41b212['set'](_0xb1be('0x2d'),_0x490729+'-'+_0x50ab8b+'/'+_0x2eec58)[_0xb1be('0x2e')](_0xc0e635);}return null;};}function patchUpdates(_0x36dabf){return function(_0x24c406){try{jsonpatch[_0xb1be('0x2f')](_0x24c406,_0x36dabf,!![]);}catch(_0x3c38bc){return BPromise[_0xb1be('0x30')](_0x3c38bc);}return _0x24c406[_0xb1be('0x31')]();};}function saveUpdates(_0x38ab5a,_0x116643){return function(_0x263695){if(_0x263695){return _0x263695[_0xb1be('0x32')](_0x38ab5a)[_0xb1be('0x1d')](function(_0x7da5c2){return _0x7da5c2;});}return null;};}function removeEntity(_0x4a9942,_0x530634){return function(_0x35b4b8){if(_0x35b4b8){return _0x35b4b8[_0xb1be('0x33')]()[_0xb1be('0x1d')](function(){_0x4a9942[_0xb1be('0x27')](0xcc)[_0xb1be('0x28')]();});}};}function handleEntityNotFound(_0x9a66cf,_0x46862b){return function(_0x2cfeb8){if(!_0x2cfeb8){_0x9a66cf[_0xb1be('0x26')](0x194);}return _0x2cfeb8;};}function handleError(_0x62526b,_0x5cdd71){_0x5cdd71=_0x5cdd71||0x1f4;return function(_0x1807b2){logger[_0xb1be('0x23')](_0x1807b2['stack']);if(_0x1807b2['name']){delete _0x1807b2['name'];}_0x62526b['status'](_0x5cdd71)[_0xb1be('0x34')](_0x1807b2);};}exports[_0xb1be('0x35')]=function(_0x498efc,_0x17b5ff){var _0x27e3ff={},_0x303d2d={},_0x3a6275={'count':0x0,'rows':[]};var _0x21e91a=_[_0xb1be('0x36')](db[_0xb1be('0x37')][_0xb1be('0x38')],function(_0x29b662){return{'name':_0x29b662[_0xb1be('0x39')],'type':_0x29b662[_0xb1be('0x3a')][_0xb1be('0x3b')]};});_0x303d2d[_0xb1be('0x3c')]=_['map'](_0x21e91a,_0xb1be('0x3d'));_0x303d2d[_0xb1be('0x3e')]=_['keys'](_0x498efc['query']);_0x303d2d['filters']=_[_0xb1be('0x3f')](_0x303d2d[_0xb1be('0x3c')],_0x303d2d[_0xb1be('0x3e')]);_0x27e3ff[_0xb1be('0x40')]=_['intersection'](_0x303d2d['model'],qs[_0xb1be('0x41')](_0x498efc['query'][_0xb1be('0x41')]));_0x27e3ff[_0xb1be('0x40')]=_0x27e3ff[_0xb1be('0x40')][_0xb1be('0x42')]?_0x27e3ff[_0xb1be('0x40')]:_0x303d2d[_0xb1be('0x3c')];if(!_0x498efc['query'][_0xb1be('0x43')](_0xb1be('0x44'))){_0x27e3ff[_0xb1be('0x2a')]=qs[_0xb1be('0x2a')](_0x498efc[_0xb1be('0x3e')]['limit']);_0x27e3ff[_0xb1be('0x2c')]=qs['offset'](_0x498efc['query'][_0xb1be('0x2c')]);}_0x27e3ff[_0xb1be('0x45')]=qs[_0xb1be('0x46')](_0x498efc['query'][_0xb1be('0x46')]);_0x27e3ff[_0xb1be('0x47')]=qs[_0xb1be('0x48')](_[_0xb1be('0x49')](_0x498efc[_0xb1be('0x3e')],_0x303d2d[_0xb1be('0x48')]),_0x21e91a);if(_0x498efc['query'][_0xb1be('0x4a')]){_0x27e3ff[_0xb1be('0x47')]=_['merge'](_0x27e3ff[_0xb1be('0x47')],{'$or':_[_0xb1be('0x36')](_0x21e91a,function(_0x50826b){if(_0x50826b[_0xb1be('0x3a')]!==_0xb1be('0x4b')){var _0x5ce324={};_0x5ce324[_0x50826b[_0xb1be('0x3d')]]={'$like':'%'+_0x498efc['query'][_0xb1be('0x4a')]+'%'};return _0x5ce324;}})});}_0x27e3ff=_[_0xb1be('0x4c')]({},_0x27e3ff,_0x498efc[_0xb1be('0x4d')]);var _0x534e08={'where':_0x27e3ff[_0xb1be('0x47')]};return db['Network']['count'](_0x534e08)[_0xb1be('0x1d')](function(_0x58218d){_0x3a6275[_0xb1be('0x2b')]=_0x58218d;if(_0x498efc['query']['includeAll']){_0x27e3ff[_0xb1be('0x4e')]=[{'all':!![]}];}return db['Network'][_0xb1be('0x4f')](_0x27e3ff);})[_0xb1be('0x1d')](function(_0x2f802b){_0x3a6275['rows']=_0x2f802b;return _0x3a6275;})[_0xb1be('0x1d')](respondWithFilteredResult(_0x17b5ff,_0x27e3ff))[_0xb1be('0x50')](handleError(_0x17b5ff,null));};exports[_0xb1be('0x51')]=function(_0x5d677f,_0x48093a){var _0x540d49={'raw':!![],'where':{'id':_0x5d677f['params']['id']}},_0xcc4399={};_0xcc4399['model']=_[_0xb1be('0x52')](db[_0xb1be('0x37')]['rawAttributes']);_0xcc4399[_0xb1be('0x3e')]=_[_0xb1be('0x52')](_0x5d677f[_0xb1be('0x3e')]);_0xcc4399[_0xb1be('0x48')]=_[_0xb1be('0x3f')](_0xcc4399['model'],_0xcc4399[_0xb1be('0x3e')]);_0x540d49[_0xb1be('0x40')]=_[_0xb1be('0x3f')](_0xcc4399[_0xb1be('0x3c')],qs[_0xb1be('0x41')](_0x5d677f[_0xb1be('0x3e')][_0xb1be('0x41')]));_0x540d49[_0xb1be('0x40')]=_0x540d49['attributes'][_0xb1be('0x42')]?_0x540d49['attributes']:_0xcc4399[_0xb1be('0x3c')];if(_0x5d677f[_0xb1be('0x3e')][_0xb1be('0x53')]){_0x540d49[_0xb1be('0x4e')]=[{'all':!![]}];}_0x540d49=_[_0xb1be('0x4c')]({},_0x540d49,_0x5d677f[_0xb1be('0x4d')]);return db[_0xb1be('0x37')]['find'](_0x540d49)['then'](handleEntityNotFound(_0x48093a,null))[_0xb1be('0x1d')](respondWithResult(_0x48093a,null))[_0xb1be('0x50')](handleError(_0x48093a,null));};exports['create']=function(_0x5e82e3,_0x940991,_0x290509){var _0x475b00;return db[_0xb1be('0x54')][_0xb1be('0x55')](function(_0x3ad254){return db[_0xb1be('0x37')][_0xb1be('0x56')](_0x5e82e3[_0xb1be('0x57')],{'raw':!![]})[_0xb1be('0x1d')](function(_0x2425f1){_0x475b00=_0x2425f1;return db[_0xb1be('0x37')][_0xb1be('0x4f')]({'where':{'type':_0x5e82e3[_0xb1be('0x57')][_0xb1be('0x3a')]},'raw':!![]});})[_0xb1be('0x1d')](function(_0x4b14a2){if(_0x475b00[_0xb1be('0x3a')]['toUpperCase']()==_0xb1be('0x58')){var _0x4bea0c=fs['readFileSync'](path[_0xb1be('0x59')](config[_0xb1be('0x5a')],_0xb1be('0x5b')),_0xb1be('0x5c'));var _0x1be60f=ejs['render'](_0x4bea0c,{'networks':_0x4b14a2||[]});fs[_0xb1be('0x5d')](_0xb1be('0x5e'),_0x1be60f);return respondWithRpcPromise(_0xb1be('0x5f'),'create',{'module':_0xb1be('0x60')});}else if(_0x475b00[_0xb1be('0x3a')][_0xb1be('0x61')]()==_0xb1be('0x62')){var _0x187d22=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config['root'],_0xb1be('0x64')),_0xb1be('0x5c'));var _0x2e8d5a=ejs[_0xb1be('0x65')](_0x187d22,{'networks':_0x4b14a2||[]});fs[_0xb1be('0x5d')](_0xb1be('0x66'),_0x2e8d5a);return respondWithRpcPromise(_0xb1be('0x5f'),_0xb1be('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x3cd4dc=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config['root'],_0xb1be('0x67')),'utf8');var _0x2d7b2e=ejs[_0xb1be('0x65')](_0x3cd4dc,{'networks':_0x4b14a2||[]});fs[_0xb1be('0x5d')](util[_0xb1be('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x5e82e3[_0xb1be('0x57')][_0xb1be('0x3a')][_0xb1be('0x69')]()),_0x2d7b2e);return respondWithRpcPromise(_0xb1be('0x5f'),_0xb1be('0x56'),{'module':_0xb1be('0x6a')});}return null;})[_0xb1be('0x1d')](function(){return _0x475b00;});})[_0xb1be('0x1d')](respondWithResult(_0x940991,0xc9))[_0xb1be('0x50')](handleError(_0x940991,null));};exports[_0xb1be('0x32')]=function(_0x5a11af,_0x36ab18,_0x762d1c){var _0x5cb344;return db[_0xb1be('0x54')][_0xb1be('0x55')](function(_0x5153f3){return db[_0xb1be('0x37')]['find']({'where':{'id':_0x5a11af[_0xb1be('0x6b')]['id']}})['then'](handleEntityNotFound(_0x36ab18,null))[_0xb1be('0x1d')](saveUpdates(_0x5a11af[_0xb1be('0x57')],null))[_0xb1be('0x1d')](function(_0x587250){if(_0x587250){_0x5cb344=_0x587250;return db['Network']['findAll']({'where':{'type':_0x5cb344['type']},'raw':!![]});}return null;})[_0xb1be('0x1d')](function(_0x52e857){if(_0x5cb344[_0xb1be('0x3a')]['toUpperCase']()=='STUN'){var _0x30eaa1=fs[_0xb1be('0x63')](path['join'](config[_0xb1be('0x5a')],_0xb1be('0x5b')),_0xb1be('0x5c'));var _0x5952ed=ejs[_0xb1be('0x65')](_0x30eaa1,{'networks':_0x52e857||[]});fs[_0xb1be('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x5952ed);return respondWithRpcPromise(_0xb1be('0x5f'),'update',{'module':'res_stun_monitor.so'});}else if(_0x5cb344[_0xb1be('0x3a')][_0xb1be('0x61')]()==_0xb1be('0x62')){var _0xe9a500=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x59e5bd=ejs[_0xb1be('0x65')](_0xe9a500,{'networks':_0x52e857||[]});fs[_0xb1be('0x5d')](_0xb1be('0x66'),_0x59e5bd);return respondWithRpcPromise('Reload',_0xb1be('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x4385c5=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config[_0xb1be('0x5a')],_0xb1be('0x67')),'utf8');var _0xa2be0=ejs[_0xb1be('0x65')](_0x4385c5,{'networks':_0x52e857||[]});fs[_0xb1be('0x5d')](util[_0xb1be('0x68')](_0xb1be('0x6c'),_0x5a11af['body']['type'][_0xb1be('0x69')]()),_0xa2be0);return respondWithRpcPromise(_0xb1be('0x5f'),_0xb1be('0x32'),{'module':'chan_sip.so'});}return null;})[_0xb1be('0x1d')](function(_0x2e5619){if(_0x2e5619){return _0x5cb344;}return null;});})[_0xb1be('0x1d')](respondWithResult(_0x36ab18,null))[_0xb1be('0x50')](handleError(_0x36ab18,null));};exports['destroy']=function(_0x738c45,_0xe145c3,_0x4fa166){var _0xd08b18;return db[_0xb1be('0x37')][_0xb1be('0x6d')]({'where':{'id':_0x738c45['params']['id']}})[_0xb1be('0x1d')](function(_0x231b56){_0xd08b18=_0x231b56;return _0x231b56;})[_0xb1be('0x1d')](handleEntityNotFound(_0xe145c3,null))[_0xb1be('0x1d')](removeEntity(_0xe145c3,null))[_0xb1be('0x1d')](function(){if(_0xd08b18){return db[_0xb1be('0x37')][_0xb1be('0x4f')]({'where':{'type':_0xd08b18[_0xb1be('0x3a')]},'raw':!![]});}})[_0xb1be('0x1d')](function(_0x596fb1){if(_0xd08b18['type'][_0xb1be('0x61')]()==_0xb1be('0x58')){var _0x529215=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config[_0xb1be('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xb1be('0x5c'));var _0x2b9cde=ejs['render'](_0x529215,{'networks':_0x596fb1||[]});fs[_0xb1be('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x2b9cde);return respondWithRpcPromise(_0xb1be('0x5f'),'destroy',{'module':_0xb1be('0x60')});}else if(_0xd08b18['type'][_0xb1be('0x61')]()==_0xb1be('0x62')){var _0x34a8a4=fs[_0xb1be('0x63')](path['join'](config[_0xb1be('0x5a')],_0xb1be('0x64')),_0xb1be('0x5c'));var _0x4c9913=ejs[_0xb1be('0x65')](_0x34a8a4,{'networks':_0x596fb1||[]});fs[_0xb1be('0x5d')](_0xb1be('0x66'),_0x4c9913);return respondWithRpcPromise(_0xb1be('0x5f'),_0xb1be('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x163bd4=fs[_0xb1be('0x63')](path[_0xb1be('0x59')](config[_0xb1be('0x5a')],_0xb1be('0x67')),_0xb1be('0x5c'));var _0x43214d=ejs[_0xb1be('0x65')](_0x163bd4,{'networks':_0x596fb1||[]});fs[_0xb1be('0x5d')](util[_0xb1be('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x738c45[_0xb1be('0x57')][_0xb1be('0x3a')][_0xb1be('0x69')]()),_0x43214d);return respondWithRpcPromise(_0xb1be('0x5f'),_0xb1be('0x33'),{'module':_0xb1be('0x6a')});}return null;})[_0xb1be('0x50')](handleError(_0xe145c3,null));}; \ No newline at end of file +var _0xe336=['create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','format','destroy','util','path','ejs','../../components/parsers/qs','api','http','then','info','request\x20sent','debug','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','stack','name','send','index','Network','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','params','rawAttributes','include','find'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xe336,0x68));var _0x6e33=function(_0x46c297,_0x43c5c){_0x46c297=_0x46c297-0x0;var _0x3afa5a=_0xe336[_0x46c297];return _0x3afa5a;};'use strict';var util=require(_0x6e33('0x0'));var path=require(_0x6e33('0x1'));var ejs=require(_0x6e33('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x6e33('0x3'));var logger=require('../../config/logger')(_0x6e33('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x6e33('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4e9733,_0x16e008,_0x34345a,_0x4de98e){return new Promise(function(_0x356b25,_0x474ad4){var _0x3f6236=_0x4de98e||client;return _0x3f6236['request'](_0x4e9733,_0x34345a)[_0x6e33('0x6')](function(_0x53c63a){logger[_0x6e33('0x7')]('Network,\x20%s,\x20%s',_0x16e008,_0x6e33('0x8'));logger[_0x6e33('0x9')]('Network,\x20%s,\x20%s,\x20%s',_0x16e008,'request\x20sent',JSON['stringify'](_0x53c63a));if(_0x53c63a[_0x6e33('0xa')]){if(_0x53c63a[_0x6e33('0xa')][_0x6e33('0xb')]===0x1f4){logger[_0x6e33('0xa')](_0x6e33('0xc'),_0x16e008,_0x53c63a[_0x6e33('0xa')][_0x6e33('0xd')]);return _0x474ad4(_0x53c63a[_0x6e33('0xa')]['message']);}logger[_0x6e33('0xa')](_0x6e33('0xc'),_0x16e008,_0x53c63a[_0x6e33('0xa')][_0x6e33('0xd')]);return _0x356b25(_0x53c63a[_0x6e33('0xa')]['message']);}else{logger['info'](_0x6e33('0xc'),_0x16e008,_0x6e33('0x8'));_0x356b25(_0x53c63a[_0x6e33('0xe')][_0x6e33('0xd')]);}})[_0x6e33('0xf')](function(_0x2e8062){logger['error'](_0x6e33('0xc'),_0x16e008,_0x2e8062);_0x474ad4(_0x2e8062);});});}function respondWithResult(_0x449937,_0x3f9810){_0x3f9810=_0x3f9810||0xc8;return function(_0x3c6b11){if(_0x3c6b11){return _0x449937[_0x6e33('0x10')](_0x3f9810)[_0x6e33('0x11')](_0x3c6b11);}};}function respondWithFilteredResult(_0x2592e7,_0x138d66){return function(_0x58e83a){if(_0x58e83a){var _0x20e287=typeof _0x138d66[_0x6e33('0x12')]===_0x6e33('0x13')&&typeof _0x138d66[_0x6e33('0x14')]==='undefined';var _0x4ae7b7=_0x58e83a[_0x6e33('0x15')];var _0x14c7f1=_0x20e287?0x0:_0x138d66[_0x6e33('0x12')];var _0x6e6f5d=_0x20e287?_0x58e83a[_0x6e33('0x15')]:_0x138d66[_0x6e33('0x12')]+_0x138d66['limit'];var _0x1bfa9e;if(_0x6e6f5d>=_0x4ae7b7){_0x6e6f5d=_0x4ae7b7;_0x1bfa9e=0xc8;}else{_0x1bfa9e=0xce;}_0x2592e7[_0x6e33('0x10')](_0x1bfa9e);return _0x2592e7[_0x6e33('0x16')](_0x6e33('0x17'),_0x14c7f1+'-'+_0x6e6f5d+'/'+_0x4ae7b7)[_0x6e33('0x11')](_0x58e83a);}return null;};}function saveUpdates(_0x35ce27){return function(_0x287bb8){if(_0x287bb8){return _0x287bb8[_0x6e33('0x18')](_0x35ce27)['then'](function(_0x22cf27){return _0x22cf27;});}return null;};}function removeEntity(_0x1009fc){return function(_0x407fd4){if(_0x407fd4){return _0x407fd4['destroy']()[_0x6e33('0x6')](function(){_0x1009fc[_0x6e33('0x10')](0xcc)[_0x6e33('0x19')]();});}};}function handleEntityNotFound(_0x38730a){return function(_0x5bfdce){if(!_0x5bfdce){_0x38730a['sendStatus'](0x194);}return _0x5bfdce;};}function handleError(_0x5743c7,_0x236a13){_0x236a13=_0x236a13||0x1f4;return function(_0x4c732e){logger[_0x6e33('0xa')](_0x4c732e[_0x6e33('0x1a')]);if(_0x4c732e[_0x6e33('0x1b')]){delete _0x4c732e['name'];}_0x5743c7[_0x6e33('0x10')](_0x236a13)[_0x6e33('0x1c')](_0x4c732e);};}exports[_0x6e33('0x1d')]=function(_0xae9de,_0x2abab1){var _0x29062f={},_0x346c34={},_0x48662a={'count':0x0,'rows':[]};var _0x309ea9=_['map'](db[_0x6e33('0x1e')]['rawAttributes'],function(_0xbadf50){return{'name':_0xbadf50[_0x6e33('0x1f')],'type':_0xbadf50[_0x6e33('0x20')][_0x6e33('0x21')]};});_0x346c34['model']=_[_0x6e33('0x22')](_0x309ea9,_0x6e33('0x1b'));_0x346c34[_0x6e33('0x23')]=_[_0x6e33('0x24')](_0xae9de[_0x6e33('0x23')]);_0x346c34[_0x6e33('0x25')]=_[_0x6e33('0x26')](_0x346c34[_0x6e33('0x27')],_0x346c34[_0x6e33('0x23')]);_0x29062f[_0x6e33('0x28')]=_['intersection'](_0x346c34['model'],qs[_0x6e33('0x29')](_0xae9de['query'][_0x6e33('0x29')]));_0x29062f[_0x6e33('0x28')]=_0x29062f['attributes'][_0x6e33('0x2a')]?_0x29062f[_0x6e33('0x28')]:_0x346c34[_0x6e33('0x27')];if(!_0xae9de[_0x6e33('0x23')][_0x6e33('0x2b')](_0x6e33('0x2c'))){_0x29062f[_0x6e33('0x14')]=qs[_0x6e33('0x14')](_0xae9de[_0x6e33('0x23')]['limit']);_0x29062f[_0x6e33('0x12')]=qs[_0x6e33('0x12')](_0xae9de['query'][_0x6e33('0x12')]);}_0x29062f[_0x6e33('0x2d')]=qs['sort'](_0xae9de['query'][_0x6e33('0x2e')]);_0x29062f[_0x6e33('0x2f')]=qs[_0x6e33('0x25')](_[_0x6e33('0x30')](_0xae9de[_0x6e33('0x23')],_0x346c34[_0x6e33('0x25')]),_0x309ea9);if(_0xae9de[_0x6e33('0x23')][_0x6e33('0x31')]){_0x29062f['where']=_['merge'](_0x29062f[_0x6e33('0x2f')],{'$or':_['map'](_0x309ea9,function(_0x3c7c06){if(_0x3c7c06[_0x6e33('0x20')]!=='VIRTUAL'){var _0x5a68a7={};_0x5a68a7[_0x3c7c06[_0x6e33('0x1b')]]={'$like':'%'+_0xae9de[_0x6e33('0x23')][_0x6e33('0x31')]+'%'};return _0x5a68a7;}})});}_0x29062f=_[_0x6e33('0x32')]({},_0x29062f,_0xae9de[_0x6e33('0x33')]);var _0x31ad6d={'where':_0x29062f[_0x6e33('0x2f')]};return db[_0x6e33('0x1e')][_0x6e33('0x15')](_0x31ad6d)[_0x6e33('0x6')](function(_0xef46b7){_0x48662a[_0x6e33('0x15')]=_0xef46b7;if(_0xae9de[_0x6e33('0x23')][_0x6e33('0x34')]){_0x29062f['include']=[{'all':!![]}];}return db[_0x6e33('0x1e')][_0x6e33('0x35')](_0x29062f);})['then'](function(_0x3fd2c8){_0x48662a['rows']=_0x3fd2c8;return _0x48662a;})['then'](respondWithFilteredResult(_0x2abab1,_0x29062f))[_0x6e33('0xf')](handleError(_0x2abab1,null));};exports['show']=function(_0x187e9e,_0x310731){var _0x2c7871={'raw':!![],'where':{'id':_0x187e9e[_0x6e33('0x36')]['id']}},_0x3e6580={};_0x3e6580[_0x6e33('0x27')]=_[_0x6e33('0x24')](db[_0x6e33('0x1e')][_0x6e33('0x37')]);_0x3e6580['query']=_['keys'](_0x187e9e[_0x6e33('0x23')]);_0x3e6580[_0x6e33('0x25')]=_[_0x6e33('0x26')](_0x3e6580[_0x6e33('0x27')],_0x3e6580[_0x6e33('0x23')]);_0x2c7871['attributes']=_['intersection'](_0x3e6580[_0x6e33('0x27')],qs['fields'](_0x187e9e[_0x6e33('0x23')][_0x6e33('0x29')]));_0x2c7871[_0x6e33('0x28')]=_0x2c7871[_0x6e33('0x28')][_0x6e33('0x2a')]?_0x2c7871[_0x6e33('0x28')]:_0x3e6580[_0x6e33('0x27')];if(_0x187e9e[_0x6e33('0x23')][_0x6e33('0x34')]){_0x2c7871[_0x6e33('0x38')]=[{'all':!![]}];}_0x2c7871=_[_0x6e33('0x32')]({},_0x2c7871,_0x187e9e[_0x6e33('0x33')]);return db['Network'][_0x6e33('0x39')](_0x2c7871)['then'](handleEntityNotFound(_0x310731,null))[_0x6e33('0x6')](respondWithResult(_0x310731,null))['catch'](handleError(_0x310731,null));};exports[_0x6e33('0x3a')]=function(_0x1c319e,_0x331769){var _0x1bb8b8;return db['Network']['create'](_0x1c319e[_0x6e33('0x3b')],{'raw':!![]})[_0x6e33('0x6')](function(_0x491f4c){_0x1bb8b8=_0x491f4c;return db[_0x6e33('0x1e')]['findAll']({'where':{'type':_0x1c319e['body'][_0x6e33('0x20')]},'raw':!![]});})[_0x6e33('0x6')](function(_0x31759c){if(_0x1bb8b8['type']['toUpperCase']()==_0x6e33('0x3c')){var _0x3b6fdf=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config[_0x6e33('0x3f')],_0x6e33('0x40')),_0x6e33('0x41'));var _0x5a5a19=ejs['render'](_0x3b6fdf,{'networks':_0x31759c||[]});fs[_0x6e33('0x42')](_0x6e33('0x43'),_0x5a5a19);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x3a'),{'module':_0x6e33('0x45')});}else if(_0x1bb8b8[_0x6e33('0x20')][_0x6e33('0x46')]()==_0x6e33('0x47')){var _0x1af680=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config[_0x6e33('0x3f')],_0x6e33('0x48')),_0x6e33('0x41'));var _0x630391=ejs[_0x6e33('0x49')](_0x1af680,{'networks':_0x31759c||[]});fs[_0x6e33('0x42')]('/etc/asterisk/turn_xcally.conf',_0x630391);return respondWithRpcPromise('Reload',_0x6e33('0x3a'),{'module':_0x6e33('0x45')});}else{var _0x5e954b=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config['root'],_0x6e33('0x4a')),_0x6e33('0x41'));var _0x22005f=ejs['render'](_0x5e954b,{'networks':_0x31759c||[]});fs['writeFileSync'](util['format'](_0x6e33('0x4b'),_0x1c319e[_0x6e33('0x3b')][_0x6e33('0x20')][_0x6e33('0x4c')]()),_0x22005f);return respondWithRpcPromise('Reload',_0x6e33('0x3a'),{'module':_0x6e33('0x4d')});}})[_0x6e33('0x6')](function(){return _0x1bb8b8;})['then'](respondWithResult(_0x331769,0xc9))[_0x6e33('0xf')](handleError(_0x331769,null));};exports['update']=function(_0x5d2d2c,_0x3699b3){var _0x5344af;return db['Network'][_0x6e33('0x39')]({'where':{'id':_0x5d2d2c['params']['id']}})[_0x6e33('0x6')](handleEntityNotFound(_0x3699b3,null))['then'](saveUpdates(_0x5d2d2c[_0x6e33('0x3b')],null))[_0x6e33('0x6')](function(_0x185264){if(_0x185264){_0x5344af=_0x185264;return db[_0x6e33('0x1e')]['findAll']({'where':{'type':_0x5344af['type']},'raw':!![]});}return null;})[_0x6e33('0x6')](function(_0x363fca){if(_0x5344af['type'][_0x6e33('0x46')]()==_0x6e33('0x3c')){var _0x27f5f8=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config[_0x6e33('0x3f')],_0x6e33('0x40')),_0x6e33('0x41'));var _0x59453e=ejs['render'](_0x27f5f8,{'networks':_0x363fca||[]});fs[_0x6e33('0x42')](_0x6e33('0x43'),_0x59453e);return respondWithRpcPromise('Reload',_0x6e33('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x5344af['type'][_0x6e33('0x46')]()==_0x6e33('0x47')){var _0x17a16=fs['readFileSync'](path[_0x6e33('0x3e')](config['root'],_0x6e33('0x48')),_0x6e33('0x41'));var _0x48cc92=ejs[_0x6e33('0x49')](_0x17a16,{'networks':_0x363fca||[]});fs[_0x6e33('0x42')](_0x6e33('0x4e'),_0x48cc92);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x3e9155=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config[_0x6e33('0x3f')],_0x6e33('0x4a')),_0x6e33('0x41'));var _0x4af384=ejs[_0x6e33('0x49')](_0x3e9155,{'networks':_0x363fca||[]});fs[_0x6e33('0x42')](util[_0x6e33('0x4f')](_0x6e33('0x4b'),_0x5d2d2c[_0x6e33('0x3b')][_0x6e33('0x20')]['toLowerCase']()),_0x4af384);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x18'),{'module':_0x6e33('0x4d')});}})[_0x6e33('0x6')](function(_0x46bf3c){if(_0x46bf3c){return _0x5344af;}return null;})[_0x6e33('0x6')](respondWithResult(_0x3699b3,null))['catch'](handleError(_0x3699b3,null));};exports['destroy']=function(_0x38b9fd,_0x4414f5){var _0x8321f0;return db[_0x6e33('0x1e')][_0x6e33('0x39')]({'where':{'id':_0x38b9fd['params']['id']}})[_0x6e33('0x6')](function(_0x3aa491){_0x8321f0=_0x3aa491;return _0x3aa491;})[_0x6e33('0x6')](handleEntityNotFound(_0x4414f5,null))[_0x6e33('0x6')](removeEntity(_0x4414f5,null))[_0x6e33('0x6')](function(){if(_0x8321f0){return db[_0x6e33('0x1e')][_0x6e33('0x35')]({'where':{'type':_0x8321f0[_0x6e33('0x20')]},'raw':!![]});}})[_0x6e33('0x6')](function(_0x10c906){if(_0x8321f0[_0x6e33('0x20')]['toUpperCase']()==_0x6e33('0x3c')){var _0x3e0696=fs[_0x6e33('0x3d')](path['join'](config[_0x6e33('0x3f')],'server/files/templates/stun_multiple.ejs'),_0x6e33('0x41'));var _0x596f4f=ejs[_0x6e33('0x49')](_0x3e0696,{'networks':_0x10c906||[]});fs[_0x6e33('0x42')](_0x6e33('0x43'),_0x596f4f);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x50'),{'module':_0x6e33('0x45')});}else if(_0x8321f0[_0x6e33('0x20')][_0x6e33('0x46')]()==_0x6e33('0x47')){var _0x1c2584=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config[_0x6e33('0x3f')],_0x6e33('0x48')),_0x6e33('0x41'));var _0x2f61c0=ejs['render'](_0x1c2584,{'networks':_0x10c906||[]});fs[_0x6e33('0x42')](_0x6e33('0x4e'),_0x2f61c0);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x50'),{'module':_0x6e33('0x45')});}else{var _0x79c1f8=fs[_0x6e33('0x3d')](path[_0x6e33('0x3e')](config['root'],_0x6e33('0x4a')),_0x6e33('0x41'));var _0x4189fb=ejs['render'](_0x79c1f8,{'networks':_0x10c906||[]});fs[_0x6e33('0x42')](util['format'](_0x6e33('0x4b'),_0x8321f0[_0x6e33('0x20')][_0x6e33('0x4c')]()),_0x4189fb);return respondWithRpcPromise(_0x6e33('0x44'),_0x6e33('0x50'),{'module':_0x6e33('0x4d')});}})[_0x6e33('0xf')](handleError(_0x4414f5,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8db7a91..ab1d4ab 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 _0xad8a=['path','rimraf','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0xad8a,0xb0));var _0xaad8=function(_0xdbf615,_0xebc0d3){_0xdbf615=_0xdbf615-0x0;var _0x107d85=_0xad8a[_0xdbf615];return _0x107d85;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var logger=require(_0xaad8('0x2'))(_0xaad8('0x3'));var moment=require(_0xaad8('0x4'));var BPromise=require('bluebird');var rp=require(_0xaad8('0x5'));var fs=require('fs');var path=require(_0xaad8('0x6'));var rimraf=require(_0xaad8('0x7'));var config=require('../../config/environment');var attributes=require(_0xaad8('0x8'));module[_0xaad8('0x9')]=function(_0x22c799,_0xeb5d15){return _0x22c799[_0xaad8('0xa')](_0xaad8('0xb'),attributes,{'tableName':_0xaad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x8032c,_0x589730){var _0x1c9dbd=function(_0x35d279){while(--_0x35d279){_0x8032c['push'](_0x8032c['shift']());}};_0x1c9dbd(++_0x589730);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0xcb91[_0x152fe3];return _0xc5bb39;};'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')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'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 4d1752a..efdd2f3 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(_0x512b43,_0x114ef3){var _0x38d596=function(_0x541fd8){while(--_0x541fd8){_0x512b43['push'](_0x512b43['shift']());}};_0x38d596(++_0x114ef3);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4b1fac,_0x16c04a){_0x4b1fac=_0x4b1fac-0x0;var _0x12a623=_0x7a54[_0x4b1fac];return _0x12a623;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b46589e..77f6377 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 _0x5e26=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','addApplications','addAgents','send','put','update','delete','destroy'];(function(_0x90426e,_0x2bd68b){var _0x4be0dc=function(_0x5827c2){while(--_0x5827c2){_0x90426e['push'](_0x90426e['shift']());}};_0x4be0dc(++_0x2bd68b);}(_0x5e26,0x18d));var _0x65e2=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x5e26[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x65e2('0x0'));var util=require(_0x65e2('0x1'));var path=require(_0x65e2('0x2'));var timeout=require(_0x65e2('0x3'));var express=require(_0x65e2('0x4'));var router=express[_0x65e2('0x5')]();var fs_extra=require(_0x65e2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65e2('0x7'));var controller=require(_0x65e2('0x8'));router[_0x65e2('0x9')]('/',auth[_0x65e2('0xa')](),controller['index']);router[_0x65e2('0x9')](_0x65e2('0xb'),auth['isAuthenticated'](),controller[_0x65e2('0xc')]);router[_0x65e2('0x9')](_0x65e2('0xd'),auth['isAuthenticated'](),controller[_0x65e2('0xe')]);router[_0x65e2('0x9')](_0x65e2('0xf'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x10')]);router[_0x65e2('0x9')](_0x65e2('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x65e2('0x9')](_0x65e2('0x12'),auth['isAuthenticated'](),controller[_0x65e2('0x13')]);router[_0x65e2('0x9')](_0x65e2('0x14'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x15')]);router['get'](_0x65e2('0x16'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x17')]);router[_0x65e2('0x18')]('/',auth[_0x65e2('0xa')](),controller[_0x65e2('0x19')]);router['post']('/:id/dispositions',auth[_0x65e2('0xa')](),controller['addDisposition']);router[_0x65e2('0x18')](_0x65e2('0x11'),auth['isAuthenticated'](),controller[_0x65e2('0x1a')]);router[_0x65e2('0x18')](_0x65e2('0x1b'),controller['notify']);router[_0x65e2('0x18')](_0x65e2('0x12'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x1c')]);router[_0x65e2('0x18')](_0x65e2('0x16'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x1d')]);router['post']('/:id/send',auth[_0x65e2('0xa')](),controller[_0x65e2('0x1e')]);router[_0x65e2('0x1f')](_0x65e2('0xd'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x20')]);router[_0x65e2('0x21')](_0x65e2('0xd'),auth[_0x65e2('0xa')](),controller[_0x65e2('0x22')]);router['delete'](_0x65e2('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65e2('0x21')](_0x65e2('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x65e2('0x16'),auth[_0x65e2('0xa')](),controller['removeAgents']);module[_0x65e2('0x23')]=router; \ No newline at end of file +var _0x3049=['/:id/applications','/:id/interactions','getInteractions','getAgents','post','/:id/dispositions','addDisposition','addAnswer','notify','/:id/users','/:id/send','send','put','update','destroy','delete','removeAnswers','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers'];(function(_0x1ebce3,_0x1c0f76){var _0x1ece9e=function(_0x3b0d7e){while(--_0x3b0d7e){_0x1ebce3['push'](_0x1ebce3['shift']());}};_0x1ece9e(++_0x1c0f76);}(_0x3049,0x10e));var _0x9304=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3049[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0x9304('0x0'));var util=require(_0x9304('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9304('0x2'));var router=express[_0x9304('0x3')]();var fs_extra=require(_0x9304('0x4'));var auth=require(_0x9304('0x5'));var interaction=require(_0x9304('0x6'));var config=require(_0x9304('0x7'));var controller=require(_0x9304('0x8'));router[_0x9304('0x9')]('/',auth[_0x9304('0xa')](),controller[_0x9304('0xb')]);router['get'](_0x9304('0xc'),auth[_0x9304('0xa')](),controller[_0x9304('0xd')]);router[_0x9304('0x9')](_0x9304('0xe'),auth[_0x9304('0xa')](),controller[_0x9304('0xf')]);router[_0x9304('0x9')]('/:id/dispositions',auth[_0x9304('0xa')](),controller['getDispositions']);router[_0x9304('0x9')](_0x9304('0x10'),auth[_0x9304('0xa')](),controller[_0x9304('0x11')]);router[_0x9304('0x9')](_0x9304('0x12'),auth[_0x9304('0xa')](),controller['getApplications']);router[_0x9304('0x9')](_0x9304('0x13'),auth[_0x9304('0xa')](),controller[_0x9304('0x14')]);router[_0x9304('0x9')]('/:id/users',auth[_0x9304('0xa')](),controller[_0x9304('0x15')]);router[_0x9304('0x16')]('/',auth[_0x9304('0xa')](),controller['create']);router[_0x9304('0x16')](_0x9304('0x17'),auth[_0x9304('0xa')](),controller[_0x9304('0x18')]);router[_0x9304('0x16')](_0x9304('0x10'),auth['isAuthenticated'](),controller[_0x9304('0x19')]);router[_0x9304('0x16')]('/:id/notify',controller[_0x9304('0x1a')]);router['post']('/:id/applications',auth[_0x9304('0xa')](),controller['addApplications']);router['post'](_0x9304('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9304('0x16')](_0x9304('0x1c'),auth[_0x9304('0xa')](),controller[_0x9304('0x1d')]);router[_0x9304('0x1e')](_0x9304('0xe'),auth[_0x9304('0xa')](),controller[_0x9304('0x1f')]);router['delete']('/:id',auth[_0x9304('0xa')](),controller[_0x9304('0x20')]);router[_0x9304('0x21')]('/:id/dispositions',auth[_0x9304('0xa')](),controller['removeDispositions']);router[_0x9304('0x21')](_0x9304('0x10'),auth[_0x9304('0xa')](),controller[_0x9304('0x22')]);router[_0x9304('0x21')](_0x9304('0x1b'),auth[_0x9304('0xa')](),controller['removeAgents']);module[_0x9304('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 35232f5..b959014 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 _0xf5e1=['exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0xc69530,_0x57c174){var _0x148a92=function(_0x409d97){while(--_0x409d97){_0xc69530['push'](_0xc69530['shift']());}};_0x148a92(++_0x57c174);}(_0xf5e1,0x6b));var _0x1f5e=function(_0x17136b,_0x6e4a61){_0x17136b=_0x17136b-0x0;var _0x13842a=_0xf5e1[_0x17136b];return _0x13842a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1f5e('0x0'));module[_0x1f5e('0x1')]={'name':{'type':Sequelize[_0x1f5e('0x2')],'unique':_0x1f5e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1f5e('0x2')]},'token':{'type':Sequelize[_0x1f5e('0x2')],'defaultValue':function(){return rs[_0x1f5e('0x4')]();}},'replyUri':{'type':Sequelize[_0x1f5e('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1f5e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1f5e('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1f5e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f5e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1f5e('0x2')]},'queueTransfer':{'type':Sequelize[_0x1f5e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f5e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1f5e('0x6')],'defaultValue':![],'comment':_0x1f5e('0x8'),'set':function(_0x5d39c1){if(!_0x5d39c1)this[_0x1f5e('0x9')](_0x1f5e('0xa'),null);this[_0x1f5e('0x9')](_0x1f5e('0xb'),_0x5d39c1);}}}; \ No newline at end of file +var _0xb818=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','name','STRING','generate','BOOLEAN'];(function(_0x48cd08,_0x5c2bf8){var _0x860c00=function(_0x18162d){while(--_0x18162d){_0x48cd08['push'](_0x48cd08['shift']());}};_0x860c00(++_0x5c2bf8);}(_0xb818,0x1f4));var _0x8b81=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb818[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8b81('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8b81('0x1')],'defaultValue':function(){return rs[_0x8b81('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8b81('0x1')],'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[_0x8b81('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b81('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x8b81('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b81('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b81('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8b81('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b81('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x8b81('0x5')},'mandatoryDisposition':{'type':Sequelize[_0x8b81('0x3')],'defaultValue':![],'comment':_0x8b81('0x6'),'set':function(_0x5596fc){if(!_0x5596fc)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8b81('0x7')](_0x8b81('0x8'),_0x5596fc);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6f75b1e..bc9479a 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 _0x3762=['getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','user','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','end','json','offset','undefined','limit','status','set','apply','reject','update','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','Pause','intersection','length','include','find','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','map','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','asc','account','ListId','threadId','externalUrl','OpenchannelInteraction','ContactId','contact','firstName','lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','forcedOwnership','startRouting','Start','EventManager','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','send'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x3762,0x18b));var _0x2376=function(_0x56d872,_0x3106dd){_0x56d872=_0x56d872-0x0;var _0x344655=_0x3762[_0x56d872];return _0x344655;};'use strict';var emlformat=require(_0x2376('0x0'));var rimraf=require(_0x2376('0x1'));var zipdir=require(_0x2376('0x2'));var jsonpatch=require(_0x2376('0x3'));var rp=require('request-promise');var moment=require(_0x2376('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2376('0x5'));var util=require(_0x2376('0x6'));var path=require('path');var sox=require(_0x2376('0x7'));var csv=require(_0x2376('0x8'));var ejs=require(_0x2376('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2376('0xa'));var squel=require(_0x2376('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2376('0xc'));var toCsv=require(_0x2376('0x8'));var querystring=require(_0x2376('0xd'));var Papa=require(_0x2376('0xe'));var Redis=require(_0x2376('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2376('0x10'));var as=require(_0x2376('0x11'));var hardwareService=require(_0x2376('0x12'));var logger=require(_0x2376('0x13'))(_0x2376('0x14'));var utils=require('../../config/utils');var config=require(_0x2376('0x15'));var licenseUtil=require(_0x2376('0x16'));var db=require(_0x2376('0x17'))['db'];config[_0x2376('0x18')]=_[_0x2376('0x19')](config[_0x2376('0x18')],{'host':_0x2376('0x1a'),'port':0x18eb});var socket=require(_0x2376('0x1b'))(new Redis(config[_0x2376('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x2376('0x1c'));var client=jayson[_0x2376('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x2376('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54592a,_0x2f040e,_0x2fe14c,_0x4f8da0){return new BPromise(function(_0x11dbc4,_0x4b8a68){var _0x296377=_0x4f8da0||client;return _0x296377[_0x2376('0x1e')](_0x54592a,_0x2fe14c)[_0x2376('0x1f')](function(_0x20f816){logger[_0x2376('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f040e,'request\x20sent');logger['debug'](_0x2376('0x21'),_0x2f040e,_0x2376('0x22'),JSON[_0x2376('0x23')](_0x20f816));if(_0x20f816['error']){if(_0x20f816[_0x2376('0x24')][_0x2376('0x25')]===0x1f4){logger['error'](_0x2376('0x26'),_0x2f040e,_0x20f816['error']['message']);return _0x4b8a68(_0x20f816[_0x2376('0x24')][_0x2376('0x27')]);}logger[_0x2376('0x24')](_0x2376('0x26'),_0x2f040e,_0x20f816[_0x2376('0x24')][_0x2376('0x27')]);return _0x11dbc4(_0x20f816[_0x2376('0x24')][_0x2376('0x27')]);}else{logger['info'](_0x2376('0x26'),_0x2f040e,'request\x20sent');_0x11dbc4(_0x20f816['result'][_0x2376('0x27')]);}})[_0x2376('0x28')](function(_0x49c235){logger['error'](_0x2376('0x26'),_0x2f040e,_0x49c235);_0x4b8a68(_0x49c235);});});}function respondWithStatusCode(_0x32eaf7,_0x55486c){_0x55486c=_0x55486c||0xcc;return function(_0x50af4b){if(_0x50af4b){return _0x32eaf7['sendStatus'](_0x55486c);}return _0x32eaf7['status'](_0x55486c)[_0x2376('0x29')]();};}function respondWithResult(_0x5803b5,_0x2c6102){_0x2c6102=_0x2c6102||0xc8;return function(_0x3031b8){if(_0x3031b8){return _0x5803b5['status'](_0x2c6102)[_0x2376('0x2a')](_0x3031b8);}};}function respondWithFilteredResult(_0x59523c,_0xd71c4a){return function(_0x11d641){if(_0x11d641){var _0x188b00=typeof _0xd71c4a[_0x2376('0x2b')]===_0x2376('0x2c')&&typeof _0xd71c4a[_0x2376('0x2d')]===_0x2376('0x2c');var _0x2603da=_0x11d641['count'];var _0x49f0d3=_0x188b00?0x0:_0xd71c4a['offset'];var _0x7a2c46=_0x188b00?_0x11d641['count']:_0xd71c4a['offset']+_0xd71c4a[_0x2376('0x2d')];var _0x53f7c2;if(_0x7a2c46>=_0x2603da){_0x7a2c46=_0x2603da;_0x53f7c2=0xc8;}else{_0x53f7c2=0xce;}_0x59523c[_0x2376('0x2e')](_0x53f7c2);return _0x59523c[_0x2376('0x2f')]('Content-Range',_0x49f0d3+'-'+_0x7a2c46+'/'+_0x2603da)['json'](_0x11d641);}return null;};}function patchUpdates(_0x3ca0ff){return function(_0x1436e2){try{jsonpatch[_0x2376('0x30')](_0x1436e2,_0x3ca0ff,!![]);}catch(_0x3e87b6){return BPromise[_0x2376('0x31')](_0x3e87b6);}return _0x1436e2['save']();};}function saveUpdates(_0x1ba5ff,_0x31bc64){return function(_0x5d13d4){if(_0x5d13d4){return _0x5d13d4[_0x2376('0x32')](_0x1ba5ff)[_0x2376('0x1f')](function(_0xf7804b){return _0xf7804b;});}return null;};}function removeEntity(_0x3a517e,_0xa6f24f){return function(_0x51586f){if(_0x51586f){return _0x51586f['destroy']()[_0x2376('0x1f')](function(){var _0xab6bad=_0x51586f[_0x2376('0x33')]({'plain':!![]});var _0x43fcc8=_0x2376('0x34');return db[_0x2376('0x35')][_0x2376('0x36')]({'where':{'type':_0x43fcc8,'resourceId':_0xab6bad['id']}})[_0x2376('0x1f')](function(){return _0x51586f;});})[_0x2376('0x1f')](function(){_0x3a517e['status'](0xcc)[_0x2376('0x29')]();});}};}function handleEntityNotFound(_0x28041b,_0x17e4bd){return function(_0x5e6475){if(!_0x5e6475){_0x28041b[_0x2376('0x37')](0x194);}return _0x5e6475;};}function handleError(_0x5af7fe,_0x56920d){_0x56920d=_0x56920d||0x1f4;return function(_0x27a63c){logger[_0x2376('0x24')](_0x27a63c['stack']);if(_0x27a63c[_0x2376('0x38')]){delete _0x27a63c[_0x2376('0x38')];}_0x5af7fe[_0x2376('0x2e')](_0x56920d)['send'](_0x27a63c);};}exports[_0x2376('0x39')]=function(_0x1c9d6a,_0x2352c1){var _0xfc69b0={'include':[{'model':db['Pause'],'as':_0x2376('0x3a')}]},_0x7be0fe={},_0x39beea={'count':0x0,'rows':[]};var _0x3c177d=_['map'](db[_0x2376('0x3b')][_0x2376('0x3c')],function(_0x3ef45f){return{'name':_0x3ef45f['fieldName'],'type':_0x3ef45f[_0x2376('0x3d')]['key']};});_0x7be0fe[_0x2376('0x3e')]=_['map'](_0x3c177d,'name');_0x7be0fe[_0x2376('0x3f')]=_[_0x2376('0x40')](_0x1c9d6a[_0x2376('0x3f')]);_0x7be0fe[_0x2376('0x41')]=_['intersection'](_0x7be0fe[_0x2376('0x3e')],_0x7be0fe[_0x2376('0x3f')]);_0xfc69b0[_0x2376('0x42')]=_['intersection'](_0x7be0fe[_0x2376('0x3e')],qs[_0x2376('0x43')](_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x43')]));_0xfc69b0[_0x2376('0x42')]=_0xfc69b0[_0x2376('0x42')]['length']?_0xfc69b0[_0x2376('0x42')]:_0x7be0fe[_0x2376('0x3e')];if(!_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x44')](_0x2376('0x45'))){_0xfc69b0['limit']=qs[_0x2376('0x2d')](_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x2d')]);_0xfc69b0['offset']=qs[_0x2376('0x2b')](_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x2b')]);}_0xfc69b0['order']=qs['sort'](_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x46')]);_0xfc69b0['where']=qs[_0x2376('0x41')](_[_0x2376('0x47')](_0x1c9d6a['query'],_0x7be0fe[_0x2376('0x41')]),_0x3c177d);if(_0x1c9d6a['query'][_0x2376('0x48')]){_0xfc69b0[_0x2376('0x49')]=_[_0x2376('0x4a')](_0xfc69b0[_0x2376('0x49')],{'$or':_['map'](_0x3c177d,function(_0x342b65){if(_0x342b65[_0x2376('0x3d')]!==_0x2376('0x4b')){var _0x3b1016={};_0x3b1016[_0x342b65[_0x2376('0x38')]]={'$like':'%'+_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x48')]+'%'};return _0x3b1016;}})});}_0xfc69b0=_['merge']({},_0xfc69b0,_0x1c9d6a[_0x2376('0x4c')]);var _0x39405a={'where':_0xfc69b0[_0x2376('0x49')]};return db[_0x2376('0x3b')][_0x2376('0x4d')](_0x39405a)['then'](function(_0x310a45){_0x39beea[_0x2376('0x4d')]=_0x310a45;if(_0x1c9d6a[_0x2376('0x3f')][_0x2376('0x4e')]){_0xfc69b0['include']=[{'all':!![]}];}return db[_0x2376('0x3b')][_0x2376('0x4f')](_0xfc69b0);})[_0x2376('0x1f')](function(_0x179ddb){_0x39beea[_0x2376('0x50')]=_0x179ddb;return _0x39beea;})[_0x2376('0x1f')](respondWithFilteredResult(_0x2352c1,_0xfc69b0))[_0x2376('0x28')](handleError(_0x2352c1,null));};exports[_0x2376('0x51')]=function(_0x2c8b13,_0x23afdf){var _0x29676e={'raw':![],'where':{'id':_0x2c8b13[_0x2376('0x52')]['id']},'include':[{'model':db[_0x2376('0x53')],'as':_0x2376('0x3a')}]},_0x72616f={};_0x72616f[_0x2376('0x3e')]=_['keys'](db[_0x2376('0x3b')][_0x2376('0x3c')]);_0x72616f['query']=_['keys'](_0x2c8b13[_0x2376('0x3f')]);_0x72616f[_0x2376('0x41')]=_['intersection'](_0x72616f[_0x2376('0x3e')],_0x72616f[_0x2376('0x3f')]);_0x29676e[_0x2376('0x42')]=_[_0x2376('0x54')](_0x72616f[_0x2376('0x3e')],qs[_0x2376('0x43')](_0x2c8b13['query'][_0x2376('0x43')]));_0x29676e[_0x2376('0x42')]=_0x29676e['attributes'][_0x2376('0x55')]?_0x29676e[_0x2376('0x42')]:_0x72616f[_0x2376('0x3e')];if(_0x2c8b13['query']['includeAll']){_0x29676e[_0x2376('0x56')]=[{'all':!![]}];}_0x29676e=_[_0x2376('0x4a')]({},_0x29676e,_0x2c8b13['options']);return db['OpenchannelAccount'][_0x2376('0x57')](_0x29676e)['then'](handleEntityNotFound(_0x23afdf,null))[_0x2376('0x1f')](respondWithResult(_0x23afdf,null))[_0x2376('0x28')](handleError(_0x23afdf,null));};exports['create']=function(_0x2d482a,_0x36d758){return db[_0x2376('0x3b')][_0x2376('0x58')](_0x2d482a['body'],{})[_0x2376('0x1f')](function(_0x4c8329){var _0x4fc5fb=_0x2d482a['user']['get']({'plain':!![]});if(!_0x4fc5fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fc5fb[_0x2376('0x59')]==='user'){var _0x4bd73b=_0x4c8329[_0x2376('0x33')]({'plain':!![]});var _0x3801ae='OpenchannelAccounts';return db['UserProfileSection'][_0x2376('0x57')]({'where':{'name':_0x3801ae,'userProfileId':_0x4fc5fb[_0x2376('0x5a')]},'raw':!![]})[_0x2376('0x1f')](function(_0x3196b4){if(_0x3196b4&&_0x3196b4[_0x2376('0x5b')]===0x0){return db[_0x2376('0x35')][_0x2376('0x58')]({'name':_0x4bd73b[_0x2376('0x38')],'resourceId':_0x4bd73b['id'],'type':_0x3196b4[_0x2376('0x38')],'sectionId':_0x3196b4['id']},{})[_0x2376('0x1f')](function(){return _0x4c8329;});}else{return _0x4c8329;}})[_0x2376('0x28')](function(_0x490b42){logger[_0x2376('0x24')](_0x2376('0x5c'),_0x490b42);throw _0x490b42;});}return _0x4c8329;})[_0x2376('0x1f')](respondWithResult(_0x36d758,0xc9))[_0x2376('0x28')](handleError(_0x36d758,null));};exports['update']=function(_0x41abde,_0x3d07ab){if(_0x41abde[_0x2376('0x5d')]['id']){delete _0x41abde[_0x2376('0x5d')]['id'];}return db[_0x2376('0x3b')][_0x2376('0x57')]({'where':{'id':_0x41abde['params']['id']},'include':[{'model':db[_0x2376('0x53')],'as':_0x2376('0x3a')}]})[_0x2376('0x1f')](handleEntityNotFound(_0x3d07ab,null))[_0x2376('0x1f')](saveUpdates(_0x41abde[_0x2376('0x5d')],null))['then'](respondWithResult(_0x3d07ab,null))[_0x2376('0x28')](handleError(_0x3d07ab,null));};exports[_0x2376('0x36')]=function(_0x21d646,_0x38a085){return db['OpenchannelAccount'][_0x2376('0x57')]({'where':{'id':_0x21d646['params']['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x38a085,null))[_0x2376('0x1f')](removeEntity(_0x38a085,null))[_0x2376('0x28')](handleError(_0x38a085,null));};exports[_0x2376('0x5e')]=function(_0x11cac9,_0x2c315a){return db[_0x2376('0x3b')]['describe']()[_0x2376('0x1f')](respondWithResult(_0x2c315a,null))['catch'](handleError(_0x2c315a,null));};exports[_0x2376('0x5f')]=function(_0x350e20,_0x471e68,_0x5be66b){if(_0x350e20[_0x2376('0x5d')]['id']){delete _0x350e20['body']['id'];}return db[_0x2376('0x3b')][_0x2376('0x57')]({'where':{'id':_0x350e20['params']['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x471e68,null))[_0x2376('0x1f')](function(_0x296e70){if(_0x296e70){_0x350e20[_0x2376('0x5d')][_0x2376('0x60')]=_0x296e70['id'];return db[_0x2376('0x61')][_0x2376('0x58')](_0x350e20['body']);}})['then'](respondWithResult(_0x471e68,null))[_0x2376('0x28')](handleError(_0x471e68,null));};exports[_0x2376('0x62')]=function(_0x35e4bc,_0x541fc6,_0x330b1b){var _0x4df5ad={'raw':![],'where':{}};var _0x137711={};var _0x43b349={'count':0x0,'rows':[]};return db[_0x2376('0x3b')][_0x2376('0x63')]({'where':{'id':_0x35e4bc[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x541fc6,null))[_0x2376('0x1f')](function(_0x3eb6ff){if(_0x3eb6ff){_0x137711[_0x2376('0x3e')]=_[_0x2376('0x40')](db[_0x2376('0x61')]['rawAttributes']);_0x137711['query']=_[_0x2376('0x40')](_0x35e4bc[_0x2376('0x3f')]);_0x137711[_0x2376('0x41')]=_[_0x2376('0x54')](_0x137711[_0x2376('0x3e')],_0x137711['query']);_0x4df5ad[_0x2376('0x42')]=_['intersection'](_0x137711[_0x2376('0x3e')],qs['fields'](_0x35e4bc[_0x2376('0x3f')][_0x2376('0x43')]));_0x4df5ad[_0x2376('0x42')]=_0x4df5ad['attributes'][_0x2376('0x55')]?_0x4df5ad[_0x2376('0x42')]:_0x137711[_0x2376('0x3e')];if(!_0x35e4bc['query'][_0x2376('0x44')]('nolimit')){_0x4df5ad[_0x2376('0x2d')]=qs[_0x2376('0x2d')](_0x35e4bc[_0x2376('0x3f')][_0x2376('0x2d')]);_0x4df5ad[_0x2376('0x2b')]=qs[_0x2376('0x2b')](_0x35e4bc[_0x2376('0x3f')][_0x2376('0x2b')]);}_0x4df5ad[_0x2376('0x64')]=qs['sort'](_0x35e4bc[_0x2376('0x3f')][_0x2376('0x46')]);_0x4df5ad['where']=qs[_0x2376('0x41')](_[_0x2376('0x47')](_0x35e4bc['query'],_0x137711[_0x2376('0x41')]));_0x4df5ad[_0x2376('0x49')]['OpenchannelAccountId']=_0x3eb6ff['id'];if(_0x35e4bc[_0x2376('0x3f')][_0x2376('0x48')]){_0x4df5ad[_0x2376('0x49')]=_[_0x2376('0x4a')](_0x4df5ad[_0x2376('0x49')],{'$or':_[_0x2376('0x65')](_0x4df5ad[_0x2376('0x42')],function(_0x478814){var _0xb80151={};_0xb80151[_0x478814]={'$like':'%'+_0x35e4bc[_0x2376('0x3f')]['filter']+'%'};return _0xb80151;})});}_0x4df5ad=_['merge']({},_0x4df5ad,_0x35e4bc[_0x2376('0x4c')]);return db['Disposition'][_0x2376('0x4d')]({'where':_0x4df5ad[_0x2376('0x49')]})['then'](function(_0x1173c4){_0x43b349[_0x2376('0x4d')]=_0x1173c4;if(_0x35e4bc[_0x2376('0x3f')][_0x2376('0x4e')]){_0x4df5ad[_0x2376('0x56')]=[{'all':!![]}];}return db[_0x2376('0x61')][_0x2376('0x4f')](_0x4df5ad);})[_0x2376('0x1f')](function(_0x1554b1){_0x43b349[_0x2376('0x50')]=_0x1554b1;return _0x43b349;});}})['then'](respondWithFilteredResult(_0x541fc6,_0x4df5ad))['catch'](handleError(_0x541fc6,null));};exports[_0x2376('0x66')]=function(_0x8f272a,_0x1fd96a,_0x25dbf8){return db[_0x2376('0x3b')][_0x2376('0x57')]({'where':{'id':_0x8f272a[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x1fd96a,null))[_0x2376('0x1f')](function(_0x39a2af){if(_0x39a2af){return _0x39a2af['removeDispositions'](_0x8f272a[_0x2376('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x1fd96a,null))[_0x2376('0x28')](handleError(_0x1fd96a,null));};exports[_0x2376('0x67')]=function(_0x497409,_0x5a4782,_0x272c28){if(_0x497409[_0x2376('0x5d')]['id']){delete _0x497409[_0x2376('0x5d')]['id'];}return db[_0x2376('0x3b')][_0x2376('0x57')]({'where':{'id':_0x497409[_0x2376('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a4782,null))[_0x2376('0x1f')](function(_0x575b59){if(_0x575b59){_0x497409[_0x2376('0x5d')][_0x2376('0x60')]=_0x575b59['id'];return db[_0x2376('0x68')][_0x2376('0x58')](_0x497409['body']);}})[_0x2376('0x1f')](respondWithResult(_0x5a4782,null))[_0x2376('0x28')](handleError(_0x5a4782,null));};exports[_0x2376('0x69')]=function(_0x131ec8,_0x4a4009,_0x24a40d){var _0x48964a={'raw':![],'where':{}};var _0x2d6a47={};var _0x3cb358={'count':0x0,'rows':[]};return db[_0x2376('0x3b')][_0x2376('0x63')]({'where':{'id':_0x131ec8['params']['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x4a4009,null))[_0x2376('0x1f')](function(_0x58d7ed){if(_0x58d7ed){_0x2d6a47[_0x2376('0x3e')]=_[_0x2376('0x40')](db[_0x2376('0x68')][_0x2376('0x3c')]);_0x2d6a47['query']=_[_0x2376('0x40')](_0x131ec8[_0x2376('0x3f')]);_0x2d6a47[_0x2376('0x41')]=_[_0x2376('0x54')](_0x2d6a47['model'],_0x2d6a47['query']);_0x48964a[_0x2376('0x42')]=_[_0x2376('0x54')](_0x2d6a47[_0x2376('0x3e')],qs[_0x2376('0x43')](_0x131ec8[_0x2376('0x3f')][_0x2376('0x43')]));_0x48964a[_0x2376('0x42')]=_0x48964a[_0x2376('0x42')][_0x2376('0x55')]?_0x48964a[_0x2376('0x42')]:_0x2d6a47['model'];if(!_0x131ec8['query']['hasOwnProperty']('nolimit')){_0x48964a[_0x2376('0x2d')]=qs[_0x2376('0x2d')](_0x131ec8[_0x2376('0x3f')][_0x2376('0x2d')]);_0x48964a['offset']=qs[_0x2376('0x2b')](_0x131ec8[_0x2376('0x3f')][_0x2376('0x2b')]);}_0x48964a[_0x2376('0x64')]=qs['sort'](_0x131ec8[_0x2376('0x3f')]['sort']);_0x48964a[_0x2376('0x49')]=qs[_0x2376('0x41')](_[_0x2376('0x47')](_0x131ec8['query'],_0x2d6a47[_0x2376('0x41')]));_0x48964a['where'][_0x2376('0x60')]=_0x58d7ed['id'];if(_0x131ec8['query'][_0x2376('0x48')]){_0x48964a['where']=_[_0x2376('0x4a')](_0x48964a[_0x2376('0x49')],{'$or':_[_0x2376('0x65')](_0x48964a['attributes'],function(_0x33aa44){var _0x226fb0={};_0x226fb0[_0x33aa44]={'$like':'%'+_0x131ec8[_0x2376('0x3f')][_0x2376('0x48')]+'%'};return _0x226fb0;})});}_0x48964a=_[_0x2376('0x4a')]({},_0x48964a,_0x131ec8[_0x2376('0x4c')]);return db['CannedAnswer'][_0x2376('0x4d')]({'where':_0x48964a[_0x2376('0x49')]})['then'](function(_0x171887){_0x3cb358['count']=_0x171887;if(_0x131ec8[_0x2376('0x3f')][_0x2376('0x4e')]){_0x48964a[_0x2376('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2376('0x4f')](_0x48964a);})[_0x2376('0x1f')](function(_0x321182){_0x3cb358[_0x2376('0x50')]=_0x321182;return _0x3cb358;});}})[_0x2376('0x1f')](respondWithFilteredResult(_0x4a4009,_0x48964a))['catch'](handleError(_0x4a4009,null));};exports[_0x2376('0x6a')]=function(_0x4b2e60,_0x4cc781,_0x540bbf){return db['OpenchannelAccount'][_0x2376('0x57')]({'where':{'id':_0x4b2e60[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x4cc781,null))['then'](function(_0x250760){if(_0x250760){return _0x250760[_0x2376('0x6a')](_0x4b2e60[_0x2376('0x3f')][_0x2376('0x6b')]);}})[_0x2376('0x1f')](respondWithStatusCode(_0x4cc781,null))['catch'](handleError(_0x4cc781,null));};exports[_0x2376('0x6c')]=function(_0x52c1e9,_0x1dae2e,_0x2d5f6c){var _0x4912fb={'body':_0x52c1e9[_0x2376('0x5d')],'channel':_0x2376('0x6d')};var _0x26ef8f=[];var _0x3da317=[];var _0xf8cff3={};var _0x570f38=![];return db['CmContact'][_0x2376('0x5e')]()['then'](function(_0xa55b4){if(!_0xa55b4){throw new db[(_0x2376('0x6e'))][(_0x2376('0x6f'))]('no\x20available\x20attributes');}_0x26ef8f=_['difference'](_[_0x2376('0x40')](_0xa55b4),['createdAt',_0x2376('0x70')]);_0x3da317=_[_0x2376('0x71')](_[_0x2376('0x40')](_0xa55b4),[_0x2376('0x72'),_0x2376('0x70'),_0x2376('0x73'),'ListId']);if(_0x52c1e9['body']['id']){delete _0x52c1e9['body']['id'];}if(_['isNil'](_0x52c1e9[_0x2376('0x5d')][_0x2376('0x74')])){throw new db[(_0x2376('0x6e'))][(_0x2376('0x6f'))](_0x2376('0x75'));}if(_[_0x2376('0x76')](_0x52c1e9['body']['body'])||_0x52c1e9['body'][_0x2376('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x2376('0x77'));}if(_[_0x2376('0x76')](_0x52c1e9[_0x2376('0x5d')][_0x2376('0x78')])){throw new db[(_0x2376('0x6e'))][(_0x2376('0x6f'))](_0x2376('0x79')+_0x3da317);}if(!_[_0x2376('0x7a')](_0x3da317,_0x52c1e9[_0x2376('0x5d')][_0x2376('0x78')])){throw new db[(_0x2376('0x6e'))][(_0x2376('0x6f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da317);}_0xf8cff3[_0x52c1e9[_0x2376('0x5d')][_0x2376('0x78')]]=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x74')];})[_0x2376('0x1f')](function(){return db[_0x2376('0x3b')][_0x2376('0x57')]({'where':{'id':_0x52c1e9[_0x2376('0x52')]['id']},'include':[{'model':db[_0x2376('0x7b')],'as':_0x2376('0x7c'),'include':[{'model':db[_0x2376('0x7d')],'as':_0x2376('0x7e'),'where':_0xf8cff3,'limit':0x1,'order':[['updatedAt',_0x2376('0x7f')]]}]},{'model':db[_0x2376('0x80')],'as':_0x2376('0x81')}]});})[_0x2376('0x1f')](handleEntityNotFound(_0x1dae2e,null))[_0x2376('0x1f')](function(_0x39d8bc){if(_0x39d8bc&&_0x39d8bc['List']){_0x4912fb['account']=_0x39d8bc;_0x4912fb[_0x2376('0x82')]=_0x39d8bc[_0x2376('0x81')];_0x4912fb[_0x2376('0x83')]=_0x39d8bc[_0x2376('0x7c')];_0x4912fb['applications']=_['orderBy'](_0x4912fb[_0x2376('0x82')],['priority'],[_0x2376('0x84')]);if(_0x4912fb[_0x2376('0x85')][_0x2376('0x81')]){delete _0x4912fb[_0x2376('0x85')][_0x2376('0x81')];}if(_0x4912fb['account'][_0x2376('0x7c')]&&_0x4912fb['account'][_0x2376('0x7c')]['Contacts']['length']){return _0x4912fb[_0x2376('0x85')][_0x2376('0x7c')]['Contacts'][0x0];}var _0x3027e9=_[_0x2376('0x19')](_0x52c1e9['body'],{'firstName':_0x52c1e9['body'][_0x2376('0x74')],'ListId':_0x39d8bc[_0x2376('0x86')]});_0x3027e9[_0x52c1e9['body'][_0x2376('0x78')]]=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x74')];return db[_0x2376('0x7d')][_0x2376('0x58')](_0x3027e9,{'fields':_0x26ef8f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1dae2e,null))[_0x2376('0x1f')](function(_0xe878f2){_0x4912fb['contact']=_0xe878f2;if(_0xe878f2){var _0x562460={'ContactId':_0xe878f2['id'],'OpenchannelAccountId':_0x52c1e9[_0x2376('0x52')]['id'],'from':(_0xe878f2['firstName']||'')+'\x20'+(_0xe878f2['lastName']||'')};var _0x270de3={'OpenchannelAccountId':_0x52c1e9[_0x2376('0x52')]['id'],'closed':![]};if(_0x52c1e9[_0x2376('0x5d')][_0x2376('0x87')]){_0x270de3[_0x2376('0x87')]=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x87')];return db['OpenchannelInteraction'][_0x2376('0x57')]({'where':_0x270de3})[_0x2376('0x1f')](function(_0x59d1ea){if(_0x59d1ea){return[_0x59d1ea,![]];}_0x562460[_0x2376('0x87')]=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x87')];_0x562460['externalUrl']=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x88')];return db[_0x2376('0x89')][_0x2376('0x58')](_0x562460)[_0x2376('0x1f')](function(_0x49abb6){return[_0x49abb6,!![]];});});}else{_0x270de3[_0x2376('0x87')]=null;}_0x270de3[_0x2376('0x8a')]=_0xe878f2['id'];return db[_0x2376('0x89')][_0x2376('0x57')]({'where':_0x270de3})[_0x2376('0x1f')](function(_0x1cad3c){if(_0x1cad3c){return[_0x1cad3c,![]];}return db[_0x2376('0x89')][_0x2376('0x58')](_0x562460)['then'](function(_0x1a915d){return[_0x1a915d,!![]];});});}})['spread'](function(_0x56a9da,_0x47e880){if(_0x56a9da){_0x570f38=_0x47e880;if(!_0x47e880){var _0xed9e49={'from':(_0x4912fb[_0x2376('0x8b')][_0x2376('0x8c')]||'')+'\x20'+(_0x4912fb[_0x2376('0x8b')][_0x2376('0x8d')]||'')};if(_0x52c1e9[_0x2376('0x5d')][_0x2376('0x87')]&&_0x52c1e9['body']['messageId']&&_0x52c1e9[_0x2376('0x5d')][_0x2376('0x87')]!=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x8e')]){_0xed9e49[_0x2376('0x87')]=_0x52c1e9[_0x2376('0x5d')][_0x2376('0x8e')];}return _0x56a9da[_0x2376('0x32')](_0xed9e49);}else{return _0x56a9da;}}})[_0x2376('0x1f')](function(_0x1803ed){_0x4912fb[_0x2376('0x8f')]=_0x1803ed[_0x2376('0x33')]({'plain':!![]});_0x4912fb[_0x2376('0x8f')][_0x2376('0x90')]=_0x570f38;if(_0x4912fb[_0x2376('0x8f')]['created']){if(_0x4912fb['account'][_0x2376('0x91')]){_0x4912fb[_0x2376('0x82')][_0x2376('0x92')]({'id':0x0,'priority':_0x4912fb[_0x2376('0x82')]['length']+0x1,'app':'close','appdata':_0x2376('0x93'),'interval':_0x2376('0x94')});}}return db[_0x2376('0x95')][_0x2376('0x58')]({'body':_0x52c1e9[_0x2376('0x5d')][_0x2376('0x5d')],'OpenchannelAccountId':_0x52c1e9[_0x2376('0x52')]['id'],'OpenchannelInteractionId':_0x1803ed['id'],'direction':'in','ContactId':_0x4912fb['contact']['id'],'AttachmentId':_0x52c1e9[_0x2376('0x5d')][_0x2376('0x96')]});})[_0x2376('0x1f')](function(_0x4b5e39){_0x4912fb[_0x2376('0x27')]=_0x4b5e39;if(_0x4912fb[_0x2376('0x8f')][_0x2376('0x97')]){return db[_0x2376('0x98')]['find']({'attributes':['id',_0x2376('0x38')],'where':{'id':_0x4912fb[_0x2376('0x8f')][_0x2376('0x97')]}})[_0x2376('0x1f')](function(_0x580a08){if(_0x580a08){_0x4912fb[_0x2376('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2376('0x99'),'appdata':_0x580a08[_0x2376('0x38')]+','+(_0x4912fb[_0x2376('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x2376('0x94')});_0x4912fb[_0x2376('0x9a')]=![];}return respondWithRpcPromise('Start',_0x2376('0x9b'),_0x4912fb);});}return respondWithRpcPromise(_0x2376('0x9c'),_0x2376('0x9b'),_0x4912fb);})[_0x2376('0x1f')](function(_0x554e2e){respondWithRpcPromise(_0x2376('0x9d'),'EventManager',{'event':_0x2376('0x6c'),'message':_0x554e2e},client9002);return _0x554e2e;})['then'](respondWithResult(_0x1dae2e,null))[_0x2376('0x28')](handleError(_0x1dae2e,null));};exports['addApplications']=function(_0x4b8084,_0x4ce78c){var _0x11dd3f=_0x4b8084[_0x2376('0x52')]['id'];var _0x28444e=_0x4b8084['body'];var _0x2b16fd=0xc8;var _0x2ab09c=null;return db['sequelize'][_0x2376('0x9e')]({'isolationLevel':db[_0x2376('0x9f')][_0x2376('0xa0')][_0x2376('0xa1')][_0x2376('0xa2')]},function(_0x5f4076){return db['OpenchannelAccount'][_0x2376('0x63')]({'where':{'id':_0x11dd3f},'transaction':_0x5f4076})[_0x2376('0x1f')](function(_0x4775e8){if(_0x4775e8){return db[_0x2376('0x80')]['destroy']({'where':{'OpenchannelAccountId':_0x11dd3f},'transaction':_0x5f4076})[_0x2376('0x1f')](function(){var _0x493ee0=_[_0x2376('0x65')](_0x28444e,function(_0x138d68){_0x138d68[_0x2376('0x60')]=_0x11dd3f;return _0x138d68;});return db[_0x2376('0x80')][_0x2376('0xa3')](_0x493ee0,{'transaction':_0x5f4076});});}else{_0x2b16fd=0x194;_0x2ab09c=[];}});})['then'](function(){if(_0x2b16fd!==0x194){return db[_0x2376('0x80')][_0x2376('0xa4')]({'where':{'OpenchannelAccountId':_0x11dd3f},'order':_0x2376('0xa5')})[_0x2376('0x1f')](function(_0x541f3f){_0x2ab09c=_0x541f3f;});}})[_0x2376('0x28')](function(_0xe9122){_0x2b16fd=0x1f4;logger[_0x2376('0x24')](_0xe9122[_0x2376('0xa6')]);if(_0xe9122[_0x2376('0x38')]){delete _0xe9122['name'];}_0x2ab09c=_0xe9122;})[_0x2376('0xa7')](function(){if(_0x2ab09c===null){_0x4ce78c[_0x2376('0x37')](_0x2b16fd);}else{if(_0x2b16fd===0x1f4){_0x4ce78c['status'](_0x2b16fd)[_0x2376('0xa8')](_0x2ab09c);}else{_0x4ce78c[_0x2376('0x2e')](_0x2b16fd)[_0x2376('0x2a')](_0x2ab09c);}}});};exports[_0x2376('0xa9')]=function(_0x4a9a1c,_0x5498e0,_0x48dd15){var _0x514320={};var _0x27c161={};var _0x38f39c;var _0x232495;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4a9a1c['params']['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x5498e0,null))[_0x2376('0x1f')](function(_0x1d8670){if(_0x1d8670){_0x38f39c=_0x1d8670;_0x27c161[_0x2376('0x3e')]=_[_0x2376('0x40')](db[_0x2376('0x80')]['rawAttributes']);_0x27c161['query']=_[_0x2376('0x40')](_0x4a9a1c[_0x2376('0x3f')]);_0x27c161[_0x2376('0x41')]=_[_0x2376('0x54')](_0x27c161['model'],_0x27c161[_0x2376('0x3f')]);_0x514320['attributes']=_[_0x2376('0x54')](_0x27c161[_0x2376('0x3e')],qs[_0x2376('0x43')](_0x4a9a1c[_0x2376('0x3f')][_0x2376('0x43')]));_0x514320[_0x2376('0x42')]=_0x514320['attributes']['length']?_0x514320[_0x2376('0x42')]:_0x27c161[_0x2376('0x3e')];_0x514320[_0x2376('0x64')]=qs[_0x2376('0x46')](_0x4a9a1c['query'][_0x2376('0x46')]);_0x514320[_0x2376('0x49')]=qs[_0x2376('0x41')](_['pick'](_0x4a9a1c['query'],_0x27c161[_0x2376('0x41')]));if(_0x4a9a1c[_0x2376('0x3f')][_0x2376('0x48')]){_0x514320['where']=_['merge'](_0x514320[_0x2376('0x49')],{'$or':_[_0x2376('0x65')](_0x514320[_0x2376('0x42')],function(_0x2f52f9){var _0x169c7d={};_0x169c7d[_0x2f52f9]={'$like':'%'+_0x4a9a1c[_0x2376('0x3f')][_0x2376('0x48')]+'%'};return _0x169c7d;})});}_0x514320=_[_0x2376('0x4a')]({},_0x514320,_0x4a9a1c['options']);return _0x38f39c[_0x2376('0xa9')](_0x514320);}})['then'](function(_0x4635e0){if(_0x4635e0){_0x232495=_0x4635e0[_0x2376('0x55')];if(!_0x4a9a1c['query'][_0x2376('0x44')](_0x2376('0x45'))){_0x514320[_0x2376('0x2d')]=qs[_0x2376('0x2d')](_0x4a9a1c[_0x2376('0x3f')][_0x2376('0x2d')]);_0x514320['offset']=qs['offset'](_0x4a9a1c['query']['offset']);}return _0x38f39c['getApplications'](_0x514320);}})[_0x2376('0x1f')](function(_0x374799){if(_0x374799){return _0x374799?{'count':_0x232495,'rows':_0x374799}:null;}})[_0x2376('0x1f')](respondWithResult(_0x5498e0,null))[_0x2376('0x28')](handleError(_0x5498e0,null));};exports[_0x2376('0xaa')]=function(_0x337b97,_0x3ac76a,_0x27b790){var _0x1a95cb={'raw':![],'where':{}};var _0x34d581={};var _0x53a8d2={'count':0x0,'rows':[]};return db[_0x2376('0x3b')]['findOne']({'where':{'id':_0x337b97[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x3ac76a,null))[_0x2376('0x1f')](function(_0x3733b4){if(_0x3733b4){_0x34d581[_0x2376('0x3e')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x34d581[_0x2376('0x3f')]=_[_0x2376('0x40')](_0x337b97['query']);_0x34d581['filters']=_[_0x2376('0x54')](_0x34d581[_0x2376('0x3e')],_0x34d581[_0x2376('0x3f')]);_0x1a95cb[_0x2376('0x42')]=_[_0x2376('0x54')](_0x34d581[_0x2376('0x3e')],qs[_0x2376('0x43')](_0x337b97[_0x2376('0x3f')][_0x2376('0x43')]));_0x1a95cb[_0x2376('0x42')]=_0x1a95cb[_0x2376('0x42')][_0x2376('0x55')]?_0x1a95cb[_0x2376('0x42')]:_0x34d581[_0x2376('0x3e')];if(!_0x337b97[_0x2376('0x3f')][_0x2376('0x44')]('nolimit')){_0x1a95cb[_0x2376('0x2d')]=qs[_0x2376('0x2d')](_0x337b97[_0x2376('0x3f')][_0x2376('0x2d')]);_0x1a95cb[_0x2376('0x2b')]=qs[_0x2376('0x2b')](_0x337b97['query'][_0x2376('0x2b')]);}_0x1a95cb['order']=qs[_0x2376('0x46')](_0x337b97['query'][_0x2376('0x46')]);_0x1a95cb[_0x2376('0x49')]=qs[_0x2376('0x41')](_['pick'](_0x337b97['query'],_0x34d581[_0x2376('0x41')]));_0x1a95cb['where'][_0x2376('0x60')]=_0x3733b4['id'];if(_0x337b97['query'][_0x2376('0x48')]){_0x1a95cb[_0x2376('0x49')]=_[_0x2376('0x4a')](_0x1a95cb['where'],{'$or':_[_0x2376('0x65')](_0x1a95cb[_0x2376('0x42')],function(_0x15c00a){var _0x1f5d07={};_0x1f5d07[_0x15c00a]={'$like':'%'+_0x337b97[_0x2376('0x3f')][_0x2376('0x48')]+'%'};return _0x1f5d07;})});}_0x1a95cb=_['merge']({},_0x1a95cb,_0x337b97['options']);return db[_0x2376('0x89')][_0x2376('0x4d')]({'where':_0x1a95cb[_0x2376('0x49')]})[_0x2376('0x1f')](function(_0x52ed04){_0x53a8d2[_0x2376('0x4d')]=_0x52ed04;if(_0x337b97[_0x2376('0x3f')][_0x2376('0x4e')]){_0x1a95cb[_0x2376('0x56')]=[{'model':db[_0x2376('0x7d')],'as':_0x2376('0xab'),'required':![]},{'model':db['User'],'as':_0x2376('0xac'),'attributes':[_0x2376('0x38'),_0x2376('0xad'),_0x2376('0xae')],'required':![]},{'model':db['Tag'],'as':_0x2376('0xaf'),'attributes':['id','name','color'],'where':_0x337b97[_0x2376('0x3f')][_0x2376('0xb0')]?{'id':_0x337b97[_0x2376('0x3f')][_0x2376('0xb0')]}:undefined,'required':_0x337b97[_0x2376('0x3f')][_0x2376('0xb0')]?!![]:![]}];}return db[_0x2376('0x89')][_0x2376('0x4f')](_0x1a95cb);})[_0x2376('0x1f')](function(_0x352d66){_0x53a8d2[_0x2376('0x50')]=_0x352d66;return _0x53a8d2;});}})[_0x2376('0x1f')](respondWithFilteredResult(_0x3ac76a,_0x1a95cb))[_0x2376('0x28')](handleError(_0x3ac76a,null));};exports[_0x2376('0xb1')]=function(_0x2bfa76,_0x21e0ce,_0x13bc12){return db['OpenchannelAccount'][_0x2376('0x57')]({'where':{'id':_0x2bfa76[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x21e0ce,null))[_0x2376('0x1f')](function(_0x38ab38){if(_0x38ab38){return _0x38ab38['addAgents'](_0x2bfa76[_0x2376('0x5d')][_0x2376('0x6b')],_[_0x2376('0xb2')](_0x2bfa76[_0x2376('0x5d')],[_0x2376('0x6b'),'id'])||{})[_0x2376('0xb3')](function(_0x32053d){for(var _0x295e15=0x0;_0x295e15<_0x2bfa76[_0x2376('0x5d')][_0x2376('0x6b')]['length'];_0x295e15+=0x1){socket[_0x2376('0xb4')](_0x2376('0xb5'),{'UserId':Number(_0x2bfa76[_0x2376('0x5d')][_0x2376('0x6b')][_0x295e15]),'OpenchannelAccountId':Number(_0x2bfa76[_0x2376('0x52')]['id'])});}return _0x32053d;});}})[_0x2376('0x1f')](respondWithResult(_0x21e0ce,null))[_0x2376('0x28')](handleError(_0x21e0ce,null));};exports['removeAgents']=function(_0x24fc34,_0x38c768,_0x4c83cc){return db['OpenchannelAccount'][_0x2376('0x57')]({'where':{'id':_0x24fc34[_0x2376('0x52')]['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x38c768,null))[_0x2376('0x1f')](function(_0x1b3ba5){if(_0x1b3ba5){return _0x1b3ba5['removeAgents'](_0x24fc34[_0x2376('0x3f')][_0x2376('0x6b')])[_0x2376('0x1f')](function(){if(_[_0x2376('0xb6')](_0x24fc34[_0x2376('0x3f')][_0x2376('0x6b')])){for(var _0x33edfe=0x0;_0x33edfe<_0x24fc34[_0x2376('0x3f')][_0x2376('0x6b')][_0x2376('0x55')];_0x33edfe+=0x1){socket['emit'](_0x2376('0xb7'),{'UserId':Number(_0x24fc34[_0x2376('0x3f')]['ids'][_0x33edfe]),'OpenchannelAccountId':Number(_0x24fc34[_0x2376('0x52')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x24fc34[_0x2376('0x3f')][_0x2376('0x6b')]),'OpenchannelAccountId':Number(_0x24fc34[_0x2376('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x38c768,null))[_0x2376('0x28')](handleError(_0x38c768,null));};exports['getAgents']=function(_0x4c242f,_0x12bcd8,_0x27ef78){var _0x29096e={};var _0x3c5e4a={};var _0x2caf80;var _0x4d4097;return db[_0x2376('0x3b')]['findOne']({'where':{'id':_0x4c242f['params']['id']}})[_0x2376('0x1f')](handleEntityNotFound(_0x12bcd8,null))[_0x2376('0x1f')](function(_0x1787f7){if(_0x1787f7){_0x2caf80=_0x1787f7;_0x3c5e4a['model']=_[_0x2376('0x40')](db[_0x2376('0x98')][_0x2376('0x3c')]);_0x3c5e4a[_0x2376('0x3f')]=_[_0x2376('0x40')](_0x4c242f['query']);_0x3c5e4a[_0x2376('0x41')]=_[_0x2376('0x54')](_0x3c5e4a[_0x2376('0x3e')],_0x3c5e4a['query']);_0x29096e[_0x2376('0x42')]=_['intersection'](_0x3c5e4a[_0x2376('0x3e')],qs['fields'](_0x4c242f[_0x2376('0x3f')]['fields']));_0x29096e[_0x2376('0x42')]=_0x29096e[_0x2376('0x42')][_0x2376('0x55')]?_0x29096e['attributes']:_0x3c5e4a['model'];_0x29096e['order']=qs[_0x2376('0x46')](_0x4c242f['query'][_0x2376('0x46')]);_0x29096e[_0x2376('0x49')]=qs[_0x2376('0x41')](_[_0x2376('0x47')](_0x4c242f[_0x2376('0x3f')],_0x3c5e4a['filters']));if(_0x4c242f[_0x2376('0x3f')][_0x2376('0x48')]){_0x29096e[_0x2376('0x49')]=_['merge'](_0x29096e[_0x2376('0x49')],{'$or':_['map'](_0x29096e[_0x2376('0x42')],function(_0x201832){var _0x53b9e2={};_0x53b9e2[_0x201832]={'$like':'%'+_0x4c242f[_0x2376('0x3f')][_0x2376('0x48')]+'%'};return _0x53b9e2;})});}_0x29096e=_[_0x2376('0x4a')]({},_0x29096e,_0x4c242f[_0x2376('0x4c')]);return _0x2caf80['getAgents'](_0x29096e);}})[_0x2376('0x1f')](function(_0x4e1991){if(_0x4e1991){_0x4d4097=_0x4e1991['length'];if(!_0x4c242f[_0x2376('0x3f')]['hasOwnProperty'](_0x2376('0x45'))){_0x29096e[_0x2376('0x2d')]=qs[_0x2376('0x2d')](_0x4c242f[_0x2376('0x3f')]['limit']);_0x29096e[_0x2376('0x2b')]=qs[_0x2376('0x2b')](_0x4c242f[_0x2376('0x3f')]['offset']);}return _0x2caf80[_0x2376('0xb8')](_0x29096e);}})[_0x2376('0x1f')](function(_0x4fbfb4){if(_0x4fbfb4){return _0x4fbfb4?{'count':_0x4d4097,'rows':_0x4fbfb4}:null;}})[_0x2376('0x1f')](respondWithResult(_0x12bcd8,null))[_0x2376('0x28')](handleError(_0x12bcd8,null));};exports[_0x2376('0xa8')]=function(_0x330c4a,_0xa4c9f2,_0x2e2615){var _0x5cb11f,_0x38f071,_0x37737d;if(_['isNil'](_0x330c4a[_0x2376('0x5d')]['body'])||_0x330c4a[_0x2376('0x5d')][_0x2376('0x5d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x330c4a[_0x2376('0x5d')]['to'])){}_0x5cb11f=_0x330c4a[_0x2376('0x5d')]['to'];return db[_0x2376('0x3b')]['findOne']({'where':{'id':_0x330c4a[_0x2376('0x52')]['id']}})['then'](handleEntityNotFound(_0xa4c9f2,null))[_0x2376('0x1f')](function(_0x599c7d){if(_0x599c7d){return db['OpenchannelAccount'][_0x2376('0x57')]({'where':{'id':_0x599c7d['id']},'include':[{'model':db[_0x2376('0x7b')],'as':_0x2376('0x7c'),'include':[{'model':db[_0x2376('0x7d')],'as':_0x2376('0x7e'),'where':{[_0x599c7d[_0x2376('0x78')]]:_0x5cb11f},'limit':0x1,'order':[[_0x2376('0x70'),_0x2376('0x7f')]]}]}]})['then'](handleEntityNotFound(_0xa4c9f2,null))['then'](function(_0x4c92cd){if(_0x4c92cd&&_0x4c92cd[_0x2376('0x7c')]){_0x38f071=_0x4c92cd[_0x2376('0x33')]({'plain':!![]});if(_0x38f071['List']&&_0x38f071[_0x2376('0x7c')]['Contacts'][_0x2376('0x55')]){return _0x38f071['List'][_0x2376('0x7e')][0x0];}return db[_0x2376('0x7d')][_0x2376('0x58')](_[_0x2376('0x19')](_0x330c4a['body'],{'firstName':_0x5cb11f,[_0x4c92cd[_0x2376('0x78')]]:_0x5cb11f,'phone':_0x5cb11f,'ListId':_0x38f071[_0x2376('0x86')]}));}})[_0x2376('0x1f')](handleEntityNotFound(_0xa4c9f2,null))[_0x2376('0x1f')](function(_0x2fc91d){if(_0x2fc91d){_0x37737d=_0x2fc91d;return db[_0x2376('0x89')]['find']({'where':{'ContactId':_0x37737d['id'],'closed':![],'OpenchannelAccountId':_0x38f071['id']}})['then'](function(_0xb9e803){if(_0xb9e803){return[_0xb9e803,![]];}return db[_0x2376('0x89')][_0x2376('0x58')]({'UserId':_0x330c4a[_0x2376('0xb9')]['id'],'ContactId':_0x37737d['id'],'OpenchannelAccountId':_0x38f071['id'],'lastMsgDirection':'out','Messages':[_[_0x2376('0x4a')](_0x330c4a['body'],{'read':![],'body':_0x330c4a[_0x2376('0x5d')]['body'],'OpenchannelAccountId':_0x38f071['id'],'UserId':_0x330c4a[_0x2376('0xb9')]['id'],'ContactId':_0x37737d['id']})]},{'include':[{'model':db[_0x2376('0x95')],'as':_0x2376('0xba')}]})['then'](function(_0x5c9bbd){return[_0x5c9bbd,!![]];});});}})[_0x2376('0xb3')](function(_0x5b2145,_0x2e6c1d){if(_0x2e6c1d){return _0x5b2145;}return db[_0x2376('0x95')][_0x2376('0x58')](_[_0x2376('0x4a')](_0x330c4a['body'],{'read':![],'body':_0x330c4a[_0x2376('0x5d')][_0x2376('0x5d')],'OpenchannelAccountId':_0x38f071['id'],'OpenchannelInteractionId':_0x5b2145['id'],'UserId':_0x330c4a[_0x2376('0xb9')]['id'],'ContactId':_0x37737d['id']}))[_0x2376('0x1f')](function(_0x3559f3){_0x5b2145[_0x2376('0xbb')][_0x2376('0xba')]=[];_0x5b2145[_0x2376('0xbb')]['Messages'][_0x2376('0x92')](_0x3559f3[_0x2376('0xbb')]);return _0x5b2145;});});}})['then'](respondWithResult(_0xa4c9f2,null))['catch'](handleError(_0xa4c9f2,null));}; \ No newline at end of file +var _0x004e=['end','sendStatus','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','count','includeAll','include','findAll','rows','show','mandatoryDispositionPause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','list','priority','account','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','transaction','sequelize','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','then','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','status','json','offset','undefined','limit','set','reject','destroy','OpenchannelAccounts','UserProfileResource'];(function(_0x20b6c5,_0x299643){var _0x5e0094=function(_0x258e69){while(--_0x258e69){_0x20b6c5['push'](_0x20b6c5['shift']());}};_0x5e0094(++_0x299643);}(_0x004e,0x88));var _0xe004=function(_0x1bd997,_0x4aee52){_0x1bd997=_0x1bd997-0x0;var _0x440f23=_0x004e[_0x1bd997];return _0x440f23;};'use strict';var emlformat=require(_0xe004('0x0'));var rimraf=require(_0xe004('0x1'));var zipdir=require(_0xe004('0x2'));var jsonpatch=require(_0xe004('0x3'));var rp=require(_0xe004('0x4'));var moment=require(_0xe004('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe004('0x6'));var util=require(_0xe004('0x7'));var path=require('path');var sox=require(_0xe004('0x8'));var csv=require('to-csv');var ejs=require(_0xe004('0x9'));var fs=require('fs');var fs_extra=require(_0xe004('0xa'));var _=require('lodash');var squel=require(_0xe004('0xb'));var crypto=require(_0xe004('0xc'));var jsforce=require(_0xe004('0xd'));var deskjs=require(_0xe004('0xe'));var toCsv=require(_0xe004('0xf'));var querystring=require(_0xe004('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe004('0x11'));var qs=require(_0xe004('0x12'));var as=require(_0xe004('0x13'));var hardwareService=require(_0xe004('0x14'));var logger=require(_0xe004('0x15'))('api');var utils=require(_0xe004('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe004('0x17'));var db=require(_0xe004('0x18'))['db'];config[_0xe004('0x19')]=_[_0xe004('0x1a')](config[_0xe004('0x19')],{'host':_0xe004('0x1b'),'port':0x18eb});var socket=require(_0xe004('0x1c'))(new Redis(config[_0xe004('0x19')]));require(_0xe004('0x1d'))['register'](socket);var jayson=require(_0xe004('0x1e'));var client=jayson['client'][_0xe004('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xe004('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x20239e,_0xec5a17,_0x307ad6,_0x900c9f){return new BPromise(function(_0x296dfa,_0x269348){var _0x2a6d04=_0x900c9f||client;return _0x2a6d04[_0xe004('0x20')](_0x20239e,_0x307ad6)[_0xe004('0x21')](function(_0x8c0488){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xec5a17,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xec5a17,'request\x20sent',JSON[_0xe004('0x22')](_0x8c0488));if(_0x8c0488[_0xe004('0x23')]){if(_0x8c0488['error'][_0xe004('0x24')]===0x1f4){logger[_0xe004('0x23')](_0xe004('0x25'),_0xec5a17,_0x8c0488[_0xe004('0x23')]['message']);return _0x269348(_0x8c0488[_0xe004('0x23')][_0xe004('0x26')]);}logger[_0xe004('0x23')](_0xe004('0x25'),_0xec5a17,_0x8c0488['error'][_0xe004('0x26')]);return _0x296dfa(_0x8c0488[_0xe004('0x23')][_0xe004('0x26')]);}else{logger['info'](_0xe004('0x25'),_0xec5a17,_0xe004('0x27'));_0x296dfa(_0x8c0488[_0xe004('0x28')][_0xe004('0x26')]);}})[_0xe004('0x29')](function(_0xac326b){logger[_0xe004('0x23')](_0xe004('0x25'),_0xec5a17,_0xac326b);_0x269348(_0xac326b);});});}function respondWithStatusCode(_0x53a59a,_0x3db338){_0x3db338=_0x3db338||0xcc;return function(_0x41fcb1){if(_0x41fcb1){return _0x53a59a['sendStatus'](_0x3db338);}return _0x53a59a[_0xe004('0x2a')](_0x3db338)['end']();};}function respondWithResult(_0x296c40,_0x48a39b){_0x48a39b=_0x48a39b||0xc8;return function(_0x508f2d){if(_0x508f2d){return _0x296c40[_0xe004('0x2a')](_0x48a39b)[_0xe004('0x2b')](_0x508f2d);}};}function respondWithFilteredResult(_0x48307c,_0x3f0e03){return function(_0x5ca3bb){if(_0x5ca3bb){var _0x1906ab=typeof _0x3f0e03[_0xe004('0x2c')]===_0xe004('0x2d')&&typeof _0x3f0e03[_0xe004('0x2e')]===_0xe004('0x2d');var _0x2ef866=_0x5ca3bb['count'];var _0x5dbc1a=_0x1906ab?0x0:_0x3f0e03[_0xe004('0x2c')];var _0x142254=_0x1906ab?_0x5ca3bb['count']:_0x3f0e03[_0xe004('0x2c')]+_0x3f0e03[_0xe004('0x2e')];var _0x586a1b;if(_0x142254>=_0x2ef866){_0x142254=_0x2ef866;_0x586a1b=0xc8;}else{_0x586a1b=0xce;}_0x48307c[_0xe004('0x2a')](_0x586a1b);return _0x48307c[_0xe004('0x2f')]('Content-Range',_0x5dbc1a+'-'+_0x142254+'/'+_0x2ef866)[_0xe004('0x2b')](_0x5ca3bb);}return null;};}function patchUpdates(_0x5c9d62){return function(_0x4558dd){try{jsonpatch['apply'](_0x4558dd,_0x5c9d62,!![]);}catch(_0x468d69){return BPromise[_0xe004('0x30')](_0x468d69);}return _0x4558dd['save']();};}function saveUpdates(_0xb2354d,_0xd5feab){return function(_0x2f7384){if(_0x2f7384){return _0x2f7384['update'](_0xb2354d)[_0xe004('0x21')](function(_0xb436ce){return _0xb436ce;});}return null;};}function removeEntity(_0x1854e3,_0x39f489){return function(_0xc760f2){if(_0xc760f2){return _0xc760f2[_0xe004('0x31')]()['then'](function(){var _0x6e51fb=_0xc760f2['get']({'plain':!![]});var _0x472b91=_0xe004('0x32');return db[_0xe004('0x33')]['destroy']({'where':{'type':_0x472b91,'resourceId':_0x6e51fb['id']}})['then'](function(){return _0xc760f2;});})['then'](function(){_0x1854e3[_0xe004('0x2a')](0xcc)[_0xe004('0x34')]();});}};}function handleEntityNotFound(_0x5c54d7,_0x551d1c){return function(_0x32c41b){if(!_0x32c41b){_0x5c54d7[_0xe004('0x35')](0x194);}return _0x32c41b;};}function handleError(_0x893f12,_0x30c89a){_0x30c89a=_0x30c89a||0x1f4;return function(_0x381404){logger['error'](_0x381404['stack']);if(_0x381404[_0xe004('0x36')]){delete _0x381404[_0xe004('0x36')];}_0x893f12[_0xe004('0x2a')](_0x30c89a)[_0xe004('0x37')](_0x381404);};}exports[_0xe004('0x38')]=function(_0x4951d1,_0x5c4ef6){var _0x4a9716={'include':[{'model':db[_0xe004('0x39')],'as':'mandatoryDispositionPause'}]},_0x406a60={},_0x1b4c58={'count':0x0,'rows':[]};var _0x20e40f=_[_0xe004('0x3a')](db[_0xe004('0x3b')][_0xe004('0x3c')],function(_0x1a1297){return{'name':_0x1a1297[_0xe004('0x3d')],'type':_0x1a1297[_0xe004('0x3e')][_0xe004('0x3f')]};});_0x406a60[_0xe004('0x40')]=_[_0xe004('0x3a')](_0x20e40f,'name');_0x406a60[_0xe004('0x41')]=_[_0xe004('0x42')](_0x4951d1[_0xe004('0x41')]);_0x406a60[_0xe004('0x43')]=_[_0xe004('0x44')](_0x406a60['model'],_0x406a60[_0xe004('0x41')]);_0x4a9716[_0xe004('0x45')]=_[_0xe004('0x44')](_0x406a60['model'],qs[_0xe004('0x46')](_0x4951d1['query'][_0xe004('0x46')]));_0x4a9716['attributes']=_0x4a9716[_0xe004('0x45')]['length']?_0x4a9716[_0xe004('0x45')]:_0x406a60[_0xe004('0x40')];if(!_0x4951d1[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x4a9716[_0xe004('0x2e')]=qs[_0xe004('0x2e')](_0x4951d1[_0xe004('0x41')][_0xe004('0x2e')]);_0x4a9716[_0xe004('0x2c')]=qs[_0xe004('0x2c')](_0x4951d1[_0xe004('0x41')][_0xe004('0x2c')]);}_0x4a9716[_0xe004('0x49')]=qs[_0xe004('0x4a')](_0x4951d1['query']['sort']);_0x4a9716['where']=qs[_0xe004('0x43')](_['pick'](_0x4951d1['query'],_0x406a60['filters']),_0x20e40f);if(_0x4951d1['query']['filter']){_0x4a9716[_0xe004('0x4b')]=_[_0xe004('0x4c')](_0x4a9716['where'],{'$or':_['map'](_0x20e40f,function(_0x179eec){if(_0x179eec[_0xe004('0x3e')]!=='VIRTUAL'){var _0x10e71b={};_0x10e71b[_0x179eec[_0xe004('0x36')]]={'$like':'%'+_0x4951d1['query'][_0xe004('0x4d')]+'%'};return _0x10e71b;}})});}_0x4a9716=_[_0xe004('0x4c')]({},_0x4a9716,_0x4951d1[_0xe004('0x4e')]);var _0x51393={'where':_0x4a9716[_0xe004('0x4b')]};return db[_0xe004('0x3b')][_0xe004('0x4f')](_0x51393)['then'](function(_0x2598ce){_0x1b4c58[_0xe004('0x4f')]=_0x2598ce;if(_0x4951d1[_0xe004('0x41')][_0xe004('0x50')]){_0x4a9716[_0xe004('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe004('0x52')](_0x4a9716);})[_0xe004('0x21')](function(_0x34c635){_0x1b4c58[_0xe004('0x53')]=_0x34c635;return _0x1b4c58;})[_0xe004('0x21')](respondWithFilteredResult(_0x5c4ef6,_0x4a9716))[_0xe004('0x29')](handleError(_0x5c4ef6,null));};exports[_0xe004('0x54')]=function(_0x20d6f5,_0xeab7d6){var _0x5113c1={'raw':![],'where':{'id':_0x20d6f5['params']['id']},'include':[{'model':db['Pause'],'as':_0xe004('0x55')}]},_0x2e8d65={};_0x2e8d65[_0xe004('0x40')]=_[_0xe004('0x42')](db[_0xe004('0x3b')][_0xe004('0x3c')]);_0x2e8d65[_0xe004('0x41')]=_[_0xe004('0x42')](_0x20d6f5[_0xe004('0x41')]);_0x2e8d65[_0xe004('0x43')]=_[_0xe004('0x44')](_0x2e8d65[_0xe004('0x40')],_0x2e8d65[_0xe004('0x41')]);_0x5113c1[_0xe004('0x45')]=_[_0xe004('0x44')](_0x2e8d65[_0xe004('0x40')],qs[_0xe004('0x46')](_0x20d6f5[_0xe004('0x41')][_0xe004('0x46')]));_0x5113c1[_0xe004('0x45')]=_0x5113c1['attributes'][_0xe004('0x56')]?_0x5113c1['attributes']:_0x2e8d65[_0xe004('0x40')];if(_0x20d6f5[_0xe004('0x41')][_0xe004('0x50')]){_0x5113c1[_0xe004('0x51')]=[{'all':!![]}];}_0x5113c1=_[_0xe004('0x4c')]({},_0x5113c1,_0x20d6f5['options']);return db['OpenchannelAccount'][_0xe004('0x57')](_0x5113c1)[_0xe004('0x21')](handleEntityNotFound(_0xeab7d6,null))[_0xe004('0x21')](respondWithResult(_0xeab7d6,null))[_0xe004('0x29')](handleError(_0xeab7d6,null));};exports['create']=function(_0x3bfdfd,_0x2b91f1){return db[_0xe004('0x3b')][_0xe004('0x58')](_0x3bfdfd[_0xe004('0x59')],{})[_0xe004('0x21')](function(_0x23efe2){var _0x137101=_0x3bfdfd[_0xe004('0x5a')]['get']({'plain':!![]});if(!_0x137101)throw new Error(_0xe004('0x5b'));if(_0x137101[_0xe004('0x5c')]==='user'){var _0x34bc11=_0x23efe2[_0xe004('0x5d')]({'plain':!![]});var _0x4068a2=_0xe004('0x32');return db[_0xe004('0x5e')][_0xe004('0x57')]({'where':{'name':_0x4068a2,'userProfileId':_0x137101['userProfileId']},'raw':!![]})[_0xe004('0x21')](function(_0x351e15){if(_0x351e15&&_0x351e15[_0xe004('0x5f')]===0x0){return db['UserProfileResource'][_0xe004('0x58')]({'name':_0x34bc11['name'],'resourceId':_0x34bc11['id'],'type':_0x351e15['name'],'sectionId':_0x351e15['id']},{})[_0xe004('0x21')](function(){return _0x23efe2;});}else{return _0x23efe2;}})[_0xe004('0x29')](function(_0x5d4e86){logger[_0xe004('0x23')](_0xe004('0x60'),_0x5d4e86);throw _0x5d4e86;});}return _0x23efe2;})[_0xe004('0x21')](respondWithResult(_0x2b91f1,0xc9))['catch'](handleError(_0x2b91f1,null));};exports[_0xe004('0x61')]=function(_0x428acf,_0x3c9469){if(_0x428acf[_0xe004('0x59')]['id']){delete _0x428acf[_0xe004('0x59')]['id'];}return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x428acf[_0xe004('0x62')]['id']},'include':[{'model':db[_0xe004('0x39')],'as':_0xe004('0x55')}]})['then'](handleEntityNotFound(_0x3c9469,null))[_0xe004('0x21')](saveUpdates(_0x428acf[_0xe004('0x59')],null))[_0xe004('0x21')](respondWithResult(_0x3c9469,null))[_0xe004('0x29')](handleError(_0x3c9469,null));};exports[_0xe004('0x31')]=function(_0x415d33,_0x2d992f){return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x415d33[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x2d992f,null))['then'](removeEntity(_0x2d992f,null))[_0xe004('0x29')](handleError(_0x2d992f,null));};exports[_0xe004('0x63')]=function(_0x347b6b,_0x2470e8){return db[_0xe004('0x3b')][_0xe004('0x63')]()[_0xe004('0x21')](respondWithResult(_0x2470e8,null))[_0xe004('0x29')](handleError(_0x2470e8,null));};exports[_0xe004('0x64')]=function(_0x36d2e3,_0x5ae77d,_0x5db19d){if(_0x36d2e3['body']['id']){delete _0x36d2e3[_0xe004('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x36d2e3[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x5ae77d,null))[_0xe004('0x21')](function(_0x293e1d){if(_0x293e1d){_0x36d2e3[_0xe004('0x59')][_0xe004('0x65')]=_0x293e1d['id'];return db[_0xe004('0x66')][_0xe004('0x58')](_0x36d2e3[_0xe004('0x59')]);}})[_0xe004('0x21')](respondWithResult(_0x5ae77d,null))[_0xe004('0x29')](handleError(_0x5ae77d,null));};exports[_0xe004('0x67')]=function(_0x454e70,_0x500f69,_0x3ac2ee){var _0x41bdd4={'raw':![],'where':{}};var _0x3c05d1={};var _0x5b8176={'count':0x0,'rows':[]};return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x454e70[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x500f69,null))[_0xe004('0x21')](function(_0x1e4e66){if(_0x1e4e66){_0x3c05d1[_0xe004('0x40')]=_['keys'](db['Disposition']['rawAttributes']);_0x3c05d1[_0xe004('0x41')]=_[_0xe004('0x42')](_0x454e70[_0xe004('0x41')]);_0x3c05d1['filters']=_[_0xe004('0x44')](_0x3c05d1[_0xe004('0x40')],_0x3c05d1[_0xe004('0x41')]);_0x41bdd4['attributes']=_[_0xe004('0x44')](_0x3c05d1['model'],qs[_0xe004('0x46')](_0x454e70[_0xe004('0x41')]['fields']));_0x41bdd4['attributes']=_0x41bdd4[_0xe004('0x45')][_0xe004('0x56')]?_0x41bdd4[_0xe004('0x45')]:_0x3c05d1[_0xe004('0x40')];if(!_0x454e70[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x41bdd4[_0xe004('0x2e')]=qs['limit'](_0x454e70[_0xe004('0x41')][_0xe004('0x2e')]);_0x41bdd4[_0xe004('0x2c')]=qs[_0xe004('0x2c')](_0x454e70['query'][_0xe004('0x2c')]);}_0x41bdd4['order']=qs[_0xe004('0x4a')](_0x454e70[_0xe004('0x41')][_0xe004('0x4a')]);_0x41bdd4[_0xe004('0x4b')]=qs['filters'](_[_0xe004('0x69')](_0x454e70[_0xe004('0x41')],_0x3c05d1[_0xe004('0x43')]));_0x41bdd4[_0xe004('0x4b')]['OpenchannelAccountId']=_0x1e4e66['id'];if(_0x454e70['query']['filter']){_0x41bdd4[_0xe004('0x4b')]=_[_0xe004('0x4c')](_0x41bdd4['where'],{'$or':_[_0xe004('0x3a')](_0x41bdd4[_0xe004('0x45')],function(_0x2e69d8){var _0x1b6026={};_0x1b6026[_0x2e69d8]={'$like':'%'+_0x454e70[_0xe004('0x41')][_0xe004('0x4d')]+'%'};return _0x1b6026;})});}_0x41bdd4=_['merge']({},_0x41bdd4,_0x454e70[_0xe004('0x4e')]);return db[_0xe004('0x66')][_0xe004('0x4f')]({'where':_0x41bdd4['where']})[_0xe004('0x21')](function(_0x471613){_0x5b8176['count']=_0x471613;if(_0x454e70['query'][_0xe004('0x50')]){_0x41bdd4[_0xe004('0x51')]=[{'all':!![]}];}return db[_0xe004('0x66')][_0xe004('0x52')](_0x41bdd4);})[_0xe004('0x21')](function(_0x43492a){_0x5b8176['rows']=_0x43492a;return _0x5b8176;});}})[_0xe004('0x21')](respondWithFilteredResult(_0x500f69,_0x41bdd4))[_0xe004('0x29')](handleError(_0x500f69,null));};exports[_0xe004('0x6a')]=function(_0x48573a,_0x4b106d,_0x2b771e){return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x48573a['params']['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x4b106d,null))[_0xe004('0x21')](function(_0x171977){if(_0x171977){return _0x171977[_0xe004('0x6a')](_0x48573a[_0xe004('0x41')][_0xe004('0x6b')]);}})[_0xe004('0x21')](respondWithStatusCode(_0x4b106d,null))[_0xe004('0x29')](handleError(_0x4b106d,null));};exports[_0xe004('0x6c')]=function(_0x5764ab,_0x985810,_0x3a38e2){if(_0x5764ab[_0xe004('0x59')]['id']){delete _0x5764ab[_0xe004('0x59')]['id'];}return db['OpenchannelAccount'][_0xe004('0x57')]({'where':{'id':_0x5764ab['params']['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x985810,null))[_0xe004('0x21')](function(_0x516e12){if(_0x516e12){_0x5764ab['body'][_0xe004('0x65')]=_0x516e12['id'];return db[_0xe004('0x6d')][_0xe004('0x58')](_0x5764ab[_0xe004('0x59')]);}})[_0xe004('0x21')](respondWithResult(_0x985810,null))[_0xe004('0x29')](handleError(_0x985810,null));};exports[_0xe004('0x6e')]=function(_0x39b406,_0x4d6a8b,_0x403e4f){var _0x32b985={'raw':![],'where':{}};var _0x16e611={};var _0x34ed02={'count':0x0,'rows':[]};return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x39b406[_0xe004('0x62')]['id']}})['then'](handleEntityNotFound(_0x4d6a8b,null))[_0xe004('0x21')](function(_0x584f92){if(_0x584f92){_0x16e611[_0xe004('0x40')]=_[_0xe004('0x42')](db[_0xe004('0x6d')][_0xe004('0x3c')]);_0x16e611[_0xe004('0x41')]=_[_0xe004('0x42')](_0x39b406[_0xe004('0x41')]);_0x16e611[_0xe004('0x43')]=_[_0xe004('0x44')](_0x16e611[_0xe004('0x40')],_0x16e611[_0xe004('0x41')]);_0x32b985[_0xe004('0x45')]=_[_0xe004('0x44')](_0x16e611[_0xe004('0x40')],qs[_0xe004('0x46')](_0x39b406[_0xe004('0x41')][_0xe004('0x46')]));_0x32b985[_0xe004('0x45')]=_0x32b985[_0xe004('0x45')][_0xe004('0x56')]?_0x32b985[_0xe004('0x45')]:_0x16e611['model'];if(!_0x39b406[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x32b985[_0xe004('0x2e')]=qs[_0xe004('0x2e')](_0x39b406[_0xe004('0x41')][_0xe004('0x2e')]);_0x32b985[_0xe004('0x2c')]=qs[_0xe004('0x2c')](_0x39b406[_0xe004('0x41')][_0xe004('0x2c')]);}_0x32b985['order']=qs[_0xe004('0x4a')](_0x39b406[_0xe004('0x41')][_0xe004('0x4a')]);_0x32b985[_0xe004('0x4b')]=qs[_0xe004('0x43')](_[_0xe004('0x69')](_0x39b406[_0xe004('0x41')],_0x16e611[_0xe004('0x43')]));_0x32b985['where'][_0xe004('0x65')]=_0x584f92['id'];if(_0x39b406[_0xe004('0x41')]['filter']){_0x32b985['where']=_[_0xe004('0x4c')](_0x32b985[_0xe004('0x4b')],{'$or':_[_0xe004('0x3a')](_0x32b985[_0xe004('0x45')],function(_0x36d70f){var _0x85ad96={};_0x85ad96[_0x36d70f]={'$like':'%'+_0x39b406['query'][_0xe004('0x4d')]+'%'};return _0x85ad96;})});}_0x32b985=_[_0xe004('0x4c')]({},_0x32b985,_0x39b406[_0xe004('0x4e')]);return db['CannedAnswer']['count']({'where':_0x32b985['where']})[_0xe004('0x21')](function(_0x337add){_0x34ed02['count']=_0x337add;if(_0x39b406[_0xe004('0x41')]['includeAll']){_0x32b985[_0xe004('0x51')]=[{'all':!![]}];}return db[_0xe004('0x6d')][_0xe004('0x52')](_0x32b985);})[_0xe004('0x21')](function(_0x4c0645){_0x34ed02[_0xe004('0x53')]=_0x4c0645;return _0x34ed02;});}})[_0xe004('0x21')](respondWithFilteredResult(_0x4d6a8b,_0x32b985))[_0xe004('0x29')](handleError(_0x4d6a8b,null));};exports[_0xe004('0x6f')]=function(_0x4af355,_0x3d8da5,_0x23e11b){return db[_0xe004('0x3b')]['find']({'where':{'id':_0x4af355[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x3d8da5,null))[_0xe004('0x21')](function(_0x3edee6){if(_0x3edee6){return _0x3edee6[_0xe004('0x6f')](_0x4af355['query'][_0xe004('0x6b')]);}})[_0xe004('0x21')](respondWithStatusCode(_0x3d8da5,null))[_0xe004('0x29')](handleError(_0x3d8da5,null));};exports[_0xe004('0x70')]=function(_0x1a3289,_0x55bcc5,_0x5610cf){var _0x34b2b0={'body':_0x1a3289[_0xe004('0x59')],'channel':_0xe004('0x71')};var _0x4edeec=[];var _0x11048c=[];var _0x1c43f5={};var _0xc3f864=![];return db[_0xe004('0x72')]['describe']()[_0xe004('0x21')](function(_0x5b5e50){if(!_0x5b5e50){throw new db[(_0xe004('0x73'))][(_0xe004('0x74'))]('no\x20available\x20attributes');}_0x4edeec=_['difference'](_[_0xe004('0x42')](_0x5b5e50),[_0xe004('0x75'),_0xe004('0x76')]);_0x11048c=_['difference'](_[_0xe004('0x42')](_0x5b5e50),[_0xe004('0x75'),_0xe004('0x76'),_0xe004('0x77'),_0xe004('0x78')]);if(_0x1a3289[_0xe004('0x59')]['id']){delete _0x1a3289[_0xe004('0x59')]['id'];}if(_[_0xe004('0x79')](_0x1a3289[_0xe004('0x59')][_0xe004('0x7a')])){throw new db['Sequelize'][(_0xe004('0x74'))]('from\x20is\x20mandatory');}if(_[_0xe004('0x79')](_0x1a3289[_0xe004('0x59')][_0xe004('0x59')])||_0x1a3289[_0xe004('0x59')][_0xe004('0x59')]===''){throw new db[(_0xe004('0x73'))][(_0xe004('0x74'))](_0xe004('0x7b'));}if(_['isNil'](_0x1a3289[_0xe004('0x59')][_0xe004('0x7c')])){throw new db['Sequelize'][(_0xe004('0x74'))](_0xe004('0x7d')+_0x11048c);}if(!_[_0xe004('0x7e')](_0x11048c,_0x1a3289['body'][_0xe004('0x7c')])){throw new db[(_0xe004('0x73'))][(_0xe004('0x74'))](_0xe004('0x7f')+_0x11048c);}_0x1c43f5[_0x1a3289['body'][_0xe004('0x7c')]]=_0x1a3289[_0xe004('0x59')][_0xe004('0x7a')];})[_0xe004('0x21')](function(){return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x1a3289[_0xe004('0x62')]['id']},'include':[{'model':db[_0xe004('0x80')],'as':'List','include':[{'model':db[_0xe004('0x72')],'as':_0xe004('0x81'),'where':_0x1c43f5,'limit':0x1,'order':[[_0xe004('0x76'),_0xe004('0x82')]]}]},{'model':db[_0xe004('0x83')],'as':_0xe004('0x84')}]});})[_0xe004('0x21')](handleEntityNotFound(_0x55bcc5,null))[_0xe004('0x21')](function(_0xac02e3){if(_0xac02e3&&_0xac02e3[_0xe004('0x85')]){_0x34b2b0['account']=_0xac02e3;_0x34b2b0['applications']=_0xac02e3[_0xe004('0x84')];_0x34b2b0[_0xe004('0x86')]=_0xac02e3[_0xe004('0x85')];_0x34b2b0['applications']=_['orderBy'](_0x34b2b0['applications'],[_0xe004('0x87')],['asc']);if(_0x34b2b0[_0xe004('0x88')]['Applications']){delete _0x34b2b0[_0xe004('0x88')]['Applications'];}if(_0x34b2b0[_0xe004('0x88')]['List']&&_0x34b2b0[_0xe004('0x88')][_0xe004('0x85')]['Contacts'][_0xe004('0x56')]){return _0x34b2b0['account'][_0xe004('0x85')][_0xe004('0x81')][0x0];}var _0x21af47=_['defaults'](_0x1a3289['body'],{'firstName':_0x1a3289[_0xe004('0x59')][_0xe004('0x7a')],'ListId':_0xac02e3[_0xe004('0x78')]});_0x21af47[_0x1a3289[_0xe004('0x59')][_0xe004('0x7c')]]=_0x1a3289[_0xe004('0x59')][_0xe004('0x7a')];return db['CmContact'][_0xe004('0x58')](_0x21af47,{'fields':_0x4edeec,'raw':!![]});}})[_0xe004('0x21')](handleEntityNotFound(_0x55bcc5,null))[_0xe004('0x21')](function(_0x38cae7){_0x34b2b0['contact']=_0x38cae7;if(_0x38cae7){var _0x16ca2c={'ContactId':_0x38cae7['id'],'OpenchannelAccountId':_0x1a3289[_0xe004('0x62')]['id'],'from':(_0x38cae7[_0xe004('0x89')]||'')+'\x20'+(_0x38cae7[_0xe004('0x8a')]||'')};var _0x13ea26={'OpenchannelAccountId':_0x1a3289['params']['id'],'closed':![]};if(_0x1a3289[_0xe004('0x59')][_0xe004('0x8b')]){_0x13ea26[_0xe004('0x8b')]=_0x1a3289[_0xe004('0x59')]['threadId'];return db[_0xe004('0x8c')][_0xe004('0x57')]({'where':_0x13ea26})[_0xe004('0x21')](function(_0x3616de){if(_0x3616de){return[_0x3616de,![]];}_0x16ca2c[_0xe004('0x8b')]=_0x1a3289['body'][_0xe004('0x8b')];_0x16ca2c[_0xe004('0x8d')]=_0x1a3289[_0xe004('0x59')][_0xe004('0x8d')];return db[_0xe004('0x8c')][_0xe004('0x58')](_0x16ca2c)[_0xe004('0x21')](function(_0x4f28a){return[_0x4f28a,!![]];});});}else{_0x13ea26[_0xe004('0x8b')]=null;}_0x13ea26[_0xe004('0x8e')]=_0x38cae7['id'];return db[_0xe004('0x8c')][_0xe004('0x57')]({'where':_0x13ea26})['then'](function(_0x5bf847){if(_0x5bf847){return[_0x5bf847,![]];}return db['OpenchannelInteraction']['create'](_0x16ca2c)[_0xe004('0x21')](function(_0x287b2f){return[_0x287b2f,!![]];});});}})['spread'](function(_0x35b0b6,_0x750788){if(_0x35b0b6){_0xc3f864=_0x750788;if(!_0x750788){var _0x2f6f2c={'from':(_0x34b2b0['contact'][_0xe004('0x89')]||'')+'\x20'+(_0x34b2b0[_0xe004('0x8f')]['lastName']||'')};if(_0x1a3289['body'][_0xe004('0x8b')]&&_0x1a3289[_0xe004('0x59')][_0xe004('0x90')]&&_0x1a3289[_0xe004('0x59')][_0xe004('0x8b')]!=_0x1a3289[_0xe004('0x59')][_0xe004('0x90')]){_0x2f6f2c[_0xe004('0x8b')]=_0x1a3289[_0xe004('0x59')][_0xe004('0x90')];}return _0x35b0b6[_0xe004('0x61')](_0x2f6f2c);}else{return _0x35b0b6;}}})['then'](function(_0x558c3b){_0x34b2b0[_0xe004('0x91')]=_0x558c3b['get']({'plain':!![]});_0x34b2b0[_0xe004('0x91')][_0xe004('0x92')]=_0xc3f864;if(_0x34b2b0['interaction'][_0xe004('0x92')]){if(_0x34b2b0['account'][_0xe004('0x93')]){_0x34b2b0[_0xe004('0x94')][_0xe004('0x95')]({'id':0x0,'priority':_0x34b2b0[_0xe004('0x94')]['length']+0x1,'app':_0xe004('0x96'),'appdata':_0xe004('0x97'),'interval':_0xe004('0x98')});}}return db['OpenchannelMessage']['create']({'body':_0x1a3289[_0xe004('0x59')]['body'],'OpenchannelAccountId':_0x1a3289[_0xe004('0x62')]['id'],'OpenchannelInteractionId':_0x558c3b['id'],'direction':'in','ContactId':_0x34b2b0['contact']['id'],'AttachmentId':_0x1a3289[_0xe004('0x59')][_0xe004('0x99')]});})[_0xe004('0x21')](function(_0x3a6cb0){_0x34b2b0[_0xe004('0x26')]=_0x3a6cb0;if(_0x34b2b0[_0xe004('0x91')][_0xe004('0x9a')]){return db[_0xe004('0x9b')][_0xe004('0x57')]({'attributes':['id',_0xe004('0x36')],'where':{'id':_0x34b2b0['interaction'][_0xe004('0x9a')]}})['then'](function(_0x38e735){if(_0x38e735){_0x34b2b0[_0xe004('0x94')][_0xe004('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x38e735[_0xe004('0x36')]+','+(_0x34b2b0[_0xe004('0x88')][_0xe004('0x9d')]||0xa),'interval':_0xe004('0x98')});_0x34b2b0['forcedOwnership']=![];}return respondWithRpcPromise(_0xe004('0x9e'),_0xe004('0x9f'),_0x34b2b0);});}return respondWithRpcPromise(_0xe004('0x9e'),_0xe004('0x9f'),_0x34b2b0);})[_0xe004('0x21')](function(_0x1fd0c7){respondWithRpcPromise(_0xe004('0xa0'),'EventManager',{'event':_0xe004('0x70'),'message':_0x1fd0c7},client9002);return _0x1fd0c7;})[_0xe004('0x21')](respondWithResult(_0x55bcc5,null))[_0xe004('0x29')](handleError(_0x55bcc5,null));};exports[_0xe004('0xa1')]=function(_0x3dc6d0,_0x9a5e7e){var _0x41c7e6=_0x3dc6d0[_0xe004('0x62')]['id'];var _0x20b072=_0x3dc6d0[_0xe004('0x59')];var _0x1a933f=0xc8;var _0x3a0cd6=null;return db['sequelize'][_0xe004('0xa2')]({'isolationLevel':db[_0xe004('0xa3')]['Transaction']['ISOLATION_LEVELS'][_0xe004('0xa4')]},function(_0xc5758){return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x41c7e6},'transaction':_0xc5758})[_0xe004('0x21')](function(_0x585dca){if(_0x585dca){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x41c7e6},'transaction':_0xc5758})[_0xe004('0x21')](function(){var _0x1f72b8=_[_0xe004('0x3a')](_0x20b072,function(_0x281b70){_0x281b70[_0xe004('0x65')]=_0x41c7e6;return _0x281b70;});return db[_0xe004('0x83')]['bulkCreate'](_0x1f72b8,{'transaction':_0xc5758});});}else{_0x1a933f=0x194;_0x3a0cd6=[];}});})[_0xe004('0x21')](function(){if(_0x1a933f!==0x194){return db[_0xe004('0x83')][_0xe004('0xa5')]({'where':{'OpenchannelAccountId':_0x41c7e6},'order':_0xe004('0x87')})[_0xe004('0x21')](function(_0x3ea879){_0x3a0cd6=_0x3ea879;});}})[_0xe004('0x29')](function(_0x158fed){_0x1a933f=0x1f4;logger['error'](_0x158fed[_0xe004('0xa6')]);if(_0x158fed[_0xe004('0x36')]){delete _0x158fed[_0xe004('0x36')];}_0x3a0cd6=_0x158fed;})[_0xe004('0xa7')](function(){if(_0x3a0cd6===null){_0x9a5e7e['sendStatus'](_0x1a933f);}else{if(_0x1a933f===0x1f4){_0x9a5e7e[_0xe004('0x2a')](_0x1a933f)['send'](_0x3a0cd6);}else{_0x9a5e7e[_0xe004('0x2a')](_0x1a933f)[_0xe004('0x2b')](_0x3a0cd6);}}});};exports[_0xe004('0xa8')]=function(_0x5d59f9,_0x3e1ea3,_0x1e9ac3){var _0x218bc0={};var _0x143db3={};var _0x36e8af;var _0x42dfb8;return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x5d59f9['params']['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x3e1ea3,null))[_0xe004('0x21')](function(_0x1394c8){if(_0x1394c8){_0x36e8af=_0x1394c8;_0x143db3['model']=_[_0xe004('0x42')](db['OpenchannelApplication'][_0xe004('0x3c')]);_0x143db3[_0xe004('0x41')]=_[_0xe004('0x42')](_0x5d59f9['query']);_0x143db3[_0xe004('0x43')]=_[_0xe004('0x44')](_0x143db3[_0xe004('0x40')],_0x143db3[_0xe004('0x41')]);_0x218bc0[_0xe004('0x45')]=_[_0xe004('0x44')](_0x143db3[_0xe004('0x40')],qs[_0xe004('0x46')](_0x5d59f9[_0xe004('0x41')][_0xe004('0x46')]));_0x218bc0[_0xe004('0x45')]=_0x218bc0['attributes'][_0xe004('0x56')]?_0x218bc0[_0xe004('0x45')]:_0x143db3[_0xe004('0x40')];_0x218bc0['order']=qs[_0xe004('0x4a')](_0x5d59f9['query'][_0xe004('0x4a')]);_0x218bc0[_0xe004('0x4b')]=qs[_0xe004('0x43')](_[_0xe004('0x69')](_0x5d59f9[_0xe004('0x41')],_0x143db3['filters']));if(_0x5d59f9[_0xe004('0x41')][_0xe004('0x4d')]){_0x218bc0[_0xe004('0x4b')]=_[_0xe004('0x4c')](_0x218bc0[_0xe004('0x4b')],{'$or':_[_0xe004('0x3a')](_0x218bc0[_0xe004('0x45')],function(_0x525b81){var _0x3a7ea7={};_0x3a7ea7[_0x525b81]={'$like':'%'+_0x5d59f9[_0xe004('0x41')][_0xe004('0x4d')]+'%'};return _0x3a7ea7;})});}_0x218bc0=_[_0xe004('0x4c')]({},_0x218bc0,_0x5d59f9[_0xe004('0x4e')]);return _0x36e8af[_0xe004('0xa8')](_0x218bc0);}})[_0xe004('0x21')](function(_0x4e4830){if(_0x4e4830){_0x42dfb8=_0x4e4830[_0xe004('0x56')];if(!_0x5d59f9[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x218bc0[_0xe004('0x2e')]=qs['limit'](_0x5d59f9[_0xe004('0x41')][_0xe004('0x2e')]);_0x218bc0[_0xe004('0x2c')]=qs[_0xe004('0x2c')](_0x5d59f9['query'][_0xe004('0x2c')]);}return _0x36e8af['getApplications'](_0x218bc0);}})[_0xe004('0x21')](function(_0x31cc50){if(_0x31cc50){return _0x31cc50?{'count':_0x42dfb8,'rows':_0x31cc50}:null;}})[_0xe004('0x21')](respondWithResult(_0x3e1ea3,null))[_0xe004('0x29')](handleError(_0x3e1ea3,null));};exports['getInteractions']=function(_0x88422a,_0x242e64,_0x95b577){var _0x1a2f01={'raw':![],'where':{}};var _0x17673b={};var _0x2ca81e={'count':0x0,'rows':[]};return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x88422a[_0xe004('0x62')]['id']}})['then'](handleEntityNotFound(_0x242e64,null))[_0xe004('0x21')](function(_0x168911){if(_0x168911){_0x17673b[_0xe004('0x40')]=_[_0xe004('0x42')](db[_0xe004('0x8c')][_0xe004('0x3c')]);_0x17673b[_0xe004('0x41')]=_[_0xe004('0x42')](_0x88422a[_0xe004('0x41')]);_0x17673b[_0xe004('0x43')]=_[_0xe004('0x44')](_0x17673b['model'],_0x17673b[_0xe004('0x41')]);_0x1a2f01[_0xe004('0x45')]=_[_0xe004('0x44')](_0x17673b[_0xe004('0x40')],qs['fields'](_0x88422a['query']['fields']));_0x1a2f01[_0xe004('0x45')]=_0x1a2f01[_0xe004('0x45')][_0xe004('0x56')]?_0x1a2f01[_0xe004('0x45')]:_0x17673b[_0xe004('0x40')];if(!_0x88422a[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x1a2f01[_0xe004('0x2e')]=qs[_0xe004('0x2e')](_0x88422a['query'][_0xe004('0x2e')]);_0x1a2f01[_0xe004('0x2c')]=qs[_0xe004('0x2c')](_0x88422a['query']['offset']);}_0x1a2f01[_0xe004('0x49')]=qs[_0xe004('0x4a')](_0x88422a[_0xe004('0x41')][_0xe004('0x4a')]);_0x1a2f01[_0xe004('0x4b')]=qs[_0xe004('0x43')](_[_0xe004('0x69')](_0x88422a[_0xe004('0x41')],_0x17673b['filters']));_0x1a2f01['where'][_0xe004('0x65')]=_0x168911['id'];if(_0x88422a[_0xe004('0x41')][_0xe004('0x4d')]){_0x1a2f01['where']=_[_0xe004('0x4c')](_0x1a2f01['where'],{'$or':_[_0xe004('0x3a')](_0x1a2f01[_0xe004('0x45')],function(_0x29e913){var _0x444332={};_0x444332[_0x29e913]={'$like':'%'+_0x88422a[_0xe004('0x41')][_0xe004('0x4d')]+'%'};return _0x444332;})});}_0x1a2f01=_[_0xe004('0x4c')]({},_0x1a2f01,_0x88422a[_0xe004('0x4e')]);return db['OpenchannelInteraction'][_0xe004('0x4f')]({'where':_0x1a2f01[_0xe004('0x4b')]})[_0xe004('0x21')](function(_0x28691e){_0x2ca81e[_0xe004('0x4f')]=_0x28691e;if(_0x88422a[_0xe004('0x41')]['includeAll']){_0x1a2f01[_0xe004('0x51')]=[{'model':db[_0xe004('0x72')],'as':'Contact','required':![]},{'model':db[_0xe004('0x9b')],'as':_0xe004('0xa9'),'attributes':[_0xe004('0x36'),_0xe004('0xaa'),_0xe004('0xab')],'required':![]},{'model':db[_0xe004('0xac')],'as':_0xe004('0xad'),'attributes':['id',_0xe004('0x36'),_0xe004('0xae')],'where':_0x88422a[_0xe004('0x41')][_0xe004('0xaf')]?{'id':_0x88422a['query'][_0xe004('0xaf')]}:undefined,'required':_0x88422a[_0xe004('0x41')][_0xe004('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xe004('0x52')](_0x1a2f01);})[_0xe004('0x21')](function(_0x4409be){_0x2ca81e[_0xe004('0x53')]=_0x4409be;return _0x2ca81e;});}})[_0xe004('0x21')](respondWithFilteredResult(_0x242e64,_0x1a2f01))[_0xe004('0x29')](handleError(_0x242e64,null));};exports['addAgents']=function(_0x59973e,_0x2018cc,_0x4f96a5){return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x59973e[_0xe004('0x62')]['id']}})['then'](handleEntityNotFound(_0x2018cc,null))[_0xe004('0x21')](function(_0x59676a){if(_0x59676a){return _0x59676a[_0xe004('0xb0')](_0x59973e[_0xe004('0x59')]['ids'],_[_0xe004('0xb1')](_0x59973e['body'],[_0xe004('0x6b'),'id'])||{})[_0xe004('0xb2')](function(_0xe0e1ba){for(var _0x27f1f8=0x0;_0x27f1f8<_0x59973e[_0xe004('0x59')]['ids']['length'];_0x27f1f8+=0x1){socket[_0xe004('0xb3')](_0xe004('0xb4'),{'UserId':Number(_0x59973e['body']['ids'][_0x27f1f8]),'OpenchannelAccountId':Number(_0x59973e[_0xe004('0x62')]['id'])});}return _0xe0e1ba;});}})[_0xe004('0x21')](respondWithResult(_0x2018cc,null))[_0xe004('0x29')](handleError(_0x2018cc,null));};exports[_0xe004('0xb5')]=function(_0x520c7e,_0x47c53e,_0x9c83fb){return db[_0xe004('0x3b')][_0xe004('0x57')]({'where':{'id':_0x520c7e[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x47c53e,null))[_0xe004('0x21')](function(_0x5b1359){if(_0x5b1359){return _0x5b1359[_0xe004('0xb5')](_0x520c7e[_0xe004('0x41')][_0xe004('0x6b')])[_0xe004('0x21')](function(){if(_[_0xe004('0xb6')](_0x520c7e[_0xe004('0x41')][_0xe004('0x6b')])){for(var _0x18acf0=0x0;_0x18acf0<_0x520c7e[_0xe004('0x41')]['ids']['length'];_0x18acf0+=0x1){socket[_0xe004('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x520c7e['query']['ids'][_0x18acf0]),'OpenchannelAccountId':Number(_0x520c7e[_0xe004('0x62')]['id'])});}}else{socket[_0xe004('0xb3')](_0xe004('0xb7'),{'UserId':Number(_0x520c7e[_0xe004('0x41')][_0xe004('0x6b')]),'OpenchannelAccountId':Number(_0x520c7e[_0xe004('0x62')]['id'])});}});}})[_0xe004('0x21')](respondWithStatusCode(_0x47c53e,null))['catch'](handleError(_0x47c53e,null));};exports[_0xe004('0xb8')]=function(_0x246d70,_0x36de44,_0xd1c1){var _0x2e5b19={};var _0x3139f1={};var _0x41d896;var _0x514aa0;return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x246d70[_0xe004('0x62')]['id']}})['then'](handleEntityNotFound(_0x36de44,null))[_0xe004('0x21')](function(_0x4b82a9){if(_0x4b82a9){_0x41d896=_0x4b82a9;_0x3139f1['model']=_[_0xe004('0x42')](db[_0xe004('0x9b')][_0xe004('0x3c')]);_0x3139f1[_0xe004('0x41')]=_[_0xe004('0x42')](_0x246d70[_0xe004('0x41')]);_0x3139f1[_0xe004('0x43')]=_[_0xe004('0x44')](_0x3139f1[_0xe004('0x40')],_0x3139f1[_0xe004('0x41')]);_0x2e5b19[_0xe004('0x45')]=_[_0xe004('0x44')](_0x3139f1[_0xe004('0x40')],qs['fields'](_0x246d70[_0xe004('0x41')]['fields']));_0x2e5b19[_0xe004('0x45')]=_0x2e5b19[_0xe004('0x45')][_0xe004('0x56')]?_0x2e5b19[_0xe004('0x45')]:_0x3139f1[_0xe004('0x40')];_0x2e5b19[_0xe004('0x49')]=qs['sort'](_0x246d70['query'][_0xe004('0x4a')]);_0x2e5b19['where']=qs['filters'](_[_0xe004('0x69')](_0x246d70['query'],_0x3139f1[_0xe004('0x43')]));if(_0x246d70[_0xe004('0x41')][_0xe004('0x4d')]){_0x2e5b19[_0xe004('0x4b')]=_[_0xe004('0x4c')](_0x2e5b19['where'],{'$or':_[_0xe004('0x3a')](_0x2e5b19['attributes'],function(_0x344243){var _0x17b56b={};_0x17b56b[_0x344243]={'$like':'%'+_0x246d70[_0xe004('0x41')][_0xe004('0x4d')]+'%'};return _0x17b56b;})});}_0x2e5b19=_['merge']({},_0x2e5b19,_0x246d70[_0xe004('0x4e')]);return _0x41d896[_0xe004('0xb8')](_0x2e5b19);}})[_0xe004('0x21')](function(_0xaa2ed1){if(_0xaa2ed1){_0x514aa0=_0xaa2ed1[_0xe004('0x56')];if(!_0x246d70[_0xe004('0x41')][_0xe004('0x47')](_0xe004('0x48'))){_0x2e5b19[_0xe004('0x2e')]=qs[_0xe004('0x2e')](_0x246d70[_0xe004('0x41')][_0xe004('0x2e')]);_0x2e5b19['offset']=qs['offset'](_0x246d70['query'][_0xe004('0x2c')]);}return _0x41d896[_0xe004('0xb8')](_0x2e5b19);}})[_0xe004('0x21')](function(_0x49f548){if(_0x49f548){return _0x49f548?{'count':_0x514aa0,'rows':_0x49f548}:null;}})[_0xe004('0x21')](respondWithResult(_0x36de44,null))[_0xe004('0x29')](handleError(_0x36de44,null));};exports[_0xe004('0x37')]=function(_0x37798f,_0x5f9c93,_0x2b3ccb){var _0x1b2356,_0x335527,_0x1e6af6;if(_['isNil'](_0x37798f[_0xe004('0x59')][_0xe004('0x59')])||_0x37798f[_0xe004('0x59')][_0xe004('0x59')]===''){throw new db[(_0xe004('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x37798f[_0xe004('0x59')]['to'])){}_0x1b2356=_0x37798f['body']['to'];return db[_0xe004('0x3b')][_0xe004('0x68')]({'where':{'id':_0x37798f[_0xe004('0x62')]['id']}})[_0xe004('0x21')](handleEntityNotFound(_0x5f9c93,null))['then'](function(_0x481c3e){if(_0x481c3e){return db[_0xe004('0x3b')]['find']({'where':{'id':_0x481c3e['id']},'include':[{'model':db[_0xe004('0x80')],'as':_0xe004('0x85'),'include':[{'model':db[_0xe004('0x72')],'as':_0xe004('0x81'),'where':{[_0x481c3e['mapKey']]:_0x1b2356},'limit':0x1,'order':[['updatedAt',_0xe004('0x82')]]}]}]})[_0xe004('0x21')](handleEntityNotFound(_0x5f9c93,null))[_0xe004('0x21')](function(_0x545a41){if(_0x545a41&&_0x545a41[_0xe004('0x85')]){_0x335527=_0x545a41[_0xe004('0x5d')]({'plain':!![]});if(_0x335527[_0xe004('0x85')]&&_0x335527[_0xe004('0x85')][_0xe004('0x81')][_0xe004('0x56')]){return _0x335527['List'][_0xe004('0x81')][0x0];}return db[_0xe004('0x72')][_0xe004('0x58')](_[_0xe004('0x1a')](_0x37798f[_0xe004('0x59')],{'firstName':_0x1b2356,[_0x545a41['mapKey']]:_0x1b2356,'phone':_0x1b2356,'ListId':_0x335527[_0xe004('0x78')]}));}})[_0xe004('0x21')](handleEntityNotFound(_0x5f9c93,null))[_0xe004('0x21')](function(_0x57520f){if(_0x57520f){_0x1e6af6=_0x57520f;return db[_0xe004('0x8c')]['find']({'where':{'ContactId':_0x1e6af6['id'],'closed':![],'OpenchannelAccountId':_0x335527['id']}})[_0xe004('0x21')](function(_0x52575c){if(_0x52575c){return[_0x52575c,![]];}return db[_0xe004('0x8c')][_0xe004('0x58')]({'UserId':_0x37798f[_0xe004('0x5a')]['id'],'ContactId':_0x1e6af6['id'],'OpenchannelAccountId':_0x335527['id'],'lastMsgDirection':_0xe004('0xb9'),'Messages':[_['merge'](_0x37798f[_0xe004('0x59')],{'read':![],'body':_0x37798f[_0xe004('0x59')][_0xe004('0x59')],'OpenchannelAccountId':_0x335527['id'],'UserId':_0x37798f[_0xe004('0x5a')]['id'],'ContactId':_0x1e6af6['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xe004('0x21')](function(_0x5ab5f5){return[_0x5ab5f5,!![]];});});}})[_0xe004('0xb2')](function(_0x3afe05,_0x46ee17){if(_0x46ee17){return _0x3afe05;}return db['OpenchannelMessage']['create'](_[_0xe004('0x4c')](_0x37798f['body'],{'read':![],'body':_0x37798f[_0xe004('0x59')][_0xe004('0x59')],'OpenchannelAccountId':_0x335527['id'],'OpenchannelInteractionId':_0x3afe05['id'],'UserId':_0x37798f[_0xe004('0x5a')]['id'],'ContactId':_0x1e6af6['id']}))[_0xe004('0x21')](function(_0x5db7af){_0x3afe05[_0xe004('0xba')][_0xe004('0xbb')]=[];_0x3afe05[_0xe004('0xba')][_0xe004('0xbb')][_0xe004('0x95')](_0x5db7af[_0xe004('0xba')]);return _0x3afe05;});});}})[_0xe004('0x21')](respondWithResult(_0x5f9c93,null))['catch'](handleError(_0x5f9c93,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index fca9449..dfd12cb 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0xb688,0xcf));var _0x8b68=function(_0x4c5d91,_0x3653c7){_0x4c5d91=_0x4c5d91-0x0;var _0x1cfbf2=_0xb688[_0x4c5d91];return _0x1cfbf2;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91a7,0xe7));var _0x791a=function(_0x13f7eb,_0x5d93f5){_0x13f7eb=_0x13f7eb-0x0;var _0x333ff8=_0x91a7[_0x13f7eb];return _0x333ff8;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5a73594..1475a0c 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(_0x47605f,_0x16045a){var _0x43ebdc=function(_0x392734){while(--_0x392734){_0x47605f['push'](_0x47605f['shift']());}};_0x43ebdc(++_0x16045a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xd18f81,_0xf905d7){var _0x1219fd=function(_0x45ce8c){while(--_0x45ce8c){_0xd18f81['push'](_0xd18f81['shift']());}};_0x1219fd(++_0xf905d7);}(_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 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 ad4ad90..e5ea4c7 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 _0xa699=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa699,0x6b));var _0x9a69=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0xa699[_0x5af59e];return _0x4240df;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});config[_0x9a69('0xd')]=_[_0x9a69('0xe')](config[_0x9a69('0xd')],{'host':_0x9a69('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a69('0xd')]));require(_0x9a69('0x10'))[_0x9a69('0x11')](socket);function respondWithRpcPromise(_0x1ee4e3,_0x43d2f2,_0x58b59e){return new BPromise(function(_0x47cc82,_0x1562e2){return client['request'](_0x1ee4e3,_0x58b59e)[_0x9a69('0x12')](function(_0x5016b2){logger['info'](_0x9a69('0x13'),_0x43d2f2,_0x9a69('0x14'));logger['debug'](_0x9a69('0x15'),_0x43d2f2,_0x9a69('0x14'),JSON[_0x9a69('0x16')](_0x5016b2));if(_0x5016b2[_0x9a69('0x17')]){if(_0x5016b2[_0x9a69('0x17')][_0x9a69('0x18')]===0x1f4){logger[_0x9a69('0x17')](_0x9a69('0x13'),_0x43d2f2,_0x5016b2[_0x9a69('0x17')]['message']);return _0x1562e2(_0x5016b2[_0x9a69('0x17')][_0x9a69('0x19')]);}logger[_0x9a69('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x43d2f2,_0x5016b2[_0x9a69('0x17')][_0x9a69('0x19')]);return _0x47cc82(_0x5016b2[_0x9a69('0x17')][_0x9a69('0x19')]);}else{logger[_0x9a69('0x1a')]('OpenchannelAccount,\x20%s,\x20%s',_0x43d2f2,_0x9a69('0x14'));_0x47cc82(_0x5016b2[_0x9a69('0x1b')][_0x9a69('0x19')]);}})[_0x9a69('0x1c')](function(_0x3a09c8){logger[_0x9a69('0x17')](_0x9a69('0x13'),_0x43d2f2,_0x3a09c8);_0x1562e2(_0x3a09c8);});});} \ No newline at end of file +var _0x6215=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x55347a,_0x176683){var _0x5f13f4=function(_0x522a9b){while(--_0x522a9b){_0x55347a['push'](_0x55347a['shift']());}};_0x5f13f4(++_0x176683);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5621('0x9')]=_[_0x5621('0xa')](config[_0x5621('0x9')],{'host':_0x5621('0xb'),'port':0x18eb});var socket=require(_0x5621('0xc'))(new Redis(config['redis']));require(_0x5621('0xd'))[_0x5621('0xe')](socket);function respondWithRpcPromise(_0x3aa022,_0x418114,_0x53625c){return new BPromise(function(_0x1f4148,_0x10bb32){return client[_0x5621('0xf')](_0x3aa022,_0x53625c)['then'](function(_0x2b0f51){logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));logger[_0x5621('0x13')](_0x5621('0x14'),_0x418114,_0x5621('0x12'),JSON[_0x5621('0x15')](_0x2b0f51));if(_0x2b0f51[_0x5621('0x16')]){if(_0x2b0f51[_0x5621('0x16')]['code']===0x1f4){logger[_0x5621('0x16')](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')]['message']);return _0x10bb32(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}logger['error'](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);return _0x1f4148(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}else{logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));_0x1f4148(_0x2b0f51[_0x5621('0x18')][_0x5621('0x17')]);}})['catch'](function(_0x1111b2){logger[_0x5621('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x418114,_0x1111b2);_0x10bb32(_0x1111b2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 039ab74..3720764 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 _0x20ce=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x20ce,0x10d));var _0xe20c=function(_0x11e63e,_0x31cddc){_0x11e63e=_0x11e63e-0x0;var _0x199c33=_0x20ce[_0x11e63e];return _0x199c33;};'use strict';var OpenchannelAccountEvents=require(_0xe20c('0x0'));var events=[_0xe20c('0x1'),_0xe20c('0x2'),'update'];function createListener(_0x377a74,_0x34b536){return function(_0x213486){_0x34b536[_0xe20c('0x3')](_0x377a74,_0x213486);};}function removeListener(_0x7e5160,_0x23f743){return function(){OpenchannelAccountEvents[_0xe20c('0x4')](_0x7e5160,_0x23f743);};}exports[_0xe20c('0x5')]=function(_0x373f9f){for(var _0x2c9e6a=0x0,_0x893e48=events[_0xe20c('0x6')];_0x2c9e6a<_0x893e48;_0x2c9e6a++){var _0x2d88b5=events[_0x2c9e6a];var _0x8f79ad=createListener(_0xe20c('0x7')+_0x2d88b5,_0x373f9f);OpenchannelAccountEvents['on'](_0x2d88b5,_0x8f79ad);}}; \ No newline at end of file +var _0x2557=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x2557,0x11e));var _0x7255=function(_0x11fc0b,_0x49a057){_0x11fc0b=_0x11fc0b-0x0;var _0x4bcc44=_0x2557[_0x11fc0b];return _0x4bcc44;};'use strict';var OpenchannelAccountEvents=require(_0x7255('0x0'));var events=['save',_0x7255('0x1'),_0x7255('0x2')];function createListener(_0xbf1375,_0x1d8176){return function(_0x1db25c){_0x1d8176[_0x7255('0x3')](_0xbf1375,_0x1db25c);};}function removeListener(_0x5994ca,_0x4fc880){return function(){OpenchannelAccountEvents['removeListener'](_0x5994ca,_0x4fc880);};}exports[_0x7255('0x4')]=function(_0x937dce){for(var _0x46c30e=0x0,_0x841417=events[_0x7255('0x5')];_0x46c30e<_0x841417;_0x46c30e++){var _0x2142a5=events[_0x46c30e];var _0x5b6aa4=createListener(_0x7255('0x6')+_0x2142a5,_0x937dce);OpenchannelAccountEvents['on'](_0x2142a5,_0x5b6aa4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index dc3b4f5..6cfe9fe 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 _0xcc90=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../config/environment','./openchannelApplication.controller'];(function(_0x2a393e,_0x4d36c2){var _0x357b59=function(_0x19a9f6){while(--_0x19a9f6){_0x2a393e['push'](_0x2a393e['shift']());}};_0x357b59(++_0x4d36c2);}(_0xcc90,0x197));var _0x0cc9=function(_0x38449e,_0x40c932){_0x38449e=_0x38449e-0x0;var _0x20c763=_0xcc90[_0x38449e];return _0x20c763;};'use strict';var multer=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var path=require(_0x0cc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cc9('0x3'));var router=express[_0x0cc9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cc9('0x5'));var controller=require(_0x0cc9('0x6'));router[_0x0cc9('0x7')]('/',auth[_0x0cc9('0x8')](),controller[_0x0cc9('0x9')]);router[_0x0cc9('0x7')](_0x0cc9('0xa'),auth['isAuthenticated'](),controller[_0x0cc9('0xb')]);router[_0x0cc9('0xc')]('/',auth[_0x0cc9('0x8')](),controller[_0x0cc9('0xd')]);router[_0x0cc9('0xe')](_0x0cc9('0xa'),auth[_0x0cc9('0x8')](),controller[_0x0cc9('0xf')]);router['delete']('/:id',auth[_0x0cc9('0x8')](),controller[_0x0cc9('0x10')]);module[_0x0cc9('0x11')]=router; \ No newline at end of file +var _0x0bb6=['index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x5d15fa,_0x4ba736){var _0x250e01=function(_0x432d79){while(--_0x432d79){_0x5d15fa['push'](_0x5d15fa['shift']());}};_0x250e01(++_0x4ba736);}(_0x0bb6,0x1ac));var _0x60bb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0bb6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x60bb('0x0'));var util=require(_0x60bb('0x1'));var path=require(_0x60bb('0x2'));var timeout=require(_0x60bb('0x3'));var express=require(_0x60bb('0x4'));var router=express[_0x60bb('0x5')]();var fs_extra=require(_0x60bb('0x6'));var auth=require(_0x60bb('0x7'));var interaction=require(_0x60bb('0x8'));var config=require('../../config/environment');var controller=require(_0x60bb('0x9'));router[_0x60bb('0xa')]('/',auth[_0x60bb('0xb')](),controller[_0x60bb('0xc')]);router['get'](_0x60bb('0xd'),auth[_0x60bb('0xb')](),controller['show']);router[_0x60bb('0xe')]('/',auth['isAuthenticated'](),controller[_0x60bb('0xf')]);router[_0x60bb('0x10')](_0x60bb('0xd'),auth[_0x60bb('0xb')](),controller[_0x60bb('0x11')]);router[_0x60bb('0x12')]('/:id',auth[_0x60bb('0xb')](),controller[_0x60bb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e16bdba..ed24439 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 _0x4d4f=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x4d4f,0x159));var _0xf4d4=function(_0x2f31bf,_0x1cab6f){_0x2f31bf=_0x2f31bf-0x0;var _0x39362b=_0x4d4f[_0x2f31bf];return _0x39362b;};'use strict';var Sequelize=require(_0xf4d4('0x0'));module[_0xf4d4('0x1')]={'priority':{'type':Sequelize[_0xf4d4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf4d4('0x3')],'allowNull':![],'defaultValue':_0xf4d4('0x4')},'appdata':{'type':Sequelize[_0xf4d4('0x5')]()},'description':{'type':Sequelize[_0xf4d4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf4d4('0x6')}}; \ No newline at end of file +var _0xc861=['TEXT','STRING','*,*,*,*','noop'];(function(_0x56103b,_0x3a38ec){var _0x3cb4d9=function(_0x65ddc0){while(--_0x65ddc0){_0x56103b['push'](_0x56103b['shift']());}};_0x3cb4d9(++_0x3a38ec);}(_0xc861,0xe7));var _0x1c86=function(_0x3ddfbb,_0x1fd4e8){_0x3ddfbb=_0x3ddfbb-0x0;var _0x437488=_0xc861[_0x3ddfbb];return _0x437488;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c86('0x0')},'appdata':{'type':Sequelize[_0x1c86('0x1')]()},'description':{'type':Sequelize[_0x1c86('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1c86('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ab840e1..336a2e7 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 _0x3a83=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x3a83,0x92));var _0x33a8=function(_0x23be68,_0x5db403){_0x23be68=_0x23be68-0x0;var _0x4641c5=_0x3a83[_0x23be68];return _0x4641c5;};'use strict';var emlformat=require(_0x33a8('0x0'));var rimraf=require(_0x33a8('0x1'));var zipdir=require(_0x33a8('0x2'));var jsonpatch=require(_0x33a8('0x3'));var rp=require(_0x33a8('0x4'));var moment=require(_0x33a8('0x5'));var BPromise=require(_0x33a8('0x6'));var Mustache=require(_0x33a8('0x7'));var util=require('util');var path=require('path');var sox=require(_0x33a8('0x8'));var csv=require(_0x33a8('0x9'));var ejs=require(_0x33a8('0xa'));var fs=require('fs');var fs_extra=require(_0x33a8('0xb'));var _=require(_0x33a8('0xc'));var squel=require(_0x33a8('0xd'));var crypto=require(_0x33a8('0xe'));var jsforce=require(_0x33a8('0xf'));var deskjs=require(_0x33a8('0x10'));var toCsv=require(_0x33a8('0x9'));var querystring=require('querystring');var Papa=require(_0x33a8('0x11'));var Redis=require('ioredis');var authService=require(_0x33a8('0x12'));var qs=require(_0x33a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33a8('0x14'));var logger=require(_0x33a8('0x15'))(_0x33a8('0x16'));var utils=require('../../config/utils');var config=require(_0x33a8('0x17'));var licenseUtil=require(_0x33a8('0x18'));var db=require(_0x33a8('0x19'))['db'];function respondWithStatusCode(_0x1f232f,_0x35dad5){_0x35dad5=_0x35dad5||0xcc;return function(_0x533790){if(_0x533790){return _0x1f232f[_0x33a8('0x1a')](_0x35dad5);}return _0x1f232f[_0x33a8('0x1b')](_0x35dad5)[_0x33a8('0x1c')]();};}function respondWithResult(_0x20836b,_0x52774a){_0x52774a=_0x52774a||0xc8;return function(_0x1da203){if(_0x1da203){return _0x20836b[_0x33a8('0x1b')](_0x52774a)[_0x33a8('0x1d')](_0x1da203);}};}function respondWithFilteredResult(_0x1772de,_0x315ed8){return function(_0x21022d){if(_0x21022d){var _0x2d8469=typeof _0x315ed8[_0x33a8('0x1e')]===_0x33a8('0x1f')&&typeof _0x315ed8[_0x33a8('0x20')]===_0x33a8('0x1f');var _0x56dd47=_0x21022d[_0x33a8('0x21')];var _0x5e93c2=_0x2d8469?0x0:_0x315ed8['offset'];var _0x118584=_0x2d8469?_0x21022d[_0x33a8('0x21')]:_0x315ed8[_0x33a8('0x1e')]+_0x315ed8[_0x33a8('0x20')];var _0x47f5ef;if(_0x118584>=_0x56dd47){_0x118584=_0x56dd47;_0x47f5ef=0xc8;}else{_0x47f5ef=0xce;}_0x1772de[_0x33a8('0x1b')](_0x47f5ef);return _0x1772de[_0x33a8('0x22')](_0x33a8('0x23'),_0x5e93c2+'-'+_0x118584+'/'+_0x56dd47)[_0x33a8('0x1d')](_0x21022d);}return null;};}function patchUpdates(_0x1a3c70){return function(_0x57ca22){try{jsonpatch['apply'](_0x57ca22,_0x1a3c70,!![]);}catch(_0x589831){return BPromise[_0x33a8('0x24')](_0x589831);}return _0x57ca22[_0x33a8('0x25')]();};}function saveUpdates(_0xac51f4,_0x2110ec){return function(_0x11ce61){if(_0x11ce61){return _0x11ce61[_0x33a8('0x26')](_0xac51f4)['then'](function(_0xdb85c2){return _0xdb85c2;});}return null;};}function removeEntity(_0x6f2a43,_0x14b49c){return function(_0xd633d5){if(_0xd633d5){return _0xd633d5['destroy']()[_0x33a8('0x27')](function(){_0x6f2a43[_0x33a8('0x1b')](0xcc)[_0x33a8('0x1c')]();});}};}function handleEntityNotFound(_0x5bc0b2,_0x5b0fca){return function(_0x5847f5){if(!_0x5847f5){_0x5bc0b2['sendStatus'](0x194);}return _0x5847f5;};}function handleError(_0x4bc62d,_0x1ec01a){_0x1ec01a=_0x1ec01a||0x1f4;return function(_0x16c418){logger[_0x33a8('0x28')](_0x16c418[_0x33a8('0x29')]);if(_0x16c418['name']){delete _0x16c418[_0x33a8('0x2a')];}_0x4bc62d['status'](_0x1ec01a)[_0x33a8('0x2b')](_0x16c418);};}exports['index']=function(_0x4de17d,_0x1e5af5){var _0x354769={},_0x2fcdca={},_0x407679={'count':0x0,'rows':[]};var _0x7b6187=_[_0x33a8('0x2c')](db[_0x33a8('0x2d')][_0x33a8('0x2e')],function(_0xdfbf9b){return{'name':_0xdfbf9b[_0x33a8('0x2f')],'type':_0xdfbf9b[_0x33a8('0x30')][_0x33a8('0x31')]};});_0x2fcdca['model']=_[_0x33a8('0x2c')](_0x7b6187,_0x33a8('0x2a'));_0x2fcdca[_0x33a8('0x32')]=_['keys'](_0x4de17d['query']);_0x2fcdca[_0x33a8('0x33')]=_['intersection'](_0x2fcdca['model'],_0x2fcdca[_0x33a8('0x32')]);_0x354769[_0x33a8('0x34')]=_[_0x33a8('0x35')](_0x2fcdca[_0x33a8('0x36')],qs['fields'](_0x4de17d['query'][_0x33a8('0x37')]));_0x354769[_0x33a8('0x34')]=_0x354769[_0x33a8('0x34')][_0x33a8('0x38')]?_0x354769['attributes']:_0x2fcdca[_0x33a8('0x36')];if(!_0x4de17d[_0x33a8('0x32')][_0x33a8('0x39')]('nolimit')){_0x354769['limit']=qs[_0x33a8('0x20')](_0x4de17d['query'][_0x33a8('0x20')]);_0x354769[_0x33a8('0x1e')]=qs[_0x33a8('0x1e')](_0x4de17d[_0x33a8('0x32')][_0x33a8('0x1e')]);}_0x354769[_0x33a8('0x3a')]=qs['sort'](_0x4de17d[_0x33a8('0x32')][_0x33a8('0x3b')]);_0x354769[_0x33a8('0x3c')]=qs[_0x33a8('0x33')](_[_0x33a8('0x3d')](_0x4de17d['query'],_0x2fcdca[_0x33a8('0x33')]),_0x7b6187);if(_0x4de17d[_0x33a8('0x32')][_0x33a8('0x3e')]){_0x354769[_0x33a8('0x3c')]=_['merge'](_0x354769[_0x33a8('0x3c')],{'$or':_[_0x33a8('0x2c')](_0x7b6187,function(_0x518061){if(_0x518061[_0x33a8('0x30')]!==_0x33a8('0x3f')){var _0x1fb9a0={};_0x1fb9a0[_0x518061[_0x33a8('0x2a')]]={'$like':'%'+_0x4de17d[_0x33a8('0x32')][_0x33a8('0x3e')]+'%'};return _0x1fb9a0;}})});}_0x354769=_[_0x33a8('0x40')]({},_0x354769,_0x4de17d['options']);var _0x44fdfe={'where':_0x354769['where']};return db[_0x33a8('0x2d')][_0x33a8('0x21')](_0x44fdfe)['then'](function(_0x4c3c89){_0x407679['count']=_0x4c3c89;if(_0x4de17d[_0x33a8('0x32')][_0x33a8('0x41')]){_0x354769[_0x33a8('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x33a8('0x43')](_0x354769);})[_0x33a8('0x27')](function(_0x4d2c22){_0x407679[_0x33a8('0x44')]=_0x4d2c22;return _0x407679;})[_0x33a8('0x27')](respondWithFilteredResult(_0x1e5af5,_0x354769))[_0x33a8('0x45')](handleError(_0x1e5af5,null));};exports[_0x33a8('0x46')]=function(_0x1c641b,_0x4d9d4f){var _0x45e082={'raw':!![],'where':{'id':_0x1c641b[_0x33a8('0x47')]['id']}},_0x559d29={};_0x559d29[_0x33a8('0x36')]=_[_0x33a8('0x48')](db[_0x33a8('0x2d')]['rawAttributes']);_0x559d29[_0x33a8('0x32')]=_[_0x33a8('0x48')](_0x1c641b[_0x33a8('0x32')]);_0x559d29['filters']=_[_0x33a8('0x35')](_0x559d29['model'],_0x559d29['query']);_0x45e082[_0x33a8('0x34')]=_['intersection'](_0x559d29[_0x33a8('0x36')],qs[_0x33a8('0x37')](_0x1c641b[_0x33a8('0x32')][_0x33a8('0x37')]));_0x45e082[_0x33a8('0x34')]=_0x45e082['attributes']['length']?_0x45e082[_0x33a8('0x34')]:_0x559d29['model'];if(_0x1c641b[_0x33a8('0x32')]['includeAll']){_0x45e082['include']=[{'all':!![]}];}_0x45e082=_[_0x33a8('0x40')]({},_0x45e082,_0x1c641b[_0x33a8('0x49')]);return db['OpenchannelApplication'][_0x33a8('0x4a')](_0x45e082)[_0x33a8('0x27')](handleEntityNotFound(_0x4d9d4f,null))['then'](respondWithResult(_0x4d9d4f,null))['catch'](handleError(_0x4d9d4f,null));};exports['create']=function(_0xcd63d6,_0x24cba2){return db[_0x33a8('0x2d')][_0x33a8('0x4b')](_0xcd63d6[_0x33a8('0x4c')],{})['then'](respondWithResult(_0x24cba2,0xc9))[_0x33a8('0x45')](handleError(_0x24cba2,null));};exports['update']=function(_0x151f0c,_0x2d5271){if(_0x151f0c[_0x33a8('0x4c')]['id']){delete _0x151f0c[_0x33a8('0x4c')]['id'];}return db[_0x33a8('0x2d')][_0x33a8('0x4a')]({'where':{'id':_0x151f0c[_0x33a8('0x47')]['id']}})[_0x33a8('0x27')](handleEntityNotFound(_0x2d5271,null))['then'](saveUpdates(_0x151f0c[_0x33a8('0x4c')],null))[_0x33a8('0x27')](respondWithResult(_0x2d5271,null))[_0x33a8('0x45')](handleError(_0x2d5271,null));};exports['destroy']=function(_0x550e2a,_0x385a72){return db[_0x33a8('0x2d')][_0x33a8('0x4a')]({'where':{'id':_0x550e2a['params']['id']}})['then'](handleEntityNotFound(_0x385a72,null))[_0x33a8('0x27')](removeEntity(_0x385a72,null))[_0x33a8('0x45')](handleError(_0x385a72,null));}; \ No newline at end of file +var _0x975a=['set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','catch','show','params','keys','includeAll','find','create','body','update','destroy','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','count','limit'];(function(_0x85c92c,_0x52eb29){var _0x433a1f=function(_0x553b84){while(--_0x553b84){_0x85c92c['push'](_0x85c92c['shift']());}};_0x433a1f(++_0x52eb29);}(_0x975a,0x106));var _0xa975=function(_0x6b4a43,_0x3fbf3e){_0x6b4a43=_0x6b4a43-0x0;var _0x440d4a=_0x975a[_0x6b4a43];return _0x440d4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa975('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa975('0x1'));var BPromise=require(_0xa975('0x2'));var Mustache=require(_0xa975('0x3'));var util=require(_0xa975('0x4'));var path=require(_0xa975('0x5'));var sox=require(_0xa975('0x6'));var csv=require(_0xa975('0x7'));var ejs=require(_0xa975('0x8'));var fs=require('fs');var fs_extra=require(_0xa975('0x9'));var _=require(_0xa975('0xa'));var squel=require('squel');var crypto=require(_0xa975('0xb'));var jsforce=require(_0xa975('0xc'));var deskjs=require(_0xa975('0xd'));var toCsv=require(_0xa975('0x7'));var querystring=require(_0xa975('0xe'));var Papa=require('papaparse');var Redis=require(_0xa975('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa975('0x10'));var as=require(_0xa975('0x11'));var hardwareService=require(_0xa975('0x12'));var logger=require(_0xa975('0x13'))(_0xa975('0x14'));var utils=require(_0xa975('0x15'));var config=require(_0xa975('0x16'));var licenseUtil=require(_0xa975('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a00e0,_0x1377cd){_0x1377cd=_0x1377cd||0xcc;return function(_0x3973a8){if(_0x3973a8){return _0x4a00e0['sendStatus'](_0x1377cd);}return _0x4a00e0['status'](_0x1377cd)[_0xa975('0x18')]();};}function respondWithResult(_0x5f58d7,_0x50f920){_0x50f920=_0x50f920||0xc8;return function(_0x347850){if(_0x347850){return _0x5f58d7[_0xa975('0x19')](_0x50f920)['json'](_0x347850);}};}function respondWithFilteredResult(_0xb55a63,_0x156e47){return function(_0x78ca2b){if(_0x78ca2b){var _0x57eaa2=typeof _0x156e47[_0xa975('0x1a')]===_0xa975('0x1b')&&typeof _0x156e47['limit']===_0xa975('0x1b');var _0x48c4f2=_0x78ca2b[_0xa975('0x1c')];var _0x26fab3=_0x57eaa2?0x0:_0x156e47[_0xa975('0x1a')];var _0x123e7b=_0x57eaa2?_0x78ca2b[_0xa975('0x1c')]:_0x156e47[_0xa975('0x1a')]+_0x156e47[_0xa975('0x1d')];var _0x537e44;if(_0x123e7b>=_0x48c4f2){_0x123e7b=_0x48c4f2;_0x537e44=0xc8;}else{_0x537e44=0xce;}_0xb55a63['status'](_0x537e44);return _0xb55a63[_0xa975('0x1e')](_0xa975('0x1f'),_0x26fab3+'-'+_0x123e7b+'/'+_0x48c4f2)[_0xa975('0x20')](_0x78ca2b);}return null;};}function patchUpdates(_0x156a7e){return function(_0x74e499){try{jsonpatch[_0xa975('0x21')](_0x74e499,_0x156a7e,!![]);}catch(_0x1ad2b7){return BPromise[_0xa975('0x22')](_0x1ad2b7);}return _0x74e499['save']();};}function saveUpdates(_0x485cc8,_0x1e9232){return function(_0x59b977){if(_0x59b977){return _0x59b977['update'](_0x485cc8)[_0xa975('0x23')](function(_0x49c921){return _0x49c921;});}return null;};}function removeEntity(_0x160e4e,_0x48720d){return function(_0x235ca8){if(_0x235ca8){return _0x235ca8['destroy']()[_0xa975('0x23')](function(){_0x160e4e[_0xa975('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a68f,_0x3e3822){return function(_0x186598){if(!_0x186598){_0x23a68f['sendStatus'](0x194);}return _0x186598;};}function handleError(_0xda4b57,_0x6a71a2){_0x6a71a2=_0x6a71a2||0x1f4;return function(_0x57c9a0){logger[_0xa975('0x24')](_0x57c9a0[_0xa975('0x25')]);if(_0x57c9a0[_0xa975('0x26')]){delete _0x57c9a0[_0xa975('0x26')];}_0xda4b57[_0xa975('0x19')](_0x6a71a2)[_0xa975('0x27')](_0x57c9a0);};}exports[_0xa975('0x28')]=function(_0x323206,_0x51aff1){var _0x3e8d94={},_0x168c3b={},_0x3758fa={'count':0x0,'rows':[]};var _0xba7b4e=_[_0xa975('0x29')](db[_0xa975('0x2a')][_0xa975('0x2b')],function(_0x336091){return{'name':_0x336091['fieldName'],'type':_0x336091['type'][_0xa975('0x2c')]};});_0x168c3b[_0xa975('0x2d')]=_['map'](_0xba7b4e,_0xa975('0x26'));_0x168c3b['query']=_['keys'](_0x323206['query']);_0x168c3b['filters']=_[_0xa975('0x2e')](_0x168c3b[_0xa975('0x2d')],_0x168c3b[_0xa975('0x2f')]);_0x3e8d94[_0xa975('0x30')]=_[_0xa975('0x2e')](_0x168c3b['model'],qs[_0xa975('0x31')](_0x323206[_0xa975('0x2f')][_0xa975('0x31')]));_0x3e8d94[_0xa975('0x30')]=_0x3e8d94[_0xa975('0x30')][_0xa975('0x32')]?_0x3e8d94[_0xa975('0x30')]:_0x168c3b[_0xa975('0x2d')];if(!_0x323206[_0xa975('0x2f')][_0xa975('0x33')]('nolimit')){_0x3e8d94[_0xa975('0x1d')]=qs[_0xa975('0x1d')](_0x323206[_0xa975('0x2f')][_0xa975('0x1d')]);_0x3e8d94[_0xa975('0x1a')]=qs['offset'](_0x323206[_0xa975('0x2f')]['offset']);}_0x3e8d94[_0xa975('0x34')]=qs[_0xa975('0x35')](_0x323206['query']['sort']);_0x3e8d94[_0xa975('0x36')]=qs[_0xa975('0x37')](_[_0xa975('0x38')](_0x323206[_0xa975('0x2f')],_0x168c3b['filters']),_0xba7b4e);if(_0x323206[_0xa975('0x2f')]['filter']){_0x3e8d94['where']=_[_0xa975('0x39')](_0x3e8d94['where'],{'$or':_[_0xa975('0x29')](_0xba7b4e,function(_0x1640fc){if(_0x1640fc[_0xa975('0x3a')]!==_0xa975('0x3b')){var _0x5c44d1={};_0x5c44d1[_0x1640fc['name']]={'$like':'%'+_0x323206[_0xa975('0x2f')][_0xa975('0x3c')]+'%'};return _0x5c44d1;}})});}_0x3e8d94=_[_0xa975('0x39')]({},_0x3e8d94,_0x323206[_0xa975('0x3d')]);var _0x4686a8={'where':_0x3e8d94[_0xa975('0x36')]};return db[_0xa975('0x2a')]['count'](_0x4686a8)[_0xa975('0x23')](function(_0x279afe){_0x3758fa[_0xa975('0x1c')]=_0x279afe;if(_0x323206['query']['includeAll']){_0x3e8d94[_0xa975('0x3e')]=[{'all':!![]}];}return db[_0xa975('0x2a')]['findAll'](_0x3e8d94);})[_0xa975('0x23')](function(_0xc94943){_0x3758fa['rows']=_0xc94943;return _0x3758fa;})[_0xa975('0x23')](respondWithFilteredResult(_0x51aff1,_0x3e8d94))[_0xa975('0x3f')](handleError(_0x51aff1,null));};exports[_0xa975('0x40')]=function(_0x4454ec,_0xf2701c){var _0x2741fb={'raw':!![],'where':{'id':_0x4454ec[_0xa975('0x41')]['id']}},_0x53c67c={};_0x53c67c[_0xa975('0x2d')]=_[_0xa975('0x42')](db[_0xa975('0x2a')]['rawAttributes']);_0x53c67c[_0xa975('0x2f')]=_[_0xa975('0x42')](_0x4454ec[_0xa975('0x2f')]);_0x53c67c[_0xa975('0x37')]=_[_0xa975('0x2e')](_0x53c67c['model'],_0x53c67c[_0xa975('0x2f')]);_0x2741fb[_0xa975('0x30')]=_[_0xa975('0x2e')](_0x53c67c[_0xa975('0x2d')],qs['fields'](_0x4454ec[_0xa975('0x2f')][_0xa975('0x31')]));_0x2741fb[_0xa975('0x30')]=_0x2741fb[_0xa975('0x30')][_0xa975('0x32')]?_0x2741fb[_0xa975('0x30')]:_0x53c67c[_0xa975('0x2d')];if(_0x4454ec[_0xa975('0x2f')][_0xa975('0x43')]){_0x2741fb['include']=[{'all':!![]}];}_0x2741fb=_[_0xa975('0x39')]({},_0x2741fb,_0x4454ec[_0xa975('0x3d')]);return db[_0xa975('0x2a')][_0xa975('0x44')](_0x2741fb)[_0xa975('0x23')](handleEntityNotFound(_0xf2701c,null))[_0xa975('0x23')](respondWithResult(_0xf2701c,null))['catch'](handleError(_0xf2701c,null));};exports[_0xa975('0x45')]=function(_0x3a633f,_0x8e0b3d){return db[_0xa975('0x2a')][_0xa975('0x45')](_0x3a633f[_0xa975('0x46')],{})[_0xa975('0x23')](respondWithResult(_0x8e0b3d,0xc9))[_0xa975('0x3f')](handleError(_0x8e0b3d,null));};exports[_0xa975('0x47')]=function(_0x3ca1b5,_0x235f9f){if(_0x3ca1b5[_0xa975('0x46')]['id']){delete _0x3ca1b5[_0xa975('0x46')]['id'];}return db[_0xa975('0x2a')]['find']({'where':{'id':_0x3ca1b5['params']['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x235f9f,null))[_0xa975('0x23')](saveUpdates(_0x3ca1b5['body'],null))['then'](respondWithResult(_0x235f9f,null))['catch'](handleError(_0x235f9f,null));};exports[_0xa975('0x48')]=function(_0x18c62d,_0x93b7f3){return db[_0xa975('0x2a')][_0xa975('0x44')]({'where':{'id':_0x18c62d[_0xa975('0x41')]['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x93b7f3,null))[_0xa975('0x23')](removeEntity(_0x93b7f3,null))[_0xa975('0x3f')](handleError(_0x93b7f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a72c795..646d8b4 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 _0xebd2=['openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x543a45,_0x330ce2){var _0x1e211a=function(_0x1ef406){while(--_0x1ef406){_0x543a45['push'](_0x543a45['shift']());}};_0x1e211a(++_0x330ce2);}(_0xebd2,0x6e));var _0x2ebd=function(_0x455700,_0x4c874f){_0x455700=_0x455700-0x0;var _0x1f6a66=_0xebd2[_0x455700];return _0x1f6a66;};'use strict';var _=require(_0x2ebd('0x0'));var util=require(_0x2ebd('0x1'));var logger=require(_0x2ebd('0x2'))(_0x2ebd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ebd('0x4'));var rimraf=require(_0x2ebd('0x5'));var config=require(_0x2ebd('0x6'));var attributes=require(_0x2ebd('0x7'));module[_0x2ebd('0x8')]=function(_0x1f35b4,_0x533301){return _0x1f35b4['define'](_0x2ebd('0x9'),attributes,{'tableName':_0x2ebd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2ebd('0xb')});}; \ No newline at end of file +var _0x2596=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelApplication.attributes'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2596,0x11a));var _0x6259=function(_0x508ec6,_0x2268a6){_0x508ec6=_0x508ec6-0x0;var _0x296414=_0x2596[_0x508ec6];return _0x296414;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6259('0x0'))(_0x6259('0x1'));var moment=require(_0x6259('0x2'));var BPromise=require(_0x6259('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6259('0x4'));var attributes=require(_0x6259('0x5'));module[_0x6259('0x6')]=function(_0x574bf6,_0x5cba9c){return _0x574bf6[_0x6259('0x7')](_0x6259('0x8'),attributes,{'tableName':_0x6259('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6259('0xa'),'collate':_0x6259('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 502bcac..566aadc 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 _0x55e9=['util','moment','bluebird','ioredis','rpc','../../config/environment','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateOpenchannelApplication','update','body','options','raw','limit','lodash'];(function(_0x5a7933,_0x44921a){var _0x3a6dd1=function(_0x556cc8){while(--_0x556cc8){_0x5a7933['push'](_0x5a7933['shift']());}};_0x3a6dd1(++_0x44921a);}(_0x55e9,0x167));var _0x955e=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x55e9[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x955e('0x0'));var util=require(_0x955e('0x1'));var moment=require(_0x955e('0x2'));var BPromise=require(_0x955e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x955e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x955e('0x5'));var config=require(_0x955e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x955e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa70174,_0x4667d1,_0x57b1b5){return new BPromise(function(_0x4fd6c1,_0x57adf7){return client[_0x955e('0x8')](_0xa70174,_0x57b1b5)[_0x955e('0x9')](function(_0x12202c){logger[_0x955e('0xa')](_0x955e('0xb'),_0x4667d1,_0x955e('0xc'));logger[_0x955e('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4667d1,_0x955e('0xc'),JSON[_0x955e('0xe')](_0x12202c));if(_0x12202c['error']){if(_0x12202c[_0x955e('0xf')]['code']===0x1f4){logger[_0x955e('0xf')](_0x955e('0xb'),_0x4667d1,_0x12202c[_0x955e('0xf')][_0x955e('0x10')]);return _0x57adf7(_0x12202c['error'][_0x955e('0x10')]);}logger['error'](_0x955e('0xb'),_0x4667d1,_0x12202c[_0x955e('0xf')][_0x955e('0x10')]);return _0x4fd6c1(_0x12202c[_0x955e('0xf')][_0x955e('0x10')]);}else{logger[_0x955e('0xa')](_0x955e('0xb'),_0x4667d1,_0x955e('0xc'));_0x4fd6c1(_0x12202c['result']['message']);}})[_0x955e('0x11')](function(_0x35432b){logger[_0x955e('0xf')](_0x955e('0xb'),_0x4667d1,_0x35432b);_0x57adf7(_0x35432b);});});}exports[_0x955e('0x12')]=function(_0x40e240){var _0x418ef5=this;return new Promise(function(_0x4da2d0,_0x26c950){return db['OpenchannelApplication'][_0x955e('0x13')](_0x40e240[_0x955e('0x14')],{'raw':_0x40e240[_0x955e('0x15')]?_0x40e240[_0x955e('0x15')][_0x955e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e240[_0x955e('0x15')]?_0x40e240[_0x955e('0x15')]['where']||null:null,'attributes':_0x40e240[_0x955e('0x15')]?_0x40e240[_0x955e('0x15')]['attributes']||null:null,'limit':_0x40e240[_0x955e('0x15')]?_0x40e240[_0x955e('0x15')][_0x955e('0x17')]||null:null})[_0x955e('0x9')](function(_0x3c8b82){logger['info'](_0x955e('0x12'),_0x40e240);logger[_0x955e('0xd')]('UpdateOpenchannelApplication',_0x40e240,JSON[_0x955e('0xe')](_0x3c8b82));_0x4da2d0(_0x3c8b82);})[_0x955e('0x11')](function(_0x4db755){logger[_0x955e('0xf')]('UpdateOpenchannelApplication',_0x4db755[_0x955e('0x10')],_0x40e240);_0x26c950(_0x418ef5[_0x955e('0xf')](0x1f4,_0x4db755[_0x955e('0x10')]));});});}; \ No newline at end of file +var _0x36c1=['client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelApplication','body','options','raw','where','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x48c20a,_0x2dd18a){var _0x141656=function(_0xfce882){while(--_0xfce882){_0x48c20a['push'](_0x48c20a['shift']());}};_0x141656(++_0x2dd18a);}(_0x36c1,0x140));var _0x136c=function(_0x334578,_0x4f68f1){_0x334578=_0x334578-0x0;var _0x11d272=_0x36c1[_0x334578];return _0x11d272;};'use strict';var _=require(_0x136c('0x0'));var util=require(_0x136c('0x1'));var moment=require(_0x136c('0x2'));var BPromise=require(_0x136c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x136c('0x4'));var db=require(_0x136c('0x5'))['db'];var utils=require(_0x136c('0x6'));var logger=require('../../config/logger')(_0x136c('0x7'));var config=require(_0x136c('0x8'));var jayson=require(_0x136c('0x9'));var client=jayson[_0x136c('0xa')][_0x136c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e313f,_0x45274c,_0x566226){return new BPromise(function(_0x3275a1,_0x145e02){return client[_0x136c('0xc')](_0x4e313f,_0x566226)[_0x136c('0xd')](function(_0x304a4a){logger[_0x136c('0xe')](_0x136c('0xf'),_0x45274c,_0x136c('0x10'));logger[_0x136c('0x11')](_0x136c('0x12'),_0x45274c,_0x136c('0x10'),JSON['stringify'](_0x304a4a));if(_0x304a4a[_0x136c('0x13')]){if(_0x304a4a[_0x136c('0x13')][_0x136c('0x14')]===0x1f4){logger[_0x136c('0x13')](_0x136c('0xf'),_0x45274c,_0x304a4a[_0x136c('0x13')][_0x136c('0x15')]);return _0x145e02(_0x304a4a[_0x136c('0x13')][_0x136c('0x15')]);}logger[_0x136c('0x13')](_0x136c('0xf'),_0x45274c,_0x304a4a[_0x136c('0x13')][_0x136c('0x15')]);return _0x3275a1(_0x304a4a['error']['message']);}else{logger[_0x136c('0xe')](_0x136c('0xf'),_0x45274c,_0x136c('0x10'));_0x3275a1(_0x304a4a['result'][_0x136c('0x15')]);}})[_0x136c('0x16')](function(_0x52633d){logger[_0x136c('0x13')](_0x136c('0xf'),_0x45274c,_0x52633d);_0x145e02(_0x52633d);});});}exports[_0x136c('0x17')]=function(_0x42a618){var _0x4c22df=this;return new Promise(function(_0x20cc52,_0x323e9c){return db['OpenchannelApplication']['update'](_0x42a618[_0x136c('0x18')],{'raw':_0x42a618[_0x136c('0x19')]?_0x42a618[_0x136c('0x19')][_0x136c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42a618[_0x136c('0x19')]?_0x42a618[_0x136c('0x19')][_0x136c('0x1b')]||null:null,'attributes':_0x42a618[_0x136c('0x19')]?_0x42a618['options']['attributes']||null:null,'limit':_0x42a618[_0x136c('0x19')]?_0x42a618[_0x136c('0x19')][_0x136c('0x1c')]||null:null})['then'](function(_0xdeace3){logger[_0x136c('0xe')](_0x136c('0x17'),_0x42a618);logger[_0x136c('0x11')]('UpdateOpenchannelApplication',_0x42a618,JSON[_0x136c('0x1d')](_0xdeace3));_0x20cc52(_0xdeace3);})[_0x136c('0x16')](function(_0x5ab8b2){logger['error'](_0x136c('0x17'),_0x5ab8b2['message'],_0x42a618);_0x323e9c(_0x4c22df[_0x136c('0x13')](0x1f4,_0x5ab8b2[_0x136c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9f53c95..df73f34 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 _0xfbf1=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','/:id','tracked','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4ae0b5,_0x2f5637){var _0x43b9aa=function(_0x5e4743){while(--_0x5e4743){_0x4ae0b5['push'](_0x4ae0b5['shift']());}};_0x43b9aa(++_0x2f5637);}(_0xfbf1,0x139));var _0x1fbf=function(_0x230b12,_0x3ab9e2){_0x230b12=_0x230b12-0x0;var _0x596f23=_0xfbf1[_0x230b12];return _0x596f23;};'use strict';var multer=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var path=require(_0x1fbf('0x2'));var timeout=require(_0x1fbf('0x3'));var express=require(_0x1fbf('0x4'));var router=express['Router']();var fs_extra=require(_0x1fbf('0x5'));var auth=require(_0x1fbf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1fbf('0x7'));var controller=require(_0x1fbf('0x8'));router[_0x1fbf('0x9')]('/',auth[_0x1fbf('0xa')](),controller[_0x1fbf('0xb')]);router[_0x1fbf('0x9')](_0x1fbf('0xc'),auth[_0x1fbf('0xa')](),controller[_0x1fbf('0xd')]);router[_0x1fbf('0x9')]('/:id',auth[_0x1fbf('0xa')](),controller[_0x1fbf('0xe')]);router[_0x1fbf('0x9')](_0x1fbf('0xf'),auth[_0x1fbf('0xa')](),controller['getMessages']);router[_0x1fbf('0x9')](_0x1fbf('0x10'),auth[_0x1fbf('0xa')](),controller[_0x1fbf('0x11')]);router[_0x1fbf('0x12')]('/',auth[_0x1fbf('0xa')](),controller[_0x1fbf('0x13')]);router['post']('/:id/messages',auth[_0x1fbf('0xa')](),controller[_0x1fbf('0x14')]);router[_0x1fbf('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x1fbf('0x15'),_0x1fbf('0x16')),controller[_0x1fbf('0x17')]);router['put'](_0x1fbf('0x18'),auth[_0x1fbf('0xa')](),interaction[_0x1fbf('0x19')](_0x1fbf('0x15'),'openchannelinteraction:update'),controller['update']);router[_0x1fbf('0x1a')](_0x1fbf('0x18'),auth[_0x1fbf('0xa')](),interaction[_0x1fbf('0x19')]('openchannel',_0x1fbf('0x1b')),controller[_0x1fbf('0x1c')]);router[_0x1fbf('0x1a')](_0x1fbf('0x1d'),auth[_0x1fbf('0xa')](),controller[_0x1fbf('0x1e')]);module[_0x1fbf('0x1f')]=router; \ No newline at end of file +var _0xd199=['/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create'];(function(_0xcd49bd,_0x2a12a3){var _0xb6ee44=function(_0x1f77bb){while(--_0x1f77bb){_0xcd49bd['push'](_0xcd49bd['shift']());}};_0xb6ee44(++_0x2a12a3);}(_0xd199,0xa8));var _0x9d19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd199[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9d19('0x0'));var util=require('util');var path=require(_0x9d19('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d19('0x2'));var router=express[_0x9d19('0x3')]();var fs_extra=require(_0x9d19('0x4'));var auth=require(_0x9d19('0x5'));var interaction=require(_0x9d19('0x6'));var config=require(_0x9d19('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x9d19('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d19('0x9')]);router[_0x9d19('0x8')]('/describe',auth[_0x9d19('0xa')](),controller[_0x9d19('0xb')]);router[_0x9d19('0x8')](_0x9d19('0xc'),auth[_0x9d19('0xa')](),controller[_0x9d19('0xd')]);router[_0x9d19('0x8')]('/:id/messages',auth[_0x9d19('0xa')](),controller[_0x9d19('0xe')]);router['get'](_0x9d19('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x9d19('0x10')]('/',auth[_0x9d19('0xa')](),controller[_0x9d19('0x11')]);router[_0x9d19('0x10')](_0x9d19('0x12'),auth[_0x9d19('0xa')](),controller[_0x9d19('0x13')]);router[_0x9d19('0x10')](_0x9d19('0x14'),auth[_0x9d19('0xa')](),interaction[_0x9d19('0x15')](_0x9d19('0x16'),_0x9d19('0x17')),controller['addTags']);router[_0x9d19('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x9d19('0x15')](_0x9d19('0x16'),_0x9d19('0x19')),controller[_0x9d19('0x1a')]);router['delete'](_0x9d19('0xc'),auth[_0x9d19('0xa')](),interaction[_0x9d19('0x15')](_0x9d19('0x16'),'openchannelinteraction:destroy'),controller[_0x9d19('0x1b')]);router[_0x9d19('0x1c')](_0x9d19('0x14'),auth['isAuthenticated'](),controller[_0x9d19('0x1d')]);module[_0x9d19('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a5de2dc..76179d7 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 _0x48c6=['BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x2447e5,_0x51831f){var _0x34054c=function(_0x48ad5f){while(--_0x48ad5f){_0x2447e5['push'](_0x2447e5['shift']());}};_0x34054c(++_0x51831f);}(_0x48c6,0x17d));var _0x648c=function(_0x4ef69c,_0x2dee0f){_0x4ef69c=_0x4ef69c-0x0;var _0x365e46=_0x48c6[_0x4ef69c];return _0x365e46;};'use strict';var Sequelize=require(_0x648c('0x0'));module[_0x648c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x648c('0x2')]},'disposition':{'type':Sequelize[_0x648c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x648c('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x648c('0x2')]},'threadId':{'type':Sequelize[_0x648c('0x3')]},'externalUrl':{'type':Sequelize[_0x648c('0x3')]},'lastMsgAt':{'type':Sequelize[_0x648c('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x648c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4eb=['BOOLEAN','sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x2d63b9,_0x11a03f){var _0x4cd954=function(_0x5b9cd2){while(--_0x5b9cd2){_0x2d63b9['push'](_0x2d63b9['shift']());}};_0x4cd954(++_0x11a03f);}(_0xe4eb,0x9b));var _0xbe4e=function(_0x28f62f,_0x124cd8){_0x28f62f=_0x28f62f-0x0;var _0x297207=_0xe4eb[_0x28f62f];return _0x297207;};'use strict';var Sequelize=require(_0xbe4e('0x0'));module[_0xbe4e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbe4e('0x2')]},'disposition':{'type':Sequelize[_0xbe4e('0x3')]},'secondDisposition':{'type':Sequelize[_0xbe4e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbe4e('0x3')]},'read1stAt':{'type':Sequelize[_0xbe4e('0x2')]},'threadId':{'type':Sequelize[_0xbe4e('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xbe4e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbe4e('0x4')]('in',_0xbe4e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbe4e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xbe4e('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index fc8dabf..9379531 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 _0x8478=['parseSearch','sqlOperator','conditions','length','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','user','role','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','params','fields','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','Messages','direction','OpenchannelAccount','Account','User','Owner','get','N.A.','closedAt','disposition','threadId','Private','basename','existsSync','pipe','createWriteStream','out','System','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','map','fullname','TagIds','Tags','forEach','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','LOG\x20~\x20req.query','query','OpenchannelInteraction','rawAttributes','fieldName','type','model','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search'];(function(_0x4eba77,_0x58581a){var _0x191e57=function(_0x2f9794){while(--_0x2f9794){_0x4eba77['push'](_0x4eba77['shift']());}};_0x191e57(++_0x58581a);}(_0x8478,0x91));var _0x8847=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8478[_0x4a9fb1];return _0x348672;};'use strict';var rimraf=require(_0x8847('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var util=require('util');var path=require(_0x8847('0x1'));var ejs=require(_0x8847('0x2'));var fs=require('fs');var _=require(_0x8847('0x3'));var squel=require(_0x8847('0x4'));var Redis=require(_0x8847('0x5'));var qs=require(_0x8847('0x6'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x8847('0x7'));var logger=require('../../config/logger')(_0x8847('0x8'));var config=require('../../config/environment');var db=require(_0x8847('0x9'))['db'];config[_0x8847('0xa')]=_[_0x8847('0xb')](config[_0x8847('0xa')],{'host':_0x8847('0xc'),'port':0x18eb});var socket=require(_0x8847('0xd'))(new Redis(config[_0x8847('0xa')]));require(_0x8847('0xe'))[_0x8847('0xf')](socket);function respondWithStatusCode(_0x406eb7,_0x1f9d0e){_0x1f9d0e=_0x1f9d0e||0xcc;return function(_0x2dfb14){if(_0x2dfb14){return _0x406eb7[_0x8847('0x10')](_0x1f9d0e);}return _0x406eb7[_0x8847('0x11')](_0x1f9d0e)[_0x8847('0x12')]();};}function respondWithResult(_0x28e2f6,_0x407a0c){_0x407a0c=_0x407a0c||0xc8;return function(_0x20ff56){if(_0x20ff56){return _0x28e2f6['status'](_0x407a0c)[_0x8847('0x13')](_0x20ff56);}};}function respondWithFilteredResult(_0xebd26a,_0x39d2bb){return function(_0x18bd72){if(_0x18bd72){var _0x28d7a3=typeof _0x39d2bb[_0x8847('0x14')]===_0x8847('0x15')&&typeof _0x39d2bb[_0x8847('0x16')]===_0x8847('0x15');var _0x5904a5=_0x18bd72[_0x8847('0x17')];var _0x3be144=_0x28d7a3?0x0:_0x39d2bb[_0x8847('0x14')];var _0x55137a=_0x28d7a3?_0x18bd72[_0x8847('0x17')]:_0x39d2bb[_0x8847('0x14')]+_0x39d2bb[_0x8847('0x16')];var _0x11734e;if(_0x55137a>=_0x5904a5){_0x55137a=_0x5904a5;_0x11734e=0xc8;}else{_0x11734e=0xce;}_0xebd26a[_0x8847('0x11')](_0x11734e);return _0xebd26a[_0x8847('0x18')](_0x8847('0x19'),_0x3be144+'-'+_0x55137a+'/'+_0x5904a5)['json'](_0x18bd72);}return null;};}function saveUpdates(_0x1d18d7){return function(_0x2c0dc2){if(_0x2c0dc2){return _0x2c0dc2[_0x8847('0x1a')](_0x1d18d7)[_0x8847('0x1b')](function(_0x524c52){return _0x524c52;});}return null;};}function removeEntity(_0x45374c){return function(_0x57ed5e){if(_0x57ed5e){return _0x57ed5e[_0x8847('0x1c')]()[_0x8847('0x1b')](function(){_0x45374c[_0x8847('0x11')](0xcc)[_0x8847('0x12')]();});}};}function handleEntityNotFound(_0xb09b4d){return function(_0x2499f3){if(!_0x2499f3){_0xb09b4d[_0x8847('0x10')](0x194);}return _0x2499f3;};}function handleError(_0x31d2f2,_0x5b2b9e){_0x5b2b9e=_0x5b2b9e||0x1f4;return function(_0x1cffe1){logger[_0x8847('0x1d')](_0x1cffe1['stack']);if(_0x1cffe1['name']){delete _0x1cffe1[_0x8847('0x1e')];}_0x31d2f2[_0x8847('0x11')](_0x5b2b9e)[_0x8847('0x1f')](_0x1cffe1);};}function getInteractionUsers(_0x4cc535,_0x5eb493){return new Promise(function(_0x5cafc1,_0x8bedae){try{if(_0x5eb493[_0x4cc535['id']]){_0x4cc535['Users']=_[_0x8847('0x20')](_0x5eb493[_0x4cc535['id']],function(_0x2d31f9){return{'id':_0x2d31f9['id'],'fullname':_0x2d31f9[_0x8847('0x21')]};});}}catch(_0x4fe5b6){_0x8bedae(_0x4fe5b6);}_0x5cafc1(_0x4cc535);});}function getInteractionTags(_0x3ac5b8,_0x3ed973){return new Promise(function(_0x147633,_0x38d4c1){try{if(_0x3ac5b8[_0x8847('0x22')]){_0x3ac5b8[_0x8847('0x23')]=[];_0x3ac5b8[_0x8847('0x22')]['split'](',')[_0x8847('0x24')](function(_0x224ba0){_0x3ac5b8['Tags'][_0x8847('0x25')](_0x3ed973[_0x224ba0]);});}delete _0x3ac5b8[_0x8847('0x22')];}catch(_0x535890){_0x38d4c1(_0x535890);}_0x147633(_0x3ac5b8);});}function updateOpenchannelInteraction(_0x1c0fea,_0x3943d1,_0x20d70e){return new Promise(function(_0x417e1e,_0x4abdbc){return getInteractionUsers(_0x1c0fea,_0x20d70e)['then'](function(_0x53d50b){return getInteractionTags(_0x53d50b,_0x3943d1);})[_0x8847('0x1b')](function(_0x4125ba){return getStateInteraction(_0x4125ba);})['then'](function(_0x4f2018){_0x417e1e(_0x4f2018);})[_0x8847('0x26')](function(_0x229e2d){_0x4abdbc(_0x229e2d);});});}function getStateInteraction(_0xc6b88){return new Promise(function(_0x46730b){_0xc6b88['waiting']=0x0;_0xc6b88[_0x8847('0x27')]=0x0;_0xc6b88[_0x8847('0x28')]=0x0;_0xc6b88[_0x8847('0x29')]=0x0;_0xc6b88[_0x8847('0x2a')]=0x0;if(!_0xc6b88[_0x8847('0x2b')]&&!_0xc6b88[_0x8847('0x2c')]){_0xc6b88[_0x8847('0x2d')]+=0x1;}if(!_0xc6b88[_0x8847('0x2b')]&&_0xc6b88['UserId']){_0xc6b88[_0x8847('0x27')]+=0x1;if(_0xc6b88[_0x8847('0x2d')]){_0xc6b88[_0x8847('0x2d')]-=0x1;}}if(_0xc6b88[_0x8847('0x2b')]&&_0xc6b88[_0x8847('0x2c')]){_0xc6b88[_0x8847('0x28')]+=0x1;if(_0xc6b88[_0x8847('0x27')]){_0xc6b88['talking']-=0x1;}}if(_0xc6b88['closed']&&!_0xc6b88[_0x8847('0x2c')]){_0xc6b88[_0x8847('0x29')]+=0x1;if(_0xc6b88[_0x8847('0x2d')]){_0xc6b88[_0x8847('0x2d')]-=0x1;}}_0xc6b88[_0x8847('0x2a')]+=0x1;_0x46730b(_0xc6b88);});}exports[_0x8847('0x2e')]=function(_0xfeae2,_0x444dbc){console['log'](_0x8847('0x2f'),_0xfeae2[_0x8847('0x30')]);var _0x5d53dd={},_0x39c96d={},_0x5f4c3a={'count':0x0,'rows':[]};var _0x2fbaec=_[_0x8847('0x20')](db[_0x8847('0x31')][_0x8847('0x32')],function(_0x1edb65){return{'name':_0x1edb65[_0x8847('0x33')],'type':_0x1edb65[_0x8847('0x34')]['key']};});_0x39c96d[_0x8847('0x35')]=_[_0x8847('0x20')](_0x2fbaec,_0x8847('0x1e'));_0x39c96d[_0x8847('0x30')]=_['keys'](_0xfeae2[_0x8847('0x30')]);_0x39c96d[_0x8847('0x36')]=_[_0x8847('0x37')](_0x39c96d[_0x8847('0x35')],_0x39c96d[_0x8847('0x30')]);_0x5d53dd[_0x8847('0x38')]=_['intersection'](_0x39c96d[_0x8847('0x35')],qs['fields'](_0xfeae2[_0x8847('0x30')]['fields']));_0x5d53dd[_0x8847('0x38')]=_0x5d53dd[_0x8847('0x38')]['length']?_0x5d53dd['attributes']:_0x39c96d['model'];if(!_0xfeae2[_0x8847('0x30')][_0x8847('0x39')](_0x8847('0x3a'))){_0x5d53dd[_0x8847('0x16')]=qs[_0x8847('0x16')](_0xfeae2[_0x8847('0x30')][_0x8847('0x16')]);_0x5d53dd[_0x8847('0x14')]=qs['offset'](_0xfeae2[_0x8847('0x30')][_0x8847('0x14')]);}_0x5d53dd[_0x8847('0x3b')]=qs[_0x8847('0x3c')](_0xfeae2[_0x8847('0x30')][_0x8847('0x3c')]);_0x5d53dd[_0x8847('0x3d')]=qs[_0x8847('0x36')](_[_0x8847('0x3e')](_0xfeae2[_0x8847('0x30')],_0x39c96d[_0x8847('0x36')]),_0x2fbaec);var _0x352640=[];var _0x1f96e5=squel['select']()[_0x8847('0x3f')]('id')['field'](_0x8847('0x1e'))[_0x8847('0x3f')]('color')[_0x8847('0x40')](_0x8847('0x41'));var _0x317876=squel[_0x8847('0x42')]()[_0x8847('0x3f')](_0x8847('0x43'))[_0x8847('0x3f')](_0x8847('0x44'))['field'](_0x8847('0x45'))['from'](_0x8847('0x46'),'ui')[_0x8847('0x47')](_0x8847('0x48'),'u',_0x8847('0x49'));var _0xf3062c=squel['select']()[_0x8847('0x40')]('openchannel_interactions','i')['left_join'](_0x8847('0x4a'),'c',_0x8847('0x4b'))[_0x8847('0x47')]('users','o',_0x8847('0x4c'))[_0x8847('0x47')]('openchannel_accounts','a',_0x8847('0x4d'))[_0x8847('0x47')](_0x8847('0x4e'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x8847('0x47')](_0x8847('0x4f'),'it',_0x8847('0x50'))[_0x8847('0x47')](_0x8847('0x41'),'t','t.id\x20=\x20it.TagId');var _0x2a4fa4=squel[_0x8847('0x51')]();var _0x115fee=[];var _0x18c221=squel['expr']();var _0x5af9fc;if(_0xfeae2[_0x8847('0x30')][_0x8847('0x52')]){_0x5af9fc=as[_0x8847('0x53')](_0xfeae2[_0x8847('0x30')][_0x8847('0x52')]);var _0x52bd65=_0x5af9fc[_0x8847('0x54')];for(var _0xf97a33=0x0;_0xf97a33<_0x5af9fc[_0x8847('0x55')][_0x8847('0x56')];_0xf97a33++){var _0x560f69=_0x5af9fc['conditions'][_0xf97a33];var _0x324040='i';var _0x49b04f=_[_0x8847('0x57')](_0x2fbaec,[_0x8847('0x1e'),_0x560f69[_0x8847('0x3f')]]);if(!_0x49b04f){switch(_0x560f69[_0x8847('0x3f')]){case'unreadMessages':if(_0x560f69['value']==0x1){_0xf3062c[_0x8847('0x58')]('`'+_0x560f69['field']+_0x8847('0x59'));}else{_0xf3062c[_0x8847('0x58')]('`'+_0x560f69[_0x8847('0x3f')]+_0x8847('0x5a'));}break;case _0x8847('0x5b'):if(_0x560f69[_0x8847('0x5c')]==='$substring'){if(_0x560f69['value'][_0x8847('0x5d')]('\x20')['length']>0x1){_0x2a4fa4[_0x52bd65](_0x8847('0x5e'),qs[_0x8847('0x5f')](_0x560f69[_0x8847('0x60')]),null);}else{var _0x6a3de1='%'+_0x560f69['value']+'%';_0x2a4fa4[_0x52bd65](_0x8847('0x61'),_0x6a3de1,_0x6a3de1,_0x6a3de1);}}else{_0x49b04f=_['find'](_0x2fbaec,['name',_0x8847('0x62')]);_0x560f69[_0x8847('0x3f')]=_0x8847('0x62');_0x4b087d=as[_0x8847('0x63')](_0x324040,_0x49b04f[_0x8847('0x34')],_0x560f69);_0x2a4fa4[_0x52bd65](_0x4b087d[_0x8847('0x64')],_0x4b087d[_0x8847('0x60')][_0x8847('0x65')],_0x4b087d[_0x8847('0x60')][_0x8847('0x12')]);}break;case'Tag':var _0x103c0a=_0x560f69[_0x8847('0x60')][_0x8847('0x5d')](',')['map'](function(_0x5dd709){return Number(_0x5dd709);});_0x103c0a['forEach'](function(_0x1f08e5){_0x18c221['or'](_0x8847('0x66'),'%,'+_0x1f08e5+',%');});_0x115fee=_['union'](_0x115fee,_0x103c0a);break;case'User':if(_0x560f69[_0x8847('0x5c')]===_0x8847('0x67')){_0x2a4fa4[_0x52bd65](_0x8847('0x68'),'%'+_0x560f69[_0x8847('0x60')]+'%',null);}else{_0x49b04f=_['find'](_0x2fbaec,[_0x8847('0x1e'),_0x8847('0x2c')]);_0x560f69['field']=_0x8847('0x2c');_0x4b087d=as['buildExpression'](_0x324040,_0x49b04f[_0x8847('0x34')],_0x560f69);_0x2a4fa4[_0x52bd65](_0x4b087d[_0x8847('0x64')],_0x4b087d['value'][_0x8847('0x65')],_0x4b087d[_0x8847('0x60')][_0x8847('0x12')]);}break;case _0x8847('0x69'):_0x4b087d=as[_0x8847('0x63')]('me',null,_0x560f69);_0x2a4fa4[_0x52bd65](_0x4b087d[_0x8847('0x64')],_0x4b087d[_0x8847('0x60')][_0x8847('0x65')],_0x4b087d[_0x8847('0x60')]['end']);break;}}else{var _0x4b087d=as[_0x8847('0x63')](_0x324040,_0x49b04f['type'],_0x560f69);_0x2a4fa4[_0x52bd65](_0x4b087d[_0x8847('0x64')],_0x4b087d[_0x8847('0x60')][_0x8847('0x65')],_0x4b087d['value'][_0x8847('0x12')]);}}}else{var _0x41c3e1=_(_0xfeae2['query'])[_0x8847('0x6a')]()[_0x8847('0x20')](function(_0x356526){return _[_0x8847('0x6b')](_0x2fbaec,[_0x8847('0x1e'),_0x356526])?_0x356526:undefined;})['compact']()[_0x8847('0x60')]();if(!_[_0x8847('0x6c')](_0x41c3e1)){_0x41c3e1[_0x8847('0x24')](function(_0x6e4630){if(_0x6e4630===_0x8847('0x6d')){_0xf3062c[_0x8847('0x3d')](_0x8847('0x6e'),[][_0x8847('0x6f')](_0xfeae2[_0x8847('0x30')][_0x6e4630]));}else if(_0x6e4630===_0x8847('0x70')){var _0x35503e=JSON['parse'](_0xfeae2[_0x8847('0x30')][_0x6e4630])[_0x8847('0x71')];var _0xf1b1f9=JSON[_0x8847('0x72')](_0xfeae2[_0x8847('0x30')][_0x6e4630])[_0x8847('0x73')];_0xf3062c['where'](_0x8847('0x74'),_0x35503e,_0xf1b1f9);}else{if(_0xfeae2[_0x8847('0x30')][_0x6e4630]===_0x8847('0x75')){_0xf3062c[_0x8847('0x3d')]('i.'+_0x6e4630+'\x20IS\x20NULL');}else{_0xf3062c['where']('i.'+_0x6e4630+'\x20=\x20?',_0xfeae2[_0x8847('0x30')][_0x6e4630]);}}});}if(_0xfeae2[_0x8847('0x30')][_0x8847('0x76')]){if(_0xfeae2['query']['read']==0x1){_0xf3062c['having'](_0x8847('0x77'));}else{_0xf3062c[_0x8847('0x58')](_0x8847('0x78'));}}if(_0xfeae2['query']['tag']){_0x115fee=_[_0x8847('0x79')](_0xfeae2['query'][_0x8847('0x7a')])?_0xfeae2['query']['tag']:new Array(_0xfeae2[_0x8847('0x30')]['tag']);_0x115fee[_0x8847('0x24')](function(_0x4bcce6){_0x18c221['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bcce6+',%');});}if(_0xfeae2[_0x8847('0x30')][_0x8847('0x7b')]){var _0x5e2ae6=_0xfeae2['query'][_0x8847('0x7b')][_0x8847('0x7c')]('\x5c','\x5c\x5c')[_0x8847('0x7c')](/'/g,'\x27\x27');if(qs[_0x8847('0x7d')](_0x5e2ae6)){_0x2a4fa4['or'](_0x8847('0x7e'),_0x5e2ae6+'%');}else{_0x2a4fa4['or'](_0x8847('0x7f'),qs['getFullTextValue'](_0x5e2ae6))['or'](_0x8847('0x80'),_0x5e2ae6+'%');}_0x2a4fa4['or'](_0x8847('0x81'),_0x5e2ae6+'%');}}_0xf3062c[_0x8847('0x3d')](_0x2a4fa4);_0xf3062c[_0x8847('0x82')](_0x8847('0x83'));var _0x5b84f4={'type':db[_0x8847('0x84')]['QueryTypes'][_0x8847('0x85')],'raw':!![]};var _0x1c0594=_0xf3062c['clone']();_0x1c0594[_0x8847('0x3f')](_0x8847('0x83'));_0x1c0594[_0x8847('0x3f')](_0x8847('0x86'),_0x8847('0x87'));if(_0x5d53dd['order']){_0x5d53dd[_0x8847('0x3b')][_0x8847('0x24')](function(_0x213d61){var _0x27a2eb=_0x213d61[0x0]===_0x8847('0x88')?_0x213d61[0x0]:'i.'+_0x213d61[0x0];_0xf3062c[_0x8847('0x3b')](_0x27a2eb,_0x213d61[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8847('0x6c')](_0x115fee)){_0xf3062c['having'](_0x18c221);_0x1c0594['where'](_0x8847('0x89'),_0x115fee);}Promise['resolve']()[_0x8847('0x1b')](function(){if(!_0x5af9fc){if(_0xfeae2[_0x8847('0x30')][_0x8847('0x6d')])return;_0x1c0594[_0x8847('0x3d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0xf3062c['where'](_0x8847('0x8a'));return;}if(_0xfeae2['user']['role']!=='agent')return;return _0xfeae2['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x8847('0x1b')](function(_0x40ea73){if(_[_0x8847('0x6c')](_0x40ea73)){_0x1c0594[_0x8847('0x3d')](_0x8847('0x8b'));_0xf3062c[_0x8847('0x3d')](_0x8847('0x8b'));}else{_0x1c0594['where'](_0x8847('0x6e'),_[_0x8847('0x20')](_0x40ea73,'id'));_0xf3062c['where'](_0x8847('0x6e'),_['map'](_0x40ea73,'id'));}});})['then'](function(){if(_0xfeae2[_0x8847('0x8c')][_0x8847('0x8d')]===_0x8847('0x8e')&&!_0x5af9fc&&!_0xfeae2[_0x8847('0x30')]['OpenchannelAccountId'])return[];return db[_0x8847('0x8f')]['query'](_0x1c0594[_0x8847('0x90')](),_0x5b84f4);})[_0x8847('0x1b')](function(_0x3f323a){_0x5f4c3a[_0x8847('0x17')]=_0x3f323a[_0x8847('0x56')];if(_0x5f4c3a[_0x8847('0x17')]===0x0)return[];return db['sequelize'][_0x8847('0x30')](_0x1f96e5[_0x8847('0x90')](),_0x5b84f4)[_0x8847('0x1b')](function(_0x1428f8){_0x352640=_['keyBy'](_0x1428f8,'id');_0x5b84f4=_[_0x8847('0x91')](_0x5b84f4,{'model':db[_0x8847('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfeae2[_0x8847('0x30')]['fields']){_0x5d53dd[_0x8847('0x38')]['forEach'](function(_0x3de177){_0xf3062c[_0x8847('0x3f')]('i.'+_0x3de177);});}else{_0xf3062c[_0x8847('0x3f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8847('0x87'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x92'),_0x8847('0x93'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x94'),_0x8847('0x95'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x96'),_0x8847('0x88'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x97'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x98'),'Contact.firstName');_0xf3062c[_0x8847('0x3f')](_0x8847('0x99'),'Contact.lastName');_0xf3062c[_0x8847('0x3f')](_0x8847('0x9a'),_0x8847('0x9b'));_0xf3062c['field']('c.phone',_0x8847('0x9c'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x9d'),_0x8847('0x9e'));_0xf3062c[_0x8847('0x3f')](_0x8847('0x9f'),_0x8847('0xa0'));_0xf3062c[_0x8847('0x3f')](_0x8847('0xa1'),'Owner.fullname');_0xf3062c['field'](_0x8847('0xa2'),'Owner.internal');_0xf3062c[_0x8847('0x3f')](_0x8847('0xa3'),_0x8847('0x22'));}if(_0x5d53dd[_0x8847('0x16')])_0xf3062c[_0x8847('0x16')](_0x5d53dd['limit']);if(_0x5d53dd[_0x8847('0x14')])_0xf3062c['offset'](_0x5d53dd[_0x8847('0x14')]);return db[_0x8847('0x8f')][_0x8847('0x30')](_0xf3062c[_0x8847('0x90')](),_0x5b84f4);})[_0x8847('0x1b')](function(_0x1711f3){if(_0x1711f3[_0x8847('0x56')]>0x0)_0x317876[_0x8847('0x3d')](_0x8847('0xa4'),_[_0x8847('0x20')](_0x1711f3,'id'));return db['sequelize'][_0x8847('0x30')](_0x317876[_0x8847('0x90')](),_0x5b84f4)[_0x8847('0x1b')](function(_0x4ceb4b){var _0x313bcb=_[_0x8847('0xa5')](_0x4ceb4b,_0x8847('0xa6'));var _0x39ed81=[];_0x1711f3[_0x8847('0x24')](function(_0x5c64d0){_0x39ed81[_0x8847('0x25')](updateOpenchannelInteraction(_0x5c64d0,_0x352640,_0x313bcb));});return Promise['all'](_0x39ed81);});});})[_0x8847('0x1b')](function(_0x194c85){_0x5f4c3a[_0x8847('0xa7')]=_0x194c85;return _0x5f4c3a;})[_0x8847('0x1b')](respondWithFilteredResult(_0x444dbc,_0x5d53dd))['catch'](handleError(_0x444dbc,null));};exports['show']=function(_0x2551de,_0x4429bc){var _0x44dc40={};if(_0x2551de[_0x8847('0x30')][_0x8847('0x34')]&&_0x2551de[_0x8847('0x30')][_0x8847('0x34')]==='from'){_0x44dc40[_0x8847('0x40')]=_0x2551de[_0x8847('0xa8')]['id'];}else{_0x44dc40['id']=_0x2551de['params']['id'];}var _0x51db0f={'raw':![],'where':_0x44dc40},_0x3d5134={};_0x3d5134['model']=_[_0x8847('0x6a')](db[_0x8847('0x31')][_0x8847('0x32')]);_0x3d5134[_0x8847('0x30')]=_['keys'](_0x2551de[_0x8847('0x30')]);_0x3d5134[_0x8847('0x36')]=_[_0x8847('0x37')](_0x3d5134[_0x8847('0x35')],_0x3d5134[_0x8847('0x30')]);_0x51db0f['attributes']=_[_0x8847('0x37')](_0x3d5134[_0x8847('0x35')],qs[_0x8847('0xa9')](_0x2551de['query']['fields']));_0x51db0f[_0x8847('0x38')]=_0x51db0f[_0x8847('0x38')]['length']?_0x51db0f['attributes']:_0x3d5134[_0x8847('0x35')];if(_0x2551de[_0x8847('0x30')][_0x8847('0xaa')]){_0x51db0f[_0x8847('0xab')]=[{'all':!![]}];}_0x51db0f=_[_0x8847('0x91')]({},_0x51db0f,_0x2551de[_0x8847('0xac')]);return db['OpenchannelInteraction'][_0x8847('0x57')](_0x51db0f)[_0x8847('0x1b')](handleEntityNotFound(_0x4429bc,null))['then'](respondWithResult(_0x4429bc,null))[_0x8847('0x26')](handleError(_0x4429bc,null));};exports[_0x8847('0xad')]=function(_0x1459c9,_0x2f660c){return db[_0x8847('0x31')]['create'](_0x1459c9[_0x8847('0x69')],{})[_0x8847('0x1b')](respondWithResult(_0x2f660c,0xc9))[_0x8847('0x26')](handleError(_0x2f660c,null));};exports[_0x8847('0x1a')]=function(_0x3ab694,_0x2e8e54){if(_0x3ab694[_0x8847('0x69')]['id']){delete _0x3ab694[_0x8847('0x69')]['id'];}return db[_0x8847('0x31')]['find']({'where':{'id':_0x3ab694['params']['id']}})[_0x8847('0x1b')](handleEntityNotFound(_0x2e8e54,null))[_0x8847('0x1b')](saveUpdates(_0x3ab694[_0x8847('0x69')],null))[_0x8847('0x1b')](respondWithResult(_0x2e8e54,null))[_0x8847('0x26')](handleError(_0x2e8e54,null));};exports[_0x8847('0x1c')]=function(_0x25cacb,_0x422da6){return db[_0x8847('0x31')][_0x8847('0x57')]({'where':{'id':_0x25cacb[_0x8847('0xa8')]['id']}})['then'](handleEntityNotFound(_0x422da6,null))[_0x8847('0x1b')](removeEntity(_0x422da6,null))[_0x8847('0x26')](handleError(_0x422da6,null));};exports[_0x8847('0xae')]=function(_0x331864,_0x28a76e){return db[_0x8847('0x31')]['describe']()['then'](respondWithResult(_0x28a76e,null))[_0x8847('0x26')](handleError(_0x28a76e,null));};exports[_0x8847('0xaf')]=function(_0x5050ce,_0x4749a4){return db[_0x8847('0xb0')]['find']({'where':{'id':_0x5050ce[_0x8847('0xa8')]['id']}})[_0x8847('0x1b')](handleEntityNotFound(_0x4749a4,null))[_0x8847('0x1b')](function(_0x503220){if(_0x503220){return _0x503220[_0x8847('0xaf')](_0x5050ce[_0x8847('0x69')][_0x8847('0xb1')],_[_0x8847('0xb2')](_0x5050ce[_0x8847('0x69')],[_0x8847('0xb1'),'id'])||{});}})[_0x8847('0x1b')](respondWithResult(_0x4749a4,null))[_0x8847('0x26')](handleError(_0x4749a4,null));};exports[_0x8847('0xb3')]=function(_0x3bff6d,_0x4b912a){var _0x172a56={'raw':![],'where':{}};var _0x2dd92d={};var _0x200f44={'count':0x0,'rows':[]};return db[_0x8847('0x31')]['findOne']({'where':{'id':_0x3bff6d[_0x8847('0xa8')]['id']}})['then'](handleEntityNotFound(_0x4b912a,null))[_0x8847('0x1b')](function(_0x56f3c8){if(_0x56f3c8){_0x2dd92d['model']=_['keys'](db[_0x8847('0xb0')][_0x8847('0x32')]);_0x2dd92d[_0x8847('0x30')]=_[_0x8847('0x6a')](_0x3bff6d[_0x8847('0x30')]);_0x2dd92d[_0x8847('0x36')]=_[_0x8847('0x37')](_0x2dd92d[_0x8847('0x35')],_0x2dd92d['query']);_0x172a56[_0x8847('0x38')]=_[_0x8847('0x37')](_0x2dd92d[_0x8847('0x35')],qs['fields'](_0x3bff6d[_0x8847('0x30')][_0x8847('0xa9')]));_0x172a56['attributes']=_0x172a56[_0x8847('0x38')][_0x8847('0x56')]?_0x172a56['attributes']:_0x2dd92d[_0x8847('0x35')];if(!_0x3bff6d['query']['hasOwnProperty'](_0x8847('0x3a'))){_0x172a56[_0x8847('0x16')]=qs['limit'](_0x3bff6d[_0x8847('0x30')][_0x8847('0x16')]);_0x172a56[_0x8847('0x14')]=qs[_0x8847('0x14')](_0x3bff6d['query']['offset']);}_0x172a56[_0x8847('0x3b')]=qs[_0x8847('0x3c')](_0x3bff6d[_0x8847('0x30')][_0x8847('0x3c')]);_0x172a56[_0x8847('0x3d')]=qs['filters'](_[_0x8847('0x3e')](_0x3bff6d[_0x8847('0x30')],_0x2dd92d[_0x8847('0x36')]));_0x172a56[_0x8847('0x3d')]['OpenchannelInteractionId']=_0x56f3c8['id'];if(_0x3bff6d[_0x8847('0x30')]['filter']){_0x172a56[_0x8847('0x3d')]=_[_0x8847('0x91')](_0x172a56['where'],{'$or':_['map'](_0x172a56[_0x8847('0x38')],function(_0x159718){var _0x5606ba={};_0x5606ba[_0x159718]={'$like':'%'+_0x3bff6d['query'][_0x8847('0x7b')]+'%'};return _0x5606ba;})});}if(_0x3bff6d['query']['$gte']){var _0x189da5=_0x3bff6d[_0x8847('0x30')]['$gte'][_0x8847('0x5d')](',');var _0x8c5cb9={};_0x8c5cb9[_0x189da5[0x0]]={'$gte':moment(_0x189da5[0x1])[_0x8847('0xb4')](_0x8847('0xb5'))};_0x172a56['where']=_['merge'](_0x172a56['where'],_0x8c5cb9);}_0x172a56=_[_0x8847('0x91')]({},_0x172a56,_0x3bff6d[_0x8847('0xac')]);return db[_0x8847('0xb0')][_0x8847('0x17')]({'where':_0x172a56['where']})[_0x8847('0x1b')](function(_0x5ca5be){_0x200f44[_0x8847('0x17')]=_0x5ca5be;if(_0x3bff6d[_0x8847('0x30')][_0x8847('0xaa')]){_0x172a56[_0x8847('0xab')]=[{'all':!![]}];}return db[_0x8847('0xb0')][_0x8847('0xb6')](_0x172a56);})[_0x8847('0x1b')](function(_0x5d0504){_0x200f44[_0x8847('0xa7')]=_0x5d0504;return _0x200f44;});}})[_0x8847('0x1b')](respondWithFilteredResult(_0x4b912a,_0x172a56))['catch'](handleError(_0x4b912a,null));};exports[_0x8847('0xb7')]=function(_0x194ddd,_0x54befd){return db['OpenchannelInteraction'][_0x8847('0x57')]({'where':{'id':_0x194ddd[_0x8847('0xa8')]['id']}})[_0x8847('0x1b')](handleEntityNotFound(_0x54befd,null))[_0x8847('0x1b')](function(_0x106b14){if(_0x106b14){return _0x106b14['setTags'](_0x194ddd['body'][_0x8847('0xb1')],_[_0x8847('0xb2')](_0x194ddd[_0x8847('0x69')],[_0x8847('0xb1'),'id'])||{})[_0x8847('0xb8')](function(){return db[_0x8847('0xb9')][_0x8847('0xb6')]({'attributes':['id',_0x8847('0x1e'),_0x8847('0xba')],'where':{'id':_0x194ddd[_0x8847('0x69')][_0x8847('0xb1')]}});})[_0x8847('0x1b')](function(_0x596227){socket[_0x8847('0xbb')]('openchannelInteractionTags:save',{'id':Number(_0x194ddd[_0x8847('0xa8')]['id']),'tags':_0x596227||[]});return{'id':Number(_0x194ddd[_0x8847('0xa8')]['id']),'tags':_0x596227||[]};});}})[_0x8847('0x1b')](respondWithResult(_0x54befd,null))['catch'](handleError(_0x54befd,null));};exports[_0x8847('0xbc')]=function(_0x4ad6c7,_0x193801){return db[_0x8847('0x31')]['find']({'where':{'id':_0x4ad6c7[_0x8847('0xa8')]['id']}})[_0x8847('0x1b')](handleEntityNotFound(_0x193801,null))[_0x8847('0x1b')](function(_0x1095c1){if(_0x1095c1){return _0x1095c1[_0x8847('0xbc')](_0x4ad6c7[_0x8847('0x30')][_0x8847('0xb1')]);}})[_0x8847('0x1b')](respondWithStatusCode(_0x193801,null))[_0x8847('0x26')](handleError(_0x193801,null));};exports[_0x8847('0xbd')]=function(_0x1e633c,_0x1e4165){var _0x36d906=moment()[_0x8847('0xbe')]()[_0x8847('0x90')]();var _0x46b5dc=path[_0x8847('0xbf')](config[_0x8847('0xc0')],_0x8847('0xc1'),_0x8847('0xc2'),_0x8847('0xc3'));var _0x2fe2f4=path[_0x8847('0xbf')](config[_0x8847('0xc0')],_0x8847('0xc1'),_0x8847('0xc2'),'attachments');var _0x34b46d=path[_0x8847('0xbf')](_0x46b5dc,_0x36d906);var _0x50c879=util['format'](_0x8847('0xc4'),_0x1e633c[_0x8847('0xa8')]['id'],_0x36d906);var _0x1b26d0=path[_0x8847('0xbf')](_0x46b5dc,_0x50c879);var _0xef692=[];_0xef692[_0x8847('0x25')]({'model':db['User'],'as':'User','attributes':['id',_0x8847('0x21')],'raw':!![]});_0xef692[_0x8847('0x25')]({'model':db['CmContact'],'as':_0x8847('0x5b'),'attributes':['id',_0x8847('0xc5'),_0x8847('0xc6')],'raw':!![]});if(_0x1e633c[_0x8847('0x30')][_0x8847('0xc7')]){_0xef692[_0x8847('0x25')]({'model':db[_0x8847('0xc8')],'as':_0x8847('0xc8'),'raw':!![]});}var _0x36062a=[{'model':db[_0x8847('0xb0')],'as':_0x8847('0xc9'),'attributes':['id','body',_0x8847('0x70'),_0x8847('0xca'),'secret',_0x8847('0x76')],'include':_0xef692}];_0x36062a['push']({'model':db[_0x8847('0xcb')],'as':_0x8847('0xcc'),'attributes':['id',_0x8847('0x1e')]});_0x36062a['push']({'model':db[_0x8847('0xcd')],'as':_0x8847('0xce'),'attributes':['id','fullname']});return db[_0x8847('0x31')][_0x8847('0x57')]({'where':{'id':_0x1e633c[_0x8847('0xa8')]['id']},'include':_0x36062a})[_0x8847('0x1b')](handleEntityNotFound(_0x1e4165,null))[_0x8847('0x1b')](function(_0xb3b24e){if(_0xb3b24e){var _0x1a99b9=_0xb3b24e[_0x8847('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x34b46d);var _0x4c2bf1={'channel':'Openchannel','account':_0x1a99b9[_0x8847('0xcc')][_0x8847('0x1e')],'agent':_0x1a99b9['Owner']?_0x1a99b9[_0x8847('0xce')][_0x8847('0x21')]:_0x8847('0xd0'),'createdAt':moment(_0x1a99b9[_0x8847('0x70')])[_0x8847('0xb4')](_0x8847('0xb5'))[_0x8847('0x90')](),'closedAt':_0x1a99b9[_0x8847('0x2b')]?moment(_0x1a99b9[_0x8847('0xd1')])[_0x8847('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8847('0x90')]():'','disposition':_0x1a99b9[_0x8847('0xd2')],'visibility':_0x1a99b9[_0x8847('0xd3')]?'Public':_0x8847('0xd4'),'messages':_(_0x1a99b9[_0x8847('0xc9')])[_0x8847('0x7b')]({'secret':![]})[_0x8847('0x20')](function(_0x28743a){if(_0x28743a[_0x8847('0xc8')]){var _0x427514=path[_0x8847('0xbf')](_0x2fe2f4,_0x28743a[_0x8847('0xc8')][_0x8847('0xd5')]);if(fs[_0x8847('0xd6')](_0x427514)){fs['createReadStream'](_0x427514)[_0x8847('0xd7')](fs[_0x8847('0xd8')](path[_0x8847('0xbf')](_0x34b46d,_0x28743a[_0x8847('0xc8')][_0x8847('0xd5')])));}}return{'date':moment(_0x28743a[_0x8847('0x70')])[_0x8847('0xb4')](_0x8847('0xb5'))[_0x8847('0x90')](),'sender':_0x28743a[_0x8847('0xca')]===_0x8847('0xd9')?_0x28743a[_0x8847('0xcd')]?_0x28743a['User'][_0x8847('0x21')]:_0x8847('0xda'):_0x28743a[_0x8847('0x5b')][_0x8847('0xc5')]+(_0x28743a[_0x8847('0x5b')]['lastName']?'\x20'+_0x28743a['Contact'][_0x8847('0xc6')]:''),'body':_0x28743a[_0x8847('0xc8')]?_0x28743a['Attachment'][_0x8847('0xd5')]:_0x28743a[_0x8847('0x69')],'direction':_0x28743a['direction']===_0x8847('0xd9')?'A':'C','secret':_0x28743a[_0x8847('0xdb')],'read':_0x28743a['read'],'attachment':_0x28743a[_0x8847('0xc8')]};})[_0x8847('0x60')]()};return ejs[_0x8847('0xdc')](path[_0x8847('0xbf')](config[_0x8847('0xc0')],'server','views',_0x8847('0xdd')),{'interaction':_0x4c2bf1})[_0x8847('0x1b')](function(_0x24fd2c){var _0x39838e=path[_0x8847('0xbf')](_0x34b46d,_0x8847('0xde')+_0x1a99b9['id']+'-'+_0x36d906+_0x8847('0xdf'));var _0x8eaafd={'path':_0x39838e,'channel':_0x8847('0xe0'),'interactionId':_0x1a99b9['id']};return pdf[_0x8847('0xe1')](_0x24fd2c,_0x8eaafd);})[_0x8847('0x1b')](function(){return new Promise(function(_0x505a96,_0x31d83a){zipdir(_0x34b46d,{'saveTo':_0x1b26d0},function(_0x44ec3e,_0x5074d4){if(_0x44ec3e)return _0x31d83a(_0x44ec3e);return _0x505a96(_0x5074d4);});})[_0x8847('0x1b')](function(){return new Promise(function(_0x3e09f9,_0x431713){rimraf(_0x34b46d,function(_0x13c263){if(_0x13c263)_0x431713(_0x13c263);return _0x3e09f9();});});})[_0x8847('0x1b')](function(){return _0x1e4165[_0x8847('0xbd')](_0x1b26d0,_0x50c879,function(_0x220b75){if(_0x220b75){logger['error'](_0x8847('0xe2'),_0x220b75);}else{fs[_0x8847('0xe3')](_0x1b26d0);}});});});}else{return _0x1e4165[_0x8847('0x10')](0xc8);}})[_0x8847('0x26')](handleError(_0x1e4165,null));}; \ No newline at end of file +var _0xd450=['OpenchannelMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','Public','Private','basename','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','sendStatus','error','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','closed','UserId','answered','total','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','options','create','body','addMessage'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xd450,0x12f));var _0x0d45=function(_0x5c7f67,_0xfb218c){_0x5c7f67=_0x5c7f67-0x0;var _0x41a4be=_0xd450[_0x5c7f67];return _0x41a4be;};'use strict';var emlformat=require(_0x0d45('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d45('0x1'));var rp=require(_0x0d45('0x2'));var moment=require(_0x0d45('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0d45('0x4'));var sox=require(_0x0d45('0x5'));var csv=require(_0x0d45('0x6'));var ejs=require(_0x0d45('0x7'));var fs=require('fs');var fs_extra=require(_0x0d45('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d45('0x9'));var jsforce=require(_0x0d45('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0d45('0x6'));var querystring=require(_0x0d45('0xb'));var Papa=require('papaparse');var Redis=require(_0x0d45('0xc'));var authService=require(_0x0d45('0xd'));var qs=require(_0x0d45('0xe'));var as=require(_0x0d45('0xf'));var pdf=require(_0x0d45('0x10'));var hardwareService=require(_0x0d45('0x11'));var logger=require(_0x0d45('0x12'))(_0x0d45('0x13'));var utils=require(_0x0d45('0x14'));var config=require(_0x0d45('0x15'));var licenseUtil=require(_0x0d45('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0d45('0x17'),'port':0x18eb});var socket=require(_0x0d45('0x18'))(new Redis(config[_0x0d45('0x19')]));require(_0x0d45('0x1a'))[_0x0d45('0x1b')](socket);function respondWithStatusCode(_0x48070f,_0x79cd68){_0x79cd68=_0x79cd68||0xcc;return function(_0x48dd6d){if(_0x48dd6d){return _0x48070f['sendStatus'](_0x79cd68);}return _0x48070f[_0x0d45('0x1c')](_0x79cd68)[_0x0d45('0x1d')]();};}function respondWithResult(_0x3fdddd,_0xa21c04){_0xa21c04=_0xa21c04||0xc8;return function(_0x54dd15){if(_0x54dd15){return _0x3fdddd[_0x0d45('0x1c')](_0xa21c04)[_0x0d45('0x1e')](_0x54dd15);}};}function respondWithFilteredResult(_0x21e760,_0x502097){return function(_0x3dfb8d){if(_0x3dfb8d){var _0x539149=typeof _0x502097[_0x0d45('0x1f')]===_0x0d45('0x20')&&typeof _0x502097[_0x0d45('0x21')]==='undefined';var _0x534f67=_0x3dfb8d['count'];var _0x42c373=_0x539149?0x0:_0x502097['offset'];var _0x5d3985=_0x539149?_0x3dfb8d['count']:_0x502097[_0x0d45('0x1f')]+_0x502097['limit'];var _0x40824e;if(_0x5d3985>=_0x534f67){_0x5d3985=_0x534f67;_0x40824e=0xc8;}else{_0x40824e=0xce;}_0x21e760['status'](_0x40824e);return _0x21e760[_0x0d45('0x22')]('Content-Range',_0x42c373+'-'+_0x5d3985+'/'+_0x534f67)['json'](_0x3dfb8d);}return null;};}function patchUpdates(_0x1428ce){return function(_0x2458a8){try{jsonpatch[_0x0d45('0x23')](_0x2458a8,_0x1428ce,!![]);}catch(_0x2b7186){return BPromise[_0x0d45('0x24')](_0x2b7186);}return _0x2458a8['save']();};}function saveUpdates(_0x5ae56d,_0x22a26f){return function(_0x4c7897){if(_0x4c7897){return _0x4c7897[_0x0d45('0x25')](_0x5ae56d)[_0x0d45('0x26')](function(_0xb21f12){return _0xb21f12;});}return null;};}function removeEntity(_0x16c35c,_0x14f279){return function(_0x1ec7b8){if(_0x1ec7b8){return _0x1ec7b8[_0x0d45('0x27')]()[_0x0d45('0x26')](function(){_0x16c35c[_0x0d45('0x1c')](0xcc)[_0x0d45('0x1d')]();});}};}function handleEntityNotFound(_0x4ad7b8,_0x4aca0b){return function(_0xa8d40b){if(!_0xa8d40b){_0x4ad7b8[_0x0d45('0x28')](0x194);}return _0xa8d40b;};}function handleError(_0x336f7e,_0x293a6c){_0x293a6c=_0x293a6c||0x1f4;return function(_0x3e1754){logger[_0x0d45('0x29')](_0x3e1754['stack']);if(_0x3e1754['name']){delete _0x3e1754['name'];}_0x336f7e['status'](_0x293a6c)[_0x0d45('0x2a')](_0x3e1754);};}function getInteractionUsers(_0x193ee0,_0x1080cf){return new BPromise(function(_0x108be7,_0x57908c){try{if(_0x1080cf[_0x193ee0['id']]){_0x193ee0[_0x0d45('0x2b')]=_[_0x0d45('0x2c')](_0x1080cf[_0x193ee0['id']],function(_0x1528bf){return{'id':_0x1528bf['id'],'fullname':_0x1528bf[_0x0d45('0x2d')]};});}}catch(_0x56fd2d){_0x57908c(_0x56fd2d);}_0x108be7(_0x193ee0);});}function getInteractionTags(_0xc67ea2,_0x3a713d){return new BPromise(function(_0x1b96b0,_0x10b65e){try{if(_0xc67ea2[_0x0d45('0x2e')]){_0xc67ea2[_0x0d45('0x2f')]=[];_0xc67ea2['TagIds']['split'](',')[_0x0d45('0x30')](function(_0x1ad915){_0xc67ea2[_0x0d45('0x2f')][_0x0d45('0x31')](_0x3a713d[_0x1ad915]);});}delete _0xc67ea2[_0x0d45('0x2e')];}catch(_0x275ae1){_0x10b65e(_0x275ae1);}_0x1b96b0(_0xc67ea2);});}function updateOpenchannelInteraction(_0x18b66c,_0x10de3a,_0x217c9b){return new BPromise(function(_0x59c778,_0x21deb4){return getInteractionUsers(_0x18b66c,_0x217c9b)[_0x0d45('0x26')](function(_0x220de2){return getInteractionTags(_0x220de2,_0x10de3a);})['then'](function(_0x3ea731){return getStateInteraction(_0x3ea731);})[_0x0d45('0x26')](function(_0x5638a7){_0x59c778(_0x5638a7);})[_0x0d45('0x32')](function(_0x173879){_0x21deb4(_0x173879);});});}function getStateInteraction(_0x515efa){return new BPromise(function(_0x290c02){_0x515efa[_0x0d45('0x33')]=0x0;_0x515efa[_0x0d45('0x34')]=0x0;_0x515efa['answered']=0x0;_0x515efa[_0x0d45('0x35')]=0x0;_0x515efa['total']=0x0;if(!_0x515efa[_0x0d45('0x36')]&&!_0x515efa[_0x0d45('0x37')]){_0x515efa[_0x0d45('0x33')]+=0x1;}if(!_0x515efa[_0x0d45('0x36')]&&_0x515efa[_0x0d45('0x37')]){_0x515efa[_0x0d45('0x34')]+=0x1;if(_0x515efa[_0x0d45('0x33')]){_0x515efa[_0x0d45('0x33')]-=0x1;}}if(_0x515efa[_0x0d45('0x36')]&&_0x515efa[_0x0d45('0x37')]){_0x515efa[_0x0d45('0x38')]+=0x1;if(_0x515efa[_0x0d45('0x34')]){_0x515efa[_0x0d45('0x34')]-=0x1;}}if(_0x515efa[_0x0d45('0x36')]&&!_0x515efa['UserId']){_0x515efa[_0x0d45('0x35')]+=0x1;if(_0x515efa[_0x0d45('0x33')]){_0x515efa[_0x0d45('0x33')]-=0x1;}}_0x515efa[_0x0d45('0x39')]+=0x1;_0x290c02(_0x515efa);});}exports[_0x0d45('0x3a')]=function(_0x55fd4b,_0x125a0e){var _0x24457f={},_0x16faf9={},_0x37c2f4={'count':0x0,'rows':[]};var _0x443ad7=_[_0x0d45('0x2c')](db[_0x0d45('0x3b')][_0x0d45('0x3c')],function(_0x176537){return{'name':_0x176537[_0x0d45('0x3d')],'type':_0x176537[_0x0d45('0x3e')]['key']};});_0x16faf9[_0x0d45('0x3f')]=_[_0x0d45('0x2c')](_0x443ad7,_0x0d45('0x40'));_0x16faf9[_0x0d45('0x41')]=_[_0x0d45('0x42')](_0x55fd4b[_0x0d45('0x41')]);_0x16faf9[_0x0d45('0x43')]=_[_0x0d45('0x44')](_0x16faf9[_0x0d45('0x3f')],_0x16faf9[_0x0d45('0x41')]);_0x24457f['attributes']=_[_0x0d45('0x44')](_0x16faf9[_0x0d45('0x3f')],qs['fields'](_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x45')]));_0x24457f['attributes']=_0x24457f[_0x0d45('0x46')][_0x0d45('0x47')]?_0x24457f[_0x0d45('0x46')]:_0x16faf9[_0x0d45('0x3f')];if(!_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x48')](_0x0d45('0x49'))){_0x24457f['limit']=qs[_0x0d45('0x21')](_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x21')]);_0x24457f[_0x0d45('0x1f')]=qs['offset'](_0x55fd4b['query'][_0x0d45('0x1f')]);}_0x24457f[_0x0d45('0x4a')]=qs['sort'](_0x55fd4b['query'][_0x0d45('0x4b')]);_0x24457f['where']=qs[_0x0d45('0x43')](_[_0x0d45('0x4c')](_0x55fd4b[_0x0d45('0x41')],_0x16faf9[_0x0d45('0x43')]),_0x443ad7);var _0x3ace7a=[];var _0x4adcf4=squel[_0x0d45('0x4d')]()[_0x0d45('0x4e')]('id')['field'](_0x0d45('0x40'))['field']('color')[_0x0d45('0x4f')]('tools_tags');var _0x1e8782=squel['select']()[_0x0d45('0x4e')](_0x0d45('0x50'))[_0x0d45('0x4e')](_0x0d45('0x51'))[_0x0d45('0x4e')](_0x0d45('0x52'))[_0x0d45('0x4f')](_0x0d45('0x53'),'ui')[_0x0d45('0x54')](_0x0d45('0x55'),'u',_0x0d45('0x56'));var _0x411aa9=squel[_0x0d45('0x4d')]()['from'](_0x0d45('0x57'),'i')[_0x0d45('0x54')](_0x0d45('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0d45('0x54')](_0x0d45('0x55'),'o',_0x0d45('0x59'))[_0x0d45('0x54')](_0x0d45('0x5a'),'a',_0x0d45('0x5b'))[_0x0d45('0x54')](_0x0d45('0x5c'),'me',_0x0d45('0x5d'))['left_join'](_0x0d45('0x5e'),'it',_0x0d45('0x5f'))[_0x0d45('0x54')](_0x0d45('0x60'),'t','t.id\x20=\x20it.TagId');var _0x469806=squel['expr']();var _0x16cb55=[];var _0x1f0b0f=squel[_0x0d45('0x61')]();var _0xb551f5;if(_0x55fd4b['query'][_0x0d45('0x62')]){_0xb551f5=as[_0x0d45('0x63')](_0x55fd4b['query']['search']);var _0x36b6bf=_0xb551f5[_0x0d45('0x64')];for(var _0x58c3c7=0x0;_0x58c3c7<_0xb551f5[_0x0d45('0x65')]['length'];_0x58c3c7++){var _0x271602=_0xb551f5[_0x0d45('0x65')][_0x58c3c7];var _0x575c0d='i';var _0x1949f7=_[_0x0d45('0x66')](_0x443ad7,['name',_0x271602[_0x0d45('0x4e')]]);if(!_0x1949f7){switch(_0x271602[_0x0d45('0x4e')]){case _0x0d45('0x67'):if(_0x271602[_0x0d45('0x68')]==0x1){_0x411aa9[_0x0d45('0x69')]('`'+_0x271602['field']+'`\x20=\x200');}else{_0x411aa9[_0x0d45('0x69')]('`'+_0x271602[_0x0d45('0x4e')]+_0x0d45('0x6a'));}break;case _0x0d45('0x6b'):if(_0x271602['operator']===_0x0d45('0x6c')){if(_0x271602[_0x0d45('0x68')][_0x0d45('0x6d')]('\x20')[_0x0d45('0x47')]>0x1){_0x469806[_0x36b6bf](_0x0d45('0x6e'),qs['getFullTextValue'](_0x271602[_0x0d45('0x68')]),null);}else{var _0x2d0b07='%'+_0x271602[_0x0d45('0x68')]+'%';_0x469806[_0x36b6bf](_0x0d45('0x6f'),_0x2d0b07,_0x2d0b07,_0x2d0b07);}}else{_0x1949f7=_[_0x0d45('0x66')](_0x443ad7,[_0x0d45('0x40'),'ContactId']);_0x271602[_0x0d45('0x4e')]=_0x0d45('0x70');_0x127d5b=as[_0x0d45('0x71')](_0x575c0d,_0x1949f7[_0x0d45('0x3e')],_0x271602);_0x469806[_0x36b6bf](_0x127d5b[_0x0d45('0x72')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x73')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x1d')]);}break;case _0x0d45('0x74'):var _0x39c934=_0x271602[_0x0d45('0x68')][_0x0d45('0x6d')](',')['map'](function(_0x5ebb88){return Number(_0x5ebb88);});_0x39c934[_0x0d45('0x30')](function(_0x2fbab8){_0x1f0b0f['or'](_0x0d45('0x75'),'%,'+_0x2fbab8+',%');});_0x16cb55=_[_0x0d45('0x76')](_0x16cb55,_0x39c934);break;case _0x0d45('0x77'):if(_0x271602[_0x0d45('0x78')]===_0x0d45('0x6c')){_0x469806[_0x36b6bf](_0x0d45('0x79'),'%'+_0x271602['value']+'%',null);}else{_0x1949f7=_[_0x0d45('0x66')](_0x443ad7,[_0x0d45('0x40'),'UserId']);_0x271602[_0x0d45('0x4e')]=_0x0d45('0x37');_0x127d5b=as[_0x0d45('0x71')](_0x575c0d,_0x1949f7['type'],_0x271602);_0x469806[_0x36b6bf](_0x127d5b[_0x0d45('0x72')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x73')],_0x127d5b[_0x0d45('0x68')]['end']);}break;case'body':_0x127d5b=as[_0x0d45('0x71')]('me',null,_0x271602);_0x469806[_0x36b6bf](_0x127d5b['text'],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x73')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x1d')]);break;}}else{var _0x127d5b=as[_0x0d45('0x71')](_0x575c0d,_0x1949f7[_0x0d45('0x3e')],_0x271602);_0x469806[_0x36b6bf](_0x127d5b[_0x0d45('0x72')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x73')],_0x127d5b[_0x0d45('0x68')][_0x0d45('0x1d')]);}}}else{var _0x1105c9=_(_0x55fd4b['query'])['keys']()[_0x0d45('0x2c')](function(_0xb59114){return _[_0x0d45('0x7a')](_0x443ad7,[_0x0d45('0x40'),_0xb59114])?_0xb59114:undefined;})[_0x0d45('0x7b')]()[_0x0d45('0x68')]();if(!_[_0x0d45('0x7c')](_0x1105c9)){_0x1105c9[_0x0d45('0x30')](function(_0x69e8e1){if(_0x69e8e1==='OpenchannelAccountId'){_0x411aa9['where'](_0x0d45('0x7d'),[][_0x0d45('0x7e')](_0x55fd4b[_0x0d45('0x41')][_0x69e8e1]));}else if(_0x69e8e1===_0x0d45('0x7f')){var _0x3491cc=JSON[_0x0d45('0x80')](_0x55fd4b[_0x0d45('0x41')][_0x69e8e1])[_0x0d45('0x81')];var _0x560c97=JSON[_0x0d45('0x80')](_0x55fd4b['query'][_0x69e8e1])[_0x0d45('0x82')];_0x411aa9[_0x0d45('0x83')](_0x0d45('0x84'),_0x3491cc,_0x560c97);}else{if(_0x55fd4b[_0x0d45('0x41')][_0x69e8e1]===_0x0d45('0x85')){_0x411aa9[_0x0d45('0x83')]('i.'+_0x69e8e1+_0x0d45('0x86'));}else{_0x411aa9[_0x0d45('0x83')]('i.'+_0x69e8e1+_0x0d45('0x87'),_0x55fd4b[_0x0d45('0x41')][_0x69e8e1]);}}});}if(_0x55fd4b['query'][_0x0d45('0x88')]){if(_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x88')]==0x1){_0x411aa9[_0x0d45('0x69')]('`unreadMessages`\x20=\x200');}else{_0x411aa9[_0x0d45('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x55fd4b['query']['tag']){_0x16cb55=_[_0x0d45('0x89')](_0x55fd4b[_0x0d45('0x41')]['tag'])?_0x55fd4b[_0x0d45('0x41')]['tag']:new Array(_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x8a')]);_0x16cb55[_0x0d45('0x30')](function(_0x557452){_0x1f0b0f['or'](_0x0d45('0x75'),'%,'+_0x557452+',%');});}if(_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x8b')]){var _0x575bd0=_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x8b')][_0x0d45('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0d45('0x8d')](_0x575bd0)){_0x469806['or'](_0x0d45('0x8e'),_0x575bd0+'%');}else{_0x469806['or'](_0x0d45('0x8f'),qs[_0x0d45('0x90')](_0x575bd0))['or']('i.from\x20LIKE\x20?',_0x575bd0+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x575bd0+'%');}}}_0x411aa9['where'](_0x469806);_0x411aa9['group'](_0x0d45('0x91'));var _0x3a0de0={'type':db['Sequelize'][_0x0d45('0x92')][_0x0d45('0x93')],'raw':!![]};var _0x1053d5=_0x411aa9['clone']();_0x1053d5[_0x0d45('0x4e')](_0x0d45('0x91'));_0x1053d5['field'](_0x0d45('0x94'),_0x0d45('0x67'));if(_0x24457f['order']){_0x24457f[_0x0d45('0x4a')][_0x0d45('0x30')](function(_0x17f1c3){var _0x51469e=_0x17f1c3[0x0]===_0x0d45('0x95')?_0x17f1c3[0x0]:'i.'+_0x17f1c3[0x0];_0x411aa9[_0x0d45('0x4a')](_0x51469e,_0x17f1c3[0x1]===_0x0d45('0x96')?![]:!![]);});}if(!_[_0x0d45('0x7c')](_0x16cb55)){_0x411aa9[_0x0d45('0x69')](_0x1f0b0f);_0x1053d5[_0x0d45('0x83')](_0x0d45('0x97'),_0x16cb55);}BPromise[_0x0d45('0x98')]()[_0x0d45('0x26')](function(){if(!_0xb551f5){if(_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x99')])return;_0x1053d5['where'](_0x0d45('0x9a'));_0x411aa9[_0x0d45('0x83')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x55fd4b['user']['role']!==_0x0d45('0x9b'))return;return _0x55fd4b[_0x0d45('0x9c')][_0x0d45('0x9d')]({'attributes':['id'],'raw':!![]})[_0x0d45('0x26')](function(_0x2b4ec4){if(_[_0x0d45('0x7c')](_0x2b4ec4)){_0x1053d5[_0x0d45('0x83')](_0x0d45('0x9e'));_0x411aa9[_0x0d45('0x83')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1053d5[_0x0d45('0x83')](_0x0d45('0x7d'),_[_0x0d45('0x2c')](_0x2b4ec4,'id'));_0x411aa9[_0x0d45('0x83')](_0x0d45('0x7d'),_[_0x0d45('0x2c')](_0x2b4ec4,'id'));}});})[_0x0d45('0x26')](function(){if(_0x55fd4b[_0x0d45('0x9c')][_0x0d45('0x9f')]===_0x0d45('0x9b')&&!_0xb551f5&&!_0x55fd4b['query'][_0x0d45('0x99')])return[];return db[_0x0d45('0xa0')][_0x0d45('0x41')](_0x1053d5[_0x0d45('0xa1')](),_0x3a0de0);})['then'](function(_0x159d39){_0x37c2f4[_0x0d45('0xa2')]=_0x159d39[_0x0d45('0x47')];if(_0x37c2f4[_0x0d45('0xa2')]===0x0)return[];return db['sequelize']['query'](_0x4adcf4[_0x0d45('0xa1')](),_0x3a0de0)[_0x0d45('0x26')](function(_0x32e585){_0x3ace7a=_[_0x0d45('0xa3')](_0x32e585,'id');_0x3a0de0=_[_0x0d45('0xa4')](_0x3a0de0,{'model':db[_0x0d45('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55fd4b[_0x0d45('0x41')][_0x0d45('0x45')]){_0x24457f['attributes']['forEach'](function(_0x4cd0e4){_0x411aa9[_0x0d45('0x4e')]('i.'+_0x4cd0e4);});}else{_0x411aa9[_0x0d45('0x4e')](_0x0d45('0x94'),_0x0d45('0x67'));_0x411aa9['field']('a.key',_0x0d45('0xa5'));_0x411aa9['field'](_0x0d45('0xa6'),_0x0d45('0xa7'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xa8'),_0x0d45('0x95'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xa9'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xaa'),_0x0d45('0xab'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xac'),_0x0d45('0xad'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xae'),_0x0d45('0xaf'));_0x411aa9['field'](_0x0d45('0xb0'),_0x0d45('0xb1'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xb2'),_0x0d45('0xb3'));_0x411aa9[_0x0d45('0x4e')]('c.fax',_0x0d45('0xb4'));_0x411aa9[_0x0d45('0x4e')]('o.fullname',_0x0d45('0xb5'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xb6'),_0x0d45('0xb7'));_0x411aa9[_0x0d45('0x4e')](_0x0d45('0xb8'),_0x0d45('0x2e'));}if(_0x24457f[_0x0d45('0x21')])_0x411aa9[_0x0d45('0x21')](_0x24457f[_0x0d45('0x21')]);if(_0x24457f[_0x0d45('0x1f')])_0x411aa9[_0x0d45('0x1f')](_0x24457f['offset']);return db[_0x0d45('0xa0')][_0x0d45('0x41')](_0x411aa9[_0x0d45('0xa1')](),_0x3a0de0);})[_0x0d45('0x26')](function(_0x5284e5){if(_0x5284e5[_0x0d45('0x47')]>0x0)_0x1e8782[_0x0d45('0x83')](_0x0d45('0xb9'),_['map'](_0x5284e5,'id'));return db[_0x0d45('0xa0')]['query'](_0x1e8782[_0x0d45('0xa1')](),_0x3a0de0)['then'](function(_0x42460b){var _0x1c5f97=_[_0x0d45('0xba')](_0x42460b,_0x0d45('0xbb'));var _0x5127e0=[];_0x5284e5['forEach'](function(_0x177a57){_0x5127e0[_0x0d45('0x31')](updateOpenchannelInteraction(_0x177a57,_0x3ace7a,_0x1c5f97));});return BPromise[_0x0d45('0xbc')](_0x5127e0);});});})[_0x0d45('0x26')](function(_0x37e181){_0x37c2f4[_0x0d45('0xbd')]=_0x37e181;return _0x37c2f4;})['then'](respondWithFilteredResult(_0x125a0e,_0x24457f))[_0x0d45('0x32')](handleError(_0x125a0e,null));};exports[_0x0d45('0xbe')]=function(_0x131a2d,_0x2ace63){var _0x5d481e={};if(_0x131a2d['query'][_0x0d45('0x3e')]&&_0x131a2d[_0x0d45('0x41')][_0x0d45('0x3e')]==='from'){_0x5d481e[_0x0d45('0x4f')]=_0x131a2d[_0x0d45('0xbf')]['id'];}else{_0x5d481e['id']=_0x131a2d[_0x0d45('0xbf')]['id'];}var _0x1414e4={'raw':![],'where':_0x5d481e},_0x46b56b={};_0x46b56b[_0x0d45('0x3f')]=_[_0x0d45('0x42')](db[_0x0d45('0x3b')][_0x0d45('0x3c')]);_0x46b56b['query']=_[_0x0d45('0x42')](_0x131a2d[_0x0d45('0x41')]);_0x46b56b[_0x0d45('0x43')]=_['intersection'](_0x46b56b[_0x0d45('0x3f')],_0x46b56b[_0x0d45('0x41')]);_0x1414e4['attributes']=_[_0x0d45('0x44')](_0x46b56b[_0x0d45('0x3f')],qs['fields'](_0x131a2d[_0x0d45('0x41')]['fields']));_0x1414e4['attributes']=_0x1414e4[_0x0d45('0x46')]['length']?_0x1414e4[_0x0d45('0x46')]:_0x46b56b[_0x0d45('0x3f')];if(_0x131a2d['query'][_0x0d45('0xc0')]){_0x1414e4['include']=[{'all':!![]}];}_0x1414e4=_[_0x0d45('0xa4')]({},_0x1414e4,_0x131a2d[_0x0d45('0xc1')]);return db[_0x0d45('0x3b')][_0x0d45('0x66')](_0x1414e4)[_0x0d45('0x26')](handleEntityNotFound(_0x2ace63,null))[_0x0d45('0x26')](respondWithResult(_0x2ace63,null))[_0x0d45('0x32')](handleError(_0x2ace63,null));};exports[_0x0d45('0xc2')]=function(_0x50c8a7,_0x37c4eb){return db[_0x0d45('0x3b')]['create'](_0x50c8a7[_0x0d45('0xc3')],{})[_0x0d45('0x26')](respondWithResult(_0x37c4eb,0xc9))['catch'](handleError(_0x37c4eb,null));};exports['update']=function(_0x5745d1,_0xf77b94){if(_0x5745d1[_0x0d45('0xc3')]['id']){delete _0x5745d1[_0x0d45('0xc3')]['id'];}return db['OpenchannelInteraction'][_0x0d45('0x66')]({'where':{'id':_0x5745d1[_0x0d45('0xbf')]['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0xf77b94,null))[_0x0d45('0x26')](saveUpdates(_0x5745d1[_0x0d45('0xc3')],null))['then'](respondWithResult(_0xf77b94,null))[_0x0d45('0x32')](handleError(_0xf77b94,null));};exports[_0x0d45('0x27')]=function(_0x2f6fd7,_0xcfcc35){return db[_0x0d45('0x3b')][_0x0d45('0x66')]({'where':{'id':_0x2f6fd7[_0x0d45('0xbf')]['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0xcfcc35,null))[_0x0d45('0x26')](removeEntity(_0xcfcc35,null))['catch'](handleError(_0xcfcc35,null));};exports['describe']=function(_0x12f189,_0x20193c){return db[_0x0d45('0x3b')]['describe']()[_0x0d45('0x26')](respondWithResult(_0x20193c,null))[_0x0d45('0x32')](handleError(_0x20193c,null));};exports[_0x0d45('0xc4')]=function(_0x1f7c1d,_0x2d6843,_0x29cbbe){return db[_0x0d45('0xc5')][_0x0d45('0x66')]({'where':{'id':_0x1f7c1d[_0x0d45('0xbf')]['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0x2d6843,null))[_0x0d45('0x26')](function(_0x39838b){if(_0x39838b){return _0x39838b[_0x0d45('0xc4')](_0x1f7c1d[_0x0d45('0xc3')][_0x0d45('0xc6')],_['omit'](_0x1f7c1d[_0x0d45('0xc3')],[_0x0d45('0xc6'),'id'])||{});}})[_0x0d45('0x26')](respondWithResult(_0x2d6843,null))['catch'](handleError(_0x2d6843,null));};exports[_0x0d45('0xc7')]=function(_0x3b9db1,_0x176ea4,_0x5c82b4){var _0x293ab7={'raw':![],'where':{}};var _0x476f53={};var _0x218468={'count':0x0,'rows':[]};return db[_0x0d45('0x3b')]['findOne']({'where':{'id':_0x3b9db1[_0x0d45('0xbf')]['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0x176ea4,null))[_0x0d45('0x26')](function(_0x392ac1){if(_0x392ac1){_0x476f53[_0x0d45('0x3f')]=_[_0x0d45('0x42')](db[_0x0d45('0xc5')]['rawAttributes']);_0x476f53[_0x0d45('0x41')]=_['keys'](_0x3b9db1[_0x0d45('0x41')]);_0x476f53[_0x0d45('0x43')]=_[_0x0d45('0x44')](_0x476f53[_0x0d45('0x3f')],_0x476f53[_0x0d45('0x41')]);_0x293ab7['attributes']=_[_0x0d45('0x44')](_0x476f53[_0x0d45('0x3f')],qs[_0x0d45('0x45')](_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x45')]));_0x293ab7[_0x0d45('0x46')]=_0x293ab7[_0x0d45('0x46')][_0x0d45('0x47')]?_0x293ab7[_0x0d45('0x46')]:_0x476f53[_0x0d45('0x3f')];if(!_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x48')](_0x0d45('0x49'))){_0x293ab7['limit']=qs[_0x0d45('0x21')](_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x21')]);_0x293ab7['offset']=qs[_0x0d45('0x1f')](_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x1f')]);}_0x293ab7[_0x0d45('0x4a')]=qs[_0x0d45('0x4b')](_0x3b9db1['query'][_0x0d45('0x4b')]);_0x293ab7[_0x0d45('0x83')]=qs[_0x0d45('0x43')](_[_0x0d45('0x4c')](_0x3b9db1[_0x0d45('0x41')],_0x476f53[_0x0d45('0x43')]));_0x293ab7[_0x0d45('0x83')][_0x0d45('0xbb')]=_0x392ac1['id'];if(_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x8b')]){_0x293ab7[_0x0d45('0x83')]=_['merge'](_0x293ab7[_0x0d45('0x83')],{'$or':_[_0x0d45('0x2c')](_0x293ab7[_0x0d45('0x46')],function(_0xe66459){var _0x305599={};_0x305599[_0xe66459]={'$like':'%'+_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x8b')]+'%'};return _0x305599;})});}if(_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x81')]){var _0x391200=_0x3b9db1[_0x0d45('0x41')][_0x0d45('0x81')][_0x0d45('0x6d')](',');var _0x2971c3={};_0x2971c3[_0x391200[0x0]]={'$gte':moment(_0x391200[0x1])[_0x0d45('0xc8')](_0x0d45('0xc9'))};_0x293ab7[_0x0d45('0x83')]=_[_0x0d45('0xa4')](_0x293ab7[_0x0d45('0x83')],_0x2971c3);}_0x293ab7=_[_0x0d45('0xa4')]({},_0x293ab7,_0x3b9db1['options']);return db[_0x0d45('0xc5')][_0x0d45('0xa2')]({'where':_0x293ab7[_0x0d45('0x83')]})[_0x0d45('0x26')](function(_0x3151bd){_0x218468['count']=_0x3151bd;if(_0x3b9db1[_0x0d45('0x41')][_0x0d45('0xc0')]){_0x293ab7[_0x0d45('0xca')]=[{'all':!![]}];}return db[_0x0d45('0xc5')][_0x0d45('0xcb')](_0x293ab7);})[_0x0d45('0x26')](function(_0x4d6fcc){_0x218468[_0x0d45('0xbd')]=_0x4d6fcc;return _0x218468;});}})['then'](respondWithFilteredResult(_0x176ea4,_0x293ab7))[_0x0d45('0x32')](handleError(_0x176ea4,null));};exports[_0x0d45('0xcc')]=function(_0x282e2b,_0xcca609,_0x3722bc){return db['OpenchannelInteraction'][_0x0d45('0x66')]({'where':{'id':_0x282e2b['params']['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0xcca609,null))[_0x0d45('0x26')](function(_0x27261f){if(_0x27261f){return _0x27261f[_0x0d45('0xcd')](_0x282e2b['body'][_0x0d45('0xc6')],_[_0x0d45('0xce')](_0x282e2b['body'],[_0x0d45('0xc6'),'id'])||{})['spread'](function(){return db[_0x0d45('0x74')][_0x0d45('0xcb')]({'attributes':['id',_0x0d45('0x40'),_0x0d45('0xcf')],'where':{'id':_0x282e2b[_0x0d45('0xc3')][_0x0d45('0xc6')]}});})['then'](function(_0x49e3cd){socket[_0x0d45('0xd0')](_0x0d45('0xd1'),{'id':Number(_0x282e2b['params']['id']),'tags':_0x49e3cd||[]});return{'id':Number(_0x282e2b[_0x0d45('0xbf')]['id']),'tags':_0x49e3cd||[]};});}})['then'](respondWithResult(_0xcca609,null))['catch'](handleError(_0xcca609,null));};exports['removeTags']=function(_0x523b07,_0xcc4fc,_0x1d45ac){return db[_0x0d45('0x3b')]['find']({'where':{'id':_0x523b07[_0x0d45('0xbf')]['id']}})[_0x0d45('0x26')](handleEntityNotFound(_0xcc4fc,null))[_0x0d45('0x26')](function(_0x2adfe8){if(_0x2adfe8){return _0x2adfe8[_0x0d45('0xd2')](_0x523b07[_0x0d45('0x41')][_0x0d45('0xc6')]);}})['then'](respondWithStatusCode(_0xcc4fc,null))['catch'](handleError(_0xcc4fc,null));};exports[_0x0d45('0xd3')]=function(_0x127229,_0x4a6f89){var _0x3691ba=moment()[_0x0d45('0xd4')]()[_0x0d45('0xa1')]();var _0x521f4c=path[_0x0d45('0xd5')](config[_0x0d45('0xd6')],_0x0d45('0xd7'),_0x0d45('0xd8'),'tmp');var _0x4474c4=path['join'](config['root'],'server',_0x0d45('0xd8'),_0x0d45('0xd9'));var _0x56494a=path[_0x0d45('0xd5')](_0x521f4c,_0x3691ba);var _0x355734=util[_0x0d45('0xc8')](_0x0d45('0xda'),_0x127229[_0x0d45('0xbf')]['id'],_0x3691ba);var _0x48c1c2=path[_0x0d45('0xd5')](_0x521f4c,_0x355734);var _0x1f088b=[];_0x1f088b[_0x0d45('0x31')]({'model':db[_0x0d45('0x77')],'as':_0x0d45('0x77'),'attributes':['id',_0x0d45('0x2d')],'raw':!![]});_0x1f088b[_0x0d45('0x31')]({'model':db[_0x0d45('0xdb')],'as':_0x0d45('0x6b'),'attributes':['id',_0x0d45('0xdc'),_0x0d45('0xdd')],'raw':!![]});if(_0x127229['query'][_0x0d45('0xd9')]){_0x1f088b[_0x0d45('0x31')]({'model':db[_0x0d45('0xde')],'as':_0x0d45('0xde'),'raw':!![]});}var _0x272de0=[{'model':db[_0x0d45('0xc5')],'as':_0x0d45('0xdf'),'attributes':['id','body',_0x0d45('0x7f'),_0x0d45('0xe0'),_0x0d45('0xe1'),_0x0d45('0x88')],'include':_0x1f088b}];_0x272de0[_0x0d45('0x31')]({'model':db[_0x0d45('0xe2')],'as':_0x0d45('0xe3'),'attributes':['id',_0x0d45('0x40')]});_0x272de0['push']({'model':db[_0x0d45('0x77')],'as':_0x0d45('0xe4'),'attributes':['id',_0x0d45('0x2d')]});return db[_0x0d45('0x3b')][_0x0d45('0x66')]({'where':{'id':_0x127229[_0x0d45('0xbf')]['id']},'include':_0x272de0})['then'](handleEntityNotFound(_0x4a6f89,null))[_0x0d45('0x26')](function(_0x36724c){if(_0x36724c){var _0x1cdbd0=_0x36724c[_0x0d45('0xe5')]({'plain':!![]});fs[_0x0d45('0xe6')](_0x56494a);var _0x1803f6={'channel':_0x0d45('0xe7'),'account':_0x1cdbd0['Account'][_0x0d45('0x40')],'agent':_0x1cdbd0[_0x0d45('0xe4')]?_0x1cdbd0[_0x0d45('0xe4')][_0x0d45('0x2d')]:_0x0d45('0xe8'),'createdAt':moment(_0x1cdbd0[_0x0d45('0x7f')])[_0x0d45('0xc8')](_0x0d45('0xc9'))[_0x0d45('0xa1')](),'closedAt':_0x1cdbd0[_0x0d45('0x36')]?moment(_0x1cdbd0[_0x0d45('0xe9')])[_0x0d45('0xc8')](_0x0d45('0xc9'))[_0x0d45('0xa1')]():'','disposition':_0x1cdbd0['disposition'],'visibility':_0x1cdbd0['threadId']?_0x0d45('0xea'):_0x0d45('0xeb'),'messages':_(_0x1cdbd0['Messages'])['filter']({'secret':![]})[_0x0d45('0x2c')](function(_0x4fa0b7){if(_0x4fa0b7['Attachment']){var _0x4de818=path[_0x0d45('0xd5')](_0x4474c4,_0x4fa0b7[_0x0d45('0xde')][_0x0d45('0xec')]);if(fs['existsSync'](_0x4de818)){fs['createReadStream'](_0x4de818)[_0x0d45('0xed')](fs[_0x0d45('0xee')](path['join'](_0x56494a,_0x4fa0b7[_0x0d45('0xde')]['basename'])));}}return{'date':moment(_0x4fa0b7['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4fa0b7[_0x0d45('0xe0')]===_0x0d45('0xef')?_0x4fa0b7[_0x0d45('0x77')]?_0x4fa0b7[_0x0d45('0x77')][_0x0d45('0x2d')]:_0x0d45('0xf0'):_0x4fa0b7[_0x0d45('0x6b')][_0x0d45('0xdc')]+(_0x4fa0b7['Contact']['lastName']?'\x20'+_0x4fa0b7['Contact'][_0x0d45('0xdd')]:''),'body':_0x4fa0b7[_0x0d45('0xde')]?_0x4fa0b7[_0x0d45('0xde')][_0x0d45('0xec')]:_0x4fa0b7[_0x0d45('0xc3')],'direction':_0x4fa0b7[_0x0d45('0xe0')]==='out'?'A':'C','secret':_0x4fa0b7[_0x0d45('0xe1')],'read':_0x4fa0b7['read'],'attachment':_0x4fa0b7[_0x0d45('0xde')]};})[_0x0d45('0x68')]()};return ejs[_0x0d45('0xf1')](path[_0x0d45('0xd5')](config['root'],'server',_0x0d45('0xf2'),_0x0d45('0xf3')),{'interaction':_0x1803f6})[_0x0d45('0x26')](function(_0x54ae9b){var _0x37dc1e=path['join'](_0x56494a,_0x0d45('0xf4')+_0x1cdbd0['id']+'-'+_0x3691ba+_0x0d45('0xf5'));var _0x157c5b={'path':_0x37dc1e,'channel':_0x0d45('0xe7'),'interactionId':_0x1cdbd0['id']};return pdf[_0x0d45('0xf6')](_0x54ae9b,_0x157c5b);})[_0x0d45('0x26')](function(){return new BPromise(function(_0x2cc976,_0x355c22){zipdir(_0x56494a,{'saveTo':_0x48c1c2},function(_0x38b3a9,_0x28c9d6){if(_0x38b3a9)return _0x355c22(_0x38b3a9);return _0x2cc976(_0x28c9d6);});})['then'](function(){return new BPromise(function(_0x5e76a1,_0x111541){rimraf(_0x56494a,function(_0x54c86a){if(_0x54c86a)_0x111541(_0x54c86a);return _0x5e76a1();});});})[_0x0d45('0x26')](function(){return _0x4a6f89[_0x0d45('0xd3')](_0x48c1c2,_0x355734,function(_0x3b9492){if(_0x3b9492){console[_0x0d45('0xf7')](_0x0d45('0xf8'),_0x3b9492);}else{fs[_0x0d45('0xf9')](_0x48c1c2);}});});});}else{return _0x4a6f89[_0x0d45('0x28')](0xc8);}})[_0x0d45('0x32')](handleError(_0x4a6f89,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f7968c1..a465920 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 _0x1d03=['Users','map','findAll','then','unreadMessages','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','save','remove','getUsers','setDataValue'];(function(_0x4e5b60,_0x58b613){var _0x3b53bf=function(_0x55f793){while(--_0x55f793){_0x4e5b60['push'](_0x4e5b60['shift']());}};_0x3b53bf(++_0x58b613);}(_0x1d03,0x1ca));var _0x31d0=function(_0x1b5894,_0x4aa595){_0x1b5894=_0x1b5894-0x0;var _0x5d7ad8=_0x1d03[_0x1b5894];return _0x5d7ad8;};'use strict';var EventEmitter=require(_0x31d0('0x0'));var OpenchannelInteraction=require(_0x31d0('0x1'))['db'][_0x31d0('0x2')];var OpenchannelMessage=require(_0x31d0('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31d0('0x3'),'afterUpdate':'update','afterDestroy':_0x31d0('0x4')};function emitEvent(_0x1716c8){return function(_0x53da87,_0x1e1c55,_0x4f5417){_0x53da87[_0x31d0('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x57e8a4){_0x53da87[_0x31d0('0x6')](_0x31d0('0x7'),_0x57e8a4[_0x31d0('0x8')](function(_0x3e5bd1){return{'id':_0x3e5bd1['id']};}));return OpenchannelMessage[_0x31d0('0x9')]({'where':{'OpenchannelInteractionId':_0x53da87['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31d0('0xa')](function(_0x85f354){_0x53da87[_0x31d0('0x6')](_0x31d0('0xb'),_0x85f354['length']);OpenchannelInteractionEvents[_0x31d0('0xc')](_0x1716c8+':'+_0x53da87['id'],_0x53da87);OpenchannelInteractionEvents[_0x31d0('0xc')](_0x1716c8,_0x53da87);_0x4f5417(null);})[_0x31d0('0xd')](_0x4f5417(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x31d0('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa850=['setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','getUsers'];(function(_0x381563,_0x43e247){var _0x39dfcd=function(_0x3364c4){while(--_0x3364c4){_0x381563['push'](_0x381563['shift']());}};_0x39dfcd(++_0x43e247);}(_0xa850,0x107));var _0x0a85=function(_0x443d60,_0x1c5344){_0x443d60=_0x443d60-0x0;var _0xcd4e95=_0xa850[_0x443d60];return _0xcd4e95;};'use strict';var EventEmitter=require(_0x0a85('0x0'));var OpenchannelInteraction=require(_0x0a85('0x1'))['db'][_0x0a85('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0a85('0x3')](0x0);var events={'afterCreate':_0x0a85('0x4'),'afterUpdate':'update','afterDestroy':_0x0a85('0x5')};function emitEvent(_0x15f627){return function(_0x5deebf,_0xd778a,_0x20d934){_0x5deebf[_0x0a85('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x247861){_0x5deebf[_0x0a85('0x7')](_0x0a85('0x8'),_0x247861['map'](function(_0x3dcd19){return{'id':_0x3dcd19['id']};}));return OpenchannelMessage[_0x0a85('0x9')]({'where':{'OpenchannelInteractionId':_0x5deebf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0a85('0xa')](function(_0x3201f4){_0x5deebf[_0x0a85('0x7')](_0x0a85('0xb'),_0x3201f4[_0x0a85('0xc')]);OpenchannelInteractionEvents[_0x0a85('0xd')](_0x15f627+':'+_0x5deebf['id'],_0x5deebf);OpenchannelInteractionEvents[_0x0a85('0xd')](_0x15f627,_0x5deebf);_0x20d934(null);})[_0x0a85('0xe')](_0x20d934(null));};}for(var e in events){if(events[_0x0a85('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x0a85('0x10')](e,emitEvent(event));}}module[_0x0a85('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0f70533..53af580 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 _0x5ade=['exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes'];(function(_0x2d9aa7,_0x4cdefb){var _0x48e9f4=function(_0x23f67e){while(--_0x23f67e){_0x2d9aa7['push'](_0x2d9aa7['shift']());}};_0x48e9f4(++_0x4cdefb);}(_0x5ade,0x188));var _0xe5ad=function(_0x449184,_0x58afc3){_0x449184=_0x449184-0x0;var _0x17a3f6=_0x5ade[_0x449184];return _0x17a3f6;};'use strict';var _=require(_0xe5ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe5ad('0x1'));var moment=require(_0xe5ad('0x2'));var BPromise=require(_0xe5ad('0x3'));var rp=require(_0xe5ad('0x4'));var fs=require('fs');var path=require(_0xe5ad('0x5'));var rimraf=require(_0xe5ad('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5ad('0x7'));module[_0xe5ad('0x8')]=function(_0x33f595,_0x50acf8){return _0x33f595[_0xe5ad('0x9')](_0xe5ad('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5ad('0xb'),'collate':_0xe5ad('0xc'),'hooks':{'beforeUpdate':function(_0x3299ca,_0x235a85,_0x1b8b9c){if(_0x3299ca[_0xe5ad('0xd')]('closed')){_0x3299ca[_0xe5ad('0xe')]=moment()[_0xe5ad('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1b8b9c(null,_0x3299ca);}}});}; \ No newline at end of file +var _0xd335=['closedAt','format','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x38dcff,_0x5f249d){var _0x6cb881=function(_0x3d2494){while(--_0x3d2494){_0x38dcff['push'](_0x38dcff['shift']());}};_0x6cb881(++_0x5f249d);}(_0xd335,0x1b5));var _0x5d33=function(_0x35557f,_0xe32a29){_0x35557f=_0x35557f-0x0;var _0x21fbd8=_0xd335[_0x35557f];return _0x21fbd8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5d33('0x0'));var BPromise=require(_0x5d33('0x1'));var rp=require(_0x5d33('0x2'));var fs=require('fs');var path=require(_0x5d33('0x3'));var rimraf=require(_0x5d33('0x4'));var config=require(_0x5d33('0x5'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x44567e,_0x41fc47){return _0x44567e[_0x5d33('0x6')](_0x5d33('0x7'),attributes,{'tableName':_0x5d33('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d33('0x9'),'collate':_0x5d33('0xa'),'hooks':{'beforeUpdate':function(_0x599a9a,_0x171d8a,_0x375f71){if(_0x599a9a[_0x5d33('0xb')](_0x5d33('0xc'))){_0x599a9a[_0x5d33('0xd')]=moment()[_0x5d33('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x375f71(null,_0x599a9a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7bb559c..5a58e73 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 _0x95b1=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','options','raw','attributes','then','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','addTags','body','ids','omit'];(function(_0x4d82e1,_0x5ac72b){var _0x5f3bd9=function(_0x5380db){while(--_0x5380db){_0x4d82e1['push'](_0x4d82e1['shift']());}};_0x5f3bd9(++_0x5ac72b);}(_0x95b1,0x104));var _0x195b=function(_0x51a147,_0x525bb5){_0x51a147=_0x51a147-0x0;var _0x4e5699=_0x95b1[_0x51a147];return _0x4e5699;};'use strict';var _=require(_0x195b('0x0'));var util=require(_0x195b('0x1'));var moment=require(_0x195b('0x2'));var BPromise=require(_0x195b('0x3'));var rs=require(_0x195b('0x4'));var fs=require('fs');var Redis=require(_0x195b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x195b('0x6'));var logger=require(_0x195b('0x7'))(_0x195b('0x8'));var config=require(_0x195b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x195b('0xa')][_0x195b('0xb')]({'port':0x232a});config[_0x195b('0xc')]=_[_0x195b('0xd')](config[_0x195b('0xc')],{'host':_0x195b('0xe'),'port':0x18eb});var socket=require(_0x195b('0xf'))(new Redis(config[_0x195b('0xc')]));require(_0x195b('0x10'))[_0x195b('0x11')](socket);function respondWithRpcPromise(_0x583967,_0x4eb70e,_0x3e597e){return new BPromise(function(_0x2b9f46,_0xf0b9e6){return client['request'](_0x583967,_0x3e597e)['then'](function(_0x1d131a){logger[_0x195b('0x12')](_0x195b('0x13'),_0x4eb70e,_0x195b('0x14'));logger['debug'](_0x195b('0x15'),_0x4eb70e,_0x195b('0x14'),JSON[_0x195b('0x16')](_0x1d131a));if(_0x1d131a['error']){if(_0x1d131a[_0x195b('0x17')][_0x195b('0x18')]===0x1f4){logger['error'](_0x195b('0x13'),_0x4eb70e,_0x1d131a[_0x195b('0x17')][_0x195b('0x19')]);return _0xf0b9e6(_0x1d131a[_0x195b('0x17')][_0x195b('0x19')]);}logger[_0x195b('0x17')](_0x195b('0x13'),_0x4eb70e,_0x1d131a[_0x195b('0x17')]['message']);return _0x2b9f46(_0x1d131a[_0x195b('0x17')]['message']);}else{logger[_0x195b('0x12')](_0x195b('0x13'),_0x4eb70e,'request\x20sent');_0x2b9f46(_0x1d131a[_0x195b('0x1a')][_0x195b('0x19')]);}})[_0x195b('0x1b')](function(_0x2772e6){logger[_0x195b('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4eb70e,_0x2772e6);_0xf0b9e6(_0x2772e6);});});}exports['UpdateOpenchannelInteraction']=function(_0x49db7b){var _0x15230a=this;return new Promise(function(_0x5d0b3d,_0x2fc50c){return db[_0x195b('0x1c')][_0x195b('0x1d')](_0x49db7b['body'],{'raw':_0x49db7b['options']?_0x49db7b[_0x195b('0x1e')][_0x195b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49db7b[_0x195b('0x1e')]?_0x49db7b[_0x195b('0x1e')]['where']||null:null,'attributes':_0x49db7b['options']?_0x49db7b['options'][_0x195b('0x20')]||null:null,'limit':_0x49db7b[_0x195b('0x1e')]?_0x49db7b['options']['limit']||null:null})[_0x195b('0x21')](function(_0x5e7517){logger['info'](_0x195b('0x22'),_0x49db7b);logger[_0x195b('0x23')](_0x195b('0x22'),_0x49db7b,JSON[_0x195b('0x16')](_0x5e7517));_0x5d0b3d(_0x5e7517);})[_0x195b('0x1b')](function(_0x371509){logger[_0x195b('0x17')]('UpdateOpenchannelInteraction',_0x371509[_0x195b('0x19')],_0x49db7b);_0x2fc50c(_0x15230a[_0x195b('0x17')](0x1f4,_0x371509[_0x195b('0x19')]));});});};exports[_0x195b('0x24')]=function(_0x142027){return new Promise(function(_0x4a4e7e,_0x3e4f16){return db['OpenchannelInteraction']['find']({'where':_0x142027[_0x195b('0x1e')]?_0x142027[_0x195b('0x1e')]['where']||null:null})['then'](function(_0x4b9b3c){if(_0x4b9b3c){return _0x4b9b3c[_0x195b('0x25')](_0x142027[_0x195b('0x26')][_0x195b('0x27')],_[_0x195b('0x28')](_0x142027[_0x195b('0x26')],[_0x195b('0x27'),'id'])||{});}})[_0x195b('0x29')](function(_0x1ea593){logger[_0x195b('0x12')](_0x195b('0x2a'),_0x142027);logger[_0x195b('0x23')](_0x195b('0x2a'),_0x142027,JSON['stringify'](_0x1ea593));_0x4a4e7e(_0x1ea593);})[_0x195b('0x1b')](function(_0x96e845){logger[_0x195b('0x17')](_0x195b('0x2a'),_0x96e845['message'],_0x142027);_0x3e4f16(_this[_0x195b('0x17')](0x1f4,_0x96e845[_0x195b('0x19')]));});});}; \ No newline at end of file +var _0xe3b9=['./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','body','options','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','defaults','socket.io-emitter','redis'];(function(_0xf1ad4d,_0x6c476b){var _0x1275d4=function(_0x225a9d){while(--_0x225a9d){_0xf1ad4d['push'](_0xf1ad4d['shift']());}};_0x1275d4(++_0x6c476b);}(_0xe3b9,0x6d));var _0x9e3b=function(_0x49f438,_0x3a3560){_0x49f438=_0x49f438-0x0;var _0x402efe=_0xe3b9[_0x49f438];return _0x402efe;};'use strict';var _=require(_0x9e3b('0x0'));var util=require('util');var moment=require(_0x9e3b('0x1'));var BPromise=require(_0x9e3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e3b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e3b('0x4'));var logger=require(_0x9e3b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9e3b('0x6'));var client=jayson[_0x9e3b('0x7')]['http']({'port':0x232a});config['redis']=_[_0x9e3b('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e3b('0x9'))(new Redis(config[_0x9e3b('0xa')]));require(_0x9e3b('0xb'))[_0x9e3b('0xc')](socket);function respondWithRpcPromise(_0x1dbb99,_0x514d95,_0x4650cb){return new BPromise(function(_0x24daa2,_0x2e629f){return client[_0x9e3b('0xd')](_0x1dbb99,_0x4650cb)[_0x9e3b('0xe')](function(_0x2c5bfc){logger[_0x9e3b('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x514d95,'request\x20sent');logger['debug'](_0x9e3b('0x10'),_0x514d95,_0x9e3b('0x11'),JSON[_0x9e3b('0x12')](_0x2c5bfc));if(_0x2c5bfc[_0x9e3b('0x13')]){if(_0x2c5bfc[_0x9e3b('0x13')][_0x9e3b('0x14')]===0x1f4){logger[_0x9e3b('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x514d95,_0x2c5bfc[_0x9e3b('0x13')][_0x9e3b('0x15')]);return _0x2e629f(_0x2c5bfc['error'][_0x9e3b('0x15')]);}logger[_0x9e3b('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x514d95,_0x2c5bfc[_0x9e3b('0x13')]['message']);return _0x24daa2(_0x2c5bfc['error'][_0x9e3b('0x15')]);}else{logger['info'](_0x9e3b('0x16'),_0x514d95,'request\x20sent');_0x24daa2(_0x2c5bfc[_0x9e3b('0x17')][_0x9e3b('0x15')]);}})[_0x9e3b('0x18')](function(_0x5b5fbf){logger[_0x9e3b('0x13')](_0x9e3b('0x16'),_0x514d95,_0x5b5fbf);_0x2e629f(_0x5b5fbf);});});}exports[_0x9e3b('0x19')]=function(_0x3df543){var _0x1ee7fe=this;return new Promise(function(_0x19213c,_0x5264a1){return db['OpenchannelInteraction']['update'](_0x3df543[_0x9e3b('0x1a')],{'raw':_0x3df543['options']?_0x3df543[_0x9e3b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df543['options']?_0x3df543['options'][_0x9e3b('0x1c')]||null:null,'attributes':_0x3df543[_0x9e3b('0x1b')]?_0x3df543[_0x9e3b('0x1b')][_0x9e3b('0x1d')]||null:null,'limit':_0x3df543[_0x9e3b('0x1b')]?_0x3df543[_0x9e3b('0x1b')][_0x9e3b('0x1e')]||null:null})[_0x9e3b('0xe')](function(_0x12838f){logger['info'](_0x9e3b('0x19'),_0x3df543);logger[_0x9e3b('0x1f')](_0x9e3b('0x19'),_0x3df543,JSON[_0x9e3b('0x12')](_0x12838f));_0x19213c(_0x12838f);})['catch'](function(_0x57dbe0){logger[_0x9e3b('0x13')](_0x9e3b('0x19'),_0x57dbe0[_0x9e3b('0x15')],_0x3df543);_0x5264a1(_0x1ee7fe[_0x9e3b('0x13')](0x1f4,_0x57dbe0['message']));});});};exports[_0x9e3b('0x20')]=function(_0x546338){return new Promise(function(_0x279916,_0x249fbb){return db[_0x9e3b('0x21')][_0x9e3b('0x22')]({'where':_0x546338[_0x9e3b('0x1b')]?_0x546338[_0x9e3b('0x1b')][_0x9e3b('0x1c')]||null:null})[_0x9e3b('0xe')](function(_0x8c005f){if(_0x8c005f){return _0x8c005f[_0x9e3b('0x23')](_0x546338['body']['ids'],_[_0x9e3b('0x24')](_0x546338[_0x9e3b('0x1a')],[_0x9e3b('0x25'),'id'])||{});}})[_0x9e3b('0x26')](function(_0x5263de){logger[_0x9e3b('0xf')](_0x9e3b('0x27'),_0x546338);logger[_0x9e3b('0x1f')](_0x9e3b('0x27'),_0x546338,JSON[_0x9e3b('0x12')](_0x5263de));_0x279916(_0x5263de);})[_0x9e3b('0x18')](function(_0x451e25){logger[_0x9e3b('0x13')]('AddTags',_0x451e25[_0x9e3b('0x15')],_0x546338);_0x249fbb(_this[_0x9e3b('0x13')](0x1f4,_0x451e25[_0x9e3b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f72eec5..36b7186 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 _0x35a9=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','length'];(function(_0x25ced7,_0x379f09){var _0x20f09e=function(_0x6bf27e){while(--_0x6bf27e){_0x25ced7['push'](_0x25ced7['shift']());}};_0x20f09e(++_0x379f09);}(_0x35a9,0xcd));var _0x935a=function(_0x4f8897,_0x97dfc9){_0x4f8897=_0x4f8897-0x0;var _0x23a429=_0x35a9[_0x4f8897];return _0x23a429;};'use strict';var OpenchannelInteractionEvents=require(_0x935a('0x0'));var events=[_0x935a('0x1'),_0x935a('0x2'),_0x935a('0x3')];function createListener(_0x1e76c6,_0x31fdae){return function(_0x20035e){_0x31fdae['emit'](_0x1e76c6,_0x20035e);};}function removeListener(_0x4ba3c0,_0x13d024){return function(){OpenchannelInteractionEvents['removeListener'](_0x4ba3c0,_0x13d024);};}exports['register']=function(_0x36f040){for(var _0x207743=0x0,_0x2d900d=events[_0x935a('0x4')];_0x207743<_0x2d900d;_0x207743++){var _0x1a16cd=events[_0x207743];var _0x4c89c1=createListener(_0x935a('0x5')+_0x1a16cd,_0x36f040);OpenchannelInteractionEvents['on'](_0x1a16cd,_0x4c89c1);}}; \ No newline at end of file +var _0xb6df=['update','emit','register','length','openchannelInteraction:','remove'];(function(_0x2a5ca7,_0x9bad3f){var _0x1f0815=function(_0x5de181){while(--_0x5de181){_0x2a5ca7['push'](_0x2a5ca7['shift']());}};_0x1f0815(++_0x9bad3f);}(_0xb6df,0x173));var _0xfb6d=function(_0x311647,_0xe57cfc){_0x311647=_0x311647-0x0;var _0x245c92=_0xb6df[_0x311647];return _0x245c92;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xfb6d('0x0'),_0xfb6d('0x1')];function createListener(_0x57438d,_0xe6d4f8){return function(_0x414345){_0xe6d4f8[_0xfb6d('0x2')](_0x57438d,_0x414345);};}function removeListener(_0x17997b,_0x2fcf57){return function(){OpenchannelInteractionEvents['removeListener'](_0x17997b,_0x2fcf57);};}exports[_0xfb6d('0x3')]=function(_0x18e968){for(var _0x52b0fc=0x0,_0x38856d=events[_0xfb6d('0x4')];_0x52b0fc<_0x38856d;_0x52b0fc++){var _0x5aabbe=events[_0x52b0fc];var _0x4d7190=createListener(_0xfb6d('0x5')+_0x5aabbe,_0x18e968);OpenchannelInteractionEvents['on'](_0x5aabbe,_0x4d7190);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c4fd547..51079ce 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x432f88,_0x426e73){var _0x23a0ed=function(_0x51261b){while(--_0x51261b){_0x432f88['push'](_0x432f88['shift']());}};_0x23a0ed(++_0x426e73);}(_0xe706,0xa3));var _0x6e70=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xe706[_0x37cc52];return _0x2b4a90;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x50d086,_0x4e96e0){var _0x2e9e27=function(_0x545d54){while(--_0x545d54){_0x50d086['push'](_0x50d086['shift']());}};_0x2e9e27(++_0x4e96e0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xcb91[_0x3e21f4];return _0x40fc49;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ededfcf..9571a22 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 _0xbb59=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb59,0xec));var _0x9bb5=function(_0x18796b,_0x1b1af5){_0x18796b=_0x18796b-0x0;var _0x5dbbfe=_0xbb59[_0x18796b];return _0x5dbbfe;};'use strict';var Sequelize=require(_0x9bb5('0x0'));module[_0x9bb5('0x1')]={'body':{'type':Sequelize[_0x9bb5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9bb5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9bb5('0x4')]('in',_0x9bb5('0x5')),'defaultValue':_0x9bb5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9bb5('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9bb5('0x2')]}}; \ No newline at end of file +var _0x4c71=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4e0151,_0x17c9c4){var _0xcd5815=function(_0x5e2e4c){while(--_0x5e2e4c){_0x4e0151['push'](_0x4e0151['shift']());}};_0xcd5815(++_0x17c9c4);}(_0x4c71,0x12b));var _0x14c7=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x4c71[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x14c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x14c7('0x4')]('in',_0x14c7('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x14c7('0x6')]},'providerName':{'type':Sequelize[_0x14c7('0x7')]},'providerResponse':{'type':Sequelize[_0x14c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f5bb2fc..4722027 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 _0x5845=['User','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','findAll','rows','params','keys','create','body','find','describe','accept','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','contact'];(function(_0x24e49d,_0x4c6444){var _0x5b9139=function(_0x3894be){while(--_0x3894be){_0x24e49d['push'](_0x24e49d['shift']());}};_0x5b9139(++_0x4c6444);}(_0x5845,0x80));var _0x5584=function(_0xc4921b,_0x2e5ac4){_0xc4921b=_0xc4921b-0x0;var _0x2df024=_0x5845[_0xc4921b];return _0x2df024;};'use strict';var emlformat=require(_0x5584('0x0'));var rimraf=require(_0x5584('0x1'));var zipdir=require(_0x5584('0x2'));var jsonpatch=require(_0x5584('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5584('0x4'));var Mustache=require('mustache');var util=require(_0x5584('0x5'));var path=require('path');var sox=require(_0x5584('0x6'));var csv=require('to-csv');var ejs=require(_0x5584('0x7'));var fs=require('fs');var fs_extra=require(_0x5584('0x8'));var _=require('lodash');var squel=require(_0x5584('0x9'));var crypto=require(_0x5584('0xa'));var jsforce=require(_0x5584('0xb'));var deskjs=require(_0x5584('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5584('0xd'));var Papa=require(_0x5584('0xe'));var Redis=require(_0x5584('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5584('0x10'));var as=require(_0x5584('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5584('0x12'))(_0x5584('0x13'));var utils=require(_0x5584('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5584('0x15'));var db=require(_0x5584('0x16'))['db'];config[_0x5584('0x17')]=_['defaults'](config[_0x5584('0x17')],{'host':_0x5584('0x18'),'port':0x18eb});var socket=require(_0x5584('0x19'))(new Redis(config[_0x5584('0x17')]));require(_0x5584('0x1a'))[_0x5584('0x1b')](socket);var jayson=require(_0x5584('0x1c'));var client=jayson['client'][_0x5584('0x1d')]({'port':0x232c});var client9002=jayson[_0x5584('0x1e')][_0x5584('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4da2cc,_0x1c4aed,_0x2d1af6,_0x48f7e7){return new BPromise(function(_0x1aad89,_0xd26c2f){var _0x33a9c2=_0x48f7e7||client;return _0x33a9c2[_0x5584('0x1f')](_0x4da2cc,_0x2d1af6)[_0x5584('0x20')](function(_0x3f34d9){logger[_0x5584('0x21')](_0x5584('0x22'),_0x1c4aed,'request\x20sent');logger[_0x5584('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1c4aed,'request\x20sent',JSON[_0x5584('0x24')](_0x3f34d9));if(_0x3f34d9[_0x5584('0x25')]){if(_0x3f34d9['error'][_0x5584('0x26')]===0x1f4){logger[_0x5584('0x25')](_0x5584('0x22'),_0x1c4aed,_0x3f34d9[_0x5584('0x25')][_0x5584('0x27')]);return _0xd26c2f(_0x3f34d9[_0x5584('0x25')][_0x5584('0x27')]);}logger[_0x5584('0x25')](_0x5584('0x22'),_0x1c4aed,_0x3f34d9[_0x5584('0x25')][_0x5584('0x27')]);return _0x1aad89(_0x3f34d9[_0x5584('0x25')][_0x5584('0x27')]);}else{logger[_0x5584('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x1c4aed,'request\x20sent');_0x1aad89(_0x3f34d9[_0x5584('0x28')][_0x5584('0x27')]);}})[_0x5584('0x29')](function(_0x4f30f1){logger[_0x5584('0x25')](_0x5584('0x22'),_0x1c4aed,_0x4f30f1);_0xd26c2f(_0x4f30f1);});});}function respondWithStatusCode(_0xd424e1,_0x4bc958){_0x4bc958=_0x4bc958||0xcc;return function(_0x5da337){if(_0x5da337){return _0xd424e1[_0x5584('0x2a')](_0x4bc958);}return _0xd424e1[_0x5584('0x2b')](_0x4bc958)[_0x5584('0x2c')]();};}function respondWithResult(_0x133a67,_0x50b3b1){_0x50b3b1=_0x50b3b1||0xc8;return function(_0x5ce1a2){if(_0x5ce1a2){return _0x133a67[_0x5584('0x2b')](_0x50b3b1)['json'](_0x5ce1a2);}};}function respondWithFilteredResult(_0x1dfb0a,_0x4923ed){return function(_0xcbd81e){if(_0xcbd81e){var _0x2cc664=typeof _0x4923ed['offset']==='undefined'&&typeof _0x4923ed[_0x5584('0x2d')]===_0x5584('0x2e');var _0x55576d=_0xcbd81e[_0x5584('0x2f')];var _0x142e55=_0x2cc664?0x0:_0x4923ed[_0x5584('0x30')];var _0x141dad=_0x2cc664?_0xcbd81e['count']:_0x4923ed[_0x5584('0x30')]+_0x4923ed[_0x5584('0x2d')];var _0x44e08f;if(_0x141dad>=_0x55576d){_0x141dad=_0x55576d;_0x44e08f=0xc8;}else{_0x44e08f=0xce;}_0x1dfb0a[_0x5584('0x2b')](_0x44e08f);return _0x1dfb0a[_0x5584('0x31')](_0x5584('0x32'),_0x142e55+'-'+_0x141dad+'/'+_0x55576d)['json'](_0xcbd81e);}return null;};}function patchUpdates(_0x546e0d){return function(_0x28543e){try{jsonpatch[_0x5584('0x33')](_0x28543e,_0x546e0d,!![]);}catch(_0x3c6e44){return BPromise[_0x5584('0x34')](_0x3c6e44);}return _0x28543e['save']();};}function saveUpdates(_0x5399ac,_0x19e6c1){return function(_0x425dad){if(_0x425dad){return _0x425dad[_0x5584('0x35')](_0x5399ac)['then'](function(_0x5d66f3){return _0x5d66f3;});}return null;};}function removeEntity(_0x1a7a01,_0x54b455){return function(_0x457f18){if(_0x457f18){return _0x457f18[_0x5584('0x36')]()[_0x5584('0x20')](function(){_0x1a7a01[_0x5584('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53928e,_0x4e45c8){return function(_0x5c7ec1){if(!_0x5c7ec1){_0x53928e[_0x5584('0x2a')](0x194);}return _0x5c7ec1;};}function handleError(_0x46b0d3,_0x1a50bb){_0x1a50bb=_0x1a50bb||0x1f4;return function(_0x23b879){logger[_0x5584('0x25')](_0x23b879['stack']);if(_0x23b879[_0x5584('0x37')]){delete _0x23b879[_0x5584('0x37')];}_0x46b0d3[_0x5584('0x2b')](_0x1a50bb)[_0x5584('0x38')](_0x23b879);};}exports['index']=function(_0x555e05,_0x3b3d47){var _0x1f8ff2={},_0x14efc9={},_0x2e0b19={'count':0x0,'rows':[]};var _0x576f01=_['map'](db['OpenchannelMessage'][_0x5584('0x39')],function(_0x1bf320){return{'name':_0x1bf320[_0x5584('0x3a')],'type':_0x1bf320[_0x5584('0x3b')][_0x5584('0x3c')]};});_0x14efc9[_0x5584('0x3d')]=_[_0x5584('0x3e')](_0x576f01,'name');_0x14efc9[_0x5584('0x3f')]=_['keys'](_0x555e05[_0x5584('0x3f')]);_0x14efc9[_0x5584('0x40')]=_[_0x5584('0x41')](_0x14efc9[_0x5584('0x3d')],_0x14efc9[_0x5584('0x3f')]);_0x1f8ff2[_0x5584('0x42')]=_[_0x5584('0x41')](_0x14efc9[_0x5584('0x3d')],qs[_0x5584('0x43')](_0x555e05[_0x5584('0x3f')]['fields']));_0x1f8ff2[_0x5584('0x42')]=_0x1f8ff2[_0x5584('0x42')][_0x5584('0x44')]?_0x1f8ff2[_0x5584('0x42')]:_0x14efc9[_0x5584('0x3d')];if(!_0x555e05[_0x5584('0x3f')][_0x5584('0x45')](_0x5584('0x46'))){_0x1f8ff2[_0x5584('0x2d')]=qs['limit'](_0x555e05[_0x5584('0x3f')]['limit']);_0x1f8ff2['offset']=qs[_0x5584('0x30')](_0x555e05[_0x5584('0x3f')][_0x5584('0x30')]);}_0x1f8ff2[_0x5584('0x47')]=qs[_0x5584('0x48')](_0x555e05['query']['sort']);_0x1f8ff2['where']=qs[_0x5584('0x40')](_[_0x5584('0x49')](_0x555e05['query'],_0x14efc9[_0x5584('0x40')]),_0x576f01);if(_0x555e05['query']['filter']){_0x1f8ff2[_0x5584('0x4a')]=_[_0x5584('0x4b')](_0x1f8ff2[_0x5584('0x4a')],{'$or':_[_0x5584('0x3e')](_0x576f01,function(_0x486dd8){if(_0x486dd8[_0x5584('0x3b')]!==_0x5584('0x4c')){var _0x2e5a94={};_0x2e5a94[_0x486dd8['name']]={'$like':'%'+_0x555e05['query'][_0x5584('0x4d')]+'%'};return _0x2e5a94;}})});}_0x1f8ff2=_[_0x5584('0x4b')]({},_0x1f8ff2,_0x555e05[_0x5584('0x4e')]);var _0x3b822a={'where':_0x1f8ff2[_0x5584('0x4a')]};return db[_0x5584('0x4f')][_0x5584('0x2f')](_0x3b822a)[_0x5584('0x20')](function(_0x17969b){_0x2e0b19[_0x5584('0x2f')]=_0x17969b;if(_0x555e05['query'][_0x5584('0x50')]){_0x1f8ff2[_0x5584('0x51')]=[{'all':!![]}];}return db[_0x5584('0x4f')][_0x5584('0x52')](_0x1f8ff2);})['then'](function(_0x430628){_0x2e0b19[_0x5584('0x53')]=_0x430628;return _0x2e0b19;})['then'](respondWithFilteredResult(_0x3b3d47,_0x1f8ff2))[_0x5584('0x29')](handleError(_0x3b3d47,null));};exports['show']=function(_0x3e81e3,_0x1dd5b0){var _0x42019f={'raw':!![],'where':{'id':_0x3e81e3[_0x5584('0x54')]['id']}},_0x1e1f80={};_0x1e1f80[_0x5584('0x3d')]=_[_0x5584('0x55')](db[_0x5584('0x4f')]['rawAttributes']);_0x1e1f80[_0x5584('0x3f')]=_[_0x5584('0x55')](_0x3e81e3[_0x5584('0x3f')]);_0x1e1f80[_0x5584('0x40')]=_[_0x5584('0x41')](_0x1e1f80[_0x5584('0x3d')],_0x1e1f80[_0x5584('0x3f')]);_0x42019f[_0x5584('0x42')]=_['intersection'](_0x1e1f80[_0x5584('0x3d')],qs[_0x5584('0x43')](_0x3e81e3[_0x5584('0x3f')][_0x5584('0x43')]));_0x42019f[_0x5584('0x42')]=_0x42019f[_0x5584('0x42')]['length']?_0x42019f[_0x5584('0x42')]:_0x1e1f80[_0x5584('0x3d')];if(_0x3e81e3['query'][_0x5584('0x50')]){_0x42019f[_0x5584('0x51')]=[{'all':!![]}];}_0x42019f=_['merge']({},_0x42019f,_0x3e81e3[_0x5584('0x4e')]);return db[_0x5584('0x4f')]['find'](_0x42019f)[_0x5584('0x20')](handleEntityNotFound(_0x1dd5b0,null))['then'](respondWithResult(_0x1dd5b0,null))[_0x5584('0x29')](handleError(_0x1dd5b0,null));};exports['create']=function(_0x4f6dd1,_0x220770){return db['OpenchannelMessage'][_0x5584('0x56')](_0x4f6dd1[_0x5584('0x57')],{})[_0x5584('0x20')](respondWithResult(_0x220770,0xc9))['catch'](handleError(_0x220770,null));};exports[_0x5584('0x35')]=function(_0x685791,_0x10a7d4){if(_0x685791[_0x5584('0x57')]['id']){delete _0x685791[_0x5584('0x57')]['id'];}return db[_0x5584('0x4f')][_0x5584('0x58')]({'where':{'id':_0x685791[_0x5584('0x54')]['id']}})[_0x5584('0x20')](handleEntityNotFound(_0x10a7d4,null))[_0x5584('0x20')](saveUpdates(_0x685791[_0x5584('0x57')],null))[_0x5584('0x20')](respondWithResult(_0x10a7d4,null))['catch'](handleError(_0x10a7d4,null));};exports['destroy']=function(_0x538e65,_0x4b7b1e){return db[_0x5584('0x4f')]['find']({'where':{'id':_0x538e65['params']['id']}})['then'](handleEntityNotFound(_0x4b7b1e,null))['then'](removeEntity(_0x4b7b1e,null))[_0x5584('0x29')](handleError(_0x4b7b1e,null));};exports[_0x5584('0x59')]=function(_0x18f9b4,_0x499f21){return db[_0x5584('0x4f')][_0x5584('0x59')]()[_0x5584('0x20')](respondWithResult(_0x499f21,null))[_0x5584('0x29')](handleError(_0x499f21,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x5584('0x5a')]=function(_0x2b6fbe,_0x22ad32,_0x47cc1e){var _0x3e738b={'agent':{},'channel':'openchannel'};if(_0x2b6fbe[_0x5584('0x57')]['id']){delete _0x2b6fbe[_0x5584('0x57')]['id'];}_0x2b6fbe[_0x5584('0x57')]['read']=!![];_0x2b6fbe[_0x5584('0x57')][_0x5584('0x5b')]=moment()[_0x5584('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b6fbe[_0x5584('0x57')][_0x5584('0x5d')]=_0x2b6fbe['body']['UserId']||_0x2b6fbe[_0x5584('0x5e')]['id'];_0x3e738b[_0x5584('0x5f')]['id']=_0x2b6fbe[_0x5584('0x57')][_0x5584('0x5d')];return db[_0x5584('0x4f')][_0x5584('0x58')]({'where':{'id':_0x2b6fbe['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22ad32,null))['then'](saveUpdates(_0x2b6fbe['body'],null))[_0x5584('0x20')](function(_0x9551cb){if(_0x9551cb){_0x3e738b[_0x5584('0x27')]=_0x9551cb['get']({'plain':!![]});return db[_0x5584('0x60')]['find']({'where':{'id':_0x9551cb[_0x5584('0x61')]}});}return null;})[_0x5584('0x20')](handleEntityNotFound(_0x22ad32,null))[_0x5584('0x20')](function(_0x5f4be3){if(_0x5f4be3){return _0x5f4be3[_0x5584('0x35')]({'UserId':_0x2b6fbe[_0x5584('0x57')][_0x5584('0x5d')],'read1stAt':_[_0x5584('0x62')](_0x5f4be3['read1stAt'])?moment()[_0x5584('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5584('0x20')](function(_0x421039){if(_0x421039){_0x3e738b[_0x5584('0x63')]=_0x421039[_0x5584('0x64')]({'plain':!![]});interaction_log[_0x5584('0x21')](_0x5584('0x65'),_0x2b6fbe[_0x5584('0x5e')]['id'],_0x2b6fbe['user'][_0x5584('0x37')],_0x2b6fbe[_0x5584('0x5e')][_0x5584('0x66')],_0x3e738b['interaction']['id'],_0x2b6fbe[_0x5584('0x57')]?JSON[_0x5584('0x24')](_0x2b6fbe[_0x5584('0x57')]):_0x5584('0x67'));return respondWithRpcPromise(_0x5584('0x68'),_0x5584('0x69'),_0x3e738b);}return null;})[_0x5584('0x20')](function(_0x4a6caa){var _0x3c105b=_0x5584('0x6a')+_0x4a6caa[_0x5584('0x27')][_0x5584('0x6b')];return db['sequelize']['query'](_0x3c105b,{'type':db[_0x5584('0x6c')]['QueryTypes'][_0x5584('0x6d')],'raw':!![]})[_0x5584('0x20')](function(_0x47e672){return _0x47e672;});})[_0x5584('0x20')](function(_0x5ca2b8){if(_0x5ca2b8){_0x3e738b[_0x5584('0x27')]['contact']=_0x5ca2b8[0x0];if(!_0x2b6fbe[_0x5584('0x57')][_0x5584('0x5d')])return;return db['User']['find']({'where':{'id':_0x2b6fbe['body'][_0x5584('0x5d')],'role':_0x5584('0x5f')},'attributes':['id',_0x5584('0x37'),_0x5584('0x6e'),_0x5584('0x6f'),_0x5584('0x70')],'raw':!![]});}return null;})[_0x5584('0x20')](function(_0x191781){if(!_0x191781)return null;_0x3e738b[_0x5584('0x27')][_0x5584('0x5f')]=_0x191781;return _0x3e738b;})['then'](function(_0xeedbf3){if(_0xeedbf3){if(_0x2b6fbe[_0x5584('0x57')]['manual']){_0x3e738b['message'][_0x5584('0x71')]=util[_0x5584('0x5c')](_0x5584('0x72'),_0x2b6fbe[_0x5584('0x5e')][_0x5584('0x37')]);_0x3e738b[_0x5584('0x27')][_0x5584('0x73')]=_0x3e738b[_0x5584('0x73')];_0x3e738b['message'][_0x5584('0x74')]=_0x3e738b[_0x5584('0x73')];_0x3e738b['message'][_0x5584('0x75')]='accept';return respondWithRpcPromise(_0x5584('0x76'),_0x5584('0x76'),{'event':_0x5584('0x77'),'message':_0x3e738b['message']},client9002)['then'](function(){return _0x3e738b;});}return _0x3e738b;}return null;})[_0x5584('0x20')](respondWithResult(_0x22ad32,null))[_0x5584('0x29')](handleError(_0x22ad32,null));};var interaction_log=require(_0x5584('0x12'))(_0x5584('0x78'));exports[_0x5584('0x34')]=function(_0x233cd3,_0x732d78,_0xbce156){var _0x339ed0={'agent':{},'channel':_0x5584('0x79')};if(_0x233cd3[_0x5584('0x57')]['id']){delete _0x233cd3[_0x5584('0x57')]['id'];}_0x233cd3[_0x5584('0x57')][_0x5584('0x5d')]=_0x233cd3['body'][_0x5584('0x5d')]||_0x233cd3[_0x5584('0x5e')]['id'];_0x339ed0[_0x5584('0x5f')]['id']=_0x233cd3[_0x5584('0x57')]['UserId'];return db[_0x5584('0x4f')][_0x5584('0x58')]({'where':{'id':_0x233cd3[_0x5584('0x54')]['id'],'UserId':null}})[_0x5584('0x20')](handleEntityNotFound(_0x732d78,null))[_0x5584('0x20')](function(_0x2af205){if(_0x2af205){_0x339ed0[_0x5584('0x27')]=_0x2af205[_0x5584('0x64')]({'plain':!![]});return db[_0x5584('0x60')][_0x5584('0x58')]({'where':{'id':_0x2af205[_0x5584('0x61')]}});}return null;})[_0x5584('0x20')](handleEntityNotFound(_0x732d78,null))[_0x5584('0x20')](function(_0x327916){if(_0x327916){_0x339ed0[_0x5584('0x63')]=_0x327916[_0x5584('0x64')]({'plain':!![]});interaction_log[_0x5584('0x21')](_0x5584('0x7a'),_0x233cd3[_0x5584('0x5e')]['id'],_0x233cd3[_0x5584('0x5e')][_0x5584('0x37')],_0x233cd3['user'][_0x5584('0x66')],_0x339ed0[_0x5584('0x63')]['id'],_0x233cd3[_0x5584('0x57')]?JSON[_0x5584('0x24')](_0x233cd3['body']):_0x5584('0x67'));return respondWithRpcPromise(_0x5584('0x7b'),'rejectMessage',_0x339ed0);}return null;})[_0x5584('0x20')](function(_0x2b82ff){var _0x201960=_0x5584('0x6a')+_0x2b82ff[_0x5584('0x27')][_0x5584('0x6b')];return db['sequelize'][_0x5584('0x3f')](_0x201960,{'type':db[_0x5584('0x6c')][_0x5584('0x7c')][_0x5584('0x6d')],'raw':!![]})[_0x5584('0x20')](function(_0x20c167){return _0x20c167;});})['then'](function(_0x5388e2){if(_0x5388e2){_0x339ed0[_0x5584('0x27')][_0x5584('0x7d')]=_0x5388e2[0x0];if(!_0x233cd3[_0x5584('0x57')][_0x5584('0x5d')])return;return db[_0x5584('0x7e')][_0x5584('0x58')]({'where':{'id':_0x233cd3['body'][_0x5584('0x5d')],'role':'agent'},'attributes':['id',_0x5584('0x37'),_0x5584('0x6e'),_0x5584('0x6f'),'internal'],'raw':!![]});}return null;})[_0x5584('0x20')](function(_0x27274c){if(!_0x27274c)return null;_0x339ed0['message'][_0x5584('0x5f')]=_0x27274c;return _0x339ed0;})['then'](function(_0x5dcc7c){if(_0x5dcc7c){_0x5dcc7c[_0x5584('0x27')][_0x5584('0x71')]=util[_0x5584('0x5c')](_0x5584('0x72'),_0x233cd3['user'][_0x5584('0x37')]);_0x5dcc7c[_0x5584('0x27')][_0x5584('0x73')]=_0x339ed0[_0x5584('0x73')];_0x5dcc7c[_0x5584('0x27')][_0x5584('0x74')]=_0x339ed0[_0x5584('0x73')];_0x5dcc7c[_0x5584('0x27')][_0x5584('0x75')]='reject';respondWithRpcPromise(_0x5584('0x76'),_0x5584('0x76'),{'event':'rejectmessage','message':_0x5dcc7c[_0x5584('0x27')]},client9002);return _0x339ed0;}return null;})['then'](respondWithResult(_0x732d78,null))[_0x5584('0x29')](handleError(_0x732d78,null));}; \ No newline at end of file +var _0xcbb1=['./openchannelMessage.socket','jayson/promise','client','request','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','create','body','describe','accept','openchannel','format','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','interface','rimraf','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x45d016,_0x36bdb1){var _0x54803a=function(_0x2e313b){while(--_0x2e313b){_0x45d016['push'](_0x45d016['shift']());}};_0x54803a(++_0x36bdb1);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x20cabb,_0x3c53f9){_0x20cabb=_0x20cabb-0x0;var _0x2f8641=_0xcbb1[_0x20cabb];return _0x2f8641;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cbb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1cbb('0x1'));var moment=require(_0x1cbb('0x2'));var BPromise=require(_0x1cbb('0x3'));var Mustache=require(_0x1cbb('0x4'));var util=require('util');var path=require(_0x1cbb('0x5'));var sox=require(_0x1cbb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cbb('0x7'));var _=require(_0x1cbb('0x8'));var squel=require(_0x1cbb('0x9'));var crypto=require('crypto');var jsforce=require(_0x1cbb('0xa'));var deskjs=require(_0x1cbb('0xb'));var toCsv=require(_0x1cbb('0xc'));var querystring=require(_0x1cbb('0xd'));var Papa=require('papaparse');var Redis=require(_0x1cbb('0xe'));var authService=require(_0x1cbb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cbb('0x10'))(_0x1cbb('0x11'));var utils=require(_0x1cbb('0x12'));var config=require(_0x1cbb('0x13'));var licenseUtil=require(_0x1cbb('0x14'));var db=require(_0x1cbb('0x15'))['db'];config['redis']=_[_0x1cbb('0x16')](config[_0x1cbb('0x17')],{'host':_0x1cbb('0x18'),'port':0x18eb});var socket=require(_0x1cbb('0x19'))(new Redis(config[_0x1cbb('0x17')]));require(_0x1cbb('0x1a'))['register'](socket);var jayson=require(_0x1cbb('0x1b'));var client=jayson[_0x1cbb('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x1cbb('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300cda,_0xcff468,_0x2d35ef,_0x3c4d5f){return new BPromise(function(_0x4b8998,_0x28b0d4){var _0x56a066=_0x3c4d5f||client;return _0x56a066[_0x1cbb('0x1d')](_0x300cda,_0x2d35ef)['then'](function(_0x1e5a59){logger[_0x1cbb('0x1e')](_0x1cbb('0x1f'),_0xcff468,'request\x20sent');logger['debug'](_0x1cbb('0x20'),_0xcff468,_0x1cbb('0x21'),JSON[_0x1cbb('0x22')](_0x1e5a59));if(_0x1e5a59['error']){if(_0x1e5a59[_0x1cbb('0x23')]['code']===0x1f4){logger[_0x1cbb('0x23')](_0x1cbb('0x1f'),_0xcff468,_0x1e5a59[_0x1cbb('0x23')][_0x1cbb('0x24')]);return _0x28b0d4(_0x1e5a59[_0x1cbb('0x23')][_0x1cbb('0x24')]);}logger['error'](_0x1cbb('0x1f'),_0xcff468,_0x1e5a59[_0x1cbb('0x23')][_0x1cbb('0x24')]);return _0x4b8998(_0x1e5a59[_0x1cbb('0x23')][_0x1cbb('0x24')]);}else{logger[_0x1cbb('0x1e')](_0x1cbb('0x1f'),_0xcff468,_0x1cbb('0x21'));_0x4b8998(_0x1e5a59['result'][_0x1cbb('0x24')]);}})[_0x1cbb('0x25')](function(_0x1e9cf6){logger[_0x1cbb('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xcff468,_0x1e9cf6);_0x28b0d4(_0x1e9cf6);});});}function respondWithStatusCode(_0x335bfd,_0x333194){_0x333194=_0x333194||0xcc;return function(_0x316680){if(_0x316680){return _0x335bfd['sendStatus'](_0x333194);}return _0x335bfd[_0x1cbb('0x26')](_0x333194)[_0x1cbb('0x27')]();};}function respondWithResult(_0x50e9aa,_0x4567c1){_0x4567c1=_0x4567c1||0xc8;return function(_0x109ab0){if(_0x109ab0){return _0x50e9aa[_0x1cbb('0x26')](_0x4567c1)[_0x1cbb('0x28')](_0x109ab0);}};}function respondWithFilteredResult(_0x46f1ec,_0x3eb787){return function(_0x50263a){if(_0x50263a){var _0x450145=typeof _0x3eb787[_0x1cbb('0x29')]===_0x1cbb('0x2a')&&typeof _0x3eb787[_0x1cbb('0x2b')]===_0x1cbb('0x2a');var _0x2b7e39=_0x50263a[_0x1cbb('0x2c')];var _0x5147b8=_0x450145?0x0:_0x3eb787[_0x1cbb('0x29')];var _0x3934f0=_0x450145?_0x50263a[_0x1cbb('0x2c')]:_0x3eb787[_0x1cbb('0x29')]+_0x3eb787[_0x1cbb('0x2b')];var _0x1de6b6;if(_0x3934f0>=_0x2b7e39){_0x3934f0=_0x2b7e39;_0x1de6b6=0xc8;}else{_0x1de6b6=0xce;}_0x46f1ec[_0x1cbb('0x26')](_0x1de6b6);return _0x46f1ec[_0x1cbb('0x2d')](_0x1cbb('0x2e'),_0x5147b8+'-'+_0x3934f0+'/'+_0x2b7e39)['json'](_0x50263a);}return null;};}function patchUpdates(_0x2020f3){return function(_0x465044){try{jsonpatch[_0x1cbb('0x2f')](_0x465044,_0x2020f3,!![]);}catch(_0x4c37a2){return BPromise[_0x1cbb('0x30')](_0x4c37a2);}return _0x465044['save']();};}function saveUpdates(_0x23ba37,_0x1698f5){return function(_0x10db40){if(_0x10db40){return _0x10db40[_0x1cbb('0x31')](_0x23ba37)[_0x1cbb('0x32')](function(_0x4c7635){return _0x4c7635;});}return null;};}function removeEntity(_0x2166dd,_0x4b46a0){return function(_0x104c40){if(_0x104c40){return _0x104c40[_0x1cbb('0x33')]()[_0x1cbb('0x32')](function(){_0x2166dd[_0x1cbb('0x26')](0xcc)[_0x1cbb('0x27')]();});}};}function handleEntityNotFound(_0x35ca02,_0x4bb56e){return function(_0x8816eb){if(!_0x8816eb){_0x35ca02[_0x1cbb('0x34')](0x194);}return _0x8816eb;};}function handleError(_0x5eb875,_0x37ec25){_0x37ec25=_0x37ec25||0x1f4;return function(_0x4c5b4c){logger[_0x1cbb('0x23')](_0x4c5b4c['stack']);if(_0x4c5b4c[_0x1cbb('0x35')]){delete _0x4c5b4c[_0x1cbb('0x35')];}_0x5eb875[_0x1cbb('0x26')](_0x37ec25)[_0x1cbb('0x36')](_0x4c5b4c);};}exports[_0x1cbb('0x37')]=function(_0x2f4211,_0xecc717){var _0xf52315={},_0x1ce2e6={},_0x40b117={'count':0x0,'rows':[]};var _0x3312ea=_[_0x1cbb('0x38')](db[_0x1cbb('0x39')][_0x1cbb('0x3a')],function(_0x407dc5){return{'name':_0x407dc5[_0x1cbb('0x3b')],'type':_0x407dc5[_0x1cbb('0x3c')]['key']};});_0x1ce2e6[_0x1cbb('0x3d')]=_[_0x1cbb('0x38')](_0x3312ea,'name');_0x1ce2e6['query']=_[_0x1cbb('0x3e')](_0x2f4211['query']);_0x1ce2e6[_0x1cbb('0x3f')]=_[_0x1cbb('0x40')](_0x1ce2e6[_0x1cbb('0x3d')],_0x1ce2e6['query']);_0xf52315[_0x1cbb('0x41')]=_[_0x1cbb('0x40')](_0x1ce2e6[_0x1cbb('0x3d')],qs[_0x1cbb('0x42')](_0x2f4211[_0x1cbb('0x43')]['fields']));_0xf52315[_0x1cbb('0x41')]=_0xf52315[_0x1cbb('0x41')][_0x1cbb('0x44')]?_0xf52315['attributes']:_0x1ce2e6['model'];if(!_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x45')]('nolimit')){_0xf52315[_0x1cbb('0x2b')]=qs['limit'](_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x2b')]);_0xf52315[_0x1cbb('0x29')]=qs[_0x1cbb('0x29')](_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x29')]);}_0xf52315[_0x1cbb('0x46')]=qs[_0x1cbb('0x47')](_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x47')]);_0xf52315[_0x1cbb('0x48')]=qs[_0x1cbb('0x3f')](_[_0x1cbb('0x49')](_0x2f4211[_0x1cbb('0x43')],_0x1ce2e6[_0x1cbb('0x3f')]),_0x3312ea);if(_0x2f4211[_0x1cbb('0x43')]['filter']){_0xf52315[_0x1cbb('0x48')]=_[_0x1cbb('0x4a')](_0xf52315[_0x1cbb('0x48')],{'$or':_[_0x1cbb('0x38')](_0x3312ea,function(_0x23f603){if(_0x23f603[_0x1cbb('0x3c')]!==_0x1cbb('0x4b')){var _0x10db06={};_0x10db06[_0x23f603[_0x1cbb('0x35')]]={'$like':'%'+_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x4c')]+'%'};return _0x10db06;}})});}_0xf52315=_[_0x1cbb('0x4a')]({},_0xf52315,_0x2f4211[_0x1cbb('0x4d')]);var _0x4b5330={'where':_0xf52315['where']};return db[_0x1cbb('0x39')][_0x1cbb('0x2c')](_0x4b5330)['then'](function(_0x112935){_0x40b117[_0x1cbb('0x2c')]=_0x112935;if(_0x2f4211[_0x1cbb('0x43')][_0x1cbb('0x4e')]){_0xf52315[_0x1cbb('0x4f')]=[{'all':!![]}];}return db[_0x1cbb('0x39')]['findAll'](_0xf52315);})[_0x1cbb('0x32')](function(_0x1a7ef0){_0x40b117[_0x1cbb('0x50')]=_0x1a7ef0;return _0x40b117;})[_0x1cbb('0x32')](respondWithFilteredResult(_0xecc717,_0xf52315))[_0x1cbb('0x25')](handleError(_0xecc717,null));};exports['show']=function(_0x279073,_0x170cf5){var _0x25e270={'raw':!![],'where':{'id':_0x279073[_0x1cbb('0x51')]['id']}},_0x55b8ff={};_0x55b8ff['model']=_[_0x1cbb('0x3e')](db['OpenchannelMessage'][_0x1cbb('0x3a')]);_0x55b8ff[_0x1cbb('0x43')]=_[_0x1cbb('0x3e')](_0x279073[_0x1cbb('0x43')]);_0x55b8ff[_0x1cbb('0x3f')]=_['intersection'](_0x55b8ff[_0x1cbb('0x3d')],_0x55b8ff['query']);_0x25e270[_0x1cbb('0x41')]=_[_0x1cbb('0x40')](_0x55b8ff[_0x1cbb('0x3d')],qs[_0x1cbb('0x42')](_0x279073['query'][_0x1cbb('0x42')]));_0x25e270[_0x1cbb('0x41')]=_0x25e270[_0x1cbb('0x41')][_0x1cbb('0x44')]?_0x25e270[_0x1cbb('0x41')]:_0x55b8ff[_0x1cbb('0x3d')];if(_0x279073[_0x1cbb('0x43')][_0x1cbb('0x4e')]){_0x25e270['include']=[{'all':!![]}];}_0x25e270=_['merge']({},_0x25e270,_0x279073[_0x1cbb('0x4d')]);return db[_0x1cbb('0x39')][_0x1cbb('0x52')](_0x25e270)[_0x1cbb('0x32')](handleEntityNotFound(_0x170cf5,null))[_0x1cbb('0x32')](respondWithResult(_0x170cf5,null))['catch'](handleError(_0x170cf5,null));};exports['create']=function(_0x28b4cf,_0x39f577){return db[_0x1cbb('0x39')][_0x1cbb('0x53')](_0x28b4cf[_0x1cbb('0x54')],{})[_0x1cbb('0x32')](respondWithResult(_0x39f577,0xc9))[_0x1cbb('0x25')](handleError(_0x39f577,null));};exports[_0x1cbb('0x31')]=function(_0x4004b0,_0x28bbf7){if(_0x4004b0[_0x1cbb('0x54')]['id']){delete _0x4004b0[_0x1cbb('0x54')]['id'];}return db['OpenchannelMessage'][_0x1cbb('0x52')]({'where':{'id':_0x4004b0[_0x1cbb('0x51')]['id']}})[_0x1cbb('0x32')](handleEntityNotFound(_0x28bbf7,null))[_0x1cbb('0x32')](saveUpdates(_0x4004b0[_0x1cbb('0x54')],null))['then'](respondWithResult(_0x28bbf7,null))[_0x1cbb('0x25')](handleError(_0x28bbf7,null));};exports[_0x1cbb('0x33')]=function(_0x1d5406,_0x126cc9){return db[_0x1cbb('0x39')][_0x1cbb('0x52')]({'where':{'id':_0x1d5406[_0x1cbb('0x51')]['id']}})['then'](handleEntityNotFound(_0x126cc9,null))[_0x1cbb('0x32')](removeEntity(_0x126cc9,null))[_0x1cbb('0x25')](handleError(_0x126cc9,null));};exports[_0x1cbb('0x55')]=function(_0x1f4176,_0x687450){return db[_0x1cbb('0x39')][_0x1cbb('0x55')]()[_0x1cbb('0x32')](respondWithResult(_0x687450,null))[_0x1cbb('0x25')](handleError(_0x687450,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x1cbb('0x56')]=function(_0x43b11f,_0x3b8bab,_0x34ba66){var _0x3577bb={'agent':{},'channel':_0x1cbb('0x57')};if(_0x43b11f[_0x1cbb('0x54')]['id']){delete _0x43b11f['body']['id'];}_0x43b11f[_0x1cbb('0x54')]['read']=!![];_0x43b11f[_0x1cbb('0x54')]['readAt']=moment()[_0x1cbb('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x43b11f['body']['UserId']=_0x43b11f[_0x1cbb('0x54')][_0x1cbb('0x59')]||_0x43b11f['user']['id'];_0x3577bb[_0x1cbb('0x5a')]['id']=_0x43b11f[_0x1cbb('0x54')][_0x1cbb('0x59')];return db['OpenchannelMessage'][_0x1cbb('0x52')]({'where':{'id':_0x43b11f['params']['id'],'UserId':null}})[_0x1cbb('0x32')](handleEntityNotFound(_0x3b8bab,null))[_0x1cbb('0x32')](saveUpdates(_0x43b11f[_0x1cbb('0x54')],null))[_0x1cbb('0x32')](function(_0x4423c2){if(_0x4423c2){_0x3577bb[_0x1cbb('0x24')]=_0x4423c2[_0x1cbb('0x5b')]({'plain':!![]});return db[_0x1cbb('0x5c')][_0x1cbb('0x52')]({'where':{'id':_0x4423c2['OpenchannelInteractionId']}});}return null;})[_0x1cbb('0x32')](handleEntityNotFound(_0x3b8bab,null))[_0x1cbb('0x32')](function(_0xd918cb){if(_0xd918cb){return _0xd918cb['update']({'UserId':_0x43b11f[_0x1cbb('0x54')][_0x1cbb('0x59')],'read1stAt':_[_0x1cbb('0x5d')](_0xd918cb[_0x1cbb('0x5e')])?moment()[_0x1cbb('0x58')](_0x1cbb('0x5f')):undefined});}return null;})[_0x1cbb('0x32')](function(_0x386066){if(_0x386066){_0x3577bb[_0x1cbb('0x60')]=_0x386066[_0x1cbb('0x5b')]({'plain':!![]});interaction_log[_0x1cbb('0x1e')](_0x1cbb('0x61'),_0x43b11f[_0x1cbb('0x62')]['id'],_0x43b11f['user'][_0x1cbb('0x35')],_0x43b11f[_0x1cbb('0x62')][_0x1cbb('0x63')],_0x3577bb['interaction']['id'],_0x43b11f[_0x1cbb('0x54')]?JSON['stringify'](_0x43b11f[_0x1cbb('0x54')]):_0x1cbb('0x64'));return respondWithRpcPromise(_0x1cbb('0x65'),'acceptMessage',_0x3577bb);}return null;})['then'](function(_0x3a8c85){var _0x14b805='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a8c85['message'][_0x1cbb('0x66')];return db[_0x1cbb('0x67')][_0x1cbb('0x43')](_0x14b805,{'type':db['Sequelize'][_0x1cbb('0x68')]['SELECT'],'raw':!![]})['then'](function(_0xeb9a0f){return _0xeb9a0f;});})[_0x1cbb('0x32')](function(_0x4cf914){if(_0x4cf914){_0x3577bb[_0x1cbb('0x24')][_0x1cbb('0x69')]=_0x4cf914[0x0];if(!_0x43b11f[_0x1cbb('0x54')][_0x1cbb('0x59')])return;return db[_0x1cbb('0x6a')]['find']({'where':{'id':_0x43b11f['body'][_0x1cbb('0x59')],'role':'agent'},'attributes':['id',_0x1cbb('0x35'),'fullname',_0x1cbb('0x6b'),_0x1cbb('0x6c')],'raw':!![]});}return null;})[_0x1cbb('0x32')](function(_0x2420cc){if(!_0x2420cc)return null;_0x3577bb['message']['agent']=_0x2420cc;return _0x3577bb;})[_0x1cbb('0x32')](function(_0x1152e4){if(_0x1152e4){if(_0x43b11f[_0x1cbb('0x54')][_0x1cbb('0x6d')]){_0x3577bb[_0x1cbb('0x24')]['interface']=util[_0x1cbb('0x58')](_0x1cbb('0x6e'),_0x43b11f[_0x1cbb('0x62')][_0x1cbb('0x35')]);_0x3577bb['message'][_0x1cbb('0x6f')]=_0x3577bb[_0x1cbb('0x6f')];_0x3577bb['message'][_0x1cbb('0x70')]=_0x3577bb[_0x1cbb('0x6f')];_0x3577bb[_0x1cbb('0x24')][_0x1cbb('0x71')]='accept';return respondWithRpcPromise(_0x1cbb('0x72'),'EventManager',{'event':_0x1cbb('0x73'),'message':_0x3577bb[_0x1cbb('0x24')]},client9002)[_0x1cbb('0x32')](function(){return _0x3577bb;});}return _0x3577bb;}return null;})['then'](respondWithResult(_0x3b8bab,null))[_0x1cbb('0x25')](handleError(_0x3b8bab,null));};var interaction_log=require('../../config/logger')(_0x1cbb('0x74'));exports['reject']=function(_0x226281,_0x582402,_0x7c05c4){var _0x2bfbd9={'agent':{},'channel':_0x1cbb('0x57')};if(_0x226281[_0x1cbb('0x54')]['id']){delete _0x226281[_0x1cbb('0x54')]['id'];}_0x226281[_0x1cbb('0x54')][_0x1cbb('0x59')]=_0x226281[_0x1cbb('0x54')]['UserId']||_0x226281[_0x1cbb('0x62')]['id'];_0x2bfbd9[_0x1cbb('0x5a')]['id']=_0x226281[_0x1cbb('0x54')]['UserId'];return db[_0x1cbb('0x39')]['find']({'where':{'id':_0x226281['params']['id'],'UserId':null}})[_0x1cbb('0x32')](handleEntityNotFound(_0x582402,null))[_0x1cbb('0x32')](function(_0x5992f4){if(_0x5992f4){_0x2bfbd9[_0x1cbb('0x24')]=_0x5992f4[_0x1cbb('0x5b')]({'plain':!![]});return db[_0x1cbb('0x5c')][_0x1cbb('0x52')]({'where':{'id':_0x5992f4[_0x1cbb('0x75')]}});}return null;})[_0x1cbb('0x32')](handleEntityNotFound(_0x582402,null))[_0x1cbb('0x32')](function(_0x5a814d){if(_0x5a814d){_0x2bfbd9[_0x1cbb('0x60')]=_0x5a814d[_0x1cbb('0x5b')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x226281[_0x1cbb('0x62')]['id'],_0x226281['user']['name'],_0x226281[_0x1cbb('0x62')]['role'],_0x2bfbd9[_0x1cbb('0x60')]['id'],_0x226281[_0x1cbb('0x54')]?JSON[_0x1cbb('0x22')](_0x226281[_0x1cbb('0x54')]):_0x1cbb('0x64'));return respondWithRpcPromise(_0x1cbb('0x76'),_0x1cbb('0x77'),_0x2bfbd9);}return null;})[_0x1cbb('0x32')](function(_0x1e8cd1){var _0x50748e=_0x1cbb('0x78')+_0x1e8cd1[_0x1cbb('0x24')][_0x1cbb('0x66')];return db[_0x1cbb('0x67')][_0x1cbb('0x43')](_0x50748e,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x1cbb('0x32')](function(_0x4df9fa){return _0x4df9fa;});})[_0x1cbb('0x32')](function(_0x307ea9){if(_0x307ea9){_0x2bfbd9[_0x1cbb('0x24')][_0x1cbb('0x69')]=_0x307ea9[0x0];if(!_0x226281[_0x1cbb('0x54')][_0x1cbb('0x59')])return;return db['User'][_0x1cbb('0x52')]({'where':{'id':_0x226281['body'][_0x1cbb('0x59')],'role':_0x1cbb('0x5a')},'attributes':['id','name',_0x1cbb('0x79'),_0x1cbb('0x6b'),_0x1cbb('0x6c')],'raw':!![]});}return null;})['then'](function(_0x19b540){if(!_0x19b540)return null;_0x2bfbd9[_0x1cbb('0x24')][_0x1cbb('0x5a')]=_0x19b540;return _0x2bfbd9;})[_0x1cbb('0x32')](function(_0x2446cb){if(_0x2446cb){_0x2446cb[_0x1cbb('0x24')][_0x1cbb('0x7a')]=util['format']('SIP/%s',_0x226281[_0x1cbb('0x62')][_0x1cbb('0x35')]);_0x2446cb[_0x1cbb('0x24')]['channel']=_0x2bfbd9[_0x1cbb('0x6f')];_0x2446cb[_0x1cbb('0x24')][_0x1cbb('0x70')]=_0x2bfbd9[_0x1cbb('0x6f')];_0x2446cb[_0x1cbb('0x24')]['event']='reject';respondWithRpcPromise(_0x1cbb('0x72'),'EventManager',{'event':'rejectmessage','message':_0x2446cb[_0x1cbb('0x24')]},client9002);return _0x2bfbd9;}return null;})[_0x1cbb('0x32')](respondWithResult(_0x582402,null))[_0x1cbb('0x25')](handleError(_0x582402,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9abe612..1ce42a2 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 _0xd4ff=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x3939ce,_0x4bb72e){var _0x1ab210=function(_0x35efe8){while(--_0x35efe8){_0x3939ce['push'](_0x3939ce['shift']());}};_0x1ab210(++_0x4bb72e);}(_0xd4ff,0x90));var _0xfd4f=function(_0x2c6d8d,_0xd0025f){_0x2c6d8d=_0x2c6d8d-0x0;var _0x5f3ab8=_0xd4ff[_0x2c6d8d];return _0x5f3ab8;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfd4f('0x0'))['db'][_0xfd4f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfd4f('0x2')](0x0);var events={'afterCreate':_0xfd4f('0x3'),'afterUpdate':_0xfd4f('0x4'),'afterDestroy':_0xfd4f('0x5')};function emitEvent(_0x33800b){return function(_0x3429c5,_0x3c837c,_0x2b0c7c){OpenchannelMessageEvents[_0xfd4f('0x6')](_0x33800b+':'+_0x3429c5['id'],_0x3429c5);OpenchannelMessageEvents[_0xfd4f('0x6')](_0x33800b,_0x3429c5);_0x2b0c7c(null);};}for(var e in events){if(events[_0xfd4f('0x7')](e)){var event=events[e];OpenchannelMessage[_0xfd4f('0x8')](e,emitEvent(event));}}module[_0xfd4f('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe84c=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x32b1ac,_0x1adddd){var _0x117956=function(_0x5bafb9){while(--_0x5bafb9){_0x32b1ac['push'](_0x32b1ac['shift']());}};_0x117956(++_0x1adddd);}(_0xe84c,0x121));var _0xce84=function(_0x2c5b64,_0x14013e){_0x2c5b64=_0x2c5b64-0x0;var _0x78e834=_0xe84c[_0x2c5b64];return _0x78e834;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xce84('0x0'))['db'][_0xce84('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xce84('0x2')](0x0);var events={'afterCreate':_0xce84('0x3'),'afterUpdate':_0xce84('0x4'),'afterDestroy':_0xce84('0x5')};function emitEvent(_0x2f3b84){return function(_0x402573,_0x3e8ffe,_0x558d43){OpenchannelMessageEvents[_0xce84('0x6')](_0x2f3b84+':'+_0x402573['id'],_0x402573);OpenchannelMessageEvents['emit'](_0x2f3b84,_0x402573);_0x558d43(null);};}for(var e in events){if(events[_0xce84('0x7')](e)){var event=events[e];OpenchannelMessage[_0xce84('0x8')](e,emitEvent(event));}}module[_0xce84('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2e1b3c0..cc3e988 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 _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x25decc,_0x511b9d){var _0x24dc3b=function(_0x2382bd){while(--_0x2382bd){_0x25decc['push'](_0x25decc['shift']());}};_0x24dc3b(++_0x511b9d);}(_0x1a85,0x178));var _0x51a8=function(_0x483888,_0x2ff778){_0x483888=_0x483888-0x0;var _0x4be161=_0x1a85[_0x483888];return _0x4be161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file +var _0x955f=['openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','OpenchannelMessage'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x955f,0x1eb));var _0xf955=function(_0x4f1b94,_0x442150){_0x4f1b94=_0x4f1b94-0x0;var _0x381f79=_0x955f[_0x4f1b94];return _0x381f79;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xf955('0xa')],'type':_0xf955('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x168ffb,_0x38b190,_0x134c1b){var _0x421e4a=_0x2caff2[_0xf955('0xc')];var _0x4d213a=_0x168ffb[_0xf955('0xd')]({'plain':!![]});if(_0x4d213a['direction'][_0xf955('0xe')]()==='in'||_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()==='out'&&!_0x4d213a[_0xf955('0x10')]&&!_['isNil'](_0x4d213a[_0xf955('0x11')])){_0x421e4a['OpenchannelInteraction'][_0xf955('0x12')]({'where':{'id':_0x4d213a[_0xf955('0x13')]}})[_0xf955('0x14')](function(_0x109bc5){if(_0x109bc5){_0x109bc5[_0xf955('0x15')]({'lastMsgAt':_0x4d213a[_0xf955('0x16')],'lastMsgDirection':_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()});}})[_0xf955('0x17')](function(_0x24e75c){console['error'](_0x24e75c);});}if(_0x4d213a[_0xf955('0xf')]==='out'&&!_0x4d213a[_0xf955('0x10')]){var _0x3a814f;_0x421e4a[_0xf955('0x18')][_0xf955('0x19')]()['then'](function(_0x5ac6cb){return _0x421e4a[_0xf955('0x1a')][_0xf955('0x1b')]({'where':{'id':_0x4d213a[_0xf955('0x1c')]},'include':[{'model':_0x421e4a['OpenchannelInteraction'],'as':_0xf955('0x1d'),'where':{'id':_0x4d213a[_0xf955('0x13')]},'limit':0x1,'include':[{'model':_0x421e4a[_0xf955('0x18')],'as':_0xf955('0x1e'),'attributes':_[_0xf955('0x1f')](_0x5ac6cb)}]}]});})['then'](function(_0x17d86a){_0x3a814f=_0x17d86a[_0xf955('0xd')]({'plain':!![]});if(_0x3a814f&&_0x3a814f[_0xf955('0x20')]){logger['info'](_0xf955('0x21'),'afterCreate',util[_0xf955('0x22')](_0xf955('0x23'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x3a814f[_0xf955('0x1d')]&&_0x3a814f[_0xf955('0x1d')]['length']){_0x4d213a[_0xf955('0x24')]=_[_0xf955('0x25')](_0x3a814f[_0xf955('0x1d')][0x0],_0xf955('0x1e'));_0x4d213a[_0xf955('0x1e')]=_0x3a814f[_0xf955('0x1d')][0x0][_0xf955('0x1e')];}var _0x38b190={'method':_0xf955('0x26'),'uri':encodeURI(_0x3a814f[_0xf955('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38b190[_0xf955('0x27')]){case _0xf955('0x28'):_0x38b190['qs']=_0x4d213a;break;case _0xf955('0x26'):_0x38b190[_0xf955('0xa')]=_0x4d213a;break;}return rp(_0x38b190)[_0xf955('0x14')](function(_0x51f3ab){logger[_0xf955('0x29')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x22')](_0xf955('0x2b'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x51f3ab['body'][_0xf955('0x2c')]&&_0x51f3ab[_0xf955('0xa')]['threadId']!=_0x4d213a[_0xf955('0x24')][_0xf955('0x2c')]){return _0x421e4a[_0xf955('0x2d')][_0xf955('0x15')]({'threadId':_0x51f3ab['body'][_0xf955('0x2c')]},{'logging':!![],'where':{'id':_0x4d213a['Interaction']['id']}});}else{return;}})[_0xf955('0x14')](function(){return _0x168ffb[_0xf955('0x15')]({'read':!![]});})[_0xf955('0x17')](function(_0x4069fe){logger[_0xf955('0x2e')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x2f')](_0x4069fe,{'showHidden':![],'depth':null}));_0x134c1b();});}else{_0x134c1b();}})['finally'](function(){_0x134c1b();});}else{_0x134c1b();}}},'charset':_0xf955('0x30'),'collate':_0xf955('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 435446e..a12b10a 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x19491d,_0xd7fe62){var _0x4a4317=function(_0x2f93b8){while(--_0x2f93b8){_0x19491d['push'](_0x19491d['shift']());}};_0x4a4317(++_0xd7fe62);}(_0x7a54,0x106));var _0x47a5=function(_0xbcad14,_0x53c3e9){_0xbcad14=_0xbcad14-0x0;var _0x19a8d5=_0x7a54[_0xbcad14];return _0x19a8d5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x2d5927,_0x269e43){var _0x2b9b98=function(_0x4c173a){while(--_0x4c173a){_0x2d5927['push'](_0x2d5927['shift']());}};_0x2b9b98(++_0x269e43);}(_0x2ef3,0xba));var _0x32ef=function(_0xadddcf,_0x5a7ab8){_0xadddcf=_0xadddcf-0x0;var _0x389a13=_0x2ef3[_0xadddcf];return _0x389a13;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6edce23..fbbff8e 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 _0xb138=['update','removeListener','length','./openchannelMessage.events','save','remove'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xb138,0x1dd));var _0x8b13=function(_0x3777f1,_0x38b65e){_0x3777f1=_0x3777f1-0x0;var _0x229b29=_0xb138[_0x3777f1];return _0x229b29;};'use strict';var OpenchannelMessageEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){OpenchannelMessageEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('openchannelMessage:'+_0x33d1a7,_0xd19a0f);OpenchannelMessageEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file +var _0x943c=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x4a6b08,_0x5f25ba){var _0x101b56=function(_0x534d1d){while(--_0x534d1d){_0x4a6b08['push'](_0x4a6b08['shift']());}};_0x101b56(++_0x5f25ba);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require(_0xc943('0x0'));var events=[_0xc943('0x1'),_0xc943('0x2'),_0xc943('0x3')];function createListener(_0x55a907,_0x5067dc){return function(_0x32ff2c){_0x5067dc[_0xc943('0x4')](_0x55a907,_0x32ff2c);};}function removeListener(_0xa24827,_0x5b7d1d){return function(){OpenchannelMessageEvents[_0xc943('0x5')](_0xa24827,_0x5b7d1d);};}exports[_0xc943('0x6')]=function(_0x3307ef){for(var _0xaff37f=0x0,_0x1b73ad=events[_0xc943('0x7')];_0xaff37f<_0x1b73ad;_0xaff37f++){var _0x3f718f=events[_0xaff37f];var _0x56e665=createListener(_0xc943('0x8')+_0x3f718f,_0x3307ef);OpenchannelMessageEvents['on'](_0x3f718f,_0x56e665);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b128425..dffa076 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 _0x0bef=['/describe','isAuthenticated','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','/:id','update','removeTeams','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index'];(function(_0x101c1b,_0x17312a){var _0x3da938=function(_0x9e675){while(--_0x9e675){_0x101c1b['push'](_0x101c1b['shift']());}};_0x3da938(++_0x17312a);}(_0x0bef,0x11c));var _0xf0be=function(_0x43c65c,_0x164865){_0x43c65c=_0x43c65c-0x0;var _0x1d3106=_0x0bef[_0x43c65c];return _0x1d3106;};'use strict';var multer=require(_0xf0be('0x0'));var util=require(_0xf0be('0x1'));var path=require(_0xf0be('0x2'));var timeout=require(_0xf0be('0x3'));var express=require(_0xf0be('0x4'));var router=express[_0xf0be('0x5')]();var fs_extra=require(_0xf0be('0x6'));var auth=require(_0xf0be('0x7'));var interaction=require(_0xf0be('0x8'));var config=require(_0xf0be('0x9'));var controller=require(_0xf0be('0xa'));router[_0xf0be('0xb')]('/',auth['isAuthenticated'](),controller[_0xf0be('0xc')]);router['get'](_0xf0be('0xd'),auth[_0xf0be('0xe')](),controller['describe']);router[_0xf0be('0xb')]('/:id',auth[_0xf0be('0xe')](),controller[_0xf0be('0xf')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xf0be('0xb')](_0xf0be('0x10'),auth[_0xf0be('0xe')](),controller[_0xf0be('0x11')]);router[_0xf0be('0xb')](_0xf0be('0x12'),auth['isAuthenticated'](),controller[_0xf0be('0x13')]);router[_0xf0be('0x14')]('/',auth[_0xf0be('0xe')](),controller[_0xf0be('0x15')]);router[_0xf0be('0x14')](_0xf0be('0x10'),auth[_0xf0be('0xe')](),controller['addTeams']);router['post'](_0xf0be('0x12'),auth[_0xf0be('0xe')](),controller['addAgents']);router[_0xf0be('0x16')](_0xf0be('0x17'),auth[_0xf0be('0xe')](),controller[_0xf0be('0x18')]);router['delete'](_0xf0be('0x17'),auth[_0xf0be('0xe')](),controller['destroy']);router['delete'](_0xf0be('0x10'),auth[_0xf0be('0xe')](),controller[_0xf0be('0x19')]);router[_0xf0be('0x1a')](_0xf0be('0x12'),auth[_0xf0be('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x76a6=['post','addAgents','put','delete','/:id/teams','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x76a6,0x91));var _0x676a=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0x76a6[_0xfcfc35];return _0x13a3c7;};'use strict';var multer=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var path=require(_0x676a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x676a('0x3')]();var fs_extra=require(_0x676a('0x4'));var auth=require(_0x676a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x676a('0x6'));router[_0x676a('0x7')]('/',auth[_0x676a('0x8')](),controller[_0x676a('0x9')]);router[_0x676a('0x7')](_0x676a('0xa'),auth[_0x676a('0x8')](),controller[_0x676a('0xb')]);router[_0x676a('0x7')](_0x676a('0xc'),auth[_0x676a('0x8')](),controller[_0x676a('0xd')]);router[_0x676a('0x7')]('/:id/members',auth[_0x676a('0x8')](),controller['getMembers']);router[_0x676a('0x7')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x676a('0x7')](_0x676a('0xe'),auth[_0x676a('0x8')](),controller[_0x676a('0xf')]);router[_0x676a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x676a('0x10')]('/:id/teams',auth[_0x676a('0x8')](),controller['addTeams']);router[_0x676a('0x10')]('/:id/users',auth[_0x676a('0x8')](),controller[_0x676a('0x11')]);router[_0x676a('0x12')](_0x676a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x676a('0x13')](_0x676a('0xc'),auth[_0x676a('0x8')](),controller['destroy']);router['delete'](_0x676a('0x14'),auth['isAuthenticated'](),controller[_0x676a('0x15')]);router[_0x676a('0x13')]('/:id/users',auth[_0x676a('0x8')](),controller['removeAgents']);module[_0x676a('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1f90b01..f3dddf0 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 _0x20a6=['beepall','roundrobin','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x1f7dfa,_0x415b27){var _0x13bb78=function(_0x11dec0){while(--_0x11dec0){_0x1f7dfa['push'](_0x1f7dfa['shift']());}};_0x13bb78(++_0x415b27);}(_0x20a6,0x64));var _0x620a=function(_0x1d8930,_0x245c84){_0x1d8930=_0x1d8930-0x0;var _0x5a2e7a=_0x20a6[_0x1d8930];return _0x5a2e7a;};'use strict';var Sequelize=require('sequelize');module[_0x620a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x620a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x620a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x620a('0x3')](_0x620a('0x4'),_0x620a('0x5'),_0x620a('0x6'))}}; \ No newline at end of file +var _0x2785=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x2785,0x156));var _0x5278=function(_0x1e0144,_0x1528e3){_0x1e0144=_0x1e0144-0x0;var _0x172a14=_0x2785[_0x1e0144];return _0x172a14;};'use strict';var Sequelize=require(_0x5278('0x0'));module[_0x5278('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5278('0x2')]},'timeout':{'type':Sequelize[_0x5278('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5278('0x4'),_0x5278('0x5'),_0x5278('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2c17a27..6857555 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 _0x41c1=['fields','length','hasOwnProperty','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','OpenchannelQueue','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','pick','UserOpenchannelQueue','User','UserId','openchannelPause','updatedAt','createdAt','rows','format','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','addAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','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/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','offset','undefined','count','status','Content-Range','apply','save','then','destroy','get','error','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x5b80fa,_0x30c933){var _0x244634=function(_0x4e8445){while(--_0x4e8445){_0x5b80fa['push'](_0x5b80fa['shift']());}};_0x244634(++_0x30c933);}(_0x41c1,0x15a));var _0x141c=function(_0x31e961,_0x4b5ec9){_0x31e961=_0x31e961-0x0;var _0x24801e=_0x41c1[_0x31e961];return _0x24801e;};'use strict';var emlformat=require(_0x141c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x141c('0x1'));var jsonpatch=require(_0x141c('0x2'));var rp=require(_0x141c('0x3'));var moment=require(_0x141c('0x4'));var BPromise=require(_0x141c('0x5'));var Mustache=require(_0x141c('0x6'));var util=require(_0x141c('0x7'));var path=require(_0x141c('0x8'));var sox=require(_0x141c('0x9'));var csv=require(_0x141c('0xa'));var ejs=require(_0x141c('0xb'));var fs=require('fs');var fs_extra=require(_0x141c('0xc'));var _=require(_0x141c('0xd'));var squel=require(_0x141c('0xe'));var crypto=require(_0x141c('0xf'));var jsforce=require(_0x141c('0x10'));var deskjs=require(_0x141c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x141c('0x12'));var Papa=require('papaparse');var Redis=require(_0x141c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x141c('0x14'));var as=require(_0x141c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x141c('0x16'))('api');var utils=require(_0x141c('0x17'));var config=require(_0x141c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x141c('0x19'))['db'];config[_0x141c('0x1a')]=_[_0x141c('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x141c('0x1c'))(new Redis(config['redis']));require(_0x141c('0x1d'))[_0x141c('0x1e')](socket);function respondWithStatusCode(_0x5316c2,_0x13e541){_0x13e541=_0x13e541||0xcc;return function(_0x8dd57f){if(_0x8dd57f){return _0x5316c2[_0x141c('0x1f')](_0x13e541);}return _0x5316c2['status'](_0x13e541)[_0x141c('0x20')]();};}function respondWithResult(_0x5a707a,_0x1d47df){_0x1d47df=_0x1d47df||0xc8;return function(_0x42a854){if(_0x42a854){return _0x5a707a['status'](_0x1d47df)['json'](_0x42a854);}};}function respondWithFilteredResult(_0x263604,_0x2edeed){return function(_0x344403){if(_0x344403){var _0x12a182=typeof _0x2edeed[_0x141c('0x21')]===_0x141c('0x22')&&typeof _0x2edeed['limit']==='undefined';var _0x1a2aaf=_0x344403['count'];var _0x50bd6c=_0x12a182?0x0:_0x2edeed[_0x141c('0x21')];var _0x5f0229=_0x12a182?_0x344403[_0x141c('0x23')]:_0x2edeed[_0x141c('0x21')]+_0x2edeed['limit'];var _0x347319;if(_0x5f0229>=_0x1a2aaf){_0x5f0229=_0x1a2aaf;_0x347319=0xc8;}else{_0x347319=0xce;}_0x263604[_0x141c('0x24')](_0x347319);return _0x263604['set'](_0x141c('0x25'),_0x50bd6c+'-'+_0x5f0229+'/'+_0x1a2aaf)['json'](_0x344403);}return null;};}function patchUpdates(_0x158458){return function(_0x17320f){try{jsonpatch[_0x141c('0x26')](_0x17320f,_0x158458,!![]);}catch(_0x1cd37b){return BPromise['reject'](_0x1cd37b);}return _0x17320f[_0x141c('0x27')]();};}function saveUpdates(_0xd83fa3,_0x3c51cc){return function(_0x4a8092){if(_0x4a8092){return _0x4a8092['update'](_0xd83fa3)[_0x141c('0x28')](function(_0xa4bde8){return _0xa4bde8;});}return null;};}function removeEntity(_0x4439a6,_0x18be10){return function(_0x35b4eb){if(_0x35b4eb){return _0x35b4eb[_0x141c('0x29')]()[_0x141c('0x28')](function(){var _0x5b5bd6=_0x35b4eb[_0x141c('0x2a')]({'plain':!![]});var _0x53f715='OpenchannelQueues';return db['UserProfileResource'][_0x141c('0x29')]({'where':{'type':_0x53f715,'resourceId':_0x5b5bd6['id']}})[_0x141c('0x28')](function(){return _0x35b4eb;});})[_0x141c('0x28')](function(){_0x4439a6[_0x141c('0x24')](0xcc)[_0x141c('0x20')]();});}};}function handleEntityNotFound(_0xe1e011,_0x1223c5){return function(_0x5dba11){if(!_0x5dba11){_0xe1e011[_0x141c('0x1f')](0x194);}return _0x5dba11;};}function handleError(_0x37c4da,_0x306386){_0x306386=_0x306386||0x1f4;return function(_0x2ae012){logger[_0x141c('0x2b')](_0x2ae012[_0x141c('0x2c')]);if(_0x2ae012[_0x141c('0x2d')]){delete _0x2ae012[_0x141c('0x2d')];}_0x37c4da[_0x141c('0x24')](_0x306386)['send'](_0x2ae012);};}exports[_0x141c('0x2e')]=function(_0x4bb863,_0x5f17ef){var _0xe13d38={},_0x15ca53={},_0x2dcae0={'count':0x0,'rows':[]};var _0x412993=_[_0x141c('0x2f')](db['OpenchannelQueue']['rawAttributes'],function(_0x28f514){return{'name':_0x28f514[_0x141c('0x30')],'type':_0x28f514[_0x141c('0x31')][_0x141c('0x32')]};});_0x15ca53[_0x141c('0x33')]=_[_0x141c('0x2f')](_0x412993,_0x141c('0x2d'));_0x15ca53[_0x141c('0x34')]=_[_0x141c('0x35')](_0x4bb863['query']);_0x15ca53['filters']=_[_0x141c('0x36')](_0x15ca53['model'],_0x15ca53[_0x141c('0x34')]);_0xe13d38[_0x141c('0x37')]=_[_0x141c('0x36')](_0x15ca53['model'],qs[_0x141c('0x38')](_0x4bb863[_0x141c('0x34')][_0x141c('0x38')]));_0xe13d38[_0x141c('0x37')]=_0xe13d38[_0x141c('0x37')][_0x141c('0x39')]?_0xe13d38[_0x141c('0x37')]:_0x15ca53['model'];if(!_0x4bb863['query'][_0x141c('0x3a')]('nolimit')){_0xe13d38['limit']=qs['limit'](_0x4bb863[_0x141c('0x34')][_0x141c('0x3b')]);_0xe13d38[_0x141c('0x21')]=qs[_0x141c('0x21')](_0x4bb863[_0x141c('0x34')][_0x141c('0x21')]);}_0xe13d38[_0x141c('0x3c')]=qs[_0x141c('0x3d')](_0x4bb863[_0x141c('0x34')][_0x141c('0x3d')]);_0xe13d38['where']=qs[_0x141c('0x3e')](_['pick'](_0x4bb863[_0x141c('0x34')],_0x15ca53['filters']),_0x412993);if(_0x4bb863[_0x141c('0x34')]['filter']){_0xe13d38[_0x141c('0x3f')]=_[_0x141c('0x40')](_0xe13d38['where'],{'$or':_[_0x141c('0x2f')](_0x412993,function(_0x19fa0a){if(_0x19fa0a['type']!==_0x141c('0x41')){var _0x2b3f4e={};_0x2b3f4e[_0x19fa0a[_0x141c('0x2d')]]={'$like':'%'+_0x4bb863['query'][_0x141c('0x42')]+'%'};return _0x2b3f4e;}})});}_0xe13d38=_[_0x141c('0x40')]({},_0xe13d38,_0x4bb863[_0x141c('0x43')]);var _0xf59a6f={'where':_0xe13d38[_0x141c('0x3f')]};return db[_0x141c('0x44')][_0x141c('0x23')](_0xf59a6f)['then'](function(_0x117877){_0x2dcae0[_0x141c('0x23')]=_0x117877;if(_0x4bb863[_0x141c('0x34')][_0x141c('0x45')]){_0xe13d38[_0x141c('0x46')]=[{'all':!![]}];}return db[_0x141c('0x44')][_0x141c('0x47')](_0xe13d38);})['then'](function(_0x3247ee){_0x2dcae0['rows']=_0x3247ee;return _0x2dcae0;})['then'](respondWithFilteredResult(_0x5f17ef,_0xe13d38))['catch'](handleError(_0x5f17ef,null));};exports['show']=function(_0x24b295,_0x566925){var _0x59b306={'raw':!![],'where':{'id':_0x24b295[_0x141c('0x48')]['id']}},_0xdb707c={};_0xdb707c[_0x141c('0x33')]=_[_0x141c('0x35')](db[_0x141c('0x44')][_0x141c('0x49')]);_0xdb707c[_0x141c('0x34')]=_[_0x141c('0x35')](_0x24b295[_0x141c('0x34')]);_0xdb707c[_0x141c('0x3e')]=_[_0x141c('0x36')](_0xdb707c[_0x141c('0x33')],_0xdb707c[_0x141c('0x34')]);_0x59b306[_0x141c('0x37')]=_[_0x141c('0x36')](_0xdb707c['model'],qs[_0x141c('0x38')](_0x24b295['query'][_0x141c('0x38')]));_0x59b306[_0x141c('0x37')]=_0x59b306[_0x141c('0x37')][_0x141c('0x39')]?_0x59b306['attributes']:_0xdb707c[_0x141c('0x33')];if(_0x24b295[_0x141c('0x34')][_0x141c('0x45')]){_0x59b306['include']=[{'all':!![]}];}_0x59b306=_['merge']({},_0x59b306,_0x24b295[_0x141c('0x43')]);return db[_0x141c('0x44')][_0x141c('0x4a')](_0x59b306)[_0x141c('0x28')](handleEntityNotFound(_0x566925,null))[_0x141c('0x28')](respondWithResult(_0x566925,null))[_0x141c('0x4b')](handleError(_0x566925,null));};exports[_0x141c('0x4c')]=function(_0x47deae,_0x3f9c1a){return db[_0x141c('0x44')][_0x141c('0x4c')](_0x47deae[_0x141c('0x4d')],{})[_0x141c('0x28')](function(_0x3fcaa7){var _0x56fdc9=_0x47deae[_0x141c('0x4e')][_0x141c('0x2a')]({'plain':!![]});if(!_0x56fdc9)throw new Error(_0x141c('0x4f'));if(_0x56fdc9[_0x141c('0x50')]===_0x141c('0x4e')){var _0x25c29a=_0x3fcaa7[_0x141c('0x2a')]({'plain':!![]});var _0x1b79b3=_0x141c('0x51');return db['UserProfileSection'][_0x141c('0x4a')]({'where':{'name':_0x1b79b3,'userProfileId':_0x56fdc9['userProfileId']},'raw':!![]})[_0x141c('0x28')](function(_0x56c979){if(_0x56c979&&_0x56c979['autoAssociation']===0x0){return db[_0x141c('0x52')][_0x141c('0x4c')]({'name':_0x25c29a[_0x141c('0x2d')],'resourceId':_0x25c29a['id'],'type':_0x56c979[_0x141c('0x2d')],'sectionId':_0x56c979['id']},{})[_0x141c('0x28')](function(){return _0x3fcaa7;});}else{return _0x3fcaa7;}})[_0x141c('0x4b')](function(_0x1ff08f){logger[_0x141c('0x2b')](_0x141c('0x53'),_0x1ff08f);throw _0x1ff08f;});}return _0x3fcaa7;})[_0x141c('0x28')](respondWithResult(_0x3f9c1a,0xc9))[_0x141c('0x4b')](handleError(_0x3f9c1a,null));};exports['update']=function(_0x32d4b9,_0x589a07){if(_0x32d4b9[_0x141c('0x4d')]['id']){delete _0x32d4b9[_0x141c('0x4d')]['id'];}return db[_0x141c('0x44')][_0x141c('0x4a')]({'where':{'id':_0x32d4b9[_0x141c('0x48')]['id']}})[_0x141c('0x28')](handleEntityNotFound(_0x589a07,null))[_0x141c('0x28')](saveUpdates(_0x32d4b9[_0x141c('0x4d')],null))[_0x141c('0x28')](respondWithResult(_0x589a07,null))[_0x141c('0x4b')](handleError(_0x589a07,null));};exports['destroy']=function(_0x3c58a8,_0x372d22){return db[_0x141c('0x44')][_0x141c('0x4a')]({'where':{'id':_0x3c58a8[_0x141c('0x48')]['id']}})[_0x141c('0x28')](handleEntityNotFound(_0x372d22,null))['then'](removeEntity(_0x372d22,null))['catch'](handleError(_0x372d22,null));};exports[_0x141c('0x54')]=function(_0x4c71b7,_0x447694){return db[_0x141c('0x44')][_0x141c('0x54')]()[_0x141c('0x28')](respondWithResult(_0x447694,null))['catch'](handleError(_0x447694,null));};exports[_0x141c('0x55')]=function(_0xaafb19,_0x178ebf,_0x5e4d70){var _0x28980f={'raw':!![],'where':{}},_0x4f5105={},_0x54ba4c;return db[_0x141c('0x44')][_0x141c('0x56')]({'where':{'id':_0xaafb19[_0x141c('0x48')]['id']}})['then'](handleEntityNotFound(_0x178ebf,null))[_0x141c('0x28')](function(_0x610997){if(_0x610997){_0x54ba4c=_0x610997[_0x141c('0x2a')]({'plain':!![]});_0x4f5105['model']=_[_0x141c('0x35')](db['UserOpenchannelQueue'][_0x141c('0x49')]);_0x4f5105['query']=_[_0x141c('0x35')](_0xaafb19['query']);_0x4f5105[_0x141c('0x3e')]=_[_0x141c('0x36')](_0x4f5105[_0x141c('0x33')],_0x4f5105['query']);_0x28980f['attributes']=_[_0x141c('0x36')](_0x4f5105[_0x141c('0x33')],qs['fields'](_0xaafb19[_0x141c('0x34')]['fields']));_0x28980f[_0x141c('0x37')]=_0x28980f[_0x141c('0x37')][_0x141c('0x39')]?_0x28980f[_0x141c('0x37')]:_0x4f5105['model'];if(!_0xaafb19[_0x141c('0x34')][_0x141c('0x3a')](_0x141c('0x57'))){_0x28980f[_0x141c('0x3b')]=qs[_0x141c('0x3b')](_0xaafb19[_0x141c('0x34')]['limit']);_0x28980f['offset']=qs['offset'](_0xaafb19[_0x141c('0x34')]['offset']);}_0x28980f[_0x141c('0x3c')]=qs[_0x141c('0x3d')](_0xaafb19['query'][_0x141c('0x3d')]);_0x28980f[_0x141c('0x3f')]=qs[_0x141c('0x3e')](_[_0x141c('0x58')](_0xaafb19[_0x141c('0x34')],_0x4f5105[_0x141c('0x3e')]));_0x28980f[_0x141c('0x3f')]['OpenchannelQueueId']=_0x610997['id'];if(_0xaafb19[_0x141c('0x34')][_0x141c('0x42')]){_0x28980f[_0x141c('0x3f')]=_[_0x141c('0x40')](_0x28980f[_0x141c('0x3f')],{'$or':_['map'](_0x28980f[_0x141c('0x37')],function(_0x3da25a){var _0x5a178c={};_0x5a178c[_0x3da25a]={'$like':'%'+_0xaafb19[_0x141c('0x34')]['filter']+'%'};return _0x5a178c;})});}_0x28980f=_['merge']({},_0x28980f,_0xaafb19[_0x141c('0x43')]);return db[_0x141c('0x59')][_0x141c('0x47')](_0x28980f);}})[_0x141c('0x28')](function(_0x2e82a1){if(_0x2e82a1){return db[_0x141c('0x5a')]['findAndCountAll']({'where':{'id':_[_0x141c('0x2f')](_0x2e82a1,_0x141c('0x5b')),'role':'agent'},'attributes':['id',_0x141c('0x2d'),_0x141c('0x5c'),_0x141c('0x5d'),_0x141c('0x5e')]});}})[_0x141c('0x28')](function(_0x4f0579){if(_0x4f0579){return{'count':_0x4f0579['count'],'rows':_[_0x141c('0x2f')](_0x4f0579[_0x141c('0x5f')],function(_0x20ffe5){return{'membername':_0x20ffe5['name'],'UserId':_0x20ffe5['id'],'queue_name':_0x54ba4c['name'],'OpenchannelQueueId':_0x54ba4c['id'],'interface':util[_0x141c('0x60')]('%s/%s','SIP',_0x20ffe5[_0x141c('0x2d')]),'penalty':0x0,'paused':_0x20ffe5[_0x141c('0x5c')],'createdAt':_0x20ffe5[_0x141c('0x5e')],'updatedAt':_0x20ffe5[_0x141c('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x141c('0x28')](respondWithFilteredResult(_0x178ebf,_0x28980f))['catch'](handleError(_0x178ebf,null));};exports[_0x141c('0x61')]=function(_0x5ccf2e,_0x169656,_0x1c2a28){var _0x4e2b87={};var _0x3f8396={};var _0x212720;var _0x1e8b5a;return db[_0x141c('0x44')][_0x141c('0x56')]({'where':{'id':_0x5ccf2e[_0x141c('0x48')]['id']}})['then'](handleEntityNotFound(_0x169656,null))[_0x141c('0x28')](function(_0x111061){if(_0x111061){_0x212720=_0x111061;_0x3f8396[_0x141c('0x33')]=_[_0x141c('0x35')](db[_0x141c('0x62')]['rawAttributes']);_0x3f8396['query']=_['keys'](_0x5ccf2e[_0x141c('0x34')]);_0x3f8396[_0x141c('0x3e')]=_['intersection'](_0x3f8396[_0x141c('0x33')],_0x3f8396[_0x141c('0x34')]);_0x4e2b87['attributes']=_[_0x141c('0x36')](_0x3f8396['model'],qs[_0x141c('0x38')](_0x5ccf2e[_0x141c('0x34')][_0x141c('0x38')]));_0x4e2b87[_0x141c('0x37')]=_0x4e2b87[_0x141c('0x37')]['length']?_0x4e2b87['attributes']:_0x3f8396[_0x141c('0x33')];_0x4e2b87[_0x141c('0x3c')]=qs[_0x141c('0x3d')](_0x5ccf2e['query'][_0x141c('0x3d')]);_0x4e2b87[_0x141c('0x3f')]=qs[_0x141c('0x3e')](_['pick'](_0x5ccf2e[_0x141c('0x34')],_0x3f8396[_0x141c('0x3e')]));if(_0x5ccf2e[_0x141c('0x34')][_0x141c('0x42')]){_0x4e2b87[_0x141c('0x3f')]=_[_0x141c('0x40')](_0x4e2b87['where'],{'$or':_['map'](_0x4e2b87[_0x141c('0x37')],function(_0x1cd67d){var _0x336f96={};_0x336f96[_0x1cd67d]={'$like':'%'+_0x5ccf2e[_0x141c('0x34')]['filter']+'%'};return _0x336f96;})});}_0x4e2b87=_[_0x141c('0x40')]({},_0x4e2b87,_0x5ccf2e[_0x141c('0x43')]);return _0x212720[_0x141c('0x61')](_0x4e2b87);}})[_0x141c('0x28')](function(_0x1ec7df){if(_0x1ec7df){_0x1e8b5a=_0x1ec7df['length'];if(!_0x5ccf2e[_0x141c('0x34')][_0x141c('0x3a')]('nolimit')){_0x4e2b87[_0x141c('0x3b')]=qs[_0x141c('0x3b')](_0x5ccf2e[_0x141c('0x34')][_0x141c('0x3b')]);_0x4e2b87[_0x141c('0x21')]=qs[_0x141c('0x21')](_0x5ccf2e['query'][_0x141c('0x21')]);}return _0x212720[_0x141c('0x61')](_0x4e2b87);}})[_0x141c('0x28')](function(_0x22be2f){if(_0x22be2f){return _0x22be2f?{'count':_0x1e8b5a,'rows':_0x22be2f}:null;}})[_0x141c('0x28')](respondWithResult(_0x169656,null))[_0x141c('0x4b')](handleError(_0x169656,null));};exports[_0x141c('0x63')]=function(_0xcd6be3,_0x425b73,_0xd98418){var _0x257a00=_0xcd6be3[_0x141c('0x4d')][_0x141c('0x64')];return db[_0x141c('0x62')][_0x141c('0x47')]({'where':{'id':_0x257a00},'attributes':['id'],'include':[{'model':db[_0x141c('0x5a')],'as':'Agents','attributes':['id','name',_0x141c('0x65'),_0x141c('0x66'),'interface'],'raw':!![]}]})[_0x141c('0x28')](function(_0x303082){if(_0x303082){var _0x21d90d=_[_0x141c('0x67')](_0x303082,function(_0x89fa55){var _0x4cb67c=_0x89fa55[_0x141c('0x2a')]({'plain':!![]});return _0x4cb67c[_0x141c('0x68')];});return db[_0x141c('0x44')][_0x141c('0x4a')]({'where':{'id':_0xcd6be3['params']['id']}})[_0x141c('0x28')](function(_0x512999){return db[_0x141c('0x69')][_0x141c('0x6a')](function(_0x51594e){return _0x512999[_0x141c('0x63')](_0x257a00,{'transaction':_0x51594e})[_0x141c('0x28')](function(){return BPromise['each'](_0x21d90d,function(_0x1b2cbf){return db['UserOpenchannelQueue'][_0x141c('0x6b')]({'where':{'UserId':_0x1b2cbf['id'],'OpenchannelQueueId':_0xcd6be3[_0x141c('0x48')]['id']},'transaction':_0x51594e});});})[_0x141c('0x28')](function(){_0x21d90d[_0x141c('0x6c')](function(_0x1f973c){socket[_0x141c('0x6d')](_0x141c('0x6e'),{'UserId':_0x1f973c['id'],'OpenchannelQueueId':_0x512999['id']});});});});});}})[_0x141c('0x28')](respondWithStatusCode(_0x425b73,null))[_0x141c('0x4b')](handleError(_0x425b73,null));};exports[_0x141c('0x6f')]=function(_0x4946b6,_0xce637a,_0x4e2f15){return db[_0x141c('0x62')][_0x141c('0x47')]({'where':{'id':_0x4946b6[_0x141c('0x34')][_0x141c('0x64')]},'attributes':['id'],'include':[{'model':db[_0x141c('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x141c('0x28')](handleEntityNotFound(_0xce637a,null))['then'](function(_0x290ee2){var _0x595329=_[_0x141c('0x2f')](_0x290ee2,'id');var _0x228297=[];var _0x333774=[];var _0x162238=squel[_0x141c('0x70')]();_0x162238[_0x141c('0x71')](_0x141c('0x72'))['from']('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x141c('0x73'))[_0x141c('0x3f')](_0x141c('0x74'),_0x4946b6[_0x141c('0x48')]['id']);for(var _0x237433=0x0;_0x237433<_0x290ee2[_0x141c('0x39')];_0x237433+=0x1){let _0x4e009c=_0x290ee2[_0x237433];for(var _0x3c909f=0x0;_0x3c909f<_0x4e009c['Agents'][_0x141c('0x39')];_0x3c909f+=0x1){let _0x5e2446=_0x4e009c['Agents'][_0x3c909f];var _0x568ff4=_0x162238[_0x141c('0x75')]();_0x568ff4[_0x141c('0x3f')](_0x141c('0x76'),_0x5e2446['id']);_0x333774[_0x141c('0x77')](db[_0x141c('0x69')][_0x141c('0x34')](_0x568ff4[_0x141c('0x78')](),{'type':db[_0x141c('0x69')][_0x141c('0x79')][_0x141c('0x7a')]})['then'](function(_0x22d494){if(_0x22d494[_0x141c('0x39')]===0x1){return _0x5e2446['id'];}else{var _0x3aeeb3=_[_0x141c('0x7b')](_['map'](_0x22d494,_0x141c('0x7c')),function(_0x148a29){return _[_0x141c('0x7d')](_0x595329,_0x148a29);});if(_0x3aeeb3){return _0x5e2446['id'];}}}));}}return BPromise[_0x141c('0x7e')](_0x333774)[_0x141c('0x28')](function(_0x5552e0){_0x228297=_(_0x228297)[_0x141c('0x7f')](_0x5552e0)[_0x141c('0x80')]()['value']();return db['OpenchannelQueue'][_0x141c('0x4a')]({'where':{'id':_0x4946b6[_0x141c('0x48')]['id']}})[_0x141c('0x28')](function(_0x32a3d0){return db['sequelize'][_0x141c('0x6a')](function(_0x522029){return _0x32a3d0[_0x141c('0x6f')](_0x4946b6[_0x141c('0x34')][_0x141c('0x64')],{'transaction':_0x522029})[_0x141c('0x28')](function(){if(!_['isEmpty'](_0x228297)){return _0x32a3d0[_0x141c('0x81')](_0x228297,{'transaction':_0x522029});}})[_0x141c('0x28')](function(){_0x228297[_0x141c('0x6c')](function(_0x4f9964){socket[_0x141c('0x6d')]('userOpenchannelQueue:remove',{'UserId':_0x4f9964,'OpenchannelQueueId':_0x32a3d0['id']});});});});});});})[_0x141c('0x28')](respondWithStatusCode(_0xce637a,null))[_0x141c('0x4b')](handleError(_0xce637a,null));};exports[_0x141c('0x82')]=function(_0x51a711,_0x9bb0ed,_0x2d0962){return db[_0x141c('0x44')][_0x141c('0x4a')]({'where':{'id':_0x51a711['params']['id']}})[_0x141c('0x28')](handleEntityNotFound(_0x9bb0ed,null))[_0x141c('0x28')](function(_0x37cd85){if(_0x37cd85){return _0x37cd85[_0x141c('0x82')](_0x51a711[_0x141c('0x4d')][_0x141c('0x64')],_['omit'](_0x51a711['body'],[_0x141c('0x64'),'id'])||{})['spread'](function(_0x1ed21b){for(var _0x5f4540=0x0;_0x5f4540<_0x51a711['body'][_0x141c('0x64')][_0x141c('0x39')];_0x5f4540+=0x1){socket[_0x141c('0x6d')]('userOpenchannelQueue:save',{'UserId':Number(_0x51a711['body']['ids'][_0x5f4540]),'OpenchannelQueueId':Number(_0x51a711[_0x141c('0x48')]['id'])});}return _0x1ed21b;});}})[_0x141c('0x28')](respondWithResult(_0x9bb0ed,null))[_0x141c('0x4b')](handleError(_0x9bb0ed,null));};exports['removeAgents']=function(_0x310274,_0x3864c9,_0x2df549){return db[_0x141c('0x44')]['find']({'where':{'id':_0x310274[_0x141c('0x48')]['id']}})[_0x141c('0x28')](handleEntityNotFound(_0x3864c9,null))[_0x141c('0x28')](function(_0x225a41){if(_0x225a41){return _0x225a41[_0x141c('0x81')](_0x310274['query'][_0x141c('0x64')])[_0x141c('0x28')](function(){if(_[_0x141c('0x83')](_0x310274[_0x141c('0x34')]['ids'])){for(var _0x1803da=0x0;_0x1803da<_0x310274['query'][_0x141c('0x64')][_0x141c('0x39')];_0x1803da+=0x1){socket[_0x141c('0x6d')](_0x141c('0x84'),{'UserId':Number(_0x310274['query']['ids'][_0x1803da]),'OpenchannelQueueId':Number(_0x310274[_0x141c('0x48')]['id'])});}}else{socket[_0x141c('0x6d')](_0x141c('0x84'),{'UserId':Number(_0x310274[_0x141c('0x34')][_0x141c('0x64')]),'OpenchannelQueueId':Number(_0x310274[_0x141c('0x48')]['id'])});}});}})[_0x141c('0x28')](respondWithStatusCode(_0x3864c9,null))[_0x141c('0x4b')](handleError(_0x3864c9,null));};exports[_0x141c('0x85')]=function(_0x25e9d5,_0x4533da,_0x4e005f){var _0x5f05c={};var _0x415b65={};var _0x2f82a7;var _0x525ae6;return db[_0x141c('0x44')]['findOne']({'where':{'id':_0x25e9d5[_0x141c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4533da,null))[_0x141c('0x28')](function(_0x38ce3a){if(_0x38ce3a){_0x2f82a7=_0x38ce3a;_0x415b65['model']=_[_0x141c('0x35')](db[_0x141c('0x5a')][_0x141c('0x49')]);_0x415b65['query']=_['keys'](_0x25e9d5[_0x141c('0x34')]);_0x415b65[_0x141c('0x3e')]=_[_0x141c('0x36')](_0x415b65['model'],_0x415b65[_0x141c('0x34')]);_0x5f05c[_0x141c('0x37')]=_[_0x141c('0x36')](_0x415b65[_0x141c('0x33')],qs[_0x141c('0x38')](_0x25e9d5[_0x141c('0x34')][_0x141c('0x38')]));_0x5f05c[_0x141c('0x37')]=_0x5f05c['attributes']['length']?_0x5f05c[_0x141c('0x37')]:_0x415b65[_0x141c('0x33')];_0x5f05c[_0x141c('0x3c')]=qs[_0x141c('0x3d')](_0x25e9d5[_0x141c('0x34')][_0x141c('0x3d')]);_0x5f05c['where']=qs['filters'](_[_0x141c('0x58')](_0x25e9d5[_0x141c('0x34')],_0x415b65[_0x141c('0x3e')]));if(_0x25e9d5[_0x141c('0x34')]['filter']){_0x5f05c[_0x141c('0x3f')]=_[_0x141c('0x40')](_0x5f05c[_0x141c('0x3f')],{'$or':_[_0x141c('0x2f')](_0x5f05c['attributes'],function(_0x2c124f){var _0x406417={};_0x406417[_0x2c124f]={'$like':'%'+_0x25e9d5['query'][_0x141c('0x42')]+'%'};return _0x406417;})});}_0x5f05c=_['merge']({},_0x5f05c,_0x25e9d5[_0x141c('0x43')]);return _0x2f82a7['getAgents'](_0x5f05c);}})[_0x141c('0x28')](function(_0x4d76d9){if(_0x4d76d9){_0x525ae6=_0x4d76d9[_0x141c('0x39')];if(!_0x25e9d5[_0x141c('0x34')][_0x141c('0x3a')](_0x141c('0x57'))){_0x5f05c['limit']=qs[_0x141c('0x3b')](_0x25e9d5['query'][_0x141c('0x3b')]);_0x5f05c[_0x141c('0x21')]=qs[_0x141c('0x21')](_0x25e9d5['query'][_0x141c('0x21')]);}return _0x2f82a7['getAgents'](_0x5f05c);}})[_0x141c('0x28')](function(_0x346801){if(_0x346801){return _0x346801?{'count':_0x525ae6,'rows':_0x346801}:null;}})[_0x141c('0x28')](respondWithResult(_0x4533da,null))[_0x141c('0x4b')](handleError(_0x4533da,null));}; \ No newline at end of file +var _0xb307=['each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb307,0x13f));var _0x7b30=function(_0xb18608,_0x29404a){_0xb18608=_0xb18608-0x0;var _0xfb1f59=_0xb307[_0xb18608];return _0xfb1f59;};'use strict';var emlformat=require(_0x7b30('0x0'));var rimraf=require(_0x7b30('0x1'));var zipdir=require(_0x7b30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b30('0x3'));var moment=require(_0x7b30('0x4'));var BPromise=require(_0x7b30('0x5'));var Mustache=require('mustache');var util=require(_0x7b30('0x6'));var path=require(_0x7b30('0x7'));var sox=require(_0x7b30('0x8'));var csv=require(_0x7b30('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b30('0xa'));var _=require(_0x7b30('0xb'));var squel=require(_0x7b30('0xc'));var crypto=require(_0x7b30('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b30('0x9'));var querystring=require(_0x7b30('0xe'));var Papa=require(_0x7b30('0xf'));var Redis=require('ioredis');var authService=require(_0x7b30('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b30('0x11'));var logger=require(_0x7b30('0x12'))(_0x7b30('0x13'));var utils=require('../../config/utils');var config=require(_0x7b30('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b30('0x15'))['db'];config[_0x7b30('0x16')]=_[_0x7b30('0x17')](config[_0x7b30('0x16')],{'host':_0x7b30('0x18'),'port':0x18eb});var socket=require(_0x7b30('0x19'))(new Redis(config[_0x7b30('0x16')]));require(_0x7b30('0x1a'))[_0x7b30('0x1b')](socket);function respondWithStatusCode(_0x24c4cf,_0x2a228b){_0x2a228b=_0x2a228b||0xcc;return function(_0x1d2c70){if(_0x1d2c70){return _0x24c4cf['sendStatus'](_0x2a228b);}return _0x24c4cf[_0x7b30('0x1c')](_0x2a228b)[_0x7b30('0x1d')]();};}function respondWithResult(_0x2e86d1,_0x2fe9d2){_0x2fe9d2=_0x2fe9d2||0xc8;return function(_0x521337){if(_0x521337){return _0x2e86d1[_0x7b30('0x1c')](_0x2fe9d2)[_0x7b30('0x1e')](_0x521337);}};}function respondWithFilteredResult(_0xdf3d46,_0x7841ff){return function(_0x3bf97d){if(_0x3bf97d){var _0xb9d430=typeof _0x7841ff[_0x7b30('0x1f')]===_0x7b30('0x20')&&typeof _0x7841ff[_0x7b30('0x21')]==='undefined';var _0x4dad25=_0x3bf97d[_0x7b30('0x22')];var _0x2fbba6=_0xb9d430?0x0:_0x7841ff['offset'];var _0x30ff17=_0xb9d430?_0x3bf97d[_0x7b30('0x22')]:_0x7841ff['offset']+_0x7841ff[_0x7b30('0x21')];var _0x38b7d0;if(_0x30ff17>=_0x4dad25){_0x30ff17=_0x4dad25;_0x38b7d0=0xc8;}else{_0x38b7d0=0xce;}_0xdf3d46['status'](_0x38b7d0);return _0xdf3d46['set'](_0x7b30('0x23'),_0x2fbba6+'-'+_0x30ff17+'/'+_0x4dad25)['json'](_0x3bf97d);}return null;};}function patchUpdates(_0x282bcc){return function(_0x32ef59){try{jsonpatch[_0x7b30('0x24')](_0x32ef59,_0x282bcc,!![]);}catch(_0x2edb78){return BPromise[_0x7b30('0x25')](_0x2edb78);}return _0x32ef59[_0x7b30('0x26')]();};}function saveUpdates(_0x1ec2cc,_0x47dff6){return function(_0x34c773){if(_0x34c773){return _0x34c773[_0x7b30('0x27')](_0x1ec2cc)[_0x7b30('0x28')](function(_0x2bb750){return _0x2bb750;});}return null;};}function removeEntity(_0x3dd5aa,_0x1659c3){return function(_0x522fb6){if(_0x522fb6){return _0x522fb6[_0x7b30('0x29')]()['then'](function(){var _0x42ea40=_0x522fb6['get']({'plain':!![]});var _0x21105d=_0x7b30('0x2a');return db[_0x7b30('0x2b')][_0x7b30('0x29')]({'where':{'type':_0x21105d,'resourceId':_0x42ea40['id']}})['then'](function(){return _0x522fb6;});})[_0x7b30('0x28')](function(){_0x3dd5aa[_0x7b30('0x1c')](0xcc)[_0x7b30('0x1d')]();});}};}function handleEntityNotFound(_0xaa2675,_0x3d4211){return function(_0x475c91){if(!_0x475c91){_0xaa2675['sendStatus'](0x194);}return _0x475c91;};}function handleError(_0x3a47d5,_0xde7eb){_0xde7eb=_0xde7eb||0x1f4;return function(_0xde0f93){logger[_0x7b30('0x2c')](_0xde0f93[_0x7b30('0x2d')]);if(_0xde0f93['name']){delete _0xde0f93[_0x7b30('0x2e')];}_0x3a47d5[_0x7b30('0x1c')](_0xde7eb)[_0x7b30('0x2f')](_0xde0f93);};}exports[_0x7b30('0x30')]=function(_0x245b2c,_0x29ee55){var _0x1e4cb1={},_0x59e0ff={},_0x3977fd={'count':0x0,'rows':[]};var _0x42f907=_[_0x7b30('0x31')](db['OpenchannelQueue'][_0x7b30('0x32')],function(_0x3599a3){return{'name':_0x3599a3[_0x7b30('0x33')],'type':_0x3599a3[_0x7b30('0x34')][_0x7b30('0x35')]};});_0x59e0ff[_0x7b30('0x36')]=_['map'](_0x42f907,_0x7b30('0x2e'));_0x59e0ff[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x245b2c[_0x7b30('0x37')]);_0x59e0ff[_0x7b30('0x39')]=_[_0x7b30('0x3a')](_0x59e0ff['model'],_0x59e0ff['query']);_0x1e4cb1['attributes']=_[_0x7b30('0x3a')](_0x59e0ff[_0x7b30('0x36')],qs[_0x7b30('0x3b')](_0x245b2c[_0x7b30('0x37')][_0x7b30('0x3b')]));_0x1e4cb1[_0x7b30('0x3c')]=_0x1e4cb1[_0x7b30('0x3c')][_0x7b30('0x3d')]?_0x1e4cb1[_0x7b30('0x3c')]:_0x59e0ff[_0x7b30('0x36')];if(!_0x245b2c[_0x7b30('0x37')]['hasOwnProperty'](_0x7b30('0x3e'))){_0x1e4cb1['limit']=qs[_0x7b30('0x21')](_0x245b2c['query'][_0x7b30('0x21')]);_0x1e4cb1[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x245b2c['query'][_0x7b30('0x1f')]);}_0x1e4cb1[_0x7b30('0x3f')]=qs[_0x7b30('0x40')](_0x245b2c[_0x7b30('0x37')]['sort']);_0x1e4cb1[_0x7b30('0x41')]=qs[_0x7b30('0x39')](_[_0x7b30('0x42')](_0x245b2c[_0x7b30('0x37')],_0x59e0ff[_0x7b30('0x39')]),_0x42f907);if(_0x245b2c['query'][_0x7b30('0x43')]){_0x1e4cb1[_0x7b30('0x41')]=_[_0x7b30('0x44')](_0x1e4cb1['where'],{'$or':_[_0x7b30('0x31')](_0x42f907,function(_0xcc5bb3){if(_0xcc5bb3[_0x7b30('0x34')]!=='VIRTUAL'){var _0x501312={};_0x501312[_0xcc5bb3[_0x7b30('0x2e')]]={'$like':'%'+_0x245b2c[_0x7b30('0x37')][_0x7b30('0x43')]+'%'};return _0x501312;}})});}_0x1e4cb1=_[_0x7b30('0x44')]({},_0x1e4cb1,_0x245b2c[_0x7b30('0x45')]);var _0x506611={'where':_0x1e4cb1['where']};return db[_0x7b30('0x46')][_0x7b30('0x22')](_0x506611)['then'](function(_0x206f20){_0x3977fd[_0x7b30('0x22')]=_0x206f20;if(_0x245b2c[_0x7b30('0x37')][_0x7b30('0x47')]){_0x1e4cb1[_0x7b30('0x48')]=[{'all':!![]}];}return db[_0x7b30('0x46')][_0x7b30('0x49')](_0x1e4cb1);})[_0x7b30('0x28')](function(_0x28a0b2){_0x3977fd[_0x7b30('0x4a')]=_0x28a0b2;return _0x3977fd;})[_0x7b30('0x28')](respondWithFilteredResult(_0x29ee55,_0x1e4cb1))[_0x7b30('0x4b')](handleError(_0x29ee55,null));};exports[_0x7b30('0x4c')]=function(_0x2ba22d,_0x4a603c){var _0x3c2470={'raw':!![],'where':{'id':_0x2ba22d[_0x7b30('0x4d')]['id']}},_0x5c1797={};_0x5c1797['model']=_['keys'](db[_0x7b30('0x46')]['rawAttributes']);_0x5c1797['query']=_[_0x7b30('0x38')](_0x2ba22d[_0x7b30('0x37')]);_0x5c1797['filters']=_[_0x7b30('0x3a')](_0x5c1797['model'],_0x5c1797[_0x7b30('0x37')]);_0x3c2470['attributes']=_['intersection'](_0x5c1797[_0x7b30('0x36')],qs[_0x7b30('0x3b')](_0x2ba22d['query'][_0x7b30('0x3b')]));_0x3c2470['attributes']=_0x3c2470[_0x7b30('0x3c')]['length']?_0x3c2470['attributes']:_0x5c1797['model'];if(_0x2ba22d[_0x7b30('0x37')]['includeAll']){_0x3c2470[_0x7b30('0x48')]=[{'all':!![]}];}_0x3c2470=_[_0x7b30('0x44')]({},_0x3c2470,_0x2ba22d['options']);return db[_0x7b30('0x46')][_0x7b30('0x4e')](_0x3c2470)['then'](handleEntityNotFound(_0x4a603c,null))[_0x7b30('0x28')](respondWithResult(_0x4a603c,null))['catch'](handleError(_0x4a603c,null));};exports[_0x7b30('0x4f')]=function(_0x2c1887,_0x237f44){return db['OpenchannelQueue']['create'](_0x2c1887[_0x7b30('0x50')],{})[_0x7b30('0x28')](function(_0x45d1be){var _0x513454=_0x2c1887[_0x7b30('0x51')]['get']({'plain':!![]});if(!_0x513454)throw new Error(_0x7b30('0x52'));if(_0x513454['role']===_0x7b30('0x51')){var _0x19f4ee=_0x45d1be[_0x7b30('0x53')]({'plain':!![]});var _0x29da21=_0x7b30('0x2a');return db[_0x7b30('0x54')][_0x7b30('0x4e')]({'where':{'name':_0x29da21,'userProfileId':_0x513454[_0x7b30('0x55')]},'raw':!![]})[_0x7b30('0x28')](function(_0x56d878){if(_0x56d878&&_0x56d878[_0x7b30('0x56')]===0x0){return db[_0x7b30('0x2b')][_0x7b30('0x4f')]({'name':_0x19f4ee[_0x7b30('0x2e')],'resourceId':_0x19f4ee['id'],'type':_0x56d878[_0x7b30('0x2e')],'sectionId':_0x56d878['id']},{})[_0x7b30('0x28')](function(){return _0x45d1be;});}else{return _0x45d1be;}})['catch'](function(_0x3b2b71){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b2b71);throw _0x3b2b71;});}return _0x45d1be;})[_0x7b30('0x28')](respondWithResult(_0x237f44,0xc9))['catch'](handleError(_0x237f44,null));};exports[_0x7b30('0x27')]=function(_0x42ec3e,_0x2d013d){if(_0x42ec3e[_0x7b30('0x50')]['id']){delete _0x42ec3e['body']['id'];}return db[_0x7b30('0x46')][_0x7b30('0x4e')]({'where':{'id':_0x42ec3e[_0x7b30('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d013d,null))[_0x7b30('0x28')](saveUpdates(_0x42ec3e['body'],null))['then'](respondWithResult(_0x2d013d,null))[_0x7b30('0x4b')](handleError(_0x2d013d,null));};exports[_0x7b30('0x29')]=function(_0x38cda8,_0x2e744f){return db[_0x7b30('0x46')][_0x7b30('0x4e')]({'where':{'id':_0x38cda8['params']['id']}})[_0x7b30('0x28')](handleEntityNotFound(_0x2e744f,null))['then'](removeEntity(_0x2e744f,null))[_0x7b30('0x4b')](handleError(_0x2e744f,null));};exports['describe']=function(_0x41597d,_0x384fa6){return db['OpenchannelQueue'][_0x7b30('0x57')]()[_0x7b30('0x28')](respondWithResult(_0x384fa6,null))[_0x7b30('0x4b')](handleError(_0x384fa6,null));};exports[_0x7b30('0x58')]=function(_0x1344fa,_0xebcdc2,_0x14aae3){var _0x26876e={'raw':!![],'where':{}},_0x15174c={},_0x48b0d1;return db[_0x7b30('0x46')][_0x7b30('0x59')]({'where':{'id':_0x1344fa[_0x7b30('0x4d')]['id']}})[_0x7b30('0x28')](handleEntityNotFound(_0xebcdc2,null))['then'](function(_0x22e00c){if(_0x22e00c){_0x48b0d1=_0x22e00c[_0x7b30('0x53')]({'plain':!![]});_0x15174c[_0x7b30('0x36')]=_[_0x7b30('0x38')](db[_0x7b30('0x5a')]['rawAttributes']);_0x15174c[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x1344fa['query']);_0x15174c[_0x7b30('0x39')]=_[_0x7b30('0x3a')](_0x15174c[_0x7b30('0x36')],_0x15174c[_0x7b30('0x37')]);_0x26876e[_0x7b30('0x3c')]=_[_0x7b30('0x3a')](_0x15174c[_0x7b30('0x36')],qs[_0x7b30('0x3b')](_0x1344fa['query']['fields']));_0x26876e[_0x7b30('0x3c')]=_0x26876e[_0x7b30('0x3c')]['length']?_0x26876e[_0x7b30('0x3c')]:_0x15174c[_0x7b30('0x36')];if(!_0x1344fa[_0x7b30('0x37')][_0x7b30('0x5b')]('nolimit')){_0x26876e[_0x7b30('0x21')]=qs[_0x7b30('0x21')](_0x1344fa[_0x7b30('0x37')][_0x7b30('0x21')]);_0x26876e[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x1344fa[_0x7b30('0x37')][_0x7b30('0x1f')]);}_0x26876e[_0x7b30('0x3f')]=qs[_0x7b30('0x40')](_0x1344fa[_0x7b30('0x37')]['sort']);_0x26876e[_0x7b30('0x41')]=qs['filters'](_[_0x7b30('0x42')](_0x1344fa[_0x7b30('0x37')],_0x15174c[_0x7b30('0x39')]));_0x26876e['where'][_0x7b30('0x5c')]=_0x22e00c['id'];if(_0x1344fa[_0x7b30('0x37')]['filter']){_0x26876e[_0x7b30('0x41')]=_['merge'](_0x26876e[_0x7b30('0x41')],{'$or':_[_0x7b30('0x31')](_0x26876e[_0x7b30('0x3c')],function(_0x19f111){var _0x4c6d76={};_0x4c6d76[_0x19f111]={'$like':'%'+_0x1344fa[_0x7b30('0x37')][_0x7b30('0x43')]+'%'};return _0x4c6d76;})});}_0x26876e=_[_0x7b30('0x44')]({},_0x26876e,_0x1344fa['options']);return db['UserOpenchannelQueue'][_0x7b30('0x49')](_0x26876e);}})['then'](function(_0x21d0cd){if(_0x21d0cd){return db['User'][_0x7b30('0x5d')]({'where':{'id':_[_0x7b30('0x31')](_0x21d0cd,'UserId'),'role':_0x7b30('0x5e')},'attributes':['id',_0x7b30('0x2e'),_0x7b30('0x5f'),_0x7b30('0x60'),_0x7b30('0x61')]});}})[_0x7b30('0x28')](function(_0xe8900e){if(_0xe8900e){return{'count':_0xe8900e[_0x7b30('0x22')],'rows':_[_0x7b30('0x31')](_0xe8900e[_0x7b30('0x4a')],function(_0x424693){return{'membername':_0x424693[_0x7b30('0x2e')],'UserId':_0x424693['id'],'queue_name':_0x48b0d1[_0x7b30('0x2e')],'OpenchannelQueueId':_0x48b0d1['id'],'interface':util[_0x7b30('0x62')]('%s/%s','SIP',_0x424693[_0x7b30('0x2e')]),'penalty':0x0,'paused':_0x424693['openchannelPause'],'createdAt':_0x424693[_0x7b30('0x61')],'updatedAt':_0x424693['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b30('0x28')](respondWithFilteredResult(_0xebcdc2,_0x26876e))[_0x7b30('0x4b')](handleError(_0xebcdc2,null));};exports['getTeams']=function(_0x19ba91,_0x11dab7,_0x15cc9a){var _0x266405={};var _0x62bcb3={};var _0xd5e230;var _0x2ec805;return db[_0x7b30('0x46')][_0x7b30('0x59')]({'where':{'id':_0x19ba91[_0x7b30('0x4d')]['id']}})[_0x7b30('0x28')](handleEntityNotFound(_0x11dab7,null))[_0x7b30('0x28')](function(_0x1e4156){if(_0x1e4156){_0xd5e230=_0x1e4156;_0x62bcb3[_0x7b30('0x36')]=_[_0x7b30('0x38')](db[_0x7b30('0x63')][_0x7b30('0x32')]);_0x62bcb3['query']=_[_0x7b30('0x38')](_0x19ba91[_0x7b30('0x37')]);_0x62bcb3[_0x7b30('0x39')]=_['intersection'](_0x62bcb3[_0x7b30('0x36')],_0x62bcb3['query']);_0x266405[_0x7b30('0x3c')]=_[_0x7b30('0x3a')](_0x62bcb3[_0x7b30('0x36')],qs[_0x7b30('0x3b')](_0x19ba91[_0x7b30('0x37')]['fields']));_0x266405[_0x7b30('0x3c')]=_0x266405[_0x7b30('0x3c')]['length']?_0x266405['attributes']:_0x62bcb3[_0x7b30('0x36')];_0x266405[_0x7b30('0x3f')]=qs[_0x7b30('0x40')](_0x19ba91[_0x7b30('0x37')][_0x7b30('0x40')]);_0x266405[_0x7b30('0x41')]=qs[_0x7b30('0x39')](_[_0x7b30('0x42')](_0x19ba91[_0x7b30('0x37')],_0x62bcb3[_0x7b30('0x39')]));if(_0x19ba91['query']['filter']){_0x266405['where']=_[_0x7b30('0x44')](_0x266405[_0x7b30('0x41')],{'$or':_[_0x7b30('0x31')](_0x266405['attributes'],function(_0x50b4cf){var _0xfd28dc={};_0xfd28dc[_0x50b4cf]={'$like':'%'+_0x19ba91[_0x7b30('0x37')][_0x7b30('0x43')]+'%'};return _0xfd28dc;})});}_0x266405=_[_0x7b30('0x44')]({},_0x266405,_0x19ba91['options']);return _0xd5e230[_0x7b30('0x64')](_0x266405);}})['then'](function(_0x1091d3){if(_0x1091d3){_0x2ec805=_0x1091d3[_0x7b30('0x3d')];if(!_0x19ba91[_0x7b30('0x37')][_0x7b30('0x5b')](_0x7b30('0x3e'))){_0x266405[_0x7b30('0x21')]=qs['limit'](_0x19ba91[_0x7b30('0x37')][_0x7b30('0x21')]);_0x266405[_0x7b30('0x1f')]=qs['offset'](_0x19ba91[_0x7b30('0x37')][_0x7b30('0x1f')]);}return _0xd5e230[_0x7b30('0x64')](_0x266405);}})[_0x7b30('0x28')](function(_0x4fa950){if(_0x4fa950){return _0x4fa950?{'count':_0x2ec805,'rows':_0x4fa950}:null;}})['then'](respondWithResult(_0x11dab7,null))[_0x7b30('0x4b')](handleError(_0x11dab7,null));};exports[_0x7b30('0x65')]=function(_0x3b90b4,_0x416126,_0x20f45c){var _0x3ce69b=_0x3b90b4['body'][_0x7b30('0x66')];return db[_0x7b30('0x63')]['findAll']({'where':{'id':_0x3ce69b},'attributes':['id'],'include':[{'model':db[_0x7b30('0x67')],'as':_0x7b30('0x68'),'attributes':['id','name',_0x7b30('0x69'),_0x7b30('0x6a'),'interface'],'raw':!![]}]})[_0x7b30('0x28')](function(_0x4c2aa0){if(_0x4c2aa0){var _0x4c8d71=_[_0x7b30('0x6b')](_0x4c2aa0,function(_0x45e0bb){var _0x1f1203=_0x45e0bb[_0x7b30('0x53')]({'plain':!![]});return _0x1f1203['Agents'];});return db[_0x7b30('0x46')][_0x7b30('0x4e')]({'where':{'id':_0x3b90b4[_0x7b30('0x4d')]['id']}})['then'](function(_0x333301){return db[_0x7b30('0x6c')][_0x7b30('0x6d')](function(_0x41d3c9){return _0x333301['addTeams'](_0x3ce69b,{'transaction':_0x41d3c9})['then'](function(){return BPromise[_0x7b30('0x6e')](_0x4c8d71,function(_0x505527){return db[_0x7b30('0x5a')][_0x7b30('0x6f')]({'where':{'UserId':_0x505527['id'],'OpenchannelQueueId':_0x3b90b4[_0x7b30('0x4d')]['id']},'transaction':_0x41d3c9});});})[_0x7b30('0x28')](function(){_0x4c8d71['forEach'](function(_0xe6240c){socket['emit'](_0x7b30('0x70'),{'UserId':_0xe6240c['id'],'OpenchannelQueueId':_0x333301['id']});});});});});}})[_0x7b30('0x28')](respondWithStatusCode(_0x416126,null))[_0x7b30('0x4b')](handleError(_0x416126,null));};exports[_0x7b30('0x71')]=function(_0x1d8587,_0x2f5132,_0xed8c87){return db[_0x7b30('0x63')][_0x7b30('0x49')]({'where':{'id':_0x1d8587[_0x7b30('0x37')][_0x7b30('0x66')]},'attributes':['id'],'include':[{'model':db[_0x7b30('0x67')],'as':_0x7b30('0x68'),'attributes':['id'],'raw':!![]}]})[_0x7b30('0x28')](handleEntityNotFound(_0x2f5132,null))[_0x7b30('0x28')](function(_0x193939){var _0x1a1d03=_[_0x7b30('0x31')](_0x193939,'id');var _0x60b197=[];var _0x205be9=[];var _0x42de65=squel[_0x7b30('0x72')]();_0x42de65[_0x7b30('0x73')](_0x7b30('0x74'))[_0x7b30('0x75')](_0x7b30('0x76'),'tq')[_0x7b30('0x77')]('user_has_teams','ut',_0x7b30('0x78'))[_0x7b30('0x41')](_0x7b30('0x79'),_0x1d8587[_0x7b30('0x4d')]['id']);for(var _0x3de8c8=0x0;_0x3de8c8<_0x193939[_0x7b30('0x3d')];_0x3de8c8+=0x1){let _0x42a88f=_0x193939[_0x3de8c8];for(var _0x1874e9=0x0;_0x1874e9<_0x42a88f['Agents']['length'];_0x1874e9+=0x1){let _0x2840e3=_0x42a88f[_0x7b30('0x68')][_0x1874e9];var _0x9b02c0=_0x42de65[_0x7b30('0x7a')]();_0x9b02c0['where'](_0x7b30('0x7b'),_0x2840e3['id']);_0x205be9[_0x7b30('0x7c')](db['sequelize'][_0x7b30('0x37')](_0x9b02c0[_0x7b30('0x7d')](),{'type':db['sequelize']['QueryTypes'][_0x7b30('0x7e')]})[_0x7b30('0x28')](function(_0x55383f){if(_0x55383f['length']===0x1){return _0x2840e3['id'];}else{var _0x975c97=_[_0x7b30('0x7f')](_[_0x7b30('0x31')](_0x55383f,_0x7b30('0x80')),function(_0x231d48){return _[_0x7b30('0x81')](_0x1a1d03,_0x231d48);});if(_0x975c97){return _0x2840e3['id'];}}}));}}return BPromise[_0x7b30('0x82')](_0x205be9)[_0x7b30('0x28')](function(_0x9622b9){_0x60b197=_(_0x60b197)['union'](_0x9622b9)[_0x7b30('0x83')]()[_0x7b30('0x84')]();return db[_0x7b30('0x46')][_0x7b30('0x4e')]({'where':{'id':_0x1d8587[_0x7b30('0x4d')]['id']}})[_0x7b30('0x28')](function(_0x2e0a91){return db[_0x7b30('0x6c')][_0x7b30('0x6d')](function(_0x48d882){return _0x2e0a91[_0x7b30('0x71')](_0x1d8587[_0x7b30('0x37')]['ids'],{'transaction':_0x48d882})[_0x7b30('0x28')](function(){if(!_[_0x7b30('0x85')](_0x60b197)){return _0x2e0a91[_0x7b30('0x86')](_0x60b197,{'transaction':_0x48d882});}})[_0x7b30('0x28')](function(){_0x60b197[_0x7b30('0x87')](function(_0x1af4d9){socket[_0x7b30('0x88')](_0x7b30('0x89'),{'UserId':_0x1af4d9,'OpenchannelQueueId':_0x2e0a91['id']});});});});});});})[_0x7b30('0x28')](respondWithStatusCode(_0x2f5132,null))[_0x7b30('0x4b')](handleError(_0x2f5132,null));};exports['addAgents']=function(_0x334afd,_0x42acbc,_0x27aee9){return db[_0x7b30('0x46')][_0x7b30('0x4e')]({'where':{'id':_0x334afd[_0x7b30('0x4d')]['id']}})['then'](handleEntityNotFound(_0x42acbc,null))[_0x7b30('0x28')](function(_0xb0c9f2){if(_0xb0c9f2){return _0xb0c9f2[_0x7b30('0x8a')](_0x334afd[_0x7b30('0x50')][_0x7b30('0x66')],_[_0x7b30('0x8b')](_0x334afd['body'],[_0x7b30('0x66'),'id'])||{})[_0x7b30('0x8c')](function(_0x286f21){for(var _0x37d842=0x0;_0x37d842<_0x334afd[_0x7b30('0x50')][_0x7b30('0x66')][_0x7b30('0x3d')];_0x37d842+=0x1){socket[_0x7b30('0x88')](_0x7b30('0x70'),{'UserId':Number(_0x334afd[_0x7b30('0x50')]['ids'][_0x37d842]),'OpenchannelQueueId':Number(_0x334afd[_0x7b30('0x4d')]['id'])});}return _0x286f21;});}})[_0x7b30('0x28')](respondWithResult(_0x42acbc,null))[_0x7b30('0x4b')](handleError(_0x42acbc,null));};exports[_0x7b30('0x86')]=function(_0x370e53,_0x5cbda2,_0x31c2f7){return db['OpenchannelQueue']['find']({'where':{'id':_0x370e53['params']['id']}})[_0x7b30('0x28')](handleEntityNotFound(_0x5cbda2,null))['then'](function(_0x54c134){if(_0x54c134){return _0x54c134[_0x7b30('0x86')](_0x370e53[_0x7b30('0x37')]['ids'])['then'](function(){if(_[_0x7b30('0x8d')](_0x370e53[_0x7b30('0x37')][_0x7b30('0x66')])){for(var _0x41816a=0x0;_0x41816a<_0x370e53[_0x7b30('0x37')][_0x7b30('0x66')][_0x7b30('0x3d')];_0x41816a+=0x1){socket[_0x7b30('0x88')](_0x7b30('0x89'),{'UserId':Number(_0x370e53[_0x7b30('0x37')][_0x7b30('0x66')][_0x41816a]),'OpenchannelQueueId':Number(_0x370e53[_0x7b30('0x4d')]['id'])});}}else{socket[_0x7b30('0x88')](_0x7b30('0x89'),{'UserId':Number(_0x370e53[_0x7b30('0x37')][_0x7b30('0x66')]),'OpenchannelQueueId':Number(_0x370e53['params']['id'])});}});}})[_0x7b30('0x28')](respondWithStatusCode(_0x5cbda2,null))['catch'](handleError(_0x5cbda2,null));};exports['getAgents']=function(_0x4fa726,_0x52bb46,_0x44d44f){var _0x56fc78={};var _0x39186e={};var _0xcf8fdc;var _0x1b5137;return db[_0x7b30('0x46')][_0x7b30('0x59')]({'where':{'id':_0x4fa726[_0x7b30('0x4d')]['id']}})[_0x7b30('0x28')](handleEntityNotFound(_0x52bb46,null))[_0x7b30('0x28')](function(_0x5a5758){if(_0x5a5758){_0xcf8fdc=_0x5a5758;_0x39186e['model']=_[_0x7b30('0x38')](db[_0x7b30('0x67')]['rawAttributes']);_0x39186e[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x4fa726[_0x7b30('0x37')]);_0x39186e['filters']=_[_0x7b30('0x3a')](_0x39186e[_0x7b30('0x36')],_0x39186e['query']);_0x56fc78[_0x7b30('0x3c')]=_[_0x7b30('0x3a')](_0x39186e[_0x7b30('0x36')],qs[_0x7b30('0x3b')](_0x4fa726[_0x7b30('0x37')]['fields']));_0x56fc78[_0x7b30('0x3c')]=_0x56fc78[_0x7b30('0x3c')][_0x7b30('0x3d')]?_0x56fc78[_0x7b30('0x3c')]:_0x39186e[_0x7b30('0x36')];_0x56fc78[_0x7b30('0x3f')]=qs[_0x7b30('0x40')](_0x4fa726[_0x7b30('0x37')]['sort']);_0x56fc78[_0x7b30('0x41')]=qs[_0x7b30('0x39')](_['pick'](_0x4fa726[_0x7b30('0x37')],_0x39186e[_0x7b30('0x39')]));if(_0x4fa726[_0x7b30('0x37')][_0x7b30('0x43')]){_0x56fc78[_0x7b30('0x41')]=_[_0x7b30('0x44')](_0x56fc78[_0x7b30('0x41')],{'$or':_[_0x7b30('0x31')](_0x56fc78[_0x7b30('0x3c')],function(_0x4701cc){var _0x4c20b3={};_0x4c20b3[_0x4701cc]={'$like':'%'+_0x4fa726[_0x7b30('0x37')][_0x7b30('0x43')]+'%'};return _0x4c20b3;})});}_0x56fc78=_[_0x7b30('0x44')]({},_0x56fc78,_0x4fa726[_0x7b30('0x45')]);return _0xcf8fdc[_0x7b30('0x8e')](_0x56fc78);}})['then'](function(_0x5d5737){if(_0x5d5737){_0x1b5137=_0x5d5737[_0x7b30('0x3d')];if(!_0x4fa726[_0x7b30('0x37')][_0x7b30('0x5b')]('nolimit')){_0x56fc78[_0x7b30('0x21')]=qs[_0x7b30('0x21')](_0x4fa726[_0x7b30('0x37')][_0x7b30('0x21')]);_0x56fc78[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x4fa726['query']['offset']);}return _0xcf8fdc[_0x7b30('0x8e')](_0x56fc78);}})[_0x7b30('0x28')](function(_0x4881d0){if(_0x4881d0){return _0x4881d0?{'count':_0x1b5137,'rows':_0x4881d0}:null;}})[_0x7b30('0x28')](respondWithResult(_0x52bb46,null))['catch'](handleError(_0x52bb46,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1b1bb20..08e596a 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 _0x2ce5=['OpenchannelQueue','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2ce5,0xa6));var _0x52ce=function(_0x9f2616,_0x59d43e){_0x9f2616=_0x9f2616-0x0;var _0xe0475f=_0x2ce5[_0x9f2616];return _0xe0475f;};'use strict';var EventEmitter=require(_0x52ce('0x0'));var OpenchannelQueue=require(_0x52ce('0x1'))['db'][_0x52ce('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x52ce('0x3'),'afterUpdate':'update','afterDestroy':_0x52ce('0x4')};function emitEvent(_0x2d5f91){return function(_0x440b7b,_0x164e34,_0x4ad7d8){OpenchannelQueueEvents[_0x52ce('0x5')](_0x2d5f91+':'+_0x440b7b['id'],_0x440b7b);OpenchannelQueueEvents[_0x52ce('0x5')](_0x2d5f91,_0x440b7b);_0x4ad7d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x52ce('0x6')](e,emitEvent(event));}}module[_0x52ce('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1913=['setMaxListeners','save','update','emit','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x1d69a9,_0x3e8c40){var _0x4df8b8=function(_0x5122a0){while(--_0x5122a0){_0x1d69a9['push'](_0x1d69a9['shift']());}};_0x4df8b8(++_0x3e8c40);}(_0x1913,0xd5));var _0x3191=function(_0x36a693,_0x1e6511){_0x36a693=_0x36a693-0x0;var _0xd7dbe9=_0x1913[_0x36a693];return _0xd7dbe9;};'use strict';var EventEmitter=require(_0x3191('0x0'));var OpenchannelQueue=require(_0x3191('0x1'))['db'][_0x3191('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3191('0x3')](0x0);var events={'afterCreate':_0x3191('0x4'),'afterUpdate':_0x3191('0x5'),'afterDestroy':'remove'};function emitEvent(_0x122318){return function(_0x13ffb0,_0x3b6acd,_0x2eca84){OpenchannelQueueEvents[_0x3191('0x6')](_0x122318+':'+_0x13ffb0['id'],_0x13ffb0);OpenchannelQueueEvents[_0x3191('0x6')](_0x122318,_0x13ffb0);_0x2eca84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x3191('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 792ca26..27e67b7 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 _0xb280=['util','api','moment','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x8b2ad2,_0x4541d4){var _0x4993f1=function(_0x50013d){while(--_0x50013d){_0x8b2ad2['push'](_0x8b2ad2['shift']());}};_0x4993f1(++_0x4541d4);}(_0xb280,0x6b));var _0x0b28=function(_0x5508aa,_0xf9ea5){_0x5508aa=_0x5508aa-0x0;var _0x19bb18=_0xb280[_0x5508aa];return _0x19bb18;};'use strict';var _=require(_0x0b28('0x0'));var util=require(_0x0b28('0x1'));var logger=require('../../config/logger')(_0x0b28('0x2'));var moment=require(_0x0b28('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b28('0x4'));var rimraf=require(_0x0b28('0x5'));var config=require(_0x0b28('0x6'));var attributes=require(_0x0b28('0x7'));module[_0x0b28('0x8')]=function(_0x3871fd,_0x43a050){return _0x3871fd[_0x0b28('0x9')](_0x0b28('0xa'),attributes,{'tableName':_0x0b28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ea=['request-promise','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','bluebird'];(function(_0x6e9a01,_0x41ab36){var _0x238469=function(_0x4811e){while(--_0x4811e){_0x6e9a01['push'](_0x6e9a01['shift']());}};_0x238469(++_0x41ab36);}(_0xb5ea,0x1bf));var _0xab5e=function(_0x1a4e8c,_0x4b4fed){_0x1a4e8c=_0x1a4e8c-0x0;var _0x52f45d=_0xb5ea[_0x1a4e8c];return _0x52f45d;};'use strict';var _=require('lodash');var util=require(_0xab5e('0x0'));var logger=require(_0xab5e('0x1'))(_0xab5e('0x2'));var moment=require('moment');var BPromise=require(_0xab5e('0x3'));var rp=require(_0xab5e('0x4'));var fs=require('fs');var path=require(_0xab5e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab5e('0x6'));module[_0xab5e('0x7')]=function(_0x35cc95,_0x4b7ed2){return _0x35cc95[_0xab5e('0x8')](_0xab5e('0x9'),attributes,{'tableName':_0xab5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 0beea8f..d87f915 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 _0xbddb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','model','catch','ShowOpenchannelQueue','find','map','lodash','util'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xbddb,0x1de));var _0xbbdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbddb[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xbbdd('0x0'));var util=require(_0xbbdd('0x1'));var moment=require(_0xbbdd('0x2'));var BPromise=require(_0xbbdd('0x3'));var rs=require(_0xbbdd('0x4'));var fs=require('fs');var Redis=require(_0xbbdd('0x5'));var db=require(_0xbbdd('0x6'))['db'];var utils=require(_0xbbdd('0x7'));var logger=require('../../config/logger')(_0xbbdd('0x8'));var config=require('../../config/environment');var jayson=require(_0xbbdd('0x9'));var client=jayson[_0xbbdd('0xa')]['http']({'port':0x232a});config[_0xbbdd('0xb')]=_[_0xbbdd('0xc')](config[_0xbbdd('0xb')],{'host':_0xbbdd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbbdd('0xe'))[_0xbbdd('0xf')](socket);function respondWithRpcPromise(_0x5ea0c7,_0x448fac,_0x4bcd9e){return new BPromise(function(_0x1c5bf9,_0x54c397){return client[_0xbbdd('0x10')](_0x5ea0c7,_0x4bcd9e)[_0xbbdd('0x11')](function(_0x59cb32){logger[_0xbbdd('0x12')](_0xbbdd('0x13'),_0x448fac,'request\x20sent');logger[_0xbbdd('0x14')](_0xbbdd('0x15'),_0x448fac,_0xbbdd('0x16'),JSON[_0xbbdd('0x17')](_0x59cb32));if(_0x59cb32[_0xbbdd('0x18')]){if(_0x59cb32[_0xbbdd('0x18')][_0xbbdd('0x19')]===0x1f4){logger[_0xbbdd('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x448fac,_0x59cb32[_0xbbdd('0x18')]['message']);return _0x54c397(_0x59cb32[_0xbbdd('0x18')][_0xbbdd('0x1a')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x448fac,_0x59cb32[_0xbbdd('0x18')]['message']);return _0x1c5bf9(_0x59cb32[_0xbbdd('0x18')]['message']);}else{logger['info'](_0xbbdd('0x13'),_0x448fac,_0xbbdd('0x16'));_0x1c5bf9(_0x59cb32['result']['message']);}})['catch'](function(_0x3298f0){logger[_0xbbdd('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x448fac,_0x3298f0);_0x54c397(_0x3298f0);});});}exports[_0xbbdd('0x1b')]=function(_0x3d9f12){var _0x4df4c6=this;return new Promise(function(_0x2ca5fd,_0x1a0063){return db[_0xbbdd('0x1c')][_0xbbdd('0x1d')]({'raw':_0x3d9f12[_0xbbdd('0x1e')]?_0x3d9f12[_0xbbdd('0x1e')][_0xbbdd('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d9f12['options']?_0x3d9f12[_0xbbdd('0x1e')]['where']||null:null,'attributes':_0x3d9f12[_0xbbdd('0x1e')]?_0x3d9f12[_0xbbdd('0x1e')][_0xbbdd('0x20')]||null:null,'limit':_0x3d9f12[_0xbbdd('0x1e')]?_0x3d9f12[_0xbbdd('0x1e')][_0xbbdd('0x21')]||null:null,'include':_0x3d9f12[_0xbbdd('0x1e')]?_0x3d9f12['options'][_0xbbdd('0x22')]?_['map'](_0x3d9f12[_0xbbdd('0x1e')][_0xbbdd('0x22')],function(_0x2df3fe){return{'model':db[_0x2df3fe['model']],'as':_0x2df3fe['as'],'attributes':_0x2df3fe[_0xbbdd('0x20')],'include':_0x2df3fe[_0xbbdd('0x22')]?_['map'](_0x2df3fe[_0xbbdd('0x22')],function(_0x5b5266){return{'model':db[_0x5b5266[_0xbbdd('0x23')]],'as':_0x5b5266['as'],'attributes':_0x5b5266[_0xbbdd('0x20')],'include':_0x5b5266[_0xbbdd('0x22')]?_['map'](_0x5b5266['include'],function(_0x52cf27){return{'model':db[_0x52cf27[_0xbbdd('0x23')]],'as':_0x52cf27['as'],'attributes':_0x52cf27[_0xbbdd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbbdd('0x11')](function(_0x5118a7){logger[_0xbbdd('0x12')](_0xbbdd('0x1b'),_0x3d9f12);logger['debug'](_0xbbdd('0x1b'),_0x3d9f12,JSON['stringify'](_0x5118a7));_0x2ca5fd(_0x5118a7);})[_0xbbdd('0x24')](function(_0x30a7c7){logger[_0xbbdd('0x18')](_0xbbdd('0x1b'),_0x30a7c7['message'],_0x3d9f12);_0x1a0063(_0x4df4c6[_0xbbdd('0x18')](0x1f4,_0x30a7c7[_0xbbdd('0x1a')]));});});};exports[_0xbbdd('0x25')]=function(_0x5a987a){var _0x3a2a56=this;return new Promise(function(_0x2403ac,_0x500a75){return db[_0xbbdd('0x1c')][_0xbbdd('0x26')]({'raw':_0x5a987a[_0xbbdd('0x1e')]?_0x5a987a[_0xbbdd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5a987a[_0xbbdd('0x1e')]?_0x5a987a['options']['where']||null:null,'attributes':_0x5a987a[_0xbbdd('0x1e')]?_0x5a987a[_0xbbdd('0x1e')][_0xbbdd('0x20')]||null:null,'include':_0x5a987a['options']?_0x5a987a[_0xbbdd('0x1e')][_0xbbdd('0x22')]?_[_0xbbdd('0x27')](_0x5a987a[_0xbbdd('0x1e')][_0xbbdd('0x22')],function(_0x3ebc75){return{'model':db[_0x3ebc75['model']],'as':_0x3ebc75['as'],'attributes':_0x3ebc75[_0xbbdd('0x20')],'include':_0x3ebc75['include']?_[_0xbbdd('0x27')](_0x3ebc75[_0xbbdd('0x22')],function(_0x301a0b){return{'model':db[_0x301a0b[_0xbbdd('0x23')]],'as':_0x301a0b['as'],'attributes':_0x301a0b['attributes'],'include':_0x301a0b['include']?_['map'](_0x301a0b[_0xbbdd('0x22')],function(_0x1ab906){return{'model':db[_0x1ab906[_0xbbdd('0x23')]],'as':_0x1ab906['as'],'attributes':_0x1ab906[_0xbbdd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbbdd('0x11')](function(_0x3f4e4f){logger[_0xbbdd('0x12')](_0xbbdd('0x25'),_0x5a987a);logger[_0xbbdd('0x14')](_0xbbdd('0x25'),_0x5a987a,JSON['stringify'](_0x3f4e4f));_0x2403ac(_0x3f4e4f);})[_0xbbdd('0x24')](function(_0x4cc59b){logger[_0xbbdd('0x18')](_0xbbdd('0x25'),_0x4cc59b[_0xbbdd('0x1a')],_0x5a987a);_0x500a75(_0x3a2a56[_0xbbdd('0x18')](0x1f4,_0x4cc59b['message']));});});}; \ No newline at end of file +var _0x2574=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','util','moment','bluebird'];(function(_0x307dba,_0x4ad76e){var _0x4971d4=function(_0x34ccc4){while(--_0x34ccc4){_0x307dba['push'](_0x307dba['shift']());}};_0x4971d4(++_0x4ad76e);}(_0x2574,0x13d));var _0x4257=function(_0x25bc56,_0x3323c8){_0x25bc56=_0x25bc56-0x0;var _0x3ec365=_0x2574[_0x25bc56];return _0x3ec365;};'use strict';var _=require('lodash');var util=require(_0x4257('0x0'));var moment=require(_0x4257('0x1'));var BPromise=require(_0x4257('0x2'));var rs=require(_0x4257('0x3'));var fs=require('fs');var Redis=require(_0x4257('0x4'));var db=require(_0x4257('0x5'))['db'];var utils=require(_0x4257('0x6'));var logger=require(_0x4257('0x7'))('rpc');var config=require(_0x4257('0x8'));var jayson=require(_0x4257('0x9'));var client=jayson['client'][_0x4257('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4257('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4257('0xc'))(new Redis(config[_0x4257('0xb')]));require(_0x4257('0xd'))[_0x4257('0xe')](socket);function respondWithRpcPromise(_0x132f62,_0x10cb13,_0x442d3c){return new BPromise(function(_0x5b5246,_0x262d44){return client['request'](_0x132f62,_0x442d3c)[_0x4257('0xf')](function(_0x50274f){logger[_0x4257('0x10')](_0x4257('0x11'),_0x10cb13,_0x4257('0x12'));logger[_0x4257('0x13')](_0x4257('0x14'),_0x10cb13,_0x4257('0x12'),JSON[_0x4257('0x15')](_0x50274f));if(_0x50274f['error']){if(_0x50274f['error'][_0x4257('0x16')]===0x1f4){logger[_0x4257('0x17')](_0x4257('0x11'),_0x10cb13,_0x50274f['error'][_0x4257('0x18')]);return _0x262d44(_0x50274f[_0x4257('0x17')][_0x4257('0x18')]);}logger[_0x4257('0x17')](_0x4257('0x11'),_0x10cb13,_0x50274f[_0x4257('0x17')][_0x4257('0x18')]);return _0x5b5246(_0x50274f[_0x4257('0x17')][_0x4257('0x18')]);}else{logger[_0x4257('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x10cb13,'request\x20sent');_0x5b5246(_0x50274f[_0x4257('0x19')]['message']);}})[_0x4257('0x1a')](function(_0x248d03){logger['error'](_0x4257('0x11'),_0x10cb13,_0x248d03);_0x262d44(_0x248d03);});});}exports[_0x4257('0x1b')]=function(_0x3f02b6){var _0x4f05fa=this;return new Promise(function(_0x1b18a9,_0x1c28d0){return db[_0x4257('0x1c')][_0x4257('0x1d')]({'raw':_0x3f02b6[_0x4257('0x1e')]?_0x3f02b6[_0x4257('0x1e')][_0x4257('0x1f')]===undefined?!![]:![]:!![],'where':_0x3f02b6[_0x4257('0x1e')]?_0x3f02b6[_0x4257('0x1e')][_0x4257('0x20')]||null:null,'attributes':_0x3f02b6[_0x4257('0x1e')]?_0x3f02b6[_0x4257('0x1e')][_0x4257('0x21')]||null:null,'limit':_0x3f02b6[_0x4257('0x1e')]?_0x3f02b6[_0x4257('0x1e')][_0x4257('0x22')]||null:null,'include':_0x3f02b6[_0x4257('0x1e')]?_0x3f02b6[_0x4257('0x1e')][_0x4257('0x23')]?_[_0x4257('0x24')](_0x3f02b6[_0x4257('0x1e')][_0x4257('0x23')],function(_0x598c15){return{'model':db[_0x598c15['model']],'as':_0x598c15['as'],'attributes':_0x598c15[_0x4257('0x21')],'include':_0x598c15[_0x4257('0x23')]?_[_0x4257('0x24')](_0x598c15[_0x4257('0x23')],function(_0x4c9bb7){return{'model':db[_0x4c9bb7[_0x4257('0x25')]],'as':_0x4c9bb7['as'],'attributes':_0x4c9bb7[_0x4257('0x21')],'include':_0x4c9bb7[_0x4257('0x23')]?_[_0x4257('0x24')](_0x4c9bb7[_0x4257('0x23')],function(_0x115ca8){return{'model':db[_0x115ca8[_0x4257('0x25')]],'as':_0x115ca8['as'],'attributes':_0x115ca8[_0x4257('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4257('0xf')](function(_0x1fab33){logger['info']('GetOpenchannelQueue',_0x3f02b6);logger[_0x4257('0x13')](_0x4257('0x1b'),_0x3f02b6,JSON[_0x4257('0x15')](_0x1fab33));_0x1b18a9(_0x1fab33);})[_0x4257('0x1a')](function(_0x3a1155){logger[_0x4257('0x17')](_0x4257('0x1b'),_0x3a1155[_0x4257('0x18')],_0x3f02b6);_0x1c28d0(_0x4f05fa['error'](0x1f4,_0x3a1155[_0x4257('0x18')]));});});};exports[_0x4257('0x26')]=function(_0x499fab){var _0x2046a0=this;return new Promise(function(_0x31c5c2,_0x1bc117){return db[_0x4257('0x1c')][_0x4257('0x27')]({'raw':_0x499fab[_0x4257('0x1e')]?_0x499fab[_0x4257('0x1e')][_0x4257('0x1f')]===undefined?!![]:![]:!![],'where':_0x499fab[_0x4257('0x1e')]?_0x499fab[_0x4257('0x1e')][_0x4257('0x20')]||null:null,'attributes':_0x499fab[_0x4257('0x1e')]?_0x499fab[_0x4257('0x1e')][_0x4257('0x21')]||null:null,'include':_0x499fab[_0x4257('0x1e')]?_0x499fab[_0x4257('0x1e')][_0x4257('0x23')]?_['map'](_0x499fab[_0x4257('0x1e')][_0x4257('0x23')],function(_0x55b204){return{'model':db[_0x55b204['model']],'as':_0x55b204['as'],'attributes':_0x55b204[_0x4257('0x21')],'include':_0x55b204[_0x4257('0x23')]?_[_0x4257('0x24')](_0x55b204[_0x4257('0x23')],function(_0x545bdf){return{'model':db[_0x545bdf[_0x4257('0x25')]],'as':_0x545bdf['as'],'attributes':_0x545bdf[_0x4257('0x21')],'include':_0x545bdf[_0x4257('0x23')]?_[_0x4257('0x24')](_0x545bdf[_0x4257('0x23')],function(_0x2c5ec4){return{'model':db[_0x2c5ec4[_0x4257('0x25')]],'as':_0x2c5ec4['as'],'attributes':_0x2c5ec4[_0x4257('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4257('0xf')](function(_0x383d62){logger[_0x4257('0x10')](_0x4257('0x26'),_0x499fab);logger[_0x4257('0x13')]('ShowOpenchannelQueue',_0x499fab,JSON['stringify'](_0x383d62));_0x31c5c2(_0x383d62);})[_0x4257('0x1a')](function(_0xa2e926){logger[_0x4257('0x17')](_0x4257('0x26'),_0xa2e926[_0x4257('0x18')],_0x499fab);_0x1bc117(_0x2046a0['error'](0x1f4,_0xa2e926[_0x4257('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b3c6aaf..71ba482 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 _0xecb9=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xecb9,0x90));var _0x9ecb=function(_0x425a95,_0x2743b6){_0x425a95=_0x425a95-0x0;var _0x270c10=_0xecb9[_0x425a95];return _0x270c10;};'use strict';var OpenchannelQueueEvents=require(_0x9ecb('0x0'));var events=[_0x9ecb('0x1'),_0x9ecb('0x2'),_0x9ecb('0x3')];function createListener(_0x3d82b8,_0x40ec2a){return function(_0x4d88bf){_0x40ec2a[_0x9ecb('0x4')](_0x3d82b8,_0x4d88bf);};}function removeListener(_0x2c36f8,_0xe7342d){return function(){OpenchannelQueueEvents[_0x9ecb('0x5')](_0x2c36f8,_0xe7342d);};}exports[_0x9ecb('0x6')]=function(_0x2a7a55){for(var _0x23f787=0x0,_0x7e35fd=events[_0x9ecb('0x7')];_0x23f787<_0x7e35fd;_0x23f787++){var _0x234bf2=events[_0x23f787];var _0x3cf98e=createListener(_0x9ecb('0x8')+_0x234bf2,_0x2a7a55);OpenchannelQueueEvents['on'](_0x234bf2,_0x3cf98e);}}; \ No newline at end of file +var _0xb8be=['remove','update','removeListener','save'];(function(_0x4e12eb,_0x2cc32c){var _0x32dc8f=function(_0x7c78a7){while(--_0x7c78a7){_0x4e12eb['push'](_0x4e12eb['shift']());}};_0x32dc8f(++_0x2cc32c);}(_0xb8be,0x67));var _0xeb8b=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xb8be[_0x586fa2];return _0x515be9;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xeb8b('0x0'),_0xeb8b('0x1'),_0xeb8b('0x2')];function createListener(_0x324ba1,_0x3a7e16){return function(_0x33a9d4){_0x3a7e16['emit'](_0x324ba1,_0x33a9d4);};}function removeListener(_0x44afed,_0x30692f){return function(){OpenchannelQueueEvents[_0xeb8b('0x3')](_0x44afed,_0x30692f);};}exports['register']=function(_0x5365ba){for(var _0xfb0782=0x0,_0x550b8c=events['length'];_0xfb0782<_0x550b8c;_0xfb0782++){var _0x141cbc=events[_0xfb0782];var _0x198ecf=createListener('openchannelQueue:'+_0x141cbc,_0x5365ba);OpenchannelQueueEvents['on'](_0x141cbc,_0x198ecf);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 672fb80..aedc518 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 _0x13a3=['update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x13a3,0xe4));var _0x313a=function(_0x4c3d88,_0xfde040){_0x4c3d88=_0x4c3d88-0x0;var _0x22e8dd=_0x13a3[_0x4c3d88];return _0x22e8dd;};'use strict';var multer=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x313a('0x2'));var router=express['Router']();var fs_extra=require(_0x313a('0x3'));var auth=require(_0x313a('0x4'));var interaction=require(_0x313a('0x5'));var config=require(_0x313a('0x6'));var controller=require(_0x313a('0x7'));router[_0x313a('0x8')]('/',auth[_0x313a('0x9')](),controller[_0x313a('0xa')]);router['get']('/describe',auth[_0x313a('0x9')](),controller['describe']);router[_0x313a('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x313a('0x9')](),controller['create']);router['put'](_0x313a('0xb'),auth['isAuthenticated'](),controller[_0x313a('0xc')]);router[_0x313a('0xd')](_0x313a('0xb'),auth[_0x313a('0x9')](),controller[_0x313a('0xe')]);module[_0x313a('0xf')]=router; \ No newline at end of file +var _0xb4f2=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x23ca93,_0x2812f9){var _0x1c9d7c=function(_0x4f4507){while(--_0x4f4507){_0x23ca93['push'](_0x23ca93['shift']());}};_0x1c9d7c(++_0x2812f9);}(_0xb4f2,0xe1));var _0x2b4f=function(_0x3b5d20,_0x4aa876){_0x3b5d20=_0x3b5d20-0x0;var _0x454d47=_0xb4f2[_0x3b5d20];return _0x454d47;};'use strict';var multer=require('multer');var util=require(_0x2b4f('0x0'));var path=require(_0x2b4f('0x1'));var timeout=require(_0x2b4f('0x2'));var express=require(_0x2b4f('0x3'));var router=express[_0x2b4f('0x4')]();var fs_extra=require(_0x2b4f('0x5'));var auth=require(_0x2b4f('0x6'));var interaction=require(_0x2b4f('0x7'));var config=require('../../config/environment');var controller=require(_0x2b4f('0x8'));router[_0x2b4f('0x9')]('/',auth[_0x2b4f('0xa')](),controller['index']);router[_0x2b4f('0x9')](_0x2b4f('0xb'),auth[_0x2b4f('0xa')](),controller['describe']);router[_0x2b4f('0x9')](_0x2b4f('0xc'),auth[_0x2b4f('0xa')](),controller['show']);router[_0x2b4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x2b4f('0xe')]);router[_0x2b4f('0xf')](_0x2b4f('0xc'),auth[_0x2b4f('0xa')](),controller[_0x2b4f('0x10')]);router[_0x2b4f('0x11')]('/:id',auth[_0x2b4f('0xa')](),controller[_0x2b4f('0x12')]);module[_0x2b4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6534a69..adb237b 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 _0x182d=['STRING','DATE','moment','exports'];(function(_0x30f44c,_0x3cb2a4){var _0x5daf5a=function(_0x422fbd){while(--_0x422fbd){_0x30f44c['push'](_0x30f44c['shift']());}};_0x5daf5a(++_0x3cb2a4);}(_0x182d,0x152));var _0xd182=function(_0x5e2199,_0x1cd3bd){_0x5e2199=_0x5e2199-0x0;var _0x4759e9=_0x182d[_0x5e2199];return _0x4759e9;};'use strict';var moment=require(_0xd182('0x0'));var Sequelize=require('sequelize');module[_0xd182('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd182('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd182('0x3')]},'acceptAt':{'type':Sequelize[_0xd182('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd182('0x2')]}}; \ No newline at end of file +var _0xe2ba=['STRING','DATE','moment','sequelize'];(function(_0x23b972,_0xb49801){var _0x3c9a83=function(_0x2ace20){while(--_0x2ace20){_0x23b972['push'](_0x23b972['shift']());}};_0x3c9a83(++_0xb49801);}(_0xe2ba,0x18a));var _0xae2b=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xe2ba[_0x13b02f];return _0x12e9a6;};'use strict';var moment=require(_0xae2b('0x0'));var Sequelize=require(_0xae2b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xae2b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xae2b('0x2')]},'joinAt':{'type':Sequelize[_0xae2b('0x3')]},'leaveAt':{'type':Sequelize[_0xae2b('0x3')]},'acceptAt':{'type':Sequelize[_0xae2b('0x3')]},'exitAt':{'type':Sequelize[_0xae2b('0x3')]},'reason':{'type':Sequelize[_0xae2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9d260af..5b782d9 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 _0xc555=['VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0x39d44a,_0x220893){var _0x47ce17=function(_0xbd157d){while(--_0xbd157d){_0x39d44a['push'](_0x39d44a['shift']());}};_0x47ce17(++_0x220893);}(_0xc555,0x136));var _0x5c55=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc555[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x5c55('0x0'));var rimraf=require(_0x5c55('0x1'));var zipdir=require(_0x5c55('0x2'));var jsonpatch=require(_0x5c55('0x3'));var rp=require(_0x5c55('0x4'));var moment=require(_0x5c55('0x5'));var BPromise=require(_0x5c55('0x6'));var Mustache=require(_0x5c55('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5c55('0x8'));var csv=require(_0x5c55('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c55('0xa'));var squel=require(_0x5c55('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c55('0xc'));var deskjs=require(_0x5c55('0xd'));var toCsv=require(_0x5c55('0x9'));var querystring=require('querystring');var Papa=require(_0x5c55('0xe'));var Redis=require(_0x5c55('0xf'));var authService=require(_0x5c55('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5c55('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c55('0x12'))(_0x5c55('0x13'));var utils=require('../../config/utils');var config=require(_0x5c55('0x14'));var licenseUtil=require(_0x5c55('0x15'));var db=require(_0x5c55('0x16'))['db'];function respondWithStatusCode(_0x2be9fe,_0x2c7141){_0x2c7141=_0x2c7141||0xcc;return function(_0x542d9a){if(_0x542d9a){return _0x2be9fe[_0x5c55('0x17')](_0x2c7141);}return _0x2be9fe['status'](_0x2c7141)[_0x5c55('0x18')]();};}function respondWithResult(_0x24b5d7,_0x57c890){_0x57c890=_0x57c890||0xc8;return function(_0x408a28){if(_0x408a28){return _0x24b5d7[_0x5c55('0x19')](_0x57c890)[_0x5c55('0x1a')](_0x408a28);}};}function respondWithFilteredResult(_0x165789,_0x98eab4){return function(_0x554ab0){if(_0x554ab0){var _0x4858=typeof _0x98eab4[_0x5c55('0x1b')]===_0x5c55('0x1c')&&typeof _0x98eab4[_0x5c55('0x1d')]===_0x5c55('0x1c');var _0x5f32d3=_0x554ab0[_0x5c55('0x1e')];var _0x59bb5b=_0x4858?0x0:_0x98eab4[_0x5c55('0x1b')];var _0x5efb87=_0x4858?_0x554ab0[_0x5c55('0x1e')]:_0x98eab4[_0x5c55('0x1b')]+_0x98eab4[_0x5c55('0x1d')];var _0x115b95;if(_0x5efb87>=_0x5f32d3){_0x5efb87=_0x5f32d3;_0x115b95=0xc8;}else{_0x115b95=0xce;}_0x165789[_0x5c55('0x19')](_0x115b95);return _0x165789[_0x5c55('0x1f')](_0x5c55('0x20'),_0x59bb5b+'-'+_0x5efb87+'/'+_0x5f32d3)[_0x5c55('0x1a')](_0x554ab0);}return null;};}function patchUpdates(_0x250894){return function(_0x5ebba5){try{jsonpatch[_0x5c55('0x21')](_0x5ebba5,_0x250894,!![]);}catch(_0x1f0844){return BPromise['reject'](_0x1f0844);}return _0x5ebba5[_0x5c55('0x22')]();};}function saveUpdates(_0x4e45c5,_0x115db5){return function(_0x223a0e){if(_0x223a0e){return _0x223a0e['update'](_0x4e45c5)['then'](function(_0x48b1b1){return _0x48b1b1;});}return null;};}function removeEntity(_0x298fe3,_0x4187c9){return function(_0x13bf35){if(_0x13bf35){return _0x13bf35[_0x5c55('0x23')]()[_0x5c55('0x24')](function(){_0x298fe3[_0x5c55('0x19')](0xcc)[_0x5c55('0x18')]();});}};}function handleEntityNotFound(_0x2a0a8a,_0x5ca5f9){return function(_0x2080dd){if(!_0x2080dd){_0x2a0a8a['sendStatus'](0x194);}return _0x2080dd;};}function handleError(_0x5c9454,_0x206b74){_0x206b74=_0x206b74||0x1f4;return function(_0x334764){logger[_0x5c55('0x25')](_0x334764[_0x5c55('0x26')]);if(_0x334764[_0x5c55('0x27')]){delete _0x334764['name'];}_0x5c9454[_0x5c55('0x19')](_0x206b74)[_0x5c55('0x28')](_0x334764);};}exports['index']=function(_0x5cad4a,_0x555b1b){var _0x579215={},_0x50fd2d={},_0x3d2db5={'count':0x0,'rows':[]};var _0x3c7a70=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x48f4c7){return{'name':_0x48f4c7[_0x5c55('0x29')],'type':_0x48f4c7[_0x5c55('0x2a')][_0x5c55('0x2b')]};});_0x50fd2d['model']=_[_0x5c55('0x2c')](_0x3c7a70,_0x5c55('0x27'));_0x50fd2d[_0x5c55('0x2d')]=_[_0x5c55('0x2e')](_0x5cad4a['query']);_0x50fd2d[_0x5c55('0x2f')]=_[_0x5c55('0x30')](_0x50fd2d['model'],_0x50fd2d[_0x5c55('0x2d')]);_0x579215['attributes']=_[_0x5c55('0x30')](_0x50fd2d[_0x5c55('0x31')],qs[_0x5c55('0x32')](_0x5cad4a[_0x5c55('0x2d')][_0x5c55('0x32')]));_0x579215[_0x5c55('0x33')]=_0x579215['attributes'][_0x5c55('0x34')]?_0x579215[_0x5c55('0x33')]:_0x50fd2d[_0x5c55('0x31')];if(!_0x5cad4a[_0x5c55('0x2d')][_0x5c55('0x35')](_0x5c55('0x36'))){_0x579215[_0x5c55('0x1d')]=qs[_0x5c55('0x1d')](_0x5cad4a['query'][_0x5c55('0x1d')]);_0x579215['offset']=qs[_0x5c55('0x1b')](_0x5cad4a[_0x5c55('0x2d')]['offset']);}_0x579215['order']=qs[_0x5c55('0x37')](_0x5cad4a[_0x5c55('0x2d')][_0x5c55('0x37')]);_0x579215['where']=qs[_0x5c55('0x2f')](_[_0x5c55('0x38')](_0x5cad4a[_0x5c55('0x2d')],_0x50fd2d[_0x5c55('0x2f')]),_0x3c7a70);if(_0x5cad4a[_0x5c55('0x2d')][_0x5c55('0x39')]){_0x579215[_0x5c55('0x3a')]=_[_0x5c55('0x3b')](_0x579215[_0x5c55('0x3a')],{'$or':_[_0x5c55('0x2c')](_0x3c7a70,function(_0x34b76c){if(_0x34b76c['type']!==_0x5c55('0x3c')){var _0x2b0fd6={};_0x2b0fd6[_0x34b76c[_0x5c55('0x27')]]={'$like':'%'+_0x5cad4a[_0x5c55('0x2d')][_0x5c55('0x39')]+'%'};return _0x2b0fd6;}})});}_0x579215=_[_0x5c55('0x3b')]({},_0x579215,_0x5cad4a['options']);var _0x3892c4={'where':_0x579215['where']};return db[_0x5c55('0x3d')]['count'](_0x3892c4)[_0x5c55('0x24')](function(_0x285514){_0x3d2db5[_0x5c55('0x1e')]=_0x285514;if(_0x5cad4a['query'][_0x5c55('0x3e')]){_0x579215[_0x5c55('0x3f')]=[{'all':!![]}];}return db[_0x5c55('0x3d')][_0x5c55('0x40')](_0x579215);})[_0x5c55('0x24')](function(_0x1b15c5){_0x3d2db5[_0x5c55('0x41')]=_0x1b15c5;return _0x3d2db5;})['then'](respondWithFilteredResult(_0x555b1b,_0x579215))['catch'](handleError(_0x555b1b,null));};exports['show']=function(_0x5ab457,_0x1d94fd){var _0x4e0075={'raw':!![],'where':{'id':_0x5ab457[_0x5c55('0x42')]['id']}},_0xe09b54={};_0xe09b54['model']=_[_0x5c55('0x2e')](db[_0x5c55('0x3d')][_0x5c55('0x43')]);_0xe09b54[_0x5c55('0x2d')]=_[_0x5c55('0x2e')](_0x5ab457['query']);_0xe09b54[_0x5c55('0x2f')]=_['intersection'](_0xe09b54[_0x5c55('0x31')],_0xe09b54[_0x5c55('0x2d')]);_0x4e0075['attributes']=_[_0x5c55('0x30')](_0xe09b54[_0x5c55('0x31')],qs[_0x5c55('0x32')](_0x5ab457[_0x5c55('0x2d')]['fields']));_0x4e0075[_0x5c55('0x33')]=_0x4e0075[_0x5c55('0x33')]['length']?_0x4e0075[_0x5c55('0x33')]:_0xe09b54['model'];if(_0x5ab457[_0x5c55('0x2d')][_0x5c55('0x3e')]){_0x4e0075[_0x5c55('0x3f')]=[{'all':!![]}];}_0x4e0075=_[_0x5c55('0x3b')]({},_0x4e0075,_0x5ab457['options']);return db[_0x5c55('0x3d')][_0x5c55('0x44')](_0x4e0075)[_0x5c55('0x24')](handleEntityNotFound(_0x1d94fd,null))['then'](respondWithResult(_0x1d94fd,null))[_0x5c55('0x45')](handleError(_0x1d94fd,null));};exports['create']=function(_0x3cd0be,_0xb0ece4){return db[_0x5c55('0x3d')][_0x5c55('0x46')](_0x3cd0be[_0x5c55('0x47')],{})[_0x5c55('0x24')](respondWithResult(_0xb0ece4,0xc9))['catch'](handleError(_0xb0ece4,null));};exports[_0x5c55('0x48')]=function(_0x54c28d,_0x5da1c6){if(_0x54c28d[_0x5c55('0x47')]['id']){delete _0x54c28d[_0x5c55('0x47')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x54c28d['params']['id']}})[_0x5c55('0x24')](handleEntityNotFound(_0x5da1c6,null))[_0x5c55('0x24')](saveUpdates(_0x54c28d['body'],null))[_0x5c55('0x24')](respondWithResult(_0x5da1c6,null))[_0x5c55('0x45')](handleError(_0x5da1c6,null));};exports['destroy']=function(_0x40723e,_0x5741b3){return db[_0x5c55('0x3d')][_0x5c55('0x44')]({'where':{'id':_0x40723e[_0x5c55('0x42')]['id']}})[_0x5c55('0x24')](handleEntityNotFound(_0x5741b3,null))[_0x5c55('0x24')](removeEntity(_0x5741b3,null))[_0x5c55('0x45')](handleError(_0x5741b3,null));};exports[_0x5c55('0x49')]=function(_0x493de3,_0x738c3b){return db[_0x5c55('0x3d')][_0x5c55('0x49')]()[_0x5c55('0x24')](respondWithResult(_0x738c3b,null))['catch'](handleError(_0x738c3b,null));}; \ No newline at end of file +var _0x9def=['limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','OpenchannelQueueReport','rawAttributes','fieldName','type','map','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x299afc,_0x2e1c23){var _0xf53025=function(_0x547b7b){while(--_0x547b7b){_0x299afc['push'](_0x299afc['shift']());}};_0xf53025(++_0x2e1c23);}(_0x9def,0xb8));var _0xf9de=function(_0x4039d8,_0x2764d1){_0x4039d8=_0x4039d8-0x0;var _0x102210=_0x9def[_0x4039d8];return _0x102210;};'use strict';var emlformat=require(_0xf9de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9de('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9de('0x2'));var moment=require(_0xf9de('0x3'));var BPromise=require(_0xf9de('0x4'));var Mustache=require(_0xf9de('0x5'));var util=require(_0xf9de('0x6'));var path=require(_0xf9de('0x7'));var sox=require('sox');var csv=require(_0xf9de('0x8'));var ejs=require(_0xf9de('0x9'));var fs=require('fs');var fs_extra=require(_0xf9de('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9de('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf9de('0xc'));var authService=require(_0xf9de('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9de('0xe'));var logger=require(_0xf9de('0xf'))(_0xf9de('0x10'));var utils=require(_0xf9de('0x11'));var config=require(_0xf9de('0x12'));var licenseUtil=require(_0xf9de('0x13'));var db=require(_0xf9de('0x14'))['db'];function respondWithStatusCode(_0x44e9eb,_0x5f34ea){_0x5f34ea=_0x5f34ea||0xcc;return function(_0x369d6c){if(_0x369d6c){return _0x44e9eb[_0xf9de('0x15')](_0x5f34ea);}return _0x44e9eb['status'](_0x5f34ea)['end']();};}function respondWithResult(_0x3f2f4f,_0x276a9e){_0x276a9e=_0x276a9e||0xc8;return function(_0x20cd0c){if(_0x20cd0c){return _0x3f2f4f[_0xf9de('0x16')](_0x276a9e)[_0xf9de('0x17')](_0x20cd0c);}};}function respondWithFilteredResult(_0x262839,_0x54660f){return function(_0x52fb62){if(_0x52fb62){var _0x10cd84=typeof _0x54660f[_0xf9de('0x18')]===_0xf9de('0x19')&&typeof _0x54660f[_0xf9de('0x1a')]==='undefined';var _0x3e4ec9=_0x52fb62[_0xf9de('0x1b')];var _0x248845=_0x10cd84?0x0:_0x54660f[_0xf9de('0x18')];var _0x4c97f9=_0x10cd84?_0x52fb62[_0xf9de('0x1b')]:_0x54660f[_0xf9de('0x18')]+_0x54660f[_0xf9de('0x1a')];var _0x4f9d89;if(_0x4c97f9>=_0x3e4ec9){_0x4c97f9=_0x3e4ec9;_0x4f9d89=0xc8;}else{_0x4f9d89=0xce;}_0x262839[_0xf9de('0x16')](_0x4f9d89);return _0x262839[_0xf9de('0x1c')]('Content-Range',_0x248845+'-'+_0x4c97f9+'/'+_0x3e4ec9)[_0xf9de('0x17')](_0x52fb62);}return null;};}function patchUpdates(_0x2dca5a){return function(_0x370ef4){try{jsonpatch[_0xf9de('0x1d')](_0x370ef4,_0x2dca5a,!![]);}catch(_0x11e349){return BPromise[_0xf9de('0x1e')](_0x11e349);}return _0x370ef4[_0xf9de('0x1f')]();};}function saveUpdates(_0x117860,_0x55c8b3){return function(_0x487778){if(_0x487778){return _0x487778['update'](_0x117860)[_0xf9de('0x20')](function(_0x1204c0){return _0x1204c0;});}return null;};}function removeEntity(_0xcfbedf,_0x52422f){return function(_0x55a505){if(_0x55a505){return _0x55a505[_0xf9de('0x21')]()[_0xf9de('0x20')](function(){_0xcfbedf[_0xf9de('0x16')](0xcc)[_0xf9de('0x22')]();});}};}function handleEntityNotFound(_0x393825,_0x27162e){return function(_0x52a7cc){if(!_0x52a7cc){_0x393825['sendStatus'](0x194);}return _0x52a7cc;};}function handleError(_0x38a0f8,_0x637e1d){_0x637e1d=_0x637e1d||0x1f4;return function(_0x415e18){logger[_0xf9de('0x23')](_0x415e18[_0xf9de('0x24')]);if(_0x415e18[_0xf9de('0x25')]){delete _0x415e18['name'];}_0x38a0f8['status'](_0x637e1d)['send'](_0x415e18);};}exports['index']=function(_0x32b88d,_0x28ca1a){var _0xb5bc87={},_0x355bdf={},_0x22cd13={'count':0x0,'rows':[]};var _0x1bc56f=_['map'](db[_0xf9de('0x26')][_0xf9de('0x27')],function(_0x33c816){return{'name':_0x33c816[_0xf9de('0x28')],'type':_0x33c816[_0xf9de('0x29')]['key']};});_0x355bdf['model']=_[_0xf9de('0x2a')](_0x1bc56f,_0xf9de('0x25'));_0x355bdf['query']=_[_0xf9de('0x2b')](_0x32b88d['query']);_0x355bdf['filters']=_['intersection'](_0x355bdf[_0xf9de('0x2c')],_0x355bdf[_0xf9de('0x2d')]);_0xb5bc87[_0xf9de('0x2e')]=_[_0xf9de('0x2f')](_0x355bdf['model'],qs['fields'](_0x32b88d[_0xf9de('0x2d')][_0xf9de('0x30')]));_0xb5bc87['attributes']=_0xb5bc87[_0xf9de('0x2e')][_0xf9de('0x31')]?_0xb5bc87[_0xf9de('0x2e')]:_0x355bdf[_0xf9de('0x2c')];if(!_0x32b88d[_0xf9de('0x2d')][_0xf9de('0x32')]('nolimit')){_0xb5bc87[_0xf9de('0x1a')]=qs[_0xf9de('0x1a')](_0x32b88d['query'][_0xf9de('0x1a')]);_0xb5bc87[_0xf9de('0x18')]=qs[_0xf9de('0x18')](_0x32b88d['query'][_0xf9de('0x18')]);}_0xb5bc87[_0xf9de('0x33')]=qs[_0xf9de('0x34')](_0x32b88d[_0xf9de('0x2d')][_0xf9de('0x34')]);_0xb5bc87[_0xf9de('0x35')]=qs['filters'](_[_0xf9de('0x36')](_0x32b88d[_0xf9de('0x2d')],_0x355bdf[_0xf9de('0x37')]),_0x1bc56f);if(_0x32b88d[_0xf9de('0x2d')][_0xf9de('0x38')]){_0xb5bc87[_0xf9de('0x35')]=_[_0xf9de('0x39')](_0xb5bc87['where'],{'$or':_['map'](_0x1bc56f,function(_0x28a1d1){if(_0x28a1d1['type']!==_0xf9de('0x3a')){var _0x23cb56={};_0x23cb56[_0x28a1d1[_0xf9de('0x25')]]={'$like':'%'+_0x32b88d['query'][_0xf9de('0x38')]+'%'};return _0x23cb56;}})});}_0xb5bc87=_['merge']({},_0xb5bc87,_0x32b88d[_0xf9de('0x3b')]);var _0x3400cd={'where':_0xb5bc87[_0xf9de('0x35')]};return db[_0xf9de('0x26')][_0xf9de('0x1b')](_0x3400cd)[_0xf9de('0x20')](function(_0x5a6dd1){_0x22cd13[_0xf9de('0x1b')]=_0x5a6dd1;if(_0x32b88d['query'][_0xf9de('0x3c')]){_0xb5bc87[_0xf9de('0x3d')]=[{'all':!![]}];}return db[_0xf9de('0x26')][_0xf9de('0x3e')](_0xb5bc87);})['then'](function(_0x4f3bf5){_0x22cd13['rows']=_0x4f3bf5;return _0x22cd13;})[_0xf9de('0x20')](respondWithFilteredResult(_0x28ca1a,_0xb5bc87))[_0xf9de('0x3f')](handleError(_0x28ca1a,null));};exports['show']=function(_0x4437f2,_0x1f0f9a){var _0x2edc60={'raw':!![],'where':{'id':_0x4437f2[_0xf9de('0x40')]['id']}},_0x576a33={};_0x576a33['model']=_[_0xf9de('0x2b')](db[_0xf9de('0x26')]['rawAttributes']);_0x576a33['query']=_[_0xf9de('0x2b')](_0x4437f2[_0xf9de('0x2d')]);_0x576a33[_0xf9de('0x37')]=_[_0xf9de('0x2f')](_0x576a33['model'],_0x576a33['query']);_0x2edc60[_0xf9de('0x2e')]=_['intersection'](_0x576a33[_0xf9de('0x2c')],qs[_0xf9de('0x30')](_0x4437f2[_0xf9de('0x2d')][_0xf9de('0x30')]));_0x2edc60[_0xf9de('0x2e')]=_0x2edc60[_0xf9de('0x2e')][_0xf9de('0x31')]?_0x2edc60[_0xf9de('0x2e')]:_0x576a33['model'];if(_0x4437f2[_0xf9de('0x2d')][_0xf9de('0x3c')]){_0x2edc60[_0xf9de('0x3d')]=[{'all':!![]}];}_0x2edc60=_['merge']({},_0x2edc60,_0x4437f2[_0xf9de('0x3b')]);return db[_0xf9de('0x26')]['find'](_0x2edc60)['then'](handleEntityNotFound(_0x1f0f9a,null))[_0xf9de('0x20')](respondWithResult(_0x1f0f9a,null))['catch'](handleError(_0x1f0f9a,null));};exports['create']=function(_0x221be9,_0x44cd3d){return db['OpenchannelQueueReport'][_0xf9de('0x41')](_0x221be9[_0xf9de('0x42')],{})[_0xf9de('0x20')](respondWithResult(_0x44cd3d,0xc9))[_0xf9de('0x3f')](handleError(_0x44cd3d,null));};exports[_0xf9de('0x43')]=function(_0x4d56c5,_0x1a84aa){if(_0x4d56c5[_0xf9de('0x42')]['id']){delete _0x4d56c5[_0xf9de('0x42')]['id'];}return db[_0xf9de('0x26')]['find']({'where':{'id':_0x4d56c5[_0xf9de('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a84aa,null))[_0xf9de('0x20')](saveUpdates(_0x4d56c5[_0xf9de('0x42')],null))[_0xf9de('0x20')](respondWithResult(_0x1a84aa,null))[_0xf9de('0x3f')](handleError(_0x1a84aa,null));};exports[_0xf9de('0x21')]=function(_0x88e529,_0x4125b7){return db[_0xf9de('0x26')][_0xf9de('0x44')]({'where':{'id':_0x88e529['params']['id']}})[_0xf9de('0x20')](handleEntityNotFound(_0x4125b7,null))[_0xf9de('0x20')](removeEntity(_0x4125b7,null))[_0xf9de('0x3f')](handleError(_0x4125b7,null));};exports[_0xf9de('0x45')]=function(_0x47f5b5,_0x2f7736){return db[_0xf9de('0x26')]['describe']()[_0xf9de('0x20')](respondWithResult(_0x2f7736,null))['catch'](handleError(_0x2f7736,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 543ce5d..f23e4cc 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(_0xa2f38c,_0x4d1d31){var _0x3fd0ed=function(_0x44de0f){while(--_0x44de0f){_0xa2f38c['push'](_0xa2f38c['shift']());}};_0x3fd0ed(++_0x4d1d31);}(_0x2ef3,0xba));var _0x32ef=function(_0xf91693,_0x226541){_0xf91693=_0xf91693-0x0;var _0x2b12dc=_0x2ef3[_0xf91693];return _0x2b12dc;};'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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x814b,0x1a2));var _0xb814=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0x814b[_0x4d3d50];return _0x175e6d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 78f8aab..c97d0b7 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 _0xd26f=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','update','body','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x3a1bed,_0x16d557){var _0x31aa4c=function(_0x5db5d7){while(--_0x5db5d7){_0x3a1bed['push'](_0x3a1bed['shift']());}};_0x31aa4c(++_0x16d557);}(_0xd26f,0x113));var _0xfd26=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd26f[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['create'](_0xeb7aeb['body'],{'raw':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x18')][_0xfd26('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x523cbe){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger['debug'](_0xfd26('0x16'),_0xeb7aeb,JSON['stringify'](_0x523cbe));_0x36a275(_0x523cbe);})[_0xfd26('0x15')](function(_0x531bf7){logger[_0xfd26('0x12')]('CreateOpenchannelQueueReport',_0x531bf7[_0xfd26('0x13')],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x531bf7['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1194c2){var _0x4bc02c=this;return new Promise(function(_0x1d62c5,_0xebbab7){return db[_0xfd26('0x17')][_0xfd26('0x1a')](_0x1194c2[_0xfd26('0x1b')],{'raw':_0x1194c2['options']?_0x1194c2[_0xfd26('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')]['where']||null:null,'attributes':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1c')]||null:null,'limit':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1d')]||null:null})[_0xfd26('0x1e')](function(_0x565c0){logger[_0xfd26('0xc')]('UpdateOpenchannelQueueReport',_0x1194c2);logger['debug']('UpdateOpenchannelQueueReport',_0x1194c2,JSON['stringify'](_0x565c0));_0x1d62c5(_0x565c0);})[_0xfd26('0x15')](function(_0x5d0101){logger[_0xfd26('0x12')](_0xfd26('0x1f'),_0x5d0101['message'],_0x1194c2);_0xebbab7(_0x4bc02c['error'](0x1f4,_0x5d0101[_0xfd26('0x13')]));});});}; \ No newline at end of file +var _0x8374=['limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x8374,0x174));var _0x4837=function(_0x3622c4,_0x3dd909){_0x3622c4=_0x3622c4-0x0;var _0x1dddb3=_0x8374[_0x3622c4];return _0x1dddb3;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});}exports[_0x4837('0x19')]=function(_0x48b61b){var _0xf21681=this;return new Promise(function(_0x1cb24a,_0x427171){return db[_0x4837('0x1a')][_0x4837('0x1b')](_0x48b61b[_0x4837('0x1c')],{'raw':_0x48b61b[_0x4837('0x1d')]?_0x48b61b['options']['raw']===undefined?!![]:![]:!![]})[_0x4837('0xf')](function(_0x133e9d){logger[_0x4837('0x10')](_0x4837('0x19'),_0x48b61b);logger['debug'](_0x4837('0x19'),_0x48b61b,JSON['stringify'](_0x133e9d));_0x1cb24a(_0x133e9d);})[_0x4837('0x18')](function(_0x5f5631){logger['error'](_0x4837('0x19'),_0x5f5631['message'],_0x48b61b);_0x427171(_0xf21681['error'](0x1f4,_0x5f5631['message']));});});};exports[_0x4837('0x1e')]=function(_0x2d820a){var _0x4bbfbd=this;return new Promise(function(_0x36b841,_0xa10b75){return db['OpenchannelQueueReport'][_0x4837('0x1f')](_0x2d820a[_0x4837('0x1c')],{'raw':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x21')]||null:null,'attributes':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x22')]||null:null,'limit':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x23')]||null:null})[_0x4837('0xf')](function(_0x215858){logger[_0x4837('0x10')]('UpdateOpenchannelQueueReport',_0x2d820a);logger[_0x4837('0x13')](_0x4837('0x1e'),_0x2d820a,JSON[_0x4837('0x24')](_0x215858));_0x36b841(_0x215858);})[_0x4837('0x18')](function(_0x594039){logger[_0x4837('0x15')](_0x4837('0x1e'),_0x594039[_0x4837('0x17')],_0x2d820a);_0xa10b75(_0x4bbfbd[_0x4837('0x15')](0x1f4,_0x594039['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6207c3e..1ae65b5 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 _0x8641=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5d3550,_0x107033){var _0x5d1299=function(_0x5edaa1){while(--_0x5edaa1){_0x5d3550['push'](_0x5d3550['shift']());}};_0x5d1299(++_0x107033);}(_0x8641,0x77));var _0x1864=function(_0x171fa7,_0x587eca){_0x171fa7=_0x171fa7-0x0;var _0xc894e1=_0x8641[_0x171fa7];return _0xc894e1;};'use strict';var multer=require(_0x1864('0x0'));var util=require(_0x1864('0x1'));var path=require(_0x1864('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1864('0x3')]();var fs_extra=require(_0x1864('0x4'));var auth=require(_0x1864('0x5'));var interaction=require(_0x1864('0x6'));var config=require(_0x1864('0x7'));var controller=require(_0x1864('0x8'));router[_0x1864('0x9')]('/',auth[_0x1864('0xa')](),controller[_0x1864('0xb')]);router[_0x1864('0x9')](_0x1864('0xc'),auth[_0x1864('0xa')](),controller[_0x1864('0xd')]);router['get'](_0x1864('0xe'),auth['isAuthenticated'](),controller[_0x1864('0xf')]);router['post']('/',auth[_0x1864('0xa')](),controller[_0x1864('0x10')]);router[_0x1864('0x11')](_0x1864('0xe'),auth[_0x1864('0xa')](),controller[_0x1864('0x12')]);router[_0x1864('0x13')](_0x1864('0xe'),auth[_0x1864('0xa')](),controller[_0x1864('0x14')]);module[_0x1864('0x15')]=router; \ No newline at end of file +var _0xf3b7=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x509568,_0x22c93d){var _0x18aa32=function(_0x2aa528){while(--_0x2aa528){_0x509568['push'](_0x509568['shift']());}};_0x18aa32(++_0x22c93d);}(_0xf3b7,0x71));var _0x7f3b=function(_0x1222db,_0x3f0f55){_0x1222db=_0x1222db-0x0;var _0x5bd9b4=_0xf3b7[_0x1222db];return _0x5bd9b4;};'use strict';var multer=require(_0x7f3b('0x0'));var util=require(_0x7f3b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f3b('0x2'));var router=express[_0x7f3b('0x3')]();var fs_extra=require(_0x7f3b('0x4'));var auth=require(_0x7f3b('0x5'));var interaction=require(_0x7f3b('0x6'));var config=require('../../config/environment');var controller=require(_0x7f3b('0x7'));router[_0x7f3b('0x8')]('/',auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xa')]);router['get'](_0x7f3b('0xb'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xc')]);router[_0x7f3b('0x8')](_0x7f3b('0xd'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xe')]);router[_0x7f3b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7f3b('0xd'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0x10')]);router[_0x7f3b('0x11')]('/:id',auth[_0x7f3b('0x9')](),controller[_0x7f3b('0x12')]);module[_0x7f3b('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 89cab8e..701e854 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2f5381,_0x53faa7){var _0x5998cc=function(_0x101a99){while(--_0x101a99){_0x2f5381['push'](_0x2f5381['shift']());}};_0x5998cc(++_0x53faa7);}(_0xaa88,0x137));var _0x8aa8=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0xaa88[_0x3616bb];return _0x1c0994;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x39a89a,_0x5431f1){var _0x1f291f=function(_0x58e09b){while(--_0x58e09b){_0x39a89a['push'](_0x39a89a['shift']());}};_0x1f291f(++_0x5431f1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x850e2d,_0x18214d){_0x850e2d=_0x850e2d-0x0;var _0x468f3f=_0xf4eb[_0x850e2d];return _0x468f3f;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 92afd90..f52c7a8 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 _0x0ff0=['index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','name','send'];(function(_0x3d7807,_0x407bc9){var _0x5baefa=function(_0x3f0751){while(--_0x3f0751){_0x3d7807['push'](_0x3d7807['shift']());}};_0x5baefa(++_0x407bc9);}(_0x0ff0,0x1e9));var _0x00ff=function(_0x2e3888,_0xb8d5c4){_0x2e3888=_0x2e3888-0x0;var _0x3ec5ea=_0x0ff0[_0x2e3888];return _0x3ec5ea;};'use strict';var emlformat=require(_0x00ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00ff('0x1'));var jsonpatch=require(_0x00ff('0x2'));var rp=require('request-promise');var moment=require(_0x00ff('0x3'));var BPromise=require(_0x00ff('0x4'));var Mustache=require(_0x00ff('0x5'));var util=require(_0x00ff('0x6'));var path=require(_0x00ff('0x7'));var sox=require(_0x00ff('0x8'));var csv=require(_0x00ff('0x9'));var ejs=require(_0x00ff('0xa'));var fs=require('fs');var fs_extra=require(_0x00ff('0xb'));var _=require(_0x00ff('0xc'));var squel=require('squel');var crypto=require(_0x00ff('0xd'));var jsforce=require(_0x00ff('0xe'));var deskjs=require(_0x00ff('0xf'));var toCsv=require(_0x00ff('0x9'));var querystring=require(_0x00ff('0x10'));var Papa=require(_0x00ff('0x11'));var Redis=require('ioredis');var authService=require(_0x00ff('0x12'));var qs=require(_0x00ff('0x13'));var as=require(_0x00ff('0x14'));var hardwareService=require(_0x00ff('0x15'));var logger=require(_0x00ff('0x16'))(_0x00ff('0x17'));var utils=require(_0x00ff('0x18'));var config=require(_0x00ff('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53bcf9,_0x5caa22){_0x5caa22=_0x5caa22||0xcc;return function(_0x2cb0c2){if(_0x2cb0c2){return _0x53bcf9['sendStatus'](_0x5caa22);}return _0x53bcf9[_0x00ff('0x1a')](_0x5caa22)[_0x00ff('0x1b')]();};}function respondWithResult(_0x473e62,_0x23fd34){_0x23fd34=_0x23fd34||0xc8;return function(_0x159ee4){if(_0x159ee4){return _0x473e62['status'](_0x23fd34)[_0x00ff('0x1c')](_0x159ee4);}};}function respondWithFilteredResult(_0x14dab4,_0x539e27){return function(_0x460d35){if(_0x460d35){var _0x45abd9=typeof _0x539e27['offset']==='undefined'&&typeof _0x539e27[_0x00ff('0x1d')]===_0x00ff('0x1e');var _0x54fed7=_0x460d35[_0x00ff('0x1f')];var _0x116bc5=_0x45abd9?0x0:_0x539e27[_0x00ff('0x20')];var _0x5b5695=_0x45abd9?_0x460d35[_0x00ff('0x1f')]:_0x539e27[_0x00ff('0x20')]+_0x539e27[_0x00ff('0x1d')];var _0x2eb1f0;if(_0x5b5695>=_0x54fed7){_0x5b5695=_0x54fed7;_0x2eb1f0=0xc8;}else{_0x2eb1f0=0xce;}_0x14dab4[_0x00ff('0x1a')](_0x2eb1f0);return _0x14dab4[_0x00ff('0x21')](_0x00ff('0x22'),_0x116bc5+'-'+_0x5b5695+'/'+_0x54fed7)['json'](_0x460d35);}return null;};}function patchUpdates(_0x1bcf30){return function(_0x229984){try{jsonpatch['apply'](_0x229984,_0x1bcf30,!![]);}catch(_0x14993c){return BPromise[_0x00ff('0x23')](_0x14993c);}return _0x229984[_0x00ff('0x24')]();};}function saveUpdates(_0x26d021,_0x28ad23){return function(_0x307a7e){if(_0x307a7e){return _0x307a7e[_0x00ff('0x25')](_0x26d021)[_0x00ff('0x26')](function(_0x45ace3){return _0x45ace3;});}return null;};}function removeEntity(_0x3a473e,_0x167469){return function(_0x179198){if(_0x179198){return _0x179198['destroy']()['then'](function(){_0x3a473e[_0x00ff('0x1a')](0xcc)[_0x00ff('0x1b')]();});}};}function handleEntityNotFound(_0x223a8c,_0x5de047){return function(_0x4816c9){if(!_0x4816c9){_0x223a8c[_0x00ff('0x27')](0x194);}return _0x4816c9;};}function handleError(_0x1e91b7,_0x2d8726){_0x2d8726=_0x2d8726||0x1f4;return function(_0x4a4bca){logger[_0x00ff('0x28')](_0x4a4bca['stack']);if(_0x4a4bca[_0x00ff('0x29')]){delete _0x4a4bca[_0x00ff('0x29')];}_0x1e91b7[_0x00ff('0x1a')](_0x2d8726)[_0x00ff('0x2a')](_0x4a4bca);};}exports[_0x00ff('0x2b')]=function(_0x58f60f,_0x44dc57){var _0xe810b1={},_0x51c5fe={},_0x413c61={'count':0x0,'rows':[]};var _0x2e5466=_[_0x00ff('0x2c')](db[_0x00ff('0x2d')][_0x00ff('0x2e')],function(_0x2ca122){return{'name':_0x2ca122[_0x00ff('0x2f')],'type':_0x2ca122[_0x00ff('0x30')][_0x00ff('0x31')]};});_0x51c5fe[_0x00ff('0x32')]=_[_0x00ff('0x2c')](_0x2e5466,'name');_0x51c5fe['query']=_[_0x00ff('0x33')](_0x58f60f['query']);_0x51c5fe[_0x00ff('0x34')]=_[_0x00ff('0x35')](_0x51c5fe[_0x00ff('0x32')],_0x51c5fe['query']);_0xe810b1[_0x00ff('0x36')]=_[_0x00ff('0x35')](_0x51c5fe['model'],qs['fields'](_0x58f60f[_0x00ff('0x37')][_0x00ff('0x38')]));_0xe810b1[_0x00ff('0x36')]=_0xe810b1[_0x00ff('0x36')]['length']?_0xe810b1[_0x00ff('0x36')]:_0x51c5fe[_0x00ff('0x32')];if(!_0x58f60f[_0x00ff('0x37')][_0x00ff('0x39')]('nolimit')){_0xe810b1['limit']=qs[_0x00ff('0x1d')](_0x58f60f[_0x00ff('0x37')]['limit']);_0xe810b1[_0x00ff('0x20')]=qs[_0x00ff('0x20')](_0x58f60f[_0x00ff('0x37')][_0x00ff('0x20')]);}_0xe810b1[_0x00ff('0x3a')]=qs[_0x00ff('0x3b')](_0x58f60f['query'][_0x00ff('0x3b')]);_0xe810b1['where']=qs['filters'](_['pick'](_0x58f60f[_0x00ff('0x37')],_0x51c5fe[_0x00ff('0x34')]),_0x2e5466);if(_0x58f60f[_0x00ff('0x37')][_0x00ff('0x3c')]){_0xe810b1[_0x00ff('0x3d')]=_[_0x00ff('0x3e')](_0xe810b1[_0x00ff('0x3d')],{'$or':_[_0x00ff('0x2c')](_0x2e5466,function(_0x132624){if(_0x132624[_0x00ff('0x30')]!==_0x00ff('0x3f')){var _0x1ae15d={};_0x1ae15d[_0x132624[_0x00ff('0x29')]]={'$like':'%'+_0x58f60f['query'][_0x00ff('0x3c')]+'%'};return _0x1ae15d;}})});}_0xe810b1=_['merge']({},_0xe810b1,_0x58f60f[_0x00ff('0x40')]);var _0x473aac={'where':_0xe810b1['where']};return db['OpenchannelTransferReport'][_0x00ff('0x1f')](_0x473aac)['then'](function(_0x2c4e35){_0x413c61[_0x00ff('0x1f')]=_0x2c4e35;if(_0x58f60f[_0x00ff('0x37')][_0x00ff('0x41')]){_0xe810b1[_0x00ff('0x42')]=[{'all':!![]}];}return db[_0x00ff('0x2d')][_0x00ff('0x43')](_0xe810b1);})[_0x00ff('0x26')](function(_0x38af32){_0x413c61[_0x00ff('0x44')]=_0x38af32;return _0x413c61;})[_0x00ff('0x26')](respondWithFilteredResult(_0x44dc57,_0xe810b1))['catch'](handleError(_0x44dc57,null));};exports[_0x00ff('0x45')]=function(_0x2f5895,_0x4eebbe){var _0x33174b={'raw':!![],'where':{'id':_0x2f5895[_0x00ff('0x46')]['id']}},_0x193a97={};_0x193a97[_0x00ff('0x32')]=_[_0x00ff('0x33')](db[_0x00ff('0x2d')][_0x00ff('0x2e')]);_0x193a97[_0x00ff('0x37')]=_['keys'](_0x2f5895['query']);_0x193a97[_0x00ff('0x34')]=_[_0x00ff('0x35')](_0x193a97[_0x00ff('0x32')],_0x193a97['query']);_0x33174b[_0x00ff('0x36')]=_[_0x00ff('0x35')](_0x193a97[_0x00ff('0x32')],qs[_0x00ff('0x38')](_0x2f5895[_0x00ff('0x37')][_0x00ff('0x38')]));_0x33174b[_0x00ff('0x36')]=_0x33174b['attributes'][_0x00ff('0x47')]?_0x33174b['attributes']:_0x193a97[_0x00ff('0x32')];if(_0x2f5895[_0x00ff('0x37')][_0x00ff('0x41')]){_0x33174b[_0x00ff('0x42')]=[{'all':!![]}];}_0x33174b=_[_0x00ff('0x3e')]({},_0x33174b,_0x2f5895['options']);return db[_0x00ff('0x2d')][_0x00ff('0x48')](_0x33174b)['then'](handleEntityNotFound(_0x4eebbe,null))[_0x00ff('0x26')](respondWithResult(_0x4eebbe,null))['catch'](handleError(_0x4eebbe,null));};exports['create']=function(_0x2369dc,_0x404536){return db[_0x00ff('0x2d')]['create'](_0x2369dc['body'],{})[_0x00ff('0x26')](respondWithResult(_0x404536,0xc9))[_0x00ff('0x49')](handleError(_0x404536,null));};exports[_0x00ff('0x25')]=function(_0x5e8404,_0x30b0f9){if(_0x5e8404[_0x00ff('0x4a')]['id']){delete _0x5e8404[_0x00ff('0x4a')]['id'];}return db[_0x00ff('0x2d')][_0x00ff('0x48')]({'where':{'id':_0x5e8404[_0x00ff('0x46')]['id']}})[_0x00ff('0x26')](handleEntityNotFound(_0x30b0f9,null))[_0x00ff('0x26')](saveUpdates(_0x5e8404[_0x00ff('0x4a')],null))['then'](respondWithResult(_0x30b0f9,null))[_0x00ff('0x49')](handleError(_0x30b0f9,null));};exports[_0x00ff('0x4b')]=function(_0x496b65,_0x378a54){return db['OpenchannelTransferReport'][_0x00ff('0x48')]({'where':{'id':_0x496b65['params']['id']}})[_0x00ff('0x26')](handleEntityNotFound(_0x378a54,null))[_0x00ff('0x26')](removeEntity(_0x378a54,null))[_0x00ff('0x49')](handleError(_0x378a54,null));};exports['describe']=function(_0x37e34c,_0x39a56f){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x39a56f,null))['catch'](handleError(_0x39a56f,null));}; \ No newline at end of file +var _0xfbf7=['stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','catch','show','params','intersection','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','reject','update','then','end','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfbf7,0x19b));var _0x7fbf=function(_0x400074,_0x4b0e07){_0x400074=_0x400074-0x0;var _0x318f3a=_0xfbf7[_0x400074];return _0x318f3a;};'use strict';var emlformat=require(_0x7fbf('0x0'));var rimraf=require(_0x7fbf('0x1'));var zipdir=require(_0x7fbf('0x2'));var jsonpatch=require(_0x7fbf('0x3'));var rp=require(_0x7fbf('0x4'));var moment=require(_0x7fbf('0x5'));var BPromise=require(_0x7fbf('0x6'));var Mustache=require(_0x7fbf('0x7'));var util=require(_0x7fbf('0x8'));var path=require(_0x7fbf('0x9'));var sox=require(_0x7fbf('0xa'));var csv=require(_0x7fbf('0xb'));var ejs=require(_0x7fbf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7fbf('0xd'));var crypto=require(_0x7fbf('0xe'));var jsforce=require(_0x7fbf('0xf'));var deskjs=require(_0x7fbf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fbf('0x11'));var Papa=require(_0x7fbf('0x12'));var Redis=require(_0x7fbf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fbf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fbf('0x15'));var logger=require(_0x7fbf('0x16'))(_0x7fbf('0x17'));var utils=require(_0x7fbf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fbf('0x19'))['db'];function respondWithStatusCode(_0x5dd9d4,_0x52a133){_0x52a133=_0x52a133||0xcc;return function(_0x358a87){if(_0x358a87){return _0x5dd9d4[_0x7fbf('0x1a')](_0x52a133);}return _0x5dd9d4[_0x7fbf('0x1b')](_0x52a133)['end']();};}function respondWithResult(_0x44650c,_0x22cb27){_0x22cb27=_0x22cb27||0xc8;return function(_0x307798){if(_0x307798){return _0x44650c['status'](_0x22cb27)[_0x7fbf('0x1c')](_0x307798);}};}function respondWithFilteredResult(_0x2911db,_0x1d80d9){return function(_0xd65c36){if(_0xd65c36){var _0x4f8d22=typeof _0x1d80d9['offset']==='undefined'&&typeof _0x1d80d9[_0x7fbf('0x1d')]==='undefined';var _0x2f9e9b=_0xd65c36[_0x7fbf('0x1e')];var _0xbcbd1=_0x4f8d22?0x0:_0x1d80d9[_0x7fbf('0x1f')];var _0x257741=_0x4f8d22?_0xd65c36['count']:_0x1d80d9[_0x7fbf('0x1f')]+_0x1d80d9[_0x7fbf('0x1d')];var _0x4ef3cf;if(_0x257741>=_0x2f9e9b){_0x257741=_0x2f9e9b;_0x4ef3cf=0xc8;}else{_0x4ef3cf=0xce;}_0x2911db[_0x7fbf('0x1b')](_0x4ef3cf);return _0x2911db[_0x7fbf('0x20')](_0x7fbf('0x21'),_0xbcbd1+'-'+_0x257741+'/'+_0x2f9e9b)['json'](_0xd65c36);}return null;};}function patchUpdates(_0x695739){return function(_0x296f66){try{jsonpatch['apply'](_0x296f66,_0x695739,!![]);}catch(_0x4ac88d){return BPromise[_0x7fbf('0x22')](_0x4ac88d);}return _0x296f66['save']();};}function saveUpdates(_0xe95a8,_0x146a9d){return function(_0x24b106){if(_0x24b106){return _0x24b106[_0x7fbf('0x23')](_0xe95a8)[_0x7fbf('0x24')](function(_0xe7e12c){return _0xe7e12c;});}return null;};}function removeEntity(_0x1b1897,_0x45facd){return function(_0x306cb2){if(_0x306cb2){return _0x306cb2['destroy']()[_0x7fbf('0x24')](function(){_0x1b1897['status'](0xcc)[_0x7fbf('0x25')]();});}};}function handleEntityNotFound(_0x4eaa74,_0x3f2df0){return function(_0x201a59){if(!_0x201a59){_0x4eaa74['sendStatus'](0x194);}return _0x201a59;};}function handleError(_0x15a2d2,_0x4c8247){_0x4c8247=_0x4c8247||0x1f4;return function(_0x473de7){logger[_0x7fbf('0x26')](_0x473de7[_0x7fbf('0x27')]);if(_0x473de7[_0x7fbf('0x28')]){delete _0x473de7['name'];}_0x15a2d2[_0x7fbf('0x1b')](_0x4c8247)[_0x7fbf('0x29')](_0x473de7);};}exports[_0x7fbf('0x2a')]=function(_0x7a0916,_0x2f2167){var _0x296314={},_0x4812ed={},_0x3dcb6e={'count':0x0,'rows':[]};var _0xa90cc5=_['map'](db['OpenchannelTransferReport'][_0x7fbf('0x2b')],function(_0x241e28){return{'name':_0x241e28[_0x7fbf('0x2c')],'type':_0x241e28[_0x7fbf('0x2d')][_0x7fbf('0x2e')]};});_0x4812ed[_0x7fbf('0x2f')]=_[_0x7fbf('0x30')](_0xa90cc5,_0x7fbf('0x28'));_0x4812ed[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x7a0916[_0x7fbf('0x31')]);_0x4812ed[_0x7fbf('0x33')]=_['intersection'](_0x4812ed[_0x7fbf('0x2f')],_0x4812ed['query']);_0x296314['attributes']=_['intersection'](_0x4812ed['model'],qs['fields'](_0x7a0916['query']['fields']));_0x296314[_0x7fbf('0x34')]=_0x296314[_0x7fbf('0x34')][_0x7fbf('0x35')]?_0x296314[_0x7fbf('0x34')]:_0x4812ed[_0x7fbf('0x2f')];if(!_0x7a0916[_0x7fbf('0x31')][_0x7fbf('0x36')](_0x7fbf('0x37'))){_0x296314[_0x7fbf('0x1d')]=qs[_0x7fbf('0x1d')](_0x7a0916['query'][_0x7fbf('0x1d')]);_0x296314[_0x7fbf('0x1f')]=qs['offset'](_0x7a0916[_0x7fbf('0x31')][_0x7fbf('0x1f')]);}_0x296314[_0x7fbf('0x38')]=qs[_0x7fbf('0x39')](_0x7a0916['query'][_0x7fbf('0x39')]);_0x296314[_0x7fbf('0x3a')]=qs[_0x7fbf('0x33')](_['pick'](_0x7a0916[_0x7fbf('0x31')],_0x4812ed[_0x7fbf('0x33')]),_0xa90cc5);if(_0x7a0916['query'][_0x7fbf('0x3b')]){_0x296314['where']=_['merge'](_0x296314['where'],{'$or':_[_0x7fbf('0x30')](_0xa90cc5,function(_0x468f81){if(_0x468f81[_0x7fbf('0x2d')]!==_0x7fbf('0x3c')){var _0x3d50e9={};_0x3d50e9[_0x468f81[_0x7fbf('0x28')]]={'$like':'%'+_0x7a0916[_0x7fbf('0x31')][_0x7fbf('0x3b')]+'%'};return _0x3d50e9;}})});}_0x296314=_[_0x7fbf('0x3d')]({},_0x296314,_0x7a0916[_0x7fbf('0x3e')]);var _0x506039={'where':_0x296314[_0x7fbf('0x3a')]};return db[_0x7fbf('0x3f')][_0x7fbf('0x1e')](_0x506039)[_0x7fbf('0x24')](function(_0x20cd7a){_0x3dcb6e[_0x7fbf('0x1e')]=_0x20cd7a;if(_0x7a0916['query'][_0x7fbf('0x40')]){_0x296314[_0x7fbf('0x41')]=[{'all':!![]}];}return db[_0x7fbf('0x3f')]['findAll'](_0x296314);})[_0x7fbf('0x24')](function(_0x12724e){_0x3dcb6e['rows']=_0x12724e;return _0x3dcb6e;})[_0x7fbf('0x24')](respondWithFilteredResult(_0x2f2167,_0x296314))[_0x7fbf('0x42')](handleError(_0x2f2167,null));};exports[_0x7fbf('0x43')]=function(_0x434678,_0x47356a){var _0x3a4f4d={'raw':!![],'where':{'id':_0x434678[_0x7fbf('0x44')]['id']}},_0x57b7b2={};_0x57b7b2[_0x7fbf('0x2f')]=_[_0x7fbf('0x32')](db[_0x7fbf('0x3f')][_0x7fbf('0x2b')]);_0x57b7b2[_0x7fbf('0x31')]=_['keys'](_0x434678[_0x7fbf('0x31')]);_0x57b7b2['filters']=_[_0x7fbf('0x45')](_0x57b7b2[_0x7fbf('0x2f')],_0x57b7b2[_0x7fbf('0x31')]);_0x3a4f4d[_0x7fbf('0x34')]=_[_0x7fbf('0x45')](_0x57b7b2[_0x7fbf('0x2f')],qs[_0x7fbf('0x46')](_0x434678[_0x7fbf('0x31')][_0x7fbf('0x46')]));_0x3a4f4d[_0x7fbf('0x34')]=_0x3a4f4d[_0x7fbf('0x34')][_0x7fbf('0x35')]?_0x3a4f4d['attributes']:_0x57b7b2[_0x7fbf('0x2f')];if(_0x434678[_0x7fbf('0x31')][_0x7fbf('0x40')]){_0x3a4f4d[_0x7fbf('0x41')]=[{'all':!![]}];}_0x3a4f4d=_[_0x7fbf('0x3d')]({},_0x3a4f4d,_0x434678['options']);return db[_0x7fbf('0x3f')][_0x7fbf('0x47')](_0x3a4f4d)[_0x7fbf('0x24')](handleEntityNotFound(_0x47356a,null))[_0x7fbf('0x24')](respondWithResult(_0x47356a,null))[_0x7fbf('0x42')](handleError(_0x47356a,null));};exports[_0x7fbf('0x48')]=function(_0x538e16,_0x53e0f9){return db['OpenchannelTransferReport'][_0x7fbf('0x48')](_0x538e16[_0x7fbf('0x49')],{})[_0x7fbf('0x24')](respondWithResult(_0x53e0f9,0xc9))['catch'](handleError(_0x53e0f9,null));};exports[_0x7fbf('0x23')]=function(_0x42ae35,_0x48747f){if(_0x42ae35[_0x7fbf('0x49')]['id']){delete _0x42ae35[_0x7fbf('0x49')]['id'];}return db[_0x7fbf('0x3f')]['find']({'where':{'id':_0x42ae35[_0x7fbf('0x44')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x48747f,null))[_0x7fbf('0x24')](saveUpdates(_0x42ae35[_0x7fbf('0x49')],null))[_0x7fbf('0x24')](respondWithResult(_0x48747f,null))['catch'](handleError(_0x48747f,null));};exports['destroy']=function(_0x1abd01,_0x2444b4){return db[_0x7fbf('0x3f')][_0x7fbf('0x47')]({'where':{'id':_0x1abd01[_0x7fbf('0x44')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x2444b4,null))['then'](removeEntity(_0x2444b4,null))[_0x7fbf('0x42')](handleError(_0x2444b4,null));};exports[_0x7fbf('0x4a')]=function(_0x294457,_0x570eed){return db[_0x7fbf('0x3f')][_0x7fbf('0x4a')]()['then'](respondWithResult(_0x570eed,null))[_0x7fbf('0x42')](handleError(_0x570eed,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b227e63..68dec8c 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 _0x1124=['../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11bc61,_0x47651b){var _0x59b796=function(_0x457565){while(--_0x457565){_0x11bc61['push'](_0x11bc61['shift']());}};_0x59b796(++_0x47651b);}(_0x1124,0x17e));var _0x4112=function(_0x402f3f,_0xb47479){_0x402f3f=_0x402f3f-0x0;var _0x4cfcc1=_0x1124[_0x402f3f];return _0x4cfcc1;};'use strict';var _=require(_0x4112('0x0'));var util=require('util');var logger=require(_0x4112('0x1'))(_0x4112('0x2'));var moment=require(_0x4112('0x3'));var BPromise=require(_0x4112('0x4'));var rp=require(_0x4112('0x5'));var fs=require('fs');var path=require(_0x4112('0x6'));var rimraf=require(_0x4112('0x7'));var config=require(_0x4112('0x8'));var attributes=require(_0x4112('0x9'));module['exports']=function(_0x3bb51d,_0x349b83){return _0x3bb51d[_0x4112('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x4112('0xb'),'paranoid':![],'indexes':[{'name':_0x4112('0xc'),'fields':[_0x4112('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6edc=['request-promise','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6edc,0xa0));var _0xc6ed=function(_0x4d2d40,_0x5b69ce){_0x4d2d40=_0x4d2d40-0x0;var _0x491803=_0x6edc[_0x4d2d40];return _0x491803;};'use strict';var _=require(_0xc6ed('0x0'));var util=require(_0xc6ed('0x1'));var logger=require('../../config/logger')(_0xc6ed('0x2'));var moment=require(_0xc6ed('0x3'));var BPromise=require(_0xc6ed('0x4'));var rp=require(_0xc6ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ed('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0xc6ed('0x7')]=function(_0x3e39a8,_0x31aeae){return _0x3e39a8[_0xc6ed('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0xc6ed('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc6ed('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 5436fb5..788be5c 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 _0x90b5=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x1927dc,_0x235225){var _0x4882dc=function(_0x419205){while(--_0x419205){_0x1927dc['push'](_0x1927dc['shift']());}};_0x4882dc(++_0x235225);}(_0x90b5,0x139));var _0x590b=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x90b5[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var moment=require(_0x590b('0x1'));var BPromise=require(_0x590b('0x2'));var rs=require(_0x590b('0x3'));var fs=require('fs');var Redis=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x590b('0x5'))(_0x590b('0x6'));var config=require('../../config/environment');var jayson=require(_0x590b('0x7'));var client=jayson[_0x590b('0x8')][_0x590b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54fe,_0x30bc6e,_0x3663a0){return new BPromise(function(_0x3ec156,_0x9c408b){return client[_0x590b('0xa')](_0x5e54fe,_0x3663a0)[_0x590b('0xb')](function(_0x2103c0){logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,'request\x20sent');logger[_0x590b('0xe')](_0x590b('0xf'),_0x30bc6e,'request\x20sent',JSON[_0x590b('0x10')](_0x2103c0));if(_0x2103c0['error']){if(_0x2103c0[_0x590b('0x11')][_0x590b('0x12')]===0x1f4){logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0['error'][_0x590b('0x13')]);return _0x9c408b(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);return _0x3ec156(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}else{logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,_0x590b('0x14'));_0x3ec156(_0x2103c0[_0x590b('0x15')][_0x590b('0x13')]);}})[_0x590b('0x16')](function(_0x4f2512){logger[_0x590b('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x30bc6e,_0x4f2512);_0x9c408b(_0x4f2512);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x47f35d,_0x439625){var _0x33bd6f=function(_0x5cc44b){while(--_0x5cc44b){_0x47f35d['push'](_0x47f35d['shift']());}};_0x33bd6f(++_0x439625);}(_0x207c,0x1e8));var _0xc207=function(_0x5d6600,_0x9a9e9b){_0x5d6600=_0x5d6600-0x0;var _0x3c85cc=_0x207c[_0x5d6600];return _0x3c85cc;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 209fdd1..020c6c1 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 _0xa0c8=['../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','post','isAuthenticated','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3bb0cb,_0x336f5e){var _0x5c485f=function(_0x16f9a3){while(--_0x16f9a3){_0x3bb0cb['push'](_0x3bb0cb['shift']());}};_0x5c485f(++_0x336f5e);}(_0xa0c8,0x6b));var _0x8a0c=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xa0c8[_0x163040];return _0x364667;};'use strict';var multer=require('multer');var util=require(_0x8a0c('0x0'));var path=require('path');var timeout=require(_0x8a0c('0x1'));var express=require('express');var router=express[_0x8a0c('0x2')]();var fs_extra=require(_0x8a0c('0x3'));var auth=require(_0x8a0c('0x4'));var interaction=require(_0x8a0c('0x5'));var config=require(_0x8a0c('0x6'));var controller=require(_0x8a0c('0x7'));router[_0x8a0c('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a0c('0x9')]);router['get'](_0x8a0c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8a0c('0xb')]('/',auth[_0x8a0c('0xc')](),controller['create']);router[_0x8a0c('0xd')]('/:id',auth[_0x8a0c('0xc')](),controller['update']);router[_0x8a0c('0xe')](_0x8a0c('0xa'),auth[_0x8a0c('0xc')](),controller['destroy']);module[_0x8a0c('0xf')]=router; \ No newline at end of file +var _0x5321=['path','express','../../components/auth/service','../../config/environment','./pause.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','multer','util'];(function(_0x1e1fa8,_0x5c1271){var _0x48cf7b=function(_0x1f0335){while(--_0x1f0335){_0x1e1fa8['push'](_0x1e1fa8['shift']());}};_0x48cf7b(++_0x5c1271);}(_0x5321,0x9e));var _0x1532=function(_0x1222e3,_0xfcee6e){_0x1222e3=_0x1222e3-0x0;var _0x2f91e5=_0x5321[_0x1222e3];return _0x2f91e5;};'use strict';var multer=require(_0x1532('0x0'));var util=require(_0x1532('0x1'));var path=require(_0x1532('0x2'));var timeout=require('connect-timeout');var express=require(_0x1532('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1532('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1532('0x5'));var controller=require(_0x1532('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1532('0x7')]);router[_0x1532('0x8')](_0x1532('0x9'),auth[_0x1532('0xa')](),controller[_0x1532('0xb')]);router[_0x1532('0xc')]('/',auth[_0x1532('0xa')](),controller[_0x1532('0xd')]);router[_0x1532('0xe')]('/:id',auth[_0x1532('0xa')](),controller[_0x1532('0xf')]);router['delete'](_0x1532('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index b909da0..ca2a1df 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 _0x9500=['exports','STRING','sequelize'];(function(_0x59b669,_0x32fd14){var _0x270335=function(_0x3e347a){while(--_0x3e347a){_0x59b669['push'](_0x59b669['shift']());}};_0x270335(++_0x32fd14);}(_0x9500,0x173));var _0x0950=function(_0x453668,_0x2cd5eb){_0x453668=_0x453668-0x0;var _0x3b4f8c=_0x9500[_0x453668];return _0x3b4f8c;};'use strict';var Sequelize=require(_0x0950('0x0'));module[_0x0950('0x1')]={'name':{'type':Sequelize[_0x0950('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0950('0x2')]}}; \ No newline at end of file +var _0xea21=['sequelize','STRING'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xea21,0x1c6));var _0x1ea2=function(_0x359f88,_0x38f7dc){_0x359f88=_0x359f88-0x0;var _0x57cea3=_0xea21[_0x359f88];return _0x57cea3;};'use strict';var Sequelize=require(_0x1ea2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1ea2('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f4a6cd2..4e32592 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 _0x9ee6=['apply','update','then','destroy','UserProfileResource','stack','name','send','Pause','rawAttributes','type','map','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','catch','show','params','keys','intersection','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x490ad3,_0x204bb3){var _0x1bd7a2=function(_0x53fe43){while(--_0x53fe43){_0x490ad3['push'](_0x490ad3['shift']());}};_0x1bd7a2(++_0x204bb3);}(_0x9ee6,0x7e));var _0x69ee=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0x9ee6[_0x41582d];return _0x59c504;};'use strict';var emlformat=require(_0x69ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69ee('0x1'));var jsonpatch=require(_0x69ee('0x2'));var rp=require(_0x69ee('0x3'));var moment=require(_0x69ee('0x4'));var BPromise=require(_0x69ee('0x5'));var Mustache=require(_0x69ee('0x6'));var util=require(_0x69ee('0x7'));var path=require(_0x69ee('0x8'));var sox=require('sox');var csv=require(_0x69ee('0x9'));var ejs=require(_0x69ee('0xa'));var fs=require('fs');var fs_extra=require(_0x69ee('0xb'));var _=require(_0x69ee('0xc'));var squel=require(_0x69ee('0xd'));var crypto=require(_0x69ee('0xe'));var jsforce=require(_0x69ee('0xf'));var deskjs=require(_0x69ee('0x10'));var toCsv=require(_0x69ee('0x9'));var querystring=require(_0x69ee('0x11'));var Papa=require(_0x69ee('0x12'));var Redis=require('ioredis');var authService=require(_0x69ee('0x13'));var qs=require(_0x69ee('0x14'));var as=require(_0x69ee('0x15'));var hardwareService=require(_0x69ee('0x16'));var logger=require(_0x69ee('0x17'))('api');var utils=require(_0x69ee('0x18'));var config=require(_0x69ee('0x19'));var licenseUtil=require(_0x69ee('0x1a'));var db=require(_0x69ee('0x1b'))['db'];function respondWithStatusCode(_0x15f9ae,_0x342835){_0x342835=_0x342835||0xcc;return function(_0x25a6ee){if(_0x25a6ee){return _0x15f9ae[_0x69ee('0x1c')](_0x342835);}return _0x15f9ae['status'](_0x342835)[_0x69ee('0x1d')]();};}function respondWithResult(_0x443d21,_0x1ef4ad){_0x1ef4ad=_0x1ef4ad||0xc8;return function(_0x145292){if(_0x145292){return _0x443d21[_0x69ee('0x1e')](_0x1ef4ad)[_0x69ee('0x1f')](_0x145292);}};}function respondWithFilteredResult(_0x5440a5,_0x2f167a){return function(_0x205576){if(_0x205576){var _0x219891=typeof _0x2f167a[_0x69ee('0x20')]===_0x69ee('0x21')&&typeof _0x2f167a['limit']===_0x69ee('0x21');var _0x1c2bd1=_0x205576[_0x69ee('0x22')];var _0x17b5e5=_0x219891?0x0:_0x2f167a[_0x69ee('0x20')];var _0x11beaa=_0x219891?_0x205576[_0x69ee('0x22')]:_0x2f167a[_0x69ee('0x20')]+_0x2f167a[_0x69ee('0x23')];var _0x3a7cb1;if(_0x11beaa>=_0x1c2bd1){_0x11beaa=_0x1c2bd1;_0x3a7cb1=0xc8;}else{_0x3a7cb1=0xce;}_0x5440a5[_0x69ee('0x1e')](_0x3a7cb1);return _0x5440a5[_0x69ee('0x24')](_0x69ee('0x25'),_0x17b5e5+'-'+_0x11beaa+'/'+_0x1c2bd1)['json'](_0x205576);}return null;};}function patchUpdates(_0x5dce67){return function(_0x3ec105){try{jsonpatch[_0x69ee('0x26')](_0x3ec105,_0x5dce67,!![]);}catch(_0x2164af){return BPromise['reject'](_0x2164af);}return _0x3ec105['save']();};}function saveUpdates(_0xa188e3,_0x317cb4){return function(_0x1ea294){if(_0x1ea294){return _0x1ea294[_0x69ee('0x27')](_0xa188e3)[_0x69ee('0x28')](function(_0x2e8b2c){return _0x2e8b2c;});}return null;};}function removeEntity(_0x3e83ad,_0x43676d){return function(_0xe04755){if(_0xe04755){return _0xe04755[_0x69ee('0x29')]()[_0x69ee('0x28')](function(){var _0x5a02f2=_0xe04755['get']({'plain':!![]});var _0xbde60d='Pauses';return db[_0x69ee('0x2a')][_0x69ee('0x29')]({'where':{'type':_0xbde60d,'resourceId':_0x5a02f2['id']}})[_0x69ee('0x28')](function(){return _0xe04755;});})[_0x69ee('0x28')](function(){_0x3e83ad[_0x69ee('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49557a,_0x1159ba){return function(_0x4b5823){if(!_0x4b5823){_0x49557a[_0x69ee('0x1c')](0x194);}return _0x4b5823;};}function handleError(_0xde3cb4,_0x84591b){_0x84591b=_0x84591b||0x1f4;return function(_0x2bf519){logger['error'](_0x2bf519[_0x69ee('0x2b')]);if(_0x2bf519['name']){delete _0x2bf519[_0x69ee('0x2c')];}_0xde3cb4[_0x69ee('0x1e')](_0x84591b)[_0x69ee('0x2d')](_0x2bf519);};}exports['index']=function(_0x5ac50d,_0x1a25c9){var _0x26a3b3={},_0x3e5205={},_0x10aea5={'count':0x0,'rows':[]};var _0x588a1e=_['map'](db[_0x69ee('0x2e')][_0x69ee('0x2f')],function(_0x23bde5){return{'name':_0x23bde5['fieldName'],'type':_0x23bde5[_0x69ee('0x30')]['key']};});_0x3e5205['model']=_[_0x69ee('0x31')](_0x588a1e,'name');_0x3e5205['query']=_['keys'](_0x5ac50d[_0x69ee('0x32')]);_0x3e5205['filters']=_['intersection'](_0x3e5205['model'],_0x3e5205[_0x69ee('0x32')]);_0x26a3b3[_0x69ee('0x33')]=_['intersection'](_0x3e5205['model'],qs[_0x69ee('0x34')](_0x5ac50d[_0x69ee('0x32')][_0x69ee('0x34')]));_0x26a3b3[_0x69ee('0x33')]=_0x26a3b3[_0x69ee('0x33')][_0x69ee('0x35')]?_0x26a3b3[_0x69ee('0x33')]:_0x3e5205[_0x69ee('0x36')];if(!_0x5ac50d['query'][_0x69ee('0x37')](_0x69ee('0x38'))){_0x26a3b3[_0x69ee('0x23')]=qs['limit'](_0x5ac50d[_0x69ee('0x32')][_0x69ee('0x23')]);_0x26a3b3[_0x69ee('0x20')]=qs['offset'](_0x5ac50d['query']['offset']);}_0x26a3b3[_0x69ee('0x39')]=qs['sort'](_0x5ac50d[_0x69ee('0x32')][_0x69ee('0x3a')]);_0x26a3b3[_0x69ee('0x3b')]=qs[_0x69ee('0x3c')](_[_0x69ee('0x3d')](_0x5ac50d[_0x69ee('0x32')],_0x3e5205['filters']),_0x588a1e);if(_0x5ac50d[_0x69ee('0x32')][_0x69ee('0x3e')]){_0x26a3b3['where']=_['merge'](_0x26a3b3['where'],{'$or':_[_0x69ee('0x31')](_0x588a1e,function(_0x29f099){if(_0x29f099['type']!=='VIRTUAL'){var _0x4e55a5={};_0x4e55a5[_0x29f099[_0x69ee('0x2c')]]={'$like':'%'+_0x5ac50d[_0x69ee('0x32')]['filter']+'%'};return _0x4e55a5;}})});}_0x26a3b3=_['merge']({},_0x26a3b3,_0x5ac50d['options']);var _0x1d1f5d={'where':_0x26a3b3[_0x69ee('0x3b')]};return db['Pause'][_0x69ee('0x22')](_0x1d1f5d)[_0x69ee('0x28')](function(_0x390183){_0x10aea5['count']=_0x390183;if(_0x5ac50d[_0x69ee('0x32')][_0x69ee('0x3f')]){_0x26a3b3[_0x69ee('0x40')]=[{'all':!![]}];}return db[_0x69ee('0x2e')]['findAll'](_0x26a3b3);})[_0x69ee('0x28')](function(_0x157dce){_0x10aea5['rows']=_0x157dce;return _0x10aea5;})[_0x69ee('0x28')](respondWithFilteredResult(_0x1a25c9,_0x26a3b3))[_0x69ee('0x41')](handleError(_0x1a25c9,null));};exports[_0x69ee('0x42')]=function(_0x39d2b4,_0x110d63){var _0x30031d={'raw':!![],'where':{'id':_0x39d2b4[_0x69ee('0x43')]['id']}},_0x5cd46d={};_0x5cd46d[_0x69ee('0x36')]=_[_0x69ee('0x44')](db[_0x69ee('0x2e')][_0x69ee('0x2f')]);_0x5cd46d['query']=_[_0x69ee('0x44')](_0x39d2b4[_0x69ee('0x32')]);_0x5cd46d[_0x69ee('0x3c')]=_[_0x69ee('0x45')](_0x5cd46d[_0x69ee('0x36')],_0x5cd46d[_0x69ee('0x32')]);_0x30031d[_0x69ee('0x33')]=_[_0x69ee('0x45')](_0x5cd46d[_0x69ee('0x36')],qs[_0x69ee('0x34')](_0x39d2b4[_0x69ee('0x32')][_0x69ee('0x34')]));_0x30031d[_0x69ee('0x33')]=_0x30031d['attributes']['length']?_0x30031d[_0x69ee('0x33')]:_0x5cd46d[_0x69ee('0x36')];if(_0x39d2b4[_0x69ee('0x32')][_0x69ee('0x3f')]){_0x30031d[_0x69ee('0x40')]=[{'all':!![]}];}_0x30031d=_['merge']({},_0x30031d,_0x39d2b4[_0x69ee('0x46')]);return db['Pause'][_0x69ee('0x47')](_0x30031d)[_0x69ee('0x28')](handleEntityNotFound(_0x110d63,null))[_0x69ee('0x28')](respondWithResult(_0x110d63,null))[_0x69ee('0x41')](handleError(_0x110d63,null));};exports['create']=function(_0x501398,_0x125224){return db[_0x69ee('0x2e')]['create'](_0x501398[_0x69ee('0x48')],{})[_0x69ee('0x28')](function(_0x263fb0){var _0x1993f2=_0x501398[_0x69ee('0x49')]['get']({'plain':!![]});if(!_0x1993f2)throw new Error(_0x69ee('0x4a'));if(_0x1993f2[_0x69ee('0x4b')]===_0x69ee('0x49')){var _0x1d1971=_0x263fb0[_0x69ee('0x4c')]({'plain':!![]});var _0x963df4='Pauses';return db[_0x69ee('0x4d')][_0x69ee('0x47')]({'where':{'name':_0x963df4,'userProfileId':_0x1993f2[_0x69ee('0x4e')]},'raw':!![]})[_0x69ee('0x28')](function(_0x1cdc38){if(_0x1cdc38&&_0x1cdc38[_0x69ee('0x4f')]===0x0){return db[_0x69ee('0x2a')]['create']({'name':_0x1d1971[_0x69ee('0x2c')],'resourceId':_0x1d1971['id'],'type':_0x1cdc38[_0x69ee('0x2c')],'sectionId':_0x1cdc38['id']},{})['then'](function(){return _0x263fb0;});}else{return _0x263fb0;}})[_0x69ee('0x41')](function(_0xfd6dae){logger[_0x69ee('0x50')](_0x69ee('0x51'),_0xfd6dae);throw _0xfd6dae;});}return _0x263fb0;})['then'](respondWithResult(_0x125224,0xc9))[_0x69ee('0x41')](handleError(_0x125224,null));};exports[_0x69ee('0x27')]=function(_0x42102d,_0x5ef0ee){if(_0x42102d[_0x69ee('0x48')]['id']){delete _0x42102d[_0x69ee('0x48')]['id'];}return db['Pause'][_0x69ee('0x47')]({'where':{'id':_0x42102d[_0x69ee('0x43')]['id']}})[_0x69ee('0x28')](handleEntityNotFound(_0x5ef0ee,null))[_0x69ee('0x28')](saveUpdates(_0x42102d['body'],null))[_0x69ee('0x28')](respondWithResult(_0x5ef0ee,null))[_0x69ee('0x41')](handleError(_0x5ef0ee,null));};exports['destroy']=function(_0x17cad3,_0x334092){return db[_0x69ee('0x2e')][_0x69ee('0x47')]({'where':{'id':_0x17cad3[_0x69ee('0x43')]['id']}})[_0x69ee('0x28')](handleEntityNotFound(_0x334092,null))[_0x69ee('0x28')](removeEntity(_0x334092,null))[_0x69ee('0x41')](handleError(_0x334092,null));}; \ No newline at end of file +var _0x0511=['index','map','Pause','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','error','find','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','name'];(function(_0x10cd27,_0x4bec03){var _0x5f5857=function(_0x30c517){while(--_0x30c517){_0x10cd27['push'](_0x10cd27['shift']());}};_0x5f5857(++_0x4bec03);}(_0x0511,0x118));var _0x1051=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x0511[_0x2e8418];return _0x548fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1051('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1051('0x1'));var moment=require(_0x1051('0x2'));var BPromise=require(_0x1051('0x3'));var Mustache=require(_0x1051('0x4'));var util=require(_0x1051('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1051('0x6'));var ejs=require(_0x1051('0x7'));var fs=require('fs');var fs_extra=require(_0x1051('0x8'));var _=require(_0x1051('0x9'));var squel=require(_0x1051('0xa'));var crypto=require('crypto');var jsforce=require(_0x1051('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1051('0x6'));var querystring=require(_0x1051('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1051('0xd'));var qs=require(_0x1051('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1051('0xf'))(_0x1051('0x10'));var utils=require(_0x1051('0x11'));var config=require(_0x1051('0x12'));var licenseUtil=require(_0x1051('0x13'));var db=require(_0x1051('0x14'))['db'];function respondWithStatusCode(_0x4275a0,_0x3582c6){_0x3582c6=_0x3582c6||0xcc;return function(_0xf7c298){if(_0xf7c298){return _0x4275a0[_0x1051('0x15')](_0x3582c6);}return _0x4275a0[_0x1051('0x16')](_0x3582c6)[_0x1051('0x17')]();};}function respondWithResult(_0x30eb40,_0xe7ffe){_0xe7ffe=_0xe7ffe||0xc8;return function(_0x2040be){if(_0x2040be){return _0x30eb40[_0x1051('0x16')](_0xe7ffe)['json'](_0x2040be);}};}function respondWithFilteredResult(_0x1a6854,_0x77f47f){return function(_0xb75a9a){if(_0xb75a9a){var _0x52161b=typeof _0x77f47f[_0x1051('0x18')]==='undefined'&&typeof _0x77f47f[_0x1051('0x19')]===_0x1051('0x1a');var _0x1725ea=_0xb75a9a[_0x1051('0x1b')];var _0xec39d3=_0x52161b?0x0:_0x77f47f[_0x1051('0x18')];var _0x2de90f=_0x52161b?_0xb75a9a[_0x1051('0x1b')]:_0x77f47f[_0x1051('0x18')]+_0x77f47f[_0x1051('0x19')];var _0x8eb944;if(_0x2de90f>=_0x1725ea){_0x2de90f=_0x1725ea;_0x8eb944=0xc8;}else{_0x8eb944=0xce;}_0x1a6854[_0x1051('0x16')](_0x8eb944);return _0x1a6854[_0x1051('0x1c')](_0x1051('0x1d'),_0xec39d3+'-'+_0x2de90f+'/'+_0x1725ea)[_0x1051('0x1e')](_0xb75a9a);}return null;};}function patchUpdates(_0x898d2a){return function(_0x1f7be4){try{jsonpatch[_0x1051('0x1f')](_0x1f7be4,_0x898d2a,!![]);}catch(_0x1fa5fa){return BPromise[_0x1051('0x20')](_0x1fa5fa);}return _0x1f7be4['save']();};}function saveUpdates(_0x3eefb5,_0x404dde){return function(_0x518d20){if(_0x518d20){return _0x518d20[_0x1051('0x21')](_0x3eefb5)[_0x1051('0x22')](function(_0x1737ce){return _0x1737ce;});}return null;};}function removeEntity(_0x341c82,_0x5f253b){return function(_0x248ede){if(_0x248ede){return _0x248ede[_0x1051('0x23')]()['then'](function(){var _0x3252f9=_0x248ede[_0x1051('0x24')]({'plain':!![]});var _0xe7ef14='Pauses';return db[_0x1051('0x25')]['destroy']({'where':{'type':_0xe7ef14,'resourceId':_0x3252f9['id']}})[_0x1051('0x22')](function(){return _0x248ede;});})[_0x1051('0x22')](function(){_0x341c82[_0x1051('0x16')](0xcc)[_0x1051('0x17')]();});}};}function handleEntityNotFound(_0x4c4b6d,_0x228f45){return function(_0x10af6b){if(!_0x10af6b){_0x4c4b6d[_0x1051('0x15')](0x194);}return _0x10af6b;};}function handleError(_0x3acbf6,_0x1093be){_0x1093be=_0x1093be||0x1f4;return function(_0x1a8e09){logger['error'](_0x1a8e09[_0x1051('0x26')]);if(_0x1a8e09[_0x1051('0x27')]){delete _0x1a8e09[_0x1051('0x27')];}_0x3acbf6[_0x1051('0x16')](_0x1093be)['send'](_0x1a8e09);};}exports[_0x1051('0x28')]=function(_0x51120b,_0x53463e){var _0x3d95d8={},_0x2185cf={},_0x320766={'count':0x0,'rows':[]};var _0x2cdd6c=_[_0x1051('0x29')](db[_0x1051('0x2a')][_0x1051('0x2b')],function(_0x8fbb4b){return{'name':_0x8fbb4b[_0x1051('0x2c')],'type':_0x8fbb4b[_0x1051('0x2d')][_0x1051('0x2e')]};});_0x2185cf['model']=_['map'](_0x2cdd6c,_0x1051('0x27'));_0x2185cf[_0x1051('0x2f')]=_[_0x1051('0x30')](_0x51120b['query']);_0x2185cf['filters']=_[_0x1051('0x31')](_0x2185cf[_0x1051('0x32')],_0x2185cf['query']);_0x3d95d8[_0x1051('0x33')]=_[_0x1051('0x31')](_0x2185cf[_0x1051('0x32')],qs[_0x1051('0x34')](_0x51120b[_0x1051('0x2f')]['fields']));_0x3d95d8[_0x1051('0x33')]=_0x3d95d8['attributes'][_0x1051('0x35')]?_0x3d95d8[_0x1051('0x33')]:_0x2185cf['model'];if(!_0x51120b['query']['hasOwnProperty']('nolimit')){_0x3d95d8['limit']=qs['limit'](_0x51120b[_0x1051('0x2f')]['limit']);_0x3d95d8[_0x1051('0x18')]=qs['offset'](_0x51120b[_0x1051('0x2f')][_0x1051('0x18')]);}_0x3d95d8[_0x1051('0x36')]=qs[_0x1051('0x37')](_0x51120b[_0x1051('0x2f')]['sort']);_0x3d95d8[_0x1051('0x38')]=qs[_0x1051('0x39')](_[_0x1051('0x3a')](_0x51120b[_0x1051('0x2f')],_0x2185cf[_0x1051('0x39')]),_0x2cdd6c);if(_0x51120b[_0x1051('0x2f')][_0x1051('0x3b')]){_0x3d95d8[_0x1051('0x38')]=_[_0x1051('0x3c')](_0x3d95d8[_0x1051('0x38')],{'$or':_['map'](_0x2cdd6c,function(_0xe2dbeb){if(_0xe2dbeb[_0x1051('0x2d')]!==_0x1051('0x3d')){var _0x26de77={};_0x26de77[_0xe2dbeb[_0x1051('0x27')]]={'$like':'%'+_0x51120b['query']['filter']+'%'};return _0x26de77;}})});}_0x3d95d8=_[_0x1051('0x3c')]({},_0x3d95d8,_0x51120b[_0x1051('0x3e')]);var _0x38ae97={'where':_0x3d95d8['where']};return db[_0x1051('0x2a')][_0x1051('0x1b')](_0x38ae97)[_0x1051('0x22')](function(_0x12c602){_0x320766[_0x1051('0x1b')]=_0x12c602;if(_0x51120b[_0x1051('0x2f')]['includeAll']){_0x3d95d8['include']=[{'all':!![]}];}return db[_0x1051('0x2a')][_0x1051('0x3f')](_0x3d95d8);})[_0x1051('0x22')](function(_0x1ba33a){_0x320766[_0x1051('0x40')]=_0x1ba33a;return _0x320766;})[_0x1051('0x22')](respondWithFilteredResult(_0x53463e,_0x3d95d8))[_0x1051('0x41')](handleError(_0x53463e,null));};exports[_0x1051('0x42')]=function(_0x23e60d,_0xe675b7){var _0xe45344={'raw':!![],'where':{'id':_0x23e60d[_0x1051('0x43')]['id']}},_0x5bdefc={};_0x5bdefc[_0x1051('0x32')]=_['keys'](db[_0x1051('0x2a')][_0x1051('0x2b')]);_0x5bdefc[_0x1051('0x2f')]=_[_0x1051('0x30')](_0x23e60d[_0x1051('0x2f')]);_0x5bdefc[_0x1051('0x39')]=_[_0x1051('0x31')](_0x5bdefc[_0x1051('0x32')],_0x5bdefc[_0x1051('0x2f')]);_0xe45344[_0x1051('0x33')]=_[_0x1051('0x31')](_0x5bdefc['model'],qs[_0x1051('0x34')](_0x23e60d[_0x1051('0x2f')][_0x1051('0x34')]));_0xe45344['attributes']=_0xe45344['attributes'][_0x1051('0x35')]?_0xe45344[_0x1051('0x33')]:_0x5bdefc[_0x1051('0x32')];if(_0x23e60d[_0x1051('0x2f')][_0x1051('0x44')]){_0xe45344[_0x1051('0x45')]=[{'all':!![]}];}_0xe45344=_[_0x1051('0x3c')]({},_0xe45344,_0x23e60d[_0x1051('0x3e')]);return db[_0x1051('0x2a')]['find'](_0xe45344)[_0x1051('0x22')](handleEntityNotFound(_0xe675b7,null))[_0x1051('0x22')](respondWithResult(_0xe675b7,null))['catch'](handleError(_0xe675b7,null));};exports[_0x1051('0x46')]=function(_0x32c53b,_0x18440e){return db[_0x1051('0x2a')][_0x1051('0x46')](_0x32c53b[_0x1051('0x47')],{})[_0x1051('0x22')](function(_0x1a0767){var _0x3c3873=_0x32c53b[_0x1051('0x48')][_0x1051('0x24')]({'plain':!![]});if(!_0x3c3873)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c3873[_0x1051('0x49')]==='user'){var _0x2df334=_0x1a0767[_0x1051('0x24')]({'plain':!![]});var _0xc1c82=_0x1051('0x4a');return db[_0x1051('0x4b')]['find']({'where':{'name':_0xc1c82,'userProfileId':_0x3c3873[_0x1051('0x4c')]},'raw':!![]})[_0x1051('0x22')](function(_0x1669e8){if(_0x1669e8&&_0x1669e8[_0x1051('0x4d')]===0x0){return db[_0x1051('0x25')][_0x1051('0x46')]({'name':_0x2df334[_0x1051('0x27')],'resourceId':_0x2df334['id'],'type':_0x1669e8['name'],'sectionId':_0x1669e8['id']},{})[_0x1051('0x22')](function(){return _0x1a0767;});}else{return _0x1a0767;}})[_0x1051('0x41')](function(_0x282c7d){logger[_0x1051('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x282c7d);throw _0x282c7d;});}return _0x1a0767;})[_0x1051('0x22')](respondWithResult(_0x18440e,0xc9))[_0x1051('0x41')](handleError(_0x18440e,null));};exports[_0x1051('0x21')]=function(_0x327b15,_0x464af5){if(_0x327b15['body']['id']){delete _0x327b15[_0x1051('0x47')]['id'];}return db['Pause'][_0x1051('0x4f')]({'where':{'id':_0x327b15[_0x1051('0x43')]['id']}})[_0x1051('0x22')](handleEntityNotFound(_0x464af5,null))[_0x1051('0x22')](saveUpdates(_0x327b15['body'],null))[_0x1051('0x22')](respondWithResult(_0x464af5,null))[_0x1051('0x41')](handleError(_0x464af5,null));};exports[_0x1051('0x23')]=function(_0x1384b3,_0x3163b1){return db[_0x1051('0x2a')][_0x1051('0x4f')]({'where':{'id':_0x1384b3['params']['id']}})[_0x1051('0x22')](handleEntityNotFound(_0x3163b1,null))[_0x1051('0x22')](removeEntity(_0x3163b1,null))[_0x1051('0x41')](handleError(_0x3163b1,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index aca973f..e583ace 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x458f9d,_0x1d72f2){var _0x2ccc36=function(_0xf9b2a6){while(--_0xf9b2a6){_0x458f9d['push'](_0x458f9d['shift']());}};_0x2ccc36(++_0x1d72f2);}(_0x53ec,0x192));var _0xc53e=function(_0x164b96,_0x12f735){_0x164b96=_0x164b96-0x0;var _0x5489d9=_0x53ec[_0x164b96];return _0x5489d9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c6b479e..405a6bd 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x27760c,_0x56225a){var _0x1ff25f=function(_0x4c4608){while(--_0x4c4608){_0x27760c['push'](_0x27760c['shift']());}};_0x1ff25f(++_0x56225a);}(_0xb10b,0x12a));var _0xbb10=function(_0x549d16,_0x4d069a){_0x549d16=_0x549d16-0x0;var _0x344ccc=_0xb10b[_0x549d16];return _0x344ccc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x428fe1,_0xa3033d){var _0x5f19ba=function(_0x9c4234){while(--_0x9c4234){_0x428fe1['push'](_0x428fe1['shift']());}};_0x5f19ba(++_0xa3033d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0xb10b[_0x5c049a];return _0x168e70;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 63d8cae..cbdb2af 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 _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x1b791c,_0x4cb3a1){_0x1b791c=_0x1b791c-0x0;var _0x9a1b01=_0xc3b5[_0x1b791c];return _0x9a1b01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file +var _0xc6d8=['format','%s-%s%s','basename','extname','now','single','file','post','put','update','delete','exports','multer','path','express','fs-extra','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','diskStorage','root','originalname','replace'];(function(_0x35a21a,_0x4cbce3){var _0x17e065=function(_0x3cce7b){while(--_0x3cce7b){_0x35a21a['push'](_0x35a21a['shift']());}};_0x17e065(++_0x4cbce3);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0xc6d8[_0x3e690a];return _0x435ca0;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),controller['webhookGet']);router[_0x8c6d('0x6')](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller['show']);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xc')]);var upload=multer({'storage':multer[_0x8c6d('0xd')]({'destination':function(_0x43a7ab,_0x60cd5c,_0x392a6b){_0x392a6b(null,path['join'](config[_0x8c6d('0xe')],'server/files/plugins'));},'filename':function(_0x4c0878,_0x22d0fb,_0x890e85){_0x22d0fb[_0x8c6d('0xf')]=_0x22d0fb[_0x8c6d('0xf')][_0x8c6d('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x890e85(null,util[_0x8c6d('0x11')](_0x8c6d('0x12'),path[_0x8c6d('0x13')](_0x22d0fb[_0x8c6d('0xf')],path[_0x8c6d('0x14')](_0x22d0fb['originalname'])),Date[_0x8c6d('0x15')](),path['extname'](_0x22d0fb[_0x8c6d('0xf')])));}})});router['post']('/',upload[_0x8c6d('0x16')](_0x8c6d('0x17')),controller['upload']);router[_0x8c6d('0x18')](_0x8c6d('0x9'),controller['webhookPost']);router[_0x8c6d('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x8c6d('0x1a')]);router['delete'](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x1b')]);module[_0x8c6d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 44f47b4..fd2362f 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 _0x5b66=['script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','exports','ENUM','html'];(function(_0x3e89f8,_0x2287ee){var _0x499516=function(_0x3507f1){while(--_0x3507f1){_0x3e89f8['push'](_0x3e89f8['shift']());}};_0x499516(++_0x2287ee);}(_0x5b66,0x1ad));var _0x65b6=function(_0x2ae278,_0x340e9e){_0x2ae278=_0x2ae278-0x0;var _0x19828d=_0x5b66[_0x2ae278];return _0x19828d;};'use strict';var Sequelize=require('sequelize');module[_0x65b6('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x65b6('0x1')](_0x65b6('0x2'),_0x65b6('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x65b6('0x4')]},'path':{'type':Sequelize[_0x65b6('0x5')],'comment':_0x65b6('0x6')},'active':{'type':Sequelize[_0x65b6('0x7')],'defaultValue':0x0,'comment':_0x65b6('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x65b6('0x9'),_0x65b6('0xa'),'always',_0x65b6('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x65b6('0x5')]},'agentUrl':{'type':Sequelize[_0x65b6('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x23d3=['adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x23d3,0x158));var _0x323d=function(_0x2981fb,_0x13e1db){_0x2981fb=_0x2981fb-0x0;var _0x5a5baa=_0x23d3[_0x2981fb];return _0x5a5baa;};'use strict';var Sequelize=require('sequelize');module[_0x323d('0x0')]={'name':{'type':Sequelize[_0x323d('0x1')]},'type':{'type':Sequelize[_0x323d('0x2')]('html','script')},'description':{'type':Sequelize[_0x323d('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x323d('0x1')],'comment':_0x323d('0x4')},'active':{'type':Sequelize[_0x323d('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x323d('0x6'),_0x323d('0x7'),_0x323d('0x8'),'never'),'defaultValue':_0x323d('0x8'),'comment':_0x323d('0x9')},'icon':{'type':Sequelize[_0x323d('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x323d('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x323d('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 85531ed..d4f0698 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 _0x1973=['defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','set','Content-Range','json','apply','reject','save','update','then','get','Plugins','UserProfileResource','destroy','end','name','map','Plugin','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','limit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','keys','find','path','join','root','format','%s.zip','basename','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','send','Extracted\x20folder\x20removed','params','delete','webhookGet','resolve','\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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x2f4dd8,_0x52536a){var _0x42ae1a=function(_0x2781f2){while(--_0x2781f2){_0x2f4dd8['push'](_0x2f4dd8['shift']());}};_0x42ae1a(++_0x52536a);}(_0x1973,0x13e));var _0x3197=function(_0x15a301,_0x1bceb7){_0x15a301=_0x15a301-0x0;var _0x4cb3ef=_0x1973[_0x15a301];return _0x4cb3ef;};'use strict';var emlformat=require(_0x3197('0x0'));var rimraf=require(_0x3197('0x1'));var zipdir=require(_0x3197('0x2'));var jsonpatch=require(_0x3197('0x3'));var rp=require(_0x3197('0x4'));var moment=require(_0x3197('0x5'));var BPromise=require(_0x3197('0x6'));var Mustache=require(_0x3197('0x7'));var util=require(_0x3197('0x8'));var path=require('path');var sox=require(_0x3197('0x9'));var csv=require(_0x3197('0xa'));var ejs=require(_0x3197('0xb'));var fs=require('fs');var fs_extra=require(_0x3197('0xc'));var _=require(_0x3197('0xd'));var squel=require('squel');var crypto=require(_0x3197('0xe'));var jsforce=require(_0x3197('0xf'));var deskjs=require(_0x3197('0x10'));var toCsv=require(_0x3197('0xa'));var querystring=require('querystring');var Papa=require(_0x3197('0x11'));var extract=require(_0x3197('0x12'));var rimraf=require(_0x3197('0x1'));var archiver=require(_0x3197('0x13'));var Redis=require(_0x3197('0x14'));var authService=require(_0x3197('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3197('0x16'));var logger=require(_0x3197('0x17'))(_0x3197('0x18'));var utils=require(_0x3197('0x19'));var config=require(_0x3197('0x1a'));var licenseUtil=require(_0x3197('0x1b'));var db=require(_0x3197('0x1c'))['db'];config[_0x3197('0x1d')]=_[_0x3197('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3197('0x1f'))(new Redis(config['redis']));require(_0x3197('0x20'))[_0x3197('0x21')](socket);function respondWithStatusCode(_0x358689,_0xb4777c){_0xb4777c=_0xb4777c||0xcc;return function(_0x130bf6){if(_0x130bf6){return _0x358689[_0x3197('0x22')](_0xb4777c);}return _0x358689[_0x3197('0x23')](_0xb4777c)['end']();};}function respondWithResult(_0x429275,_0x26d70e){_0x26d70e=_0x26d70e||0xc8;return function(_0x397dbb){if(_0x397dbb){return _0x429275[_0x3197('0x23')](_0x26d70e)['json'](_0x397dbb);}};}function respondWithFilteredResult(_0x4a4c90,_0x49f205){return function(_0x19e8fd){if(_0x19e8fd){var _0x3ec5c6=typeof _0x49f205[_0x3197('0x24')]===_0x3197('0x25')&&typeof _0x49f205['limit']===_0x3197('0x25');var _0x558b2e=_0x19e8fd['count'];var _0x35dc0d=_0x3ec5c6?0x0:_0x49f205['offset'];var _0x292557=_0x3ec5c6?_0x19e8fd['count']:_0x49f205['offset']+_0x49f205['limit'];var _0x419f51;if(_0x292557>=_0x558b2e){_0x292557=_0x558b2e;_0x419f51=0xc8;}else{_0x419f51=0xce;}_0x4a4c90[_0x3197('0x23')](_0x419f51);return _0x4a4c90[_0x3197('0x26')](_0x3197('0x27'),_0x35dc0d+'-'+_0x292557+'/'+_0x558b2e)[_0x3197('0x28')](_0x19e8fd);}return null;};}function patchUpdates(_0xe096f1){return function(_0x5235f9){try{jsonpatch[_0x3197('0x29')](_0x5235f9,_0xe096f1,!![]);}catch(_0x4c067a){return BPromise[_0x3197('0x2a')](_0x4c067a);}return _0x5235f9[_0x3197('0x2b')]();};}function saveUpdates(_0x3d85c9,_0x15e827){return function(_0x3eacfd){if(_0x3eacfd){return _0x3eacfd[_0x3197('0x2c')](_0x3d85c9)[_0x3197('0x2d')](function(_0x41e7b7){return _0x41e7b7;});}return null;};}function removeEntity(_0x3c4a63,_0x57504d){return function(_0x2a895f){if(_0x2a895f){return _0x2a895f['destroy']()[_0x3197('0x2d')](function(){var _0x298991=_0x2a895f[_0x3197('0x2e')]({'plain':!![]});var _0x302d28=_0x3197('0x2f');return db[_0x3197('0x30')][_0x3197('0x31')]({'where':{'type':_0x302d28,'resourceId':_0x298991['id']}})[_0x3197('0x2d')](function(){return _0x2a895f;});})['then'](function(){_0x3c4a63[_0x3197('0x23')](0xcc)[_0x3197('0x32')]();});}};}function handleEntityNotFound(_0x186217,_0x16e7c1){return function(_0x34dc08){if(!_0x34dc08){_0x186217[_0x3197('0x22')](0x194);}return _0x34dc08;};}function handleError(_0x536584,_0x5bcda3){_0x5bcda3=_0x5bcda3||0x1f4;return function(_0x26a687){logger['error'](_0x26a687['stack']);if(_0x26a687[_0x3197('0x33')]){delete _0x26a687[_0x3197('0x33')];}_0x536584[_0x3197('0x23')](_0x5bcda3)['send'](_0x26a687);};}exports['index']=function(_0x2f8de8,_0x9bed7){var _0x3d41b7={},_0x1129e8={},_0x421887={'count':0x0,'rows':[]};var _0x48a5e7=_[_0x3197('0x34')](db[_0x3197('0x35')][_0x3197('0x36')],function(_0xdaccb2){return{'name':_0xdaccb2['fieldName'],'type':_0xdaccb2[_0x3197('0x37')][_0x3197('0x38')]};});_0x1129e8[_0x3197('0x39')]=_[_0x3197('0x34')](_0x48a5e7,_0x3197('0x33'));_0x1129e8[_0x3197('0x3a')]=_['keys'](_0x2f8de8[_0x3197('0x3a')]);_0x1129e8[_0x3197('0x3b')]=_['intersection'](_0x1129e8[_0x3197('0x39')],_0x1129e8[_0x3197('0x3a')]);_0x3d41b7[_0x3197('0x3c')]=_[_0x3197('0x3d')](_0x1129e8[_0x3197('0x39')],qs[_0x3197('0x3e')](_0x2f8de8[_0x3197('0x3a')][_0x3197('0x3e')]));_0x3d41b7[_0x3197('0x3c')]=_0x3d41b7[_0x3197('0x3c')][_0x3197('0x3f')]?_0x3d41b7['attributes']:_0x1129e8[_0x3197('0x39')];if(!_0x2f8de8[_0x3197('0x3a')]['hasOwnProperty']('nolimit')){_0x3d41b7[_0x3197('0x40')]=qs[_0x3197('0x40')](_0x2f8de8['query'][_0x3197('0x40')]);_0x3d41b7[_0x3197('0x24')]=qs[_0x3197('0x24')](_0x2f8de8[_0x3197('0x3a')][_0x3197('0x24')]);}_0x3d41b7[_0x3197('0x41')]=qs[_0x3197('0x42')](_0x2f8de8[_0x3197('0x3a')]['sort']);_0x3d41b7[_0x3197('0x43')]=qs[_0x3197('0x3b')](_['pick'](_0x2f8de8[_0x3197('0x3a')],_0x1129e8[_0x3197('0x3b')]),_0x48a5e7);if(_0x2f8de8[_0x3197('0x3a')]['filter']){_0x3d41b7['where']=_[_0x3197('0x44')](_0x3d41b7[_0x3197('0x43')],{'$or':_[_0x3197('0x34')](_0x48a5e7,function(_0x424696){if(_0x424696[_0x3197('0x37')]!==_0x3197('0x45')){var _0x373f8c={};_0x373f8c[_0x424696[_0x3197('0x33')]]={'$like':'%'+_0x2f8de8[_0x3197('0x3a')][_0x3197('0x46')]+'%'};return _0x373f8c;}})});}_0x3d41b7=_[_0x3197('0x44')]({},_0x3d41b7,_0x2f8de8[_0x3197('0x47')]);var _0x4fbf3a={'where':_0x3d41b7[_0x3197('0x43')]};return db['Plugin'][_0x3197('0x48')](_0x4fbf3a)['then'](function(_0xe2e8be){_0x421887['count']=_0xe2e8be;if(_0x2f8de8[_0x3197('0x3a')][_0x3197('0x49')]){_0x3d41b7[_0x3197('0x4a')]=[{'all':!![]}];}return db[_0x3197('0x35')][_0x3197('0x4b')](_0x3d41b7);})['then'](function(_0x53c0ec){_0x421887[_0x3197('0x4c')]=_0x53c0ec;return _0x421887;})[_0x3197('0x2d')](respondWithFilteredResult(_0x9bed7,_0x3d41b7))[_0x3197('0x4d')](handleError(_0x9bed7,null));};exports[_0x3197('0x4e')]=function(_0x4c1884,_0x2ee9b5){var _0x2e2eec={'raw':!![],'where':{'id':_0x4c1884['params']['id']}},_0x9716fd={};_0x9716fd['model']=_[_0x3197('0x4f')](db[_0x3197('0x35')][_0x3197('0x36')]);_0x9716fd[_0x3197('0x3a')]=_[_0x3197('0x4f')](_0x4c1884['query']);_0x9716fd[_0x3197('0x3b')]=_[_0x3197('0x3d')](_0x9716fd[_0x3197('0x39')],_0x9716fd[_0x3197('0x3a')]);_0x2e2eec[_0x3197('0x3c')]=_['intersection'](_0x9716fd[_0x3197('0x39')],qs[_0x3197('0x3e')](_0x4c1884[_0x3197('0x3a')][_0x3197('0x3e')]));_0x2e2eec[_0x3197('0x3c')]=_0x2e2eec[_0x3197('0x3c')][_0x3197('0x3f')]?_0x2e2eec['attributes']:_0x9716fd[_0x3197('0x39')];if(_0x4c1884['query'][_0x3197('0x49')]){_0x2e2eec['include']=[{'all':!![]}];}_0x2e2eec=_[_0x3197('0x44')]({},_0x2e2eec,_0x4c1884[_0x3197('0x47')]);return db[_0x3197('0x35')]['find'](_0x2e2eec)[_0x3197('0x2d')](handleEntityNotFound(_0x2ee9b5,null))[_0x3197('0x2d')](respondWithResult(_0x2ee9b5,null))[_0x3197('0x4d')](handleError(_0x2ee9b5,null));};exports['download']=function(_0xe5f03c,_0x360a26,_0x2e283b){return db['Plugin'][_0x3197('0x50')]({'where':{'id':_0xe5f03c['params']['id']},'attributes':['name',_0x3197('0x51')],'raw':!![]})[_0x3197('0x2d')](handleEntityNotFound(_0x360a26,null))['then'](function(_0x5bb738){if(_0x5bb738){var _0x470512=path[_0x3197('0x52')](config[_0x3197('0x53')],'server/files/plugins',util[_0x3197('0x54')](_0x3197('0x55'),path[_0x3197('0x56')](_0x5bb738[_0x3197('0x51')])));var _0x411f84=fs['createWriteStream'](_0x470512);var _0xc0f1af=archiver(_0x3197('0x57'),{'zlib':{'level':0x9}});_0xc0f1af['on']('warning',function(_0x351ded){if(_0x351ded[_0x3197('0x58')]===_0x3197('0x59')){logger['error'](_0x351ded);}else{throw new db[(_0x3197('0x5a'))][(_0x3197('0x5b'))](_0x3197('0x5c'));}});_0xc0f1af['on'](_0x3197('0x5d'),function(_0x3418ae){throw new db[(_0x3197('0x5a'))][(_0x3197('0x5b'))](_0x3197('0x5c'));});_0xc0f1af[_0x3197('0x5e')](_0x411f84);_0xc0f1af[_0x3197('0x5f')](_0x3197('0x60'),{'cwd':path[_0x3197('0x52')](config[_0x3197('0x53')],_0x3197('0x61'),path[_0x3197('0x62')](_0x5bb738[_0x3197('0x51')])),'ignore':[path[_0x3197('0x52')](path[_0x3197('0x56')](_0x5bb738[_0x3197('0x51')]),_0x3197('0x63')),path[_0x3197('0x52')](path['basename'](_0x5bb738[_0x3197('0x51')]),'attachments/**/*')],'nodir':!![]})[_0x3197('0x64')]();_0x411f84['on'](_0x3197('0x65'),function(){if(!fs['existsSync'](_0x470512)){throw new db['Sequelize']['Error'](_0x3197('0x66'));}return _0x360a26['download'](_0x470512,util[_0x3197('0x54')](_0x3197('0x55'),path[_0x3197('0x56')](_0x5bb738[_0x3197('0x51')])),function(_0x192f02){if(_0x192f02){throw new db[(_0x3197('0x5a'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x3197('0x67')](_0x470512);logger[_0x3197('0x68')](_0x3197('0x69'));logger[_0x3197('0x68')](_0x3197('0x6a'));});});}return null;})['catch'](handleError(_0x360a26,null));};exports[_0x3197('0x6b')]=function(_0x1b32df,_0x339f16,_0x24fe11){var _0x12b41c=path[_0x3197('0x56')](_0x1b32df['file'][_0x3197('0x6c')],path['extname'](_0x1b32df['file'][_0x3197('0x6c')]));var _0x19ffb7=path[_0x3197('0x52')](config[_0x3197('0x53')],_0x3197('0x61'),_0x1b32df[_0x3197('0x6d')]['filename']);var _0x541aac=path[_0x3197('0x52')](config[_0x3197('0x53')],_0x3197('0x61'),_0x12b41c);logger[_0x3197('0x68')](_0x3197('0x6e'),_0x19ffb7);logger[_0x3197('0x68')](_0x3197('0x6f'),_0x541aac);try{fs[_0x3197('0x70')](_0x19ffb7,parseInt(_0x3197('0x71'),0x8));extract(_0x19ffb7,{'dir':_0x541aac},function(_0x18fd94){if(_0x18fd94){logger['error'](_0x18fd94);handleError(_0x18fd94,!![]);};var _0xbd8d63=fs[_0x3197('0x72')](_0x541aac);if(_0xbd8d63[_0x3197('0x3f')]>0x1){removeReferences(_0x19ffb7,_0x541aac);logger['error'](_0x3197('0x73'));return _0x24fe11(new Error(_0x3197('0x73')));}var _0x4c0b25=fs[_0x3197('0x74')](path[_0x3197('0x52')](_0x541aac,_0xbd8d63[0x0]));if(_0x4c0b25[_0x3197('0x75')]()){removeReferences(_0x19ffb7,_0x541aac);logger[_0x3197('0x5d')](_0x3197('0x73'));return _0x24fe11(new Error(_0x3197('0x73')));}if(_0x4c0b25['isDirectory']()){var _0x1ab44d=fs[_0x3197('0x72')](path[_0x3197('0x52')](_0x541aac,_0xbd8d63[0x0]));if(_0x1ab44d[_0x3197('0x3f')]===0x0){removeReferences(_0x19ffb7,_0x541aac);logger['error'](_0x3197('0x73'));return _0x24fe11(new Error('Invalid\x20plugin\x20structure'));}var _0x5d774a=_0x1ab44d[_0x3197('0x76')](function(_0x428962){return _0x428962===_0x3197('0x77');});if(!_0x5d774a){return _0x24fe11(new Error(_0x3197('0x78')));}var _0x34431f=fs[_0x3197('0x79')](path['join'](_0x541aac,_0xbd8d63[0x0],_0x3197('0x77')));var _0x4f93ba=JSON['parse'](_0x34431f);if(_0x3197('0x25')==typeof _0x4f93ba[_0x3197('0x33')]){return _0x24fe11(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x4f93ba[_0x3197('0x37')]){return _0x24fe11(new Error(_0x3197('0x7a')));}if('undefined'==typeof _0x4f93ba[_0x3197('0x7b')]){return _0x24fe11(new Error(_0x3197('0x7c')));}if(_0x3197('0x25')==typeof _0x4f93ba['parameters']){return _0x24fe11(new Error(_0x3197('0x7d')));}if(_0x4f93ba[_0x3197('0x37')]===_0x3197('0x7e')){if(_0x3197('0x25')==typeof _0x4f93ba[_0x3197('0x7f')]['views']){return _0x24fe11(new Error(_0x3197('0x80')));}if(_0x3197('0x25')==typeof _0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')][_0x3197('0x82')]&&'undefined'==typeof _0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')][_0x3197('0x83')]){return _0x24fe11(new Error(_0x3197('0x84')));}}else if(_0x4f93ba[_0x3197('0x37')]===_0x3197('0x85')){if(_0x3197('0x25')==typeof _0x4f93ba[_0x3197('0x7f')][_0x3197('0x86')]){return _0x24fe11(new Error(_0x3197('0x87')));}if(_0x3197('0x25')==typeof _0x4f93ba[_0x3197('0x7f')][_0x3197('0x88')]){return _0x24fe11(new Error(_0x3197('0x89')));}}else{return _0x24fe11(new Error(_0x3197('0x8a')));}var _0x4bce89=_0x4f93ba[_0x3197('0x33')];var _0x4ae996=_0x4f93ba[_0x3197('0x8b')];var _0x1e3ef2=_0x4f93ba[_0x3197('0x37')];var _0x3122f0=_0x4f93ba['sidebar']?_0x4f93ba['sidebar']:_0x3197('0x8c');var _0xc2e0ba=_0x4f93ba[_0x3197('0x8d')]?_0x4f93ba[_0x3197('0x8d')]:_0x3197('0x8e');var _0x32e170='';var _0x1226ea='';var _0x311119='';var _0x57e628='';var _0x2bdd61=_0x4f93ba[_0x3197('0x7b')];if(_0x1e3ef2===_0x3197('0x7e')){if(_0x3197('0x25')!=typeof _0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')]['admin']){var _0x4833b0=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4833b0)){_0x32e170=path[_0x3197('0x52')](_0x3197('0x8f'),_0x12b41c,_0xbd8d63[0x0],_0x4833b0);}else{_0x32e170=_0x4833b0;}}else{logger[_0x3197('0x68')](_0x3197('0x90'));}if(_0x3197('0x25')!=typeof _0x4f93ba[_0x3197('0x7f')]['views'][_0x3197('0x83')]){var _0x3602ad=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')][_0x3197('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x3197('0x91')](_0x3602ad)){_0x1226ea=path[_0x3197('0x52')](_0x3197('0x8f'),_0x12b41c,_0xbd8d63[0x0],_0x3602ad);}else{_0x1226ea=_0x3602ad;}}else{logger[_0x3197('0x68')](_0x3197('0x92'));}}else if(_0x1e3ef2===_0x3197('0x85')){_0x311119=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x86')];_0x57e628=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x88')];if('undefined'!=typeof _0x4f93ba['parameters'][_0x3197('0x81')]){if(_0x3197('0x25')!=typeof _0x4f93ba['parameters'][_0x3197('0x81')][_0x3197('0x82')]){var _0x4833b0=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')][_0x3197('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x3197('0x91')](_0x4833b0)){_0x32e170=path[_0x3197('0x52')](_0x3197('0x8f'),_0x12b41c,_0xbd8d63[0x0],_0x4833b0);}else{_0x32e170=_0x4833b0;}}if(_0x3197('0x25')!=typeof _0x4f93ba[_0x3197('0x7f')]['views'][_0x3197('0x83')]){var _0x3602ad=_0x4f93ba[_0x3197('0x7f')][_0x3197('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3197('0x91')](_0x3602ad)){_0x1226ea=path[_0x3197('0x52')](_0x3197('0x8f'),_0x12b41c,_0xbd8d63[0x0],_0x3602ad);}else{_0x1226ea=_0x3602ad;}}}}var _0x34eb57={'name':_0x4bce89,'description':_0x4ae996,'path':path[_0x3197('0x52')](_0x12b41c,_0xbd8d63[0x0]),'type':_0x1e3ef2,'sidebar':_0x3122f0,'icon':_0xc2e0ba,'adminUrl':_0x32e170,'agentUrl':_0x1226ea,'scriptName':_0x311119,'scriptPath':_0x57e628,'version':_0x2bdd61};removeReferences(_0x19ffb7,null);return db[_0x3197('0x35')][_0x3197('0x93')](_0x34eb57)[_0x3197('0x2d')](function(_0x51a55b){var _0x1a6920={'role':_0x1b32df[_0x3197('0x94')][_0x3197('0x95')],'userProfileId':_0x1b32df[_0x3197('0x94')][_0x3197('0x96')]};if(!_0x1a6920)throw new Error(_0x3197('0x97'));if(_0x1a6920[_0x3197('0x95')]===_0x3197('0x98')){var _0x53f539=_0x51a55b[_0x3197('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x3197('0x50')]({'where':{'name':_0x3197('0x2f'),'userProfileId':_0x1a6920[_0x3197('0x96')]},'raw':!![]})[_0x3197('0x2d')](function(_0x5848a5){if(_0x5848a5&&_0x5848a5[_0x3197('0x99')]===0x0){return db[_0x3197('0x30')][_0x3197('0x93')]({'name':_0x53f539['name'],'resourceId':_0x53f539['id'],'type':_0x5848a5['name'],'sectionId':_0x5848a5['id']},{})[_0x3197('0x2d')](function(){return _0x51a55b;});}else{return _0x51a55b;}})['catch'](function(_0x4951ef){logger[_0x3197('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4951ef);throw _0x4951ef;});}return _0x51a55b;})['then'](respondWithResult(_0x339f16,null))[_0x3197('0x4d')](handleError(_0x339f16,null));}});}catch(_0x2c8cb5){_0x339f16[_0x3197('0x23')](0x1f4)[_0x3197('0x9a')](_0x2c8cb5);}};function removeReferences(_0x4499c7,_0x513227){try{if(_0x4499c7){fs[_0x3197('0x67')](_0x4499c7);logger[_0x3197('0x68')]('Zip\x20archive\x20removed');}if(_0x513227){rimraf(_0x513227,function(){});logger[_0x3197('0x68')](_0x3197('0x9b'));}}catch(_0x5110fb){logger[_0x3197('0x5d')](_0x5110fb);}}exports['update']=function(_0x1a8e03,_0xb67088,_0x54d8ab){return db['Plugin'][_0x3197('0x50')]({'where':{'id':_0x1a8e03[_0x3197('0x9c')]['id']}})[_0x3197('0x2d')](handleEntityNotFound(_0xb67088,null))[_0x3197('0x2d')](saveUpdates(_0x1a8e03[_0x3197('0x94')],null))['then'](respondWithResult(_0xb67088,null))[_0x3197('0x4d')](handleError(_0xb67088,null));};exports[_0x3197('0x9d')]=function(_0x7e0c02,_0x366366,_0x2684ef){return db[_0x3197('0x35')][_0x3197('0x50')]({'where':{'id':_0x7e0c02['params']['id']}})[_0x3197('0x2d')](function(_0x2e4a1c){if(_0x2e4a1c){return _0x2e4a1c[_0x3197('0x31')]();}})[_0x3197('0x2d')](function(_0x3f40d3){rimraf(path['join'](config[_0x3197('0x53')],_0x3197('0x61'),path[_0x3197('0x62')](_0x3f40d3[_0x3197('0x51')])),function(){});return _0x3f40d3;})['then'](handleEntityNotFound(_0x366366,null))['then'](respondWithStatusCode(_0x366366,null))['catch'](handleError(_0x366366,null));};exports[_0x3197('0x9e')]=function(_0x1384fb,_0x596559,_0x37ec7b){return BPromise[_0x3197('0x9f')]()['then'](function(){if(!_0x1384fb[_0x3197('0x3a')][_0x3197('0x51')]){throw new Error(_0x3197('0xa0'));}if(!_0x1384fb[_0x3197('0x3a')][_0x3197('0xa1')]){throw new Error(_0x3197('0xa2'));}var _0x3e463a=_0x1384fb[_0x3197('0x3a')][_0x3197('0xa3')]?_0x1384fb['query'][_0x3197('0xa3')]+':'+_0x1384fb[_0x3197('0x3a')][_0x3197('0xa1')]:_0x3197('0xa4')+_0x1384fb[_0x3197('0x3a')]['port'];var _0x36077e=_0x1384fb[_0x3197('0x3a')][_0x3197('0x28')]?_0x1384fb['query'][_0x3197('0x28')]:!![];var _0x559561=_0x1384fb['query'][_0x3197('0xa5')]?_0x1384fb[_0x3197('0x3a')][_0x3197('0xa5')]:null;var _0x54b80b={'method':_0x1384fb[_0x3197('0xa6')],'uri':util[_0x3197('0x54')](_0x3197('0xa7'),_0x3e463a,_0x1384fb[_0x3197('0x3a')]['path']),'json':_0x36077e,'resolveWithFullResponse':!![],'encoding':_0x559561,'qs':_0x1384fb[_0x3197('0x3a')]};if(_0x1384fb[_0x3197('0xa8')]){_0x54b80b[_0x3197('0xa8')]=_0x1384fb['headers'];if(_0x54b80b[_0x3197('0xa8')][_0x3197('0xa9')]){delete _0x54b80b['headers'][_0x3197('0xa9')];}}if(_0x54b80b[_0x3197('0xa8')][_0x3197('0xaa')]){delete _0x54b80b[_0x3197('0xa8')][_0x3197('0xaa')];}return rp(_0x54b80b);})[_0x3197('0x2d')](function(_0x39feb5){if(_0x39feb5){_0x596559[_0x3197('0x26')](_0x39feb5[_0x3197('0xa8')]);logger['info'](_0x39feb5[_0x3197('0x94')]);if(_[_0x3197('0xab')](_0x1384fb['query'][_0x3197('0x51')],_0x3197('0xac'))&&_0x39feb5[_0x3197('0xad')]==0x1f4){return _0x596559[_0x3197('0x22')](_0x39feb5['statusCode']);}else{return _0x596559[_0x3197('0x23')](_0x39feb5[_0x3197('0xad')])['send'](_0x39feb5[_0x3197('0x94')]);}}else{return _0x596559['sendStatus'](0xc8);}})['catch'](handleError(_0x596559,null));};exports['webhookPost']=function(_0x13d658,_0x339506,_0x312caf){return BPromise['resolve']()[_0x3197('0x2d')](function(){if(!_0x13d658[_0x3197('0x3a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x13d658[_0x3197('0x3a')][_0x3197('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x22663b=_0x13d658[_0x3197('0x3a')][_0x3197('0xa3')]?_0x13d658[_0x3197('0x3a')][_0x3197('0xa3')]+':'+_0x13d658[_0x3197('0x3a')]['port']:_0x3197('0xa4')+_0x13d658[_0x3197('0x3a')][_0x3197('0xa1')];var _0x41f1f9=_0x13d658[_0x3197('0x3a')][_0x3197('0x28')]?_0x13d658['query'][_0x3197('0x28')]:!![];var _0x31688a=_0x13d658[_0x3197('0x3a')][_0x3197('0xa5')]?_0x13d658[_0x3197('0x3a')][_0x3197('0xa5')]:null;var _0x140277={'method':_0x13d658[_0x3197('0xa6')],'uri':util[_0x3197('0x54')](_0x3197('0xa7'),_0x22663b,_0x13d658[_0x3197('0x3a')]['path']),'json':_0x41f1f9,'resolveWithFullResponse':!![],'encoding':_0x31688a,'body':_0x13d658[_0x3197('0x94')]};if(_0x13d658[_0x3197('0xa8')]){_0x140277[_0x3197('0xa8')]=_0x13d658['headers'];if(_0x140277['headers']['content-length']){delete _0x140277['headers'][_0x3197('0xa9')];}}if(_0x140277['headers']['content-type']){delete _0x140277[_0x3197('0xa8')][_0x3197('0xaa')];}return rp(_0x140277);})[_0x3197('0x2d')](function(_0x12de03){if(_0x12de03){_0x339506[_0x3197('0x26')](_0x12de03[_0x3197('0xa8')]);logger[_0x3197('0x68')](_0x12de03['body']);return _0x339506['status'](_0x12de03[_0x3197('0xad')])[_0x3197('0x9a')](_0x12de03[_0x3197('0x94')]);}else{return _0x339506[_0x3197('0x22')](0xc8);}})[_0x3197('0x4d')](handleError(_0x339506,null));}; \ No newline at end of file +var _0xc5fd=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','root','server/files/plugins','format','basename','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','**/*','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc5fd,0x1f3));var _0xdc5f=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0xc5fd[_0x59ee41];return _0x3ecd3e;};'use strict';var emlformat=require(_0xdc5f('0x0'));var rimraf=require(_0xdc5f('0x1'));var zipdir=require(_0xdc5f('0x2'));var jsonpatch=require(_0xdc5f('0x3'));var rp=require(_0xdc5f('0x4'));var moment=require(_0xdc5f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc5f('0x6'));var util=require('util');var path=require(_0xdc5f('0x7'));var sox=require(_0xdc5f('0x8'));var csv=require(_0xdc5f('0x9'));var ejs=require(_0xdc5f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdc5f('0xb'));var crypto=require(_0xdc5f('0xc'));var jsforce=require(_0xdc5f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdc5f('0x9'));var querystring=require('querystring');var Papa=require(_0xdc5f('0xe'));var extract=require(_0xdc5f('0xf'));var rimraf=require(_0xdc5f('0x1'));var archiver=require(_0xdc5f('0x10'));var Redis=require(_0xdc5f('0x11'));var authService=require(_0xdc5f('0x12'));var qs=require(_0xdc5f('0x13'));var as=require(_0xdc5f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc5f('0x15'))('api');var utils=require(_0xdc5f('0x16'));var config=require(_0xdc5f('0x17'));var licenseUtil=require(_0xdc5f('0x18'));var db=require(_0xdc5f('0x19'))['db'];config[_0xdc5f('0x1a')]=_[_0xdc5f('0x1b')](config[_0xdc5f('0x1a')],{'host':_0xdc5f('0x1c'),'port':0x18eb});var socket=require(_0xdc5f('0x1d'))(new Redis(config['redis']));require('./plugin.socket')[_0xdc5f('0x1e')](socket);function respondWithStatusCode(_0x24cf38,_0x37ec89){_0x37ec89=_0x37ec89||0xcc;return function(_0x11318e){if(_0x11318e){return _0x24cf38[_0xdc5f('0x1f')](_0x37ec89);}return _0x24cf38['status'](_0x37ec89)[_0xdc5f('0x20')]();};}function respondWithResult(_0x35ea77,_0x557c6a){_0x557c6a=_0x557c6a||0xc8;return function(_0x3d8a42){if(_0x3d8a42){return _0x35ea77[_0xdc5f('0x21')](_0x557c6a)[_0xdc5f('0x22')](_0x3d8a42);}};}function respondWithFilteredResult(_0xf0ee82,_0x348af1){return function(_0x1c8728){if(_0x1c8728){var _0x42e346=typeof _0x348af1[_0xdc5f('0x23')]===_0xdc5f('0x24')&&typeof _0x348af1[_0xdc5f('0x25')]===_0xdc5f('0x24');var _0x5d801e=_0x1c8728[_0xdc5f('0x26')];var _0x2a1710=_0x42e346?0x0:_0x348af1[_0xdc5f('0x23')];var _0x381b3f=_0x42e346?_0x1c8728[_0xdc5f('0x26')]:_0x348af1[_0xdc5f('0x23')]+_0x348af1[_0xdc5f('0x25')];var _0x14a6fa;if(_0x381b3f>=_0x5d801e){_0x381b3f=_0x5d801e;_0x14a6fa=0xc8;}else{_0x14a6fa=0xce;}_0xf0ee82['status'](_0x14a6fa);return _0xf0ee82['set'](_0xdc5f('0x27'),_0x2a1710+'-'+_0x381b3f+'/'+_0x5d801e)[_0xdc5f('0x22')](_0x1c8728);}return null;};}function patchUpdates(_0x190ca2){return function(_0x493073){try{jsonpatch[_0xdc5f('0x28')](_0x493073,_0x190ca2,!![]);}catch(_0x3f6f63){return BPromise[_0xdc5f('0x29')](_0x3f6f63);}return _0x493073[_0xdc5f('0x2a')]();};}function saveUpdates(_0x38b499,_0x5cd7f3){return function(_0x273ca9){if(_0x273ca9){return _0x273ca9[_0xdc5f('0x2b')](_0x38b499)[_0xdc5f('0x2c')](function(_0x5d36fe){return _0x5d36fe;});}return null;};}function removeEntity(_0x1ef0be,_0x519929){return function(_0x25bb42){if(_0x25bb42){return _0x25bb42[_0xdc5f('0x2d')]()[_0xdc5f('0x2c')](function(){var _0x313005=_0x25bb42[_0xdc5f('0x2e')]({'plain':!![]});var _0x5872fc=_0xdc5f('0x2f');return db[_0xdc5f('0x30')][_0xdc5f('0x2d')]({'where':{'type':_0x5872fc,'resourceId':_0x313005['id']}})['then'](function(){return _0x25bb42;});})[_0xdc5f('0x2c')](function(){_0x1ef0be[_0xdc5f('0x21')](0xcc)[_0xdc5f('0x20')]();});}};}function handleEntityNotFound(_0x2ad8a4,_0xc17c36){return function(_0x541b24){if(!_0x541b24){_0x2ad8a4[_0xdc5f('0x1f')](0x194);}return _0x541b24;};}function handleError(_0x28cab5,_0x348295){_0x348295=_0x348295||0x1f4;return function(_0xd6888b){logger[_0xdc5f('0x31')](_0xd6888b[_0xdc5f('0x32')]);if(_0xd6888b['name']){delete _0xd6888b[_0xdc5f('0x33')];}_0x28cab5[_0xdc5f('0x21')](_0x348295)['send'](_0xd6888b);};}exports[_0xdc5f('0x34')]=function(_0x2fc3c3,_0x1215a7){var _0x117387={},_0x5a522d={},_0x17d158={'count':0x0,'rows':[]};var _0x35d729=_[_0xdc5f('0x35')](db[_0xdc5f('0x36')][_0xdc5f('0x37')],function(_0x45b836){return{'name':_0x45b836[_0xdc5f('0x38')],'type':_0x45b836['type']['key']};});_0x5a522d[_0xdc5f('0x39')]=_[_0xdc5f('0x35')](_0x35d729,'name');_0x5a522d['query']=_['keys'](_0x2fc3c3['query']);_0x5a522d['filters']=_['intersection'](_0x5a522d[_0xdc5f('0x39')],_0x5a522d[_0xdc5f('0x3a')]);_0x117387['attributes']=_[_0xdc5f('0x3b')](_0x5a522d['model'],qs[_0xdc5f('0x3c')](_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x3c')]));_0x117387[_0xdc5f('0x3d')]=_0x117387['attributes'][_0xdc5f('0x3e')]?_0x117387['attributes']:_0x5a522d[_0xdc5f('0x39')];if(!_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x3f')](_0xdc5f('0x40'))){_0x117387['limit']=qs[_0xdc5f('0x25')](_0x2fc3c3['query'][_0xdc5f('0x25')]);_0x117387[_0xdc5f('0x23')]=qs[_0xdc5f('0x23')](_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x23')]);}_0x117387[_0xdc5f('0x41')]=qs[_0xdc5f('0x42')](_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x42')]);_0x117387[_0xdc5f('0x43')]=qs[_0xdc5f('0x44')](_[_0xdc5f('0x45')](_0x2fc3c3[_0xdc5f('0x3a')],_0x5a522d[_0xdc5f('0x44')]),_0x35d729);if(_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x46')]){_0x117387[_0xdc5f('0x43')]=_[_0xdc5f('0x47')](_0x117387[_0xdc5f('0x43')],{'$or':_[_0xdc5f('0x35')](_0x35d729,function(_0x4e9c78){if(_0x4e9c78[_0xdc5f('0x48')]!=='VIRTUAL'){var _0x178c42={};_0x178c42[_0x4e9c78['name']]={'$like':'%'+_0x2fc3c3[_0xdc5f('0x3a')]['filter']+'%'};return _0x178c42;}})});}_0x117387=_['merge']({},_0x117387,_0x2fc3c3[_0xdc5f('0x49')]);var _0x448a2d={'where':_0x117387['where']};return db[_0xdc5f('0x36')][_0xdc5f('0x26')](_0x448a2d)[_0xdc5f('0x2c')](function(_0x5af43c){_0x17d158[_0xdc5f('0x26')]=_0x5af43c;if(_0x2fc3c3[_0xdc5f('0x3a')][_0xdc5f('0x4a')]){_0x117387[_0xdc5f('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0xdc5f('0x4c')](_0x117387);})[_0xdc5f('0x2c')](function(_0x33fb59){_0x17d158[_0xdc5f('0x4d')]=_0x33fb59;return _0x17d158;})[_0xdc5f('0x2c')](respondWithFilteredResult(_0x1215a7,_0x117387))[_0xdc5f('0x4e')](handleError(_0x1215a7,null));};exports[_0xdc5f('0x4f')]=function(_0xfbef5d,_0xd45e26){var _0x4b47cf={'raw':!![],'where':{'id':_0xfbef5d[_0xdc5f('0x50')]['id']}},_0x279e2a={};_0x279e2a[_0xdc5f('0x39')]=_[_0xdc5f('0x51')](db['Plugin'][_0xdc5f('0x37')]);_0x279e2a[_0xdc5f('0x3a')]=_['keys'](_0xfbef5d['query']);_0x279e2a[_0xdc5f('0x44')]=_['intersection'](_0x279e2a[_0xdc5f('0x39')],_0x279e2a['query']);_0x4b47cf[_0xdc5f('0x3d')]=_[_0xdc5f('0x3b')](_0x279e2a['model'],qs['fields'](_0xfbef5d[_0xdc5f('0x3a')]['fields']));_0x4b47cf[_0xdc5f('0x3d')]=_0x4b47cf[_0xdc5f('0x3d')][_0xdc5f('0x3e')]?_0x4b47cf[_0xdc5f('0x3d')]:_0x279e2a[_0xdc5f('0x39')];if(_0xfbef5d[_0xdc5f('0x3a')][_0xdc5f('0x4a')]){_0x4b47cf[_0xdc5f('0x4b')]=[{'all':!![]}];}_0x4b47cf=_[_0xdc5f('0x47')]({},_0x4b47cf,_0xfbef5d[_0xdc5f('0x49')]);return db[_0xdc5f('0x36')][_0xdc5f('0x52')](_0x4b47cf)['then'](handleEntityNotFound(_0xd45e26,null))[_0xdc5f('0x2c')](respondWithResult(_0xd45e26,null))['catch'](handleError(_0xd45e26,null));};exports[_0xdc5f('0x53')]=function(_0x57b5e6,_0x5056c6,_0x15c0e6){return db[_0xdc5f('0x36')][_0xdc5f('0x52')]({'where':{'id':_0x57b5e6[_0xdc5f('0x50')]['id']},'attributes':[_0xdc5f('0x33'),'path'],'raw':!![]})[_0xdc5f('0x2c')](handleEntityNotFound(_0x5056c6,null))['then'](function(_0x33c0a4){if(_0x33c0a4){var _0xd62144=path[_0xdc5f('0x54')](config[_0xdc5f('0x55')],_0xdc5f('0x56'),util[_0xdc5f('0x57')]('%s.zip',path[_0xdc5f('0x58')](_0x33c0a4[_0xdc5f('0x7')])));var _0x2cc604=fs['createWriteStream'](_0xd62144);var _0x3e2ef2=archiver('zip',{'zlib':{'level':0x9}});_0x3e2ef2['on']('warning',function(_0x481895){if(_0x481895[_0xdc5f('0x59')]===_0xdc5f('0x5a')){logger[_0xdc5f('0x31')](_0x481895);}else{throw new db[(_0xdc5f('0x5b'))]['Error'](_0xdc5f('0x5c'));}});_0x3e2ef2['on'](_0xdc5f('0x31'),function(_0x12daef){throw new db[(_0xdc5f('0x5b'))][(_0xdc5f('0x5d'))](_0xdc5f('0x5c'));});_0x3e2ef2['pipe'](_0x2cc604);_0x3e2ef2['glob'](_0xdc5f('0x5e'),{'cwd':path[_0xdc5f('0x54')](config[_0xdc5f('0x55')],_0xdc5f('0x56'),path[_0xdc5f('0x5f')](_0x33c0a4[_0xdc5f('0x7')])),'ignore':[path[_0xdc5f('0x54')](path[_0xdc5f('0x58')](_0x33c0a4['path']),_0xdc5f('0x60')),path[_0xdc5f('0x54')](path[_0xdc5f('0x58')](_0x33c0a4[_0xdc5f('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x2cc604['on'](_0xdc5f('0x61'),function(){if(!fs[_0xdc5f('0x62')](_0xd62144)){throw new db[(_0xdc5f('0x5b'))][(_0xdc5f('0x5d'))](_0xdc5f('0x63'));}return _0x5056c6[_0xdc5f('0x53')](_0xd62144,util['format'](_0xdc5f('0x64'),path[_0xdc5f('0x58')](_0x33c0a4[_0xdc5f('0x7')])),function(_0x5a6efb){if(_0x5a6efb){throw new db[(_0xdc5f('0x5b'))][(_0xdc5f('0x5d'))](_0xdc5f('0x65'));}fs[_0xdc5f('0x66')](_0xd62144);logger['info'](_0xdc5f('0x67'));logger[_0xdc5f('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x5056c6,null));};exports[_0xdc5f('0x69')]=function(_0x422f7d,_0x2703cd,_0x2f3a7e){var _0x24b02e=path[_0xdc5f('0x58')](_0x422f7d['file'][_0xdc5f('0x6a')],path['extname'](_0x422f7d['file'][_0xdc5f('0x6a')]));var _0x20851b=path['join'](config['root'],_0xdc5f('0x56'),_0x422f7d[_0xdc5f('0x6b')]['filename']);var _0x448af3=path[_0xdc5f('0x54')](config[_0xdc5f('0x55')],_0xdc5f('0x56'),_0x24b02e);logger[_0xdc5f('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x20851b);logger[_0xdc5f('0x68')](_0xdc5f('0x6c'),_0x448af3);try{fs[_0xdc5f('0x6d')](_0x20851b,parseInt(_0xdc5f('0x6e'),0x8));extract(_0x20851b,{'dir':_0x448af3},function(_0x289fd9){if(_0x289fd9){logger[_0xdc5f('0x31')](_0x289fd9);handleError(_0x289fd9,!![]);};var _0x1e005c=fs[_0xdc5f('0x6f')](_0x448af3);if(_0x1e005c['length']>0x1){removeReferences(_0x20851b,_0x448af3);logger['error'](_0xdc5f('0x70'));return _0x2f3a7e(new Error(_0xdc5f('0x70')));}var _0xbb1e87=fs[_0xdc5f('0x71')](path['join'](_0x448af3,_0x1e005c[0x0]));if(_0xbb1e87[_0xdc5f('0x72')]()){removeReferences(_0x20851b,_0x448af3);logger[_0xdc5f('0x31')]('Invalid\x20plugin\x20structure');return _0x2f3a7e(new Error('Invalid\x20plugin\x20structure'));}if(_0xbb1e87[_0xdc5f('0x73')]()){var _0x1427b7=fs[_0xdc5f('0x6f')](path['join'](_0x448af3,_0x1e005c[0x0]));if(_0x1427b7[_0xdc5f('0x3e')]===0x0){removeReferences(_0x20851b,_0x448af3);logger[_0xdc5f('0x31')](_0xdc5f('0x70'));return _0x2f3a7e(new Error(_0xdc5f('0x70')));}var _0x30b302=_0x1427b7[_0xdc5f('0x74')](function(_0x362c89){return _0x362c89==='manifest.json';});if(!_0x30b302){return _0x2f3a7e(new Error(_0xdc5f('0x75')));}var _0x1b6ca6=fs[_0xdc5f('0x76')](path['join'](_0x448af3,_0x1e005c[0x0],_0xdc5f('0x77')));var _0x30ae0f=JSON['parse'](_0x1b6ca6);if('undefined'==typeof _0x30ae0f[_0xdc5f('0x33')]){return _0x2f3a7e(new Error(_0xdc5f('0x78')));}if(_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x48')]){return _0x2f3a7e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x79')]){return _0x2f3a7e(new Error(_0xdc5f('0x7a')));}if(_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x7b')]){return _0x2f3a7e(new Error(_0xdc5f('0x7c')));}if(_0x30ae0f['type']===_0xdc5f('0x7d')){if(_0xdc5f('0x24')==typeof _0x30ae0f['parameters'][_0xdc5f('0x7e')]){return _0x2f3a7e(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')][_0xdc5f('0x7f')]&&_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')][_0xdc5f('0x80')]){return _0x2f3a7e(new Error(_0xdc5f('0x81')));}}else if(_0x30ae0f[_0xdc5f('0x48')]===_0xdc5f('0x82')){if(_0xdc5f('0x24')==typeof _0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x83')]){return _0x2f3a7e(new Error(_0xdc5f('0x84')));}if(_0xdc5f('0x24')==typeof _0x30ae0f['parameters'][_0xdc5f('0x85')]){return _0x2f3a7e(new Error(_0xdc5f('0x86')));}}else{return _0x2f3a7e(new Error(_0xdc5f('0x87')));}var _0x2819a9=_0x30ae0f[_0xdc5f('0x33')];var _0x21406a=_0x30ae0f['description'];var _0x126b3a=_0x30ae0f[_0xdc5f('0x48')];var _0x58c42a=_0x30ae0f[_0xdc5f('0x88')]?_0x30ae0f[_0xdc5f('0x88')]:_0xdc5f('0x89');var _0x45adf4=_0x30ae0f['icon']?_0x30ae0f[_0xdc5f('0x8a')]:_0xdc5f('0x8b');var _0x148e75='';var _0x2bbddf='';var _0x54a8bc='';var _0x450c50='';var _0x2dafed=_0x30ae0f['version'];if(_0x126b3a===_0xdc5f('0x7d')){if(_0xdc5f('0x24')!=typeof _0x30ae0f[_0xdc5f('0x7b')]['views']['admin']){var _0xc5ae81=_0x30ae0f['parameters'][_0xdc5f('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xdc5f('0x8c')](_0xc5ae81)){_0x148e75=path[_0xdc5f('0x54')](_0xdc5f('0x8d'),_0x24b02e,_0x1e005c[0x0],_0xc5ae81);}else{_0x148e75=_0xc5ae81;}}else{logger[_0xdc5f('0x68')](_0xdc5f('0x8e'));}if('undefined'!=typeof _0x30ae0f[_0xdc5f('0x7b')]['views'][_0xdc5f('0x80')]){var _0x3cfb1f=_0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xdc5f('0x8c')](_0x3cfb1f)){_0x2bbddf=path[_0xdc5f('0x54')](_0xdc5f('0x8d'),_0x24b02e,_0x1e005c[0x0],_0x3cfb1f);}else{_0x2bbddf=_0x3cfb1f;}}else{logger[_0xdc5f('0x68')](_0xdc5f('0x8f'));}}else if(_0x126b3a===_0xdc5f('0x82')){_0x54a8bc=_0x30ae0f[_0xdc5f('0x7b')]['scriptName'];_0x450c50=_0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x85')];if(_0xdc5f('0x24')!=typeof _0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')]){if(_0xdc5f('0x24')!=typeof _0x30ae0f['parameters']['views'][_0xdc5f('0x7f')]){var _0xc5ae81=_0x30ae0f['parameters'][_0xdc5f('0x7e')][_0xdc5f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xdc5f('0x8c')](_0xc5ae81)){_0x148e75=path[_0xdc5f('0x54')]('plugins',_0x24b02e,_0x1e005c[0x0],_0xc5ae81);}else{_0x148e75=_0xc5ae81;}}if('undefined'!=typeof _0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')][_0xdc5f('0x80')]){var _0x3cfb1f=_0x30ae0f[_0xdc5f('0x7b')][_0xdc5f('0x7e')][_0xdc5f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xdc5f('0x8c')](_0x3cfb1f)){_0x2bbddf=path['join']('plugins',_0x24b02e,_0x1e005c[0x0],_0x3cfb1f);}else{_0x2bbddf=_0x3cfb1f;}}}}var _0x1be5f2={'name':_0x2819a9,'description':_0x21406a,'path':path[_0xdc5f('0x54')](_0x24b02e,_0x1e005c[0x0]),'type':_0x126b3a,'sidebar':_0x58c42a,'icon':_0x45adf4,'adminUrl':_0x148e75,'agentUrl':_0x2bbddf,'scriptName':_0x54a8bc,'scriptPath':_0x450c50,'version':_0x2dafed};removeReferences(_0x20851b,null);return db[_0xdc5f('0x36')][_0xdc5f('0x90')](_0x1be5f2)['then'](function(_0x5c025e){var _0x4259b9={'role':_0x422f7d[_0xdc5f('0x91')][_0xdc5f('0x92')],'userProfileId':_0x422f7d[_0xdc5f('0x91')][_0xdc5f('0x93')]};if(!_0x4259b9)throw new Error(_0xdc5f('0x94'));if(_0x4259b9[_0xdc5f('0x92')]===_0xdc5f('0x95')){var _0x240f2b=_0x5c025e['get']({'plain':!![]});return db[_0xdc5f('0x96')][_0xdc5f('0x52')]({'where':{'name':_0xdc5f('0x2f'),'userProfileId':_0x4259b9['userProfileId']},'raw':!![]})[_0xdc5f('0x2c')](function(_0x35305f){if(_0x35305f&&_0x35305f[_0xdc5f('0x97')]===0x0){return db[_0xdc5f('0x30')][_0xdc5f('0x90')]({'name':_0x240f2b[_0xdc5f('0x33')],'resourceId':_0x240f2b['id'],'type':_0x35305f[_0xdc5f('0x33')],'sectionId':_0x35305f['id']},{})[_0xdc5f('0x2c')](function(){return _0x5c025e;});}else{return _0x5c025e;}})[_0xdc5f('0x4e')](function(_0x2fe5f9){logger[_0xdc5f('0x31')](_0xdc5f('0x98'),_0x2fe5f9);throw _0x2fe5f9;});}return _0x5c025e;})['then'](respondWithResult(_0x2703cd,null))['catch'](handleError(_0x2703cd,null));}});}catch(_0x50f7b1){_0x2703cd[_0xdc5f('0x21')](0x1f4)[_0xdc5f('0x99')](_0x50f7b1);}};function removeReferences(_0x182aa5,_0x361518){try{if(_0x182aa5){fs[_0xdc5f('0x66')](_0x182aa5);logger[_0xdc5f('0x68')](_0xdc5f('0x9a'));}if(_0x361518){rimraf(_0x361518,function(){});logger[_0xdc5f('0x68')](_0xdc5f('0x9b'));}}catch(_0x47cdf9){logger[_0xdc5f('0x31')](_0x47cdf9);}}exports[_0xdc5f('0x2b')]=function(_0x3d16a7,_0x1c8e82,_0x1cc711){return db[_0xdc5f('0x36')][_0xdc5f('0x52')]({'where':{'id':_0x3d16a7['params']['id']}})['then'](handleEntityNotFound(_0x1c8e82,null))[_0xdc5f('0x2c')](saveUpdates(_0x3d16a7['body'],null))['then'](respondWithResult(_0x1c8e82,null))[_0xdc5f('0x4e')](handleError(_0x1c8e82,null));};exports[_0xdc5f('0x9c')]=function(_0x5bc5d8,_0x361a5b,_0xda7dd7){return db[_0xdc5f('0x36')][_0xdc5f('0x52')]({'where':{'id':_0x5bc5d8[_0xdc5f('0x50')]['id']}})[_0xdc5f('0x2c')](function(_0x16d98d){if(_0x16d98d){return _0x16d98d[_0xdc5f('0x2d')]();}})[_0xdc5f('0x2c')](function(_0x528957){rimraf(path[_0xdc5f('0x54')](config[_0xdc5f('0x55')],_0xdc5f('0x56'),path[_0xdc5f('0x5f')](_0x528957[_0xdc5f('0x7')])),function(){});return _0x528957;})[_0xdc5f('0x2c')](handleEntityNotFound(_0x361a5b,null))[_0xdc5f('0x2c')](respondWithStatusCode(_0x361a5b,null))['catch'](handleError(_0x361a5b,null));};exports[_0xdc5f('0x9d')]=function(_0x4ca1b5,_0x2091a5,_0x35a5ea){return BPromise[_0xdc5f('0x9e')]()[_0xdc5f('0x2c')](function(){if(!_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x9f')]){throw new Error(_0xdc5f('0xa0'));}var _0x36a86a=_0x4ca1b5['query'][_0xdc5f('0xa1')]?_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0xa1')]+':'+_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x9f')]:_0xdc5f('0xa2')+_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x9f')];var _0x1008c0=_0x4ca1b5[_0xdc5f('0x3a')]['json']?_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x22')]:!![];var _0x2a972b=_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0xa3')]?_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0xa3')]:null;var _0x40fcd7={'method':_0x4ca1b5[_0xdc5f('0xa4')],'uri':util[_0xdc5f('0x57')](_0xdc5f('0xa5'),_0x36a86a,_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x7')]),'json':_0x1008c0,'resolveWithFullResponse':!![],'encoding':_0x2a972b,'qs':_0x4ca1b5[_0xdc5f('0x3a')]};if(_0x4ca1b5[_0xdc5f('0xa6')]){_0x40fcd7[_0xdc5f('0xa6')]=_0x4ca1b5[_0xdc5f('0xa6')];if(_0x40fcd7[_0xdc5f('0xa6')][_0xdc5f('0xa7')]){delete _0x40fcd7[_0xdc5f('0xa6')][_0xdc5f('0xa7')];}}if(_0x40fcd7[_0xdc5f('0xa6')][_0xdc5f('0xa8')]){delete _0x40fcd7['headers'][_0xdc5f('0xa8')];}return rp(_0x40fcd7);})[_0xdc5f('0x2c')](function(_0x5f8543){if(_0x5f8543){_0x2091a5[_0xdc5f('0xa9')](_0x5f8543[_0xdc5f('0xa6')]);logger['info'](_0x5f8543[_0xdc5f('0x91')]);if(_[_0xdc5f('0xaa')](_0x4ca1b5[_0xdc5f('0x3a')][_0xdc5f('0x7')],'download')&&_0x5f8543[_0xdc5f('0xab')]==0x1f4){return _0x2091a5['sendStatus'](_0x5f8543[_0xdc5f('0xab')]);}else{return _0x2091a5['status'](_0x5f8543['statusCode'])[_0xdc5f('0x99')](_0x5f8543[_0xdc5f('0x91')]);}}else{return _0x2091a5[_0xdc5f('0x1f')](0xc8);}})[_0xdc5f('0x4e')](handleError(_0x2091a5,null));};exports[_0xdc5f('0xac')]=function(_0x205693,_0x23ca10,_0x37bfb1){return BPromise[_0xdc5f('0x9e')]()[_0xdc5f('0x2c')](function(){if(!_0x205693[_0xdc5f('0x3a')]['path']){throw new Error(_0xdc5f('0xad'));}if(!_0x205693[_0xdc5f('0x3a')][_0xdc5f('0x9f')]){throw new Error(_0xdc5f('0xa0'));}var _0x384e11=_0x205693[_0xdc5f('0x3a')][_0xdc5f('0xa1')]?_0x205693[_0xdc5f('0x3a')][_0xdc5f('0xa1')]+':'+_0x205693['query'][_0xdc5f('0x9f')]:_0xdc5f('0xa2')+_0x205693['query'][_0xdc5f('0x9f')];var _0x54d54c=_0x205693[_0xdc5f('0x3a')][_0xdc5f('0x22')]?_0x205693['query'][_0xdc5f('0x22')]:!![];var _0x514d6b=_0x205693[_0xdc5f('0x3a')][_0xdc5f('0xa3')]?_0x205693['query']['encoding']:null;var _0x559a10={'method':_0x205693[_0xdc5f('0xa4')],'uri':util['format'](_0xdc5f('0xa5'),_0x384e11,_0x205693[_0xdc5f('0x3a')]['path']),'json':_0x54d54c,'resolveWithFullResponse':!![],'encoding':_0x514d6b,'body':_0x205693[_0xdc5f('0x91')]};if(_0x205693[_0xdc5f('0xa6')]){_0x559a10['headers']=_0x205693[_0xdc5f('0xa6')];if(_0x559a10['headers'][_0xdc5f('0xa7')]){delete _0x559a10['headers']['content-length'];}}if(_0x559a10['headers'][_0xdc5f('0xa8')]){delete _0x559a10['headers'][_0xdc5f('0xa8')];}return rp(_0x559a10);})[_0xdc5f('0x2c')](function(_0x19bdc5){if(_0x19bdc5){_0x23ca10[_0xdc5f('0xa9')](_0x19bdc5[_0xdc5f('0xa6')]);logger[_0xdc5f('0x68')](_0x19bdc5[_0xdc5f('0x91')]);return _0x23ca10[_0xdc5f('0x21')](_0x19bdc5[_0xdc5f('0xab')])[_0xdc5f('0x99')](_0x19bdc5[_0xdc5f('0x91')]);}else{return _0x23ca10[_0xdc5f('0x1f')](0xc8);}})['catch'](handleError(_0x23ca10,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2b59780..04e2a77 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 _0xb0e5=['emit','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0xdc5698,_0x5daa1f){var _0x2e077d=function(_0x1462b5){while(--_0x1462b5){_0xdc5698['push'](_0xdc5698['shift']());}};_0x2e077d(++_0x5daa1f);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x18e58f,_0xe7beb3){_0x18e58f=_0x18e58f-0x0;var _0x273290=_0xb0e5[_0x18e58f];return _0x273290;};'use strict';var EventEmitter=require(_0x5b0e('0x0'));var Plugin=require(_0x5b0e('0x1'))['db'][_0x5b0e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5b0e('0x3')](0x0);var events={'afterCreate':_0x5b0e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x232b17){return function(_0x582501,_0x38ca7c,_0x553588){PluginEvents[_0x5b0e('0x5')](_0x232b17+':'+_0x582501['id'],_0x582501);PluginEvents[_0x5b0e('0x5')](_0x232b17,_0x582501);_0x553588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5b0e('0x6')]=PluginEvents; \ No newline at end of file +var _0x7b84=['../../mysqldb','Plugin','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x41b2bb,_0x4324e3){var _0x7e369b=function(_0x39d9e6){while(--_0x39d9e6){_0x41b2bb['push'](_0x41b2bb['shift']());}};_0x7e369b(++_0x4324e3);}(_0x7b84,0x167));var _0x47b8=function(_0x4b1199,_0x326358){_0x4b1199=_0x4b1199-0x0;var _0x2362a8=_0x7b84[_0x4b1199];return _0x2362a8;};'use strict';var EventEmitter=require(_0x47b8('0x0'));var Plugin=require(_0x47b8('0x1'))['db'][_0x47b8('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x47b8('0x3'),'afterDestroy':_0x47b8('0x4')};function emitEvent(_0x2693f6){return function(_0x1db46b,_0x2a3dac,_0x2a8ae3){PluginEvents[_0x47b8('0x5')](_0x2693f6+':'+_0x1db46b['id'],_0x1db46b);PluginEvents[_0x47b8('0x5')](_0x2693f6,_0x1db46b);_0x2a8ae3(null);};}for(var e in events){if(events[_0x47b8('0x6')](e)){var event=events[e];Plugin[_0x47b8('0x7')](e,emitEvent(event));}}module[_0x47b8('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 16b9615..a8100dd 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91f4=['exports','define','plugins','util','bluebird','path'];(function(_0x45a115,_0x5038ae){var _0x28e311=function(_0x26e18d){while(--_0x26e18d){_0x45a115['push'](_0x45a115['shift']());}};_0x28e311(++_0x5038ae);}(_0x91f4,0xc9));var _0x491f=function(_0x80b2c7,_0x673840){_0x80b2c7=_0x80b2c7-0x0;var _0x2c40a0=_0x91f4[_0x80b2c7];return _0x2c40a0;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x491f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x491f('0x3')]=function(_0x54d45c,_0x37df6a){return _0x54d45c[_0x491f('0x4')]('Plugin',attributes,{'tableName':_0x491f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8649=['plugins','../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports','define','Plugin'];(function(_0xffad61,_0x5f0282){var _0x33ef10=function(_0x54fde3){while(--_0x54fde3){_0xffad61['push'](_0xffad61['shift']());}};_0x33ef10(++_0x5f0282);}(_0x8649,0x7a));var _0x9864=function(_0x1aa9fe,_0xb6b996){_0x1aa9fe=_0x1aa9fe-0x0;var _0x54bfe7=_0x8649[_0x1aa9fe];return _0x54bfe7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9864('0x0'))(_0x9864('0x1'));var moment=require(_0x9864('0x2'));var BPromise=require(_0x9864('0x3'));var rp=require(_0x9864('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9864('0x5'));var config=require('../../config/environment');var attributes=require(_0x9864('0x6'));module[_0x9864('0x7')]=function(_0x430a28,_0x580ae6){return _0x430a28[_0x9864('0x8')](_0x9864('0x9'),attributes,{'tableName':_0x9864('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 4260c26..c5fb9f6 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 _0x471b=['code','message','result','catch','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x23345e,_0x577876){var _0x20fe3c=function(_0x5892a8){while(--_0x5892a8){_0x23345e['push'](_0x23345e['shift']());}};_0x20fe3c(++_0x577876);}(_0x471b,0x133));var _0xb471=function(_0x9b3f56,_0x3f5f52){_0x9b3f56=_0x9b3f56-0x0;var _0x298336=_0x471b[_0x9b3f56];return _0x298336;};'use strict';var _=require(_0xb471('0x0'));var util=require(_0xb471('0x1'));var moment=require(_0xb471('0x2'));var BPromise=require(_0xb471('0x3'));var rs=require(_0xb471('0x4'));var fs=require('fs');var Redis=require(_0xb471('0x5'));var db=require(_0xb471('0x6'))['db'];var utils=require(_0xb471('0x7'));var logger=require(_0xb471('0x8'))(_0xb471('0x9'));var config=require(_0xb471('0xa'));var jayson=require(_0xb471('0xb'));var client=jayson['client'][_0xb471('0xc')]({'port':0x232a});config[_0xb471('0xd')]=_[_0xb471('0xe')](config[_0xb471('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb471('0xd')]));require('./plugin.socket')[_0xb471('0xf')](socket);function respondWithRpcPromise(_0x4cd26f,_0x234e5d,_0x15e593){return new BPromise(function(_0x83c721,_0x48f019){return client['request'](_0x4cd26f,_0x15e593)[_0xb471('0x10')](function(_0x1aeff1){logger[_0xb471('0x11')](_0xb471('0x12'),_0x234e5d,_0xb471('0x13'));logger[_0xb471('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x234e5d,_0xb471('0x13'),JSON[_0xb471('0x15')](_0x1aeff1));if(_0x1aeff1[_0xb471('0x16')]){if(_0x1aeff1[_0xb471('0x16')][_0xb471('0x17')]===0x1f4){logger[_0xb471('0x16')](_0xb471('0x12'),_0x234e5d,_0x1aeff1[_0xb471('0x16')][_0xb471('0x18')]);return _0x48f019(_0x1aeff1[_0xb471('0x16')]['message']);}logger[_0xb471('0x16')]('Plugin,\x20%s,\x20%s',_0x234e5d,_0x1aeff1['error']['message']);return _0x83c721(_0x1aeff1['error']['message']);}else{logger[_0xb471('0x11')](_0xb471('0x12'),_0x234e5d,'request\x20sent');_0x83c721(_0x1aeff1[_0xb471('0x19')][_0xb471('0x18')]);}})[_0xb471('0x1a')](function(_0x49126d){logger[_0xb471('0x16')](_0xb471('0x12'),_0x234e5d,_0x49126d);_0x48f019(_0x49126d);});});}exports['CreatePlugin']=function(_0x6eb2bb){var _0x4cd812=this;return new Promise(function(_0x5a1b6f,_0x1a0fbe){return db['Plugin']['create'](_0x6eb2bb['body'],{'raw':_0x6eb2bb[_0xb471('0x1b')]?_0x6eb2bb[_0xb471('0x1b')][_0xb471('0x1c')]===undefined?!![]:![]:!![]})[_0xb471('0x10')](function(_0x2fb86c){logger['info'](_0xb471('0x1d'),_0x6eb2bb);logger[_0xb471('0x14')]('CreatePlugin',_0x6eb2bb,JSON['stringify'](_0x2fb86c));_0x5a1b6f(_0x2fb86c);})[_0xb471('0x1a')](function(_0x5bcbdc){logger[_0xb471('0x16')](_0xb471('0x1d'),_0x5bcbdc[_0xb471('0x18')],_0x6eb2bb);_0x1a0fbe(_0x4cd812[_0xb471('0x16')](0x1f4,_0x5bcbdc[_0xb471('0x18')]));});});}; \ No newline at end of file +var _0xb5ad=['Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','debug','CreatePlugin','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info'];(function(_0x271b57,_0x1aae81){var _0x1bcdc6=function(_0x1e738f){while(--_0x1e738f){_0x271b57['push'](_0x271b57['shift']());}};_0x1bcdc6(++_0x1aae81);}(_0xb5ad,0x176));var _0xdb5a=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xb5ad[_0x421cf8];return _0x145c48;};'use strict';var _=require('lodash');var util=require(_0xdb5a('0x0'));var moment=require(_0xdb5a('0x1'));var BPromise=require(_0xdb5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5a('0x3'))['db'];var utils=require(_0xdb5a('0x4'));var logger=require(_0xdb5a('0x5'))(_0xdb5a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb5a('0x7')][_0xdb5a('0x8')]({'port':0x232a});config[_0xdb5a('0x9')]=_[_0xdb5a('0xa')](config[_0xdb5a('0x9')],{'host':_0xdb5a('0xb'),'port':0x18eb});var socket=require(_0xdb5a('0xc'))(new Redis(config[_0xdb5a('0x9')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x28c9de,_0x2a0aec,_0x36588c){return new BPromise(function(_0x4f553a,_0xa1eb76){return client[_0xdb5a('0xd')](_0x28c9de,_0x36588c)[_0xdb5a('0xe')](function(_0x5b51be){logger[_0xdb5a('0xf')](_0xdb5a('0x10'),_0x2a0aec,_0xdb5a('0x11'));logger['debug'](_0xdb5a('0x12'),_0x2a0aec,_0xdb5a('0x11'),JSON[_0xdb5a('0x13')](_0x5b51be));if(_0x5b51be[_0xdb5a('0x14')]){if(_0x5b51be[_0xdb5a('0x14')]['code']===0x1f4){logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5b51be[_0xdb5a('0x14')][_0xdb5a('0x15')]);return _0xa1eb76(_0x5b51be['error'][_0xdb5a('0x15')]);}logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5b51be[_0xdb5a('0x14')][_0xdb5a('0x15')]);return _0x4f553a(_0x5b51be['error'][_0xdb5a('0x15')]);}else{logger[_0xdb5a('0xf')]('Plugin,\x20%s,\x20%s',_0x2a0aec,_0xdb5a('0x11'));_0x4f553a(_0x5b51be[_0xdb5a('0x16')][_0xdb5a('0x15')]);}})[_0xdb5a('0x17')](function(_0x5a0177){logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5a0177);_0xa1eb76(_0x5a0177);});});}exports['CreatePlugin']=function(_0x563c33){var _0x477d42=this;return new Promise(function(_0x20933a,_0x422010){return db['Plugin'][_0xdb5a('0x18')](_0x563c33[_0xdb5a('0x19')],{'raw':_0x563c33['options']?_0x563c33[_0xdb5a('0x1a')][_0xdb5a('0x1b')]===undefined?!![]:![]:!![]})[_0xdb5a('0xe')](function(_0xe06963){logger[_0xdb5a('0xf')]('CreatePlugin',_0x563c33);logger[_0xdb5a('0x1c')](_0xdb5a('0x1d'),_0x563c33,JSON[_0xdb5a('0x13')](_0xe06963));_0x20933a(_0xe06963);})['catch'](function(_0xaf5b9){logger[_0xdb5a('0x14')](_0xdb5a('0x1d'),_0xaf5b9['message'],_0x563c33);_0x422010(_0x477d42['error'](0x1f4,_0xaf5b9[_0xdb5a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4bea993..59b33f5 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 _0x4955=['./plugin.events','save','remove','update','emit','removeListener','register','plugin:'];(function(_0x3a7f5d,_0x3853fa){var _0x4f079f=function(_0x3d0e7b){while(--_0x3d0e7b){_0x3a7f5d['push'](_0x3a7f5d['shift']());}};_0x4f079f(++_0x3853fa);}(_0x4955,0x70));var _0x5495=function(_0x3e9b1c,_0x546b25){_0x3e9b1c=_0x3e9b1c-0x0;var _0xe6834b=_0x4955[_0x3e9b1c];return _0xe6834b;};'use strict';var PluginEvents=require(_0x5495('0x0'));var events=[_0x5495('0x1'),_0x5495('0x2'),_0x5495('0x3')];function createListener(_0x86937f,_0x5e9bb7){return function(_0x50a9f5){_0x5e9bb7[_0x5495('0x4')](_0x86937f,_0x50a9f5);};}function removeListener(_0x582bd4,_0x3d01b3){return function(){PluginEvents[_0x5495('0x5')](_0x582bd4,_0x3d01b3);};}exports[_0x5495('0x6')]=function(_0x4eb917){for(var _0xb58ce0=0x0,_0xd48b9e=events['length'];_0xb58ce0<_0xd48b9e;_0xb58ce0++){var _0x2c23e3=events[_0xb58ce0];var _0x5d77fb=createListener(_0x5495('0x7')+_0x2c23e3,_0x4eb917);PluginEvents['on'](_0x2c23e3,_0x5d77fb);}}; \ No newline at end of file +var _0xf829=['./plugin.events','save','emit','removeListener','register','length','plugin:'];(function(_0x4c1a93,_0x541957){var _0x24dd39=function(_0x3d6c82){while(--_0x3d6c82){_0x4c1a93['push'](_0x4c1a93['shift']());}};_0x24dd39(++_0x541957);}(_0xf829,0x1b9));var _0x9f82=function(_0x51e897,_0x3d9a7e){_0x51e897=_0x51e897-0x0;var _0x54a1b8=_0xf829[_0x51e897];return _0x54a1b8;};'use strict';var PluginEvents=require(_0x9f82('0x0'));var events=[_0x9f82('0x1'),'remove','update'];function createListener(_0x431eae,_0x41b63e){return function(_0x3b1587){_0x41b63e[_0x9f82('0x2')](_0x431eae,_0x3b1587);};}function removeListener(_0x4600ce,_0xdfd9ba){return function(){PluginEvents[_0x9f82('0x3')](_0x4600ce,_0xdfd9ba);};}exports[_0x9f82('0x4')]=function(_0x286ec2){for(var _0x80e41e=0x0,_0x484cba=events[_0x9f82('0x5')];_0x80e41e<_0x484cba;_0x80e41e++){var _0x1e4a58=events[_0x80e41e];var _0x1a5a0f=createListener(_0x9f82('0x6')+_0x1e4a58,_0x286ec2);PluginEvents['on'](_0x1e4a58,_0x1a5a0f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index bc7bdd6..0780a4d 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(_0x53caa7,_0x893050){var _0x274885=function(_0x22bc86){while(--_0x22bc86){_0x53caa7['push'](_0x53caa7['shift']());}};_0x274885(++_0x893050);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x796f16,_0x3c9d72){var _0x5afd5a=function(_0x5e3038){while(--_0x5e3038){_0x796f16['push'](_0x796f16['shift']());}};_0x5afd5a(++_0x3c9d72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 55c7487..d009d2d 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 _0xda55=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty'];(function(_0x1bf573,_0xf4257){var _0x539d6d=function(_0x541704){while(--_0x541704){_0x1bf573['push'](_0x1bf573['shift']());}};_0x539d6d(++_0xf4257);}(_0xda55,0x6d));var _0x5da5=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xda55[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require(_0x5da5('0x0'));var pm2=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x5da5('0x2'));var exec=require(_0x5da5('0x3'))[_0x5da5('0x4')];var BPromise=require(_0x5da5('0x5'));function handleEntityNotFound(_0x1c3afd,_0x5da254){return function(_0x3400e9){if(!_0x3400e9){_0x1c3afd['sendStatus'](0x194);;}return _0x3400e9;};}function respondWithResult(_0x356a37,_0x58e7b3){_0x58e7b3=_0x58e7b3||0xc8;return function(_0x2fd877){if(_0x2fd877){return _0x356a37[_0x5da5('0x6')](_0x58e7b3)[_0x5da5('0x7')](_0x2fd877);}return null;};}function handleError(_0x46290d,_0x3debdf){_0x3debdf=_0x3debdf||0x1f4;return function(_0x25c873){logger[_0x5da5('0x8')](_0x25c873[_0x5da5('0x9')]);if(_0x25c873['name']){delete _0x25c873[_0x5da5('0xa')];}_0x46290d[_0x5da5('0x6')](_0x3debdf)[_0x5da5('0xb')](_0x25c873);};}function execChildProcess(){return new BPromise(function(_0x26fbe3,_0x1a047e){exec(_0x5da5('0xc'),function(_0x33313e,_0x589c14,_0x2f4e4b){logger[_0x5da5('0xd')](_0x589c14);logger['info'](_0x2f4e4b);if(_0x33313e){logger[_0x5da5('0x8')](_0x33313e);return _0x1a047e(_0x33313e);}return _0x26fbe3(_0x589c14);});});}exports[_0x5da5('0xe')]=function(_0x3ced00,_0x43d526){return pm2[_0x5da5('0xf')]()[_0x5da5('0x10')](function(_0x481562){if(_0x481562){var _0x489b60=_['reject'](_0x481562,function(_0x4267cd){return _0x4267cd[_0x5da5('0xa')]===_0x5da5('0x11')||_0x4267cd[_0x5da5('0xa')]===_0x5da5('0x12');});return{'rows':_0x489b60,'count':_0x489b60[_0x5da5('0x13')]};}return null;})[_0x5da5('0x10')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x5da5('0x14')]=function(_0x290136,_0x1a4849){return pm2[_0x5da5('0x15')](_0x290136[_0x5da5('0x16')]['id'])[_0x5da5('0x10')](respondWithResult(_0x1a4849,null))['then'](handleEntityNotFound(_0x1a4849,null))[_0x5da5('0x17')](handleError(_0x1a4849,null));};exports[_0x5da5('0x18')]=function(_0x3d3d26,_0x30cde5){if(_0x3d3d26[_0x5da5('0x19')]['name']&&_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]){var _0x42a3cb=path['join'](__dirname,_0x5da5('0x1b'),_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]);var _0x2e68d5=process[_0x5da5('0x1c')]();process[_0x5da5('0x1d')](path['dirname'](_0x42a3cb));return execChildProcess()[_0x5da5('0x10')](function(_0x568ddf){process[_0x5da5('0x1d')](_0x2e68d5);return pm2[_0x5da5('0x1e')]({'name':_0x3d3d26[_0x5da5('0x19')]['name'],'script':_0x42a3cb});})[_0x5da5('0x10')](function(_0x236bf3){pm2[_0x5da5('0x1f')]();return _0x236bf3[0x0];})[_0x5da5('0x10')](respondWithResult(_0x30cde5,0xc9))['catch'](handleError(_0x30cde5,null));}else{return _0x30cde5['status'](0x1f4)['send']({'message':_0x5da5('0x20')});}};exports['update']=function(_0x4e8890,_0x1f75f3){if(_0x4e8890[_0x5da5('0x19')]['id']){delete _0x4e8890['body']['id'];}var _0x1798ae={'online':_0x5da5('0x21'),'stopped':'stop'};if(_0x1798ae[_0x5da5('0x22')](_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')])){return pm2[_0x1798ae[_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')]]](_0x4e8890['params']['id'])[_0x5da5('0x10')](respondWithResult(_0x1f75f3,0xc8))[_0x5da5('0x17')](handleError(_0x1f75f3,null));}else{return _0x1f75f3[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x4cb022,_0x245273){if(_0x4cb022[_0x5da5('0x19')]['id']){delete _0x4cb022[_0x5da5('0x19')]['id'];}if(_0x4cb022[_0x5da5('0x16')]['id']){return pm2['delete'](_0x4cb022['params']['id'])[_0x5da5('0x10')](function(_0x4afb58){pm2['dump']();return _0x4afb58[0x0];})[_0x5da5('0x10')](respondWithResult(_0x245273,null))['catch'](handleError(_0x245273,null));}else{return _0x245273[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':_0x5da5('0x23')});}}; \ No newline at end of file +var _0x0bb5=['bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','then','express','motion2','length','show','describe','body','script','join','chdir','start','dump','catch','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','path','child_process','exec'];(function(_0x4beeba,_0x456588){var _0x272339=function(_0x3f426){while(--_0x3f426){_0x4beeba['push'](_0x4beeba['shift']());}};_0x272339(++_0x456588);}(_0x0bb5,0x148));var _0x50bb=function(_0x336ca0,_0x32b488){_0x336ca0=_0x336ca0-0x0;var _0x1e4f8d=_0x0bb5[_0x336ca0];return _0x1e4f8d;};'use strict';var _=require(_0x50bb('0x0'));var pm2=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x50bb('0x2'));var exec=require(_0x50bb('0x3'))[_0x50bb('0x4')];var BPromise=require(_0x50bb('0x5'));function handleEntityNotFound(_0x29c72b,_0xfdc9d4){return function(_0x451b4c){if(!_0x451b4c){_0x29c72b[_0x50bb('0x6')](0x194);;}return _0x451b4c;};}function respondWithResult(_0x4e6093,_0x4a105c){_0x4a105c=_0x4a105c||0xc8;return function(_0xfd7aeb){if(_0xfd7aeb){return _0x4e6093[_0x50bb('0x7')](_0x4a105c)[_0x50bb('0x8')](_0xfd7aeb);}return null;};}function handleError(_0x33ff54,_0x4f9172){_0x4f9172=_0x4f9172||0x1f4;return function(_0x4ab8d7){logger[_0x50bb('0x9')](_0x4ab8d7[_0x50bb('0xa')]);if(_0x4ab8d7[_0x50bb('0xb')]){delete _0x4ab8d7[_0x50bb('0xb')];}_0x33ff54['status'](_0x4f9172)[_0x50bb('0xc')](_0x4ab8d7);};}function execChildProcess(){return new BPromise(function(_0x2edeeb,_0x184d06){exec(_0x50bb('0xd'),function(_0x346422,_0x304c3a,_0x38d3b6){logger['info'](_0x304c3a);logger[_0x50bb('0xe')](_0x38d3b6);if(_0x346422){logger['error'](_0x346422);return _0x184d06(_0x346422);}return _0x2edeeb(_0x304c3a);});});}exports[_0x50bb('0xf')]=function(_0xd8ab27,_0x155864){return pm2['list']()[_0x50bb('0x10')](function(_0x309986){if(_0x309986){var _0x3094f2=_['reject'](_0x309986,function(_0xbbc6a0){return _0xbbc6a0['name']===_0x50bb('0x11')||_0xbbc6a0[_0x50bb('0xb')]===_0x50bb('0x12');});return{'rows':_0x3094f2,'count':_0x3094f2[_0x50bb('0x13')]};}return null;})[_0x50bb('0x10')](respondWithResult(_0x155864,null))['catch'](handleError(_0x155864,null));};exports[_0x50bb('0x14')]=function(_0x174065,_0x4b1f5f){return pm2[_0x50bb('0x15')](_0x174065['params']['id'])[_0x50bb('0x10')](respondWithResult(_0x4b1f5f,null))[_0x50bb('0x10')](handleEntityNotFound(_0x4b1f5f,null))['catch'](handleError(_0x4b1f5f,null));};exports['create']=function(_0x43465b,_0x1499dc){if(_0x43465b[_0x50bb('0x16')][_0x50bb('0xb')]&&_0x43465b['body'][_0x50bb('0x17')]){var _0x32bfc3=path[_0x50bb('0x18')](__dirname,'../../files/plugins',_0x43465b[_0x50bb('0x16')][_0x50bb('0x17')]);var _0x1344ec=process['cwd']();process[_0x50bb('0x19')](path['dirname'](_0x32bfc3));return execChildProcess()[_0x50bb('0x10')](function(_0x3391da){process[_0x50bb('0x19')](_0x1344ec);return pm2[_0x50bb('0x1a')]({'name':_0x43465b[_0x50bb('0x16')][_0x50bb('0xb')],'script':_0x32bfc3});})['then'](function(_0xad17ac){pm2[_0x50bb('0x1b')]();return _0xad17ac[0x0];})[_0x50bb('0x10')](respondWithResult(_0x1499dc,0xc9))[_0x50bb('0x1c')](handleError(_0x1499dc,null));}else{return _0x1499dc['status'](0x1f4)[_0x50bb('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x2befd9,_0x491632){if(_0x2befd9['body']['id']){delete _0x2befd9[_0x50bb('0x16')]['id'];}var _0x12ee2c={'online':_0x50bb('0x1d'),'stopped':_0x50bb('0x1e')};if(_0x12ee2c[_0x50bb('0x1f')](_0x2befd9[_0x50bb('0x16')][_0x50bb('0x7')])){return pm2[_0x12ee2c[_0x2befd9[_0x50bb('0x16')]['status']]](_0x2befd9[_0x50bb('0x20')]['id'])[_0x50bb('0x10')](respondWithResult(_0x491632,0xc8))[_0x50bb('0x1c')](handleError(_0x491632,null));}else{return _0x491632[_0x50bb('0x7')](0x1f4)['send']({'message':_0x50bb('0x21')});}};exports[_0x50bb('0x22')]=function(_0xc38da5,_0xb3c3ba){if(_0xc38da5[_0x50bb('0x16')]['id']){delete _0xc38da5[_0x50bb('0x16')]['id'];}if(_0xc38da5[_0x50bb('0x20')]['id']){return pm2[_0x50bb('0x23')](_0xc38da5[_0x50bb('0x20')]['id'])[_0x50bb('0x10')](function(_0x1c2ee2){pm2[_0x50bb('0x1b')]();return _0x1c2ee2[0x0];})['then'](respondWithResult(_0xb3c3ba,null))[_0x50bb('0x1c')](handleError(_0xb3c3ba,null));}else{return _0xb3c3ba[_0x50bb('0x7')](0x1f4)[_0x50bb('0xc')]({'message':_0x50bb('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 412461d..0d60a2e 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 _0x39a5=['./realtime.controller','get','isAuthenticated','getAgents','/queues','exports','express','../../components/auth/service'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x39a5,0x14e));var _0x539a=function(_0x38a035,_0x117208){_0x38a035=_0x38a035-0x0;var _0x246052=_0x39a5[_0x38a035];return _0x246052;};'use strict';var express=require(_0x539a('0x0'));var router=express['Router']();var auth=require(_0x539a('0x1'));var controller=require(_0x539a('0x2'));router[_0x539a('0x3')]('/agents',auth[_0x539a('0x4')](),controller[_0x539a('0x5')]);router[_0x539a('0x3')](_0x539a('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0x539a('0x7')]=router; \ No newline at end of file +var _0xdc5f=['/queues','getQueues','exports','express','Router','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0xdc5f,0x161));var _0xfdc5=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xdc5f[_0x3ab9ee];return _0x82ee88;};'use strict';var express=require(_0xfdc5('0x0'));var router=express[_0xfdc5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfdc5('0x2'));router[_0xfdc5('0x3')](_0xfdc5('0x4'),auth[_0xfdc5('0x5')](),controller[_0xfdc5('0x6')]);router['get'](_0xfdc5('0x7'),auth['isAuthenticated'](),controller[_0xfdc5('0x8')]);module[_0xfdc5('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 f7828b9..d4af975 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 _0x7a54=['loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','message','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','pick','filter','queue','busy','some','internal','toString','length','find','UserId','accountcode','online','voiceStatus','loggedInDb','User','Queue','agents','idle','unknown','isNil','mailPause','smsPause','voicePause','whatsappPause','every','pause','faxStatus','mailStatus','openchannelStatus','split','fields','includes','globalStatus','order','startsWith','DESC','sort','pauseType','getAgents','lastLoginAt','lastPauseAt','address','chatPause','openchannelPause','faxPause','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','join','type','role','agent','raw','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','count','rows','map','omit','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','openchannel','channel','toLowerCase','rawAttributes','fieldName','key','QueueCampaigns','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','status','set','Content-Range','json','stack','name','send','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels'];(function(_0x23a236,_0x3c50a0){var _0x4c391b=function(_0x5660c4){while(--_0x5660c4){_0x23a236['push'](_0x23a236['shift']());}};_0x4c391b(++_0x3c50a0);}(_0x7a54,0x106));var _0x47a5=function(_0x43477b,_0x472674){_0x43477b=_0x43477b-0x0;var _0x3be853=_0x7a54[_0x43477b];return _0x3be853;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232a});var routingClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xfdf934,_0x545a97){return function(_0x3d5629){if(_0x3d5629){var _0x59199c=typeof _0x545a97[_0x47a5('0x7')]===_0x47a5('0x8')&&typeof _0x545a97['limit']===_0x47a5('0x8');var _0x5077f3=_0x3d5629['count'];var _0x582352=_0x59199c?0x0:_0x545a97[_0x47a5('0x7')];var _0x2baee7=_0x59199c?_0x3d5629['count']:_0x545a97[_0x47a5('0x7')]+_0x545a97['limit'];var _0x5de6d7;if(_0x2baee7>=_0x5077f3){_0x2baee7=_0x5077f3;_0x5de6d7=0xc8;}else{_0x5de6d7=0xce;}_0xfdf934[_0x47a5('0x9')](_0x5de6d7);return _0xfdf934[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352+'-'+_0x2baee7+'/'+_0x5077f3)[_0x47a5('0xc')](_0x3d5629);}return null;};}function handleError(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0x1f4;return function(_0x1eae59){logger['error'](_0x1eae59[_0x47a5('0xd')]);if(_0x1eae59[_0x47a5('0xe')]){delete _0x1eae59[_0x47a5('0xe')];}_0xd612dd[_0x47a5('0x9')](_0xd308b8)[_0x47a5('0xf')](_0x1eae59);};}function getRealtimeAgents(){return new Promise(function(_0x620ee9,_0x3c6c46){return amiClient[_0x47a5('0x10')]('Agents',{})[_0x47a5('0x11')](function(_0x11faf5){if(_0x11faf5[_0x47a5('0x12')])throw new Error(_0x47a5('0x13'));var _0x1ef44c=_0x11faf5['result'];return routingClient['request'](_0x47a5('0x14'),{})['then'](function(_0x5247fd){if(_0x5247fd[_0x47a5('0x12')])throw new Error(_0x47a5('0x15'));var _0x2ce454=_0x5247fd[_0x47a5('0x16')];return _0x620ee9(_[_0x47a5('0x17')]({},_0x1ef44c,_0x2ce454));});})[_0x47a5('0x18')](function(_0x2763d6){_0x3c6c46(_0x2763d6);});});}function getRealtimeQueues(_0xe3c618,_0x3aed38){return new Promise(function(_0x4a9fcb,_0x1570bc){var _0xf160ba=_0x3aed38==='voice'?amiClient:routingClient;return _0xf160ba[_0x47a5('0x10')](_[_0x47a5('0x19')](_0x3aed38)+_0x47a5('0x1a'),_0xe3c618)['then'](function(_0xb8ae6c){if(_0xb8ae6c[_0x47a5('0x12')])throw new Error(util[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x3aed38));return _0x4a9fcb(_0xb8ae6c['result']);})[_0x47a5('0x18')](function(_0x385687){_0x1570bc(_0x385687);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x513981,_0x28747d){return amiClient[_0x47a5('0x10')](_0x47a5('0x1d'),{})[_0x47a5('0x11')](function(_0x3abd6a){if(_0x3abd6a['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x513981(_0x3abd6a[_0x47a5('0x16')]);})['catch'](function(_0x1ea9c8){_0x28747d(_0x1ea9c8);});});}function initializeQueues(_0x5b6c4e,_0x23cb77,_0x378208,_0x36ad34){var _0x1dac65=[_0x47a5('0x1e'),_0x47a5('0x1f'),_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22')];if(_0x378208===_0x47a5('0x23')&&_0x36ad34===_0x47a5('0x24')){_0x1dac65[_0x47a5('0x25')](_0x47a5('0x26'),'originated',_0x47a5('0x27'),'dialActive',_0x47a5('0x28'),_0x47a5('0x29'),_0x47a5('0x2a'),'startProgressive',_0x47a5('0x2b'),_0x47a5('0x2c'),_0x47a5('0x2d'),_0x47a5('0x2e'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x47a5('0x2f'),_0x47a5('0x30'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x47a5('0x31'),_0x47a5('0x32'),'predictiveIntervalAvgHoldtime',_0x47a5('0x33'));}return _0x5b6c4e['map'](function(_0x122ed6){var _0xd972c=_0x122ed6['get']({'plain':!![]});_0xd972c['agents']=[];_0xd972c[_0x47a5('0x22')]=0x0;_0xd972c['loggedInDb']=0x0;_0xd972c[_0x47a5('0x1e')]=0x0;_0xd972c[_0x47a5('0x1f')]=0x0;_0xd972c[_0x47a5('0x20')]=0x0;if(_0x378208==='voice'){_0xd972c[_0x47a5('0x21')]=0x0;_0xd972c['busy']=0x0;if(_0x36ad34==='outbound'){_0xd972c[_0x47a5('0x26')]=0x0;_0xd972c['originated']=0x0;}}var _0x25cce0=_['find'](_0x23cb77,['id',_0xd972c['id']]);if(_0x25cce0)_[_0x47a5('0x17')](_0xd972c,_[_0x47a5('0x34')](_0x25cce0,_0x1dac65));return _0xd972c;});}function updateAgentVoiceStatus(_0x38c8d4,_0x199698,_0x36add5){var _0xed6320=_[_0x47a5('0x35')](_0x36add5,[_0x47a5('0x36'),_0x199698[_0x47a5('0xe')]]);if(_0xed6320['length']===0x0)return _0x38c8d4[_0x47a5('0x37')]=!![];if(_[_0x47a5('0x38')](_0xed6320,['connectedlinenum',_0x38c8d4[_0x47a5('0x39')][_0x47a5('0x3a')]()]))return _0x38c8d4[_0x47a5('0x21')]=!![];if(!_0x38c8d4['talking'])return _0x38c8d4[_0x47a5('0x37')]=!![];}function getVoiceQueueAgents(_0x10f660,_0x596097,_0x2ebba0,_0x19218a){var _0x54ae35=_['find'](_0x596097,['id',_0x10f660['id']]);if(!_0x54ae35)return _0x10f660;return _0x54ae35['getMembers']({'raw':!![]})[_0x47a5('0x11')](function(_0x5c569e){for(var _0x9b5eaf=0x0;_0x9b5eaf<_0x5c569e[_0x47a5('0x3b')];_0x9b5eaf++){var _0x301a85=_[_0x47a5('0x3c')](_0x2ebba0,['id',_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')]]);if(!_0x301a85){_0x301a85={'id':_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')],'name':_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')],'accountcode':'','online':![]};}var _0x1f3d01={'id':_0x301a85['id'],'name':_0x301a85[_0x47a5('0xe')],'internal':_0x301a85[_0x47a5('0x3e')],'online':Boolean(_0x301a85[_0x47a5('0x3f')]),'paused':Boolean(_0x5c569e[_0x9b5eaf][_0x47a5('0x22')])};if(_0x301a85[_0x47a5('0x40')]==='talking')updateAgentVoiceStatus(_0x1f3d01,_0x10f660,_0x19218a);if(_0x1f3d01[_0x47a5('0x3f')])_0x10f660[_0x47a5('0x41')]++;if(_0x1f3d01[_0x47a5('0x37')])_0x10f660[_0x47a5('0x37')]++;if(_0x1f3d01['paused']&&!_0x1f3d01[_0x47a5('0x37')]&&!_0x1f3d01['talking'])_0x10f660['paused']++;_0x10f660['agents']['push'](_0x1f3d01);}return _0x10f660;});}function getQueueAgents(_0x27dd5d,_0x5ec4e5,_0x2bb502){var _0x3a740b=_0x47a5('0x42')+_['startCase'](_0x2bb502)+_0x47a5('0x43');var _0x20c5bc=_0x2bb502+'Pause';return db[_0x3a740b]['findAll']({'where':{[_[_0x47a5('0x19')](_0x2bb502)+'QueueId']:_0x27dd5d['id']},'raw':!![]})[_0x47a5('0x11')](function(_0x4703b2){for(var _0x188614=0x0;_0x188614<_0x4703b2[_0x47a5('0x3b')];_0x188614++){var _0x34a9ae=_[_0x47a5('0x3c')](_0x5ec4e5,['id',_0x4703b2[_0x188614][_0x47a5('0x3d')]]);if(!_0x34a9ae){_0x34a9ae={'id':_0x4703b2[_0x188614][_0x47a5('0x3d')],'name':_0x4703b2[_0x188614][_0x47a5('0x3d')],'online':![],['pauseField']:![]};}var _0x162fa0={'id':_0x34a9ae['id'],'name':_0x34a9ae[_0x47a5('0xe')],'online':Boolean(_0x34a9ae[_0x47a5('0x3f')]),'paused':Boolean(_0x34a9ae[_0x20c5bc])};if(_0x162fa0[_0x47a5('0x3f')])_0x27dd5d[_0x47a5('0x41')]++;_0x27dd5d[_0x47a5('0x44')][_0x47a5('0x25')](_0x162fa0);}return _0x27dd5d;});}function isIdle(_0x512e65){return _0x512e65===_0x47a5('0x45')||_0x512e65===_0x47a5('0x46')||_0x512e65==='unavailable'||_0x512e65==='ringing'||_[_0x47a5('0x47')](_0x512e65);}function isAgentPaused(_0x560e4e,_0x13750d){var _0xd93e37=[_0x560e4e['chatPause'],_0x560e4e['faxPause'],_0x560e4e[_0x47a5('0x48')],_0x560e4e['openchannelPause'],_0x560e4e[_0x47a5('0x49')],_0x560e4e[_0x47a5('0x4a')],_0x560e4e[_0x47a5('0x4b')]];if(!_0x13750d)return _[_0x47a5('0x4c')](_0xd93e37);var _0x44fe8a=_[_0x47a5('0x35')](_0xd93e37);return _0x44fe8a[_0x47a5('0x3b')]>0x0&&_0x44fe8a['length']<_0xd93e37['length']?!![]:![];}function isAgentIdle(_0x2dd1db){if(_0x2dd1db[_0x47a5('0x40')]!==_0x47a5('0x45')&&_0x2dd1db[_0x47a5('0x4a')]){_0x2dd1db[_0x47a5('0x40')]=_0x47a5('0x4d');return![];}return _[_0x47a5('0x4c')]([_0x2dd1db['chatStatus'],_0x2dd1db[_0x47a5('0x4e')],_0x2dd1db[_0x47a5('0x4f')],_0x2dd1db[_0x47a5('0x50')],_0x2dd1db['smsStatus'],_0x2dd1db[_0x47a5('0x40')],_0x2dd1db['whatsappStatus']],isIdle);}function getAgentStatus(_0x2bf302){var _0xe31817=_0x47a5('0x46');if(isAgentPaused(_0x2bf302))_0xe31817=_0x47a5('0x4d');else if(isAgentPaused(_0x2bf302,!![]))_0xe31817='*pause';else if(isAgentIdle(_0x2bf302))_0xe31817=_0x47a5('0x45');else _0xe31817=_0x47a5('0x37');return _0xe31817;}function getUpdatedSortOptions(_0x2f66e9){var _0x3a2de4={'fields':[],'order':null};var _0x1b2335=_0x2f66e9[_0x47a5('0x51')](',');_0x3a2de4[_0x47a5('0x52')]=_['filter'](_0x1b2335,function(_0x2a0aa2){if(!_0x2a0aa2[_0x47a5('0x53')](_0x47a5('0x54')))return!![];_0x3a2de4[_0x47a5('0x55')]=_[_0x47a5('0x56')](_0x2a0aa2,'-')?_0x47a5('0x57'):'ASC';return![];});return _0x3a2de4;}function orderAgentsByStatus(_0x1ad6a9,_0x245a15){return _0x1ad6a9[_0x47a5('0x58')](function(_0x53871e,_0x4c5ed){if(_0x53871e[_0x47a5('0x54')]===_0x4c5ed[_0x47a5('0x54')]&&_0x53871e['globalStatus']==='pause'){if(_0x245a15===_0x47a5('0x57'))return(_0x53871e[_0x47a5('0x59')]||'')<(_0x4c5ed['pauseType']||'')?0x1:-0x1;return _0x53871e['pauseType']<_0x4c5ed[_0x47a5('0x59')]?-0x1:0x1;}else{if(_0x245a15==='DESC')return _0x53871e[_0x47a5('0x54')]<_0x4c5ed['globalStatus']?0x1:-0x1;return _0x53871e['globalStatus']<_0x4c5ed[_0x47a5('0x54')]?-0x1:0x1;}});}exports[_0x47a5('0x5a')]=function(_0x53eedf,_0x1b958b){var _0x72fe={'count':0x0,'rows':[]},_0x4b706a={},_0x5b6127,_0x16b4fd,_0x30d482,_0x867da0=['userpic',_0x47a5('0x3f'),_0x47a5('0x5b'),_0x47a5('0x5c'),'pauseType',_0x47a5('0x5c'),'internal',_0x47a5('0x5d'),_0x47a5('0x5e'),_0x47a5('0x5f'),_0x47a5('0x48'),_0x47a5('0x49'),'whatsappPause',_0x47a5('0x60'),'voicePause','chatCapacity','openchannelCapacity','mailCapacity',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x47a5('0x64'),_0x47a5('0x65'),_0x47a5('0x66'),_0x47a5('0x67'),_0x47a5('0x68'),'openchannelStatus',_0x47a5('0x4f'),'smsStatus',_0x47a5('0x69'),_0x47a5('0x4e'),'voiceStatus',_0x47a5('0x6a'),_0x47a5('0x6b'),_0x47a5('0x6c'),_0x47a5('0x6d'),_0x47a5('0x6e'),_0x47a5('0x6f'),_0x47a5('0x70'),_0x47a5('0x36'),'destconnectedlinenum',_0x47a5('0x71'),_0x47a5('0x72'),_0x47a5('0x73'),_0x47a5('0x74')],_0x2931e4=[_0x47a5('0x5e'),'openchannelPause',_0x47a5('0x48'),_0x47a5('0x49'),_0x47a5('0x4b'),_0x47a5('0x60'),_0x47a5('0x4a'),_0x47a5('0x3f')];Promise[_0x47a5('0x75')]()[_0x47a5('0x11')](function(){if(!_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')]||!_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')][_0x47a5('0x53')](_0x47a5('0x54')))return;var _0x3edd17=getUpdatedSortOptions(_0x53eedf['query'][_0x47a5('0x58')]);_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')]=_0x3edd17['fields'][_0x47a5('0x77')](',');_0x5b6127=_0x3edd17[_0x47a5('0x55')];})[_0x47a5('0x11')](function(){var _0x26f1ac=_['map'](db[_0x47a5('0x42')]['rawAttributes'],function(_0x2d5ee6){return{'name':_0x2d5ee6['fieldName'],'type':_0x2d5ee6[_0x47a5('0x78')]['key']};});_0x53eedf[_0x47a5('0x76')][_0x47a5('0x79')]=_0x47a5('0x7a');_0x53eedf['query']['online']=!![];_0x4b706a=qs['getOptions'](_0x26f1ac,_0x53eedf);_0x4b706a[_0x47a5('0x7b')]=!![];if(_0x53eedf[_0x47a5('0x7c')][_0x47a5('0x79')]===_0x47a5('0x7c')){var _0x525055={'params':{'id':_0x53eedf[_0x47a5('0x7c')][_0x47a5('0x7d')]},'query':{'section':_0x47a5('0x14'),'role':_0x47a5('0x7a'),'online':!![],'nolimit':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x7e')],'sort':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')],'filter':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x35')],'raw':!![]}};return db[_0x47a5('0x7f')][_0x47a5('0x80')](_0x525055);}return db['User'][_0x47a5('0x81')](_0x4b706a);})['then'](function(_0x2ad00a){_0x72fe[_0x47a5('0x82')]=_0x2ad00a[_0x47a5('0x82')];_0x16b4fd=_0x2ad00a[_0x47a5('0x83')];return getRealtimeAgents();})[_0x47a5('0x11')](function(_0xa9c853){_0x30d482=_0xa9c853[_0x47a5('0x83')];return _0x16b4fd[_0x47a5('0x84')](function(_0x11c1db){var _0x254049=_[_0x47a5('0x3c')](_0x30d482,['id',_0x11c1db['id']]);if(_0x254049)_[_0x47a5('0x17')](_0x11c1db,_[_0x47a5('0x34')](_[_0x47a5('0x85')](_0x254049,_0x2931e4),_0x867da0));_0x11c1db[_0x47a5('0x54')]=getAgentStatus(_0x11c1db);return _0x11c1db;});})['then'](function(_0x48eb77){var _0x5ccc89;if(_0x53eedf['query'][_0x47a5('0x86')]){_0x5ccc89=_[_0x47a5('0x35')](_0x48eb77,['globalStatus',_0x53eedf[_0x47a5('0x76')][_0x47a5('0x86')]]);if(_0x53eedf[_0x47a5('0x76')][_0x47a5('0x87')]){_0x5ccc89=_[_0x47a5('0x35')](_0x5ccc89,[_0x47a5('0x59'),_0x53eedf[_0x47a5('0x76')][_0x47a5('0x87')]]);}}if(_0x5ccc89)_0x48eb77=_0x5ccc89;if(!_0x5b6127)return _0x48eb77;return orderAgentsByStatus(_0x48eb77,_0x5b6127);})[_0x47a5('0x11')](function(_0x1ffe3c){_0x72fe[_0x47a5('0x83')]=_0x1ffe3c;return _0x72fe;})['then'](respondWithFilteredResult(_0x1b958b,_0x4b706a))[_0x47a5('0x18')](handleError(_0x1b958b,null));};exports[_0x47a5('0x88')]=function(_0x420671,_0x4f35ff){var _0x340846=[_0x47a5('0x89'),_0x47a5('0x8a'),'sms',_0x47a5('0x8b'),'fax','whatsapp',_0x47a5('0x23')];var _0x292d9c={'count':0x0,'rows':[]},_0x277486={},_0x27333e,_0x164d42,_0xea50f3,_0x479a82,_0x592322;Promise[_0x47a5('0x75')]()['then'](function(){if(_0x420671[_0x47a5('0x76')][_0x47a5('0x8c')]){if(!_[_0x47a5('0x53')](_0x340846,_0x420671[_0x47a5('0x76')]['channel'][_0x47a5('0x8d')]()))throw new Error('Invalid\x20channel');_0x27333e=_0x420671['query'][_0x47a5('0x8c')][_0x47a5('0x8d')]();}var _0x5b91f7=_[_0x47a5('0x19')](_0x27333e)+_0x47a5('0x43');var _0x24a98b=_['map'](db[_0x5b91f7][_0x47a5('0x8e')],function(_0x578e27){return{'name':_0x578e27[_0x47a5('0x8f')],'type':_0x578e27[_0x47a5('0x78')][_0x47a5('0x90')]};});_0x277486=qs['getOptions'](_0x24a98b,_0x420671);if(_0x420671[_0x47a5('0x7c')][_0x47a5('0x79')]===_0x47a5('0x7c')){var _0x4b3fef={'params':{'id':_0x420671[_0x47a5('0x7c')]['userProfileId']},'query':{'section':_0x27333e===_0x47a5('0x23')&&_0x420671['query'][_0x47a5('0x78')]===_0x47a5('0x24')?_0x47a5('0x91'):_[_0x47a5('0x19')](_0x27333e)+'Queues','type':_0x420671[_0x47a5('0x76')][_0x47a5('0x78')],'nolimit':!![],'sort':_0x47a5('0xe'),'filter':_0x420671[_0x47a5('0x76')][_0x47a5('0x35')]}};return db['UserProfile']['getResources'](_0x4b3fef);}return db[_0x5b91f7][_0x47a5('0x81')](_0x277486);})['then'](function(_0xd6c211){_0x292d9c[_0x47a5('0x82')]=_0xd6c211[_0x47a5('0x82')];_0x164d42=_0xd6c211['rows'];return getRealtimeQueues(_0x420671,_0x27333e);})[_0x47a5('0x11')](function(_0x18f833){_0x479a82=_0x18f833['rows'];return getRealtimeAgents();})[_0x47a5('0x11')](function(_0x8a9dea){_0xea50f3=_0x8a9dea[_0x47a5('0x83')];if(_0x27333e!=_0x47a5('0x23'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x4b5353){_0x592322=_0x4b5353?_0x4b5353[_0x47a5('0x83')]:[];return initializeQueues(_0x164d42,_0x479a82,_0x27333e,_0x420671[_0x47a5('0x76')]['type']);})[_0x47a5('0x11')](function(_0x23f055){var _0x5a0901=_0x23f055[_0x47a5('0x84')](function(_0x2a02cd){if(_0x27333e===_0x47a5('0x23'))return getVoiceQueueAgents(_0x2a02cd,_0x164d42,_0xea50f3,_0x592322);else return getQueueAgents(_0x2a02cd,_0xea50f3,_0x27333e);});return Promise['all'](_0x5a0901);})[_0x47a5('0x11')](function(_0x59b4a5){_0x292d9c[_0x47a5('0x83')]=_0x59b4a5;return _0x292d9c;})['then'](respondWithFilteredResult(_0x4f35ff,_0x277486))[_0x47a5('0x18')](handleError(_0x4f35ff,null));}; \ No newline at end of file +var _0x7a54=['loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','message','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','pick','filter','queue','busy','some','internal','toString','length','find','UserId','accountcode','online','voiceStatus','loggedInDb','User','Queue','agents','idle','unknown','isNil','mailPause','smsPause','voicePause','whatsappPause','every','pause','faxStatus','mailStatus','openchannelStatus','split','fields','includes','globalStatus','order','startsWith','DESC','sort','pauseType','getAgents','lastLoginAt','lastPauseAt','address','chatPause','openchannelPause','faxPause','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','join','type','role','agent','raw','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','count','rows','map','omit','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','openchannel','channel','toLowerCase','rawAttributes','fieldName','key','QueueCampaigns','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','status','set','Content-Range','json','stack','name','send','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels'];(function(_0x3013c6,_0x191c16){var _0x7ea83f=function(_0x513391){while(--_0x513391){_0x3013c6['push'](_0x3013c6['shift']());}};_0x7ea83f(++_0x191c16);}(_0x7a54,0x106));var _0x47a5=function(_0x3e042b,_0x3d4b58){_0x3e042b=_0x3e042b-0x0;var _0x1b6831=_0x7a54[_0x3e042b];return _0x1b6831;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232a});var routingClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xfdf934,_0x545a97){return function(_0x3d5629){if(_0x3d5629){var _0x59199c=typeof _0x545a97[_0x47a5('0x7')]===_0x47a5('0x8')&&typeof _0x545a97['limit']===_0x47a5('0x8');var _0x5077f3=_0x3d5629['count'];var _0x582352=_0x59199c?0x0:_0x545a97[_0x47a5('0x7')];var _0x2baee7=_0x59199c?_0x3d5629['count']:_0x545a97[_0x47a5('0x7')]+_0x545a97['limit'];var _0x5de6d7;if(_0x2baee7>=_0x5077f3){_0x2baee7=_0x5077f3;_0x5de6d7=0xc8;}else{_0x5de6d7=0xce;}_0xfdf934[_0x47a5('0x9')](_0x5de6d7);return _0xfdf934[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352+'-'+_0x2baee7+'/'+_0x5077f3)[_0x47a5('0xc')](_0x3d5629);}return null;};}function handleError(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0x1f4;return function(_0x1eae59){logger['error'](_0x1eae59[_0x47a5('0xd')]);if(_0x1eae59[_0x47a5('0xe')]){delete _0x1eae59[_0x47a5('0xe')];}_0xd612dd[_0x47a5('0x9')](_0xd308b8)[_0x47a5('0xf')](_0x1eae59);};}function getRealtimeAgents(){return new Promise(function(_0x620ee9,_0x3c6c46){return amiClient[_0x47a5('0x10')]('Agents',{})[_0x47a5('0x11')](function(_0x11faf5){if(_0x11faf5[_0x47a5('0x12')])throw new Error(_0x47a5('0x13'));var _0x1ef44c=_0x11faf5['result'];return routingClient['request'](_0x47a5('0x14'),{})['then'](function(_0x5247fd){if(_0x5247fd[_0x47a5('0x12')])throw new Error(_0x47a5('0x15'));var _0x2ce454=_0x5247fd[_0x47a5('0x16')];return _0x620ee9(_[_0x47a5('0x17')]({},_0x1ef44c,_0x2ce454));});})[_0x47a5('0x18')](function(_0x2763d6){_0x3c6c46(_0x2763d6);});});}function getRealtimeQueues(_0xe3c618,_0x3aed38){return new Promise(function(_0x4a9fcb,_0x1570bc){var _0xf160ba=_0x3aed38==='voice'?amiClient:routingClient;return _0xf160ba[_0x47a5('0x10')](_[_0x47a5('0x19')](_0x3aed38)+_0x47a5('0x1a'),_0xe3c618)['then'](function(_0xb8ae6c){if(_0xb8ae6c[_0x47a5('0x12')])throw new Error(util[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x3aed38));return _0x4a9fcb(_0xb8ae6c['result']);})[_0x47a5('0x18')](function(_0x385687){_0x1570bc(_0x385687);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x513981,_0x28747d){return amiClient[_0x47a5('0x10')](_0x47a5('0x1d'),{})[_0x47a5('0x11')](function(_0x3abd6a){if(_0x3abd6a['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x513981(_0x3abd6a[_0x47a5('0x16')]);})['catch'](function(_0x1ea9c8){_0x28747d(_0x1ea9c8);});});}function initializeQueues(_0x5b6c4e,_0x23cb77,_0x378208,_0x36ad34){var _0x1dac65=[_0x47a5('0x1e'),_0x47a5('0x1f'),_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22')];if(_0x378208===_0x47a5('0x23')&&_0x36ad34===_0x47a5('0x24')){_0x1dac65[_0x47a5('0x25')](_0x47a5('0x26'),'originated',_0x47a5('0x27'),'dialActive',_0x47a5('0x28'),_0x47a5('0x29'),_0x47a5('0x2a'),'startProgressive',_0x47a5('0x2b'),_0x47a5('0x2c'),_0x47a5('0x2d'),_0x47a5('0x2e'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x47a5('0x2f'),_0x47a5('0x30'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x47a5('0x31'),_0x47a5('0x32'),'predictiveIntervalAvgHoldtime',_0x47a5('0x33'));}return _0x5b6c4e['map'](function(_0x122ed6){var _0xd972c=_0x122ed6['get']({'plain':!![]});_0xd972c['agents']=[];_0xd972c[_0x47a5('0x22')]=0x0;_0xd972c['loggedInDb']=0x0;_0xd972c[_0x47a5('0x1e')]=0x0;_0xd972c[_0x47a5('0x1f')]=0x0;_0xd972c[_0x47a5('0x20')]=0x0;if(_0x378208==='voice'){_0xd972c[_0x47a5('0x21')]=0x0;_0xd972c['busy']=0x0;if(_0x36ad34==='outbound'){_0xd972c[_0x47a5('0x26')]=0x0;_0xd972c['originated']=0x0;}}var _0x25cce0=_['find'](_0x23cb77,['id',_0xd972c['id']]);if(_0x25cce0)_[_0x47a5('0x17')](_0xd972c,_[_0x47a5('0x34')](_0x25cce0,_0x1dac65));return _0xd972c;});}function updateAgentVoiceStatus(_0x38c8d4,_0x199698,_0x36add5){var _0xed6320=_[_0x47a5('0x35')](_0x36add5,[_0x47a5('0x36'),_0x199698[_0x47a5('0xe')]]);if(_0xed6320['length']===0x0)return _0x38c8d4[_0x47a5('0x37')]=!![];if(_[_0x47a5('0x38')](_0xed6320,['connectedlinenum',_0x38c8d4[_0x47a5('0x39')][_0x47a5('0x3a')]()]))return _0x38c8d4[_0x47a5('0x21')]=!![];if(!_0x38c8d4['talking'])return _0x38c8d4[_0x47a5('0x37')]=!![];}function getVoiceQueueAgents(_0x10f660,_0x596097,_0x2ebba0,_0x19218a){var _0x54ae35=_['find'](_0x596097,['id',_0x10f660['id']]);if(!_0x54ae35)return _0x10f660;return _0x54ae35['getMembers']({'raw':!![]})[_0x47a5('0x11')](function(_0x5c569e){for(var _0x9b5eaf=0x0;_0x9b5eaf<_0x5c569e[_0x47a5('0x3b')];_0x9b5eaf++){var _0x301a85=_[_0x47a5('0x3c')](_0x2ebba0,['id',_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')]]);if(!_0x301a85){_0x301a85={'id':_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')],'name':_0x5c569e[_0x9b5eaf][_0x47a5('0x3d')],'accountcode':'','online':![]};}var _0x1f3d01={'id':_0x301a85['id'],'name':_0x301a85[_0x47a5('0xe')],'internal':_0x301a85[_0x47a5('0x3e')],'online':Boolean(_0x301a85[_0x47a5('0x3f')]),'paused':Boolean(_0x5c569e[_0x9b5eaf][_0x47a5('0x22')])};if(_0x301a85[_0x47a5('0x40')]==='talking')updateAgentVoiceStatus(_0x1f3d01,_0x10f660,_0x19218a);if(_0x1f3d01[_0x47a5('0x3f')])_0x10f660[_0x47a5('0x41')]++;if(_0x1f3d01[_0x47a5('0x37')])_0x10f660[_0x47a5('0x37')]++;if(_0x1f3d01['paused']&&!_0x1f3d01[_0x47a5('0x37')]&&!_0x1f3d01['talking'])_0x10f660['paused']++;_0x10f660['agents']['push'](_0x1f3d01);}return _0x10f660;});}function getQueueAgents(_0x27dd5d,_0x5ec4e5,_0x2bb502){var _0x3a740b=_0x47a5('0x42')+_['startCase'](_0x2bb502)+_0x47a5('0x43');var _0x20c5bc=_0x2bb502+'Pause';return db[_0x3a740b]['findAll']({'where':{[_[_0x47a5('0x19')](_0x2bb502)+'QueueId']:_0x27dd5d['id']},'raw':!![]})[_0x47a5('0x11')](function(_0x4703b2){for(var _0x188614=0x0;_0x188614<_0x4703b2[_0x47a5('0x3b')];_0x188614++){var _0x34a9ae=_[_0x47a5('0x3c')](_0x5ec4e5,['id',_0x4703b2[_0x188614][_0x47a5('0x3d')]]);if(!_0x34a9ae){_0x34a9ae={'id':_0x4703b2[_0x188614][_0x47a5('0x3d')],'name':_0x4703b2[_0x188614][_0x47a5('0x3d')],'online':![],['pauseField']:![]};}var _0x162fa0={'id':_0x34a9ae['id'],'name':_0x34a9ae[_0x47a5('0xe')],'online':Boolean(_0x34a9ae[_0x47a5('0x3f')]),'paused':Boolean(_0x34a9ae[_0x20c5bc])};if(_0x162fa0[_0x47a5('0x3f')])_0x27dd5d[_0x47a5('0x41')]++;_0x27dd5d[_0x47a5('0x44')][_0x47a5('0x25')](_0x162fa0);}return _0x27dd5d;});}function isIdle(_0x512e65){return _0x512e65===_0x47a5('0x45')||_0x512e65===_0x47a5('0x46')||_0x512e65==='unavailable'||_0x512e65==='ringing'||_[_0x47a5('0x47')](_0x512e65);}function isAgentPaused(_0x560e4e,_0x13750d){var _0xd93e37=[_0x560e4e['chatPause'],_0x560e4e['faxPause'],_0x560e4e[_0x47a5('0x48')],_0x560e4e['openchannelPause'],_0x560e4e[_0x47a5('0x49')],_0x560e4e[_0x47a5('0x4a')],_0x560e4e[_0x47a5('0x4b')]];if(!_0x13750d)return _[_0x47a5('0x4c')](_0xd93e37);var _0x44fe8a=_[_0x47a5('0x35')](_0xd93e37);return _0x44fe8a[_0x47a5('0x3b')]>0x0&&_0x44fe8a['length']<_0xd93e37['length']?!![]:![];}function isAgentIdle(_0x2dd1db){if(_0x2dd1db[_0x47a5('0x40')]!==_0x47a5('0x45')&&_0x2dd1db[_0x47a5('0x4a')]){_0x2dd1db[_0x47a5('0x40')]=_0x47a5('0x4d');return![];}return _[_0x47a5('0x4c')]([_0x2dd1db['chatStatus'],_0x2dd1db[_0x47a5('0x4e')],_0x2dd1db[_0x47a5('0x4f')],_0x2dd1db[_0x47a5('0x50')],_0x2dd1db['smsStatus'],_0x2dd1db[_0x47a5('0x40')],_0x2dd1db['whatsappStatus']],isIdle);}function getAgentStatus(_0x2bf302){var _0xe31817=_0x47a5('0x46');if(isAgentPaused(_0x2bf302))_0xe31817=_0x47a5('0x4d');else if(isAgentPaused(_0x2bf302,!![]))_0xe31817='*pause';else if(isAgentIdle(_0x2bf302))_0xe31817=_0x47a5('0x45');else _0xe31817=_0x47a5('0x37');return _0xe31817;}function getUpdatedSortOptions(_0x2f66e9){var _0x3a2de4={'fields':[],'order':null};var _0x1b2335=_0x2f66e9[_0x47a5('0x51')](',');_0x3a2de4[_0x47a5('0x52')]=_['filter'](_0x1b2335,function(_0x2a0aa2){if(!_0x2a0aa2[_0x47a5('0x53')](_0x47a5('0x54')))return!![];_0x3a2de4[_0x47a5('0x55')]=_[_0x47a5('0x56')](_0x2a0aa2,'-')?_0x47a5('0x57'):'ASC';return![];});return _0x3a2de4;}function orderAgentsByStatus(_0x1ad6a9,_0x245a15){return _0x1ad6a9[_0x47a5('0x58')](function(_0x53871e,_0x4c5ed){if(_0x53871e[_0x47a5('0x54')]===_0x4c5ed[_0x47a5('0x54')]&&_0x53871e['globalStatus']==='pause'){if(_0x245a15===_0x47a5('0x57'))return(_0x53871e[_0x47a5('0x59')]||'')<(_0x4c5ed['pauseType']||'')?0x1:-0x1;return _0x53871e['pauseType']<_0x4c5ed[_0x47a5('0x59')]?-0x1:0x1;}else{if(_0x245a15==='DESC')return _0x53871e[_0x47a5('0x54')]<_0x4c5ed['globalStatus']?0x1:-0x1;return _0x53871e['globalStatus']<_0x4c5ed[_0x47a5('0x54')]?-0x1:0x1;}});}exports[_0x47a5('0x5a')]=function(_0x53eedf,_0x1b958b){var _0x72fe={'count':0x0,'rows':[]},_0x4b706a={},_0x5b6127,_0x16b4fd,_0x30d482,_0x867da0=['userpic',_0x47a5('0x3f'),_0x47a5('0x5b'),_0x47a5('0x5c'),'pauseType',_0x47a5('0x5c'),'internal',_0x47a5('0x5d'),_0x47a5('0x5e'),_0x47a5('0x5f'),_0x47a5('0x48'),_0x47a5('0x49'),'whatsappPause',_0x47a5('0x60'),'voicePause','chatCapacity','openchannelCapacity','mailCapacity',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x47a5('0x64'),_0x47a5('0x65'),_0x47a5('0x66'),_0x47a5('0x67'),_0x47a5('0x68'),'openchannelStatus',_0x47a5('0x4f'),'smsStatus',_0x47a5('0x69'),_0x47a5('0x4e'),'voiceStatus',_0x47a5('0x6a'),_0x47a5('0x6b'),_0x47a5('0x6c'),_0x47a5('0x6d'),_0x47a5('0x6e'),_0x47a5('0x6f'),_0x47a5('0x70'),_0x47a5('0x36'),'destconnectedlinenum',_0x47a5('0x71'),_0x47a5('0x72'),_0x47a5('0x73'),_0x47a5('0x74')],_0x2931e4=[_0x47a5('0x5e'),'openchannelPause',_0x47a5('0x48'),_0x47a5('0x49'),_0x47a5('0x4b'),_0x47a5('0x60'),_0x47a5('0x4a'),_0x47a5('0x3f')];Promise[_0x47a5('0x75')]()[_0x47a5('0x11')](function(){if(!_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')]||!_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')][_0x47a5('0x53')](_0x47a5('0x54')))return;var _0x3edd17=getUpdatedSortOptions(_0x53eedf['query'][_0x47a5('0x58')]);_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')]=_0x3edd17['fields'][_0x47a5('0x77')](',');_0x5b6127=_0x3edd17[_0x47a5('0x55')];})[_0x47a5('0x11')](function(){var _0x26f1ac=_['map'](db[_0x47a5('0x42')]['rawAttributes'],function(_0x2d5ee6){return{'name':_0x2d5ee6['fieldName'],'type':_0x2d5ee6[_0x47a5('0x78')]['key']};});_0x53eedf[_0x47a5('0x76')][_0x47a5('0x79')]=_0x47a5('0x7a');_0x53eedf['query']['online']=!![];_0x4b706a=qs['getOptions'](_0x26f1ac,_0x53eedf);_0x4b706a[_0x47a5('0x7b')]=!![];if(_0x53eedf[_0x47a5('0x7c')][_0x47a5('0x79')]===_0x47a5('0x7c')){var _0x525055={'params':{'id':_0x53eedf[_0x47a5('0x7c')][_0x47a5('0x7d')]},'query':{'section':_0x47a5('0x14'),'role':_0x47a5('0x7a'),'online':!![],'nolimit':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x7e')],'sort':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x58')],'filter':_0x53eedf[_0x47a5('0x76')][_0x47a5('0x35')],'raw':!![]}};return db[_0x47a5('0x7f')][_0x47a5('0x80')](_0x525055);}return db['User'][_0x47a5('0x81')](_0x4b706a);})['then'](function(_0x2ad00a){_0x72fe[_0x47a5('0x82')]=_0x2ad00a[_0x47a5('0x82')];_0x16b4fd=_0x2ad00a[_0x47a5('0x83')];return getRealtimeAgents();})[_0x47a5('0x11')](function(_0xa9c853){_0x30d482=_0xa9c853[_0x47a5('0x83')];return _0x16b4fd[_0x47a5('0x84')](function(_0x11c1db){var _0x254049=_[_0x47a5('0x3c')](_0x30d482,['id',_0x11c1db['id']]);if(_0x254049)_[_0x47a5('0x17')](_0x11c1db,_[_0x47a5('0x34')](_[_0x47a5('0x85')](_0x254049,_0x2931e4),_0x867da0));_0x11c1db[_0x47a5('0x54')]=getAgentStatus(_0x11c1db);return _0x11c1db;});})['then'](function(_0x48eb77){var _0x5ccc89;if(_0x53eedf['query'][_0x47a5('0x86')]){_0x5ccc89=_[_0x47a5('0x35')](_0x48eb77,['globalStatus',_0x53eedf[_0x47a5('0x76')][_0x47a5('0x86')]]);if(_0x53eedf[_0x47a5('0x76')][_0x47a5('0x87')]){_0x5ccc89=_[_0x47a5('0x35')](_0x5ccc89,[_0x47a5('0x59'),_0x53eedf[_0x47a5('0x76')][_0x47a5('0x87')]]);}}if(_0x5ccc89)_0x48eb77=_0x5ccc89;if(!_0x5b6127)return _0x48eb77;return orderAgentsByStatus(_0x48eb77,_0x5b6127);})[_0x47a5('0x11')](function(_0x1ffe3c){_0x72fe[_0x47a5('0x83')]=_0x1ffe3c;return _0x72fe;})['then'](respondWithFilteredResult(_0x1b958b,_0x4b706a))[_0x47a5('0x18')](handleError(_0x1b958b,null));};exports[_0x47a5('0x88')]=function(_0x420671,_0x4f35ff){var _0x340846=[_0x47a5('0x89'),_0x47a5('0x8a'),'sms',_0x47a5('0x8b'),'fax','whatsapp',_0x47a5('0x23')];var _0x292d9c={'count':0x0,'rows':[]},_0x277486={},_0x27333e,_0x164d42,_0xea50f3,_0x479a82,_0x592322;Promise[_0x47a5('0x75')]()['then'](function(){if(_0x420671[_0x47a5('0x76')][_0x47a5('0x8c')]){if(!_[_0x47a5('0x53')](_0x340846,_0x420671[_0x47a5('0x76')]['channel'][_0x47a5('0x8d')]()))throw new Error('Invalid\x20channel');_0x27333e=_0x420671['query'][_0x47a5('0x8c')][_0x47a5('0x8d')]();}var _0x5b91f7=_[_0x47a5('0x19')](_0x27333e)+_0x47a5('0x43');var _0x24a98b=_['map'](db[_0x5b91f7][_0x47a5('0x8e')],function(_0x578e27){return{'name':_0x578e27[_0x47a5('0x8f')],'type':_0x578e27[_0x47a5('0x78')][_0x47a5('0x90')]};});_0x277486=qs['getOptions'](_0x24a98b,_0x420671);if(_0x420671[_0x47a5('0x7c')][_0x47a5('0x79')]===_0x47a5('0x7c')){var _0x4b3fef={'params':{'id':_0x420671[_0x47a5('0x7c')]['userProfileId']},'query':{'section':_0x27333e===_0x47a5('0x23')&&_0x420671['query'][_0x47a5('0x78')]===_0x47a5('0x24')?_0x47a5('0x91'):_[_0x47a5('0x19')](_0x27333e)+'Queues','type':_0x420671[_0x47a5('0x76')][_0x47a5('0x78')],'nolimit':!![],'sort':_0x47a5('0xe'),'filter':_0x420671[_0x47a5('0x76')][_0x47a5('0x35')]}};return db['UserProfile']['getResources'](_0x4b3fef);}return db[_0x5b91f7][_0x47a5('0x81')](_0x277486);})['then'](function(_0xd6c211){_0x292d9c[_0x47a5('0x82')]=_0xd6c211[_0x47a5('0x82')];_0x164d42=_0xd6c211['rows'];return getRealtimeQueues(_0x420671,_0x27333e);})[_0x47a5('0x11')](function(_0x18f833){_0x479a82=_0x18f833['rows'];return getRealtimeAgents();})[_0x47a5('0x11')](function(_0x8a9dea){_0xea50f3=_0x8a9dea[_0x47a5('0x83')];if(_0x27333e!=_0x47a5('0x23'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x4b5353){_0x592322=_0x4b5353?_0x4b5353[_0x47a5('0x83')]:[];return initializeQueues(_0x164d42,_0x479a82,_0x27333e,_0x420671[_0x47a5('0x76')]['type']);})[_0x47a5('0x11')](function(_0x23f055){var _0x5a0901=_0x23f055[_0x47a5('0x84')](function(_0x2a02cd){if(_0x27333e===_0x47a5('0x23'))return getVoiceQueueAgents(_0x2a02cd,_0x164d42,_0xea50f3,_0x592322);else return getQueueAgents(_0x2a02cd,_0xea50f3,_0x27333e);});return Promise['all'](_0x5a0901);})[_0x47a5('0x11')](function(_0x59b4a5){_0x292d9c[_0x47a5('0x83')]=_0x59b4a5;return _0x292d9c;})['then'](respondWithFilteredResult(_0x4f35ff,_0x277486))[_0x47a5('0x18')](handleError(_0x4f35ff,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2db6e77..3986a08 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x43b9af,_0x2c8316){var _0x1df62e=function(_0x2b2e79){while(--_0x2b2e79){_0x43b9af['push'](_0x43b9af['shift']());}};_0x1df62e(++_0x2c8316);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x340c7f,_0x4e962e){var _0x47a92d=function(_0x4ffe60){while(--_0x4ffe60){_0x340c7f['push'](_0x340c7f['shift']());}};_0x47a92d(++_0x4e962e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xcb91[_0x328534];return _0x2796c0;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c32e8e3..6009fc5 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 _0xee3c=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x18d6fa,_0x408303){var _0x2d7b6a=function(_0x879e4d){while(--_0x879e4d){_0x18d6fa['push'](_0x18d6fa['shift']());}};_0x2d7b6a(++_0x408303);}(_0xee3c,0x14a));var _0xcee3=function(_0x4eed58,_0x3a3b9f){_0x4eed58=_0x4eed58-0x0;var _0x4f20f5=_0xee3c[_0x4eed58];return _0x4f20f5;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'state':{'type':Sequelize[_0xcee3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcee3('0x3')]},'scheduledat':{'type':Sequelize[_0xcee3('0x4')]},'uniqueid':{'type':Sequelize[_0xcee3('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xcee3('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xcee3('0x3')]},'campaigntype':{'type':Sequelize[_0xcee3('0x3')]},'membername':{'type':Sequelize[_0xcee3('0x3')]}}; \ No newline at end of file +var _0x3b74=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0xa3da82,_0x3be0c4){var _0x55a74=function(_0x4f0f76){while(--_0x4f0f76){_0xa3da82['push'](_0xa3da82['shift']());}};_0x55a74(++_0x3be0c4);}(_0x3b74,0x80));var _0x43b7=function(_0x44d88c,_0x4e0cb4){_0x44d88c=_0x44d88c-0x0;var _0x508da7=_0x3b74[_0x44d88c];return _0x508da7;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'state':{'type':Sequelize[_0x43b7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x43b7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x43b7('0x3')]},'starttime':{'type':Sequelize[_0x43b7('0x4')]},'responsetime':{'type':Sequelize[_0x43b7('0x4')]},'ringtime':{'type':Sequelize[_0x43b7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x43b7('0x3')]},'membername':{'type':Sequelize[_0x43b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a6c6a49..7338f1d 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 _0x09c6=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','request-promise','path','./reportAgentPreview.attributes','exports'];(function(_0x1eecff,_0x371a8e){var _0x2f7e73=function(_0x5685ed){while(--_0x5685ed){_0x1eecff['push'](_0x1eecff['shift']());}};_0x2f7e73(++_0x371a8e);}(_0x09c6,0x184));var _0x609c=function(_0x51e3c5,_0x266d49){_0x51e3c5=_0x51e3c5-0x0;var _0x35b448=_0x09c6[_0x51e3c5];return _0x35b448;};'use strict';var _=require(_0x609c('0x0'));var util=require(_0x609c('0x1'));var logger=require(_0x609c('0x2'))(_0x609c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x609c('0x4'));var fs=require('fs');var path=require(_0x609c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x609c('0x6'));module[_0x609c('0x7')]=function(_0x312fa1,_0xb7befe){return _0x312fa1[_0x609c('0x8')](_0x609c('0x9'),attributes,{'tableName':_0x609c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1843=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34298b,_0x3e5e07){var _0x28a747=function(_0x4b7124){while(--_0x4b7124){_0x34298b['push'](_0x34298b['shift']());}};_0x28a747(++_0x3e5e07);}(_0x1843,0x1c8));var _0x3184=function(_0x869c80,_0x608979){_0x869c80=_0x869c80-0x0;var _0x5aabd2=_0x1843[_0x869c80];return _0x5aabd2;};'use strict';var _=require(_0x3184('0x0'));var util=require(_0x3184('0x1'));var logger=require(_0x3184('0x2'))(_0x3184('0x3'));var moment=require(_0x3184('0x4'));var BPromise=require(_0x3184('0x5'));var rp=require(_0x3184('0x6'));var fs=require('fs');var path=require(_0x3184('0x7'));var rimraf=require(_0x3184('0x8'));var config=require(_0x3184('0x9'));var attributes=require(_0x3184('0xa'));module[_0x3184('0xb')]=function(_0x524302,_0x65a60){return _0x524302[_0x3184('0xc')](_0x3184('0xd'),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 79d8737..ffe421d 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 _0x6332=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','create','body','options','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f2049,_0x2885d0){var _0xa30094=function(_0x39d919){while(--_0x39d919){_0x1f2049['push'](_0x1f2049['shift']());}};_0xa30094(++_0x2885d0);}(_0x6332,0x19b));var _0x2633=function(_0x24a5bc,_0x5ae7d8){_0x24a5bc=_0x24a5bc-0x0;var _0x153c8c=_0x6332[_0x24a5bc];return _0x153c8c;};'use strict';var _=require(_0x2633('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2633('0x1'));var rs=require(_0x2633('0x2'));var fs=require('fs');var Redis=require(_0x2633('0x3'));var db=require(_0x2633('0x4'))['db'];var utils=require(_0x2633('0x5'));var logger=require(_0x2633('0x6'))('rpc');var config=require(_0x2633('0x7'));var jayson=require(_0x2633('0x8'));var client=jayson[_0x2633('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x650e5f,_0x2c6376,_0x212eb9){return new BPromise(function(_0x363944,_0x45bd07){return client[_0x2633('0xa')](_0x650e5f,_0x212eb9)[_0x2633('0xb')](function(_0x24a909){logger['info'](_0x2633('0xc'),_0x2c6376,_0x2633('0xd'));logger[_0x2633('0xe')](_0x2633('0xf'),_0x2c6376,_0x2633('0xd'),JSON[_0x2633('0x10')](_0x24a909));if(_0x24a909[_0x2633('0x11')]){if(_0x24a909[_0x2633('0x11')][_0x2633('0x12')]===0x1f4){logger[_0x2633('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c6376,_0x24a909[_0x2633('0x11')][_0x2633('0x13')]);return _0x45bd07(_0x24a909[_0x2633('0x11')][_0x2633('0x13')]);}logger['error'](_0x2633('0xc'),_0x2c6376,_0x24a909[_0x2633('0x11')]['message']);return _0x363944(_0x24a909['error'][_0x2633('0x13')]);}else{logger['info'](_0x2633('0xc'),_0x2c6376,_0x2633('0xd'));_0x363944(_0x24a909['result'][_0x2633('0x13')]);}})['catch'](function(_0x36f957){logger[_0x2633('0x11')](_0x2633('0xc'),_0x2c6376,_0x36f957);_0x45bd07(_0x36f957);});});}exports[_0x2633('0x14')]=function(_0x3d220d){var _0x313965=this;return new Promise(function(_0x30e8c8,_0x123371){return db['ReportAgentPreview'][_0x2633('0x15')](_0x3d220d[_0x2633('0x16')],{'raw':_0x3d220d['options']?_0x3d220d[_0x2633('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2633('0xb')](function(_0xac4dfa){logger[_0x2633('0x18')](_0x2633('0x14'),_0x3d220d);logger['debug'](_0x2633('0x14'),_0x3d220d,JSON[_0x2633('0x10')](_0xac4dfa));_0x30e8c8(_0xac4dfa);})[_0x2633('0x19')](function(_0x10f3f1){logger[_0x2633('0x11')](_0x2633('0x14'),_0x10f3f1['message'],_0x3d220d);_0x123371(_0x313965['error'](0x1f4,_0x10f3f1[_0x2633('0x13')]));});});}; \ No newline at end of file +var _0xefa7=['ReportAgentPreview','create','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateReportAgentPreview'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xefa7,0x11e));var _0x7efa=function(_0x114671,_0x3912c5){_0x114671=_0x114671-0x0;var _0x2084f9=_0xefa7[_0x114671];return _0x2084f9;};'use strict';var _=require(_0x7efa('0x0'));var util=require('util');var moment=require(_0x7efa('0x1'));var BPromise=require(_0x7efa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7efa('0x3'));var db=require(_0x7efa('0x4'))['db'];var utils=require(_0x7efa('0x5'));var logger=require(_0x7efa('0x6'))('rpc');var config=require(_0x7efa('0x7'));var jayson=require(_0x7efa('0x8'));var client=jayson['client'][_0x7efa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41346c,_0x3c6119,_0x4dbb75){return new BPromise(function(_0x346b1e,_0xd458ae){return client[_0x7efa('0xa')](_0x41346c,_0x4dbb75)[_0x7efa('0xb')](function(_0x262916){logger['info'](_0x7efa('0xc'),_0x3c6119,'request\x20sent');logger['debug'](_0x7efa('0xd'),_0x3c6119,'request\x20sent',JSON[_0x7efa('0xe')](_0x262916));if(_0x262916['error']){if(_0x262916['error'][_0x7efa('0xf')]===0x1f4){logger['error'](_0x7efa('0xc'),_0x3c6119,_0x262916[_0x7efa('0x10')]['message']);return _0xd458ae(_0x262916[_0x7efa('0x10')][_0x7efa('0x11')]);}logger[_0x7efa('0x10')](_0x7efa('0xc'),_0x3c6119,_0x262916['error'][_0x7efa('0x11')]);return _0x346b1e(_0x262916['error'][_0x7efa('0x11')]);}else{logger[_0x7efa('0x12')](_0x7efa('0xc'),_0x3c6119,'request\x20sent');_0x346b1e(_0x262916[_0x7efa('0x13')][_0x7efa('0x11')]);}})[_0x7efa('0x14')](function(_0x5a9462){logger[_0x7efa('0x10')](_0x7efa('0xc'),_0x3c6119,_0x5a9462);_0xd458ae(_0x5a9462);});});}exports[_0x7efa('0x15')]=function(_0x4512ce){var _0x190e7e=this;return new Promise(function(_0x3976f7,_0x56f458){return db[_0x7efa('0x16')][_0x7efa('0x17')](_0x4512ce[_0x7efa('0x18')],{'raw':_0x4512ce['options']?_0x4512ce[_0x7efa('0x19')][_0x7efa('0x1a')]===undefined?!![]:![]:!![]})[_0x7efa('0xb')](function(_0xf0c8f6){logger['info'](_0x7efa('0x15'),_0x4512ce);logger[_0x7efa('0x1b')](_0x7efa('0x15'),_0x4512ce,JSON[_0x7efa('0xe')](_0xf0c8f6));_0x3976f7(_0xf0c8f6);})[_0x7efa('0x14')](function(_0x5f1dd0){logger[_0x7efa('0x10')](_0x7efa('0x15'),_0x5f1dd0[_0x7efa('0x11')],_0x4512ce);_0x56f458(_0x190e7e[_0x7efa('0x10')](0x1f4,_0x5f1dd0[_0x7efa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3baa49f..f8f852b 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 _0x04c5=['/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated'];(function(_0xa2503f,_0x22d273){var _0x1c704=function(_0x16bc60){while(--_0x16bc60){_0xa2503f['push'](_0xa2503f['shift']());}};_0x1c704(++_0x22d273);}(_0x04c5,0x125));var _0x504c=function(_0x344bf0,_0xae50c4){_0x344bf0=_0x344bf0-0x0;var _0x2ef27a=_0x04c5[_0x344bf0];return _0x2ef27a;};'use strict';var multer=require(_0x504c('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x504c('0x1'));var controller=require('./rpc.controller');router[_0x504c('0x2')](_0x504c('0x3'),auth['isAuthenticated'](),controller[_0x504c('0x4')]);router[_0x504c('0x2')](_0x504c('0x5'),auth[_0x504c('0x6')](),controller['voiceChannelMixMonitor']);router[_0x504c('0x2')](_0x504c('0x7'),auth[_0x504c('0x6')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x504c('0x8'),auth[_0x504c('0x6')](),controller[_0x504c('0x9')]);router[_0x504c('0x2')](_0x504c('0xa'),auth[_0x504c('0x6')](),controller[_0x504c('0xb')]);router['get']('/mail/queues',auth[_0x504c('0x6')](),controller[_0x504c('0xc')]);router[_0x504c('0x2')]('/mail/accounts',auth[_0x504c('0x6')](),controller[_0x504c('0xd')]);router[_0x504c('0x2')](_0x504c('0xe'),auth[_0x504c('0x6')](),controller['openchannelQueues']);router[_0x504c('0x2')](_0x504c('0xf'),auth[_0x504c('0x6')](),controller[_0x504c('0x10')]);router['get']('/whatsapp/queues',auth[_0x504c('0x6')](),controller[_0x504c('0x11')]);router[_0x504c('0x2')](_0x504c('0x12'),auth[_0x504c('0x6')](),controller[_0x504c('0x13')]);router[_0x504c('0x2')](_0x504c('0x14'),auth[_0x504c('0x6')](),controller[_0x504c('0x15')]);router[_0x504c('0x2')](_0x504c('0x16'),auth[_0x504c('0x6')](),controller[_0x504c('0x17')]);router[_0x504c('0x2')](_0x504c('0x18'),auth[_0x504c('0x6')](),controller['voiceQueuesChannel']);router[_0x504c('0x2')](_0x504c('0x19'),auth[_0x504c('0x6')](),controller[_0x504c('0x1a')]);router['get'](_0x504c('0x1b'),auth[_0x504c('0x6')](),controller[_0x504c('0x1c')]);router[_0x504c('0x2')](_0x504c('0x1d'),auth[_0x504c('0x6')](),controller[_0x504c('0x1e')]);router[_0x504c('0x1f')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x504c('0x20')]);router[_0x504c('0x2')](_0x504c('0x21'),auth[_0x504c('0x6')](),controller['outbound']);router['get'](_0x504c('0x22'),auth['isAuthenticated'](),controller[_0x504c('0x23')]);router[_0x504c('0x2')](_0x504c('0x24'),auth[_0x504c('0x6')](),controller['agents']);router[_0x504c('0x1f')](_0x504c('0x25'),auth[_0x504c('0x6')](),controller[_0x504c('0x26')]);router[_0x504c('0x2')](_0x504c('0x27'),auth[_0x504c('0x6')](),controller['telephones']);router[_0x504c('0x2')](_0x504c('0x28'),auth[_0x504c('0x6')](),controller[_0x504c('0x29')]);router[_0x504c('0x2')](_0x504c('0x2a'),auth[_0x504c('0x6')](),controller[_0x504c('0x2b')]);router['get'](_0x504c('0x2c'),auth[_0x504c('0x6')](),controller[_0x504c('0x2d')]);router[_0x504c('0x2')]('/chat/queues/waitinginteractions',auth[_0x504c('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x504c('0x2')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x504c('0x2e')]);router[_0x504c('0x2')](_0x504c('0x2f'),auth[_0x504c('0x6')](),controller[_0x504c('0x30')]);router[_0x504c('0x2')]('/openchannel/queues/:id/waitinginteractions',auth[_0x504c('0x6')](),controller[_0x504c('0x31')]);router[_0x504c('0x2')](_0x504c('0x32'),auth[_0x504c('0x6')](),controller[_0x504c('0x33')]);router[_0x504c('0x2')]('/whatsapp/queues/waitinginteractions',auth[_0x504c('0x6')](),controller[_0x504c('0x34')]);router[_0x504c('0x2')](_0x504c('0x35'),auth[_0x504c('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x504c('0x36')](_0x504c('0x37'),auth[_0x504c('0x6')](),controller[_0x504c('0x38')](_0x504c('0x39')));router['get'](_0x504c('0x3a'),auth[_0x504c('0x6')](),controller[_0x504c('0x3b')]);router[_0x504c('0x36')](_0x504c('0x3c'),auth[_0x504c('0x6')](),controller[_0x504c('0x38')](_0x504c('0x3d')));router['get']('/chat/queues/:id',auth[_0x504c('0x6')](),controller['showChatQueues']);router[_0x504c('0x36')]('/fax/queues/:id/notify',auth[_0x504c('0x6')](),controller[_0x504c('0x38')](_0x504c('0x3e')));router[_0x504c('0x2')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x504c('0x3f')]);router[_0x504c('0x36')](_0x504c('0x40'),auth[_0x504c('0x6')](),controller[_0x504c('0x38')](_0x504c('0x41')));router['get'](_0x504c('0x42'),auth[_0x504c('0x6')](),controller[_0x504c('0x43')]);router['post']('/sms/queues/:id/notify',auth[_0x504c('0x6')](),controller[_0x504c('0x38')]('sms'));router[_0x504c('0x36')](_0x504c('0x44'),auth[_0x504c('0x6')](),controller['queueNotify'](_0x504c('0x45')));router[_0x504c('0x2')](_0x504c('0x46'),auth[_0x504c('0x6')](),controller[_0x504c('0x47')]);router[_0x504c('0x2')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x504c('0x36')](_0x504c('0x48'),auth['isAuthenticated'](),controller[_0x504c('0x49')]);module[_0x504c('0x4a')]=router; \ No newline at end of file +var _0xcb21=['/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions'];(function(_0x2d27eb,_0x160b74){var _0x3b3bbc=function(_0x1f492c){while(--_0x1f492c){_0x2d27eb['push'](_0x2d27eb['shift']());}};_0x3b3bbc(++_0x160b74);}(_0xcb21,0x1b6));var _0x1cb2=function(_0x6866e3,_0x3ddb25){_0x6866e3=_0x6866e3-0x0;var _0x394cfe=_0xcb21[_0x6866e3];return _0x394cfe;};'use strict';var multer=require(_0x1cb2('0x0'));var util=require('util');var path=require(_0x1cb2('0x1'));var express=require(_0x1cb2('0x2'));var router=express[_0x1cb2('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x1cb2('0x4')](_0x1cb2('0x5'),auth['isAuthenticated'](),controller[_0x1cb2('0x6')]);router[_0x1cb2('0x4')](_0x1cb2('0x7'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x9')]);router['get'](_0x1cb2('0xa'),auth[_0x1cb2('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x1cb2('0x4')]('/voice/queues',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0xb')]);router[_0x1cb2('0x4')](_0x1cb2('0xc'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0xd')]);router['get']('/mail/queues',auth[_0x1cb2('0x8')](),controller['mailQueues']);router[_0x1cb2('0x4')]('/mail/accounts',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0xe')]);router['get'](_0x1cb2('0xf'),auth[_0x1cb2('0x8')](),controller['openchannelQueues']);router['get'](_0x1cb2('0x10'),auth[_0x1cb2('0x8')](),controller['smsQueues']);router[_0x1cb2('0x4')](_0x1cb2('0x11'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x12')]);router[_0x1cb2('0x4')](_0x1cb2('0x13'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x14')]);router['get']('/voice/queues/preview/:id',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x15')]);router[_0x1cb2('0x4')](_0x1cb2('0x16'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x17')]);router[_0x1cb2('0x4')](_0x1cb2('0x18'),auth['isAuthenticated'](),controller[_0x1cb2('0x19')]);router[_0x1cb2('0x4')](_0x1cb2('0x1a'),auth[_0x1cb2('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x1cb2('0x1b'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x1c')]);router[_0x1cb2('0x4')]('/voice/queues/:id',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x1d')]);router[_0x1cb2('0x1e')](_0x1cb2('0x1f'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x20')]);router[_0x1cb2('0x4')]('/outbound',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x21')]);router[_0x1cb2('0x4')](_0x1cb2('0x22'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x23')]);router[_0x1cb2('0x4')](_0x1cb2('0x24'),auth[_0x1cb2('0x8')](),controller['agents']);router[_0x1cb2('0x1e')](_0x1cb2('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x1cb2('0x4')](_0x1cb2('0x26'),auth['isAuthenticated'](),controller[_0x1cb2('0x27')]);router[_0x1cb2('0x4')]('/trunks',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x28')]);router[_0x1cb2('0x4')]('/campaigns',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x29')]);router[_0x1cb2('0x4')](_0x1cb2('0x2a'),auth['isAuthenticated'](),controller[_0x1cb2('0x2b')]);router['get'](_0x1cb2('0x2c'),auth['isAuthenticated'](),controller[_0x1cb2('0x2d')]);router[_0x1cb2('0x4')](_0x1cb2('0x2e'),auth[_0x1cb2('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x1cb2('0x4')]('/openchannel/queues/waitinginteractions',auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x2f')]);router[_0x1cb2('0x4')](_0x1cb2('0x30'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x31')]);router['get'](_0x1cb2('0x32'),auth[_0x1cb2('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x1cb2('0x4')](_0x1cb2('0x33'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x34')]);router[_0x1cb2('0x4')](_0x1cb2('0x35'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x36')]);router[_0x1cb2('0x37')](_0x1cb2('0x38'),auth['isAuthenticated'](),controller['queueNotify'](_0x1cb2('0x39')));router['get'](_0x1cb2('0x3a'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x3b')]);router[_0x1cb2('0x37')](_0x1cb2('0x3c'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x3d')](_0x1cb2('0x3e')));router[_0x1cb2('0x4')](_0x1cb2('0x3f'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x40')]);router[_0x1cb2('0x37')](_0x1cb2('0x41'),auth['isAuthenticated'](),controller[_0x1cb2('0x3d')](_0x1cb2('0x42')));router[_0x1cb2('0x4')](_0x1cb2('0x43'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x44')]);router[_0x1cb2('0x37')](_0x1cb2('0x45'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x3d')](_0x1cb2('0x46')));router[_0x1cb2('0x4')](_0x1cb2('0x47'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x1cb2('0x37')](_0x1cb2('0x48'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x3d')](_0x1cb2('0x49')));router['post']('/whatsapp/queues/:id/notify',auth[_0x1cb2('0x8')](),controller['queueNotify']('whatsapp'));router[_0x1cb2('0x4')](_0x1cb2('0x4a'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x4b')]);router[_0x1cb2('0x4')](_0x1cb2('0x4c'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x4d')]);router[_0x1cb2('0x37')](_0x1cb2('0x4e'),auth[_0x1cb2('0x8')](),controller[_0x1cb2('0x4f')]);module[_0x1cb2('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0e21ff1..ce486d9 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 _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x332309,_0x5eff30){var _0x5048cf=function(_0x5b5ef5){while(--_0x5b5ef5){_0x332309['push'](_0x332309['shift']());}};_0x5048cf(++_0x5eff30);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file +var _0x3e74=['http','client','then','error','code','message','result','sendStatus','stack','name','status','isNil','find','rows','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise'];(function(_0x49780d,_0x234efb){var _0x619002=function(_0x1343fa){while(--_0x1343fa){_0x49780d['push'](_0x49780d['shift']());}};_0x619002(++_0x234efb);}(_0x3e74,0x175));var _0x43e7=function(_0x1b8910,_0xb83157){_0x1b8910=_0x1b8910-0x0;var _0x246563=_0x3e74[_0x1b8910];return _0x246563;};'use strict';var BPromise=require(_0x43e7('0x0'));var moment=require('moment');var _=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var db=require(_0x43e7('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x43e7('0x4'));var amiClient=jayson['client'][_0x43e7('0x5')]({'port':0x232a});var mailClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232b});var routingClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){var _0x21f491=_0x3491d6?_0x3491d6:amiClient;return _0x21f491['request'](_0x503698,_0x45a0d1)[_0x43e7('0x7')](function(_0x554d44){if(_0x554d44['error']){if(_0x554d44[_0x43e7('0x8')][_0x43e7('0x9')]===0x1f4){return _0x8528fc(_0x554d44['error'][_0x43e7('0xa')]);}return _0x2ede2d(_0x554d44['error'][_0x43e7('0xa')]);}else{_0x2ede2d(_0x554d44[_0x43e7('0xb')]);}})['catch'](function(_0x3eb206){_0x8528fc(_0x3eb206);});});}function respondWithResult(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xc8;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['status'](_0x2718d3)['json'](_0x3bb83f);}return _0xc960ea[_0x43e7('0xc')](0x194);};}function handleError(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0x1f4;return function(_0x51b974){logger['error'](_0x51b974[_0x43e7('0xd')]);if(_0x51b974[_0x43e7('0xe')]){delete _0x51b974[_0x43e7('0xe')];}_0x21fdd3[_0x43e7('0xf')](_0x44b0bd)['send'](_0x51b974);};}function findById(_0x5c4eaa){return function(_0xdf16c){if(!_[_0x43e7('0x10')](_0x5c4eaa)&&!_[_0x43e7('0x10')](_0xdf16c)&&!_['isNil'](_0xdf16c['rows'])){return _[_0x43e7('0x11')](_0xdf16c[_0x43e7('0x12')],function(_0x9037d3){return _0x9037d3['id']==_0x5c4eaa;});}return null;};}exports[_0x43e7('0x13')]=function(_0x3776f5,_0x1f24fb){return respondWithRpcPromise(_0x43e7('0x14'),_0x3776f5[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x1f24fb,null))[_0x43e7('0x16')](handleError(_0x1f24fb,null));};exports[_0x43e7('0x17')]=function(_0x177ee1,_0x4b5d64){return respondWithRpcPromise(_0x43e7('0x18'),_[_0x43e7('0x19')](_0x177ee1['query'],_0x177ee1[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4b5d64,null))[_0x43e7('0x16')](handleError(_0x4b5d64,null));};exports[_0x43e7('0x1b')]=function(_0x4077fb,_0x2f4cb4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x43e7('0x19')](_0x4077fb['query'],_0x4077fb['params']))[_0x43e7('0x7')](respondWithResult(_0x2f4cb4,null))[_0x43e7('0x16')](handleError(_0x2f4cb4,null));};exports['voiceQueues']=function(_0x1f0673,_0x4ca5cf){return respondWithRpcPromise(_0x43e7('0x1c'),_0x1f0673['query'])[_0x43e7('0x7')](respondWithResult(_0x4ca5cf,null))[_0x43e7('0x16')](handleError(_0x4ca5cf,null));};exports[_0x43e7('0x1d')]=function(_0x405f85,_0x51f4d7){return respondWithRpcPromise('VoiceQueues',_0x405f85[_0x43e7('0x15')])['then'](findById(_0x405f85[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x51f4d7,null))[_0x43e7('0x16')](handleError(_0x51f4d7,null));};exports[_0x43e7('0x1e')]=function(_0x5087d7,_0x33a1a5){return respondWithRpcPromise(_0x43e7('0x1f'),_[_0x43e7('0x19')](_0x5087d7[_0x43e7('0x20')],_0x5087d7[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x33a1a5,null))[_0x43e7('0x16')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x21')]=function(_0x3bf475,_0x35dbcd){return respondWithRpcPromise(_0x43e7('0x22'),_[_0x43e7('0x19')](_0x3bf475[_0x43e7('0x15')],_0x3bf475[_0x43e7('0x1a')]))['then'](respondWithResult(_0x35dbcd,null))[_0x43e7('0x16')](handleError(_0x35dbcd,null));};exports[_0x43e7('0x23')]=function(_0x3b8f78,_0x183c81){return respondWithRpcPromise(_0x43e7('0x24'),_0x3b8f78['query'])[_0x43e7('0x7')](respondWithResult(_0x183c81,null))[_0x43e7('0x16')](handleError(_0x183c81,null));};exports[_0x43e7('0x25')]=function(_0x3f280d,_0x4c61b9){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f280d[_0x43e7('0x15')],_0x3f280d[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4c61b9,null))[_0x43e7('0x16')](handleError(_0x4c61b9,null));};exports[_0x43e7('0x26')]=function(_0xde7ed,_0x485c6c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0xde7ed['query'],_0xde7ed['params']))['then'](respondWithResult(_0x485c6c,null))['catch'](handleError(_0x485c6c,null));};exports[_0x43e7('0x27')]=function(_0x49cda6,_0x2b4bfd){return respondWithRpcPromise(_0x43e7('0x28'),_[_0x43e7('0x19')](_0x49cda6[_0x43e7('0x15')],_0x49cda6[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x2b4bfd,null))[_0x43e7('0x16')](handleError(_0x2b4bfd,null));};exports['outbound']=function(_0x5332d9,_0x5d84f4){return respondWithRpcPromise(_0x43e7('0x29'),_0x5332d9[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x5d84f4,null))[_0x43e7('0x16')](handleError(_0x5d84f4,null));};exports[_0x43e7('0x2a')]=function(_0x1ed538,_0x1d4589){return respondWithRpcPromise(_0x43e7('0x2b'),_0x1ed538['query'])[_0x43e7('0x7')](respondWithResult(_0x1d4589,null))[_0x43e7('0x16')](handleError(_0x1d4589,null));};exports['agents']=function(_0x2d54c1,_0x4c0c7a){var _0x44d8e4;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1[_0x43e7('0x15')])[_0x43e7('0x7')](function(_0x35ac85){_0x44d8e4=_0x35ac85;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1['query'],routingClient);})['then'](function(_0x30dfa9){return _[_0x43e7('0x19')]({},_0x30dfa9,_0x44d8e4);})[_0x43e7('0x7')](respondWithResult(_0x4c0c7a,null))[_0x43e7('0x16')](handleError(_0x4c0c7a,null));};exports[_0x43e7('0x2d')]=function(_0x4a4a85,_0x32a451){if(_0x4a4a85[_0x43e7('0x20')]&&_0x4a4a85['body'][_0x43e7('0x2e')]&&_0x4a4a85['user']&&_0x4a4a85[_0x43e7('0x2f')]['name']){for(var _0x3d81ae in _0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')]){if(_0x4a4a85[_0x43e7('0x20')]['interaction']['hasOwnProperty'](_0x3d81ae)){db[_0x43e7('0x30')][_0x43e7('0x31')]({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae]&&_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x43e7('0x32')]?{'$notIn':_0x4a4a85['body']['interaction'][_0x3d81ae]}:{'$ne':null}}})[_0x43e7('0x7')](function(_0x5ee1c5){var _0x2de14f=moment()[_0x43e7('0x33')](_0x43e7('0x34'));for(var _0x99b9e1=0x0,_0x4fc5e8=_0x5ee1c5[_0x43e7('0x32')];_0x99b9e1<_0x4fc5e8;_0x99b9e1+=0x1){_0x5ee1c5[_0x99b9e1][_0x43e7('0x35')]({'exitAt':_0x2de14f});}});for(var _0x23a611=0x0;_0x23a611<_0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')][_0x3d81ae][_0x43e7('0x32')];_0x23a611+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':_0x43e7('0x36'),'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae][_0x23a611],'exitAt':null},'defaults':{'channel':_0x3d81ae,'membername':_0x4a4a85['user'][_0x43e7('0xe')],'interface':_[_0x43e7('0x10')](_0x4a4a85['user'][_0x43e7('0x37')])?util[_0x43e7('0x33')](_0x43e7('0x38'),_0x4a4a85['user']['name']):_0x4a4a85['user']['interface'],'type':_0x43e7('0x36'),'enterAt':moment()[_0x43e7('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43e7('0x39'),'internal':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0x3a')],'uniqueid':_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x23a611]}});}}}}return respondWithRpcPromise(_0x43e7('0x3b'),{'id':_0x4a4a85['params']['id'],'capacity':_0x4a4a85['body'][_0x43e7('0x3c')]},routingClient)[_0x43e7('0x7')](respondWithResult(_0x32a451,null))[_0x43e7('0x16')](handleError(_0x32a451,null));};exports[_0x43e7('0x3d')]=function(_0x13503c,_0x2351cf){return respondWithRpcPromise(_0x43e7('0x3e'),_0x13503c[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x2351cf,null))[_0x43e7('0x16')](handleError(_0x2351cf,null));};exports['trunks']=function(_0x119d34,_0x46c910){return respondWithRpcPromise('Trunks',_0x119d34[_0x43e7('0x15')])['then'](respondWithResult(_0x46c910,null))[_0x43e7('0x16')](handleError(_0x46c910,null));};exports[_0x43e7('0x3f')]=function(_0x34e2ec,_0x1f561f){return respondWithRpcPromise(_0x43e7('0x40'),_0x34e2ec['query'])['then'](respondWithResult(_0x1f561f,null))[_0x43e7('0x16')](handleError(_0x1f561f,null));};exports[_0x43e7('0x41')]=function(_0x399942,_0x29c53d){return respondWithRpcPromise(_0x43e7('0x42'),_0x399942[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x29c53d,null))[_0x43e7('0x16')](handleError(_0x29c53d,null));};exports[_0x43e7('0x43')]=function(_0x24e758,_0x312306){return respondWithRpcPromise('ChatQueues',_0x24e758[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x24e758['params']['id']))[_0x43e7('0x7')](respondWithResult(_0x312306,null))[_0x43e7('0x16')](handleError(_0x312306,null));};exports[_0x43e7('0x44')]=function(_0x558d54,_0x5d63c6){return respondWithRpcPromise(_0x43e7('0x45'),_0x558d54[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x5d63c6,null))[_0x43e7('0x16')](handleError(_0x5d63c6,null));};exports['showMailQueues']=function(_0x49a6ce,_0x1fa3f6){return respondWithRpcPromise(_0x43e7('0x45'),_0x49a6ce[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x49a6ce[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1fa3f6,null))[_0x43e7('0x16')](handleError(_0x1fa3f6,null));};exports[_0x43e7('0x46')]=function(_0x4d89bd,_0x20283b){return respondWithRpcPromise(_0x43e7('0x47'),_0x4d89bd[_0x43e7('0x15')],mailClient)['then'](respondWithResult(_0x20283b,null))['catch'](handleError(_0x20283b,null));};exports['openchannelQueues']=function(_0x2ada55,_0x4058ce){return respondWithRpcPromise(_0x43e7('0x48'),_0x2ada55[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x4058ce,null))['catch'](handleError(_0x4058ce,null));};exports[_0x43e7('0x49')]=function(_0x8b50bb,_0x140438){return respondWithRpcPromise(_0x43e7('0x48'),_0x8b50bb['query'],routingClient)[_0x43e7('0x7')](findById(_0x8b50bb[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x140438,null))[_0x43e7('0x16')](handleError(_0x140438,null));};exports[_0x43e7('0x4a')]=function(_0xd41e79,_0x4665db){return respondWithRpcPromise(_0x43e7('0x4b'),_0xd41e79[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x4665db,null))[_0x43e7('0x16')](handleError(_0x4665db,null));};exports['showSmsQueues']=function(_0x5f3824,_0x2b0711){return respondWithRpcPromise('SmsQueues',_0x5f3824['query'],routingClient)['then'](findById(_0x5f3824[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x2b0711,null))['catch'](handleError(_0x2b0711,null));};exports[_0x43e7('0x4c')]=function(_0x135791,_0x1d8438){return respondWithRpcPromise('WhatsappQueues',_0x135791[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x1d8438,null))[_0x43e7('0x16')](handleError(_0x1d8438,null));};exports[_0x43e7('0x4d')]=function(_0x2f43d7,_0x472a19){return respondWithRpcPromise(_0x43e7('0x4e'),_0x2f43d7['query'],routingClient)[_0x43e7('0x7')](findById(_0x2f43d7[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x472a19,null))['catch'](handleError(_0x472a19,null));};exports['faxQueues']=function(_0x30377a,_0x5c3ad8){return respondWithRpcPromise('FaxQueues',_0x30377a[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5c3ad8,null))['catch'](handleError(_0x5c3ad8,null));};exports[_0x43e7('0x4f')]=function(_0x28b21d,_0x1e2fed){return respondWithRpcPromise(_0x43e7('0x50'),_0x28b21d[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x28b21d[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1e2fed,null))[_0x43e7('0x16')](handleError(_0x1e2fed,null));};exports[_0x43e7('0x51')]=function(_0x4e5956,_0x418213){return respondWithRpcPromise('FaxAccounts',_0x4e5956[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x418213,null))[_0x43e7('0x16')](handleError(_0x418213,null));};exports[_0x43e7('0x52')]=function(_0x506361,_0x2d25b5){return respondWithRpcPromise(_0x43e7('0x53'),_0x506361[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x2d25b5,null))[_0x43e7('0x16')](handleError(_0x2d25b5,null));};exports[_0x43e7('0x54')]=function(_0x219dc6,_0x703a30){return respondWithRpcPromise(_0x43e7('0x55'),_0x219dc6['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x703a30,null))[_0x43e7('0x16')](handleError(_0x703a30,null));};exports[_0x43e7('0x56')]=function(_0x2499ef,_0x433d3c){return respondWithRpcPromise(_0x43e7('0x57'),_0x2499ef[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x433d3c,null))['catch'](handleError(_0x433d3c,null));};exports[_0x43e7('0x58')]=function(_0x536477,_0x550036){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x536477[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](function(_0x230fda){if(_0x536477[_0x43e7('0x15')][_0x43e7('0x59')]!==undefined){var _0x1ae0c8=_(_0x230fda['rows'])[_0x43e7('0x5a')]([_0x536477[_0x43e7('0x15')][_0x43e7('0x59')],_0x536477['params']['id']])[_0x43e7('0x5b')](_0x43e7('0x5c'))[_0x43e7('0x5d')]()[_0x43e7('0x5e')]();return _0x230fda[_0x43e7('0x12')][_0x43e7('0x5a')](function(_0x1d4a29){return _0x1ae0c8[_0x43e7('0x5f')](_0x1d4a29['queue_id'])>-0x1;});}else{return _0x230fda['rows']['filter'](function(_0x156074){return _0x156074[_0x43e7('0x5c')]===parseInt(_0x536477['params']['id']);});}})[_0x43e7('0x7')](respondWithResult(_0x550036,null))[_0x43e7('0x16')](handleError(_0x550036,null));};exports[_0x43e7('0x60')]=function(_0x8e60f1,_0x5a5565){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x8e60f1['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5a5565,null))[_0x43e7('0x16')](handleError(_0x5a5565,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x58cbb7,_0x21adf7){return respondWithRpcPromise(_0x43e7('0x61'),_0x58cbb7[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x21adf7,null))[_0x43e7('0x16')](handleError(_0x21adf7,null));};exports[_0x43e7('0x62')]=function(_0x401654,_0xb04082){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x401654[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0xb04082,null))[_0x43e7('0x16')](handleError(_0xb04082,null));};exports[_0x43e7('0x63')]=function(_0x24a168){return function(_0x90667c,_0xa7cb2c){var _0x45adef,_0x126133;var _0x5e8d4e=_[_0x43e7('0x64')](_0x24a168);var _0x40257e=_0x24a168===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x5e8d4e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x90667c[_0x43e7('0x1a')]['id']}})['then'](function(_0x240f0d){if(_[_0x43e7('0x10')](_0x240f0d)){throw new Error(_0x5e8d4e+_0x43e7('0x67'));}_0x45adef=_0x240f0d;return db[_0x5e8d4e+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x90667c[_0x43e7('0x20')][_0x43e7('0x6a')]},'include':[{'model':db[_0x5e8d4e+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x5e8d4e+_0x40257e],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x5b3565){if(_[_0x43e7('0x10')](_0x5b3565)){throw new Error(_0x5e8d4e+_0x43e7('0x6d'));}_0x126133=_0x5b3565;return _0x5b3565[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x206e54={'uniqueid':_0x24a168+'.'+_0x126133['id']+'.'+_0x126133['Interaction']['id'],'FromUserId':_0x90667c['user']['id'],'type':_0x43e7('0x6f')};_0x206e54[_0x5e8d4e+_0x43e7('0x70')]=_0x126133['id'];_0x206e54[_0x5e8d4e+'InteractionId']=_0x126133[_0x43e7('0x6b')]['id'];_0x206e54[_0x43e7('0x71')+_0x5e8d4e+_0x40257e+'Id']=_0x126133['Account']['id'];_0x206e54['To'+_0x5e8d4e+'QueueId']=_0x45adef['id'];return db[_0x5e8d4e+_0x43e7('0x72')][_0x43e7('0x73')](_0x206e54);})[_0x43e7('0x7')](function(){return respondWithRpcPromise(_0x43e7('0x74'),{'channel':_0x24a168,'interaction':_0x126133[_0x43e7('0x6b')],'message':_0x126133,'account':_0x126133['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45adef[_0x43e7('0xe')]+','+(_0x126133[_0x43e7('0x6c')][_0x43e7('0x75')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})['then'](respondWithResult(_0xa7cb2c,null))[_0x43e7('0x16')](handleError(_0xa7cb2c,null));};};exports[_0x43e7('0x77')]=function(_0x1ed590,_0x15ee83){var _0x5bc060,_0x3a4962;if(_[_0x43e7('0x10')](_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')])){throw new Error(_0x43e7('0x79'));}var _0x4ef289=_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')];var _0x509d8d=_[_0x43e7('0x64')](_0x4ef289);var _0x2ca6fb=_0x4ef289===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x43e7('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x1ed590[_0x43e7('0x1a')]['id'],'role':_0x43e7('0x39')}})[_0x43e7('0x7')](function(_0x2614ff){if(_[_0x43e7('0x10')](_0x2614ff)){throw new Error(_0x43e7('0x7b'));}_0x5bc060=_0x2614ff;return db[_0x509d8d+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x1ed590[_0x43e7('0x20')]['messageId']},'include':[{'model':db[_0x509d8d+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x509d8d+_0x2ca6fb],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x56593f){if(_['isNil'](_0x56593f)){throw new Error(_0x509d8d+_0x43e7('0x6d'));}_0x3a4962=_0x56593f;return _0x56593f[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x4d30f7={'uniqueid':_0x4ef289+'.'+_0x3a4962['id']+'.'+_0x3a4962[_0x43e7('0x6b')]['id'],'FromUserId':_0x1ed590['user']['id'],'type':'queue','ToUserId':_0x5bc060['id']};_0x4d30f7[_0x509d8d+'MessageId']=_0x3a4962['id'];_0x4d30f7[_0x509d8d+_0x43e7('0x7c')]=_0x3a4962['Interaction']['id'];_0x4d30f7[_0x43e7('0x71')+_0x509d8d+_0x2ca6fb+'Id']=_0x3a4962[_0x43e7('0x6c')]['id'];return db[_0x509d8d+_0x43e7('0x72')][_0x43e7('0x73')](_0x4d30f7);})[_0x43e7('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x4ef289,'interaction':_0x3a4962['Interaction'],'message':_0x3a4962,'account':_0x3a4962[_0x43e7('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x43e7('0x39'),'appdata':_0x5bc060['name']+','+(_0x3a4962[_0x43e7('0x6c')][_0x43e7('0x7d')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})[_0x43e7('0x7')](respondWithResult(_0x15ee83,null))[_0x43e7('0x16')](handleError(_0x15ee83,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1b804f8..2c445ae 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 _0xbd78=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','create','put','update','delete','destroy','util','path','Router','fs-extra'];(function(_0x49344d,_0x48bf10){var _0x1c8bd4=function(_0x5d3048){while(--_0x5d3048){_0x49344d['push'](_0x49344d['shift']());}};_0x1c8bd4(++_0x48bf10);}(_0xbd78,0x10a));var _0x8bd7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbd78[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x8bd7('0x0'));var path=require(_0x8bd7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bd7('0x2')]();var fs_extra=require(_0x8bd7('0x3'));var auth=require(_0x8bd7('0x4'));var interaction=require(_0x8bd7('0x5'));var config=require(_0x8bd7('0x6'));var controller=require(_0x8bd7('0x7'));router[_0x8bd7('0x8')]('/',auth[_0x8bd7('0x9')](),controller[_0x8bd7('0xa')]);router[_0x8bd7('0x8')](_0x8bd7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8bd7('0x8')](_0x8bd7('0xc'),auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0x8bd7('0x9')](),controller[_0x8bd7('0xd')]);router[_0x8bd7('0xe')](_0x8bd7('0xb'),auth[_0x8bd7('0x9')](),controller[_0x8bd7('0xf')]);router[_0x8bd7('0x10')]('/:id',auth[_0x8bd7('0x9')](),controller[_0x8bd7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1c37=['/:id/run','run','post','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','get','/:id','isAuthenticated','show'];(function(_0x54fcd6,_0x2f11f5){var _0xe393f7=function(_0x562a77){while(--_0x562a77){_0x54fcd6['push'](_0x54fcd6['shift']());}};_0xe393f7(++_0x2f11f5);}(_0x1c37,0xee));var _0x71c3=function(_0x10b8e1,_0x1f4048){_0x10b8e1=_0x10b8e1-0x0;var _0x5bb2aa=_0x1c37[_0x10b8e1];return _0x5bb2aa;};'use strict';var multer=require(_0x71c3('0x0'));var util=require(_0x71c3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x71c3('0x2'));var router=express[_0x71c3('0x3')]();var fs_extra=require(_0x71c3('0x4'));var auth=require(_0x71c3('0x5'));var interaction=require(_0x71c3('0x6'));var config=require(_0x71c3('0x7'));var controller=require(_0x71c3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x71c3('0x9')]);router[_0x71c3('0xa')](_0x71c3('0xb'),auth[_0x71c3('0xc')](),controller[_0x71c3('0xd')]);router[_0x71c3('0xa')](_0x71c3('0xe'),auth['isAuthenticated'](),controller[_0x71c3('0xf')]);router[_0x71c3('0x10')]('/',auth[_0x71c3('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x71c3('0x11')]);router[_0x71c3('0x12')](_0x71c3('0xb'),auth[_0x71c3('0xc')](),controller[_0x71c3('0x13')]);module[_0x71c3('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 8a407ad..af453e3 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 _0x937f=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default','custom','TEXT'];(function(_0x5ea589,_0x1c9d76){var _0x1ecfee=function(_0x4584bf){while(--_0x4584bf){_0x5ea589['push'](_0x5ea589['shift']());}};_0x1ecfee(++_0x1c9d76);}(_0x937f,0xe7));var _0xf937=function(_0x2f0cad,_0x41fbbb){_0x2f0cad=_0x2f0cad-0x0;var _0x4049c2=_0x937f[_0x2f0cad];return _0x4049c2;};'use strict';var Sequelize=require(_0xf937('0x0'));module[_0xf937('0x1')]={'name':{'type':Sequelize[_0xf937('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf937('0x2')]},'active':{'type':Sequelize[_0xf937('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf937('0x2')],'allowNull':![],'defaultValue':_0xf937('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xf937('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf937('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf937('0x7')](_0xf937('0x8'),_0xf937('0x9'),_0xf937('0xa'),_0xf937('0xb'),_0xf937('0xc'),_0xf937('0xd'),_0xf937('0xe')),'allowNull':![],'defaultValue':_0xf937('0xc')},'output':{'type':Sequelize['ENUM'](_0xf937('0xf'),_0xf937('0x10'),_0xf937('0x11')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xf937('0x7')]('custom',_0xf937('0x12')),'allowNull':![],'defaultValue':_0xf937('0x13')},'sendMail':{'type':Sequelize[_0xf937('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf937('0x2')]},'cc':{'type':Sequelize[_0xf937('0x14')]},'bcc':{'type':Sequelize[_0xf937('0x14')]},'sendIfEmpty':{'type':Sequelize[_0xf937('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0e75=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','weeks','days','hours','minutes','pdf','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x4c6058,_0x4b5868){var _0x8d1b4c=function(_0x3f126f){while(--_0x3f126f){_0x4c6058['push'](_0x4c6058['shift']());}};_0x8d1b4c(++_0x4b5868);}(_0x0e75,0x1f4));var _0x50e7=function(_0x4d08e9,_0x27514c){_0x4d08e9=_0x4d08e9-0x0;var _0x515ae9=_0x0e75[_0x4d08e9];return _0x515ae9;};'use strict';var Sequelize=require(_0x50e7('0x0'));module[_0x50e7('0x1')]={'name':{'type':Sequelize[_0x50e7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x50e7('0x2')]},'active':{'type':Sequelize[_0x50e7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x50e7('0x2')],'allowNull':![],'defaultValue':_0x50e7('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x50e7('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x50e7('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x50e7('0x7')]('years',_0x50e7('0x8'),'months',_0x50e7('0x9'),_0x50e7('0xa'),_0x50e7('0xb'),_0x50e7('0xc')),'allowNull':![],'defaultValue':_0x50e7('0xa')},'output':{'type':Sequelize[_0x50e7('0x7')]('csv',_0x50e7('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x50e7('0xe')},'type':{'type':Sequelize[_0x50e7('0x7')]('custom',_0x50e7('0xf')),'allowNull':![],'defaultValue':_0x50e7('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x50e7('0x2')]},'cc':{'type':Sequelize[_0x50e7('0x11')]},'bcc':{'type':Sequelize[_0x50e7('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x50e7('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 511b6a0..287eb08 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 _0x9023=['status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','run','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x8887d7,_0x8d89d3){var _0x4df1d9=function(_0x5b4466){while(--_0x5b4466){_0x8887d7['push'](_0x8887d7['shift']());}};_0x4df1d9(++_0x8d89d3);}(_0x9023,0x134));var _0x3902=function(_0x512ebd,_0x5ed256){_0x512ebd=_0x512ebd-0x0;var _0x11b6c2=_0x9023[_0x512ebd];return _0x11b6c2;};'use strict';var emlformat=require(_0x3902('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3902('0x1'));var jsonpatch=require(_0x3902('0x2'));var rp=require('request-promise');var moment=require(_0x3902('0x3'));var BPromise=require(_0x3902('0x4'));var Mustache=require('mustache');var util=require(_0x3902('0x5'));var path=require('path');var sox=require(_0x3902('0x6'));var csv=require(_0x3902('0x7'));var ejs=require(_0x3902('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3902('0x9'));var squel=require('squel');var crypto=require(_0x3902('0xa'));var jsforce=require(_0x3902('0xb'));var deskjs=require(_0x3902('0xc'));var toCsv=require(_0x3902('0x7'));var querystring=require(_0x3902('0xd'));var Papa=require(_0x3902('0xe'));var Redis=require('ioredis');var authService=require(_0x3902('0xf'));var qs=require(_0x3902('0x10'));var as=require(_0x3902('0x11'));var hardwareService=require(_0x3902('0x12'));var logger=require(_0x3902('0x13'))('api');var utils=require(_0x3902('0x14'));var config=require(_0x3902('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3902('0x16'))['db'];function respondWithStatusCode(_0x26e1f6,_0x52f3f2){_0x52f3f2=_0x52f3f2||0xcc;return function(_0x22d850){if(_0x22d850){return _0x26e1f6[_0x3902('0x17')](_0x52f3f2);}return _0x26e1f6[_0x3902('0x18')](_0x52f3f2)[_0x3902('0x19')]();};}function respondWithResult(_0x86d22b,_0x21113c){_0x21113c=_0x21113c||0xc8;return function(_0x1698da){if(_0x1698da){return _0x86d22b[_0x3902('0x18')](_0x21113c)[_0x3902('0x1a')](_0x1698da);}};}function respondWithFilteredResult(_0x1bb32b,_0x23a6e8){return function(_0x9d653c){if(_0x9d653c){var _0x65ad81=typeof _0x23a6e8['offset']===_0x3902('0x1b')&&typeof _0x23a6e8['limit']===_0x3902('0x1b');var _0x4d1a43=_0x9d653c[_0x3902('0x1c')];var _0x1b55a0=_0x65ad81?0x0:_0x23a6e8[_0x3902('0x1d')];var _0x32e3ed=_0x65ad81?_0x9d653c[_0x3902('0x1c')]:_0x23a6e8[_0x3902('0x1d')]+_0x23a6e8['limit'];var _0x2fa693;if(_0x32e3ed>=_0x4d1a43){_0x32e3ed=_0x4d1a43;_0x2fa693=0xc8;}else{_0x2fa693=0xce;}_0x1bb32b['status'](_0x2fa693);return _0x1bb32b[_0x3902('0x1e')](_0x3902('0x1f'),_0x1b55a0+'-'+_0x32e3ed+'/'+_0x4d1a43)['json'](_0x9d653c);}return null;};}function patchUpdates(_0x5d0fc){return function(_0x4224e5){try{jsonpatch[_0x3902('0x20')](_0x4224e5,_0x5d0fc,!![]);}catch(_0x1ade87){return BPromise[_0x3902('0x21')](_0x1ade87);}return _0x4224e5[_0x3902('0x22')]();};}function saveUpdates(_0x414142,_0x330cae){return function(_0xae9075){if(_0xae9075){return _0xae9075[_0x3902('0x23')](_0x414142)[_0x3902('0x24')](function(_0x1bb49f){return _0x1bb49f;});}return null;};}function removeEntity(_0x9a09a9,_0x5958e2){return function(_0x8cec27){if(_0x8cec27){return _0x8cec27[_0x3902('0x25')]()[_0x3902('0x24')](function(){var _0x4d441c=_0x8cec27['get']({'plain':!![]});var _0x32ab04='Scheduler';return db['UserProfileResource'][_0x3902('0x25')]({'where':{'type':_0x32ab04,'resourceId':_0x4d441c['id']}})['then'](function(){return _0x8cec27;});})['then'](function(){_0x9a09a9[_0x3902('0x18')](0xcc)[_0x3902('0x19')]();});}};}function handleEntityNotFound(_0x1c990e,_0x43da25){return function(_0x4949a3){if(!_0x4949a3){_0x1c990e[_0x3902('0x17')](0x194);}return _0x4949a3;};}function handleError(_0xcf063,_0x3a4b34){_0x3a4b34=_0x3a4b34||0x1f4;return function(_0x39f289){logger[_0x3902('0x26')](_0x39f289[_0x3902('0x27')]);if(_0x39f289[_0x3902('0x28')]){delete _0x39f289['name'];}_0xcf063[_0x3902('0x18')](_0x3a4b34)['send'](_0x39f289);};}exports['index']=function(_0xda0f8d,_0x10657d){var _0x3b6927={},_0x17f7cc={},_0x34bcee={'count':0x0,'rows':[]};var _0x283e65=_[_0x3902('0x29')](db[_0x3902('0x2a')][_0x3902('0x2b')],function(_0x586f4a){return{'name':_0x586f4a[_0x3902('0x2c')],'type':_0x586f4a[_0x3902('0x2d')][_0x3902('0x2e')]};});_0x17f7cc[_0x3902('0x2f')]=_[_0x3902('0x29')](_0x283e65,_0x3902('0x28'));_0x17f7cc[_0x3902('0x30')]=_[_0x3902('0x31')](_0xda0f8d[_0x3902('0x30')]);_0x17f7cc[_0x3902('0x32')]=_[_0x3902('0x33')](_0x17f7cc['model'],_0x17f7cc['query']);_0x3b6927[_0x3902('0x34')]=_[_0x3902('0x33')](_0x17f7cc[_0x3902('0x2f')],qs[_0x3902('0x35')](_0xda0f8d[_0x3902('0x30')][_0x3902('0x35')]));_0x3b6927[_0x3902('0x34')]=_0x3b6927[_0x3902('0x34')]['length']?_0x3b6927['attributes']:_0x17f7cc['model'];if(!_0xda0f8d[_0x3902('0x30')][_0x3902('0x36')](_0x3902('0x37'))){_0x3b6927[_0x3902('0x38')]=qs['limit'](_0xda0f8d['query'][_0x3902('0x38')]);_0x3b6927[_0x3902('0x1d')]=qs[_0x3902('0x1d')](_0xda0f8d[_0x3902('0x30')][_0x3902('0x1d')]);}_0x3b6927['order']=qs[_0x3902('0x39')](_0xda0f8d[_0x3902('0x30')][_0x3902('0x39')]);_0x3b6927[_0x3902('0x3a')]=qs[_0x3902('0x32')](_[_0x3902('0x3b')](_0xda0f8d[_0x3902('0x30')],_0x17f7cc[_0x3902('0x32')]),_0x283e65);if(_0xda0f8d['query'][_0x3902('0x3c')]){_0x3b6927[_0x3902('0x3a')]=_[_0x3902('0x3d')](_0x3b6927[_0x3902('0x3a')],{'$or':_[_0x3902('0x29')](_0x283e65,function(_0x5619f7){if(_0x5619f7[_0x3902('0x2d')]!==_0x3902('0x3e')){var _0x2579e3={};_0x2579e3[_0x5619f7['name']]={'$like':'%'+_0xda0f8d['query'][_0x3902('0x3c')]+'%'};return _0x2579e3;}})});}_0x3b6927=_[_0x3902('0x3d')]({},_0x3b6927,_0xda0f8d['options']);var _0x5ca50e={'where':_0x3b6927[_0x3902('0x3a')]};return db[_0x3902('0x2a')][_0x3902('0x1c')](_0x5ca50e)[_0x3902('0x24')](function(_0x5a4314){_0x34bcee[_0x3902('0x1c')]=_0x5a4314;if(_0xda0f8d[_0x3902('0x30')]['includeAll']){_0x3b6927[_0x3902('0x3f')]=[{'all':!![]}];}return db[_0x3902('0x2a')][_0x3902('0x40')](_0x3b6927);})[_0x3902('0x24')](function(_0x5dc8e3){_0x34bcee[_0x3902('0x41')]=_0x5dc8e3;return _0x34bcee;})['then'](respondWithFilteredResult(_0x10657d,_0x3b6927))[_0x3902('0x42')](handleError(_0x10657d,null));};exports[_0x3902('0x43')]=function(_0x1e58bc,_0x35d043){var _0x374dd5={'raw':![],'where':{'id':_0x1e58bc[_0x3902('0x44')]['id']}},_0x3b198d={};_0x3b198d[_0x3902('0x2f')]=_[_0x3902('0x31')](db[_0x3902('0x2a')][_0x3902('0x2b')]);_0x3b198d[_0x3902('0x30')]=_['keys'](_0x1e58bc['query']);_0x3b198d[_0x3902('0x32')]=_['intersection'](_0x3b198d[_0x3902('0x2f')],_0x3b198d[_0x3902('0x30')]);_0x374dd5['attributes']=_[_0x3902('0x33')](_0x3b198d[_0x3902('0x2f')],qs['fields'](_0x1e58bc[_0x3902('0x30')][_0x3902('0x35')]));_0x374dd5[_0x3902('0x34')]=_0x374dd5['attributes']['length']?_0x374dd5[_0x3902('0x34')]:_0x3b198d['model'];if(_0x1e58bc['query']['includeAll']){_0x374dd5['include']=[{'all':!![]}];}_0x374dd5=_[_0x3902('0x3d')]({},_0x374dd5,_0x1e58bc[_0x3902('0x45')]);return db[_0x3902('0x2a')][_0x3902('0x46')](_0x374dd5)[_0x3902('0x24')](handleEntityNotFound(_0x35d043,null))[_0x3902('0x24')](respondWithResult(_0x35d043,null))[_0x3902('0x42')](handleError(_0x35d043,null));};exports['create']=function(_0xf2cfd9,_0x38efe9){return db[_0x3902('0x2a')]['create'](_0xf2cfd9[_0x3902('0x47')],{})['then'](function(_0x467627){var _0x209338=_0xf2cfd9[_0x3902('0x48')][_0x3902('0x49')]({'plain':!![]});if(!_0x209338)throw new Error(_0x3902('0x4a'));if(_0x209338[_0x3902('0x4b')]===_0x3902('0x48')){var _0x3bace1=_0x467627[_0x3902('0x49')]({'plain':!![]});var _0x120257=_0x3902('0x4c');return db[_0x3902('0x4d')][_0x3902('0x46')]({'where':{'name':_0x120257,'userProfileId':_0x209338[_0x3902('0x4e')]},'raw':!![]})[_0x3902('0x24')](function(_0x2e6fd6){if(_0x2e6fd6&&_0x2e6fd6[_0x3902('0x4f')]===0x0){return db[_0x3902('0x50')][_0x3902('0x51')]({'name':_0x3bace1['name'],'resourceId':_0x3bace1['id'],'type':_0x2e6fd6[_0x3902('0x28')],'sectionId':_0x2e6fd6['id']},{})[_0x3902('0x24')](function(){return _0x467627;});}else{return _0x467627;}})['catch'](function(_0x4c5f27){logger[_0x3902('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c5f27);throw _0x4c5f27;});}return _0x467627;})[_0x3902('0x24')](respondWithResult(_0x38efe9,0xc9))[_0x3902('0x42')](handleError(_0x38efe9,null));};exports['update']=function(_0x38b1e1,_0x13c95e){if(_0x38b1e1['body']['id']){delete _0x38b1e1[_0x3902('0x47')]['id'];}return db['Schedule']['find']({'where':{'id':_0x38b1e1[_0x3902('0x44')]['id']}})[_0x3902('0x24')](handleEntityNotFound(_0x13c95e,null))[_0x3902('0x24')](saveUpdates(_0x38b1e1[_0x3902('0x47')],null))['then'](respondWithResult(_0x13c95e,null))[_0x3902('0x42')](handleError(_0x13c95e,null));};exports[_0x3902('0x25')]=function(_0x18d54a,_0x8a0e66){return db[_0x3902('0x2a')][_0x3902('0x46')]({'where':{'id':_0x18d54a[_0x3902('0x44')]['id']}})[_0x3902('0x24')](handleEntityNotFound(_0x8a0e66,null))[_0x3902('0x24')](removeEntity(_0x8a0e66,null))[_0x3902('0x42')](handleError(_0x8a0e66,null));};exports[_0x3902('0x52')]=function(_0x3d66fc,_0x15c4f2,_0x151da1){var _0x3701de=require('../../config/schedule');return db[_0x3902('0x2a')][_0x3902('0x46')]({'where':{'id':_0x3d66fc[_0x3902('0x44')]['id']},'raw':!![]})[_0x3902('0x24')](handleEntityNotFound(_0x15c4f2,null))['then'](function(){_0x3701de[_0x3902('0x52')](_0x3d66fc['params']['id']);})[_0x3902('0x24')](respondWithStatusCode(_0x15c4f2,null))['catch'](handleError(_0x15c4f2,null));}; \ No newline at end of file +var _0xfab8=['undefined','limit','count','Content-Range','json','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xfab8,0x7b));var _0x8fab=function(_0x148b5f,_0x5a17f5){_0x148b5f=_0x148b5f-0x0;var _0x571af6=_0xfab8[_0x148b5f];return _0x571af6;};'use strict';var emlformat=require(_0x8fab('0x0'));var rimraf=require(_0x8fab('0x1'));var zipdir=require(_0x8fab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fab('0x3'));var moment=require('moment');var BPromise=require(_0x8fab('0x4'));var Mustache=require('mustache');var util=require(_0x8fab('0x5'));var path=require('path');var sox=require(_0x8fab('0x6'));var csv=require(_0x8fab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fab('0x8'));var _=require(_0x8fab('0x9'));var squel=require(_0x8fab('0xa'));var crypto=require(_0x8fab('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8fab('0xc'));var Redis=require('ioredis');var authService=require(_0x8fab('0xd'));var qs=require(_0x8fab('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fab('0xf'));var logger=require(_0x8fab('0x10'))('api');var utils=require(_0x8fab('0x11'));var config=require(_0x8fab('0x12'));var licenseUtil=require(_0x8fab('0x13'));var db=require(_0x8fab('0x14'))['db'];function respondWithStatusCode(_0x11ae25,_0x1b9c57){_0x1b9c57=_0x1b9c57||0xcc;return function(_0x110245){if(_0x110245){return _0x11ae25['sendStatus'](_0x1b9c57);}return _0x11ae25[_0x8fab('0x15')](_0x1b9c57)['end']();};}function respondWithResult(_0xbdafb3,_0x4f18ed){_0x4f18ed=_0x4f18ed||0xc8;return function(_0x5148b9){if(_0x5148b9){return _0xbdafb3[_0x8fab('0x15')](_0x4f18ed)['json'](_0x5148b9);}};}function respondWithFilteredResult(_0x1d6964,_0x510355){return function(_0x3b0051){if(_0x3b0051){var _0x117580=typeof _0x510355[_0x8fab('0x16')]===_0x8fab('0x17')&&typeof _0x510355[_0x8fab('0x18')]===_0x8fab('0x17');var _0x1256c2=_0x3b0051[_0x8fab('0x19')];var _0x1adc0f=_0x117580?0x0:_0x510355['offset'];var _0x575499=_0x117580?_0x3b0051['count']:_0x510355['offset']+_0x510355[_0x8fab('0x18')];var _0x348930;if(_0x575499>=_0x1256c2){_0x575499=_0x1256c2;_0x348930=0xc8;}else{_0x348930=0xce;}_0x1d6964[_0x8fab('0x15')](_0x348930);return _0x1d6964['set'](_0x8fab('0x1a'),_0x1adc0f+'-'+_0x575499+'/'+_0x1256c2)[_0x8fab('0x1b')](_0x3b0051);}return null;};}function patchUpdates(_0x2b3f2b){return function(_0x41614c){try{jsonpatch['apply'](_0x41614c,_0x2b3f2b,!![]);}catch(_0x4a0e2a){return BPromise[_0x8fab('0x1c')](_0x4a0e2a);}return _0x41614c['save']();};}function saveUpdates(_0x1bfc63,_0x2bc9a9){return function(_0x42c85a){if(_0x42c85a){return _0x42c85a[_0x8fab('0x1d')](_0x1bfc63)[_0x8fab('0x1e')](function(_0xf174d7){return _0xf174d7;});}return null;};}function removeEntity(_0x3ba88e,_0x2cc6e6){return function(_0x507b02){if(_0x507b02){return _0x507b02[_0x8fab('0x1f')]()[_0x8fab('0x1e')](function(){var _0x5497f2=_0x507b02[_0x8fab('0x20')]({'plain':!![]});var _0x23b64a='Scheduler';return db[_0x8fab('0x21')][_0x8fab('0x1f')]({'where':{'type':_0x23b64a,'resourceId':_0x5497f2['id']}})[_0x8fab('0x1e')](function(){return _0x507b02;});})[_0x8fab('0x1e')](function(){_0x3ba88e[_0x8fab('0x15')](0xcc)[_0x8fab('0x22')]();});}};}function handleEntityNotFound(_0x22e50e,_0x4397cd){return function(_0x4a72bf){if(!_0x4a72bf){_0x22e50e[_0x8fab('0x23')](0x194);}return _0x4a72bf;};}function handleError(_0x1bad35,_0x429910){_0x429910=_0x429910||0x1f4;return function(_0x26846b){logger['error'](_0x26846b[_0x8fab('0x24')]);if(_0x26846b[_0x8fab('0x25')]){delete _0x26846b['name'];}_0x1bad35[_0x8fab('0x15')](_0x429910)[_0x8fab('0x26')](_0x26846b);};}exports[_0x8fab('0x27')]=function(_0x3d3747,_0x10a861){var _0x54c450={},_0x32ab36={},_0x21d645={'count':0x0,'rows':[]};var _0xf4c37f=_[_0x8fab('0x28')](db[_0x8fab('0x29')][_0x8fab('0x2a')],function(_0x5c5330){return{'name':_0x5c5330['fieldName'],'type':_0x5c5330[_0x8fab('0x2b')][_0x8fab('0x2c')]};});_0x32ab36[_0x8fab('0x2d')]=_[_0x8fab('0x28')](_0xf4c37f,_0x8fab('0x25'));_0x32ab36[_0x8fab('0x2e')]=_[_0x8fab('0x2f')](_0x3d3747['query']);_0x32ab36[_0x8fab('0x30')]=_[_0x8fab('0x31')](_0x32ab36[_0x8fab('0x2d')],_0x32ab36[_0x8fab('0x2e')]);_0x54c450[_0x8fab('0x32')]=_[_0x8fab('0x31')](_0x32ab36['model'],qs[_0x8fab('0x33')](_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x33')]));_0x54c450['attributes']=_0x54c450[_0x8fab('0x32')][_0x8fab('0x34')]?_0x54c450[_0x8fab('0x32')]:_0x32ab36[_0x8fab('0x2d')];if(!_0x3d3747[_0x8fab('0x2e')]['hasOwnProperty']('nolimit')){_0x54c450[_0x8fab('0x18')]=qs[_0x8fab('0x18')](_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x18')]);_0x54c450['offset']=qs[_0x8fab('0x16')](_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x16')]);}_0x54c450[_0x8fab('0x35')]=qs[_0x8fab('0x36')](_0x3d3747['query'][_0x8fab('0x36')]);_0x54c450[_0x8fab('0x37')]=qs[_0x8fab('0x30')](_['pick'](_0x3d3747['query'],_0x32ab36[_0x8fab('0x30')]),_0xf4c37f);if(_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x38')]){_0x54c450[_0x8fab('0x37')]=_[_0x8fab('0x39')](_0x54c450['where'],{'$or':_[_0x8fab('0x28')](_0xf4c37f,function(_0x56af40){if(_0x56af40[_0x8fab('0x2b')]!==_0x8fab('0x3a')){var _0x64fcad={};_0x64fcad[_0x56af40['name']]={'$like':'%'+_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x38')]+'%'};return _0x64fcad;}})});}_0x54c450=_[_0x8fab('0x39')]({},_0x54c450,_0x3d3747[_0x8fab('0x3b')]);var _0x150add={'where':_0x54c450[_0x8fab('0x37')]};return db[_0x8fab('0x29')][_0x8fab('0x19')](_0x150add)[_0x8fab('0x1e')](function(_0x7c61b7){_0x21d645[_0x8fab('0x19')]=_0x7c61b7;if(_0x3d3747[_0x8fab('0x2e')][_0x8fab('0x3c')]){_0x54c450[_0x8fab('0x3d')]=[{'all':!![]}];}return db[_0x8fab('0x29')]['findAll'](_0x54c450);})[_0x8fab('0x1e')](function(_0x2f5918){_0x21d645['rows']=_0x2f5918;return _0x21d645;})[_0x8fab('0x1e')](respondWithFilteredResult(_0x10a861,_0x54c450))['catch'](handleError(_0x10a861,null));};exports['show']=function(_0x3bab47,_0x2ef589){var _0x22ba60={'raw':![],'where':{'id':_0x3bab47[_0x8fab('0x3e')]['id']}},_0x180701={};_0x180701[_0x8fab('0x2d')]=_[_0x8fab('0x2f')](db[_0x8fab('0x29')][_0x8fab('0x2a')]);_0x180701[_0x8fab('0x2e')]=_['keys'](_0x3bab47[_0x8fab('0x2e')]);_0x180701[_0x8fab('0x30')]=_[_0x8fab('0x31')](_0x180701[_0x8fab('0x2d')],_0x180701[_0x8fab('0x2e')]);_0x22ba60[_0x8fab('0x32')]=_[_0x8fab('0x31')](_0x180701[_0x8fab('0x2d')],qs['fields'](_0x3bab47['query'][_0x8fab('0x33')]));_0x22ba60[_0x8fab('0x32')]=_0x22ba60['attributes'][_0x8fab('0x34')]?_0x22ba60['attributes']:_0x180701[_0x8fab('0x2d')];if(_0x3bab47[_0x8fab('0x2e')][_0x8fab('0x3c')]){_0x22ba60[_0x8fab('0x3d')]=[{'all':!![]}];}_0x22ba60=_[_0x8fab('0x39')]({},_0x22ba60,_0x3bab47[_0x8fab('0x3b')]);return db[_0x8fab('0x29')][_0x8fab('0x3f')](_0x22ba60)[_0x8fab('0x1e')](handleEntityNotFound(_0x2ef589,null))[_0x8fab('0x1e')](respondWithResult(_0x2ef589,null))[_0x8fab('0x40')](handleError(_0x2ef589,null));};exports[_0x8fab('0x41')]=function(_0x322528,_0x1832f4){return db['Schedule'][_0x8fab('0x41')](_0x322528[_0x8fab('0x42')],{})['then'](function(_0x431ca6){var _0x40a5dc=_0x322528['user'][_0x8fab('0x20')]({'plain':!![]});if(!_0x40a5dc)throw new Error(_0x8fab('0x43'));if(_0x40a5dc['role']==='user'){var _0x2fd1d4=_0x431ca6[_0x8fab('0x20')]({'plain':!![]});var _0x5b121a=_0x8fab('0x44');return db['UserProfileSection'][_0x8fab('0x3f')]({'where':{'name':_0x5b121a,'userProfileId':_0x40a5dc[_0x8fab('0x45')]},'raw':!![]})[_0x8fab('0x1e')](function(_0x411be9){if(_0x411be9&&_0x411be9['autoAssociation']===0x0){return db[_0x8fab('0x21')][_0x8fab('0x41')]({'name':_0x2fd1d4['name'],'resourceId':_0x2fd1d4['id'],'type':_0x411be9[_0x8fab('0x25')],'sectionId':_0x411be9['id']},{})[_0x8fab('0x1e')](function(){return _0x431ca6;});}else{return _0x431ca6;}})[_0x8fab('0x40')](function(_0x3a1a75){logger[_0x8fab('0x46')](_0x8fab('0x47'),_0x3a1a75);throw _0x3a1a75;});}return _0x431ca6;})[_0x8fab('0x1e')](respondWithResult(_0x1832f4,0xc9))[_0x8fab('0x40')](handleError(_0x1832f4,null));};exports[_0x8fab('0x1d')]=function(_0x479675,_0x294c6d){if(_0x479675[_0x8fab('0x42')]['id']){delete _0x479675[_0x8fab('0x42')]['id'];}return db[_0x8fab('0x29')][_0x8fab('0x3f')]({'where':{'id':_0x479675[_0x8fab('0x3e')]['id']}})[_0x8fab('0x1e')](handleEntityNotFound(_0x294c6d,null))[_0x8fab('0x1e')](saveUpdates(_0x479675[_0x8fab('0x42')],null))[_0x8fab('0x1e')](respondWithResult(_0x294c6d,null))['catch'](handleError(_0x294c6d,null));};exports['destroy']=function(_0x5a9826,_0x2e3c8c){return db['Schedule']['find']({'where':{'id':_0x5a9826[_0x8fab('0x3e')]['id']}})[_0x8fab('0x1e')](handleEntityNotFound(_0x2e3c8c,null))[_0x8fab('0x1e')](removeEntity(_0x2e3c8c,null))[_0x8fab('0x40')](handleError(_0x2e3c8c,null));};exports[_0x8fab('0x48')]=function(_0x15a7bf,_0x2714bb,_0x55efce){var _0x1e9981=require('../../config/schedule');return db[_0x8fab('0x29')][_0x8fab('0x3f')]({'where':{'id':_0x15a7bf[_0x8fab('0x3e')]['id']},'raw':!![]})[_0x8fab('0x1e')](handleEntityNotFound(_0x2714bb,null))['then'](function(){_0x1e9981['run'](_0x15a7bf[_0x8fab('0x3e')]['id']);})[_0x8fab('0x1e')](respondWithStatusCode(_0x2714bb,null))['catch'](handleError(_0x2714bb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c1d9a3e..e4728eb 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 _0xf440=['path','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x39788d,_0xf99173){var _0x2991bb=function(_0x2ce0dd){while(--_0x2ce0dd){_0x39788d['push'](_0x39788d['shift']());}};_0x2991bb(++_0xf99173);}(_0xf440,0x72));var _0x0f44=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf440[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x0f44('0x0'));var logger=require(_0x0f44('0x1'))(_0x0f44('0x2'));var moment=require(_0x0f44('0x3'));var BPromise=require(_0x0f44('0x4'));var rp=require(_0x0f44('0x5'));var fs=require('fs');var path=require(_0x0f44('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f44('0x7'));module[_0x0f44('0x8')]=function(_0x5f1ae0,_0x3c9cbd){return _0x5f1ae0[_0x0f44('0x9')](_0x0f44('0xa'),attributes,{'tableName':_0x0f44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43c3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','api'];(function(_0xc694ff,_0x1498ad){var _0x59dba2=function(_0x4c3ccd){while(--_0x4c3ccd){_0xc694ff['push'](_0xc694ff['shift']());}};_0x59dba2(++_0x1498ad);}(_0x43c3,0xe7));var _0x343c=function(_0x245c0f,_0x4352b3){_0x245c0f=_0x245c0f-0x0;var _0x5da92b=_0x43c3[_0x245c0f];return _0x5da92b;};'use strict';var _=require(_0x343c('0x0'));var util=require(_0x343c('0x1'));var logger=require('../../config/logger')(_0x343c('0x2'));var moment=require(_0x343c('0x3'));var BPromise=require(_0x343c('0x4'));var rp=require(_0x343c('0x5'));var fs=require('fs');var path=require(_0x343c('0x6'));var rimraf=require(_0x343c('0x7'));var config=require(_0x343c('0x8'));var attributes=require(_0x343c('0x9'));module['exports']=function(_0x563f3d,_0x26c2c8){return _0x563f3d[_0x343c('0xa')](_0x343c('0xb'),attributes,{'tableName':_0x343c('0xc'),'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 8c09cd0..5055b85 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 _0x6a5b=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x3959d6,_0x16015f){var _0x2ea0ba=function(_0xdfa6da){while(--_0xdfa6da){_0x3959d6['push'](_0x3959d6['shift']());}};_0x2ea0ba(++_0x16015f);}(_0x6a5b,0x9e));var _0xb6a5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6a5b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb6a5('0x0'));var util=require(_0xb6a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6a5('0x4'))(_0xb6a5('0x5'));var config=require('../../config/environment');var jayson=require(_0xb6a5('0x6'));var client=jayson[_0xb6a5('0x7')][_0xb6a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ac9e3,_0x804b35,_0x374a30){return new BPromise(function(_0x5bb997,_0x2717a4){return client[_0xb6a5('0x9')](_0x1ac9e3,_0x374a30)['then'](function(_0x29e640){logger[_0xb6a5('0xa')]('Schedule,\x20%s,\x20%s',_0x804b35,'request\x20sent');logger[_0xb6a5('0xb')](_0xb6a5('0xc'),_0x804b35,_0xb6a5('0xd'),JSON[_0xb6a5('0xe')](_0x29e640));if(_0x29e640[_0xb6a5('0xf')]){if(_0x29e640[_0xb6a5('0xf')][_0xb6a5('0x10')]===0x1f4){logger[_0xb6a5('0xf')](_0xb6a5('0x11'),_0x804b35,_0x29e640['error'][_0xb6a5('0x12')]);return _0x2717a4(_0x29e640[_0xb6a5('0xf')][_0xb6a5('0x12')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x804b35,_0x29e640['error']['message']);return _0x5bb997(_0x29e640['error'][_0xb6a5('0x12')]);}else{logger[_0xb6a5('0xa')](_0xb6a5('0x11'),_0x804b35,_0xb6a5('0xd'));_0x5bb997(_0x29e640['result'][_0xb6a5('0x12')]);}})[_0xb6a5('0x13')](function(_0x11a55c){logger[_0xb6a5('0xf')](_0xb6a5('0x11'),_0x804b35,_0x11a55c);_0x2717a4(_0x11a55c);});});} \ No newline at end of file +var _0x16d3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x16d3,0xeb));var _0x316d=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0x16d3[_0x3233c3];return _0x36029b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x316d('0x0'));var BPromise=require(_0x316d('0x1'));var rs=require(_0x316d('0x2'));var fs=require('fs');var Redis=require(_0x316d('0x3'));var db=require(_0x316d('0x4'))['db'];var utils=require(_0x316d('0x5'));var logger=require(_0x316d('0x6'))(_0x316d('0x7'));var config=require(_0x316d('0x8'));var jayson=require(_0x316d('0x9'));var client=jayson[_0x316d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c4df,_0x29fae4,_0x35697f){return new BPromise(function(_0x4d22d4,_0x1b27c8){return client[_0x316d('0xb')](_0x15c4df,_0x35697f)[_0x316d('0xc')](function(_0x49be71){logger['info'](_0x316d('0xd'),_0x29fae4,'request\x20sent');logger[_0x316d('0xe')](_0x316d('0xf'),_0x29fae4,_0x316d('0x10'),JSON[_0x316d('0x11')](_0x49be71));if(_0x49be71['error']){if(_0x49be71[_0x316d('0x12')][_0x316d('0x13')]===0x1f4){logger['error'](_0x316d('0xd'),_0x29fae4,_0x49be71['error'][_0x316d('0x14')]);return _0x1b27c8(_0x49be71[_0x316d('0x12')]['message']);}logger[_0x316d('0x12')](_0x316d('0xd'),_0x29fae4,_0x49be71[_0x316d('0x12')][_0x316d('0x14')]);return _0x4d22d4(_0x49be71['error']['message']);}else{logger[_0x316d('0x15')]('Schedule,\x20%s,\x20%s',_0x29fae4,_0x316d('0x10'));_0x4d22d4(_0x49be71[_0x316d('0x16')][_0x316d('0x14')]);}})[_0x316d('0x17')](function(_0x551d78){logger[_0x316d('0x12')](_0x316d('0xd'),_0x29fae4,_0x551d78);_0x1b27c8(_0x551d78);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c9b673c..f9b15e9 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 _0xf427=['describe','download','post','create','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0xf427,0x15c));var _0x7f42=function(_0x17bde8,_0x207464){_0x17bde8=_0x17bde8-0x0;var _0x569b6f=_0xf427[_0x17bde8];return _0x569b6f;};'use strict';var multer=require(_0x7f42('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7f42('0x1'));var express=require(_0x7f42('0x2'));var router=express[_0x7f42('0x3')]();var fs_extra=require(_0x7f42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7f42('0x5'));var config=require(_0x7f42('0x6'));var controller=require(_0x7f42('0x7'));router['get']('/',auth[_0x7f42('0x8')](),controller[_0x7f42('0x9')]);router[_0x7f42('0xa')](_0x7f42('0xb'),auth[_0x7f42('0x8')](),controller[_0x7f42('0xc')]);router['get']('/:id',auth[_0x7f42('0x8')](),controller['show']);router[_0x7f42('0xa')]('/:id/download',auth[_0x7f42('0x8')](),controller[_0x7f42('0xd')]);router[_0x7f42('0xe')]('/',auth[_0x7f42('0x8')](),controller[_0x7f42('0xf')]);router['put'](_0x7f42('0x10'),auth[_0x7f42('0x8')](),controller[_0x7f42('0x11')]);router[_0x7f42('0x12')](_0x7f42('0x10'),auth[_0x7f42('0x8')](),controller[_0x7f42('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf8ce=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','download','post','create'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0xf8ce,0x7d));var _0xef8c=function(_0x1dcb57,_0x586416){_0x1dcb57=_0x1dcb57-0x0;var _0x3680=_0xf8ce[_0x1dcb57];return _0x3680;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xef8c('0x0'));var timeout=require(_0xef8c('0x1'));var express=require(_0xef8c('0x2'));var router=express['Router']();var fs_extra=require(_0xef8c('0x3'));var auth=require(_0xef8c('0x4'));var interaction=require(_0xef8c('0x5'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xef8c('0x6')]('/',auth[_0xef8c('0x7')](),controller[_0xef8c('0x8')]);router[_0xef8c('0x6')]('/describe',auth[_0xef8c('0x7')](),controller[_0xef8c('0x9')]);router['get'](_0xef8c('0xa'),auth[_0xef8c('0x7')](),controller[_0xef8c('0xb')]);router[_0xef8c('0x6')]('/:id/download',auth[_0xef8c('0x7')](),controller[_0xef8c('0xc')]);router[_0xef8c('0xd')]('/',auth[_0xef8c('0x7')](),controller[_0xef8c('0xe')]);router[_0xef8c('0xf')](_0xef8c('0xa'),auth[_0xef8c('0x7')](),controller[_0xef8c('0x10')]);router[_0xef8c('0x11')](_0xef8c('0xa'),auth['isAuthenticated'](),controller[_0xef8c('0x12')]);module[_0xef8c('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7542988..e169397 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 _0x3e22=['duration','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract','closedAt'];(function(_0x139b85,_0x5e0691){var _0x1e833f=function(_0xc97932){while(--_0xc97932){_0x139b85['push'](_0x139b85['shift']());}};_0x1e833f(++_0x5e0691);}(_0x3e22,0xa8));var _0x23e2=function(_0x2c3609,_0x412199){_0x2c3609=_0x2c3609-0x0;var _0x461da2=_0x3e22[_0x2c3609];return _0x461da2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x23e2('0x0'));var path=require('path');var config=require(_0x23e2('0x1'));module[_0x23e2('0x2')]={'format':{'type':Sequelize[_0x23e2('0x3')],'get':function(){return this[_0x23e2('0x4')]('value')?path['extname'](this[_0x23e2('0x4')](_0x23e2('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x23e2('0x6')]},'value':{'type':Sequelize[_0x23e2('0x6')],'set':function(_0x3a8351){var _0x927fbb=_0x3a8351[_0x23e2('0x7')](/\\/g,'/');this['setDataValue'](_0x23e2('0x5'),_0x927fbb);}},'rating':{'type':Sequelize[_0x23e2('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x23e2('0x8')],'set':function(_0x75da0a){this[_0x23e2('0x9')]('startedAt',moment()[_0x23e2('0xa')](_0x75da0a,'ms'));this[_0x23e2('0x9')](_0x23e2('0xb'),moment());this[_0x23e2('0x9')](_0x23e2('0xc'),_0x75da0a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x23e2('0xd')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}},'closedAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0xb')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}},'createdAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0x12')))[_0x23e2('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x23e2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0x13')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}}}; \ No newline at end of file +var _0xdd6e=['format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration'];(function(_0x2f06b2,_0xf44280){var _0x34e84f=function(_0x3683e1){while(--_0x3683e1){_0x2f06b2['push'](_0x2f06b2['shift']());}};_0x34e84f(++_0xf44280);}(_0xdd6e,0xa5));var _0xedd6=function(_0x3a39df,_0x3c1483){_0x3a39df=_0x3a39df-0x0;var _0x445f38=_0xdd6e[_0x3a39df];return _0x445f38;};'use strict';var Sequelize=require(_0xedd6('0x0'));var moment=require(_0xedd6('0x1'));var path=require(_0xedd6('0x2'));var config=require(_0xedd6('0x3'));module['exports']={'format':{'type':Sequelize[_0xedd6('0x4')],'get':function(){return this[_0xedd6('0x5')](_0xedd6('0x6'))?path[_0xedd6('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xedd6('0x8')]},'value':{'type':Sequelize[_0xedd6('0x8')],'set':function(_0x5300a5){var _0x135950=_0x5300a5[_0xedd6('0x9')](/\\/g,'/');this[_0xedd6('0xa')](_0xedd6('0x6'),_0x135950);}},'rating':{'type':Sequelize[_0xedd6('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4c282c){this[_0xedd6('0xa')](_0xedd6('0xc'),moment()['subtract'](_0x4c282c,'ms'));this[_0xedd6('0xa')](_0xedd6('0xd'),moment());this[_0xedd6('0xa')](_0xedd6('0xe'),_0x4c282c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xedd6('0x5')]('startedAt'))[_0xedd6('0xf')](_0xedd6('0x10'))[_0xedd6('0x11')]();}},'closedAt':{'type':Sequelize[_0xedd6('0x12')],'get':function(){return moment(this['getDataValue'](_0xedd6('0xd')))[_0xedd6('0xf')](_0xedd6('0x10'))[_0xedd6('0x11')]();}},'createdAt':{'type':Sequelize[_0xedd6('0x12')],'get':function(){return moment(this[_0xedd6('0x5')](_0xedd6('0x13')))[_0xedd6('0xf')](_0xedd6('0x10'))[_0xedd6('0x11')]();}},'updatedAt':{'type':Sequelize[_0xedd6('0x12')],'get':function(){return moment(this[_0xedd6('0x5')]('updatedAt'))[_0xedd6('0xf')](_0xedd6('0x10'))[_0xedd6('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c5db7e6..bf8f5a4 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 _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5bdd6e,_0x2fe3e2){_0x5bdd6e=_0x5bdd6e-0x0;var _0x34fce5=_0xdbf5[_0x5bdd6e];return _0x34fce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x175885,_0xe13bd3){var _0x277e93=function(_0x3949ba){while(--_0x3949ba){_0x175885['push'](_0x175885['shift']());}};_0x277e93(++_0xe13bd3);}(_0x33c5,0xe6));var _0x533c=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x33c5[_0x6173fc];return _0x965fbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1d46343..17697d6 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 _0xff2c=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','util'];(function(_0x5ab20a,_0x9677a0){var _0x2414c4=function(_0x4374ec){while(--_0x4374ec){_0x5ab20a['push'](_0x5ab20a['shift']());}};_0x2414c4(++_0x9677a0);}(_0xff2c,0x17f));var _0xcff2=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xff2c[_0x466247];return _0x4b352e;};'use strict';var _=require('lodash');var util=require(_0xcff2('0x0'));var logger=require(_0xcff2('0x1'))(_0xcff2('0x2'));var moment=require(_0xcff2('0x3'));var BPromise=require(_0xcff2('0x4'));var rp=require(_0xcff2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcff2('0x6'));var attributes=require('./screenRecording.attributes');module[_0xcff2('0x7')]=function(_0x4aab57,_0x31f8ac){return _0x4aab57[_0xcff2('0x8')](_0xcff2('0x9'),attributes,{'tableName':_0xcff2('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcff2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e66=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x4bf0a9,_0x43acaa){var _0x476c90=function(_0x43cb94){while(--_0x43cb94){_0x4bf0a9['push'](_0x4bf0a9['shift']());}};_0x476c90(++_0x43acaa);}(_0x0e66,0xff));var _0x60e6=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x0e66[_0x60286b];return _0x5dff69;};'use strict';var _=require(_0x60e6('0x0'));var util=require(_0x60e6('0x1'));var logger=require(_0x60e6('0x2'))(_0x60e6('0x3'));var moment=require(_0x60e6('0x4'));var BPromise=require(_0x60e6('0x5'));var rp=require(_0x60e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x60e6('0x7'));var attributes=require(_0x60e6('0x8'));module[_0x60e6('0x9')]=function(_0x322119,_0x1d6248){return _0x322119[_0x60e6('0xa')](_0x60e6('0xb'),attributes,{'tableName':_0x60e6('0xc'),'paranoid':![],'indexes':[{'name':_0x60e6('0xd'),'fields':[_0x60e6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7909766..1d91c1c 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 _0x4132=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4132,0xd6));var _0x2413=function(_0x2fb683,_0x202d9b){_0x2fb683=_0x2fb683-0x0;var _0x5011bb=_0x4132[_0x2fb683];return _0x5011bb;};'use strict';var _=require(_0x2413('0x0'));var util=require(_0x2413('0x1'));var moment=require(_0x2413('0x2'));var BPromise=require('bluebird');var rs=require(_0x2413('0x3'));var fs=require('fs');var Redis=require(_0x2413('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2413('0x5'));var logger=require(_0x2413('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2413('0x7')][_0x2413('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53e270,_0x19b8d3,_0x17fcba){return new BPromise(function(_0x449eba,_0x5c109c){return client['request'](_0x53e270,_0x17fcba)[_0x2413('0x9')](function(_0x375de1){logger[_0x2413('0xa')](_0x2413('0xb'),_0x19b8d3,'request\x20sent');logger['debug'](_0x2413('0xc'),_0x19b8d3,_0x2413('0xd'),JSON[_0x2413('0xe')](_0x375de1));if(_0x375de1[_0x2413('0xf')]){if(_0x375de1[_0x2413('0xf')]['code']===0x1f4){logger[_0x2413('0xf')](_0x2413('0xb'),_0x19b8d3,_0x375de1[_0x2413('0xf')]['message']);return _0x5c109c(_0x375de1['error'][_0x2413('0x10')]);}logger[_0x2413('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x19b8d3,_0x375de1['error'][_0x2413('0x10')]);return _0x449eba(_0x375de1['error'][_0x2413('0x10')]);}else{logger[_0x2413('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x19b8d3,_0x2413('0xd'));_0x449eba(_0x375de1[_0x2413('0x11')]['message']);}})[_0x2413('0x12')](function(_0x22fdd6){logger[_0x2413('0xf')](_0x2413('0xb'),_0x19b8d3,_0x22fdd6);_0x5c109c(_0x22fdd6);});});} \ No newline at end of file +var _0x4d3a=['code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4d3a,0x6e));var _0xa4d3=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x4d3a[_0x533528];return _0x3189f1;};'use strict';var _=require(_0xa4d3('0x0'));var util=require(_0xa4d3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa4d3('0x2'));var fs=require('fs');var Redis=require(_0xa4d3('0x3'));var db=require(_0xa4d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa4d3('0x5'));var config=require(_0xa4d3('0x6'));var jayson=require(_0xa4d3('0x7'));var client=jayson[_0xa4d3('0x8')][_0xa4d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c1d39,_0x4fb21a,_0x38004b){return new BPromise(function(_0x14a95b,_0x566885){return client[_0xa4d3('0xa')](_0x3c1d39,_0x38004b)[_0xa4d3('0xb')](function(_0x5e9bbd){logger[_0xa4d3('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x4fb21a,_0xa4d3('0xd'));logger[_0xa4d3('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4fb21a,_0xa4d3('0xd'),JSON['stringify'](_0x5e9bbd));if(_0x5e9bbd[_0xa4d3('0xf')]){if(_0x5e9bbd[_0xa4d3('0xf')][_0xa4d3('0x10')]===0x1f4){logger[_0xa4d3('0xf')](_0xa4d3('0x11'),_0x4fb21a,_0x5e9bbd[_0xa4d3('0xf')][_0xa4d3('0x12')]);return _0x566885(_0x5e9bbd[_0xa4d3('0xf')][_0xa4d3('0x12')]);}logger[_0xa4d3('0xf')](_0xa4d3('0x11'),_0x4fb21a,_0x5e9bbd[_0xa4d3('0xf')][_0xa4d3('0x12')]);return _0x14a95b(_0x5e9bbd[_0xa4d3('0xf')][_0xa4d3('0x12')]);}else{logger[_0xa4d3('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x4fb21a,_0xa4d3('0xd'));_0x14a95b(_0x5e9bbd[_0xa4d3('0x13')][_0xa4d3('0x12')]);}})[_0xa4d3('0x14')](function(_0x2dd3e7){logger[_0xa4d3('0xf')](_0xa4d3('0x11'),_0x4fb21a,_0x2dd3e7);_0x566885(_0x2dd3e7);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a894c98..3d301ed 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 _0x8486=['/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','join','format','logologin','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','/:id/logo_login'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x8486,0x70));var _0x6848=function(_0x2d46d1,_0x525199){_0x2d46d1=_0x2d46d1-0x0;var _0x52434f=_0x8486[_0x2d46d1];return _0x52434f;};'use strict';var multer=require(_0x6848('0x0'));var util=require(_0x6848('0x1'));var path=require(_0x6848('0x2'));var timeout=require('connect-timeout');var express=require(_0x6848('0x3'));var router=express[_0x6848('0x4')]();var fs_extra=require(_0x6848('0x5'));var auth=require(_0x6848('0x6'));var interaction=require(_0x6848('0x7'));var config=require(_0x6848('0x8'));var controller=require('./setting.controller');router[_0x6848('0x9')]('/',auth[_0x6848('0xa')](),controller[_0x6848('0xb')]);router['get'](_0x6848('0xc'),controller[_0x6848('0xd')]);router[_0x6848('0x9')](_0x6848('0xe'),controller['show']);router['get'](_0x6848('0xf'),controller['getLogo']);router[_0x6848('0x9')](_0x6848('0x10'),controller['getLogoLogin']);router[_0x6848('0x9')](_0x6848('0x11'),controller[_0x6848('0x12')]);router['get']('/:id/preferred',controller[_0x6848('0x13')]);router[_0x6848('0x9')](_0x6848('0x14'),controller[_0x6848('0x15')]);var upload=multer({'storage':multer[_0x6848('0x16')]({'destination':function(_0x36ef1e,_0x33b9cf,_0x47281a){_0x47281a(null,path['join'](config['root'],_0x6848('0x17')));},'filename':function(_0x47d2e7,_0x3e5d32,_0xf962f5){_0xf962f5(null,util['format'](_0x6848('0x18'),_0x6848('0x19'),path[_0x6848('0x1a')](_0x3e5d32[_0x6848('0x1b')])));}})});router[_0x6848('0x1c')](_0x6848('0xf'),upload[_0x6848('0x1d')](_0x6848('0x1e')),controller[_0x6848('0x1f')]);var upload=multer({'storage':multer[_0x6848('0x16')]({'destination':function(_0x1b8e06,_0x59bb8a,_0x3ca99a){_0x3ca99a(null,path[_0x6848('0x20')](config['root'],_0x6848('0x17')));},'filename':function(_0x20b5b9,_0x217536,_0x53c24e){_0x53c24e(null,util[_0x6848('0x21')](_0x6848('0x18'),_0x6848('0x22'),path[_0x6848('0x1a')](_0x217536[_0x6848('0x1b')])));}})});router[_0x6848('0x1c')]('/:id/logo_login',upload[_0x6848('0x1d')]('file'),controller[_0x6848('0x23')]);var upload=multer({'storage':multer[_0x6848('0x16')]({'destination':function(_0x5d3c76,_0x3d0497,_0x183057){_0x183057(null,path[_0x6848('0x20')](config['root'],_0x6848('0x17')));},'filename':function(_0x37a4f9,_0x3d2eac,_0x128d26){_0x128d26(null,util[_0x6848('0x21')](_0x6848('0x18'),_0x6848('0x24'),path[_0x6848('0x1a')](_0x3d2eac[_0x6848('0x1b')])));}})});router[_0x6848('0x1c')](_0x6848('0x25'),upload[_0x6848('0x1d')](_0x6848('0x1e')),controller[_0x6848('0x26')]);var upload=multer({'storage':multer[_0x6848('0x16')]({'destination':function(_0x2b7bed,_0x1c9798,_0x1a0f3b){_0x1a0f3b(null,path[_0x6848('0x20')](config['root'],_0x6848('0x17')));},'filename':function(_0x18fc5c,_0x33fb59,_0x1b27b9){_0x1b27b9(null,util[_0x6848('0x21')]('%s%s',_0x6848('0x27'),path[_0x6848('0x1a')](_0x33fb59[_0x6848('0x1b')])));}})});router[_0x6848('0x1c')]('/:id/favicon',upload[_0x6848('0x1d')](_0x6848('0x1e')),controller[_0x6848('0x28')]);router[_0x6848('0x29')]('/:id',auth[_0x6848('0xa')](),controller[_0x6848('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x8bed=['show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','post','single','addLogo','logologin','originalname','/:id/logo_login','file','addLogoLogin','addPreferred','favicon','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate'];(function(_0x3512c2,_0x4f61c0){var _0x451e62=function(_0x45a5c0){while(--_0x45a5c0){_0x3512c2['push'](_0x3512c2['shift']());}};_0x451e62(++_0x4f61c0);}(_0x8bed,0xc4));var _0xd8be=function(_0x18b5fb,_0x36862b){_0x18b5fb=_0x18b5fb-0x0;var _0x56f0e2=_0x8bed[_0x18b5fb];return _0x56f0e2;};'use strict';var multer=require(_0xd8be('0x0'));var util=require('util');var path=require(_0xd8be('0x1'));var timeout=require(_0xd8be('0x2'));var express=require(_0xd8be('0x3'));var router=express[_0xd8be('0x4')]();var fs_extra=require(_0xd8be('0x5'));var auth=require(_0xd8be('0x6'));var interaction=require(_0xd8be('0x7'));var config=require(_0xd8be('0x8'));var controller=require(_0xd8be('0x9'));router[_0xd8be('0xa')]('/',auth[_0xd8be('0xb')](),controller[_0xd8be('0xc')]);router[_0xd8be('0xa')]('/now',controller[_0xd8be('0xd')]);router[_0xd8be('0xa')]('/:id',controller[_0xd8be('0xe')]);router['get'](_0xd8be('0xf'),controller[_0xd8be('0x10')]);router[_0xd8be('0xa')]('/:id/logo_login',controller[_0xd8be('0x11')]);router['get'](_0xd8be('0x12'),controller['gdpr']);router[_0xd8be('0xa')](_0xd8be('0x13'),controller[_0xd8be('0x14')]);router[_0xd8be('0xa')](_0xd8be('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xd8be('0x16')]({'destination':function(_0x32b71e,_0x496f6f,_0x4d35c5){_0x4d35c5(null,path[_0xd8be('0x17')](config[_0xd8be('0x18')],_0xd8be('0x19')));},'filename':function(_0x15ea47,_0x173005,_0x51b48e){_0x51b48e(null,util[_0xd8be('0x1a')](_0xd8be('0x1b'),'logo',path[_0xd8be('0x1c')](_0x173005['originalname'])));}})});router[_0xd8be('0x1d')](_0xd8be('0xf'),upload[_0xd8be('0x1e')]('file'),controller[_0xd8be('0x1f')]);var upload=multer({'storage':multer[_0xd8be('0x16')]({'destination':function(_0x4f126e,_0x3a4a82,_0x4e7ef4){_0x4e7ef4(null,path[_0xd8be('0x17')](config['root'],_0xd8be('0x19')));},'filename':function(_0x904088,_0x4a387d,_0x506385){_0x506385(null,util[_0xd8be('0x1a')](_0xd8be('0x1b'),_0xd8be('0x20'),path['extname'](_0x4a387d[_0xd8be('0x21')])));}})});router[_0xd8be('0x1d')](_0xd8be('0x22'),upload[_0xd8be('0x1e')](_0xd8be('0x23')),controller[_0xd8be('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cc6d5,_0x947c0c,_0x2c7de0){_0x2c7de0(null,path['join'](config[_0xd8be('0x18')],_0xd8be('0x19')));},'filename':function(_0x15b99f,_0x13c090,_0x235fc5){_0x235fc5(null,util[_0xd8be('0x1a')]('%s%s','preferred',path[_0xd8be('0x1c')](_0x13c090[_0xd8be('0x21')])));}})});router[_0xd8be('0x1d')](_0xd8be('0x13'),upload[_0xd8be('0x1e')](_0xd8be('0x23')),controller[_0xd8be('0x25')]);var upload=multer({'storage':multer[_0xd8be('0x16')]({'destination':function(_0x5121d0,_0x1073c2,_0x48336b){_0x48336b(null,path['join'](config[_0xd8be('0x18')],'server/files/images/logos/'));},'filename':function(_0x43ff6e,_0x4d6de6,_0x4ba877){_0x4ba877(null,util[_0xd8be('0x1a')](_0xd8be('0x1b'),_0xd8be('0x26'),path[_0xd8be('0x1c')](_0x4d6de6[_0xd8be('0x21')])));}})});router[_0xd8be('0x1d')]('/:id/favicon',upload[_0xd8be('0x1e')](_0xd8be('0x23')),controller['addFavicon']);router['put'](_0xd8be('0x27'),auth[_0xd8be('0xb')](),controller[_0xd8be('0x28')]);module[_0xd8be('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 437d919..77cb49d 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 _0xb9d9=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb9d9,0x104));var _0x9b9d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb9d9[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x9b9d('0x0'));module[_0x9b9d('0x1')]={'min_internal':{'type':Sequelize[_0x9b9d('0x2')](0xb),'unique':_0x9b9d('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9b9d('0x2')](0xb),'unique':_0x9b9d('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9b9d('0x5')],'defaultValue':_0x9b9d('0x6')},'logo':{'type':Sequelize[_0x9b9d('0x5')]},'defaultLogo':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9b9d('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9b9d('0x5')]},'turnaddr':{'type':Sequelize[_0x9b9d('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9b9d('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9b9d('0x5')],'defaultValue':_0x9b9d('0x8')},'enableEmailPreview':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9b9d('0x5')],'defaultValue':_0x9b9d('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9b9d('0x5')]},'defaultPreferred':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9b9d('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9b9d('0x5')]},'defaultFavicon':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9b9d('0x2')]},'transcribeRegion':{'type':Sequelize[_0x9b9d('0x5')]},'sentiment':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9b9d('0x2')]},'sentimentRegion':{'type':Sequelize[_0x9b9d('0x5')]},'language':{'type':Sequelize[_0x9b9d('0x5')]},'bucket':{'type':Sequelize[_0x9b9d('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9b9d('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x9b9d('0x2')](0x2)[_0x9b9d('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9b9d('0x2')](0x2)[_0x9b9d('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9b9d('0x2')](0x2)[_0x9b9d('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9b9d('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9b9d('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xc6d7=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x4868de,_0x4d07af){var _0x460e7b=function(_0x42ee3b){while(--_0x42ee3b){_0x4868de['push'](_0x4868de['shift']());}};_0x460e7b(++_0x4d07af);}(_0xc6d7,0x71));var _0x7c6d=function(_0x3df280,_0x3a4c27){_0x3df280=_0x3df280-0x0;var _0x506760=_0xc6d7[_0x3df280];return _0x506760;};'use strict';var Sequelize=require(_0x7c6d('0x0'));module[_0x7c6d('0x1')]={'min_internal':{'type':Sequelize[_0x7c6d('0x2')](0xb),'unique':_0x7c6d('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7c6d('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7c6d('0x4')],'defaultValue':_0x7c6d('0x5')},'logo':{'type':Sequelize[_0x7c6d('0x4')]},'defaultLogo':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7c6d('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7c6d('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7c6d('0x4')]},'turnaddr':{'type':Sequelize[_0x7c6d('0x4')]},'turnusername':{'type':Sequelize[_0x7c6d('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x7c6d('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7c6d('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7c6d('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7c6d('0x4')],'defaultValue':_0x7c6d('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7c6d('0x4')]},'defaultPreferred':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7c6d('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7c6d('0x4')]},'defaultFavicon':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x7c6d('0x4')]},'sentiment':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7c6d('0x2')]},'sentimentRegion':{'type':Sequelize[_0x7c6d('0x4')]},'language':{'type':Sequelize[_0x7c6d('0x4')]},'bucket':{'type':Sequelize[_0x7c6d('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7c6d('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7c6d('0x2')](0x2)[_0x7c6d('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7c6d('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7c6d('0x2')](0x2)[_0x7c6d('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7c6d('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x7c6d('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7c6d('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 1eb7334..9bc875c 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 _0x4d7f=['fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','update','body','find','addLogo','file','filename','addLogoLogin','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','default_loginLogo.svg','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','offset','count','Content-Range','reject','save','destroy','end','stack','name','send','index','map','Setting','rawAttributes'];(function(_0x39af86,_0x376aeb){var _0x3963ab=function(_0x4a280b){while(--_0x4a280b){_0x39af86['push'](_0x39af86['shift']());}};_0x3963ab(++_0x376aeb);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x5bb134,_0x32fb33){_0x5bb134=_0x5bb134-0x0;var _0x538ae6=_0x4d7f[_0x5bb134];return _0x538ae6;};'use strict';var emlformat=require(_0xf4d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4d7('0x2'));var moment=require(_0xf4d7('0x3'));var BPromise=require(_0xf4d7('0x4'));var Mustache=require(_0xf4d7('0x5'));var util=require(_0xf4d7('0x6'));var path=require('path');var sox=require(_0xf4d7('0x7'));var csv=require('to-csv');var ejs=require(_0xf4d7('0x8'));var fs=require('fs');var fs_extra=require(_0xf4d7('0x9'));var _=require(_0xf4d7('0xa'));var squel=require('squel');var crypto=require(_0xf4d7('0xb'));var jsforce=require(_0xf4d7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf4d7('0xd'));var querystring=require(_0xf4d7('0xe'));var Papa=require(_0xf4d7('0xf'));var Redis=require('ioredis');var authService=require(_0xf4d7('0x10'));var qs=require(_0xf4d7('0x11'));var as=require(_0xf4d7('0x12'));var hardwareService=require(_0xf4d7('0x13'));var logger=require(_0xf4d7('0x14'))(_0xf4d7('0x15'));var utils=require(_0xf4d7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf4d7('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf4d7('0x18'));var client=jayson[_0xf4d7('0x19')][_0xf4d7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1c4867,_0x32aa09,_0x35b72f,_0x576327){return new BPromise(function(_0x4e9394,_0x3f89fb){var _0x24bfae=_0x576327||client;return _0x24bfae[_0xf4d7('0x1b')](_0x1c4867,_0x35b72f)[_0xf4d7('0x1c')](function(_0x2339ce){logger[_0xf4d7('0x1d')]('Setting,\x20%s,\x20%s',_0x32aa09,'request\x20sent');logger[_0xf4d7('0x1e')](_0xf4d7('0x1f'),_0x32aa09,'request\x20sent',JSON[_0xf4d7('0x20')](_0x2339ce));if(_0x2339ce[_0xf4d7('0x21')]){if(_0x2339ce[_0xf4d7('0x21')][_0xf4d7('0x22')]===0x1f4){logger['error'](_0xf4d7('0x23'),_0x32aa09,_0x2339ce[_0xf4d7('0x21')][_0xf4d7('0x24')]);return _0x3f89fb(_0x2339ce['error'][_0xf4d7('0x24')]);}logger['error'](_0xf4d7('0x23'),_0x32aa09,_0x2339ce['error'][_0xf4d7('0x24')]);return _0x4e9394(_0x2339ce[_0xf4d7('0x21')][_0xf4d7('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x32aa09,_0xf4d7('0x25'));_0x4e9394(_0x2339ce[_0xf4d7('0x26')][_0xf4d7('0x24')]);}})[_0xf4d7('0x27')](function(_0x538731){logger['error'](_0xf4d7('0x23'),_0x32aa09,_0x538731);_0x3f89fb(_0x538731);});});}function respondWithStatusCode(_0x1ead91,_0x678a34){_0x678a34=_0x678a34||0xcc;return function(_0x4802a1){if(_0x4802a1){return _0x1ead91[_0xf4d7('0x28')](_0x678a34);}return _0x1ead91[_0xf4d7('0x29')](_0x678a34)['end']();};}function respondWithResult(_0x52650b,_0x354bbb){_0x354bbb=_0x354bbb||0xc8;return function(_0x38cb0a){if(_0x38cb0a){return _0x52650b[_0xf4d7('0x29')](_0x354bbb)[_0xf4d7('0x2a')](_0x38cb0a);}};}function respondWithFilteredResult(_0x4d9b9b,_0x5f3411){return function(_0x5ee4be){if(_0x5ee4be){var _0x924d71=typeof _0x5f3411[_0xf4d7('0x2b')]==='undefined'&&typeof _0x5f3411['limit']==='undefined';var _0x553880=_0x5ee4be[_0xf4d7('0x2c')];var _0x374ada=_0x924d71?0x0:_0x5f3411[_0xf4d7('0x2b')];var _0x58b22b=_0x924d71?_0x5ee4be[_0xf4d7('0x2c')]:_0x5f3411[_0xf4d7('0x2b')]+_0x5f3411['limit'];var _0x62ef51;if(_0x58b22b>=_0x553880){_0x58b22b=_0x553880;_0x62ef51=0xc8;}else{_0x62ef51=0xce;}_0x4d9b9b[_0xf4d7('0x29')](_0x62ef51);return _0x4d9b9b['set'](_0xf4d7('0x2d'),_0x374ada+'-'+_0x58b22b+'/'+_0x553880)[_0xf4d7('0x2a')](_0x5ee4be);}return null;};}function patchUpdates(_0x23fa55){return function(_0x24cb94){try{jsonpatch['apply'](_0x24cb94,_0x23fa55,!![]);}catch(_0xaf5e16){return BPromise[_0xf4d7('0x2e')](_0xaf5e16);}return _0x24cb94[_0xf4d7('0x2f')]();};}function saveUpdates(_0xe7f58,_0x39073c){return function(_0xcb2e09){if(_0xcb2e09){return _0xcb2e09['update'](_0xe7f58)[_0xf4d7('0x1c')](function(_0x4c5399){return _0x4c5399;});}return null;};}function removeEntity(_0x4651a6,_0x577a0a){return function(_0x5bbd60){if(_0x5bbd60){return _0x5bbd60[_0xf4d7('0x30')]()['then'](function(){_0x4651a6[_0xf4d7('0x29')](0xcc)[_0xf4d7('0x31')]();});}};}function handleEntityNotFound(_0x5a173d,_0x3f1906){return function(_0x555148){if(!_0x555148){_0x5a173d['sendStatus'](0x194);}return _0x555148;};}function handleError(_0x347588,_0x15cc73){_0x15cc73=_0x15cc73||0x1f4;return function(_0x5b9749){logger['error'](_0x5b9749[_0xf4d7('0x32')]);if(_0x5b9749[_0xf4d7('0x33')]){delete _0x5b9749[_0xf4d7('0x33')];}_0x347588[_0xf4d7('0x29')](_0x15cc73)[_0xf4d7('0x34')](_0x5b9749);};}exports[_0xf4d7('0x35')]=function(_0x496498,_0x173206){var _0x2ff9aa={},_0x589131={},_0x489680={'count':0x0,'rows':[]};var _0x5dcb23=_[_0xf4d7('0x36')](db[_0xf4d7('0x37')][_0xf4d7('0x38')],function(_0x15a686){return{'name':_0x15a686[_0xf4d7('0x39')],'type':_0x15a686[_0xf4d7('0x3a')][_0xf4d7('0x3b')]};});_0x589131[_0xf4d7('0x3c')]=_[_0xf4d7('0x36')](_0x5dcb23,'name');_0x589131['query']=_[_0xf4d7('0x3d')](_0x496498[_0xf4d7('0x3e')]);_0x589131[_0xf4d7('0x3f')]=_[_0xf4d7('0x40')](_0x589131['model'],_0x589131[_0xf4d7('0x3e')]);_0x2ff9aa['attributes']=_['intersection'](_0x589131[_0xf4d7('0x3c')],qs[_0xf4d7('0x41')](_0x496498['query'][_0xf4d7('0x41')]));_0x2ff9aa[_0xf4d7('0x42')]=_0x2ff9aa[_0xf4d7('0x42')][_0xf4d7('0x43')]?_0x2ff9aa['attributes']:_0x589131[_0xf4d7('0x3c')];if(!_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x44')](_0xf4d7('0x45'))){_0x2ff9aa[_0xf4d7('0x46')]=qs[_0xf4d7('0x46')](_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x46')]);_0x2ff9aa[_0xf4d7('0x2b')]=qs['offset'](_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x2b')]);}_0x2ff9aa[_0xf4d7('0x47')]=qs[_0xf4d7('0x48')](_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x48')]);_0x2ff9aa[_0xf4d7('0x49')]=qs[_0xf4d7('0x3f')](_[_0xf4d7('0x4a')](_0x496498[_0xf4d7('0x3e')],_0x589131[_0xf4d7('0x3f')]),_0x5dcb23);if(_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x4b')]){_0x2ff9aa[_0xf4d7('0x49')]=_[_0xf4d7('0x4c')](_0x2ff9aa[_0xf4d7('0x49')],{'$or':_[_0xf4d7('0x36')](_0x5dcb23,function(_0x43ea1c){if(_0x43ea1c[_0xf4d7('0x3a')]!==_0xf4d7('0x4d')){var _0x394e2c={};_0x394e2c[_0x43ea1c[_0xf4d7('0x33')]]={'$like':'%'+_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x4b')]+'%'};return _0x394e2c;}})});}_0x2ff9aa=_[_0xf4d7('0x4c')]({},_0x2ff9aa,_0x496498[_0xf4d7('0x4e')]);var _0xb4ab48={'where':_0x2ff9aa[_0xf4d7('0x49')]};return db[_0xf4d7('0x37')][_0xf4d7('0x2c')](_0xb4ab48)[_0xf4d7('0x1c')](function(_0x1dda57){_0x489680[_0xf4d7('0x2c')]=_0x1dda57;if(_0x496498[_0xf4d7('0x3e')][_0xf4d7('0x4f')]){_0x2ff9aa[_0xf4d7('0x50')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x2ff9aa);})['then'](function(_0x1f1a93){_0x489680[_0xf4d7('0x51')]=_0x1f1a93;return _0x489680;})['then'](respondWithFilteredResult(_0x173206,_0x2ff9aa))[_0xf4d7('0x27')](handleError(_0x173206,null));};exports[_0xf4d7('0x52')]=function(_0x99cea2,_0x1104bc){var _0xb1f2f8={'raw':![],'where':{'id':_0x99cea2[_0xf4d7('0x53')]['id']}},_0x275742={};_0x275742[_0xf4d7('0x3c')]=_[_0xf4d7('0x3d')](db[_0xf4d7('0x37')][_0xf4d7('0x38')]);_0x275742[_0xf4d7('0x3e')]=_[_0xf4d7('0x3d')](_0x99cea2[_0xf4d7('0x3e')]);_0x275742['filters']=_[_0xf4d7('0x40')](_0x275742[_0xf4d7('0x3c')],_0x275742['query']);_0xb1f2f8[_0xf4d7('0x42')]=_[_0xf4d7('0x40')](_0x275742[_0xf4d7('0x3c')],qs[_0xf4d7('0x41')](_0x99cea2[_0xf4d7('0x3e')][_0xf4d7('0x41')]));_0xb1f2f8[_0xf4d7('0x42')]=_0xb1f2f8[_0xf4d7('0x42')][_0xf4d7('0x43')]?_0xb1f2f8[_0xf4d7('0x42')]:_0x275742[_0xf4d7('0x3c')];if(_0x99cea2[_0xf4d7('0x3e')][_0xf4d7('0x4f')]){_0xb1f2f8['include']=[{'all':!![]}];}_0xb1f2f8=_[_0xf4d7('0x4c')]({},_0xb1f2f8,_0x99cea2['options']);return db[_0xf4d7('0x37')]['find'](_0xb1f2f8)['then'](handleEntityNotFound(_0x1104bc,null))[_0xf4d7('0x1c')](respondWithResult(_0x1104bc,null))[_0xf4d7('0x27')](handleError(_0x1104bc,null));};exports[_0xf4d7('0x54')]=function(_0x5ee7d0,_0x159428){if(_0x5ee7d0[_0xf4d7('0x55')]['id']){delete _0x5ee7d0[_0xf4d7('0x55')]['id'];}return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x5ee7d0[_0xf4d7('0x53')]['id']}})[_0xf4d7('0x1c')](handleEntityNotFound(_0x159428,null))['then'](saveUpdates(_0x5ee7d0['body'],null))[_0xf4d7('0x1c')](respondWithResult(_0x159428,null))[_0xf4d7('0x27')](handleError(_0x159428,null));};exports[_0xf4d7('0x57')]=function(_0x333272,_0x14dc89,_0x5c07f2){if(_0x333272[_0xf4d7('0x58')]&&_0x333272[_0xf4d7('0x58')][_0xf4d7('0x59')]){_0x333272[_0xf4d7('0x55')]['logo']=_0x333272['file']['filename'];}return db[_0xf4d7('0x37')]['find']({'where':{'id':_0x333272['params']['id']}})[_0xf4d7('0x1c')](handleEntityNotFound(_0x14dc89,null))['then'](saveUpdates(_0x333272[_0xf4d7('0x55')],null))['then'](respondWithResult(_0x14dc89,null))[_0xf4d7('0x27')](handleError(_0x14dc89,null));};exports[_0xf4d7('0x5a')]=function(_0x1b36a7,_0x5897,_0x51ee62){if(_0x1b36a7[_0xf4d7('0x58')]&&_0x1b36a7[_0xf4d7('0x58')][_0xf4d7('0x59')]){_0x1b36a7['body']['loginLogo']=_0x1b36a7['file'][_0xf4d7('0x59')];}return db[_0xf4d7('0x37')]['find']({'where':{'id':_0x1b36a7[_0xf4d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x5897,null))['then'](saveUpdates(_0x1b36a7[_0xf4d7('0x55')],null))['then'](respondWithResult(_0x5897,null))[_0xf4d7('0x27')](handleError(_0x5897,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x97f94,_0x38edee,_0x253be5){var _0x3262f3=_0xf4d7('0x5b');var _0x116271={'custom':![]};return utilLicense[_0xf4d7('0x5c')]()[_0xf4d7('0x1c')](function(_0x2a8103){if(_0x2a8103){_0x116271=_0x2a8103;}return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x97f94[_0xf4d7('0x53')]['id']},'attributes':[_0xf4d7('0x5d'),_0xf4d7('0x5e'),_0xf4d7('0x5f'),_0xf4d7('0x60'),_0xf4d7('0x61'),_0xf4d7('0x62'),_0xf4d7('0x63'),_0xf4d7('0x64')],'raw':!![]});})[_0xf4d7('0x1c')](handleEntityNotFound(_0x38edee,null))[_0xf4d7('0x1c')](function(_0x3bfb7b){if(_0x3bfb7b){var _0x1ecff4=_0x3bfb7b[_0xf4d7('0x5d')]&&fs[_0xf4d7('0x65')](path[_0xf4d7('0x66')](config[_0xf4d7('0x67')],_0x3262f3,_[_0xf4d7('0x68')](_0x3bfb7b[_0xf4d7('0x5d')])))?path['join'](config['root'],_0x3262f3,_[_0xf4d7('0x68')](_0x3bfb7b['logo'])):path[_0xf4d7('0x66')](config[_0xf4d7('0x67')],_0x3262f3,_['toLower'](_0xf4d7('0x69')));var _0x333eb5=_0xf4d7('0x6a')+_[_0xf4d7('0x6b')]('logo');if(_0x3bfb7b[_0x333eb5]||!_0x116271[_0xf4d7('0x6c')]){_0x1ecff4=path[_0xf4d7('0x66')](config['root'],_0x3262f3,_[_0xf4d7('0x68')]('default_logo.svg'));}if(!fs[_0xf4d7('0x65')](_0x1ecff4)){throw new db[(_0xf4d7('0x6d'))][(_0xf4d7('0x6e'))](_[_0xf4d7('0x6b')]('logo')+_0xf4d7('0x6f'));}return _0x38edee[_0xf4d7('0x70')](_0x1ecff4);}})[_0xf4d7('0x27')](handleError(_0x38edee,null));};var utilLicense=require(_0xf4d7('0x17'));exports['getLogoLogin']=function(_0x1f824f,_0x18d1ab,_0xe8dab4){var _0xb1db81='server/files/images/logos';var _0x149479={'custom':![]};return utilLicense['getLicense']()[_0xf4d7('0x1c')](function(_0x48c59d){if(_0x48c59d){_0x149479=_0x48c59d;}return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x1f824f[_0xf4d7('0x53')]['id']},'attributes':[_0xf4d7('0x5d'),'loginLogo',_0xf4d7('0x5f'),'favicon','defaultLogo',_0xf4d7('0x62'),_0xf4d7('0x63'),_0xf4d7('0x64')],'raw':!![]});})[_0xf4d7('0x1c')](handleEntityNotFound(_0x18d1ab,null))[_0xf4d7('0x1c')](function(_0x24565b){if(_0x24565b){var _0x1f13e2=_0x24565b[_0xf4d7('0x5e')]&&fs[_0xf4d7('0x65')](path['join'](config['root'],_0xb1db81,_[_0xf4d7('0x68')](_0x24565b[_0xf4d7('0x5e')])))?path[_0xf4d7('0x66')](config['root'],_0xb1db81,_[_0xf4d7('0x68')](_0x24565b[_0xf4d7('0x5e')])):path['join'](config[_0xf4d7('0x67')],_0xb1db81,_[_0xf4d7('0x68')](_0xf4d7('0x71')));var _0x112a94='default'+_['upperFirst'](_0xf4d7('0x5e'));if(_0x24565b[_0x112a94]||!_0x149479[_0xf4d7('0x6c')]){_0x1f13e2=path['join'](config['root'],_0xb1db81,_[_0xf4d7('0x68')](_0xf4d7('0x71')));}if(!fs[_0xf4d7('0x65')](_0x1f13e2)){throw new db[(_0xf4d7('0x6d'))][(_0xf4d7('0x6e'))](_['upperFirst'](_0xf4d7('0x5e'))+_0xf4d7('0x6f'));}return _0x18d1ab['download'](_0x1f13e2);}})[_0xf4d7('0x27')](handleError(_0x18d1ab,null));};exports['gdpr']=function(_0x1e1028,_0x32ac34){return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x1e1028['params']['id']},'attributes':['securePassword']})[_0xf4d7('0x1c')](respondWithResult(_0x32ac34,null))[_0xf4d7('0x27')](handleError(_0x32ac34,null));};exports[_0xf4d7('0x72')]=function(_0x223a60,_0x2a92df,_0xacc727){if(_0x223a60['file']&&_0x223a60[_0xf4d7('0x58')][_0xf4d7('0x59')]){_0x223a60[_0xf4d7('0x55')][_0xf4d7('0x5f')]=_0x223a60['file'][_0xf4d7('0x59')];}return db[_0xf4d7('0x37')]['find']({'where':{'id':_0x223a60['params']['id']}})[_0xf4d7('0x1c')](handleEntityNotFound(_0x2a92df,null))[_0xf4d7('0x1c')](saveUpdates(_0x223a60[_0xf4d7('0x55')],null))[_0xf4d7('0x1c')](respondWithResult(_0x2a92df,null))[_0xf4d7('0x27')](handleError(_0x2a92df,null));};var utilLicense=require('../../config/license/util');exports[_0xf4d7('0x73')]=function(_0x326027,_0x248084,_0x2f7972){var _0x2eeb60=_0xf4d7('0x5b');var _0x1d0a7b={'custom':![]};return utilLicense[_0xf4d7('0x5c')]()[_0xf4d7('0x1c')](function(_0x5e2a16){if(_0x5e2a16){_0x1d0a7b=_0x5e2a16;}return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x326027['params']['id']},'attributes':['logo',_0xf4d7('0x5e'),_0xf4d7('0x5f'),_0xf4d7('0x60'),'defaultLogo',_0xf4d7('0x62'),'defaultPreferred',_0xf4d7('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x248084,null))[_0xf4d7('0x1c')](function(_0x3cd84f){if(_0x3cd84f){var _0x446128=_0x3cd84f[_0xf4d7('0x5f')]&&fs['existsSync'](path['join'](config[_0xf4d7('0x67')],_0x2eeb60,_[_0xf4d7('0x68')](_0x3cd84f[_0xf4d7('0x5f')])))?path[_0xf4d7('0x66')](config['root'],_0x2eeb60,_[_0xf4d7('0x68')](_0x3cd84f['preferred'])):path['join'](config['root'],_0x2eeb60,_[_0xf4d7('0x68')](_0xf4d7('0x74')));var _0x19a524=_0xf4d7('0x6a')+_['upperFirst'](_0xf4d7('0x5f'));if(_0x3cd84f[_0x19a524]||!_0x1d0a7b['custom']||!_0x1d0a7b['preferred']){_0x446128=path[_0xf4d7('0x66')](config['root'],_0x2eeb60,_['toLower'](_0xf4d7('0x74')));}if(!fs[_0xf4d7('0x65')](_0x446128)){throw new db[(_0xf4d7('0x6d'))][(_0xf4d7('0x6e'))](_[_0xf4d7('0x6b')](_0xf4d7('0x5f'))+_0xf4d7('0x6f'));}return _0x248084['download'](_0x446128);}})[_0xf4d7('0x27')](handleError(_0x248084,null));};exports[_0xf4d7('0x75')]=function(_0x5d454e,_0x35719a,_0x2bc2d2){if(_0x5d454e[_0xf4d7('0x58')]&&_0x5d454e[_0xf4d7('0x58')][_0xf4d7('0x59')]){_0x5d454e[_0xf4d7('0x55')][_0xf4d7('0x60')]=_0x5d454e['file'][_0xf4d7('0x59')];}return db[_0xf4d7('0x37')][_0xf4d7('0x56')]({'where':{'id':_0x5d454e[_0xf4d7('0x53')]['id']}})[_0xf4d7('0x1c')](handleEntityNotFound(_0x35719a,null))[_0xf4d7('0x1c')](saveUpdates(_0x5d454e[_0xf4d7('0x55')],null))['then'](respondWithResult(_0x35719a,null))[_0xf4d7('0x27')](handleError(_0x35719a,null));};var utilLicense=require(_0xf4d7('0x17'));exports[_0xf4d7('0x76')]=function(_0x5ef752,_0x1a4a43,_0x246275){var _0x2bbd00=_0xf4d7('0x5b');var _0x235c4e={'custom':![]};return utilLicense[_0xf4d7('0x5c')]()[_0xf4d7('0x1c')](function(_0x27838e){if(_0x27838e){_0x235c4e=_0x27838e;}return db['Setting']['find']({'where':{'id':_0x5ef752[_0xf4d7('0x53')]['id']},'attributes':[_0xf4d7('0x5d'),'loginLogo',_0xf4d7('0x5f'),_0xf4d7('0x60'),'defaultLogo',_0xf4d7('0x62'),_0xf4d7('0x63'),'defaultFavicon'],'raw':!![]});})[_0xf4d7('0x1c')](handleEntityNotFound(_0x1a4a43,null))[_0xf4d7('0x1c')](function(_0x245519){if(_0x245519){var _0x5f24d3=_0x245519[_0xf4d7('0x60')]&&fs[_0xf4d7('0x65')](path['join'](config['root'],_0x2bbd00,_[_0xf4d7('0x68')](_0x245519[_0xf4d7('0x60')])))?path[_0xf4d7('0x66')](config['root'],_0x2bbd00,_[_0xf4d7('0x68')](_0x245519[_0xf4d7('0x60')])):path['join'](config['root'],_0x2bbd00,_[_0xf4d7('0x68')]('default_favicon.ico'));var _0x834f9c=_0xf4d7('0x6a')+_[_0xf4d7('0x6b')](_0xf4d7('0x60'));if(_0x245519[_0x834f9c]||!_0x235c4e[_0xf4d7('0x6c')]){_0x5f24d3=path[_0xf4d7('0x66')](config[_0xf4d7('0x67')],_0x2bbd00,_[_0xf4d7('0x68')](_0xf4d7('0x77')));}if(!fs[_0xf4d7('0x65')](_0x5f24d3)){throw new db[(_0xf4d7('0x6d'))][(_0xf4d7('0x6e'))](_[_0xf4d7('0x6b')](_0xf4d7('0x60'))+'\x20not\x20found');}return _0x1a4a43[_0xf4d7('0x70')](_0x5f24d3);}})['catch'](handleError(_0x1a4a43,null));};exports[_0xf4d7('0x78')]=function(_0x42ecaa,_0x28a10a){var _0x16c46a={'offset':moment()[_0xf4d7('0x79')]()};_0x16c46a[_0xf4d7('0x7a')]=moment()[_0xf4d7('0x79')](_0x16c46a[_0xf4d7('0x2b')])[_0xf4d7('0x7b')](_0xf4d7('0x7c'));return _0x28a10a[_0xf4d7('0x29')](0xc8)[_0xf4d7('0x34')](_0x16c46a);}; \ No newline at end of file +var _0xa854=['defaultLoginLogo','default_loginLogo.svg','default','gdpr','addPreferred','default_preferred.png','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','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','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','intersection','include','find','body','params','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin'];(function(_0x4db1d7,_0xe0d557){var _0x53f2d7=function(_0x167c55){while(--_0x167c55){_0x4db1d7['push'](_0x4db1d7['shift']());}};_0x53f2d7(++_0xe0d557);}(_0xa854,0x103));var _0x4a85=function(_0xb53865,_0x396fd4){_0xb53865=_0xb53865-0x0;var _0x524d54=_0xa854[_0xb53865];return _0x524d54;};'use strict';var emlformat=require(_0x4a85('0x0'));var rimraf=require(_0x4a85('0x1'));var zipdir=require(_0x4a85('0x2'));var jsonpatch=require(_0x4a85('0x3'));var rp=require(_0x4a85('0x4'));var moment=require('moment');var BPromise=require(_0x4a85('0x5'));var Mustache=require('mustache');var util=require(_0x4a85('0x6'));var path=require('path');var sox=require(_0x4a85('0x7'));var csv=require(_0x4a85('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a85('0x9'));var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0x8'));var querystring=require(_0x4a85('0xd'));var Papa=require(_0x4a85('0xe'));var Redis=require(_0x4a85('0xf'));var authService=require(_0x4a85('0x10'));var qs=require(_0x4a85('0x11'));var as=require(_0x4a85('0x12'));var hardwareService=require(_0x4a85('0x13'));var logger=require('../../config/logger')(_0x4a85('0x14'));var utils=require(_0x4a85('0x15'));var config=require(_0x4a85('0x16'));var licenseUtil=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];var jayson=require(_0x4a85('0x19'));var client=jayson[_0x4a85('0x1a')][_0x4a85('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x32d2c1,_0x5e8b82,_0x35e857,_0x2a2802){return new BPromise(function(_0x454596,_0x153d39){var _0x1d5e1d=_0x2a2802||client;return _0x1d5e1d[_0x4a85('0x1c')](_0x32d2c1,_0x35e857)[_0x4a85('0x1d')](function(_0x256a3c){logger[_0x4a85('0x1e')](_0x4a85('0x1f'),_0x5e8b82,_0x4a85('0x20'));logger['debug'](_0x4a85('0x21'),_0x5e8b82,_0x4a85('0x20'),JSON['stringify'](_0x256a3c));if(_0x256a3c[_0x4a85('0x22')]){if(_0x256a3c[_0x4a85('0x22')][_0x4a85('0x23')]===0x1f4){logger['error'](_0x4a85('0x1f'),_0x5e8b82,_0x256a3c[_0x4a85('0x22')][_0x4a85('0x24')]);return _0x153d39(_0x256a3c['error']['message']);}logger[_0x4a85('0x22')](_0x4a85('0x1f'),_0x5e8b82,_0x256a3c[_0x4a85('0x22')][_0x4a85('0x24')]);return _0x454596(_0x256a3c[_0x4a85('0x22')][_0x4a85('0x24')]);}else{logger[_0x4a85('0x1e')](_0x4a85('0x1f'),_0x5e8b82,'request\x20sent');_0x454596(_0x256a3c['result']['message']);}})[_0x4a85('0x25')](function(_0x83fd88){logger[_0x4a85('0x22')](_0x4a85('0x1f'),_0x5e8b82,_0x83fd88);_0x153d39(_0x83fd88);});});}function respondWithStatusCode(_0x4d3774,_0x154bea){_0x154bea=_0x154bea||0xcc;return function(_0x27f9c1){if(_0x27f9c1){return _0x4d3774[_0x4a85('0x26')](_0x154bea);}return _0x4d3774[_0x4a85('0x27')](_0x154bea)[_0x4a85('0x28')]();};}function respondWithResult(_0x4839f5,_0x1075e2){_0x1075e2=_0x1075e2||0xc8;return function(_0x1a9a8c){if(_0x1a9a8c){return _0x4839f5[_0x4a85('0x27')](_0x1075e2)[_0x4a85('0x29')](_0x1a9a8c);}};}function respondWithFilteredResult(_0xab59e0,_0x27cab3){return function(_0x4a34d5){if(_0x4a34d5){var _0x462656=typeof _0x27cab3[_0x4a85('0x2a')]===_0x4a85('0x2b')&&typeof _0x27cab3['limit']===_0x4a85('0x2b');var _0x51d51d=_0x4a34d5[_0x4a85('0x2c')];var _0x1b91ec=_0x462656?0x0:_0x27cab3[_0x4a85('0x2a')];var _0x3ade10=_0x462656?_0x4a34d5[_0x4a85('0x2c')]:_0x27cab3[_0x4a85('0x2a')]+_0x27cab3[_0x4a85('0x2d')];var _0x131eb8;if(_0x3ade10>=_0x51d51d){_0x3ade10=_0x51d51d;_0x131eb8=0xc8;}else{_0x131eb8=0xce;}_0xab59e0['status'](_0x131eb8);return _0xab59e0[_0x4a85('0x2e')]('Content-Range',_0x1b91ec+'-'+_0x3ade10+'/'+_0x51d51d)[_0x4a85('0x29')](_0x4a34d5);}return null;};}function patchUpdates(_0x196cd7){return function(_0x4fee4f){try{jsonpatch[_0x4a85('0x2f')](_0x4fee4f,_0x196cd7,!![]);}catch(_0x362d93){return BPromise[_0x4a85('0x30')](_0x362d93);}return _0x4fee4f[_0x4a85('0x31')]();};}function saveUpdates(_0x9b33c6,_0x181dfa){return function(_0x16a1b5){if(_0x16a1b5){return _0x16a1b5[_0x4a85('0x32')](_0x9b33c6)[_0x4a85('0x1d')](function(_0x89e5bb){return _0x89e5bb;});}return null;};}function removeEntity(_0x327a1c,_0x3612e7){return function(_0x5326a8){if(_0x5326a8){return _0x5326a8[_0x4a85('0x33')]()[_0x4a85('0x1d')](function(){_0x327a1c[_0x4a85('0x27')](0xcc)[_0x4a85('0x28')]();});}};}function handleEntityNotFound(_0x50aefd,_0x825687){return function(_0x5c838d){if(!_0x5c838d){_0x50aefd[_0x4a85('0x26')](0x194);}return _0x5c838d;};}function handleError(_0x117c3d,_0x3441af){_0x3441af=_0x3441af||0x1f4;return function(_0x41827f){logger[_0x4a85('0x22')](_0x41827f['stack']);if(_0x41827f[_0x4a85('0x34')]){delete _0x41827f[_0x4a85('0x34')];}_0x117c3d['status'](_0x3441af)[_0x4a85('0x35')](_0x41827f);};}exports[_0x4a85('0x36')]=function(_0x1de887,_0x5ca719){var _0x2d15f7={},_0x2eddef={},_0x3672ff={'count':0x0,'rows':[]};var _0x3d716c=_[_0x4a85('0x37')](db[_0x4a85('0x38')][_0x4a85('0x39')],function(_0x2ee041){return{'name':_0x2ee041[_0x4a85('0x3a')],'type':_0x2ee041['type'][_0x4a85('0x3b')]};});_0x2eddef[_0x4a85('0x3c')]=_[_0x4a85('0x37')](_0x3d716c,'name');_0x2eddef[_0x4a85('0x3d')]=_['keys'](_0x1de887[_0x4a85('0x3d')]);_0x2eddef[_0x4a85('0x3e')]=_['intersection'](_0x2eddef[_0x4a85('0x3c')],_0x2eddef[_0x4a85('0x3d')]);_0x2d15f7[_0x4a85('0x3f')]=_['intersection'](_0x2eddef['model'],qs[_0x4a85('0x40')](_0x1de887[_0x4a85('0x3d')]['fields']));_0x2d15f7['attributes']=_0x2d15f7['attributes'][_0x4a85('0x41')]?_0x2d15f7[_0x4a85('0x3f')]:_0x2eddef['model'];if(!_0x1de887['query'][_0x4a85('0x42')](_0x4a85('0x43'))){_0x2d15f7[_0x4a85('0x2d')]=qs[_0x4a85('0x2d')](_0x1de887[_0x4a85('0x3d')][_0x4a85('0x2d')]);_0x2d15f7[_0x4a85('0x2a')]=qs[_0x4a85('0x2a')](_0x1de887['query']['offset']);}_0x2d15f7[_0x4a85('0x44')]=qs['sort'](_0x1de887['query'][_0x4a85('0x45')]);_0x2d15f7[_0x4a85('0x46')]=qs[_0x4a85('0x3e')](_[_0x4a85('0x47')](_0x1de887[_0x4a85('0x3d')],_0x2eddef[_0x4a85('0x3e')]),_0x3d716c);if(_0x1de887[_0x4a85('0x3d')][_0x4a85('0x48')]){_0x2d15f7['where']=_['merge'](_0x2d15f7[_0x4a85('0x46')],{'$or':_[_0x4a85('0x37')](_0x3d716c,function(_0x2a96d1){if(_0x2a96d1[_0x4a85('0x49')]!==_0x4a85('0x4a')){var _0x4bd64b={};_0x4bd64b[_0x2a96d1['name']]={'$like':'%'+_0x1de887[_0x4a85('0x3d')][_0x4a85('0x48')]+'%'};return _0x4bd64b;}})});}_0x2d15f7=_[_0x4a85('0x4b')]({},_0x2d15f7,_0x1de887[_0x4a85('0x4c')]);var _0x382dff={'where':_0x2d15f7[_0x4a85('0x46')]};return db[_0x4a85('0x38')][_0x4a85('0x2c')](_0x382dff)[_0x4a85('0x1d')](function(_0x760ec8){_0x3672ff[_0x4a85('0x2c')]=_0x760ec8;if(_0x1de887[_0x4a85('0x3d')][_0x4a85('0x4d')]){_0x2d15f7['include']=[{'all':!![]}];}return db[_0x4a85('0x38')][_0x4a85('0x4e')](_0x2d15f7);})[_0x4a85('0x1d')](function(_0x5b7f9e){_0x3672ff[_0x4a85('0x4f')]=_0x5b7f9e;return _0x3672ff;})[_0x4a85('0x1d')](respondWithFilteredResult(_0x5ca719,_0x2d15f7))['catch'](handleError(_0x5ca719,null));};exports[_0x4a85('0x50')]=function(_0x1cd122,_0x4c8154){var _0x5cfa99={'raw':![],'where':{'id':_0x1cd122['params']['id']}},_0x10b0e1={};_0x10b0e1[_0x4a85('0x3c')]=_[_0x4a85('0x51')](db[_0x4a85('0x38')][_0x4a85('0x39')]);_0x10b0e1[_0x4a85('0x3d')]=_[_0x4a85('0x51')](_0x1cd122['query']);_0x10b0e1['filters']=_[_0x4a85('0x52')](_0x10b0e1[_0x4a85('0x3c')],_0x10b0e1[_0x4a85('0x3d')]);_0x5cfa99[_0x4a85('0x3f')]=_[_0x4a85('0x52')](_0x10b0e1[_0x4a85('0x3c')],qs[_0x4a85('0x40')](_0x1cd122[_0x4a85('0x3d')][_0x4a85('0x40')]));_0x5cfa99[_0x4a85('0x3f')]=_0x5cfa99[_0x4a85('0x3f')][_0x4a85('0x41')]?_0x5cfa99[_0x4a85('0x3f')]:_0x10b0e1[_0x4a85('0x3c')];if(_0x1cd122['query'][_0x4a85('0x4d')]){_0x5cfa99[_0x4a85('0x53')]=[{'all':!![]}];}_0x5cfa99=_['merge']({},_0x5cfa99,_0x1cd122['options']);return db[_0x4a85('0x38')][_0x4a85('0x54')](_0x5cfa99)['then'](handleEntityNotFound(_0x4c8154,null))[_0x4a85('0x1d')](respondWithResult(_0x4c8154,null))[_0x4a85('0x25')](handleError(_0x4c8154,null));};exports['update']=function(_0x12432c,_0x5d5db3){if(_0x12432c[_0x4a85('0x55')]['id']){delete _0x12432c[_0x4a85('0x55')]['id'];}return db[_0x4a85('0x38')][_0x4a85('0x54')]({'where':{'id':_0x12432c[_0x4a85('0x56')]['id']}})[_0x4a85('0x1d')](handleEntityNotFound(_0x5d5db3,null))[_0x4a85('0x1d')](saveUpdates(_0x12432c[_0x4a85('0x55')],null))[_0x4a85('0x1d')](respondWithResult(_0x5d5db3,null))['catch'](handleError(_0x5d5db3,null));};exports[_0x4a85('0x57')]=function(_0x46303e,_0x3acbb3,_0x29ae20){if(_0x46303e[_0x4a85('0x58')]&&_0x46303e['file'][_0x4a85('0x59')]){_0x46303e['body'][_0x4a85('0x5a')]=_0x46303e[_0x4a85('0x58')][_0x4a85('0x59')];}return db['Setting'][_0x4a85('0x54')]({'where':{'id':_0x46303e[_0x4a85('0x56')]['id']}})[_0x4a85('0x1d')](handleEntityNotFound(_0x3acbb3,null))[_0x4a85('0x1d')](saveUpdates(_0x46303e[_0x4a85('0x55')],null))[_0x4a85('0x1d')](respondWithResult(_0x3acbb3,null))['catch'](handleError(_0x3acbb3,null));};exports['addLogoLogin']=function(_0x83b49e,_0x183020,_0x16fd6e){if(_0x83b49e[_0x4a85('0x58')]&&_0x83b49e[_0x4a85('0x58')]['filename']){_0x83b49e[_0x4a85('0x55')][_0x4a85('0x5b')]=_0x83b49e[_0x4a85('0x58')]['filename'];}return db['Setting'][_0x4a85('0x54')]({'where':{'id':_0x83b49e[_0x4a85('0x56')]['id']}})[_0x4a85('0x1d')](handleEntityNotFound(_0x183020,null))[_0x4a85('0x1d')](saveUpdates(_0x83b49e[_0x4a85('0x55')],null))[_0x4a85('0x1d')](respondWithResult(_0x183020,null))[_0x4a85('0x25')](handleError(_0x183020,null));};var utilLicense=require(_0x4a85('0x17'));exports['getLogo']=function(_0x27c1a4,_0xb79352,_0x4a188b){var _0x589589=_0x4a85('0x5c');var _0x4756bc={'custom':![]};return utilLicense[_0x4a85('0x5d')]()['then'](function(_0x237208){if(_0x237208){_0x4756bc=_0x237208;}return db[_0x4a85('0x38')][_0x4a85('0x54')]({'where':{'id':_0x27c1a4[_0x4a85('0x56')]['id']},'attributes':[_0x4a85('0x5a'),_0x4a85('0x5b'),_0x4a85('0x5e'),_0x4a85('0x5f'),_0x4a85('0x60'),'defaultLoginLogo',_0x4a85('0x61'),_0x4a85('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0xb79352,null))[_0x4a85('0x1d')](function(_0x3384b4){if(_0x3384b4){var _0x3bc900=_0x3384b4['logo']&&fs['existsSync'](path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x589589,_[_0x4a85('0x65')](_0x3384b4[_0x4a85('0x5a')])))?path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x589589,_['toLower'](_0x3384b4['logo'])):path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x589589,_[_0x4a85('0x65')](_0x4a85('0x66')));var _0x156472='default'+_[_0x4a85('0x67')](_0x4a85('0x5a'));if(_0x3384b4[_0x156472]||!_0x4756bc[_0x4a85('0x68')]){_0x3bc900=path['join'](config[_0x4a85('0x64')],_0x589589,_[_0x4a85('0x65')]('default_logo.svg'));}if(!fs[_0x4a85('0x69')](_0x3bc900)){throw new db['Sequelize'][(_0x4a85('0x6a'))](_[_0x4a85('0x67')](_0x4a85('0x5a'))+_0x4a85('0x6b'));}return _0xb79352[_0x4a85('0x6c')](_0x3bc900);}})[_0x4a85('0x25')](handleError(_0xb79352,null));};var utilLicense=require(_0x4a85('0x17'));exports[_0x4a85('0x6d')]=function(_0x56b9f3,_0x293ecf,_0x22da45){var _0x381209=_0x4a85('0x5c');var _0x501b76={'custom':![]};return utilLicense[_0x4a85('0x5d')]()[_0x4a85('0x1d')](function(_0x44e077){if(_0x44e077){_0x501b76=_0x44e077;}return db[_0x4a85('0x38')]['find']({'where':{'id':_0x56b9f3[_0x4a85('0x56')]['id']},'attributes':[_0x4a85('0x5a'),_0x4a85('0x5b'),_0x4a85('0x5e'),_0x4a85('0x5f'),'defaultLogo',_0x4a85('0x6e'),_0x4a85('0x61'),_0x4a85('0x62')],'raw':!![]});})[_0x4a85('0x1d')](handleEntityNotFound(_0x293ecf,null))[_0x4a85('0x1d')](function(_0x4ebd25){if(_0x4ebd25){var _0x14cdc1=_0x4ebd25[_0x4a85('0x5b')]&&fs[_0x4a85('0x69')](path[_0x4a85('0x63')](config['root'],_0x381209,_['toLower'](_0x4ebd25[_0x4a85('0x5b')])))?path[_0x4a85('0x63')](config['root'],_0x381209,_['toLower'](_0x4ebd25[_0x4a85('0x5b')])):path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x381209,_[_0x4a85('0x65')](_0x4a85('0x6f')));var _0x154a3d=_0x4a85('0x70')+_['upperFirst'](_0x4a85('0x5b'));if(_0x4ebd25[_0x154a3d]||!_0x501b76[_0x4a85('0x68')]){_0x14cdc1=path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x381209,_[_0x4a85('0x65')](_0x4a85('0x6f')));}if(!fs[_0x4a85('0x69')](_0x14cdc1)){throw new db['Sequelize'][(_0x4a85('0x6a'))](_[_0x4a85('0x67')]('loginLogo')+_0x4a85('0x6b'));}return _0x293ecf[_0x4a85('0x6c')](_0x14cdc1);}})[_0x4a85('0x25')](handleError(_0x293ecf,null));};exports[_0x4a85('0x71')]=function(_0x2d3280,_0x1ea5b7){return db[_0x4a85('0x38')]['find']({'where':{'id':_0x2d3280[_0x4a85('0x56')]['id']},'attributes':['securePassword']})[_0x4a85('0x1d')](respondWithResult(_0x1ea5b7,null))['catch'](handleError(_0x1ea5b7,null));};exports[_0x4a85('0x72')]=function(_0x37ed96,_0x19c2e7,_0x2c552e){if(_0x37ed96[_0x4a85('0x58')]&&_0x37ed96[_0x4a85('0x58')][_0x4a85('0x59')]){_0x37ed96[_0x4a85('0x55')][_0x4a85('0x5e')]=_0x37ed96[_0x4a85('0x58')][_0x4a85('0x59')];}return db['Setting'][_0x4a85('0x54')]({'where':{'id':_0x37ed96[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x19c2e7,null))[_0x4a85('0x1d')](saveUpdates(_0x37ed96[_0x4a85('0x55')],null))[_0x4a85('0x1d')](respondWithResult(_0x19c2e7,null))[_0x4a85('0x25')](handleError(_0x19c2e7,null));};var utilLicense=require(_0x4a85('0x17'));exports['getPreferred']=function(_0x8054b3,_0x1d7aec,_0x4c3186){var _0x93109b=_0x4a85('0x5c');var _0x1450c9={'custom':![]};return utilLicense['getLicense']()[_0x4a85('0x1d')](function(_0x265068){if(_0x265068){_0x1450c9=_0x265068;}return db[_0x4a85('0x38')][_0x4a85('0x54')]({'where':{'id':_0x8054b3[_0x4a85('0x56')]['id']},'attributes':[_0x4a85('0x5a'),_0x4a85('0x5b'),_0x4a85('0x5e'),_0x4a85('0x5f'),_0x4a85('0x60'),_0x4a85('0x6e'),_0x4a85('0x61'),_0x4a85('0x62')],'raw':!![]});})[_0x4a85('0x1d')](handleEntityNotFound(_0x1d7aec,null))['then'](function(_0x21118e){if(_0x21118e){var _0x18bd0c=_0x21118e['preferred']&&fs[_0x4a85('0x69')](path['join'](config[_0x4a85('0x64')],_0x93109b,_[_0x4a85('0x65')](_0x21118e['preferred'])))?path['join'](config['root'],_0x93109b,_[_0x4a85('0x65')](_0x21118e[_0x4a85('0x5e')])):path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x93109b,_[_0x4a85('0x65')](_0x4a85('0x73')));var _0x5a5bf2='default'+_['upperFirst'](_0x4a85('0x5e'));if(_0x21118e[_0x5a5bf2]||!_0x1450c9['custom']||!_0x1450c9['preferred']){_0x18bd0c=path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x93109b,_[_0x4a85('0x65')]('default_preferred.png'));}if(!fs[_0x4a85('0x69')](_0x18bd0c)){throw new db[(_0x4a85('0x74'))]['ValidationError'](_[_0x4a85('0x67')](_0x4a85('0x5e'))+'\x20not\x20found');}return _0x1d7aec[_0x4a85('0x6c')](_0x18bd0c);}})[_0x4a85('0x25')](handleError(_0x1d7aec,null));};exports[_0x4a85('0x75')]=function(_0x4a54e6,_0x37a36f,_0x2dfea3){if(_0x4a54e6['file']&&_0x4a54e6['file'][_0x4a85('0x59')]){_0x4a54e6[_0x4a85('0x55')][_0x4a85('0x5f')]=_0x4a54e6[_0x4a85('0x58')]['filename'];}return db[_0x4a85('0x38')]['find']({'where':{'id':_0x4a54e6[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x37a36f,null))[_0x4a85('0x1d')](saveUpdates(_0x4a54e6['body'],null))[_0x4a85('0x1d')](respondWithResult(_0x37a36f,null))[_0x4a85('0x25')](handleError(_0x37a36f,null));};var utilLicense=require('../../config/license/util');exports[_0x4a85('0x76')]=function(_0x58bc27,_0x41725f,_0x2efa91){var _0x5cde58=_0x4a85('0x5c');var _0x3a1800={'custom':![]};return utilLicense[_0x4a85('0x5d')]()[_0x4a85('0x1d')](function(_0xc1c6b4){if(_0xc1c6b4){_0x3a1800=_0xc1c6b4;}return db['Setting'][_0x4a85('0x54')]({'where':{'id':_0x58bc27[_0x4a85('0x56')]['id']},'attributes':[_0x4a85('0x5a'),_0x4a85('0x5b'),'preferred','favicon',_0x4a85('0x60'),_0x4a85('0x6e'),'defaultPreferred',_0x4a85('0x62')],'raw':!![]});})[_0x4a85('0x1d')](handleEntityNotFound(_0x41725f,null))[_0x4a85('0x1d')](function(_0x38d82c){if(_0x38d82c){var _0x168edd=_0x38d82c[_0x4a85('0x5f')]&&fs['existsSync'](path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x5cde58,_[_0x4a85('0x65')](_0x38d82c['favicon'])))?path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x5cde58,_[_0x4a85('0x65')](_0x38d82c[_0x4a85('0x5f')])):path['join'](config[_0x4a85('0x64')],_0x5cde58,_[_0x4a85('0x65')]('default_favicon.ico'));var _0xd917be=_0x4a85('0x70')+_['upperFirst'](_0x4a85('0x5f'));if(_0x38d82c[_0xd917be]||!_0x3a1800[_0x4a85('0x68')]){_0x168edd=path[_0x4a85('0x63')](config[_0x4a85('0x64')],_0x5cde58,_['toLower'](_0x4a85('0x77')));}if(!fs[_0x4a85('0x69')](_0x168edd)){throw new db[(_0x4a85('0x74'))][(_0x4a85('0x6a'))](_[_0x4a85('0x67')](_0x4a85('0x5f'))+'\x20not\x20found');}return _0x41725f[_0x4a85('0x6c')](_0x168edd);}})[_0x4a85('0x25')](handleError(_0x41725f,null));};exports[_0x4a85('0x78')]=function(_0x5a7b75,_0x36e9ce){var _0x2b6ba0={'offset':moment()[_0x4a85('0x79')]()};_0x2b6ba0[_0x4a85('0x7a')]=moment()[_0x4a85('0x79')](_0x2b6ba0[_0x4a85('0x2a')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x36e9ce['status'](0xc8)[_0x4a85('0x35')](_0x2b6ba0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9c8e0b3..ef72f8e 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(_0x21ab0d,_0x2c1f71){var _0x8585f1=function(_0x457335){while(--_0x457335){_0x21ab0d['push'](_0x21ab0d['shift']());}};_0x8585f1(++_0x2c1f71);}(_0xedd9,0xfc));var _0x9edd=function(_0xad0e6d,_0x15d9c8){_0xad0e6d=_0xad0e6d-0x0;var _0x25ca1c=_0xedd9[_0xad0e6d];return _0x25ca1c;};'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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x96c93a,_0x4b995c){var _0x2dcd5e=function(_0x2336f6){while(--_0x2336f6){_0x96c93a['push'](_0x96c93a['shift']());}};_0x2dcd5e(++_0x4b995c);}(_0x34e8,0x12c));var _0x834e=function(_0xa81b4d,_0x4c04c1){_0xa81b4d=_0xa81b4d-0x0;var _0xc91ab3=_0x34e8[_0xa81b4d];return _0xc91ab3;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 6b61121..6d03126 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 _0xfaab=['error','code','message','result','catch','ShowSetting','options','raw','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x123ed1,_0x5f3314){var _0x42b3b7=function(_0x583045){while(--_0x583045){_0x123ed1['push'](_0x123ed1['shift']());}};_0x42b3b7(++_0x5f3314);}(_0xfaab,0x10c));var _0xbfaa=function(_0x44c891,_0xa91e7b){_0x44c891=_0x44c891-0x0;var _0x4b0582=_0xfaab[_0x44c891];return _0x4b0582;};'use strict';var _=require(_0xbfaa('0x0'));var util=require(_0xbfaa('0x1'));var moment=require(_0xbfaa('0x2'));var BPromise=require(_0xbfaa('0x3'));var rs=require(_0xbfaa('0x4'));var fs=require('fs');var Redis=require(_0xbfaa('0x5'));var db=require(_0xbfaa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfaa('0x7'))(_0xbfaa('0x8'));var config=require(_0xbfaa('0x9'));var jayson=require(_0xbfaa('0xa'));var client=jayson[_0xbfaa('0xb')][_0xbfaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a6969,_0x33ba1a,_0x35c7f9){return new BPromise(function(_0x2c8639,_0x247c57){return client[_0xbfaa('0xd')](_0x3a6969,_0x35c7f9)[_0xbfaa('0xe')](function(_0x34c0ca){logger[_0xbfaa('0xf')](_0xbfaa('0x10'),_0x33ba1a,_0xbfaa('0x11'));logger['debug'](_0xbfaa('0x12'),_0x33ba1a,_0xbfaa('0x11'),JSON[_0xbfaa('0x13')](_0x34c0ca));if(_0x34c0ca[_0xbfaa('0x14')]){if(_0x34c0ca[_0xbfaa('0x14')][_0xbfaa('0x15')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x33ba1a,_0x34c0ca[_0xbfaa('0x14')]['message']);return _0x247c57(_0x34c0ca['error'][_0xbfaa('0x16')]);}logger['error']('Setting,\x20%s,\x20%s',_0x33ba1a,_0x34c0ca[_0xbfaa('0x14')][_0xbfaa('0x16')]);return _0x2c8639(_0x34c0ca['error']['message']);}else{logger[_0xbfaa('0xf')](_0xbfaa('0x10'),_0x33ba1a,'request\x20sent');_0x2c8639(_0x34c0ca[_0xbfaa('0x17')][_0xbfaa('0x16')]);}})[_0xbfaa('0x18')](function(_0x1b1166){logger['error'](_0xbfaa('0x10'),_0x33ba1a,_0x1b1166);_0x247c57(_0x1b1166);});});}exports[_0xbfaa('0x19')]=function(_0x3c05e5){var _0x8fdf4a=this;return new Promise(function(_0xb0b6b8,_0x4c26d6){return db['Setting']['find']({'raw':_0x3c05e5[_0xbfaa('0x1a')]?_0x3c05e5[_0xbfaa('0x1a')][_0xbfaa('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c05e5[_0xbfaa('0x1a')]?_0x3c05e5[_0xbfaa('0x1a')]['where']||null:null,'attributes':_0x3c05e5[_0xbfaa('0x1a')]?_0x3c05e5['options'][_0xbfaa('0x1c')]||null:null,'include':_0x3c05e5['options']?_0x3c05e5[_0xbfaa('0x1a')][_0xbfaa('0x1d')]?_['map'](_0x3c05e5[_0xbfaa('0x1a')][_0xbfaa('0x1d')],function(_0xd85c71){return{'model':db[_0xd85c71[_0xbfaa('0x1e')]],'as':_0xd85c71['as'],'attributes':_0xd85c71[_0xbfaa('0x1c')],'include':_0xd85c71['include']?_[_0xbfaa('0x1f')](_0xd85c71[_0xbfaa('0x1d')],function(_0xd4367d){return{'model':db[_0xd4367d[_0xbfaa('0x1e')]],'as':_0xd4367d['as'],'attributes':_0xd4367d['attributes'],'include':_0xd4367d[_0xbfaa('0x1d')]?_['map'](_0xd4367d[_0xbfaa('0x1d')],function(_0x18e4be){return{'model':db[_0x18e4be[_0xbfaa('0x1e')]],'as':_0x18e4be['as'],'attributes':_0x18e4be[_0xbfaa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbfaa('0xe')](function(_0x54b7a9){logger[_0xbfaa('0xf')]('ShowSetting',_0x3c05e5);logger['debug']('ShowSetting',_0x3c05e5,JSON[_0xbfaa('0x13')](_0x54b7a9));_0xb0b6b8(_0x54b7a9);})[_0xbfaa('0x18')](function(_0x78b6b7){logger['error']('ShowSetting',_0x78b6b7[_0xbfaa('0x16')],_0x3c05e5);_0x4c26d6(_0x8fdf4a[_0xbfaa('0x14')](0x1f4,_0x78b6b7['message']));});});}; \ No newline at end of file +var _0xb450=['include','map','attributes','model','then','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','find','options','raw'];(function(_0xdb0cc5,_0x33653a){var _0x153aa=function(_0x138677){while(--_0x138677){_0xdb0cc5['push'](_0xdb0cc5['shift']());}};_0x153aa(++_0x33653a);}(_0xb450,0xab));var _0x0b45=function(_0x5925b5,_0x35005c){_0x5925b5=_0x5925b5-0x0;var _0x5b2ac2=_0xb450[_0x5925b5];return _0x5b2ac2;};'use strict';var _=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var moment=require(_0x0b45('0x2'));var BPromise=require(_0x0b45('0x3'));var rs=require(_0x0b45('0x4'));var fs=require('fs');var Redis=require(_0x0b45('0x5'));var db=require(_0x0b45('0x6'))['db'];var utils=require(_0x0b45('0x7'));var logger=require(_0x0b45('0x8'))(_0x0b45('0x9'));var config=require(_0x0b45('0xa'));var jayson=require(_0x0b45('0xb'));var client=jayson[_0x0b45('0xc')][_0x0b45('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e5c3d,_0x20232c,_0xa24ae6){return new BPromise(function(_0x39b35c,_0x3d7bcf){return client[_0x0b45('0xe')](_0x1e5c3d,_0xa24ae6)['then'](function(_0x2bb923){logger[_0x0b45('0xf')](_0x0b45('0x10'),_0x20232c,_0x0b45('0x11'));logger[_0x0b45('0x12')](_0x0b45('0x13'),_0x20232c,'request\x20sent',JSON[_0x0b45('0x14')](_0x2bb923));if(_0x2bb923[_0x0b45('0x15')]){if(_0x2bb923[_0x0b45('0x15')][_0x0b45('0x16')]===0x1f4){logger[_0x0b45('0x15')](_0x0b45('0x10'),_0x20232c,_0x2bb923['error'][_0x0b45('0x17')]);return _0x3d7bcf(_0x2bb923['error'][_0x0b45('0x17')]);}logger[_0x0b45('0x15')](_0x0b45('0x10'),_0x20232c,_0x2bb923[_0x0b45('0x15')]['message']);return _0x39b35c(_0x2bb923[_0x0b45('0x15')][_0x0b45('0x17')]);}else{logger[_0x0b45('0xf')](_0x0b45('0x10'),_0x20232c,'request\x20sent');_0x39b35c(_0x2bb923['result'][_0x0b45('0x17')]);}})['catch'](function(_0x4df2ba){logger[_0x0b45('0x15')](_0x0b45('0x10'),_0x20232c,_0x4df2ba);_0x3d7bcf(_0x4df2ba);});});}exports['ShowSetting']=function(_0x4a8ef6){var _0x19188=this;return new Promise(function(_0x4f5d14,_0x2e9a76){return db['Setting'][_0x0b45('0x18')]({'raw':_0x4a8ef6[_0x0b45('0x19')]?_0x4a8ef6[_0x0b45('0x19')][_0x0b45('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a8ef6[_0x0b45('0x19')]?_0x4a8ef6[_0x0b45('0x19')]['where']||null:null,'attributes':_0x4a8ef6[_0x0b45('0x19')]?_0x4a8ef6[_0x0b45('0x19')]['attributes']||null:null,'include':_0x4a8ef6[_0x0b45('0x19')]?_0x4a8ef6[_0x0b45('0x19')][_0x0b45('0x1b')]?_[_0x0b45('0x1c')](_0x4a8ef6[_0x0b45('0x19')][_0x0b45('0x1b')],function(_0x21dc29){return{'model':db[_0x21dc29['model']],'as':_0x21dc29['as'],'attributes':_0x21dc29[_0x0b45('0x1d')],'include':_0x21dc29[_0x0b45('0x1b')]?_[_0x0b45('0x1c')](_0x21dc29[_0x0b45('0x1b')],function(_0x397106){return{'model':db[_0x397106[_0x0b45('0x1e')]],'as':_0x397106['as'],'attributes':_0x397106[_0x0b45('0x1d')],'include':_0x397106['include']?_[_0x0b45('0x1c')](_0x397106[_0x0b45('0x1b')],function(_0x468ce6){return{'model':db[_0x468ce6[_0x0b45('0x1e')]],'as':_0x468ce6['as'],'attributes':_0x468ce6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b45('0x1f')](function(_0x7b078b){logger[_0x0b45('0xf')](_0x0b45('0x20'),_0x4a8ef6);logger['debug'](_0x0b45('0x20'),_0x4a8ef6,JSON[_0x0b45('0x14')](_0x7b078b));_0x4f5d14(_0x7b078b);})['catch'](function(_0x56d530){logger[_0x0b45('0x15')](_0x0b45('0x20'),_0x56d530[_0x0b45('0x17')],_0x4a8ef6);_0x2e9a76(_0x19188[_0x0b45('0x15')](0x1f4,_0x56d530[_0x0b45('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3117a6d..310ab84 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x273f92,_0x5e6ea2){var _0x38b53c=function(_0x494d4e){while(--_0x494d4e){_0x273f92['push'](_0x273f92['shift']());}};_0x38b53c(++_0x5e6ea2);}(_0x326f,0xd1));var _0xf326=function(_0x12948c,_0x27cb85){_0x12948c=_0x12948c-0x0;var _0x3c888f=_0x326f[_0x12948c];return _0x3c888f;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0xa94fb2,_0xc1a930){var _0x5bb3a7=function(_0x3c20b7){while(--_0x3c20b7){_0xa94fb2['push'](_0xa94fb2['shift']());}};_0x5bb3a7(++_0xc1a930);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4cfaa21..653700e 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 _0xe269=['infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc'];(function(_0x5f5721,_0x437819){var _0x4beab9=function(_0x2ac8f9){while(--_0x2ac8f9){_0x5f5721['push'](_0x5f5721['shift']());}};_0x4beab9(++_0x437819);}(_0xe269,0xce));var _0x9e26=function(_0x175727,_0x27b338){_0x175727=_0x175727-0x0;var _0x4ffc6f=_0xe269[_0x175727];return _0x4ffc6f;};'use strict';var Sequelize=require(_0x9e26('0x0'));var rs=require(_0x9e26('0x1'));module[_0x9e26('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e26('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9e26('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9e26('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9e26('0x4')]},'type':{'type':Sequelize[_0x9e26('0x5')](_0x9e26('0x6'),_0x9e26('0x7'),_0x9e26('0x8'),_0x9e26('0x9'),_0x9e26('0xa'),_0x9e26('0xb'),_0x9e26('0xc'),_0x9e26('0xd'),_0x9e26('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x9e26('0x4')]},'authId':{'type':Sequelize[_0x9e26('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x9e26('0x4')]},'password':{'type':Sequelize[_0x9e26('0x4')]},'apiKey':{'type':Sequelize[_0x9e26('0x4')]},'applicationId':{'type':Sequelize[_0x9e26('0x4')]},'accountId':{'type':Sequelize[_0x9e26('0x4')]},'senderString':{'type':Sequelize[_0x9e26('0x4')]},'deliveryReport':{'type':Sequelize[_0x9e26('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x9e26('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9e26('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9e26('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9e26('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9e26('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9e26('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e26('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9e26('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x370894){if(!_0x370894)this[_0x9e26('0x12')](_0x9e26('0x13'),null);this[_0x9e26('0x12')]('mandatoryDisposition',_0x370894);}}}; \ No newline at end of file +var _0x406c=['connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby'];(function(_0x59f9ca,_0x3baa72){var _0x229751=function(_0x17b5a4){while(--_0x17b5a4){_0x59f9ca['push'](_0x59f9ca['shift']());}};_0x229751(++_0x3baa72);}(_0x406c,0x1d3));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc406('0x0'));var rs=require(_0xc406('0x1'));module[_0xc406('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xc406('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc406('0x3')],'defaultValue':function(){return rs[_0xc406('0x4')]();}},'phone':{'type':Sequelize[_0xc406('0x3')]},'type':{'type':Sequelize[_0xc406('0x5')](_0xc406('0x6'),_0xc406('0x7'),_0xc406('0x8'),_0xc406('0x9'),_0xc406('0xa'),_0xc406('0xb'),_0xc406('0xc'),_0xc406('0xd'),_0xc406('0xe'),_0xc406('0xf'))},'accountSid':{'type':Sequelize[_0xc406('0x3')]},'authId':{'type':Sequelize[_0xc406('0x3')]},'authToken':{'type':Sequelize[_0xc406('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc406('0x3')]},'password':{'type':Sequelize[_0xc406('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xc406('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc406('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc406('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc406('0x10')],'defaultValue':function(){return _0xc406('0x11');}},'notificationSound':{'type':Sequelize[_0xc406('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc406('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc406('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc406('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc406('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc406('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc406('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc406('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc406('0x12')],'defaultValue':![],'comment':_0xc406('0x15'),'set':function(_0x641752){if(!_0x641752)this[_0xc406('0x16')](_0xc406('0x17'),null);this['setDataValue'](_0xc406('0x18'),_0x641752);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2ba1d4c..f3642bf 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 _0x1725=['infobip','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','autoclose','applications','push','close','interaction','created','ContactId','AttachmentId','UserId','User','agent','*,*,*,*','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','statusInt','requestid','results','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','SmsAccount','include','show','params','keys','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','filter','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','orderBy','priority','asc','account','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text'];(function(_0x2f0371,_0x4a1588){var _0x4941aa=function(_0x5e2f1a){while(--_0x5e2f1a){_0x2f0371['push'](_0x2f0371['shift']());}};_0x4941aa(++_0x4a1588);}(_0x1725,0x13a));var _0x5172=function(_0xe85976,_0x41acf8){_0xe85976=_0xe85976-0x0;var _0x14c552=_0x1725[_0xe85976];return _0x14c552;};'use strict';var emlformat=require(_0x5172('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5172('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5172('0x2'));var moment=require(_0x5172('0x3'));var BPromise=require(_0x5172('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5172('0x5'));var sox=require(_0x5172('0x6'));var csv=require(_0x5172('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5172('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5172('0x9'));var jsforce=require(_0x5172('0xa'));var deskjs=require(_0x5172('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5172('0xc'));var Papa=require('papaparse');var Redis=require(_0x5172('0xd'));var authService=require(_0x5172('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5172('0xf'));var logger=require('../../config/logger')(_0x5172('0x10'));var utils=require(_0x5172('0x11'));var config=require(_0x5172('0x12'));var licenseUtil=require(_0x5172('0x13'));var db=require(_0x5172('0x14'))['db'];config[_0x5172('0x15')]=_[_0x5172('0x16')](config[_0x5172('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5172('0x17'))(new Redis(config['redis']));require(_0x5172('0x18'))[_0x5172('0x19')](socket);var jayson=require(_0x5172('0x1a'));var client=jayson['client'][_0x5172('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x5d0ba6,_0x3c8e60,_0x33ba8d,_0xa0ce4){return new BPromise(function(_0x1d42cc,_0x5962fa){var _0x2f0cd1=_0xa0ce4||client;return _0x2f0cd1['request'](_0x5d0ba6,_0x33ba8d)[_0x5172('0x1c')](function(_0x18c25b){logger[_0x5172('0x1d')](_0x5172('0x1e'),_0x3c8e60,_0x5172('0x1f'));logger[_0x5172('0x20')](_0x5172('0x21'),_0x3c8e60,_0x5172('0x1f'),JSON[_0x5172('0x22')](_0x18c25b));if(_0x18c25b['error']){if(_0x18c25b[_0x5172('0x23')][_0x5172('0x24')]===0x1f4){logger[_0x5172('0x23')](_0x5172('0x1e'),_0x3c8e60,_0x18c25b[_0x5172('0x23')][_0x5172('0x25')]);return _0x5962fa(_0x18c25b[_0x5172('0x23')][_0x5172('0x25')]);}logger[_0x5172('0x23')](_0x5172('0x1e'),_0x3c8e60,_0x18c25b[_0x5172('0x23')][_0x5172('0x25')]);return _0x1d42cc(_0x18c25b[_0x5172('0x23')]['message']);}else{logger[_0x5172('0x1d')](_0x5172('0x1e'),_0x3c8e60,'request\x20sent');_0x1d42cc(_0x18c25b['result'][_0x5172('0x25')]);}})[_0x5172('0x26')](function(_0xd25557){logger[_0x5172('0x23')]('SmsAccount,\x20%s,\x20%s',_0x3c8e60,_0xd25557);_0x5962fa(_0xd25557);});});}function respondWithStatusCode(_0x226b26,_0x2cf808){_0x2cf808=_0x2cf808||0xcc;return function(_0x19813c){if(_0x19813c){return _0x226b26[_0x5172('0x27')](_0x2cf808);}return _0x226b26['status'](_0x2cf808)[_0x5172('0x28')]();};}function respondWithResult(_0x303b55,_0x227e70){_0x227e70=_0x227e70||0xc8;return function(_0x5bc1d9){if(_0x5bc1d9){return _0x303b55['status'](_0x227e70)[_0x5172('0x29')](_0x5bc1d9);}};}function respondWithFilteredResult(_0x359336,_0x36f27a){return function(_0x2b1c1e){if(_0x2b1c1e){var _0x465947=typeof _0x36f27a[_0x5172('0x2a')]===_0x5172('0x2b')&&typeof _0x36f27a[_0x5172('0x2c')]==='undefined';var _0x216ec4=_0x2b1c1e['count'];var _0x3bb290=_0x465947?0x0:_0x36f27a[_0x5172('0x2a')];var _0x33ca51=_0x465947?_0x2b1c1e[_0x5172('0x2d')]:_0x36f27a[_0x5172('0x2a')]+_0x36f27a[_0x5172('0x2c')];var _0xb8eabe;if(_0x33ca51>=_0x216ec4){_0x33ca51=_0x216ec4;_0xb8eabe=0xc8;}else{_0xb8eabe=0xce;}_0x359336[_0x5172('0x2e')](_0xb8eabe);return _0x359336[_0x5172('0x2f')]('Content-Range',_0x3bb290+'-'+_0x33ca51+'/'+_0x216ec4)[_0x5172('0x29')](_0x2b1c1e);}return null;};}function patchUpdates(_0x40f2a9){return function(_0x59b292){try{jsonpatch[_0x5172('0x30')](_0x59b292,_0x40f2a9,!![]);}catch(_0x5f8c0e){return BPromise['reject'](_0x5f8c0e);}return _0x59b292[_0x5172('0x31')]();};}function saveUpdates(_0x406214,_0x4edd0e){return function(_0x561361){if(_0x561361){return _0x561361[_0x5172('0x32')](_0x406214)[_0x5172('0x1c')](function(_0x3445b3){return _0x3445b3;});}return null;};}function removeEntity(_0x21597b,_0x283797){return function(_0x3f444c){if(_0x3f444c){return _0x3f444c[_0x5172('0x33')]()[_0x5172('0x1c')](function(){var _0x2f3abf=_0x3f444c[_0x5172('0x34')]({'plain':!![]});var _0x4116bd=_0x5172('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x4116bd,'resourceId':_0x2f3abf['id']}})[_0x5172('0x1c')](function(){return _0x3f444c;});})['then'](function(){_0x21597b[_0x5172('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ada2,_0x44126f){return function(_0x3ee402){if(!_0x3ee402){_0x56ada2['sendStatus'](0x194);}return _0x3ee402;};}function handleError(_0x26ea51,_0x119a38){_0x119a38=_0x119a38||0x1f4;return function(_0xae7a81){logger['error'](_0xae7a81[_0x5172('0x36')]);if(_0xae7a81[_0x5172('0x37')]){delete _0xae7a81[_0x5172('0x37')];}_0x26ea51[_0x5172('0x2e')](_0x119a38)[_0x5172('0x38')](_0xae7a81);};}exports[_0x5172('0x39')]=function(_0x467e97,_0x230c96){var _0x57ef40={'include':[{'model':db[_0x5172('0x3a')],'as':_0x5172('0x3b')}]},_0x84f179={},_0x36f258={'count':0x0,'rows':[]};var _0x30f2df=_[_0x5172('0x3c')](db['SmsAccount'][_0x5172('0x3d')],function(_0x362bcf){return{'name':_0x362bcf[_0x5172('0x3e')],'type':_0x362bcf['type'][_0x5172('0x3f')]};});_0x84f179[_0x5172('0x40')]=_['map'](_0x30f2df,_0x5172('0x37'));_0x84f179[_0x5172('0x41')]=_['keys'](_0x467e97['query']);_0x84f179[_0x5172('0x42')]=_[_0x5172('0x43')](_0x84f179[_0x5172('0x40')],_0x84f179[_0x5172('0x41')]);_0x57ef40[_0x5172('0x44')]=_[_0x5172('0x43')](_0x84f179[_0x5172('0x40')],qs['fields'](_0x467e97[_0x5172('0x41')]['fields']));_0x57ef40[_0x5172('0x44')]=_0x57ef40['attributes']['length']?_0x57ef40[_0x5172('0x44')]:_0x84f179[_0x5172('0x40')];if(!_0x467e97[_0x5172('0x41')][_0x5172('0x45')](_0x5172('0x46'))){_0x57ef40[_0x5172('0x2c')]=qs['limit'](_0x467e97['query'][_0x5172('0x2c')]);_0x57ef40[_0x5172('0x2a')]=qs['offset'](_0x467e97['query'][_0x5172('0x2a')]);}_0x57ef40[_0x5172('0x47')]=qs['sort'](_0x467e97[_0x5172('0x41')][_0x5172('0x48')]);_0x57ef40[_0x5172('0x49')]=qs[_0x5172('0x42')](_[_0x5172('0x4a')](_0x467e97[_0x5172('0x41')],_0x84f179[_0x5172('0x42')]),_0x30f2df);if(_0x467e97['query']['filter']){_0x57ef40[_0x5172('0x49')]=_[_0x5172('0x4b')](_0x57ef40[_0x5172('0x49')],{'$or':_[_0x5172('0x3c')](_0x30f2df,function(_0x7825ed){if(_0x7825ed[_0x5172('0x4c')]!=='VIRTUAL'){var _0x173c9e={};_0x173c9e[_0x7825ed[_0x5172('0x37')]]={'$like':'%'+_0x467e97['query']['filter']+'%'};return _0x173c9e;}})});}_0x57ef40=_[_0x5172('0x4b')]({},_0x57ef40,_0x467e97[_0x5172('0x4d')]);var _0x3bca70={'where':_0x57ef40[_0x5172('0x49')]};return db[_0x5172('0x4e')][_0x5172('0x2d')](_0x3bca70)[_0x5172('0x1c')](function(_0x3f0aa9){_0x36f258[_0x5172('0x2d')]=_0x3f0aa9;if(_0x467e97['query']['includeAll']){_0x57ef40[_0x5172('0x4f')]=[{'all':!![]}];}return db[_0x5172('0x4e')]['findAll'](_0x57ef40);})[_0x5172('0x1c')](function(_0x5dd1cf){_0x36f258['rows']=_0x5dd1cf;return _0x36f258;})[_0x5172('0x1c')](respondWithFilteredResult(_0x230c96,_0x57ef40))[_0x5172('0x26')](handleError(_0x230c96,null));};exports[_0x5172('0x50')]=function(_0x86109d,_0x24dffa){var _0x4a8ada={'raw':![],'where':{'id':_0x86109d[_0x5172('0x51')]['id']},'include':[{'model':db[_0x5172('0x3a')],'as':_0x5172('0x3b')}]},_0x5d9d5d={};_0x5d9d5d[_0x5172('0x40')]=_[_0x5172('0x52')](db[_0x5172('0x4e')][_0x5172('0x3d')]);_0x5d9d5d[_0x5172('0x41')]=_[_0x5172('0x52')](_0x86109d[_0x5172('0x41')]);_0x5d9d5d[_0x5172('0x42')]=_[_0x5172('0x43')](_0x5d9d5d[_0x5172('0x40')],_0x5d9d5d['query']);_0x4a8ada[_0x5172('0x44')]=_['intersection'](_0x5d9d5d['model'],qs[_0x5172('0x53')](_0x86109d[_0x5172('0x41')][_0x5172('0x53')]));_0x4a8ada[_0x5172('0x44')]=_0x4a8ada[_0x5172('0x44')][_0x5172('0x54')]?_0x4a8ada[_0x5172('0x44')]:_0x5d9d5d[_0x5172('0x40')];if(_0x86109d[_0x5172('0x41')][_0x5172('0x55')]){_0x4a8ada[_0x5172('0x4f')]=[{'all':!![]}];}_0x4a8ada=_[_0x5172('0x4b')]({},_0x4a8ada,_0x86109d[_0x5172('0x4d')]);return db[_0x5172('0x4e')][_0x5172('0x56')](_0x4a8ada)[_0x5172('0x1c')](handleEntityNotFound(_0x24dffa,null))[_0x5172('0x1c')](respondWithResult(_0x24dffa,null))[_0x5172('0x26')](handleError(_0x24dffa,null));};exports[_0x5172('0x57')]=function(_0xa73258,_0x40256a){return db[_0x5172('0x4e')][_0x5172('0x57')](_0xa73258[_0x5172('0x58')],{})[_0x5172('0x1c')](function(_0x1c3f25){var _0x3db4b3=_0xa73258[_0x5172('0x59')][_0x5172('0x34')]({'plain':!![]});if(!_0x3db4b3)throw new Error(_0x5172('0x5a'));if(_0x3db4b3[_0x5172('0x5b')]===_0x5172('0x59')){var _0x1a2815=_0x1c3f25[_0x5172('0x34')]({'plain':!![]});var _0x211d6d=_0x5172('0x35');return db[_0x5172('0x5c')][_0x5172('0x56')]({'where':{'name':_0x211d6d,'userProfileId':_0x3db4b3['userProfileId']},'raw':!![]})[_0x5172('0x1c')](function(_0x5abec2){if(_0x5abec2&&_0x5abec2[_0x5172('0x5d')]===0x0){return db[_0x5172('0x5e')]['create']({'name':_0x1a2815[_0x5172('0x37')],'resourceId':_0x1a2815['id'],'type':_0x5abec2[_0x5172('0x37')],'sectionId':_0x5abec2['id']},{})[_0x5172('0x1c')](function(){return _0x1c3f25;});}else{return _0x1c3f25;}})[_0x5172('0x26')](function(_0x1f0911){logger[_0x5172('0x23')](_0x5172('0x5f'),_0x1f0911);throw _0x1f0911;});}return _0x1c3f25;})[_0x5172('0x1c')](respondWithResult(_0x40256a,0xc9))['catch'](handleError(_0x40256a,null));};exports['update']=function(_0x44087f,_0x3c76e6){if(_0x44087f[_0x5172('0x58')]['id']){delete _0x44087f['body']['id'];}return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x44087f[_0x5172('0x51')]['id']},'include':[{'model':db[_0x5172('0x3a')],'as':_0x5172('0x3b')}]})[_0x5172('0x1c')](handleEntityNotFound(_0x3c76e6,null))[_0x5172('0x1c')](saveUpdates(_0x44087f['body'],null))['then'](respondWithResult(_0x3c76e6,null))['catch'](handleError(_0x3c76e6,null));};exports[_0x5172('0x33')]=function(_0x29b8f0,_0x5d6625){return db['SmsAccount'][_0x5172('0x56')]({'where':{'id':_0x29b8f0[_0x5172('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d6625,null))[_0x5172('0x1c')](removeEntity(_0x5d6625,null))['catch'](handleError(_0x5d6625,null));};exports[_0x5172('0x60')]=function(_0x5f5e56,_0x4b200f){return db[_0x5172('0x4e')][_0x5172('0x60')]()[_0x5172('0x1c')](respondWithResult(_0x4b200f,null))[_0x5172('0x26')](handleError(_0x4b200f,null));};exports['addDisposition']=function(_0x584980,_0x2852b0,_0x566747){if(_0x584980[_0x5172('0x58')]['id']){delete _0x584980[_0x5172('0x58')]['id'];}return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x584980['params']['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x2852b0,null))['then'](function(_0x1b331b){if(_0x1b331b){_0x584980['body'][_0x5172('0x61')]=_0x1b331b['id'];return db[_0x5172('0x62')][_0x5172('0x57')](_0x584980[_0x5172('0x58')]);}})[_0x5172('0x1c')](respondWithResult(_0x2852b0,null))['catch'](handleError(_0x2852b0,null));};exports[_0x5172('0x63')]=function(_0x2f970d,_0x35dbc6,_0x34d167){var _0x41e743={'raw':![],'where':{}};var _0xa98c2e={};var _0x13b993={'count':0x0,'rows':[]};return db[_0x5172('0x4e')][_0x5172('0x64')]({'where':{'id':_0x2f970d['params']['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x35dbc6,null))[_0x5172('0x1c')](function(_0x2ffc73){if(_0x2ffc73){_0xa98c2e[_0x5172('0x40')]=_[_0x5172('0x52')](db['Disposition']['rawAttributes']);_0xa98c2e['query']=_[_0x5172('0x52')](_0x2f970d['query']);_0xa98c2e[_0x5172('0x42')]=_[_0x5172('0x43')](_0xa98c2e[_0x5172('0x40')],_0xa98c2e['query']);_0x41e743[_0x5172('0x44')]=_['intersection'](_0xa98c2e[_0x5172('0x40')],qs[_0x5172('0x53')](_0x2f970d['query'][_0x5172('0x53')]));_0x41e743[_0x5172('0x44')]=_0x41e743['attributes'][_0x5172('0x54')]?_0x41e743[_0x5172('0x44')]:_0xa98c2e['model'];if(!_0x2f970d[_0x5172('0x41')][_0x5172('0x45')]('nolimit')){_0x41e743[_0x5172('0x2c')]=qs[_0x5172('0x2c')](_0x2f970d['query'][_0x5172('0x2c')]);_0x41e743[_0x5172('0x2a')]=qs[_0x5172('0x2a')](_0x2f970d[_0x5172('0x41')][_0x5172('0x2a')]);}_0x41e743['order']=qs[_0x5172('0x48')](_0x2f970d['query'][_0x5172('0x48')]);_0x41e743[_0x5172('0x49')]=qs['filters'](_['pick'](_0x2f970d[_0x5172('0x41')],_0xa98c2e[_0x5172('0x42')]));_0x41e743['where'][_0x5172('0x61')]=_0x2ffc73['id'];if(_0x2f970d['query'][_0x5172('0x65')]){_0x41e743[_0x5172('0x49')]=_['merge'](_0x41e743[_0x5172('0x49')],{'$or':_[_0x5172('0x3c')](_0x41e743[_0x5172('0x44')],function(_0x374773){var _0x23fc7d={};_0x23fc7d[_0x374773]={'$like':'%'+_0x2f970d[_0x5172('0x41')]['filter']+'%'};return _0x23fc7d;})});}_0x41e743=_[_0x5172('0x4b')]({},_0x41e743,_0x2f970d[_0x5172('0x4d')]);return db[_0x5172('0x62')][_0x5172('0x2d')]({'where':_0x41e743['where']})[_0x5172('0x1c')](function(_0x4f8a91){_0x13b993[_0x5172('0x2d')]=_0x4f8a91;if(_0x2f970d[_0x5172('0x41')][_0x5172('0x55')]){_0x41e743['include']=[{'all':!![]}];}return db['Disposition'][_0x5172('0x66')](_0x41e743);})[_0x5172('0x1c')](function(_0x7d8aab){_0x13b993[_0x5172('0x67')]=_0x7d8aab;return _0x13b993;});}})[_0x5172('0x1c')](respondWithFilteredResult(_0x35dbc6,_0x41e743))[_0x5172('0x26')](handleError(_0x35dbc6,null));};exports[_0x5172('0x68')]=function(_0x29199a,_0x59f7f3,_0x44f327){return db['SmsAccount']['find']({'where':{'id':_0x29199a[_0x5172('0x51')]['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x59f7f3,null))['then'](function(_0x2762c2){if(_0x2762c2){return _0x2762c2[_0x5172('0x68')](_0x29199a[_0x5172('0x41')][_0x5172('0x69')]);}})[_0x5172('0x1c')](respondWithStatusCode(_0x59f7f3,null))['catch'](handleError(_0x59f7f3,null));};exports[_0x5172('0x6a')]=function(_0x22df18,_0x78ecc0,_0x385f0b){if(_0x22df18['body']['id']){delete _0x22df18[_0x5172('0x58')]['id'];}return db['SmsAccount'][_0x5172('0x56')]({'where':{'id':_0x22df18[_0x5172('0x51')]['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x78ecc0,null))[_0x5172('0x1c')](function(_0x4e49c4){if(_0x4e49c4){_0x22df18[_0x5172('0x58')]['SmsAccountId']=_0x4e49c4['id'];return db[_0x5172('0x6b')]['create'](_0x22df18['body']);}})['then'](respondWithResult(_0x78ecc0,null))[_0x5172('0x26')](handleError(_0x78ecc0,null));};exports['getAnswers']=function(_0x530973,_0x347b5f,_0xbacf3){var _0x4830f4={'raw':![],'where':{}};var _0x117417={};var _0x5ba1df={'count':0x0,'rows':[]};return db[_0x5172('0x4e')][_0x5172('0x64')]({'where':{'id':_0x530973[_0x5172('0x51')]['id']}})['then'](handleEntityNotFound(_0x347b5f,null))[_0x5172('0x1c')](function(_0x23775e){if(_0x23775e){_0x117417[_0x5172('0x40')]=_[_0x5172('0x52')](db['CannedAnswer'][_0x5172('0x3d')]);_0x117417['query']=_[_0x5172('0x52')](_0x530973['query']);_0x117417['filters']=_['intersection'](_0x117417['model'],_0x117417[_0x5172('0x41')]);_0x4830f4[_0x5172('0x44')]=_[_0x5172('0x43')](_0x117417[_0x5172('0x40')],qs[_0x5172('0x53')](_0x530973[_0x5172('0x41')][_0x5172('0x53')]));_0x4830f4[_0x5172('0x44')]=_0x4830f4['attributes']['length']?_0x4830f4[_0x5172('0x44')]:_0x117417[_0x5172('0x40')];if(!_0x530973[_0x5172('0x41')][_0x5172('0x45')](_0x5172('0x46'))){_0x4830f4[_0x5172('0x2c')]=qs[_0x5172('0x2c')](_0x530973[_0x5172('0x41')][_0x5172('0x2c')]);_0x4830f4[_0x5172('0x2a')]=qs[_0x5172('0x2a')](_0x530973['query'][_0x5172('0x2a')]);}_0x4830f4[_0x5172('0x47')]=qs[_0x5172('0x48')](_0x530973[_0x5172('0x41')]['sort']);_0x4830f4[_0x5172('0x49')]=qs[_0x5172('0x42')](_[_0x5172('0x4a')](_0x530973[_0x5172('0x41')],_0x117417[_0x5172('0x42')]));_0x4830f4['where'][_0x5172('0x61')]=_0x23775e['id'];if(_0x530973[_0x5172('0x41')][_0x5172('0x65')]){_0x4830f4[_0x5172('0x49')]=_[_0x5172('0x4b')](_0x4830f4[_0x5172('0x49')],{'$or':_['map'](_0x4830f4['attributes'],function(_0x1d0312){var _0x112950={};_0x112950[_0x1d0312]={'$like':'%'+_0x530973[_0x5172('0x41')][_0x5172('0x65')]+'%'};return _0x112950;})});}_0x4830f4=_['merge']({},_0x4830f4,_0x530973['options']);return db[_0x5172('0x6b')][_0x5172('0x2d')]({'where':_0x4830f4[_0x5172('0x49')]})[_0x5172('0x1c')](function(_0x3abf89){_0x5ba1df[_0x5172('0x2d')]=_0x3abf89;if(_0x530973['query']['includeAll']){_0x4830f4[_0x5172('0x4f')]=[{'all':!![]}];}return db[_0x5172('0x6b')][_0x5172('0x66')](_0x4830f4);})[_0x5172('0x1c')](function(_0x24f8a0){_0x5ba1df[_0x5172('0x67')]=_0x24f8a0;return _0x5ba1df;});}})[_0x5172('0x1c')](respondWithFilteredResult(_0x347b5f,_0x4830f4))[_0x5172('0x26')](handleError(_0x347b5f,null));};exports[_0x5172('0x6c')]=function(_0x33d3ca,_0x402944,_0x175098){return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x33d3ca['params']['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x402944,null))[_0x5172('0x1c')](function(_0x1340a6){if(_0x1340a6){return _0x1340a6['removeAnswers'](_0x33d3ca[_0x5172('0x41')][_0x5172('0x69')]);}})['then'](respondWithStatusCode(_0x402944,null))[_0x5172('0x26')](handleError(_0x402944,null));};exports[_0x5172('0x6d')]=function(_0x367774,_0xfde265,_0x226b3f){var _0x1f3fe7={'channel':_0x5172('0x6e')};var _0x36c296=[];var _0x1b4352=[];var _0x2704db={};return db[_0x5172('0x4e')]['find']({'where':{'id':_0x367774[_0x5172('0x51')]['id']},'include':[{'model':db[_0x5172('0x6f')],'as':_0x5172('0x70')}]})[_0x5172('0x1c')](handleEntityNotFound(_0xfde265,null))[_0x5172('0x1c')](function(_0x3837fb){_0x1f3fe7['account']=_0x3837fb;_0x1f3fe7['applications']=_[_0x5172('0x71')](_0x3837fb[_0x5172('0x70')],[_0x5172('0x72')],[_0x5172('0x73')]);if(_0x1f3fe7[_0x5172('0x74')][_0x5172('0x70')]){delete _0x1f3fe7['account'][_0x5172('0x70')];}return db['CmContact']['describe']();})[_0x5172('0x1c')](function(_0x46903c){if(!_0x46903c){throw new db[(_0x5172('0x75'))][(_0x5172('0x76'))]('no\x20available\x20attributes');}_0x36c296=_[_0x5172('0x77')](_[_0x5172('0x52')](_0x46903c),[_0x5172('0x78'),_0x5172('0x79')]);_0x1b4352=_[_0x5172('0x77')](_['keys'](_0x46903c),[_0x5172('0x78'),'updatedAt',_0x5172('0x7a'),_0x5172('0x7b')]);_0x1f3fe7[_0x5172('0x58')]={'mapKey':_0x5172('0x7c')};if(_0x1f3fe7[_0x5172('0x74')][_0x5172('0x4c')]){switch(_0x1f3fe7[_0x5172('0x74')][_0x5172('0x4c')]){case'twilio':_0x1f3fe7['body'][_0x5172('0x7d')]=_0x367774[_0x5172('0x58')][_0x5172('0x7e')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')][_0x5172('0x7f')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')][_0x5172('0x81')];break;case'skebby':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')]='+'+_0x367774[_0x5172('0x58')][_0x5172('0x82')];_0x1f3fe7[_0x5172('0x58')]['body']=_0x367774[_0x5172('0x58')][_0x5172('0x83')];break;case'connectel':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')]=_0x367774['body'][_0x5172('0x7d')];_0x1f3fe7['body'][_0x5172('0x58')]=_0x367774[_0x5172('0x58')]['message'];break;case _0x5172('0x84'):_0x1f3fe7['body'][_0x5172('0x7d')]=_0x367774['body'][_0x5172('0x7d')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774['body']['body'];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')][_0x5172('0x85')];break;case _0x5172('0x86'):_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')]=_0x367774[_0x5172('0x58')]['From'];_0x1f3fe7['body'][_0x5172('0x58')]=_0x367774['body'][_0x5172('0x87')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')]['MessageUUID'];break;case _0x5172('0x88'):_0x1f3fe7[_0x5172('0x58')]['from']='+'+_0x367774[_0x5172('0x58')]['results'][0x0][_0x5172('0x7d')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')]['results'][0x0][_0x5172('0x83')];_0x1f3fe7['body'][_0x5172('0x80')]=_0x367774[_0x5172('0x58')]['results'][0x0][_0x5172('0x80')];break;case _0x5172('0x89'):_0x1f3fe7[_0x5172('0x58')]['from']=_0x367774[_0x5172('0x58')][_0x5172('0x8a')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')][_0x5172('0x8b')][_0x5172('0x25')];break;case _0x5172('0x8c'):_0x1f3fe7[_0x5172('0x58')]['from']=_0x367774[_0x5172('0x58')][_0x5172('0x8d')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')][_0x5172('0x83')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')][_0x5172('0x8e')];break;case _0x5172('0x8f'):_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')][0x0][_0x5172('0x25')]['id'];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')]=_0x367774['body'][0x0][_0x5172('0x25')]['from'];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')][0x0][_0x5172('0x25')][_0x5172('0x83')];break;case _0x5172('0x90'):_0x1f3fe7[_0x5172('0x58')]['from']=_0x367774[_0x5172('0x58')][_0x5172('0x7d')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]=_0x367774[_0x5172('0x58')][_0x5172('0x25')];_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')]=_0x367774[_0x5172('0x58')][_0x5172('0x91')];break;}}if(_0x1f3fe7[_0x5172('0x58')]['id']){delete _0x1f3fe7[_0x5172('0x58')]['id'];}if(_[_0x5172('0x92')](_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')])){throw new db[(_0x5172('0x75'))][(_0x5172('0x76'))](_0x5172('0x93'));}if(_['isNil'](_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')])||_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')]===''){throw new db[(_0x5172('0x75'))][(_0x5172('0x76'))](_0x5172('0x94'));}if(_[_0x5172('0x92')](_0x1f3fe7[_0x5172('0x58')][_0x5172('0x95')])){throw new db[(_0x5172('0x75'))][(_0x5172('0x76'))](_0x5172('0x96')+_0x1b4352);}if(!_[_0x5172('0x97')](_0x1b4352,_0x1f3fe7[_0x5172('0x58')][_0x5172('0x95')])){throw new db['Sequelize']['ValidationError'](_0x5172('0x98')+_0x1b4352);}_0x2704db[_0x1f3fe7[_0x5172('0x58')][_0x5172('0x95')]]=_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')];return db[_0x5172('0x99')][_0x5172('0x56')]({'where':{'id':_0x1f3fe7[_0x5172('0x74')][_0x5172('0x7b')]},'include':[{'model':db[_0x5172('0x9a')],'as':_0x5172('0x9b'),'where':_0x2704db,'limit':0x1,'order':[['updatedAt',_0x5172('0x9c')]]}]});})[_0x5172('0x1c')](handleEntityNotFound(_0xfde265,null))[_0x5172('0x1c')](function(_0x46ad01){if(_0x46ad01){_0x1f3fe7[_0x5172('0x9d')]=_[_0x5172('0x9e')](_0x46ad01,['Contacts']);if(_0x46ad01['Contacts'][_0x5172('0x54')]){return _0x46ad01[_0x5172('0x9b')][0x0];}var _0x12056f=_[_0x5172('0x16')](_0x1f3fe7['body'],{'firstName':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')],'ListId':_0x46ad01['id']});_0x12056f[_0x1f3fe7[_0x5172('0x58')][_0x5172('0x95')]]=_0x1f3fe7['body'][_0x5172('0x7d')];return db[_0x5172('0x9a')]['create'](_0x12056f,{'fields':_0x36c296,'raw':!![]});}})[_0x5172('0x1c')](handleEntityNotFound(_0xfde265,null))[_0x5172('0x1c')](function(_0x514e21){if(_0x514e21){_0x1f3fe7[_0x5172('0x9f')]=_0x514e21;var _0x21c21a={'ContactId':_0x514e21['id'],'phone':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x7d')],'SmsAccountId':_0x367774[_0x5172('0x51')]['id']};var _0x280509={'ContactId':_0x514e21['id'],'SmsAccountId':_0x367774[_0x5172('0x51')]['id'],'closed':![]};return db[_0x5172('0xa0')][_0x5172('0x56')]({'where':_0x280509})[_0x5172('0x1c')](function(_0x461414){if(_0x461414){return[_0x461414,![]];}return db['SmsInteraction'][_0x5172('0x57')](_0x21c21a)[_0x5172('0x1c')](function(_0x4a608e){return[_0x4a608e,!![]];});});}})[_0x5172('0xa1')](function(_0x5a75d1,_0x1ff7db){_0x1f3fe7['interaction']=_0x5a75d1[_0x5172('0x34')]({'plain':!![]});_0x1f3fe7['interaction']['created']=![];if(_0x1ff7db){if(_0x1f3fe7[_0x5172('0x74')][_0x5172('0xa2')]){_0x1f3fe7[_0x5172('0xa3')][_0x5172('0xa4')]({'id':0x0,'priority':_0x1f3fe7[_0x5172('0xa3')]['length']+0x1,'app':_0x5172('0xa5'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1f3fe7[_0x5172('0xa6')][_0x5172('0xa7')]=!![];}return db['SmsMessage'][_0x5172('0x57')]({'phone':_0x1f3fe7[_0x5172('0x58')]['from'],'messageId':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x80')],'body':_0x1f3fe7[_0x5172('0x58')][_0x5172('0x58')],'SmsAccountId':_0x367774[_0x5172('0x51')]['id'],'SmsInteractionId':_0x5a75d1['id'],'direction':'in','ContactId':_0x5a75d1[_0x5172('0xa8')],'AttachmentId':_0x1f3fe7[_0x5172('0x58')][_0x5172('0xa9')]});})[_0x5172('0x1c')](function(_0x5963a0){_0x1f3fe7[_0x5172('0x25')]=_0x5963a0;if(_0x1f3fe7[_0x5172('0xa6')][_0x5172('0xaa')]){return db[_0x5172('0xab')][_0x5172('0x56')]({'attributes':['id','name'],'where':{'id':_0x1f3fe7[_0x5172('0xa6')][_0x5172('0xaa')]}})[_0x5172('0x1c')](function(_0x1e2b65){if(_0x1e2b65){_0x1f3fe7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5172('0xac'),'appdata':_0x1e2b65[_0x5172('0x37')]+','+(_0x1f3fe7[_0x5172('0x74')]['waitForTheAssignedAgent']||0xa),'interval':_0x5172('0xad')});}return respondWithRpcPromise(_0x5172('0xae'),'startRouting',_0x1f3fe7);});}return respondWithRpcPromise(_0x5172('0xae'),_0x5172('0xaf'),_0x1f3fe7);})[_0x5172('0x1c')](function(_0x23d35b){if(_0x23d35b){var _0x2baa6b=0xc8;var _0x26571a='receiveMessage';logger['info'](_0x5172('0x21'),_0x26571a,_0x2baa6b,_0x5172('0xb0'));logger[_0x5172('0x20')](_0x5172('0xb1'),_0x26571a,_0x2baa6b,_0x5172('0xb0'),JSON[_0x5172('0x22')](_0x23d35b));if(_0x1f3fe7['account']['type']==='twilio'){return _0xfde265['status'](_0x2baa6b)[_0x5172('0x2f')](_0x5172('0xb2'),_0x5172('0xb3'))[_0x5172('0x38')](_0x5172('0xb4'));}else{return _0xfde265[_0x5172('0x2e')](_0x2baa6b)[_0x5172('0x29')](_0x23d35b);}}})[_0x5172('0x26')](handleError(_0xfde265,null));};exports['addApplications']=function(_0x2e0d9b,_0x556832){var _0x3cfa2f=_0x2e0d9b[_0x5172('0x51')]['id'];var _0x55771b=_0x2e0d9b[_0x5172('0x58')];var _0x505c4c=0xc8;var _0x5f5c2b=null;return db['sequelize'][_0x5172('0xb5')]({'isolationLevel':db[_0x5172('0xb6')][_0x5172('0xb7')][_0x5172('0xb8')]['READ_COMMITTED']},function(_0x45c8fa){return db[_0x5172('0x4e')][_0x5172('0x64')]({'where':{'id':_0x3cfa2f},'transaction':_0x45c8fa})[_0x5172('0x1c')](function(_0x4fbfbd){if(_0x4fbfbd){return db[_0x5172('0x6f')][_0x5172('0x33')]({'where':{'SmsAccountId':_0x3cfa2f},'transaction':_0x45c8fa})['then'](function(){var _0x1c4897=_[_0x5172('0x3c')](_0x55771b,function(_0x2cb35c){_0x2cb35c[_0x5172('0x61')]=_0x3cfa2f;return _0x2cb35c;});return db[_0x5172('0x6f')][_0x5172('0xb9')](_0x1c4897,{'transaction':_0x45c8fa});});}else{_0x505c4c=0x194;_0x5f5c2b=[];}});})[_0x5172('0x1c')](function(){if(_0x505c4c!==0x194){return db['SmsApplication'][_0x5172('0xba')]({'where':{'SmsAccountId':_0x3cfa2f},'order':_0x5172('0x72')})['then'](function(_0x454c73){_0x5f5c2b=_0x454c73;});}})['catch'](function(_0x198d5f){_0x505c4c=0x1f4;logger[_0x5172('0x23')](_0x198d5f[_0x5172('0x36')]);if(_0x198d5f[_0x5172('0x37')]){delete _0x198d5f[_0x5172('0x37')];}_0x5f5c2b=_0x198d5f;})[_0x5172('0xbb')](function(){if(_0x5f5c2b===null){_0x556832[_0x5172('0x27')](_0x505c4c);}else{if(_0x505c4c===0x1f4){_0x556832['status'](_0x505c4c)['send'](_0x5f5c2b);}else{_0x556832[_0x5172('0x2e')](_0x505c4c)[_0x5172('0x29')](_0x5f5c2b);}}});};exports[_0x5172('0xbc')]=function(_0x54aef3,_0x3d17e2,_0x548723){var _0x5ca44f={};var _0x40b8d6={};var _0x291697;var _0x75926;return db['SmsAccount'][_0x5172('0x64')]({'where':{'id':_0x54aef3[_0x5172('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d17e2,null))[_0x5172('0x1c')](function(_0x29f520){if(_0x29f520){_0x291697=_0x29f520;_0x40b8d6[_0x5172('0x40')]=_['keys'](db[_0x5172('0x6f')][_0x5172('0x3d')]);_0x40b8d6[_0x5172('0x41')]=_['keys'](_0x54aef3['query']);_0x40b8d6['filters']=_[_0x5172('0x43')](_0x40b8d6[_0x5172('0x40')],_0x40b8d6['query']);_0x5ca44f['attributes']=_[_0x5172('0x43')](_0x40b8d6[_0x5172('0x40')],qs[_0x5172('0x53')](_0x54aef3[_0x5172('0x41')]['fields']));_0x5ca44f[_0x5172('0x44')]=_0x5ca44f[_0x5172('0x44')][_0x5172('0x54')]?_0x5ca44f[_0x5172('0x44')]:_0x40b8d6[_0x5172('0x40')];_0x5ca44f[_0x5172('0x47')]=qs[_0x5172('0x48')](_0x54aef3[_0x5172('0x41')][_0x5172('0x48')]);_0x5ca44f['where']=qs[_0x5172('0x42')](_[_0x5172('0x4a')](_0x54aef3['query'],_0x40b8d6['filters']));if(_0x54aef3[_0x5172('0x41')][_0x5172('0x65')]){_0x5ca44f[_0x5172('0x49')]=_['merge'](_0x5ca44f['where'],{'$or':_[_0x5172('0x3c')](_0x5ca44f[_0x5172('0x44')],function(_0x1c412d){var _0x33fbe2={};_0x33fbe2[_0x1c412d]={'$like':'%'+_0x54aef3[_0x5172('0x41')][_0x5172('0x65')]+'%'};return _0x33fbe2;})});}_0x5ca44f=_['merge']({},_0x5ca44f,_0x54aef3[_0x5172('0x4d')]);return _0x291697[_0x5172('0xbc')](_0x5ca44f);}})[_0x5172('0x1c')](function(_0x2403c1){if(_0x2403c1){_0x75926=_0x2403c1[_0x5172('0x54')];if(!_0x54aef3['query'][_0x5172('0x45')](_0x5172('0x46'))){_0x5ca44f['limit']=qs[_0x5172('0x2c')](_0x54aef3[_0x5172('0x41')][_0x5172('0x2c')]);_0x5ca44f['offset']=qs['offset'](_0x54aef3[_0x5172('0x41')]['offset']);}return _0x291697[_0x5172('0xbc')](_0x5ca44f);}})[_0x5172('0x1c')](function(_0x5700a7){if(_0x5700a7){return _0x5700a7?{'count':_0x75926,'rows':_0x5700a7}:null;}})[_0x5172('0x1c')](respondWithResult(_0x3d17e2,null))[_0x5172('0x26')](handleError(_0x3d17e2,null));};exports[_0x5172('0xbd')]=function(_0x2287d8,_0x45edd9,_0x1b9c34){var _0x3f3cbb={'raw':![],'where':{}};var _0x3640f0={};var _0x1804ce={'count':0x0,'rows':[]};return db[_0x5172('0x4e')][_0x5172('0x64')]({'where':{'id':_0x2287d8['params']['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x45edd9,null))[_0x5172('0x1c')](function(_0xf12b03){if(_0xf12b03){_0x3640f0[_0x5172('0x40')]=_[_0x5172('0x52')](db[_0x5172('0xa0')][_0x5172('0x3d')]);_0x3640f0[_0x5172('0x41')]=_[_0x5172('0x52')](_0x2287d8[_0x5172('0x41')]);_0x3640f0['filters']=_[_0x5172('0x43')](_0x3640f0[_0x5172('0x40')],_0x3640f0[_0x5172('0x41')]);_0x3f3cbb[_0x5172('0x44')]=_[_0x5172('0x43')](_0x3640f0[_0x5172('0x40')],qs['fields'](_0x2287d8[_0x5172('0x41')][_0x5172('0x53')]));_0x3f3cbb[_0x5172('0x44')]=_0x3f3cbb[_0x5172('0x44')]['length']?_0x3f3cbb[_0x5172('0x44')]:_0x3640f0[_0x5172('0x40')];if(!_0x2287d8[_0x5172('0x41')][_0x5172('0x45')](_0x5172('0x46'))){_0x3f3cbb['limit']=qs[_0x5172('0x2c')](_0x2287d8[_0x5172('0x41')][_0x5172('0x2c')]);_0x3f3cbb[_0x5172('0x2a')]=qs[_0x5172('0x2a')](_0x2287d8[_0x5172('0x41')][_0x5172('0x2a')]);}_0x3f3cbb[_0x5172('0x47')]=qs[_0x5172('0x48')](_0x2287d8['query'][_0x5172('0x48')]);_0x3f3cbb[_0x5172('0x49')]=qs[_0x5172('0x42')](_[_0x5172('0x4a')](_0x2287d8['query'],_0x3640f0[_0x5172('0x42')]));_0x3f3cbb[_0x5172('0x49')][_0x5172('0x61')]=_0xf12b03['id'];if(_0x2287d8['query'][_0x5172('0x65')]){_0x3f3cbb['where']=_[_0x5172('0x4b')](_0x3f3cbb[_0x5172('0x49')],{'$or':_[_0x5172('0x3c')](_0x3f3cbb[_0x5172('0x44')],function(_0x54ea44){var _0x47b7e0={};_0x47b7e0[_0x54ea44]={'$like':'%'+_0x2287d8['query'][_0x5172('0x65')]+'%'};return _0x47b7e0;})});}_0x3f3cbb=_[_0x5172('0x4b')]({},_0x3f3cbb,_0x2287d8[_0x5172('0x4d')]);return db['SmsInteraction'][_0x5172('0x2d')]({'where':_0x3f3cbb[_0x5172('0x49')]})[_0x5172('0x1c')](function(_0x104be2){_0x1804ce[_0x5172('0x2d')]=_0x104be2;if(_0x2287d8[_0x5172('0x41')][_0x5172('0x55')]){_0x3f3cbb['include']=[{'model':db[_0x5172('0x9a')],'as':_0x5172('0xbe'),'required':![]},{'model':db[_0x5172('0xab')],'as':_0x5172('0xbf'),'attributes':['name','fullname',_0x5172('0xc0')],'required':![]},{'model':db['Tag'],'as':_0x5172('0xc1'),'attributes':['id',_0x5172('0x37'),_0x5172('0xc2')],'where':_0x2287d8[_0x5172('0x41')][_0x5172('0xc3')]?{'id':_0x2287d8[_0x5172('0x41')][_0x5172('0xc3')]}:undefined,'required':_0x2287d8[_0x5172('0x41')]['tag']?!![]:![]}];}return db[_0x5172('0xa0')][_0x5172('0x66')](_0x3f3cbb);})[_0x5172('0x1c')](function(_0x41c148){_0x1804ce[_0x5172('0x67')]=_0x41c148;return _0x1804ce;});}})['then'](respondWithFilteredResult(_0x45edd9,_0x3f3cbb))['catch'](handleError(_0x45edd9,null));};exports[_0x5172('0x38')]=function(_0x43b4cc,_0x58e92a,_0x317576){var _0x46fc1c,_0x43cf25,_0x2faf4d;if(_[_0x5172('0x92')](_0x43b4cc['body'][_0x5172('0x58')])||_0x43b4cc[_0x5172('0x58')][_0x5172('0x58')]===''){throw new db[(_0x5172('0x75'))][(_0x5172('0x76'))](_0x5172('0x94'));}if(_['isNil'](_0x43b4cc[_0x5172('0x58')]['to'])){throw new db['Sequelize'][(_0x5172('0x76'))](_0x5172('0xc4'));}_0x46fc1c=_0x43b4cc[_0x5172('0x58')]['to'];return db[_0x5172('0x4e')]['find']({'where':{'id':_0x43b4cc[_0x5172('0x51')]['id']},'include':[{'model':db[_0x5172('0x99')],'as':'List','include':[{'model':db[_0x5172('0x9a')],'as':_0x5172('0x9b'),'where':{'mobile':_0x46fc1c},'limit':0x1,'order':[[_0x5172('0x79'),_0x5172('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x58e92a,null))[_0x5172('0x1c')](function(_0x54b18c){if(_0x54b18c&&_0x54b18c[_0x5172('0xc5')]){_0x43cf25=_0x54b18c[_0x5172('0x34')]({'plain':!![]});if(_0x43cf25[_0x5172('0xc5')]&&_0x43cf25[_0x5172('0xc5')]['Contacts'][_0x5172('0x54')]){return _0x43cf25[_0x5172('0xc5')][_0x5172('0x9b')][0x0];}return db[_0x5172('0x9a')][_0x5172('0x57')](_[_0x5172('0x16')](_0x43b4cc[_0x5172('0x58')],{'firstName':_0x46fc1c,'mobile':_0x46fc1c,'phone':_0x46fc1c,'ListId':_0x43cf25[_0x5172('0x7b')]}));}})[_0x5172('0x1c')](handleEntityNotFound(_0x58e92a,null))[_0x5172('0x1c')](function(_0x377eae){if(_0x377eae){_0x2faf4d=_0x377eae;return db[_0x5172('0xa0')][_0x5172('0x56')]({'where':{'ContactId':_0x2faf4d['id'],'closed':![],'SmsAccountId':_0x43cf25['id']}})[_0x5172('0x1c')](function(_0x1c37bf){if(_0x1c37bf){return[_0x1c37bf,![]];}return db[_0x5172('0xa0')]['create']({'UserId':_0x43b4cc['user']['id'],'ContactId':_0x2faf4d['id'],'SmsAccountId':_0x43cf25['id'],'phone':_0x46fc1c,'firstMsgDirection':'out','Messages':[_[_0x5172('0x4b')](_0x43b4cc[_0x5172('0x58')],{'read':![],'body':_0x43b4cc[_0x5172('0x58')][_0x5172('0x58')],'phone':_0x46fc1c,'SmsAccountId':_0x43cf25['id'],'UserId':_0x43b4cc[_0x5172('0x59')]['id'],'ContactId':_0x2faf4d['id']})]},{'include':[{'model':db[_0x5172('0xc6')],'as':_0x5172('0xc7')}]})[_0x5172('0x1c')](function(_0x4d787e){return[_0x4d787e,!![]];});});}})[_0x5172('0xa1')](function(_0x3eb05,_0x13a8ba){if(_0x13a8ba){return _0x3eb05;}return db['SmsMessage'][_0x5172('0x57')](_[_0x5172('0x4b')](_0x43b4cc[_0x5172('0x58')],{'read':![],'body':_0x43b4cc[_0x5172('0x58')]['body'],'phone':_0x46fc1c,'SmsAccountId':_0x43cf25['id'],'SmsInteractionId':_0x3eb05['id'],'UserId':_0x43b4cc[_0x5172('0x59')]['id'],'ContactId':_0x2faf4d['id']}))['then'](function(_0x5276df){_0x3eb05[_0x5172('0xc8')][_0x5172('0xc7')]=[];_0x3eb05[_0x5172('0xc8')][_0x5172('0xc7')][_0x5172('0xa4')](_0x5276df[_0x5172('0xc8')]);return _0x3eb05;});})['then'](respondWithResult(_0x58e92a,null))[_0x5172('0x26')](handleError(_0x58e92a,null));};exports[_0x5172('0x2e')]=function(_0x4cb7ac,_0x50c65c,_0x459f07){if(_0x4cb7ac[_0x5172('0x58')]['id']){delete _0x4cb7ac[_0x5172('0x58')]['id'];}var _0x28f1ff,_0x1946be,_0x237095;return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x4cb7ac['params']['id']}})['then'](handleEntityNotFound(_0x50c65c,null))[_0x5172('0x1c')](function(_0x4e60f6){if(_0x4e60f6){_0x237095=_0x4e60f6;logger[_0x5172('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5172('0x2e'),_0x5172('0xc9'),_0x4e60f6[_0x5172('0x4c')],util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));switch(_0x4e60f6['type']){case _0x5172('0xcb'):if(_0x4cb7ac[_0x5172('0x58')][_0x5172('0xcc')]&&_0x4cb7ac[_0x5172('0x58')][_0x5172('0x2e')]){_0x1946be=_0x4cb7ac[_0x5172('0x58')][_0x5172('0x2e')];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac['body']['skebby_dispatch_id']}});}break;case _0x5172('0xcd'):if(_0x4cb7ac[_0x5172('0x58')]['requestid']&&_0x4cb7ac[_0x5172('0x58')][_0x5172('0xce')]){_0x1946be=_0x4cb7ac[_0x5172('0x58')][_0x5172('0xce')];return db['SmsMessage'][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac['body'][_0x5172('0xcf')]}});}break;case _0x5172('0x84'):if(_0x4cb7ac['body']['message_id']&&_0x4cb7ac[_0x5172('0x58')]['status_code']){_0x1946be=_0x4cb7ac[_0x5172('0x58')]['status_code'];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac[_0x5172('0x58')][_0x5172('0x85')]}});}break;case _0x5172('0x88'):var _0x54ae9c=_0x4cb7ac[_0x5172('0x58')][_0x5172('0xd0')][0x0];if(_0x54ae9c[_0x5172('0x80')]&&_0x54ae9c['status'][_0x5172('0xd1')]==='DELIVERED'){_0x1946be=_0x54ae9c[_0x5172('0x2e')]['groupName'];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x54ae9c[_0x5172('0x80')]}});}break;case'clickatell':if(_0x4cb7ac[_0x5172('0x58')]['messageId']&&_0x4cb7ac[_0x5172('0x58')]['status']){_0x1946be=_0x4cb7ac[_0x5172('0x58')][_0x5172('0x2e')];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac[_0x5172('0x58')][_0x5172('0x80')]}});}break;case _0x5172('0x8f'):if(_0x4cb7ac[_0x5172('0x58')][0x0][_0x5172('0x25')]['id']){_0x1946be=_0x4cb7ac[_0x5172('0x58')][0x0]['type'];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac[_0x5172('0x58')][0x0]['message']['id']}});}break;case _0x5172('0x90'):if(_0x4cb7ac[_0x5172('0x58')][_0x5172('0xd2')]&&_0x4cb7ac[_0x5172('0x58')][_0x5172('0x2e')]){_0x1946be=_0x4cb7ac[_0x5172('0x58')]['status'];return db[_0x5172('0xc6')][_0x5172('0x56')]({'where':{'messageId':_0x4cb7ac[_0x5172('0x58')][_0x5172('0xd2')]}});}break;}}})['then'](handleEntityNotFound(_0x50c65c,null))[_0x5172('0x1c')](function(_0x58e9cf){if(_0x58e9cf){_0x28f1ff=_0x58e9cf;switch(_0x237095[_0x5172('0x4c')]){case _0x5172('0xcb'):if(_0x1946be===_0x5172('0xd3')){return _0x28f1ff['update']({'read':!![]});}else{logger[_0x5172('0x23')](_0x5172('0x21'),'status',_0x5172('0xcb'),util['inspect'](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1946be==='1'){return _0x28f1ff[_0x5172('0x32')]({'read':!![]});}else{logger[_0x5172('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5172('0x2e'),_0x5172('0xcb'),util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5172('0x84'):if(!_0x4cb7ac[_0x5172('0x58')][_0x5172('0xd4')]&&_0x1946be>=0xc8&&_0x1946be<=0xce){return _0x28f1ff['update']({'read':!![]});}else{logger[_0x5172('0x23')](_0x5172('0x21'),_0x5172('0x2e'),_0x5172('0x84'),util['inspect'](_0x4cb7ac['body'],{'showHidden':![],'depth':null}));}break;case _0x5172('0x88'):var _0x437218=_0x4cb7ac['body']['results'][0x0];if(_0x437218[_0x5172('0x2e')][_0x5172('0xd1')]===_0x5172('0xd3')){return _0x28f1ff[_0x5172('0x32')]({'read':!![]});}else{logger[_0x5172('0x23')](_0x5172('0x21'),'status',_0x5172('0x88'),util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5172('0x8c'):if(_0x1946be=='DELIVERED_TO_GATEWAY'||_0x1946be==_0x5172('0xd5')){return _0x28f1ff[_0x5172('0x32')]({'read':!![]});}else{logger['error'](_0x5172('0x21'),'status',_0x5172('0x8c'),util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5172('0x8f'):if(_0x1946be==_0x5172('0xd6')){return _0x28f1ff[_0x5172('0x32')]({'read':!![]});}else{logger[_0x5172('0x23')](_0x5172('0x21'),'status',_0x5172('0x8f'),util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5172('0x90'):if(_0x1946be==='DELIVRD'||_0x1946be===_0x5172('0xd7')){return _0x28f1ff[_0x5172('0x32')]({'read':!![]});}else{logger[_0x5172('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5172('0x2e'),_0x5172('0x90'),util[_0x5172('0xca')](_0x4cb7ac[_0x5172('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x28f1ff;}})[_0x5172('0x1c')](respondWithResult(_0x50c65c,null))[_0x5172('0x26')](handleError(_0x50c65c,null));};exports[_0x5172('0xd8')]=function(_0x53cffe,_0x2858c7,_0xdc58e3){var _0x340b76,_0x2b32b5,_0x40d939;return db[_0x5172('0x4e')]['find']({'where':{'id':_0x53cffe['params']['id']}})['then'](handleEntityNotFound(_0x2858c7,null))['then'](function(_0x928561){if(_0x928561){_0x40d939=_0x928561;logger[_0x5172('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5172('0xc9'),_0x928561[_0x5172('0x4c')],util[_0x5172('0xca')](_0x53cffe[_0x5172('0x41')],{'showHidden':![],'depth':null}));switch(_0x928561[_0x5172('0x4c')]){case _0x5172('0x89'):if(_0x53cffe['query']['message-id']&&_0x53cffe[_0x5172('0x41')]['state']){_0x2b32b5=_0x53cffe[_0x5172('0x41')][_0x5172('0xd9')];return db['SmsMessage'][_0x5172('0x56')]({'where':{'messageId':_0x53cffe[_0x5172('0x41')]['message-id']}});}break;}}})[_0x5172('0x1c')](handleEntityNotFound(_0x2858c7,null))['then'](function(_0xa37bee){if(_0xa37bee){_0x340b76=_0xa37bee;switch(_0x40d939[_0x5172('0x4c')]){case _0x5172('0x89'):if(_0x2b32b5==='2'||_0x2b32b5==='6'){return _0x340b76[_0x5172('0x32')]({'read':!![]});}else{logger[_0x5172('0x23')](_0x5172('0x21'),_0x5172('0x2e'),_0x5172('0x89'),util['inspect'](_0x53cffe[_0x5172('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x340b76;}})[_0x5172('0x1c')](respondWithResult(_0x2858c7,null))[_0x5172('0x26')](handleError(_0x2858c7,null));};exports[_0x5172('0xda')]=function(_0x25f9a5,_0x49fc10,_0x5a62e0){return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x25f9a5[_0x5172('0x51')]['id']}})['then'](handleEntityNotFound(_0x49fc10,null))[_0x5172('0x1c')](function(_0x557504){if(_0x557504){return _0x557504[_0x5172('0xda')](_0x25f9a5[_0x5172('0x58')][_0x5172('0x69')],_[_0x5172('0x9e')](_0x25f9a5[_0x5172('0x58')],[_0x5172('0x69'),'id'])||{})[_0x5172('0xa1')](function(_0x58975b){for(var _0x45c225=0x0;_0x45c225<_0x25f9a5[_0x5172('0x58')][_0x5172('0x69')][_0x5172('0x54')];_0x45c225+=0x1){socket['emit'](_0x5172('0xdb'),{'UserId':Number(_0x25f9a5['body'][_0x5172('0x69')][_0x45c225]),'SmsAccountId':Number(_0x25f9a5['params']['id'])});}return _0x58975b;});}})[_0x5172('0x1c')](respondWithResult(_0x49fc10,null))[_0x5172('0x26')](handleError(_0x49fc10,null));};exports[_0x5172('0xdc')]=function(_0x187f3e,_0xe7c43b,_0x1870df){return db[_0x5172('0x4e')][_0x5172('0x56')]({'where':{'id':_0x187f3e[_0x5172('0x51')]['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0xe7c43b,null))[_0x5172('0x1c')](function(_0x501f2e){if(_0x501f2e){return _0x501f2e[_0x5172('0xdc')](_0x187f3e[_0x5172('0x41')][_0x5172('0x69')])[_0x5172('0x1c')](function(){if(_[_0x5172('0xdd')](_0x187f3e['query'][_0x5172('0x69')])){for(var _0x18045b=0x0;_0x18045b<_0x187f3e[_0x5172('0x41')][_0x5172('0x69')][_0x5172('0x54')];_0x18045b+=0x1){socket[_0x5172('0xde')](_0x5172('0xdf'),{'UserId':Number(_0x187f3e['query'][_0x5172('0x69')][_0x18045b]),'SmsAccountId':Number(_0x187f3e[_0x5172('0x51')]['id'])});}}else{socket[_0x5172('0xde')](_0x5172('0xdf'),{'UserId':Number(_0x187f3e['query']['ids']),'SmsAccountId':Number(_0x187f3e[_0x5172('0x51')]['id'])});}});}})[_0x5172('0x1c')](respondWithStatusCode(_0xe7c43b,null))[_0x5172('0x26')](handleError(_0xe7c43b,null));};exports[_0x5172('0xe0')]=function(_0x1f4344,_0x54b173,_0x579fcb){var _0x30f93c={};var _0x326619={};var _0x5b021d;var _0x24634d;return db[_0x5172('0x4e')][_0x5172('0x64')]({'where':{'id':_0x1f4344['params']['id']}})[_0x5172('0x1c')](handleEntityNotFound(_0x54b173,null))[_0x5172('0x1c')](function(_0x13e7f3){if(_0x13e7f3){_0x5b021d=_0x13e7f3;_0x326619[_0x5172('0x40')]=_[_0x5172('0x52')](db['User']['rawAttributes']);_0x326619[_0x5172('0x41')]=_[_0x5172('0x52')](_0x1f4344[_0x5172('0x41')]);_0x326619[_0x5172('0x42')]=_[_0x5172('0x43')](_0x326619[_0x5172('0x40')],_0x326619[_0x5172('0x41')]);_0x30f93c[_0x5172('0x44')]=_[_0x5172('0x43')](_0x326619['model'],qs['fields'](_0x1f4344[_0x5172('0x41')][_0x5172('0x53')]));_0x30f93c[_0x5172('0x44')]=_0x30f93c[_0x5172('0x44')][_0x5172('0x54')]?_0x30f93c[_0x5172('0x44')]:_0x326619[_0x5172('0x40')];_0x30f93c['order']=qs[_0x5172('0x48')](_0x1f4344[_0x5172('0x41')][_0x5172('0x48')]);_0x30f93c[_0x5172('0x49')]=qs[_0x5172('0x42')](_[_0x5172('0x4a')](_0x1f4344[_0x5172('0x41')],_0x326619[_0x5172('0x42')]));if(_0x1f4344[_0x5172('0x41')][_0x5172('0x65')]){_0x30f93c['where']=_['merge'](_0x30f93c['where'],{'$or':_[_0x5172('0x3c')](_0x30f93c[_0x5172('0x44')],function(_0x1a85d8){var _0x32ae4f={};_0x32ae4f[_0x1a85d8]={'$like':'%'+_0x1f4344[_0x5172('0x41')][_0x5172('0x65')]+'%'};return _0x32ae4f;})});}_0x30f93c=_[_0x5172('0x4b')]({},_0x30f93c,_0x1f4344[_0x5172('0x4d')]);return _0x5b021d[_0x5172('0xe0')](_0x30f93c);}})[_0x5172('0x1c')](function(_0x135305){if(_0x135305){_0x24634d=_0x135305[_0x5172('0x54')];if(!_0x1f4344[_0x5172('0x41')][_0x5172('0x45')]('nolimit')){_0x30f93c[_0x5172('0x2c')]=qs[_0x5172('0x2c')](_0x1f4344['query'][_0x5172('0x2c')]);_0x30f93c[_0x5172('0x2a')]=qs[_0x5172('0x2a')](_0x1f4344[_0x5172('0x41')][_0x5172('0x2a')]);}return _0x5b021d[_0x5172('0xe0')](_0x30f93c);}})[_0x5172('0x1c')](function(_0x4656db){if(_0x4656db){return _0x4656db?{'count':_0x24634d,'rows':_0x4656db}:null;}})['then'](respondWithResult(_0x54b173,null))[_0x5172('0x26')](handleError(_0x54b173,null));}; \ No newline at end of file +var _0x26bd=['priority','asc','Applications','describe','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','mobile','twilio','From','Body','messageId','MessageSid','from','sender','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','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','CmList','ListId','CmContact','list','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','json','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','user','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','DELIVERED','clickatell','redif','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','undefined','limit','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','SmsAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filters','filter','where','merge','map','options','count','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getDispositions','findOne','Disposition','order','SmsAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sms','account','applications'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x26bd,0x7a));var _0xd26b=function(_0x214457,_0x4cc054){_0x214457=_0x214457-0x0;var _0x5f08e0=_0x26bd[_0x214457];return _0x5f08e0;};'use strict';var emlformat=require(_0xd26b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd26b('0x1'));var jsonpatch=require(_0xd26b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd26b('0x3'));var util=require(_0xd26b('0x4'));var path=require(_0xd26b('0x5'));var sox=require(_0xd26b('0x6'));var csv=require(_0xd26b('0x7'));var ejs=require(_0xd26b('0x8'));var fs=require('fs');var fs_extra=require(_0xd26b('0x9'));var _=require(_0xd26b('0xa'));var squel=require(_0xd26b('0xb'));var crypto=require(_0xd26b('0xc'));var jsforce=require(_0xd26b('0xd'));var deskjs=require(_0xd26b('0xe'));var toCsv=require(_0xd26b('0x7'));var querystring=require(_0xd26b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd26b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd26b('0x11'));var as=require(_0xd26b('0x12'));var hardwareService=require(_0xd26b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd26b('0x14'));var config=require(_0xd26b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd26b('0x16'))['db'];config['redis']=_[_0xd26b('0x17')](config[_0xd26b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd26b('0x19'))(new Redis(config[_0xd26b('0x18')]));require(_0xd26b('0x1a'))[_0xd26b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd26b('0x1c')][_0xd26b('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x2f04a1,_0x38cca3,_0x15a965,_0x70b33d){return new BPromise(function(_0x3f317e,_0x287afc){var _0x594e34=_0x70b33d||client;return _0x594e34[_0xd26b('0x1e')](_0x2f04a1,_0x15a965)[_0xd26b('0x1f')](function(_0x5029a5){logger[_0xd26b('0x20')](_0xd26b('0x21'),_0x38cca3,_0xd26b('0x22'));logger[_0xd26b('0x23')](_0xd26b('0x24'),_0x38cca3,'request\x20sent',JSON[_0xd26b('0x25')](_0x5029a5));if(_0x5029a5[_0xd26b('0x26')]){if(_0x5029a5[_0xd26b('0x26')][_0xd26b('0x27')]===0x1f4){logger[_0xd26b('0x26')](_0xd26b('0x21'),_0x38cca3,_0x5029a5[_0xd26b('0x26')][_0xd26b('0x28')]);return _0x287afc(_0x5029a5[_0xd26b('0x26')][_0xd26b('0x28')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x38cca3,_0x5029a5[_0xd26b('0x26')][_0xd26b('0x28')]);return _0x3f317e(_0x5029a5[_0xd26b('0x26')][_0xd26b('0x28')]);}else{logger[_0xd26b('0x20')](_0xd26b('0x21'),_0x38cca3,_0xd26b('0x22'));_0x3f317e(_0x5029a5['result'][_0xd26b('0x28')]);}})[_0xd26b('0x29')](function(_0x2e5502){logger[_0xd26b('0x26')]('SmsAccount,\x20%s,\x20%s',_0x38cca3,_0x2e5502);_0x287afc(_0x2e5502);});});}function respondWithStatusCode(_0x3bbaed,_0x24bf08){_0x24bf08=_0x24bf08||0xcc;return function(_0x36fa0c){if(_0x36fa0c){return _0x3bbaed[_0xd26b('0x2a')](_0x24bf08);}return _0x3bbaed[_0xd26b('0x2b')](_0x24bf08)['end']();};}function respondWithResult(_0x573957,_0x339141){_0x339141=_0x339141||0xc8;return function(_0x221af4){if(_0x221af4){return _0x573957[_0xd26b('0x2b')](_0x339141)['json'](_0x221af4);}};}function respondWithFilteredResult(_0x875861,_0x124ef9){return function(_0xf0bc3f){if(_0xf0bc3f){var _0x1a1438=typeof _0x124ef9['offset']===_0xd26b('0x2c')&&typeof _0x124ef9[_0xd26b('0x2d')]===_0xd26b('0x2c');var _0xf2d564=_0xf0bc3f['count'];var _0x49c271=_0x1a1438?0x0:_0x124ef9['offset'];var _0x4a3371=_0x1a1438?_0xf0bc3f['count']:_0x124ef9['offset']+_0x124ef9[_0xd26b('0x2d')];var _0x53c815;if(_0x4a3371>=_0xf2d564){_0x4a3371=_0xf2d564;_0x53c815=0xc8;}else{_0x53c815=0xce;}_0x875861['status'](_0x53c815);return _0x875861[_0xd26b('0x2e')]('Content-Range',_0x49c271+'-'+_0x4a3371+'/'+_0xf2d564)['json'](_0xf0bc3f);}return null;};}function patchUpdates(_0x52ff74){return function(_0x27cb17){try{jsonpatch[_0xd26b('0x2f')](_0x27cb17,_0x52ff74,!![]);}catch(_0x3e77f1){return BPromise[_0xd26b('0x30')](_0x3e77f1);}return _0x27cb17[_0xd26b('0x31')]();};}function saveUpdates(_0x281528,_0x1685b8){return function(_0x43e80c){if(_0x43e80c){return _0x43e80c[_0xd26b('0x32')](_0x281528)[_0xd26b('0x1f')](function(_0x4fb40b){return _0x4fb40b;});}return null;};}function removeEntity(_0x30351c,_0x2a4d4e){return function(_0x4f4a1d){if(_0x4f4a1d){return _0x4f4a1d[_0xd26b('0x33')]()['then'](function(){var _0x415f64=_0x4f4a1d[_0xd26b('0x34')]({'plain':!![]});var _0x2ab847=_0xd26b('0x35');return db[_0xd26b('0x36')][_0xd26b('0x33')]({'where':{'type':_0x2ab847,'resourceId':_0x415f64['id']}})[_0xd26b('0x1f')](function(){return _0x4f4a1d;});})['then'](function(){_0x30351c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3c9c,_0x1dd32e){return function(_0x5c4059){if(!_0x5c4059){_0x3a3c9c[_0xd26b('0x2a')](0x194);}return _0x5c4059;};}function handleError(_0x5d4026,_0x37d539){_0x37d539=_0x37d539||0x1f4;return function(_0x28772a){logger[_0xd26b('0x26')](_0x28772a['stack']);if(_0x28772a[_0xd26b('0x37')]){delete _0x28772a[_0xd26b('0x37')];}_0x5d4026[_0xd26b('0x2b')](_0x37d539)[_0xd26b('0x38')](_0x28772a);};}exports[_0xd26b('0x39')]=function(_0x7d53c8,_0x21981c){var _0x1f9b3d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3fa39b={},_0x297675={'count':0x0,'rows':[]};var _0x2bf548=_['map'](db[_0xd26b('0x3a')]['rawAttributes'],function(_0x3008c1){return{'name':_0x3008c1[_0xd26b('0x3b')],'type':_0x3008c1[_0xd26b('0x3c')][_0xd26b('0x3d')]};});_0x3fa39b[_0xd26b('0x3e')]=_['map'](_0x2bf548,_0xd26b('0x37'));_0x3fa39b[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x7d53c8['query']);_0x3fa39b['filters']=_['intersection'](_0x3fa39b[_0xd26b('0x3e')],_0x3fa39b[_0xd26b('0x3f')]);_0x1f9b3d[_0xd26b('0x41')]=_['intersection'](_0x3fa39b[_0xd26b('0x3e')],qs[_0xd26b('0x42')](_0x7d53c8[_0xd26b('0x3f')][_0xd26b('0x42')]));_0x1f9b3d[_0xd26b('0x41')]=_0x1f9b3d[_0xd26b('0x41')][_0xd26b('0x43')]?_0x1f9b3d[_0xd26b('0x41')]:_0x3fa39b[_0xd26b('0x3e')];if(!_0x7d53c8['query'][_0xd26b('0x44')](_0xd26b('0x45'))){_0x1f9b3d['limit']=qs[_0xd26b('0x2d')](_0x7d53c8[_0xd26b('0x3f')]['limit']);_0x1f9b3d[_0xd26b('0x46')]=qs[_0xd26b('0x46')](_0x7d53c8[_0xd26b('0x3f')][_0xd26b('0x46')]);}_0x1f9b3d['order']=qs[_0xd26b('0x47')](_0x7d53c8[_0xd26b('0x3f')]['sort']);_0x1f9b3d['where']=qs['filters'](_[_0xd26b('0x48')](_0x7d53c8[_0xd26b('0x3f')],_0x3fa39b[_0xd26b('0x49')]),_0x2bf548);if(_0x7d53c8[_0xd26b('0x3f')][_0xd26b('0x4a')]){_0x1f9b3d[_0xd26b('0x4b')]=_[_0xd26b('0x4c')](_0x1f9b3d[_0xd26b('0x4b')],{'$or':_[_0xd26b('0x4d')](_0x2bf548,function(_0x56b30c){if(_0x56b30c[_0xd26b('0x3c')]!=='VIRTUAL'){var _0x55e8d1={};_0x55e8d1[_0x56b30c[_0xd26b('0x37')]]={'$like':'%'+_0x7d53c8[_0xd26b('0x3f')][_0xd26b('0x4a')]+'%'};return _0x55e8d1;}})});}_0x1f9b3d=_['merge']({},_0x1f9b3d,_0x7d53c8[_0xd26b('0x4e')]);var _0x2eab9f={'where':_0x1f9b3d[_0xd26b('0x4b')]};return db[_0xd26b('0x3a')][_0xd26b('0x4f')](_0x2eab9f)[_0xd26b('0x1f')](function(_0x43812b){_0x297675[_0xd26b('0x4f')]=_0x43812b;if(_0x7d53c8[_0xd26b('0x3f')][_0xd26b('0x50')]){_0x1f9b3d[_0xd26b('0x51')]=[{'all':!![]}];}return db[_0xd26b('0x3a')]['findAll'](_0x1f9b3d);})[_0xd26b('0x1f')](function(_0x46379f){_0x297675[_0xd26b('0x52')]=_0x46379f;return _0x297675;})[_0xd26b('0x1f')](respondWithFilteredResult(_0x21981c,_0x1f9b3d))[_0xd26b('0x29')](handleError(_0x21981c,null));};exports[_0xd26b('0x53')]=function(_0x326828,_0x441ded){var _0x5e649a={'raw':![],'where':{'id':_0x326828[_0xd26b('0x54')]['id']},'include':[{'model':db[_0xd26b('0x55')],'as':_0xd26b('0x56')}]},_0xa8631c={};_0xa8631c[_0xd26b('0x3e')]=_[_0xd26b('0x40')](db[_0xd26b('0x3a')][_0xd26b('0x57')]);_0xa8631c['query']=_[_0xd26b('0x40')](_0x326828[_0xd26b('0x3f')]);_0xa8631c[_0xd26b('0x49')]=_[_0xd26b('0x58')](_0xa8631c[_0xd26b('0x3e')],_0xa8631c[_0xd26b('0x3f')]);_0x5e649a[_0xd26b('0x41')]=_[_0xd26b('0x58')](_0xa8631c[_0xd26b('0x3e')],qs[_0xd26b('0x42')](_0x326828['query'][_0xd26b('0x42')]));_0x5e649a[_0xd26b('0x41')]=_0x5e649a[_0xd26b('0x41')][_0xd26b('0x43')]?_0x5e649a['attributes']:_0xa8631c[_0xd26b('0x3e')];if(_0x326828[_0xd26b('0x3f')]['includeAll']){_0x5e649a[_0xd26b('0x51')]=[{'all':!![]}];}_0x5e649a=_[_0xd26b('0x4c')]({},_0x5e649a,_0x326828[_0xd26b('0x4e')]);return db['SmsAccount'][_0xd26b('0x59')](_0x5e649a)[_0xd26b('0x1f')](handleEntityNotFound(_0x441ded,null))[_0xd26b('0x1f')](respondWithResult(_0x441ded,null))['catch'](handleError(_0x441ded,null));};exports[_0xd26b('0x5a')]=function(_0x17b811,_0x1aa2ae){return db['SmsAccount'][_0xd26b('0x5a')](_0x17b811[_0xd26b('0x5b')],{})['then'](function(_0x20a3a0){var _0x5725fe=_0x17b811['user']['get']({'plain':!![]});if(!_0x5725fe)throw new Error(_0xd26b('0x5c'));if(_0x5725fe[_0xd26b('0x5d')]==='user'){var _0x315728=_0x20a3a0[_0xd26b('0x34')]({'plain':!![]});var _0x556f43=_0xd26b('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x556f43,'userProfileId':_0x5725fe[_0xd26b('0x5e')]},'raw':!![]})[_0xd26b('0x1f')](function(_0x179e51){if(_0x179e51&&_0x179e51[_0xd26b('0x5f')]===0x0){return db[_0xd26b('0x36')][_0xd26b('0x5a')]({'name':_0x315728[_0xd26b('0x37')],'resourceId':_0x315728['id'],'type':_0x179e51['name'],'sectionId':_0x179e51['id']},{})[_0xd26b('0x1f')](function(){return _0x20a3a0;});}else{return _0x20a3a0;}})[_0xd26b('0x29')](function(_0x46a74a){logger[_0xd26b('0x26')](_0xd26b('0x60'),_0x46a74a);throw _0x46a74a;});}return _0x20a3a0;})[_0xd26b('0x1f')](respondWithResult(_0x1aa2ae,0xc9))[_0xd26b('0x29')](handleError(_0x1aa2ae,null));};exports[_0xd26b('0x32')]=function(_0x30063c,_0x1c65ea){if(_0x30063c[_0xd26b('0x5b')]['id']){delete _0x30063c[_0xd26b('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x30063c[_0xd26b('0x54')]['id']},'include':[{'model':db[_0xd26b('0x55')],'as':_0xd26b('0x56')}]})['then'](handleEntityNotFound(_0x1c65ea,null))['then'](saveUpdates(_0x30063c[_0xd26b('0x5b')],null))[_0xd26b('0x1f')](respondWithResult(_0x1c65ea,null))[_0xd26b('0x29')](handleError(_0x1c65ea,null));};exports[_0xd26b('0x33')]=function(_0x3eb141,_0x10baa0){return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0x3eb141['params']['id']}})['then'](handleEntityNotFound(_0x10baa0,null))[_0xd26b('0x1f')](removeEntity(_0x10baa0,null))[_0xd26b('0x29')](handleError(_0x10baa0,null));};exports['describe']=function(_0x1de679,_0x3542f1){return db[_0xd26b('0x3a')]['describe']()[_0xd26b('0x1f')](respondWithResult(_0x3542f1,null))[_0xd26b('0x29')](handleError(_0x3542f1,null));};exports['addDisposition']=function(_0x3171f6,_0x383940,_0x3274c5){if(_0x3171f6[_0xd26b('0x5b')]['id']){delete _0x3171f6['body']['id'];}return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0x3171f6[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x383940,null))[_0xd26b('0x1f')](function(_0x3430cf){if(_0x3430cf){_0x3171f6['body']['SmsAccountId']=_0x3430cf['id'];return db['Disposition'][_0xd26b('0x5a')](_0x3171f6['body']);}})[_0xd26b('0x1f')](respondWithResult(_0x383940,null))[_0xd26b('0x29')](handleError(_0x383940,null));};exports[_0xd26b('0x61')]=function(_0x289866,_0x4f5678,_0x2444e9){var _0xfb15dd={'raw':![],'where':{}};var _0x4b038c={};var _0x14044a={'count':0x0,'rows':[]};return db['SmsAccount'][_0xd26b('0x62')]({'where':{'id':_0x289866[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x4f5678,null))['then'](function(_0x1ba23e){if(_0x1ba23e){_0x4b038c[_0xd26b('0x3e')]=_[_0xd26b('0x40')](db[_0xd26b('0x63')]['rawAttributes']);_0x4b038c[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x289866[_0xd26b('0x3f')]);_0x4b038c['filters']=_[_0xd26b('0x58')](_0x4b038c[_0xd26b('0x3e')],_0x4b038c['query']);_0xfb15dd[_0xd26b('0x41')]=_['intersection'](_0x4b038c[_0xd26b('0x3e')],qs['fields'](_0x289866[_0xd26b('0x3f')]['fields']));_0xfb15dd[_0xd26b('0x41')]=_0xfb15dd['attributes'][_0xd26b('0x43')]?_0xfb15dd[_0xd26b('0x41')]:_0x4b038c[_0xd26b('0x3e')];if(!_0x289866[_0xd26b('0x3f')][_0xd26b('0x44')]('nolimit')){_0xfb15dd[_0xd26b('0x2d')]=qs['limit'](_0x289866['query'][_0xd26b('0x2d')]);_0xfb15dd[_0xd26b('0x46')]=qs[_0xd26b('0x46')](_0x289866[_0xd26b('0x3f')][_0xd26b('0x46')]);}_0xfb15dd[_0xd26b('0x64')]=qs['sort'](_0x289866['query'][_0xd26b('0x47')]);_0xfb15dd['where']=qs[_0xd26b('0x49')](_[_0xd26b('0x48')](_0x289866['query'],_0x4b038c[_0xd26b('0x49')]));_0xfb15dd['where'][_0xd26b('0x65')]=_0x1ba23e['id'];if(_0x289866[_0xd26b('0x3f')][_0xd26b('0x4a')]){_0xfb15dd[_0xd26b('0x4b')]=_[_0xd26b('0x4c')](_0xfb15dd[_0xd26b('0x4b')],{'$or':_['map'](_0xfb15dd['attributes'],function(_0x11cd6a){var _0x4cc4d5={};_0x4cc4d5[_0x11cd6a]={'$like':'%'+_0x289866[_0xd26b('0x3f')][_0xd26b('0x4a')]+'%'};return _0x4cc4d5;})});}_0xfb15dd=_['merge']({},_0xfb15dd,_0x289866[_0xd26b('0x4e')]);return db[_0xd26b('0x63')][_0xd26b('0x4f')]({'where':_0xfb15dd[_0xd26b('0x4b')]})[_0xd26b('0x1f')](function(_0x507e0f){_0x14044a[_0xd26b('0x4f')]=_0x507e0f;if(_0x289866[_0xd26b('0x3f')][_0xd26b('0x50')]){_0xfb15dd[_0xd26b('0x51')]=[{'all':!![]}];}return db['Disposition'][_0xd26b('0x66')](_0xfb15dd);})[_0xd26b('0x1f')](function(_0x4ab93f){_0x14044a[_0xd26b('0x52')]=_0x4ab93f;return _0x14044a;});}})['then'](respondWithFilteredResult(_0x4f5678,_0xfb15dd))[_0xd26b('0x29')](handleError(_0x4f5678,null));};exports[_0xd26b('0x67')]=function(_0x4e4d12,_0x4ad6f4,_0x762e41){return db['SmsAccount'][_0xd26b('0x59')]({'where':{'id':_0x4e4d12['params']['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x4ad6f4,null))[_0xd26b('0x1f')](function(_0x1c6a12){if(_0x1c6a12){return _0x1c6a12[_0xd26b('0x67')](_0x4e4d12[_0xd26b('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x4ad6f4,null))[_0xd26b('0x29')](handleError(_0x4ad6f4,null));};exports[_0xd26b('0x68')]=function(_0x2c018f,_0x35500f,_0x1ca5fa){if(_0x2c018f[_0xd26b('0x5b')]['id']){delete _0x2c018f[_0xd26b('0x5b')]['id'];}return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0x2c018f[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x35500f,null))['then'](function(_0x527338){if(_0x527338){_0x2c018f[_0xd26b('0x5b')][_0xd26b('0x65')]=_0x527338['id'];return db[_0xd26b('0x69')][_0xd26b('0x5a')](_0x2c018f[_0xd26b('0x5b')]);}})[_0xd26b('0x1f')](respondWithResult(_0x35500f,null))[_0xd26b('0x29')](handleError(_0x35500f,null));};exports[_0xd26b('0x6a')]=function(_0x2c6f03,_0x10ece4,_0x2effd3){var _0x3b2622={'raw':![],'where':{}};var _0x1c879a={};var _0x399e0f={'count':0x0,'rows':[]};return db[_0xd26b('0x3a')][_0xd26b('0x62')]({'where':{'id':_0x2c6f03['params']['id']}})['then'](handleEntityNotFound(_0x10ece4,null))['then'](function(_0x115583){if(_0x115583){_0x1c879a[_0xd26b('0x3e')]=_[_0xd26b('0x40')](db['CannedAnswer'][_0xd26b('0x57')]);_0x1c879a[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x2c6f03[_0xd26b('0x3f')]);_0x1c879a['filters']=_[_0xd26b('0x58')](_0x1c879a[_0xd26b('0x3e')],_0x1c879a[_0xd26b('0x3f')]);_0x3b2622['attributes']=_['intersection'](_0x1c879a[_0xd26b('0x3e')],qs['fields'](_0x2c6f03['query'][_0xd26b('0x42')]));_0x3b2622['attributes']=_0x3b2622[_0xd26b('0x41')][_0xd26b('0x43')]?_0x3b2622[_0xd26b('0x41')]:_0x1c879a[_0xd26b('0x3e')];if(!_0x2c6f03['query'][_0xd26b('0x44')]('nolimit')){_0x3b2622['limit']=qs[_0xd26b('0x2d')](_0x2c6f03[_0xd26b('0x3f')]['limit']);_0x3b2622['offset']=qs['offset'](_0x2c6f03[_0xd26b('0x3f')][_0xd26b('0x46')]);}_0x3b2622[_0xd26b('0x64')]=qs[_0xd26b('0x47')](_0x2c6f03[_0xd26b('0x3f')][_0xd26b('0x47')]);_0x3b2622['where']=qs[_0xd26b('0x49')](_[_0xd26b('0x48')](_0x2c6f03[_0xd26b('0x3f')],_0x1c879a[_0xd26b('0x49')]));_0x3b2622['where'][_0xd26b('0x65')]=_0x115583['id'];if(_0x2c6f03[_0xd26b('0x3f')][_0xd26b('0x4a')]){_0x3b2622['where']=_['merge'](_0x3b2622[_0xd26b('0x4b')],{'$or':_['map'](_0x3b2622[_0xd26b('0x41')],function(_0x57e69b){var _0x51964d={};_0x51964d[_0x57e69b]={'$like':'%'+_0x2c6f03[_0xd26b('0x3f')][_0xd26b('0x4a')]+'%'};return _0x51964d;})});}_0x3b2622=_[_0xd26b('0x4c')]({},_0x3b2622,_0x2c6f03[_0xd26b('0x4e')]);return db[_0xd26b('0x69')][_0xd26b('0x4f')]({'where':_0x3b2622['where']})[_0xd26b('0x1f')](function(_0x54c8ba){_0x399e0f[_0xd26b('0x4f')]=_0x54c8ba;if(_0x2c6f03[_0xd26b('0x3f')][_0xd26b('0x50')]){_0x3b2622[_0xd26b('0x51')]=[{'all':!![]}];}return db[_0xd26b('0x69')]['findAll'](_0x3b2622);})[_0xd26b('0x1f')](function(_0x59818e){_0x399e0f[_0xd26b('0x52')]=_0x59818e;return _0x399e0f;});}})[_0xd26b('0x1f')](respondWithFilteredResult(_0x10ece4,_0x3b2622))[_0xd26b('0x29')](handleError(_0x10ece4,null));};exports[_0xd26b('0x6b')]=function(_0x561fd9,_0x2afa1b,_0x571498){return db[_0xd26b('0x3a')]['find']({'where':{'id':_0x561fd9[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2afa1b,null))[_0xd26b('0x1f')](function(_0x4b4997){if(_0x4b4997){return _0x4b4997[_0xd26b('0x6b')](_0x561fd9[_0xd26b('0x3f')][_0xd26b('0x6c')]);}})[_0xd26b('0x1f')](respondWithStatusCode(_0x2afa1b,null))['catch'](handleError(_0x2afa1b,null));};exports['notify']=function(_0x2c5bb9,_0x2d97ac,_0x3a91b8){var _0x2b48c4={'channel':_0xd26b('0x6d')};var _0x6ddd8b=[];var _0xe3e88b=[];var _0x119062={};return db[_0xd26b('0x3a')]['find']({'where':{'id':_0x2c5bb9[_0xd26b('0x54')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0xd26b('0x1f')](handleEntityNotFound(_0x2d97ac,null))[_0xd26b('0x1f')](function(_0x5087a7){_0x2b48c4[_0xd26b('0x6e')]=_0x5087a7;_0x2b48c4[_0xd26b('0x6f')]=_['orderBy'](_0x5087a7['Applications'],[_0xd26b('0x70')],[_0xd26b('0x71')]);if(_0x2b48c4[_0xd26b('0x6e')]['Applications']){delete _0x2b48c4[_0xd26b('0x6e')][_0xd26b('0x72')];}return db['CmContact'][_0xd26b('0x73')]();})['then'](function(_0x4514d4){if(!_0x4514d4){throw new db[(_0xd26b('0x74'))][(_0xd26b('0x75'))](_0xd26b('0x76'));}_0x6ddd8b=_['difference'](_[_0xd26b('0x40')](_0x4514d4),['createdAt',_0xd26b('0x77')]);_0xe3e88b=_[_0xd26b('0x78')](_[_0xd26b('0x40')](_0x4514d4),[_0xd26b('0x79'),'updatedAt',_0xd26b('0x7a'),'ListId']);_0x2b48c4[_0xd26b('0x5b')]={'mapKey':_0xd26b('0x7b')};if(_0x2b48c4['account']['type']){switch(_0x2b48c4[_0xd26b('0x6e')][_0xd26b('0x3c')]){case _0xd26b('0x7c'):_0x2b48c4['body']['from']=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x7d')];_0x2b48c4['body'][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x7e')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x7f')]=_0x2c5bb9['body'][_0xd26b('0x80')];break;case'skebby':_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')]='+'+_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x82')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')]['text'];break;case _0xd26b('0x83'):_0x2b48c4['body'][_0xd26b('0x81')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x81')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')]['message'];break;case'clicksend':_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x81')];_0x2b48c4[_0xd26b('0x5b')]['body']=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x5b')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x7f')]=_0x2c5bb9['body'][_0xd26b('0x84')];break;case _0xd26b('0x85'):_0x2b48c4['body']['from']=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x7d')];_0x2b48c4[_0xd26b('0x5b')]['body']=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x86')];_0x2b48c4[_0xd26b('0x5b')]['messageId']=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x87')];break;case _0xd26b('0x88'):_0x2b48c4['body']['from']='+'+_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x89')][0x0][_0xd26b('0x81')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x89')][0x0][_0xd26b('0x8a')];_0x2b48c4[_0xd26b('0x5b')]['messageId']=_0x2c5bb9['body'][_0xd26b('0x89')][0x0][_0xd26b('0x7f')];break;case _0xd26b('0x8b'):_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x8c')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')]['segmentedMessage'][_0xd26b('0x28')];break;case'clickatell':_0x2b48c4[_0xd26b('0x5b')]['from']=_0x2c5bb9['body'][_0xd26b('0x8d')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9['body'][_0xd26b('0x8a')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x7f')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x8e')];break;case _0xd26b('0x8f'):_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x7f')]=_0x2c5bb9[_0xd26b('0x5b')][0x0]['message']['id'];_0x2b48c4[_0xd26b('0x5b')]['from']=_0x2c5bb9['body'][0x0]['message'][_0xd26b('0x81')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')][0x0][_0xd26b('0x28')][_0xd26b('0x8a')];break;case _0xd26b('0x90'):_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')]=_0x2c5bb9[_0xd26b('0x5b')][_0xd26b('0x81')];_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]=_0x2c5bb9[_0xd26b('0x5b')]['message'];_0x2b48c4[_0xd26b('0x5b')]['messageId']=_0x2c5bb9[_0xd26b('0x5b')]['refid'];break;}}if(_0x2b48c4[_0xd26b('0x5b')]['id']){delete _0x2b48c4[_0xd26b('0x5b')]['id'];}if(_[_0xd26b('0x91')](_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')])){throw new db[(_0xd26b('0x74'))][(_0xd26b('0x75'))](_0xd26b('0x92'));}if(_[_0xd26b('0x91')](_0x2b48c4['body']['body'])||_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x5b')]===''){throw new db[(_0xd26b('0x74'))][(_0xd26b('0x75'))](_0xd26b('0x93'));}if(_['isNil'](_0x2b48c4['body']['mapKey'])){throw new db[(_0xd26b('0x74'))][(_0xd26b('0x75'))](_0xd26b('0x94')+_0xe3e88b);}if(!_['includes'](_0xe3e88b,_0x2b48c4['body'][_0xd26b('0x95')])){throw new db['Sequelize']['ValidationError'](_0xd26b('0x96')+_0xe3e88b);}_0x119062[_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x95')]]=_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')];return db[_0xd26b('0x97')][_0xd26b('0x59')]({'where':{'id':_0x2b48c4[_0xd26b('0x6e')][_0xd26b('0x98')]},'include':[{'model':db[_0xd26b('0x99')],'as':'Contacts','where':_0x119062,'limit':0x1,'order':[[_0xd26b('0x77'),'DESC']]}]});})['then'](handleEntityNotFound(_0x2d97ac,null))[_0xd26b('0x1f')](function(_0x296020){if(_0x296020){_0x2b48c4[_0xd26b('0x9a')]=_[_0xd26b('0x9b')](_0x296020,[_0xd26b('0x9c')]);if(_0x296020[_0xd26b('0x9c')][_0xd26b('0x43')]){return _0x296020[_0xd26b('0x9c')][0x0];}var _0x3ee3ab=_[_0xd26b('0x17')](_0x2b48c4[_0xd26b('0x5b')],{'firstName':_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x81')],'ListId':_0x296020['id']});_0x3ee3ab[_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x95')]]=_0x2b48c4['body'][_0xd26b('0x81')];return db['CmContact'][_0xd26b('0x5a')](_0x3ee3ab,{'fields':_0x6ddd8b,'raw':!![]});}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2d97ac,null))[_0xd26b('0x1f')](function(_0x4de05a){if(_0x4de05a){_0x2b48c4[_0xd26b('0x9d')]=_0x4de05a;var _0x58e7b7={'ContactId':_0x4de05a['id'],'phone':_0x2b48c4[_0xd26b('0x5b')]['from'],'SmsAccountId':_0x2c5bb9['params']['id']};var _0x1e8bc5={'ContactId':_0x4de05a['id'],'SmsAccountId':_0x2c5bb9[_0xd26b('0x54')]['id'],'closed':![]};return db[_0xd26b('0x9e')]['find']({'where':_0x1e8bc5})[_0xd26b('0x1f')](function(_0x53bbb6){if(_0x53bbb6){return[_0x53bbb6,![]];}return db[_0xd26b('0x9e')]['create'](_0x58e7b7)['then'](function(_0x47b909){return[_0x47b909,!![]];});});}})[_0xd26b('0x9f')](function(_0x178f81,_0x2b9075){_0x2b48c4['interaction']=_0x178f81[_0xd26b('0x34')]({'plain':!![]});_0x2b48c4[_0xd26b('0xa0')]['created']=![];if(_0x2b9075){if(_0x2b48c4[_0xd26b('0x6e')][_0xd26b('0xa1')]){_0x2b48c4['applications'][_0xd26b('0xa2')]({'id':0x0,'priority':_0x2b48c4[_0xd26b('0x6f')][_0xd26b('0x43')]+0x1,'app':_0xd26b('0xa3'),'appdata':_0xd26b('0xa4'),'interval':_0xd26b('0xa5')});}_0x2b48c4[_0xd26b('0xa0')]['created']=!![];}return db[_0xd26b('0xa6')][_0xd26b('0x5a')]({'phone':_0x2b48c4[_0xd26b('0x5b')]['from'],'messageId':_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0x7f')],'body':_0x2b48c4[_0xd26b('0x5b')]['body'],'SmsAccountId':_0x2c5bb9[_0xd26b('0x54')]['id'],'SmsInteractionId':_0x178f81['id'],'direction':'in','ContactId':_0x178f81[_0xd26b('0xa7')],'AttachmentId':_0x2b48c4[_0xd26b('0x5b')][_0xd26b('0xa8')]});})[_0xd26b('0x1f')](function(_0x392f9d){_0x2b48c4[_0xd26b('0x28')]=_0x392f9d;if(_0x2b48c4[_0xd26b('0xa0')][_0xd26b('0xa9')]){return db[_0xd26b('0xaa')][_0xd26b('0x59')]({'attributes':['id',_0xd26b('0x37')],'where':{'id':_0x2b48c4['interaction'][_0xd26b('0xa9')]}})[_0xd26b('0x1f')](function(_0x4767b8){if(_0x4767b8){_0x2b48c4[_0xd26b('0x6f')][_0xd26b('0xab')]({'id':0x0,'priority':0x0,'app':_0xd26b('0xac'),'appdata':_0x4767b8[_0xd26b('0x37')]+','+(_0x2b48c4[_0xd26b('0x6e')][_0xd26b('0xad')]||0xa),'interval':_0xd26b('0xa5')});}return respondWithRpcPromise(_0xd26b('0xae'),'startRouting',_0x2b48c4);});}return respondWithRpcPromise(_0xd26b('0xae'),_0xd26b('0xaf'),_0x2b48c4);})[_0xd26b('0x1f')](function(_0x648026){if(_0x648026){var _0x47f9ba=0xc8;var _0x24c8c6='receiveMessage';logger[_0xd26b('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x24c8c6,_0x47f9ba,_0xd26b('0xb0'));logger[_0xd26b('0x23')](_0xd26b('0xb1'),_0x24c8c6,_0x47f9ba,_0xd26b('0xb0'),JSON[_0xd26b('0x25')](_0x648026));if(_0x2b48c4[_0xd26b('0x6e')][_0xd26b('0x3c')]===_0xd26b('0x7c')){return _0x2d97ac['status'](_0x47f9ba)[_0xd26b('0x2e')](_0xd26b('0xb2'),_0xd26b('0xb3'))[_0xd26b('0x38')](_0xd26b('0xb4'));}else{return _0x2d97ac[_0xd26b('0x2b')](_0x47f9ba)[_0xd26b('0xb5')](_0x648026);}}})[_0xd26b('0x29')](handleError(_0x2d97ac,null));};exports['addApplications']=function(_0x2ef3db,_0x5bcfd7){var _0x3c9b59=_0x2ef3db[_0xd26b('0x54')]['id'];var _0x24f9d6=_0x2ef3db['body'];var _0x25d79b=0xc8;var _0x4e0c25=null;return db['sequelize'][_0xd26b('0xb6')]({'isolationLevel':db[_0xd26b('0xb7')][_0xd26b('0xb8')][_0xd26b('0xb9')][_0xd26b('0xba')]},function(_0x16fe3f){return db[_0xd26b('0x3a')][_0xd26b('0x62')]({'where':{'id':_0x3c9b59},'transaction':_0x16fe3f})[_0xd26b('0x1f')](function(_0x5b50e2){if(_0x5b50e2){return db[_0xd26b('0xbb')][_0xd26b('0x33')]({'where':{'SmsAccountId':_0x3c9b59},'transaction':_0x16fe3f})[_0xd26b('0x1f')](function(){var _0x298b34=_[_0xd26b('0x4d')](_0x24f9d6,function(_0x40952c){_0x40952c['SmsAccountId']=_0x3c9b59;return _0x40952c;});return db['SmsApplication'][_0xd26b('0xbc')](_0x298b34,{'transaction':_0x16fe3f});});}else{_0x25d79b=0x194;_0x4e0c25=[];}});})['then'](function(){if(_0x25d79b!==0x194){return db[_0xd26b('0xbb')]['findAndCountAll']({'where':{'SmsAccountId':_0x3c9b59},'order':'priority'})['then'](function(_0x41dda4){_0x4e0c25=_0x41dda4;});}})[_0xd26b('0x29')](function(_0x524905){_0x25d79b=0x1f4;logger[_0xd26b('0x26')](_0x524905[_0xd26b('0xbd')]);if(_0x524905['name']){delete _0x524905['name'];}_0x4e0c25=_0x524905;})[_0xd26b('0xbe')](function(){if(_0x4e0c25===null){_0x5bcfd7[_0xd26b('0x2a')](_0x25d79b);}else{if(_0x25d79b===0x1f4){_0x5bcfd7[_0xd26b('0x2b')](_0x25d79b)[_0xd26b('0x38')](_0x4e0c25);}else{_0x5bcfd7['status'](_0x25d79b)['json'](_0x4e0c25);}}});};exports[_0xd26b('0xbf')]=function(_0x4e9794,_0x2f0e45,_0x357ff1){var _0x12e47f={};var _0x58989f={};var _0x26a9e4;var _0x25b40c;return db[_0xd26b('0x3a')][_0xd26b('0x62')]({'where':{'id':_0x4e9794[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2f0e45,null))[_0xd26b('0x1f')](function(_0xf94972){if(_0xf94972){_0x26a9e4=_0xf94972;_0x58989f[_0xd26b('0x3e')]=_[_0xd26b('0x40')](db[_0xd26b('0xbb')]['rawAttributes']);_0x58989f[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x4e9794[_0xd26b('0x3f')]);_0x58989f[_0xd26b('0x49')]=_['intersection'](_0x58989f[_0xd26b('0x3e')],_0x58989f['query']);_0x12e47f[_0xd26b('0x41')]=_[_0xd26b('0x58')](_0x58989f[_0xd26b('0x3e')],qs[_0xd26b('0x42')](_0x4e9794[_0xd26b('0x3f')][_0xd26b('0x42')]));_0x12e47f[_0xd26b('0x41')]=_0x12e47f['attributes'][_0xd26b('0x43')]?_0x12e47f[_0xd26b('0x41')]:_0x58989f[_0xd26b('0x3e')];_0x12e47f['order']=qs[_0xd26b('0x47')](_0x4e9794[_0xd26b('0x3f')][_0xd26b('0x47')]);_0x12e47f[_0xd26b('0x4b')]=qs['filters'](_[_0xd26b('0x48')](_0x4e9794[_0xd26b('0x3f')],_0x58989f[_0xd26b('0x49')]));if(_0x4e9794[_0xd26b('0x3f')][_0xd26b('0x4a')]){_0x12e47f[_0xd26b('0x4b')]=_[_0xd26b('0x4c')](_0x12e47f[_0xd26b('0x4b')],{'$or':_[_0xd26b('0x4d')](_0x12e47f[_0xd26b('0x41')],function(_0x1f87d3){var _0x683d58={};_0x683d58[_0x1f87d3]={'$like':'%'+_0x4e9794['query'][_0xd26b('0x4a')]+'%'};return _0x683d58;})});}_0x12e47f=_[_0xd26b('0x4c')]({},_0x12e47f,_0x4e9794[_0xd26b('0x4e')]);return _0x26a9e4[_0xd26b('0xbf')](_0x12e47f);}})[_0xd26b('0x1f')](function(_0x1bd152){if(_0x1bd152){_0x25b40c=_0x1bd152['length'];if(!_0x4e9794[_0xd26b('0x3f')][_0xd26b('0x44')](_0xd26b('0x45'))){_0x12e47f[_0xd26b('0x2d')]=qs[_0xd26b('0x2d')](_0x4e9794[_0xd26b('0x3f')]['limit']);_0x12e47f[_0xd26b('0x46')]=qs[_0xd26b('0x46')](_0x4e9794[_0xd26b('0x3f')]['offset']);}return _0x26a9e4[_0xd26b('0xbf')](_0x12e47f);}})[_0xd26b('0x1f')](function(_0x31a55e){if(_0x31a55e){return _0x31a55e?{'count':_0x25b40c,'rows':_0x31a55e}:null;}})[_0xd26b('0x1f')](respondWithResult(_0x2f0e45,null))[_0xd26b('0x29')](handleError(_0x2f0e45,null));};exports[_0xd26b('0xc0')]=function(_0x1e142a,_0x9a24e,_0x3a9dad){var _0x4cf987={'raw':![],'where':{}};var _0x29ef3f={};var _0x3ddc10={'count':0x0,'rows':[]};return db[_0xd26b('0x3a')][_0xd26b('0x62')]({'where':{'id':_0x1e142a[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x9a24e,null))[_0xd26b('0x1f')](function(_0x20eddd){if(_0x20eddd){_0x29ef3f[_0xd26b('0x3e')]=_[_0xd26b('0x40')](db[_0xd26b('0x9e')][_0xd26b('0x57')]);_0x29ef3f[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x1e142a[_0xd26b('0x3f')]);_0x29ef3f['filters']=_[_0xd26b('0x58')](_0x29ef3f[_0xd26b('0x3e')],_0x29ef3f[_0xd26b('0x3f')]);_0x4cf987[_0xd26b('0x41')]=_[_0xd26b('0x58')](_0x29ef3f[_0xd26b('0x3e')],qs[_0xd26b('0x42')](_0x1e142a[_0xd26b('0x3f')][_0xd26b('0x42')]));_0x4cf987['attributes']=_0x4cf987[_0xd26b('0x41')][_0xd26b('0x43')]?_0x4cf987[_0xd26b('0x41')]:_0x29ef3f[_0xd26b('0x3e')];if(!_0x1e142a[_0xd26b('0x3f')][_0xd26b('0x44')](_0xd26b('0x45'))){_0x4cf987[_0xd26b('0x2d')]=qs[_0xd26b('0x2d')](_0x1e142a[_0xd26b('0x3f')][_0xd26b('0x2d')]);_0x4cf987[_0xd26b('0x46')]=qs[_0xd26b('0x46')](_0x1e142a[_0xd26b('0x3f')]['offset']);}_0x4cf987[_0xd26b('0x64')]=qs[_0xd26b('0x47')](_0x1e142a[_0xd26b('0x3f')][_0xd26b('0x47')]);_0x4cf987[_0xd26b('0x4b')]=qs[_0xd26b('0x49')](_[_0xd26b('0x48')](_0x1e142a['query'],_0x29ef3f[_0xd26b('0x49')]));_0x4cf987['where'][_0xd26b('0x65')]=_0x20eddd['id'];if(_0x1e142a[_0xd26b('0x3f')]['filter']){_0x4cf987[_0xd26b('0x4b')]=_['merge'](_0x4cf987[_0xd26b('0x4b')],{'$or':_[_0xd26b('0x4d')](_0x4cf987['attributes'],function(_0x3ebd75){var _0x2b39c3={};_0x2b39c3[_0x3ebd75]={'$like':'%'+_0x1e142a['query'][_0xd26b('0x4a')]+'%'};return _0x2b39c3;})});}_0x4cf987=_[_0xd26b('0x4c')]({},_0x4cf987,_0x1e142a[_0xd26b('0x4e')]);return db['SmsInteraction'][_0xd26b('0x4f')]({'where':_0x4cf987[_0xd26b('0x4b')]})[_0xd26b('0x1f')](function(_0x438b46){_0x3ddc10[_0xd26b('0x4f')]=_0x438b46;if(_0x1e142a[_0xd26b('0x3f')][_0xd26b('0x50')]){_0x4cf987['include']=[{'model':db[_0xd26b('0x99')],'as':_0xd26b('0xc1'),'required':![]},{'model':db[_0xd26b('0xaa')],'as':_0xd26b('0xc2'),'attributes':[_0xd26b('0x37'),_0xd26b('0xc3'),_0xd26b('0xc4')],'required':![]},{'model':db[_0xd26b('0xc5')],'as':_0xd26b('0xc6'),'attributes':['id',_0xd26b('0x37'),_0xd26b('0xc7')],'where':_0x1e142a['query'][_0xd26b('0xc8')]?{'id':_0x1e142a[_0xd26b('0x3f')]['tag']}:undefined,'required':_0x1e142a[_0xd26b('0x3f')][_0xd26b('0xc8')]?!![]:![]}];}return db[_0xd26b('0x9e')][_0xd26b('0x66')](_0x4cf987);})['then'](function(_0x31730e){_0x3ddc10[_0xd26b('0x52')]=_0x31730e;return _0x3ddc10;});}})[_0xd26b('0x1f')](respondWithFilteredResult(_0x9a24e,_0x4cf987))[_0xd26b('0x29')](handleError(_0x9a24e,null));};exports['send']=function(_0x57c83e,_0x2423a9,_0x3cdf6a){var _0x2560d7,_0x3e819c,_0x24a362;if(_['isNil'](_0x57c83e[_0xd26b('0x5b')][_0xd26b('0x5b')])||_0x57c83e[_0xd26b('0x5b')]['body']===''){throw new db['Sequelize'][(_0xd26b('0x75'))](_0xd26b('0x93'));}if(_['isNil'](_0x57c83e[_0xd26b('0x5b')]['to'])){throw new db[(_0xd26b('0x74'))][(_0xd26b('0x75'))](_0xd26b('0xc9'));}_0x2560d7=_0x57c83e['body']['to'];return db[_0xd26b('0x3a')]['find']({'where':{'id':_0x57c83e['params']['id']},'include':[{'model':db[_0xd26b('0x97')],'as':_0xd26b('0xca'),'include':[{'model':db[_0xd26b('0x99')],'as':_0xd26b('0x9c'),'where':{'mobile':_0x2560d7},'limit':0x1,'order':[[_0xd26b('0x77'),_0xd26b('0xcb')]]}]}]})['then'](handleEntityNotFound(_0x2423a9,null))[_0xd26b('0x1f')](function(_0x2b8a72){if(_0x2b8a72&&_0x2b8a72[_0xd26b('0xca')]){_0x3e819c=_0x2b8a72['get']({'plain':!![]});if(_0x3e819c[_0xd26b('0xca')]&&_0x3e819c[_0xd26b('0xca')]['Contacts'][_0xd26b('0x43')]){return _0x3e819c[_0xd26b('0xca')][_0xd26b('0x9c')][0x0];}return db[_0xd26b('0x99')]['create'](_[_0xd26b('0x17')](_0x57c83e[_0xd26b('0x5b')],{'firstName':_0x2560d7,'mobile':_0x2560d7,'phone':_0x2560d7,'ListId':_0x3e819c[_0xd26b('0x98')]}));}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2423a9,null))[_0xd26b('0x1f')](function(_0x52ab9){if(_0x52ab9){_0x24a362=_0x52ab9;return db[_0xd26b('0x9e')]['find']({'where':{'ContactId':_0x24a362['id'],'closed':![],'SmsAccountId':_0x3e819c['id']}})[_0xd26b('0x1f')](function(_0x519124){if(_0x519124){return[_0x519124,![]];}return db[_0xd26b('0x9e')]['create']({'UserId':_0x57c83e['user']['id'],'ContactId':_0x24a362['id'],'SmsAccountId':_0x3e819c['id'],'phone':_0x2560d7,'firstMsgDirection':_0xd26b('0xcc'),'Messages':[_['merge'](_0x57c83e[_0xd26b('0x5b')],{'read':![],'body':_0x57c83e[_0xd26b('0x5b')]['body'],'phone':_0x2560d7,'SmsAccountId':_0x3e819c['id'],'UserId':_0x57c83e['user']['id'],'ContactId':_0x24a362['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd26b('0xcd')}]})[_0xd26b('0x1f')](function(_0x48f01d){return[_0x48f01d,!![]];});});}})[_0xd26b('0x9f')](function(_0x24523b,_0x374523){if(_0x374523){return _0x24523b;}return db[_0xd26b('0xa6')][_0xd26b('0x5a')](_[_0xd26b('0x4c')](_0x57c83e[_0xd26b('0x5b')],{'read':![],'body':_0x57c83e[_0xd26b('0x5b')][_0xd26b('0x5b')],'phone':_0x2560d7,'SmsAccountId':_0x3e819c['id'],'SmsInteractionId':_0x24523b['id'],'UserId':_0x57c83e[_0xd26b('0xce')]['id'],'ContactId':_0x24a362['id']}))[_0xd26b('0x1f')](function(_0x2c898b){_0x24523b[_0xd26b('0xcf')][_0xd26b('0xcd')]=[];_0x24523b[_0xd26b('0xcf')]['Messages'][_0xd26b('0xa2')](_0x2c898b[_0xd26b('0xcf')]);return _0x24523b;});})['then'](respondWithResult(_0x2423a9,null))[_0xd26b('0x29')](handleError(_0x2423a9,null));};exports[_0xd26b('0x2b')]=function(_0x1428a8,_0x4b0c1c,_0x52f4af){if(_0x1428a8[_0xd26b('0x5b')]['id']){delete _0x1428a8[_0xd26b('0x5b')]['id'];}var _0x5cccc5,_0x4b8d5b,_0x5a7cc5;return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0x1428a8[_0xd26b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b0c1c,null))[_0xd26b('0x1f')](function(_0x300d2d){if(_0x300d2d){_0x5a7cc5=_0x300d2d;logger['debug'](_0xd26b('0x24'),_0xd26b('0x2b'),_0xd26b('0xd0'),_0x300d2d[_0xd26b('0x3c')],util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));switch(_0x300d2d['type']){case _0xd26b('0xd2'):if(_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd3')]&&_0x1428a8[_0xd26b('0x5b')][_0xd26b('0x2b')]){_0x4b8d5b=_0x1428a8[_0xd26b('0x5b')][_0xd26b('0x2b')];return db['SmsMessage'][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')]['skebby_dispatch_id']}});}break;case _0xd26b('0x83'):if(_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd4')]&&_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd5')]){_0x4b8d5b=_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd5')];return db['SmsMessage'][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd4')]}});}break;case _0xd26b('0xd6'):if(_0x1428a8[_0xd26b('0x5b')]['message_id']&&_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xd7')]){_0x4b8d5b=_0x1428a8['body']['status_code'];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')][_0xd26b('0x84')]}});}break;case _0xd26b('0x88'):var _0x5137ae=_0x1428a8[_0xd26b('0x5b')]['results'][0x0];if(_0x5137ae[_0xd26b('0x7f')]&&_0x5137ae[_0xd26b('0x2b')]['groupName']===_0xd26b('0xd8')){_0x4b8d5b=_0x5137ae[_0xd26b('0x2b')]['groupName'];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0x5137ae['messageId']}});}break;case _0xd26b('0xd9'):if(_0x1428a8[_0xd26b('0x5b')]['messageId']&&_0x1428a8[_0xd26b('0x5b')]['status']){_0x4b8d5b=_0x1428a8[_0xd26b('0x5b')][_0xd26b('0x2b')];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')]['messageId']}});}break;case _0xd26b('0x8f'):if(_0x1428a8[_0xd26b('0x5b')][0x0]['message']['id']){_0x4b8d5b=_0x1428a8[_0xd26b('0x5b')][0x0]['type'];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')][0x0][_0xd26b('0x28')]['id']}});}break;case _0xd26b('0x90'):if(_0x1428a8[_0xd26b('0x5b')]['redif']&&_0x1428a8['body'][_0xd26b('0x2b')]){_0x4b8d5b=_0x1428a8[_0xd26b('0x5b')]['status'];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0x1428a8[_0xd26b('0x5b')][_0xd26b('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x4b0c1c,null))['then'](function(_0x48ae4e){if(_0x48ae4e){_0x5cccc5=_0x48ae4e;switch(_0x5a7cc5[_0xd26b('0x3c')]){case'skebby':if(_0x4b8d5b==='DELIVERED'){return _0x5cccc5[_0xd26b('0x32')]({'read':!![]});}else{logger[_0xd26b('0x26')](_0xd26b('0x24'),_0xd26b('0x2b'),_0xd26b('0xd2'),util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x83'):if(_0x4b8d5b==='1'){return _0x5cccc5[_0xd26b('0x32')]({'read':!![]});}else{logger['error'](_0xd26b('0x24'),_0xd26b('0x2b'),_0xd26b('0xd2'),util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd26b('0xd6'):if(!_0x1428a8[_0xd26b('0x5b')]['error_code']&&_0x4b8d5b>=0xc8&&_0x4b8d5b<=0xce){return _0x5cccc5['update']({'read':!![]});}else{logger[_0xd26b('0x26')](_0xd26b('0x24'),'status',_0xd26b('0xd6'),util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x88'):var _0x22d618=_0x1428a8[_0xd26b('0x5b')][_0xd26b('0x89')][0x0];if(_0x22d618[_0xd26b('0x2b')][_0xd26b('0xdb')]===_0xd26b('0xd8')){return _0x5cccc5['update']({'read':!![]});}else{logger[_0xd26b('0x26')](_0xd26b('0x24'),'status',_0xd26b('0x88'),util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4b8d5b==_0xd26b('0xdc')||_0x4b8d5b==_0xd26b('0xdd')){return _0x5cccc5[_0xd26b('0x32')]({'read':!![]});}else{logger[_0xd26b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd26b('0x2b'),'clickatell',util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x8f'):if(_0x4b8d5b==_0xd26b('0xde')){return _0x5cccc5[_0xd26b('0x32')]({'read':!![]});}else{logger[_0xd26b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd26b('0x2b'),'bandwidth',util[_0xd26b('0xd1')](_0x1428a8['body'],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x90'):if(_0x4b8d5b===_0xd26b('0xdf')||_0x4b8d5b===_0xd26b('0xe0')){return _0x5cccc5[_0xd26b('0x32')]({'read':!![]});}else{logger[_0xd26b('0x26')](_0xd26b('0x24'),'status',_0xd26b('0x90'),util[_0xd26b('0xd1')](_0x1428a8[_0xd26b('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5cccc5;}})[_0xd26b('0x1f')](respondWithResult(_0x4b0c1c,null))['catch'](handleError(_0x4b0c1c,null));};exports[_0xd26b('0xe1')]=function(_0xe70b8e,_0x2e585a,_0x560ec4){var _0x3a093e,_0x3ce5cc,_0x5ca770;return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0xe70b8e[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2e585a,null))[_0xd26b('0x1f')](function(_0x14958c){if(_0x14958c){_0x5ca770=_0x14958c;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd26b('0x2b'),'received\x20delivery\x20report\x20from',_0x14958c[_0xd26b('0x3c')],util['inspect'](_0xe70b8e[_0xd26b('0x3f')],{'showHidden':![],'depth':null}));switch(_0x14958c['type']){case'csc':if(_0xe70b8e['query'][_0xd26b('0xe2')]&&_0xe70b8e['query']['state']){_0x3ce5cc=_0xe70b8e[_0xd26b('0x3f')][_0xd26b('0xe3')];return db[_0xd26b('0xa6')][_0xd26b('0x59')]({'where':{'messageId':_0xe70b8e[_0xd26b('0x3f')][_0xd26b('0xe2')]}});}break;}}})[_0xd26b('0x1f')](handleEntityNotFound(_0x2e585a,null))[_0xd26b('0x1f')](function(_0x5cc688){if(_0x5cc688){_0x3a093e=_0x5cc688;switch(_0x5ca770[_0xd26b('0x3c')]){case'csc':if(_0x3ce5cc==='2'||_0x3ce5cc==='6'){return _0x3a093e['update']({'read':!![]});}else{logger[_0xd26b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd26b('0x2b'),'csc',util[_0xd26b('0xd1')](_0xe70b8e['query'],{'showHidden':![],'depth':null}));};break;}return _0x3a093e;}})['then'](respondWithResult(_0x2e585a,null))[_0xd26b('0x29')](handleError(_0x2e585a,null));};exports['addAgents']=function(_0x4dd499,_0x158363,_0x43ef83){return db[_0xd26b('0x3a')]['find']({'where':{'id':_0x4dd499[_0xd26b('0x54')]['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x158363,null))[_0xd26b('0x1f')](function(_0x215627){if(_0x215627){return _0x215627[_0xd26b('0xe4')](_0x4dd499[_0xd26b('0x5b')]['ids'],_[_0xd26b('0x9b')](_0x4dd499['body'],[_0xd26b('0x6c'),'id'])||{})['spread'](function(_0xb57b8b){for(var _0x24b7e6=0x0;_0x24b7e6<_0x4dd499[_0xd26b('0x5b')][_0xd26b('0x6c')][_0xd26b('0x43')];_0x24b7e6+=0x1){socket[_0xd26b('0xe5')](_0xd26b('0xe6'),{'UserId':Number(_0x4dd499[_0xd26b('0x5b')][_0xd26b('0x6c')][_0x24b7e6]),'SmsAccountId':Number(_0x4dd499[_0xd26b('0x54')]['id'])});}return _0xb57b8b;});}})[_0xd26b('0x1f')](respondWithResult(_0x158363,null))[_0xd26b('0x29')](handleError(_0x158363,null));};exports[_0xd26b('0xe7')]=function(_0x5ac3cf,_0x3432ad,_0x29e9f7){return db[_0xd26b('0x3a')][_0xd26b('0x59')]({'where':{'id':_0x5ac3cf['params']['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x3432ad,null))[_0xd26b('0x1f')](function(_0x1b89f6){if(_0x1b89f6){return _0x1b89f6[_0xd26b('0xe7')](_0x5ac3cf[_0xd26b('0x3f')]['ids'])[_0xd26b('0x1f')](function(){if(_[_0xd26b('0xe8')](_0x5ac3cf[_0xd26b('0x3f')][_0xd26b('0x6c')])){for(var _0x181e04=0x0;_0x181e04<_0x5ac3cf['query'][_0xd26b('0x6c')][_0xd26b('0x43')];_0x181e04+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x5ac3cf[_0xd26b('0x3f')][_0xd26b('0x6c')][_0x181e04]),'SmsAccountId':Number(_0x5ac3cf[_0xd26b('0x54')]['id'])});}}else{socket[_0xd26b('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x5ac3cf[_0xd26b('0x3f')]['ids']),'SmsAccountId':Number(_0x5ac3cf[_0xd26b('0x54')]['id'])});}});}})[_0xd26b('0x1f')](respondWithStatusCode(_0x3432ad,null))[_0xd26b('0x29')](handleError(_0x3432ad,null));};exports[_0xd26b('0xe9')]=function(_0x4cda1b,_0x3b2559,_0x51bb8e){var _0x52879e={};var _0x115ac6={};var _0x5b9afb;var _0x271167;return db[_0xd26b('0x3a')][_0xd26b('0x62')]({'where':{'id':_0x4cda1b['params']['id']}})[_0xd26b('0x1f')](handleEntityNotFound(_0x3b2559,null))[_0xd26b('0x1f')](function(_0x1ab118){if(_0x1ab118){_0x5b9afb=_0x1ab118;_0x115ac6['model']=_[_0xd26b('0x40')](db[_0xd26b('0xaa')][_0xd26b('0x57')]);_0x115ac6[_0xd26b('0x3f')]=_[_0xd26b('0x40')](_0x4cda1b['query']);_0x115ac6[_0xd26b('0x49')]=_[_0xd26b('0x58')](_0x115ac6[_0xd26b('0x3e')],_0x115ac6[_0xd26b('0x3f')]);_0x52879e[_0xd26b('0x41')]=_[_0xd26b('0x58')](_0x115ac6[_0xd26b('0x3e')],qs[_0xd26b('0x42')](_0x4cda1b['query'][_0xd26b('0x42')]));_0x52879e['attributes']=_0x52879e[_0xd26b('0x41')][_0xd26b('0x43')]?_0x52879e[_0xd26b('0x41')]:_0x115ac6['model'];_0x52879e[_0xd26b('0x64')]=qs[_0xd26b('0x47')](_0x4cda1b[_0xd26b('0x3f')][_0xd26b('0x47')]);_0x52879e[_0xd26b('0x4b')]=qs[_0xd26b('0x49')](_[_0xd26b('0x48')](_0x4cda1b[_0xd26b('0x3f')],_0x115ac6['filters']));if(_0x4cda1b['query']['filter']){_0x52879e['where']=_[_0xd26b('0x4c')](_0x52879e[_0xd26b('0x4b')],{'$or':_[_0xd26b('0x4d')](_0x52879e[_0xd26b('0x41')],function(_0x21550b){var _0x6da35b={};_0x6da35b[_0x21550b]={'$like':'%'+_0x4cda1b['query']['filter']+'%'};return _0x6da35b;})});}_0x52879e=_[_0xd26b('0x4c')]({},_0x52879e,_0x4cda1b[_0xd26b('0x4e')]);return _0x5b9afb['getAgents'](_0x52879e);}})[_0xd26b('0x1f')](function(_0x3083fa){if(_0x3083fa){_0x271167=_0x3083fa[_0xd26b('0x43')];if(!_0x4cda1b[_0xd26b('0x3f')][_0xd26b('0x44')](_0xd26b('0x45'))){_0x52879e['limit']=qs[_0xd26b('0x2d')](_0x4cda1b[_0xd26b('0x3f')][_0xd26b('0x2d')]);_0x52879e[_0xd26b('0x46')]=qs[_0xd26b('0x46')](_0x4cda1b[_0xd26b('0x3f')]['offset']);}return _0x5b9afb[_0xd26b('0xe9')](_0x52879e);}})['then'](function(_0x17118c){if(_0x17118c){return _0x17118c?{'count':_0x271167,'rows':_0x17118c}:null;}})[_0xd26b('0x1f')](respondWithResult(_0x3b2559,null))[_0xd26b('0x29')](handleError(_0x3b2559,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8fe1844..f9360e8 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 _0xf835=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','SmsAccount'];(function(_0x2a242a,_0x36f1ef){var _0xab8839=function(_0x18a56e){while(--_0x18a56e){_0x2a242a['push'](_0x2a242a['shift']());}};_0xab8839(++_0x36f1ef);}(_0xf835,0xc4));var _0x5f83=function(_0x752854,_0x2d7017){_0x752854=_0x752854-0x0;var _0x21192e=_0xf835[_0x752854];return _0x21192e;};'use strict';var EventEmitter=require(_0x5f83('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5f83('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5f83('0x2')](0x0);var events={'afterCreate':_0x5f83('0x3'),'afterUpdate':'update','afterDestroy':_0x5f83('0x4')};function emitEvent(_0x185d10){return function(_0x3cf80c,_0x852093,_0x79fe3a){SmsAccountEvents[_0x5f83('0x5')](_0x185d10+':'+_0x3cf80c['id'],_0x3cf80c);SmsAccountEvents[_0x5f83('0x5')](_0x185d10,_0x3cf80c);_0x79fe3a(null);};}for(var e in events){if(events[_0x5f83('0x6')](e)){var event=events[e];SmsAccount[_0x5f83('0x7')](e,emitEvent(event));}}module[_0x5f83('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x7260=['events','../../mysqldb','SmsAccount','remove','emit','hasOwnProperty','exports'];(function(_0x2f1677,_0x668f){var _0x359eff=function(_0x3fcc1e){while(--_0x3fcc1e){_0x2f1677['push'](_0x2f1677['shift']());}};_0x359eff(++_0x668f);}(_0x7260,0x18f));var _0x0726=function(_0x2a90a2,_0x1aeb9e){_0x2a90a2=_0x2a90a2-0x0;var _0x40bf40=_0x7260[_0x2a90a2];return _0x40bf40;};'use strict';var EventEmitter=require(_0x0726('0x0'));var SmsAccount=require(_0x0726('0x1'))['db'][_0x0726('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0726('0x3')};function emitEvent(_0x3bd3e3){return function(_0x453e85,_0x57a7a3,_0x80042b){SmsAccountEvents[_0x0726('0x4')](_0x3bd3e3+':'+_0x453e85['id'],_0x453e85);SmsAccountEvents[_0x0726('0x4')](_0x3bd3e3,_0x453e85);_0x80042b(null);};}for(var e in events){if(events[_0x0726('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x0726('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e6222d3..520f3d5 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 _0xf6d2=['SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x284176,_0x338fb9){var _0x39d541=function(_0x37d0ce){while(--_0x37d0ce){_0x284176['push'](_0x284176['shift']());}};_0x39d541(++_0x338fb9);}(_0xf6d2,0x1e2));var _0x2f6d=function(_0x126cb0,_0x1202d1){_0x126cb0=_0x126cb0-0x0;var _0x4d86ae=_0xf6d2[_0x126cb0];return _0x4d86ae;};'use strict';var _=require(_0x2f6d('0x0'));var util=require('util');var logger=require(_0x2f6d('0x1'))(_0x2f6d('0x2'));var moment=require(_0x2f6d('0x3'));var BPromise=require(_0x2f6d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f6d('0x5'));var rimraf=require(_0x2f6d('0x6'));var config=require(_0x2f6d('0x7'));var attributes=require('./smsAccount.attributes');module[_0x2f6d('0x8')]=function(_0x2b3131,_0x248632){return _0x2b3131[_0x2f6d('0x9')](_0x2f6d('0xa'),attributes,{'tableName':_0x2f6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x530c=['../../config/logger','moment','request-promise','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x530c,0x10c));var _0xc530=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x530c[_0x2f54b6];return _0x169f21;};'use strict';var _=require(_0xc530('0x0'));var util=require(_0xc530('0x1'));var logger=require(_0xc530('0x2'))('api');var moment=require(_0xc530('0x3'));var BPromise=require('bluebird');var rp=require(_0xc530('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xc530('0x5')]=function(_0xc9161c,_0x4c61ef){return _0xc9161c[_0xc530('0x6')](_0xc530('0x7'),attributes,{'tableName':_0xc530('0x8'),'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 30552f5..6b92360 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 _0xb773=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x55cc6a,_0x5db072){var _0x49a025=function(_0x195eef){while(--_0x195eef){_0x55cc6a['push'](_0x55cc6a['shift']());}};_0x49a025(++_0x5db072);}(_0xb773,0x13e));var _0x3b77=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xb773[_0x44b7d6];return _0x5346f0;};'use strict';var _=require(_0x3b77('0x0'));var util=require(_0x3b77('0x1'));var moment=require(_0x3b77('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b77('0x3'));var fs=require('fs');var Redis=require(_0x3b77('0x4'));var db=require(_0x3b77('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b77('0x6'))(_0x3b77('0x7'));var config=require(_0x3b77('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b77('0x9')][_0x3b77('0xa')]({'port':0x232a});config[_0x3b77('0xb')]=_[_0x3b77('0xc')](config['redis'],{'host':_0x3b77('0xd'),'port':0x18eb});var socket=require(_0x3b77('0xe'))(new Redis(config[_0x3b77('0xb')]));require('./smsAccount.socket')[_0x3b77('0xf')](socket);function respondWithRpcPromise(_0x463308,_0x479f3a,_0x36b279){return new BPromise(function(_0x13d5c0,_0xe1bd8){return client['request'](_0x463308,_0x36b279)[_0x3b77('0x10')](function(_0x41017d){logger[_0x3b77('0x11')](_0x3b77('0x12'),_0x479f3a,'request\x20sent');logger['debug'](_0x3b77('0x13'),_0x479f3a,'request\x20sent',JSON[_0x3b77('0x14')](_0x41017d));if(_0x41017d['error']){if(_0x41017d[_0x3b77('0x15')]['code']===0x1f4){logger[_0x3b77('0x15')](_0x3b77('0x12'),_0x479f3a,_0x41017d['error'][_0x3b77('0x16')]);return _0xe1bd8(_0x41017d[_0x3b77('0x15')]['message']);}logger[_0x3b77('0x15')]('SmsAccount,\x20%s,\x20%s',_0x479f3a,_0x41017d[_0x3b77('0x15')]['message']);return _0x13d5c0(_0x41017d[_0x3b77('0x15')][_0x3b77('0x16')]);}else{logger[_0x3b77('0x11')](_0x3b77('0x12'),_0x479f3a,_0x3b77('0x17'));_0x13d5c0(_0x41017d['result'][_0x3b77('0x16')]);}})[_0x3b77('0x18')](function(_0x429017){logger[_0x3b77('0x15')](_0x3b77('0x12'),_0x479f3a,_0x429017);_0xe1bd8(_0x429017);});});}exports[_0x3b77('0x19')]=function(_0x38572c){var _0x46f1a7=this;return new Promise(function(_0x135f3c,_0x4da7d7){return db[_0x3b77('0x1a')][_0x3b77('0x1b')]({'raw':_0x38572c['options']?_0x38572c[_0x3b77('0x1c')][_0x3b77('0x1d')]===undefined?!![]:![]:!![],'where':_0x38572c[_0x3b77('0x1c')]?_0x38572c[_0x3b77('0x1c')][_0x3b77('0x1e')]||null:null,'attributes':_0x38572c[_0x3b77('0x1c')]?_0x38572c[_0x3b77('0x1c')][_0x3b77('0x1f')]||null:null,'include':_0x38572c[_0x3b77('0x1c')]?_0x38572c[_0x3b77('0x1c')][_0x3b77('0x20')]?_['map'](_0x38572c[_0x3b77('0x1c')]['include'],function(_0xd37034){return{'model':db[_0xd37034[_0x3b77('0x21')]],'as':_0xd37034['as'],'attributes':_0xd37034[_0x3b77('0x1f')],'include':_0xd37034[_0x3b77('0x20')]?_[_0x3b77('0x22')](_0xd37034[_0x3b77('0x20')],function(_0x12161e){return{'model':db[_0x12161e['model']],'as':_0x12161e['as'],'attributes':_0x12161e[_0x3b77('0x1f')],'include':_0x12161e[_0x3b77('0x20')]?_[_0x3b77('0x22')](_0x12161e[_0x3b77('0x20')],function(_0xa565d5){return{'model':db[_0xa565d5['model']],'as':_0xa565d5['as'],'attributes':_0xa565d5[_0x3b77('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bec11){logger[_0x3b77('0x11')](_0x3b77('0x19'),_0x38572c);logger[_0x3b77('0x23')](_0x3b77('0x19'),_0x38572c,JSON[_0x3b77('0x14')](_0x3bec11));_0x135f3c(_0x3bec11);})[_0x3b77('0x18')](function(_0x54b2ac){logger[_0x3b77('0x15')](_0x3b77('0x19'),_0x54b2ac[_0x3b77('0x16')],_0x38572c);_0x4da7d7(_0x46f1a7[_0x3b77('0x15')](0x1f4,_0x54b2ac['message']));});});}; \ No newline at end of file +var _0xb58b=['request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','find','options','raw','where','include','model','attributes','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xb58b,0x192));var _0xbb58=function(_0x217bd7,_0xe0c23e){_0x217bd7=_0x217bd7-0x0;var _0x5ccb58=_0xb58b[_0x217bd7];return _0x5ccb58;};'use strict';var _=require(_0xbb58('0x0'));var util=require(_0xbb58('0x1'));var moment=require(_0xbb58('0x2'));var BPromise=require(_0xbb58('0x3'));var rs=require(_0xbb58('0x4'));var fs=require('fs');var Redis=require(_0xbb58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb58('0x6'));var logger=require(_0xbb58('0x7'))(_0xbb58('0x8'));var config=require(_0xbb58('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb58('0xa')]({'port':0x232a});config[_0xbb58('0xb')]=_[_0xbb58('0xc')](config['redis'],{'host':_0xbb58('0xd'),'port':0x18eb});var socket=require(_0xbb58('0xe'))(new Redis(config[_0xbb58('0xb')]));require(_0xbb58('0xf'))['register'](socket);function respondWithRpcPromise(_0x450794,_0x58842d,_0x2546b7){return new BPromise(function(_0x29bf94,_0x740a18){return client[_0xbb58('0x10')](_0x450794,_0x2546b7)['then'](function(_0x5e7daa){logger[_0xbb58('0x11')]('SmsAccount,\x20%s,\x20%s',_0x58842d,_0xbb58('0x12'));logger[_0xbb58('0x13')](_0xbb58('0x14'),_0x58842d,_0xbb58('0x12'),JSON[_0xbb58('0x15')](_0x5e7daa));if(_0x5e7daa[_0xbb58('0x16')]){if(_0x5e7daa[_0xbb58('0x16')][_0xbb58('0x17')]===0x1f4){logger[_0xbb58('0x16')](_0xbb58('0x18'),_0x58842d,_0x5e7daa[_0xbb58('0x16')][_0xbb58('0x19')]);return _0x740a18(_0x5e7daa[_0xbb58('0x16')][_0xbb58('0x19')]);}logger[_0xbb58('0x16')](_0xbb58('0x18'),_0x58842d,_0x5e7daa[_0xbb58('0x16')][_0xbb58('0x19')]);return _0x29bf94(_0x5e7daa[_0xbb58('0x16')][_0xbb58('0x19')]);}else{logger['info'](_0xbb58('0x18'),_0x58842d,_0xbb58('0x12'));_0x29bf94(_0x5e7daa[_0xbb58('0x1a')]['message']);}})[_0xbb58('0x1b')](function(_0x5cef4e){logger[_0xbb58('0x16')](_0xbb58('0x18'),_0x58842d,_0x5cef4e);_0x740a18(_0x5cef4e);});});}exports[_0xbb58('0x1c')]=function(_0x4904c9){var _0x2c629a=this;return new Promise(function(_0x2c1512,_0x5ee0e4){return db['SmsAccount'][_0xbb58('0x1d')]({'raw':_0x4904c9[_0xbb58('0x1e')]?_0x4904c9[_0xbb58('0x1e')][_0xbb58('0x1f')]===undefined?!![]:![]:!![],'where':_0x4904c9[_0xbb58('0x1e')]?_0x4904c9[_0xbb58('0x1e')][_0xbb58('0x20')]||null:null,'attributes':_0x4904c9['options']?_0x4904c9[_0xbb58('0x1e')]['attributes']||null:null,'include':_0x4904c9[_0xbb58('0x1e')]?_0x4904c9['options'][_0xbb58('0x21')]?_['map'](_0x4904c9[_0xbb58('0x1e')][_0xbb58('0x21')],function(_0x508132){return{'model':db[_0x508132[_0xbb58('0x22')]],'as':_0x508132['as'],'attributes':_0x508132[_0xbb58('0x23')],'include':_0x508132[_0xbb58('0x21')]?_[_0xbb58('0x24')](_0x508132[_0xbb58('0x21')],function(_0x4beb99){return{'model':db[_0x4beb99[_0xbb58('0x22')]],'as':_0x4beb99['as'],'attributes':_0x4beb99[_0xbb58('0x23')],'include':_0x4beb99[_0xbb58('0x21')]?_['map'](_0x4beb99[_0xbb58('0x21')],function(_0x3a3e94){return{'model':db[_0x3a3e94[_0xbb58('0x22')]],'as':_0x3a3e94['as'],'attributes':_0x3a3e94['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb58('0x25')](function(_0x27e8b4){logger['info'](_0xbb58('0x1c'),_0x4904c9);logger[_0xbb58('0x13')](_0xbb58('0x1c'),_0x4904c9,JSON[_0xbb58('0x15')](_0x27e8b4));_0x2c1512(_0x27e8b4);})[_0xbb58('0x1b')](function(_0x3576ee){logger[_0xbb58('0x16')](_0xbb58('0x1c'),_0x3576ee[_0xbb58('0x19')],_0x4904c9);_0x5ee0e4(_0x2c629a[_0xbb58('0x16')](0x1f4,_0x3576ee[_0xbb58('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 982b212..1b4c4e2 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 76c6dac..905c16f 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 _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(_0x11ce88,_0x2c6c11){var _0x38e21b=function(_0x215341){while(--_0x215341){_0x11ce88['push'](_0x11ce88['shift']());}};_0x38e21b(++_0x2c6c11);}(_0xedd9,0xfc));var _0x9edd=function(_0x53bec2,_0x2c8db1){_0x53bec2=_0x53bec2-0x0;var _0x418497=_0xedd9[_0x53bec2];return _0x418497;};'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 +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0x34e8,0x12c));var _0x834e=function(_0xd992ff,_0x721aff){_0xd992ff=_0xd992ff-0x0;var _0x5a8d95=_0x34e8[_0xd992ff];return _0x5a8d95;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f21eb2e..757e661 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 _0xdd1b=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x53e25d,_0x4db4f3){var _0x2b44ea=function(_0x49de8a){while(--_0x49de8a){_0x53e25d['push'](_0x53e25d['shift']());}};_0x2b44ea(++_0x4db4f3);}(_0xdd1b,0x78));var _0xbdd1=function(_0x8343ba,_0x217a01){_0x8343ba=_0x8343ba-0x0;var _0x3b10ff=_0xdd1b[_0x8343ba];return _0x3b10ff;};'use strict';var Sequelize=require(_0xbdd1('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbdd1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbdd1('0x2')],'allowNull':![],'defaultValue':_0xbdd1('0x3')},'appdata':{'type':Sequelize[_0xbdd1('0x4')]()},'description':{'type':Sequelize[_0xbdd1('0x2')]},'interval':{'type':Sequelize[_0xbdd1('0x2')],'defaultValue':_0xbdd1('0x5')}}; \ No newline at end of file +var _0x8d22=['sequelize','INTEGER','STRING','TEXT'];(function(_0x2dae62,_0x226560){var _0x558cd5=function(_0x2de004){while(--_0x2de004){_0x2dae62['push'](_0x2dae62['shift']());}};_0x558cd5(++_0x226560);}(_0x8d22,0x10c));var _0x28d2=function(_0x4613f1,_0x51029d){_0x4613f1=_0x4613f1-0x0;var _0x5c184f=_0x8d22[_0x4613f1];return _0x5c184f;};'use strict';var Sequelize=require(_0x28d2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x28d2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x28d2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x28d2('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x28d2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 63d8ae2..534361c 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 _0x97d1=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','save','update','destroy','then','error','name','send','index','map','SmsApplication','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv'];(function(_0x3fb8ce,_0x236bcd){var _0x5c29a5=function(_0x25ea17){while(--_0x25ea17){_0x3fb8ce['push'](_0x3fb8ce['shift']());}};_0x5c29a5(++_0x236bcd);}(_0x97d1,0xd9));var _0x197d=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x97d1[_0x163f58];return _0x472ed9;};'use strict';var emlformat=require(_0x197d('0x0'));var rimraf=require(_0x197d('0x1'));var zipdir=require(_0x197d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x197d('0x3'));var moment=require(_0x197d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x197d('0x5'));var path=require('path');var sox=require(_0x197d('0x6'));var csv=require(_0x197d('0x7'));var ejs=require(_0x197d('0x8'));var fs=require('fs');var fs_extra=require(_0x197d('0x9'));var _=require(_0x197d('0xa'));var squel=require(_0x197d('0xb'));var crypto=require(_0x197d('0xc'));var jsforce=require(_0x197d('0xd'));var deskjs=require(_0x197d('0xe'));var toCsv=require(_0x197d('0x7'));var querystring=require(_0x197d('0xf'));var Papa=require(_0x197d('0x10'));var Redis=require(_0x197d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x197d('0x12'));var as=require(_0x197d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x197d('0x14'))(_0x197d('0x15'));var utils=require(_0x197d('0x16'));var config=require(_0x197d('0x17'));var licenseUtil=require(_0x197d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x436731,_0x350c36){_0x350c36=_0x350c36||0xcc;return function(_0x3c96ac){if(_0x3c96ac){return _0x436731[_0x197d('0x19')](_0x350c36);}return _0x436731['status'](_0x350c36)[_0x197d('0x1a')]();};}function respondWithResult(_0x594593,_0x13a08d){_0x13a08d=_0x13a08d||0xc8;return function(_0x70aa95){if(_0x70aa95){return _0x594593[_0x197d('0x1b')](_0x13a08d)['json'](_0x70aa95);}};}function respondWithFilteredResult(_0x5d18db,_0x446280){return function(_0x5dc35a){if(_0x5dc35a){var _0x1fed47=typeof _0x446280[_0x197d('0x1c')]===_0x197d('0x1d')&&typeof _0x446280[_0x197d('0x1e')]==='undefined';var _0xe0d8b6=_0x5dc35a['count'];var _0x44929f=_0x1fed47?0x0:_0x446280[_0x197d('0x1c')];var _0x374c62=_0x1fed47?_0x5dc35a['count']:_0x446280['offset']+_0x446280[_0x197d('0x1e')];var _0x58550a;if(_0x374c62>=_0xe0d8b6){_0x374c62=_0xe0d8b6;_0x58550a=0xc8;}else{_0x58550a=0xce;}_0x5d18db[_0x197d('0x1b')](_0x58550a);return _0x5d18db['set'](_0x197d('0x1f'),_0x44929f+'-'+_0x374c62+'/'+_0xe0d8b6)[_0x197d('0x20')](_0x5dc35a);}return null;};}function patchUpdates(_0x276f80){return function(_0x1dfb93){try{jsonpatch[_0x197d('0x21')](_0x1dfb93,_0x276f80,!![]);}catch(_0x18fcbd){return BPromise['reject'](_0x18fcbd);}return _0x1dfb93[_0x197d('0x22')]();};}function saveUpdates(_0x55175b,_0xa2d655){return function(_0x1581f7){if(_0x1581f7){return _0x1581f7[_0x197d('0x23')](_0x55175b)['then'](function(_0xe772d7){return _0xe772d7;});}return null;};}function removeEntity(_0x1dc364,_0x20b0ca){return function(_0x4aebb9){if(_0x4aebb9){return _0x4aebb9[_0x197d('0x24')]()[_0x197d('0x25')](function(){_0x1dc364[_0x197d('0x1b')](0xcc)[_0x197d('0x1a')]();});}};}function handleEntityNotFound(_0x288bf3,_0x3dfcb1){return function(_0xcde439){if(!_0xcde439){_0x288bf3[_0x197d('0x19')](0x194);}return _0xcde439;};}function handleError(_0x513416,_0x47a52e){_0x47a52e=_0x47a52e||0x1f4;return function(_0x39269f){logger[_0x197d('0x26')](_0x39269f['stack']);if(_0x39269f[_0x197d('0x27')]){delete _0x39269f['name'];}_0x513416[_0x197d('0x1b')](_0x47a52e)[_0x197d('0x28')](_0x39269f);};}exports[_0x197d('0x29')]=function(_0x24ccab,_0x344895){var _0x2bcce1={},_0x571946={},_0x3c8559={'count':0x0,'rows':[]};var _0x38abd7=_[_0x197d('0x2a')](db[_0x197d('0x2b')]['rawAttributes'],function(_0x59ec48){return{'name':_0x59ec48[_0x197d('0x2c')],'type':_0x59ec48[_0x197d('0x2d')]['key']};});_0x571946['model']=_[_0x197d('0x2a')](_0x38abd7,'name');_0x571946[_0x197d('0x2e')]=_[_0x197d('0x2f')](_0x24ccab['query']);_0x571946[_0x197d('0x30')]=_['intersection'](_0x571946[_0x197d('0x31')],_0x571946['query']);_0x2bcce1[_0x197d('0x32')]=_[_0x197d('0x33')](_0x571946[_0x197d('0x31')],qs['fields'](_0x24ccab[_0x197d('0x2e')][_0x197d('0x34')]));_0x2bcce1[_0x197d('0x32')]=_0x2bcce1[_0x197d('0x32')][_0x197d('0x35')]?_0x2bcce1['attributes']:_0x571946[_0x197d('0x31')];if(!_0x24ccab[_0x197d('0x2e')][_0x197d('0x36')](_0x197d('0x37'))){_0x2bcce1[_0x197d('0x1e')]=qs[_0x197d('0x1e')](_0x24ccab[_0x197d('0x2e')][_0x197d('0x1e')]);_0x2bcce1[_0x197d('0x1c')]=qs[_0x197d('0x1c')](_0x24ccab[_0x197d('0x2e')]['offset']);}_0x2bcce1[_0x197d('0x38')]=qs['sort'](_0x24ccab['query'][_0x197d('0x39')]);_0x2bcce1[_0x197d('0x3a')]=qs[_0x197d('0x30')](_[_0x197d('0x3b')](_0x24ccab[_0x197d('0x2e')],_0x571946[_0x197d('0x30')]),_0x38abd7);if(_0x24ccab[_0x197d('0x2e')][_0x197d('0x3c')]){_0x2bcce1[_0x197d('0x3a')]=_['merge'](_0x2bcce1[_0x197d('0x3a')],{'$or':_[_0x197d('0x2a')](_0x38abd7,function(_0x32b366){if(_0x32b366[_0x197d('0x2d')]!==_0x197d('0x3d')){var _0x3ad996={};_0x3ad996[_0x32b366[_0x197d('0x27')]]={'$like':'%'+_0x24ccab[_0x197d('0x2e')]['filter']+'%'};return _0x3ad996;}})});}_0x2bcce1=_[_0x197d('0x3e')]({},_0x2bcce1,_0x24ccab[_0x197d('0x3f')]);var _0x338bea={'where':_0x2bcce1[_0x197d('0x3a')]};return db[_0x197d('0x2b')][_0x197d('0x40')](_0x338bea)[_0x197d('0x25')](function(_0x497edb){_0x3c8559[_0x197d('0x40')]=_0x497edb;if(_0x24ccab[_0x197d('0x2e')][_0x197d('0x41')]){_0x2bcce1['include']=[{'all':!![]}];}return db['SmsApplication'][_0x197d('0x42')](_0x2bcce1);})[_0x197d('0x25')](function(_0x52193){_0x3c8559[_0x197d('0x43')]=_0x52193;return _0x3c8559;})[_0x197d('0x25')](respondWithFilteredResult(_0x344895,_0x2bcce1))[_0x197d('0x44')](handleError(_0x344895,null));};exports[_0x197d('0x45')]=function(_0x5a21bd,_0x36aba7){var _0x142fee={'raw':!![],'where':{'id':_0x5a21bd['params']['id']}},_0xccd0c={};_0xccd0c['model']=_[_0x197d('0x2f')](db[_0x197d('0x2b')][_0x197d('0x46')]);_0xccd0c[_0x197d('0x2e')]=_[_0x197d('0x2f')](_0x5a21bd[_0x197d('0x2e')]);_0xccd0c['filters']=_[_0x197d('0x33')](_0xccd0c[_0x197d('0x31')],_0xccd0c['query']);_0x142fee[_0x197d('0x32')]=_[_0x197d('0x33')](_0xccd0c[_0x197d('0x31')],qs[_0x197d('0x34')](_0x5a21bd[_0x197d('0x2e')][_0x197d('0x34')]));_0x142fee['attributes']=_0x142fee[_0x197d('0x32')][_0x197d('0x35')]?_0x142fee[_0x197d('0x32')]:_0xccd0c['model'];if(_0x5a21bd[_0x197d('0x2e')]['includeAll']){_0x142fee['include']=[{'all':!![]}];}_0x142fee=_[_0x197d('0x3e')]({},_0x142fee,_0x5a21bd[_0x197d('0x3f')]);return db[_0x197d('0x2b')][_0x197d('0x47')](_0x142fee)[_0x197d('0x25')](handleEntityNotFound(_0x36aba7,null))[_0x197d('0x25')](respondWithResult(_0x36aba7,null))[_0x197d('0x44')](handleError(_0x36aba7,null));};exports[_0x197d('0x48')]=function(_0x3ea016,_0x1af5af){return db[_0x197d('0x2b')][_0x197d('0x48')](_0x3ea016['body'],{})['then'](respondWithResult(_0x1af5af,0xc9))['catch'](handleError(_0x1af5af,null));};exports[_0x197d('0x23')]=function(_0x5a5296,_0x28f949){if(_0x5a5296[_0x197d('0x49')]['id']){delete _0x5a5296[_0x197d('0x49')]['id'];}return db['SmsApplication'][_0x197d('0x47')]({'where':{'id':_0x5a5296[_0x197d('0x4a')]['id']}})[_0x197d('0x25')](handleEntityNotFound(_0x28f949,null))[_0x197d('0x25')](saveUpdates(_0x5a5296['body'],null))[_0x197d('0x25')](respondWithResult(_0x28f949,null))[_0x197d('0x44')](handleError(_0x28f949,null));};exports['destroy']=function(_0x247116,_0x5249d0){return db[_0x197d('0x2b')][_0x197d('0x47')]({'where':{'id':_0x247116[_0x197d('0x4a')]['id']}})[_0x197d('0x25')](handleEntityNotFound(_0x5249d0,null))['then'](removeEntity(_0x5249d0,null))[_0x197d('0x44')](handleError(_0x5249d0,null));}; \ No newline at end of file +var _0xe35b=['undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x133ee2,_0x1365ff){var _0x28e86f=function(_0x162938){while(--_0x162938){_0x133ee2['push'](_0x133ee2['shift']());}};_0x28e86f(++_0x1365ff);}(_0xe35b,0x154));var _0xbe35=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xe35b[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe35('0x0'));var zipdir=require(_0xbe35('0x1'));var jsonpatch=require(_0xbe35('0x2'));var rp=require('request-promise');var moment=require(_0xbe35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe35('0x4'));var util=require('util');var path=require(_0xbe35('0x5'));var sox=require(_0xbe35('0x6'));var csv=require(_0xbe35('0x7'));var ejs=require(_0xbe35('0x8'));var fs=require('fs');var fs_extra=require(_0xbe35('0x9'));var _=require(_0xbe35('0xa'));var squel=require('squel');var crypto=require(_0xbe35('0xb'));var jsforce=require(_0xbe35('0xc'));var deskjs=require(_0xbe35('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe35('0xe'));var Papa=require(_0xbe35('0xf'));var Redis=require('ioredis');var authService=require(_0xbe35('0x10'));var qs=require(_0xbe35('0x11'));var as=require(_0xbe35('0x12'));var hardwareService=require(_0xbe35('0x13'));var logger=require('../../config/logger')(_0xbe35('0x14'));var utils=require(_0xbe35('0x15'));var config=require(_0xbe35('0x16'));var licenseUtil=require(_0xbe35('0x17'));var db=require(_0xbe35('0x18'))['db'];function respondWithStatusCode(_0x8f85df,_0xa725e0){_0xa725e0=_0xa725e0||0xcc;return function(_0x5226d2){if(_0x5226d2){return _0x8f85df[_0xbe35('0x19')](_0xa725e0);}return _0x8f85df[_0xbe35('0x1a')](_0xa725e0)[_0xbe35('0x1b')]();};}function respondWithResult(_0x2641a1,_0x4a611c){_0x4a611c=_0x4a611c||0xc8;return function(_0x26897b){if(_0x26897b){return _0x2641a1[_0xbe35('0x1a')](_0x4a611c)[_0xbe35('0x1c')](_0x26897b);}};}function respondWithFilteredResult(_0x3aa92f,_0x13c0b8){return function(_0x4ce7a2){if(_0x4ce7a2){var _0x52932d=typeof _0x13c0b8[_0xbe35('0x1d')]===_0xbe35('0x1e')&&typeof _0x13c0b8['limit']===_0xbe35('0x1e');var _0x32ef2e=_0x4ce7a2['count'];var _0x3ed0cd=_0x52932d?0x0:_0x13c0b8[_0xbe35('0x1d')];var _0x3cb87f=_0x52932d?_0x4ce7a2[_0xbe35('0x1f')]:_0x13c0b8['offset']+_0x13c0b8[_0xbe35('0x20')];var _0x59d818;if(_0x3cb87f>=_0x32ef2e){_0x3cb87f=_0x32ef2e;_0x59d818=0xc8;}else{_0x59d818=0xce;}_0x3aa92f['status'](_0x59d818);return _0x3aa92f[_0xbe35('0x21')]('Content-Range',_0x3ed0cd+'-'+_0x3cb87f+'/'+_0x32ef2e)['json'](_0x4ce7a2);}return null;};}function patchUpdates(_0x37a201){return function(_0xb47a0a){try{jsonpatch[_0xbe35('0x22')](_0xb47a0a,_0x37a201,!![]);}catch(_0x43a827){return BPromise[_0xbe35('0x23')](_0x43a827);}return _0xb47a0a[_0xbe35('0x24')]();};}function saveUpdates(_0x5890b9,_0x3c0da6){return function(_0x1ddb6e){if(_0x1ddb6e){return _0x1ddb6e['update'](_0x5890b9)[_0xbe35('0x25')](function(_0x41446d){return _0x41446d;});}return null;};}function removeEntity(_0x410e22,_0x2b14af){return function(_0x46ac84){if(_0x46ac84){return _0x46ac84[_0xbe35('0x26')]()[_0xbe35('0x25')](function(){_0x410e22['status'](0xcc)[_0xbe35('0x1b')]();});}};}function handleEntityNotFound(_0x494418,_0x38d3f1){return function(_0x55e250){if(!_0x55e250){_0x494418[_0xbe35('0x19')](0x194);}return _0x55e250;};}function handleError(_0x4e7918,_0xb05d22){_0xb05d22=_0xb05d22||0x1f4;return function(_0x3dcfe4){logger[_0xbe35('0x27')](_0x3dcfe4[_0xbe35('0x28')]);if(_0x3dcfe4[_0xbe35('0x29')]){delete _0x3dcfe4['name'];}_0x4e7918[_0xbe35('0x1a')](_0xb05d22)['send'](_0x3dcfe4);};}exports[_0xbe35('0x2a')]=function(_0x25b256,_0x5bca28){var _0x3528db={},_0x1e61d5={},_0x1d728c={'count':0x0,'rows':[]};var _0xfaef9d=_[_0xbe35('0x2b')](db['SmsApplication'][_0xbe35('0x2c')],function(_0x4f4177){return{'name':_0x4f4177[_0xbe35('0x2d')],'type':_0x4f4177[_0xbe35('0x2e')]['key']};});_0x1e61d5[_0xbe35('0x2f')]=_[_0xbe35('0x2b')](_0xfaef9d,_0xbe35('0x29'));_0x1e61d5[_0xbe35('0x30')]=_[_0xbe35('0x31')](_0x25b256[_0xbe35('0x30')]);_0x1e61d5[_0xbe35('0x32')]=_[_0xbe35('0x33')](_0x1e61d5['model'],_0x1e61d5[_0xbe35('0x30')]);_0x3528db[_0xbe35('0x34')]=_[_0xbe35('0x33')](_0x1e61d5[_0xbe35('0x2f')],qs[_0xbe35('0x35')](_0x25b256[_0xbe35('0x30')][_0xbe35('0x35')]));_0x3528db[_0xbe35('0x34')]=_0x3528db['attributes'][_0xbe35('0x36')]?_0x3528db[_0xbe35('0x34')]:_0x1e61d5[_0xbe35('0x2f')];if(!_0x25b256[_0xbe35('0x30')]['hasOwnProperty'](_0xbe35('0x37'))){_0x3528db[_0xbe35('0x20')]=qs['limit'](_0x25b256[_0xbe35('0x30')][_0xbe35('0x20')]);_0x3528db[_0xbe35('0x1d')]=qs[_0xbe35('0x1d')](_0x25b256[_0xbe35('0x30')][_0xbe35('0x1d')]);}_0x3528db[_0xbe35('0x38')]=qs[_0xbe35('0x39')](_0x25b256['query'][_0xbe35('0x39')]);_0x3528db[_0xbe35('0x3a')]=qs[_0xbe35('0x32')](_['pick'](_0x25b256['query'],_0x1e61d5[_0xbe35('0x32')]),_0xfaef9d);if(_0x25b256[_0xbe35('0x30')][_0xbe35('0x3b')]){_0x3528db[_0xbe35('0x3a')]=_[_0xbe35('0x3c')](_0x3528db[_0xbe35('0x3a')],{'$or':_['map'](_0xfaef9d,function(_0x1204ba){if(_0x1204ba[_0xbe35('0x2e')]!==_0xbe35('0x3d')){var _0x55d555={};_0x55d555[_0x1204ba['name']]={'$like':'%'+_0x25b256[_0xbe35('0x30')][_0xbe35('0x3b')]+'%'};return _0x55d555;}})});}_0x3528db=_['merge']({},_0x3528db,_0x25b256[_0xbe35('0x3e')]);var _0x22875b={'where':_0x3528db[_0xbe35('0x3a')]};return db['SmsApplication'][_0xbe35('0x1f')](_0x22875b)[_0xbe35('0x25')](function(_0x3ce3e6){_0x1d728c[_0xbe35('0x1f')]=_0x3ce3e6;if(_0x25b256['query'][_0xbe35('0x3f')]){_0x3528db[_0xbe35('0x40')]=[{'all':!![]}];}return db[_0xbe35('0x41')][_0xbe35('0x42')](_0x3528db);})['then'](function(_0x1219e6){_0x1d728c[_0xbe35('0x43')]=_0x1219e6;return _0x1d728c;})[_0xbe35('0x25')](respondWithFilteredResult(_0x5bca28,_0x3528db))[_0xbe35('0x44')](handleError(_0x5bca28,null));};exports[_0xbe35('0x45')]=function(_0x1356f6,_0xa0e1ae){var _0x36cd2d={'raw':!![],'where':{'id':_0x1356f6[_0xbe35('0x46')]['id']}},_0x35fab8={};_0x35fab8[_0xbe35('0x2f')]=_[_0xbe35('0x31')](db[_0xbe35('0x41')]['rawAttributes']);_0x35fab8[_0xbe35('0x30')]=_[_0xbe35('0x31')](_0x1356f6['query']);_0x35fab8['filters']=_[_0xbe35('0x33')](_0x35fab8[_0xbe35('0x2f')],_0x35fab8[_0xbe35('0x30')]);_0x36cd2d[_0xbe35('0x34')]=_[_0xbe35('0x33')](_0x35fab8[_0xbe35('0x2f')],qs[_0xbe35('0x35')](_0x1356f6['query'][_0xbe35('0x35')]));_0x36cd2d[_0xbe35('0x34')]=_0x36cd2d[_0xbe35('0x34')]['length']?_0x36cd2d[_0xbe35('0x34')]:_0x35fab8[_0xbe35('0x2f')];if(_0x1356f6[_0xbe35('0x30')]['includeAll']){_0x36cd2d[_0xbe35('0x40')]=[{'all':!![]}];}_0x36cd2d=_[_0xbe35('0x3c')]({},_0x36cd2d,_0x1356f6[_0xbe35('0x3e')]);return db[_0xbe35('0x41')][_0xbe35('0x47')](_0x36cd2d)[_0xbe35('0x25')](handleEntityNotFound(_0xa0e1ae,null))['then'](respondWithResult(_0xa0e1ae,null))['catch'](handleError(_0xa0e1ae,null));};exports[_0xbe35('0x48')]=function(_0x291dc6,_0x193bba){return db['SmsApplication']['create'](_0x291dc6[_0xbe35('0x49')],{})[_0xbe35('0x25')](respondWithResult(_0x193bba,0xc9))[_0xbe35('0x44')](handleError(_0x193bba,null));};exports['update']=function(_0xab89f4,_0x93ee05){if(_0xab89f4['body']['id']){delete _0xab89f4['body']['id'];}return db[_0xbe35('0x41')][_0xbe35('0x47')]({'where':{'id':_0xab89f4[_0xbe35('0x46')]['id']}})[_0xbe35('0x25')](handleEntityNotFound(_0x93ee05,null))[_0xbe35('0x25')](saveUpdates(_0xab89f4['body'],null))[_0xbe35('0x25')](respondWithResult(_0x93ee05,null))[_0xbe35('0x44')](handleError(_0x93ee05,null));};exports[_0xbe35('0x26')]=function(_0x15e82e,_0x3c6588){return db[_0xbe35('0x41')]['find']({'where':{'id':_0x15e82e['params']['id']}})[_0xbe35('0x25')](handleEntityNotFound(_0x3c6588,null))[_0xbe35('0x25')](removeEntity(_0x3c6588,null))[_0xbe35('0x44')](handleError(_0x3c6588,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5bcd82a..31ff648 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 _0x06fc=['path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise'];(function(_0x5aaf28,_0x16b926){var _0x5925dd=function(_0x1c9aef){while(--_0x1c9aef){_0x5aaf28['push'](_0x5aaf28['shift']());}};_0x5925dd(++_0x16b926);}(_0x06fc,0x14d));var _0xc06f=function(_0x6e7f5,_0x560ec9){_0x6e7f5=_0x6e7f5-0x0;var _0x25f7c3=_0x06fc[_0x6e7f5];return _0x25f7c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc06f('0x0'))('api');var moment=require(_0xc06f('0x1'));var BPromise=require('bluebird');var rp=require(_0xc06f('0x2'));var fs=require('fs');var path=require(_0xc06f('0x3'));var rimraf=require(_0xc06f('0x4'));var config=require(_0xc06f('0x5'));var attributes=require('./smsApplication.attributes');module[_0xc06f('0x6')]=function(_0x2154a5,_0x15d668){return _0x2154a5[_0xc06f('0x7')](_0xc06f('0x8'),attributes,{'tableName':_0xc06f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc06f('0xa'),'collate':_0xc06f('0xb')});}; \ No newline at end of file +var _0x8546=['exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8546,0x125));var _0x6854=function(_0x2e106d,_0x536c11){_0x2e106d=_0x2e106d-0x0;var _0x5d061f=_0x8546[_0x2e106d];return _0x5d061f;};'use strict';var _=require(_0x6854('0x0'));var util=require(_0x6854('0x1'));var logger=require('../../config/logger')(_0x6854('0x2'));var moment=require(_0x6854('0x3'));var BPromise=require(_0x6854('0x4'));var rp=require(_0x6854('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6854('0x6'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x6854('0x7')]=function(_0x1a8ad6,_0x3ad64a){return _0x1a8ad6[_0x6854('0x8')](_0x6854('0x9'),attributes,{'tableName':_0x6854('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6854('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5b8479f..ba5e0fd 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 _0xc2a2=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4b833b,_0x17a859){var _0x104d32=function(_0x4ff318){while(--_0x4ff318){_0x4b833b['push'](_0x4b833b['shift']());}};_0x104d32(++_0x17a859);}(_0xc2a2,0x84));var _0x2c2a=function(_0xf60841,_0x3ef317){_0xf60841=_0xf60841-0x0;var _0x3efd2b=_0xc2a2[_0xf60841];return _0x3efd2b;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var moment=require(_0x2c2a('0x2'));var BPromise=require(_0x2c2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c2a('0x4'));var db=require(_0x2c2a('0x5'))['db'];var utils=require(_0x2c2a('0x6'));var logger=require('../../config/logger')(_0x2c2a('0x7'));var config=require(_0x2c2a('0x8'));var jayson=require(_0x2c2a('0x9'));var client=jayson[_0x2c2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f476,_0x53b0c0,_0x578a80){return new BPromise(function(_0x48a901,_0x5cc8c5){return client['request'](_0x52f476,_0x578a80)[_0x2c2a('0xb')](function(_0x48ba78){logger[_0x2c2a('0xc')](_0x2c2a('0xd'),_0x53b0c0,_0x2c2a('0xe'));logger[_0x2c2a('0xf')](_0x2c2a('0x10'),_0x53b0c0,_0x2c2a('0xe'),JSON['stringify'](_0x48ba78));if(_0x48ba78['error']){if(_0x48ba78[_0x2c2a('0x11')][_0x2c2a('0x12')]===0x1f4){logger[_0x2c2a('0x11')](_0x2c2a('0xd'),_0x53b0c0,_0x48ba78[_0x2c2a('0x11')][_0x2c2a('0x13')]);return _0x5cc8c5(_0x48ba78['error'][_0x2c2a('0x13')]);}logger[_0x2c2a('0x11')]('SmsApplication,\x20%s,\x20%s',_0x53b0c0,_0x48ba78[_0x2c2a('0x11')]['message']);return _0x48a901(_0x48ba78[_0x2c2a('0x11')]['message']);}else{logger[_0x2c2a('0xc')](_0x2c2a('0xd'),_0x53b0c0,'request\x20sent');_0x48a901(_0x48ba78[_0x2c2a('0x14')][_0x2c2a('0x13')]);}})[_0x2c2a('0x15')](function(_0x7af854){logger[_0x2c2a('0x11')](_0x2c2a('0xd'),_0x53b0c0,_0x7af854);_0x5cc8c5(_0x7af854);});});} \ No newline at end of file +var _0xcf37=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x9e6807,_0x13587d){var _0x1f1b72=function(_0x15fb2d){while(--_0x15fb2d){_0x9e6807['push'](_0x9e6807['shift']());}};_0x1f1b72(++_0x13587d);}(_0xcf37,0xdc));var _0x7cf3=function(_0x2d7cd2,_0x5e01dc){_0x2d7cd2=_0x2d7cd2-0x0;var _0x40851a=_0xcf37[_0x2d7cd2];return _0x40851a;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd617,_0x5be340,_0x78b9a4){return new BPromise(function(_0x53502d,_0x110c99){return client['request'](_0x4fd617,_0x78b9a4)[_0x7cf3('0xa')](function(_0x377577){logger[_0x7cf3('0xb')](_0x7cf3('0xc'),_0x5be340,_0x7cf3('0xd'));logger[_0x7cf3('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5be340,_0x7cf3('0xd'),JSON[_0x7cf3('0xf')](_0x377577));if(_0x377577[_0x7cf3('0x10')]){if(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x11')]===0x1f4){logger['error'](_0x7cf3('0xc'),_0x5be340,_0x377577['error'][_0x7cf3('0x12')]);return _0x110c99(_0x377577['error'][_0x7cf3('0x12')]);}logger[_0x7cf3('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5be340,_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);return _0x53502d(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);}else{logger['info'](_0x7cf3('0xc'),_0x5be340,'request\x20sent');_0x53502d(_0x377577[_0x7cf3('0x13')][_0x7cf3('0x12')]);}})[_0x7cf3('0x14')](function(_0x14aef6){logger[_0x7cf3('0x10')](_0x7cf3('0xc'),_0x5be340,_0x14aef6);_0x110c99(_0x14aef6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a2af72b..fb4af1f 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 _0x8603=['sms','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0xda3f86,_0x32c86c){var _0x1bcc40=function(_0x47a384){while(--_0x47a384){_0xda3f86['push'](_0xda3f86['shift']());}};_0x1bcc40(++_0x32c86c);}(_0x8603,0x190));var _0x3860=function(_0x263450,_0x420187){_0x263450=_0x263450-0x0;var _0x17a239=_0x8603[_0x263450];return _0x17a239;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getMessages']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0xf')]('/',auth['isAuthenticated'](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0xf')](_0x3860('0x12'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),'smsinteraction:addtags'),controller[_0x3860('0x15')]);router[_0x3860('0x16')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),_0x3860('0x18')),controller[_0x3860('0x19')]);router[_0x3860('0x1a')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')]('sms','smsinteraction:destroy'),controller[_0x3860('0x1b')]);router[_0x3860('0x1a')](_0x3860('0x12'),auth['isAuthenticated'](),controller[_0x3860('0x1c')]);module[_0x3860('0x1d')]=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x5df69b,_0x5d7cd6){var _0x79a0fe=function(_0x28d4ae){while(--_0x28d4ae){_0x5df69b['push'](_0x5df69b['shift']());}};_0x79a0fe(++_0x5d7cd6);}(_0x13f6,0x124));var _0x613f=function(_0x263286,_0x438db2){_0x263286=_0x263286-0x0;var _0x4f1c6b=_0x13f6[_0x263286];return _0x4f1c6b;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 7cabc56..f57effd 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 _0x7b27=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x3de684,_0x35e402){var _0x1dfed9=function(_0xfa2214){while(--_0xfa2214){_0x3de684['push'](_0x3de684['shift']());}};_0x1dfed9(++_0x35e402);}(_0x7b27,0x186));var _0x77b2=function(_0x2a91a8,_0x599455){_0x2a91a8=_0x2a91a8-0x0;var _0x4034a8=_0x7b27[_0x2a91a8];return _0x4034a8;};'use strict';var Sequelize=require(_0x77b2('0x0'));var moment=require('moment');module[_0x77b2('0x1')]={'closed':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x77b2('0x3')]},'disposition':{'type':Sequelize[_0x77b2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x77b2('0x4')]},'note':{'type':Sequelize[_0x77b2('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x77b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x77b2('0x5')]('in',_0x77b2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x77b2('0x5')]('in',_0x77b2('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x78e0=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0xab92b5,_0x184d79){var _0x3a758c=function(_0x3eae35){while(--_0x3eae35){_0xab92b5['push'](_0xab92b5['shift']());}};_0x3a758c(++_0x184d79);}(_0x78e0,0x13e));var _0x078e=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0x78e0[_0x5a47de];return _0x400ee6;};'use strict';var Sequelize=require(_0x078e('0x0'));var moment=require(_0x078e('0x1'));module[_0x078e('0x2')]={'closed':{'type':Sequelize[_0x078e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x078e('0x4')]},'disposition':{'type':Sequelize[_0x078e('0x5')]},'secondDisposition':{'type':Sequelize[_0x078e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x078e('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x078e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x078e('0x6')]('in',_0x078e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x078e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x078e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x078e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b98684c..50bc2b1 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 _0x2451=['split','forEach','push','answered','unmanaged','total','closed','UserId','waiting','talking','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','tools_tags','u.id','from','left_join','users','sms_interactions','cm_contacts','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','order','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','toString','merge','SmsInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','catch','show','params','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','Contact','lastName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','Messages','System','firstName','out','views','downloadInteraction.ejs','transcript-','.pdf','log','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','Users','map','fullname','TagIds','Tags'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x2451,0xb7));var _0x1245=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x2451[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0x1245('0x0'));var rimraf=require(_0x1245('0x1'));var zipdir=require(_0x1245('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1245('0x3'));var Mustache=require(_0x1245('0x4'));var util=require(_0x1245('0x5'));var path=require(_0x1245('0x6'));var sox=require(_0x1245('0x7'));var csv=require('to-csv');var ejs=require(_0x1245('0x8'));var fs=require('fs');var fs_extra=require(_0x1245('0x9'));var _=require(_0x1245('0xa'));var squel=require('squel');var crypto=require(_0x1245('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1245('0xc'));var querystring=require(_0x1245('0xd'));var Papa=require(_0x1245('0xe'));var Redis=require(_0x1245('0xf'));var authService=require(_0x1245('0x10'));var qs=require(_0x1245('0x11'));var as=require(_0x1245('0x12'));var pdf=require(_0x1245('0x13'));var hardwareService=require(_0x1245('0x14'));var logger=require('../../config/logger')(_0x1245('0x15'));var utils=require(_0x1245('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1245('0x17'));var db=require(_0x1245('0x18'))['db'];config[_0x1245('0x19')]=_[_0x1245('0x1a')](config['redis'],{'host':_0x1245('0x1b'),'port':0x18eb});var socket=require(_0x1245('0x1c'))(new Redis(config[_0x1245('0x19')]));require(_0x1245('0x1d'))['register'](socket);function respondWithStatusCode(_0xd67c0d,_0x680b4c){_0x680b4c=_0x680b4c||0xcc;return function(_0x4be3e0){if(_0x4be3e0){return _0xd67c0d['sendStatus'](_0x680b4c);}return _0xd67c0d['status'](_0x680b4c)[_0x1245('0x1e')]();};}function respondWithResult(_0x6df04,_0xc63ad2){_0xc63ad2=_0xc63ad2||0xc8;return function(_0x38f648){if(_0x38f648){return _0x6df04[_0x1245('0x1f')](_0xc63ad2)[_0x1245('0x20')](_0x38f648);}};}function respondWithFilteredResult(_0x2b34d1,_0xa1ee7e){return function(_0x49a198){if(_0x49a198){var _0x5b7eed=typeof _0xa1ee7e[_0x1245('0x21')]===_0x1245('0x22')&&typeof _0xa1ee7e[_0x1245('0x23')]==='undefined';var _0x1d8d59=_0x49a198[_0x1245('0x24')];var _0x179a26=_0x5b7eed?0x0:_0xa1ee7e[_0x1245('0x21')];var _0x76112d=_0x5b7eed?_0x49a198['count']:_0xa1ee7e['offset']+_0xa1ee7e['limit'];var _0x519689;if(_0x76112d>=_0x1d8d59){_0x76112d=_0x1d8d59;_0x519689=0xc8;}else{_0x519689=0xce;}_0x2b34d1[_0x1245('0x1f')](_0x519689);return _0x2b34d1[_0x1245('0x25')](_0x1245('0x26'),_0x179a26+'-'+_0x76112d+'/'+_0x1d8d59)['json'](_0x49a198);}return null;};}function patchUpdates(_0x3d56fe){return function(_0x377f53){try{jsonpatch['apply'](_0x377f53,_0x3d56fe,!![]);}catch(_0x12695e){return BPromise['reject'](_0x12695e);}return _0x377f53['save']();};}function saveUpdates(_0x572a8f,_0x590794){return function(_0x2e497b){if(_0x2e497b){return _0x2e497b['update'](_0x572a8f)[_0x1245('0x27')](function(_0x41d12f){return _0x41d12f;});}return null;};}function removeEntity(_0x52c4f6,_0x4724c9){return function(_0x56299e){if(_0x56299e){return _0x56299e['destroy']()[_0x1245('0x27')](function(){_0x52c4f6[_0x1245('0x1f')](0xcc)[_0x1245('0x1e')]();});}};}function handleEntityNotFound(_0x25a339,_0x1e753b){return function(_0x21cb4d){if(!_0x21cb4d){_0x25a339['sendStatus'](0x194);}return _0x21cb4d;};}function handleError(_0x1369ae,_0x477f7f){_0x477f7f=_0x477f7f||0x1f4;return function(_0x16b8d3){logger[_0x1245('0x28')](_0x16b8d3[_0x1245('0x29')]);if(_0x16b8d3[_0x1245('0x2a')]){delete _0x16b8d3[_0x1245('0x2a')];}_0x1369ae[_0x1245('0x1f')](_0x477f7f)[_0x1245('0x2b')](_0x16b8d3);};}function getInteractionUsers(_0x194795,_0x5a3dbc){return new BPromise(function(_0x40ee5e,_0x425a7d){try{if(_0x5a3dbc[_0x194795['id']]){_0x194795[_0x1245('0x2c')]=_[_0x1245('0x2d')](_0x5a3dbc[_0x194795['id']],function(_0x5247c1){return{'id':_0x5247c1['id'],'fullname':_0x5247c1[_0x1245('0x2e')]};});}}catch(_0x51f905){_0x425a7d(_0x51f905);}_0x40ee5e(_0x194795);});}function getInteractionTags(_0x147424,_0x468fd8){return new BPromise(function(_0x23db1c,_0x3f18f3){try{if(_0x147424[_0x1245('0x2f')]){_0x147424[_0x1245('0x30')]=[];_0x147424['TagIds'][_0x1245('0x31')](',')[_0x1245('0x32')](function(_0x435a8b){_0x147424['Tags'][_0x1245('0x33')](_0x468fd8[_0x435a8b]);});}delete _0x147424[_0x1245('0x2f')];}catch(_0x31e5ff){_0x3f18f3(_0x31e5ff);}_0x23db1c(_0x147424);});}function updateSmsInteraction(_0x3a1605,_0x3af9e3,_0x14ff85){return new BPromise(function(_0x420078,_0x373f95){return getInteractionUsers(_0x3a1605,_0x14ff85)[_0x1245('0x27')](function(_0x4fd9c2){return getInteractionTags(_0x4fd9c2,_0x3af9e3);})[_0x1245('0x27')](function(_0x10e7d1){return getStateInteraction(_0x10e7d1);})[_0x1245('0x27')](function(_0xf6e156){_0x420078(_0xf6e156);})['catch'](function(_0xdde181){_0x373f95(_0xdde181);});});}function getStateInteraction(_0x756f3){return new BPromise(function(_0x4a697b){_0x756f3['waiting']=0x0;_0x756f3['talking']=0x0;_0x756f3[_0x1245('0x34')]=0x0;_0x756f3[_0x1245('0x35')]=0x0;_0x756f3[_0x1245('0x36')]=0x0;if(!_0x756f3[_0x1245('0x37')]&&!_0x756f3[_0x1245('0x38')]){_0x756f3['waiting']+=0x1;}if(!_0x756f3[_0x1245('0x37')]&&_0x756f3[_0x1245('0x38')]){_0x756f3['talking']+=0x1;if(_0x756f3[_0x1245('0x39')]){_0x756f3[_0x1245('0x39')]-=0x1;}}if(_0x756f3[_0x1245('0x37')]&&_0x756f3[_0x1245('0x38')]){_0x756f3[_0x1245('0x34')]+=0x1;if(_0x756f3[_0x1245('0x3a')]){_0x756f3[_0x1245('0x3a')]-=0x1;}}if(_0x756f3[_0x1245('0x37')]&&!_0x756f3['UserId']){_0x756f3['unmanaged']+=0x1;if(_0x756f3[_0x1245('0x39')]){_0x756f3[_0x1245('0x39')]-=0x1;}}_0x756f3[_0x1245('0x36')]+=0x1;_0x4a697b(_0x756f3);});}exports[_0x1245('0x3b')]=function(_0x29266a,_0x381a49){var _0x524efc={},_0x1a5160={},_0x184738={'count':0x0,'rows':[]};var _0x21ba00=_[_0x1245('0x2d')](db['SmsInteraction'][_0x1245('0x3c')],function(_0x40ea3f){return{'name':_0x40ea3f[_0x1245('0x3d')],'type':_0x40ea3f[_0x1245('0x3e')][_0x1245('0x3f')]};});_0x1a5160[_0x1245('0x40')]=_['map'](_0x21ba00,_0x1245('0x2a'));_0x1a5160['query']=_[_0x1245('0x41')](_0x29266a[_0x1245('0x42')]);_0x1a5160[_0x1245('0x43')]=_[_0x1245('0x44')](_0x1a5160[_0x1245('0x40')],_0x1a5160[_0x1245('0x42')]);_0x524efc[_0x1245('0x45')]=_[_0x1245('0x44')](_0x1a5160['model'],qs['fields'](_0x29266a['query'][_0x1245('0x46')]));_0x524efc[_0x1245('0x45')]=_0x524efc[_0x1245('0x45')][_0x1245('0x47')]?_0x524efc[_0x1245('0x45')]:_0x1a5160[_0x1245('0x40')];if(!_0x29266a[_0x1245('0x42')][_0x1245('0x48')]('nolimit')){_0x524efc[_0x1245('0x23')]=qs[_0x1245('0x23')](_0x29266a[_0x1245('0x42')][_0x1245('0x23')]);_0x524efc['offset']=qs[_0x1245('0x21')](_0x29266a[_0x1245('0x42')][_0x1245('0x21')]);}_0x524efc['order']=qs[_0x1245('0x49')](_0x29266a[_0x1245('0x42')][_0x1245('0x49')]);_0x524efc[_0x1245('0x4a')]=qs[_0x1245('0x43')](_[_0x1245('0x4b')](_0x29266a['query'],_0x1a5160[_0x1245('0x43')]),_0x21ba00);var _0x1208e0=[];var _0x4afe93=squel[_0x1245('0x4c')]()[_0x1245('0x4d')]('id')[_0x1245('0x4d')](_0x1245('0x2a'))[_0x1245('0x4d')]('color')['from'](_0x1245('0x4e'));var _0x753cef=squel['select']()['field'](_0x1245('0x4f'))['field']('u.fullname')[_0x1245('0x4d')]('ui.SmsInteractionId')[_0x1245('0x50')]('user_has_sms_interactions','ui')[_0x1245('0x51')](_0x1245('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x496049=squel[_0x1245('0x4c')]()[_0x1245('0x50')](_0x1245('0x53'),'i')[_0x1245('0x51')](_0x1245('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1245('0x51')]('users','o','o.id\x20=\x20i.UserId')[_0x1245('0x51')](_0x1245('0x55'),'a',_0x1245('0x56'))[_0x1245('0x51')](_0x1245('0x57'),'me',_0x1245('0x58'))[_0x1245('0x51')]('sms_interaction_has_tags','it',_0x1245('0x59'))[_0x1245('0x51')]('tools_tags','t',_0x1245('0x5a'));var _0x743b0b=squel[_0x1245('0x5b')]();var _0x22bb4a=[];var _0x219e34=squel['expr']();var _0x5a1653;if(_0x29266a['query'][_0x1245('0x5c')]){_0x5a1653=as[_0x1245('0x5d')](_0x29266a[_0x1245('0x42')][_0x1245('0x5c')]);var _0x485faa=_0x5a1653['sqlOperator'];for(var _0x1fba87=0x0;_0x1fba87<_0x5a1653[_0x1245('0x5e')][_0x1245('0x47')];_0x1fba87++){var _0x14502b=_0x5a1653[_0x1245('0x5e')][_0x1fba87];var _0x4c01e9='i';var _0x44258c=_[_0x1245('0x5f')](_0x21ba00,[_0x1245('0x2a'),_0x14502b[_0x1245('0x4d')]]);if(!_0x44258c){switch(_0x14502b[_0x1245('0x4d')]){case _0x1245('0x60'):if(_0x14502b[_0x1245('0x61')]==0x1){_0x496049[_0x1245('0x62')]('`'+_0x14502b['field']+'`\x20=\x200');}else{_0x496049[_0x1245('0x62')]('`'+_0x14502b[_0x1245('0x4d')]+'`\x20>\x200');}break;case'Contact':if(_0x14502b[_0x1245('0x63')]===_0x1245('0x64')){if(_0x14502b[_0x1245('0x61')][_0x1245('0x31')]('\x20')[_0x1245('0x47')]>0x1){_0x743b0b[_0x485faa](_0x1245('0x65'),qs[_0x1245('0x66')](_0x14502b[_0x1245('0x61')]),null);}else{var _0x38bbda='%'+_0x14502b[_0x1245('0x61')]+'%';_0x743b0b[_0x485faa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x38bbda,_0x38bbda,_0x38bbda);}}else{_0x44258c=_['find'](_0x21ba00,[_0x1245('0x2a'),'ContactId']);_0x14502b[_0x1245('0x4d')]='ContactId';_0x5476f4=as[_0x1245('0x67')](_0x4c01e9,_0x44258c[_0x1245('0x3e')],_0x14502b);_0x743b0b[_0x485faa](_0x5476f4[_0x1245('0x68')],_0x5476f4[_0x1245('0x61')]['start'],_0x5476f4[_0x1245('0x61')][_0x1245('0x1e')]);}break;case _0x1245('0x69'):var _0x42a484=_0x14502b[_0x1245('0x61')][_0x1245('0x31')](',')[_0x1245('0x2d')](function(_0x7700c){return Number(_0x7700c);});_0x42a484[_0x1245('0x32')](function(_0x2d7f09){_0x219e34['or'](_0x1245('0x6a'),'%,'+_0x2d7f09+',%');});_0x22bb4a=_['union'](_0x22bb4a,_0x42a484);break;case _0x1245('0x6b'):if(_0x14502b[_0x1245('0x63')]==='$substring'){_0x743b0b[_0x485faa](_0x1245('0x6c'),'%'+_0x14502b[_0x1245('0x61')]+'%',null);}else{_0x44258c=_[_0x1245('0x5f')](_0x21ba00,['name',_0x1245('0x38')]);_0x14502b[_0x1245('0x4d')]=_0x1245('0x38');_0x5476f4=as[_0x1245('0x67')](_0x4c01e9,_0x44258c[_0x1245('0x3e')],_0x14502b);_0x743b0b[_0x485faa](_0x5476f4[_0x1245('0x68')],_0x5476f4[_0x1245('0x61')]['start'],_0x5476f4[_0x1245('0x61')][_0x1245('0x1e')]);}break;case _0x1245('0x6d'):_0x5476f4=as[_0x1245('0x67')]('me',null,_0x14502b);_0x743b0b[_0x485faa](_0x5476f4['text'],_0x5476f4[_0x1245('0x61')][_0x1245('0x6e')],_0x5476f4[_0x1245('0x61')][_0x1245('0x1e')]);break;}}else{var _0x5476f4=as['buildExpression'](_0x4c01e9,_0x44258c['type'],_0x14502b);_0x743b0b[_0x485faa](_0x5476f4[_0x1245('0x68')],_0x5476f4['value'][_0x1245('0x6e')],_0x5476f4[_0x1245('0x61')][_0x1245('0x1e')]);}}}else{var _0xa0900=_(_0x29266a[_0x1245('0x42')])[_0x1245('0x41')]()[_0x1245('0x2d')](function(_0x5e2d21){return _[_0x1245('0x6f')](_0x21ba00,[_0x1245('0x2a'),_0x5e2d21])?_0x5e2d21:undefined;})[_0x1245('0x70')]()['value']();if(!_[_0x1245('0x71')](_0xa0900)){_0xa0900[_0x1245('0x32')](function(_0x2f3bb5){if(_0x2f3bb5==='SmsAccountId'){_0x496049[_0x1245('0x4a')](_0x1245('0x72'),[][_0x1245('0x73')](_0x29266a[_0x1245('0x42')][_0x2f3bb5]));}else if(_0x2f3bb5==='createdAt'){var _0x46196=JSON[_0x1245('0x74')](_0x29266a[_0x1245('0x42')][_0x2f3bb5])['$gte'];var _0x2ab37d=JSON[_0x1245('0x74')](_0x29266a[_0x1245('0x42')][_0x2f3bb5])[_0x1245('0x75')];_0x496049['where'](_0x1245('0x76'),_0x46196,_0x2ab37d);}else{if(_0x29266a[_0x1245('0x42')][_0x2f3bb5]===_0x1245('0x77')){_0x496049[_0x1245('0x4a')]('i.'+_0x2f3bb5+_0x1245('0x78'));}else{_0x496049['where']('i.'+_0x2f3bb5+_0x1245('0x79'),_0x29266a[_0x1245('0x42')][_0x2f3bb5]);}}});}if(_0x29266a[_0x1245('0x42')][_0x1245('0x7a')]){if(_0x29266a[_0x1245('0x42')][_0x1245('0x7a')]==0x1){_0x496049[_0x1245('0x62')](_0x1245('0x7b'));}else{_0x496049[_0x1245('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x29266a[_0x1245('0x42')][_0x1245('0x7c')]){_0x22bb4a=_['isArray'](_0x29266a[_0x1245('0x42')][_0x1245('0x7c')])?_0x29266a['query']['tag']:new Array(_0x29266a[_0x1245('0x42')][_0x1245('0x7c')]);_0x22bb4a[_0x1245('0x32')](function(_0x5b326a){_0x219e34['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5b326a+',%');});}if(_0x29266a[_0x1245('0x42')][_0x1245('0x7d')]){var _0x51723b=_0x29266a[_0x1245('0x42')][_0x1245('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x1245('0x7e')](/'/g,'\x27\x27');if(qs[_0x1245('0x7f')](_0x51723b)){_0x743b0b['or'](_0x1245('0x80'),_0x51723b+'%')['or'](_0x1245('0x81'),_0x51723b+'%');}else{_0x743b0b['or'](_0x1245('0x82'),qs['getFullTextValue'](_0x51723b))['or'](_0x1245('0x83'),_0x51723b+'%');}}}_0x496049['where'](_0x743b0b);_0x496049[_0x1245('0x84')]('i.id');var _0x917928={'type':db[_0x1245('0x85')][_0x1245('0x86')][_0x1245('0x87')],'raw':!![]};var _0x44a170=_0x496049['clone']();_0x44a170[_0x1245('0x4d')](_0x1245('0x88'));_0x44a170[_0x1245('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1245('0x60'));if(_0x524efc[_0x1245('0x89')]){_0x524efc['order']['forEach'](function(_0x358307){var _0xd4c8fa=_0x358307[0x0]===_0x1245('0x8a')?_0x358307[0x0]:'i.'+_0x358307[0x0];_0x496049['order'](_0xd4c8fa,_0x358307[0x1]===_0x1245('0x8b')?![]:!![]);});}if(!_[_0x1245('0x71')](_0x22bb4a)){_0x496049[_0x1245('0x62')](_0x219e34);_0x44a170[_0x1245('0x4a')](_0x1245('0x8c'),_0x22bb4a);}BPromise['resolve']()[_0x1245('0x27')](function(){if(!_0x5a1653){if(_0x29266a[_0x1245('0x42')][_0x1245('0x8d')])return;_0x44a170[_0x1245('0x4a')](_0x1245('0x8e'));_0x496049['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x29266a[_0x1245('0x8f')]['role']!=='agent')return;return _0x29266a[_0x1245('0x8f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x1245('0x27')](function(_0x284cd8){if(_[_0x1245('0x71')](_0x284cd8)){_0x44a170['where']('i.SmsAccountId\x20IS\x20NULL');_0x496049[_0x1245('0x4a')](_0x1245('0x90'));}else{_0x44a170[_0x1245('0x4a')](_0x1245('0x72'),_[_0x1245('0x2d')](_0x284cd8,'id'));_0x496049['where'](_0x1245('0x72'),_[_0x1245('0x2d')](_0x284cd8,'id'));}});})[_0x1245('0x27')](function(){if(_0x29266a[_0x1245('0x8f')][_0x1245('0x91')]===_0x1245('0x92')&&!_0x5a1653&&!_0x29266a[_0x1245('0x42')]['SmsAccountId'])return[];return db[_0x1245('0x93')][_0x1245('0x42')](_0x44a170[_0x1245('0x94')](),_0x917928);})[_0x1245('0x27')](function(_0x3e3bfd){_0x184738[_0x1245('0x24')]=_0x3e3bfd['length'];if(_0x184738[_0x1245('0x24')]===0x0)return[];return db['sequelize']['query'](_0x4afe93[_0x1245('0x94')](),_0x917928)[_0x1245('0x27')](function(_0x38d727){_0x1208e0=_['keyBy'](_0x38d727,'id');_0x917928=_[_0x1245('0x95')](_0x917928,{'model':db[_0x1245('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29266a['query']['fields']){_0x524efc['attributes'][_0x1245('0x32')](function(_0x395823){_0x496049[_0x1245('0x4d')]('i.'+_0x395823);});}else{_0x496049[_0x1245('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1245('0x60'));_0x496049['field']('a.key',_0x1245('0x97'));_0x496049[_0x1245('0x4d')](_0x1245('0x98'),_0x1245('0x99'));_0x496049['field'](_0x1245('0x9a'),_0x1245('0x8a'));_0x496049[_0x1245('0x4d')](_0x1245('0x9b'));_0x496049[_0x1245('0x4d')](_0x1245('0x9c'),_0x1245('0x9d'));_0x496049[_0x1245('0x4d')]('c.lastName',_0x1245('0x9e'));_0x496049[_0x1245('0x4d')](_0x1245('0x9f'),_0x1245('0xa0'));_0x496049[_0x1245('0x4d')](_0x1245('0xa1'),_0x1245('0xa2'));_0x496049[_0x1245('0x4d')](_0x1245('0xa3'),'Contact.mobile');_0x496049[_0x1245('0x4d')](_0x1245('0xa4'),_0x1245('0xa5'));_0x496049[_0x1245('0x4d')]('o.fullname',_0x1245('0xa6'));_0x496049['field'](_0x1245('0xa7'),_0x1245('0xa8'));_0x496049[_0x1245('0x4d')](_0x1245('0xa9'),'TagIds');}if(_0x524efc[_0x1245('0x23')])_0x496049['limit'](_0x524efc['limit']);if(_0x524efc['offset'])_0x496049[_0x1245('0x21')](_0x524efc[_0x1245('0x21')]);return db['sequelize'][_0x1245('0x42')](_0x496049['toString'](),_0x917928);})['then'](function(_0x35c36c){if(_0x35c36c['length']>0x0)_0x753cef[_0x1245('0x4a')](_0x1245('0xaa'),_[_0x1245('0x2d')](_0x35c36c,'id'));return db[_0x1245('0x93')]['query'](_0x753cef[_0x1245('0x94')](),_0x917928)[_0x1245('0x27')](function(_0x3e8156){var _0x5c9cb5=_['groupBy'](_0x3e8156,_0x1245('0xab'));var _0xc3cb2c=[];_0x35c36c[_0x1245('0x32')](function(_0x20cab0){_0xc3cb2c[_0x1245('0x33')](updateSmsInteraction(_0x20cab0,_0x1208e0,_0x5c9cb5));});return BPromise[_0x1245('0xac')](_0xc3cb2c);});});})[_0x1245('0x27')](function(_0x4cc70e){_0x184738['rows']=_0x4cc70e;return _0x184738;})[_0x1245('0x27')](respondWithFilteredResult(_0x381a49,_0x524efc))[_0x1245('0xad')](handleError(_0x381a49,null));};exports[_0x1245('0xae')]=function(_0x9577d0,_0xc0727d){var _0x4d8311={'raw':![],'where':{'id':_0x9577d0[_0x1245('0xaf')]['id']}},_0x4fe929={};_0x4fe929[_0x1245('0x40')]=_['keys'](db[_0x1245('0x96')][_0x1245('0x3c')]);_0x4fe929[_0x1245('0x42')]=_['keys'](_0x9577d0[_0x1245('0x42')]);_0x4fe929[_0x1245('0x43')]=_[_0x1245('0x44')](_0x4fe929[_0x1245('0x40')],_0x4fe929[_0x1245('0x42')]);_0x4d8311[_0x1245('0x45')]=_['intersection'](_0x4fe929[_0x1245('0x40')],qs['fields'](_0x9577d0['query'][_0x1245('0x46')]));_0x4d8311[_0x1245('0x45')]=_0x4d8311[_0x1245('0x45')][_0x1245('0x47')]?_0x4d8311[_0x1245('0x45')]:_0x4fe929['model'];if(_0x9577d0[_0x1245('0x42')][_0x1245('0xb0')]){_0x4d8311[_0x1245('0xb1')]=[{'all':!![]}];}_0x4d8311=_['merge']({},_0x4d8311,_0x9577d0[_0x1245('0xb2')]);return db['SmsInteraction']['find'](_0x4d8311)[_0x1245('0x27')](handleEntityNotFound(_0xc0727d,null))[_0x1245('0x27')](respondWithResult(_0xc0727d,null))[_0x1245('0xad')](handleError(_0xc0727d,null));};exports[_0x1245('0xb3')]=function(_0x378864,_0x4eb29f){return db['SmsInteraction'][_0x1245('0xb3')](_0x378864['body'],{})[_0x1245('0x27')](respondWithResult(_0x4eb29f,0xc9))[_0x1245('0xad')](handleError(_0x4eb29f,null));};exports[_0x1245('0xb4')]=function(_0x53ce22,_0x3b5731){if(_0x53ce22['body']['id']){delete _0x53ce22[_0x1245('0x6d')]['id'];}return db[_0x1245('0x96')][_0x1245('0x5f')]({'where':{'id':_0x53ce22['params']['id']}})[_0x1245('0x27')](handleEntityNotFound(_0x3b5731,null))[_0x1245('0x27')](saveUpdates(_0x53ce22[_0x1245('0x6d')],null))[_0x1245('0x27')](respondWithResult(_0x3b5731,null))[_0x1245('0xad')](handleError(_0x3b5731,null));};exports['destroy']=function(_0x2befe2,_0x492c4e){return db[_0x1245('0x96')][_0x1245('0x5f')]({'where':{'id':_0x2befe2[_0x1245('0xaf')]['id']}})[_0x1245('0x27')](handleEntityNotFound(_0x492c4e,null))['then'](removeEntity(_0x492c4e,null))[_0x1245('0xad')](handleError(_0x492c4e,null));};exports['describe']=function(_0x2afd3a,_0x554f87){return db[_0x1245('0x96')][_0x1245('0xb5')]()['then'](respondWithResult(_0x554f87,null))[_0x1245('0xad')](handleError(_0x554f87,null));};exports[_0x1245('0xb6')]=function(_0x455be9,_0x26eb7e,_0x5457dd){return db[_0x1245('0xb7')]['find']({'where':{'id':_0x455be9[_0x1245('0xaf')]['id']}})['then'](handleEntityNotFound(_0x26eb7e,null))[_0x1245('0x27')](function(_0x32c0a0){if(_0x32c0a0){return _0x32c0a0['addMessage'](_0x455be9['body'][_0x1245('0xb8')],_[_0x1245('0xb9')](_0x455be9[_0x1245('0x6d')],[_0x1245('0xb8'),'id'])||{});}})[_0x1245('0x27')](respondWithResult(_0x26eb7e,null))[_0x1245('0xad')](handleError(_0x26eb7e,null));};exports[_0x1245('0xba')]=function(_0xd2c8ce,_0x178f65,_0x4075a9){var _0x1a9f8b={'raw':![],'where':{}};var _0x42699f={};var _0x2b42d4={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1245('0xbb')]({'where':{'id':_0xd2c8ce[_0x1245('0xaf')]['id']}})[_0x1245('0x27')](handleEntityNotFound(_0x178f65,null))[_0x1245('0x27')](function(_0x568e03){if(_0x568e03){_0x42699f[_0x1245('0x40')]=_[_0x1245('0x41')](db[_0x1245('0xb7')][_0x1245('0x3c')]);_0x42699f[_0x1245('0x42')]=_[_0x1245('0x41')](_0xd2c8ce[_0x1245('0x42')]);_0x42699f[_0x1245('0x43')]=_[_0x1245('0x44')](_0x42699f['model'],_0x42699f[_0x1245('0x42')]);_0x1a9f8b['attributes']=_[_0x1245('0x44')](_0x42699f[_0x1245('0x40')],qs[_0x1245('0x46')](_0xd2c8ce[_0x1245('0x42')][_0x1245('0x46')]));_0x1a9f8b[_0x1245('0x45')]=_0x1a9f8b[_0x1245('0x45')][_0x1245('0x47')]?_0x1a9f8b['attributes']:_0x42699f[_0x1245('0x40')];if(!_0xd2c8ce[_0x1245('0x42')][_0x1245('0x48')](_0x1245('0xbc'))){_0x1a9f8b['limit']=qs[_0x1245('0x23')](_0xd2c8ce[_0x1245('0x42')]['limit']);_0x1a9f8b['offset']=qs[_0x1245('0x21')](_0xd2c8ce[_0x1245('0x42')][_0x1245('0x21')]);}_0x1a9f8b[_0x1245('0x89')]=qs['sort'](_0xd2c8ce[_0x1245('0x42')]['sort']);_0x1a9f8b[_0x1245('0x4a')]=qs['filters'](_[_0x1245('0x4b')](_0xd2c8ce[_0x1245('0x42')],_0x42699f[_0x1245('0x43')]));_0x1a9f8b[_0x1245('0x4a')][_0x1245('0xab')]=_0x568e03['id'];if(_0xd2c8ce['query'][_0x1245('0x7d')]){_0x1a9f8b[_0x1245('0x4a')]=_[_0x1245('0x95')](_0x1a9f8b['where'],{'$or':_[_0x1245('0x2d')](_0x1a9f8b[_0x1245('0x45')],function(_0x15e3de){var _0x2520cb={};_0x2520cb[_0x15e3de]={'$like':'%'+_0xd2c8ce[_0x1245('0x42')][_0x1245('0x7d')]+'%'};return _0x2520cb;})});}if(_0xd2c8ce[_0x1245('0x42')][_0x1245('0xbd')]){var _0x57ef65=_0xd2c8ce[_0x1245('0x42')][_0x1245('0xbd')][_0x1245('0x31')](',');var _0x6944ea={};_0x6944ea[_0x57ef65[0x0]]={'$gte':moment(_0x57ef65[0x1])[_0x1245('0xbe')](_0x1245('0xbf'))};_0x1a9f8b[_0x1245('0x4a')]=_[_0x1245('0x95')](_0x1a9f8b[_0x1245('0x4a')],_0x6944ea);}_0x1a9f8b=_[_0x1245('0x95')]({},_0x1a9f8b,_0xd2c8ce['options']);return db['SmsMessage'][_0x1245('0x24')]({'where':_0x1a9f8b[_0x1245('0x4a')]})[_0x1245('0x27')](function(_0x20fc35){_0x2b42d4[_0x1245('0x24')]=_0x20fc35;if(_0xd2c8ce[_0x1245('0x42')][_0x1245('0xb0')]){_0x1a9f8b['include']=[{'all':!![]}];}return db[_0x1245('0xb7')][_0x1245('0xc0')](_0x1a9f8b);})[_0x1245('0x27')](function(_0x1cd1f7){_0x2b42d4[_0x1245('0xc1')]=_0x1cd1f7;return _0x2b42d4;});}})['then'](respondWithFilteredResult(_0x178f65,_0x1a9f8b))[_0x1245('0xad')](handleError(_0x178f65,null));};exports[_0x1245('0xc2')]=function(_0x4ab3f0,_0x275872,_0x1f8bfc){return db[_0x1245('0x96')][_0x1245('0x5f')]({'where':{'id':_0x4ab3f0[_0x1245('0xaf')]['id']}})[_0x1245('0x27')](handleEntityNotFound(_0x275872,null))[_0x1245('0x27')](function(_0x29e09b){if(_0x29e09b){return _0x29e09b[_0x1245('0xc3')](_0x4ab3f0[_0x1245('0x6d')][_0x1245('0xb8')],_[_0x1245('0xb9')](_0x4ab3f0[_0x1245('0x6d')],[_0x1245('0xb8'),'id'])||{})[_0x1245('0xc4')](function(){return db[_0x1245('0x69')][_0x1245('0xc0')]({'attributes':['id','name','color'],'where':{'id':_0x4ab3f0[_0x1245('0x6d')]['ids']}});})[_0x1245('0x27')](function(_0x3ee316){socket[_0x1245('0xc5')](_0x1245('0xc6'),{'id':Number(_0x4ab3f0[_0x1245('0xaf')]['id']),'tags':_0x3ee316||[]});return{'id':Number(_0x4ab3f0['params']['id']),'tags':_0x3ee316||[]};});}})[_0x1245('0x27')](respondWithResult(_0x275872,null))['catch'](handleError(_0x275872,null));};exports[_0x1245('0xc7')]=function(_0x25d018,_0x12dcea,_0x4dba83){return db['SmsInteraction'][_0x1245('0x5f')]({'where':{'id':_0x25d018[_0x1245('0xaf')]['id']}})[_0x1245('0x27')](handleEntityNotFound(_0x12dcea,null))['then'](function(_0x1d92a9){if(_0x1d92a9){return _0x1d92a9[_0x1245('0xc7')](_0x25d018[_0x1245('0x42')][_0x1245('0xb8')]);}})[_0x1245('0x27')](respondWithStatusCode(_0x12dcea,null))[_0x1245('0xad')](handleError(_0x12dcea,null));};exports[_0x1245('0xc8')]=function(_0x14c117,_0x2d08cc){var _0x16e317=moment()[_0x1245('0xc9')]()[_0x1245('0x94')]();var _0x4be216=path[_0x1245('0xca')](config[_0x1245('0xcb')],_0x1245('0xcc'),_0x1245('0xcd'),_0x1245('0xce'));var _0x19bfa8=path[_0x1245('0xca')](config['root'],_0x1245('0xcc'),'files',_0x1245('0xcf'));var _0x92d156=path['join'](_0x4be216,_0x16e317);var _0x2ed1e9=util['format']('transcript-%d-%s.zip',_0x14c117[_0x1245('0xaf')]['id'],_0x16e317);var _0x592779=path[_0x1245('0xca')](_0x4be216,_0x2ed1e9);var _0x436c01=[];_0x436c01[_0x1245('0x33')]({'model':db[_0x1245('0x6b')],'as':_0x1245('0x6b'),'attributes':['id',_0x1245('0x2e')],'raw':!![]});_0x436c01[_0x1245('0x33')]({'model':db['CmContact'],'as':_0x1245('0xd0'),'attributes':['id','firstName',_0x1245('0xd1')],'raw':!![]});var _0x2ea8fa=[{'model':db[_0x1245('0xb7')],'as':'Messages','attributes':['id',_0x1245('0x6d'),'createdAt',_0x1245('0xd2'),_0x1245('0xd3'),_0x1245('0x7a')],'include':_0x436c01}];_0x2ea8fa[_0x1245('0x33')]({'model':db[_0x1245('0xd4')],'as':_0x1245('0xd5'),'attributes':['id',_0x1245('0x2a')]});_0x2ea8fa[_0x1245('0x33')]({'model':db[_0x1245('0x6b')],'as':_0x1245('0xd6'),'attributes':['id','fullname']});return db[_0x1245('0x96')][_0x1245('0x5f')]({'where':{'id':_0x14c117[_0x1245('0xaf')]['id']},'include':_0x2ea8fa})['then'](handleEntityNotFound(_0x2d08cc,null))[_0x1245('0x27')](function(_0x2393bb){if(_0x2393bb){var _0x3f2fda=_0x2393bb[_0x1245('0xd7')]({'plain':!![]});fs[_0x1245('0xd8')](_0x92d156);var _0x4a05de={'channel':_0x1245('0xd9'),'account':_0x3f2fda[_0x1245('0xd5')]['name'],'agent':_0x3f2fda['Owner']?_0x3f2fda[_0x1245('0xd6')][_0x1245('0x2e')]:_0x1245('0xda'),'createdAt':moment(_0x3f2fda['createdAt'])['format'](_0x1245('0xbf'))[_0x1245('0x94')](),'closedAt':_0x3f2fda[_0x1245('0x37')]?moment(_0x3f2fda[_0x1245('0xdb')])[_0x1245('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1245('0x94')]():'','disposition':_0x3f2fda[_0x1245('0xdc')],'messages':_(_0x3f2fda[_0x1245('0xdd')])['filter']({'secret':![]})['map'](function(_0x5e7581){return{'date':moment(_0x5e7581['createdAt'])[_0x1245('0xbe')](_0x1245('0xbf'))[_0x1245('0x94')](),'sender':_0x5e7581['direction']==='out'?_0x5e7581[_0x1245('0x6b')]?_0x5e7581[_0x1245('0x6b')][_0x1245('0x2e')]:_0x1245('0xde'):_0x5e7581[_0x1245('0xd0')][_0x1245('0xdf')]+(_0x5e7581[_0x1245('0xd0')][_0x1245('0xd1')]?'\x20'+_0x5e7581['Contact']['lastName']:''),'body':_0x5e7581['body'],'direction':_0x5e7581[_0x1245('0xd2')]===_0x1245('0xe0')?'A':'C','secret':_0x5e7581[_0x1245('0xd3')],'read':_0x5e7581['read']};})['value']()};return ejs['renderFile'](path['join'](config['root'],_0x1245('0xcc'),_0x1245('0xe1'),_0x1245('0xe2')),{'interaction':_0x4a05de})[_0x1245('0x27')](function(_0xec4759){var _0x1b8a89=path[_0x1245('0xca')](_0x92d156,_0x1245('0xe3')+_0x3f2fda['id']+'-'+_0x16e317+_0x1245('0xe4'));var _0x1b76b2={'path':_0x1b8a89,'channel':'Sms','interactionId':_0x3f2fda['id']};return pdf['createPdfFromHTML'](_0xec4759,_0x1b76b2);})[_0x1245('0x27')](function(){return new BPromise(function(_0x263a23,_0x4719c7){zipdir(_0x92d156,{'saveTo':_0x592779},function(_0x86637e,_0x594f78){if(_0x86637e)return _0x4719c7(_0x86637e);return _0x263a23(_0x594f78);});})['then'](function(){return new BPromise(function(_0x15599e,_0x3eb046){rimraf(_0x92d156,function(_0x2f1c79){if(_0x2f1c79)_0x3eb046(_0x2f1c79);return _0x15599e();});});})[_0x1245('0x27')](function(){return _0x2d08cc[_0x1245('0xc8')](_0x592779,_0x2ed1e9,function(_0x1e5357){if(_0x1e5357){console[_0x1245('0xe5')]('err',_0x1e5357);}else{fs[_0x1245('0xe6')](_0x592779);}});});});}else{return _0x2d08cc[_0x1245('0xe7')](0xc8);}})[_0x1245('0xad')](handleError(_0x2d08cc,null));}; \ No newline at end of file +var _0xb156=['closed','UserId','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','rows','show','params','keys','includeAll','include','options','catch','create','describe','addMessage','ids','omit','findOne','SmsMessage','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','color','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','direction','System','lastName','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','Users','map','fullname','TagIds','forEach','Tags','waiting','talking','answered','unmanaged','total'];(function(_0x25b3c9,_0x37360d){var _0x337313=function(_0x4bf723){while(--_0x4bf723){_0x25b3c9['push'](_0x25b3c9['shift']());}};_0x337313(++_0x37360d);}(_0xb156,0x1a7));var _0x6b15=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0xb156[_0x233716];return _0x302298;};'use strict';var emlformat=require(_0x6b15('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b15('0x1'));var moment=require('moment');var BPromise=require(_0x6b15('0x2'));var Mustache=require('mustache');var util=require(_0x6b15('0x3'));var path=require(_0x6b15('0x4'));var sox=require(_0x6b15('0x5'));var csv=require(_0x6b15('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b15('0x7'));var _=require(_0x6b15('0x8'));var squel=require('squel');var crypto=require(_0x6b15('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6b15('0xa'));var toCsv=require(_0x6b15('0x6'));var querystring=require(_0x6b15('0xb'));var Papa=require(_0x6b15('0xc'));var Redis=require(_0x6b15('0xd'));var authService=require(_0x6b15('0xe'));var qs=require(_0x6b15('0xf'));var as=require(_0x6b15('0x10'));var pdf=require(_0x6b15('0x11'));var hardwareService=require(_0x6b15('0x12'));var logger=require(_0x6b15('0x13'))(_0x6b15('0x14'));var utils=require(_0x6b15('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b15('0x16'));var db=require('../../mysqldb')['db'];config[_0x6b15('0x17')]=_[_0x6b15('0x18')](config[_0x6b15('0x17')],{'host':_0x6b15('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b15('0x17')]));require(_0x6b15('0x1a'))[_0x6b15('0x1b')](socket);function respondWithStatusCode(_0x3fd863,_0x3bb635){_0x3bb635=_0x3bb635||0xcc;return function(_0x27deec){if(_0x27deec){return _0x3fd863[_0x6b15('0x1c')](_0x3bb635);}return _0x3fd863[_0x6b15('0x1d')](_0x3bb635)[_0x6b15('0x1e')]();};}function respondWithResult(_0x46b5f8,_0x36b2d6){_0x36b2d6=_0x36b2d6||0xc8;return function(_0x495338){if(_0x495338){return _0x46b5f8[_0x6b15('0x1d')](_0x36b2d6)[_0x6b15('0x1f')](_0x495338);}};}function respondWithFilteredResult(_0x23ece2,_0x14ddac){return function(_0x1449b2){if(_0x1449b2){var _0x32cc65=typeof _0x14ddac[_0x6b15('0x20')]===_0x6b15('0x21')&&typeof _0x14ddac[_0x6b15('0x22')]===_0x6b15('0x21');var _0x2d2434=_0x1449b2[_0x6b15('0x23')];var _0x115de3=_0x32cc65?0x0:_0x14ddac[_0x6b15('0x20')];var _0x237aa8=_0x32cc65?_0x1449b2['count']:_0x14ddac[_0x6b15('0x20')]+_0x14ddac[_0x6b15('0x22')];var _0x38b6a4;if(_0x237aa8>=_0x2d2434){_0x237aa8=_0x2d2434;_0x38b6a4=0xc8;}else{_0x38b6a4=0xce;}_0x23ece2['status'](_0x38b6a4);return _0x23ece2[_0x6b15('0x24')](_0x6b15('0x25'),_0x115de3+'-'+_0x237aa8+'/'+_0x2d2434)[_0x6b15('0x1f')](_0x1449b2);}return null;};}function patchUpdates(_0x1a6734){return function(_0x3e14e7){try{jsonpatch[_0x6b15('0x26')](_0x3e14e7,_0x1a6734,!![]);}catch(_0x85c2c2){return BPromise[_0x6b15('0x27')](_0x85c2c2);}return _0x3e14e7[_0x6b15('0x28')]();};}function saveUpdates(_0x3366fe,_0x4c4856){return function(_0x5be64b){if(_0x5be64b){return _0x5be64b[_0x6b15('0x29')](_0x3366fe)['then'](function(_0x143043){return _0x143043;});}return null;};}function removeEntity(_0x1872d8,_0x8eefec){return function(_0x58eeb6){if(_0x58eeb6){return _0x58eeb6[_0x6b15('0x2a')]()[_0x6b15('0x2b')](function(){_0x1872d8[_0x6b15('0x1d')](0xcc)[_0x6b15('0x1e')]();});}};}function handleEntityNotFound(_0x4cf311,_0x27c80d){return function(_0x560d48){if(!_0x560d48){_0x4cf311[_0x6b15('0x1c')](0x194);}return _0x560d48;};}function handleError(_0x5917fe,_0x4bde6c){_0x4bde6c=_0x4bde6c||0x1f4;return function(_0x269250){logger['error'](_0x269250[_0x6b15('0x2c')]);if(_0x269250[_0x6b15('0x2d')]){delete _0x269250[_0x6b15('0x2d')];}_0x5917fe[_0x6b15('0x1d')](_0x4bde6c)['send'](_0x269250);};}function getInteractionUsers(_0x31cf93,_0x2bb074){return new BPromise(function(_0x4afeec,_0x4d5c84){try{if(_0x2bb074[_0x31cf93['id']]){_0x31cf93[_0x6b15('0x2e')]=_[_0x6b15('0x2f')](_0x2bb074[_0x31cf93['id']],function(_0x2978f0){return{'id':_0x2978f0['id'],'fullname':_0x2978f0[_0x6b15('0x30')]};});}}catch(_0x1478ad){_0x4d5c84(_0x1478ad);}_0x4afeec(_0x31cf93);});}function getInteractionTags(_0x265d6b,_0x43ff0a){return new BPromise(function(_0x3b1a4a,_0x59fccb){try{if(_0x265d6b['TagIds']){_0x265d6b['Tags']=[];_0x265d6b[_0x6b15('0x31')]['split'](',')[_0x6b15('0x32')](function(_0x48095d){_0x265d6b[_0x6b15('0x33')]['push'](_0x43ff0a[_0x48095d]);});}delete _0x265d6b[_0x6b15('0x31')];}catch(_0x31ef67){_0x59fccb(_0x31ef67);}_0x3b1a4a(_0x265d6b);});}function updateSmsInteraction(_0x56dab8,_0x2fb1c8,_0x1a583d){return new BPromise(function(_0x20df21,_0x23025c){return getInteractionUsers(_0x56dab8,_0x1a583d)['then'](function(_0xf4ff61){return getInteractionTags(_0xf4ff61,_0x2fb1c8);})[_0x6b15('0x2b')](function(_0x10c798){return getStateInteraction(_0x10c798);})[_0x6b15('0x2b')](function(_0x535a7d){_0x20df21(_0x535a7d);})['catch'](function(_0xddbf3f){_0x23025c(_0xddbf3f);});});}function getStateInteraction(_0x116978){return new BPromise(function(_0x7a1ada){_0x116978[_0x6b15('0x34')]=0x0;_0x116978[_0x6b15('0x35')]=0x0;_0x116978[_0x6b15('0x36')]=0x0;_0x116978[_0x6b15('0x37')]=0x0;_0x116978[_0x6b15('0x38')]=0x0;if(!_0x116978[_0x6b15('0x39')]&&!_0x116978[_0x6b15('0x3a')]){_0x116978[_0x6b15('0x34')]+=0x1;}if(!_0x116978['closed']&&_0x116978['UserId']){_0x116978[_0x6b15('0x35')]+=0x1;if(_0x116978[_0x6b15('0x34')]){_0x116978[_0x6b15('0x34')]-=0x1;}}if(_0x116978[_0x6b15('0x39')]&&_0x116978['UserId']){_0x116978[_0x6b15('0x36')]+=0x1;if(_0x116978[_0x6b15('0x35')]){_0x116978[_0x6b15('0x35')]-=0x1;}}if(_0x116978['closed']&&!_0x116978[_0x6b15('0x3a')]){_0x116978[_0x6b15('0x37')]+=0x1;if(_0x116978['waiting']){_0x116978[_0x6b15('0x34')]-=0x1;}}_0x116978[_0x6b15('0x38')]+=0x1;_0x7a1ada(_0x116978);});}exports[_0x6b15('0x3b')]=function(_0x4084ec,_0x5f2dfa){var _0x1e4cf5={},_0x16f563={},_0x9b203a={'count':0x0,'rows':[]};var _0x4bef0a=_[_0x6b15('0x2f')](db['SmsInteraction']['rawAttributes'],function(_0x405ce2){return{'name':_0x405ce2[_0x6b15('0x3c')],'type':_0x405ce2[_0x6b15('0x3d')][_0x6b15('0x3e')]};});_0x16f563[_0x6b15('0x3f')]=_['map'](_0x4bef0a,'name');_0x16f563[_0x6b15('0x40')]=_['keys'](_0x4084ec[_0x6b15('0x40')]);_0x16f563[_0x6b15('0x41')]=_[_0x6b15('0x42')](_0x16f563[_0x6b15('0x3f')],_0x16f563['query']);_0x1e4cf5[_0x6b15('0x43')]=_[_0x6b15('0x42')](_0x16f563['model'],qs[_0x6b15('0x44')](_0x4084ec[_0x6b15('0x40')][_0x6b15('0x44')]));_0x1e4cf5[_0x6b15('0x43')]=_0x1e4cf5[_0x6b15('0x43')][_0x6b15('0x45')]?_0x1e4cf5[_0x6b15('0x43')]:_0x16f563[_0x6b15('0x3f')];if(!_0x4084ec[_0x6b15('0x40')][_0x6b15('0x46')](_0x6b15('0x47'))){_0x1e4cf5['limit']=qs[_0x6b15('0x22')](_0x4084ec[_0x6b15('0x40')][_0x6b15('0x22')]);_0x1e4cf5[_0x6b15('0x20')]=qs[_0x6b15('0x20')](_0x4084ec[_0x6b15('0x40')]['offset']);}_0x1e4cf5[_0x6b15('0x48')]=qs[_0x6b15('0x49')](_0x4084ec[_0x6b15('0x40')][_0x6b15('0x49')]);_0x1e4cf5[_0x6b15('0x4a')]=qs['filters'](_[_0x6b15('0x4b')](_0x4084ec[_0x6b15('0x40')],_0x16f563[_0x6b15('0x41')]),_0x4bef0a);var _0x48cef0=[];var _0x27ed03=squel['select']()[_0x6b15('0x4c')]('id')[_0x6b15('0x4c')]('name')[_0x6b15('0x4c')]('color')[_0x6b15('0x4d')](_0x6b15('0x4e'));var _0x3a1a7c=squel[_0x6b15('0x4f')]()[_0x6b15('0x4c')](_0x6b15('0x50'))['field'](_0x6b15('0x51'))[_0x6b15('0x4c')](_0x6b15('0x52'))[_0x6b15('0x4d')](_0x6b15('0x53'),'ui')[_0x6b15('0x54')](_0x6b15('0x55'),'u',_0x6b15('0x56'));var _0x112e2e=squel[_0x6b15('0x4f')]()[_0x6b15('0x4d')]('sms_interactions','i')[_0x6b15('0x54')](_0x6b15('0x57'),'c',_0x6b15('0x58'))[_0x6b15('0x54')](_0x6b15('0x55'),'o',_0x6b15('0x59'))[_0x6b15('0x54')](_0x6b15('0x5a'),'a',_0x6b15('0x5b'))[_0x6b15('0x54')]('sms_messages','me',_0x6b15('0x5c'))[_0x6b15('0x54')](_0x6b15('0x5d'),'it',_0x6b15('0x5e'))[_0x6b15('0x54')](_0x6b15('0x4e'),'t',_0x6b15('0x5f'));var _0x125421=squel[_0x6b15('0x60')]();var _0xb25b2=[];var _0x112fe1=squel[_0x6b15('0x60')]();var _0x177bf3;if(_0x4084ec[_0x6b15('0x40')][_0x6b15('0x61')]){_0x177bf3=as[_0x6b15('0x62')](_0x4084ec['query']['search']);var _0x14f6de=_0x177bf3[_0x6b15('0x63')];for(var _0x58f586=0x0;_0x58f586<_0x177bf3['conditions'][_0x6b15('0x45')];_0x58f586++){var _0x195690=_0x177bf3[_0x6b15('0x64')][_0x58f586];var _0x32f18d='i';var _0x40c457=_[_0x6b15('0x65')](_0x4bef0a,[_0x6b15('0x2d'),_0x195690['field']]);if(!_0x40c457){switch(_0x195690[_0x6b15('0x4c')]){case _0x6b15('0x66'):if(_0x195690[_0x6b15('0x67')]==0x1){_0x112e2e[_0x6b15('0x68')]('`'+_0x195690['field']+_0x6b15('0x69'));}else{_0x112e2e[_0x6b15('0x68')]('`'+_0x195690['field']+_0x6b15('0x6a'));}break;case _0x6b15('0x6b'):if(_0x195690[_0x6b15('0x6c')]===_0x6b15('0x6d')){if(_0x195690['value'][_0x6b15('0x6e')]('\x20')[_0x6b15('0x45')]>0x1){_0x125421[_0x14f6de](_0x6b15('0x6f'),qs['getFullTextValue'](_0x195690[_0x6b15('0x67')]),null);}else{var _0x4fe3f7='%'+_0x195690[_0x6b15('0x67')]+'%';_0x125421[_0x14f6de](_0x6b15('0x70'),_0x4fe3f7,_0x4fe3f7,_0x4fe3f7);}}else{_0x40c457=_[_0x6b15('0x65')](_0x4bef0a,[_0x6b15('0x2d'),_0x6b15('0x71')]);_0x195690[_0x6b15('0x4c')]=_0x6b15('0x71');_0x70f3b8=as['buildExpression'](_0x32f18d,_0x40c457[_0x6b15('0x3d')],_0x195690);_0x125421[_0x14f6de](_0x70f3b8['text'],_0x70f3b8[_0x6b15('0x67')][_0x6b15('0x72')],_0x70f3b8[_0x6b15('0x67')][_0x6b15('0x1e')]);}break;case _0x6b15('0x73'):var _0x2410ba=_0x195690['value'][_0x6b15('0x6e')](',')[_0x6b15('0x2f')](function(_0x224744){return Number(_0x224744);});_0x2410ba[_0x6b15('0x32')](function(_0x290dde){_0x112fe1['or'](_0x6b15('0x74'),'%,'+_0x290dde+',%');});_0xb25b2=_['union'](_0xb25b2,_0x2410ba);break;case _0x6b15('0x75'):if(_0x195690[_0x6b15('0x6c')]===_0x6b15('0x6d')){_0x125421[_0x14f6de](_0x6b15('0x76'),'%'+_0x195690['value']+'%',null);}else{_0x40c457=_[_0x6b15('0x65')](_0x4bef0a,[_0x6b15('0x2d'),_0x6b15('0x3a')]);_0x195690['field']=_0x6b15('0x3a');_0x70f3b8=as[_0x6b15('0x77')](_0x32f18d,_0x40c457['type'],_0x195690);_0x125421[_0x14f6de](_0x70f3b8[_0x6b15('0x78')],_0x70f3b8[_0x6b15('0x67')]['start'],_0x70f3b8['value'][_0x6b15('0x1e')]);}break;case _0x6b15('0x79'):_0x70f3b8=as[_0x6b15('0x77')]('me',null,_0x195690);_0x125421[_0x14f6de](_0x70f3b8[_0x6b15('0x78')],_0x70f3b8['value']['start'],_0x70f3b8[_0x6b15('0x67')][_0x6b15('0x1e')]);break;}}else{var _0x70f3b8=as[_0x6b15('0x77')](_0x32f18d,_0x40c457['type'],_0x195690);_0x125421[_0x14f6de](_0x70f3b8[_0x6b15('0x78')],_0x70f3b8[_0x6b15('0x67')]['start'],_0x70f3b8[_0x6b15('0x67')][_0x6b15('0x1e')]);}}}else{var _0x14b752=_(_0x4084ec[_0x6b15('0x40')])['keys']()[_0x6b15('0x2f')](function(_0x5c3d0f){return _['some'](_0x4bef0a,[_0x6b15('0x2d'),_0x5c3d0f])?_0x5c3d0f:undefined;})['compact']()[_0x6b15('0x67')]();if(!_[_0x6b15('0x7a')](_0x14b752)){_0x14b752[_0x6b15('0x32')](function(_0x427239){if(_0x427239===_0x6b15('0x7b')){_0x112e2e['where'](_0x6b15('0x7c'),[]['concat'](_0x4084ec['query'][_0x427239]));}else if(_0x427239===_0x6b15('0x7d')){var _0x34f86d=JSON[_0x6b15('0x7e')](_0x4084ec[_0x6b15('0x40')][_0x427239])[_0x6b15('0x7f')];var _0x55ec68=JSON[_0x6b15('0x7e')](_0x4084ec['query'][_0x427239])[_0x6b15('0x80')];_0x112e2e[_0x6b15('0x4a')](_0x6b15('0x81'),_0x34f86d,_0x55ec68);}else{if(_0x4084ec[_0x6b15('0x40')][_0x427239]==='null'){_0x112e2e['where']('i.'+_0x427239+_0x6b15('0x82'));}else{_0x112e2e['where']('i.'+_0x427239+'\x20=\x20?',_0x4084ec[_0x6b15('0x40')][_0x427239]);}}});}if(_0x4084ec[_0x6b15('0x40')][_0x6b15('0x83')]){if(_0x4084ec['query'][_0x6b15('0x83')]==0x1){_0x112e2e['having'](_0x6b15('0x84'));}else{_0x112e2e[_0x6b15('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x4084ec[_0x6b15('0x40')][_0x6b15('0x85')]){_0xb25b2=_[_0x6b15('0x86')](_0x4084ec['query'][_0x6b15('0x85')])?_0x4084ec[_0x6b15('0x40')]['tag']:new Array(_0x4084ec['query'][_0x6b15('0x85')]);_0xb25b2[_0x6b15('0x32')](function(_0x2e4605){_0x112fe1['or'](_0x6b15('0x74'),'%,'+_0x2e4605+',%');});}if(_0x4084ec['query'][_0x6b15('0x87')]){var _0x2d7aad=_0x4084ec[_0x6b15('0x40')][_0x6b15('0x87')][_0x6b15('0x88')]('\x5c','\x5c\x5c')[_0x6b15('0x88')](/'/g,'\x27\x27');if(qs[_0x6b15('0x89')](_0x2d7aad)){_0x125421['or'](_0x6b15('0x8a'),_0x2d7aad+'%')['or'](_0x6b15('0x8b'),_0x2d7aad+'%');}else{_0x125421['or'](_0x6b15('0x8c'),qs[_0x6b15('0x8d')](_0x2d7aad))['or'](_0x6b15('0x8e'),_0x2d7aad+'%');}}}_0x112e2e[_0x6b15('0x4a')](_0x125421);_0x112e2e[_0x6b15('0x8f')](_0x6b15('0x90'));var _0x3973ab={'type':db[_0x6b15('0x91')][_0x6b15('0x92')][_0x6b15('0x93')],'raw':!![]};var _0x2a8423=_0x112e2e['clone']();_0x2a8423[_0x6b15('0x4c')](_0x6b15('0x90'));_0x2a8423[_0x6b15('0x4c')](_0x6b15('0x94'),'unreadMessages');if(_0x1e4cf5[_0x6b15('0x48')]){_0x1e4cf5[_0x6b15('0x48')][_0x6b15('0x32')](function(_0x453f1a){var _0x58c6ee=_0x453f1a[0x0]==='contactName'?_0x453f1a[0x0]:'i.'+_0x453f1a[0x0];_0x112e2e[_0x6b15('0x48')](_0x58c6ee,_0x453f1a[0x1]===_0x6b15('0x95')?![]:!![]);});}if(!_[_0x6b15('0x7a')](_0xb25b2)){_0x112e2e[_0x6b15('0x68')](_0x112fe1);_0x2a8423['where'](_0x6b15('0x96'),_0xb25b2);}BPromise[_0x6b15('0x97')]()[_0x6b15('0x2b')](function(){if(!_0x177bf3){if(_0x4084ec[_0x6b15('0x40')][_0x6b15('0x7b')])return;_0x2a8423[_0x6b15('0x4a')](_0x6b15('0x98'));_0x112e2e[_0x6b15('0x4a')](_0x6b15('0x98'));return;}if(_0x4084ec[_0x6b15('0x99')][_0x6b15('0x9a')]!==_0x6b15('0x9b'))return;return _0x4084ec[_0x6b15('0x99')][_0x6b15('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x36128b){if(_[_0x6b15('0x7a')](_0x36128b)){_0x2a8423['where']('i.SmsAccountId\x20IS\x20NULL');_0x112e2e[_0x6b15('0x4a')](_0x6b15('0x9d'));}else{_0x2a8423[_0x6b15('0x4a')](_0x6b15('0x7c'),_[_0x6b15('0x2f')](_0x36128b,'id'));_0x112e2e[_0x6b15('0x4a')](_0x6b15('0x7c'),_[_0x6b15('0x2f')](_0x36128b,'id'));}});})[_0x6b15('0x2b')](function(){if(_0x4084ec[_0x6b15('0x99')]['role']===_0x6b15('0x9b')&&!_0x177bf3&&!_0x4084ec['query'][_0x6b15('0x7b')])return[];return db[_0x6b15('0x9e')]['query'](_0x2a8423[_0x6b15('0x9f')](),_0x3973ab);})[_0x6b15('0x2b')](function(_0x1c5357){_0x9b203a['count']=_0x1c5357[_0x6b15('0x45')];if(_0x9b203a['count']===0x0)return[];return db[_0x6b15('0x9e')]['query'](_0x27ed03[_0x6b15('0x9f')](),_0x3973ab)[_0x6b15('0x2b')](function(_0xf8939c){_0x48cef0=_[_0x6b15('0xa0')](_0xf8939c,'id');_0x3973ab=_[_0x6b15('0xa1')](_0x3973ab,{'model':db[_0x6b15('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4084ec[_0x6b15('0x40')][_0x6b15('0x44')]){_0x1e4cf5['attributes'][_0x6b15('0x32')](function(_0x17cd4e){_0x112e2e['field']('i.'+_0x17cd4e);});}else{_0x112e2e[_0x6b15('0x4c')](_0x6b15('0x94'),_0x6b15('0x66'));_0x112e2e[_0x6b15('0x4c')](_0x6b15('0xa3'),'Account.key');_0x112e2e['field'](_0x6b15('0xa4'),_0x6b15('0xa5'));_0x112e2e[_0x6b15('0x4c')](_0x6b15('0xa6'),_0x6b15('0xa7'));_0x112e2e['field'](_0x6b15('0xa8'));_0x112e2e['field'](_0x6b15('0xa9'),_0x6b15('0xaa'));_0x112e2e[_0x6b15('0x4c')]('c.lastName','Contact.lastName');_0x112e2e[_0x6b15('0x4c')](_0x6b15('0xab'),_0x6b15('0xac'));_0x112e2e['field']('c.phone',_0x6b15('0xad'));_0x112e2e[_0x6b15('0x4c')](_0x6b15('0xae'),'Contact.mobile');_0x112e2e[_0x6b15('0x4c')]('c.fax',_0x6b15('0xaf'));_0x112e2e['field']('o.fullname',_0x6b15('0xb0'));_0x112e2e[_0x6b15('0x4c')](_0x6b15('0xb1'),'Owner.internal');_0x112e2e['field'](_0x6b15('0xb2'),_0x6b15('0x31'));}if(_0x1e4cf5[_0x6b15('0x22')])_0x112e2e[_0x6b15('0x22')](_0x1e4cf5['limit']);if(_0x1e4cf5[_0x6b15('0x20')])_0x112e2e[_0x6b15('0x20')](_0x1e4cf5[_0x6b15('0x20')]);return db[_0x6b15('0x9e')]['query'](_0x112e2e[_0x6b15('0x9f')](),_0x3973ab);})['then'](function(_0x5c507e){if(_0x5c507e[_0x6b15('0x45')]>0x0)_0x3a1a7c[_0x6b15('0x4a')](_0x6b15('0xb3'),_[_0x6b15('0x2f')](_0x5c507e,'id'));return db[_0x6b15('0x9e')][_0x6b15('0x40')](_0x3a1a7c[_0x6b15('0x9f')](),_0x3973ab)[_0x6b15('0x2b')](function(_0x5c2b1c){var _0x55ab84=_['groupBy'](_0x5c2b1c,_0x6b15('0xb4'));var _0x15e042=[];_0x5c507e[_0x6b15('0x32')](function(_0xe70882){_0x15e042[_0x6b15('0xb5')](updateSmsInteraction(_0xe70882,_0x48cef0,_0x55ab84));});return BPromise[_0x6b15('0xb6')](_0x15e042);});});})[_0x6b15('0x2b')](function(_0x450424){_0x9b203a[_0x6b15('0xb7')]=_0x450424;return _0x9b203a;})['then'](respondWithFilteredResult(_0x5f2dfa,_0x1e4cf5))['catch'](handleError(_0x5f2dfa,null));};exports[_0x6b15('0xb8')]=function(_0x3e86c2,_0x25407f){var _0x115f45={'raw':![],'where':{'id':_0x3e86c2[_0x6b15('0xb9')]['id']}},_0x376278={};_0x376278['model']=_[_0x6b15('0xba')](db[_0x6b15('0xa2')]['rawAttributes']);_0x376278[_0x6b15('0x40')]=_['keys'](_0x3e86c2['query']);_0x376278[_0x6b15('0x41')]=_['intersection'](_0x376278[_0x6b15('0x3f')],_0x376278['query']);_0x115f45[_0x6b15('0x43')]=_[_0x6b15('0x42')](_0x376278[_0x6b15('0x3f')],qs[_0x6b15('0x44')](_0x3e86c2[_0x6b15('0x40')][_0x6b15('0x44')]));_0x115f45['attributes']=_0x115f45[_0x6b15('0x43')][_0x6b15('0x45')]?_0x115f45[_0x6b15('0x43')]:_0x376278[_0x6b15('0x3f')];if(_0x3e86c2[_0x6b15('0x40')][_0x6b15('0xbb')]){_0x115f45[_0x6b15('0xbc')]=[{'all':!![]}];}_0x115f45=_[_0x6b15('0xa1')]({},_0x115f45,_0x3e86c2[_0x6b15('0xbd')]);return db['SmsInteraction'][_0x6b15('0x65')](_0x115f45)[_0x6b15('0x2b')](handleEntityNotFound(_0x25407f,null))['then'](respondWithResult(_0x25407f,null))[_0x6b15('0xbe')](handleError(_0x25407f,null));};exports[_0x6b15('0xbf')]=function(_0xfa7cb2,_0x297ff2){return db[_0x6b15('0xa2')]['create'](_0xfa7cb2[_0x6b15('0x79')],{})[_0x6b15('0x2b')](respondWithResult(_0x297ff2,0xc9))[_0x6b15('0xbe')](handleError(_0x297ff2,null));};exports[_0x6b15('0x29')]=function(_0x13a380,_0x4dd421){if(_0x13a380[_0x6b15('0x79')]['id']){delete _0x13a380[_0x6b15('0x79')]['id'];}return db[_0x6b15('0xa2')][_0x6b15('0x65')]({'where':{'id':_0x13a380[_0x6b15('0xb9')]['id']}})[_0x6b15('0x2b')](handleEntityNotFound(_0x4dd421,null))[_0x6b15('0x2b')](saveUpdates(_0x13a380['body'],null))[_0x6b15('0x2b')](respondWithResult(_0x4dd421,null))[_0x6b15('0xbe')](handleError(_0x4dd421,null));};exports[_0x6b15('0x2a')]=function(_0x51e3a2,_0x1a65fd){return db[_0x6b15('0xa2')][_0x6b15('0x65')]({'where':{'id':_0x51e3a2[_0x6b15('0xb9')]['id']}})[_0x6b15('0x2b')](handleEntityNotFound(_0x1a65fd,null))[_0x6b15('0x2b')](removeEntity(_0x1a65fd,null))[_0x6b15('0xbe')](handleError(_0x1a65fd,null));};exports[_0x6b15('0xc0')]=function(_0xdb1e52,_0xb941f6){return db['SmsInteraction'][_0x6b15('0xc0')]()[_0x6b15('0x2b')](respondWithResult(_0xb941f6,null))[_0x6b15('0xbe')](handleError(_0xb941f6,null));};exports[_0x6b15('0xc1')]=function(_0x3361cc,_0x9f80ba,_0x397aa8){return db['SmsMessage'][_0x6b15('0x65')]({'where':{'id':_0x3361cc['params']['id']}})[_0x6b15('0x2b')](handleEntityNotFound(_0x9f80ba,null))[_0x6b15('0x2b')](function(_0x5c1412){if(_0x5c1412){return _0x5c1412[_0x6b15('0xc1')](_0x3361cc[_0x6b15('0x79')][_0x6b15('0xc2')],_[_0x6b15('0xc3')](_0x3361cc['body'],[_0x6b15('0xc2'),'id'])||{});}})[_0x6b15('0x2b')](respondWithResult(_0x9f80ba,null))['catch'](handleError(_0x9f80ba,null));};exports['getMessages']=function(_0x1c896d,_0x516225,_0x3af6c0){var _0x4b7b1b={'raw':![],'where':{}};var _0x1a9a31={};var _0xbdf4ba={'count':0x0,'rows':[]};return db[_0x6b15('0xa2')][_0x6b15('0xc4')]({'where':{'id':_0x1c896d[_0x6b15('0xb9')]['id']}})['then'](handleEntityNotFound(_0x516225,null))[_0x6b15('0x2b')](function(_0x41c3a){if(_0x41c3a){_0x1a9a31[_0x6b15('0x3f')]=_[_0x6b15('0xba')](db[_0x6b15('0xc5')][_0x6b15('0xc6')]);_0x1a9a31[_0x6b15('0x40')]=_[_0x6b15('0xba')](_0x1c896d['query']);_0x1a9a31['filters']=_[_0x6b15('0x42')](_0x1a9a31[_0x6b15('0x3f')],_0x1a9a31[_0x6b15('0x40')]);_0x4b7b1b[_0x6b15('0x43')]=_[_0x6b15('0x42')](_0x1a9a31[_0x6b15('0x3f')],qs[_0x6b15('0x44')](_0x1c896d[_0x6b15('0x40')][_0x6b15('0x44')]));_0x4b7b1b[_0x6b15('0x43')]=_0x4b7b1b[_0x6b15('0x43')][_0x6b15('0x45')]?_0x4b7b1b[_0x6b15('0x43')]:_0x1a9a31[_0x6b15('0x3f')];if(!_0x1c896d[_0x6b15('0x40')][_0x6b15('0x46')](_0x6b15('0x47'))){_0x4b7b1b[_0x6b15('0x22')]=qs[_0x6b15('0x22')](_0x1c896d[_0x6b15('0x40')][_0x6b15('0x22')]);_0x4b7b1b['offset']=qs[_0x6b15('0x20')](_0x1c896d['query'][_0x6b15('0x20')]);}_0x4b7b1b['order']=qs[_0x6b15('0x49')](_0x1c896d[_0x6b15('0x40')][_0x6b15('0x49')]);_0x4b7b1b[_0x6b15('0x4a')]=qs[_0x6b15('0x41')](_[_0x6b15('0x4b')](_0x1c896d['query'],_0x1a9a31[_0x6b15('0x41')]));_0x4b7b1b[_0x6b15('0x4a')][_0x6b15('0xb4')]=_0x41c3a['id'];if(_0x1c896d[_0x6b15('0x40')][_0x6b15('0x87')]){_0x4b7b1b[_0x6b15('0x4a')]=_[_0x6b15('0xa1')](_0x4b7b1b[_0x6b15('0x4a')],{'$or':_[_0x6b15('0x2f')](_0x4b7b1b[_0x6b15('0x43')],function(_0x41303e){var _0xa1a28={};_0xa1a28[_0x41303e]={'$like':'%'+_0x1c896d['query'][_0x6b15('0x87')]+'%'};return _0xa1a28;})});}if(_0x1c896d[_0x6b15('0x40')][_0x6b15('0x7f')]){var _0x31ad1b=_0x1c896d[_0x6b15('0x40')][_0x6b15('0x7f')][_0x6b15('0x6e')](',');var _0x300110={};_0x300110[_0x31ad1b[0x0]]={'$gte':moment(_0x31ad1b[0x1])[_0x6b15('0xc7')](_0x6b15('0xc8'))};_0x4b7b1b['where']=_[_0x6b15('0xa1')](_0x4b7b1b['where'],_0x300110);}_0x4b7b1b=_[_0x6b15('0xa1')]({},_0x4b7b1b,_0x1c896d[_0x6b15('0xbd')]);return db[_0x6b15('0xc5')][_0x6b15('0x23')]({'where':_0x4b7b1b[_0x6b15('0x4a')]})[_0x6b15('0x2b')](function(_0x3f9192){_0xbdf4ba['count']=_0x3f9192;if(_0x1c896d[_0x6b15('0x40')][_0x6b15('0xbb')]){_0x4b7b1b[_0x6b15('0xbc')]=[{'all':!![]}];}return db['SmsMessage'][_0x6b15('0xc9')](_0x4b7b1b);})['then'](function(_0x412215){_0xbdf4ba[_0x6b15('0xb7')]=_0x412215;return _0xbdf4ba;});}})[_0x6b15('0x2b')](respondWithFilteredResult(_0x516225,_0x4b7b1b))[_0x6b15('0xbe')](handleError(_0x516225,null));};exports[_0x6b15('0xca')]=function(_0x1999ad,_0xd19479,_0x63fa1e){return db[_0x6b15('0xa2')][_0x6b15('0x65')]({'where':{'id':_0x1999ad['params']['id']}})[_0x6b15('0x2b')](handleEntityNotFound(_0xd19479,null))['then'](function(_0x2272b3){if(_0x2272b3){return _0x2272b3['setTags'](_0x1999ad[_0x6b15('0x79')]['ids'],_[_0x6b15('0xc3')](_0x1999ad[_0x6b15('0x79')],[_0x6b15('0xc2'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x6b15('0x2d'),_0x6b15('0xcb')],'where':{'id':_0x1999ad[_0x6b15('0x79')][_0x6b15('0xc2')]}});})[_0x6b15('0x2b')](function(_0x8f1c3d){socket[_0x6b15('0xcc')](_0x6b15('0xcd'),{'id':Number(_0x1999ad[_0x6b15('0xb9')]['id']),'tags':_0x8f1c3d||[]});return{'id':Number(_0x1999ad[_0x6b15('0xb9')]['id']),'tags':_0x8f1c3d||[]};});}})[_0x6b15('0x2b')](respondWithResult(_0xd19479,null))[_0x6b15('0xbe')](handleError(_0xd19479,null));};exports['removeTags']=function(_0x56f7e1,_0x491fb8,_0x301da4){return db[_0x6b15('0xa2')][_0x6b15('0x65')]({'where':{'id':_0x56f7e1[_0x6b15('0xb9')]['id']}})[_0x6b15('0x2b')](handleEntityNotFound(_0x491fb8,null))['then'](function(_0x2c9d68){if(_0x2c9d68){return _0x2c9d68[_0x6b15('0xce')](_0x56f7e1[_0x6b15('0x40')][_0x6b15('0xc2')]);}})['then'](respondWithStatusCode(_0x491fb8,null))[_0x6b15('0xbe')](handleError(_0x491fb8,null));};exports['download']=function(_0x28253b,_0x4e2d2b){var _0x749d11=moment()[_0x6b15('0xcf')]()[_0x6b15('0x9f')]();var _0x4d8214=path[_0x6b15('0xd0')](config[_0x6b15('0xd1')],_0x6b15('0xd2'),_0x6b15('0xd3'),_0x6b15('0xd4'));var _0x51b218=path[_0x6b15('0xd0')](config['root'],_0x6b15('0xd2'),_0x6b15('0xd3'),_0x6b15('0xd5'));var _0x38c954=path[_0x6b15('0xd0')](_0x4d8214,_0x749d11);var _0x521b7e=util[_0x6b15('0xc7')](_0x6b15('0xd6'),_0x28253b[_0x6b15('0xb9')]['id'],_0x749d11);var _0x40d19c=path[_0x6b15('0xd0')](_0x4d8214,_0x521b7e);var _0x32af5d=[];_0x32af5d[_0x6b15('0xb5')]({'model':db[_0x6b15('0x75')],'as':_0x6b15('0x75'),'attributes':['id',_0x6b15('0x30')],'raw':!![]});_0x32af5d[_0x6b15('0xb5')]({'model':db[_0x6b15('0xd7')],'as':_0x6b15('0x6b'),'attributes':['id',_0x6b15('0xd8'),'lastName'],'raw':!![]});var _0x57be69=[{'model':db[_0x6b15('0xc5')],'as':_0x6b15('0xd9'),'attributes':['id',_0x6b15('0x79'),_0x6b15('0x7d'),'direction',_0x6b15('0xda'),_0x6b15('0x83')],'include':_0x32af5d}];_0x57be69[_0x6b15('0xb5')]({'model':db[_0x6b15('0xdb')],'as':_0x6b15('0xdc'),'attributes':['id',_0x6b15('0x2d')]});_0x57be69[_0x6b15('0xb5')]({'model':db[_0x6b15('0x75')],'as':_0x6b15('0xdd'),'attributes':['id',_0x6b15('0x30')]});return db[_0x6b15('0xa2')][_0x6b15('0x65')]({'where':{'id':_0x28253b['params']['id']},'include':_0x57be69})[_0x6b15('0x2b')](handleEntityNotFound(_0x4e2d2b,null))[_0x6b15('0x2b')](function(_0x48596c){if(_0x48596c){var _0x127789=_0x48596c[_0x6b15('0xde')]({'plain':!![]});fs[_0x6b15('0xdf')](_0x38c954);var _0x2fe972={'channel':_0x6b15('0xe0'),'account':_0x127789['Account'][_0x6b15('0x2d')],'agent':_0x127789[_0x6b15('0xdd')]?_0x127789[_0x6b15('0xdd')][_0x6b15('0x30')]:_0x6b15('0xe1'),'createdAt':moment(_0x127789[_0x6b15('0x7d')])[_0x6b15('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6b15('0x9f')](),'closedAt':_0x127789['closed']?moment(_0x127789[_0x6b15('0xe2')])['format'](_0x6b15('0xc8'))[_0x6b15('0x9f')]():'','disposition':_0x127789[_0x6b15('0xe3')],'messages':_(_0x127789[_0x6b15('0xd9')])[_0x6b15('0x87')]({'secret':![]})[_0x6b15('0x2f')](function(_0x2d6cf7){return{'date':moment(_0x2d6cf7['createdAt'])[_0x6b15('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6b15('0x9f')](),'sender':_0x2d6cf7[_0x6b15('0xe4')]==='out'?_0x2d6cf7[_0x6b15('0x75')]?_0x2d6cf7[_0x6b15('0x75')][_0x6b15('0x30')]:_0x6b15('0xe5'):_0x2d6cf7['Contact'][_0x6b15('0xd8')]+(_0x2d6cf7[_0x6b15('0x6b')][_0x6b15('0xe6')]?'\x20'+_0x2d6cf7[_0x6b15('0x6b')]['lastName']:''),'body':_0x2d6cf7[_0x6b15('0x79')],'direction':_0x2d6cf7[_0x6b15('0xe4')]===_0x6b15('0xe7')?'A':'C','secret':_0x2d6cf7[_0x6b15('0xda')],'read':_0x2d6cf7[_0x6b15('0x83')]};})[_0x6b15('0x67')]()};return ejs[_0x6b15('0xe8')](path[_0x6b15('0xd0')](config['root'],_0x6b15('0xd2'),'views',_0x6b15('0xe9')),{'interaction':_0x2fe972})[_0x6b15('0x2b')](function(_0x4ba79f){var _0x22ac4b=path['join'](_0x38c954,_0x6b15('0xea')+_0x127789['id']+'-'+_0x749d11+_0x6b15('0xeb'));var _0xac7e6a={'path':_0x22ac4b,'channel':'Sms','interactionId':_0x127789['id']};return pdf[_0x6b15('0xec')](_0x4ba79f,_0xac7e6a);})[_0x6b15('0x2b')](function(){return new BPromise(function(_0x263637,_0x30a729){zipdir(_0x38c954,{'saveTo':_0x40d19c},function(_0x2a24db,_0x27ed0d){if(_0x2a24db)return _0x30a729(_0x2a24db);return _0x263637(_0x27ed0d);});})['then'](function(){return new BPromise(function(_0x3e82ca,_0x4f895a){rimraf(_0x38c954,function(_0x554cae){if(_0x554cae)_0x4f895a(_0x554cae);return _0x3e82ca();});});})[_0x6b15('0x2b')](function(){return _0x4e2d2b['download'](_0x40d19c,_0x521b7e,function(_0xed43a7){if(_0xed43a7){console[_0x6b15('0xed')](_0x6b15('0xee'),_0xed43a7);}else{fs[_0x6b15('0xef')](_0x40d19c);}});});});}else{return _0x4e2d2b[_0x6b15('0x1c')](0xc8);}})[_0x6b15('0xbe')](handleError(_0x4e2d2b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d0bcc02..89fb2f5 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 _0x3266=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x52452b,_0x25ade8){var _0x3ae176=function(_0xf2daae){while(--_0xf2daae){_0x52452b['push'](_0x52452b['shift']());}};_0x3ae176(++_0x25ade8);}(_0x3266,0x6a));var _0x6326=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x3266[_0x59bcb1];return _0x4a737f;};'use strict';var EventEmitter=require(_0x6326('0x0'));var SmsInteraction=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var SmsMessage=require(_0x6326('0x1'))['db'][_0x6326('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6326('0x4')](0x0);var events={'afterCreate':_0x6326('0x5'),'afterUpdate':_0x6326('0x6'),'afterDestroy':_0x6326('0x7')};function emitEvent(_0x5a6b4d){return function(_0x30b22e,_0x5f38a3,_0x25ecd8){_0x30b22e[_0x6326('0x8')]({'attributes':['id'],'raw':!![]})[_0x6326('0x9')](function(_0x5402e5){_0x30b22e[_0x6326('0xa')]('Users',_0x5402e5[_0x6326('0xb')](function(_0x90c0f){return{'id':_0x90c0f['id']};}));return SmsMessage[_0x6326('0xc')]({'where':{'SmsInteractionId':_0x30b22e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6326('0x9')](function(_0x37a23d){_0x30b22e['setDataValue'](_0x6326('0xd'),_0x37a23d[_0x6326('0xe')]);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d+':'+_0x30b22e['id'],_0x30b22e);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d,_0x30b22e);_0x25ecd8(null);})[_0x6326('0x10')](_0x25ecd8(null));};}for(var e in events){if(events[_0x6326('0x11')](e)){var event=events[e];SmsInteraction[_0x6326('0x12')](e,emitEvent(event));}}module[_0x6326('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0xe2cf=['update','remove','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x25cd6d,_0x30a718){_0x25cd6d=_0x25cd6d-0x0;var _0x7811e1=_0xe2cf[_0x25cd6d];return _0x7811e1;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe2c('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xfe2c('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe2c('0x1')](0x0);var events={'afterCreate':_0xfe2c('0x2'),'afterUpdate':_0xfe2c('0x3'),'afterDestroy':_0xfe2c('0x4')};function emitEvent(_0x494978){return function(_0xd40c31,_0x14674d,_0x55bb12){_0xd40c31['getUsers']({'attributes':['id'],'raw':!![]})[_0xfe2c('0x5')](function(_0x417bc4){_0xd40c31['setDataValue']('Users',_0x417bc4[_0xfe2c('0x6')](function(_0x2e2933){return{'id':_0x2e2933['id']};}));return SmsMessage[_0xfe2c('0x7')]({'where':{'SmsInteractionId':_0xd40c31['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5b616c){_0xd40c31[_0xfe2c('0x8')](_0xfe2c('0x9'),_0x5b616c['length']);SmsInteractionEvents[_0xfe2c('0xa')](_0x494978+':'+_0xd40c31['id'],_0xd40c31);SmsInteractionEvents[_0xfe2c('0xa')](_0x494978,_0xd40c31);_0x55bb12(null);})[_0xfe2c('0xb')](_0x55bb12(null));};}for(var e in events){if(events[_0xfe2c('0xc')](e)){var event=events[e];SmsInteraction[_0xfe2c('0xd')](e,emitEvent(event));}}module[_0xfe2c('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6b8fc60..bfed3c1 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 _0x2c35=['moment','bluebird','request-promise','path','exports','define','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x2c35,0xa1));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var logger=require(_0x52c3('0x2'))(_0x52c3('0x3'));var moment=require(_0x52c3('0x4'));var BPromise=require(_0x52c3('0x5'));var rp=require(_0x52c3('0x6'));var fs=require('fs');var path=require(_0x52c3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x52c3('0x8')]=function(_0x3d6702,_0x49086c){return _0x3d6702[_0x52c3('0x9')](_0x52c3('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36ad69,_0x2b3731,_0x1f6e0a){if(_0x36ad69[_0x52c3('0xb')](_0x52c3('0xc'))){_0x36ad69[_0x52c3('0xd')]=moment()['format'](_0x52c3('0xe'));}_0x1f6e0a(null,_0x36ad69);}}});}; \ No newline at end of file +var _0x7639=['lodash','util','api','moment','request-promise','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','format'];(function(_0x504a37,_0x2dc5fa){var _0x36ce41=function(_0x20e0fb){while(--_0x20e0fb){_0x504a37['push'](_0x504a37['shift']());}};_0x36ce41(++_0x2dc5fa);}(_0x7639,0x1ee));var _0x9763=function(_0x503e1f,_0x45dd44){_0x503e1f=_0x503e1f-0x0;var _0x2f08da=_0x7639[_0x503e1f];return _0x2f08da;};'use strict';var _=require(_0x9763('0x0'));var util=require(_0x9763('0x1'));var logger=require('../../config/logger')(_0x9763('0x2'));var moment=require(_0x9763('0x3'));var BPromise=require('bluebird');var rp=require(_0x9763('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9763('0x5'));var config=require('../../config/environment');var attributes=require(_0x9763('0x6'));module[_0x9763('0x7')]=function(_0x26cd2a,_0x4de3cd){return _0x26cd2a[_0x9763('0x8')](_0x9763('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x154ee6,_0x78a254,_0x3300c2){if(_0x154ee6[_0x9763('0xa')](_0x9763('0xb'))){_0x154ee6['closedAt']=moment()[_0x9763('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3300c2(null,_0x154ee6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3eec616..8302154 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 _0x7a9c=['spread','debug','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','options','limit','AddTagsToSmsInteraction','find','body','ids'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x7a9c,0x16b));var _0xc7a9=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x7a9c[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xc7a9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7a9('0x1'));var rs=require(_0xc7a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a9('0x4'))(_0xc7a9('0x5'));var config=require(_0xc7a9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc7a9('0x7')][_0xc7a9('0x8')]({'port':0x232a});config[_0xc7a9('0x9')]=_[_0xc7a9('0xa')](config[_0xc7a9('0x9')],{'host':_0xc7a9('0xb'),'port':0x18eb});var socket=require(_0xc7a9('0xc'))(new Redis(config['redis']));require(_0xc7a9('0xd'))['register'](socket);function respondWithRpcPromise(_0xa01f0f,_0x22864c,_0x400cb1){return new BPromise(function(_0x692296,_0x21e2d1){return client[_0xc7a9('0xe')](_0xa01f0f,_0x400cb1)[_0xc7a9('0xf')](function(_0x2f2ba5){logger[_0xc7a9('0x10')](_0xc7a9('0x11'),_0x22864c,_0xc7a9('0x12'));logger['debug'](_0xc7a9('0x13'),_0x22864c,'request\x20sent',JSON[_0xc7a9('0x14')](_0x2f2ba5));if(_0x2f2ba5[_0xc7a9('0x15')]){if(_0x2f2ba5['error'][_0xc7a9('0x16')]===0x1f4){logger[_0xc7a9('0x15')](_0xc7a9('0x11'),_0x22864c,_0x2f2ba5[_0xc7a9('0x15')]['message']);return _0x21e2d1(_0x2f2ba5[_0xc7a9('0x15')][_0xc7a9('0x17')]);}logger[_0xc7a9('0x15')](_0xc7a9('0x11'),_0x22864c,_0x2f2ba5['error'][_0xc7a9('0x17')]);return _0x692296(_0x2f2ba5[_0xc7a9('0x15')]['message']);}else{logger[_0xc7a9('0x10')](_0xc7a9('0x11'),_0x22864c,_0xc7a9('0x12'));_0x692296(_0x2f2ba5[_0xc7a9('0x18')][_0xc7a9('0x17')]);}})[_0xc7a9('0x19')](function(_0x3afc46){logger[_0xc7a9('0x15')](_0xc7a9('0x11'),_0x22864c,_0x3afc46);_0x21e2d1(_0x3afc46);});});}exports['UpdateSmsInteraction']=function(_0x362508){var _0x2d3f8b=this;return new Promise(function(_0x4c5c54,_0x57d11d){return db[_0xc7a9('0x1a')]['update'](_0x362508['body'],{'raw':_0x362508[_0xc7a9('0x1b')]?_0x362508[_0xc7a9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x362508[_0xc7a9('0x1b')]?_0x362508[_0xc7a9('0x1b')]['where']||null:null,'attributes':_0x362508[_0xc7a9('0x1b')]?_0x362508[_0xc7a9('0x1b')]['attributes']||null:null,'limit':_0x362508[_0xc7a9('0x1b')]?_0x362508[_0xc7a9('0x1b')][_0xc7a9('0x1c')]||null:null})['then'](function(_0x4974fc){logger[_0xc7a9('0x10')]('UpdateSmsInteraction',_0x362508);logger['debug']('UpdateSmsInteraction',_0x362508,JSON['stringify'](_0x4974fc));_0x4c5c54(_0x4974fc);})['catch'](function(_0x48448c){logger[_0xc7a9('0x15')]('UpdateSmsInteraction',_0x48448c['message'],_0x362508);_0x57d11d(_0x2d3f8b[_0xc7a9('0x15')](0x1f4,_0x48448c[_0xc7a9('0x17')]));});});};exports[_0xc7a9('0x1d')]=function(_0x1e7ae4){return new Promise(function(_0x2a761d,_0x2fd068){return db[_0xc7a9('0x1a')][_0xc7a9('0x1e')]({'where':_0x1e7ae4[_0xc7a9('0x1b')]?_0x1e7ae4[_0xc7a9('0x1b')]['where']||null:null})[_0xc7a9('0xf')](function(_0x246bc2){if(_0x246bc2){return _0x246bc2['addTags'](_0x1e7ae4[_0xc7a9('0x1f')][_0xc7a9('0x20')],_['omit'](_0x1e7ae4['body'],[_0xc7a9('0x20'),'id'])||{});}})[_0xc7a9('0x21')](function(_0x2ae0d8){logger[_0xc7a9('0x10')]('AddTags',_0x1e7ae4);logger[_0xc7a9('0x22')](_0xc7a9('0x23'),_0x1e7ae4,JSON['stringify'](_0x2ae0d8));_0x2a761d(_0x2ae0d8);})['catch'](function(_0x1ac732){logger[_0xc7a9('0x15')](_0xc7a9('0x23'),_0x1ac732[_0xc7a9('0x17')],_0x1e7ae4);_0x2fd068(_this[_0xc7a9('0x15')](0x1f4,_0x1ac732[_0xc7a9('0x17')]));});});}; \ No newline at end of file +var _0x0810=['defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','attributes','limit','then','debug','AddTagsToSmsInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1327f7,_0x574202){var _0xa7a00c=function(_0x4cfe0b){while(--_0x4cfe0b){_0x1327f7['push'](_0x1327f7['shift']());}};_0xa7a00c(++_0x574202);}(_0x0810,0x177));var _0x0081=function(_0x33098e,_0x24ccde){_0x33098e=_0x33098e-0x0;var _0x3ab8b7=_0x0810[_0x33098e];return _0x3ab8b7;};'use strict';var _=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var moment=require(_0x0081('0x2'));var BPromise=require(_0x0081('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0081('0x4'));var db=require(_0x0081('0x5'))['db'];var utils=require(_0x0081('0x6'));var logger=require('../../config/logger')(_0x0081('0x7'));var config=require(_0x0081('0x8'));var jayson=require(_0x0081('0x9'));var client=jayson[_0x0081('0xa')][_0x0081('0xb')]({'port':0x232a});config['redis']=_[_0x0081('0xc')](config[_0x0081('0xd')],{'host':_0x0081('0xe'),'port':0x18eb});var socket=require(_0x0081('0xf'))(new Redis(config['redis']));require(_0x0081('0x10'))[_0x0081('0x11')](socket);function respondWithRpcPromise(_0x2a9361,_0x2e359f,_0x5e2389){return new BPromise(function(_0x3f0903,_0xb701){return client['request'](_0x2a9361,_0x5e2389)['then'](function(_0x5e5763){logger['info'](_0x0081('0x12'),_0x2e359f,_0x0081('0x13'));logger['debug'](_0x0081('0x14'),_0x2e359f,'request\x20sent',JSON[_0x0081('0x15')](_0x5e5763));if(_0x5e5763[_0x0081('0x16')]){if(_0x5e5763[_0x0081('0x16')]['code']===0x1f4){logger[_0x0081('0x16')](_0x0081('0x12'),_0x2e359f,_0x5e5763[_0x0081('0x16')][_0x0081('0x17')]);return _0xb701(_0x5e5763[_0x0081('0x16')]['message']);}logger[_0x0081('0x16')](_0x0081('0x12'),_0x2e359f,_0x5e5763[_0x0081('0x16')][_0x0081('0x17')]);return _0x3f0903(_0x5e5763['error'][_0x0081('0x17')]);}else{logger[_0x0081('0x18')](_0x0081('0x12'),_0x2e359f,_0x0081('0x13'));_0x3f0903(_0x5e5763[_0x0081('0x19')][_0x0081('0x17')]);}})[_0x0081('0x1a')](function(_0xea7a5f){logger[_0x0081('0x16')](_0x0081('0x12'),_0x2e359f,_0xea7a5f);_0xb701(_0xea7a5f);});});}exports[_0x0081('0x1b')]=function(_0xb56c86){var _0x46958b=this;return new Promise(function(_0x52c259,_0x185975){return db[_0x0081('0x1c')]['update'](_0xb56c86['body'],{'raw':_0xb56c86[_0x0081('0x1d')]?_0xb56c86['options'][_0x0081('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb56c86[_0x0081('0x1d')]?_0xb56c86['options'][_0x0081('0x1f')]||null:null,'attributes':_0xb56c86[_0x0081('0x1d')]?_0xb56c86['options'][_0x0081('0x20')]||null:null,'limit':_0xb56c86[_0x0081('0x1d')]?_0xb56c86['options'][_0x0081('0x21')]||null:null})[_0x0081('0x22')](function(_0x2648b8){logger[_0x0081('0x18')](_0x0081('0x1b'),_0xb56c86);logger[_0x0081('0x23')](_0x0081('0x1b'),_0xb56c86,JSON[_0x0081('0x15')](_0x2648b8));_0x52c259(_0x2648b8);})['catch'](function(_0x303b0b){logger['error'](_0x0081('0x1b'),_0x303b0b['message'],_0xb56c86);_0x185975(_0x46958b[_0x0081('0x16')](0x1f4,_0x303b0b[_0x0081('0x17')]));});});};exports[_0x0081('0x24')]=function(_0x19f404){return new Promise(function(_0x24b73b,_0xa9e4c9){return db['SmsInteraction'][_0x0081('0x25')]({'where':_0x19f404[_0x0081('0x1d')]?_0x19f404[_0x0081('0x1d')][_0x0081('0x1f')]||null:null})[_0x0081('0x22')](function(_0x484276){if(_0x484276){return _0x484276['addTags'](_0x19f404[_0x0081('0x26')][_0x0081('0x27')],_[_0x0081('0x28')](_0x19f404[_0x0081('0x26')],[_0x0081('0x27'),'id'])||{});}})[_0x0081('0x29')](function(_0xedc26){logger[_0x0081('0x18')]('AddTags',_0x19f404);logger[_0x0081('0x23')]('AddTags',_0x19f404,JSON[_0x0081('0x15')](_0xedc26));_0x24b73b(_0xedc26);})['catch'](function(_0x5619fa){logger['error'](_0x0081('0x2a'),_0x5619fa['message'],_0x19f404);_0xa9e4c9(_this[_0x0081('0x16')](0x1f4,_0x5619fa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e880e05..e4fac68 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 _0xbe92=['update','emit','removeListener','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x238ede,_0x5e21da){var _0x3b8160=function(_0x403e18){while(--_0x403e18){_0x238ede['push'](_0x238ede['shift']());}};_0x3b8160(++_0x5e21da);}(_0xbe92,0xf9));var _0x2be9=function(_0x17f3ac,_0x167137){_0x17f3ac=_0x17f3ac-0x0;var _0x4ab47e=_0xbe92[_0x17f3ac];return _0x4ab47e;};'use strict';var SmsInteractionEvents=require(_0x2be9('0x0'));var events=[_0x2be9('0x1'),_0x2be9('0x2'),_0x2be9('0x3')];function createListener(_0x11b687,_0x225726){return function(_0x3ac173){_0x225726[_0x2be9('0x4')](_0x11b687,_0x3ac173);};}function removeListener(_0x483b93,_0x1566ab){return function(){SmsInteractionEvents[_0x2be9('0x5')](_0x483b93,_0x1566ab);};}exports['register']=function(_0x3724e9){for(var _0x3d8c42=0x0,_0xbc2d54=events['length'];_0x3d8c42<_0xbc2d54;_0x3d8c42++){var _0x44ea0a=events[_0x3d8c42];var _0x2862ea=createListener(_0x2be9('0x6')+_0x44ea0a,_0x3724e9);SmsInteractionEvents['on'](_0x44ea0a,_0x2862ea);}}; \ No newline at end of file +var _0x85c5=['./smsInteraction.events','save','update','emit','removeListener','smsInteraction:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85c5,0x138));var _0x585c=function(_0x1d1baf,_0x4f7332){_0x1d1baf=_0x1d1baf-0x0;var _0x3d0eb8=_0x85c5[_0x1d1baf];return _0x3d0eb8;};'use strict';var SmsInteractionEvents=require(_0x585c('0x0'));var events=[_0x585c('0x1'),'remove',_0x585c('0x2')];function createListener(_0x29a08c,_0x5e4d44){return function(_0x56181d){_0x5e4d44[_0x585c('0x3')](_0x29a08c,_0x56181d);};}function removeListener(_0x28fb38,_0x4a3651){return function(){SmsInteractionEvents[_0x585c('0x4')](_0x28fb38,_0x4a3651);};}exports['register']=function(_0x23cc24){for(var _0x4ba574=0x0,_0x29952b=events['length'];_0x4ba574<_0x29952b;_0x4ba574++){var _0x3ae360=events[_0x4ba574];var _0x183678=createListener(_0x585c('0x5')+_0x3ae360,_0x23cc24);SmsInteractionEvents['on'](_0x3ae360,_0x183678);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0c040b6..039ec27 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 _0xb0cf=['sms','/:id/status','status','put','/:id/accept','accept','/:id/reject','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb0cf,0x84));var _0xfb0c=function(_0x1c10da,_0x8eb697){_0x1c10da=_0x1c10da-0x0;var _0xc2c0a=_0xb0cf[_0x1c10da];return _0xc2c0a;};'use strict';var multer=require(_0xfb0c('0x0'));var util=require('util');var path=require(_0xfb0c('0x1'));var timeout=require(_0xfb0c('0x2'));var express=require(_0xfb0c('0x3'));var router=express[_0xfb0c('0x4')]();var fs_extra=require(_0xfb0c('0x5'));var auth=require(_0xfb0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb0c('0x7'));var controller=require(_0xfb0c('0x8'));router[_0xfb0c('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb0c('0xa')]);router[_0xfb0c('0x9')](_0xfb0c('0xb'),auth[_0xfb0c('0xc')](),controller[_0xfb0c('0xd')]);router[_0xfb0c('0x9')](_0xfb0c('0xe'),auth[_0xfb0c('0xc')](),controller[_0xfb0c('0xf')]);router[_0xfb0c('0x10')]('/',auth[_0xfb0c('0xc')](),interaction[_0xfb0c('0x11')](_0xfb0c('0x12'),'smsmessage:create'),controller['create']);router[_0xfb0c('0x10')](_0xfb0c('0x13'),controller[_0xfb0c('0x14')]);router[_0xfb0c('0x15')]('/:id',auth[_0xfb0c('0xc')](),controller['update']);router['put'](_0xfb0c('0x16'),auth[_0xfb0c('0xc')](),controller[_0xfb0c('0x17')]);router[_0xfb0c('0x15')](_0xfb0c('0x18'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xfb0c('0xe'),auth[_0xfb0c('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7c59=['show','tracked','sms','smsmessage:create','post','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x5dd85a,_0x2a889d){var _0x3aa134=function(_0xcb0e52){while(--_0xcb0e52){_0x5dd85a['push'](_0x5dd85a['shift']());}};_0x3aa134(++_0x2a889d);}(_0x7c59,0x147));var _0x97c5=function(_0x3520a5,_0x354155){_0x3520a5=_0x3520a5-0x0;var _0x28f417=_0x7c59[_0x3520a5];return _0x28f417;};'use strict';var multer=require('multer');var util=require(_0x97c5('0x0'));var path=require(_0x97c5('0x1'));var timeout=require(_0x97c5('0x2'));var express=require(_0x97c5('0x3'));var router=express['Router']();var fs_extra=require(_0x97c5('0x4'));var auth=require(_0x97c5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x97c5('0x6'));router[_0x97c5('0x7')]('/',auth[_0x97c5('0x8')](),controller[_0x97c5('0x9')]);router[_0x97c5('0x7')]('/describe',auth[_0x97c5('0x8')](),controller['describe']);router['get'](_0x97c5('0xa'),auth[_0x97c5('0x8')](),controller[_0x97c5('0xb')]);router['post']('/',auth[_0x97c5('0x8')](),interaction[_0x97c5('0xc')](_0x97c5('0xd'),_0x97c5('0xe')),controller['create']);router[_0x97c5('0xf')](_0x97c5('0x10'),controller[_0x97c5('0x11')]);router['put'](_0x97c5('0xa'),auth[_0x97c5('0x8')](),controller[_0x97c5('0x12')]);router[_0x97c5('0x13')](_0x97c5('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x97c5('0x13')](_0x97c5('0x15'),auth[_0x97c5('0x8')](),controller[_0x97c5('0x16')]);router[_0x97c5('0x17')](_0x97c5('0xa'),auth[_0x97c5('0x8')](),controller[_0x97c5('0x18')]);module[_0x97c5('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 736f738..cda4eb9 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 _0x6d22=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x457079,_0x5cc423){var _0x43d176=function(_0x3a8108){while(--_0x3a8108){_0x457079['push'](_0x457079['shift']());}};_0x43d176(++_0x5cc423);}(_0x6d22,0x112));var _0x26d2=function(_0x541787,_0x2f4be3){_0x541787=_0x541787-0x0;var _0x28c873=_0x6d22[_0x541787];return _0x28c873;};'use strict';var Sequelize=require(_0x26d2('0x0'));module[_0x26d2('0x1')]={'body':{'type':Sequelize[_0x26d2('0x2')](_0x26d2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x26d2('0x5')),'defaultValue':_0x26d2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x26d2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x26d2('0x6')]},'readAt':{'type':Sequelize[_0x26d2('0x7')]},'secret':{'type':Sequelize[_0x26d2('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x26d2('0x6')]},'providerResponse':{'type':Sequelize[_0x26d2('0x2')]}}; \ No newline at end of file +var _0x0233=['TEXT','medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x2f30ac,_0x47d553){var _0xceb6d5=function(_0xf8b790){while(--_0xf8b790){_0x2f30ac['push'](_0x2f30ac['shift']());}};_0xceb6d5(++_0x47d553);}(_0x0233,0x1b0));var _0x3023=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x0233[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require(_0x3023('0x0'));module[_0x3023('0x1')]={'body':{'type':Sequelize[_0x3023('0x2')](_0x3023('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3023('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3023('0x5')),'defaultValue':_0x3023('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3023('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3023('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3023('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3023('0x6')]},'providerResponse':{'type':Sequelize[_0x3023('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d4450cc..21a7871 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 _0x21c9=['message','catch','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','end','sendStatus','stack','name','send','SmsMessage','fieldName','type','map','keys','query','filters','intersection','attributes','fields','model','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','create','update','body','describe','sms-interactions','accept','sms','readAt','UserId','user','agent','get','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','email','SmsAccount','inspect','MessageSid','messageId','twilio','plivo','delivered','Status','plivio','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x21c9,0xea));var _0x921c=function(_0x164d05,_0x279d63){_0x164d05=_0x164d05-0x0;var _0x427fa2=_0x21c9[_0x164d05];return _0x427fa2;};'use strict';var emlformat=require(_0x921c('0x0'));var rimraf=require(_0x921c('0x1'));var zipdir=require(_0x921c('0x2'));var jsonpatch=require(_0x921c('0x3'));var rp=require('request-promise');var moment=require(_0x921c('0x4'));var BPromise=require(_0x921c('0x5'));var Mustache=require('mustache');var util=require(_0x921c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x921c('0x7'));var ejs=require(_0x921c('0x8'));var fs=require('fs');var fs_extra=require(_0x921c('0x9'));var _=require(_0x921c('0xa'));var squel=require(_0x921c('0xb'));var crypto=require(_0x921c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x921c('0x7'));var querystring=require('querystring');var Papa=require(_0x921c('0xd'));var Redis=require('ioredis');var authService=require(_0x921c('0xe'));var qs=require(_0x921c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x921c('0x10'));var logger=require(_0x921c('0x11'))('api');var utils=require(_0x921c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x921c('0x13'));var db=require(_0x921c('0x14'))['db'];config[_0x921c('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x921c('0x16'))(new Redis(config[_0x921c('0x15')]));require(_0x921c('0x17'))[_0x921c('0x18')](socket);var jayson=require(_0x921c('0x19'));var client=jayson['client'][_0x921c('0x1a')]({'port':0x232c});var client9002=jayson[_0x921c('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf13c,_0x402ea4,_0x32c264,_0x348bf7){return new BPromise(function(_0x56e8a6,_0x21b689){var _0x52a740=_0x348bf7||client;return _0x52a740[_0x921c('0x1c')](_0x5cf13c,_0x32c264)['then'](function(_0x5a39f6){logger[_0x921c('0x1d')](_0x921c('0x1e'),_0x402ea4,_0x921c('0x1f'));logger[_0x921c('0x20')](_0x921c('0x21'),_0x402ea4,_0x921c('0x1f'),JSON[_0x921c('0x22')](_0x5a39f6));if(_0x5a39f6['error']){if(_0x5a39f6[_0x921c('0x23')]['code']===0x1f4){logger[_0x921c('0x23')]('SmsMessage,\x20%s,\x20%s',_0x402ea4,_0x5a39f6['error'][_0x921c('0x24')]);return _0x21b689(_0x5a39f6[_0x921c('0x23')]['message']);}logger[_0x921c('0x23')](_0x921c('0x1e'),_0x402ea4,_0x5a39f6[_0x921c('0x23')]['message']);return _0x56e8a6(_0x5a39f6[_0x921c('0x23')][_0x921c('0x24')]);}else{logger[_0x921c('0x1d')](_0x921c('0x1e'),_0x402ea4,_0x921c('0x1f'));_0x56e8a6(_0x5a39f6['result'][_0x921c('0x24')]);}})[_0x921c('0x25')](function(_0x1da963){logger[_0x921c('0x23')]('SmsMessage,\x20%s,\x20%s',_0x402ea4,_0x1da963);_0x21b689(_0x1da963);});});}function respondWithStatusCode(_0x5f23ee,_0x3e002c){_0x3e002c=_0x3e002c||0xcc;return function(_0x50d2ce){if(_0x50d2ce){return _0x5f23ee['sendStatus'](_0x3e002c);}return _0x5f23ee[_0x921c('0x26')](_0x3e002c)['end']();};}function respondWithResult(_0xec637b,_0x843c00){_0x843c00=_0x843c00||0xc8;return function(_0x15aac7){if(_0x15aac7){return _0xec637b[_0x921c('0x26')](_0x843c00)['json'](_0x15aac7);}};}function respondWithFilteredResult(_0x1508d9,_0x3017c5){return function(_0x46cc65){if(_0x46cc65){var _0x1b3409=typeof _0x3017c5[_0x921c('0x27')]===_0x921c('0x28')&&typeof _0x3017c5[_0x921c('0x29')]===_0x921c('0x28');var _0x7de247=_0x46cc65[_0x921c('0x2a')];var _0x49b3d7=_0x1b3409?0x0:_0x3017c5['offset'];var _0x49b4a8=_0x1b3409?_0x46cc65[_0x921c('0x2a')]:_0x3017c5['offset']+_0x3017c5[_0x921c('0x29')];var _0x44dc5e;if(_0x49b4a8>=_0x7de247){_0x49b4a8=_0x7de247;_0x44dc5e=0xc8;}else{_0x44dc5e=0xce;}_0x1508d9[_0x921c('0x26')](_0x44dc5e);return _0x1508d9[_0x921c('0x2b')]('Content-Range',_0x49b3d7+'-'+_0x49b4a8+'/'+_0x7de247)[_0x921c('0x2c')](_0x46cc65);}return null;};}function patchUpdates(_0x27d135){return function(_0x5e6b9b){try{jsonpatch['apply'](_0x5e6b9b,_0x27d135,!![]);}catch(_0x3c250a){return BPromise[_0x921c('0x2d')](_0x3c250a);}return _0x5e6b9b[_0x921c('0x2e')]();};}function saveUpdates(_0x168a9f,_0x4112a5){return function(_0x3c7083){if(_0x3c7083){return _0x3c7083['update'](_0x168a9f)['then'](function(_0x413fbd){return _0x413fbd;});}return null;};}function removeEntity(_0x4cdd29,_0x20ab62){return function(_0x4c38c8){if(_0x4c38c8){return _0x4c38c8[_0x921c('0x2f')]()[_0x921c('0x30')](function(){_0x4cdd29[_0x921c('0x26')](0xcc)[_0x921c('0x31')]();});}};}function handleEntityNotFound(_0x1912de,_0xad7326){return function(_0x4afca7){if(!_0x4afca7){_0x1912de[_0x921c('0x32')](0x194);}return _0x4afca7;};}function handleError(_0x5c29fd,_0x5df25e){_0x5df25e=_0x5df25e||0x1f4;return function(_0x3096d1){logger[_0x921c('0x23')](_0x3096d1[_0x921c('0x33')]);if(_0x3096d1[_0x921c('0x34')]){delete _0x3096d1['name'];}_0x5c29fd['status'](_0x5df25e)[_0x921c('0x35')](_0x3096d1);};}exports['index']=function(_0x4a3d21,_0x5c71cc){var _0x40fa75={},_0x549370={},_0x5b9452={'count':0x0,'rows':[]};var _0x2762de=_['map'](db[_0x921c('0x36')]['rawAttributes'],function(_0x3c27af){return{'name':_0x3c27af[_0x921c('0x37')],'type':_0x3c27af[_0x921c('0x38')]['key']};});_0x549370['model']=_[_0x921c('0x39')](_0x2762de,_0x921c('0x34'));_0x549370['query']=_[_0x921c('0x3a')](_0x4a3d21[_0x921c('0x3b')]);_0x549370[_0x921c('0x3c')]=_[_0x921c('0x3d')](_0x549370['model'],_0x549370['query']);_0x40fa75[_0x921c('0x3e')]=_[_0x921c('0x3d')](_0x549370['model'],qs[_0x921c('0x3f')](_0x4a3d21[_0x921c('0x3b')][_0x921c('0x3f')]));_0x40fa75[_0x921c('0x3e')]=_0x40fa75['attributes']['length']?_0x40fa75[_0x921c('0x3e')]:_0x549370[_0x921c('0x40')];if(!_0x4a3d21[_0x921c('0x3b')]['hasOwnProperty'](_0x921c('0x41'))){_0x40fa75['limit']=qs[_0x921c('0x29')](_0x4a3d21[_0x921c('0x3b')][_0x921c('0x29')]);_0x40fa75[_0x921c('0x27')]=qs['offset'](_0x4a3d21[_0x921c('0x3b')][_0x921c('0x27')]);}_0x40fa75[_0x921c('0x42')]=qs['sort'](_0x4a3d21[_0x921c('0x3b')][_0x921c('0x43')]);_0x40fa75['where']=qs[_0x921c('0x3c')](_['pick'](_0x4a3d21[_0x921c('0x3b')],_0x549370[_0x921c('0x3c')]),_0x2762de);if(_0x4a3d21[_0x921c('0x3b')][_0x921c('0x44')]){_0x40fa75['where']=_['merge'](_0x40fa75[_0x921c('0x45')],{'$or':_['map'](_0x2762de,function(_0x508e08){if(_0x508e08['type']!==_0x921c('0x46')){var _0x2744b0={};_0x2744b0[_0x508e08[_0x921c('0x34')]]={'$like':'%'+_0x4a3d21[_0x921c('0x3b')][_0x921c('0x44')]+'%'};return _0x2744b0;}})});}_0x40fa75=_[_0x921c('0x47')]({},_0x40fa75,_0x4a3d21[_0x921c('0x48')]);var _0x5acbfb={'where':_0x40fa75[_0x921c('0x45')]};return db[_0x921c('0x36')][_0x921c('0x2a')](_0x5acbfb)[_0x921c('0x30')](function(_0x42c6be){_0x5b9452[_0x921c('0x2a')]=_0x42c6be;if(_0x4a3d21[_0x921c('0x3b')][_0x921c('0x49')]){_0x40fa75['include']=[{'all':!![]}];}return db[_0x921c('0x36')][_0x921c('0x4a')](_0x40fa75);})[_0x921c('0x30')](function(_0x1c23f8){_0x5b9452[_0x921c('0x4b')]=_0x1c23f8;return _0x5b9452;})[_0x921c('0x30')](respondWithFilteredResult(_0x5c71cc,_0x40fa75))[_0x921c('0x25')](handleError(_0x5c71cc,null));};exports[_0x921c('0x4c')]=function(_0x26354c,_0x40b1b1){var _0x17ee5f={'raw':!![],'where':{'id':_0x26354c[_0x921c('0x4d')]['id']}},_0x94978b={};_0x94978b['model']=_[_0x921c('0x3a')](db[_0x921c('0x36')]['rawAttributes']);_0x94978b[_0x921c('0x3b')]=_[_0x921c('0x3a')](_0x26354c[_0x921c('0x3b')]);_0x94978b[_0x921c('0x3c')]=_['intersection'](_0x94978b[_0x921c('0x40')],_0x94978b[_0x921c('0x3b')]);_0x17ee5f[_0x921c('0x3e')]=_[_0x921c('0x3d')](_0x94978b[_0x921c('0x40')],qs[_0x921c('0x3f')](_0x26354c[_0x921c('0x3b')]['fields']));_0x17ee5f[_0x921c('0x3e')]=_0x17ee5f['attributes']['length']?_0x17ee5f[_0x921c('0x3e')]:_0x94978b[_0x921c('0x40')];if(_0x26354c[_0x921c('0x3b')][_0x921c('0x49')]){_0x17ee5f[_0x921c('0x4e')]=[{'all':!![]}];}_0x17ee5f=_['merge']({},_0x17ee5f,_0x26354c['options']);return db['SmsMessage'][_0x921c('0x4f')](_0x17ee5f)[_0x921c('0x30')](handleEntityNotFound(_0x40b1b1,null))[_0x921c('0x30')](respondWithResult(_0x40b1b1,null))[_0x921c('0x25')](handleError(_0x40b1b1,null));};exports[_0x921c('0x50')]=function(_0x4f9ca9,_0x408706){return db[_0x921c('0x36')][_0x921c('0x50')](_0x4f9ca9['body'],{})['then'](respondWithResult(_0x408706,0xc9))[_0x921c('0x25')](handleError(_0x408706,null));};exports[_0x921c('0x51')]=function(_0x250219,_0x4e2001){if(_0x250219[_0x921c('0x52')]['id']){delete _0x250219['body']['id'];}return db[_0x921c('0x36')][_0x921c('0x4f')]({'where':{'id':_0x250219[_0x921c('0x4d')]['id']}})[_0x921c('0x30')](handleEntityNotFound(_0x4e2001,null))[_0x921c('0x30')](saveUpdates(_0x250219[_0x921c('0x52')],null))['then'](respondWithResult(_0x4e2001,null))['catch'](handleError(_0x4e2001,null));};exports[_0x921c('0x2f')]=function(_0x235766,_0x1eed23){return db[_0x921c('0x36')][_0x921c('0x4f')]({'where':{'id':_0x235766[_0x921c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1eed23,null))[_0x921c('0x30')](removeEntity(_0x1eed23,null))[_0x921c('0x25')](handleError(_0x1eed23,null));};exports['describe']=function(_0x4e14de,_0x505657){return db[_0x921c('0x36')][_0x921c('0x53')]()['then'](respondWithResult(_0x505657,null))['catch'](handleError(_0x505657,null));};var interaction_log=require(_0x921c('0x11'))(_0x921c('0x54'));exports[_0x921c('0x55')]=function(_0x5517ba,_0x4328da,_0x425170){var _0x2a4327={'agent':{},'channel':_0x921c('0x56')};if(_0x5517ba[_0x921c('0x52')]['id']){delete _0x5517ba[_0x921c('0x52')]['id'];}_0x5517ba[_0x921c('0x52')]['read']=!![];_0x5517ba['body'][_0x921c('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5517ba[_0x921c('0x52')][_0x921c('0x58')]=_0x5517ba[_0x921c('0x52')][_0x921c('0x58')]||_0x5517ba[_0x921c('0x59')]['id'];_0x2a4327[_0x921c('0x5a')]['id']=_0x5517ba[_0x921c('0x52')][_0x921c('0x58')];return db['SmsMessage'][_0x921c('0x4f')]({'where':{'id':_0x5517ba[_0x921c('0x4d')]['id'],'UserId':null}})[_0x921c('0x30')](handleEntityNotFound(_0x4328da,null))[_0x921c('0x30')](saveUpdates(_0x5517ba[_0x921c('0x52')],null))[_0x921c('0x30')](function(_0x2fa63a){if(_0x2fa63a){_0x2a4327[_0x921c('0x24')]=_0x2fa63a[_0x921c('0x5b')]({'plain':!![]});return db['SmsInteraction'][_0x921c('0x4f')]({'where':{'id':_0x2fa63a['SmsInteractionId']}});}return null;})[_0x921c('0x30')](handleEntityNotFound(_0x4328da,null))[_0x921c('0x30')](function(_0x531a1c){if(_0x531a1c){return _0x531a1c[_0x921c('0x51')]({'UserId':_0x5517ba['body'][_0x921c('0x58')],'read1stAt':_['isNil'](_0x531a1c[_0x921c('0x5c')])?moment()[_0x921c('0x5d')](_0x921c('0x5e')):undefined});}return null;})[_0x921c('0x30')](function(_0xc9f673){if(_0xc9f673){_0x2a4327[_0x921c('0x5f')]=_0xc9f673[_0x921c('0x5b')]({'plain':!![]});interaction_log[_0x921c('0x1d')](_0x921c('0x60'),_0x5517ba['user']['id'],_0x5517ba['user'][_0x921c('0x34')],_0x5517ba[_0x921c('0x59')][_0x921c('0x61')],_0x2a4327[_0x921c('0x5f')]['id'],_0x5517ba[_0x921c('0x52')]?JSON[_0x921c('0x22')](_0x5517ba[_0x921c('0x52')]):_0x921c('0x62'));return respondWithRpcPromise(_0x921c('0x63'),_0x921c('0x64'),_0x2a4327);}return null;})[_0x921c('0x30')](function(_0x34e0c2){var _0xac4d2b=_0x921c('0x65')+_0x34e0c2['message']['ContactId'];return db[_0x921c('0x66')][_0x921c('0x3b')](_0xac4d2b,{'type':db['Sequelize'][_0x921c('0x67')]['SELECT'],'raw':!![]})[_0x921c('0x30')](function(_0x57b238){return _0x57b238;});})[_0x921c('0x30')](function(_0xcd4cbf){if(_0xcd4cbf){_0x2a4327[_0x921c('0x24')][_0x921c('0x68')]=_0xcd4cbf[0x0];if(!_0x5517ba['body'][_0x921c('0x58')])return;return db[_0x921c('0x69')][_0x921c('0x4f')]({'where':{'id':_0x5517ba[_0x921c('0x52')]['UserId'],'role':_0x921c('0x5a')},'attributes':['id','name',_0x921c('0x6a'),'email',_0x921c('0x6b')],'raw':!![]});}return null;})['then'](function(_0x16a2d2){if(!_0x16a2d2)return null;_0x2a4327[_0x921c('0x24')][_0x921c('0x5a')]=_0x16a2d2;return _0x2a4327;})[_0x921c('0x30')](function(_0x37d2cc){if(_0x37d2cc){if(_0x5517ba[_0x921c('0x52')][_0x921c('0x6c')]){_0x2a4327[_0x921c('0x24')][_0x921c('0x6d')]=util[_0x921c('0x5d')](_0x921c('0x6e'),_0x5517ba['user'][_0x921c('0x34')]);_0x2a4327['message']['channel']=_0x2a4327[_0x921c('0x6f')];_0x2a4327[_0x921c('0x24')][_0x921c('0x70')]=_0x2a4327[_0x921c('0x6f')];_0x2a4327['message'][_0x921c('0x71')]=_0x921c('0x55');return respondWithRpcPromise(_0x921c('0x72'),'EventManager',{'event':'acceptmessage','message':_0x2a4327[_0x921c('0x24')]},client9002)[_0x921c('0x30')](function(){return _0x2a4327;});}return _0x2a4327;}return null;})[_0x921c('0x30')](respondWithResult(_0x4328da,null))[_0x921c('0x25')](handleError(_0x4328da,null));};var interaction_log=require(_0x921c('0x11'))(_0x921c('0x54'));exports['reject']=function(_0x564dc2,_0x254626,_0x17ed77){var _0x4ef417={'agent':{},'channel':'sms'};if(_0x564dc2['body']['id']){delete _0x564dc2[_0x921c('0x52')]['id'];}_0x564dc2[_0x921c('0x52')][_0x921c('0x58')]=_0x564dc2[_0x921c('0x52')][_0x921c('0x58')]||_0x564dc2[_0x921c('0x59')]['id'];_0x4ef417[_0x921c('0x5a')]['id']=_0x564dc2[_0x921c('0x52')][_0x921c('0x58')];return db[_0x921c('0x36')][_0x921c('0x4f')]({'where':{'id':_0x564dc2[_0x921c('0x4d')]['id'],'UserId':null}})[_0x921c('0x30')](handleEntityNotFound(_0x254626,null))[_0x921c('0x30')](function(_0x1ea2cf){if(_0x1ea2cf){_0x4ef417[_0x921c('0x24')]=_0x1ea2cf[_0x921c('0x5b')]({'plain':!![]});return db['SmsInteraction'][_0x921c('0x4f')]({'where':{'id':_0x1ea2cf['SmsInteractionId']}});}return null;})[_0x921c('0x30')](handleEntityNotFound(_0x254626,null))[_0x921c('0x30')](function(_0x41d98b){if(_0x41d98b){_0x4ef417[_0x921c('0x5f')]=_0x41d98b[_0x921c('0x5b')]({'plain':!![]});interaction_log[_0x921c('0x1d')](_0x921c('0x73'),_0x564dc2['user']['id'],_0x564dc2[_0x921c('0x59')][_0x921c('0x34')],_0x564dc2[_0x921c('0x59')]['role'],_0x4ef417[_0x921c('0x5f')]['id'],_0x564dc2[_0x921c('0x52')]?JSON[_0x921c('0x22')](_0x564dc2[_0x921c('0x52')]):_0x921c('0x62'));return respondWithRpcPromise(_0x921c('0x74'),_0x921c('0x75'),_0x4ef417);}return null;})[_0x921c('0x30')](function(_0x37b2ba){var _0xbafc2b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37b2ba[_0x921c('0x24')][_0x921c('0x76')];return db['sequelize'][_0x921c('0x3b')](_0xbafc2b,{'type':db[_0x921c('0x77')][_0x921c('0x67')][_0x921c('0x78')],'raw':!![]})['then'](function(_0xb5e7d8){return _0xb5e7d8;});})['then'](function(_0x2e1697){if(_0x2e1697){_0x4ef417['message'][_0x921c('0x68')]=_0x2e1697[0x0];if(!_0x564dc2[_0x921c('0x52')][_0x921c('0x58')])return;return db[_0x921c('0x69')][_0x921c('0x4f')]({'where':{'id':_0x564dc2[_0x921c('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x921c('0x34'),_0x921c('0x6a'),_0x921c('0x79'),_0x921c('0x6b')],'raw':!![]});}return null;})[_0x921c('0x30')](function(_0x245968){if(!_0x245968)return null;_0x4ef417[_0x921c('0x24')][_0x921c('0x5a')]=_0x245968;return _0x4ef417;})[_0x921c('0x30')](function(_0x56d79c){if(_0x56d79c){_0x56d79c[_0x921c('0x24')][_0x921c('0x6d')]=util[_0x921c('0x5d')](_0x921c('0x6e'),_0x564dc2[_0x921c('0x59')]['name']);_0x56d79c[_0x921c('0x24')][_0x921c('0x6f')]=_0x4ef417[_0x921c('0x6f')];_0x56d79c[_0x921c('0x24')][_0x921c('0x70')]=_0x4ef417['channel'];_0x56d79c[_0x921c('0x24')]['event']=_0x921c('0x2d');respondWithRpcPromise('EventManager',_0x921c('0x72'),{'event':'rejectmessage','message':_0x56d79c[_0x921c('0x24')]},client9002);return _0x4ef417;}return null;})[_0x921c('0x30')](respondWithResult(_0x254626,null))[_0x921c('0x25')](handleError(_0x254626,null));};exports['status']=function(_0x1066fe,_0x67dfcf,_0x3ce5a2){if(_0x1066fe[_0x921c('0x52')]['id']){delete _0x1066fe['body']['id'];}var _0x423f36;return db[_0x921c('0x36')][_0x921c('0x4f')]({'where':{'id':_0x1066fe[_0x921c('0x4d')]['id']}})[_0x921c('0x30')](handleEntityNotFound(_0x67dfcf,null))[_0x921c('0x30')](function(_0x29aff2){if(_0x29aff2){_0x423f36=_0x29aff2;return db[_0x921c('0x7a')]['find']({'where':{'id':_0x29aff2['SmsAccountId']}});}})[_0x921c('0x30')](handleEntityNotFound(_0x67dfcf,null))[_0x921c('0x30')](function(_0x42ca50){if(_0x42ca50){logger[_0x921c('0x20')](_0x921c('0x21'),_0x921c('0x26'),'received\x20delivery\x20report\x20from',_0x42ca50[_0x921c('0x38')],util[_0x921c('0x7b')](_0x1066fe[_0x921c('0x52')],{'showHidden':![],'depth':null}));switch(_0x42ca50[_0x921c('0x38')]){case'twilio':if(_0x1066fe['body'][_0x921c('0x7c')]&&_0x1066fe[_0x921c('0x52')][_0x921c('0x7c')]===_0x423f36[_0x921c('0x7d')]){return _0x423f36[_0x921c('0x51')]({'read':!![]});}else{logger[_0x921c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x921c('0x7e'),util[_0x921c('0x7b')](_0x1066fe[_0x921c('0x52')],{'showHidden':![],'depth':null}));}break;case _0x921c('0x7f'):if(_0x1066fe[_0x921c('0x52')]['MessageUUID']&&_0x1066fe[_0x921c('0x52')]['MessageUUID']===_0x423f36[_0x921c('0x7d')]&&_['indexOf'](['sent',_0x921c('0x80')],_0x1066fe[_0x921c('0x52')][_0x921c('0x81')])>=0x0){return _0x423f36[_0x921c('0x51')]({'read':!![]});}else{logger[_0x921c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x921c('0x82'),util['inspect'](_0x1066fe[_0x921c('0x52')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xf80603=_0x1066fe[_0x921c('0x52')][_0x921c('0x83')][0x0];if(_0xf80603[_0x921c('0x26')]['groupName']===_0x921c('0x84')){return _0x423f36[_0x921c('0x51')]({'read':!![]});}else{logger[_0x921c('0x23')](_0x921c('0x85'),_0x921c('0x26'),_0x921c('0x86'),util[_0x921c('0x7b')](_0x1066fe['body'],{'showHidden':![],'depth':null}));}break;}return _0x423f36;}})[_0x921c('0x30')](respondWithResult(_0x67dfcf,null))[_0x921c('0x25')](handleError(_0x67dfcf,null));}; \ No newline at end of file +var _0x2525=['null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','email','internal','agent','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','fullname','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','index','map','SmsMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','rawAttributes','length','include','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x201b5e,_0x1adde7){var _0x43fdaf=function(_0x5dd55a){while(--_0x5dd55a){_0x201b5e['push'](_0x201b5e['shift']());}};_0x43fdaf(++_0x1adde7);}(_0x2525,0x1f0));var _0x5252=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2525[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x5252('0x0'));var rimraf=require(_0x5252('0x1'));var zipdir=require(_0x5252('0x2'));var jsonpatch=require(_0x5252('0x3'));var rp=require(_0x5252('0x4'));var moment=require(_0x5252('0x5'));var BPromise=require(_0x5252('0x6'));var Mustache=require(_0x5252('0x7'));var util=require(_0x5252('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5252('0x9'));var ejs=require(_0x5252('0xa'));var fs=require('fs');var fs_extra=require(_0x5252('0xb'));var _=require(_0x5252('0xc'));var squel=require(_0x5252('0xd'));var crypto=require(_0x5252('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5252('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5252('0x10'));var Papa=require(_0x5252('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5252('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5252('0x13'));var logger=require(_0x5252('0x14'))(_0x5252('0x15'));var utils=require(_0x5252('0x16'));var config=require(_0x5252('0x17'));var licenseUtil=require(_0x5252('0x18'));var db=require(_0x5252('0x19'))['db'];config[_0x5252('0x1a')]=_[_0x5252('0x1b')](config[_0x5252('0x1a')],{'host':_0x5252('0x1c'),'port':0x18eb});var socket=require(_0x5252('0x1d'))(new Redis(config[_0x5252('0x1a')]));require(_0x5252('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5252('0x1f')][_0x5252('0x20')]({'port':0x232c});var client9002=jayson[_0x5252('0x1f')][_0x5252('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x399a71,_0x3e54d1,_0x3aeab1,_0x5e1fb4){return new BPromise(function(_0x4b244a,_0x4f7a8d){var _0xa24f14=_0x5e1fb4||client;return _0xa24f14[_0x5252('0x21')](_0x399a71,_0x3aeab1)[_0x5252('0x22')](function(_0x10eb1e){logger[_0x5252('0x23')](_0x5252('0x24'),_0x3e54d1,_0x5252('0x25'));logger['debug'](_0x5252('0x26'),_0x3e54d1,_0x5252('0x25'),JSON[_0x5252('0x27')](_0x10eb1e));if(_0x10eb1e[_0x5252('0x28')]){if(_0x10eb1e[_0x5252('0x28')]['code']===0x1f4){logger[_0x5252('0x28')](_0x5252('0x24'),_0x3e54d1,_0x10eb1e[_0x5252('0x28')][_0x5252('0x29')]);return _0x4f7a8d(_0x10eb1e[_0x5252('0x28')][_0x5252('0x29')]);}logger['error'](_0x5252('0x24'),_0x3e54d1,_0x10eb1e[_0x5252('0x28')]['message']);return _0x4b244a(_0x10eb1e['error']['message']);}else{logger['info'](_0x5252('0x24'),_0x3e54d1,_0x5252('0x25'));_0x4b244a(_0x10eb1e['result'][_0x5252('0x29')]);}})[_0x5252('0x2a')](function(_0x5976e5){logger['error'](_0x5252('0x24'),_0x3e54d1,_0x5976e5);_0x4f7a8d(_0x5976e5);});});}function respondWithStatusCode(_0x57f24c,_0x2d74af){_0x2d74af=_0x2d74af||0xcc;return function(_0xc7f144){if(_0xc7f144){return _0x57f24c[_0x5252('0x2b')](_0x2d74af);}return _0x57f24c[_0x5252('0x2c')](_0x2d74af)[_0x5252('0x2d')]();};}function respondWithResult(_0x5d1b23,_0x537f52){_0x537f52=_0x537f52||0xc8;return function(_0x39e1fd){if(_0x39e1fd){return _0x5d1b23['status'](_0x537f52)[_0x5252('0x2e')](_0x39e1fd);}};}function respondWithFilteredResult(_0x5abb6a,_0x4a7d0b){return function(_0x4fb047){if(_0x4fb047){var _0x4ac8b8=typeof _0x4a7d0b[_0x5252('0x2f')]===_0x5252('0x30')&&typeof _0x4a7d0b[_0x5252('0x31')]==='undefined';var _0x23b62c=_0x4fb047[_0x5252('0x32')];var _0x8fd7df=_0x4ac8b8?0x0:_0x4a7d0b[_0x5252('0x2f')];var _0x346f0a=_0x4ac8b8?_0x4fb047[_0x5252('0x32')]:_0x4a7d0b[_0x5252('0x2f')]+_0x4a7d0b[_0x5252('0x31')];var _0x494fb1;if(_0x346f0a>=_0x23b62c){_0x346f0a=_0x23b62c;_0x494fb1=0xc8;}else{_0x494fb1=0xce;}_0x5abb6a[_0x5252('0x2c')](_0x494fb1);return _0x5abb6a['set'](_0x5252('0x33'),_0x8fd7df+'-'+_0x346f0a+'/'+_0x23b62c)[_0x5252('0x2e')](_0x4fb047);}return null;};}function patchUpdates(_0x3554c7){return function(_0x571883){try{jsonpatch[_0x5252('0x34')](_0x571883,_0x3554c7,!![]);}catch(_0x55ea27){return BPromise[_0x5252('0x35')](_0x55ea27);}return _0x571883[_0x5252('0x36')]();};}function saveUpdates(_0x11708e,_0x452dfb){return function(_0x482dd2){if(_0x482dd2){return _0x482dd2[_0x5252('0x37')](_0x11708e)['then'](function(_0x5cf891){return _0x5cf891;});}return null;};}function removeEntity(_0x5cd743,_0x372edc){return function(_0x5773e8){if(_0x5773e8){return _0x5773e8[_0x5252('0x38')]()[_0x5252('0x22')](function(){_0x5cd743[_0x5252('0x2c')](0xcc)[_0x5252('0x2d')]();});}};}function handleEntityNotFound(_0x4aeb94,_0x4e1c96){return function(_0x4e3b3d){if(!_0x4e3b3d){_0x4aeb94['sendStatus'](0x194);}return _0x4e3b3d;};}function handleError(_0x21a892,_0x1a8480){_0x1a8480=_0x1a8480||0x1f4;return function(_0x3cb4ea){logger[_0x5252('0x28')](_0x3cb4ea['stack']);if(_0x3cb4ea[_0x5252('0x39')]){delete _0x3cb4ea[_0x5252('0x39')];}_0x21a892['status'](_0x1a8480)[_0x5252('0x3a')](_0x3cb4ea);};}exports[_0x5252('0x3b')]=function(_0x43c1ce,_0x5f1cdb){var _0x5b7004={},_0xd54c3d={},_0x536bb8={'count':0x0,'rows':[]};var _0xf96489=_[_0x5252('0x3c')](db[_0x5252('0x3d')]['rawAttributes'],function(_0x2e7a13){return{'name':_0x2e7a13[_0x5252('0x3e')],'type':_0x2e7a13['type'][_0x5252('0x3f')]};});_0xd54c3d[_0x5252('0x40')]=_['map'](_0xf96489,_0x5252('0x39'));_0xd54c3d[_0x5252('0x41')]=_[_0x5252('0x42')](_0x43c1ce[_0x5252('0x41')]);_0xd54c3d[_0x5252('0x43')]=_[_0x5252('0x44')](_0xd54c3d['model'],_0xd54c3d['query']);_0x5b7004[_0x5252('0x45')]=_['intersection'](_0xd54c3d[_0x5252('0x40')],qs['fields'](_0x43c1ce[_0x5252('0x41')][_0x5252('0x46')]));_0x5b7004['attributes']=_0x5b7004[_0x5252('0x45')]['length']?_0x5b7004[_0x5252('0x45')]:_0xd54c3d[_0x5252('0x40')];if(!_0x43c1ce[_0x5252('0x41')][_0x5252('0x47')](_0x5252('0x48'))){_0x5b7004[_0x5252('0x31')]=qs['limit'](_0x43c1ce['query'][_0x5252('0x31')]);_0x5b7004[_0x5252('0x2f')]=qs[_0x5252('0x2f')](_0x43c1ce[_0x5252('0x41')]['offset']);}_0x5b7004['order']=qs[_0x5252('0x49')](_0x43c1ce[_0x5252('0x41')][_0x5252('0x49')]);_0x5b7004['where']=qs[_0x5252('0x43')](_[_0x5252('0x4a')](_0x43c1ce['query'],_0xd54c3d[_0x5252('0x43')]),_0xf96489);if(_0x43c1ce[_0x5252('0x41')][_0x5252('0x4b')]){_0x5b7004['where']=_[_0x5252('0x4c')](_0x5b7004[_0x5252('0x4d')],{'$or':_['map'](_0xf96489,function(_0x1019a7){if(_0x1019a7['type']!==_0x5252('0x4e')){var _0x5a3f76={};_0x5a3f76[_0x1019a7[_0x5252('0x39')]]={'$like':'%'+_0x43c1ce['query'][_0x5252('0x4b')]+'%'};return _0x5a3f76;}})});}_0x5b7004=_[_0x5252('0x4c')]({},_0x5b7004,_0x43c1ce[_0x5252('0x4f')]);var _0x2520d7={'where':_0x5b7004[_0x5252('0x4d')]};return db[_0x5252('0x3d')]['count'](_0x2520d7)[_0x5252('0x22')](function(_0x5a7bf5){_0x536bb8[_0x5252('0x32')]=_0x5a7bf5;if(_0x43c1ce[_0x5252('0x41')][_0x5252('0x50')]){_0x5b7004['include']=[{'all':!![]}];}return db['SmsMessage'][_0x5252('0x51')](_0x5b7004);})['then'](function(_0x2c9c42){_0x536bb8['rows']=_0x2c9c42;return _0x536bb8;})[_0x5252('0x22')](respondWithFilteredResult(_0x5f1cdb,_0x5b7004))[_0x5252('0x2a')](handleError(_0x5f1cdb,null));};exports[_0x5252('0x52')]=function(_0x4dbd29,_0x3c9d5d){var _0x18becf={'raw':!![],'where':{'id':_0x4dbd29['params']['id']}},_0x592677={};_0x592677['model']=_['keys'](db[_0x5252('0x3d')][_0x5252('0x53')]);_0x592677['query']=_['keys'](_0x4dbd29['query']);_0x592677[_0x5252('0x43')]=_[_0x5252('0x44')](_0x592677[_0x5252('0x40')],_0x592677[_0x5252('0x41')]);_0x18becf[_0x5252('0x45')]=_['intersection'](_0x592677['model'],qs[_0x5252('0x46')](_0x4dbd29[_0x5252('0x41')][_0x5252('0x46')]));_0x18becf[_0x5252('0x45')]=_0x18becf['attributes'][_0x5252('0x54')]?_0x18becf[_0x5252('0x45')]:_0x592677['model'];if(_0x4dbd29[_0x5252('0x41')][_0x5252('0x50')]){_0x18becf[_0x5252('0x55')]=[{'all':!![]}];}_0x18becf=_['merge']({},_0x18becf,_0x4dbd29[_0x5252('0x4f')]);return db[_0x5252('0x3d')][_0x5252('0x56')](_0x18becf)['then'](handleEntityNotFound(_0x3c9d5d,null))['then'](respondWithResult(_0x3c9d5d,null))['catch'](handleError(_0x3c9d5d,null));};exports[_0x5252('0x57')]=function(_0xeeee06,_0x3151aa){return db[_0x5252('0x3d')][_0x5252('0x57')](_0xeeee06[_0x5252('0x58')],{})[_0x5252('0x22')](respondWithResult(_0x3151aa,0xc9))[_0x5252('0x2a')](handleError(_0x3151aa,null));};exports[_0x5252('0x37')]=function(_0x516dae,_0x49f62f){if(_0x516dae[_0x5252('0x58')]['id']){delete _0x516dae['body']['id'];}return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x516dae['params']['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x49f62f,null))[_0x5252('0x22')](saveUpdates(_0x516dae[_0x5252('0x58')],null))['then'](respondWithResult(_0x49f62f,null))[_0x5252('0x2a')](handleError(_0x49f62f,null));};exports['destroy']=function(_0xdd056d,_0x5b3a79){return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0xdd056d[_0x5252('0x59')]['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x5b3a79,null))[_0x5252('0x22')](removeEntity(_0x5b3a79,null))[_0x5252('0x2a')](handleError(_0x5b3a79,null));};exports[_0x5252('0x5a')]=function(_0x1b4e84,_0x1f2ab7){return db[_0x5252('0x3d')][_0x5252('0x5a')]()['then'](respondWithResult(_0x1f2ab7,null))[_0x5252('0x2a')](handleError(_0x1f2ab7,null));};var interaction_log=require(_0x5252('0x14'))(_0x5252('0x5b'));exports[_0x5252('0x5c')]=function(_0x4b52fe,_0xe613bc,_0x541222){var _0x385bbe={'agent':{},'channel':_0x5252('0x5d')};if(_0x4b52fe['body']['id']){delete _0x4b52fe[_0x5252('0x58')]['id'];}_0x4b52fe['body']['read']=!![];_0x4b52fe[_0x5252('0x58')][_0x5252('0x5e')]=moment()[_0x5252('0x5f')](_0x5252('0x60'));_0x4b52fe[_0x5252('0x58')]['UserId']=_0x4b52fe[_0x5252('0x58')]['UserId']||_0x4b52fe[_0x5252('0x61')]['id'];_0x385bbe['agent']['id']=_0x4b52fe[_0x5252('0x58')]['UserId'];return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x4b52fe['params']['id'],'UserId':null}})[_0x5252('0x22')](handleEntityNotFound(_0xe613bc,null))[_0x5252('0x22')](saveUpdates(_0x4b52fe[_0x5252('0x58')],null))[_0x5252('0x22')](function(_0x5b2c5d){if(_0x5b2c5d){_0x385bbe['message']=_0x5b2c5d[_0x5252('0x62')]({'plain':!![]});return db[_0x5252('0x63')][_0x5252('0x56')]({'where':{'id':_0x5b2c5d[_0x5252('0x64')]}});}return null;})[_0x5252('0x22')](handleEntityNotFound(_0xe613bc,null))['then'](function(_0x2cc8a5){if(_0x2cc8a5){return _0x2cc8a5['update']({'UserId':_0x4b52fe[_0x5252('0x58')]['UserId'],'read1stAt':_['isNil'](_0x2cc8a5['read1stAt'])?moment()[_0x5252('0x5f')](_0x5252('0x60')):undefined});}return null;})[_0x5252('0x22')](function(_0x331462){if(_0x331462){_0x385bbe[_0x5252('0x65')]=_0x331462[_0x5252('0x62')]({'plain':!![]});interaction_log[_0x5252('0x23')](_0x5252('0x66'),_0x4b52fe[_0x5252('0x61')]['id'],_0x4b52fe[_0x5252('0x61')][_0x5252('0x39')],_0x4b52fe[_0x5252('0x61')][_0x5252('0x67')],_0x385bbe[_0x5252('0x65')]['id'],_0x4b52fe[_0x5252('0x58')]?JSON[_0x5252('0x27')](_0x4b52fe[_0x5252('0x58')]):_0x5252('0x68'));return respondWithRpcPromise(_0x5252('0x69'),'acceptMessage',_0x385bbe);}return null;})[_0x5252('0x22')](function(_0x572106){var _0x3b4f3c=_0x5252('0x6a')+_0x572106[_0x5252('0x29')]['ContactId'];return db[_0x5252('0x6b')][_0x5252('0x41')](_0x3b4f3c,{'type':db[_0x5252('0x6c')][_0x5252('0x6d')][_0x5252('0x6e')],'raw':!![]})[_0x5252('0x22')](function(_0x4a9530){return _0x4a9530;});})['then'](function(_0x3b7e2e){if(_0x3b7e2e){_0x385bbe[_0x5252('0x29')][_0x5252('0x6f')]=_0x3b7e2e[0x0];if(!_0x4b52fe[_0x5252('0x58')][_0x5252('0x70')])return;return db[_0x5252('0x71')]['find']({'where':{'id':_0x4b52fe[_0x5252('0x58')][_0x5252('0x70')],'role':'agent'},'attributes':['id',_0x5252('0x39'),'fullname',_0x5252('0x72'),_0x5252('0x73')],'raw':!![]});}return null;})[_0x5252('0x22')](function(_0x2f86f2){if(!_0x2f86f2)return null;_0x385bbe['message'][_0x5252('0x74')]=_0x2f86f2;return _0x385bbe;})[_0x5252('0x22')](function(_0x3c98a8){if(_0x3c98a8){if(_0x4b52fe['body'][_0x5252('0x75')]){_0x385bbe[_0x5252('0x29')][_0x5252('0x76')]=util[_0x5252('0x5f')]('SIP/%s',_0x4b52fe[_0x5252('0x61')][_0x5252('0x39')]);_0x385bbe['message'][_0x5252('0x77')]=_0x385bbe[_0x5252('0x77')];_0x385bbe[_0x5252('0x29')][_0x5252('0x78')]=_0x385bbe[_0x5252('0x77')];_0x385bbe[_0x5252('0x29')][_0x5252('0x79')]=_0x5252('0x5c');return respondWithRpcPromise('EventManager',_0x5252('0x7a'),{'event':_0x5252('0x7b'),'message':_0x385bbe[_0x5252('0x29')]},client9002)[_0x5252('0x22')](function(){return _0x385bbe;});}return _0x385bbe;}return null;})[_0x5252('0x22')](respondWithResult(_0xe613bc,null))[_0x5252('0x2a')](handleError(_0xe613bc,null));};var interaction_log=require(_0x5252('0x14'))('sms-interactions');exports[_0x5252('0x35')]=function(_0x5e69fd,_0x1fc279,_0x28cd47){var _0x24ccb7={'agent':{},'channel':_0x5252('0x5d')};if(_0x5e69fd[_0x5252('0x58')]['id']){delete _0x5e69fd['body']['id'];}_0x5e69fd['body'][_0x5252('0x70')]=_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')]||_0x5e69fd[_0x5252('0x61')]['id'];_0x24ccb7[_0x5252('0x74')]['id']=_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')];return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x5e69fd[_0x5252('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fc279,null))[_0x5252('0x22')](function(_0x39b1b8){if(_0x39b1b8){_0x24ccb7[_0x5252('0x29')]=_0x39b1b8[_0x5252('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x39b1b8['SmsInteractionId']}});}return null;})[_0x5252('0x22')](handleEntityNotFound(_0x1fc279,null))[_0x5252('0x22')](function(_0x2ef099){if(_0x2ef099){_0x24ccb7[_0x5252('0x65')]=_0x2ef099['get']({'plain':!![]});interaction_log[_0x5252('0x23')](_0x5252('0x7c'),_0x5e69fd[_0x5252('0x61')]['id'],_0x5e69fd[_0x5252('0x61')]['name'],_0x5e69fd[_0x5252('0x61')][_0x5252('0x67')],_0x24ccb7['interaction']['id'],_0x5e69fd[_0x5252('0x58')]?JSON[_0x5252('0x27')](_0x5e69fd[_0x5252('0x58')]):_0x5252('0x68'));return respondWithRpcPromise(_0x5252('0x7d'),_0x5252('0x7e'),_0x24ccb7);}return null;})[_0x5252('0x22')](function(_0x43def3){var _0x34a592=_0x5252('0x6a')+_0x43def3['message'][_0x5252('0x7f')];return db['sequelize'][_0x5252('0x41')](_0x34a592,{'type':db[_0x5252('0x6c')][_0x5252('0x6d')]['SELECT'],'raw':!![]})[_0x5252('0x22')](function(_0x3991a6){return _0x3991a6;});})[_0x5252('0x22')](function(_0x2a7c6d){if(_0x2a7c6d){_0x24ccb7[_0x5252('0x29')]['contact']=_0x2a7c6d[0x0];if(!_0x5e69fd[_0x5252('0x58')]['UserId'])return;return db[_0x5252('0x71')][_0x5252('0x56')]({'where':{'id':_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')],'role':_0x5252('0x74')},'attributes':['id',_0x5252('0x39'),_0x5252('0x80'),_0x5252('0x72'),_0x5252('0x73')],'raw':!![]});}return null;})['then'](function(_0x216c21){if(!_0x216c21)return null;_0x24ccb7[_0x5252('0x29')]['agent']=_0x216c21;return _0x24ccb7;})[_0x5252('0x22')](function(_0x27cce8){if(_0x27cce8){_0x27cce8[_0x5252('0x29')]['interface']=util[_0x5252('0x5f')](_0x5252('0x81'),_0x5e69fd[_0x5252('0x61')][_0x5252('0x39')]);_0x27cce8[_0x5252('0x29')][_0x5252('0x77')]=_0x24ccb7['channel'];_0x27cce8[_0x5252('0x29')][_0x5252('0x78')]=_0x24ccb7[_0x5252('0x77')];_0x27cce8['message'][_0x5252('0x79')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x5252('0x82'),'message':_0x27cce8[_0x5252('0x29')]},client9002);return _0x24ccb7;}return null;})['then'](respondWithResult(_0x1fc279,null))[_0x5252('0x2a')](handleError(_0x1fc279,null));};exports[_0x5252('0x2c')]=function(_0x21ad3d,_0x47b378,_0x26bed0){if(_0x21ad3d[_0x5252('0x58')]['id']){delete _0x21ad3d[_0x5252('0x58')]['id'];}var _0x46beb1;return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x21ad3d[_0x5252('0x59')]['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x47b378,null))[_0x5252('0x22')](function(_0x422e63){if(_0x422e63){_0x46beb1=_0x422e63;return db[_0x5252('0x83')]['find']({'where':{'id':_0x422e63[_0x5252('0x84')]}});}})['then'](handleEntityNotFound(_0x47b378,null))[_0x5252('0x22')](function(_0x4f1a9b){if(_0x4f1a9b){logger['debug'](_0x5252('0x26'),_0x5252('0x2c'),_0x5252('0x85'),_0x4f1a9b[_0x5252('0x86')],util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));switch(_0x4f1a9b[_0x5252('0x86')]){case _0x5252('0x88'):if(_0x21ad3d[_0x5252('0x58')][_0x5252('0x89')]&&_0x21ad3d['body'][_0x5252('0x89')]===_0x46beb1[_0x5252('0x8a')]){return _0x46beb1[_0x5252('0x37')]({'read':!![]});}else{logger['error'](_0x5252('0x8b'),_0x5252('0x2c'),'twilio',util['inspect'](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5252('0x8c'):if(_0x21ad3d['body'][_0x5252('0x8d')]&&_0x21ad3d[_0x5252('0x58')][_0x5252('0x8d')]===_0x46beb1['messageId']&&_[_0x5252('0x8e')]([_0x5252('0x8f'),_0x5252('0x90')],_0x21ad3d[_0x5252('0x58')][_0x5252('0x91')])>=0x0){return _0x46beb1[_0x5252('0x37')]({'read':!![]});}else{logger['error'](_0x5252('0x8b'),_0x5252('0x2c'),'plivio',util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5c8ff7=_0x21ad3d[_0x5252('0x58')][_0x5252('0x92')][0x0];if(_0x5c8ff7[_0x5252('0x2c')][_0x5252('0x93')]===_0x5252('0x94')){return _0x46beb1['update']({'read':!![]});}else{logger[_0x5252('0x28')](_0x5252('0x8b'),_0x5252('0x2c'),_0x5252('0x95'),util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x46beb1;}})[_0x5252('0x22')](respondWithResult(_0x47b378,null))['catch'](handleError(_0x47b378,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1c0c7b2..605f643 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 _0x592a=['update','remove','emit','exports','events','SmsMessage','setMaxListeners','save'];(function(_0x27184c,_0x30e2e2){var _0x4c7a64=function(_0x5cc332){while(--_0x5cc332){_0x27184c['push'](_0x27184c['shift']());}};_0x4c7a64(++_0x30e2e2);}(_0x592a,0x15c));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa592('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xa592('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa592('0x2')](0x0);var events={'afterCreate':_0xa592('0x3'),'afterUpdate':_0xa592('0x4'),'afterDestroy':_0xa592('0x5')};function emitEvent(_0xca7694){return function(_0x4d6944,_0x28f1c1,_0x188d31){SmsMessageEvents[_0xa592('0x6')](_0xca7694+':'+_0x4d6944['id'],_0x4d6944);SmsMessageEvents[_0xa592('0x6')](_0xca7694,_0x4d6944);_0x188d31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xa592('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xee9f=['hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xee9f,0x1f1));var _0xfee9=function(_0xd153cf,_0x13aa8c){_0xd153cf=_0xd153cf-0x0;var _0x347b78=_0xee9f[_0xd153cf];return _0x347b78;};'use strict';var EventEmitter=require(_0xfee9('0x0'));var SmsMessage=require(_0xfee9('0x1'))['db'][_0xfee9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfee9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfee9('0x4'),'afterDestroy':_0xfee9('0x5')};function emitEvent(_0x55481e){return function(_0x438c42,_0x16e64e,_0x5e68a2){SmsMessageEvents[_0xfee9('0x6')](_0x55481e+':'+_0x438c42['id'],_0x438c42);SmsMessageEvents[_0xfee9('0x6')](_0x55481e,_0x438c42);_0x5e68a2(null);};}for(var e in events){if(events[_0xfee9('0x7')](e)){var event=events[e];SmsMessage[_0xfee9('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6a0b063..33d5afa 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 _0x50be=['POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','timestamp','length','md5','digest','signature=','/external/get/send.php?','keys','csc','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','&password=','password','GET','sms'];(function(_0x510b3e,_0x460ac8){var _0x472d35=function(_0x60c899){while(--_0x60c899){_0x510b3e['push'](_0x510b3e['shift']());}};_0x472d35(++_0x460ac8);}(_0x50be,0xb9));var _0xe50b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe50b('0x0'));var util=require('util');var logger=require(_0xe50b('0x1'))(_0xe50b('0x2'));var moment=require(_0xe50b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe50b('0x4'));var fs=require('fs');var path=require(_0xe50b('0x5'));var rimraf=require(_0xe50b('0x6'));var config=require(_0xe50b('0x7'));var attributes=require(_0xe50b('0x8'));module[_0xe50b('0x9')]=function(_0x3a6cf7,_0xd45eb5){return _0x3a6cf7[_0xe50b('0xa')](_0xe50b('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xe50b('0xc'),'fields':[_0xe50b('0xc')]},{'name':_0xe50b('0xd'),'fields':[_0xe50b('0xe')],'type':_0xe50b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x319f2f,_0x1168af,_0x3b8fd6){var _0x5708ec=_0x3a6cf7['models'];var _0x3928f8=_0x319f2f[_0xe50b('0x10')]({'plain':!![]});if(_0x3928f8['direction']['toLowerCase']()==='in'||_0x3928f8[_0xe50b('0x11')][_0xe50b('0x12')]()===_0xe50b('0x13')&&!_0x3928f8['secret']&&!_['isNil'](_0x3928f8[_0xe50b('0x14')])&&!_[_0xe50b('0x15')](_0x3928f8[_0xe50b('0x16')])){_0x5708ec[_0xe50b('0x17')][_0xe50b('0x18')]({'where':{'id':_0x3928f8[_0xe50b('0x16')]}})[_0xe50b('0x19')](function(_0x10092b){if(_0x10092b){_0x10092b['update']({'lastMsgAt':_0x3928f8[_0xe50b('0x1a')],'lastMsgDirection':_0x3928f8['direction'][_0xe50b('0x12')]()});}})[_0xe50b('0x1b')](function(_0x578767){console[_0xe50b('0x1c')](_0x578767);});}if(_0x3928f8['direction']==='out'&&!_0x3928f8[_0xe50b('0x1d')]){var _0x2aea5e;_0x5708ec['SmsAccount'][_0xe50b('0x1e')]({'where':{'id':_0x3928f8[_0xe50b('0x1f')]},'raw':!![]})[_0xe50b('0x19')](function(_0x88eb7c){_0x2aea5e=_0x88eb7c;if(_0x2aea5e&&_0x2aea5e[_0xe50b('0x20')]){switch(_0x2aea5e['type']){case _0xe50b('0x21'):var _0x1ea568=require(_0xe50b('0x21'));if(_0x2aea5e[_0xe50b('0x22')]&&_0x2aea5e[_0xe50b('0x23')]&&_0x2aea5e[_0xe50b('0x24')]){var _0x4f58c4=new _0x1ea568(_0x2aea5e['accountSid'],_0x2aea5e[_0xe50b('0x23')]);_0x4f58c4[_0xe50b('0x25')]['create']({'body':_0x3928f8[_0xe50b('0xe')],'to':_0x3928f8['phone'],'from':_0x2aea5e[_0xe50b('0x24')],'statusCallback':_0x2aea5e['remote']+_0xe50b('0x26')+_0x3928f8['id']+_0xe50b('0x27')+_0x2aea5e['token']})[_0xe50b('0x19')](function(_0x26a233){if(_0x26a233[_0xe50b('0x28')]){return _0x319f2f[_0xe50b('0x29')]({'messageId':_0x26a233[_0xe50b('0x28')]});}})[_0xe50b('0x1b')](function(_0x4888a4){logger['error'](_0xe50b('0x2a'),_0xe50b('0x2b'),'twilio',util[_0xe50b('0x2c')](_0x4888a4,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x21'),_0xe50b('0x2d'));}break;case _0xe50b('0x2e'):var _0x54a3d4='https://api.skebby.it/API/v1.0/REST/';if(_0x2aea5e[_0xe50b('0x2f')]&&_0x2aea5e['password']){var _0x58a184={'recipient':[_0x3928f8['phone']],'message':_0x3928f8[_0xe50b('0xe')],'message_type':_0x2aea5e['smsMethod']};if(_0x2aea5e[_0xe50b('0x30')]&&_0x2aea5e[_0xe50b('0x30')]!=='SI'){_0x58a184[_0xe50b('0x31')]=_0x2aea5e[_0xe50b('0x24')];}var _0x3218c0={'url':_0x54a3d4+_0xe50b('0x32')+_0x2aea5e[_0xe50b('0x2f')]+_0xe50b('0x33')+_0x2aea5e[_0xe50b('0x34')],'method':_0xe50b('0x35')};rp(_0x3218c0)[_0xe50b('0x19')](function(_0x2e4fdf){var _0x82c450=_0x2e4fdf['split'](';');var _0x46cff4={'user_key':_0x82c450[0x0],'session_key':_0x82c450[0x1]};_0x3218c0={'url':_0x54a3d4+_0xe50b('0x36'),'method':_0xe50b('0x37'),'headers':{'user_key':_0x46cff4[_0xe50b('0x38')],'Session_key':_0x46cff4[_0xe50b('0x39')]},'json':!![],'body':_0x58a184};return rp(_0x3218c0);})[_0xe50b('0x19')](function(_0x3df24a){if(_0x3df24a[_0xe50b('0x3a')]>=0x1){var _0x4a50cf={'messageId':_0x3df24a[_0xe50b('0x3b')]};if(_0x2aea5e[_0xe50b('0x30')]!=='GP'||!_0x2aea5e[_0xe50b('0x3c')]){_0x4a50cf[_0xe50b('0x3d')]=!![];}return _0x319f2f[_0xe50b('0x29')](_0x4a50cf);}else{return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x2e'),util['inspect'](_0x3df24a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x393722){return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x2e'),util[_0xe50b('0x2c')](_0x393722,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe50b('0x3e'):if(_0x2aea5e[_0xe50b('0x23')]){var _0x2c3d59={'recipient':_0x3928f8[_0xe50b('0x24')],'message':_0x3928f8[_0xe50b('0xe')],'sender':_0x2aea5e[_0xe50b('0x3f')]||_0x2aea5e[_0xe50b('0x24')],'authorization':_0x2aea5e[_0xe50b('0x23')]};var _0x1168af={'method':_0xe50b('0x37'),'uri':_0xe50b('0x40'),'body':_0x2c3d59,'json':!![]};rp(_0x1168af)[_0xe50b('0x19')](function(_0x3fbe52){var _0x53a2f7={'messageId':_0x3fbe52['requestid']};if(!_0x2aea5e['deliveryReport']){_0x53a2f7[_0xe50b('0x3d')]=!![];}return _0x319f2f[_0xe50b('0x29')](_0x53a2f7);})[_0xe50b('0x1b')](function(_0x5d33cf){logger['error'](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x3e'),util[_0xe50b('0x2c')](_0x5d33cf,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x3e'),_0xe50b('0x41'));}break;case _0xe50b('0x42'):if(_0x2aea5e[_0xe50b('0x2f')]&&_0x2aea5e[_0xe50b('0x34')]){var _0x2c3d59={'messages':[{'source':_0xe50b('0x43'),'to':_0x3928f8[_0xe50b('0x24')],'body':_0x3928f8[_0xe50b('0xe')],'from':_0x2aea5e[_0xe50b('0x3f')]||_0x2aea5e['phone']}]};var _0x5c16c4=util[_0xe50b('0x44')](_0xe50b('0x45'),_0x2aea5e[_0xe50b('0x2f')],_0x2aea5e['password']);var _0x1168af={'method':_0xe50b('0x37'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2c3d59,'headers':{'Authorization':util[_0xe50b('0x44')](_0xe50b('0x46'),new Buffer(_0x5c16c4)['toString']('base64'))},'json':!![]};rp(_0x1168af)[_0xe50b('0x19')](function(_0x5ab92f){if(_0x5ab92f[_0xe50b('0x47')]>=0xc8&&_0x5ab92f[_0xe50b('0x47')]<=0xce){if(_0x5ab92f[_0xe50b('0x48')]&&_0x5ab92f[_0xe50b('0x48')][_0xe50b('0x49')]>0x0){var _0x4c80d5=_[_0xe50b('0x4a')](_0x5ab92f[_0xe50b('0x48')][_0xe50b('0x25')]);var _0x4ca050={'messageId':_0x4c80d5['message_id']};if(!_0x2aea5e[_0xe50b('0x3c')]){_0x4ca050['read']=!![];}return _0x319f2f[_0xe50b('0x29')](_0x4ca050);}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x4b'),util[_0xe50b('0x2c')](_0x5ab92f,{'showHidden':![],'depth':null}));}}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),'clickSend',util[_0xe50b('0x2c')](_0x5ab92f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2b8c0d){logger['error'](_0xe50b('0x2a'),'afterCreate','clickSend',util[_0xe50b('0x2c')](_0x2b8c0d,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x4b'),_0xe50b('0x4c'));}break;case _0xe50b('0x4d'):if(_0x2aea5e[_0xe50b('0x4e')]&&_0x2aea5e['authToken']){var _0x2c3d59={'dst':_0x3928f8[_0xe50b('0x24')],'text':_0x3928f8[_0xe50b('0xe')],'src':_0x2aea5e['senderString']||_0x2aea5e[_0xe50b('0x24')],'url':_0x2aea5e[_0xe50b('0x4f')]+_0xe50b('0x26')+_0x3928f8['id']+_0xe50b('0x27')+_0x2aea5e[_0xe50b('0x50')]};var _0x5c16c4=util[_0xe50b('0x44')](_0xe50b('0x45'),_0x2aea5e[_0xe50b('0x4e')],_0x2aea5e['authToken']);var _0x1168af={'method':'POST','uri':util[_0xe50b('0x44')](_0xe50b('0x51'),_0x2aea5e[_0xe50b('0x4e')]),'body':_0x2c3d59,'headers':{'Authorization':util[_0xe50b('0x44')](_0xe50b('0x46'),new Buffer(_0x5c16c4)['toString']('base64'))},'json':!![]};rp(_0x1168af)[_0xe50b('0x19')](function(_0x2b2538){var _0x98ef1c={'messageId':_0x2b2538[_0xe50b('0x52')][0x0]};return _0x319f2f[_0xe50b('0x29')](_0x98ef1c);})[_0xe50b('0x1b')](function(_0x29a56b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe50b('0x2b'),_0xe50b('0x4d'),util[_0xe50b('0x2c')](_0x29a56b,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x4d'),_0xe50b('0x53'));}break;case _0xe50b('0x54'):if(_0x2aea5e[_0xe50b('0x2f')]&&_0x2aea5e['password']){if(_0x2aea5e[_0xe50b('0x55')]){var _0x19ccf5={'method':_0xe50b('0x37'),'uri':_0x2aea5e[_0xe50b('0x55')]+_0xe50b('0x56'),'body':{'username':_0x2aea5e['username'],'password':_0x2aea5e['password']},'json':!![]};return rp(_0x19ccf5)['then'](function(_0x526dcd){var _0x563c99={'method':_0xe50b('0x37'),'uri':_0x2aea5e[_0xe50b('0x55')]+_0xe50b('0x57'),'body':{'messages':[{'from':_0x2aea5e[_0xe50b('0x24')],'destinations':[{'to':_0x3928f8['phone']}],'text':_0x3928f8[_0xe50b('0xe')],'notifyUrl':_0x2aea5e[_0xe50b('0x4f')]+_0xe50b('0x26')+_0x3928f8['id']+'/status?token='+_0x2aea5e[_0xe50b('0x50')],'notifyContentType':_0xe50b('0x58'),'callbackData':_0x2aea5e[_0xe50b('0x24')]+';'+_0x3928f8[_0xe50b('0xe')]}]},'headers':{'Authorization':_0xe50b('0x59')+_0x526dcd[_0xe50b('0x50')]},'json':!![]};return rp(_0x563c99)['then'](function(_0x450dea){if(_0x450dea[_0xe50b('0x25')]){var _0x2fb919={'messageId':_0x450dea[_0xe50b('0x25')][0x0][_0xe50b('0xc')]};if(!_0x2aea5e[_0xe50b('0x3c')]){_0x2fb919[_0xe50b('0x3d')]=!![];}return _0x319f2f['update'](_0x2fb919);}else{return logger[_0xe50b('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe50b('0x2b'),_0xe50b('0x54'),util['inspect'](_0x450dea,{'showHidden':![],'depth':null}));}});})[_0xe50b('0x1b')](function(_0x18292c){return logger['error'](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x54'),util['inspect'](_0x18292c,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x54'),_0xe50b('0x4c'));}break;case'csc':var _0x3d5e91=require(_0xe50b('0x5a'));if(_0x2aea5e[_0xe50b('0x5b')]){var _0x2f5ed3={};_0x2f5ed3['login']=_0x2aea5e['username'];_0x2f5ed3[_0xe50b('0x24')]=_0x3928f8[_0xe50b('0x24')];_0x2f5ed3['sender']=_0x2aea5e[_0xe50b('0x24')];_0x2f5ed3['text']=_0x3928f8[_0xe50b('0xe')];_0x2f5ed3[_0xe50b('0x5c')]=+new Date();var _0x18fcb2='';var _0x53724b='';var _0x299724=Object['keys'](_0x2f5ed3);_0x299724['sort']();for(var _0x45fb48=0x0;_0x45fb48<_0x299724[_0xe50b('0x5d')];_0x45fb48++){if(_0x18fcb2!=''){_0x18fcb2+='&';}_0x18fcb2+=_0x299724[_0x45fb48]+'='+encodeURIComponent(_0x2f5ed3[_0x299724[_0x45fb48]]);_0x53724b+=_0x2f5ed3[_0x299724[_0x45fb48]];}_0x53724b+=_0x2aea5e[_0xe50b('0x5b')];_0x53724b=_0x3d5e91['createHash'](_0xe50b('0x5e'))[_0xe50b('0x29')](_0x53724b)[_0xe50b('0x5f')]('hex');if(_0x18fcb2!==''){_0x18fcb2+='&';}_0x18fcb2+=_0xe50b('0x60')+_0x53724b;var _0x3218c0={'method':'GET','uri':_0x2aea5e[_0xe50b('0x55')]+_0xe50b('0x61')+_0x18fcb2,'json':!![]};return rp(_0x3218c0)[_0xe50b('0x19')](function(_0xeee251){var _0x27d9d0=Object[_0xe50b('0x62')](_0xeee251);if(_0xeee251[_0x27d9d0[0x0]][_0xe50b('0x1c')]&&parseInt(_0xeee251[_0x27d9d0[0x0]][_0xe50b('0x1c')])===0x0){var _0x1fd2fa={'messageId':_0xeee251[_0x27d9d0[0x0]]['id_sms']};if(!_0x2aea5e['deliveryReport']){_0x1fd2fa[_0xe50b('0x3d')]=!![];}return _0x319f2f[_0xe50b('0x29')](_0x1fd2fa);}else{return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x63'),util[_0xe50b('0x2c')](_0xeee251[_0xe50b('0x1c')],{'showHidden':![],'depth':null}));}})[_0xe50b('0x1b')](function(_0x11700b){return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x63'),util[_0xe50b('0x2c')](_0x11700b,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate',_0xe50b('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0xe50b('0x64'):if(_0x2aea5e['apiKey']){var _0x33d127={'method':_0xe50b('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2aea5e[_0xe50b('0x5b')]},'body':{'content':_0x3928f8[_0xe50b('0xe')],'to':[_0x3928f8[_0xe50b('0x24')]],'from':_0x2aea5e[_0xe50b('0x24')],'binary':![],'clientMessageId':_0xe50b('0x65'),'charset':_0xe50b('0x66')},'json':!![]};rp(_0x33d127)['then'](function(_0x2b34e){if(!_0x2b34e[_0xe50b('0x1c')]){var _0x31ff23={'messageId':_0x2b34e[_0xe50b('0x25')][0x0][_0xe50b('0x67')]};if(!_0x2aea5e[_0xe50b('0x3c')]){_0x31ff23[_0xe50b('0x3d')]=!![];}return _0x319f2f['update'](_0x31ff23);}else{return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),'clickatell',util[_0xe50b('0x2c')](_0x2b34e[_0xe50b('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2f7f1c){return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),'afterCreate','clickatell',util[_0xe50b('0x2c')](_0x2f7f1c,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),'clickatell',_0xe50b('0x68'));}break;case _0xe50b('0x69'):if(_0x2aea5e[_0xe50b('0x2f')]&&_0x2aea5e[_0xe50b('0x34')]){var _0x5c16c4=util[_0xe50b('0x44')](_0xe50b('0x45'),_0x2aea5e['username'],_0x2aea5e[_0xe50b('0x34')]);var _0x1168af={'method':_0xe50b('0x37'),'uri':_0xe50b('0x6a')+_0x2aea5e['accountId']+_0xe50b('0x6b'),'body':{'to':[_0x3928f8[_0xe50b('0x24')]],'text':_0x3928f8[_0xe50b('0xe')],'from':_0x2aea5e[_0xe50b('0x24')],'applicationId':_0x2aea5e[_0xe50b('0x6c')]},'headers':{'Authorization':util['format'](_0xe50b('0x46'),new Buffer(_0x5c16c4)['toString'](_0xe50b('0x6d')))},'json':!![]};rp(_0x1168af)[_0xe50b('0x19')](function(_0x3c43ca){if(_0x3c43ca['id']){var _0x5ae87f={'messageId':_0x3c43ca['id']};return _0x319f2f[_0xe50b('0x29')](_0x5ae87f);}else{logger[_0xe50b('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe50b('0x69'),util[_0xe50b('0x2c')](_0x3c43ca,{'showHidden':![],'depth':null}));}})[_0xe50b('0x1b')](function(_0xaa8c11){logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x69'),util[_0xe50b('0x2c')](_0xaa8c11,{'showHidden':![],'depth':null}));});}else{logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x69'),_0xe50b('0x4c'));}break;case _0xe50b('0x6e'):if(_0x2aea5e[_0xe50b('0x5b')]){var _0x254b0d={};var _0x3218c0={'method':_0xe50b('0x37'),'uri':_0xe50b('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x2aea5e[_0xe50b('0x5b')],'Content-Type':_0xe50b('0x58')},'body':{'from':_0x2aea5e[_0xe50b('0x24')],'to':_0x3928f8[_0xe50b('0x24')],'text':_0x3928f8[_0xe50b('0xe')]},'json':!![]};return rp(_0x3218c0)[_0xe50b('0x19')](function(_0xe2c068){if(_0xe2c068[_0xe50b('0x70')]==0xca){_0x254b0d[_0xe50b('0x71')]=_0xe2c068;var _0x82dc7d={'method':_0xe50b('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe50b('0x72')+_0x2aea5e['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x254b0d[_0xe50b('0x71')]['refid']},'json':!![]};return rp(_0x82dc7d)['then'](function(_0x4fe87f){_0x254b0d[_0xe50b('0x73')]=_0x4fe87f;var _0x45438a={'messageId':_0x254b0d[_0xe50b('0x71')][_0xe50b('0x74')],'read':!![]};return _0x319f2f[_0xe50b('0x29')](_0x45438a);});}else{return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),_0xe50b('0x6e'),util[_0xe50b('0x2c')](_0xe2c068,{'showHidden':![],'depth':null}));}})[_0xe50b('0x1b')](function(_0x456051){return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),'intelepeer',util[_0xe50b('0x2c')](_0x456051,{'showHidden':![],'depth':null}));});}else{return logger[_0xe50b('0x1c')](_0xe50b('0x2a'),_0xe50b('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xe50b('0x75')](function(){_0x3b8fd6();});}else{_0x3b8fd6();}}},'charset':_0xe50b('0x76'),'collate':_0xe50b('0x77')});}; \ No newline at end of file +var _0x0cf1=['/api/sms/messages/','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','requestid','connectel','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','length','md5','digest','hex','/external/get/send.php?','keys','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Bearer\x20','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','update','catch','SmsAccount','find','SmsAccountId','then','twilio','authToken','phone','create','body','remote'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x0cf1,0xcf));var _0x10cf=function(_0x5c4cc4,_0x11437e){_0x5c4cc4=_0x5c4cc4-0x0;var _0x57316d=_0x0cf1[_0x5c4cc4];return _0x57316d;};'use strict';var _=require(_0x10cf('0x0'));var util=require(_0x10cf('0x1'));var logger=require('../../config/logger')(_0x10cf('0x2'));var moment=require(_0x10cf('0x3'));var BPromise=require(_0x10cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10cf('0x5'));var rimraf=require(_0x10cf('0x6'));var config=require(_0x10cf('0x7'));var attributes=require('./smsMessage.attributes');module[_0x10cf('0x8')]=function(_0x17eb70,_0xd6f689){return _0x17eb70['define'](_0x10cf('0x9'),attributes,{'tableName':_0x10cf('0xa'),'paranoid':![],'indexes':[{'name':_0x10cf('0xb'),'fields':[_0x10cf('0xb')]},{'name':_0x10cf('0xc'),'fields':['body'],'type':_0x10cf('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f95cd,_0x2febcd,_0x589b0c){var _0x15b7a9=_0x17eb70[_0x10cf('0xe')];var _0x1be308=_0x2f95cd[_0x10cf('0xf')]({'plain':!![]});if(_0x1be308[_0x10cf('0x10')][_0x10cf('0x11')]()==='in'||_0x1be308['direction']['toLowerCase']()===_0x10cf('0x12')&&!_0x1be308[_0x10cf('0x13')]&&!_['isNil'](_0x1be308[_0x10cf('0x14')])&&!_[_0x10cf('0x15')](_0x1be308['SmsInteractionId'])){_0x15b7a9['SmsInteraction']['findOne']({'where':{'id':_0x1be308[_0x10cf('0x16')]}})['then'](function(_0x149b1a){if(_0x149b1a){_0x149b1a[_0x10cf('0x17')]({'lastMsgAt':_0x1be308['createdAt'],'lastMsgDirection':_0x1be308[_0x10cf('0x10')]['toLowerCase']()});}})[_0x10cf('0x18')](function(_0x1c0431){console['error'](_0x1c0431);});}if(_0x1be308[_0x10cf('0x10')]===_0x10cf('0x12')&&!_0x1be308[_0x10cf('0x13')]){var _0x75525c;_0x15b7a9[_0x10cf('0x19')][_0x10cf('0x1a')]({'where':{'id':_0x1be308[_0x10cf('0x1b')]},'raw':!![]})[_0x10cf('0x1c')](function(_0x3426f2){_0x75525c=_0x3426f2;if(_0x75525c&&_0x75525c['type']){switch(_0x75525c['type']){case _0x10cf('0x1d'):var _0x4a06bf=require('twilio');if(_0x75525c['accountSid']&&_0x75525c[_0x10cf('0x1e')]&&_0x75525c[_0x10cf('0x1f')]){var _0x146bbe=new _0x4a06bf(_0x75525c['accountSid'],_0x75525c[_0x10cf('0x1e')]);_0x146bbe['messages'][_0x10cf('0x20')]({'body':_0x1be308[_0x10cf('0x21')],'to':_0x1be308[_0x10cf('0x1f')],'from':_0x75525c['phone'],'statusCallback':_0x75525c[_0x10cf('0x22')]+_0x10cf('0x23')+_0x1be308['id']+'/status?token='+_0x75525c['token']})[_0x10cf('0x1c')](function(_0xf6c6a){if(_0xf6c6a[_0x10cf('0x24')]){return _0x2f95cd[_0x10cf('0x17')]({'messageId':_0xf6c6a[_0x10cf('0x24')]});}})[_0x10cf('0x18')](function(_0xb537f8){logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x1d'),util['inspect'](_0xb537f8,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),'twilio',_0x10cf('0x28'));}break;case'skebby':var _0xd22d9e=_0x10cf('0x29');if(_0x75525c[_0x10cf('0x2a')]&&_0x75525c[_0x10cf('0x2b')]){var _0x21d9e2={'recipient':[_0x1be308[_0x10cf('0x1f')]],'message':_0x1be308[_0x10cf('0x21')],'message_type':_0x75525c['smsMethod']};if(_0x75525c['smsMethod']&&_0x75525c['smsMethod']!=='SI'){_0x21d9e2[_0x10cf('0x2c')]=_0x75525c[_0x10cf('0x1f')];}var _0x2e26ea={'url':_0xd22d9e+_0x10cf('0x2d')+_0x75525c[_0x10cf('0x2a')]+_0x10cf('0x2e')+_0x75525c[_0x10cf('0x2b')],'method':_0x10cf('0x2f')};rp(_0x2e26ea)['then'](function(_0x1fa3e7){var _0x2516a5=_0x1fa3e7[_0x10cf('0x30')](';');var _0x576f7a={'user_key':_0x2516a5[0x0],'session_key':_0x2516a5[0x1]};_0x2e26ea={'url':_0xd22d9e+_0x10cf('0x31'),'method':_0x10cf('0x32'),'headers':{'user_key':_0x576f7a[_0x10cf('0x33')],'Session_key':_0x576f7a[_0x10cf('0x34')]},'json':!![],'body':_0x21d9e2};return rp(_0x2e26ea);})['then'](function(_0xda3e2){if(_0xda3e2[_0x10cf('0x35')]>=0x1){var _0x248495={'messageId':_0xda3e2[_0x10cf('0x36')]};if(_0x75525c[_0x10cf('0x37')]!=='GP'||!_0x75525c[_0x10cf('0x38')]){_0x248495[_0x10cf('0x39')]=!![];}return _0x2f95cd[_0x10cf('0x17')](_0x248495);}else{return logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x3a'),util[_0x10cf('0x3b')](_0xda3e2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3fe718){return logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),'skebby',util[_0x10cf('0x3b')](_0x3fe718,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x3a'),_0x10cf('0x3c'));}break;case'connectel':if(_0x75525c['authToken']){var _0x23bdbb={'recipient':_0x1be308['phone'],'message':_0x1be308['body'],'sender':_0x75525c[_0x10cf('0x3d')]||_0x75525c[_0x10cf('0x1f')],'authorization':_0x75525c[_0x10cf('0x1e')]};var _0x2febcd={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x23bdbb,'json':!![]};rp(_0x2febcd)[_0x10cf('0x1c')](function(_0x1ba125){var _0x1aa696={'messageId':_0x1ba125[_0x10cf('0x3e')]};if(!_0x75525c[_0x10cf('0x38')]){_0x1aa696['read']=!![];}return _0x2f95cd[_0x10cf('0x17')](_0x1aa696);})[_0x10cf('0x18')](function(_0x4efde9){logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x3f'),util[_0x10cf('0x3b')](_0x4efde9,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x3f'),'Missing\x20parameters:\x20authToken');}break;case _0x10cf('0x40'):if(_0x75525c['username']&&_0x75525c[_0x10cf('0x2b')]){var _0x23bdbb={'messages':[{'source':_0x10cf('0x41'),'to':_0x1be308[_0x10cf('0x1f')],'body':_0x1be308[_0x10cf('0x21')],'from':_0x75525c[_0x10cf('0x3d')]||_0x75525c[_0x10cf('0x1f')]}]};var _0x4621ee=util[_0x10cf('0x42')]('%s:%s',_0x75525c[_0x10cf('0x2a')],_0x75525c[_0x10cf('0x2b')]);var _0x2febcd={'method':'POST','uri':_0x10cf('0x43'),'body':_0x23bdbb,'headers':{'Authorization':util[_0x10cf('0x42')](_0x10cf('0x44'),new Buffer(_0x4621ee)[_0x10cf('0x45')](_0x10cf('0x46')))},'json':!![]};rp(_0x2febcd)[_0x10cf('0x1c')](function(_0x438fc5){if(_0x438fc5[_0x10cf('0x47')]>=0xc8&&_0x438fc5['http_code']<=0xce){if(_0x438fc5[_0x10cf('0x48')]&&_0x438fc5['data'][_0x10cf('0x49')]>0x0){var _0x19509e=_[_0x10cf('0x4a')](_0x438fc5[_0x10cf('0x48')][_0x10cf('0x4b')]);var _0x5bd795={'messageId':_0x19509e[_0x10cf('0x4c')]};if(!_0x75525c['deliveryReport']){_0x5bd795[_0x10cf('0x39')]=!![];}return _0x2f95cd[_0x10cf('0x17')](_0x5bd795);}else{logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x4d'),util[_0x10cf('0x3b')](_0x438fc5,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x4d'),util[_0x10cf('0x3b')](_0x438fc5,{'showHidden':![],'depth':null}));}})[_0x10cf('0x18')](function(_0x4d6b69){logger[_0x10cf('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10cf('0x27'),_0x10cf('0x4d'),util[_0x10cf('0x3b')](_0x4d6b69,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),'afterCreate',_0x10cf('0x4d'),_0x10cf('0x3c'));}break;case _0x10cf('0x4e'):if(_0x75525c[_0x10cf('0x4f')]&&_0x75525c['authToken']){var _0x23bdbb={'dst':_0x1be308[_0x10cf('0x1f')],'text':_0x1be308[_0x10cf('0x21')],'src':_0x75525c[_0x10cf('0x3d')]||_0x75525c[_0x10cf('0x1f')],'url':_0x75525c['remote']+_0x10cf('0x23')+_0x1be308['id']+'/status?token='+_0x75525c[_0x10cf('0x50')]};var _0x4621ee=util[_0x10cf('0x42')](_0x10cf('0x51'),_0x75525c['authId'],_0x75525c[_0x10cf('0x1e')]);var _0x2febcd={'method':'POST','uri':util[_0x10cf('0x42')](_0x10cf('0x52'),_0x75525c[_0x10cf('0x4f')]),'body':_0x23bdbb,'headers':{'Authorization':util[_0x10cf('0x42')]('Basic\x20%s',new Buffer(_0x4621ee)['toString'](_0x10cf('0x46')))},'json':!![]};rp(_0x2febcd)[_0x10cf('0x1c')](function(_0x82447a){var _0x4cb2c2={'messageId':_0x82447a['message_uuid'][0x0]};return _0x2f95cd[_0x10cf('0x17')](_0x4cb2c2);})['catch'](function(_0x1f8a7e){logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x4e'),util['inspect'](_0x1f8a7e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x10cf('0x26'),'afterCreate',_0x10cf('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x10cf('0x53'):if(_0x75525c[_0x10cf('0x2a')]&&_0x75525c[_0x10cf('0x2b')]){if(_0x75525c['baseUrl']){var _0x57a89c={'method':_0x10cf('0x32'),'uri':_0x75525c[_0x10cf('0x54')]+_0x10cf('0x55'),'body':{'username':_0x75525c[_0x10cf('0x2a')],'password':_0x75525c[_0x10cf('0x2b')]},'json':!![]};return rp(_0x57a89c)[_0x10cf('0x1c')](function(_0x45f249){var _0x31fa47={'method':_0x10cf('0x32'),'uri':_0x75525c['baseUrl']+_0x10cf('0x56'),'body':{'messages':[{'from':_0x75525c[_0x10cf('0x1f')],'destinations':[{'to':_0x1be308[_0x10cf('0x1f')]}],'text':_0x1be308[_0x10cf('0x21')],'notifyUrl':_0x75525c[_0x10cf('0x22')]+'/api/sms/messages/'+_0x1be308['id']+_0x10cf('0x57')+_0x75525c['token'],'notifyContentType':_0x10cf('0x58'),'callbackData':_0x75525c[_0x10cf('0x1f')]+';'+_0x1be308[_0x10cf('0x21')]}]},'headers':{'Authorization':_0x10cf('0x59')+_0x45f249[_0x10cf('0x50')]},'json':!![]};return rp(_0x31fa47)[_0x10cf('0x1c')](function(_0x31f7f0){if(_0x31f7f0['messages']){var _0x4b5e19={'messageId':_0x31f7f0['messages'][0x0][_0x10cf('0xb')]};if(!_0x75525c[_0x10cf('0x38')]){_0x4b5e19[_0x10cf('0x39')]=!![];}return _0x2f95cd['update'](_0x4b5e19);}else{return logger[_0x10cf('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10cf('0x27'),'infobip',util['inspect'](_0x31f7f0,{'showHidden':![],'depth':null}));}});})[_0x10cf('0x18')](function(_0x313e2b){return logger['error'](_0x10cf('0x26'),'afterCreate',_0x10cf('0x53'),util[_0x10cf('0x3b')](_0x313e2b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x53'),_0x10cf('0x5a'));}}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x53'),_0x10cf('0x3c'));}break;case'csc':var _0x2d9d4d=require(_0x10cf('0x5b'));if(_0x75525c[_0x10cf('0x5c')]){var _0x572b78={};_0x572b78[_0x10cf('0x5d')]=_0x75525c[_0x10cf('0x2a')];_0x572b78[_0x10cf('0x1f')]=_0x1be308[_0x10cf('0x1f')];_0x572b78[_0x10cf('0x2c')]=_0x75525c[_0x10cf('0x1f')];_0x572b78[_0x10cf('0x5e')]=_0x1be308['body'];_0x572b78['timestamp']=+new Date();var _0x17abf5='';var _0x4d66af='';var _0x5833d1=Object['keys'](_0x572b78);_0x5833d1['sort']();for(var _0x11f35e=0x0;_0x11f35e<_0x5833d1[_0x10cf('0x5f')];_0x11f35e++){if(_0x17abf5!=''){_0x17abf5+='&';}_0x17abf5+=_0x5833d1[_0x11f35e]+'='+encodeURIComponent(_0x572b78[_0x5833d1[_0x11f35e]]);_0x4d66af+=_0x572b78[_0x5833d1[_0x11f35e]];}_0x4d66af+=_0x75525c[_0x10cf('0x5c')];_0x4d66af=_0x2d9d4d['createHash'](_0x10cf('0x60'))[_0x10cf('0x17')](_0x4d66af)[_0x10cf('0x61')](_0x10cf('0x62'));if(_0x17abf5!==''){_0x17abf5+='&';}_0x17abf5+='signature='+_0x4d66af;var _0x2e26ea={'method':_0x10cf('0x2f'),'uri':_0x75525c['baseUrl']+_0x10cf('0x63')+_0x17abf5,'json':!![]};return rp(_0x2e26ea)[_0x10cf('0x1c')](function(_0x5bbbde){var _0x199648=Object[_0x10cf('0x64')](_0x5bbbde);if(_0x5bbbde[_0x199648[0x0]]['error']&&parseInt(_0x5bbbde[_0x199648[0x0]][_0x10cf('0x25')])===0x0){var _0x24a230={'messageId':_0x5bbbde[_0x199648[0x0]]['id_sms']};if(!_0x75525c[_0x10cf('0x38')]){_0x24a230[_0x10cf('0x39')]=!![];}return _0x2f95cd[_0x10cf('0x17')](_0x24a230);}else{return logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),'csc',util[_0x10cf('0x3b')](_0x5bbbde[_0x10cf('0x25')],{'showHidden':![],'depth':null}));}})[_0x10cf('0x18')](function(_0x14e9ce){return logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x65'),util['inspect'](_0x14e9ce,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10cf('0x27'),'csc',_0x10cf('0x66'));}break;case _0x10cf('0x67'):if(_0x75525c[_0x10cf('0x5c')]){var _0x3c968a={'method':_0x10cf('0x32'),'uri':_0x10cf('0x68'),'headers':{'Authorization':_0x75525c[_0x10cf('0x5c')]},'body':{'content':_0x1be308['body'],'to':[_0x1be308[_0x10cf('0x1f')]],'from':_0x75525c['phone'],'binary':![],'clientMessageId':_0x10cf('0x69'),'charset':_0x10cf('0x6a')},'json':!![]};rp(_0x3c968a)[_0x10cf('0x1c')](function(_0x15c5c5){if(!_0x15c5c5[_0x10cf('0x25')]){var _0x46102b={'messageId':_0x15c5c5[_0x10cf('0x4b')][0x0][_0x10cf('0x6b')]};if(!_0x75525c[_0x10cf('0x38')]){_0x46102b['read']=!![];}return _0x2f95cd[_0x10cf('0x17')](_0x46102b);}else{return logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x67'),util[_0x10cf('0x3b')](_0x15c5c5[_0x10cf('0x25')],{'showHidden':![],'depth':null}));}})[_0x10cf('0x18')](function(_0x5bde99){return logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),'clickatell',util[_0x10cf('0x3b')](_0x5bde99,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),'afterCreate',_0x10cf('0x67'),_0x10cf('0x66'));}break;case _0x10cf('0x6c'):if(_0x75525c['username']&&_0x75525c[_0x10cf('0x2b')]){var _0x4621ee=util[_0x10cf('0x42')](_0x10cf('0x51'),_0x75525c[_0x10cf('0x2a')],_0x75525c[_0x10cf('0x2b')]);var _0x2febcd={'method':_0x10cf('0x32'),'uri':_0x10cf('0x6d')+_0x75525c['accountId']+_0x10cf('0x6e'),'body':{'to':[_0x1be308[_0x10cf('0x1f')]],'text':_0x1be308['body'],'from':_0x75525c[_0x10cf('0x1f')],'applicationId':_0x75525c[_0x10cf('0x6f')]},'headers':{'Authorization':util[_0x10cf('0x42')](_0x10cf('0x44'),new Buffer(_0x4621ee)[_0x10cf('0x45')](_0x10cf('0x46')))},'json':!![]};rp(_0x2febcd)['then'](function(_0x4ff350){if(_0x4ff350['id']){var _0x19974f={'messageId':_0x4ff350['id']};return _0x2f95cd[_0x10cf('0x17')](_0x19974f);}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),'afterCreate','bandwidth',util['inspect'](_0x4ff350,{'showHidden':![],'depth':null}));}})['catch'](function(_0x522f5a){logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x6c'),util[_0x10cf('0x3b')](_0x522f5a,{'showHidden':![],'depth':null}));});}else{logger[_0x10cf('0x25')](_0x10cf('0x26'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x75525c[_0x10cf('0x5c')]){var _0x16b35d={};var _0x2e26ea={'method':_0x10cf('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x10cf('0x70')+_0x75525c[_0x10cf('0x5c')],'Content-Type':_0x10cf('0x58')},'body':{'from':_0x75525c[_0x10cf('0x1f')],'to':_0x1be308[_0x10cf('0x1f')],'text':_0x1be308[_0x10cf('0x21')]},'json':!![]};return rp(_0x2e26ea)[_0x10cf('0x1c')](function(_0x146405){if(_0x146405['code']==0xca){_0x16b35d[_0x10cf('0x71')]=_0x146405;var _0x42bf35={'method':_0x10cf('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x10cf('0x70')+_0x75525c[_0x10cf('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x16b35d[_0x10cf('0x71')][_0x10cf('0x72')]},'json':!![]};return rp(_0x42bf35)['then'](function(_0x338d06){_0x16b35d[_0x10cf('0x73')]=_0x338d06;var _0x386d30={'messageId':_0x16b35d['message'][_0x10cf('0x72')],'read':!![]};return _0x2f95cd[_0x10cf('0x17')](_0x386d30);});}else{return logger['error'](_0x10cf('0x26'),_0x10cf('0x27'),_0x10cf('0x74'),util[_0x10cf('0x3b')](_0x146405,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e8285){return logger[_0x10cf('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x10cf('0x74'),util[_0x10cf('0x3b')](_0x2e8285,{'showHidden':![],'depth':null}));});}else{return logger[_0x10cf('0x25')](_0x10cf('0x26'),_0x10cf('0x27'),'intelepeer',_0x10cf('0x75'));}break;}}})[_0x10cf('0x76')](function(){_0x589b0c();});}else{_0x589b0c();}}},'charset':_0x10cf('0x77'),'collate':_0x10cf('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6f36e01..9fe4c92 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 _0x07f8=['body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','CreateSmsMessage'];(function(_0x35f56e,_0x182b72){var _0xc0bd81=function(_0x235113){while(--_0x235113){_0x35f56e['push'](_0x35f56e['shift']());}};_0xc0bd81(++_0x182b72);}(_0x07f8,0x178));var _0x807f=function(_0x4160e6,_0x46a685){_0x4160e6=_0x4160e6-0x0;var _0x27d906=_0x07f8[_0x4160e6];return _0x27d906;};'use strict';var _=require('lodash');var util=require(_0x807f('0x0'));var moment=require(_0x807f('0x1'));var BPromise=require(_0x807f('0x2'));var rs=require(_0x807f('0x3'));var fs=require('fs');var Redis=require(_0x807f('0x4'));var db=require(_0x807f('0x5'))['db'];var utils=require(_0x807f('0x6'));var logger=require(_0x807f('0x7'))(_0x807f('0x8'));var config=require(_0x807f('0x9'));var jayson=require(_0x807f('0xa'));var client=jayson['client'][_0x807f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x807f('0xc')],{'host':_0x807f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x807f('0xe')](socket);function respondWithRpcPromise(_0x510ecd,_0x29cf5c,_0x16c617){return new BPromise(function(_0xfd4f76,_0x4c61d7){return client[_0x807f('0xf')](_0x510ecd,_0x16c617)[_0x807f('0x10')](function(_0x248c65){logger['info'](_0x807f('0x11'),_0x29cf5c,'request\x20sent');logger[_0x807f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29cf5c,_0x807f('0x13'),JSON[_0x807f('0x14')](_0x248c65));if(_0x248c65[_0x807f('0x15')]){if(_0x248c65[_0x807f('0x15')][_0x807f('0x16')]===0x1f4){logger[_0x807f('0x15')](_0x807f('0x11'),_0x29cf5c,_0x248c65[_0x807f('0x15')][_0x807f('0x17')]);return _0x4c61d7(_0x248c65[_0x807f('0x15')][_0x807f('0x17')]);}logger['error'](_0x807f('0x11'),_0x29cf5c,_0x248c65[_0x807f('0x15')][_0x807f('0x17')]);return _0xfd4f76(_0x248c65[_0x807f('0x15')][_0x807f('0x17')]);}else{logger[_0x807f('0x18')](_0x807f('0x11'),_0x29cf5c,'request\x20sent');_0xfd4f76(_0x248c65[_0x807f('0x19')]['message']);}})['catch'](function(_0x27f0ef){logger[_0x807f('0x15')](_0x807f('0x11'),_0x29cf5c,_0x27f0ef);_0x4c61d7(_0x27f0ef);});});}exports[_0x807f('0x1a')]=function(_0x3928f6){var _0x5d172d=this;return new Promise(function(_0x2589af,_0x2e3705){return db['SmsMessage']['create'](_0x3928f6[_0x807f('0x1b')],{'raw':_0x3928f6['options']?_0x3928f6[_0x807f('0x1c')][_0x807f('0x1d')]===undefined?!![]:![]:!![]})[_0x807f('0x10')](function(_0x522fe8){logger['info']('CreateSmsMessage',_0x3928f6);logger[_0x807f('0x12')](_0x807f('0x1a'),_0x3928f6,JSON[_0x807f('0x14')](_0x522fe8));_0x2589af(_0x522fe8);})[_0x807f('0x1e')](function(_0x52da8b){logger[_0x807f('0x15')](_0x807f('0x1a'),_0x52da8b[_0x807f('0x17')],_0x3928f6);_0x2e3705(_0x5d172d[_0x807f('0x15')](0x1f4,_0x52da8b[_0x807f('0x17')]));});});}; \ No newline at end of file +var _0x792a=['redis','localhost','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x46c1bb,_0x6085f0){var _0x293c0a=function(_0x48d4f3){while(--_0x48d4f3){_0x46c1bb['push'](_0x46c1bb['shift']());}};_0x293c0a(++_0x6085f0);}(_0x792a,0x1f4));var _0xa792=function(_0x2d4ac3,_0x113b48){_0x2d4ac3=_0x2d4ac3-0x0;var _0x43f42e=_0x792a[_0x2d4ac3];return _0x43f42e;};'use strict';var _=require(_0xa792('0x0'));var util=require(_0xa792('0x1'));var moment=require(_0xa792('0x2'));var BPromise=require('bluebird');var rs=require(_0xa792('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa792('0x4'))['db'];var utils=require(_0xa792('0x5'));var logger=require(_0xa792('0x6'))(_0xa792('0x7'));var config=require(_0xa792('0x8'));var jayson=require(_0xa792('0x9'));var client=jayson[_0xa792('0xa')][_0xa792('0xb')]({'port':0x232a});config[_0xa792('0xc')]=_['defaults'](config[_0xa792('0xc')],{'host':_0xa792('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa792('0xc')]));require(_0xa792('0xe'))[_0xa792('0xf')](socket);function respondWithRpcPromise(_0xff3719,_0x483ab3,_0x5e471d){return new BPromise(function(_0x306dc4,_0x5e7057){return client['request'](_0xff3719,_0x5e471d)[_0xa792('0x10')](function(_0x523241){logger[_0xa792('0x11')](_0xa792('0x12'),_0x483ab3,_0xa792('0x13'));logger[_0xa792('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x483ab3,_0xa792('0x13'),JSON[_0xa792('0x15')](_0x523241));if(_0x523241[_0xa792('0x16')]){if(_0x523241[_0xa792('0x16')][_0xa792('0x17')]===0x1f4){logger[_0xa792('0x16')](_0xa792('0x12'),_0x483ab3,_0x523241[_0xa792('0x16')][_0xa792('0x18')]);return _0x5e7057(_0x523241[_0xa792('0x16')][_0xa792('0x18')]);}logger[_0xa792('0x16')](_0xa792('0x12'),_0x483ab3,_0x523241['error'][_0xa792('0x18')]);return _0x306dc4(_0x523241[_0xa792('0x16')][_0xa792('0x18')]);}else{logger['info'](_0xa792('0x12'),_0x483ab3,_0xa792('0x13'));_0x306dc4(_0x523241[_0xa792('0x19')]['message']);}})[_0xa792('0x1a')](function(_0x6fecdf){logger[_0xa792('0x16')](_0xa792('0x12'),_0x483ab3,_0x6fecdf);_0x5e7057(_0x6fecdf);});});}exports[_0xa792('0x1b')]=function(_0x1b7bf5){var _0x1749ad=this;return new Promise(function(_0x271bae,_0x154469){return db['SmsMessage'][_0xa792('0x1c')](_0x1b7bf5[_0xa792('0x1d')],{'raw':_0x1b7bf5['options']?_0x1b7bf5[_0xa792('0x1e')][_0xa792('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3f104c){logger[_0xa792('0x11')](_0xa792('0x1b'),_0x1b7bf5);logger['debug'](_0xa792('0x1b'),_0x1b7bf5,JSON[_0xa792('0x15')](_0x3f104c));_0x271bae(_0x3f104c);})[_0xa792('0x1a')](function(_0xc382f4){logger[_0xa792('0x16')](_0xa792('0x1b'),_0xc382f4['message'],_0x1b7bf5);_0x154469(_0x1749ad['error'](0x1f4,_0xc382f4['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1d39068..cee91e6 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 _0xd940=['./smsMessage.events','save','remove','emit','removeListener','register','length','smsMessage:'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0xd940,0x140));var _0x0d94=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xd940[_0x3cb3ca];return _0x214366;};'use strict';var SmsMessageEvents=require(_0x0d94('0x0'));var events=[_0x0d94('0x1'),_0x0d94('0x2'),'update'];function createListener(_0x4eafd6,_0x4c45d3){return function(_0x22a025){_0x4c45d3[_0x0d94('0x3')](_0x4eafd6,_0x22a025);};}function removeListener(_0x3a2556,_0x22266d){return function(){SmsMessageEvents[_0x0d94('0x4')](_0x3a2556,_0x22266d);};}exports[_0x0d94('0x5')]=function(_0x24245d){for(var _0x532d39=0x0,_0x14bb7b=events[_0x0d94('0x6')];_0x532d39<_0x14bb7b;_0x532d39++){var _0x288719=events[_0x532d39];var _0x3f0595=createListener(_0x0d94('0x7')+_0x288719,_0x24245d);SmsMessageEvents['on'](_0x288719,_0x3f0595);}}; \ No newline at end of file +var _0x2048=['removeListener','register','length','./smsMessage.events','remove','emit'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x2048,0x11d));var _0x8204=function(_0x296b3c,_0x203828){_0x296b3c=_0x296b3c-0x0;var _0x53adfa=_0x2048[_0x296b3c];return _0x53adfa;};'use strict';var SmsMessageEvents=require(_0x8204('0x0'));var events=['save',_0x8204('0x1'),'update'];function createListener(_0x398f82,_0x5319c7){return function(_0x36262f){_0x5319c7[_0x8204('0x2')](_0x398f82,_0x36262f);};}function removeListener(_0x399a55,_0xec9fea){return function(){SmsMessageEvents[_0x8204('0x3')](_0x399a55,_0xec9fea);};}exports[_0x8204('0x4')]=function(_0x419497){for(var _0x2b3cf4=0x0,_0x423df4=events[_0x8204('0x5')];_0x2b3cf4<_0x423df4;_0x2b3cf4++){var _0x136988=events[_0x2b3cf4];var _0xac5978=createListener('smsMessage:'+_0x136988,_0x419497);SmsMessageEvents['on'](_0x136988,_0xac5978);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e5e3d88..a4ef1de 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 _0x8ca6=['../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8ca6,0x1cb));var _0x68ca=function(_0x52b963,_0x54c1d){_0x52b963=_0x52b963-0x0;var _0x242fbd=_0x8ca6[_0x52b963];return _0x242fbd;};'use strict';var multer=require(_0x68ca('0x0'));var util=require(_0x68ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x68ca('0x2'));var router=express[_0x68ca('0x3')]();var fs_extra=require(_0x68ca('0x4'));var auth=require(_0x68ca('0x5'));var interaction=require(_0x68ca('0x6'));var config=require('../../config/environment');var controller=require(_0x68ca('0x7'));router[_0x68ca('0x8')]('/',auth[_0x68ca('0x9')](),controller[_0x68ca('0xa')]);router[_0x68ca('0x8')](_0x68ca('0xb'),auth['isAuthenticated'](),controller[_0x68ca('0xc')]);router[_0x68ca('0x8')](_0x68ca('0xd'),auth['isAuthenticated'](),controller[_0x68ca('0xe')]);router[_0x68ca('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x68ca('0x8')](_0x68ca('0xf'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x10')]);router['get'](_0x68ca('0x11'),auth['isAuthenticated'](),controller[_0x68ca('0x12')]);router['post']('/',auth[_0x68ca('0x9')](),controller[_0x68ca('0x13')]);router['post'](_0x68ca('0xf'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x14')]);router[_0x68ca('0x15')]('/:id/users',auth[_0x68ca('0x9')](),controller['addAgents']);router[_0x68ca('0x16')](_0x68ca('0xd'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x17')]);router[_0x68ca('0x18')](_0x68ca('0xd'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x19')]);router[_0x68ca('0x18')](_0x68ca('0xf'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x1a')]);router['delete'](_0x68ca('0x11'),auth[_0x68ca('0x9')](),controller[_0x68ca('0x1b')]);module[_0x68ca('0x1c')]=router; \ No newline at end of file +var _0x9eba=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','delete','destroy','removeTeams','removeAgents'];(function(_0x3b3caf,_0x57b9c8){var _0x18766a=function(_0x264da5){while(--_0x264da5){_0x3b3caf['push'](_0x3b3caf['shift']());}};_0x18766a(++_0x57b9c8);}(_0x9eba,0x106));var _0xa9eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9eba[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xa9eb('0x0'));var util=require(_0xa9eb('0x1'));var path=require('path');var timeout=require(_0xa9eb('0x2'));var express=require(_0xa9eb('0x3'));var router=express[_0xa9eb('0x4')]();var fs_extra=require(_0xa9eb('0x5'));var auth=require(_0xa9eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9eb('0x7'));var controller=require(_0xa9eb('0x8'));router[_0xa9eb('0x9')]('/',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xb')]);router[_0xa9eb('0x9')]('/describe',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xc')]);router[_0xa9eb('0x9')](_0xa9eb('0xd'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xe')]);router[_0xa9eb('0x9')](_0xa9eb('0xf'),auth['isAuthenticated'](),controller[_0xa9eb('0x10')]);router[_0xa9eb('0x9')]('/:id/teams',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x11')]);router[_0xa9eb('0x9')](_0xa9eb('0x12'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x13')]);router['post']('/',auth[_0xa9eb('0xa')](),controller['create']);router[_0xa9eb('0x14')](_0xa9eb('0x15'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x16')]);router[_0xa9eb('0x14')]('/:id/users',auth[_0xa9eb('0xa')](),controller['addAgents']);router[_0xa9eb('0x17')](_0xa9eb('0xd'),auth[_0xa9eb('0xa')](),controller['update']);router[_0xa9eb('0x18')](_0xa9eb('0xd'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x19')]);router[_0xa9eb('0x18')](_0xa9eb('0x15'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x1a')]);router[_0xa9eb('0x18')](_0xa9eb('0x12'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x1b')]);module[_0xa9eb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e2e563d..a111f8b 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 _0xb78a=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x48e9ae,_0x13cc9c){var _0x56beaf=function(_0x4fbdff){while(--_0x4fbdff){_0x48e9ae['push'](_0x48e9ae['shift']());}};_0x56beaf(++_0x13cc9c);}(_0xb78a,0x197));var _0xab78=function(_0x85fbb2,_0x55d447){_0x85fbb2=_0x85fbb2-0x0;var _0x2c94e5=_0xb78a[_0x85fbb2];return _0x2c94e5;};'use strict';var Sequelize=require(_0xab78('0x0'));module[_0xab78('0x1')]={'name':{'type':Sequelize[_0xab78('0x2')],'unique':_0xab78('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab78('0x2')]},'timeout':{'type':Sequelize[_0xab78('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab78('0x5')](_0xab78('0x6'),_0xab78('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xd21e=['name','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x403cb7,_0x49516c){var _0x3e89be=function(_0x272637){while(--_0x272637){_0x403cb7['push'](_0x403cb7['shift']());}};_0x3e89be(++_0x49516c);}(_0xd21e,0x130));var _0xed21=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0xd21e[_0x2ad1b8];return _0x52547d;};'use strict';var Sequelize=require('sequelize');module[_0xed21('0x0')]={'name':{'type':Sequelize[_0xed21('0x1')],'unique':_0xed21('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed21('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed21('0x3')]('rrmemory',_0xed21('0x4'),_0xed21('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ab3d5dd..fcb8150 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 _0xb713=['transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','options','includeAll','include','SmsQueue','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','findAll','User','findAndCountAll','UserId','smsPause','updatedAt','rows','format','SIP','createdAt','getTeams','Team','online','interface','flatMap','Agents','sequelize'];(function(_0x29c0f4,_0x296db5){var _0x352970=function(_0x3c8547){while(--_0x3c8547){_0x29c0f4['push'](_0x29c0f4['shift']());}};_0x352970(++_0x296db5);}(_0xb713,0x1a6));var _0x3b71=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xb713[_0x367361];return _0x195d2d;};'use strict';var emlformat=require(_0x3b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b71('0x1'));var jsonpatch=require(_0x3b71('0x2'));var rp=require(_0x3b71('0x3'));var moment=require(_0x3b71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b71('0x5'));var util=require(_0x3b71('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3b71('0x7'));var ejs=require(_0x3b71('0x8'));var fs=require('fs');var fs_extra=require(_0x3b71('0x9'));var _=require(_0x3b71('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b71('0xb'));var deskjs=require(_0x3b71('0xc'));var toCsv=require(_0x3b71('0x7'));var querystring=require(_0x3b71('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b71('0xe'));var qs=require(_0x3b71('0xf'));var as=require(_0x3b71('0x10'));var hardwareService=require(_0x3b71('0x11'));var logger=require(_0x3b71('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b71('0x13'));var db=require('../../mysqldb')['db'];config[_0x3b71('0x14')]=_[_0x3b71('0x15')](config['redis'],{'host':_0x3b71('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b71('0x14')]));require(_0x3b71('0x17'))['register'](socket);function respondWithStatusCode(_0x2f229b,_0x1ac2b3){_0x1ac2b3=_0x1ac2b3||0xcc;return function(_0x177480){if(_0x177480){return _0x2f229b[_0x3b71('0x18')](_0x1ac2b3);}return _0x2f229b[_0x3b71('0x19')](_0x1ac2b3)['end']();};}function respondWithResult(_0x2624b7,_0x4504cd){_0x4504cd=_0x4504cd||0xc8;return function(_0x35a8a5){if(_0x35a8a5){return _0x2624b7[_0x3b71('0x19')](_0x4504cd)['json'](_0x35a8a5);}};}function respondWithFilteredResult(_0x398ec0,_0x2fba0e){return function(_0xdcdd23){if(_0xdcdd23){var _0x3ef9d8=typeof _0x2fba0e[_0x3b71('0x1a')]===_0x3b71('0x1b')&&typeof _0x2fba0e[_0x3b71('0x1c')]==='undefined';var _0x32eccc=_0xdcdd23[_0x3b71('0x1d')];var _0x291578=_0x3ef9d8?0x0:_0x2fba0e[_0x3b71('0x1a')];var _0x325a0c=_0x3ef9d8?_0xdcdd23[_0x3b71('0x1d')]:_0x2fba0e['offset']+_0x2fba0e['limit'];var _0x54fa90;if(_0x325a0c>=_0x32eccc){_0x325a0c=_0x32eccc;_0x54fa90=0xc8;}else{_0x54fa90=0xce;}_0x398ec0[_0x3b71('0x19')](_0x54fa90);return _0x398ec0['set']('Content-Range',_0x291578+'-'+_0x325a0c+'/'+_0x32eccc)[_0x3b71('0x1e')](_0xdcdd23);}return null;};}function patchUpdates(_0xec9f3){return function(_0x59dac0){try{jsonpatch[_0x3b71('0x1f')](_0x59dac0,_0xec9f3,!![]);}catch(_0x403727){return BPromise[_0x3b71('0x20')](_0x403727);}return _0x59dac0[_0x3b71('0x21')]();};}function saveUpdates(_0x34e662,_0x54b18d){return function(_0x1c2f71){if(_0x1c2f71){return _0x1c2f71['update'](_0x34e662)['then'](function(_0x3d188a){return _0x3d188a;});}return null;};}function removeEntity(_0x4a0351,_0x2d5a33){return function(_0x12b11e){if(_0x12b11e){return _0x12b11e[_0x3b71('0x22')]()[_0x3b71('0x23')](function(){var _0x13db01=_0x12b11e[_0x3b71('0x24')]({'plain':!![]});var _0x453be7='SmsQueues';return db[_0x3b71('0x25')][_0x3b71('0x22')]({'where':{'type':_0x453be7,'resourceId':_0x13db01['id']}})[_0x3b71('0x23')](function(){return _0x12b11e;});})[_0x3b71('0x23')](function(){_0x4a0351[_0x3b71('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a00b,_0x507954){return function(_0x15b40b){if(!_0x15b40b){_0x29a00b['sendStatus'](0x194);}return _0x15b40b;};}function handleError(_0x306fd2,_0x388e61){_0x388e61=_0x388e61||0x1f4;return function(_0x5477d1){logger[_0x3b71('0x26')](_0x5477d1[_0x3b71('0x27')]);if(_0x5477d1[_0x3b71('0x28')]){delete _0x5477d1[_0x3b71('0x28')];}_0x306fd2['status'](_0x388e61)[_0x3b71('0x29')](_0x5477d1);};}exports[_0x3b71('0x2a')]=function(_0x5eaaeb,_0x29fc2d){var _0x50b0fc={},_0x5723de={},_0x56de61={'count':0x0,'rows':[]};var _0x274c4d=_['map'](db['SmsQueue'][_0x3b71('0x2b')],function(_0x2bc528){return{'name':_0x2bc528['fieldName'],'type':_0x2bc528['type']['key']};});_0x5723de[_0x3b71('0x2c')]=_['map'](_0x274c4d,'name');_0x5723de['query']=_['keys'](_0x5eaaeb[_0x3b71('0x2d')]);_0x5723de[_0x3b71('0x2e')]=_[_0x3b71('0x2f')](_0x5723de['model'],_0x5723de[_0x3b71('0x2d')]);_0x50b0fc[_0x3b71('0x30')]=_[_0x3b71('0x2f')](_0x5723de[_0x3b71('0x2c')],qs[_0x3b71('0x31')](_0x5eaaeb['query'][_0x3b71('0x31')]));_0x50b0fc[_0x3b71('0x30')]=_0x50b0fc[_0x3b71('0x30')][_0x3b71('0x32')]?_0x50b0fc[_0x3b71('0x30')]:_0x5723de[_0x3b71('0x2c')];if(!_0x5eaaeb[_0x3b71('0x2d')][_0x3b71('0x33')](_0x3b71('0x34'))){_0x50b0fc[_0x3b71('0x1c')]=qs[_0x3b71('0x1c')](_0x5eaaeb[_0x3b71('0x2d')][_0x3b71('0x1c')]);_0x50b0fc[_0x3b71('0x1a')]=qs[_0x3b71('0x1a')](_0x5eaaeb[_0x3b71('0x2d')][_0x3b71('0x1a')]);}_0x50b0fc[_0x3b71('0x35')]=qs[_0x3b71('0x36')](_0x5eaaeb[_0x3b71('0x2d')]['sort']);_0x50b0fc[_0x3b71('0x37')]=qs['filters'](_['pick'](_0x5eaaeb[_0x3b71('0x2d')],_0x5723de[_0x3b71('0x2e')]),_0x274c4d);if(_0x5eaaeb['query'][_0x3b71('0x38')]){_0x50b0fc[_0x3b71('0x37')]=_[_0x3b71('0x39')](_0x50b0fc[_0x3b71('0x37')],{'$or':_[_0x3b71('0x3a')](_0x274c4d,function(_0x5aeac7){if(_0x5aeac7[_0x3b71('0x3b')]!=='VIRTUAL'){var _0x144c71={};_0x144c71[_0x5aeac7[_0x3b71('0x28')]]={'$like':'%'+_0x5eaaeb[_0x3b71('0x2d')][_0x3b71('0x38')]+'%'};return _0x144c71;}})});}_0x50b0fc=_[_0x3b71('0x39')]({},_0x50b0fc,_0x5eaaeb[_0x3b71('0x3c')]);var _0x5b0f41={'where':_0x50b0fc['where']};return db['SmsQueue'][_0x3b71('0x1d')](_0x5b0f41)[_0x3b71('0x23')](function(_0x8dce28){_0x56de61['count']=_0x8dce28;if(_0x5eaaeb[_0x3b71('0x2d')][_0x3b71('0x3d')]){_0x50b0fc[_0x3b71('0x3e')]=[{'all':!![]}];}return db[_0x3b71('0x3f')]['findAll'](_0x50b0fc);})[_0x3b71('0x23')](function(_0x53abed){_0x56de61['rows']=_0x53abed;return _0x56de61;})[_0x3b71('0x23')](respondWithFilteredResult(_0x29fc2d,_0x50b0fc))[_0x3b71('0x40')](handleError(_0x29fc2d,null));};exports['show']=function(_0x3da6ea,_0xfc2f17){var _0x27ad52={'raw':!![],'where':{'id':_0x3da6ea[_0x3b71('0x41')]['id']}},_0x18a856={};_0x18a856[_0x3b71('0x2c')]=_[_0x3b71('0x42')](db[_0x3b71('0x3f')][_0x3b71('0x2b')]);_0x18a856['query']=_['keys'](_0x3da6ea['query']);_0x18a856[_0x3b71('0x2e')]=_[_0x3b71('0x2f')](_0x18a856[_0x3b71('0x2c')],_0x18a856[_0x3b71('0x2d')]);_0x27ad52[_0x3b71('0x30')]=_[_0x3b71('0x2f')](_0x18a856[_0x3b71('0x2c')],qs[_0x3b71('0x31')](_0x3da6ea[_0x3b71('0x2d')]['fields']));_0x27ad52[_0x3b71('0x30')]=_0x27ad52[_0x3b71('0x30')][_0x3b71('0x32')]?_0x27ad52[_0x3b71('0x30')]:_0x18a856['model'];if(_0x3da6ea[_0x3b71('0x2d')][_0x3b71('0x3d')]){_0x27ad52[_0x3b71('0x3e')]=[{'all':!![]}];}_0x27ad52=_[_0x3b71('0x39')]({},_0x27ad52,_0x3da6ea[_0x3b71('0x3c')]);return db[_0x3b71('0x3f')][_0x3b71('0x43')](_0x27ad52)['then'](handleEntityNotFound(_0xfc2f17,null))[_0x3b71('0x23')](respondWithResult(_0xfc2f17,null))[_0x3b71('0x40')](handleError(_0xfc2f17,null));};exports[_0x3b71('0x44')]=function(_0x4fea8e,_0x7ec0f6){return db['SmsQueue'][_0x3b71('0x44')](_0x4fea8e[_0x3b71('0x45')],{})[_0x3b71('0x23')](function(_0x33a665){var _0x560a3b=_0x4fea8e['user']['get']({'plain':!![]});if(!_0x560a3b)throw new Error(_0x3b71('0x46'));if(_0x560a3b[_0x3b71('0x47')]===_0x3b71('0x48')){var _0x4c94a6=_0x33a665[_0x3b71('0x24')]({'plain':!![]});var _0x373e2a=_0x3b71('0x49');return db[_0x3b71('0x4a')][_0x3b71('0x43')]({'where':{'name':_0x373e2a,'userProfileId':_0x560a3b[_0x3b71('0x4b')]},'raw':!![]})['then'](function(_0xf0847e){if(_0xf0847e&&_0xf0847e[_0x3b71('0x4c')]===0x0){return db[_0x3b71('0x25')][_0x3b71('0x44')]({'name':_0x4c94a6['name'],'resourceId':_0x4c94a6['id'],'type':_0xf0847e['name'],'sectionId':_0xf0847e['id']},{})[_0x3b71('0x23')](function(){return _0x33a665;});}else{return _0x33a665;}})[_0x3b71('0x40')](function(_0x5e3b51){logger[_0x3b71('0x26')](_0x3b71('0x4d'),_0x5e3b51);throw _0x5e3b51;});}return _0x33a665;})[_0x3b71('0x23')](respondWithResult(_0x7ec0f6,0xc9))[_0x3b71('0x40')](handleError(_0x7ec0f6,null));};exports[_0x3b71('0x4e')]=function(_0x31aa64,_0x3659f5){if(_0x31aa64[_0x3b71('0x45')]['id']){delete _0x31aa64['body']['id'];}return db[_0x3b71('0x3f')][_0x3b71('0x43')]({'where':{'id':_0x31aa64[_0x3b71('0x41')]['id']}})['then'](handleEntityNotFound(_0x3659f5,null))[_0x3b71('0x23')](saveUpdates(_0x31aa64[_0x3b71('0x45')],null))['then'](respondWithResult(_0x3659f5,null))[_0x3b71('0x40')](handleError(_0x3659f5,null));};exports[_0x3b71('0x22')]=function(_0x1f19be,_0x50d0cc){return db[_0x3b71('0x3f')][_0x3b71('0x43')]({'where':{'id':_0x1f19be['params']['id']}})[_0x3b71('0x23')](handleEntityNotFound(_0x50d0cc,null))['then'](removeEntity(_0x50d0cc,null))[_0x3b71('0x40')](handleError(_0x50d0cc,null));};exports[_0x3b71('0x4f')]=function(_0x544aad,_0x50f97c){return db[_0x3b71('0x3f')][_0x3b71('0x4f')]()[_0x3b71('0x23')](respondWithResult(_0x50f97c,null))[_0x3b71('0x40')](handleError(_0x50f97c,null));};exports[_0x3b71('0x50')]=function(_0x185ad9,_0x5ab6d8,_0x58951e){var _0x2d3f21={'raw':!![],'where':{}},_0x5119bf={},_0xf25037;return db[_0x3b71('0x3f')][_0x3b71('0x51')]({'where':{'id':_0x185ad9['params']['id']}})[_0x3b71('0x23')](handleEntityNotFound(_0x5ab6d8,null))[_0x3b71('0x23')](function(_0x3d194a){if(_0x3d194a){_0xf25037=_0x3d194a[_0x3b71('0x24')]({'plain':!![]});_0x5119bf[_0x3b71('0x2c')]=_[_0x3b71('0x42')](db[_0x3b71('0x52')][_0x3b71('0x2b')]);_0x5119bf[_0x3b71('0x2d')]=_['keys'](_0x185ad9[_0x3b71('0x2d')]);_0x5119bf['filters']=_[_0x3b71('0x2f')](_0x5119bf['model'],_0x5119bf[_0x3b71('0x2d')]);_0x2d3f21[_0x3b71('0x30')]=_[_0x3b71('0x2f')](_0x5119bf[_0x3b71('0x2c')],qs[_0x3b71('0x31')](_0x185ad9['query']['fields']));_0x2d3f21[_0x3b71('0x30')]=_0x2d3f21[_0x3b71('0x30')][_0x3b71('0x32')]?_0x2d3f21[_0x3b71('0x30')]:_0x5119bf[_0x3b71('0x2c')];if(!_0x185ad9[_0x3b71('0x2d')][_0x3b71('0x33')]('nolimit')){_0x2d3f21[_0x3b71('0x1c')]=qs[_0x3b71('0x1c')](_0x185ad9[_0x3b71('0x2d')]['limit']);_0x2d3f21[_0x3b71('0x1a')]=qs['offset'](_0x185ad9[_0x3b71('0x2d')]['offset']);}_0x2d3f21[_0x3b71('0x35')]=qs[_0x3b71('0x36')](_0x185ad9[_0x3b71('0x2d')][_0x3b71('0x36')]);_0x2d3f21[_0x3b71('0x37')]=qs[_0x3b71('0x2e')](_[_0x3b71('0x53')](_0x185ad9[_0x3b71('0x2d')],_0x5119bf[_0x3b71('0x2e')]));_0x2d3f21[_0x3b71('0x37')][_0x3b71('0x54')]=_0x3d194a['id'];if(_0x185ad9[_0x3b71('0x2d')][_0x3b71('0x38')]){_0x2d3f21[_0x3b71('0x37')]=_['merge'](_0x2d3f21[_0x3b71('0x37')],{'$or':_['map'](_0x2d3f21['attributes'],function(_0x405a73){var _0x57148f={};_0x57148f[_0x405a73]={'$like':'%'+_0x185ad9[_0x3b71('0x2d')][_0x3b71('0x38')]+'%'};return _0x57148f;})});}_0x2d3f21=_[_0x3b71('0x39')]({},_0x2d3f21,_0x185ad9[_0x3b71('0x3c')]);return db[_0x3b71('0x52')][_0x3b71('0x55')](_0x2d3f21);}})['then'](function(_0x3fbe04){if(_0x3fbe04){return db[_0x3b71('0x56')][_0x3b71('0x57')]({'where':{'id':_['map'](_0x3fbe04,_0x3b71('0x58')),'role':'agent'},'attributes':['id',_0x3b71('0x28'),_0x3b71('0x59'),_0x3b71('0x5a'),'createdAt']});}})[_0x3b71('0x23')](function(_0x3f6fbc){if(_0x3f6fbc){return{'count':_0x3f6fbc[_0x3b71('0x1d')],'rows':_[_0x3b71('0x3a')](_0x3f6fbc[_0x3b71('0x5b')],function(_0x55c643){return{'membername':_0x55c643[_0x3b71('0x28')],'UserId':_0x55c643['id'],'queue_name':_0xf25037['name'],'SmsQueueId':_0xf25037['id'],'interface':util[_0x3b71('0x5c')]('%s/%s',_0x3b71('0x5d'),_0x55c643[_0x3b71('0x28')]),'penalty':0x0,'paused':_0x55c643['smsPause'],'createdAt':_0x55c643[_0x3b71('0x5e')],'updatedAt':_0x55c643[_0x3b71('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3b71('0x23')](respondWithFilteredResult(_0x5ab6d8,_0x2d3f21))[_0x3b71('0x40')](handleError(_0x5ab6d8,null));};exports[_0x3b71('0x5f')]=function(_0x610b6c,_0x505f42,_0x5e58e8){var _0x238bbb={};var _0x42d0f0={};var _0x2915b6;var _0x1bf6d3;return db['SmsQueue'][_0x3b71('0x51')]({'where':{'id':_0x610b6c[_0x3b71('0x41')]['id']}})[_0x3b71('0x23')](handleEntityNotFound(_0x505f42,null))[_0x3b71('0x23')](function(_0x4284d4){if(_0x4284d4){_0x2915b6=_0x4284d4;_0x42d0f0[_0x3b71('0x2c')]=_['keys'](db[_0x3b71('0x60')]['rawAttributes']);_0x42d0f0[_0x3b71('0x2d')]=_[_0x3b71('0x42')](_0x610b6c[_0x3b71('0x2d')]);_0x42d0f0[_0x3b71('0x2e')]=_[_0x3b71('0x2f')](_0x42d0f0[_0x3b71('0x2c')],_0x42d0f0['query']);_0x238bbb['attributes']=_[_0x3b71('0x2f')](_0x42d0f0['model'],qs[_0x3b71('0x31')](_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x31')]));_0x238bbb['attributes']=_0x238bbb[_0x3b71('0x30')][_0x3b71('0x32')]?_0x238bbb[_0x3b71('0x30')]:_0x42d0f0[_0x3b71('0x2c')];_0x238bbb[_0x3b71('0x35')]=qs[_0x3b71('0x36')](_0x610b6c[_0x3b71('0x2d')]['sort']);_0x238bbb[_0x3b71('0x37')]=qs[_0x3b71('0x2e')](_['pick'](_0x610b6c[_0x3b71('0x2d')],_0x42d0f0['filters']));if(_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x38')]){_0x238bbb[_0x3b71('0x37')]=_[_0x3b71('0x39')](_0x238bbb[_0x3b71('0x37')],{'$or':_['map'](_0x238bbb[_0x3b71('0x30')],function(_0x5d2165){var _0xf6cd46={};_0xf6cd46[_0x5d2165]={'$like':'%'+_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x38')]+'%'};return _0xf6cd46;})});}_0x238bbb=_[_0x3b71('0x39')]({},_0x238bbb,_0x610b6c[_0x3b71('0x3c')]);return _0x2915b6[_0x3b71('0x5f')](_0x238bbb);}})[_0x3b71('0x23')](function(_0x371f37){if(_0x371f37){_0x1bf6d3=_0x371f37['length'];if(!_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x33')](_0x3b71('0x34'))){_0x238bbb[_0x3b71('0x1c')]=qs['limit'](_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x1c')]);_0x238bbb[_0x3b71('0x1a')]=qs[_0x3b71('0x1a')](_0x610b6c[_0x3b71('0x2d')][_0x3b71('0x1a')]);}return _0x2915b6['getTeams'](_0x238bbb);}})[_0x3b71('0x23')](function(_0x38dc4f){if(_0x38dc4f){return _0x38dc4f?{'count':_0x1bf6d3,'rows':_0x38dc4f}:null;}})['then'](respondWithResult(_0x505f42,null))['catch'](handleError(_0x505f42,null));};exports['addTeams']=function(_0x5da247,_0x21e896,_0x2cce9e){var _0x116e2c=_0x5da247[_0x3b71('0x45')]['ids'];return db['Team'][_0x3b71('0x55')]({'where':{'id':_0x116e2c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x3b71('0x28'),_0x3b71('0x61'),'voicePause',_0x3b71('0x62')],'raw':!![]}]})[_0x3b71('0x23')](function(_0x31f306){if(_0x31f306){var _0xda6779=_[_0x3b71('0x63')](_0x31f306,function(_0x487fd7){var _0x5488b7=_0x487fd7[_0x3b71('0x24')]({'plain':!![]});return _0x5488b7[_0x3b71('0x64')];});return db['SmsQueue']['find']({'where':{'id':_0x5da247['params']['id']}})[_0x3b71('0x23')](function(_0x3258a5){return db[_0x3b71('0x65')][_0x3b71('0x66')](function(_0x1e2e4b){return _0x3258a5['addTeams'](_0x116e2c,{'transaction':_0x1e2e4b})['then'](function(){return BPromise['each'](_0xda6779,function(_0x141123){return db['UserSmsQueue'][_0x3b71('0x67')]({'where':{'UserId':_0x141123['id'],'SmsQueueId':_0x5da247[_0x3b71('0x41')]['id']},'transaction':_0x1e2e4b});});})[_0x3b71('0x23')](function(){_0xda6779['forEach'](function(_0x16421a){socket[_0x3b71('0x68')](_0x3b71('0x69'),{'UserId':_0x16421a['id'],'SmsQueueId':_0x3258a5['id']});});});});});}})[_0x3b71('0x23')](respondWithStatusCode(_0x21e896,null))[_0x3b71('0x40')](handleError(_0x21e896,null));};exports[_0x3b71('0x6a')]=function(_0x5ea9b2,_0x18dad2,_0x49f286){return db[_0x3b71('0x60')][_0x3b71('0x55')]({'where':{'id':_0x5ea9b2[_0x3b71('0x2d')][_0x3b71('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x3b71('0x56')],'as':_0x3b71('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3b71('0x23')](handleEntityNotFound(_0x18dad2,null))[_0x3b71('0x23')](function(_0x4ac435){var _0xe18c80=_[_0x3b71('0x3a')](_0x4ac435,'id');var _0x571a34=[];var _0x1394f1=[];var _0x2f3b24=squel['select']();_0x2f3b24[_0x3b71('0x6c')](_0x3b71('0x6d'))[_0x3b71('0x6e')](_0x3b71('0x6f'),'tq')['join'](_0x3b71('0x70'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3b71('0x37')](_0x3b71('0x71'),_0x5ea9b2[_0x3b71('0x41')]['id']);for(var _0x3151d0=0x0;_0x3151d0<_0x4ac435[_0x3b71('0x32')];_0x3151d0+=0x1){let _0xf1ba09=_0x4ac435[_0x3151d0];for(var _0x118d3b=0x0;_0x118d3b<_0xf1ba09['Agents'][_0x3b71('0x32')];_0x118d3b+=0x1){let _0x57c484=_0xf1ba09[_0x3b71('0x64')][_0x118d3b];var _0x2ada01=_0x2f3b24[_0x3b71('0x72')]();_0x2ada01[_0x3b71('0x37')](_0x3b71('0x73'),_0x57c484['id']);_0x1394f1[_0x3b71('0x74')](db[_0x3b71('0x65')]['query'](_0x2ada01[_0x3b71('0x75')](),{'type':db[_0x3b71('0x65')][_0x3b71('0x76')][_0x3b71('0x77')]})['then'](function(_0x5a1d23){if(_0x5a1d23[_0x3b71('0x32')]===0x1){return _0x57c484['id'];}else{var _0x31e9f2=_[_0x3b71('0x78')](_[_0x3b71('0x3a')](_0x5a1d23,_0x3b71('0x79')),function(_0x4b53e3){return _[_0x3b71('0x7a')](_0xe18c80,_0x4b53e3);});if(_0x31e9f2){return _0x57c484['id'];}}}));}}return BPromise['all'](_0x1394f1)[_0x3b71('0x23')](function(_0x2097d2){_0x571a34=_(_0x571a34)[_0x3b71('0x7b')](_0x2097d2)['compact']()['value']();return db['SmsQueue']['find']({'where':{'id':_0x5ea9b2[_0x3b71('0x41')]['id']}})[_0x3b71('0x23')](function(_0x431053){return db[_0x3b71('0x65')][_0x3b71('0x66')](function(_0xacaa8a){return _0x431053[_0x3b71('0x6a')](_0x5ea9b2[_0x3b71('0x2d')][_0x3b71('0x6b')],{'transaction':_0xacaa8a})[_0x3b71('0x23')](function(){if(!_[_0x3b71('0x7c')](_0x571a34)){return _0x431053[_0x3b71('0x7d')](_0x571a34,{'transaction':_0xacaa8a});}})[_0x3b71('0x23')](function(){_0x571a34[_0x3b71('0x7e')](function(_0x502bbd){socket[_0x3b71('0x68')](_0x3b71('0x7f'),{'UserId':_0x502bbd,'SmsQueueId':_0x431053['id']});});});});});});})['then'](respondWithStatusCode(_0x18dad2,null))[_0x3b71('0x40')](handleError(_0x18dad2,null));};exports[_0x3b71('0x80')]=function(_0x39e842,_0x26cba1,_0x595061){return db['SmsQueue'][_0x3b71('0x43')]({'where':{'id':_0x39e842[_0x3b71('0x41')]['id']}})[_0x3b71('0x23')](handleEntityNotFound(_0x26cba1,null))['then'](function(_0x4dda6b){if(_0x4dda6b){return _0x4dda6b[_0x3b71('0x80')](_0x39e842[_0x3b71('0x45')][_0x3b71('0x6b')],_['omit'](_0x39e842[_0x3b71('0x45')],[_0x3b71('0x6b'),'id'])||{})[_0x3b71('0x81')](function(_0x370bba){for(var _0x3529e7=0x0;_0x3529e7<_0x39e842[_0x3b71('0x45')][_0x3b71('0x6b')][_0x3b71('0x32')];_0x3529e7+=0x1){socket[_0x3b71('0x68')](_0x3b71('0x69'),{'UserId':Number(_0x39e842[_0x3b71('0x45')]['ids'][_0x3529e7]),'SmsQueueId':Number(_0x39e842[_0x3b71('0x41')]['id'])});}return _0x370bba;});}})['then'](respondWithResult(_0x26cba1,null))[_0x3b71('0x40')](handleError(_0x26cba1,null));};exports['removeAgents']=function(_0x48d204,_0x4543f7,_0x3a1089){return db[_0x3b71('0x3f')][_0x3b71('0x43')]({'where':{'id':_0x48d204[_0x3b71('0x41')]['id']}})['then'](handleEntityNotFound(_0x4543f7,null))[_0x3b71('0x23')](function(_0x59e660){if(_0x59e660){return _0x59e660[_0x3b71('0x7d')](_0x48d204[_0x3b71('0x2d')]['ids'])['then'](function(){if(_['isArray'](_0x48d204['query'][_0x3b71('0x6b')])){for(var _0x2cf775=0x0;_0x2cf775<_0x48d204['query'][_0x3b71('0x6b')][_0x3b71('0x32')];_0x2cf775+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x48d204[_0x3b71('0x2d')][_0x3b71('0x6b')][_0x2cf775]),'SmsQueueId':Number(_0x48d204[_0x3b71('0x41')]['id'])});}}else{socket[_0x3b71('0x68')](_0x3b71('0x7f'),{'UserId':Number(_0x48d204[_0x3b71('0x2d')][_0x3b71('0x6b')]),'SmsQueueId':Number(_0x48d204[_0x3b71('0x41')]['id'])});}});}})[_0x3b71('0x23')](respondWithStatusCode(_0x4543f7,null))['catch'](handleError(_0x4543f7,null));};exports['getAgents']=function(_0x46e8df,_0x118986,_0x2df6c4){var _0x28da81={};var _0x1c0113={};var _0x5dbfbc;var _0x2593a1;return db[_0x3b71('0x3f')]['findOne']({'where':{'id':_0x46e8df[_0x3b71('0x41')]['id']}})[_0x3b71('0x23')](handleEntityNotFound(_0x118986,null))[_0x3b71('0x23')](function(_0x105131){if(_0x105131){_0x5dbfbc=_0x105131;_0x1c0113['model']=_[_0x3b71('0x42')](db['User'][_0x3b71('0x2b')]);_0x1c0113[_0x3b71('0x2d')]=_[_0x3b71('0x42')](_0x46e8df[_0x3b71('0x2d')]);_0x1c0113[_0x3b71('0x2e')]=_[_0x3b71('0x2f')](_0x1c0113[_0x3b71('0x2c')],_0x1c0113[_0x3b71('0x2d')]);_0x28da81[_0x3b71('0x30')]=_['intersection'](_0x1c0113[_0x3b71('0x2c')],qs[_0x3b71('0x31')](_0x46e8df[_0x3b71('0x2d')]['fields']));_0x28da81[_0x3b71('0x30')]=_0x28da81['attributes'][_0x3b71('0x32')]?_0x28da81[_0x3b71('0x30')]:_0x1c0113[_0x3b71('0x2c')];_0x28da81[_0x3b71('0x35')]=qs['sort'](_0x46e8df[_0x3b71('0x2d')]['sort']);_0x28da81['where']=qs['filters'](_[_0x3b71('0x53')](_0x46e8df[_0x3b71('0x2d')],_0x1c0113[_0x3b71('0x2e')]));if(_0x46e8df['query'][_0x3b71('0x38')]){_0x28da81[_0x3b71('0x37')]=_['merge'](_0x28da81[_0x3b71('0x37')],{'$or':_[_0x3b71('0x3a')](_0x28da81[_0x3b71('0x30')],function(_0x29bd6a){var _0x1ac1f7={};_0x1ac1f7[_0x29bd6a]={'$like':'%'+_0x46e8df[_0x3b71('0x2d')][_0x3b71('0x38')]+'%'};return _0x1ac1f7;})});}_0x28da81=_[_0x3b71('0x39')]({},_0x28da81,_0x46e8df[_0x3b71('0x3c')]);return _0x5dbfbc[_0x3b71('0x82')](_0x28da81);}})[_0x3b71('0x23')](function(_0x2ae557){if(_0x2ae557){_0x2593a1=_0x2ae557['length'];if(!_0x46e8df[_0x3b71('0x2d')][_0x3b71('0x33')](_0x3b71('0x34'))){_0x28da81[_0x3b71('0x1c')]=qs[_0x3b71('0x1c')](_0x46e8df[_0x3b71('0x2d')][_0x3b71('0x1c')]);_0x28da81[_0x3b71('0x1a')]=qs[_0x3b71('0x1a')](_0x46e8df[_0x3b71('0x2d')][_0x3b71('0x1a')]);}return _0x5dbfbc['getAgents'](_0x28da81);}})[_0x3b71('0x23')](function(_0x47af48){if(_0x47af48){return _0x47af48?{'count':_0x2593a1,'rows':_0x47af48}:null;}})[_0x3b71('0x23')](respondWithResult(_0x118986,null))[_0x3b71('0x40')](handleError(_0x118986,null));}; \ No newline at end of file +var _0xa72d=['sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','emit','isArray','getAgents','eml-format','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','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','SmsQueue','findAll','rows','catch','show','intersection','find','create','user','SmsQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x242e23,_0x52bac4){var _0x398f14=function(_0x2219e9){while(--_0x2219e9){_0x242e23['push'](_0x242e23['shift']());}};_0x398f14(++_0x52bac4);}(_0xa72d,0x1bf));var _0xda72=function(_0x2185bc,_0x4d5d27){_0x2185bc=_0x2185bc-0x0;var _0x3693d2=_0xa72d[_0x2185bc];return _0x3693d2;};'use strict';var emlformat=require(_0xda72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda72('0x1'));var rp=require(_0xda72('0x2'));var moment=require(_0xda72('0x3'));var BPromise=require(_0xda72('0x4'));var Mustache=require(_0xda72('0x5'));var util=require(_0xda72('0x6'));var path=require(_0xda72('0x7'));var sox=require(_0xda72('0x8'));var csv=require('to-csv');var ejs=require(_0xda72('0x9'));var fs=require('fs');var fs_extra=require(_0xda72('0xa'));var _=require(_0xda72('0xb'));var squel=require('squel');var crypto=require(_0xda72('0xc'));var jsforce=require(_0xda72('0xd'));var deskjs=require(_0xda72('0xe'));var toCsv=require(_0xda72('0xf'));var querystring=require(_0xda72('0x10'));var Papa=require(_0xda72('0x11'));var Redis=require(_0xda72('0x12'));var authService=require(_0xda72('0x13'));var qs=require(_0xda72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda72('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xda72('0x16'));var licenseUtil=require(_0xda72('0x17'));var db=require('../../mysqldb')['db'];config[_0xda72('0x18')]=_[_0xda72('0x19')](config[_0xda72('0x18')],{'host':_0xda72('0x1a'),'port':0x18eb});var socket=require(_0xda72('0x1b'))(new Redis(config['redis']));require(_0xda72('0x1c'))[_0xda72('0x1d')](socket);function respondWithStatusCode(_0x43919f,_0x1c2886){_0x1c2886=_0x1c2886||0xcc;return function(_0x10b6bf){if(_0x10b6bf){return _0x43919f[_0xda72('0x1e')](_0x1c2886);}return _0x43919f[_0xda72('0x1f')](_0x1c2886)[_0xda72('0x20')]();};}function respondWithResult(_0x4e14d3,_0x4dbe31){_0x4dbe31=_0x4dbe31||0xc8;return function(_0x461ca7){if(_0x461ca7){return _0x4e14d3[_0xda72('0x1f')](_0x4dbe31)[_0xda72('0x21')](_0x461ca7);}};}function respondWithFilteredResult(_0x41e459,_0x128e26){return function(_0x10bcfc){if(_0x10bcfc){var _0x4c38a8=typeof _0x128e26[_0xda72('0x22')]===_0xda72('0x23')&&typeof _0x128e26[_0xda72('0x24')]===_0xda72('0x23');var _0x3957d1=_0x10bcfc[_0xda72('0x25')];var _0x2e511c=_0x4c38a8?0x0:_0x128e26['offset'];var _0x948e7a=_0x4c38a8?_0x10bcfc[_0xda72('0x25')]:_0x128e26[_0xda72('0x22')]+_0x128e26[_0xda72('0x24')];var _0x4d3f27;if(_0x948e7a>=_0x3957d1){_0x948e7a=_0x3957d1;_0x4d3f27=0xc8;}else{_0x4d3f27=0xce;}_0x41e459[_0xda72('0x1f')](_0x4d3f27);return _0x41e459['set'](_0xda72('0x26'),_0x2e511c+'-'+_0x948e7a+'/'+_0x3957d1)[_0xda72('0x21')](_0x10bcfc);}return null;};}function patchUpdates(_0x35f527){return function(_0x133504){try{jsonpatch[_0xda72('0x27')](_0x133504,_0x35f527,!![]);}catch(_0x587bdf){return BPromise[_0xda72('0x28')](_0x587bdf);}return _0x133504['save']();};}function saveUpdates(_0x4dbc01,_0x599f98){return function(_0xc72fe4){if(_0xc72fe4){return _0xc72fe4[_0xda72('0x29')](_0x4dbc01)[_0xda72('0x2a')](function(_0x17694a){return _0x17694a;});}return null;};}function removeEntity(_0x2ffa30,_0x1eb770){return function(_0x4abc33){if(_0x4abc33){return _0x4abc33[_0xda72('0x2b')]()[_0xda72('0x2a')](function(){var _0x56edc9=_0x4abc33[_0xda72('0x2c')]({'plain':!![]});var _0x257775='SmsQueues';return db['UserProfileResource'][_0xda72('0x2b')]({'where':{'type':_0x257775,'resourceId':_0x56edc9['id']}})[_0xda72('0x2a')](function(){return _0x4abc33;});})['then'](function(){_0x2ffa30['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x479455,_0x5eb2de){return function(_0x4df546){if(!_0x4df546){_0x479455[_0xda72('0x1e')](0x194);}return _0x4df546;};}function handleError(_0x3bd907,_0x232599){_0x232599=_0x232599||0x1f4;return function(_0x30b207){logger[_0xda72('0x2d')](_0x30b207['stack']);if(_0x30b207[_0xda72('0x2e')]){delete _0x30b207[_0xda72('0x2e')];}_0x3bd907[_0xda72('0x1f')](_0x232599)[_0xda72('0x2f')](_0x30b207);};}exports[_0xda72('0x30')]=function(_0x11ce3b,_0x1f1f3d){var _0x5ee5d3={},_0x3805d4={},_0x59f739={'count':0x0,'rows':[]};var _0x5d15ad=_[_0xda72('0x31')](db['SmsQueue'][_0xda72('0x32')],function(_0x4ba23a){return{'name':_0x4ba23a[_0xda72('0x33')],'type':_0x4ba23a['type'][_0xda72('0x34')]};});_0x3805d4[_0xda72('0x35')]=_[_0xda72('0x31')](_0x5d15ad,_0xda72('0x2e'));_0x3805d4[_0xda72('0x36')]=_[_0xda72('0x37')](_0x11ce3b['query']);_0x3805d4[_0xda72('0x38')]=_['intersection'](_0x3805d4[_0xda72('0x35')],_0x3805d4[_0xda72('0x36')]);_0x5ee5d3[_0xda72('0x39')]=_['intersection'](_0x3805d4[_0xda72('0x35')],qs[_0xda72('0x3a')](_0x11ce3b[_0xda72('0x36')][_0xda72('0x3a')]));_0x5ee5d3[_0xda72('0x39')]=_0x5ee5d3[_0xda72('0x39')][_0xda72('0x3b')]?_0x5ee5d3[_0xda72('0x39')]:_0x3805d4['model'];if(!_0x11ce3b['query'][_0xda72('0x3c')](_0xda72('0x3d'))){_0x5ee5d3[_0xda72('0x24')]=qs[_0xda72('0x24')](_0x11ce3b[_0xda72('0x36')]['limit']);_0x5ee5d3['offset']=qs[_0xda72('0x22')](_0x11ce3b[_0xda72('0x36')][_0xda72('0x22')]);}_0x5ee5d3[_0xda72('0x3e')]=qs[_0xda72('0x3f')](_0x11ce3b[_0xda72('0x36')][_0xda72('0x3f')]);_0x5ee5d3[_0xda72('0x40')]=qs[_0xda72('0x38')](_['pick'](_0x11ce3b['query'],_0x3805d4['filters']),_0x5d15ad);if(_0x11ce3b[_0xda72('0x36')][_0xda72('0x41')]){_0x5ee5d3[_0xda72('0x40')]=_[_0xda72('0x42')](_0x5ee5d3['where'],{'$or':_['map'](_0x5d15ad,function(_0x23ecf9){if(_0x23ecf9[_0xda72('0x43')]!==_0xda72('0x44')){var _0x58951d={};_0x58951d[_0x23ecf9['name']]={'$like':'%'+_0x11ce3b[_0xda72('0x36')]['filter']+'%'};return _0x58951d;}})});}_0x5ee5d3=_[_0xda72('0x42')]({},_0x5ee5d3,_0x11ce3b[_0xda72('0x45')]);var _0x3eff60={'where':_0x5ee5d3['where']};return db['SmsQueue']['count'](_0x3eff60)[_0xda72('0x2a')](function(_0x2d5257){_0x59f739['count']=_0x2d5257;if(_0x11ce3b[_0xda72('0x36')][_0xda72('0x46')]){_0x5ee5d3['include']=[{'all':!![]}];}return db[_0xda72('0x47')][_0xda72('0x48')](_0x5ee5d3);})[_0xda72('0x2a')](function(_0x1ed92c){_0x59f739[_0xda72('0x49')]=_0x1ed92c;return _0x59f739;})[_0xda72('0x2a')](respondWithFilteredResult(_0x1f1f3d,_0x5ee5d3))[_0xda72('0x4a')](handleError(_0x1f1f3d,null));};exports[_0xda72('0x4b')]=function(_0x37a3c2,_0x111095){var _0x1c5869={'raw':!![],'where':{'id':_0x37a3c2['params']['id']}},_0x5051a6={};_0x5051a6['model']=_[_0xda72('0x37')](db[_0xda72('0x47')][_0xda72('0x32')]);_0x5051a6['query']=_['keys'](_0x37a3c2[_0xda72('0x36')]);_0x5051a6[_0xda72('0x38')]=_[_0xda72('0x4c')](_0x5051a6[_0xda72('0x35')],_0x5051a6[_0xda72('0x36')]);_0x1c5869[_0xda72('0x39')]=_['intersection'](_0x5051a6[_0xda72('0x35')],qs[_0xda72('0x3a')](_0x37a3c2['query'][_0xda72('0x3a')]));_0x1c5869[_0xda72('0x39')]=_0x1c5869[_0xda72('0x39')][_0xda72('0x3b')]?_0x1c5869['attributes']:_0x5051a6[_0xda72('0x35')];if(_0x37a3c2[_0xda72('0x36')][_0xda72('0x46')]){_0x1c5869['include']=[{'all':!![]}];}_0x1c5869=_['merge']({},_0x1c5869,_0x37a3c2[_0xda72('0x45')]);return db[_0xda72('0x47')][_0xda72('0x4d')](_0x1c5869)['then'](handleEntityNotFound(_0x111095,null))[_0xda72('0x2a')](respondWithResult(_0x111095,null))[_0xda72('0x4a')](handleError(_0x111095,null));};exports[_0xda72('0x4e')]=function(_0x19a40f,_0x1202b6){return db[_0xda72('0x47')][_0xda72('0x4e')](_0x19a40f['body'],{})[_0xda72('0x2a')](function(_0x4047a5){var _0x53ab7d=_0x19a40f['user'][_0xda72('0x2c')]({'plain':!![]});if(!_0x53ab7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53ab7d['role']===_0xda72('0x4f')){var _0x7d2bb8=_0x4047a5[_0xda72('0x2c')]({'plain':!![]});var _0x109195=_0xda72('0x50');return db[_0xda72('0x51')][_0xda72('0x4d')]({'where':{'name':_0x109195,'userProfileId':_0x53ab7d[_0xda72('0x52')]},'raw':!![]})['then'](function(_0x3d5a6f){if(_0x3d5a6f&&_0x3d5a6f['autoAssociation']===0x0){return db[_0xda72('0x53')][_0xda72('0x4e')]({'name':_0x7d2bb8[_0xda72('0x2e')],'resourceId':_0x7d2bb8['id'],'type':_0x3d5a6f[_0xda72('0x2e')],'sectionId':_0x3d5a6f['id']},{})[_0xda72('0x2a')](function(){return _0x4047a5;});}else{return _0x4047a5;}})[_0xda72('0x4a')](function(_0x18d2c8){logger['error'](_0xda72('0x54'),_0x18d2c8);throw _0x18d2c8;});}return _0x4047a5;})['then'](respondWithResult(_0x1202b6,0xc9))[_0xda72('0x4a')](handleError(_0x1202b6,null));};exports['update']=function(_0x24efba,_0x31d1d8){if(_0x24efba['body']['id']){delete _0x24efba[_0xda72('0x55')]['id'];}return db['SmsQueue'][_0xda72('0x4d')]({'where':{'id':_0x24efba[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x31d1d8,null))['then'](saveUpdates(_0x24efba[_0xda72('0x55')],null))[_0xda72('0x2a')](respondWithResult(_0x31d1d8,null))[_0xda72('0x4a')](handleError(_0x31d1d8,null));};exports[_0xda72('0x2b')]=function(_0xad1a41,_0x56bfa1){return db[_0xda72('0x47')][_0xda72('0x4d')]({'where':{'id':_0xad1a41[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x56bfa1,null))[_0xda72('0x2a')](removeEntity(_0x56bfa1,null))['catch'](handleError(_0x56bfa1,null));};exports[_0xda72('0x57')]=function(_0x411f1b,_0x519d2e){return db[_0xda72('0x47')][_0xda72('0x57')]()[_0xda72('0x2a')](respondWithResult(_0x519d2e,null))[_0xda72('0x4a')](handleError(_0x519d2e,null));};exports[_0xda72('0x58')]=function(_0x484b2d,_0x3aae4a,_0x37b0f6){var _0x36664c={'raw':!![],'where':{}},_0x51ae0a={},_0x48f47e;return db[_0xda72('0x47')][_0xda72('0x59')]({'where':{'id':_0x484b2d[_0xda72('0x56')]['id']}})['then'](handleEntityNotFound(_0x3aae4a,null))[_0xda72('0x2a')](function(_0x1beb1d){if(_0x1beb1d){_0x48f47e=_0x1beb1d['get']({'plain':!![]});_0x51ae0a[_0xda72('0x35')]=_[_0xda72('0x37')](db[_0xda72('0x5a')][_0xda72('0x32')]);_0x51ae0a[_0xda72('0x36')]=_[_0xda72('0x37')](_0x484b2d['query']);_0x51ae0a[_0xda72('0x38')]=_[_0xda72('0x4c')](_0x51ae0a[_0xda72('0x35')],_0x51ae0a[_0xda72('0x36')]);_0x36664c[_0xda72('0x39')]=_[_0xda72('0x4c')](_0x51ae0a['model'],qs[_0xda72('0x3a')](_0x484b2d[_0xda72('0x36')][_0xda72('0x3a')]));_0x36664c[_0xda72('0x39')]=_0x36664c[_0xda72('0x39')]['length']?_0x36664c[_0xda72('0x39')]:_0x51ae0a[_0xda72('0x35')];if(!_0x484b2d[_0xda72('0x36')][_0xda72('0x3c')](_0xda72('0x3d'))){_0x36664c['limit']=qs[_0xda72('0x24')](_0x484b2d[_0xda72('0x36')][_0xda72('0x24')]);_0x36664c[_0xda72('0x22')]=qs[_0xda72('0x22')](_0x484b2d[_0xda72('0x36')][_0xda72('0x22')]);}_0x36664c[_0xda72('0x3e')]=qs[_0xda72('0x3f')](_0x484b2d[_0xda72('0x36')][_0xda72('0x3f')]);_0x36664c['where']=qs['filters'](_[_0xda72('0x5b')](_0x484b2d[_0xda72('0x36')],_0x51ae0a['filters']));_0x36664c['where'][_0xda72('0x5c')]=_0x1beb1d['id'];if(_0x484b2d[_0xda72('0x36')][_0xda72('0x41')]){_0x36664c[_0xda72('0x40')]=_['merge'](_0x36664c['where'],{'$or':_[_0xda72('0x31')](_0x36664c[_0xda72('0x39')],function(_0x1ae651){var _0x184b4e={};_0x184b4e[_0x1ae651]={'$like':'%'+_0x484b2d[_0xda72('0x36')]['filter']+'%'};return _0x184b4e;})});}_0x36664c=_['merge']({},_0x36664c,_0x484b2d[_0xda72('0x45')]);return db[_0xda72('0x5a')]['findAll'](_0x36664c);}})[_0xda72('0x2a')](function(_0x25a7a5){if(_0x25a7a5){return db[_0xda72('0x5d')][_0xda72('0x5e')]({'where':{'id':_['map'](_0x25a7a5,_0xda72('0x5f')),'role':_0xda72('0x60')},'attributes':['id',_0xda72('0x2e'),_0xda72('0x61'),_0xda72('0x62'),_0xda72('0x63')]});}})[_0xda72('0x2a')](function(_0x54c075){if(_0x54c075){return{'count':_0x54c075[_0xda72('0x25')],'rows':_[_0xda72('0x31')](_0x54c075[_0xda72('0x49')],function(_0x2f9926){return{'membername':_0x2f9926[_0xda72('0x2e')],'UserId':_0x2f9926['id'],'queue_name':_0x48f47e[_0xda72('0x2e')],'SmsQueueId':_0x48f47e['id'],'interface':util[_0xda72('0x64')](_0xda72('0x65'),'SIP',_0x2f9926[_0xda72('0x2e')]),'penalty':0x0,'paused':_0x2f9926[_0xda72('0x61')],'createdAt':_0x2f9926[_0xda72('0x63')],'updatedAt':_0x2f9926[_0xda72('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda72('0x2a')](respondWithFilteredResult(_0x3aae4a,_0x36664c))['catch'](handleError(_0x3aae4a,null));};exports[_0xda72('0x66')]=function(_0x11aaad,_0x4460dc,_0x23469b){var _0x435be3={};var _0x41ba87={};var _0x1f9add;var _0x2b62f1;return db['SmsQueue'][_0xda72('0x59')]({'where':{'id':_0x11aaad[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x4460dc,null))[_0xda72('0x2a')](function(_0x1647a2){if(_0x1647a2){_0x1f9add=_0x1647a2;_0x41ba87[_0xda72('0x35')]=_['keys'](db[_0xda72('0x67')]['rawAttributes']);_0x41ba87[_0xda72('0x36')]=_[_0xda72('0x37')](_0x11aaad[_0xda72('0x36')]);_0x41ba87[_0xda72('0x38')]=_['intersection'](_0x41ba87[_0xda72('0x35')],_0x41ba87[_0xda72('0x36')]);_0x435be3[_0xda72('0x39')]=_[_0xda72('0x4c')](_0x41ba87[_0xda72('0x35')],qs[_0xda72('0x3a')](_0x11aaad[_0xda72('0x36')]['fields']));_0x435be3['attributes']=_0x435be3['attributes']['length']?_0x435be3['attributes']:_0x41ba87[_0xda72('0x35')];_0x435be3['order']=qs['sort'](_0x11aaad[_0xda72('0x36')]['sort']);_0x435be3[_0xda72('0x40')]=qs[_0xda72('0x38')](_[_0xda72('0x5b')](_0x11aaad[_0xda72('0x36')],_0x41ba87[_0xda72('0x38')]));if(_0x11aaad[_0xda72('0x36')][_0xda72('0x41')]){_0x435be3[_0xda72('0x40')]=_[_0xda72('0x42')](_0x435be3[_0xda72('0x40')],{'$or':_[_0xda72('0x31')](_0x435be3[_0xda72('0x39')],function(_0x4bd51e){var _0x13253d={};_0x13253d[_0x4bd51e]={'$like':'%'+_0x11aaad[_0xda72('0x36')][_0xda72('0x41')]+'%'};return _0x13253d;})});}_0x435be3=_[_0xda72('0x42')]({},_0x435be3,_0x11aaad[_0xda72('0x45')]);return _0x1f9add[_0xda72('0x66')](_0x435be3);}})['then'](function(_0x1188f1){if(_0x1188f1){_0x2b62f1=_0x1188f1[_0xda72('0x3b')];if(!_0x11aaad[_0xda72('0x36')][_0xda72('0x3c')](_0xda72('0x3d'))){_0x435be3[_0xda72('0x24')]=qs[_0xda72('0x24')](_0x11aaad[_0xda72('0x36')][_0xda72('0x24')]);_0x435be3[_0xda72('0x22')]=qs['offset'](_0x11aaad[_0xda72('0x36')][_0xda72('0x22')]);}return _0x1f9add['getTeams'](_0x435be3);}})[_0xda72('0x2a')](function(_0x5b6b5c){if(_0x5b6b5c){return _0x5b6b5c?{'count':_0x2b62f1,'rows':_0x5b6b5c}:null;}})[_0xda72('0x2a')](respondWithResult(_0x4460dc,null))[_0xda72('0x4a')](handleError(_0x4460dc,null));};exports[_0xda72('0x68')]=function(_0xf709fa,_0x7f7435,_0x2d6d2c){var _0x66fcb5=_0xf709fa[_0xda72('0x55')][_0xda72('0x69')];return db[_0xda72('0x67')][_0xda72('0x48')]({'where':{'id':_0x66fcb5},'attributes':['id'],'include':[{'model':db[_0xda72('0x5d')],'as':'Agents','attributes':['id',_0xda72('0x2e'),_0xda72('0x6a'),_0xda72('0x6b'),'interface'],'raw':!![]}]})[_0xda72('0x2a')](function(_0x5c3385){if(_0x5c3385){var _0x291fe5=_[_0xda72('0x6c')](_0x5c3385,function(_0x50b7ac){var _0x13c741=_0x50b7ac[_0xda72('0x2c')]({'plain':!![]});return _0x13c741[_0xda72('0x6d')];});return db['SmsQueue']['find']({'where':{'id':_0xf709fa[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](function(_0x40f73e){return db['sequelize'][_0xda72('0x6e')](function(_0x5edf45){return _0x40f73e[_0xda72('0x68')](_0x66fcb5,{'transaction':_0x5edf45})[_0xda72('0x2a')](function(){return BPromise[_0xda72('0x6f')](_0x291fe5,function(_0x10535a){return db[_0xda72('0x5a')][_0xda72('0x70')]({'where':{'UserId':_0x10535a['id'],'SmsQueueId':_0xf709fa[_0xda72('0x56')]['id']},'transaction':_0x5edf45});});})[_0xda72('0x2a')](function(){_0x291fe5[_0xda72('0x71')](function(_0x3af213){socket['emit'](_0xda72('0x72'),{'UserId':_0x3af213['id'],'SmsQueueId':_0x40f73e['id']});});});});});}})['then'](respondWithStatusCode(_0x7f7435,null))[_0xda72('0x4a')](handleError(_0x7f7435,null));};exports[_0xda72('0x73')]=function(_0x251313,_0x513f4c,_0x33e831){return db[_0xda72('0x67')][_0xda72('0x48')]({'where':{'id':_0x251313[_0xda72('0x36')][_0xda72('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xda72('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xda72('0x2a')](handleEntityNotFound(_0x513f4c,null))[_0xda72('0x2a')](function(_0x37df16){var _0x38f49a=_[_0xda72('0x31')](_0x37df16,'id');var _0xb0e883=[];var _0x3a1ef5=[];var _0x2e1a59=squel[_0xda72('0x74')]();_0x2e1a59[_0xda72('0x75')](_0xda72('0x76'))[_0xda72('0x77')]('team_has_sms_queues','tq')[_0xda72('0x78')](_0xda72('0x79'),'ut',_0xda72('0x7a'))[_0xda72('0x40')](_0xda72('0x7b'),_0x251313[_0xda72('0x56')]['id']);for(var _0x513bc9=0x0;_0x513bc9<_0x37df16[_0xda72('0x3b')];_0x513bc9+=0x1){let _0x242741=_0x37df16[_0x513bc9];for(var _0x12c289=0x0;_0x12c289<_0x242741[_0xda72('0x6d')]['length'];_0x12c289+=0x1){let _0x52c452=_0x242741[_0xda72('0x6d')][_0x12c289];var _0x108a08=_0x2e1a59['clone']();_0x108a08[_0xda72('0x40')](_0xda72('0x7c'),_0x52c452['id']);_0x3a1ef5['push'](db[_0xda72('0x7d')][_0xda72('0x36')](_0x108a08['toString'](),{'type':db[_0xda72('0x7d')][_0xda72('0x7e')][_0xda72('0x7f')]})[_0xda72('0x2a')](function(_0x21cb95){if(_0x21cb95[_0xda72('0x3b')]===0x1){return _0x52c452['id'];}else{var _0x5cc55c=_[_0xda72('0x80')](_[_0xda72('0x31')](_0x21cb95,_0xda72('0x81')),function(_0x5d490d){return _[_0xda72('0x82')](_0x38f49a,_0x5d490d);});if(_0x5cc55c){return _0x52c452['id'];}}}));}}return BPromise[_0xda72('0x83')](_0x3a1ef5)['then'](function(_0x379ac6){_0xb0e883=_(_0xb0e883)[_0xda72('0x84')](_0x379ac6)[_0xda72('0x85')]()[_0xda72('0x86')]();return db[_0xda72('0x47')][_0xda72('0x4d')]({'where':{'id':_0x251313[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](function(_0x2637dd){return db[_0xda72('0x7d')]['transaction'](function(_0x3e8006){return _0x2637dd[_0xda72('0x73')](_0x251313[_0xda72('0x36')][_0xda72('0x69')],{'transaction':_0x3e8006})['then'](function(){if(!_[_0xda72('0x87')](_0xb0e883)){return _0x2637dd[_0xda72('0x88')](_0xb0e883,{'transaction':_0x3e8006});}})[_0xda72('0x2a')](function(){_0xb0e883[_0xda72('0x71')](function(_0x570a8c){socket['emit'](_0xda72('0x89'),{'UserId':_0x570a8c,'SmsQueueId':_0x2637dd['id']});});});});});});})[_0xda72('0x2a')](respondWithStatusCode(_0x513f4c,null))[_0xda72('0x4a')](handleError(_0x513f4c,null));};exports[_0xda72('0x8a')]=function(_0x1497b9,_0x25773f,_0x4763ca){return db['SmsQueue'][_0xda72('0x4d')]({'where':{'id':_0x1497b9[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x25773f,null))[_0xda72('0x2a')](function(_0x510aaa){if(_0x510aaa){return _0x510aaa['addAgents'](_0x1497b9[_0xda72('0x55')][_0xda72('0x69')],_['omit'](_0x1497b9[_0xda72('0x55')],[_0xda72('0x69'),'id'])||{})[_0xda72('0x8b')](function(_0x4e4ee0){for(var _0x570d80=0x0;_0x570d80<_0x1497b9[_0xda72('0x55')][_0xda72('0x69')]['length'];_0x570d80+=0x1){socket[_0xda72('0x8c')]('userSmsQueue:save',{'UserId':Number(_0x1497b9[_0xda72('0x55')]['ids'][_0x570d80]),'SmsQueueId':Number(_0x1497b9[_0xda72('0x56')]['id'])});}return _0x4e4ee0;});}})[_0xda72('0x2a')](respondWithResult(_0x25773f,null))['catch'](handleError(_0x25773f,null));};exports['removeAgents']=function(_0xe56161,_0x4eb5dc,_0x371d33){return db[_0xda72('0x47')][_0xda72('0x4d')]({'where':{'id':_0xe56161[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x4eb5dc,null))[_0xda72('0x2a')](function(_0x99ecf7){if(_0x99ecf7){return _0x99ecf7[_0xda72('0x88')](_0xe56161['query'][_0xda72('0x69')])[_0xda72('0x2a')](function(){if(_[_0xda72('0x8d')](_0xe56161[_0xda72('0x36')][_0xda72('0x69')])){for(var _0x361d9a=0x0;_0x361d9a<_0xe56161[_0xda72('0x36')]['ids'][_0xda72('0x3b')];_0x361d9a+=0x1){socket[_0xda72('0x8c')](_0xda72('0x89'),{'UserId':Number(_0xe56161[_0xda72('0x36')][_0xda72('0x69')][_0x361d9a]),'SmsQueueId':Number(_0xe56161[_0xda72('0x56')]['id'])});}}else{socket[_0xda72('0x8c')]('userSmsQueue:remove',{'UserId':Number(_0xe56161[_0xda72('0x36')][_0xda72('0x69')]),'SmsQueueId':Number(_0xe56161['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4eb5dc,null))['catch'](handleError(_0x4eb5dc,null));};exports[_0xda72('0x8e')]=function(_0x137d3a,_0x42e2a3,_0x5ac184){var _0x70dc80={};var _0x11e470={};var _0x1423f6;var _0x35ffe6;return db[_0xda72('0x47')]['findOne']({'where':{'id':_0x137d3a[_0xda72('0x56')]['id']}})[_0xda72('0x2a')](handleEntityNotFound(_0x42e2a3,null))[_0xda72('0x2a')](function(_0x5cf3bc){if(_0x5cf3bc){_0x1423f6=_0x5cf3bc;_0x11e470[_0xda72('0x35')]=_[_0xda72('0x37')](db[_0xda72('0x5d')][_0xda72('0x32')]);_0x11e470['query']=_[_0xda72('0x37')](_0x137d3a['query']);_0x11e470[_0xda72('0x38')]=_[_0xda72('0x4c')](_0x11e470[_0xda72('0x35')],_0x11e470[_0xda72('0x36')]);_0x70dc80[_0xda72('0x39')]=_[_0xda72('0x4c')](_0x11e470[_0xda72('0x35')],qs[_0xda72('0x3a')](_0x137d3a[_0xda72('0x36')]['fields']));_0x70dc80[_0xda72('0x39')]=_0x70dc80[_0xda72('0x39')][_0xda72('0x3b')]?_0x70dc80['attributes']:_0x11e470['model'];_0x70dc80[_0xda72('0x3e')]=qs[_0xda72('0x3f')](_0x137d3a['query'][_0xda72('0x3f')]);_0x70dc80[_0xda72('0x40')]=qs[_0xda72('0x38')](_['pick'](_0x137d3a[_0xda72('0x36')],_0x11e470[_0xda72('0x38')]));if(_0x137d3a[_0xda72('0x36')][_0xda72('0x41')]){_0x70dc80[_0xda72('0x40')]=_[_0xda72('0x42')](_0x70dc80[_0xda72('0x40')],{'$or':_[_0xda72('0x31')](_0x70dc80[_0xda72('0x39')],function(_0x4f8d29){var _0x14e8ea={};_0x14e8ea[_0x4f8d29]={'$like':'%'+_0x137d3a[_0xda72('0x36')][_0xda72('0x41')]+'%'};return _0x14e8ea;})});}_0x70dc80=_[_0xda72('0x42')]({},_0x70dc80,_0x137d3a[_0xda72('0x45')]);return _0x1423f6[_0xda72('0x8e')](_0x70dc80);}})['then'](function(_0x586990){if(_0x586990){_0x35ffe6=_0x586990[_0xda72('0x3b')];if(!_0x137d3a[_0xda72('0x36')][_0xda72('0x3c')](_0xda72('0x3d'))){_0x70dc80[_0xda72('0x24')]=qs[_0xda72('0x24')](_0x137d3a[_0xda72('0x36')][_0xda72('0x24')]);_0x70dc80[_0xda72('0x22')]=qs[_0xda72('0x22')](_0x137d3a[_0xda72('0x36')][_0xda72('0x22')]);}return _0x1423f6['getAgents'](_0x70dc80);}})[_0xda72('0x2a')](function(_0x653d43){if(_0x653d43){return _0x653d43?{'count':_0x35ffe6,'rows':_0x653d43}:null;}})[_0xda72('0x2a')](respondWithResult(_0x42e2a3,null))[_0xda72('0x4a')](handleError(_0x42e2a3,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2c6b4ae..191acf6 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 _0x567d=['hasOwnProperty','hook','exports','events','SmsQueue','save','remove','emit'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x567d,0xcb));var _0xd567=function(_0x4766f9,_0x5e2368){_0x4766f9=_0x4766f9-0x0;var _0x5a45e4=_0x567d[_0x4766f9];return _0x5a45e4;};'use strict';var EventEmitter=require(_0xd567('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xd567('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd567('0x2'),'afterUpdate':'update','afterDestroy':_0xd567('0x3')};function emitEvent(_0x5c26e5){return function(_0x3d1be2,_0x5070d2,_0x16401a){SmsQueueEvents[_0xd567('0x4')](_0x5c26e5+':'+_0x3d1be2['id'],_0x3d1be2);SmsQueueEvents['emit'](_0x5c26e5,_0x3d1be2);_0x16401a(null);};}for(var e in events){if(events[_0xd567('0x5')](e)){var event=events[e];SmsQueue[_0xd567('0x6')](e,emitEvent(event));}}module[_0xd567('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x8972=['events','../../mysqldb','SmsQueue','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x8972,0xd8));var _0x2897=function(_0x177488,_0x5329bf){_0x177488=_0x177488-0x0;var _0x5aba8e=_0x8972[_0x177488];return _0x5aba8e;};'use strict';var EventEmitter=require(_0x2897('0x0'));var SmsQueue=require(_0x2897('0x1'))['db'][_0x2897('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2897('0x3'),'afterUpdate':_0x2897('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1f074b){return function(_0xb7aeb6,_0x1d26be,_0x3179cf){SmsQueueEvents[_0x2897('0x5')](_0x1f074b+':'+_0xb7aeb6['id'],_0xb7aeb6);SmsQueueEvents[_0x2897('0x5')](_0x1f074b,_0xb7aeb6);_0x3179cf(null);};}for(var e in events){if(events[_0x2897('0x6')](e)){var event=events[e];SmsQueue[_0x2897('0x7')](e,emitEvent(event));}}module[_0x2897('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 88331ee..ffae343 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 _0xaefa=['lodash','util','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports'];(function(_0x82ac81,_0x28b115){var _0x4b40dd=function(_0x46ff0e){while(--_0x46ff0e){_0x82ac81['push'](_0x82ac81['shift']());}};_0x4b40dd(++_0x28b115);}(_0xaefa,0x195));var _0xaaef=function(_0x1f5cb9,_0x255503){_0x1f5cb9=_0x1f5cb9-0x0;var _0xf60e23=_0xaefa[_0x1f5cb9];return _0xf60e23;};'use strict';var _=require(_0xaaef('0x0'));var util=require(_0xaaef('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaaef('0x2'));var BPromise=require(_0xaaef('0x3'));var rp=require(_0xaaef('0x4'));var fs=require('fs');var path=require(_0xaaef('0x5'));var rimraf=require(_0xaaef('0x6'));var config=require('../../config/environment');var attributes=require(_0xaaef('0x7'));module[_0xaaef('0x8')]=function(_0x186044,_0x423050){return _0x186044['define']('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3220=['request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird'];(function(_0x404f06,_0x5287a2){var _0x37811f=function(_0xf6161c){while(--_0xf6161c){_0x404f06['push'](_0x404f06['shift']());}};_0x37811f(++_0x5287a2);}(_0x3220,0x1e8));var _0x0322=function(_0xcbbda3,_0x461039){_0xcbbda3=_0xcbbda3-0x0;var _0x424eb4=_0x3220[_0xcbbda3];return _0x424eb4;};'use strict';var _=require(_0x0322('0x0'));var util=require(_0x0322('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0322('0x2'));var BPromise=require(_0x0322('0x3'));var rp=require(_0x0322('0x4'));var fs=require('fs');var path=require(_0x0322('0x5'));var rimraf=require('rimraf');var config=require(_0x0322('0x6'));var attributes=require(_0x0322('0x7'));module[_0x0322('0x8')]=function(_0x43327b,_0x1a5d0a){return _0x43327b[_0x0322('0x9')](_0x0322('0xa'),attributes,{'tableName':_0x0322('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 ed28260..daa78b9 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 _0xf184=['limit','include','map','model','stringify','ShowSmsQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','attributes'];(function(_0x191f12,_0x5a77bb){var _0x31090b=function(_0x207f16){while(--_0x207f16){_0x191f12['push'](_0x191f12['shift']());}};_0x31090b(++_0x5a77bb);}(_0xf184,0xa8));var _0x4f18=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xf184[_0x280ae7];return _0x418b9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f18('0x0'));var BPromise=require(_0x4f18('0x1'));var rs=require(_0x4f18('0x2'));var fs=require('fs');var Redis=require(_0x4f18('0x3'));var db=require(_0x4f18('0x4'))['db'];var utils=require(_0x4f18('0x5'));var logger=require(_0x4f18('0x6'))(_0x4f18('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f18('0x8'));var client=jayson[_0x4f18('0x9')][_0x4f18('0xa')]({'port':0x232a});config['redis']=_[_0x4f18('0xb')](config[_0x4f18('0xc')],{'host':_0x4f18('0xd'),'port':0x18eb});var socket=require(_0x4f18('0xe'))(new Redis(config[_0x4f18('0xc')]));require('./smsQueue.socket')[_0x4f18('0xf')](socket);function respondWithRpcPromise(_0x4e915a,_0x5ababb,_0x2f57c6){return new BPromise(function(_0x44f20b,_0x3713ae){return client[_0x4f18('0x10')](_0x4e915a,_0x2f57c6)[_0x4f18('0x11')](function(_0x1085cd){logger[_0x4f18('0x12')](_0x4f18('0x13'),_0x5ababb,_0x4f18('0x14'));logger[_0x4f18('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5ababb,_0x4f18('0x14'),JSON['stringify'](_0x1085cd));if(_0x1085cd['error']){if(_0x1085cd[_0x4f18('0x16')][_0x4f18('0x17')]===0x1f4){logger['error'](_0x4f18('0x13'),_0x5ababb,_0x1085cd[_0x4f18('0x16')][_0x4f18('0x18')]);return _0x3713ae(_0x1085cd['error'][_0x4f18('0x18')]);}logger[_0x4f18('0x16')]('SmsQueue,\x20%s,\x20%s',_0x5ababb,_0x1085cd[_0x4f18('0x16')][_0x4f18('0x18')]);return _0x44f20b(_0x1085cd[_0x4f18('0x16')][_0x4f18('0x18')]);}else{logger[_0x4f18('0x12')](_0x4f18('0x13'),_0x5ababb,_0x4f18('0x14'));_0x44f20b(_0x1085cd[_0x4f18('0x19')][_0x4f18('0x18')]);}})[_0x4f18('0x1a')](function(_0x5a019e){logger[_0x4f18('0x16')](_0x4f18('0x13'),_0x5ababb,_0x5a019e);_0x3713ae(_0x5a019e);});});}exports[_0x4f18('0x1b')]=function(_0x3427d9){var _0x1ad6e5=this;return new Promise(function(_0x292c26,_0x22c80e){return db[_0x4f18('0x1c')][_0x4f18('0x1d')]({'raw':_0x3427d9['options']?_0x3427d9[_0x4f18('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3427d9[_0x4f18('0x1e')]?_0x3427d9[_0x4f18('0x1e')]['where']||null:null,'attributes':_0x3427d9[_0x4f18('0x1e')]?_0x3427d9['options'][_0x4f18('0x1f')]||null:null,'limit':_0x3427d9[_0x4f18('0x1e')]?_0x3427d9[_0x4f18('0x1e')][_0x4f18('0x20')]||null:null,'include':_0x3427d9[_0x4f18('0x1e')]?_0x3427d9[_0x4f18('0x1e')][_0x4f18('0x21')]?_[_0x4f18('0x22')](_0x3427d9['options']['include'],function(_0x37ba27){return{'model':db[_0x37ba27[_0x4f18('0x23')]],'as':_0x37ba27['as'],'attributes':_0x37ba27['attributes'],'include':_0x37ba27[_0x4f18('0x21')]?_[_0x4f18('0x22')](_0x37ba27[_0x4f18('0x21')],function(_0xba9ac8){return{'model':db[_0xba9ac8[_0x4f18('0x23')]],'as':_0xba9ac8['as'],'attributes':_0xba9ac8['attributes'],'include':_0xba9ac8[_0x4f18('0x21')]?_[_0x4f18('0x22')](_0xba9ac8[_0x4f18('0x21')],function(_0xac6229){return{'model':db[_0xac6229['model']],'as':_0xac6229['as'],'attributes':_0xac6229[_0x4f18('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4f18('0x11')](function(_0x3eb9fd){logger[_0x4f18('0x12')](_0x4f18('0x1b'),_0x3427d9);logger[_0x4f18('0x15')](_0x4f18('0x1b'),_0x3427d9,JSON[_0x4f18('0x24')](_0x3eb9fd));_0x292c26(_0x3eb9fd);})['catch'](function(_0x16224b){logger[_0x4f18('0x16')]('GetSmsQueue',_0x16224b[_0x4f18('0x18')],_0x3427d9);_0x22c80e(_0x1ad6e5['error'](0x1f4,_0x16224b[_0x4f18('0x18')]));});});};exports[_0x4f18('0x25')]=function(_0xaa4a1d){var _0x310d3e=this;return new Promise(function(_0x3122bb,_0x96c68a){return db['SmsQueue'][_0x4f18('0x26')]({'raw':_0xaa4a1d['options']?_0xaa4a1d[_0x4f18('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xaa4a1d[_0x4f18('0x1e')]?_0xaa4a1d['options'][_0x4f18('0x27')]||null:null,'attributes':_0xaa4a1d[_0x4f18('0x1e')]?_0xaa4a1d[_0x4f18('0x1e')]['attributes']||null:null,'include':_0xaa4a1d[_0x4f18('0x1e')]?_0xaa4a1d[_0x4f18('0x1e')][_0x4f18('0x21')]?_[_0x4f18('0x22')](_0xaa4a1d[_0x4f18('0x1e')][_0x4f18('0x21')],function(_0x22c235){return{'model':db[_0x22c235[_0x4f18('0x23')]],'as':_0x22c235['as'],'attributes':_0x22c235[_0x4f18('0x1f')],'include':_0x22c235['include']?_[_0x4f18('0x22')](_0x22c235['include'],function(_0x10cacc){return{'model':db[_0x10cacc[_0x4f18('0x23')]],'as':_0x10cacc['as'],'attributes':_0x10cacc['attributes'],'include':_0x10cacc[_0x4f18('0x21')]?_[_0x4f18('0x22')](_0x10cacc['include'],function(_0x5bc286){return{'model':db[_0x5bc286[_0x4f18('0x23')]],'as':_0x5bc286['as'],'attributes':_0x5bc286[_0x4f18('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4f18('0x11')](function(_0x4455fd){logger['info']('ShowSmsQueue',_0xaa4a1d);logger[_0x4f18('0x15')]('ShowSmsQueue',_0xaa4a1d,JSON[_0x4f18('0x24')](_0x4455fd));_0x3122bb(_0x4455fd);})[_0x4f18('0x1a')](function(_0xcf1c7f){logger[_0x4f18('0x16')](_0x4f18('0x25'),_0xcf1c7f[_0x4f18('0x18')],_0xaa4a1d);_0x96c68a(_0x310d3e[_0x4f18('0x16')](0x1f4,_0xcf1c7f[_0x4f18('0x18')]));});});}; \ No newline at end of file +var _0x4a70=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','limit','include','map','model','attributes','ShowSmsQueue','SmsQueue'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x4a70,0xd8));var _0x04a7=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x4a70[_0x280ae7];return _0x418b9e;};'use strict';var _=require(_0x04a7('0x0'));var util=require(_0x04a7('0x1'));var moment=require(_0x04a7('0x2'));var BPromise=require(_0x04a7('0x3'));var rs=require(_0x04a7('0x4'));var fs=require('fs');var Redis=require(_0x04a7('0x5'));var db=require(_0x04a7('0x6'))['db'];var utils=require(_0x04a7('0x7'));var logger=require('../../config/logger')(_0x04a7('0x8'));var config=require(_0x04a7('0x9'));var jayson=require(_0x04a7('0xa'));var client=jayson[_0x04a7('0xb')][_0x04a7('0xc')]({'port':0x232a});config[_0x04a7('0xd')]=_[_0x04a7('0xe')](config[_0x04a7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x04a7('0xf'))(new Redis(config[_0x04a7('0xd')]));require(_0x04a7('0x10'))[_0x04a7('0x11')](socket);function respondWithRpcPromise(_0x4e9c5a,_0x340ed2,_0x319b35){return new BPromise(function(_0x1ed40c,_0x212daf){return client[_0x04a7('0x12')](_0x4e9c5a,_0x319b35)[_0x04a7('0x13')](function(_0x20386e){logger[_0x04a7('0x14')](_0x04a7('0x15'),_0x340ed2,'request\x20sent');logger[_0x04a7('0x16')](_0x04a7('0x17'),_0x340ed2,_0x04a7('0x18'),JSON[_0x04a7('0x19')](_0x20386e));if(_0x20386e[_0x04a7('0x1a')]){if(_0x20386e[_0x04a7('0x1a')][_0x04a7('0x1b')]===0x1f4){logger[_0x04a7('0x1a')](_0x04a7('0x15'),_0x340ed2,_0x20386e[_0x04a7('0x1a')][_0x04a7('0x1c')]);return _0x212daf(_0x20386e[_0x04a7('0x1a')][_0x04a7('0x1c')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x340ed2,_0x20386e['error'][_0x04a7('0x1c')]);return _0x1ed40c(_0x20386e[_0x04a7('0x1a')][_0x04a7('0x1c')]);}else{logger[_0x04a7('0x14')](_0x04a7('0x15'),_0x340ed2,'request\x20sent');_0x1ed40c(_0x20386e[_0x04a7('0x1d')][_0x04a7('0x1c')]);}})[_0x04a7('0x1e')](function(_0x374eec){logger[_0x04a7('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x340ed2,_0x374eec);_0x212daf(_0x374eec);});});}exports[_0x04a7('0x1f')]=function(_0x4c3fc9){var _0x456173=this;return new Promise(function(_0x46f085,_0x21a05c){return db['SmsQueue'][_0x04a7('0x20')]({'raw':_0x4c3fc9[_0x04a7('0x21')]?_0x4c3fc9[_0x04a7('0x21')][_0x04a7('0x22')]===undefined?!![]:![]:!![],'where':_0x4c3fc9[_0x04a7('0x21')]?_0x4c3fc9[_0x04a7('0x21')]['where']||null:null,'attributes':_0x4c3fc9[_0x04a7('0x21')]?_0x4c3fc9[_0x04a7('0x21')]['attributes']||null:null,'limit':_0x4c3fc9['options']?_0x4c3fc9[_0x04a7('0x21')][_0x04a7('0x23')]||null:null,'include':_0x4c3fc9[_0x04a7('0x21')]?_0x4c3fc9[_0x04a7('0x21')][_0x04a7('0x24')]?_[_0x04a7('0x25')](_0x4c3fc9[_0x04a7('0x21')][_0x04a7('0x24')],function(_0x12d0ed){return{'model':db[_0x12d0ed[_0x04a7('0x26')]],'as':_0x12d0ed['as'],'attributes':_0x12d0ed[_0x04a7('0x27')],'include':_0x12d0ed[_0x04a7('0x24')]?_[_0x04a7('0x25')](_0x12d0ed[_0x04a7('0x24')],function(_0x141d51){return{'model':db[_0x141d51[_0x04a7('0x26')]],'as':_0x141d51['as'],'attributes':_0x141d51[_0x04a7('0x27')],'include':_0x141d51[_0x04a7('0x24')]?_[_0x04a7('0x25')](_0x141d51['include'],function(_0x2e64cf){return{'model':db[_0x2e64cf[_0x04a7('0x26')]],'as':_0x2e64cf['as'],'attributes':_0x2e64cf[_0x04a7('0x27')]};}):[]};}):[]};}):[]:[]})[_0x04a7('0x13')](function(_0x5f51f2){logger[_0x04a7('0x14')](_0x04a7('0x1f'),_0x4c3fc9);logger[_0x04a7('0x16')](_0x04a7('0x1f'),_0x4c3fc9,JSON[_0x04a7('0x19')](_0x5f51f2));_0x46f085(_0x5f51f2);})[_0x04a7('0x1e')](function(_0x4d7ba3){logger[_0x04a7('0x1a')](_0x04a7('0x1f'),_0x4d7ba3[_0x04a7('0x1c')],_0x4c3fc9);_0x21a05c(_0x456173[_0x04a7('0x1a')](0x1f4,_0x4d7ba3[_0x04a7('0x1c')]));});});};exports[_0x04a7('0x28')]=function(_0x551fc2){var _0x2fec4c=this;return new Promise(function(_0xe4c10d,_0x3c78b3){return db[_0x04a7('0x29')][_0x04a7('0x2a')]({'raw':_0x551fc2['options']?_0x551fc2['options']['raw']===undefined?!![]:![]:!![],'where':_0x551fc2['options']?_0x551fc2[_0x04a7('0x21')]['where']||null:null,'attributes':_0x551fc2[_0x04a7('0x21')]?_0x551fc2[_0x04a7('0x21')][_0x04a7('0x27')]||null:null,'include':_0x551fc2[_0x04a7('0x21')]?_0x551fc2[_0x04a7('0x21')][_0x04a7('0x24')]?_[_0x04a7('0x25')](_0x551fc2[_0x04a7('0x21')][_0x04a7('0x24')],function(_0x152161){return{'model':db[_0x152161[_0x04a7('0x26')]],'as':_0x152161['as'],'attributes':_0x152161[_0x04a7('0x27')],'include':_0x152161['include']?_[_0x04a7('0x25')](_0x152161[_0x04a7('0x24')],function(_0x5950c6){return{'model':db[_0x5950c6[_0x04a7('0x26')]],'as':_0x5950c6['as'],'attributes':_0x5950c6[_0x04a7('0x27')],'include':_0x5950c6[_0x04a7('0x24')]?_[_0x04a7('0x25')](_0x5950c6['include'],function(_0x45efd2){return{'model':db[_0x45efd2['model']],'as':_0x45efd2['as'],'attributes':_0x45efd2[_0x04a7('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b279f){logger[_0x04a7('0x14')]('ShowSmsQueue',_0x551fc2);logger[_0x04a7('0x16')](_0x04a7('0x28'),_0x551fc2,JSON[_0x04a7('0x19')](_0x4b279f));_0xe4c10d(_0x4b279f);})[_0x04a7('0x1e')](function(_0x2de33e){logger[_0x04a7('0x1a')]('ShowSmsQueue',_0x2de33e['message'],_0x551fc2);_0x3c78b3(_0x2fec4c[_0x04a7('0x1a')](0x1f4,_0x2de33e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d388b0f..8fd382f 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 _0x8e82=['removeListener','length','smsQueue:','./smsQueue.events','save','update'];(function(_0x4c31fc,_0x25021b){var _0x527de2=function(_0x10d0bd){while(--_0x10d0bd){_0x4c31fc['push'](_0x4c31fc['shift']());}};_0x527de2(++_0x25021b);}(_0x8e82,0x14d));var _0x28e8=function(_0x3906b4,_0x3aceb1){_0x3906b4=_0x3906b4-0x0;var _0x1e5805=_0x8e82[_0x3906b4];return _0x1e5805;};'use strict';var SmsQueueEvents=require(_0x28e8('0x0'));var events=[_0x28e8('0x1'),'remove',_0x28e8('0x2')];function createListener(_0x23a46,_0x280438){return function(_0x5e6103){_0x280438['emit'](_0x23a46,_0x5e6103);};}function removeListener(_0x5f0f7f,_0x30aa53){return function(){SmsQueueEvents[_0x28e8('0x3')](_0x5f0f7f,_0x30aa53);};}exports['register']=function(_0x4687d6){for(var _0x533f97=0x0,_0x732472=events[_0x28e8('0x4')];_0x533f97<_0x732472;_0x533f97++){var _0x110479=events[_0x533f97];var _0x48abe9=createListener(_0x28e8('0x5')+_0x110479,_0x4687d6);SmsQueueEvents['on'](_0x110479,_0x48abe9);}}; \ No newline at end of file +var _0x7cc2=['./smsQueue.events','save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x7cc2,0xe1));var _0x27cc=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7cc2[_0x5ddaac];return _0x2a9c58;};'use strict';var SmsQueueEvents=require(_0x27cc('0x0'));var events=[_0x27cc('0x1'),_0x27cc('0x2'),_0x27cc('0x3')];function createListener(_0x15fc43,_0x1c520f){return function(_0x58b3c7){_0x1c520f[_0x27cc('0x4')](_0x15fc43,_0x58b3c7);};}function removeListener(_0x31f288,_0x1b714d){return function(){SmsQueueEvents[_0x27cc('0x5')](_0x31f288,_0x1b714d);};}exports[_0x27cc('0x6')]=function(_0x1cc098){for(var _0x3142d4=0x0,_0x5e288b=events[_0x27cc('0x7')];_0x3142d4<_0x5e288b;_0x3142d4++){var _0x311366=events[_0x3142d4];var _0x2b959e=createListener(_0x27cc('0x8')+_0x311366,_0x1cc098);SmsQueueEvents['on'](_0x311366,_0x2b959e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 69c5799..9a96982 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 _0x7eea=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x59c3ae,_0x3b195d){var _0x337d78=function(_0x3fcf31){while(--_0x3fcf31){_0x59c3ae['push'](_0x59c3ae['shift']());}};_0x337d78(++_0x3b195d);}(_0x7eea,0x9b));var _0xa7ee=function(_0x1812d0,_0x3a4b8a){_0x1812d0=_0x1812d0-0x0;var _0x348461=_0x7eea[_0x1812d0];return _0x348461;};'use strict';var multer=require(_0xa7ee('0x0'));var util=require(_0xa7ee('0x1'));var path=require(_0xa7ee('0x2'));var timeout=require(_0xa7ee('0x3'));var express=require(_0xa7ee('0x4'));var router=express[_0xa7ee('0x5')]();var fs_extra=require(_0xa7ee('0x6'));var auth=require(_0xa7ee('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa7ee('0x8'));var controller=require(_0xa7ee('0x9'));router['get']('/',auth[_0xa7ee('0xa')](),controller[_0xa7ee('0xb')]);router[_0xa7ee('0xc')](_0xa7ee('0xd'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0xe')]);router[_0xa7ee('0xc')](_0xa7ee('0xf'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x10')]);router[_0xa7ee('0x11')]('/',auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x12')]);router[_0xa7ee('0x13')](_0xa7ee('0xf'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa7ee('0x15')]);module['exports']=router; \ No newline at end of file +var _0x09f3=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller'];(function(_0x43f90e,_0x2b9e0c){var _0x226797=function(_0x5d3b4f){while(--_0x5d3b4f){_0x43f90e['push'](_0x43f90e['shift']());}};_0x226797(++_0x2b9e0c);}(_0x09f3,0x1c5));var _0x309f=function(_0x538acc,_0x47e62){_0x538acc=_0x538acc-0x0;var _0x3b985a=_0x09f3[_0x538acc];return _0x3b985a;};'use strict';var multer=require(_0x309f('0x0'));var util=require(_0x309f('0x1'));var path=require(_0x309f('0x2'));var timeout=require(_0x309f('0x3'));var express=require(_0x309f('0x4'));var router=express[_0x309f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x309f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x309f('0x7'));var controller=require(_0x309f('0x8'));router[_0x309f('0x9')]('/',auth[_0x309f('0xa')](),controller[_0x309f('0xb')]);router[_0x309f('0x9')](_0x309f('0xc'),auth['isAuthenticated'](),controller[_0x309f('0xd')]);router[_0x309f('0x9')](_0x309f('0xe'),auth[_0x309f('0xa')](),controller[_0x309f('0xf')]);router['post']('/',auth[_0x309f('0xa')](),controller[_0x309f('0x10')]);router[_0x309f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x309f('0x12')]);router['delete']('/:id',auth[_0x309f('0xa')](),controller[_0x309f('0x13')]);module[_0x309f('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5f2f122..3bf7c3e 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 _0x96bb=['STRING','DATE','sequelize','exports'];(function(_0x378e5d,_0x335caa){var _0x3f05f5=function(_0x1c3101){while(--_0x1c3101){_0x378e5d['push'](_0x378e5d['shift']());}};_0x3f05f5(++_0x335caa);}(_0x96bb,0x1be));var _0xb96b=function(_0x50180c,_0x3fc232){_0x50180c=_0x50180c-0x0;var _0x5eaa41=_0x96bb[_0x50180c];return _0x5eaa41;};'use strict';var moment=require('moment');var Sequelize=require(_0xb96b('0x0'));module[_0xb96b('0x1')]={'uniqueid':{'type':Sequelize[_0xb96b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb96b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb96b('0x3')]},'acceptAt':{'type':Sequelize[_0xb96b('0x3')]},'exitAt':{'type':Sequelize[_0xb96b('0x3')]},'reason':{'type':Sequelize[_0xb96b('0x2')]}}; \ No newline at end of file +var _0x075e=['STRING','DATE','sequelize','exports'];(function(_0x1064b8,_0x32e8ac){var _0x4a53bd=function(_0xe43f81){while(--_0xe43f81){_0x1064b8['push'](_0x1064b8['shift']());}};_0x4a53bd(++_0x32e8ac);}(_0x075e,0x92));var _0xe075=function(_0x35224b,_0x4ff192){_0x35224b=_0x35224b-0x0;var _0x169909=_0x075e[_0x35224b];return _0x169909;};'use strict';var moment=require('moment');var Sequelize=require(_0xe075('0x0'));module[_0xe075('0x1')]={'uniqueid':{'type':Sequelize[_0xe075('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe075('0x2')]},'joinAt':{'type':Sequelize[_0xe075('0x3')]},'leaveAt':{'type':Sequelize[_0xe075('0x3')]},'acceptAt':{'type':Sequelize[_0xe075('0x3')]},'exitAt':{'type':Sequelize[_0xe075('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ec3b96c..b2a8117 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 _0x891b=['length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x891b,0x131));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb891('0x0'));var rimraf=require(_0xb891('0x1'));var zipdir=require(_0xb891('0x2'));var jsonpatch=require(_0xb891('0x3'));var rp=require('request-promise');var moment=require(_0xb891('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb891('0x5'));var util=require(_0xb891('0x6'));var path=require('path');var sox=require(_0xb891('0x7'));var csv=require(_0xb891('0x8'));var ejs=require(_0xb891('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb891('0xa'));var jsforce=require(_0xb891('0xb'));var deskjs=require(_0xb891('0xc'));var toCsv=require(_0xb891('0x8'));var querystring=require(_0xb891('0xd'));var Papa=require('papaparse');var Redis=require(_0xb891('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb891('0xf'));var as=require(_0xb891('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb891('0x11'))(_0xb891('0x12'));var utils=require(_0xb891('0x13'));var config=require(_0xb891('0x14'));var licenseUtil=require(_0xb891('0x15'));var db=require(_0xb891('0x16'))['db'];function respondWithStatusCode(_0x16af9d,_0x31577c){_0x31577c=_0x31577c||0xcc;return function(_0x46f6c7){if(_0x46f6c7){return _0x16af9d[_0xb891('0x17')](_0x31577c);}return _0x16af9d[_0xb891('0x18')](_0x31577c)[_0xb891('0x19')]();};}function respondWithResult(_0x2008e0,_0x24ca89){_0x24ca89=_0x24ca89||0xc8;return function(_0x21c869){if(_0x21c869){return _0x2008e0['status'](_0x24ca89)[_0xb891('0x1a')](_0x21c869);}};}function respondWithFilteredResult(_0x3e1242,_0x1c65ba){return function(_0x323dc5){if(_0x323dc5){var _0x2867d8=typeof _0x1c65ba[_0xb891('0x1b')]===_0xb891('0x1c')&&typeof _0x1c65ba['limit']===_0xb891('0x1c');var _0x1e03b4=_0x323dc5['count'];var _0x1d6212=_0x2867d8?0x0:_0x1c65ba['offset'];var _0x2a67d1=_0x2867d8?_0x323dc5[_0xb891('0x1d')]:_0x1c65ba[_0xb891('0x1b')]+_0x1c65ba[_0xb891('0x1e')];var _0x4fdd3e;if(_0x2a67d1>=_0x1e03b4){_0x2a67d1=_0x1e03b4;_0x4fdd3e=0xc8;}else{_0x4fdd3e=0xce;}_0x3e1242[_0xb891('0x18')](_0x4fdd3e);return _0x3e1242[_0xb891('0x1f')](_0xb891('0x20'),_0x1d6212+'-'+_0x2a67d1+'/'+_0x1e03b4)['json'](_0x323dc5);}return null;};}function patchUpdates(_0x4037db){return function(_0x41b706){try{jsonpatch[_0xb891('0x21')](_0x41b706,_0x4037db,!![]);}catch(_0x3d1fbb){return BPromise[_0xb891('0x22')](_0x3d1fbb);}return _0x41b706[_0xb891('0x23')]();};}function saveUpdates(_0x24c9fd,_0x6f95ab){return function(_0x158fe8){if(_0x158fe8){return _0x158fe8[_0xb891('0x24')](_0x24c9fd)[_0xb891('0x25')](function(_0x3e5092){return _0x3e5092;});}return null;};}function removeEntity(_0x138a83,_0x3e9d4a){return function(_0xe37d16){if(_0xe37d16){return _0xe37d16[_0xb891('0x26')]()[_0xb891('0x25')](function(){_0x138a83[_0xb891('0x18')](0xcc)[_0xb891('0x19')]();});}};}function handleEntityNotFound(_0x57c26d,_0x4817cd){return function(_0x358859){if(!_0x358859){_0x57c26d[_0xb891('0x17')](0x194);}return _0x358859;};}function handleError(_0x4f00a8,_0x3abaa8){_0x3abaa8=_0x3abaa8||0x1f4;return function(_0x16e4e2){logger[_0xb891('0x27')](_0x16e4e2['stack']);if(_0x16e4e2[_0xb891('0x28')]){delete _0x16e4e2[_0xb891('0x28')];}_0x4f00a8[_0xb891('0x18')](_0x3abaa8)['send'](_0x16e4e2);};}exports[_0xb891('0x29')]=function(_0x10a5f0,_0x377785){var _0x42e243={},_0xd20a0={},_0x275840={'count':0x0,'rows':[]};var _0x295cd6=_[_0xb891('0x2a')](db['SmsQueueReport'][_0xb891('0x2b')],function(_0x2da86d){return{'name':_0x2da86d[_0xb891('0x2c')],'type':_0x2da86d['type'][_0xb891('0x2d')]};});_0xd20a0[_0xb891('0x2e')]=_[_0xb891('0x2a')](_0x295cd6,_0xb891('0x28'));_0xd20a0[_0xb891('0x2f')]=_[_0xb891('0x30')](_0x10a5f0[_0xb891('0x2f')]);_0xd20a0['filters']=_[_0xb891('0x31')](_0xd20a0[_0xb891('0x2e')],_0xd20a0[_0xb891('0x2f')]);_0x42e243['attributes']=_[_0xb891('0x31')](_0xd20a0[_0xb891('0x2e')],qs[_0xb891('0x32')](_0x10a5f0[_0xb891('0x2f')][_0xb891('0x32')]));_0x42e243['attributes']=_0x42e243['attributes']['length']?_0x42e243[_0xb891('0x33')]:_0xd20a0['model'];if(!_0x10a5f0[_0xb891('0x2f')][_0xb891('0x34')](_0xb891('0x35'))){_0x42e243[_0xb891('0x1e')]=qs[_0xb891('0x1e')](_0x10a5f0['query']['limit']);_0x42e243[_0xb891('0x1b')]=qs['offset'](_0x10a5f0[_0xb891('0x2f')][_0xb891('0x1b')]);}_0x42e243['order']=qs['sort'](_0x10a5f0[_0xb891('0x2f')][_0xb891('0x36')]);_0x42e243[_0xb891('0x37')]=qs['filters'](_[_0xb891('0x38')](_0x10a5f0[_0xb891('0x2f')],_0xd20a0[_0xb891('0x39')]),_0x295cd6);if(_0x10a5f0[_0xb891('0x2f')][_0xb891('0x3a')]){_0x42e243[_0xb891('0x37')]=_['merge'](_0x42e243['where'],{'$or':_[_0xb891('0x2a')](_0x295cd6,function(_0x2a7f9b){if(_0x2a7f9b['type']!==_0xb891('0x3b')){var _0x187637={};_0x187637[_0x2a7f9b['name']]={'$like':'%'+_0x10a5f0[_0xb891('0x2f')]['filter']+'%'};return _0x187637;}})});}_0x42e243=_[_0xb891('0x3c')]({},_0x42e243,_0x10a5f0[_0xb891('0x3d')]);var _0x1745f2={'where':_0x42e243[_0xb891('0x37')]};return db[_0xb891('0x3e')][_0xb891('0x1d')](_0x1745f2)[_0xb891('0x25')](function(_0xe77834){_0x275840[_0xb891('0x1d')]=_0xe77834;if(_0x10a5f0[_0xb891('0x2f')][_0xb891('0x3f')]){_0x42e243[_0xb891('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb891('0x41')](_0x42e243);})[_0xb891('0x25')](function(_0x4bc2a4){_0x275840[_0xb891('0x42')]=_0x4bc2a4;return _0x275840;})['then'](respondWithFilteredResult(_0x377785,_0x42e243))[_0xb891('0x43')](handleError(_0x377785,null));};exports[_0xb891('0x44')]=function(_0xfd4ef9,_0x1a1d2a){var _0x3a0c7b={'raw':!![],'where':{'id':_0xfd4ef9[_0xb891('0x45')]['id']}},_0x30e136={};_0x30e136[_0xb891('0x2e')]=_[_0xb891('0x30')](db['SmsQueueReport'][_0xb891('0x2b')]);_0x30e136[_0xb891('0x2f')]=_[_0xb891('0x30')](_0xfd4ef9[_0xb891('0x2f')]);_0x30e136[_0xb891('0x39')]=_['intersection'](_0x30e136[_0xb891('0x2e')],_0x30e136[_0xb891('0x2f')]);_0x3a0c7b[_0xb891('0x33')]=_[_0xb891('0x31')](_0x30e136['model'],qs['fields'](_0xfd4ef9['query'][_0xb891('0x32')]));_0x3a0c7b[_0xb891('0x33')]=_0x3a0c7b[_0xb891('0x33')][_0xb891('0x46')]?_0x3a0c7b[_0xb891('0x33')]:_0x30e136[_0xb891('0x2e')];if(_0xfd4ef9['query']['includeAll']){_0x3a0c7b['include']=[{'all':!![]}];}_0x3a0c7b=_['merge']({},_0x3a0c7b,_0xfd4ef9[_0xb891('0x3d')]);return db[_0xb891('0x3e')][_0xb891('0x47')](_0x3a0c7b)[_0xb891('0x25')](handleEntityNotFound(_0x1a1d2a,null))[_0xb891('0x25')](respondWithResult(_0x1a1d2a,null))[_0xb891('0x43')](handleError(_0x1a1d2a,null));};exports['create']=function(_0x49762a,_0x5d9757){return db[_0xb891('0x3e')][_0xb891('0x48')](_0x49762a['body'],{})[_0xb891('0x25')](respondWithResult(_0x5d9757,0xc9))[_0xb891('0x43')](handleError(_0x5d9757,null));};exports[_0xb891('0x24')]=function(_0x194fcd,_0x1714eb){if(_0x194fcd[_0xb891('0x49')]['id']){delete _0x194fcd['body']['id'];}return db['SmsQueueReport'][_0xb891('0x47')]({'where':{'id':_0x194fcd[_0xb891('0x45')]['id']}})[_0xb891('0x25')](handleEntityNotFound(_0x1714eb,null))[_0xb891('0x25')](saveUpdates(_0x194fcd[_0xb891('0x49')],null))[_0xb891('0x25')](respondWithResult(_0x1714eb,null))[_0xb891('0x43')](handleError(_0x1714eb,null));};exports[_0xb891('0x26')]=function(_0x3bee53,_0x50d7be){return db[_0xb891('0x3e')][_0xb891('0x47')]({'where':{'id':_0x3bee53[_0xb891('0x45')]['id']}})[_0xb891('0x25')](handleEntityNotFound(_0x50d7be,null))['then'](removeEntity(_0x50d7be,null))['catch'](handleError(_0x50d7be,null));};exports['describe']=function(_0x512549,_0x236d04){return db['SmsQueueReport'][_0xb891('0x4a')]()[_0xb891('0x25')](respondWithResult(_0x236d04,null))[_0xb891('0x43')](handleError(_0x236d04,null));}; \ No newline at end of file +var _0x1cba=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x30b57d,_0x775a59){var _0x2eedae=function(_0x1e880b){while(--_0x1e880b){_0x30b57d['push'](_0x30b57d['shift']());}};_0x2eedae(++_0x775a59);}(_0x1cba,0x12f));var _0xa1cb=function(_0x4ce3b8,_0x616767){_0x4ce3b8=_0x4ce3b8-0x0;var _0x302779=_0x1cba[_0x4ce3b8];return _0x302779;};'use strict';var emlformat=require(_0xa1cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1cb('0x1'));var jsonpatch=require(_0xa1cb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1cb('0x3'));var Mustache=require(_0xa1cb('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa1cb('0x5'));var csv=require(_0xa1cb('0x6'));var ejs=require(_0xa1cb('0x7'));var fs=require('fs');var fs_extra=require(_0xa1cb('0x8'));var _=require(_0xa1cb('0x9'));var squel=require(_0xa1cb('0xa'));var crypto=require(_0xa1cb('0xb'));var jsforce=require(_0xa1cb('0xc'));var deskjs=require(_0xa1cb('0xd'));var toCsv=require(_0xa1cb('0x6'));var querystring=require(_0xa1cb('0xe'));var Papa=require(_0xa1cb('0xf'));var Redis=require(_0xa1cb('0x10'));var authService=require(_0xa1cb('0x11'));var qs=require(_0xa1cb('0x12'));var as=require(_0xa1cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1cb('0x14'))(_0xa1cb('0x15'));var utils=require('../../config/utils');var config=require(_0xa1cb('0x16'));var licenseUtil=require(_0xa1cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x224410,_0x3729a8){_0x3729a8=_0x3729a8||0xcc;return function(_0x394e90){if(_0x394e90){return _0x224410[_0xa1cb('0x18')](_0x3729a8);}return _0x224410[_0xa1cb('0x19')](_0x3729a8)[_0xa1cb('0x1a')]();};}function respondWithResult(_0x5c04d8,_0x10fa11){_0x10fa11=_0x10fa11||0xc8;return function(_0x2520af){if(_0x2520af){return _0x5c04d8[_0xa1cb('0x19')](_0x10fa11)[_0xa1cb('0x1b')](_0x2520af);}};}function respondWithFilteredResult(_0x16d008,_0x4a1334){return function(_0x5bac05){if(_0x5bac05){var _0x21106b=typeof _0x4a1334['offset']===_0xa1cb('0x1c')&&typeof _0x4a1334[_0xa1cb('0x1d')]===_0xa1cb('0x1c');var _0x591db5=_0x5bac05[_0xa1cb('0x1e')];var _0x4f5d04=_0x21106b?0x0:_0x4a1334[_0xa1cb('0x1f')];var _0x1f5e5e=_0x21106b?_0x5bac05[_0xa1cb('0x1e')]:_0x4a1334['offset']+_0x4a1334[_0xa1cb('0x1d')];var _0x407531;if(_0x1f5e5e>=_0x591db5){_0x1f5e5e=_0x591db5;_0x407531=0xc8;}else{_0x407531=0xce;}_0x16d008[_0xa1cb('0x19')](_0x407531);return _0x16d008['set'](_0xa1cb('0x20'),_0x4f5d04+'-'+_0x1f5e5e+'/'+_0x591db5)[_0xa1cb('0x1b')](_0x5bac05);}return null;};}function patchUpdates(_0x35da26){return function(_0x1c436a){try{jsonpatch[_0xa1cb('0x21')](_0x1c436a,_0x35da26,!![]);}catch(_0x2ca29f){return BPromise[_0xa1cb('0x22')](_0x2ca29f);}return _0x1c436a['save']();};}function saveUpdates(_0x3b6d4f,_0x3727d6){return function(_0x1579c0){if(_0x1579c0){return _0x1579c0['update'](_0x3b6d4f)[_0xa1cb('0x23')](function(_0x511f2e){return _0x511f2e;});}return null;};}function removeEntity(_0x4e8b3b,_0x4c460f){return function(_0x390fb7){if(_0x390fb7){return _0x390fb7['destroy']()[_0xa1cb('0x23')](function(){_0x4e8b3b[_0xa1cb('0x19')](0xcc)[_0xa1cb('0x1a')]();});}};}function handleEntityNotFound(_0x513bf0,_0x3a85e5){return function(_0x210015){if(!_0x210015){_0x513bf0[_0xa1cb('0x18')](0x194);}return _0x210015;};}function handleError(_0x2d2eb4,_0x280842){_0x280842=_0x280842||0x1f4;return function(_0xc339a0){logger[_0xa1cb('0x24')](_0xc339a0[_0xa1cb('0x25')]);if(_0xc339a0[_0xa1cb('0x26')]){delete _0xc339a0['name'];}_0x2d2eb4['status'](_0x280842)[_0xa1cb('0x27')](_0xc339a0);};}exports[_0xa1cb('0x28')]=function(_0x211a3b,_0x9787d2){var _0x29b2f7={},_0x403342={},_0x33e742={'count':0x0,'rows':[]};var _0x1dd32d=_[_0xa1cb('0x29')](db[_0xa1cb('0x2a')][_0xa1cb('0x2b')],function(_0x3cff39){return{'name':_0x3cff39[_0xa1cb('0x2c')],'type':_0x3cff39[_0xa1cb('0x2d')][_0xa1cb('0x2e')]};});_0x403342[_0xa1cb('0x2f')]=_['map'](_0x1dd32d,_0xa1cb('0x26'));_0x403342[_0xa1cb('0x30')]=_[_0xa1cb('0x31')](_0x211a3b[_0xa1cb('0x30')]);_0x403342[_0xa1cb('0x32')]=_[_0xa1cb('0x33')](_0x403342[_0xa1cb('0x2f')],_0x403342[_0xa1cb('0x30')]);_0x29b2f7[_0xa1cb('0x34')]=_['intersection'](_0x403342[_0xa1cb('0x2f')],qs[_0xa1cb('0x35')](_0x211a3b[_0xa1cb('0x30')][_0xa1cb('0x35')]));_0x29b2f7[_0xa1cb('0x34')]=_0x29b2f7[_0xa1cb('0x34')][_0xa1cb('0x36')]?_0x29b2f7[_0xa1cb('0x34')]:_0x403342[_0xa1cb('0x2f')];if(!_0x211a3b['query'][_0xa1cb('0x37')](_0xa1cb('0x38'))){_0x29b2f7['limit']=qs[_0xa1cb('0x1d')](_0x211a3b[_0xa1cb('0x30')]['limit']);_0x29b2f7['offset']=qs[_0xa1cb('0x1f')](_0x211a3b[_0xa1cb('0x30')][_0xa1cb('0x1f')]);}_0x29b2f7[_0xa1cb('0x39')]=qs[_0xa1cb('0x3a')](_0x211a3b[_0xa1cb('0x30')][_0xa1cb('0x3a')]);_0x29b2f7[_0xa1cb('0x3b')]=qs[_0xa1cb('0x32')](_[_0xa1cb('0x3c')](_0x211a3b[_0xa1cb('0x30')],_0x403342[_0xa1cb('0x32')]),_0x1dd32d);if(_0x211a3b[_0xa1cb('0x30')][_0xa1cb('0x3d')]){_0x29b2f7[_0xa1cb('0x3b')]=_[_0xa1cb('0x3e')](_0x29b2f7[_0xa1cb('0x3b')],{'$or':_[_0xa1cb('0x29')](_0x1dd32d,function(_0x19fe84){if(_0x19fe84['type']!==_0xa1cb('0x3f')){var _0x34d878={};_0x34d878[_0x19fe84['name']]={'$like':'%'+_0x211a3b[_0xa1cb('0x30')]['filter']+'%'};return _0x34d878;}})});}_0x29b2f7=_['merge']({},_0x29b2f7,_0x211a3b[_0xa1cb('0x40')]);var _0x540180={'where':_0x29b2f7['where']};return db[_0xa1cb('0x2a')][_0xa1cb('0x1e')](_0x540180)[_0xa1cb('0x23')](function(_0x18db89){_0x33e742[_0xa1cb('0x1e')]=_0x18db89;if(_0x211a3b[_0xa1cb('0x30')][_0xa1cb('0x41')]){_0x29b2f7[_0xa1cb('0x42')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa1cb('0x43')](_0x29b2f7);})[_0xa1cb('0x23')](function(_0x668585){_0x33e742[_0xa1cb('0x44')]=_0x668585;return _0x33e742;})[_0xa1cb('0x23')](respondWithFilteredResult(_0x9787d2,_0x29b2f7))['catch'](handleError(_0x9787d2,null));};exports[_0xa1cb('0x45')]=function(_0x469f2f,_0x526866){var _0x33693b={'raw':!![],'where':{'id':_0x469f2f['params']['id']}},_0x45df64={};_0x45df64['model']=_['keys'](db['SmsQueueReport'][_0xa1cb('0x2b')]);_0x45df64[_0xa1cb('0x30')]=_[_0xa1cb('0x31')](_0x469f2f[_0xa1cb('0x30')]);_0x45df64[_0xa1cb('0x32')]=_['intersection'](_0x45df64[_0xa1cb('0x2f')],_0x45df64[_0xa1cb('0x30')]);_0x33693b[_0xa1cb('0x34')]=_[_0xa1cb('0x33')](_0x45df64[_0xa1cb('0x2f')],qs[_0xa1cb('0x35')](_0x469f2f[_0xa1cb('0x30')]['fields']));_0x33693b[_0xa1cb('0x34')]=_0x33693b['attributes'][_0xa1cb('0x36')]?_0x33693b['attributes']:_0x45df64[_0xa1cb('0x2f')];if(_0x469f2f['query'][_0xa1cb('0x41')]){_0x33693b[_0xa1cb('0x42')]=[{'all':!![]}];}_0x33693b=_[_0xa1cb('0x3e')]({},_0x33693b,_0x469f2f[_0xa1cb('0x40')]);return db[_0xa1cb('0x2a')][_0xa1cb('0x46')](_0x33693b)[_0xa1cb('0x23')](handleEntityNotFound(_0x526866,null))[_0xa1cb('0x23')](respondWithResult(_0x526866,null))[_0xa1cb('0x47')](handleError(_0x526866,null));};exports[_0xa1cb('0x48')]=function(_0x4310d3,_0x305a6b){return db[_0xa1cb('0x2a')][_0xa1cb('0x48')](_0x4310d3[_0xa1cb('0x49')],{})[_0xa1cb('0x23')](respondWithResult(_0x305a6b,0xc9))[_0xa1cb('0x47')](handleError(_0x305a6b,null));};exports[_0xa1cb('0x4a')]=function(_0x497b3f,_0x7f7365){if(_0x497b3f[_0xa1cb('0x49')]['id']){delete _0x497b3f[_0xa1cb('0x49')]['id'];}return db[_0xa1cb('0x2a')]['find']({'where':{'id':_0x497b3f[_0xa1cb('0x4b')]['id']}})[_0xa1cb('0x23')](handleEntityNotFound(_0x7f7365,null))['then'](saveUpdates(_0x497b3f[_0xa1cb('0x49')],null))[_0xa1cb('0x23')](respondWithResult(_0x7f7365,null))[_0xa1cb('0x47')](handleError(_0x7f7365,null));};exports[_0xa1cb('0x4c')]=function(_0x2dd9b4,_0x4418e2){return db[_0xa1cb('0x2a')][_0xa1cb('0x46')]({'where':{'id':_0x2dd9b4['params']['id']}})[_0xa1cb('0x23')](handleEntityNotFound(_0x4418e2,null))['then'](removeEntity(_0x4418e2,null))[_0xa1cb('0x47')](handleError(_0x4418e2,null));};exports[_0xa1cb('0x4d')]=function(_0x50eb67,_0x50381c){return db[_0xa1cb('0x2a')]['describe']()['then'](respondWithResult(_0x50381c,null))[_0xa1cb('0x47')](handleError(_0x50381c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f766263..afc3562 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x120207,_0x598472){var _0x1faa90=function(_0x1287c5){while(--_0x1287c5){_0x120207['push'](_0x120207['shift']());}};_0x1faa90(++_0x598472);}(_0xe706,0xa3));var _0x6e70=function(_0x2067e3,_0x19bcb2){_0x2067e3=_0x2067e3-0x0;var _0x180c44=_0xe706[_0x2067e3];return _0x180c44;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_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 93306e7..d560743 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 _0xf778=['where','attributes','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','UpdateSmsQueueReport'];(function(_0x3ba2f9,_0x209d30){var _0x4e4a74=function(_0x1cd525){while(--_0x1cd525){_0x3ba2f9['push'](_0x3ba2f9['shift']());}};_0x4e4a74(++_0x209d30);}(_0xf778,0x16e));var _0x8f77=function(_0x378d18,_0x17362b){_0x378d18=_0x378d18-0x0;var _0x52d233=_0xf778[_0x378d18];return _0x52d233;};'use strict';var _=require('lodash');var util=require(_0x8f77('0x0'));var moment=require(_0x8f77('0x1'));var BPromise=require(_0x8f77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f77('0x3'))['db'];var utils=require(_0x8f77('0x4'));var logger=require(_0x8f77('0x5'))('rpc');var config=require(_0x8f77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8f77('0x7')][_0x8f77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aee60,_0x4e9a96,_0x5c2085){return new BPromise(function(_0x41023b,_0x1be518){return client['request'](_0x4aee60,_0x5c2085)['then'](function(_0x3d4399){logger[_0x8f77('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x4e9a96,_0x8f77('0xa'));logger[_0x8f77('0xb')](_0x8f77('0xc'),_0x4e9a96,_0x8f77('0xa'),JSON[_0x8f77('0xd')](_0x3d4399));if(_0x3d4399[_0x8f77('0xe')]){if(_0x3d4399['error']['code']===0x1f4){logger['error'](_0x8f77('0xf'),_0x4e9a96,_0x3d4399[_0x8f77('0xe')]['message']);return _0x1be518(_0x3d4399[_0x8f77('0xe')]['message']);}logger[_0x8f77('0xe')](_0x8f77('0xf'),_0x4e9a96,_0x3d4399[_0x8f77('0xe')][_0x8f77('0x10')]);return _0x41023b(_0x3d4399[_0x8f77('0xe')][_0x8f77('0x10')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x4e9a96,_0x8f77('0xa'));_0x41023b(_0x3d4399[_0x8f77('0x11')][_0x8f77('0x10')]);}})[_0x8f77('0x12')](function(_0x12100f){logger[_0x8f77('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x4e9a96,_0x12100f);_0x1be518(_0x12100f);});});}exports[_0x8f77('0x13')]=function(_0x23d2d6){var _0x20f2c1=this;return new Promise(function(_0x49650c,_0x2421c3){return db[_0x8f77('0x14')]['create'](_0x23d2d6[_0x8f77('0x15')],{'raw':_0x23d2d6[_0x8f77('0x16')]?_0x23d2d6[_0x8f77('0x16')][_0x8f77('0x17')]===undefined?!![]:![]:!![]})[_0x8f77('0x18')](function(_0x4ff3ad){logger[_0x8f77('0x9')]('CreateSmsQueueReport',_0x23d2d6);logger['debug'](_0x8f77('0x13'),_0x23d2d6,JSON[_0x8f77('0xd')](_0x4ff3ad));_0x49650c(_0x4ff3ad);})['catch'](function(_0x134624){logger['error'](_0x8f77('0x13'),_0x134624[_0x8f77('0x10')],_0x23d2d6);_0x2421c3(_0x20f2c1['error'](0x1f4,_0x134624['message']));});});};exports[_0x8f77('0x19')]=function(_0x573e98){var _0x109efd=this;return new Promise(function(_0x2f1527,_0x41fb09){return db[_0x8f77('0x14')]['update'](_0x573e98[_0x8f77('0x15')],{'raw':_0x573e98['options']?_0x573e98[_0x8f77('0x16')][_0x8f77('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573e98[_0x8f77('0x16')]?_0x573e98[_0x8f77('0x16')][_0x8f77('0x1a')]||null:null,'attributes':_0x573e98['options']?_0x573e98[_0x8f77('0x16')][_0x8f77('0x1b')]||null:null,'limit':_0x573e98[_0x8f77('0x16')]?_0x573e98[_0x8f77('0x16')]['limit']||null:null})['then'](function(_0x48646f){logger[_0x8f77('0x9')](_0x8f77('0x19'),_0x573e98);logger[_0x8f77('0xb')](_0x8f77('0x19'),_0x573e98,JSON[_0x8f77('0xd')](_0x48646f));_0x2f1527(_0x48646f);})[_0x8f77('0x12')](function(_0x10e3d3){logger[_0x8f77('0xe')](_0x8f77('0x19'),_0x10e3d3[_0x8f77('0x10')],_0x573e98);_0x41fb09(_0x109efd['error'](0x1f4,_0x10e3d3['message']));});});}; \ No newline at end of file +var _0x175d=['catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','update','body','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x29d51d,_0x13ccfe){var _0x2d410a=function(_0x44d119){while(--_0x44d119){_0x29d51d['push'](_0x29d51d['shift']());}};_0x2d410a(++_0x13ccfe);}(_0x175d,0x1b9));var _0xd175=function(_0xe5bd5a,_0x413dbe){_0xe5bd5a=_0xe5bd5a-0x0;var _0xc97b71=_0x175d[_0xe5bd5a];return _0xc97b71;};'use strict';var _=require(_0xd175('0x0'));var util=require(_0xd175('0x1'));var moment=require(_0xd175('0x2'));var BPromise=require(_0xd175('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd175('0x4'));var db=require(_0xd175('0x5'))['db'];var utils=require(_0xd175('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd175('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd175('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46c4df,_0x118c73,_0x1e4d2e){return new BPromise(function(_0x105e3c,_0x361dbf){return client[_0xd175('0x9')](_0x46c4df,_0x1e4d2e)[_0xd175('0xa')](function(_0x2480b1){logger['info'](_0xd175('0xb'),_0x118c73,_0xd175('0xc'));logger[_0xd175('0xd')](_0xd175('0xe'),_0x118c73,_0xd175('0xc'),JSON[_0xd175('0xf')](_0x2480b1));if(_0x2480b1['error']){if(_0x2480b1['error'][_0xd175('0x10')]===0x1f4){logger[_0xd175('0x11')](_0xd175('0xb'),_0x118c73,_0x2480b1[_0xd175('0x11')][_0xd175('0x12')]);return _0x361dbf(_0x2480b1[_0xd175('0x11')][_0xd175('0x12')]);}logger[_0xd175('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x118c73,_0x2480b1['error']['message']);return _0x105e3c(_0x2480b1[_0xd175('0x11')]['message']);}else{logger[_0xd175('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x118c73,_0xd175('0xc'));_0x105e3c(_0x2480b1[_0xd175('0x14')][_0xd175('0x12')]);}})[_0xd175('0x15')](function(_0x2ee861){logger[_0xd175('0x11')](_0xd175('0xb'),_0x118c73,_0x2ee861);_0x361dbf(_0x2ee861);});});}exports[_0xd175('0x16')]=function(_0x725b6a){var _0x1c2d2f=this;return new Promise(function(_0x1ce8df,_0x39b1a2){return db[_0xd175('0x17')][_0xd175('0x18')](_0x725b6a['body'],{'raw':_0x725b6a[_0xd175('0x19')]?_0x725b6a[_0xd175('0x19')][_0xd175('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4256db){logger[_0xd175('0x13')](_0xd175('0x16'),_0x725b6a);logger[_0xd175('0xd')](_0xd175('0x16'),_0x725b6a,JSON[_0xd175('0xf')](_0x4256db));_0x1ce8df(_0x4256db);})['catch'](function(_0x3a16df){logger['error'](_0xd175('0x16'),_0x3a16df[_0xd175('0x12')],_0x725b6a);_0x39b1a2(_0x1c2d2f[_0xd175('0x11')](0x1f4,_0x3a16df['message']));});});};exports['UpdateSmsQueueReport']=function(_0x427ec1){var _0x5a3da5=this;return new Promise(function(_0x2cb0b8,_0x5e3b54){return db[_0xd175('0x17')][_0xd175('0x1b')](_0x427ec1[_0xd175('0x1c')],{'raw':_0x427ec1[_0xd175('0x19')]?_0x427ec1[_0xd175('0x19')][_0xd175('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x427ec1[_0xd175('0x19')]?_0x427ec1[_0xd175('0x19')][_0xd175('0x1d')]||null:null,'attributes':_0x427ec1[_0xd175('0x19')]?_0x427ec1['options'][_0xd175('0x1e')]||null:null,'limit':_0x427ec1[_0xd175('0x19')]?_0x427ec1['options'][_0xd175('0x1f')]||null:null})[_0xd175('0xa')](function(_0x386df3){logger['info']('UpdateSmsQueueReport',_0x427ec1);logger['debug'](_0xd175('0x20'),_0x427ec1,JSON[_0xd175('0xf')](_0x386df3));_0x2cb0b8(_0x386df3);})[_0xd175('0x15')](function(_0x1fbdd0){logger[_0xd175('0x11')](_0xd175('0x20'),_0x1fbdd0[_0xd175('0x12')],_0x427ec1);_0x5e3b54(_0x5a3da5[_0xd175('0x11')](0x1f4,_0x1fbdd0[_0xd175('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 10e4f67..38f5868 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 _0x50a6=['create','/:id','update','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show'];(function(_0x586a2b,_0x3f337b){var _0x10f9f1=function(_0x5a832c){while(--_0x5a832c){_0x586a2b['push'](_0x586a2b['shift']());}};_0x10f9f1(++_0x3f337b);}(_0x50a6,0xa4));var _0x650a=function(_0x588a9c,_0x434e22){_0x588a9c=_0x588a9c-0x0;var _0x32ab03=_0x50a6[_0x588a9c];return _0x32ab03;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),auth[_0x650a('0xa')](),controller['describe']);router[_0x650a('0x8')]('/:id',auth[_0x650a('0xa')](),controller[_0x650a('0xb')]);router['post']('/',auth[_0x650a('0xa')](),controller[_0x650a('0xc')]);router['put'](_0x650a('0xd'),auth['isAuthenticated'](),controller[_0x650a('0xe')]);router['delete'](_0x650a('0xd'),auth['isAuthenticated'](),controller[_0x650a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x31af=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update'];(function(_0xded6a8,_0x327a84){var _0x4ac96e=function(_0x4bbd7c){while(--_0x4bbd7c){_0xded6a8['push'](_0xded6a8['shift']());}};_0x4ac96e(++_0x327a84);}(_0x31af,0xde));var _0xf31a=function(_0x4c1657,_0x5ba338){_0x4c1657=_0x4c1657-0x0;var _0x2d8b3e=_0x31af[_0x4c1657];return _0x2d8b3e;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xe')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0x10')](_0xf31a('0xd'),auth['isAuthenticated'](),controller[_0xf31a('0x11')]);router[_0xf31a('0x12')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['destroy']);module[_0xf31a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 73e9f64..28a1c0f 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x40d46b,_0x5a76c1){var _0x2716cd=function(_0xde0d39){while(--_0xde0d39){_0x40d46b['push'](_0x40d46b['shift']());}};_0x2716cd(++_0x5a76c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x520a3d,_0x56a8f4){_0x520a3d=_0x520a3d-0x0;var _0xced0c2=_0x9bde[_0x520a3d];return _0xced0c2;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 5d1c35d..687e1d1 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 _0x7a7f=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','name','send','index','SmsTransferReport','rawAttributes','fieldName','model','map','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','then','rows','show','fields','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2088cc,_0xba512e){var _0x47ef1d=function(_0x151aa7){while(--_0x151aa7){_0x2088cc['push'](_0x2088cc['shift']());}};_0x47ef1d(++_0xba512e);}(_0x7a7f,0x165));var _0xf7a7=function(_0x428097,_0xf7ef7d){_0x428097=_0x428097-0x0;var _0x4ad5cd=_0x7a7f[_0x428097];return _0x4ad5cd;};'use strict';var emlformat=require(_0xf7a7('0x0'));var rimraf=require(_0xf7a7('0x1'));var zipdir=require(_0xf7a7('0x2'));var jsonpatch=require(_0xf7a7('0x3'));var rp=require(_0xf7a7('0x4'));var moment=require(_0xf7a7('0x5'));var BPromise=require(_0xf7a7('0x6'));var Mustache=require(_0xf7a7('0x7'));var util=require('util');var path=require(_0xf7a7('0x8'));var sox=require('sox');var csv=require(_0xf7a7('0x9'));var ejs=require(_0xf7a7('0xa'));var fs=require('fs');var fs_extra=require(_0xf7a7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf7a7('0xc'));var jsforce=require(_0xf7a7('0xd'));var deskjs=require(_0xf7a7('0xe'));var toCsv=require(_0xf7a7('0x9'));var querystring=require(_0xf7a7('0xf'));var Papa=require(_0xf7a7('0x10'));var Redis=require(_0xf7a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7a7('0x12'));var as=require(_0xf7a7('0x13'));var hardwareService=require(_0xf7a7('0x14'));var logger=require(_0xf7a7('0x15'))(_0xf7a7('0x16'));var utils=require('../../config/utils');var config=require(_0xf7a7('0x17'));var licenseUtil=require(_0xf7a7('0x18'));var db=require(_0xf7a7('0x19'))['db'];function respondWithStatusCode(_0x23e6c8,_0x35dcfb){_0x35dcfb=_0x35dcfb||0xcc;return function(_0x48427b){if(_0x48427b){return _0x23e6c8[_0xf7a7('0x1a')](_0x35dcfb);}return _0x23e6c8[_0xf7a7('0x1b')](_0x35dcfb)[_0xf7a7('0x1c')]();};}function respondWithResult(_0x3508d5,_0x4ded9f){_0x4ded9f=_0x4ded9f||0xc8;return function(_0x1132f5){if(_0x1132f5){return _0x3508d5['status'](_0x4ded9f)[_0xf7a7('0x1d')](_0x1132f5);}};}function respondWithFilteredResult(_0x4f2646,_0xcc87d5){return function(_0x2d37b8){if(_0x2d37b8){var _0x5829f3=typeof _0xcc87d5[_0xf7a7('0x1e')]===_0xf7a7('0x1f')&&typeof _0xcc87d5['limit']==='undefined';var _0x441c63=_0x2d37b8[_0xf7a7('0x20')];var _0x72c5d7=_0x5829f3?0x0:_0xcc87d5[_0xf7a7('0x1e')];var _0x52924c=_0x5829f3?_0x2d37b8[_0xf7a7('0x20')]:_0xcc87d5[_0xf7a7('0x1e')]+_0xcc87d5[_0xf7a7('0x21')];var _0x2af7e9;if(_0x52924c>=_0x441c63){_0x52924c=_0x441c63;_0x2af7e9=0xc8;}else{_0x2af7e9=0xce;}_0x4f2646['status'](_0x2af7e9);return _0x4f2646[_0xf7a7('0x22')](_0xf7a7('0x23'),_0x72c5d7+'-'+_0x52924c+'/'+_0x441c63)[_0xf7a7('0x1d')](_0x2d37b8);}return null;};}function patchUpdates(_0x1661f8){return function(_0x13b4e5){try{jsonpatch[_0xf7a7('0x24')](_0x13b4e5,_0x1661f8,!![]);}catch(_0x37d0fa){return BPromise[_0xf7a7('0x25')](_0x37d0fa);}return _0x13b4e5[_0xf7a7('0x26')]();};}function saveUpdates(_0x88ea14,_0x331620){return function(_0x17d631){if(_0x17d631){return _0x17d631['update'](_0x88ea14)['then'](function(_0x4f59c9){return _0x4f59c9;});}return null;};}function removeEntity(_0x35f11f,_0x51dfcb){return function(_0x17102f){if(_0x17102f){return _0x17102f[_0xf7a7('0x27')]()['then'](function(){_0x35f11f[_0xf7a7('0x1b')](0xcc)[_0xf7a7('0x1c')]();});}};}function handleEntityNotFound(_0x2ffe22,_0x14425a){return function(_0x2d6c04){if(!_0x2d6c04){_0x2ffe22['sendStatus'](0x194);}return _0x2d6c04;};}function handleError(_0x202877,_0x5a899d){_0x5a899d=_0x5a899d||0x1f4;return function(_0x448b21){logger['error'](_0x448b21['stack']);if(_0x448b21['name']){delete _0x448b21[_0xf7a7('0x28')];}_0x202877['status'](_0x5a899d)[_0xf7a7('0x29')](_0x448b21);};}exports[_0xf7a7('0x2a')]=function(_0x592d0d,_0x50055a){var _0x48025e={},_0xbcdc1a={},_0x1676b1={'count':0x0,'rows':[]};var _0xb06d0a=_['map'](db[_0xf7a7('0x2b')][_0xf7a7('0x2c')],function(_0x1de1d5){return{'name':_0x1de1d5[_0xf7a7('0x2d')],'type':_0x1de1d5['type']['key']};});_0xbcdc1a[_0xf7a7('0x2e')]=_[_0xf7a7('0x2f')](_0xb06d0a,'name');_0xbcdc1a['query']=_[_0xf7a7('0x30')](_0x592d0d[_0xf7a7('0x31')]);_0xbcdc1a['filters']=_['intersection'](_0xbcdc1a[_0xf7a7('0x2e')],_0xbcdc1a[_0xf7a7('0x31')]);_0x48025e[_0xf7a7('0x32')]=_[_0xf7a7('0x33')](_0xbcdc1a[_0xf7a7('0x2e')],qs['fields'](_0x592d0d['query']['fields']));_0x48025e[_0xf7a7('0x32')]=_0x48025e[_0xf7a7('0x32')][_0xf7a7('0x34')]?_0x48025e['attributes']:_0xbcdc1a[_0xf7a7('0x2e')];if(!_0x592d0d['query'][_0xf7a7('0x35')](_0xf7a7('0x36'))){_0x48025e[_0xf7a7('0x21')]=qs['limit'](_0x592d0d['query']['limit']);_0x48025e[_0xf7a7('0x1e')]=qs['offset'](_0x592d0d[_0xf7a7('0x31')][_0xf7a7('0x1e')]);}_0x48025e[_0xf7a7('0x37')]=qs[_0xf7a7('0x38')](_0x592d0d[_0xf7a7('0x31')][_0xf7a7('0x38')]);_0x48025e['where']=qs[_0xf7a7('0x39')](_[_0xf7a7('0x3a')](_0x592d0d[_0xf7a7('0x31')],_0xbcdc1a[_0xf7a7('0x39')]),_0xb06d0a);if(_0x592d0d[_0xf7a7('0x31')]['filter']){_0x48025e['where']=_['merge'](_0x48025e[_0xf7a7('0x3b')],{'$or':_[_0xf7a7('0x2f')](_0xb06d0a,function(_0x1e661d){if(_0x1e661d['type']!=='VIRTUAL'){var _0xea20b7={};_0xea20b7[_0x1e661d[_0xf7a7('0x28')]]={'$like':'%'+_0x592d0d[_0xf7a7('0x31')][_0xf7a7('0x3c')]+'%'};return _0xea20b7;}})});}_0x48025e=_[_0xf7a7('0x3d')]({},_0x48025e,_0x592d0d[_0xf7a7('0x3e')]);var _0x104a1a={'where':_0x48025e[_0xf7a7('0x3b')]};return db[_0xf7a7('0x2b')][_0xf7a7('0x20')](_0x104a1a)['then'](function(_0x3a80f5){_0x1676b1[_0xf7a7('0x20')]=_0x3a80f5;if(_0x592d0d[_0xf7a7('0x31')][_0xf7a7('0x3f')]){_0x48025e[_0xf7a7('0x40')]=[{'all':!![]}];}return db[_0xf7a7('0x2b')][_0xf7a7('0x41')](_0x48025e);})[_0xf7a7('0x42')](function(_0x1db80f){_0x1676b1[_0xf7a7('0x43')]=_0x1db80f;return _0x1676b1;})[_0xf7a7('0x42')](respondWithFilteredResult(_0x50055a,_0x48025e))['catch'](handleError(_0x50055a,null));};exports[_0xf7a7('0x44')]=function(_0x2d89be,_0xf5e284){var _0x2f7aac={'raw':!![],'where':{'id':_0x2d89be['params']['id']}},_0x140313={};_0x140313[_0xf7a7('0x2e')]=_['keys'](db['SmsTransferReport'][_0xf7a7('0x2c')]);_0x140313['query']=_['keys'](_0x2d89be['query']);_0x140313[_0xf7a7('0x39')]=_[_0xf7a7('0x33')](_0x140313['model'],_0x140313[_0xf7a7('0x31')]);_0x2f7aac[_0xf7a7('0x32')]=_[_0xf7a7('0x33')](_0x140313[_0xf7a7('0x2e')],qs[_0xf7a7('0x45')](_0x2d89be[_0xf7a7('0x31')][_0xf7a7('0x45')]));_0x2f7aac[_0xf7a7('0x32')]=_0x2f7aac[_0xf7a7('0x32')][_0xf7a7('0x34')]?_0x2f7aac[_0xf7a7('0x32')]:_0x140313[_0xf7a7('0x2e')];if(_0x2d89be[_0xf7a7('0x31')]['includeAll']){_0x2f7aac['include']=[{'all':!![]}];}_0x2f7aac=_['merge']({},_0x2f7aac,_0x2d89be['options']);return db[_0xf7a7('0x2b')]['find'](_0x2f7aac)['then'](handleEntityNotFound(_0xf5e284,null))[_0xf7a7('0x42')](respondWithResult(_0xf5e284,null))[_0xf7a7('0x46')](handleError(_0xf5e284,null));};exports[_0xf7a7('0x47')]=function(_0x4da425,_0x5702ca){return db['SmsTransferReport'][_0xf7a7('0x47')](_0x4da425[_0xf7a7('0x48')],{})[_0xf7a7('0x42')](respondWithResult(_0x5702ca,0xc9))[_0xf7a7('0x46')](handleError(_0x5702ca,null));};exports['update']=function(_0x424ba5,_0x7dfb19){if(_0x424ba5[_0xf7a7('0x48')]['id']){delete _0x424ba5[_0xf7a7('0x48')]['id'];}return db[_0xf7a7('0x2b')][_0xf7a7('0x49')]({'where':{'id':_0x424ba5[_0xf7a7('0x4a')]['id']}})[_0xf7a7('0x42')](handleEntityNotFound(_0x7dfb19,null))[_0xf7a7('0x42')](saveUpdates(_0x424ba5['body'],null))[_0xf7a7('0x42')](respondWithResult(_0x7dfb19,null))[_0xf7a7('0x46')](handleError(_0x7dfb19,null));};exports['destroy']=function(_0x103789,_0x2b1d8f){return db[_0xf7a7('0x2b')][_0xf7a7('0x49')]({'where':{'id':_0x103789[_0xf7a7('0x4a')]['id']}})[_0xf7a7('0x42')](handleEntityNotFound(_0x2b1d8f,null))[_0xf7a7('0x42')](removeEntity(_0x2b1d8f,null))[_0xf7a7('0x46')](handleError(_0x2b1d8f,null));};exports[_0xf7a7('0x4b')]=function(_0x46ff31,_0x10aacc){return db[_0xf7a7('0x2b')][_0xf7a7('0x4b')]()[_0xf7a7('0x42')](respondWithResult(_0x10aacc,null))['catch'](handleError(_0x10aacc,null));}; \ No newline at end of file +var _0xd0b7=['includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','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','SmsTransferReport','include','findAll','rows','catch','show','params'];(function(_0x1283ad,_0x33c0e0){var _0x12afe0=function(_0x231e75){while(--_0x231e75){_0x1283ad['push'](_0x1283ad['shift']());}};_0x12afe0(++_0x33c0e0);}(_0xd0b7,0x9d));var _0x7d0b=function(_0x51c5bb,_0x345a62){_0x51c5bb=_0x51c5bb-0x0;var _0x3cac80=_0xd0b7[_0x51c5bb];return _0x3cac80;};'use strict';var emlformat=require(_0x7d0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d0b('0x1'));var jsonpatch=require(_0x7d0b('0x2'));var rp=require(_0x7d0b('0x3'));var moment=require(_0x7d0b('0x4'));var BPromise=require(_0x7d0b('0x5'));var Mustache=require(_0x7d0b('0x6'));var util=require(_0x7d0b('0x7'));var path=require(_0x7d0b('0x8'));var sox=require('sox');var csv=require(_0x7d0b('0x9'));var ejs=require(_0x7d0b('0xa'));var fs=require('fs');var fs_extra=require(_0x7d0b('0xb'));var _=require('lodash');var squel=require(_0x7d0b('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d0b('0xd'));var deskjs=require(_0x7d0b('0xe'));var toCsv=require(_0x7d0b('0x9'));var querystring=require(_0x7d0b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7d0b('0x10'));var as=require(_0x7d0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d0b('0x12'))(_0x7d0b('0x13'));var utils=require('../../config/utils');var config=require(_0x7d0b('0x14'));var licenseUtil=require(_0x7d0b('0x15'));var db=require(_0x7d0b('0x16'))['db'];function respondWithStatusCode(_0x706ef,_0x1e39eb){_0x1e39eb=_0x1e39eb||0xcc;return function(_0x33db5c){if(_0x33db5c){return _0x706ef['sendStatus'](_0x1e39eb);}return _0x706ef[_0x7d0b('0x17')](_0x1e39eb)['end']();};}function respondWithResult(_0x8466de,_0x1c7bf5){_0x1c7bf5=_0x1c7bf5||0xc8;return function(_0x434c33){if(_0x434c33){return _0x8466de[_0x7d0b('0x17')](_0x1c7bf5)[_0x7d0b('0x18')](_0x434c33);}};}function respondWithFilteredResult(_0x1299eb,_0x4ef487){return function(_0xbb8bb7){if(_0xbb8bb7){var _0x1c715c=typeof _0x4ef487[_0x7d0b('0x19')]==='undefined'&&typeof _0x4ef487[_0x7d0b('0x1a')]===_0x7d0b('0x1b');var _0x3f2418=_0xbb8bb7['count'];var _0x4672ad=_0x1c715c?0x0:_0x4ef487[_0x7d0b('0x19')];var _0x49793a=_0x1c715c?_0xbb8bb7[_0x7d0b('0x1c')]:_0x4ef487[_0x7d0b('0x19')]+_0x4ef487[_0x7d0b('0x1a')];var _0x5c39b0;if(_0x49793a>=_0x3f2418){_0x49793a=_0x3f2418;_0x5c39b0=0xc8;}else{_0x5c39b0=0xce;}_0x1299eb[_0x7d0b('0x17')](_0x5c39b0);return _0x1299eb[_0x7d0b('0x1d')](_0x7d0b('0x1e'),_0x4672ad+'-'+_0x49793a+'/'+_0x3f2418)[_0x7d0b('0x18')](_0xbb8bb7);}return null;};}function patchUpdates(_0x5fc22c){return function(_0x4f8be3){try{jsonpatch['apply'](_0x4f8be3,_0x5fc22c,!![]);}catch(_0x14f93b){return BPromise[_0x7d0b('0x1f')](_0x14f93b);}return _0x4f8be3[_0x7d0b('0x20')]();};}function saveUpdates(_0x317674,_0x37666){return function(_0x227883){if(_0x227883){return _0x227883[_0x7d0b('0x21')](_0x317674)['then'](function(_0xe4426e){return _0xe4426e;});}return null;};}function removeEntity(_0x137361,_0x3d3215){return function(_0x187140){if(_0x187140){return _0x187140[_0x7d0b('0x22')]()[_0x7d0b('0x23')](function(){_0x137361[_0x7d0b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x123f9b,_0x551a4a){return function(_0x1d7977){if(!_0x1d7977){_0x123f9b[_0x7d0b('0x24')](0x194);}return _0x1d7977;};}function handleError(_0x3c9d88,_0x2bc6a5){_0x2bc6a5=_0x2bc6a5||0x1f4;return function(_0xcb9dbb){logger['error'](_0xcb9dbb[_0x7d0b('0x25')]);if(_0xcb9dbb['name']){delete _0xcb9dbb[_0x7d0b('0x26')];}_0x3c9d88[_0x7d0b('0x17')](_0x2bc6a5)[_0x7d0b('0x27')](_0xcb9dbb);};}exports[_0x7d0b('0x28')]=function(_0xa7d4aa,_0xa8ca4){var _0x2fb494={},_0x37c319={},_0x3e8ea2={'count':0x0,'rows':[]};var _0x7c4291=_[_0x7d0b('0x29')](db['SmsTransferReport'][_0x7d0b('0x2a')],function(_0x42a9f6){return{'name':_0x42a9f6[_0x7d0b('0x2b')],'type':_0x42a9f6[_0x7d0b('0x2c')][_0x7d0b('0x2d')]};});_0x37c319[_0x7d0b('0x2e')]=_[_0x7d0b('0x29')](_0x7c4291,_0x7d0b('0x26'));_0x37c319['query']=_[_0x7d0b('0x2f')](_0xa7d4aa[_0x7d0b('0x30')]);_0x37c319['filters']=_[_0x7d0b('0x31')](_0x37c319['model'],_0x37c319[_0x7d0b('0x30')]);_0x2fb494['attributes']=_['intersection'](_0x37c319[_0x7d0b('0x2e')],qs['fields'](_0xa7d4aa[_0x7d0b('0x30')][_0x7d0b('0x32')]));_0x2fb494[_0x7d0b('0x33')]=_0x2fb494['attributes'][_0x7d0b('0x34')]?_0x2fb494['attributes']:_0x37c319[_0x7d0b('0x2e')];if(!_0xa7d4aa[_0x7d0b('0x30')][_0x7d0b('0x35')](_0x7d0b('0x36'))){_0x2fb494[_0x7d0b('0x1a')]=qs['limit'](_0xa7d4aa[_0x7d0b('0x30')][_0x7d0b('0x1a')]);_0x2fb494[_0x7d0b('0x19')]=qs['offset'](_0xa7d4aa['query'][_0x7d0b('0x19')]);}_0x2fb494[_0x7d0b('0x37')]=qs[_0x7d0b('0x38')](_0xa7d4aa[_0x7d0b('0x30')][_0x7d0b('0x38')]);_0x2fb494[_0x7d0b('0x39')]=qs[_0x7d0b('0x3a')](_[_0x7d0b('0x3b')](_0xa7d4aa[_0x7d0b('0x30')],_0x37c319[_0x7d0b('0x3a')]),_0x7c4291);if(_0xa7d4aa['query'][_0x7d0b('0x3c')]){_0x2fb494[_0x7d0b('0x39')]=_['merge'](_0x2fb494[_0x7d0b('0x39')],{'$or':_[_0x7d0b('0x29')](_0x7c4291,function(_0x451ae8){if(_0x451ae8['type']!==_0x7d0b('0x3d')){var _0x191a70={};_0x191a70[_0x451ae8['name']]={'$like':'%'+_0xa7d4aa[_0x7d0b('0x30')][_0x7d0b('0x3c')]+'%'};return _0x191a70;}})});}_0x2fb494=_[_0x7d0b('0x3e')]({},_0x2fb494,_0xa7d4aa[_0x7d0b('0x3f')]);var _0x13fbde={'where':_0x2fb494[_0x7d0b('0x39')]};return db[_0x7d0b('0x40')][_0x7d0b('0x1c')](_0x13fbde)[_0x7d0b('0x23')](function(_0x3fa00a){_0x3e8ea2[_0x7d0b('0x1c')]=_0x3fa00a;if(_0xa7d4aa[_0x7d0b('0x30')]['includeAll']){_0x2fb494[_0x7d0b('0x41')]=[{'all':!![]}];}return db[_0x7d0b('0x40')][_0x7d0b('0x42')](_0x2fb494);})[_0x7d0b('0x23')](function(_0x4936ee){_0x3e8ea2[_0x7d0b('0x43')]=_0x4936ee;return _0x3e8ea2;})[_0x7d0b('0x23')](respondWithFilteredResult(_0xa8ca4,_0x2fb494))[_0x7d0b('0x44')](handleError(_0xa8ca4,null));};exports[_0x7d0b('0x45')]=function(_0x48b58f,_0x3464cc){var _0xf449e8={'raw':!![],'where':{'id':_0x48b58f[_0x7d0b('0x46')]['id']}},_0x432464={};_0x432464[_0x7d0b('0x2e')]=_[_0x7d0b('0x2f')](db[_0x7d0b('0x40')][_0x7d0b('0x2a')]);_0x432464[_0x7d0b('0x30')]=_[_0x7d0b('0x2f')](_0x48b58f[_0x7d0b('0x30')]);_0x432464[_0x7d0b('0x3a')]=_['intersection'](_0x432464[_0x7d0b('0x2e')],_0x432464[_0x7d0b('0x30')]);_0xf449e8[_0x7d0b('0x33')]=_['intersection'](_0x432464[_0x7d0b('0x2e')],qs[_0x7d0b('0x32')](_0x48b58f[_0x7d0b('0x30')]['fields']));_0xf449e8['attributes']=_0xf449e8['attributes'][_0x7d0b('0x34')]?_0xf449e8['attributes']:_0x432464[_0x7d0b('0x2e')];if(_0x48b58f[_0x7d0b('0x30')][_0x7d0b('0x47')]){_0xf449e8[_0x7d0b('0x41')]=[{'all':!![]}];}_0xf449e8=_[_0x7d0b('0x3e')]({},_0xf449e8,_0x48b58f[_0x7d0b('0x3f')]);return db['SmsTransferReport'][_0x7d0b('0x48')](_0xf449e8)['then'](handleEntityNotFound(_0x3464cc,null))[_0x7d0b('0x23')](respondWithResult(_0x3464cc,null))[_0x7d0b('0x44')](handleError(_0x3464cc,null));};exports[_0x7d0b('0x49')]=function(_0x53f2af,_0x1106c8){return db[_0x7d0b('0x40')][_0x7d0b('0x49')](_0x53f2af[_0x7d0b('0x4a')],{})['then'](respondWithResult(_0x1106c8,0xc9))[_0x7d0b('0x44')](handleError(_0x1106c8,null));};exports[_0x7d0b('0x21')]=function(_0x38e3b4,_0x13c907){if(_0x38e3b4['body']['id']){delete _0x38e3b4[_0x7d0b('0x4a')]['id'];}return db[_0x7d0b('0x40')]['find']({'where':{'id':_0x38e3b4[_0x7d0b('0x46')]['id']}})[_0x7d0b('0x23')](handleEntityNotFound(_0x13c907,null))[_0x7d0b('0x23')](saveUpdates(_0x38e3b4[_0x7d0b('0x4a')],null))['then'](respondWithResult(_0x13c907,null))[_0x7d0b('0x44')](handleError(_0x13c907,null));};exports['destroy']=function(_0x20848b,_0x32874c){return db[_0x7d0b('0x40')][_0x7d0b('0x48')]({'where':{'id':_0x20848b['params']['id']}})[_0x7d0b('0x23')](handleEntityNotFound(_0x32874c,null))['then'](removeEntity(_0x32874c,null))['catch'](handleError(_0x32874c,null));};exports[_0x7d0b('0x4b')]=function(_0x5f8e54,_0xaaf78a){return db[_0x7d0b('0x40')][_0x7d0b('0x4b')]()[_0x7d0b('0x23')](respondWithResult(_0xaaf78a,null))[_0x7d0b('0x44')](handleError(_0xaaf78a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 45dc2f0..7e6bcbc 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 _0x7351=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x1c0a4f,_0x48b0da){var _0x2a853f=function(_0x12a462){while(--_0x12a462){_0x1c0a4f['push'](_0x1c0a4f['shift']());}};_0x2a853f(++_0x48b0da);}(_0x7351,0x139));var _0x1735=function(_0x28e634,_0x5699d1){_0x28e634=_0x28e634-0x0;var _0x7d8cc8=_0x7351[_0x28e634];return _0x7d8cc8;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var logger=require(_0x1735('0x2'))(_0x1735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1735('0x4'));var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require(_0x1735('0x7'));var attributes=require(_0x1735('0x8'));module[_0x1735('0x9')]=function(_0x47fa51,_0x3fdcc1){return _0x47fa51[_0x1735('0xa')](_0x1735('0xb'),attributes,{'tableName':_0x1735('0xc'),'paranoid':![],'indexes':[{'name':_0x1735('0xd'),'fields':[_0x1735('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a1d=['exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0xf17d71,_0x3bbe72){var _0x2502f3=function(_0x2e7c34){while(--_0x2e7c34){_0xf17d71['push'](_0xf17d71['shift']());}};_0x2502f3(++_0x3bbe72);}(_0x6a1d,0xe1));var _0xd6a1=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x6a1d[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xd6a1('0x0'));var util=require(_0xd6a1('0x1'));var logger=require(_0xd6a1('0x2'))('api');var moment=require(_0xd6a1('0x3'));var BPromise=require(_0xd6a1('0x4'));var rp=require(_0xd6a1('0x5'));var fs=require('fs');var path=require(_0xd6a1('0x6'));var rimraf=require('rimraf');var config=require(_0xd6a1('0x7'));var attributes=require(_0xd6a1('0x8'));module[_0xd6a1('0x9')]=function(_0x5c4b6c,_0x3400ae){return _0x5c4b6c[_0xd6a1('0xa')](_0xd6a1('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xd6a1('0xc'),'fields':[_0xd6a1('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 d6d55b1..9ffc708 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 _0xd13e=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x318686,_0x46e9cf){var _0x118c5c=function(_0x3ea14b){while(--_0x3ea14b){_0x318686['push'](_0x318686['shift']());}};_0x118c5c(++_0x46e9cf);}(_0xd13e,0x193));var _0xed13=function(_0x1ece03,_0x3bee2d){_0x1ece03=_0x1ece03-0x0;var _0x216614=_0xd13e[_0x1ece03];return _0x216614;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var moment=require(_0xed13('0x2'));var BPromise=require(_0xed13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed13('0x5'));var logger=require('../../config/logger')(_0xed13('0x6'));var config=require(_0xed13('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x95ff4c,_0x134929,_0xab0fff){return new BPromise(function(_0x3b3984,_0x369798){return client[_0xed13('0x8')](_0x95ff4c,_0xab0fff)[_0xed13('0x9')](function(_0x9bc191){logger[_0xed13('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x134929,_0xed13('0xb'));logger[_0xed13('0xc')](_0xed13('0xd'),_0x134929,_0xed13('0xb'),JSON[_0xed13('0xe')](_0x9bc191));if(_0x9bc191['error']){if(_0x9bc191[_0xed13('0xf')][_0xed13('0x10')]===0x1f4){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x9bc191[_0xed13('0xf')][_0xed13('0x12')]);return _0x369798(_0x9bc191['error'][_0xed13('0x12')]);}logger['error'](_0xed13('0x11'),_0x134929,_0x9bc191['error'][_0xed13('0x12')]);return _0x3b3984(_0x9bc191['error'][_0xed13('0x12')]);}else{logger['info'](_0xed13('0x11'),_0x134929,_0xed13('0xb'));_0x3b3984(_0x9bc191[_0xed13('0x13')][_0xed13('0x12')]);}})[_0xed13('0x14')](function(_0x1f8585){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x1f8585);_0x369798(_0x1f8585);});});} \ No newline at end of file +var _0x6688=['stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x17d987,_0x440369){var _0x12581c=function(_0x5e55ea){while(--_0x5e55ea){_0x17d987['push'](_0x17d987['shift']());}};_0x12581c(++_0x440369);}(_0x6688,0x10e));var _0x8668=function(_0x5c9e88,_0x501d38){_0x5c9e88=_0x5c9e88-0x0;var _0x429a5c=_0x6688[_0x5c9e88];return _0x429a5c;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var moment=require(_0x8668('0x2'));var BPromise=require('bluebird');var rs=require(_0x8668('0x3'));var fs=require('fs');var Redis=require(_0x8668('0x4'));var db=require(_0x8668('0x5'))['db'];var utils=require(_0x8668('0x6'));var logger=require(_0x8668('0x7'))(_0x8668('0x8'));var config=require(_0x8668('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8668('0xa')][_0x8668('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51c691,_0x1b9518,_0xf3b726){return new BPromise(function(_0xb4ac50,_0x15e42d){return client[_0x8668('0xc')](_0x51c691,_0xf3b726)[_0x8668('0xd')](function(_0x21315c){logger[_0x8668('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x1b9518,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1b9518,_0x8668('0xf'),JSON[_0x8668('0x10')](_0x21315c));if(_0x21315c[_0x8668('0x11')]){if(_0x21315c[_0x8668('0x11')][_0x8668('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1b9518,_0x21315c[_0x8668('0x11')][_0x8668('0x13')]);return _0x15e42d(_0x21315c[_0x8668('0x11')]['message']);}logger[_0x8668('0x11')](_0x8668('0x14'),_0x1b9518,_0x21315c[_0x8668('0x11')]['message']);return _0xb4ac50(_0x21315c['error'][_0x8668('0x13')]);}else{logger[_0x8668('0xe')](_0x8668('0x14'),_0x1b9518,_0x8668('0xf'));_0xb4ac50(_0x21315c['result']['message']);}})[_0x8668('0x15')](function(_0x191220){logger[_0x8668('0x11')](_0x8668('0x14'),_0x1b9518,_0x191220);_0x15e42d(_0x191220);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cc303ab..99484c2 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 _0x5d0c=['%s-%s%s','basename','extname','now','single','file','create','put','multer','util','fs-extra','../../components/auth/service','index','get','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x5d0c,0x17f));var _0xc5d0=function(_0x32fa40,_0x3c1558){_0x32fa40=_0x32fa40-0x0;var _0x32ed63=_0x5d0c[_0x32fa40];return _0x32ed63;};'use strict';var multer=require(_0xc5d0('0x0'));var util=require(_0xc5d0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc5d0('0x2'));var auth=require(_0xc5d0('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc5d0('0x4')]);router[_0xc5d0('0x5')](_0xc5d0('0x6'),auth[_0xc5d0('0x7')](),controller[_0xc5d0('0x8')]);router['get']('/:id/download',auth[_0xc5d0('0x7')](),controller[_0xc5d0('0x9')]);var upload=multer({'storage':multer[_0xc5d0('0xa')]({'destination':function(_0x249d2c,_0x1366a3,_0x451436){_0x451436(null,path[_0xc5d0('0xb')](config[_0xc5d0('0xc')],_0xc5d0('0xd')));},'filename':function(_0x4cab03,_0x4c30d8,_0x475994){_0x4c30d8[_0xc5d0('0xe')]=_0x4c30d8[_0xc5d0('0xe')][_0xc5d0('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x475994(null,util[_0xc5d0('0x10')](_0xc5d0('0x11'),path[_0xc5d0('0x12')](_0x4c30d8[_0xc5d0('0xe')],path[_0xc5d0('0x13')](_0x4c30d8[_0xc5d0('0xe')])),Date[_0xc5d0('0x14')](),path[_0xc5d0('0x13')](_0x4c30d8[_0xc5d0('0xe')])));}})});router['post']('/',upload[_0xc5d0('0x15')](_0xc5d0('0x16')),controller[_0xc5d0('0x17')]);router[_0xc5d0('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc5d0('0x6'),auth[_0xc5d0('0x7')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x4c01=['download','join','root','originalname','replace','format','basename','extname','now','post','single','file','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x47fe94,_0x4f9973){var _0x576fb6=function(_0x26c2aa){while(--_0x26c2aa){_0x47fe94['push'](_0x47fe94['shift']());}};_0x576fb6(++_0x4f9973);}(_0x4c01,0x13c));var _0x14c0=function(_0x477bd5,_0x539ad0){_0x477bd5=_0x477bd5-0x0;var _0x4434a5=_0x4c01[_0x477bd5];return _0x4434a5;};'use strict';var multer=require(_0x14c0('0x0'));var util=require('util');var path=require(_0x14c0('0x1'));var timeout=require(_0x14c0('0x2'));var express=require(_0x14c0('0x3'));var router=express[_0x14c0('0x4')]();var fs_extra=require(_0x14c0('0x5'));var auth=require(_0x14c0('0x6'));var interaction=require(_0x14c0('0x7'));var config=require(_0x14c0('0x8'));var controller=require('./sound.controller');router['get']('/',auth[_0x14c0('0x9')](),controller[_0x14c0('0xa')]);router[_0x14c0('0xb')](_0x14c0('0xc'),auth['isAuthenticated'](),controller[_0x14c0('0xd')]);router[_0x14c0('0xb')]('/:id/download',auth[_0x14c0('0x9')](),controller[_0x14c0('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x235095,_0x60590a,_0x4734a4){_0x4734a4(null,path[_0x14c0('0xf')](config[_0x14c0('0x10')],'server/files/sounds/original/'));},'filename':function(_0x39aa9c,_0x2ed95a,_0x439bad){_0x2ed95a['originalname']=_0x2ed95a[_0x14c0('0x11')][_0x14c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x439bad(null,util[_0x14c0('0x13')]('%s-%s%s',path[_0x14c0('0x14')](_0x2ed95a['originalname'],path[_0x14c0('0x15')](_0x2ed95a[_0x14c0('0x11')])),Date[_0x14c0('0x16')](),path[_0x14c0('0x15')](_0x2ed95a['originalname'])));}})});router[_0x14c0('0x17')]('/',upload[_0x14c0('0x18')](_0x14c0('0x19')),controller['create']);router[_0x14c0('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x14c0('0x1b')]);router[_0x14c0('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x14c0('0x1c')]);module[_0x14c0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3bf08ed..86a3242 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 _0xa4d6=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x36be04,_0x35a9d6){var _0x4996ac=function(_0x4759ac){while(--_0x4759ac){_0x36be04['push'](_0x36be04['shift']());}};_0x4996ac(++_0x35a9d6);}(_0xa4d6,0xef));var _0x6a4d=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xa4d6[_0x1314d4];return _0x584ba5;};'use strict';var Sequelize=require(_0x6a4d('0x0'));module[_0x6a4d('0x1')]={'name':{'type':Sequelize[_0x6a4d('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x6a4d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x6a4d('0x2')]},'original_format':{'type':Sequelize[_0x6a4d('0x2')]},'original_duration':{'type':Sequelize[_0x6a4d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x6a4d('0x4')]},'original_channelCount':{'type':Sequelize[_0x6a4d('0x5')]},'original_bitRate':{'type':Sequelize[_0x6a4d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x6a4d('0x5')]},'converted_format':{'type':Sequelize[_0x6a4d('0x2')]},'converted_duration':{'type':Sequelize[_0x6a4d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x6a4d('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x6a4d('0x5')]}}; \ No newline at end of file +var _0xc0ef=['exports','name','STRING','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xc0ef,0x109));var _0xfc0e=function(_0xf007e6,_0x137ef2){_0xf007e6=_0xf007e6-0x0;var _0x471111=_0xc0ef[_0xf007e6];return _0x471111;};'use strict';var Sequelize=require(_0xfc0e('0x0'));module[_0xfc0e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc0e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xfc0e('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xfc0e('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xfc0e('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xfc0e('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xfc0e('0x6')]},'converted_channelCount':{'type':Sequelize[_0xfc0e('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xfc0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9f01a24..2087477 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 _0x7e60=['reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','catch','params','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','desk.js','to-csv','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','undefined','limit','count','set','Content-Range','apply'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7e60,0xd5));var _0x07e6=function(_0x5ba29,_0xb18b){_0x5ba29=_0x5ba29-0x0;var _0x2489e3=_0x7e60[_0x5ba29];return _0x2489e3;};'use strict';var emlformat=require(_0x07e6('0x0'));var rimraf=require(_0x07e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07e6('0x2'));var rp=require(_0x07e6('0x3'));var moment=require(_0x07e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x07e6('0x5'));var util=require('util');var path=require(_0x07e6('0x6'));var sox=require(_0x07e6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07e6('0x8'));var _=require(_0x07e6('0x9'));var squel=require(_0x07e6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x07e6('0xb'));var toCsv=require(_0x07e6('0xc'));var querystring=require('querystring');var Papa=require(_0x07e6('0xd'));var Redis=require(_0x07e6('0xe'));var authService=require(_0x07e6('0xf'));var qs=require(_0x07e6('0x10'));var as=require(_0x07e6('0x11'));var hardwareService=require(_0x07e6('0x12'));var logger=require(_0x07e6('0x13'))(_0x07e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x07e6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x183590,_0xdb13a3){_0xdb13a3=_0xdb13a3||0xcc;return function(_0x280d19){if(_0x280d19){return _0x183590[_0x07e6('0x16')](_0xdb13a3);}return _0x183590[_0x07e6('0x17')](_0xdb13a3)[_0x07e6('0x18')]();};}function respondWithResult(_0x80604b,_0x3a6c16){_0x3a6c16=_0x3a6c16||0xc8;return function(_0xf73d8b){if(_0xf73d8b){return _0x80604b[_0x07e6('0x17')](_0x3a6c16)[_0x07e6('0x19')](_0xf73d8b);}};}function respondWithFilteredResult(_0x5ead53,_0xcbc929){return function(_0x255d15){if(_0x255d15){var _0x3905c7=typeof _0xcbc929[_0x07e6('0x1a')]===_0x07e6('0x1b')&&typeof _0xcbc929[_0x07e6('0x1c')]===_0x07e6('0x1b');var _0x175bf2=_0x255d15[_0x07e6('0x1d')];var _0x4b7d83=_0x3905c7?0x0:_0xcbc929[_0x07e6('0x1a')];var _0x46e226=_0x3905c7?_0x255d15['count']:_0xcbc929[_0x07e6('0x1a')]+_0xcbc929[_0x07e6('0x1c')];var _0x46145a;if(_0x46e226>=_0x175bf2){_0x46e226=_0x175bf2;_0x46145a=0xc8;}else{_0x46145a=0xce;}_0x5ead53['status'](_0x46145a);return _0x5ead53[_0x07e6('0x1e')](_0x07e6('0x1f'),_0x4b7d83+'-'+_0x46e226+'/'+_0x175bf2)['json'](_0x255d15);}return null;};}function patchUpdates(_0x21eed4){return function(_0x51c093){try{jsonpatch[_0x07e6('0x20')](_0x51c093,_0x21eed4,!![]);}catch(_0x30fb2){return BPromise[_0x07e6('0x21')](_0x30fb2);}return _0x51c093[_0x07e6('0x22')]();};}function saveUpdates(_0x1266b0,_0x33793f){return function(_0x19b267){if(_0x19b267){return _0x19b267[_0x07e6('0x23')](_0x1266b0)[_0x07e6('0x24')](function(_0xfbfa11){return _0xfbfa11;});}return null;};}function removeEntity(_0x1bbc8c,_0x26ad23){return function(_0x13faee){if(_0x13faee){return _0x13faee[_0x07e6('0x25')]()[_0x07e6('0x24')](function(){var _0x317628=_0x13faee[_0x07e6('0x26')]({'plain':!![]});var _0x108c79=_0x07e6('0x27');return db[_0x07e6('0x28')]['destroy']({'where':{'type':_0x108c79,'resourceId':_0x317628['id']}})[_0x07e6('0x24')](function(){return _0x13faee;});})['then'](function(){_0x1bbc8c[_0x07e6('0x17')](0xcc)[_0x07e6('0x18')]();});}};}function handleEntityNotFound(_0xa32c6d,_0x18e620){return function(_0x1a7057){if(!_0x1a7057){_0xa32c6d[_0x07e6('0x16')](0x194);}return _0x1a7057;};}function handleError(_0x771b96,_0x5c9e8e){_0x5c9e8e=_0x5c9e8e||0x1f4;return function(_0x59fa3f){logger[_0x07e6('0x29')](_0x59fa3f[_0x07e6('0x2a')]);if(_0x59fa3f[_0x07e6('0x2b')]){delete _0x59fa3f['name'];}_0x771b96[_0x07e6('0x17')](_0x5c9e8e)[_0x07e6('0x2c')](_0x59fa3f);};}exports[_0x07e6('0x2d')]=function(_0x234418,_0x7f29c4){var _0x155826={},_0x9c786b={},_0x4fcef2={'count':0x0,'rows':[]};var _0x4802d8=_[_0x07e6('0x2e')](db[_0x07e6('0x2f')][_0x07e6('0x30')],function(_0x3a9230){return{'name':_0x3a9230[_0x07e6('0x31')],'type':_0x3a9230[_0x07e6('0x32')]['key']};});_0x9c786b['model']=_[_0x07e6('0x2e')](_0x4802d8,_0x07e6('0x2b'));_0x9c786b[_0x07e6('0x33')]=_[_0x07e6('0x34')](_0x234418[_0x07e6('0x33')]);_0x9c786b['filters']=_['intersection'](_0x9c786b[_0x07e6('0x35')],_0x9c786b[_0x07e6('0x33')]);_0x155826[_0x07e6('0x36')]=_[_0x07e6('0x37')](_0x9c786b[_0x07e6('0x35')],qs['fields'](_0x234418[_0x07e6('0x33')][_0x07e6('0x38')]));_0x155826[_0x07e6('0x36')]=_0x155826[_0x07e6('0x36')][_0x07e6('0x39')]?_0x155826['attributes']:_0x9c786b[_0x07e6('0x35')];if(!_0x234418[_0x07e6('0x33')][_0x07e6('0x3a')](_0x07e6('0x3b'))){_0x155826[_0x07e6('0x1c')]=qs[_0x07e6('0x1c')](_0x234418[_0x07e6('0x33')][_0x07e6('0x1c')]);_0x155826[_0x07e6('0x1a')]=qs['offset'](_0x234418[_0x07e6('0x33')][_0x07e6('0x1a')]);}_0x155826[_0x07e6('0x3c')]=qs[_0x07e6('0x3d')](_0x234418[_0x07e6('0x33')][_0x07e6('0x3d')]);_0x155826['where']=qs[_0x07e6('0x3e')](_['pick'](_0x234418[_0x07e6('0x33')],_0x9c786b[_0x07e6('0x3e')]),_0x4802d8);if(_0x234418[_0x07e6('0x33')][_0x07e6('0x3f')]){_0x155826[_0x07e6('0x40')]=_[_0x07e6('0x41')](_0x155826['where'],{'$or':_['map'](_0x4802d8,function(_0x4e2f98){if(_0x4e2f98[_0x07e6('0x32')]!==_0x07e6('0x42')){var _0x3f8757={};_0x3f8757[_0x4e2f98[_0x07e6('0x2b')]]={'$like':'%'+_0x234418[_0x07e6('0x33')]['filter']+'%'};return _0x3f8757;}})});}_0x155826=_[_0x07e6('0x41')]({},_0x155826,_0x234418['options']);var _0x108302={'where':_0x155826[_0x07e6('0x40')]};return db[_0x07e6('0x2f')][_0x07e6('0x1d')](_0x108302)['then'](function(_0x159bad){_0x4fcef2[_0x07e6('0x1d')]=_0x159bad;if(_0x234418[_0x07e6('0x33')][_0x07e6('0x43')]){_0x155826[_0x07e6('0x44')]=[{'all':!![]}];}return db[_0x07e6('0x2f')]['findAll'](_0x155826);})['then'](function(_0x55679e){_0x4fcef2['rows']=_0x55679e;return _0x4fcef2;})['then'](respondWithFilteredResult(_0x7f29c4,_0x155826))[_0x07e6('0x45')](handleError(_0x7f29c4,null));};exports['show']=function(_0xd9796a,_0x43e528){var _0x144f7f={'raw':!![],'where':{'id':_0xd9796a[_0x07e6('0x46')]['id']}},_0x24a226={};_0x24a226[_0x07e6('0x35')]=_['keys'](db[_0x07e6('0x2f')][_0x07e6('0x30')]);_0x24a226[_0x07e6('0x33')]=_[_0x07e6('0x34')](_0xd9796a[_0x07e6('0x33')]);_0x24a226[_0x07e6('0x3e')]=_[_0x07e6('0x37')](_0x24a226[_0x07e6('0x35')],_0x24a226['query']);_0x144f7f[_0x07e6('0x36')]=_[_0x07e6('0x37')](_0x24a226[_0x07e6('0x35')],qs[_0x07e6('0x38')](_0xd9796a[_0x07e6('0x33')]['fields']));_0x144f7f[_0x07e6('0x36')]=_0x144f7f[_0x07e6('0x36')][_0x07e6('0x39')]?_0x144f7f[_0x07e6('0x36')]:_0x24a226['model'];if(_0xd9796a[_0x07e6('0x33')][_0x07e6('0x43')]){_0x144f7f[_0x07e6('0x44')]=[{'all':!![]}];}_0x144f7f=_[_0x07e6('0x41')]({},_0x144f7f,_0xd9796a[_0x07e6('0x47')]);return db[_0x07e6('0x2f')][_0x07e6('0x48')](_0x144f7f)[_0x07e6('0x24')](handleEntityNotFound(_0x43e528,null))[_0x07e6('0x24')](respondWithResult(_0x43e528,null))[_0x07e6('0x45')](handleError(_0x43e528,null));};exports[_0x07e6('0x49')]=function(_0x183f11,_0x24b75f,_0x321690){return db[_0x07e6('0x2f')][_0x07e6('0x48')]({'where':{'id':_0x183f11[_0x07e6('0x46')]['id']},'attributes':[_0x07e6('0x2b'),_0x07e6('0x4a'),_0x07e6('0x4b')],'raw':!![]})[_0x07e6('0x24')](handleEntityNotFound(_0x24b75f,null))[_0x07e6('0x24')](function(_0x39e148){if(_0x39e148){if(!fs[_0x07e6('0x4c')](path[_0x07e6('0x4d')](config[_0x07e6('0x4e')],_0x07e6('0x4f'),_0x39e148[_0x07e6('0x4a')]+'.'+_0x39e148[_0x07e6('0x4b')]))){throw new db[(_0x07e6('0x50'))]['ValidationError'](_0x07e6('0x51'));}return _0x24b75f[_0x07e6('0x49')](path['join'](config[_0x07e6('0x4e')],_0x07e6('0x4f'),util[_0x07e6('0x52')]('%s.%s',_0x39e148[_0x07e6('0x4a')],_0x39e148[_0x07e6('0x4b')])),util['format'](_0x07e6('0x53'),_0x39e148['name'],_0x39e148[_0x07e6('0x4b')]));}return null;})[_0x07e6('0x45')](handleError(_0x24b75f,null));};exports[_0x07e6('0x54')]=function(_0x5dde3f,_0x5ba464,_0x264e9e){var _0x2b363e={'name':path['basename'](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x56')],path[_0x07e6('0x57')](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x56')])),'save_name':path[_0x07e6('0x58')](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x59')],path['extname'](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x59')])),'original_format':path[_0x07e6('0x57')](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x56')])[_0x07e6('0x5a')](0x1),'converted_format':_0x07e6('0x5b')};var _0x1368e2=path[_0x07e6('0x4d')](config[_0x07e6('0x4e')],_0x07e6('0x5c'),_0x5dde3f['file'][_0x07e6('0x59')]);var _0xf613aa=path['join'](config['root'],'server/files/sounds/converted',util[_0x07e6('0x52')](_0x07e6('0x53'),path[_0x07e6('0x58')](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x59')],path['extname'](_0x5dde3f[_0x07e6('0x55')][_0x07e6('0x59')])),_0x2b363e[_0x07e6('0x4b')]));logger['info'](_0x07e6('0x5d'),_0x1368e2);logger[_0x07e6('0x5e')](_0x07e6('0x5f'),_0xf613aa);try{fs[_0x07e6('0x60')](_0x1368e2,parseInt(_0x07e6('0x61'),0x8));var _0x1af134=sox[_0x07e6('0x62')](_0x1368e2,_0xf613aa,{'sampleRate':0x1f40,'format':_0x07e6('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1af134['on']('error',function(_0x4aacfd){fs[_0x07e6('0x63')](_0x1368e2);_0x5ba464[_0x07e6('0x17')](0x1f4)[_0x07e6('0x2c')](_0x4aacfd);});_0x1af134['on'](_0x07e6('0x64'),function(_0x1caaf1){_0x2b363e[_0x07e6('0x65')]=isNaN(_0x1caaf1[_0x07e6('0x66')])?null:_0x1caaf1[_0x07e6('0x66')]*0x3e8;_0x2b363e['original_sampleCount']=isNaN(_0x1caaf1[_0x07e6('0x67')])?null:_0x1caaf1[_0x07e6('0x67')];_0x2b363e['original_channelCount']=isNaN(_0x1caaf1['channelCount'])?null:_0x1caaf1[_0x07e6('0x68')];_0x2b363e[_0x07e6('0x69')]=isNaN(_0x1caaf1['bitRate'])?null:_0x1caaf1[_0x07e6('0x6a')];_0x2b363e['original_sampleRate']=isNaN(_0x1caaf1[_0x07e6('0x6b')])?null:_0x1caaf1['sampleRate'];});_0x1af134['on'](_0x07e6('0x6c'),function(_0x4025b5){_0x2b363e[_0x07e6('0x6d')]=isNaN(_0x4025b5[_0x07e6('0x66')])?null:_0x4025b5['duration']*0x3e8;_0x2b363e[_0x07e6('0x6e')]=isNaN(_0x4025b5['sampleCount'])?null:_0x4025b5['sampleCount'];_0x2b363e[_0x07e6('0x6f')]=isNaN(_0x4025b5[_0x07e6('0x68')])?null:_0x4025b5['channelCount'];_0x2b363e[_0x07e6('0x70')]=isNaN(_0x4025b5['bitRate'])?null:_0x4025b5[_0x07e6('0x6a')];_0x2b363e[_0x07e6('0x71')]=isNaN(_0x4025b5[_0x07e6('0x6b')])?null:_0x4025b5[_0x07e6('0x6b')];});_0x1af134['on'](_0x07e6('0x18'),function(){fs[_0x07e6('0x60')](_0xf613aa,parseInt(_0x07e6('0x61'),0x8));return db['Sound'][_0x07e6('0x54')](_0x2b363e)[_0x07e6('0x24')](function(_0x37aa87){var _0x49f01b={'role':_0x5dde3f[_0x07e6('0x72')]['role'],'userProfileId':_0x5dde3f[_0x07e6('0x72')][_0x07e6('0x73')]};if(!_0x49f01b)throw new Error(_0x07e6('0x74'));if(_0x49f01b[_0x07e6('0x75')]==='user'){var _0x4ba691=_0x37aa87[_0x07e6('0x26')]({'plain':!![]});return db[_0x07e6('0x76')][_0x07e6('0x48')]({'where':{'name':_0x07e6('0x27'),'userProfileId':_0x49f01b[_0x07e6('0x73')]},'raw':!![]})[_0x07e6('0x24')](function(_0x113da8){if(_0x113da8&&_0x113da8[_0x07e6('0x77')]===0x0){return db['UserProfileResource'][_0x07e6('0x54')]({'name':_0x4ba691[_0x07e6('0x2b')],'resourceId':_0x4ba691['id'],'type':_0x113da8['name'],'sectionId':_0x113da8['id']},{})['then'](function(){return _0x37aa87;});}else{return _0x37aa87;}})['catch'](function(_0x3d5a7f){logger[_0x07e6('0x29')](_0x07e6('0x78'),_0x3d5a7f);throw _0x3d5a7f;});}return _0x37aa87;})[_0x07e6('0x24')](respondWithResult(_0x5ba464,null))[_0x07e6('0x45')](handleError(_0x5ba464,null));});_0x1af134['start']();}catch(_0x4db9d2){_0x5ba464[_0x07e6('0x17')](0x1f4)[_0x07e6('0x2c')](_0x4db9d2);}};exports['update']=function(_0x485eae,_0x48e866,_0x56a6f6){return db[_0x07e6('0x2f')]['find']({'where':{'id':_0x485eae[_0x07e6('0x46')]['id']}})[_0x07e6('0x24')](handleEntityNotFound(_0x48e866,null))[_0x07e6('0x24')](saveUpdates(_[_0x07e6('0x79')](_0x485eae[_0x07e6('0x72')],['name',_0x07e6('0x7a')]),null))[_0x07e6('0x24')](respondWithResult(_0x48e866,null))['catch'](handleError(_0x48e866,null));};exports['delete']=function(_0x4db38a,_0x479e1a,_0x237058){return db[_0x07e6('0x2f')][_0x07e6('0x48')]({'where':{'id':_0x4db38a[_0x07e6('0x46')]['id']}})[_0x07e6('0x24')](function(_0x5f301d){if(_0x5f301d){return _0x5f301d['destroy']();}})[_0x07e6('0x24')](function(_0x3d29fe){var _0x3440be=path[_0x07e6('0x4d')](config[_0x07e6('0x4e')],_0x07e6('0x5c'),util[_0x07e6('0x52')](_0x07e6('0x53'),_0x3d29fe[_0x07e6('0x4a')],_0x3d29fe['original_format']));var _0x5dfaf7=path[_0x07e6('0x4d')](config[_0x07e6('0x4e')],_0x07e6('0x4f'),util[_0x07e6('0x52')](_0x07e6('0x53'),_0x3d29fe['save_name'],_0x3d29fe[_0x07e6('0x4b')]));fs[_0x07e6('0x63')](_0x3440be);fs[_0x07e6('0x63')](_0x5dfaf7);return _0x3d29fe;})['then'](function(_0x45464e){if(_0x45464e){return _0x479e1a[_0x07e6('0x17')](0xcc)['end']();}})[_0x07e6('0x24')](handleEntityNotFound(_0x479e1a,null))[_0x07e6('0x45')](handleError(_0x479e1a,null));}; \ No newline at end of file +var _0x534f=['bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','UserProfileResource','destroy','error','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','originalname','file','filename','extname','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate'];(function(_0x3878ff,_0xc7e47e){var _0x23e5a1=function(_0xef694f){while(--_0xef694f){_0x3878ff['push'](_0x3878ff['shift']());}};_0x23e5a1(++_0xc7e47e);}(_0x534f,0x8f));var _0xf534=function(_0x52cf65,_0x3fc0ec){_0x52cf65=_0x52cf65-0x0;var _0x2c90fe=_0x534f[_0x52cf65];return _0x2c90fe;};'use strict';var emlformat=require(_0xf534('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf534('0x1'));var moment=require(_0xf534('0x2'));var BPromise=require(_0xf534('0x3'));var Mustache=require(_0xf534('0x4'));var util=require(_0xf534('0x5'));var path=require(_0xf534('0x6'));var sox=require(_0xf534('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf534('0x8'));var squel=require(_0xf534('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf534('0xa'));var toCsv=require(_0xf534('0xb'));var querystring=require(_0xf534('0xc'));var Papa=require(_0xf534('0xd'));var Redis=require(_0xf534('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf534('0xf'));var hardwareService=require(_0xf534('0x10'));var logger=require(_0xf534('0x11'))(_0xf534('0x12'));var utils=require(_0xf534('0x13'));var config=require(_0xf534('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf534('0x15'))['db'];function respondWithStatusCode(_0x3e403e,_0x6fce3f){_0x6fce3f=_0x6fce3f||0xcc;return function(_0x3b4323){if(_0x3b4323){return _0x3e403e[_0xf534('0x16')](_0x6fce3f);}return _0x3e403e[_0xf534('0x17')](_0x6fce3f)[_0xf534('0x18')]();};}function respondWithResult(_0x4b0350,_0x5a0b67){_0x5a0b67=_0x5a0b67||0xc8;return function(_0x5f2d4c){if(_0x5f2d4c){return _0x4b0350[_0xf534('0x17')](_0x5a0b67)['json'](_0x5f2d4c);}};}function respondWithFilteredResult(_0x5ac12d,_0x3a822c){return function(_0x2b5370){if(_0x2b5370){var _0x31e340=typeof _0x3a822c[_0xf534('0x19')]===_0xf534('0x1a')&&typeof _0x3a822c[_0xf534('0x1b')]===_0xf534('0x1a');var _0x24a798=_0x2b5370[_0xf534('0x1c')];var _0xcb2229=_0x31e340?0x0:_0x3a822c[_0xf534('0x19')];var _0x4846fa=_0x31e340?_0x2b5370[_0xf534('0x1c')]:_0x3a822c['offset']+_0x3a822c[_0xf534('0x1b')];var _0x124322;if(_0x4846fa>=_0x24a798){_0x4846fa=_0x24a798;_0x124322=0xc8;}else{_0x124322=0xce;}_0x5ac12d['status'](_0x124322);return _0x5ac12d[_0xf534('0x1d')](_0xf534('0x1e'),_0xcb2229+'-'+_0x4846fa+'/'+_0x24a798)[_0xf534('0x1f')](_0x2b5370);}return null;};}function patchUpdates(_0x4175fe){return function(_0x5bbc81){try{jsonpatch[_0xf534('0x20')](_0x5bbc81,_0x4175fe,!![]);}catch(_0x4fc0e4){return BPromise['reject'](_0x4fc0e4);}return _0x5bbc81[_0xf534('0x21')]();};}function saveUpdates(_0x3c27a2,_0x51cb1b){return function(_0x4ae155){if(_0x4ae155){return _0x4ae155[_0xf534('0x22')](_0x3c27a2)[_0xf534('0x23')](function(_0x99fbd0){return _0x99fbd0;});}return null;};}function removeEntity(_0x46f4fc,_0x5e1220){return function(_0x22d975){if(_0x22d975){return _0x22d975['destroy']()[_0xf534('0x23')](function(){var _0x2b4a16=_0x22d975['get']({'plain':!![]});var _0x2ca362='Sounds';return db[_0xf534('0x24')][_0xf534('0x25')]({'where':{'type':_0x2ca362,'resourceId':_0x2b4a16['id']}})[_0xf534('0x23')](function(){return _0x22d975;});})['then'](function(){_0x46f4fc['status'](0xcc)[_0xf534('0x18')]();});}};}function handleEntityNotFound(_0x2d6305,_0x1d7925){return function(_0x348937){if(!_0x348937){_0x2d6305[_0xf534('0x16')](0x194);}return _0x348937;};}function handleError(_0x1ae0f9,_0x53d8ef){_0x53d8ef=_0x53d8ef||0x1f4;return function(_0x253f33){logger[_0xf534('0x26')](_0x253f33['stack']);if(_0x253f33['name']){delete _0x253f33[_0xf534('0x27')];}_0x1ae0f9[_0xf534('0x17')](_0x53d8ef)[_0xf534('0x28')](_0x253f33);};}exports[_0xf534('0x29')]=function(_0x281367,_0x17ca7d){var _0x21ee3a={},_0x29e349={},_0x45b55b={'count':0x0,'rows':[]};var _0xfcc768=_[_0xf534('0x2a')](db[_0xf534('0x2b')][_0xf534('0x2c')],function(_0x5d358c){return{'name':_0x5d358c[_0xf534('0x2d')],'type':_0x5d358c['type'][_0xf534('0x2e')]};});_0x29e349[_0xf534('0x2f')]=_[_0xf534('0x2a')](_0xfcc768,_0xf534('0x27'));_0x29e349[_0xf534('0x30')]=_[_0xf534('0x31')](_0x281367[_0xf534('0x30')]);_0x29e349[_0xf534('0x32')]=_[_0xf534('0x33')](_0x29e349[_0xf534('0x2f')],_0x29e349[_0xf534('0x30')]);_0x21ee3a[_0xf534('0x34')]=_[_0xf534('0x33')](_0x29e349['model'],qs[_0xf534('0x35')](_0x281367[_0xf534('0x30')]['fields']));_0x21ee3a[_0xf534('0x34')]=_0x21ee3a[_0xf534('0x34')][_0xf534('0x36')]?_0x21ee3a[_0xf534('0x34')]:_0x29e349['model'];if(!_0x281367[_0xf534('0x30')][_0xf534('0x37')]('nolimit')){_0x21ee3a['limit']=qs[_0xf534('0x1b')](_0x281367[_0xf534('0x30')][_0xf534('0x1b')]);_0x21ee3a['offset']=qs['offset'](_0x281367[_0xf534('0x30')][_0xf534('0x19')]);}_0x21ee3a['order']=qs[_0xf534('0x38')](_0x281367['query']['sort']);_0x21ee3a[_0xf534('0x39')]=qs[_0xf534('0x32')](_[_0xf534('0x3a')](_0x281367['query'],_0x29e349[_0xf534('0x32')]),_0xfcc768);if(_0x281367[_0xf534('0x30')][_0xf534('0x3b')]){_0x21ee3a[_0xf534('0x39')]=_['merge'](_0x21ee3a['where'],{'$or':_[_0xf534('0x2a')](_0xfcc768,function(_0x3d892a){if(_0x3d892a[_0xf534('0x3c')]!==_0xf534('0x3d')){var _0x332914={};_0x332914[_0x3d892a[_0xf534('0x27')]]={'$like':'%'+_0x281367['query'][_0xf534('0x3b')]+'%'};return _0x332914;}})});}_0x21ee3a=_['merge']({},_0x21ee3a,_0x281367[_0xf534('0x3e')]);var _0x4f143d={'where':_0x21ee3a[_0xf534('0x39')]};return db[_0xf534('0x2b')]['count'](_0x4f143d)[_0xf534('0x23')](function(_0x4fcbcc){_0x45b55b[_0xf534('0x1c')]=_0x4fcbcc;if(_0x281367[_0xf534('0x30')][_0xf534('0x3f')]){_0x21ee3a[_0xf534('0x40')]=[{'all':!![]}];}return db['Sound'][_0xf534('0x41')](_0x21ee3a);})[_0xf534('0x23')](function(_0x2518b5){_0x45b55b[_0xf534('0x42')]=_0x2518b5;return _0x45b55b;})['then'](respondWithFilteredResult(_0x17ca7d,_0x21ee3a))[_0xf534('0x43')](handleError(_0x17ca7d,null));};exports['show']=function(_0x518387,_0x31fe8d){var _0x3aa6f5={'raw':!![],'where':{'id':_0x518387[_0xf534('0x44')]['id']}},_0x134cc5={};_0x134cc5[_0xf534('0x2f')]=_[_0xf534('0x31')](db[_0xf534('0x2b')][_0xf534('0x2c')]);_0x134cc5[_0xf534('0x30')]=_['keys'](_0x518387[_0xf534('0x30')]);_0x134cc5[_0xf534('0x32')]=_[_0xf534('0x33')](_0x134cc5[_0xf534('0x2f')],_0x134cc5[_0xf534('0x30')]);_0x3aa6f5[_0xf534('0x34')]=_['intersection'](_0x134cc5[_0xf534('0x2f')],qs[_0xf534('0x35')](_0x518387['query']['fields']));_0x3aa6f5['attributes']=_0x3aa6f5[_0xf534('0x34')]['length']?_0x3aa6f5[_0xf534('0x34')]:_0x134cc5['model'];if(_0x518387['query'][_0xf534('0x3f')]){_0x3aa6f5[_0xf534('0x40')]=[{'all':!![]}];}_0x3aa6f5=_[_0xf534('0x45')]({},_0x3aa6f5,_0x518387[_0xf534('0x3e')]);return db[_0xf534('0x2b')]['find'](_0x3aa6f5)[_0xf534('0x23')](handleEntityNotFound(_0x31fe8d,null))['then'](respondWithResult(_0x31fe8d,null))[_0xf534('0x43')](handleError(_0x31fe8d,null));};exports[_0xf534('0x46')]=function(_0x2fae21,_0xdd60ad,_0x33ba67){return db['Sound'][_0xf534('0x47')]({'where':{'id':_0x2fae21[_0xf534('0x44')]['id']},'attributes':['name',_0xf534('0x48'),_0xf534('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0xdd60ad,null))[_0xf534('0x23')](function(_0x9d0344){if(_0x9d0344){if(!fs[_0xf534('0x4a')](path['join'](config[_0xf534('0x4b')],_0xf534('0x4c'),_0x9d0344[_0xf534('0x48')]+'.'+_0x9d0344['converted_format']))){throw new db[(_0xf534('0x4d'))][(_0xf534('0x4e'))](_0xf534('0x4f'));}return _0xdd60ad[_0xf534('0x46')](path[_0xf534('0x50')](config[_0xf534('0x4b')],_0xf534('0x4c'),util[_0xf534('0x51')]('%s.%s',_0x9d0344[_0xf534('0x48')],_0x9d0344[_0xf534('0x49')])),util[_0xf534('0x51')](_0xf534('0x52'),_0x9d0344[_0xf534('0x27')],_0x9d0344[_0xf534('0x49')]));}return null;})[_0xf534('0x43')](handleError(_0xdd60ad,null));};exports[_0xf534('0x53')]=function(_0x376ee6,_0x12b6d8,_0x1b9f75){var _0x2ac41f={'name':path[_0xf534('0x54')](_0x376ee6['file'][_0xf534('0x55')],path['extname'](_0x376ee6[_0xf534('0x56')]['originalname'])),'save_name':path[_0xf534('0x54')](_0x376ee6[_0xf534('0x56')][_0xf534('0x57')],path['extname'](_0x376ee6[_0xf534('0x56')]['filename'])),'original_format':path[_0xf534('0x58')](_0x376ee6[_0xf534('0x56')][_0xf534('0x55')])['substring'](0x1),'converted_format':_0xf534('0x59')};var _0x8eae82=path[_0xf534('0x50')](config[_0xf534('0x4b')],_0xf534('0x5a'),_0x376ee6[_0xf534('0x56')][_0xf534('0x57')]);var _0x3688b9=path['join'](config[_0xf534('0x4b')],_0xf534('0x4c'),util[_0xf534('0x51')]('%s.%s',path[_0xf534('0x54')](_0x376ee6[_0xf534('0x56')][_0xf534('0x57')],path['extname'](_0x376ee6[_0xf534('0x56')][_0xf534('0x57')])),_0x2ac41f[_0xf534('0x49')]));logger['info'](_0xf534('0x5b'),_0x8eae82);logger[_0xf534('0x5c')](_0xf534('0x5d'),_0x3688b9);try{fs[_0xf534('0x5e')](_0x8eae82,parseInt(_0xf534('0x5f'),0x8));var _0x4e7eef=sox[_0xf534('0x60')](_0x8eae82,_0x3688b9,{'sampleRate':0x1f40,'format':_0xf534('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4e7eef['on'](_0xf534('0x26'),function(_0x2a9f79){fs[_0xf534('0x61')](_0x8eae82);_0x12b6d8[_0xf534('0x17')](0x1f4)[_0xf534('0x28')](_0x2a9f79);});_0x4e7eef['on']('src',function(_0x302403){_0x2ac41f[_0xf534('0x62')]=isNaN(_0x302403[_0xf534('0x63')])?null:_0x302403[_0xf534('0x63')]*0x3e8;_0x2ac41f[_0xf534('0x64')]=isNaN(_0x302403[_0xf534('0x65')])?null:_0x302403[_0xf534('0x65')];_0x2ac41f[_0xf534('0x66')]=isNaN(_0x302403['channelCount'])?null:_0x302403[_0xf534('0x67')];_0x2ac41f[_0xf534('0x68')]=isNaN(_0x302403[_0xf534('0x69')])?null:_0x302403[_0xf534('0x69')];_0x2ac41f[_0xf534('0x6a')]=isNaN(_0x302403[_0xf534('0x6b')])?null:_0x302403[_0xf534('0x6b')];});_0x4e7eef['on'](_0xf534('0x6c'),function(_0xd81cb9){_0x2ac41f['converted_duration']=isNaN(_0xd81cb9[_0xf534('0x63')])?null:_0xd81cb9['duration']*0x3e8;_0x2ac41f['converted_sampleCount']=isNaN(_0xd81cb9['sampleCount'])?null:_0xd81cb9[_0xf534('0x65')];_0x2ac41f[_0xf534('0x6d')]=isNaN(_0xd81cb9[_0xf534('0x67')])?null:_0xd81cb9[_0xf534('0x67')];_0x2ac41f['converted_bitRate']=isNaN(_0xd81cb9[_0xf534('0x69')])?null:_0xd81cb9[_0xf534('0x69')];_0x2ac41f[_0xf534('0x6e')]=isNaN(_0xd81cb9[_0xf534('0x6b')])?null:_0xd81cb9[_0xf534('0x6b')];});_0x4e7eef['on']('end',function(){fs[_0xf534('0x5e')](_0x3688b9,parseInt('0777',0x8));return db[_0xf534('0x2b')][_0xf534('0x53')](_0x2ac41f)[_0xf534('0x23')](function(_0x2c0e2){var _0x22e8df={'role':_0x376ee6[_0xf534('0x6f')]['role'],'userProfileId':_0x376ee6[_0xf534('0x6f')][_0xf534('0x70')]};if(!_0x22e8df)throw new Error(_0xf534('0x71'));if(_0x22e8df[_0xf534('0x72')]===_0xf534('0x73')){var _0x11d746=_0x2c0e2[_0xf534('0x74')]({'plain':!![]});return db[_0xf534('0x75')][_0xf534('0x47')]({'where':{'name':_0xf534('0x76'),'userProfileId':_0x22e8df[_0xf534('0x70')]},'raw':!![]})[_0xf534('0x23')](function(_0xa200d7){if(_0xa200d7&&_0xa200d7[_0xf534('0x77')]===0x0){return db['UserProfileResource'][_0xf534('0x53')]({'name':_0x11d746[_0xf534('0x27')],'resourceId':_0x11d746['id'],'type':_0xa200d7[_0xf534('0x27')],'sectionId':_0xa200d7['id']},{})[_0xf534('0x23')](function(){return _0x2c0e2;});}else{return _0x2c0e2;}})['catch'](function(_0x25fb13){logger[_0xf534('0x26')](_0xf534('0x78'),_0x25fb13);throw _0x25fb13;});}return _0x2c0e2;})[_0xf534('0x23')](respondWithResult(_0x12b6d8,null))['catch'](handleError(_0x12b6d8,null));});_0x4e7eef[_0xf534('0x79')]();}catch(_0x1c57de){_0x12b6d8['status'](0x1f4)[_0xf534('0x28')](_0x1c57de);}};exports[_0xf534('0x22')]=function(_0x5230b9,_0x3444f4,_0x4c503f){return db[_0xf534('0x2b')][_0xf534('0x47')]({'where':{'id':_0x5230b9[_0xf534('0x44')]['id']}})[_0xf534('0x23')](handleEntityNotFound(_0x3444f4,null))[_0xf534('0x23')](saveUpdates(_['pick'](_0x5230b9[_0xf534('0x6f')],[_0xf534('0x27'),'description']),null))[_0xf534('0x23')](respondWithResult(_0x3444f4,null))[_0xf534('0x43')](handleError(_0x3444f4,null));};exports[_0xf534('0x7a')]=function(_0x3021bd,_0x45e198,_0x3424ae){return db[_0xf534('0x2b')][_0xf534('0x47')]({'where':{'id':_0x3021bd[_0xf534('0x44')]['id']}})[_0xf534('0x23')](function(_0x24a1a5){if(_0x24a1a5){return _0x24a1a5[_0xf534('0x25')]();}})['then'](function(_0x30483c){var _0x26c6f9=path[_0xf534('0x50')](config[_0xf534('0x4b')],_0xf534('0x5a'),util[_0xf534('0x51')]('%s.%s',_0x30483c[_0xf534('0x48')],_0x30483c[_0xf534('0x7b')]));var _0x55c067=path[_0xf534('0x50')](config[_0xf534('0x4b')],_0xf534('0x4c'),util[_0xf534('0x51')](_0xf534('0x52'),_0x30483c['save_name'],_0x30483c['converted_format']));fs[_0xf534('0x61')](_0x26c6f9);fs[_0xf534('0x61')](_0x55c067);return _0x30483c;})[_0xf534('0x23')](function(_0x438a6f){if(_0x438a6f){return _0x45e198[_0xf534('0x17')](0xcc)['end']();}})[_0xf534('0x23')](handleEntityNotFound(_0x45e198,null))['catch'](handleError(_0x45e198,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 01e8c98..00b6e29 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 _0x2f8d=['path','rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x182478,_0x1d80f9){var _0x38f7d1=function(_0x3d75ba){while(--_0x3d75ba){_0x182478['push'](_0x182478['shift']());}};_0x38f7d1(++_0x1d80f9);}(_0x2f8d,0x19e));var _0xd2f8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2f8d[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd2f8('0x0'));var util=require(_0xd2f8('0x1'));var logger=require(_0xd2f8('0x2'))('api');var moment=require(_0xd2f8('0x3'));var BPromise=require(_0xd2f8('0x4'));var rp=require(_0xd2f8('0x5'));var fs=require('fs');var path=require(_0xd2f8('0x6'));var rimraf=require(_0xd2f8('0x7'));var config=require(_0xd2f8('0x8'));var attributes=require(_0xd2f8('0x9'));module['exports']=function(_0x4da89d,_0x219391){return _0x4da89d['define'](_0xd2f8('0xa'),attributes,{'tableName':_0xd2f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78fc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./sound.attributes','exports','Sound','tools_sounds'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x78fc,0x16b));var _0xc78f=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x78fc[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0xc78f('0x0'));var util=require(_0xc78f('0x1'));var logger=require(_0xc78f('0x2'))(_0xc78f('0x3'));var moment=require(_0xc78f('0x4'));var BPromise=require(_0xc78f('0x5'));var rp=require(_0xc78f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc78f('0x7'));module[_0xc78f('0x8')]=function(_0x2bf128,_0xfdffb9){return _0x2bf128['define'](_0xc78f('0x9'),attributes,{'tableName':_0xc78f('0xa'),'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 f96e31d..8b27da4 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 _0xc81a=['error','code','message','catch','Sound','find','options','raw','where','attributes','include','model','map','ShowSound','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../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'];(function(_0xf5c7bf,_0x5e26c1){var _0xa37d79=function(_0x4cdeec){while(--_0x4cdeec){_0xf5c7bf['push'](_0xf5c7bf['shift']());}};_0xa37d79(++_0x5e26c1);}(_0xc81a,0x71));var _0xac81=function(_0x41c9be,_0x3fbc06){_0x41c9be=_0x41c9be-0x0;var _0x29cb73=_0xc81a[_0x41c9be];return _0x29cb73;};'use strict';var _=require(_0xac81('0x0'));var util=require('util');var moment=require(_0xac81('0x1'));var BPromise=require('bluebird');var rs=require(_0xac81('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac81('0x3'))['db'];var utils=require(_0xac81('0x4'));var logger=require(_0xac81('0x5'))(_0xac81('0x6'));var config=require(_0xac81('0x7'));var jayson=require(_0xac81('0x8'));var client=jayson[_0xac81('0x9')][_0xac81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d3dd0,_0x240820,_0x27d32e){return new BPromise(function(_0x76e8cd,_0x184cca){return client[_0xac81('0xb')](_0x4d3dd0,_0x27d32e)[_0xac81('0xc')](function(_0xa2da18){logger[_0xac81('0xd')](_0xac81('0xe'),_0x240820,_0xac81('0xf'));logger[_0xac81('0x10')](_0xac81('0x11'),_0x240820,_0xac81('0xf'),JSON[_0xac81('0x12')](_0xa2da18));if(_0xa2da18['error']){if(_0xa2da18[_0xac81('0x13')][_0xac81('0x14')]===0x1f4){logger[_0xac81('0x13')](_0xac81('0xe'),_0x240820,_0xa2da18[_0xac81('0x13')][_0xac81('0x15')]);return _0x184cca(_0xa2da18[_0xac81('0x13')][_0xac81('0x15')]);}logger[_0xac81('0x13')](_0xac81('0xe'),_0x240820,_0xa2da18[_0xac81('0x13')][_0xac81('0x15')]);return _0x76e8cd(_0xa2da18[_0xac81('0x13')][_0xac81('0x15')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x240820,_0xac81('0xf'));_0x76e8cd(_0xa2da18['result']['message']);}})[_0xac81('0x16')](function(_0xcccbce){logger[_0xac81('0x13')](_0xac81('0xe'),_0x240820,_0xcccbce);_0x184cca(_0xcccbce);});});}exports['ShowSound']=function(_0x106438){var _0x5e0853=this;return new Promise(function(_0x59c80d,_0x5b3105){return db[_0xac81('0x17')][_0xac81('0x18')]({'raw':_0x106438[_0xac81('0x19')]?_0x106438[_0xac81('0x19')][_0xac81('0x1a')]===undefined?!![]:![]:!![],'where':_0x106438[_0xac81('0x19')]?_0x106438[_0xac81('0x19')][_0xac81('0x1b')]||null:null,'attributes':_0x106438[_0xac81('0x19')]?_0x106438[_0xac81('0x19')][_0xac81('0x1c')]||null:null,'include':_0x106438[_0xac81('0x19')]?_0x106438[_0xac81('0x19')][_0xac81('0x1d')]?_['map'](_0x106438[_0xac81('0x19')]['include'],function(_0x2d5a1f){return{'model':db[_0x2d5a1f[_0xac81('0x1e')]],'as':_0x2d5a1f['as'],'attributes':_0x2d5a1f[_0xac81('0x1c')],'include':_0x2d5a1f[_0xac81('0x1d')]?_[_0xac81('0x1f')](_0x2d5a1f[_0xac81('0x1d')],function(_0x30b782){return{'model':db[_0x30b782[_0xac81('0x1e')]],'as':_0x30b782['as'],'attributes':_0x30b782['attributes'],'include':_0x30b782[_0xac81('0x1d')]?_[_0xac81('0x1f')](_0x30b782[_0xac81('0x1d')],function(_0x5f0f44){return{'model':db[_0x5f0f44[_0xac81('0x1e')]],'as':_0x5f0f44['as'],'attributes':_0x5f0f44['attributes']};}):[]};}):[]};}):[]:[]})[_0xac81('0xc')](function(_0xef2c23){logger['info'](_0xac81('0x20'),_0x106438);logger[_0xac81('0x10')]('ShowSound',_0x106438,JSON[_0xac81('0x12')](_0xef2c23));_0x59c80d(_0xef2c23);})[_0xac81('0x16')](function(_0x56c0e3){logger[_0xac81('0x13')](_0xac81('0x20'),_0x56c0e3[_0xac81('0x15')],_0x106438);_0x5b3105(_0x5e0853[_0xac81('0x13')](0x1f4,_0x56c0e3[_0xac81('0x15')]));});});}; \ No newline at end of file +var _0x4ebe=['../../config/utils','rpc','jayson/promise','request','then','info','request\x20sent','debug','error','Sound,\x20%s,\x20%s','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowSound','stringify','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x16e6a4,_0x1cbc2e){var _0x3c2954=function(_0x27b1c6){while(--_0x27b1c6){_0x16e6a4['push'](_0x16e6a4['shift']());}};_0x3c2954(++_0x1cbc2e);}(_0x4ebe,0x183));var _0xe4eb=function(_0x1d9302,_0xb78a08){_0x1d9302=_0x1d9302-0x0;var _0x15c30b=_0x4ebe[_0x1d9302];return _0x15c30b;};'use strict';var _=require('lodash');var util=require(_0xe4eb('0x0'));var moment=require('moment');var BPromise=require(_0xe4eb('0x1'));var rs=require(_0xe4eb('0x2'));var fs=require('fs');var Redis=require(_0xe4eb('0x3'));var db=require(_0xe4eb('0x4'))['db'];var utils=require(_0xe4eb('0x5'));var logger=require('../../config/logger')(_0xe4eb('0x6'));var config=require('../../config/environment');var jayson=require(_0xe4eb('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcbc0f1,_0x1091e5,_0x5a2915){return new BPromise(function(_0x56fa63,_0x12cfa6){return client[_0xe4eb('0x8')](_0xcbc0f1,_0x5a2915)[_0xe4eb('0x9')](function(_0x36c3b8){logger[_0xe4eb('0xa')]('Sound,\x20%s,\x20%s',_0x1091e5,_0xe4eb('0xb'));logger[_0xe4eb('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x1091e5,_0xe4eb('0xb'),JSON['stringify'](_0x36c3b8));if(_0x36c3b8['error']){if(_0x36c3b8[_0xe4eb('0xd')]['code']===0x1f4){logger[_0xe4eb('0xd')](_0xe4eb('0xe'),_0x1091e5,_0x36c3b8['error'][_0xe4eb('0xf')]);return _0x12cfa6(_0x36c3b8[_0xe4eb('0xd')][_0xe4eb('0xf')]);}logger[_0xe4eb('0xd')](_0xe4eb('0xe'),_0x1091e5,_0x36c3b8[_0xe4eb('0xd')]['message']);return _0x56fa63(_0x36c3b8[_0xe4eb('0xd')][_0xe4eb('0xf')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x1091e5,'request\x20sent');_0x56fa63(_0x36c3b8[_0xe4eb('0x10')][_0xe4eb('0xf')]);}})[_0xe4eb('0x11')](function(_0x568c0a){logger[_0xe4eb('0xd')](_0xe4eb('0xe'),_0x1091e5,_0x568c0a);_0x12cfa6(_0x568c0a);});});}exports['ShowSound']=function(_0x2d1a0a){var _0x1b98ec=this;return new Promise(function(_0x1208f8,_0x41371d){return db['Sound'][_0xe4eb('0x12')]({'raw':_0x2d1a0a[_0xe4eb('0x13')]?_0x2d1a0a[_0xe4eb('0x13')][_0xe4eb('0x14')]===undefined?!![]:![]:!![],'where':_0x2d1a0a[_0xe4eb('0x13')]?_0x2d1a0a[_0xe4eb('0x13')][_0xe4eb('0x15')]||null:null,'attributes':_0x2d1a0a[_0xe4eb('0x13')]?_0x2d1a0a['options'][_0xe4eb('0x16')]||null:null,'include':_0x2d1a0a[_0xe4eb('0x13')]?_0x2d1a0a[_0xe4eb('0x13')][_0xe4eb('0x17')]?_[_0xe4eb('0x18')](_0x2d1a0a[_0xe4eb('0x13')][_0xe4eb('0x17')],function(_0x233c1e){return{'model':db[_0x233c1e['model']],'as':_0x233c1e['as'],'attributes':_0x233c1e[_0xe4eb('0x16')],'include':_0x233c1e[_0xe4eb('0x17')]?_[_0xe4eb('0x18')](_0x233c1e['include'],function(_0x343909){return{'model':db[_0x343909[_0xe4eb('0x19')]],'as':_0x343909['as'],'attributes':_0x343909[_0xe4eb('0x16')],'include':_0x343909[_0xe4eb('0x17')]?_[_0xe4eb('0x18')](_0x343909[_0xe4eb('0x17')],function(_0x2cd64f){return{'model':db[_0x2cd64f['model']],'as':_0x2cd64f['as'],'attributes':_0x2cd64f[_0xe4eb('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe4eb('0x9')](function(_0x3789db){logger[_0xe4eb('0xa')](_0xe4eb('0x1a'),_0x2d1a0a);logger[_0xe4eb('0xc')]('ShowSound',_0x2d1a0a,JSON[_0xe4eb('0x1b')](_0x3789db));_0x1208f8(_0x3789db);})[_0xe4eb('0x11')](function(_0xb82aac){logger[_0xe4eb('0xd')]('ShowSound',_0xb82aac[_0xe4eb('0xf')],_0x2d1a0a);_0x41371d(_0x1b98ec[_0xe4eb('0xd')](0x1f4,_0xb82aac[_0xe4eb('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3623e38..21f1887 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x5375c6,_0xa1378){var _0x529bca=function(_0x1c8b83){while(--_0x1c8b83){_0x5375c6['push'](_0x5375c6['shift']());}};_0x529bca(++_0xa1378);}(_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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2d582c,_0x424a15){var _0x37e92a=function(_0x142fb1){while(--_0x142fb1){_0x2d582c['push'](_0x2d582c['shift']());}};_0x37e92a(++_0x424a15);}(_0x4fc2,0x111));var _0x24fc=function(_0x2daff6,_0x18a06f){_0x2daff6=_0x2daff6-0x0;var _0x19a3d6=_0x4fc2[_0x2daff6];return _0x19a3d6;};'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')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b67f91e..68f2a74 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 _0xd3af=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x1cd439,_0x4154ad){var _0x413696=function(_0x190bfc){while(--_0x190bfc){_0x1cd439['push'](_0x1cd439['shift']());}};_0x413696(++_0x4154ad);}(_0xd3af,0xa0));var _0xfd3a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd3af[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xfd3a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfd3a('0x1')]},'body':{'type':Sequelize[_0xfd3a('0x2')](_0xfd3a('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xfd3a('0x4')]('in',_0xfd3a('0x5')),'defaultValue':_0xfd3a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfd3a('0x2')]}}; \ No newline at end of file +var _0x2093=['exports','STRING','TEXT','medium','out','sequelize'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x2093,0xad));var _0x3209=function(_0x4a8072,_0x435bab){_0x4a8072=_0x4a8072-0x0;var _0x11a4fe=_0x2093[_0x4a8072];return _0x11a4fe;};'use strict';var Sequelize=require(_0x3209('0x0'));module[_0x3209('0x1')]={'uniqueid':{'type':Sequelize[_0x3209('0x2')]},'body':{'type':Sequelize[_0x3209('0x3')](_0x3209('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3209('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3209('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f62c7d2..d457258 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 _0x5d0a=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','update','then','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2f47cc,_0x2cb108){var _0x8b4394=function(_0x557d1e){while(--_0x557d1e){_0x2f47cc['push'](_0x2f47cc['shift']());}};_0x8b4394(++_0x2cb108);}(_0x5d0a,0x175));var _0xa5d0=function(_0x524d78,_0x556616){_0x524d78=_0x524d78-0x0;var _0x55e57c=_0x5d0a[_0x524d78];return _0x55e57c;};'use strict';var emlformat=require(_0xa5d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d0('0x2'));var moment=require(_0xa5d0('0x3'));var BPromise=require(_0xa5d0('0x4'));var Mustache=require(_0xa5d0('0x5'));var util=require('util');var path=require(_0xa5d0('0x6'));var sox=require(_0xa5d0('0x7'));var csv=require(_0xa5d0('0x8'));var ejs=require(_0xa5d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa5d0('0xa'));var _=require(_0xa5d0('0xb'));var squel=require(_0xa5d0('0xc'));var crypto=require(_0xa5d0('0xd'));var jsforce=require(_0xa5d0('0xe'));var deskjs=require(_0xa5d0('0xf'));var toCsv=require(_0xa5d0('0x8'));var querystring=require('querystring');var Papa=require(_0xa5d0('0x10'));var Redis=require(_0xa5d0('0x11'));var authService=require(_0xa5d0('0x12'));var qs=require(_0xa5d0('0x13'));var as=require(_0xa5d0('0x14'));var hardwareService=require(_0xa5d0('0x15'));var logger=require(_0xa5d0('0x16'))(_0xa5d0('0x17'));var utils=require(_0xa5d0('0x18'));var config=require(_0xa5d0('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5d0('0x1a'))['db'];function respondWithStatusCode(_0x4bdb6b,_0x566b17){_0x566b17=_0x566b17||0xcc;return function(_0x3ab8b9){if(_0x3ab8b9){return _0x4bdb6b[_0xa5d0('0x1b')](_0x566b17);}return _0x4bdb6b[_0xa5d0('0x1c')](_0x566b17)[_0xa5d0('0x1d')]();};}function respondWithResult(_0x4cb722,_0x56ee85){_0x56ee85=_0x56ee85||0xc8;return function(_0xf06747){if(_0xf06747){return _0x4cb722[_0xa5d0('0x1c')](_0x56ee85)[_0xa5d0('0x1e')](_0xf06747);}};}function respondWithFilteredResult(_0x22afa2,_0x3847bb){return function(_0x146722){if(_0x146722){var _0x1461d5=typeof _0x3847bb['offset']===_0xa5d0('0x1f')&&typeof _0x3847bb['limit']===_0xa5d0('0x1f');var _0x3c00fd=_0x146722['count'];var _0x5bc068=_0x1461d5?0x0:_0x3847bb[_0xa5d0('0x20')];var _0x234254=_0x1461d5?_0x146722['count']:_0x3847bb[_0xa5d0('0x20')]+_0x3847bb[_0xa5d0('0x21')];var _0x9fab4;if(_0x234254>=_0x3c00fd){_0x234254=_0x3c00fd;_0x9fab4=0xc8;}else{_0x9fab4=0xce;}_0x22afa2[_0xa5d0('0x1c')](_0x9fab4);return _0x22afa2[_0xa5d0('0x22')](_0xa5d0('0x23'),_0x5bc068+'-'+_0x234254+'/'+_0x3c00fd)['json'](_0x146722);}return null;};}function patchUpdates(_0x4cf8db){return function(_0x2a56ff){try{jsonpatch[_0xa5d0('0x24')](_0x2a56ff,_0x4cf8db,!![]);}catch(_0x4cc587){return BPromise['reject'](_0x4cc587);}return _0x2a56ff[_0xa5d0('0x25')]();};}function saveUpdates(_0x42a745,_0x27a4cb){return function(_0xde8c41){if(_0xde8c41){return _0xde8c41[_0xa5d0('0x26')](_0x42a745)[_0xa5d0('0x27')](function(_0x518a60){return _0x518a60;});}return null;};}function removeEntity(_0x2de295,_0x307377){return function(_0xefd903){if(_0xefd903){return _0xefd903['destroy']()[_0xa5d0('0x27')](function(){_0x2de295[_0xa5d0('0x1c')](0xcc)[_0xa5d0('0x1d')]();});}};}function handleEntityNotFound(_0x4d5e7a,_0x4916f6){return function(_0x758789){if(!_0x758789){_0x4d5e7a['sendStatus'](0x194);}return _0x758789;};}function handleError(_0x49ca76,_0x55cd15){_0x55cd15=_0x55cd15||0x1f4;return function(_0x2b29a5){logger[_0xa5d0('0x28')](_0x2b29a5['stack']);if(_0x2b29a5[_0xa5d0('0x29')]){delete _0x2b29a5['name'];}_0x49ca76[_0xa5d0('0x1c')](_0x55cd15)['send'](_0x2b29a5);};}exports[_0xa5d0('0x2a')]=function(_0xc3336f,_0x431fea){var _0x48dbd2={},_0x5495cb={},_0x5bcfe1={'count':0x0,'rows':[]};var _0x3d7818=_[_0xa5d0('0x2b')](db[_0xa5d0('0x2c')][_0xa5d0('0x2d')],function(_0x5e876c){return{'name':_0x5e876c[_0xa5d0('0x2e')],'type':_0x5e876c[_0xa5d0('0x2f')]['key']};});_0x5495cb[_0xa5d0('0x30')]=_[_0xa5d0('0x2b')](_0x3d7818,_0xa5d0('0x29'));_0x5495cb[_0xa5d0('0x31')]=_[_0xa5d0('0x32')](_0xc3336f[_0xa5d0('0x31')]);_0x5495cb[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x5495cb[_0xa5d0('0x30')],_0x5495cb[_0xa5d0('0x31')]);_0x48dbd2[_0xa5d0('0x35')]=_['intersection'](_0x5495cb[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x48dbd2['attributes']=_0x48dbd2[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0x48dbd2['attributes']:_0x5495cb[_0xa5d0('0x30')];if(!_0xc3336f['query'][_0xa5d0('0x38')](_0xa5d0('0x39'))){_0x48dbd2['limit']=qs['limit'](_0xc3336f['query'][_0xa5d0('0x21')]);_0x48dbd2['offset']=qs[_0xa5d0('0x20')](_0xc3336f[_0xa5d0('0x31')]['offset']);}_0x48dbd2[_0xa5d0('0x3a')]=qs[_0xa5d0('0x3b')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3b')]);_0x48dbd2[_0xa5d0('0x3c')]=qs[_0xa5d0('0x33')](_[_0xa5d0('0x3d')](_0xc3336f[_0xa5d0('0x31')],_0x5495cb[_0xa5d0('0x33')]),_0x3d7818);if(_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3e')]){_0x48dbd2[_0xa5d0('0x3c')]=_['merge'](_0x48dbd2[_0xa5d0('0x3c')],{'$or':_['map'](_0x3d7818,function(_0x393daf){if(_0x393daf[_0xa5d0('0x2f')]!==_0xa5d0('0x3f')){var _0x40c179={};_0x40c179[_0x393daf[_0xa5d0('0x29')]]={'$like':'%'+_0xc3336f[_0xa5d0('0x31')]['filter']+'%'};return _0x40c179;}})});}_0x48dbd2=_[_0xa5d0('0x40')]({},_0x48dbd2,_0xc3336f['options']);var _0x16fe00={'where':_0x48dbd2['where']};return db['SquareMessage'][_0xa5d0('0x41')](_0x16fe00)[_0xa5d0('0x27')](function(_0x249b28){_0x5bcfe1[_0xa5d0('0x41')]=_0x249b28;if(_0xc3336f['query'][_0xa5d0('0x42')]){_0x48dbd2[_0xa5d0('0x43')]=[{'all':!![]}];}return db[_0xa5d0('0x2c')][_0xa5d0('0x44')](_0x48dbd2);})[_0xa5d0('0x27')](function(_0x26d37f){_0x5bcfe1[_0xa5d0('0x45')]=_0x26d37f;return _0x5bcfe1;})['then'](respondWithFilteredResult(_0x431fea,_0x48dbd2))[_0xa5d0('0x46')](handleError(_0x431fea,null));};exports[_0xa5d0('0x47')]=function(_0x20ae65,_0x343376){var _0x1090b6={'raw':!![],'where':{'id':_0x20ae65[_0xa5d0('0x48')]['id']}},_0x358b23={};_0x358b23[_0xa5d0('0x30')]=_['keys'](db[_0xa5d0('0x2c')]['rawAttributes']);_0x358b23[_0xa5d0('0x31')]=_['keys'](_0x20ae65[_0xa5d0('0x31')]);_0x358b23['filters']=_[_0xa5d0('0x34')](_0x358b23['model'],_0x358b23[_0xa5d0('0x31')]);_0x1090b6[_0xa5d0('0x35')]=_['intersection'](_0x358b23[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0x20ae65[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x1090b6['attributes']=_0x1090b6['attributes'][_0xa5d0('0x37')]?_0x1090b6[_0xa5d0('0x35')]:_0x358b23[_0xa5d0('0x30')];if(_0x20ae65[_0xa5d0('0x31')]['includeAll']){_0x1090b6['include']=[{'all':!![]}];}_0x1090b6=_[_0xa5d0('0x40')]({},_0x1090b6,_0x20ae65[_0xa5d0('0x49')]);return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')](_0x1090b6)[_0xa5d0('0x27')](handleEntityNotFound(_0x343376,null))['then'](respondWithResult(_0x343376,null))['catch'](handleError(_0x343376,null));};exports[_0xa5d0('0x4b')]=function(_0x9a4c50,_0x2d8551){return db[_0xa5d0('0x2c')][_0xa5d0('0x4b')](_0x9a4c50[_0xa5d0('0x4c')],{})[_0xa5d0('0x27')](respondWithResult(_0x2d8551,0xc9))[_0xa5d0('0x46')](handleError(_0x2d8551,null));};exports[_0xa5d0('0x26')]=function(_0xbb7c45,_0x555ec8){if(_0xbb7c45[_0xa5d0('0x4c')]['id']){delete _0xbb7c45['body']['id'];}return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0xbb7c45['params']['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x555ec8,null))[_0xa5d0('0x27')](saveUpdates(_0xbb7c45[_0xa5d0('0x4c')],null))[_0xa5d0('0x27')](respondWithResult(_0x555ec8,null))[_0xa5d0('0x46')](handleError(_0x555ec8,null));};exports['destroy']=function(_0x30d13c,_0x54bd94){return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0x30d13c[_0xa5d0('0x48')]['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x54bd94,null))['then'](removeEntity(_0x54bd94,null))['catch'](handleError(_0x54bd94,null));}; \ No newline at end of file +var _0xd287=['params','keys','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','SquareMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x36c001,_0xd20d39){var _0x2c8e8f=function(_0x2fb082){while(--_0x2fb082){_0x36c001['push'](_0x36c001['shift']());}};_0x2c8e8f(++_0xd20d39);}(_0xd287,0x97));var _0x7d28=function(_0x281ece,_0x4b760b){_0x281ece=_0x281ece-0x0;var _0x43b303=_0xd287[_0x281ece];return _0x43b303;};'use strict';var emlformat=require(_0x7d28('0x0'));var rimraf=require(_0x7d28('0x1'));var zipdir=require(_0x7d28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d28('0x3'));var BPromise=require(_0x7d28('0x4'));var Mustache=require(_0x7d28('0x5'));var util=require(_0x7d28('0x6'));var path=require('path');var sox=require(_0x7d28('0x7'));var csv=require(_0x7d28('0x8'));var ejs=require(_0x7d28('0x9'));var fs=require('fs');var fs_extra=require(_0x7d28('0xa'));var _=require(_0x7d28('0xb'));var squel=require(_0x7d28('0xc'));var crypto=require(_0x7d28('0xd'));var jsforce=require(_0x7d28('0xe'));var deskjs=require(_0x7d28('0xf'));var toCsv=require(_0x7d28('0x8'));var querystring=require(_0x7d28('0x10'));var Papa=require('papaparse');var Redis=require(_0x7d28('0x11'));var authService=require(_0x7d28('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d28('0x13'));var logger=require(_0x7d28('0x14'))(_0x7d28('0x15'));var utils=require('../../config/utils');var config=require(_0x7d28('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d28('0x17'))['db'];function respondWithStatusCode(_0x22feee,_0xb0fff4){_0xb0fff4=_0xb0fff4||0xcc;return function(_0x3def1e){if(_0x3def1e){return _0x22feee['sendStatus'](_0xb0fff4);}return _0x22feee['status'](_0xb0fff4)[_0x7d28('0x18')]();};}function respondWithResult(_0x420401,_0x2bfdcb){_0x2bfdcb=_0x2bfdcb||0xc8;return function(_0x4f7510){if(_0x4f7510){return _0x420401[_0x7d28('0x19')](_0x2bfdcb)[_0x7d28('0x1a')](_0x4f7510);}};}function respondWithFilteredResult(_0x2e8278,_0x3ace77){return function(_0x30ead3){if(_0x30ead3){var _0x6a9b5e=typeof _0x3ace77[_0x7d28('0x1b')]===_0x7d28('0x1c')&&typeof _0x3ace77[_0x7d28('0x1d')]===_0x7d28('0x1c');var _0x2e20f=_0x30ead3[_0x7d28('0x1e')];var _0x2f5186=_0x6a9b5e?0x0:_0x3ace77[_0x7d28('0x1b')];var _0x56e33a=_0x6a9b5e?_0x30ead3[_0x7d28('0x1e')]:_0x3ace77[_0x7d28('0x1b')]+_0x3ace77[_0x7d28('0x1d')];var _0x90a6b2;if(_0x56e33a>=_0x2e20f){_0x56e33a=_0x2e20f;_0x90a6b2=0xc8;}else{_0x90a6b2=0xce;}_0x2e8278[_0x7d28('0x19')](_0x90a6b2);return _0x2e8278['set']('Content-Range',_0x2f5186+'-'+_0x56e33a+'/'+_0x2e20f)[_0x7d28('0x1a')](_0x30ead3);}return null;};}function patchUpdates(_0x5d003b){return function(_0x3ecc6f){try{jsonpatch[_0x7d28('0x1f')](_0x3ecc6f,_0x5d003b,!![]);}catch(_0x5c7c8c){return BPromise[_0x7d28('0x20')](_0x5c7c8c);}return _0x3ecc6f[_0x7d28('0x21')]();};}function saveUpdates(_0x5c5239,_0xb4e2dd){return function(_0x4c2853){if(_0x4c2853){return _0x4c2853[_0x7d28('0x22')](_0x5c5239)[_0x7d28('0x23')](function(_0x1db722){return _0x1db722;});}return null;};}function removeEntity(_0x4d8b68,_0x21d700){return function(_0x2b1506){if(_0x2b1506){return _0x2b1506[_0x7d28('0x24')]()[_0x7d28('0x23')](function(){_0x4d8b68[_0x7d28('0x19')](0xcc)[_0x7d28('0x18')]();});}};}function handleEntityNotFound(_0x52adf1,_0x46a56a){return function(_0xa31e7e){if(!_0xa31e7e){_0x52adf1['sendStatus'](0x194);}return _0xa31e7e;};}function handleError(_0x1d804e,_0x3d3f40){_0x3d3f40=_0x3d3f40||0x1f4;return function(_0x19ee3c){logger[_0x7d28('0x25')](_0x19ee3c[_0x7d28('0x26')]);if(_0x19ee3c[_0x7d28('0x27')]){delete _0x19ee3c[_0x7d28('0x27')];}_0x1d804e[_0x7d28('0x19')](_0x3d3f40)['send'](_0x19ee3c);};}exports['index']=function(_0x516e50,_0x49a38f){var _0x3168b1={},_0x566820={},_0x571176={'count':0x0,'rows':[]};var _0xfaffb3=_['map'](db[_0x7d28('0x28')][_0x7d28('0x29')],function(_0x227bfb){return{'name':_0x227bfb[_0x7d28('0x2a')],'type':_0x227bfb[_0x7d28('0x2b')][_0x7d28('0x2c')]};});_0x566820[_0x7d28('0x2d')]=_['map'](_0xfaffb3,_0x7d28('0x27'));_0x566820[_0x7d28('0x2e')]=_['keys'](_0x516e50[_0x7d28('0x2e')]);_0x566820['filters']=_['intersection'](_0x566820[_0x7d28('0x2d')],_0x566820['query']);_0x3168b1[_0x7d28('0x2f')]=_[_0x7d28('0x30')](_0x566820[_0x7d28('0x2d')],qs[_0x7d28('0x31')](_0x516e50[_0x7d28('0x2e')][_0x7d28('0x31')]));_0x3168b1[_0x7d28('0x2f')]=_0x3168b1[_0x7d28('0x2f')][_0x7d28('0x32')]?_0x3168b1[_0x7d28('0x2f')]:_0x566820[_0x7d28('0x2d')];if(!_0x516e50[_0x7d28('0x2e')]['hasOwnProperty'](_0x7d28('0x33'))){_0x3168b1[_0x7d28('0x1d')]=qs['limit'](_0x516e50[_0x7d28('0x2e')]['limit']);_0x3168b1[_0x7d28('0x1b')]=qs[_0x7d28('0x1b')](_0x516e50[_0x7d28('0x2e')][_0x7d28('0x1b')]);}_0x3168b1[_0x7d28('0x34')]=qs[_0x7d28('0x35')](_0x516e50['query']['sort']);_0x3168b1[_0x7d28('0x36')]=qs['filters'](_[_0x7d28('0x37')](_0x516e50[_0x7d28('0x2e')],_0x566820[_0x7d28('0x38')]),_0xfaffb3);if(_0x516e50[_0x7d28('0x2e')][_0x7d28('0x39')]){_0x3168b1['where']=_[_0x7d28('0x3a')](_0x3168b1['where'],{'$or':_[_0x7d28('0x3b')](_0xfaffb3,function(_0x10a1f9){if(_0x10a1f9['type']!==_0x7d28('0x3c')){var _0x20c5e1={};_0x20c5e1[_0x10a1f9['name']]={'$like':'%'+_0x516e50[_0x7d28('0x2e')]['filter']+'%'};return _0x20c5e1;}})});}_0x3168b1=_[_0x7d28('0x3a')]({},_0x3168b1,_0x516e50[_0x7d28('0x3d')]);var _0x57d8ca={'where':_0x3168b1['where']};return db[_0x7d28('0x28')][_0x7d28('0x1e')](_0x57d8ca)[_0x7d28('0x23')](function(_0x4a974f){_0x571176[_0x7d28('0x1e')]=_0x4a974f;if(_0x516e50[_0x7d28('0x2e')][_0x7d28('0x3e')]){_0x3168b1[_0x7d28('0x3f')]=[{'all':!![]}];}return db[_0x7d28('0x28')][_0x7d28('0x40')](_0x3168b1);})[_0x7d28('0x23')](function(_0x47144d){_0x571176[_0x7d28('0x41')]=_0x47144d;return _0x571176;})[_0x7d28('0x23')](respondWithFilteredResult(_0x49a38f,_0x3168b1))[_0x7d28('0x42')](handleError(_0x49a38f,null));};exports[_0x7d28('0x43')]=function(_0x5cb334,_0x46cf06){var _0x293a97={'raw':!![],'where':{'id':_0x5cb334[_0x7d28('0x44')]['id']}},_0x1d07af={};_0x1d07af['model']=_[_0x7d28('0x45')](db['SquareMessage'][_0x7d28('0x29')]);_0x1d07af[_0x7d28('0x2e')]=_[_0x7d28('0x45')](_0x5cb334['query']);_0x1d07af[_0x7d28('0x38')]=_[_0x7d28('0x30')](_0x1d07af[_0x7d28('0x2d')],_0x1d07af[_0x7d28('0x2e')]);_0x293a97[_0x7d28('0x2f')]=_['intersection'](_0x1d07af[_0x7d28('0x2d')],qs[_0x7d28('0x31')](_0x5cb334[_0x7d28('0x2e')][_0x7d28('0x31')]));_0x293a97[_0x7d28('0x2f')]=_0x293a97['attributes'][_0x7d28('0x32')]?_0x293a97[_0x7d28('0x2f')]:_0x1d07af[_0x7d28('0x2d')];if(_0x5cb334[_0x7d28('0x2e')][_0x7d28('0x3e')]){_0x293a97[_0x7d28('0x3f')]=[{'all':!![]}];}_0x293a97=_[_0x7d28('0x3a')]({},_0x293a97,_0x5cb334['options']);return db['SquareMessage']['find'](_0x293a97)[_0x7d28('0x23')](handleEntityNotFound(_0x46cf06,null))[_0x7d28('0x23')](respondWithResult(_0x46cf06,null))['catch'](handleError(_0x46cf06,null));};exports[_0x7d28('0x46')]=function(_0x3110da,_0x5e16ea){return db[_0x7d28('0x28')]['create'](_0x3110da[_0x7d28('0x47')],{})[_0x7d28('0x23')](respondWithResult(_0x5e16ea,0xc9))[_0x7d28('0x42')](handleError(_0x5e16ea,null));};exports['update']=function(_0x14633e,_0xfcad93){if(_0x14633e[_0x7d28('0x47')]['id']){delete _0x14633e[_0x7d28('0x47')]['id'];}return db[_0x7d28('0x28')][_0x7d28('0x48')]({'where':{'id':_0x14633e[_0x7d28('0x44')]['id']}})['then'](handleEntityNotFound(_0xfcad93,null))['then'](saveUpdates(_0x14633e[_0x7d28('0x47')],null))[_0x7d28('0x23')](respondWithResult(_0xfcad93,null))[_0x7d28('0x42')](handleError(_0xfcad93,null));};exports['destroy']=function(_0x2bbcaa,_0x487d41){return db[_0x7d28('0x28')][_0x7d28('0x48')]({'where':{'id':_0x2bbcaa['params']['id']}})[_0x7d28('0x23')](handleEntityNotFound(_0x487d41,null))[_0x7d28('0x23')](removeEntity(_0x487d41,null))[_0x7d28('0x42')](handleError(_0x487d41,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index bbe3638..2d93ee6 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 _0x6850=['exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareMessage.attributes'];(function(_0x3258de,_0x11cf5e){var _0x16b65f=function(_0x8ccbdf){while(--_0x8ccbdf){_0x3258de['push'](_0x3258de['shift']());}};_0x16b65f(++_0x11cf5e);}(_0x6850,0x1e3));var _0x0685=function(_0x3623cc,_0x752fb7){_0x3623cc=_0x3623cc-0x0;var _0x418263=_0x6850[_0x3623cc];return _0x418263;};'use strict';var _=require(_0x0685('0x0'));var util=require(_0x0685('0x1'));var logger=require(_0x0685('0x2'))(_0x0685('0x3'));var moment=require(_0x0685('0x4'));var BPromise=require(_0x0685('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0685('0x6'));var rimraf=require('rimraf');var config=require(_0x0685('0x7'));var attributes=require(_0x0685('0x8'));module[_0x0685('0x9')]=function(_0x3b531d,_0x1791d6){return _0x3b531d[_0x0685('0xa')](_0x0685('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeb2=['../../config/logger','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util'];(function(_0x1fab16,_0x351dc0){var _0x338abb=function(_0x4443fa){while(--_0x4443fa){_0x1fab16['push'](_0x1fab16['shift']());}};_0x338abb(++_0x351dc0);}(_0xeeb2,0x182));var _0x2eeb=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xeeb2[_0x5bf420];return _0x1c5255;};'use strict';var _=require('lodash');var util=require(_0x2eeb('0x0'));var logger=require(_0x2eeb('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2eeb('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2eeb('0x3'));var config=require(_0x2eeb('0x4'));var attributes=require(_0x2eeb('0x5'));module[_0x2eeb('0x6')]=function(_0x34bc28,_0x1b6118){return _0x34bc28[_0x2eeb('0x7')](_0x2eeb('0x8'),attributes,{'tableName':'square_messages','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 238c608..734e915 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 _0xf945=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','lodash','util'];(function(_0x1865f3,_0x5154be){var _0xb69290=function(_0x12e20b){while(--_0x12e20b){_0x1865f3['push'](_0x1865f3['shift']());}};_0xb69290(++_0x5154be);}(_0xf945,0x177));var _0x5f94=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf945[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5f94('0x0'));var util=require(_0x5f94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f94('0x2'));var db=require(_0x5f94('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f94('0x4'))(_0x5f94('0x5'));var config=require(_0x5f94('0x6'));var jayson=require(_0x5f94('0x7'));var client=jayson[_0x5f94('0x8')][_0x5f94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9436cc,_0x1485b8,_0x5c2ac0){return new BPromise(function(_0x12805f,_0x3fc6b8){return client[_0x5f94('0xa')](_0x9436cc,_0x5c2ac0)[_0x5f94('0xb')](function(_0x23c345){logger['info'](_0x5f94('0xc'),_0x1485b8,_0x5f94('0xd'));logger[_0x5f94('0xe')](_0x5f94('0xf'),_0x1485b8,_0x5f94('0xd'),JSON[_0x5f94('0x10')](_0x23c345));if(_0x23c345[_0x5f94('0x11')]){if(_0x23c345['error'][_0x5f94('0x12')]===0x1f4){logger['error'](_0x5f94('0xc'),_0x1485b8,_0x23c345[_0x5f94('0x11')]['message']);return _0x3fc6b8(_0x23c345['error']['message']);}logger[_0x5f94('0x11')](_0x5f94('0xc'),_0x1485b8,_0x23c345[_0x5f94('0x11')][_0x5f94('0x13')]);return _0x12805f(_0x23c345['error'][_0x5f94('0x13')]);}else{logger[_0x5f94('0x14')](_0x5f94('0xc'),_0x1485b8,'request\x20sent');_0x12805f(_0x23c345[_0x5f94('0x15')][_0x5f94('0x13')]);}})[_0x5f94('0x16')](function(_0x1e9651){logger['error']('SquareMessage,\x20%s,\x20%s',_0x1485b8,_0x1e9651);_0x3fc6b8(_0x1e9651);});});}exports['CreateSquareMessage']=function(_0xb3b329){var _0x165612=this;return new Promise(function(_0x16950d,_0x330ffe){return db[_0x5f94('0x17')][_0x5f94('0x18')](_0xb3b329[_0x5f94('0x19')],{'raw':_0xb3b329[_0x5f94('0x1a')]?_0xb3b329['options'][_0x5f94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x273da7){logger['info'](_0x5f94('0x1c'),_0xb3b329);logger['debug'](_0x5f94('0x1c'),_0xb3b329,JSON['stringify'](_0x273da7));_0x16950d(_0x273da7);})[_0x5f94('0x16')](function(_0x5b75af){logger['error']('CreateSquareMessage',_0x5b75af[_0x5f94('0x13')],_0xb3b329);_0x330ffe(_0x165612[_0x5f94('0x11')](0x1f4,_0x5b75af[_0x5f94('0x13')]));});});}; \ No newline at end of file +var _0x53cc=['create','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage'];(function(_0x4dfce8,_0x2a9880){var _0x488a8c=function(_0xcf49e5){while(--_0xcf49e5){_0x4dfce8['push'](_0x4dfce8['shift']());}};_0x488a8c(++_0x2a9880);}(_0x53cc,0xc9));var _0xc53c=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x53cc[_0x1085db];return _0x392a60;};'use strict';var _=require(_0xc53c('0x0'));var util=require('util');var moment=require(_0xc53c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc53c('0x2'));var fs=require('fs');var Redis=require(_0xc53c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53c('0x4'));var logger=require(_0xc53c('0x5'))(_0xc53c('0x6'));var config=require(_0xc53c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc53c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x213ac8,_0x210a99,_0x365f98){return new BPromise(function(_0x75ed07,_0x100180){return client[_0xc53c('0x9')](_0x213ac8,_0x365f98)[_0xc53c('0xa')](function(_0xc07a05){logger[_0xc53c('0xb')](_0xc53c('0xc'),_0x210a99,_0xc53c('0xd'));logger[_0xc53c('0xe')](_0xc53c('0xf'),_0x210a99,'request\x20sent',JSON[_0xc53c('0x10')](_0xc07a05));if(_0xc07a05[_0xc53c('0x11')]){if(_0xc07a05[_0xc53c('0x11')][_0xc53c('0x12')]===0x1f4){logger[_0xc53c('0x11')]('SquareMessage,\x20%s,\x20%s',_0x210a99,_0xc07a05[_0xc53c('0x11')][_0xc53c('0x13')]);return _0x100180(_0xc07a05['error'][_0xc53c('0x13')]);}logger[_0xc53c('0x11')](_0xc53c('0xc'),_0x210a99,_0xc07a05[_0xc53c('0x11')][_0xc53c('0x13')]);return _0x75ed07(_0xc07a05[_0xc53c('0x11')][_0xc53c('0x13')]);}else{logger[_0xc53c('0xb')](_0xc53c('0xc'),_0x210a99,'request\x20sent');_0x75ed07(_0xc07a05[_0xc53c('0x14')]['message']);}})['catch'](function(_0x2de6a5){logger[_0xc53c('0x11')](_0xc53c('0xc'),_0x210a99,_0x2de6a5);_0x100180(_0x2de6a5);});});}exports[_0xc53c('0x15')]=function(_0x12b49c){var _0xef3367=this;return new Promise(function(_0x7a6800,_0x14f260){return db[_0xc53c('0x16')][_0xc53c('0x17')](_0x12b49c[_0xc53c('0x18')],{'raw':_0x12b49c['options']?_0x12b49c[_0xc53c('0x19')][_0xc53c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xe5a3bd){logger[_0xc53c('0xb')]('CreateSquareMessage',_0x12b49c);logger[_0xc53c('0xe')](_0xc53c('0x15'),_0x12b49c,JSON['stringify'](_0xe5a3bd));_0x7a6800(_0xe5a3bd);})[_0xc53c('0x1b')](function(_0x330727){logger['error'](_0xc53c('0x15'),_0x330727[_0xc53c('0x13')],_0x12b49c);_0x14f260(_0xef3367['error'](0x1f4,_0x330727['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f664a9c..5ea2e73 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 _0x7925=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7925,0x74));var _0x5792=function(_0x35a97d,_0x307fbc){_0x35a97d=_0x35a97d-0x0;var _0x4d5641=_0x7925[_0x35a97d];return _0x4d5641;};'use strict';var multer=require(_0x5792('0x0'));var util=require(_0x5792('0x1'));var path=require('path');var timeout=require(_0x5792('0x2'));var express=require(_0x5792('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5792('0x4'));var interaction=require(_0x5792('0x5'));var config=require(_0x5792('0x6'));var controller=require(_0x5792('0x7'));router[_0x5792('0x8')]('/',auth[_0x5792('0x9')](),controller[_0x5792('0xa')]);router[_0x5792('0x8')](_0x5792('0xb'),auth[_0x5792('0x9')](),controller[_0x5792('0xc')]);router['get'](_0x5792('0xd'),auth[_0x5792('0x9')](),timeout(_0x5792('0xe')),controller['test']);router[_0x5792('0xf')]('/',auth[_0x5792('0x9')](),controller[_0x5792('0x10')]);router[_0x5792('0x11')](_0x5792('0xb'),auth[_0x5792('0x9')](),controller[_0x5792('0x12')]);router[_0x5792('0x13')](_0x5792('0xb'),auth['isAuthenticated'](),controller[_0x5792('0x14')]);module[_0x5792('0x15')]=router; \ No newline at end of file +var _0xa780=['15s','test','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xa780,0x17e));var _0x0a78=function(_0x357e43,_0x3320b9){_0x357e43=_0x357e43-0x0;var _0x15e14c=_0xa780[_0x357e43];return _0x15e14c;};'use strict';var multer=require(_0x0a78('0x0'));var util=require(_0x0a78('0x1'));var path=require(_0x0a78('0x2'));var timeout=require(_0x0a78('0x3'));var express=require('express');var router=express[_0x0a78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a78('0x5'));var interaction=require(_0x0a78('0x6'));var config=require(_0x0a78('0x7'));var controller=require(_0x0a78('0x8'));router[_0x0a78('0x9')]('/',auth[_0x0a78('0xa')](),controller[_0x0a78('0xb')]);router[_0x0a78('0x9')](_0x0a78('0xc'),auth[_0x0a78('0xa')](),controller['show']);router[_0x0a78('0x9')](_0x0a78('0xd'),auth['isAuthenticated'](),timeout(_0x0a78('0xe')),controller[_0x0a78('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a78('0x10')]);router[_0x0a78('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0a78('0x12')]);router[_0x0a78('0x13')]('/:id',auth[_0x0a78('0xa')](),controller[_0x0a78('0x14')]);module[_0x0a78('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index dd804f4..8daa155 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 _0x1c54=['name','sequelize','STRING'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x1c54,0x199));var _0x41c5=function(_0x70397e,_0x4362f6){_0x70397e=_0x70397e-0x0;var _0x5617bb=_0x1c54[_0x70397e];return _0x5617bb;};'use strict';var Sequelize=require(_0x41c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x41c5('0x1')],'unique':_0x41c5('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x41c5('0x1')]}}; \ No newline at end of file +var _0x4ad3=['exports','STRING','name'];(function(_0x51de43,_0x36b6cb){var _0xdc363e=function(_0x2725b9){while(--_0x2725b9){_0x51de43['push'](_0x51de43['shift']());}};_0xdc363e(++_0x36b6cb);}(_0x4ad3,0x141));var _0x34ad=function(_0x21c69c,_0x1b7535){_0x21c69c=_0x21c69c-0x0;var _0x2acd03=_0x4ad3[_0x21c69c];return _0x2acd03;};'use strict';var Sequelize=require('sequelize');module[_0x34ad('0x0')]={'name':{'type':Sequelize[_0x34ad('0x1')],'unique':_0x34ad('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x34ad('0x1')]},'description':{'type':Sequelize[_0x34ad('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 18b79c4..2928ff4 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 _0x5e1b=['openSync','dsn','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','error','stack','name','SquareOdbc','rawAttributes','fieldName','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5e1b,0xa8));var _0xb5e1=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x5e1b[_0x2c5340];return _0x3c505e;};'use strict';var emlformat=require(_0xb5e1('0x0'));var rimraf=require(_0xb5e1('0x1'));var zipdir=require(_0xb5e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5e1('0x3'));var moment=require(_0xb5e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5e1('0x5'));var util=require('util');var path=require(_0xb5e1('0x6'));var sox=require(_0xb5e1('0x7'));var csv=require(_0xb5e1('0x8'));var ejs=require(_0xb5e1('0x9'));var fs=require('fs');var fs_extra=require(_0xb5e1('0xa'));var _=require(_0xb5e1('0xb'));var squel=require('squel');var crypto=require(_0xb5e1('0xc'));var jsforce=require(_0xb5e1('0xd'));var deskjs=require(_0xb5e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb5e1('0xf'));var Papa=require('papaparse');var Redis=require(_0xb5e1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb5e1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5e1('0x12'))('api');var utils=require(_0xb5e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb5e1('0x14'));var db=require(_0xb5e1('0x15'))['db'];function respondWithStatusCode(_0x3a12dd,_0x2dc38c){_0x2dc38c=_0x2dc38c||0xcc;return function(_0x3e22ac){if(_0x3e22ac){return _0x3a12dd[_0xb5e1('0x16')](_0x2dc38c);}return _0x3a12dd['status'](_0x2dc38c)[_0xb5e1('0x17')]();};}function respondWithResult(_0x146b36,_0x9a070f){_0x9a070f=_0x9a070f||0xc8;return function(_0x285a05){if(_0x285a05){return _0x146b36['status'](_0x9a070f)[_0xb5e1('0x18')](_0x285a05);}};}function respondWithFilteredResult(_0xc689b4,_0x5ee2ae){return function(_0x532793){if(_0x532793){var _0x27d990=typeof _0x5ee2ae['offset']==='undefined'&&typeof _0x5ee2ae[_0xb5e1('0x19')]===_0xb5e1('0x1a');var _0x15f8cd=_0x532793['count'];var _0x5d3951=_0x27d990?0x0:_0x5ee2ae['offset'];var _0x2bcc5f=_0x27d990?_0x532793[_0xb5e1('0x1b')]:_0x5ee2ae['offset']+_0x5ee2ae[_0xb5e1('0x19')];var _0x101aa1;if(_0x2bcc5f>=_0x15f8cd){_0x2bcc5f=_0x15f8cd;_0x101aa1=0xc8;}else{_0x101aa1=0xce;}_0xc689b4[_0xb5e1('0x1c')](_0x101aa1);return _0xc689b4[_0xb5e1('0x1d')](_0xb5e1('0x1e'),_0x5d3951+'-'+_0x2bcc5f+'/'+_0x15f8cd)[_0xb5e1('0x18')](_0x532793);}return null;};}function patchUpdates(_0x556892){return function(_0xa1917f){try{jsonpatch[_0xb5e1('0x1f')](_0xa1917f,_0x556892,!![]);}catch(_0xf927d4){return BPromise[_0xb5e1('0x20')](_0xf927d4);}return _0xa1917f[_0xb5e1('0x21')]();};}function saveUpdates(_0x5bbc07,_0x4058e4){return function(_0x174d11){if(_0x174d11){return _0x174d11[_0xb5e1('0x22')](_0x5bbc07)[_0xb5e1('0x23')](function(_0x1d3d37){return _0x1d3d37;});}return null;};}function removeEntity(_0x77241f,_0x4ff6df){return function(_0x317308){if(_0x317308){return _0x317308[_0xb5e1('0x24')]()[_0xb5e1('0x23')](function(){var _0x2224b9=_0x317308[_0xb5e1('0x25')]({'plain':!![]});var _0x4eda47=_0xb5e1('0x26');return db['UserProfileResource'][_0xb5e1('0x24')]({'where':{'type':_0x4eda47,'resourceId':_0x2224b9['id']}})[_0xb5e1('0x23')](function(){return _0x317308;});})['then'](function(){_0x77241f['status'](0xcc)[_0xb5e1('0x17')]();});}};}function handleEntityNotFound(_0x4adde2,_0x2ba2ce){return function(_0x3bb321){if(!_0x3bb321){_0x4adde2[_0xb5e1('0x16')](0x194);}return _0x3bb321;};}function handleError(_0x305142,_0x531ae1){_0x531ae1=_0x531ae1||0x1f4;return function(_0x42febf){logger[_0xb5e1('0x27')](_0x42febf[_0xb5e1('0x28')]);if(_0x42febf[_0xb5e1('0x29')]){delete _0x42febf['name'];}_0x305142[_0xb5e1('0x1c')](_0x531ae1)['send'](_0x42febf);};}exports['index']=function(_0x1c0e0b,_0x8962ba){var _0x29b5d7={},_0x3a19d6={},_0x4fd3fb={'count':0x0,'rows':[]};var _0x2be851=_['map'](db[_0xb5e1('0x2a')][_0xb5e1('0x2b')],function(_0x19fb10){return{'name':_0x19fb10[_0xb5e1('0x2c')],'type':_0x19fb10['type']['key']};});_0x3a19d6[_0xb5e1('0x2d')]=_[_0xb5e1('0x2e')](_0x2be851,'name');_0x3a19d6['query']=_[_0xb5e1('0x2f')](_0x1c0e0b[_0xb5e1('0x30')]);_0x3a19d6['filters']=_[_0xb5e1('0x31')](_0x3a19d6[_0xb5e1('0x2d')],_0x3a19d6[_0xb5e1('0x30')]);_0x29b5d7[_0xb5e1('0x32')]=_['intersection'](_0x3a19d6[_0xb5e1('0x2d')],qs['fields'](_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x33')]));_0x29b5d7[_0xb5e1('0x32')]=_0x29b5d7['attributes']['length']?_0x29b5d7[_0xb5e1('0x32')]:_0x3a19d6[_0xb5e1('0x2d')];if(!_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x34')](_0xb5e1('0x35'))){_0x29b5d7['limit']=qs[_0xb5e1('0x19')](_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x19')]);_0x29b5d7[_0xb5e1('0x36')]=qs['offset'](_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x36')]);}_0x29b5d7['order']=qs['sort'](_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x37')]);_0x29b5d7[_0xb5e1('0x38')]=qs[_0xb5e1('0x39')](_[_0xb5e1('0x3a')](_0x1c0e0b[_0xb5e1('0x30')],_0x3a19d6[_0xb5e1('0x39')]),_0x2be851);if(_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x3b')]){_0x29b5d7[_0xb5e1('0x38')]=_[_0xb5e1('0x3c')](_0x29b5d7[_0xb5e1('0x38')],{'$or':_['map'](_0x2be851,function(_0x13e55d){if(_0x13e55d[_0xb5e1('0x3d')]!=='VIRTUAL'){var _0x1fa56a={};_0x1fa56a[_0x13e55d[_0xb5e1('0x29')]]={'$like':'%'+_0x1c0e0b[_0xb5e1('0x30')][_0xb5e1('0x3b')]+'%'};return _0x1fa56a;}})});}_0x29b5d7=_['merge']({},_0x29b5d7,_0x1c0e0b[_0xb5e1('0x3e')]);var _0x549ba2={'where':_0x29b5d7['where']};return db[_0xb5e1('0x2a')][_0xb5e1('0x1b')](_0x549ba2)[_0xb5e1('0x23')](function(_0x5b55dd){_0x4fd3fb[_0xb5e1('0x1b')]=_0x5b55dd;if(_0x1c0e0b['query'][_0xb5e1('0x3f')]){_0x29b5d7[_0xb5e1('0x40')]=[{'all':!![]}];}return db[_0xb5e1('0x2a')][_0xb5e1('0x41')](_0x29b5d7);})[_0xb5e1('0x23')](function(_0xd28d00){_0x4fd3fb[_0xb5e1('0x42')]=_0xd28d00;return _0x4fd3fb;})[_0xb5e1('0x23')](respondWithFilteredResult(_0x8962ba,_0x29b5d7))[_0xb5e1('0x43')](handleError(_0x8962ba,null));};exports[_0xb5e1('0x44')]=function(_0x26d959,_0x2387db){var _0x8ba8ce={'raw':!![],'where':{'id':_0x26d959[_0xb5e1('0x45')]['id']}},_0x1a270e={};_0x1a270e[_0xb5e1('0x2d')]=_[_0xb5e1('0x2f')](db[_0xb5e1('0x2a')][_0xb5e1('0x2b')]);_0x1a270e['query']=_[_0xb5e1('0x2f')](_0x26d959[_0xb5e1('0x30')]);_0x1a270e[_0xb5e1('0x39')]=_['intersection'](_0x1a270e['model'],_0x1a270e[_0xb5e1('0x30')]);_0x8ba8ce['attributes']=_[_0xb5e1('0x31')](_0x1a270e[_0xb5e1('0x2d')],qs[_0xb5e1('0x33')](_0x26d959['query'][_0xb5e1('0x33')]));_0x8ba8ce[_0xb5e1('0x32')]=_0x8ba8ce[_0xb5e1('0x32')][_0xb5e1('0x46')]?_0x8ba8ce['attributes']:_0x1a270e[_0xb5e1('0x2d')];if(_0x26d959[_0xb5e1('0x30')][_0xb5e1('0x3f')]){_0x8ba8ce[_0xb5e1('0x40')]=[{'all':!![]}];}_0x8ba8ce=_['merge']({},_0x8ba8ce,_0x26d959[_0xb5e1('0x3e')]);return db[_0xb5e1('0x2a')]['find'](_0x8ba8ce)['then'](handleEntityNotFound(_0x2387db,null))[_0xb5e1('0x23')](respondWithResult(_0x2387db,null))[_0xb5e1('0x43')](handleError(_0x2387db,null));};exports['create']=function(_0x2e7266,_0x2fbe03){return db['SquareOdbc']['create'](_0x2e7266[_0xb5e1('0x47')],{})[_0xb5e1('0x23')](function(_0x246e75){var _0x57ef74=_0x2e7266['user'][_0xb5e1('0x25')]({'plain':!![]});if(!_0x57ef74)throw new Error(_0xb5e1('0x48'));if(_0x57ef74[_0xb5e1('0x49')]===_0xb5e1('0x4a')){var _0x5708c2=_0x246e75[_0xb5e1('0x25')]({'plain':!![]});var _0x18f5b8=_0xb5e1('0x26');return db['UserProfileSection'][_0xb5e1('0x4b')]({'where':{'name':_0x18f5b8,'userProfileId':_0x57ef74['userProfileId']},'raw':!![]})[_0xb5e1('0x23')](function(_0x2869c8){if(_0x2869c8&&_0x2869c8['autoAssociation']===0x0){return db[_0xb5e1('0x4c')][_0xb5e1('0x4d')]({'name':_0x5708c2['name'],'resourceId':_0x5708c2['id'],'type':_0x2869c8[_0xb5e1('0x29')],'sectionId':_0x2869c8['id']},{})[_0xb5e1('0x23')](function(){return _0x246e75;});}else{return _0x246e75;}})[_0xb5e1('0x43')](function(_0x5ca050){logger[_0xb5e1('0x27')](_0xb5e1('0x4e'),_0x5ca050);throw _0x5ca050;});}return _0x246e75;})[_0xb5e1('0x23')](respondWithResult(_0x2fbe03,0xc9))[_0xb5e1('0x43')](handleError(_0x2fbe03,null));};exports[_0xb5e1('0x22')]=function(_0x34ea3b,_0x444cd4){if(_0x34ea3b['body']['id']){delete _0x34ea3b[_0xb5e1('0x47')]['id'];}return db[_0xb5e1('0x2a')][_0xb5e1('0x4b')]({'where':{'id':_0x34ea3b[_0xb5e1('0x45')]['id']}})[_0xb5e1('0x23')](handleEntityNotFound(_0x444cd4,null))['then'](saveUpdates(_0x34ea3b[_0xb5e1('0x47')],null))[_0xb5e1('0x23')](respondWithResult(_0x444cd4,null))[_0xb5e1('0x43')](handleError(_0x444cd4,null));};exports[_0xb5e1('0x24')]=function(_0x502bba,_0x5d32ee){return db[_0xb5e1('0x2a')][_0xb5e1('0x4b')]({'where':{'id':_0x502bba[_0xb5e1('0x45')]['id']}})[_0xb5e1('0x23')](handleEntityNotFound(_0x5d32ee,null))['then'](removeEntity(_0x5d32ee,null))[_0xb5e1('0x43')](handleError(_0x5d32ee,null));};exports[_0xb5e1('0x4f')]=function(_0x3e784c,_0x1975c1,_0x3eb9ec){var _0x4aa75b;return db[_0xb5e1('0x2a')][_0xb5e1('0x4b')]({'where':{'id':_0x3e784c[_0xb5e1('0x45')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x1975c1,null))[_0xb5e1('0x23')](function(_0xd35f53){if(_0xd35f53){var _0x1f3ff9=require(_0xb5e1('0x50'))();_0x1f3ff9[_0xb5e1('0x51')](_0xd35f53[_0xb5e1('0x52')]);_0x1f3ff9['closeSync']();return _0xd35f53;}})[_0xb5e1('0x23')](respondWithResult(_0x1975c1,null))[_0xb5e1('0x43')](handleError(_0x1975c1,null));}; \ No newline at end of file +var _0x6cdf=['undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x775ff4,_0x14d00f){var _0x2e6abe=function(_0x5ad039){while(--_0x5ad039){_0x775ff4['push'](_0x775ff4['shift']());}};_0x2e6abe(++_0x14d00f);}(_0x6cdf,0x196));var _0xf6cd=function(_0x74f52,_0x15fb1d){_0x74f52=_0x74f52-0x0;var _0x2d5b52=_0x6cdf[_0x74f52];return _0x2d5b52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6cd('0x1'));var rp=require(_0xf6cd('0x2'));var moment=require(_0xf6cd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6cd('0x4'));var path=require(_0xf6cd('0x5'));var sox=require(_0xf6cd('0x6'));var csv=require(_0xf6cd('0x7'));var ejs=require(_0xf6cd('0x8'));var fs=require('fs');var fs_extra=require(_0xf6cd('0x9'));var _=require(_0xf6cd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf6cd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6cd('0x7'));var querystring=require(_0xf6cd('0xc'));var Papa=require(_0xf6cd('0xd'));var Redis=require('ioredis');var authService=require(_0xf6cd('0xe'));var qs=require(_0xf6cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6cd('0x10'));var logger=require('../../config/logger')(_0xf6cd('0x11'));var utils=require('../../config/utils');var config=require(_0xf6cd('0x12'));var licenseUtil=require(_0xf6cd('0x13'));var db=require(_0xf6cd('0x14'))['db'];function respondWithStatusCode(_0x5083b9,_0xc92582){_0xc92582=_0xc92582||0xcc;return function(_0x36d5ba){if(_0x36d5ba){return _0x5083b9['sendStatus'](_0xc92582);}return _0x5083b9[_0xf6cd('0x15')](_0xc92582)['end']();};}function respondWithResult(_0x3b3289,_0x3d419c){_0x3d419c=_0x3d419c||0xc8;return function(_0x23cfb1){if(_0x23cfb1){return _0x3b3289[_0xf6cd('0x15')](_0x3d419c)[_0xf6cd('0x16')](_0x23cfb1);}};}function respondWithFilteredResult(_0x4aa904,_0x1802df){return function(_0x522d8d){if(_0x522d8d){var _0x1d649d=typeof _0x1802df[_0xf6cd('0x17')]===_0xf6cd('0x18')&&typeof _0x1802df[_0xf6cd('0x19')]===_0xf6cd('0x18');var _0x395e0f=_0x522d8d[_0xf6cd('0x1a')];var _0x2a780c=_0x1d649d?0x0:_0x1802df['offset'];var _0x3f6b04=_0x1d649d?_0x522d8d[_0xf6cd('0x1a')]:_0x1802df['offset']+_0x1802df['limit'];var _0x53b87e;if(_0x3f6b04>=_0x395e0f){_0x3f6b04=_0x395e0f;_0x53b87e=0xc8;}else{_0x53b87e=0xce;}_0x4aa904[_0xf6cd('0x15')](_0x53b87e);return _0x4aa904[_0xf6cd('0x1b')](_0xf6cd('0x1c'),_0x2a780c+'-'+_0x3f6b04+'/'+_0x395e0f)[_0xf6cd('0x16')](_0x522d8d);}return null;};}function patchUpdates(_0xa99995){return function(_0x5a3f45){try{jsonpatch[_0xf6cd('0x1d')](_0x5a3f45,_0xa99995,!![]);}catch(_0x4efac7){return BPromise[_0xf6cd('0x1e')](_0x4efac7);}return _0x5a3f45['save']();};}function saveUpdates(_0x300b1e,_0x52fde8){return function(_0x4a4212){if(_0x4a4212){return _0x4a4212['update'](_0x300b1e)[_0xf6cd('0x1f')](function(_0x40e351){return _0x40e351;});}return null;};}function removeEntity(_0x146cb1,_0x14f051){return function(_0x33fa16){if(_0x33fa16){return _0x33fa16[_0xf6cd('0x20')]()[_0xf6cd('0x1f')](function(){var _0x56d701=_0x33fa16[_0xf6cd('0x21')]({'plain':!![]});var _0x17c7a2=_0xf6cd('0x22');return db[_0xf6cd('0x23')]['destroy']({'where':{'type':_0x17c7a2,'resourceId':_0x56d701['id']}})['then'](function(){return _0x33fa16;});})[_0xf6cd('0x1f')](function(){_0x146cb1[_0xf6cd('0x15')](0xcc)[_0xf6cd('0x24')]();});}};}function handleEntityNotFound(_0x4b3d00,_0x17e6e9){return function(_0x17db06){if(!_0x17db06){_0x4b3d00['sendStatus'](0x194);}return _0x17db06;};}function handleError(_0x5c6607,_0x1e8036){_0x1e8036=_0x1e8036||0x1f4;return function(_0xb9753){logger[_0xf6cd('0x25')](_0xb9753[_0xf6cd('0x26')]);if(_0xb9753[_0xf6cd('0x27')]){delete _0xb9753[_0xf6cd('0x27')];}_0x5c6607['status'](_0x1e8036)[_0xf6cd('0x28')](_0xb9753);};}exports[_0xf6cd('0x29')]=function(_0x4e7c06,_0x27b73f){var _0x4605d7={},_0x134318={},_0x363653={'count':0x0,'rows':[]};var _0x3cecbd=_[_0xf6cd('0x2a')](db[_0xf6cd('0x2b')][_0xf6cd('0x2c')],function(_0x11796e){return{'name':_0x11796e[_0xf6cd('0x2d')],'type':_0x11796e['type'][_0xf6cd('0x2e')]};});_0x134318[_0xf6cd('0x2f')]=_[_0xf6cd('0x2a')](_0x3cecbd,'name');_0x134318[_0xf6cd('0x30')]=_[_0xf6cd('0x31')](_0x4e7c06['query']);_0x134318[_0xf6cd('0x32')]=_['intersection'](_0x134318[_0xf6cd('0x2f')],_0x134318[_0xf6cd('0x30')]);_0x4605d7[_0xf6cd('0x33')]=_[_0xf6cd('0x34')](_0x134318[_0xf6cd('0x2f')],qs[_0xf6cd('0x35')](_0x4e7c06[_0xf6cd('0x30')][_0xf6cd('0x35')]));_0x4605d7[_0xf6cd('0x33')]=_0x4605d7[_0xf6cd('0x33')][_0xf6cd('0x36')]?_0x4605d7[_0xf6cd('0x33')]:_0x134318[_0xf6cd('0x2f')];if(!_0x4e7c06[_0xf6cd('0x30')][_0xf6cd('0x37')](_0xf6cd('0x38'))){_0x4605d7['limit']=qs[_0xf6cd('0x19')](_0x4e7c06[_0xf6cd('0x30')][_0xf6cd('0x19')]);_0x4605d7[_0xf6cd('0x17')]=qs[_0xf6cd('0x17')](_0x4e7c06['query'][_0xf6cd('0x17')]);}_0x4605d7[_0xf6cd('0x39')]=qs['sort'](_0x4e7c06[_0xf6cd('0x30')][_0xf6cd('0x3a')]);_0x4605d7[_0xf6cd('0x3b')]=qs[_0xf6cd('0x32')](_[_0xf6cd('0x3c')](_0x4e7c06[_0xf6cd('0x30')],_0x134318[_0xf6cd('0x32')]),_0x3cecbd);if(_0x4e7c06[_0xf6cd('0x30')][_0xf6cd('0x3d')]){_0x4605d7[_0xf6cd('0x3b')]=_[_0xf6cd('0x3e')](_0x4605d7[_0xf6cd('0x3b')],{'$or':_[_0xf6cd('0x2a')](_0x3cecbd,function(_0x1c73b7){if(_0x1c73b7[_0xf6cd('0x3f')]!==_0xf6cd('0x40')){var _0x55546e={};_0x55546e[_0x1c73b7[_0xf6cd('0x27')]]={'$like':'%'+_0x4e7c06['query'][_0xf6cd('0x3d')]+'%'};return _0x55546e;}})});}_0x4605d7=_[_0xf6cd('0x3e')]({},_0x4605d7,_0x4e7c06[_0xf6cd('0x41')]);var _0x279756={'where':_0x4605d7[_0xf6cd('0x3b')]};return db[_0xf6cd('0x2b')][_0xf6cd('0x1a')](_0x279756)[_0xf6cd('0x1f')](function(_0x5ab520){_0x363653[_0xf6cd('0x1a')]=_0x5ab520;if(_0x4e7c06[_0xf6cd('0x30')]['includeAll']){_0x4605d7['include']=[{'all':!![]}];}return db[_0xf6cd('0x2b')]['findAll'](_0x4605d7);})['then'](function(_0x2e3a15){_0x363653['rows']=_0x2e3a15;return _0x363653;})[_0xf6cd('0x1f')](respondWithFilteredResult(_0x27b73f,_0x4605d7))[_0xf6cd('0x42')](handleError(_0x27b73f,null));};exports[_0xf6cd('0x43')]=function(_0x5400e8,_0x238c48){var _0x3000c3={'raw':!![],'where':{'id':_0x5400e8[_0xf6cd('0x44')]['id']}},_0x26cec3={};_0x26cec3[_0xf6cd('0x2f')]=_['keys'](db['SquareOdbc'][_0xf6cd('0x2c')]);_0x26cec3['query']=_[_0xf6cd('0x31')](_0x5400e8[_0xf6cd('0x30')]);_0x26cec3[_0xf6cd('0x32')]=_[_0xf6cd('0x34')](_0x26cec3[_0xf6cd('0x2f')],_0x26cec3[_0xf6cd('0x30')]);_0x3000c3[_0xf6cd('0x33')]=_[_0xf6cd('0x34')](_0x26cec3[_0xf6cd('0x2f')],qs[_0xf6cd('0x35')](_0x5400e8[_0xf6cd('0x30')][_0xf6cd('0x35')]));_0x3000c3[_0xf6cd('0x33')]=_0x3000c3[_0xf6cd('0x33')][_0xf6cd('0x36')]?_0x3000c3[_0xf6cd('0x33')]:_0x26cec3[_0xf6cd('0x2f')];if(_0x5400e8[_0xf6cd('0x30')]['includeAll']){_0x3000c3[_0xf6cd('0x45')]=[{'all':!![]}];}_0x3000c3=_[_0xf6cd('0x3e')]({},_0x3000c3,_0x5400e8[_0xf6cd('0x41')]);return db[_0xf6cd('0x2b')][_0xf6cd('0x46')](_0x3000c3)[_0xf6cd('0x1f')](handleEntityNotFound(_0x238c48,null))[_0xf6cd('0x1f')](respondWithResult(_0x238c48,null))['catch'](handleError(_0x238c48,null));};exports[_0xf6cd('0x47')]=function(_0x262ece,_0x4795b8){return db['SquareOdbc'][_0xf6cd('0x47')](_0x262ece['body'],{})[_0xf6cd('0x1f')](function(_0x340154){var _0x5c2d4e=_0x262ece['user'][_0xf6cd('0x21')]({'plain':!![]});if(!_0x5c2d4e)throw new Error(_0xf6cd('0x48'));if(_0x5c2d4e[_0xf6cd('0x49')]===_0xf6cd('0x4a')){var _0x4ce30f=_0x340154[_0xf6cd('0x21')]({'plain':!![]});var _0x181eb3='ODBC';return db[_0xf6cd('0x4b')][_0xf6cd('0x46')]({'where':{'name':_0x181eb3,'userProfileId':_0x5c2d4e[_0xf6cd('0x4c')]},'raw':!![]})['then'](function(_0x2d1a5d){if(_0x2d1a5d&&_0x2d1a5d[_0xf6cd('0x4d')]===0x0){return db[_0xf6cd('0x23')][_0xf6cd('0x47')]({'name':_0x4ce30f['name'],'resourceId':_0x4ce30f['id'],'type':_0x2d1a5d[_0xf6cd('0x27')],'sectionId':_0x2d1a5d['id']},{})['then'](function(){return _0x340154;});}else{return _0x340154;}})[_0xf6cd('0x42')](function(_0x8f7964){logger[_0xf6cd('0x25')](_0xf6cd('0x4e'),_0x8f7964);throw _0x8f7964;});}return _0x340154;})[_0xf6cd('0x1f')](respondWithResult(_0x4795b8,0xc9))[_0xf6cd('0x42')](handleError(_0x4795b8,null));};exports[_0xf6cd('0x4f')]=function(_0x44b6bf,_0x116804){if(_0x44b6bf['body']['id']){delete _0x44b6bf[_0xf6cd('0x50')]['id'];}return db['SquareOdbc'][_0xf6cd('0x46')]({'where':{'id':_0x44b6bf[_0xf6cd('0x44')]['id']}})[_0xf6cd('0x1f')](handleEntityNotFound(_0x116804,null))[_0xf6cd('0x1f')](saveUpdates(_0x44b6bf['body'],null))[_0xf6cd('0x1f')](respondWithResult(_0x116804,null))[_0xf6cd('0x42')](handleError(_0x116804,null));};exports[_0xf6cd('0x20')]=function(_0x515338,_0x70fb56){return db[_0xf6cd('0x2b')][_0xf6cd('0x46')]({'where':{'id':_0x515338[_0xf6cd('0x44')]['id']}})[_0xf6cd('0x1f')](handleEntityNotFound(_0x70fb56,null))[_0xf6cd('0x1f')](removeEntity(_0x70fb56,null))['catch'](handleError(_0x70fb56,null));};exports[_0xf6cd('0x51')]=function(_0x3bae5c,_0x5e4fc1,_0x374732){var _0xa0ce4e;return db[_0xf6cd('0x2b')]['find']({'where':{'id':_0x3bae5c[_0xf6cd('0x44')]['id']},'attributes':['id',_0xf6cd('0x52')]})['then'](handleEntityNotFound(_0x5e4fc1,null))['then'](function(_0x2c5a9d){if(_0x2c5a9d){var _0x58aef0=require(_0xf6cd('0x53'))();_0x58aef0[_0xf6cd('0x54')](_0x2c5a9d['dsn']);_0x58aef0[_0xf6cd('0x55')]();return _0x2c5a9d;}})[_0xf6cd('0x1f')](respondWithResult(_0x5e4fc1,null))[_0xf6cd('0x42')](handleError(_0x5e4fc1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c1d53d2..0c6e32a 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 _0xb1a6=['request-promise','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb1a6,0x11b));var _0x6b1a=function(_0x5ed34b,_0x12b42f){_0x5ed34b=_0x5ed34b-0x0;var _0x24e702=_0xb1a6[_0x5ed34b];return _0x24e702;};'use strict';var _=require(_0x6b1a('0x0'));var util=require(_0x6b1a('0x1'));var logger=require(_0x6b1a('0x2'))(_0x6b1a('0x3'));var moment=require(_0x6b1a('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b1a('0x6'));var config=require(_0x6b1a('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x6b1a('0x8')]=function(_0x59f49d,_0x3478ec){return _0x59f49d[_0x6b1a('0x9')](_0x6b1a('0xa'),attributes,{'tableName':_0x6b1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e88=['SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0x5e88,0xb5));var _0x85e8=function(_0x395d0f,_0x417ac8){_0x395d0f=_0x395d0f-0x0;var _0x5ad300=_0x5e88[_0x395d0f];return _0x5ad300;};'use strict';var _=require(_0x85e8('0x0'));var util=require(_0x85e8('0x1'));var logger=require(_0x85e8('0x2'))(_0x85e8('0x3'));var moment=require(_0x85e8('0x4'));var BPromise=require(_0x85e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85e8('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x85e8('0x7')]=function(_0x5871bf,_0x4355fb){return _0x5871bf[_0x85e8('0x8')](_0x85e8('0x9'),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 7a89853..0b9d30e 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 _0x7bb8=['code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','where','attributes','include','map','model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5e2f3f,_0x5a5548){var _0x4e1c22=function(_0x200e0d){while(--_0x200e0d){_0x5e2f3f['push'](_0x5e2f3f['shift']());}};_0x4e1c22(++_0x5a5548);}(_0x7bb8,0xd9));var _0x87bb=function(_0x18cd25,_0x410fb9){_0x18cd25=_0x18cd25-0x0;var _0x11696b=_0x7bb8[_0x18cd25];return _0x11696b;};'use strict';var _=require(_0x87bb('0x0'));var util=require(_0x87bb('0x1'));var moment=require('moment');var BPromise=require(_0x87bb('0x2'));var rs=require(_0x87bb('0x3'));var fs=require('fs');var Redis=require(_0x87bb('0x4'));var db=require(_0x87bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87bb('0x6'))('rpc');var config=require(_0x87bb('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b48a2,_0x410a52,_0x2fb370){return new BPromise(function(_0x44aebb,_0x43431f){return client[_0x87bb('0x8')](_0x5b48a2,_0x2fb370)['then'](function(_0x65d879){logger[_0x87bb('0x9')](_0x87bb('0xa'),_0x410a52,_0x87bb('0xb'));logger['debug'](_0x87bb('0xc'),_0x410a52,_0x87bb('0xb'),JSON[_0x87bb('0xd')](_0x65d879));if(_0x65d879[_0x87bb('0xe')]){if(_0x65d879['error'][_0x87bb('0xf')]===0x1f4){logger['error'](_0x87bb('0xa'),_0x410a52,_0x65d879[_0x87bb('0xe')]['message']);return _0x43431f(_0x65d879['error']['message']);}logger[_0x87bb('0xe')](_0x87bb('0xa'),_0x410a52,_0x65d879[_0x87bb('0xe')][_0x87bb('0x10')]);return _0x44aebb(_0x65d879['error']['message']);}else{logger[_0x87bb('0x9')](_0x87bb('0xa'),_0x410a52,_0x87bb('0xb'));_0x44aebb(_0x65d879[_0x87bb('0x11')][_0x87bb('0x10')]);}})[_0x87bb('0x12')](function(_0x13e458){logger['error'](_0x87bb('0xa'),_0x410a52,_0x13e458);_0x43431f(_0x13e458);});});}exports[_0x87bb('0x13')]=function(_0x22dd99){var _0x2c9af1=this;return new Promise(function(_0x46a426,_0x366a54){return db[_0x87bb('0x14')]['find']({'raw':_0x22dd99[_0x87bb('0x15')]?_0x22dd99[_0x87bb('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x22dd99[_0x87bb('0x15')]?_0x22dd99['options'][_0x87bb('0x16')]||null:null,'attributes':_0x22dd99[_0x87bb('0x15')]?_0x22dd99[_0x87bb('0x15')][_0x87bb('0x17')]||null:null,'include':_0x22dd99[_0x87bb('0x15')]?_0x22dd99[_0x87bb('0x15')][_0x87bb('0x18')]?_[_0x87bb('0x19')](_0x22dd99[_0x87bb('0x15')][_0x87bb('0x18')],function(_0x3f02ae){return{'model':db[_0x3f02ae[_0x87bb('0x1a')]],'as':_0x3f02ae['as'],'attributes':_0x3f02ae[_0x87bb('0x17')],'include':_0x3f02ae[_0x87bb('0x18')]?_[_0x87bb('0x19')](_0x3f02ae[_0x87bb('0x18')],function(_0x20cb82){return{'model':db[_0x20cb82[_0x87bb('0x1a')]],'as':_0x20cb82['as'],'attributes':_0x20cb82[_0x87bb('0x17')],'include':_0x20cb82['include']?_[_0x87bb('0x19')](_0x20cb82[_0x87bb('0x18')],function(_0x3df829){return{'model':db[_0x3df829[_0x87bb('0x1a')]],'as':_0x3df829['as'],'attributes':_0x3df829['attributes']};}):[]};}):[]};}):[]:[]})[_0x87bb('0x1b')](function(_0x582c1c){logger[_0x87bb('0x9')]('ShowSquareOdbc',_0x22dd99);logger[_0x87bb('0x1c')](_0x87bb('0x13'),_0x22dd99,JSON[_0x87bb('0xd')](_0x582c1c));_0x46a426(_0x582c1c);})['catch'](function(_0xc42bfb){logger[_0x87bb('0xe')](_0x87bb('0x13'),_0xc42bfb['message'],_0x22dd99);_0x366a54(_0x2c9af1[_0x87bb('0xe')](0x1f4,_0xc42bfb[_0x87bb('0x10')]));});});}; \ No newline at end of file +var _0x2952=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','message','util'];(function(_0xac54,_0xceca7c){var _0x52c85e=function(_0x7fe683){while(--_0x7fe683){_0xac54['push'](_0xac54['shift']());}};_0x52c85e(++_0xceca7c);}(_0x2952,0x1bf));var _0x2295=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2952[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x2295('0x0'));var moment=require(_0x2295('0x1'));var BPromise=require(_0x2295('0x2'));var rs=require(_0x2295('0x3'));var fs=require('fs');var Redis=require(_0x2295('0x4'));var db=require(_0x2295('0x5'))['db'];var utils=require(_0x2295('0x6'));var logger=require(_0x2295('0x7'))('rpc');var config=require(_0x2295('0x8'));var jayson=require(_0x2295('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358b69,_0x49e62e,_0x2c7ebc){return new BPromise(function(_0x272a1e,_0x4b28f7){return client['request'](_0x358b69,_0x2c7ebc)[_0x2295('0xa')](function(_0x38725b){logger[_0x2295('0xb')](_0x2295('0xc'),_0x49e62e,_0x2295('0xd'));logger[_0x2295('0xe')](_0x2295('0xf'),_0x49e62e,_0x2295('0xd'),JSON[_0x2295('0x10')](_0x38725b));if(_0x38725b['error']){if(_0x38725b[_0x2295('0x11')][_0x2295('0x12')]===0x1f4){logger[_0x2295('0x11')](_0x2295('0xc'),_0x49e62e,_0x38725b[_0x2295('0x11')]['message']);return _0x4b28f7(_0x38725b[_0x2295('0x11')]['message']);}logger[_0x2295('0x11')](_0x2295('0xc'),_0x49e62e,_0x38725b[_0x2295('0x11')]['message']);return _0x272a1e(_0x38725b[_0x2295('0x11')]['message']);}else{logger[_0x2295('0xb')](_0x2295('0xc'),_0x49e62e,_0x2295('0xd'));_0x272a1e(_0x38725b[_0x2295('0x13')]['message']);}})[_0x2295('0x14')](function(_0x3f3221){logger[_0x2295('0x11')](_0x2295('0xc'),_0x49e62e,_0x3f3221);_0x4b28f7(_0x3f3221);});});}exports[_0x2295('0x15')]=function(_0x4729ea){var _0x2d1b65=this;return new Promise(function(_0x5558b8,_0x4b92c){return db[_0x2295('0x16')][_0x2295('0x17')]({'raw':_0x4729ea[_0x2295('0x18')]?_0x4729ea['options'][_0x2295('0x19')]===undefined?!![]:![]:!![],'where':_0x4729ea[_0x2295('0x18')]?_0x4729ea[_0x2295('0x18')][_0x2295('0x1a')]||null:null,'attributes':_0x4729ea['options']?_0x4729ea['options'][_0x2295('0x1b')]||null:null,'include':_0x4729ea[_0x2295('0x18')]?_0x4729ea[_0x2295('0x18')]['include']?_['map'](_0x4729ea[_0x2295('0x18')][_0x2295('0x1c')],function(_0x296ae2){return{'model':db[_0x296ae2['model']],'as':_0x296ae2['as'],'attributes':_0x296ae2[_0x2295('0x1b')],'include':_0x296ae2[_0x2295('0x1c')]?_[_0x2295('0x1d')](_0x296ae2[_0x2295('0x1c')],function(_0x4b9be2){return{'model':db[_0x4b9be2[_0x2295('0x1e')]],'as':_0x4b9be2['as'],'attributes':_0x4b9be2[_0x2295('0x1b')],'include':_0x4b9be2['include']?_[_0x2295('0x1d')](_0x4b9be2[_0x2295('0x1c')],function(_0x349644){return{'model':db[_0x349644[_0x2295('0x1e')]],'as':_0x349644['as'],'attributes':_0x349644[_0x2295('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2295('0xa')](function(_0x3812d1){logger[_0x2295('0xb')](_0x2295('0x15'),_0x4729ea);logger[_0x2295('0xe')]('ShowSquareOdbc',_0x4729ea,JSON['stringify'](_0x3812d1));_0x5558b8(_0x3812d1);})['catch'](function(_0x12af01){logger[_0x2295('0x11')]('ShowSquareOdbc',_0x12af01[_0x2295('0x1f')],_0x4729ea);_0x4b92c(_0x2d1b65['error'](0x1f4,_0x12af01[_0x2295('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 7555b15..f38c9b5 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 _0xcdd2=['addUsers','put','delete','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','index','/:id','isAuthenticated','post','create','/:id/users'];(function(_0x2e204d,_0x29d003){var _0x49fc6c=function(_0x582280){while(--_0x582280){_0x2e204d['push'](_0x2e204d['shift']());}};_0x49fc6c(++_0x29d003);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var path=require(_0x2cdd('0x2'));var timeout=require(_0x2cdd('0x3'));var express=require('express');var router=express[_0x2cdd('0x4')]();var fs_extra=require(_0x2cdd('0x5'));var auth=require(_0x2cdd('0x6'));var interaction=require(_0x2cdd('0x7'));var config=require('../../config/environment');var controller=require(_0x2cdd('0x8'));router[_0x2cdd('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cdd('0xa')]);router[_0x2cdd('0x9')](_0x2cdd('0xb'),auth[_0x2cdd('0xc')](),controller['show']);router['get']('/:id/users',auth[_0x2cdd('0xc')](),controller['getUsers']);router[_0x2cdd('0xd')]('/',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0xe')]);router[_0x2cdd('0xd')](_0x2cdd('0xf'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x10')]);router[_0x2cdd('0x11')](_0x2cdd('0xb'),auth[_0x2cdd('0xc')](),controller['update']);router['delete'](_0x2cdd('0xb'),auth[_0x2cdd('0xc')](),controller['destroy']);router[_0x2cdd('0x12')](_0x2cdd('0xf'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x13')]);module[_0x2cdd('0x14')]=router; \ No newline at end of file +var _0x5630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1c1478,_0x456c89){var _0x1c33f1=function(_0x4a4d97){while(--_0x4a4d97){_0x1c1478['push'](_0x1c1478['shift']());}};_0x1c33f1(++_0x456c89);}(_0x5630,0xc3));var _0x0563=function(_0x51cc81,_0x1d2bf0){_0x51cc81=_0x51cc81-0x0;var _0x15972b=_0x5630[_0x51cc81];return _0x15972b;};'use strict';var multer=require(_0x0563('0x0'));var util=require(_0x0563('0x1'));var path=require(_0x0563('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0563('0x3'));var auth=require(_0x0563('0x4'));var interaction=require(_0x0563('0x5'));var config=require(_0x0563('0x6'));var controller=require(_0x0563('0x7'));router[_0x0563('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0563('0x8')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0xb')]);router['get'](_0x0563('0xc'),auth[_0x0563('0xa')](),controller[_0x0563('0xd')]);router[_0x0563('0xe')]('/',auth[_0x0563('0xa')](),controller[_0x0563('0xf')]);router[_0x0563('0xe')](_0x0563('0xc'),auth['isAuthenticated'](),controller[_0x0563('0x10')]);router[_0x0563('0x11')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0x12')]);router[_0x0563('0x13')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0x14')]);router[_0x0563('0x13')](_0x0563('0xc'),auth[_0x0563('0xa')](),controller['removeUsers']);module[_0x0563('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8e54b7a..f83c2f9 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 _0xbd3a=['toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue'];(function(_0x425917,_0x276043){var _0x48bed1=function(_0x204900){while(--_0x204900){_0x425917['push'](_0x425917['shift']());}};_0x48bed1(++_0x276043);}(_0xbd3a,0xb9));var _0xabd3=function(_0x4d6c6c,_0x48a728){_0x4d6c6c=_0x4d6c6c-0x0;var _0x17a90d=_0xbd3a[_0x4d6c6c];return _0x17a90d;};'use strict';var Sequelize=require(_0xabd3('0x0'));module[_0xabd3('0x1')]={'name':{'type':Sequelize[_0xabd3('0x2')],'unique':_0xabd3('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xabd3('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xabd3('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xabd3('0x6')]('preproduction')[_0xabd3('0x7')](_0xabd3('0x8'));}}},'production':{'type':Sequelize[_0xabd3('0x9')](_0xabd3('0x5')),'get':function(){if(this[_0xabd3('0x6')](_0xabd3('0xa'))){return this[_0xabd3('0x6')](_0xabd3('0xa'))[_0xabd3('0x7')](_0xabd3('0x8'));}}},'savedAt':{'type':Sequelize[_0xabd3('0xb')]},'publishedAt':{'type':Sequelize[_0xabd3('0xb')]}}; \ No newline at end of file +var _0xd566=['TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE','sequelize','exports','STRING','name'];(function(_0x5c1196,_0x820d51){var _0x41be95=function(_0x245219){while(--_0x245219){_0x5c1196['push'](_0x5c1196['shift']());}};_0x41be95(++_0x820d51);}(_0xd566,0x100));var _0x6d56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd566[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6d56('0x0'));module[_0x6d56('0x1')]={'name':{'type':Sequelize[_0x6d56('0x2')],'unique':_0x6d56('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6d56('0x2')]},'notes':{'type':Sequelize[_0x6d56('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x6d56('0x5')),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0x7'))){return this[_0x6d56('0x6')]('preproduction')['toString'](_0x6d56('0x8'));}}},'production':{'type':Sequelize[_0x6d56('0x9')]('long'),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0xa'))){return this[_0x6d56('0x6')](_0x6d56('0xa'))[_0x6d56('0xb')](_0x6d56('0x8'));}}},'savedAt':{'type':Sequelize[_0x6d56('0xc')]},'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 284bed8..9e416f5 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 _0xfe51=['moment','bluebird','path','sox','to-csv','ejs','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','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','SquareProjects','UserProfileResource','end','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','rows','show','params','keys','includeAll','include','find','catch','create','body','user','role','autoAssociation','addUsers','ids','omit','removeUsers','emit','getUsers','findOne','order','eml-format','rimraf','request-promise'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xfe51,0x1c4));var _0x1fe5=function(_0x33f535,_0x2a7daa){_0x33f535=_0x33f535-0x0;var _0x57e0b5=_0xfe51[_0x33f535];return _0x57e0b5;};'use strict';var emlformat=require(_0x1fe5('0x0'));var rimraf=require(_0x1fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1fe5('0x2'));var moment=require(_0x1fe5('0x3'));var BPromise=require(_0x1fe5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1fe5('0x5'));var sox=require(_0x1fe5('0x6'));var csv=require(_0x1fe5('0x7'));var ejs=require(_0x1fe5('0x8'));var fs=require('fs');var fs_extra=require(_0x1fe5('0x9'));var _=require(_0x1fe5('0xa'));var squel=require(_0x1fe5('0xb'));var crypto=require('crypto');var jsforce=require(_0x1fe5('0xc'));var deskjs=require(_0x1fe5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1fe5('0xe'));var Papa=require(_0x1fe5('0xf'));var Redis=require('ioredis');var authService=require(_0x1fe5('0x10'));var qs=require(_0x1fe5('0x11'));var as=require(_0x1fe5('0x12'));var hardwareService=require(_0x1fe5('0x13'));var logger=require(_0x1fe5('0x14'))(_0x1fe5('0x15'));var utils=require(_0x1fe5('0x16'));var config=require(_0x1fe5('0x17'));var licenseUtil=require(_0x1fe5('0x18'));var db=require(_0x1fe5('0x19'))['db'];config[_0x1fe5('0x1a')]=_[_0x1fe5('0x1b')](config[_0x1fe5('0x1a')],{'host':_0x1fe5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fe5('0x1a')]));require('./squareProject.socket')[_0x1fe5('0x1d')](socket);function respondWithStatusCode(_0x51abd0,_0x9e3fd7){_0x9e3fd7=_0x9e3fd7||0xcc;return function(_0x107891){if(_0x107891){return _0x51abd0[_0x1fe5('0x1e')](_0x9e3fd7);}return _0x51abd0[_0x1fe5('0x1f')](_0x9e3fd7)['end']();};}function respondWithResult(_0x579e84,_0x3c2f95){_0x3c2f95=_0x3c2f95||0xc8;return function(_0x9f4ab9){if(_0x9f4ab9){return _0x579e84[_0x1fe5('0x1f')](_0x3c2f95)[_0x1fe5('0x20')](_0x9f4ab9);}};}function respondWithFilteredResult(_0x2631eb,_0x3fe9c6){return function(_0xaf6e31){if(_0xaf6e31){var _0x3fc580=typeof _0x3fe9c6[_0x1fe5('0x21')]===_0x1fe5('0x22')&&typeof _0x3fe9c6[_0x1fe5('0x23')]===_0x1fe5('0x22');var _0x202098=_0xaf6e31[_0x1fe5('0x24')];var _0x217e61=_0x3fc580?0x0:_0x3fe9c6['offset'];var _0x506d3d=_0x3fc580?_0xaf6e31[_0x1fe5('0x24')]:_0x3fe9c6[_0x1fe5('0x21')]+_0x3fe9c6[_0x1fe5('0x23')];var _0xca1c35;if(_0x506d3d>=_0x202098){_0x506d3d=_0x202098;_0xca1c35=0xc8;}else{_0xca1c35=0xce;}_0x2631eb['status'](_0xca1c35);return _0x2631eb[_0x1fe5('0x25')](_0x1fe5('0x26'),_0x217e61+'-'+_0x506d3d+'/'+_0x202098)[_0x1fe5('0x20')](_0xaf6e31);}return null;};}function patchUpdates(_0x194738){return function(_0x29e310){try{jsonpatch['apply'](_0x29e310,_0x194738,!![]);}catch(_0x742457){return BPromise['reject'](_0x742457);}return _0x29e310[_0x1fe5('0x27')]();};}function saveUpdates(_0x3100fa,_0xd51a91){return function(_0x9bf4f2){if(_0x9bf4f2){return _0x9bf4f2[_0x1fe5('0x28')](_0x3100fa)[_0x1fe5('0x29')](function(_0x17336d){return _0x17336d;});}return null;};}function removeEntity(_0x1abc1d,_0x230967){return function(_0x3e8b3a){if(_0x3e8b3a){return _0x3e8b3a[_0x1fe5('0x2a')]()['then'](function(){var _0x5f3924=_0x3e8b3a['get']({'plain':!![]});var _0x5cf782=_0x1fe5('0x2b');return db[_0x1fe5('0x2c')][_0x1fe5('0x2a')]({'where':{'type':_0x5cf782,'resourceId':_0x5f3924['id']}})['then'](function(){return _0x3e8b3a;});})[_0x1fe5('0x29')](function(){_0x1abc1d[_0x1fe5('0x1f')](0xcc)[_0x1fe5('0x2d')]();});}};}function handleEntityNotFound(_0x3319cc,_0x50778c){return function(_0x2bfd05){if(!_0x2bfd05){_0x3319cc[_0x1fe5('0x1e')](0x194);}return _0x2bfd05;};}function handleError(_0x3aa311,_0x48694f){_0x48694f=_0x48694f||0x1f4;return function(_0xa6d55){logger[_0x1fe5('0x2e')](_0xa6d55[_0x1fe5('0x2f')]);if(_0xa6d55[_0x1fe5('0x30')]){delete _0xa6d55[_0x1fe5('0x30')];}_0x3aa311[_0x1fe5('0x1f')](_0x48694f)[_0x1fe5('0x31')](_0xa6d55);};}exports[_0x1fe5('0x32')]=function(_0x146548,_0x4f8b21){var _0x3d53e4={},_0x4c89c5={},_0x3e5cdd={'count':0x0,'rows':[]};var _0x3e842c=_['map'](db[_0x1fe5('0x33')][_0x1fe5('0x34')],function(_0x1a311b){return{'name':_0x1a311b[_0x1fe5('0x35')],'type':_0x1a311b['type']['key']};});_0x4c89c5['model']=_[_0x1fe5('0x36')](_0x3e842c,_0x1fe5('0x30'));_0x4c89c5[_0x1fe5('0x37')]=_['keys'](_0x146548['query']);_0x4c89c5[_0x1fe5('0x38')]=_[_0x1fe5('0x39')](_0x4c89c5[_0x1fe5('0x3a')],_0x4c89c5[_0x1fe5('0x37')]);_0x3d53e4[_0x1fe5('0x3b')]=_[_0x1fe5('0x39')](_0x4c89c5['model'],qs[_0x1fe5('0x3c')](_0x146548[_0x1fe5('0x37')]['fields']));_0x3d53e4[_0x1fe5('0x3b')]=_0x3d53e4[_0x1fe5('0x3b')][_0x1fe5('0x3d')]?_0x3d53e4['attributes']:_0x4c89c5[_0x1fe5('0x3a')];if(!_0x146548[_0x1fe5('0x37')][_0x1fe5('0x3e')]('nolimit')){_0x3d53e4[_0x1fe5('0x23')]=qs[_0x1fe5('0x23')](_0x146548[_0x1fe5('0x37')][_0x1fe5('0x23')]);_0x3d53e4[_0x1fe5('0x21')]=qs['offset'](_0x146548['query'][_0x1fe5('0x21')]);}_0x3d53e4['order']=qs[_0x1fe5('0x3f')](_0x146548[_0x1fe5('0x37')][_0x1fe5('0x3f')]);_0x3d53e4[_0x1fe5('0x40')]=qs['filters'](_[_0x1fe5('0x41')](_0x146548['query'],_0x4c89c5['filters']),_0x3e842c);if(_0x146548[_0x1fe5('0x37')][_0x1fe5('0x42')]){_0x3d53e4[_0x1fe5('0x40')]=_[_0x1fe5('0x43')](_0x3d53e4[_0x1fe5('0x40')],{'$or':_[_0x1fe5('0x36')](_0x3e842c,function(_0x4f9a05){if(_0x4f9a05[_0x1fe5('0x44')]!=='VIRTUAL'){var _0x42652d={};_0x42652d[_0x4f9a05['name']]={'$like':'%'+_0x146548[_0x1fe5('0x37')]['filter']+'%'};return _0x42652d;}})});}_0x3d53e4=_[_0x1fe5('0x43')]({},_0x3d53e4,_0x146548[_0x1fe5('0x45')]);var _0x2203be={'where':_0x3d53e4[_0x1fe5('0x40')]};return db['SquareProject'][_0x1fe5('0x24')](_0x2203be)['then'](function(_0x5c7439){_0x3e5cdd[_0x1fe5('0x24')]=_0x5c7439;if(_0x146548[_0x1fe5('0x37')]['includeAll']){_0x3d53e4['include']=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x3d53e4);})[_0x1fe5('0x29')](function(_0x27e0d3){_0x3e5cdd[_0x1fe5('0x46')]=_0x27e0d3;return _0x3e5cdd;})[_0x1fe5('0x29')](respondWithFilteredResult(_0x4f8b21,_0x3d53e4))['catch'](handleError(_0x4f8b21,null));};exports[_0x1fe5('0x47')]=function(_0xd4488b,_0x504b7e){var _0x41081a={'raw':![],'where':{'id':_0xd4488b[_0x1fe5('0x48')]['id']}},_0x56cd20={};_0x56cd20[_0x1fe5('0x3a')]=_['keys'](db[_0x1fe5('0x33')][_0x1fe5('0x34')]);_0x56cd20['query']=_[_0x1fe5('0x49')](_0xd4488b['query']);_0x56cd20[_0x1fe5('0x38')]=_[_0x1fe5('0x39')](_0x56cd20[_0x1fe5('0x3a')],_0x56cd20[_0x1fe5('0x37')]);_0x41081a[_0x1fe5('0x3b')]=_[_0x1fe5('0x39')](_0x56cd20[_0x1fe5('0x3a')],qs['fields'](_0xd4488b[_0x1fe5('0x37')][_0x1fe5('0x3c')]));_0x41081a[_0x1fe5('0x3b')]=_0x41081a['attributes']['length']?_0x41081a['attributes']:_0x56cd20[_0x1fe5('0x3a')];if(_0xd4488b['query'][_0x1fe5('0x4a')]){_0x41081a[_0x1fe5('0x4b')]=[{'all':!![]}];}_0x41081a=_[_0x1fe5('0x43')]({},_0x41081a,_0xd4488b[_0x1fe5('0x45')]);return db[_0x1fe5('0x33')][_0x1fe5('0x4c')](_0x41081a)['then'](handleEntityNotFound(_0x504b7e,null))[_0x1fe5('0x29')](respondWithResult(_0x504b7e,null))[_0x1fe5('0x4d')](handleError(_0x504b7e,null));};exports[_0x1fe5('0x4e')]=function(_0x50421b,_0x29a38b){return db['SquareProject'][_0x1fe5('0x4e')](_0x50421b[_0x1fe5('0x4f')],{})['then'](function(_0x1be56b){var _0x251498=_0x50421b[_0x1fe5('0x50')]['get']({'plain':!![]});if(!_0x251498)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251498[_0x1fe5('0x51')]===_0x1fe5('0x50')){var _0x44c8ff=_0x1be56b['get']({'plain':!![]});var _0x282f8e='SquareProjects';return db['UserProfileSection'][_0x1fe5('0x4c')]({'where':{'name':_0x282f8e,'userProfileId':_0x251498['userProfileId']},'raw':!![]})[_0x1fe5('0x29')](function(_0x1024a2){if(_0x1024a2&&_0x1024a2[_0x1fe5('0x52')]===0x0){return db[_0x1fe5('0x2c')][_0x1fe5('0x4e')]({'name':_0x44c8ff['name'],'resourceId':_0x44c8ff['id'],'type':_0x1024a2['name'],'sectionId':_0x1024a2['id']},{})[_0x1fe5('0x29')](function(){return _0x1be56b;});}else{return _0x1be56b;}})[_0x1fe5('0x4d')](function(_0x1ad62e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ad62e);throw _0x1ad62e;});}return _0x1be56b;})[_0x1fe5('0x29')](respondWithResult(_0x29a38b,0xc9))[_0x1fe5('0x4d')](handleError(_0x29a38b,null));};exports[_0x1fe5('0x28')]=function(_0x4f384c,_0x44e4f2){if(_0x4f384c[_0x1fe5('0x4f')]['id']){delete _0x4f384c['body']['id'];}return db[_0x1fe5('0x33')][_0x1fe5('0x4c')]({'where':{'id':_0x4f384c[_0x1fe5('0x48')]['id']}})['then'](handleEntityNotFound(_0x44e4f2,null))[_0x1fe5('0x29')](saveUpdates(_0x4f384c['body'],null))['then'](respondWithResult(_0x44e4f2,null))[_0x1fe5('0x4d')](handleError(_0x44e4f2,null));};exports[_0x1fe5('0x2a')]=function(_0x13d373,_0x3bb4eb){return db[_0x1fe5('0x33')]['find']({'where':{'id':_0x13d373[_0x1fe5('0x48')]['id']}})[_0x1fe5('0x29')](handleEntityNotFound(_0x3bb4eb,null))[_0x1fe5('0x29')](removeEntity(_0x3bb4eb,null))[_0x1fe5('0x4d')](handleError(_0x3bb4eb,null));};exports[_0x1fe5('0x53')]=function(_0x46f2bb,_0x30a789,_0x525880){return db[_0x1fe5('0x33')][_0x1fe5('0x4c')]({'where':{'id':_0x46f2bb[_0x1fe5('0x48')]['id']}})[_0x1fe5('0x29')](handleEntityNotFound(_0x30a789,null))[_0x1fe5('0x29')](function(_0x304de9){if(_0x304de9){return _0x304de9['addUsers'](_0x46f2bb[_0x1fe5('0x4f')][_0x1fe5('0x54')],_[_0x1fe5('0x55')](_0x46f2bb[_0x1fe5('0x4f')],[_0x1fe5('0x54'),'id'])||{});}})[_0x1fe5('0x29')](respondWithResult(_0x30a789,null))[_0x1fe5('0x4d')](handleError(_0x30a789,null));};exports[_0x1fe5('0x56')]=function(_0x482e87,_0x3eeda9,_0x343db0){return db['SquareProject'][_0x1fe5('0x4c')]({'where':{'id':_0x482e87['params']['id']}})['then'](handleEntityNotFound(_0x3eeda9,null))['then'](function(_0x48980a){if(_0x48980a){return _0x48980a[_0x1fe5('0x56')](_0x482e87['query']['ids'])[_0x1fe5('0x29')](function(){if(_['isArray'](_0x482e87[_0x1fe5('0x37')][_0x1fe5('0x54')])){for(var _0x5a3120=0x0;_0x5a3120<_0x482e87[_0x1fe5('0x37')]['ids'][_0x1fe5('0x3d')];_0x5a3120+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x482e87[_0x1fe5('0x37')][_0x1fe5('0x54')][_0x5a3120]),'SquareProjectId':Number(_0x482e87[_0x1fe5('0x48')]['id'])});}}else{socket[_0x1fe5('0x57')]('userSquareProject:remove',{'UserId':Number(_0x482e87[_0x1fe5('0x37')][_0x1fe5('0x54')]),'SquareProjectId':Number(_0x482e87[_0x1fe5('0x48')]['id'])});}});}})[_0x1fe5('0x29')](respondWithStatusCode(_0x3eeda9,null))[_0x1fe5('0x4d')](handleError(_0x3eeda9,null));};exports[_0x1fe5('0x58')]=function(_0x17c81a,_0x4e71f0,_0x1016e8){var _0x2ca8b6={};var _0x13f1df={};var _0x8c6bc5;var _0x18a1d7;return db[_0x1fe5('0x33')][_0x1fe5('0x59')]({'where':{'id':_0x17c81a['params']['id']}})[_0x1fe5('0x29')](handleEntityNotFound(_0x4e71f0,null))['then'](function(_0x44bfbd){if(_0x44bfbd){_0x8c6bc5=_0x44bfbd;_0x13f1df[_0x1fe5('0x3a')]=_['keys'](db['User'][_0x1fe5('0x34')]);_0x13f1df['query']=_[_0x1fe5('0x49')](_0x17c81a[_0x1fe5('0x37')]);_0x13f1df[_0x1fe5('0x38')]=_[_0x1fe5('0x39')](_0x13f1df[_0x1fe5('0x3a')],_0x13f1df['query']);_0x2ca8b6['attributes']=_['intersection'](_0x13f1df[_0x1fe5('0x3a')],qs[_0x1fe5('0x3c')](_0x17c81a[_0x1fe5('0x37')]['fields']));_0x2ca8b6[_0x1fe5('0x3b')]=_0x2ca8b6[_0x1fe5('0x3b')][_0x1fe5('0x3d')]?_0x2ca8b6[_0x1fe5('0x3b')]:_0x13f1df[_0x1fe5('0x3a')];_0x2ca8b6[_0x1fe5('0x5a')]=qs[_0x1fe5('0x3f')](_0x17c81a[_0x1fe5('0x37')][_0x1fe5('0x3f')]);_0x2ca8b6[_0x1fe5('0x40')]=qs[_0x1fe5('0x38')](_[_0x1fe5('0x41')](_0x17c81a[_0x1fe5('0x37')],_0x13f1df['filters']));if(_0x17c81a['query'][_0x1fe5('0x42')]){_0x2ca8b6[_0x1fe5('0x40')]=_['merge'](_0x2ca8b6['where'],{'$or':_[_0x1fe5('0x36')](_0x2ca8b6[_0x1fe5('0x3b')],function(_0x72fd50){var _0x26048e={};_0x26048e[_0x72fd50]={'$like':'%'+_0x17c81a[_0x1fe5('0x37')][_0x1fe5('0x42')]+'%'};return _0x26048e;})});}_0x2ca8b6=_['merge']({},_0x2ca8b6,_0x17c81a[_0x1fe5('0x45')]);return _0x8c6bc5[_0x1fe5('0x58')](_0x2ca8b6);}})['then'](function(_0x352e8a){if(_0x352e8a){_0x18a1d7=_0x352e8a[_0x1fe5('0x3d')];if(!_0x17c81a['query'][_0x1fe5('0x3e')]('nolimit')){_0x2ca8b6[_0x1fe5('0x23')]=qs[_0x1fe5('0x23')](_0x17c81a['query']['limit']);_0x2ca8b6[_0x1fe5('0x21')]=qs[_0x1fe5('0x21')](_0x17c81a[_0x1fe5('0x37')][_0x1fe5('0x21')]);}return _0x8c6bc5[_0x1fe5('0x58')](_0x2ca8b6);}})[_0x1fe5('0x29')](function(_0x24ff9b){if(_0x24ff9b){return _0x24ff9b?{'count':_0x18a1d7,'rows':_0x24ff9b}:null;}})[_0x1fe5('0x29')](respondWithResult(_0x4e71f0,null))[_0x1fe5('0x4d')](handleError(_0x4e71f0,null));}; \ No newline at end of file +var _0x4bc2=['body','params','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','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/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','then','get','UserProfileResource','destroy','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','SquareProject','rows','show','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xc96ce9,_0x39dab2){var _0x4f8966=function(_0x5739ef){while(--_0x5739ef){_0xc96ce9['push'](_0xc96ce9['shift']());}};_0x4f8966(++_0x39dab2);}(_0x4bc2,0x6b));var _0x24bc=function(_0x7f7634,_0x232a17){_0x7f7634=_0x7f7634-0x0;var _0x403280=_0x4bc2[_0x7f7634];return _0x403280;};'use strict';var emlformat=require(_0x24bc('0x0'));var rimraf=require(_0x24bc('0x1'));var zipdir=require(_0x24bc('0x2'));var jsonpatch=require(_0x24bc('0x3'));var rp=require(_0x24bc('0x4'));var moment=require(_0x24bc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24bc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x24bc('0x7'));var ejs=require(_0x24bc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24bc('0x9'));var squel=require(_0x24bc('0xa'));var crypto=require(_0x24bc('0xb'));var jsforce=require(_0x24bc('0xc'));var deskjs=require(_0x24bc('0xd'));var toCsv=require(_0x24bc('0x7'));var querystring=require(_0x24bc('0xe'));var Papa=require(_0x24bc('0xf'));var Redis=require(_0x24bc('0x10'));var authService=require(_0x24bc('0x11'));var qs=require(_0x24bc('0x12'));var as=require(_0x24bc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24bc('0x14'))(_0x24bc('0x15'));var utils=require(_0x24bc('0x16'));var config=require(_0x24bc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x24bc('0x18'))['db'];config['redis']=_[_0x24bc('0x19')](config[_0x24bc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x24bc('0x1b'))(new Redis(config[_0x24bc('0x1a')]));require(_0x24bc('0x1c'))[_0x24bc('0x1d')](socket);function respondWithStatusCode(_0xa56c0c,_0x563745){_0x563745=_0x563745||0xcc;return function(_0x486ae7){if(_0x486ae7){return _0xa56c0c[_0x24bc('0x1e')](_0x563745);}return _0xa56c0c[_0x24bc('0x1f')](_0x563745)[_0x24bc('0x20')]();};}function respondWithResult(_0x4a0b46,_0x32c2cf){_0x32c2cf=_0x32c2cf||0xc8;return function(_0x30a557){if(_0x30a557){return _0x4a0b46[_0x24bc('0x1f')](_0x32c2cf)[_0x24bc('0x21')](_0x30a557);}};}function respondWithFilteredResult(_0x4c50eb,_0x10cf02){return function(_0x1aaaa8){if(_0x1aaaa8){var _0x48c362=typeof _0x10cf02[_0x24bc('0x22')]===_0x24bc('0x23')&&typeof _0x10cf02[_0x24bc('0x24')]===_0x24bc('0x23');var _0x8e3e42=_0x1aaaa8['count'];var _0x1d0eaa=_0x48c362?0x0:_0x10cf02['offset'];var _0xd8d606=_0x48c362?_0x1aaaa8[_0x24bc('0x25')]:_0x10cf02[_0x24bc('0x22')]+_0x10cf02[_0x24bc('0x24')];var _0x3a95c7;if(_0xd8d606>=_0x8e3e42){_0xd8d606=_0x8e3e42;_0x3a95c7=0xc8;}else{_0x3a95c7=0xce;}_0x4c50eb[_0x24bc('0x1f')](_0x3a95c7);return _0x4c50eb['set']('Content-Range',_0x1d0eaa+'-'+_0xd8d606+'/'+_0x8e3e42)[_0x24bc('0x21')](_0x1aaaa8);}return null;};}function patchUpdates(_0x154737){return function(_0x22d6ba){try{jsonpatch[_0x24bc('0x26')](_0x22d6ba,_0x154737,!![]);}catch(_0x1a5c35){return BPromise['reject'](_0x1a5c35);}return _0x22d6ba['save']();};}function saveUpdates(_0x4b3e77,_0x3503e2){return function(_0x4d3c91){if(_0x4d3c91){return _0x4d3c91['update'](_0x4b3e77)[_0x24bc('0x27')](function(_0x190aef){return _0x190aef;});}return null;};}function removeEntity(_0x304a93,_0x41c5f1){return function(_0xbac0ff){if(_0xbac0ff){return _0xbac0ff['destroy']()['then'](function(){var _0x4507c2=_0xbac0ff[_0x24bc('0x28')]({'plain':!![]});var _0x3d4232='SquareProjects';return db[_0x24bc('0x29')][_0x24bc('0x2a')]({'where':{'type':_0x3d4232,'resourceId':_0x4507c2['id']}})[_0x24bc('0x27')](function(){return _0xbac0ff;});})[_0x24bc('0x27')](function(){_0x304a93[_0x24bc('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x447497,_0x1fcc7c){return function(_0x1b35a4){if(!_0x1b35a4){_0x447497[_0x24bc('0x1e')](0x194);}return _0x1b35a4;};}function handleError(_0x502c65,_0xad1c85){_0xad1c85=_0xad1c85||0x1f4;return function(_0x1f8a13){logger['error'](_0x1f8a13[_0x24bc('0x2b')]);if(_0x1f8a13[_0x24bc('0x2c')]){delete _0x1f8a13['name'];}_0x502c65[_0x24bc('0x1f')](_0xad1c85)[_0x24bc('0x2d')](_0x1f8a13);};}exports[_0x24bc('0x2e')]=function(_0x49324c,_0x58cae2){var _0x1151cf={},_0x18959f={},_0x6bee70={'count':0x0,'rows':[]};var _0x4815c9=_[_0x24bc('0x2f')](db['SquareProject']['rawAttributes'],function(_0x2b984b){return{'name':_0x2b984b[_0x24bc('0x30')],'type':_0x2b984b[_0x24bc('0x31')][_0x24bc('0x32')]};});_0x18959f[_0x24bc('0x33')]=_[_0x24bc('0x2f')](_0x4815c9,_0x24bc('0x2c'));_0x18959f[_0x24bc('0x34')]=_['keys'](_0x49324c['query']);_0x18959f['filters']=_[_0x24bc('0x35')](_0x18959f[_0x24bc('0x33')],_0x18959f[_0x24bc('0x34')]);_0x1151cf[_0x24bc('0x36')]=_[_0x24bc('0x35')](_0x18959f[_0x24bc('0x33')],qs[_0x24bc('0x37')](_0x49324c['query']['fields']));_0x1151cf[_0x24bc('0x36')]=_0x1151cf[_0x24bc('0x36')][_0x24bc('0x38')]?_0x1151cf[_0x24bc('0x36')]:_0x18959f[_0x24bc('0x33')];if(!_0x49324c[_0x24bc('0x34')][_0x24bc('0x39')](_0x24bc('0x3a'))){_0x1151cf[_0x24bc('0x24')]=qs[_0x24bc('0x24')](_0x49324c[_0x24bc('0x34')]['limit']);_0x1151cf[_0x24bc('0x22')]=qs[_0x24bc('0x22')](_0x49324c[_0x24bc('0x34')]['offset']);}_0x1151cf[_0x24bc('0x3b')]=qs[_0x24bc('0x3c')](_0x49324c[_0x24bc('0x34')]['sort']);_0x1151cf[_0x24bc('0x3d')]=qs[_0x24bc('0x3e')](_[_0x24bc('0x3f')](_0x49324c['query'],_0x18959f['filters']),_0x4815c9);if(_0x49324c[_0x24bc('0x34')][_0x24bc('0x40')]){_0x1151cf['where']=_[_0x24bc('0x41')](_0x1151cf[_0x24bc('0x3d')],{'$or':_['map'](_0x4815c9,function(_0x41a479){if(_0x41a479['type']!=='VIRTUAL'){var _0x348b44={};_0x348b44[_0x41a479[_0x24bc('0x2c')]]={'$like':'%'+_0x49324c[_0x24bc('0x34')]['filter']+'%'};return _0x348b44;}})});}_0x1151cf=_[_0x24bc('0x41')]({},_0x1151cf,_0x49324c[_0x24bc('0x42')]);var _0x31717d={'where':_0x1151cf['where']};return db['SquareProject']['count'](_0x31717d)['then'](function(_0x373312){_0x6bee70[_0x24bc('0x25')]=_0x373312;if(_0x49324c[_0x24bc('0x34')][_0x24bc('0x43')]){_0x1151cf[_0x24bc('0x44')]=[{'all':!![]}];}return db[_0x24bc('0x45')]['findAll'](_0x1151cf);})[_0x24bc('0x27')](function(_0x3f3839){_0x6bee70[_0x24bc('0x46')]=_0x3f3839;return _0x6bee70;})['then'](respondWithFilteredResult(_0x58cae2,_0x1151cf))['catch'](handleError(_0x58cae2,null));};exports[_0x24bc('0x47')]=function(_0x5ab268,_0x6eedb5){var _0x42b923={'raw':![],'where':{'id':_0x5ab268['params']['id']}},_0x5b3dd9={};_0x5b3dd9[_0x24bc('0x33')]=_[_0x24bc('0x48')](db[_0x24bc('0x45')][_0x24bc('0x49')]);_0x5b3dd9['query']=_[_0x24bc('0x48')](_0x5ab268['query']);_0x5b3dd9[_0x24bc('0x3e')]=_['intersection'](_0x5b3dd9[_0x24bc('0x33')],_0x5b3dd9[_0x24bc('0x34')]);_0x42b923['attributes']=_[_0x24bc('0x35')](_0x5b3dd9['model'],qs['fields'](_0x5ab268[_0x24bc('0x34')][_0x24bc('0x37')]));_0x42b923[_0x24bc('0x36')]=_0x42b923[_0x24bc('0x36')][_0x24bc('0x38')]?_0x42b923['attributes']:_0x5b3dd9['model'];if(_0x5ab268[_0x24bc('0x34')][_0x24bc('0x43')]){_0x42b923[_0x24bc('0x44')]=[{'all':!![]}];}_0x42b923=_[_0x24bc('0x41')]({},_0x42b923,_0x5ab268[_0x24bc('0x42')]);return db[_0x24bc('0x45')][_0x24bc('0x4a')](_0x42b923)['then'](handleEntityNotFound(_0x6eedb5,null))[_0x24bc('0x27')](respondWithResult(_0x6eedb5,null))['catch'](handleError(_0x6eedb5,null));};exports[_0x24bc('0x4b')]=function(_0x60e4c0,_0x50ac8d){return db[_0x24bc('0x45')][_0x24bc('0x4b')](_0x60e4c0['body'],{})[_0x24bc('0x27')](function(_0xbc71fa){var _0x33c4d4=_0x60e4c0[_0x24bc('0x4c')][_0x24bc('0x28')]({'plain':!![]});if(!_0x33c4d4)throw new Error(_0x24bc('0x4d'));if(_0x33c4d4[_0x24bc('0x4e')]==='user'){var _0x120a85=_0xbc71fa[_0x24bc('0x28')]({'plain':!![]});var _0x1c917d=_0x24bc('0x4f');return db['UserProfileSection'][_0x24bc('0x4a')]({'where':{'name':_0x1c917d,'userProfileId':_0x33c4d4[_0x24bc('0x50')]},'raw':!![]})[_0x24bc('0x27')](function(_0x3cb58b){if(_0x3cb58b&&_0x3cb58b[_0x24bc('0x51')]===0x0){return db[_0x24bc('0x29')][_0x24bc('0x4b')]({'name':_0x120a85[_0x24bc('0x2c')],'resourceId':_0x120a85['id'],'type':_0x3cb58b[_0x24bc('0x2c')],'sectionId':_0x3cb58b['id']},{})[_0x24bc('0x27')](function(){return _0xbc71fa;});}else{return _0xbc71fa;}})[_0x24bc('0x52')](function(_0x5db145){logger[_0x24bc('0x53')](_0x24bc('0x54'),_0x5db145);throw _0x5db145;});}return _0xbc71fa;})[_0x24bc('0x27')](respondWithResult(_0x50ac8d,0xc9))['catch'](handleError(_0x50ac8d,null));};exports['update']=function(_0x330ecd,_0x481689){if(_0x330ecd['body']['id']){delete _0x330ecd[_0x24bc('0x55')]['id'];}return db['SquareProject'][_0x24bc('0x4a')]({'where':{'id':_0x330ecd[_0x24bc('0x56')]['id']}})[_0x24bc('0x27')](handleEntityNotFound(_0x481689,null))[_0x24bc('0x27')](saveUpdates(_0x330ecd[_0x24bc('0x55')],null))[_0x24bc('0x27')](respondWithResult(_0x481689,null))[_0x24bc('0x52')](handleError(_0x481689,null));};exports[_0x24bc('0x2a')]=function(_0x5b0195,_0x4d0d8a){return db[_0x24bc('0x45')][_0x24bc('0x4a')]({'where':{'id':_0x5b0195[_0x24bc('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d0d8a,null))[_0x24bc('0x27')](removeEntity(_0x4d0d8a,null))[_0x24bc('0x52')](handleError(_0x4d0d8a,null));};exports[_0x24bc('0x57')]=function(_0x5adb49,_0x3b0b0d,_0x8d774d){return db[_0x24bc('0x45')][_0x24bc('0x4a')]({'where':{'id':_0x5adb49[_0x24bc('0x56')]['id']}})[_0x24bc('0x27')](handleEntityNotFound(_0x3b0b0d,null))[_0x24bc('0x27')](function(_0x427aa9){if(_0x427aa9){return _0x427aa9['addUsers'](_0x5adb49['body']['ids'],_[_0x24bc('0x58')](_0x5adb49['body'],[_0x24bc('0x59'),'id'])||{});}})['then'](respondWithResult(_0x3b0b0d,null))[_0x24bc('0x52')](handleError(_0x3b0b0d,null));};exports[_0x24bc('0x5a')]=function(_0x4a0f40,_0x23a3a9,_0x84c5a9){return db[_0x24bc('0x45')][_0x24bc('0x4a')]({'where':{'id':_0x4a0f40[_0x24bc('0x56')]['id']}})[_0x24bc('0x27')](handleEntityNotFound(_0x23a3a9,null))[_0x24bc('0x27')](function(_0x5becb7){if(_0x5becb7){return _0x5becb7[_0x24bc('0x5a')](_0x4a0f40[_0x24bc('0x34')]['ids'])['then'](function(){if(_[_0x24bc('0x5b')](_0x4a0f40[_0x24bc('0x34')][_0x24bc('0x59')])){for(var _0x1dd2d3=0x0;_0x1dd2d3<_0x4a0f40[_0x24bc('0x34')]['ids']['length'];_0x1dd2d3+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x4a0f40['query'][_0x24bc('0x59')][_0x1dd2d3]),'SquareProjectId':Number(_0x4a0f40[_0x24bc('0x56')]['id'])});}}else{socket['emit'](_0x24bc('0x5c'),{'UserId':Number(_0x4a0f40[_0x24bc('0x34')][_0x24bc('0x59')]),'SquareProjectId':Number(_0x4a0f40[_0x24bc('0x56')]['id'])});}});}})[_0x24bc('0x27')](respondWithStatusCode(_0x23a3a9,null))['catch'](handleError(_0x23a3a9,null));};exports['getUsers']=function(_0x9685cc,_0x174614,_0x4c6b82){var _0x2ecd1d={};var _0x5b3258={};var _0x2e15a7;var _0x178734;return db[_0x24bc('0x45')][_0x24bc('0x5d')]({'where':{'id':_0x9685cc[_0x24bc('0x56')]['id']}})[_0x24bc('0x27')](handleEntityNotFound(_0x174614,null))['then'](function(_0x118ac1){if(_0x118ac1){_0x2e15a7=_0x118ac1;_0x5b3258[_0x24bc('0x33')]=_[_0x24bc('0x48')](db[_0x24bc('0x5e')]['rawAttributes']);_0x5b3258[_0x24bc('0x34')]=_['keys'](_0x9685cc[_0x24bc('0x34')]);_0x5b3258[_0x24bc('0x3e')]=_['intersection'](_0x5b3258[_0x24bc('0x33')],_0x5b3258[_0x24bc('0x34')]);_0x2ecd1d['attributes']=_[_0x24bc('0x35')](_0x5b3258[_0x24bc('0x33')],qs[_0x24bc('0x37')](_0x9685cc[_0x24bc('0x34')][_0x24bc('0x37')]));_0x2ecd1d[_0x24bc('0x36')]=_0x2ecd1d['attributes'][_0x24bc('0x38')]?_0x2ecd1d[_0x24bc('0x36')]:_0x5b3258[_0x24bc('0x33')];_0x2ecd1d[_0x24bc('0x3b')]=qs[_0x24bc('0x3c')](_0x9685cc[_0x24bc('0x34')][_0x24bc('0x3c')]);_0x2ecd1d['where']=qs['filters'](_['pick'](_0x9685cc[_0x24bc('0x34')],_0x5b3258[_0x24bc('0x3e')]));if(_0x9685cc[_0x24bc('0x34')][_0x24bc('0x40')]){_0x2ecd1d['where']=_[_0x24bc('0x41')](_0x2ecd1d[_0x24bc('0x3d')],{'$or':_[_0x24bc('0x2f')](_0x2ecd1d[_0x24bc('0x36')],function(_0x6e1190){var _0x481f03={};_0x481f03[_0x6e1190]={'$like':'%'+_0x9685cc['query'][_0x24bc('0x40')]+'%'};return _0x481f03;})});}_0x2ecd1d=_[_0x24bc('0x41')]({},_0x2ecd1d,_0x9685cc[_0x24bc('0x42')]);return _0x2e15a7[_0x24bc('0x5f')](_0x2ecd1d);}})[_0x24bc('0x27')](function(_0x3df065){if(_0x3df065){_0x178734=_0x3df065[_0x24bc('0x38')];if(!_0x9685cc[_0x24bc('0x34')][_0x24bc('0x39')](_0x24bc('0x3a'))){_0x2ecd1d['limit']=qs[_0x24bc('0x24')](_0x9685cc[_0x24bc('0x34')][_0x24bc('0x24')]);_0x2ecd1d[_0x24bc('0x22')]=qs[_0x24bc('0x22')](_0x9685cc[_0x24bc('0x34')][_0x24bc('0x22')]);}return _0x2e15a7[_0x24bc('0x5f')](_0x2ecd1d);}})[_0x24bc('0x27')](function(_0x1dbbbd){if(_0x1dbbbd){return _0x1dbbbd?{'count':_0x178734,'rows':_0x1dbbbd}:null;}})['then'](respondWithResult(_0x174614,null))[_0x24bc('0x52')](handleError(_0x174614,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 199aae2..8810fe7 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 _0xd949=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x4fca6f,_0x364895){var _0x43c2a6=function(_0x4d7809){while(--_0x4d7809){_0x4fca6f['push'](_0x4fca6f['shift']());}};_0x43c2a6(++_0x364895);}(_0xd949,0x1a9));var _0x9d94=function(_0x22ba0f,_0x3ecddd){_0x22ba0f=_0x22ba0f-0x0;var _0x4db9d3=_0xd949[_0x22ba0f];return _0x4db9d3;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9d94('0x0'))['db'][_0x9d94('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9d94('0x2')](0x0);var events={'afterCreate':_0x9d94('0x3'),'afterUpdate':_0x9d94('0x4'),'afterDestroy':_0x9d94('0x5')};function emitEvent(_0x46e7bf){return function(_0x28eea1,_0x27818f,_0x1efa2a){SquareProjectEvents[_0x9d94('0x6')](_0x46e7bf+':'+_0x28eea1['id'],_0x28eea1);SquareProjectEvents[_0x9d94('0x6')](_0x46e7bf,_0x28eea1);_0x1efa2a(null);};}for(var e in events){if(events[_0x9d94('0x7')](e)){var event=events[e];SquareProject[_0x9d94('0x8')](e,emitEvent(event));}}module[_0x9d94('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x2fbe=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','update','remove','emit'];(function(_0x55d8d5,_0x193b2b){var _0x208a38=function(_0x170e93){while(--_0x170e93){_0x55d8d5['push'](_0x55d8d5['shift']());}};_0x208a38(++_0x193b2b);}(_0x2fbe,0xc9));var _0xe2fb=function(_0x34cd48,_0x384be3){_0x34cd48=_0x34cd48-0x0;var _0x2a6e73=_0x2fbe[_0x34cd48];return _0x2a6e73;};'use strict';var EventEmitter=require(_0xe2fb('0x0'));var SquareProject=require(_0xe2fb('0x1'))['db'][_0xe2fb('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2fb('0x3'),'afterDestroy':_0xe2fb('0x4')};function emitEvent(_0x5c70e9){return function(_0x31b008,_0x485561,_0x193c4c){SquareProjectEvents[_0xe2fb('0x5')](_0x5c70e9+':'+_0x31b008['id'],_0x31b008);SquareProjectEvents[_0xe2fb('0x5')](_0x5c70e9,_0x31b008);_0x193c4c(null);};}for(var e in events){if(events[_0xe2fb('0x6')](e)){var event=events[e];SquareProject[_0xe2fb('0x7')](e,emitEvent(event));}}module[_0xe2fb('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 d3117e9..ebda9ad 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 _0x67ee=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x16438c,_0x35d747){var _0x1eb905=function(_0x193e76){while(--_0x193e76){_0x16438c['push'](_0x16438c['shift']());}};_0x1eb905(++_0x35d747);}(_0x67ee,0xed));var _0xe67e=function(_0x3a0307,_0x331f73){_0x3a0307=_0x3a0307-0x0;var _0x27baaf=_0x67ee[_0x3a0307];return _0x27baaf;};'use strict';var _=require(_0xe67e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe67e('0x1'));var moment=require(_0xe67e('0x2'));var BPromise=require(_0xe67e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe67e('0x4'));var config=require(_0xe67e('0x5'));var attributes=require(_0xe67e('0x6'));module[_0xe67e('0x7')]=function(_0x41a636,_0x592135){return _0x41a636[_0xe67e('0x8')](_0xe67e('0x9'),attributes,{'tableName':_0xe67e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xafa1f1,_0x4a6f14,_0x592c31){if(_0xafa1f1[_0xe67e('0xb')](_0xe67e('0xc'))){_0xafa1f1[_0xe67e('0xd')]=moment()[_0xe67e('0xe')](_0xe67e('0xf'));}if(_0xafa1f1[_0xe67e('0xb')](_0xe67e('0x10'))){_0xafa1f1[_0xe67e('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x592c31(null,_0xafa1f1);}}});}; \ No newline at end of file +var _0x225f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment'];(function(_0x1b96ae,_0x11cd19){var _0x394985=function(_0x581c14){while(--_0x581c14){_0x1b96ae['push'](_0x1b96ae['shift']());}};_0x394985(++_0x11cd19);}(_0x225f,0x18c));var _0xf225=function(_0x352cd0,_0xef4e89){_0x352cd0=_0x352cd0-0x0;var _0x2f50e3=_0x225f[_0x352cd0];return _0x2f50e3;};'use strict';var _=require(_0xf225('0x0'));var util=require('util');var logger=require(_0xf225('0x1'))(_0xf225('0x2'));var moment=require(_0xf225('0x3'));var BPromise=require(_0xf225('0x4'));var rp=require(_0xf225('0x5'));var fs=require('fs');var path=require(_0xf225('0x6'));var rimraf=require(_0xf225('0x7'));var config=require(_0xf225('0x8'));var attributes=require(_0xf225('0x9'));module[_0xf225('0xa')]=function(_0x5db58c,_0x36ef20){return _0x5db58c[_0xf225('0xb')](_0xf225('0xc'),attributes,{'tableName':_0xf225('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50dfc2,_0x1add79,_0x18a40b){if(_0x50dfc2[_0xf225('0xe')]('preproduction')){_0x50dfc2[_0xf225('0xf')]=moment()[_0xf225('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x50dfc2[_0xf225('0xe')](_0xf225('0x11'))){_0x50dfc2[_0xf225('0x12')]=moment()[_0xf225('0x10')](_0xf225('0x13'));}_0x18a40b(null,_0x50dfc2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 98219ad..5d2c928 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 _0x2680=['ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result'];(function(_0x4a89ef,_0x13239b){var _0xcad871=function(_0x4bda5f){while(--_0x4bda5f){_0x4a89ef['push'](_0x4a89ef['shift']());}};_0xcad871(++_0x13239b);}(_0x2680,0x115));var _0x0268=function(_0x4fe1e3,_0x1ad824){_0x4fe1e3=_0x4fe1e3-0x0;var _0x2a24d9=_0x2680[_0x4fe1e3];return _0x2a24d9;};'use strict';var _=require('lodash');var util=require(_0x0268('0x0'));var moment=require('moment');var BPromise=require(_0x0268('0x1'));var rs=require(_0x0268('0x2'));var fs=require('fs');var Redis=require(_0x0268('0x3'));var db=require(_0x0268('0x4'))['db'];var utils=require(_0x0268('0x5'));var logger=require(_0x0268('0x6'))(_0x0268('0x7'));var config=require(_0x0268('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0268('0x9')][_0x0268('0xa')]({'port':0x232a});config['redis']=_[_0x0268('0xb')](config[_0x0268('0xc')],{'host':_0x0268('0xd'),'port':0x18eb});var socket=require(_0x0268('0xe'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0268('0xf')](socket);function respondWithRpcPromise(_0x6c6f7e,_0x35352f,_0x563b01){return new BPromise(function(_0x44b9b1,_0x1b8621){return client[_0x0268('0x10')](_0x6c6f7e,_0x563b01)[_0x0268('0x11')](function(_0x5d0cf9){logger[_0x0268('0x12')]('SquareProject,\x20%s,\x20%s',_0x35352f,_0x0268('0x13'));logger[_0x0268('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x35352f,'request\x20sent',JSON[_0x0268('0x15')](_0x5d0cf9));if(_0x5d0cf9[_0x0268('0x16')]){if(_0x5d0cf9[_0x0268('0x16')][_0x0268('0x17')]===0x1f4){logger[_0x0268('0x16')](_0x0268('0x18'),_0x35352f,_0x5d0cf9[_0x0268('0x16')][_0x0268('0x19')]);return _0x1b8621(_0x5d0cf9[_0x0268('0x16')][_0x0268('0x19')]);}logger[_0x0268('0x16')](_0x0268('0x18'),_0x35352f,_0x5d0cf9['error'][_0x0268('0x19')]);return _0x44b9b1(_0x5d0cf9[_0x0268('0x16')][_0x0268('0x19')]);}else{logger[_0x0268('0x12')](_0x0268('0x18'),_0x35352f,_0x0268('0x13'));_0x44b9b1(_0x5d0cf9[_0x0268('0x1a')][_0x0268('0x19')]);}})['catch'](function(_0xaa6ddb){logger[_0x0268('0x16')]('SquareProject,\x20%s,\x20%s',_0x35352f,_0xaa6ddb);_0x1b8621(_0xaa6ddb);});});}exports[_0x0268('0x1b')]=function(_0x5705b6){var _0x59a590=this;return new Promise(function(_0x10ecc0,_0x3e99ce){return db[_0x0268('0x1c')][_0x0268('0x1d')]({'raw':_0x5705b6[_0x0268('0x1e')]?_0x5705b6[_0x0268('0x1e')][_0x0268('0x1f')]===undefined?!![]:![]:!![],'where':_0x5705b6[_0x0268('0x1e')]?_0x5705b6['options'][_0x0268('0x20')]||null:null,'attributes':_0x5705b6['options']?_0x5705b6[_0x0268('0x1e')][_0x0268('0x21')]||null:null,'include':_0x5705b6[_0x0268('0x1e')]?_0x5705b6[_0x0268('0x1e')][_0x0268('0x22')]?_[_0x0268('0x23')](_0x5705b6['options'][_0x0268('0x22')],function(_0x56e088){return{'model':db[_0x56e088[_0x0268('0x24')]],'as':_0x56e088['as'],'attributes':_0x56e088['attributes'],'include':_0x56e088[_0x0268('0x22')]?_[_0x0268('0x23')](_0x56e088['include'],function(_0x46b155){return{'model':db[_0x46b155[_0x0268('0x24')]],'as':_0x46b155['as'],'attributes':_0x46b155['attributes'],'include':_0x46b155[_0x0268('0x22')]?_[_0x0268('0x23')](_0x46b155[_0x0268('0x22')],function(_0x4a94be){return{'model':db[_0x4a94be[_0x0268('0x24')]],'as':_0x4a94be['as'],'attributes':_0x4a94be[_0x0268('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0268('0x11')](function(_0x2de153){logger[_0x0268('0x12')](_0x0268('0x1b'),_0x5705b6);logger[_0x0268('0x14')](_0x0268('0x1b'),_0x5705b6,JSON[_0x0268('0x15')](_0x2de153));_0x10ecc0(_0x2de153);})[_0x0268('0x25')](function(_0x56de74){logger[_0x0268('0x16')](_0x0268('0x1b'),_0x56de74['message'],_0x5705b6);_0x3e99ce(_0x59a590[_0x0268('0x16')](0x1f4,_0x56de74[_0x0268('0x19')]));});});}; \ No newline at end of file +var _0x11aa=['raw','where','include','map','attributes','model','debug','stringify','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','error','SquareProject,\x20%s,\x20%s','message','ShowSquareProject','SquareProject','options'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0x11aa,0x1e8));var _0xa11a=function(_0x3e1ce5,_0x41fb5f){_0x3e1ce5=_0x3e1ce5-0x0;var _0x1e54ff=_0x11aa[_0x3e1ce5];return _0x1e54ff;};'use strict';var _=require(_0xa11a('0x0'));var util=require(_0xa11a('0x1'));var moment=require('moment');var BPromise=require(_0xa11a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa11a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa11a('0x4'));var logger=require(_0xa11a('0x5'))(_0xa11a('0x6'));var config=require(_0xa11a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa11a('0x8')][_0xa11a('0x9')]({'port':0x232a});config[_0xa11a('0xa')]=_['defaults'](config[_0xa11a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa11a('0xb'))(new Redis(config['redis']));require(_0xa11a('0xc'))[_0xa11a('0xd')](socket);function respondWithRpcPromise(_0x1d8074,_0x271f90,_0x316387){return new BPromise(function(_0x34db9a,_0x4d8249){return client[_0xa11a('0xe')](_0x1d8074,_0x316387)[_0xa11a('0xf')](function(_0xc44bc9){logger[_0xa11a('0x10')]('SquareProject,\x20%s,\x20%s',_0x271f90,_0xa11a('0x11'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x271f90,'request\x20sent',JSON['stringify'](_0xc44bc9));if(_0xc44bc9[_0xa11a('0x12')]){if(_0xc44bc9[_0xa11a('0x12')]['code']===0x1f4){logger[_0xa11a('0x12')](_0xa11a('0x13'),_0x271f90,_0xc44bc9[_0xa11a('0x12')]['message']);return _0x4d8249(_0xc44bc9[_0xa11a('0x12')][_0xa11a('0x14')]);}logger[_0xa11a('0x12')]('SquareProject,\x20%s,\x20%s',_0x271f90,_0xc44bc9['error'][_0xa11a('0x14')]);return _0x34db9a(_0xc44bc9[_0xa11a('0x12')][_0xa11a('0x14')]);}else{logger[_0xa11a('0x10')]('SquareProject,\x20%s,\x20%s',_0x271f90,'request\x20sent');_0x34db9a(_0xc44bc9['result']['message']);}})['catch'](function(_0x1d5099){logger['error']('SquareProject,\x20%s,\x20%s',_0x271f90,_0x1d5099);_0x4d8249(_0x1d5099);});});}exports[_0xa11a('0x15')]=function(_0xdfb336){var _0x1779f1=this;return new Promise(function(_0x42f456,_0x1f7e4c){return db[_0xa11a('0x16')]['find']({'raw':_0xdfb336[_0xa11a('0x17')]?_0xdfb336[_0xa11a('0x17')][_0xa11a('0x18')]===undefined?!![]:![]:!![],'where':_0xdfb336[_0xa11a('0x17')]?_0xdfb336['options'][_0xa11a('0x19')]||null:null,'attributes':_0xdfb336['options']?_0xdfb336[_0xa11a('0x17')]['attributes']||null:null,'include':_0xdfb336[_0xa11a('0x17')]?_0xdfb336[_0xa11a('0x17')][_0xa11a('0x1a')]?_[_0xa11a('0x1b')](_0xdfb336[_0xa11a('0x17')][_0xa11a('0x1a')],function(_0x34db38){return{'model':db[_0x34db38['model']],'as':_0x34db38['as'],'attributes':_0x34db38[_0xa11a('0x1c')],'include':_0x34db38[_0xa11a('0x1a')]?_[_0xa11a('0x1b')](_0x34db38[_0xa11a('0x1a')],function(_0x3fddf1){return{'model':db[_0x3fddf1[_0xa11a('0x1d')]],'as':_0x3fddf1['as'],'attributes':_0x3fddf1[_0xa11a('0x1c')],'include':_0x3fddf1['include']?_['map'](_0x3fddf1[_0xa11a('0x1a')],function(_0x5e93a0){return{'model':db[_0x5e93a0[_0xa11a('0x1d')]],'as':_0x5e93a0['as'],'attributes':_0x5e93a0[_0xa11a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa11a('0xf')](function(_0x2b657d){logger['info']('ShowSquareProject',_0xdfb336);logger[_0xa11a('0x1e')](_0xa11a('0x15'),_0xdfb336,JSON[_0xa11a('0x1f')](_0x2b657d));_0x42f456(_0x2b657d);})['catch'](function(_0x48f6be){logger['error']('ShowSquareProject',_0x48f6be['message'],_0xdfb336);_0x1f7e4c(_0x1779f1[_0xa11a('0x12')](0x1f4,_0x48f6be[_0xa11a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 92a9a5e..be210f5 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 _0xe4a0=['removeListener','length','squareProject:','./squareProject.events','save','remove','emit'];(function(_0x17615e,_0x483a49){var _0xa4c97e=function(_0x24ecf7){while(--_0x24ecf7){_0x17615e['push'](_0x17615e['shift']());}};_0xa4c97e(++_0x483a49);}(_0xe4a0,0x13e));var _0x0e4a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe4a0[_0x397e5f];return _0x5302b8;};'use strict';var SquareProjectEvents=require(_0x0e4a('0x0'));var events=[_0x0e4a('0x1'),_0x0e4a('0x2'),'update'];function createListener(_0x24626a,_0x5e3c03){return function(_0x56fab7){_0x5e3c03[_0x0e4a('0x3')](_0x24626a,_0x56fab7);};}function removeListener(_0x3d6a8c,_0x5e6606){return function(){SquareProjectEvents[_0x0e4a('0x4')](_0x3d6a8c,_0x5e6606);};}exports['register']=function(_0x532b03){for(var _0x382adb=0x0,_0x48fc66=events[_0x0e4a('0x5')];_0x382adb<_0x48fc66;_0x382adb++){var _0x4749ac=events[_0x382adb];var _0x114b56=createListener(_0x0e4a('0x6')+_0x4749ac,_0x532b03);SquareProjectEvents['on'](_0x4749ac,_0x114b56);}}; \ No newline at end of file +var _0xb232=['remove','update','emit','removeListener','length','./squareProject.events','save'];(function(_0x557701,_0x180f95){var _0x4c6d09=function(_0x241b67){while(--_0x241b67){_0x557701['push'](_0x557701['shift']());}};_0x4c6d09(++_0x180f95);}(_0xb232,0x11d));var _0x2b23=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xb232[_0x650e11];return _0x1a9b47;};'use strict';var SquareProjectEvents=require(_0x2b23('0x0'));var events=[_0x2b23('0x1'),_0x2b23('0x2'),_0x2b23('0x3')];function createListener(_0x43a0ea,_0x1b37b7){return function(_0x1ed0c2){_0x1b37b7[_0x2b23('0x4')](_0x43a0ea,_0x1ed0c2);};}function removeListener(_0x2cceb9,_0x43826a){return function(){SquareProjectEvents[_0x2b23('0x5')](_0x2cceb9,_0x43826a);};}exports['register']=function(_0x34cfde){for(var _0x2b5b6c=0x0,_0x544e13=events[_0x2b23('0x6')];_0x2b5b6c<_0x544e13;_0x2b5b6c++){var _0x124ffc=events[_0x2b5b6c];var _0x5c5ce5=createListener('squareProject:'+_0x124ffc,_0x34cfde);SquareProjectEvents['on'](_0x124ffc,_0x5c5ce5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 02de275..26c8099 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x5bdc84,_0xfcbdba){var _0xb84e18=function(_0x27a97a){while(--_0x27a97a){_0x5bdc84['push'](_0x5bdc84['shift']());}};_0xb84e18(++_0xfcbdba);}(_0x1261,0x144));var _0x1126=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x1261[_0x269094];return _0x10344f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x5142d9,_0x598667){var _0x3b50e7=function(_0x2aefbd){while(--_0x2aefbd){_0x5142d9['push'](_0x5142d9['shift']());}};_0x3b50e7(++_0x598667);}(_0xe14b,0x93));var _0xbe14=function(_0x4a1b51,_0x18c770){_0x4a1b51=_0x4a1b51-0x0;var _0x5d7116=_0xe14b[_0x4a1b51];return _0x5d7116;};'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['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ea11210..341a83c 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x7da7[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'uniqueid':{'type':Sequelize[_0x77da('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x77da('0x2')]},'extension':{'type':Sequelize[_0x77da('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x77da('0x2')]},'dnid':{'type':Sequelize[_0x77da('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x77da('0x2')]},'filename':{'type':Sequelize[_0x77da('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x77da('0x3')],'get':function(){var _0x47cf1d='';var _0x1191de=this[_0x77da('0x4')](_0x77da('0x5'));if(_0x1191de){_0x47cf1d=_0x1191de[_0x77da('0x6')](_0x1191de[_0x77da('0x7')]('.'));}return _0x47cf1d;}}}; \ No newline at end of file +var _0x207c=['savePath','substring','exports','STRING','VIRTUAL','getDataValue'];(function(_0x580559,_0x1032a3){var _0xe426a2=function(_0x31075b){while(--_0x31075b){_0x580559['push'](_0x580559['shift']());}};_0xe426a2(++_0x1032a3);}(_0x207c,0x1e8));var _0xc207=function(_0x2bd8a6,_0x5b9211){_0x2bd8a6=_0x2bd8a6-0x0;var _0x1e037a=_0x207c[_0x2bd8a6];return _0x1e037a;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'calleridname':{'type':Sequelize[_0xc207('0x1')]},'context':{'type':Sequelize[_0xc207('0x1')]},'extension':{'type':Sequelize[_0xc207('0x1')]},'priority':{'type':Sequelize[_0xc207('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc207('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xc207('0x1')]},'format':{'type':Sequelize[_0xc207('0x2')],'get':function(){var _0x3395e4='';var _0x59ff6f=this[_0xc207('0x3')](_0xc207('0x4'));if(_0x59ff6f){_0x3395e4=_0x59ff6f[_0xc207('0x5')](_0x59ff6f['lastIndexOf']('.'));}return _0x3395e4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 901463d..aa80e0e 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 _0x2589=['cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','info'];(function(_0x153d69,_0x348c05){var _0xfb9878=function(_0x5b7bd3){while(--_0x5b7bd3){_0x153d69['push'](_0x153d69['shift']());}};_0xfb9878(++_0x348c05);}(_0x2589,0xce));var _0x9258=function(_0x28dfaf,_0x1723c8){_0x28dfaf=_0x28dfaf-0x0;var _0x5b6ed8=_0x2589[_0x28dfaf];return _0x5b6ed8;};'use strict';var emlformat=require(_0x9258('0x0'));var rimraf=require(_0x9258('0x1'));var zipdir=require(_0x9258('0x2'));var jsonpatch=require(_0x9258('0x3'));var rp=require(_0x9258('0x4'));var moment=require(_0x9258('0x5'));var BPromise=require(_0x9258('0x6'));var Mustache=require(_0x9258('0x7'));var util=require(_0x9258('0x8'));var path=require(_0x9258('0x9'));var sox=require(_0x9258('0xa'));var csv=require(_0x9258('0xb'));var ejs=require(_0x9258('0xc'));var fs=require('fs');var fs_extra=require(_0x9258('0xd'));var _=require('lodash');var squel=require(_0x9258('0xe'));var crypto=require(_0x9258('0xf'));var jsforce=require(_0x9258('0x10'));var deskjs=require(_0x9258('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9258('0x12'));var as=require(_0x9258('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9258('0x14'))(_0x9258('0x15'));var utils=require(_0x9258('0x16'));var config=require(_0x9258('0x17'));var licenseUtil=require(_0x9258('0x18'));var db=require(_0x9258('0x19'))['db'];function respondWithStatusCode(_0x195ad5,_0x507f8c){_0x507f8c=_0x507f8c||0xcc;return function(_0x338baf){if(_0x338baf){return _0x195ad5[_0x9258('0x1a')](_0x507f8c);}return _0x195ad5[_0x9258('0x1b')](_0x507f8c)['end']();};}function respondWithResult(_0x553d65,_0x2edc6f){_0x2edc6f=_0x2edc6f||0xc8;return function(_0x39a60f){if(_0x39a60f){return _0x553d65[_0x9258('0x1b')](_0x2edc6f)[_0x9258('0x1c')](_0x39a60f);}};}function respondWithFilteredResult(_0x5b913d,_0x255cc4){return function(_0x3979f2){if(_0x3979f2){var _0x4f9a44=typeof _0x255cc4['offset']===_0x9258('0x1d')&&typeof _0x255cc4[_0x9258('0x1e')]===_0x9258('0x1d');var _0x2ce7d9=_0x3979f2[_0x9258('0x1f')];var _0x1f8f0e=_0x4f9a44?0x0:_0x255cc4[_0x9258('0x20')];var _0x927052=_0x4f9a44?_0x3979f2['count']:_0x255cc4[_0x9258('0x20')]+_0x255cc4['limit'];var _0x460c82;if(_0x927052>=_0x2ce7d9){_0x927052=_0x2ce7d9;_0x460c82=0xc8;}else{_0x460c82=0xce;}_0x5b913d[_0x9258('0x1b')](_0x460c82);return _0x5b913d['set'](_0x9258('0x21'),_0x1f8f0e+'-'+_0x927052+'/'+_0x2ce7d9)[_0x9258('0x1c')](_0x3979f2);}return null;};}function patchUpdates(_0x340780){return function(_0xc11b8e){try{jsonpatch[_0x9258('0x22')](_0xc11b8e,_0x340780,!![]);}catch(_0x49014a){return BPromise[_0x9258('0x23')](_0x49014a);}return _0xc11b8e[_0x9258('0x24')]();};}function saveUpdates(_0x266039,_0x579b48){return function(_0x38d108){if(_0x38d108){return _0x38d108[_0x9258('0x25')](_0x266039)[_0x9258('0x26')](function(_0x3fc44d){return _0x3fc44d;});}return null;};}function removeEntity(_0x5879a6,_0x292c14){return function(_0xe633bb){if(_0xe633bb){return _0xe633bb[_0x9258('0x27')]()[_0x9258('0x26')](function(){_0x5879a6[_0x9258('0x1b')](0xcc)[_0x9258('0x28')]();});}};}function handleEntityNotFound(_0x1770f7,_0x5ab1be){return function(_0xd299c6){if(!_0xd299c6){_0x1770f7['sendStatus'](0x194);}return _0xd299c6;};}function handleError(_0x4fbf0b,_0x260df8){_0x260df8=_0x260df8||0x1f4;return function(_0x3d9015){logger['error'](_0x3d9015[_0x9258('0x29')]);if(_0x3d9015[_0x9258('0x2a')]){delete _0x3d9015[_0x9258('0x2a')];}_0x4fbf0b['status'](_0x260df8)[_0x9258('0x2b')](_0x3d9015);};}exports[_0x9258('0x2c')]=function(_0x2e7e96,_0x41d999){var _0x267465={},_0x52d4c1={},_0x1f9f3d={'count':0x0,'rows':[]};var _0x58bab0=_[_0x9258('0x2d')](db[_0x9258('0x2e')][_0x9258('0x2f')],function(_0x217fe1){return{'name':_0x217fe1[_0x9258('0x30')],'type':_0x217fe1[_0x9258('0x31')]['key']};});_0x52d4c1['model']=_[_0x9258('0x2d')](_0x58bab0,_0x9258('0x2a'));_0x52d4c1['query']=_[_0x9258('0x32')](_0x2e7e96[_0x9258('0x33')]);_0x52d4c1[_0x9258('0x34')]=_[_0x9258('0x35')](_0x52d4c1[_0x9258('0x36')],_0x52d4c1[_0x9258('0x33')]);_0x267465[_0x9258('0x37')]=_[_0x9258('0x35')](_0x52d4c1[_0x9258('0x36')],qs[_0x9258('0x38')](_0x2e7e96[_0x9258('0x33')][_0x9258('0x38')]));_0x267465[_0x9258('0x37')]=_0x267465[_0x9258('0x37')][_0x9258('0x39')]?_0x267465[_0x9258('0x37')]:_0x52d4c1[_0x9258('0x36')];if(!_0x2e7e96['query'][_0x9258('0x3a')](_0x9258('0x3b'))){_0x267465[_0x9258('0x1e')]=qs[_0x9258('0x1e')](_0x2e7e96['query'][_0x9258('0x1e')]);_0x267465[_0x9258('0x20')]=qs[_0x9258('0x20')](_0x2e7e96[_0x9258('0x33')][_0x9258('0x20')]);}_0x267465[_0x9258('0x3c')]=qs[_0x9258('0x3d')](_0x2e7e96[_0x9258('0x33')][_0x9258('0x3d')]);_0x267465['where']=qs[_0x9258('0x34')](_['pick'](_0x2e7e96[_0x9258('0x33')],_0x52d4c1[_0x9258('0x34')]),_0x58bab0);if(_0x2e7e96[_0x9258('0x33')][_0x9258('0x3e')]){_0x267465['where']=_[_0x9258('0x3f')](_0x267465[_0x9258('0x40')],{'$or':_[_0x9258('0x2d')](_0x58bab0,function(_0x4ded66){if(_0x4ded66[_0x9258('0x31')]!==_0x9258('0x41')){var _0x14ef3f={};_0x14ef3f[_0x4ded66[_0x9258('0x2a')]]={'$like':'%'+_0x2e7e96[_0x9258('0x33')][_0x9258('0x3e')]+'%'};return _0x14ef3f;}})});}_0x267465=_[_0x9258('0x3f')]({},_0x267465,_0x2e7e96[_0x9258('0x42')]);var _0x538887={'where':_0x267465[_0x9258('0x40')]};return db['SquareRecording'][_0x9258('0x1f')](_0x538887)[_0x9258('0x26')](function(_0x20d8e8){_0x1f9f3d['count']=_0x20d8e8;if(_0x2e7e96[_0x9258('0x33')][_0x9258('0x43')]){_0x267465[_0x9258('0x44')]=[{'all':!![]}];}return db[_0x9258('0x2e')][_0x9258('0x45')](_0x267465);})[_0x9258('0x26')](function(_0x17eb22){_0x1f9f3d[_0x9258('0x46')]=_0x17eb22;return _0x1f9f3d;})[_0x9258('0x26')](respondWithFilteredResult(_0x41d999,_0x267465))[_0x9258('0x47')](handleError(_0x41d999,null));};exports[_0x9258('0x48')]=function(_0x41df49,_0x240a0c){var _0x47046a={'raw':!![],'where':{'id':_0x41df49[_0x9258('0x49')]['id']}},_0x3a7b07={};_0x3a7b07[_0x9258('0x36')]=_[_0x9258('0x32')](db['SquareRecording'][_0x9258('0x2f')]);_0x3a7b07[_0x9258('0x33')]=_[_0x9258('0x32')](_0x41df49['query']);_0x3a7b07[_0x9258('0x34')]=_[_0x9258('0x35')](_0x3a7b07[_0x9258('0x36')],_0x3a7b07[_0x9258('0x33')]);_0x47046a[_0x9258('0x37')]=_[_0x9258('0x35')](_0x3a7b07['model'],qs[_0x9258('0x38')](_0x41df49[_0x9258('0x33')]['fields']));_0x47046a[_0x9258('0x37')]=_0x47046a[_0x9258('0x37')]['length']?_0x47046a[_0x9258('0x37')]:_0x3a7b07[_0x9258('0x36')];if(_0x41df49[_0x9258('0x33')][_0x9258('0x43')]){_0x47046a[_0x9258('0x44')]=[{'all':!![]}];}_0x47046a=_[_0x9258('0x3f')]({},_0x47046a,_0x41df49['options']);return db[_0x9258('0x2e')][_0x9258('0x4a')](_0x47046a)['then'](handleEntityNotFound(_0x240a0c,null))['then'](respondWithResult(_0x240a0c,null))['catch'](handleError(_0x240a0c,null));};exports[_0x9258('0x4b')]=function(_0x1ba8bb,_0x3a3fd7){return db[_0x9258('0x2e')]['create'](_0x1ba8bb[_0x9258('0x4c')],{})[_0x9258('0x26')](respondWithResult(_0x3a3fd7,0xc9))[_0x9258('0x47')](handleError(_0x3a3fd7,null));};exports[_0x9258('0x25')]=function(_0x2a7e7c,_0x3943ca){if(_0x2a7e7c['body']['id']){delete _0x2a7e7c['body']['id'];}return db[_0x9258('0x2e')][_0x9258('0x4a')]({'where':{'id':_0x2a7e7c[_0x9258('0x49')]['id']}})[_0x9258('0x26')](handleEntityNotFound(_0x3943ca,null))[_0x9258('0x26')](saveUpdates(_0x2a7e7c[_0x9258('0x4c')],null))[_0x9258('0x26')](respondWithResult(_0x3943ca,null))[_0x9258('0x47')](handleError(_0x3943ca,null));};exports[_0x9258('0x4d')]=function(_0x2d1c99,_0x2e4fbd,_0x334702){var _0x163163=require(_0x9258('0x4e'));var _0x5e607b=![];var _0x4ce2cb={};if(_0x2d1c99['query'][_0x9258('0x31')]&&_0x2d1c99[_0x9258('0x33')]['type']===_0x9258('0x4f')){_0x4ce2cb[_0x9258('0x4f')]=_0x2d1c99[_0x9258('0x49')]['id'];}else{_0x4ce2cb['id']=_0x2d1c99[_0x9258('0x49')]['id'];}return db['SquareRecording']['find']({'where':_0x4ce2cb,'attributes':['id',_0x9258('0x50'),_0x9258('0x51')],'raw':!![]})[_0x9258('0x26')](handleEntityNotFound(_0x2e4fbd,null))[_0x9258('0x26')](function(_0x376973){if(_0x376973){var _0x15e2f2=_0x376973[_0x9258('0x50')];var _0x3ae182=util[_0x9258('0x52')](_0x9258('0x53'),_0x15e2f2);if(fs['existsSync'](_0x3ae182)){_0x5e607b=!![];return _0x163163[_0x9258('0x54')](_0x3ae182,_0x15e2f2,config[_0x9258('0x55')]['recording'])[_0x9258('0x26')](function(){return _0x376973;});}return _0x376973;}})['then'](function(_0xc12edf){if(_0xc12edf){var _0x76645b=_0xc12edf['savePath'];if(!fs[_0x9258('0x56')](_0x76645b)){throw new db[(_0x9258('0x57'))]['ValidationError'](_0x9258('0x58'));}if(_0xc12edf[_0x9258('0x51')]){return _0x2e4fbd['download'](_0x76645b,_0xc12edf[_0x9258('0x51')]+path[_0x9258('0x59')](_0x76645b),function(){if(_0x5e607b){fs[_0x9258('0x5a')](_0x76645b);}});}else{return _0x2e4fbd[_0x9258('0x4d')](_0x76645b,function(_0x1fe72b){if(_0x5e607b){fs[_0x9258('0x5a')](_0x76645b);}});}}})[_0x9258('0x47')](function(_0x58bc55){if(_0x58bc55[_0x9258('0x5b')]==='SquareRecording\x20not\x20found'){_0x2e4fbd[_0x9258('0x1b')](0x194)[_0x9258('0x2b')]('Not\x20found');}else{return handleError(_0x2e4fbd,null);}});};exports[_0x9258('0x27')]=function(_0x2edb37,_0x5cecc7){return db[_0x9258('0x2e')][_0x9258('0x4a')]({'where':{'id':_0x2edb37['params']['id']}})[_0x9258('0x26')](function(_0x75bf30){if(_['isNil'](_0x75bf30)){throw new ReferenceError(_0x9258('0x5c'));}return _0x75bf30;})[_0x9258('0x26')](function(_0x427ab0){var _0x990771=_0x427ab0[_0x9258('0x50')];logger[_0x9258('0x5d')](_0x9258('0x5e'),_0x990771);if(!_[_0x9258('0x5f')](_0x427ab0['savePath'])&&fs[_0x9258('0x56')](_0x990771)){logger[_0x9258('0x5d')](_0x9258('0x60')+_0x990771+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9258('0x61')](_0x990771);}_0x990771=_0x990771+_0x9258('0x62');if(!_[_0x9258('0x5f')](_0x427ab0[_0x9258('0x50')])&&fs['existsSync'](_0x990771)){logger[_0x9258('0x5d')]('File:\x20\x22'+_0x990771+_0x9258('0x63'));fs[_0x9258('0x61')](_0x990771);}return _0x427ab0;})[_0x9258('0x26')](function(_0x4a6c1f){if(!_0x4a6c1f)throw new InternalError();return _0x4a6c1f[_0x9258('0x27')]();})[_0x9258('0x26')](function(){_0x5cecc7[_0x9258('0x1b')](0xcc)[_0x9258('0x28')]();})[_0x9258('0x47')](handleError(_0x5cecc7,null));}; \ No newline at end of file +var _0xc675=['destroy','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','SquareRecording','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','params','../../components/encryptor','type','uniqueid','find','savePath','filename','format','existsSync','SquareRecording\x20not\x20found','download','extname','message','Not\x20found'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xc675,0x18b));var _0x5c67=function(_0x1fb1ee,_0x4c64f3){_0x1fb1ee=_0x1fb1ee-0x0;var _0x2a3ceb=_0xc675[_0x1fb1ee];return _0x2a3ceb;};'use strict';var emlformat=require(_0x5c67('0x0'));var rimraf=require(_0x5c67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c67('0x2'));var rp=require(_0x5c67('0x3'));var moment=require(_0x5c67('0x4'));var BPromise=require(_0x5c67('0x5'));var Mustache=require(_0x5c67('0x6'));var util=require(_0x5c67('0x7'));var path=require(_0x5c67('0x8'));var sox=require(_0x5c67('0x9'));var csv=require(_0x5c67('0xa'));var ejs=require(_0x5c67('0xb'));var fs=require('fs');var fs_extra=require(_0x5c67('0xc'));var _=require(_0x5c67('0xd'));var squel=require(_0x5c67('0xe'));var crypto=require(_0x5c67('0xf'));var jsforce=require(_0x5c67('0x10'));var deskjs=require(_0x5c67('0x11'));var toCsv=require(_0x5c67('0xa'));var querystring=require(_0x5c67('0x12'));var Papa=require(_0x5c67('0x13'));var Redis=require('ioredis');var authService=require(_0x5c67('0x14'));var qs=require(_0x5c67('0x15'));var as=require(_0x5c67('0x16'));var hardwareService=require(_0x5c67('0x17'));var logger=require(_0x5c67('0x18'))(_0x5c67('0x19'));var utils=require(_0x5c67('0x1a'));var config=require(_0x5c67('0x1b'));var licenseUtil=require(_0x5c67('0x1c'));var db=require(_0x5c67('0x1d'))['db'];function respondWithStatusCode(_0x5bceb6,_0x4d0eaf){_0x4d0eaf=_0x4d0eaf||0xcc;return function(_0x58689e){if(_0x58689e){return _0x5bceb6[_0x5c67('0x1e')](_0x4d0eaf);}return _0x5bceb6[_0x5c67('0x1f')](_0x4d0eaf)[_0x5c67('0x20')]();};}function respondWithResult(_0xff16ac,_0xf0e0cf){_0xf0e0cf=_0xf0e0cf||0xc8;return function(_0x24e57e){if(_0x24e57e){return _0xff16ac[_0x5c67('0x1f')](_0xf0e0cf)[_0x5c67('0x21')](_0x24e57e);}};}function respondWithFilteredResult(_0x9e4478,_0x479ae1){return function(_0x5b6e03){if(_0x5b6e03){var _0x585c30=typeof _0x479ae1['offset']===_0x5c67('0x22')&&typeof _0x479ae1['limit']===_0x5c67('0x22');var _0x192f23=_0x5b6e03[_0x5c67('0x23')];var _0x44b4b5=_0x585c30?0x0:_0x479ae1[_0x5c67('0x24')];var _0x1aa5bf=_0x585c30?_0x5b6e03['count']:_0x479ae1[_0x5c67('0x24')]+_0x479ae1[_0x5c67('0x25')];var _0x27aee7;if(_0x1aa5bf>=_0x192f23){_0x1aa5bf=_0x192f23;_0x27aee7=0xc8;}else{_0x27aee7=0xce;}_0x9e4478['status'](_0x27aee7);return _0x9e4478[_0x5c67('0x26')](_0x5c67('0x27'),_0x44b4b5+'-'+_0x1aa5bf+'/'+_0x192f23)[_0x5c67('0x21')](_0x5b6e03);}return null;};}function patchUpdates(_0x97c2b4){return function(_0x36c173){try{jsonpatch['apply'](_0x36c173,_0x97c2b4,!![]);}catch(_0x26b1d3){return BPromise[_0x5c67('0x28')](_0x26b1d3);}return _0x36c173[_0x5c67('0x29')]();};}function saveUpdates(_0x212f72,_0xd3a133){return function(_0x1cb0e3){if(_0x1cb0e3){return _0x1cb0e3[_0x5c67('0x2a')](_0x212f72)['then'](function(_0x27605b){return _0x27605b;});}return null;};}function removeEntity(_0x2c7775,_0x9c5ff1){return function(_0x45d3df){if(_0x45d3df){return _0x45d3df['destroy']()[_0x5c67('0x2b')](function(){_0x2c7775['status'](0xcc)[_0x5c67('0x20')]();});}};}function handleEntityNotFound(_0x519b06,_0x133b78){return function(_0x9a422f){if(!_0x9a422f){_0x519b06[_0x5c67('0x1e')](0x194);}return _0x9a422f;};}function handleError(_0x435c3b,_0x40f98c){_0x40f98c=_0x40f98c||0x1f4;return function(_0x125431){logger[_0x5c67('0x2c')](_0x125431[_0x5c67('0x2d')]);if(_0x125431[_0x5c67('0x2e')]){delete _0x125431[_0x5c67('0x2e')];}_0x435c3b[_0x5c67('0x1f')](_0x40f98c)[_0x5c67('0x2f')](_0x125431);};}exports['index']=function(_0x41d3e3,_0x13a4b1){var _0x421e59={},_0x47a7fb={},_0x55a263={'count':0x0,'rows':[]};var _0xa37a13=_['map'](db[_0x5c67('0x30')][_0x5c67('0x31')],function(_0x512a16){return{'name':_0x512a16[_0x5c67('0x32')],'type':_0x512a16['type'][_0x5c67('0x33')]};});_0x47a7fb[_0x5c67('0x34')]=_[_0x5c67('0x35')](_0xa37a13,_0x5c67('0x2e'));_0x47a7fb[_0x5c67('0x36')]=_[_0x5c67('0x37')](_0x41d3e3[_0x5c67('0x36')]);_0x47a7fb[_0x5c67('0x38')]=_[_0x5c67('0x39')](_0x47a7fb[_0x5c67('0x34')],_0x47a7fb[_0x5c67('0x36')]);_0x421e59[_0x5c67('0x3a')]=_[_0x5c67('0x39')](_0x47a7fb['model'],qs[_0x5c67('0x3b')](_0x41d3e3[_0x5c67('0x36')][_0x5c67('0x3b')]));_0x421e59[_0x5c67('0x3a')]=_0x421e59['attributes'][_0x5c67('0x3c')]?_0x421e59[_0x5c67('0x3a')]:_0x47a7fb[_0x5c67('0x34')];if(!_0x41d3e3[_0x5c67('0x36')]['hasOwnProperty'](_0x5c67('0x3d'))){_0x421e59['limit']=qs[_0x5c67('0x25')](_0x41d3e3['query'][_0x5c67('0x25')]);_0x421e59['offset']=qs[_0x5c67('0x24')](_0x41d3e3['query'][_0x5c67('0x24')]);}_0x421e59[_0x5c67('0x3e')]=qs[_0x5c67('0x3f')](_0x41d3e3['query']['sort']);_0x421e59[_0x5c67('0x40')]=qs['filters'](_['pick'](_0x41d3e3['query'],_0x47a7fb[_0x5c67('0x38')]),_0xa37a13);if(_0x41d3e3[_0x5c67('0x36')][_0x5c67('0x41')]){_0x421e59[_0x5c67('0x40')]=_[_0x5c67('0x42')](_0x421e59['where'],{'$or':_['map'](_0xa37a13,function(_0x5d5f2a){if(_0x5d5f2a['type']!==_0x5c67('0x43')){var _0x2d86dd={};_0x2d86dd[_0x5d5f2a['name']]={'$like':'%'+_0x41d3e3[_0x5c67('0x36')]['filter']+'%'};return _0x2d86dd;}})});}_0x421e59=_[_0x5c67('0x42')]({},_0x421e59,_0x41d3e3[_0x5c67('0x44')]);var _0x42fb95={'where':_0x421e59['where']};return db[_0x5c67('0x30')]['count'](_0x42fb95)['then'](function(_0x2ccce9){_0x55a263[_0x5c67('0x23')]=_0x2ccce9;if(_0x41d3e3['query']['includeAll']){_0x421e59[_0x5c67('0x45')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x421e59);})['then'](function(_0x3443d6){_0x55a263[_0x5c67('0x46')]=_0x3443d6;return _0x55a263;})['then'](respondWithFilteredResult(_0x13a4b1,_0x421e59))[_0x5c67('0x47')](handleError(_0x13a4b1,null));};exports[_0x5c67('0x48')]=function(_0x3a6339,_0x2c162c){var _0x33bcc4={'raw':!![],'where':{'id':_0x3a6339['params']['id']}},_0x472890={};_0x472890[_0x5c67('0x34')]=_[_0x5c67('0x37')](db[_0x5c67('0x30')][_0x5c67('0x31')]);_0x472890['query']=_[_0x5c67('0x37')](_0x3a6339[_0x5c67('0x36')]);_0x472890[_0x5c67('0x38')]=_[_0x5c67('0x39')](_0x472890[_0x5c67('0x34')],_0x472890[_0x5c67('0x36')]);_0x33bcc4[_0x5c67('0x3a')]=_[_0x5c67('0x39')](_0x472890[_0x5c67('0x34')],qs[_0x5c67('0x3b')](_0x3a6339[_0x5c67('0x36')][_0x5c67('0x3b')]));_0x33bcc4[_0x5c67('0x3a')]=_0x33bcc4[_0x5c67('0x3a')][_0x5c67('0x3c')]?_0x33bcc4[_0x5c67('0x3a')]:_0x472890['model'];if(_0x3a6339[_0x5c67('0x36')][_0x5c67('0x49')]){_0x33bcc4['include']=[{'all':!![]}];}_0x33bcc4=_[_0x5c67('0x42')]({},_0x33bcc4,_0x3a6339['options']);return db[_0x5c67('0x30')]['find'](_0x33bcc4)[_0x5c67('0x2b')](handleEntityNotFound(_0x2c162c,null))[_0x5c67('0x2b')](respondWithResult(_0x2c162c,null))[_0x5c67('0x47')](handleError(_0x2c162c,null));};exports['create']=function(_0x2a5ebd,_0x2c1e24){return db['SquareRecording'][_0x5c67('0x4a')](_0x2a5ebd[_0x5c67('0x4b')],{})[_0x5c67('0x2b')](respondWithResult(_0x2c1e24,0xc9))[_0x5c67('0x47')](handleError(_0x2c1e24,null));};exports[_0x5c67('0x2a')]=function(_0x25d736,_0x430ddd){if(_0x25d736[_0x5c67('0x4b')]['id']){delete _0x25d736['body']['id'];}return db[_0x5c67('0x30')]['find']({'where':{'id':_0x25d736[_0x5c67('0x4c')]['id']}})[_0x5c67('0x2b')](handleEntityNotFound(_0x430ddd,null))['then'](saveUpdates(_0x25d736[_0x5c67('0x4b')],null))[_0x5c67('0x2b')](respondWithResult(_0x430ddd,null))['catch'](handleError(_0x430ddd,null));};exports['download']=function(_0x11b33a,_0x4bb7ba,_0x40d3ab){var _0x1820a8=require(_0x5c67('0x4d'));var _0x3e705e=![];var _0x22d33c={};if(_0x11b33a[_0x5c67('0x36')][_0x5c67('0x4e')]&&_0x11b33a['query'][_0x5c67('0x4e')]===_0x5c67('0x4f')){_0x22d33c[_0x5c67('0x4f')]=_0x11b33a[_0x5c67('0x4c')]['id'];}else{_0x22d33c['id']=_0x11b33a['params']['id'];}return db[_0x5c67('0x30')][_0x5c67('0x50')]({'where':_0x22d33c,'attributes':['id',_0x5c67('0x51'),_0x5c67('0x52')],'raw':!![]})[_0x5c67('0x2b')](handleEntityNotFound(_0x4bb7ba,null))[_0x5c67('0x2b')](function(_0x159f92){if(_0x159f92){var _0x552d8e=_0x159f92['savePath'];var _0x27fb6a=util[_0x5c67('0x53')]('%s.cypher',_0x552d8e);if(fs[_0x5c67('0x54')](_0x27fb6a)){_0x3e705e=!![];return _0x1820a8['decryptFile'](_0x27fb6a,_0x552d8e,config['secrets']['recording'])['then'](function(){return _0x159f92;});}return _0x159f92;}})['then'](function(_0x473def){if(_0x473def){var _0x31ffe3=_0x473def[_0x5c67('0x51')];if(!fs[_0x5c67('0x54')](_0x31ffe3)){throw new db['Sequelize']['ValidationError'](_0x5c67('0x55'));}if(_0x473def[_0x5c67('0x52')]){return _0x4bb7ba[_0x5c67('0x56')](_0x31ffe3,_0x473def['filename']+path[_0x5c67('0x57')](_0x31ffe3),function(){if(_0x3e705e){fs['unlink'](_0x31ffe3);}});}else{return _0x4bb7ba[_0x5c67('0x56')](_0x31ffe3,function(_0x1bd7e2){if(_0x3e705e){fs['unlink'](_0x31ffe3);}});}}})['catch'](function(_0x4af669){if(_0x4af669[_0x5c67('0x58')]===_0x5c67('0x55')){_0x4bb7ba['status'](0x194)[_0x5c67('0x2f')](_0x5c67('0x59'));}else{return handleError(_0x4bb7ba,null);}});};exports[_0x5c67('0x5a')]=function(_0x1b7356,_0x3e88ac){return db[_0x5c67('0x30')][_0x5c67('0x50')]({'where':{'id':_0x1b7356[_0x5c67('0x4c')]['id']}})[_0x5c67('0x2b')](function(_0x54e02e){if(_['isNil'](_0x54e02e)){throw new ReferenceError(_0x5c67('0x5b'));}return _0x54e02e;})[_0x5c67('0x2b')](function(_0x7f8c8b){var _0xc969f4=_0x7f8c8b[_0x5c67('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xc969f4);if(!_['isNil'](_0x7f8c8b[_0x5c67('0x51')])&&fs[_0x5c67('0x54')](_0xc969f4)){logger[_0x5c67('0x5c')]('File:\x20\x22'+_0xc969f4+_0x5c67('0x5d'));fs[_0x5c67('0x5e')](_0xc969f4);}_0xc969f4=_0xc969f4+'.cypher';if(!_[_0x5c67('0x5f')](_0x7f8c8b[_0x5c67('0x51')])&&fs[_0x5c67('0x54')](_0xc969f4)){logger[_0x5c67('0x5c')](_0x5c67('0x60')+_0xc969f4+_0x5c67('0x5d'));fs[_0x5c67('0x5e')](_0xc969f4);}return _0x7f8c8b;})[_0x5c67('0x2b')](function(_0xc003bd){if(!_0xc003bd)throw new InternalError();return _0xc003bd[_0x5c67('0x5a')]();})[_0x5c67('0x2b')](function(){_0x3e88ac[_0x5c67('0x1f')](0xcc)[_0x5c67('0x20')]();})[_0x5c67('0x47')](handleError(_0x3e88ac,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0e49028..d0da0bd 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 _0x1472=['bluebird','request-promise','path','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','moment'];(function(_0x20e602,_0x472ad6){var _0x639e2=function(_0x237e24){while(--_0x237e24){_0x20e602['push'](_0x20e602['shift']());}};_0x639e2(++_0x472ad6);}(_0x1472,0x166));var _0x2147=function(_0x32bce8,_0x54f965){_0x32bce8=_0x32bce8-0x0;var _0x38badc=_0x1472[_0x32bce8];return _0x38badc;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require(_0x2147('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2147('0x8'));module[_0x2147('0x9')]=function(_0x146353,_0x5593f4){return _0x146353['define'](_0x2147('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a83=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0x6a83,0xd2));var _0x36a8=function(_0x813210,_0x29df86){_0x813210=_0x813210-0x0;var _0x337215=_0x6a83[_0x813210];return _0x337215;};'use strict';var _=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var logger=require(_0x36a8('0x2'))(_0x36a8('0x3'));var moment=require(_0x36a8('0x4'));var BPromise=require(_0x36a8('0x5'));var rp=require(_0x36a8('0x6'));var fs=require('fs');var path=require(_0x36a8('0x7'));var rimraf=require(_0x36a8('0x8'));var config=require(_0x36a8('0x9'));var attributes=require(_0x36a8('0xa'));module[_0x36a8('0xb')]=function(_0x360b47,_0x60d79a){return _0x360b47[_0x36a8('0xc')](_0x36a8('0xd'),attributes,{'tableName':_0x36a8('0xe'),'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 7785179..ce473d2 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 _0x0adc=['request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareRecording','SquareRecording','create','body','raw','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x0adc,0x101));var _0xc0ad=function(_0x536a63,_0x48ecfe){_0x536a63=_0x536a63-0x0;var _0x109c1e=_0x0adc[_0x536a63];return _0x109c1e;};'use strict';var _=require(_0xc0ad('0x0'));var util=require('util');var moment=require(_0xc0ad('0x1'));var BPromise=require(_0xc0ad('0x2'));var rs=require(_0xc0ad('0x3'));var fs=require('fs');var Redis=require(_0xc0ad('0x4'));var db=require(_0xc0ad('0x5'))['db'];var utils=require(_0xc0ad('0x6'));var logger=require(_0xc0ad('0x7'))(_0xc0ad('0x8'));var config=require(_0xc0ad('0x9'));var jayson=require(_0xc0ad('0xa'));var client=jayson[_0xc0ad('0xb')][_0xc0ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33d5fc,_0x59c362,_0x4f28c7){return new BPromise(function(_0x4f6381,_0xae8faa){return client[_0xc0ad('0xd')](_0x33d5fc,_0x4f28c7)['then'](function(_0x1a1d6f){logger[_0xc0ad('0xe')](_0xc0ad('0xf'),_0x59c362,_0xc0ad('0x10'));logger[_0xc0ad('0x11')](_0xc0ad('0x12'),_0x59c362,_0xc0ad('0x10'),JSON[_0xc0ad('0x13')](_0x1a1d6f));if(_0x1a1d6f[_0xc0ad('0x14')]){if(_0x1a1d6f['error'][_0xc0ad('0x15')]===0x1f4){logger[_0xc0ad('0x14')](_0xc0ad('0xf'),_0x59c362,_0x1a1d6f[_0xc0ad('0x14')]['message']);return _0xae8faa(_0x1a1d6f[_0xc0ad('0x14')][_0xc0ad('0x16')]);}logger[_0xc0ad('0x14')]('SquareRecording,\x20%s,\x20%s',_0x59c362,_0x1a1d6f['error'][_0xc0ad('0x16')]);return _0x4f6381(_0x1a1d6f[_0xc0ad('0x14')][_0xc0ad('0x16')]);}else{logger[_0xc0ad('0xe')](_0xc0ad('0xf'),_0x59c362,'request\x20sent');_0x4f6381(_0x1a1d6f['result'][_0xc0ad('0x16')]);}})['catch'](function(_0x49d367){logger[_0xc0ad('0x14')](_0xc0ad('0xf'),_0x59c362,_0x49d367);_0xae8faa(_0x49d367);});});}exports[_0xc0ad('0x17')]=function(_0x5686cb){var _0x2c21d3=this;return new Promise(function(_0x2d8a11,_0x32af6d){return db[_0xc0ad('0x18')][_0xc0ad('0x19')](_0x5686cb[_0xc0ad('0x1a')],{'raw':_0x5686cb['options']?_0x5686cb['options'][_0xc0ad('0x1b')]===undefined?!![]:![]:!![]})[_0xc0ad('0x1c')](function(_0x12d1a7){logger[_0xc0ad('0xe')]('CreateSquareRecording',_0x5686cb);logger[_0xc0ad('0x11')]('CreateSquareRecording',_0x5686cb,JSON[_0xc0ad('0x13')](_0x12d1a7));_0x2d8a11(_0x12d1a7);})[_0xc0ad('0x1d')](function(_0x1fa184){logger['error']('CreateSquareRecording',_0x1fa184[_0xc0ad('0x16')],_0x5686cb);_0x32af6d(_0x2c21d3['error'](0x1f4,_0x1fa184[_0xc0ad('0x16')]));});});}; \ No newline at end of file +var _0x9672=['create','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9672,0xee));var _0x2967=function(_0x50fce1,_0x1d248a){_0x50fce1=_0x50fce1-0x0;var _0x4a56f4=_0x9672[_0x50fce1];return _0x4a56f4;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var moment=require('moment');var BPromise=require(_0x2967('0x2'));var rs=require(_0x2967('0x3'));var fs=require('fs');var Redis=require(_0x2967('0x4'));var db=require(_0x2967('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2967('0x6'))(_0x2967('0x7'));var config=require(_0x2967('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2967('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x355e82,_0x1aa9a5,_0x77f846){return new BPromise(function(_0x3bcd7e,_0xf353b6){return client[_0x2967('0xa')](_0x355e82,_0x77f846)[_0x2967('0xb')](function(_0x4aec0f){logger[_0x2967('0xc')](_0x2967('0xd'),_0x1aa9a5,_0x2967('0xe'));logger[_0x2967('0xf')](_0x2967('0x10'),_0x1aa9a5,_0x2967('0xe'),JSON['stringify'](_0x4aec0f));if(_0x4aec0f[_0x2967('0x11')]){if(_0x4aec0f['error'][_0x2967('0x12')]===0x1f4){logger['error'](_0x2967('0xd'),_0x1aa9a5,_0x4aec0f[_0x2967('0x11')]['message']);return _0xf353b6(_0x4aec0f[_0x2967('0x11')]['message']);}logger[_0x2967('0x11')](_0x2967('0xd'),_0x1aa9a5,_0x4aec0f[_0x2967('0x11')]['message']);return _0x3bcd7e(_0x4aec0f['error'][_0x2967('0x13')]);}else{logger[_0x2967('0xc')](_0x2967('0xd'),_0x1aa9a5,'request\x20sent');_0x3bcd7e(_0x4aec0f['result'][_0x2967('0x13')]);}})[_0x2967('0x14')](function(_0x1bcec9){logger[_0x2967('0x11')](_0x2967('0xd'),_0x1aa9a5,_0x1bcec9);_0xf353b6(_0x1bcec9);});});}exports[_0x2967('0x15')]=function(_0x426fee){var _0x8a7c84=this;return new Promise(function(_0x209f45,_0xc9162a){return db['SquareRecording'][_0x2967('0x16')](_0x426fee[_0x2967('0x17')],{'raw':_0x426fee[_0x2967('0x18')]?_0x426fee[_0x2967('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2967('0xb')](function(_0x1cb5e4){logger[_0x2967('0xc')]('CreateSquareRecording',_0x426fee);logger['debug'](_0x2967('0x15'),_0x426fee,JSON[_0x2967('0x19')](_0x1cb5e4));_0x209f45(_0x1cb5e4);})[_0x2967('0x14')](function(_0x10788e){logger[_0x2967('0x11')](_0x2967('0x15'),_0x10788e[_0x2967('0x13')],_0x426fee);_0xc9162a(_0x8a7c84[_0x2967('0x11')](0x1f4,_0x10788e[_0x2967('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 442d62f..8085658 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2dc255,_0x1d8576){var _0x12e373=function(_0x45d00e){while(--_0x45d00e){_0x2dc255['push'](_0x2dc255['shift']());}};_0x12e373(++_0x1d8576);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x47ca6d,_0x5f8957){var _0x558365=function(_0xe4fb4){while(--_0xe4fb4){_0x47ca6d['push'](_0x47ca6d['shift']());}};_0x558365(++_0x5f8957);}(_0xe706,0xa3));var _0x6e70=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0xe706[_0x44b346];return _0x1c2f2b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a419769..b45d6fb 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 _0xd3a9=['BOOLEAN','exports','STRING','DATE'];(function(_0x6b4e41,_0x3ed208){var _0x346877=function(_0x5b5d0e){while(--_0x5b5d0e){_0x6b4e41['push'](_0x6b4e41['shift']());}};_0x346877(++_0x3ed208);}(_0xd3a9,0x1e5));var _0x9d3a=function(_0x4371aa,_0x1d1438){_0x4371aa=_0x4371aa-0x0;var _0x33e716=_0xd3a9[_0x4371aa];return _0x33e716;};'use strict';var Sequelize=require('sequelize');module[_0x9d3a('0x0')]={'network':{'type':Sequelize[_0x9d3a('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x9d3a('0x1')]},'channel':{'type':Sequelize[_0x9d3a('0x1')]},'language':{'type':Sequelize[_0x9d3a('0x1')]},'type':{'type':Sequelize[_0x9d3a('0x1')]},'uniqueid':{'type':Sequelize[_0x9d3a('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9d3a('0x1')]},'calleridname':{'type':Sequelize[_0x9d3a('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9d3a('0x1')]},'callington':{'type':Sequelize[_0x9d3a('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9d3a('0x1')]},'rdnis':{'type':Sequelize[_0x9d3a('0x1')]},'context':{'type':Sequelize[_0x9d3a('0x1')]},'extension':{'type':Sequelize[_0x9d3a('0x1')]},'priority':{'type':Sequelize[_0x9d3a('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9d3a('0x1')]},'threadid':{'type':Sequelize[_0x9d3a('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9d3a('0x2')]},'leaveAt':{'type':Sequelize[_0x9d3a('0x2')]},'bot':{'type':Sequelize[_0x9d3a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc2ee=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x95ce2a,_0x5d5738){var _0x13879e=function(_0x39d5c0){while(--_0x39d5c0){_0x95ce2a['push'](_0x95ce2a['shift']());}};_0x13879e(++_0x5d5738);}(_0xc2ee,0x7a));var _0xec2e=function(_0x2641b0,_0x36b5d0){_0x2641b0=_0x2641b0-0x0;var _0x54731f=_0xc2ee[_0x2641b0];return _0x54731f;};'use strict';var Sequelize=require(_0xec2e('0x0'));module[_0xec2e('0x1')]={'network':{'type':Sequelize[_0xec2e('0x2')]},'network_script':{'type':Sequelize[_0xec2e('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xec2e('0x2')]},'language':{'type':Sequelize[_0xec2e('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xec2e('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xec2e('0x2')]},'callington':{'type':Sequelize[_0xec2e('0x2')]},'callingtns':{'type':Sequelize[_0xec2e('0x2')]},'dnid':{'type':Sequelize[_0xec2e('0x2')]},'rdnis':{'type':Sequelize[_0xec2e('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xec2e('0x2')]},'enhanced':{'type':Sequelize[_0xec2e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xec2e('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xec2e('0x3')]},'leaveAt':{'type':Sequelize[_0xec2e('0x3')]},'bot':{'type':Sequelize[_0xec2e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index bfa00d4..d8ea522 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 _0xdae0=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','map','SquareReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','params','rawAttributes','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x55eb1d,_0x269dd3){var _0x440291=function(_0x4af9d0){while(--_0x4af9d0){_0x55eb1d['push'](_0x55eb1d['shift']());}};_0x440291(++_0x269dd3);}(_0xdae0,0xc0));var _0x0dae=function(_0x2146ed,_0x1f9c98){_0x2146ed=_0x2146ed-0x0;var _0x3d8372=_0xdae0[_0x2146ed];return _0x3d8372;};'use strict';var emlformat=require(_0x0dae('0x0'));var rimraf=require(_0x0dae('0x1'));var zipdir=require(_0x0dae('0x2'));var jsonpatch=require(_0x0dae('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dae('0x4'));var Mustache=require(_0x0dae('0x5'));var util=require(_0x0dae('0x6'));var path=require(_0x0dae('0x7'));var sox=require(_0x0dae('0x8'));var csv=require('to-csv');var ejs=require(_0x0dae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0dae('0xa'));var crypto=require(_0x0dae('0xb'));var jsforce=require(_0x0dae('0xc'));var deskjs=require(_0x0dae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0dae('0xe'));var Papa=require(_0x0dae('0xf'));var Redis=require('ioredis');var authService=require(_0x0dae('0x10'));var qs=require(_0x0dae('0x11'));var as=require(_0x0dae('0x12'));var hardwareService=require(_0x0dae('0x13'));var logger=require('../../config/logger')(_0x0dae('0x14'));var utils=require(_0x0dae('0x15'));var config=require(_0x0dae('0x16'));var licenseUtil=require(_0x0dae('0x17'));var db=require(_0x0dae('0x18'))['db'];function respondWithStatusCode(_0x5f4e03,_0x50201b){_0x50201b=_0x50201b||0xcc;return function(_0x5c8663){if(_0x5c8663){return _0x5f4e03[_0x0dae('0x19')](_0x50201b);}return _0x5f4e03[_0x0dae('0x1a')](_0x50201b)[_0x0dae('0x1b')]();};}function respondWithResult(_0x113111,_0x289ef5){_0x289ef5=_0x289ef5||0xc8;return function(_0x36d208){if(_0x36d208){return _0x113111[_0x0dae('0x1a')](_0x289ef5)[_0x0dae('0x1c')](_0x36d208);}};}function respondWithFilteredResult(_0x19143f,_0x136a06){return function(_0x14442c){if(_0x14442c){var _0xc1edf9=typeof _0x136a06[_0x0dae('0x1d')]==='undefined'&&typeof _0x136a06[_0x0dae('0x1e')]===_0x0dae('0x1f');var _0x3bbfc9=_0x14442c[_0x0dae('0x20')];var _0x1f9aa6=_0xc1edf9?0x0:_0x136a06[_0x0dae('0x1d')];var _0x3be17b=_0xc1edf9?_0x14442c[_0x0dae('0x20')]:_0x136a06[_0x0dae('0x1d')]+_0x136a06[_0x0dae('0x1e')];var _0x5c363e;if(_0x3be17b>=_0x3bbfc9){_0x3be17b=_0x3bbfc9;_0x5c363e=0xc8;}else{_0x5c363e=0xce;}_0x19143f['status'](_0x5c363e);return _0x19143f[_0x0dae('0x21')](_0x0dae('0x22'),_0x1f9aa6+'-'+_0x3be17b+'/'+_0x3bbfc9)['json'](_0x14442c);}return null;};}function patchUpdates(_0x95224){return function(_0x1c8e79){try{jsonpatch[_0x0dae('0x23')](_0x1c8e79,_0x95224,!![]);}catch(_0x213fd8){return BPromise[_0x0dae('0x24')](_0x213fd8);}return _0x1c8e79['save']();};}function saveUpdates(_0x39111d,_0x262a99){return function(_0x103491){if(_0x103491){return _0x103491[_0x0dae('0x25')](_0x39111d)[_0x0dae('0x26')](function(_0x4ddec4){return _0x4ddec4;});}return null;};}function removeEntity(_0x3bcf7d,_0x396381){return function(_0x351176){if(_0x351176){return _0x351176['destroy']()[_0x0dae('0x26')](function(){_0x3bcf7d[_0x0dae('0x1a')](0xcc)[_0x0dae('0x1b')]();});}};}function handleEntityNotFound(_0x5d012f,_0x108d6a){return function(_0x458bcd){if(!_0x458bcd){_0x5d012f[_0x0dae('0x19')](0x194);}return _0x458bcd;};}function handleError(_0x1a0d41,_0x54bfda){_0x54bfda=_0x54bfda||0x1f4;return function(_0xd0b567){logger['error'](_0xd0b567[_0x0dae('0x27')]);if(_0xd0b567['name']){delete _0xd0b567[_0x0dae('0x28')];}_0x1a0d41[_0x0dae('0x1a')](_0x54bfda)[_0x0dae('0x29')](_0xd0b567);};}exports['index']=function(_0x100caa,_0x371995){var _0x59de45={},_0x31a97a={},_0x481a96={'count':0x0,'rows':[]};var _0x478606=_[_0x0dae('0x2a')](db[_0x0dae('0x2b')]['rawAttributes'],function(_0x27d603){return{'name':_0x27d603[_0x0dae('0x2c')],'type':_0x27d603[_0x0dae('0x2d')][_0x0dae('0x2e')]};});_0x31a97a[_0x0dae('0x2f')]=_[_0x0dae('0x2a')](_0x478606,_0x0dae('0x28'));_0x31a97a['query']=_[_0x0dae('0x30')](_0x100caa[_0x0dae('0x31')]);_0x31a97a[_0x0dae('0x32')]=_[_0x0dae('0x33')](_0x31a97a[_0x0dae('0x2f')],_0x31a97a['query']);_0x59de45[_0x0dae('0x34')]=_[_0x0dae('0x33')](_0x31a97a['model'],qs[_0x0dae('0x35')](_0x100caa[_0x0dae('0x31')]['fields']));_0x59de45['attributes']=_0x59de45[_0x0dae('0x34')][_0x0dae('0x36')]?_0x59de45['attributes']:_0x31a97a['model'];if(!_0x100caa[_0x0dae('0x31')]['hasOwnProperty'](_0x0dae('0x37'))){_0x59de45[_0x0dae('0x1e')]=qs[_0x0dae('0x1e')](_0x100caa[_0x0dae('0x31')][_0x0dae('0x1e')]);_0x59de45[_0x0dae('0x1d')]=qs[_0x0dae('0x1d')](_0x100caa[_0x0dae('0x31')][_0x0dae('0x1d')]);}_0x59de45['order']=qs[_0x0dae('0x38')](_0x100caa[_0x0dae('0x31')][_0x0dae('0x38')]);_0x59de45['where']=qs[_0x0dae('0x32')](_['pick'](_0x100caa[_0x0dae('0x31')],_0x31a97a[_0x0dae('0x32')]),_0x478606);if(_0x100caa[_0x0dae('0x31')]['filter']){_0x59de45['where']=_[_0x0dae('0x39')](_0x59de45[_0x0dae('0x3a')],{'$or':_[_0x0dae('0x2a')](_0x478606,function(_0x3e5002){if(_0x3e5002['type']!==_0x0dae('0x3b')){var _0x33b32a={};_0x33b32a[_0x3e5002['name']]={'$like':'%'+_0x100caa[_0x0dae('0x31')][_0x0dae('0x3c')]+'%'};return _0x33b32a;}})});}_0x59de45=_[_0x0dae('0x39')]({},_0x59de45,_0x100caa['options']);var _0x4b92bc={'where':_0x59de45[_0x0dae('0x3a')]};return db[_0x0dae('0x2b')]['count'](_0x4b92bc)[_0x0dae('0x26')](function(_0x482097){_0x481a96[_0x0dae('0x20')]=_0x482097;if(_0x100caa[_0x0dae('0x31')][_0x0dae('0x3d')]){_0x59de45[_0x0dae('0x3e')]=[{'all':!![]}];}return db[_0x0dae('0x2b')]['findAll'](_0x59de45);})[_0x0dae('0x26')](function(_0xd41c84){_0x481a96[_0x0dae('0x3f')]=_0xd41c84;return _0x481a96;})['then'](respondWithFilteredResult(_0x371995,_0x59de45))[_0x0dae('0x40')](handleError(_0x371995,null));};exports[_0x0dae('0x41')]=function(_0x213bd4,_0x4b39a7){var _0x1cf9e6={'raw':!![],'where':{'id':_0x213bd4[_0x0dae('0x42')]['id']}},_0xdb6e42={};_0xdb6e42[_0x0dae('0x2f')]=_['keys'](db[_0x0dae('0x2b')][_0x0dae('0x43')]);_0xdb6e42[_0x0dae('0x31')]=_[_0x0dae('0x30')](_0x213bd4[_0x0dae('0x31')]);_0xdb6e42[_0x0dae('0x32')]=_[_0x0dae('0x33')](_0xdb6e42[_0x0dae('0x2f')],_0xdb6e42[_0x0dae('0x31')]);_0x1cf9e6[_0x0dae('0x34')]=_['intersection'](_0xdb6e42['model'],qs[_0x0dae('0x35')](_0x213bd4[_0x0dae('0x31')][_0x0dae('0x35')]));_0x1cf9e6[_0x0dae('0x34')]=_0x1cf9e6['attributes'][_0x0dae('0x36')]?_0x1cf9e6[_0x0dae('0x34')]:_0xdb6e42[_0x0dae('0x2f')];if(_0x213bd4[_0x0dae('0x31')][_0x0dae('0x3d')]){_0x1cf9e6[_0x0dae('0x3e')]=[{'all':!![]}];}_0x1cf9e6=_[_0x0dae('0x39')]({},_0x1cf9e6,_0x213bd4[_0x0dae('0x44')]);return db['SquareReport']['find'](_0x1cf9e6)[_0x0dae('0x26')](handleEntityNotFound(_0x4b39a7,null))['then'](respondWithResult(_0x4b39a7,null))[_0x0dae('0x40')](handleError(_0x4b39a7,null));};exports[_0x0dae('0x45')]=function(_0x133fb0,_0x3b9df4){return db[_0x0dae('0x2b')][_0x0dae('0x45')](_0x133fb0[_0x0dae('0x46')],{})[_0x0dae('0x26')](respondWithResult(_0x3b9df4,0xc9))[_0x0dae('0x40')](handleError(_0x3b9df4,null));};exports[_0x0dae('0x25')]=function(_0x5a7d0e,_0xbbe71f){if(_0x5a7d0e[_0x0dae('0x46')]['id']){delete _0x5a7d0e[_0x0dae('0x46')]['id'];}return db[_0x0dae('0x2b')][_0x0dae('0x47')]({'where':{'id':_0x5a7d0e[_0x0dae('0x42')]['id']}})[_0x0dae('0x26')](handleEntityNotFound(_0xbbe71f,null))['then'](saveUpdates(_0x5a7d0e[_0x0dae('0x46')],null))[_0x0dae('0x26')](respondWithResult(_0xbbe71f,null))[_0x0dae('0x40')](handleError(_0xbbe71f,null));};exports['destroy']=function(_0x362ff4,_0x1bc902){return db['SquareReport'][_0x0dae('0x47')]({'where':{'id':_0x362ff4[_0x0dae('0x42')]['id']}})[_0x0dae('0x26')](handleEntityNotFound(_0x1bc902,null))['then'](removeEntity(_0x1bc902,null))['catch'](handleError(_0x1bc902,null));};exports[_0x0dae('0x48')]=function(_0x50e3db,_0x35e194){return db['SquareReport'][_0x0dae('0x48')]()[_0x0dae('0x26')](respondWithResult(_0x35e194,null))[_0x0dae('0x40')](handleError(_0x35e194,null));}; \ No newline at end of file +var _0x10fb=['catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','reject','save','update','then','destroy','error','name','index','SquareReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','findAll','params','includeAll','find','create','body'];(function(_0x492fe3,_0x387a63){var _0x328a8a=function(_0x5a6eff){while(--_0x5a6eff){_0x492fe3['push'](_0x492fe3['shift']());}};_0x328a8a(++_0x387a63);}(_0x10fb,0x126));var _0xb10f=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0x10fb[_0x244862];return _0x2bce23;};'use strict';var emlformat=require(_0xb10f('0x0'));var rimraf=require(_0xb10f('0x1'));var zipdir=require(_0xb10f('0x2'));var jsonpatch=require(_0xb10f('0x3'));var rp=require(_0xb10f('0x4'));var moment=require('moment');var BPromise=require(_0xb10f('0x5'));var Mustache=require(_0xb10f('0x6'));var util=require(_0xb10f('0x7'));var path=require(_0xb10f('0x8'));var sox=require(_0xb10f('0x9'));var csv=require('to-csv');var ejs=require(_0xb10f('0xa'));var fs=require('fs');var fs_extra=require(_0xb10f('0xb'));var _=require(_0xb10f('0xc'));var squel=require(_0xb10f('0xd'));var crypto=require(_0xb10f('0xe'));var jsforce=require(_0xb10f('0xf'));var deskjs=require(_0xb10f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb10f('0x11'));var Papa=require(_0xb10f('0x12'));var Redis=require(_0xb10f('0x13'));var authService=require(_0xb10f('0x14'));var qs=require(_0xb10f('0x15'));var as=require(_0xb10f('0x16'));var hardwareService=require(_0xb10f('0x17'));var logger=require('../../config/logger')(_0xb10f('0x18'));var utils=require(_0xb10f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb10f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa3edbd,_0x4829db){_0x4829db=_0x4829db||0xcc;return function(_0x36b999){if(_0x36b999){return _0xa3edbd[_0xb10f('0x1b')](_0x4829db);}return _0xa3edbd[_0xb10f('0x1c')](_0x4829db)[_0xb10f('0x1d')]();};}function respondWithResult(_0x321e4f,_0x23bc7b){_0x23bc7b=_0x23bc7b||0xc8;return function(_0x45821f){if(_0x45821f){return _0x321e4f[_0xb10f('0x1c')](_0x23bc7b)['json'](_0x45821f);}};}function respondWithFilteredResult(_0x5e0472,_0x326496){return function(_0x285d23){if(_0x285d23){var _0x506a75=typeof _0x326496['offset']===_0xb10f('0x1e')&&typeof _0x326496[_0xb10f('0x1f')]===_0xb10f('0x1e');var _0x118768=_0x285d23['count'];var _0x58fc06=_0x506a75?0x0:_0x326496[_0xb10f('0x20')];var _0x408f31=_0x506a75?_0x285d23[_0xb10f('0x21')]:_0x326496[_0xb10f('0x20')]+_0x326496['limit'];var _0x532e43;if(_0x408f31>=_0x118768){_0x408f31=_0x118768;_0x532e43=0xc8;}else{_0x532e43=0xce;}_0x5e0472[_0xb10f('0x1c')](_0x532e43);return _0x5e0472['set'](_0xb10f('0x22'),_0x58fc06+'-'+_0x408f31+'/'+_0x118768)[_0xb10f('0x23')](_0x285d23);}return null;};}function patchUpdates(_0xaed06b){return function(_0x26e9a5){try{jsonpatch['apply'](_0x26e9a5,_0xaed06b,!![]);}catch(_0x4406bc){return BPromise[_0xb10f('0x24')](_0x4406bc);}return _0x26e9a5[_0xb10f('0x25')]();};}function saveUpdates(_0x306ed7,_0x4d89f2){return function(_0x58b974){if(_0x58b974){return _0x58b974[_0xb10f('0x26')](_0x306ed7)[_0xb10f('0x27')](function(_0x200a8f){return _0x200a8f;});}return null;};}function removeEntity(_0x480bb2,_0x32cb25){return function(_0x178135){if(_0x178135){return _0x178135[_0xb10f('0x28')]()['then'](function(){_0x480bb2[_0xb10f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541a9e,_0x1a8e3b){return function(_0x55a455){if(!_0x55a455){_0x541a9e[_0xb10f('0x1b')](0x194);}return _0x55a455;};}function handleError(_0x34ec29,_0x551c5e){_0x551c5e=_0x551c5e||0x1f4;return function(_0x3ae84a){logger[_0xb10f('0x29')](_0x3ae84a['stack']);if(_0x3ae84a['name']){delete _0x3ae84a[_0xb10f('0x2a')];}_0x34ec29[_0xb10f('0x1c')](_0x551c5e)['send'](_0x3ae84a);};}exports[_0xb10f('0x2b')]=function(_0x4e82cc,_0x21ad39){var _0x221bd2={},_0x89720d={},_0x38093d={'count':0x0,'rows':[]};var _0x4256c6=_['map'](db[_0xb10f('0x2c')][_0xb10f('0x2d')],function(_0x17e495){return{'name':_0x17e495[_0xb10f('0x2e')],'type':_0x17e495['type']['key']};});_0x89720d[_0xb10f('0x2f')]=_[_0xb10f('0x30')](_0x4256c6,_0xb10f('0x2a'));_0x89720d[_0xb10f('0x31')]=_[_0xb10f('0x32')](_0x4e82cc[_0xb10f('0x31')]);_0x89720d[_0xb10f('0x33')]=_[_0xb10f('0x34')](_0x89720d[_0xb10f('0x2f')],_0x89720d[_0xb10f('0x31')]);_0x221bd2[_0xb10f('0x35')]=_[_0xb10f('0x34')](_0x89720d[_0xb10f('0x2f')],qs[_0xb10f('0x36')](_0x4e82cc[_0xb10f('0x31')]['fields']));_0x221bd2[_0xb10f('0x35')]=_0x221bd2[_0xb10f('0x35')][_0xb10f('0x37')]?_0x221bd2[_0xb10f('0x35')]:_0x89720d[_0xb10f('0x2f')];if(!_0x4e82cc[_0xb10f('0x31')][_0xb10f('0x38')](_0xb10f('0x39'))){_0x221bd2[_0xb10f('0x1f')]=qs[_0xb10f('0x1f')](_0x4e82cc[_0xb10f('0x31')][_0xb10f('0x1f')]);_0x221bd2[_0xb10f('0x20')]=qs[_0xb10f('0x20')](_0x4e82cc[_0xb10f('0x31')][_0xb10f('0x20')]);}_0x221bd2[_0xb10f('0x3a')]=qs['sort'](_0x4e82cc[_0xb10f('0x31')]['sort']);_0x221bd2['where']=qs[_0xb10f('0x33')](_[_0xb10f('0x3b')](_0x4e82cc[_0xb10f('0x31')],_0x89720d['filters']),_0x4256c6);if(_0x4e82cc[_0xb10f('0x31')][_0xb10f('0x3c')]){_0x221bd2[_0xb10f('0x3d')]=_[_0xb10f('0x3e')](_0x221bd2[_0xb10f('0x3d')],{'$or':_[_0xb10f('0x30')](_0x4256c6,function(_0x1fb895){if(_0x1fb895['type']!==_0xb10f('0x3f')){var _0x4e9214={};_0x4e9214[_0x1fb895[_0xb10f('0x2a')]]={'$like':'%'+_0x4e82cc[_0xb10f('0x31')]['filter']+'%'};return _0x4e9214;}})});}_0x221bd2=_['merge']({},_0x221bd2,_0x4e82cc[_0xb10f('0x40')]);var _0x541f81={'where':_0x221bd2[_0xb10f('0x3d')]};return db[_0xb10f('0x2c')][_0xb10f('0x21')](_0x541f81)[_0xb10f('0x27')](function(_0x1585f5){_0x38093d['count']=_0x1585f5;if(_0x4e82cc['query']['includeAll']){_0x221bd2['include']=[{'all':!![]}];}return db[_0xb10f('0x2c')][_0xb10f('0x41')](_0x221bd2);})['then'](function(_0x352012){_0x38093d['rows']=_0x352012;return _0x38093d;})['then'](respondWithFilteredResult(_0x21ad39,_0x221bd2))['catch'](handleError(_0x21ad39,null));};exports['show']=function(_0x42a616,_0x23bcb3){var _0x30eee9={'raw':!![],'where':{'id':_0x42a616[_0xb10f('0x42')]['id']}},_0x4c62c9={};_0x4c62c9[_0xb10f('0x2f')]=_[_0xb10f('0x32')](db[_0xb10f('0x2c')][_0xb10f('0x2d')]);_0x4c62c9[_0xb10f('0x31')]=_['keys'](_0x42a616[_0xb10f('0x31')]);_0x4c62c9['filters']=_['intersection'](_0x4c62c9[_0xb10f('0x2f')],_0x4c62c9[_0xb10f('0x31')]);_0x30eee9['attributes']=_['intersection'](_0x4c62c9['model'],qs[_0xb10f('0x36')](_0x42a616['query']['fields']));_0x30eee9[_0xb10f('0x35')]=_0x30eee9[_0xb10f('0x35')][_0xb10f('0x37')]?_0x30eee9[_0xb10f('0x35')]:_0x4c62c9['model'];if(_0x42a616['query'][_0xb10f('0x43')]){_0x30eee9['include']=[{'all':!![]}];}_0x30eee9=_[_0xb10f('0x3e')]({},_0x30eee9,_0x42a616['options']);return db['SquareReport'][_0xb10f('0x44')](_0x30eee9)[_0xb10f('0x27')](handleEntityNotFound(_0x23bcb3,null))[_0xb10f('0x27')](respondWithResult(_0x23bcb3,null))['catch'](handleError(_0x23bcb3,null));};exports['create']=function(_0x564d29,_0x2bdca8){return db[_0xb10f('0x2c')][_0xb10f('0x45')](_0x564d29[_0xb10f('0x46')],{})[_0xb10f('0x27')](respondWithResult(_0x2bdca8,0xc9))[_0xb10f('0x47')](handleError(_0x2bdca8,null));};exports[_0xb10f('0x26')]=function(_0x5cdab2,_0x11bee6){if(_0x5cdab2[_0xb10f('0x46')]['id']){delete _0x5cdab2[_0xb10f('0x46')]['id'];}return db[_0xb10f('0x2c')]['find']({'where':{'id':_0x5cdab2[_0xb10f('0x42')]['id']}})[_0xb10f('0x27')](handleEntityNotFound(_0x11bee6,null))[_0xb10f('0x27')](saveUpdates(_0x5cdab2[_0xb10f('0x46')],null))[_0xb10f('0x27')](respondWithResult(_0x11bee6,null))['catch'](handleError(_0x11bee6,null));};exports['destroy']=function(_0x1e8194,_0x1cdf0f){return db[_0xb10f('0x2c')][_0xb10f('0x44')]({'where':{'id':_0x1e8194[_0xb10f('0x42')]['id']}})[_0xb10f('0x27')](handleEntityNotFound(_0x1cdf0f,null))[_0xb10f('0x27')](removeEntity(_0x1cdf0f,null))[_0xb10f('0x47')](handleError(_0x1cdf0f,null));};exports['describe']=function(_0x1821e1,_0x21e3f9){return db[_0xb10f('0x2c')][_0xb10f('0x48')]()[_0xb10f('0x27')](respondWithResult(_0x21e3f9,null))[_0xb10f('0x47')](handleError(_0x21e3f9,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 89c2982..2f8f347 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 _0xb0af=['moment','bluebird','request-promise','../../config/environment','exports','SquareReport','report_square','uid_pname','leaveAt','util','../../config/logger','api'];(function(_0x32a923,_0x524c14){var _0x11677d=function(_0x3cc314){while(--_0x3cc314){_0x32a923['push'](_0x32a923['shift']());}};_0x11677d(++_0x524c14);}(_0xb0af,0xf9));var _0xfb0a=function(_0x53f9c2,_0x5659e9){_0x53f9c2=_0x53f9c2-0x0;var _0x960075=_0xb0af[_0x53f9c2];return _0x960075;};'use strict';var _=require('lodash');var util=require(_0xfb0a('0x0'));var logger=require(_0xfb0a('0x1'))(_0xfb0a('0x2'));var moment=require(_0xfb0a('0x3'));var BPromise=require(_0xfb0a('0x4'));var rp=require(_0xfb0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb0a('0x6'));var attributes=require('./squareReport.attributes');module[_0xfb0a('0x7')]=function(_0x8ce9ae,_0x3a4c94){return _0x8ce9ae['define'](_0xfb0a('0x8'),attributes,{'tableName':_0xfb0a('0x9'),'paranoid':![],'indexes':[{'name':_0xfb0a('0xa'),'fields':['uniqueid','project_name']},{'name':_0xfb0a('0xb'),'fields':[_0xfb0a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9a6=['api','moment','bluebird','request-promise','path','../../config/environment','exports','SquareReport','project_name','leaveAt','util'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xe9a6,0x78));var _0x6e9a=function(_0x13e407,_0x58b7ba){_0x13e407=_0x13e407-0x0;var _0x3c55ec=_0xe9a6[_0x13e407];return _0x3c55ec;};'use strict';var _=require('lodash');var util=require(_0x6e9a('0x0'));var logger=require('../../config/logger')(_0x6e9a('0x1'));var moment=require(_0x6e9a('0x2'));var BPromise=require(_0x6e9a('0x3'));var rp=require(_0x6e9a('0x4'));var fs=require('fs');var path=require(_0x6e9a('0x5'));var rimraf=require('rimraf');var config=require(_0x6e9a('0x6'));var attributes=require('./squareReport.attributes');module[_0x6e9a('0x7')]=function(_0x583191,_0x4b4d20){return _0x583191['define'](_0x6e9a('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x6e9a('0x9')]},{'name':_0x6e9a('0xa'),'fields':[_0x6e9a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b615d5d..2640628 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 _0xcaa0=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','where','limit','lodash','util','moment','bluebird'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcaa0,0x84));var _0x0caa=function(_0x14a4d0,_0x4c7068){_0x14a4d0=_0x14a4d0-0x0;var _0x18c8ab=_0xcaa0[_0x14a4d0];return _0x18c8ab;};'use strict';var _=require(_0x0caa('0x0'));var util=require(_0x0caa('0x1'));var moment=require(_0x0caa('0x2'));var BPromise=require(_0x0caa('0x3'));var rs=require(_0x0caa('0x4'));var fs=require('fs');var Redis=require(_0x0caa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0caa('0x6'));var logger=require(_0x0caa('0x7'))(_0x0caa('0x8'));var config=require(_0x0caa('0x9'));var jayson=require(_0x0caa('0xa'));var client=jayson['client'][_0x0caa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58fff7,_0x5e9b76,_0x419572){return new BPromise(function(_0x39c85c,_0x472177){return client[_0x0caa('0xc')](_0x58fff7,_0x419572)[_0x0caa('0xd')](function(_0x1dde9a){logger[_0x0caa('0xe')](_0x0caa('0xf'),_0x5e9b76,_0x0caa('0x10'));logger['debug'](_0x0caa('0x11'),_0x5e9b76,_0x0caa('0x10'),JSON[_0x0caa('0x12')](_0x1dde9a));if(_0x1dde9a[_0x0caa('0x13')]){if(_0x1dde9a[_0x0caa('0x13')][_0x0caa('0x14')]===0x1f4){logger['error'](_0x0caa('0xf'),_0x5e9b76,_0x1dde9a[_0x0caa('0x13')][_0x0caa('0x15')]);return _0x472177(_0x1dde9a[_0x0caa('0x13')]['message']);}logger[_0x0caa('0x13')](_0x0caa('0xf'),_0x5e9b76,_0x1dde9a['error'][_0x0caa('0x15')]);return _0x39c85c(_0x1dde9a['error'][_0x0caa('0x15')]);}else{logger['info'](_0x0caa('0xf'),_0x5e9b76,'request\x20sent');_0x39c85c(_0x1dde9a[_0x0caa('0x16')][_0x0caa('0x15')]);}})[_0x0caa('0x17')](function(_0x2b1a53){logger[_0x0caa('0x13')](_0x0caa('0xf'),_0x5e9b76,_0x2b1a53);_0x472177(_0x2b1a53);});});}exports[_0x0caa('0x18')]=function(_0x387fbe){var _0x4317cc=this;return new Promise(function(_0x3c60e9,_0xa69bd9){return db[_0x0caa('0x19')][_0x0caa('0x1a')](_0x387fbe[_0x0caa('0x1b')],{'raw':_0x387fbe['options']?_0x387fbe[_0x0caa('0x1c')][_0x0caa('0x1d')]===undefined?!![]:![]:!![]})[_0x0caa('0xd')](function(_0x393768){logger[_0x0caa('0xe')]('CreateSquareReport',_0x387fbe);logger[_0x0caa('0x1e')](_0x0caa('0x18'),_0x387fbe,JSON[_0x0caa('0x12')](_0x393768));_0x3c60e9(_0x393768);})[_0x0caa('0x17')](function(_0x21245f){logger[_0x0caa('0x13')](_0x0caa('0x18'),_0x21245f['message'],_0x387fbe);_0xa69bd9(_0x4317cc[_0x0caa('0x13')](0x1f4,_0x21245f[_0x0caa('0x15')]));});});};exports[_0x0caa('0x1f')]=function(_0x200497){var _0x40200c=this;return new Promise(function(_0x2652cd,_0x44b9ef){return db[_0x0caa('0x19')]['update'](_0x200497['body'],{'raw':_0x200497[_0x0caa('0x1c')]?_0x200497[_0x0caa('0x1c')][_0x0caa('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200497[_0x0caa('0x1c')]?_0x200497[_0x0caa('0x1c')][_0x0caa('0x20')]||null:null,'attributes':_0x200497[_0x0caa('0x1c')]?_0x200497['options']['attributes']||null:null,'limit':_0x200497[_0x0caa('0x1c')]?_0x200497['options'][_0x0caa('0x21')]||null:null})[_0x0caa('0xd')](function(_0x2fa0c0){logger['info'](_0x0caa('0x1f'),_0x200497);logger[_0x0caa('0x1e')](_0x0caa('0x1f'),_0x200497,JSON[_0x0caa('0x12')](_0x2fa0c0));_0x2652cd(_0x2fa0c0);})[_0x0caa('0x17')](function(_0xe0244d){logger[_0x0caa('0x13')]('UpdateSquareReport',_0xe0244d[_0x0caa('0x15')],_0x200497);_0x44b9ef(_0x40200c[_0x0caa('0x13')](0x1f4,_0xe0244d['message']));});});}; \ No newline at end of file +var _0xd1ac=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53df17,_0x23c7ac){var _0x13908f=function(_0x14e5c8){while(--_0x14e5c8){_0x53df17['push'](_0x53df17['shift']());}};_0x13908f(++_0x23c7ac);}(_0xd1ac,0x17b));var _0xcd1a=function(_0xc8a337,_0x52062b){_0xc8a337=_0xc8a337-0x0;var _0x4d3d9b=_0xd1ac[_0xc8a337];return _0x4d3d9b;};'use strict';var _=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var moment=require(_0xcd1a('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd1a('0x3'));var fs=require('fs');var Redis=require(_0xcd1a('0x4'));var db=require(_0xcd1a('0x5'))['db'];var utils=require(_0xcd1a('0x6'));var logger=require(_0xcd1a('0x7'))(_0xcd1a('0x8'));var config=require('../../config/environment');var jayson=require(_0xcd1a('0x9'));var client=jayson['client'][_0xcd1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597a81,_0x45c178,_0x48b74b){return new BPromise(function(_0x35903f,_0x2b30a2){return client[_0xcd1a('0xb')](_0x597a81,_0x48b74b)[_0xcd1a('0xc')](function(_0x450097){logger[_0xcd1a('0xd')](_0xcd1a('0xe'),_0x45c178,_0xcd1a('0xf'));logger[_0xcd1a('0x10')](_0xcd1a('0x11'),_0x45c178,_0xcd1a('0xf'),JSON[_0xcd1a('0x12')](_0x450097));if(_0x450097[_0xcd1a('0x13')]){if(_0x450097['error'][_0xcd1a('0x14')]===0x1f4){logger[_0xcd1a('0x13')](_0xcd1a('0xe'),_0x45c178,_0x450097[_0xcd1a('0x13')][_0xcd1a('0x15')]);return _0x2b30a2(_0x450097[_0xcd1a('0x13')][_0xcd1a('0x15')]);}logger[_0xcd1a('0x13')](_0xcd1a('0xe'),_0x45c178,_0x450097[_0xcd1a('0x13')][_0xcd1a('0x15')]);return _0x35903f(_0x450097['error'][_0xcd1a('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x45c178,_0xcd1a('0xf'));_0x35903f(_0x450097['result'][_0xcd1a('0x15')]);}})[_0xcd1a('0x16')](function(_0x3d73cb){logger[_0xcd1a('0x13')]('SquareReport,\x20%s,\x20%s',_0x45c178,_0x3d73cb);_0x2b30a2(_0x3d73cb);});});}exports[_0xcd1a('0x17')]=function(_0x2c862c){var _0x83a08a=this;return new Promise(function(_0x55870d,_0xc3e7be){return db[_0xcd1a('0x18')][_0xcd1a('0x19')](_0x2c862c['body'],{'raw':_0x2c862c['options']?_0x2c862c[_0xcd1a('0x1a')][_0xcd1a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31d183){logger[_0xcd1a('0xd')](_0xcd1a('0x17'),_0x2c862c);logger[_0xcd1a('0x10')]('CreateSquareReport',_0x2c862c,JSON[_0xcd1a('0x12')](_0x31d183));_0x55870d(_0x31d183);})['catch'](function(_0x3e1cc5){logger[_0xcd1a('0x13')](_0xcd1a('0x17'),_0x3e1cc5['message'],_0x2c862c);_0xc3e7be(_0x83a08a['error'](0x1f4,_0x3e1cc5[_0xcd1a('0x15')]));});});};exports[_0xcd1a('0x1c')]=function(_0xb872b0){var _0xc4d573=this;return new Promise(function(_0x45e522,_0x5e0fcf){return db[_0xcd1a('0x18')][_0xcd1a('0x1d')](_0xb872b0[_0xcd1a('0x1e')],{'raw':_0xb872b0[_0xcd1a('0x1a')]?_0xb872b0[_0xcd1a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb872b0[_0xcd1a('0x1a')]?_0xb872b0[_0xcd1a('0x1a')]['where']||null:null,'attributes':_0xb872b0['options']?_0xb872b0[_0xcd1a('0x1a')][_0xcd1a('0x1f')]||null:null,'limit':_0xb872b0[_0xcd1a('0x1a')]?_0xb872b0[_0xcd1a('0x1a')][_0xcd1a('0x20')]||null:null})['then'](function(_0x405dd8){logger[_0xcd1a('0xd')]('UpdateSquareReport',_0xb872b0);logger[_0xcd1a('0x10')]('UpdateSquareReport',_0xb872b0,JSON[_0xcd1a('0x12')](_0x405dd8));_0x45e522(_0x405dd8);})[_0xcd1a('0x16')](function(_0x30eaf4){logger[_0xcd1a('0x13')]('UpdateSquareReport',_0x30eaf4[_0xcd1a('0x15')],_0xb872b0);_0x5e0fcf(_0xc4d573[_0xcd1a('0x13')](0x1f4,_0x30eaf4[_0xcd1a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ed73996..01dab7d 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 _0xf6b2=['create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x1a637a,_0x477cf1){var _0x43dd2f=function(_0x46c6bc){while(--_0x46c6bc){_0x1a637a['push'](_0x1a637a['shift']());}};_0x43dd2f(++_0x477cf1);}(_0xf6b2,0xc1));var _0x2f6b=function(_0x4f45e6,_0x209926){_0x4f45e6=_0x4f45e6-0x0;var _0x2c5b2c=_0xf6b2[_0x4f45e6];return _0x2c5b2c;};'use strict';var multer=require(_0x2f6b('0x0'));var util=require(_0x2f6b('0x1'));var path=require(_0x2f6b('0x2'));var timeout=require(_0x2f6b('0x3'));var express=require('express');var router=express[_0x2f6b('0x4')]();var fs_extra=require(_0x2f6b('0x5'));var auth=require(_0x2f6b('0x6'));var interaction=require(_0x2f6b('0x7'));var config=require(_0x2f6b('0x8'));var controller=require(_0x2f6b('0x9'));router[_0x2f6b('0xa')]('/',auth[_0x2f6b('0xb')](),controller['index']);router[_0x2f6b('0xa')](_0x2f6b('0xc'),auth[_0x2f6b('0xb')](),controller[_0x2f6b('0xd')]);router[_0x2f6b('0xa')](_0x2f6b('0xe'),auth['isAuthenticated'](),controller[_0x2f6b('0xf')]);router[_0x2f6b('0x10')]('/',auth['isAuthenticated'](),controller[_0x2f6b('0x11')]);router['put'](_0x2f6b('0xe'),auth[_0x2f6b('0xb')](),controller[_0x2f6b('0x12')]);router[_0x2f6b('0x13')]('/:id',auth[_0x2f6b('0xb')](),controller['destroy']);module[_0x2f6b('0x14')]=router; \ No newline at end of file +var _0x490f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x490f,0x1c6));var _0xf490=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x490f[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xf490('0x0'));var path=require(_0xf490('0x1'));var timeout=require(_0xf490('0x2'));var express=require(_0xf490('0x3'));var router=express[_0xf490('0x4')]();var fs_extra=require(_0xf490('0x5'));var auth=require(_0xf490('0x6'));var interaction=require(_0xf490('0x7'));var config=require(_0xf490('0x8'));var controller=require(_0xf490('0x9'));router[_0xf490('0xa')]('/',auth[_0xf490('0xb')](),controller['index']);router[_0xf490('0xa')]('/describe',auth[_0xf490('0xb')](),controller['describe']);router[_0xf490('0xa')](_0xf490('0xc'),auth['isAuthenticated'](),controller[_0xf490('0xd')]);router[_0xf490('0xe')]('/',auth[_0xf490('0xb')](),controller[_0xf490('0xf')]);router[_0xf490('0x10')](_0xf490('0xc'),auth[_0xf490('0xb')](),controller[_0xf490('0x11')]);router[_0xf490('0x12')](_0xf490('0xc'),auth[_0xf490('0xb')](),controller[_0xf490('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e1ec810..20b6e12 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 _0xb0b7=['sequelize','exports','STRING','TEXT'];(function(_0x35ccd8,_0xc4285d){var _0x3535ad=function(_0x416c2a){while(--_0x416c2a){_0x35ccd8['push'](_0x35ccd8['shift']());}};_0x3535ad(++_0xc4285d);}(_0xb0b7,0x158));var _0x7b0b=function(_0x297bf9,_0x3ed549){_0x297bf9=_0x297bf9-0x0;var _0x3e86dc=_0xb0b7[_0x297bf9];return _0x3e86dc;};'use strict';var Sequelize=require(_0x7b0b('0x0'));module[_0x7b0b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x7b0b('0x2')]},'application':{'type':Sequelize[_0x7b0b('0x2')]},'data':{'type':Sequelize[_0x7b0b('0x3')]},'project_name':{'type':Sequelize[_0x7b0b('0x2')]},'callerid':{'type':Sequelize[_0x7b0b('0x2')]}}; \ No newline at end of file +var _0x5df0=['TEXT','exports','STRING'];(function(_0x343c9a,_0x38ef23){var _0x3a8295=function(_0x3d5606){while(--_0x3d5606){_0x343c9a['push'](_0x343c9a['shift']());}};_0x3a8295(++_0x38ef23);}(_0x5df0,0xee));var _0x05df=function(_0x18d7d2,_0x5b63ff){_0x18d7d2=_0x18d7d2-0x0;var _0x1b3001=_0x5df0[_0x18d7d2];return _0x1b3001;};'use strict';var Sequelize=require('sequelize');module[_0x05df('0x0')]={'uniqueid':{'type':Sequelize[_0x05df('0x1')]},'node':{'type':Sequelize[_0x05df('0x1')]},'application':{'type':Sequelize[_0x05df('0x1')]},'data':{'type':Sequelize[_0x05df('0x2')]},'project_name':{'type':Sequelize[_0x05df('0x1')]},'callerid':{'type':Sequelize[_0x05df('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index fe35ce9..ed19084 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 _0xec5a=['name','index','map','SquareDetailsReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','keys','options','find','catch','create','body','destroy','params','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','apply','reject','update','then','sendStatus','error'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xec5a,0x135));var _0xaec5=function(_0x582ba8,_0xf9bd8d){_0x582ba8=_0x582ba8-0x0;var _0x2bcfb8=_0xec5a[_0x582ba8];return _0x2bcfb8;};'use strict';var emlformat=require(_0xaec5('0x0'));var rimraf=require(_0xaec5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaec5('0x2'));var BPromise=require(_0xaec5('0x3'));var Mustache=require(_0xaec5('0x4'));var util=require(_0xaec5('0x5'));var path=require(_0xaec5('0x6'));var sox=require(_0xaec5('0x7'));var csv=require(_0xaec5('0x8'));var ejs=require(_0xaec5('0x9'));var fs=require('fs');var fs_extra=require(_0xaec5('0xa'));var _=require(_0xaec5('0xb'));var squel=require(_0xaec5('0xc'));var crypto=require('crypto');var jsforce=require(_0xaec5('0xd'));var deskjs=require(_0xaec5('0xe'));var toCsv=require(_0xaec5('0x8'));var querystring=require(_0xaec5('0xf'));var Papa=require(_0xaec5('0x10'));var Redis=require('ioredis');var authService=require(_0xaec5('0x11'));var qs=require(_0xaec5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaec5('0x13'));var logger=require('../../config/logger')(_0xaec5('0x14'));var utils=require('../../config/utils');var config=require(_0xaec5('0x15'));var licenseUtil=require(_0xaec5('0x16'));var db=require(_0xaec5('0x17'))['db'];function respondWithStatusCode(_0x1083cb,_0x507670){_0x507670=_0x507670||0xcc;return function(_0x2a4797){if(_0x2a4797){return _0x1083cb['sendStatus'](_0x507670);}return _0x1083cb['status'](_0x507670)[_0xaec5('0x18')]();};}function respondWithResult(_0x40737e,_0x3fce6b){_0x3fce6b=_0x3fce6b||0xc8;return function(_0x39c6a1){if(_0x39c6a1){return _0x40737e['status'](_0x3fce6b)[_0xaec5('0x19')](_0x39c6a1);}};}function respondWithFilteredResult(_0x255508,_0x1b965a){return function(_0x3e9b25){if(_0x3e9b25){var _0x201c3a=typeof _0x1b965a[_0xaec5('0x1a')]===_0xaec5('0x1b')&&typeof _0x1b965a[_0xaec5('0x1c')]===_0xaec5('0x1b');var _0x480a36=_0x3e9b25[_0xaec5('0x1d')];var _0x192261=_0x201c3a?0x0:_0x1b965a[_0xaec5('0x1a')];var _0x8093bb=_0x201c3a?_0x3e9b25['count']:_0x1b965a[_0xaec5('0x1a')]+_0x1b965a[_0xaec5('0x1c')];var _0x2eb43d;if(_0x8093bb>=_0x480a36){_0x8093bb=_0x480a36;_0x2eb43d=0xc8;}else{_0x2eb43d=0xce;}_0x255508['status'](_0x2eb43d);return _0x255508['set']('Content-Range',_0x192261+'-'+_0x8093bb+'/'+_0x480a36)['json'](_0x3e9b25);}return null;};}function patchUpdates(_0x3b563d){return function(_0x115ea7){try{jsonpatch[_0xaec5('0x1e')](_0x115ea7,_0x3b563d,!![]);}catch(_0x4032dd){return BPromise[_0xaec5('0x1f')](_0x4032dd);}return _0x115ea7['save']();};}function saveUpdates(_0x23a876,_0x3008ba){return function(_0x42e472){if(_0x42e472){return _0x42e472[_0xaec5('0x20')](_0x23a876)[_0xaec5('0x21')](function(_0x39610e){return _0x39610e;});}return null;};}function removeEntity(_0x2fe9e1,_0x187c38){return function(_0x4e5bd3){if(_0x4e5bd3){return _0x4e5bd3['destroy']()[_0xaec5('0x21')](function(){_0x2fe9e1['status'](0xcc)[_0xaec5('0x18')]();});}};}function handleEntityNotFound(_0xdc3f00,_0x112ab1){return function(_0x29486a){if(!_0x29486a){_0xdc3f00[_0xaec5('0x22')](0x194);}return _0x29486a;};}function handleError(_0xba00a5,_0x293800){_0x293800=_0x293800||0x1f4;return function(_0x550b12){logger[_0xaec5('0x23')](_0x550b12['stack']);if(_0x550b12[_0xaec5('0x24')]){delete _0x550b12[_0xaec5('0x24')];}_0xba00a5['status'](_0x293800)['send'](_0x550b12);};}exports[_0xaec5('0x25')]=function(_0x2211f,_0x1568fd){var _0x22bdf6={},_0x4ede7d={},_0x18af1c={'count':0x0,'rows':[]};var _0x23849d=_[_0xaec5('0x26')](db[_0xaec5('0x27')][_0xaec5('0x28')],function(_0x28f0a3){return{'name':_0x28f0a3['fieldName'],'type':_0x28f0a3[_0xaec5('0x29')][_0xaec5('0x2a')]};});_0x4ede7d['model']=_[_0xaec5('0x26')](_0x23849d,'name');_0x4ede7d[_0xaec5('0x2b')]=_['keys'](_0x2211f[_0xaec5('0x2b')]);_0x4ede7d[_0xaec5('0x2c')]=_[_0xaec5('0x2d')](_0x4ede7d[_0xaec5('0x2e')],_0x4ede7d[_0xaec5('0x2b')]);_0x22bdf6[_0xaec5('0x2f')]=_['intersection'](_0x4ede7d[_0xaec5('0x2e')],qs[_0xaec5('0x30')](_0x2211f[_0xaec5('0x2b')][_0xaec5('0x30')]));_0x22bdf6[_0xaec5('0x2f')]=_0x22bdf6[_0xaec5('0x2f')][_0xaec5('0x31')]?_0x22bdf6[_0xaec5('0x2f')]:_0x4ede7d['model'];if(!_0x2211f[_0xaec5('0x2b')]['hasOwnProperty'](_0xaec5('0x32'))){_0x22bdf6[_0xaec5('0x1c')]=qs[_0xaec5('0x1c')](_0x2211f[_0xaec5('0x2b')]['limit']);_0x22bdf6[_0xaec5('0x1a')]=qs[_0xaec5('0x1a')](_0x2211f['query'][_0xaec5('0x1a')]);}_0x22bdf6['order']=qs[_0xaec5('0x33')](_0x2211f[_0xaec5('0x2b')]['sort']);_0x22bdf6['where']=qs['filters'](_[_0xaec5('0x34')](_0x2211f[_0xaec5('0x2b')],_0x4ede7d[_0xaec5('0x2c')]),_0x23849d);if(_0x2211f[_0xaec5('0x2b')][_0xaec5('0x35')]){_0x22bdf6[_0xaec5('0x36')]=_[_0xaec5('0x37')](_0x22bdf6[_0xaec5('0x36')],{'$or':_['map'](_0x23849d,function(_0x385a62){if(_0x385a62['type']!==_0xaec5('0x38')){var _0x4b881a={};_0x4b881a[_0x385a62['name']]={'$like':'%'+_0x2211f[_0xaec5('0x2b')]['filter']+'%'};return _0x4b881a;}})});}_0x22bdf6=_[_0xaec5('0x37')]({},_0x22bdf6,_0x2211f['options']);var _0x2cbdff={'where':_0x22bdf6[_0xaec5('0x36')]};return db[_0xaec5('0x27')][_0xaec5('0x1d')](_0x2cbdff)[_0xaec5('0x21')](function(_0x7bd20){_0x18af1c[_0xaec5('0x1d')]=_0x7bd20;if(_0x2211f[_0xaec5('0x2b')][_0xaec5('0x39')]){_0x22bdf6[_0xaec5('0x3a')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x22bdf6);})['then'](function(_0x3c4da5){_0x18af1c[_0xaec5('0x3b')]=_0x3c4da5;return _0x18af1c;})[_0xaec5('0x21')](respondWithFilteredResult(_0x1568fd,_0x22bdf6))['catch'](handleError(_0x1568fd,null));};exports['show']=function(_0x16af5d,_0xba73f8){var _0x380411={'raw':!![],'where':{'id':_0x16af5d['params']['id']}},_0x426136={};_0x426136[_0xaec5('0x2e')]=_[_0xaec5('0x3c')](db['SquareDetailsReport'][_0xaec5('0x28')]);_0x426136[_0xaec5('0x2b')]=_['keys'](_0x16af5d[_0xaec5('0x2b')]);_0x426136[_0xaec5('0x2c')]=_[_0xaec5('0x2d')](_0x426136[_0xaec5('0x2e')],_0x426136[_0xaec5('0x2b')]);_0x380411['attributes']=_['intersection'](_0x426136[_0xaec5('0x2e')],qs[_0xaec5('0x30')](_0x16af5d[_0xaec5('0x2b')][_0xaec5('0x30')]));_0x380411[_0xaec5('0x2f')]=_0x380411[_0xaec5('0x2f')][_0xaec5('0x31')]?_0x380411[_0xaec5('0x2f')]:_0x426136[_0xaec5('0x2e')];if(_0x16af5d['query']['includeAll']){_0x380411[_0xaec5('0x3a')]=[{'all':!![]}];}_0x380411=_[_0xaec5('0x37')]({},_0x380411,_0x16af5d[_0xaec5('0x3d')]);return db[_0xaec5('0x27')][_0xaec5('0x3e')](_0x380411)['then'](handleEntityNotFound(_0xba73f8,null))[_0xaec5('0x21')](respondWithResult(_0xba73f8,null))[_0xaec5('0x3f')](handleError(_0xba73f8,null));};exports[_0xaec5('0x40')]=function(_0xdcc893,_0x35d07a){return db[_0xaec5('0x27')][_0xaec5('0x40')](_0xdcc893[_0xaec5('0x41')],{})[_0xaec5('0x21')](respondWithResult(_0x35d07a,0xc9))[_0xaec5('0x3f')](handleError(_0x35d07a,null));};exports[_0xaec5('0x20')]=function(_0xc2dcc7,_0x1d4113){if(_0xc2dcc7[_0xaec5('0x41')]['id']){delete _0xc2dcc7[_0xaec5('0x41')]['id'];}return db[_0xaec5('0x27')][_0xaec5('0x3e')]({'where':{'id':_0xc2dcc7['params']['id']}})[_0xaec5('0x21')](handleEntityNotFound(_0x1d4113,null))['then'](saveUpdates(_0xc2dcc7[_0xaec5('0x41')],null))[_0xaec5('0x21')](respondWithResult(_0x1d4113,null))[_0xaec5('0x3f')](handleError(_0x1d4113,null));};exports[_0xaec5('0x42')]=function(_0x1faf9e,_0x1d45d0){return db['SquareDetailsReport']['find']({'where':{'id':_0x1faf9e[_0xaec5('0x43')]['id']}})[_0xaec5('0x21')](handleEntityNotFound(_0x1d45d0,null))[_0xaec5('0x21')](removeEntity(_0x1d45d0,null))[_0xaec5('0x3f')](handleError(_0x1d45d0,null));};exports[_0xaec5('0x44')]=function(_0x5a4b95,_0x558aef){return db[_0xaec5('0x27')][_0xaec5('0x44')]()[_0xaec5('0x21')](respondWithResult(_0x558aef,null))['catch'](handleError(_0x558aef,null));}; \ No newline at end of file +var _0x05ab=['keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','rawAttributes','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','map','query'];(function(_0x18f688,_0x5d13bf){var _0x4ea16d=function(_0x519777){while(--_0x519777){_0x18f688['push'](_0x18f688['shift']());}};_0x4ea16d(++_0x5d13bf);}(_0x05ab,0xff));var _0xb05a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x05ab[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xb05a('0x0'));var rimraf=require(_0xb05a('0x1'));var zipdir=require(_0xb05a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb05a('0x3'));var moment=require(_0xb05a('0x4'));var BPromise=require(_0xb05a('0x5'));var Mustache=require(_0xb05a('0x6'));var util=require(_0xb05a('0x7'));var path=require(_0xb05a('0x8'));var sox=require(_0xb05a('0x9'));var csv=require(_0xb05a('0xa'));var ejs=require(_0xb05a('0xb'));var fs=require('fs');var fs_extra=require(_0xb05a('0xc'));var _=require('lodash');var squel=require(_0xb05a('0xd'));var crypto=require(_0xb05a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb05a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb05a('0x10'));var authService=require(_0xb05a('0x11'));var qs=require(_0xb05a('0x12'));var as=require(_0xb05a('0x13'));var hardwareService=require(_0xb05a('0x14'));var logger=require(_0xb05a('0x15'))(_0xb05a('0x16'));var utils=require('../../config/utils');var config=require(_0xb05a('0x17'));var licenseUtil=require(_0xb05a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x591fb6,_0x4ff045){_0x4ff045=_0x4ff045||0xcc;return function(_0x26344d){if(_0x26344d){return _0x591fb6[_0xb05a('0x19')](_0x4ff045);}return _0x591fb6[_0xb05a('0x1a')](_0x4ff045)[_0xb05a('0x1b')]();};}function respondWithResult(_0x2dfeae,_0x31c3c8){_0x31c3c8=_0x31c3c8||0xc8;return function(_0x270528){if(_0x270528){return _0x2dfeae['status'](_0x31c3c8)[_0xb05a('0x1c')](_0x270528);}};}function respondWithFilteredResult(_0x477d57,_0x3aee9d){return function(_0x1e61d9){if(_0x1e61d9){var _0x59fc24=typeof _0x3aee9d[_0xb05a('0x1d')]===_0xb05a('0x1e')&&typeof _0x3aee9d[_0xb05a('0x1f')]===_0xb05a('0x1e');var _0x47450c=_0x1e61d9[_0xb05a('0x20')];var _0x437ede=_0x59fc24?0x0:_0x3aee9d[_0xb05a('0x1d')];var _0x4ed382=_0x59fc24?_0x1e61d9[_0xb05a('0x20')]:_0x3aee9d['offset']+_0x3aee9d[_0xb05a('0x1f')];var _0xbac29b;if(_0x4ed382>=_0x47450c){_0x4ed382=_0x47450c;_0xbac29b=0xc8;}else{_0xbac29b=0xce;}_0x477d57[_0xb05a('0x1a')](_0xbac29b);return _0x477d57[_0xb05a('0x21')](_0xb05a('0x22'),_0x437ede+'-'+_0x4ed382+'/'+_0x47450c)[_0xb05a('0x1c')](_0x1e61d9);}return null;};}function patchUpdates(_0x1118db){return function(_0x1c9e62){try{jsonpatch['apply'](_0x1c9e62,_0x1118db,!![]);}catch(_0x4cda0e){return BPromise[_0xb05a('0x23')](_0x4cda0e);}return _0x1c9e62[_0xb05a('0x24')]();};}function saveUpdates(_0x499e6e,_0x784a41){return function(_0x51a997){if(_0x51a997){return _0x51a997[_0xb05a('0x25')](_0x499e6e)[_0xb05a('0x26')](function(_0x2c3401){return _0x2c3401;});}return null;};}function removeEntity(_0x253df0,_0x32e197){return function(_0x3ce3c5){if(_0x3ce3c5){return _0x3ce3c5[_0xb05a('0x27')]()[_0xb05a('0x26')](function(){_0x253df0[_0xb05a('0x1a')](0xcc)[_0xb05a('0x1b')]();});}};}function handleEntityNotFound(_0x452d69,_0xa63682){return function(_0x1bc078){if(!_0x1bc078){_0x452d69['sendStatus'](0x194);}return _0x1bc078;};}function handleError(_0x22273a,_0x40e6fd){_0x40e6fd=_0x40e6fd||0x1f4;return function(_0x38f6d6){logger[_0xb05a('0x28')](_0x38f6d6[_0xb05a('0x29')]);if(_0x38f6d6['name']){delete _0x38f6d6[_0xb05a('0x2a')];}_0x22273a['status'](_0x40e6fd)[_0xb05a('0x2b')](_0x38f6d6);};}exports[_0xb05a('0x2c')]=function(_0x4216b7,_0x325ab9){var _0x234a4e={},_0x27cfee={},_0x20bd9e={'count':0x0,'rows':[]};var _0x303673=_['map'](db['SquareDetailsReport']['rawAttributes'],function(_0x4280b6){return{'name':_0x4280b6[_0xb05a('0x2d')],'type':_0x4280b6[_0xb05a('0x2e')]['key']};});_0x27cfee['model']=_[_0xb05a('0x2f')](_0x303673,_0xb05a('0x2a'));_0x27cfee[_0xb05a('0x30')]=_[_0xb05a('0x31')](_0x4216b7[_0xb05a('0x30')]);_0x27cfee['filters']=_[_0xb05a('0x32')](_0x27cfee[_0xb05a('0x33')],_0x27cfee[_0xb05a('0x30')]);_0x234a4e[_0xb05a('0x34')]=_['intersection'](_0x27cfee[_0xb05a('0x33')],qs[_0xb05a('0x35')](_0x4216b7[_0xb05a('0x30')][_0xb05a('0x35')]));_0x234a4e[_0xb05a('0x34')]=_0x234a4e[_0xb05a('0x34')][_0xb05a('0x36')]?_0x234a4e[_0xb05a('0x34')]:_0x27cfee[_0xb05a('0x33')];if(!_0x4216b7[_0xb05a('0x30')]['hasOwnProperty'](_0xb05a('0x37'))){_0x234a4e[_0xb05a('0x1f')]=qs[_0xb05a('0x1f')](_0x4216b7[_0xb05a('0x30')][_0xb05a('0x1f')]);_0x234a4e[_0xb05a('0x1d')]=qs[_0xb05a('0x1d')](_0x4216b7[_0xb05a('0x30')][_0xb05a('0x1d')]);}_0x234a4e[_0xb05a('0x38')]=qs['sort'](_0x4216b7['query'][_0xb05a('0x39')]);_0x234a4e[_0xb05a('0x3a')]=qs['filters'](_['pick'](_0x4216b7['query'],_0x27cfee[_0xb05a('0x3b')]),_0x303673);if(_0x4216b7[_0xb05a('0x30')][_0xb05a('0x3c')]){_0x234a4e[_0xb05a('0x3a')]=_[_0xb05a('0x3d')](_0x234a4e[_0xb05a('0x3a')],{'$or':_[_0xb05a('0x2f')](_0x303673,function(_0x3222b4){if(_0x3222b4['type']!==_0xb05a('0x3e')){var _0x3dff28={};_0x3dff28[_0x3222b4[_0xb05a('0x2a')]]={'$like':'%'+_0x4216b7[_0xb05a('0x30')][_0xb05a('0x3c')]+'%'};return _0x3dff28;}})});}_0x234a4e=_[_0xb05a('0x3d')]({},_0x234a4e,_0x4216b7[_0xb05a('0x3f')]);var _0x4609ad={'where':_0x234a4e[_0xb05a('0x3a')]};return db[_0xb05a('0x40')][_0xb05a('0x20')](_0x4609ad)[_0xb05a('0x26')](function(_0x3fb364){_0x20bd9e[_0xb05a('0x20')]=_0x3fb364;if(_0x4216b7[_0xb05a('0x30')][_0xb05a('0x41')]){_0x234a4e[_0xb05a('0x42')]=[{'all':!![]}];}return db[_0xb05a('0x40')][_0xb05a('0x43')](_0x234a4e);})[_0xb05a('0x26')](function(_0x31fd88){_0x20bd9e[_0xb05a('0x44')]=_0x31fd88;return _0x20bd9e;})[_0xb05a('0x26')](respondWithFilteredResult(_0x325ab9,_0x234a4e))[_0xb05a('0x45')](handleError(_0x325ab9,null));};exports[_0xb05a('0x46')]=function(_0x5bf6d4,_0x384817){var _0x28da0f={'raw':!![],'where':{'id':_0x5bf6d4['params']['id']}},_0x1ef171={};_0x1ef171[_0xb05a('0x33')]=_[_0xb05a('0x31')](db['SquareDetailsReport'][_0xb05a('0x47')]);_0x1ef171['query']=_['keys'](_0x5bf6d4[_0xb05a('0x30')]);_0x1ef171[_0xb05a('0x3b')]=_['intersection'](_0x1ef171[_0xb05a('0x33')],_0x1ef171['query']);_0x28da0f[_0xb05a('0x34')]=_['intersection'](_0x1ef171[_0xb05a('0x33')],qs[_0xb05a('0x35')](_0x5bf6d4[_0xb05a('0x30')][_0xb05a('0x35')]));_0x28da0f[_0xb05a('0x34')]=_0x28da0f[_0xb05a('0x34')][_0xb05a('0x36')]?_0x28da0f['attributes']:_0x1ef171[_0xb05a('0x33')];if(_0x5bf6d4[_0xb05a('0x30')]['includeAll']){_0x28da0f[_0xb05a('0x42')]=[{'all':!![]}];}_0x28da0f=_[_0xb05a('0x3d')]({},_0x28da0f,_0x5bf6d4[_0xb05a('0x3f')]);return db['SquareDetailsReport']['find'](_0x28da0f)[_0xb05a('0x26')](handleEntityNotFound(_0x384817,null))[_0xb05a('0x26')](respondWithResult(_0x384817,null))[_0xb05a('0x45')](handleError(_0x384817,null));};exports['create']=function(_0xd9f604,_0x49cf32){return db[_0xb05a('0x40')]['create'](_0xd9f604[_0xb05a('0x48')],{})[_0xb05a('0x26')](respondWithResult(_0x49cf32,0xc9))[_0xb05a('0x45')](handleError(_0x49cf32,null));};exports[_0xb05a('0x25')]=function(_0x35293a,_0x58afba){if(_0x35293a['body']['id']){delete _0x35293a[_0xb05a('0x48')]['id'];}return db[_0xb05a('0x40')]['find']({'where':{'id':_0x35293a['params']['id']}})['then'](handleEntityNotFound(_0x58afba,null))['then'](saveUpdates(_0x35293a[_0xb05a('0x48')],null))[_0xb05a('0x26')](respondWithResult(_0x58afba,null))[_0xb05a('0x45')](handleError(_0x58afba,null));};exports[_0xb05a('0x27')]=function(_0x28a6c4,_0x406ddc){return db[_0xb05a('0x40')][_0xb05a('0x49')]({'where':{'id':_0x28a6c4[_0xb05a('0x4a')]['id']}})[_0xb05a('0x26')](handleEntityNotFound(_0x406ddc,null))['then'](removeEntity(_0x406ddc,null))[_0xb05a('0x45')](handleError(_0x406ddc,null));};exports[_0xb05a('0x4b')]=function(_0x256f79,_0x40f7ac){return db[_0xb05a('0x40')][_0xb05a('0x4b')]()[_0xb05a('0x26')](respondWithResult(_0x40f7ac,null))[_0xb05a('0x45')](handleError(_0x40f7ac,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ea63a0c..495c47c 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 _0xc503=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3f7dd0,_0x30d230){var _0x1eca23=function(_0x43fba7){while(--_0x43fba7){_0x3f7dd0['push'](_0x3f7dd0['shift']());}};_0x1eca23(++_0x30d230);}(_0xc503,0x1a7));var _0x3c50=function(_0x3b9bc0,_0x1c48df){_0x3b9bc0=_0x3b9bc0-0x0;var _0x9eeb03=_0xc503[_0x3b9bc0];return _0x9eeb03;};'use strict';var _=require(_0x3c50('0x0'));var util=require(_0x3c50('0x1'));var logger=require(_0x3c50('0x2'))(_0x3c50('0x3'));var moment=require(_0x3c50('0x4'));var BPromise=require(_0x3c50('0x5'));var rp=require(_0x3c50('0x6'));var fs=require('fs');var path=require(_0x3c50('0x7'));var rimraf=require(_0x3c50('0x8'));var config=require(_0x3c50('0x9'));var attributes=require(_0x3c50('0xa'));module['exports']=function(_0x435312,_0x2a44c0){return _0x435312['define'](_0x3c50('0xb'),attributes,{'tableName':_0x3c50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1342=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3f65c3,_0x1b50af){var _0x44ca19=function(_0xbe57e3){while(--_0xbe57e3){_0x3f65c3['push'](_0x3f65c3['shift']());}};_0x44ca19(++_0x1b50af);}(_0x1342,0x7c));var _0x2134=function(_0x5df752,_0xf2d692){_0x5df752=_0x5df752-0x0;var _0x142ab8=_0x1342[_0x5df752];return _0x142ab8;};'use strict';var _=require(_0x2134('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2134('0x1'));var moment=require('moment');var BPromise=require(_0x2134('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2134('0x3'));var rimraf=require(_0x2134('0x4'));var config=require(_0x2134('0x5'));var attributes=require(_0x2134('0x6'));module['exports']=function(_0x522e52,_0x255fe8){return _0x522e52[_0x2134('0x7')](_0x2134('0x8'),attributes,{'tableName':_0x2134('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 107ace2..cbbf74d 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 _0x0598=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','then','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x253f6d,_0x419185){var _0x6d2621=function(_0xbf0fce){while(--_0xbf0fce){_0x253f6d['push'](_0x253f6d['shift']());}};_0x6d2621(++_0x419185);}(_0x0598,0x92));var _0x8059=function(_0x1f82a7,_0x56d219){_0x1f82a7=_0x1f82a7-0x0;var _0xa4c85d=_0x0598[_0x1f82a7];return _0xa4c85d;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['create'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x8059('0x13')](function(_0x56d794){logger[_0x8059('0x7')](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')]('CreateSquareDetailsReport',_0x4b6d55,JSON['stringify'](_0x56d794));_0x2bb670(_0x56d794);})[_0x8059('0xe')](function(_0x232f1b){logger[_0x8059('0xc')](_0x8059('0xf'),_0x232f1b['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x232f1b[_0x8059('0xd')]));});});}; \ No newline at end of file +var _0x94df=['client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x250d21,_0x1a4a50){var _0x15f43b=function(_0x2d249a){while(--_0x2d249a){_0x250d21['push'](_0x250d21['shift']());}};_0x15f43b(++_0x1a4a50);}(_0x94df,0xa3));var _0xf94d=function(_0x2b5403,_0x467432){_0x2b5403=_0x2b5403-0x0;var _0x21adc5=_0x94df[_0x2b5403];return _0x21adc5;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a11a,_0x1ebc19,_0xf285b5){return new BPromise(function(_0x1832e9,_0x504670){return client[_0xf94d('0xd')](_0x18a11a,_0xf285b5)[_0xf94d('0xe')](function(_0x145f5b){logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));logger['debug'](_0xf94d('0x12'),_0x1ebc19,_0xf94d('0x11'),JSON[_0xf94d('0x13')](_0x145f5b));if(_0x145f5b[_0xf94d('0x14')]){if(_0x145f5b[_0xf94d('0x14')]['code']===0x1f4){logger['error'](_0xf94d('0x10'),_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x504670(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x1832e9(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}else{logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));_0x1832e9(_0x145f5b[_0xf94d('0x16')]['message']);}})[_0xf94d('0x17')](function(_0x5cd967){logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x5cd967);_0x504670(_0x5cd967);});});}exports[_0xf94d('0x18')]=function(_0x559e0c){var _0x30d231=this;return new Promise(function(_0x3bf001,_0x510eef){return db[_0xf94d('0x19')]['create'](_0x559e0c[_0xf94d('0x1a')],{'raw':_0x559e0c['options']?_0x559e0c[_0xf94d('0x1b')][_0xf94d('0x1c')]===undefined?!![]:![]:!![]})[_0xf94d('0xe')](function(_0x2ede5b){logger['info'](_0xf94d('0x18'),_0x559e0c);logger['debug'](_0xf94d('0x18'),_0x559e0c,JSON[_0xf94d('0x13')](_0x2ede5b));_0x3bf001(_0x2ede5b);})[_0xf94d('0x17')](function(_0x56e5f5){logger[_0xf94d('0x14')](_0xf94d('0x18'),_0x56e5f5[_0xf94d('0x15')],_0x559e0c);_0x510eef(_0x30d231[_0xf94d('0x14')](0x1f4,_0x56e5f5[_0xf94d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b117cd2..2c1087f 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 _0x7d15=['index','get','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x1d94f2,_0xae6815){var _0x1d1c36=function(_0x2fb2f4){while(--_0x2fb2f4){_0x1d94f2['push'](_0x1d94f2['shift']());}};_0x1d1c36(++_0xae6815);}(_0x7d15,0x1e6));var _0x57d1=function(_0x2fbd87,_0x421a2d){_0x2fbd87=_0x2fbd87-0x0;var _0x33e0de=_0x7d15[_0x2fbd87];return _0x33e0de;};'use strict';var express=require(_0x57d1('0x0'));var router=express[_0x57d1('0x1')]();var auth=require(_0x57d1('0x2'));var controller=require(_0x57d1('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x57d1('0x4')]);router[_0x57d1('0x5')](_0x57d1('0x6'),auth[_0x57d1('0x7')](),controller[_0x57d1('0x8')]);module[_0x57d1('0x9')]=router; \ No newline at end of file +var _0x99b6=['index','/process/:pid/kill','exports','express','../../components/auth/service','get','isAuthenticated'];(function(_0x1db37b,_0x357c59){var _0xbf74c1=function(_0xc5f54d){while(--_0xc5f54d){_0x1db37b['push'](_0x1db37b['shift']());}};_0xbf74c1(++_0x357c59);}(_0x99b6,0x1d1));var _0x699b=function(_0x148745,_0xa0bb91){_0x148745=_0x148745-0x0;var _0x1db1f6=_0x99b6[_0x148745];return _0x1db1f6;};'use strict';var express=require(_0x699b('0x0'));var router=express['Router']();var auth=require(_0x699b('0x1'));var controller=require('./system.controller');router[_0x699b('0x2')]('/',auth[_0x699b('0x3')](),controller[_0x699b('0x4')]);router['get'](_0x699b('0x5'),auth[_0x699b('0x3')](),controller['killProcess']);module[_0x699b('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index de0b435..bd14433 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 _0xa777=['api','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','format','kill','child_process','exec','../../config/logger'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xa777,0x6b));var _0x7a77=function(_0x5a8a5b,_0x3ed42a){_0x5a8a5b=_0x5a8a5b-0x0;var _0x54bfc7=_0xa777[_0x5a8a5b];return _0x54bfc7;};'use strict';var info=require('systeminformation');var exec=require(_0x7a77('0x0'))[_0x7a77('0x1')];var logger=require(_0x7a77('0x2'))(_0x7a77('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x367d16,_0x4320b3,_0x5a1996){_0x4320b3=_0x4320b3||0x1f4;return function(_0x4eed7d){logger[_0x7a77('0x4')](_0x7a77('0x5'),_0x5a1996,_0x4320b3,util[_0x7a77('0x6')](_0x4eed7d,{'showHidden':![],'depth':null}));delete _0x4eed7d['name'];_0x367d16[_0x7a77('0x7')](_0x4320b3)[_0x7a77('0x8')](_0x4eed7d);};}exports[_0x7a77('0x9')]=function(_0x504f67,_0xa07508){return info[_0x7a77('0xa')]()[_0x7a77('0xb')](function(_0x3e4579){return _0xa07508['status'](0xc8)[_0x7a77('0xc')](_0x3e4579);})[_0x7a77('0xd')](function(_0x2d1218){return _0xa07508['status'](0x1f4)[_0x7a77('0xc')](_0x2d1218);});};exports[_0x7a77('0xe')]=function(_0x2ce4ca,_0x5afc9f){var _0x182261=['components/import/cm'];return new BPromise(function(_0x2d6c58,_0x27e186){return exec(util['format'](_0x7a77('0xf'),_0x2ce4ca[_0x7a77('0x10')]['pid']),function(_0x4923b1,_0x5621e0,_0x37fbc8){if(_0x4923b1){return _0x27e186(_0x4923b1);}return _0x2d6c58(_0x5621e0);});})[_0x7a77('0xb')](function(_0x1edd88){var _0x560521=![];var _0x5ddab7=_0x1edd88[_0x7a77('0x11')](/\n/);for(var _0x1edacc=0x0,_0x7bee93=_0x182261[_0x7a77('0x12')];_0x1edacc<_0x7bee93,_0x560521===![];_0x1edacc+=0x1){if(_0x1edd88[_0x7a77('0x13')](_0x182261[_0x1edacc])>=0x0){_0x560521=!![];}}if(!_0x560521){throw new Error(util[_0x7a77('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2ce4ca['params']['pid']));}process[_0x7a77('0x15')](_0x2ce4ca[_0x7a77('0x10')]['pid'],'SIGINT');return _0x5afc9f['status'](0xc8)['json']({'message':util[_0x7a77('0x14')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2ce4ca[_0x7a77('0x10')]['pid'])});})[_0x7a77('0xd')](handleError(_0x5afc9f,null,_0x7a77('0xe')));}; \ No newline at end of file +var _0xff90=['inspect','status','send','then','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','../../config/logger','api','util','lodash','error'];(function(_0x36acb1,_0x58d0d9){var _0x5121de=function(_0x43a475){while(--_0x43a475){_0x36acb1['push'](_0x36acb1['shift']());}};_0x5121de(++_0x58d0d9);}(_0xff90,0x162));var _0x0ff9=function(_0x1e1b5a,_0x13b534){_0x1e1b5a=_0x1e1b5a-0x0;var _0x3206db=_0xff90[_0x1e1b5a];return _0x3206db;};'use strict';var info=require(_0x0ff9('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x0ff9('0x1'))(_0x0ff9('0x2'));var util=require(_0x0ff9('0x3'));var BPromise=require('bluebird');var _=require(_0x0ff9('0x4'));function handleError(_0x105047,_0x519bdb,_0x3571d1){_0x519bdb=_0x519bdb||0x1f4;return function(_0x1b77da){logger[_0x0ff9('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3571d1,_0x519bdb,util[_0x0ff9('0x6')](_0x1b77da,{'showHidden':![],'depth':null}));delete _0x1b77da['name'];_0x105047[_0x0ff9('0x7')](_0x519bdb)[_0x0ff9('0x8')](_0x1b77da);};}exports['index']=function(_0x4c2e56,_0x1e187e){return info['getAllData']()[_0x0ff9('0x9')](function(_0x476697){return _0x1e187e[_0x0ff9('0x7')](0xc8)['json'](_0x476697);})['catch'](function(_0x2adffe){return _0x1e187e['status'](0x1f4)['json'](_0x2adffe);});};exports[_0x0ff9('0xa')]=function(_0x2b19c3,_0x1e0246){var _0xd1d111=['components/import/cm'];return new BPromise(function(_0x101fb9,_0x3d7369){return exec(util[_0x0ff9('0xb')](_0x0ff9('0xc'),_0x2b19c3['params']['pid']),function(_0x5aed2f,_0xb97afe,_0x28733f){if(_0x5aed2f){return _0x3d7369(_0x5aed2f);}return _0x101fb9(_0xb97afe);});})[_0x0ff9('0x9')](function(_0x3f06f4){var _0x1c7ad7=![];var _0x53344c=_0x3f06f4[_0x0ff9('0xd')](/\n/);for(var _0x3efbb3=0x0,_0x5856c4=_0xd1d111[_0x0ff9('0xe')];_0x3efbb3<_0x5856c4,_0x1c7ad7===![];_0x3efbb3+=0x1){if(_0x3f06f4[_0x0ff9('0xf')](_0xd1d111[_0x3efbb3])>=0x0){_0x1c7ad7=!![];}}if(!_0x1c7ad7){throw new Error(util[_0x0ff9('0xb')](_0x0ff9('0x10'),_0x2b19c3[_0x0ff9('0x11')][_0x0ff9('0x12')]));}process[_0x0ff9('0x13')](_0x2b19c3[_0x0ff9('0x11')][_0x0ff9('0x12')],_0x0ff9('0x14'));return _0x1e0246[_0x0ff9('0x7')](0xc8)[_0x0ff9('0x15')]({'message':util[_0x0ff9('0xb')](_0x0ff9('0x16'),_0x2b19c3[_0x0ff9('0x11')][_0x0ff9('0x12')])});})[_0x0ff9('0x17')](handleError(_0x1e0246,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 62b974f..1c59ec0 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 _0x59b9=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create'];(function(_0x12ce29,_0x5334ac){var _0x16da01=function(_0x21cc25){while(--_0x21cc25){_0x12ce29['push'](_0x12ce29['shift']());}};_0x16da01(++_0x5334ac);}(_0x59b9,0x15b));var _0x959b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x59b9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x959b('0x0'));var util=require('util');var path=require(_0x959b('0x1'));var timeout=require(_0x959b('0x2'));var express=require(_0x959b('0x3'));var router=express[_0x959b('0x4')]();var fs_extra=require(_0x959b('0x5'));var auth=require(_0x959b('0x6'));var interaction=require(_0x959b('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x959b('0x8')]('/',auth[_0x959b('0x9')](),controller['index']);router['get'](_0x959b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x959b('0xb')]('/',auth[_0x959b('0x9')](),controller[_0x959b('0xc')]);router[_0x959b('0xd')](_0x959b('0xa'),auth[_0x959b('0x9')](),controller[_0x959b('0xe')]);router[_0x959b('0xf')]('/:id',auth[_0x959b('0x9')](),controller[_0x959b('0x10')]);module[_0x959b('0x11')]=router; \ No newline at end of file +var _0x218d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports'];(function(_0x28a567,_0x31cabd){var _0x4d263e=function(_0xb87cbb){while(--_0xb87cbb){_0x28a567['push'](_0x28a567['shift']());}};_0x4d263e(++_0x31cabd);}(_0x218d,0x143));var _0xd218=function(_0x127461,_0x46cbfa){_0x127461=_0x127461-0x0;var _0x56b246=_0x218d[_0x127461];return _0x56b246;};'use strict';var multer=require(_0xd218('0x0'));var util=require(_0xd218('0x1'));var path=require(_0xd218('0x2'));var timeout=require(_0xd218('0x3'));var express=require(_0xd218('0x4'));var router=express[_0xd218('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd218('0x6'));var interaction=require(_0xd218('0x7'));var config=require(_0xd218('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0xd218('0x9')](),controller[_0xd218('0xa')]);router[_0xd218('0xb')](_0xd218('0xc'),auth[_0xd218('0x9')](),controller['show']);router[_0xd218('0xd')]('/',auth[_0xd218('0x9')](),controller[_0xd218('0xe')]);router['put'](_0xd218('0xc'),auth[_0xd218('0x9')](),controller[_0xd218('0xf')]);router[_0xd218('0x10')]('/:id',auth[_0xd218('0x9')](),controller[_0xd218('0x11')]);module[_0xd218('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9043362..c7068d2 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 _0x5d86=['STRING','sequelize','exports'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x5d86,0x76));var _0x65d8=function(_0x145f74,_0x346ce8){_0x145f74=_0x145f74-0x0;var _0x13ec90=_0x5d86[_0x145f74];return _0x13ec90;};'use strict';var Sequelize=require(_0x65d8('0x0'));module[_0x65d8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x65d8('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x65d8('0x2')]}}; \ No newline at end of file +var _0x2136=['#0091EA','sequelize','exports','STRING','name'];(function(_0x4219de,_0x29fbde){var _0xd5eaa1=function(_0x1abdd2){while(--_0x1abdd2){_0x4219de['push'](_0x4219de['shift']());}};_0xd5eaa1(++_0x29fbde);}(_0x2136,0x1eb));var _0x6213=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x2136[_0x407461];return _0x2b3ffa;};'use strict';var Sequelize=require(_0x6213('0x0'));module[_0x6213('0x1')]={'name':{'type':Sequelize[_0x6213('0x2')],'unique':_0x6213('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6213('0x2')],'defaultValue':_0x6213('0x4')},'description':{'type':Sequelize[_0x6213('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 728e60e..2c39030 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 _0x91a7=['moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','rimraf','zip-dir','fast-json-patch'];(function(_0x1ee391,_0x176009){var _0x1320cf=function(_0x111bbb){while(--_0x111bbb){_0x1ee391['push'](_0x1ee391['shift']());}};_0x1320cf(++_0x176009);}(_0x91a7,0xe7));var _0x791a=function(_0x1dd1f3,_0x2786da){_0x1dd1f3=_0x1dd1f3-0x0;var _0x3bb2e9=_0x91a7[_0x1dd1f3];return _0x3bb2e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['Tag'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));}; \ No newline at end of file +var _0xb0b9=['params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','Tags','UserProfileResource','end','error','name','send','map','Tag','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','keys','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','find'];(function(_0x715fe8,_0x4b0367){var _0x49af58=function(_0x34b501){while(--_0x34b501){_0x715fe8['push'](_0x715fe8['shift']());}};_0x49af58(++_0x4b0367);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x3d489b,_0x2d7a4c){_0x3d489b=_0x3d489b-0x0;var _0x312aa5=_0xb0b9[_0x3d489b];return _0x312aa5;};'use strict';var emlformat=require(_0x9b0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b0b('0x1'));var rp=require(_0x9b0b('0x2'));var moment=require(_0x9b0b('0x3'));var BPromise=require(_0x9b0b('0x4'));var Mustache=require(_0x9b0b('0x5'));var util=require(_0x9b0b('0x6'));var path=require(_0x9b0b('0x7'));var sox=require(_0x9b0b('0x8'));var csv=require(_0x9b0b('0x9'));var ejs=require(_0x9b0b('0xa'));var fs=require('fs');var fs_extra=require(_0x9b0b('0xb'));var _=require(_0x9b0b('0xc'));var squel=require(_0x9b0b('0xd'));var crypto=require(_0x9b0b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b0b('0x9'));var querystring=require(_0x9b0b('0xf'));var Papa=require(_0x9b0b('0x10'));var Redis=require(_0x9b0b('0x11'));var authService=require(_0x9b0b('0x12'));var qs=require(_0x9b0b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b0b('0x14'));var logger=require(_0x9b0b('0x15'))(_0x9b0b('0x16'));var utils=require(_0x9b0b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b0b('0x18'))['db'];function respondWithStatusCode(_0x4b3ed5,_0x283336){_0x283336=_0x283336||0xcc;return function(_0x4e6739){if(_0x4e6739){return _0x4b3ed5[_0x9b0b('0x19')](_0x283336);}return _0x4b3ed5[_0x9b0b('0x1a')](_0x283336)['end']();};}function respondWithResult(_0x5974af,_0x5f0555){_0x5f0555=_0x5f0555||0xc8;return function(_0xe9c112){if(_0xe9c112){return _0x5974af[_0x9b0b('0x1a')](_0x5f0555)['json'](_0xe9c112);}};}function respondWithFilteredResult(_0x248ff9,_0x377736){return function(_0x297b07){if(_0x297b07){var _0x1e92c1=typeof _0x377736[_0x9b0b('0x1b')]===_0x9b0b('0x1c')&&typeof _0x377736[_0x9b0b('0x1d')]===_0x9b0b('0x1c');var _0x1b7673=_0x297b07[_0x9b0b('0x1e')];var _0x264b6d=_0x1e92c1?0x0:_0x377736[_0x9b0b('0x1b')];var _0x3334e5=_0x1e92c1?_0x297b07[_0x9b0b('0x1e')]:_0x377736['offset']+_0x377736[_0x9b0b('0x1d')];var _0xee66f5;if(_0x3334e5>=_0x1b7673){_0x3334e5=_0x1b7673;_0xee66f5=0xc8;}else{_0xee66f5=0xce;}_0x248ff9[_0x9b0b('0x1a')](_0xee66f5);return _0x248ff9['set'](_0x9b0b('0x1f'),_0x264b6d+'-'+_0x3334e5+'/'+_0x1b7673)[_0x9b0b('0x20')](_0x297b07);}return null;};}function patchUpdates(_0x4067d3){return function(_0x565d35){try{jsonpatch[_0x9b0b('0x21')](_0x565d35,_0x4067d3,!![]);}catch(_0x2218d5){return BPromise[_0x9b0b('0x22')](_0x2218d5);}return _0x565d35[_0x9b0b('0x23')]();};}function saveUpdates(_0x4fe0a2,_0x30bfe8){return function(_0x408f70){if(_0x408f70){return _0x408f70['update'](_0x4fe0a2)[_0x9b0b('0x24')](function(_0x1e7789){return _0x1e7789;});}return null;};}function removeEntity(_0x3f433c,_0x16b413){return function(_0xbf0f87){if(_0xbf0f87){return _0xbf0f87[_0x9b0b('0x25')]()[_0x9b0b('0x24')](function(){var _0x322a0b=_0xbf0f87[_0x9b0b('0x26')]({'plain':!![]});var _0x5771fd=_0x9b0b('0x27');return db[_0x9b0b('0x28')][_0x9b0b('0x25')]({'where':{'type':_0x5771fd,'resourceId':_0x322a0b['id']}})[_0x9b0b('0x24')](function(){return _0xbf0f87;});})['then'](function(){_0x3f433c[_0x9b0b('0x1a')](0xcc)[_0x9b0b('0x29')]();});}};}function handleEntityNotFound(_0x5c9ec3,_0x2841fc){return function(_0x1e25fb){if(!_0x1e25fb){_0x5c9ec3[_0x9b0b('0x19')](0x194);}return _0x1e25fb;};}function handleError(_0x47a135,_0x2cfe21){_0x2cfe21=_0x2cfe21||0x1f4;return function(_0xa4f392){logger[_0x9b0b('0x2a')](_0xa4f392['stack']);if(_0xa4f392[_0x9b0b('0x2b')]){delete _0xa4f392[_0x9b0b('0x2b')];}_0x47a135[_0x9b0b('0x1a')](_0x2cfe21)[_0x9b0b('0x2c')](_0xa4f392);};}exports['index']=function(_0x347f76,_0xfa71df){var _0x48d324={},_0x272934={},_0x32cde1={'count':0x0,'rows':[]};var _0x328e82=_[_0x9b0b('0x2d')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')],function(_0xfd6ce){return{'name':_0xfd6ce[_0x9b0b('0x30')],'type':_0xfd6ce['type']['key']};});_0x272934[_0x9b0b('0x31')]=_['map'](_0x328e82,_0x9b0b('0x2b'));_0x272934['query']=_['keys'](_0x347f76['query']);_0x272934[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],_0x272934[_0x9b0b('0x34')]);_0x48d324[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],qs[_0x9b0b('0x36')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x36')]));_0x48d324[_0x9b0b('0x35')]=_0x48d324[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x48d324['attributes']:_0x272934[_0x9b0b('0x31')];if(!_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x38')](_0x9b0b('0x39'))){_0x48d324[_0x9b0b('0x1d')]=qs[_0x9b0b('0x1d')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1d')]);_0x48d324[_0x9b0b('0x1b')]=qs[_0x9b0b('0x1b')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1b')]);}_0x48d324[_0x9b0b('0x3a')]=qs['sort'](_0x347f76['query'][_0x9b0b('0x3b')]);_0x48d324[_0x9b0b('0x3c')]=qs[_0x9b0b('0x32')](_[_0x9b0b('0x3d')](_0x347f76[_0x9b0b('0x34')],_0x272934['filters']),_0x328e82);if(_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]){_0x48d324[_0x9b0b('0x3c')]=_[_0x9b0b('0x3f')](_0x48d324['where'],{'$or':_['map'](_0x328e82,function(_0x1fffc4){if(_0x1fffc4['type']!==_0x9b0b('0x40')){var _0x316d86={};_0x316d86[_0x1fffc4[_0x9b0b('0x2b')]]={'$like':'%'+_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]+'%'};return _0x316d86;}})});}_0x48d324=_[_0x9b0b('0x3f')]({},_0x48d324,_0x347f76[_0x9b0b('0x41')]);var _0x24724c={'where':_0x48d324[_0x9b0b('0x3c')]};return db[_0x9b0b('0x2e')][_0x9b0b('0x1e')](_0x24724c)[_0x9b0b('0x24')](function(_0x4049ad){_0x32cde1[_0x9b0b('0x1e')]=_0x4049ad;if(_0x347f76[_0x9b0b('0x34')]['includeAll']){_0x48d324['include']=[{'all':!![]}];}return db['Tag'][_0x9b0b('0x42')](_0x48d324);})[_0x9b0b('0x24')](function(_0x1522a1){_0x32cde1[_0x9b0b('0x43')]=_0x1522a1;return _0x32cde1;})[_0x9b0b('0x24')](respondWithFilteredResult(_0xfa71df,_0x48d324))['catch'](handleError(_0xfa71df,null));};exports['show']=function(_0x20ec55,_0x243063){var _0x8be3d0={'raw':!![],'where':{'id':_0x20ec55['params']['id']}},_0x136a33={};_0x136a33[_0x9b0b('0x31')]=_[_0x9b0b('0x44')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')]);_0x136a33[_0x9b0b('0x34')]=_['keys'](_0x20ec55[_0x9b0b('0x34')]);_0x136a33[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],_0x136a33[_0x9b0b('0x34')]);_0x8be3d0[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],qs['fields'](_0x20ec55['query']['fields']));_0x8be3d0[_0x9b0b('0x35')]=_0x8be3d0[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x8be3d0[_0x9b0b('0x35')]:_0x136a33[_0x9b0b('0x31')];if(_0x20ec55[_0x9b0b('0x34')][_0x9b0b('0x45')]){_0x8be3d0[_0x9b0b('0x46')]=[{'all':!![]}];}_0x8be3d0=_[_0x9b0b('0x3f')]({},_0x8be3d0,_0x20ec55[_0x9b0b('0x41')]);return db[_0x9b0b('0x2e')]['find'](_0x8be3d0)[_0x9b0b('0x24')](handleEntityNotFound(_0x243063,null))[_0x9b0b('0x24')](respondWithResult(_0x243063,null))['catch'](handleError(_0x243063,null));};exports['create']=function(_0xd9410f,_0x990950){return db[_0x9b0b('0x2e')][_0x9b0b('0x47')](_0xd9410f['body'],{})[_0x9b0b('0x24')](function(_0x348444){var _0x3eeb0c=_0xd9410f[_0x9b0b('0x48')][_0x9b0b('0x26')]({'plain':!![]});if(!_0x3eeb0c)throw new Error(_0x9b0b('0x49'));if(_0x3eeb0c[_0x9b0b('0x4a')]===_0x9b0b('0x48')){var _0x146654=_0x348444['get']({'plain':!![]});var _0x1a6cf8='Tags';return db[_0x9b0b('0x4b')]['find']({'where':{'name':_0x1a6cf8,'userProfileId':_0x3eeb0c['userProfileId']},'raw':!![]})[_0x9b0b('0x24')](function(_0x2238d1){if(_0x2238d1&&_0x2238d1[_0x9b0b('0x4c')]===0x0){return db[_0x9b0b('0x28')][_0x9b0b('0x47')]({'name':_0x146654[_0x9b0b('0x2b')],'resourceId':_0x146654['id'],'type':_0x2238d1[_0x9b0b('0x2b')],'sectionId':_0x2238d1['id']},{})['then'](function(){return _0x348444;});}else{return _0x348444;}})['catch'](function(_0x4bba88){logger[_0x9b0b('0x2a')](_0x9b0b('0x4d'),_0x4bba88);throw _0x4bba88;});}return _0x348444;})[_0x9b0b('0x24')](respondWithResult(_0x990950,0xc9))[_0x9b0b('0x4e')](handleError(_0x990950,null));};exports[_0x9b0b('0x4f')]=function(_0x41331d,_0x5a568e){if(_0x41331d[_0x9b0b('0x50')]['id']){delete _0x41331d[_0x9b0b('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x41331d['params']['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x5a568e,null))[_0x9b0b('0x24')](saveUpdates(_0x41331d['body'],null))['then'](respondWithResult(_0x5a568e,null))['catch'](handleError(_0x5a568e,null));};exports[_0x9b0b('0x25')]=function(_0x2d8637,_0x23225c){return db[_0x9b0b('0x2e')][_0x9b0b('0x51')]({'where':{'id':_0x2d8637[_0x9b0b('0x52')]['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x23225c,null))[_0x9b0b('0x24')](removeEntity(_0x23225c,null))[_0x9b0b('0x4e')](handleError(_0x23225c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index c83cd1c..e2976d3 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 _0xcc56=['moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','util','api'];(function(_0x1b15f6,_0x3ebc60){var _0x378911=function(_0x2f4da1){while(--_0x2f4da1){_0x1b15f6['push'](_0x1b15f6['shift']());}};_0x378911(++_0x3ebc60);}(_0xcc56,0x76));var _0x6cc5=function(_0x4670cb,_0x3ed3b8){_0x4670cb=_0x4670cb-0x0;var _0x2af1e6=_0xcc56[_0x4670cb];return _0x2af1e6;};'use strict';var _=require('lodash');var util=require(_0x6cc5('0x0'));var logger=require('../../config/logger')(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require('bluebird');var rp=require(_0x6cc5('0x3'));var fs=require('fs');var path=require(_0x6cc5('0x4'));var rimraf=require(_0x6cc5('0x5'));var config=require(_0x6cc5('0x6'));var attributes=require(_0x6cc5('0x7'));module['exports']=function(_0x3ffbcb,_0x183e07){return _0x3ffbcb['define'](_0x6cc5('0x8'),attributes,{'tableName':_0x6cc5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1095=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','util','../../config/logger'];(function(_0x463713,_0x5897dd){var _0x5670bd=function(_0x12a32a){while(--_0x12a32a){_0x463713['push'](_0x463713['shift']());}};_0x5670bd(++_0x5897dd);}(_0x1095,0x1e9));var _0x5109=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x1095[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x5109('0x0'));var util=require(_0x5109('0x1'));var logger=require(_0x5109('0x2'))(_0x5109('0x3'));var moment=require(_0x5109('0x4'));var BPromise=require(_0x5109('0x5'));var rp=require(_0x5109('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5109('0x7'));var config=require(_0x5109('0x8'));var attributes=require(_0x5109('0x9'));module['exports']=function(_0x3c746c,_0x48951b){return _0x3c746c[_0x5109('0xa')]('Tag',attributes,{'tableName':_0x5109('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 3c5341d..0bf8624 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 _0x984b=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x48e30b,_0x3e1269){var _0xba37b2=function(_0x2d3e28){while(--_0x2d3e28){_0x48e30b['push'](_0x48e30b['shift']());}};_0xba37b2(++_0x3e1269);}(_0x984b,0xee));var _0xb984=function(_0x45112c,_0x41236b){_0x45112c=_0x45112c-0x0;var _0x2bfcc2=_0x984b[_0x45112c];return _0x2bfcc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file +var _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6308[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('Tag,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('Tag,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('Tag,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6ff2bf0..514f1f8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 47d18cb..98386c8 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(_0x186cf5,_0xd37d24){var _0x35f120=function(_0x101f46){while(--_0x101f46){_0x186cf5['push'](_0x186cf5['shift']());}};_0x35f120(++_0xd37d24);}(_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(_0x1db74f,_0x181211){var _0x1c0daf=function(_0x30b663){while(--_0x30b663){_0x1db74f['push'](_0x1db74f['shift']());}};_0x1c0daf(++_0x181211);}(_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 40cdc7f..2b37cae 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 _0xf7d8=['UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','add','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','through','QueueId','TeamVoiceQueue','penalty','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','Whatsapp','emit','Queue:remove','removeAgents','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','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','defaults','localhost','socket.io-emitter','redis','./team.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','Team','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','find','userProfileId','UserProfileResource','update','destroy','sequelize','transaction','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x573c9e,_0xd4ab71){var _0x5d0714=function(_0x127a2a){while(--_0x127a2a){_0x573c9e['push'](_0x573c9e['shift']());}};_0x5d0714(++_0xd4ab71);}(_0xf7d8,0xcf));var _0x8f7d=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xf7d8[_0x515283];return _0x38f836;};'use strict';var emlformat=require(_0x8f7d('0x0'));var rimraf=require(_0x8f7d('0x1'));var zipdir=require(_0x8f7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f7d('0x3'));var moment=require(_0x8f7d('0x4'));var BPromise=require(_0x8f7d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8f7d('0x6'));var csv=require('to-csv');var ejs=require(_0x8f7d('0x7'));var fs=require('fs');var fs_extra=require(_0x8f7d('0x8'));var _=require(_0x8f7d('0x9'));var squel=require(_0x8f7d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8f7d('0xb'));var querystring=require(_0x8f7d('0xc'));var Papa=require(_0x8f7d('0xd'));var Redis=require(_0x8f7d('0xe'));var authService=require(_0x8f7d('0xf'));var qs=require(_0x8f7d('0x10'));var as=require(_0x8f7d('0x11'));var hardwareService=require(_0x8f7d('0x12'));var logger=require(_0x8f7d('0x13'))(_0x8f7d('0x14'));var utils=require(_0x8f7d('0x15'));var config=require(_0x8f7d('0x16'));var licenseUtil=require(_0x8f7d('0x17'));var db=require(_0x8f7d('0x18'))['db'];config['redis']=_[_0x8f7d('0x19')](config['redis'],{'host':_0x8f7d('0x1a'),'port':0x18eb});var socket=require(_0x8f7d('0x1b'))(new Redis(config[_0x8f7d('0x1c')]));require(_0x8f7d('0x1d'))['register'](socket);function respondWithStatusCode(_0x2bf680,_0x4e779c){_0x4e779c=_0x4e779c||0xcc;return function(_0x24d5ff){if(_0x24d5ff){return _0x2bf680[_0x8f7d('0x1e')](_0x4e779c);}return _0x2bf680[_0x8f7d('0x1f')](_0x4e779c)[_0x8f7d('0x20')]();};}function respondWithResult(_0x5869a1,_0x1bb21a){_0x1bb21a=_0x1bb21a||0xc8;return function(_0x58d87c){if(_0x58d87c){return _0x5869a1[_0x8f7d('0x1f')](_0x1bb21a)['json'](_0x58d87c);}};}function respondWithFilteredResult(_0x4c4025,_0xb00076){return function(_0x78023d){if(_0x78023d){var _0x12a4e6=typeof _0xb00076[_0x8f7d('0x21')]===_0x8f7d('0x22')&&typeof _0xb00076['limit']==='undefined';var _0x557060=_0x78023d[_0x8f7d('0x23')];var _0x3e3f4c=_0x12a4e6?0x0:_0xb00076['offset'];var _0x13e20b=_0x12a4e6?_0x78023d[_0x8f7d('0x23')]:_0xb00076['offset']+_0xb00076[_0x8f7d('0x24')];var _0x41f75d;if(_0x13e20b>=_0x557060){_0x13e20b=_0x557060;_0x41f75d=0xc8;}else{_0x41f75d=0xce;}_0x4c4025[_0x8f7d('0x1f')](_0x41f75d);return _0x4c4025[_0x8f7d('0x25')](_0x8f7d('0x26'),_0x3e3f4c+'-'+_0x13e20b+'/'+_0x557060)[_0x8f7d('0x27')](_0x78023d);}return null;};}function patchUpdates(_0x40c9a3){return function(_0x202af5){try{jsonpatch[_0x8f7d('0x28')](_0x202af5,_0x40c9a3,!![]);}catch(_0x465521){return BPromise[_0x8f7d('0x29')](_0x465521);}return _0x202af5[_0x8f7d('0x2a')]();};}function saveUpdates(_0x3c122a,_0x16a506){return function(_0x55c815){if(_0x55c815){return _0x55c815['update'](_0x3c122a)[_0x8f7d('0x2b')](function(_0x457752){return _0x457752;});}return null;};}function handleEntityNotFound(_0x3c8833,_0x4ce0dd){return function(_0x168aa0){if(!_0x168aa0){_0x3c8833[_0x8f7d('0x1e')](0x194);}return _0x168aa0;};}function handleError(_0x3dc0b4,_0x282f0a){_0x282f0a=_0x282f0a||0x1f4;return function(_0x3d0887){logger[_0x8f7d('0x2c')](_0x3d0887[_0x8f7d('0x2d')]);if(_0x3d0887[_0x8f7d('0x2e')]){delete _0x3d0887['name'];}_0x3dc0b4[_0x8f7d('0x1f')](_0x282f0a)[_0x8f7d('0x2f')](_0x3d0887);};}exports[_0x8f7d('0x30')]=function(_0x3ee744,_0x139c62){var _0x4b28db={},_0x59a40c={},_0x5e1d5d={'count':0x0,'rows':[]};var _0x4343c5=_[_0x8f7d('0x31')](db[_0x8f7d('0x32')][_0x8f7d('0x33')],function(_0x465730){return{'name':_0x465730['fieldName'],'type':_0x465730[_0x8f7d('0x34')]['key']};});_0x59a40c[_0x8f7d('0x35')]=_[_0x8f7d('0x31')](_0x4343c5,_0x8f7d('0x2e'));_0x59a40c[_0x8f7d('0x36')]=_[_0x8f7d('0x37')](_0x3ee744[_0x8f7d('0x36')]);_0x59a40c[_0x8f7d('0x38')]=_['intersection'](_0x59a40c[_0x8f7d('0x35')],_0x59a40c[_0x8f7d('0x36')]);_0x4b28db[_0x8f7d('0x39')]=_['intersection'](_0x59a40c[_0x8f7d('0x35')],qs[_0x8f7d('0x3a')](_0x3ee744['query'][_0x8f7d('0x3a')]));_0x4b28db[_0x8f7d('0x39')]=_0x4b28db[_0x8f7d('0x39')][_0x8f7d('0x3b')]?_0x4b28db['attributes']:_0x59a40c[_0x8f7d('0x35')];if(!_0x3ee744[_0x8f7d('0x36')][_0x8f7d('0x3c')]('nolimit')){_0x4b28db[_0x8f7d('0x24')]=qs[_0x8f7d('0x24')](_0x3ee744['query']['limit']);_0x4b28db[_0x8f7d('0x21')]=qs[_0x8f7d('0x21')](_0x3ee744[_0x8f7d('0x36')]['offset']);}_0x4b28db['order']=qs[_0x8f7d('0x3d')](_0x3ee744[_0x8f7d('0x36')]['sort']);_0x4b28db[_0x8f7d('0x3e')]=qs[_0x8f7d('0x38')](_[_0x8f7d('0x3f')](_0x3ee744[_0x8f7d('0x36')],_0x59a40c[_0x8f7d('0x38')]),_0x4343c5);if(_0x3ee744['query'][_0x8f7d('0x40')]){_0x4b28db['where']=_[_0x8f7d('0x41')](_0x4b28db[_0x8f7d('0x3e')],{'$or':_[_0x8f7d('0x31')](_0x4343c5,function(_0x41a54b){if(_0x41a54b['type']!==_0x8f7d('0x42')){var _0x453a6f={};_0x453a6f[_0x41a54b['name']]={'$like':'%'+_0x3ee744[_0x8f7d('0x36')][_0x8f7d('0x40')]+'%'};return _0x453a6f;}})});}_0x4b28db=_['merge']({},_0x4b28db,_0x3ee744[_0x8f7d('0x43')]);var _0x53d70f={'where':_0x4b28db['where']};return db[_0x8f7d('0x32')][_0x8f7d('0x23')](_0x53d70f)[_0x8f7d('0x2b')](function(_0x2966b5){_0x5e1d5d[_0x8f7d('0x23')]=_0x2966b5;if(_0x3ee744[_0x8f7d('0x36')][_0x8f7d('0x44')]){_0x4b28db[_0x8f7d('0x45')]=[{'all':!![]}];}return db[_0x8f7d('0x32')][_0x8f7d('0x46')](_0x4b28db);})[_0x8f7d('0x2b')](function(_0x38e628){_0x5e1d5d[_0x8f7d('0x47')]=_0x38e628;return _0x5e1d5d;})[_0x8f7d('0x2b')](respondWithFilteredResult(_0x139c62,_0x4b28db))[_0x8f7d('0x48')](handleError(_0x139c62,null));};exports[_0x8f7d('0x49')]=function(_0x64ef6,_0x46e21c){var _0x4ccd12={'raw':![],'where':{'id':_0x64ef6[_0x8f7d('0x4a')]['id']}},_0x3069dc={};_0x3069dc[_0x8f7d('0x35')]=_[_0x8f7d('0x37')](db[_0x8f7d('0x32')][_0x8f7d('0x33')]);_0x3069dc[_0x8f7d('0x36')]=_[_0x8f7d('0x37')](_0x64ef6[_0x8f7d('0x36')]);_0x3069dc[_0x8f7d('0x38')]=_[_0x8f7d('0x4b')](_0x3069dc[_0x8f7d('0x35')],_0x3069dc[_0x8f7d('0x36')]);_0x4ccd12[_0x8f7d('0x39')]=_[_0x8f7d('0x4b')](_0x3069dc['model'],qs['fields'](_0x64ef6['query'][_0x8f7d('0x3a')]));_0x4ccd12[_0x8f7d('0x39')]=_0x4ccd12[_0x8f7d('0x39')]['length']?_0x4ccd12[_0x8f7d('0x39')]:_0x3069dc[_0x8f7d('0x35')];if(_0x64ef6[_0x8f7d('0x36')][_0x8f7d('0x44')]){_0x4ccd12[_0x8f7d('0x45')]=[{'all':!![]}];}_0x4ccd12=_[_0x8f7d('0x41')]({},_0x4ccd12,_0x64ef6[_0x8f7d('0x43')]);return db['Team']['find'](_0x4ccd12)[_0x8f7d('0x2b')](handleEntityNotFound(_0x46e21c,null))[_0x8f7d('0x2b')](respondWithResult(_0x46e21c,null))['catch'](handleError(_0x46e21c,null));};exports['create']=function(_0x519881,_0x3f4bc3){return db[_0x8f7d('0x32')][_0x8f7d('0x4c')](_0x519881[_0x8f7d('0x4d')],{})[_0x8f7d('0x2b')](function(_0x47a316){var _0x5a59e4=_0x519881[_0x8f7d('0x4e')]['get']({'plain':!![]});if(!_0x5a59e4)throw new Error(_0x8f7d('0x4f'));if(_0x5a59e4[_0x8f7d('0x50')]==='user'){var _0x281ddf=_0x47a316[_0x8f7d('0x51')]({'plain':!![]});var _0x16b615=_0x8f7d('0x52');return db[_0x8f7d('0x53')][_0x8f7d('0x54')]({'where':{'name':_0x16b615,'userProfileId':_0x5a59e4[_0x8f7d('0x55')]},'raw':!![]})[_0x8f7d('0x2b')](function(_0x496ca9){if(_0x496ca9&&_0x496ca9['autoAssociation']===0x0){return db[_0x8f7d('0x56')][_0x8f7d('0x4c')]({'name':_0x281ddf[_0x8f7d('0x2e')],'resourceId':_0x281ddf['id'],'type':_0x496ca9['name'],'sectionId':_0x496ca9['id']},{})[_0x8f7d('0x2b')](function(){return _0x47a316;});}else{return _0x47a316;}})[_0x8f7d('0x48')](function(_0x29e2c5){logger[_0x8f7d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29e2c5);throw _0x29e2c5;});}return _0x47a316;})[_0x8f7d('0x2b')](respondWithResult(_0x3f4bc3,0xc9))[_0x8f7d('0x48')](handleError(_0x3f4bc3,null));};exports[_0x8f7d('0x57')]=function(_0x5bd7f9,_0xdc34dd){if(_0x5bd7f9['body']['id']){delete _0x5bd7f9[_0x8f7d('0x4d')]['id'];}return db[_0x8f7d('0x32')][_0x8f7d('0x54')]({'where':{'id':_0x5bd7f9[_0x8f7d('0x4a')]['id']}})[_0x8f7d('0x2b')](handleEntityNotFound(_0xdc34dd,null))[_0x8f7d('0x2b')](saveUpdates(_0x5bd7f9[_0x8f7d('0x4d')],null))['then'](respondWithResult(_0xdc34dd,null))[_0x8f7d('0x48')](handleError(_0xdc34dd,null));};exports[_0x8f7d('0x58')]=function(_0x4d208e,_0x261def){var _0x58a764=_0x4d208e['params']['id'];var _0x588994=[];return db[_0x8f7d('0x59')][_0x8f7d('0x5a')](function(_0x1f3ec2){var _0x3043ee='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x58a764;return db[_0x8f7d('0x59')][_0x8f7d('0x36')](_0x3043ee,{'type':db['Sequelize'][_0x8f7d('0x5b')]['SELECT'],'raw':!![],'transaction':_0x1f3ec2})[_0x8f7d('0x2b')](function(_0x2fc981){_0x588994=_['map'](_0x2fc981,function(_0x585b31){return Number(_0x585b31[_0x8f7d('0x5c')]);});})[_0x8f7d('0x2b')](function(){var _0x5ac4ef=_0x8f7d('0x5d')+_0x58a764;return db['sequelize'][_0x8f7d('0x36')](_0x5ac4ef,{'type':db[_0x8f7d('0x5e')]['QueryTypes'][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})['then'](function(_0x29844a){var _0x27b21f=_[_0x8f7d('0x31')](_0x29844a,function(_0x19eb73){return Number(_0x19eb73[_0x8f7d('0x60')]);});return db[_0x8f7d('0x61')][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'VoiceQueueId':{'$in':_0x27b21f}},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){var _0x572429=_0x8f7d('0x62')+_0x58a764;return db[_0x8f7d('0x59')][_0x8f7d('0x36')](_0x572429,{'type':db[_0x8f7d('0x5e')][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0x176e5e){var _0x3b18d5=_[_0x8f7d('0x31')](_0x176e5e,function(_0x147427){return Number(_0x147427['MailQueueId']);});return db[_0x8f7d('0x63')][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'MailQueueId':{'$in':_0x3b18d5}},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){var _0x39690b=_0x8f7d('0x64')+_0x58a764;return db[_0x8f7d('0x59')][_0x8f7d('0x36')](_0x39690b,{'type':db[_0x8f7d('0x5e')][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0x32640a){var _0x5d8c1b=_[_0x8f7d('0x31')](_0x32640a,function(_0x1c2dd1){return Number(_0x1c2dd1[_0x8f7d('0x65')]);});return db['UserSmsQueue'][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'SmsQueueId':{'$in':_0x5d8c1b}},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){var _0xad2e0e=_0x8f7d('0x66')+_0x58a764;return db['sequelize'][_0x8f7d('0x36')](_0xad2e0e,{'type':db['Sequelize'][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0x507dd7){var _0x2518c9=_[_0x8f7d('0x31')](_0x507dd7,function(_0xb7021f){return Number(_0xb7021f['ChatQueueId']);});return db[_0x8f7d('0x67')][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'ChatQueueId':{'$in':_0x2518c9}},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){var _0x225131=_0x8f7d('0x68')+_0x58a764;return db[_0x8f7d('0x59')]['query'](_0x225131,{'type':db[_0x8f7d('0x5e')][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0x193a28){var _0x35f857=_['map'](_0x193a28,function(_0x482784){return Number(_0x482784[_0x8f7d('0x69')]);});return db['UserFaxQueue'][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'FaxQueueId':{'$in':_0x35f857}},'transaction':_0x1f3ec2});})['then'](function(){var _0xa56100=_0x8f7d('0x6a')+_0x58a764;return db[_0x8f7d('0x59')][_0x8f7d('0x36')](_0xa56100,{'type':db['Sequelize'][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})['then'](function(_0x54d795){var _0x16a307=_['map'](_0x54d795,function(_0x5ab0b4){return Number(_0x5ab0b4[_0x8f7d('0x6b')]);});return db[_0x8f7d('0x6c')][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'OpenchannelQueueId':{'$in':_0x16a307}},'transaction':_0x1f3ec2});})['then'](function(){var _0x5346d4=_0x8f7d('0x6d')+_0x58a764;return db[_0x8f7d('0x59')][_0x8f7d('0x36')](_0x5346d4,{'type':db['Sequelize'][_0x8f7d('0x5b')][_0x8f7d('0x5f')],'raw':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0x3168d7){var _0x1f21ab=_[_0x8f7d('0x31')](_0x3168d7,function(_0x4ed060){return Number(_0x4ed060['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x8f7d('0x58')]({'where':{'UserId':{'$in':_0x588994},'WhatsappQueueId':{'$in':_0x1f21ab}},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){return db[_0x8f7d('0x6e')]['find']({'where':{'TeamId':_0x58a764}});})[_0x8f7d('0x2b')](function(_0x111a07){if(_0x111a07===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x588994},'VoicePrefixId':_0x111a07[_0x8f7d('0x6f')]},'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(){return db[_0x8f7d('0x32')]['destroy']({'where':{'id':_0x58a764},'cascade':!![],'transaction':_0x1f3ec2});})[_0x8f7d('0x2b')](function(_0xccbcfe){if(_0xccbcfe===0x0){_0x261def[_0x8f7d('0x1e')](0x194);}else{return db[_0x8f7d('0x56')][_0x8f7d('0x58')]({'where':{'type':_0x8f7d('0x52'),'resourceId':_0x58a764},'cascade':!![],'transaction':_0x1f3ec2})['then'](function(){_0x261def['status'](0xcc)[_0x8f7d('0x20')]();});}})[_0x8f7d('0x48')](function(_0x1d2f2f){_0x261def[_0x8f7d('0x1f')](0x1f4)[_0x8f7d('0x2f')](_0x1d2f2f);});});};exports[_0x8f7d('0x70')]=function(_0x522679,_0x2189c3,_0xc3a79){return db[_0x8f7d('0x32')][_0x8f7d('0x71')]({'where':{'id':_0x522679['params']['id']}})[_0x8f7d('0x2b')](handleEntityNotFound(_0x2189c3,null))[_0x8f7d('0x2b')](function(_0xd94f9b){if(!_0x522679[_0x8f7d('0x36')][_0x8f7d('0x72')]||!utils['isValidChannel'](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x72')])){throw new db[(_0x8f7d('0x5e'))][(_0x8f7d('0x73'))](_0x8f7d('0x74'));}var _0x340372={};var _0x770c90={};_0x770c90[_0x8f7d('0x35')]=_[_0x8f7d('0x37')](db[_[_0x8f7d('0x75')](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x72')][_0x8f7d('0x76')]())+_0x8f7d('0x77')]['rawAttributes']);_0x770c90[_0x8f7d('0x36')]=_[_0x8f7d('0x37')](_0x522679[_0x8f7d('0x36')]);_0x770c90[_0x8f7d('0x38')]=_[_0x8f7d('0x4b')](_0x770c90['model'],_0x770c90[_0x8f7d('0x36')]);_0x340372['attributes']=_[_0x8f7d('0x4b')](_0x770c90['model'],qs[_0x8f7d('0x3a')](_0x522679[_0x8f7d('0x36')]['fields']));_0x340372[_0x8f7d('0x39')]=_0x340372[_0x8f7d('0x39')][_0x8f7d('0x3b')]?_0x340372['attributes']:_0x770c90['model'];_0x340372[_0x8f7d('0x24')]=qs[_0x8f7d('0x24')](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x24')]);_0x340372[_0x8f7d('0x21')]=qs[_0x8f7d('0x21')](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x21')]);_0x340372['order']=qs[_0x8f7d('0x3d')](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x3d')]);_0x340372[_0x8f7d('0x3e')]=qs[_0x8f7d('0x38')](_[_0x8f7d('0x3f')](_0x522679[_0x8f7d('0x36')],_0x770c90[_0x8f7d('0x38')]));_0x340372=_[_0x8f7d('0x41')]({},_0x340372,_0x522679['options']);return _0xd94f9b[_0x8f7d('0x51')+_[_0x8f7d('0x75')](_0x522679[_0x8f7d('0x36')][_0x8f7d('0x72')]['toLowerCase']())+_0x8f7d('0x78')](_0x340372);})['then'](respondWithResult(_0x2189c3,null))[_0x8f7d('0x48')](handleError(_0x2189c3,null));};exports[_0x8f7d('0x79')]=function(_0x5bf391,_0x57ff5b,_0x27fb45){return db[_0x8f7d('0x32')][_0x8f7d('0x71')]({'where':{'id':_0x5bf391[_0x8f7d('0x4a')]['id']}})['then'](function(_0x2b5db8){if(_0x2b5db8){if(!_0x5bf391[_0x8f7d('0x4d')][_0x8f7d('0x72')]||!utils[_0x8f7d('0x7a')](_0x5bf391[_0x8f7d('0x4d')][_0x8f7d('0x72')])){throw new db['Sequelize'][(_0x8f7d('0x73'))]('Unknown\x20channel');}return _0x2b5db8[_0x8f7d('0x7b')+_[_0x8f7d('0x75')](_0x5bf391['body'][_0x8f7d('0x72')][_0x8f7d('0x76')]())+_0x8f7d('0x78')](_0x5bf391[_0x8f7d('0x4d')]['ids']);}return null;})[_0x8f7d('0x2b')](handleEntityNotFound(_0x57ff5b,null))[_0x8f7d('0x2b')](respondWithStatusCode(_0x57ff5b,null))[_0x8f7d('0x48')](handleError(_0x57ff5b,null));};exports[_0x8f7d('0x7c')]=function(_0x17b72c,_0x540d58,_0x119556){return db['Team'][_0x8f7d('0x71')]({'where':{'id':_0x17b72c[_0x8f7d('0x4a')]['id']}})['then'](function(_0x55407a){if(_0x55407a){if(!_0x17b72c['query'][_0x8f7d('0x72')]||!utils[_0x8f7d('0x7a')](_0x17b72c[_0x8f7d('0x36')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x8f7d('0x74'));}return _0x55407a[_0x8f7d('0x7d')+_[_0x8f7d('0x75')](_0x17b72c[_0x8f7d('0x36')][_0x8f7d('0x72')][_0x8f7d('0x76')]())+'Queues'](_0x17b72c[_0x8f7d('0x36')][_0x8f7d('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x540d58,null))['then'](respondWithStatusCode(_0x540d58,null))['catch'](handleError(_0x540d58,null));};exports[_0x8f7d('0x7f')]=function(_0x58a4a6,_0x1802f8){var _0x36097e=_['isArray'](_0x58a4a6[_0x8f7d('0x4d')][_0x8f7d('0x7e')])?_0x58a4a6[_0x8f7d('0x4d')][_0x8f7d('0x7e')]:[_0x58a4a6['body'][_0x8f7d('0x7e')]];var _0x1c345c=_0x58a4a6['params']['id'];return db[_0x8f7d('0x32')][_0x8f7d('0x54')]({'where':{'id':_0x1c345c}})[_0x8f7d('0x2b')](handleEntityNotFound(_0x1802f8,null))[_0x8f7d('0x2b')](function(_0x38a575){if(_0x38a575){var _0x4b21fd=[_0x8f7d('0x80'),_0x8f7d('0x81'),_0x8f7d('0x82'),_0x8f7d('0x83'),_0x8f7d('0x84'),_0x8f7d('0x85'),'Whatsapp'];return db[_0x8f7d('0x59')][_0x8f7d('0x5a')](function(_0x5b2546){var _0x4f844a=_[_0x8f7d('0x31')](_0x4b21fd,function(_0x567397){var _0x154be3={'attributes':['id',_0x8f7d('0x2e')]};if(_0x567397===_0x8f7d('0x80')){_0x154be3[_0x8f7d('0x86')]={'attributes':['penalty']};}return _0x38a575[_0x8f7d('0x51')+_0x567397+_0x8f7d('0x78')](_0x154be3)['then'](function(_0x1143d5){var _0x2b247b=_[_0x8f7d('0x31')](_0x1143d5,function(_0x1dd873){var _0x1df3a4=_[_0x8f7d('0x31')](_0x36097e,function(_0x49e1d8){var _0x3a86af={'where':{'UserId':_0x49e1d8,[_0x567397+_0x8f7d('0x87')]:_0x1dd873['id']},'transaction':_0x5b2546};if(_0x567397==='Voice'){_0x3a86af[_0x8f7d('0x19')]={'penalty':_0x1dd873[_0x8f7d('0x88')][_0x8f7d('0x89')]};}return db['User'+_0x567397+_0x8f7d('0x77')]['findOrCreate'](_0x3a86af)[_0x8f7d('0x2b')](function(){socket['emit']('user'+_0x567397+'Queue:save',{'UserId':_0x49e1d8,[_0x567397+_0x8f7d('0x87')]:_0x1dd873['id']});if(_0x567397!==_0x8f7d('0x80')){return;}return db[_0x8f7d('0x8a')]['findAll']({'where':{'id':_0x36097e,'online':0x1},'attributes':['id',_0x8f7d('0x2e'),_0x8f7d('0x8b'),_0x8f7d('0x8c'),_0x8f7d('0x8d')],'raw':!![]})[_0x8f7d('0x2b')](function(_0x25a07d){var _0x369f86=_[_0x8f7d('0x31')](_0x25a07d,function(_0x5472eb){return db[_0x8f7d('0x8e')][_0x8f7d('0x8f')]({'membername':_0x5472eb[_0x8f7d('0x2e')],'UserId':_0x5472eb['id'],'queue_name':_0x1dd873[_0x8f7d('0x2e')],'VoiceQueueId':_0x1dd873['id'],'interface':_[_0x8f7d('0x90')](_0x5472eb[_0x8f7d('0x8d')])?util[_0x8f7d('0x91')](_0x8f7d('0x92'),_0x5472eb[_0x8f7d('0x2e')]):_0x5472eb[_0x8f7d('0x8d')],'paused':_0x5472eb[_0x8f7d('0x8c')]||![],'penalty':_0x1dd873[_0x8f7d('0x88')][_0x8f7d('0x89')]},{'transaction':_0x5b2546});});return Promise[_0x8f7d('0x93')](_0x369f86);});});});return Promise[_0x8f7d('0x93')](_0x1df3a4);});return Promise['all'](_0x2b247b);})[_0x8f7d('0x2b')](function(){return db[_0x8f7d('0x6e')][_0x8f7d('0x71')]({'where':{'teamId':_0x1c345c}})[_0x8f7d('0x2b')](function(_0x5631e8){if(_0x5631e8){var _0x380c2e=_[_0x8f7d('0x31')](_0x36097e,function(_0x220aa){db['UserVoicePrefix'][_0x8f7d('0x8f')]({'UserId':_0x220aa,'VoicePrefixId':_0x5631e8[_0x8f7d('0x6f')]});});return Promise[_0x8f7d('0x93')](_0x380c2e);}});});});return Promise[_0x8f7d('0x93')](_0x4f844a)[_0x8f7d('0x2b')](function(){return _0x38a575[_0x8f7d('0x7f')](_0x36097e,{'transaction':_0x5b2546})[_0x8f7d('0x94')](function(_0x3f3d95){return _0x3f3d95;});});});}})[_0x8f7d('0x2b')](respondWithResult(_0x1802f8,null))[_0x8f7d('0x48')](handleError(_0x1802f8,null));};exports['removeAgents']=function(_0x694914,_0x9dafae){var _0x4d3242=_['isArray'](_0x694914[_0x8f7d('0x36')][_0x8f7d('0x7e')])?_0x694914[_0x8f7d('0x36')][_0x8f7d('0x7e')]:[_0x694914[_0x8f7d('0x36')][_0x8f7d('0x7e')]];var _0xdf8e4f=_0x694914[_0x8f7d('0x4a')]['id'];return db[_0x8f7d('0x32')][_0x8f7d('0x54')]({'where':{'id':_0xdf8e4f}})['then'](handleEntityNotFound(_0x9dafae,null))[_0x8f7d('0x2b')](function(_0x2050ea){if(_0x2050ea){var _0x301cd4=[_0x8f7d('0x80'),_0x8f7d('0x81'),_0x8f7d('0x82'),'Sms','Fax',_0x8f7d('0x85'),_0x8f7d('0x95')];return db[_0x8f7d('0x59')][_0x8f7d('0x5a')](function(_0x1210c1){var _0x9db551=_[_0x8f7d('0x31')](_0x301cd4,function(_0x37fae4){var _0x1e0621={'attributes':['id',_0x8f7d('0x2e')]};return _0x2050ea[_0x8f7d('0x51')+_0x37fae4+_0x8f7d('0x78')](_0x1e0621)[_0x8f7d('0x2b')](function(_0x561c62){var _0x3b5e5c=_['map'](_0x561c62,function(_0x3230bb){return _0x3230bb['removeAgents'](_0x4d3242,{'transaction':_0x1210c1})[_0x8f7d('0x2b')](function(){var _0x10b135=_[_0x8f7d('0x31')](_0x4d3242,function(_0x3b009b){socket[_0x8f7d('0x96')](_0x8f7d('0x4e')+_0x37fae4+_0x8f7d('0x97'),{'UserId':Number(_0x3b009b),[_0x37fae4+_0x8f7d('0x87')]:_0x3230bb['id']});if(_0x37fae4!==_0x8f7d('0x80')){return;}return db[_0x8f7d('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x3230bb['id'],'UserId':_0x3b009b},'transaction':_0x1210c1});});return Promise[_0x8f7d('0x93')](_0x10b135);});});return Promise[_0x8f7d('0x93')](_0x3b5e5c);});});return Promise[_0x8f7d('0x93')](_0x9db551)[_0x8f7d('0x2b')](function(){return _0x2050ea[_0x8f7d('0x98')](_0x4d3242,{'transaction':_0x1210c1});})[_0x8f7d('0x2b')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0xdf8e4f}})[_0x8f7d('0x2b')](function(_0x2e7665){if(_0x2e7665){var _0x14fcae=_['map'](_0x4d3242,function(_0x422a96){db[_0x8f7d('0x99')][_0x8f7d('0x58')]({'where':{'UserId':_0x422a96,'VoicePrefixId':_0x2e7665['VoicePrefixId']}});});return Promise[_0x8f7d('0x93')](_0x14fcae);}});});});}})[_0x8f7d('0x2b')](respondWithStatusCode(_0x9dafae,null))['catch'](handleError(_0x9dafae,null));};exports[_0x8f7d('0x9a')]=function(_0x35030c,_0x5f95ef,_0x25586b){var _0x5deb29={};var _0x3c8b4b={};var _0x2c3880;var _0x2cf5ff;return db[_0x8f7d('0x32')]['findOne']({'where':{'id':_0x35030c[_0x8f7d('0x4a')]['id']}})[_0x8f7d('0x2b')](handleEntityNotFound(_0x5f95ef,null))['then'](function(_0x4f2a50){if(_0x4f2a50){_0x2c3880=_0x4f2a50;_0x3c8b4b[_0x8f7d('0x35')]=_[_0x8f7d('0x37')](db['User'][_0x8f7d('0x33')]);_0x3c8b4b[_0x8f7d('0x36')]=_[_0x8f7d('0x37')](_0x35030c['query']);_0x3c8b4b[_0x8f7d('0x38')]=_[_0x8f7d('0x4b')](_0x3c8b4b['model'],_0x3c8b4b['query']);_0x5deb29[_0x8f7d('0x39')]=_[_0x8f7d('0x4b')](_0x3c8b4b['model'],qs[_0x8f7d('0x3a')](_0x35030c[_0x8f7d('0x36')]['fields']));_0x5deb29[_0x8f7d('0x39')]=_0x5deb29[_0x8f7d('0x39')][_0x8f7d('0x3b')]?_0x5deb29[_0x8f7d('0x39')]:_0x3c8b4b[_0x8f7d('0x35')];_0x5deb29['order']=qs['sort'](_0x35030c[_0x8f7d('0x36')][_0x8f7d('0x3d')]);_0x5deb29[_0x8f7d('0x3e')]=qs['filters'](_[_0x8f7d('0x3f')](_0x35030c['query'],_0x3c8b4b['filters']));if(_0x35030c['query']['filter']){_0x5deb29[_0x8f7d('0x3e')]=_[_0x8f7d('0x41')](_0x5deb29[_0x8f7d('0x3e')],{'$or':_[_0x8f7d('0x31')](_0x5deb29[_0x8f7d('0x39')],function(_0x44944b){var _0x547236={};_0x547236[_0x44944b]={'$like':'%'+_0x35030c['query'][_0x8f7d('0x40')]+'%'};return _0x547236;})});}_0x5deb29=_[_0x8f7d('0x41')]({},_0x5deb29,_0x35030c[_0x8f7d('0x43')]);return _0x2c3880['getAgents'](_0x5deb29);}})[_0x8f7d('0x2b')](function(_0x4f5fc7){if(_0x4f5fc7){_0x2cf5ff=_0x4f5fc7[_0x8f7d('0x3b')];if(!_0x35030c[_0x8f7d('0x36')]['hasOwnProperty']('nolimit')){_0x5deb29[_0x8f7d('0x24')]=qs[_0x8f7d('0x24')](_0x35030c[_0x8f7d('0x36')]['limit']);_0x5deb29[_0x8f7d('0x21')]=qs['offset'](_0x35030c[_0x8f7d('0x36')][_0x8f7d('0x21')]);}return _0x2c3880[_0x8f7d('0x9a')](_0x5deb29);}})[_0x8f7d('0x2b')](function(_0x474fa2){if(_0x474fa2){return _0x474fa2?{'count':_0x2cf5ff,'rows':_0x474fa2}:null;}})[_0x8f7d('0x2b')](respondWithResult(_0x5f95ef,null))['catch'](handleError(_0x5f95ef,null));}; \ No newline at end of file +var _0x9333=['VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','isValidChannel','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','ValidationError','add','ids','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','removeAgents','emit','Queue:remove','getAgents','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x9333,0x16f));var _0x3933=function(_0x42ca28,_0x1d25e5){_0x42ca28=_0x42ca28-0x0;var _0x1ebacd=_0x9333[_0x42ca28];return _0x1ebacd;};'use strict';var emlformat=require(_0x3933('0x0'));var rimraf=require(_0x3933('0x1'));var zipdir=require(_0x3933('0x2'));var jsonpatch=require(_0x3933('0x3'));var rp=require(_0x3933('0x4'));var moment=require(_0x3933('0x5'));var BPromise=require(_0x3933('0x6'));var Mustache=require(_0x3933('0x7'));var util=require(_0x3933('0x8'));var path=require(_0x3933('0x9'));var sox=require('sox');var csv=require(_0x3933('0xa'));var ejs=require(_0x3933('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3933('0xc'));var crypto=require(_0x3933('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3933('0xa'));var querystring=require('querystring');var Papa=require(_0x3933('0xe'));var Redis=require(_0x3933('0xf'));var authService=require(_0x3933('0x10'));var qs=require(_0x3933('0x11'));var as=require(_0x3933('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3933('0x13'))(_0x3933('0x14'));var utils=require(_0x3933('0x15'));var config=require(_0x3933('0x16'));var licenseUtil=require(_0x3933('0x17'));var db=require(_0x3933('0x18'))['db'];config['redis']=_[_0x3933('0x19')](config[_0x3933('0x1a')],{'host':_0x3933('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3933('0x1a')]));require(_0x3933('0x1c'))[_0x3933('0x1d')](socket);function respondWithStatusCode(_0x2734a8,_0x59ce87){_0x59ce87=_0x59ce87||0xcc;return function(_0x5dbda8){if(_0x5dbda8){return _0x2734a8[_0x3933('0x1e')](_0x59ce87);}return _0x2734a8[_0x3933('0x1f')](_0x59ce87)['end']();};}function respondWithResult(_0x289371,_0x736e63){_0x736e63=_0x736e63||0xc8;return function(_0x59f295){if(_0x59f295){return _0x289371[_0x3933('0x1f')](_0x736e63)[_0x3933('0x20')](_0x59f295);}};}function respondWithFilteredResult(_0xdd5690,_0x52fee3){return function(_0x4f8f4e){if(_0x4f8f4e){var _0x1e6b30=typeof _0x52fee3['offset']===_0x3933('0x21')&&typeof _0x52fee3[_0x3933('0x22')]==='undefined';var _0x404657=_0x4f8f4e[_0x3933('0x23')];var _0x3211ce=_0x1e6b30?0x0:_0x52fee3[_0x3933('0x24')];var _0x498302=_0x1e6b30?_0x4f8f4e['count']:_0x52fee3[_0x3933('0x24')]+_0x52fee3['limit'];var _0x15e086;if(_0x498302>=_0x404657){_0x498302=_0x404657;_0x15e086=0xc8;}else{_0x15e086=0xce;}_0xdd5690[_0x3933('0x1f')](_0x15e086);return _0xdd5690[_0x3933('0x25')](_0x3933('0x26'),_0x3211ce+'-'+_0x498302+'/'+_0x404657)[_0x3933('0x20')](_0x4f8f4e);}return null;};}function patchUpdates(_0x22e3dc){return function(_0x509810){try{jsonpatch[_0x3933('0x27')](_0x509810,_0x22e3dc,!![]);}catch(_0x33ef16){return BPromise['reject'](_0x33ef16);}return _0x509810[_0x3933('0x28')]();};}function saveUpdates(_0x1af568,_0x32582f){return function(_0x1d89e7){if(_0x1d89e7){return _0x1d89e7[_0x3933('0x29')](_0x1af568)[_0x3933('0x2a')](function(_0x55065e){return _0x55065e;});}return null;};}function handleEntityNotFound(_0x1c5190,_0x440164){return function(_0x5091ce){if(!_0x5091ce){_0x1c5190['sendStatus'](0x194);}return _0x5091ce;};}function handleError(_0x79af3e,_0x1184a7){_0x1184a7=_0x1184a7||0x1f4;return function(_0x4cc2ad){logger['error'](_0x4cc2ad[_0x3933('0x2b')]);if(_0x4cc2ad[_0x3933('0x2c')]){delete _0x4cc2ad[_0x3933('0x2c')];}_0x79af3e[_0x3933('0x1f')](_0x1184a7)[_0x3933('0x2d')](_0x4cc2ad);};}exports[_0x3933('0x2e')]=function(_0x1f713d,_0x47c956){var _0x302294={},_0x1d6fcf={},_0x1d702d={'count':0x0,'rows':[]};var _0x3cc652=_[_0x3933('0x2f')](db[_0x3933('0x30')][_0x3933('0x31')],function(_0x26f1bf){return{'name':_0x26f1bf['fieldName'],'type':_0x26f1bf[_0x3933('0x32')][_0x3933('0x33')]};});_0x1d6fcf[_0x3933('0x34')]=_[_0x3933('0x2f')](_0x3cc652,_0x3933('0x2c'));_0x1d6fcf['query']=_['keys'](_0x1f713d[_0x3933('0x35')]);_0x1d6fcf[_0x3933('0x36')]=_['intersection'](_0x1d6fcf[_0x3933('0x34')],_0x1d6fcf[_0x3933('0x35')]);_0x302294[_0x3933('0x37')]=_[_0x3933('0x38')](_0x1d6fcf['model'],qs[_0x3933('0x39')](_0x1f713d['query'][_0x3933('0x39')]));_0x302294[_0x3933('0x37')]=_0x302294[_0x3933('0x37')][_0x3933('0x3a')]?_0x302294[_0x3933('0x37')]:_0x1d6fcf['model'];if(!_0x1f713d[_0x3933('0x35')]['hasOwnProperty'](_0x3933('0x3b'))){_0x302294['limit']=qs[_0x3933('0x22')](_0x1f713d[_0x3933('0x35')][_0x3933('0x22')]);_0x302294[_0x3933('0x24')]=qs[_0x3933('0x24')](_0x1f713d[_0x3933('0x35')][_0x3933('0x24')]);}_0x302294['order']=qs[_0x3933('0x3c')](_0x1f713d['query']['sort']);_0x302294[_0x3933('0x3d')]=qs[_0x3933('0x36')](_[_0x3933('0x3e')](_0x1f713d[_0x3933('0x35')],_0x1d6fcf[_0x3933('0x36')]),_0x3cc652);if(_0x1f713d['query']['filter']){_0x302294[_0x3933('0x3d')]=_[_0x3933('0x3f')](_0x302294[_0x3933('0x3d')],{'$or':_['map'](_0x3cc652,function(_0x3300cd){if(_0x3300cd[_0x3933('0x32')]!==_0x3933('0x40')){var _0x25b1f2={};_0x25b1f2[_0x3300cd[_0x3933('0x2c')]]={'$like':'%'+_0x1f713d[_0x3933('0x35')][_0x3933('0x41')]+'%'};return _0x25b1f2;}})});}_0x302294=_['merge']({},_0x302294,_0x1f713d[_0x3933('0x42')]);var _0x13c47f={'where':_0x302294[_0x3933('0x3d')]};return db[_0x3933('0x30')][_0x3933('0x23')](_0x13c47f)['then'](function(_0x5108b0){_0x1d702d[_0x3933('0x23')]=_0x5108b0;if(_0x1f713d[_0x3933('0x35')][_0x3933('0x43')]){_0x302294[_0x3933('0x44')]=[{'all':!![]}];}return db[_0x3933('0x30')][_0x3933('0x45')](_0x302294);})[_0x3933('0x2a')](function(_0x4153b8){_0x1d702d[_0x3933('0x46')]=_0x4153b8;return _0x1d702d;})[_0x3933('0x2a')](respondWithFilteredResult(_0x47c956,_0x302294))[_0x3933('0x47')](handleError(_0x47c956,null));};exports[_0x3933('0x48')]=function(_0x5e9856,_0x11d345){var _0x47b494={'raw':![],'where':{'id':_0x5e9856[_0x3933('0x49')]['id']}},_0x338c64={};_0x338c64[_0x3933('0x34')]=_[_0x3933('0x4a')](db['Team'][_0x3933('0x31')]);_0x338c64[_0x3933('0x35')]=_[_0x3933('0x4a')](_0x5e9856[_0x3933('0x35')]);_0x338c64[_0x3933('0x36')]=_['intersection'](_0x338c64['model'],_0x338c64[_0x3933('0x35')]);_0x47b494[_0x3933('0x37')]=_[_0x3933('0x38')](_0x338c64['model'],qs[_0x3933('0x39')](_0x5e9856['query'][_0x3933('0x39')]));_0x47b494[_0x3933('0x37')]=_0x47b494[_0x3933('0x37')][_0x3933('0x3a')]?_0x47b494['attributes']:_0x338c64['model'];if(_0x5e9856['query']['includeAll']){_0x47b494[_0x3933('0x44')]=[{'all':!![]}];}_0x47b494=_[_0x3933('0x3f')]({},_0x47b494,_0x5e9856['options']);return db['Team'][_0x3933('0x4b')](_0x47b494)[_0x3933('0x2a')](handleEntityNotFound(_0x11d345,null))[_0x3933('0x2a')](respondWithResult(_0x11d345,null))[_0x3933('0x47')](handleError(_0x11d345,null));};exports[_0x3933('0x4c')]=function(_0x47ff94,_0x20f07d){return db[_0x3933('0x30')][_0x3933('0x4c')](_0x47ff94[_0x3933('0x4d')],{})[_0x3933('0x2a')](function(_0x1a7a05){var _0x20ea9a=_0x47ff94[_0x3933('0x4e')][_0x3933('0x4f')]({'plain':!![]});if(!_0x20ea9a)throw new Error(_0x3933('0x50'));if(_0x20ea9a['role']==='user'){var _0x2fb6e9=_0x1a7a05[_0x3933('0x4f')]({'plain':!![]});var _0x5845db=_0x3933('0x51');return db[_0x3933('0x52')][_0x3933('0x4b')]({'where':{'name':_0x5845db,'userProfileId':_0x20ea9a[_0x3933('0x53')]},'raw':!![]})[_0x3933('0x2a')](function(_0x4a2940){if(_0x4a2940&&_0x4a2940[_0x3933('0x54')]===0x0){return db[_0x3933('0x55')][_0x3933('0x4c')]({'name':_0x2fb6e9[_0x3933('0x2c')],'resourceId':_0x2fb6e9['id'],'type':_0x4a2940[_0x3933('0x2c')],'sectionId':_0x4a2940['id']},{})[_0x3933('0x2a')](function(){return _0x1a7a05;});}else{return _0x1a7a05;}})[_0x3933('0x47')](function(_0x2f460d){logger['error'](_0x3933('0x56'),_0x2f460d);throw _0x2f460d;});}return _0x1a7a05;})[_0x3933('0x2a')](respondWithResult(_0x20f07d,0xc9))[_0x3933('0x47')](handleError(_0x20f07d,null));};exports[_0x3933('0x29')]=function(_0x1b9a48,_0x2dc4d9){if(_0x1b9a48[_0x3933('0x4d')]['id']){delete _0x1b9a48[_0x3933('0x4d')]['id'];}return db[_0x3933('0x30')][_0x3933('0x4b')]({'where':{'id':_0x1b9a48[_0x3933('0x49')]['id']}})[_0x3933('0x2a')](handleEntityNotFound(_0x2dc4d9,null))[_0x3933('0x2a')](saveUpdates(_0x1b9a48[_0x3933('0x4d')],null))[_0x3933('0x2a')](respondWithResult(_0x2dc4d9,null))[_0x3933('0x47')](handleError(_0x2dc4d9,null));};exports[_0x3933('0x57')]=function(_0xb7fe28,_0x3b917d){var _0x4d419f=_0xb7fe28[_0x3933('0x49')]['id'];var _0x5dcb23=[];return db[_0x3933('0x58')][_0x3933('0x59')](function(_0x26be84){var _0xb3260c=_0x3933('0x5a')+_0x4d419f;return db[_0x3933('0x58')][_0x3933('0x35')](_0xb3260c,{'type':db[_0x3933('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x26be84})[_0x3933('0x2a')](function(_0x188404){_0x5dcb23=_[_0x3933('0x2f')](_0x188404,function(_0x38a5c4){return Number(_0x38a5c4['UserId']);});})[_0x3933('0x2a')](function(){var _0x3641cb=_0x3933('0x5c')+_0x4d419f;return db[_0x3933('0x58')][_0x3933('0x35')](_0x3641cb,{'type':db['Sequelize'][_0x3933('0x5d')][_0x3933('0x5e')],'raw':!![],'transaction':_0x26be84});})['then'](function(_0x40b12a){var _0x3adc01=_[_0x3933('0x2f')](_0x40b12a,function(_0x50e9f9){return Number(_0x50e9f9[_0x3933('0x5f')]);});return db['UserVoiceQueue'][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'VoiceQueueId':{'$in':_0x3adc01}},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){var _0x1c970e=_0x3933('0x60')+_0x4d419f;return db[_0x3933('0x58')]['query'](_0x1c970e,{'type':db[_0x3933('0x5b')][_0x3933('0x5d')]['SELECT'],'raw':!![],'transaction':_0x26be84});})[_0x3933('0x2a')](function(_0x405713){var _0x351241=_[_0x3933('0x2f')](_0x405713,function(_0x13fecb){return Number(_0x13fecb['MailQueueId']);});return db['UserMailQueue'][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'MailQueueId':{'$in':_0x351241}},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){var _0x42de05='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d419f;return db[_0x3933('0x58')][_0x3933('0x35')](_0x42de05,{'type':db['Sequelize'][_0x3933('0x5d')]['SELECT'],'raw':!![],'transaction':_0x26be84});})[_0x3933('0x2a')](function(_0x4fcc5e){var _0x38b653=_['map'](_0x4fcc5e,function(_0x27321e){return Number(_0x27321e[_0x3933('0x61')]);});return db[_0x3933('0x62')][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'SmsQueueId':{'$in':_0x38b653}},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){var _0x1e4897=_0x3933('0x63')+_0x4d419f;return db['sequelize'][_0x3933('0x35')](_0x1e4897,{'type':db[_0x3933('0x5b')][_0x3933('0x5d')][_0x3933('0x5e')],'raw':!![],'transaction':_0x26be84});})[_0x3933('0x2a')](function(_0x55edfc){var _0x3ca703=_[_0x3933('0x2f')](_0x55edfc,function(_0x694892){return Number(_0x694892[_0x3933('0x64')]);});return db[_0x3933('0x65')]['destroy']({'where':{'UserId':{'$in':_0x5dcb23},'ChatQueueId':{'$in':_0x3ca703}},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){var _0x5a543c=_0x3933('0x66')+_0x4d419f;return db[_0x3933('0x58')][_0x3933('0x35')](_0x5a543c,{'type':db[_0x3933('0x5b')]['QueryTypes'][_0x3933('0x5e')],'raw':!![],'transaction':_0x26be84});})[_0x3933('0x2a')](function(_0xde712e){var _0x576830=_['map'](_0xde712e,function(_0x5bc4f8){return Number(_0x5bc4f8[_0x3933('0x67')]);});return db[_0x3933('0x68')][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'FaxQueueId':{'$in':_0x576830}},'transaction':_0x26be84});})['then'](function(){var _0x546624=_0x3933('0x69')+_0x4d419f;return db[_0x3933('0x58')][_0x3933('0x35')](_0x546624,{'type':db[_0x3933('0x5b')]['QueryTypes'][_0x3933('0x5e')],'raw':!![],'transaction':_0x26be84});})[_0x3933('0x2a')](function(_0x328fae){var _0x1402e2=_[_0x3933('0x2f')](_0x328fae,function(_0x263d87){return Number(_0x263d87[_0x3933('0x6a')]);});return db[_0x3933('0x6b')][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'OpenchannelQueueId':{'$in':_0x1402e2}},'transaction':_0x26be84});})['then'](function(){var _0x32dfbd=_0x3933('0x6c')+_0x4d419f;return db[_0x3933('0x58')]['query'](_0x32dfbd,{'type':db[_0x3933('0x5b')]['QueryTypes'][_0x3933('0x5e')],'raw':!![],'transaction':_0x26be84});})['then'](function(_0x5a88d0){var _0x107b98=_[_0x3933('0x2f')](_0x5a88d0,function(_0x21f3f8){return Number(_0x21f3f8['WhatsappQueueId']);});return db[_0x3933('0x6d')][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'WhatsappQueueId':{'$in':_0x107b98}},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){return db[_0x3933('0x6e')][_0x3933('0x4b')]({'where':{'TeamId':_0x4d419f}});})[_0x3933('0x2a')](function(_0x5a54a2){if(_0x5a54a2===null){return;}return db[_0x3933('0x6f')][_0x3933('0x57')]({'where':{'UserId':{'$in':_0x5dcb23},'VoicePrefixId':_0x5a54a2[_0x3933('0x70')]},'transaction':_0x26be84});})[_0x3933('0x2a')](function(){return db['Team'][_0x3933('0x57')]({'where':{'id':_0x4d419f},'cascade':!![],'transaction':_0x26be84});})['then'](function(_0x7b4b78){if(_0x7b4b78===0x0){_0x3b917d[_0x3933('0x1e')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0x3933('0x51'),'resourceId':_0x4d419f},'cascade':!![],'transaction':_0x26be84})['then'](function(){_0x3b917d[_0x3933('0x1f')](0xcc)['end']();});}})[_0x3933('0x47')](function(_0x332dd1){_0x3b917d[_0x3933('0x1f')](0x1f4)['send'](_0x332dd1);});});};exports['getQueues']=function(_0x444bb9,_0xdaf568,_0x265778){return db[_0x3933('0x30')][_0x3933('0x71')]({'where':{'id':_0x444bb9[_0x3933('0x49')]['id']}})[_0x3933('0x2a')](handleEntityNotFound(_0xdaf568,null))[_0x3933('0x2a')](function(_0x535eb8){if(!_0x444bb9[_0x3933('0x35')]['channel']||!utils[_0x3933('0x72')](_0x444bb9[_0x3933('0x35')][_0x3933('0x73')])){throw new db['Sequelize']['ValidationError'](_0x3933('0x74'));}var _0x5493cc={};var _0x32345c={};_0x32345c[_0x3933('0x34')]=_['keys'](db[_[_0x3933('0x75')](_0x444bb9['query']['channel'][_0x3933('0x76')]())+_0x3933('0x77')][_0x3933('0x31')]);_0x32345c['query']=_[_0x3933('0x4a')](_0x444bb9['query']);_0x32345c['filters']=_[_0x3933('0x38')](_0x32345c[_0x3933('0x34')],_0x32345c[_0x3933('0x35')]);_0x5493cc[_0x3933('0x37')]=_[_0x3933('0x38')](_0x32345c['model'],qs['fields'](_0x444bb9[_0x3933('0x35')][_0x3933('0x39')]));_0x5493cc['attributes']=_0x5493cc[_0x3933('0x37')]['length']?_0x5493cc[_0x3933('0x37')]:_0x32345c[_0x3933('0x34')];_0x5493cc[_0x3933('0x22')]=qs[_0x3933('0x22')](_0x444bb9['query'][_0x3933('0x22')]);_0x5493cc[_0x3933('0x24')]=qs[_0x3933('0x24')](_0x444bb9['query'][_0x3933('0x24')]);_0x5493cc['order']=qs[_0x3933('0x3c')](_0x444bb9[_0x3933('0x35')][_0x3933('0x3c')]);_0x5493cc['where']=qs['filters'](_['pick'](_0x444bb9['query'],_0x32345c['filters']));_0x5493cc=_[_0x3933('0x3f')]({},_0x5493cc,_0x444bb9['options']);return _0x535eb8['get'+_[_0x3933('0x75')](_0x444bb9[_0x3933('0x35')][_0x3933('0x73')][_0x3933('0x76')]())+_0x3933('0x78')](_0x5493cc);})[_0x3933('0x2a')](respondWithResult(_0xdaf568,null))[_0x3933('0x47')](handleError(_0xdaf568,null));};exports[_0x3933('0x79')]=function(_0xc2a44e,_0x4f5c17,_0x3ba487){return db[_0x3933('0x30')][_0x3933('0x71')]({'where':{'id':_0xc2a44e[_0x3933('0x49')]['id']}})['then'](function(_0x310b0a){if(_0x310b0a){if(!_0xc2a44e[_0x3933('0x4d')][_0x3933('0x73')]||!utils[_0x3933('0x72')](_0xc2a44e['body']['channel'])){throw new db['Sequelize'][(_0x3933('0x7a'))]('Unknown\x20channel');}return _0x310b0a[_0x3933('0x7b')+_['capitalize'](_0xc2a44e[_0x3933('0x4d')][_0x3933('0x73')][_0x3933('0x76')]())+_0x3933('0x78')](_0xc2a44e['body'][_0x3933('0x7c')]);}return null;})[_0x3933('0x2a')](handleEntityNotFound(_0x4f5c17,null))[_0x3933('0x2a')](respondWithStatusCode(_0x4f5c17,null))['catch'](handleError(_0x4f5c17,null));};exports['removeQueues']=function(_0xb51a9b,_0x13f22a,_0x5dc850){return db[_0x3933('0x30')]['findOne']({'where':{'id':_0xb51a9b[_0x3933('0x49')]['id']}})['then'](function(_0x3bb985){if(_0x3bb985){if(!_0xb51a9b['query']['channel']||!utils[_0x3933('0x72')](_0xb51a9b['query'][_0x3933('0x73')])){throw new db['Sequelize'][(_0x3933('0x7a'))](_0x3933('0x74'));}return _0x3bb985['remove'+_[_0x3933('0x75')](_0xb51a9b['query'][_0x3933('0x73')][_0x3933('0x76')]())+_0x3933('0x78')](_0xb51a9b[_0x3933('0x35')][_0x3933('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x13f22a,null))[_0x3933('0x2a')](respondWithStatusCode(_0x13f22a,null))[_0x3933('0x47')](handleError(_0x13f22a,null));};exports['addAgents']=function(_0x1fdd94,_0x302aaf){var _0x5ebced=_[_0x3933('0x7d')](_0x1fdd94[_0x3933('0x4d')][_0x3933('0x7c')])?_0x1fdd94['body'][_0x3933('0x7c')]:[_0x1fdd94['body'][_0x3933('0x7c')]];var _0x9acd40=_0x1fdd94[_0x3933('0x49')]['id'];return db['Team']['find']({'where':{'id':_0x9acd40}})[_0x3933('0x2a')](handleEntityNotFound(_0x302aaf,null))[_0x3933('0x2a')](function(_0x334303){if(_0x334303){var _0x5ada1d=[_0x3933('0x7e'),'Chat',_0x3933('0x7f'),_0x3933('0x80'),_0x3933('0x81'),_0x3933('0x82'),_0x3933('0x83')];return db[_0x3933('0x58')][_0x3933('0x59')](function(_0x2e44cf){var _0x1a871c=_[_0x3933('0x2f')](_0x5ada1d,function(_0x54d431){var _0x41b21c={'attributes':['id','name']};if(_0x54d431===_0x3933('0x7e')){_0x41b21c[_0x3933('0x84')]={'attributes':[_0x3933('0x85')]};}return _0x334303['get'+_0x54d431+_0x3933('0x78')](_0x41b21c)[_0x3933('0x2a')](function(_0x2d328a){var _0x20cfed=_[_0x3933('0x2f')](_0x2d328a,function(_0x18df4f){var _0x5e29a2=_[_0x3933('0x2f')](_0x5ebced,function(_0x4d4e5f){var _0x300fb8={'where':{'UserId':_0x4d4e5f,[_0x54d431+_0x3933('0x86')]:_0x18df4f['id']},'transaction':_0x2e44cf};if(_0x54d431===_0x3933('0x7e')){_0x300fb8[_0x3933('0x19')]={'penalty':_0x18df4f[_0x3933('0x87')][_0x3933('0x85')]};}return db[_0x3933('0x88')+_0x54d431+_0x3933('0x77')][_0x3933('0x89')](_0x300fb8)[_0x3933('0x2a')](function(){socket['emit'](_0x3933('0x4e')+_0x54d431+_0x3933('0x8a'),{'UserId':_0x4d4e5f,[_0x54d431+_0x3933('0x86')]:_0x18df4f['id']});if(_0x54d431!==_0x3933('0x7e')){return;}return db[_0x3933('0x88')][_0x3933('0x45')]({'where':{'id':_0x5ebced,'online':0x1},'attributes':['id',_0x3933('0x2c'),_0x3933('0x8b'),_0x3933('0x8c'),'interface'],'raw':!![]})['then'](function(_0x458a86){var _0x55e9d0=_[_0x3933('0x2f')](_0x458a86,function(_0x17e1c8){return db[_0x3933('0x8d')][_0x3933('0x8e')]({'membername':_0x17e1c8[_0x3933('0x2c')],'UserId':_0x17e1c8['id'],'queue_name':_0x18df4f['name'],'VoiceQueueId':_0x18df4f['id'],'interface':_[_0x3933('0x8f')](_0x17e1c8[_0x3933('0x90')])?util[_0x3933('0x91')](_0x3933('0x92'),_0x17e1c8[_0x3933('0x2c')]):_0x17e1c8[_0x3933('0x90')],'paused':_0x17e1c8[_0x3933('0x8c')]||![],'penalty':_0x18df4f[_0x3933('0x87')]['penalty']},{'transaction':_0x2e44cf});});return Promise[_0x3933('0x93')](_0x55e9d0);});});});return Promise['all'](_0x5e29a2);});return Promise[_0x3933('0x93')](_0x20cfed);})[_0x3933('0x2a')](function(){return db['TeamVoicePrefix'][_0x3933('0x71')]({'where':{'teamId':_0x9acd40}})[_0x3933('0x2a')](function(_0x53be45){if(_0x53be45){var _0x421d00=_[_0x3933('0x2f')](_0x5ebced,function(_0x31b38a){db['UserVoicePrefix']['upsert']({'UserId':_0x31b38a,'VoicePrefixId':_0x53be45[_0x3933('0x70')]});});return Promise['all'](_0x421d00);}});});});return Promise['all'](_0x1a871c)[_0x3933('0x2a')](function(){return _0x334303['addAgents'](_0x5ebced,{'transaction':_0x2e44cf})['spread'](function(_0x5f56c7){return _0x5f56c7;});});});}})[_0x3933('0x2a')](respondWithResult(_0x302aaf,null))['catch'](handleError(_0x302aaf,null));};exports[_0x3933('0x94')]=function(_0xdedae3,_0x23c5cf){var _0x2a209d=_['isArray'](_0xdedae3[_0x3933('0x35')][_0x3933('0x7c')])?_0xdedae3['query']['ids']:[_0xdedae3['query'][_0x3933('0x7c')]];var _0xafc29=_0xdedae3[_0x3933('0x49')]['id'];return db['Team']['find']({'where':{'id':_0xafc29}})[_0x3933('0x2a')](handleEntityNotFound(_0x23c5cf,null))[_0x3933('0x2a')](function(_0xe70585){if(_0xe70585){var _0x2a363e=[_0x3933('0x7e'),'Chat','Mail',_0x3933('0x80'),_0x3933('0x81'),_0x3933('0x82'),_0x3933('0x83')];return db[_0x3933('0x58')]['transaction'](function(_0x4daeb5){var _0x2fadb9=_[_0x3933('0x2f')](_0x2a363e,function(_0x4221f6){var _0x4152b8={'attributes':['id',_0x3933('0x2c')]};return _0xe70585[_0x3933('0x4f')+_0x4221f6+_0x3933('0x78')](_0x4152b8)['then'](function(_0xbf4baa){var _0x308603=_[_0x3933('0x2f')](_0xbf4baa,function(_0x5d8240){return _0x5d8240[_0x3933('0x94')](_0x2a209d,{'transaction':_0x4daeb5})[_0x3933('0x2a')](function(){var _0x391a89=_[_0x3933('0x2f')](_0x2a209d,function(_0x35966a){socket[_0x3933('0x95')](_0x3933('0x4e')+_0x4221f6+_0x3933('0x96'),{'UserId':Number(_0x35966a),[_0x4221f6+_0x3933('0x86')]:_0x5d8240['id']});if(_0x4221f6!==_0x3933('0x7e')){return;}return db[_0x3933('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x5d8240['id'],'UserId':_0x35966a},'transaction':_0x4daeb5});});return Promise[_0x3933('0x93')](_0x391a89);});});return Promise[_0x3933('0x93')](_0x308603);});});return Promise[_0x3933('0x93')](_0x2fadb9)[_0x3933('0x2a')](function(){return _0xe70585[_0x3933('0x94')](_0x2a209d,{'transaction':_0x4daeb5});})[_0x3933('0x2a')](function(){return db['TeamVoicePrefix'][_0x3933('0x71')]({'where':{'teamId':_0xafc29}})[_0x3933('0x2a')](function(_0x270718){if(_0x270718){var _0xe5e33f=_['map'](_0x2a209d,function(_0x50ba2e){db[_0x3933('0x6f')][_0x3933('0x57')]({'where':{'UserId':_0x50ba2e,'VoicePrefixId':_0x270718[_0x3933('0x70')]}});});return Promise[_0x3933('0x93')](_0xe5e33f);}});});});}})[_0x3933('0x2a')](respondWithStatusCode(_0x23c5cf,null))[_0x3933('0x47')](handleError(_0x23c5cf,null));};exports[_0x3933('0x97')]=function(_0x1f7610,_0x4f935a,_0x43d737){var _0x33e08c={};var _0x3c6d3d={};var _0x582106;var _0xfd14de;return db['Team'][_0x3933('0x71')]({'where':{'id':_0x1f7610['params']['id']}})['then'](handleEntityNotFound(_0x4f935a,null))[_0x3933('0x2a')](function(_0x3d5179){if(_0x3d5179){_0x582106=_0x3d5179;_0x3c6d3d[_0x3933('0x34')]=_['keys'](db[_0x3933('0x88')]['rawAttributes']);_0x3c6d3d[_0x3933('0x35')]=_[_0x3933('0x4a')](_0x1f7610[_0x3933('0x35')]);_0x3c6d3d['filters']=_['intersection'](_0x3c6d3d['model'],_0x3c6d3d['query']);_0x33e08c[_0x3933('0x37')]=_[_0x3933('0x38')](_0x3c6d3d[_0x3933('0x34')],qs['fields'](_0x1f7610[_0x3933('0x35')][_0x3933('0x39')]));_0x33e08c[_0x3933('0x37')]=_0x33e08c[_0x3933('0x37')][_0x3933('0x3a')]?_0x33e08c[_0x3933('0x37')]:_0x3c6d3d[_0x3933('0x34')];_0x33e08c[_0x3933('0x98')]=qs[_0x3933('0x3c')](_0x1f7610['query'][_0x3933('0x3c')]);_0x33e08c['where']=qs[_0x3933('0x36')](_[_0x3933('0x3e')](_0x1f7610['query'],_0x3c6d3d['filters']));if(_0x1f7610[_0x3933('0x35')][_0x3933('0x41')]){_0x33e08c[_0x3933('0x3d')]=_['merge'](_0x33e08c[_0x3933('0x3d')],{'$or':_['map'](_0x33e08c['attributes'],function(_0x201fc0){var _0x3e9f6b={};_0x3e9f6b[_0x201fc0]={'$like':'%'+_0x1f7610[_0x3933('0x35')][_0x3933('0x41')]+'%'};return _0x3e9f6b;})});}_0x33e08c=_[_0x3933('0x3f')]({},_0x33e08c,_0x1f7610[_0x3933('0x42')]);return _0x582106[_0x3933('0x97')](_0x33e08c);}})[_0x3933('0x2a')](function(_0x273417){if(_0x273417){_0xfd14de=_0x273417[_0x3933('0x3a')];if(!_0x1f7610[_0x3933('0x35')][_0x3933('0x99')]('nolimit')){_0x33e08c[_0x3933('0x22')]=qs[_0x3933('0x22')](_0x1f7610[_0x3933('0x35')][_0x3933('0x22')]);_0x33e08c[_0x3933('0x24')]=qs[_0x3933('0x24')](_0x1f7610['query'][_0x3933('0x24')]);}return _0x582106[_0x3933('0x97')](_0x33e08c);}})[_0x3933('0x2a')](function(_0x3cbc2f){if(_0x3cbc2f){return _0x3cbc2f?{'count':_0xfd14de,'rows':_0x3cbc2f}:null;}})[_0x3933('0x2a')](respondWithResult(_0x4f935a,null))[_0x3933('0x47')](handleError(_0x4f935a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8953e4c..92d889c 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 _0x90c4=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0xd4724a,_0x3ab941){var _0x2515b4=function(_0x1dd83f){while(--_0x1dd83f){_0xd4724a['push'](_0xd4724a['shift']());}};_0x2515b4(++_0x3ab941);}(_0x90c4,0xd4));var _0x490c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x90c4[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require('events');var Team=require(_0x490c('0x0'))['db'][_0x490c('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x490c('0x2')](0x0);var events={'afterCreate':_0x490c('0x3'),'afterUpdate':_0x490c('0x4'),'afterDestroy':_0x490c('0x5')};function emitEvent(_0xc93c00){return function(_0x2851a9,_0x305d8c,_0xaa49ab){TeamEvents[_0x490c('0x6')](_0xc93c00+':'+_0x2851a9['id'],_0x2851a9);TeamEvents['emit'](_0xc93c00,_0x2851a9);_0xaa49ab(null);};}for(var e in events){if(events[_0x490c('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x490c('0x8')]=TeamEvents; \ No newline at end of file +var _0x244e=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','Team','setMaxListeners'];(function(_0x39ea15,_0x3a8595){var _0x27e381=function(_0x2866ea){while(--_0x2866ea){_0x39ea15['push'](_0x39ea15['shift']());}};_0x27e381(++_0x3a8595);}(_0x244e,0x1ec));var _0xe244=function(_0x3be3be,_0x224591){_0x3be3be=_0x3be3be-0x0;var _0x464642=_0x244e[_0x3be3be];return _0x464642;};'use strict';var EventEmitter=require('events');var Team=require(_0xe244('0x0'))['db'][_0xe244('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe244('0x2')](0x0);var events={'afterCreate':_0xe244('0x3'),'afterUpdate':_0xe244('0x4'),'afterDestroy':_0xe244('0x5')};function emitEvent(_0x467d35){return function(_0x494035,_0xf44287,_0xfb5f63){TeamEvents[_0xe244('0x6')](_0x467d35+':'+_0x494035['id'],_0x494035);TeamEvents['emit'](_0x467d35,_0x494035);_0xfb5f63(null);};}for(var e in events){if(events[_0xe244('0x7')](e)){var event=events[e];Team[_0xe244('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ee76302..6413fad 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 _0x7e3a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger'];(function(_0x328e1a,_0x8c5baa){var _0x5918af=function(_0x33a64f){while(--_0x33a64f){_0x328e1a['push'](_0x328e1a['shift']());}};_0x5918af(++_0x8c5baa);}(_0x7e3a,0x138));var _0xa7e3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7e3a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa7e3('0x0'));var util=require(_0xa7e3('0x1'));var logger=require(_0xa7e3('0x2'))(_0xa7e3('0x3'));var moment=require(_0xa7e3('0x4'));var BPromise=require(_0xa7e3('0x5'));var rp=require(_0xa7e3('0x6'));var fs=require('fs');var path=require(_0xa7e3('0x7'));var rimraf=require(_0xa7e3('0x8'));var config=require(_0xa7e3('0x9'));var attributes=require(_0xa7e3('0xa'));module[_0xa7e3('0xb')]=function(_0x261d85,_0x47ac1b){return _0x261d85[_0xa7e3('0xc')](_0xa7e3('0xd'),attributes,{'tableName':_0xa7e3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1218=['rimraf','../../config/environment','./team.attributes','exports','define','Team','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x873466,_0x41b2d3){var _0x2e94d5=function(_0x227c5b){while(--_0x227c5b){_0x873466['push'](_0x873466['shift']());}};_0x2e94d5(++_0x41b2d3);}(_0x1218,0x76));var _0x8121=function(_0x184474,_0x1bb659){_0x184474=_0x184474-0x0;var _0x191247=_0x1218[_0x184474];return _0x191247;};'use strict';var _=require(_0x8121('0x0'));var util=require(_0x8121('0x1'));var logger=require(_0x8121('0x2'))(_0x8121('0x3'));var moment=require(_0x8121('0x4'));var BPromise=require(_0x8121('0x5'));var rp=require(_0x8121('0x6'));var fs=require('fs');var path=require(_0x8121('0x7'));var rimraf=require(_0x8121('0x8'));var config=require(_0x8121('0x9'));var attributes=require(_0x8121('0xa'));module[_0x8121('0xb')]=function(_0x3b6737,_0x100318){return _0x3b6737[_0x8121('0xc')](_0x8121('0xd'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f5ff64d..cc1e9e5 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 _0xb0b5=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x118489,_0x3e8b9e){var _0x2459c7=function(_0x554693){while(--_0x554693){_0x118489['push'](_0x118489['shift']());}};_0x2459c7(++_0x3e8b9e);}(_0xb0b5,0x17a));var _0x5b0b=function(_0x3ae8f4,_0x2920f4){_0x3ae8f4=_0x3ae8f4-0x0;var _0x367312=_0xb0b5[_0x3ae8f4];return _0x367312;};'use strict';var _=require(_0x5b0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b0b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b0b('0x2'))['db'];var utils=require(_0x5b0b('0x3'));var logger=require(_0x5b0b('0x4'))(_0x5b0b('0x5'));var config=require(_0x5b0b('0x6'));var jayson=require(_0x5b0b('0x7'));var client=jayson[_0x5b0b('0x8')][_0x5b0b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5b0b('0xa')],{'host':_0x5b0b('0xb'),'port':0x18eb});var socket=require(_0x5b0b('0xc'))(new Redis(config[_0x5b0b('0xa')]));require(_0x5b0b('0xd'))['register'](socket);function respondWithRpcPromise(_0x6af4c0,_0x41b44f,_0x3f0a67){return new BPromise(function(_0x465f14,_0x332b22){return client['request'](_0x6af4c0,_0x3f0a67)['then'](function(_0x40f21e){logger[_0x5b0b('0xe')]('Team,\x20%s,\x20%s',_0x41b44f,_0x5b0b('0xf'));logger[_0x5b0b('0x10')](_0x5b0b('0x11'),_0x41b44f,_0x5b0b('0xf'),JSON['stringify'](_0x40f21e));if(_0x40f21e[_0x5b0b('0x12')]){if(_0x40f21e[_0x5b0b('0x12')][_0x5b0b('0x13')]===0x1f4){logger[_0x5b0b('0x12')](_0x5b0b('0x14'),_0x41b44f,_0x40f21e[_0x5b0b('0x12')]['message']);return _0x332b22(_0x40f21e[_0x5b0b('0x12')][_0x5b0b('0x15')]);}logger[_0x5b0b('0x12')](_0x5b0b('0x14'),_0x41b44f,_0x40f21e[_0x5b0b('0x12')][_0x5b0b('0x15')]);return _0x465f14(_0x40f21e['error'][_0x5b0b('0x15')]);}else{logger[_0x5b0b('0xe')](_0x5b0b('0x14'),_0x41b44f,'request\x20sent');_0x465f14(_0x40f21e[_0x5b0b('0x16')][_0x5b0b('0x15')]);}})[_0x5b0b('0x17')](function(_0x3d9b27){logger[_0x5b0b('0x12')]('Team,\x20%s,\x20%s',_0x41b44f,_0x3d9b27);_0x332b22(_0x3d9b27);});});} \ No newline at end of file +var _0x56b0=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','socket.io-emitter','./team.socket','request','then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Team,\x20%s,\x20%s','result'];(function(_0x195a73,_0x4e4a07){var _0x2f5ef1=function(_0xda3937){while(--_0xda3937){_0x195a73['push'](_0x195a73['shift']());}};_0x2f5ef1(++_0x4e4a07);}(_0x56b0,0x83));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x056b('0x0'));var util=require(_0x056b('0x1'));var moment=require(_0x056b('0x2'));var BPromise=require(_0x056b('0x3'));var rs=require(_0x056b('0x4'));var fs=require('fs');var Redis=require(_0x056b('0x5'));var db=require(_0x056b('0x6'))['db'];var utils=require(_0x056b('0x7'));var logger=require('../../config/logger')(_0x056b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x056b('0x9')]['http']({'port':0x232a});config[_0x056b('0xa')]=_[_0x056b('0xb')](config[_0x056b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x056b('0xc'))(new Redis(config['redis']));require(_0x056b('0xd'))['register'](socket);function respondWithRpcPromise(_0xd764c6,_0x444fe6,_0x37568c){return new BPromise(function(_0x5dedcc,_0x27c008){return client[_0x056b('0xe')](_0xd764c6,_0x37568c)[_0x056b('0xf')](function(_0x5f41eb){logger[_0x056b('0x10')]('Team,\x20%s,\x20%s',_0x444fe6,_0x056b('0x11'));logger['debug'](_0x056b('0x12'),_0x444fe6,_0x056b('0x11'),JSON[_0x056b('0x13')](_0x5f41eb));if(_0x5f41eb[_0x056b('0x14')]){if(_0x5f41eb[_0x056b('0x14')][_0x056b('0x15')]===0x1f4){logger[_0x056b('0x14')]('Team,\x20%s,\x20%s',_0x444fe6,_0x5f41eb[_0x056b('0x14')][_0x056b('0x16')]);return _0x27c008(_0x5f41eb[_0x056b('0x14')][_0x056b('0x16')]);}logger[_0x056b('0x14')](_0x056b('0x17'),_0x444fe6,_0x5f41eb[_0x056b('0x14')][_0x056b('0x16')]);return _0x5dedcc(_0x5f41eb[_0x056b('0x14')][_0x056b('0x16')]);}else{logger[_0x056b('0x10')](_0x056b('0x17'),_0x444fe6,_0x056b('0x11'));_0x5dedcc(_0x5f41eb[_0x056b('0x18')][_0x056b('0x16')]);}})[_0x056b('0x19')](function(_0x164b7b){logger[_0x056b('0x14')](_0x056b('0x17'),_0x444fe6,_0x164b7b);_0x27c008(_0x164b7b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 940eb2d..899942b 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 _0xd719=['register','team:','./team.events','save','update','emit','removeListener'];(function(_0x171840,_0x5bc45a){var _0x5e3aa7=function(_0x263ea1){while(--_0x263ea1){_0x171840['push'](_0x171840['shift']());}};_0x5e3aa7(++_0x5bc45a);}(_0xd719,0xb8));var _0x9d71=function(_0xc7d147,_0x5ce566){_0xc7d147=_0xc7d147-0x0;var _0x3b38fb=_0xd719[_0xc7d147];return _0x3b38fb;};'use strict';var TeamEvents=require(_0x9d71('0x0'));var events=[_0x9d71('0x1'),'remove',_0x9d71('0x2')];function createListener(_0x597200,_0x62a4c0){return function(_0x46aeed){_0x62a4c0[_0x9d71('0x3')](_0x597200,_0x46aeed);};}function removeListener(_0x4c4b1b,_0xd48131){return function(){TeamEvents[_0x9d71('0x4')](_0x4c4b1b,_0xd48131);};}exports[_0x9d71('0x5')]=function(_0x5bf64c){for(var _0x25e98a=0x0,_0xc3d8c8=events['length'];_0x25e98a<_0xc3d8c8;_0x25e98a++){var _0x4d981a=events[_0x25e98a];var _0x508ba8=createListener(_0x9d71('0x6')+_0x4d981a,_0x5bf64c);TeamEvents['on'](_0x4d981a,_0x508ba8);}}; \ No newline at end of file +var _0x0102=['update','removeListener','register','length','team:','save','remove'];(function(_0x4e2d3e,_0x59578a){var _0x3596bc=function(_0x5528e3){while(--_0x5528e3){_0x4e2d3e['push'](_0x4e2d3e['shift']());}};_0x3596bc(++_0x59578a);}(_0x0102,0x186));var _0x2010=function(_0x42ba87,_0x436630){_0x42ba87=_0x42ba87-0x0;var _0x15c4b8=_0x0102[_0x42ba87];return _0x15c4b8;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2010('0x0'),_0x2010('0x1'),_0x2010('0x2')];function createListener(_0x9ae519,_0x54090f){return function(_0x530694){_0x54090f['emit'](_0x9ae519,_0x530694);};}function removeListener(_0x4e30b3,_0x59082d){return function(){TeamEvents[_0x2010('0x3')](_0x4e30b3,_0x59082d);};}exports[_0x2010('0x4')]=function(_0x130725){for(var _0x304264=0x0,_0x4eeb67=events[_0x2010('0x5')];_0x304264<_0x4eeb67;_0x304264++){var _0x495d98=events[_0x304264];var _0x4728c0=createListener(_0x2010('0x6')+_0x495d98,_0x130725);TeamEvents['on'](_0x495d98,_0x4728c0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9d5dd8d..16bfa06 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 _0xda65=['exports','INTEGER','sequelize'];(function(_0x33982b,_0x158be5){var _0xdaee76=function(_0x46c71){while(--_0x46c71){_0x33982b['push'](_0x33982b['shift']());}};_0xdaee76(++_0x158be5);}(_0xda65,0x1d0));var _0x5da6=function(_0x4600ba,_0x3fa2f8){_0x4600ba=_0x4600ba-0x0;var _0x532e80=_0xda65[_0x4600ba];return _0x532e80;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'TeamId':{'type':Sequelize[_0x5da6('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb945=['INTEGER','sequelize'];(function(_0x287a4d,_0x22b476){var _0x257498=function(_0x403279){while(--_0x403279){_0x287a4d['push'](_0x287a4d['shift']());}};_0x257498(++_0x22b476);}(_0xb945,0x97));var _0x5b94=function(_0x4264ee,_0x520320){_0x4264ee=_0x4264ee-0x0;var _0x46d043=_0xb945[_0x4264ee];return _0x46d043;};'use strict';var Sequelize=require(_0x5b94('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x5b94('0x1')]},'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 96b14ff..f62317b 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 _0x6be1=['exports','define','TeamVoicePrefix','lodash','util','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x4c9852,_0xf5611e){var _0x1bb1d9=function(_0x5724b3){while(--_0x5724b3){_0x4c9852['push'](_0x4c9852['shift']());}};_0x1bb1d9(++_0xf5611e);}(_0x6be1,0x12f));var _0x16be=function(_0x467c13,_0x335781){_0x467c13=_0x467c13-0x0;var _0x248c24=_0x6be1[_0x467c13];return _0x248c24;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16be('0x2'));var fs=require('fs');var path=require(_0x16be('0x3'));var rimraf=require(_0x16be('0x4'));var config=require(_0x16be('0x5'));var attributes=require(_0x16be('0x6'));module[_0x16be('0x7')]=function(_0x36e4da,_0x19754e){return _0x36e4da[_0x16be('0x8')](_0x16be('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d86=['team_has_voice_prefixes','lodash','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x3c53fe,_0x413887){var _0xf25357=function(_0x2a96c2){while(--_0x2a96c2){_0x3c53fe['push'](_0x3c53fe['shift']());}};_0xf25357(++_0x413887);}(_0x5d86,0x76));var _0x65d8=function(_0x52980f,_0x47b3b0){_0x52980f=_0x52980f-0x0;var _0x1f52a1=_0x5d86[_0x52980f];return _0x1f52a1;};'use strict';var _=require(_0x65d8('0x0'));var util=require(_0x65d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x65d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x65d8('0x3'));var fs=require('fs');var path=require(_0x65d8('0x4'));var rimraf=require('rimraf');var config=require(_0x65d8('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x65d8('0x6')]=function(_0x50c922,_0x1581a6){return _0x50c922[_0x65d8('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x65d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 33390c7..234b221 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x22e405,_0x1f781a){var _0xa2ce7e=function(_0x1c8d8b){while(--_0x1c8d8b){_0x22e405['push'](_0x22e405['shift']());}};_0xa2ce7e(++_0x1f781a);}(_0xe706,0xa3));var _0x6e70=function(_0x452bed,_0x128e55){_0x452bed=_0x452bed-0x0;var _0x4bb2cf=_0xe706[_0x452bed];return _0x4bb2cf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x592eb5,_0x4a6092){var _0x5d3cb6=function(_0x4c4121){while(--_0x4c4121){_0x592eb5['push'](_0x592eb5['shift']());}};_0x5d3cb6(++_0x4a6092);}(_0x70e0,0x17b));var _0x070e=function(_0x3116f5,_0x12802d){_0x3116f5=_0x3116f5-0x0;var _0xcd2256=_0x70e0[_0x3116f5];return _0xcd2256;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index a3beb2a..5d2b61c 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 _0x29e0=['sequelize','exports','INTEGER'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x029e('0x0'));module[_0x029e('0x1')]={'penalty':{'type':Sequelize[_0x029e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x28d0=['sequelize','exports','INTEGER'];(function(_0x585060,_0x572962){var _0x5de617=function(_0x4d076a){while(--_0x4d076a){_0x585060['push'](_0x585060['shift']());}};_0x5de617(++_0x572962);}(_0x28d0,0x138));var _0x028d=function(_0x24c989,_0x559731){_0x24c989=_0x24c989-0x0;var _0x5b107e=_0x28d0[_0x24c989];return _0x5b107e;};'use strict';var Sequelize=require(_0x028d('0x0'));module[_0x028d('0x1')]={'penalty':{'type':Sequelize[_0x028d('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 bee94b0..b4108e7 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 _0xe914=['moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api'];(function(_0x468022,_0x35f784){var _0x1f4261=function(_0x2a4fc9){while(--_0x2a4fc9){_0x468022['push'](_0x468022['shift']());}};_0x1f4261(++_0x35f784);}(_0xe914,0x7f));var _0x4e91=function(_0x214852,_0x33df9d){_0x214852=_0x214852-0x0;var _0x36450b=_0xe914[_0x214852];return _0x36450b;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var logger=require('../../config/logger')(_0x4e91('0x2'));var moment=require(_0x4e91('0x3'));var BPromise=require(_0x4e91('0x4'));var rp=require(_0x4e91('0x5'));var fs=require('fs');var path=require(_0x4e91('0x6'));var rimraf=require(_0x4e91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e91('0x8'));module[_0x4e91('0x9')]=function(_0x5d4c14,_0x29c27c){return _0x5d4c14[_0x4e91('0xa')](_0x4e91('0xb'),attributes,{'tableName':_0x4e91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5620=['TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','path','../../config/environment','exports','define'];(function(_0x4d95db,_0x28b7e9){var _0x1cc484=function(_0x42c09c){while(--_0x42c09c){_0x4d95db['push'](_0x4d95db['shift']());}};_0x1cc484(++_0x28b7e9);}(_0x5620,0xbf));var _0x0562=function(_0x47b0d9,_0x41b561){_0x47b0d9=_0x47b0d9-0x0;var _0x599df3=_0x5620[_0x47b0d9];return _0x599df3;};'use strict';var _=require(_0x0562('0x0'));var util=require('util');var logger=require(_0x0562('0x1'))(_0x0562('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0562('0x3'));var rimraf=require('rimraf');var config=require(_0x0562('0x4'));var attributes=require('./teamVoiceQueue.attributes');module[_0x0562('0x5')]=function(_0x39ab9a,_0x4155b9){return _0x39ab9a[_0x0562('0x6')](_0x0562('0x7'),attributes,{'tableName':_0x0562('0x8'),'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 7eaf239..ae127f6 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 _0xda73=['http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x45eef0,_0x258ec1){var _0x565558=function(_0x40d987){while(--_0x40d987){_0x45eef0['push'](_0x45eef0['shift']());}};_0x565558(++_0x258ec1);}(_0xda73,0x160));var _0x3da7=function(_0x27acdf,_0x5eec9e){_0x27acdf=_0x27acdf-0x0;var _0x49aaa6=_0xda73[_0x27acdf];return _0x49aaa6;};'use strict';var _=require(_0x3da7('0x0'));var util=require(_0x3da7('0x1'));var moment=require(_0x3da7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3da7('0x3'));var db=require(_0x3da7('0x4'))['db'];var utils=require(_0x3da7('0x5'));var logger=require(_0x3da7('0x6'))(_0x3da7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3da7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1af25e,_0xa9462a,_0xa68914){return new BPromise(function(_0xc95d14,_0x55aff1){return client[_0x3da7('0x9')](_0x1af25e,_0xa68914)[_0x3da7('0xa')](function(_0x593bb4){logger[_0x3da7('0xb')](_0x3da7('0xc'),_0xa9462a,_0x3da7('0xd'));logger['debug'](_0x3da7('0xe'),_0xa9462a,_0x3da7('0xd'),JSON[_0x3da7('0xf')](_0x593bb4));if(_0x593bb4[_0x3da7('0x10')]){if(_0x593bb4[_0x3da7('0x10')][_0x3da7('0x11')]===0x1f4){logger[_0x3da7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xa9462a,_0x593bb4[_0x3da7('0x10')][_0x3da7('0x12')]);return _0x55aff1(_0x593bb4[_0x3da7('0x10')][_0x3da7('0x12')]);}logger['error'](_0x3da7('0xc'),_0xa9462a,_0x593bb4[_0x3da7('0x10')][_0x3da7('0x12')]);return _0xc95d14(_0x593bb4['error'][_0x3da7('0x12')]);}else{logger[_0x3da7('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0xa9462a,'request\x20sent');_0xc95d14(_0x593bb4[_0x3da7('0x13')][_0x3da7('0x12')]);}})['catch'](function(_0x561338){logger[_0x3da7('0x10')](_0x3da7('0xc'),_0xa9462a,_0x561338);_0x55aff1(_0x561338);});});} \ No newline at end of file +var _0xb9da=['TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info'];(function(_0x3d4882,_0x230d03){var _0x2fe197=function(_0xbe3268){while(--_0xbe3268){_0x3d4882['push'](_0x3d4882['shift']());}};_0x2fe197(++_0x230d03);}(_0xb9da,0x1d6));var _0xab9d=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0xb9da[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0xab9d('0x0'));var util=require(_0xab9d('0x1'));var moment=require(_0xab9d('0x2'));var BPromise=require(_0xab9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9d('0x4'));var db=require(_0xab9d('0x5'))['db'];var utils=require(_0xab9d('0x6'));var logger=require(_0xab9d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab9d('0x8'));var client=jayson[_0xab9d('0x9')][_0xab9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1146fc,_0xd4a6c,_0x6caba6){return new BPromise(function(_0x46fb17,_0x59e162){return client[_0xab9d('0xb')](_0x1146fc,_0x6caba6)['then'](function(_0x20b703){logger[_0xab9d('0xc')](_0xab9d('0xd'),_0xd4a6c,'request\x20sent');logger[_0xab9d('0xe')](_0xab9d('0xf'),_0xd4a6c,_0xab9d('0x10'),JSON[_0xab9d('0x11')](_0x20b703));if(_0x20b703['error']){if(_0x20b703['error'][_0xab9d('0x12')]===0x1f4){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x59e162(_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);}logger[_0xab9d('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x46fb17(_0x20b703['error'][_0xab9d('0x14')]);}else{logger['info'](_0xab9d('0xd'),_0xd4a6c,_0xab9d('0x10'));_0x46fb17(_0x20b703[_0xab9d('0x15')]['message']);}})[_0xab9d('0x16')](function(_0x3616ad){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x3616ad);_0x59e162(_0x3616ad);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 99995ff..6d2d6f2 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 _0x5454=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x243481,_0x33ba56){var _0x3c7a5c=function(_0x4b07c1){while(--_0x4b07c1){_0x243481['push'](_0x243481['shift']());}};_0x3c7a5c(++_0x33ba56);}(_0x5454,0x15b));var _0x4545=function(_0x57c753,_0x2b01f8){_0x57c753=_0x57c753-0x0;var _0x433640=_0x5454[_0x57c753];return _0x433640;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4545('0x1'));var interaction=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var controller=require(_0x4545('0x4'));router['get']('/',auth[_0x4545('0x5')](),controller[_0x4545('0x6')]);router[_0x4545('0x7')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x9')]);router[_0x4545('0xa')]('/',auth[_0x4545('0x5')](),controller[_0x4545('0xb')]);router[_0x4545('0xc')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xd')]);router['delete'](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xe')]);module[_0x4545('0xf')]=router; \ No newline at end of file +var _0x4cb5=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','isAuthenticated','post','create','put','/:id','exports','multer'];(function(_0xa1175b,_0x1cce2c){var _0x509d1c=function(_0x4b9440){while(--_0x4b9440){_0xa1175b['push'](_0xa1175b['shift']());}};_0x509d1c(++_0x1cce2c);}(_0x4cb5,0x8f));var _0x54cb=function(_0x2a36ff,_0x547f56){_0x2a36ff=_0x2a36ff-0x0;var _0x12d677=_0x4cb5[_0x2a36ff];return _0x12d677;};'use strict';var multer=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var path=require(_0x54cb('0x2'));var timeout=require(_0x54cb('0x3'));var express=require('express');var router=express[_0x54cb('0x4')]();var fs_extra=require(_0x54cb('0x5'));var auth=require(_0x54cb('0x6'));var interaction=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var controller=require(_0x54cb('0x9'));router[_0x54cb('0xa')]('/',auth['isAuthenticated'](),controller[_0x54cb('0xb')]);router[_0x54cb('0xa')]('/:id',auth[_0x54cb('0xc')](),controller['show']);router[_0x54cb('0xd')]('/',auth[_0x54cb('0xc')](),controller[_0x54cb('0xe')]);router[_0x54cb('0xf')](_0x54cb('0x10'),auth[_0x54cb('0xc')](),controller['update']);router['delete'](_0x54cb('0x10'),auth[_0x54cb('0xc')](),controller['destroy']);module[_0x54cb('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 ea6a8e3..ca12a24 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 _0x5372=['STRING','TEXT'];(function(_0x458d68,_0x1dbe12){var _0x3e4a4b=function(_0x3f7b04){while(--_0x3f7b04){_0x458d68['push'](_0x458d68['shift']());}};_0x3e4a4b(++_0x1dbe12);}(_0x5372,0x152));var _0x2537=function(_0x4d76c9,_0x270b11){_0x4d76c9=_0x4d76c9-0x0;var _0x4b5446=_0x5372[_0x4d76c9];return _0x4b5446;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2537('0x0')]},'html':{'type':Sequelize[_0x2537('0x1')]}}; \ No newline at end of file +var _0x484c=['sequelize','exports','STRING'];(function(_0x39075c,_0x464ac8){var _0x2f396f=function(_0x554bae){while(--_0x554bae){_0x39075c['push'](_0x39075c['shift']());}};_0x2f396f(++_0x464ac8);}(_0x484c,0x135));var _0xc484=function(_0x1ea98d,_0x556f48){_0x1ea98d=_0x1ea98d-0x0;var _0x56188d=_0x484c[_0x1ea98d];return _0x56188d;};'use strict';var Sequelize=require(_0xc484('0x0'));module[_0xc484('0x1')]={'name':{'type':Sequelize[_0xc484('0x2')]},'description':{'type':Sequelize[_0xc484('0x2')]},'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 fa665a2..c5d76c5 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 _0x1abe=['fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs'];(function(_0xd6f942,_0x5ad7af){var _0x5663a4=function(_0x2eb51c){while(--_0x2eb51c){_0xd6f942['push'](_0xd6f942['shift']());}};_0x5663a4(++_0x5ad7af);}(_0x1abe,0x1e2));var _0xe1ab=function(_0x334ddd,_0xd9a79e){_0x334ddd=_0x334ddd-0x0;var _0x50c7e5=_0x1abe[_0x334ddd];return _0x50c7e5;};'use strict';var emlformat=require(_0xe1ab('0x0'));var rimraf=require(_0xe1ab('0x1'));var zipdir=require(_0xe1ab('0x2'));var jsonpatch=require(_0xe1ab('0x3'));var rp=require('request-promise');var moment=require(_0xe1ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1ab('0x5'));var util=require(_0xe1ab('0x6'));var path=require(_0xe1ab('0x7'));var sox=require('sox');var csv=require(_0xe1ab('0x8'));var ejs=require(_0xe1ab('0x9'));var fs=require('fs');var fs_extra=require(_0xe1ab('0xa'));var _=require(_0xe1ab('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe1ab('0xc'));var deskjs=require(_0xe1ab('0xd'));var toCsv=require(_0xe1ab('0x8'));var querystring=require('querystring');var Papa=require(_0xe1ab('0xe'));var Redis=require(_0xe1ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe1ab('0x10'));var as=require(_0xe1ab('0x11'));var hardwareService=require(_0xe1ab('0x12'));var logger=require(_0xe1ab('0x13'))(_0xe1ab('0x14'));var utils=require(_0xe1ab('0x15'));var config=require(_0xe1ab('0x16'));var licenseUtil=require(_0xe1ab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf24d46,_0x1462ea){_0x1462ea=_0x1462ea||0xcc;return function(_0xde97fe){if(_0xde97fe){return _0xf24d46[_0xe1ab('0x18')](_0x1462ea);}return _0xf24d46[_0xe1ab('0x19')](_0x1462ea)[_0xe1ab('0x1a')]();};}function respondWithResult(_0x2de6ad,_0x474a07){_0x474a07=_0x474a07||0xc8;return function(_0x4805f6){if(_0x4805f6){return _0x2de6ad[_0xe1ab('0x19')](_0x474a07)['json'](_0x4805f6);}};}function respondWithFilteredResult(_0x1cd4ae,_0x4c5924){return function(_0x1f7755){if(_0x1f7755){var _0x38da25=typeof _0x4c5924[_0xe1ab('0x1b')]==='undefined'&&typeof _0x4c5924[_0xe1ab('0x1c')]===_0xe1ab('0x1d');var _0x231041=_0x1f7755[_0xe1ab('0x1e')];var _0x2523be=_0x38da25?0x0:_0x4c5924[_0xe1ab('0x1b')];var _0x22aeed=_0x38da25?_0x1f7755[_0xe1ab('0x1e')]:_0x4c5924['offset']+_0x4c5924[_0xe1ab('0x1c')];var _0x1a1439;if(_0x22aeed>=_0x231041){_0x22aeed=_0x231041;_0x1a1439=0xc8;}else{_0x1a1439=0xce;}_0x1cd4ae['status'](_0x1a1439);return _0x1cd4ae[_0xe1ab('0x1f')](_0xe1ab('0x20'),_0x2523be+'-'+_0x22aeed+'/'+_0x231041)[_0xe1ab('0x21')](_0x1f7755);}return null;};}function patchUpdates(_0xef7300){return function(_0x15d0aa){try{jsonpatch[_0xe1ab('0x22')](_0x15d0aa,_0xef7300,!![]);}catch(_0x5b0129){return BPromise[_0xe1ab('0x23')](_0x5b0129);}return _0x15d0aa[_0xe1ab('0x24')]();};}function saveUpdates(_0x4bbb11,_0x43ef59){return function(_0x1d824b){if(_0x1d824b){return _0x1d824b[_0xe1ab('0x25')](_0x4bbb11)[_0xe1ab('0x26')](function(_0x2a08c0){return _0x2a08c0;});}return null;};}function removeEntity(_0x482c1d,_0x5d1234){return function(_0x565688){if(_0x565688){return _0x565688[_0xe1ab('0x27')]()[_0xe1ab('0x26')](function(){var _0x10cc59=_0x565688[_0xe1ab('0x28')]({'plain':!![]});var _0x459d7b=_0xe1ab('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x459d7b,'resourceId':_0x10cc59['id']}})[_0xe1ab('0x26')](function(){return _0x565688;});})[_0xe1ab('0x26')](function(){_0x482c1d['status'](0xcc)[_0xe1ab('0x1a')]();});}};}function handleEntityNotFound(_0x5c82b2,_0x55cd98){return function(_0x4218e3){if(!_0x4218e3){_0x5c82b2[_0xe1ab('0x18')](0x194);}return _0x4218e3;};}function handleError(_0x2e3752,_0x4b0c12){_0x4b0c12=_0x4b0c12||0x1f4;return function(_0x248878){logger[_0xe1ab('0x2a')](_0x248878[_0xe1ab('0x2b')]);if(_0x248878[_0xe1ab('0x2c')]){delete _0x248878['name'];}_0x2e3752[_0xe1ab('0x19')](_0x4b0c12)[_0xe1ab('0x2d')](_0x248878);};}exports[_0xe1ab('0x2e')]=function(_0x2f8a59,_0x4a02b9){var _0x2ef5fa={},_0x2912b7={},_0x1c96ae={'count':0x0,'rows':[]};var _0x437a0b=_[_0xe1ab('0x2f')](db[_0xe1ab('0x30')][_0xe1ab('0x31')],function(_0x4227af){return{'name':_0x4227af['fieldName'],'type':_0x4227af[_0xe1ab('0x32')][_0xe1ab('0x33')]};});_0x2912b7[_0xe1ab('0x34')]=_['map'](_0x437a0b,'name');_0x2912b7[_0xe1ab('0x35')]=_['keys'](_0x2f8a59['query']);_0x2912b7['filters']=_[_0xe1ab('0x36')](_0x2912b7[_0xe1ab('0x34')],_0x2912b7[_0xe1ab('0x35')]);_0x2ef5fa[_0xe1ab('0x37')]=_['intersection'](_0x2912b7['model'],qs[_0xe1ab('0x38')](_0x2f8a59['query'][_0xe1ab('0x38')]));_0x2ef5fa[_0xe1ab('0x37')]=_0x2ef5fa[_0xe1ab('0x37')][_0xe1ab('0x39')]?_0x2ef5fa[_0xe1ab('0x37')]:_0x2912b7['model'];if(!_0x2f8a59[_0xe1ab('0x35')]['hasOwnProperty'](_0xe1ab('0x3a'))){_0x2ef5fa[_0xe1ab('0x1c')]=qs[_0xe1ab('0x1c')](_0x2f8a59[_0xe1ab('0x35')][_0xe1ab('0x1c')]);_0x2ef5fa[_0xe1ab('0x1b')]=qs[_0xe1ab('0x1b')](_0x2f8a59[_0xe1ab('0x35')][_0xe1ab('0x1b')]);}_0x2ef5fa[_0xe1ab('0x3b')]=qs['sort'](_0x2f8a59['query'][_0xe1ab('0x3c')]);_0x2ef5fa[_0xe1ab('0x3d')]=qs[_0xe1ab('0x3e')](_['pick'](_0x2f8a59[_0xe1ab('0x35')],_0x2912b7['filters']),_0x437a0b);if(_0x2f8a59['query'][_0xe1ab('0x3f')]){_0x2ef5fa[_0xe1ab('0x3d')]=_[_0xe1ab('0x40')](_0x2ef5fa[_0xe1ab('0x3d')],{'$or':_[_0xe1ab('0x2f')](_0x437a0b,function(_0x4ad03b){if(_0x4ad03b[_0xe1ab('0x32')]!=='VIRTUAL'){var _0x545227={};_0x545227[_0x4ad03b[_0xe1ab('0x2c')]]={'$like':'%'+_0x2f8a59[_0xe1ab('0x35')][_0xe1ab('0x3f')]+'%'};return _0x545227;}})});}_0x2ef5fa=_[_0xe1ab('0x40')]({},_0x2ef5fa,_0x2f8a59[_0xe1ab('0x41')]);var _0x134ef2={'where':_0x2ef5fa[_0xe1ab('0x3d')]};return db[_0xe1ab('0x30')][_0xe1ab('0x1e')](_0x134ef2)['then'](function(_0x5b6308){_0x1c96ae['count']=_0x5b6308;if(_0x2f8a59[_0xe1ab('0x35')][_0xe1ab('0x42')]){_0x2ef5fa[_0xe1ab('0x43')]=[{'all':!![]}];}return db[_0xe1ab('0x30')][_0xe1ab('0x44')](_0x2ef5fa);})[_0xe1ab('0x26')](function(_0x2bb1b9){_0x1c96ae[_0xe1ab('0x45')]=_0x2bb1b9;return _0x1c96ae;})[_0xe1ab('0x26')](respondWithFilteredResult(_0x4a02b9,_0x2ef5fa))[_0xe1ab('0x46')](handleError(_0x4a02b9,null));};exports[_0xe1ab('0x47')]=function(_0x2977b0,_0x38ba3c){var _0x55eca1={'raw':!![],'where':{'id':_0x2977b0[_0xe1ab('0x48')]['id']}},_0x2cbe40={};_0x2cbe40[_0xe1ab('0x34')]=_[_0xe1ab('0x49')](db[_0xe1ab('0x30')][_0xe1ab('0x31')]);_0x2cbe40['query']=_[_0xe1ab('0x49')](_0x2977b0['query']);_0x2cbe40[_0xe1ab('0x3e')]=_[_0xe1ab('0x36')](_0x2cbe40[_0xe1ab('0x34')],_0x2cbe40[_0xe1ab('0x35')]);_0x55eca1[_0xe1ab('0x37')]=_['intersection'](_0x2cbe40[_0xe1ab('0x34')],qs[_0xe1ab('0x38')](_0x2977b0['query'][_0xe1ab('0x38')]));_0x55eca1[_0xe1ab('0x37')]=_0x55eca1['attributes']['length']?_0x55eca1['attributes']:_0x2cbe40[_0xe1ab('0x34')];if(_0x2977b0['query'][_0xe1ab('0x42')]){_0x55eca1['include']=[{'all':!![]}];}_0x55eca1=_[_0xe1ab('0x40')]({},_0x55eca1,_0x2977b0['options']);return db[_0xe1ab('0x30')][_0xe1ab('0x4a')](_0x55eca1)['then'](handleEntityNotFound(_0x38ba3c,null))[_0xe1ab('0x26')](respondWithResult(_0x38ba3c,null))[_0xe1ab('0x46')](handleError(_0x38ba3c,null));};exports[_0xe1ab('0x4b')]=function(_0x19ccfa,_0x55f4d1){return db[_0xe1ab('0x30')][_0xe1ab('0x4b')](_0x19ccfa[_0xe1ab('0x4c')],{})[_0xe1ab('0x26')](function(_0x1b0960){var _0x2418c7=_0x19ccfa['user'][_0xe1ab('0x28')]({'plain':!![]});if(!_0x2418c7)throw new Error(_0xe1ab('0x4d'));if(_0x2418c7['role']===_0xe1ab('0x4e')){var _0x5a1023=_0x1b0960[_0xe1ab('0x28')]({'plain':!![]});var _0x1642f5='Templates';return db[_0xe1ab('0x4f')][_0xe1ab('0x4a')]({'where':{'name':_0x1642f5,'userProfileId':_0x2418c7[_0xe1ab('0x50')]},'raw':!![]})[_0xe1ab('0x26')](function(_0x4d6d6d){if(_0x4d6d6d&&_0x4d6d6d['autoAssociation']===0x0){return db[_0xe1ab('0x51')][_0xe1ab('0x4b')]({'name':_0x5a1023[_0xe1ab('0x2c')],'resourceId':_0x5a1023['id'],'type':_0x4d6d6d['name'],'sectionId':_0x4d6d6d['id']},{})[_0xe1ab('0x26')](function(){return _0x1b0960;});}else{return _0x1b0960;}})[_0xe1ab('0x46')](function(_0x1b7143){logger[_0xe1ab('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b7143);throw _0x1b7143;});}return _0x1b0960;})[_0xe1ab('0x26')](respondWithResult(_0x55f4d1,0xc9))[_0xe1ab('0x46')](handleError(_0x55f4d1,null));};exports[_0xe1ab('0x25')]=function(_0xb8430a,_0xe0c8ac){if(_0xb8430a[_0xe1ab('0x4c')]['id']){delete _0xb8430a[_0xe1ab('0x4c')]['id'];}return db[_0xe1ab('0x30')]['find']({'where':{'id':_0xb8430a[_0xe1ab('0x48')]['id']}})['then'](handleEntityNotFound(_0xe0c8ac,null))[_0xe1ab('0x26')](saveUpdates(_0xb8430a[_0xe1ab('0x4c')],null))[_0xe1ab('0x26')](respondWithResult(_0xe0c8ac,null))[_0xe1ab('0x46')](handleError(_0xe0c8ac,null));};exports[_0xe1ab('0x27')]=function(_0x5084b3,_0x49fcb6){return db[_0xe1ab('0x30')][_0xe1ab('0x4a')]({'where':{'id':_0x5084b3[_0xe1ab('0x48')]['id']}})[_0xe1ab('0x26')](handleEntityNotFound(_0x49fcb6,null))[_0xe1ab('0x26')](removeEntity(_0x49fcb6,null))[_0xe1ab('0x46')](handleError(_0x49fcb6,null));}; \ No newline at end of file +var _0xc03b=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','Template','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x5a24b5,_0x92f66f){var _0x105924=function(_0x5b5f42){while(--_0x5b5f42){_0x5a24b5['push'](_0x5a24b5['shift']());}};_0x105924(++_0x92f66f);}(_0xc03b,0xc2));var _0xbc03=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0xc03b[_0x361422];return _0x2daa43;};'use strict';var emlformat=require(_0xbc03('0x0'));var rimraf=require(_0xbc03('0x1'));var zipdir=require(_0xbc03('0x2'));var jsonpatch=require(_0xbc03('0x3'));var rp=require(_0xbc03('0x4'));var moment=require('moment');var BPromise=require(_0xbc03('0x5'));var Mustache=require(_0xbc03('0x6'));var util=require('util');var path=require(_0xbc03('0x7'));var sox=require(_0xbc03('0x8'));var csv=require(_0xbc03('0x9'));var ejs=require(_0xbc03('0xa'));var fs=require('fs');var fs_extra=require(_0xbc03('0xb'));var _=require(_0xbc03('0xc'));var squel=require(_0xbc03('0xd'));var crypto=require(_0xbc03('0xe'));var jsforce=require(_0xbc03('0xf'));var deskjs=require(_0xbc03('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbc03('0x11'));var Papa=require('papaparse');var Redis=require(_0xbc03('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbc03('0x13'));var as=require(_0xbc03('0x14'));var hardwareService=require(_0xbc03('0x15'));var logger=require(_0xbc03('0x16'))(_0xbc03('0x17'));var utils=require(_0xbc03('0x18'));var config=require(_0xbc03('0x19'));var licenseUtil=require(_0xbc03('0x1a'));var db=require(_0xbc03('0x1b'))['db'];function respondWithStatusCode(_0xa37ad2,_0x555a9a){_0x555a9a=_0x555a9a||0xcc;return function(_0x7124bd){if(_0x7124bd){return _0xa37ad2[_0xbc03('0x1c')](_0x555a9a);}return _0xa37ad2['status'](_0x555a9a)[_0xbc03('0x1d')]();};}function respondWithResult(_0x14a101,_0x5da24b){_0x5da24b=_0x5da24b||0xc8;return function(_0x1ea956){if(_0x1ea956){return _0x14a101[_0xbc03('0x1e')](_0x5da24b)[_0xbc03('0x1f')](_0x1ea956);}};}function respondWithFilteredResult(_0x191c9a,_0x544264){return function(_0x507f9f){if(_0x507f9f){var _0x573129=typeof _0x544264[_0xbc03('0x20')]===_0xbc03('0x21')&&typeof _0x544264[_0xbc03('0x22')]===_0xbc03('0x21');var _0x28b684=_0x507f9f['count'];var _0x2efdb5=_0x573129?0x0:_0x544264['offset'];var _0x1d1617=_0x573129?_0x507f9f[_0xbc03('0x23')]:_0x544264[_0xbc03('0x20')]+_0x544264[_0xbc03('0x22')];var _0x236713;if(_0x1d1617>=_0x28b684){_0x1d1617=_0x28b684;_0x236713=0xc8;}else{_0x236713=0xce;}_0x191c9a[_0xbc03('0x1e')](_0x236713);return _0x191c9a['set'](_0xbc03('0x24'),_0x2efdb5+'-'+_0x1d1617+'/'+_0x28b684)['json'](_0x507f9f);}return null;};}function patchUpdates(_0x488aa0){return function(_0x274889){try{jsonpatch[_0xbc03('0x25')](_0x274889,_0x488aa0,!![]);}catch(_0x3dbb5e){return BPromise['reject'](_0x3dbb5e);}return _0x274889[_0xbc03('0x26')]();};}function saveUpdates(_0xeaeedb,_0x2476ef){return function(_0x6fe505){if(_0x6fe505){return _0x6fe505['update'](_0xeaeedb)[_0xbc03('0x27')](function(_0x3e58a6){return _0x3e58a6;});}return null;};}function removeEntity(_0x2afc20,_0x1ca18b){return function(_0x1acdb6){if(_0x1acdb6){return _0x1acdb6[_0xbc03('0x28')]()['then'](function(){var _0x4feba5=_0x1acdb6[_0xbc03('0x29')]({'plain':!![]});var _0x19815b=_0xbc03('0x2a');return db[_0xbc03('0x2b')][_0xbc03('0x28')]({'where':{'type':_0x19815b,'resourceId':_0x4feba5['id']}})[_0xbc03('0x27')](function(){return _0x1acdb6;});})['then'](function(){_0x2afc20[_0xbc03('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151f1a,_0x192292){return function(_0x58bef5){if(!_0x58bef5){_0x151f1a['sendStatus'](0x194);}return _0x58bef5;};}function handleError(_0x4a0e84,_0x4ef6c0){_0x4ef6c0=_0x4ef6c0||0x1f4;return function(_0x14b168){logger[_0xbc03('0x2c')](_0x14b168[_0xbc03('0x2d')]);if(_0x14b168['name']){delete _0x14b168[_0xbc03('0x2e')];}_0x4a0e84[_0xbc03('0x1e')](_0x4ef6c0)['send'](_0x14b168);};}exports[_0xbc03('0x2f')]=function(_0x4235ae,_0x537bbb){var _0xe3d7f8={},_0x53e20d={},_0x118679={'count':0x0,'rows':[]};var _0x40e4be=_[_0xbc03('0x30')](db[_0xbc03('0x31')]['rawAttributes'],function(_0x30c1b9){return{'name':_0x30c1b9[_0xbc03('0x32')],'type':_0x30c1b9[_0xbc03('0x33')][_0xbc03('0x34')]};});_0x53e20d['model']=_[_0xbc03('0x30')](_0x40e4be,'name');_0x53e20d[_0xbc03('0x35')]=_[_0xbc03('0x36')](_0x4235ae['query']);_0x53e20d[_0xbc03('0x37')]=_['intersection'](_0x53e20d[_0xbc03('0x38')],_0x53e20d[_0xbc03('0x35')]);_0xe3d7f8['attributes']=_[_0xbc03('0x39')](_0x53e20d[_0xbc03('0x38')],qs[_0xbc03('0x3a')](_0x4235ae[_0xbc03('0x35')][_0xbc03('0x3a')]));_0xe3d7f8[_0xbc03('0x3b')]=_0xe3d7f8[_0xbc03('0x3b')][_0xbc03('0x3c')]?_0xe3d7f8['attributes']:_0x53e20d[_0xbc03('0x38')];if(!_0x4235ae[_0xbc03('0x35')][_0xbc03('0x3d')](_0xbc03('0x3e'))){_0xe3d7f8['limit']=qs['limit'](_0x4235ae[_0xbc03('0x35')][_0xbc03('0x22')]);_0xe3d7f8[_0xbc03('0x20')]=qs[_0xbc03('0x20')](_0x4235ae[_0xbc03('0x35')][_0xbc03('0x20')]);}_0xe3d7f8[_0xbc03('0x3f')]=qs[_0xbc03('0x40')](_0x4235ae[_0xbc03('0x35')][_0xbc03('0x40')]);_0xe3d7f8[_0xbc03('0x41')]=qs['filters'](_[_0xbc03('0x42')](_0x4235ae[_0xbc03('0x35')],_0x53e20d[_0xbc03('0x37')]),_0x40e4be);if(_0x4235ae['query'][_0xbc03('0x43')]){_0xe3d7f8['where']=_[_0xbc03('0x44')](_0xe3d7f8[_0xbc03('0x41')],{'$or':_[_0xbc03('0x30')](_0x40e4be,function(_0x45c6ac){if(_0x45c6ac[_0xbc03('0x33')]!==_0xbc03('0x45')){var _0x5e7ffc={};_0x5e7ffc[_0x45c6ac[_0xbc03('0x2e')]]={'$like':'%'+_0x4235ae[_0xbc03('0x35')]['filter']+'%'};return _0x5e7ffc;}})});}_0xe3d7f8=_[_0xbc03('0x44')]({},_0xe3d7f8,_0x4235ae[_0xbc03('0x46')]);var _0x58e16c={'where':_0xe3d7f8[_0xbc03('0x41')]};return db[_0xbc03('0x31')][_0xbc03('0x23')](_0x58e16c)[_0xbc03('0x27')](function(_0x2427c9){_0x118679['count']=_0x2427c9;if(_0x4235ae[_0xbc03('0x35')][_0xbc03('0x47')]){_0xe3d7f8['include']=[{'all':!![]}];}return db[_0xbc03('0x31')][_0xbc03('0x48')](_0xe3d7f8);})['then'](function(_0x1e5727){_0x118679['rows']=_0x1e5727;return _0x118679;})[_0xbc03('0x27')](respondWithFilteredResult(_0x537bbb,_0xe3d7f8))[_0xbc03('0x49')](handleError(_0x537bbb,null));};exports['show']=function(_0x1adcdd,_0x4c1253){var _0x15a9e1={'raw':!![],'where':{'id':_0x1adcdd[_0xbc03('0x4a')]['id']}},_0x165921={};_0x165921[_0xbc03('0x38')]=_[_0xbc03('0x36')](db[_0xbc03('0x31')][_0xbc03('0x4b')]);_0x165921[_0xbc03('0x35')]=_['keys'](_0x1adcdd[_0xbc03('0x35')]);_0x165921[_0xbc03('0x37')]=_[_0xbc03('0x39')](_0x165921[_0xbc03('0x38')],_0x165921['query']);_0x15a9e1[_0xbc03('0x3b')]=_[_0xbc03('0x39')](_0x165921[_0xbc03('0x38')],qs['fields'](_0x1adcdd['query'][_0xbc03('0x3a')]));_0x15a9e1[_0xbc03('0x3b')]=_0x15a9e1[_0xbc03('0x3b')][_0xbc03('0x3c')]?_0x15a9e1[_0xbc03('0x3b')]:_0x165921['model'];if(_0x1adcdd['query'][_0xbc03('0x47')]){_0x15a9e1[_0xbc03('0x4c')]=[{'all':!![]}];}_0x15a9e1=_[_0xbc03('0x44')]({},_0x15a9e1,_0x1adcdd[_0xbc03('0x46')]);return db['Template'][_0xbc03('0x4d')](_0x15a9e1)[_0xbc03('0x27')](handleEntityNotFound(_0x4c1253,null))[_0xbc03('0x27')](respondWithResult(_0x4c1253,null))['catch'](handleError(_0x4c1253,null));};exports[_0xbc03('0x4e')]=function(_0x2157e2,_0x4ac437){return db[_0xbc03('0x31')][_0xbc03('0x4e')](_0x2157e2['body'],{})[_0xbc03('0x27')](function(_0x4ea822){var _0x2e2332=_0x2157e2[_0xbc03('0x4f')][_0xbc03('0x29')]({'plain':!![]});if(!_0x2e2332)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e2332[_0xbc03('0x50')]===_0xbc03('0x4f')){var _0x2a4ffa=_0x4ea822[_0xbc03('0x29')]({'plain':!![]});var _0x258bf5='Templates';return db[_0xbc03('0x51')]['find']({'where':{'name':_0x258bf5,'userProfileId':_0x2e2332['userProfileId']},'raw':!![]})[_0xbc03('0x27')](function(_0x1a87a2){if(_0x1a87a2&&_0x1a87a2[_0xbc03('0x52')]===0x0){return db['UserProfileResource'][_0xbc03('0x4e')]({'name':_0x2a4ffa[_0xbc03('0x2e')],'resourceId':_0x2a4ffa['id'],'type':_0x1a87a2['name'],'sectionId':_0x1a87a2['id']},{})[_0xbc03('0x27')](function(){return _0x4ea822;});}else{return _0x4ea822;}})[_0xbc03('0x49')](function(_0x460041){logger[_0xbc03('0x2c')](_0xbc03('0x53'),_0x460041);throw _0x460041;});}return _0x4ea822;})['then'](respondWithResult(_0x4ac437,0xc9))[_0xbc03('0x49')](handleError(_0x4ac437,null));};exports[_0xbc03('0x54')]=function(_0x4c8170,_0x174c87){if(_0x4c8170[_0xbc03('0x55')]['id']){delete _0x4c8170['body']['id'];}return db['Template']['find']({'where':{'id':_0x4c8170[_0xbc03('0x4a')]['id']}})[_0xbc03('0x27')](handleEntityNotFound(_0x174c87,null))[_0xbc03('0x27')](saveUpdates(_0x4c8170['body'],null))[_0xbc03('0x27')](respondWithResult(_0x174c87,null))[_0xbc03('0x49')](handleError(_0x174c87,null));};exports[_0xbc03('0x28')]=function(_0x23045b,_0x339ac7){return db[_0xbc03('0x31')][_0xbc03('0x4d')]({'where':{'id':_0x23045b[_0xbc03('0x4a')]['id']}})[_0xbc03('0x27')](handleEntityNotFound(_0x339ac7,null))[_0xbc03('0x27')](removeEntity(_0x339ac7,null))[_0xbc03('0x49')](handleError(_0x339ac7,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3786e99..875f94b 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 _0xa458=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./template.attributes','define','Template'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0xa458,0x1ed));var _0x8a45=function(_0x7f5bac,_0x3d61fc){_0x7f5bac=_0x7f5bac-0x0;var _0x5a078a=_0xa458[_0x7f5bac];return _0x5a078a;};'use strict';var _=require(_0x8a45('0x0'));var util=require(_0x8a45('0x1'));var logger=require(_0x8a45('0x2'))(_0x8a45('0x3'));var moment=require(_0x8a45('0x4'));var BPromise=require(_0x8a45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a45('0x6'));var config=require(_0x8a45('0x7'));var attributes=require(_0x8a45('0x8'));module['exports']=function(_0x50ec25,_0x2e9931){return _0x50ec25[_0x8a45('0x9')](_0x8a45('0xa'),attributes,{'tableName':_0x8a45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43dd=['./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3b4b61,_0x2b52d1){var _0x2ba577=function(_0x432856){while(--_0x432856){_0x3b4b61['push'](_0x3b4b61['shift']());}};_0x2ba577(++_0x2b52d1);}(_0x43dd,0x9f));var _0xd43d=function(_0xcbc1f8,_0x3a0bee){_0xcbc1f8=_0xcbc1f8-0x0;var _0x1793d1=_0x43dd[_0xcbc1f8];return _0x1793d1;};'use strict';var _=require(_0xd43d('0x0'));var util=require(_0xd43d('0x1'));var logger=require(_0xd43d('0x2'))(_0xd43d('0x3'));var moment=require(_0xd43d('0x4'));var BPromise=require(_0xd43d('0x5'));var rp=require(_0xd43d('0x6'));var fs=require('fs');var path=require(_0xd43d('0x7'));var rimraf=require('rimraf');var config=require(_0xd43d('0x8'));var attributes=require(_0xd43d('0x9'));module[_0xd43d('0xa')]=function(_0x37cb0c,_0x555d9f){return _0x37cb0c[_0xd43d('0xb')](_0xd43d('0xc'),attributes,{'tableName':_0xd43d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 797f036..058e579 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 _0x3e57=['options','raw','attributes','limit','include','map','model','GetTemplate','debug','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll'];(function(_0xd70bbf,_0x550124){var _0x18677f=function(_0x42faed){while(--_0x42faed){_0xd70bbf['push'](_0xd70bbf['shift']());}};_0x18677f(++_0x550124);}(_0x3e57,0x1cb));var _0x73e5=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x3e57[_0x4de586];return _0x46baf5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73e5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73e5('0x1'));var db=require(_0x73e5('0x2'))['db'];var utils=require(_0x73e5('0x3'));var logger=require(_0x73e5('0x4'))(_0x73e5('0x5'));var config=require(_0x73e5('0x6'));var jayson=require(_0x73e5('0x7'));var client=jayson[_0x73e5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204e43,_0x285afc,_0x242a88){return new BPromise(function(_0x38078f,_0x1b8804){return client[_0x73e5('0x9')](_0x204e43,_0x242a88)[_0x73e5('0xa')](function(_0x32a788){logger[_0x73e5('0xb')](_0x73e5('0xc'),_0x285afc,_0x73e5('0xd'));logger['debug'](_0x73e5('0xe'),_0x285afc,_0x73e5('0xd'),JSON[_0x73e5('0xf')](_0x32a788));if(_0x32a788[_0x73e5('0x10')]){if(_0x32a788[_0x73e5('0x10')]['code']===0x1f4){logger[_0x73e5('0x10')](_0x73e5('0xc'),_0x285afc,_0x32a788[_0x73e5('0x10')]['message']);return _0x1b8804(_0x32a788[_0x73e5('0x10')][_0x73e5('0x11')]);}logger['error'](_0x73e5('0xc'),_0x285afc,_0x32a788[_0x73e5('0x10')][_0x73e5('0x11')]);return _0x38078f(_0x32a788[_0x73e5('0x10')][_0x73e5('0x11')]);}else{logger[_0x73e5('0xb')](_0x73e5('0xc'),_0x285afc,_0x73e5('0xd'));_0x38078f(_0x32a788[_0x73e5('0x12')][_0x73e5('0x11')]);}})[_0x73e5('0x13')](function(_0x515b2e){logger['error']('Template,\x20%s,\x20%s',_0x285afc,_0x515b2e);_0x1b8804(_0x515b2e);});});}exports['GetTemplate']=function(_0x270232){var _0x24a8cf=this;return new Promise(function(_0x10108f,_0x3403fb){return db['Template'][_0x73e5('0x14')]({'raw':_0x270232[_0x73e5('0x15')]?_0x270232[_0x73e5('0x15')][_0x73e5('0x16')]===undefined?!![]:![]:!![],'where':_0x270232['options']?_0x270232['options']['where']||null:null,'attributes':_0x270232['options']?_0x270232['options'][_0x73e5('0x17')]||null:null,'limit':_0x270232[_0x73e5('0x15')]?_0x270232[_0x73e5('0x15')][_0x73e5('0x18')]||null:null,'include':_0x270232['options']?_0x270232[_0x73e5('0x15')][_0x73e5('0x19')]?_[_0x73e5('0x1a')](_0x270232['options'][_0x73e5('0x19')],function(_0x2ab6a6){return{'model':db[_0x2ab6a6[_0x73e5('0x1b')]],'as':_0x2ab6a6['as'],'attributes':_0x2ab6a6[_0x73e5('0x17')],'include':_0x2ab6a6[_0x73e5('0x19')]?_['map'](_0x2ab6a6[_0x73e5('0x19')],function(_0x4710bb){return{'model':db[_0x4710bb[_0x73e5('0x1b')]],'as':_0x4710bb['as'],'attributes':_0x4710bb[_0x73e5('0x17')],'include':_0x4710bb['include']?_[_0x73e5('0x1a')](_0x4710bb[_0x73e5('0x19')],function(_0x24b2db){return{'model':db[_0x24b2db[_0x73e5('0x1b')]],'as':_0x24b2db['as'],'attributes':_0x24b2db[_0x73e5('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee5e8){logger['info'](_0x73e5('0x1c'),_0x270232);logger[_0x73e5('0x1d')](_0x73e5('0x1c'),_0x270232,JSON[_0x73e5('0xf')](_0x4ee5e8));_0x10108f(_0x4ee5e8);})['catch'](function(_0x39728e){logger[_0x73e5('0x10')](_0x73e5('0x1c'),_0x39728e[_0x73e5('0x11')],_0x270232);_0x3403fb(_0x24a8cf['error'](0x1f4,_0x39728e[_0x73e5('0x11')]));});});}; \ No newline at end of file +var _0x6514=['raw','where','attributes','limit','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','options'];(function(_0x4f7449,_0x407356){var _0x21e3cb=function(_0x40f623){while(--_0x40f623){_0x4f7449['push'](_0x4f7449['shift']());}};_0x21e3cb(++_0x407356);}(_0x6514,0x1ab));var _0x4651=function(_0x1918f6,_0x22417c){_0x1918f6=_0x1918f6-0x0;var _0x3ed851=_0x6514[_0x1918f6];return _0x3ed851;};'use strict';var _=require('lodash');var util=require(_0x4651('0x0'));var moment=require('moment');var BPromise=require(_0x4651('0x1'));var rs=require(_0x4651('0x2'));var fs=require('fs');var Redis=require(_0x4651('0x3'));var db=require(_0x4651('0x4'))['db'];var utils=require(_0x4651('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4651('0x6'));var client=jayson[_0x4651('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33d9b9,_0x4fd156,_0x106cfd){return new BPromise(function(_0x1affec,_0x27dbd5){return client[_0x4651('0x8')](_0x33d9b9,_0x106cfd)[_0x4651('0x9')](function(_0x249c76){logger[_0x4651('0xa')](_0x4651('0xb'),_0x4fd156,_0x4651('0xc'));logger[_0x4651('0xd')](_0x4651('0xe'),_0x4fd156,_0x4651('0xc'),JSON[_0x4651('0xf')](_0x249c76));if(_0x249c76[_0x4651('0x10')]){if(_0x249c76['error'][_0x4651('0x11')]===0x1f4){logger[_0x4651('0x10')](_0x4651('0xb'),_0x4fd156,_0x249c76['error'][_0x4651('0x12')]);return _0x27dbd5(_0x249c76['error'][_0x4651('0x12')]);}logger[_0x4651('0x10')](_0x4651('0xb'),_0x4fd156,_0x249c76[_0x4651('0x10')][_0x4651('0x12')]);return _0x1affec(_0x249c76['error'][_0x4651('0x12')]);}else{logger[_0x4651('0xa')]('Template,\x20%s,\x20%s',_0x4fd156,'request\x20sent');_0x1affec(_0x249c76[_0x4651('0x13')][_0x4651('0x12')]);}})[_0x4651('0x14')](function(_0x24ab46){logger[_0x4651('0x10')]('Template,\x20%s,\x20%s',_0x4fd156,_0x24ab46);_0x27dbd5(_0x24ab46);});});}exports[_0x4651('0x15')]=function(_0x4f0432){var _0x416594=this;return new Promise(function(_0xa16e13,_0x49883f){return db['Template']['findAll']({'raw':_0x4f0432[_0x4651('0x16')]?_0x4f0432[_0x4651('0x16')][_0x4651('0x17')]===undefined?!![]:![]:!![],'where':_0x4f0432[_0x4651('0x16')]?_0x4f0432[_0x4651('0x16')][_0x4651('0x18')]||null:null,'attributes':_0x4f0432[_0x4651('0x16')]?_0x4f0432[_0x4651('0x16')][_0x4651('0x19')]||null:null,'limit':_0x4f0432[_0x4651('0x16')]?_0x4f0432[_0x4651('0x16')][_0x4651('0x1a')]||null:null,'include':_0x4f0432['options']?_0x4f0432[_0x4651('0x16')][_0x4651('0x1b')]?_['map'](_0x4f0432[_0x4651('0x16')][_0x4651('0x1b')],function(_0x524463){return{'model':db[_0x524463[_0x4651('0x1c')]],'as':_0x524463['as'],'attributes':_0x524463[_0x4651('0x19')],'include':_0x524463[_0x4651('0x1b')]?_[_0x4651('0x1d')](_0x524463[_0x4651('0x1b')],function(_0x19a0d8){return{'model':db[_0x19a0d8['model']],'as':_0x19a0d8['as'],'attributes':_0x19a0d8['attributes'],'include':_0x19a0d8[_0x4651('0x1b')]?_[_0x4651('0x1d')](_0x19a0d8[_0x4651('0x1b')],function(_0x52283e){return{'model':db[_0x52283e[_0x4651('0x1c')]],'as':_0x52283e['as'],'attributes':_0x52283e[_0x4651('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a369a){logger['info']('GetTemplate',_0x4f0432);logger[_0x4651('0xd')](_0x4651('0x15'),_0x4f0432,JSON[_0x4651('0xf')](_0x5a369a));_0xa16e13(_0x5a369a);})[_0x4651('0x14')](function(_0x4295d8){logger[_0x4651('0x10')](_0x4651('0x15'),_0x4295d8['message'],_0x4f0432);_0x49883f(_0x416594[_0x4651('0x10')](0x1f4,_0x4295d8[_0x4651('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index afbd816..7f7c794 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 _0xc84b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAnyCondition','/:id/actions','put','update','delete','destroy','exports','multer'];(function(_0x77c0b6,_0x11f5ab){var _0x1f4b71=function(_0x13eeb5){while(--_0x13eeb5){_0x77c0b6['push'](_0x77c0b6['shift']());}};_0x1f4b71(++_0x11f5ab);}(_0xc84b,0xbf));var _0xbc84=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xc84b[_0x50e593];return _0x3821d0;};'use strict';var multer=require(_0xbc84('0x0'));var util=require('util');var path=require(_0xbc84('0x1'));var timeout=require(_0xbc84('0x2'));var express=require(_0xbc84('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc84('0x4'));var interaction=require(_0xbc84('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xbc84('0x6')]('/',auth[_0xbc84('0x7')](),controller[_0xbc84('0x8')]);router[_0xbc84('0x6')](_0xbc84('0x9'),auth[_0xbc84('0x7')](),controller['show']);router[_0xbc84('0x6')](_0xbc84('0xa'),auth[_0xbc84('0x7')](),controller[_0xbc84('0xb')]);router[_0xbc84('0x6')](_0xbc84('0xc'),auth[_0xbc84('0x7')](),controller[_0xbc84('0xd')]);router[_0xbc84('0x6')]('/:id/actions',auth[_0xbc84('0x7')](),controller[_0xbc84('0xe')]);router[_0xbc84('0xf')]('/',auth[_0xbc84('0x7')](),controller[_0xbc84('0x10')]);router[_0xbc84('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0xbc84('0xf')](_0xbc84('0xc'),auth[_0xbc84('0x7')](),controller[_0xbc84('0x11')]);router['post'](_0xbc84('0x12'),auth['isAuthenticated'](),controller['addAction']);router[_0xbc84('0x13')](_0xbc84('0x9'),auth['isAuthenticated'](),controller[_0xbc84('0x14')]);router[_0xbc84('0x15')]('/:id',auth[_0xbc84('0x7')](),controller[_0xbc84('0x16')]);module[_0xbc84('0x17')]=router; \ No newline at end of file +var _0x4123=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAnyCondition','addAction','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4123,0x87));var _0x3412=function(_0x43b2e6,_0x14d773){_0x43b2e6=_0x43b2e6-0x0;var _0x102c0b=_0x4123[_0x43b2e6];return _0x102c0b;};'use strict';var multer=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var path=require(_0x3412('0x2'));var timeout=require(_0x3412('0x3'));var express=require(_0x3412('0x4'));var router=express[_0x3412('0x5')]();var fs_extra=require(_0x3412('0x6'));var auth=require(_0x3412('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3412('0x8'));router[_0x3412('0x9')]('/',auth['isAuthenticated'](),controller[_0x3412('0xa')]);router[_0x3412('0x9')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0xd')]);router[_0x3412('0x9')]('/:id/all_conditions',auth[_0x3412('0xc')](),controller[_0x3412('0xe')]);router[_0x3412('0x9')](_0x3412('0xf'),auth[_0x3412('0xc')](),controller[_0x3412('0x10')]);router[_0x3412('0x9')](_0x3412('0x11'),auth[_0x3412('0xc')](),controller['getActions']);router['post']('/',auth[_0x3412('0xc')](),controller[_0x3412('0x12')]);router[_0x3412('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0x3412('0x13')](_0x3412('0xf'),auth[_0x3412('0xc')](),controller[_0x3412('0x14')]);router[_0x3412('0x13')](_0x3412('0x11'),auth[_0x3412('0xc')](),controller[_0x3412('0x15')]);router[_0x3412('0x16')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x17')]);router[_0x3412('0x18')](_0x3412('0xb'),auth['isAuthenticated'](),controller[_0x3412('0x19')]);module[_0x3412('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 6f3ba4b..fb2045b 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 _0xf622=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0xf622,0x1b6));var _0x2f62=function(_0x3fa955,_0x247187){_0x3fa955=_0x3fa955-0x0;var _0x3f0280=_0xf622[_0x3fa955];return _0x3f0280;};'use strict';var Sequelize=require(_0x2f62('0x0'));module[_0x2f62('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2f62('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2f62('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x64f5=['STRING','BOOLEAN'];(function(_0x47662d,_0x4928a6){var _0x17a98e=function(_0x51170a){while(--_0x51170a){_0x47662d['push'](_0x47662d['shift']());}};_0x17a98e(++_0x4928a6);}(_0x64f5,0x1ee));var _0x564f=function(_0x4fd2ab,_0x444fa0){_0x4fd2ab=_0x4fd2ab-0x0;var _0x142add=_0x64f5[_0x4fd2ab];return _0x142add;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x564f('0x0')]},'channel':{'type':Sequelize[_0x564f('0x0')]},'description':{'type':Sequelize[_0x564f('0x0')]},'status':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a64cbb3..ca6e3c1 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 _0xd782=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','Trigger','includeAll','catch','show','params','include','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','nolimit','getAnyConditions','hasOwnProperty','TriggerId','Action','getActions','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','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd782,0x1c8));var _0x2d78=function(_0xc3676a,_0x17fb85){_0xc3676a=_0xc3676a-0x0;var _0x107801=_0xd782[_0xc3676a];return _0x107801;};'use strict';var emlformat=require(_0x2d78('0x0'));var rimraf=require(_0x2d78('0x1'));var zipdir=require(_0x2d78('0x2'));var jsonpatch=require(_0x2d78('0x3'));var rp=require(_0x2d78('0x4'));var moment=require(_0x2d78('0x5'));var BPromise=require(_0x2d78('0x6'));var Mustache=require(_0x2d78('0x7'));var util=require(_0x2d78('0x8'));var path=require('path');var sox=require(_0x2d78('0x9'));var csv=require('to-csv');var ejs=require(_0x2d78('0xa'));var fs=require('fs');var fs_extra=require(_0x2d78('0xb'));var _=require(_0x2d78('0xc'));var squel=require(_0x2d78('0xd'));var crypto=require(_0x2d78('0xe'));var jsforce=require(_0x2d78('0xf'));var deskjs=require(_0x2d78('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2d78('0x11'));var Papa=require(_0x2d78('0x12'));var Redis=require(_0x2d78('0x13'));var authService=require(_0x2d78('0x14'));var qs=require(_0x2d78('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d78('0x16'));var logger=require(_0x2d78('0x17'))(_0x2d78('0x18'));var utils=require(_0x2d78('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2d78('0x1a'));var db=require(_0x2d78('0x1b'))['db'];function respondWithStatusCode(_0x5876e0,_0x40d1d7){_0x40d1d7=_0x40d1d7||0xcc;return function(_0x5b1dcc){if(_0x5b1dcc){return _0x5876e0[_0x2d78('0x1c')](_0x40d1d7);}return _0x5876e0['status'](_0x40d1d7)['end']();};}function respondWithResult(_0x1b8d7b,_0x87c31a){_0x87c31a=_0x87c31a||0xc8;return function(_0x3757f6){if(_0x3757f6){return _0x1b8d7b[_0x2d78('0x1d')](_0x87c31a)['json'](_0x3757f6);}};}function respondWithFilteredResult(_0x346bea,_0x5965e7){return function(_0x223887){if(_0x223887){var _0x422473=typeof _0x5965e7[_0x2d78('0x1e')]===_0x2d78('0x1f')&&typeof _0x5965e7[_0x2d78('0x20')]===_0x2d78('0x1f');var _0x2552d2=_0x223887[_0x2d78('0x21')];var _0x58d8c0=_0x422473?0x0:_0x5965e7[_0x2d78('0x1e')];var _0x141fce=_0x422473?_0x223887[_0x2d78('0x21')]:_0x5965e7[_0x2d78('0x1e')]+_0x5965e7['limit'];var _0x9aac4d;if(_0x141fce>=_0x2552d2){_0x141fce=_0x2552d2;_0x9aac4d=0xc8;}else{_0x9aac4d=0xce;}_0x346bea[_0x2d78('0x1d')](_0x9aac4d);return _0x346bea[_0x2d78('0x22')](_0x2d78('0x23'),_0x58d8c0+'-'+_0x141fce+'/'+_0x2552d2)[_0x2d78('0x24')](_0x223887);}return null;};}function patchUpdates(_0x1ef214){return function(_0x1f96a6){try{jsonpatch['apply'](_0x1f96a6,_0x1ef214,!![]);}catch(_0x33ab31){return BPromise[_0x2d78('0x25')](_0x33ab31);}return _0x1f96a6[_0x2d78('0x26')]();};}function saveUpdates(_0x3abebf,_0x133d9c){return function(_0x1ac105){if(_0x1ac105){return _0x1ac105[_0x2d78('0x27')](_0x3abebf)['then'](function(_0x1c50e0){return _0x1c50e0;});}return null;};}function removeEntity(_0x3d2804,_0x5a480e){return function(_0x2102a4){if(_0x2102a4){return _0x2102a4[_0x2d78('0x28')]()[_0x2d78('0x29')](function(){var _0x36d955=_0x2102a4['get']({'plain':!![]});var _0x1708b9='Triggers';return db[_0x2d78('0x2a')][_0x2d78('0x28')]({'where':{'type':_0x1708b9,'resourceId':_0x36d955['id']}})[_0x2d78('0x29')](function(){return _0x2102a4;});})[_0x2d78('0x29')](function(){_0x3d2804[_0x2d78('0x1d')](0xcc)[_0x2d78('0x2b')]();});}};}function handleEntityNotFound(_0x1bb607,_0x24b1d3){return function(_0x133f52){if(!_0x133f52){_0x1bb607[_0x2d78('0x1c')](0x194);}return _0x133f52;};}function handleError(_0x3ccbbb,_0x1519d7){_0x1519d7=_0x1519d7||0x1f4;return function(_0x554265){logger[_0x2d78('0x2c')](_0x554265[_0x2d78('0x2d')]);if(_0x554265[_0x2d78('0x2e')]){delete _0x554265[_0x2d78('0x2e')];}_0x3ccbbb[_0x2d78('0x1d')](_0x1519d7)['send'](_0x554265);};}exports[_0x2d78('0x2f')]=function(_0x8a87ae,_0x2abb26){var _0x37a04b={},_0x4e2e91={},_0x20bbed={'count':0x0,'rows':[]};var _0x2b2c87=_['map'](db['Trigger'][_0x2d78('0x30')],function(_0x1a3592){return{'name':_0x1a3592[_0x2d78('0x31')],'type':_0x1a3592[_0x2d78('0x32')]['key']};});_0x4e2e91['model']=_[_0x2d78('0x33')](_0x2b2c87,_0x2d78('0x2e'));_0x4e2e91[_0x2d78('0x34')]=_[_0x2d78('0x35')](_0x8a87ae[_0x2d78('0x34')]);_0x4e2e91[_0x2d78('0x36')]=_[_0x2d78('0x37')](_0x4e2e91[_0x2d78('0x38')],_0x4e2e91[_0x2d78('0x34')]);_0x37a04b['attributes']=_[_0x2d78('0x37')](_0x4e2e91[_0x2d78('0x38')],qs[_0x2d78('0x39')](_0x8a87ae[_0x2d78('0x34')][_0x2d78('0x39')]));_0x37a04b[_0x2d78('0x3a')]=_0x37a04b[_0x2d78('0x3a')][_0x2d78('0x3b')]?_0x37a04b[_0x2d78('0x3a')]:_0x4e2e91[_0x2d78('0x38')];if(!_0x8a87ae['query']['hasOwnProperty']('nolimit')){_0x37a04b[_0x2d78('0x20')]=qs['limit'](_0x8a87ae['query']['limit']);_0x37a04b[_0x2d78('0x1e')]=qs[_0x2d78('0x1e')](_0x8a87ae[_0x2d78('0x34')][_0x2d78('0x1e')]);}_0x37a04b[_0x2d78('0x3c')]=qs['sort'](_0x8a87ae[_0x2d78('0x34')][_0x2d78('0x3d')]);_0x37a04b[_0x2d78('0x3e')]=qs[_0x2d78('0x36')](_[_0x2d78('0x3f')](_0x8a87ae[_0x2d78('0x34')],_0x4e2e91['filters']),_0x2b2c87);if(_0x8a87ae[_0x2d78('0x34')][_0x2d78('0x40')]){_0x37a04b[_0x2d78('0x3e')]=_['merge'](_0x37a04b[_0x2d78('0x3e')],{'$or':_[_0x2d78('0x33')](_0x2b2c87,function(_0x1e5b94){if(_0x1e5b94[_0x2d78('0x32')]!==_0x2d78('0x41')){var _0x4d51a3={};_0x4d51a3[_0x1e5b94['name']]={'$like':'%'+_0x8a87ae[_0x2d78('0x34')]['filter']+'%'};return _0x4d51a3;}})});}_0x37a04b=_[_0x2d78('0x42')]({},_0x37a04b,_0x8a87ae[_0x2d78('0x43')]);var _0x1f4fe0={'where':_0x37a04b['where']};return db[_0x2d78('0x44')][_0x2d78('0x21')](_0x1f4fe0)[_0x2d78('0x29')](function(_0x1913e9){_0x20bbed[_0x2d78('0x21')]=_0x1913e9;if(_0x8a87ae['query'][_0x2d78('0x45')]){_0x37a04b['include']=[{'all':!![]}];}return db[_0x2d78('0x44')]['findAll'](_0x37a04b);})['then'](function(_0x4d8ced){_0x20bbed['rows']=_0x4d8ced;return _0x20bbed;})['then'](respondWithFilteredResult(_0x2abb26,_0x37a04b))[_0x2d78('0x46')](handleError(_0x2abb26,null));};exports[_0x2d78('0x47')]=function(_0x310fa7,_0x12530e){var _0x5ca86d={'raw':![],'where':{'id':_0x310fa7[_0x2d78('0x48')]['id']}},_0xc6bf4a={};_0xc6bf4a[_0x2d78('0x38')]=_[_0x2d78('0x35')](db[_0x2d78('0x44')]['rawAttributes']);_0xc6bf4a[_0x2d78('0x34')]=_[_0x2d78('0x35')](_0x310fa7[_0x2d78('0x34')]);_0xc6bf4a[_0x2d78('0x36')]=_['intersection'](_0xc6bf4a['model'],_0xc6bf4a[_0x2d78('0x34')]);_0x5ca86d[_0x2d78('0x3a')]=_['intersection'](_0xc6bf4a[_0x2d78('0x38')],qs[_0x2d78('0x39')](_0x310fa7['query']['fields']));_0x5ca86d[_0x2d78('0x3a')]=_0x5ca86d[_0x2d78('0x3a')][_0x2d78('0x3b')]?_0x5ca86d[_0x2d78('0x3a')]:_0xc6bf4a['model'];if(_0x310fa7['query'][_0x2d78('0x45')]){_0x5ca86d[_0x2d78('0x49')]=[{'all':!![]}];}_0x5ca86d=_[_0x2d78('0x42')]({},_0x5ca86d,_0x310fa7[_0x2d78('0x43')]);return db['Trigger']['find'](_0x5ca86d)[_0x2d78('0x29')](handleEntityNotFound(_0x12530e,null))[_0x2d78('0x29')](respondWithResult(_0x12530e,null))[_0x2d78('0x46')](handleError(_0x12530e,null));};exports['create']=function(_0x4e2b5a,_0x1f7249){return db[_0x2d78('0x44')]['create'](_0x4e2b5a[_0x2d78('0x4a')],{})[_0x2d78('0x29')](function(_0x1bf1c8){var _0xa306ac=_0x4e2b5a[_0x2d78('0x4b')][_0x2d78('0x4c')]({'plain':!![]});if(!_0xa306ac)throw new Error(_0x2d78('0x4d'));if(_0xa306ac[_0x2d78('0x4e')]==='user'){var _0x401d19=_0x1bf1c8[_0x2d78('0x4c')]({'plain':!![]});var _0x2464c6='Triggers';return db[_0x2d78('0x4f')][_0x2d78('0x50')]({'where':{'name':_0x2464c6,'userProfileId':_0xa306ac[_0x2d78('0x51')]},'raw':!![]})[_0x2d78('0x29')](function(_0x24d91e){if(_0x24d91e&&_0x24d91e[_0x2d78('0x52')]===0x0){return db['UserProfileResource'][_0x2d78('0x53')]({'name':_0x401d19[_0x2d78('0x2e')],'resourceId':_0x401d19['id'],'type':_0x24d91e[_0x2d78('0x2e')],'sectionId':_0x24d91e['id']},{})[_0x2d78('0x29')](function(){return _0x1bf1c8;});}else{return _0x1bf1c8;}})[_0x2d78('0x46')](function(_0x5a6ad3){logger[_0x2d78('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a6ad3);throw _0x5a6ad3;});}return _0x1bf1c8;})[_0x2d78('0x29')](respondWithResult(_0x1f7249,0xc9))[_0x2d78('0x46')](handleError(_0x1f7249,null));};exports[_0x2d78('0x27')]=function(_0x403d1c,_0x3320d5){if(_0x403d1c[_0x2d78('0x4a')]['id']){delete _0x403d1c[_0x2d78('0x4a')]['id'];}return db[_0x2d78('0x44')]['find']({'where':{'id':_0x403d1c[_0x2d78('0x48')]['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x3320d5,null))[_0x2d78('0x29')](saveUpdates(_0x403d1c[_0x2d78('0x4a')],null))[_0x2d78('0x29')](respondWithResult(_0x3320d5,null))['catch'](handleError(_0x3320d5,null));};exports[_0x2d78('0x28')]=function(_0x295755,_0x481800){return db[_0x2d78('0x44')][_0x2d78('0x50')]({'where':{'id':_0x295755[_0x2d78('0x48')]['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x481800,null))['then'](removeEntity(_0x481800,null))[_0x2d78('0x46')](handleError(_0x481800,null));};exports[_0x2d78('0x54')]=function(_0x10fb34,_0x3ad786,_0x59b88f){if(_0x10fb34[_0x2d78('0x4a')]['id']){delete _0x10fb34['body']['id'];}return db[_0x2d78('0x44')][_0x2d78('0x50')]({'where':{'id':_0x10fb34['params']['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x3ad786,null))[_0x2d78('0x29')](function(_0x5d529e){if(_0x5d529e){_0x10fb34['body'][_0x2d78('0x55')]=_0x5d529e['id'];return db['Condition'][_0x2d78('0x53')](_0x10fb34[_0x2d78('0x4a')]);}})[_0x2d78('0x29')](respondWithResult(_0x3ad786,null))[_0x2d78('0x46')](handleError(_0x3ad786,null));};exports['addAnyCondition']=function(_0x4779e9,_0x186579,_0x39a152){if(_0x4779e9[_0x2d78('0x4a')]['id']){delete _0x4779e9['body']['id'];}return db[_0x2d78('0x44')][_0x2d78('0x50')]({'where':{'id':_0x4779e9[_0x2d78('0x48')]['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x186579,null))[_0x2d78('0x29')](function(_0x27362a){if(_0x27362a){_0x4779e9[_0x2d78('0x4a')][_0x2d78('0x56')]=_0x27362a['id'];return db[_0x2d78('0x57')]['create'](_0x4779e9['body']);}})[_0x2d78('0x29')](respondWithResult(_0x186579,null))[_0x2d78('0x46')](handleError(_0x186579,null));};exports[_0x2d78('0x58')]=function(_0x80b45e,_0x20be9e,_0xd691d3){var _0x57f4c1={};var _0x132b03={};var _0x44adbc;var _0x31be5c;return db['Trigger'][_0x2d78('0x59')]({'where':{'id':_0x80b45e[_0x2d78('0x48')]['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x20be9e,null))[_0x2d78('0x29')](function(_0x5881c1){if(_0x5881c1){_0x44adbc=_0x5881c1;_0x132b03[_0x2d78('0x38')]=_[_0x2d78('0x35')](db[_0x2d78('0x57')][_0x2d78('0x30')]);_0x132b03['query']=_[_0x2d78('0x35')](_0x80b45e[_0x2d78('0x34')]);_0x132b03['filters']=_['intersection'](_0x132b03['model'],_0x132b03[_0x2d78('0x34')]);_0x57f4c1[_0x2d78('0x3a')]=_[_0x2d78('0x37')](_0x132b03[_0x2d78('0x38')],qs[_0x2d78('0x39')](_0x80b45e[_0x2d78('0x34')][_0x2d78('0x39')]));_0x57f4c1[_0x2d78('0x3a')]=_0x57f4c1[_0x2d78('0x3a')][_0x2d78('0x3b')]?_0x57f4c1[_0x2d78('0x3a')]:_0x132b03[_0x2d78('0x38')];_0x57f4c1[_0x2d78('0x3c')]=qs[_0x2d78('0x3d')](_0x80b45e[_0x2d78('0x34')][_0x2d78('0x3d')]);_0x57f4c1['where']=qs['filters'](_[_0x2d78('0x3f')](_0x80b45e[_0x2d78('0x34')],_0x132b03[_0x2d78('0x36')]));if(_0x80b45e[_0x2d78('0x34')][_0x2d78('0x40')]){_0x57f4c1['where']=_[_0x2d78('0x42')](_0x57f4c1[_0x2d78('0x3e')],{'$or':_[_0x2d78('0x33')](_0x57f4c1[_0x2d78('0x3a')],function(_0x21cc04){var _0x6d536d={};_0x6d536d[_0x21cc04]={'$like':'%'+_0x80b45e[_0x2d78('0x34')]['filter']+'%'};return _0x6d536d;})});}_0x57f4c1=_[_0x2d78('0x42')]({},_0x57f4c1,_0x80b45e[_0x2d78('0x43')]);return _0x44adbc[_0x2d78('0x58')](_0x57f4c1);}})[_0x2d78('0x29')](function(_0x10c131){if(_0x10c131){_0x31be5c=_0x10c131[_0x2d78('0x3b')];if(!_0x80b45e[_0x2d78('0x34')]['hasOwnProperty'](_0x2d78('0x5a'))){_0x57f4c1[_0x2d78('0x20')]=qs['limit'](_0x80b45e[_0x2d78('0x34')][_0x2d78('0x20')]);_0x57f4c1['offset']=qs[_0x2d78('0x1e')](_0x80b45e[_0x2d78('0x34')][_0x2d78('0x1e')]);}return _0x44adbc[_0x2d78('0x58')](_0x57f4c1);}})['then'](function(_0x3e0b4b){if(_0x3e0b4b){return _0x3e0b4b?{'count':_0x31be5c,'rows':_0x3e0b4b}:null;}})[_0x2d78('0x29')](respondWithResult(_0x20be9e,null))[_0x2d78('0x46')](handleError(_0x20be9e,null));};exports[_0x2d78('0x5b')]=function(_0x3d7cfa,_0x4ca766,_0x39d3f1){var _0x5c661a={};var _0x3746ba={};var _0x3b804d;var _0x743ab6;return db[_0x2d78('0x44')][_0x2d78('0x59')]({'where':{'id':_0x3d7cfa['params']['id']}})['then'](handleEntityNotFound(_0x4ca766,null))[_0x2d78('0x29')](function(_0x549d23){if(_0x549d23){_0x3b804d=_0x549d23;_0x3746ba[_0x2d78('0x38')]=_[_0x2d78('0x35')](db['Condition'][_0x2d78('0x30')]);_0x3746ba['query']=_[_0x2d78('0x35')](_0x3d7cfa[_0x2d78('0x34')]);_0x3746ba[_0x2d78('0x36')]=_['intersection'](_0x3746ba[_0x2d78('0x38')],_0x3746ba['query']);_0x5c661a[_0x2d78('0x3a')]=_[_0x2d78('0x37')](_0x3746ba[_0x2d78('0x38')],qs[_0x2d78('0x39')](_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x39')]));_0x5c661a['attributes']=_0x5c661a[_0x2d78('0x3a')][_0x2d78('0x3b')]?_0x5c661a['attributes']:_0x3746ba[_0x2d78('0x38')];_0x5c661a[_0x2d78('0x3c')]=qs['sort'](_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x3d')]);_0x5c661a[_0x2d78('0x3e')]=qs[_0x2d78('0x36')](_['pick'](_0x3d7cfa[_0x2d78('0x34')],_0x3746ba[_0x2d78('0x36')]));if(_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x40')]){_0x5c661a[_0x2d78('0x3e')]=_[_0x2d78('0x42')](_0x5c661a[_0x2d78('0x3e')],{'$or':_[_0x2d78('0x33')](_0x5c661a['attributes'],function(_0x1b2a33){var _0x6ccca1={};_0x6ccca1[_0x1b2a33]={'$like':'%'+_0x3d7cfa['query']['filter']+'%'};return _0x6ccca1;})});}_0x5c661a=_[_0x2d78('0x42')]({},_0x5c661a,_0x3d7cfa[_0x2d78('0x43')]);return _0x3b804d[_0x2d78('0x5b')](_0x5c661a);}})[_0x2d78('0x29')](function(_0x363932){if(_0x363932){_0x743ab6=_0x363932[_0x2d78('0x3b')];if(!_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x5c')](_0x2d78('0x5a'))){_0x5c661a['limit']=qs[_0x2d78('0x20')](_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x20')]);_0x5c661a[_0x2d78('0x1e')]=qs[_0x2d78('0x1e')](_0x3d7cfa[_0x2d78('0x34')][_0x2d78('0x1e')]);}return _0x3b804d['getAnyConditions'](_0x5c661a);}})['then'](function(_0x37ca3f){if(_0x37ca3f){return _0x37ca3f?{'count':_0x743ab6,'rows':_0x37ca3f}:null;}})[_0x2d78('0x29')](respondWithResult(_0x4ca766,null))[_0x2d78('0x46')](handleError(_0x4ca766,null));};exports['addAction']=function(_0x46f291,_0x45377b,_0x3f3982){if(_0x46f291[_0x2d78('0x4a')]['id']){delete _0x46f291[_0x2d78('0x4a')]['id'];}return db['Trigger'][_0x2d78('0x50')]({'where':{'id':_0x46f291[_0x2d78('0x48')]['id']}})['then'](handleEntityNotFound(_0x45377b,null))[_0x2d78('0x29')](function(_0x15d7a7){if(_0x15d7a7){_0x46f291[_0x2d78('0x4a')][_0x2d78('0x5d')]=_0x15d7a7['id'];return db[_0x2d78('0x5e')][_0x2d78('0x53')](_0x46f291[_0x2d78('0x4a')]);}})['then'](respondWithResult(_0x45377b,null))[_0x2d78('0x46')](handleError(_0x45377b,null));};exports[_0x2d78('0x5f')]=function(_0x3b774e,_0x2a09ea,_0x2cfff5){var _0x2c8053={};var _0x1cf4af={};var _0x33323a;var _0x833e12;return db['Trigger']['findOne']({'where':{'id':_0x3b774e[_0x2d78('0x48')]['id']}})[_0x2d78('0x29')](handleEntityNotFound(_0x2a09ea,null))[_0x2d78('0x29')](function(_0x1fd968){if(_0x1fd968){_0x33323a=_0x1fd968;_0x1cf4af[_0x2d78('0x38')]=_['keys'](db[_0x2d78('0x5e')][_0x2d78('0x30')]);_0x1cf4af['query']=_[_0x2d78('0x35')](_0x3b774e[_0x2d78('0x34')]);_0x1cf4af[_0x2d78('0x36')]=_['intersection'](_0x1cf4af[_0x2d78('0x38')],_0x1cf4af[_0x2d78('0x34')]);_0x2c8053[_0x2d78('0x3a')]=_[_0x2d78('0x37')](_0x1cf4af['model'],qs[_0x2d78('0x39')](_0x3b774e[_0x2d78('0x34')][_0x2d78('0x39')]));_0x2c8053[_0x2d78('0x3a')]=_0x2c8053[_0x2d78('0x3a')][_0x2d78('0x3b')]?_0x2c8053['attributes']:_0x1cf4af['model'];_0x2c8053[_0x2d78('0x3c')]=qs[_0x2d78('0x3d')](_0x3b774e[_0x2d78('0x34')][_0x2d78('0x3d')]);_0x2c8053[_0x2d78('0x3e')]=qs[_0x2d78('0x36')](_[_0x2d78('0x3f')](_0x3b774e[_0x2d78('0x34')],_0x1cf4af[_0x2d78('0x36')]));if(_0x3b774e[_0x2d78('0x34')]['filter']){_0x2c8053[_0x2d78('0x3e')]=_[_0x2d78('0x42')](_0x2c8053[_0x2d78('0x3e')],{'$or':_[_0x2d78('0x33')](_0x2c8053[_0x2d78('0x3a')],function(_0x442a80){var _0x23877c={};_0x23877c[_0x442a80]={'$like':'%'+_0x3b774e[_0x2d78('0x34')][_0x2d78('0x40')]+'%'};return _0x23877c;})});}_0x2c8053=_[_0x2d78('0x42')]({},_0x2c8053,_0x3b774e[_0x2d78('0x43')]);return _0x33323a[_0x2d78('0x5f')](_0x2c8053);}})[_0x2d78('0x29')](function(_0x4ddd07){if(_0x4ddd07){_0x833e12=_0x4ddd07[_0x2d78('0x3b')];if(!_0x3b774e['query']['hasOwnProperty']('nolimit')){_0x2c8053['limit']=qs[_0x2d78('0x20')](_0x3b774e[_0x2d78('0x34')][_0x2d78('0x20')]);_0x2c8053[_0x2d78('0x1e')]=qs[_0x2d78('0x1e')](_0x3b774e[_0x2d78('0x34')][_0x2d78('0x1e')]);}return _0x33323a[_0x2d78('0x5f')](_0x2c8053);}})[_0x2d78('0x29')](function(_0x54c59e){if(_0x54c59e){return _0x54c59e?{'count':_0x833e12,'rows':_0x54c59e}:null;}})[_0x2d78('0x29')](respondWithResult(_0x2a09ea,null))['catch'](handleError(_0x2a09ea,null));}; \ No newline at end of file +var _0xe29f=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','findAll','rows','show','intersection','include','merge','find','catch','create','body','user','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xe29f,0x1db));var _0xfe29=function(_0x3deae2,_0x4b0190){_0x3deae2=_0x3deae2-0x0;var _0x805df2=_0xe29f[_0x3deae2];return _0x805df2;};'use strict';var emlformat=require(_0xfe29('0x0'));var rimraf=require(_0xfe29('0x1'));var zipdir=require(_0xfe29('0x2'));var jsonpatch=require(_0xfe29('0x3'));var rp=require('request-promise');var moment=require(_0xfe29('0x4'));var BPromise=require(_0xfe29('0x5'));var Mustache=require(_0xfe29('0x6'));var util=require(_0xfe29('0x7'));var path=require(_0xfe29('0x8'));var sox=require(_0xfe29('0x9'));var csv=require(_0xfe29('0xa'));var ejs=require(_0xfe29('0xb'));var fs=require('fs');var fs_extra=require(_0xfe29('0xc'));var _=require(_0xfe29('0xd'));var squel=require(_0xfe29('0xe'));var crypto=require(_0xfe29('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xfe29('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe29('0x11'));var authService=require(_0xfe29('0x12'));var qs=require(_0xfe29('0x13'));var as=require(_0xfe29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe29('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfe29('0x16'))['db'];function respondWithStatusCode(_0x8be1f0,_0x347c4e){_0x347c4e=_0x347c4e||0xcc;return function(_0x145801){if(_0x145801){return _0x8be1f0[_0xfe29('0x17')](_0x347c4e);}return _0x8be1f0[_0xfe29('0x18')](_0x347c4e)['end']();};}function respondWithResult(_0x487219,_0x1baa24){_0x1baa24=_0x1baa24||0xc8;return function(_0x55deac){if(_0x55deac){return _0x487219['status'](_0x1baa24)['json'](_0x55deac);}};}function respondWithFilteredResult(_0x42b075,_0x4b3943){return function(_0x4d075e){if(_0x4d075e){var _0x1321e1=typeof _0x4b3943['offset']===_0xfe29('0x19')&&typeof _0x4b3943['limit']===_0xfe29('0x19');var _0x91ff1a=_0x4d075e[_0xfe29('0x1a')];var _0x42813d=_0x1321e1?0x0:_0x4b3943['offset'];var _0x53c1f3=_0x1321e1?_0x4d075e[_0xfe29('0x1a')]:_0x4b3943[_0xfe29('0x1b')]+_0x4b3943[_0xfe29('0x1c')];var _0x411cc6;if(_0x53c1f3>=_0x91ff1a){_0x53c1f3=_0x91ff1a;_0x411cc6=0xc8;}else{_0x411cc6=0xce;}_0x42b075['status'](_0x411cc6);return _0x42b075[_0xfe29('0x1d')](_0xfe29('0x1e'),_0x42813d+'-'+_0x53c1f3+'/'+_0x91ff1a)[_0xfe29('0x1f')](_0x4d075e);}return null;};}function patchUpdates(_0x5a2058){return function(_0x1c7d9e){try{jsonpatch[_0xfe29('0x20')](_0x1c7d9e,_0x5a2058,!![]);}catch(_0x11f252){return BPromise[_0xfe29('0x21')](_0x11f252);}return _0x1c7d9e[_0xfe29('0x22')]();};}function saveUpdates(_0x59179f,_0x1b9f4f){return function(_0x2cefd7){if(_0x2cefd7){return _0x2cefd7['update'](_0x59179f)['then'](function(_0x515f23){return _0x515f23;});}return null;};}function removeEntity(_0x255ab2,_0x104aaa){return function(_0x4e0970){if(_0x4e0970){return _0x4e0970['destroy']()[_0xfe29('0x23')](function(){var _0x48cb36=_0x4e0970[_0xfe29('0x24')]({'plain':!![]});var _0x364271='Triggers';return db[_0xfe29('0x25')][_0xfe29('0x26')]({'where':{'type':_0x364271,'resourceId':_0x48cb36['id']}})[_0xfe29('0x23')](function(){return _0x4e0970;});})[_0xfe29('0x23')](function(){_0x255ab2['status'](0xcc)[_0xfe29('0x27')]();});}};}function handleEntityNotFound(_0x289016,_0x527e97){return function(_0x15bf3f){if(!_0x15bf3f){_0x289016[_0xfe29('0x17')](0x194);}return _0x15bf3f;};}function handleError(_0x1b4d83,_0x8daf87){_0x8daf87=_0x8daf87||0x1f4;return function(_0x2fc1dd){logger['error'](_0x2fc1dd[_0xfe29('0x28')]);if(_0x2fc1dd[_0xfe29('0x29')]){delete _0x2fc1dd['name'];}_0x1b4d83[_0xfe29('0x18')](_0x8daf87)[_0xfe29('0x2a')](_0x2fc1dd);};}exports[_0xfe29('0x2b')]=function(_0x475b5d,_0xc3869e){var _0xa4c743={},_0x40149d={},_0x1906b8={'count':0x0,'rows':[]};var _0x4ba78f=_[_0xfe29('0x2c')](db[_0xfe29('0x2d')][_0xfe29('0x2e')],function(_0x18da81){return{'name':_0x18da81[_0xfe29('0x2f')],'type':_0x18da81[_0xfe29('0x30')][_0xfe29('0x31')]};});_0x40149d[_0xfe29('0x32')]=_['map'](_0x4ba78f,_0xfe29('0x29'));_0x40149d[_0xfe29('0x33')]=_[_0xfe29('0x34')](_0x475b5d[_0xfe29('0x33')]);_0x40149d['filters']=_['intersection'](_0x40149d['model'],_0x40149d[_0xfe29('0x33')]);_0xa4c743['attributes']=_['intersection'](_0x40149d[_0xfe29('0x32')],qs['fields'](_0x475b5d[_0xfe29('0x33')][_0xfe29('0x35')]));_0xa4c743[_0xfe29('0x36')]=_0xa4c743[_0xfe29('0x36')]['length']?_0xa4c743[_0xfe29('0x36')]:_0x40149d[_0xfe29('0x32')];if(!_0x475b5d['query'][_0xfe29('0x37')](_0xfe29('0x38'))){_0xa4c743[_0xfe29('0x1c')]=qs[_0xfe29('0x1c')](_0x475b5d[_0xfe29('0x33')][_0xfe29('0x1c')]);_0xa4c743[_0xfe29('0x1b')]=qs[_0xfe29('0x1b')](_0x475b5d['query'][_0xfe29('0x1b')]);}_0xa4c743[_0xfe29('0x39')]=qs[_0xfe29('0x3a')](_0x475b5d[_0xfe29('0x33')][_0xfe29('0x3a')]);_0xa4c743[_0xfe29('0x3b')]=qs['filters'](_[_0xfe29('0x3c')](_0x475b5d[_0xfe29('0x33')],_0x40149d[_0xfe29('0x3d')]),_0x4ba78f);if(_0x475b5d[_0xfe29('0x33')][_0xfe29('0x3e')]){_0xa4c743[_0xfe29('0x3b')]=_['merge'](_0xa4c743[_0xfe29('0x3b')],{'$or':_[_0xfe29('0x2c')](_0x4ba78f,function(_0x322fb6){if(_0x322fb6[_0xfe29('0x30')]!==_0xfe29('0x3f')){var _0xb10b2={};_0xb10b2[_0x322fb6[_0xfe29('0x29')]]={'$like':'%'+_0x475b5d[_0xfe29('0x33')]['filter']+'%'};return _0xb10b2;}})});}_0xa4c743=_['merge']({},_0xa4c743,_0x475b5d[_0xfe29('0x40')]);var _0x4b756c={'where':_0xa4c743[_0xfe29('0x3b')]};return db[_0xfe29('0x2d')]['count'](_0x4b756c)[_0xfe29('0x23')](function(_0x1eeb92){_0x1906b8[_0xfe29('0x1a')]=_0x1eeb92;if(_0x475b5d[_0xfe29('0x33')][_0xfe29('0x41')]){_0xa4c743['include']=[{'all':!![]}];}return db[_0xfe29('0x2d')][_0xfe29('0x42')](_0xa4c743);})[_0xfe29('0x23')](function(_0x4695be){_0x1906b8[_0xfe29('0x43')]=_0x4695be;return _0x1906b8;})[_0xfe29('0x23')](respondWithFilteredResult(_0xc3869e,_0xa4c743))['catch'](handleError(_0xc3869e,null));};exports[_0xfe29('0x44')]=function(_0xb1c523,_0x453380){var _0x1f6f3d={'raw':![],'where':{'id':_0xb1c523['params']['id']}},_0x333b4f={};_0x333b4f[_0xfe29('0x32')]=_['keys'](db[_0xfe29('0x2d')]['rawAttributes']);_0x333b4f[_0xfe29('0x33')]=_[_0xfe29('0x34')](_0xb1c523[_0xfe29('0x33')]);_0x333b4f[_0xfe29('0x3d')]=_['intersection'](_0x333b4f['model'],_0x333b4f[_0xfe29('0x33')]);_0x1f6f3d['attributes']=_[_0xfe29('0x45')](_0x333b4f[_0xfe29('0x32')],qs['fields'](_0xb1c523[_0xfe29('0x33')][_0xfe29('0x35')]));_0x1f6f3d[_0xfe29('0x36')]=_0x1f6f3d[_0xfe29('0x36')]['length']?_0x1f6f3d[_0xfe29('0x36')]:_0x333b4f[_0xfe29('0x32')];if(_0xb1c523[_0xfe29('0x33')][_0xfe29('0x41')]){_0x1f6f3d[_0xfe29('0x46')]=[{'all':!![]}];}_0x1f6f3d=_[_0xfe29('0x47')]({},_0x1f6f3d,_0xb1c523['options']);return db[_0xfe29('0x2d')][_0xfe29('0x48')](_0x1f6f3d)[_0xfe29('0x23')](handleEntityNotFound(_0x453380,null))[_0xfe29('0x23')](respondWithResult(_0x453380,null))[_0xfe29('0x49')](handleError(_0x453380,null));};exports[_0xfe29('0x4a')]=function(_0x984dfb,_0x1ef09d){return db['Trigger'][_0xfe29('0x4a')](_0x984dfb[_0xfe29('0x4b')],{})[_0xfe29('0x23')](function(_0x317272){var _0x17062e=_0x984dfb[_0xfe29('0x4c')][_0xfe29('0x24')]({'plain':!![]});if(!_0x17062e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17062e['role']===_0xfe29('0x4c')){var _0x3bd56e=_0x317272['get']({'plain':!![]});var _0x537914=_0xfe29('0x4d');return db[_0xfe29('0x4e')][_0xfe29('0x48')]({'where':{'name':_0x537914,'userProfileId':_0x17062e[_0xfe29('0x4f')]},'raw':!![]})[_0xfe29('0x23')](function(_0x561051){if(_0x561051&&_0x561051[_0xfe29('0x50')]===0x0){return db['UserProfileResource'][_0xfe29('0x4a')]({'name':_0x3bd56e[_0xfe29('0x29')],'resourceId':_0x3bd56e['id'],'type':_0x561051[_0xfe29('0x29')],'sectionId':_0x561051['id']},{})[_0xfe29('0x23')](function(){return _0x317272;});}else{return _0x317272;}})[_0xfe29('0x49')](function(_0x4e7059){logger[_0xfe29('0x51')](_0xfe29('0x52'),_0x4e7059);throw _0x4e7059;});}return _0x317272;})['then'](respondWithResult(_0x1ef09d,0xc9))['catch'](handleError(_0x1ef09d,null));};exports[_0xfe29('0x53')]=function(_0x1f39f6,_0x11ade2){if(_0x1f39f6[_0xfe29('0x4b')]['id']){delete _0x1f39f6[_0xfe29('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1f39f6[_0xfe29('0x54')]['id']}})['then'](handleEntityNotFound(_0x11ade2,null))[_0xfe29('0x23')](saveUpdates(_0x1f39f6[_0xfe29('0x4b')],null))['then'](respondWithResult(_0x11ade2,null))[_0xfe29('0x49')](handleError(_0x11ade2,null));};exports[_0xfe29('0x26')]=function(_0x15133d,_0x5f08fb){return db[_0xfe29('0x2d')]['find']({'where':{'id':_0x15133d[_0xfe29('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f08fb,null))['then'](removeEntity(_0x5f08fb,null))[_0xfe29('0x49')](handleError(_0x5f08fb,null));};exports[_0xfe29('0x55')]=function(_0x4e47e8,_0x1fd2e4,_0x1cecf7){if(_0x4e47e8[_0xfe29('0x4b')]['id']){delete _0x4e47e8['body']['id'];}return db[_0xfe29('0x2d')][_0xfe29('0x48')]({'where':{'id':_0x4e47e8[_0xfe29('0x54')]['id']}})['then'](handleEntityNotFound(_0x1fd2e4,null))[_0xfe29('0x23')](function(_0x2e3d43){if(_0x2e3d43){_0x4e47e8['body'][_0xfe29('0x56')]=_0x2e3d43['id'];return db[_0xfe29('0x57')][_0xfe29('0x4a')](_0x4e47e8[_0xfe29('0x4b')]);}})[_0xfe29('0x23')](respondWithResult(_0x1fd2e4,null))[_0xfe29('0x49')](handleError(_0x1fd2e4,null));};exports['addAnyCondition']=function(_0x3297ab,_0x27e8cc,_0x538854){if(_0x3297ab['body']['id']){delete _0x3297ab[_0xfe29('0x4b')]['id'];}return db[_0xfe29('0x2d')]['find']({'where':{'id':_0x3297ab[_0xfe29('0x54')]['id']}})[_0xfe29('0x23')](handleEntityNotFound(_0x27e8cc,null))['then'](function(_0x4d458c){if(_0x4d458c){_0x3297ab[_0xfe29('0x4b')][_0xfe29('0x58')]=_0x4d458c['id'];return db[_0xfe29('0x57')][_0xfe29('0x4a')](_0x3297ab[_0xfe29('0x4b')]);}})[_0xfe29('0x23')](respondWithResult(_0x27e8cc,null))[_0xfe29('0x49')](handleError(_0x27e8cc,null));};exports[_0xfe29('0x59')]=function(_0x43d69c,_0x28cfc5,_0x5a95be){var _0x19ee0f={};var _0x34ec0c={};var _0x38e1b5;var _0xa78ca0;return db[_0xfe29('0x2d')][_0xfe29('0x5a')]({'where':{'id':_0x43d69c[_0xfe29('0x54')]['id']}})['then'](handleEntityNotFound(_0x28cfc5,null))[_0xfe29('0x23')](function(_0x169784){if(_0x169784){_0x38e1b5=_0x169784;_0x34ec0c[_0xfe29('0x32')]=_[_0xfe29('0x34')](db[_0xfe29('0x57')][_0xfe29('0x2e')]);_0x34ec0c[_0xfe29('0x33')]=_['keys'](_0x43d69c['query']);_0x34ec0c[_0xfe29('0x3d')]=_[_0xfe29('0x45')](_0x34ec0c[_0xfe29('0x32')],_0x34ec0c[_0xfe29('0x33')]);_0x19ee0f['attributes']=_['intersection'](_0x34ec0c[_0xfe29('0x32')],qs['fields'](_0x43d69c['query']['fields']));_0x19ee0f[_0xfe29('0x36')]=_0x19ee0f[_0xfe29('0x36')][_0xfe29('0x5b')]?_0x19ee0f['attributes']:_0x34ec0c[_0xfe29('0x32')];_0x19ee0f[_0xfe29('0x39')]=qs[_0xfe29('0x3a')](_0x43d69c['query'][_0xfe29('0x3a')]);_0x19ee0f['where']=qs[_0xfe29('0x3d')](_[_0xfe29('0x3c')](_0x43d69c[_0xfe29('0x33')],_0x34ec0c[_0xfe29('0x3d')]));if(_0x43d69c[_0xfe29('0x33')][_0xfe29('0x3e')]){_0x19ee0f[_0xfe29('0x3b')]=_[_0xfe29('0x47')](_0x19ee0f['where'],{'$or':_['map'](_0x19ee0f[_0xfe29('0x36')],function(_0x41443b){var _0x15de42={};_0x15de42[_0x41443b]={'$like':'%'+_0x43d69c[_0xfe29('0x33')][_0xfe29('0x3e')]+'%'};return _0x15de42;})});}_0x19ee0f=_[_0xfe29('0x47')]({},_0x19ee0f,_0x43d69c['options']);return _0x38e1b5[_0xfe29('0x59')](_0x19ee0f);}})[_0xfe29('0x23')](function(_0x41aeef){if(_0x41aeef){_0xa78ca0=_0x41aeef[_0xfe29('0x5b')];if(!_0x43d69c['query'][_0xfe29('0x37')](_0xfe29('0x38'))){_0x19ee0f[_0xfe29('0x1c')]=qs['limit'](_0x43d69c[_0xfe29('0x33')]['limit']);_0x19ee0f[_0xfe29('0x1b')]=qs['offset'](_0x43d69c['query'][_0xfe29('0x1b')]);}return _0x38e1b5['getAllConditions'](_0x19ee0f);}})[_0xfe29('0x23')](function(_0x38af2f){if(_0x38af2f){return _0x38af2f?{'count':_0xa78ca0,'rows':_0x38af2f}:null;}})[_0xfe29('0x23')](respondWithResult(_0x28cfc5,null))[_0xfe29('0x49')](handleError(_0x28cfc5,null));};exports['getAnyConditions']=function(_0x1cd5ca,_0xde4378,_0x1ebd25){var _0x264664={};var _0x135393={};var _0xb35bb0;var _0x59196d;return db[_0xfe29('0x2d')][_0xfe29('0x5a')]({'where':{'id':_0x1cd5ca[_0xfe29('0x54')]['id']}})[_0xfe29('0x23')](handleEntityNotFound(_0xde4378,null))['then'](function(_0x422e61){if(_0x422e61){_0xb35bb0=_0x422e61;_0x135393[_0xfe29('0x32')]=_[_0xfe29('0x34')](db['Condition'][_0xfe29('0x2e')]);_0x135393['query']=_['keys'](_0x1cd5ca['query']);_0x135393['filters']=_[_0xfe29('0x45')](_0x135393[_0xfe29('0x32')],_0x135393['query']);_0x264664[_0xfe29('0x36')]=_[_0xfe29('0x45')](_0x135393[_0xfe29('0x32')],qs[_0xfe29('0x35')](_0x1cd5ca[_0xfe29('0x33')][_0xfe29('0x35')]));_0x264664[_0xfe29('0x36')]=_0x264664[_0xfe29('0x36')][_0xfe29('0x5b')]?_0x264664[_0xfe29('0x36')]:_0x135393['model'];_0x264664[_0xfe29('0x39')]=qs[_0xfe29('0x3a')](_0x1cd5ca[_0xfe29('0x33')][_0xfe29('0x3a')]);_0x264664[_0xfe29('0x3b')]=qs[_0xfe29('0x3d')](_[_0xfe29('0x3c')](_0x1cd5ca[_0xfe29('0x33')],_0x135393[_0xfe29('0x3d')]));if(_0x1cd5ca[_0xfe29('0x33')]['filter']){_0x264664[_0xfe29('0x3b')]=_[_0xfe29('0x47')](_0x264664[_0xfe29('0x3b')],{'$or':_['map'](_0x264664[_0xfe29('0x36')],function(_0x5645a2){var _0x2b9af0={};_0x2b9af0[_0x5645a2]={'$like':'%'+_0x1cd5ca['query'][_0xfe29('0x3e')]+'%'};return _0x2b9af0;})});}_0x264664=_['merge']({},_0x264664,_0x1cd5ca[_0xfe29('0x40')]);return _0xb35bb0[_0xfe29('0x5c')](_0x264664);}})['then'](function(_0x4b3c0f){if(_0x4b3c0f){_0x59196d=_0x4b3c0f[_0xfe29('0x5b')];if(!_0x1cd5ca[_0xfe29('0x33')]['hasOwnProperty']('nolimit')){_0x264664[_0xfe29('0x1c')]=qs[_0xfe29('0x1c')](_0x1cd5ca['query'][_0xfe29('0x1c')]);_0x264664['offset']=qs[_0xfe29('0x1b')](_0x1cd5ca[_0xfe29('0x33')][_0xfe29('0x1b')]);}return _0xb35bb0[_0xfe29('0x5c')](_0x264664);}})['then'](function(_0x296b29){if(_0x296b29){return _0x296b29?{'count':_0x59196d,'rows':_0x296b29}:null;}})[_0xfe29('0x23')](respondWithResult(_0xde4378,null))['catch'](handleError(_0xde4378,null));};exports[_0xfe29('0x5d')]=function(_0x104cb7,_0x28b79f,_0x1e3c38){if(_0x104cb7[_0xfe29('0x4b')]['id']){delete _0x104cb7[_0xfe29('0x4b')]['id'];}return db[_0xfe29('0x2d')][_0xfe29('0x48')]({'where':{'id':_0x104cb7[_0xfe29('0x54')]['id']}})[_0xfe29('0x23')](handleEntityNotFound(_0x28b79f,null))[_0xfe29('0x23')](function(_0x562050){if(_0x562050){_0x104cb7[_0xfe29('0x4b')][_0xfe29('0x5e')]=_0x562050['id'];return db[_0xfe29('0x5f')][_0xfe29('0x4a')](_0x104cb7[_0xfe29('0x4b')]);}})[_0xfe29('0x23')](respondWithResult(_0x28b79f,null))[_0xfe29('0x49')](handleError(_0x28b79f,null));};exports[_0xfe29('0x60')]=function(_0x44bb66,_0x51a0bb,_0x214f77){var _0x2dd160={};var _0xf61eaf={};var _0x30330a;var _0xdab77;return db[_0xfe29('0x2d')]['findOne']({'where':{'id':_0x44bb66[_0xfe29('0x54')]['id']}})[_0xfe29('0x23')](handleEntityNotFound(_0x51a0bb,null))[_0xfe29('0x23')](function(_0x1a2f22){if(_0x1a2f22){_0x30330a=_0x1a2f22;_0xf61eaf[_0xfe29('0x32')]=_['keys'](db[_0xfe29('0x5f')][_0xfe29('0x2e')]);_0xf61eaf[_0xfe29('0x33')]=_[_0xfe29('0x34')](_0x44bb66['query']);_0xf61eaf[_0xfe29('0x3d')]=_['intersection'](_0xf61eaf['model'],_0xf61eaf[_0xfe29('0x33')]);_0x2dd160['attributes']=_['intersection'](_0xf61eaf[_0xfe29('0x32')],qs[_0xfe29('0x35')](_0x44bb66[_0xfe29('0x33')][_0xfe29('0x35')]));_0x2dd160[_0xfe29('0x36')]=_0x2dd160['attributes'][_0xfe29('0x5b')]?_0x2dd160[_0xfe29('0x36')]:_0xf61eaf[_0xfe29('0x32')];_0x2dd160[_0xfe29('0x39')]=qs['sort'](_0x44bb66['query'][_0xfe29('0x3a')]);_0x2dd160['where']=qs[_0xfe29('0x3d')](_[_0xfe29('0x3c')](_0x44bb66['query'],_0xf61eaf[_0xfe29('0x3d')]));if(_0x44bb66[_0xfe29('0x33')][_0xfe29('0x3e')]){_0x2dd160[_0xfe29('0x3b')]=_[_0xfe29('0x47')](_0x2dd160['where'],{'$or':_[_0xfe29('0x2c')](_0x2dd160[_0xfe29('0x36')],function(_0x337165){var _0x375505={};_0x375505[_0x337165]={'$like':'%'+_0x44bb66['query']['filter']+'%'};return _0x375505;})});}_0x2dd160=_[_0xfe29('0x47')]({},_0x2dd160,_0x44bb66[_0xfe29('0x40')]);return _0x30330a[_0xfe29('0x60')](_0x2dd160);}})[_0xfe29('0x23')](function(_0x16ad9d){if(_0x16ad9d){_0xdab77=_0x16ad9d[_0xfe29('0x5b')];if(!_0x44bb66['query']['hasOwnProperty'](_0xfe29('0x38'))){_0x2dd160[_0xfe29('0x1c')]=qs['limit'](_0x44bb66[_0xfe29('0x33')][_0xfe29('0x1c')]);_0x2dd160[_0xfe29('0x1b')]=qs['offset'](_0x44bb66[_0xfe29('0x33')][_0xfe29('0x1b')]);}return _0x30330a[_0xfe29('0x60')](_0x2dd160);}})['then'](function(_0xbfe915){if(_0xbfe915){return _0xbfe915?{'count':_0xdab77,'rows':_0xbfe915}:null;}})['then'](respondWithResult(_0x51a0bb,null))[_0xfe29('0x49')](handleError(_0x51a0bb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 913a516..477f6c1 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 _0x3164=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x37c7d9,_0x2dea78){var _0x45e519=function(_0xfc0e57){while(--_0xfc0e57){_0x37c7d9['push'](_0x37c7d9['shift']());}};_0x45e519(++_0x2dea78);}(_0x3164,0x182));var _0x4316=function(_0x43b9f7,_0x32f5a7){_0x43b9f7=_0x43b9f7-0x0;var _0x102365=_0x3164[_0x43b9f7];return _0x102365;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require(_0x4316('0x4'));var BPromise=require('bluebird');var rp=require(_0x4316('0x5'));var fs=require('fs');var path=require(_0x4316('0x6'));var rimraf=require(_0x4316('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x4316('0x8')]=function(_0x25827b,_0xf88ba4){return _0x25827b[_0x4316('0x9')](_0x4316('0xa'),attributes,{'tableName':_0x4316('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['./trigger.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5eac99,_0x363882){var _0x12a907=function(_0x318a0e){while(--_0x318a0e){_0x5eac99['push'](_0x5eac99['shift']());}};_0x12a907(++_0x363882);}(_0x4bc3,0x16e));var _0x34bc=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x4bc3[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 8b9558e..4a58b35 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 _0x0dd1=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Trigger','findAll','raw','options','where','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then'];(function(_0x175836,_0x30d703){var _0x131b59=function(_0x452a85){while(--_0x452a85){_0x175836['push'](_0x175836['shift']());}};_0x131b59(++_0x30d703);}(_0x0dd1,0x16b));var _0x10dd=function(_0x460358,_0x354877){_0x460358=_0x460358-0x0;var _0xdfdfa8=_0x0dd1[_0x460358];return _0xdfdfa8;};'use strict';var _=require(_0x10dd('0x0'));var util=require(_0x10dd('0x1'));var moment=require('moment');var BPromise=require(_0x10dd('0x2'));var rs=require(_0x10dd('0x3'));var fs=require('fs');var Redis=require(_0x10dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10dd('0x5'));var config=require(_0x10dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x10dd('0x7')][_0x10dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437fb1,_0x1ea058,_0x5eacee){return new BPromise(function(_0x5758c7,_0x59117e){return client[_0x10dd('0x9')](_0x437fb1,_0x5eacee)[_0x10dd('0xa')](function(_0x298452){logger['info'](_0x10dd('0xb'),_0x1ea058,_0x10dd('0xc'));logger[_0x10dd('0xd')](_0x10dd('0xe'),_0x1ea058,_0x10dd('0xc'),JSON[_0x10dd('0xf')](_0x298452));if(_0x298452[_0x10dd('0x10')]){if(_0x298452[_0x10dd('0x10')]['code']===0x1f4){logger['error'](_0x10dd('0xb'),_0x1ea058,_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);return _0x59117e(_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);}logger[_0x10dd('0x10')](_0x10dd('0xb'),_0x1ea058,_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);return _0x5758c7(_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);}else{logger[_0x10dd('0x12')]('Trigger,\x20%s,\x20%s',_0x1ea058,'request\x20sent');_0x5758c7(_0x298452[_0x10dd('0x13')]['message']);}})[_0x10dd('0x14')](function(_0x798d5d){logger[_0x10dd('0x10')](_0x10dd('0xb'),_0x1ea058,_0x798d5d);_0x59117e(_0x798d5d);});});}exports['GetTrigger']=function(_0x3ab5bf){var _0x1e077a=this;return new Promise(function(_0x59fc8c,_0x7c29ca){return db[_0x10dd('0x15')][_0x10dd('0x16')]({'raw':_0x3ab5bf['options']?_0x3ab5bf['options'][_0x10dd('0x17')]===undefined?!![]:![]:!![],'where':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x19')]||null:null,'attributes':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf['options'][_0x10dd('0x1a')]||null:null,'limit':_0x3ab5bf['options']?_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x1b')]||null:null,'include':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf['options']['include']?_[_0x10dd('0x1c')](_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x1d')],function(_0x140e40){return{'model':db[_0x140e40[_0x10dd('0x1e')]],'as':_0x140e40['as'],'attributes':_0x140e40[_0x10dd('0x1a')],'include':_0x140e40[_0x10dd('0x1d')]?_[_0x10dd('0x1c')](_0x140e40[_0x10dd('0x1d')],function(_0x8bfc8){return{'model':db[_0x8bfc8[_0x10dd('0x1e')]],'as':_0x8bfc8['as'],'attributes':_0x8bfc8[_0x10dd('0x1a')],'include':_0x8bfc8[_0x10dd('0x1d')]?_[_0x10dd('0x1c')](_0x8bfc8[_0x10dd('0x1d')],function(_0x4de749){return{'model':db[_0x4de749[_0x10dd('0x1e')]],'as':_0x4de749['as'],'attributes':_0x4de749['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x211106){logger[_0x10dd('0x12')](_0x10dd('0x1f'),_0x3ab5bf);logger[_0x10dd('0xd')](_0x10dd('0x1f'),_0x3ab5bf,JSON[_0x10dd('0xf')](_0x211106));_0x59fc8c(_0x211106);})[_0x10dd('0x14')](function(_0x20bc15){logger['error'](_0x10dd('0x1f'),_0x20bc15[_0x10dd('0x11')],_0x3ab5bf);_0x7c29ca(_0x1e077a[_0x10dd('0x10')](0x1f4,_0x20bc15[_0x10dd('0x11')]));});});};exports[_0x10dd('0x20')]=function(_0x3a6935){var _0xe018c8=this;return new Promise(function(_0x3bccab,_0xb2da9){return db[_0x10dd('0x15')][_0x10dd('0x21')]({'raw':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')][_0x10dd('0x17')]===undefined?!![]:![]:!![],'where':_0x3a6935[_0x10dd('0x18')]?_0x3a6935['options']['where']||null:null,'attributes':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')][_0x10dd('0x1a')]||null:null,'include':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')]['include']?_['map'](_0x3a6935[_0x10dd('0x18')][_0x10dd('0x1d')],function(_0x47e52a){return{'model':db[_0x47e52a['model']],'as':_0x47e52a['as'],'attributes':_0x47e52a[_0x10dd('0x1a')],'include':_0x47e52a[_0x10dd('0x1d')]?_['map'](_0x47e52a['include'],function(_0x3d8b53){return{'model':db[_0x3d8b53['model']],'as':_0x3d8b53['as'],'attributes':_0x3d8b53[_0x10dd('0x1a')],'include':_0x3d8b53['include']?_[_0x10dd('0x1c')](_0x3d8b53[_0x10dd('0x1d')],function(_0x67c773){return{'model':db[_0x67c773[_0x10dd('0x1e')]],'as':_0x67c773['as'],'attributes':_0x67c773[_0x10dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x10dd('0xa')](function(_0x31dcdd){logger[_0x10dd('0x12')](_0x10dd('0x20'),_0x3a6935);logger[_0x10dd('0xd')](_0x10dd('0x20'),_0x3a6935,JSON[_0x10dd('0xf')](_0x31dcdd));_0x3bccab(_0x31dcdd);})[_0x10dd('0x14')](function(_0x6d2e9){logger[_0x10dd('0x10')](_0x10dd('0x20'),_0x6d2e9[_0x10dd('0x11')],_0x3a6935);_0xb2da9(_0xe018c8[_0x10dd('0x10')](0x1f4,_0x6d2e9[_0x10dd('0x11')]));});});}; \ No newline at end of file +var _0x86f8=['code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x527438,_0x371183){var _0x587d46=function(_0x2b2386){while(--_0x2b2386){_0x527438['push'](_0x527438['shift']());}};_0x587d46(++_0x371183);}(_0x86f8,0x1e6));var _0x886f=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x86f8[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require('lodash');var util=require(_0x886f('0x0'));var moment=require(_0x886f('0x1'));var BPromise=require(_0x886f('0x2'));var rs=require(_0x886f('0x3'));var fs=require('fs');var Redis=require(_0x886f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x886f('0x5'));var logger=require(_0x886f('0x6'))(_0x886f('0x7'));var config=require(_0x886f('0x8'));var jayson=require(_0x886f('0x9'));var client=jayson[_0x886f('0xa')][_0x886f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21428b,_0x1edfc0,_0x302255){return new BPromise(function(_0x5e8e98,_0x5b72b6){return client[_0x886f('0xc')](_0x21428b,_0x302255)['then'](function(_0x36f977){logger[_0x886f('0xd')](_0x886f('0xe'),_0x1edfc0,_0x886f('0xf'));logger[_0x886f('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1edfc0,'request\x20sent',JSON['stringify'](_0x36f977));if(_0x36f977[_0x886f('0x11')]){if(_0x36f977['error'][_0x886f('0x12')]===0x1f4){logger[_0x886f('0x11')](_0x886f('0xe'),_0x1edfc0,_0x36f977[_0x886f('0x11')]['message']);return _0x5b72b6(_0x36f977[_0x886f('0x11')][_0x886f('0x13')]);}logger[_0x886f('0x11')](_0x886f('0xe'),_0x1edfc0,_0x36f977[_0x886f('0x11')][_0x886f('0x13')]);return _0x5e8e98(_0x36f977[_0x886f('0x11')][_0x886f('0x13')]);}else{logger['info'](_0x886f('0xe'),_0x1edfc0,_0x886f('0xf'));_0x5e8e98(_0x36f977[_0x886f('0x14')][_0x886f('0x13')]);}})[_0x886f('0x15')](function(_0x3ca901){logger[_0x886f('0x11')]('Trigger,\x20%s,\x20%s',_0x1edfc0,_0x3ca901);_0x5b72b6(_0x3ca901);});});}exports[_0x886f('0x16')]=function(_0x26cdaa){var _0x1b4b0d=this;return new Promise(function(_0x3ab69c,_0x50f423){return db[_0x886f('0x17')][_0x886f('0x18')]({'raw':_0x26cdaa[_0x886f('0x19')]?_0x26cdaa[_0x886f('0x19')][_0x886f('0x1a')]===undefined?!![]:![]:!![],'where':_0x26cdaa[_0x886f('0x19')]?_0x26cdaa[_0x886f('0x19')][_0x886f('0x1b')]||null:null,'attributes':_0x26cdaa[_0x886f('0x19')]?_0x26cdaa['options'][_0x886f('0x1c')]||null:null,'limit':_0x26cdaa[_0x886f('0x19')]?_0x26cdaa[_0x886f('0x19')][_0x886f('0x1d')]||null:null,'include':_0x26cdaa[_0x886f('0x19')]?_0x26cdaa[_0x886f('0x19')][_0x886f('0x1e')]?_[_0x886f('0x1f')](_0x26cdaa[_0x886f('0x19')][_0x886f('0x1e')],function(_0x3294eb){return{'model':db[_0x3294eb['model']],'as':_0x3294eb['as'],'attributes':_0x3294eb[_0x886f('0x1c')],'include':_0x3294eb[_0x886f('0x1e')]?_['map'](_0x3294eb[_0x886f('0x1e')],function(_0x20be07){return{'model':db[_0x20be07['model']],'as':_0x20be07['as'],'attributes':_0x20be07['attributes'],'include':_0x20be07[_0x886f('0x1e')]?_[_0x886f('0x1f')](_0x20be07[_0x886f('0x1e')],function(_0x269734){return{'model':db[_0x269734[_0x886f('0x20')]],'as':_0x269734['as'],'attributes':_0x269734[_0x886f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x886f('0x21')](function(_0x3319b7){logger[_0x886f('0xd')](_0x886f('0x16'),_0x26cdaa);logger[_0x886f('0x10')](_0x886f('0x16'),_0x26cdaa,JSON[_0x886f('0x22')](_0x3319b7));_0x3ab69c(_0x3319b7);})[_0x886f('0x15')](function(_0x1917aa){logger[_0x886f('0x11')]('GetTrigger',_0x1917aa['message'],_0x26cdaa);_0x50f423(_0x1b4b0d[_0x886f('0x11')](0x1f4,_0x1917aa['message']));});});};exports[_0x886f('0x23')]=function(_0x3a707f){var _0x1f3247=this;return new Promise(function(_0x2b44b7,_0x5681d5){return db[_0x886f('0x17')]['find']({'raw':_0x3a707f['options']?_0x3a707f['options'][_0x886f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a707f[_0x886f('0x19')]?_0x3a707f[_0x886f('0x19')][_0x886f('0x1b')]||null:null,'attributes':_0x3a707f[_0x886f('0x19')]?_0x3a707f['options'][_0x886f('0x1c')]||null:null,'include':_0x3a707f[_0x886f('0x19')]?_0x3a707f[_0x886f('0x19')][_0x886f('0x1e')]?_['map'](_0x3a707f[_0x886f('0x19')][_0x886f('0x1e')],function(_0x510efb){return{'model':db[_0x510efb[_0x886f('0x20')]],'as':_0x510efb['as'],'attributes':_0x510efb[_0x886f('0x1c')],'include':_0x510efb[_0x886f('0x1e')]?_['map'](_0x510efb[_0x886f('0x1e')],function(_0x1e2b64){return{'model':db[_0x1e2b64['model']],'as':_0x1e2b64['as'],'attributes':_0x1e2b64[_0x886f('0x1c')],'include':_0x1e2b64['include']?_[_0x886f('0x1f')](_0x1e2b64[_0x886f('0x1e')],function(_0x1e1947){return{'model':db[_0x1e1947[_0x886f('0x20')]],'as':_0x1e1947['as'],'attributes':_0x1e1947[_0x886f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x886f('0x21')](function(_0x50e8dd){logger[_0x886f('0xd')](_0x886f('0x23'),_0x3a707f);logger['debug']('ShowTrigger',_0x3a707f,JSON[_0x886f('0x22')](_0x50e8dd));_0x2b44b7(_0x50e8dd);})[_0x886f('0x15')](function(_0x4952f3){logger[_0x886f('0x11')](_0x886f('0x23'),_0x4952f3[_0x886f('0x13')],_0x3a707f);_0x5681d5(_0x1f3247['error'](0x1f4,_0x4952f3[_0x886f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 56211ed..4353e6e 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 _0x2241=['isAuthenticated','/:id','post','/:id/clone','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x29bad8,_0x440b57){var _0x1a5486=function(_0xa83322){while(--_0xa83322){_0x29bad8['push'](_0x29bad8['shift']());}};_0x1a5486(++_0x440b57);}(_0x2241,0xfa));var _0x1224=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2241[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1224('0x0'));var util=require('util');var path=require(_0x1224('0x1'));var timeout=require(_0x1224('0x2'));var express=require(_0x1224('0x3'));var router=express[_0x1224('0x4')]();var fs_extra=require(_0x1224('0x5'));var auth=require(_0x1224('0x6'));var interaction=require(_0x1224('0x7'));var config=require(_0x1224('0x8'));var controller=require('./trunk.controller');router[_0x1224('0x9')]('/',auth[_0x1224('0xa')](),controller['index']);router['get'](_0x1224('0xb'),auth[_0x1224('0xa')](),controller['show']);router[_0x1224('0xc')](_0x1224('0xd'),auth[_0x1224('0xa')](),controller['clone']);router[_0x1224('0xc')]('/',auth['isAuthenticated'](),controller[_0x1224('0xe')]);router[_0x1224('0xf')]('/:id',auth[_0x1224('0xa')](),controller[_0x1224('0x10')]);router[_0x1224('0x11')]('/:id',auth[_0x1224('0xa')](),controller[_0x1224('0x12')]);module[_0x1224('0x13')]=router; \ No newline at end of file +var _0x7b8f=['clone','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','post'];(function(_0x22a34e,_0xc1291a){var _0x1785cb=function(_0x20b5cc){while(--_0x20b5cc){_0x22a34e['push'](_0x22a34e['shift']());}};_0x1785cb(++_0xc1291a);}(_0x7b8f,0x16f));var _0xf7b8=function(_0x4c137c,_0x41c5b4){_0x4c137c=_0x4c137c-0x0;var _0x5e1d03=_0x7b8f[_0x4c137c];return _0x5e1d03;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf7b8('0x0'));var timeout=require(_0xf7b8('0x1'));var express=require(_0xf7b8('0x2'));var router=express[_0xf7b8('0x3')]();var fs_extra=require(_0xf7b8('0x4'));var auth=require(_0xf7b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf7b8('0x6'));var controller=require(_0xf7b8('0x7'));router['get']('/',auth[_0xf7b8('0x8')](),controller[_0xf7b8('0x9')]);router[_0xf7b8('0xa')](_0xf7b8('0xb'),auth[_0xf7b8('0x8')](),controller['show']);router[_0xf7b8('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0xf7b8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf7b8('0xe')]);router[_0xf7b8('0xf')]('/:id',auth[_0xf7b8('0x8')](),controller[_0xf7b8('0x10')]);router[_0xf7b8('0x11')]('/:id',auth[_0xf7b8('0x8')](),controller[_0xf7b8('0x12')]);module[_0xf7b8('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f29ba4b..f80a884 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 _0x0287=['outgoing','yes','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','dynamic','BOOLEAN','sequelize','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','shortinfo','inband','auto','nonat','update'];(function(_0x322128,_0x54c0ce){var _0x53ebea=function(_0x299d54){while(--_0x299d54){_0x322128['push'](_0x322128['shift']());}};_0x53ebea(++_0x54c0ce);}(_0x0287,0x1e3));var _0x7028=function(_0x1bf89a,_0x2a2949){_0x1bf89a=_0x1bf89a-0x0;var _0x198910=_0x0287[_0x1bf89a];return _0x198910;};'use strict';var Sequelize=require(_0x7028('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7028('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x3'),_0x7028('0x4'),_0x7028('0x5')),'allowNull':![],'defaultValue':_0x7028('0x3')},'context':{'type':Sequelize[_0x7028('0x6')],'allowNull':![],'defaultValue':_0x7028('0x7')},'callingpres':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x8'),_0x7028('0x9'),_0x7028('0xa'),'ALLOWED',_0x7028('0xb'),_0x7028('0xc'),_0x7028('0xd'),_0x7028('0xe'))},'deny':{'type':Sequelize[_0x7028('0x6')]},'permit':{'type':Sequelize[_0x7028('0x6')]},'secret':{'type':Sequelize[_0x7028('0x6')]},'md5secret':{'type':Sequelize[_0x7028('0x6')]},'remotesecret':{'type':Sequelize[_0x7028('0x6')]},'transport':{'type':Sequelize[_0x7028('0x6')],'defaultValue':_0x7028('0xf'),'set':function(_0xda85ae){this[_0x7028('0x10')](_0x7028('0x11'),_0xda85ae?_0xda85ae[_0x7028('0x12')](','):null);},'get':function(){return this[_0x7028('0x13')](_0x7028('0x11'))?this['getDataValue'](_0x7028('0x11'))[_0x7028('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x7028('0x15'),'info',_0x7028('0x16'),_0x7028('0x17'),_0x7028('0x18')),'defaultValue':_0x7028('0x15')},'directmedia':{'type':Sequelize[_0x7028('0x2')]('yes','no',_0x7028('0x19'),_0x7028('0x1a'),_0x7028('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7028('0x6')]},'directmediadeny':{'type':Sequelize[_0x7028('0x6')]},'nat':{'type':Sequelize[_0x7028('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x55d584){this[_0x7028('0x10')](_0x7028('0x1d'),_0x55d584?_0x55d584[_0x7028('0x12')](','):null);},'get':function(){return this[_0x7028('0x13')](_0x7028('0x1d'))?this['getDataValue']('nat')[_0x7028('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7028('0x6')]},'namedcallgroup':{'type':Sequelize[_0x7028('0x6')]},'pickupgroup':{'type':Sequelize[_0x7028('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7028('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7028('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7028('0x6')],'defaultValue':_0x7028('0x1e')},'allow':{'type':Sequelize[_0x7028('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xf010db){this[_0x7028('0x10')](_0x7028('0x1f'),_0xf010db?_0xf010db[_0x7028('0x12')](';'):_0x7028('0x20'));},'get':function(){return this[_0x7028('0x13')](_0x7028('0x1f'))?this[_0x7028('0x13')]('allow')[_0x7028('0x14')](';'):null;},'comment':_0x7028('0x21')},'autoframing':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'insecure':{'type':Sequelize[_0x7028('0x6')],'defaultValue':_0x7028('0x22'),'set':function(_0x393827){this[_0x7028('0x10')]('insecure',_0x393827?_0x393827[_0x7028('0x12')](','):null);},'get':function(){return this[_0x7028('0x13')](_0x7028('0x23'))?this[_0x7028('0x13')](_0x7028('0x23'))[_0x7028('0x14')](','):null;},'comment':_0x7028('0x24')},'trustrpid':{'type':Sequelize[_0x7028('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no',_0x7028('0x25'))},'promiscredir':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'accountcode':{'type':Sequelize[_0x7028('0x26')](0xb)},'setvar':{'type':Sequelize[_0x7028('0x6')]},'callerid':{'type':Sequelize[_0x7028('0x6')],'defaultValue':_0x7028('0x27')},'amaflags':{'type':Sequelize[_0x7028('0x6')]},'callcounter':{'type':Sequelize[_0x7028('0x2')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x7028('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x7028('0x6')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no',_0x7028('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7028('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'mailbox':{'type':Sequelize[_0x7028('0x6')]},'session_timers':{'type':Sequelize['ENUM'](_0x7028('0x29'),_0x7028('0x2a'),_0x7028('0x2b'))},'session_expires':{'type':Sequelize[_0x7028('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7028('0x2')]('uac',_0x7028('0x2c')),'defaultValue':_0x7028('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7028('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7028('0x6')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7028('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x7028('0x6')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x7028('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7028('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7028('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no',_0x7028('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7028('0x6')]},'callbackextension':{'type':Sequelize[_0x7028('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x7028('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7028('0x6')]},'contactdeny':{'type':Sequelize[_0x7028('0x6')]},'contactacl':{'type':Sequelize[_0x7028('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x7028('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no')},'icesupport':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x7028('0x2')]('yes','no',_0x7028('0x2e'),_0x7028('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x7028('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7028('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7028('0x6')]},'dtlscafile':{'type':Sequelize[_0x7028('0x6')]},'dtlscapath':{'type':Sequelize[_0x7028('0x6')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7028('0x30'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7028('0x6')]},'usereqphone':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7028('0x6')]},'call_limit':{'type':Sequelize[_0x7028('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7028('0x1c'),'no')},'vmexten':{'type':Sequelize[_0x7028('0x6')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x7028('0x6')]},'parkinglot':{'type':Sequelize[_0x7028('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7028('0x6')],'defaultValue':_0x7028('0x31')},'canreinvite':{'type':Sequelize[_0x7028('0x2')](_0x7028('0x1c'),'no',_0x7028('0x19'),_0x7028('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x7028('0x6')]},'active':{'type':Sequelize[_0x7028('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xb804=['PROHIB','udp','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','setDataValue','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','\x22\x22\x20<>','refuse','uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN'];(function(_0x123876,_0x322dc8){var _0xefb957=function(_0x5582cc){while(--_0x5582cc){_0x123876['push'](_0x123876['shift']());}};_0xefb957(++_0x322dc8);}(_0xb804,0xe9));var _0x4b80=function(_0x5a38e2,_0x108596){_0x5a38e2=_0x5a38e2-0x0;var _0x17a552=_0xb804[_0x5a38e2];return _0x17a552;};'use strict';var Sequelize=require(_0x4b80('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b80('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x3'),_0x4b80('0x4'),_0x4b80('0x5')),'allowNull':![],'defaultValue':_0x4b80('0x3')},'context':{'type':Sequelize[_0x4b80('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x4b80('0x7'),_0x4b80('0x8'),_0x4b80('0x9'),_0x4b80('0xa'),'PROHIB_NOT_SCREENED',_0x4b80('0xb'),'PROHIB_FAILED_SCREEN',_0x4b80('0xc'))},'deny':{'type':Sequelize[_0x4b80('0x6')]},'permit':{'type':Sequelize[_0x4b80('0x6')]},'secret':{'type':Sequelize[_0x4b80('0x6')]},'md5secret':{'type':Sequelize[_0x4b80('0x6')]},'remotesecret':{'type':Sequelize[_0x4b80('0x6')]},'transport':{'type':Sequelize[_0x4b80('0x6')],'defaultValue':_0x4b80('0xd'),'set':function(_0xa51bba){this['setDataValue'](_0x4b80('0xe'),_0xa51bba?_0xa51bba[_0x4b80('0xf')](','):null);},'get':function(){return this[_0x4b80('0x10')](_0x4b80('0xe'))?this[_0x4b80('0x10')]('transport')[_0x4b80('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x12'),_0x4b80('0x13'),_0x4b80('0x14'),_0x4b80('0x15'),'auto'),'defaultValue':_0x4b80('0x12')},'directmedia':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no',_0x4b80('0x17'),'update',_0x4b80('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x4b80('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x4b80('0x19'),'set':function(_0x11e25e){this[_0x4b80('0x1a')](_0x4b80('0x1b'),_0x11e25e?_0x11e25e[_0x4b80('0xf')](','):null);},'get':function(){return this[_0x4b80('0x10')](_0x4b80('0x1b'))?this[_0x4b80('0x10')](_0x4b80('0x1b'))[_0x4b80('0x11')](','):null;},'comment':_0x4b80('0x1c')},'callgroup':{'type':Sequelize[_0x4b80('0x6')]},'namedcallgroup':{'type':Sequelize[_0x4b80('0x6')]},'pickupgroup':{'type':Sequelize[_0x4b80('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x4b80('0x6')]},'language':{'type':Sequelize[_0x4b80('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4b80('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4b80('0x6')],'defaultValue':_0x4b80('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b80('0x1e'),'set':function(_0x48e179){this[_0x4b80('0x1a')](_0x4b80('0x1f'),_0x48e179?_0x48e179[_0x4b80('0xf')](';'):_0x4b80('0x1e'));},'get':function(){return this[_0x4b80('0x10')](_0x4b80('0x1f'))?this['getDataValue'](_0x4b80('0x1f'))[_0x4b80('0x11')](';'):null;},'comment':_0x4b80('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x4b80('0x21'),'set':function(_0xba8676){this[_0x4b80('0x1a')]('insecure',_0xba8676?_0xba8676[_0x4b80('0xf')](','):null);},'get':function(){return this[_0x4b80('0x10')](_0x4b80('0x22'))?this[_0x4b80('0x10')]('insecure')[_0x4b80('0x11')](','):null;},'comment':_0x4b80('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4b80('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4b80('0x2')]('yes','no',_0x4b80('0x24'))},'promiscredir':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x4b80('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x4b80('0x25')](0xb)},'setvar':{'type':Sequelize[_0x4b80('0x6')]},'callerid':{'type':Sequelize[_0x4b80('0x6')],'defaultValue':_0x4b80('0x26')},'amaflags':{'type':Sequelize[_0x4b80('0x6')]},'callcounter':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no'),'defaultValue':_0x4b80('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x4b80('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x4b80('0x6')]},'template':{'type':Sequelize[_0x4b80('0x6')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4b80('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4b80('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4b80('0x2')]('accept',_0x4b80('0x27'),'originate')},'session_expires':{'type':Sequelize[_0x4b80('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x4b80('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x4b80('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4b80('0x6')]},'fromuser':{'type':Sequelize[_0x4b80('0x6')]},'port':{'type':Sequelize[_0x4b80('0x25')](0x5)},'qualify':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4b80('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x4b80('0x6')]},'defaultuser':{'type':Sequelize[_0x4b80('0x6')]},'rtptimeout':{'type':Sequelize[_0x4b80('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4b80('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4b80('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4b80('0x6')]},'callbackextension':{'type':Sequelize[_0x4b80('0x6')]},'timert1':{'type':Sequelize[_0x4b80('0x25')](0xb)},'timerb':{'type':Sequelize[_0x4b80('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4b80('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x4b80('0x6')]},'contactdeny':{'type':Sequelize[_0x4b80('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x4b80('0x6')]},'use_q850_reason':{'type':Sequelize[_0x4b80('0x6')]},'maxforwards':{'type':Sequelize[_0x4b80('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'force_avp':{'type':Sequelize[_0x4b80('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no',_0x4b80('0x29'),_0x4b80('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x4b80('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4b80('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x4b80('0x6')]},'dtlscipher':{'type':Sequelize[_0x4b80('0x6')]},'dtlscafile':{'type':Sequelize[_0x4b80('0x6')]},'dtlscapath':{'type':Sequelize[_0x4b80('0x6')]},'dtlssetup':{'type':Sequelize[_0x4b80('0x2')](_0x4b80('0x2b'),_0x4b80('0x2c'),_0x4b80('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4b80('0x6')]},'recordofffeature':{'type':Sequelize[_0x4b80('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x4b80('0x16'),'no')},'vmexten':{'type':Sequelize[_0x4b80('0x6')]},'mohinterpret':{'type':Sequelize[_0x4b80('0x6')]},'mohsuggest':{'type':Sequelize[_0x4b80('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4b80('0x2e')},'canreinvite':{'type':Sequelize[_0x4b80('0x2')]('yes','no',_0x4b80('0x17'),'update',_0x4b80('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4b80('0x6')]},'otherFields':{'type':Sequelize[_0x4b80('0x6')]},'active':{'type':Sequelize[_0x4b80('0x30')],'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 41126ba..ea1b20b 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x371e76,_0x2ad34d){var _0xec04d1=function(_0x10c368){while(--_0x10c368){_0x371e76['push'](_0x371e76['shift']());}};_0xec04d1(++_0x2ad34d);}(_0xa41a,0x6b));var _0xaa41=function(_0x4f1135,_0x42c2ac){_0x4f1135=_0x4f1135-0x0;var _0x179d52=_0xa41a[_0x4f1135];return _0x179d52;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file +var _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(_0x48b3fb,_0x4b07bf){var _0x458604=function(_0x5484a2){while(--_0x5484a2){_0x48b3fb['push'](_0x48b3fb['shift']());}};_0x458604(++_0x4b07bf);}(_0x9bde,0xe1));var _0xe9bd=function(_0x183706,_0x17e2ec){_0x183706=_0x183706-0x0;var _0x17f6ef=_0x9bde[_0x183706];return _0x17f6ef;};'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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0e3bd0f..c9a531b 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 _0x8264=['../../config/environment','exports','define','Trunk','tools_trunks','lodash','../../config/logger','moment','path'];(function(_0x4bb742,_0x244530){var _0x4a1912=function(_0x1d827b){while(--_0x1d827b){_0x4bb742['push'](_0x4bb742['shift']());}};_0x4a1912(++_0x244530);}(_0x8264,0x1f4));var _0x4826=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x8264[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0x4826('0x0'));var util=require('util');var logger=require(_0x4826('0x1'))('api');var moment=require(_0x4826('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4826('0x3'));var rimraf=require('rimraf');var config=require(_0x4826('0x4'));var attributes=require('./trunk.attributes');module[_0x4826('0x5')]=function(_0x190420,_0x9d7e73){return _0x190420[_0x4826('0x6')](_0x4826('0x7'),attributes,{'tableName':_0x4826('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c08=['./trunk.attributes','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3d3efa,_0x508794){var _0x4bb01a=function(_0x32379d){while(--_0x32379d){_0x3d3efa['push'](_0x3d3efa['shift']());}};_0x4bb01a(++_0x508794);}(_0x9c08,0x1af));var _0x89c0=function(_0x133d40,_0x270622){_0x133d40=_0x133d40-0x0;var _0x3a6e8d=_0x9c08[_0x133d40];return _0x3a6e8d;};'use strict';var _=require(_0x89c0('0x0'));var util=require(_0x89c0('0x1'));var logger=require(_0x89c0('0x2'))(_0x89c0('0x3'));var moment=require(_0x89c0('0x4'));var BPromise=require(_0x89c0('0x5'));var rp=require(_0x89c0('0x6'));var fs=require('fs');var path=require(_0x89c0('0x7'));var rimraf=require('rimraf');var config=require(_0x89c0('0x8'));var attributes=require(_0x89c0('0x9'));module['exports']=function(_0x32164f,_0x5ddab5){return _0x32164f['define']('Trunk',attributes,{'tableName':_0x89c0('0xa'),'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 45807a4..535db4e 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 _0x9f27=['message','info','catch','GetTrunk','findAll','options','raw','where','attributes','limit','map','include','model','Trunk','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b44ea,_0x17c90a){var _0x11c4ee=function(_0x5a3f3a){while(--_0x5a3f3a){_0x5b44ea['push'](_0x5b44ea['shift']());}};_0x11c4ee(++_0x17c90a);}(_0x9f27,0x1cc));var _0x79f2=function(_0x4863d9,_0x272d8f){_0x4863d9=_0x4863d9-0x0;var _0xa9e173=_0x9f27[_0x4863d9];return _0xa9e173;};'use strict';var _=require('lodash');var util=require(_0x79f2('0x0'));var moment=require(_0x79f2('0x1'));var BPromise=require(_0x79f2('0x2'));var rs=require(_0x79f2('0x3'));var fs=require('fs');var Redis=require(_0x79f2('0x4'));var db=require(_0x79f2('0x5'))['db'];var utils=require(_0x79f2('0x6'));var logger=require(_0x79f2('0x7'))(_0x79f2('0x8'));var config=require(_0x79f2('0x9'));var jayson=require(_0x79f2('0xa'));var client=jayson['client'][_0x79f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x299793,_0x3a779b,_0x47f925){return new BPromise(function(_0xf9f798,_0x4ca7e6){return client[_0x79f2('0xc')](_0x299793,_0x47f925)[_0x79f2('0xd')](function(_0x20f4ad){logger['info'](_0x79f2('0xe'),_0x3a779b,_0x79f2('0xf'));logger[_0x79f2('0x10')](_0x79f2('0x11'),_0x3a779b,_0x79f2('0xf'),JSON[_0x79f2('0x12')](_0x20f4ad));if(_0x20f4ad[_0x79f2('0x13')]){if(_0x20f4ad[_0x79f2('0x13')][_0x79f2('0x14')]===0x1f4){logger[_0x79f2('0x13')](_0x79f2('0xe'),_0x3a779b,_0x20f4ad[_0x79f2('0x13')][_0x79f2('0x15')]);return _0x4ca7e6(_0x20f4ad[_0x79f2('0x13')][_0x79f2('0x15')]);}logger[_0x79f2('0x13')](_0x79f2('0xe'),_0x3a779b,_0x20f4ad[_0x79f2('0x13')]['message']);return _0xf9f798(_0x20f4ad[_0x79f2('0x13')][_0x79f2('0x15')]);}else{logger[_0x79f2('0x16')](_0x79f2('0xe'),_0x3a779b,'request\x20sent');_0xf9f798(_0x20f4ad['result']['message']);}})[_0x79f2('0x17')](function(_0x2faeda){logger[_0x79f2('0x13')](_0x79f2('0xe'),_0x3a779b,_0x2faeda);_0x4ca7e6(_0x2faeda);});});}exports[_0x79f2('0x18')]=function(_0x264e74){var _0x2b535b=this;return new Promise(function(_0x53bd4e,_0x55d68e){return db['Trunk'][_0x79f2('0x19')]({'raw':_0x264e74[_0x79f2('0x1a')]?_0x264e74[_0x79f2('0x1a')][_0x79f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x264e74[_0x79f2('0x1a')]?_0x264e74['options'][_0x79f2('0x1c')]||null:null,'attributes':_0x264e74[_0x79f2('0x1a')]?_0x264e74[_0x79f2('0x1a')][_0x79f2('0x1d')]||null:null,'limit':_0x264e74[_0x79f2('0x1a')]?_0x264e74[_0x79f2('0x1a')][_0x79f2('0x1e')]||null:null,'include':_0x264e74[_0x79f2('0x1a')]?_0x264e74[_0x79f2('0x1a')]['include']?_[_0x79f2('0x1f')](_0x264e74['options'][_0x79f2('0x20')],function(_0x298229){return{'model':db[_0x298229[_0x79f2('0x21')]],'as':_0x298229['as'],'attributes':_0x298229[_0x79f2('0x1d')],'include':_0x298229[_0x79f2('0x20')]?_[_0x79f2('0x1f')](_0x298229[_0x79f2('0x20')],function(_0x362902){return{'model':db[_0x362902['model']],'as':_0x362902['as'],'attributes':_0x362902[_0x79f2('0x1d')],'include':_0x362902[_0x79f2('0x20')]?_[_0x79f2('0x1f')](_0x362902[_0x79f2('0x20')],function(_0x273656){return{'model':db[_0x273656['model']],'as':_0x273656['as'],'attributes':_0x273656[_0x79f2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x79f2('0xd')](function(_0x4b9a0c){logger[_0x79f2('0x16')](_0x79f2('0x18'),_0x264e74);logger['debug'](_0x79f2('0x18'),_0x264e74,JSON[_0x79f2('0x12')](_0x4b9a0c));_0x53bd4e(_0x4b9a0c);})[_0x79f2('0x17')](function(_0x1f52d9){logger[_0x79f2('0x13')](_0x79f2('0x18'),_0x1f52d9[_0x79f2('0x15')],_0x264e74);_0x55d68e(_0x2b535b[_0x79f2('0x13')](0x1f4,_0x1f52d9[_0x79f2('0x15')]));});});};exports['ShowTrunk']=function(_0x25fc68){var _0x172db9=this;return new Promise(function(_0x55057f,_0x3e8414){return db[_0x79f2('0x22')][_0x79f2('0x23')]({'raw':_0x25fc68[_0x79f2('0x1a')]?_0x25fc68['options'][_0x79f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x25fc68[_0x79f2('0x1a')]?_0x25fc68[_0x79f2('0x1a')][_0x79f2('0x1c')]||null:null,'attributes':_0x25fc68['options']?_0x25fc68[_0x79f2('0x1a')][_0x79f2('0x1d')]||null:null,'include':_0x25fc68[_0x79f2('0x1a')]?_0x25fc68['options']['include']?_[_0x79f2('0x1f')](_0x25fc68['options']['include'],function(_0x2dc1d0){return{'model':db[_0x2dc1d0['model']],'as':_0x2dc1d0['as'],'attributes':_0x2dc1d0[_0x79f2('0x1d')],'include':_0x2dc1d0[_0x79f2('0x20')]?_[_0x79f2('0x1f')](_0x2dc1d0['include'],function(_0x3cb8a1){return{'model':db[_0x3cb8a1[_0x79f2('0x21')]],'as':_0x3cb8a1['as'],'attributes':_0x3cb8a1[_0x79f2('0x1d')],'include':_0x3cb8a1['include']?_['map'](_0x3cb8a1[_0x79f2('0x20')],function(_0x1cd1c9){return{'model':db[_0x1cd1c9['model']],'as':_0x1cd1c9['as'],'attributes':_0x1cd1c9['attributes']};}):[]};}):[]};}):[]:[]})[_0x79f2('0xd')](function(_0x49de78){logger[_0x79f2('0x16')]('ShowTrunk',_0x25fc68);logger[_0x79f2('0x10')]('ShowTrunk',_0x25fc68,JSON['stringify'](_0x49de78));_0x55057f(_0x49de78);})[_0x79f2('0x17')](function(_0x2266af){logger[_0x79f2('0x13')](_0x79f2('0x24'),_0x2266af['message'],_0x25fc68);_0x3e8414(_0x172db9[_0x79f2('0x13')](0x1f4,_0x2266af[_0x79f2('0x15')]));});});}; \ No newline at end of file +var _0x9d56=['http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','Trunk','findAll','options','raw','limit','include','map','attributes','model','then','GetTrunk','catch','ShowTrunk','find','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x5cc3b6,_0x249e4f){var _0x3ea2e0=function(_0x8ab600){while(--_0x8ab600){_0x5cc3b6['push'](_0x5cc3b6['shift']());}};_0x3ea2e0(++_0x249e4f);}(_0x9d56,0x1a7));var _0x69d5=function(_0x28ae64,_0xe3313){_0x28ae64=_0x28ae64-0x0;var _0xcd3970=_0x9d56[_0x28ae64];return _0xcd3970;};'use strict';var _=require(_0x69d5('0x0'));var util=require('util');var moment=require(_0x69d5('0x1'));var BPromise=require(_0x69d5('0x2'));var rs=require(_0x69d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69d5('0x5'))(_0x69d5('0x6'));var config=require(_0x69d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69d5('0x8')][_0x69d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa51d59,_0x273763,_0x1fb01f){return new BPromise(function(_0x3787b9,_0x715a74){return client[_0x69d5('0xa')](_0xa51d59,_0x1fb01f)['then'](function(_0x315138){logger[_0x69d5('0xb')](_0x69d5('0xc'),_0x273763,_0x69d5('0xd'));logger[_0x69d5('0xe')](_0x69d5('0xf'),_0x273763,_0x69d5('0xd'),JSON[_0x69d5('0x10')](_0x315138));if(_0x315138['error']){if(_0x315138['error'][_0x69d5('0x11')]===0x1f4){logger['error'](_0x69d5('0xc'),_0x273763,_0x315138[_0x69d5('0x12')][_0x69d5('0x13')]);return _0x715a74(_0x315138[_0x69d5('0x12')][_0x69d5('0x13')]);}logger[_0x69d5('0x12')]('Trunk,\x20%s,\x20%s',_0x273763,_0x315138[_0x69d5('0x12')][_0x69d5('0x13')]);return _0x3787b9(_0x315138[_0x69d5('0x12')][_0x69d5('0x13')]);}else{logger[_0x69d5('0xb')]('Trunk,\x20%s,\x20%s',_0x273763,_0x69d5('0xd'));_0x3787b9(_0x315138[_0x69d5('0x14')][_0x69d5('0x13')]);}})['catch'](function(_0x5cdb9a){logger[_0x69d5('0x12')]('Trunk,\x20%s,\x20%s',_0x273763,_0x5cdb9a);_0x715a74(_0x5cdb9a);});});}exports['GetTrunk']=function(_0x439884){var _0x542258=this;return new Promise(function(_0xf85142,_0x2667a5){return db[_0x69d5('0x15')][_0x69d5('0x16')]({'raw':_0x439884[_0x69d5('0x17')]?_0x439884[_0x69d5('0x17')][_0x69d5('0x18')]===undefined?!![]:![]:!![],'where':_0x439884[_0x69d5('0x17')]?_0x439884[_0x69d5('0x17')]['where']||null:null,'attributes':_0x439884[_0x69d5('0x17')]?_0x439884[_0x69d5('0x17')]['attributes']||null:null,'limit':_0x439884[_0x69d5('0x17')]?_0x439884['options'][_0x69d5('0x19')]||null:null,'include':_0x439884[_0x69d5('0x17')]?_0x439884[_0x69d5('0x17')][_0x69d5('0x1a')]?_[_0x69d5('0x1b')](_0x439884['options'][_0x69d5('0x1a')],function(_0x393658){return{'model':db[_0x393658['model']],'as':_0x393658['as'],'attributes':_0x393658[_0x69d5('0x1c')],'include':_0x393658[_0x69d5('0x1a')]?_[_0x69d5('0x1b')](_0x393658[_0x69d5('0x1a')],function(_0xcc42dc){return{'model':db[_0xcc42dc['model']],'as':_0xcc42dc['as'],'attributes':_0xcc42dc[_0x69d5('0x1c')],'include':_0xcc42dc[_0x69d5('0x1a')]?_[_0x69d5('0x1b')](_0xcc42dc[_0x69d5('0x1a')],function(_0x19bdf9){return{'model':db[_0x19bdf9[_0x69d5('0x1d')]],'as':_0x19bdf9['as'],'attributes':_0x19bdf9[_0x69d5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x69d5('0x1e')](function(_0x286c5b){logger[_0x69d5('0xb')](_0x69d5('0x1f'),_0x439884);logger['debug'](_0x69d5('0x1f'),_0x439884,JSON[_0x69d5('0x10')](_0x286c5b));_0xf85142(_0x286c5b);})[_0x69d5('0x20')](function(_0x20b77a){logger[_0x69d5('0x12')](_0x69d5('0x1f'),_0x20b77a[_0x69d5('0x13')],_0x439884);_0x2667a5(_0x542258[_0x69d5('0x12')](0x1f4,_0x20b77a[_0x69d5('0x13')]));});});};exports[_0x69d5('0x21')]=function(_0x2b27d6){var _0x5bff5f=this;return new Promise(function(_0x19d50b,_0x5dc7f1){return db[_0x69d5('0x15')][_0x69d5('0x22')]({'raw':_0x2b27d6[_0x69d5('0x17')]?_0x2b27d6[_0x69d5('0x17')][_0x69d5('0x18')]===undefined?!![]:![]:!![],'where':_0x2b27d6[_0x69d5('0x17')]?_0x2b27d6[_0x69d5('0x17')][_0x69d5('0x23')]||null:null,'attributes':_0x2b27d6[_0x69d5('0x17')]?_0x2b27d6['options']['attributes']||null:null,'include':_0x2b27d6[_0x69d5('0x17')]?_0x2b27d6[_0x69d5('0x17')]['include']?_[_0x69d5('0x1b')](_0x2b27d6['options']['include'],function(_0x58a480){return{'model':db[_0x58a480[_0x69d5('0x1d')]],'as':_0x58a480['as'],'attributes':_0x58a480[_0x69d5('0x1c')],'include':_0x58a480['include']?_['map'](_0x58a480['include'],function(_0x4dd6c1){return{'model':db[_0x4dd6c1[_0x69d5('0x1d')]],'as':_0x4dd6c1['as'],'attributes':_0x4dd6c1[_0x69d5('0x1c')],'include':_0x4dd6c1['include']?_[_0x69d5('0x1b')](_0x4dd6c1[_0x69d5('0x1a')],function(_0x5cfcb8){return{'model':db[_0x5cfcb8[_0x69d5('0x1d')]],'as':_0x5cfcb8['as'],'attributes':_0x5cfcb8[_0x69d5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x69d5('0x1e')](function(_0x33889d){logger['info'](_0x69d5('0x21'),_0x2b27d6);logger[_0x69d5('0xe')](_0x69d5('0x21'),_0x2b27d6,JSON[_0x69d5('0x10')](_0x33889d));_0x19d50b(_0x33889d);})[_0x69d5('0x20')](function(_0x386fa8){logger[_0x69d5('0x12')](_0x69d5('0x21'),_0x386fa8[_0x69d5('0x13')],_0x2b27d6);_0x5dc7f1(_0x5bff5f[_0x69d5('0x12')](0x1f4,_0x386fa8[_0x69d5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b1f0d54..de4bf6c 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 _0x4dcf=['exports','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x340fdf,_0x48ad2b){var _0x1a04c2=function(_0x5bcc8e){while(--_0x5bcc8e){_0x340fdf['push'](_0x340fdf['shift']());}};_0x1a04c2(++_0x48ad2b);}(_0x4dcf,0x104));var _0xf4dc=function(_0x54904e,_0x449917){_0x54904e=_0x54904e-0x0;var _0x3917fe=_0x4dcf[_0x54904e];return _0x3917fe;};'use strict';var express=require('express');var router=express[_0xf4dc('0x0')]();var auth=require(_0xf4dc('0x1'));var controller=require(_0xf4dc('0x2'));router['put'](_0xf4dc('0x3'),auth[_0xf4dc('0x4')](),controller[_0xf4dc('0x5')]);module[_0xf4dc('0x6')]=router; \ No newline at end of file +var _0x670a=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','exports','express'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0x670a,0x9f));var _0xa670=function(_0x2388e0,_0x2e7eb0){_0x2388e0=_0x2388e0-0x0;var _0x2e7d29=_0x670a[_0x2388e0];return _0x2e7d29;};'use strict';var express=require(_0xa670('0x0'));var router=express[_0xa670('0x1')]();var auth=require(_0xa670('0x2'));var controller=require(_0xa670('0x3'));router[_0xa670('0x4')](_0xa670('0x5'),auth[_0xa670('0x6')](),controller['update']);module[_0xa670('0x7')]=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 de1f413..35b83ff 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 _0xebd7=['INTEGER','UserId','sequelize','error','info','debug','ENUM','BOOLEAN','TEXT','DATE'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xebd7,0x1b0));var _0x7ebd=function(_0x122aca,_0x288533){_0x122aca=_0x122aca-0x0;var _0x39b5d9=_0xebd7[_0x122aca];return _0x39b5d9;};'use strict';var Sequelize=require(_0x7ebd('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x7ebd('0x1'),'warning',_0x7ebd('0x2'),_0x7ebd('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x7ebd('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7ebd('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7ebd('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7ebd('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7ebd('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7ebd('0x8')],'unique':_0x7ebd('0x9')}}; \ No newline at end of file +var _0x4d03=['sequelize','warning','debug','exports','ENUM','error','TEXT','DATE','INTEGER','UserId'];(function(_0x366fa4,_0x30e2c2){var _0x413050=function(_0x280aef){while(--_0x280aef){_0x366fa4['push'](_0x366fa4['shift']());}};_0x413050(++_0x30e2c2);}(_0x4d03,0xe6));var _0x34d0=function(_0x29d1ad,_0x5ea6bc){_0x29d1ad=_0x29d1ad-0x0;var _0x233263=_0x4d03[_0x29d1ad];return _0x233263;};'use strict';var Sequelize=require(_0x34d0('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x34d0('0x1'),'info',_0x34d0('0x2')];module[_0x34d0('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x34d0('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x34d0('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x34d0('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x34d0('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x34d0('0x8')],'unique':_0x34d0('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index dc1ef32..0e50c85 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 _0x6364=['role','admin','Unauthorized','params','UserSetting','find','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','then','sendStatus','error','stack','name','send','update'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x6364,0x8f));var _0x4636=function(_0x569b81,_0xc69c09){_0x569b81=_0x569b81-0x0;var _0x3bd644=_0x6364[_0x569b81];return _0x3bd644;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x4636('0x0'))(_0x4636('0x1'));var config=require(_0x4636('0x2'));var db=require(_0x4636('0x3'))['db'];var socket=require(_0x4636('0x4'))(new Redis(config[_0x4636('0x5')]));require(_0x4636('0x6'))[_0x4636('0x7')](socket);config['redis']=_[_0x4636('0x8')](config[_0x4636('0x5')],{'host':_0x4636('0x9'),'port':0x18eb});function respondWithResult(_0x185ea0,_0x17456d){_0x17456d=_0x17456d||0xc8;return function(_0x4e662e){if(_0x4e662e){return _0x185ea0[_0x4636('0xa')](_0x17456d)[_0x4636('0xb')](_0x4e662e);}};}function saveUpdates(_0x122d94){return function(_0x3e3f80){if(_0x3e3f80){return _0x3e3f80['update'](_0x122d94)[_0x4636('0xc')](function(_0x4747ac){return _0x4747ac;});}return null;};}function handleEntityNotFound(_0x31a3d2){return function(_0x348709){if(!_0x348709){_0x31a3d2[_0x4636('0xd')](0x194);}return _0x348709;};}function handleError(_0x48daa0,_0xcdf2bc){_0xcdf2bc=_0xcdf2bc||0x1f4;return function(_0x135761){logger[_0x4636('0xe')](_0x135761[_0x4636('0xf')]);if(_0x135761['name']){delete _0x135761[_0x4636('0x10')];}_0x48daa0[_0x4636('0xa')](_0xcdf2bc)[_0x4636('0x11')](_0x135761);};}exports[_0x4636('0x12')]=function(_0x16e836,_0x4e478d){if(_0x16e836['user'][_0x4636('0x13')]!==_0x4636('0x14'))throw new Error(_0x4636('0x15'));if(isNaN(Number(_0x16e836[_0x4636('0x16')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x4636('0x17')][_0x4636('0x18')]({'where':{'id':_0x16e836[_0x4636('0x16')]['id']}})[_0x4636('0xc')](handleEntityNotFound(_0x4e478d,null))[_0x4636('0xc')](saveUpdates(_0x16e836[_0x4636('0x19')],null))['then'](respondWithResult(_0x4e478d,null))[_0x4636('0x1a')](handleError(_0x4e478d,null));}; \ No newline at end of file +var _0xaf93=['catch','lodash','ioredis','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status','sendStatus','error','stack','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xaf93,0x151));var _0x3af9=function(_0x36bc1c,_0x384a24){_0x36bc1c=_0x36bc1c-0x0;var _0x59376a=_0xaf93[_0x36bc1c];return _0x59376a;};'use strict';var _=require(_0x3af9('0x0'));var Redis=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x3af9('0x2'));var db=require(_0x3af9('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x3af9('0x4')]));require(_0x3af9('0x5'))[_0x3af9('0x6')](socket);config[_0x3af9('0x4')]=_[_0x3af9('0x7')](config[_0x3af9('0x4')],{'host':_0x3af9('0x8'),'port':0x18eb});function respondWithResult(_0x535583,_0x2ac1a2){_0x2ac1a2=_0x2ac1a2||0xc8;return function(_0x56e4c2){if(_0x56e4c2){return _0x535583[_0x3af9('0x9')](_0x2ac1a2)['json'](_0x56e4c2);}};}function saveUpdates(_0x5325b1){return function(_0x43ca48){if(_0x43ca48){return _0x43ca48['update'](_0x5325b1)['then'](function(_0x1313eb){return _0x1313eb;});}return null;};}function handleEntityNotFound(_0x431798){return function(_0x42b89a){if(!_0x42b89a){_0x431798[_0x3af9('0xa')](0x194);}return _0x42b89a;};}function handleError(_0x507254,_0x4392b9){_0x4392b9=_0x4392b9||0x1f4;return function(_0x412af3){logger[_0x3af9('0xb')](_0x412af3[_0x3af9('0xc')]);if(_0x412af3[_0x3af9('0xd')]){delete _0x412af3[_0x3af9('0xd')];}_0x507254[_0x3af9('0x9')](_0x4392b9)[_0x3af9('0xe')](_0x412af3);};}exports['update']=function(_0x3b4d2f,_0x5477a7){if(_0x3b4d2f[_0x3af9('0xf')][_0x3af9('0x10')]!==_0x3af9('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x3b4d2f[_0x3af9('0x12')]['id'])))throw new Error(_0x3af9('0x13'));return db[_0x3af9('0x14')]['find']({'where':{'id':_0x3b4d2f[_0x3af9('0x12')]['id']}})[_0x3af9('0x15')](handleEntityNotFound(_0x5477a7,null))[_0x3af9('0x15')](saveUpdates(_0x3b4d2f[_0x3af9('0x16')],null))['then'](respondWithResult(_0x5477a7,null))[_0x3af9('0x17')](handleError(_0x5477a7,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 a4be5b1..3726928 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 _0x20e0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x50b5fe,_0x3fd36a){var _0x1ffb34=function(_0x52d663){while(--_0x52d663){_0x50b5fe['push'](_0x50b5fe['shift']());}};_0x1ffb34(++_0x3fd36a);}(_0x20e0,0x10d));var _0x020e=function(_0x3aa349,_0xe74521){_0x3aa349=_0x3aa349-0x0;var _0x2a355d=_0x20e0[_0x3aa349];return _0x2a355d;};'use strict';var EventEmitter=require(_0x020e('0x0'));var UserSetting=require(_0x020e('0x1'))['db'][_0x020e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x020e('0x3')](0x0);var events={'afterCreate':_0x020e('0x4'),'afterUpdate':_0x020e('0x5'),'afterDestroy':_0x020e('0x6')};function emitEvent(_0x16c0fa){return function(_0x2cef32,_0x2b5766,_0x5acc77){UserSettingEvents[_0x020e('0x7')](_0x16c0fa+':'+_0x2cef32['id'],_0x2cef32);UserSettingEvents[_0x020e('0x7')](_0x16c0fa,_0x2cef32);_0x5acc77(null);};}for(var e in events){if(events[_0x020e('0x8')](e)){var event=events[e];UserSetting[_0x020e('0x9')](e,emitEvent(event));}}module[_0x020e('0xa')]=UserSettingEvents; \ No newline at end of file +var _0xd0dd=['emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xd0dd,0xf6));var _0xdd0d=function(_0x308765,_0x1fd30d){_0x308765=_0x308765-0x0;var _0x36a32a=_0xd0dd[_0x308765];return _0x36a32a;};'use strict';var EventEmitter=require(_0xdd0d('0x0'));var UserSetting=require(_0xdd0d('0x1'))['db'][_0xdd0d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xdd0d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd0d('0x4'),'afterDestroy':_0xdd0d('0x5')};function emitEvent(_0x2d8f12){return function(_0x40b953,_0x219b84,_0x196a74){UserSettingEvents[_0xdd0d('0x6')](_0x2d8f12+':'+_0x40b953['id'],_0x40b953);UserSettingEvents[_0xdd0d('0x6')](_0x2d8f12,_0x40b953);_0x196a74(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xdd0d('0x7')](e,emitEvent(event));}}module[_0xdd0d('0x8')]=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 0a7935d..ecf5789 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 _0x9b87=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings'];(function(_0x371516,_0x2d0368){var _0x50ef96=function(_0x26431c){while(--_0x26431c){_0x371516['push'](_0x371516['shift']());}};_0x50ef96(++_0x2d0368);}(_0x9b87,0x8e));var _0x79b8=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x9b87[_0x1aec28];return _0x2398c7;};'use strict';var attributes=require(_0x79b8('0x0'));module[_0x79b8('0x1')]=function(_0x20fb46){return _0x20fb46[_0x79b8('0x2')](_0x79b8('0x3'),attributes,{'tableName':_0x79b8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23b645){if(!_0x23b645[_0x79b8('0x5')])_0x23b645[_0x79b8('0x6')]=null;else if(_0x23b645[_0x79b8('0x6')]===null)_0x23b645[_0x79b8('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xaf1d=['exports','define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x351d29,_0x17ee04){_0x351d29=_0x351d29-0x0;var _0x451ab8=_0xaf1d[_0x351d29];return _0x451ab8;};'use strict';var attributes=require(_0xdaf1('0x0'));module[_0xdaf1('0x1')]=function(_0x39b0cb){return _0x39b0cb[_0xdaf1('0x2')]('UserSetting',attributes,{'tableName':_0xdaf1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x258708){if(!_0x258708['clientSideLoggingEnabled'])_0x258708[_0xdaf1('0x4')]=null;else if(_0x258708[_0xdaf1('0x4')]===null)_0x258708[_0xdaf1('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 518bbc4..c106758 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 _0xec2c=['emit','user-setting:update','user-setting:update:user-','UserId','remove','update'];(function(_0x3333bd,_0x28395c){var _0x441663=function(_0x3c9f72){while(--_0x3c9f72){_0x3333bd['push'](_0x3333bd['shift']());}};_0x441663(++_0x28395c);}(_0xec2c,0xa0));var _0xcec2=function(_0x56ba58,_0x1697c4){_0x56ba58=_0x56ba58-0x0;var _0x337772=_0xec2c[_0x56ba58];return _0x337772;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xcec2('0x0'),_0xcec2('0x1')];function createListener(_0x416a6b,_0x3b353){return function(_0x25dfdd){_0x3b353[_0xcec2('0x2')](_0x416a6b,_0x25dfdd);if(_0x416a6b===_0xcec2('0x3')){_0x3b353[_0xcec2('0x2')](_0xcec2('0x4')+_0x25dfdd[_0xcec2('0x5')],_0x25dfdd);}};}exports['register']=function(_0x167c9a){for(var _0x2b3fef=0x0,_0x47348f=events['length'];_0x2b3fef<_0x47348f;_0x2b3fef++){var _0x101b40=events[_0x2b3fef];var _0x31bfad=createListener('user-setting:'+_0x101b40,_0x167c9a);UserSettingEvents['on'](_0x101b40,_0x31bfad);}}; \ No newline at end of file +var _0x767e=['user-setting:update','register','length','user-setting:','./user-setting.events','save','update','emit'];(function(_0x95623e,_0x2b7766){var _0x227c37=function(_0x4c2db3){while(--_0x4c2db3){_0x95623e['push'](_0x95623e['shift']());}};_0x227c37(++_0x2b7766);}(_0x767e,0x9c));var _0xe767=function(_0x1b6262,_0x1088bc){_0x1b6262=_0x1b6262-0x0;var _0x27b5a7=_0x767e[_0x1b6262];return _0x27b5a7;};'use strict';var UserSettingEvents=require(_0xe767('0x0'));var events=[_0xe767('0x1'),'remove',_0xe767('0x2')];function createListener(_0x4d70a2,_0x4edb68){return function(_0x246e7c){_0x4edb68[_0xe767('0x3')](_0x4d70a2,_0x246e7c);if(_0x4d70a2===_0xe767('0x4')){_0x4edb68[_0xe767('0x3')]('user-setting:update:user-'+_0x246e7c['UserId'],_0x246e7c);}};}exports[_0xe767('0x5')]=function(_0x28228e){for(var _0x9bd819=0x0,_0x2d34c1=events[_0xe767('0x6')];_0x9bd819<_0x2d34c1;_0x9bd819++){var _0x15c151=events[_0x9bd819];var _0x314949=createListener(_0xe767('0x7')+_0x15c151,_0x28228e);UserSettingEvents['on'](_0x15c151,_0x314949);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f328790..4cd9daf 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 _0xa838=['getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','%s-%s','now','/:id/avatar','single','file','addAvatar','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0xa838,0x123));var _0x8a83=function(_0x84b6b5,_0x47cace){_0x84b6b5=_0x84b6b5-0x0;var _0x349b4f=_0xa838[_0x84b6b5];return _0x349b4f;};'use strict';var multer=require(_0x8a83('0x0'));var util=require(_0x8a83('0x1'));var path=require(_0x8a83('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a83('0x3'));var router=express[_0x8a83('0x4')]();var fs_extra=require(_0x8a83('0x5'));var auth=require(_0x8a83('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a83('0x7'));var controller=require(_0x8a83('0x8'));router[_0x8a83('0x9')]('/',auth[_0x8a83('0xa')](),controller[_0x8a83('0xb')]);router[_0x8a83('0x9')](_0x8a83('0xc'),auth[_0x8a83('0xa')](),controller[_0x8a83('0xd')]);router[_0x8a83('0x9')]('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0x8a83('0x9')](_0x8a83('0xe'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0x8a83('0xf'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x10')]);router[_0x8a83('0x9')]('/:id/avatar',controller[_0x8a83('0x11')]);router[_0x8a83('0x9')](_0x8a83('0x12'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x13')]);router[_0x8a83('0x9')](_0x8a83('0x14'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x15')]);router[_0x8a83('0x9')](_0x8a83('0x16'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x17')]);router[_0x8a83('0x9')](_0x8a83('0x18'),auth[_0x8a83('0xa')](),controller['getVoiceQueuesRt']);router[_0x8a83('0x9')]('/:id/groups',auth[_0x8a83('0xa')](),controller[_0x8a83('0x19')]);router[_0x8a83('0x9')](_0x8a83('0x1a'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x1b')]);router['get']('/:id/screen_recordings',auth[_0x8a83('0xa')](),controller[_0x8a83('0x1c')]);router[_0x8a83('0x9')]('/:id/chat/interactions',auth[_0x8a83('0xa')](),controller['getChatInteractions']);router[_0x8a83('0x9')](_0x8a83('0x1d'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x8a83('0x9')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x8a83('0x1e')]);router[_0x8a83('0x9')](_0x8a83('0x1f'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x20')]);router[_0x8a83('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x8a83('0x9')]('/:id/whatsapp/interactions',auth[_0x8a83('0xa')](),controller[_0x8a83('0x21')]);router[_0x8a83('0x9')](_0x8a83('0x22'),auth['isAuthenticated'](),controller[_0x8a83('0x23')]);router[_0x8a83('0x9')](_0x8a83('0x24'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x25')]);router[_0x8a83('0x9')](_0x8a83('0x26'),auth['isAuthenticated'](),controller[_0x8a83('0x27')]);router['get'](_0x8a83('0x28'),auth['isAuthenticated'](),controller[_0x8a83('0x29')]);router[_0x8a83('0x9')]('/:id/fax_accounts',auth[_0x8a83('0xa')](),controller['getFaxAccounts']);router[_0x8a83('0x9')](_0x8a83('0x2a'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x2b')]);router[_0x8a83('0x9')](_0x8a83('0x2c'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x2d')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router['get'](_0x8a83('0x2e'),auth['isAuthenticated'](),controller[_0x8a83('0x2f')]);router[_0x8a83('0x9')](_0x8a83('0x30'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x31')]);router[_0x8a83('0x9')]('/:id/square_projects',auth[_0x8a83('0xa')](),controller[_0x8a83('0x32')]);router[_0x8a83('0x9')](_0x8a83('0x33'),auth[_0x8a83('0xa')](),controller['getScheduledCalls']);router[_0x8a83('0x9')](_0x8a83('0x34'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x35')]);router['post'](_0x8a83('0x14'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x36')]);router[_0x8a83('0x37')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a83('0x37')](_0x8a83('0x38'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x39')]);router[_0x8a83('0x37')]('/:id/queues',auth[_0x8a83('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x8a83('0x3a')]({'destination':function(_0x41a6b0,_0x56bb80,_0x533f70){_0x533f70(null,path['join'](config[_0x8a83('0x3b')],_0x8a83('0x3c')));},'filename':function(_0x18082d,_0x27c07b,_0x3b08b0){_0x3b08b0(null,util[_0x8a83('0x3d')](_0x8a83('0x3e'),Date[_0x8a83('0x3f')](),_0x27c07b['originalname']));}})});router[_0x8a83('0x37')](_0x8a83('0x40'),upload[_0x8a83('0x41')](_0x8a83('0x42')),controller[_0x8a83('0x43')]);router[_0x8a83('0x37')]('/:id/login',auth[_0x8a83('0xa')](),controller['login']);router[_0x8a83('0x37')](_0x8a83('0x44'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x45')]);router[_0x8a83('0x37')]('/:id/pause',auth[_0x8a83('0xa')](),controller[_0x8a83('0x46')]);router[_0x8a83('0x37')](_0x8a83('0x47'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x48')]);router[_0x8a83('0x37')]('/:id/teams',auth[_0x8a83('0xa')](),controller['addTeams']);router['post'](_0x8a83('0x49'),auth['isAuthenticated'](),controller[_0x8a83('0x4a')]);router['post'](_0x8a83('0x4b'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x4c')]);router[_0x8a83('0x37')](_0x8a83('0x4d'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x4e')]);router['post'](_0x8a83('0x4f'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x50')]);router[_0x8a83('0x37')](_0x8a83('0x51'),auth[_0x8a83('0xa')](),controller['addOpenchannelInteractions']);router[_0x8a83('0x37')](_0x8a83('0x52'),auth['isAuthenticated'](),controller[_0x8a83('0x53')]);router[_0x8a83('0x37')](_0x8a83('0x54'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x8a83('0x37')](_0x8a83('0x2a'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x55')]);router['post'](_0x8a83('0x2c'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x56')]);router[_0x8a83('0x37')](_0x8a83('0x57'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x58')]);router[_0x8a83('0x37')](_0x8a83('0x2e'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x59')]);router[_0x8a83('0x37')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x8a83('0x5a')]);router[_0x8a83('0x37')](_0x8a83('0x5b'),auth[_0x8a83('0xa')](),controller['addSquareProjects']);router['post'](_0x8a83('0x34'),auth['isAuthenticated'](),controller[_0x8a83('0x5c')]);router['put'](_0x8a83('0xf'),auth[_0x8a83('0xa')](),controller['update']);router[_0x8a83('0x5d')](_0x8a83('0x5e'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x5f')]);router[_0x8a83('0x60')](_0x8a83('0x16'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x61')]);router[_0x8a83('0x60')](_0x8a83('0x22'),auth[_0x8a83('0xa')](),controller['removeTeams']);router[_0x8a83('0x60')](_0x8a83('0xf'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x62')]);router[_0x8a83('0x60')]('/:id/chat_interactions',auth[_0x8a83('0xa')](),controller[_0x8a83('0x63')]);router['delete']('/:id/mail_interactions',auth[_0x8a83('0xa')](),controller['removeMailInteractions']);router[_0x8a83('0x60')](_0x8a83('0x4d'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x64')]);router[_0x8a83('0x60')](_0x8a83('0x4f'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x65')]);router[_0x8a83('0x60')]('/:id/openchannel_interactions',auth[_0x8a83('0xa')](),controller[_0x8a83('0x66')]);router[_0x8a83('0x60')](_0x8a83('0x52'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x67')]);router[_0x8a83('0x60')](_0x8a83('0x54'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x68')]);router[_0x8a83('0x60')](_0x8a83('0x2a'),auth[_0x8a83('0xa')](),controller['removeMailAccounts']);router[_0x8a83('0x60')]('/:id/openchannel_accounts',auth[_0x8a83('0xa')](),controller['removeOpenchannelAccounts']);router[_0x8a83('0x60')](_0x8a83('0x57'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x69')]);router[_0x8a83('0x60')](_0x8a83('0x2e'),auth[_0x8a83('0xa')](),controller[_0x8a83('0x6a')]);router[_0x8a83('0x60')](_0x8a83('0x30'),auth['isAuthenticated'](),controller[_0x8a83('0x6b')]);router[_0x8a83('0x60')]('/:id/square_projects',auth[_0x8a83('0xa')](),controller[_0x8a83('0x6c')]);router[_0x8a83('0x60')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x8a83('0x6d')]);module['exports']=router; \ No newline at end of file +var _0x3847=['addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts'];(function(_0x5991e9,_0x1a9fb6){var _0x5088b1=function(_0x298b4e){while(--_0x298b4e){_0x5991e9['push'](_0x5991e9['shift']());}};_0x5088b1(++_0x1a9fb6);}(_0x3847,0x109));var _0x7384=function(_0x1828ea,_0x55813e){_0x1828ea=_0x1828ea-0x0;var _0xad893f=_0x3847[_0x1828ea];return _0xad893f;};'use strict';var multer=require('multer');var util=require(_0x7384('0x0'));var path=require('path');var timeout=require(_0x7384('0x1'));var express=require(_0x7384('0x2'));var router=express['Router']();var fs_extra=require(_0x7384('0x3'));var auth=require(_0x7384('0x4'));var interaction=require(_0x7384('0x5'));var config=require(_0x7384('0x6'));var controller=require(_0x7384('0x7'));router[_0x7384('0x8')]('/',auth[_0x7384('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7384('0xa')]);router[_0x7384('0x8')](_0x7384('0xb'),auth[_0x7384('0x9')](),controller[_0x7384('0xc')]);router['get'](_0x7384('0xd'),auth[_0x7384('0x9')](),controller[_0x7384('0xe')]);router['get'](_0x7384('0xf'),auth['isAuthenticated'](),controller[_0x7384('0x10')]);router[_0x7384('0x8')](_0x7384('0x11'),controller[_0x7384('0x12')]);router[_0x7384('0x8')]('/:id/open_tabs',auth[_0x7384('0x9')](),controller['getOpenTabs']);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x7384('0x13')]);router[_0x7384('0x8')](_0x7384('0x14'),auth[_0x7384('0x9')](),controller[_0x7384('0x15')]);router[_0x7384('0x8')](_0x7384('0x16'),auth[_0x7384('0x9')](),controller[_0x7384('0x17')]);router[_0x7384('0x8')]('/:id/groups',auth[_0x7384('0x9')](),controller['getGroups']);router[_0x7384('0x8')](_0x7384('0x18'),auth[_0x7384('0x9')](),controller[_0x7384('0x19')]);router['get'](_0x7384('0x1a'),auth[_0x7384('0x9')](),controller[_0x7384('0x1b')]);router[_0x7384('0x8')](_0x7384('0x1c'),auth[_0x7384('0x9')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth[_0x7384('0x9')](),controller[_0x7384('0x1d')]);router['get']('/:id/mail/interactions',auth[_0x7384('0x9')](),controller[_0x7384('0x1e')]);router[_0x7384('0x8')](_0x7384('0x1f'),auth[_0x7384('0x9')](),controller['getSmsInteractions']);router[_0x7384('0x8')](_0x7384('0x20'),auth[_0x7384('0x9')](),controller[_0x7384('0x21')]);router[_0x7384('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x7384('0x22')]);router['get'](_0x7384('0x23'),auth[_0x7384('0x9')](),controller['getTeams']);router[_0x7384('0x8')](_0x7384('0x24'),auth[_0x7384('0x9')](),controller[_0x7384('0x25')]);router[_0x7384('0x8')](_0x7384('0x26'),auth[_0x7384('0x9')](),controller[_0x7384('0x27')]);router[_0x7384('0x8')](_0x7384('0x28'),auth['isAuthenticated'](),controller[_0x7384('0x29')]);router[_0x7384('0x8')](_0x7384('0x2a'),auth['isAuthenticated'](),controller[_0x7384('0x2b')]);router[_0x7384('0x8')](_0x7384('0x2c'),auth[_0x7384('0x9')](),controller[_0x7384('0x2d')]);router[_0x7384('0x8')](_0x7384('0x2e'),auth['isAuthenticated'](),controller[_0x7384('0x2f')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x7384('0x30')]);router['get'](_0x7384('0x31'),auth[_0x7384('0x9')](),controller[_0x7384('0x32')]);router['get'](_0x7384('0x33'),auth['isAuthenticated'](),controller[_0x7384('0x34')]);router['get'](_0x7384('0x35'),auth['isAuthenticated'](),controller[_0x7384('0x36')]);router[_0x7384('0x8')](_0x7384('0x37'),auth[_0x7384('0x9')](),controller[_0x7384('0x38')]);router['get']('/:id/api_key',auth[_0x7384('0x9')](),controller[_0x7384('0x39')]);router[_0x7384('0x3a')](_0x7384('0x3b'),auth['isAuthenticated'](),controller[_0x7384('0x3c')]);router[_0x7384('0x3a')]('/',auth[_0x7384('0x9')](),controller[_0x7384('0x3d')]);router['post'](_0x7384('0x3e'),auth[_0x7384('0x9')](),controller[_0x7384('0x3f')]);router['post'](_0x7384('0x14'),auth[_0x7384('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7384('0x40')]({'destination':function(_0x7ce6f0,_0x3fa22c,_0x2aa97d){_0x2aa97d(null,path['join'](config[_0x7384('0x41')],_0x7384('0x42')));},'filename':function(_0x4f852d,_0x29ccc6,_0x3aea07){_0x3aea07(null,util[_0x7384('0x43')]('%s-%s',Date[_0x7384('0x44')](),_0x29ccc6['originalname']));}})});router['post'](_0x7384('0x11'),upload[_0x7384('0x45')](_0x7384('0x46')),controller[_0x7384('0x47')]);router[_0x7384('0x3a')](_0x7384('0x48'),auth[_0x7384('0x9')](),controller[_0x7384('0x49')]);router[_0x7384('0x3a')](_0x7384('0x4a'),auth[_0x7384('0x9')](),controller[_0x7384('0x4b')]);router[_0x7384('0x3a')](_0x7384('0x4c'),auth['isAuthenticated'](),controller[_0x7384('0x4d')]);router['post'](_0x7384('0x4e'),auth['isAuthenticated'](),controller[_0x7384('0x4f')]);router[_0x7384('0x3a')](_0x7384('0x23'),auth[_0x7384('0x9')](),controller[_0x7384('0x50')]);router['post'](_0x7384('0x51'),auth[_0x7384('0x9')](),controller[_0x7384('0x52')]);router[_0x7384('0x3a')](_0x7384('0x53'),auth['isAuthenticated'](),controller[_0x7384('0x54')]);router[_0x7384('0x3a')](_0x7384('0x55'),auth[_0x7384('0x9')](),controller[_0x7384('0x56')]);router[_0x7384('0x3a')](_0x7384('0x57'),auth['isAuthenticated'](),controller[_0x7384('0x58')]);router[_0x7384('0x3a')]('/:id/openchannel_interactions',auth[_0x7384('0x9')](),controller[_0x7384('0x59')]);router[_0x7384('0x3a')](_0x7384('0x5a'),auth[_0x7384('0x9')](),controller[_0x7384('0x5b')]);router[_0x7384('0x3a')]('/:id/fax_accounts',auth[_0x7384('0x9')](),controller[_0x7384('0x5c')]);router[_0x7384('0x3a')](_0x7384('0x2c'),auth[_0x7384('0x9')](),controller[_0x7384('0x5d')]);router[_0x7384('0x3a')](_0x7384('0x2e'),auth[_0x7384('0x9')](),controller['addOpenchannelAccounts']);router['post'](_0x7384('0x5e'),auth[_0x7384('0x9')](),controller[_0x7384('0x5f')]);router[_0x7384('0x3a')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7384('0x60')]);router[_0x7384('0x3a')]('/:id/whatsapp_accounts',auth[_0x7384('0x9')](),controller[_0x7384('0x61')]);router[_0x7384('0x3a')]('/:id/square_projects',auth[_0x7384('0x9')](),controller['addSquareProjects']);router[_0x7384('0x3a')](_0x7384('0x62'),auth['isAuthenticated'](),controller[_0x7384('0x63')]);router[_0x7384('0x64')](_0x7384('0xf'),auth[_0x7384('0x9')](),controller[_0x7384('0x65')]);router[_0x7384('0x64')](_0x7384('0x66'),auth[_0x7384('0x9')](),controller[_0x7384('0x67')]);router[_0x7384('0x68')](_0x7384('0x14'),auth[_0x7384('0x9')](),controller[_0x7384('0x69')]);router[_0x7384('0x68')]('/:id/teams',auth[_0x7384('0x9')](),controller[_0x7384('0x6a')]);router[_0x7384('0x68')]('/:id',auth['isAuthenticated'](),controller[_0x7384('0x6b')]);router['delete']('/:id/chat_interactions',auth[_0x7384('0x9')](),controller[_0x7384('0x6c')]);router[_0x7384('0x68')](_0x7384('0x53'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x7384('0x68')](_0x7384('0x55'),auth['isAuthenticated'](),controller[_0x7384('0x6d')]);router[_0x7384('0x68')](_0x7384('0x57'),auth[_0x7384('0x9')](),controller[_0x7384('0x6e')]);router[_0x7384('0x68')](_0x7384('0x6f'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0x7384('0x5a'),auth[_0x7384('0x9')](),controller[_0x7384('0x70')]);router[_0x7384('0x68')](_0x7384('0x2a'),auth[_0x7384('0x9')](),controller[_0x7384('0x71')]);router[_0x7384('0x68')](_0x7384('0x2c'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x7384('0x68')](_0x7384('0x2e'),auth[_0x7384('0x9')](),controller['removeOpenchannelAccounts']);router[_0x7384('0x68')](_0x7384('0x5e'),auth[_0x7384('0x9')](),controller[_0x7384('0x72')]);router[_0x7384('0x68')](_0x7384('0x31'),auth['isAuthenticated'](),controller[_0x7384('0x73')]);router[_0x7384('0x68')](_0x7384('0x33'),auth[_0x7384('0x9')](),controller[_0x7384('0x74')]);router[_0x7384('0x68')]('/:id/square_projects',auth[_0x7384('0x9')](),controller[_0x7384('0x75')]);router[_0x7384('0x68')](_0x7384('0x62'),auth[_0x7384('0x9')](),controller[_0x7384('0x76')]);module[_0x7384('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1d7eca7..02e9312 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(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 _0xe706=['admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM'];(function(_0x1922c5,_0x4e6689){var _0x4e7ec2=function(_0x23b1d9){while(--_0x23b1d9){_0x1922c5['push'](_0x1922c5['shift']());}};_0x4e7ec2(++_0x4e6689);}(_0xe706,0xa3));var _0x6e70=function(_0x33d239,_0x24bb87){_0x33d239=_0x33d239-0x0;var _0x6784c2=_0xe706[_0x33d239];return _0x6784c2;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6e70('0x18')]},'chatCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x1a')},'ipaddr':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1b'),'user',_0x6e70('0x1c')),'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1d')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1e'),_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),'PROHIB_PASSED_SCREEN',_0x6e70('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x24'),'set':function(_0x42b094){this['setDataValue'](_0x6e70('0x25'),_0x42b094?_0x42b094[_0x6e70('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x6e70('0x25'))?this[_0x6e70('0xd')](_0x6e70('0x25'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x28')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x29'),_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0x6e70('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no',_0x6e70('0x2e'),_0x6e70('0x2f'),_0x6e70('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x31'),'set':function(_0x2a5444){this[_0x6e70('0x6')](_0x6e70('0x32'),_0x2a5444?_0x2a5444['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6e70('0xd')](_0x6e70('0x32'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x33')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x34')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x35'),'set':function(_0x16fc7d){this['setDataValue'](_0x6e70('0x36'),_0x16fc7d?_0x16fc7d[_0x6e70('0x26')](';'):_0x6e70('0x35'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x36'))?this[_0x6e70('0xd')](_0x6e70('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'set':function(_0x83847b){this[_0x6e70('0x6')](_0x6e70('0x37'),_0x83847b?_0x83847b['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x37'))?this[_0x6e70('0xd')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x38')},'amaflags':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2d')},'busylevel':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3b'),_0x6e70('0x3c')),'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','fingerprint',_0x6e70('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','nonat',_0x6e70('0x2f'),_0x6e70('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6e70('0x18')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2f9be4){this[_0x6e70('0x6')](_0x6e70('0x42'),_0x2f9be4);var _0x41a861=this[_0x6e70('0x43')]({'plain':!![]});switch(_0x2f9be4){case 0x0:case 0x1:var _0x739946=_0x41a861[_0x6e70('0x25')]?_['isArray'](_0x41a861['transport'])?_0x41a861[_0x6e70('0x25')][_0x6e70('0x26')]():_0x41a861[_0x6e70('0x25')]:_0x6e70('0x24');if(_0x739946==='wss'){_0x739946='udp';}this[_0x6e70('0x6')](_0x6e70('0x25'),_0x739946);this['setDataValue']('encryption','no');this[_0x6e70('0x6')]('avpf',null);this[_0x6e70('0x6')](_0x6e70('0x44'),null);this[_0x6e70('0x6')](_0x6e70('0x45'),null);this[_0x6e70('0x6')](_0x6e70('0x46'),null);this[_0x6e70('0x6')](_0x6e70('0x47'),null);this['setDataValue'](_0x6e70('0x48'),null);this[_0x6e70('0x6')](_0x6e70('0x49'),null);this[_0x6e70('0x6')](_0x6e70('0x4a'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x6e70('0x25'),_0x6e70('0x4b'));this[_0x6e70('0x6')]('encryption','yes');this[_0x6e70('0x6')](_0x6e70('0x4c'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x44'),_0x6e70('0x2d'));this['setDataValue'](_0x6e70('0x45'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x46'),'yes');this[_0x6e70('0x6')]('dtlsverify','no');this['setDataValue'](_0x6e70('0x48'),_0x6e70('0x40'));this[_0x6e70('0x6')](_0x6e70('0x49'),_0x41a861[_0x6e70('0x49')]||_0x6e70('0x4d'));this['setDataValue'](_0x6e70('0x4a'),_0x41a861[_0x6e70('0x4a')]||_0x6e70('0x4e'));this[_0x6e70('0x6')](_0x6e70('0x4f'),_0x6e70('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x50')],'set':function(_0xd9b4a9){this[_0x6e70('0x6')](_0x6e70('0x51'),_0xd9b4a9?_0xd9b4a9['join'](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x51'))?_[_0x6e70('0x52')](this['getDataValue']('permissions')[_0x6e70('0x27')](','),function(_0x18ecf0){return parseInt(_0x18ecf0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x53')],'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x54'))?this[_0x6e70('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x576069){if(typeof _0x576069===_0x6e70('0x55')){var _0x21e4c2=_0x576069==='1'?!![]:_0x576069==='0'?![]:_0x576069===_0x6e70('0x56')?!![]:_0x576069==='false'?![]:![];this['setDataValue']('screenrecording',_0x21e4c2);}else{this[_0x6e70('0x6')]('screenrecording',_0x576069);}}},'blocked':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![],'set':function(_0x34237d){this[_0x6e70('0x6')](_0x6e70('0x57'),_0x34237d);if(_0x34237d===!![]){this[_0x6e70('0x6')](_0x6e70('0x58'),moment());this[_0x6e70('0x6')]('loginAttempts',0x0);}else{this[_0x6e70('0x6')](_0x6e70('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6e70('0x19')](0x5)[_0x6e70('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'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 89d59ab..ff14225 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 _0xa7f6=['getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','intrf','user:forcelogout','headers','connection','remoteAddress','socket','UserVoiceQueue.penalty','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','faxPause','openchannelPause','smsPause','pauseType','manual','mail','%s%s','Pause','Team','addTeams','getVoiceQueues','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','Voice','penalty','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getWhatsappQueues','getDataValue','getLists','CmList','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$lt','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','CmHopper','firstName','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','teams','queues','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','charAt','slice','SELECT','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','json','undefined','limit','count','offset','status','set','destroy','get','Users','Agents','agent','Telephones','telephone','ignore','map','value','includes','role','find','name','UserProfileResource','stack','send','User','rawAttributes','fieldName','type','key','password','salt','query','userSetting','true','include','push','findAll','rows','chat','dataValues','sms','fax','openchannel','whatsapp','model','differenceBy','keys','filters','intersection','fields','attributes','length','includeAll','UserSetting','merge','options','openTabs','all','update','body','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','fullname','email','permissions','102','103','110','104','106','107','108','109','114','create','user','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','each','isEmpty','autoAssociation','compact','params','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','capitalize','toLowerCase','Queues','spread','QueueId','emit','voice','VoiceQueue','format','SIP/%s','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','filename','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','CmContact','sort','where','pick','filter','List','Tag','tag','nolimit','getQueues','order','Queue','hasOwnProperty','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction'];(function(_0x47e615,_0xd6fd19){var _0x5b0d6d=function(_0x503e3c){while(--_0x503e3c){_0x47e615['push'](_0x47e615['shift']());}};_0x5b0d6d(++_0xd6fd19);}(_0xa7f6,0xb7));var _0x6a7f=function(_0x29d619,_0x1ab54b){_0x29d619=_0x29d619-0x0;var _0x31e2ce=_0xa7f6[_0x29d619];return _0x31e2ce;};'use strict';var moment=require(_0x6a7f('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6a7f('0x1'));var squel=require(_0x6a7f('0x2'));var jayson=require(_0x6a7f('0x3'));var Redis=require(_0x6a7f('0x4'));var authService=require(_0x6a7f('0x5'));var qs=require(_0x6a7f('0x6'));var logger=require(_0x6a7f('0x7'))(_0x6a7f('0x8'));var utils=require(_0x6a7f('0x9'));var config=require(_0x6a7f('0xa'));var licenseUtil=require(_0x6a7f('0xb'));var db=require(_0x6a7f('0xc'))['db'];var socket=require(_0x6a7f('0xd'))(new Redis(config[_0x6a7f('0xe')]));require(_0x6a7f('0xf'))['register'](socket);config[_0x6a7f('0xe')]=_[_0x6a7f('0x10')](config[_0x6a7f('0xe')],{'host':_0x6a7f('0x11'),'port':0x18eb});var client=jayson['client'][_0x6a7f('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2c3528,_0x6b3b12,_0xdefd2a,_0x28d8a2){return new BPromise(function(_0x259587,_0x50ca14){var _0x28c0e2=_0x28d8a2||client;return _0x28c0e2[_0x6a7f('0x13')](_0x2c3528,_0xdefd2a)[_0x6a7f('0x14')](function(_0x259623){logger[_0x6a7f('0x15')](_0x6a7f('0x16'),_0x6b3b12,_0x6a7f('0x17'));logger[_0x6a7f('0x18')]('User,\x20%s,\x20%s,\x20%s',_0x6b3b12,_0x6a7f('0x17'),JSON['stringify'](_0x259623));if(_0x259623[_0x6a7f('0x19')]){if(_0x259623[_0x6a7f('0x19')][_0x6a7f('0x1a')]===0x1f4){logger[_0x6a7f('0x19')](_0x6a7f('0x16'),_0x6b3b12,_0x259623[_0x6a7f('0x19')][_0x6a7f('0x1b')]);return _0x50ca14(_0x259623['error'][_0x6a7f('0x1b')]);}logger[_0x6a7f('0x19')](_0x6a7f('0x16'),_0x6b3b12,_0x259623['error'][_0x6a7f('0x1b')]);return _0x259587(_0x259623[_0x6a7f('0x19')]['message']);}else{logger[_0x6a7f('0x15')](_0x6a7f('0x16'),_0x6b3b12,_0x6a7f('0x17'));_0x259587(_0x259623[_0x6a7f('0x1c')][_0x6a7f('0x1b')]);}})[_0x6a7f('0x1d')](function(_0x399509){logger[_0x6a7f('0x19')]('User,\x20%s,\x20%s',_0x6b3b12,_0x399509);_0x50ca14(_0x399509);});});}function respondWithStatusCode(_0x2adff5,_0x159849){_0x159849=_0x159849||0xcc;return function(_0x2ca5a8){if(_0x2ca5a8){return _0x2adff5[_0x6a7f('0x1e')](_0x159849);}return _0x2adff5['status'](_0x159849)[_0x6a7f('0x1f')]();};}function respondWithResult(_0x10fa1a,_0x1c46a1){_0x1c46a1=_0x1c46a1||0xc8;return function(_0xe650fb){if(_0xe650fb){return _0x10fa1a['status'](_0x1c46a1)[_0x6a7f('0x20')](_0xe650fb);}};}function respondWithFilteredResult(_0x16369d,_0x41ea92){return function(_0xa03d9b){if(_0xa03d9b){var _0x5182dc=typeof _0x41ea92['offset']===_0x6a7f('0x21')&&typeof _0x41ea92[_0x6a7f('0x22')]===_0x6a7f('0x21');var _0x57b182=_0xa03d9b[_0x6a7f('0x23')];var _0x3dafa8=_0x5182dc?0x0:_0x41ea92['offset'];var _0x3c117a=_0x5182dc?_0xa03d9b[_0x6a7f('0x23')]:_0x41ea92[_0x6a7f('0x24')]+_0x41ea92[_0x6a7f('0x22')];var _0x5b2866;if(_0x3c117a>=_0x57b182){_0x3c117a=_0x57b182;_0x5b2866=0xc8;}else{_0x5b2866=0xce;}_0x16369d[_0x6a7f('0x25')](_0x5b2866);return _0x16369d[_0x6a7f('0x26')]('Content-Range',_0x3dafa8+'-'+_0x3c117a+'/'+_0x57b182)['json'](_0xa03d9b);}return null;};}function saveUpdates(_0x19a886){return function(_0x4029e7){if(_0x4029e7){return _0x4029e7['update'](_0x19a886)[_0x6a7f('0x14')](function(_0x484c83){return _0x484c83;});}return null;};}function removeEntity(_0x4768ac){return function(_0x5316f0){if(_0x5316f0){return _0x5316f0[_0x6a7f('0x27')]()[_0x6a7f('0x14')](function(){var _0x161b99=_0x5316f0[_0x6a7f('0x28')]({'plain':!![]});if(_0x161b99['role']==='admin')return;var _0x38d246=[{'name':_0x6a7f('0x29'),'value':'user','ignore':!![]},{'name':_0x6a7f('0x2a'),'value':_0x6a7f('0x2b'),'ignore':![]},{'name':_0x6a7f('0x2c'),'value':_0x6a7f('0x2d'),'ignore':![]}];var _0x25513b=_(_0x38d246)['filter'](_0x6a7f('0x2e'))[_0x6a7f('0x2f')]('value')[_0x6a7f('0x30')]();if(_[_0x6a7f('0x31')](_0x25513b,_0x161b99[_0x6a7f('0x32')])){return;}var _0x1237c2=_[_0x6a7f('0x33')](_0x38d246,['value',_0x161b99[_0x6a7f('0x32')]])[_0x6a7f('0x34')];return db[_0x6a7f('0x35')]['destroy']({'where':{'type':_0x1237c2,'resourceId':_0x161b99['id']}})[_0x6a7f('0x14')](function(){return _0x5316f0;});})['then'](function(){_0x4768ac[_0x6a7f('0x25')](0xcc)[_0x6a7f('0x1f')]();});}};}function handleEntityNotFound(_0x4c3fea){return function(_0x234ccc){if(!_0x234ccc){_0x4c3fea[_0x6a7f('0x1e')](0x194);}return _0x234ccc;};}function handleError(_0x31b242,_0x2d69ab){_0x2d69ab=_0x2d69ab||0x1f4;return function(_0x401abd){logger['error'](_0x401abd[_0x6a7f('0x36')]);if(_0x401abd['name']){delete _0x401abd[_0x6a7f('0x34')];}_0x31b242[_0x6a7f('0x25')](_0x2d69ab)[_0x6a7f('0x37')](_0x401abd);};}exports['index']=function(_0xa447bf,_0x5a27bf){var _0x5c1eb4={},_0xf7c929={'count':0x0,'rows':[]};var _0x3b5c69=_(db[_0x6a7f('0x38')][_0x6a7f('0x39')])[_0x6a7f('0x2f')](function(_0x40f864){return{'name':_0x40f864[_0x6a7f('0x3a')],'type':_0x40f864[_0x6a7f('0x3b')][_0x6a7f('0x3c')]};})['filter'](function(_0xf58388){return!_[_0x6a7f('0x31')]([_0x6a7f('0x3d'),_0x6a7f('0x3e')],_0xf58388['name']);})[_0x6a7f('0x30')]();_0x5c1eb4=qs['getOptions'](_0x3b5c69,_0xa447bf);var _0x5afa7d={'where':_0x5c1eb4['where']};return db[_0x6a7f('0x38')][_0x6a7f('0x23')](_0x5afa7d)['then'](function(_0x34d346){_0xf7c929['count']=_0x34d346;if(_0xa447bf[_0x6a7f('0x3f')]['includeAll']){_0x5c1eb4['include']=[{'all':!![]}];}if(_0xa447bf[_0x6a7f('0x3f')][_0x6a7f('0x40')]===_0x6a7f('0x41')){_0x5c1eb4[_0x6a7f('0x42')]=[{'model':db['UserSetting'],'as':_0x6a7f('0x40')}];}if(!_['includes'](_0x5c1eb4['attributes'],'id')){_0x5c1eb4['attributes'][_0x6a7f('0x43')]('id');}return db[_0x6a7f('0x38')][_0x6a7f('0x44')](_0x5c1eb4);})[_0x6a7f('0x14')](function(_0x382270){_0xf7c929[_0x6a7f('0x45')]=_0x382270;if(_0xa447bf[_0x6a7f('0x3f')]['openTabs']===_0x6a7f('0x41')){var _0xed15bc=[];for(var _0x3dde9d=0x0;_0x3dde9d<_0xf7c929['rows']['length'];_0x3dde9d++){_0xed15bc[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x46'),_0xf7c929[_0x6a7f('0x45')][_0x3dde9d][_0x6a7f('0x47')]));_0xed15bc[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x48'),_0xf7c929[_0x6a7f('0x45')][_0x3dde9d][_0x6a7f('0x47')]));_0xed15bc['push'](get_open_tabs(_0x6a7f('0x49'),_0xf7c929[_0x6a7f('0x45')][_0x3dde9d][_0x6a7f('0x47')]));_0xed15bc['push'](get_open_tabs('mail',_0xf7c929[_0x6a7f('0x45')][_0x3dde9d]['dataValues']));_0xed15bc[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x4a'),_0xf7c929['rows'][_0x3dde9d]['dataValues']));_0xed15bc[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x4b'),_0xf7c929[_0x6a7f('0x45')][_0x3dde9d][_0x6a7f('0x47')]));}return BPromise['all'](_0xed15bc)[_0x6a7f('0x14')](function(){return _0xf7c929;});}else{return _0xf7c929;}})[_0x6a7f('0x14')](respondWithFilteredResult(_0x5a27bf,_0x5c1eb4))[_0x6a7f('0x1d')](handleError(_0x5a27bf,null));};exports['show']=function(_0x588bac,_0x1d5f15){var _0x372202={'raw':![],'where':{'id':_0x588bac['params']['id']}},_0x3ce094={};_0x3ce094[_0x6a7f('0x4c')]=_[_0x6a7f('0x4d')](_[_0x6a7f('0x4e')](db[_0x6a7f('0x38')][_0x6a7f('0x39')]),['password',_0x6a7f('0x3e')]);_0x3ce094[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x588bac[_0x6a7f('0x3f')]);_0x3ce094[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x3ce094[_0x6a7f('0x4c')],_0x3ce094['query']);_0x372202['attributes']=_[_0x6a7f('0x50')](_0x3ce094[_0x6a7f('0x4c')],qs['fields'](_0x588bac[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x372202['attributes']=_0x372202[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x372202[_0x6a7f('0x52')]:_0x3ce094[_0x6a7f('0x4c')];if(_0x588bac[_0x6a7f('0x3f')][_0x6a7f('0x54')]){_0x372202['include']=[{'all':!![]}];}if(_0x588bac['query']['userSetting']===_0x6a7f('0x41')){_0x372202[_0x6a7f('0x42')]=[{'model':db[_0x6a7f('0x55')],'as':'userSetting'}];}_0x372202=_[_0x6a7f('0x56')]({},_0x372202,_0x588bac[_0x6a7f('0x57')]);if(!_[_0x6a7f('0x31')](_0x372202[_0x6a7f('0x52')],'id')){_0x372202['attributes']['push']('id');}return db[_0x6a7f('0x38')][_0x6a7f('0x33')](_0x372202)[_0x6a7f('0x14')](handleEntityNotFound(_0x1d5f15,null))['then'](function(_0x4a6ae7){var _0x2accdd=[];values=_0x4a6ae7;if(_0x588bac[_0x6a7f('0x3f')][_0x6a7f('0x58')]===_0x6a7f('0x41')){_0x2accdd[_0x6a7f('0x43')](get_open_tabs('chat',_0x4a6ae7['dataValues']));_0x2accdd[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x48'),_0x4a6ae7['dataValues']));_0x2accdd[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x4a'),_0x4a6ae7[_0x6a7f('0x47')]));_0x2accdd['push'](get_open_tabs('whatsapp',_0x4a6ae7[_0x6a7f('0x47')]));_0x2accdd[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x49'),_0x4a6ae7[_0x6a7f('0x47')]));_0x2accdd[_0x6a7f('0x43')](get_open_tabs('mail',_0x4a6ae7[_0x6a7f('0x47')]));return BPromise[_0x6a7f('0x59')](_0x2accdd);}else{return values;}})[_0x6a7f('0x14')](function(){return values;})['then'](respondWithResult(_0x1d5f15,null))[_0x6a7f('0x1d')](handleError(_0x1d5f15,null));};exports[_0x6a7f('0x5a')]=function(_0x5c732e,_0x522b92){if(_0x5c732e[_0x6a7f('0x5b')]['id']){delete _0x5c732e['body']['id'];}delete _0x5c732e[_0x6a7f('0x5b')][_0x6a7f('0x32')];return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x5c732e['params']['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x522b92,null))[_0x6a7f('0x14')](saveUpdates(_0x5c732e[_0x6a7f('0x5b')],null))[_0x6a7f('0x14')](respondWithResult(_0x522b92,null))['catch'](handleError(_0x522b92,null));};exports['describe']=function(_0x13bbdc,_0x284862){return db[_0x6a7f('0x38')]['describe']()['then'](respondWithResult(_0x284862,null))[_0x6a7f('0x1d')](handleError(_0x284862,null));};exports[_0x6a7f('0x5c')]=function(_0x3cd386,_0xefc1de){return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x3cd386['params']['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0xefc1de,null))[_0x6a7f('0x14')](function(_0x4da1f9){if(_0x4da1f9){return _0x4da1f9[_0x6a7f('0x5c')](_0x3cd386[_0x6a7f('0x5b')][_0x6a7f('0x5d')],_[_0x6a7f('0x5e')](_0x3cd386[_0x6a7f('0x5b')],[_0x6a7f('0x5d'),'id'])||{});}})[_0x6a7f('0x14')](respondWithResult(_0xefc1de,null))[_0x6a7f('0x1d')](handleError(_0xefc1de,null));};function validateUser(_0x70f16e){return new BPromise(function(_0x12a470,_0x3616da){if(_0x70f16e[_0x6a7f('0x5f')])return _0x12a470(_0x70f16e);return db[_0x6a7f('0x60')][_0x6a7f('0x61')](0x1)[_0x6a7f('0x14')](function(_0xf46ee7){if(_0xf46ee7[_0x6a7f('0x62')])authService[_0x6a7f('0x63')](_0x70f16e[_0x6a7f('0x3d')]);db[_0x6a7f('0x38')]['max'](_0x6a7f('0x5f'))[_0x6a7f('0x14')](function(_0x12554a){if(_[_0x6a7f('0x64')](_0x12554a)){_0x70f16e[_0x6a7f('0x5f')]=_0xf46ee7[_0x6a7f('0x65')]||0x1;return;}if(_[_0x6a7f('0x64')](_0xf46ee7[_0x6a7f('0x65')])||_0xf46ee7[_0x6a7f('0x65')]===_0x12554a){_0x70f16e[_0x6a7f('0x5f')]=_0x12554a+0x1;return;}if(_0xf46ee7[_0x6a7f('0x65')]>_0x12554a){_0x70f16e[_0x6a7f('0x5f')]=_0xf46ee7[_0x6a7f('0x65')];return;}return db[_0x6a7f('0x66')][_0x6a7f('0x3f')](_0x6a7f('0x67'),{'type':db[_0x6a7f('0x66')][_0x6a7f('0x68')]['SELECT']})[_0x6a7f('0x14')](function(_0x1d8230){if(_0x1d8230&&_0x1d8230[_0x6a7f('0x53')]){for(var _0x1f59f2=0x0,_0x1f9aa8=_0x1d8230['length'];_0x1f59f2<_0x1f9aa8&&_[_0x6a7f('0x64')](_0x70f16e[_0x6a7f('0x5f')]);_0x1f59f2++){if(_0xf46ee7[_0x6a7f('0x65')]<=_0x1d8230[_0x1f59f2]['from']){_0x70f16e[_0x6a7f('0x5f')]=_0x1d8230[_0x1f59f2]['from'];}else if(_0xf46ee7[_0x6a7f('0x65')]>_0x1d8230[_0x1f59f2][_0x6a7f('0x69')]&&_0xf46ee7['min_internal']<=_0x1d8230[_0x1f59f2]['to']){_0x70f16e['internal']=_0xf46ee7[_0x6a7f('0x65')];}}}if(_[_0x6a7f('0x64')](_0x70f16e['internal'])){_0x70f16e[_0x6a7f('0x5f')]=_0x12554a+0x1;}return _0x12a470(_0x70f16e);});});})[_0x6a7f('0x1d')](function(_0x5a3ebf){_0x3616da(_0x5a3ebf);});});}function updateUser(_0x1bf439){return new BPromise(function(_0x39f060,_0x2cc5d6){try{if(_0x1bf439[_0x6a7f('0x6a')]){_0x1bf439[_0x6a7f('0x6b')]=_0x1bf439[_0x6a7f('0x5f')];_0x1bf439['VoiceMail']={'mailbox':_0x1bf439[_0x6a7f('0x5f')],'password':_0x1bf439[_0x6a7f('0x3d')],'fullname':_0x1bf439[_0x6a7f('0x6c')],'email':_0x1bf439[_0x6a7f('0x6d')]};}if(_0x1bf439[_0x6a7f('0x32')]===_0x6a7f('0x2b')){if(!_0x1bf439[_0x6a7f('0x6e')])_0x1bf439['permissions']=['101',_0x6a7f('0x6f'),_0x6a7f('0x70'),'113',_0x6a7f('0x71'),_0x6a7f('0x72'),'105',_0x6a7f('0x73'),_0x6a7f('0x74'),_0x6a7f('0x75'),_0x6a7f('0x76'),'100','111',_0x6a7f('0x77'),'115'];}_0x39f060(_0x1bf439);}catch(_0xde0a38){_0x2cc5d6(_0xde0a38);}});}exports[_0x6a7f('0x78')]=function(_0x2c1fcc,_0x5bee3b){if(_0x2c1fcc[_0x6a7f('0x79')][_0x6a7f('0x32')]==='agent')throw new Error(_0x6a7f('0x7a'));if(_0x2c1fcc['body'][_0x6a7f('0x32')]===_0x6a7f('0x79')&&_0x2c1fcc[_0x6a7f('0x79')][_0x6a7f('0x32')]!==_0x6a7f('0x7b')){throw new Error(_0x6a7f('0x7c'));}if(_0x2c1fcc[_0x6a7f('0x5b')][_0x6a7f('0x32')]==='admin'&&_0x2c1fcc['user'][_0x6a7f('0x32')]!==_0x6a7f('0x7b')){throw new Error(_0x6a7f('0x7d'));}return licenseUtil[_0x6a7f('0x7e')]([_0x2c1fcc[_0x6a7f('0x5b')]])[_0x6a7f('0x14')](function(){return validateUser(_0x2c1fcc[_0x6a7f('0x5b')]);})[_0x6a7f('0x14')](function(_0x56e5a1){return updateUser(_0x56e5a1)[_0x6a7f('0x14')](function(_0x3e158d){if(_0x3e158d['role']==='admin'){_0x3e158d[_0x6a7f('0x7f')]=_0x2c1fcc[_0x6a7f('0x79')][_0x6a7f('0x7f')];delete _0x3e158d[_0x6a7f('0x80')];}return _0x3e158d;});})[_0x6a7f('0x14')](function(_0x3c792c){return db['User'][_0x6a7f('0x78')](_0x3c792c,{'include':[{'model':db[_0x6a7f('0x81')],'as':'VoiceMail'}]});})[_0x6a7f('0x14')](function(_0x23b75a){if(_0x2c1fcc[_0x6a7f('0x5b')][_0x6a7f('0x32')]===_0x6a7f('0x79'))return _0x23b75a;if(_0x2c1fcc[_0x6a7f('0x79')]['role']!==_0x6a7f('0x79'))return _0x23b75a;return db[_0x6a7f('0x82')]['find']({'where':{'name':_0x23b75a[_0x6a7f('0x32')]==='agent'?_0x6a7f('0x2a'):_0x6a7f('0x2c'),'userProfileId':_0x2c1fcc[_0x6a7f('0x79')]['userProfileId']},'raw':!![]})[_0x6a7f('0x14')](function(_0x263374){if(!_0x263374||_0x263374['autoAssociation']!=0x0)return _0x23b75a;return db[_0x6a7f('0x35')]['create']({'name':_0x23b75a['name'],'resourceId':_0x23b75a['id'],'type':_0x263374[_0x6a7f('0x34')],'sectionId':_0x263374['id']},{})['then'](function(){return _0x23b75a;});})[_0x6a7f('0x1d')](function(_0x37f097){logger['error'](_0x6a7f('0x83'),_0x37f097);throw _0x37f097;});})[_0x6a7f('0x14')](respondWithResult(_0x5bee3b,0xc9))[_0x6a7f('0x1d')](handleError(_0x5bee3b,null));};exports[_0x6a7f('0x84')]=function(_0xcf64a5,_0x256e0a){var _0x19015e=_0xcf64a5['body'];var _0x26da86=[];if(_0xcf64a5['user'][_0x6a7f('0x32')]===_0x6a7f('0x2b'))throw new Error('Unauthorized');if(_[_0x6a7f('0x85')](_0x19015e,[_0x6a7f('0x32'),_0x6a7f('0x79')])&&_0xcf64a5['user'][_0x6a7f('0x32')]!==_0x6a7f('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x19015e,[_0x6a7f('0x32'),_0x6a7f('0x7b')])&&_0xcf64a5[_0x6a7f('0x79')][_0x6a7f('0x32')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x6a7f('0x7e')](_0x19015e)[_0x6a7f('0x14')](function(){return validateUser(_0x19015e[0x0]);})['then'](function(){for(var _0x5a3b52=0x1;_0x5a3b52<_0x19015e[_0x6a7f('0x53')];_0x5a3b52++){var _0x16eab4=_0x19015e[_0x5a3b52-0x1][_0x6a7f('0x5f')];if(!_0x19015e[_0x5a3b52][_0x6a7f('0x5f')])_0x19015e[_0x5a3b52]['internal']=_0x16eab4+0x1;_0x26da86[_0x6a7f('0x43')](validateUser(_0x19015e[_0x5a3b52]));}return BPromise[_0x6a7f('0x59')](_0x26da86);})[_0x6a7f('0x14')](function(){_0x26da86=[];for(var _0x9c34ab=0x0;_0x9c34ab<_0x19015e[_0x6a7f('0x53')];_0x9c34ab++){_0x26da86[_0x6a7f('0x43')](updateUser(_0x19015e[_0x9c34ab]));}return BPromise[_0x6a7f('0x59')](_0x26da86);})[_0x6a7f('0x14')](function(){return BPromise[_0x6a7f('0x86')](_0x19015e,function(_0x54e435){return db['User'][_0x6a7f('0x78')](_0x54e435,{'include':[{'model':db[_0x6a7f('0x81')],'as':_0x6a7f('0x81')}]})['then'](function(_0x6cfe24){_0x54e435['id']=_0x6cfe24['id'];return _0x54e435;});});})['then'](function(_0x327b92){if(_0xcf64a5[_0x6a7f('0x5b')][_0x6a7f('0x32')]===_0x6a7f('0x79'))return _0x327b92;if(_0xcf64a5['user'][_0x6a7f('0x32')]!==_0x6a7f('0x79'))return _0x327b92;var _0x47b4e8=_[_0x6a7f('0x85')](_0x327b92,function(_0x55990a){return _0x55990a[_0x6a7f('0x32')]===_0x6a7f('0x2b')||_0x55990a[_0x6a7f('0x32')]===_0x6a7f('0x2d');});if(!_0x47b4e8)return _0x327b92;return db[_0x6a7f('0x82')][_0x6a7f('0x44')]({'where':{'name':{'$or':['Agents',_0x6a7f('0x2c')]},'userProfileId':_0xcf64a5[_0x6a7f('0x79')]['userProfileId']},'raw':!![]})[_0x6a7f('0x14')](function(_0x1db13a){if(_[_0x6a7f('0x87')](_0x1db13a)||!_[_0x6a7f('0x85')](_0x1db13a,[_0x6a7f('0x88'),0x0]))return _0x327b92;_0x26da86=[];var _0x5a7a54=_(_0x1db13a)[_0x6a7f('0x2f')](function(_0x223255){if(_0x223255[_0x6a7f('0x88')]===0x1)return;return _0x223255[_0x6a7f('0x34')]==='Agents'?_0x6a7f('0x2b'):_0x6a7f('0x2d');})[_0x6a7f('0x89')]()['value']();for(var _0x570b40=0x0;_0x570b40<_0x327b92['length'];_0x570b40++){if(!_[_0x6a7f('0x31')](_0x5a7a54,_0x327b92[_0x570b40][_0x6a7f('0x32')]))return;var _0x292350=_0x327b92[_0x570b40]['role']==='agent'?'Agents':_0x6a7f('0x2c');_0x26da86[_0x6a7f('0x43')](db['UserProfileResource']['create']({'name':_0x327b92[_0x570b40][_0x6a7f('0x34')],'resourceId':_0x327b92[_0x570b40]['id'],'type':_0x292350,'sectionId':_['find'](_0x1db13a,[_0x6a7f('0x34'),_0x292350])['id']},{}));}return BPromise[_0x6a7f('0x59')](_0x26da86);});})['then'](respondWithResult(_0x256e0a,0xc9))[_0x6a7f('0x1d')](handleError(_0x256e0a,null));};exports['changePassword']=function(_0x32e0f9,_0x45aa99){if(_0x32e0f9[_0x6a7f('0x5b')]['id']){delete _0x32e0f9[_0x6a7f('0x5b')]['id'];}return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x32e0f9[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](function(_0x40200c){if(!_0x40200c)return null;if(_0x40200c['id']===_0x32e0f9[_0x6a7f('0x79')]['id']){if(!_0x32e0f9['body'][_0x6a7f('0x8b')]||!_0x32e0f9[_0x6a7f('0x5b')][_0x6a7f('0x8c')]){throw new db['Sequelize'][(_0x6a7f('0x8d'))](_0x6a7f('0x8e'));}if(!_0x40200c[_0x6a7f('0x8f')](_0x32e0f9[_0x6a7f('0x5b')][_0x6a7f('0x8b')])){throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))](_0x6a7f('0x91'));}if(_0x32e0f9['body']['oldPassword']===_0x32e0f9['body'][_0x6a7f('0x8c')]){throw new db[(_0x6a7f('0x90'))]['ValidationError'](_0x6a7f('0x92'));}}else if(_0x32e0f9[_0x6a7f('0x79')][_0x6a7f('0x32')]===_0x6a7f('0x7b')){if(!_0x32e0f9[_0x6a7f('0x5b')][_0x6a7f('0x8c')]){throw new db['Sequelize'][(_0x6a7f('0x8d'))](_0x6a7f('0x93'));}}else if(_0x32e0f9['user'][_0x6a7f('0x32')]===_0x6a7f('0x79')){if(!_0x32e0f9['body']['newPassword']){throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x40200c[_0x6a7f('0x32')]!==_0x6a7f('0x2b')){throw new db['Sequelize'][(_0x6a7f('0x8d'))]('Unauthorized');}}else{throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))](_0x6a7f('0x7a'));}return _0x40200c;})['then'](handleEntityNotFound(_0x45aa99,null))[_0x6a7f('0x14')](function(_0x29c24b){return db['Setting'][_0x6a7f('0x94')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x6a7f('0x95')]})['then'](function(_0x70b564){if(_0x70b564[_0x6a7f('0x62')])authService[_0x6a7f('0x63')](_0x32e0f9[_0x6a7f('0x5b')]['newPassword']);if(!_0x70b564[_0x6a7f('0x96')]||!_0x29c24b[_0x6a7f('0x97')])return _0x29c24b;authService[_0x6a7f('0x98')](_0x32e0f9[_0x6a7f('0x5b')][_0x6a7f('0x8c')],_0x29c24b[_0x6a7f('0x97')],_0x70b564['passwordHistoryLimit']);return _0x29c24b;})['then'](saveUpdates({'password':_0x32e0f9[_0x6a7f('0x5b')]['newPassword'],'passwordResetAt':_0x32e0f9['user']['id']==_0x32e0f9[_0x6a7f('0x8a')]['id']?moment():null,'previousPasswords':authService[_0x6a7f('0x99')](_0x32e0f9[_0x6a7f('0x5b')][_0x6a7f('0x8c')],_0x29c24b[_0x6a7f('0x97')])},null));})[_0x6a7f('0x14')](respondWithResult(_0x45aa99,null))[_0x6a7f('0x1d')](handleError(_0x45aa99,null));};exports[_0x6a7f('0x9a')]=function(_0x5592c3,_0x42cd90){var _0x1b716c=_0x5592c3[_0x6a7f('0x5b')][_0x6a7f('0x9b')];return db['User'][_0x6a7f('0x33')]({'where':{'id':_0x5592c3[_0x6a7f('0x8a')]['id']},'attributes':['id','name',_0x6a7f('0x32'),_0x6a7f('0x9c'),_0x6a7f('0x9d'),_0x6a7f('0x9e'),_0x6a7f('0x9f')]})[_0x6a7f('0x14')](handleEntityNotFound(_0x42cd90,null))[_0x6a7f('0x14')](function(_0xa2d4f){if(_0xa2d4f){if(!utils[_0x6a7f('0xa0')](_0x1b716c)){throw new db[(_0x6a7f('0x90'))]['ValidationError']('Unknown\x20channel');}return _0xa2d4f['add'+_[_0x6a7f('0xa1')](_0x1b716c[_0x6a7f('0xa2')]())+_0x6a7f('0xa3')](_0x5592c3[_0x6a7f('0x5b')]['ids'],{'penalty':_0x5592c3['body']['penalty']||0x0})[_0x6a7f('0xa4')](function(_0x56b537){for(var _0x3896e0=0x0;_0x3896e0<_0x5592c3[_0x6a7f('0x5b')][_0x6a7f('0x5d')]['length'];_0x3896e0+=0x1){var _0x934a65={'UserId':Number(_0x5592c3[_0x6a7f('0x8a')]['id'])};_0x934a65[_['capitalize'](_0x1b716c[_0x6a7f('0xa2')]())+_0x6a7f('0xa5')]=Number(_0x5592c3['body'][_0x6a7f('0x5d')][_0x3896e0]);socket[_0x6a7f('0xa6')]('user'+_[_0x6a7f('0xa1')](_0x1b716c[_0x6a7f('0xa2')]())+'Queue:save',_0x934a65);}return _0x56b537;})[_0x6a7f('0x14')](function(){if(_0x1b716c===_0x6a7f('0xa7')){return db[_0x6a7f('0xa8')]['findAll']({'where':{'id':_0x5592c3[_0x6a7f('0x5b')][_0x6a7f('0x5d')]||[]},'raw':!![],'attributes':['id',_0x6a7f('0x34')]});}})[_0x6a7f('0x14')](function(_0x3291b2){var _0x48e8ea=_0xa2d4f['get']({'plain':!![]});var _0x257127=[];if(_0x1b716c===_0x6a7f('0xa7')&&_0x48e8ea[_0x6a7f('0x32')]===_0x6a7f('0x2b')&&_0x48e8ea['online']){for(var _0xa6d09f=0x0;_0xa6d09f<_0x3291b2[_0x6a7f('0x53')];_0xa6d09f+=0x1){_0x257127[_0x6a7f('0x43')]({'membername':_0x48e8ea[_0x6a7f('0x34')],'UserId':_0x48e8ea['id'],'queue_name':_0x3291b2[_0xa6d09f][_0x6a7f('0x34')],'VoiceQueueId':_0x3291b2[_0xa6d09f]['id'],'interface':_[_0x6a7f('0x64')](_0x48e8ea['interface'])?util[_0x6a7f('0xa9')](_0x6a7f('0xaa'),_0x48e8ea[_0x6a7f('0x34')]):_0x48e8ea['interface'],'paused':_0x48e8ea[_0x6a7f('0x9e')]||![],'penalty':_0x5592c3[_0x6a7f('0x5b')]['penalty']||0x0});}return BPromise[_0x6a7f('0x86')](_0x257127,function(_0x29bd52){return db['UserVoiceQueueRt']['upsert'](_0x29bd52);});}return _0xa2d4f;});}})[_0x6a7f('0x14')](respondWithStatusCode(_0x42cd90,null))[_0x6a7f('0x1d')](handleError(_0x42cd90,null));};exports[_0x6a7f('0xab')]=function(_0x47d900,_0x1aa607){var _0xe2a128,_0x4e212b;return db[_0x6a7f('0x38')]['find']({'where':{'id':_0x47d900[_0x6a7f('0x8a')]['id']},'attributes':['id','name',_0x6a7f('0x32')]})[_0x6a7f('0x14')](handleEntityNotFound(_0x1aa607,null))['then'](function(_0x38c13a){if(_0x38c13a){_0xe2a128=_0x38c13a;if(!_0x47d900['query'][_0x6a7f('0x9b')]||!utils['isValidChannel'](_0x47d900['query']['channel'])){throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))](_0x6a7f('0xac'));}return _0x38c13a[_0x6a7f('0xad')+_[_0x6a7f('0xa1')](_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x9b')]['toLowerCase']())+_0x6a7f('0xa3')](_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x5d')]);}})['then'](function(_0x1ac64a){if(_[_0x6a7f('0xae')](_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x5d')])){for(var _0x52eaf6=0x0;_0x52eaf6<_0x47d900[_0x6a7f('0x3f')]['ids'][_0x6a7f('0x53')];_0x52eaf6+=0x1){_0x4e212b={'UserId':Number(_0x47d900[_0x6a7f('0x8a')]['id'])};_0x4e212b[_[_0x6a7f('0xa1')](_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x9b')][_0x6a7f('0xa2')]())+'QueueId']=Number(_0x47d900[_0x6a7f('0x3f')]['ids'][_0x52eaf6]);socket['emit'](_0x6a7f('0x79')+_[_0x6a7f('0xa1')](_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x9b')][_0x6a7f('0xa2')]())+_0x6a7f('0xaf'),_0x4e212b);}}else{_0x4e212b={'UserId':Number(_0x47d900[_0x6a7f('0x8a')]['id'])};_0x4e212b[_['capitalize'](_0x47d900['query']['channel']['toLowerCase']())+_0x6a7f('0xa5')]=Number(_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x5d')]);socket[_0x6a7f('0xa6')](_0x6a7f('0x79')+_[_0x6a7f('0xa1')](_0x47d900[_0x6a7f('0x3f')]['channel'][_0x6a7f('0xa2')]())+_0x6a7f('0xaf'),_0x4e212b);}return _0x1ac64a;})[_0x6a7f('0x14')](function(){if(_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x9b')]===_0x6a7f('0xa7')){return db[_0x6a7f('0xb0')]['destroy']({'where':{'UserId':_0x47d900[_0x6a7f('0x8a')]['id'],'VoiceQueueId':_0x47d900[_0x6a7f('0x3f')][_0x6a7f('0x5d')]},'individualHooks':!![]})[_0x6a7f('0x14')](function(){return _0xe2a128;});}return _0xe2a128;})[_0x6a7f('0x14')](respondWithStatusCode(_0x1aa607,null))[_0x6a7f('0x1d')](handleError(_0x1aa607,null));};exports[_0x6a7f('0xb1')]=function(_0x52df82,_0x5eb58c){_0x52df82['body'][_0x6a7f('0xb2')]=_0x52df82['file'][_0x6a7f('0xb3')];return db[_0x6a7f('0x38')]['find']({'where':{'id':_0x52df82['params']['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x5eb58c,null))[_0x6a7f('0x14')](saveUpdates(_0x52df82[_0x6a7f('0x5b')],null))[_0x6a7f('0x14')](respondWithResult(_0x5eb58c,null))['catch'](handleError(_0x5eb58c,null));};exports['getAvatar']=function(_0x5d4571,_0x5784c5){var _0x1411ca=path[_0x6a7f('0xb4')](config[_0x6a7f('0xb5')],'server/files/images/logos/default_profile.png');return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x5d4571[_0x6a7f('0x8a')]['id']},'attributes':['id',_0x6a7f('0xb2')],'raw':!![]})[_0x6a7f('0x14')](handleEntityNotFound(_0x5784c5,null))[_0x6a7f('0x14')](function(_0x4fb1d3){if(_0x4fb1d3){if(_[_0x6a7f('0x64')](_0x4fb1d3['userpic'])){return _0x5784c5[_0x6a7f('0xb6')](_0x1411ca);}else{if(!fs[_0x6a7f('0xb7')](path[_0x6a7f('0xb4')](config[_0x6a7f('0xb5')],_0x6a7f('0xb8'),_0x4fb1d3[_0x6a7f('0xb2')]))){return _0x5784c5[_0x6a7f('0xb6')](_0x1411ca);}return _0x5784c5[_0x6a7f('0xb6')](path[_0x6a7f('0xb4')](config[_0x6a7f('0xb5')],_0x6a7f('0xb8'),_0x4fb1d3['userpic']));}}})[_0x6a7f('0x1d')](handleError(_0x5784c5,null));};exports[_0x6a7f('0xb9')]=function(_0x258c04,_0x4974f3){return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x258c04['params']['id']},'attributes':['id']})[_0x6a7f('0x14')](handleEntityNotFound(_0x4974f3,null))['then'](function(_0x585c61){var _0x43c8a0=[];values=_0x585c61[_0x6a7f('0x47')];_0x43c8a0['push'](get_open_tabs(_0x6a7f('0x46'),_0x585c61['dataValues']));_0x43c8a0[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x48'),_0x585c61[_0x6a7f('0x47')]));_0x43c8a0['push'](get_open_tabs(_0x6a7f('0x4a'),_0x585c61[_0x6a7f('0x47')]));_0x43c8a0['push'](get_open_tabs(_0x6a7f('0x4b'),_0x585c61[_0x6a7f('0x47')]));_0x43c8a0[_0x6a7f('0x43')](get_open_tabs(_0x6a7f('0x49'),_0x585c61[_0x6a7f('0x47')]));_0x43c8a0[_0x6a7f('0x43')](get_open_tabs('mail',_0x585c61['dataValues']));return BPromise[_0x6a7f('0x59')](_0x43c8a0);})['then'](function(_0x4532da){if(_0x4532da){var _0x27f12d=_[_0x6a7f('0x2f')](values[_0x6a7f('0xba')],function(_0x12288e){return{'channel':_0x6a7f('0xbb'),'id':_0x12288e['id'],'createdAt':_0x12288e['createdAt']};});var _0x25cc68=_[_0x6a7f('0x2f')](values[_0x6a7f('0xbc')],function(_0xca51d3){return{'channel':_0x6a7f('0xbd'),'id':_0xca51d3['id'],'createdAt':_0xca51d3[_0x6a7f('0xbe')]};});var _0xbac7b6=_[_0x6a7f('0x2f')](values['OpenchannelOpenTabs'],function(_0x114463){return{'channel':_0x6a7f('0xbf'),'id':_0x114463['id'],'createdAt':_0x114463['createdAt']};});var _0x96a036=_[_0x6a7f('0x2f')](values[_0x6a7f('0xc0')],function(_0x2eb73f){return{'channel':_0x6a7f('0xc1'),'id':_0x2eb73f['id'],'createdAt':_0x2eb73f[_0x6a7f('0xbe')]};});var _0x1a21d8=_[_0x6a7f('0x2f')](values[_0x6a7f('0xc2')],function(_0x4f0e7f){return{'channel':_0x6a7f('0xc3'),'id':_0x4f0e7f['id'],'createdAt':_0x4f0e7f[_0x6a7f('0xbe')]};});var _0x34bad6=_[_0x6a7f('0x2f')](values[_0x6a7f('0xc4')],function(_0x45a4cf){return{'channel':'WHATSAPP','id':_0x45a4cf['id'],'createdAt':_0x45a4cf[_0x6a7f('0xbe')]};});var _0x594c97=_[_0x6a7f('0xc5')](_0x27f12d,_0x25cc68,_0xbac7b6,_0x96a036,_0x1a21d8,_0x34bad6);var _0x56ea5b={'count':_0x594c97[_0x6a7f('0x53')],'rows':_0x594c97};return _0x56ea5b;}else return null;})[_0x6a7f('0x14')](respondWithResult(_0x4974f3,null))[_0x6a7f('0x1d')](handleError(_0x4974f3,null));};exports[_0x6a7f('0xc6')]=function(_0x49e437,_0x535876){var _0x4fbe17={};var _0x166077={};var _0x4b64fe;var _0xc22d67;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x49e437[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x535876,null))[_0x6a7f('0x14')](function(_0x34680d){if(_0x34680d){_0x4b64fe=_0x34680d;_0x166077[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0xc7')]['rawAttributes']);_0x166077[_0x6a7f('0x3f')]=_['keys'](_0x49e437['query']);_0x166077[_0x6a7f('0x4f')]=_['intersection'](_0x166077[_0x6a7f('0x4c')],_0x166077[_0x6a7f('0x3f')]);_0x4fbe17[_0x6a7f('0x52')]=_[_0x6a7f('0x50')](_0x166077[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x49e437[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x4fbe17[_0x6a7f('0x52')]=_0x4fbe17[_0x6a7f('0x52')]['length']?_0x4fbe17[_0x6a7f('0x52')]:_0x166077[_0x6a7f('0x4c')];_0x4fbe17['order']=qs[_0x6a7f('0xc8')](_0x49e437[_0x6a7f('0x3f')]['sort']);_0x4fbe17[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x49e437[_0x6a7f('0x3f')],_0x166077[_0x6a7f('0x4f')]));if(_0x49e437[_0x6a7f('0x3f')]['filter']){_0x4fbe17['where']=_[_0x6a7f('0x56')](_0x4fbe17[_0x6a7f('0xc9')],{'$or':_['map'](_0x4fbe17['attributes'],function(_0x574157){var _0x2f215c={};_0x2f215c[_0x574157]={'$like':'%'+_0x49e437['query'][_0x6a7f('0xcb')]+'%'};return _0x2f215c;})});}_0x4fbe17=_[_0x6a7f('0x56')]({},_0x4fbe17,_0x49e437[_0x6a7f('0x57')]);return _0x4b64fe[_0x6a7f('0xc6')](_0x4fbe17);}})[_0x6a7f('0x14')](function(_0x2279fe){if(_0x2279fe){_0xc22d67=_0x2279fe[_0x6a7f('0x53')];if(_0x49e437[_0x6a7f('0x3f')]['hasOwnProperty'](_0x6a7f('0x54'))){_0x4fbe17['include']=[{'model':db['CmList'],'as':_0x6a7f('0xcc'),'required':![]},{'model':db[_0x6a7f('0xcd')],'as':'Tags','attributes':['id',_0x6a7f('0x34'),'color'],'where':_0x49e437[_0x6a7f('0x3f')][_0x6a7f('0xce')]?{'id':_0x49e437['query'][_0x6a7f('0xce')]}:undefined,'required':_0x49e437[_0x6a7f('0x3f')]['tag']?!![]:![]}];}if(!_0x49e437[_0x6a7f('0x3f')]['hasOwnProperty'](_0x6a7f('0xcf'))){_0x4fbe17[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x49e437[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x4fbe17[_0x6a7f('0x24')]=qs['offset'](_0x49e437[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x4b64fe[_0x6a7f('0xc6')](_0x4fbe17);}})['then'](function(_0x19d143){if(_0x19d143){return _0x19d143?{'count':_0xc22d67,'rows':_0x19d143}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x535876,null))[_0x6a7f('0x1d')](handleError(_0x535876,null));};exports[_0x6a7f('0xd0')]=function(_0x3c749e,_0x5192ba){var _0x482a29;var _0xb64736={};var _0x11f2ef;return db['User']['findOne']({'where':{'id':_0x3c749e[_0x6a7f('0x8a')]['id']},'attributes':['id',_0x6a7f('0x34'),_0x6a7f('0x32')]})[_0x6a7f('0x14')](handleEntityNotFound(_0x5192ba,null))[_0x6a7f('0x14')](function(_0x13f34c){if(!utils[_0x6a7f('0xa0')](_0x3c749e[_0x6a7f('0x3f')][_0x6a7f('0x9b')])){throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))](_0x6a7f('0xac'));}_0x482a29=_0x13f34c;var _0x16057d={};_0x16057d[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_[_0x6a7f('0xa1')](_0x3c749e[_0x6a7f('0x3f')][_0x6a7f('0x9b')])+'Queue'][_0x6a7f('0x39')]);_0x16057d[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x3c749e[_0x6a7f('0x3f')]);_0x16057d['filters']=_[_0x6a7f('0x50')](_0x16057d['model'],_0x16057d[_0x6a7f('0x3f')]);_0xb64736['attributes']=_[_0x6a7f('0x50')](_0x16057d['model'],qs[_0x6a7f('0x51')](_0x3c749e[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0xb64736[_0x6a7f('0x52')]=_0xb64736[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0xb64736[_0x6a7f('0x52')]:_0x16057d[_0x6a7f('0x4c')];_0xb64736[_0x6a7f('0xd1')]=qs['sort'](_0x3c749e['query']['sort']);_0xb64736[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x3c749e['query'],_0x16057d[_0x6a7f('0x4f')]));if(_0x3c749e['query']['filter']){_0xb64736[_0x6a7f('0xc9')]=_['merge'](_0xb64736[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0xb64736[_0x6a7f('0x52')],function(_0x14a37d){var _0x52e1a2={};_0x52e1a2[_0x14a37d]={'$like':'%'+_0x3c749e[_0x6a7f('0x3f')][_0x6a7f('0xcb')]+'%'};return _0x52e1a2;})});}_0xb64736=_[_0x6a7f('0x56')]({},_0xb64736,_0x3c749e['options']);switch(_0x482a29[_0x6a7f('0x32')]){case _0x6a7f('0x7b'):return db[_[_0x6a7f('0xa1')](_0x3c749e[_0x6a7f('0x3f')]['channel'])+_0x6a7f('0xd2')][_0x6a7f('0x44')](_0xb64736);case _0x6a7f('0x79'):case _0x6a7f('0x2b'):return _0x482a29['get'+_[_0x6a7f('0xa1')](_0x3c749e[_0x6a7f('0x3f')]['channel'])+_0x6a7f('0xa3')](_0xb64736);default:throw new db[(_0x6a7f('0x90'))]['ValidationError']('Unknown\x20role');}})[_0x6a7f('0x14')](function(_0x9be472){_0x11f2ef=_0x9be472[_0x6a7f('0x53')];if(!_0x3c749e[_0x6a7f('0x3f')][_0x6a7f('0xd3')]('nolimit')){_0xb64736[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x3c749e['query'][_0x6a7f('0x22')]);_0xb64736[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x3c749e[_0x6a7f('0x3f')]['offset']);}switch(_0x482a29[_0x6a7f('0x32')]){case _0x6a7f('0x7b'):return db[_[_0x6a7f('0xa1')](_0x3c749e[_0x6a7f('0x3f')]['channel'])+_0x6a7f('0xd2')]['findAll'](_0xb64736);case _0x6a7f('0x79'):case _0x6a7f('0x2b'):return _0x482a29['get'+_[_0x6a7f('0xa1')](_0x3c749e[_0x6a7f('0x3f')]['channel'])+'Queues'](_0xb64736);}})[_0x6a7f('0x14')](function(_0x1d2f5e){return{'count':_0x11f2ef,'rows':_0x1d2f5e};})[_0x6a7f('0x14')](respondWithResult(_0x5192ba,null))[_0x6a7f('0x1d')](handleError(_0x5192ba,null));};exports[_0x6a7f('0xd4')]=function(_0x2a64a9,_0x29f1a4){var _0x255aad={};var _0x57d5c0={};var _0x2acfed;var _0x392a41;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x2a64a9[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x29f1a4,null))[_0x6a7f('0x14')](function(_0x2db59f){if(_0x2db59f){_0x2acfed=_0x2db59f;_0x57d5c0['model']=_[_0x6a7f('0x4e')](db[_0x6a7f('0xb0')]['rawAttributes']);_0x57d5c0[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x2a64a9[_0x6a7f('0x3f')]);_0x57d5c0[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x57d5c0[_0x6a7f('0x4c')],_0x57d5c0[_0x6a7f('0x3f')]);_0x255aad['attributes']=_['intersection'](_0x57d5c0[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x2a64a9['query'][_0x6a7f('0x51')]));_0x255aad['attributes']=_0x255aad[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x255aad['attributes']:_0x57d5c0[_0x6a7f('0x4c')];_0x255aad[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x2a64a9[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0x255aad[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_['pick'](_0x2a64a9[_0x6a7f('0x3f')],_0x57d5c0[_0x6a7f('0x4f')]));if(_0x2a64a9[_0x6a7f('0x3f')][_0x6a7f('0xcb')]){_0x255aad[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x255aad[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x255aad[_0x6a7f('0x52')],function(_0x559ad2){var _0x37ea66={};_0x37ea66[_0x559ad2]={'$like':'%'+_0x2a64a9['query'][_0x6a7f('0xcb')]+'%'};return _0x37ea66;})});}_0x255aad=_[_0x6a7f('0x56')]({},_0x255aad,_0x2a64a9['options']);return _0x2acfed[_0x6a7f('0xd4')](_0x255aad);}})[_0x6a7f('0x14')](function(_0x2a1727){if(_0x2a1727){_0x392a41=_0x2a1727[_0x6a7f('0x53')];if(!_0x2a64a9['query']['hasOwnProperty'](_0x6a7f('0xcf'))){_0x255aad[_0x6a7f('0x22')]=qs['limit'](_0x2a64a9['query']['limit']);_0x255aad[_0x6a7f('0x24')]=qs['offset'](_0x2a64a9[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x2acfed['getVoiceQueuesRt'](_0x255aad);}})[_0x6a7f('0x14')](function(_0x49496e){if(_0x49496e){return _0x49496e?{'count':_0x392a41,'rows':_0x49496e}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x29f1a4,null))[_0x6a7f('0x1d')](handleError(_0x29f1a4,null));};exports[_0x6a7f('0xd5')]=function(_0x30a4d5,_0xcb1da8){var _0x36d9b4={};var _0x3f8e0e={};var _0x31aef5;var _0x356c44;return db[_0x6a7f('0x38')]['findOne']({'where':{'id':_0x30a4d5[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0xcb1da8,null))[_0x6a7f('0x14')](function(_0x311cfa){if(_0x311cfa){_0x31aef5=_0x311cfa;_0x3f8e0e[_0x6a7f('0x4c')]=_['keys'](db[_0x6a7f('0xd6')][_0x6a7f('0x39')]);_0x3f8e0e[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x30a4d5[_0x6a7f('0x3f')]);_0x3f8e0e[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x3f8e0e[_0x6a7f('0x4c')],_0x3f8e0e['query']);_0x36d9b4[_0x6a7f('0x52')]=_['intersection'](_0x3f8e0e['model'],qs[_0x6a7f('0x51')](_0x30a4d5[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x36d9b4[_0x6a7f('0x52')]=_0x36d9b4[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x36d9b4['attributes']:_0x3f8e0e[_0x6a7f('0x4c')];_0x36d9b4[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x30a4d5[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0x36d9b4[_0x6a7f('0xc9')]=qs['filters'](_[_0x6a7f('0xca')](_0x30a4d5[_0x6a7f('0x3f')],_0x3f8e0e[_0x6a7f('0x4f')]));if(_0x30a4d5['query'][_0x6a7f('0xcb')]){_0x36d9b4['where']=_[_0x6a7f('0x56')](_0x36d9b4[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x36d9b4[_0x6a7f('0x52')],function(_0x330ea2){var _0x430113={};_0x430113[_0x330ea2]={'$like':'%'+_0x30a4d5['query'][_0x6a7f('0xcb')]+'%'};return _0x430113;})});}_0x36d9b4=_['merge']({},_0x36d9b4,_0x30a4d5[_0x6a7f('0x57')]);return _0x31aef5[_0x6a7f('0xd5')](_0x36d9b4);}})[_0x6a7f('0x14')](function(_0x1fbb87){if(_0x1fbb87){_0x356c44=_0x1fbb87[_0x6a7f('0x53')];if(!_0x30a4d5[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x36d9b4[_0x6a7f('0x22')]=qs['limit'](_0x30a4d5[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x36d9b4[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x30a4d5['query'][_0x6a7f('0x24')]);}return _0x31aef5[_0x6a7f('0xd5')](_0x36d9b4);}})[_0x6a7f('0x14')](function(_0x37b793){if(_0x37b793){return _0x37b793?{'count':_0x356c44,'rows':_0x37b793}:null;}})[_0x6a7f('0x14')](respondWithResult(_0xcb1da8,null))['catch'](handleError(_0xcb1da8,null));};exports[_0x6a7f('0xd7')]=function(_0xb493b5,_0xf614c1){var _0x1d4689={'raw':!![],'where':{}};var _0x34b8cb={};var _0x233d35={'count':0x0,'rows':[]};return db[_0x6a7f('0x38')]['findOne']({'where':{'id':_0xb493b5[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0xf614c1,null))[_0x6a7f('0x14')](function(_0x14ac5b){if(_0x14ac5b){_0x34b8cb[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db['VoiceRecording']['rawAttributes']);_0x34b8cb[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0xb493b5[_0x6a7f('0x3f')]);_0x34b8cb[_0x6a7f('0x4f')]=_['intersection'](_0x34b8cb[_0x6a7f('0x4c')],_0x34b8cb[_0x6a7f('0x3f')]);_0x1d4689['attributes']=_[_0x6a7f('0x50')](_0x34b8cb[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0xb493b5['query'][_0x6a7f('0x51')]));_0x1d4689[_0x6a7f('0x52')]=_0x1d4689[_0x6a7f('0x52')]['length']?_0x1d4689[_0x6a7f('0x52')]:_0x34b8cb['model'];if(!_0xb493b5[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x1d4689[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0xb493b5[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x1d4689['offset']=qs[_0x6a7f('0x24')](_0xb493b5[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}_0x1d4689['order']=qs[_0x6a7f('0xc8')](_0xb493b5[_0x6a7f('0x3f')]['sort']);_0x1d4689['where']=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0xb493b5[_0x6a7f('0x3f')],_0x34b8cb['filters']));_0x1d4689[_0x6a7f('0xc9')][_0x6a7f('0xd8')]=_0x14ac5b['id'];if(_0xb493b5[_0x6a7f('0x3f')]['filter']){_0x1d4689[_0x6a7f('0xc9')]=_['merge'](_0x1d4689[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x1d4689[_0x6a7f('0x52')],function(_0x1820ba){var _0x3e1a12={};_0x3e1a12[_0x1820ba]={'$like':'%'+_0xb493b5[_0x6a7f('0x3f')][_0x6a7f('0xcb')]+'%'};return _0x3e1a12;})});}_0x1d4689=_[_0x6a7f('0x56')]({},_0x1d4689,_0xb493b5['options']);return db['VoiceRecording'][_0x6a7f('0x23')]({'where':_0x1d4689[_0x6a7f('0xc9')]})[_0x6a7f('0x14')](function(_0x21c06b){_0x233d35['count']=_0x21c06b;if(_0xb493b5['query']['includeAll']){_0x1d4689['include']=[{'all':!![]}];}return db[_0x6a7f('0xd9')]['findAll'](_0x1d4689);})[_0x6a7f('0x14')](function(_0x3a299f){_0x233d35['rows']=_0x3a299f;return _0x233d35;});}})[_0x6a7f('0x14')](respondWithFilteredResult(_0xf614c1,_0x1d4689))[_0x6a7f('0x1d')](handleError(_0xf614c1,null));};exports[_0x6a7f('0xda')]=function(_0x4f505e,_0xbb5f83){var _0x247af9={'raw':!![],'where':{}};var _0x3fbe36={};var _0x4c26c1={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4f505e['params']['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0xbb5f83,null))[_0x6a7f('0x14')](function(_0x3c828b){if(_0x3c828b){_0x3fbe36[_0x6a7f('0x4c')]=_['keys'](db[_0x6a7f('0xdb')]['rawAttributes']);_0x3fbe36['query']=_['keys'](_0x4f505e[_0x6a7f('0x3f')]);_0x3fbe36['filters']=_['intersection'](_0x3fbe36['model'],_0x3fbe36[_0x6a7f('0x3f')]);_0x247af9[_0x6a7f('0x52')]=_[_0x6a7f('0x50')](_0x3fbe36[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x4f505e[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x247af9[_0x6a7f('0x52')]=_0x247af9[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x247af9[_0x6a7f('0x52')]:_0x3fbe36[_0x6a7f('0x4c')];if(!_0x4f505e[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x247af9[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x4f505e[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x247af9['offset']=qs[_0x6a7f('0x24')](_0x4f505e['query'][_0x6a7f('0x24')]);}_0x247af9[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x4f505e['query']['sort']);_0x247af9[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_['pick'](_0x4f505e['query'],_0x3fbe36['filters']));_0x247af9[_0x6a7f('0xc9')][_0x6a7f('0xd8')]=_0x3c828b['id'];if(_0x4f505e[_0x6a7f('0x3f')][_0x6a7f('0xcb')]){_0x247af9[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x247af9[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x247af9[_0x6a7f('0x52')],function(_0x4950c4){var _0x55e3e8={};_0x55e3e8[_0x4950c4]={'$like':'%'+_0x4f505e['query'][_0x6a7f('0xcb')]+'%'};return _0x55e3e8;})});}_0x247af9=_[_0x6a7f('0x56')]({},_0x247af9,_0x4f505e[_0x6a7f('0x57')]);return db[_0x6a7f('0xdb')][_0x6a7f('0x23')]({'where':_0x247af9[_0x6a7f('0xc9')]})[_0x6a7f('0x14')](function(_0x4385b3){_0x4c26c1[_0x6a7f('0x23')]=_0x4385b3;if(_0x4f505e[_0x6a7f('0x3f')][_0x6a7f('0x54')]){_0x247af9[_0x6a7f('0x42')]=[{'all':!![]}];}return db[_0x6a7f('0xdb')]['findAll'](_0x247af9);})[_0x6a7f('0x14')](function(_0x1ceec4){_0x4c26c1[_0x6a7f('0x45')]=_0x1ceec4;return _0x4c26c1;});}})['then'](respondWithFilteredResult(_0xbb5f83,_0x247af9))[_0x6a7f('0x1d')](handleError(_0xbb5f83,null));};exports['getChatInteractions']=function(_0x5ca415,_0x4de2cd){var _0x593f43={};var _0x24fcde={};var _0x42a2c5;var _0x485fa2;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x5ca415['params']['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x4de2cd,null))[_0x6a7f('0x14')](function(_0x46bdac){if(_0x46bdac){_0x42a2c5=_0x46bdac;_0x24fcde[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0xdc')][_0x6a7f('0x39')]);_0x24fcde[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x5ca415[_0x6a7f('0x3f')]);_0x24fcde['filters']=_[_0x6a7f('0x50')](_0x24fcde['model'],_0x24fcde[_0x6a7f('0x3f')]);_0x593f43[_0x6a7f('0x52')]=_[_0x6a7f('0x50')](_0x24fcde[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x5ca415['query'][_0x6a7f('0x51')]));_0x593f43[_0x6a7f('0x52')]=_0x593f43[_0x6a7f('0x52')]['length']?_0x593f43[_0x6a7f('0x52')]:_0x24fcde[_0x6a7f('0x4c')];_0x593f43[_0x6a7f('0xd1')]=qs['sort'](_0x5ca415[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0x593f43['where']=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x5ca415[_0x6a7f('0x3f')],_0x24fcde['filters']));if(_0x5ca415[_0x6a7f('0x3f')]['filter']){_0x593f43[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x593f43['where'],{'$or':_[_0x6a7f('0x2f')](_0x593f43['attributes'],function(_0x16329f){var _0xaa44f8={};_0xaa44f8[_0x16329f]={'$like':'%'+_0x5ca415['query'][_0x6a7f('0xcb')]+'%'};return _0xaa44f8;})});}_0x593f43=_[_0x6a7f('0x56')]({},_0x593f43,_0x5ca415[_0x6a7f('0x57')]);return _0x42a2c5[_0x6a7f('0xdd')](_0x593f43);}})[_0x6a7f('0x14')](function(_0x15ada3){if(_0x15ada3){_0x485fa2=_0x15ada3[_0x6a7f('0x53')];if(!_0x5ca415[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x593f43[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x5ca415[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x593f43[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x5ca415[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x42a2c5['getChatInteractions'](_0x593f43);}})['then'](function(_0x2492b4){if(_0x2492b4){return _0x2492b4?{'count':_0x485fa2,'rows':_0x2492b4}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x4de2cd,null))['catch'](handleError(_0x4de2cd,null));};exports[_0x6a7f('0xde')]=function(_0x3c88af,_0x930903){var _0x1990a3={};var _0x187e79={};var _0x578d6e;var _0x4441e1;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x3c88af[_0x6a7f('0x8a')]['id']}})['then'](handleEntityNotFound(_0x930903,null))[_0x6a7f('0x14')](function(_0xbf3ff2){if(_0xbf3ff2){_0x578d6e=_0xbf3ff2;_0x187e79[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0xdf')]['rawAttributes']);_0x187e79[_0x6a7f('0x3f')]=_['keys'](_0x3c88af[_0x6a7f('0x3f')]);_0x187e79['filters']=_[_0x6a7f('0x50')](_0x187e79[_0x6a7f('0x4c')],_0x187e79[_0x6a7f('0x3f')]);_0x1990a3[_0x6a7f('0x52')]=_['intersection'](_0x187e79[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x3c88af[_0x6a7f('0x3f')]['fields']));_0x1990a3[_0x6a7f('0x52')]=_0x1990a3[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x1990a3[_0x6a7f('0x52')]:_0x187e79[_0x6a7f('0x4c')];_0x1990a3[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x3c88af[_0x6a7f('0x3f')]['sort']);_0x1990a3[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x3c88af[_0x6a7f('0x3f')],_0x187e79['filters']));if(_0x3c88af['query'][_0x6a7f('0xcb')]){_0x1990a3['where']=_[_0x6a7f('0x56')](_0x1990a3['where'],{'$or':_[_0x6a7f('0x2f')](_0x1990a3[_0x6a7f('0x52')],function(_0x5e6584){var _0x22ee83={};_0x22ee83[_0x5e6584]={'$like':'%'+_0x3c88af[_0x6a7f('0x3f')][_0x6a7f('0xcb')]+'%'};return _0x22ee83;})});}_0x1990a3=_[_0x6a7f('0x56')]({},_0x1990a3,_0x3c88af['options']);return _0x578d6e[_0x6a7f('0xde')](_0x1990a3);}})[_0x6a7f('0x14')](function(_0x542076){if(_0x542076){_0x4441e1=_0x542076[_0x6a7f('0x53')];if(!_0x3c88af[_0x6a7f('0x3f')]['hasOwnProperty']('nolimit')){_0x1990a3[_0x6a7f('0x22')]=qs['limit'](_0x3c88af[_0x6a7f('0x3f')]['limit']);_0x1990a3[_0x6a7f('0x24')]=qs['offset'](_0x3c88af[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x578d6e[_0x6a7f('0xde')](_0x1990a3);}})[_0x6a7f('0x14')](function(_0x596e74){if(_0x596e74){return _0x596e74?{'count':_0x4441e1,'rows':_0x596e74}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x930903,null))['catch'](handleError(_0x930903,null));};exports[_0x6a7f('0xe0')]=function(_0x246926,_0x3744ef){var _0x4a0407={'raw':!![],'where':{}};var _0x5f03f1={};var _0x2cfba6={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x246926[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x3744ef,null))[_0x6a7f('0x14')](function(_0x268e7b){if(_0x268e7b){_0x5f03f1[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0xe1')][_0x6a7f('0x39')]);_0x5f03f1[_0x6a7f('0x3f')]=_['keys'](_0x246926['query']);_0x5f03f1[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x5f03f1[_0x6a7f('0x4c')],_0x5f03f1['query']);_0x4a0407[_0x6a7f('0x52')]=_['intersection'](_0x5f03f1[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x246926[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x4a0407[_0x6a7f('0x52')]=_0x4a0407[_0x6a7f('0x52')]['length']?_0x4a0407[_0x6a7f('0x52')]:_0x5f03f1['model'];if(!_0x246926[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x4a0407[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x246926['query'][_0x6a7f('0x22')]);_0x4a0407[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x246926['query'][_0x6a7f('0x24')]);}_0x4a0407[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x246926[_0x6a7f('0x3f')]['sort']);_0x4a0407[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x246926[_0x6a7f('0x3f')],_0x5f03f1[_0x6a7f('0x4f')]));_0x4a0407['where'][_0x6a7f('0xd8')]=_0x268e7b['id'];if(_0x246926[_0x6a7f('0x3f')][_0x6a7f('0xcb')]){_0x4a0407[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x4a0407[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x4a0407[_0x6a7f('0x52')],function(_0x578933){var _0x47699a={};_0x47699a[_0x578933]={'$like':'%'+_0x246926[_0x6a7f('0x3f')][_0x6a7f('0xcb')]+'%'};return _0x47699a;})});}_0x4a0407=_[_0x6a7f('0x56')]({},_0x4a0407,_0x246926[_0x6a7f('0x57')]);return db['MailInteraction'][_0x6a7f('0x23')]({'where':_0x4a0407['where']})[_0x6a7f('0x14')](function(_0x107316){_0x2cfba6[_0x6a7f('0x23')]=_0x107316;if(_0x246926[_0x6a7f('0x3f')][_0x6a7f('0x54')]){_0x4a0407[_0x6a7f('0x42')]=[{'all':!![]}];}return db[_0x6a7f('0xe1')][_0x6a7f('0x44')](_0x4a0407);})['then'](function(_0x6275dd){_0x2cfba6[_0x6a7f('0x45')]=_0x6275dd;return _0x2cfba6;});}})[_0x6a7f('0x14')](respondWithFilteredResult(_0x3744ef,_0x4a0407))[_0x6a7f('0x1d')](handleError(_0x3744ef,null));};exports[_0x6a7f('0xe2')]=function(_0x21cf32,_0x5295b8){var _0x29aab4={};var _0x4c2f39={};var _0x3a7a2b;var _0x5ec322;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x21cf32[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x5295b8,null))[_0x6a7f('0x14')](function(_0xe673){if(_0xe673){_0x3a7a2b=_0xe673;_0x4c2f39[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db['SmsInteraction'][_0x6a7f('0x39')]);_0x4c2f39[_0x6a7f('0x3f')]=_['keys'](_0x21cf32['query']);_0x4c2f39[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x4c2f39[_0x6a7f('0x4c')],_0x4c2f39[_0x6a7f('0x3f')]);_0x29aab4[_0x6a7f('0x52')]=_[_0x6a7f('0x50')](_0x4c2f39[_0x6a7f('0x4c')],qs['fields'](_0x21cf32['query'][_0x6a7f('0x51')]));_0x29aab4[_0x6a7f('0x52')]=_0x29aab4[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x29aab4[_0x6a7f('0x52')]:_0x4c2f39[_0x6a7f('0x4c')];_0x29aab4[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x21cf32[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0x29aab4[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x21cf32['query'],_0x4c2f39[_0x6a7f('0x4f')]));if(_0x21cf32['query'][_0x6a7f('0xcb')]){_0x29aab4['where']=_[_0x6a7f('0x56')](_0x29aab4[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x29aab4[_0x6a7f('0x52')],function(_0x16d8d5){var _0x125302={};_0x125302[_0x16d8d5]={'$like':'%'+_0x21cf32['query'][_0x6a7f('0xcb')]+'%'};return _0x125302;})});}_0x29aab4=_['merge']({},_0x29aab4,_0x21cf32[_0x6a7f('0x57')]);return _0x3a7a2b[_0x6a7f('0xe2')](_0x29aab4);}})['then'](function(_0x63928e){if(_0x63928e){_0x5ec322=_0x63928e[_0x6a7f('0x53')];if(!_0x21cf32[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x29aab4[_0x6a7f('0x22')]=qs['limit'](_0x21cf32[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x29aab4['offset']=qs[_0x6a7f('0x24')](_0x21cf32[_0x6a7f('0x3f')]['offset']);}return _0x3a7a2b['getSmsInteractions'](_0x29aab4);}})['then'](function(_0x5c03f2){if(_0x5c03f2){return _0x5c03f2?{'count':_0x5ec322,'rows':_0x5c03f2}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x5295b8,null))[_0x6a7f('0x1d')](handleError(_0x5295b8,null));};exports[_0x6a7f('0xe3')]=function(_0x457dd0,_0x26c20d){var _0x4be39a={};var _0x4df7c0={};var _0x540206;var _0x129cd0;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x457dd0[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x26c20d,null))[_0x6a7f('0x14')](function(_0x5d9c94){if(_0x5d9c94){_0x540206=_0x5d9c94;_0x4df7c0[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0xe4')][_0x6a7f('0x39')]);_0x4df7c0['query']=_[_0x6a7f('0x4e')](_0x457dd0[_0x6a7f('0x3f')]);_0x4df7c0[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x4df7c0[_0x6a7f('0x4c')],_0x4df7c0[_0x6a7f('0x3f')]);_0x4be39a['attributes']=_[_0x6a7f('0x50')](_0x4df7c0['model'],qs[_0x6a7f('0x51')](_0x457dd0['query'][_0x6a7f('0x51')]));_0x4be39a[_0x6a7f('0x52')]=_0x4be39a['attributes'][_0x6a7f('0x53')]?_0x4be39a[_0x6a7f('0x52')]:_0x4df7c0[_0x6a7f('0x4c')];_0x4be39a[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x457dd0[_0x6a7f('0x3f')]['sort']);_0x4be39a['where']=qs[_0x6a7f('0x4f')](_['pick'](_0x457dd0[_0x6a7f('0x3f')],_0x4df7c0[_0x6a7f('0x4f')]));if(_0x457dd0[_0x6a7f('0x3f')][_0x6a7f('0xcb')]){_0x4be39a[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x4be39a[_0x6a7f('0xc9')],{'$or':_[_0x6a7f('0x2f')](_0x4be39a[_0x6a7f('0x52')],function(_0x26389b){var _0x359912={};_0x359912[_0x26389b]={'$like':'%'+_0x457dd0[_0x6a7f('0x3f')]['filter']+'%'};return _0x359912;})});}_0x4be39a=_[_0x6a7f('0x56')]({},_0x4be39a,_0x457dd0[_0x6a7f('0x57')]);return _0x540206[_0x6a7f('0xe3')](_0x4be39a);}})[_0x6a7f('0x14')](function(_0x5b3e8e){if(_0x5b3e8e){_0x129cd0=_0x5b3e8e[_0x6a7f('0x53')];if(!_0x457dd0[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x4be39a[_0x6a7f('0x22')]=qs['limit'](_0x457dd0[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x4be39a[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x457dd0['query'][_0x6a7f('0x24')]);}return _0x540206['getFaxInteractions'](_0x4be39a);}})[_0x6a7f('0x14')](function(_0x4fbff4){if(_0x4fbff4){return _0x4fbff4?{'count':_0x129cd0,'rows':_0x4fbff4}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x26c20d,null))[_0x6a7f('0x1d')](handleError(_0x26c20d,null));};exports[_0x6a7f('0xe5')]=function(_0xae01d4,_0x38b288){var _0x28576c={};var _0x2ae475={};var _0xed81d0;var _0xdcea9d;return db[_0x6a7f('0x38')]['findOne']({'where':{'id':_0xae01d4['params']['id']}})['then'](handleEntityNotFound(_0x38b288,null))[_0x6a7f('0x14')](function(_0x542f0b){if(_0x542f0b){_0xed81d0=_0x542f0b;_0x2ae475[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db['WhatsappInteraction'][_0x6a7f('0x39')]);_0x2ae475[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0xae01d4[_0x6a7f('0x3f')]);_0x2ae475['filters']=_[_0x6a7f('0x50')](_0x2ae475[_0x6a7f('0x4c')],_0x2ae475[_0x6a7f('0x3f')]);_0x28576c[_0x6a7f('0x52')]=_['intersection'](_0x2ae475['model'],qs[_0x6a7f('0x51')](_0xae01d4[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x28576c[_0x6a7f('0x52')]=_0x28576c[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0x28576c[_0x6a7f('0x52')]:_0x2ae475[_0x6a7f('0x4c')];_0x28576c[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0xae01d4[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0x28576c[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0xae01d4[_0x6a7f('0x3f')],_0x2ae475['filters']));if(_0xae01d4['query'][_0x6a7f('0xcb')]){_0x28576c[_0x6a7f('0xc9')]=_[_0x6a7f('0x56')](_0x28576c[_0x6a7f('0xc9')],{'$or':_['map'](_0x28576c[_0x6a7f('0x52')],function(_0x1ff9e4){var _0x4b1af5={};_0x4b1af5[_0x1ff9e4]={'$like':'%'+_0xae01d4[_0x6a7f('0x3f')]['filter']+'%'};return _0x4b1af5;})});}_0x28576c=_['merge']({},_0x28576c,_0xae01d4[_0x6a7f('0x57')]);return _0xed81d0[_0x6a7f('0xe5')](_0x28576c);}})[_0x6a7f('0x14')](function(_0x28d702){if(_0x28d702){_0xdcea9d=_0x28d702[_0x6a7f('0x53')];if(!_0xae01d4[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0x28576c[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0xae01d4['query'][_0x6a7f('0x22')]);_0x28576c[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0xae01d4[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0xed81d0['getWhatsappInteractions'](_0x28576c);}})[_0x6a7f('0x14')](function(_0x171186){if(_0x171186){return _0x171186?{'count':_0xdcea9d,'rows':_0x171186}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x38b288,null))[_0x6a7f('0x1d')](handleError(_0x38b288,null));};exports[_0x6a7f('0xe6')]=function(_0x3511a5,_0x378d3a,_0x5957e4){var _0x2c87eb;var _0x81b9f6;var _0x3efef1;var _0x2872cc=!_['isNil'](_0x3511a5['params']['id'])?_0x3511a5[_0x6a7f('0x8a')]['id']:!_['isNil'](_0x3511a5['user']['id'])?_0x3511a5[_0x6a7f('0x79')]['id']:null;return db[_0x6a7f('0x38')]['find']({'where':{'id':_0x2872cc,'role':{'$or':[_0x6a7f('0x7b'),_0x6a7f('0x79'),'agent']}},'attributes':['id',_0x6a7f('0x34'),_0x6a7f('0xe7'),_0x6a7f('0xe8'),_0x6a7f('0x32'),_0x6a7f('0x5f'),_0x6a7f('0x9d')]})[_0x6a7f('0x14')](function(_0xd6ce51){if(_0xd6ce51){if(_0xd6ce51[_0x6a7f('0x32')]==='agent'){_0x2c87eb=_0xd6ce51;if(_0x3511a5[_0x6a7f('0x5b')]['interface']){_0x3efef1=util[_0x6a7f('0xa9')]('LOCAL/%s@from-sip/n',_0x2c87eb[_0x3511a5[_0x6a7f('0x5b')][_0x6a7f('0x9f')]]);}else if(_0x3511a5[_0x6a7f('0x5b')]['intrf']){_0x3efef1=util['format'](_0x6a7f('0xaa'),_0x3511a5[_0x6a7f('0x5b')][_0x6a7f('0xe9')]);}else{_0x3efef1=util[_0x6a7f('0xa9')](_0x6a7f('0xaa'),_0x2c87eb[_0x6a7f('0x34')]);}socket['to'](util[_0x6a7f('0xa9')]('user:%s',_0x2c87eb['name']))[_0x6a7f('0xa6')](_0x6a7f('0xea'),{'user':{'id':_0x2c87eb['id'],'name':_0x2c87eb[_0x6a7f('0x34')]},'ip':_0x3511a5[_0x6a7f('0xeb')]['x-forwarded-for']||_0x3511a5[_0x6a7f('0xec')][_0x6a7f('0xed')]||_0x3511a5['socket'][_0x6a7f('0xed')]||_0x3511a5['connection'][_0x6a7f('0xee')][_0x6a7f('0xed')]});return db[_0x6a7f('0xb0')]['destroy']({'where':{'membername':_0x2c87eb['name']},'individualHooks':!![]});}}else{throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x2c87eb){return _0x2c87eb['getVoiceQueues']({'raw':!![]});}})[_0x6a7f('0x14')](function(_0xd37213){if(_0x2c87eb){var _0xe90913=[];if(_0xd37213){_0x81b9f6=_0xd37213;if(_0x81b9f6[_0x6a7f('0x53')]){for(var _0x34a228=0x0;_0x34a228<_0x81b9f6['length'];_0x34a228++){_0xe90913[_0x6a7f('0x43')]({'membername':_0x2c87eb[_0x6a7f('0x34')],'UserId':_0x2c87eb['id'],'queue_name':_0x81b9f6[_0x34a228]['name'],'VoiceQueueId':_0x81b9f6[_0x34a228]['id'],'interface':_0x3efef1,'paused':_0x2c87eb[_0x6a7f('0x9d')]||![],'penalty':_0x81b9f6[_0x34a228][_0x6a7f('0xef')]||0x0});}return BPromise[_0x6a7f('0x86')](_0xe90913,function(_0x299bc5){return db[_0x6a7f('0xb0')][_0x6a7f('0xf0')](_0x299bc5);});}}}})[_0x6a7f('0x14')](function(){if(_0x2c87eb){return db['MemberReport'][_0x6a7f('0x44')]({'where':{'membername':_0x2c87eb[_0x6a7f('0x34')],'exitAt':null}});}})['then'](function(_0x4a5ace){if(_0x2c87eb){var _0x56f10b=[];_0x4a5ace[_0x6a7f('0xf1')](function(_0xa221d5){_0x56f10b[_0x6a7f('0x43')](_0xa221d5[_0x6a7f('0x5a')]({'exitAt':moment()['format'](_0x6a7f('0xf2'))}));});return BPromise[_0x6a7f('0x59')](_0x56f10b);}})[_0x6a7f('0x14')](function(){if(_0x2c87eb){var _0x2420fb=[];var _0x233974=[];var _0x4f07d2=utils[_0x6a7f('0xf3')]();var _0x5a30d0={'membername':_0x2c87eb[_0x6a7f('0x34')],'interface':_0x3efef1,'enterAt':moment()[_0x6a7f('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2c87eb[_0x6a7f('0x32')],'internal':_0x2c87eb[_0x6a7f('0x5f')]};_0x4f07d2[_0x6a7f('0xf1')](function(_0x1240d8){_0x2420fb[_0x6a7f('0x43')](_[_0x6a7f('0x56')]({'channel':_0x1240d8,'type':_0x6a7f('0xf4'),'data1':_0x3511a5['body']['device'],'data2':_0x3efef1},_0x5a30d0));if(_0x2c87eb['loginInPause']){_0x233974[_0x6a7f('0x43')](_[_0x6a7f('0x56')]({'channel':_0x1240d8,'type':_0x6a7f('0xf5'),'data1':_0x6a7f('0xf6')},_0x5a30d0));}});return db[_0x6a7f('0xf7')][_0x6a7f('0x84')](_0x2420fb[_0x6a7f('0xc5')](_0x233974),{'individualHooks':!![]});}})['then'](function(){if(_0x2c87eb){return _0x2c87eb['update']({'online':!![],'lastLoginAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2')),'voicePause':_0x2c87eb[_0x6a7f('0x9d')]||![],'mailPause':_0x2c87eb['loginInPause']||![],'chatPause':_0x2c87eb[_0x6a7f('0x9d')]||![],'faxPause':_0x2c87eb[_0x6a7f('0x9d')]||![],'smsPause':_0x2c87eb['loginInPause']||![],'openchannelPause':_0x2c87eb[_0x6a7f('0x9d')]||![],'whatsappPause':_0x2c87eb[_0x6a7f('0x9d')]||![],'pauseType':_0x2c87eb['loginInPause']?_0x6a7f('0xf6'):null,'interface':_0x3efef1,'lastPauseAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2'))});}})[_0x6a7f('0x14')](function(_0xd982d9){if(_0x3511a5[_0x6a7f('0xf8')]){return _0x5957e4();}else{return BPromise['resolve'](_0xd982d9)[_0x6a7f('0x14')](respondWithResult(_0x378d3a,null));}})[_0x6a7f('0x1d')](handleError(_0x378d3a,null));};exports[_0x6a7f('0xf9')]=function(_0x3f96ad,_0x19808c){var _0x3c216a;return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x3f96ad['params']['id'],'role':_0x6a7f('0x2b')},'attributes':['id','name',_0x6a7f('0x32')]})[_0x6a7f('0x14')](handleEntityNotFound(_0x19808c,null))[_0x6a7f('0x14')](function(_0x145e16){if(_0x145e16){_0x3c216a=_0x145e16;return db[_0x6a7f('0xb0')][_0x6a7f('0x27')]({'where':{'membername':_0x3c216a[_0x6a7f('0x34')]},'individualHooks':!![]});}})[_0x6a7f('0x14')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3c216a[_0x6a7f('0x34')],'exitAt':null}});})[_0x6a7f('0x14')](function(_0x2e846d){var _0x48c9d2=[];_0x2e846d[_0x6a7f('0xf1')](function(_0x113ade){_0x48c9d2[_0x6a7f('0x43')](_0x113ade['update']({'exitAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2'))}));});return BPromise['all'](_0x48c9d2);})['then'](function(){return _0x3c216a['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6a7f('0x14')](respondWithResult(_0x19808c,null))[_0x6a7f('0x1d')](handleError(_0x19808c,null));};exports[_0x6a7f('0xfa')]=function(_0x4c19d1,_0x513029){var _0x463dc4;return db['UserVoiceQueueRt'][_0x6a7f('0x5a')]({'paused':0x1},{'where':{'UserId':_0x4c19d1[_0x6a7f('0x8a')]['id']},'individualHooks':!![]})[_0x6a7f('0x14')](function(){return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x4c19d1[_0x6a7f('0x8a')]['id'],'role':'agent'},'attributes':['id',_0x6a7f('0x34'),_0x6a7f('0x32'),_0x6a7f('0x5f'),_0x6a7f('0x9f')]});})[_0x6a7f('0x14')](handleEntityNotFound(_0x513029,null))[_0x6a7f('0x14')](function(_0x15eece){if(_0x15eece){_0x463dc4=_0x15eece;return respondWithRpcPromise(_0x6a7f('0xfb'),'pause',{'id':_0x463dc4['id'],'name':_0x463dc4[_0x6a7f('0x34')],'pause':!![]});}})[_0x6a7f('0x14')](function(){if(_0x463dc4){return db[_0x6a7f('0xf7')]['findAll']({'where':{'membername':_0x463dc4[_0x6a7f('0x34')],'type':_0x6a7f('0xf5'),'exitAt':null}});}})[_0x6a7f('0x14')](function(_0x31e707){if(_0x31e707[_0x6a7f('0x53')]){var _0x1dc852=moment()['format'](_0x6a7f('0xf2'));for(var _0x37e1b8=0x0,_0x218875=_0x31e707[_0x6a7f('0x53')];_0x37e1b8<_0x218875;_0x37e1b8++){_0x31e707[_0x37e1b8][_0x6a7f('0xfc')]({'exitAt':_0x1dc852});}}})[_0x6a7f('0x14')](function(){var _0x4f8666=[];var _0x5e1765=utils[_0x6a7f('0xf3')]();_0x5e1765[_0x6a7f('0xf1')](function(_0x2f93a4){_0x4f8666[_0x6a7f('0x43')]({'channel':_0x2f93a4,'membername':_0x463dc4['name'],'interface':_[_0x6a7f('0x64')](_0x463dc4[_0x6a7f('0x9f')])?util['format'](_0x6a7f('0xaa'),_0x463dc4[_0x6a7f('0x34')]):_0x463dc4[_0x6a7f('0x9f')],'type':_0x6a7f('0xf5'),'enterAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2')),'data1':_0x4c19d1[_0x6a7f('0x5b')][_0x6a7f('0x3b')]||_0x6a7f('0xfd'),'role':_0x463dc4['role'],'internal':_0x463dc4['internal']});});return db['MemberReport'][_0x6a7f('0x84')](_0x4f8666,{'individualHooks':!![]});})[_0x6a7f('0x14')](function(){return _0x463dc4[_0x6a7f('0x5a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4c19d1['body'][_0x6a7f('0x3b')]||_0x6a7f('0xfd'),'lastPauseAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2'))});})[_0x6a7f('0x14')](respondWithResult(_0x513029,null))[_0x6a7f('0x1d')](handleError(_0x513029,null));};exports[_0x6a7f('0xfe')]=function(_0x36c57a,_0x268572){var _0x1406a3;return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x36c57a[_0x6a7f('0x8a')]['id']},'attributes':['id',_0x6a7f('0x34'),_0x6a7f('0x32'),_0x6a7f('0x9e'),'mailPause','chatPause',_0x6a7f('0xff'),_0x6a7f('0x100'),_0x6a7f('0x101'),'whatsapppause',_0x6a7f('0x102'),'lastPauseAt']})[_0x6a7f('0x14')](handleEntityNotFound(_0x268572,null))['then'](function(_0x33d25a){if(_0x33d25a){_0x1406a3=_0x33d25a;if(_0x36c57a[_0x6a7f('0x5b')][_0x6a7f('0x9b')]&&!utils[_0x6a7f('0xa0')](_0x36c57a['body'][_0x6a7f('0x9b')])){throw new db[(_0x6a7f('0x90'))][(_0x6a7f('0x8d'))](_0x6a7f('0xac'));}switch(_0x36c57a[_0x6a7f('0x5b')][_0x6a7f('0x9b')]){case _0x6a7f('0xa7'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x1406a3['id'],'name':_0x1406a3[_0x6a7f('0x34')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x1406a3['id']},'individualHooks':!![]});})['then'](function(){return db[_0x6a7f('0xf7')][_0x6a7f('0x33')]({'where':{'channel':_0x36c57a['body'][_0x6a7f('0x9b')],'membername':_0x1406a3[_0x6a7f('0x34')],'type':'PAUSE','exitAt':null}});})[_0x6a7f('0x14')](function(_0x4ae247){if(_0x4ae247){return _0x4ae247[_0x6a7f('0x5a')]({'exitAt':moment()[_0x6a7f('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6a7f('0x103')},{'individualHooks':!![]});}return null;})[_0x6a7f('0x14')](function(){return _0x1406a3[_0x6a7f('0x5a')]({'voicePause':![]});});case _0x6a7f('0x104'):case'chat':case _0x6a7f('0x49'):case'sms':case _0x6a7f('0x4b'):case _0x6a7f('0x4a'):return db[_0x6a7f('0xf7')][_0x6a7f('0x33')]({'where':{'channel':_0x36c57a[_0x6a7f('0x5b')]['channel'],'membername':_0x1406a3[_0x6a7f('0x34')],'type':_0x6a7f('0xf5'),'exitAt':null}})['then'](function(_0x25f089){if(_0x25f089){return _0x25f089[_0x6a7f('0x5a')]({'exitAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2')),'data2':_0x6a7f('0x103')},{'individualHooks':!![]});}return null;})[_0x6a7f('0x14')](function(){var _0x5f2593={};_[_0x6a7f('0x26')](_0x5f2593,util[_0x6a7f('0xa9')](_0x6a7f('0x105'),_0x36c57a[_0x6a7f('0x5b')][_0x6a7f('0x9b')],_0x6a7f('0x106')),![]);return _0x1406a3[_0x6a7f('0x5a')](_0x5f2593);});default:return respondWithRpcPromise('QueuePause',_0x6a7f('0xfe'),{'id':_0x1406a3['id'],'name':_0x1406a3['name'],'pause':![]})[_0x6a7f('0x14')](function(){return db[_0x6a7f('0xb0')]['update']({'paused':0x0},{'where':{'UserId':_0x1406a3['id']}});})[_0x6a7f('0x14')](function(){return db[_0x6a7f('0xf7')][_0x6a7f('0x44')]({'where':{'membername':_0x1406a3[_0x6a7f('0x34')],'type':_0x6a7f('0xf5'),'exitAt':null}});})[_0x6a7f('0x14')](function(_0x3beb41){var _0x266134=[];_0x3beb41['forEach'](function(_0x505674){_0x266134['push'](_0x505674[_0x6a7f('0x5a')]({'exitAt':moment()[_0x6a7f('0xa9')](_0x6a7f('0xf2')),'data2':_0x6a7f('0x103')}));});return BPromise[_0x6a7f('0x59')](_0x266134);})[_0x6a7f('0x14')](function(){return _0x1406a3[_0x6a7f('0x5a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6a7f('0x14')](respondWithResult(_0x268572,null))['catch'](handleError(_0x268572,null));};exports['getTeams']=function(_0x34ce54,_0x221bbd){var _0xea34c3={};var _0x3a7591={};var _0x45461e;var _0x4cefc7;return db['User']['findOne']({'where':{'id':_0x34ce54[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x221bbd,null))['then'](function(_0x185666){if(_0x185666){_0x45461e=_0x185666;_0x3a7591[_0x6a7f('0x4c')]=_['keys'](db[_0x6a7f('0x107')]['rawAttributes']);_0x3a7591[_0x6a7f('0x3f')]=_[_0x6a7f('0x4e')](_0x34ce54[_0x6a7f('0x3f')]);_0x3a7591['filters']=_['intersection'](_0x3a7591[_0x6a7f('0x4c')],_0x3a7591[_0x6a7f('0x3f')]);_0xea34c3[_0x6a7f('0x52')]=_['intersection'](_0x3a7591[_0x6a7f('0x4c')],qs['fields'](_0x34ce54[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0xea34c3['attributes']=_0xea34c3[_0x6a7f('0x52')][_0x6a7f('0x53')]?_0xea34c3['attributes']:_0x3a7591[_0x6a7f('0x4c')];_0xea34c3[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x34ce54[_0x6a7f('0x3f')][_0x6a7f('0xc8')]);_0xea34c3['where']=qs[_0x6a7f('0x4f')](_[_0x6a7f('0xca')](_0x34ce54[_0x6a7f('0x3f')],_0x3a7591['filters']));if(_0x34ce54[_0x6a7f('0x3f')]['filter']){_0xea34c3['where']=_['merge'](_0xea34c3[_0x6a7f('0xc9')],{'$or':_['map'](_0xea34c3[_0x6a7f('0x52')],function(_0xbda6c6){var _0x543f4e={};_0x543f4e[_0xbda6c6]={'$like':'%'+_0x34ce54['query'][_0x6a7f('0xcb')]+'%'};return _0x543f4e;})});}_0xea34c3=_[_0x6a7f('0x56')]({},_0xea34c3,_0x34ce54[_0x6a7f('0x57')]);return _0x45461e['getTeams'](_0xea34c3);}})['then'](function(_0x4bd806){if(_0x4bd806){_0x4cefc7=_0x4bd806[_0x6a7f('0x53')];if(!_0x34ce54[_0x6a7f('0x3f')][_0x6a7f('0xd3')](_0x6a7f('0xcf'))){_0xea34c3[_0x6a7f('0x22')]=qs[_0x6a7f('0x22')](_0x34ce54[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0xea34c3[_0x6a7f('0x24')]=qs[_0x6a7f('0x24')](_0x34ce54[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x45461e['getTeams'](_0xea34c3);}})[_0x6a7f('0x14')](function(_0x2600e3){if(_0x2600e3){return _0x2600e3?{'count':_0x4cefc7,'rows':_0x2600e3}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x221bbd,null))[_0x6a7f('0x1d')](handleError(_0x221bbd,null));};exports[_0x6a7f('0x108')]=function(_0x327c99,_0x533802){return db[_0x6a7f('0x38')][_0x6a7f('0x33')]({'where':{'id':_0x327c99[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x533802,null))[_0x6a7f('0x14')](function(_0x30d42f){if(_0x30d42f){var _0xd94e9e=_0x30d42f[_0x6a7f('0x28')]({'plain':!![]});return _0x30d42f['addTeams'](_0x327c99['body'][_0x6a7f('0x5d')],_['omit'](_0x327c99[_0x6a7f('0x5b')],[_0x6a7f('0x5d'),'id'])||{})[_0x6a7f('0x14')](function(){for(var _0x54a559=0x0;_0x54a559<_0x327c99[_0x6a7f('0x5b')][_0x6a7f('0x5d')][_0x6a7f('0x53')];_0x54a559++){var _0x2009cf=[];var _0x1ec18e={};db[_0x6a7f('0x107')][_0x6a7f('0x94')]({'where':{'id':_0x327c99[_0x6a7f('0x5b')][_0x6a7f('0x5d')][_0x54a559]}})[_0x6a7f('0x14')](function(_0x45432b){_0x1ec18e=_0x45432b[_0x6a7f('0x47')];_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x109')]()[_0x6a7f('0x14')](function(_0x316c30){for(var _0x2bc8c7=0x0;_0x2bc8c7<_0x316c30[_0x6a7f('0x53')];_0x2bc8c7++){_0x316c30[_0x2bc8c7][_0x6a7f('0x10a')]('channel','Voice');}return _0x316c30;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x10b')]()[_0x6a7f('0x14')](function(_0x421288){for(var _0x4cc6da=0x0;_0x4cc6da<_0x421288['length'];_0x4cc6da++){_0x421288[_0x4cc6da]['setDataValue'](_0x6a7f('0x9b'),_0x6a7f('0x10c'));}return _0x421288;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x10d')]()[_0x6a7f('0x14')](function(_0x5cf276){for(var _0x36b3e2=0x0;_0x36b3e2<_0x5cf276['length'];_0x36b3e2++){_0x5cf276[_0x36b3e2][_0x6a7f('0x10a')]('channel',_0x6a7f('0x10e'));}return _0x5cf276;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x10f')]()['then'](function(_0x567944){for(var _0x1fccc2=0x0;_0x1fccc2<_0x567944[_0x6a7f('0x53')];_0x1fccc2++){_0x567944[_0x1fccc2][_0x6a7f('0x10a')](_0x6a7f('0x9b'),_0x6a7f('0x110'));}return _0x567944;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b['getWhatsappQueues']()[_0x6a7f('0x14')](function(_0xbdc80f){for(var _0x1a44f3=0x0;_0x1a44f3<_0xbdc80f[_0x6a7f('0x53')];_0x1a44f3++){_0xbdc80f[_0x1a44f3]['setDataValue']('channel',_0x6a7f('0x111'));}return _0xbdc80f;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x112')]()[_0x6a7f('0x14')](function(_0x44a9a0){for(var _0x321a8e=0x0;_0x321a8e<_0x44a9a0[_0x6a7f('0x53')];_0x321a8e++){_0x44a9a0[_0x321a8e][_0x6a7f('0x10a')]('channel',_0x6a7f('0x113'));}return _0x44a9a0;}));_0x2009cf[_0x6a7f('0x43')](_0x45432b[_0x6a7f('0x114')]()[_0x6a7f('0x14')](function(_0x1644d0){for(var _0x33756d=0x0;_0x33756d<_0x1644d0['length'];_0x33756d++){_0x1644d0[_0x33756d][_0x6a7f('0x10a')](_0x6a7f('0x9b'),_0x6a7f('0x115'));}return _0x1644d0;}));return BPromise['all'](_0x2009cf);})[_0x6a7f('0x14')](function(_0x4d6f51){var _0x255f6f=_['flatten'](_0x4d6f51);_0x2009cf=[];return db[_0x6a7f('0x66')][_0x6a7f('0x116')](function(_0x2ffa8f){for(var _0xd0c2be=0x0;_0xd0c2be<_0x255f6f[_0x6a7f('0x53')];_0xd0c2be++){_0x2009cf[_0x6a7f('0x43')](_0x255f6f[_0xd0c2be][_0x6a7f('0x117')](_0xd94e9e['id']),{'transaction':_0x2ffa8f});}return BPromise['all'](_0x2009cf)[_0x6a7f('0x14')](function(){if(_0xd94e9e[_0x6a7f('0x9c')]){return BPromise[_0x6a7f('0x86')](_['filter'](_0x255f6f,function(_0x35f7e6){return _0x35f7e6['getDataValue'](_0x6a7f('0x9b'))===_0x6a7f('0x118');}),function(_0x409d31){return db[_0x6a7f('0xb0')][_0x6a7f('0xf0')]({'membername':_0xd94e9e[_0x6a7f('0x34')],'UserId':_0xd94e9e['id'],'queue_name':_0x409d31[_0x6a7f('0x34')],'VoiceQueueId':_0x409d31['id'],'interface':_[_0x6a7f('0x64')](_0xd94e9e[_0x6a7f('0x9f')])?util[_0x6a7f('0xa9')](_0x6a7f('0xaa'),_0xd94e9e[_0x6a7f('0x34')]):_0xd94e9e['interface'],'paused':_0xd94e9e[_0x6a7f('0x9e')]||![],'penalty':_0xd94e9e[_0x6a7f('0x119')]},{'transaction':_0x2ffa8f});});}else{return;}})[_0x6a7f('0x14')](function(){for(var _0x3f1c6c=0x0;_0x3f1c6c<_0x255f6f[_0x6a7f('0x53')];_0x3f1c6c++){var _0x1222e1=_0x255f6f[_0x3f1c6c]['getDataValue'](_0x6a7f('0x9b'));var _0x29bae8=_0x1222e1+'QueueId';socket[_0x6a7f('0xa6')](_0x6a7f('0x79')+_0x1222e1+'Queue:save',{'UserId':_0xd94e9e['id'],['queueField']:_0x255f6f[_0x3f1c6c]['id']});}});});})[_0x6a7f('0x14')](function(){db[_0x6a7f('0x11a')]['findOne']({'where':{'teamId':_0x1ec18e['id']}})['then'](function(_0x535e0e){if(_0x535e0e){db[_0x6a7f('0x11b')][_0x6a7f('0x78')]({'UserId':_0x327c99[_0x6a7f('0x8a')]['id'],'VoicePrefixId':_0x535e0e[_0x6a7f('0x11c')]});}});});}});}})[_0x6a7f('0x14')](respondWithStatusCode(_0x533802,null))[_0x6a7f('0x1d')](handleError(_0x533802,null));};exports['removeTeams']=function(_0x3fd93f,_0x596a81){return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x3fd93f[_0x6a7f('0x8a')]['id']}})['then'](handleEntityNotFound(_0x596a81,null))[_0x6a7f('0x14')](function(_0x3a084d){if(_0x3a084d){var _0x56102f=_0x3a084d[_0x6a7f('0x28')]({'plain':!![]});var _0x58f5ed=_0x3fd93f[_0x6a7f('0x3f')]['ids'];return _0x3a084d[_0x6a7f('0x11d')](_0x58f5ed)[_0x6a7f('0x14')](function(){for(var _0x511940=0x0;_0x511940<_0x58f5ed['length'];_0x511940++){var _0x4b4157=[];var _0x1a2abc={};db['Team'][_0x6a7f('0x94')]({'where':{'id':_0x58f5ed[_0x511940]}})[_0x6a7f('0x14')](function(_0x37bd4c){_0x1a2abc=_0x37bd4c['dataValues'];_0x4b4157[_0x6a7f('0x43')](_0x37bd4c[_0x6a7f('0x109')]()[_0x6a7f('0x14')](function(_0x249711){for(var _0x2e455d=0x0;_0x2e455d<_0x249711[_0x6a7f('0x53')];_0x2e455d++){_0x249711[_0x2e455d][_0x6a7f('0x10a')](_0x6a7f('0x9b'),'Voice');}return _0x249711;}));_0x4b4157[_0x6a7f('0x43')](_0x37bd4c[_0x6a7f('0x10b')]()[_0x6a7f('0x14')](function(_0x5109c6){for(var _0x58ca9a=0x0;_0x58ca9a<_0x5109c6[_0x6a7f('0x53')];_0x58ca9a++){_0x5109c6[_0x58ca9a][_0x6a7f('0x10a')](_0x6a7f('0x9b'),'Chat');}return _0x5109c6;}));_0x4b4157[_0x6a7f('0x43')](_0x37bd4c['getMailQueues']()[_0x6a7f('0x14')](function(_0x2936be){for(var _0x3d3c37=0x0;_0x3d3c37<_0x2936be['length'];_0x3d3c37++){_0x2936be[_0x3d3c37][_0x6a7f('0x10a')](_0x6a7f('0x9b'),_0x6a7f('0x10e'));}return _0x2936be;}));_0x4b4157[_0x6a7f('0x43')](_0x37bd4c['getSmsQueues']()[_0x6a7f('0x14')](function(_0x2a9ae3){for(var _0xa2ab04=0x0;_0xa2ab04<_0x2a9ae3[_0x6a7f('0x53')];_0xa2ab04++){_0x2a9ae3[_0xa2ab04][_0x6a7f('0x10a')]('channel',_0x6a7f('0x110'));}return _0x2a9ae3;}));_0x4b4157[_0x6a7f('0x43')](_0x37bd4c[_0x6a7f('0x11e')]()[_0x6a7f('0x14')](function(_0x31c86e){for(var _0x41469a=0x0;_0x41469a<_0x31c86e[_0x6a7f('0x53')];_0x41469a++){_0x31c86e[_0x41469a]['setDataValue']('channel',_0x6a7f('0x111'));}return _0x31c86e;}));_0x4b4157[_0x6a7f('0x43')](_0x37bd4c[_0x6a7f('0x112')]()[_0x6a7f('0x14')](function(_0x39e3ce){for(var _0x5f4317=0x0;_0x5f4317<_0x39e3ce[_0x6a7f('0x53')];_0x5f4317++){_0x39e3ce[_0x5f4317][_0x6a7f('0x10a')](_0x6a7f('0x9b'),'Fax');}return _0x39e3ce;}));_0x4b4157['push'](_0x37bd4c['getOpenchannelQueues']()[_0x6a7f('0x14')](function(_0x38101d){for(var _0x500978=0x0;_0x500978<_0x38101d['length'];_0x500978++){_0x38101d[_0x500978][_0x6a7f('0x10a')](_0x6a7f('0x9b'),_0x6a7f('0x115'));}return _0x38101d;}));return BPromise[_0x6a7f('0x59')](_0x4b4157);})[_0x6a7f('0x14')](function(_0x102419){var _0xdb6441=_['flatten'](_0x102419);_0x4b4157=[];return db['sequelize']['transaction'](function(_0x556de4){for(var _0x2fd13b=0x0;_0x2fd13b<_0xdb6441[_0x6a7f('0x53')];_0x2fd13b++){_0x4b4157['push'](_0xdb6441[_0x2fd13b]['removeAgent'](_0x56102f['id']),{'transaction':_0x556de4});}return BPromise[_0x6a7f('0x59')](_0x4b4157)[_0x6a7f('0x14')](function(){if(_0x56102f[_0x6a7f('0x9c')]){return BPromise[_0x6a7f('0x86')](_[_0x6a7f('0xcb')](_0xdb6441,function(_0x3f3da2){return _0x3f3da2[_0x6a7f('0x11f')](_0x6a7f('0x9b'))===_0x6a7f('0x118');}),function(_0x46ec11){return db[_0x6a7f('0xb0')][_0x6a7f('0x27')]({'where':{'VoiceQueueId':_0x46ec11['id'],'UserId':_0x56102f['id']},'transaction':_0x556de4});});}else{return;}})[_0x6a7f('0x14')](function(){db[_0x6a7f('0x11a')]['findOne']({'where':{'teamId':_0x1a2abc['id']}})[_0x6a7f('0x14')](function(_0x3dec4a){if(_0x3dec4a){return db[_0x6a7f('0x11b')]['destroy']({'where':{'UserId':_0x56102f['id'],'VoicePrefixId':_0x3dec4a[_0x6a7f('0x47')][_0x6a7f('0x11c')]}});}});})[_0x6a7f('0x14')](function(){for(var _0x369707=0x0;_0x369707<_0xdb6441['length'];_0x369707++){var _0x510c93=_0xdb6441[_0x369707][_0x6a7f('0x11f')]('channel');var _0x1c67b7=_0x510c93+'QueueId';socket[_0x6a7f('0xa6')](_0x6a7f('0x79')+_0x510c93+'Queue:remove',{'UserId':_0x56102f['id'],['queueField']:_0xdb6441[_0x369707]['id']});}});});});}});}})[_0x6a7f('0x14')](respondWithStatusCode(_0x596a81,null))[_0x6a7f('0x1d')](handleError(_0x596a81,null));};exports[_0x6a7f('0x120')]=function(_0x13f7ab,_0x5032d5){var _0x4d030d={};var _0x5c277e={};var _0x45833e;var _0x329a69;return db[_0x6a7f('0x38')][_0x6a7f('0x94')]({'where':{'id':_0x13f7ab[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x5032d5,null))[_0x6a7f('0x14')](function(_0x124df8){if(_0x124df8){_0x45833e=_0x124df8;_0x5c277e[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0x121')][_0x6a7f('0x39')]);_0x5c277e['query']=_[_0x6a7f('0x4e')](_0x13f7ab['query']);_0x5c277e[_0x6a7f('0x4f')]=_[_0x6a7f('0x50')](_0x5c277e[_0x6a7f('0x4c')],_0x5c277e['query']);_0x4d030d[_0x6a7f('0x52')]=_['intersection'](_0x5c277e[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x13f7ab[_0x6a7f('0x3f')][_0x6a7f('0x51')]));_0x4d030d[_0x6a7f('0x52')]=_0x4d030d['attributes'][_0x6a7f('0x53')]?_0x4d030d[_0x6a7f('0x52')]:_0x5c277e['model'];_0x4d030d[_0x6a7f('0xd1')]=qs[_0x6a7f('0xc8')](_0x13f7ab[_0x6a7f('0x3f')]['sort']);_0x4d030d[_0x6a7f('0xc9')]=qs['filters'](_[_0x6a7f('0xca')](_0x13f7ab['query'],_0x5c277e[_0x6a7f('0x4f')]));if(_0x13f7ab[_0x6a7f('0x3f')]['filter']){_0x4d030d['where']=_[_0x6a7f('0x56')](_0x4d030d[_0x6a7f('0xc9')],{'$or':_['map'](_0x4d030d[_0x6a7f('0x52')],function(_0x4b56d2){var _0x20b6ad={};_0x20b6ad[_0x4b56d2]={'$like':'%'+_0x13f7ab[_0x6a7f('0x3f')]['filter']+'%'};return _0x20b6ad;})});}_0x4d030d=_['merge']({},_0x4d030d,_0x13f7ab['options']);return _0x45833e[_0x6a7f('0x120')](_0x4d030d);}})[_0x6a7f('0x14')](function(_0x421d59){if(_0x421d59){_0x329a69=_0x421d59[_0x6a7f('0x53')];if(!_0x13f7ab[_0x6a7f('0x3f')][_0x6a7f('0xd3')]('nolimit')){_0x4d030d['limit']=qs['limit'](_0x13f7ab[_0x6a7f('0x3f')][_0x6a7f('0x22')]);_0x4d030d[_0x6a7f('0x24')]=qs['offset'](_0x13f7ab[_0x6a7f('0x3f')][_0x6a7f('0x24')]);}return _0x45833e[_0x6a7f('0x120')](_0x4d030d);}})[_0x6a7f('0x14')](function(_0x32bd7b){if(_0x32bd7b){return _0x32bd7b?{'count':_0x329a69,'rows':_0x32bd7b}:null;}})[_0x6a7f('0x14')](respondWithResult(_0x5032d5,null))[_0x6a7f('0x1d')](handleError(_0x5032d5,null));};exports[_0x6a7f('0x122')]=function(_0x11a0f1,_0x41fc3c){var _0x2d2dd0={};var _0x46879e={};var _0x17f1df;return db['User'][_0x6a7f('0x94')]({'where':{'id':_0x11a0f1[_0x6a7f('0x8a')]['id']}})[_0x6a7f('0x14')](handleEntityNotFound(_0x41fc3c,null))[_0x6a7f('0x14')](function(_0x1fe095){if(_0x1fe095){_0x17f1df=_0x1fe095;_0x46879e[_0x6a7f('0x4c')]=_[_0x6a7f('0x4e')](db[_0x6a7f('0x38')][_0x6a7f('0x39')]);_0x46879e['query']=_[_0x6a7f('0x4e')](_0x11a0f1[_0x6a7f('0x3f')]);_0x46879e['filters']=_[_0x6a7f('0x50')](_0x46879e[_0x6a7f('0x4c')],_0x46879e[_0x6a7f('0x3f')]);_0x2d2dd0[_0x6a7f('0x52')]=_[_0x6a7f('0x50')](_0x46879e[_0x6a7f('0x4c')],qs[_0x6a7f('0x51')](_0x11a0f1[_0x6a7f('0x3f')]['fields']));_0x2d2dd0['attributes']=_0x2d2dd0['attributes'][_0x6a7f('0x53')]?_0x2d2dd0[_0x6a7f('0x52')]:_0x46879e['model'];_0x2d2dd0['order']=qs[_0x6a7f('0xc8')](_0x11a0f1[_0x6a7f('0x3f')]['sort']);_0x2d2dd0[_0x6a7f('0xc9')]=qs[_0x6a7f('0x4f')](_['pick'](_0x11a0f1[_0x6a7f('0x3f')],_0x46879e[_0x6a7f('0x4f')]));if(_0x11a0f1[_0x6a7f('0x3f')][_0x6a7f('0xcb')]){_0x2d2dd0['where']=_['merge'](_0x2d2dd0['where'],{'$or':_[_0x6a7f('0x2f')](_0x2d2dd0[_0x6a7f('0x52')],function(_0x21a83d){var _0x5c850b={};_0x5c850b[_0x21a83d]={'$like':'%'+_0x11a0f1[_0x6a7f('0x3f')]['filter']+'%'};return _0x5c850b;})});}_0x2d2dd0[_0x6a7f('0x4c')]=db[_0x6a7f('0x38')];_0x2d2dd0['as']=_0x6a7f('0x2a');_0x2d2dd0=_[_0x6a7f('0x56')]({},_0x2d2dd0,_0x11a0f1[_0x6a7f('0x57')]);return _0x17f1df[_0x6a7f('0x109')]({'include':[_0x2d2dd0]});}})[_0x6a7f('0x14')](function(_0x39da94){if(_0x39da94){var _0x5542a3={},_0x7a8516=[];for(var _0x588bd8=0x0;_0x588bd8<_0x39da94['length'];_0x588bd8+=0x1){for(var _0x35f36e=0x0,_0x4ad344;_0x35f36e<_0x39da94[_0x588bd8][_0x6a7f('0x2a')][_0x6a7f('0x53')];_0x35f36e+=0x1){_0x4ad344=_0x39da94[_0x588bd8][_0x6a7f('0x2a')][_0x35f36e][_0x6a7f('0x28')]({'plain':!![]});_0x5542a3[_0x4ad344['id']]=_0x4ad344;}}_0x5542a3=_['values'](_0x5542a3);for(var _0xe3eb14=qs[_0x6a7f('0x24')](_0x11a0f1[_0x6a7f('0x3f')][_0x6a7f('0x24')]);_0xe3eb14<_0x5542a3[_0x6a7f('0x53')]&&_0x7a8516[_0x6a7f('0x53')]=_0x17aa5d){_0x2ae6c9=_0x17aa5d;_0x613659=0xc8;}else{_0x613659=0xce;}_0x2ee043['status'](_0x613659);return _0x2ee043[_0xfe15('0x26')](_0xfe15('0x27'),_0x3e2696+'-'+_0x2ae6c9+'/'+_0x17aa5d)[_0xfe15('0x21')](_0x2c70e5);}return null;};}function saveUpdates(_0x30d997){return function(_0x53c1e2){if(_0x53c1e2){return _0x53c1e2[_0xfe15('0x28')](_0x30d997)[_0xfe15('0x29')](function(_0x1d0607){return _0x1d0607;});}return null;};}function removeEntity(_0x43d002){return function(_0x381cd7){if(_0x381cd7){return _0x381cd7['destroy']()[_0xfe15('0x29')](function(){var _0x725379=_0x381cd7[_0xfe15('0x2a')]({'plain':!![]});if(_0x725379[_0xfe15('0x2b')]===_0xfe15('0x2c'))return;var _0x38d75a=[{'name':'Users','value':'user','ignore':!![]},{'name':_0xfe15('0x2d'),'value':'agent','ignore':![]},{'name':_0xfe15('0x2e'),'value':'telephone','ignore':![]}];var _0x32c18f=_(_0x38d75a)[_0xfe15('0x2f')](_0xfe15('0x30'))[_0xfe15('0x31')](_0xfe15('0x32'))['value']();if(_['includes'](_0x32c18f,_0x725379[_0xfe15('0x2b')])){return;}var _0xb908aa=_['find'](_0x38d75a,['value',_0x725379['role']])[_0xfe15('0x33')];return db[_0xfe15('0x34')][_0xfe15('0x35')]({'where':{'type':_0xb908aa,'resourceId':_0x725379['id']}})[_0xfe15('0x29')](function(){return _0x381cd7;});})[_0xfe15('0x29')](function(){_0x43d002['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b859f){return function(_0x3bb750){if(!_0x3bb750){_0x2b859f['sendStatus'](0x194);}return _0x3bb750;};}function handleError(_0x5f1186,_0xccbb09){_0xccbb09=_0xccbb09||0x1f4;return function(_0xd24290){logger[_0xfe15('0x1a')](_0xd24290[_0xfe15('0x36')]);if(_0xd24290[_0xfe15('0x33')]){delete _0xd24290[_0xfe15('0x33')];}_0x5f1186[_0xfe15('0x1f')](_0xccbb09)[_0xfe15('0x37')](_0xd24290);};}exports[_0xfe15('0x38')]=function(_0x231fda,_0x350004){var _0x21e774={},_0x30cce9={'count':0x0,'rows':[]};var _0x42d7f6=_(db[_0xfe15('0x39')][_0xfe15('0x3a')])[_0xfe15('0x31')](function(_0x391280){return{'name':_0x391280[_0xfe15('0x3b')],'type':_0x391280[_0xfe15('0x3c')]['key']};})[_0xfe15('0x2f')](function(_0x3f70f0){return!_['includes']([_0xfe15('0x3d'),'salt'],_0x3f70f0[_0xfe15('0x33')]);})[_0xfe15('0x32')]();_0x21e774=qs['getOptions'](_0x42d7f6,_0x231fda);var _0x4a35d2={'where':_0x21e774[_0xfe15('0x3e')]};return db[_0xfe15('0x39')]['count'](_0x4a35d2)[_0xfe15('0x29')](function(_0x4928c2){_0x30cce9[_0xfe15('0x24')]=_0x4928c2;if(_0x231fda[_0xfe15('0x3f')][_0xfe15('0x40')]){_0x21e774[_0xfe15('0x41')]=[{'all':!![]}];}if(_0x231fda[_0xfe15('0x3f')][_0xfe15('0x42')]==='true'){_0x21e774[_0xfe15('0x41')]=[{'model':db[_0xfe15('0x43')],'as':_0xfe15('0x42')}];}if(!_['includes'](_0x21e774[_0xfe15('0x44')],'id')){_0x21e774[_0xfe15('0x44')][_0xfe15('0x45')]('id');}return db[_0xfe15('0x39')][_0xfe15('0x46')](_0x21e774);})[_0xfe15('0x29')](function(_0x2ec61f){_0x30cce9[_0xfe15('0x47')]=_0x2ec61f;if(_0x231fda[_0xfe15('0x3f')][_0xfe15('0x48')]==='true'){var _0x1f8842=[];for(var _0x6769cb=0x0;_0x6769cb<_0x30cce9['rows'][_0xfe15('0x49')];_0x6769cb++){_0x1f8842[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4a'),_0x30cce9['rows'][_0x6769cb][_0xfe15('0x4b')]));_0x1f8842[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4c'),_0x30cce9[_0xfe15('0x47')][_0x6769cb][_0xfe15('0x4b')]));_0x1f8842[_0xfe15('0x45')](get_open_tabs('fax',_0x30cce9[_0xfe15('0x47')][_0x6769cb]['dataValues']));_0x1f8842[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4d'),_0x30cce9['rows'][_0x6769cb][_0xfe15('0x4b')]));_0x1f8842[_0xfe15('0x45')](get_open_tabs('openchannel',_0x30cce9[_0xfe15('0x47')][_0x6769cb][_0xfe15('0x4b')]));_0x1f8842[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4e'),_0x30cce9[_0xfe15('0x47')][_0x6769cb]['dataValues']));}return BPromise[_0xfe15('0x4f')](_0x1f8842)[_0xfe15('0x29')](function(){return _0x30cce9;});}else{return _0x30cce9;}})[_0xfe15('0x29')](respondWithFilteredResult(_0x350004,_0x21e774))['catch'](handleError(_0x350004,null));};exports['show']=function(_0x90be1b,_0x2c06ef){var _0x344ee0={'raw':![],'where':{'id':_0x90be1b['params']['id']}},_0x19e4c1={};_0x19e4c1['model']=_[_0xfe15('0x50')](_['keys'](db[_0xfe15('0x39')]['rawAttributes']),[_0xfe15('0x3d'),_0xfe15('0x51')]);_0x19e4c1['query']=_['keys'](_0x90be1b['query']);_0x19e4c1[_0xfe15('0x52')]=_['intersection'](_0x19e4c1[_0xfe15('0x53')],_0x19e4c1[_0xfe15('0x3f')]);_0x344ee0[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x19e4c1[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x90be1b[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x344ee0['attributes']=_0x344ee0['attributes'][_0xfe15('0x49')]?_0x344ee0[_0xfe15('0x44')]:_0x19e4c1['model'];if(_0x90be1b[_0xfe15('0x3f')][_0xfe15('0x40')]){_0x344ee0[_0xfe15('0x41')]=[{'all':!![]}];}if(_0x90be1b[_0xfe15('0x3f')][_0xfe15('0x42')]==='true'){_0x344ee0[_0xfe15('0x41')]=[{'model':db['UserSetting'],'as':_0xfe15('0x42')}];}_0x344ee0=_[_0xfe15('0x56')]({},_0x344ee0,_0x90be1b[_0xfe15('0x57')]);if(!_['includes'](_0x344ee0[_0xfe15('0x44')],'id')){_0x344ee0[_0xfe15('0x44')][_0xfe15('0x45')]('id');}return db[_0xfe15('0x39')][_0xfe15('0x58')](_0x344ee0)[_0xfe15('0x29')](handleEntityNotFound(_0x2c06ef,null))[_0xfe15('0x29')](function(_0x163f25){var _0x3c0447=[];values=_0x163f25;if(_0x90be1b['query'][_0xfe15('0x48')]===_0xfe15('0x59')){_0x3c0447[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4a'),_0x163f25['dataValues']));_0x3c0447[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4c'),_0x163f25['dataValues']));_0x3c0447[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x5a'),_0x163f25[_0xfe15('0x4b')]));_0x3c0447['push'](get_open_tabs('whatsapp',_0x163f25[_0xfe15('0x4b')]));_0x3c0447['push'](get_open_tabs(_0xfe15('0x5b'),_0x163f25[_0xfe15('0x4b')]));_0x3c0447['push'](get_open_tabs(_0xfe15('0x4d'),_0x163f25[_0xfe15('0x4b')]));return BPromise['all'](_0x3c0447);}else{return values;}})[_0xfe15('0x29')](function(){return values;})[_0xfe15('0x29')](respondWithResult(_0x2c06ef,null))['catch'](handleError(_0x2c06ef,null));};exports[_0xfe15('0x28')]=function(_0x143cc5,_0x6c353f){if(_0x143cc5[_0xfe15('0x5c')]['id']){delete _0x143cc5['body']['id'];}delete _0x143cc5['body'][_0xfe15('0x2b')];return db[_0xfe15('0x39')]['find']({'where':{'id':_0x143cc5['params']['id']}})['then'](handleEntityNotFound(_0x6c353f,null))[_0xfe15('0x29')](saveUpdates(_0x143cc5[_0xfe15('0x5c')],null))[_0xfe15('0x29')](respondWithResult(_0x6c353f,null))[_0xfe15('0x5d')](handleError(_0x6c353f,null));};exports[_0xfe15('0x5e')]=function(_0x456cc9,_0x11a30e){return db[_0xfe15('0x39')][_0xfe15('0x5e')]()[_0xfe15('0x29')](respondWithResult(_0x11a30e,null))[_0xfe15('0x5d')](handleError(_0x11a30e,null));};exports[_0xfe15('0x5f')]=function(_0x14b4bd,_0xbc3b1e){return db[_0xfe15('0x39')]['find']({'where':{'id':_0x14b4bd[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0xbc3b1e,null))[_0xfe15('0x29')](function(_0x3d5355){if(_0x3d5355){return _0x3d5355['addContacts'](_0x14b4bd['body'][_0xfe15('0x61')],_[_0xfe15('0x62')](_0x14b4bd[_0xfe15('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0xbc3b1e,null))['catch'](handleError(_0xbc3b1e,null));};function validateUser(_0x53f904){return new BPromise(function(_0xb2f849,_0xbffee0){if(_0x53f904[_0xfe15('0x63')])return _0xb2f849(_0x53f904);return db['Setting'][_0xfe15('0x64')](0x1)['then'](function(_0x346f3f){if(_0x346f3f[_0xfe15('0x65')])authService[_0xfe15('0x66')](_0x53f904[_0xfe15('0x3d')]);db[_0xfe15('0x39')]['max'](_0xfe15('0x63'))[_0xfe15('0x29')](function(_0x3b0210){if(_[_0xfe15('0x67')](_0x3b0210)){_0x53f904[_0xfe15('0x63')]=_0x346f3f['min_internal']||0x1;return;}if(_['isNil'](_0x346f3f[_0xfe15('0x68')])||_0x346f3f['min_internal']===_0x3b0210){_0x53f904[_0xfe15('0x63')]=_0x3b0210+0x1;return;}if(_0x346f3f[_0xfe15('0x68')]>_0x3b0210){_0x53f904[_0xfe15('0x63')]=_0x346f3f[_0xfe15('0x68')];return;}return db[_0xfe15('0x69')]['query'](_0xfe15('0x6a'),{'type':db[_0xfe15('0x69')][_0xfe15('0x6b')]['SELECT']})[_0xfe15('0x29')](function(_0x396056){if(_0x396056&&_0x396056['length']){for(var _0x5d506f=0x0,_0x519967=_0x396056[_0xfe15('0x49')];_0x5d506f<_0x519967&&_['isNil'](_0x53f904[_0xfe15('0x63')]);_0x5d506f++){if(_0x346f3f[_0xfe15('0x68')]<=_0x396056[_0x5d506f]['from']){_0x53f904['internal']=_0x396056[_0x5d506f][_0xfe15('0x6c')];}else if(_0x346f3f['min_internal']>_0x396056[_0x5d506f][_0xfe15('0x6c')]&&_0x346f3f[_0xfe15('0x68')]<=_0x396056[_0x5d506f]['to']){_0x53f904['internal']=_0x346f3f[_0xfe15('0x68')];}}}if(_[_0xfe15('0x67')](_0x53f904[_0xfe15('0x63')])){_0x53f904[_0xfe15('0x63')]=_0x3b0210+0x1;}return _0xb2f849(_0x53f904);});});})[_0xfe15('0x5d')](function(_0x4f4cf4){_0xbffee0(_0x4f4cf4);});});}function updateUser(_0x3d839c){return new BPromise(function(_0x4e6d97,_0x5c2a63){try{if(_0x3d839c[_0xfe15('0x6d')]){_0x3d839c[_0xfe15('0x6e')]=_0x3d839c[_0xfe15('0x63')];_0x3d839c[_0xfe15('0x6f')]={'mailbox':_0x3d839c['internal'],'password':_0x3d839c[_0xfe15('0x3d')],'fullname':_0x3d839c[_0xfe15('0x70')],'email':_0x3d839c[_0xfe15('0x71')]};}if(_0x3d839c[_0xfe15('0x2b')]===_0xfe15('0x72')){if(!_0x3d839c['permissions'])_0x3d839c[_0xfe15('0x73')]=['101',_0xfe15('0x74'),'103',_0xfe15('0x75'),_0xfe15('0x76'),'104',_0xfe15('0x77'),_0xfe15('0x78'),'107',_0xfe15('0x79'),_0xfe15('0x7a'),_0xfe15('0x7b'),_0xfe15('0x7c'),_0xfe15('0x7d'),_0xfe15('0x7e')];}_0x4e6d97(_0x3d839c);}catch(_0x4c22ca){_0x5c2a63(_0x4c22ca);}});}exports[_0xfe15('0x7f')]=function(_0x9b3301,_0x2671e4){if(_0x9b3301[_0xfe15('0x80')]['role']==='agent')throw new Error('Unauthorized');if(_0x9b3301['body']['role']==='user'&&_0x9b3301[_0xfe15('0x80')][_0xfe15('0x2b')]!==_0xfe15('0x2c')){throw new Error(_0xfe15('0x81'));}if(_0x9b3301[_0xfe15('0x5c')]['role']===_0xfe15('0x2c')&&_0x9b3301[_0xfe15('0x80')][_0xfe15('0x2b')]!=='admin'){throw new Error(_0xfe15('0x82'));}return licenseUtil['checkUserLimits']([_0x9b3301[_0xfe15('0x5c')]])[_0xfe15('0x29')](function(){return validateUser(_0x9b3301[_0xfe15('0x5c')]);})[_0xfe15('0x29')](function(_0x4b43e3){return updateUser(_0x4b43e3)[_0xfe15('0x29')](function(_0x24cce1){if(_0x24cce1[_0xfe15('0x2b')]==='admin'){_0x24cce1[_0xfe15('0x83')]=_0x9b3301[_0xfe15('0x80')]['settingsEnabled'];delete _0x24cce1[_0xfe15('0x84')];}return _0x24cce1;});})[_0xfe15('0x29')](function(_0x2ac4b0){return db[_0xfe15('0x39')][_0xfe15('0x7f')](_0x2ac4b0,{'include':[{'model':db[_0xfe15('0x6f')],'as':'VoiceMail'}]});})[_0xfe15('0x29')](function(_0x3acad3){if(_0x9b3301[_0xfe15('0x5c')][_0xfe15('0x2b')]==='user')return _0x3acad3;if(_0x9b3301[_0xfe15('0x80')][_0xfe15('0x2b')]!==_0xfe15('0x80'))return _0x3acad3;return db[_0xfe15('0x85')]['find']({'where':{'name':_0x3acad3[_0xfe15('0x2b')]===_0xfe15('0x72')?_0xfe15('0x2d'):_0xfe15('0x2e'),'userProfileId':_0x9b3301[_0xfe15('0x80')]['userProfileId']},'raw':!![]})[_0xfe15('0x29')](function(_0x1fcec6){if(!_0x1fcec6||_0x1fcec6[_0xfe15('0x86')]!=0x0)return _0x3acad3;return db['UserProfileResource'][_0xfe15('0x7f')]({'name':_0x3acad3[_0xfe15('0x33')],'resourceId':_0x3acad3['id'],'type':_0x1fcec6[_0xfe15('0x33')],'sectionId':_0x1fcec6['id']},{})[_0xfe15('0x29')](function(){return _0x3acad3;});})[_0xfe15('0x5d')](function(_0x573575){logger[_0xfe15('0x1a')](_0xfe15('0x87'),_0x573575);throw _0x573575;});})[_0xfe15('0x29')](respondWithResult(_0x2671e4,0xc9))[_0xfe15('0x5d')](handleError(_0x2671e4,null));};exports['bulkCreate']=function(_0x58d9df,_0x313f43){var _0xb27ed9=_0x58d9df[_0xfe15('0x5c')];var _0x590713=[];if(_0x58d9df[_0xfe15('0x80')][_0xfe15('0x2b')]===_0xfe15('0x72'))throw new Error(_0xfe15('0x88'));if(_[_0xfe15('0x89')](_0xb27ed9,[_0xfe15('0x2b'),'user'])&&_0x58d9df['user'][_0xfe15('0x2b')]!==_0xfe15('0x2c')){throw new Error(_0xfe15('0x81'));}if(_[_0xfe15('0x89')](_0xb27ed9,[_0xfe15('0x2b'),'admin'])&&_0x58d9df['user']['role']!==_0xfe15('0x2c')){throw new Error(_0xfe15('0x8a'));}return licenseUtil[_0xfe15('0x8b')](_0xb27ed9)[_0xfe15('0x29')](function(){return validateUser(_0xb27ed9[0x0]);})['then'](function(){for(var _0x207e66=0x1;_0x207e66<_0xb27ed9[_0xfe15('0x49')];_0x207e66++){var _0x4c0be4=_0xb27ed9[_0x207e66-0x1][_0xfe15('0x63')];if(!_0xb27ed9[_0x207e66][_0xfe15('0x63')])_0xb27ed9[_0x207e66]['internal']=_0x4c0be4+0x1;_0x590713['push'](validateUser(_0xb27ed9[_0x207e66]));}return BPromise['all'](_0x590713);})['then'](function(){_0x590713=[];for(var _0xbaf5a3=0x0;_0xbaf5a3<_0xb27ed9[_0xfe15('0x49')];_0xbaf5a3++){_0x590713[_0xfe15('0x45')](updateUser(_0xb27ed9[_0xbaf5a3]));}return BPromise[_0xfe15('0x4f')](_0x590713);})[_0xfe15('0x29')](function(){return BPromise[_0xfe15('0x8c')](_0xb27ed9,function(_0x49e0af){return db[_0xfe15('0x39')]['create'](_0x49e0af,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0xfe15('0x29')](function(_0x4c5f5a){_0x49e0af['id']=_0x4c5f5a['id'];return _0x49e0af;});});})['then'](function(_0x219ad3){if(_0x58d9df[_0xfe15('0x5c')][_0xfe15('0x2b')]===_0xfe15('0x80'))return _0x219ad3;if(_0x58d9df['user'][_0xfe15('0x2b')]!==_0xfe15('0x80'))return _0x219ad3;var _0x2ace3f=_[_0xfe15('0x89')](_0x219ad3,function(_0x2acd94){return _0x2acd94['role']===_0xfe15('0x72')||_0x2acd94[_0xfe15('0x2b')]===_0xfe15('0x8d');});if(!_0x2ace3f)return _0x219ad3;return db[_0xfe15('0x85')][_0xfe15('0x46')]({'where':{'name':{'$or':['Agents',_0xfe15('0x2e')]},'userProfileId':_0x58d9df['user'][_0xfe15('0x84')]},'raw':!![]})['then'](function(_0x25e7b3){if(_[_0xfe15('0x8e')](_0x25e7b3)||!_[_0xfe15('0x89')](_0x25e7b3,[_0xfe15('0x86'),0x0]))return _0x219ad3;_0x590713=[];var _0x4670a0=_(_0x25e7b3)[_0xfe15('0x31')](function(_0x14dc70){if(_0x14dc70[_0xfe15('0x86')]===0x1)return;return _0x14dc70[_0xfe15('0x33')]===_0xfe15('0x2d')?'agent':'telephone';})[_0xfe15('0x8f')]()[_0xfe15('0x32')]();for(var _0x314e89=0x0;_0x314e89<_0x219ad3['length'];_0x314e89++){if(!_[_0xfe15('0x90')](_0x4670a0,_0x219ad3[_0x314e89][_0xfe15('0x2b')]))return;var _0x98afe2=_0x219ad3[_0x314e89]['role']==='agent'?_0xfe15('0x2d'):_0xfe15('0x2e');_0x590713[_0xfe15('0x45')](db[_0xfe15('0x34')][_0xfe15('0x7f')]({'name':_0x219ad3[_0x314e89][_0xfe15('0x33')],'resourceId':_0x219ad3[_0x314e89]['id'],'type':_0x98afe2,'sectionId':_[_0xfe15('0x58')](_0x25e7b3,[_0xfe15('0x33'),_0x98afe2])['id']},{}));}return BPromise['all'](_0x590713);});})[_0xfe15('0x29')](respondWithResult(_0x313f43,0xc9))[_0xfe15('0x5d')](handleError(_0x313f43,null));};exports[_0xfe15('0x91')]=function(_0x5929cf,_0x54ec80){if(_0x5929cf[_0xfe15('0x5c')]['id']){delete _0x5929cf['body']['id'];}return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x5929cf[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](function(_0x26d7a8){if(!_0x26d7a8)return null;if(_0x26d7a8['id']===_0x5929cf[_0xfe15('0x80')]['id']){if(!_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x92')]||!_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')]){throw new db[(_0xfe15('0x94'))]['ValidationError'](_0xfe15('0x95'));}if(!_0x26d7a8[_0xfe15('0x96')](_0x5929cf['body'][_0xfe15('0x92')])){throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0x98'));}if(_0x5929cf[_0xfe15('0x5c')]['oldPassword']===_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')]){throw new db['Sequelize']['ValidationError'](_0xfe15('0x99'));}}else if(_0x5929cf[_0xfe15('0x80')]['role']===_0xfe15('0x2c')){if(!_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')]){throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0x9a'));}}else if(_0x5929cf[_0xfe15('0x80')][_0xfe15('0x2b')]===_0xfe15('0x80')){if(!_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')]){throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0x9a'));}if(_0x26d7a8[_0xfe15('0x2b')]!==_0xfe15('0x72')){throw new db[(_0xfe15('0x94'))]['ValidationError'](_0xfe15('0x88'));}}else{throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))]('Unauthorized');}return _0x26d7a8;})[_0xfe15('0x29')](handleEntityNotFound(_0x54ec80,null))[_0xfe15('0x29')](function(_0x4ac2f0){return db['Setting'][_0xfe15('0x9b')]({'attributes':['id',_0xfe15('0x65'),_0xfe15('0x9c'),_0xfe15('0x9d')]})[_0xfe15('0x29')](function(_0x41872c){if(_0x41872c['securePassword'])authService[_0xfe15('0x66')](_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')]);if(!_0x41872c[_0xfe15('0x9c')]||!_0x4ac2f0[_0xfe15('0x9e')])return _0x4ac2f0;authService[_0xfe15('0x9f')](_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')],_0x4ac2f0[_0xfe15('0x9e')],_0x41872c[_0xfe15('0x9d')]);return _0x4ac2f0;})[_0xfe15('0x29')](saveUpdates({'password':_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')],'passwordResetAt':_0x5929cf['user']['id']==_0x5929cf[_0xfe15('0x60')]['id']?moment():null,'previousPasswords':authService[_0xfe15('0xa0')](_0x5929cf[_0xfe15('0x5c')][_0xfe15('0x93')],_0x4ac2f0[_0xfe15('0x9e')])},null));})[_0xfe15('0x29')](respondWithResult(_0x54ec80,null))[_0xfe15('0x5d')](handleError(_0x54ec80,null));};exports[_0xfe15('0xa1')]=function(_0x2a4fa3,_0x23f944){var _0x52a478=_0x2a4fa3[_0xfe15('0x5c')]['channel'];return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x2a4fa3[_0xfe15('0x60')]['id']},'attributes':['id',_0xfe15('0x33'),_0xfe15('0x2b'),'online','loginInPause',_0xfe15('0xa2'),_0xfe15('0xa3')]})['then'](handleEntityNotFound(_0x23f944,null))[_0xfe15('0x29')](function(_0x218cdc){if(_0x218cdc){if(!utils['isValidChannel'](_0x52a478)){throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0xa4'));}return _0x218cdc[_0xfe15('0xa5')+_[_0xfe15('0xa6')](_0x52a478[_0xfe15('0xa7')]())+_0xfe15('0xa8')](_0x2a4fa3['body'][_0xfe15('0x61')],{'penalty':_0x2a4fa3['body'][_0xfe15('0xa9')]||0x0})[_0xfe15('0xaa')](function(_0x1fe04d){for(var _0x543a8b=0x0;_0x543a8b<_0x2a4fa3[_0xfe15('0x5c')]['ids']['length'];_0x543a8b+=0x1){var _0x297cb5={'UserId':Number(_0x2a4fa3[_0xfe15('0x60')]['id'])};_0x297cb5[_[_0xfe15('0xa6')](_0x52a478[_0xfe15('0xa7')]())+_0xfe15('0xab')]=Number(_0x2a4fa3['body'][_0xfe15('0x61')][_0x543a8b]);socket[_0xfe15('0xac')](_0xfe15('0x80')+_['capitalize'](_0x52a478[_0xfe15('0xa7')]())+_0xfe15('0xad'),_0x297cb5);}return _0x1fe04d;})[_0xfe15('0x29')](function(){if(_0x52a478===_0xfe15('0xae')){return db['VoiceQueue'][_0xfe15('0x46')]({'where':{'id':_0x2a4fa3[_0xfe15('0x5c')][_0xfe15('0x61')]||[]},'raw':!![],'attributes':['id',_0xfe15('0x33')]});}})[_0xfe15('0x29')](function(_0x6d5827){var _0x3f4a0f=_0x218cdc['get']({'plain':!![]});var _0x4ee797=[];if(_0x52a478===_0xfe15('0xae')&&_0x3f4a0f[_0xfe15('0x2b')]===_0xfe15('0x72')&&_0x3f4a0f['online']){for(var _0x471f36=0x0;_0x471f36<_0x6d5827[_0xfe15('0x49')];_0x471f36+=0x1){_0x4ee797[_0xfe15('0x45')]({'membername':_0x3f4a0f['name'],'UserId':_0x3f4a0f['id'],'queue_name':_0x6d5827[_0x471f36]['name'],'VoiceQueueId':_0x6d5827[_0x471f36]['id'],'interface':_[_0xfe15('0x67')](_0x3f4a0f[_0xfe15('0xa3')])?util[_0xfe15('0xaf')]('SIP/%s',_0x3f4a0f[_0xfe15('0x33')]):_0x3f4a0f[_0xfe15('0xa3')],'paused':_0x3f4a0f[_0xfe15('0xa2')]||![],'penalty':_0x2a4fa3[_0xfe15('0x5c')][_0xfe15('0xa9')]||0x0});}return BPromise[_0xfe15('0x8c')](_0x4ee797,function(_0x3f656a){return db[_0xfe15('0xb0')][_0xfe15('0xb1')](_0x3f656a);});}return _0x218cdc;});}})['then'](respondWithStatusCode(_0x23f944,null))[_0xfe15('0x5d')](handleError(_0x23f944,null));};exports[_0xfe15('0xb2')]=function(_0x13e836,_0x57bf81){var _0x382d2b,_0x2f0143;return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x13e836[_0xfe15('0x60')]['id']},'attributes':['id','name','role']})[_0xfe15('0x29')](handleEntityNotFound(_0x57bf81,null))[_0xfe15('0x29')](function(_0x1b2429){if(_0x1b2429){_0x382d2b=_0x1b2429;if(!_0x13e836[_0xfe15('0x3f')][_0xfe15('0xb3')]||!utils['isValidChannel'](_0x13e836[_0xfe15('0x3f')][_0xfe15('0xb3')])){throw new db['Sequelize'][(_0xfe15('0x97'))]('Unknown\x20channel');}return _0x1b2429[_0xfe15('0xb4')+_[_0xfe15('0xa6')](_0x13e836[_0xfe15('0x3f')]['channel'][_0xfe15('0xa7')]())+_0xfe15('0xa8')](_0x13e836[_0xfe15('0x3f')]['ids']);}})['then'](function(_0x5626ec){if(_[_0xfe15('0xb5')](_0x13e836[_0xfe15('0x3f')]['ids'])){for(var _0x3c3986=0x0;_0x3c3986<_0x13e836[_0xfe15('0x3f')][_0xfe15('0x61')][_0xfe15('0x49')];_0x3c3986+=0x1){_0x2f0143={'UserId':Number(_0x13e836[_0xfe15('0x60')]['id'])};_0x2f0143[_['capitalize'](_0x13e836['query']['channel']['toLowerCase']())+_0xfe15('0xab')]=Number(_0x13e836['query'][_0xfe15('0x61')][_0x3c3986]);socket[_0xfe15('0xac')](_0xfe15('0x80')+_[_0xfe15('0xa6')](_0x13e836[_0xfe15('0x3f')]['channel'][_0xfe15('0xa7')]())+'Queue:remove',_0x2f0143);}}else{_0x2f0143={'UserId':Number(_0x13e836[_0xfe15('0x60')]['id'])};_0x2f0143[_['capitalize'](_0x13e836['query'][_0xfe15('0xb3')][_0xfe15('0xa7')]())+_0xfe15('0xab')]=Number(_0x13e836[_0xfe15('0x3f')]['ids']);socket['emit'](_0xfe15('0x80')+_[_0xfe15('0xa6')](_0x13e836[_0xfe15('0x3f')][_0xfe15('0xb3')][_0xfe15('0xa7')]())+'Queue:remove',_0x2f0143);}return _0x5626ec;})['then'](function(){if(_0x13e836[_0xfe15('0x3f')][_0xfe15('0xb3')]===_0xfe15('0xae')){return db[_0xfe15('0xb0')][_0xfe15('0x35')]({'where':{'UserId':_0x13e836[_0xfe15('0x60')]['id'],'VoiceQueueId':_0x13e836[_0xfe15('0x3f')][_0xfe15('0x61')]},'individualHooks':!![]})['then'](function(){return _0x382d2b;});}return _0x382d2b;})['then'](respondWithStatusCode(_0x57bf81,null))[_0xfe15('0x5d')](handleError(_0x57bf81,null));};exports[_0xfe15('0xb6')]=function(_0x201ec1,_0x403277){_0x201ec1[_0xfe15('0x5c')][_0xfe15('0xb7')]=_0x201ec1[_0xfe15('0xb8')]['filename'];return db[_0xfe15('0x39')]['find']({'where':{'id':_0x201ec1['params']['id']}})['then'](handleEntityNotFound(_0x403277,null))[_0xfe15('0x29')](saveUpdates(_0x201ec1[_0xfe15('0x5c')],null))[_0xfe15('0x29')](respondWithResult(_0x403277,null))[_0xfe15('0x5d')](handleError(_0x403277,null));};exports[_0xfe15('0xb9')]=function(_0x1ea739,_0x5a947e){var _0xad0a8=path[_0xfe15('0xba')](config[_0xfe15('0xbb')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x1ea739[_0xfe15('0x60')]['id']},'attributes':['id',_0xfe15('0xb7')],'raw':!![]})[_0xfe15('0x29')](handleEntityNotFound(_0x5a947e,null))[_0xfe15('0x29')](function(_0x405847){if(_0x405847){if(_['isNil'](_0x405847[_0xfe15('0xb7')])){return _0x5a947e[_0xfe15('0xbc')](_0xad0a8);}else{if(!fs['existsSync'](path['join'](config[_0xfe15('0xbb')],_0xfe15('0xbd'),_0x405847[_0xfe15('0xb7')]))){return _0x5a947e['download'](_0xad0a8);}return _0x5a947e[_0xfe15('0xbc')](path[_0xfe15('0xba')](config['root'],'server/files/images/',_0x405847[_0xfe15('0xb7')]));}}})[_0xfe15('0x5d')](handleError(_0x5a947e,null));};exports['getOpenTabs']=function(_0x517cb5,_0x4b76a2){return db['User'][_0xfe15('0x58')]({'where':{'id':_0x517cb5[_0xfe15('0x60')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4b76a2,null))['then'](function(_0x1da88a){var _0x4bdc83=[];values=_0x1da88a['dataValues'];_0x4bdc83[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4a'),_0x1da88a[_0xfe15('0x4b')]));_0x4bdc83[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4c'),_0x1da88a[_0xfe15('0x4b')]));_0x4bdc83['push'](get_open_tabs(_0xfe15('0x5a'),_0x1da88a[_0xfe15('0x4b')]));_0x4bdc83[_0xfe15('0x45')](get_open_tabs('whatsapp',_0x1da88a[_0xfe15('0x4b')]));_0x4bdc83[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x5b'),_0x1da88a[_0xfe15('0x4b')]));_0x4bdc83[_0xfe15('0x45')](get_open_tabs(_0xfe15('0x4d'),_0x1da88a[_0xfe15('0x4b')]));return BPromise[_0xfe15('0x4f')](_0x4bdc83);})[_0xfe15('0x29')](function(_0x2777b9){if(_0x2777b9){var _0x2ef681=_['map'](values[_0xfe15('0xbe')],function(_0x5f227e){return{'channel':_0xfe15('0xbf'),'id':_0x5f227e['id'],'createdAt':_0x5f227e['createdAt']};});var _0x5946ad=_[_0xfe15('0x31')](values[_0xfe15('0xc0')],function(_0x2f95e5){return{'channel':_0xfe15('0xc1'),'id':_0x2f95e5['id'],'createdAt':_0x2f95e5[_0xfe15('0xc2')]};});var _0x5ea1bf=_[_0xfe15('0x31')](values[_0xfe15('0xc3')],function(_0x4cc91b){return{'channel':'OPENCHANNEL','id':_0x4cc91b['id'],'createdAt':_0x4cc91b[_0xfe15('0xc2')]};});var _0x6df022=_[_0xfe15('0x31')](values[_0xfe15('0xc4')],function(_0x3948c8){return{'channel':_0xfe15('0xc5'),'id':_0x3948c8['id'],'createdAt':_0x3948c8[_0xfe15('0xc2')]};});var _0x17f391=_[_0xfe15('0x31')](values[_0xfe15('0xc6')],function(_0x115883){return{'channel':_0xfe15('0xc7'),'id':_0x115883['id'],'createdAt':_0x115883[_0xfe15('0xc2')]};});var _0x4911ff=_[_0xfe15('0x31')](values[_0xfe15('0xc8')],function(_0x468b36){return{'channel':_0xfe15('0xc9'),'id':_0x468b36['id'],'createdAt':_0x468b36[_0xfe15('0xc2')]};});var _0x2d9833=_[_0xfe15('0xca')](_0x2ef681,_0x5946ad,_0x5ea1bf,_0x6df022,_0x17f391,_0x4911ff);var _0x1c4de6={'count':_0x2d9833[_0xfe15('0x49')],'rows':_0x2d9833};return _0x1c4de6;}else return null;})['then'](respondWithResult(_0x4b76a2,null))[_0xfe15('0x5d')](handleError(_0x4b76a2,null));};exports[_0xfe15('0xcb')]=function(_0x497984,_0x486967){var _0xf66f35={};var _0x4ed17b={};var _0x221d27;var _0xbf5610;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x497984[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x486967,null))['then'](function(_0x34c6e2){if(_0x34c6e2){_0x221d27=_0x34c6e2;_0x4ed17b[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db['CmContact'][_0xfe15('0x3a')]);_0x4ed17b['query']=_[_0xfe15('0xcc')](_0x497984[_0xfe15('0x3f')]);_0x4ed17b[_0xfe15('0x52')]=_['intersection'](_0x4ed17b[_0xfe15('0x53')],_0x4ed17b[_0xfe15('0x3f')]);_0xf66f35[_0xfe15('0x44')]=_['intersection'](_0x4ed17b[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x497984[_0xfe15('0x3f')][_0xfe15('0x55')]));_0xf66f35[_0xfe15('0x44')]=_0xf66f35[_0xfe15('0x44')][_0xfe15('0x49')]?_0xf66f35[_0xfe15('0x44')]:_0x4ed17b[_0xfe15('0x53')];_0xf66f35[_0xfe15('0xcd')]=qs['sort'](_0x497984[_0xfe15('0x3f')][_0xfe15('0xce')]);_0xf66f35[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_['pick'](_0x497984[_0xfe15('0x3f')],_0x4ed17b[_0xfe15('0x52')]));if(_0x497984[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0xf66f35[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0xf66f35[_0xfe15('0x3e')],{'$or':_['map'](_0xf66f35['attributes'],function(_0x48d77f){var _0x4535ce={};_0x4535ce[_0x48d77f]={'$like':'%'+_0x497984[_0xfe15('0x3f')]['filter']+'%'};return _0x4535ce;})});}_0xf66f35=_[_0xfe15('0x56')]({},_0xf66f35,_0x497984['options']);return _0x221d27[_0xfe15('0xcb')](_0xf66f35);}})[_0xfe15('0x29')](function(_0x251992){if(_0x251992){_0xbf5610=_0x251992[_0xfe15('0x49')];if(_0x497984[_0xfe15('0x3f')][_0xfe15('0xcf')]('includeAll')){_0xf66f35[_0xfe15('0x41')]=[{'model':db[_0xfe15('0xd0')],'as':_0xfe15('0xd1'),'required':![]},{'model':db[_0xfe15('0xd2')],'as':_0xfe15('0xd3'),'attributes':['id',_0xfe15('0x33'),'color'],'where':_0x497984['query']['tag']?{'id':_0x497984[_0xfe15('0x3f')]['tag']}:undefined,'required':_0x497984[_0xfe15('0x3f')]['tag']?!![]:![]}];}if(!_0x497984[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0xf66f35[_0xfe15('0x25')]=qs['limit'](_0x497984[_0xfe15('0x3f')][_0xfe15('0x25')]);_0xf66f35[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x497984[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x221d27[_0xfe15('0xcb')](_0xf66f35);}})[_0xfe15('0x29')](function(_0x1ad897){if(_0x1ad897){return _0x1ad897?{'count':_0xbf5610,'rows':_0x1ad897}:null;}})[_0xfe15('0x29')](respondWithResult(_0x486967,null))[_0xfe15('0x5d')](handleError(_0x486967,null));};exports[_0xfe15('0xd5')]=function(_0x429ac9,_0x35eacb){var _0x14404d;var _0x1a83be={};var _0x2c2912;return db['User']['findOne']({'where':{'id':_0x429ac9[_0xfe15('0x60')]['id']},'attributes':['id',_0xfe15('0x33'),_0xfe15('0x2b')]})['then'](handleEntityNotFound(_0x35eacb,null))[_0xfe15('0x29')](function(_0xa37d31){if(!utils[_0xfe15('0xd6')](_0x429ac9[_0xfe15('0x3f')][_0xfe15('0xb3')])){throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0xa4'));}_0x14404d=_0xa37d31;var _0xb31f25={};_0xb31f25[_0xfe15('0x53')]=_['keys'](db[_[_0xfe15('0xa6')](_0x429ac9['query'][_0xfe15('0xb3')])+'Queue'][_0xfe15('0x3a')]);_0xb31f25[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x429ac9[_0xfe15('0x3f')]);_0xb31f25[_0xfe15('0x52')]=_[_0xfe15('0x54')](_0xb31f25[_0xfe15('0x53')],_0xb31f25[_0xfe15('0x3f')]);_0x1a83be[_0xfe15('0x44')]=_['intersection'](_0xb31f25['model'],qs[_0xfe15('0x55')](_0x429ac9[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x1a83be[_0xfe15('0x44')]=_0x1a83be['attributes'][_0xfe15('0x49')]?_0x1a83be[_0xfe15('0x44')]:_0xb31f25[_0xfe15('0x53')];_0x1a83be[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x429ac9[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x1a83be[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x429ac9[_0xfe15('0x3f')],_0xb31f25[_0xfe15('0x52')]));if(_0x429ac9[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x1a83be[_0xfe15('0x3e')]=_['merge'](_0x1a83be[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0x1a83be[_0xfe15('0x44')],function(_0x44d91b){var _0x28c0e7={};_0x28c0e7[_0x44d91b]={'$like':'%'+_0x429ac9['query']['filter']+'%'};return _0x28c0e7;})});}_0x1a83be=_[_0xfe15('0x56')]({},_0x1a83be,_0x429ac9[_0xfe15('0x57')]);switch(_0x14404d[_0xfe15('0x2b')]){case _0xfe15('0x2c'):return db[_[_0xfe15('0xa6')](_0x429ac9['query']['channel'])+'Queue'][_0xfe15('0x46')](_0x1a83be);case'user':case _0xfe15('0x72'):return _0x14404d[_0xfe15('0x2a')+_['capitalize'](_0x429ac9[_0xfe15('0x3f')]['channel'])+_0xfe15('0xa8')](_0x1a83be);default:throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0xd8'));}})[_0xfe15('0x29')](function(_0x235ceb){_0x2c2912=_0x235ceb[_0xfe15('0x49')];if(!_0x429ac9['query']['hasOwnProperty'](_0xfe15('0xd4'))){_0x1a83be[_0xfe15('0x25')]=qs['limit'](_0x429ac9[_0xfe15('0x3f')]['limit']);_0x1a83be[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x429ac9[_0xfe15('0x3f')]['offset']);}switch(_0x14404d[_0xfe15('0x2b')]){case _0xfe15('0x2c'):return db[_[_0xfe15('0xa6')](_0x429ac9[_0xfe15('0x3f')][_0xfe15('0xb3')])+_0xfe15('0xd9')]['findAll'](_0x1a83be);case _0xfe15('0x80'):case _0xfe15('0x72'):return _0x14404d['get'+_[_0xfe15('0xa6')](_0x429ac9[_0xfe15('0x3f')]['channel'])+'Queues'](_0x1a83be);}})['then'](function(_0xff4b57){return{'count':_0x2c2912,'rows':_0xff4b57};})[_0xfe15('0x29')](respondWithResult(_0x35eacb,null))[_0xfe15('0x5d')](handleError(_0x35eacb,null));};exports[_0xfe15('0xda')]=function(_0x1cc03f,_0x55b415){var _0x53a4fa={};var _0x124fb7={};var _0xc0fb36;var _0x5cbfec;return db[_0xfe15('0x39')]['findOne']({'where':{'id':_0x1cc03f[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x55b415,null))[_0xfe15('0x29')](function(_0x47f1a1){if(_0x47f1a1){_0xc0fb36=_0x47f1a1;_0x124fb7['model']=_[_0xfe15('0xcc')](db[_0xfe15('0xb0')][_0xfe15('0x3a')]);_0x124fb7['query']=_[_0xfe15('0xcc')](_0x1cc03f['query']);_0x124fb7[_0xfe15('0x52')]=_['intersection'](_0x124fb7[_0xfe15('0x53')],_0x124fb7[_0xfe15('0x3f')]);_0x53a4fa['attributes']=_[_0xfe15('0x54')](_0x124fb7[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x1cc03f[_0xfe15('0x3f')]['fields']));_0x53a4fa[_0xfe15('0x44')]=_0x53a4fa[_0xfe15('0x44')][_0xfe15('0x49')]?_0x53a4fa[_0xfe15('0x44')]:_0x124fb7[_0xfe15('0x53')];_0x53a4fa[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x1cc03f[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x53a4fa[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x1cc03f[_0xfe15('0x3f')],_0x124fb7[_0xfe15('0x52')]));if(_0x1cc03f[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x53a4fa[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x53a4fa[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0x53a4fa[_0xfe15('0x44')],function(_0x287030){var _0x13d7dd={};_0x13d7dd[_0x287030]={'$like':'%'+_0x1cc03f[_0xfe15('0x3f')]['filter']+'%'};return _0x13d7dd;})});}_0x53a4fa=_[_0xfe15('0x56')]({},_0x53a4fa,_0x1cc03f[_0xfe15('0x57')]);return _0xc0fb36[_0xfe15('0xda')](_0x53a4fa);}})['then'](function(_0x184226){if(_0x184226){_0x5cbfec=_0x184226[_0xfe15('0x49')];if(!_0x1cc03f[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x53a4fa[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x1cc03f[_0xfe15('0x3f')]['limit']);_0x53a4fa[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x1cc03f['query'][_0xfe15('0x23')]);}return _0xc0fb36[_0xfe15('0xda')](_0x53a4fa);}})['then'](function(_0x85804e){if(_0x85804e){return _0x85804e?{'count':_0x5cbfec,'rows':_0x85804e}:null;}})[_0xfe15('0x29')](respondWithResult(_0x55b415,null))[_0xfe15('0x5d')](handleError(_0x55b415,null));};exports[_0xfe15('0xdb')]=function(_0x259347,_0x8eb2c6){var _0x2699c6={};var _0x54adc1={};var _0x41cfd6;var _0x3d376f;return db[_0xfe15('0x39')]['findOne']({'where':{'id':_0x259347[_0xfe15('0x60')]['id']}})['then'](handleEntityNotFound(_0x8eb2c6,null))[_0xfe15('0x29')](function(_0x11bbc7){if(_0x11bbc7){_0x41cfd6=_0x11bbc7;_0x54adc1[_0xfe15('0x53')]=_['keys'](db[_0xfe15('0xdc')][_0xfe15('0x3a')]);_0x54adc1['query']=_['keys'](_0x259347[_0xfe15('0x3f')]);_0x54adc1[_0xfe15('0x52')]=_['intersection'](_0x54adc1['model'],_0x54adc1[_0xfe15('0x3f')]);_0x2699c6['attributes']=_[_0xfe15('0x54')](_0x54adc1[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x259347[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x2699c6[_0xfe15('0x44')]=_0x2699c6[_0xfe15('0x44')][_0xfe15('0x49')]?_0x2699c6['attributes']:_0x54adc1[_0xfe15('0x53')];_0x2699c6[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x259347['query']['sort']);_0x2699c6['where']=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x259347[_0xfe15('0x3f')],_0x54adc1[_0xfe15('0x52')]));if(_0x259347[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x2699c6[_0xfe15('0x3e')]=_['merge'](_0x2699c6[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0x2699c6['attributes'],function(_0x512c4e){var _0x14bebb={};_0x14bebb[_0x512c4e]={'$like':'%'+_0x259347[_0xfe15('0x3f')]['filter']+'%'};return _0x14bebb;})});}_0x2699c6=_['merge']({},_0x2699c6,_0x259347[_0xfe15('0x57')]);return _0x41cfd6[_0xfe15('0xdb')](_0x2699c6);}})['then'](function(_0x15b079){if(_0x15b079){_0x3d376f=_0x15b079[_0xfe15('0x49')];if(!_0x259347[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x2699c6[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x259347[_0xfe15('0x3f')][_0xfe15('0x25')]);_0x2699c6[_0xfe15('0x23')]=qs['offset'](_0x259347[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x41cfd6[_0xfe15('0xdb')](_0x2699c6);}})[_0xfe15('0x29')](function(_0x29829b){if(_0x29829b){return _0x29829b?{'count':_0x3d376f,'rows':_0x29829b}:null;}})[_0xfe15('0x29')](respondWithResult(_0x8eb2c6,null))[_0xfe15('0x5d')](handleError(_0x8eb2c6,null));};exports[_0xfe15('0xdd')]=function(_0x4c0b3a,_0x1d464b){var _0x47cff4={'raw':!![],'where':{}};var _0x38fc95={};var _0x5200fc={'count':0x0,'rows':[]};return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x4c0b3a[_0xfe15('0x60')]['id']}})['then'](handleEntityNotFound(_0x1d464b,null))['then'](function(_0x40afc7){if(_0x40afc7){_0x38fc95[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db[_0xfe15('0xde')]['rawAttributes']);_0x38fc95[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x4c0b3a[_0xfe15('0x3f')]);_0x38fc95[_0xfe15('0x52')]=_['intersection'](_0x38fc95[_0xfe15('0x53')],_0x38fc95[_0xfe15('0x3f')]);_0x47cff4['attributes']=_[_0xfe15('0x54')](_0x38fc95[_0xfe15('0x53')],qs['fields'](_0x4c0b3a[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x47cff4[_0xfe15('0x44')]=_0x47cff4[_0xfe15('0x44')][_0xfe15('0x49')]?_0x47cff4['attributes']:_0x38fc95['model'];if(!_0x4c0b3a[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x47cff4[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x4c0b3a['query'][_0xfe15('0x25')]);_0x47cff4[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x4c0b3a[_0xfe15('0x3f')]['offset']);}_0x47cff4['order']=qs[_0xfe15('0xce')](_0x4c0b3a[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x47cff4[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_['pick'](_0x4c0b3a[_0xfe15('0x3f')],_0x38fc95[_0xfe15('0x52')]));_0x47cff4[_0xfe15('0x3e')][_0xfe15('0xdf')]=_0x40afc7['id'];if(_0x4c0b3a[_0xfe15('0x3f')]['filter']){_0x47cff4[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x47cff4[_0xfe15('0x3e')],{'$or':_['map'](_0x47cff4[_0xfe15('0x44')],function(_0x320055){var _0x3629bd={};_0x3629bd[_0x320055]={'$like':'%'+_0x4c0b3a[_0xfe15('0x3f')]['filter']+'%'};return _0x3629bd;})});}_0x47cff4=_[_0xfe15('0x56')]({},_0x47cff4,_0x4c0b3a[_0xfe15('0x57')]);return db[_0xfe15('0xde')]['count']({'where':_0x47cff4[_0xfe15('0x3e')]})[_0xfe15('0x29')](function(_0x21af97){_0x5200fc['count']=_0x21af97;if(_0x4c0b3a[_0xfe15('0x3f')]['includeAll']){_0x47cff4[_0xfe15('0x41')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x47cff4);})['then'](function(_0x4b02bf){_0x5200fc[_0xfe15('0x47')]=_0x4b02bf;return _0x5200fc;});}})['then'](respondWithFilteredResult(_0x1d464b,_0x47cff4))[_0xfe15('0x5d')](handleError(_0x1d464b,null));};exports[_0xfe15('0xe0')]=function(_0x2eabe7,_0x4f000d){var _0x4d29c0={'raw':!![],'where':{}};var _0x424806={};var _0x58bb1a={'count':0x0,'rows':[]};return db[_0xfe15('0x39')]['findOne']({'where':{'id':_0x2eabe7[_0xfe15('0x60')]['id']}})['then'](handleEntityNotFound(_0x4f000d,null))[_0xfe15('0x29')](function(_0x25f91e){if(_0x25f91e){_0x424806[_0xfe15('0x53')]=_['keys'](db[_0xfe15('0xe1')][_0xfe15('0x3a')]);_0x424806['query']=_[_0xfe15('0xcc')](_0x2eabe7['query']);_0x424806['filters']=_['intersection'](_0x424806[_0xfe15('0x53')],_0x424806['query']);_0x4d29c0[_0xfe15('0x44')]=_['intersection'](_0x424806[_0xfe15('0x53')],qs['fields'](_0x2eabe7[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x4d29c0[_0xfe15('0x44')]=_0x4d29c0[_0xfe15('0x44')]['length']?_0x4d29c0[_0xfe15('0x44')]:_0x424806[_0xfe15('0x53')];if(!_0x2eabe7['query'][_0xfe15('0xcf')]('nolimit')){_0x4d29c0[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x2eabe7[_0xfe15('0x3f')]['limit']);_0x4d29c0[_0xfe15('0x23')]=qs['offset'](_0x2eabe7[_0xfe15('0x3f')][_0xfe15('0x23')]);}_0x4d29c0[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x2eabe7[_0xfe15('0x3f')]['sort']);_0x4d29c0[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x2eabe7[_0xfe15('0x3f')],_0x424806['filters']));_0x4d29c0[_0xfe15('0x3e')][_0xfe15('0xdf')]=_0x25f91e['id'];if(_0x2eabe7[_0xfe15('0x3f')]['filter']){_0x4d29c0[_0xfe15('0x3e')]=_['merge'](_0x4d29c0[_0xfe15('0x3e')],{'$or':_['map'](_0x4d29c0[_0xfe15('0x44')],function(_0x5735b9){var _0x14d7d3={};_0x14d7d3[_0x5735b9]={'$like':'%'+_0x2eabe7[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x14d7d3;})});}_0x4d29c0=_[_0xfe15('0x56')]({},_0x4d29c0,_0x2eabe7[_0xfe15('0x57')]);return db[_0xfe15('0xe1')][_0xfe15('0x24')]({'where':_0x4d29c0[_0xfe15('0x3e')]})['then'](function(_0x37cbcd){_0x58bb1a['count']=_0x37cbcd;if(_0x2eabe7[_0xfe15('0x3f')][_0xfe15('0x40')]){_0x4d29c0[_0xfe15('0x41')]=[{'all':!![]}];}return db[_0xfe15('0xe1')][_0xfe15('0x46')](_0x4d29c0);})['then'](function(_0x501ac9){_0x58bb1a[_0xfe15('0x47')]=_0x501ac9;return _0x58bb1a;});}})[_0xfe15('0x29')](respondWithFilteredResult(_0x4f000d,_0x4d29c0))[_0xfe15('0x5d')](handleError(_0x4f000d,null));};exports[_0xfe15('0xe2')]=function(_0x2e3e39,_0x29fb98){var _0x956a49={};var _0x513903={};var _0x346d7f;var _0x349915;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x2e3e39['params']['id']}})['then'](handleEntityNotFound(_0x29fb98,null))['then'](function(_0x357697){if(_0x357697){_0x346d7f=_0x357697;_0x513903[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db[_0xfe15('0xe3')][_0xfe15('0x3a')]);_0x513903[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x2e3e39[_0xfe15('0x3f')]);_0x513903[_0xfe15('0x52')]=_['intersection'](_0x513903[_0xfe15('0x53')],_0x513903['query']);_0x956a49[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x513903[_0xfe15('0x53')],qs['fields'](_0x2e3e39[_0xfe15('0x3f')]['fields']));_0x956a49['attributes']=_0x956a49[_0xfe15('0x44')][_0xfe15('0x49')]?_0x956a49[_0xfe15('0x44')]:_0x513903['model'];_0x956a49[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x2e3e39['query'][_0xfe15('0xce')]);_0x956a49[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x2e3e39['query'],_0x513903[_0xfe15('0x52')]));if(_0x2e3e39[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x956a49[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x956a49['where'],{'$or':_[_0xfe15('0x31')](_0x956a49[_0xfe15('0x44')],function(_0x347be3){var _0xe3c96={};_0xe3c96[_0x347be3]={'$like':'%'+_0x2e3e39[_0xfe15('0x3f')]['filter']+'%'};return _0xe3c96;})});}_0x956a49=_['merge']({},_0x956a49,_0x2e3e39[_0xfe15('0x57')]);return _0x346d7f[_0xfe15('0xe2')](_0x956a49);}})[_0xfe15('0x29')](function(_0x260ba9){if(_0x260ba9){_0x349915=_0x260ba9[_0xfe15('0x49')];if(!_0x2e3e39[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x956a49[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x2e3e39[_0xfe15('0x3f')][_0xfe15('0x25')]);_0x956a49[_0xfe15('0x23')]=qs['offset'](_0x2e3e39['query'][_0xfe15('0x23')]);}return _0x346d7f[_0xfe15('0xe2')](_0x956a49);}})[_0xfe15('0x29')](function(_0x18a74b){if(_0x18a74b){return _0x18a74b?{'count':_0x349915,'rows':_0x18a74b}:null;}})[_0xfe15('0x29')](respondWithResult(_0x29fb98,null))['catch'](handleError(_0x29fb98,null));};exports[_0xfe15('0xe4')]=function(_0x5481ff,_0x14301a){var _0x6c0177={};var _0x185765={};var _0x5897c5;var _0x216965;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x5481ff[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x14301a,null))[_0xfe15('0x29')](function(_0x1a508a){if(_0x1a508a){_0x5897c5=_0x1a508a;_0x185765['model']=_[_0xfe15('0xcc')](db[_0xfe15('0xe5')][_0xfe15('0x3a')]);_0x185765['query']=_[_0xfe15('0xcc')](_0x5481ff[_0xfe15('0x3f')]);_0x185765[_0xfe15('0x52')]=_['intersection'](_0x185765[_0xfe15('0x53')],_0x185765[_0xfe15('0x3f')]);_0x6c0177[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x185765[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x5481ff[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x6c0177[_0xfe15('0x44')]=_0x6c0177[_0xfe15('0x44')][_0xfe15('0x49')]?_0x6c0177[_0xfe15('0x44')]:_0x185765['model'];_0x6c0177[_0xfe15('0xcd')]=qs['sort'](_0x5481ff['query'][_0xfe15('0xce')]);_0x6c0177[_0xfe15('0x3e')]=qs['filters'](_[_0xfe15('0xd7')](_0x5481ff[_0xfe15('0x3f')],_0x185765['filters']));if(_0x5481ff[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x6c0177[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x6c0177['where'],{'$or':_[_0xfe15('0x31')](_0x6c0177[_0xfe15('0x44')],function(_0x5f0f0f){var _0xc3472e={};_0xc3472e[_0x5f0f0f]={'$like':'%'+_0x5481ff[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0xc3472e;})});}_0x6c0177=_['merge']({},_0x6c0177,_0x5481ff[_0xfe15('0x57')]);return _0x5897c5[_0xfe15('0xe4')](_0x6c0177);}})[_0xfe15('0x29')](function(_0x4c95ac){if(_0x4c95ac){_0x216965=_0x4c95ac[_0xfe15('0x49')];if(!_0x5481ff[_0xfe15('0x3f')]['hasOwnProperty'](_0xfe15('0xd4'))){_0x6c0177[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x5481ff[_0xfe15('0x3f')][_0xfe15('0x25')]);_0x6c0177[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x5481ff[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x5897c5[_0xfe15('0xe4')](_0x6c0177);}})['then'](function(_0xb725d2){if(_0xb725d2){return _0xb725d2?{'count':_0x216965,'rows':_0xb725d2}:null;}})[_0xfe15('0x29')](respondWithResult(_0x14301a,null))['catch'](handleError(_0x14301a,null));};exports[_0xfe15('0xe6')]=function(_0x259a97,_0x20c6ba){var _0x5154e2={'raw':!![],'where':{}};var _0x32358={};var _0x24d8ea={'count':0x0,'rows':[]};return db['User'][_0xfe15('0x9b')]({'where':{'id':_0x259a97[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x20c6ba,null))['then'](function(_0x393660){if(_0x393660){_0x32358[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db['MailInteraction'][_0xfe15('0x3a')]);_0x32358[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x259a97[_0xfe15('0x3f')]);_0x32358[_0xfe15('0x52')]=_['intersection'](_0x32358[_0xfe15('0x53')],_0x32358[_0xfe15('0x3f')]);_0x5154e2[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x32358[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x259a97['query']['fields']));_0x5154e2[_0xfe15('0x44')]=_0x5154e2[_0xfe15('0x44')][_0xfe15('0x49')]?_0x5154e2[_0xfe15('0x44')]:_0x32358['model'];if(!_0x259a97['query'][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x5154e2['limit']=qs[_0xfe15('0x25')](_0x259a97[_0xfe15('0x3f')]['limit']);_0x5154e2[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x259a97[_0xfe15('0x3f')][_0xfe15('0x23')]);}_0x5154e2['order']=qs['sort'](_0x259a97['query'][_0xfe15('0xce')]);_0x5154e2[_0xfe15('0x3e')]=qs['filters'](_[_0xfe15('0xd7')](_0x259a97['query'],_0x32358[_0xfe15('0x52')]));_0x5154e2[_0xfe15('0x3e')]['UserId']=_0x393660['id'];if(_0x259a97['query'][_0xfe15('0x2f')]){_0x5154e2['where']=_[_0xfe15('0x56')](_0x5154e2['where'],{'$or':_['map'](_0x5154e2['attributes'],function(_0x4837f2){var _0x17ec1e={};_0x17ec1e[_0x4837f2]={'$like':'%'+_0x259a97['query'][_0xfe15('0x2f')]+'%'};return _0x17ec1e;})});}_0x5154e2=_[_0xfe15('0x56')]({},_0x5154e2,_0x259a97['options']);return db['MailInteraction'][_0xfe15('0x24')]({'where':_0x5154e2[_0xfe15('0x3e')]})[_0xfe15('0x29')](function(_0x4d2a63){_0x24d8ea['count']=_0x4d2a63;if(_0x259a97[_0xfe15('0x3f')][_0xfe15('0x40')]){_0x5154e2[_0xfe15('0x41')]=[{'all':!![]}];}return db[_0xfe15('0xe7')][_0xfe15('0x46')](_0x5154e2);})[_0xfe15('0x29')](function(_0x203799){_0x24d8ea['rows']=_0x203799;return _0x24d8ea;});}})[_0xfe15('0x29')](respondWithFilteredResult(_0x20c6ba,_0x5154e2))[_0xfe15('0x5d')](handleError(_0x20c6ba,null));};exports[_0xfe15('0xe8')]=function(_0x471d57,_0x4f9217){var _0xb837a3={};var _0x3b5aa5={};var _0x18bc28;var _0x49090e;return db['User'][_0xfe15('0x9b')]({'where':{'id':_0x471d57[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x4f9217,null))[_0xfe15('0x29')](function(_0x145eb1){if(_0x145eb1){_0x18bc28=_0x145eb1;_0x3b5aa5[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db[_0xfe15('0xe9')][_0xfe15('0x3a')]);_0x3b5aa5['query']=_['keys'](_0x471d57[_0xfe15('0x3f')]);_0x3b5aa5[_0xfe15('0x52')]=_[_0xfe15('0x54')](_0x3b5aa5[_0xfe15('0x53')],_0x3b5aa5[_0xfe15('0x3f')]);_0xb837a3[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x3b5aa5[_0xfe15('0x53')],qs['fields'](_0x471d57[_0xfe15('0x3f')]['fields']));_0xb837a3[_0xfe15('0x44')]=_0xb837a3['attributes'][_0xfe15('0x49')]?_0xb837a3[_0xfe15('0x44')]:_0x3b5aa5['model'];_0xb837a3[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x471d57[_0xfe15('0x3f')][_0xfe15('0xce')]);_0xb837a3['where']=qs['filters'](_[_0xfe15('0xd7')](_0x471d57[_0xfe15('0x3f')],_0x3b5aa5['filters']));if(_0x471d57['query'][_0xfe15('0x2f')]){_0xb837a3[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0xb837a3[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0xb837a3[_0xfe15('0x44')],function(_0x2e173c){var _0x467035={};_0x467035[_0x2e173c]={'$like':'%'+_0x471d57[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x467035;})});}_0xb837a3=_[_0xfe15('0x56')]({},_0xb837a3,_0x471d57[_0xfe15('0x57')]);return _0x18bc28['getSmsInteractions'](_0xb837a3);}})[_0xfe15('0x29')](function(_0x4211a2){if(_0x4211a2){_0x49090e=_0x4211a2[_0xfe15('0x49')];if(!_0x471d57[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0xb837a3[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x471d57[_0xfe15('0x3f')]['limit']);_0xb837a3[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x471d57[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x18bc28[_0xfe15('0xe8')](_0xb837a3);}})[_0xfe15('0x29')](function(_0x300226){if(_0x300226){return _0x300226?{'count':_0x49090e,'rows':_0x300226}:null;}})[_0xfe15('0x29')](respondWithResult(_0x4f9217,null))['catch'](handleError(_0x4f9217,null));};exports['getFaxInteractions']=function(_0x10f048,_0x305d1f){var _0x526238={};var _0x30bfd5={};var _0x334d92;var _0x4ca91a;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x10f048[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x305d1f,null))[_0xfe15('0x29')](function(_0x40b5e3){if(_0x40b5e3){_0x334d92=_0x40b5e3;_0x30bfd5[_0xfe15('0x53')]=_['keys'](db[_0xfe15('0xea')][_0xfe15('0x3a')]);_0x30bfd5['query']=_['keys'](_0x10f048[_0xfe15('0x3f')]);_0x30bfd5['filters']=_[_0xfe15('0x54')](_0x30bfd5['model'],_0x30bfd5['query']);_0x526238[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x30bfd5['model'],qs[_0xfe15('0x55')](_0x10f048['query']['fields']));_0x526238[_0xfe15('0x44')]=_0x526238[_0xfe15('0x44')][_0xfe15('0x49')]?_0x526238[_0xfe15('0x44')]:_0x30bfd5['model'];_0x526238[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x10f048[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x526238[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x10f048[_0xfe15('0x3f')],_0x30bfd5[_0xfe15('0x52')]));if(_0x10f048['query'][_0xfe15('0x2f')]){_0x526238[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x526238['where'],{'$or':_[_0xfe15('0x31')](_0x526238[_0xfe15('0x44')],function(_0x25ab7d){var _0x251ec8={};_0x251ec8[_0x25ab7d]={'$like':'%'+_0x10f048[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x251ec8;})});}_0x526238=_[_0xfe15('0x56')]({},_0x526238,_0x10f048[_0xfe15('0x57')]);return _0x334d92['getFaxInteractions'](_0x526238);}})['then'](function(_0x59b6c6){if(_0x59b6c6){_0x4ca91a=_0x59b6c6[_0xfe15('0x49')];if(!_0x10f048[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x526238['limit']=qs['limit'](_0x10f048['query'][_0xfe15('0x25')]);_0x526238[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x10f048[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x334d92[_0xfe15('0xeb')](_0x526238);}})['then'](function(_0x25e40e){if(_0x25e40e){return _0x25e40e?{'count':_0x4ca91a,'rows':_0x25e40e}:null;}})[_0xfe15('0x29')](respondWithResult(_0x305d1f,null))[_0xfe15('0x5d')](handleError(_0x305d1f,null));};exports[_0xfe15('0xec')]=function(_0x58ca58,_0x2d2316){var _0x1e9034={};var _0x570d5f={};var _0x4f9e82;var _0x1ba345;return db['User'][_0xfe15('0x9b')]({'where':{'id':_0x58ca58[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x2d2316,null))[_0xfe15('0x29')](function(_0x4ed704){if(_0x4ed704){_0x4f9e82=_0x4ed704;_0x570d5f[_0xfe15('0x53')]=_['keys'](db[_0xfe15('0xed')][_0xfe15('0x3a')]);_0x570d5f[_0xfe15('0x3f')]=_['keys'](_0x58ca58['query']);_0x570d5f[_0xfe15('0x52')]=_[_0xfe15('0x54')](_0x570d5f[_0xfe15('0x53')],_0x570d5f[_0xfe15('0x3f')]);_0x1e9034[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x570d5f[_0xfe15('0x53')],qs['fields'](_0x58ca58['query'][_0xfe15('0x55')]));_0x1e9034[_0xfe15('0x44')]=_0x1e9034[_0xfe15('0x44')][_0xfe15('0x49')]?_0x1e9034[_0xfe15('0x44')]:_0x570d5f['model'];_0x1e9034['order']=qs['sort'](_0x58ca58[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x1e9034[_0xfe15('0x3e')]=qs['filters'](_[_0xfe15('0xd7')](_0x58ca58[_0xfe15('0x3f')],_0x570d5f['filters']));if(_0x58ca58['query'][_0xfe15('0x2f')]){_0x1e9034[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x1e9034['where'],{'$or':_['map'](_0x1e9034[_0xfe15('0x44')],function(_0x35f3cc){var _0x36967f={};_0x36967f[_0x35f3cc]={'$like':'%'+_0x58ca58[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x36967f;})});}_0x1e9034=_['merge']({},_0x1e9034,_0x58ca58['options']);return _0x4f9e82['getWhatsappInteractions'](_0x1e9034);}})['then'](function(_0x50fd2b){if(_0x50fd2b){_0x1ba345=_0x50fd2b[_0xfe15('0x49')];if(!_0x58ca58[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x1e9034[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x58ca58[_0xfe15('0x3f')]['limit']);_0x1e9034[_0xfe15('0x23')]=qs['offset'](_0x58ca58[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x4f9e82['getWhatsappInteractions'](_0x1e9034);}})[_0xfe15('0x29')](function(_0x2415ec){if(_0x2415ec){return _0x2415ec?{'count':_0x1ba345,'rows':_0x2415ec}:null;}})[_0xfe15('0x29')](respondWithResult(_0x2d2316,null))['catch'](handleError(_0x2d2316,null));};exports['login']=function(_0xd0c8c8,_0x240544,_0x34b603){var _0x334bbe;var _0x5d9c57;var _0x3e20b4;var _0x33cd05=!_[_0xfe15('0x67')](_0xd0c8c8[_0xfe15('0x60')]['id'])?_0xd0c8c8[_0xfe15('0x60')]['id']:!_[_0xfe15('0x67')](_0xd0c8c8['user']['id'])?_0xd0c8c8[_0xfe15('0x80')]['id']:null;return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x33cd05,'role':{'$or':[_0xfe15('0x2c'),_0xfe15('0x80'),'agent']}},'attributes':['id',_0xfe15('0x33'),_0xfe15('0xee'),_0xfe15('0xef'),_0xfe15('0x2b'),_0xfe15('0x63'),_0xfe15('0xf0')]})[_0xfe15('0x29')](function(_0x500733){if(_0x500733){if(_0x500733[_0xfe15('0x2b')]===_0xfe15('0x72')){_0x334bbe=_0x500733;if(_0xd0c8c8[_0xfe15('0x5c')][_0xfe15('0xa3')]){_0x3e20b4=util[_0xfe15('0xaf')](_0xfe15('0xf1'),_0x334bbe[_0xd0c8c8[_0xfe15('0x5c')][_0xfe15('0xa3')]]);}else if(_0xd0c8c8[_0xfe15('0x5c')][_0xfe15('0xf2')]){_0x3e20b4=util[_0xfe15('0xaf')]('SIP/%s',_0xd0c8c8['body']['intrf']);}else{_0x3e20b4=util[_0xfe15('0xaf')](_0xfe15('0xf3'),_0x334bbe[_0xfe15('0x33')]);}socket['to'](util[_0xfe15('0xaf')]('user:%s',_0x334bbe[_0xfe15('0x33')]))[_0xfe15('0xac')](_0xfe15('0xf4'),{'user':{'id':_0x334bbe['id'],'name':_0x334bbe['name']},'ip':_0xd0c8c8[_0xfe15('0xf5')]['x-forwarded-for']||_0xd0c8c8[_0xfe15('0xf6')]['remoteAddress']||_0xd0c8c8[_0xfe15('0xf7')][_0xfe15('0xf8')]||_0xd0c8c8[_0xfe15('0xf6')][_0xfe15('0xf7')]['remoteAddress']});return db[_0xfe15('0xb0')][_0xfe15('0x35')]({'where':{'membername':_0x334bbe[_0xfe15('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0xfe15('0x94'))][(_0xfe15('0x97'))](_0xfe15('0xf9'));}})[_0xfe15('0x29')](function(){if(_0x334bbe){return _0x334bbe[_0xfe15('0xfa')]({'raw':!![]});}})['then'](function(_0x4bece9){if(_0x334bbe){var _0x8f04d6=[];if(_0x4bece9){_0x5d9c57=_0x4bece9;if(_0x5d9c57[_0xfe15('0x49')]){for(var _0x3c4844=0x0;_0x3c4844<_0x5d9c57['length'];_0x3c4844++){_0x8f04d6['push']({'membername':_0x334bbe[_0xfe15('0x33')],'UserId':_0x334bbe['id'],'queue_name':_0x5d9c57[_0x3c4844][_0xfe15('0x33')],'VoiceQueueId':_0x5d9c57[_0x3c4844]['id'],'interface':_0x3e20b4,'paused':_0x334bbe[_0xfe15('0xf0')]||![],'penalty':_0x5d9c57[_0x3c4844][_0xfe15('0xfb')]||0x0});}return BPromise[_0xfe15('0x8c')](_0x8f04d6,function(_0x2d6303){return db[_0xfe15('0xb0')][_0xfe15('0xb1')](_0x2d6303);});}}}})['then'](function(){if(_0x334bbe){return db[_0xfe15('0xfc')][_0xfe15('0x46')]({'where':{'membername':_0x334bbe[_0xfe15('0x33')],'exitAt':null}});}})[_0xfe15('0x29')](function(_0x34ce2b){if(_0x334bbe){var _0x493de1=[];_0x34ce2b[_0xfe15('0xfd')](function(_0x298758){_0x493de1[_0xfe15('0x45')](_0x298758['update']({'exitAt':moment()[_0xfe15('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xfe15('0x4f')](_0x493de1);}})[_0xfe15('0x29')](function(){if(_0x334bbe){var _0x59ba91=[];var _0x2a4715=[];var _0x1e326a=utils[_0xfe15('0xfe')]();var _0x1151cc={'membername':_0x334bbe[_0xfe15('0x33')],'interface':_0x3e20b4,'enterAt':moment()[_0xfe15('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x334bbe[_0xfe15('0x2b')],'internal':_0x334bbe[_0xfe15('0x63')]};_0x1e326a[_0xfe15('0xfd')](function(_0x83516b){_0x59ba91[_0xfe15('0x45')](_[_0xfe15('0x56')]({'channel':_0x83516b,'type':'LOGIN','data1':_0xd0c8c8['body']['device'],'data2':_0x3e20b4},_0x1151cc));if(_0x334bbe[_0xfe15('0xf0')]){_0x2a4715['push'](_[_0xfe15('0x56')]({'channel':_0x83516b,'type':_0xfe15('0xff'),'data1':_0xfe15('0x100')},_0x1151cc));}});return db['MemberReport'][_0xfe15('0x101')](_0x59ba91[_0xfe15('0xca')](_0x2a4715),{'individualHooks':!![]});}})[_0xfe15('0x29')](function(){if(_0x334bbe){return _0x334bbe[_0xfe15('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfe15('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x334bbe['loginInPause']||![],'mailPause':_0x334bbe[_0xfe15('0xf0')]||![],'chatPause':_0x334bbe['loginInPause']||![],'faxPause':_0x334bbe[_0xfe15('0xf0')]||![],'smsPause':_0x334bbe[_0xfe15('0xf0')]||![],'openchannelPause':_0x334bbe[_0xfe15('0xf0')]||![],'whatsappPause':_0x334bbe[_0xfe15('0xf0')]||![],'pauseType':_0x334bbe[_0xfe15('0xf0')]?'LOGININPAUSE':null,'interface':_0x3e20b4,'lastPauseAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102'))});}})[_0xfe15('0x29')](function(_0x4e0b9e){if(_0xd0c8c8[_0xfe15('0x103')]){return _0x34b603();}else{return BPromise[_0xfe15('0x104')](_0x4e0b9e)['then'](respondWithResult(_0x240544,null));}})['catch'](handleError(_0x240544,null));};exports[_0xfe15('0x105')]=function(_0x3555b7,_0x5af813){var _0x452bec;return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x3555b7['params']['id'],'role':_0xfe15('0x72')},'attributes':['id','name',_0xfe15('0x2b')]})['then'](handleEntityNotFound(_0x5af813,null))['then'](function(_0x267fd0){if(_0x267fd0){_0x452bec=_0x267fd0;return db[_0xfe15('0xb0')][_0xfe15('0x35')]({'where':{'membername':_0x452bec[_0xfe15('0x33')]},'individualHooks':!![]});}})[_0xfe15('0x29')](function(){return db['MemberReport'][_0xfe15('0x46')]({'where':{'membername':_0x452bec[_0xfe15('0x33')],'exitAt':null}});})[_0xfe15('0x29')](function(_0x131748){var _0x412711=[];_0x131748[_0xfe15('0xfd')](function(_0x57fec9){_0x412711['push'](_0x57fec9[_0xfe15('0x28')]({'exitAt':moment()['format'](_0xfe15('0x102'))}));});return BPromise[_0xfe15('0x4f')](_0x412711);})['then'](function(){return _0x452bec['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfe15('0x29')](respondWithResult(_0x5af813,null))['catch'](handleError(_0x5af813,null));};exports[_0xfe15('0x106')]=function(_0x23ad17,_0x2682d1){var _0x13b6a9;return db[_0xfe15('0xb0')][_0xfe15('0x28')]({'paused':0x1},{'where':{'UserId':_0x23ad17['params']['id']},'individualHooks':!![]})[_0xfe15('0x29')](function(){return db[_0xfe15('0x39')][_0xfe15('0x58')]({'where':{'id':_0x23ad17['params']['id'],'role':'agent'},'attributes':['id',_0xfe15('0x33'),_0xfe15('0x2b'),_0xfe15('0x63'),_0xfe15('0xa3')]});})[_0xfe15('0x29')](handleEntityNotFound(_0x2682d1,null))[_0xfe15('0x29')](function(_0x515526){if(_0x515526){_0x13b6a9=_0x515526;return respondWithRpcPromise(_0xfe15('0x107'),_0xfe15('0x106'),{'id':_0x13b6a9['id'],'name':_0x13b6a9[_0xfe15('0x33')],'pause':!![]});}})[_0xfe15('0x29')](function(){if(_0x13b6a9){return db[_0xfe15('0xfc')]['findAll']({'where':{'membername':_0x13b6a9[_0xfe15('0x33')],'type':_0xfe15('0xff'),'exitAt':null}});}})[_0xfe15('0x29')](function(_0x332f88){if(_0x332f88['length']){var _0x553a86=moment()[_0xfe15('0xaf')](_0xfe15('0x102'));for(var _0x2144bc=0x0,_0x3da68c=_0x332f88[_0xfe15('0x49')];_0x2144bc<_0x3da68c;_0x2144bc++){_0x332f88[_0x2144bc][_0xfe15('0x108')]({'exitAt':_0x553a86});}}})[_0xfe15('0x29')](function(){var _0x14a54d=[];var _0x35d801=utils[_0xfe15('0xfe')]();_0x35d801['forEach'](function(_0x523471){_0x14a54d[_0xfe15('0x45')]({'channel':_0x523471,'membername':_0x13b6a9[_0xfe15('0x33')],'interface':_[_0xfe15('0x67')](_0x13b6a9[_0xfe15('0xa3')])?util[_0xfe15('0xaf')](_0xfe15('0xf3'),_0x13b6a9[_0xfe15('0x33')]):_0x13b6a9[_0xfe15('0xa3')],'type':_0xfe15('0xff'),'enterAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102')),'data1':_0x23ad17[_0xfe15('0x5c')][_0xfe15('0x3c')]||'DEFAULT\x20PAUSE','role':_0x13b6a9['role'],'internal':_0x13b6a9[_0xfe15('0x63')]});});return db[_0xfe15('0xfc')][_0xfe15('0x101')](_0x14a54d,{'individualHooks':!![]});})['then'](function(){return _0x13b6a9[_0xfe15('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x23ad17[_0xfe15('0x5c')][_0xfe15('0x3c')]||_0xfe15('0x109'),'lastPauseAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102'))});})[_0xfe15('0x29')](respondWithResult(_0x2682d1,null))[_0xfe15('0x5d')](handleError(_0x2682d1,null));};exports[_0xfe15('0x10a')]=function(_0x241d8d,_0x33fa36){var _0x2cea52;return db['User']['find']({'where':{'id':_0x241d8d[_0xfe15('0x60')]['id']},'attributes':['id',_0xfe15('0x33'),_0xfe15('0x2b'),_0xfe15('0xa2'),_0xfe15('0x10b'),_0xfe15('0x10c'),'faxPause',_0xfe15('0x10d'),_0xfe15('0x10e'),_0xfe15('0x10f'),_0xfe15('0x110'),_0xfe15('0x111')]})[_0xfe15('0x29')](handleEntityNotFound(_0x33fa36,null))['then'](function(_0x43c496){if(_0x43c496){_0x2cea52=_0x43c496;if(_0x241d8d[_0xfe15('0x5c')][_0xfe15('0xb3')]&&!utils[_0xfe15('0xd6')](_0x241d8d[_0xfe15('0x5c')]['channel'])){throw new db[(_0xfe15('0x94'))]['ValidationError'](_0xfe15('0xa4'));}switch(_0x241d8d[_0xfe15('0x5c')]['channel']){case'voice':return respondWithRpcPromise('QueuePause',_0xfe15('0x10a'),{'id':_0x2cea52['id'],'name':_0x2cea52[_0xfe15('0x33')],'pause':![]})[_0xfe15('0x29')](function(){return db[_0xfe15('0xb0')][_0xfe15('0x28')]({'paused':0x0},{'where':{'UserId':_0x2cea52['id']},'individualHooks':!![]});})[_0xfe15('0x29')](function(){return db[_0xfe15('0xfc')][_0xfe15('0x58')]({'where':{'channel':_0x241d8d[_0xfe15('0x5c')][_0xfe15('0xb3')],'membername':_0x2cea52[_0xfe15('0x33')],'type':_0xfe15('0xff'),'exitAt':null}});})['then'](function(_0x3c550c){if(_0x3c550c){return _0x3c550c[_0xfe15('0x28')]({'exitAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102')),'data2':_0xfe15('0x112')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2cea52[_0xfe15('0x28')]({'voicePause':![]});});case'mail':case _0xfe15('0x4a'):case _0xfe15('0x5b'):case _0xfe15('0x4c'):case'whatsapp':case'openchannel':return db[_0xfe15('0xfc')][_0xfe15('0x58')]({'where':{'channel':_0x241d8d[_0xfe15('0x5c')]['channel'],'membername':_0x2cea52[_0xfe15('0x33')],'type':_0xfe15('0xff'),'exitAt':null}})['then'](function(_0x57c4ba){if(_0x57c4ba){return _0x57c4ba[_0xfe15('0x28')]({'exitAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102')),'data2':_0xfe15('0x112')},{'individualHooks':!![]});}return null;})[_0xfe15('0x29')](function(){var _0x56b44d={};_['set'](_0x56b44d,util['format']('%s%s',_0x241d8d[_0xfe15('0x5c')]['channel'],_0xfe15('0x113')),![]);return _0x2cea52[_0xfe15('0x28')](_0x56b44d);});default:return respondWithRpcPromise(_0xfe15('0x107'),_0xfe15('0x10a'),{'id':_0x2cea52['id'],'name':_0x2cea52[_0xfe15('0x33')],'pause':![]})['then'](function(){return db[_0xfe15('0xb0')]['update']({'paused':0x0},{'where':{'UserId':_0x2cea52['id']}});})[_0xfe15('0x29')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2cea52[_0xfe15('0x33')],'type':_0xfe15('0xff'),'exitAt':null}});})['then'](function(_0x52d2b5){var _0x386987=[];_0x52d2b5[_0xfe15('0xfd')](function(_0x40ee70){_0x386987[_0xfe15('0x45')](_0x40ee70['update']({'exitAt':moment()[_0xfe15('0xaf')](_0xfe15('0x102')),'data2':_0xfe15('0x112')}));});return BPromise[_0xfe15('0x4f')](_0x386987);})[_0xfe15('0x29')](function(){return _0x2cea52[_0xfe15('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xfe15('0x29')](respondWithResult(_0x33fa36,null))[_0xfe15('0x5d')](handleError(_0x33fa36,null));};exports[_0xfe15('0x114')]=function(_0x37c55d,_0x9b1ca8){var _0x217a30={};var _0x41d7d5={};var _0x15fa11;var _0x576cc5;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x37c55d['params']['id']}})['then'](handleEntityNotFound(_0x9b1ca8,null))[_0xfe15('0x29')](function(_0x16a216){if(_0x16a216){_0x15fa11=_0x16a216;_0x41d7d5[_0xfe15('0x53')]=_[_0xfe15('0xcc')](db['Team'][_0xfe15('0x3a')]);_0x41d7d5[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x37c55d[_0xfe15('0x3f')]);_0x41d7d5[_0xfe15('0x52')]=_[_0xfe15('0x54')](_0x41d7d5[_0xfe15('0x53')],_0x41d7d5[_0xfe15('0x3f')]);_0x217a30[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0x41d7d5[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x37c55d[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x217a30[_0xfe15('0x44')]=_0x217a30[_0xfe15('0x44')][_0xfe15('0x49')]?_0x217a30[_0xfe15('0x44')]:_0x41d7d5['model'];_0x217a30['order']=qs[_0xfe15('0xce')](_0x37c55d['query'][_0xfe15('0xce')]);_0x217a30[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x37c55d[_0xfe15('0x3f')],_0x41d7d5[_0xfe15('0x52')]));if(_0x37c55d[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x217a30['where']=_[_0xfe15('0x56')](_0x217a30[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0x217a30[_0xfe15('0x44')],function(_0x4291d0){var _0xa153c1={};_0xa153c1[_0x4291d0]={'$like':'%'+_0x37c55d['query'][_0xfe15('0x2f')]+'%'};return _0xa153c1;})});}_0x217a30=_[_0xfe15('0x56')]({},_0x217a30,_0x37c55d[_0xfe15('0x57')]);return _0x15fa11[_0xfe15('0x114')](_0x217a30);}})[_0xfe15('0x29')](function(_0x29a5f7){if(_0x29a5f7){_0x576cc5=_0x29a5f7[_0xfe15('0x49')];if(!_0x37c55d[_0xfe15('0x3f')][_0xfe15('0xcf')]('nolimit')){_0x217a30[_0xfe15('0x25')]=qs[_0xfe15('0x25')](_0x37c55d[_0xfe15('0x3f')][_0xfe15('0x25')]);_0x217a30[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x37c55d[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x15fa11['getTeams'](_0x217a30);}})[_0xfe15('0x29')](function(_0x15948f){if(_0x15948f){return _0x15948f?{'count':_0x576cc5,'rows':_0x15948f}:null;}})[_0xfe15('0x29')](respondWithResult(_0x9b1ca8,null))[_0xfe15('0x5d')](handleError(_0x9b1ca8,null));};exports['addTeams']=function(_0xdffae9,_0x31cfa7){return db['User'][_0xfe15('0x58')]({'where':{'id':_0xdffae9[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x31cfa7,null))[_0xfe15('0x29')](function(_0x1d544e){if(_0x1d544e){var _0x27b266=_0x1d544e[_0xfe15('0x2a')]({'plain':!![]});return _0x1d544e[_0xfe15('0x115')](_0xdffae9[_0xfe15('0x5c')][_0xfe15('0x61')],_[_0xfe15('0x62')](_0xdffae9['body'],[_0xfe15('0x61'),'id'])||{})[_0xfe15('0x29')](function(){for(var _0x2d805b=0x0;_0x2d805b<_0xdffae9[_0xfe15('0x5c')]['ids'][_0xfe15('0x49')];_0x2d805b++){var _0x1e82b3=[];var _0x2813dd={};db[_0xfe15('0x116')][_0xfe15('0x9b')]({'where':{'id':_0xdffae9[_0xfe15('0x5c')][_0xfe15('0x61')][_0x2d805b]}})['then'](function(_0x2e6f36){_0x2813dd=_0x2e6f36[_0xfe15('0x4b')];_0x1e82b3[_0xfe15('0x45')](_0x2e6f36[_0xfe15('0xfa')]()['then'](function(_0x3ee30f){for(var _0x496c9f=0x0;_0x496c9f<_0x3ee30f['length'];_0x496c9f++){_0x3ee30f[_0x496c9f][_0xfe15('0x117')](_0xfe15('0xb3'),_0xfe15('0x118'));}return _0x3ee30f;}));_0x1e82b3['push'](_0x2e6f36[_0xfe15('0x119')]()[_0xfe15('0x29')](function(_0x46ba83){for(var _0x4e6f18=0x0;_0x4e6f18<_0x46ba83[_0xfe15('0x49')];_0x4e6f18++){_0x46ba83[_0x4e6f18]['setDataValue']('channel',_0xfe15('0x11a'));}return _0x46ba83;}));_0x1e82b3['push'](_0x2e6f36['getMailQueues']()[_0xfe15('0x29')](function(_0x4892cc){for(var _0x5f1512=0x0;_0x5f1512<_0x4892cc['length'];_0x5f1512++){_0x4892cc[_0x5f1512]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x11b'));}return _0x4892cc;}));_0x1e82b3[_0xfe15('0x45')](_0x2e6f36[_0xfe15('0x11c')]()[_0xfe15('0x29')](function(_0x365296){for(var _0x4898f1=0x0;_0x4898f1<_0x365296[_0xfe15('0x49')];_0x4898f1++){_0x365296[_0x4898f1]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x11d'));}return _0x365296;}));_0x1e82b3[_0xfe15('0x45')](_0x2e6f36[_0xfe15('0x11e')]()[_0xfe15('0x29')](function(_0x196aee){for(var _0x4929a0=0x0;_0x4929a0<_0x196aee[_0xfe15('0x49')];_0x4929a0++){_0x196aee[_0x4929a0][_0xfe15('0x117')]('channel','Whatsapp');}return _0x196aee;}));_0x1e82b3[_0xfe15('0x45')](_0x2e6f36[_0xfe15('0x11f')]()['then'](function(_0x52daaa){for(var _0x26e50f=0x0;_0x26e50f<_0x52daaa[_0xfe15('0x49')];_0x26e50f++){_0x52daaa[_0x26e50f][_0xfe15('0x117')](_0xfe15('0xb3'),_0xfe15('0x120'));}return _0x52daaa;}));_0x1e82b3[_0xfe15('0x45')](_0x2e6f36['getOpenchannelQueues']()['then'](function(_0x247c08){for(var _0x135131=0x0;_0x135131<_0x247c08['length'];_0x135131++){_0x247c08[_0x135131]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x121'));}return _0x247c08;}));return BPromise[_0xfe15('0x4f')](_0x1e82b3);})[_0xfe15('0x29')](function(_0x4581ec){var _0x42f3e8=_[_0xfe15('0x122')](_0x4581ec);_0x1e82b3=[];return db[_0xfe15('0x69')][_0xfe15('0x123')](function(_0x3773d3){for(var _0xf8932f=0x0;_0xf8932f<_0x42f3e8[_0xfe15('0x49')];_0xf8932f++){_0x1e82b3[_0xfe15('0x45')](_0x42f3e8[_0xf8932f]['addAgent'](_0x27b266['id']),{'transaction':_0x3773d3});}return BPromise[_0xfe15('0x4f')](_0x1e82b3)[_0xfe15('0x29')](function(){if(_0x27b266[_0xfe15('0x124')]){return BPromise['each'](_[_0xfe15('0x2f')](_0x42f3e8,function(_0x469149){return _0x469149[_0xfe15('0x125')](_0xfe15('0xb3'))==='Voice';}),function(_0x54f4e9){return db[_0xfe15('0xb0')]['upsert']({'membername':_0x27b266[_0xfe15('0x33')],'UserId':_0x27b266['id'],'queue_name':_0x54f4e9[_0xfe15('0x33')],'VoiceQueueId':_0x54f4e9['id'],'interface':_['isNil'](_0x27b266[_0xfe15('0xa3')])?util[_0xfe15('0xaf')]('SIP/%s',_0x27b266[_0xfe15('0x33')]):_0x27b266[_0xfe15('0xa3')],'paused':_0x27b266[_0xfe15('0xa2')]||![],'penalty':_0x27b266['penalty']},{'transaction':_0x3773d3});});}else{return;}})[_0xfe15('0x29')](function(){for(var _0x37b089=0x0;_0x37b089<_0x42f3e8['length'];_0x37b089++){var _0xf318e0=_0x42f3e8[_0x37b089][_0xfe15('0x125')](_0xfe15('0xb3'));var _0x5e5d29=_0xf318e0+_0xfe15('0xab');socket[_0xfe15('0xac')](_0xfe15('0x80')+_0xf318e0+_0xfe15('0xad'),{'UserId':_0x27b266['id'],['queueField']:_0x42f3e8[_0x37b089]['id']});}});});})['then'](function(){db[_0xfe15('0x126')][_0xfe15('0x9b')]({'where':{'teamId':_0x2813dd['id']}})[_0xfe15('0x29')](function(_0x3d3797){if(_0x3d3797){db['UserVoicePrefix'][_0xfe15('0x7f')]({'UserId':_0xdffae9[_0xfe15('0x60')]['id'],'VoicePrefixId':_0x3d3797[_0xfe15('0x127')]});}});});}});}})['then'](respondWithStatusCode(_0x31cfa7,null))[_0xfe15('0x5d')](handleError(_0x31cfa7,null));};exports[_0xfe15('0x128')]=function(_0x3ff76f,_0x19e1c3){return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x3ff76f['params']['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x19e1c3,null))[_0xfe15('0x29')](function(_0x3eb32b){if(_0x3eb32b){var _0x236a2b=_0x3eb32b[_0xfe15('0x2a')]({'plain':!![]});var _0xeb7f9a=_0x3ff76f[_0xfe15('0x3f')][_0xfe15('0x61')];return _0x3eb32b['removeTeams'](_0xeb7f9a)[_0xfe15('0x29')](function(){for(var _0x11862e=0x0;_0x11862e<_0xeb7f9a[_0xfe15('0x49')];_0x11862e++){var _0x130fd0=[];var _0x192991={};db[_0xfe15('0x116')][_0xfe15('0x9b')]({'where':{'id':_0xeb7f9a[_0x11862e]}})['then'](function(_0x7acb85){_0x192991=_0x7acb85['dataValues'];_0x130fd0[_0xfe15('0x45')](_0x7acb85['getVoiceQueues']()[_0xfe15('0x29')](function(_0x5a0a79){for(var _0x50739e=0x0;_0x50739e<_0x5a0a79[_0xfe15('0x49')];_0x50739e++){_0x5a0a79[_0x50739e][_0xfe15('0x117')](_0xfe15('0xb3'),_0xfe15('0x118'));}return _0x5a0a79;}));_0x130fd0['push'](_0x7acb85[_0xfe15('0x119')]()[_0xfe15('0x29')](function(_0x4bd445){for(var _0x1ff9fe=0x0;_0x1ff9fe<_0x4bd445['length'];_0x1ff9fe++){_0x4bd445[_0x1ff9fe]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x11a'));}return _0x4bd445;}));_0x130fd0[_0xfe15('0x45')](_0x7acb85[_0xfe15('0x129')]()[_0xfe15('0x29')](function(_0x18eb45){for(var _0x2c9f4e=0x0;_0x2c9f4e<_0x18eb45[_0xfe15('0x49')];_0x2c9f4e++){_0x18eb45[_0x2c9f4e][_0xfe15('0x117')]('channel','Mail');}return _0x18eb45;}));_0x130fd0[_0xfe15('0x45')](_0x7acb85[_0xfe15('0x11c')]()[_0xfe15('0x29')](function(_0x11f76f){for(var _0x403216=0x0;_0x403216<_0x11f76f[_0xfe15('0x49')];_0x403216++){_0x11f76f[_0x403216]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x11d'));}return _0x11f76f;}));_0x130fd0['push'](_0x7acb85[_0xfe15('0x11e')]()[_0xfe15('0x29')](function(_0xf551b){for(var _0x3b135d=0x0;_0x3b135d<_0xf551b[_0xfe15('0x49')];_0x3b135d++){_0xf551b[_0x3b135d][_0xfe15('0x117')](_0xfe15('0xb3'),_0xfe15('0x12a'));}return _0xf551b;}));_0x130fd0[_0xfe15('0x45')](_0x7acb85['getFaxQueues']()[_0xfe15('0x29')](function(_0x1b43cd){for(var _0x21225d=0x0;_0x21225d<_0x1b43cd[_0xfe15('0x49')];_0x21225d++){_0x1b43cd[_0x21225d]['setDataValue'](_0xfe15('0xb3'),_0xfe15('0x120'));}return _0x1b43cd;}));_0x130fd0[_0xfe15('0x45')](_0x7acb85[_0xfe15('0x12b')]()['then'](function(_0x4b49f8){for(var _0x2a4c66=0x0;_0x2a4c66<_0x4b49f8[_0xfe15('0x49')];_0x2a4c66++){_0x4b49f8[_0x2a4c66][_0xfe15('0x117')](_0xfe15('0xb3'),_0xfe15('0x121'));}return _0x4b49f8;}));return BPromise[_0xfe15('0x4f')](_0x130fd0);})[_0xfe15('0x29')](function(_0x3efcff){var _0x475475=_[_0xfe15('0x122')](_0x3efcff);_0x130fd0=[];return db[_0xfe15('0x69')][_0xfe15('0x123')](function(_0xb68e1a){for(var _0x57954c=0x0;_0x57954c<_0x475475[_0xfe15('0x49')];_0x57954c++){_0x130fd0[_0xfe15('0x45')](_0x475475[_0x57954c]['removeAgent'](_0x236a2b['id']),{'transaction':_0xb68e1a});}return BPromise[_0xfe15('0x4f')](_0x130fd0)[_0xfe15('0x29')](function(){if(_0x236a2b[_0xfe15('0x124')]){return BPromise[_0xfe15('0x8c')](_['filter'](_0x475475,function(_0x2b42c7){return _0x2b42c7[_0xfe15('0x125')](_0xfe15('0xb3'))===_0xfe15('0x118');}),function(_0x5cd4a7){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5cd4a7['id'],'UserId':_0x236a2b['id']},'transaction':_0xb68e1a});});}else{return;}})['then'](function(){db[_0xfe15('0x126')][_0xfe15('0x9b')]({'where':{'teamId':_0x192991['id']}})[_0xfe15('0x29')](function(_0x5f4183){if(_0x5f4183){return db[_0xfe15('0x12c')][_0xfe15('0x35')]({'where':{'UserId':_0x236a2b['id'],'VoicePrefixId':_0x5f4183[_0xfe15('0x4b')][_0xfe15('0x127')]}});}});})[_0xfe15('0x29')](function(){for(var _0x824293=0x0;_0x824293<_0x475475['length'];_0x824293++){var _0xf81e37=_0x475475[_0x824293]['getDataValue'](_0xfe15('0xb3'));var _0x1b465f=_0xf81e37+_0xfe15('0xab');socket[_0xfe15('0xac')](_0xfe15('0x80')+_0xf81e37+'Queue:remove',{'UserId':_0x236a2b['id'],['queueField']:_0x475475[_0x824293]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x19e1c3,null))[_0xfe15('0x5d')](handleError(_0x19e1c3,null));};exports[_0xfe15('0x12d')]=function(_0x47072d,_0x2eef12){var _0x1e1031={};var _0xd55ec={};var _0x404a6d;var _0x30b9f9;return db[_0xfe15('0x39')][_0xfe15('0x9b')]({'where':{'id':_0x47072d[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x2eef12,null))[_0xfe15('0x29')](function(_0x2d6a13){if(_0x2d6a13){_0x404a6d=_0x2d6a13;_0xd55ec[_0xfe15('0x53')]=_['keys'](db['CmList'][_0xfe15('0x3a')]);_0xd55ec[_0xfe15('0x3f')]=_['keys'](_0x47072d['query']);_0xd55ec['filters']=_[_0xfe15('0x54')](_0xd55ec[_0xfe15('0x53')],_0xd55ec[_0xfe15('0x3f')]);_0x1e1031[_0xfe15('0x44')]=_[_0xfe15('0x54')](_0xd55ec[_0xfe15('0x53')],qs[_0xfe15('0x55')](_0x47072d[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x1e1031[_0xfe15('0x44')]=_0x1e1031[_0xfe15('0x44')][_0xfe15('0x49')]?_0x1e1031[_0xfe15('0x44')]:_0xd55ec['model'];_0x1e1031[_0xfe15('0xcd')]=qs[_0xfe15('0xce')](_0x47072d['query'][_0xfe15('0xce')]);_0x1e1031['where']=qs['filters'](_[_0xfe15('0xd7')](_0x47072d['query'],_0xd55ec[_0xfe15('0x52')]));if(_0x47072d[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x1e1031[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x1e1031[_0xfe15('0x3e')],{'$or':_[_0xfe15('0x31')](_0x1e1031[_0xfe15('0x44')],function(_0x589bc0){var _0x4763a7={};_0x4763a7[_0x589bc0]={'$like':'%'+_0x47072d[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x4763a7;})});}_0x1e1031=_['merge']({},_0x1e1031,_0x47072d[_0xfe15('0x57')]);return _0x404a6d[_0xfe15('0x12d')](_0x1e1031);}})['then'](function(_0x2a7a97){if(_0x2a7a97){_0x30b9f9=_0x2a7a97['length'];if(!_0x47072d[_0xfe15('0x3f')][_0xfe15('0xcf')](_0xfe15('0xd4'))){_0x1e1031[_0xfe15('0x25')]=qs['limit'](_0x47072d[_0xfe15('0x3f')]['limit']);_0x1e1031[_0xfe15('0x23')]=qs[_0xfe15('0x23')](_0x47072d[_0xfe15('0x3f')][_0xfe15('0x23')]);}return _0x404a6d[_0xfe15('0x12d')](_0x1e1031);}})[_0xfe15('0x29')](function(_0x4d1057){if(_0x4d1057){return _0x4d1057?{'count':_0x30b9f9,'rows':_0x4d1057}:null;}})[_0xfe15('0x29')](respondWithResult(_0x2eef12,null))['catch'](handleError(_0x2eef12,null));};exports['getAgents']=function(_0x4b8492,_0x24e454){var _0x46306e={};var _0x54df91={};var _0x288eec;return db[_0xfe15('0x39')]['findOne']({'where':{'id':_0x4b8492[_0xfe15('0x60')]['id']}})[_0xfe15('0x29')](handleEntityNotFound(_0x24e454,null))['then'](function(_0x182d43){if(_0x182d43){_0x288eec=_0x182d43;_0x54df91[_0xfe15('0x53')]=_['keys'](db[_0xfe15('0x39')][_0xfe15('0x3a')]);_0x54df91[_0xfe15('0x3f')]=_[_0xfe15('0xcc')](_0x4b8492[_0xfe15('0x3f')]);_0x54df91['filters']=_[_0xfe15('0x54')](_0x54df91[_0xfe15('0x53')],_0x54df91[_0xfe15('0x3f')]);_0x46306e['attributes']=_['intersection'](_0x54df91['model'],qs[_0xfe15('0x55')](_0x4b8492[_0xfe15('0x3f')][_0xfe15('0x55')]));_0x46306e[_0xfe15('0x44')]=_0x46306e[_0xfe15('0x44')]['length']?_0x46306e['attributes']:_0x54df91['model'];_0x46306e['order']=qs[_0xfe15('0xce')](_0x4b8492[_0xfe15('0x3f')][_0xfe15('0xce')]);_0x46306e[_0xfe15('0x3e')]=qs[_0xfe15('0x52')](_[_0xfe15('0xd7')](_0x4b8492[_0xfe15('0x3f')],_0x54df91[_0xfe15('0x52')]));if(_0x4b8492[_0xfe15('0x3f')][_0xfe15('0x2f')]){_0x46306e[_0xfe15('0x3e')]=_[_0xfe15('0x56')](_0x46306e[_0xfe15('0x3e')],{'$or':_['map'](_0x46306e[_0xfe15('0x44')],function(_0x49e48c){var _0x42b74f={};_0x42b74f[_0x49e48c]={'$like':'%'+_0x4b8492[_0xfe15('0x3f')][_0xfe15('0x2f')]+'%'};return _0x42b74f;})});}_0x46306e[_0xfe15('0x53')]=db[_0xfe15('0x39')];_0x46306e['as']='Agents';_0x46306e=_[_0xfe15('0x56')]({},_0x46306e,_0x4b8492['options']);return _0x288eec['getVoiceQueues']({'include':[_0x46306e]});}})[_0xfe15('0x29')](function(_0x4f0e32){if(_0x4f0e32){var _0x548b9b={},_0xbc9ac2=[];for(var _0x9df995=0x0;_0x9df995<_0x4f0e32['length'];_0x9df995+=0x1){for(var _0xc7fa49=0x0,_0x24abea;_0xc7fa49<_0x4f0e32[_0x9df995]['Agents'][_0xfe15('0x49')];_0xc7fa49+=0x1){_0x24abea=_0x4f0e32[_0x9df995][_0xfe15('0x2d')][_0xc7fa49]['get']({'plain':!![]});_0x548b9b[_0x24abea['id']]=_0x24abea;}}_0x548b9b=_[_0xfe15('0x12e')](_0x548b9b);for(var _0x20345c=qs[_0xfe15('0x23')](_0x4b8492[_0xfe15('0x3f')]['offset']);_0x20345c<_0x548b9b[_0xfe15('0x49')]&&_0xbc9ac2[_0xfe15('0x49')]=_0x144b1d[_0x212b('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x212b('0xf')](function(){if(_0x386f42){return db[_0x212b('0x29')][_0x212b('0x4a')]({'where':{'membername':_0x386f42[_0x212b('0x2c')]},'individualHooks':!![]});}})[_0x212b('0xf')](function(){if(_0x386f42){return _0x386f42['getVoiceQueues']({'raw':!![]});}})[_0x212b('0xf')](function(_0x2a0336){if(_0x386f42){if(_0x2a0336){var _0x4b650d=[];_0x4a6315=_0x2a0336;if(_0x4a6315[_0x212b('0x2e')]){for(var _0x2701ac=0x0;_0x2701ac<_0x4a6315[_0x212b('0x2e')];_0x2701ac++){_0x4b650d['push'](db['UserVoiceQueueRt'][_0x212b('0x52')]({'membername':_0x386f42[_0x212b('0x2c')],'UserId':_0x386f42['id'],'queue_name':_0x4a6315[_0x2701ac][_0x212b('0x2c')],'VoiceQueueId':_0x4a6315[_0x2701ac]['id'],'interface':_0x3e8c7b,'paused':_0x386f42['loginInPause']||![],'penalty':_0x4a6315[_0x2701ac][_0x212b('0x53')]||0x0}));}return BPromise['all'](_0x4b650d);}}}})[_0x212b('0xf')](function(){if(_0x386f42){return db['MemberReport'][_0x212b('0x2b')]({'where':{'membername':_0x386f42[_0x212b('0x2c')],'exitAt':null}});}})['then'](function(_0x585da1){if(_0x386f42){if(_0x585da1&&_0x585da1[_0x212b('0x2e')]){var _0x1c309c=[];_0x585da1[_0x212b('0x31')](function(_0x2e73ba){_0x1c309c['push'](_0x2e73ba['update']({'exitAt':moment()[_0x212b('0x2f')](_0x212b('0x34'))}));});return BPromise['all'](_0x1c309c);}}})[_0x212b('0xf')](function(_0x2ff047){if(_0x386f42){var _0x48b40e=[];var _0x19753d=[];var _0x2df51e=utils['getChannels']();var _0x3e72a7={'membername':_0x386f42[_0x212b('0x2c')],'interface':_0x3e8c7b,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x386f42[_0x212b('0x28')],'internal':_0x386f42[_0x212b('0x37')]};_0x2df51e['forEach'](function(_0x5a0ed9){_0x48b40e[_0x212b('0x4b')](_['merge']({'channel':_0x5a0ed9,'type':'LOGIN','data1':_0x212b('0x54'),'data2':_0x3e8c7b},_0x3e72a7));if(_0x386f42[_0x212b('0x4e')]){_0x19753d['push'](_[_0x212b('0x55')]({'channel':_0x5a0ed9,'type':_0x212b('0x2d'),'data1':_0x212b('0x56')},_0x3e72a7));}});return db[_0x212b('0x39')][_0x212b('0x57')](_0x48b40e[_0x212b('0x58')](_0x19753d),{'individualHooks':!![]});}})[_0x212b('0xf')](function(){if(_0x386f42){return _0x386f42[_0x212b('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x212b('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x386f42[_0x212b('0x4e')]||![],'mailPause':_0x386f42[_0x212b('0x4e')]||![],'chatPause':_0x386f42[_0x212b('0x4e')]||![],'faxPause':_0x386f42[_0x212b('0x4e')]||![],'smsPause':_0x386f42['loginInPause']||![],'openchannelPause':_0x386f42[_0x212b('0x4e')]||![],'pauseType':_0x386f42[_0x212b('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x212b('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3e8c7b});}})[_0x212b('0xf')](function(_0x1a74a0){_0x1cf210(_0x1a74a0);})['catch'](function(_0x229a30){_0x4066b2(_0x2276d9[_0x212b('0x15')](0x1f4,_0x229a30[_0x212b('0x17')]));});});}; \ No newline at end of file +var _0x8a3d=['../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./user.socket','register','request','then','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowUser','find','name','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','type','DEFAULT\x20PAUSE','role','internal','body','uniqueid','UnpauseUser','findOne','channel','isValidChannel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','destroy','push','LoginUser','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','LOGIN','LOGININPAUSE','bulkCreate','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xe4e6c6,_0x45a683){var _0x175b25=function(_0xad7c4e){while(--_0xad7c4e){_0xe4e6c6['push'](_0xe4e6c6['shift']());}};_0x175b25(++_0x45a683);}(_0x8a3d,0x16e));var _0xd8a3=function(_0x4b0ea6,_0x4192d3){_0x4b0ea6=_0x4b0ea6-0x0;var _0xcc3c29=_0x8a3d[_0x4b0ea6];return _0xcc3c29;};'use strict';var _=require(_0xd8a3('0x0'));var util=require(_0xd8a3('0x1'));var moment=require(_0xd8a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8a3('0x3'));var fs=require('fs');var Redis=require(_0xd8a3('0x4'));var db=require(_0xd8a3('0x5'))['db'];var utils=require(_0xd8a3('0x6'));var logger=require('../../config/logger')(_0xd8a3('0x7'));var config=require(_0xd8a3('0x8'));var jayson=require(_0xd8a3('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd8a3('0xa')](config[_0xd8a3('0xb')],{'host':_0xd8a3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8a3('0xb')]));require(_0xd8a3('0xd'))[_0xd8a3('0xe')](socket);function respondWithRpcPromise(_0x3a5f33,_0x4a7553,_0x8bdd49){return new BPromise(function(_0x404dc6,_0x55c031){return client[_0xd8a3('0xf')](_0x3a5f33,_0x8bdd49)[_0xd8a3('0x10')](function(_0x5ad6fa){logger['info'](_0xd8a3('0x11'),_0x4a7553,_0xd8a3('0x12'));logger[_0xd8a3('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x4a7553,'request\x20sent',JSON['stringify'](_0x5ad6fa));if(_0x5ad6fa[_0xd8a3('0x14')]){if(_0x5ad6fa[_0xd8a3('0x14')][_0xd8a3('0x15')]===0x1f4){logger[_0xd8a3('0x14')](_0xd8a3('0x11'),_0x4a7553,_0x5ad6fa['error'][_0xd8a3('0x16')]);return _0x55c031(_0x5ad6fa[_0xd8a3('0x14')][_0xd8a3('0x16')]);}logger['error'](_0xd8a3('0x11'),_0x4a7553,_0x5ad6fa['error']['message']);return _0x404dc6(_0x5ad6fa['error'][_0xd8a3('0x16')]);}else{logger[_0xd8a3('0x17')](_0xd8a3('0x11'),_0x4a7553,_0xd8a3('0x12'));_0x404dc6(_0x5ad6fa[_0xd8a3('0x18')]['message']);}})[_0xd8a3('0x19')](function(_0x1cb7ca){logger[_0xd8a3('0x14')](_0xd8a3('0x11'),_0x4a7553,_0x1cb7ca);_0x55c031(_0x1cb7ca);});});}exports[_0xd8a3('0x1a')]=function(_0x3a1149){var _0x436119=this;return new Promise(function(_0x1075d0,_0x1f4310){return db[_0xd8a3('0x1b')][_0xd8a3('0x1c')]({'raw':_0x3a1149[_0xd8a3('0x1d')]?_0x3a1149['options'][_0xd8a3('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a1149[_0xd8a3('0x1d')]?_0x3a1149['options'][_0xd8a3('0x1f')]||null:null,'attributes':_0x3a1149[_0xd8a3('0x1d')]?_0x3a1149[_0xd8a3('0x1d')][_0xd8a3('0x20')]||null:null,'limit':_0x3a1149[_0xd8a3('0x1d')]?_0x3a1149[_0xd8a3('0x1d')][_0xd8a3('0x21')]||null:null,'include':_0x3a1149[_0xd8a3('0x1d')]?_0x3a1149[_0xd8a3('0x1d')][_0xd8a3('0x22')]?_['map'](_0x3a1149[_0xd8a3('0x1d')][_0xd8a3('0x22')],function(_0x45957d){return{'model':db[_0x45957d[_0xd8a3('0x23')]],'as':_0x45957d['as'],'attributes':_0x45957d[_0xd8a3('0x20')],'include':_0x45957d[_0xd8a3('0x22')]?_[_0xd8a3('0x24')](_0x45957d[_0xd8a3('0x22')],function(_0xb172d8){return{'model':db[_0xb172d8[_0xd8a3('0x23')]],'as':_0xb172d8['as'],'attributes':_0xb172d8[_0xd8a3('0x20')],'include':_0xb172d8[_0xd8a3('0x22')]?_[_0xd8a3('0x24')](_0xb172d8[_0xd8a3('0x22')],function(_0x15427d){return{'model':db[_0x15427d[_0xd8a3('0x23')]],'as':_0x15427d['as'],'attributes':_0x15427d[_0xd8a3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cfe46){logger[_0xd8a3('0x17')](_0xd8a3('0x1a'),_0x3a1149);logger[_0xd8a3('0x13')](_0xd8a3('0x1a'),_0x3a1149,JSON[_0xd8a3('0x25')](_0x5cfe46));_0x1075d0(_0x5cfe46);})[_0xd8a3('0x19')](function(_0x1e7d30){logger[_0xd8a3('0x14')](_0xd8a3('0x1a'),_0x1e7d30['message'],_0x3a1149);_0x1f4310(_0x436119[_0xd8a3('0x14')](0x1f4,_0x1e7d30[_0xd8a3('0x16')]));});});};exports[_0xd8a3('0x26')]=function(_0x58c922){var _0x2902e5=this;return new Promise(function(_0x3fbd26,_0x59cfbf){return db['User'][_0xd8a3('0x27')]({'raw':_0x58c922[_0xd8a3('0x1d')]?_0x58c922[_0xd8a3('0x1d')][_0xd8a3('0x1e')]===undefined?!![]:![]:!![],'where':_0x58c922[_0xd8a3('0x1d')]?_0x58c922['options'][_0xd8a3('0x1f')]||null:null,'attributes':_0x58c922[_0xd8a3('0x1d')]?_0x58c922['options'][_0xd8a3('0x20')]||null:null,'include':_0x58c922[_0xd8a3('0x1d')]?_0x58c922[_0xd8a3('0x1d')][_0xd8a3('0x22')]?_[_0xd8a3('0x24')](_0x58c922[_0xd8a3('0x1d')][_0xd8a3('0x22')],function(_0x43ccd4){return{'model':db[_0x43ccd4[_0xd8a3('0x23')]],'as':_0x43ccd4['as'],'attributes':_0x43ccd4['attributes'],'include':_0x43ccd4['include']?_[_0xd8a3('0x24')](_0x43ccd4[_0xd8a3('0x22')],function(_0x38451a){return{'model':db[_0x38451a[_0xd8a3('0x23')]],'as':_0x38451a['as'],'attributes':_0x38451a['attributes'],'include':_0x38451a[_0xd8a3('0x22')]?_[_0xd8a3('0x24')](_0x38451a[_0xd8a3('0x22')],function(_0x56a9fc){return{'model':db[_0x56a9fc[_0xd8a3('0x23')]],'as':_0x56a9fc['as'],'attributes':_0x56a9fc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x355d28){logger[_0xd8a3('0x17')](_0xd8a3('0x26'),_0x58c922);logger['debug'](_0xd8a3('0x26'),_0x58c922,JSON[_0xd8a3('0x25')](_0x355d28));_0x3fbd26(_0x355d28);})['catch'](function(_0x1403ef){logger[_0xd8a3('0x14')]('ShowUser',_0x1403ef[_0xd8a3('0x16')],_0x58c922);_0x59cfbf(_0x2902e5[_0xd8a3('0x14')](0x1f4,_0x1403ef[_0xd8a3('0x16')]));});});};exports['PauseUser']=function(_0x38cc53){var _0x4f4b7e=this;return new Promise(function(_0x164e0f,_0x27a448){var _0x34b2e6;return db[_0xd8a3('0x1b')][_0xd8a3('0x27')]({'where':_0x38cc53['options']['where']||{},'attributes':['id',_0xd8a3('0x28'),'role','internal',_0xd8a3('0x29')]})['then'](function(_0x41d71c){if(_0x41d71c){_0x34b2e6=_0x41d71c;return db[_0xd8a3('0x2a')][_0xd8a3('0x2b')]({'paused':0x1},{'where':{'UserId':_0x34b2e6['id']},'individualHooks':!![]});}})[_0xd8a3('0x10')](function(){if(_0x34b2e6){return db[_0xd8a3('0x2c')][_0xd8a3('0x1c')]({'where':{'membername':_0x34b2e6[_0xd8a3('0x28')],'type':_0xd8a3('0x2d'),'exitAt':null}});}})['then'](function(_0x1edf8a){if(_0x34b2e6){if(_0x1edf8a&&_0x1edf8a[_0xd8a3('0x2e')]){var _0x40cffa=moment()[_0xd8a3('0x2f')](_0xd8a3('0x30'));for(var _0x1eaa0b=0x0,_0x1eaa72=_0x1edf8a[_0xd8a3('0x2e')];_0x1eaa0b<_0x1eaa72;_0x1eaa0b++){_0x1edf8a[_0x1eaa0b][_0xd8a3('0x31')]({'exitAt':_0x40cffa});}}}})[_0xd8a3('0x10')](function(){if(_0x34b2e6){var _0x127065=[];var _0x5cfd03=utils[_0xd8a3('0x32')]();_0x5cfd03[_0xd8a3('0x33')](function(_0x97e409){_0x127065['push']({'channel':_0x97e409,'membername':_0x34b2e6[_0xd8a3('0x28')],'interface':_[_0xd8a3('0x34')](_0x34b2e6[_0xd8a3('0x29')])?util[_0xd8a3('0x2f')](_0xd8a3('0x35'),_0x34b2e6[_0xd8a3('0x28')]):_0x34b2e6[_0xd8a3('0x29')],'type':'PAUSE','enterAt':moment()[_0xd8a3('0x2f')](_0xd8a3('0x30')),'data1':_0x38cc53['body'][_0xd8a3('0x36')]||_0xd8a3('0x37'),'role':_0x34b2e6[_0xd8a3('0x38')],'internal':_0x34b2e6[_0xd8a3('0x39')],'uniqueid':_0x38cc53[_0xd8a3('0x3a')][_0xd8a3('0x3b')]||null});});return db[_0xd8a3('0x2c')]['bulkCreate'](_0x127065,{'individualHooks':!![]});}})[_0xd8a3('0x10')](function(){if(_0x34b2e6){return _0x34b2e6[_0xd8a3('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38cc53['body'][_0xd8a3('0x36')]||_0xd8a3('0x37'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd8a3('0x10')](function(_0x4bef3b){_0x164e0f(_0x4bef3b);})['catch'](function(_0x492465){_0x27a448(_0x4f4b7e['error'](0x1f4,_0x492465[_0xd8a3('0x16')]));});});};exports[_0xd8a3('0x3c')]=function(_0x464054){var _0x36272e=this;return new Promise(function(_0xce18d1,_0x25ada2){var _0x515bde;return db[_0xd8a3('0x1b')][_0xd8a3('0x3d')]({'where':_0x464054[_0xd8a3('0x1d')][_0xd8a3('0x1f')]||{},'attributes':['id',_0xd8a3('0x28')]})[_0xd8a3('0x10')](function(_0x1d87ed){if(_0x1d87ed){_0x515bde=_0x1d87ed;if(_0x464054[_0xd8a3('0x3a')][_0xd8a3('0x3e')]&&!utils[_0xd8a3('0x3f')](_0x464054[_0xd8a3('0x3a')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x464054[_0xd8a3('0x3a')]['channel']){case _0xd8a3('0x40'):return db[_0xd8a3('0x2a')]['update']({'paused':0x0},{'where':{'UserId':_0x515bde['id']}})[_0xd8a3('0x10')](function(){return db[_0xd8a3('0x2c')]['find']({'where':{'channel':_0x464054[_0xd8a3('0x3a')]['channel'],'membername':_0x515bde[_0xd8a3('0x28')],'type':_0xd8a3('0x2d'),'exitAt':null}});})[_0xd8a3('0x10')](function(_0x5edee3){if(_0x5edee3){return _0x5edee3[_0xd8a3('0x2b')]({'exitAt':moment()[_0xd8a3('0x2f')](_0xd8a3('0x30')),'data2':_0xd8a3('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x515bde['update']({'voicePause':![]});});case _0xd8a3('0x42'):case _0xd8a3('0x43'):case _0xd8a3('0x44'):case _0xd8a3('0x45'):case _0xd8a3('0x46'):case _0xd8a3('0x47'):return db['MemberReport']['find']({'where':{'channel':_0x464054[_0xd8a3('0x3a')][_0xd8a3('0x3e')],'membername':_0x515bde[_0xd8a3('0x28')],'type':_0xd8a3('0x2d'),'exitAt':null}})[_0xd8a3('0x10')](function(_0x1c105d){return _0x1c105d[_0xd8a3('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd8a3('0x41')},{'individualHooks':!![]});})[_0xd8a3('0x10')](function(){var _0x34c0cf={};_[_0xd8a3('0x48')](_0x34c0cf,util[_0xd8a3('0x2f')](_0xd8a3('0x49'),_0x464054['body'][_0xd8a3('0x3e')],_0xd8a3('0x4a')),![]);return _0x515bde['update'](_0x34c0cf);});default:return db[_0xd8a3('0x2a')][_0xd8a3('0x2b')]({'paused':0x0},{'where':{'UserId':_0x515bde['id']}})[_0xd8a3('0x10')](function(){return db['MemberReport'][_0xd8a3('0x1c')]({'where':{'membername':_0x515bde['name'],'type':_0xd8a3('0x2d'),'exitAt':null}});})['then'](function(_0x1da452){var _0x1fafed=[];_0x1da452[_0xd8a3('0x33')](function(_0x452b14){_0x1fafed['push'](_0x452b14[_0xd8a3('0x2b')]({'exitAt':moment()[_0xd8a3('0x2f')](_0xd8a3('0x30')),'data2':_0xd8a3('0x41')}));});return BPromise[_0xd8a3('0x4b')](_0x1fafed);})['then'](function(){return _0x515bde[_0xd8a3('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd8a3('0x10')](function(_0x29a411){_0xce18d1(_0x29a411);})[_0xd8a3('0x19')](function(_0x28a7a7){_0x25ada2(_0x36272e[_0xd8a3('0x14')](0x1f4,_0x28a7a7[_0xd8a3('0x16')]));});});};exports[_0xd8a3('0x4c')]=function(_0x3241f6){var _0x12c552=this;return new Promise(function(_0x145e99,_0x378ffc){var _0x2c0e51;return db[_0xd8a3('0x1b')][_0xd8a3('0x3d')]({'where':_0x3241f6[_0xd8a3('0x1d')][_0xd8a3('0x1f')]||{},'attributes':['id',_0xd8a3('0x28')]})[_0xd8a3('0x10')](function(_0x4fc9a4){if(_0x4fc9a4){_0x2c0e51=_0x4fc9a4;return db[_0xd8a3('0x2a')][_0xd8a3('0x4d')]({'where':{'membername':_0x2c0e51[_0xd8a3('0x28')]},'individualHooks':!![]});}})[_0xd8a3('0x10')](function(){if(_0x2c0e51){return db[_0xd8a3('0x2c')][_0xd8a3('0x1c')]({'where':{'membername':_0x2c0e51[_0xd8a3('0x28')],'exitAt':null}});}})[_0xd8a3('0x10')](function(_0x14f382){if(_0x2c0e51){if(_0x14f382&&_0x14f382[_0xd8a3('0x2e')]){var _0x45e292=[];_0x14f382[_0xd8a3('0x33')](function(_0x527438){_0x45e292[_0xd8a3('0x4e')](_0x527438[_0xd8a3('0x2b')]({'exitAt':moment()[_0xd8a3('0x2f')](_0xd8a3('0x30'))}));});return BPromise['all'](_0x45e292);}}})[_0xd8a3('0x10')](function(){if(_0x2c0e51){return _0x2c0e51[_0xd8a3('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd8a3('0x10')](function(_0xedee3c){_0x145e99(_0xedee3c);})['catch'](function(_0x8bb05b){_0x378ffc(_0x12c552['error'](0x1f4,_0x8bb05b[_0xd8a3('0x16')]));});});};exports[_0xd8a3('0x4f')]=function(_0x31e240){var _0x542a6a=this;return new Promise(function(_0x1a938f,_0x439d4a){var _0x45c95b;var _0x52d47f;var _0x303251;var _0x4e28c7;return db['User'][_0xd8a3('0x3d')]({'where':_0x31e240[_0xd8a3('0x1d')][_0xd8a3('0x1f')]||{},'attributes':['id',_0xd8a3('0x28'),'role',_0xd8a3('0x50'),'phone','internal',_0xd8a3('0x51'),'interface']})['then'](function(_0x5c124e){if(_0x5c124e){_0x45c95b=_0x5c124e;_0x4e28c7=_0x31e240['body'][_0xd8a3('0x29')]?_0x31e240[_0xd8a3('0x3a')][_0xd8a3('0x29')]:util[_0xd8a3('0x2f')](_0xd8a3('0x35'),_0x45c95b[_0xd8a3('0x28')]);return db['User'][_0xd8a3('0x52')]({'where':{'role':_0xd8a3('0x53'),'online':!![],'id':{'$ne':_0x45c95b['id']}}});}})[_0xd8a3('0x10')](function(_0x4228de){if(_0x4228de){_0x303251=_0x4228de;return require('../../config/license/util')[_0xd8a3('0x54')]();}})[_0xd8a3('0x10')](function(_0x2d0365){if(_0x2d0365&&_0x2d0365['agents']&&_0x303251>=_0x2d0365[_0xd8a3('0x55')]){throw new Error(_0xd8a3('0x56'));}})[_0xd8a3('0x10')](function(){if(_0x45c95b){return db[_0xd8a3('0x2a')][_0xd8a3('0x4d')]({'where':{'membername':_0x45c95b[_0xd8a3('0x28')]},'individualHooks':!![]});}})[_0xd8a3('0x10')](function(){if(_0x45c95b){return _0x45c95b[_0xd8a3('0x57')]({'raw':!![]});}})[_0xd8a3('0x10')](function(_0x341c65){if(_0x45c95b){if(_0x341c65){var _0x267087=[];_0x52d47f=_0x341c65;if(_0x52d47f[_0xd8a3('0x2e')]){for(var _0x111701=0x0;_0x111701<_0x52d47f[_0xd8a3('0x2e')];_0x111701++){_0x267087[_0xd8a3('0x4e')](db[_0xd8a3('0x2a')][_0xd8a3('0x58')]({'membername':_0x45c95b['name'],'UserId':_0x45c95b['id'],'queue_name':_0x52d47f[_0x111701][_0xd8a3('0x28')],'VoiceQueueId':_0x52d47f[_0x111701]['id'],'interface':_0x4e28c7,'paused':_0x45c95b[_0xd8a3('0x51')]||![],'penalty':_0x52d47f[_0x111701]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd8a3('0x4b')](_0x267087);}}}})[_0xd8a3('0x10')](function(){if(_0x45c95b){return db[_0xd8a3('0x2c')][_0xd8a3('0x1c')]({'where':{'membername':_0x45c95b[_0xd8a3('0x28')],'exitAt':null}});}})[_0xd8a3('0x10')](function(_0x38ed6a){if(_0x45c95b){if(_0x38ed6a&&_0x38ed6a[_0xd8a3('0x2e')]){var _0x4460f0=[];_0x38ed6a[_0xd8a3('0x33')](function(_0x5a467c){_0x4460f0['push'](_0x5a467c[_0xd8a3('0x2b')]({'exitAt':moment()[_0xd8a3('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd8a3('0x4b')](_0x4460f0);}}})[_0xd8a3('0x10')](function(_0x3b56ed){if(_0x45c95b){var _0x5abada=[];var _0x257776=[];var _0x55cc6f=utils[_0xd8a3('0x32')]();var _0x3c9d5f={'membername':_0x45c95b[_0xd8a3('0x28')],'interface':_0x4e28c7,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x45c95b[_0xd8a3('0x38')],'internal':_0x45c95b['internal']};_0x55cc6f['forEach'](function(_0x434276){_0x5abada[_0xd8a3('0x4e')](_[_0xd8a3('0x59')]({'channel':_0x434276,'type':_0xd8a3('0x5a'),'data1':'callysquare','data2':_0x4e28c7},_0x3c9d5f));if(_0x45c95b[_0xd8a3('0x51')]){_0x257776[_0xd8a3('0x4e')](_[_0xd8a3('0x59')]({'channel':_0x434276,'type':'PAUSE','data1':_0xd8a3('0x5b')},_0x3c9d5f));}});return db[_0xd8a3('0x2c')][_0xd8a3('0x5c')](_0x5abada['concat'](_0x257776),{'individualHooks':!![]});}})[_0xd8a3('0x10')](function(){if(_0x45c95b){return _0x45c95b[_0xd8a3('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xd8a3('0x2f')](_0xd8a3('0x30')),'voicePause':_0x45c95b['loginInPause']||![],'mailPause':_0x45c95b['loginInPause']||![],'chatPause':_0x45c95b[_0xd8a3('0x51')]||![],'faxPause':_0x45c95b[_0xd8a3('0x51')]||![],'smsPause':_0x45c95b[_0xd8a3('0x51')]||![],'openchannelPause':_0x45c95b[_0xd8a3('0x51')]||![],'pauseType':_0x45c95b['loginInPause']?_0xd8a3('0x5b'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4e28c7});}})['then'](function(_0x4af81a){_0x1a938f(_0x4af81a);})['catch'](function(_0x4597e8){_0x439d4a(_0x542a6a['error'](0x1f4,_0x4597e8['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 43bb1c2..ee19f87 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 _0xe934=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x79cc24,_0x2b13cf){var _0x11fdaf=function(_0x457544){while(--_0x457544){_0x79cc24['push'](_0x79cc24['shift']());}};_0x11fdaf(++_0x2b13cf);}(_0xe934,0x152));var _0x4e93=function(_0x4413a1,_0x55a868){_0x4413a1=_0x4413a1-0x0;var _0x184cf3=_0xe934[_0x4413a1];return _0x184cf3;};'use strict';var UserEvents=require(_0x4e93('0x0'));var events=[_0x4e93('0x1'),_0x4e93('0x2'),_0x4e93('0x3')];function createListener(_0x5f126c,_0x1e818a){return function(_0x2bfa0d){_0x1e818a[_0x4e93('0x4')](_0x5f126c,_0x2bfa0d);};}function removeListener(_0x3fbc86,_0xe9290c){return function(){UserEvents[_0x4e93('0x5')](_0x3fbc86,_0xe9290c);};}exports[_0x4e93('0x6')]=function(_0x51969f){for(var _0x5b557a=0x0,_0x7ce930=events[_0x4e93('0x7')];_0x5b557a<_0x7ce930;_0x5b557a++){var _0x2a4ea6=events[_0x5b557a];var _0xfe7055=createListener(_0x4e93('0x8')+_0x2a4ea6,_0x51969f);UserEvents['on'](_0x2a4ea6,_0xfe7055);}}; \ No newline at end of file +var _0x01e7=['update','emit','removeListener','register','length','user:','./user.events','remove'];(function(_0x3dd871,_0x46b68a){var _0x3bca1c=function(_0x1610be){while(--_0x1610be){_0x3dd871['push'](_0x3dd871['shift']());}};_0x3bca1c(++_0x46b68a);}(_0x01e7,0x156));var _0x701e=function(_0x481dc1,_0x41a785){_0x481dc1=_0x481dc1-0x0;var _0x277c77=_0x01e7[_0x481dc1];return _0x277c77;};'use strict';var UserEvents=require(_0x701e('0x0'));var events=['save',_0x701e('0x1'),_0x701e('0x2')];function createListener(_0x16626e,_0x76729f){return function(_0x357d8e){_0x76729f[_0x701e('0x3')](_0x16626e,_0x357d8e);};}function removeListener(_0x28abf9,_0x1f4e98){return function(){UserEvents[_0x701e('0x4')](_0x28abf9,_0x1f4e98);};}exports[_0x701e('0x5')]=function(_0x16a22e){for(var _0x405111=0x0,_0x26d00a=events[_0x701e('0x6')];_0x405111<_0x26d00a;_0x405111++){var _0x36c657=events[_0x405111];var _0x242391=createListener(_0x701e('0x7')+_0x36c657,_0x16a22e);UserEvents['on'](_0x36c657,_0x242391);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fbbb2e4..ea29713 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(_0x1f43f3,_0x4c556c){var _0x1f5fdb=function(_0x3505c9){while(--_0x3505c9){_0x1f43f3['push'](_0x1f43f3['shift']());}};_0x1f5fdb(++_0x4c556c);}(_0x70e0,0x17b));var _0x070e=function(_0x31afad,_0x1b3521){_0x31afad=_0x31afad-0x0;var _0x1bce29=_0x70e0[_0x31afad];return _0x1bce29;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xbed03d,_0x977d21){var _0x3362fe=function(_0x25532a){while(--_0x25532a){_0xbed03d['push'](_0xbed03d['shift']());}};_0x3362fe(++_0x977d21);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xcb91[_0x562f3b];return _0x1edd55;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4af8c75..230e4be 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 _0x0ee3=['sequelize','exports','INTEGER'];(function(_0x382669,_0x59e1e8){var _0x2a3ddd=function(_0x413a03){while(--_0x413a03){_0x382669['push'](_0x382669['shift']());}};_0x2a3ddd(++_0x59e1e8);}(_0x0ee3,0xd5));var _0x30ee=function(_0x3778b9,_0x9726ce){_0x3778b9=_0x3778b9-0x0;var _0x5c0def=_0x0ee3[_0x3778b9];return _0x5c0def;};'use strict';var Sequelize=require(_0x30ee('0x0'));module[_0x30ee('0x1')]={'penalty':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6007=['exports','INTEGER','sequelize'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6007,0x8f));var _0x7600=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x6007[_0x34bd34];return _0x4e36d6;};'use strict';var Sequelize=require(_0x7600('0x0'));module[_0x7600('0x1')]={'penalty':{'type':Sequelize[_0x7600('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2584f85..e9ce89f 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 _0x5d0f=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b58f8,_0x14f865){var _0x2af05b=function(_0x2c2bf3){while(--_0x2c2bf3){_0x2b58f8['push'](_0x2b58f8['shift']());}};_0x2af05b(++_0x14f865);}(_0x5d0f,0x1cd));var _0xf5d0=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x5d0f[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xf5d0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf5d0('0x1'));var BPromise=require(_0xf5d0('0x2'));var rp=require(_0xf5d0('0x3'));var fs=require('fs');var path=require(_0xf5d0('0x4'));var rimraf=require(_0xf5d0('0x5'));var config=require(_0xf5d0('0x6'));var attributes=require(_0xf5d0('0x7'));module[_0xf5d0('0x8')]=function(_0x53eb2d,_0x33c295){return _0x53eb2d[_0xf5d0('0x9')](_0xf5d0('0xa'),attributes,{'tableName':_0xf5d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa0b=['define','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes'];(function(_0x4cf304,_0x4b8a9d){var _0xf18adf=function(_0x3bac2d){while(--_0x3bac2d){_0x4cf304['push'](_0x4cf304['shift']());}};_0xf18adf(++_0x4b8a9d);}(_0xfa0b,0x178));var _0xbfa0=function(_0x425c5b,_0x5a23a5){_0x425c5b=_0x425c5b-0x0;var _0x3ec47a=_0xfa0b[_0x425c5b];return _0x3ec47a;};'use strict';var _=require(_0xbfa0('0x0'));var util=require('util');var logger=require(_0xbfa0('0x1'))(_0xbfa0('0x2'));var moment=require(_0xbfa0('0x3'));var BPromise=require(_0xbfa0('0x4'));var rp=require(_0xbfa0('0x5'));var fs=require('fs');var path=require(_0xbfa0('0x6'));var rimraf=require('rimraf');var config=require(_0xbfa0('0x7'));var attributes=require(_0xbfa0('0x8'));module['exports']=function(_0x29ce62,_0x4a2a5a){return _0x29ce62[_0xbfa0('0x9')]('UserChatQueue',attributes,{'tableName':_0xbfa0('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 c9b7511..31de643 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 _0xf9a3=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55ae7f,_0x449847){var _0x3e95d9=function(_0x21a21e){while(--_0x21a21e){_0x55ae7f['push'](_0x55ae7f['shift']());}};_0x3e95d9(++_0x449847);}(_0xf9a3,0x181));var _0x3f9a=function(_0x271b9e,_0x25fad1){_0x271b9e=_0x271b9e-0x0;var _0x4cf962=_0xf9a3[_0x271b9e];return _0x4cf962;};'use strict';var _=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var moment=require('moment');var BPromise=require(_0x3f9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f9a('0x4'))(_0x3f9a('0x5'));var config=require(_0x3f9a('0x6'));var jayson=require(_0x3f9a('0x7'));var client=jayson[_0x3f9a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b4619,_0x4ad0cd,_0x4cbcf6){return new BPromise(function(_0x13d745,_0x1b73b6){return client[_0x3f9a('0x9')](_0x2b4619,_0x4cbcf6)[_0x3f9a('0xa')](function(_0x57083b){logger[_0x3f9a('0xb')](_0x3f9a('0xc'),_0x4ad0cd,_0x3f9a('0xd'));logger[_0x3f9a('0xe')](_0x3f9a('0xf'),_0x4ad0cd,_0x3f9a('0xd'),JSON['stringify'](_0x57083b));if(_0x57083b[_0x3f9a('0x10')]){if(_0x57083b[_0x3f9a('0x10')][_0x3f9a('0x11')]===0x1f4){logger[_0x3f9a('0x10')](_0x3f9a('0xc'),_0x4ad0cd,_0x57083b['error'][_0x3f9a('0x12')]);return _0x1b73b6(_0x57083b[_0x3f9a('0x10')][_0x3f9a('0x12')]);}logger[_0x3f9a('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4ad0cd,_0x57083b[_0x3f9a('0x10')][_0x3f9a('0x12')]);return _0x13d745(_0x57083b[_0x3f9a('0x10')][_0x3f9a('0x12')]);}else{logger[_0x3f9a('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x4ad0cd,_0x3f9a('0xd'));_0x13d745(_0x57083b['result'][_0x3f9a('0x12')]);}})[_0x3f9a('0x13')](function(_0x349f44){logger[_0x3f9a('0x10')](_0x3f9a('0xc'),_0x4ad0cd,_0x349f44);_0x1b73b6(_0x349f44);});});} \ No newline at end of file +var _0x3b5a=['jayson/promise','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x117ed3,_0x94a970){var _0x16cd2b=function(_0x576840){while(--_0x576840){_0x117ed3['push'](_0x117ed3['shift']());}};_0x16cd2b(++_0x94a970);}(_0x3b5a,0x174));var _0xa3b5=function(_0x1e5a59,_0x22d345){_0x1e5a59=_0x1e5a59-0x0;var _0x4ca834=_0x3b5a[_0x1e5a59];return _0x4ca834;};'use strict';var _=require('lodash');var util=require(_0xa3b5('0x0'));var moment=require(_0xa3b5('0x1'));var BPromise=require(_0xa3b5('0x2'));var rs=require(_0xa3b5('0x3'));var fs=require('fs');var Redis=require(_0xa3b5('0x4'));var db=require(_0xa3b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3b5('0x6'))('rpc');var config=require(_0xa3b5('0x7'));var jayson=require(_0xa3b5('0x8'));var client=jayson['client'][_0xa3b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x492f28,_0x3d9dfa,_0xd0546){return new BPromise(function(_0x16b24b,_0x4599c6){return client['request'](_0x492f28,_0xd0546)[_0xa3b5('0xa')](function(_0x2c233e){logger['info'](_0xa3b5('0xb'),_0x3d9dfa,_0xa3b5('0xc'));logger[_0xa3b5('0xd')](_0xa3b5('0xe'),_0x3d9dfa,'request\x20sent',JSON[_0xa3b5('0xf')](_0x2c233e));if(_0x2c233e[_0xa3b5('0x10')]){if(_0x2c233e[_0xa3b5('0x10')]['code']===0x1f4){logger['error'](_0xa3b5('0xb'),_0x3d9dfa,_0x2c233e[_0xa3b5('0x10')][_0xa3b5('0x11')]);return _0x4599c6(_0x2c233e[_0xa3b5('0x10')][_0xa3b5('0x11')]);}logger[_0xa3b5('0x10')](_0xa3b5('0xb'),_0x3d9dfa,_0x2c233e[_0xa3b5('0x10')][_0xa3b5('0x11')]);return _0x16b24b(_0x2c233e[_0xa3b5('0x10')][_0xa3b5('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3d9dfa,_0xa3b5('0xc'));_0x16b24b(_0x2c233e[_0xa3b5('0x12')][_0xa3b5('0x11')]);}})[_0xa3b5('0x13')](function(_0x1428e8){logger['error'](_0xa3b5('0xb'),_0x3d9dfa,_0x1428e8);_0x4599c6(_0x1428e8);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f6099ca..18c7bf6 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3559c5,_0x1a0283){var _0x1139b5=function(_0x15c4b9){while(--_0x15c4b9){_0x3559c5['push'](_0x3559c5['shift']());}};_0x1139b5(++_0x1a0283);}(_0xe706,0xa3));var _0x6e70=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0xe706[_0x7472aa];return _0x12e552;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d1adc07..5c6573a 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 _0xa2c0=['exports','STRING','sequelize'];(function(_0x3cef8d,_0x42ef69){var _0xdc36ef=function(_0x2ff820){while(--_0x2ff820){_0x3cef8d['push'](_0x3cef8d['shift']());}};_0xdc36ef(++_0x42ef69);}(_0xa2c0,0x191));var _0x0a2c=function(_0x576728,_0x1a07fe){_0x576728=_0x576728-0x0;var _0x1a91df=_0xa2c0[_0x576728];return _0x1a91df;};'use strict';var Sequelize=require(_0x0a2c('0x0'));module[_0x0a2c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0a2c('0x2')]}}; \ No newline at end of file +var _0xe6c4=['INTEGER','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6c4,0x11b));var _0x4e6c=function(_0x1312a5,_0x20176f){_0x1312a5=_0x1312a5-0x0;var _0x210476=_0xe6c4[_0x1312a5];return _0x210476;};'use strict';var Sequelize=require(_0x4e6c('0x0'));module[_0x4e6c('0x1')]={'penalty':{'type':Sequelize[_0x4e6c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4e6c('0x2')],'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 c67bb86..52074b2 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 _0x2a14=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','user_has_fax_queues','lodash','util'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2a14,0xda));var _0x42a1=function(_0x9e944f,_0x5ac1ce){_0x9e944f=_0x9e944f-0x0;var _0x178c84=_0x2a14[_0x9e944f];return _0x178c84;};'use strict';var _=require(_0x42a1('0x0'));var util=require(_0x42a1('0x1'));var logger=require(_0x42a1('0x2'))(_0x42a1('0x3'));var moment=require(_0x42a1('0x4'));var BPromise=require(_0x42a1('0x5'));var rp=require(_0x42a1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a1('0x7'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x42a1('0x8')]=function(_0xb7254,_0x159646){return _0xb7254[_0x42a1('0x9')]('UserFaxQueue',attributes,{'tableName':_0x42a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa4=['rimraf','./userFaxQueue.attributes','define','lodash','util','path'];(function(_0x4cafb1,_0x2954df){var _0x5d0869=function(_0x43667a){while(--_0x43667a){_0x4cafb1['push'](_0x4cafb1['shift']());}};_0x5d0869(++_0x2954df);}(_0xfaa4,0xdb));var _0x4faa=function(_0x46b412,_0x2b274d){_0x46b412=_0x46b412-0x0;var _0x4d61b1=_0xfaa4[_0x46b412];return _0x4d61b1;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('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(_0x4faa('0x2'));var rimraf=require(_0x4faa('0x3'));var config=require('../../config/environment');var attributes=require(_0x4faa('0x4'));module['exports']=function(_0xc631b7,_0x407761){return _0xc631b7[_0x4faa('0x5')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 3786e39..bf93b94 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 _0x2bdf=['then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5712cd,_0x31c127){var _0x5670bb=function(_0x122d91){while(--_0x122d91){_0x5712cd['push'](_0x5712cd['shift']());}};_0x5670bb(++_0x31c127);}(_0x2bdf,0xbd));var _0xf2bd=function(_0x56414d,_0x125cbf){_0x56414d=_0x56414d-0x0;var _0xec7997=_0x2bdf[_0x56414d];return _0xec7997;};'use strict';var _=require('lodash');var util=require(_0xf2bd('0x0'));var moment=require('moment');var BPromise=require(_0xf2bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2bd('0x2'))['db'];var utils=require(_0xf2bd('0x3'));var logger=require('../../config/logger')(_0xf2bd('0x4'));var config=require(_0xf2bd('0x5'));var jayson=require(_0xf2bd('0x6'));var client=jayson['client'][_0xf2bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2397bb,_0x2cf3c1,_0x3526cf){return new BPromise(function(_0x24fecc,_0x25d7e9){return client[_0xf2bd('0x8')](_0x2397bb,_0x3526cf)[_0xf2bd('0x9')](function(_0x5a6cbb){logger[_0xf2bd('0xa')](_0xf2bd('0xb'),_0x2cf3c1,'request\x20sent');logger['debug'](_0xf2bd('0xc'),_0x2cf3c1,'request\x20sent',JSON['stringify'](_0x5a6cbb));if(_0x5a6cbb['error']){if(_0x5a6cbb[_0xf2bd('0xd')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x2cf3c1,_0x5a6cbb['error']['message']);return _0x25d7e9(_0x5a6cbb[_0xf2bd('0xd')]['message']);}logger[_0xf2bd('0xd')](_0xf2bd('0xb'),_0x2cf3c1,_0x5a6cbb[_0xf2bd('0xd')][_0xf2bd('0xe')]);return _0x24fecc(_0x5a6cbb[_0xf2bd('0xd')][_0xf2bd('0xe')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2cf3c1,_0xf2bd('0xf'));_0x24fecc(_0x5a6cbb[_0xf2bd('0x10')][_0xf2bd('0xe')]);}})[_0xf2bd('0x11')](function(_0x4d4af4){logger[_0xf2bd('0xd')](_0xf2bd('0xb'),_0x2cf3c1,_0x4d4af4);_0x25d7e9(_0x4d4af4);});});} \ No newline at end of file +var _0xefdc=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x46c5ac,_0x5bcbd8){var _0x45bda3=function(_0x592217){while(--_0x592217){_0x46c5ac['push'](_0x46c5ac['shift']());}};_0x45bda3(++_0x5bcbd8);}(_0xefdc,0x1ed));var _0xcefd=function(_0x3a634e,_0x273db2){_0x3a634e=_0x3a634e-0x0;var _0x2ecddb=_0xefdc[_0x3a634e];return _0x2ecddb;};'use strict';var _=require(_0xcefd('0x0'));var util=require(_0xcefd('0x1'));var moment=require(_0xcefd('0x2'));var BPromise=require(_0xcefd('0x3'));var rs=require(_0xcefd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcefd('0x5'))['db'];var utils=require(_0xcefd('0x6'));var logger=require('../../config/logger')(_0xcefd('0x7'));var config=require(_0xcefd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x400809,_0x48226e,_0x3e1a65){return new BPromise(function(_0x2a0f13,_0x12c7eb){return client[_0xcefd('0x9')](_0x400809,_0x3e1a65)[_0xcefd('0xa')](function(_0x38ffad){logger[_0xcefd('0xb')](_0xcefd('0xc'),_0x48226e,_0xcefd('0xd'));logger[_0xcefd('0xe')](_0xcefd('0xf'),_0x48226e,'request\x20sent',JSON['stringify'](_0x38ffad));if(_0x38ffad[_0xcefd('0x10')]){if(_0x38ffad[_0xcefd('0x10')][_0xcefd('0x11')]===0x1f4){logger[_0xcefd('0x10')](_0xcefd('0xc'),_0x48226e,_0x38ffad[_0xcefd('0x10')][_0xcefd('0x12')]);return _0x12c7eb(_0x38ffad[_0xcefd('0x10')][_0xcefd('0x12')]);}logger[_0xcefd('0x10')](_0xcefd('0xc'),_0x48226e,_0x38ffad[_0xcefd('0x10')][_0xcefd('0x12')]);return _0x2a0f13(_0x38ffad[_0xcefd('0x10')][_0xcefd('0x12')]);}else{logger['info'](_0xcefd('0xc'),_0x48226e,_0xcefd('0xd'));_0x2a0f13(_0x38ffad[_0xcefd('0x13')]['message']);}})[_0xcefd('0x14')](function(_0x42ac8e){logger[_0xcefd('0x10')](_0xcefd('0xc'),_0x48226e,_0x42ac8e);_0x12c7eb(_0x42ac8e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 095e930..69096fe 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1232ea,_0x31cffa){var _0xdc426=function(_0x333956){while(--_0x333956){_0x1232ea['push'](_0x1232ea['shift']());}};_0xdc426(++_0x31cffa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2892688..eec42cb 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 _0x4ef8=['sequelize','INTEGER'];(function(_0x40b7f3,_0x36e4e8){var _0x156cf3=function(_0x35a8fb){while(--_0x35a8fb){_0x40b7f3['push'](_0x40b7f3['shift']());}};_0x156cf3(++_0x36e4e8);}(_0x4ef8,0x148));var _0x84ef=function(_0x22b6b4,_0x1f8e49){_0x22b6b4=_0x22b6b4-0x0;var _0x2ee634=_0x4ef8[_0x22b6b4];return _0x2ee634;};'use strict';var Sequelize=require(_0x84ef('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x84ef('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x41e5=['INTEGER','exports'];(function(_0x18261f,_0x3eddfa){var _0x1c5910=function(_0x57224e){while(--_0x57224e){_0x18261f['push'](_0x18261f['shift']());}};_0x1c5910(++_0x3eddfa);}(_0x41e5,0x193));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x541e('0x0')]={'penalty':{'type':Sequelize[_0x541e('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 e516055..8364090 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 _0x04e7=['../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x04e7,0x108));var _0x704e=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x04e7[_0xc87d08];return _0x30a714;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x704e('0x0'))(_0x704e('0x1'));var moment=require(_0x704e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x704e('0x3'));var rimraf=require(_0x704e('0x4'));var config=require(_0x704e('0x5'));var attributes=require(_0x704e('0x6'));module[_0x704e('0x7')]=function(_0x3fc4e5,_0x3cb0c2){return _0x3fc4e5[_0x704e('0x8')](_0x704e('0x9'),attributes,{'tableName':_0x704e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b16=['bluebird','path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x2b16,0xce));var _0x62b1=function(_0x348bd5,_0x219683){_0x348bd5=_0x348bd5-0x0;var _0x4cdb23=_0x2b16[_0x348bd5];return _0x4cdb23;};'use strict';var _=require('lodash');var util=require(_0x62b1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x62b1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62b1('0x2'));var rimraf=require(_0x62b1('0x3'));var config=require(_0x62b1('0x4'));var attributes=require('./userMailQueue.attributes');module[_0x62b1('0x5')]=function(_0x2ce3f4,_0x5b1658){return _0x2ce3f4[_0x62b1('0x6')](_0x62b1('0x7'),attributes,{'tableName':_0x62b1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 4ce1707..8ef8481 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x10a07d,_0x558798){var _0x2c03d9=function(_0xdef758){while(--_0xdef758){_0x10a07d['push'](_0x10a07d['shift']());}};_0x2c03d9(++_0x558798);}(_0xe14b,0x93));var _0xbe14=function(_0xca964d,_0x4b5c07){_0xca964d=_0xca964d-0x0;var _0x28c917=_0xe14b[_0xca964d];return _0x28c917;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _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(_0x4b5a83,_0x202d4a){var _0x3ab2ce=function(_0x2f69e5){while(--_0x2f69e5){_0x4b5a83['push'](_0x4b5a83['shift']());}};_0x3ab2ce(++_0x202d4a);}(_0x55ca,0x126));var _0xa55c=function(_0x309bde,_0x3ef7f5){_0x309bde=_0x309bde-0x0;var _0x5fa8bc=_0x55ca[_0x309bde];return _0x5fa8bc;};'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 fb0c349..84778d4 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 _0x13b1=['../../config/environment','isAuthenticated','sendUserNotification','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x4df89f,_0x3c6929){var _0x1a62f8=function(_0x3c1f7c){while(--_0x3c1f7c){_0x4df89f['push'](_0x4df89f['shift']());}};_0x1a62f8(++_0x3c6929);}(_0x13b1,0xb7));var _0x113b=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x13b1[_0x1385dc];return _0x2f6469;};'use strict';var multer=require('multer');var util=require(_0x113b('0x0'));var path=require(_0x113b('0x1'));var timeout=require(_0x113b('0x2'));var express=require(_0x113b('0x3'));var router=express['Router']();var fs_extra=require(_0x113b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x113b('0x5'));var config=require(_0x113b('0x6'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x113b('0x7')](),controller[_0x113b('0x8')]);module['exports']=router; \ No newline at end of file +var _0xa909=['post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0xa909,0xfa));var _0x9a90=function(_0x56a909,_0x202b1d){_0x56a909=_0x56a909-0x0;var _0x5987b8=_0xa909[_0x56a909];return _0x5987b8;};'use strict';var multer=require(_0x9a90('0x0'));var util=require(_0x9a90('0x1'));var path=require(_0x9a90('0x2'));var timeout=require(_0x9a90('0x3'));var express=require(_0x9a90('0x4'));var router=express[_0x9a90('0x5')]();var fs_extra=require(_0x9a90('0x6'));var auth=require(_0x9a90('0x7'));var interaction=require(_0x9a90('0x8'));var config=require('../../config/environment');var controller=require(_0x9a90('0x9'));router[_0x9a90('0xa')]('/',auth[_0x9a90('0xb')](),controller['sendUserNotification']);module[_0x9a90('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5bedd9e..142bd38 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 _0x877a=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x877a,0xb9));var _0xa877=function(_0x4bd556,_0x37e4d0){_0x4bd556=_0x4bd556-0x0;var _0x479ed5=_0x877a[_0x4bd556];return _0x479ed5;};'use strict';var Sequelize=require(_0xa877('0x0'));module[_0xa877('0x1')]={'body':{'type':Sequelize[_0xa877('0x2')]},'senderName':{'type':Sequelize[_0xa877('0x3')]},'recipientsId':{'type':Sequelize[_0xa877('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa877('0x3')]},'beep':{'type':Sequelize[_0xa877('0x4')]}}; \ No newline at end of file +var _0x78d7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x78d7,0x1d2));var _0x778d=function(_0x516c7c,_0x20fca5){_0x516c7c=_0x516c7c-0x0;var _0x1e5521=_0x78d7[_0x516c7c];return _0x1e5521;};'use strict';var Sequelize=require(_0x778d('0x0'));module[_0x778d('0x1')]={'body':{'type':Sequelize[_0x778d('0x2')]},'senderName':{'type':Sequelize[_0x778d('0x3')]},'recipientsId':{'type':Sequelize[_0x778d('0x2')]},'recipientsDescription':{'type':Sequelize[_0x778d('0x3')]},'beep':{'type':Sequelize[_0x778d('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index fee7035..a793541 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 _0xba9f=['sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','senderName','fullname','recipientsDescription','beep','SenderId','then','recipientsId','sortBy','transaction','UserNotification','create','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','model','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','error','stack','name','send'];(function(_0x361422,_0xa27d1e){var _0x2daa43=function(_0x1ad8f6){while(--_0x1ad8f6){_0x361422['push'](_0x361422['shift']());}};_0x2daa43(++_0xa27d1e);}(_0xba9f,0x164));var _0xfba9=function(_0xbc18f1,_0x5b745e){_0xbc18f1=_0xbc18f1-0x0;var _0x1d30ec=_0xba9f[_0xbc18f1];return _0x1d30ec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfba9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfba9('0x1'));var moment=require(_0xfba9('0x2'));var BPromise=require(_0xfba9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfba9('0x4'));var ejs=require(_0xfba9('0x5'));var fs=require('fs');var fs_extra=require(_0xfba9('0x6'));var _=require(_0xfba9('0x7'));var squel=require(_0xfba9('0x8'));var crypto=require(_0xfba9('0x9'));var jsforce=require(_0xfba9('0xa'));var deskjs=require(_0xfba9('0xb'));var toCsv=require(_0xfba9('0x4'));var querystring=require(_0xfba9('0xc'));var Papa=require(_0xfba9('0xd'));var Redis=require(_0xfba9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfba9('0xf'));var hardwareService=require(_0xfba9('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xfba9('0x11'));var config=require(_0xfba9('0x12'));var licenseUtil=require(_0xfba9('0x13'));var db=require('../../mysqldb')['db'];config[_0xfba9('0x14')]=_[_0xfba9('0x15')](config[_0xfba9('0x14')],{'host':_0xfba9('0x16'),'port':0x18eb});var socket=require(_0xfba9('0x17'))(new Redis(config[_0xfba9('0x14')]));require(_0xfba9('0x18'))[_0xfba9('0x19')](socket);function respondWithStatusCode(_0x49e94c,_0x2bc4a4){_0x2bc4a4=_0x2bc4a4||0xcc;return function(_0x100f9b){if(_0x100f9b){return _0x49e94c[_0xfba9('0x1a')](_0x2bc4a4);}return _0x49e94c[_0xfba9('0x1b')](_0x2bc4a4)[_0xfba9('0x1c')]();};}function respondWithResult(_0x5d8408,_0x57b4c9){_0x57b4c9=_0x57b4c9||0xc8;return function(_0x3e302f){if(_0x3e302f){return _0x5d8408[_0xfba9('0x1b')](_0x57b4c9)[_0xfba9('0x1d')](_0x3e302f);}};}function respondWithFilteredResult(_0x4baad4,_0xec1e87){return function(_0x4fb12e){if(_0x4fb12e){var _0x394693=typeof _0xec1e87['offset']===_0xfba9('0x1e')&&typeof _0xec1e87[_0xfba9('0x1f')]==='undefined';var _0x489318=_0x4fb12e['count'];var _0x4063cc=_0x394693?0x0:_0xec1e87[_0xfba9('0x20')];var _0x552c7d=_0x394693?_0x4fb12e[_0xfba9('0x21')]:_0xec1e87[_0xfba9('0x20')]+_0xec1e87[_0xfba9('0x1f')];var _0x553369;if(_0x552c7d>=_0x489318){_0x552c7d=_0x489318;_0x553369=0xc8;}else{_0x553369=0xce;}_0x4baad4['status'](_0x553369);return _0x4baad4[_0xfba9('0x22')]('Content-Range',_0x4063cc+'-'+_0x552c7d+'/'+_0x489318)[_0xfba9('0x1d')](_0x4fb12e);}return null;};}function patchUpdates(_0x4b8a93){return function(_0x29f77e){try{jsonpatch[_0xfba9('0x23')](_0x29f77e,_0x4b8a93,!![]);}catch(_0x49d6f0){return BPromise[_0xfba9('0x24')](_0x49d6f0);}return _0x29f77e[_0xfba9('0x25')]();};}function saveUpdates(_0x4c1205,_0x3f1610){return function(_0x2db2ef){if(_0x2db2ef){return _0x2db2ef[_0xfba9('0x26')](_0x4c1205)['then'](function(_0x46e55d){return _0x46e55d;});}return null;};}function removeEntity(_0x4401b0,_0x2e99b6){return function(_0x28e30a){if(_0x28e30a){return _0x28e30a[_0xfba9('0x27')]()['then'](function(){_0x4401b0[_0xfba9('0x1b')](0xcc)[_0xfba9('0x1c')]();});}};}function handleEntityNotFound(_0x4dc17a,_0x43ccde){return function(_0xb7599d){if(!_0xb7599d){_0x4dc17a[_0xfba9('0x1a')](0x194);}return _0xb7599d;};}function handleError(_0x36baae,_0x9ad0dc){_0x9ad0dc=_0x9ad0dc||0x1f4;return function(_0x33f1c4){logger[_0xfba9('0x28')](_0x33f1c4[_0xfba9('0x29')]);if(_0x33f1c4[_0xfba9('0x2a')]){delete _0x33f1c4[_0xfba9('0x2a')];}_0x36baae['status'](_0x9ad0dc)[_0xfba9('0x2b')](_0x33f1c4);};}exports[_0xfba9('0x2c')]=function(_0x2bb46d,_0x3f4652,_0x573241){if(!_0x2bb46d[_0xfba9('0x2d')][_0xfba9('0x2e')](_0xfba9('0x2f'))&&!_0x2bb46d['body']['hasOwnProperty'](_0xfba9('0x30'))){throw new db[(_0xfba9('0x31'))]['ValidationError'](_0xfba9('0x32'));}else{if(_0x2bb46d[_0xfba9('0x2d')][_0xfba9('0x2e')](_0xfba9('0x30'))&&!_0x2bb46d[_0xfba9('0x2d')][_0xfba9('0x2e')](_0xfba9('0x33'))){throw new db['Sequelize'][(_0xfba9('0x34'))](_0xfba9('0x35'));}if(!_0x2bb46d['body'][_0xfba9('0x2e')](_0xfba9('0x36'))){throw new db[(_0xfba9('0x31'))]['ValidationError'](_0xfba9('0x37'));}else{try{var _0x1e87f6=JSON[_0xfba9('0x38')](_0x2bb46d['body']['recipients']);}catch(_0xb30d5a){logger['error'](_0xb30d5a);throw new db[(_0xfba9('0x31'))][(_0xfba9('0x34'))](_0xfba9('0x39'));}var _0x4debb8=['chatqueue',_0xfba9('0x3a'),_0xfba9('0x3b'),_0xfba9('0x3c'),'smsqueue',_0xfba9('0x3d'),_0xfba9('0x3e'),_0xfba9('0x3f'),_0xfba9('0x40')];if(_[_0xfba9('0x41')](_0x1e87f6,function(_0xacbf25){return!_[_0xfba9('0x42')](_0x4debb8,_0xacbf25['model'][_0xfba9('0x43')]());})){throw new db['Sequelize'][(_0xfba9('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x40c0c6={};_0x40c0c6[_0xfba9('0x44')]=_0x2bb46d[_0xfba9('0x2d')]['hasOwnProperty'](_0xfba9('0x44'))?_0x2bb46d[_0xfba9('0x2d')]['senderName']:_0x2bb46d[_0xfba9('0x40')][_0xfba9('0x45')];_0x40c0c6[_0xfba9('0x46')]=_['isEmpty'](_0x2bb46d[_0xfba9('0x2d')][_0xfba9('0x46')])?null:_0x2bb46d[_0xfba9('0x2d')]['recipientsDescription'];_0x40c0c6[_0xfba9('0x47')]=_0x2bb46d[_0xfba9('0x2d')][_0xfba9('0x47')]||![];_0x40c0c6[_0xfba9('0x48')]=_0x2bb46d[_0xfba9('0x40')]['id'];return getContent(_0x2bb46d['body'])['then'](function(_0x42af33){_0x40c0c6[_0xfba9('0x2d')]=_0x42af33;return getRecipients(_0x1e87f6);})[_0xfba9('0x49')](function(_0x5a902a){_0x40c0c6[_0xfba9('0x4a')]=_[_0xfba9('0x4b')](_0x5a902a)['join'](',');return db['sequelize'][_0xfba9('0x4c')](function(_0x2755ce){return db[_0xfba9('0x4d')][_0xfba9('0x4e')](_0x40c0c6,{'raw':!![],'transaction':_0x2755ce})[_0xfba9('0x49')](function(_0x1e27db){var _0x580063={'sender':_0x40c0c6[_0xfba9('0x44')],'description':_0x40c0c6['recipientsDescription'],'content':_0x40c0c6[_0xfba9('0x2d')],'beep':_0x40c0c6[_0xfba9('0x47')]};_0x5a902a['forEach'](function(_0x27d451){_0x580063['recipient']=_0x27d451;socket[_0xfba9('0x4f')](_0xfba9('0x50'),_0x580063);});return _0x1e27db;});});})[_0xfba9('0x49')](respondWithResult(_0x3f4652,0xc9))[_0xfba9('0x51')](handleError(_0x3f4652,null));};function getContent(_0x3146d5){return new BPromise(function(_0x3572ff,_0x251ece){if(_0x3146d5[_0xfba9('0x2f')]){_0x3572ff(_0x3146d5[_0xfba9('0x2f')]);return;}return db[_0xfba9('0x52')][_0xfba9('0x53')]({'attributes':[_0xfba9('0x54')],'where':{'id':_0x3146d5['TemplateId']},'raw':!![]})[_0xfba9('0x49')](function(_0x4509ca){if(!_0x4509ca)throw new db[(_0xfba9('0x31'))][(_0xfba9('0x34'))](_0xfba9('0x55'));var _0x84582b=Mustache[_0xfba9('0x56')](_0x4509ca['html'],_0x3146d5[_0xfba9('0x33')]);_0x3572ff(_0x84582b);})['catch'](function(_0x445840){_0x251ece(_0x445840);});});}function getRecipients(_0x128101){return new BPromise(function(_0x45a1c8,_0x2f1692){var _0x4ed11e=[];var _0x80aa9e=[];_0x128101[_0xfba9('0x57')](function(_0x5d2bee){var _0x472657=_[_0xfba9('0x58')](_0x5d2bee[_0xfba9('0x59')][_0xfba9('0x43')]());if(_0x472657==='User'){_0x4ed11e=_[_0xfba9('0x5a')](_0x4ed11e,_0x5d2bee[_0xfba9('0x5b')]);}else{if(_[_0xfba9('0x42')](_0x472657,_0xfba9('0x5c')))_0x472657=_0x472657[_0xfba9('0x5d')](_0xfba9('0x5c'),_0xfba9('0x5e'));_0x5d2bee[_0xfba9('0x5b')]['forEach'](function(_0x3d368f){_0x80aa9e[_0xfba9('0x5f')](getAgents(_0x472657,_0x3d368f));});}});return BPromise[_0xfba9('0x60')](_0x80aa9e)[_0xfba9('0x49')](function(_0x3c3c1b){_0x4ed11e=_[_0xfba9('0x5a')](_0x4ed11e,_[_0xfba9('0x61')](_0x3c3c1b));_0x45a1c8(_0x4ed11e);})[_0xfba9('0x51')](function(_0x48c292){_0x2f1692(_0x48c292);});});}function getAgents(_0x374290,_0x3ab8fe){return new BPromise(function(_0xf8efb7,_0x4b95de){return db[_0x374290]['findOne']({'where':{'id':_0x3ab8fe}})[_0xfba9('0x49')](function(_0x32f0de){return _0x32f0de[_0xfba9('0x62')]({'attributes':['id'],'raw':!![]})[_0xfba9('0x49')](function(_0x28d4ca){var _0x4b5fd5=_[_0xfba9('0x63')](_0x28d4ca,'id');_0xf8efb7(_0x4b5fd5);});})[_0xfba9('0x51')](function(_0x437152){_0x4b95de(_0x437152);});});} \ No newline at end of file +var _0x1c02=['json','apply','reject','save','update','then','name','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','sequelize','transaction','create','forEach','userNotification:send','catch','Template','html','TemplateId','render','startCase','User','union','ids','queue','Queue','push','flatten','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','undefined','count','offset','set'];(function(_0x166824,_0x4114ae){var _0x22e28b=function(_0x1e8694){while(--_0x1e8694){_0x166824['push'](_0x166824['shift']());}};_0x22e28b(++_0x4114ae);}(_0x1c02,0xee));var _0x21c0=function(_0x128f3a,_0x929550){_0x128f3a=_0x128f3a-0x0;var _0x523696=_0x1c02[_0x128f3a];return _0x523696;};'use strict';var emlformat=require(_0x21c0('0x0'));var rimraf=require(_0x21c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21c0('0x2'));var rp=require(_0x21c0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x21c0('0x4'));var util=require(_0x21c0('0x5'));var path=require(_0x21c0('0x6'));var sox=require(_0x21c0('0x7'));var csv=require(_0x21c0('0x8'));var ejs=require(_0x21c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x21c0('0xa'));var crypto=require(_0x21c0('0xb'));var jsforce=require(_0x21c0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x21c0('0x8'));var querystring=require(_0x21c0('0xd'));var Papa=require(_0x21c0('0xe'));var Redis=require('ioredis');var authService=require(_0x21c0('0xf'));var qs=require(_0x21c0('0x10'));var as=require(_0x21c0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21c0('0x12'))(_0x21c0('0x13'));var utils=require(_0x21c0('0x14'));var config=require(_0x21c0('0x15'));var licenseUtil=require(_0x21c0('0x16'));var db=require('../../mysqldb')['db'];config[_0x21c0('0x17')]=_[_0x21c0('0x18')](config[_0x21c0('0x17')],{'host':_0x21c0('0x19'),'port':0x18eb});var socket=require(_0x21c0('0x1a'))(new Redis(config[_0x21c0('0x17')]));require(_0x21c0('0x1b'))[_0x21c0('0x1c')](socket);function respondWithStatusCode(_0x28b547,_0xb5ff13){_0xb5ff13=_0xb5ff13||0xcc;return function(_0x42f5bc){if(_0x42f5bc){return _0x28b547[_0x21c0('0x1d')](_0xb5ff13);}return _0x28b547[_0x21c0('0x1e')](_0xb5ff13)['end']();};}function respondWithResult(_0x187c4f,_0x4c3089){_0x4c3089=_0x4c3089||0xc8;return function(_0x5c9419){if(_0x5c9419){return _0x187c4f[_0x21c0('0x1e')](_0x4c3089)['json'](_0x5c9419);}};}function respondWithFilteredResult(_0x11b261,_0x752f04){return function(_0x4bd363){if(_0x4bd363){var _0x209855=typeof _0x752f04['offset']==='undefined'&&typeof _0x752f04['limit']===_0x21c0('0x1f');var _0x573675=_0x4bd363[_0x21c0('0x20')];var _0x48d2eb=_0x209855?0x0:_0x752f04['offset'];var _0x5681c3=_0x209855?_0x4bd363[_0x21c0('0x20')]:_0x752f04[_0x21c0('0x21')]+_0x752f04['limit'];var _0xfc302;if(_0x5681c3>=_0x573675){_0x5681c3=_0x573675;_0xfc302=0xc8;}else{_0xfc302=0xce;}_0x11b261[_0x21c0('0x1e')](_0xfc302);return _0x11b261[_0x21c0('0x22')]('Content-Range',_0x48d2eb+'-'+_0x5681c3+'/'+_0x573675)[_0x21c0('0x23')](_0x4bd363);}return null;};}function patchUpdates(_0x30e99e){return function(_0x4c64d5){try{jsonpatch[_0x21c0('0x24')](_0x4c64d5,_0x30e99e,!![]);}catch(_0x9a8d11){return BPromise[_0x21c0('0x25')](_0x9a8d11);}return _0x4c64d5[_0x21c0('0x26')]();};}function saveUpdates(_0x4e8b8d,_0x422175){return function(_0x1f1fad){if(_0x1f1fad){return _0x1f1fad[_0x21c0('0x27')](_0x4e8b8d)[_0x21c0('0x28')](function(_0x4aba82){return _0x4aba82;});}return null;};}function removeEntity(_0x3fd9d4,_0x4b7ec8){return function(_0x512bc2){if(_0x512bc2){return _0x512bc2['destroy']()['then'](function(){_0x3fd9d4[_0x21c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3a5d,_0x4c7169){return function(_0x21d3ea){if(!_0x21d3ea){_0x2e3a5d[_0x21c0('0x1d')](0x194);}return _0x21d3ea;};}function handleError(_0x50bb28,_0x418b2c){_0x418b2c=_0x418b2c||0x1f4;return function(_0x4cea74){logger['error'](_0x4cea74['stack']);if(_0x4cea74[_0x21c0('0x29')]){delete _0x4cea74['name'];}_0x50bb28[_0x21c0('0x1e')](_0x418b2c)['send'](_0x4cea74);};}exports[_0x21c0('0x2a')]=function(_0x486290,_0x3cf68d,_0x527a20){if(!_0x486290[_0x21c0('0x2b')][_0x21c0('0x2c')](_0x21c0('0x2d'))&&!_0x486290[_0x21c0('0x2b')][_0x21c0('0x2c')]('TemplateId')){throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x486290[_0x21c0('0x2b')][_0x21c0('0x2c')]('TemplateId')&&!_0x486290[_0x21c0('0x2b')][_0x21c0('0x2c')](_0x21c0('0x30'))){throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))](_0x21c0('0x31'));}if(!_0x486290['body'][_0x21c0('0x2c')](_0x21c0('0x32'))){throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))](_0x21c0('0x33'));}else{try{var _0xfb6898=JSON[_0x21c0('0x34')](_0x486290[_0x21c0('0x2b')]['recipients']);}catch(_0xde66ec){logger['error'](_0xde66ec);throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))](_0x21c0('0x35'));}var _0xd1cd23=[_0x21c0('0x36'),'faxqueue','mailqueue','openchannelqueue',_0x21c0('0x37'),_0x21c0('0x38'),_0x21c0('0x39'),_0x21c0('0x3a'),_0x21c0('0x3b')];if(_['some'](_0xfb6898,function(_0x2f8442){return!_[_0x21c0('0x3c')](_0xd1cd23,_0x2f8442[_0x21c0('0x3d')][_0x21c0('0x3e')]());})){throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x8d42f1={};_0x8d42f1['senderName']=_0x486290[_0x21c0('0x2b')][_0x21c0('0x2c')](_0x21c0('0x3f'))?_0x486290[_0x21c0('0x2b')][_0x21c0('0x3f')]:_0x486290[_0x21c0('0x3b')][_0x21c0('0x40')];_0x8d42f1['recipientsDescription']=_[_0x21c0('0x41')](_0x486290[_0x21c0('0x2b')][_0x21c0('0x42')])?null:_0x486290[_0x21c0('0x2b')][_0x21c0('0x42')];_0x8d42f1[_0x21c0('0x43')]=_0x486290[_0x21c0('0x2b')][_0x21c0('0x43')]||![];_0x8d42f1['SenderId']=_0x486290[_0x21c0('0x3b')]['id'];return getContent(_0x486290[_0x21c0('0x2b')])[_0x21c0('0x28')](function(_0x1d7187){_0x8d42f1[_0x21c0('0x2b')]=_0x1d7187;return getRecipients(_0xfb6898);})[_0x21c0('0x28')](function(_0x388ec1){_0x8d42f1[_0x21c0('0x44')]=_[_0x21c0('0x45')](_0x388ec1)['join'](',');return db[_0x21c0('0x46')][_0x21c0('0x47')](function(_0x55c136){return db['UserNotification'][_0x21c0('0x48')](_0x8d42f1,{'raw':!![],'transaction':_0x55c136})[_0x21c0('0x28')](function(_0x3c0c12){var _0x41fa69={'sender':_0x8d42f1[_0x21c0('0x3f')],'description':_0x8d42f1[_0x21c0('0x42')],'content':_0x8d42f1[_0x21c0('0x2b')],'beep':_0x8d42f1[_0x21c0('0x43')]};_0x388ec1[_0x21c0('0x49')](function(_0x315be0){_0x41fa69['recipient']=_0x315be0;socket['emit'](_0x21c0('0x4a'),_0x41fa69);});return _0x3c0c12;});});})[_0x21c0('0x28')](respondWithResult(_0x3cf68d,0xc9))[_0x21c0('0x4b')](handleError(_0x3cf68d,null));};function getContent(_0x3754af){return new BPromise(function(_0x550801,_0x34f6fa){if(_0x3754af[_0x21c0('0x2d')]){_0x550801(_0x3754af[_0x21c0('0x2d')]);return;}return db[_0x21c0('0x4c')]['findOne']({'attributes':[_0x21c0('0x4d')],'where':{'id':_0x3754af[_0x21c0('0x4e')]},'raw':!![]})[_0x21c0('0x28')](function(_0x147183){if(!_0x147183)throw new db[(_0x21c0('0x2e'))][(_0x21c0('0x2f'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x694d10=Mustache[_0x21c0('0x4f')](_0x147183[_0x21c0('0x4d')],_0x3754af[_0x21c0('0x30')]);_0x550801(_0x694d10);})[_0x21c0('0x4b')](function(_0x1ffbc1){_0x34f6fa(_0x1ffbc1);});});}function getRecipients(_0x31a867){return new BPromise(function(_0x1fb6d6,_0x5cfe22){var _0x2da685=[];var _0x10f133=[];_0x31a867[_0x21c0('0x49')](function(_0x5c4189){var _0x3df8ce=_[_0x21c0('0x50')](_0x5c4189['model'][_0x21c0('0x3e')]());if(_0x3df8ce===_0x21c0('0x51')){_0x2da685=_[_0x21c0('0x52')](_0x2da685,_0x5c4189[_0x21c0('0x53')]);}else{if(_[_0x21c0('0x3c')](_0x3df8ce,_0x21c0('0x54')))_0x3df8ce=_0x3df8ce['replace'](_0x21c0('0x54'),_0x21c0('0x55'));_0x5c4189[_0x21c0('0x53')][_0x21c0('0x49')](function(_0x3fdb59){_0x10f133[_0x21c0('0x56')](getAgents(_0x3df8ce,_0x3fdb59));});}});return BPromise['all'](_0x10f133)['then'](function(_0x309a0f){_0x2da685=_[_0x21c0('0x52')](_0x2da685,_[_0x21c0('0x57')](_0x309a0f));_0x1fb6d6(_0x2da685);})['catch'](function(_0x200567){_0x5cfe22(_0x200567);});});}function getAgents(_0x510214,_0xc34b3b){return new BPromise(function(_0x4e5d39,_0x1c4753){return db[_0x510214][_0x21c0('0x58')]({'where':{'id':_0xc34b3b}})[_0x21c0('0x28')](function(_0x3f172b){return _0x3f172b[_0x21c0('0x59')]({'attributes':['id'],'raw':!![]})[_0x21c0('0x28')](function(_0x22914d){var _0x29ccfa=_[_0x21c0('0x5a')](_0x22914d,'id');_0x4e5d39(_0x29ccfa);});})[_0x21c0('0x4b')](function(_0x2f7463){_0x1c4753(_0x2f7463);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 4ea60b5..c061826 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 _0x1526=['remove','hasOwnProperty','hook','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x1526,0x1d3));var _0x6152=function(_0x17b302,_0x3bb65f){_0x17b302=_0x17b302-0x0;var _0x2f58e3=_0x1526[_0x17b302];return _0x2f58e3;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x6152('0x0'))['db'][_0x6152('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6152('0x2')](0x0);var events={'afterCreate':_0x6152('0x3'),'afterUpdate':_0x6152('0x4'),'afterDestroy':_0x6152('0x5')};function emitEvent(_0xb2428){return function(_0x1acdbd,_0x46673b,_0x5a22f2){UserNotificationEvents['emit'](_0xb2428+':'+_0x1acdbd['id'],_0x1acdbd);UserNotificationEvents['emit'](_0xb2428,_0x1acdbd);_0x5a22f2(null);};}for(var e in events){if(events[_0x6152('0x6')](e)){var event=events[e];UserNotification[_0x6152('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x29b5=['hook','events','../../mysqldb','UserNotification','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x24403d,_0x94ebf1){var _0x3fabf3=function(_0x39b1a9){while(--_0x39b1a9){_0x24403d['push'](_0x24403d['shift']());}};_0x3fabf3(++_0x94ebf1);}(_0x29b5,0x1a9));var _0x529b=function(_0x20ba05,_0x25101d){_0x20ba05=_0x20ba05-0x0;var _0x25b70b=_0x29b5[_0x20ba05];return _0x25b70b;};'use strict';var EventEmitter=require(_0x529b('0x0'));var UserNotification=require(_0x529b('0x1'))['db'][_0x529b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x529b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x529b('0x4'),'afterDestroy':_0x529b('0x5')};function emitEvent(_0x5789d1){return function(_0x331d4e,_0x25e8db,_0x16dbdb){UserNotificationEvents['emit'](_0x5789d1+':'+_0x331d4e['id'],_0x331d4e);UserNotificationEvents['emit'](_0x5789d1,_0x331d4e);_0x16dbdb(null);};}for(var e in events){if(events[_0x529b('0x6')](e)){var event=events[e];UserNotification[_0x529b('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 0cdb250..ba5a0d5 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 _0x6f36=['api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f36,0x8e));var _0x66f3=function(_0xfce263,_0x49e591){_0xfce263=_0xfce263-0x0;var _0x370d98=_0x6f36[_0xfce263];return _0x370d98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66f3('0x0'))(_0x66f3('0x1'));var moment=require(_0x66f3('0x2'));var BPromise=require(_0x66f3('0x3'));var rp=require(_0x66f3('0x4'));var fs=require('fs');var path=require(_0x66f3('0x5'));var rimraf=require('rimraf');var config=require(_0x66f3('0x6'));var attributes=require(_0x66f3('0x7'));module[_0x66f3('0x8')]=function(_0x4e4564,_0x5e3fe1){return _0x4e4564[_0x66f3('0x9')](_0x66f3('0xa'),attributes,{'tableName':_0x66f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66f3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6c9b=['request-promise','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x48f74b,_0x3d45dc){var _0x19b051=function(_0x2bf17a){while(--_0x2bf17a){_0x48f74b['push'](_0x48f74b['shift']());}};_0x19b051(++_0x3d45dc);}(_0x6c9b,0x6b));var _0xb6c9=function(_0xb553,_0x450db3){_0xb553=_0xb553-0x0;var _0x527571=_0x6c9b[_0xb553];return _0x527571;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6c9('0x0'))(_0xb6c9('0x1'));var moment=require(_0xb6c9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6c9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6c9('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c9('0x5'));module['exports']=function(_0x5ac1c2,_0x4937b8){return _0x5ac1c2[_0xb6c9('0x6')](_0xb6c9('0x7'),attributes,{'tableName':_0xb6c9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6c9('0x9'),'collate':_0xb6c9('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ae43309..616bc5f 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 _0xda48=['./userNotification.socket','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xda48,0x109));var _0x8da4=function(_0x314f57,_0xf145b3){_0x314f57=_0x314f57-0x0;var _0x4f0f3d=_0xda48[_0x314f57];return _0x4f0f3d;};'use strict';var _=require(_0x8da4('0x0'));var util=require(_0x8da4('0x1'));var moment=require(_0x8da4('0x2'));var BPromise=require(_0x8da4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8da4('0x4'));var db=require(_0x8da4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8da4('0x6'))(_0x8da4('0x7'));var config=require(_0x8da4('0x8'));var jayson=require(_0x8da4('0x9'));var client=jayson[_0x8da4('0xa')][_0x8da4('0xb')]({'port':0x232a});config['redis']=_[_0x8da4('0xc')](config[_0x8da4('0xd')],{'host':_0x8da4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8da4('0xf'))['register'](socket);function respondWithRpcPromise(_0x3dacda,_0x5bba08,_0x5090f7){return new BPromise(function(_0x4cd4b1,_0x44e528){return client[_0x8da4('0x10')](_0x3dacda,_0x5090f7)[_0x8da4('0x11')](function(_0x81cf8c){logger[_0x8da4('0x12')]('UserNotification,\x20%s,\x20%s',_0x5bba08,_0x8da4('0x13'));logger[_0x8da4('0x14')](_0x8da4('0x15'),_0x5bba08,'request\x20sent',JSON[_0x8da4('0x16')](_0x81cf8c));if(_0x81cf8c[_0x8da4('0x17')]){if(_0x81cf8c[_0x8da4('0x17')]['code']===0x1f4){logger[_0x8da4('0x17')](_0x8da4('0x18'),_0x5bba08,_0x81cf8c[_0x8da4('0x17')][_0x8da4('0x19')]);return _0x44e528(_0x81cf8c[_0x8da4('0x17')][_0x8da4('0x19')]);}logger['error'](_0x8da4('0x18'),_0x5bba08,_0x81cf8c[_0x8da4('0x17')][_0x8da4('0x19')]);return _0x4cd4b1(_0x81cf8c['error'][_0x8da4('0x19')]);}else{logger[_0x8da4('0x12')](_0x8da4('0x18'),_0x5bba08,_0x8da4('0x13'));_0x4cd4b1(_0x81cf8c[_0x8da4('0x1a')][_0x8da4('0x19')]);}})[_0x8da4('0x1b')](function(_0x54e1bf){logger[_0x8da4('0x17')]('UserNotification,\x20%s,\x20%s',_0x5bba08,_0x54e1bf);_0x44e528(_0x54e1bf);});});} \ No newline at end of file +var _0xbb45=['util','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xbb45,0xf2));var _0x5bb4=function(_0x56faab,_0x1214d0){_0x56faab=_0x56faab-0x0;var _0x292050=_0xbb45[_0x56faab];return _0x292050;};'use strict';var _=require('lodash');var util=require(_0x5bb4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bb4('0x1'));var db=require(_0x5bb4('0x2'))['db'];var utils=require(_0x5bb4('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5bb4('0x4'));var client=jayson[_0x5bb4('0x5')][_0x5bb4('0x6')]({'port':0x232a});config[_0x5bb4('0x7')]=_[_0x5bb4('0x8')](config[_0x5bb4('0x7')],{'host':_0x5bb4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bb4('0x7')]));require('./userNotification.socket')[_0x5bb4('0xa')](socket);function respondWithRpcPromise(_0x3ce1e8,_0x4b2d87,_0x5575ce){return new BPromise(function(_0x1d3e8e,_0x52ca33){return client[_0x5bb4('0xb')](_0x3ce1e8,_0x5575ce)[_0x5bb4('0xc')](function(_0x442a4b){logger[_0x5bb4('0xd')](_0x5bb4('0xe'),_0x4b2d87,_0x5bb4('0xf'));logger[_0x5bb4('0x10')](_0x5bb4('0x11'),_0x4b2d87,_0x5bb4('0xf'),JSON['stringify'](_0x442a4b));if(_0x442a4b['error']){if(_0x442a4b[_0x5bb4('0x12')]['code']===0x1f4){logger[_0x5bb4('0x12')](_0x5bb4('0xe'),_0x4b2d87,_0x442a4b[_0x5bb4('0x12')]['message']);return _0x52ca33(_0x442a4b[_0x5bb4('0x12')]['message']);}logger[_0x5bb4('0x12')](_0x5bb4('0xe'),_0x4b2d87,_0x442a4b['error'][_0x5bb4('0x13')]);return _0x1d3e8e(_0x442a4b[_0x5bb4('0x12')]['message']);}else{logger[_0x5bb4('0xd')]('UserNotification,\x20%s,\x20%s',_0x4b2d87,'request\x20sent');_0x1d3e8e(_0x442a4b[_0x5bb4('0x14')][_0x5bb4('0x13')]);}})[_0x5bb4('0x15')](function(_0x1dd639){logger['error'](_0x5bb4('0xe'),_0x4b2d87,_0x1dd639);_0x52ca33(_0x1dd639);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0b62d40..a80873e 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 _0xae1c=['length','userNotification:','./userNotification.events','save','remove','update','emit','register'];(function(_0x1d5677,_0x342d27){var _0x274227=function(_0x5ead9c){while(--_0x5ead9c){_0x1d5677['push'](_0x1d5677['shift']());}};_0x274227(++_0x342d27);}(_0xae1c,0x1d2));var _0xcae1=function(_0x2527d7,_0x5b31da){_0x2527d7=_0x2527d7-0x0;var _0x1170bb=_0xae1c[_0x2527d7];return _0x1170bb;};'use strict';var UserNotificationEvents=require(_0xcae1('0x0'));var events=[_0xcae1('0x1'),_0xcae1('0x2'),_0xcae1('0x3')];function createListener(_0x27fe17,_0x1a13fe){return function(_0x4e2d0f){_0x1a13fe[_0xcae1('0x4')](_0x27fe17,_0x4e2d0f);};}function removeListener(_0x6fc5c9,_0x350604){return function(){UserNotificationEvents['removeListener'](_0x6fc5c9,_0x350604);};}exports[_0xcae1('0x5')]=function(_0x4c156f){for(var _0x46a8c1=0x0,_0x20ad0d=events[_0xcae1('0x6')];_0x46a8c1<_0x20ad0d;_0x46a8c1++){var _0x3f6fe1=events[_0x46a8c1];var _0xbc1d9a=createListener(_0xcae1('0x7')+_0x3f6fe1,_0x4c156f);UserNotificationEvents['on'](_0x3f6fe1,_0xbc1d9a);}}; \ No newline at end of file +var _0x7975=['./userNotification.events','save','remove','update','removeListener','register','userNotification:'];(function(_0x41be4d,_0x2d296f){var _0x300831=function(_0x322931){while(--_0x322931){_0x41be4d['push'](_0x41be4d['shift']());}};_0x300831(++_0x2d296f);}(_0x7975,0x19d));var _0x5797=function(_0x1a07f4,_0x5a7810){_0x1a07f4=_0x1a07f4-0x0;var _0x14cb73=_0x7975[_0x1a07f4];return _0x14cb73;};'use strict';var UserNotificationEvents=require(_0x5797('0x0'));var events=[_0x5797('0x1'),_0x5797('0x2'),_0x5797('0x3')];function createListener(_0x4a6cda,_0x4e040e){return function(_0x4b1063){_0x4e040e['emit'](_0x4a6cda,_0x4b1063);};}function removeListener(_0x76a55b,_0x44f96f){return function(){UserNotificationEvents[_0x5797('0x4')](_0x76a55b,_0x44f96f);};}exports[_0x5797('0x5')]=function(_0x2d90cc){for(var _0x491d31=0x0,_0x489ede=events['length'];_0x491d31<_0x489ede;_0x491d31++){var _0x50e862=events[_0x491d31];var _0x2b1b96=createListener(_0x5797('0x6')+_0x50e862,_0x2d90cc);UserNotificationEvents['on'](_0x50e862,_0x2b1b96);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3970818..9c80008 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x187842,_0x58331c){var _0x5dbcf3=function(_0x55faef){while(--_0x55faef){_0x187842['push'](_0x187842['shift']());}};_0x5dbcf3(++_0x58331c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5eff19,_0x4cc7c9){var _0xfd9a30=function(_0x4dc40d){while(--_0x4dc40d){_0x5eff19['push'](_0x5eff19['shift']());}};_0xfd9a30(++_0x4cc7c9);}(_0xedd9,0xfc));var _0x9edd=function(_0x386e88,_0x26ac2e){_0x386e88=_0x386e88-0x0;var _0x2b3208=_0xedd9[_0x386e88];return _0x2b3208;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1198340..c034b6a 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 _0xb8b3=['exports','INTEGER','sequelize'];(function(_0x468c71,_0x157aea){var _0x35e7d6=function(_0xaf846){while(--_0xaf846){_0x468c71['push'](_0x468c71['shift']());}};_0x35e7d6(++_0x157aea);}(_0xb8b3,0x1a0));var _0x3b8b=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0xb8b3[_0x1b6311];return _0x25aab6;};'use strict';var Sequelize=require(_0x3b8b('0x0'));module[_0x3b8b('0x1')]={'penalty':{'type':Sequelize[_0x3b8b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe53e=['INTEGER','sequelize'];(function(_0x310866,_0x44d7b2){var _0x2af246=function(_0x473c0c){while(--_0x473c0c){_0x310866['push'](_0x310866['shift']());}};_0x2af246(++_0x44d7b2);}(_0xe53e,0x11b));var _0xee53=function(_0x311d33,_0x26a41c){_0x311d33=_0x311d33-0x0;var _0x5cd69f=_0xe53e[_0x311d33];return _0x5cd69f;};'use strict';var Sequelize=require(_0xee53('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xee53('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 0eec9c1..55c83b3 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 _0x6602=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define'];(function(_0x3282da,_0x3676e2){var _0x3c11a5=function(_0x1a66ef){while(--_0x1a66ef){_0x3282da['push'](_0x3282da['shift']());}};_0x3c11a5(++_0x3676e2);}(_0x6602,0x10a));var _0x2660=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x6602[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x2660('0x0'));var util=require(_0x2660('0x1'));var logger=require(_0x2660('0x2'))(_0x2660('0x3'));var moment=require('moment');var BPromise=require(_0x2660('0x4'));var rp=require(_0x2660('0x5'));var fs=require('fs');var path=require(_0x2660('0x6'));var rimraf=require(_0x2660('0x7'));var config=require('../../config/environment');var attributes=require(_0x2660('0x8'));module['exports']=function(_0x584233,_0x1085c9){return _0x584233[_0x2660('0x9')](_0x2660('0xa'),attributes,{'tableName':_0x2660('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0293=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x59e2e7,_0x84f335){var _0x3bbe7d=function(_0x1afa75){while(--_0x1afa75){_0x59e2e7['push'](_0x59e2e7['shift']());}};_0x3bbe7d(++_0x84f335);}(_0x0293,0xce));var _0x3029=function(_0x2431bb,_0x5087fd){_0x2431bb=_0x2431bb-0x0;var _0x2c69bf=_0x0293[_0x2431bb];return _0x2c69bf;};'use strict';var _=require(_0x3029('0x0'));var util=require(_0x3029('0x1'));var logger=require(_0x3029('0x2'))(_0x3029('0x3'));var moment=require(_0x3029('0x4'));var BPromise=require(_0x3029('0x5'));var rp=require(_0x3029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3029('0x7'));var config=require(_0x3029('0x8'));var attributes=require(_0x3029('0x9'));module[_0x3029('0xa')]=function(_0x2b6c1c,_0x5b828c){return _0x2b6c1c[_0x3029('0xb')](_0x3029('0xc'),attributes,{'tableName':_0x3029('0xd'),'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 413bb24..f3624e0 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 _0x9978=['client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xff533e,_0x5474d4){var _0x103aae=function(_0x337973){while(--_0x337973){_0xff533e['push'](_0xff533e['shift']());}};_0x103aae(++_0x5474d4);}(_0x9978,0xdd));var _0x8997=function(_0xfc8e9e,_0x1615ff){_0xfc8e9e=_0xfc8e9e-0x0;var _0x29d520=_0x9978[_0xfc8e9e];return _0x29d520;};'use strict';var _=require(_0x8997('0x0'));var util=require(_0x8997('0x1'));var moment=require(_0x8997('0x2'));var BPromise=require(_0x8997('0x3'));var rs=require(_0x8997('0x4'));var fs=require('fs');var Redis=require(_0x8997('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8997('0x6'));var logger=require(_0x8997('0x7'))('rpc');var config=require(_0x8997('0x8'));var jayson=require(_0x8997('0x9'));var client=jayson[_0x8997('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506e56,_0x4571c7,_0x504f5f){return new BPromise(function(_0x28c1c9,_0x5bd1bf){return client['request'](_0x506e56,_0x504f5f)[_0x8997('0xb')](function(_0x25339c){logger[_0x8997('0xc')](_0x8997('0xd'),_0x4571c7,_0x8997('0xe'));logger[_0x8997('0xf')](_0x8997('0x10'),_0x4571c7,_0x8997('0xe'),JSON['stringify'](_0x25339c));if(_0x25339c[_0x8997('0x11')]){if(_0x25339c[_0x8997('0x11')][_0x8997('0x12')]===0x1f4){logger[_0x8997('0x11')](_0x8997('0xd'),_0x4571c7,_0x25339c[_0x8997('0x11')][_0x8997('0x13')]);return _0x5bd1bf(_0x25339c[_0x8997('0x11')][_0x8997('0x13')]);}logger[_0x8997('0x11')](_0x8997('0xd'),_0x4571c7,_0x25339c['error'][_0x8997('0x13')]);return _0x28c1c9(_0x25339c[_0x8997('0x11')][_0x8997('0x13')]);}else{logger[_0x8997('0xc')](_0x8997('0xd'),_0x4571c7,'request\x20sent');_0x28c1c9(_0x25339c[_0x8997('0x14')]['message']);}})['catch'](function(_0x5f4dec){logger[_0x8997('0x11')](_0x8997('0xd'),_0x4571c7,_0x5f4dec);_0x5bd1bf(_0x5f4dec);});});} \ No newline at end of file +var _0xa8f0=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x359377,_0x1a63ef){var _0x8be18a=function(_0x246390){while(--_0x246390){_0x359377['push'](_0x359377['shift']());}};_0x8be18a(++_0x1a63ef);}(_0xa8f0,0x182));var _0x0a8f=function(_0x475aa9,_0x439aab){_0x475aa9=_0x475aa9-0x0;var _0x360bbc=_0xa8f0[_0x475aa9];return _0x360bbc;};'use strict';var _=require('lodash');var util=require(_0x0a8f('0x0'));var moment=require(_0x0a8f('0x1'));var BPromise=require(_0x0a8f('0x2'));var rs=require(_0x0a8f('0x3'));var fs=require('fs');var Redis=require(_0x0a8f('0x4'));var db=require(_0x0a8f('0x5'))['db'];var utils=require(_0x0a8f('0x6'));var logger=require(_0x0a8f('0x7'))(_0x0a8f('0x8'));var config=require(_0x0a8f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0a8f('0xa')][_0x0a8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2af073,_0x4ef815,_0x4ec414){return new BPromise(function(_0xca1c95,_0x302bc7){return client[_0x0a8f('0xc')](_0x2af073,_0x4ec414)[_0x0a8f('0xd')](function(_0x5b20bb){logger['info'](_0x0a8f('0xe'),_0x4ef815,_0x0a8f('0xf'));logger['debug'](_0x0a8f('0x10'),_0x4ef815,_0x0a8f('0xf'),JSON[_0x0a8f('0x11')](_0x5b20bb));if(_0x5b20bb[_0x0a8f('0x12')]){if(_0x5b20bb[_0x0a8f('0x12')][_0x0a8f('0x13')]===0x1f4){logger[_0x0a8f('0x12')](_0x0a8f('0xe'),_0x4ef815,_0x5b20bb[_0x0a8f('0x12')]['message']);return _0x302bc7(_0x5b20bb['error'][_0x0a8f('0x14')]);}logger[_0x0a8f('0x12')](_0x0a8f('0xe'),_0x4ef815,_0x5b20bb[_0x0a8f('0x12')][_0x0a8f('0x14')]);return _0xca1c95(_0x5b20bb[_0x0a8f('0x12')][_0x0a8f('0x14')]);}else{logger[_0x0a8f('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4ef815,'request\x20sent');_0xca1c95(_0x5b20bb[_0x0a8f('0x16')][_0x0a8f('0x14')]);}})[_0x0a8f('0x17')](function(_0x369a68){logger[_0x0a8f('0x12')](_0x0a8f('0xe'),_0x4ef815,_0x369a68);_0x302bc7(_0x369a68);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8e16fdc..04098ba 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 _0x0bd8=['get','/describe','describe','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0x0bd8,0x1c5));var _0x80bd=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x0bd8[_0x4ee881];return _0x305f48;};'use strict';var multer=require(_0x80bd('0x0'));var util=require(_0x80bd('0x1'));var path=require(_0x80bd('0x2'));var timeout=require(_0x80bd('0x3'));var express=require(_0x80bd('0x4'));var router=express['Router']();var fs_extra=require(_0x80bd('0x5'));var auth=require(_0x80bd('0x6'));var interaction=require(_0x80bd('0x7'));var config=require(_0x80bd('0x8'));var controller=require(_0x80bd('0x9'));router['get']('/',auth[_0x80bd('0xa')](),controller[_0x80bd('0xb')]);router[_0x80bd('0xc')](_0x80bd('0xd'),auth['isAuthenticated'](),controller[_0x80bd('0xe')]);router[_0x80bd('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x80bd('0xf'),auth['isAuthenticated'](),controller[_0x80bd('0x10')]);router[_0x80bd('0xc')](_0x80bd('0x11'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x80bd('0xa')](),controller[_0x80bd('0x12')]);router[_0x80bd('0x13')](_0x80bd('0x14'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x15')]);router[_0x80bd('0x13')](_0x80bd('0xf'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x16')]);router[_0x80bd('0x13')](_0x80bd('0x11'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x17')]);router['put'](_0x80bd('0x18'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x19')]);router[_0x80bd('0x1a')](_0x80bd('0x18'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x1b')]);router[_0x80bd('0x1a')]('/:id/sections',auth[_0x80bd('0xa')](),controller[_0x80bd('0x1c')]);router['delete'](_0x80bd('0x11'),auth[_0x80bd('0xa')](),controller[_0x80bd('0x1d')]);module[_0x80bd('0x1e')]=router; \ No newline at end of file +var _0xc692=['addSections','update','destroy','delete','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone'];(function(_0xfdf83b,_0x3212ea){var _0xe77f76=function(_0x5286c7){while(--_0x5286c7){_0xfdf83b['push'](_0xfdf83b['shift']());}};_0xe77f76(++_0x3212ea);}(_0xc692,0x11e));var _0x2c69=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xc692[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var path=require(_0x2c69('0x2'));var timeout=require(_0x2c69('0x3'));var express=require(_0x2c69('0x4'));var router=express[_0x2c69('0x5')]();var fs_extra=require(_0x2c69('0x6'));var auth=require(_0x2c69('0x7'));var interaction=require(_0x2c69('0x8'));var config=require(_0x2c69('0x9'));var controller=require(_0x2c69('0xa'));router[_0x2c69('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c69('0xc')]);router['get'](_0x2c69('0xd'),auth[_0x2c69('0xe')](),controller['describe']);router[_0x2c69('0xb')](_0x2c69('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x2c69('0xb')](_0x2c69('0x10'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x11')]);router[_0x2c69('0xb')](_0x2c69('0x12'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2c69('0x14')](_0x2c69('0x15'),auth[_0x2c69('0xe')](),controller['clone']);router[_0x2c69('0x14')](_0x2c69('0x10'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x16')]);router[_0x2c69('0x14')](_0x2c69('0x12'),auth[_0x2c69('0xe')](),controller['addResources']);router['put'](_0x2c69('0xf'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x17')]);router['delete'](_0x2c69('0xf'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x18')]);router[_0x2c69('0x19')](_0x2c69('0x10'),auth[_0x2c69('0xe')](),controller[_0x2c69('0x1a')]);router[_0x2c69('0x19')](_0x2c69('0x12'),auth['isAuthenticated'](),controller['removeResources']);module[_0x2c69('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c73a1e0..0a9b163 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 _0x5f9b=['join','getDataValue','BOOLEAN','sequelize','STRING','crudPermissions'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x5f9b,0x171));var _0xb5f9=function(_0x4abd58,_0x523c62){_0x4abd58=_0x4abd58-0x0;var _0x3608a8=_0x5f9b[_0x4abd58];return _0x3608a8;};'use strict';var Sequelize=require(_0xb5f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5f9('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xb5f9('0x1')],'set':function(_0x4059a7){this['setDataValue'](_0xb5f9('0x2'),_0x4059a7?_0x4059a7[_0xb5f9('0x3')](''):[]);},'get':function(){return this[_0xb5f9('0x4')]('crudPermissions')?this[_0xb5f9('0x4')](_0xb5f9('0x2'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb5f9('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb5f9('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb5f9('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb5f9('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb5f9('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb5f9('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d67=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0x7d67,0x1e7));var _0x77d6=function(_0xb30002,_0x1207a5){_0xb30002=_0xb30002-0x0;var _0x228a64=_0x7d67[_0xb30002];return _0x228a64;};'use strict';var Sequelize=require(_0x77d6('0x0'));module[_0x77d6('0x1')]={'name':{'type':Sequelize[_0x77d6('0x2')],'allowNull':![],'unique':_0x77d6('0x3')},'crudPermissions':{'type':Sequelize[_0x77d6('0x2')],'set':function(_0x34c63d){this[_0x77d6('0x4')](_0x77d6('0x5'),_0x34c63d?_0x34c63d[_0x77d6('0x6')](''):[]);},'get':function(){return this[_0x77d6('0x7')](_0x77d6('0x5'))?this[_0x77d6('0x7')](_0x77d6('0x5'))[_0x77d6('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x77d6('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1705361..c0ac756 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 _0x5232=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userProfile.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','send','UserProfile','rawAttributes','fieldName','type','key','map','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','UserProfileSection','each','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','transaction','sectionId','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','autoAssociation','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x3bdef4,_0x12617d){var _0x4ad69f=function(_0x130f48){while(--_0x130f48){_0x3bdef4['push'](_0x3bdef4['shift']());}};_0x4ad69f(++_0x12617d);}(_0x5232,0x1c9));var _0x2523=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x5232[_0x149ca0];return _0x56b6b9;};'use strict';var emlformat=require(_0x2523('0x0'));var rimraf=require(_0x2523('0x1'));var zipdir=require(_0x2523('0x2'));var jsonpatch=require(_0x2523('0x3'));var rp=require(_0x2523('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2523('0x5'));var util=require(_0x2523('0x6'));var path=require('path');var sox=require(_0x2523('0x7'));var csv=require(_0x2523('0x8'));var ejs=require(_0x2523('0x9'));var fs=require('fs');var fs_extra=require(_0x2523('0xa'));var _=require(_0x2523('0xb'));var squel=require(_0x2523('0xc'));var crypto=require(_0x2523('0xd'));var jsforce=require(_0x2523('0xe'));var deskjs=require(_0x2523('0xf'));var toCsv=require(_0x2523('0x8'));var querystring=require(_0x2523('0x10'));var Papa=require(_0x2523('0x11'));var Redis=require('ioredis');var authService=require(_0x2523('0x12'));var qs=require(_0x2523('0x13'));var as=require(_0x2523('0x14'));var hardwareService=require(_0x2523('0x15'));var logger=require(_0x2523('0x16'))(_0x2523('0x17'));var utils=require('../../config/utils');var config=require(_0x2523('0x18'));var licenseUtil=require(_0x2523('0x19'));var db=require(_0x2523('0x1a'))['db'];config[_0x2523('0x1b')]=_['defaults'](config[_0x2523('0x1b')],{'host':_0x2523('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2523('0x1b')]));require(_0x2523('0x1d'))[_0x2523('0x1e')](socket);function respondWithStatusCode(_0xc09a01,_0x4bc216){_0x4bc216=_0x4bc216||0xcc;return function(_0x211505){if(_0x211505){return _0xc09a01['sendStatus'](_0x4bc216);}return _0xc09a01[_0x2523('0x1f')](_0x4bc216)[_0x2523('0x20')]();};}function respondWithResult(_0x173218,_0x73e57a){_0x73e57a=_0x73e57a||0xc8;return function(_0x4830e4){if(_0x4830e4){return _0x173218[_0x2523('0x1f')](_0x73e57a)[_0x2523('0x21')](_0x4830e4);}};}function respondWithFilteredResult(_0x108159,_0x367bae){return function(_0x1ce828){if(_0x1ce828){var _0x2f3a96=typeof _0x367bae['offset']===_0x2523('0x22')&&typeof _0x367bae[_0x2523('0x23')]==='undefined';var _0x2819aa=_0x1ce828[_0x2523('0x24')];var _0x3f29f6=_0x2f3a96?0x0:_0x367bae[_0x2523('0x25')];var _0x5744d9=_0x2f3a96?_0x1ce828['count']:_0x367bae['offset']+_0x367bae['limit'];var _0x1d52dc;if(_0x5744d9>=_0x2819aa){_0x5744d9=_0x2819aa;_0x1d52dc=0xc8;}else{_0x1d52dc=0xce;}_0x108159[_0x2523('0x1f')](_0x1d52dc);return _0x108159[_0x2523('0x26')](_0x2523('0x27'),_0x3f29f6+'-'+_0x5744d9+'/'+_0x2819aa)[_0x2523('0x21')](_0x1ce828);}return null;};}function patchUpdates(_0x578a83){return function(_0x577359){try{jsonpatch['apply'](_0x577359,_0x578a83,!![]);}catch(_0x50e34e){return BPromise[_0x2523('0x28')](_0x50e34e);}return _0x577359[_0x2523('0x29')]();};}function saveUpdates(_0x4fc304,_0x5b5043){return function(_0x1df86b){if(_0x1df86b){return _0x1df86b[_0x2523('0x2a')](_0x4fc304)[_0x2523('0x2b')](function(_0x393956){return _0x393956;});}return null;};}function removeEntity(_0xd47858,_0x5495f4){return function(_0x3f3ab1){if(_0x3f3ab1){return _0x3f3ab1[_0x2523('0x2c')]()[_0x2523('0x2b')](function(){_0xd47858[_0x2523('0x1f')](0xcc)[_0x2523('0x20')]();});}};}function handleEntityNotFound(_0x23941b,_0x17b55c){return function(_0x3af962){if(!_0x3af962){_0x23941b[_0x2523('0x2d')](0x194);}return _0x3af962;};}function handleError(_0x4f88ca,_0x1c90f4){_0x1c90f4=_0x1c90f4||0x1f4;return function(_0x1565a8){logger['error'](_0x1565a8[_0x2523('0x2e')]);if(_0x1565a8['name']){delete _0x1565a8['name'];}_0x4f88ca['status'](_0x1c90f4)[_0x2523('0x2f')](_0x1565a8);};}exports['index']=function(_0x3d8862,_0x577c90){var _0x42ea60={},_0xb9cba8={},_0x5ba27c={'count':0x0,'rows':[]};var _0xe78975=_['map'](db[_0x2523('0x30')][_0x2523('0x31')],function(_0x965bb8){return{'name':_0x965bb8[_0x2523('0x32')],'type':_0x965bb8[_0x2523('0x33')][_0x2523('0x34')]};});_0xb9cba8['model']=_[_0x2523('0x35')](_0xe78975,_0x2523('0x36'));_0xb9cba8[_0x2523('0x37')]=_['keys'](_0x3d8862[_0x2523('0x37')]);_0xb9cba8['filters']=_[_0x2523('0x38')](_0xb9cba8[_0x2523('0x39')],_0xb9cba8[_0x2523('0x37')]);_0x42ea60[_0x2523('0x3a')]=_[_0x2523('0x38')](_0xb9cba8[_0x2523('0x39')],qs[_0x2523('0x3b')](_0x3d8862['query'][_0x2523('0x3b')]));_0x42ea60[_0x2523('0x3a')]=_0x42ea60[_0x2523('0x3a')][_0x2523('0x3c')]?_0x42ea60[_0x2523('0x3a')]:_0xb9cba8['model'];if(!_0x3d8862[_0x2523('0x37')][_0x2523('0x3d')](_0x2523('0x3e'))){_0x42ea60[_0x2523('0x23')]=qs['limit'](_0x3d8862[_0x2523('0x37')]['limit']);_0x42ea60[_0x2523('0x25')]=qs['offset'](_0x3d8862[_0x2523('0x37')][_0x2523('0x25')]);}_0x42ea60[_0x2523('0x3f')]=qs[_0x2523('0x40')](_0x3d8862[_0x2523('0x37')][_0x2523('0x40')]);_0x42ea60[_0x2523('0x41')]=qs[_0x2523('0x42')](_['pick'](_0x3d8862[_0x2523('0x37')],_0xb9cba8[_0x2523('0x42')]),_0xe78975);if(_0x3d8862[_0x2523('0x37')][_0x2523('0x43')]){_0x42ea60[_0x2523('0x41')]=_['merge'](_0x42ea60[_0x2523('0x41')],{'$or':_[_0x2523('0x35')](_0xe78975,function(_0x5164c3){if(_0x5164c3['type']!==_0x2523('0x44')){var _0x4aa9ad={};_0x4aa9ad[_0x5164c3[_0x2523('0x36')]]={'$like':'%'+_0x3d8862[_0x2523('0x37')][_0x2523('0x43')]+'%'};return _0x4aa9ad;}})});}_0x42ea60=_[_0x2523('0x45')]({},_0x42ea60,_0x3d8862['options']);var _0x51331d={'where':_0x42ea60[_0x2523('0x41')]};return db[_0x2523('0x30')][_0x2523('0x24')](_0x51331d)[_0x2523('0x2b')](function(_0x14104c){_0x5ba27c['count']=_0x14104c;if(_0x3d8862['query']['includeAll']){_0x42ea60[_0x2523('0x46')]=[{'all':!![]}];}return db[_0x2523('0x30')][_0x2523('0x47')](_0x42ea60);})['then'](function(_0x24e0e1){_0x5ba27c[_0x2523('0x48')]=_0x24e0e1;return _0x5ba27c;})['then'](respondWithFilteredResult(_0x577c90,_0x42ea60))[_0x2523('0x49')](handleError(_0x577c90,null));};exports[_0x2523('0x4a')]=function(_0x4180b1,_0x35cff0){var _0xb8d95e={'raw':![],'where':{'id':_0x4180b1[_0x2523('0x4b')]['id']}},_0x5a02bf={};_0x5a02bf[_0x2523('0x39')]=_[_0x2523('0x4c')](db[_0x2523('0x30')]['rawAttributes']);_0x5a02bf[_0x2523('0x37')]=_[_0x2523('0x4c')](_0x4180b1[_0x2523('0x37')]);_0x5a02bf[_0x2523('0x42')]=_['intersection'](_0x5a02bf['model'],_0x5a02bf[_0x2523('0x37')]);_0xb8d95e['attributes']=_[_0x2523('0x38')](_0x5a02bf[_0x2523('0x39')],qs[_0x2523('0x3b')](_0x4180b1[_0x2523('0x37')][_0x2523('0x3b')]));_0xb8d95e['attributes']=_0xb8d95e[_0x2523('0x3a')][_0x2523('0x3c')]?_0xb8d95e['attributes']:_0x5a02bf[_0x2523('0x39')];if(_0x4180b1[_0x2523('0x37')][_0x2523('0x4d')]){_0xb8d95e['include']=[{'all':!![]}];}_0xb8d95e=_[_0x2523('0x45')]({},_0xb8d95e,_0x4180b1[_0x2523('0x4e')]);return db[_0x2523('0x30')][_0x2523('0x4f')](_0xb8d95e)[_0x2523('0x2b')](handleEntityNotFound(_0x35cff0,null))['then'](respondWithResult(_0x35cff0,null))[_0x2523('0x49')](handleError(_0x35cff0,null));};exports[_0x2523('0x50')]=function(_0x4d0727,_0x569caa){return db['UserProfile']['create'](_0x4d0727[_0x2523('0x51')],{})[_0x2523('0x2b')](respondWithResult(_0x569caa,0xc9))[_0x2523('0x49')](handleError(_0x569caa,null));};exports[_0x2523('0x52')]=function(_0x3e9533,_0x3bb391){var _0x296c44={'where':{'id':_0x3e9533['params']['id']}},_0x5c891a={};_0x5c891a['model']=_[_0x2523('0x4c')](db[_0x2523('0x30')]['rawAttributes']);_0x296c44[_0x2523('0x3a')]=_[_0x2523('0x38')](_0x5c891a[_0x2523('0x39')],qs['fields'](_0x3e9533[_0x2523('0x37')][_0x2523('0x3b')]));_0x296c44[_0x2523('0x3a')]=_0x296c44['attributes']['length']?_0x296c44[_0x2523('0x3a')]:_0x5c891a[_0x2523('0x39')];if(_0x3e9533['query'][_0x2523('0x4d')]){_0x296c44[_0x2523('0x46')]=[{'all':!![]}];}_0x296c44=_[_0x2523('0x45')]({},_0x296c44,_0x3e9533[_0x2523('0x4e')]);return db[_0x2523('0x30')][_0x2523('0x4f')](_0x296c44)[_0x2523('0x2b')](handleEntityNotFound(_0x3bb391,null))[_0x2523('0x2b')](function(_0x27d74d){if(_0x27d74d){var _0x12c163=_0x27d74d[_0x2523('0x53')]({'plain':!![]});_0x12c163=qs[_0x2523('0x54')](_0x12c163,['id',_0x2523('0x55'),_0x2523('0x56'),_0x2523('0x57')]);_0x3e9533['body']=_[_0x2523('0x54')](_0x3e9533['body'],['id',_0x2523('0x55'),_0x2523('0x56')]);return db['sequelize']['transaction'](function(_0x37616d){return db[_0x2523('0x30')]['create'](_[_0x2523('0x45')](_0x12c163,_0x3e9533[_0x2523('0x51')]),{'include':_0x3e9533['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x37616d})[_0x2523('0x2b')](function(_0x570338){var _0x3da34a=_0x570338[_0x2523('0x53')]({'plain':!![]});return db[_0x2523('0x58')][_0x2523('0x47')]({'where':{'userProfileId':_0x3e9533[_0x2523('0x4b')]['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x5a5119){if(_0x5a5119){return BPromise[_0x2523('0x59')](_0x5a5119,function(_0x4136f0){return new BPromise(function(_0x4f1dad,_0x463709){if(_0x4136f0['autoAssociation']===null||_0x4136f0['autoAssociation']===0x1)_0x4f1dad(null);return db[_0x2523('0x5a')]['findAll']({'where':{'sectionId':_0x4136f0['id']},'raw':!![]})['then'](function(_0x30a910){var _0x43de6f=_[_0x2523('0x35')](_0x30a910,function(_0xc32bf3){return qs[_0x2523('0x54')](_0xc32bf3,['id',_0x2523('0x55'),_0x2523('0x56'),'sectionId']);});_0x4f1dad(_0x43de6f);})['catch'](function(_0x26c881){_0x463709(_0x26c881);});})[_0x2523('0x2b')](function(_0x3bcdf6){var _0x595cd5=qs[_0x2523('0x54')](_0x4136f0,['id',_0x2523('0x55'),'updatedAt']);_0x595cd5[_0x2523('0x5b')]=_0x3da34a['id'];if(_0x3bcdf6)_0x595cd5[_0x2523('0x5c')]=_0x3bcdf6;return _0x595cd5;})[_0x2523('0x2b')](function(_0x29dfd2){return db['UserProfileSection'][_0x2523('0x50')](_0x29dfd2,{'include':[{'model':db[_0x2523('0x5a')],'as':_0x2523('0x5c')}],'raw':!![],'transaction':_0x37616d});});})[_0x2523('0x2b')](function(){return _0x3da34a;});}});});});}})[_0x2523('0x2b')](respondWithResult(_0x3bb391,0xc9))[_0x2523('0x49')](handleError(_0x3bb391,null));};exports[_0x2523('0x2a')]=function(_0x2af3d2,_0x47078a){if(_0x2af3d2[_0x2523('0x51')]['id']){delete _0x2af3d2[_0x2523('0x51')]['id'];}return db[_0x2523('0x30')][_0x2523('0x4f')]({'where':{'id':_0x2af3d2[_0x2523('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47078a,null))[_0x2523('0x2b')](saveUpdates(_0x2af3d2[_0x2523('0x51')],null))[_0x2523('0x2b')](respondWithResult(_0x47078a,null))[_0x2523('0x49')](handleError(_0x47078a,null));};exports[_0x2523('0x2c')]=function(_0x3c6306,_0x5f19f6){return db[_0x2523('0x30')]['find']({'where':{'id':_0x3c6306[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x5f19f6,null))[_0x2523('0x2b')](removeEntity(_0x5f19f6,null))['catch'](handleError(_0x5f19f6,null));};exports[_0x2523('0x5d')]=function(_0x42a76a,_0x1daf51){return db[_0x2523('0x30')][_0x2523('0x5d')]()[_0x2523('0x2b')](respondWithResult(_0x1daf51,null))[_0x2523('0x49')](handleError(_0x1daf51,null));};exports[_0x2523('0x5e')]=function(_0x44706e,_0x451e00){var _0x3a54ac=_0x44706e['body'];return db[_0x2523('0x30')]['find']({'where':{'id':_0x44706e[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x451e00,null))[_0x2523('0x2b')](function(_0xcc1b79){if(_0xcc1b79){return db[_0x2523('0x5f')][_0x2523('0x60')](function(_0x53e6d8){return db[_0x2523('0x58')][_0x2523('0x2c')]({'where':{'userProfileId':_0x44706e[_0x2523('0x4b')]['id'],'sectionId':_[_0x2523('0x35')](_0x3a54ac,function(_0x5d8178){return _0x5d8178[_0x2523('0x61')];})},'transaction':_0x53e6d8})[_0x2523('0x2b')](function(){var _0x5090f2=_[_0x2523('0x35')](_0x3a54ac,function(_0x4f56cf){_0x4f56cf['userProfileId']=_0x44706e['params']['id'];return _0x4f56cf;});var _0x5bba49=[];return BPromise[_0x2523('0x59')](_0x5090f2,function(_0x573bb5){return db[_0x2523('0x58')][_0x2523('0x50')](_0x573bb5,{'include':[{'model':db[_0x2523('0x5a')],'as':_0x2523('0x5c')}],'raw':!![],'transaction':_0x53e6d8})[_0x2523('0x2b')](function(_0x1c1e75){_0x5bba49['push'](_0x1c1e75['get']({'plain':!![]}));});})[_0x2523('0x2b')](function(){return _0x5bba49;});});});}})[_0x2523('0x2b')](function(_0x174559){return _0x174559;})['then'](respondWithResult(_0x451e00,null))['catch'](handleError(_0x451e00,null));};exports[_0x2523('0x62')]=function(_0x6be76b,_0x33cf70){var _0x2617f1;return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0x6be76b[_0x2523('0x4b')]['id']},'attributes':['id',_0x2523('0x36')]})['then'](handleEntityNotFound(_0x33cf70,null))[_0x2523('0x2b')](function(_0x1ac011){if(_0x1ac011){_0x2617f1=_0x1ac011;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x6be76b[_0x2523('0x4b')]['id'],'sectionId':_0x6be76b[_0x2523('0x37')][_0x2523('0x63')]}});}})[_0x2523('0x2b')](function(){return _0x2617f1;})['then'](respondWithStatusCode(_0x33cf70,null))[_0x2523('0x49')](handleError(_0x33cf70,null));};exports[_0x2523('0x64')]=function(_0x3c11a1,_0x1fecc0){var _0x29750c=[];var _0x505cb6=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3c11a1[_0x2523('0x4b')]['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x334b5c){_0x29750c=_['filter'](_0x334b5c,function(_0x3da450){return _0x3da450[_0x2523('0x65')]===0x1||_[_0x2523('0x66')]([0x3eb,0x709],_0x3da450[_0x2523('0x61')]);});if(!_[_0x2523('0x67')](_0x29750c)){return _['map'](_0x29750c,function(_0x47e5ce){return _0x47e5ce[_0x2523('0x61')];});}else{return;}})['then'](function(_0x4e358d){if(_0x4e358d)_0x505cb6=_0x4e358d;if(_[_0x2523('0x66')](_0x505cb6,0x64)){var _0x2e1dff=_[_0x2523('0x4f')](_0x29750c,{'sectionId':0x64});return hasDefaultDashboard(_0x2e1dff)['then'](function(_0x458993){return _[_0x2523('0x35')](_0x29750c,function(_0x2ede82){if(_0x2ede82[_0x2523('0x61')]===0x64){_0x2ede82[_0x2523('0x68')]=_0x458993;}return _0x2ede82;});});}else{return;}})[_0x2523('0x2b')](function(_0x50d724){if(_0x50d724)_0x29750c=_0x50d724;if(_[_0x2523('0x66')](_0x505cb6,0x3eb)){var _0x4d8233=_[_0x2523('0x4f')](_0x29750c,{'sectionId':0x3eb});return getCustomDashboards(_0x4d8233)[_0x2523('0x2b')](function(_0x4489a8){return _[_0x2523('0x35')](_0x29750c,function(_0x49a9a0){if(_0x4d8233[_0x2523('0x65')]){if(_0x49a9a0['sectionId']===0x3eb){_0x49a9a0[_0x2523('0x68')]=_0x4489a8;}}else{if(_0x49a9a0[_0x2523('0x61')]===0x64){_0x49a9a0[_0x2523('0x68')]=_0x4489a8;}}return _0x49a9a0;});});}else{return;}})[_0x2523('0x2b')](function(_0x3ce53f){if(_0x3ce53f)_0x29750c=_0x3ce53f;if(_[_0x2523('0x66')](_0x505cb6,0x709)){var _0x18bdb2=_['find'](_0x29750c,{'sectionId':0x709});return getPlugins(_0x18bdb2)[_0x2523('0x2b')](function(_0x3c12fa){if(_0x18bdb2['enabled']){return _[_0x2523('0x35')](_0x29750c,function(_0x29ff8e){if(_0x29ff8e['sectionId']===0x709){_0x29ff8e[_0x2523('0x68')]=_0x3c12fa;}return _0x29ff8e;});}else{var _0x2b218b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c12fa};var _0x2b5c64=_[_0x2523('0x35')](_0x29750c);_0x2b5c64[_0x2523('0x69')](_0x2b218b);return _0x2b5c64;}});}else{return;}})[_0x2523('0x2b')](function(_0x3f3af9){if(_0x3f3af9)_0x29750c=_0x3f3af9;return _[_0x2523('0x43')](_0x29750c,[_0x2523('0x65'),0x1]);})[_0x2523('0x2b')](respondWithResult(_0x1fecc0,null))[_0x2523('0x49')](handleError(_0x1fecc0,null));};function hasDefaultDashboard(_0x5f412a){var _0x28f53e=[0x65];return new BPromise(function(_0x4168ae,_0x57e29c){try{if(_0x5f412a['autoAssociation']){_0x4168ae(_0x28f53e);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x5f412a['id']},'raw':!![]})[_0x2523('0x2b')](function(_0xd275c8){_0xd275c8?_0x4168ae(_0x28f53e):_0x4168ae();});}}catch(_0x13af4b){_0x57e29c(_0x13af4b);}});}function getCustomDashboards(_0x369752){var _0x12f8b3=[];return new BPromise(function(_0x5b889b,_0x197f9e){try{if(_0x369752[_0x2523('0x6a')]){return db[_0x2523('0x6b')][_0x2523('0x47')]({'raw':!![]})[_0x2523('0x2b')](function(_0x3675d8){_0x3675d8[_0x2523('0x6c')](function(_0x10ede3){_0x12f8b3[_0x2523('0x69')](_0x10ede3['id']+0x1869f);});_0x5b889b(_0x12f8b3);});}else{return db[_0x2523('0x5a')][_0x2523('0x47')]({'where':{'sectionId':_0x369752['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x34be38){_0x34be38[_0x2523('0x6c')](function(_0x787029){_0x12f8b3[_0x2523('0x69')](_0x787029[_0x2523('0x6d')]+0x1869f);});_0x5b889b(_0x12f8b3);});}}catch(_0x2fc802){_0x197f9e(_0x2fc802);}});}function getPlugins(_0x162a4b){var _0x3af278=[];return new BPromise(function(_0x4c804f,_0x99f6e7){try{if(_0x162a4b[_0x2523('0x6a')]){return db[_0x2523('0x6e')][_0x2523('0x47')]({'raw':!![]})['then'](function(_0x2295dd){_0x2295dd['forEach'](function(_0x5a76cc){_0x3af278['push'](_0x5a76cc['id']+0x15b38);});_0x4c804f(_0x3af278);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x162a4b['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x5f49a5){_0x5f49a5['forEach'](function(_0x405d63){_0x3af278[_0x2523('0x69')](_0x405d63['resourceId']+0x15b38);});_0x4c804f(_0x3af278);});}}catch(_0x4c3a84){_0x99f6e7(_0x4c3a84);}});}exports[_0x2523('0x6f')]=function(_0xc74259,_0x33b23a){return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0xc74259[_0x2523('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33b23a,null))[_0x2523('0x2b')](function(_0x5b96a0){if(_0x5b96a0){return db['sequelize'][_0x2523('0x60')](function(_0x148633){return db[_0x2523('0x58')]['findAll']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x2523('0x2b')](function(_0x5d50c9){if(_0x5d50c9){return db[_0x2523('0x58')]['destroy']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id'],'id':_[_0x2523('0x35')](_0x5d50c9,function(_0x1de812){return _0x1de812['id'];})},'transaction':_0x148633});}})[_0x2523('0x2b')](function(_0x519a9d){var _0x24e346=_['map'](_0xc74259[_0x2523('0x51')],function(_0x46efbe){_0x46efbe[_0x2523('0x5b')]=_0xc74259[_0x2523('0x4b')]['id'];return _0x46efbe;});return db[_0x2523('0x58')]['bulkCreate'](_0x24e346,{'raw':!![],'transaction':_0x148633});})[_0x2523('0x2b')](function(_0x25cb9b){var _0x64c848=_['filter'](_[_0x2523('0x35')](_0x25cb9b,function(_0x2dff11){return _0x2dff11[_0x2523('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x64c848){return db[_0x2523('0x58')]['findAll']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id'],'sectionId':_['map'](_0x64c848,function(_0x2c3abd){return _0x2c3abd[_0x2523('0x61')];})},'attributes':['id',_0x2523('0x61')],'raw':!![]})[_0x2523('0x2b')](function(_0x578f11){var _0x2b4868=_[_0x2523('0x35')](_0xc74259['body'],function(_0x577df9){_0x577df9[_0x2523('0x5b')]=_0xc74259[_0x2523('0x4b')]['id'];return _0x577df9;});return db[_0x2523('0x5a')][_0x2523('0x70')](_0x2b4868,{'raw':!![],'transaction':_0x148633});});}})['catch'](handleError(_0x33b23a,null));});}})['then'](function(_0x589fae){var _0x534e2d=_[_0x2523('0x35')](_0x589fae,function(_0x357938){return _0x357938['get']({'plain':!![]});});})[_0x2523('0x2b')](respondWithResult(_0x33b23a,null))[_0x2523('0x49')](handleError(_0x33b23a,null));};exports[_0x2523('0x71')]=function(_0x57e874,_0x458254,_0xa1d53){return db[_0x2523('0x30')][_0x2523('0x4f')]({'where':{'id':_0x57e874[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x458254,null))[_0x2523('0x2b')](function(_0x2d3222){if(_0x2d3222){return _0x2d3222[_0x2523('0x71')](_0x57e874[_0x2523('0x37')]['ids']);}})[_0x2523('0x2b')](respondWithStatusCode(_0x458254,null))[_0x2523('0x49')](handleError(_0x458254,null));};exports['getResources']=function(_0x4382d2,_0x8b9b6a){var _0x4454e6={};if(!_0x4382d2[_0x2523('0x37')]['section'])throw new Error(_0x2523('0x72'));if(!_0x4382d2['query'][_0x2523('0x3d')](_0x2523('0x3e'))){_0x4454e6[_0x2523('0x23')]=qs[_0x2523('0x23')](_0x4382d2[_0x2523('0x37')]['limit']);_0x4454e6[_0x2523('0x25')]=qs[_0x2523('0x25')](_0x4382d2[_0x2523('0x37')]['offset']);}return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0x4382d2[_0x2523('0x4b')]['id']}})['then'](function(_0x2a52dc){if(!_0x2a52dc)throw new Error(_0x2523('0x73')+_0x4382d2[_0x2523('0x4b')]['id']);return db[_0x2523('0x30')][_0x2523('0x74')](_0x4382d2);})['then'](respondWithFilteredResult(_0x8b9b6a,_0x4454e6))[_0x2523('0x49')](handleError(_0x8b9b6a,null));}; \ No newline at end of file +var _0xdb28=['each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xdb28,0x106));var _0x8db2=function(_0x49c129,_0x4736dd){_0x49c129=_0x49c129-0x0;var _0x382c81=_0xdb28[_0x49c129];return _0x382c81;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];config[_0x8db2('0x19')]=_[_0x8db2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x1b'))(new Redis(config[_0x8db2('0x19')]));require(_0x8db2('0x1c'))[_0x8db2('0x1d')](socket);function respondWithStatusCode(_0x227355,_0xfa285b){_0xfa285b=_0xfa285b||0xcc;return function(_0x2f177a){if(_0x2f177a){return _0x227355[_0x8db2('0x1e')](_0xfa285b);}return _0x227355[_0x8db2('0x1f')](_0xfa285b)[_0x8db2('0x20')]();};}function respondWithResult(_0x5489a9,_0x13b0f5){_0x13b0f5=_0x13b0f5||0xc8;return function(_0x24da1b){if(_0x24da1b){return _0x5489a9['status'](_0x13b0f5)[_0x8db2('0x21')](_0x24da1b);}};}function respondWithFilteredResult(_0x44957d,_0x21db8c){return function(_0x3fddc2){if(_0x3fddc2){var _0x2efd06=typeof _0x21db8c[_0x8db2('0x22')]==='undefined'&&typeof _0x21db8c['limit']===_0x8db2('0x23');var _0x104e33=_0x3fddc2[_0x8db2('0x24')];var _0x1b64e4=_0x2efd06?0x0:_0x21db8c['offset'];var _0x431d60=_0x2efd06?_0x3fddc2[_0x8db2('0x24')]:_0x21db8c[_0x8db2('0x22')]+_0x21db8c[_0x8db2('0x25')];var _0x3dbe8e;if(_0x431d60>=_0x104e33){_0x431d60=_0x104e33;_0x3dbe8e=0xc8;}else{_0x3dbe8e=0xce;}_0x44957d['status'](_0x3dbe8e);return _0x44957d[_0x8db2('0x26')](_0x8db2('0x27'),_0x1b64e4+'-'+_0x431d60+'/'+_0x104e33)[_0x8db2('0x21')](_0x3fddc2);}return null;};}function patchUpdates(_0x125be2){return function(_0x2260d8){try{jsonpatch[_0x8db2('0x28')](_0x2260d8,_0x125be2,!![]);}catch(_0x796ec1){return BPromise['reject'](_0x796ec1);}return _0x2260d8[_0x8db2('0x29')]();};}function saveUpdates(_0x4f6516,_0x5725f0){return function(_0x52a9ca){if(_0x52a9ca){return _0x52a9ca['update'](_0x4f6516)[_0x8db2('0x2a')](function(_0x29b5cd){return _0x29b5cd;});}return null;};}function removeEntity(_0x3be281,_0x2baed0){return function(_0x145328){if(_0x145328){return _0x145328[_0x8db2('0x2b')]()['then'](function(){_0x3be281[_0x8db2('0x1f')](0xcc)[_0x8db2('0x20')]();});}};}function handleEntityNotFound(_0x430dd5,_0x8b7cec){return function(_0x483aee){if(!_0x483aee){_0x430dd5[_0x8db2('0x1e')](0x194);}return _0x483aee;};}function handleError(_0x11f398,_0x241baf){_0x241baf=_0x241baf||0x1f4;return function(_0x1687ed){logger[_0x8db2('0x2c')](_0x1687ed[_0x8db2('0x2d')]);if(_0x1687ed[_0x8db2('0x2e')]){delete _0x1687ed[_0x8db2('0x2e')];}_0x11f398[_0x8db2('0x1f')](_0x241baf)['send'](_0x1687ed);};}exports[_0x8db2('0x2f')]=function(_0x50b28d,_0x59cb77){var _0x302188={},_0x25ed2c={},_0xcc8a66={'count':0x0,'rows':[]};var _0x49b2b3=_[_0x8db2('0x30')](db['UserProfile'][_0x8db2('0x31')],function(_0x2b653b){return{'name':_0x2b653b[_0x8db2('0x32')],'type':_0x2b653b['type']['key']};});_0x25ed2c[_0x8db2('0x33')]=_[_0x8db2('0x30')](_0x49b2b3,'name');_0x25ed2c['query']=_[_0x8db2('0x34')](_0x50b28d[_0x8db2('0x35')]);_0x25ed2c[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x25ed2c[_0x8db2('0x33')],_0x25ed2c[_0x8db2('0x35')]);_0x302188[_0x8db2('0x38')]=_[_0x8db2('0x37')](_0x25ed2c[_0x8db2('0x33')],qs[_0x8db2('0x39')](_0x50b28d['query'][_0x8db2('0x39')]));_0x302188[_0x8db2('0x38')]=_0x302188['attributes'][_0x8db2('0x3a')]?_0x302188[_0x8db2('0x38')]:_0x25ed2c['model'];if(!_0x50b28d['query'][_0x8db2('0x3b')]('nolimit')){_0x302188[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x50b28d[_0x8db2('0x35')][_0x8db2('0x25')]);_0x302188['offset']=qs[_0x8db2('0x22')](_0x50b28d['query'][_0x8db2('0x22')]);}_0x302188[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x50b28d[_0x8db2('0x35')]['sort']);_0x302188['where']=qs[_0x8db2('0x36')](_[_0x8db2('0x3e')](_0x50b28d['query'],_0x25ed2c[_0x8db2('0x36')]),_0x49b2b3);if(_0x50b28d[_0x8db2('0x35')][_0x8db2('0x3f')]){_0x302188['where']=_[_0x8db2('0x40')](_0x302188[_0x8db2('0x41')],{'$or':_[_0x8db2('0x30')](_0x49b2b3,function(_0x279e74){if(_0x279e74[_0x8db2('0x42')]!==_0x8db2('0x43')){var _0x380046={};_0x380046[_0x279e74[_0x8db2('0x2e')]]={'$like':'%'+_0x50b28d[_0x8db2('0x35')][_0x8db2('0x3f')]+'%'};return _0x380046;}})});}_0x302188=_[_0x8db2('0x40')]({},_0x302188,_0x50b28d[_0x8db2('0x44')]);var _0x1d9025={'where':_0x302188['where']};return db[_0x8db2('0x45')][_0x8db2('0x24')](_0x1d9025)['then'](function(_0x49a7ae){_0xcc8a66[_0x8db2('0x24')]=_0x49a7ae;if(_0x50b28d['query'][_0x8db2('0x46')]){_0x302188[_0x8db2('0x47')]=[{'all':!![]}];}return db[_0x8db2('0x45')][_0x8db2('0x48')](_0x302188);})[_0x8db2('0x2a')](function(_0x30d606){_0xcc8a66[_0x8db2('0x49')]=_0x30d606;return _0xcc8a66;})['then'](respondWithFilteredResult(_0x59cb77,_0x302188))[_0x8db2('0x4a')](handleError(_0x59cb77,null));};exports[_0x8db2('0x4b')]=function(_0x40c69e,_0x4a0b56){var _0x482b26={'raw':![],'where':{'id':_0x40c69e[_0x8db2('0x4c')]['id']}},_0x424c27={};_0x424c27[_0x8db2('0x33')]=_[_0x8db2('0x34')](db['UserProfile'][_0x8db2('0x31')]);_0x424c27['query']=_[_0x8db2('0x34')](_0x40c69e[_0x8db2('0x35')]);_0x424c27[_0x8db2('0x36')]=_['intersection'](_0x424c27['model'],_0x424c27[_0x8db2('0x35')]);_0x482b26['attributes']=_[_0x8db2('0x37')](_0x424c27[_0x8db2('0x33')],qs[_0x8db2('0x39')](_0x40c69e[_0x8db2('0x35')][_0x8db2('0x39')]));_0x482b26[_0x8db2('0x38')]=_0x482b26[_0x8db2('0x38')][_0x8db2('0x3a')]?_0x482b26[_0x8db2('0x38')]:_0x424c27[_0x8db2('0x33')];if(_0x40c69e[_0x8db2('0x35')][_0x8db2('0x46')]){_0x482b26['include']=[{'all':!![]}];}_0x482b26=_[_0x8db2('0x40')]({},_0x482b26,_0x40c69e[_0x8db2('0x44')]);return db[_0x8db2('0x45')][_0x8db2('0x4d')](_0x482b26)['then'](handleEntityNotFound(_0x4a0b56,null))['then'](respondWithResult(_0x4a0b56,null))[_0x8db2('0x4a')](handleError(_0x4a0b56,null));};exports[_0x8db2('0x4e')]=function(_0x164020,_0x4c66e5){return db['UserProfile']['create'](_0x164020[_0x8db2('0x4f')],{})[_0x8db2('0x2a')](respondWithResult(_0x4c66e5,0xc9))[_0x8db2('0x4a')](handleError(_0x4c66e5,null));};exports[_0x8db2('0x50')]=function(_0xaab731,_0x4195ef){var _0x2fa118={'where':{'id':_0xaab731['params']['id']}},_0x511718={};_0x511718[_0x8db2('0x33')]=_[_0x8db2('0x34')](db[_0x8db2('0x45')][_0x8db2('0x31')]);_0x2fa118[_0x8db2('0x38')]=_[_0x8db2('0x37')](_0x511718[_0x8db2('0x33')],qs[_0x8db2('0x39')](_0xaab731[_0x8db2('0x35')][_0x8db2('0x39')]));_0x2fa118[_0x8db2('0x38')]=_0x2fa118[_0x8db2('0x38')][_0x8db2('0x3a')]?_0x2fa118[_0x8db2('0x38')]:_0x511718[_0x8db2('0x33')];if(_0xaab731['query'][_0x8db2('0x46')]){_0x2fa118[_0x8db2('0x47')]=[{'all':!![]}];}_0x2fa118=_['merge']({},_0x2fa118,_0xaab731[_0x8db2('0x44')]);return db[_0x8db2('0x45')][_0x8db2('0x4d')](_0x2fa118)['then'](handleEntityNotFound(_0x4195ef,null))[_0x8db2('0x2a')](function(_0x27acd2){if(_0x27acd2){var _0x1872fa=_0x27acd2[_0x8db2('0x51')]({'plain':!![]});_0x1872fa=qs[_0x8db2('0x52')](_0x1872fa,['id','createdAt',_0x8db2('0x53'),_0x8db2('0x54')]);_0xaab731[_0x8db2('0x4f')]=_['omit'](_0xaab731[_0x8db2('0x4f')],['id',_0x8db2('0x55'),_0x8db2('0x53')]);return db[_0x8db2('0x56')][_0x8db2('0x57')](function(_0x16d897){return db[_0x8db2('0x45')]['create'](_[_0x8db2('0x40')](_0x1872fa,_0xaab731[_0x8db2('0x4f')]),{'include':_0xaab731['query'][_0x8db2('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x16d897})[_0x8db2('0x2a')](function(_0x533e41){var _0x107bbe=_0x533e41[_0x8db2('0x51')]({'plain':!![]});return db[_0x8db2('0x58')][_0x8db2('0x48')]({'where':{'userProfileId':_0xaab731[_0x8db2('0x4c')]['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0x10f267){if(_0x10f267){return BPromise[_0x8db2('0x59')](_0x10f267,function(_0x120ef2){return new BPromise(function(_0x173a5e,_0x12fd12){if(_0x120ef2[_0x8db2('0x5a')]===null||_0x120ef2[_0x8db2('0x5a')]===0x1)_0x173a5e(null);return db[_0x8db2('0x5b')][_0x8db2('0x48')]({'where':{'sectionId':_0x120ef2['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0x4a20a7){var _0xe0c3e=_[_0x8db2('0x30')](_0x4a20a7,function(_0x44118a){return qs[_0x8db2('0x52')](_0x44118a,['id',_0x8db2('0x55'),'updatedAt',_0x8db2('0x5c')]);});_0x173a5e(_0xe0c3e);})[_0x8db2('0x4a')](function(_0x3ab670){_0x12fd12(_0x3ab670);});})[_0x8db2('0x2a')](function(_0x2ad70f){var _0x348da8=qs[_0x8db2('0x52')](_0x120ef2,['id',_0x8db2('0x55'),_0x8db2('0x53')]);_0x348da8[_0x8db2('0x5d')]=_0x107bbe['id'];if(_0x2ad70f)_0x348da8[_0x8db2('0x5e')]=_0x2ad70f;return _0x348da8;})[_0x8db2('0x2a')](function(_0x170a72){return db[_0x8db2('0x58')][_0x8db2('0x4e')](_0x170a72,{'include':[{'model':db[_0x8db2('0x5b')],'as':_0x8db2('0x5e')}],'raw':!![],'transaction':_0x16d897});});})[_0x8db2('0x2a')](function(){return _0x107bbe;});}});});});}})['then'](respondWithResult(_0x4195ef,0xc9))[_0x8db2('0x4a')](handleError(_0x4195ef,null));};exports['update']=function(_0x364176,_0x570c53){if(_0x364176[_0x8db2('0x4f')]['id']){delete _0x364176[_0x8db2('0x4f')]['id'];}return db[_0x8db2('0x45')][_0x8db2('0x4d')]({'where':{'id':_0x364176[_0x8db2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x570c53,null))['then'](saveUpdates(_0x364176[_0x8db2('0x4f')],null))[_0x8db2('0x2a')](respondWithResult(_0x570c53,null))[_0x8db2('0x4a')](handleError(_0x570c53,null));};exports[_0x8db2('0x2b')]=function(_0x20b49c,_0x1f28d2){return db[_0x8db2('0x45')][_0x8db2('0x4d')]({'where':{'id':_0x20b49c['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x1f28d2,null))[_0x8db2('0x2a')](removeEntity(_0x1f28d2,null))[_0x8db2('0x4a')](handleError(_0x1f28d2,null));};exports[_0x8db2('0x5f')]=function(_0x250150,_0x382c75){return db[_0x8db2('0x45')][_0x8db2('0x5f')]()['then'](respondWithResult(_0x382c75,null))['catch'](handleError(_0x382c75,null));};exports[_0x8db2('0x60')]=function(_0x2f8beb,_0x1d2dfc){var _0x27f4cd=_0x2f8beb[_0x8db2('0x4f')];return db['UserProfile']['find']({'where':{'id':_0x2f8beb[_0x8db2('0x4c')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x1d2dfc,null))['then'](function(_0xa698bd){if(_0xa698bd){return db[_0x8db2('0x56')][_0x8db2('0x57')](function(_0x5093e8){return db[_0x8db2('0x58')][_0x8db2('0x2b')]({'where':{'userProfileId':_0x2f8beb[_0x8db2('0x4c')]['id'],'sectionId':_['map'](_0x27f4cd,function(_0x3ff023){return _0x3ff023[_0x8db2('0x5c')];})},'transaction':_0x5093e8})[_0x8db2('0x2a')](function(){var _0x98f91b=_[_0x8db2('0x30')](_0x27f4cd,function(_0x5923b3){_0x5923b3[_0x8db2('0x5d')]=_0x2f8beb[_0x8db2('0x4c')]['id'];return _0x5923b3;});var _0x150439=[];return BPromise['each'](_0x98f91b,function(_0x59e740){return db[_0x8db2('0x58')][_0x8db2('0x4e')](_0x59e740,{'include':[{'model':db['UserProfileResource'],'as':_0x8db2('0x5e')}],'raw':!![],'transaction':_0x5093e8})[_0x8db2('0x2a')](function(_0x199687){_0x150439[_0x8db2('0x61')](_0x199687[_0x8db2('0x51')]({'plain':!![]}));});})[_0x8db2('0x2a')](function(){return _0x150439;});});});}})[_0x8db2('0x2a')](function(_0x3349f1){return _0x3349f1;})[_0x8db2('0x2a')](respondWithResult(_0x1d2dfc,null))[_0x8db2('0x4a')](handleError(_0x1d2dfc,null));};exports[_0x8db2('0x62')]=function(_0x3e1478,_0x24a52d){var _0x5f2aa6;return db[_0x8db2('0x45')]['find']({'where':{'id':_0x3e1478[_0x8db2('0x4c')]['id']},'attributes':['id',_0x8db2('0x2e')]})['then'](handleEntityNotFound(_0x24a52d,null))[_0x8db2('0x2a')](function(_0x2fa89d){if(_0x2fa89d){_0x5f2aa6=_0x2fa89d;return db['UserProfileSection'][_0x8db2('0x2b')]({'where':{'userProfileId':_0x3e1478[_0x8db2('0x4c')]['id'],'sectionId':_0x3e1478[_0x8db2('0x35')][_0x8db2('0x63')]}});}})[_0x8db2('0x2a')](function(){return _0x5f2aa6;})[_0x8db2('0x2a')](respondWithStatusCode(_0x24a52d,null))[_0x8db2('0x4a')](handleError(_0x24a52d,null));};exports[_0x8db2('0x64')]=function(_0x1afd36,_0x5dd92b){var _0x4f9fbd=[];var _0x198c3b=[];return db['UserProfileSection'][_0x8db2('0x48')]({'where':{'userProfileId':_0x1afd36[_0x8db2('0x4c')]['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0x58479c){_0x4f9fbd=_[_0x8db2('0x3f')](_0x58479c,function(_0x9675c1){return _0x9675c1[_0x8db2('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x9675c1[_0x8db2('0x5c')]);});if(!_[_0x8db2('0x66')](_0x4f9fbd)){return _[_0x8db2('0x30')](_0x4f9fbd,function(_0x432413){return _0x432413['sectionId'];});}else{return;}})[_0x8db2('0x2a')](function(_0x5f61b8){if(_0x5f61b8)_0x198c3b=_0x5f61b8;if(_[_0x8db2('0x67')](_0x198c3b,0x64)){var _0x1edb1a=_[_0x8db2('0x4d')](_0x4f9fbd,{'sectionId':0x64});return hasDefaultDashboard(_0x1edb1a)[_0x8db2('0x2a')](function(_0x1aadfb){return _[_0x8db2('0x30')](_0x4f9fbd,function(_0x358f48){if(_0x358f48[_0x8db2('0x5c')]===0x64){_0x358f48[_0x8db2('0x68')]=_0x1aadfb;}return _0x358f48;});});}else{return;}})['then'](function(_0x2450fb){if(_0x2450fb)_0x4f9fbd=_0x2450fb;if(_[_0x8db2('0x67')](_0x198c3b,0x3eb)){var _0x377fb4=_['find'](_0x4f9fbd,{'sectionId':0x3eb});return getCustomDashboards(_0x377fb4)['then'](function(_0x556666){return _[_0x8db2('0x30')](_0x4f9fbd,function(_0xdba223){if(_0x377fb4[_0x8db2('0x65')]){if(_0xdba223[_0x8db2('0x5c')]===0x3eb){_0xdba223[_0x8db2('0x68')]=_0x556666;}}else{if(_0xdba223[_0x8db2('0x5c')]===0x64){_0xdba223[_0x8db2('0x68')]=_0x556666;}}return _0xdba223;});});}else{return;}})[_0x8db2('0x2a')](function(_0x3b1929){if(_0x3b1929)_0x4f9fbd=_0x3b1929;if(_[_0x8db2('0x67')](_0x198c3b,0x709)){var _0x46eb80=_['find'](_0x4f9fbd,{'sectionId':0x709});return getPlugins(_0x46eb80)[_0x8db2('0x2a')](function(_0xa2e293){if(_0x46eb80[_0x8db2('0x65')]){return _[_0x8db2('0x30')](_0x4f9fbd,function(_0x49341c){if(_0x49341c['sectionId']===0x709){_0x49341c[_0x8db2('0x68')]=_0xa2e293;}return _0x49341c;});}else{var _0x3c3f3e={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa2e293};var _0x4a89e7=_[_0x8db2('0x30')](_0x4f9fbd);_0x4a89e7[_0x8db2('0x61')](_0x3c3f3e);return _0x4a89e7;}});}else{return;}})[_0x8db2('0x2a')](function(_0x5f2ece){if(_0x5f2ece)_0x4f9fbd=_0x5f2ece;return _['filter'](_0x4f9fbd,['enabled',0x1]);})[_0x8db2('0x2a')](respondWithResult(_0x5dd92b,null))[_0x8db2('0x4a')](handleError(_0x5dd92b,null));};function hasDefaultDashboard(_0x281e48){var _0x3dc3d4=[0x65];return new BPromise(function(_0x192c02,_0x4e8aac){try{if(_0x281e48[_0x8db2('0x5a')]){_0x192c02(_0x3dc3d4);}else{return db['UserProfileResource'][_0x8db2('0x69')]({'where':{'sectionId':_0x281e48['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0xa083b1){_0xa083b1?_0x192c02(_0x3dc3d4):_0x192c02();});}}catch(_0x18d1eb){_0x4e8aac(_0x18d1eb);}});}function getCustomDashboards(_0x3f3040){var _0x5d5380=[];return new BPromise(function(_0x4e0834,_0x45cce8){try{if(_0x3f3040['autoAssociation']){return db[_0x8db2('0x6a')][_0x8db2('0x48')]({'raw':!![]})[_0x8db2('0x2a')](function(_0x1e7bc2){_0x1e7bc2[_0x8db2('0x6b')](function(_0x456d5e){_0x5d5380['push'](_0x456d5e['id']+0x1869f);});_0x4e0834(_0x5d5380);});}else{return db[_0x8db2('0x5b')][_0x8db2('0x48')]({'where':{'sectionId':_0x3f3040['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0x549725){_0x549725[_0x8db2('0x6b')](function(_0x34804e){_0x5d5380['push'](_0x34804e[_0x8db2('0x6c')]+0x1869f);});_0x4e0834(_0x5d5380);});}}catch(_0x7cb97d){_0x45cce8(_0x7cb97d);}});}function getPlugins(_0x11fabf){var _0x15307d=[];return new BPromise(function(_0x105aa6,_0x32e8a3){try{if(_0x11fabf[_0x8db2('0x5a')]){return db[_0x8db2('0x6d')][_0x8db2('0x48')]({'raw':!![]})['then'](function(_0x44c0cc){_0x44c0cc[_0x8db2('0x6b')](function(_0x1c37b7){_0x15307d[_0x8db2('0x61')](_0x1c37b7['id']+0x15b38);});_0x105aa6(_0x15307d);});}else{return db[_0x8db2('0x5b')][_0x8db2('0x48')]({'where':{'sectionId':_0x11fabf['id']},'raw':!![]})[_0x8db2('0x2a')](function(_0x95cf3){_0x95cf3[_0x8db2('0x6b')](function(_0x39633b){_0x15307d['push'](_0x39633b[_0x8db2('0x6c')]+0x15b38);});_0x105aa6(_0x15307d);});}}catch(_0x7e4bf){_0x32e8a3(_0x7e4bf);}});}exports[_0x8db2('0x6e')]=function(_0x1587e8,_0x5d371b){return db[_0x8db2('0x45')][_0x8db2('0x4d')]({'where':{'id':_0x1587e8[_0x8db2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d371b,null))['then'](function(_0x1fdeee){if(_0x1fdeee){return db[_0x8db2('0x56')][_0x8db2('0x57')](function(_0xc83913){return db['UserProfileSection'][_0x8db2('0x48')]({'where':{'userProfileId':_0x1587e8[_0x8db2('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x8db2('0x2a')](function(_0x3d298e){if(_0x3d298e){return db['UserProfileSection'][_0x8db2('0x2b')]({'where':{'userProfileId':_0x1587e8[_0x8db2('0x4c')]['id'],'id':_[_0x8db2('0x30')](_0x3d298e,function(_0x5121be){return _0x5121be['id'];})},'transaction':_0xc83913});}})['then'](function(_0x54a645){var _0x1ba097=_[_0x8db2('0x30')](_0x1587e8[_0x8db2('0x4f')],function(_0x4ef212){_0x4ef212['userProfileId']=_0x1587e8['params']['id'];return _0x4ef212;});return db[_0x8db2('0x58')][_0x8db2('0x6f')](_0x1ba097,{'raw':!![],'transaction':_0xc83913});})[_0x8db2('0x2a')](function(_0x39f08f){var _0x2cb15d=_[_0x8db2('0x3f')](_['map'](_0x39f08f,function(_0x2942eb){return _0x2942eb['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2cb15d){return db[_0x8db2('0x58')][_0x8db2('0x48')]({'where':{'userProfileId':_0x1587e8[_0x8db2('0x4c')]['id'],'sectionId':_[_0x8db2('0x30')](_0x2cb15d,function(_0x26d3ff){return _0x26d3ff['sectionId'];})},'attributes':['id',_0x8db2('0x5c')],'raw':!![]})[_0x8db2('0x2a')](function(_0x54d36d){var _0x28beec=_[_0x8db2('0x30')](_0x1587e8[_0x8db2('0x4f')],function(_0x1c184c){_0x1c184c['userProfileId']=_0x1587e8[_0x8db2('0x4c')]['id'];return _0x1c184c;});return db['UserProfileResource']['bulkCreate'](_0x28beec,{'raw':!![],'transaction':_0xc83913});});}})[_0x8db2('0x4a')](handleError(_0x5d371b,null));});}})[_0x8db2('0x2a')](function(_0x9b563c){var _0x256f16=_[_0x8db2('0x30')](_0x9b563c,function(_0x46254a){return _0x46254a[_0x8db2('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x5d371b,null))[_0x8db2('0x4a')](handleError(_0x5d371b,null));};exports['removeResources']=function(_0x4bbf03,_0x2f473e,_0x4ced3e){return db['UserProfile'][_0x8db2('0x4d')]({'where':{'id':_0x4bbf03[_0x8db2('0x4c')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x2f473e,null))['then'](function(_0x211460){if(_0x211460){return _0x211460[_0x8db2('0x70')](_0x4bbf03[_0x8db2('0x35')]['ids']);}})[_0x8db2('0x2a')](respondWithStatusCode(_0x2f473e,null))[_0x8db2('0x4a')](handleError(_0x2f473e,null));};exports[_0x8db2('0x71')]=function(_0x7ff636,_0x248280){var _0x63bfc2={};if(!_0x7ff636[_0x8db2('0x35')][_0x8db2('0x72')])throw new Error('Missing\x20section\x20parameter');if(!_0x7ff636[_0x8db2('0x35')][_0x8db2('0x3b')](_0x8db2('0x73'))){_0x63bfc2[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x7ff636[_0x8db2('0x35')][_0x8db2('0x25')]);_0x63bfc2[_0x8db2('0x22')]=qs[_0x8db2('0x22')](_0x7ff636[_0x8db2('0x35')][_0x8db2('0x22')]);}return db['UserProfile'][_0x8db2('0x4d')]({'where':{'id':_0x7ff636[_0x8db2('0x4c')]['id']}})[_0x8db2('0x2a')](function(_0x58063b){if(!_0x58063b)throw new Error(_0x8db2('0x74')+_0x7ff636[_0x8db2('0x4c')]['id']);return db[_0x8db2('0x45')]['getResources'](_0x7ff636);})['then'](respondWithFilteredResult(_0x248280,_0x63bfc2))[_0x8db2('0x4a')](handleError(_0x248280,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index bf68087..ebc2695 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 _0xb470=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x575bf9,_0x2f320f){var _0x4cdb9e=function(_0xaf13fe){while(--_0xaf13fe){_0x575bf9['push'](_0x575bf9['shift']());}};_0x4cdb9e(++_0x2f320f);}(_0xb470,0x75));var _0x0b47=function(_0x2a2e97,_0x4cc8e4){_0x2a2e97=_0x2a2e97-0x0;var _0x5ed190=_0xb470[_0x2a2e97];return _0x5ed190;};'use strict';var EventEmitter=require(_0x0b47('0x0'));var UserProfile=require(_0x0b47('0x1'))['db'][_0x0b47('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0b47('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b47('0x4'),'afterDestroy':_0x0b47('0x5')};function emitEvent(_0x2639b3){return function(_0x4fe439,_0x3638c5,_0x2057b8){UserProfileEvents[_0x0b47('0x6')](_0x2639b3+':'+_0x4fe439['id'],_0x4fe439);UserProfileEvents[_0x0b47('0x6')](_0x2639b3,_0x4fe439);_0x2057b8(null);};}for(var e in events){if(events[_0x0b47('0x7')](e)){var event=events[e];UserProfile[_0x0b47('0x8')](e,emitEvent(event));}}module[_0x0b47('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xd634=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','update','remove'];(function(_0xabbca3,_0x110f7e){var _0x86aa43=function(_0xc97d5f){while(--_0xc97d5f){_0xabbca3['push'](_0xabbca3['shift']());}};_0x86aa43(++_0x110f7e);}(_0xd634,0xf4));var _0x4d63=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xd634[_0x5e36d1];return _0x950b9e;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4d63('0x0'))['db'][_0x4d63('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d63('0x2'),'afterDestroy':_0x4d63('0x3')};function emitEvent(_0x478b56){return function(_0x4f99ac,_0x2b8d62,_0x35ba45){UserProfileEvents[_0x4d63('0x4')](_0x478b56+':'+_0x4f99ac['id'],_0x4f99ac);UserProfileEvents[_0x4d63('0x4')](_0x478b56,_0x4f99ac);_0x35ba45(null);};}for(var e in events){if(events[_0x4d63('0x5')](e)){var event=events[e];UserProfile[_0x4d63('0x6')](e,emitEvent(event));}}module[_0x4d63('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1c7922e..557cd18 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 _0x9dd9=['metrics','AnalyticMetric','toUpperCase','slice','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','ignore','isEmpty','union','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','foreignKey','include','forEach','reportType','default','custom','CustomReports','count','rows','Tags','tag','ThroughTags','color','openTabs','chat','sms','dataValues','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','map','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId'];(function(_0x14c06d,_0x54ae0c){var _0x8ed373=function(_0x5b6a09){while(--_0x5b6a09){_0x14c06d['push'](_0x14c06d['shift']());}};_0x8ed373(++_0x54ae0c);}(_0x9dd9,0x1ba));var _0x99dd=function(_0x2c8303,_0x5b0023){_0x2c8303=_0x2c8303-0x0;var _0x5b19b2=_0x9dd9[_0x2c8303];return _0x5b19b2;};'use strict';var _=require(_0x99dd('0x0'));var attributes=require(_0x99dd('0x1'));var qs=require(_0x99dd('0x2'));var squel=require('squel');module[_0x99dd('0x3')]=function(_0x1ad8a1){var _0x169248=_0x1ad8a1[_0x99dd('0x4')];function _0x155722(_0x1ce2ff,_0x1f8da8){return new Promise(function(_0x5f41e3,_0x4492de){if(!_0x1f8da8)return _0x5f41e3(null);var _0x275f60=_0x1f8da8[_0x99dd('0x5')]?{[_0x1f8da8[_0x99dd('0x5')][_0x99dd('0x6')]]:_0x1f8da8['filter'][_0x99dd('0x7')]}:undefined;return _0x169248[_0x1ce2ff][_0x99dd('0x8')]({'where':_0x275f60,'raw':!![]})[_0x99dd('0x9')](function(_0x4df38a){_0x1f8da8[_0x99dd('0xa')]=_[_0x99dd('0xb')](_0x4df38a,'id');_0x5f41e3(_0x1f8da8);})['catch'](function(_0x3f8851){_0x4492de(_0x3f8851);});});}function _0x5f1c6d(_0x1a0223,_0x4da494){return new Promise(function(_0x36a80f,_0x43ecfe){var _0xc3d519=_0x1a0223[_0x99dd('0x5')]?{[_0x1a0223[_0x99dd('0x5')]['field']]:_0x1a0223[_0x99dd('0x5')][_0x99dd('0x7')]}:undefined;return _0x169248[_0x1a0223[_0x99dd('0xc')]]['findAll']({'where':_0xc3d519,'raw':!![]})[_0x99dd('0x9')](function(_0x4914f2){_0x4da494[_0x99dd('0xa')]=_[_0x99dd('0xb')](_0x4914f2,function(_0x457516){return _0x457516[_0x99dd('0xd')];});_0x36a80f(_0x4da494);})[_0x99dd('0xe')](function(_0x30acd4){_0x43ecfe(_0x30acd4);});});}function _0x24a46a(_0x3f161e,_0x43024a,_0x334a45){if(!_0x43024a)return Promise[_0x99dd('0xf')](null);return new Promise(function(_0x44c839,_0x4716bf){return _0x169248[_0x99dd('0x10')][_0x99dd('0x8')]({'where':{'sectionId':_0x43024a['id']},'raw':!![]})[_0x99dd('0x9')](function(_0x319af6){if(_0x3f161e[_0x99dd('0x6')]&&_0x3f161e[_0x99dd('0x6')]!=='id'){_0x43024a[_0x99dd('0xa')]=_[_0x99dd('0xb')](_0x319af6,function(_0x21a4b6){return _0x21a4b6[_0x3f161e['field']];});}else{if(_0x334a45===_0x99dd('0x11')){_0x43024a[_0x99dd('0xa')]=_['map'](_0x319af6,function(_0x4c91fb){return{'id':_0x4c91fb[_0x99dd('0x12')],'type':_0x4c91fb[_0x99dd('0x13')]};});}else{_0x43024a[_0x99dd('0xa')]=_[_0x99dd('0xb')](_0x319af6,function(_0x2246ce){return _0x2246ce[_0x99dd('0x12')];});}}_0x44c839(_0x43024a);})[_0x99dd('0xe')](function(_0x1af5ea){_0x4716bf(_0x1af5ea);});});}function _0x1b6b47(_0x437f9f,_0x33ad22){var _0x333682={'parentSections':[]};switch(_0x437f9f[_0x99dd('0x14')]()){case _0x99dd('0x15'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x17');break;case _0x99dd('0x18'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x19');break;case _0x99dd('0x1a'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x1b');_0x333682[_0x99dd('0x1c')]=[{'name':_0x99dd('0x1d'),'field':_0x99dd('0xd'),'foreignKey':_0x99dd('0x1e')}];break;case _0x99dd('0x1f'):_0x333682['childModel']=_0x99dd('0x20');break;case _0x99dd('0x21'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x22');_0x333682[_0x99dd('0x1c')]=[{'name':_0x99dd('0x23'),'field':'id','foreignKey':'ListId'}];break;case _0x99dd('0x24'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x25');break;case _0x99dd('0x26'):_0x333682[_0x99dd('0x16')]='CmCompany';break;case _0x99dd('0x27'):_0x333682['childModel']=_0x99dd('0x28');break;case _0x99dd('0x29'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x2a');break;case _0x99dd('0x2b'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x2c');break;case _0x99dd('0x2d'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x2e');break;case _0x99dd('0x2f'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x30');break;case'inboundroutes':case _0x99dd('0x31'):case _0x99dd('0x32'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x33');break;case _0x99dd('0x34'):_0x333682[_0x99dd('0x16')]='VoiceContext';break;case'voicemails':_0x333682[_0x99dd('0x16')]=_0x99dd('0x35');break;case _0x99dd('0x36'):_0x333682['childModel']='VoiceRecording';_0x333682[_0x99dd('0x1c')]=[{'name':_0x99dd('0x37'),'field':_0x99dd('0xd'),'foreignKey':_0x99dd('0x38'),'model':_0x99dd('0x39'),'filter':{'field':_0x99dd('0x3a'),'value':[_0x99dd('0x3b')]}},{'name':_0x99dd('0x3c'),'field':_0x99dd('0xd'),'foreignKey':_0x99dd('0x38'),'model':_0x99dd('0x39'),'filter':{'field':_0x99dd('0x3a'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x99dd('0x3d'),'model':_0x99dd('0x3e'),'filter':{'field':_0x99dd('0x13'),'value':[_0x99dd('0x3f')]}},{'name':'QueueCampaigns','field':_0x99dd('0xd'),'foreignKey':_0x99dd('0x3d'),'model':_0x99dd('0x3e'),'filter':{'field':'type','value':['outbound']}}];break;case _0x99dd('0x40'):_0x333682[_0x99dd('0x16')]='VoiceMusicOnHold';break;case _0x99dd('0x41'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x42');break;case _0x99dd('0x43'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x44');break;case _0x99dd('0x45'):_0x333682[_0x99dd('0x16')]='Campaign';break;case _0x99dd('0x46'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x47');break;case _0x99dd('0x48'):_0x333682['childModel']=_0x99dd('0x49');break;case'mailsubstatuses':_0x333682[_0x99dd('0x16')]='MailSubstatus';break;case _0x99dd('0x4a'):_0x333682[_0x99dd('0x16')]='OpenchannelQueue';break;case _0x99dd('0x4b'):_0x333682['childModel']=_0x99dd('0x4c');break;case _0x99dd('0x4d'):_0x333682['childModel']=_0x99dd('0x4e');break;case'smsaccounts':_0x333682['childModel']=_0x99dd('0x4f');break;case'whatsappqueues':_0x333682['childModel']=_0x99dd('0x50');break;case _0x99dd('0x51'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x52');break;case'teams':_0x333682['childModel']=_0x99dd('0x53');break;case'voicequeues':case _0x99dd('0x54'):_0x333682['childModel']='VoiceQueue';if(_0x33ad22){_0x333682[_0x99dd('0x1c')]=[{'name':_0x99dd('0x55')},{'name':_0x99dd('0x56')}];}break;case _0x99dd('0x57'):case _0x99dd('0x58'):case _0x99dd('0x59'):_0x333682['childModel']=_0x99dd('0x39');if(_0x33ad22){_0x333682['parentSections']=[{'name':_0x99dd('0x5a'),'filter':{'field':'role','value':[_0x99dd('0x5b'),_0x99dd('0x5c')]},'ignore':!![]},{'name':_0x99dd('0x37')},{'name':_0x99dd('0x3c')}];}break;case _0x99dd('0x5d'):_0x333682['childModel']=_0x99dd('0x5e');break;case _0x99dd('0x5f'):_0x333682[_0x99dd('0x16')]='SalesforceAccount';break;case _0x99dd('0x60'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x61');break;case _0x99dd('0x62'):_0x333682[_0x99dd('0x16')]='SugarcrmAccount';break;case _0x99dd('0x63'):_0x333682['childModel']=_0x99dd('0x64');break;case'zohoaccounts':_0x333682[_0x99dd('0x16')]=_0x99dd('0x65');break;case _0x99dd('0x66'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x39');break;case _0x99dd('0x67'):_0x333682['childModel']=_0x99dd('0x68');break;case _0x99dd('0x69'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x6a');break;case'customdashboards':_0x333682['childModel']=_0x99dd('0x6b');break;case _0x99dd('0x6c'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x6d');break;case _0x99dd('0x6e'):_0x333682['childModel']=_0x99dd('0x6f');break;case'scheduler':_0x333682[_0x99dd('0x16')]=_0x99dd('0x70');break;case _0x99dd('0x71'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x72');break;case _0x99dd('0x73'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x74');break;case _0x99dd('0x75'):_0x333682['childModel']=_0x99dd('0x76');break;case _0x99dd('0x77'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x78');break;case'trunks':_0x333682[_0x99dd('0x16')]=_0x99dd('0x79');break;case _0x99dd('0x7a'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x7b');break;case _0x99dd('0x7c'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x7d');break;case _0x99dd('0x7e'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x11');_0x333682[_0x99dd('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0x99dd('0x7f')}];break;case _0x99dd('0x80'):_0x333682[_0x99dd('0x16')]=_0x99dd('0x81');break;}return _0x333682;}function _0x175b08(_0x253b8c,_0x354edc){var _0x4c8a09=_0x253b8c['charAt'](0x0)[_0x99dd('0x82')]()+_0x253b8c[_0x99dd('0x83')](0x1);var _0x29c192={'type':_0x169248['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x4e9e6f,_0x32e89a){var _0x28ddb0=squel['select']()[_0x99dd('0x6')](_0x99dd('0x84')+_0x4c8a09+'InteractionId','id')[_0x99dd('0x6')](_0x99dd('0x85'))[_0x99dd('0x86')](_0x99dd('0x87')+_0x253b8c+'_interactions','ui')[_0x99dd('0x88')](_0x99dd('0x89'),_0x354edc['id']);return _0x169248[_0x99dd('0x8a')][_0x99dd('0x8b')](_0x28ddb0['toString'](),_0x29c192)['then'](function(_0x42551e){_0x354edc[_0x4c8a09+_0x99dd('0x8c')]=_0x42551e;_0x4e9e6f(_0x42551e);})[_0x99dd('0xe')](function(_0x2c988e){_0x32e89a(_0x2c988e);});});}return _0x1ad8a1['define'](_0x99dd('0x8d'),attributes,{'tableName':_0x99dd('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c05b8){var _0x238228={'raw':_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0x8f')],'where':{}};var _0x12a4b9={};var _0x998e38={'count':0x0,'rows':[]};var _0x56d63c=_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0x90')];var _0x5c3028=_0x1c05b8[_0x99dd('0x8b')]['mergeResources']||![];var _0x5bfe4c=_0x1b6b47(_0x56d63c,_0x5c3028);if(!_0x5bfe4c[_0x99dd('0x16')])throw new Error(_0x99dd('0x91')+_0x56d63c+'\x27');var _0x34b62c=[{'name':_0x56d63c}];if(!_['isEmpty'](_0x5bfe4c[_0x99dd('0x1c')]))_0x34b62c=_0x5bfe4c['parentSections'];var _0x585b61=[];for(var _0x102374=0x0;_0x102374<_0x34b62c[_0x99dd('0x92')];_0x102374++){_0x585b61[_0x99dd('0x93')](_0x169248[_0x99dd('0x94')][_0x99dd('0x95')]({'where':{'userProfileId':_0x1c05b8[_0x99dd('0x96')]['id'],'name':_0x34b62c[_0x102374][_0x99dd('0xd')]},'raw':!![]}));}return Promise['all'](_0x585b61)['then'](function(_0x2cc7af){var _0x57f9c5=_[_0x99dd('0x5')](_0x2cc7af,function(_0xda20e2){return _0xda20e2?_0xda20e2:undefined;});var _0x1e8b73=_[_0x99dd('0x5')](_0x34b62c,[_0x99dd('0x97'),!![]]);var _0xb6c531=_['isEmpty'](_0x57f9c5)&&_[_0x99dd('0x98')](_0x1e8b73)?null:_[_0x99dd('0x99')](_0x1e8b73,_0x57f9c5);if(!_0xb6c531)return null;var _0x4445c7=[];for(var _0x559cfe=0x0;_0x559cfe<_0xb6c531[_0x99dd('0x92')];_0x559cfe++){var _0x2eb534=_[_0x99dd('0x95')](_0x34b62c,function(_0x5af903){return _0xb6c531[_0x559cfe]?_0x5af903[_0x99dd('0xd')]===_0xb6c531[_0x559cfe][_0x99dd('0xd')]:null;});if(_0x2eb534){if(_0xb6c531[_0x559cfe]['ignore']){_0x4445c7[_0x99dd('0x93')](_0x155722(_0x5bfe4c[_0x99dd('0x16')],_0xb6c531[_0x559cfe]));}else{if(!_0xb6c531[_0x559cfe][_0x99dd('0x9a')]){_0x4445c7[_0x99dd('0x93')](_0x24a46a(_0x2eb534,_0xb6c531[_0x559cfe],_0x5bfe4c[_0x99dd('0x16')]));}else{if(_0x2eb534[_0x99dd('0xc')]){_0x4445c7['push'](_0x5f1c6d(_0x2eb534,_0xb6c531[_0x559cfe]));}}}}}return Promise[_0x99dd('0x9b')](_0x4445c7);})[_0x99dd('0x9')](function(_0x3a67b7){var _0x35d440=_0x3a67b7;var _0x569bb0=null;if(_0x35d440){_0x569bb0=_0x35d440[_0x99dd('0x92')]===0x1?_0x35d440[0x0]:null;}if(!_0x569bb0&&!_0x35d440)return _0x998e38;var _0xe9c8ab=_0x169248[_0x5bfe4c[_0x99dd('0x16')]][_0x99dd('0x9c')];_0x12a4b9[_0x99dd('0xc')]=_[_0x99dd('0x9d')](_0xe9c8ab);_0x12a4b9[_0x99dd('0x8b')]=_['keys'](_0x1c05b8[_0x99dd('0x8b')]);_0x12a4b9[_0x99dd('0x9e')]=_[_0x99dd('0x9f')](_0x12a4b9['model'],_0x12a4b9['query']);_0x238228[_0x99dd('0xa0')]=_['intersection'](_0x12a4b9[_0x99dd('0xc')],qs[_0x99dd('0xa1')](_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0xa1')]));_0x238228[_0x99dd('0xa0')]=_0x238228[_0x99dd('0xa0')][_0x99dd('0x92')]?_0x238228['attributes']:_0x12a4b9['model'];if(!_0x1c05b8['query'][_0x99dd('0xa2')](_0x99dd('0xa3'))){_0x238228['limit']=qs[_0x99dd('0xa4')](_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0xa4')]);_0x238228[_0x99dd('0xa5')]=qs[_0x99dd('0xa5')](_0x1c05b8['query']['offset']);}_0x238228[_0x99dd('0xa6')]=qs[_0x99dd('0xa7')](_0x1c05b8[_0x99dd('0x8b')]['sort']);_0x238228['where']=qs[_0x99dd('0x9e')](_['pick'](_0x1c05b8[_0x99dd('0x8b')],_0x12a4b9[_0x99dd('0x9e')]));if(_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0x5')]){_0x238228[_0x99dd('0x88')]=_[_0x99dd('0xa8')](_0x238228[_0x99dd('0x88')],{'$or':_[_0x99dd('0xb')](_0xe9c8ab,function(_0x1fa1dd){if(_0x1fa1dd[_0x99dd('0x13')][_0x99dd('0xa9')]!=='VIRTUAL'){var _0x458d92={};_0x458d92[_0x1fa1dd[_0x99dd('0x6')]]={'$like':'%'+_0x1c05b8['query'][_0x99dd('0x5')]+'%'};return _0x458d92;}})});}var _0x3983e8=[];var _0x2f39ed=null;var _0x15e2ae={};if(_0x569bb0){_0x2f39ed=_[_0x99dd('0x95')](_0x34b62c,[_0x99dd('0xd'),_0x569bb0[_0x99dd('0xd')]]);if(_0x2f39ed[_0x99dd('0x6')]){_0x15e2ae={};if(_0x5bfe4c[_0x99dd('0x16')]===_0x99dd('0x11')){_0x15e2ae[_0x2f39ed[_0x99dd('0xaa')]]=_[_0x99dd('0xb')](_0x569bb0[_0x99dd('0xa')],'id');}else{_0x15e2ae[_0x2f39ed['foreignKey']]=_0x569bb0[_0x99dd('0xa')];}_0x3983e8[_0x99dd('0x93')](_0x15e2ae);}else{_0x238228[_0x99dd('0x88')]['id']=_0x569bb0[_0x99dd('0xa')];}}else{for(var _0x428fe0=0x0;_0x428fe0<_0x35d440[_0x99dd('0x92')];_0x428fe0++){_0x2f39ed=_['find'](_0x34b62c,[_0x99dd('0xd'),_0x35d440[_0x428fe0][_0x99dd('0xd')]]);if(_0x2f39ed['field']){_0x15e2ae={};_0x15e2ae[_0x2f39ed[_0x99dd('0xaa')]]=_0x35d440[_0x428fe0][_0x99dd('0xa')];_0x3983e8[_0x99dd('0x93')](_0x15e2ae);}else{if(!_0x238228[_0x99dd('0x88')]['id'])_0x238228[_0x99dd('0x88')]['id']=[];_0x35d440[_0x428fe0][_0x99dd('0xa')]['forEach'](function(_0x5bb6f4){_0x238228['where']['id'][_0x99dd('0x93')](_0x5bb6f4);});}}}if(!_[_0x99dd('0x98')](_0x3983e8)){_0x238228['where']=_[_0x99dd('0xa8')](_0x238228[_0x99dd('0x88')],{'$and':{'$or':_0x3983e8}});}_0x238228=_[_0x99dd('0xa8')]({},_0x238228,_0x1c05b8['options']);if(_0x569bb0&&!_0x569bb0[_0x99dd('0x9a')]&&_0x5bfe4c[_0x99dd('0x16')]===_0x99dd('0x11')){if(_0x1c05b8[_0x99dd('0x8b')]['includeAll']){_0x238228[_0x99dd('0xab')]=[{'all':!![]}];}return _0x169248[_0x5bfe4c['childModel']][_0x99dd('0x8')](_0x238228)[_0x99dd('0x9')](function(_0x44549c){var _0x13ef22=[];_0x44549c[_0x99dd('0xac')](function(_0x9cf50b){var _0x370dc3;switch(_0x9cf50b[_0x99dd('0xad')]){case _0x99dd('0xae'):_0x370dc3=_[_0x99dd('0x95')](_0x569bb0['associatedResources'],function(_0x8f6b4e){return _0x8f6b4e['id']===_0x9cf50b[_0x99dd('0x7f')]&&_0x8f6b4e[_0x99dd('0x13')]==='DefaultReports';});break;case _0x99dd('0xaf'):_0x370dc3=_[_0x99dd('0x95')](_0x569bb0[_0x99dd('0xa')],function(_0xa8efb1){return _0xa8efb1['id']===_0x9cf50b['reportId']&&_0xa8efb1[_0x99dd('0x13')]===_0x99dd('0xb0');});break;}if(_0x370dc3)_0x13ef22[_0x99dd('0x93')](_0x9cf50b);});_0x998e38[_0x99dd('0xb1')]=_0x13ef22[_0x99dd('0x92')];_0x998e38[_0x99dd('0xb2')]=_0x13ef22;return _0x998e38;});}else{return _0x169248[_0x5bfe4c['childModel']][_0x99dd('0xb1')]({'where':_0x238228[_0x99dd('0x88')]})[_0x99dd('0x9')](function(_0x55ea94){_0x998e38[_0x99dd('0xb1')]=_0x55ea94;if(_0x1c05b8[_0x99dd('0x8b')]['includeAll']){if(_0x5bfe4c[_0x99dd('0x16')]===_0x99dd('0x22')){_0x238228[_0x99dd('0xab')]=[{'model':_0x169248[_0x99dd('0x74')],'as':_0x99dd('0xb3'),'attributes':['id',_0x99dd('0xd'),'color'],'required':_0x1c05b8['query'][_0x99dd('0xb4')]?!![]:![]},{'model':_0x169248[_0x99dd('0x74')],'as':_0x99dd('0xb5'),'attributes':['id',_0x99dd('0xd'),_0x99dd('0xb6')],'through':_0x1c05b8['query'][_0x99dd('0xb4')]?{'attributes':[],'where':{'TagId':_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0xb4')]||undefined}}:{},'required':_0x1c05b8[_0x99dd('0x8b')]['tag']?!![]:![]}];}else{_0x238228[_0x99dd('0xab')]=[{'all':!![]}];}}return _0x169248[_0x5bfe4c['childModel']][_0x99dd('0x8')](_0x238228);})['then'](function(_0x127872){_0x998e38[_0x99dd('0xb2')]=_0x127872;if(_0x56d63c==='Agents'&&_0x1c05b8[_0x99dd('0x8b')][_0x99dd('0xb7')]==='true'){var _0x2be34a=[];for(var _0x5b9861=0x0;_0x5b9861<_0x998e38[_0x99dd('0xb2')][_0x99dd('0x92')];_0x5b9861++){_0x2be34a[_0x99dd('0x93')](_0x175b08(_0x99dd('0xb8'),_0x998e38[_0x99dd('0xb2')][_0x5b9861]['dataValues']));_0x2be34a[_0x99dd('0x93')](_0x175b08(_0x99dd('0xb9'),_0x998e38[_0x99dd('0xb2')][_0x5b9861][_0x99dd('0xba')]));_0x2be34a[_0x99dd('0x93')](_0x175b08(_0x99dd('0xbb'),_0x998e38[_0x99dd('0xb2')][_0x5b9861]['dataValues']));_0x2be34a[_0x99dd('0x93')](_0x175b08(_0x99dd('0xbc'),_0x998e38[_0x99dd('0xb2')][_0x5b9861]['dataValues']));_0x2be34a[_0x99dd('0x93')](_0x175b08(_0x99dd('0xbd'),_0x998e38[_0x99dd('0xb2')][_0x5b9861][_0x99dd('0xba')]));_0x2be34a['push'](_0x175b08('whatsapp',_0x998e38[_0x99dd('0xb2')][_0x5b9861][_0x99dd('0xba')]));}return Promise['all'](_0x2be34a)[_0x99dd('0x9')](function(){return _0x998e38;});}return _0x998e38;});}});}}});}; \ No newline at end of file +var _0x3eb4=['Agents','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','Plugin','Reports','reportId','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','user_profiles','raw','section','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','name','ignore','model','rawAttributes','keys','filters','fields','attributes','nolimit','limit','offset','sort','pick','VIRTUAL','foreignKey','merge','options','autoAssociation','includeAll','include','forEach','reportType','DefaultReports','custom','CustomReports','count','Tags','color','ThroughTags','tag','rows','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','field','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user'];(function(_0x1b5705,_0x2bf2c4){var _0x48b732=function(_0x4ac6e6){while(--_0x4ac6e6){_0x1b5705['push'](_0x1b5705['shift']());}};_0x48b732(++_0x2bf2c4);}(_0x3eb4,0x65));var _0x43eb=function(_0x191c33,_0x7ec3dd){_0x191c33=_0x191c33-0x0;var _0x424be0=_0x3eb4[_0x191c33];return _0x424be0;};'use strict';var _=require(_0x43eb('0x0'));var attributes=require(_0x43eb('0x1'));var qs=require(_0x43eb('0x2'));var squel=require('squel');module[_0x43eb('0x3')]=function(_0x1dc2b3){var _0x300823=_0x1dc2b3[_0x43eb('0x4')];function _0x5735d9(_0x431abe,_0x306d66){return new Promise(function(_0x5ab1ac,_0x3dfd91){if(!_0x306d66)return _0x5ab1ac(null);var _0x3633c4=_0x306d66[_0x43eb('0x5')]?{[_0x306d66[_0x43eb('0x5')]['field']]:_0x306d66['filter'][_0x43eb('0x6')]}:undefined;return _0x300823[_0x431abe][_0x43eb('0x7')]({'where':_0x3633c4,'raw':!![]})[_0x43eb('0x8')](function(_0x3a76e8){_0x306d66[_0x43eb('0x9')]=_[_0x43eb('0xa')](_0x3a76e8,'id');_0x5ab1ac(_0x306d66);})[_0x43eb('0xb')](function(_0x4cd65b){_0x3dfd91(_0x4cd65b);});});}function _0x38606f(_0x308941,_0x2052d7){return new Promise(function(_0x35250d,_0x5c630b){var _0x1a90b7=_0x308941[_0x43eb('0x5')]?{[_0x308941[_0x43eb('0x5')][_0x43eb('0xc')]]:_0x308941[_0x43eb('0x5')]['value']}:undefined;return _0x300823[_0x308941['model']]['findAll']({'where':_0x1a90b7,'raw':!![]})[_0x43eb('0x8')](function(_0x47dcc7){_0x2052d7[_0x43eb('0x9')]=_[_0x43eb('0xa')](_0x47dcc7,function(_0x7685b6){return _0x7685b6['name'];});_0x35250d(_0x2052d7);})[_0x43eb('0xb')](function(_0x2c7164){_0x5c630b(_0x2c7164);});});}function _0x1bcd69(_0x5d5f58,_0x573cda,_0x57d5f0){if(!_0x573cda)return Promise[_0x43eb('0xd')](null);return new Promise(function(_0x40cede,_0xbf6a22){return _0x300823[_0x43eb('0xe')][_0x43eb('0x7')]({'where':{'sectionId':_0x573cda['id']},'raw':!![]})[_0x43eb('0x8')](function(_0x2f3309){if(_0x5d5f58[_0x43eb('0xc')]&&_0x5d5f58[_0x43eb('0xc')]!=='id'){_0x573cda['associatedResources']=_['map'](_0x2f3309,function(_0x2cf285){return _0x2cf285[_0x5d5f58[_0x43eb('0xc')]];});}else{if(_0x57d5f0===_0x43eb('0xf')){_0x573cda[_0x43eb('0x9')]=_[_0x43eb('0xa')](_0x2f3309,function(_0x36b617){return{'id':_0x36b617['resourceId'],'type':_0x36b617[_0x43eb('0x10')]};});}else{_0x573cda[_0x43eb('0x9')]=_[_0x43eb('0xa')](_0x2f3309,function(_0x21db8f){return _0x21db8f[_0x43eb('0x11')];});}}_0x40cede(_0x573cda);})[_0x43eb('0xb')](function(_0x430a33){_0xbf6a22(_0x430a33);});});}function _0x32dda4(_0x1722e3,_0x4434f4){var _0x15ac24={'parentSections':[]};switch(_0x1722e3[_0x43eb('0x12')]()){case'squareprojects':_0x15ac24[_0x43eb('0x13')]='SquareProject';break;case _0x43eb('0x14'):_0x15ac24['childModel']=_0x43eb('0x15');break;case _0x43eb('0x16'):_0x15ac24['childModel']=_0x43eb('0x17');_0x15ac24[_0x43eb('0x18')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x43eb('0x19')}];break;case _0x43eb('0x1a'):_0x15ac24['childModel']=_0x43eb('0x1b');break;case _0x43eb('0x1c'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x1d');_0x15ac24[_0x43eb('0x18')]=[{'name':_0x43eb('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x43eb('0x1f'):_0x15ac24['childModel']=_0x43eb('0x20');break;case _0x43eb('0x21'):_0x15ac24[_0x43eb('0x13')]='CmCompany';break;case _0x43eb('0x22'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x23');break;case'chatqueues':_0x15ac24[_0x43eb('0x13')]='ChatQueue';break;case _0x43eb('0x24'):_0x15ac24[_0x43eb('0x13')]='ChatWebsite';break;case _0x43eb('0x25'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x26');break;case _0x43eb('0x27'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x28');break;case _0x43eb('0x29'):case'internalroutes':case'outboundroutes':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x2a');break;case _0x43eb('0x2b'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x2c');break;case'voicemails':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x2d');break;case'voicerecordings':_0x15ac24['childModel']=_0x43eb('0x2e');_0x15ac24[_0x43eb('0x18')]=[{'name':'Agents','field':'name','foreignKey':_0x43eb('0x2f'),'model':_0x43eb('0x30'),'filter':{'field':'role','value':[_0x43eb('0x31')]}},{'name':_0x43eb('0x32'),'field':'name','foreignKey':_0x43eb('0x2f'),'model':_0x43eb('0x30'),'filter':{'field':_0x43eb('0x33'),'value':[_0x43eb('0x34')]}},{'name':_0x43eb('0x35'),'field':'name','foreignKey':'queue','model':_0x43eb('0x36'),'filter':{'field':_0x43eb('0x10'),'value':[_0x43eb('0x37')]}},{'name':_0x43eb('0x38'),'field':'name','foreignKey':_0x43eb('0x39'),'model':_0x43eb('0x36'),'filter':{'field':_0x43eb('0x10'),'value':[_0x43eb('0x3a')]}}];break;case'musiconholds':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x3b');break;case _0x43eb('0x3c'):_0x15ac24[_0x43eb('0x13')]='VoiceChanSpy';break;case _0x43eb('0x3d'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x3e');break;case _0x43eb('0x3f'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x40');break;case _0x43eb('0x41'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x42');break;case'mailaccounts':_0x15ac24[_0x43eb('0x13')]='MailAccount';break;case _0x43eb('0x43'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x44');break;case'openchannelqueues':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x45');break;case _0x43eb('0x46'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x47');break;case'smsqueues':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x48');break;case _0x43eb('0x49'):_0x15ac24['childModel']=_0x43eb('0x4a');break;case _0x43eb('0x4b'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x4c');break;case _0x43eb('0x4d'):_0x15ac24['childModel']=_0x43eb('0x4e');break;case _0x43eb('0x4f'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x50');break;case _0x43eb('0x51'):case _0x43eb('0x52'):_0x15ac24['childModel']=_0x43eb('0x36');if(_0x4434f4){_0x15ac24[_0x43eb('0x18')]=[{'name':_0x43eb('0x35')},{'name':'QueueCampaigns'}];}break;case _0x43eb('0x53'):case _0x43eb('0x54'):case _0x43eb('0x55'):_0x15ac24['childModel']=_0x43eb('0x30');if(_0x4434f4){_0x15ac24[_0x43eb('0x18')]=[{'name':_0x43eb('0x56'),'filter':{'field':_0x43eb('0x33'),'value':[_0x43eb('0x57'),_0x43eb('0x58')]},'ignore':!![]},{'name':_0x43eb('0x59')},{'name':_0x43eb('0x32')}];}break;case _0x43eb('0x5a'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x5b');break;case'salesforceaccounts':_0x15ac24[_0x43eb('0x13')]='SalesforceAccount';break;case _0x43eb('0x5c'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x5d');break;case'sugarcrmaccounts':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x5e');break;case _0x43eb('0x5f'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x60');break;case _0x43eb('0x61'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x62');break;case'vtigeraccounts':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x30');break;case _0x43eb('0x63'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x64');break;case'dispositions':_0x15ac24[_0x43eb('0x13')]='Disposition';break;case _0x43eb('0x65'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x66');break;case _0x43eb('0x67'):_0x15ac24['childModel']=_0x43eb('0x68');break;case'pauses':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x69');break;case _0x43eb('0x6a'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x6b');break;case _0x43eb('0x6c'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x6d');break;case _0x43eb('0x6e'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x6f');break;case _0x43eb('0x70'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x71');break;case _0x43eb('0x72'):_0x15ac24['childModel']='Trigger';break;case _0x43eb('0x73'):_0x15ac24['childModel']=_0x43eb('0x74');break;case _0x43eb('0x75'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x76');break;case'plugins':_0x15ac24['childModel']=_0x43eb('0x77');break;case'extractedreports':_0x15ac24[_0x43eb('0x13')]=_0x43eb('0xf');_0x15ac24[_0x43eb('0x18')]=[{'name':_0x43eb('0x78'),'field':'id','foreignKey':_0x43eb('0x79')}];break;case _0x43eb('0x7a'):_0x15ac24[_0x43eb('0x13')]=_0x43eb('0x7b');break;}return _0x15ac24;}function _0x313cea(_0x5c69fd,_0x3f343d){var _0x8d84ec=_0x5c69fd['charAt'](0x0)['toUpperCase']()+_0x5c69fd[_0x43eb('0x7c')](0x1);var _0x381227={'type':_0x300823[_0x43eb('0x7d')][_0x43eb('0x7e')][_0x43eb('0x7f')],'raw':!![]};return new Promise(function(_0x41c810,_0x2e8dbd){var _0x2695b3=squel[_0x43eb('0x80')]()[_0x43eb('0xc')](_0x43eb('0x81')+_0x8d84ec+_0x43eb('0x82'),'id')[_0x43eb('0xc')](_0x43eb('0x83'))[_0x43eb('0x84')](_0x43eb('0x85')+_0x5c69fd+_0x43eb('0x86'),'ui')[_0x43eb('0x87')](_0x43eb('0x88'),_0x3f343d['id']);return _0x300823[_0x43eb('0x89')]['query'](_0x2695b3[_0x43eb('0x8a')](),_0x381227)[_0x43eb('0x8')](function(_0x5bb47b){_0x3f343d[_0x8d84ec+'OpenTabs']=_0x5bb47b;_0x41c810(_0x5bb47b);})[_0x43eb('0xb')](function(_0x14bc7c){_0x2e8dbd(_0x14bc7c);});});}return _0x1dc2b3[_0x43eb('0x8b')](_0x43eb('0x8c'),attributes,{'tableName':_0x43eb('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5a24a1){var _0x3bd91f={'raw':_0x5a24a1['query'][_0x43eb('0x8e')],'where':{}};var _0x1abece={};var _0x8bc821={'count':0x0,'rows':[]};var _0x5d0bf4=_0x5a24a1['query'][_0x43eb('0x8f')];var _0x4e9238=_0x5a24a1[_0x43eb('0x90')][_0x43eb('0x91')]||![];var _0x4841d6=_0x32dda4(_0x5d0bf4,_0x4e9238);if(!_0x4841d6[_0x43eb('0x13')])throw new Error(_0x43eb('0x92')+_0x5d0bf4+'\x27');var _0x130c62=[{'name':_0x5d0bf4}];if(!_[_0x43eb('0x93')](_0x4841d6['parentSections']))_0x130c62=_0x4841d6['parentSections'];var _0x42c2c5=[];for(var _0x498358=0x0;_0x498358<_0x130c62[_0x43eb('0x94')];_0x498358++){_0x42c2c5[_0x43eb('0x95')](_0x300823[_0x43eb('0x96')][_0x43eb('0x97')]({'where':{'userProfileId':_0x5a24a1['params']['id'],'name':_0x130c62[_0x498358]['name']},'raw':!![]}));}return Promise[_0x43eb('0x98')](_0x42c2c5)[_0x43eb('0x8')](function(_0x311a98){var _0x134562=_[_0x43eb('0x5')](_0x311a98,function(_0x305ac9){return _0x305ac9?_0x305ac9:undefined;});var _0x1b5cac=_[_0x43eb('0x5')](_0x130c62,['ignore',!![]]);var _0x55f3a1=_[_0x43eb('0x93')](_0x134562)&&_['isEmpty'](_0x1b5cac)?null:_['union'](_0x1b5cac,_0x134562);if(!_0x55f3a1)return null;var _0x3d0178=[];for(var _0x34c0cc=0x0;_0x34c0cc<_0x55f3a1[_0x43eb('0x94')];_0x34c0cc++){var _0x3c372b=_[_0x43eb('0x97')](_0x130c62,function(_0x240133){return _0x55f3a1[_0x34c0cc]?_0x240133['name']===_0x55f3a1[_0x34c0cc][_0x43eb('0x99')]:null;});if(_0x3c372b){if(_0x55f3a1[_0x34c0cc][_0x43eb('0x9a')]){_0x3d0178['push'](_0x5735d9(_0x4841d6[_0x43eb('0x13')],_0x55f3a1[_0x34c0cc]));}else{if(!_0x55f3a1[_0x34c0cc]['autoAssociation']){_0x3d0178[_0x43eb('0x95')](_0x1bcd69(_0x3c372b,_0x55f3a1[_0x34c0cc],_0x4841d6[_0x43eb('0x13')]));}else{if(_0x3c372b[_0x43eb('0x9b')]){_0x3d0178['push'](_0x38606f(_0x3c372b,_0x55f3a1[_0x34c0cc]));}}}}}return Promise[_0x43eb('0x98')](_0x3d0178);})[_0x43eb('0x8')](function(_0x374a75){var _0x4b5ba7=_0x374a75;var _0x49dadf=null;if(_0x4b5ba7){_0x49dadf=_0x4b5ba7[_0x43eb('0x94')]===0x1?_0x4b5ba7[0x0]:null;}if(!_0x49dadf&&!_0x4b5ba7)return _0x8bc821;var _0x1d47c4=_0x300823[_0x4841d6[_0x43eb('0x13')]][_0x43eb('0x9c')];_0x1abece[_0x43eb('0x9b')]=_[_0x43eb('0x9d')](_0x1d47c4);_0x1abece[_0x43eb('0x90')]=_[_0x43eb('0x9d')](_0x5a24a1[_0x43eb('0x90')]);_0x1abece[_0x43eb('0x9e')]=_['intersection'](_0x1abece[_0x43eb('0x9b')],_0x1abece[_0x43eb('0x90')]);_0x3bd91f['attributes']=_['intersection'](_0x1abece['model'],qs['fields'](_0x5a24a1[_0x43eb('0x90')][_0x43eb('0x9f')]));_0x3bd91f['attributes']=_0x3bd91f[_0x43eb('0xa0')][_0x43eb('0x94')]?_0x3bd91f[_0x43eb('0xa0')]:_0x1abece[_0x43eb('0x9b')];if(!_0x5a24a1[_0x43eb('0x90')]['hasOwnProperty'](_0x43eb('0xa1'))){_0x3bd91f['limit']=qs[_0x43eb('0xa2')](_0x5a24a1[_0x43eb('0x90')][_0x43eb('0xa2')]);_0x3bd91f[_0x43eb('0xa3')]=qs[_0x43eb('0xa3')](_0x5a24a1['query'][_0x43eb('0xa3')]);}_0x3bd91f['order']=qs['sort'](_0x5a24a1['query'][_0x43eb('0xa4')]);_0x3bd91f[_0x43eb('0x87')]=qs[_0x43eb('0x9e')](_[_0x43eb('0xa5')](_0x5a24a1[_0x43eb('0x90')],_0x1abece[_0x43eb('0x9e')]));if(_0x5a24a1[_0x43eb('0x90')][_0x43eb('0x5')]){_0x3bd91f['where']=_['merge'](_0x3bd91f['where'],{'$or':_[_0x43eb('0xa')](_0x1d47c4,function(_0x3517c5){if(_0x3517c5[_0x43eb('0x10')]['key']!==_0x43eb('0xa6')){var _0xeea8ee={};_0xeea8ee[_0x3517c5[_0x43eb('0xc')]]={'$like':'%'+_0x5a24a1[_0x43eb('0x90')][_0x43eb('0x5')]+'%'};return _0xeea8ee;}})});}var _0x246d88=[];var _0x4c3cc8=null;var _0x220aeb={};if(_0x49dadf){_0x4c3cc8=_[_0x43eb('0x97')](_0x130c62,[_0x43eb('0x99'),_0x49dadf[_0x43eb('0x99')]]);if(_0x4c3cc8['field']){_0x220aeb={};if(_0x4841d6['childModel']==='AnalyticExtractedReport'){_0x220aeb[_0x4c3cc8[_0x43eb('0xa7')]]=_[_0x43eb('0xa')](_0x49dadf[_0x43eb('0x9')],'id');}else{_0x220aeb[_0x4c3cc8[_0x43eb('0xa7')]]=_0x49dadf[_0x43eb('0x9')];}_0x246d88[_0x43eb('0x95')](_0x220aeb);}else{_0x3bd91f[_0x43eb('0x87')]['id']=_0x49dadf[_0x43eb('0x9')];}}else{for(var _0x113ca8=0x0;_0x113ca8<_0x4b5ba7[_0x43eb('0x94')];_0x113ca8++){_0x4c3cc8=_['find'](_0x130c62,[_0x43eb('0x99'),_0x4b5ba7[_0x113ca8][_0x43eb('0x99')]]);if(_0x4c3cc8['field']){_0x220aeb={};_0x220aeb[_0x4c3cc8['foreignKey']]=_0x4b5ba7[_0x113ca8]['associatedResources'];_0x246d88[_0x43eb('0x95')](_0x220aeb);}else{if(!_0x3bd91f[_0x43eb('0x87')]['id'])_0x3bd91f[_0x43eb('0x87')]['id']=[];_0x4b5ba7[_0x113ca8][_0x43eb('0x9')]['forEach'](function(_0x1ce2a2){_0x3bd91f['where']['id'][_0x43eb('0x95')](_0x1ce2a2);});}}}if(!_[_0x43eb('0x93')](_0x246d88)){_0x3bd91f[_0x43eb('0x87')]=_[_0x43eb('0xa8')](_0x3bd91f[_0x43eb('0x87')],{'$and':{'$or':_0x246d88}});}_0x3bd91f=_[_0x43eb('0xa8')]({},_0x3bd91f,_0x5a24a1[_0x43eb('0xa9')]);if(_0x49dadf&&!_0x49dadf[_0x43eb('0xaa')]&&_0x4841d6['childModel']==='AnalyticExtractedReport'){if(_0x5a24a1[_0x43eb('0x90')][_0x43eb('0xab')]){_0x3bd91f[_0x43eb('0xac')]=[{'all':!![]}];}return _0x300823[_0x4841d6[_0x43eb('0x13')]]['findAll'](_0x3bd91f)[_0x43eb('0x8')](function(_0xd7003a){var _0x5092fb=[];_0xd7003a[_0x43eb('0xad')](function(_0x50d8dd){var _0x1b9ce3;switch(_0x50d8dd[_0x43eb('0xae')]){case'default':_0x1b9ce3=_[_0x43eb('0x97')](_0x49dadf['associatedResources'],function(_0x431e3f){return _0x431e3f['id']===_0x50d8dd[_0x43eb('0x79')]&&_0x431e3f['type']===_0x43eb('0xaf');});break;case _0x43eb('0xb0'):_0x1b9ce3=_[_0x43eb('0x97')](_0x49dadf[_0x43eb('0x9')],function(_0x381be6){return _0x381be6['id']===_0x50d8dd[_0x43eb('0x79')]&&_0x381be6[_0x43eb('0x10')]===_0x43eb('0xb1');});break;}if(_0x1b9ce3)_0x5092fb[_0x43eb('0x95')](_0x50d8dd);});_0x8bc821['count']=_0x5092fb[_0x43eb('0x94')];_0x8bc821['rows']=_0x5092fb;return _0x8bc821;});}else{return _0x300823[_0x4841d6['childModel']][_0x43eb('0xb2')]({'where':_0x3bd91f[_0x43eb('0x87')]})['then'](function(_0x3b25c8){_0x8bc821[_0x43eb('0xb2')]=_0x3b25c8;if(_0x5a24a1['query'][_0x43eb('0xab')]){if(_0x4841d6[_0x43eb('0x13')]===_0x43eb('0x1d')){_0x3bd91f[_0x43eb('0xac')]=[{'model':_0x300823[_0x43eb('0x6f')],'as':_0x43eb('0xb3'),'attributes':['id',_0x43eb('0x99'),_0x43eb('0xb4')],'required':_0x5a24a1[_0x43eb('0x90')]['tag']?!![]:![]},{'model':_0x300823[_0x43eb('0x6f')],'as':_0x43eb('0xb5'),'attributes':['id',_0x43eb('0x99'),_0x43eb('0xb4')],'through':_0x5a24a1['query'][_0x43eb('0xb6')]?{'attributes':[],'where':{'TagId':_0x5a24a1[_0x43eb('0x90')][_0x43eb('0xb6')]||undefined}}:{},'required':_0x5a24a1[_0x43eb('0x90')][_0x43eb('0xb6')]?!![]:![]}];}else{_0x3bd91f[_0x43eb('0xac')]=[{'all':!![]}];}}return _0x300823[_0x4841d6['childModel']]['findAll'](_0x3bd91f);})[_0x43eb('0x8')](function(_0x3c8a0d){_0x8bc821[_0x43eb('0xb7')]=_0x3c8a0d;if(_0x5d0bf4===_0x43eb('0x59')&&_0x5a24a1[_0x43eb('0x90')]['openTabs']===_0x43eb('0xb8')){var _0x422f9c=[];for(var _0x440055=0x0;_0x440055<_0x8bc821[_0x43eb('0xb7')]['length'];_0x440055++){_0x422f9c[_0x43eb('0x95')](_0x313cea(_0x43eb('0xb9'),_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));_0x422f9c[_0x43eb('0x95')](_0x313cea(_0x43eb('0xbb'),_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));_0x422f9c[_0x43eb('0x95')](_0x313cea(_0x43eb('0xbc'),_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));_0x422f9c[_0x43eb('0x95')](_0x313cea('mail',_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));_0x422f9c[_0x43eb('0x95')](_0x313cea(_0x43eb('0xbd'),_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));_0x422f9c[_0x43eb('0x95')](_0x313cea('whatsapp',_0x8bc821[_0x43eb('0xb7')][_0x440055][_0x43eb('0xba')]));}return Promise[_0x43eb('0x98')](_0x422f9c)[_0x43eb('0x8')](function(){return _0x8bc821;});}return _0x8bc821;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c95cf64..1062b8d 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 _0xe08b=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3457ce,_0x22b413){var _0x4e5205=function(_0x5563fb){while(--_0x5563fb){_0x3457ce['push'](_0x3457ce['shift']());}};_0x4e5205(++_0x22b413);}(_0xe08b,0x10e));var _0xbe08=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xe08b[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe08('0x3'));var db=require(_0xbe08('0x4'))['db'];var utils=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});config[_0xbe08('0xc')]=_[_0xbe08('0xd')](config[_0xbe08('0xc')],{'host':_0xbe08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe08('0xc')]));require(_0xbe08('0xf'))['register'](socket);function respondWithRpcPromise(_0xb4e69a,_0xed8e0c,_0x47ca8d){return new BPromise(function(_0xc5824c,_0x202fec){return client['request'](_0xb4e69a,_0x47ca8d)[_0xbe08('0x10')](function(_0x133725){logger[_0xbe08('0x11')](_0xbe08('0x12'),_0xed8e0c,'request\x20sent');logger[_0xbe08('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'),JSON[_0xbe08('0x15')](_0x133725));if(_0x133725[_0xbe08('0x16')]){if(_0x133725[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x202fec(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0xc5824c(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x11')]('UserProfile,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'));_0xc5824c(_0x133725[_0xbe08('0x19')][_0xbe08('0x18')]);}})[_0xbe08('0x1a')](function(_0x1c9379){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x1c9379);_0x202fec(_0x1c9379);});});} \ No newline at end of file +var _0xa282=['UserProfile,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x536d7d,_0x5c10f9){var _0x33617a=function(_0x3c6b65){while(--_0x3c6b65){_0x536d7d['push'](_0x536d7d['shift']());}};_0x33617a(++_0x5c10f9);}(_0xa282,0x1f3));var _0x2a28=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa282[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x2a28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a28('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a28('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a28('0x3'));var logger=require(_0x2a28('0x4'))(_0x2a28('0x5'));var config=require(_0x2a28('0x6'));var jayson=require(_0x2a28('0x7'));var client=jayson[_0x2a28('0x8')][_0x2a28('0x9')]({'port':0x232a});config[_0x2a28('0xa')]=_[_0x2a28('0xb')](config[_0x2a28('0xa')],{'host':_0x2a28('0xc'),'port':0x18eb});var socket=require(_0x2a28('0xd'))(new Redis(config[_0x2a28('0xa')]));require('./userProfile.socket')[_0x2a28('0xe')](socket);function respondWithRpcPromise(_0x4e74b6,_0x21bdd0,_0x515e7){return new BPromise(function(_0x4186d9,_0xa7a136){return client[_0x2a28('0xf')](_0x4e74b6,_0x515e7)[_0x2a28('0x10')](function(_0x4f6255){logger['info']('UserProfile,\x20%s,\x20%s',_0x21bdd0,_0x2a28('0x11'));logger['debug'](_0x2a28('0x12'),_0x21bdd0,_0x2a28('0x11'),JSON[_0x2a28('0x13')](_0x4f6255));if(_0x4f6255[_0x2a28('0x14')]){if(_0x4f6255[_0x2a28('0x14')]['code']===0x1f4){logger['error'](_0x2a28('0x15'),_0x21bdd0,_0x4f6255[_0x2a28('0x14')]['message']);return _0xa7a136(_0x4f6255[_0x2a28('0x14')][_0x2a28('0x16')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x21bdd0,_0x4f6255[_0x2a28('0x14')][_0x2a28('0x16')]);return _0x4186d9(_0x4f6255['error'][_0x2a28('0x16')]);}else{logger[_0x2a28('0x17')]('UserProfile,\x20%s,\x20%s',_0x21bdd0,_0x2a28('0x11'));_0x4186d9(_0x4f6255[_0x2a28('0x18')]['message']);}})[_0x2a28('0x19')](function(_0x5316a1){logger[_0x2a28('0x14')]('UserProfile,\x20%s,\x20%s',_0x21bdd0,_0x5316a1);_0xa7a136(_0x5316a1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b0a5ea8..8301184 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 _0xe61d=['userProfile:','save','remove','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe61d,0x104));var _0xde61=function(_0x13be81,_0x12fd4a){_0x13be81=_0x13be81-0x0;var _0x2dea00=_0xe61d[_0x13be81];return _0x2dea00;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xde61('0x0'),_0xde61('0x1'),_0xde61('0x2')];function createListener(_0x13d184,_0x342527){return function(_0x4f6f9b){_0x342527[_0xde61('0x3')](_0x13d184,_0x4f6f9b);};}function removeListener(_0x3b8c88,_0x1b9470){return function(){UserProfileEvents[_0xde61('0x4')](_0x3b8c88,_0x1b9470);};}exports['register']=function(_0x2e4781){for(var _0x540687=0x0,_0x54b0bf=events[_0xde61('0x5')];_0x540687<_0x54b0bf;_0x540687++){var _0x3f4ff7=events[_0x540687];var _0x38e0dd=createListener(_0xde61('0x6')+_0x3f4ff7,_0x2e4781);UserProfileEvents['on'](_0x3f4ff7,_0x38e0dd);}}; \ No newline at end of file +var _0x0e75=['./userProfile.events','save','remove','update','removeListener','register','length','userProfile:'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x0e75,0x90));var _0x50e7=function(_0x418612,_0x1b7710){_0x418612=_0x418612-0x0;var _0x224247=_0x0e75[_0x418612];return _0x224247;};'use strict';var UserProfileEvents=require(_0x50e7('0x0'));var events=[_0x50e7('0x1'),_0x50e7('0x2'),_0x50e7('0x3')];function createListener(_0x4b725f,_0x35ea30){return function(_0xe85666){_0x35ea30['emit'](_0x4b725f,_0xe85666);};}function removeListener(_0x41bce7,_0x258fd6){return function(){UserProfileEvents[_0x50e7('0x4')](_0x41bce7,_0x258fd6);};}exports[_0x50e7('0x5')]=function(_0x49a033){for(var _0x121d16=0x0,_0x5a0efa=events[_0x50e7('0x6')];_0x121d16<_0x5a0efa;_0x121d16++){var _0x3d2371=events[_0x121d16];var _0x3ab5e4=createListener(_0x50e7('0x7')+_0x3d2371,_0x49a033);UserProfileEvents['on'](_0x3d2371,_0x3ab5e4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b02bdc0..8485b77 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 _0x2fcd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','destroy','exports','path'];(function(_0x2a214b,_0x53faeb){var _0x359f25=function(_0x52f40a){while(--_0x52f40a){_0x2a214b['push'](_0x2a214b['shift']());}};_0x359f25(++_0x53faeb);}(_0x2fcd,0x17b));var _0xd2fc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2fcd[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd2fc('0x0'));var timeout=require('connect-timeout');var express=require(_0xd2fc('0x1'));var router=express[_0xd2fc('0x2')]();var fs_extra=require(_0xd2fc('0x3'));var auth=require(_0xd2fc('0x4'));var interaction=require(_0xd2fc('0x5'));var config=require(_0xd2fc('0x6'));var controller=require(_0xd2fc('0x7'));router[_0xd2fc('0x8')]('/',auth[_0xd2fc('0x9')](),controller[_0xd2fc('0xa')]);router[_0xd2fc('0x8')]('/describe',auth[_0xd2fc('0x9')](),controller[_0xd2fc('0xb')]);router[_0xd2fc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd2fc('0xc')]);router[_0xd2fc('0xd')]('/',auth[_0xd2fc('0x9')](),controller[_0xd2fc('0xe')]);router[_0xd2fc('0xf')](_0xd2fc('0x10'),auth[_0xd2fc('0x9')](),controller['update']);router['delete'](_0xd2fc('0x10'),auth[_0xd2fc('0x9')](),controller[_0xd2fc('0x11')]);module[_0xd2fc('0x12')]=router; \ No newline at end of file +var _0xfb18=['show','post','create','put','update','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id'];(function(_0xf4497e,_0x5c7e2e){var _0x484f66=function(_0x51689e){while(--_0x51689e){_0xf4497e['push'](_0xf4497e['shift']());}};_0x484f66(++_0x5c7e2e);}(_0xfb18,0x133));var _0x8fb1=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0xfb18[_0x147497];return _0x35f45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8fb1('0x0'));var timeout=require(_0x8fb1('0x1'));var express=require('express');var router=express[_0x8fb1('0x2')]();var fs_extra=require(_0x8fb1('0x3'));var auth=require(_0x8fb1('0x4'));var interaction=require(_0x8fb1('0x5'));var config=require(_0x8fb1('0x6'));var controller=require(_0x8fb1('0x7'));router[_0x8fb1('0x8')]('/',auth[_0x8fb1('0x9')](),controller[_0x8fb1('0xa')]);router[_0x8fb1('0x8')]('/describe',auth[_0x8fb1('0x9')](),controller[_0x8fb1('0xb')]);router['get'](_0x8fb1('0xc'),auth[_0x8fb1('0x9')](),controller[_0x8fb1('0xd')]);router[_0x8fb1('0xe')]('/',auth[_0x8fb1('0x9')](),controller[_0x8fb1('0xf')]);router[_0x8fb1('0x10')](_0x8fb1('0xc'),auth[_0x8fb1('0x9')](),controller[_0x8fb1('0x11')]);router[_0x8fb1('0x12')](_0x8fb1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8fb1('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1f7d4bf..de121a7 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 _0x2d9f=['STRING'];(function(_0x15644f,_0x569a86){var _0x2c6849=function(_0x1d8f56){while(--_0x1d8f56){_0x15644f['push'](_0x15644f['shift']());}};_0x2c6849(++_0x569a86);}(_0x2d9f,0x1e5));var _0xf2d9=function(_0x4cb58a,_0x2a62e0){_0x4cb58a=_0x4cb58a-0x0;var _0x592f29=_0x2d9f[_0x4cb58a];return _0x592f29;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf2d9('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6952=['exports','STRING','INTEGER','sequelize'];(function(_0x551cab,_0x1a4b6b){var _0x2a8d49=function(_0x4b177d){while(--_0x4b177d){_0x551cab['push'](_0x551cab['shift']());}};_0x2a8d49(++_0x1a4b6b);}(_0x6952,0x1c7));var _0x2695=function(_0x21d225,_0x5bbaf7){_0x21d225=_0x21d225-0x0;var _0x29049b=_0x6952[_0x21d225];return _0x29049b;};'use strict';var Sequelize=require(_0x2695('0x0'));module[_0x2695('0x1')]={'name':{'type':Sequelize[_0x2695('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2695('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2695('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 59059cc..626ec69 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 _0xadb5=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','keys'];(function(_0x44b249,_0x5b4811){var _0x23b853=function(_0x3f90ef){while(--_0x3f90ef){_0x44b249['push'](_0x44b249['shift']());}};_0x23b853(++_0x5b4811);}(_0xadb5,0xad));var _0x5adb=function(_0x2cc7b6,_0x594660){_0x2cc7b6=_0x2cc7b6-0x0;var _0x3d9fcf=_0xadb5[_0x2cc7b6];return _0x3d9fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['UserProfileResource']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));};exports['describe']=function(_0x36b847,_0x3a5703){return db[_0x5adb('0x2a')][_0x5adb('0x49')]()['then'](respondWithResult(_0x3a5703,null))[_0x5adb('0x42')](handleError(_0x3a5703,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x7a54,0x106));var _0x47a5=function(_0x8108ba,_0x1791de){_0x8108ba=_0x8108ba-0x0;var _0x4658b4=_0x7a54[_0x8108ba];return _0x4658b4;};'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['UserProfileResource'][_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['UserProfileResource']['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['UserProfileResource']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f53f3cb..b809d52 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 _0xaab5=['sectionId','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x1fc852,_0x449001){var _0x46a237=function(_0x1bfdcc){while(--_0x1bfdcc){_0x1fc852['push'](_0x1fc852['shift']());}};_0x46a237(++_0x449001);}(_0xaab5,0x1ed));var _0x5aab=function(_0xecc697,_0x323ad4){_0xecc697=_0xecc697-0x0;var _0x3df2b4=_0xaab5[_0xecc697];return _0x3df2b4;};'use strict';var _=require(_0x5aab('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5aab('0x1'));var BPromise=require('bluebird');var rp=require(_0x5aab('0x2'));var fs=require('fs');var path=require(_0x5aab('0x3'));var rimraf=require(_0x5aab('0x4'));var config=require(_0x5aab('0x5'));var attributes=require('./userProfileResource.attributes');module[_0x5aab('0x6')]=function(_0x29a35b,_0x76b029){return _0x29a35b[_0x5aab('0x7')](_0x5aab('0x8'),attributes,{'tableName':_0x5aab('0x9'),'paranoid':![],'indexes':[{'name':_0x5aab('0xa'),'fields':['resourceId',_0x5aab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf781=['compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0xf781,0x1e3));var _0x1f78=function(_0x354ec5,_0x2bce03){_0x354ec5=_0x354ec5-0x0;var _0x486676=_0xf781[_0x354ec5];return _0x486676;};'use strict';var _=require(_0x1f78('0x0'));var util=require('util');var logger=require(_0x1f78('0x1'))(_0x1f78('0x2'));var moment=require(_0x1f78('0x3'));var BPromise=require(_0x1f78('0x4'));var rp=require(_0x1f78('0x5'));var fs=require('fs');var path=require(_0x1f78('0x6'));var rimraf=require(_0x1f78('0x7'));var config=require(_0x1f78('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5a0978,_0x58de87){return _0x5a0978[_0x1f78('0x9')](_0x1f78('0xa'),attributes,{'tableName':_0x1f78('0xb'),'paranoid':![],'indexes':[{'name':_0x1f78('0xc'),'fields':[_0x1f78('0xd'),_0x1f78('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4d8cb22..4782a50 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 _0x6018=['request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','UserProfileResource,\x20%s,\x20%s','result','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x5525e7,_0x57df7a){var _0xf4ac5d=function(_0x24fb60){while(--_0x24fb60){_0x5525e7['push'](_0x5525e7['shift']());}};_0xf4ac5d(++_0x57df7a);}(_0x6018,0x1df));var _0x8601=function(_0x594576,_0x65ab0c){_0x594576=_0x594576-0x0;var _0x56b371=_0x6018[_0x594576];return _0x56b371;};'use strict';var _=require(_0x8601('0x0'));var util=require(_0x8601('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8601('0x2'));var db=require(_0x8601('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8601('0x4'));var config=require('../../config/environment');var jayson=require(_0x8601('0x5'));var client=jayson[_0x8601('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3202c3,_0x171e03,_0x5034b8){return new BPromise(function(_0x17c638,_0x3ac5a8){return client[_0x8601('0x7')](_0x3202c3,_0x5034b8)[_0x8601('0x8')](function(_0x567ebf){logger[_0x8601('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x171e03,_0x8601('0xa'));logger[_0x8601('0xb')](_0x8601('0xc'),_0x171e03,_0x8601('0xa'),JSON['stringify'](_0x567ebf));if(_0x567ebf[_0x8601('0xd')]){if(_0x567ebf[_0x8601('0xd')][_0x8601('0xe')]===0x1f4){logger[_0x8601('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x171e03,_0x567ebf['error'][_0x8601('0xf')]);return _0x3ac5a8(_0x567ebf[_0x8601('0xd')]['message']);}logger[_0x8601('0xd')](_0x8601('0x10'),_0x171e03,_0x567ebf[_0x8601('0xd')][_0x8601('0xf')]);return _0x17c638(_0x567ebf[_0x8601('0xd')][_0x8601('0xf')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x171e03,_0x8601('0xa'));_0x17c638(_0x567ebf[_0x8601('0x11')]['message']);}})['catch'](function(_0x2782e2){logger[_0x8601('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x171e03,_0x2782e2);_0x3ac5a8(_0x2782e2);});});} \ No newline at end of file +var _0x11b7=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x56d3da,_0x16368f){var _0x2c66ec=function(_0x4e0d17){while(--_0x4e0d17){_0x56d3da['push'](_0x56d3da['shift']());}};_0x2c66ec(++_0x16368f);}(_0x11b7,0x112));var _0x711b=function(_0x515df6,_0x89d6ee){_0x515df6=_0x515df6-0x0;var _0x42ff46=_0x11b7[_0x515df6];return _0x42ff46;};'use strict';var _=require(_0x711b('0x0'));var util=require(_0x711b('0x1'));var moment=require(_0x711b('0x2'));var BPromise=require(_0x711b('0x3'));var rs=require(_0x711b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x711b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x711b('0x6'))(_0x711b('0x7'));var config=require('../../config/environment');var jayson=require(_0x711b('0x8'));var client=jayson[_0x711b('0x9')][_0x711b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x565ff8,_0x1fd069,_0x236d32){return new BPromise(function(_0xa1e213,_0x5dc9ca){return client['request'](_0x565ff8,_0x236d32)[_0x711b('0xb')](function(_0xb56847){logger[_0x711b('0xc')](_0x711b('0xd'),_0x1fd069,_0x711b('0xe'));logger['debug'](_0x711b('0xf'),_0x1fd069,_0x711b('0xe'),JSON['stringify'](_0xb56847));if(_0xb56847[_0x711b('0x10')]){if(_0xb56847[_0x711b('0x10')][_0x711b('0x11')]===0x1f4){logger[_0x711b('0x10')](_0x711b('0xd'),_0x1fd069,_0xb56847['error'][_0x711b('0x12')]);return _0x5dc9ca(_0xb56847[_0x711b('0x10')][_0x711b('0x12')]);}logger[_0x711b('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x1fd069,_0xb56847['error'][_0x711b('0x12')]);return _0xa1e213(_0xb56847[_0x711b('0x10')][_0x711b('0x12')]);}else{logger[_0x711b('0xc')](_0x711b('0xd'),_0x1fd069,_0x711b('0xe'));_0xa1e213(_0xb56847[_0x711b('0x13')][_0x711b('0x12')]);}})[_0x711b('0x14')](function(_0xce937f){logger[_0x711b('0x10')](_0x711b('0xd'),_0x1fd069,_0xce937f);_0x5dc9ca(_0xce937f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8f4074f..d19d166 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 _0x0f7c=['isAuthenticated','index','/describe','describe','show','post','create','put','destroy','exports','multer','path','express','fs-extra','./userProfileSection.controller','get'];(function(_0x8b1a5e,_0x2744eb){var _0x1146b1=function(_0x5a9f50){while(--_0x5a9f50){_0x8b1a5e['push'](_0x8b1a5e['shift']());}};_0x1146b1(++_0x2744eb);}(_0x0f7c,0x1ba));var _0xc0f7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0f7c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc0f7('0x0'));var util=require('util');var path=require(_0xc0f7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc0f7('0x2'));var router=express['Router']();var fs_extra=require(_0xc0f7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc0f7('0x4'));router[_0xc0f7('0x5')]('/',auth[_0xc0f7('0x6')](),controller[_0xc0f7('0x7')]);router[_0xc0f7('0x5')](_0xc0f7('0x8'),auth[_0xc0f7('0x6')](),controller[_0xc0f7('0x9')]);router[_0xc0f7('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc0f7('0xa')]);router[_0xc0f7('0xb')]('/',auth['isAuthenticated'](),controller[_0xc0f7('0xc')]);router[_0xc0f7('0xd')]('/:id',auth[_0xc0f7('0x6')](),controller['update']);router['delete']('/:id',auth[_0xc0f7('0x6')](),controller[_0xc0f7('0xe')]);module[_0xc0f7('0xf')]=router; \ No newline at end of file +var _0x1be6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x1be6,0x1b3));var _0x61be=function(_0x41dbc2,_0x30f743){_0x41dbc2=_0x41dbc2-0x0;var _0x23ba83=_0x1be6[_0x41dbc2];return _0x23ba83;};'use strict';var multer=require(_0x61be('0x0'));var util=require(_0x61be('0x1'));var path=require(_0x61be('0x2'));var timeout=require('connect-timeout');var express=require(_0x61be('0x3'));var router=express[_0x61be('0x4')]();var fs_extra=require(_0x61be('0x5'));var auth=require(_0x61be('0x6'));var interaction=require(_0x61be('0x7'));var config=require(_0x61be('0x8'));var controller=require(_0x61be('0x9'));router[_0x61be('0xa')]('/',auth['isAuthenticated'](),controller[_0x61be('0xb')]);router[_0x61be('0xa')]('/describe',auth[_0x61be('0xc')](),controller[_0x61be('0xd')]);router[_0x61be('0xa')](_0x61be('0xe'),auth[_0x61be('0xc')](),controller[_0x61be('0xf')]);router[_0x61be('0x10')]('/',auth['isAuthenticated'](),controller[_0x61be('0x11')]);router[_0x61be('0x12')](_0x61be('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x61be('0x13')](_0x61be('0xe'),auth[_0x61be('0xc')](),controller[_0x61be('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 72a30bb..c0ed4d5 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 _0xae60=['setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x21b1b9,_0x3354b3){var _0x7e54fc=function(_0x32c139){while(--_0x32c139){_0x21b1b9['push'](_0x21b1b9['shift']());}};_0x7e54fc(++_0x3354b3);}(_0xae60,0x1c7));var _0x0ae6=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xae60[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'name':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0ae6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4c014f){this[_0x0ae6('0x5')]('crudPermissions',_0x4c014f?_0x4c014f[_0x0ae6('0x6')](''):[]);},'get':function(){return this[_0x0ae6('0x7')](_0x0ae6('0x8'))?this[_0x0ae6('0x7')](_0x0ae6('0x8'))[_0x0ae6('0x9')](''):[];}}}; \ No newline at end of file +var _0xe511=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x3c3e28,_0x2a4c73){var _0x597523=function(_0x22df5c){while(--_0x22df5c){_0x3c3e28['push'](_0x3c3e28['shift']());}};_0x597523(++_0x2a4c73);}(_0xe511,0x16f));var _0x1e51=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0xe511[_0xb247e3];return _0x57fb7b;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x1e51('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x42e242){this[_0x1e51('0x4')](_0x1e51('0x5'),_0x42e242?_0x42e242[_0x1e51('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x1e51('0x5'))?this[_0x1e51('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 22d4288..9a9f025 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 _0x772c=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','params','rawAttributes','options','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x172364,_0xebbb66){var _0x118574=function(_0x58af78){while(--_0x58af78){_0x172364['push'](_0x172364['shift']());}};_0x118574(++_0xebbb66);}(_0x772c,0x111));var _0xc772=function(_0x47cef0,_0x9486dc){_0x47cef0=_0x47cef0-0x0;var _0x26fec8=_0x772c[_0x47cef0];return _0x26fec8;};'use strict';var emlformat=require(_0xc772('0x0'));var rimraf=require(_0xc772('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc772('0x2'));var rp=require(_0xc772('0x3'));var moment=require(_0xc772('0x4'));var BPromise=require(_0xc772('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc772('0x6'));var sox=require(_0xc772('0x7'));var csv=require(_0xc772('0x8'));var ejs=require(_0xc772('0x9'));var fs=require('fs');var fs_extra=require(_0xc772('0xa'));var _=require(_0xc772('0xb'));var squel=require(_0xc772('0xc'));var crypto=require('crypto');var jsforce=require(_0xc772('0xd'));var deskjs=require(_0xc772('0xe'));var toCsv=require(_0xc772('0x8'));var querystring=require('querystring');var Papa=require(_0xc772('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc772('0x10'));var as=require(_0xc772('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc772('0x12'))(_0xc772('0x13'));var utils=require(_0xc772('0x14'));var config=require(_0xc772('0x15'));var licenseUtil=require(_0xc772('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc9dd,_0x1d8ca5){_0x1d8ca5=_0x1d8ca5||0xcc;return function(_0x5b1c24){if(_0x5b1c24){return _0x4fc9dd[_0xc772('0x17')](_0x1d8ca5);}return _0x4fc9dd[_0xc772('0x18')](_0x1d8ca5)['end']();};}function respondWithResult(_0x4ac66d,_0x2c544b){_0x2c544b=_0x2c544b||0xc8;return function(_0x347080){if(_0x347080){return _0x4ac66d[_0xc772('0x18')](_0x2c544b)[_0xc772('0x19')](_0x347080);}};}function respondWithFilteredResult(_0xbca2d8,_0x1a0a5d){return function(_0x4334e3){if(_0x4334e3){var _0x145548=typeof _0x1a0a5d[_0xc772('0x1a')]==='undefined'&&typeof _0x1a0a5d[_0xc772('0x1b')]==='undefined';var _0x2970b3=_0x4334e3[_0xc772('0x1c')];var _0x2a986a=_0x145548?0x0:_0x1a0a5d['offset'];var _0x85878=_0x145548?_0x4334e3[_0xc772('0x1c')]:_0x1a0a5d[_0xc772('0x1a')]+_0x1a0a5d[_0xc772('0x1b')];var _0x525d97;if(_0x85878>=_0x2970b3){_0x85878=_0x2970b3;_0x525d97=0xc8;}else{_0x525d97=0xce;}_0xbca2d8[_0xc772('0x18')](_0x525d97);return _0xbca2d8['set'](_0xc772('0x1d'),_0x2a986a+'-'+_0x85878+'/'+_0x2970b3)[_0xc772('0x19')](_0x4334e3);}return null;};}function patchUpdates(_0x43fe9a){return function(_0x498df5){try{jsonpatch[_0xc772('0x1e')](_0x498df5,_0x43fe9a,!![]);}catch(_0x408a86){return BPromise[_0xc772('0x1f')](_0x408a86);}return _0x498df5[_0xc772('0x20')]();};}function saveUpdates(_0x133cd2,_0x223b04){return function(_0x501982){if(_0x501982){return _0x501982[_0xc772('0x21')](_0x133cd2)[_0xc772('0x22')](function(_0x5b4a0e){return _0x5b4a0e;});}return null;};}function removeEntity(_0x1fde14,_0x3c3064){return function(_0x5d9029){if(_0x5d9029){return _0x5d9029[_0xc772('0x23')]()[_0xc772('0x22')](function(){_0x1fde14[_0xc772('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x147c20,_0x5db3a2){return function(_0x3707d3){if(!_0x3707d3){_0x147c20[_0xc772('0x17')](0x194);}return _0x3707d3;};}function handleError(_0x179a90,_0x10c049){_0x10c049=_0x10c049||0x1f4;return function(_0x4c04cf){logger[_0xc772('0x24')](_0x4c04cf[_0xc772('0x25')]);if(_0x4c04cf[_0xc772('0x26')]){delete _0x4c04cf[_0xc772('0x26')];}_0x179a90[_0xc772('0x18')](_0x10c049)[_0xc772('0x27')](_0x4c04cf);};}exports[_0xc772('0x28')]=function(_0x427eab,_0x4dc74a){var _0x4ee4b2={},_0xeb0206={},_0x30b0ba={'count':0x0,'rows':[]};var _0x5396a4=_[_0xc772('0x29')](db[_0xc772('0x2a')]['rawAttributes'],function(_0x215b23){return{'name':_0x215b23[_0xc772('0x2b')],'type':_0x215b23[_0xc772('0x2c')][_0xc772('0x2d')]};});_0xeb0206[_0xc772('0x2e')]=_[_0xc772('0x29')](_0x5396a4,_0xc772('0x26'));_0xeb0206[_0xc772('0x2f')]=_[_0xc772('0x30')](_0x427eab[_0xc772('0x2f')]);_0xeb0206[_0xc772('0x31')]=_[_0xc772('0x32')](_0xeb0206[_0xc772('0x2e')],_0xeb0206[_0xc772('0x2f')]);_0x4ee4b2[_0xc772('0x33')]=_['intersection'](_0xeb0206[_0xc772('0x2e')],qs[_0xc772('0x34')](_0x427eab['query']['fields']));_0x4ee4b2[_0xc772('0x33')]=_0x4ee4b2[_0xc772('0x33')]['length']?_0x4ee4b2[_0xc772('0x33')]:_0xeb0206[_0xc772('0x2e')];if(!_0x427eab['query'][_0xc772('0x35')](_0xc772('0x36'))){_0x4ee4b2['limit']=qs[_0xc772('0x1b')](_0x427eab[_0xc772('0x2f')][_0xc772('0x1b')]);_0x4ee4b2[_0xc772('0x1a')]=qs[_0xc772('0x1a')](_0x427eab[_0xc772('0x2f')]['offset']);}_0x4ee4b2[_0xc772('0x37')]=qs[_0xc772('0x38')](_0x427eab[_0xc772('0x2f')]['sort']);_0x4ee4b2[_0xc772('0x39')]=qs['filters'](_[_0xc772('0x3a')](_0x427eab[_0xc772('0x2f')],_0xeb0206['filters']),_0x5396a4);if(_0x427eab['query']['filter']){_0x4ee4b2[_0xc772('0x39')]=_['merge'](_0x4ee4b2[_0xc772('0x39')],{'$or':_[_0xc772('0x29')](_0x5396a4,function(_0x44b273){if(_0x44b273[_0xc772('0x2c')]!==_0xc772('0x3b')){var _0x1a2246={};_0x1a2246[_0x44b273['name']]={'$like':'%'+_0x427eab[_0xc772('0x2f')][_0xc772('0x3c')]+'%'};return _0x1a2246;}})});}_0x4ee4b2=_[_0xc772('0x3d')]({},_0x4ee4b2,_0x427eab['options']);var _0x150a64={'where':_0x4ee4b2[_0xc772('0x39')]};return db['UserProfileSection']['count'](_0x150a64)[_0xc772('0x22')](function(_0x153cf7){_0x30b0ba[_0xc772('0x1c')]=_0x153cf7;if(_0x427eab[_0xc772('0x2f')][_0xc772('0x3e')]){_0x4ee4b2['include']=[{'all':!![]}];}return db[_0xc772('0x2a')][_0xc772('0x3f')](_0x4ee4b2);})[_0xc772('0x22')](function(_0x5563f4){_0x30b0ba[_0xc772('0x40')]=_0x5563f4;return _0x30b0ba;})[_0xc772('0x22')](respondWithFilteredResult(_0x4dc74a,_0x4ee4b2))['catch'](handleError(_0x4dc74a,null));};exports['show']=function(_0x587c9f,_0x2b66b9){var _0x2dcb1f={'raw':![],'where':{'id':_0x587c9f[_0xc772('0x41')]['id']}},_0x328a4b={};_0x328a4b[_0xc772('0x2e')]=_[_0xc772('0x30')](db['UserProfileSection'][_0xc772('0x42')]);_0x328a4b[_0xc772('0x2f')]=_['keys'](_0x587c9f[_0xc772('0x2f')]);_0x328a4b[_0xc772('0x31')]=_['intersection'](_0x328a4b['model'],_0x328a4b[_0xc772('0x2f')]);_0x2dcb1f['attributes']=_['intersection'](_0x328a4b[_0xc772('0x2e')],qs[_0xc772('0x34')](_0x587c9f['query'][_0xc772('0x34')]));_0x2dcb1f[_0xc772('0x33')]=_0x2dcb1f[_0xc772('0x33')]['length']?_0x2dcb1f[_0xc772('0x33')]:_0x328a4b[_0xc772('0x2e')];if(_0x587c9f[_0xc772('0x2f')][_0xc772('0x3e')]){_0x2dcb1f['include']=[{'all':!![]}];}_0x2dcb1f=_[_0xc772('0x3d')]({},_0x2dcb1f,_0x587c9f[_0xc772('0x43')]);return db['UserProfileSection'][_0xc772('0x44')](_0x2dcb1f)['then'](handleEntityNotFound(_0x2b66b9,null))[_0xc772('0x22')](respondWithResult(_0x2b66b9,null))['catch'](handleError(_0x2b66b9,null));};exports[_0xc772('0x45')]=function(_0x50ad04,_0x2ccc3b){return db['UserProfileSection'][_0xc772('0x45')](_0x50ad04['body'],{})[_0xc772('0x22')](respondWithResult(_0x2ccc3b,0xc9))[_0xc772('0x46')](handleError(_0x2ccc3b,null));};exports[_0xc772('0x21')]=function(_0x47f34d,_0x41477e){if(_0x47f34d[_0xc772('0x47')]['id']){delete _0x47f34d[_0xc772('0x47')]['id'];}return db[_0xc772('0x2a')]['find']({'where':{'id':_0x47f34d['params']['id']}})[_0xc772('0x22')](handleEntityNotFound(_0x41477e,null))['then'](saveUpdates(_0x47f34d[_0xc772('0x47')],null))[_0xc772('0x22')](respondWithResult(_0x41477e,null))['catch'](handleError(_0x41477e,null));};exports[_0xc772('0x23')]=function(_0x5124c2,_0x35ab8c){return db[_0xc772('0x2a')][_0xc772('0x44')]({'where':{'id':_0x5124c2['params']['id']}})['then'](handleEntityNotFound(_0x35ab8c,null))[_0xc772('0x22')](removeEntity(_0x35ab8c,null))[_0xc772('0x46')](handleError(_0x35ab8c,null));};exports[_0xc772('0x48')]=function(_0x4af890,_0x2370e9){return db[_0xc772('0x2a')][_0xc772('0x48')]()[_0xc772('0x22')](respondWithResult(_0x2370e9,null))['catch'](handleError(_0x2370e9,null));}; \ No newline at end of file +var _0x06cb=['limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','create','body','destroy','params','describe','eml-format','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x3b92cc,_0x564346){var _0x34298f=function(_0x3a39f7){while(--_0x3a39f7){_0x3b92cc['push'](_0x3b92cc['shift']());}};_0x34298f(++_0x564346);}(_0x06cb,0x118));var _0xb06c=function(_0x3c99d1,_0x53651d){_0x3c99d1=_0x3c99d1-0x0;var _0x5ac579=_0x06cb[_0x3c99d1];return _0x5ac579;};'use strict';var emlformat=require(_0xb06c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb06c('0x1'));var jsonpatch=require(_0xb06c('0x2'));var rp=require(_0xb06c('0x3'));var moment=require(_0xb06c('0x4'));var BPromise=require(_0xb06c('0x5'));var Mustache=require(_0xb06c('0x6'));var util=require(_0xb06c('0x7'));var path=require('path');var sox=require(_0xb06c('0x8'));var csv=require('to-csv');var ejs=require(_0xb06c('0x9'));var fs=require('fs');var fs_extra=require(_0xb06c('0xa'));var _=require(_0xb06c('0xb'));var squel=require(_0xb06c('0xc'));var crypto=require(_0xb06c('0xd'));var jsforce=require(_0xb06c('0xe'));var deskjs=require(_0xb06c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb06c('0x10'));var Papa=require(_0xb06c('0x11'));var Redis=require(_0xb06c('0x12'));var authService=require(_0xb06c('0x13'));var qs=require(_0xb06c('0x14'));var as=require(_0xb06c('0x15'));var hardwareService=require(_0xb06c('0x16'));var logger=require(_0xb06c('0x17'))(_0xb06c('0x18'));var utils=require(_0xb06c('0x19'));var config=require(_0xb06c('0x1a'));var licenseUtil=require(_0xb06c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26f29f,_0xda6652){_0xda6652=_0xda6652||0xcc;return function(_0x2b1b1b){if(_0x2b1b1b){return _0x26f29f[_0xb06c('0x1c')](_0xda6652);}return _0x26f29f['status'](_0xda6652)[_0xb06c('0x1d')]();};}function respondWithResult(_0x11621f,_0x197fc8){_0x197fc8=_0x197fc8||0xc8;return function(_0x12d40e){if(_0x12d40e){return _0x11621f[_0xb06c('0x1e')](_0x197fc8)[_0xb06c('0x1f')](_0x12d40e);}};}function respondWithFilteredResult(_0x548594,_0x2d5a62){return function(_0x3436f1){if(_0x3436f1){var _0x34b177=typeof _0x2d5a62['offset']==='undefined'&&typeof _0x2d5a62[_0xb06c('0x20')]===_0xb06c('0x21');var _0x99d73d=_0x3436f1['count'];var _0x14e410=_0x34b177?0x0:_0x2d5a62['offset'];var _0x2da3fb=_0x34b177?_0x3436f1[_0xb06c('0x22')]:_0x2d5a62[_0xb06c('0x23')]+_0x2d5a62[_0xb06c('0x20')];var _0x162cf6;if(_0x2da3fb>=_0x99d73d){_0x2da3fb=_0x99d73d;_0x162cf6=0xc8;}else{_0x162cf6=0xce;}_0x548594[_0xb06c('0x1e')](_0x162cf6);return _0x548594[_0xb06c('0x24')](_0xb06c('0x25'),_0x14e410+'-'+_0x2da3fb+'/'+_0x99d73d)[_0xb06c('0x1f')](_0x3436f1);}return null;};}function patchUpdates(_0x3a0a64){return function(_0x8420a2){try{jsonpatch[_0xb06c('0x26')](_0x8420a2,_0x3a0a64,!![]);}catch(_0x4128f2){return BPromise[_0xb06c('0x27')](_0x4128f2);}return _0x8420a2[_0xb06c('0x28')]();};}function saveUpdates(_0x9278f,_0x3703b9){return function(_0x4567ea){if(_0x4567ea){return _0x4567ea[_0xb06c('0x29')](_0x9278f)[_0xb06c('0x2a')](function(_0x3a63ba){return _0x3a63ba;});}return null;};}function removeEntity(_0x585c3d,_0x3233bf){return function(_0x5c0dcd){if(_0x5c0dcd){return _0x5c0dcd['destroy']()[_0xb06c('0x2a')](function(){_0x585c3d[_0xb06c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131a6a,_0x324718){return function(_0x4d23ea){if(!_0x4d23ea){_0x131a6a[_0xb06c('0x1c')](0x194);}return _0x4d23ea;};}function handleError(_0x3aaf30,_0x31615c){_0x31615c=_0x31615c||0x1f4;return function(_0x2a11e1){logger[_0xb06c('0x2b')](_0x2a11e1[_0xb06c('0x2c')]);if(_0x2a11e1[_0xb06c('0x2d')]){delete _0x2a11e1[_0xb06c('0x2d')];}_0x3aaf30['status'](_0x31615c)[_0xb06c('0x2e')](_0x2a11e1);};}exports[_0xb06c('0x2f')]=function(_0x3db7c7,_0x964814){var _0x4d4c92={},_0x4afa6d={},_0x708c59={'count':0x0,'rows':[]};var _0x55f876=_[_0xb06c('0x30')](db[_0xb06c('0x31')][_0xb06c('0x32')],function(_0x139d46){return{'name':_0x139d46['fieldName'],'type':_0x139d46['type']['key']};});_0x4afa6d['model']=_['map'](_0x55f876,'name');_0x4afa6d[_0xb06c('0x33')]=_[_0xb06c('0x34')](_0x3db7c7[_0xb06c('0x33')]);_0x4afa6d[_0xb06c('0x35')]=_[_0xb06c('0x36')](_0x4afa6d[_0xb06c('0x37')],_0x4afa6d[_0xb06c('0x33')]);_0x4d4c92[_0xb06c('0x38')]=_[_0xb06c('0x36')](_0x4afa6d[_0xb06c('0x37')],qs[_0xb06c('0x39')](_0x3db7c7[_0xb06c('0x33')]['fields']));_0x4d4c92[_0xb06c('0x38')]=_0x4d4c92[_0xb06c('0x38')]['length']?_0x4d4c92[_0xb06c('0x38')]:_0x4afa6d[_0xb06c('0x37')];if(!_0x3db7c7['query'][_0xb06c('0x3a')](_0xb06c('0x3b'))){_0x4d4c92[_0xb06c('0x20')]=qs[_0xb06c('0x20')](_0x3db7c7['query']['limit']);_0x4d4c92[_0xb06c('0x23')]=qs[_0xb06c('0x23')](_0x3db7c7[_0xb06c('0x33')][_0xb06c('0x23')]);}_0x4d4c92[_0xb06c('0x3c')]=qs['sort'](_0x3db7c7[_0xb06c('0x33')]['sort']);_0x4d4c92[_0xb06c('0x3d')]=qs['filters'](_[_0xb06c('0x3e')](_0x3db7c7[_0xb06c('0x33')],_0x4afa6d['filters']),_0x55f876);if(_0x3db7c7[_0xb06c('0x33')][_0xb06c('0x3f')]){_0x4d4c92['where']=_['merge'](_0x4d4c92['where'],{'$or':_['map'](_0x55f876,function(_0xa29679){if(_0xa29679[_0xb06c('0x40')]!==_0xb06c('0x41')){var _0x5125be={};_0x5125be[_0xa29679[_0xb06c('0x2d')]]={'$like':'%'+_0x3db7c7[_0xb06c('0x33')][_0xb06c('0x3f')]+'%'};return _0x5125be;}})});}_0x4d4c92=_[_0xb06c('0x42')]({},_0x4d4c92,_0x3db7c7[_0xb06c('0x43')]);var _0x54ea24={'where':_0x4d4c92[_0xb06c('0x3d')]};return db['UserProfileSection'][_0xb06c('0x22')](_0x54ea24)[_0xb06c('0x2a')](function(_0x14e4e6){_0x708c59['count']=_0x14e4e6;if(_0x3db7c7[_0xb06c('0x33')][_0xb06c('0x44')]){_0x4d4c92[_0xb06c('0x45')]=[{'all':!![]}];}return db[_0xb06c('0x31')][_0xb06c('0x46')](_0x4d4c92);})[_0xb06c('0x2a')](function(_0x371ce0){_0x708c59['rows']=_0x371ce0;return _0x708c59;})[_0xb06c('0x2a')](respondWithFilteredResult(_0x964814,_0x4d4c92))[_0xb06c('0x47')](handleError(_0x964814,null));};exports['show']=function(_0x3144ce,_0x3eb9a1){var _0x3b7b4b={'raw':![],'where':{'id':_0x3144ce['params']['id']}},_0x501cb4={};_0x501cb4[_0xb06c('0x37')]=_[_0xb06c('0x34')](db['UserProfileSection']['rawAttributes']);_0x501cb4[_0xb06c('0x33')]=_[_0xb06c('0x34')](_0x3144ce[_0xb06c('0x33')]);_0x501cb4['filters']=_[_0xb06c('0x36')](_0x501cb4['model'],_0x501cb4[_0xb06c('0x33')]);_0x3b7b4b['attributes']=_[_0xb06c('0x36')](_0x501cb4['model'],qs['fields'](_0x3144ce[_0xb06c('0x33')][_0xb06c('0x39')]));_0x3b7b4b['attributes']=_0x3b7b4b['attributes']['length']?_0x3b7b4b[_0xb06c('0x38')]:_0x501cb4[_0xb06c('0x37')];if(_0x3144ce[_0xb06c('0x33')][_0xb06c('0x44')]){_0x3b7b4b[_0xb06c('0x45')]=[{'all':!![]}];}_0x3b7b4b=_['merge']({},_0x3b7b4b,_0x3144ce[_0xb06c('0x43')]);return db['UserProfileSection'][_0xb06c('0x48')](_0x3b7b4b)['then'](handleEntityNotFound(_0x3eb9a1,null))[_0xb06c('0x2a')](respondWithResult(_0x3eb9a1,null))['catch'](handleError(_0x3eb9a1,null));};exports[_0xb06c('0x49')]=function(_0x1c12ff,_0x169220){return db[_0xb06c('0x31')][_0xb06c('0x49')](_0x1c12ff[_0xb06c('0x4a')],{})[_0xb06c('0x2a')](respondWithResult(_0x169220,0xc9))['catch'](handleError(_0x169220,null));};exports[_0xb06c('0x29')]=function(_0xa96a17,_0x206995){if(_0xa96a17[_0xb06c('0x4a')]['id']){delete _0xa96a17[_0xb06c('0x4a')]['id'];}return db[_0xb06c('0x31')][_0xb06c('0x48')]({'where':{'id':_0xa96a17['params']['id']}})['then'](handleEntityNotFound(_0x206995,null))['then'](saveUpdates(_0xa96a17[_0xb06c('0x4a')],null))[_0xb06c('0x2a')](respondWithResult(_0x206995,null))[_0xb06c('0x47')](handleError(_0x206995,null));};exports[_0xb06c('0x4b')]=function(_0x1ad6ec,_0x15a654){return db[_0xb06c('0x31')]['find']({'where':{'id':_0x1ad6ec[_0xb06c('0x4c')]['id']}})[_0xb06c('0x2a')](handleEntityNotFound(_0x15a654,null))[_0xb06c('0x2a')](removeEntity(_0x15a654,null))[_0xb06c('0x47')](handleError(_0x15a654,null));};exports[_0xb06c('0x4d')]=function(_0x1338de,_0x1a83b7){return db['UserProfileSection'][_0xb06c('0x4d')]()[_0xb06c('0x2a')](respondWithResult(_0x1a83b7,null))[_0xb06c('0x47')](handleError(_0x1a83b7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index e335f2b..6d97135 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 _0xb671=['user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x282320,_0x379ad6){var _0x271d54=function(_0x5bfe98){while(--_0x5bfe98){_0x282320['push'](_0x282320['shift']());}};_0x271d54(++_0x379ad6);}(_0xb671,0xcf));var _0x1b67=function(_0x1ecec6,_0x30092f){_0x1ecec6=_0x1ecec6-0x0;var _0x29e0b7=_0xb671[_0x1ecec6];return _0x29e0b7;};'use strict';var _=require(_0x1b67('0x0'));var util=require('util');var logger=require(_0x1b67('0x1'))(_0x1b67('0x2'));var moment=require('moment');var BPromise=require(_0x1b67('0x3'));var rp=require(_0x1b67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b67('0x5'));var attributes=require(_0x1b67('0x6'));module[_0x1b67('0x7')]=function(_0x2f79df,_0x32f46a){return _0x2f79df['define'](_0x1b67('0x8'),attributes,{'tableName':_0x1b67('0x9'),'paranoid':![],'indexes':[{'name':_0x1b67('0xa'),'fields':[_0x1b67('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x96dd=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c6b44,_0x5d0506){var _0x3fb4ec=function(_0x3c4e98){while(--_0x3c4e98){_0x5c6b44['push'](_0x5c6b44['shift']());}};_0x3fb4ec(++_0x5d0506);}(_0x96dd,0x1b7));var _0xd96d=function(_0x19b232,_0x374bd8){_0x19b232=_0x19b232-0x0;var _0x3e045e=_0x96dd[_0x19b232];return _0x3e045e;};'use strict';var _=require('lodash');var util=require(_0xd96d('0x0'));var logger=require(_0xd96d('0x1'))(_0xd96d('0x2'));var moment=require(_0xd96d('0x3'));var BPromise=require(_0xd96d('0x4'));var rp=require(_0xd96d('0x5'));var fs=require('fs');var path=require(_0xd96d('0x6'));var rimraf=require(_0xd96d('0x7'));var config=require(_0xd96d('0x8'));var attributes=require(_0xd96d('0x9'));module[_0xd96d('0xa')]=function(_0x55cc30,_0x46f7dc){return _0x55cc30[_0xd96d('0xb')](_0xd96d('0xc'),attributes,{'tableName':_0xd96d('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd96d('0xe'),_0xd96d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f9f0209..d3dc30f 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 _0xa191=['util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x128812,_0x12dfa6){var _0x4103aa=function(_0xeee69c){while(--_0xeee69c){_0x128812['push'](_0x128812['shift']());}};_0x4103aa(++_0x12dfa6);}(_0xa191,0xa7));var _0x1a19=function(_0x7327c4,_0x374e31){_0x7327c4=_0x7327c4-0x0;var _0x2050a3=_0xa191[_0x7327c4];return _0x2050a3;};'use strict';var _=require(_0x1a19('0x0'));var util=require(_0x1a19('0x1'));var moment=require(_0x1a19('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a19('0x3'));var db=require(_0x1a19('0x4'))['db'];var utils=require(_0x1a19('0x5'));var logger=require('../../config/logger')(_0x1a19('0x6'));var config=require(_0x1a19('0x7'));var jayson=require(_0x1a19('0x8'));var client=jayson['client'][_0x1a19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e5fe3,_0x4bf097,_0x1f50d7){return new BPromise(function(_0xe4a0a0,_0xdee0a){return client[_0x1a19('0xa')](_0x1e5fe3,_0x1f50d7)['then'](function(_0x257c2c){logger[_0x1a19('0xb')](_0x1a19('0xc'),_0x4bf097,_0x1a19('0xd'));logger[_0x1a19('0xe')](_0x1a19('0xf'),_0x4bf097,_0x1a19('0xd'),JSON[_0x1a19('0x10')](_0x257c2c));if(_0x257c2c[_0x1a19('0x11')]){if(_0x257c2c[_0x1a19('0x11')][_0x1a19('0x12')]===0x1f4){logger['error'](_0x1a19('0xc'),_0x4bf097,_0x257c2c[_0x1a19('0x11')]['message']);return _0xdee0a(_0x257c2c['error'][_0x1a19('0x13')]);}logger['error'](_0x1a19('0xc'),_0x4bf097,_0x257c2c[_0x1a19('0x11')]['message']);return _0xe4a0a0(_0x257c2c[_0x1a19('0x11')][_0x1a19('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4bf097,_0x1a19('0xd'));_0xe4a0a0(_0x257c2c['result'][_0x1a19('0x13')]);}})[_0x1a19('0x14')](function(_0x229d1f){logger[_0x1a19('0x11')](_0x1a19('0xc'),_0x4bf097,_0x229d1f);_0xdee0a(_0x229d1f);});});} \ No newline at end of file +var _0xfe28=['lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x2e34dd,_0x3c712e){var _0x3d0f55=function(_0x4f901f){while(--_0x4f901f){_0x2e34dd['push'](_0x2e34dd['shift']());}};_0x3d0f55(++_0x3c712e);}(_0xfe28,0x104));var _0x8fe2=function(_0x1c3745,_0x105272){_0x1c3745=_0x1c3745-0x0;var _0x20df0b=_0xfe28[_0x1c3745];return _0x20df0b;};'use strict';var _=require(_0x8fe2('0x0'));var util=require(_0x8fe2('0x1'));var moment=require(_0x8fe2('0x2'));var BPromise=require(_0x8fe2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fe2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8fe2('0x5'))('rpc');var config=require(_0x8fe2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8fe2('0x7')][_0x8fe2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x219779,_0x2f2b5a,_0x53d6a9){return new BPromise(function(_0x12131a,_0x192898){return client[_0x8fe2('0x9')](_0x219779,_0x53d6a9)[_0x8fe2('0xa')](function(_0x2e675c){logger[_0x8fe2('0xb')](_0x8fe2('0xc'),_0x2f2b5a,'request\x20sent');logger[_0x8fe2('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2f2b5a,_0x8fe2('0xe'),JSON[_0x8fe2('0xf')](_0x2e675c));if(_0x2e675c['error']){if(_0x2e675c['error']['code']===0x1f4){logger[_0x8fe2('0x10')](_0x8fe2('0xc'),_0x2f2b5a,_0x2e675c[_0x8fe2('0x10')][_0x8fe2('0x11')]);return _0x192898(_0x2e675c[_0x8fe2('0x10')][_0x8fe2('0x11')]);}logger['error'](_0x8fe2('0xc'),_0x2f2b5a,_0x2e675c['error'][_0x8fe2('0x11')]);return _0x12131a(_0x2e675c['error'][_0x8fe2('0x11')]);}else{logger[_0x8fe2('0xb')](_0x8fe2('0xc'),_0x2f2b5a,_0x8fe2('0xe'));_0x12131a(_0x2e675c[_0x8fe2('0x12')][_0x8fe2('0x11')]);}})[_0x8fe2('0x13')](function(_0x4b1427){logger[_0x8fe2('0x10')](_0x8fe2('0xc'),_0x2f2b5a,_0x4b1427);_0x192898(_0x4b1427);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 438a86b..febcf32 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x310dc2,_0x2299c4){var _0x24980f=function(_0xde9b88){while(--_0xde9b88){_0x310dc2['push'](_0x310dc2['shift']());}};_0x24980f(++_0x2299c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13be12,_0x3331cc){var _0x123542=function(_0x46215e){while(--_0x46215e){_0x13be12['push'](_0x13be12['shift']());}};_0x123542(++_0x3331cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xcb91[_0x5f09c5];return _0x426ad9;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8201a25..4105449 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 _0xa23f=['sequelize','exports'];(function(_0x8e234e,_0x4db9ca){var _0x3b0a62=function(_0x2662bc){while(--_0x2662bc){_0x8e234e['push'](_0x8e234e['shift']());}};_0x3b0a62(++_0x4db9ca);}(_0xa23f,0x7c));var _0xfa23=function(_0x582f05,_0x1a73b0){_0x582f05=_0x582f05-0x0;var _0x351bd7=_0xa23f[_0x582f05];return _0x351bd7;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa969=['sequelize','exports','INTEGER'];(function(_0x1dfdd3,_0x3e1a05){var _0x4dbacf=function(_0x414411){while(--_0x414411){_0x1dfdd3['push'](_0x1dfdd3['shift']());}};_0x4dbacf(++_0x3e1a05);}(_0xa969,0x114));var _0x9a96=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xa969[_0x56daff];return _0x132c82;};'use strict';var Sequelize=require(_0x9a96('0x0'));module[_0x9a96('0x1')]={'penalty':{'type':Sequelize[_0x9a96('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c85fb06..cb63e2a 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 _0x8cad=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x1bd3a1,_0x3e9240){var _0x1c5109=function(_0x491cf1){while(--_0x491cf1){_0x1bd3a1['push'](_0x1bd3a1['shift']());}};_0x1c5109(++_0x3e9240);}(_0x8cad,0xfe));var _0xd8ca=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8cad[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','UserSmsQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x567e55,_0x4968d9){var _0x316288=function(_0x37d48c){while(--_0x37d48c){_0x567e55['push'](_0x567e55['shift']());}};_0x316288(++_0x4968d9);}(_0x524e,0x15e));var _0xe524=function(_0x4e5f31,_0x3854f6){_0x4e5f31=_0x4e5f31-0x0;var _0x31874d=_0x524e[_0x4e5f31];return _0x31874d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),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 6c36061..9a86eab 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 _0x54b1=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','error','code','UserSmsQueue,\x20%s,\x20%s','message'];(function(_0x4a0f9e,_0x29e6bb){var _0x3071ec=function(_0x2b1e72){while(--_0x2b1e72){_0x4a0f9e['push'](_0x4a0f9e['shift']());}};_0x3071ec(++_0x29e6bb);}(_0x54b1,0x157));var _0x154b=function(_0x23a55a,_0x174f92){_0x23a55a=_0x23a55a-0x0;var _0x3f001e=_0x54b1[_0x23a55a];return _0x3f001e;};'use strict';var _=require(_0x154b('0x0'));var util=require(_0x154b('0x1'));var moment=require('moment');var BPromise=require(_0x154b('0x2'));var rs=require(_0x154b('0x3'));var fs=require('fs');var Redis=require(_0x154b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x154b('0x5'));var logger=require('../../config/logger')(_0x154b('0x6'));var config=require('../../config/environment');var jayson=require(_0x154b('0x7'));var client=jayson[_0x154b('0x8')][_0x154b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e955e,_0x53e180,_0x49ae48){return new BPromise(function(_0x12b993,_0x5bf573){return client[_0x154b('0xa')](_0x4e955e,_0x49ae48)[_0x154b('0xb')](function(_0x101ac3){logger[_0x154b('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x53e180,_0x154b('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x53e180,_0x154b('0xd'),JSON['stringify'](_0x101ac3));if(_0x101ac3[_0x154b('0xe')]){if(_0x101ac3[_0x154b('0xe')][_0x154b('0xf')]===0x1f4){logger[_0x154b('0xe')](_0x154b('0x10'),_0x53e180,_0x101ac3['error'][_0x154b('0x11')]);return _0x5bf573(_0x101ac3[_0x154b('0xe')][_0x154b('0x11')]);}logger[_0x154b('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x53e180,_0x101ac3[_0x154b('0xe')][_0x154b('0x11')]);return _0x12b993(_0x101ac3[_0x154b('0xe')][_0x154b('0x11')]);}else{logger[_0x154b('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x53e180,_0x154b('0xd'));_0x12b993(_0x101ac3['result']['message']);}})[_0x154b('0x12')](function(_0x1811df){logger[_0x154b('0xe')](_0x154b('0x10'),_0x53e180,_0x1811df);_0x5bf573(_0x1811df);});});} \ No newline at end of file +var _0xe951=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xe951,0xe3));var _0x1e95=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0xe951[_0x2797c6];return _0x54809f;};'use strict';var _=require(_0x1e95('0x0'));var util=require(_0x1e95('0x1'));var moment=require(_0x1e95('0x2'));var BPromise=require(_0x1e95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e95('0x4'));var db=require(_0x1e95('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e95('0x6'));var config=require(_0x1e95('0x7'));var jayson=require(_0x1e95('0x8'));var client=jayson[_0x1e95('0x9')][_0x1e95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x142fb6,_0x437637,_0x1a3f4f){return new BPromise(function(_0x30d1a2,_0x5ce9c4){return client['request'](_0x142fb6,_0x1a3f4f)['then'](function(_0x2feb8a){logger[_0x1e95('0xb')](_0x1e95('0xc'),_0x437637,_0x1e95('0xd'));logger[_0x1e95('0xe')](_0x1e95('0xf'),_0x437637,'request\x20sent',JSON[_0x1e95('0x10')](_0x2feb8a));if(_0x2feb8a[_0x1e95('0x11')]){if(_0x2feb8a['error'][_0x1e95('0x12')]===0x1f4){logger[_0x1e95('0x11')](_0x1e95('0xc'),_0x437637,_0x2feb8a[_0x1e95('0x11')]['message']);return _0x5ce9c4(_0x2feb8a['error'][_0x1e95('0x13')]);}logger[_0x1e95('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x437637,_0x2feb8a['error'][_0x1e95('0x13')]);return _0x30d1a2(_0x2feb8a[_0x1e95('0x11')]['message']);}else{logger[_0x1e95('0xb')](_0x1e95('0xc'),_0x437637,_0x1e95('0xd'));_0x30d1a2(_0x2feb8a[_0x1e95('0x14')][_0x1e95('0x13')]);}})[_0x1e95('0x15')](function(_0x26f0d7){logger[_0x1e95('0x11')](_0x1e95('0xc'),_0x437637,_0x26f0d7);_0x5ce9c4(_0x26f0d7);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2a56f00..250c1fd 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 _0xecae=['sequelize','INTEGER'];(function(_0xaee442,_0x4bbdd7){var _0x18dd11=function(_0x234ce9){while(--_0x234ce9){_0xaee442['push'](_0xaee442['shift']());}};_0x18dd11(++_0x4bbdd7);}(_0xecae,0x172));var _0xeeca=function(_0x1e4000,_0x4e5ce8){_0x1e4000=_0x1e4000-0x0;var _0x2774bb=_0xecae[_0x1e4000];return _0x2774bb;};'use strict';var Sequelize=require(_0xeeca('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xeeca('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xeeca('0x1')]}}; \ No newline at end of file +var _0x802c=['exports','INTEGER','sequelize'];(function(_0x574ed2,_0xc41542){var _0x5604fa=function(_0x325641){while(--_0x325641){_0x574ed2['push'](_0x574ed2['shift']());}};_0x5604fa(++_0xc41542);}(_0x802c,0xbf));var _0xc802=function(_0x5dd3b1,_0x2e259b){_0x5dd3b1=_0x5dd3b1-0x0;var _0x2af759=_0x802c[_0x5dd3b1];return _0x2af759;};'use strict';var Sequelize=require(_0xc802('0x0'));module[_0xc802('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc802('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c03e2a7..d64c966 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(_0x2f9ef8,_0x4813e8){var _0x2fd046=function(_0x11ad85){while(--_0x11ad85){_0x2f9ef8['push'](_0x2f9ef8['shift']());}};_0x2fd046(++_0x4813e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x17b8b,_0x324533){var _0x5f1c7f=function(_0x4cda81){while(--_0x4cda81){_0x17b8b['push'](_0x17b8b['shift']());}};_0x5f1c7f(++_0x324533);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 6ef880e..697d7b0 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x461d52,_0x43604b){var _0x25d252=function(_0x3bdc91){while(--_0x3bdc91){_0x461d52['push'](_0x461d52['shift']());}};_0x25d252(++_0x43604b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x352335,_0x2736e5){var _0x1e1cf2=function(_0x3eac6a){while(--_0x3eac6a){_0x352335['push'](_0x352335['shift']());}};_0x1e1cf2(++_0x2736e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x51d772,_0x10eb04){_0x51d772=_0x51d772-0x0;var _0x42bae8=_0xedd9[_0x51d772];return _0x42bae8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 80f6bc4..1160bbb 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 _0xc7fb=['exports','INTEGER','sequelize'];(function(_0x5b5cd4,_0x443680){var _0x39b05e=function(_0x36a5d3){while(--_0x36a5d3){_0x5b5cd4['push'](_0x5b5cd4['shift']());}};_0x39b05e(++_0x443680);}(_0xc7fb,0x68));var _0xbc7f=function(_0x4de00f,_0x254d09){_0x4de00f=_0x4de00f-0x0;var _0x27ec34=_0xc7fb[_0x4de00f];return _0x27ec34;};'use strict';var Sequelize=require(_0xbc7f('0x0'));module[_0xbc7f('0x1')]={'penalty':{'type':Sequelize[_0xbc7f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1fd9=['sequelize','exports','INTEGER'];(function(_0xce0ab0,_0x4b9099){var _0x970b25=function(_0x5be2db){while(--_0x5be2db){_0xce0ab0['push'](_0xce0ab0['shift']());}};_0x970b25(++_0x4b9099);}(_0x1fd9,0x19b));var _0x91fd=function(_0x61dac9,_0x3ea226){_0x61dac9=_0x61dac9-0x0;var _0x5ca555=_0x1fd9[_0x61dac9];return _0x5ca555;};'use strict';var Sequelize=require(_0x91fd('0x0'));module[_0x91fd('0x1')]={'penalty':{'type':Sequelize[_0x91fd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e2af961..5bc2cb0 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 _0x1c92=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x1c92,0x1df));var _0x21c9=function(_0x159c68,_0xc544c9){_0x159c68=_0x159c68-0x0;var _0x32792f=_0x1c92[_0x159c68];return _0x32792f;};'use strict';var _=require(_0x21c9('0x0'));var util=require(_0x21c9('0x1'));var logger=require(_0x21c9('0x2'))(_0x21c9('0x3'));var moment=require(_0x21c9('0x4'));var BPromise=require(_0x21c9('0x5'));var rp=require(_0x21c9('0x6'));var fs=require('fs');var path=require(_0x21c9('0x7'));var rimraf=require(_0x21c9('0x8'));var config=require(_0x21c9('0x9'));var attributes=require(_0x21c9('0xa'));module[_0x21c9('0xb')]=function(_0x525f1c,_0xaad137){return _0x525f1c[_0x21c9('0xc')](_0x21c9('0xd'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde6b=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x399a59,_0x2aab0f){var _0x2e70b8=function(_0x3d5ed7){while(--_0x3d5ed7){_0x399a59['push'](_0x399a59['shift']());}};_0x2e70b8(++_0x2aab0f);}(_0xde6b,0x88));var _0xbde6=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xde6b[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xbde6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbde6('0x1'));var moment=require(_0xbde6('0x2'));var BPromise=require(_0xbde6('0x3'));var rp=require(_0xbde6('0x4'));var fs=require('fs');var path=require(_0xbde6('0x5'));var rimraf=require(_0xbde6('0x6'));var config=require(_0xbde6('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xbde6('0x8')]=function(_0x5f486b,_0x93cfd0){return _0x5f486b[_0xbde6('0x9')](_0xbde6('0xa'),attributes,{'tableName':_0xbde6('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 9b1ea5f..a787fbd 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 _0xc3fe=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x3d5a66,_0x44117d){var _0x440dd6=function(_0x5256da){while(--_0x5256da){_0x3d5a66['push'](_0x3d5a66['shift']());}};_0x440dd6(++_0x44117d);}(_0xc3fe,0x158));var _0xec3f=function(_0x106fa3,_0xdf70dd){_0x106fa3=_0x106fa3-0x0;var _0x23305d=_0xc3fe[_0x106fa3];return _0x23305d;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require(_0xec3f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec3f('0x5'));var logger=require('../../config/logger')(_0xec3f('0x6'));var config=require(_0xec3f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xec3f('0x8')][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x279396,_0xf74445,_0x318a80){return new BPromise(function(_0x5d4b20,_0x5c71eb){return client[_0xec3f('0xa')](_0x279396,_0x318a80)[_0xec3f('0xb')](function(_0x454691){logger[_0xec3f('0xc')](_0xec3f('0xd'),_0xf74445,_0xec3f('0xe'));logger['debug'](_0xec3f('0xf'),_0xf74445,_0xec3f('0xe'),JSON[_0xec3f('0x10')](_0x454691));if(_0x454691[_0xec3f('0x11')]){if(_0x454691[_0xec3f('0x11')][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0xd'),_0xf74445,_0x454691['error'][_0xec3f('0x13')]);return _0x5c71eb(_0x454691[_0xec3f('0x11')][_0xec3f('0x13')]);}logger['error'](_0xec3f('0xd'),_0xf74445,_0x454691[_0xec3f('0x11')][_0xec3f('0x13')]);return _0x5d4b20(_0x454691[_0xec3f('0x11')][_0xec3f('0x13')]);}else{logger['info'](_0xec3f('0xd'),_0xf74445,_0xec3f('0xe'));_0x5d4b20(_0x454691[_0xec3f('0x14')][_0xec3f('0x13')]);}})[_0xec3f('0x15')](function(_0x1b2b6a){logger['error'](_0xec3f('0xd'),_0xf74445,_0x1b2b6a);_0x5c71eb(_0x1b2b6a);});});} \ No newline at end of file +var _0xd5ed=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xd5ed,0xef));var _0xdd5e=function(_0x44cab8,_0x454fc7){_0x44cab8=_0x44cab8-0x0;var _0x1cf930=_0xd5ed[_0x44cab8];return _0x1cf930;};'use strict';var _=require(_0xdd5e('0x0'));var util=require(_0xdd5e('0x1'));var moment=require(_0xdd5e('0x2'));var BPromise=require(_0xdd5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd5e('0x4'));var db=require(_0xdd5e('0x5'))['db'];var utils=require(_0xdd5e('0x6'));var logger=require(_0xdd5e('0x7'))(_0xdd5e('0x8'));var config=require(_0xdd5e('0x9'));var jayson=require(_0xdd5e('0xa'));var client=jayson['client'][_0xdd5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdea65e,_0x58547f,_0x2d1e48){return new BPromise(function(_0x11bfb0,_0x19ab55){return client[_0xdd5e('0xc')](_0xdea65e,_0x2d1e48)[_0xdd5e('0xd')](function(_0x567c7b){logger[_0xdd5e('0xe')](_0xdd5e('0xf'),_0x58547f,'request\x20sent');logger['debug'](_0xdd5e('0x10'),_0x58547f,'request\x20sent',JSON[_0xdd5e('0x11')](_0x567c7b));if(_0x567c7b[_0xdd5e('0x12')]){if(_0x567c7b[_0xdd5e('0x12')][_0xdd5e('0x13')]===0x1f4){logger[_0xdd5e('0x12')](_0xdd5e('0xf'),_0x58547f,_0x567c7b['error'][_0xdd5e('0x14')]);return _0x19ab55(_0x567c7b[_0xdd5e('0x12')][_0xdd5e('0x14')]);}logger[_0xdd5e('0x12')](_0xdd5e('0xf'),_0x58547f,_0x567c7b[_0xdd5e('0x12')][_0xdd5e('0x14')]);return _0x11bfb0(_0x567c7b[_0xdd5e('0x12')]['message']);}else{logger[_0xdd5e('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x58547f,_0xdd5e('0x15'));_0x11bfb0(_0x567c7b[_0xdd5e('0x16')]['message']);}})[_0xdd5e('0x17')](function(_0xf056ce){logger['error'](_0xdd5e('0xf'),_0x58547f,_0xf056ce);_0x19ab55(_0xf056ce);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 67c0b86..bea4032 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1790a1,_0x12ec32){var _0x4a1dbb=function(_0x1380fa){while(--_0x1380fa){_0x1790a1['push'](_0x1790a1['shift']());}};_0x4a1dbb(++_0x12ec32);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xcb91[_0x209fcd];return _0x501d5e;};'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(_0x4a6339,_0x30cd3a){var _0x5e9a19=function(_0x4ac2b4){while(--_0x4ac2b4){_0x4a6339['push'](_0x4a6339['shift']());}};_0x5e9a19(++_0x30cd3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 41a9ad1..776a31e 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 _0x1a1e=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3ec6f4,_0xac304b){var _0x323b86=function(_0x3b0268){while(--_0x3b0268){_0x3ec6f4['push'](_0x3ec6f4['shift']());}};_0x323b86(++_0xac304b);}(_0x1a1e,0x68));var _0xe1a1=function(_0x232b67,_0x3dc89e){_0x232b67=_0x232b67-0x0;var _0x39fcc0=_0x1a1e[_0x232b67];return _0x39fcc0;};'use strict';var Sequelize=require(_0xe1a1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe1a1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe1a1('0x2')},'membername':{'type':Sequelize[_0xe1a1('0x3')],'allowNull':![],'comment':_0xe1a1('0x2')},'UserId':{'type':Sequelize[_0xe1a1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe1a1('0x4'),'comment':_0xe1a1('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe1a1('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe1a1('0x3')],'allowNull':![],'unique':_0xe1a1('0x4'),'comment':_0xe1a1('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe1a1('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xf586=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xf586,0x124));var _0x6f58=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0xf586[_0x2ce286];return _0x4c471f;};'use strict';var Sequelize=require(_0x6f58('0x0'));module[_0x6f58('0x1')]={'uniqueid':{'type':Sequelize[_0x6f58('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6f58('0x3')},'membername':{'type':Sequelize[_0x6f58('0x4')],'allowNull':![],'comment':_0x6f58('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6f58('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6f58('0x4')],'allowNull':![],'unique':_0x6f58('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x6f58('0x2')](0xb),'defaultValue':0x0,'comment':_0x6f58('0x3')},'paused':{'type':Sequelize[_0x6f58('0x2')](0xb),'defaultValue':0x0,'comment':_0x6f58('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1f7b780..fe8b368 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 _0xd1aa=['events','../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','exports'];(function(_0x3cb59d,_0x443cd4){var _0x1cd929=function(_0x24bee0){while(--_0x24bee0){_0x3cb59d['push'](_0x3cb59d['shift']());}};_0x1cd929(++_0x443cd4);}(_0xd1aa,0x140));var _0xad1a=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xd1aa[_0x4a0e68];return _0x4fb274;};'use strict';var EventEmitter=require(_0xad1a('0x0'));var UserVoiceQueueRt=require(_0xad1a('0x1'))['db'][_0xad1a('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad1a('0x3'),'afterDestroy':_0xad1a('0x4')};function emitEvent(_0x7a68dd){return function(_0xa24a6e,_0x59e2bc,_0x2876ba){UserVoiceQueueRtEvents[_0xad1a('0x5')](_0x7a68dd+':'+_0xa24a6e['id'],_0xa24a6e);UserVoiceQueueRtEvents[_0xad1a('0x5')](_0x7a68dd,_0xa24a6e);_0x2876ba(null);};}for(var e in events){if(events[_0xad1a('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xad1a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x704e=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x47643e,_0x337374){var _0x2aa5db=function(_0x5dcbf2){while(--_0x5dcbf2){_0x47643e['push'](_0x47643e['shift']());}};_0x2aa5db(++_0x337374);}(_0x704e,0x98));var _0xe704=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x704e[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe704('0x0'))['db'][_0xe704('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe704('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2abe43){return function(_0x42576d,_0x4d39e4,_0x52aa1e){UserVoiceQueueRtEvents[_0xe704('0x3')](_0x2abe43+':'+_0x42576d['id'],_0x42576d);UserVoiceQueueRtEvents['emit'](_0x2abe43,_0x42576d);_0x52aa1e(null);};}for(var e in events){if(events[_0xe704('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xe704('0x5')](e,emitEvent(event));}}module[_0xe704('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3bb19da..e88ea3a 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 _0x75df=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment'];(function(_0x177516,_0xf5d053){var _0x57f471=function(_0x5b588a){while(--_0x5b588a){_0x177516['push'](_0x177516['shift']());}};_0x57f471(++_0xf5d053);}(_0x75df,0x140));var _0xf75d=function(_0x5e57c4,_0x822859){_0x5e57c4=_0x5e57c4-0x0;var _0xb3e0f6=_0x75df[_0x5e57c4];return _0xb3e0f6;};'use strict';var _=require(_0xf75d('0x0'));var util=require('util');var logger=require(_0xf75d('0x1'))(_0xf75d('0x2'));var moment=require(_0xf75d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf75d('0x4'));var fs=require('fs');var path=require(_0xf75d('0x5'));var rimraf=require(_0xf75d('0x6'));var config=require(_0xf75d('0x7'));var attributes=require(_0xf75d('0x8'));module[_0xf75d('0x9')]=function(_0x1b5454,_0x11df21){return _0x1b5454[_0xf75d('0xa')](_0xf75d('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f67=['../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x2e0901,_0x1613e8){var _0x376e82=function(_0x5d8012){while(--_0x5d8012){_0x2e0901['push'](_0x2e0901['shift']());}};_0x376e82(++_0x1613e8);}(_0x7f67,0x16f));var _0x77f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7f67[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x77f6('0x0'));var util=require(_0x77f6('0x1'));var logger=require('../../config/logger')(_0x77f6('0x2'));var moment=require(_0x77f6('0x3'));var BPromise=require(_0x77f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77f6('0x5'));var rimraf=require(_0x77f6('0x6'));var config=require(_0x77f6('0x7'));var attributes=require(_0x77f6('0x8'));module['exports']=function(_0x145201,_0x12d043){return _0x145201['define'](_0x77f6('0x9'),attributes,{'tableName':_0x77f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index c495d19..1417cef 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 _0xad08=['literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT'];(function(_0x5ade39,_0x935b0b){var _0x20e492=function(_0x22c6f6){while(--_0x22c6f6){_0x5ade39['push'](_0x5ade39['shift']());}};_0x20e492(++_0x935b0b);}(_0xad08,0x147));var _0x8ad0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xad08[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var moment=require(_0x8ad0('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ad0('0x3'));var fs=require('fs');var Redis=require(_0x8ad0('0x4'));var db=require(_0x8ad0('0x5'))['db'];var utils=require(_0x8ad0('0x6'));var logger=require(_0x8ad0('0x7'))('rpc');var config=require(_0x8ad0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ad0('0x9')]['http']({'port':0x232a});config[_0x8ad0('0xa')]=_['defaults'](config['redis'],{'host':_0x8ad0('0xb'),'port':0x18eb});var socket=require(_0x8ad0('0xc'))(new Redis(config[_0x8ad0('0xa')]));require('./userVoiceQueueRt.socket')[_0x8ad0('0xd')](socket);function respondWithRpcPromise(_0x31e68d,_0x122128,_0x4db12d){return new BPromise(function(_0x1a1d5e,_0x4b2003){return client['request'](_0x31e68d,_0x4db12d)[_0x8ad0('0xe')](function(_0x3ec9c7){logger[_0x8ad0('0xf')](_0x8ad0('0x10'),_0x122128,_0x8ad0('0x11'));logger[_0x8ad0('0x12')](_0x8ad0('0x13'),_0x122128,_0x8ad0('0x11'),JSON[_0x8ad0('0x14')](_0x3ec9c7));if(_0x3ec9c7[_0x8ad0('0x15')]){if(_0x3ec9c7[_0x8ad0('0x15')][_0x8ad0('0x16')]===0x1f4){logger[_0x8ad0('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x122128,_0x3ec9c7[_0x8ad0('0x15')]['message']);return _0x4b2003(_0x3ec9c7[_0x8ad0('0x15')][_0x8ad0('0x17')]);}logger[_0x8ad0('0x15')](_0x8ad0('0x10'),_0x122128,_0x3ec9c7[_0x8ad0('0x15')][_0x8ad0('0x17')]);return _0x1a1d5e(_0x3ec9c7[_0x8ad0('0x15')][_0x8ad0('0x17')]);}else{logger['info'](_0x8ad0('0x10'),_0x122128,_0x8ad0('0x11'));_0x1a1d5e(_0x3ec9c7['result'][_0x8ad0('0x17')]);}})[_0x8ad0('0x18')](function(_0x394a96){logger['error'](_0x8ad0('0x10'),_0x122128,_0x394a96);_0x4b2003(_0x394a96);});});}exports[_0x8ad0('0x19')]=function(_0x31c2dc){var _0x535512=this;return new Promise(function(_0x1f244e,_0x44b1ac){return db[_0x8ad0('0x1a')][_0x8ad0('0x1b')]({'raw':_0x31c2dc[_0x8ad0('0x1c')]?_0x31c2dc[_0x8ad0('0x1c')][_0x8ad0('0x1d')]===undefined?!![]:![]:!![],'where':_0x31c2dc[_0x8ad0('0x1c')]?_0x31c2dc['options'][_0x8ad0('0x1e')]||null:null,'attributes':[[db[_0x8ad0('0x1f')]['fn'](_0x8ad0('0x20'),db[_0x8ad0('0x1f')]['fn']('IF',db[_0x8ad0('0x1f')][_0x8ad0('0x21')](_0x8ad0('0x22')))),_0x8ad0('0x23')]]})[_0x8ad0('0xe')](function(_0x4dff31){logger[_0x8ad0('0xf')](_0x8ad0('0x19'),_0x31c2dc);logger['debug'](_0x8ad0('0x19'),_0x31c2dc,JSON[_0x8ad0('0x14')](_0x4dff31));_0x1f244e(_0x4dff31);})[_0x8ad0('0x18')](function(_0x472d1b){logger['error'](_0x8ad0('0x19'),_0x472d1b[_0x8ad0('0x17')],_0x31c2dc);_0x44b1ac(_0x535512[_0x8ad0('0x15')](0x1f4,_0x472d1b['message']));});});}; \ No newline at end of file +var _0x53c8=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','code','error','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x53c8,0x1a3));var _0x853c=function(_0x86337d,_0x2b57c3){_0x86337d=_0x86337d-0x0;var _0x22b2c6=_0x53c8[_0x86337d];return _0x22b2c6;};'use strict';var _=require(_0x853c('0x0'));var util=require(_0x853c('0x1'));var moment=require(_0x853c('0x2'));var BPromise=require('bluebird');var rs=require(_0x853c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x853c('0x4'))['db'];var utils=require(_0x853c('0x5'));var logger=require(_0x853c('0x6'))(_0x853c('0x7'));var config=require('../../config/environment');var jayson=require(_0x853c('0x8'));var client=jayson[_0x853c('0x9')][_0x853c('0xa')]({'port':0x232a});config[_0x853c('0xb')]=_[_0x853c('0xc')](config['redis'],{'host':_0x853c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x853c('0xe')](socket);function respondWithRpcPromise(_0x5154e0,_0x576b05,_0x2e3417){return new BPromise(function(_0x4379ef,_0x220dcf){return client[_0x853c('0xf')](_0x5154e0,_0x2e3417)[_0x853c('0x10')](function(_0x14f65c){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x576b05,_0x853c('0x11'));logger[_0x853c('0x12')](_0x853c('0x13'),_0x576b05,_0x853c('0x11'),JSON['stringify'](_0x14f65c));if(_0x14f65c['error']){if(_0x14f65c['error'][_0x853c('0x14')]===0x1f4){logger[_0x853c('0x15')](_0x853c('0x16'),_0x576b05,_0x14f65c[_0x853c('0x15')]['message']);return _0x220dcf(_0x14f65c['error']['message']);}logger[_0x853c('0x15')](_0x853c('0x16'),_0x576b05,_0x14f65c[_0x853c('0x15')][_0x853c('0x17')]);return _0x4379ef(_0x14f65c[_0x853c('0x15')][_0x853c('0x17')]);}else{logger[_0x853c('0x18')](_0x853c('0x16'),_0x576b05,_0x853c('0x11'));_0x4379ef(_0x14f65c[_0x853c('0x19')][_0x853c('0x17')]);}})[_0x853c('0x1a')](function(_0x49e229){logger['error'](_0x853c('0x16'),_0x576b05,_0x49e229);_0x220dcf(_0x49e229);});});}exports[_0x853c('0x1b')]=function(_0x30f5d4){var _0x496c69=this;return new Promise(function(_0x52ea05,_0x56b614){return db[_0x853c('0x1c')]['findAll']({'raw':_0x30f5d4['options']?_0x30f5d4[_0x853c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x30f5d4['options']?_0x30f5d4[_0x853c('0x1d')][_0x853c('0x1e')]||null:null,'attributes':[[db[_0x853c('0x1f')]['fn']('COUNT',db[_0x853c('0x1f')]['fn']('IF',db[_0x853c('0x1f')][_0x853c('0x20')](_0x853c('0x21')))),_0x853c('0x22')]]})[_0x853c('0x10')](function(_0x1e1290){logger[_0x853c('0x18')](_0x853c('0x1b'),_0x30f5d4);logger['debug'](_0x853c('0x1b'),_0x30f5d4,JSON['stringify'](_0x1e1290));_0x52ea05(_0x1e1290);})[_0x853c('0x1a')](function(_0x3431c1){logger[_0x853c('0x15')](_0x853c('0x1b'),_0x3431c1['message'],_0x30f5d4);_0x56b614(_0x496c69[_0x853c('0x15')](0x1f4,_0x3431c1[_0x853c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index b074e41..a6f8fc4 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 _0x0e76=['emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update'];(function(_0xb4ec3a,_0x2bace0){var _0x1b83db=function(_0x5278f3){while(--_0x5278f3){_0xb4ec3a['push'](_0xb4ec3a['shift']());}};_0x1b83db(++_0x2bace0);}(_0x0e76,0xc4));var _0x60e7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x0e76[_0x40220a];return _0x3903cc;};'use strict';var UserVoiceQueueRtEvents=require(_0x60e7('0x0'));var events=['save','remove',_0x60e7('0x1')];function createListener(_0x4d71bb,_0x21402c){return function(_0x6f8f6e){_0x21402c[_0x60e7('0x2')](_0x4d71bb,_0x6f8f6e);};}function removeListener(_0xd3886,_0x2f1ad1){return function(){UserVoiceQueueRtEvents['removeListener'](_0xd3886,_0x2f1ad1);};}exports[_0x60e7('0x3')]=function(_0x35b628){for(var _0x1fb45c=0x0,_0xba29ef=events[_0x60e7('0x4')];_0x1fb45c<_0xba29ef;_0x1fb45c++){var _0x194535=events[_0x1fb45c];var _0x4a15f2=createListener(_0x60e7('0x5')+_0x194535,_0x35b628);UserVoiceQueueRtEvents['on'](_0x194535,_0x4a15f2);}}; \ No newline at end of file +var _0x78b7=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit'];(function(_0x338bc2,_0x561c34){var _0x41cfad=function(_0x138d46){while(--_0x138d46){_0x338bc2['push'](_0x338bc2['shift']());}};_0x41cfad(++_0x561c34);}(_0x78b7,0x194));var _0x778b=function(_0x26a94a,_0x4e7929){_0x26a94a=_0x26a94a-0x0;var _0x24da7f=_0x78b7[_0x26a94a];return _0x24da7f;};'use strict';var UserVoiceQueueRtEvents=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(){UserVoiceQueueRtEvents[_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);UserVoiceQueueRtEvents['on'](_0x49a27a,_0x3fba10);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a140623..9aebc79 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(_0x39dae4,_0x58a305){var _0x39ab08=function(_0x1ceb0c){while(--_0x1ceb0c){_0x39dae4['push'](_0x39dae4['shift']());}};_0x39ab08(++_0x58a305);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e0d86,_0x478c01){var _0x5210f4=function(_0x1c2fb3){while(--_0x1c2fb3){_0x4e0d86['push'](_0x4e0d86['shift']());}};_0x5210f4(++_0x478c01);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xcb91[_0x228ac9];return _0x69fe02;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c10f795..12882e6 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 _0xefe2=['sequelize','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xefe2,0x178));var _0x2efe=function(_0x4b97e5,_0x51d6fc){_0x4b97e5=_0x4b97e5-0x0;var _0x274a2b=_0xefe2[_0x4b97e5];return _0x274a2b;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x737f=['exports','sequelize'];(function(_0x6c464b,_0xc2daaf){var _0x3947b9=function(_0x3cce26){while(--_0x3cce26){_0x6c464b['push'](_0x6c464b['shift']());}};_0x3947b9(++_0xc2daaf);}(_0x737f,0x79));var _0xf737=function(_0x3e40ce,_0x3fcf80){_0x3e40ce=_0x3e40ce-0x0;var _0x38d26e=_0x737f[_0x3e40ce];return _0x38d26e;};'use strict';var Sequelize=require(_0xf737('0x0'));module[_0xf737('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 65efe7e..5c1c604 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 _0x4c85=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15e200,_0xcfc491){var _0x1977c0=function(_0x42d27d){while(--_0x42d27d){_0x15e200['push'](_0x15e200['shift']());}};_0x1977c0(++_0xcfc491);}(_0x4c85,0x171));var _0x54c8=function(_0x2aec45,_0xb11d2a){_0x2aec45=_0x2aec45-0x0;var _0x865cf0=_0x4c85[_0x2aec45];return _0x865cf0;};'use strict';var _=require(_0x54c8('0x0'));var util=require(_0x54c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x54c8('0x2'));var BPromise=require(_0x54c8('0x3'));var rp=require(_0x54c8('0x4'));var fs=require('fs');var path=require(_0x54c8('0x5'));var rimraf=require(_0x54c8('0x6'));var config=require(_0x54c8('0x7'));var attributes=require(_0x54c8('0x8'));module[_0x54c8('0x9')]=function(_0x2c2219,_0x46be4b){return _0x2c2219[_0x54c8('0xa')](_0x54c8('0xb'),attributes,{'tableName':_0x54c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6842=['bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment'];(function(_0x202f58,_0x2b90f2){var _0xd424d9=function(_0x34cb9a){while(--_0x34cb9a){_0x202f58['push'](_0x202f58['shift']());}};_0xd424d9(++_0x2b90f2);}(_0x6842,0xf3));var _0x2684=function(_0x47e0cc,_0x5a0057){_0x47e0cc=_0x47e0cc-0x0;var _0x513c3e=_0x6842[_0x47e0cc];return _0x513c3e;};'use strict';var _=require(_0x2684('0x0'));var util=require(_0x2684('0x1'));var logger=require(_0x2684('0x2'))('api');var moment=require(_0x2684('0x3'));var BPromise=require(_0x2684('0x4'));var rp=require(_0x2684('0x5'));var fs=require('fs');var path=require(_0x2684('0x6'));var rimraf=require(_0x2684('0x7'));var config=require('../../config/environment');var attributes=require(_0x2684('0x8'));module[_0x2684('0x9')]=function(_0x4a4d9a,_0x19d57e){return _0x4a4d9a[_0x2684('0xa')](_0x2684('0xb'),attributes,{'tableName':_0x2684('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 57b41ac..9dbb548 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 _0x5883=['info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d9ed0,_0x21858f){var _0x585fff=function(_0x3e277a){while(--_0x3e277a){_0x2d9ed0['push'](_0x2d9ed0['shift']());}};_0x585fff(++_0x21858f);}(_0x5883,0x1ec));var _0x3588=function(_0x45093c,_0x4ce9e5){_0x45093c=_0x45093c-0x0;var _0x334d94=_0x5883[_0x45093c];return _0x334d94;};'use strict';var _=require(_0x3588('0x0'));var util=require(_0x3588('0x1'));var moment=require(_0x3588('0x2'));var BPromise=require(_0x3588('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3588('0x4'))['db'];var utils=require(_0x3588('0x5'));var logger=require(_0x3588('0x6'))('rpc');var config=require(_0x3588('0x7'));var jayson=require(_0x3588('0x8'));var client=jayson[_0x3588('0x9')][_0x3588('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48f112,_0x131a49,_0x44f589){return new BPromise(function(_0x556139,_0x9f71cf){return client[_0x3588('0xb')](_0x48f112,_0x44f589)['then'](function(_0x39b5b4){logger[_0x3588('0xc')](_0x3588('0xd'),_0x131a49,_0x3588('0xe'));logger['debug'](_0x3588('0xf'),_0x131a49,_0x3588('0xe'),JSON[_0x3588('0x10')](_0x39b5b4));if(_0x39b5b4['error']){if(_0x39b5b4[_0x3588('0x11')][_0x3588('0x12')]===0x1f4){logger['error'](_0x3588('0xd'),_0x131a49,_0x39b5b4[_0x3588('0x11')][_0x3588('0x13')]);return _0x9f71cf(_0x39b5b4[_0x3588('0x11')]['message']);}logger[_0x3588('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x131a49,_0x39b5b4['error'][_0x3588('0x13')]);return _0x556139(_0x39b5b4[_0x3588('0x11')][_0x3588('0x13')]);}else{logger[_0x3588('0xc')](_0x3588('0xd'),_0x131a49,'request\x20sent');_0x556139(_0x39b5b4[_0x3588('0x14')][_0x3588('0x13')]);}})['catch'](function(_0x5de05c){logger[_0x3588('0x11')](_0x3588('0xd'),_0x131a49,_0x5de05c);_0x9f71cf(_0x5de05c);});});} \ No newline at end of file +var _0xeabe=['error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50295f,_0x3f6e1d){var _0x31b4f5=function(_0x476ab9){while(--_0x476ab9){_0x50295f['push'](_0x50295f['shift']());}};_0x31b4f5(++_0x3f6e1d);}(_0xeabe,0x1f2));var _0xeeab=function(_0x4590cf,_0xc7ba09){_0x4590cf=_0x4590cf-0x0;var _0x36bd08=_0xeabe[_0x4590cf];return _0x36bd08;};'use strict';var _=require(_0xeeab('0x0'));var util=require('util');var moment=require(_0xeeab('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeab('0x2'));var fs=require('fs');var Redis=require(_0xeeab('0x3'));var db=require(_0xeeab('0x4'))['db'];var utils=require(_0xeeab('0x5'));var logger=require('../../config/logger')(_0xeeab('0x6'));var config=require(_0xeeab('0x7'));var jayson=require(_0xeeab('0x8'));var client=jayson[_0xeeab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa672,_0x506855,_0x557a70){return new BPromise(function(_0x285c0,_0x44db8d){return client['request'](_0x4aa672,_0x557a70)['then'](function(_0x3c82d9){logger['info'](_0xeeab('0xa'),_0x506855,_0xeeab('0xb'));logger[_0xeeab('0xc')](_0xeeab('0xd'),_0x506855,_0xeeab('0xb'),JSON[_0xeeab('0xe')](_0x3c82d9));if(_0x3c82d9[_0xeeab('0xf')]){if(_0x3c82d9[_0xeeab('0xf')][_0xeeab('0x10')]===0x1f4){logger[_0xeeab('0xf')](_0xeeab('0xa'),_0x506855,_0x3c82d9[_0xeeab('0xf')][_0xeeab('0x11')]);return _0x44db8d(_0x3c82d9[_0xeeab('0xf')]['message']);}logger[_0xeeab('0xf')](_0xeeab('0xa'),_0x506855,_0x3c82d9[_0xeeab('0xf')][_0xeeab('0x11')]);return _0x285c0(_0x3c82d9[_0xeeab('0xf')][_0xeeab('0x11')]);}else{logger['info'](_0xeeab('0xa'),_0x506855,_0xeeab('0xb'));_0x285c0(_0x3c82d9['result'][_0xeeab('0x11')]);}})[_0xeeab('0x12')](function(_0x510093){logger[_0xeeab('0xf')](_0xeeab('0xa'),_0x506855,_0x510093);_0x44db8d(_0x510093);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e87226e..ec352b8 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 _0x579c=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x5c4937,_0x304d0a){var _0x2309b7=function(_0x5998d0){while(--_0x5998d0){_0x5c4937['push'](_0x5c4937['shift']());}};_0x2309b7(++_0x304d0a);}(_0x579c,0xda));var _0xc579=function(_0x1ce544,_0x5ecac6){_0x1ce544=_0x1ce544-0x0;var _0x2b3927=_0x579c[_0x1ce544];return _0x2b3927;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/:id',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0xd')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0xf')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller['update']);router[_0xc579('0x11')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller[_0xc579('0x12')]);module[_0xc579('0x13')]=router; \ No newline at end of file +var _0x3fb7=['./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x18d091,_0x4961f6){var _0x12fc59=function(_0x4ea0b4){while(--_0x4ea0b4){_0x18d091['push'](_0x18d091['shift']());}};_0x12fc59(++_0x4961f6);}(_0x3fb7,0x189));var _0x73fb=function(_0x3724ba,_0x259b80){_0x3724ba=_0x3724ba-0x0;var _0x149fbb=_0x3fb7[_0x3724ba];return _0x149fbb;};'use strict';var multer=require('multer');var util=require(_0x73fb('0x0'));var path=require('path');var timeout=require(_0x73fb('0x1'));var express=require(_0x73fb('0x2'));var router=express['Router']();var fs_extra=require(_0x73fb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x73fb('0x4'));var config=require(_0x73fb('0x5'));var controller=require(_0x73fb('0x6'));router[_0x73fb('0x7')]('/',auth[_0x73fb('0x8')](),controller[_0x73fb('0x9')]);router[_0x73fb('0x7')](_0x73fb('0xa'),auth[_0x73fb('0x8')](),controller[_0x73fb('0xb')]);router[_0x73fb('0xc')]('/',auth[_0x73fb('0x8')](),controller[_0x73fb('0xd')]);router[_0x73fb('0xe')](_0x73fb('0xa'),auth[_0x73fb('0x8')](),controller[_0x73fb('0xf')]);router[_0x73fb('0x10')](_0x73fb('0xa'),auth[_0x73fb('0x8')](),controller[_0x73fb('0x11')]);module[_0x73fb('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 527b148..8d1c4c9 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 _0x3379=['name','sequelize','exports','STRING'];(function(_0xfb4365,_0xd18f10){var _0x109516=function(_0x3cbfda){while(--_0x3cbfda){_0xfb4365['push'](_0xfb4365['shift']());}};_0x109516(++_0xd18f10);}(_0x3379,0x115));var _0x9337=function(_0x3a5e72,_0x5111f9){_0x3a5e72=_0x3a5e72-0x0;var _0x2d6286=_0x3379[_0x3a5e72];return _0x2d6286;};'use strict';var Sequelize=require(_0x9337('0x0'));module[_0x9337('0x1')]={'name':{'type':Sequelize[_0x9337('0x2')],'unique':_0x9337('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4588=['name','sequelize','exports','STRING'];(function(_0x410765,_0x52f6b8){var _0x5e91f1=function(_0xe019c4){while(--_0xe019c4){_0x410765['push'](_0x410765['shift']());}};_0x5e91f1(++_0x52f6b8);}(_0x4588,0x179));var _0x8458=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x4588[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require(_0x8458('0x0'));module[_0x8458('0x1')]={'name':{'type':Sequelize[_0x8458('0x2')],'unique':_0x8458('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 28c85a6..5ec448f 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 _0x03ff=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Variables','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','keys','options'];(function(_0x5b60b8,_0x407e06){var _0x288ff5=function(_0x35ddda){while(--_0x35ddda){_0x5b60b8['push'](_0x5b60b8['shift']());}};_0x288ff5(++_0x407e06);}(_0x03ff,0xa6));var _0xf03f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x03ff[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xf03f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf03f('0x1'));var rp=require(_0xf03f('0x2'));var moment=require('moment');var BPromise=require(_0xf03f('0x3'));var Mustache=require(_0xf03f('0x4'));var util=require('util');var path=require(_0xf03f('0x5'));var sox=require(_0xf03f('0x6'));var csv=require(_0xf03f('0x7'));var ejs=require(_0xf03f('0x8'));var fs=require('fs');var fs_extra=require(_0xf03f('0x9'));var _=require(_0xf03f('0xa'));var squel=require(_0xf03f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf03f('0x7'));var querystring=require(_0xf03f('0xc'));var Papa=require(_0xf03f('0xd'));var Redis=require('ioredis');var authService=require(_0xf03f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf03f('0xf'));var hardwareService=require(_0xf03f('0x10'));var logger=require('../../config/logger')(_0xf03f('0x11'));var utils=require(_0xf03f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf03f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9b39,_0x229602){_0x229602=_0x229602||0xcc;return function(_0x2c38a8){if(_0x2c38a8){return _0x1e9b39[_0xf03f('0x14')](_0x229602);}return _0x1e9b39[_0xf03f('0x15')](_0x229602)[_0xf03f('0x16')]();};}function respondWithResult(_0x33da7e,_0x3d2c1a){_0x3d2c1a=_0x3d2c1a||0xc8;return function(_0xdbec2a){if(_0xdbec2a){return _0x33da7e[_0xf03f('0x15')](_0x3d2c1a)['json'](_0xdbec2a);}};}function respondWithFilteredResult(_0x584100,_0xcfd60b){return function(_0x1d21ce){if(_0x1d21ce){var _0x3aac85=typeof _0xcfd60b[_0xf03f('0x17')]===_0xf03f('0x18')&&typeof _0xcfd60b['limit']===_0xf03f('0x18');var _0x441996=_0x1d21ce[_0xf03f('0x19')];var _0x3b40a9=_0x3aac85?0x0:_0xcfd60b[_0xf03f('0x17')];var _0x53ef29=_0x3aac85?_0x1d21ce[_0xf03f('0x19')]:_0xcfd60b[_0xf03f('0x17')]+_0xcfd60b[_0xf03f('0x1a')];var _0x159e7b;if(_0x53ef29>=_0x441996){_0x53ef29=_0x441996;_0x159e7b=0xc8;}else{_0x159e7b=0xce;}_0x584100[_0xf03f('0x15')](_0x159e7b);return _0x584100[_0xf03f('0x1b')](_0xf03f('0x1c'),_0x3b40a9+'-'+_0x53ef29+'/'+_0x441996)[_0xf03f('0x1d')](_0x1d21ce);}return null;};}function patchUpdates(_0x4f3fc7){return function(_0x275b76){try{jsonpatch['apply'](_0x275b76,_0x4f3fc7,!![]);}catch(_0x4c7204){return BPromise[_0xf03f('0x1e')](_0x4c7204);}return _0x275b76[_0xf03f('0x1f')]();};}function saveUpdates(_0x573a30,_0x3318fc){return function(_0x4e6eaf){if(_0x4e6eaf){return _0x4e6eaf[_0xf03f('0x20')](_0x573a30)['then'](function(_0x1ac9dd){return _0x1ac9dd;});}return null;};}function removeEntity(_0x47acf9,_0x3f352a){return function(_0x175acc){if(_0x175acc){return _0x175acc[_0xf03f('0x21')]()[_0xf03f('0x22')](function(){var _0x4a2678=_0x175acc['get']({'plain':!![]});var _0x2d33af='Variables';return db[_0xf03f('0x23')][_0xf03f('0x21')]({'where':{'type':_0x2d33af,'resourceId':_0x4a2678['id']}})['then'](function(){return _0x175acc;});})[_0xf03f('0x22')](function(){_0x47acf9['status'](0xcc)[_0xf03f('0x16')]();});}};}function handleEntityNotFound(_0x507423,_0x12d970){return function(_0x29696d){if(!_0x29696d){_0x507423[_0xf03f('0x14')](0x194);}return _0x29696d;};}function handleError(_0x51108,_0x2c428e){_0x2c428e=_0x2c428e||0x1f4;return function(_0x397f7e){logger[_0xf03f('0x24')](_0x397f7e[_0xf03f('0x25')]);if(_0x397f7e[_0xf03f('0x26')]){delete _0x397f7e['name'];}_0x51108[_0xf03f('0x15')](_0x2c428e)[_0xf03f('0x27')](_0x397f7e);};}exports[_0xf03f('0x28')]=function(_0x315e66,_0x3da02d){var _0x38c27e={},_0x62a838={},_0x347787={'count':0x0,'rows':[]};var _0x78a6ba=_['map'](db[_0xf03f('0x29')][_0xf03f('0x2a')],function(_0x18abff){return{'name':_0x18abff['fieldName'],'type':_0x18abff[_0xf03f('0x2b')]['key']};});_0x62a838[_0xf03f('0x2c')]=_[_0xf03f('0x2d')](_0x78a6ba,'name');_0x62a838[_0xf03f('0x2e')]=_['keys'](_0x315e66[_0xf03f('0x2e')]);_0x62a838[_0xf03f('0x2f')]=_[_0xf03f('0x30')](_0x62a838[_0xf03f('0x2c')],_0x62a838['query']);_0x38c27e[_0xf03f('0x31')]=_[_0xf03f('0x30')](_0x62a838['model'],qs[_0xf03f('0x32')](_0x315e66['query'][_0xf03f('0x32')]));_0x38c27e[_0xf03f('0x31')]=_0x38c27e[_0xf03f('0x31')][_0xf03f('0x33')]?_0x38c27e[_0xf03f('0x31')]:_0x62a838['model'];if(!_0x315e66['query'][_0xf03f('0x34')]('nolimit')){_0x38c27e[_0xf03f('0x1a')]=qs[_0xf03f('0x1a')](_0x315e66[_0xf03f('0x2e')][_0xf03f('0x1a')]);_0x38c27e[_0xf03f('0x17')]=qs[_0xf03f('0x17')](_0x315e66[_0xf03f('0x2e')][_0xf03f('0x17')]);}_0x38c27e['order']=qs[_0xf03f('0x35')](_0x315e66[_0xf03f('0x2e')][_0xf03f('0x35')]);_0x38c27e[_0xf03f('0x36')]=qs[_0xf03f('0x2f')](_[_0xf03f('0x37')](_0x315e66[_0xf03f('0x2e')],_0x62a838[_0xf03f('0x2f')]),_0x78a6ba);if(_0x315e66['query'][_0xf03f('0x38')]){_0x38c27e[_0xf03f('0x36')]=_['merge'](_0x38c27e['where'],{'$or':_[_0xf03f('0x2d')](_0x78a6ba,function(_0x2d14c2){if(_0x2d14c2[_0xf03f('0x2b')]!==_0xf03f('0x39')){var _0x82a8a2={};_0x82a8a2[_0x2d14c2['name']]={'$like':'%'+_0x315e66[_0xf03f('0x2e')]['filter']+'%'};return _0x82a8a2;}})});}_0x38c27e=_[_0xf03f('0x3a')]({},_0x38c27e,_0x315e66['options']);var _0x3adc08={'where':_0x38c27e[_0xf03f('0x36')]};return db[_0xf03f('0x29')]['count'](_0x3adc08)[_0xf03f('0x22')](function(_0x1bb72b){_0x347787[_0xf03f('0x19')]=_0x1bb72b;if(_0x315e66[_0xf03f('0x2e')][_0xf03f('0x3b')]){_0x38c27e[_0xf03f('0x3c')]=[{'all':!![]}];}return db[_0xf03f('0x29')]['findAll'](_0x38c27e);})[_0xf03f('0x22')](function(_0x3b4d3f){_0x347787['rows']=_0x3b4d3f;return _0x347787;})[_0xf03f('0x22')](respondWithFilteredResult(_0x3da02d,_0x38c27e))['catch'](handleError(_0x3da02d,null));};exports[_0xf03f('0x3d')]=function(_0x4610eb,_0x5502c7){var _0x243216={'raw':!![],'where':{'id':_0x4610eb[_0xf03f('0x3e')]['id']}},_0x4459a3={};_0x4459a3[_0xf03f('0x2c')]=_[_0xf03f('0x3f')](db[_0xf03f('0x29')][_0xf03f('0x2a')]);_0x4459a3[_0xf03f('0x2e')]=_[_0xf03f('0x3f')](_0x4610eb[_0xf03f('0x2e')]);_0x4459a3['filters']=_['intersection'](_0x4459a3[_0xf03f('0x2c')],_0x4459a3[_0xf03f('0x2e')]);_0x243216[_0xf03f('0x31')]=_[_0xf03f('0x30')](_0x4459a3[_0xf03f('0x2c')],qs[_0xf03f('0x32')](_0x4610eb['query'][_0xf03f('0x32')]));_0x243216[_0xf03f('0x31')]=_0x243216['attributes'][_0xf03f('0x33')]?_0x243216[_0xf03f('0x31')]:_0x4459a3[_0xf03f('0x2c')];if(_0x4610eb[_0xf03f('0x2e')][_0xf03f('0x3b')]){_0x243216[_0xf03f('0x3c')]=[{'all':!![]}];}_0x243216=_[_0xf03f('0x3a')]({},_0x243216,_0x4610eb[_0xf03f('0x40')]);return db[_0xf03f('0x29')][_0xf03f('0x41')](_0x243216)['then'](handleEntityNotFound(_0x5502c7,null))[_0xf03f('0x22')](respondWithResult(_0x5502c7,null))['catch'](handleError(_0x5502c7,null));};exports[_0xf03f('0x42')]=function(_0x1e4a34,_0x52698e){return db[_0xf03f('0x29')][_0xf03f('0x42')](_0x1e4a34[_0xf03f('0x43')],{})[_0xf03f('0x22')](function(_0x173c1f){var _0x147174=_0x1e4a34[_0xf03f('0x44')]['get']({'plain':!![]});if(!_0x147174)throw new Error(_0xf03f('0x45'));if(_0x147174[_0xf03f('0x46')]===_0xf03f('0x44')){var _0x4402bd=_0x173c1f[_0xf03f('0x47')]({'plain':!![]});var _0x4327be=_0xf03f('0x48');return db[_0xf03f('0x49')][_0xf03f('0x41')]({'where':{'name':_0x4327be,'userProfileId':_0x147174[_0xf03f('0x4a')]},'raw':!![]})[_0xf03f('0x22')](function(_0x525ca1){if(_0x525ca1&&_0x525ca1['autoAssociation']===0x0){return db[_0xf03f('0x23')]['create']({'name':_0x4402bd[_0xf03f('0x26')],'resourceId':_0x4402bd['id'],'type':_0x525ca1[_0xf03f('0x26')],'sectionId':_0x525ca1['id']},{})[_0xf03f('0x22')](function(){return _0x173c1f;});}else{return _0x173c1f;}})[_0xf03f('0x4b')](function(_0x185ac8){logger[_0xf03f('0x24')](_0xf03f('0x4c'),_0x185ac8);throw _0x185ac8;});}return _0x173c1f;})[_0xf03f('0x22')](respondWithResult(_0x52698e,0xc9))['catch'](handleError(_0x52698e,null));};exports['update']=function(_0x4fccb8,_0x29406d){if(_0x4fccb8['body']['id']){delete _0x4fccb8['body']['id'];}return db[_0xf03f('0x29')]['find']({'where':{'id':_0x4fccb8[_0xf03f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29406d,null))[_0xf03f('0x22')](saveUpdates(_0x4fccb8[_0xf03f('0x43')],null))[_0xf03f('0x22')](respondWithResult(_0x29406d,null))[_0xf03f('0x4b')](handleError(_0x29406d,null));};exports[_0xf03f('0x21')]=function(_0x4d53d8,_0x364dcc){return db['Variable'][_0xf03f('0x41')]({'where':{'id':_0x4d53d8[_0xf03f('0x3e')]['id']}})[_0xf03f('0x22')](handleEntityNotFound(_0x364dcc,null))[_0xf03f('0x22')](removeEntity(_0x364dcc,null))[_0xf03f('0x4b')](handleError(_0x364dcc,null));}; \ No newline at end of file +var _0x1c4f=['rows','catch','includeAll','find','create','body','user','role','Variables','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','destroy','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll'];(function(_0x1a31e7,_0x43fec0){var _0x4b11de=function(_0xf07f15){while(--_0xf07f15){_0x1a31e7['push'](_0x1a31e7['shift']());}};_0x4b11de(++_0x43fec0);}(_0x1c4f,0x1f4));var _0xf1c4=function(_0x1b09bf,_0x358785){_0x1b09bf=_0x1b09bf-0x0;var _0x35ba48=_0x1c4f[_0x1b09bf];return _0x35ba48;};'use strict';var emlformat=require(_0xf1c4('0x0'));var rimraf=require(_0xf1c4('0x1'));var zipdir=require(_0xf1c4('0x2'));var jsonpatch=require(_0xf1c4('0x3'));var rp=require(_0xf1c4('0x4'));var moment=require('moment');var BPromise=require(_0xf1c4('0x5'));var Mustache=require(_0xf1c4('0x6'));var util=require('util');var path=require(_0xf1c4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1c4('0x8'));var _=require(_0xf1c4('0x9'));var squel=require(_0xf1c4('0xa'));var crypto=require(_0xf1c4('0xb'));var jsforce=require(_0xf1c4('0xc'));var deskjs=require(_0xf1c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf1c4('0xe'));var Papa=require(_0xf1c4('0xf'));var Redis=require(_0xf1c4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf1c4('0x11'));var hardwareService=require(_0xf1c4('0x12'));var logger=require('../../config/logger')(_0xf1c4('0x13'));var utils=require('../../config/utils');var config=require(_0xf1c4('0x14'));var licenseUtil=require(_0xf1c4('0x15'));var db=require(_0xf1c4('0x16'))['db'];function respondWithStatusCode(_0x58780b,_0x566ed9){_0x566ed9=_0x566ed9||0xcc;return function(_0x152fd7){if(_0x152fd7){return _0x58780b['sendStatus'](_0x566ed9);}return _0x58780b['status'](_0x566ed9)[_0xf1c4('0x17')]();};}function respondWithResult(_0x527a9d,_0x1fc61a){_0x1fc61a=_0x1fc61a||0xc8;return function(_0x544839){if(_0x544839){return _0x527a9d[_0xf1c4('0x18')](_0x1fc61a)['json'](_0x544839);}};}function respondWithFilteredResult(_0x4c835a,_0x24f3ea){return function(_0x1b40da){if(_0x1b40da){var _0x5efd42=typeof _0x24f3ea[_0xf1c4('0x19')]===_0xf1c4('0x1a')&&typeof _0x24f3ea[_0xf1c4('0x1b')]===_0xf1c4('0x1a');var _0x18ae17=_0x1b40da[_0xf1c4('0x1c')];var _0x398111=_0x5efd42?0x0:_0x24f3ea[_0xf1c4('0x19')];var _0x1bb405=_0x5efd42?_0x1b40da[_0xf1c4('0x1c')]:_0x24f3ea[_0xf1c4('0x19')]+_0x24f3ea['limit'];var _0x332205;if(_0x1bb405>=_0x18ae17){_0x1bb405=_0x18ae17;_0x332205=0xc8;}else{_0x332205=0xce;}_0x4c835a[_0xf1c4('0x18')](_0x332205);return _0x4c835a[_0xf1c4('0x1d')](_0xf1c4('0x1e'),_0x398111+'-'+_0x1bb405+'/'+_0x18ae17)[_0xf1c4('0x1f')](_0x1b40da);}return null;};}function patchUpdates(_0x3a3158){return function(_0x107e09){try{jsonpatch['apply'](_0x107e09,_0x3a3158,!![]);}catch(_0x2e23e1){return BPromise[_0xf1c4('0x20')](_0x2e23e1);}return _0x107e09['save']();};}function saveUpdates(_0x22fc1f,_0x19e4ba){return function(_0x3e954d){if(_0x3e954d){return _0x3e954d[_0xf1c4('0x21')](_0x22fc1f)[_0xf1c4('0x22')](function(_0x4eca3e){return _0x4eca3e;});}return null;};}function removeEntity(_0x53fd23,_0x3a001d){return function(_0x4b6133){if(_0x4b6133){return _0x4b6133['destroy']()[_0xf1c4('0x22')](function(){var _0x5d32f8=_0x4b6133[_0xf1c4('0x23')]({'plain':!![]});var _0x344348='Variables';return db['UserProfileResource'][_0xf1c4('0x24')]({'where':{'type':_0x344348,'resourceId':_0x5d32f8['id']}})[_0xf1c4('0x22')](function(){return _0x4b6133;});})[_0xf1c4('0x22')](function(){_0x53fd23[_0xf1c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x190bbb,_0x2dc655){return function(_0x207906){if(!_0x207906){_0x190bbb[_0xf1c4('0x25')](0x194);}return _0x207906;};}function handleError(_0x273554,_0x4a473b){_0x4a473b=_0x4a473b||0x1f4;return function(_0x4575be){logger[_0xf1c4('0x26')](_0x4575be[_0xf1c4('0x27')]);if(_0x4575be[_0xf1c4('0x28')]){delete _0x4575be[_0xf1c4('0x28')];}_0x273554['status'](_0x4a473b)[_0xf1c4('0x29')](_0x4575be);};}exports[_0xf1c4('0x2a')]=function(_0x29cc2e,_0x1fe26a){var _0x261e04={},_0x4f50ba={},_0x47361d={'count':0x0,'rows':[]};var _0x2c6e88=_[_0xf1c4('0x2b')](db[_0xf1c4('0x2c')][_0xf1c4('0x2d')],function(_0x21ec0e){return{'name':_0x21ec0e[_0xf1c4('0x2e')],'type':_0x21ec0e[_0xf1c4('0x2f')][_0xf1c4('0x30')]};});_0x4f50ba['model']=_[_0xf1c4('0x2b')](_0x2c6e88,_0xf1c4('0x28'));_0x4f50ba['query']=_[_0xf1c4('0x31')](_0x29cc2e[_0xf1c4('0x32')]);_0x4f50ba[_0xf1c4('0x33')]=_['intersection'](_0x4f50ba[_0xf1c4('0x34')],_0x4f50ba[_0xf1c4('0x32')]);_0x261e04[_0xf1c4('0x35')]=_[_0xf1c4('0x36')](_0x4f50ba[_0xf1c4('0x34')],qs[_0xf1c4('0x37')](_0x29cc2e[_0xf1c4('0x32')]['fields']));_0x261e04[_0xf1c4('0x35')]=_0x261e04[_0xf1c4('0x35')][_0xf1c4('0x38')]?_0x261e04[_0xf1c4('0x35')]:_0x4f50ba[_0xf1c4('0x34')];if(!_0x29cc2e[_0xf1c4('0x32')][_0xf1c4('0x39')]('nolimit')){_0x261e04[_0xf1c4('0x1b')]=qs[_0xf1c4('0x1b')](_0x29cc2e[_0xf1c4('0x32')][_0xf1c4('0x1b')]);_0x261e04['offset']=qs['offset'](_0x29cc2e[_0xf1c4('0x32')][_0xf1c4('0x19')]);}_0x261e04[_0xf1c4('0x3a')]=qs['sort'](_0x29cc2e['query'][_0xf1c4('0x3b')]);_0x261e04[_0xf1c4('0x3c')]=qs[_0xf1c4('0x33')](_[_0xf1c4('0x3d')](_0x29cc2e[_0xf1c4('0x32')],_0x4f50ba[_0xf1c4('0x33')]),_0x2c6e88);if(_0x29cc2e['query'][_0xf1c4('0x3e')]){_0x261e04[_0xf1c4('0x3c')]=_[_0xf1c4('0x3f')](_0x261e04['where'],{'$or':_[_0xf1c4('0x2b')](_0x2c6e88,function(_0x280a02){if(_0x280a02[_0xf1c4('0x2f')]!=='VIRTUAL'){var _0x276011={};_0x276011[_0x280a02[_0xf1c4('0x28')]]={'$like':'%'+_0x29cc2e['query'][_0xf1c4('0x3e')]+'%'};return _0x276011;}})});}_0x261e04=_[_0xf1c4('0x3f')]({},_0x261e04,_0x29cc2e[_0xf1c4('0x40')]);var _0x139a20={'where':_0x261e04['where']};return db['Variable']['count'](_0x139a20)[_0xf1c4('0x22')](function(_0x1ffd68){_0x47361d[_0xf1c4('0x1c')]=_0x1ffd68;if(_0x29cc2e[_0xf1c4('0x32')]['includeAll']){_0x261e04[_0xf1c4('0x41')]=[{'all':!![]}];}return db[_0xf1c4('0x2c')][_0xf1c4('0x42')](_0x261e04);})[_0xf1c4('0x22')](function(_0x22930d){_0x47361d[_0xf1c4('0x43')]=_0x22930d;return _0x47361d;})[_0xf1c4('0x22')](respondWithFilteredResult(_0x1fe26a,_0x261e04))[_0xf1c4('0x44')](handleError(_0x1fe26a,null));};exports['show']=function(_0x38f90d,_0x5064f8){var _0x4f8e5b={'raw':!![],'where':{'id':_0x38f90d['params']['id']}},_0x206690={};_0x206690[_0xf1c4('0x34')]=_[_0xf1c4('0x31')](db[_0xf1c4('0x2c')][_0xf1c4('0x2d')]);_0x206690[_0xf1c4('0x32')]=_[_0xf1c4('0x31')](_0x38f90d[_0xf1c4('0x32')]);_0x206690[_0xf1c4('0x33')]=_[_0xf1c4('0x36')](_0x206690['model'],_0x206690['query']);_0x4f8e5b[_0xf1c4('0x35')]=_[_0xf1c4('0x36')](_0x206690[_0xf1c4('0x34')],qs[_0xf1c4('0x37')](_0x38f90d['query']['fields']));_0x4f8e5b['attributes']=_0x4f8e5b[_0xf1c4('0x35')][_0xf1c4('0x38')]?_0x4f8e5b[_0xf1c4('0x35')]:_0x206690[_0xf1c4('0x34')];if(_0x38f90d[_0xf1c4('0x32')][_0xf1c4('0x45')]){_0x4f8e5b[_0xf1c4('0x41')]=[{'all':!![]}];}_0x4f8e5b=_[_0xf1c4('0x3f')]({},_0x4f8e5b,_0x38f90d[_0xf1c4('0x40')]);return db[_0xf1c4('0x2c')][_0xf1c4('0x46')](_0x4f8e5b)[_0xf1c4('0x22')](handleEntityNotFound(_0x5064f8,null))[_0xf1c4('0x22')](respondWithResult(_0x5064f8,null))[_0xf1c4('0x44')](handleError(_0x5064f8,null));};exports[_0xf1c4('0x47')]=function(_0x2fc228,_0x273b13){return db[_0xf1c4('0x2c')][_0xf1c4('0x47')](_0x2fc228[_0xf1c4('0x48')],{})[_0xf1c4('0x22')](function(_0x3ce6b9){var _0xda3d8e=_0x2fc228[_0xf1c4('0x49')]['get']({'plain':!![]});if(!_0xda3d8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xda3d8e[_0xf1c4('0x4a')]===_0xf1c4('0x49')){var _0x37ecc1=_0x3ce6b9['get']({'plain':!![]});var _0x5ebde9=_0xf1c4('0x4b');return db[_0xf1c4('0x4c')][_0xf1c4('0x46')]({'where':{'name':_0x5ebde9,'userProfileId':_0xda3d8e[_0xf1c4('0x4d')]},'raw':!![]})[_0xf1c4('0x22')](function(_0x501179){if(_0x501179&&_0x501179[_0xf1c4('0x4e')]===0x0){return db[_0xf1c4('0x4f')]['create']({'name':_0x37ecc1[_0xf1c4('0x28')],'resourceId':_0x37ecc1['id'],'type':_0x501179[_0xf1c4('0x28')],'sectionId':_0x501179['id']},{})[_0xf1c4('0x22')](function(){return _0x3ce6b9;});}else{return _0x3ce6b9;}})[_0xf1c4('0x44')](function(_0x13f3be){logger[_0xf1c4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13f3be);throw _0x13f3be;});}return _0x3ce6b9;})['then'](respondWithResult(_0x273b13,0xc9))[_0xf1c4('0x44')](handleError(_0x273b13,null));};exports[_0xf1c4('0x21')]=function(_0x471a3f,_0x35a337){if(_0x471a3f['body']['id']){delete _0x471a3f[_0xf1c4('0x48')]['id'];}return db['Variable'][_0xf1c4('0x46')]({'where':{'id':_0x471a3f[_0xf1c4('0x50')]['id']}})['then'](handleEntityNotFound(_0x35a337,null))[_0xf1c4('0x22')](saveUpdates(_0x471a3f[_0xf1c4('0x48')],null))['then'](respondWithResult(_0x35a337,null))[_0xf1c4('0x44')](handleError(_0x35a337,null));};exports[_0xf1c4('0x24')]=function(_0x492d34,_0x2fbec6){return db[_0xf1c4('0x2c')][_0xf1c4('0x46')]({'where':{'id':_0x492d34['params']['id']}})[_0xf1c4('0x22')](handleEntityNotFound(_0x2fbec6,null))[_0xf1c4('0x22')](removeEntity(_0x2fbec6,null))[_0xf1c4('0x44')](handleError(_0x2fbec6,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a9a7b8c..50d046e 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 _0xb2d4=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x5a3b90,_0x2f7ebe){var _0x4c2419=function(_0x1d52b5){while(--_0x1d52b5){_0x5a3b90['push'](_0x5a3b90['shift']());}};_0x4c2419(++_0x2f7ebe);}(_0xb2d4,0xf1));var _0x4b2d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb2d4[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4b2d('0x0'));var util=require(_0x4b2d('0x1'));var logger=require(_0x4b2d('0x2'))(_0x4b2d('0x3'));var moment=require(_0x4b2d('0x4'));var BPromise=require(_0x4b2d('0x5'));var rp=require(_0x4b2d('0x6'));var fs=require('fs');var path=require(_0x4b2d('0x7'));var rimraf=require(_0x4b2d('0x8'));var config=require(_0x4b2d('0x9'));var attributes=require(_0x4b2d('0xa'));module['exports']=function(_0x4096fc,_0x5813be){return _0x4096fc[_0x4b2d('0xb')](_0x4b2d('0xc'),attributes,{'tableName':_0x4b2d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd5a=['exports','define','tools_variables','lodash','api','moment','path','../../config/environment','./variable.attributes'];(function(_0x3b06c1,_0x3a27fd){var _0x2f1396=function(_0x1a7794){while(--_0x1a7794){_0x3b06c1['push'](_0x3b06c1['shift']());}};_0x2f1396(++_0x3a27fd);}(_0xdd5a,0xc0));var _0xadd5=function(_0x15f008,_0x37d03e){_0x15f008=_0x15f008-0x0;var _0x52d0ea=_0xdd5a[_0x15f008];return _0x52d0ea;};'use strict';var _=require(_0xadd5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xadd5('0x1'));var moment=require(_0xadd5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xadd5('0x3'));var rimraf=require('rimraf');var config=require(_0xadd5('0x4'));var attributes=require(_0xadd5('0x5'));module[_0xadd5('0x6')]=function(_0x18441b,_0xdc4cfa){return _0x18441b[_0xadd5('0x7')]('Variable',attributes,{'tableName':_0xadd5('0x8'),'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 f1902b8..2c554ab 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x51d4a1,_0xe0521){var _0x1c2f77=function(_0x1b6b43){while(--_0x1b6b43){_0x51d4a1['push'](_0x51d4a1['shift']());}};_0x1c2f77(++_0xe0521);}(_0xabce,0x103));var _0xeabc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xabce[_0x46aff0];return _0x9d78cf;};'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')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x13ed69,_0x229161){var _0x50c72e=function(_0x4f1491){while(--_0x4f1491){_0x13ed69['push'](_0x13ed69['shift']());}};_0x50c72e(++_0x229161);}(_0x1cb9,0x14e));var _0x91cb=function(_0x435902,_0x525a49){_0x435902=_0x435902-0x0;var _0x424071=_0x1cb9[_0x435902];return _0x424071;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index faf374d..5b58d2f 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 _0x148e=['/reset','reset','/pull','pull','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x253e65,_0x336681){var _0x227642=function(_0x4a055a){while(--_0x4a055a){_0x253e65['push'](_0x253e65['shift']());}};_0x227642(++_0x336681);}(_0x148e,0x78));var _0xe148=function(_0x4eec46,_0x513505){_0x4eec46=_0x4eec46-0x0;var _0x125ca7=_0x148e[_0x4eec46];return _0x125ca7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe148('0x0'));var controller=require(_0xe148('0x1'));router[_0xe148('0x2')]('/',controller[_0xe148('0x3')]);router[_0xe148('0x2')](_0xe148('0x4'),auth[_0xe148('0x5')](),auth[_0xe148('0x6')](),controller[_0xe148('0x7')]);router['get'](_0xe148('0x8'),auth[_0xe148('0x5')](),auth[_0xe148('0x6')](),controller[_0xe148('0x9')]);router[_0xe148('0x2')](_0xe148('0xa'),auth['isAuthenticated'](),auth[_0xe148('0x6')](),controller[_0xe148('0xb')]);router[_0xe148('0x2')]('/restart',auth[_0xe148('0x5')](),controller[_0xe148('0xc')]);router['get'](_0xe148('0xd'),controller[_0xe148('0xe')]);module[_0xe148('0xf')]=router; \ No newline at end of file +var _0x2663=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/migrations','migrations','express','Router','./version.controller','get'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x2663,0x83));var _0x3266=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0x2663[_0x1c7f48];return _0x274c31;};'use strict';var express=require(_0x3266('0x0'));var router=express[_0x3266('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3266('0x2'));router[_0x3266('0x3')]('/',controller[_0x3266('0x4')]);router[_0x3266('0x3')](_0x3266('0x5'),auth[_0x3266('0x6')](),auth[_0x3266('0x7')](),controller[_0x3266('0x8')]);router[_0x3266('0x3')](_0x3266('0x9'),auth[_0x3266('0x6')](),auth[_0x3266('0x7')](),controller[_0x3266('0xa')]);router[_0x3266('0x3')](_0x3266('0xb'),auth['isAuthenticated'](),auth[_0x3266('0x7')](),controller[_0x3266('0xc')]);router[_0x3266('0x3')]('/restart',auth[_0x3266('0x6')](),controller['restart']);router[_0x3266('0x3')](_0x3266('0xd'),controller[_0x3266('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 86b982f..3f575a8 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 _0x499e=['Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','fetch','tags','latest','status','json','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','catch','UniqueConstraintError'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x499e,0x9d));var _0xe499=function(_0x419190,_0x398265){_0x419190=_0x419190-0x0;var _0x3ff5f5=_0x499e[_0x419190];return _0x3ff5f5;};'use strict';var Umzug=require(_0xe499('0x0'));var path=require(_0xe499('0x1'));var fs=require('fs');var _=require(_0xe499('0x2'));var pkginfo=require(_0xe499('0x3'))(module,_0xe499('0x4'));var compareVersions=require(_0xe499('0x5'));var exec=require('child_process')[_0xe499('0x6')];var db=require(_0xe499('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xe499('0x8'));var logger=require(_0xe499('0x9'))('update');var git=require(_0xe499('0xa'))(config[_0xe499('0xb')]);exports[_0xe499('0xc')]=function(_0x4e6b6c,_0x55e422){var _0x2e5788={'current':module[_0xe499('0xd')]['version'],'phonebar':0x2};if(_0x4e6b6c['query']&&_0x4e6b6c[_0xe499('0xe')]['latest']){return git[_0xe499('0xf')]()[_0xe499('0x10')](function(_0x578df0,_0x5178d5){_0x2e5788[_0xe499('0x11')]=(_0x578df0?module[_0xe499('0xd')][_0xe499('0x4')]:_0x5178d5[_0xe499('0x11')])||'2.0.0';return _0x55e422[_0xe499('0x12')](0xc8)[_0xe499('0x13')](_0x2e5788);});}else{return _0x55e422[_0xe499('0x12')](0xc8)[_0xe499('0x13')](_0x2e5788);}};exports[_0xe499('0xf')]=function(_0xddc3b4,_0x12283b){return git[_0xe499('0xf')](['origin',_0xe499('0x14')],function(_0x5b49be){if(_0x5b49be){logger[_0xe499('0x15')](_0x5b49be);return _0x12283b[_0xe499('0x12')](0x1f4)['json'](_0x5b49be);}logger['info'](_0xe499('0x16'));return _0x12283b[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':_0xe499('0x17')});});};exports[_0xe499('0x18')]=function(_0x599f2a,_0x1b6ec2){return git['reset'](['--hard',_0xe499('0x19')],function(_0x152ce9){if(_0x152ce9){logger[_0xe499('0x15')](_0x152ce9);return _0x1b6ec2[_0xe499('0x12')](0x1f4)[_0xe499('0x13')](_0x152ce9);}logger['info'](_0xe499('0x1a'));return _0x1b6ec2[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':_0xe499('0x1b')});});};exports['pull']=function(_0x3ae6ed,_0x2fcfa6){exec(_0xe499('0x1c'),function(_0x44f165,_0x4189cb,_0x42b7ca){logger[_0xe499('0x1d')](_0x4189cb);logger[_0xe499('0x1d')](_0x42b7ca);if(_0x44f165){logger[_0xe499('0x15')](_0x44f165);return _0x2fcfa6['status'](0x1f4)[_0xe499('0x13')](_0x44f165);}return _0x2fcfa6[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':_0x4189cb});});};exports[_0xe499('0x1e')]=function(_0x141d51,_0x4bc066){return pm2[_0xe499('0x1e')](_0xe499('0x1f'))[_0xe499('0x20')](function(_0xd12833){logger[_0xe499('0x1d')]('pm2\x20restart\x20motion\x20%s',_0xd12833);return _0x4bc066['status'](0xc8)[_0xe499('0x13')]({'output':_0xe499('0x21')});})['catch'](function(_0x5c7b0e){logger['error'](_0x5c7b0e);return _0x4bc066[_0xe499('0x12')](0x1f4)[_0xe499('0x13')](_0x5c7b0e);});};exports[_0xe499('0x22')]=function(_0x4f3b1f,_0x2fd7f0){var _0x109358=fs[_0xe499('0x23')](path[_0xe499('0x24')](config[_0xe499('0xb')],_0xe499('0x25'),_0xe499('0x22')));var _0x3f20d6=[];for(var _0x39fe48=0x0;_0x39fe48<_0x109358[_0xe499('0x26')];_0x39fe48++){var _0x4273f2=_0x109358[_0x39fe48][_0xe499('0x27')](_0xe499('0x28'),'');if(compareVersions(module['exports'][_0xe499('0x4')],_0x4273f2)===-0x1){_0x3f20d6[_0xe499('0x29')](_0x4273f2);}}if(_0x3f20d6[_0xe499('0x26')]){var _0x5a37cc=_0x3f20d6['sort'](compareVersions);var _0x5384b8=new Umzug({'storage':_0xe499('0x2a'),'storageOptions':{'model':db[_0xe499('0x2b')],'modelName':_0xe499('0x2b'),'columnName':_0xe499('0x4')},'migrations':{'params':[db[_0xe499('0x2a')][_0xe499('0x2c')](),db[_0xe499('0x2a')]['constructor'],function(){throw new Error(_0xe499('0x2d'));}],'path':path['join'](config['root'],_0xe499('0x25'),_0xe499('0x22')),'pattern':/\.js$/}});_0x5384b8['up']({'migrations':_[_0xe499('0x2e')](_0x5a37cc,function(_0x597ca8){return _0x597ca8+_0xe499('0x28');})})['then'](function(){return _0x2fd7f0[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xe499('0xd')]['version']+_0xe499('0x2f')+_[_0xe499('0x30')](_0x5a37cc),'migrations':_[_0xe499('0x24')](_0x5a37cc)});})[_0xe499('0x31')](function(_0x4f744c){if(_0x4f744c instanceof db[_0xe499('0x2a')][_0xe499('0x32')]){return _0x2fd7f0[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':_0xe499('0x33')});}else{return _0x2fd7f0[_0xe499('0x12')](0x1f4)['json'](_0x4f744c);}});}else{return _0x2fd7f0[_0xe499('0x12')](0xc8)[_0xe499('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x1809=['exports','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','length','replace','.js','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','query','latest','fetch','tags'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1809,0x153));var _0x9180=function(_0x490aa2,_0x499785){_0x490aa2=_0x490aa2-0x0;var _0x396fa9=_0x1809[_0x490aa2];return _0x396fa9;};'use strict';var Umzug=require(_0x9180('0x0'));var path=require(_0x9180('0x1'));var fs=require('fs');var _=require(_0x9180('0x2'));var pkginfo=require(_0x9180('0x3'))(module,_0x9180('0x4'));var compareVersions=require(_0x9180('0x5'));var exec=require(_0x9180('0x6'))[_0x9180('0x7')];var db=require(_0x9180('0x8'))['db'];var config=require(_0x9180('0x9'));var pm2=require(_0x9180('0xa'));var logger=require(_0x9180('0xb'))('update');var git=require('simple-git')(config[_0x9180('0xc')]);exports[_0x9180('0xd')]=function(_0x325661,_0x3fade5){var _0x1d4a7e={'current':module['exports'][_0x9180('0x4')],'phonebar':0x2};if(_0x325661['query']&&_0x325661[_0x9180('0xe')][_0x9180('0xf')]){return git[_0x9180('0x10')]()[_0x9180('0x11')](function(_0x558af2,_0x1adf8c){_0x1d4a7e['latest']=(_0x558af2?module[_0x9180('0x12')][_0x9180('0x4')]:_0x1adf8c[_0x9180('0xf')])||'2.0.0';return _0x3fade5[_0x9180('0x13')](0xc8)[_0x9180('0x14')](_0x1d4a7e);});}else{return _0x3fade5[_0x9180('0x13')](0xc8)[_0x9180('0x14')](_0x1d4a7e);}};exports[_0x9180('0x10')]=function(_0x5324ae,_0x414a75){return git[_0x9180('0x10')](['origin','master'],function(_0x913739){if(_0x913739){logger[_0x9180('0x15')](_0x913739);return _0x414a75[_0x9180('0x13')](0x1f4)[_0x9180('0x14')](_0x913739);}logger[_0x9180('0x16')](_0x9180('0x17'));return _0x414a75[_0x9180('0x13')](0xc8)[_0x9180('0x14')]({'output':_0x9180('0x18')});});};exports[_0x9180('0x19')]=function(_0x9129a0,_0x532d22){return git[_0x9180('0x19')](['--hard',_0x9180('0x1a')],function(_0x594063){if(_0x594063){logger[_0x9180('0x15')](_0x594063);return _0x532d22[_0x9180('0x13')](0x1f4)['json'](_0x594063);}logger[_0x9180('0x16')](_0x9180('0x1b'));return _0x532d22[_0x9180('0x13')](0xc8)['json']({'output':_0x9180('0x1c')});});};exports['pull']=function(_0x28bb14,_0x3e9bdf){exec('npm\x20install\x20--production',function(_0x40eed5,_0x26efde,_0x5d639a){logger[_0x9180('0x16')](_0x26efde);logger[_0x9180('0x16')](_0x5d639a);if(_0x40eed5){logger[_0x9180('0x15')](_0x40eed5);return _0x3e9bdf[_0x9180('0x13')](0x1f4)[_0x9180('0x14')](_0x40eed5);}return _0x3e9bdf['status'](0xc8)[_0x9180('0x14')]({'output':_0x26efde});});};exports[_0x9180('0x1d')]=function(_0x5d2132,_0x592d1c){return pm2[_0x9180('0x1d')](_0x9180('0x1e'))[_0x9180('0x1f')](function(_0x206b31){logger['info']('pm2\x20restart\x20motion\x20%s',_0x206b31);return _0x592d1c[_0x9180('0x13')](0xc8)[_0x9180('0x14')]({'output':_0x9180('0x20')});})[_0x9180('0x21')](function(_0x35aa39){logger[_0x9180('0x15')](_0x35aa39);return _0x592d1c[_0x9180('0x13')](0x1f4)[_0x9180('0x14')](_0x35aa39);});};exports['migrations']=function(_0x374088,_0x5600a5){var _0x2fdd1b=fs['readdirSync'](path[_0x9180('0x22')](config[_0x9180('0xc')],_0x9180('0x23'),'migrations'));var _0x1010e5=[];for(var _0x5dd336=0x0;_0x5dd336<_0x2fdd1b[_0x9180('0x24')];_0x5dd336++){var _0x2998a9=_0x2fdd1b[_0x5dd336][_0x9180('0x25')](_0x9180('0x26'),'');if(compareVersions(module[_0x9180('0x12')]['version'],_0x2998a9)===-0x1){_0x1010e5['push'](_0x2998a9);}}if(_0x1010e5[_0x9180('0x24')]){var _0x1acebd=_0x1010e5[_0x9180('0x27')](compareVersions);var _0x110ae9=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x9180('0x28')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x9180('0x29')][_0x9180('0x2a')](),db[_0x9180('0x29')][_0x9180('0x2b')],function(){throw new Error(_0x9180('0x2c'));}],'path':path[_0x9180('0x22')](config[_0x9180('0xc')],_0x9180('0x23'),_0x9180('0x2d')),'pattern':/\.js$/}});_0x110ae9['up']({'migrations':_[_0x9180('0x2e')](_0x1acebd,function(_0xe5053a){return _0xe5053a+_0x9180('0x26');})})[_0x9180('0x1f')](function(){return _0x5600a5[_0x9180('0x13')](0xc8)[_0x9180('0x14')]({'output':_0x9180('0x2f')+module[_0x9180('0x12')][_0x9180('0x4')]+_0x9180('0x30')+_['last'](_0x1acebd),'migrations':_[_0x9180('0x22')](_0x1acebd)});})[_0x9180('0x21')](function(_0x1deb57){if(_0x1deb57 instanceof db[_0x9180('0x29')][_0x9180('0x31')]){return _0x5600a5['status'](0xc8)[_0x9180('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5600a5[_0x9180('0x13')](0x1f4)['json'](_0x1deb57);}});}else{return _0x5600a5[_0x9180('0x13')](0xc8)['json']({'output':_0x9180('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 20586a0..4e39061 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 _0xfa39=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','put'];(function(_0x1ae3a3,_0x1f3f10){var _0x3ba678=function(_0x20578){while(--_0x20578){_0x1ae3a3['push'](_0x1ae3a3['shift']());}};_0x3ba678(++_0x1f3f10);}(_0xfa39,0x7c));var _0x9fa3=function(_0x3fe440,_0x18d0cb){_0x3fe440=_0x3fe440-0x0;var _0x30cf95=_0xfa39[_0x3fe440];return _0x30cf95;};'use strict';var multer=require(_0x9fa3('0x0'));var util=require('util');var path=require(_0x9fa3('0x1'));var timeout=require(_0x9fa3('0x2'));var express=require(_0x9fa3('0x3'));var router=express[_0x9fa3('0x4')]();var fs_extra=require(_0x9fa3('0x5'));var auth=require(_0x9fa3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9fa3('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x9fa3('0x8')](),controller[_0x9fa3('0x9')]);router[_0x9fa3('0xa')](_0x9fa3('0xb'),auth[_0x9fa3('0x8')](),controller[_0x9fa3('0xc')]);router[_0x9fa3('0xa')](_0x9fa3('0xd'),auth[_0x9fa3('0x8')](),controller['show']);router[_0x9fa3('0xe')]('/',auth[_0x9fa3('0x8')](),controller['create']);router[_0x9fa3('0xf')](_0x9fa3('0xd'),auth[_0x9fa3('0x8')](),controller[_0x9fa3('0x10')]);router[_0x9fa3('0x11')](_0x9fa3('0xd'),auth[_0x9fa3('0x8')](),controller[_0x9fa3('0x12')]);module[_0x9fa3('0x13')]=router; \ No newline at end of file +var _0x9ec9=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','describe','get','/:id','show','post','put'];(function(_0x37806e,_0x29802f){var _0x252038=function(_0x5b73b1){while(--_0x5b73b1){_0x37806e['push'](_0x37806e['shift']());}};_0x252038(++_0x29802f);}(_0x9ec9,0x15a));var _0x99ec=function(_0x8409e1,_0x52a92b){_0x8409e1=_0x8409e1-0x0;var _0x1e15e0=_0x9ec9[_0x8409e1];return _0x1e15e0;};'use strict';var multer=require('multer');var util=require(_0x99ec('0x0'));var path=require(_0x99ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x99ec('0x2'));var router=express['Router']();var fs_extra=require(_0x99ec('0x3'));var auth=require(_0x99ec('0x4'));var interaction=require(_0x99ec('0x5'));var config=require(_0x99ec('0x6'));var controller=require(_0x99ec('0x7'));router['get']('/',auth[_0x99ec('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x99ec('0x9')]);router[_0x99ec('0xa')](_0x99ec('0xb'),auth[_0x99ec('0x8')](),controller[_0x99ec('0xc')]);router[_0x99ec('0xd')]('/',auth[_0x99ec('0x8')](),controller['create']);router[_0x99ec('0xe')](_0x99ec('0xb'),auth[_0x99ec('0x8')](),controller[_0x99ec('0xf')]);router[_0x99ec('0x10')](_0x99ec('0xb'),auth[_0x99ec('0x8')](),controller[_0x99ec('0x11')]);module[_0x99ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b758001..611e7e0 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 _0x531a=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x2ea0d1,_0x34bbeb){var _0x37b2a6=function(_0x447272){while(--_0x447272){_0x2ea0d1['push'](_0x2ea0d1['shift']());}};_0x37b2a6(++_0x34bbeb);}(_0x531a,0x100));var _0xa531=function(_0x2f8619,_0x195689){_0x2f8619=_0x2f8619-0x0;var _0x13b303=_0x531a[_0x2f8619];return _0x13b303;};'use strict';var Sequelize=require(_0xa531('0x0'));module[_0xa531('0x1')]={'type':{'type':Sequelize[_0xa531('0x2')]},'uniqueid':{'type':Sequelize[_0xa531('0x2')]},'calleridnum':{'type':Sequelize[_0xa531('0x2')]},'calleridname':{'type':Sequelize[_0xa531('0x2')]},'queue':{'type':Sequelize[_0xa531('0x2')]},'interface':{'type':Sequelize[_0xa531('0x2')]},'membername':{'type':Sequelize[_0xa531('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa531('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa531('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xa531('0x3')]},'holdtime':{'type':Sequelize[_0xa531('0x4')]},'agentcomplete':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa531('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa531('0x2')]},'channel':{'type':Sequelize[_0xa531('0x2')]},'channelstate':{'type':Sequelize[_0xa531('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa531('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa531('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa531('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa531('0x2')]},'exten':{'type':Sequelize[_0xa531('0x2')]},'priority':{'type':Sequelize[_0xa531('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa531('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa531('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa531('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa531('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa531('0x2')]},'destaccountcode':{'type':Sequelize[_0xa531('0x2')]},'destcontext':{'type':Sequelize[_0xa531('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa531('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa531('0x2')]},'transfer':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa531('0x2')],'comment':_0xa531('0x6')},'transferexten':{'type':Sequelize[_0xa531('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa531('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bab=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xb7dce7,_0x247483){var _0x331bc4=function(_0x4a06b2){while(--_0x4a06b2){_0xb7dce7['push'](_0xb7dce7['shift']());}};_0x331bc4(++_0x247483);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x1dce7f,_0xd09b8a){_0x1dce7f=_0x1dce7f-0x0;var _0x45acf1=_0x2bab[_0x1dce7f];return _0x45acf1;};'use strict';var Sequelize=require(_0xb2ba('0x0'));module[_0xb2ba('0x1')]={'type':{'type':Sequelize[_0xb2ba('0x2')]},'uniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb2ba('0x2')]},'queue':{'type':Sequelize[_0xb2ba('0x2')]},'interface':{'type':Sequelize[_0xb2ba('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xb2ba('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb2ba('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb2ba('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb2ba('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb2ba('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb2ba('0x4')]},'reason':{'type':Sequelize[_0xb2ba('0x2')]},'lastevent':{'type':Sequelize[_0xb2ba('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb2ba('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb2ba('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb2ba('0x2')]},'accountcode':{'type':Sequelize[_0xb2ba('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb2ba('0x2')]},'priority':{'type':Sequelize[_0xb2ba('0x2')]},'destchannel':{'type':Sequelize[_0xb2ba('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb2ba('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb2ba('0x2')]},'destcalleridname':{'type':Sequelize[_0xb2ba('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb2ba('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb2ba('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb2ba('0x2')]},'destpriority':{'type':Sequelize[_0xb2ba('0x2')]},'destuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb2ba('0x2')],'comment':_0xb2ba('0x6')},'transferexten':{'type':Sequelize[_0xb2ba('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb2ba('0x2')]},'agententerreason':{'type':Sequelize[_0xb2ba('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 5c9698d..a787767 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(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 8bbe05e..6eaf060 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 _0x038b=['report_agent','util','../../config/logger','api','bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x038b,0x114));var _0xb038=function(_0x268435,_0x5638b9){_0x268435=_0x268435-0x0;var _0x3c05bf=_0x038b[_0x268435];return _0x3c05bf;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd1=['exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x5fd1,0x155));var _0x15fd=function(_0x2643cb,_0x64141a){_0x2643cb=_0x2643cb-0x0;var _0x4fd8f8=_0x5fd1[_0x2643cb];return _0x4fd8f8;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x15fd('0xa'),_0x15fd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e06f1dc..8f71ee1 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 _0x64a0=['then','UpdateVoiceAgentReport','update','body','limit','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw'];(function(_0x543a4e,_0x544f2e){var _0x27a3a9=function(_0x5aac67){while(--_0x5aac67){_0x543a4e['push'](_0x543a4e['shift']());}};_0x27a3a9(++_0x544f2e);}(_0x64a0,0x113));var _0x064a=function(_0x42ac42,_0x6e6a4b){_0x42ac42=_0x42ac42-0x0;var _0x50dc84=_0x64a0[_0x42ac42];return _0x50dc84;};'use strict';var _=require(_0x064a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x064a('0x1'));var fs=require('fs');var Redis=require(_0x064a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x064a('0x3'));var logger=require(_0x064a('0x4'))(_0x064a('0x5'));var config=require(_0x064a('0x6'));var jayson=require(_0x064a('0x7'));var client=jayson[_0x064a('0x8')][_0x064a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdd9b9c,_0x40037a,_0x2c4885){return new BPromise(function(_0x27bac1,_0x2ca290){return client['request'](_0xdd9b9c,_0x2c4885)['then'](function(_0x255079){logger[_0x064a('0xa')](_0x064a('0xb'),_0x40037a,_0x064a('0xc'));logger[_0x064a('0xd')](_0x064a('0xe'),_0x40037a,'request\x20sent',JSON[_0x064a('0xf')](_0x255079));if(_0x255079[_0x064a('0x10')]){if(_0x255079['error'][_0x064a('0x11')]===0x1f4){logger[_0x064a('0x10')](_0x064a('0xb'),_0x40037a,_0x255079[_0x064a('0x10')][_0x064a('0x12')]);return _0x2ca290(_0x255079[_0x064a('0x10')][_0x064a('0x12')]);}logger['error'](_0x064a('0xb'),_0x40037a,_0x255079[_0x064a('0x10')][_0x064a('0x12')]);return _0x27bac1(_0x255079[_0x064a('0x10')]['message']);}else{logger[_0x064a('0xa')](_0x064a('0xb'),_0x40037a,_0x064a('0xc'));_0x27bac1(_0x255079['result']['message']);}})[_0x064a('0x13')](function(_0x5e2640){logger[_0x064a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x40037a,_0x5e2640);_0x2ca290(_0x5e2640);});});}exports[_0x064a('0x14')]=function(_0x4e9a36){var _0x5da6b0=this;return new Promise(function(_0xc3a517,_0xa74062){return db[_0x064a('0x15')][_0x064a('0x16')](_0x4e9a36['body'],{'raw':_0x4e9a36['options']?_0x4e9a36[_0x064a('0x17')][_0x064a('0x18')]===undefined?!![]:![]:!![]})[_0x064a('0x19')](function(_0x120da0){logger[_0x064a('0xa')]('CreateVoiceAgentReport',_0x4e9a36);logger[_0x064a('0xd')]('CreateVoiceAgentReport',_0x4e9a36,JSON[_0x064a('0xf')](_0x120da0));_0xc3a517(_0x120da0);})[_0x064a('0x13')](function(_0x5cb3c9){logger['error'](_0x064a('0x14'),_0x5cb3c9[_0x064a('0x12')],_0x4e9a36);_0xa74062(_0x5da6b0[_0x064a('0x10')](0x1f4,_0x5cb3c9['message']));});});};exports[_0x064a('0x1a')]=function(_0x22da57){var _0x597808=this;return new Promise(function(_0x3123f2,_0x440e8b){return db[_0x064a('0x15')][_0x064a('0x1b')](_0x22da57[_0x064a('0x1c')],{'raw':_0x22da57[_0x064a('0x17')]?_0x22da57[_0x064a('0x17')][_0x064a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22da57['options']?_0x22da57['options']['where']||null:null,'attributes':_0x22da57[_0x064a('0x17')]?_0x22da57[_0x064a('0x17')]['attributes']||null:null,'limit':_0x22da57[_0x064a('0x17')]?_0x22da57[_0x064a('0x17')][_0x064a('0x1d')]||null:null})['then'](function(_0x27fe27){logger[_0x064a('0xa')]('UpdateVoiceAgentReport',_0x22da57);logger[_0x064a('0xd')](_0x064a('0x1a'),_0x22da57,JSON['stringify'](_0x27fe27));_0x3123f2(_0x27fe27);})[_0x064a('0x13')](function(_0x161e38){logger[_0x064a('0x10')]('UpdateVoiceAgentReport',_0x161e38['message'],_0x22da57);_0x440e8b(_0x597808[_0x064a('0x10')](0x1f4,_0x161e38[_0x064a('0x12')]));});});}; \ No newline at end of file +var _0xfadb=['error','code','message','result','catch','VoiceAgentReport','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2352e6,_0x284408){var _0x530f68=function(_0x3d6ce4){while(--_0x3d6ce4){_0x2352e6['push'](_0x2352e6['shift']());}};_0x530f68(++_0x284408);}(_0xfadb,0xd4));var _0xbfad=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xfadb[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0xbfad('0x0'));var util=require(_0xbfad('0x1'));var moment=require('moment');var BPromise=require(_0xbfad('0x2'));var rs=require(_0xbfad('0x3'));var fs=require('fs');var Redis=require(_0xbfad('0x4'));var db=require(_0xbfad('0x5'))['db'];var utils=require(_0xbfad('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbfad('0x7'));var jayson=require(_0xbfad('0x8'));var client=jayson[_0xbfad('0x9')][_0xbfad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d211,_0x137ed2,_0x3bdd81){return new BPromise(function(_0x4edec8,_0x4f6fdc){return client[_0xbfad('0xb')](_0x14d211,_0x3bdd81)[_0xbfad('0xc')](function(_0x871862){logger[_0xbfad('0xd')](_0xbfad('0xe'),_0x137ed2,_0xbfad('0xf'));logger[_0xbfad('0x10')](_0xbfad('0x11'),_0x137ed2,'request\x20sent',JSON[_0xbfad('0x12')](_0x871862));if(_0x871862[_0xbfad('0x13')]){if(_0x871862['error'][_0xbfad('0x14')]===0x1f4){logger[_0xbfad('0x13')](_0xbfad('0xe'),_0x137ed2,_0x871862[_0xbfad('0x13')][_0xbfad('0x15')]);return _0x4f6fdc(_0x871862[_0xbfad('0x13')][_0xbfad('0x15')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x137ed2,_0x871862['error'][_0xbfad('0x15')]);return _0x4edec8(_0x871862[_0xbfad('0x13')][_0xbfad('0x15')]);}else{logger[_0xbfad('0xd')](_0xbfad('0xe'),_0x137ed2,_0xbfad('0xf'));_0x4edec8(_0x871862[_0xbfad('0x16')]['message']);}})[_0xbfad('0x17')](function(_0x70789b){logger['error'](_0xbfad('0xe'),_0x137ed2,_0x70789b);_0x4f6fdc(_0x70789b);});});}exports['CreateVoiceAgentReport']=function(_0x4f6b7a){var _0x4032ae=this;return new Promise(function(_0x5a46a7,_0x33a4d0){return db[_0xbfad('0x18')]['create'](_0x4f6b7a[_0xbfad('0x19')],{'raw':_0x4f6b7a[_0xbfad('0x1a')]?_0x4f6b7a['options']['raw']===undefined?!![]:![]:!![]})[_0xbfad('0xc')](function(_0x23a06f){logger[_0xbfad('0xd')](_0xbfad('0x1b'),_0x4f6b7a);logger[_0xbfad('0x10')](_0xbfad('0x1b'),_0x4f6b7a,JSON[_0xbfad('0x12')](_0x23a06f));_0x5a46a7(_0x23a06f);})[_0xbfad('0x17')](function(_0x448323){logger[_0xbfad('0x13')](_0xbfad('0x1b'),_0x448323[_0xbfad('0x15')],_0x4f6b7a);_0x33a4d0(_0x4032ae[_0xbfad('0x13')](0x1f4,_0x448323[_0xbfad('0x15')]));});});};exports[_0xbfad('0x1c')]=function(_0x432f15){var _0x33f42e=this;return new Promise(function(_0x5ad5be,_0x446990){return db['VoiceAgentReport'][_0xbfad('0x1d')](_0x432f15[_0xbfad('0x19')],{'raw':_0x432f15[_0xbfad('0x1a')]?_0x432f15[_0xbfad('0x1a')][_0xbfad('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x432f15[_0xbfad('0x1a')]?_0x432f15[_0xbfad('0x1a')][_0xbfad('0x1f')]||null:null,'attributes':_0x432f15[_0xbfad('0x1a')]?_0x432f15[_0xbfad('0x1a')][_0xbfad('0x20')]||null:null,'limit':_0x432f15['options']?_0x432f15[_0xbfad('0x1a')]['limit']||null:null})[_0xbfad('0xc')](function(_0x541088){logger[_0xbfad('0xd')](_0xbfad('0x1c'),_0x432f15);logger['debug'](_0xbfad('0x1c'),_0x432f15,JSON['stringify'](_0x541088));_0x5ad5be(_0x541088);})[_0xbfad('0x17')](function(_0x2da0d9){logger['error']('UpdateVoiceAgentReport',_0x2da0d9[_0xbfad('0x15')],_0x432f15);_0x446990(_0x33f42e[_0xbfad('0x13')](0x1f4,_0x2da0d9[_0xbfad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b2ee2c3..742e255 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 _0x5c12=['./voiceCallReport.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(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x5c12,0x188));var _0x25c1=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x5c12[_0x4d7a61];return _0x186f73;};'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 _0xe5b3=['../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c7c64,_0x304930){var _0xc6ae58=function(_0x12c0b3){while(--_0x12c0b3){_0x1c7c64['push'](_0x1c7c64['shift']());}};_0xc6ae58(++_0x304930);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4b74e3,_0x4b2ce5){_0x4b74e3=_0x4b74e3-0x0;var _0x285b1e=_0xe5b3[_0x4b74e3];return _0x285b1e;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f9267f5..ccada58 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 _0x8b38=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x8b38,0x159));var _0x88b3=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x8b38[_0x2cc8bb];return _0x140e40;};'use strict';var Sequelize=require(_0x88b3('0x0'));module[_0x88b3('0x1')]={'uniqueid':{'type':Sequelize[_0x88b3('0x2')]},'type':{'type':Sequelize[_0x88b3('0x3')](_0x88b3('0x4'),'internal',_0x88b3('0x5'),_0x88b3('0x6'),'outbound-fax',_0x88b3('0x7'))},'tag':{'type':Sequelize[_0x88b3('0x2')]},'accountcode':{'type':Sequelize[_0x88b3('0x2')]},'source':{'type':Sequelize[_0x88b3('0x2')]},'destination':{'type':Sequelize[_0x88b3('0x2')]},'destinationcontext':{'type':Sequelize[_0x88b3('0x2')]},'callerid':{'type':Sequelize[_0x88b3('0x2')]},'channel':{'type':Sequelize[_0x88b3('0x2')]},'destinationchannel':{'type':Sequelize[_0x88b3('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x88b3('0x8')]},'starttime':{'type':Sequelize[_0x88b3('0x9')]},'systemanswertime':{'type':Sequelize[_0x88b3('0x9')]},'answertime':{'type':Sequelize[_0x88b3('0x9')]},'endtime':{'type':Sequelize[_0x88b3('0x9')]},'duration':{'type':Sequelize[_0x88b3('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x88b3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x88b3('0x2')]},'userfield':{'type':Sequelize[_0x88b3('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x88b3('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x88b3('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x88b3('0x2')]}}; \ No newline at end of file +var _0xe8f9=['inbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x559dbf,_0x249d39){var _0x578eb7=function(_0x18389e){while(--_0x18389e){_0x559dbf['push'](_0x559dbf['shift']());}};_0x578eb7(++_0x249d39);}(_0xe8f9,0x73));var _0x9e8f=function(_0x5b3a05,_0x22ae61){_0x5b3a05=_0x5b3a05-0x0;var _0x3c2cd9=_0xe8f9[_0x5b3a05];return _0x3c2cd9;};'use strict';var Sequelize=require('sequelize');module[_0x9e8f('0x0')]={'uniqueid':{'type':Sequelize[_0x9e8f('0x1')]},'type':{'type':Sequelize[_0x9e8f('0x2')](_0x9e8f('0x3'),_0x9e8f('0x4'),_0x9e8f('0x5'),_0x9e8f('0x6'),'outbound-fax',_0x9e8f('0x7'))},'tag':{'type':Sequelize[_0x9e8f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9e8f('0x1')]},'destination':{'type':Sequelize[_0x9e8f('0x1')]},'destinationcontext':{'type':Sequelize[_0x9e8f('0x1')]},'callerid':{'type':Sequelize[_0x9e8f('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x9e8f('0x1')]},'lastapplication':{'type':Sequelize[_0x9e8f('0x1')]},'lastdata':{'type':Sequelize[_0x9e8f('0x8')]},'starttime':{'type':Sequelize[_0x9e8f('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9e8f('0x9')]},'endtime':{'type':Sequelize[_0x9e8f('0x9')]},'duration':{'type':Sequelize[_0x9e8f('0xa')]},'billableseconds':{'type':Sequelize[_0x9e8f('0xa')]},'mohtime':{'type':Sequelize[_0x9e8f('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9e8f('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9e8f('0x1')]},'userDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'note':{'type':Sequelize[_0x9e8f('0x1')]},'prefix':{'type':Sequelize[_0x9e8f('0x1')]},'routeid':{'type':Sequelize[_0x9e8f('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 155a0b5..26f2fa9 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0xadb5,0xad));var _0x5adb=function(_0x439a22,_0x676efc){_0x439a22=_0x439a22-0x0;var _0x106d46=_0xadb5[_0x439a22];return _0x106d46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x2ef3,0xba));var _0x32ef=function(_0x123752,_0x55a347){_0x123752=_0x123752-0x0;var _0x24b937=_0x2ef3[_0x123752];return _0x24b937;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c0ea771..13633f3 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 _0xdc2a=['path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4f3cf6,_0x1d8c0b){var _0x26309f=function(_0x5031c5){while(--_0x5031c5){_0x4f3cf6['push'](_0x4f3cf6['shift']());}};_0x26309f(++_0x1d8c0b);}(_0xdc2a,0x166));var _0xadc2=function(_0x2e6ccb,_0x456879){_0x2e6ccb=_0x2e6ccb-0x0;var _0x3ced12=_0xdc2a[_0x2e6ccb];return _0x3ced12;};'use strict';var _=require(_0xadc2('0x0'));var util=require(_0xadc2('0x1'));var logger=require('../../config/logger')(_0xadc2('0x2'));var moment=require(_0xadc2('0x3'));var BPromise=require(_0xadc2('0x4'));var rp=require(_0xadc2('0x5'));var fs=require('fs');var path=require(_0xadc2('0x6'));var rimraf=require(_0xadc2('0x7'));var config=require(_0xadc2('0x8'));var attributes=require(_0xadc2('0x9'));module['exports']=function(_0x9684a5,_0x2d5f59){return _0x9684a5[_0xadc2('0xa')](_0xadc2('0xb'),attributes,{'tableName':_0xadc2('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x64c4=['./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0xed83db,_0x1b1aa8){var _0x3ff37e=function(_0xf7f40d){while(--_0xf7f40d){_0xed83db['push'](_0xed83db['shift']());}};_0x3ff37e(++_0x1b1aa8);}(_0x64c4,0x94));var _0x464c=function(_0x72142c,_0x1cbf5d){_0x72142c=_0x72142c-0x0;var _0x59d445=_0x64c4[_0x72142c];return _0x59d445;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var logger=require(_0x464c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x464c('0x3'));var fs=require('fs');var path=require(_0x464c('0x4'));var rimraf=require(_0x464c('0x5'));var config=require('../../config/environment');var attributes=require(_0x464c('0x6'));module[_0x464c('0x7')]=function(_0x5e4e2a,_0x235278){return _0x5e4e2a[_0x464c('0x8')]('VoiceCallReport',attributes,{'tableName':_0x464c('0x9'),'paranoid':![],'indexes':[{'fields':[_0x464c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index fad521a..bc56418 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 _0x7696=['../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','model','map','stringify','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','../../config/utils','rpc'];(function(_0x42ea0a,_0x211485){var _0x358c8e=function(_0x10232e){while(--_0x10232e){_0x42ea0a['push'](_0x42ea0a['shift']());}};_0x358c8e(++_0x211485);}(_0x7696,0xa4));var _0x6769=function(_0x1d19a0,_0x230548){_0x1d19a0=_0x1d19a0-0x0;var _0x5bab2d=_0x7696[_0x1d19a0];return _0x5bab2d;};'use strict';var _=require(_0x6769('0x0'));var util=require(_0x6769('0x1'));var moment=require(_0x6769('0x2'));var BPromise=require(_0x6769('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6769('0x4'));var logger=require('../../config/logger')(_0x6769('0x5'));var config=require(_0x6769('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6769('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dd2fd,_0x195a12,_0x128042){return new BPromise(function(_0x273fda,_0xed85e2){return client[_0x6769('0x8')](_0x1dd2fd,_0x128042)[_0x6769('0x9')](function(_0x32f6d2){logger[_0x6769('0xa')](_0x6769('0xb'),_0x195a12,_0x6769('0xc'));logger[_0x6769('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x195a12,_0x6769('0xc'),JSON['stringify'](_0x32f6d2));if(_0x32f6d2[_0x6769('0xe')]){if(_0x32f6d2[_0x6769('0xe')][_0x6769('0xf')]===0x1f4){logger[_0x6769('0xe')](_0x6769('0xb'),_0x195a12,_0x32f6d2[_0x6769('0xe')][_0x6769('0x10')]);return _0xed85e2(_0x32f6d2['error'][_0x6769('0x10')]);}logger[_0x6769('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x195a12,_0x32f6d2[_0x6769('0xe')][_0x6769('0x10')]);return _0x273fda(_0x32f6d2[_0x6769('0xe')]['message']);}else{logger[_0x6769('0xa')](_0x6769('0xb'),_0x195a12,_0x6769('0xc'));_0x273fda(_0x32f6d2[_0x6769('0x11')][_0x6769('0x10')]);}})[_0x6769('0x12')](function(_0x2c37c3){logger[_0x6769('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x195a12,_0x2c37c3);_0xed85e2(_0x2c37c3);});});}exports[_0x6769('0x13')]=function(_0x597a8c){var _0x48768d=this;return new Promise(function(_0x3f4ebf,_0x4b53c3){return db[_0x6769('0x14')][_0x6769('0x15')]({'raw':_0x597a8c[_0x6769('0x16')]?_0x597a8c[_0x6769('0x16')][_0x6769('0x17')]===undefined?!![]:![]:!![],'where':_0x597a8c['options']?_0x597a8c[_0x6769('0x16')]['where']||null:null,'attributes':_0x597a8c[_0x6769('0x16')]?_0x597a8c[_0x6769('0x16')][_0x6769('0x18')]||null:null,'limit':_0x597a8c[_0x6769('0x16')]?_0x597a8c['options'][_0x6769('0x19')]||null:null,'include':_0x597a8c[_0x6769('0x16')]?_0x597a8c[_0x6769('0x16')][_0x6769('0x1a')]?_['map'](_0x597a8c[_0x6769('0x16')][_0x6769('0x1a')],function(_0x2ca548){return{'model':db[_0x2ca548[_0x6769('0x1b')]],'as':_0x2ca548['as'],'attributes':_0x2ca548[_0x6769('0x18')],'include':_0x2ca548['include']?_[_0x6769('0x1c')](_0x2ca548['include'],function(_0x2903a1){return{'model':db[_0x2903a1['model']],'as':_0x2903a1['as'],'attributes':_0x2903a1['attributes'],'include':_0x2903a1['include']?_[_0x6769('0x1c')](_0x2903a1['include'],function(_0x4909b5){return{'model':db[_0x4909b5[_0x6769('0x1b')]],'as':_0x4909b5['as'],'attributes':_0x4909b5[_0x6769('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6769('0x9')](function(_0x57223e){logger[_0x6769('0xa')](_0x6769('0x13'),_0x597a8c);logger['debug'](_0x6769('0x13'),_0x597a8c,JSON[_0x6769('0x1d')](_0x57223e));_0x3f4ebf(_0x57223e);})['catch'](function(_0x48cfaf){logger[_0x6769('0xe')](_0x6769('0x13'),_0x48cfaf[_0x6769('0x10')],_0x597a8c);_0x4b53c3(_0x48768d[_0x6769('0xe')](0x1f4,_0x48cfaf[_0x6769('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x1ada2e){var _0x360ffc=this;return new Promise(function(_0x40b310,_0x6c8952){return db[_0x6769('0x14')]['create'](_0x1ada2e[_0x6769('0x1e')],{'raw':_0x1ada2e[_0x6769('0x16')]?_0x1ada2e['options'][_0x6769('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x9b9d14){logger[_0x6769('0xa')](_0x6769('0x1f'),_0x1ada2e);logger[_0x6769('0xd')](_0x6769('0x1f'),_0x1ada2e,JSON[_0x6769('0x1d')](_0x9b9d14));_0x40b310(_0x9b9d14);})['catch'](function(_0x4e35f4){logger['error'](_0x6769('0x1f'),_0x4e35f4[_0x6769('0x10')],_0x1ada2e);_0x6c8952(_0x360ffc['error'](0x1f4,_0x4e35f4[_0x6769('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0x565a4d){var _0x3836a8=this;return new Promise(function(_0x6b0cb0,_0x450124){return db[_0x6769('0x14')][_0x6769('0x20')](_0x565a4d[_0x6769('0x1e')],{'raw':_0x565a4d['options']?_0x565a4d[_0x6769('0x16')][_0x6769('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a4d[_0x6769('0x16')]?_0x565a4d[_0x6769('0x16')]['where']||null:null,'attributes':_0x565a4d[_0x6769('0x16')]?_0x565a4d[_0x6769('0x16')]['attributes']||null:null,'limit':_0x565a4d[_0x6769('0x16')]?_0x565a4d[_0x6769('0x16')][_0x6769('0x19')]||null:null})[_0x6769('0x9')](function(_0x3916ea){logger['info'](_0x6769('0x21'),_0x565a4d);logger[_0x6769('0xd')]('UpdateVoiceCallReport',_0x565a4d,JSON[_0x6769('0x1d')](_0x3916ea));_0x6b0cb0(_0x3916ea);})[_0x6769('0x12')](function(_0x1e2d27){logger['error'](_0x6769('0x21'),_0x1e2d27[_0x6769('0x10')],_0x565a4d);_0x450124(_0x3836a8['error'](0x1f4,_0x1e2d27['message']));});});}; \ No newline at end of file +var _0xf537=['include','attributes','model','GetVoiceCallReport','debug','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceCallReport','findAll','options','raw','limit','map'];(function(_0x34d8fc,_0x54afb6){var _0x29a576=function(_0x2e0e2b){while(--_0x2e0e2b){_0x34d8fc['push'](_0x34d8fc['shift']());}};_0x29a576(++_0x54afb6);}(_0xf537,0x143));var _0x7f53=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf537[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7f53('0x0'));var util=require('util');var moment=require(_0x7f53('0x1'));var BPromise=require(_0x7f53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f53('0x3'));var db=require(_0x7f53('0x4'))['db'];var utils=require(_0x7f53('0x5'));var logger=require(_0x7f53('0x6'))('rpc');var config=require(_0x7f53('0x7'));var jayson=require(_0x7f53('0x8'));var client=jayson[_0x7f53('0x9')][_0x7f53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31da75,_0x57184d,_0x14839c){return new BPromise(function(_0xd16710,_0x1fd4a9){return client[_0x7f53('0xb')](_0x31da75,_0x14839c)[_0x7f53('0xc')](function(_0x3f4b12){logger[_0x7f53('0xd')](_0x7f53('0xe'),_0x57184d,_0x7f53('0xf'));logger['debug'](_0x7f53('0x10'),_0x57184d,_0x7f53('0xf'),JSON[_0x7f53('0x11')](_0x3f4b12));if(_0x3f4b12[_0x7f53('0x12')]){if(_0x3f4b12['error']['code']===0x1f4){logger[_0x7f53('0x12')](_0x7f53('0xe'),_0x57184d,_0x3f4b12[_0x7f53('0x12')][_0x7f53('0x13')]);return _0x1fd4a9(_0x3f4b12['error'][_0x7f53('0x13')]);}logger[_0x7f53('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x57184d,_0x3f4b12[_0x7f53('0x12')][_0x7f53('0x13')]);return _0xd16710(_0x3f4b12[_0x7f53('0x12')][_0x7f53('0x13')]);}else{logger[_0x7f53('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x57184d,'request\x20sent');_0xd16710(_0x3f4b12[_0x7f53('0x14')][_0x7f53('0x13')]);}})[_0x7f53('0x15')](function(_0x2bb098){logger['error'](_0x7f53('0xe'),_0x57184d,_0x2bb098);_0x1fd4a9(_0x2bb098);});});}exports['GetVoiceCallReport']=function(_0x57e23a){var _0x1763c8=this;return new Promise(function(_0x81931,_0x4d34a1){return db[_0x7f53('0x16')][_0x7f53('0x17')]({'raw':_0x57e23a[_0x7f53('0x18')]?_0x57e23a[_0x7f53('0x18')][_0x7f53('0x19')]===undefined?!![]:![]:!![],'where':_0x57e23a[_0x7f53('0x18')]?_0x57e23a[_0x7f53('0x18')]['where']||null:null,'attributes':_0x57e23a['options']?_0x57e23a[_0x7f53('0x18')]['attributes']||null:null,'limit':_0x57e23a[_0x7f53('0x18')]?_0x57e23a['options'][_0x7f53('0x1a')]||null:null,'include':_0x57e23a[_0x7f53('0x18')]?_0x57e23a[_0x7f53('0x18')]['include']?_[_0x7f53('0x1b')](_0x57e23a['options'][_0x7f53('0x1c')],function(_0x4758f5){return{'model':db[_0x4758f5['model']],'as':_0x4758f5['as'],'attributes':_0x4758f5[_0x7f53('0x1d')],'include':_0x4758f5[_0x7f53('0x1c')]?_['map'](_0x4758f5['include'],function(_0x12d898){return{'model':db[_0x12d898['model']],'as':_0x12d898['as'],'attributes':_0x12d898['attributes'],'include':_0x12d898[_0x7f53('0x1c')]?_[_0x7f53('0x1b')](_0x12d898['include'],function(_0x540360){return{'model':db[_0x540360[_0x7f53('0x1e')]],'as':_0x540360['as'],'attributes':_0x540360['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f53('0xc')](function(_0x103f9b){logger[_0x7f53('0xd')](_0x7f53('0x1f'),_0x57e23a);logger[_0x7f53('0x20')]('GetVoiceCallReport',_0x57e23a,JSON[_0x7f53('0x11')](_0x103f9b));_0x81931(_0x103f9b);})[_0x7f53('0x15')](function(_0x1f4898){logger[_0x7f53('0x12')](_0x7f53('0x1f'),_0x1f4898['message'],_0x57e23a);_0x4d34a1(_0x1763c8[_0x7f53('0x12')](0x1f4,_0x1f4898[_0x7f53('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x1145da){var _0x2378bf=this;return new Promise(function(_0x52c28a,_0x4e7952){return db[_0x7f53('0x16')][_0x7f53('0x21')](_0x1145da[_0x7f53('0x22')],{'raw':_0x1145da[_0x7f53('0x18')]?_0x1145da[_0x7f53('0x18')][_0x7f53('0x19')]===undefined?!![]:![]:!![]})[_0x7f53('0xc')](function(_0x12be3b){logger[_0x7f53('0xd')](_0x7f53('0x23'),_0x1145da);logger[_0x7f53('0x20')]('CreateVoiceCallReport',_0x1145da,JSON['stringify'](_0x12be3b));_0x52c28a(_0x12be3b);})[_0x7f53('0x15')](function(_0x340a02){logger[_0x7f53('0x12')](_0x7f53('0x23'),_0x340a02[_0x7f53('0x13')],_0x1145da);_0x4e7952(_0x2378bf['error'](0x1f4,_0x340a02[_0x7f53('0x13')]));});});};exports[_0x7f53('0x24')]=function(_0x53983d){var _0x29ef94=this;return new Promise(function(_0x20ca93,_0x4626f6){return db[_0x7f53('0x16')][_0x7f53('0x25')](_0x53983d['body'],{'raw':_0x53983d[_0x7f53('0x18')]?_0x53983d[_0x7f53('0x18')][_0x7f53('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53983d[_0x7f53('0x18')]?_0x53983d['options'][_0x7f53('0x26')]||null:null,'attributes':_0x53983d[_0x7f53('0x18')]?_0x53983d[_0x7f53('0x18')][_0x7f53('0x1d')]||null:null,'limit':_0x53983d[_0x7f53('0x18')]?_0x53983d[_0x7f53('0x18')][_0x7f53('0x1a')]||null:null})[_0x7f53('0xc')](function(_0x569fb8){logger[_0x7f53('0xd')]('UpdateVoiceCallReport',_0x53983d);logger[_0x7f53('0x20')]('UpdateVoiceCallReport',_0x53983d,JSON[_0x7f53('0x11')](_0x569fb8));_0x20ca93(_0x569fb8);})['catch'](function(_0x391450){logger['error'](_0x7f53('0x24'),_0x391450[_0x7f53('0x13')],_0x53983d);_0x4626f6(_0x29ef94[_0x7f53('0x12')](0x1f4,_0x391450[_0x7f53('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d8f680e..ae94a0a 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 _0x8338=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x8338,0x1e3));var _0x8833=function(_0x3b1689,_0x32573a){_0x3b1689=_0x3b1689-0x0;var _0x41a6b4=_0x8338[_0x3b1689];return _0x41a6b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8833('0x0'));var timeout=require(_0x8833('0x1'));var express=require(_0x8833('0x2'));var router=express[_0x8833('0x3')]();var fs_extra=require(_0x8833('0x4'));var auth=require(_0x8833('0x5'));var interaction=require(_0x8833('0x6'));var config=require(_0x8833('0x7'));var controller=require(_0x8833('0x8'));router['get']('/',auth[_0x8833('0x9')](),controller[_0x8833('0xa')]);router[_0x8833('0xb')](_0x8833('0xc'),auth['isAuthenticated'](),controller[_0x8833('0xd')]);router[_0x8833('0xe')]('/',auth['isAuthenticated'](),controller[_0x8833('0xf')]);router[_0x8833('0x10')]('/:id',auth[_0x8833('0x9')](),controller[_0x8833('0x11')]);router[_0x8833('0x12')](_0x8833('0xc'),auth[_0x8833('0x9')](),controller[_0x8833('0x13')]);module[_0x8833('0x14')]=router; \ No newline at end of file +var _0x8b9c=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','put','update','delete'];(function(_0x310990,_0x245984){var _0x648534=function(_0xd320e5){while(--_0xd320e5){_0x310990['push'](_0x310990['shift']());}};_0x648534(++_0x245984);}(_0x8b9c,0x13c));var _0xc8b9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8b9c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc8b9('0x0'));var util=require(_0xc8b9('0x1'));var path=require(_0xc8b9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc8b9('0x3')]();var fs_extra=require(_0xc8b9('0x4'));var auth=require(_0xc8b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc8b9('0x6'));router[_0xc8b9('0x7')]('/',auth[_0xc8b9('0x8')](),controller['index']);router[_0xc8b9('0x7')](_0xc8b9('0x9'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc8b9('0xb')](_0xc8b9('0x9'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0xc')]);router[_0xc8b9('0xd')](_0xc8b9('0x9'),auth[_0xc8b9('0x8')](),controller['destroy']);module[_0xc8b9('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8d6a716..60c1e73 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 _0x315c=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x315c,0xfc));var _0xc315=function(_0x37f2f1,_0x114b35){_0x37f2f1=_0x37f2f1-0x0;var _0x197abb=_0x315c[_0x37f2f1];return _0x197abb;};'use strict';var Sequelize=require(_0xc315('0x0'));module[_0xc315('0x1')]={'name':{'type':Sequelize[_0xc315('0x2')]},'prefix':{'type':Sequelize[_0xc315('0x2')],'unique':_0xc315('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x49e819){this[_0xc315('0x4')](_0xc315('0x5'),_0x49e819?_0x49e819[_0xc315('0x6')](''):[]);},'get':function(){return this[_0xc315('0x7')](_0xc315('0x5'))?this[_0xc315('0x7')]('options')[_0xc315('0x8')](''):[];}},'auth':{'type':Sequelize[_0xc315('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xc315('0x2')]},'record':{'type':Sequelize[_0xc315('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc315('0x2')]},'description':{'type':Sequelize[_0xc315('0x2')]}}; \ No newline at end of file +var _0xd7a3=['split','BOOLEAN','exports','STRING','name','setDataValue','join','getDataValue'];(function(_0x1a850e,_0x3f5312){var _0x285c5a=function(_0x7b9c45){while(--_0x7b9c45){_0x1a850e['push'](_0x1a850e['shift']());}};_0x285c5a(++_0x3f5312);}(_0xd7a3,0xd2));var _0x3d7a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd7a3[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x3d7a('0x0')]={'name':{'type':Sequelize[_0x3d7a('0x1')]},'prefix':{'type':Sequelize[_0x3d7a('0x1')],'unique':_0x3d7a('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x20c03f){this[_0x3d7a('0x3')]('options',_0x20c03f?_0x20c03f[_0x3d7a('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x3d7a('0x5')]('options')[_0x3d7a('0x6')](''):[];}},'auth':{'type':Sequelize[_0x3d7a('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x3d7a('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3d7a('0x1')]},'description':{'type':Sequelize[_0x3d7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 36bb783..d4a7962 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 _0xc2cc=['send','index','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','findAll','rows','catch','params','include','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','status','end','error','stack','name'];(function(_0x5a62ee,_0x324ff8){var _0x47b49e=function(_0x5a06d9){while(--_0x5a06d9){_0x5a62ee['push'](_0x5a62ee['shift']());}};_0x47b49e(++_0x324ff8);}(_0xc2cc,0x70));var _0xcc2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc2cc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc2c('0x0'));var zipdir=require(_0xcc2c('0x1'));var jsonpatch=require(_0xcc2c('0x2'));var rp=require('request-promise');var moment=require(_0xcc2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc2c('0x4'));var util=require('util');var path=require(_0xcc2c('0x5'));var sox=require('sox');var csv=require(_0xcc2c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc2c('0x7'));var squel=require('squel');var crypto=require(_0xcc2c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xcc2c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc2c('0xa'));var Redis=require(_0xcc2c('0xb'));var authService=require(_0xcc2c('0xc'));var qs=require(_0xcc2c('0xd'));var as=require(_0xcc2c('0xe'));var hardwareService=require(_0xcc2c('0xf'));var logger=require(_0xcc2c('0x10'))(_0xcc2c('0x11'));var utils=require('../../config/utils');var config=require(_0xcc2c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc2c('0x13'))['db'];function respondWithStatusCode(_0x42294d,_0x3900a4){_0x3900a4=_0x3900a4||0xcc;return function(_0x1f6f0f){if(_0x1f6f0f){return _0x42294d['sendStatus'](_0x3900a4);}return _0x42294d['status'](_0x3900a4)['end']();};}function respondWithResult(_0x2cab27,_0xc1cafd){_0xc1cafd=_0xc1cafd||0xc8;return function(_0x5086f2){if(_0x5086f2){return _0x2cab27['status'](_0xc1cafd)[_0xcc2c('0x14')](_0x5086f2);}};}function respondWithFilteredResult(_0x494f3d,_0x18a774){return function(_0x344caa){if(_0x344caa){var _0x10a651=typeof _0x18a774[_0xcc2c('0x15')]==='undefined'&&typeof _0x18a774['limit']===_0xcc2c('0x16');var _0xe04b56=_0x344caa['count'];var _0x31849a=_0x10a651?0x0:_0x18a774[_0xcc2c('0x15')];var _0x440458=_0x10a651?_0x344caa[_0xcc2c('0x17')]:_0x18a774[_0xcc2c('0x15')]+_0x18a774[_0xcc2c('0x18')];var _0x36969f;if(_0x440458>=_0xe04b56){_0x440458=_0xe04b56;_0x36969f=0xc8;}else{_0x36969f=0xce;}_0x494f3d['status'](_0x36969f);return _0x494f3d[_0xcc2c('0x19')](_0xcc2c('0x1a'),_0x31849a+'-'+_0x440458+'/'+_0xe04b56)['json'](_0x344caa);}return null;};}function patchUpdates(_0x4d22fe){return function(_0x4a67f4){try{jsonpatch[_0xcc2c('0x1b')](_0x4a67f4,_0x4d22fe,!![]);}catch(_0x58f3cb){return BPromise[_0xcc2c('0x1c')](_0x58f3cb);}return _0x4a67f4[_0xcc2c('0x1d')]();};}function saveUpdates(_0x5b8ade,_0x321279){return function(_0x831360){if(_0x831360){return _0x831360['update'](_0x5b8ade)[_0xcc2c('0x1e')](function(_0x510f36){return _0x510f36;});}return null;};}function removeEntity(_0x31788d,_0x5233e3){return function(_0x4d5132){if(_0x4d5132){return _0x4d5132[_0xcc2c('0x1f')]()[_0xcc2c('0x1e')](function(){var _0x5e491f=_0x4d5132[_0xcc2c('0x20')]({'plain':!![]});var _0x1d3f8d=_0xcc2c('0x21');return db[_0xcc2c('0x22')][_0xcc2c('0x1f')]({'where':{'type':_0x1d3f8d,'resourceId':_0x5e491f['id']}})[_0xcc2c('0x1e')](function(){return _0x4d5132;});})['then'](function(){_0x31788d[_0xcc2c('0x23')](0xcc)[_0xcc2c('0x24')]();});}};}function handleEntityNotFound(_0x343603,_0xfd6b4b){return function(_0x430eef){if(!_0x430eef){_0x343603['sendStatus'](0x194);}return _0x430eef;};}function handleError(_0x52fdb4,_0x50c32b){_0x50c32b=_0x50c32b||0x1f4;return function(_0x54ea89){logger[_0xcc2c('0x25')](_0x54ea89[_0xcc2c('0x26')]);if(_0x54ea89[_0xcc2c('0x27')]){delete _0x54ea89[_0xcc2c('0x27')];}_0x52fdb4[_0xcc2c('0x23')](_0x50c32b)[_0xcc2c('0x28')](_0x54ea89);};}exports[_0xcc2c('0x29')]=function(_0x7e9c0b,_0x70a768){var _0x3cd971={},_0x2521ee={},_0x5973aa={'count':0x0,'rows':[]};var _0x353f80=_['map'](db['VoiceChanSpy']['rawAttributes'],function(_0x31778c){return{'name':_0x31778c[_0xcc2c('0x2a')],'type':_0x31778c['type']['key']};});_0x2521ee[_0xcc2c('0x2b')]=_['map'](_0x353f80,_0xcc2c('0x27'));_0x2521ee[_0xcc2c('0x2c')]=_[_0xcc2c('0x2d')](_0x7e9c0b[_0xcc2c('0x2c')]);_0x2521ee[_0xcc2c('0x2e')]=_['intersection'](_0x2521ee['model'],_0x2521ee[_0xcc2c('0x2c')]);_0x3cd971[_0xcc2c('0x2f')]=_[_0xcc2c('0x30')](_0x2521ee[_0xcc2c('0x2b')],qs[_0xcc2c('0x31')](_0x7e9c0b['query'][_0xcc2c('0x31')]));_0x3cd971['attributes']=_0x3cd971[_0xcc2c('0x2f')][_0xcc2c('0x32')]?_0x3cd971['attributes']:_0x2521ee[_0xcc2c('0x2b')];if(!_0x7e9c0b['query']['hasOwnProperty'](_0xcc2c('0x33'))){_0x3cd971['limit']=qs[_0xcc2c('0x18')](_0x7e9c0b[_0xcc2c('0x2c')][_0xcc2c('0x18')]);_0x3cd971['offset']=qs[_0xcc2c('0x15')](_0x7e9c0b[_0xcc2c('0x2c')]['offset']);}_0x3cd971[_0xcc2c('0x34')]=qs['sort'](_0x7e9c0b[_0xcc2c('0x2c')]['sort']);_0x3cd971[_0xcc2c('0x35')]=qs[_0xcc2c('0x2e')](_[_0xcc2c('0x36')](_0x7e9c0b['query'],_0x2521ee[_0xcc2c('0x2e')]),_0x353f80);if(_0x7e9c0b[_0xcc2c('0x2c')][_0xcc2c('0x37')]){_0x3cd971[_0xcc2c('0x35')]=_[_0xcc2c('0x38')](_0x3cd971[_0xcc2c('0x35')],{'$or':_['map'](_0x353f80,function(_0x279744){if(_0x279744[_0xcc2c('0x39')]!==_0xcc2c('0x3a')){var _0x43afd6={};_0x43afd6[_0x279744['name']]={'$like':'%'+_0x7e9c0b[_0xcc2c('0x2c')][_0xcc2c('0x37')]+'%'};return _0x43afd6;}})});}_0x3cd971=_[_0xcc2c('0x38')]({},_0x3cd971,_0x7e9c0b[_0xcc2c('0x3b')]);var _0x21834b={'where':_0x3cd971[_0xcc2c('0x35')]};return db[_0xcc2c('0x3c')][_0xcc2c('0x17')](_0x21834b)[_0xcc2c('0x1e')](function(_0x1c42e6){_0x5973aa['count']=_0x1c42e6;if(_0x7e9c0b[_0xcc2c('0x2c')][_0xcc2c('0x3d')]){_0x3cd971['include']=[{'all':!![]}];}return db[_0xcc2c('0x3c')][_0xcc2c('0x3e')](_0x3cd971);})[_0xcc2c('0x1e')](function(_0x3e30bf){_0x5973aa[_0xcc2c('0x3f')]=_0x3e30bf;return _0x5973aa;})[_0xcc2c('0x1e')](respondWithFilteredResult(_0x70a768,_0x3cd971))[_0xcc2c('0x40')](handleError(_0x70a768,null));};exports['show']=function(_0x3c3f29,_0xed1dd7){var _0x172185={'raw':![],'where':{'id':_0x3c3f29[_0xcc2c('0x41')]['id']}},_0x141a25={};_0x141a25[_0xcc2c('0x2b')]=_[_0xcc2c('0x2d')](db['VoiceChanSpy']['rawAttributes']);_0x141a25[_0xcc2c('0x2c')]=_[_0xcc2c('0x2d')](_0x3c3f29[_0xcc2c('0x2c')]);_0x141a25[_0xcc2c('0x2e')]=_[_0xcc2c('0x30')](_0x141a25[_0xcc2c('0x2b')],_0x141a25[_0xcc2c('0x2c')]);_0x172185[_0xcc2c('0x2f')]=_[_0xcc2c('0x30')](_0x141a25[_0xcc2c('0x2b')],qs['fields'](_0x3c3f29[_0xcc2c('0x2c')]['fields']));_0x172185[_0xcc2c('0x2f')]=_0x172185[_0xcc2c('0x2f')]['length']?_0x172185[_0xcc2c('0x2f')]:_0x141a25[_0xcc2c('0x2b')];if(_0x3c3f29[_0xcc2c('0x2c')][_0xcc2c('0x3d')]){_0x172185[_0xcc2c('0x42')]=[{'all':!![]}];}_0x172185=_['merge']({},_0x172185,_0x3c3f29['options']);return db[_0xcc2c('0x3c')]['find'](_0x172185)['then'](handleEntityNotFound(_0xed1dd7,null))['then'](respondWithResult(_0xed1dd7,null))[_0xcc2c('0x40')](handleError(_0xed1dd7,null));};exports['create']=function(_0x4f9557,_0x55a70f){return db['VoiceChanSpy']['create'](_0x4f9557['body'],{})[_0xcc2c('0x1e')](function(_0x4b7b6f){var _0x6d3072=_0x4f9557[_0xcc2c('0x43')][_0xcc2c('0x20')]({'plain':!![]});if(!_0x6d3072)throw new Error(_0xcc2c('0x44'));if(_0x6d3072['role']===_0xcc2c('0x43')){var _0x167e37=_0x4b7b6f[_0xcc2c('0x20')]({'plain':!![]});var _0x2b93a7='ChanSpies';return db[_0xcc2c('0x45')][_0xcc2c('0x46')]({'where':{'name':_0x2b93a7,'userProfileId':_0x6d3072[_0xcc2c('0x47')]},'raw':!![]})[_0xcc2c('0x1e')](function(_0x3f7c9f){if(_0x3f7c9f&&_0x3f7c9f[_0xcc2c('0x48')]===0x0){return db[_0xcc2c('0x22')][_0xcc2c('0x49')]({'name':_0x167e37[_0xcc2c('0x27')],'resourceId':_0x167e37['id'],'type':_0x3f7c9f[_0xcc2c('0x27')],'sectionId':_0x3f7c9f['id']},{})[_0xcc2c('0x1e')](function(){return _0x4b7b6f;});}else{return _0x4b7b6f;}})[_0xcc2c('0x40')](function(_0x5de4ce){logger[_0xcc2c('0x25')](_0xcc2c('0x4a'),_0x5de4ce);throw _0x5de4ce;});}return _0x4b7b6f;})[_0xcc2c('0x1e')](respondWithResult(_0x55a70f,0xc9))[_0xcc2c('0x40')](handleError(_0x55a70f,null));};exports['update']=function(_0x43c714,_0x3e460f){if(_0x43c714[_0xcc2c('0x4b')]['id']){delete _0x43c714[_0xcc2c('0x4b')]['id'];}return db[_0xcc2c('0x3c')]['find']({'where':{'id':_0x43c714[_0xcc2c('0x41')]['id']}})[_0xcc2c('0x1e')](handleEntityNotFound(_0x3e460f,null))[_0xcc2c('0x1e')](saveUpdates(_0x43c714['body'],null))[_0xcc2c('0x1e')](respondWithResult(_0x3e460f,null))[_0xcc2c('0x40')](handleError(_0x3e460f,null));};exports[_0xcc2c('0x1f')]=function(_0x24fb60,_0xa68759){return db['VoiceChanSpy']['find']({'where':{'id':_0x24fb60[_0xcc2c('0x41')]['id']}})['then'](handleEntityNotFound(_0xa68759,null))[_0xcc2c('0x1e')](removeEntity(_0xa68759,null))[_0xcc2c('0x40')](handleError(_0xa68759,null));}; \ No newline at end of file +var _0xa854=['user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','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','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa854,0x103));var _0x4a85=function(_0x25dcfe,_0x145777){_0x25dcfe=_0x25dcfe-0x0;var _0x124798=_0xa854[_0x25dcfe];return _0x124798;};'use strict';var emlformat=require(_0x4a85('0x0'));var rimraf=require(_0x4a85('0x1'));var zipdir=require(_0x4a85('0x2'));var jsonpatch=require(_0x4a85('0x3'));var rp=require(_0x4a85('0x4'));var moment=require('moment');var BPromise=require(_0x4a85('0x5'));var Mustache=require('mustache');var util=require(_0x4a85('0x6'));var path=require('path');var sox=require(_0x4a85('0x7'));var csv=require(_0x4a85('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a85('0x9'));var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0x8'));var querystring=require(_0x4a85('0xd'));var Papa=require(_0x4a85('0xe'));var Redis=require(_0x4a85('0xf'));var authService=require(_0x4a85('0x10'));var qs=require(_0x4a85('0x11'));var as=require(_0x4a85('0x12'));var hardwareService=require(_0x4a85('0x13'));var logger=require('../../config/logger')(_0x4a85('0x14'));var utils=require(_0x4a85('0x15'));var config=require(_0x4a85('0x16'));var licenseUtil=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];function respondWithStatusCode(_0x95669b,_0x108b0d){_0x108b0d=_0x108b0d||0xcc;return function(_0x42088d){if(_0x42088d){return _0x95669b[_0x4a85('0x19')](_0x108b0d);}return _0x95669b['status'](_0x108b0d)[_0x4a85('0x1a')]();};}function respondWithResult(_0x2a2802,_0x454596){_0x454596=_0x454596||0xc8;return function(_0x153d39){if(_0x153d39){return _0x2a2802[_0x4a85('0x1b')](_0x454596)[_0x4a85('0x1c')](_0x153d39);}};}function respondWithFilteredResult(_0x34743a,_0x256a3c){return function(_0x1922cb){if(_0x1922cb){var _0x397f4a=typeof _0x256a3c[_0x4a85('0x1d')]==='undefined'&&typeof _0x256a3c[_0x4a85('0x1e')]===_0x4a85('0x1f');var _0x5c9b9f=_0x1922cb[_0x4a85('0x20')];var _0x159ed0=_0x397f4a?0x0:_0x256a3c[_0x4a85('0x1d')];var _0x50e210=_0x397f4a?_0x1922cb[_0x4a85('0x20')]:_0x256a3c[_0x4a85('0x1d')]+_0x256a3c[_0x4a85('0x1e')];var _0x496b8a;if(_0x50e210>=_0x5c9b9f){_0x50e210=_0x5c9b9f;_0x496b8a=0xc8;}else{_0x496b8a=0xce;}_0x34743a['status'](_0x496b8a);return _0x34743a[_0x4a85('0x21')](_0x4a85('0x22'),_0x159ed0+'-'+_0x50e210+'/'+_0x5c9b9f)[_0x4a85('0x1c')](_0x1922cb);}return null;};}function patchUpdates(_0x2ace62){return function(_0x121379){try{jsonpatch[_0x4a85('0x23')](_0x121379,_0x2ace62,!![]);}catch(_0x382af0){return BPromise[_0x4a85('0x24')](_0x382af0);}return _0x121379['save']();};}function saveUpdates(_0x4f93ba,_0x5cf506){return function(_0x4219a7){if(_0x4219a7){return _0x4219a7[_0x4a85('0x25')](_0x4f93ba)[_0x4a85('0x26')](function(_0x408581){return _0x408581;});}return null;};}function removeEntity(_0x4d3774,_0x154bea){return function(_0x27f9c1){if(_0x27f9c1){return _0x27f9c1[_0x4a85('0x27')]()[_0x4a85('0x26')](function(){var _0x3206f8=_0x27f9c1['get']({'plain':!![]});var _0x1075e2=_0x4a85('0x28');return db[_0x4a85('0x29')][_0x4a85('0x27')]({'where':{'type':_0x1075e2,'resourceId':_0x3206f8['id']}})[_0x4a85('0x26')](function(){return _0x27f9c1;});})[_0x4a85('0x26')](function(){_0x4d3774[_0x4a85('0x1b')](0xcc)[_0x4a85('0x1a')]();});}};}function handleEntityNotFound(_0x343dfe,_0x377796){return function(_0x56c41b){if(!_0x56c41b){_0x343dfe[_0x4a85('0x19')](0x194);}return _0x56c41b;};}function handleError(_0x51d51d,_0x470803){_0x470803=_0x470803||0x1f4;return function(_0x1b91ec){logger[_0x4a85('0x2a')](_0x1b91ec[_0x4a85('0x2b')]);if(_0x1b91ec[_0x4a85('0x2c')]){delete _0x1b91ec[_0x4a85('0x2c')];}_0x51d51d[_0x4a85('0x1b')](_0x470803)[_0x4a85('0x2d')](_0x1b91ec);};}exports['index']=function(_0x45ec8f,_0x4eda22){var _0x3aa433={},_0x196cd7={},_0x4fee4f={'count':0x0,'rows':[]};var _0xb42819=_[_0x4a85('0x2e')](db[_0x4a85('0x2f')][_0x4a85('0x30')],function(_0x9b33c6){return{'name':_0x9b33c6[_0x4a85('0x31')],'type':_0x9b33c6[_0x4a85('0x32')][_0x4a85('0x33')]};});_0x196cd7[_0x4a85('0x34')]=_[_0x4a85('0x2e')](_0xb42819,_0x4a85('0x2c'));_0x196cd7[_0x4a85('0x35')]=_['keys'](_0x45ec8f[_0x4a85('0x35')]);_0x196cd7[_0x4a85('0x36')]=_[_0x4a85('0x37')](_0x196cd7[_0x4a85('0x34')],_0x196cd7['query']);_0x3aa433[_0x4a85('0x38')]=_[_0x4a85('0x37')](_0x196cd7[_0x4a85('0x34')],qs[_0x4a85('0x39')](_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x39')]));_0x3aa433[_0x4a85('0x38')]=_0x3aa433['attributes'][_0x4a85('0x3a')]?_0x3aa433[_0x4a85('0x38')]:_0x196cd7['model'];if(!_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x3b')](_0x4a85('0x3c'))){_0x3aa433['limit']=qs[_0x4a85('0x1e')](_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x1e')]);_0x3aa433[_0x4a85('0x1d')]=qs[_0x4a85('0x1d')](_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x1d')]);}_0x3aa433[_0x4a85('0x3d')]=qs[_0x4a85('0x3e')](_0x45ec8f['query'][_0x4a85('0x3e')]);_0x3aa433[_0x4a85('0x3f')]=qs[_0x4a85('0x36')](_['pick'](_0x45ec8f[_0x4a85('0x35')],_0x196cd7['filters']),_0xb42819);if(_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x40')]){_0x3aa433['where']=_[_0x4a85('0x41')](_0x3aa433[_0x4a85('0x3f')],{'$or':_[_0x4a85('0x2e')](_0xb42819,function(_0x596560){if(_0x596560['type']!==_0x4a85('0x42')){var _0x139198={};_0x139198[_0x596560['name']]={'$like':'%'+_0x45ec8f['query']['filter']+'%'};return _0x139198;}})});}_0x3aa433=_[_0x4a85('0x41')]({},_0x3aa433,_0x45ec8f[_0x4a85('0x43')]);var _0x4fd1de={'where':_0x3aa433['where']};return db[_0x4a85('0x2f')][_0x4a85('0x20')](_0x4fd1de)[_0x4a85('0x26')](function(_0x1b2e49){_0x4fee4f[_0x4a85('0x20')]=_0x1b2e49;if(_0x45ec8f[_0x4a85('0x35')][_0x4a85('0x44')]){_0x3aa433[_0x4a85('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3aa433);})[_0x4a85('0x26')](function(_0x49bd4e){_0x4fee4f['rows']=_0x49bd4e;return _0x4fee4f;})[_0x4a85('0x26')](respondWithFilteredResult(_0x4eda22,_0x3aa433))[_0x4a85('0x46')](handleError(_0x4eda22,null));};exports[_0x4a85('0x47')]=function(_0x40addd,_0x10b2f3){var _0x2bd6b8={'raw':![],'where':{'id':_0x40addd[_0x4a85('0x48')]['id']}},_0x38f7f7={};_0x38f7f7['model']=_['keys'](db[_0x4a85('0x2f')][_0x4a85('0x30')]);_0x38f7f7[_0x4a85('0x35')]=_[_0x4a85('0x49')](_0x40addd[_0x4a85('0x35')]);_0x38f7f7['filters']=_['intersection'](_0x38f7f7[_0x4a85('0x34')],_0x38f7f7[_0x4a85('0x35')]);_0x2bd6b8[_0x4a85('0x38')]=_[_0x4a85('0x37')](_0x38f7f7[_0x4a85('0x34')],qs[_0x4a85('0x39')](_0x40addd[_0x4a85('0x35')][_0x4a85('0x39')]));_0x2bd6b8[_0x4a85('0x38')]=_0x2bd6b8[_0x4a85('0x38')][_0x4a85('0x3a')]?_0x2bd6b8[_0x4a85('0x38')]:_0x38f7f7[_0x4a85('0x34')];if(_0x40addd['query'][_0x4a85('0x44')]){_0x2bd6b8[_0x4a85('0x45')]=[{'all':!![]}];}_0x2bd6b8=_[_0x4a85('0x41')]({},_0x2bd6b8,_0x40addd['options']);return db[_0x4a85('0x2f')][_0x4a85('0x4a')](_0x2bd6b8)['then'](handleEntityNotFound(_0x10b2f3,null))[_0x4a85('0x26')](respondWithResult(_0x10b2f3,null))[_0x4a85('0x46')](handleError(_0x10b2f3,null));};exports['create']=function(_0x5cfa99,_0x10b0e1){return db['VoiceChanSpy'][_0x4a85('0x4b')](_0x5cfa99[_0x4a85('0x4c')],{})[_0x4a85('0x26')](function(_0xaf8a55){var _0x1a3885=_0x5cfa99[_0x4a85('0x4d')]['get']({'plain':!![]});if(!_0x1a3885)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a3885[_0x4a85('0x4e')]===_0x4a85('0x4d')){var _0x424705=_0xaf8a55[_0x4a85('0x4f')]({'plain':!![]});var _0xd44e84=_0x4a85('0x28');return db[_0x4a85('0x50')][_0x4a85('0x4a')]({'where':{'name':_0xd44e84,'userProfileId':_0x1a3885[_0x4a85('0x51')]},'raw':!![]})[_0x4a85('0x26')](function(_0x43eb42){if(_0x43eb42&&_0x43eb42[_0x4a85('0x52')]===0x0){return db[_0x4a85('0x29')][_0x4a85('0x4b')]({'name':_0x424705['name'],'resourceId':_0x424705['id'],'type':_0x43eb42[_0x4a85('0x2c')],'sectionId':_0x43eb42['id']},{})[_0x4a85('0x26')](function(){return _0xaf8a55;});}else{return _0xaf8a55;}})['catch'](function(_0x4af105){logger[_0x4a85('0x2a')](_0x4a85('0x53'),_0x4af105);throw _0x4af105;});}return _0xaf8a55;})['then'](respondWithResult(_0x10b0e1,0xc9))[_0x4a85('0x46')](handleError(_0x10b0e1,null));};exports[_0x4a85('0x25')]=function(_0x4f7ef1,_0x12432c){if(_0x4f7ef1['body']['id']){delete _0x4f7ef1[_0x4a85('0x4c')]['id'];}return db[_0x4a85('0x2f')][_0x4a85('0x4a')]({'where':{'id':_0x4f7ef1[_0x4a85('0x48')]['id']}})[_0x4a85('0x26')](handleEntityNotFound(_0x12432c,null))[_0x4a85('0x26')](saveUpdates(_0x4f7ef1[_0x4a85('0x4c')],null))[_0x4a85('0x26')](respondWithResult(_0x12432c,null))[_0x4a85('0x46')](handleError(_0x12432c,null));};exports['destroy']=function(_0x31c050,_0x46303e){return db[_0x4a85('0x2f')][_0x4a85('0x4a')]({'where':{'id':_0x31c050[_0x4a85('0x48')]['id']}})['then'](handleEntityNotFound(_0x46303e,null))[_0x4a85('0x26')](removeEntity(_0x46303e,null))['catch'](handleError(_0x46303e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1675087..59654ef 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 _0x75ec=['auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','merge','Set','format','CDR(type)=%s','record','push','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x35a033,_0x75e6f7){var _0x5b7520=function(_0x3fea38){while(--_0x3fea38){_0x35a033['push'](_0x35a033['shift']());}};_0x5b7520(++_0x75e6f7);}(_0x75ec,0x1dc));var _0xc75e=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x75ec[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xc75e('0x0'));var attributes=require(_0xc75e('0x1'));var getUserApplications=function(_0x1873d2,_0x32b130,_0x134ed4){var _0x17ed1e=0x1;var _0x8b987a=[];var _0x3fd98e={'context':_0x32b130['context']||_0xc75e('0x2'),'exten':util['format'](_0xc75e('0x3'),_0x1873d2[_0xc75e('0x4')],_0x134ed4),'type':_0xc75e('0x5'),'isApp':![],'ChanSpyId':_0x1873d2['id'],'UserId':_0x32b130['id']};_0x8b987a['push'](_[_0xc75e('0x6')]({'app':_0xc75e('0x7'),'appdata':util[_0xc75e('0x8')](_0xc75e('0x9'),'chanspy'),'priority':_0x17ed1e++},_0x3fd98e));if(_0x1873d2[_0xc75e('0xa')]){_0x8b987a[_0xc75e('0xb')](_['merge']({'app':'MixMonitor','appdata':util[_0xc75e('0x8')](_0xc75e('0xc'),_0x1873d2[_0xc75e('0xd')]),'priority':_0x17ed1e++},_0x3fd98e));}if(_0x1873d2[_0xc75e('0xe')]){_0x8b987a['push'](_[_0xc75e('0x6')]({'app':_0xc75e('0xf'),'appdata':_0x1873d2['password'],'priority':_0x17ed1e++},_0x3fd98e));}_0x8b987a['push'](_[_0xc75e('0x6')]({'app':_0xc75e('0x10'),'appdata':util[_0xc75e('0x8')](_0xc75e('0x11'),_0x32b130[_0xc75e('0x12')],_0x1873d2['options']?_0x1873d2[_0xc75e('0x13')][_0xc75e('0x14')](''):''),'priority':_0x17ed1e++},_0x3fd98e));if(_0x1873d2['record']){_0x8b987a[_0xc75e('0xb')](_[_0xc75e('0x6')]({'app':_0xc75e('0x15'),'priority':_0x17ed1e++},_0x3fd98e));}return _0x8b987a;};var getChanSpyApplications=function(_0x38dd6f,_0x893e55){var _0x5c30d3=[];for(var _0x4c62cb=0x0,_0x1ced85=0x1;_0x4c62cb<_0x893e55[_0xc75e('0x16')];_0x4c62cb++,_0x1ced85=0x1){_0x5c30d3=_0x5c30d3[_0xc75e('0x17')](getUserApplications(_0x38dd6f,_0x893e55[_0x4c62cb],_0x893e55[_0x4c62cb]['internal']));if(_0x893e55[_0x4c62cb][_0xc75e('0x18')]!=_0x893e55[_0x4c62cb]['name']){_0x5c30d3=_0x5c30d3[_0xc75e('0x17')](getUserApplications(_0x38dd6f,_0x893e55[_0x4c62cb],_0x893e55[_0x4c62cb][_0xc75e('0x12')]));}}return _0x5c30d3;};var getChanSpyPromise=function(_0x4dbad2,_0x36c945){return new BPromise(function(_0x28262b,_0x3dc613){return _0x4dbad2[_0xc75e('0x19')]['findAll']({'attributes':['id',_0xc75e('0x12'),_0xc75e('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc75e('0x1a')](function(_0xb3baf5){if(_0xb3baf5){return _0x28262b(getChanSpyApplications(_0x36c945,_0xb3baf5));}return _0x28262b([]);})[_0xc75e('0x1b')](function(_0x4ff659){_0x3dc613(_0x4ff659);});});};module[_0xc75e('0x1c')]=function(_0x5e5d8a,_0x113acb){var _0x8871dc=_0x5e5d8a[_0xc75e('0x1d')];return _0x5e5d8a['define'](_0xc75e('0x1e'),attributes,{'tableName':_0xc75e('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b124c,_0x55f5f9,_0xba4dfa){return getChanSpyPromise(_0x8871dc,_0x5b124c)['then'](function(_0x4014d7){if(_0x4014d7&&_0x4014d7[_0xc75e('0x16')]){return _0x8871dc[_0xc75e('0x20')]['bulkCreate'](_0x4014d7);}})[_0xc75e('0x1a')](function(){_0xba4dfa();})[_0xc75e('0x1b')](function(_0x3b4734){_0xba4dfa(_0x3b4734);});},'afterUpdate':function(_0x5d6c26,_0xdc8e26,_0x255292){return _0x8871dc['VoiceExtension'][_0xc75e('0x21')]({'where':{'ChanSpyId':_0x5d6c26['id']}})[_0xc75e('0x1a')](function(){return getChanSpyPromise(_0x8871dc,_0x5d6c26);})[_0xc75e('0x1a')](function(_0x42f31a){if(_0x42f31a&&_0x42f31a['length']){return _0x8871dc[_0xc75e('0x20')][_0xc75e('0x22')](_0x42f31a);}})[_0xc75e('0x1a')](function(){_0x255292();})[_0xc75e('0x1b')](function(_0x440576){_0x255292(_0x440576);});},'afterDestroy':function(_0x3f65f9,_0x536502,_0x217f64){return _0x8871dc['VoiceExtension'][_0xc75e('0x21')]({'where':{'ChanSpyId':_0x3f65f9['id']}})[_0xc75e('0x1a')](function(){_0x217f64();})[_0xc75e('0x1b')](function(_0x58ad83){_0x217f64(_0x58ad83);});}}});}; \ No newline at end of file +var _0x4580=['concat','internal','findAll','agent','catch','models','VoiceChanSpy','VoiceExtension','bulkCreate','then','destroy','lodash','bluebird','context','format','%s%s','prefix','system','push','Set','record','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length'];(function(_0x45a608,_0x2f5daa){var _0x1f11d8=function(_0xc57be1){while(--_0xc57be1){_0x45a608['push'](_0x45a608['shift']());}};_0x1f11d8(++_0x2f5daa);}(_0x4580,0xf2));var _0x0458=function(_0x23fd09,_0x51c74c){_0x23fd09=_0x23fd09-0x0;var _0x5d8176=_0x4580[_0x23fd09];return _0x5d8176;};'use strict';var _=require(_0x0458('0x0'));var util=require('util');var BPromise=require(_0x0458('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5b2a7e,_0x5439c1,_0x443f26){var _0x477012=0x1;var _0x25cc2b=[];var _0x5639f8={'context':_0x5439c1[_0x0458('0x2')]||'from-sip','exten':util[_0x0458('0x3')](_0x0458('0x4'),_0x5b2a7e[_0x0458('0x5')],_0x443f26),'type':_0x0458('0x6'),'isApp':![],'ChanSpyId':_0x5b2a7e['id'],'UserId':_0x5439c1['id']};_0x25cc2b[_0x0458('0x7')](_['merge']({'app':_0x0458('0x8'),'appdata':util[_0x0458('0x3')]('CDR(type)=%s','chanspy'),'priority':_0x477012++},_0x5639f8));if(_0x5b2a7e[_0x0458('0x9')]){_0x25cc2b['push'](_[_0x0458('0xa')]({'app':'MixMonitor','appdata':util[_0x0458('0x3')](_0x0458('0xb'),_0x5b2a7e[_0x0458('0xc')]),'priority':_0x477012++},_0x5639f8));}if(_0x5b2a7e[_0x0458('0xd')]){_0x25cc2b[_0x0458('0x7')](_[_0x0458('0xa')]({'app':_0x0458('0xe'),'appdata':_0x5b2a7e['password'],'priority':_0x477012++},_0x5639f8));}_0x25cc2b['push'](_[_0x0458('0xa')]({'app':_0x0458('0xf'),'appdata':util['format'](_0x0458('0x10'),_0x5439c1[_0x0458('0x11')],_0x5b2a7e['options']?_0x5b2a7e[_0x0458('0x12')][_0x0458('0x13')](''):''),'priority':_0x477012++},_0x5639f8));if(_0x5b2a7e['record']){_0x25cc2b[_0x0458('0x7')](_[_0x0458('0xa')]({'app':_0x0458('0x14'),'priority':_0x477012++},_0x5639f8));}return _0x25cc2b;};var getChanSpyApplications=function(_0x169815,_0x288008){var _0x821f6b=[];for(var _0x1efa3c=0x0,_0x164a45=0x1;_0x1efa3c<_0x288008[_0x0458('0x15')];_0x1efa3c++,_0x164a45=0x1){_0x821f6b=_0x821f6b[_0x0458('0x16')](getUserApplications(_0x169815,_0x288008[_0x1efa3c],_0x288008[_0x1efa3c][_0x0458('0x17')]));if(_0x288008[_0x1efa3c][_0x0458('0x17')]!=_0x288008[_0x1efa3c][_0x0458('0x11')]){_0x821f6b=_0x821f6b['concat'](getUserApplications(_0x169815,_0x288008[_0x1efa3c],_0x288008[_0x1efa3c][_0x0458('0x11')]));}}return _0x821f6b;};var getChanSpyPromise=function(_0x8943a1,_0xe3f1bf){return new BPromise(function(_0x4c001d,_0x5b750f){return _0x8943a1['User'][_0x0458('0x18')]({'attributes':['id',_0x0458('0x11'),'internal'],'where':{'role':_0x0458('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2770a0){if(_0x2770a0){return _0x4c001d(getChanSpyApplications(_0xe3f1bf,_0x2770a0));}return _0x4c001d([]);})[_0x0458('0x1a')](function(_0x621b9d){_0x5b750f(_0x621b9d);});});};module['exports']=function(_0x247c61,_0x108dc9){var _0x514d48=_0x247c61[_0x0458('0x1b')];return _0x247c61['define'](_0x0458('0x1c'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x333d0d,_0x51e1ea,_0x34e22a){return getChanSpyPromise(_0x514d48,_0x333d0d)['then'](function(_0x3cd54c){if(_0x3cd54c&&_0x3cd54c[_0x0458('0x15')]){return _0x514d48[_0x0458('0x1d')][_0x0458('0x1e')](_0x3cd54c);}})[_0x0458('0x1f')](function(){_0x34e22a();})[_0x0458('0x1a')](function(_0x5861da){_0x34e22a(_0x5861da);});},'afterUpdate':function(_0x5263bb,_0x4e79c2,_0x334d58){return _0x514d48[_0x0458('0x1d')][_0x0458('0x20')]({'where':{'ChanSpyId':_0x5263bb['id']}})['then'](function(){return getChanSpyPromise(_0x514d48,_0x5263bb);})[_0x0458('0x1f')](function(_0x14a9dc){if(_0x14a9dc&&_0x14a9dc[_0x0458('0x15')]){return _0x514d48[_0x0458('0x1d')]['bulkCreate'](_0x14a9dc);}})[_0x0458('0x1f')](function(){_0x334d58();})[_0x0458('0x1a')](function(_0x4f074e){_0x334d58(_0x4f074e);});},'afterDestroy':function(_0x3c2ff2,_0x5a0810,_0x566626){return _0x514d48[_0x0458('0x1d')][_0x0458('0x20')]({'where':{'ChanSpyId':_0x3c2ff2['id']}})[_0x0458('0x1f')](function(){_0x566626();})[_0x0458('0x1a')](function(_0x140da3){_0x566626(_0x140da3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f76f3aa..dbb63ae 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 _0x3140=['jayson/promise','client','http','request','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1401f7,_0x2f6298){var _0x3b03d9=function(_0x40ad5f){while(--_0x40ad5f){_0x1401f7['push'](_0x1401f7['shift']());}};_0x3b03d9(++_0x2f6298);}(_0x3140,0xaf));var _0x0314=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x3140[_0x441eab];return _0xe6ff41;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});} \ No newline at end of file +var _0xc29b=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2100d0,_0x1ec817){var _0x483071=function(_0x3de2c7){while(--_0x3de2c7){_0x2100d0['push'](_0x2100d0['shift']());}};_0x483071(++_0x1ec817);}(_0xc29b,0x12d));var _0xbc29=function(_0x81a2f,_0x1d5d7b){_0x81a2f=_0x81a2f-0x0;var _0x51b307=_0xc29b[_0x81a2f];return _0x51b307;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a649c29..48eeef1 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 _0x1191=['create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x331ffe,_0x2f9a1b){var _0x1ef098=function(_0x553395){while(--_0x553395){_0x331ffe['push'](_0x331ffe['shift']());}};_0x1ef098(++_0x2f9a1b);}(_0x1191,0xb9));var _0x1119=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1191[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x1119('0x0'));var util=require('util');var path=require(_0x1119('0x1'));var timeout=require(_0x1119('0x2'));var express=require(_0x1119('0x3'));var router=express['Router']();var fs_extra=require(_0x1119('0x4'));var auth=require(_0x1119('0x5'));var interaction=require(_0x1119('0x6'));var config=require(_0x1119('0x7'));var controller=require(_0x1119('0x8'));router[_0x1119('0x9')]('/',auth[_0x1119('0xa')](),controller[_0x1119('0xb')]);router[_0x1119('0x9')](_0x1119('0xc'),auth[_0x1119('0xa')](),controller[_0x1119('0xd')]);router[_0x1119('0xe')]('/',auth[_0x1119('0xa')](),controller[_0x1119('0xf')]);router[_0x1119('0x10')]('/:id',auth[_0x1119('0xa')](),controller[_0x1119('0x11')]);router['delete'](_0x1119('0xc'),auth[_0x1119('0xa')](),controller[_0x1119('0x12')]);module[_0x1119('0x13')]=router; \ No newline at end of file +var _0xbe93=['isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x38ef85,_0x317bcc){var _0x1ffa8d=function(_0x5069b0){while(--_0x5069b0){_0x38ef85['push'](_0x38ef85['shift']());}};_0x1ffa8d(++_0x317bcc);}(_0xbe93,0x15f));var _0x3be9=function(_0x23d029,_0x4a84ad){_0x23d029=_0x23d029-0x0;var _0x5641b2=_0xbe93[_0x23d029];return _0x5641b2;};'use strict';var multer=require('multer');var util=require(_0x3be9('0x0'));var path=require(_0x3be9('0x1'));var timeout=require(_0x3be9('0x2'));var express=require(_0x3be9('0x3'));var router=express[_0x3be9('0x4')]();var fs_extra=require(_0x3be9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3be9('0x6'));var config=require(_0x3be9('0x7'));var controller=require(_0x3be9('0x8'));router[_0x3be9('0x9')]('/',auth[_0x3be9('0xa')](),controller[_0x3be9('0xb')]);router[_0x3be9('0x9')](_0x3be9('0xc'),auth[_0x3be9('0xa')](),controller[_0x3be9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3be9('0xe')]);router[_0x3be9('0xf')](_0x3be9('0xc'),auth[_0x3be9('0xa')](),controller['update']);router[_0x3be9('0x10')](_0x3be9('0xc'),auth[_0x3be9('0xa')](),controller[_0x3be9('0x11')]);module[_0x3be9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c97bf7c..0dfd9b1 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 _0xfd04=['name','exports','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xfd04,0x136));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x4fd0('0x0')]={'name':{'type':Sequelize[_0x4fd0('0x1')],'unique':_0x4fd0('0x2')},'description':{'type':Sequelize[_0x4fd0('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcfec=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x561fce,_0x34b09a){var _0x565930=function(_0x4687ca){while(--_0x4687ca){_0x561fce['push'](_0x561fce['shift']());}};_0x565930(++_0x34b09a);}(_0xcfec,0xfa));var _0xccfe=function(_0x53a6c0,_0x53df9a){_0x53a6c0=_0x53a6c0-0x0;var _0x30c452=_0xcfec[_0x53a6c0];return _0x30c452;};'use strict';var Sequelize=require(_0xccfe('0x0'));module[_0xccfe('0x1')]={'name':{'type':Sequelize[_0xccfe('0x2')],'unique':_0xccfe('0x3')},'description':{'type':Sequelize[_0xccfe('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xccfe('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8c57611..b1dd8e2 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 _0x4340=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','VoiceContext','includeAll','include','findAll','rows','show','params','intersection','options','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x3ce91d,_0x427eb9){var _0x5bf702=function(_0x170af8){while(--_0x170af8){_0x3ce91d['push'](_0x3ce91d['shift']());}};_0x5bf702(++_0x427eb9);}(_0x4340,0xc0));var _0x0434=function(_0x25fcd4,_0x176a1e){_0x25fcd4=_0x25fcd4-0x0;var _0x33c973=_0x4340[_0x25fcd4];return _0x33c973;};'use strict';var emlformat=require(_0x0434('0x0'));var rimraf=require(_0x0434('0x1'));var zipdir=require(_0x0434('0x2'));var jsonpatch=require(_0x0434('0x3'));var rp=require(_0x0434('0x4'));var moment=require(_0x0434('0x5'));var BPromise=require(_0x0434('0x6'));var Mustache=require(_0x0434('0x7'));var util=require(_0x0434('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0434('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0434('0xa'));var _=require(_0x0434('0xb'));var squel=require(_0x0434('0xc'));var crypto=require(_0x0434('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0434('0xe'));var toCsv=require(_0x0434('0x9'));var querystring=require(_0x0434('0xf'));var Papa=require(_0x0434('0x10'));var Redis=require(_0x0434('0x11'));var authService=require(_0x0434('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0434('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0434('0x14'))(_0x0434('0x15'));var utils=require(_0x0434('0x16'));var config=require(_0x0434('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0434('0x18'))['db'];var jayson=require(_0x0434('0x19'));var client=jayson[_0x0434('0x1a')][_0x0434('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1430af,_0x5e03ac,_0x21588d,_0x3eef62){return new BPromise(function(_0x5b5e71,_0x1ef6f0){var _0x3059d5=_0x3eef62||client;return _0x3059d5[_0x0434('0x1c')](_0x1430af,_0x21588d)[_0x0434('0x1d')](function(_0xbb42a1){logger[_0x0434('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x5e03ac,_0x0434('0x1f'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5e03ac,_0x0434('0x1f'),JSON['stringify'](_0xbb42a1));if(_0xbb42a1[_0x0434('0x20')]){if(_0xbb42a1[_0x0434('0x20')][_0x0434('0x21')]===0x1f4){logger['error'](_0x0434('0x22'),_0x5e03ac,_0xbb42a1[_0x0434('0x20')][_0x0434('0x23')]);return _0x1ef6f0(_0xbb42a1[_0x0434('0x20')][_0x0434('0x23')]);}logger[_0x0434('0x20')](_0x0434('0x22'),_0x5e03ac,_0xbb42a1[_0x0434('0x20')]['message']);return _0x5b5e71(_0xbb42a1[_0x0434('0x20')][_0x0434('0x23')]);}else{logger['info'](_0x0434('0x22'),_0x5e03ac,_0x0434('0x1f'));_0x5b5e71(_0xbb42a1[_0x0434('0x24')][_0x0434('0x23')]);}})[_0x0434('0x25')](function(_0x54d11f){logger[_0x0434('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5e03ac,_0x54d11f);_0x1ef6f0(_0x54d11f);});});}function respondWithStatusCode(_0xeefa56,_0xdf28c5){_0xdf28c5=_0xdf28c5||0xcc;return function(_0x56d938){if(_0x56d938){return _0xeefa56[_0x0434('0x26')](_0xdf28c5);}return _0xeefa56['status'](_0xdf28c5)[_0x0434('0x27')]();};}function respondWithResult(_0x5284bf,_0x24571a){_0x24571a=_0x24571a||0xc8;return function(_0x107049){if(_0x107049){return _0x5284bf[_0x0434('0x28')](_0x24571a)[_0x0434('0x29')](_0x107049);}};}function respondWithFilteredResult(_0x42f5dc,_0x293f45){return function(_0x5cfa96){if(_0x5cfa96){var _0x9ead94=typeof _0x293f45['offset']===_0x0434('0x2a')&&typeof _0x293f45[_0x0434('0x2b')]===_0x0434('0x2a');var _0x4b6862=_0x5cfa96[_0x0434('0x2c')];var _0x1f8c38=_0x9ead94?0x0:_0x293f45['offset'];var _0x1b5a42=_0x9ead94?_0x5cfa96['count']:_0x293f45[_0x0434('0x2d')]+_0x293f45[_0x0434('0x2b')];var _0x5906e0;if(_0x1b5a42>=_0x4b6862){_0x1b5a42=_0x4b6862;_0x5906e0=0xc8;}else{_0x5906e0=0xce;}_0x42f5dc['status'](_0x5906e0);return _0x42f5dc[_0x0434('0x2e')](_0x0434('0x2f'),_0x1f8c38+'-'+_0x1b5a42+'/'+_0x4b6862)[_0x0434('0x29')](_0x5cfa96);}return null;};}function patchUpdates(_0x4898e7){return function(_0x52088f){try{jsonpatch[_0x0434('0x30')](_0x52088f,_0x4898e7,!![]);}catch(_0x2c2340){return BPromise[_0x0434('0x31')](_0x2c2340);}return _0x52088f[_0x0434('0x32')]();};}function saveUpdates(_0x41c25b,_0x40abb5){return function(_0x4a7047){if(_0x4a7047){return _0x4a7047[_0x0434('0x33')](_0x41c25b)[_0x0434('0x1d')](function(_0x10eadb){return _0x10eadb;});}return null;};}function removeEntity(_0x35f87a,_0x297bc1){return function(_0x39c7c2){if(_0x39c7c2){return _0x39c7c2[_0x0434('0x34')]()[_0x0434('0x1d')](function(){var _0x470047=_0x39c7c2[_0x0434('0x35')]({'plain':!![]});var _0x40e375=_0x0434('0x36');return db['UserProfileResource'][_0x0434('0x34')]({'where':{'type':_0x40e375,'resourceId':_0x470047['id']}})[_0x0434('0x1d')](function(){return _0x39c7c2;});})[_0x0434('0x1d')](function(){_0x35f87a['status'](0xcc)[_0x0434('0x27')]();});}};}function handleEntityNotFound(_0x4d9724,_0x310941){return function(_0x5de8e9){if(!_0x5de8e9){_0x4d9724[_0x0434('0x26')](0x194);}return _0x5de8e9;};}function handleError(_0x568dc1,_0x4b11ed){_0x4b11ed=_0x4b11ed||0x1f4;return function(_0x3aeb7f){logger[_0x0434('0x20')](_0x3aeb7f[_0x0434('0x37')]);if(_0x3aeb7f[_0x0434('0x38')]){delete _0x3aeb7f[_0x0434('0x38')];}_0x568dc1[_0x0434('0x28')](_0x4b11ed)[_0x0434('0x39')](_0x3aeb7f);};}exports[_0x0434('0x3a')]=function(_0x363899,_0x53142d){var _0x454fe6={},_0x5a059e={},_0x2beb8f={'count':0x0,'rows':[]};var _0x5cce2e=_['map'](db['VoiceContext'][_0x0434('0x3b')],function(_0x21bd12){return{'name':_0x21bd12[_0x0434('0x3c')],'type':_0x21bd12[_0x0434('0x3d')][_0x0434('0x3e')]};});_0x5a059e[_0x0434('0x3f')]=_['map'](_0x5cce2e,_0x0434('0x38'));_0x5a059e[_0x0434('0x40')]=_[_0x0434('0x41')](_0x363899[_0x0434('0x40')]);_0x5a059e['filters']=_['intersection'](_0x5a059e[_0x0434('0x3f')],_0x5a059e['query']);_0x454fe6['attributes']=_['intersection'](_0x5a059e[_0x0434('0x3f')],qs['fields'](_0x363899['query'][_0x0434('0x42')]));_0x454fe6[_0x0434('0x43')]=_0x454fe6[_0x0434('0x43')]['length']?_0x454fe6[_0x0434('0x43')]:_0x5a059e[_0x0434('0x3f')];if(!_0x363899[_0x0434('0x40')][_0x0434('0x44')]('nolimit')){_0x454fe6[_0x0434('0x2b')]=qs['limit'](_0x363899['query'][_0x0434('0x2b')]);_0x454fe6[_0x0434('0x2d')]=qs[_0x0434('0x2d')](_0x363899[_0x0434('0x40')][_0x0434('0x2d')]);}_0x454fe6[_0x0434('0x45')]=qs[_0x0434('0x46')](_0x363899[_0x0434('0x40')][_0x0434('0x46')]);_0x454fe6['where']=qs[_0x0434('0x47')](_[_0x0434('0x48')](_0x363899[_0x0434('0x40')],_0x5a059e[_0x0434('0x47')]),_0x5cce2e);if(_0x363899[_0x0434('0x40')][_0x0434('0x49')]){_0x454fe6[_0x0434('0x4a')]=_[_0x0434('0x4b')](_0x454fe6[_0x0434('0x4a')],{'$or':_[_0x0434('0x4c')](_0x5cce2e,function(_0x5c1957){if(_0x5c1957[_0x0434('0x3d')]!==_0x0434('0x4d')){var _0x5117fb={};_0x5117fb[_0x5c1957[_0x0434('0x38')]]={'$like':'%'+_0x363899[_0x0434('0x40')][_0x0434('0x49')]+'%'};return _0x5117fb;}})});}_0x454fe6=_[_0x0434('0x4b')]({},_0x454fe6,_0x363899['options']);var _0xdba1c1={'where':_0x454fe6[_0x0434('0x4a')]};return db[_0x0434('0x4e')][_0x0434('0x2c')](_0xdba1c1)[_0x0434('0x1d')](function(_0x2e3530){_0x2beb8f['count']=_0x2e3530;if(_0x363899[_0x0434('0x40')][_0x0434('0x4f')]){_0x454fe6[_0x0434('0x50')]=[{'all':!![]}];}return db[_0x0434('0x4e')][_0x0434('0x51')](_0x454fe6);})['then'](function(_0x19ff26){_0x2beb8f[_0x0434('0x52')]=_0x19ff26;return _0x2beb8f;})[_0x0434('0x1d')](respondWithFilteredResult(_0x53142d,_0x454fe6))[_0x0434('0x25')](handleError(_0x53142d,null));};exports[_0x0434('0x53')]=function(_0x518288,_0x1bfbf0){var _0x3082f9={'raw':![],'where':{'id':_0x518288[_0x0434('0x54')]['id']}},_0x57375f={};_0x57375f[_0x0434('0x3f')]=_[_0x0434('0x41')](db[_0x0434('0x4e')][_0x0434('0x3b')]);_0x57375f[_0x0434('0x40')]=_[_0x0434('0x41')](_0x518288[_0x0434('0x40')]);_0x57375f['filters']=_['intersection'](_0x57375f[_0x0434('0x3f')],_0x57375f[_0x0434('0x40')]);_0x3082f9[_0x0434('0x43')]=_[_0x0434('0x55')](_0x57375f[_0x0434('0x3f')],qs['fields'](_0x518288[_0x0434('0x40')][_0x0434('0x42')]));_0x3082f9[_0x0434('0x43')]=_0x3082f9['attributes']['length']?_0x3082f9[_0x0434('0x43')]:_0x57375f[_0x0434('0x3f')];if(_0x518288[_0x0434('0x40')][_0x0434('0x4f')]){_0x3082f9[_0x0434('0x50')]=[{'all':!![]}];}_0x3082f9=_['merge']({},_0x3082f9,_0x518288[_0x0434('0x56')]);return db[_0x0434('0x4e')][_0x0434('0x57')](_0x3082f9)[_0x0434('0x1d')](handleEntityNotFound(_0x1bfbf0,null))['then'](respondWithResult(_0x1bfbf0,null))['catch'](handleError(_0x1bfbf0,null));};exports[_0x0434('0x58')]=function(_0x37198d,_0x32c69a,_0x11a37b){var _0x29794e;return db[_0x0434('0x4e')][_0x0434('0x58')](_0x37198d[_0x0434('0x59')],{'raw':!![]})[_0x0434('0x1d')](function(_0x503b76){_0x29794e=_0x503b76;return db[_0x0434('0x4e')]['findAll']({'raw':!![]});})[_0x0434('0x1d')](function(_0x4252af){var _0x276aa2=fs[_0x0434('0x5a')](path[_0x0434('0x5b')](config[_0x0434('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x16b97d=ejs[_0x0434('0x5d')](_0x276aa2,{'contexts':_0x4252af||[]});fs[_0x0434('0x5e')](_0x0434('0x5f'),_0x16b97d);})[_0x0434('0x1d')](function(){return respondWithRpcPromise(_0x0434('0x60'),'create',{'module':_0x0434('0x61')});})[_0x0434('0x1d')](function(){var _0x5d2324=_0x37198d[_0x0434('0x62')][_0x0434('0x35')]({'plain':!![]});if(!_0x5d2324)throw new Error(_0x0434('0x63'));if(_0x5d2324[_0x0434('0x64')]===_0x0434('0x62')){var _0x391c52=_0x29794e[_0x0434('0x35')]({'plain':!![]});return db[_0x0434('0x65')][_0x0434('0x57')]({'where':{'name':_0x0434('0x36'),'userProfileId':_0x5d2324[_0x0434('0x66')]},'raw':!![]})['then'](function(_0x84e5a6){if(_0x84e5a6&&_0x84e5a6['autoAssociation']===0x0){return db[_0x0434('0x67')][_0x0434('0x58')]({'name':_0x391c52[_0x0434('0x38')],'resourceId':_0x391c52['id'],'type':_0x84e5a6[_0x0434('0x38')],'sectionId':_0x84e5a6['id']},{})[_0x0434('0x1d')](function(){return _0x29794e;});}else{return _0x29794e;}})['catch'](function(_0x207475){logger['error'](_0x0434('0x68'),_0x207475);throw _0x207475;});}return _0x29794e;})['then'](respondWithResult(_0x32c69a,0xc9))[_0x0434('0x25')](handleError(_0x32c69a,null));};exports[_0x0434('0x33')]=function(_0xd3dbbf,_0xc11bee,_0x176fc9){var _0x192754;return db['VoiceContext']['find']({'where':{'id':_0xd3dbbf[_0x0434('0x54')]['id']}})['then'](handleEntityNotFound(_0xc11bee,null))['then'](saveUpdates(_0xd3dbbf[_0x0434('0x59')],null))[_0x0434('0x1d')](function(_0x1f53fd){if(_0x1f53fd){_0x192754=_0x1f53fd;return db[_0x0434('0x4e')][_0x0434('0x51')]({'raw':!![]});}})[_0x0434('0x1d')](function(_0x4ed0b2){var _0x39b484=fs[_0x0434('0x5a')](path['join'](config[_0x0434('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x2f20eb=ejs[_0x0434('0x5d')](_0x39b484,{'contexts':_0x4ed0b2||[]});fs['writeFileSync'](_0x0434('0x5f'),_0x2f20eb);})[_0x0434('0x1d')](function(){return respondWithRpcPromise(_0x0434('0x60'),_0x0434('0x33'),{'module':'chan_sip.so'});})[_0x0434('0x1d')](function(){return _0x192754;})[_0x0434('0x1d')](respondWithResult(_0xc11bee,null))[_0x0434('0x25')](handleError(_0xc11bee,null));};exports[_0x0434('0x34')]=function(_0x1822ab,_0x3c097f,_0x4c7d49){var _0x4d0930;return db[_0x0434('0x4e')][_0x0434('0x57')]({'where':{'id':_0x1822ab['params']['id']}})[_0x0434('0x1d')](handleEntityNotFound(_0x3c097f,null))[_0x0434('0x1d')](removeEntity(_0x3c097f,null))['then'](function(){return db[_0x0434('0x4e')][_0x0434('0x51')]({'raw':!![]});})[_0x0434('0x1d')](function(_0x2804c5){var _0x2d1b78=fs[_0x0434('0x5a')](path[_0x0434('0x5b')](config['root'],_0x0434('0x69')),'utf8');var _0x425054=ejs[_0x0434('0x5d')](_0x2d1b78,{'contexts':_0x2804c5});fs[_0x0434('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x425054);return respondWithRpcPromise(_0x0434('0x60'),'destroy',{'module':_0x0434('0x61')});})[_0x0434('0x25')](handleError(_0x3c097f,null));}; \ No newline at end of file +var _0xf117=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','get','UserProfileResource','end','stack','name','VoiceContext','rawAttributes','fieldName','type','key','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','root','chan_sip.so','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x553266,_0xaf0455){var _0x2c0365=function(_0x45e7d2){while(--_0x45e7d2){_0x553266['push'](_0x553266['shift']());}};_0x2c0365(++_0xaf0455);}(_0xf117,0x124));var _0x7f11=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf117[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x7f11('0x0'));var rimraf=require(_0x7f11('0x1'));var zipdir=require(_0x7f11('0x2'));var jsonpatch=require(_0x7f11('0x3'));var rp=require(_0x7f11('0x4'));var moment=require('moment');var BPromise=require(_0x7f11('0x5'));var Mustache=require('mustache');var util=require(_0x7f11('0x6'));var path=require(_0x7f11('0x7'));var sox=require(_0x7f11('0x8'));var csv=require(_0x7f11('0x9'));var ejs=require(_0x7f11('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f11('0xb'));var squel=require(_0x7f11('0xc'));var crypto=require(_0x7f11('0xd'));var jsforce=require(_0x7f11('0xe'));var deskjs=require(_0x7f11('0xf'));var toCsv=require(_0x7f11('0x9'));var querystring=require('querystring');var Papa=require(_0x7f11('0x10'));var Redis=require(_0x7f11('0x11'));var authService=require(_0x7f11('0x12'));var qs=require(_0x7f11('0x13'));var as=require(_0x7f11('0x14'));var hardwareService=require(_0x7f11('0x15'));var logger=require(_0x7f11('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7f11('0x17'));var licenseUtil=require(_0x7f11('0x18'));var db=require(_0x7f11('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x7f11('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x288b96,_0x11b685,_0x1401a9,_0x39f0a8){return new BPromise(function(_0x43d95d,_0x47971f){var _0x372b54=_0x39f0a8||client;return _0x372b54[_0x7f11('0x1b')](_0x288b96,_0x1401a9)[_0x7f11('0x1c')](function(_0x3afa9d){logger[_0x7f11('0x1d')](_0x7f11('0x1e'),_0x11b685,_0x7f11('0x1f'));logger[_0x7f11('0x20')](_0x7f11('0x21'),_0x11b685,_0x7f11('0x1f'),JSON[_0x7f11('0x22')](_0x3afa9d));if(_0x3afa9d['error']){if(_0x3afa9d[_0x7f11('0x23')][_0x7f11('0x24')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x11b685,_0x3afa9d[_0x7f11('0x23')][_0x7f11('0x25')]);return _0x47971f(_0x3afa9d[_0x7f11('0x23')][_0x7f11('0x25')]);}logger[_0x7f11('0x23')](_0x7f11('0x1e'),_0x11b685,_0x3afa9d[_0x7f11('0x23')][_0x7f11('0x25')]);return _0x43d95d(_0x3afa9d[_0x7f11('0x23')]['message']);}else{logger[_0x7f11('0x1d')](_0x7f11('0x1e'),_0x11b685,_0x7f11('0x1f'));_0x43d95d(_0x3afa9d['result'][_0x7f11('0x25')]);}})['catch'](function(_0x19ed02){logger[_0x7f11('0x23')](_0x7f11('0x1e'),_0x11b685,_0x19ed02);_0x47971f(_0x19ed02);});});}function respondWithStatusCode(_0x1e071d,_0x13c846){_0x13c846=_0x13c846||0xcc;return function(_0x28b5ee){if(_0x28b5ee){return _0x1e071d['sendStatus'](_0x13c846);}return _0x1e071d[_0x7f11('0x26')](_0x13c846)['end']();};}function respondWithResult(_0x208a21,_0x5efe4c){_0x5efe4c=_0x5efe4c||0xc8;return function(_0x944d80){if(_0x944d80){return _0x208a21['status'](_0x5efe4c)['json'](_0x944d80);}};}function respondWithFilteredResult(_0x270924,_0x232721){return function(_0x4911c6){if(_0x4911c6){var _0x3d2320=typeof _0x232721['offset']===_0x7f11('0x27')&&typeof _0x232721[_0x7f11('0x28')]===_0x7f11('0x27');var _0x148e77=_0x4911c6['count'];var _0x3a4564=_0x3d2320?0x0:_0x232721['offset'];var _0x3c2438=_0x3d2320?_0x4911c6[_0x7f11('0x29')]:_0x232721[_0x7f11('0x2a')]+_0x232721[_0x7f11('0x28')];var _0x1b1198;if(_0x3c2438>=_0x148e77){_0x3c2438=_0x148e77;_0x1b1198=0xc8;}else{_0x1b1198=0xce;}_0x270924['status'](_0x1b1198);return _0x270924[_0x7f11('0x2b')](_0x7f11('0x2c'),_0x3a4564+'-'+_0x3c2438+'/'+_0x148e77)['json'](_0x4911c6);}return null;};}function patchUpdates(_0x502fe9){return function(_0x1c24ad){try{jsonpatch[_0x7f11('0x2d')](_0x1c24ad,_0x502fe9,!![]);}catch(_0x38e3af){return BPromise[_0x7f11('0x2e')](_0x38e3af);}return _0x1c24ad['save']();};}function saveUpdates(_0x43f641,_0x74ef6e){return function(_0xb62e47){if(_0xb62e47){return _0xb62e47['update'](_0x43f641)['then'](function(_0x3e4f05){return _0x3e4f05;});}return null;};}function removeEntity(_0x46def9,_0x5e3fbf){return function(_0x28e538){if(_0x28e538){return _0x28e538[_0x7f11('0x2f')]()[_0x7f11('0x1c')](function(){var _0x4b4802=_0x28e538[_0x7f11('0x30')]({'plain':!![]});var _0x1ed93e='Contexts';return db[_0x7f11('0x31')][_0x7f11('0x2f')]({'where':{'type':_0x1ed93e,'resourceId':_0x4b4802['id']}})[_0x7f11('0x1c')](function(){return _0x28e538;});})[_0x7f11('0x1c')](function(){_0x46def9['status'](0xcc)[_0x7f11('0x32')]();});}};}function handleEntityNotFound(_0x29c8a9,_0x3719eb){return function(_0x261e69){if(!_0x261e69){_0x29c8a9['sendStatus'](0x194);}return _0x261e69;};}function handleError(_0x325f8e,_0xd04688){_0xd04688=_0xd04688||0x1f4;return function(_0x51629e){logger['error'](_0x51629e[_0x7f11('0x33')]);if(_0x51629e['name']){delete _0x51629e[_0x7f11('0x34')];}_0x325f8e[_0x7f11('0x26')](_0xd04688)['send'](_0x51629e);};}exports['index']=function(_0x1a7203,_0x42fe15){var _0x4bbea7={},_0x34fbd5={},_0x241528={'count':0x0,'rows':[]};var _0x3b6143=_['map'](db[_0x7f11('0x35')][_0x7f11('0x36')],function(_0x37fe0b){return{'name':_0x37fe0b[_0x7f11('0x37')],'type':_0x37fe0b[_0x7f11('0x38')][_0x7f11('0x39')]};});_0x34fbd5['model']=_[_0x7f11('0x3a')](_0x3b6143,_0x7f11('0x34'));_0x34fbd5['query']=_['keys'](_0x1a7203[_0x7f11('0x3b')]);_0x34fbd5[_0x7f11('0x3c')]=_['intersection'](_0x34fbd5[_0x7f11('0x3d')],_0x34fbd5[_0x7f11('0x3b')]);_0x4bbea7['attributes']=_[_0x7f11('0x3e')](_0x34fbd5[_0x7f11('0x3d')],qs[_0x7f11('0x3f')](_0x1a7203['query']['fields']));_0x4bbea7[_0x7f11('0x40')]=_0x4bbea7[_0x7f11('0x40')][_0x7f11('0x41')]?_0x4bbea7[_0x7f11('0x40')]:_0x34fbd5[_0x7f11('0x3d')];if(!_0x1a7203[_0x7f11('0x3b')][_0x7f11('0x42')](_0x7f11('0x43'))){_0x4bbea7[_0x7f11('0x28')]=qs[_0x7f11('0x28')](_0x1a7203[_0x7f11('0x3b')][_0x7f11('0x28')]);_0x4bbea7['offset']=qs[_0x7f11('0x2a')](_0x1a7203[_0x7f11('0x3b')][_0x7f11('0x2a')]);}_0x4bbea7['order']=qs['sort'](_0x1a7203['query']['sort']);_0x4bbea7[_0x7f11('0x44')]=qs['filters'](_[_0x7f11('0x45')](_0x1a7203[_0x7f11('0x3b')],_0x34fbd5[_0x7f11('0x3c')]),_0x3b6143);if(_0x1a7203[_0x7f11('0x3b')]['filter']){_0x4bbea7[_0x7f11('0x44')]=_[_0x7f11('0x46')](_0x4bbea7[_0x7f11('0x44')],{'$or':_[_0x7f11('0x3a')](_0x3b6143,function(_0x2f85f6){if(_0x2f85f6[_0x7f11('0x38')]!==_0x7f11('0x47')){var _0x11f044={};_0x11f044[_0x2f85f6['name']]={'$like':'%'+_0x1a7203['query'][_0x7f11('0x48')]+'%'};return _0x11f044;}})});}_0x4bbea7=_[_0x7f11('0x46')]({},_0x4bbea7,_0x1a7203[_0x7f11('0x49')]);var _0x2d7288={'where':_0x4bbea7['where']};return db['VoiceContext']['count'](_0x2d7288)[_0x7f11('0x1c')](function(_0x3323b8){_0x241528['count']=_0x3323b8;if(_0x1a7203[_0x7f11('0x3b')][_0x7f11('0x4a')]){_0x4bbea7[_0x7f11('0x4b')]=[{'all':!![]}];}return db[_0x7f11('0x35')][_0x7f11('0x4c')](_0x4bbea7);})['then'](function(_0x38e2c5){_0x241528[_0x7f11('0x4d')]=_0x38e2c5;return _0x241528;})['then'](respondWithFilteredResult(_0x42fe15,_0x4bbea7))[_0x7f11('0x4e')](handleError(_0x42fe15,null));};exports[_0x7f11('0x4f')]=function(_0x38cdd6,_0x41e972){var _0x53ee7d={'raw':![],'where':{'id':_0x38cdd6[_0x7f11('0x50')]['id']}},_0x377cb6={};_0x377cb6['model']=_[_0x7f11('0x51')](db['VoiceContext']['rawAttributes']);_0x377cb6[_0x7f11('0x3b')]=_[_0x7f11('0x51')](_0x38cdd6[_0x7f11('0x3b')]);_0x377cb6[_0x7f11('0x3c')]=_[_0x7f11('0x3e')](_0x377cb6[_0x7f11('0x3d')],_0x377cb6[_0x7f11('0x3b')]);_0x53ee7d[_0x7f11('0x40')]=_[_0x7f11('0x3e')](_0x377cb6['model'],qs[_0x7f11('0x3f')](_0x38cdd6[_0x7f11('0x3b')]['fields']));_0x53ee7d[_0x7f11('0x40')]=_0x53ee7d[_0x7f11('0x40')][_0x7f11('0x41')]?_0x53ee7d[_0x7f11('0x40')]:_0x377cb6['model'];if(_0x38cdd6['query']['includeAll']){_0x53ee7d[_0x7f11('0x4b')]=[{'all':!![]}];}_0x53ee7d=_[_0x7f11('0x46')]({},_0x53ee7d,_0x38cdd6[_0x7f11('0x49')]);return db[_0x7f11('0x35')][_0x7f11('0x52')](_0x53ee7d)[_0x7f11('0x1c')](handleEntityNotFound(_0x41e972,null))['then'](respondWithResult(_0x41e972,null))[_0x7f11('0x4e')](handleError(_0x41e972,null));};exports[_0x7f11('0x53')]=function(_0x41139b,_0x2872b4,_0x5e42ad){var _0x522fd4;return db[_0x7f11('0x35')]['create'](_0x41139b['body'],{'raw':!![]})[_0x7f11('0x1c')](function(_0x2e9128){_0x522fd4=_0x2e9128;return db[_0x7f11('0x35')][_0x7f11('0x4c')]({'raw':!![]});})['then'](function(_0x87c9b3){var _0x2f1e54=fs[_0x7f11('0x54')](path[_0x7f11('0x55')](config['root'],_0x7f11('0x56')),_0x7f11('0x57'));var _0x36862c=ejs[_0x7f11('0x58')](_0x2f1e54,{'contexts':_0x87c9b3||[]});fs['writeFileSync'](_0x7f11('0x59'),_0x36862c);})[_0x7f11('0x1c')](function(){return respondWithRpcPromise(_0x7f11('0x5a'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x5b0c84=_0x41139b[_0x7f11('0x5b')][_0x7f11('0x30')]({'plain':!![]});if(!_0x5b0c84)throw new Error(_0x7f11('0x5c'));if(_0x5b0c84[_0x7f11('0x5d')]===_0x7f11('0x5b')){var _0x564fa5=_0x522fd4[_0x7f11('0x30')]({'plain':!![]});return db['UserProfileSection'][_0x7f11('0x52')]({'where':{'name':_0x7f11('0x5e'),'userProfileId':_0x5b0c84[_0x7f11('0x5f')]},'raw':!![]})['then'](function(_0x3a0466){if(_0x3a0466&&_0x3a0466[_0x7f11('0x60')]===0x0){return db['UserProfileResource'][_0x7f11('0x53')]({'name':_0x564fa5[_0x7f11('0x34')],'resourceId':_0x564fa5['id'],'type':_0x3a0466[_0x7f11('0x34')],'sectionId':_0x3a0466['id']},{})['then'](function(){return _0x522fd4;});}else{return _0x522fd4;}})[_0x7f11('0x4e')](function(_0x479aac){logger[_0x7f11('0x23')](_0x7f11('0x61'),_0x479aac);throw _0x479aac;});}return _0x522fd4;})[_0x7f11('0x1c')](respondWithResult(_0x2872b4,0xc9))[_0x7f11('0x4e')](handleError(_0x2872b4,null));};exports[_0x7f11('0x62')]=function(_0x1bd7ec,_0x1df022,_0x17c6a0){var _0x351b24;return db[_0x7f11('0x35')][_0x7f11('0x52')]({'where':{'id':_0x1bd7ec[_0x7f11('0x50')]['id']}})['then'](handleEntityNotFound(_0x1df022,null))['then'](saveUpdates(_0x1bd7ec[_0x7f11('0x63')],null))['then'](function(_0x1b2d0b){if(_0x1b2d0b){_0x351b24=_0x1b2d0b;return db[_0x7f11('0x35')][_0x7f11('0x4c')]({'raw':!![]});}})[_0x7f11('0x1c')](function(_0x18998b){var _0x3ef1c1=fs[_0x7f11('0x54')](path[_0x7f11('0x55')](config[_0x7f11('0x64')],'server/files/templates/context.ejs'),_0x7f11('0x57'));var _0x2cf4dd=ejs[_0x7f11('0x58')](_0x3ef1c1,{'contexts':_0x18998b||[]});fs['writeFileSync'](_0x7f11('0x59'),_0x2cf4dd);})['then'](function(){return respondWithRpcPromise('Reload',_0x7f11('0x62'),{'module':_0x7f11('0x65')});})[_0x7f11('0x1c')](function(){return _0x351b24;})['then'](respondWithResult(_0x1df022,null))[_0x7f11('0x4e')](handleError(_0x1df022,null));};exports['destroy']=function(_0x5d1744,_0x33ac02,_0x556759){var _0x39d917;return db[_0x7f11('0x35')][_0x7f11('0x52')]({'where':{'id':_0x5d1744[_0x7f11('0x50')]['id']}})['then'](handleEntityNotFound(_0x33ac02,null))['then'](removeEntity(_0x33ac02,null))['then'](function(){return db[_0x7f11('0x35')][_0x7f11('0x4c')]({'raw':!![]});})[_0x7f11('0x1c')](function(_0xfecb80){var _0x35148c=fs[_0x7f11('0x54')](path[_0x7f11('0x55')](config['root'],_0x7f11('0x56')),_0x7f11('0x57'));var _0x9f792d=ejs[_0x7f11('0x58')](_0x35148c,{'contexts':_0xfecb80});fs[_0x7f11('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x9f792d);return respondWithRpcPromise(_0x7f11('0x5a'),_0x7f11('0x2f'),{'module':'chan_sip.so'});})[_0x7f11('0x4e')](handleError(_0x33ac02,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e92be6c..960a052 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 _0xae1b=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','VoiceContext'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae1b,0x96));var _0xbae1=function(_0x535e6a,_0x401846){_0x535e6a=_0x535e6a-0x0;var _0x108533=_0xae1b[_0x535e6a];return _0x108533;};'use strict';var _=require('lodash');var util=require(_0xbae1('0x0'));var logger=require('../../config/logger')(_0xbae1('0x1'));var moment=require(_0xbae1('0x2'));var BPromise=require(_0xbae1('0x3'));var rp=require(_0xbae1('0x4'));var fs=require('fs');var path=require(_0xbae1('0x5'));var rimraf=require(_0xbae1('0x6'));var config=require('../../config/environment');var attributes=require(_0xbae1('0x7'));module[_0xbae1('0x8')]=function(_0x5b8d9d,_0x447cd9){return _0x5b8d9d['define'](_0xbae1('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bdf=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9bdf,0x103));var _0xf9bd=function(_0x1b69a4,_0x3e9f5f){_0x1b69a4=_0x1b69a4-0x0;var _0x4ab6a6=_0x9bdf[_0x1b69a4];return _0x4ab6a6;};'use strict';var _=require(_0xf9bd('0x0'));var util=require(_0xf9bd('0x1'));var logger=require(_0xf9bd('0x2'))(_0xf9bd('0x3'));var moment=require(_0xf9bd('0x4'));var BPromise=require(_0xf9bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9bd('0x6'));var rimraf=require(_0xf9bd('0x7'));var config=require(_0xf9bd('0x8'));var attributes=require(_0xf9bd('0x9'));module[_0xf9bd('0xa')]=function(_0x46fc47,_0x2ab7fe){return _0x46fc47[_0xf9bd('0xb')](_0xf9bd('0xc'),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 c2913ee..21175f1 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 _0xd38f=['code','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf47939,_0x124b6a){var _0x5f1ec1=function(_0x58f724){while(--_0x58f724){_0xf47939['push'](_0xf47939['shift']());}};_0x5f1ec1(++_0x124b6a);}(_0xd38f,0xa3));var _0xfd38=function(_0x3d6deb,_0x52468c){_0x3d6deb=_0x3d6deb-0x0;var _0x3b8de8=_0xd38f[_0x3d6deb];return _0x3b8de8;};'use strict';var _=require(_0xfd38('0x0'));var util=require(_0xfd38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd38('0x2'));var db=require(_0xfd38('0x3'))['db'];var utils=require(_0xfd38('0x4'));var logger=require(_0xfd38('0x5'))(_0xfd38('0x6'));var config=require(_0xfd38('0x7'));var jayson=require(_0xfd38('0x8'));var client=jayson[_0xfd38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318785,_0x9e8238,_0x433783){return new BPromise(function(_0xd0d6d8,_0x57ffcb){return client['request'](_0x318785,_0x433783)[_0xfd38('0xa')](function(_0x2f789a){logger['info'](_0xfd38('0xb'),_0x9e8238,_0xfd38('0xc'));logger[_0xfd38('0xd')](_0xfd38('0xe'),_0x9e8238,_0xfd38('0xc'),JSON[_0xfd38('0xf')](_0x2f789a));if(_0x2f789a[_0xfd38('0x10')]){if(_0x2f789a[_0xfd38('0x10')][_0xfd38('0x11')]===0x1f4){logger[_0xfd38('0x10')]('VoiceContext,\x20%s,\x20%s',_0x9e8238,_0x2f789a[_0xfd38('0x10')]['message']);return _0x57ffcb(_0x2f789a[_0xfd38('0x10')][_0xfd38('0x12')]);}logger[_0xfd38('0x10')](_0xfd38('0xb'),_0x9e8238,_0x2f789a[_0xfd38('0x10')]['message']);return _0xd0d6d8(_0x2f789a['error'][_0xfd38('0x12')]);}else{logger['info'](_0xfd38('0xb'),_0x9e8238,_0xfd38('0xc'));_0xd0d6d8(_0x2f789a['result'][_0xfd38('0x12')]);}})[_0xfd38('0x13')](function(_0x447252){logger[_0xfd38('0x10')](_0xfd38('0xb'),_0x9e8238,_0x447252);_0x57ffcb(_0x447252);});});} \ No newline at end of file +var _0x1d90=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x1d90,0x13e));var _0x01d9=function(_0x2c9f17,_0x2c28c5){_0x2c9f17=_0x2c9f17-0x0;var _0x3112e4=_0x1d90[_0x2c9f17];return _0x3112e4;};'use strict';var _=require(_0x01d9('0x0'));var util=require('util');var moment=require(_0x01d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x01d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01d9('0x3'))['db'];var utils=require(_0x01d9('0x4'));var logger=require('../../config/logger')(_0x01d9('0x5'));var config=require(_0x01d9('0x6'));var jayson=require(_0x01d9('0x7'));var client=jayson['client'][_0x01d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1664eb,_0x31c11d,_0x598409){return new BPromise(function(_0xef9d5b,_0x479447){return client['request'](_0x1664eb,_0x598409)[_0x01d9('0x9')](function(_0x2b8e06){logger[_0x01d9('0xa')]('VoiceContext,\x20%s,\x20%s',_0x31c11d,_0x01d9('0xb'));logger[_0x01d9('0xc')](_0x01d9('0xd'),_0x31c11d,'request\x20sent',JSON[_0x01d9('0xe')](_0x2b8e06));if(_0x2b8e06[_0x01d9('0xf')]){if(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x10')]===0x1f4){logger[_0x01d9('0xf')](_0x01d9('0x11'),_0x31c11d,_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);return _0x479447(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);}logger[_0x01d9('0xf')](_0x01d9('0x11'),_0x31c11d,_0x2b8e06['error'][_0x01d9('0x12')]);return _0xef9d5b(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);}else{logger[_0x01d9('0xa')]('VoiceContext,\x20%s,\x20%s',_0x31c11d,_0x01d9('0xb'));_0xef9d5b(_0x2b8e06[_0x01d9('0x13')][_0x01d9('0x12')]);}})[_0x01d9('0x14')](function(_0x147911){logger['error'](_0x01d9('0x11'),_0x31c11d,_0x147911);_0x479447(_0x147911);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 63cf8f3..4b834cb 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 _0xeebe=['update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x29a382,_0x26d7a5){var _0x43dcda=function(_0x2f3c7a){while(--_0x2f3c7a){_0x29a382['push'](_0x29a382['shift']());}};_0x43dcda(++_0x26d7a5);}(_0xeebe,0xff));var _0xeeeb=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xeebe[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xeeeb('0x0'));var util=require('util');var path=require(_0xeeeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xeeeb('0x2'));var router=express[_0xeeeb('0x3')]();var fs_extra=require(_0xeeeb('0x4'));var auth=require(_0xeeeb('0x5'));var interaction=require(_0xeeeb('0x6'));var config=require(_0xeeeb('0x7'));var controller=require(_0xeeeb('0x8'));router[_0xeeeb('0x9')]('/',auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xb')]);router[_0xeeeb('0x9')](_0xeeeb('0xc'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xd')]);router[_0xeeeb('0x9')](_0xeeeb('0xe'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeeeb('0x10')]);router[_0xeeeb('0x11')](_0xeeeb('0xe'),auth['isAuthenticated'](),controller[_0xeeeb('0x12')]);router[_0xeeeb('0x13')](_0xeeeb('0xe'),auth['isAuthenticated'](),controller[_0xeeeb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9271=['update','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xa929c8,_0x25a5c2){var _0x1b527c=function(_0x58c391){while(--_0x58c391){_0xa929c8['push'](_0xa929c8['shift']());}};_0x1b527c(++_0x25a5c2);}(_0x9271,0x15c));var _0x1927=function(_0x3d5f84,_0x397264){_0x3d5f84=_0x3d5f84-0x0;var _0x4e873c=_0x9271[_0x3d5f84];return _0x4e873c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1927('0x0'));var timeout=require('connect-timeout');var express=require(_0x1927('0x1'));var router=express[_0x1927('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1927('0x3'));var interaction=require(_0x1927('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x1927('0x5')]('/',auth[_0x1927('0x6')](),controller[_0x1927('0x7')]);router[_0x1927('0x5')]('/describe',auth[_0x1927('0x6')](),controller['describe']);router[_0x1927('0x5')](_0x1927('0x8'),auth[_0x1927('0x6')](),controller[_0x1927('0x9')]);router[_0x1927('0xa')]('/',auth[_0x1927('0x6')](),controller['create']);router[_0x1927('0xb')](_0x1927('0x8'),auth[_0x1927('0x6')](),controller[_0x1927('0xc')]);router[_0x1927('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1927('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f8bcfde..8f60d2a 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 _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x555369,_0x463206){var _0x138107=function(_0x10cd15){while(--_0x10cd15){_0x555369['push'](_0x555369['shift']());}};_0x138107(++_0x463206);}(_0x24ca,0x1bc));var _0xa24c=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x24ca[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x3a720f,_0x25b584){var _0x33b4ee=function(_0x1427f6){while(--_0x1427f6){_0x3a720f['push'](_0x3a720f['shift']());}};_0x33b4ee(++_0x25b584);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x564d04,_0x5d1895){_0x564d04=_0x564d04-0x0;var _0x4a2864=_0x6f0d[_0x564d04];return _0x4a2864;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2685db3..2e98ba0 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 _0x4ee1=['type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName'];(function(_0xc6b011,_0x5d1f19){var _0x420171=function(_0x433751){while(--_0x433751){_0xc6b011['push'](_0xc6b011['shift']());}};_0x420171(++_0x5d1f19);}(_0x4ee1,0x1de));var _0x14ee=function(_0x348fe6,_0x5aed32){_0x348fe6=_0x348fe6-0x0;var _0x274dc5=_0x4ee1[_0x348fe6];return _0x274dc5;};'use strict';var emlformat=require(_0x14ee('0x0'));var rimraf=require(_0x14ee('0x1'));var zipdir=require(_0x14ee('0x2'));var jsonpatch=require(_0x14ee('0x3'));var rp=require(_0x14ee('0x4'));var moment=require(_0x14ee('0x5'));var BPromise=require(_0x14ee('0x6'));var Mustache=require(_0x14ee('0x7'));var util=require('util');var path=require(_0x14ee('0x8'));var sox=require(_0x14ee('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14ee('0xa'));var _=require(_0x14ee('0xb'));var squel=require(_0x14ee('0xc'));var crypto=require(_0x14ee('0xd'));var jsforce=require(_0x14ee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x14ee('0xf'));var querystring=require('querystring');var Papa=require(_0x14ee('0x10'));var Redis=require(_0x14ee('0x11'));var authService=require(_0x14ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x14ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14ee('0x14'))(_0x14ee('0x15'));var utils=require(_0x14ee('0x16'));var config=require(_0x14ee('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f4d3b,_0x4b1268){_0x4b1268=_0x4b1268||0xcc;return function(_0x4671ef){if(_0x4671ef){return _0x3f4d3b['sendStatus'](_0x4b1268);}return _0x3f4d3b['status'](_0x4b1268)['end']();};}function respondWithResult(_0x26d8e4,_0x1f42be){_0x1f42be=_0x1f42be||0xc8;return function(_0x4a6348){if(_0x4a6348){return _0x26d8e4[_0x14ee('0x18')](_0x1f42be)[_0x14ee('0x19')](_0x4a6348);}};}function respondWithFilteredResult(_0x20211a,_0x12ce26){return function(_0x8d253e){if(_0x8d253e){var _0xe5d8b0=typeof _0x12ce26['offset']===_0x14ee('0x1a')&&typeof _0x12ce26[_0x14ee('0x1b')]===_0x14ee('0x1a');var _0xebed4f=_0x8d253e[_0x14ee('0x1c')];var _0x48babb=_0xe5d8b0?0x0:_0x12ce26['offset'];var _0x3162d1=_0xe5d8b0?_0x8d253e[_0x14ee('0x1c')]:_0x12ce26[_0x14ee('0x1d')]+_0x12ce26[_0x14ee('0x1b')];var _0x2de8b6;if(_0x3162d1>=_0xebed4f){_0x3162d1=_0xebed4f;_0x2de8b6=0xc8;}else{_0x2de8b6=0xce;}_0x20211a[_0x14ee('0x18')](_0x2de8b6);return _0x20211a[_0x14ee('0x1e')]('Content-Range',_0x48babb+'-'+_0x3162d1+'/'+_0xebed4f)[_0x14ee('0x19')](_0x8d253e);}return null;};}function patchUpdates(_0x4c6f9e){return function(_0x545753){try{jsonpatch[_0x14ee('0x1f')](_0x545753,_0x4c6f9e,!![]);}catch(_0x402c1e){return BPromise[_0x14ee('0x20')](_0x402c1e);}return _0x545753[_0x14ee('0x21')]();};}function saveUpdates(_0x1c6152,_0x1a2015){return function(_0x170ac0){if(_0x170ac0){return _0x170ac0[_0x14ee('0x22')](_0x1c6152)[_0x14ee('0x23')](function(_0xf981b1){return _0xf981b1;});}return null;};}function removeEntity(_0x3f4f31,_0x3d5fcc){return function(_0x26693c){if(_0x26693c){return _0x26693c[_0x14ee('0x24')]()[_0x14ee('0x23')](function(){_0x3f4f31['status'](0xcc)[_0x14ee('0x25')]();});}};}function handleEntityNotFound(_0x1e41cf,_0x1199bc){return function(_0x3b64c8){if(!_0x3b64c8){_0x1e41cf['sendStatus'](0x194);}return _0x3b64c8;};}function handleError(_0x53ddc6,_0x3dc4e0){_0x3dc4e0=_0x3dc4e0||0x1f4;return function(_0x370605){logger[_0x14ee('0x26')](_0x370605[_0x14ee('0x27')]);if(_0x370605[_0x14ee('0x28')]){delete _0x370605[_0x14ee('0x28')];}_0x53ddc6['status'](_0x3dc4e0)[_0x14ee('0x29')](_0x370605);};}exports[_0x14ee('0x2a')]=function(_0x512c8c,_0x42d559){var _0x25cb19={},_0x418266={},_0x52f3ae={'count':0x0,'rows':[]};var _0x59cbd6=_[_0x14ee('0x2b')](db[_0x14ee('0x2c')][_0x14ee('0x2d')],function(_0x5ea569){return{'name':_0x5ea569[_0x14ee('0x2e')],'type':_0x5ea569[_0x14ee('0x2f')][_0x14ee('0x30')]};});_0x418266['model']=_['map'](_0x59cbd6,_0x14ee('0x28'));_0x418266['query']=_[_0x14ee('0x31')](_0x512c8c['query']);_0x418266[_0x14ee('0x32')]=_[_0x14ee('0x33')](_0x418266[_0x14ee('0x34')],_0x418266[_0x14ee('0x35')]);_0x25cb19[_0x14ee('0x36')]=_[_0x14ee('0x33')](_0x418266[_0x14ee('0x34')],qs['fields'](_0x512c8c[_0x14ee('0x35')][_0x14ee('0x37')]));_0x25cb19[_0x14ee('0x36')]=_0x25cb19[_0x14ee('0x36')][_0x14ee('0x38')]?_0x25cb19[_0x14ee('0x36')]:_0x418266['model'];if(!_0x512c8c[_0x14ee('0x35')][_0x14ee('0x39')](_0x14ee('0x3a'))){_0x25cb19[_0x14ee('0x1b')]=qs['limit'](_0x512c8c[_0x14ee('0x35')][_0x14ee('0x1b')]);_0x25cb19[_0x14ee('0x1d')]=qs[_0x14ee('0x1d')](_0x512c8c[_0x14ee('0x35')][_0x14ee('0x1d')]);}_0x25cb19[_0x14ee('0x3b')]=qs['sort'](_0x512c8c[_0x14ee('0x35')][_0x14ee('0x3c')]);_0x25cb19[_0x14ee('0x3d')]=qs[_0x14ee('0x32')](_['pick'](_0x512c8c[_0x14ee('0x35')],_0x418266[_0x14ee('0x32')]),_0x59cbd6);if(_0x512c8c[_0x14ee('0x35')]['filter']){_0x25cb19[_0x14ee('0x3d')]=_['merge'](_0x25cb19[_0x14ee('0x3d')],{'$or':_['map'](_0x59cbd6,function(_0x3c035b){if(_0x3c035b['type']!==_0x14ee('0x3e')){var _0x4abfa2={};_0x4abfa2[_0x3c035b['name']]={'$like':'%'+_0x512c8c[_0x14ee('0x35')][_0x14ee('0x3f')]+'%'};return _0x4abfa2;}})});}_0x25cb19=_[_0x14ee('0x40')]({},_0x25cb19,_0x512c8c[_0x14ee('0x41')]);var _0x511b65={'where':_0x25cb19[_0x14ee('0x3d')]};return db[_0x14ee('0x2c')][_0x14ee('0x1c')](_0x511b65)[_0x14ee('0x23')](function(_0x1e4bad){_0x52f3ae[_0x14ee('0x1c')]=_0x1e4bad;if(_0x512c8c['query']['includeAll']){_0x25cb19[_0x14ee('0x42')]=[{'all':!![]}];}return db[_0x14ee('0x2c')][_0x14ee('0x43')](_0x25cb19);})[_0x14ee('0x23')](function(_0xc917f2){_0x52f3ae['rows']=_0xc917f2;return _0x52f3ae;})['then'](respondWithFilteredResult(_0x42d559,_0x25cb19))[_0x14ee('0x44')](handleError(_0x42d559,null));};exports[_0x14ee('0x45')]=function(_0x2c5910,_0x12a3c3){var _0x499b88={'raw':!![],'where':{'id':_0x2c5910[_0x14ee('0x46')]['id']}},_0x3aaeb7={};_0x3aaeb7[_0x14ee('0x34')]=_['keys'](db[_0x14ee('0x2c')]['rawAttributes']);_0x3aaeb7[_0x14ee('0x35')]=_['keys'](_0x2c5910[_0x14ee('0x35')]);_0x3aaeb7[_0x14ee('0x32')]=_['intersection'](_0x3aaeb7['model'],_0x3aaeb7[_0x14ee('0x35')]);_0x499b88[_0x14ee('0x36')]=_[_0x14ee('0x33')](_0x3aaeb7[_0x14ee('0x34')],qs[_0x14ee('0x37')](_0x2c5910[_0x14ee('0x35')]['fields']));_0x499b88[_0x14ee('0x36')]=_0x499b88[_0x14ee('0x36')][_0x14ee('0x38')]?_0x499b88[_0x14ee('0x36')]:_0x3aaeb7[_0x14ee('0x34')];if(_0x2c5910[_0x14ee('0x35')]['includeAll']){_0x499b88['include']=[{'all':!![]}];}_0x499b88=_[_0x14ee('0x40')]({},_0x499b88,_0x2c5910[_0x14ee('0x41')]);return db['VoiceDialReport'][_0x14ee('0x47')](_0x499b88)['then'](handleEntityNotFound(_0x12a3c3,null))[_0x14ee('0x23')](respondWithResult(_0x12a3c3,null))[_0x14ee('0x44')](handleError(_0x12a3c3,null));};exports[_0x14ee('0x48')]=function(_0x2265b5,_0x5a552f){return db[_0x14ee('0x2c')][_0x14ee('0x48')](_0x2265b5[_0x14ee('0x49')],{})[_0x14ee('0x23')](respondWithResult(_0x5a552f,0xc9))[_0x14ee('0x44')](handleError(_0x5a552f,null));};exports[_0x14ee('0x22')]=function(_0x58c75c,_0x37d4e5){if(_0x58c75c[_0x14ee('0x49')]['id']){delete _0x58c75c['body']['id'];}return db[_0x14ee('0x2c')]['find']({'where':{'id':_0x58c75c[_0x14ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x37d4e5,null))[_0x14ee('0x23')](saveUpdates(_0x58c75c[_0x14ee('0x49')],null))[_0x14ee('0x23')](respondWithResult(_0x37d4e5,null))[_0x14ee('0x44')](handleError(_0x37d4e5,null));};exports[_0x14ee('0x24')]=function(_0x3c6884,_0x207490){return db[_0x14ee('0x2c')][_0x14ee('0x47')]({'where':{'id':_0x3c6884[_0x14ee('0x46')]['id']}})[_0x14ee('0x23')](handleEntityNotFound(_0x207490,null))[_0x14ee('0x23')](removeEntity(_0x207490,null))[_0x14ee('0x44')](handleError(_0x207490,null));};exports[_0x14ee('0x4a')]=function(_0x5e91a0,_0x24398d){return db[_0x14ee('0x2c')]['describe']()[_0x14ee('0x23')](respondWithResult(_0x24398d,null))[_0x14ee('0x44')](handleError(_0x24398d,null));}; \ No newline at end of file +var _0xdc25=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','index','map','VoiceDialReport','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x2d8e9c,_0x48201){var _0x86eb28=function(_0x5a2997){while(--_0x5a2997){_0x2d8e9c['push'](_0x2d8e9c['shift']());}};_0x86eb28(++_0x48201);}(_0xdc25,0x18e));var _0x5dc2=function(_0x3daa2f,_0x1b090c){_0x3daa2f=_0x3daa2f-0x0;var _0x4ef508=_0xdc25[_0x3daa2f];return _0x4ef508;};'use strict';var emlformat=require(_0x5dc2('0x0'));var rimraf=require(_0x5dc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dc2('0x2'));var rp=require('request-promise');var moment=require(_0x5dc2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5dc2('0x4'));var util=require('util');var path=require(_0x5dc2('0x5'));var sox=require(_0x5dc2('0x6'));var csv=require('to-csv');var ejs=require(_0x5dc2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dc2('0x8'));var squel=require(_0x5dc2('0x9'));var crypto=require(_0x5dc2('0xa'));var jsforce=require(_0x5dc2('0xb'));var deskjs=require(_0x5dc2('0xc'));var toCsv=require(_0x5dc2('0xd'));var querystring=require('querystring');var Papa=require(_0x5dc2('0xe'));var Redis=require(_0x5dc2('0xf'));var authService=require(_0x5dc2('0x10'));var qs=require(_0x5dc2('0x11'));var as=require(_0x5dc2('0x12'));var hardwareService=require(_0x5dc2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5dc2('0x14'));var config=require(_0x5dc2('0x15'));var licenseUtil=require(_0x5dc2('0x16'));var db=require(_0x5dc2('0x17'))['db'];function respondWithStatusCode(_0x909c87,_0x24ddeb){_0x24ddeb=_0x24ddeb||0xcc;return function(_0x2165e5){if(_0x2165e5){return _0x909c87[_0x5dc2('0x18')](_0x24ddeb);}return _0x909c87[_0x5dc2('0x19')](_0x24ddeb)[_0x5dc2('0x1a')]();};}function respondWithResult(_0x531efc,_0x46c361){_0x46c361=_0x46c361||0xc8;return function(_0x5e7742){if(_0x5e7742){return _0x531efc[_0x5dc2('0x19')](_0x46c361)['json'](_0x5e7742);}};}function respondWithFilteredResult(_0x41a6a1,_0x12e9fb){return function(_0x4d04e0){if(_0x4d04e0){var _0x19d318=typeof _0x12e9fb[_0x5dc2('0x1b')]===_0x5dc2('0x1c')&&typeof _0x12e9fb[_0x5dc2('0x1d')]===_0x5dc2('0x1c');var _0x5310bf=_0x4d04e0['count'];var _0x1d1da6=_0x19d318?0x0:_0x12e9fb[_0x5dc2('0x1b')];var _0x5f7f0c=_0x19d318?_0x4d04e0[_0x5dc2('0x1e')]:_0x12e9fb[_0x5dc2('0x1b')]+_0x12e9fb['limit'];var _0x3f3fdf;if(_0x5f7f0c>=_0x5310bf){_0x5f7f0c=_0x5310bf;_0x3f3fdf=0xc8;}else{_0x3f3fdf=0xce;}_0x41a6a1['status'](_0x3f3fdf);return _0x41a6a1[_0x5dc2('0x1f')](_0x5dc2('0x20'),_0x1d1da6+'-'+_0x5f7f0c+'/'+_0x5310bf)[_0x5dc2('0x21')](_0x4d04e0);}return null;};}function patchUpdates(_0x361c95){return function(_0x3b945d){try{jsonpatch[_0x5dc2('0x22')](_0x3b945d,_0x361c95,!![]);}catch(_0x3e979f){return BPromise[_0x5dc2('0x23')](_0x3e979f);}return _0x3b945d[_0x5dc2('0x24')]();};}function saveUpdates(_0x1ae058,_0x35e29f){return function(_0x1be80b){if(_0x1be80b){return _0x1be80b[_0x5dc2('0x25')](_0x1ae058)[_0x5dc2('0x26')](function(_0x57765b){return _0x57765b;});}return null;};}function removeEntity(_0x3d2c15,_0x37e271){return function(_0x37a6b9){if(_0x37a6b9){return _0x37a6b9['destroy']()[_0x5dc2('0x26')](function(){_0x3d2c15[_0x5dc2('0x19')](0xcc)[_0x5dc2('0x1a')]();});}};}function handleEntityNotFound(_0x27728d,_0x33947a){return function(_0x3b991a){if(!_0x3b991a){_0x27728d['sendStatus'](0x194);}return _0x3b991a;};}function handleError(_0x39c591,_0x1d5f8f){_0x1d5f8f=_0x1d5f8f||0x1f4;return function(_0x48c837){logger['error'](_0x48c837['stack']);if(_0x48c837[_0x5dc2('0x27')]){delete _0x48c837[_0x5dc2('0x27')];}_0x39c591[_0x5dc2('0x19')](_0x1d5f8f)['send'](_0x48c837);};}exports[_0x5dc2('0x28')]=function(_0x4dc16b,_0x4afa9e){var _0x9534ed={},_0x1e4aa7={},_0x1e3fbb={'count':0x0,'rows':[]};var _0x37b346=_[_0x5dc2('0x29')](db[_0x5dc2('0x2a')]['rawAttributes'],function(_0x1fdffa){return{'name':_0x1fdffa[_0x5dc2('0x2b')],'type':_0x1fdffa[_0x5dc2('0x2c')][_0x5dc2('0x2d')]};});_0x1e4aa7[_0x5dc2('0x2e')]=_[_0x5dc2('0x29')](_0x37b346,_0x5dc2('0x27'));_0x1e4aa7[_0x5dc2('0x2f')]=_['keys'](_0x4dc16b[_0x5dc2('0x2f')]);_0x1e4aa7[_0x5dc2('0x30')]=_[_0x5dc2('0x31')](_0x1e4aa7[_0x5dc2('0x2e')],_0x1e4aa7[_0x5dc2('0x2f')]);_0x9534ed['attributes']=_['intersection'](_0x1e4aa7[_0x5dc2('0x2e')],qs[_0x5dc2('0x32')](_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x32')]));_0x9534ed[_0x5dc2('0x33')]=_0x9534ed[_0x5dc2('0x33')][_0x5dc2('0x34')]?_0x9534ed[_0x5dc2('0x33')]:_0x1e4aa7['model'];if(!_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x35')](_0x5dc2('0x36'))){_0x9534ed[_0x5dc2('0x1d')]=qs['limit'](_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x1d')]);_0x9534ed[_0x5dc2('0x1b')]=qs[_0x5dc2('0x1b')](_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x1b')]);}_0x9534ed[_0x5dc2('0x37')]=qs[_0x5dc2('0x38')](_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x38')]);_0x9534ed[_0x5dc2('0x39')]=qs[_0x5dc2('0x30')](_[_0x5dc2('0x3a')](_0x4dc16b[_0x5dc2('0x2f')],_0x1e4aa7['filters']),_0x37b346);if(_0x4dc16b['query'][_0x5dc2('0x3b')]){_0x9534ed[_0x5dc2('0x39')]=_['merge'](_0x9534ed[_0x5dc2('0x39')],{'$or':_[_0x5dc2('0x29')](_0x37b346,function(_0x2d3c93){if(_0x2d3c93[_0x5dc2('0x2c')]!=='VIRTUAL'){var _0x6b6c59={};_0x6b6c59[_0x2d3c93['name']]={'$like':'%'+_0x4dc16b[_0x5dc2('0x2f')]['filter']+'%'};return _0x6b6c59;}})});}_0x9534ed=_[_0x5dc2('0x3c')]({},_0x9534ed,_0x4dc16b['options']);var _0x394a8d={'where':_0x9534ed[_0x5dc2('0x39')]};return db[_0x5dc2('0x2a')][_0x5dc2('0x1e')](_0x394a8d)[_0x5dc2('0x26')](function(_0x1392b4){_0x1e3fbb[_0x5dc2('0x1e')]=_0x1392b4;if(_0x4dc16b[_0x5dc2('0x2f')][_0x5dc2('0x3d')]){_0x9534ed[_0x5dc2('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x5dc2('0x3f')](_0x9534ed);})[_0x5dc2('0x26')](function(_0x239173){_0x1e3fbb[_0x5dc2('0x40')]=_0x239173;return _0x1e3fbb;})[_0x5dc2('0x26')](respondWithFilteredResult(_0x4afa9e,_0x9534ed))[_0x5dc2('0x41')](handleError(_0x4afa9e,null));};exports['show']=function(_0x3b6b22,_0x1f40e9){var _0x4b3982={'raw':!![],'where':{'id':_0x3b6b22[_0x5dc2('0x42')]['id']}},_0x3734a3={};_0x3734a3['model']=_[_0x5dc2('0x43')](db[_0x5dc2('0x2a')][_0x5dc2('0x44')]);_0x3734a3['query']=_['keys'](_0x3b6b22['query']);_0x3734a3[_0x5dc2('0x30')]=_[_0x5dc2('0x31')](_0x3734a3[_0x5dc2('0x2e')],_0x3734a3['query']);_0x4b3982['attributes']=_[_0x5dc2('0x31')](_0x3734a3[_0x5dc2('0x2e')],qs['fields'](_0x3b6b22[_0x5dc2('0x2f')][_0x5dc2('0x32')]));_0x4b3982[_0x5dc2('0x33')]=_0x4b3982[_0x5dc2('0x33')]['length']?_0x4b3982[_0x5dc2('0x33')]:_0x3734a3[_0x5dc2('0x2e')];if(_0x3b6b22[_0x5dc2('0x2f')][_0x5dc2('0x3d')]){_0x4b3982[_0x5dc2('0x3e')]=[{'all':!![]}];}_0x4b3982=_['merge']({},_0x4b3982,_0x3b6b22[_0x5dc2('0x45')]);return db[_0x5dc2('0x2a')][_0x5dc2('0x46')](_0x4b3982)[_0x5dc2('0x26')](handleEntityNotFound(_0x1f40e9,null))[_0x5dc2('0x26')](respondWithResult(_0x1f40e9,null))[_0x5dc2('0x41')](handleError(_0x1f40e9,null));};exports[_0x5dc2('0x47')]=function(_0x4229be,_0x3aba36){return db['VoiceDialReport'][_0x5dc2('0x47')](_0x4229be['body'],{})['then'](respondWithResult(_0x3aba36,0xc9))[_0x5dc2('0x41')](handleError(_0x3aba36,null));};exports[_0x5dc2('0x25')]=function(_0x4c1ae4,_0x2ed182){if(_0x4c1ae4[_0x5dc2('0x48')]['id']){delete _0x4c1ae4[_0x5dc2('0x48')]['id'];}return db[_0x5dc2('0x2a')][_0x5dc2('0x46')]({'where':{'id':_0x4c1ae4[_0x5dc2('0x42')]['id']}})[_0x5dc2('0x26')](handleEntityNotFound(_0x2ed182,null))[_0x5dc2('0x26')](saveUpdates(_0x4c1ae4[_0x5dc2('0x48')],null))[_0x5dc2('0x26')](respondWithResult(_0x2ed182,null))['catch'](handleError(_0x2ed182,null));};exports[_0x5dc2('0x49')]=function(_0x597985,_0x15c47d){return db[_0x5dc2('0x2a')]['find']({'where':{'id':_0x597985[_0x5dc2('0x42')]['id']}})[_0x5dc2('0x26')](handleEntityNotFound(_0x15c47d,null))[_0x5dc2('0x26')](removeEntity(_0x15c47d,null))[_0x5dc2('0x41')](handleError(_0x15c47d,null));};exports[_0x5dc2('0x4a')]=function(_0x5a3f68,_0x4c5367){return db[_0x5dc2('0x2a')][_0x5dc2('0x4a')]()[_0x5dc2('0x26')](respondWithResult(_0x4c5367,null))['catch'](handleError(_0x4c5367,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index aca313f..73b5ba0 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 _0x9489=['../../config/logger','api','moment','bluebird','rimraf','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x9489,0xb2));var _0x9948=function(_0x99c991,_0x439ce7){_0x99c991=_0x99c991-0x0;var _0x3e2061=_0x9489[_0x99c991];return _0x3e2061;};'use strict';var _=require(_0x9948('0x0'));var util=require(_0x9948('0x1'));var logger=require(_0x9948('0x2'))(_0x9948('0x3'));var moment=require(_0x9948('0x4'));var BPromise=require(_0x9948('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9948('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x9948('0x7')]=function(_0xafd5da,_0x424ae8){return _0xafd5da[_0x9948('0x8')](_0x9948('0x9'),attributes,{'tableName':_0x9948('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9948('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fbe=['moment','request-promise','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid','util','../../config/logger'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x5fbe,0x11e));var _0xe5fb=function(_0x43dd2a,_0x572ea9){_0x43dd2a=_0x43dd2a-0x0;var _0x4bbbae=_0x5fbe[_0x43dd2a];return _0x4bbbae;};'use strict';var _=require('lodash');var util=require(_0xe5fb('0x0'));var logger=require(_0xe5fb('0x1'))('api');var moment=require(_0xe5fb('0x2'));var BPromise=require('bluebird');var rp=require(_0xe5fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5fb('0x4'));module[_0xe5fb('0x5')]=function(_0x51f0ab,_0x4876f6){return _0x51f0ab['define'](_0xe5fb('0x6'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xe5fb('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0a6279e..2c4971d 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 _0xb43e=['limit','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','catch','UpdateVoiceDialReport','update','where'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb43e,0xb5));var _0xeb43=function(_0xfbc931,_0x2fb6bc){_0xfbc931=_0xfbc931-0x0;var _0x4e11f8=_0xb43e[_0xfbc931];return _0x4e11f8;};'use strict';var _=require('lodash');var util=require(_0xeb43('0x0'));var moment=require(_0xeb43('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb43('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xeb43('0x3'));var logger=require(_0xeb43('0x4'))('rpc');var config=require(_0xeb43('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeb43('0x6')][_0xeb43('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d6f57,_0x3659da,_0x1cd1ef){return new BPromise(function(_0x1141e0,_0x54a912){return client['request'](_0x1d6f57,_0x1cd1ef)[_0xeb43('0x8')](function(_0xa30821){logger['info'](_0xeb43('0x9'),_0x3659da,_0xeb43('0xa'));logger[_0xeb43('0xb')](_0xeb43('0xc'),_0x3659da,_0xeb43('0xa'),JSON['stringify'](_0xa30821));if(_0xa30821['error']){if(_0xa30821[_0xeb43('0xd')][_0xeb43('0xe')]===0x1f4){logger[_0xeb43('0xd')](_0xeb43('0x9'),_0x3659da,_0xa30821[_0xeb43('0xd')][_0xeb43('0xf')]);return _0x54a912(_0xa30821['error'][_0xeb43('0xf')]);}logger[_0xeb43('0xd')](_0xeb43('0x9'),_0x3659da,_0xa30821[_0xeb43('0xd')][_0xeb43('0xf')]);return _0x1141e0(_0xa30821[_0xeb43('0xd')][_0xeb43('0xf')]);}else{logger[_0xeb43('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x3659da,_0xeb43('0xa'));_0x1141e0(_0xa30821[_0xeb43('0x11')][_0xeb43('0xf')]);}})['catch'](function(_0x4be2e3){logger[_0xeb43('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3659da,_0x4be2e3);_0x54a912(_0x4be2e3);});});}exports['CreateVoiceDialReport']=function(_0x42093b){var _0x59c4e9=this;return new Promise(function(_0x5774ae,_0x376ac0){return db[_0xeb43('0x12')][_0xeb43('0x13')](_0x42093b[_0xeb43('0x14')],{'raw':_0x42093b[_0xeb43('0x15')]?_0x42093b[_0xeb43('0x15')][_0xeb43('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x44f68f){logger[_0xeb43('0x10')](_0xeb43('0x17'),_0x42093b);logger['debug'](_0xeb43('0x17'),_0x42093b,JSON[_0xeb43('0x18')](_0x44f68f));_0x5774ae(_0x44f68f);})[_0xeb43('0x19')](function(_0x3f5d95){logger['error'](_0xeb43('0x17'),_0x3f5d95['message'],_0x42093b);_0x376ac0(_0x59c4e9[_0xeb43('0xd')](0x1f4,_0x3f5d95['message']));});});};exports[_0xeb43('0x1a')]=function(_0x361263){var _0x3d67d5=this;return new Promise(function(_0xed680e,_0x4fdbf2){return db[_0xeb43('0x12')][_0xeb43('0x1b')](_0x361263[_0xeb43('0x14')],{'raw':_0x361263[_0xeb43('0x15')]?_0x361263[_0xeb43('0x15')][_0xeb43('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x361263['options']?_0x361263['options'][_0xeb43('0x1c')]||null:null,'attributes':_0x361263[_0xeb43('0x15')]?_0x361263['options']['attributes']||null:null,'limit':_0x361263[_0xeb43('0x15')]?_0x361263[_0xeb43('0x15')][_0xeb43('0x1d')]||null:null})[_0xeb43('0x8')](function(_0xc4cf7e){logger['info']('UpdateVoiceDialReport',_0x361263);logger[_0xeb43('0xb')](_0xeb43('0x1a'),_0x361263,JSON[_0xeb43('0x18')](_0xc4cf7e));_0xed680e(_0xc4cf7e);})[_0xeb43('0x19')](function(_0xb8f0f8){logger[_0xeb43('0xd')](_0xeb43('0x1a'),_0xb8f0f8[_0xeb43('0xf')],_0x361263);_0x4fdbf2(_0x3d67d5[_0xeb43('0xd')](0x1f4,_0xb8f0f8[_0xeb43('0xf')]));});});}; \ No newline at end of file +var _0xb36d=['CreateVoiceDialReport','VoiceDialReport','create','body','raw','info','stringify','catch','options','where','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2d5ac6,_0x3eeaec){var _0x1f8abf=function(_0x25641b){while(--_0x25641b){_0x2d5ac6['push'](_0x2d5ac6['shift']());}};_0x1f8abf(++_0x3eeaec);}(_0xb36d,0x168));var _0xdb36=function(_0x35e0cd,_0x5c0b4b){_0x35e0cd=_0x35e0cd-0x0;var _0x16133f=_0xb36d[_0x35e0cd];return _0x16133f;};'use strict';var _=require('lodash');var util=require(_0xdb36('0x0'));var moment=require(_0xdb36('0x1'));var BPromise=require(_0xdb36('0x2'));var rs=require(_0xdb36('0x3'));var fs=require('fs');var Redis=require(_0xdb36('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb36('0x5'))(_0xdb36('0x6'));var config=require(_0xdb36('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31016d,_0x5131a6,_0x2df760){return new BPromise(function(_0x182183,_0x1ba238){return client[_0xdb36('0x8')](_0x31016d,_0x2df760)[_0xdb36('0x9')](function(_0xec0b7c){logger['info'](_0xdb36('0xa'),_0x5131a6,'request\x20sent');logger[_0xdb36('0xb')](_0xdb36('0xc'),_0x5131a6,_0xdb36('0xd'),JSON['stringify'](_0xec0b7c));if(_0xec0b7c[_0xdb36('0xe')]){if(_0xec0b7c['error'][_0xdb36('0xf')]===0x1f4){logger[_0xdb36('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x5131a6,_0xec0b7c[_0xdb36('0xe')][_0xdb36('0x10')]);return _0x1ba238(_0xec0b7c['error'][_0xdb36('0x10')]);}logger[_0xdb36('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x5131a6,_0xec0b7c['error'][_0xdb36('0x10')]);return _0x182183(_0xec0b7c[_0xdb36('0xe')][_0xdb36('0x10')]);}else{logger['info'](_0xdb36('0xa'),_0x5131a6,_0xdb36('0xd'));_0x182183(_0xec0b7c['result']['message']);}})['catch'](function(_0x1a5bc2){logger['error'](_0xdb36('0xa'),_0x5131a6,_0x1a5bc2);_0x1ba238(_0x1a5bc2);});});}exports[_0xdb36('0x11')]=function(_0x23d75b){var _0x1517f7=this;return new Promise(function(_0x10f299,_0x100da9){return db[_0xdb36('0x12')][_0xdb36('0x13')](_0x23d75b[_0xdb36('0x14')],{'raw':_0x23d75b['options']?_0x23d75b['options'][_0xdb36('0x15')]===undefined?!![]:![]:!![]})[_0xdb36('0x9')](function(_0x4a12ce){logger[_0xdb36('0x16')](_0xdb36('0x11'),_0x23d75b);logger[_0xdb36('0xb')](_0xdb36('0x11'),_0x23d75b,JSON[_0xdb36('0x17')](_0x4a12ce));_0x10f299(_0x4a12ce);})[_0xdb36('0x18')](function(_0x502e3c){logger[_0xdb36('0xe')](_0xdb36('0x11'),_0x502e3c[_0xdb36('0x10')],_0x23d75b);_0x100da9(_0x1517f7[_0xdb36('0xe')](0x1f4,_0x502e3c[_0xdb36('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x55a689){var _0x12ccde=this;return new Promise(function(_0x477c2a,_0x44d27e){return db['VoiceDialReport']['update'](_0x55a689['body'],{'raw':_0x55a689[_0xdb36('0x19')]?_0x55a689[_0xdb36('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55a689[_0xdb36('0x19')]?_0x55a689[_0xdb36('0x19')][_0xdb36('0x1a')]||null:null,'attributes':_0x55a689[_0xdb36('0x19')]?_0x55a689[_0xdb36('0x19')]['attributes']||null:null,'limit':_0x55a689[_0xdb36('0x19')]?_0x55a689[_0xdb36('0x19')][_0xdb36('0x1b')]||null:null})[_0xdb36('0x9')](function(_0x1cd115){logger[_0xdb36('0x16')](_0xdb36('0x1c'),_0x55a689);logger[_0xdb36('0xb')](_0xdb36('0x1c'),_0x55a689,JSON[_0xdb36('0x17')](_0x1cd115));_0x477c2a(_0x1cd115);})['catch'](function(_0x114ae8){logger['error'](_0xdb36('0x1c'),_0x114ae8['message'],_0x55a689);_0x44d27e(_0x12ccde['error'](0x1f4,_0x114ae8[_0xdb36('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 32ff4fb..1ce62e6 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 _0x6ce8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4990da,_0x37b93e){var _0x1ff7d4=function(_0x16981c){while(--_0x16981c){_0x4990da['push'](_0x4990da['shift']());}};_0x1ff7d4(++_0x37b93e);}(_0x6ce8,0x88));var _0x86ce=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6ce8[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0x86ce('0x0'));var path=require(_0x86ce('0x1'));var timeout=require(_0x86ce('0x2'));var express=require(_0x86ce('0x3'));var router=express[_0x86ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86ce('0x5'));var interaction=require(_0x86ce('0x6'));var config=require(_0x86ce('0x7'));var controller=require('./voiceExtension.controller');router[_0x86ce('0x8')]('/',auth[_0x86ce('0x9')](),controller[_0x86ce('0xa')]);router['get'](_0x86ce('0xb'),auth[_0x86ce('0x9')](),controller[_0x86ce('0xc')]);router[_0x86ce('0xd')]('/',auth[_0x86ce('0x9')](),controller[_0x86ce('0xe')]);router[_0x86ce('0xd')](_0x86ce('0xf'),auth['isAuthenticated'](),controller[_0x86ce('0x10')]);router['put'](_0x86ce('0xb'),auth[_0x86ce('0x9')](),controller['update']);router[_0x86ce('0x11')](_0x86ce('0xb'),auth[_0x86ce('0x9')](),controller[_0x86ce('0x12')]);module[_0x86ce('0x13')]=router; \ No newline at end of file +var _0xba77=['isAuthenticated','index','get','/:id','show','post','create','/:id/applications','addApplications','put','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller'];(function(_0x548113,_0x18e8bd){var _0x2b6fc4=function(_0x124235){while(--_0x124235){_0x548113['push'](_0x548113['shift']());}};_0x2b6fc4(++_0x18e8bd);}(_0xba77,0x1ca));var _0x7ba7=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xba77[_0x457b64];return _0x437111;};'use strict';var multer=require('multer');var util=require(_0x7ba7('0x0'));var path=require('path');var timeout=require(_0x7ba7('0x1'));var express=require('express');var router=express[_0x7ba7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7ba7('0x3'));var interaction=require(_0x7ba7('0x4'));var config=require('../../config/environment');var controller=require(_0x7ba7('0x5'));router['get']('/',auth[_0x7ba7('0x6')](),controller[_0x7ba7('0x7')]);router[_0x7ba7('0x8')](_0x7ba7('0x9'),auth[_0x7ba7('0x6')](),controller[_0x7ba7('0xa')]);router[_0x7ba7('0xb')]('/',auth['isAuthenticated'](),controller[_0x7ba7('0xc')]);router[_0x7ba7('0xb')](_0x7ba7('0xd'),auth[_0x7ba7('0x6')](),controller[_0x7ba7('0xe')]);router[_0x7ba7('0xf')](_0x7ba7('0x9'),auth[_0x7ba7('0x6')](),controller['update']);router['delete'](_0x7ba7('0x9'),auth[_0x7ba7('0x6')](),controller['destroy']);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 3e9c9b7..9ba4827 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 _0x72bd=['*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system'];(function(_0x1fa3f4,_0x56868e){var _0x491768=function(_0x162309){while(--_0x162309){_0x1fa3f4['push'](_0x1fa3f4['shift']());}};_0x491768(++_0x56868e);}(_0x72bd,0x181));var _0xd72b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x72bd[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0xd72b('0x0'));module['exports']={'context':{'type':Sequelize[_0xd72b('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd72b('0x2')},'priority':{'type':Sequelize[_0xd72b('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xd72b('0x2')},'tag':{'type':Sequelize[_0xd72b('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd72b('0x3')},'appdata':{'type':Sequelize[_0xd72b('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd72b('0x4')](_0xd72b('0x5'),_0xd72b('0x6'),_0xd72b('0x7'),_0xd72b('0x8'),_0xd72b('0x9'),_0xd72b('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xd72b('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd72b('0xb')},'IntervalId':{'type':Sequelize[_0xd72b('0xc')]},'isApp':{'type':Sequelize[_0xd72b('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd72b('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd72b('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd72b('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd72b('0xe')},'answer':{'type':Sequelize[_0xd72b('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd72b('0xf')],'get':function(_0x12e3ad){return this[_0xd72b('0x10')](_0xd72b('0x11'));}},'alias':{'type':Sequelize[_0xd72b('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb1c4=['getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','outbound-fax','system','any','*,*,*,*','BOOLEAN','wav','VIRTUAL'];(function(_0x21f36b,_0x52b0e1){var _0x3450f2=function(_0x2babba){while(--_0x2babba){_0x21f36b['push'](_0x21f36b['shift']());}};_0x3450f2(++_0x52b0e1);}(_0xb1c4,0x72));var _0x4b1c=function(_0x53d63c,_0x130b09){_0x53d63c=_0x53d63c-0x0;var _0x443dfb=_0xb1c4[_0x53d63c];return _0x443dfb;};'use strict';var Sequelize=require('sequelize');module[_0x4b1c('0x0')]={'context':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':![],'unique':_0x4b1c('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b1c('0x2')},'priority':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x4b1c('0x2')},'tag':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b1c('0x3')},'appdata':{'type':Sequelize[_0x4b1c('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4b1c('0x4')]('inbound',_0x4b1c('0x5'),_0x4b1c('0x6'),'inbound-fax',_0x4b1c('0x7'),_0x4b1c('0x8'),_0x4b1c('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':![],'defaultValue':_0x4b1c('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4b1c('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4b1c('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x4b1c('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x4b1c('0x1')],'defaultValue':_0x4b1c('0xc')},'answer':{'type':Sequelize[_0x4b1c('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4b1c('0xd')],'get':function(_0x247fd0){return this[_0x4b1c('0xe')](_0x4b1c('0xf'));}},'alias':{'type':Sequelize[_0x4b1c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f320a03..e231067 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 _0x22f4=['set','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','send','index','VoiceExtension','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','create','body','startsWith','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','alias','context','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x3a49ed,_0x5942c0){var _0xfc681=function(_0x11d26b){while(--_0x11d26b){_0x3a49ed['push'](_0x3a49ed['shift']());}};_0xfc681(++_0x5942c0);}(_0x22f4,0xfe));var _0x422f=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x22f4[_0x352e09];return _0x1b7094;};'use strict';var _=require('lodash');var Redis=require(_0x422f('0x0'));var qs=require(_0x422f('0x1'));var logger=require(_0x422f('0x2'))('api');var config=require(_0x422f('0x3'));var db=require(_0x422f('0x4'))['db'];config[_0x422f('0x5')]=_[_0x422f('0x6')](config[_0x422f('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x422f('0x7'))(new Redis(config['redis']));require(_0x422f('0x8'))['register'](socket);function respondWithStatusCode(_0x40660f,_0x4700b5){_0x4700b5=_0x4700b5||0xcc;return function(_0x552954){if(_0x552954){return _0x40660f[_0x422f('0x9')](_0x4700b5);}return _0x40660f['status'](_0x4700b5)[_0x422f('0xa')]();};}function respondWithResult(_0x1c54c5,_0x34357e){_0x34357e=_0x34357e||0xc8;return function(_0x52eace){if(_0x52eace){return _0x1c54c5[_0x422f('0xb')](_0x34357e)['json'](_0x52eace);}};}function respondWithFilteredResult(_0x2b02e6,_0x507662){return function(_0x346591){if(_0x346591){var _0x4058bc=typeof _0x507662[_0x422f('0xc')]===_0x422f('0xd')&&typeof _0x507662[_0x422f('0xe')]===_0x422f('0xd');var _0x2dce23=_0x346591['count'];var _0x3817a0=_0x4058bc?0x0:_0x507662[_0x422f('0xc')];var _0x5313f1=_0x4058bc?_0x346591[_0x422f('0xf')]:_0x507662['offset']+_0x507662[_0x422f('0xe')];var _0x28da56;if(_0x5313f1>=_0x2dce23){_0x5313f1=_0x2dce23;_0x28da56=0xc8;}else{_0x28da56=0xce;}_0x2b02e6[_0x422f('0xb')](_0x28da56);return _0x2b02e6[_0x422f('0x10')]('Content-Range',_0x3817a0+'-'+_0x5313f1+'/'+_0x2dce23)[_0x422f('0x11')](_0x346591);}return null;};}function removeEntity(_0x2ca1fa){return function(_0x4b410b){if(_0x4b410b){return _0x4b410b[_0x422f('0x12')]()['then'](function(){var _0xa94b27=_0x4b410b[_0x422f('0x13')]({'plain':!![]});var _0x1bd6c4=[{'name':_0x422f('0x14'),'value':_0x422f('0x15'),'ignore':![]},{'name':_0x422f('0x16'),'value':_0x422f('0x17'),'ignore':![]},{'name':_0x422f('0x18'),'value':_0x422f('0x19'),'ignore':![]}];var _0x4dc649=_(_0x1bd6c4)[_0x422f('0x1a')](_0x422f('0x1b'))[_0x422f('0x1c')](_0x422f('0x1d'))[_0x422f('0x1d')]();if(_[_0x422f('0x1e')](_0x4dc649,_0xa94b27[_0x422f('0x1f')])){return;}var _0x495c5e=_[_0x422f('0x20')](_0x1bd6c4,[_0x422f('0x1d'),_0xa94b27['type']])[_0x422f('0x21')];return db[_0x422f('0x22')][_0x422f('0x12')]({'where':{'type':_0x495c5e,'resourceId':_0xa94b27['id']}})[_0x422f('0x23')](function(){return _0x4b410b;});})['then'](function(){_0x2ca1fa[_0x422f('0xb')](0xcc)[_0x422f('0xa')]();});}};}function handleEntityNotFound(_0xbd4d76){return function(_0x5bcfeb){if(!_0x5bcfeb){_0xbd4d76[_0x422f('0x9')](0x194);}return _0x5bcfeb;};}function handleError(_0x501fe8,_0x4388c6){_0x4388c6=_0x4388c6||0x1f4;return function(_0x1e58c4){logger[_0x422f('0x24')](_0x1e58c4['stack']);if(_0x1e58c4['name']){delete _0x1e58c4[_0x422f('0x21')];}_0x501fe8['status'](_0x4388c6)[_0x422f('0x25')](_0x1e58c4);};}exports[_0x422f('0x26')]=function(_0x4e8c54,_0x587d10){var _0x5efc56={},_0x5a1ff4={},_0x5cc746={'count':0x0,'rows':[]};var _0x1d6e29=_[_0x422f('0x1c')](db[_0x422f('0x27')]['rawAttributes'],function(_0x496795){return{'name':_0x496795[_0x422f('0x28')],'type':_0x496795['type']['key']};});_0x5a1ff4[_0x422f('0x29')]=_['map'](_0x1d6e29,_0x422f('0x21'));_0x5a1ff4[_0x422f('0x2a')]=_[_0x422f('0x2b')](_0x4e8c54['query']);_0x5a1ff4[_0x422f('0x2c')]=_[_0x422f('0x2d')](_0x5a1ff4['model'],_0x5a1ff4[_0x422f('0x2a')]);_0x5efc56[_0x422f('0x2e')]=_[_0x422f('0x2d')](_0x5a1ff4[_0x422f('0x29')],qs[_0x422f('0x2f')](_0x4e8c54[_0x422f('0x2a')][_0x422f('0x2f')]));_0x5efc56['attributes']=_0x5efc56[_0x422f('0x2e')][_0x422f('0x30')]?_0x5efc56[_0x422f('0x2e')]:_0x5a1ff4[_0x422f('0x29')];if(!_0x4e8c54[_0x422f('0x2a')][_0x422f('0x31')](_0x422f('0x32'))){_0x5efc56[_0x422f('0xe')]=qs[_0x422f('0xe')](_0x4e8c54[_0x422f('0x2a')][_0x422f('0xe')]);_0x5efc56[_0x422f('0xc')]=qs[_0x422f('0xc')](_0x4e8c54[_0x422f('0x2a')][_0x422f('0xc')]);}_0x5efc56['order']=qs['sort'](_0x4e8c54[_0x422f('0x2a')]['sort']);_0x5efc56[_0x422f('0x33')]=qs[_0x422f('0x2c')](_[_0x422f('0x34')](_0x4e8c54['query'],_0x5a1ff4[_0x422f('0x2c')]),_0x1d6e29);if(_0x4e8c54['query'][_0x422f('0x1a')]){_0x5efc56[_0x422f('0x33')]=_[_0x422f('0x35')](_0x5efc56[_0x422f('0x33')],{'$or':_['map'](_0x1d6e29,function(_0x5b6447){if(_0x5b6447['type']!=='VIRTUAL'){var _0x2f32fb={};_0x2f32fb[_0x5b6447['name']]={'$like':'%'+_0x4e8c54['query'][_0x422f('0x1a')]+'%'};return _0x2f32fb;}})});}_0x5efc56=_['merge']({},_0x5efc56,_0x4e8c54[_0x422f('0x36')]);var _0x5a7388={'where':_0x5efc56[_0x422f('0x33')]};return db['VoiceExtension'][_0x422f('0xf')](_0x5a7388)[_0x422f('0x23')](function(_0x1a9e84){_0x5cc746[_0x422f('0xf')]=_0x1a9e84;if(_0x4e8c54['query'][_0x422f('0x37')]){_0x5efc56['include']=[{'all':!![]}];}return db[_0x422f('0x27')][_0x422f('0x38')](_0x5efc56);})[_0x422f('0x23')](function(_0x21be76){_0x5cc746[_0x422f('0x39')]=_0x21be76;return _0x5cc746;})[_0x422f('0x23')](respondWithFilteredResult(_0x587d10,_0x5efc56))[_0x422f('0x3a')](handleError(_0x587d10,null));};exports[_0x422f('0x3b')]=function(_0xbbd374,_0x429215){var _0x3f1dd0={'raw':![],'where':{'id':_0xbbd374[_0x422f('0x3c')]['id']}},_0x125b42={};_0x125b42[_0x422f('0x29')]=_[_0x422f('0x2b')](db[_0x422f('0x27')][_0x422f('0x3d')]);_0x125b42[_0x422f('0x2a')]=_[_0x422f('0x2b')](_0xbbd374[_0x422f('0x2a')]);_0x125b42[_0x422f('0x2c')]=_['intersection'](_0x125b42['model'],_0x125b42['query']);_0x3f1dd0[_0x422f('0x2e')]=_[_0x422f('0x2d')](_0x125b42[_0x422f('0x29')],qs['fields'](_0xbbd374['query'][_0x422f('0x2f')]));_0x3f1dd0[_0x422f('0x2e')]=_0x3f1dd0[_0x422f('0x2e')][_0x422f('0x30')]?_0x3f1dd0[_0x422f('0x2e')]:_0x125b42[_0x422f('0x29')];if(_0xbbd374[_0x422f('0x2a')][_0x422f('0x37')]){_0x3f1dd0['include']=[{'all':!![]}];}_0x3f1dd0=_[_0x422f('0x35')]({},_0x3f1dd0,_0xbbd374[_0x422f('0x36')]);return db[_0x422f('0x27')][_0x422f('0x20')](_0x3f1dd0)[_0x422f('0x23')](handleEntityNotFound(_0x429215,null))[_0x422f('0x23')](respondWithResult(_0x429215,null))['catch'](handleError(_0x429215,null));};exports[_0x422f('0x12')]=function(_0x13d198,_0x5d56fa){return db[_0x422f('0x27')][_0x422f('0x20')]({'where':{'id':_0x13d198[_0x422f('0x3c')]['id']}})[_0x422f('0x23')](handleEntityNotFound(_0x5d56fa,null))[_0x422f('0x23')](removeEntity(_0x5d56fa,null))[_0x422f('0x3a')](handleError(_0x5d56fa,null));};exports[_0x422f('0x3e')]=function(_0x4f3aa5,_0x1f143d){if(_0x4f3aa5[_0x422f('0x3f')][_0x422f('0x1f')]==='outbound'&&!_[_0x422f('0x40')](_0x4f3aa5['body']['exten'],'_')){_0x4f3aa5['body'][_0x422f('0x41')]='_'[_0x422f('0x42')](_0x4f3aa5[_0x422f('0x3f')]['exten']);}return db[_0x422f('0x27')][_0x422f('0x3e')](_0x4f3aa5['body'],{'raw':![]})['then'](function(_0x322be4){var _0x54f4c0=_0x4f3aa5[_0x422f('0x43')]['get']({'plain':!![]});if(!_0x54f4c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54f4c0[_0x422f('0x44')]===_0x422f('0x43')){var _0x57b7da=_0x322be4[_0x422f('0x13')]({'plain':!![]});var _0x1df441=[{'name':_0x422f('0x14'),'value':_0x422f('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x422f('0x19')}];var _0x4c1e22=_[_0x422f('0x20')](_0x1df441,[_0x422f('0x1d'),_0x57b7da['type']])['name'];return db[_0x422f('0x45')][_0x422f('0x20')]({'where':{'name':_0x4c1e22,'userProfileId':_0x54f4c0[_0x422f('0x46')]},'raw':!![]})[_0x422f('0x23')](function(_0x4455d0){if(_0x4455d0&&_0x4455d0[_0x422f('0x47')]===0x0){return db[_0x422f('0x22')][_0x422f('0x3e')]({'name':_0x57b7da[_0x422f('0x21')],'resourceId':_0x57b7da['id'],'type':_0x4455d0[_0x422f('0x21')],'sectionId':_0x4455d0['id']},{})[_0x422f('0x23')](function(){return _0x322be4;});}else{return _0x322be4;}})[_0x422f('0x3a')](function(_0x1aca9e){logger[_0x422f('0x24')](_0x422f('0x48'),_0x1aca9e);throw _0x1aca9e;});}return _0x322be4;})['then'](respondWithResult(_0x1f143d,0xc9))[_0x422f('0x3a')](handleError(_0x1f143d,null));};exports['update']=function(_0x28ef74,_0x8f3822){if(_0x28ef74[_0x422f('0x3f')]['id']){delete _0x28ef74[_0x422f('0x3f')]['id'];}return db[_0x422f('0x27')][_0x422f('0x20')]({'where':{'id':_0x28ef74[_0x422f('0x3c')]['id']}})[_0x422f('0x23')](handleEntityNotFound(_0x8f3822,null))[_0x422f('0x23')](function(_0x1ab216){if(_0x1ab216){return db[_0x422f('0x27')][_0x422f('0x49')](_[_0x422f('0x34')](_0x28ef74['body'],[_0x422f('0x41'),'context',_0x422f('0x4a'),_0x422f('0x4b'),'cutdigits','mandatoryDisposition',_0x422f('0x4c')]),{'where':{'context':_0x1ab216[_0x422f('0x4d')],'exten':_0x1ab216[_0x422f('0x41')]},'individualHooks':!![]})['then'](function(_0x44cc4b){return _0x44cc4b;});}return null;})[_0x422f('0x23')](respondWithStatusCode(_0x8f3822,null))['catch'](handleError(_0x8f3822,null));};exports[_0x422f('0x4e')]=function(_0x2b25e8,_0x4d117f){var _0x172d0=_0x2b25e8['params']['id'];var _0x344f52=_0x2b25e8[_0x422f('0x3f')];var _0x20b97e=0xc8;var _0x3b307f=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x422f('0x4f')][_0x422f('0x50')][_0x422f('0x51')][_0x422f('0x52')]},function(_0x3b301c){return db[_0x422f('0x27')]['findOne']({'where':{'id':_0x172d0},'transaction':_0x3b301c})[_0x422f('0x23')](function(_0x483461){if(_0x483461){return db[_0x422f('0x27')][_0x422f('0x12')]({'where':{'VoiceExtensionId':_0x172d0},'transaction':_0x3b301c})[_0x422f('0x23')](function(){var _0x125ce5=_[_0x422f('0x1c')](_0x344f52,function(_0x59e696){_0x59e696[_0x422f('0x53')]=_0x172d0;_0x59e696[_0x422f('0x54')]=!![];return _0x59e696;});return _0x483461[_0x422f('0x55')](_0x125ce5);})['then'](function(_0x3c7402){return db[_0x422f('0x27')][_0x422f('0x56')](_0x3c7402,{'transaction':_0x3b301c});});}else{_0x20b97e=0x194;_0x3b307f=[];}});})[_0x422f('0x23')](function(){if(_0x20b97e!==0x194){return db[_0x422f('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x172d0},'order':_0x422f('0x57')})['then'](function(_0x4cef5d){_0x3b307f=_0x4cef5d;});}})[_0x422f('0x3a')](function(_0x1c79d0){_0x20b97e=0x1f4;logger[_0x422f('0x24')](_0x1c79d0[_0x422f('0x58')]);if(_0x1c79d0['name']){delete _0x1c79d0[_0x422f('0x21')];}_0x3b307f=_0x1c79d0;})[_0x422f('0x59')](function(){if(_0x3b307f===null){_0x4d117f[_0x422f('0x9')](_0x20b97e);}else{if(_0x20b97e===0x1f4){_0x4d117f[_0x422f('0xb')](_0x20b97e)[_0x422f('0x25')](_0x3b307f);}else{_0x4d117f[_0x422f('0xb')](_0x20b97e)[_0x422f('0x11')](_0x3b307f);}}});}; \ No newline at end of file +var _0xa97c=['nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','outbound','startsWith','exten','concat','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','offset','limit','undefined','count','status','set','Content-Range','json','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','destroy','error','send','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x405162,_0x55154b){var _0x5d188e=function(_0x285aaf){while(--_0x285aaf){_0x405162['push'](_0x405162['shift']());}};_0x5d188e(++_0x55154b);}(_0xa97c,0x7f));var _0xca97=function(_0x3d1c40,_0x470930){_0x3d1c40=_0x3d1c40-0x0;var _0x4625cb=_0xa97c[_0x3d1c40];return _0x4625cb;};'use strict';var _=require(_0xca97('0x0'));var Redis=require('ioredis');var qs=require(_0xca97('0x1'));var logger=require('../../config/logger')(_0xca97('0x2'));var config=require('../../config/environment');var db=require(_0xca97('0x3'))['db'];config[_0xca97('0x4')]=_[_0xca97('0x5')](config[_0xca97('0x4')],{'host':_0xca97('0x6'),'port':0x18eb});var socket=require(_0xca97('0x7'))(new Redis(config[_0xca97('0x4')]));require(_0xca97('0x8'))[_0xca97('0x9')](socket);function respondWithStatusCode(_0x683473,_0xf01812){_0xf01812=_0xf01812||0xcc;return function(_0x54098d){if(_0x54098d){return _0x683473[_0xca97('0xa')](_0xf01812);}return _0x683473['status'](_0xf01812)['end']();};}function respondWithResult(_0x5b6132,_0x2d58c9){_0x2d58c9=_0x2d58c9||0xc8;return function(_0x4c8d97){if(_0x4c8d97){return _0x5b6132['status'](_0x2d58c9)['json'](_0x4c8d97);}};}function respondWithFilteredResult(_0x148a36,_0x3961f9){return function(_0x2aa608){if(_0x2aa608){var _0x3e4389=typeof _0x3961f9[_0xca97('0xb')]==='undefined'&&typeof _0x3961f9[_0xca97('0xc')]===_0xca97('0xd');var _0x30c517=_0x2aa608[_0xca97('0xe')];var _0xa3b0ba=_0x3e4389?0x0:_0x3961f9['offset'];var _0x653ecc=_0x3e4389?_0x2aa608['count']:_0x3961f9['offset']+_0x3961f9['limit'];var _0x578739;if(_0x653ecc>=_0x30c517){_0x653ecc=_0x30c517;_0x578739=0xc8;}else{_0x578739=0xce;}_0x148a36[_0xca97('0xf')](_0x578739);return _0x148a36[_0xca97('0x10')](_0xca97('0x11'),_0xa3b0ba+'-'+_0x653ecc+'/'+_0x30c517)[_0xca97('0x12')](_0x2aa608);}return null;};}function removeEntity(_0x419ea2){return function(_0x2e87b2){if(_0x2e87b2){return _0x2e87b2['destroy']()[_0xca97('0x13')](function(){var _0x14ad55=_0x2e87b2[_0xca97('0x14')]({'plain':!![]});var _0x31a62d=[{'name':_0xca97('0x15'),'value':_0xca97('0x16'),'ignore':![]},{'name':_0xca97('0x17'),'value':'outbound','ignore':![]},{'name':_0xca97('0x18'),'value':_0xca97('0x19'),'ignore':![]}];var _0x2d68a1=_(_0x31a62d)[_0xca97('0x1a')](_0xca97('0x1b'))[_0xca97('0x1c')]('value')[_0xca97('0x1d')]();if(_[_0xca97('0x1e')](_0x2d68a1,_0x14ad55[_0xca97('0x1f')])){return;}var _0x1e5857=_[_0xca97('0x20')](_0x31a62d,[_0xca97('0x1d'),_0x14ad55['type']])[_0xca97('0x21')];return db['UserProfileResource'][_0xca97('0x22')]({'where':{'type':_0x1e5857,'resourceId':_0x14ad55['id']}})['then'](function(){return _0x2e87b2;});})[_0xca97('0x13')](function(){_0x419ea2[_0xca97('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x369509){return function(_0x44a6a0){if(!_0x44a6a0){_0x369509[_0xca97('0xa')](0x194);}return _0x44a6a0;};}function handleError(_0x3488ab,_0x166a18){_0x166a18=_0x166a18||0x1f4;return function(_0x6287fb){logger[_0xca97('0x23')](_0x6287fb['stack']);if(_0x6287fb[_0xca97('0x21')]){delete _0x6287fb[_0xca97('0x21')];}_0x3488ab[_0xca97('0xf')](_0x166a18)[_0xca97('0x24')](_0x6287fb);};}exports['index']=function(_0xb8ad71,_0x3047ab){var _0x468350={},_0x1e38cb={},_0x151a39={'count':0x0,'rows':[]};var _0x2cc2c5=_[_0xca97('0x1c')](db[_0xca97('0x25')][_0xca97('0x26')],function(_0x21f753){return{'name':_0x21f753[_0xca97('0x27')],'type':_0x21f753[_0xca97('0x1f')][_0xca97('0x28')]};});_0x1e38cb[_0xca97('0x29')]=_[_0xca97('0x1c')](_0x2cc2c5,_0xca97('0x21'));_0x1e38cb['query']=_[_0xca97('0x2a')](_0xb8ad71[_0xca97('0x2b')]);_0x1e38cb[_0xca97('0x2c')]=_[_0xca97('0x2d')](_0x1e38cb[_0xca97('0x29')],_0x1e38cb['query']);_0x468350[_0xca97('0x2e')]=_[_0xca97('0x2d')](_0x1e38cb[_0xca97('0x29')],qs[_0xca97('0x2f')](_0xb8ad71[_0xca97('0x2b')][_0xca97('0x2f')]));_0x468350[_0xca97('0x2e')]=_0x468350[_0xca97('0x2e')][_0xca97('0x30')]?_0x468350[_0xca97('0x2e')]:_0x1e38cb['model'];if(!_0xb8ad71['query']['hasOwnProperty'](_0xca97('0x31'))){_0x468350[_0xca97('0xc')]=qs[_0xca97('0xc')](_0xb8ad71[_0xca97('0x2b')][_0xca97('0xc')]);_0x468350[_0xca97('0xb')]=qs[_0xca97('0xb')](_0xb8ad71[_0xca97('0x2b')][_0xca97('0xb')]);}_0x468350['order']=qs[_0xca97('0x32')](_0xb8ad71['query'][_0xca97('0x32')]);_0x468350['where']=qs[_0xca97('0x2c')](_[_0xca97('0x33')](_0xb8ad71['query'],_0x1e38cb[_0xca97('0x2c')]),_0x2cc2c5);if(_0xb8ad71[_0xca97('0x2b')][_0xca97('0x1a')]){_0x468350[_0xca97('0x34')]=_[_0xca97('0x35')](_0x468350[_0xca97('0x34')],{'$or':_['map'](_0x2cc2c5,function(_0x2cd776){if(_0x2cd776[_0xca97('0x1f')]!==_0xca97('0x36')){var _0x89cd92={};_0x89cd92[_0x2cd776[_0xca97('0x21')]]={'$like':'%'+_0xb8ad71[_0xca97('0x2b')][_0xca97('0x1a')]+'%'};return _0x89cd92;}})});}_0x468350=_[_0xca97('0x35')]({},_0x468350,_0xb8ad71[_0xca97('0x37')]);var _0x57a127={'where':_0x468350[_0xca97('0x34')]};return db[_0xca97('0x25')]['count'](_0x57a127)['then'](function(_0x5849a4){_0x151a39[_0xca97('0xe')]=_0x5849a4;if(_0xb8ad71['query']['includeAll']){_0x468350[_0xca97('0x38')]=[{'all':!![]}];}return db[_0xca97('0x25')][_0xca97('0x39')](_0x468350);})[_0xca97('0x13')](function(_0x5518dc){_0x151a39[_0xca97('0x3a')]=_0x5518dc;return _0x151a39;})['then'](respondWithFilteredResult(_0x3047ab,_0x468350))[_0xca97('0x3b')](handleError(_0x3047ab,null));};exports[_0xca97('0x3c')]=function(_0x176cb5,_0x1a1c27){var _0x371c27={'raw':![],'where':{'id':_0x176cb5[_0xca97('0x3d')]['id']}},_0xe19c5={};_0xe19c5[_0xca97('0x29')]=_['keys'](db[_0xca97('0x25')][_0xca97('0x26')]);_0xe19c5[_0xca97('0x2b')]=_['keys'](_0x176cb5[_0xca97('0x2b')]);_0xe19c5['filters']=_[_0xca97('0x2d')](_0xe19c5[_0xca97('0x29')],_0xe19c5['query']);_0x371c27['attributes']=_[_0xca97('0x2d')](_0xe19c5[_0xca97('0x29')],qs['fields'](_0x176cb5[_0xca97('0x2b')][_0xca97('0x2f')]));_0x371c27['attributes']=_0x371c27[_0xca97('0x2e')][_0xca97('0x30')]?_0x371c27['attributes']:_0xe19c5[_0xca97('0x29')];if(_0x176cb5[_0xca97('0x2b')][_0xca97('0x3e')]){_0x371c27[_0xca97('0x38')]=[{'all':!![]}];}_0x371c27=_[_0xca97('0x35')]({},_0x371c27,_0x176cb5['options']);return db[_0xca97('0x25')][_0xca97('0x20')](_0x371c27)[_0xca97('0x13')](handleEntityNotFound(_0x1a1c27,null))[_0xca97('0x13')](respondWithResult(_0x1a1c27,null))['catch'](handleError(_0x1a1c27,null));};exports[_0xca97('0x22')]=function(_0x3d1f23,_0x3e8b94){return db[_0xca97('0x25')][_0xca97('0x20')]({'where':{'id':_0x3d1f23[_0xca97('0x3d')]['id']}})[_0xca97('0x13')](handleEntityNotFound(_0x3e8b94,null))[_0xca97('0x13')](removeEntity(_0x3e8b94,null))[_0xca97('0x3b')](handleError(_0x3e8b94,null));};exports[_0xca97('0x3f')]=function(_0x471afc,_0x51f329){if(_0x471afc[_0xca97('0x40')][_0xca97('0x1f')]===_0xca97('0x41')&&!_[_0xca97('0x42')](_0x471afc[_0xca97('0x40')][_0xca97('0x43')],'_')){_0x471afc[_0xca97('0x40')][_0xca97('0x43')]='_'[_0xca97('0x44')](_0x471afc[_0xca97('0x40')][_0xca97('0x43')]);}return db[_0xca97('0x25')]['create'](_0x471afc[_0xca97('0x40')],{'raw':![]})[_0xca97('0x13')](function(_0x4c26e3){var _0xcb1758=_0x471afc['user']['get']({'plain':!![]});if(!_0xcb1758)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcb1758['role']===_0xca97('0x45')){var _0x3b85d4=_0x4c26e3[_0xca97('0x14')]({'plain':!![]});var _0xe3e438=[{'name':_0xca97('0x15'),'value':'inbound'},{'name':_0xca97('0x17'),'value':'outbound'},{'name':_0xca97('0x18'),'value':_0xca97('0x19')}];var _0x1bef81=_[_0xca97('0x20')](_0xe3e438,[_0xca97('0x1d'),_0x3b85d4[_0xca97('0x1f')]])['name'];return db[_0xca97('0x46')][_0xca97('0x20')]({'where':{'name':_0x1bef81,'userProfileId':_0xcb1758['userProfileId']},'raw':!![]})[_0xca97('0x13')](function(_0x1a2ef2){if(_0x1a2ef2&&_0x1a2ef2[_0xca97('0x47')]===0x0){return db['UserProfileResource'][_0xca97('0x3f')]({'name':_0x3b85d4[_0xca97('0x21')],'resourceId':_0x3b85d4['id'],'type':_0x1a2ef2[_0xca97('0x21')],'sectionId':_0x1a2ef2['id']},{})[_0xca97('0x13')](function(){return _0x4c26e3;});}else{return _0x4c26e3;}})[_0xca97('0x3b')](function(_0x544b1f){logger[_0xca97('0x23')](_0xca97('0x48'),_0x544b1f);throw _0x544b1f;});}return _0x4c26e3;})[_0xca97('0x13')](respondWithResult(_0x51f329,0xc9))[_0xca97('0x3b')](handleError(_0x51f329,null));};exports['update']=function(_0x27bfa3,_0x6bb004){if(_0x27bfa3[_0xca97('0x40')]['id']){delete _0x27bfa3[_0xca97('0x40')]['id'];}return db[_0xca97('0x25')][_0xca97('0x20')]({'where':{'id':_0x27bfa3[_0xca97('0x3d')]['id']}})[_0xca97('0x13')](handleEntityNotFound(_0x6bb004,null))['then'](function(_0x29c143){if(_0x29c143){return db[_0xca97('0x25')]['update'](_[_0xca97('0x33')](_0x27bfa3[_0xca97('0x40')],[_0xca97('0x43'),_0xca97('0x49'),_0xca97('0x4a'),_0xca97('0x4b'),_0xca97('0x4c'),'mandatoryDisposition',_0xca97('0x4d')]),{'where':{'context':_0x29c143[_0xca97('0x49')],'exten':_0x29c143[_0xca97('0x43')]},'individualHooks':!![]})['then'](function(_0x594875){return _0x594875;});}return null;})[_0xca97('0x13')](respondWithStatusCode(_0x6bb004,null))[_0xca97('0x3b')](handleError(_0x6bb004,null));};exports['addApplications']=function(_0x537780,_0x12a800){var _0x5760cd=_0x537780[_0xca97('0x3d')]['id'];var _0x42daa9=_0x537780[_0xca97('0x40')];var _0x1667b6=0xc8;var _0x147c87=null;return db[_0xca97('0x4e')][_0xca97('0x4f')]({'isolationLevel':db['sequelize'][_0xca97('0x50')][_0xca97('0x51')]['READ_COMMITTED']},function(_0x4662f9){return db[_0xca97('0x25')][_0xca97('0x52')]({'where':{'id':_0x5760cd},'transaction':_0x4662f9})['then'](function(_0x5f0bbe){if(_0x5f0bbe){return db[_0xca97('0x25')][_0xca97('0x22')]({'where':{'VoiceExtensionId':_0x5760cd},'transaction':_0x4662f9})[_0xca97('0x13')](function(){var _0x10c2e7=_[_0xca97('0x1c')](_0x42daa9,function(_0x5e90d3){_0x5e90d3[_0xca97('0x53')]=_0x5760cd;_0x5e90d3[_0xca97('0x54')]=!![];return _0x5e90d3;});return _0x5f0bbe[_0xca97('0x55')](_0x10c2e7);})[_0xca97('0x13')](function(_0x4ee03d){return db[_0xca97('0x25')]['bulkCreate'](_0x4ee03d,{'transaction':_0x4662f9});});}else{_0x1667b6=0x194;_0x147c87=[];}});})[_0xca97('0x13')](function(){if(_0x1667b6!==0x194){return db[_0xca97('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5760cd},'order':_0xca97('0x56')})[_0xca97('0x13')](function(_0x213d32){_0x147c87=_0x213d32;});}})[_0xca97('0x3b')](function(_0x7c01a2){_0x1667b6=0x1f4;logger[_0xca97('0x23')](_0x7c01a2['stack']);if(_0x7c01a2['name']){delete _0x7c01a2[_0xca97('0x21')];}_0x147c87=_0x7c01a2;})[_0xca97('0x57')](function(){if(_0x147c87===null){_0x12a800[_0xca97('0xa')](_0x1667b6);}else{if(_0x1667b6===0x1f4){_0x12a800[_0xca97('0xf')](_0x1667b6)[_0xca97('0x24')](_0x147c87);}else{_0x12a800['status'](_0x1667b6)[_0xca97('0x12')](_0x147c87);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4f381bf..58ed389 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 _0xff11=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x3ba2a3,_0x34d0ba){var _0x2d0e38=function(_0x12ee87){while(--_0x12ee87){_0x3ba2a3['push'](_0x3ba2a3['shift']());}};_0x2d0e38(++_0x34d0ba);}(_0xff11,0x170));var _0x1ff1=function(_0x1d2d95,_0x5ed795){_0x1d2d95=_0x1d2d95-0x0;var _0x96d335=_0xff11[_0x1d2d95];return _0x96d335;};'use strict';var EventEmitter=require(_0x1ff1('0x0'));var VoiceExtension=require(_0x1ff1('0x1'))['db'][_0x1ff1('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ff1('0x3')](0x0);var events={'afterCreate':_0x1ff1('0x4'),'afterUpdate':_0x1ff1('0x5'),'afterDestroy':_0x1ff1('0x6')};function emitEvent(_0x18b5cf){return function(_0x1645a1,_0x3f09c5,_0x5c9670){VoiceExtensionEvents[_0x1ff1('0x7')](_0x18b5cf+':'+_0x1645a1['id'],_0x1645a1);VoiceExtensionEvents[_0x1ff1('0x7')](_0x18b5cf,_0x1645a1);_0x5c9670(null);};}for(var e in events){if(events[_0x1ff1('0x8')](e)){var event=events[e];VoiceExtension[_0x1ff1('0x9')](e,emitEvent(event));}}module[_0x1ff1('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb6ab=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0xddafcc,_0x5e601f){var _0x511cb1=function(_0x58d3ad){while(--_0x58d3ad){_0xddafcc['push'](_0xddafcc['shift']());}};_0x511cb1(++_0x5e601f);}(_0xb6ab,0x116));var _0xbb6a=function(_0x537230,_0x2705a1){_0x537230=_0x537230-0x0;var _0x198e68=_0xb6ab[_0x537230];return _0x198e68;};'use strict';var EventEmitter=require(_0xbb6a('0x0'));var VoiceExtension=require(_0xbb6a('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbb6a('0x2')](0x0);var events={'afterCreate':_0xbb6a('0x3'),'afterUpdate':_0xbb6a('0x4'),'afterDestroy':_0xbb6a('0x5')};function emitEvent(_0x1f02a4){return function(_0x1c375e,_0x340323,_0x2e5106){VoiceExtensionEvents[_0xbb6a('0x6')](_0x1f02a4+':'+_0x1c375e['id'],_0x1c375e);VoiceExtensionEvents[_0xbb6a('0x6')](_0x1f02a4,_0x1c375e);_0x2e5106(null);};}for(var e in events){if(events[_0xbb6a('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xbb6a('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 2dfc5b3..163cf49 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 _0x3dc1=['_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','phone','param','prefix','SIP','join','options','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','then','*,*,*,*','IntervalId','filter','toLowerCase','tag','ExecIf','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','intervals','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','exports','models','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','type','push','inbound','context','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x242eff,_0x1fd78f){var _0x3d84b0=function(_0x42fb16){while(--_0x42fb16){_0x242eff['push'](_0x242eff['shift']());}};_0x3d84b0(++_0x1fd78f);}(_0x3dc1,0x127));var _0x13dc=function(_0x1cda61,_0x49cd53){_0x1cda61=_0x1cda61-0x0;var _0x46ce10=_0x3dc1[_0x1cda61];return _0x46ce10;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x13dc('0x0')]=function(_0x59cf24){var _0x4c561b=_0x59cf24[_0x13dc('0x1')];function _0xe2fa33(_0x31d53f){var _0x162e91=0x2;var _0xc5d38f=[{'type':_0x31d53f['type'],'app':_0x13dc('0x2'),'appdata':_0x13dc('0x3')+_0x31d53f['type'],'context':_0x31d53f['context'],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']},{'type':_0x31d53f['type'],'app':_0x31d53f[_0x13dc('0x5')]?_0x13dc('0x2'):'NoOp','appdata':_0x31d53f[_0x13dc('0x5')]?_0x13dc('0x6')+_0x31d53f[_0x13dc('0x5')]:_0x13dc('0x7'),'context':_0x31d53f['context'],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']}];if(_0x31d53f[_0x13dc('0x8')]==='inbound'){_0xc5d38f[_0x13dc('0x9')]({'type':_0x13dc('0xa'),'app':_0x13dc('0x2'),'appdata':'CDR(routeid)='+_0x31d53f['id'],'context':_0x31d53f[_0x13dc('0xb')],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']});}_0xc5d38f['push']({'type':_0x31d53f[_0x13dc('0x8')],'app':'Set','appdata':_0x13dc('0xc'),'context':_0x31d53f[_0x13dc('0xb')],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']},{'type':_0x31d53f[_0x13dc('0x8')],'app':_0x13dc('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31d53f[_0x13dc('0xb')],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']},{'type':_0x31d53f[_0x13dc('0x8')],'app':_0x13dc('0x2'),'appdata':_0x13dc('0xd'),'context':_0x31d53f[_0x13dc('0xb')],'exten':_0x31d53f[_0x13dc('0x4')],'priority':_0x162e91++,'VoiceExtensionId':_0x31d53f['id']});return _0xc5d38f;}function _0x1d1e1e(_0x1e33f4){var _0xacfb1f=0x2;var _0x123645=[{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':'CDR(type)=outbound','context':_0x1e33f4['context'],'exten':_0x1e33f4['exten'],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x1e33f4['alias']?'Set':_0x13dc('0xf'),'appdata':_0x1e33f4['alias']?_0x13dc('0x6')+_0x1e33f4[_0x13dc('0x5')]:_0x13dc('0x7'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4['exten'],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0x10')+(_0x1e33f4[_0x13dc('0x11')]?_0x13dc('0x12')+_0x1e33f4[_0x13dc('0x11')]+'}':_0x13dc('0x13')),'context':_0x1e33f4['context'],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0x14')+_0x1e33f4['id'],'context':_0x1e33f4['context'],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':'ExecIf','appdata':_0x13dc('0x15')+(_0xacfb1f+0x2)+'):Goto('+(_0xacfb1f+0x1)+')','context':_0x1e33f4['context'],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x1e33f4[_0x13dc('0x11')]?_0x13dc('0x16')+_0x1e33f4[_0x13dc('0x11')]+'}':_0x13dc('0x17'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0xc'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':'outbound','app':_0x13dc('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1e33f4['context'],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0xd'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0x18')+_0x1e33f4['id'],'context':_0x1e33f4['context'],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']}];if(_0x1e33f4[_0x13dc('0x19')](_0x13dc('0x1a'))&&_0x1e33f4['recordingFormat']!==_0x13dc('0x1b')){_0x123645[_0x13dc('0x9')]({'type':_0x13dc('0xe'),'app':'Set','appdata':_0x13dc('0x1c'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4['exten'],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']},{'type':_0x13dc('0xe'),'app':_0x13dc('0x2'),'appdata':_0x13dc('0x1d')+_0x1e33f4[_0x13dc('0x1a')]||_0x13dc('0x1e'),'context':_0x1e33f4[_0x13dc('0xb')],'exten':_0x1e33f4[_0x13dc('0x4')],'priority':_0xacfb1f++,'VoiceExtensionId':_0x1e33f4['id']});}return _0x123645;}function _0x1356f7(_0x391ad7,_0x288892){var _0x25655c=[{'name':_0x13dc('0x1f'),'param':0x0},{'name':_0x13dc('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x13dc('0x21'),'param':0x3}];var _0x4bed4d={};var _0x2712f0=_0x288892[_0x13dc('0x22')](',');var _0x51b3de=[];for(var _0x2089a5=0x0;_0x2089a5<_0x25655c[_0x13dc('0x23')];_0x2089a5++){switch(_0x25655c[_0x2089a5][_0x13dc('0x24')]){case _0x13dc('0x1f'):_0x4bed4d[_0x13dc('0x1f')]=_0x2712f0[_0x25655c[_0x2089a5]['param']][_0x13dc('0x22')]('/')[0x1];_0x4bed4d[_0x13dc('0x25')]=_0x2712f0[_0x25655c[_0x2089a5][_0x13dc('0x26')]][_0x13dc('0x22')]('/')[0x2];_0x4bed4d[_0x13dc('0x27')]=_0x4bed4d[_0x13dc('0x25')]?_0x4bed4d[_0x13dc('0x25')]['split']('$')[0x0]:undefined;_0x4bed4d[_0x13dc('0x25')]=_0x391ad7[_0x13dc('0x11')]?(_0x4bed4d['prefix']||'')+_0x13dc('0x12')+_0x391ad7[_0x13dc('0x11')]+'}':(_0x4bed4d[_0x13dc('0x27')]||'')+_0x13dc('0x13');_0x51b3de[_0x25655c[_0x2089a5][_0x13dc('0x26')]]=[_0x13dc('0x28'),_0x4bed4d['trunk'],_0x4bed4d[_0x13dc('0x25')]][_0x13dc('0x29')]('/');break;case'options':_0x4bed4d[_0x13dc('0x2a')]=_0x2712f0[_0x25655c[_0x2089a5][_0x13dc('0x26')]];if(_0x391ad7[_0x13dc('0x1a')]!=='none'){if(_0x4bed4d[_0x13dc('0x2a')]['indexOf'](_0x13dc('0x2b'))<0x0){_0x4bed4d[_0x13dc('0x2a')]+='U(xcally-mixmonitor-context)';}}else{_0x4bed4d['options']=_0x4bed4d[_0x13dc('0x2a')]['replace'](_0x13dc('0x2b'),'');}_0x51b3de[_0x25655c[_0x2089a5][_0x13dc('0x26')]]=_0x4bed4d[_0x13dc('0x2a')];break;default:_0x51b3de[_0x25655c[_0x2089a5][_0x13dc('0x26')]]=_0x2712f0[_0x25655c[_0x2089a5][_0x13dc('0x26')]];}}return _0x51b3de[_0x13dc('0x29')](',');}function _0x832190(_0x2da63d,_0x5c6549,_0x1c80b5){return new Promise(function(_0x3d4ab9,_0x4f0ef8){var _0x2821fc=[];if(_[_0x13dc('0x2c')](_0x5c6549))return _0x3d4ab9(_0x2821fc);_0x4c561b[_0x13dc('0x2d')][_0x13dc('0x2e')]({'attributes':['id',_0x13dc('0x2f'),'IntervalId'],'raw':!![]})[_0x13dc('0x30')](function(_0x3af5ea){for(var _0x20efc0=0x0,_0x231eb8=0x0;_0x20efc0<_0x5c6549[_0x13dc('0x23')];_0x20efc0++,_0x231eb8=0x0){var _0x9b90b8=_0x5c6549[_0x20efc0];var _0x41d094=[];var _0x424ed1=[];delete _0x9b90b8['id'];if(_0x9b90b8[_0x13dc('0x2f')]!==_0x13dc('0x31')){_0x9b90b8['intervals']=[_0x9b90b8['interval']];}else{_0x9b90b8['intervals']=_0x9b90b8[_0x13dc('0x32')]?_['map'](_[_0x13dc('0x33')](_0x3af5ea,{'IntervalId':_0x9b90b8[_0x13dc('0x32')]}),'interval'):[];}_0x9b90b8['context']=_0x2da63d[_0x13dc('0xb')];_0x9b90b8[_0x13dc('0x4')]=_0x2da63d[_0x13dc('0x4')];if(_0x9b90b8[_0x13dc('0x8')])_0x9b90b8[_0x13dc('0x8')]=_0x9b90b8['type'][_0x13dc('0x34')]();if(_0x2da63d[_0x13dc('0x8')]===_0x13dc('0xe')){if(_0x9b90b8['hasOwnProperty'](_0x13dc('0x35'))&&_0x9b90b8[_0x13dc('0x35')]&&_0x9b90b8[_0x13dc('0x35')]!=='--'){_0x41d094[_0x13dc('0x9')]({'type':_0x9b90b8[_0x13dc('0x8')][_0x13dc('0x34')](),'app':'Set','appdata':'CDR(tag)='+_0x9b90b8['tag'],'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8['intervals']['length']+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});}_0x41d094[_0x13dc('0x9')]({'type':_0x9b90b8[_0x13dc('0x8')][_0x13dc('0x34')](),'app':_0x13dc('0x36'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x9b90b8[_0x13dc('0x37')]?'Set(CALLERID(all)='+_0x9b90b8[_0x13dc('0x37')]+')':_0x13dc('0x38')),'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8['intervals'][_0x13dc('0x23')]+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});}else{if(_0x9b90b8[_0x13dc('0x19')](_0x13dc('0x39'))){if([_0x13dc('0x3a'),_0x13dc('0x3b')][_0x13dc('0x3c')](_0x9b90b8[_0x13dc('0x3d')]['toLowerCase']())&&_0x9b90b8[_0x13dc('0x3e')]!=='custom'){if(_0x9b90b8[_0x13dc('0x39')]){_0x41d094[_0x13dc('0x9')]({'type':_0x9b90b8['type'][_0x13dc('0x34')](),'app':_0x13dc('0x36'),'appdata':_0x13dc('0x3f'),'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8[_0x13dc('0x40')][_0x13dc('0x23')]+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});_0x41d094['push']({'type':_0x9b90b8[_0x13dc('0x8')][_0x13dc('0x34')](),'app':'Set','appdata':_0x13dc('0x41'),'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8[_0x13dc('0x40')][_0x13dc('0x23')]+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});}else{_0x41d094[_0x13dc('0x9')]({'type':_0x9b90b8[_0x13dc('0x8')][_0x13dc('0x34')](),'app':_0x13dc('0x36'),'appdata':_0x13dc('0x42'),'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8['intervals'][_0x13dc('0x23')]+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});_0x41d094[_0x13dc('0x9')]({'type':_0x9b90b8[_0x13dc('0x8')][_0x13dc('0x34')](),'app':'Set','appdata':_0x13dc('0x43'),'context':_0x2da63d[_0x13dc('0xb')],'exten':_0x2da63d[_0x13dc('0x4')],'priority':_0x9b90b8['intervals'][_0x13dc('0x23')]+_0x1c80b5+_0x231eb8++,'VoiceExtensionId':_0x2da63d['id']});}}}}for(var _0x48e9b8=0x0;_0x48e9b8<_0x9b90b8[_0x13dc('0x40')][_0x13dc('0x23')];_0x48e9b8++){var _0x1658d1=_0x1c80b5+_0x9b90b8[_0x13dc('0x40')][_0x13dc('0x23')];var _0x4232e2=_0x48e9b8===_0x9b90b8[_0x13dc('0x40')]['length']-0x1?_0x1c80b5+_0x41d094[_0x13dc('0x23')]+_0x424ed1['length']+0x2:_0x1c80b5+_0x48e9b8+0x1;_0x41d094['splice'](_0x48e9b8,0x0,{'type':_0x2da63d[_0x13dc('0x8')],'app':_0x13dc('0x44'),'appdata':_0x9b90b8[_0x13dc('0x40')][_0x48e9b8]+'?'+_0x2da63d[_0x13dc('0xb')]+_0x13dc('0x45')+_0x1658d1+':'+_0x2da63d[_0x13dc('0xb')]+_0x13dc('0x45')+_0x4232e2,'exten':_0x2da63d['exten'],'context':_0x2da63d['context'],'priority':_0x1c80b5+_0x48e9b8,'VoiceExtensionId':_0x2da63d['id']});}if(_0x9b90b8[_0x13dc('0x3e')]===_0x13dc('0x46'))_0x9b90b8[_0x13dc('0x47')]=_0x1356f7(_0x2da63d,_0x9b90b8[_0x13dc('0x47')]);_0x9b90b8['priority']=_0x41d094[_0x13dc('0x23')]?_[_0x13dc('0x48')](_0x41d094)[_0x13dc('0x49')]+0x1:_0x1c80b5;_0x2821fc=_['concat'](_0x2821fc,_0x41d094,[_0x9b90b8],_0x424ed1);_0x1c80b5=_[_0x13dc('0x48')](_0x2821fc)['priority']+0x1;}return _0x3d4ab9(_0x2821fc);})[_0x13dc('0x4a')](function(_0x10f311){_0x4f0ef8(_0x10f311);});});}return _0x59cf24[_0x13dc('0x4b')](_0x13dc('0x4c'),attributes,{'tableName':_0x13dc('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2546e4){var _0x4afc6b=this[_0x13dc('0x4e')]({'plain':!![]});var _0x163c04=_0x4afc6b[_0x13dc('0x8')]===_0x13dc('0xe')?_0x1d1e1e(_0x4afc6b):_0xe2fa33(_0x4afc6b);return _0x832190(_0x4afc6b,_0x2546e4,_[_0x13dc('0x48')](_0x163c04)[_0x13dc('0x49')]+0x1)['then'](function(_0x7b0287){var _0x57c346=_[_0x13dc('0x4f')](_0x163c04,_0x7b0287);_0x57c346[_0x13dc('0x9')]({'type':_0x4afc6b['type'],'app':_0x13dc('0x50'),'exten':_0x4afc6b[_0x13dc('0x4')],'context':_0x4afc6b[_0x13dc('0xb')],'priority':_['last'](_0x57c346)['priority']+0x1,'VoiceExtensionId':_0x4afc6b['id']});return _0x57c346;});}}});}; \ No newline at end of file +var _0xa3e6=['NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','alias','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID'];(function(_0x156fca,_0x425278){var _0x3c848a=function(_0x4594e3){while(--_0x4594e3){_0x156fca['push'](_0x156fca['shift']());}};_0x3c848a(++_0x425278);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x24f735,_0xb18cc8){_0x24f735=_0x24f735-0x0;var _0x131020=_0xa3e6[_0x24f735];return _0x131020;};'use strict';var _=require(_0x6a3e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x6a3e('0x1')]=function(_0x479726){var _0x1dbcdb=_0x479726[_0x6a3e('0x2')];function _0x3e5620(_0x56e3f4){var _0xe03261=0x2;var _0x5e9a85=[{'type':_0x56e3f4[_0x6a3e('0x3')],'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x5')+_0x56e3f4[_0x6a3e('0x3')],'context':_0x56e3f4[_0x6a3e('0x6')],'exten':_0x56e3f4['exten'],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']},{'type':_0x56e3f4[_0x6a3e('0x3')],'app':_0x56e3f4[_0x6a3e('0x7')]?'Set':'NoOp','appdata':_0x56e3f4[_0x6a3e('0x7')]?'CDR(routeAlias)='+_0x56e3f4['alias']:_0x6a3e('0x8'),'context':_0x56e3f4['context'],'exten':_0x56e3f4[_0x6a3e('0x9')],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']}];if(_0x56e3f4['type']===_0x6a3e('0xa')){_0x5e9a85[_0x6a3e('0xb')]({'type':_0x6a3e('0xa'),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0xc')+_0x56e3f4['id'],'context':_0x56e3f4[_0x6a3e('0x6')],'exten':_0x56e3f4['exten'],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']});}_0x5e9a85[_0x6a3e('0xb')]({'type':_0x56e3f4[_0x6a3e('0x3')],'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0xd'),'context':_0x56e3f4[_0x6a3e('0x6')],'exten':_0x56e3f4[_0x6a3e('0x9')],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']},{'type':_0x56e3f4[_0x6a3e('0x3')],'app':'Set','appdata':_0x6a3e('0xe'),'context':_0x56e3f4[_0x6a3e('0x6')],'exten':_0x56e3f4[_0x6a3e('0x9')],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']},{'type':_0x56e3f4[_0x6a3e('0x3')],'app':'Set','appdata':_0x6a3e('0xf'),'context':_0x56e3f4[_0x6a3e('0x6')],'exten':_0x56e3f4['exten'],'priority':_0xe03261++,'VoiceExtensionId':_0x56e3f4['id']});return _0x5e9a85;}function _0x5d3d56(_0x50d348){var _0x58b221=0x2;var _0x48adf6=[{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x11'),'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x50d348[_0x6a3e('0x7')]?_0x6a3e('0x4'):'NoOp','appdata':_0x50d348[_0x6a3e('0x7')]?'CDR(routeAlias)='+_0x50d348[_0x6a3e('0x7')]:'No\x20alias\x20set','context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x4'),'appdata':'CDR(destination)='+(_0x50d348['cutdigits']?_0x6a3e('0x12')+_0x50d348[_0x6a3e('0x13')]+'}':_0x6a3e('0x14')),'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0xc')+_0x50d348['id'],'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x15'),'appdata':_0x6a3e('0x16')+(_0x58b221+0x2)+_0x6a3e('0x17')+(_0x58b221+0x1)+')','context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':'outbound','app':_0x6a3e('0x4'),'appdata':_0x50d348[_0x6a3e('0x13')]?_0x6a3e('0x18')+_0x50d348[_0x6a3e('0x13')]+'}':_0x6a3e('0x19'),'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0xd'),'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':'outbound','app':_0x6a3e('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':'outbound','app':_0x6a3e('0x4'),'appdata':_0x6a3e('0xf'),'context':_0x50d348['context'],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':_0x6a3e('0x10'),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x1a')+_0x50d348['id'],'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']}];if(_0x50d348['hasOwnProperty'](_0x6a3e('0x1b'))&&_0x50d348[_0x6a3e('0x1b')]!==_0x6a3e('0x1c')){_0x48adf6[_0x6a3e('0xb')]({'type':'outbound','app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x1d'),'context':_0x50d348['context'],'exten':_0x50d348['exten'],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']},{'type':'outbound','app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x1e')+_0x50d348[_0x6a3e('0x1b')]||_0x6a3e('0x1f'),'context':_0x50d348[_0x6a3e('0x6')],'exten':_0x50d348[_0x6a3e('0x9')],'priority':_0x58b221++,'VoiceExtensionId':_0x50d348['id']});}return _0x48adf6;}function _0x325160(_0x1e497c,_0x4044d0){var _0x377226=[{'name':_0x6a3e('0x20'),'param':0x0},{'name':_0x6a3e('0x21'),'param':0x1},{'name':_0x6a3e('0x22'),'param':0x2},{'name':_0x6a3e('0x23'),'param':0x3}];var _0x189ef8={};var _0x501d93=_0x4044d0[_0x6a3e('0x24')](',');var _0x38deb6=[];for(var _0xda602f=0x0;_0xda602f<_0x377226['length'];_0xda602f++){switch(_0x377226[_0xda602f][_0x6a3e('0x25')]){case _0x6a3e('0x20'):_0x189ef8['trunk']=_0x501d93[_0x377226[_0xda602f][_0x6a3e('0x26')]][_0x6a3e('0x24')]('/')[0x1];_0x189ef8[_0x6a3e('0x27')]=_0x501d93[_0x377226[_0xda602f]['param']][_0x6a3e('0x24')]('/')[0x2];_0x189ef8[_0x6a3e('0x28')]=_0x189ef8[_0x6a3e('0x27')]?_0x189ef8[_0x6a3e('0x27')][_0x6a3e('0x24')]('$')[0x0]:undefined;_0x189ef8[_0x6a3e('0x27')]=_0x1e497c['cutdigits']?(_0x189ef8[_0x6a3e('0x28')]||'')+'${EXTEN:'+_0x1e497c['cutdigits']+'}':(_0x189ef8['prefix']||'')+_0x6a3e('0x14');_0x38deb6[_0x377226[_0xda602f]['param']]=[_0x6a3e('0x29'),_0x189ef8[_0x6a3e('0x20')],_0x189ef8[_0x6a3e('0x27')]][_0x6a3e('0x2a')]('/');break;case _0x6a3e('0x22'):_0x189ef8[_0x6a3e('0x22')]=_0x501d93[_0x377226[_0xda602f]['param']];if(_0x1e497c['recordingFormat']!==_0x6a3e('0x1c')){if(_0x189ef8[_0x6a3e('0x22')][_0x6a3e('0x2b')](_0x6a3e('0x2c'))<0x0){_0x189ef8[_0x6a3e('0x22')]+='U(xcally-mixmonitor-context)';}}else{_0x189ef8[_0x6a3e('0x22')]=_0x189ef8[_0x6a3e('0x22')]['replace'](_0x6a3e('0x2c'),'');}_0x38deb6[_0x377226[_0xda602f][_0x6a3e('0x26')]]=_0x189ef8[_0x6a3e('0x22')];break;default:_0x38deb6[_0x377226[_0xda602f]['param']]=_0x501d93[_0x377226[_0xda602f][_0x6a3e('0x26')]];}}return _0x38deb6[_0x6a3e('0x2a')](',');}function _0xe63a0b(_0x2cd46b,_0x2a531e,_0x39e559){return new Promise(function(_0x5f49d6,_0x4206c1){var _0x249fbc=[];if(_[_0x6a3e('0x2d')](_0x2a531e))return _0x5f49d6(_0x249fbc);_0x1dbcdb['Interval'][_0x6a3e('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x6a3e('0x2f')](function(_0x2788a8){for(var _0x3da8d3=0x0,_0x590638=0x0;_0x3da8d3<_0x2a531e['length'];_0x3da8d3++,_0x590638=0x0){var _0x2ac42e=_0x2a531e[_0x3da8d3];var _0x1ec7ce=[];var _0x42ece3=[];delete _0x2ac42e['id'];if(_0x2ac42e[_0x6a3e('0x30')]!==_0x6a3e('0x31')){_0x2ac42e[_0x6a3e('0x32')]=[_0x2ac42e['interval']];}else{_0x2ac42e[_0x6a3e('0x32')]=_0x2ac42e[_0x6a3e('0x33')]?_[_0x6a3e('0x34')](_[_0x6a3e('0x35')](_0x2788a8,{'IntervalId':_0x2ac42e[_0x6a3e('0x33')]}),_0x6a3e('0x30')):[];}_0x2ac42e[_0x6a3e('0x6')]=_0x2cd46b[_0x6a3e('0x6')];_0x2ac42e[_0x6a3e('0x9')]=_0x2cd46b['exten'];if(_0x2ac42e[_0x6a3e('0x3')])_0x2ac42e[_0x6a3e('0x3')]=_0x2ac42e['type'][_0x6a3e('0x36')]();if(_0x2cd46b['type']===_0x6a3e('0x10')){if(_0x2ac42e[_0x6a3e('0x37')](_0x6a3e('0x38'))&&_0x2ac42e['tag']&&_0x2ac42e[_0x6a3e('0x38')]!=='--'){_0x1ec7ce[_0x6a3e('0xb')]({'type':_0x2ac42e['type']['toLowerCase'](),'app':'Set','appdata':_0x6a3e('0x39')+_0x2ac42e[_0x6a3e('0x38')],'context':_0x2cd46b[_0x6a3e('0x6')],'exten':_0x2cd46b[_0x6a3e('0x9')],'priority':_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')]+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});}_0x1ec7ce[_0x6a3e('0xb')]({'type':_0x2ac42e[_0x6a3e('0x3')][_0x6a3e('0x36')](),'app':_0x6a3e('0x15'),'appdata':_0x6a3e('0x3b')+(_0x2ac42e['callerID']?_0x6a3e('0x3c')+_0x2ac42e[_0x6a3e('0x3d')]+')':_0x6a3e('0x3e')),'context':_0x2cd46b[_0x6a3e('0x6')],'exten':_0x2cd46b[_0x6a3e('0x9')],'priority':_0x2ac42e['intervals'][_0x6a3e('0x3a')]+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});}else{if(_0x2ac42e['hasOwnProperty'](_0x6a3e('0x3f'))){if([_0x6a3e('0x40'),_0x6a3e('0x41')][_0x6a3e('0x42')](_0x2ac42e[_0x6a3e('0x43')]['toLowerCase']())&&_0x2ac42e['appType']!=='custom'){if(_0x2ac42e[_0x6a3e('0x3f')]){_0x1ec7ce[_0x6a3e('0xb')]({'type':_0x2ac42e[_0x6a3e('0x3')][_0x6a3e('0x36')](),'app':_0x6a3e('0x15'),'appdata':_0x6a3e('0x44'),'context':_0x2cd46b['context'],'exten':_0x2cd46b[_0x6a3e('0x9')],'priority':_0x2ac42e['intervals']['length']+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});_0x1ec7ce['push']({'type':_0x2ac42e[_0x6a3e('0x3')][_0x6a3e('0x36')](),'app':'Set','appdata':_0x6a3e('0x45'),'context':_0x2cd46b[_0x6a3e('0x6')],'exten':_0x2cd46b['exten'],'priority':_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')]+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});}else{_0x1ec7ce[_0x6a3e('0xb')]({'type':_0x2ac42e[_0x6a3e('0x3')][_0x6a3e('0x36')](),'app':'ExecIf','appdata':_0x6a3e('0x46'),'context':_0x2cd46b[_0x6a3e('0x6')],'exten':_0x2cd46b['exten'],'priority':_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')]+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});_0x1ec7ce[_0x6a3e('0xb')]({'type':_0x2ac42e[_0x6a3e('0x3')][_0x6a3e('0x36')](),'app':_0x6a3e('0x4'),'appdata':_0x6a3e('0x47'),'context':_0x2cd46b[_0x6a3e('0x6')],'exten':_0x2cd46b[_0x6a3e('0x9')],'priority':_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')]+_0x39e559+_0x590638++,'VoiceExtensionId':_0x2cd46b['id']});}}}}for(var _0x4ad790=0x0;_0x4ad790<_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')];_0x4ad790++){var _0x437a88=_0x39e559+_0x2ac42e['intervals'][_0x6a3e('0x3a')];var _0xfbc991=_0x4ad790===_0x2ac42e[_0x6a3e('0x32')][_0x6a3e('0x3a')]-0x1?_0x39e559+_0x1ec7ce['length']+_0x42ece3[_0x6a3e('0x3a')]+0x2:_0x39e559+_0x4ad790+0x1;_0x1ec7ce['splice'](_0x4ad790,0x0,{'type':_0x2cd46b[_0x6a3e('0x3')],'app':'GotoIfTime','appdata':_0x2ac42e[_0x6a3e('0x32')][_0x4ad790]+'?'+_0x2cd46b[_0x6a3e('0x6')]+_0x6a3e('0x48')+_0x437a88+':'+_0x2cd46b[_0x6a3e('0x6')]+_0x6a3e('0x48')+_0xfbc991,'exten':_0x2cd46b[_0x6a3e('0x9')],'context':_0x2cd46b[_0x6a3e('0x6')],'priority':_0x39e559+_0x4ad790,'VoiceExtensionId':_0x2cd46b['id']});}if(_0x2ac42e[_0x6a3e('0x49')]===_0x6a3e('0x4a'))_0x2ac42e['appdata']=_0x325160(_0x2cd46b,_0x2ac42e[_0x6a3e('0x4b')]);_0x2ac42e[_0x6a3e('0x4c')]=_0x1ec7ce[_0x6a3e('0x3a')]?_[_0x6a3e('0x4d')](_0x1ec7ce)[_0x6a3e('0x4c')]+0x1:_0x39e559;_0x249fbc=_[_0x6a3e('0x4e')](_0x249fbc,_0x1ec7ce,[_0x2ac42e],_0x42ece3);_0x39e559=_[_0x6a3e('0x4d')](_0x249fbc)[_0x6a3e('0x4c')]+0x1;}return _0x5f49d6(_0x249fbc);})[_0x6a3e('0x4f')](function(_0x40613d){_0x4206c1(_0x40613d);});});}return _0x479726[_0x6a3e('0x50')](_0x6a3e('0x51'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x24c444){var _0x40213e=this[_0x6a3e('0x52')]({'plain':!![]});var _0x5d11f9=_0x40213e[_0x6a3e('0x3')]==='outbound'?_0x5d3d56(_0x40213e):_0x3e5620(_0x40213e);return _0xe63a0b(_0x40213e,_0x24c444,_[_0x6a3e('0x4d')](_0x5d11f9)[_0x6a3e('0x4c')]+0x1)['then'](function(_0x461acb){var _0x2de66c=_['concat'](_0x5d11f9,_0x461acb);_0x2de66c[_0x6a3e('0xb')]({'type':_0x40213e[_0x6a3e('0x3')],'app':_0x6a3e('0x53'),'exten':_0x40213e[_0x6a3e('0x9')],'context':_0x40213e[_0x6a3e('0x6')],'priority':_['last'](_0x2de66c)[_0x6a3e('0x4c')]+0x1,'VoiceExtensionId':_0x40213e['id']});return _0x2de66c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 550d2ce..7836dd5 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 _0xd8fb=['result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x13896c,_0x419715){var _0x5e5ef8=function(_0x4c977d){while(--_0x4c977d){_0x13896c['push'](_0x13896c['shift']());}};_0x5e5ef8(++_0x419715);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1ff145,_0x15f16e){_0x1ff145=_0x1ff145-0x0;var _0x35b8b0=_0xd8fb[_0x1ff145];return _0x35b8b0;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});}exports[_0xbd8f('0x17')]=function(_0x4b5fac){var _0xd706bc=this;return new Promise(function(_0x7f46d4,_0xb47c8e){return db[_0xbd8f('0x18')][_0xbd8f('0x19')]({'raw':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1c')]||null:null,'attributes':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1d')]||null:null,'limit':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1e')]||null:null,'include':_0x4b5fac['options']?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1f')]?_[_0xbd8f('0x20')](_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1f')],function(_0x2257fd){return{'model':db[_0x2257fd[_0xbd8f('0x21')]],'as':_0x2257fd['as'],'attributes':_0x2257fd[_0xbd8f('0x1d')],'include':_0x2257fd['include']?_[_0xbd8f('0x20')](_0x2257fd[_0xbd8f('0x1f')],function(_0x5a3a8c){return{'model':db[_0x5a3a8c[_0xbd8f('0x21')]],'as':_0x5a3a8c['as'],'attributes':_0x5a3a8c['attributes'],'include':_0x5a3a8c[_0xbd8f('0x1f')]?_[_0xbd8f('0x20')](_0x5a3a8c[_0xbd8f('0x1f')],function(_0x202126){return{'model':db[_0x202126[_0xbd8f('0x21')]],'as':_0x202126['as'],'attributes':_0x202126[_0xbd8f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x166de7){logger[_0xbd8f('0xd')](_0xbd8f('0x17'),_0x4b5fac);logger[_0xbd8f('0xf')](_0xbd8f('0x17'),_0x4b5fac,JSON[_0xbd8f('0x12')](_0x166de7));_0x7f46d4(_0x166de7);})[_0xbd8f('0x22')](function(_0x479a0c){logger[_0xbd8f('0x13')](_0xbd8f('0x17'),_0x479a0c[_0xbd8f('0x15')],_0x4b5fac);_0xb47c8e(_0xd706bc[_0xbd8f('0x13')](0x1f4,_0x479a0c['message']));});});}; \ No newline at end of file +var _0x8098=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','moment','bluebird'];(function(_0x233f68,_0x54a9b1){var _0x34ee6a=function(_0x41cb31){while(--_0x41cb31){_0x233f68['push'](_0x233f68['shift']());}};_0x34ee6a(++_0x54a9b1);}(_0x8098,0x1ba));var _0x8809=function(_0x3542a3,_0x189b0c){_0x3542a3=_0x3542a3-0x0;var _0x2be7bf=_0x8098[_0x3542a3];return _0x2be7bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8809('0x0'));var BPromise=require(_0x8809('0x1'));var rs=require(_0x8809('0x2'));var fs=require('fs');var Redis=require(_0x8809('0x3'));var db=require(_0x8809('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8809('0x5'))(_0x8809('0x6'));var config=require(_0x8809('0x7'));var jayson=require(_0x8809('0x8'));var client=jayson['client'][_0x8809('0x9')]({'port':0x232a});config[_0x8809('0xa')]=_['defaults'](config[_0x8809('0xa')],{'host':_0x8809('0xb'),'port':0x18eb});var socket=require(_0x8809('0xc'))(new Redis(config[_0x8809('0xa')]));require(_0x8809('0xd'))[_0x8809('0xe')](socket);function respondWithRpcPromise(_0x2e2c3c,_0x2a2228,_0x25ed44){return new BPromise(function(_0x1d0338,_0xc10e30){return client[_0x8809('0xf')](_0x2e2c3c,_0x25ed44)[_0x8809('0x10')](function(_0x39bc6d){logger[_0x8809('0x11')](_0x8809('0x12'),_0x2a2228,'request\x20sent');logger[_0x8809('0x13')](_0x8809('0x14'),_0x2a2228,'request\x20sent',JSON[_0x8809('0x15')](_0x39bc6d));if(_0x39bc6d[_0x8809('0x16')]){if(_0x39bc6d['error']['code']===0x1f4){logger[_0x8809('0x16')](_0x8809('0x12'),_0x2a2228,_0x39bc6d[_0x8809('0x16')][_0x8809('0x17')]);return _0xc10e30(_0x39bc6d[_0x8809('0x16')][_0x8809('0x17')]);}logger[_0x8809('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x2a2228,_0x39bc6d[_0x8809('0x16')][_0x8809('0x17')]);return _0x1d0338(_0x39bc6d['error'][_0x8809('0x17')]);}else{logger[_0x8809('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x2a2228,_0x8809('0x18'));_0x1d0338(_0x39bc6d[_0x8809('0x19')][_0x8809('0x17')]);}})[_0x8809('0x1a')](function(_0x9f2f9d){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2a2228,_0x9f2f9d);_0xc10e30(_0x9f2f9d);});});}exports[_0x8809('0x1b')]=function(_0xc998a3){var _0x1afa53=this;return new Promise(function(_0x3f0f90,_0x2ff4a1){return db[_0x8809('0x1c')][_0x8809('0x1d')]({'raw':_0xc998a3[_0x8809('0x1e')]?_0xc998a3[_0x8809('0x1e')][_0x8809('0x1f')]===undefined?!![]:![]:!![],'where':_0xc998a3[_0x8809('0x1e')]?_0xc998a3[_0x8809('0x1e')][_0x8809('0x20')]||null:null,'attributes':_0xc998a3['options']?_0xc998a3['options'][_0x8809('0x21')]||null:null,'limit':_0xc998a3[_0x8809('0x1e')]?_0xc998a3['options']['limit']||null:null,'include':_0xc998a3['options']?_0xc998a3[_0x8809('0x1e')][_0x8809('0x22')]?_[_0x8809('0x23')](_0xc998a3[_0x8809('0x1e')][_0x8809('0x22')],function(_0x3d21fd){return{'model':db[_0x3d21fd[_0x8809('0x24')]],'as':_0x3d21fd['as'],'attributes':_0x3d21fd[_0x8809('0x21')],'include':_0x3d21fd[_0x8809('0x22')]?_[_0x8809('0x23')](_0x3d21fd[_0x8809('0x22')],function(_0xf45590){return{'model':db[_0xf45590['model']],'as':_0xf45590['as'],'attributes':_0xf45590[_0x8809('0x21')],'include':_0xf45590[_0x8809('0x22')]?_[_0x8809('0x23')](_0xf45590['include'],function(_0x13d74b){return{'model':db[_0x13d74b[_0x8809('0x24')]],'as':_0x13d74b['as'],'attributes':_0x13d74b[_0x8809('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8809('0x10')](function(_0xb9388f){logger['info'](_0x8809('0x1b'),_0xc998a3);logger['debug'](_0x8809('0x1b'),_0xc998a3,JSON[_0x8809('0x15')](_0xb9388f));_0x3f0f90(_0xb9388f);})['catch'](function(_0x2c505c){logger['error'](_0x8809('0x1b'),_0x2c505c[_0x8809('0x17')],_0xc998a3);_0x2ff4a1(_0x1afa53[_0x8809('0x16')](0x1f4,_0x2c505c[_0x8809('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 74a0641..477d851 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(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x814b,0x1a2));var _0xb814=function(_0x170eb7,_0x1ac59b){_0x170eb7=_0x170eb7-0x0;var _0x4dfeac=_0x814b[_0x170eb7];return _0x4dfeac;};'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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0xa52372,_0x5945cb){var _0x4f2672=function(_0x1f9f07){while(--_0x1f9f07){_0xa52372['push'](_0xa52372['shift']());}};_0x4f2672(++_0x5945cb);}(_0x5fab,0x177));var _0xb5fa=function(_0x245d02,_0x454cd7){_0x245d02=_0x245d02-0x0;var _0x3d7d1d=_0x5fab[_0x245d02];return _0x3d7d1d;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 302217e..446002a 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 _0x4fb4=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4fb4,0x190));var _0x44fb=function(_0xebe11c,_0x52ed14){_0xebe11c=_0xebe11c-0x0;var _0x59d6f4=_0x4fb4[_0xebe11c];return _0x59d6f4;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id/messages',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0x10')]);router[_0x44fb('0x11')](_0x44fb('0xc'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x12')]);router[_0x44fb('0x13')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0x14')]);module[_0x44fb('0x15')]=router; \ No newline at end of file +var _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x8ace[_0xb4788];return _0xd49d21;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 07f9f77..6adad9f 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 _0x5bcc=['\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5bcc,0x1ab));var _0xc5bc=function(_0xc71a58,_0x26173c){_0xc71a58=_0xc71a58-0x0;var _0x507c3a=_0x5bcc[_0xc71a58];return _0x507c3a;};'use strict';var Sequelize=require(_0xc5bc('0x0'));module[_0xc5bc('0x1')]={'customer_id':{'type':Sequelize[_0xc5bc('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xc5bc('0x3'),'unique':_0xc5bc('0x4')},'mailbox':{'type':Sequelize[_0xc5bc('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc5bc('0x4')},'password':{'type':Sequelize[_0xc5bc('0x2')]},'fullname':{'type':Sequelize[_0xc5bc('0x2')]},'email':{'type':Sequelize[_0xc5bc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3a55b7){this['setDataValue'](_0xc5bc('0x5'),typeof _0x3a55b7===_0xc5bc('0x6')&&_0x3a55b7[_0xc5bc('0x7')]()?_0x3a55b7['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xc5bc('0x8')},'attach':{'type':Sequelize[_0xc5bc('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':_0xc5bc('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xc5bc('0x2')]},'review':{'type':Sequelize[_0xc5bc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc5bc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc5bc('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc5bc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':_0xc5bc('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc5bc('0x9')](_0xc5bc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc5bc('0xa'),'no'),'defaultValue':_0xc5bc('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xc5bc('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc5bc('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc5bc('0xd')],'get':function(){return this[_0xc5bc('0xe')]('fullname')+_0xc5bc('0xf')+this[_0xc5bc('0xe')](_0xc5bc('0x10'));}}}; \ No newline at end of file +var _0x16db=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x12c929,_0x548db2){var _0xff3f81=function(_0x321ae0){while(--_0x321ae0){_0x12c929['push'](_0x12c929['shift']());}};_0xff3f81(++_0x548db2);}(_0x16db,0x1c9));var _0xb16d=function(_0x399895,_0x52e3e2){_0x399895=_0x399895-0x0;var _0xa8818e=_0x16db[_0x399895];return _0xa8818e;};'use strict';var Sequelize=require(_0xb16d('0x0'));module[_0xb16d('0x1')]={'customer_id':{'type':Sequelize[_0xb16d('0x2')]},'context':{'type':Sequelize[_0xb16d('0x2')],'defaultValue':_0xb16d('0x3'),'unique':_0xb16d('0x4')},'mailbox':{'type':Sequelize[_0xb16d('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb16d('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xb16d('0x2')]},'email':{'type':Sequelize[_0xb16d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4f2b8e){this[_0xb16d('0x5')](_0xb16d('0x6'),typeof _0x4f2b8e===_0xb16d('0x7')&&_0x4f2b8e[_0xb16d('0x8')]()?_0x4f2b8e[_0xb16d('0x8')]():null);}},'pager':{'type':Sequelize[_0xb16d('0x2')]},'tz':{'type':Sequelize[_0xb16d('0x2')],'defaultValue':_0xb16d('0x9')},'attach':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':_0xb16d('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':_0xb16d('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb16d('0x2')]},'callback':{'type':Sequelize[_0xb16d('0x2')]},'review':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb16d('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb16d('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb16d('0xa')]('yes','no'),'defaultValue':_0xb16d('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb16d('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb16d('0xa')](_0xb16d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb16d('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xb16d('0xd')},'emailsubject':{'type':Sequelize[_0xb16d('0x2')]},'emailbody':{'type':Sequelize[_0xb16d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb16d('0xe')],'get':function(){return this[_0xb16d('0xf')](_0xb16d('0x10'))+_0xb16d('0x11')+this[_0xb16d('0xf')](_0xb16d('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 267910a..af04e7f 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 _0xa902=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','findAll','rows','catch','show','include','find','create','role','UserProfileSection','error','body','params','getMessages','findOne','hasOwnProperty','sort','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x1c4f2a,_0x5c0349){var _0x1ea3e3=function(_0x717866){while(--_0x717866){_0x1c4f2a['push'](_0x1c4f2a['shift']());}};_0x1ea3e3(++_0x5c0349);}(_0xa902,0x8d));var _0x2a90=function(_0x3b2be9,_0x2c03ee){_0x3b2be9=_0x3b2be9-0x0;var _0x5ca212=_0xa902[_0x3b2be9];return _0x5ca212;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){var _0x10a6dd=_0x4ed9e6[_0x2a90('0x27')]({'plain':!![]});var _0x2a212c=_0x2a90('0x28');return db[_0x2a90('0x29')][_0x2a90('0x26')]({'where':{'type':_0x2a212c,'resourceId':_0x10a6dd['id']}})['then'](function(){return _0x4ed9e6;});})[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x40c61a,_0x8544e5){return function(_0x5208d8){if(!_0x5208d8){_0x40c61a['sendStatus'](0x194);}return _0x5208d8;};}function handleError(_0x293765,_0x4ed64a){_0x4ed64a=_0x4ed64a||0x1f4;return function(_0x53391e){logger['error'](_0x53391e[_0x2a90('0x2a')]);if(_0x53391e[_0x2a90('0x2b')]){delete _0x53391e['name'];}_0x293765['status'](_0x4ed64a)[_0x2a90('0x2c')](_0x53391e);};}exports['index']=function(_0x35570e,_0x6892e1){var _0x3b580f={},_0x27b6b6={},_0xf18d11={'count':0x0,'rows':[]};var _0x11586c=_[_0x2a90('0x2d')](db['VoiceMail'][_0x2a90('0x2e')],function(_0x22b1f3){return{'name':_0x22b1f3[_0x2a90('0x2f')],'type':_0x22b1f3['type'][_0x2a90('0x30')]};});_0x27b6b6[_0x2a90('0x31')]=_[_0x2a90('0x2d')](_0x11586c,_0x2a90('0x2b'));_0x27b6b6['query']=_[_0x2a90('0x32')](_0x35570e[_0x2a90('0x33')]);_0x27b6b6[_0x2a90('0x34')]=_[_0x2a90('0x35')](_0x27b6b6[_0x2a90('0x31')],_0x27b6b6[_0x2a90('0x33')]);_0x3b580f['attributes']=_[_0x2a90('0x35')](_0x27b6b6[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x35570e[_0x2a90('0x33')]['fields']));_0x3b580f[_0x2a90('0x37')]=_0x3b580f[_0x2a90('0x37')]['length']?_0x3b580f[_0x2a90('0x37')]:_0x27b6b6[_0x2a90('0x31')];if(!_0x35570e['query']['hasOwnProperty'](_0x2a90('0x38'))){_0x3b580f[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x35570e['query'][_0x2a90('0x1d')]);_0x3b580f['offset']=qs[_0x2a90('0x1b')](_0x35570e['query'][_0x2a90('0x1b')]);}_0x3b580f['order']=qs['sort'](_0x35570e[_0x2a90('0x33')]['sort']);_0x3b580f[_0x2a90('0x39')]=qs[_0x2a90('0x34')](_[_0x2a90('0x3a')](_0x35570e['query'],_0x27b6b6[_0x2a90('0x34')]),_0x11586c);if(_0x35570e[_0x2a90('0x33')][_0x2a90('0x3b')]){_0x3b580f['where']=_[_0x2a90('0x3c')](_0x3b580f[_0x2a90('0x39')],{'$or':_[_0x2a90('0x2d')](_0x11586c,function(_0x580667){if(_0x580667[_0x2a90('0x3d')]!==_0x2a90('0x3e')){var _0x504643={};_0x504643[_0x580667[_0x2a90('0x2b')]]={'$like':'%'+_0x35570e[_0x2a90('0x33')][_0x2a90('0x3b')]+'%'};return _0x504643;}})});}_0x3b580f=_[_0x2a90('0x3c')]({},_0x3b580f,_0x35570e[_0x2a90('0x3f')]);var _0x3f2685={'where':_0x3b580f[_0x2a90('0x39')]};return db[_0x2a90('0x40')][_0x2a90('0x1e')](_0x3f2685)[_0x2a90('0x25')](function(_0x45b41c){_0xf18d11[_0x2a90('0x1e')]=_0x45b41c;if(_0x35570e[_0x2a90('0x33')][_0x2a90('0x41')]){_0x3b580f['include']=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x42')](_0x3b580f);})['then'](function(_0x1045bb){_0xf18d11[_0x2a90('0x43')]=_0x1045bb;return _0xf18d11;})[_0x2a90('0x25')](respondWithFilteredResult(_0x6892e1,_0x3b580f))[_0x2a90('0x44')](handleError(_0x6892e1,null));};exports[_0x2a90('0x45')]=function(_0x54b290,_0x145925){var _0x5c6d21={'raw':!![],'where':{'id':_0x54b290['params']['id']}},_0x4566a6={};_0x4566a6[_0x2a90('0x31')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')][_0x2a90('0x2e')]);_0x4566a6[_0x2a90('0x33')]=_[_0x2a90('0x32')](_0x54b290[_0x2a90('0x33')]);_0x4566a6['filters']=_['intersection'](_0x4566a6[_0x2a90('0x31')],_0x4566a6[_0x2a90('0x33')]);_0x5c6d21[_0x2a90('0x37')]=_[_0x2a90('0x35')](_0x4566a6[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x54b290[_0x2a90('0x33')][_0x2a90('0x36')]));_0x5c6d21['attributes']=_0x5c6d21[_0x2a90('0x37')]['length']?_0x5c6d21[_0x2a90('0x37')]:_0x4566a6[_0x2a90('0x31')];if(_0x54b290['query'][_0x2a90('0x41')]){_0x5c6d21[_0x2a90('0x46')]=[{'all':!![]}];}_0x5c6d21=_[_0x2a90('0x3c')]({},_0x5c6d21,_0x54b290[_0x2a90('0x3f')]);return db[_0x2a90('0x40')][_0x2a90('0x47')](_0x5c6d21)[_0x2a90('0x25')](handleEntityNotFound(_0x145925,null))['then'](respondWithResult(_0x145925,null))['catch'](handleError(_0x145925,null));};exports[_0x2a90('0x48')]=function(_0x2611d0,_0x42c890){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x2611d0['body'],{})['then'](function(_0x10505c){var _0x386e75=_0x2611d0['user']['get']({'plain':!![]});if(!_0x386e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x386e75[_0x2a90('0x49')]==='user'){var _0x370da3=_0x10505c[_0x2a90('0x27')]({'plain':!![]});var _0x272d07=_0x2a90('0x28');return db[_0x2a90('0x4a')][_0x2a90('0x47')]({'where':{'name':_0x272d07,'userProfileId':_0x386e75['userProfileId']},'raw':!![]})[_0x2a90('0x25')](function(_0x46115e){if(_0x46115e&&_0x46115e['autoAssociation']===0x0){return db[_0x2a90('0x29')]['create']({'name':_0x370da3['name'],'resourceId':_0x370da3['id'],'type':_0x46115e[_0x2a90('0x2b')],'sectionId':_0x46115e['id']},{})[_0x2a90('0x25')](function(){return _0x10505c;});}else{return _0x10505c;}})['catch'](function(_0x4c0cb2){logger[_0x2a90('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c0cb2);throw _0x4c0cb2;});}return _0x10505c;})[_0x2a90('0x25')](respondWithResult(_0x42c890,0xc9))[_0x2a90('0x44')](handleError(_0x42c890,null));};exports['update']=function(_0x366429,_0x29bb7d){if(_0x366429[_0x2a90('0x4c')]['id']){delete _0x366429['body']['id'];}return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x366429['params']['id']}})['then'](handleEntityNotFound(_0x29bb7d,null))[_0x2a90('0x25')](saveUpdates(_0x366429[_0x2a90('0x4c')],null))['then'](respondWithResult(_0x29bb7d,null))[_0x2a90('0x44')](handleError(_0x29bb7d,null));};exports['destroy']=function(_0x1302b9,_0x5ab061){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x1302b9[_0x2a90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ab061,null))['then'](removeEntity(_0x5ab061,null))['catch'](handleError(_0x5ab061,null));};exports[_0x2a90('0x4e')]=function(_0x37adad,_0x3793e5,_0x469d3c){return db[_0x2a90('0x40')][_0x2a90('0x4f')]({'where':{'id':_0x37adad[_0x2a90('0x4d')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3793e5,null))[_0x2a90('0x25')](function(_0x4f4dc6){var _0x18bb86;var _0x2442e1={},_0xb816a8={};_0xb816a8['model']=_['keys'](db['VoiceMailMessage'][_0x2a90('0x2e')]);_0xb816a8[_0x2a90('0x33')]=_[_0x2a90('0x32')](_0x37adad[_0x2a90('0x33')]);_0xb816a8[_0x2a90('0x34')]=_[_0x2a90('0x35')](_0xb816a8[_0x2a90('0x31')],_0xb816a8[_0x2a90('0x33')]);_0x2442e1[_0x2a90('0x37')]=_[_0x2a90('0x35')](_0xb816a8[_0x2a90('0x31')],qs[_0x2a90('0x36')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x36')]));_0x2442e1[_0x2a90('0x37')]=_0x2442e1[_0x2a90('0x37')]['length']?_0x2442e1[_0x2a90('0x37')]:_0xb816a8['model'];if(!_0x37adad[_0x2a90('0x33')][_0x2a90('0x50')](_0x2a90('0x38'))){_0x2442e1[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x1d')]);_0x2442e1['offset']=qs[_0x2a90('0x1b')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x1b')]);}_0x2442e1['order']=qs[_0x2a90('0x51')](_0x37adad[_0x2a90('0x33')][_0x2a90('0x51')]);_0x2442e1[_0x2a90('0x39')]=qs['filters'](_[_0x2a90('0x3a')](_0x37adad['query'],_0xb816a8[_0x2a90('0x34')]));if(_0x37adad[_0x2a90('0x33')][_0x2a90('0x3b')]){_0x2442e1[_0x2a90('0x39')]=_[_0x2a90('0x3c')](_0x2442e1[_0x2a90('0x39')],{'$or':_['map'](_0x2442e1[_0x2a90('0x37')],function(_0x2347b6){var _0x120c17={};_0x120c17[_0x2347b6]={'$like':'%'+_0x37adad[_0x2a90('0x33')][_0x2a90('0x3b')]+'%'};return _0x120c17;})});}_0x2442e1[_0x2a90('0x39')]=_[_0x2a90('0x3c')](_0x2442e1[_0x2a90('0x39')],{'mailboxuser':_0x4f4dc6[_0x2a90('0x52')]});_0x2442e1=_['merge']({},_0x2442e1,_0x37adad[_0x2a90('0x3f')]);return db[_0x2a90('0x53')][_0x2a90('0x54')](_0x2442e1)['then'](respondWithFilteredResult(_0x3793e5,_0x2442e1));})[_0x2a90('0x44')](handleError(_0x3793e5,null));}; \ No newline at end of file +var _0xb58b=['destroy','then','get','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xb58b,0x1f1));var _0xbb58=function(_0x13ffd3,_0x2f810a){_0x13ffd3=_0x13ffd3-0x0;var _0x3fb49c=_0xb58b[_0x13ffd3];return _0x3fb49c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){var _0x2d111c=_0x287822[_0xbb58('0x27')]({'plain':!![]});var _0x2d556a=_0xbb58('0x28');return db['UserProfileResource'][_0xbb58('0x25')]({'where':{'type':_0x2d556a,'resourceId':_0x2d111c['id']}})[_0xbb58('0x26')](function(){return _0x287822;});})[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x521d0c,_0x3608dc){return function(_0x2ce7c3){if(!_0x2ce7c3){_0x521d0c[_0xbb58('0x18')](0x194);}return _0x2ce7c3;};}function handleError(_0x2d5b39,_0xf6687e){_0xf6687e=_0xf6687e||0x1f4;return function(_0x28b3a3){logger[_0xbb58('0x29')](_0x28b3a3[_0xbb58('0x2a')]);if(_0x28b3a3[_0xbb58('0x2b')]){delete _0x28b3a3['name'];}_0x2d5b39[_0xbb58('0x19')](_0xf6687e)[_0xbb58('0x2c')](_0x28b3a3);};}exports[_0xbb58('0x2d')]=function(_0x3c9cee,_0x3304b9){var _0x9d379f={},_0x1ba526={},_0x643e0e={'count':0x0,'rows':[]};var _0x3f8db3=_['map'](db[_0xbb58('0x2e')][_0xbb58('0x2f')],function(_0x3edc34){return{'name':_0x3edc34[_0xbb58('0x30')],'type':_0x3edc34[_0xbb58('0x31')][_0xbb58('0x32')]};});_0x1ba526[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x3f8db3,_0xbb58('0x2b'));_0x1ba526[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3c9cee[_0xbb58('0x35')]);_0x1ba526[_0xbb58('0x37')]=_['intersection'](_0x1ba526['model'],_0x1ba526['query']);_0x9d379f[_0xbb58('0x38')]=_[_0xbb58('0x39')](_0x1ba526[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3a')]));_0x9d379f[_0xbb58('0x38')]=_0x9d379f[_0xbb58('0x38')]['length']?_0x9d379f[_0xbb58('0x38')]:_0x1ba526[_0xbb58('0x33')];if(!_0x3c9cee['query'][_0xbb58('0x3b')]('nolimit')){_0x9d379f[_0xbb58('0x1e')]=qs['limit'](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1e')]);_0x9d379f['offset']=qs[_0xbb58('0x1c')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1c')]);}_0x9d379f[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3d')]);_0x9d379f[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3c9cee[_0xbb58('0x35')],_0x1ba526[_0xbb58('0x37')]),_0x3f8db3);if(_0x3c9cee['query']['filter']){_0x9d379f[_0xbb58('0x3e')]=_['merge'](_0x9d379f[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x3f8db3,function(_0x2ab2d8){if(_0x2ab2d8['type']!=='VIRTUAL'){var _0xc29171={};_0xc29171[_0x2ab2d8[_0xbb58('0x2b')]]={'$like':'%'+_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x40')]+'%'};return _0xc29171;}})});}_0x9d379f=_[_0xbb58('0x41')]({},_0x9d379f,_0x3c9cee[_0xbb58('0x42')]);var _0x5797e7={'where':_0x9d379f[_0xbb58('0x3e')]};return db[_0xbb58('0x2e')][_0xbb58('0x1d')](_0x5797e7)[_0xbb58('0x26')](function(_0x1185b3){_0x643e0e[_0xbb58('0x1d')]=_0x1185b3;if(_0x3c9cee['query'][_0xbb58('0x43')]){_0x9d379f['include']=[{'all':!![]}];}return db[_0xbb58('0x2e')][_0xbb58('0x44')](_0x9d379f);})[_0xbb58('0x26')](function(_0x45817f){_0x643e0e['rows']=_0x45817f;return _0x643e0e;})[_0xbb58('0x26')](respondWithFilteredResult(_0x3304b9,_0x9d379f))[_0xbb58('0x45')](handleError(_0x3304b9,null));};exports[_0xbb58('0x46')]=function(_0x3a732c,_0x5b95f7){var _0x2ecc1b={'raw':!![],'where':{'id':_0x3a732c[_0xbb58('0x47')]['id']}},_0x5250e0={};_0x5250e0[_0xbb58('0x33')]=_[_0xbb58('0x36')](db[_0xbb58('0x2e')][_0xbb58('0x2f')]);_0x5250e0[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3a732c[_0xbb58('0x35')]);_0x5250e0[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x5250e0[_0xbb58('0x33')],_0x5250e0[_0xbb58('0x35')]);_0x2ecc1b[_0xbb58('0x38')]=_['intersection'](_0x5250e0[_0xbb58('0x33')],qs['fields'](_0x3a732c['query'][_0xbb58('0x3a')]));_0x2ecc1b[_0xbb58('0x38')]=_0x2ecc1b[_0xbb58('0x38')][_0xbb58('0x48')]?_0x2ecc1b[_0xbb58('0x38')]:_0x5250e0[_0xbb58('0x33')];if(_0x3a732c[_0xbb58('0x35')][_0xbb58('0x43')]){_0x2ecc1b[_0xbb58('0x49')]=[{'all':!![]}];}_0x2ecc1b=_[_0xbb58('0x41')]({},_0x2ecc1b,_0x3a732c[_0xbb58('0x42')]);return db['VoiceMail'][_0xbb58('0x4a')](_0x2ecc1b)[_0xbb58('0x26')](handleEntityNotFound(_0x5b95f7,null))['then'](respondWithResult(_0x5b95f7,null))[_0xbb58('0x45')](handleError(_0x5b95f7,null));};exports[_0xbb58('0x4b')]=function(_0xf94897,_0xdb0ff7){return db['VoiceMail'][_0xbb58('0x4b')](_0xf94897['body'],{})[_0xbb58('0x26')](function(_0x336598){var _0x471917=_0xf94897['user'][_0xbb58('0x27')]({'plain':!![]});if(!_0x471917)throw new Error(_0xbb58('0x4c'));if(_0x471917['role']===_0xbb58('0x4d')){var _0x4ca201=_0x336598[_0xbb58('0x27')]({'plain':!![]});var _0x2d81e0=_0xbb58('0x28');return db[_0xbb58('0x4e')][_0xbb58('0x4a')]({'where':{'name':_0x2d81e0,'userProfileId':_0x471917[_0xbb58('0x4f')]},'raw':!![]})[_0xbb58('0x26')](function(_0x4cb975){if(_0x4cb975&&_0x4cb975[_0xbb58('0x50')]===0x0){return db[_0xbb58('0x51')]['create']({'name':_0x4ca201[_0xbb58('0x2b')],'resourceId':_0x4ca201['id'],'type':_0x4cb975[_0xbb58('0x2b')],'sectionId':_0x4cb975['id']},{})['then'](function(){return _0x336598;});}else{return _0x336598;}})[_0xbb58('0x45')](function(_0x44636b){logger[_0xbb58('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44636b);throw _0x44636b;});}return _0x336598;})[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,0xc9))[_0xbb58('0x45')](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x24')]=function(_0x592879,_0x537ed5){if(_0x592879['body']['id']){delete _0x592879[_0xbb58('0x52')]['id'];}return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x592879['params']['id']}})['then'](handleEntityNotFound(_0x537ed5,null))[_0xbb58('0x26')](saveUpdates(_0x592879[_0xbb58('0x52')],null))[_0xbb58('0x26')](respondWithResult(_0x537ed5,null))[_0xbb58('0x45')](handleError(_0x537ed5,null));};exports[_0xbb58('0x25')]=function(_0x5290be,_0x362b91){return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x5290be['params']['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x362b91,null))[_0xbb58('0x26')](removeEntity(_0x362b91,null))[_0xbb58('0x45')](handleError(_0x362b91,null));};exports[_0xbb58('0x53')]=function(_0x3f5add,_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x2e')][_0xbb58('0x54')]({'where':{'id':_0x3f5add[_0xbb58('0x47')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x5e7ae0,null))[_0xbb58('0x26')](function(_0x85278c){var _0x58ced2;var _0x55d5be={},_0x344b0d={};_0x344b0d['model']=_[_0xbb58('0x36')](db[_0xbb58('0x55')][_0xbb58('0x2f')]);_0x344b0d[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3f5add[_0xbb58('0x35')]);_0x344b0d[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x344b0d[_0xbb58('0x33')],_0x344b0d[_0xbb58('0x35')]);_0x55d5be[_0xbb58('0x38')]=_['intersection'](_0x344b0d[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3f5add[_0xbb58('0x35')]['fields']));_0x55d5be[_0xbb58('0x38')]=_0x55d5be['attributes'][_0xbb58('0x48')]?_0x55d5be[_0xbb58('0x38')]:_0x344b0d['model'];if(!_0x3f5add[_0xbb58('0x35')][_0xbb58('0x3b')](_0xbb58('0x56'))){_0x55d5be[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x3f5add['query']['limit']);_0x55d5be[_0xbb58('0x1c')]=qs[_0xbb58('0x1c')](_0x3f5add[_0xbb58('0x35')]['offset']);}_0x55d5be[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3f5add['query'][_0xbb58('0x3d')]);_0x55d5be[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3f5add[_0xbb58('0x35')],_0x344b0d[_0xbb58('0x37')]));if(_0x3f5add[_0xbb58('0x35')][_0xbb58('0x40')]){_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x55d5be[_0xbb58('0x38')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x3f5add['query'][_0xbb58('0x40')]+'%'};return _0x5e17fc;})});}_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'mailboxuser':_0x85278c[_0xbb58('0x57')]});_0x55d5be=_[_0xbb58('0x41')]({},_0x55d5be,_0x3f5add[_0xbb58('0x42')]);return db[_0xbb58('0x55')][_0xbb58('0x58')](_0x55d5be)[_0xbb58('0x26')](respondWithFilteredResult(_0x5e7ae0,_0x55d5be));})[_0xbb58('0x45')](handleError(_0x5e7ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 07aa4e9..96ed989 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 _0x34ea=['path','rimraf','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ea,0xbc));var _0xa34e=function(_0x2789d4,_0x23738e){_0x2789d4=_0x2789d4-0x0;var _0x5f147b=_0x34ea[_0x2789d4];return _0x5f147b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa34e('0x0'))(_0xa34e('0x1'));var moment=require(_0xa34e('0x2'));var BPromise=require('bluebird');var rp=require(_0xa34e('0x3'));var fs=require('fs');var path=require(_0xa34e('0x4'));var rimraf=require(_0xa34e('0x5'));var config=require('../../config/environment');var attributes=require(_0xa34e('0x6'));module['exports']=function(_0x1691ff,_0x681dee){return _0x1691ff['define'](_0xa34e('0x7'),attributes,{'tableName':_0xa34e('0x8'),'paranoid':![],'indexes':[{'name':_0xa34e('0x9'),'fields':[_0xa34e('0xa'),_0xa34e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x656e=['mailbox_context','context','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','VoiceMail'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x656e,0x86));var _0xe656=function(_0x5b5721,_0x1284b6){_0x5b5721=_0x5b5721-0x0;var _0x33e248=_0x656e[_0x5b5721];return _0x33e248;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe656('0x0'))(_0xe656('0x1'));var moment=require(_0xe656('0x2'));var BPromise=require(_0xe656('0x3'));var rp=require(_0xe656('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe656('0x5'));var config=require('../../config/environment');var attributes=require(_0xe656('0x6'));module[_0xe656('0x7')]=function(_0x4a61c1,_0x45aaa5){return _0x4a61c1['define'](_0xe656('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xe656('0x9'),'fields':['mailbox',_0xe656('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2a88dd4..fea9764 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 _0x9864=['../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../config/utils'];(function(_0x3c1c12,_0x5dff52){var _0x5463f8=function(_0x5239f0){while(--_0x5239f0){_0x3c1c12['push'](_0x3c1c12['shift']());}};_0x5463f8(++_0x5dff52);}(_0x9864,0xe3));var _0x4986=function(_0x67db9f,_0x444c80){_0x67db9f=_0x67db9f-0x0;var _0x2af20f=_0x9864[_0x67db9f];return _0x2af20f;};'use strict';var _=require(_0x4986('0x0'));var util=require(_0x4986('0x1'));var moment=require(_0x4986('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4986('0x3'));var logger=require(_0x4986('0x4'))(_0x4986('0x5'));var config=require(_0x4986('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4986('0x7')][_0x4986('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ae649,_0x2fbb5f,_0x346459){return new BPromise(function(_0x3de314,_0x3eac4b){return client['request'](_0x3ae649,_0x346459)[_0x4986('0x9')](function(_0x33013e){logger[_0x4986('0xa')](_0x4986('0xb'),_0x2fbb5f,_0x4986('0xc'));logger[_0x4986('0xd')](_0x4986('0xe'),_0x2fbb5f,_0x4986('0xc'),JSON[_0x4986('0xf')](_0x33013e));if(_0x33013e[_0x4986('0x10')]){if(_0x33013e[_0x4986('0x10')][_0x4986('0x11')]===0x1f4){logger[_0x4986('0x10')](_0x4986('0xb'),_0x2fbb5f,_0x33013e[_0x4986('0x10')][_0x4986('0x12')]);return _0x3eac4b(_0x33013e[_0x4986('0x10')][_0x4986('0x12')]);}logger[_0x4986('0x10')](_0x4986('0xb'),_0x2fbb5f,_0x33013e[_0x4986('0x10')][_0x4986('0x12')]);return _0x3de314(_0x33013e[_0x4986('0x10')][_0x4986('0x12')]);}else{logger[_0x4986('0xa')](_0x4986('0xb'),_0x2fbb5f,_0x4986('0xc'));_0x3de314(_0x33013e[_0x4986('0x13')][_0x4986('0x12')]);}})[_0x4986('0x14')](function(_0x1b0a27){logger[_0x4986('0x10')](_0x4986('0xb'),_0x2fbb5f,_0x1b0a27);_0x3eac4b(_0x1b0a27);});});} \ No newline at end of file +var _0x6907=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6907,0xa3));var _0x7690=function(_0x4eb146,_0x53a48b){_0x4eb146=_0x4eb146-0x0;var _0x1e5cc0=_0x6907[_0x4eb146];return _0x1e5cc0;};'use strict';var _=require('lodash');var util=require(_0x7690('0x0'));var moment=require(_0x7690('0x1'));var BPromise=require(_0x7690('0x2'));var rs=require(_0x7690('0x3'));var fs=require('fs');var Redis=require(_0x7690('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7690('0x5'))('rpc');var config=require(_0x7690('0x6'));var jayson=require(_0x7690('0x7'));var client=jayson[_0x7690('0x8')][_0x7690('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x275c49,_0x525923,_0x4fbb89){return new BPromise(function(_0x252656,_0x53d76c){return client[_0x7690('0xa')](_0x275c49,_0x4fbb89)[_0x7690('0xb')](function(_0x197252){logger[_0x7690('0xc')](_0x7690('0xd'),_0x525923,_0x7690('0xe'));logger[_0x7690('0xf')](_0x7690('0x10'),_0x525923,_0x7690('0xe'),JSON[_0x7690('0x11')](_0x197252));if(_0x197252['error']){if(_0x197252[_0x7690('0x12')]['code']===0x1f4){logger[_0x7690('0x12')](_0x7690('0xd'),_0x525923,_0x197252[_0x7690('0x12')][_0x7690('0x13')]);return _0x53d76c(_0x197252[_0x7690('0x12')][_0x7690('0x13')]);}logger[_0x7690('0x12')](_0x7690('0xd'),_0x525923,_0x197252[_0x7690('0x12')][_0x7690('0x13')]);return _0x252656(_0x197252[_0x7690('0x12')]['message']);}else{logger[_0x7690('0xc')](_0x7690('0xd'),_0x525923,_0x7690('0xe'));_0x252656(_0x197252[_0x7690('0x14')]['message']);}})['catch'](function(_0x4c94e0){logger['error'](_0x7690('0xd'),_0x525923,_0x4c94e0);_0x53d76c(_0x4c94e0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e013b29..b10113e 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 _0x0d0a=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0d0a,0xe5));var _0xa0d0=function(_0x1fcd21,_0x1a7d49){_0x1fcd21=_0x1fcd21-0x0;var _0x23c4cc=_0x0d0a[_0x1fcd21];return _0x23c4cc;};'use strict';var multer=require('multer');var util=require(_0xa0d0('0x0'));var path=require(_0xa0d0('0x1'));var timeout=require(_0xa0d0('0x2'));var express=require('express');var router=express[_0xa0d0('0x3')]();var fs_extra=require(_0xa0d0('0x4'));var auth=require(_0xa0d0('0x5'));var interaction=require(_0xa0d0('0x6'));var config=require(_0xa0d0('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xa0d0('0x8')]('/',auth[_0xa0d0('0x9')](),controller[_0xa0d0('0xa')]);router[_0xa0d0('0x8')](_0xa0d0('0xb'),auth[_0xa0d0('0x9')](),controller[_0xa0d0('0xc')]);router['get'](_0xa0d0('0xd'),auth[_0xa0d0('0x9')](),controller[_0xa0d0('0xe')]);router[_0xa0d0('0xf')]('/',auth[_0xa0d0('0x9')](),controller['create']);router[_0xa0d0('0x10')]('/:id',auth[_0xa0d0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa0d0('0x11')]);module[_0xa0d0('0x12')]=router; \ No newline at end of file +var _0xc8a6=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','post','create','/:id','update','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8a6,0x17d));var _0x6c8a=function(_0x125634,_0x1c9c8a){_0x125634=_0x125634-0x0;var _0x2716cd=_0xc8a6[_0x125634];return _0x2716cd;};'use strict';var multer=require(_0x6c8a('0x0'));var util=require('util');var path=require(_0x6c8a('0x1'));var timeout=require(_0x6c8a('0x2'));var express=require(_0x6c8a('0x3'));var router=express[_0x6c8a('0x4')]();var fs_extra=require(_0x6c8a('0x5'));var auth=require(_0x6c8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c8a('0x7'));var controller=require(_0x6c8a('0x8'));router[_0x6c8a('0x9')]('/',auth[_0x6c8a('0xa')](),controller[_0x6c8a('0xb')]);router[_0x6c8a('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6c8a('0x9')](_0x6c8a('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x6c8a('0xd')]('/',auth[_0x6c8a('0xa')](),controller[_0x6c8a('0xe')]);router['put'](_0x6c8a('0xf'),auth['isAuthenticated'](),controller[_0x6c8a('0x10')]);router['delete'](_0x6c8a('0xf'),auth['isAuthenticated'](),controller[_0x6c8a('0x11')]);module[_0x6c8a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 18dbc24..98afb3a 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 _0x32a5=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x32a5,0x132));var _0x532a=function(_0x10139d,_0x2b5ff5){_0x10139d=_0x10139d-0x0;var _0x5861e8=_0x32a5[_0x10139d];return _0x5861e8;};'use strict';var Sequelize=require(_0x532a('0x0'));module[_0x532a('0x1')]={'name':{'type':Sequelize[_0x532a('0x2')],'get':function(_0x353abb){return this[_0x532a('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x532a('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x532a('0x6')](_0x532a('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x532a('0x5')],'defaultValue':''},'stamp':{'type':_0x532a('0x8'),'defaultValue':Sequelize[_0x532a('0x9')](_0x532a('0xa'))}}; \ No newline at end of file +var _0x2bdd=['VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x29ff3b,_0x4c8718){var _0x1fab53=function(_0x4443c2){while(--_0x4443c2){_0x29ff3b['push'](_0x29ff3b['shift']());}};_0x1fab53(++_0x4c8718);}(_0x2bdd,0x1de));var _0xd2bd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2bdd[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xd2bd('0x0'));module[_0xd2bd('0x1')]={'name':{'type':Sequelize[_0xd2bd('0x2')],'get':function(_0x4b661f){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xd2bd('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xd2bd('0x5')](_0xd2bd('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd2bd('0x4')],'defaultValue':''},'stamp':{'type':_0xd2bd('0x7'),'defaultValue':Sequelize[_0xd2bd('0x8')](_0xd2bd('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3ea9028..bd2e0d2 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 _0x7d1a=['catch','create','body','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','keys','query','filters','intersection','attributes','model','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoiceMailMessage','include','findAll','rows','show','params','fields','includeAll'];(function(_0x316371,_0x3c225f){var _0x576f72=function(_0x109308){while(--_0x109308){_0x316371['push'](_0x316371['shift']());}};_0x576f72(++_0x3c225f);}(_0x7d1a,0x64));var _0xa7d1=function(_0x153ebf,_0x5c831f){_0x153ebf=_0x153ebf-0x0;var _0x4bc685=_0x7d1a[_0x153ebf];return _0x4bc685;};'use strict';var emlformat=require(_0xa7d1('0x0'));var rimraf=require(_0xa7d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7d1('0x2'));var rp=require(_0xa7d1('0x3'));var moment=require(_0xa7d1('0x4'));var BPromise=require(_0xa7d1('0x5'));var Mustache=require(_0xa7d1('0x6'));var util=require(_0xa7d1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa7d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7d1('0x9'));var _=require(_0xa7d1('0xa'));var squel=require(_0xa7d1('0xb'));var crypto=require(_0xa7d1('0xc'));var jsforce=require(_0xa7d1('0xd'));var deskjs=require(_0xa7d1('0xe'));var toCsv=require(_0xa7d1('0x8'));var querystring=require(_0xa7d1('0xf'));var Papa=require(_0xa7d1('0x10'));var Redis=require('ioredis');var authService=require(_0xa7d1('0x11'));var qs=require(_0xa7d1('0x12'));var as=require(_0xa7d1('0x13'));var hardwareService=require(_0xa7d1('0x14'));var logger=require(_0xa7d1('0x15'))(_0xa7d1('0x16'));var utils=require(_0xa7d1('0x17'));var config=require(_0xa7d1('0x18'));var licenseUtil=require(_0xa7d1('0x19'));var db=require(_0xa7d1('0x1a'))['db'];function respondWithStatusCode(_0x17026e,_0x55b3ac){_0x55b3ac=_0x55b3ac||0xcc;return function(_0xae1391){if(_0xae1391){return _0x17026e[_0xa7d1('0x1b')](_0x55b3ac);}return _0x17026e[_0xa7d1('0x1c')](_0x55b3ac)[_0xa7d1('0x1d')]();};}function respondWithResult(_0x43d3bd,_0x1516bf){_0x1516bf=_0x1516bf||0xc8;return function(_0x5cb733){if(_0x5cb733){return _0x43d3bd['status'](_0x1516bf)['json'](_0x5cb733);}};}function respondWithFilteredResult(_0x32bcf9,_0x34bc0e){return function(_0x19662f){if(_0x19662f){var _0x55d907=typeof _0x34bc0e[_0xa7d1('0x1e')]===_0xa7d1('0x1f')&&typeof _0x34bc0e[_0xa7d1('0x20')]==='undefined';var _0x246dc6=_0x19662f[_0xa7d1('0x21')];var _0x537077=_0x55d907?0x0:_0x34bc0e[_0xa7d1('0x1e')];var _0x445910=_0x55d907?_0x19662f[_0xa7d1('0x21')]:_0x34bc0e[_0xa7d1('0x1e')]+_0x34bc0e[_0xa7d1('0x20')];var _0x1885d1;if(_0x445910>=_0x246dc6){_0x445910=_0x246dc6;_0x1885d1=0xc8;}else{_0x1885d1=0xce;}_0x32bcf9[_0xa7d1('0x1c')](_0x1885d1);return _0x32bcf9[_0xa7d1('0x22')]('Content-Range',_0x537077+'-'+_0x445910+'/'+_0x246dc6)[_0xa7d1('0x23')](_0x19662f);}return null;};}function patchUpdates(_0x2bffea){return function(_0x4606ad){try{jsonpatch['apply'](_0x4606ad,_0x2bffea,!![]);}catch(_0x5e54f9){return BPromise[_0xa7d1('0x24')](_0x5e54f9);}return _0x4606ad[_0xa7d1('0x25')]();};}function saveUpdates(_0x3ed8e0,_0x2a50bf){return function(_0x26f47f){if(_0x26f47f){return _0x26f47f[_0xa7d1('0x26')](_0x3ed8e0)[_0xa7d1('0x27')](function(_0x2ea122){return _0x2ea122;});}return null;};}function removeEntity(_0x108c4d,_0x11eaed){return function(_0x3a9256){if(_0x3a9256){return _0x3a9256[_0xa7d1('0x28')]()[_0xa7d1('0x27')](function(){_0x108c4d[_0xa7d1('0x1c')](0xcc)[_0xa7d1('0x1d')]();});}};}function handleEntityNotFound(_0x5837ee,_0x1d0b77){return function(_0x28e588){if(!_0x28e588){_0x5837ee[_0xa7d1('0x1b')](0x194);}return _0x28e588;};}function handleError(_0x9e6543,_0x4af55d){_0x4af55d=_0x4af55d||0x1f4;return function(_0x1e63cd){logger[_0xa7d1('0x29')](_0x1e63cd[_0xa7d1('0x2a')]);if(_0x1e63cd['name']){delete _0x1e63cd[_0xa7d1('0x2b')];}_0x9e6543['status'](_0x4af55d)[_0xa7d1('0x2c')](_0x1e63cd);};}exports[_0xa7d1('0x2d')]=function(_0x2e8117,_0x4a01f4){var _0x7e4f64={},_0x32db59={},_0x5ddf00={'count':0x0,'rows':[]};var _0x95a1bc=_[_0xa7d1('0x2e')](db['VoiceMailMessage'][_0xa7d1('0x2f')],function(_0x577169){return{'name':_0x577169[_0xa7d1('0x30')],'type':_0x577169['type'][_0xa7d1('0x31')]};});_0x32db59['model']=_[_0xa7d1('0x32')](_[_0xa7d1('0x2e')](_0x95a1bc,_0xa7d1('0x2b')),['name']);_0x32db59['query']=_[_0xa7d1('0x33')](_0x2e8117[_0xa7d1('0x34')]);_0x32db59[_0xa7d1('0x35')]=_[_0xa7d1('0x36')](_0x32db59['model'],_0x32db59[_0xa7d1('0x34')]);_0x7e4f64[_0xa7d1('0x37')]=_['intersection'](_0x32db59[_0xa7d1('0x38')],qs['fields'](_0x2e8117['query']['fields']));_0x7e4f64[_0xa7d1('0x37')]=_0x7e4f64[_0xa7d1('0x37')][_0xa7d1('0x39')]?_0x7e4f64[_0xa7d1('0x37')]:_0x32db59[_0xa7d1('0x38')];if(!_0x2e8117['query'][_0xa7d1('0x3a')]('nolimit')){_0x7e4f64['limit']=qs[_0xa7d1('0x20')](_0x2e8117[_0xa7d1('0x34')]['limit']);_0x7e4f64[_0xa7d1('0x1e')]=qs[_0xa7d1('0x1e')](_0x2e8117[_0xa7d1('0x34')]['offset']);}_0x7e4f64[_0xa7d1('0x3b')]=qs['sort'](_0x2e8117[_0xa7d1('0x34')][_0xa7d1('0x3c')]);_0x7e4f64[_0xa7d1('0x3d')]=qs[_0xa7d1('0x35')](_[_0xa7d1('0x3e')](_0x2e8117[_0xa7d1('0x34')],_0x32db59[_0xa7d1('0x35')]),_0x95a1bc);if(_0x2e8117[_0xa7d1('0x34')][_0xa7d1('0x3f')]){_0x7e4f64[_0xa7d1('0x3d')]=_['merge'](_0x7e4f64[_0xa7d1('0x3d')],{'$or':_[_0xa7d1('0x2e')](_0x95a1bc,function(_0x6928a6){if(_0x6928a6[_0xa7d1('0x40')]!==_0xa7d1('0x41')){var _0x36fc85={};_0x36fc85[_0x6928a6[_0xa7d1('0x2b')]]={'$like':'%'+_0x2e8117[_0xa7d1('0x34')][_0xa7d1('0x3f')]+'%'};return _0x36fc85;}})});}_0x7e4f64=_[_0xa7d1('0x42')]({},_0x7e4f64,_0x2e8117[_0xa7d1('0x43')]);var _0x4deae5={'where':_0x7e4f64[_0xa7d1('0x3d')]};return db[_0xa7d1('0x44')][_0xa7d1('0x21')](_0x4deae5)['then'](function(_0x24751d){_0x5ddf00['count']=_0x24751d;if(_0x2e8117[_0xa7d1('0x34')]['includeAll']){_0x7e4f64[_0xa7d1('0x45')]=[{'all':!![]}];}return db[_0xa7d1('0x44')][_0xa7d1('0x46')](_0x7e4f64);})[_0xa7d1('0x27')](function(_0x3db451){_0x5ddf00[_0xa7d1('0x47')]=_0x3db451;return _0x5ddf00;})['then'](respondWithFilteredResult(_0x4a01f4,_0x7e4f64))['catch'](handleError(_0x4a01f4,null));};exports[_0xa7d1('0x48')]=function(_0x2c90fc,_0x25ad9e){var _0x22c443={'raw':!![],'where':{'id':_0x2c90fc[_0xa7d1('0x49')]['id']}},_0xf9babc={};_0xf9babc[_0xa7d1('0x38')]=_['keys'](db[_0xa7d1('0x44')][_0xa7d1('0x2f')]);_0xf9babc[_0xa7d1('0x34')]=_[_0xa7d1('0x33')](_0x2c90fc[_0xa7d1('0x34')]);_0xf9babc[_0xa7d1('0x35')]=_['intersection'](_0xf9babc[_0xa7d1('0x38')],_0xf9babc[_0xa7d1('0x34')]);_0x22c443['attributes']=_[_0xa7d1('0x36')](_0xf9babc[_0xa7d1('0x38')],qs[_0xa7d1('0x4a')](_0x2c90fc['query'][_0xa7d1('0x4a')]));_0x22c443[_0xa7d1('0x37')]=_0x22c443[_0xa7d1('0x37')][_0xa7d1('0x39')]?_0x22c443[_0xa7d1('0x37')]:_0xf9babc['model'];if(_0x2c90fc['query'][_0xa7d1('0x4b')]){_0x22c443[_0xa7d1('0x45')]=[{'all':!![]}];}_0x22c443=_['merge']({},_0x22c443,_0x2c90fc['options']);return db[_0xa7d1('0x44')]['find'](_0x22c443)[_0xa7d1('0x27')](handleEntityNotFound(_0x25ad9e,null))[_0xa7d1('0x27')](respondWithResult(_0x25ad9e,null))[_0xa7d1('0x4c')](handleError(_0x25ad9e,null));};exports[_0xa7d1('0x4d')]=function(_0x3d103c,_0x5880b7){return db[_0xa7d1('0x44')][_0xa7d1('0x4d')](_0x3d103c[_0xa7d1('0x4e')],{})[_0xa7d1('0x27')](respondWithResult(_0x5880b7,0xc9))[_0xa7d1('0x4c')](handleError(_0x5880b7,null));};exports['update']=function(_0x3a62b3,_0x4f64b4){if(_0x3a62b3[_0xa7d1('0x4e')]['id']){delete _0x3a62b3[_0xa7d1('0x4e')]['id'];}return db[_0xa7d1('0x44')][_0xa7d1('0x4f')]({'where':{'id':_0x3a62b3['params']['id']}})[_0xa7d1('0x27')](handleEntityNotFound(_0x4f64b4,null))[_0xa7d1('0x27')](saveUpdates(_0x3a62b3[_0xa7d1('0x4e')],null))[_0xa7d1('0x27')](respondWithResult(_0x4f64b4,null))['catch'](handleError(_0x4f64b4,null));};exports['destroy']=function(_0x66b94d,_0xadee4e){return db[_0xa7d1('0x44')]['find']({'where':{'id':_0x66b94d[_0xa7d1('0x49')]['id']}})[_0xa7d1('0x27')](handleEntityNotFound(_0xadee4e,null))[_0xa7d1('0x27')](removeEntity(_0xadee4e,null))[_0xa7d1('0x4c')](handleError(_0xadee4e,null));};exports['download']=function(_0x37a622,_0x4c426b,_0x244242){return db[_0xa7d1('0x44')][_0xa7d1('0x4f')]({'where':{'id':_0x37a622['params']['id']},'attributes':['id',_0xa7d1('0x50'),_0xa7d1('0x51')]})[_0xa7d1('0x27')](handleEntityNotFound(_0x4c426b,null))[_0xa7d1('0x27')](function(_0x68af45){if(_0x68af45){if(!_0x68af45[_0xa7d1('0x50')]){throw new db[(_0xa7d1('0x52'))][(_0xa7d1('0x53'))](_0xa7d1('0x54'));}var _0x1a5e41={'Content-Type':_0xa7d1('0x55'),'Content-Disposition':'attachment'};if(_0x68af45[_0xa7d1('0x51')]){_0x1a5e41[_0xa7d1('0x56')]='attachment;\x20filename=\x22'+_0x68af45[_0xa7d1('0x51')]+_0xa7d1('0x57');}_0x4c426b['set'](_0x1a5e41);return _0x4c426b[_0xa7d1('0x2c')](new Buffer(_0x68af45[_0xa7d1('0x50')]));}})[_0xa7d1('0x4c')](handleError(_0x4c426b,null));}; \ No newline at end of file +var _0x06d5=['moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','VoiceMailMessage','includeAll','include','rows','catch','show','params','create','body','update','find','download','recording','msg_id','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x06d5,0xf7));var _0x506d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x06d5[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x506d('0x0'));var rimraf=require(_0x506d('0x1'));var zipdir=require(_0x506d('0x2'));var jsonpatch=require(_0x506d('0x3'));var rp=require(_0x506d('0x4'));var moment=require(_0x506d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x506d('0x6'));var util=require('util');var path=require(_0x506d('0x7'));var sox=require(_0x506d('0x8'));var csv=require(_0x506d('0x9'));var ejs=require(_0x506d('0xa'));var fs=require('fs');var fs_extra=require(_0x506d('0xb'));var _=require(_0x506d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x506d('0x9'));var querystring=require(_0x506d('0xd'));var Papa=require('papaparse');var Redis=require(_0x506d('0xe'));var authService=require(_0x506d('0xf'));var qs=require(_0x506d('0x10'));var as=require(_0x506d('0x11'));var hardwareService=require(_0x506d('0x12'));var logger=require(_0x506d('0x13'))(_0x506d('0x14'));var utils=require('../../config/utils');var config=require(_0x506d('0x15'));var licenseUtil=require(_0x506d('0x16'));var db=require(_0x506d('0x17'))['db'];function respondWithStatusCode(_0x4609ba,_0x5b0e3a){_0x5b0e3a=_0x5b0e3a||0xcc;return function(_0x56d9db){if(_0x56d9db){return _0x4609ba[_0x506d('0x18')](_0x5b0e3a);}return _0x4609ba[_0x506d('0x19')](_0x5b0e3a)['end']();};}function respondWithResult(_0x2ee3cf,_0x30f60a){_0x30f60a=_0x30f60a||0xc8;return function(_0x1fb359){if(_0x1fb359){return _0x2ee3cf['status'](_0x30f60a)[_0x506d('0x1a')](_0x1fb359);}};}function respondWithFilteredResult(_0x110361,_0x5730a0){return function(_0xc7015e){if(_0xc7015e){var _0x3c19c3=typeof _0x5730a0[_0x506d('0x1b')]===_0x506d('0x1c')&&typeof _0x5730a0[_0x506d('0x1d')]===_0x506d('0x1c');var _0x36558b=_0xc7015e['count'];var _0x6b742=_0x3c19c3?0x0:_0x5730a0[_0x506d('0x1b')];var _0x52ab6f=_0x3c19c3?_0xc7015e[_0x506d('0x1e')]:_0x5730a0[_0x506d('0x1b')]+_0x5730a0['limit'];var _0x341667;if(_0x52ab6f>=_0x36558b){_0x52ab6f=_0x36558b;_0x341667=0xc8;}else{_0x341667=0xce;}_0x110361['status'](_0x341667);return _0x110361[_0x506d('0x1f')](_0x506d('0x20'),_0x6b742+'-'+_0x52ab6f+'/'+_0x36558b)[_0x506d('0x1a')](_0xc7015e);}return null;};}function patchUpdates(_0x31c62b){return function(_0x4be414){try{jsonpatch['apply'](_0x4be414,_0x31c62b,!![]);}catch(_0x2c31ff){return BPromise[_0x506d('0x21')](_0x2c31ff);}return _0x4be414[_0x506d('0x22')]();};}function saveUpdates(_0xe6ade8,_0x1ee657){return function(_0x3bdd4d){if(_0x3bdd4d){return _0x3bdd4d['update'](_0xe6ade8)[_0x506d('0x23')](function(_0x5a1d9a){return _0x5a1d9a;});}return null;};}function removeEntity(_0x13877d,_0x2789b1){return function(_0x130cbd){if(_0x130cbd){return _0x130cbd[_0x506d('0x24')]()['then'](function(){_0x13877d[_0x506d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc43ac,_0x3d667d){return function(_0x2e30cc){if(!_0x2e30cc){_0xfc43ac['sendStatus'](0x194);}return _0x2e30cc;};}function handleError(_0x1c1c84,_0x48ed1f){_0x48ed1f=_0x48ed1f||0x1f4;return function(_0xad98a){logger[_0x506d('0x25')](_0xad98a[_0x506d('0x26')]);if(_0xad98a[_0x506d('0x27')]){delete _0xad98a['name'];}_0x1c1c84[_0x506d('0x19')](_0x48ed1f)[_0x506d('0x28')](_0xad98a);};}exports[_0x506d('0x29')]=function(_0x20320d,_0x20b4be){var _0x1b0fe0={},_0x5d8be4={},_0x1c88bd={'count':0x0,'rows':[]};var _0x46bbbe=_['map'](db['VoiceMailMessage'][_0x506d('0x2a')],function(_0x16918d){return{'name':_0x16918d[_0x506d('0x2b')],'type':_0x16918d[_0x506d('0x2c')][_0x506d('0x2d')]};});_0x5d8be4['model']=_['differenceBy'](_['map'](_0x46bbbe,'name'),[_0x506d('0x27')]);_0x5d8be4[_0x506d('0x2e')]=_[_0x506d('0x2f')](_0x20320d[_0x506d('0x2e')]);_0x5d8be4[_0x506d('0x30')]=_[_0x506d('0x31')](_0x5d8be4[_0x506d('0x32')],_0x5d8be4['query']);_0x1b0fe0[_0x506d('0x33')]=_[_0x506d('0x31')](_0x5d8be4['model'],qs[_0x506d('0x34')](_0x20320d['query']['fields']));_0x1b0fe0[_0x506d('0x33')]=_0x1b0fe0[_0x506d('0x33')][_0x506d('0x35')]?_0x1b0fe0[_0x506d('0x33')]:_0x5d8be4['model'];if(!_0x20320d[_0x506d('0x2e')][_0x506d('0x36')](_0x506d('0x37'))){_0x1b0fe0['limit']=qs[_0x506d('0x1d')](_0x20320d[_0x506d('0x2e')][_0x506d('0x1d')]);_0x1b0fe0[_0x506d('0x1b')]=qs[_0x506d('0x1b')](_0x20320d['query']['offset']);}_0x1b0fe0[_0x506d('0x38')]=qs['sort'](_0x20320d['query'][_0x506d('0x39')]);_0x1b0fe0[_0x506d('0x3a')]=qs[_0x506d('0x30')](_[_0x506d('0x3b')](_0x20320d[_0x506d('0x2e')],_0x5d8be4[_0x506d('0x30')]),_0x46bbbe);if(_0x20320d[_0x506d('0x2e')][_0x506d('0x3c')]){_0x1b0fe0[_0x506d('0x3a')]=_[_0x506d('0x3d')](_0x1b0fe0['where'],{'$or':_[_0x506d('0x3e')](_0x46bbbe,function(_0x2feb0f){if(_0x2feb0f['type']!=='VIRTUAL'){var _0xdfac71={};_0xdfac71[_0x2feb0f[_0x506d('0x27')]]={'$like':'%'+_0x20320d[_0x506d('0x2e')][_0x506d('0x3c')]+'%'};return _0xdfac71;}})});}_0x1b0fe0=_[_0x506d('0x3d')]({},_0x1b0fe0,_0x20320d[_0x506d('0x3f')]);var _0x2baf56={'where':_0x1b0fe0['where']};return db[_0x506d('0x40')]['count'](_0x2baf56)[_0x506d('0x23')](function(_0x1e7d20){_0x1c88bd[_0x506d('0x1e')]=_0x1e7d20;if(_0x20320d[_0x506d('0x2e')][_0x506d('0x41')]){_0x1b0fe0[_0x506d('0x42')]=[{'all':!![]}];}return db[_0x506d('0x40')]['findAll'](_0x1b0fe0);})[_0x506d('0x23')](function(_0x2e9e4d){_0x1c88bd[_0x506d('0x43')]=_0x2e9e4d;return _0x1c88bd;})[_0x506d('0x23')](respondWithFilteredResult(_0x20b4be,_0x1b0fe0))[_0x506d('0x44')](handleError(_0x20b4be,null));};exports[_0x506d('0x45')]=function(_0x208737,_0x3469c4){var _0x250412={'raw':!![],'where':{'id':_0x208737[_0x506d('0x46')]['id']}},_0x351df4={};_0x351df4[_0x506d('0x32')]=_[_0x506d('0x2f')](db[_0x506d('0x40')][_0x506d('0x2a')]);_0x351df4['query']=_[_0x506d('0x2f')](_0x208737[_0x506d('0x2e')]);_0x351df4[_0x506d('0x30')]=_[_0x506d('0x31')](_0x351df4['model'],_0x351df4['query']);_0x250412[_0x506d('0x33')]=_[_0x506d('0x31')](_0x351df4[_0x506d('0x32')],qs[_0x506d('0x34')](_0x208737[_0x506d('0x2e')][_0x506d('0x34')]));_0x250412[_0x506d('0x33')]=_0x250412[_0x506d('0x33')][_0x506d('0x35')]?_0x250412[_0x506d('0x33')]:_0x351df4[_0x506d('0x32')];if(_0x208737['query']['includeAll']){_0x250412[_0x506d('0x42')]=[{'all':!![]}];}_0x250412=_[_0x506d('0x3d')]({},_0x250412,_0x208737[_0x506d('0x3f')]);return db[_0x506d('0x40')]['find'](_0x250412)[_0x506d('0x23')](handleEntityNotFound(_0x3469c4,null))[_0x506d('0x23')](respondWithResult(_0x3469c4,null))['catch'](handleError(_0x3469c4,null));};exports[_0x506d('0x47')]=function(_0x5e92e0,_0x562b5e){return db[_0x506d('0x40')][_0x506d('0x47')](_0x5e92e0[_0x506d('0x48')],{})['then'](respondWithResult(_0x562b5e,0xc9))['catch'](handleError(_0x562b5e,null));};exports[_0x506d('0x49')]=function(_0x48a28e,_0x59733f){if(_0x48a28e[_0x506d('0x48')]['id']){delete _0x48a28e[_0x506d('0x48')]['id'];}return db[_0x506d('0x40')][_0x506d('0x4a')]({'where':{'id':_0x48a28e[_0x506d('0x46')]['id']}})[_0x506d('0x23')](handleEntityNotFound(_0x59733f,null))['then'](saveUpdates(_0x48a28e[_0x506d('0x48')],null))[_0x506d('0x23')](respondWithResult(_0x59733f,null))[_0x506d('0x44')](handleError(_0x59733f,null));};exports[_0x506d('0x24')]=function(_0x26c9b4,_0x264d52){return db[_0x506d('0x40')][_0x506d('0x4a')]({'where':{'id':_0x26c9b4[_0x506d('0x46')]['id']}})[_0x506d('0x23')](handleEntityNotFound(_0x264d52,null))[_0x506d('0x23')](removeEntity(_0x264d52,null))[_0x506d('0x44')](handleError(_0x264d52,null));};exports[_0x506d('0x4b')]=function(_0x2c8d6c,_0x42b774,_0x46fb60){return db[_0x506d('0x40')][_0x506d('0x4a')]({'where':{'id':_0x2c8d6c[_0x506d('0x46')]['id']},'attributes':['id',_0x506d('0x4c'),_0x506d('0x4d')]})[_0x506d('0x23')](handleEntityNotFound(_0x42b774,null))[_0x506d('0x23')](function(_0x3aec4f){if(_0x3aec4f){if(!_0x3aec4f[_0x506d('0x4c')]){throw new db[(_0x506d('0x4e'))][(_0x506d('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x3ad5d8={'Content-Type':_0x506d('0x50'),'Content-Disposition':'attachment'};if(_0x3aec4f[_0x506d('0x4d')]){_0x3ad5d8[_0x506d('0x51')]=_0x506d('0x52')+_0x3aec4f[_0x506d('0x4d')]+_0x506d('0x53');}_0x42b774[_0x506d('0x1f')](_0x3ad5d8);return _0x42b774[_0x506d('0x28')](new Buffer(_0x3aec4f[_0x506d('0x4c')]));}})[_0x506d('0x44')](handleError(_0x42b774,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3b152d7..a170c54 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 _0x1e8b=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','moment'];(function(_0x5c1982,_0x4086d4){var _0x176416=function(_0x166eaf){while(--_0x166eaf){_0x5c1982['push'](_0x5c1982['shift']());}};_0x176416(++_0x4086d4);}(_0x1e8b,0x15c));var _0xb1e8=function(_0x33f153,_0x39d65d){_0x33f153=_0x33f153-0x0;var _0x12ac15=_0x1e8b[_0x33f153];return _0x12ac15;};'use strict';var _=require(_0xb1e8('0x0'));var util=require('util');var logger=require(_0xb1e8('0x1'))('api');var moment=require(_0xb1e8('0x2'));var BPromise=require(_0xb1e8('0x3'));var rp=require(_0xb1e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1e8('0x5'));var config=require(_0xb1e8('0x6'));var attributes=require(_0xb1e8('0x7'));module[_0xb1e8('0x8')]=function(_0xca8595,_0x38cf94){return _0xca8595[_0xb1e8('0x9')](_0xb1e8('0xa'),attributes,{'tableName':_0xb1e8('0xb'),'paranoid':![],'indexes':[{'name':_0xb1e8('0xc'),'fields':[_0xb1e8('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7034=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5be6dc,_0x21c817){var _0x2fdd58=function(_0x2bb8cb){while(--_0x2bb8cb){_0x5be6dc['push'](_0x5be6dc['shift']());}};_0x2fdd58(++_0x21c817);}(_0x7034,0x1c6));var _0x4703=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7034[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x4703('0x0'));var util=require(_0x4703('0x1'));var logger=require('../../config/logger')(_0x4703('0x2'));var moment=require('moment');var BPromise=require(_0x4703('0x3'));var rp=require(_0x4703('0x4'));var fs=require('fs');var path=require(_0x4703('0x5'));var rimraf=require(_0x4703('0x6'));var config=require(_0x4703('0x7'));var attributes=require(_0x4703('0x8'));module[_0x4703('0x9')]=function(_0x1889e0,_0x2bbff6){return _0x1889e0[_0x4703('0xa')](_0x4703('0xb'),attributes,{'tableName':_0x4703('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x4703('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c0e206b..164b7b7 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 _0xfe59=['client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x436c16,_0x54fd1e){var _0x1ad75b=function(_0x8aed4b){while(--_0x8aed4b){_0x436c16['push'](_0x436c16['shift']());}};_0x1ad75b(++_0x54fd1e);}(_0xfe59,0x16b));var _0x9fe5=function(_0xc37284,_0x36e7ef){_0xc37284=_0xc37284-0x0;var _0x19b5bf=_0xfe59[_0xc37284];return _0x19b5bf;};'use strict';var _=require('lodash');var util=require(_0x9fe5('0x0'));var moment=require(_0x9fe5('0x1'));var BPromise=require(_0x9fe5('0x2'));var rs=require(_0x9fe5('0x3'));var fs=require('fs');var Redis=require(_0x9fe5('0x4'));var db=require(_0x9fe5('0x5'))['db'];var utils=require(_0x9fe5('0x6'));var logger=require(_0x9fe5('0x7'))(_0x9fe5('0x8'));var config=require(_0x9fe5('0x9'));var jayson=require(_0x9fe5('0xa'));var client=jayson[_0x9fe5('0xb')][_0x9fe5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e9cee,_0x329252,_0x56ad25){return new BPromise(function(_0x5268e9,_0x2745de){return client[_0x9fe5('0xd')](_0x2e9cee,_0x56ad25)[_0x9fe5('0xe')](function(_0x5abc76){logger['info'](_0x9fe5('0xf'),_0x329252,_0x9fe5('0x10'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x329252,'request\x20sent',JSON['stringify'](_0x5abc76));if(_0x5abc76[_0x9fe5('0x11')]){if(_0x5abc76[_0x9fe5('0x11')]['code']===0x1f4){logger['error'](_0x9fe5('0xf'),_0x329252,_0x5abc76['error'][_0x9fe5('0x12')]);return _0x2745de(_0x5abc76[_0x9fe5('0x11')][_0x9fe5('0x12')]);}logger['error'](_0x9fe5('0xf'),_0x329252,_0x5abc76[_0x9fe5('0x11')][_0x9fe5('0x12')]);return _0x5268e9(_0x5abc76['error'][_0x9fe5('0x12')]);}else{logger[_0x9fe5('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x329252,_0x9fe5('0x10'));_0x5268e9(_0x5abc76[_0x9fe5('0x14')][_0x9fe5('0x12')]);}})[_0x9fe5('0x15')](function(_0x1b672f){logger[_0x9fe5('0x11')](_0x9fe5('0xf'),_0x329252,_0x1b672f);_0x2745de(_0x1b672f);});});} \ No newline at end of file +var _0x38af=['http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x55f9af,_0xfd306d){var _0x286fad=function(_0x2122c6){while(--_0x2122c6){_0x55f9af['push'](_0x55f9af['shift']());}};_0x286fad(++_0xfd306d);}(_0x38af,0xbd));var _0xf38a=function(_0x12eb45,_0x4049a0){_0x12eb45=_0x12eb45-0x0;var _0x2dd665=_0x38af[_0x12eb45];return _0x2dd665;};'use strict';var _=require('lodash');var util=require(_0xf38a('0x0'));var moment=require('moment');var BPromise=require(_0xf38a('0x1'));var rs=require(_0xf38a('0x2'));var fs=require('fs');var Redis=require(_0xf38a('0x3'));var db=require(_0xf38a('0x4'))['db'];var utils=require(_0xf38a('0x5'));var logger=require(_0xf38a('0x6'))(_0xf38a('0x7'));var config=require(_0xf38a('0x8'));var jayson=require(_0xf38a('0x9'));var client=jayson[_0xf38a('0xa')][_0xf38a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x117095,_0xc4e8fd,_0x3bdba4){return new BPromise(function(_0x2cff41,_0x364095){return client[_0xf38a('0xc')](_0x117095,_0x3bdba4)[_0xf38a('0xd')](function(_0x513b6f){logger[_0xf38a('0xe')](_0xf38a('0xf'),_0xc4e8fd,_0xf38a('0x10'));logger[_0xf38a('0x11')](_0xf38a('0x12'),_0xc4e8fd,'request\x20sent',JSON[_0xf38a('0x13')](_0x513b6f));if(_0x513b6f[_0xf38a('0x14')]){if(_0x513b6f[_0xf38a('0x14')][_0xf38a('0x15')]===0x1f4){logger['error'](_0xf38a('0xf'),_0xc4e8fd,_0x513b6f[_0xf38a('0x14')][_0xf38a('0x16')]);return _0x364095(_0x513b6f[_0xf38a('0x14')][_0xf38a('0x16')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xc4e8fd,_0x513b6f[_0xf38a('0x14')][_0xf38a('0x16')]);return _0x2cff41(_0x513b6f[_0xf38a('0x14')]['message']);}else{logger[_0xf38a('0xe')](_0xf38a('0xf'),_0xc4e8fd,_0xf38a('0x10'));_0x2cff41(_0x513b6f[_0xf38a('0x17')][_0xf38a('0x16')]);}})[_0xf38a('0x18')](function(_0x3443a5){logger[_0xf38a('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0xc4e8fd,_0x3443a5);_0x364095(_0x3443a5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b3ff528..306df0c 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 _0xe8c5=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','create','addSound','update'];(function(_0x46fb49,_0x36aebc){var _0x6eb06f=function(_0x51f8b9){while(--_0x51f8b9){_0x46fb49['push'](_0x46fb49['shift']());}};_0x6eb06f(++_0x36aebc);}(_0xe8c5,0x17c));var _0x5e8c=function(_0x142bac,_0x282ab6){_0x142bac=_0x142bac-0x0;var _0x4641b5=_0xe8c5[_0x142bac];return _0x4641b5;};'use strict';var multer=require(_0x5e8c('0x0'));var util=require(_0x5e8c('0x1'));var path=require(_0x5e8c('0x2'));var timeout=require(_0x5e8c('0x3'));var express=require(_0x5e8c('0x4'));var router=express[_0x5e8c('0x5')]();var fs_extra=require(_0x5e8c('0x6'));var auth=require(_0x5e8c('0x7'));var interaction=require(_0x5e8c('0x8'));var config=require(_0x5e8c('0x9'));var controller=require(_0x5e8c('0xa'));router[_0x5e8c('0xb')]('/',auth[_0x5e8c('0xc')](),controller['index']);router['get'](_0x5e8c('0xd'),auth[_0x5e8c('0xc')](),controller['show']);router['get'](_0x5e8c('0xe'),auth[_0x5e8c('0xc')](),controller[_0x5e8c('0xf')]);router[_0x5e8c('0x10')]('/',auth[_0x5e8c('0xc')](),controller[_0x5e8c('0x11')]);router[_0x5e8c('0x10')](_0x5e8c('0xe'),auth[_0x5e8c('0xc')](),controller[_0x5e8c('0x12')]);router['put'](_0x5e8c('0xd'),auth['isAuthenticated'](),controller[_0x5e8c('0x13')]);router[_0x5e8c('0x14')](_0x5e8c('0xd'),auth[_0x5e8c('0xc')](),controller[_0x5e8c('0x15')]);router[_0x5e8c('0x14')](_0x5e8c('0x16'),auth[_0x5e8c('0xc')](),controller[_0x5e8c('0x17')]);module[_0x5e8c('0x18')]=router; \ No newline at end of file +var _0xaf1c=['/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','/:id/sounds','getSounds','post','create','addSound','/:id','delete','destroy'];(function(_0x3ac265,_0x18c3fc){var _0x15004c=function(_0x5b7be3){while(--_0x5b7be3){_0x3ac265['push'](_0x3ac265['shift']());}};_0x15004c(++_0x18c3fc);}(_0xaf1c,0x1e3));var _0xcaf1=function(_0x2678a0,_0x2eff35){_0x2678a0=_0x2678a0-0x0;var _0x2f16ea=_0xaf1c[_0x2678a0];return _0x2f16ea;};'use strict';var multer=require(_0xcaf1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcaf1('0x1'));var express=require('express');var router=express[_0xcaf1('0x2')]();var fs_extra=require(_0xcaf1('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcaf1('0x4'));var controller=require(_0xcaf1('0x5'));router[_0xcaf1('0x6')]('/',auth['isAuthenticated'](),controller[_0xcaf1('0x7')]);router['get']('/:id',auth[_0xcaf1('0x8')](),controller['show']);router[_0xcaf1('0x6')](_0xcaf1('0x9'),auth[_0xcaf1('0x8')](),controller[_0xcaf1('0xa')]);router[_0xcaf1('0xb')]('/',auth[_0xcaf1('0x8')](),controller[_0xcaf1('0xc')]);router['post'](_0xcaf1('0x9'),auth[_0xcaf1('0x8')](),controller[_0xcaf1('0xd')]);router['put'](_0xcaf1('0xe'),auth[_0xcaf1('0x8')](),controller['update']);router[_0xcaf1('0xf')](_0xcaf1('0xe'),auth[_0xcaf1('0x8')](),controller[_0xcaf1('0x10')]);router[_0xcaf1('0xf')](_0xcaf1('0x11'),auth[_0xcaf1('0x8')](),controller[_0xcaf1('0x12')]);module[_0xcaf1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 61b9fbb..4fc7737 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 _0x1d43=['quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM','custom','files','mp3nb'];(function(_0x1c3c4e,_0x4fae93){var _0x487f87=function(_0x490b3f){while(--_0x490b3f){_0x1c3c4e['push'](_0x1c3c4e['shift']());}};_0x487f87(++_0x4fae93);}(_0x1d43,0x180));var _0x31d4=function(_0x189e84,_0x19d7c6){_0x189e84=_0x189e84-0x0;var _0x368088=_0x1d43[_0x189e84];return _0x368088;};'use strict';var Sequelize=require(_0x31d4('0x0'));module[_0x31d4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x31d4('0x2')](_0x31d4('0x3'),_0x31d4('0x4'),_0x31d4('0x5'),_0x31d4('0x6'),_0x31d4('0x7'),_0x31d4('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x31d4('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x31d4('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x31d4('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x31d4('0x9')],'allowNull':!![],'defaultValue':_0x31d4('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x31d4('0xb')},'defaultEntry':{'type':Sequelize[_0x31d4('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd1aa=['BOOLEAN','sequelize','STRING','name','ENUM','files','mp3nb','quietmp3','alpha'];(function(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_0xd1aa,0x1c3));var _0xad1a=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xd1aa[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xad1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xad1a('0x1')],'allowNull':![],'unique':_0xad1a('0x2')},'mode':{'type':Sequelize[_0xad1a('0x3')]('custom',_0xad1a('0x4'),_0xad1a('0x5'),'quietmp3nb',_0xad1a('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xad1a('0x4')},'directory':{'type':Sequelize[_0xad1a('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xad1a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xad1a('0x1')],'allowNull':!![],'defaultValue':_0xad1a('0x7')},'format':{'type':Sequelize[_0xad1a('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xad1a('0x8')],'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 d8bd9ae..98a67e1 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 _0xdfd2=['create','transaction','mode','files','join','root','mkdirSync','directory','0777','role','user','UserProfileSection','find','MusicOnHolds','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','getSounds','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','reject','save','update','destroy','then','get','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','VoiceMusicOnHold','includeAll','include','findAll','rows','params','options','body','catch'];(function(_0x525fc5,_0x26fa34){var _0x136895=function(_0x4f768f){while(--_0x4f768f){_0x525fc5['push'](_0x525fc5['shift']());}};_0x136895(++_0x26fa34);}(_0xdfd2,0xfa));var _0x2dfd=function(_0x534e1b,_0x3cae00){_0x534e1b=_0x534e1b-0x0;var _0x3ecc42=_0xdfd2[_0x534e1b];return _0x3ecc42;};'use strict';var emlformat=require(_0x2dfd('0x0'));var rimraf=require(_0x2dfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dfd('0x2'));var rp=require(_0x2dfd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2dfd('0x4'));var path=require(_0x2dfd('0x5'));var sox=require(_0x2dfd('0x6'));var csv=require(_0x2dfd('0x7'));var ejs=require(_0x2dfd('0x8'));var fs=require('fs');var fs_extra=require(_0x2dfd('0x9'));var _=require('lodash');var squel=require(_0x2dfd('0xa'));var crypto=require(_0x2dfd('0xb'));var jsforce=require(_0x2dfd('0xc'));var deskjs=require(_0x2dfd('0xd'));var toCsv=require(_0x2dfd('0x7'));var querystring=require(_0x2dfd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dfd('0xf'));var qs=require(_0x2dfd('0x10'));var as=require(_0x2dfd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dfd('0x12'))(_0x2dfd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2dfd('0x14'))['db'];function respondWithStatusCode(_0x5dff1f,_0x41c0fc){_0x41c0fc=_0x41c0fc||0xcc;return function(_0x416469){if(_0x416469){return _0x5dff1f[_0x2dfd('0x15')](_0x41c0fc);}return _0x5dff1f['status'](_0x41c0fc)[_0x2dfd('0x16')]();};}function respondWithResult(_0x5c5946,_0x1bd74b){_0x1bd74b=_0x1bd74b||0xc8;return function(_0x1ce7d4){if(_0x1ce7d4){return _0x5c5946[_0x2dfd('0x17')](_0x1bd74b)[_0x2dfd('0x18')](_0x1ce7d4);}};}function respondWithFilteredResult(_0x5d79f5,_0x1f0dc9){return function(_0xf0649){if(_0xf0649){var _0x2a6550=typeof _0x1f0dc9[_0x2dfd('0x19')]===_0x2dfd('0x1a')&&typeof _0x1f0dc9['limit']===_0x2dfd('0x1a');var _0x2c0f26=_0xf0649[_0x2dfd('0x1b')];var _0xb2ce05=_0x2a6550?0x0:_0x1f0dc9[_0x2dfd('0x19')];var _0x40f45d=_0x2a6550?_0xf0649[_0x2dfd('0x1b')]:_0x1f0dc9[_0x2dfd('0x19')]+_0x1f0dc9[_0x2dfd('0x1c')];var _0x4db12f;if(_0x40f45d>=_0x2c0f26){_0x40f45d=_0x2c0f26;_0x4db12f=0xc8;}else{_0x4db12f=0xce;}_0x5d79f5[_0x2dfd('0x17')](_0x4db12f);return _0x5d79f5['set']('Content-Range',_0xb2ce05+'-'+_0x40f45d+'/'+_0x2c0f26)['json'](_0xf0649);}return null;};}function patchUpdates(_0x4a583e){return function(_0x38e3bd){try{jsonpatch['apply'](_0x38e3bd,_0x4a583e,!![]);}catch(_0x58c694){return BPromise[_0x2dfd('0x1d')](_0x58c694);}return _0x38e3bd[_0x2dfd('0x1e')]();};}function saveUpdates(_0x3098ea,_0x5bb7c6){return function(_0x1aef59){if(_0x1aef59){return _0x1aef59[_0x2dfd('0x1f')](_0x3098ea)['then'](function(_0x411c46){return _0x411c46;});}return null;};}function removeEntity(_0x4ca969,_0x485dea){return function(_0x4c374a){if(_0x4c374a){return _0x4c374a[_0x2dfd('0x20')]()[_0x2dfd('0x21')](function(){var _0x4815de=_0x4c374a[_0x2dfd('0x22')]({'plain':!![]});var _0x2c57c0='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c57c0,'resourceId':_0x4815de['id']}})['then'](function(){return _0x4c374a;});})[_0x2dfd('0x21')](function(){_0x4ca969['status'](0xcc)[_0x2dfd('0x16')]();});}};}function handleEntityNotFound(_0x34cbc5,_0x310393){return function(_0x17de21){if(!_0x17de21){_0x34cbc5[_0x2dfd('0x15')](0x194);}return _0x17de21;};}function handleError(_0x55e2b4,_0x246587){_0x246587=_0x246587||0x1f4;return function(_0x1446fc){logger[_0x2dfd('0x23')](_0x1446fc['stack']);if(_0x1446fc[_0x2dfd('0x24')]){delete _0x1446fc[_0x2dfd('0x24')];}_0x55e2b4[_0x2dfd('0x17')](_0x246587)[_0x2dfd('0x25')](_0x1446fc);};}exports[_0x2dfd('0x26')]=function(_0x4ef5ae,_0x3fccbb){var _0x46f061={},_0x535cb5={},_0x54176f={'count':0x0,'rows':[]};var _0x3c147d=_[_0x2dfd('0x27')](db['VoiceMusicOnHold'][_0x2dfd('0x28')],function(_0x575c6d){return{'name':_0x575c6d[_0x2dfd('0x29')],'type':_0x575c6d[_0x2dfd('0x2a')][_0x2dfd('0x2b')]};});_0x535cb5[_0x2dfd('0x2c')]=_[_0x2dfd('0x27')](_0x3c147d,_0x2dfd('0x24'));_0x535cb5[_0x2dfd('0x2d')]=_[_0x2dfd('0x2e')](_0x4ef5ae[_0x2dfd('0x2d')]);_0x535cb5['filters']=_[_0x2dfd('0x2f')](_0x535cb5[_0x2dfd('0x2c')],_0x535cb5[_0x2dfd('0x2d')]);_0x46f061[_0x2dfd('0x30')]=_[_0x2dfd('0x2f')](_0x535cb5[_0x2dfd('0x2c')],qs['fields'](_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x31')]));_0x46f061['attributes']=_0x46f061[_0x2dfd('0x30')][_0x2dfd('0x32')]?_0x46f061[_0x2dfd('0x30')]:_0x535cb5[_0x2dfd('0x2c')];if(!_0x4ef5ae[_0x2dfd('0x2d')]['hasOwnProperty'](_0x2dfd('0x33'))){_0x46f061['limit']=qs[_0x2dfd('0x1c')](_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x1c')]);_0x46f061[_0x2dfd('0x19')]=qs[_0x2dfd('0x19')](_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x19')]);}_0x46f061[_0x2dfd('0x34')]=qs['sort'](_0x4ef5ae['query'][_0x2dfd('0x35')]);delete _0x4ef5ae[_0x2dfd('0x2d')]['sort'];_0x46f061['where']=qs['filters'](_[_0x2dfd('0x36')](_0x4ef5ae[_0x2dfd('0x2d')],_0x535cb5[_0x2dfd('0x37')]),_0x3c147d);if(_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x38')]){_0x46f061[_0x2dfd('0x39')]=_[_0x2dfd('0x3a')](_0x46f061[_0x2dfd('0x39')],{'$or':_['map'](_0x3c147d,function(_0x22c4c8){if(_0x22c4c8[_0x2dfd('0x2a')]!=='VIRTUAL'){var _0x2756e5={};_0x2756e5[_0x22c4c8[_0x2dfd('0x24')]]={'$like':'%'+_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x38')]+'%'};return _0x2756e5;}})});}_0x46f061=_['merge']({},_0x46f061,_0x4ef5ae['options']);var _0xaeefd7={'where':_0x46f061[_0x2dfd('0x39')]};return db[_0x2dfd('0x3b')][_0x2dfd('0x1b')](_0xaeefd7)[_0x2dfd('0x21')](function(_0x489b86){_0x54176f[_0x2dfd('0x1b')]=_0x489b86;if(_0x4ef5ae[_0x2dfd('0x2d')][_0x2dfd('0x3c')]){_0x46f061[_0x2dfd('0x3d')]=[{'all':!![]}];}return db[_0x2dfd('0x3b')][_0x2dfd('0x3e')](_0x46f061);})[_0x2dfd('0x21')](function(_0x64e220){_0x54176f[_0x2dfd('0x3f')]=_0x64e220;return _0x54176f;})[_0x2dfd('0x21')](respondWithFilteredResult(_0x3fccbb,_0x46f061))['catch'](handleError(_0x3fccbb,null));};exports['show']=function(_0x567c22,_0x438434){var _0x5024eb={'raw':![],'where':{'id':_0x567c22[_0x2dfd('0x40')]['id']}},_0x229ef0={};_0x229ef0[_0x2dfd('0x2c')]=_[_0x2dfd('0x2e')](db['VoiceMusicOnHold'][_0x2dfd('0x28')]);_0x229ef0[_0x2dfd('0x2d')]=_['keys'](_0x567c22['query']);_0x229ef0[_0x2dfd('0x37')]=_[_0x2dfd('0x2f')](_0x229ef0[_0x2dfd('0x2c')],_0x229ef0['query']);_0x5024eb[_0x2dfd('0x30')]=_[_0x2dfd('0x2f')](_0x229ef0[_0x2dfd('0x2c')],qs[_0x2dfd('0x31')](_0x567c22[_0x2dfd('0x2d')]['fields']));_0x5024eb[_0x2dfd('0x30')]=_0x5024eb[_0x2dfd('0x30')][_0x2dfd('0x32')]?_0x5024eb[_0x2dfd('0x30')]:_0x229ef0['model'];if(_0x567c22[_0x2dfd('0x2d')][_0x2dfd('0x3c')]){_0x5024eb[_0x2dfd('0x3d')]=[{'all':!![]}];}_0x5024eb=_[_0x2dfd('0x3a')]({},_0x5024eb,_0x567c22[_0x2dfd('0x41')]);return db[_0x2dfd('0x3b')]['find'](_0x5024eb)[_0x2dfd('0x21')](handleEntityNotFound(_0x438434,null))[_0x2dfd('0x21')](respondWithResult(_0x438434,null))['catch'](handleError(_0x438434,null));};exports[_0x2dfd('0x1f')]=function(_0x111b98,_0x43c1d0){if(_0x111b98[_0x2dfd('0x42')]['id']){delete _0x111b98['body']['id'];}return db[_0x2dfd('0x3b')]['find']({'where':{'id':_0x111b98[_0x2dfd('0x40')]['id']}})[_0x2dfd('0x21')](handleEntityNotFound(_0x43c1d0,null))[_0x2dfd('0x21')](saveUpdates(_0x111b98[_0x2dfd('0x42')],null))[_0x2dfd('0x21')](respondWithResult(_0x43c1d0,null))[_0x2dfd('0x43')](handleError(_0x43c1d0,null));};exports[_0x2dfd('0x44')]=function(_0x517f3c,_0x3d3b6b,_0x1b5737){return db['sequelize'][_0x2dfd('0x45')](function(_0x10daa7){if(_0x517f3c['body'][_0x2dfd('0x46')]===_0x2dfd('0x47')){_0x517f3c['body']['directory']=path[_0x2dfd('0x48')](config[_0x2dfd('0x49')],'server/files/moh',_0x517f3c[_0x2dfd('0x42')]['name']);}return db[_0x2dfd('0x3b')][_0x2dfd('0x44')](_0x517f3c[_0x2dfd('0x42')],{'transaction':_0x10daa7})[_0x2dfd('0x21')](function(_0x48f3d0){if(_0x517f3c['body'][_0x2dfd('0x46')]===_0x2dfd('0x47')){fs[_0x2dfd('0x4a')](_0x48f3d0[_0x2dfd('0x4b')],parseInt(_0x2dfd('0x4c'),0x8));}var _0x2faf90=_0x517f3c['user']['get']({'plain':!![]});if(!_0x2faf90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2faf90[_0x2dfd('0x4d')]===_0x2dfd('0x4e')){var _0x2a4b02=_0x48f3d0[_0x2dfd('0x22')]({'plain':!![]});return db[_0x2dfd('0x4f')][_0x2dfd('0x50')]({'where':{'name':_0x2dfd('0x51'),'userProfileId':_0x2faf90['userProfileId']},'raw':!![]})['then'](function(_0x4c2f70){if(_0x4c2f70&&_0x4c2f70['autoAssociation']===0x0){return db[_0x2dfd('0x52')][_0x2dfd('0x44')]({'name':_0x2a4b02[_0x2dfd('0x24')],'resourceId':_0x2a4b02['id'],'type':_0x4c2f70[_0x2dfd('0x24')],'sectionId':_0x4c2f70['id']},{})[_0x2dfd('0x21')](function(){return _0x48f3d0;});}else{return _0x48f3d0;}})[_0x2dfd('0x43')](function(_0x2111c1){logger['error'](_0x2dfd('0x53'),_0x2111c1);});}return _0x48f3d0;});})['then'](respondWithResult(_0x3d3b6b,0xc9))['catch'](handleError(_0x3d3b6b,null));};exports['destroy']=function(_0x4169c1,_0xc3a69d,_0x444bf0){var _0x14c8f5;return db[_0x2dfd('0x3b')][_0x2dfd('0x50')]({'where':{'id':_0x4169c1['params']['id']}})[_0x2dfd('0x21')](function(_0x34557a){if(_0x34557a){return db[_0x2dfd('0x54')]['transaction'](function(_0x9fe4de){return _0x34557a[_0x2dfd('0x20')]({'transaction':_0x9fe4de,'raw':!![]})['then'](function(_0x2132eb){if(_0x2132eb[_0x2dfd('0x4b')]){fs['readdirSync'](_0x2132eb['directory'])[_0x2dfd('0x55')](function(_0x51733){fs[_0x2dfd('0x56')](path[_0x2dfd('0x48')](_0x2132eb[_0x2dfd('0x4b')],_0x51733));});fs[_0x2dfd('0x57')](_0x2132eb['directory']);}return _0x2132eb;});})[_0x2dfd('0x43')](function(_0x393e60){throw new db[(_0x2dfd('0x58'))][(_0x2dfd('0x59'))](_0x393e60[_0x2dfd('0x5a')]);});}})['then'](handleEntityNotFound(_0xc3a69d,null))[_0x2dfd('0x21')](removeEntity(_0xc3a69d,null))['catch'](handleError(_0xc3a69d,null));};exports[_0x2dfd('0x5b')]=function(_0x4dcc8d,_0x4d9e07,_0x337396){return db[_0x2dfd('0x54')]['transaction'](function(_0x4340e1){var _0x344e75;return db[_0x2dfd('0x3b')][_0x2dfd('0x50')]({'where':{'id':_0x4dcc8d['params']['id']}})[_0x2dfd('0x21')](function(_0x2e012d){if(_0x2e012d){_0x344e75=_0x2e012d;return _0x2e012d['addSound'](_0x4dcc8d[_0x2dfd('0x42')]['id'],{'transaction':_0x4340e1});}})[_0x2dfd('0x21')](function(_0x1c68f3){if(_0x1c68f3){return db[_0x2dfd('0x5c')][_0x2dfd('0x5d')]({'where':{'id':_0x4dcc8d[_0x2dfd('0x42')]['id']},'attributes':['id',_0x2dfd('0x24'),_0x2dfd('0x5e'),_0x2dfd('0x5f'),_0x2dfd('0x60')],'raw':!![]});}})['then'](function(_0x2e8bdf){if(_0x2e8bdf){var _0xf8d081=path[_0x2dfd('0x48')](config[_0x2dfd('0x49')],_0x2dfd('0x61'),util[_0x2dfd('0x62')](_0x2dfd('0x63'),path[_0x2dfd('0x64')](_0x2e8bdf['save_name'],path[_0x2dfd('0x65')](_0x2e8bdf[_0x2dfd('0x5e')])),_0x2e8bdf[_0x2dfd('0x5f')]));var _0x3ade0a=path['join'](config['root'],_0x2dfd('0x66'),_0x344e75[_0x2dfd('0x24')],util[_0x2dfd('0x62')](_0x2dfd('0x63'),_0x2e8bdf[_0x2dfd('0x24')],_0x2e8bdf[_0x2dfd('0x5f')]));fs[_0x2dfd('0x67')](_0xf8d081,_0x3ade0a);return _0x2e8bdf;}})[_0x2dfd('0x43')](function(_0x2b491c){throw new db[(_0x2dfd('0x58'))][(_0x2dfd('0x59'))](_0x2b491c[_0x2dfd('0x5a')]);});})[_0x2dfd('0x21')](handleEntityNotFound(_0x4d9e07,null))[_0x2dfd('0x21')](respondWithResult(_0x4d9e07,0xc9))[_0x2dfd('0x43')](handleError(_0x4d9e07,null));};exports[_0x2dfd('0x68')]=function(_0x13d917,_0x5eacb0,_0x4594bb){return db[_0x2dfd('0x54')][_0x2dfd('0x45')](function(_0x3a1ae9){var _0x209ed6;return db[_0x2dfd('0x3b')][_0x2dfd('0x5d')]({'where':{'id':_0x13d917[_0x2dfd('0x40')]['id']}})[_0x2dfd('0x21')](handleEntityNotFound(_0x5eacb0,null))['then'](function(_0x5b36ee){if(_0x5b36ee){_0x209ed6=_0x5b36ee;return _0x5b36ee[_0x2dfd('0x68')](_0x13d917[_0x2dfd('0x40')]['id2']);}})[_0x2dfd('0x21')](function(_0x33e681){if(_0x33e681){return db[_0x2dfd('0x5c')][_0x2dfd('0x5d')]({'where':{'id':_0x13d917[_0x2dfd('0x40')]['id2']},'attributes':['id',_0x2dfd('0x24'),_0x2dfd('0x5e'),'converted_format',_0x2dfd('0x60')],'raw':!![]});}})[_0x2dfd('0x21')](function(_0x303296){if(_0x303296){fs['unlinkSync'](path['join'](_0x209ed6[_0x2dfd('0x4b')],util[_0x2dfd('0x62')](_0x2dfd('0x63'),_0x303296[_0x2dfd('0x24')],_0x303296[_0x2dfd('0x5f')])));return _0x303296;}})[_0x2dfd('0x43')](function(_0x3509e1){throw new db['Sequelize'][(_0x2dfd('0x59'))](_0x3509e1['message']);});})[_0x2dfd('0x21')](handleEntityNotFound(_0x5eacb0,null))[_0x2dfd('0x21')](respondWithStatusCode(_0x5eacb0,0xcc))[_0x2dfd('0x43')](handleError(_0x5eacb0,null));};exports['getSounds']=function(_0x503997,_0x2597ca,_0x31e582){var _0x4bbafb={};var _0x1ad144={};var _0x4183a5;var _0x32c2cb;return db['VoiceMusicOnHold'][_0x2dfd('0x5d')]({'where':{'id':_0x503997[_0x2dfd('0x40')]['id']}})['then'](handleEntityNotFound(_0x2597ca,null))['then'](function(_0x420f26){if(_0x420f26){_0x4183a5=_0x420f26;_0x1ad144[_0x2dfd('0x2c')]=_[_0x2dfd('0x2e')](db[_0x2dfd('0x5c')]['rawAttributes']);_0x1ad144[_0x2dfd('0x2d')]=_['keys'](_0x503997[_0x2dfd('0x2d')]);_0x1ad144[_0x2dfd('0x37')]=_[_0x2dfd('0x2f')](_0x1ad144['model'],_0x1ad144[_0x2dfd('0x2d')]);_0x4bbafb[_0x2dfd('0x30')]=_['intersection'](_0x1ad144[_0x2dfd('0x2c')],qs['fields'](_0x503997[_0x2dfd('0x2d')][_0x2dfd('0x31')]));_0x4bbafb[_0x2dfd('0x30')]=_0x4bbafb[_0x2dfd('0x30')][_0x2dfd('0x32')]?_0x4bbafb[_0x2dfd('0x30')]:_0x1ad144[_0x2dfd('0x2c')];_0x4bbafb['order']=qs[_0x2dfd('0x35')](_0x503997[_0x2dfd('0x2d')][_0x2dfd('0x35')]);_0x4bbafb['where']=qs['filters'](_['pick'](_0x503997[_0x2dfd('0x2d')],_0x1ad144[_0x2dfd('0x37')]));if(_0x503997['query'][_0x2dfd('0x38')]){_0x4bbafb[_0x2dfd('0x39')]=_[_0x2dfd('0x3a')](_0x4bbafb[_0x2dfd('0x39')],{'$or':_[_0x2dfd('0x27')](_0x4bbafb['attributes'],function(_0x1b4af6){var _0x15eccc={};_0x15eccc[_0x1b4af6]={'$like':'%'+_0x503997['query'][_0x2dfd('0x38')]+'%'};return _0x15eccc;})});}_0x4bbafb=_['merge']({},_0x4bbafb,_0x503997[_0x2dfd('0x41')]);return _0x4183a5['getSounds'](_0x4bbafb);}})['then'](function(_0x1521ef){if(_0x1521ef){_0x32c2cb=_0x1521ef[_0x2dfd('0x32')];if(!_0x503997[_0x2dfd('0x2d')]['hasOwnProperty'](_0x2dfd('0x33'))){_0x4bbafb[_0x2dfd('0x1c')]=qs[_0x2dfd('0x1c')](_0x503997[_0x2dfd('0x2d')][_0x2dfd('0x1c')]);_0x4bbafb['offset']=qs['offset'](_0x503997[_0x2dfd('0x2d')]['offset']);}return _0x4183a5[_0x2dfd('0x69')](_0x4bbafb);}})['then'](function(_0x43f5cf){if(_0x43f5cf){return _0x43f5cf?{'count':_0x32c2cb,'rows':_0x43f5cf}:null;}})[_0x2dfd('0x21')](respondWithResult(_0x2597ca,null))[_0x2dfd('0x43')](handleError(_0x2597ca,null));}; \ No newline at end of file +var _0xde9f=['sequelize','transaction','files','root','server/files/moh','mode','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','save_name','join','server/files/sounds/converted','format','%s.%s','converted_format','ValidationError','removeSound','findOne','id2','getSounds','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','destroy','end','error','stack','name','send','index','map','VoiceMusicOnHold','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','body','params','create'];(function(_0x328162,_0x3ed4ca){var _0x15fa8d=function(_0x33c09a){while(--_0x33c09a){_0x328162['push'](_0x328162['shift']());}};_0x15fa8d(++_0x3ed4ca);}(_0xde9f,0x90));var _0xfde9=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xde9f[_0x52bfa5];return _0x26f80b;};'use strict';var emlformat=require(_0xfde9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfde9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfde9('0x2'));var moment=require(_0xfde9('0x3'));var BPromise=require(_0xfde9('0x4'));var Mustache=require(_0xfde9('0x5'));var util=require(_0xfde9('0x6'));var path=require(_0xfde9('0x7'));var sox=require(_0xfde9('0x8'));var csv=require('to-csv');var ejs=require(_0xfde9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfde9('0xa'));var squel=require(_0xfde9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfde9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfde9('0xd'));var authService=require(_0xfde9('0xe'));var qs=require(_0xfde9('0xf'));var as=require(_0xfde9('0x10'));var hardwareService=require(_0xfde9('0x11'));var logger=require(_0xfde9('0x12'))(_0xfde9('0x13'));var utils=require(_0xfde9('0x14'));var config=require(_0xfde9('0x15'));var licenseUtil=require(_0xfde9('0x16'));var db=require(_0xfde9('0x17'))['db'];function respondWithStatusCode(_0x29b33d,_0x4d3980){_0x4d3980=_0x4d3980||0xcc;return function(_0x56a402){if(_0x56a402){return _0x29b33d[_0xfde9('0x18')](_0x4d3980);}return _0x29b33d['status'](_0x4d3980)['end']();};}function respondWithResult(_0x3acef2,_0x45f386){_0x45f386=_0x45f386||0xc8;return function(_0x53f9c1){if(_0x53f9c1){return _0x3acef2[_0xfde9('0x19')](_0x45f386)[_0xfde9('0x1a')](_0x53f9c1);}};}function respondWithFilteredResult(_0x508165,_0x2bc375){return function(_0x34bba5){if(_0x34bba5){var _0x1aceae=typeof _0x2bc375['offset']===_0xfde9('0x1b')&&typeof _0x2bc375[_0xfde9('0x1c')]==='undefined';var _0x645c1f=_0x34bba5[_0xfde9('0x1d')];var _0x4ed3c6=_0x1aceae?0x0:_0x2bc375[_0xfde9('0x1e')];var _0x24ced5=_0x1aceae?_0x34bba5[_0xfde9('0x1d')]:_0x2bc375[_0xfde9('0x1e')]+_0x2bc375[_0xfde9('0x1c')];var _0x5eb820;if(_0x24ced5>=_0x645c1f){_0x24ced5=_0x645c1f;_0x5eb820=0xc8;}else{_0x5eb820=0xce;}_0x508165[_0xfde9('0x19')](_0x5eb820);return _0x508165['set'](_0xfde9('0x1f'),_0x4ed3c6+'-'+_0x24ced5+'/'+_0x645c1f)['json'](_0x34bba5);}return null;};}function patchUpdates(_0xb0c40e){return function(_0x3245f3){try{jsonpatch[_0xfde9('0x20')](_0x3245f3,_0xb0c40e,!![]);}catch(_0x2af784){return BPromise[_0xfde9('0x21')](_0x2af784);}return _0x3245f3[_0xfde9('0x22')]();};}function saveUpdates(_0x547a48,_0x5bcc2a){return function(_0x39e2f9){if(_0x39e2f9){return _0x39e2f9[_0xfde9('0x23')](_0x547a48)[_0xfde9('0x24')](function(_0x317ed4){return _0x317ed4;});}return null;};}function removeEntity(_0x430f8a,_0x4dbebe){return function(_0xc0452d){if(_0xc0452d){return _0xc0452d['destroy']()[_0xfde9('0x24')](function(){var _0x23c7f1=_0xc0452d[_0xfde9('0x25')]({'plain':!![]});var _0x3a39a5=_0xfde9('0x26');return db['UserProfileResource'][_0xfde9('0x27')]({'where':{'type':_0x3a39a5,'resourceId':_0x23c7f1['id']}})[_0xfde9('0x24')](function(){return _0xc0452d;});})[_0xfde9('0x24')](function(){_0x430f8a[_0xfde9('0x19')](0xcc)[_0xfde9('0x28')]();});}};}function handleEntityNotFound(_0x2b7f53,_0x19de34){return function(_0x5ba766){if(!_0x5ba766){_0x2b7f53[_0xfde9('0x18')](0x194);}return _0x5ba766;};}function handleError(_0x13ce86,_0x889a69){_0x889a69=_0x889a69||0x1f4;return function(_0x5142ca){logger[_0xfde9('0x29')](_0x5142ca[_0xfde9('0x2a')]);if(_0x5142ca[_0xfde9('0x2b')]){delete _0x5142ca[_0xfde9('0x2b')];}_0x13ce86[_0xfde9('0x19')](_0x889a69)[_0xfde9('0x2c')](_0x5142ca);};}exports[_0xfde9('0x2d')]=function(_0x5b9cb9,_0x3af4a1){var _0x58234a={},_0x37d8e7={},_0x286bec={'count':0x0,'rows':[]};var _0x5e6084=_[_0xfde9('0x2e')](db[_0xfde9('0x2f')]['rawAttributes'],function(_0x1d51bf){return{'name':_0x1d51bf['fieldName'],'type':_0x1d51bf[_0xfde9('0x30')]['key']};});_0x37d8e7[_0xfde9('0x31')]=_['map'](_0x5e6084,_0xfde9('0x2b'));_0x37d8e7[_0xfde9('0x32')]=_['keys'](_0x5b9cb9['query']);_0x37d8e7[_0xfde9('0x33')]=_[_0xfde9('0x34')](_0x37d8e7[_0xfde9('0x31')],_0x37d8e7['query']);_0x58234a[_0xfde9('0x35')]=_[_0xfde9('0x34')](_0x37d8e7[_0xfde9('0x31')],qs[_0xfde9('0x36')](_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x36')]));_0x58234a[_0xfde9('0x35')]=_0x58234a[_0xfde9('0x35')][_0xfde9('0x37')]?_0x58234a['attributes']:_0x37d8e7['model'];if(!_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x38')]('nolimit')){_0x58234a['limit']=qs[_0xfde9('0x1c')](_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x1c')]);_0x58234a[_0xfde9('0x1e')]=qs['offset'](_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x1e')]);}_0x58234a[_0xfde9('0x39')]=qs['sort'](_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x3a')]);delete _0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x3a')];_0x58234a[_0xfde9('0x3b')]=qs['filters'](_['pick'](_0x5b9cb9[_0xfde9('0x32')],_0x37d8e7[_0xfde9('0x33')]),_0x5e6084);if(_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x3c')]){_0x58234a[_0xfde9('0x3b')]=_[_0xfde9('0x3d')](_0x58234a[_0xfde9('0x3b')],{'$or':_['map'](_0x5e6084,function(_0x1ec6b5){if(_0x1ec6b5[_0xfde9('0x30')]!==_0xfde9('0x3e')){var _0x2c0f94={};_0x2c0f94[_0x1ec6b5['name']]={'$like':'%'+_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x3c')]+'%'};return _0x2c0f94;}})});}_0x58234a=_[_0xfde9('0x3d')]({},_0x58234a,_0x5b9cb9[_0xfde9('0x3f')]);var _0x183b1d={'where':_0x58234a['where']};return db[_0xfde9('0x2f')][_0xfde9('0x1d')](_0x183b1d)[_0xfde9('0x24')](function(_0x52eb86){_0x286bec[_0xfde9('0x1d')]=_0x52eb86;if(_0x5b9cb9[_0xfde9('0x32')][_0xfde9('0x40')]){_0x58234a[_0xfde9('0x41')]=[{'all':!![]}];}return db[_0xfde9('0x2f')][_0xfde9('0x42')](_0x58234a);})['then'](function(_0x15922c){_0x286bec[_0xfde9('0x43')]=_0x15922c;return _0x286bec;})[_0xfde9('0x24')](respondWithFilteredResult(_0x3af4a1,_0x58234a))[_0xfde9('0x44')](handleError(_0x3af4a1,null));};exports[_0xfde9('0x45')]=function(_0x3aff22,_0x1bc536){var _0x3c3215={'raw':![],'where':{'id':_0x3aff22['params']['id']}},_0x49c52d={};_0x49c52d['model']=_[_0xfde9('0x46')](db[_0xfde9('0x2f')][_0xfde9('0x47')]);_0x49c52d['query']=_[_0xfde9('0x46')](_0x3aff22[_0xfde9('0x32')]);_0x49c52d[_0xfde9('0x33')]=_[_0xfde9('0x34')](_0x49c52d[_0xfde9('0x31')],_0x49c52d[_0xfde9('0x32')]);_0x3c3215[_0xfde9('0x35')]=_['intersection'](_0x49c52d[_0xfde9('0x31')],qs[_0xfde9('0x36')](_0x3aff22[_0xfde9('0x32')]['fields']));_0x3c3215[_0xfde9('0x35')]=_0x3c3215[_0xfde9('0x35')][_0xfde9('0x37')]?_0x3c3215['attributes']:_0x49c52d[_0xfde9('0x31')];if(_0x3aff22[_0xfde9('0x32')]['includeAll']){_0x3c3215[_0xfde9('0x41')]=[{'all':!![]}];}_0x3c3215=_[_0xfde9('0x3d')]({},_0x3c3215,_0x3aff22[_0xfde9('0x3f')]);return db[_0xfde9('0x2f')][_0xfde9('0x48')](_0x3c3215)[_0xfde9('0x24')](handleEntityNotFound(_0x1bc536,null))[_0xfde9('0x24')](respondWithResult(_0x1bc536,null))['catch'](handleError(_0x1bc536,null));};exports[_0xfde9('0x23')]=function(_0x36588e,_0xb7f407){if(_0x36588e[_0xfde9('0x49')]['id']){delete _0x36588e[_0xfde9('0x49')]['id'];}return db['VoiceMusicOnHold'][_0xfde9('0x48')]({'where':{'id':_0x36588e[_0xfde9('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb7f407,null))[_0xfde9('0x24')](saveUpdates(_0x36588e[_0xfde9('0x49')],null))['then'](respondWithResult(_0xb7f407,null))[_0xfde9('0x44')](handleError(_0xb7f407,null));};exports[_0xfde9('0x4b')]=function(_0x5e00b3,_0x1f5706,_0x3c6c67){return db[_0xfde9('0x4c')][_0xfde9('0x4d')](function(_0x2c4e2c){if(_0x5e00b3[_0xfde9('0x49')]['mode']===_0xfde9('0x4e')){_0x5e00b3[_0xfde9('0x49')]['directory']=path['join'](config[_0xfde9('0x4f')],_0xfde9('0x50'),_0x5e00b3[_0xfde9('0x49')][_0xfde9('0x2b')]);}return db[_0xfde9('0x2f')][_0xfde9('0x4b')](_0x5e00b3[_0xfde9('0x49')],{'transaction':_0x2c4e2c})['then'](function(_0x270727){if(_0x5e00b3['body'][_0xfde9('0x51')]==='files'){fs['mkdirSync'](_0x270727[_0xfde9('0x52')],parseInt(_0xfde9('0x53'),0x8));}var _0x1f1cc9=_0x5e00b3[_0xfde9('0x54')][_0xfde9('0x25')]({'plain':!![]});if(!_0x1f1cc9)throw new Error(_0xfde9('0x55'));if(_0x1f1cc9[_0xfde9('0x56')]===_0xfde9('0x54')){var _0x4f0406=_0x270727[_0xfde9('0x25')]({'plain':!![]});return db[_0xfde9('0x57')]['find']({'where':{'name':_0xfde9('0x26'),'userProfileId':_0x1f1cc9['userProfileId']},'raw':!![]})[_0xfde9('0x24')](function(_0x57c468){if(_0x57c468&&_0x57c468[_0xfde9('0x58')]===0x0){return db['UserProfileResource'][_0xfde9('0x4b')]({'name':_0x4f0406[_0xfde9('0x2b')],'resourceId':_0x4f0406['id'],'type':_0x57c468[_0xfde9('0x2b')],'sectionId':_0x57c468['id']},{})['then'](function(){return _0x270727;});}else{return _0x270727;}})[_0xfde9('0x44')](function(_0x1ae039){logger[_0xfde9('0x29')](_0xfde9('0x59'),_0x1ae039);});}return _0x270727;});})['then'](respondWithResult(_0x1f5706,0xc9))['catch'](handleError(_0x1f5706,null));};exports[_0xfde9('0x27')]=function(_0x1f1cf2,_0x3599f2,_0x4c2313){var _0x2bc650;return db[_0xfde9('0x2f')][_0xfde9('0x48')]({'where':{'id':_0x1f1cf2['params']['id']}})[_0xfde9('0x24')](function(_0x3b92bc){if(_0x3b92bc){return db['sequelize'][_0xfde9('0x4d')](function(_0x34d1e1){return _0x3b92bc[_0xfde9('0x27')]({'transaction':_0x34d1e1,'raw':!![]})[_0xfde9('0x24')](function(_0x2c79ff){if(_0x2c79ff[_0xfde9('0x52')]){fs[_0xfde9('0x5a')](_0x2c79ff[_0xfde9('0x52')])[_0xfde9('0x5b')](function(_0x5f38f2){fs[_0xfde9('0x5c')](path['join'](_0x2c79ff[_0xfde9('0x52')],_0x5f38f2));});fs[_0xfde9('0x5d')](_0x2c79ff[_0xfde9('0x52')]);}return _0x2c79ff;});})[_0xfde9('0x44')](function(_0x403e5a){throw new db[(_0xfde9('0x5e'))]['ValidationError'](_0x403e5a[_0xfde9('0x5f')]);});}})[_0xfde9('0x24')](handleEntityNotFound(_0x3599f2,null))['then'](removeEntity(_0x3599f2,null))[_0xfde9('0x44')](handleError(_0x3599f2,null));};exports[_0xfde9('0x60')]=function(_0x2c6960,_0x1d01a9,_0x269d51){return db['sequelize'][_0xfde9('0x4d')](function(_0x44ae4b){var _0x276de7;return db[_0xfde9('0x2f')][_0xfde9('0x48')]({'where':{'id':_0x2c6960[_0xfde9('0x4a')]['id']}})[_0xfde9('0x24')](function(_0xf52acd){if(_0xf52acd){_0x276de7=_0xf52acd;return _0xf52acd[_0xfde9('0x60')](_0x2c6960[_0xfde9('0x49')]['id'],{'transaction':_0x44ae4b});}})[_0xfde9('0x24')](function(_0x3253fe){if(_0x3253fe){return db[_0xfde9('0x61')]['findOne']({'where':{'id':_0x2c6960[_0xfde9('0x49')]['id']},'attributes':['id',_0xfde9('0x2b'),_0xfde9('0x62'),'converted_format','createdAt'],'raw':!![]});}})[_0xfde9('0x24')](function(_0x46a341){if(_0x46a341){var _0x2b8ae5=path[_0xfde9('0x63')](config[_0xfde9('0x4f')],_0xfde9('0x64'),util[_0xfde9('0x65')](_0xfde9('0x66'),path['basename'](_0x46a341[_0xfde9('0x62')],path['extname'](_0x46a341[_0xfde9('0x62')])),_0x46a341[_0xfde9('0x67')]));var _0x3d37f3=path[_0xfde9('0x63')](config[_0xfde9('0x4f')],_0xfde9('0x50'),_0x276de7[_0xfde9('0x2b')],util[_0xfde9('0x65')](_0xfde9('0x66'),_0x46a341[_0xfde9('0x2b')],_0x46a341[_0xfde9('0x67')]));fs['symlinkSync'](_0x2b8ae5,_0x3d37f3);return _0x46a341;}})[_0xfde9('0x44')](function(_0x3dea9b){throw new db[(_0xfde9('0x5e'))][(_0xfde9('0x68'))](_0x3dea9b[_0xfde9('0x5f')]);});})[_0xfde9('0x24')](handleEntityNotFound(_0x1d01a9,null))[_0xfde9('0x24')](respondWithResult(_0x1d01a9,0xc9))[_0xfde9('0x44')](handleError(_0x1d01a9,null));};exports[_0xfde9('0x69')]=function(_0x594bdd,_0x49a6a1,_0x54a622){return db[_0xfde9('0x4c')][_0xfde9('0x4d')](function(_0x36d433){var _0x45d8b8;return db[_0xfde9('0x2f')][_0xfde9('0x6a')]({'where':{'id':_0x594bdd['params']['id']}})[_0xfde9('0x24')](handleEntityNotFound(_0x49a6a1,null))[_0xfde9('0x24')](function(_0x2873ba){if(_0x2873ba){_0x45d8b8=_0x2873ba;return _0x2873ba[_0xfde9('0x69')](_0x594bdd[_0xfde9('0x4a')][_0xfde9('0x6b')]);}})[_0xfde9('0x24')](function(_0x51608c){if(_0x51608c){return db[_0xfde9('0x61')][_0xfde9('0x6a')]({'where':{'id':_0x594bdd['params'][_0xfde9('0x6b')]},'attributes':['id',_0xfde9('0x2b'),_0xfde9('0x62'),'converted_format','createdAt'],'raw':!![]});}})[_0xfde9('0x24')](function(_0x59b6f3){if(_0x59b6f3){fs[_0xfde9('0x5c')](path[_0xfde9('0x63')](_0x45d8b8[_0xfde9('0x52')],util['format']('%s.%s',_0x59b6f3[_0xfde9('0x2b')],_0x59b6f3[_0xfde9('0x67')])));return _0x59b6f3;}})[_0xfde9('0x44')](function(_0x49df0d){throw new db[(_0xfde9('0x5e'))][(_0xfde9('0x68'))](_0x49df0d[_0xfde9('0x5f')]);});})[_0xfde9('0x24')](handleEntityNotFound(_0x49a6a1,null))[_0xfde9('0x24')](respondWithStatusCode(_0x49a6a1,0xcc))[_0xfde9('0x44')](handleError(_0x49a6a1,null));};exports[_0xfde9('0x6c')]=function(_0xa79e52,_0x3f5c83,_0x37253f){var _0x9ed3d4={};var _0x284b76={};var _0x115b90;var _0x2b9d6f;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xa79e52['params']['id']}})[_0xfde9('0x24')](handleEntityNotFound(_0x3f5c83,null))[_0xfde9('0x24')](function(_0xa4756a){if(_0xa4756a){_0x115b90=_0xa4756a;_0x284b76[_0xfde9('0x31')]=_[_0xfde9('0x46')](db[_0xfde9('0x61')]['rawAttributes']);_0x284b76['query']=_[_0xfde9('0x46')](_0xa79e52['query']);_0x284b76['filters']=_[_0xfde9('0x34')](_0x284b76[_0xfde9('0x31')],_0x284b76[_0xfde9('0x32')]);_0x9ed3d4[_0xfde9('0x35')]=_[_0xfde9('0x34')](_0x284b76['model'],qs[_0xfde9('0x36')](_0xa79e52[_0xfde9('0x32')][_0xfde9('0x36')]));_0x9ed3d4[_0xfde9('0x35')]=_0x9ed3d4['attributes'][_0xfde9('0x37')]?_0x9ed3d4[_0xfde9('0x35')]:_0x284b76[_0xfde9('0x31')];_0x9ed3d4[_0xfde9('0x39')]=qs[_0xfde9('0x3a')](_0xa79e52[_0xfde9('0x32')][_0xfde9('0x3a')]);_0x9ed3d4[_0xfde9('0x3b')]=qs[_0xfde9('0x33')](_['pick'](_0xa79e52[_0xfde9('0x32')],_0x284b76[_0xfde9('0x33')]));if(_0xa79e52[_0xfde9('0x32')][_0xfde9('0x3c')]){_0x9ed3d4[_0xfde9('0x3b')]=_['merge'](_0x9ed3d4[_0xfde9('0x3b')],{'$or':_[_0xfde9('0x2e')](_0x9ed3d4[_0xfde9('0x35')],function(_0x16ae08){var _0x423d09={};_0x423d09[_0x16ae08]={'$like':'%'+_0xa79e52['query'][_0xfde9('0x3c')]+'%'};return _0x423d09;})});}_0x9ed3d4=_['merge']({},_0x9ed3d4,_0xa79e52[_0xfde9('0x3f')]);return _0x115b90[_0xfde9('0x6c')](_0x9ed3d4);}})[_0xfde9('0x24')](function(_0x3aaf59){if(_0x3aaf59){_0x2b9d6f=_0x3aaf59['length'];if(!_0xa79e52[_0xfde9('0x32')][_0xfde9('0x38')](_0xfde9('0x6d'))){_0x9ed3d4[_0xfde9('0x1c')]=qs['limit'](_0xa79e52['query'][_0xfde9('0x1c')]);_0x9ed3d4[_0xfde9('0x1e')]=qs[_0xfde9('0x1e')](_0xa79e52[_0xfde9('0x32')][_0xfde9('0x1e')]);}return _0x115b90[_0xfde9('0x6c')](_0x9ed3d4);}})['then'](function(_0x4ff3fc){if(_0x4ff3fc){return _0x4ff3fc?{'count':_0x2b9d6f,'rows':_0x4ff3fc}:null;}})[_0xfde9('0x24')](respondWithResult(_0x3f5c83,null))[_0xfde9('0x44')](handleError(_0x3f5c83,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a54cef3..dae285c 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 _0x97c6=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x97c6,0x186));var _0x697c=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x97c6[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x697c('0x0'));var util=require(_0x697c('0x1'));var logger=require(_0x697c('0x2'))(_0x697c('0x3'));var moment=require(_0x697c('0x4'));var BPromise=require('bluebird');var rp=require(_0x697c('0x5'));var fs=require('fs');var path=require(_0x697c('0x6'));var rimraf=require('rimraf');var config=require(_0x697c('0x7'));var attributes=require(_0x697c('0x8'));module[_0x697c('0x9')]=function(_0x336767,_0xf49a42){return _0x336767[_0x697c('0xa')](_0x697c('0xb'),attributes,{'tableName':_0x697c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa354=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x673a4a,_0x50e273){var _0x36af23=function(_0x2a4b58){while(--_0x2a4b58){_0x673a4a['push'](_0x673a4a['shift']());}};_0x36af23(++_0x50e273);}(_0xa354,0x1c6));var _0x4a35=function(_0x4c8a72,_0x2412fc){_0x4c8a72=_0x4c8a72-0x0;var _0x5b43d1=_0xa354[_0x4c8a72];return _0x5b43d1;};'use strict';var _=require(_0x4a35('0x0'));var util=require(_0x4a35('0x1'));var logger=require(_0x4a35('0x2'))(_0x4a35('0x3'));var moment=require(_0x4a35('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a35('0x5'));var rimraf=require(_0x4a35('0x6'));var config=require(_0x4a35('0x7'));var attributes=require(_0x4a35('0x8'));module[_0x4a35('0x9')]=function(_0x2a51c9,_0x33fa93){return _0x2a51c9[_0x4a35('0xa')](_0x4a35('0xb'),attributes,{'tableName':_0x4a35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index fc63e57..3ee3e28 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(_0x57c493,_0x384c8e){var _0x2c17db=function(_0x32fa06){while(--_0x32fa06){_0x57c493['push'](_0x57c493['shift']());}};_0x2c17db(++_0x384c8e);}(_0x70e0,0x17b));var _0x070e=function(_0x3420b5,_0x41665f){_0x3420b5=_0x3420b5-0x0;var _0x2221a2=_0x70e0[_0x3420b5];return _0x2221a2;};'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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x358a78,_0x6a43a4){var _0x3cbcea=function(_0x101045){while(--_0x101045){_0x358a78['push'](_0x358a78['shift']());}};_0x3cbcea(++_0x6a43a4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4c677bc..e3b76a6 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 _0x5395=['index','/describe','/:id','show','post','/:id/users','addAgents','/:id/teams','put','update','destroy','delete','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x5395,0x150));var _0x5539=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5395[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x5539('0x0'));var util=require('util');var path=require(_0x5539('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5539('0x2')]();var fs_extra=require(_0x5539('0x3'));var auth=require(_0x5539('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5539('0x5'));var controller=require(_0x5539('0x6'));router[_0x5539('0x7')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0x9')]);router[_0x5539('0x7')](_0x5539('0xa'),auth[_0x5539('0x8')](),controller['describe']);router[_0x5539('0x7')](_0x5539('0xb'),auth[_0x5539('0x8')](),controller[_0x5539('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x5539('0x7')]('/:id/teams',auth[_0x5539('0x8')](),controller['getTeams']);router[_0x5539('0xd')]('/',auth[_0x5539('0x8')](),controller['create']);router[_0x5539('0xd')](_0x5539('0xe'),auth[_0x5539('0x8')](),controller[_0x5539('0xf')]);router[_0x5539('0xd')](_0x5539('0x10'),auth[_0x5539('0x8')](),controller['addTeams']);router[_0x5539('0x11')](_0x5539('0xb'),auth['isAuthenticated'](),controller[_0x5539('0x12')]);router['delete'](_0x5539('0xb'),auth[_0x5539('0x8')](),controller[_0x5539('0x13')]);router[_0x5539('0x14')](_0x5539('0xe'),auth[_0x5539('0x8')](),controller[_0x5539('0x15')]);router[_0x5539('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0x5539('0x16')]=router; \ No newline at end of file +var _0xbbfa=['path','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/teams','getTeams','/:id/users','addAgents','post','addTeams','put','update','delete','destroy','removeTeams','multer','util'];(function(_0x27b7d2,_0x56c091){var _0x3ef6be=function(_0x6e8a35){while(--_0x6e8a35){_0x27b7d2['push'](_0x27b7d2['shift']());}};_0x3ef6be(++_0x56c091);}(_0xbbfa,0x175));var _0xabbf=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0xbbfa[_0x5bc5fe];return _0x298ea7;};'use strict';var multer=require(_0xabbf('0x0'));var util=require(_0xabbf('0x1'));var path=require(_0xabbf('0x2'));var timeout=require('connect-timeout');var express=require(_0xabbf('0x3'));var router=express[_0xabbf('0x4')]();var fs_extra=require(_0xabbf('0x5'));var auth=require(_0xabbf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabbf('0x7'));router[_0xabbf('0x8')]('/',auth[_0xabbf('0x9')](),controller[_0xabbf('0xa')]);router[_0xabbf('0x8')](_0xabbf('0xb'),auth[_0xabbf('0x9')](),controller[_0xabbf('0xc')]);router[_0xabbf('0x8')](_0xabbf('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xabbf('0x8')]('/:id/users',auth[_0xabbf('0x9')](),controller['getAgents']);router['get'](_0xabbf('0xe'),auth[_0xabbf('0x9')](),controller[_0xabbf('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xabbf('0x10'),auth['isAuthenticated'](),controller[_0xabbf('0x11')]);router[_0xabbf('0x12')](_0xabbf('0xe'),auth['isAuthenticated'](),controller[_0xabbf('0x13')]);router[_0xabbf('0x14')](_0xabbf('0xd'),auth[_0xabbf('0x9')](),controller[_0xabbf('0x15')]);router[_0xabbf('0x16')](_0xabbf('0xd'),auth['isAuthenticated'](),controller[_0xabbf('0x17')]);router[_0xabbf('0x16')]('/:id/users',auth[_0xabbf('0x9')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0xabbf('0x9')](),controller[_0xabbf('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e0f8731..8e337be 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 _0x965f=['INTEGER','exports','name','VIRTUAL','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x965f,0x182));var _0xf965=function(_0x431c3e,_0x4bab4e){_0x431c3e=_0x431c3e-0x0;var _0x3a47fc=_0x965f[_0x431c3e];return _0x3a47fc;};'use strict';var Sequelize=require('sequelize');module[_0xf965('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf965('0x1')},'prefix':{'type':Sequelize[_0xf965('0x2')],'get':function(_0x5948bc){return'system-'+this['getDataValue'](_0xf965('0x1'))+'-';}},'description':{'type':Sequelize[_0xf965('0x3')]},'callerIdAll':{'type':Sequelize[_0xf965('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0xf965('0x4')]}}; \ No newline at end of file +var _0xf931=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x555687,_0x10d5b8){var _0x5eabd2=function(_0x445018){while(--_0x445018){_0x555687['push'](_0x555687['shift']());}};_0x5eabd2(++_0x10d5b8);}(_0xf931,0xca));var _0x1f93=function(_0x40ef48,_0x1ead5d){_0x40ef48=_0x40ef48-0x0;var _0x3ee6cb=_0xf931[_0x40ef48];return _0x3ee6cb;};'use strict';var Sequelize=require(_0x1f93('0x0'));module[_0x1f93('0x1')]={'name':{'type':Sequelize[_0x1f93('0x2')],'allowNull':![],'unique':_0x1f93('0x3')},'prefix':{'type':Sequelize[_0x1f93('0x4')],'get':function(_0x42b3a5){return _0x1f93('0x5')+this['getDataValue'](_0x1f93('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x1f93('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1f93('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 37d00f6..c1e3cfc 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 _0x5f2f=['VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','transaction','body','get','VoiceExtension','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','appdata','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','context','charAt','prefix','system-','sequelize','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','order','hasOwnProperty','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32dcbd,_0x522a54){_0x32dcbd=_0x32dcbd-0x0;var _0x4d2e4d=_0x5f2f[_0x32dcbd];return _0x4d2e4d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];config[_0xf5f2('0x18')]=_[_0xf5f2('0x19')](config[_0xf5f2('0x18')],{'host':_0xf5f2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x18')]));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);function respondWithStatusCode(_0x1c1a5c,_0x422b55){_0x422b55=_0x422b55||0xcc;return function(_0x4d97fc){if(_0x4d97fc){return _0x1c1a5c[_0xf5f2('0x1d')](_0x422b55);}return _0x1c1a5c[_0xf5f2('0x1e')](_0x422b55)[_0xf5f2('0x1f')]();};}function respondWithResult(_0x1b6dd2,_0x23e23a){_0x23e23a=_0x23e23a||0xc8;return function(_0x3a9dbb){if(_0x3a9dbb){return _0x1b6dd2[_0xf5f2('0x1e')](_0x23e23a)[_0xf5f2('0x20')](_0x3a9dbb);}};}function respondWithFilteredResult(_0x11f702,_0x228ace){return function(_0x20fccd){if(_0x20fccd){var _0x28e097=typeof _0x228ace[_0xf5f2('0x21')]===_0xf5f2('0x22')&&typeof _0x228ace[_0xf5f2('0x23')]===_0xf5f2('0x22');var _0x1bf655=_0x20fccd['count'];var _0x34706d=_0x28e097?0x0:_0x228ace[_0xf5f2('0x21')];var _0x49dac2=_0x28e097?_0x20fccd['count']:_0x228ace[_0xf5f2('0x21')]+_0x228ace[_0xf5f2('0x23')];var _0x4ae323;if(_0x49dac2>=_0x1bf655){_0x49dac2=_0x1bf655;_0x4ae323=0xc8;}else{_0x4ae323=0xce;}_0x11f702[_0xf5f2('0x1e')](_0x4ae323);return _0x11f702[_0xf5f2('0x24')](_0xf5f2('0x25'),_0x34706d+'-'+_0x49dac2+'/'+_0x1bf655)[_0xf5f2('0x20')](_0x20fccd);}return null;};}function patchUpdates(_0x36f1cb){return function(_0x4c691a){try{jsonpatch[_0xf5f2('0x26')](_0x4c691a,_0x36f1cb,!![]);}catch(_0x4669a6){return BPromise[_0xf5f2('0x27')](_0x4669a6);}return _0x4c691a[_0xf5f2('0x28')]();};}function saveUpdates(_0x287ad5,_0x5bdf4a){return function(_0x529f07){if(_0x529f07){return _0x529f07[_0xf5f2('0x29')](_0x287ad5)[_0xf5f2('0x2a')](function(_0x13da6f){return _0x13da6f;});}return null;};}function removeEntity(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(_0x788a8d){return _0x788a8d[_0xf5f2('0x2b')]()[_0xf5f2('0x2a')](function(){var _0x294414=_0x788a8d['get']({'plain':!![]});var _0xaa2602=_0xf5f2('0x2c');return db[_0xf5f2('0x2d')][_0xf5f2('0x2b')]({'where':{'type':_0xaa2602,'resourceId':_0x294414['id']}})[_0xf5f2('0x2a')](function(){return _0x788a8d;});})[_0xf5f2('0x2a')](function(){_0x1a5bb3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22c826,_0x14c829){return function(_0x11c771){if(!_0x11c771){_0x22c826['sendStatus'](0x194);}return _0x11c771;};}function handleError(_0x5a2c7e,_0x29571b){_0x29571b=_0x29571b||0x1f4;return function(_0x50b8a2){logger[_0xf5f2('0x2e')](_0x50b8a2[_0xf5f2('0x2f')]);if(_0x50b8a2[_0xf5f2('0x30')]){delete _0x50b8a2['name'];}_0x5a2c7e['status'](_0x29571b)[_0xf5f2('0x31')](_0x50b8a2);};}exports['index']=function(_0xb744b9,_0x58a4df){var _0x45b643={},_0x31087c={},_0x7b6817={'count':0x0,'rows':[]};var _0x428770=_[_0xf5f2('0x32')](db[_0xf5f2('0x33')][_0xf5f2('0x34')],function(_0x2c0e05){return{'name':_0x2c0e05['fieldName'],'type':_0x2c0e05[_0xf5f2('0x35')][_0xf5f2('0x36')]};});_0x31087c[_0xf5f2('0x37')]=_[_0xf5f2('0x32')](_0x428770,_0xf5f2('0x30'));_0x31087c[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0xb744b9['query']);_0x31087c[_0xf5f2('0x3a')]=_[_0xf5f2('0x3b')](_0x31087c['model'],_0x31087c[_0xf5f2('0x38')]);_0x45b643['attributes']=_[_0xf5f2('0x3b')](_0x31087c[_0xf5f2('0x37')],qs[_0xf5f2('0x3c')](_0xb744b9[_0xf5f2('0x38')]['fields']));_0x45b643['attributes']=_0x45b643[_0xf5f2('0x3d')][_0xf5f2('0x3e')]?_0x45b643[_0xf5f2('0x3d')]:_0x31087c['model'];if(!_0xb744b9[_0xf5f2('0x38')]['hasOwnProperty'](_0xf5f2('0x3f'))){_0x45b643['limit']=qs[_0xf5f2('0x23')](_0xb744b9[_0xf5f2('0x38')]['limit']);_0x45b643[_0xf5f2('0x21')]=qs[_0xf5f2('0x21')](_0xb744b9[_0xf5f2('0x38')][_0xf5f2('0x21')]);}_0x45b643['order']=qs['sort'](_0xb744b9[_0xf5f2('0x38')][_0xf5f2('0x40')]);_0x45b643[_0xf5f2('0x41')]=qs[_0xf5f2('0x3a')](_[_0xf5f2('0x42')](_0xb744b9[_0xf5f2('0x38')],_0x31087c[_0xf5f2('0x3a')]),_0x428770);if(_0xb744b9['query'][_0xf5f2('0x43')]){_0x45b643[_0xf5f2('0x41')]=_['merge'](_0x45b643[_0xf5f2('0x41')],{'$or':_[_0xf5f2('0x32')](_0x428770,function(_0x71b0e7){if(_0x71b0e7[_0xf5f2('0x35')]!==_0xf5f2('0x44')){var _0x3b6372={};_0x3b6372[_0x71b0e7[_0xf5f2('0x30')]]={'$like':'%'+_0xb744b9[_0xf5f2('0x38')]['filter']+'%'};return _0x3b6372;}})});}_0x45b643=_[_0xf5f2('0x45')]({},_0x45b643,_0xb744b9[_0xf5f2('0x46')]);var _0x17a78e={'where':_0x45b643['where']};return db['VoicePrefix']['count'](_0x17a78e)[_0xf5f2('0x2a')](function(_0x2ad13c){_0x7b6817['count']=_0x2ad13c;if(_0xb744b9[_0xf5f2('0x38')][_0xf5f2('0x47')]){_0x45b643[_0xf5f2('0x48')]=[{'all':!![]}];}return db[_0xf5f2('0x33')][_0xf5f2('0x49')](_0x45b643);})[_0xf5f2('0x2a')](function(_0x1a6ec1){_0x7b6817[_0xf5f2('0x4a')]=_0x1a6ec1;return _0x7b6817;})[_0xf5f2('0x2a')](respondWithFilteredResult(_0x58a4df,_0x45b643))[_0xf5f2('0x4b')](handleError(_0x58a4df,null));};exports[_0xf5f2('0x4c')]=function(_0x4773cd,_0x4252a3){var _0x2fb67e={'raw':![],'where':{'id':_0x4773cd[_0xf5f2('0x4d')]['id']}},_0x4faeed={};_0x4faeed['model']=_[_0xf5f2('0x39')](db[_0xf5f2('0x33')][_0xf5f2('0x34')]);_0x4faeed[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0x4773cd[_0xf5f2('0x38')]);_0x4faeed['filters']=_[_0xf5f2('0x3b')](_0x4faeed[_0xf5f2('0x37')],_0x4faeed[_0xf5f2('0x38')]);_0x2fb67e[_0xf5f2('0x3d')]=_[_0xf5f2('0x3b')](_0x4faeed[_0xf5f2('0x37')],qs[_0xf5f2('0x3c')](_0x4773cd[_0xf5f2('0x38')]['fields']));_0x2fb67e[_0xf5f2('0x3d')]=_0x2fb67e[_0xf5f2('0x3d')][_0xf5f2('0x3e')]?_0x2fb67e['attributes']:_0x4faeed[_0xf5f2('0x37')];if(_0x4773cd[_0xf5f2('0x38')][_0xf5f2('0x47')]){_0x2fb67e['include']=[{'all':!![]}];}_0x2fb67e=_['merge']({},_0x2fb67e,_0x4773cd[_0xf5f2('0x46')]);return db[_0xf5f2('0x33')]['find'](_0x2fb67e)[_0xf5f2('0x2a')](handleEntityNotFound(_0x4252a3,null))['then'](respondWithResult(_0x4252a3,null))[_0xf5f2('0x4b')](handleError(_0x4252a3,null));};exports['destroy']=function(_0x2cbd9d,_0x5d9120){return db[_0xf5f2('0x33')][_0xf5f2('0x4e')]({'where':{'id':_0x2cbd9d[_0xf5f2('0x4d')]['id']}})[_0xf5f2('0x2a')](handleEntityNotFound(_0x5d9120,null))['then'](removeEntity(_0x5d9120,null))[_0xf5f2('0x4b')](handleError(_0x5d9120,null));};exports[_0xf5f2('0x4f')]=function(_0x4f6b01,_0x58213b){return db[_0xf5f2('0x33')][_0xf5f2('0x4f')]()['then'](respondWithResult(_0x58213b,null))[_0xf5f2('0x4b')](handleError(_0x58213b,null));};exports[_0xf5f2('0x50')]=function(_0x29c9b6,_0x41b1c7){var _0x5d0db0;return db['sequelize'][_0xf5f2('0x51')](function(_0xa3cc67){return db['VoicePrefix'][_0xf5f2('0x50')](_0x29c9b6[_0xf5f2('0x52')],{'transaction':_0xa3cc67})[_0xf5f2('0x2a')](function(_0x14029e){_0x5d0db0=_0x14029e[_0xf5f2('0x53')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x4e')]({'where':{'id':_0x5d0db0['VoiceExtensionId']},'raw':!![]})['then'](function(_0x330730){return createVoicePrefixExtensions(_0x5d0db0,_0x330730,_0xa3cc67);});});})[_0xf5f2('0x2a')](function(){var _0x3c349f=_0x29c9b6[_0xf5f2('0x55')][_0xf5f2('0x53')]({'plain':!![]});if(!_0x3c349f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c349f[_0xf5f2('0x56')]===_0xf5f2('0x55')){var _0x18b124=_0x5d0db0;return db['UserProfileSection'][_0xf5f2('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c349f[_0xf5f2('0x57')]},'raw':!![]})[_0xf5f2('0x2a')](function(_0x28cce5){if(_0x28cce5&&_0x28cce5[_0xf5f2('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x18b124[_0xf5f2('0x30')],'resourceId':_0x18b124['id'],'type':_0x28cce5['name'],'sectionId':_0x28cce5['id']},{})[_0xf5f2('0x2a')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x4b')](function(_0x572ec1){logger[_0xf5f2('0x2e')](_0xf5f2('0x59'),_0x572ec1);throw _0x572ec1;});}return _0x5d0db0;})[_0xf5f2('0x2a')](respondWithResult(_0x41b1c7,null))['catch'](handleError(_0x41b1c7,null));};function Extension(_0x397b99,_0xcf7a50,_0x42cc27,_0x4579f4){this['context']=_0xf5f2('0x5a');this['exten']=_0x397b99;this[_0xf5f2('0x5b')]=_0x42cc27;this[_0xf5f2('0x35')]=_0xf5f2('0x5c');this[_0xf5f2('0x5d')]=_0xf5f2('0x5e');this['priority']=_0xcf7a50;this[_0xf5f2('0x5f')]=_0x4579f4;}function createVoicePrefixExtensions(_0xacd80,_0x3461e5,_0x212639){return new BPromise(function(_0x2c5733,_0x5359b5){var _0x31e16b=new Extension(formatPrefixName(_0xacd80['prefix']),0x1,'NoOp',_0xf5f2('0x60'));_0x31e16b['VoicePrefixId']=_0xacd80['id'];return db[_0xf5f2('0x54')][_0xf5f2('0x50')](_0x31e16b,{'transaction':_0x212639})[_0xf5f2('0x2a')](function(_0x123b93){var _0x5767fc=_0x123b93[_0xf5f2('0x53')]({'plain':!![]});var _0x3a53f2=_[_0xf5f2('0x32')](addVoicePrefixExtensions(_0xacd80,_0x3461e5),function(_0x18c41f){_0x18c41f[_0xf5f2('0x61')]=_0x5767fc['id'];_0x18c41f[_0xf5f2('0x62')]=_0xacd80['id'];return _0x18c41f;});return db[_0xf5f2('0x54')]['bulkCreate'](_0x3a53f2,{'transaction':_0x212639})[_0xf5f2('0x2a')](function(_0x2d171d){if(!_0x2d171d){return _0x5359b5(_0xf5f2('0x63'));}else{return _0x2c5733(_0x2d171d);}})[_0xf5f2('0x4b')](function(_0x5a5b2b){return _0x5359b5(_0x5a5b2b);});});;});};function addVoicePrefixExtensions(_0x1de396,_0x4cce08){var _0x410866=[];var _0x1c7f06=formatPrefixName(_0x1de396['prefix']);_0x410866[_0xf5f2('0x64')](new Extension(_0x1c7f06,0x2,_0xf5f2('0x65'),_0xf5f2('0x66')+_0x1de396[_0xf5f2('0x30')]));if(_0x1de396[_0xf5f2('0x67')]){_0x410866['push'](new Extension(_0x1c7f06,0x3,_0xf5f2('0x65'),_0xf5f2('0x68')+_0x1de396[_0xf5f2('0x67')]));}else{_0x410866[_0xf5f2('0x64')](new Extension(_0x1c7f06,0x3,_0xf5f2('0x69'),_0xf5f2('0x6a')));}_0x410866['push'](new Extension(_0x1c7f06,0x4,_0xf5f2('0x6b'),_0x4cce08[_0xf5f2('0x6c')]+','+'${EXTEN:'+(0x8+_0x1de396[_0xf5f2('0x30')][_0xf5f2('0x3e')])+'}'+','+0x1));return _0x410866;}function formatPrefixName(_0x377aad){var _0x51a3c7='_';for(var _0x551cc9=0x0;_0x551cc9<_0x377aad['length'];_0x551cc9++){if(_0x377aad[_0xf5f2('0x6d')](_0x551cc9)=='-'){_0x51a3c7+=_0x377aad[_0xf5f2('0x6d')](_0x551cc9);}else{_0x51a3c7+='['+_0x377aad[_0xf5f2('0x6d')](_0x551cc9)+']';}}_0x51a3c7+='.';return _0x51a3c7;}exports[_0xf5f2('0x29')]=function(_0x55da4d,_0x4d878e,_0x278b76){var _0x3a98b4=_0x55da4d[_0xf5f2('0x52')];_0x3a98b4[_0xf5f2('0x6e')]=_0xf5f2('0x6f')+_0x3a98b4[_0xf5f2('0x30')]+'-';return db[_0xf5f2('0x70')][_0xf5f2('0x51')](function(_0x155f45){return db[_0xf5f2('0x33')][_0xf5f2('0x29')](_0x3a98b4,{'where':{'id':_0x3a98b4['id']},'transaction':_0x155f45})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3a98b4['id']},'transaction':_0x155f45})[_0xf5f2('0x2a')](function(){return db[_0xf5f2('0x54')][_0xf5f2('0x4e')]({'where':{'id':_0x3a98b4[_0xf5f2('0x61')]},'raw':!![]})[_0xf5f2('0x2a')](function(_0x5c6959){return createVoicePrefixExtensions(_0x3a98b4,_0x5c6959,_0x155f45);});});});})[_0xf5f2('0x2a')](function(){return db[_0xf5f2('0x33')][_0xf5f2('0x71')](_0x3a98b4['id']);})[_0xf5f2('0x2a')](respondWithResult(_0x4d878e,null))[_0xf5f2('0x4b')](handleError(_0x4d878e,null));};exports['addAgents']=function(_0x2986ed,_0x1409b9,_0x517c15){return db[_0xf5f2('0x33')][_0xf5f2('0x4e')]({'where':{'id':_0x2986ed[_0xf5f2('0x4d')]['id']}})[_0xf5f2('0x2a')](handleEntityNotFound(_0x1409b9,null))['then'](function(_0x40b36e){if(_0x40b36e){return _0x40b36e[_0xf5f2('0x72')](_0x2986ed[_0xf5f2('0x52')][_0xf5f2('0x73')],_[_0xf5f2('0x74')](_0x2986ed['body'],['ids','id'])||{})[_0xf5f2('0x75')](function(_0x30f362){for(var _0x17eb69=0x0;_0x17eb69<_0x2986ed[_0xf5f2('0x52')]['ids']['length'];_0x17eb69+=0x1){socket[_0xf5f2('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x2986ed['body']['ids'][_0x17eb69]),'VoicePrefixId':Number(_0x2986ed['params']['id'])});}return _0x30f362;});}})[_0xf5f2('0x2a')](respondWithResult(_0x1409b9,null))[_0xf5f2('0x4b')](handleError(_0x1409b9,null));};exports[_0xf5f2('0x77')]=function(_0x168092,_0x3de508,_0x9f941e){return db[_0xf5f2('0x33')][_0xf5f2('0x4e')]({'where':{'id':_0x168092[_0xf5f2('0x4d')]['id']}})[_0xf5f2('0x2a')](handleEntityNotFound(_0x3de508,null))[_0xf5f2('0x2a')](function(_0x2afeac){if(_0x2afeac){return _0x2afeac[_0xf5f2('0x77')](_0x168092[_0xf5f2('0x38')][_0xf5f2('0x73')])[_0xf5f2('0x2a')](function(){if(_[_0xf5f2('0x78')](_0x168092[_0xf5f2('0x38')]['ids'])){for(var _0xe7ac8=0x0;_0xe7ac8<_0x168092[_0xf5f2('0x38')][_0xf5f2('0x73')][_0xf5f2('0x3e')];_0xe7ac8+=0x1){socket[_0xf5f2('0x76')](_0xf5f2('0x79'),{'UserId':Number(_0x168092[_0xf5f2('0x38')][_0xf5f2('0x73')][_0xe7ac8]),'VoicePrefixId':Number(_0x168092['params']['id'])});}}else{socket[_0xf5f2('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x168092['query']['ids']),'VoicePrefixId':Number(_0x168092['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3de508,null))['catch'](handleError(_0x3de508,null));};exports[_0xf5f2('0x7a')]=function(_0x18ce86,_0x26a57c,_0x375bc9){var _0x145d4d={};var _0x3cf857={};var _0x5dc63f;var _0x4a0005;return db[_0xf5f2('0x33')]['findOne']({'where':{'id':_0x18ce86[_0xf5f2('0x4d')]['id']}})[_0xf5f2('0x2a')](handleEntityNotFound(_0x26a57c,null))['then'](function(_0x4f3ad4){if(_0x4f3ad4){_0x5dc63f=_0x4f3ad4;_0x3cf857[_0xf5f2('0x37')]=_[_0xf5f2('0x39')](db['User'][_0xf5f2('0x34')]);_0x3cf857[_0xf5f2('0x38')]=_['keys'](_0x18ce86[_0xf5f2('0x38')]);_0x3cf857[_0xf5f2('0x3a')]=_[_0xf5f2('0x3b')](_0x3cf857['model'],_0x3cf857[_0xf5f2('0x38')]);_0x145d4d[_0xf5f2('0x3d')]=_[_0xf5f2('0x3b')](_0x3cf857[_0xf5f2('0x37')],qs[_0xf5f2('0x3c')](_0x18ce86[_0xf5f2('0x38')][_0xf5f2('0x3c')]));_0x145d4d[_0xf5f2('0x3d')]=_0x145d4d[_0xf5f2('0x3d')][_0xf5f2('0x3e')]?_0x145d4d[_0xf5f2('0x3d')]:_0x3cf857[_0xf5f2('0x37')];_0x145d4d[_0xf5f2('0x7b')]=qs[_0xf5f2('0x40')](_0x18ce86[_0xf5f2('0x38')][_0xf5f2('0x40')]);_0x145d4d[_0xf5f2('0x41')]=qs[_0xf5f2('0x3a')](_[_0xf5f2('0x42')](_0x18ce86[_0xf5f2('0x38')],_0x3cf857[_0xf5f2('0x3a')]));if(_0x18ce86['query'][_0xf5f2('0x43')]){_0x145d4d[_0xf5f2('0x41')]=_['merge'](_0x145d4d[_0xf5f2('0x41')],{'$or':_[_0xf5f2('0x32')](_0x145d4d['attributes'],function(_0xb56304){var _0x2f54eb={};_0x2f54eb[_0xb56304]={'$like':'%'+_0x18ce86[_0xf5f2('0x38')]['filter']+'%'};return _0x2f54eb;})});}_0x145d4d=_['merge']({},_0x145d4d,_0x18ce86[_0xf5f2('0x46')]);return _0x5dc63f[_0xf5f2('0x7a')](_0x145d4d);}})[_0xf5f2('0x2a')](function(_0x5ba275){if(_0x5ba275){_0x4a0005=_0x5ba275['length'];if(!_0x18ce86[_0xf5f2('0x38')][_0xf5f2('0x7c')](_0xf5f2('0x3f'))){_0x145d4d['limit']=qs['limit'](_0x18ce86['query']['limit']);_0x145d4d['offset']=qs[_0xf5f2('0x21')](_0x18ce86['query'][_0xf5f2('0x21')]);}return _0x5dc63f[_0xf5f2('0x7a')](_0x145d4d);}})[_0xf5f2('0x2a')](function(_0x43a167){if(_0x43a167){return _0x43a167?{'count':_0x4a0005,'rows':_0x43a167}:null;}})[_0xf5f2('0x2a')](respondWithResult(_0x26a57c,null))[_0xf5f2('0x4b')](handleError(_0x26a57c,null));};exports[_0xf5f2('0x7d')]=function(_0x40e921,_0x3dc051,_0x27ca4a){var _0x1bb4ac={};var _0x36c3c8={};var _0x10c982;var _0x5e69a2;return db[_0xf5f2('0x33')][_0xf5f2('0x7e')]({'where':{'id':_0x40e921['params']['id']}})[_0xf5f2('0x2a')](handleEntityNotFound(_0x3dc051,null))[_0xf5f2('0x2a')](function(_0x537a7d){if(_0x537a7d){_0x10c982=_0x537a7d;_0x36c3c8[_0xf5f2('0x37')]=_[_0xf5f2('0x39')](db[_0xf5f2('0x7f')]['rawAttributes']);_0x36c3c8[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0x40e921['query']);_0x36c3c8[_0xf5f2('0x3a')]=_[_0xf5f2('0x3b')](_0x36c3c8[_0xf5f2('0x37')],_0x36c3c8['query']);_0x1bb4ac[_0xf5f2('0x3d')]=_['intersection'](_0x36c3c8[_0xf5f2('0x37')],qs['fields'](_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x3c')]));_0x1bb4ac[_0xf5f2('0x3d')]=_0x1bb4ac[_0xf5f2('0x3d')]['length']?_0x1bb4ac[_0xf5f2('0x3d')]:_0x36c3c8['model'];_0x1bb4ac['order']=qs['sort'](_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x40')]);_0x1bb4ac['where']=qs[_0xf5f2('0x3a')](_[_0xf5f2('0x42')](_0x40e921[_0xf5f2('0x38')],_0x36c3c8[_0xf5f2('0x3a')]));if(_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x43')]){_0x1bb4ac['where']=_[_0xf5f2('0x45')](_0x1bb4ac[_0xf5f2('0x41')],{'$or':_['map'](_0x1bb4ac[_0xf5f2('0x3d')],function(_0x19cbff){var _0x58042c={};_0x58042c[_0x19cbff]={'$like':'%'+_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x43')]+'%'};return _0x58042c;})});}_0x1bb4ac=_[_0xf5f2('0x45')]({},_0x1bb4ac,_0x40e921[_0xf5f2('0x46')]);return _0x10c982[_0xf5f2('0x7d')](_0x1bb4ac);}})[_0xf5f2('0x2a')](function(_0x4df05c){if(_0x4df05c){_0x5e69a2=_0x4df05c[_0xf5f2('0x3e')];if(!_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x7c')](_0xf5f2('0x3f'))){_0x1bb4ac[_0xf5f2('0x23')]=qs[_0xf5f2('0x23')](_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x23')]);_0x1bb4ac[_0xf5f2('0x21')]=qs['offset'](_0x40e921[_0xf5f2('0x38')][_0xf5f2('0x21')]);}return _0x10c982[_0xf5f2('0x7d')](_0x1bb4ac);}})[_0xf5f2('0x2a')](function(_0x35fe1a){if(_0x35fe1a){return _0x35fe1a?{'count':_0x5e69a2,'rows':_0x35fe1a}:null;}})[_0xf5f2('0x2a')](respondWithResult(_0x3dc051,null))[_0xf5f2('0x4b')](handleError(_0x3dc051,null));};exports[_0xf5f2('0x80')]=function(_0x33cfe7,_0x40d0eb,_0x4c138c){var _0x52e419=_0x33cfe7[_0xf5f2('0x52')][_0xf5f2('0x73')];var _0x28eda5;return db[_0xf5f2('0x7f')]['findAll']({'where':{'id':_0x52e419},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x81')],'as':_0xf5f2('0x82'),'attributes':['id',_0xf5f2('0x30'),_0xf5f2('0x83'),_0xf5f2('0x84'),'interface'],'raw':!![]}]})[_0xf5f2('0x2a')](function(_0x18d727){if(_0x18d727){_0x28eda5=_0x18d727;var _0x4bdb72=_[_0xf5f2('0x85')](_0x18d727,function(_0x3ff714){var _0x2563fa=_0x3ff714[_0xf5f2('0x53')]({'plain':!![]});return _0x2563fa['Agents'];});return db[_0xf5f2('0x33')][_0xf5f2('0x4e')]({'where':{'id':_0x33cfe7[_0xf5f2('0x4d')]['id']}})['then'](function(_0x489d4a){return db[_0xf5f2('0x70')][_0xf5f2('0x51')](function(_0x1432ef){return _0x489d4a[_0xf5f2('0x80')](_0x52e419,{'transaction':_0x1432ef})[_0xf5f2('0x2a')](function(){return BPromise[_0xf5f2('0x86')](_0x28eda5,function(_0x58711d){return db[_0xf5f2('0x87')]['upsert']({'TeamId':_0x58711d['id'],'VoicePrefixId':_0x33cfe7[_0xf5f2('0x4d')]['id']},{'transaction':_0x1432ef});});})[_0xf5f2('0x2a')](function(){return BPromise[_0xf5f2('0x86')](_0x4bdb72,function(_0xa74467){return db[_0xf5f2('0x88')][_0xf5f2('0x89')]({'where':{'UserId':_0xa74467['id'],'VoicePrefixId':_0x33cfe7['params']['id']},'transaction':_0x1432ef});});})[_0xf5f2('0x2a')](function(){_0x4bdb72[_0xf5f2('0x8a')](function(_0x457b53){socket[_0xf5f2('0x76')](_0xf5f2('0x8b'),{'UserId':_0x457b53['id'],'VoicePrefixId':_0x489d4a['id']});});});});});}})[_0xf5f2('0x2a')](respondWithStatusCode(_0x40d0eb,null))[_0xf5f2('0x4b')](handleError(_0x40d0eb,null));};exports['removeTeams']=function(_0x1ee541,_0x4a6b83,_0x5857d1){return db['Team'][_0xf5f2('0x49')]({'where':{'id':_0x1ee541[_0xf5f2('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x81')],'as':_0xf5f2('0x82'),'attributes':['id'],'raw':!![]}]})[_0xf5f2('0x2a')](handleEntityNotFound(_0x4a6b83,null))[_0xf5f2('0x2a')](function(_0x4f2704){var _0x3075b4=_[_0xf5f2('0x32')](_0x4f2704,'id');var _0x10ac11=[];var _0x5d3ca7=[];var _0x29f7bd=squel[_0xf5f2('0x8c')]();_0x29f7bd['field'](_0xf5f2('0x8d'))[_0xf5f2('0x8e')](_0xf5f2('0x8f'),'tq')[_0xf5f2('0x90')](_0xf5f2('0x91'),'ut',_0xf5f2('0x92'))[_0xf5f2('0x41')](_0xf5f2('0x93'),_0x1ee541[_0xf5f2('0x4d')]['id']);for(var _0x4782da=0x0;_0x4782da<_0x4f2704[_0xf5f2('0x3e')];_0x4782da+=0x1){let _0x4b6146=_0x4f2704[_0x4782da];for(var _0x299c53=0x0;_0x299c53<_0x4b6146[_0xf5f2('0x82')]['length'];_0x299c53+=0x1){let _0x2275ba=_0x4b6146['Agents'][_0x299c53];var _0x3b2620=_0x29f7bd[_0xf5f2('0x94')]();_0x3b2620[_0xf5f2('0x41')](_0xf5f2('0x95'),_0x2275ba['id']);_0x5d3ca7['push'](db[_0xf5f2('0x70')]['query'](_0x3b2620[_0xf5f2('0x96')](),{'type':db['sequelize'][_0xf5f2('0x97')][_0xf5f2('0x98')]})['then'](function(_0x2bfc53){if(_0x2bfc53[_0xf5f2('0x3e')]===0x1){return _0x2275ba['id'];}else{var _0x16619b=_[_0xf5f2('0x99')](_[_0xf5f2('0x32')](_0x2bfc53,_0xf5f2('0x9a')),function(_0x54c86e){return _['includes'](_0x3075b4,_0x54c86e);});if(_0x16619b){return _0x2275ba['id'];}}}));}}return BPromise[_0xf5f2('0x9b')](_0x5d3ca7)[_0xf5f2('0x2a')](function(_0x5dc5da){_0x10ac11=_(_0x10ac11)[_0xf5f2('0x9c')](_0x5dc5da)[_0xf5f2('0x9d')]()[_0xf5f2('0x9e')]();return db[_0xf5f2('0x33')][_0xf5f2('0x4e')]({'where':{'id':_0x1ee541[_0xf5f2('0x4d')]['id']}})[_0xf5f2('0x2a')](function(_0x4f9e2d){return db[_0xf5f2('0x70')]['transaction'](function(_0x3ea1aa){return _0x4f9e2d['removeTeams'](_0x1ee541[_0xf5f2('0x38')]['ids'],{'transaction':_0x3ea1aa})[_0xf5f2('0x2a')](function(){if(!_['isEmpty'](_0x10ac11)){return _0x4f9e2d['removeAgents'](_0x10ac11,{'transaction':_0x3ea1aa});}})[_0xf5f2('0x2a')](function(){_0x10ac11[_0xf5f2('0x8a')](function(_0x57708f){socket[_0xf5f2('0x76')](_0xf5f2('0x79'),{'UserId':_0x57708f,'VoicePrefixId':_0x4f9e2d['id']});});});});});});})[_0xf5f2('0x2a')](respondWithStatusCode(_0x4a6b83,null))[_0xf5f2('0x4b')](handleError(_0x4a6b83,null));}; \ No newline at end of file +var _0x5423=['user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','filter','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1c30df,_0x11d569){var _0xecf32c=function(_0x5bab38){while(--_0x5bab38){_0x1c30df['push'](_0x1c30df['shift']());}};_0xecf32c(++_0x11d569);}(_0x5423,0xe3));var _0x3542=function(_0x1ce021,_0x33ad71){_0x1ce021=_0x1ce021-0x0;var _0x1125e9=_0x5423[_0x1ce021];return _0x1125e9;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];config[_0x3542('0x18')]=_[_0x3542('0x19')](config[_0x3542('0x18')],{'host':_0x3542('0x1a'),'port':0x18eb});var socket=require(_0x3542('0x1b'))(new Redis(config[_0x3542('0x18')]));require(_0x3542('0x1c'))['register'](socket);function respondWithStatusCode(_0x14fe57,_0x4fb366){_0x4fb366=_0x4fb366||0xcc;return function(_0x3bfb33){if(_0x3bfb33){return _0x14fe57[_0x3542('0x1d')](_0x4fb366);}return _0x14fe57[_0x3542('0x1e')](_0x4fb366)['end']();};}function respondWithResult(_0x270312,_0x177fb9){_0x177fb9=_0x177fb9||0xc8;return function(_0x347ac8){if(_0x347ac8){return _0x270312['status'](_0x177fb9)[_0x3542('0x1f')](_0x347ac8);}};}function respondWithFilteredResult(_0x23b0de,_0x116859){return function(_0x3d5199){if(_0x3d5199){var _0x493d95=typeof _0x116859[_0x3542('0x20')]==='undefined'&&typeof _0x116859[_0x3542('0x21')]===_0x3542('0x22');var _0x4d93bc=_0x3d5199[_0x3542('0x23')];var _0x199f7d=_0x493d95?0x0:_0x116859[_0x3542('0x20')];var _0x1302fb=_0x493d95?_0x3d5199[_0x3542('0x23')]:_0x116859['offset']+_0x116859['limit'];var _0x4c58f1;if(_0x1302fb>=_0x4d93bc){_0x1302fb=_0x4d93bc;_0x4c58f1=0xc8;}else{_0x4c58f1=0xce;}_0x23b0de[_0x3542('0x1e')](_0x4c58f1);return _0x23b0de['set'](_0x3542('0x24'),_0x199f7d+'-'+_0x1302fb+'/'+_0x4d93bc)['json'](_0x3d5199);}return null;};}function patchUpdates(_0x1d5f1e){return function(_0x55774d){try{jsonpatch['apply'](_0x55774d,_0x1d5f1e,!![]);}catch(_0x3eacd0){return BPromise[_0x3542('0x25')](_0x3eacd0);}return _0x55774d['save']();};}function saveUpdates(_0x5d05b2,_0x3fc964){return function(_0x5123f0){if(_0x5123f0){return _0x5123f0[_0x3542('0x26')](_0x5d05b2)[_0x3542('0x27')](function(_0x1e0723){return _0x1e0723;});}return null;};}function removeEntity(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(_0xf1f7d0){return _0xf1f7d0[_0x3542('0x28')]()[_0x3542('0x27')](function(){var _0x18dc6c=_0xf1f7d0[_0x3542('0x29')]({'plain':!![]});var _0xfdfe62=_0x3542('0x2a');return db[_0x3542('0x2b')][_0x3542('0x28')]({'where':{'type':_0xfdfe62,'resourceId':_0x18dc6c['id']}})[_0x3542('0x27')](function(){return _0xf1f7d0;});})[_0x3542('0x27')](function(){_0x2f2e63[_0x3542('0x1e')](0xcc)[_0x3542('0x2c')]();});}};}function handleEntityNotFound(_0x3bd666,_0x5590a2){return function(_0x31ad47){if(!_0x31ad47){_0x3bd666[_0x3542('0x1d')](0x194);}return _0x31ad47;};}function handleError(_0x2aec76,_0x4a3ad0){_0x4a3ad0=_0x4a3ad0||0x1f4;return function(_0x402c97){logger[_0x3542('0x2d')](_0x402c97[_0x3542('0x2e')]);if(_0x402c97[_0x3542('0x2f')]){delete _0x402c97['name'];}_0x2aec76['status'](_0x4a3ad0)[_0x3542('0x30')](_0x402c97);};}exports[_0x3542('0x31')]=function(_0xd19bf4,_0x44e8f7){var _0x209e7f={},_0x1e5789={},_0x1f43d2={'count':0x0,'rows':[]};var _0x49b18a=_['map'](db[_0x3542('0x32')]['rawAttributes'],function(_0x4ec0c1){return{'name':_0x4ec0c1[_0x3542('0x33')],'type':_0x4ec0c1['type']['key']};});_0x1e5789[_0x3542('0x34')]=_[_0x3542('0x35')](_0x49b18a,_0x3542('0x2f'));_0x1e5789['query']=_[_0x3542('0x36')](_0xd19bf4['query']);_0x1e5789[_0x3542('0x37')]=_[_0x3542('0x38')](_0x1e5789['model'],_0x1e5789[_0x3542('0x39')]);_0x209e7f['attributes']=_[_0x3542('0x38')](_0x1e5789[_0x3542('0x34')],qs[_0x3542('0x3a')](_0xd19bf4['query'][_0x3542('0x3a')]));_0x209e7f['attributes']=_0x209e7f[_0x3542('0x3b')][_0x3542('0x3c')]?_0x209e7f[_0x3542('0x3b')]:_0x1e5789[_0x3542('0x34')];if(!_0xd19bf4[_0x3542('0x39')][_0x3542('0x3d')](_0x3542('0x3e'))){_0x209e7f[_0x3542('0x21')]=qs[_0x3542('0x21')](_0xd19bf4[_0x3542('0x39')][_0x3542('0x21')]);_0x209e7f[_0x3542('0x20')]=qs[_0x3542('0x20')](_0xd19bf4['query'][_0x3542('0x20')]);}_0x209e7f['order']=qs['sort'](_0xd19bf4[_0x3542('0x39')][_0x3542('0x3f')]);_0x209e7f[_0x3542('0x40')]=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0xd19bf4[_0x3542('0x39')],_0x1e5789[_0x3542('0x37')]),_0x49b18a);if(_0xd19bf4[_0x3542('0x39')]['filter']){_0x209e7f[_0x3542('0x40')]=_['merge'](_0x209e7f[_0x3542('0x40')],{'$or':_[_0x3542('0x35')](_0x49b18a,function(_0x57900f){if(_0x57900f[_0x3542('0x42')]!==_0x3542('0x43')){var _0x49d879={};_0x49d879[_0x57900f[_0x3542('0x2f')]]={'$like':'%'+_0xd19bf4[_0x3542('0x39')]['filter']+'%'};return _0x49d879;}})});}_0x209e7f=_[_0x3542('0x44')]({},_0x209e7f,_0xd19bf4[_0x3542('0x45')]);var _0x18c5aa={'where':_0x209e7f[_0x3542('0x40')]};return db[_0x3542('0x32')][_0x3542('0x23')](_0x18c5aa)[_0x3542('0x27')](function(_0x4bf45a){_0x1f43d2['count']=_0x4bf45a;if(_0xd19bf4[_0x3542('0x39')][_0x3542('0x46')]){_0x209e7f[_0x3542('0x47')]=[{'all':!![]}];}return db[_0x3542('0x32')][_0x3542('0x48')](_0x209e7f);})['then'](function(_0x3e6a49){_0x1f43d2['rows']=_0x3e6a49;return _0x1f43d2;})[_0x3542('0x27')](respondWithFilteredResult(_0x44e8f7,_0x209e7f))[_0x3542('0x49')](handleError(_0x44e8f7,null));};exports[_0x3542('0x4a')]=function(_0x5255a3,_0x1ea685){var _0x2c2bb2={'raw':![],'where':{'id':_0x5255a3[_0x3542('0x4b')]['id']}},_0x524925={};_0x524925[_0x3542('0x34')]=_[_0x3542('0x36')](db[_0x3542('0x32')][_0x3542('0x4c')]);_0x524925[_0x3542('0x39')]=_[_0x3542('0x36')](_0x5255a3[_0x3542('0x39')]);_0x524925['filters']=_['intersection'](_0x524925['model'],_0x524925[_0x3542('0x39')]);_0x2c2bb2[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x524925[_0x3542('0x34')],qs[_0x3542('0x3a')](_0x5255a3[_0x3542('0x39')][_0x3542('0x3a')]));_0x2c2bb2['attributes']=_0x2c2bb2[_0x3542('0x3b')][_0x3542('0x3c')]?_0x2c2bb2[_0x3542('0x3b')]:_0x524925[_0x3542('0x34')];if(_0x5255a3['query'][_0x3542('0x46')]){_0x2c2bb2[_0x3542('0x47')]=[{'all':!![]}];}_0x2c2bb2=_['merge']({},_0x2c2bb2,_0x5255a3['options']);return db[_0x3542('0x32')][_0x3542('0x4d')](_0x2c2bb2)[_0x3542('0x27')](handleEntityNotFound(_0x1ea685,null))[_0x3542('0x27')](respondWithResult(_0x1ea685,null))[_0x3542('0x49')](handleError(_0x1ea685,null));};exports[_0x3542('0x28')]=function(_0x42cf91,_0x594189){return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x42cf91[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x594189,null))[_0x3542('0x27')](removeEntity(_0x594189,null))[_0x3542('0x49')](handleError(_0x594189,null));};exports[_0x3542('0x4e')]=function(_0x331506,_0xaf8f1){return db['VoicePrefix']['describe']()[_0x3542('0x27')](respondWithResult(_0xaf8f1,null))['catch'](handleError(_0xaf8f1,null));};exports['create']=function(_0x572e7a,_0x286222){var _0xd5c5c3;return db[_0x3542('0x4f')]['transaction'](function(_0x2db495){return db[_0x3542('0x32')]['create'](_0x572e7a[_0x3542('0x50')],{'transaction':_0x2db495})[_0x3542('0x27')](function(_0x442000){_0xd5c5c3=_0x442000[_0x3542('0x29')]({'plain':!![]});return db[_0x3542('0x51')]['find']({'where':{'id':_0xd5c5c3[_0x3542('0x52')]},'raw':!![]})[_0x3542('0x27')](function(_0x2989c3){return createVoicePrefixExtensions(_0xd5c5c3,_0x2989c3,_0x2db495);});});})[_0x3542('0x27')](function(){var _0xbf9a5=_0x572e7a['user']['get']({'plain':!![]});if(!_0xbf9a5)throw new Error(_0x3542('0x53'));if(_0xbf9a5[_0x3542('0x54')]===_0x3542('0x55')){var _0x5de994=_0xd5c5c3;return db[_0x3542('0x56')][_0x3542('0x4d')]({'where':{'name':_0x3542('0x2a'),'userProfileId':_0xbf9a5[_0x3542('0x57')]},'raw':!![]})[_0x3542('0x27')](function(_0x5d49cc){if(_0x5d49cc&&_0x5d49cc['autoAssociation']===0x0){return db[_0x3542('0x2b')]['create']({'name':_0x5de994[_0x3542('0x2f')],'resourceId':_0x5de994['id'],'type':_0x5d49cc[_0x3542('0x2f')],'sectionId':_0x5d49cc['id']},{})['then'](function(){return _0xd5c5c3;});}else{return _0xd5c5c3;}})[_0x3542('0x49')](function(_0x422535){logger[_0x3542('0x2d')](_0x3542('0x58'),_0x422535);throw _0x422535;});}return _0xd5c5c3;})[_0x3542('0x27')](respondWithResult(_0x286222,null))['catch'](handleError(_0x286222,null));};function Extension(_0x4cb73f,_0x271dd0,_0x56b920,_0x1ffa0a){this[_0x3542('0x59')]=_0x3542('0x5a');this['exten']=_0x4cb73f;this[_0x3542('0x5b')]=_0x56b920;this[_0x3542('0x42')]=_0x3542('0x5c');this[_0x3542('0x5d')]=_0x3542('0x5e');this[_0x3542('0x5f')]=_0x271dd0;this['appdata']=_0x1ffa0a;}function createVoicePrefixExtensions(_0x2e75a1,_0x3ee446,_0x44c95a){return new BPromise(function(_0x411de1,_0x302bed){var _0x43dd32=new Extension(formatPrefixName(_0x2e75a1['prefix']),0x1,_0x3542('0x60'),_0x3542('0x61'));_0x43dd32[_0x3542('0x62')]=_0x2e75a1['id'];return db[_0x3542('0x51')]['create'](_0x43dd32,{'transaction':_0x44c95a})[_0x3542('0x27')](function(_0x2bb95c){var _0x5349a8=_0x2bb95c['get']({'plain':!![]});var _0x2908e5=_['map'](addVoicePrefixExtensions(_0x2e75a1,_0x3ee446),function(_0x3be40e){_0x3be40e['VoiceExtensionId']=_0x5349a8['id'];_0x3be40e['VoicePrefixId']=_0x2e75a1['id'];return _0x3be40e;});return db[_0x3542('0x51')][_0x3542('0x63')](_0x2908e5,{'transaction':_0x44c95a})[_0x3542('0x27')](function(_0x3bba0d){if(!_0x3bba0d){return _0x302bed(_0x3542('0x64'));}else{return _0x411de1(_0x3bba0d);}})[_0x3542('0x49')](function(_0x32b137){return _0x302bed(_0x32b137);});});;});};function addVoicePrefixExtensions(_0x557c5c,_0x365947){var _0xf1cf57=[];var _0x16faf1=formatPrefixName(_0x557c5c[_0x3542('0x65')]);_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x2,'Set',_0x3542('0x67')+_0x557c5c[_0x3542('0x2f')]));if(_0x557c5c[_0x3542('0x68')]){_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x3,_0x3542('0x69'),_0x3542('0x6a')+_0x557c5c[_0x3542('0x68')]));}else{_0xf1cf57['push'](new Extension(_0x16faf1,0x3,_0x3542('0x60'),'No\x20callerid\x20available'));}_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x4,_0x3542('0x6b'),_0x365947[_0x3542('0x59')]+','+_0x3542('0x6c')+(0x8+_0x557c5c['name']['length'])+'}'+','+0x1));return _0xf1cf57;}function formatPrefixName(_0x5b3d44){var _0x2f36c6='_';for(var _0x349a9e=0x0;_0x349a9e<_0x5b3d44[_0x3542('0x3c')];_0x349a9e++){if(_0x5b3d44[_0x3542('0x6d')](_0x349a9e)=='-'){_0x2f36c6+=_0x5b3d44[_0x3542('0x6d')](_0x349a9e);}else{_0x2f36c6+='['+_0x5b3d44[_0x3542('0x6d')](_0x349a9e)+']';}}_0x2f36c6+='.';return _0x2f36c6;}exports[_0x3542('0x26')]=function(_0x77f0af,_0x2b0de0,_0x5c8061){var _0x37ce35=_0x77f0af[_0x3542('0x50')];_0x37ce35[_0x3542('0x65')]=_0x3542('0x6e')+_0x37ce35[_0x3542('0x2f')]+'-';return db['sequelize']['transaction'](function(_0x51b83c){return db[_0x3542('0x32')]['update'](_0x37ce35,{'where':{'id':_0x37ce35['id']},'transaction':_0x51b83c})[_0x3542('0x27')](function(){return db['VoiceExtension'][_0x3542('0x28')]({'where':{'VoicePrefixId':_0x37ce35['id']},'transaction':_0x51b83c})['then'](function(){return db[_0x3542('0x51')][_0x3542('0x4d')]({'where':{'id':_0x37ce35['VoiceExtensionId']},'raw':!![]})['then'](function(_0x5488f8){return createVoicePrefixExtensions(_0x37ce35,_0x5488f8,_0x51b83c);});});});})[_0x3542('0x27')](function(){return db['VoicePrefix'][_0x3542('0x6f')](_0x37ce35['id']);})[_0x3542('0x27')](respondWithResult(_0x2b0de0,null))['catch'](handleError(_0x2b0de0,null));};exports[_0x3542('0x70')]=function(_0x345082,_0x12d32a,_0x51d0a8){return db[_0x3542('0x32')]['find']({'where':{'id':_0x345082[_0x3542('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12d32a,null))[_0x3542('0x27')](function(_0xf10a99){if(_0xf10a99){return _0xf10a99[_0x3542('0x70')](_0x345082['body'][_0x3542('0x71')],_[_0x3542('0x72')](_0x345082[_0x3542('0x50')],[_0x3542('0x71'),'id'])||{})['spread'](function(_0x5b2016){for(var _0x3f9cdb=0x0;_0x3f9cdb<_0x345082[_0x3542('0x50')][_0x3542('0x71')][_0x3542('0x3c')];_0x3f9cdb+=0x1){socket[_0x3542('0x73')](_0x3542('0x74'),{'UserId':Number(_0x345082[_0x3542('0x50')][_0x3542('0x71')][_0x3f9cdb]),'VoicePrefixId':Number(_0x345082[_0x3542('0x4b')]['id'])});}return _0x5b2016;});}})[_0x3542('0x27')](respondWithResult(_0x12d32a,null))[_0x3542('0x49')](handleError(_0x12d32a,null));};exports[_0x3542('0x75')]=function(_0x23f092,_0x8a72fb,_0x33719d){return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x23f092[_0x3542('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8a72fb,null))[_0x3542('0x27')](function(_0x10f7d2){if(_0x10f7d2){return _0x10f7d2['removeAgents'](_0x23f092['query'][_0x3542('0x71')])[_0x3542('0x27')](function(){if(_[_0x3542('0x76')](_0x23f092[_0x3542('0x39')]['ids'])){for(var _0x263ff6=0x0;_0x263ff6<_0x23f092[_0x3542('0x39')]['ids'][_0x3542('0x3c')];_0x263ff6+=0x1){socket['emit'](_0x3542('0x77'),{'UserId':Number(_0x23f092['query'][_0x3542('0x71')][_0x263ff6]),'VoicePrefixId':Number(_0x23f092[_0x3542('0x4b')]['id'])});}}else{socket[_0x3542('0x73')](_0x3542('0x77'),{'UserId':Number(_0x23f092[_0x3542('0x39')][_0x3542('0x71')]),'VoicePrefixId':Number(_0x23f092[_0x3542('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x8a72fb,null))[_0x3542('0x49')](handleError(_0x8a72fb,null));};exports['getAgents']=function(_0x55c2a7,_0x3c47c1,_0x1a9a73){var _0x2c6f2b={};var _0x40c19c={};var _0x593bf1;var _0x468804;return db[_0x3542('0x32')][_0x3542('0x78')]({'where':{'id':_0x55c2a7[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x3c47c1,null))[_0x3542('0x27')](function(_0x1bc57f){if(_0x1bc57f){_0x593bf1=_0x1bc57f;_0x40c19c[_0x3542('0x34')]=_[_0x3542('0x36')](db[_0x3542('0x79')]['rawAttributes']);_0x40c19c['query']=_[_0x3542('0x36')](_0x55c2a7['query']);_0x40c19c[_0x3542('0x37')]=_[_0x3542('0x38')](_0x40c19c[_0x3542('0x34')],_0x40c19c['query']);_0x2c6f2b[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x40c19c[_0x3542('0x34')],qs['fields'](_0x55c2a7[_0x3542('0x39')]['fields']));_0x2c6f2b[_0x3542('0x3b')]=_0x2c6f2b[_0x3542('0x3b')][_0x3542('0x3c')]?_0x2c6f2b['attributes']:_0x40c19c[_0x3542('0x34')];_0x2c6f2b['order']=qs[_0x3542('0x3f')](_0x55c2a7['query']['sort']);_0x2c6f2b[_0x3542('0x40')]=qs[_0x3542('0x37')](_['pick'](_0x55c2a7[_0x3542('0x39')],_0x40c19c['filters']));if(_0x55c2a7[_0x3542('0x39')]['filter']){_0x2c6f2b[_0x3542('0x40')]=_[_0x3542('0x44')](_0x2c6f2b[_0x3542('0x40')],{'$or':_[_0x3542('0x35')](_0x2c6f2b[_0x3542('0x3b')],function(_0x4accdb){var _0x40ad35={};_0x40ad35[_0x4accdb]={'$like':'%'+_0x55c2a7[_0x3542('0x39')][_0x3542('0x7a')]+'%'};return _0x40ad35;})});}_0x2c6f2b=_['merge']({},_0x2c6f2b,_0x55c2a7[_0x3542('0x45')]);return _0x593bf1[_0x3542('0x7b')](_0x2c6f2b);}})[_0x3542('0x27')](function(_0x32a91e){if(_0x32a91e){_0x468804=_0x32a91e[_0x3542('0x3c')];if(!_0x55c2a7[_0x3542('0x39')][_0x3542('0x3d')]('nolimit')){_0x2c6f2b[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x55c2a7['query']['limit']);_0x2c6f2b['offset']=qs[_0x3542('0x20')](_0x55c2a7[_0x3542('0x39')][_0x3542('0x20')]);}return _0x593bf1[_0x3542('0x7b')](_0x2c6f2b);}})[_0x3542('0x27')](function(_0x47a913){if(_0x47a913){return _0x47a913?{'count':_0x468804,'rows':_0x47a913}:null;}})['then'](respondWithResult(_0x3c47c1,null))[_0x3542('0x49')](handleError(_0x3c47c1,null));};exports['getTeams']=function(_0x41157c,_0x446817,_0x1d275b){var _0x7c8e51={};var _0x5912ef={};var _0x4737ee;var _0x40fa0d;return db[_0x3542('0x32')][_0x3542('0x78')]({'where':{'id':_0x41157c[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x446817,null))[_0x3542('0x27')](function(_0x5481e9){if(_0x5481e9){_0x4737ee=_0x5481e9;_0x5912ef['model']=_[_0x3542('0x36')](db['Team'][_0x3542('0x4c')]);_0x5912ef[_0x3542('0x39')]=_[_0x3542('0x36')](_0x41157c[_0x3542('0x39')]);_0x5912ef['filters']=_[_0x3542('0x38')](_0x5912ef[_0x3542('0x34')],_0x5912ef['query']);_0x7c8e51[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x5912ef[_0x3542('0x34')],qs[_0x3542('0x3a')](_0x41157c[_0x3542('0x39')][_0x3542('0x3a')]));_0x7c8e51[_0x3542('0x3b')]=_0x7c8e51['attributes']['length']?_0x7c8e51[_0x3542('0x3b')]:_0x5912ef['model'];_0x7c8e51['order']=qs['sort'](_0x41157c[_0x3542('0x39')][_0x3542('0x3f')]);_0x7c8e51['where']=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0x41157c[_0x3542('0x39')],_0x5912ef[_0x3542('0x37')]));if(_0x41157c[_0x3542('0x39')]['filter']){_0x7c8e51[_0x3542('0x40')]=_['merge'](_0x7c8e51[_0x3542('0x40')],{'$or':_['map'](_0x7c8e51[_0x3542('0x3b')],function(_0x32b2d1){var _0x4ad1e2={};_0x4ad1e2[_0x32b2d1]={'$like':'%'+_0x41157c['query'][_0x3542('0x7a')]+'%'};return _0x4ad1e2;})});}_0x7c8e51=_['merge']({},_0x7c8e51,_0x41157c[_0x3542('0x45')]);return _0x4737ee[_0x3542('0x7c')](_0x7c8e51);}})[_0x3542('0x27')](function(_0x2f86ef){if(_0x2f86ef){_0x40fa0d=_0x2f86ef['length'];if(!_0x41157c[_0x3542('0x39')]['hasOwnProperty'](_0x3542('0x3e'))){_0x7c8e51[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x41157c[_0x3542('0x39')][_0x3542('0x21')]);_0x7c8e51[_0x3542('0x20')]=qs[_0x3542('0x20')](_0x41157c[_0x3542('0x39')]['offset']);}return _0x4737ee[_0x3542('0x7c')](_0x7c8e51);}})[_0x3542('0x27')](function(_0x97014){if(_0x97014){return _0x97014?{'count':_0x40fa0d,'rows':_0x97014}:null;}})[_0x3542('0x27')](respondWithResult(_0x446817,null))[_0x3542('0x49')](handleError(_0x446817,null));};exports[_0x3542('0x7d')]=function(_0x903746,_0x363be1,_0x537baf){var _0x40f0ea=_0x903746[_0x3542('0x50')][_0x3542('0x71')];var _0x43c45a;return db[_0x3542('0x7e')]['findAll']({'where':{'id':_0x40f0ea},'attributes':['id'],'include':[{'model':db[_0x3542('0x79')],'as':_0x3542('0x7f'),'attributes':['id',_0x3542('0x2f'),_0x3542('0x80'),_0x3542('0x81'),_0x3542('0x82')],'raw':!![]}]})['then'](function(_0x2dccea){if(_0x2dccea){_0x43c45a=_0x2dccea;var _0x404b41=_[_0x3542('0x83')](_0x2dccea,function(_0x3f4459){var _0x39fda0=_0x3f4459['get']({'plain':!![]});return _0x39fda0[_0x3542('0x7f')];});return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x903746['params']['id']}})[_0x3542('0x27')](function(_0x3517aa){return db[_0x3542('0x4f')][_0x3542('0x84')](function(_0x5be1ce){return _0x3517aa[_0x3542('0x7d')](_0x40f0ea,{'transaction':_0x5be1ce})[_0x3542('0x27')](function(){return BPromise[_0x3542('0x85')](_0x43c45a,function(_0x4e5ca6){return db['TeamVoicePrefix'][_0x3542('0x86')]({'TeamId':_0x4e5ca6['id'],'VoicePrefixId':_0x903746[_0x3542('0x4b')]['id']},{'transaction':_0x5be1ce});});})[_0x3542('0x27')](function(){return BPromise[_0x3542('0x85')](_0x404b41,function(_0xdd4842){return db[_0x3542('0x87')]['findOrCreate']({'where':{'UserId':_0xdd4842['id'],'VoicePrefixId':_0x903746[_0x3542('0x4b')]['id']},'transaction':_0x5be1ce});});})[_0x3542('0x27')](function(){_0x404b41[_0x3542('0x88')](function(_0x51d0bb){socket[_0x3542('0x73')](_0x3542('0x74'),{'UserId':_0x51d0bb['id'],'VoicePrefixId':_0x3517aa['id']});});});});});}})[_0x3542('0x27')](respondWithStatusCode(_0x363be1,null))[_0x3542('0x49')](handleError(_0x363be1,null));};exports[_0x3542('0x89')]=function(_0x1ab57e,_0x299d11,_0x1e2111){return db[_0x3542('0x7e')]['findAll']({'where':{'id':_0x1ab57e[_0x3542('0x39')][_0x3542('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3542('0x79')],'as':_0x3542('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x3542('0x27')](handleEntityNotFound(_0x299d11,null))['then'](function(_0x1c0bfd){var _0x2f3ad3=_[_0x3542('0x35')](_0x1c0bfd,'id');var _0x30a535=[];var _0x1fdf10=[];var _0x415044=squel[_0x3542('0x8a')]();_0x415044[_0x3542('0x8b')]('tq.TeamId')[_0x3542('0x8c')](_0x3542('0x8d'),'tq')[_0x3542('0x8e')](_0x3542('0x8f'),'ut',_0x3542('0x90'))[_0x3542('0x40')](_0x3542('0x91'),_0x1ab57e[_0x3542('0x4b')]['id']);for(var _0x5afb14=0x0;_0x5afb14<_0x1c0bfd['length'];_0x5afb14+=0x1){let _0x404cf0=_0x1c0bfd[_0x5afb14];for(var _0x1e9d45=0x0;_0x1e9d45<_0x404cf0[_0x3542('0x7f')]['length'];_0x1e9d45+=0x1){let _0x5c2675=_0x404cf0[_0x3542('0x7f')][_0x1e9d45];var _0x57859a=_0x415044[_0x3542('0x92')]();_0x57859a['where'](_0x3542('0x93'),_0x5c2675['id']);_0x1fdf10[_0x3542('0x66')](db[_0x3542('0x4f')][_0x3542('0x39')](_0x57859a[_0x3542('0x94')](),{'type':db[_0x3542('0x4f')][_0x3542('0x95')][_0x3542('0x96')]})[_0x3542('0x27')](function(_0x518344){if(_0x518344[_0x3542('0x3c')]===0x1){return _0x5c2675['id'];}else{var _0x5d9869=_['every'](_[_0x3542('0x35')](_0x518344,_0x3542('0x97')),function(_0x5927a7){return _[_0x3542('0x98')](_0x2f3ad3,_0x5927a7);});if(_0x5d9869){return _0x5c2675['id'];}}}));}}return BPromise[_0x3542('0x99')](_0x1fdf10)[_0x3542('0x27')](function(_0x2da3a5){_0x30a535=_(_0x30a535)['union'](_0x2da3a5)[_0x3542('0x9a')]()['value']();return db['VoicePrefix'][_0x3542('0x4d')]({'where':{'id':_0x1ab57e[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](function(_0x51ac4a){return db[_0x3542('0x4f')]['transaction'](function(_0x32712f){return _0x51ac4a[_0x3542('0x89')](_0x1ab57e[_0x3542('0x39')][_0x3542('0x71')],{'transaction':_0x32712f})[_0x3542('0x27')](function(){if(!_[_0x3542('0x9b')](_0x30a535)){return _0x51ac4a[_0x3542('0x75')](_0x30a535,{'transaction':_0x32712f});}})[_0x3542('0x27')](function(){_0x30a535[_0x3542('0x88')](function(_0x5815b5){socket[_0x3542('0x73')](_0x3542('0x77'),{'UserId':_0x5815b5,'VoicePrefixId':_0x51ac4a['id']});});});});});});})['then'](respondWithStatusCode(_0x299d11,null))[_0x3542('0x49')](handleError(_0x299d11,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 20fd1b8..4b84f3c 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 _0x71ce=['save','update','remove','emit','hasOwnProperty','hook','events','VoicePrefix'];(function(_0x8b2af5,_0x288c9e){var _0x298e75=function(_0x35a253){while(--_0x35a253){_0x8b2af5['push'](_0x8b2af5['shift']());}};_0x298e75(++_0x288c9e);}(_0x71ce,0x15e));var _0xe71c=function(_0x66197d,_0x6059ef){_0x66197d=_0x66197d-0x0;var _0x147328=_0x71ce[_0x66197d];return _0x147328;};'use strict';var EventEmitter=require(_0xe71c('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe71c('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe71c('0x2'),'afterUpdate':_0xe71c('0x3'),'afterDestroy':_0xe71c('0x4')};function emitEvent(_0x341570){return function(_0x525315,_0x319a7f,_0x45f5f7){VoicePrefixEvents[_0xe71c('0x5')](_0x341570+':'+_0x525315['id'],_0x525315);VoicePrefixEvents[_0xe71c('0x5')](_0x341570,_0x525315);_0x45f5f7(null);};}for(var e in events){if(events[_0xe71c('0x6')](e)){var event=events[e];VoicePrefix[_0xe71c('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x6f59=['hook','exports','VoicePrefix','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f59,0x128));var _0x96f5=function(_0x5ad024,_0x3b54e6){_0x5ad024=_0x5ad024-0x0;var _0xa24b7d=_0x6f59[_0x5ad024];return _0xa24b7d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x96f5('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96f5('0x1'),'afterUpdate':'update','afterDestroy':_0x96f5('0x2')};function emitEvent(_0x240775){return function(_0x421e5f,_0x29a576,_0xd68ede){VoicePrefixEvents[_0x96f5('0x3')](_0x240775+':'+_0x421e5f['id'],_0x421e5f);VoicePrefixEvents[_0x96f5('0x3')](_0x240775,_0x421e5f);_0xd68ede(null);};}for(var e in events){if(events[_0x96f5('0x4')](e)){var event=events[e];VoicePrefix[_0x96f5('0x5')](e,emitEvent(event));}}module[_0x96f5('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 5571d44..c1dfea9 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 _0xdfe6=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','voice_prefixes','lodash'];(function(_0x3ba527,_0x446a5e){var _0x5ee6ad=function(_0x5978c7){while(--_0x5978c7){_0x3ba527['push'](_0x3ba527['shift']());}};_0x5ee6ad(++_0x446a5e);}(_0xdfe6,0x103));var _0x6dfe=function(_0x24a0f3,_0x2f3652){_0x24a0f3=_0x24a0f3-0x0;var _0x130249=_0xdfe6[_0x24a0f3];return _0x130249;};'use strict';var _=require(_0x6dfe('0x0'));var util=require(_0x6dfe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6dfe('0x2'));var BPromise=require(_0x6dfe('0x3'));var rp=require(_0x6dfe('0x4'));var fs=require('fs');var path=require(_0x6dfe('0x5'));var rimraf=require(_0x6dfe('0x6'));var config=require(_0x6dfe('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x6dfe('0x8')]=function(_0x158a69,_0x57f917){return _0x158a69['define']('VoicePrefix',attributes,{'tableName':_0x6dfe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe635=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util'];(function(_0x29d40e,_0x50bf76){var _0x258106=function(_0x5b3884){while(--_0x5b3884){_0x29d40e['push'](_0x29d40e['shift']());}};_0x258106(++_0x50bf76);}(_0xe635,0x178));var _0x5e63=function(_0x21e591,_0x40612d){_0x21e591=_0x21e591-0x0;var _0x4c3223=_0xe635[_0x21e591];return _0x4c3223;};'use strict';var _=require('lodash');var util=require(_0x5e63('0x0'));var logger=require(_0x5e63('0x1'))(_0x5e63('0x2'));var moment=require(_0x5e63('0x3'));var BPromise=require(_0x5e63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e63('0x5'));var rimraf=require(_0x5e63('0x6'));var config=require(_0x5e63('0x7'));var attributes=require(_0x5e63('0x8'));module[_0x5e63('0x9')]=function(_0x12631d,_0x5ce698){return _0x12631d[_0x5e63('0xa')](_0x5e63('0xb'),attributes,{'tableName':_0x5e63('0xc'),'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 a2a319c..397b2b8 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 _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x54b366,_0x3beb7b){var _0x8210aa=function(_0x26935b){while(--_0x26935b){_0x54b366['push'](_0x54b366['shift']());}};_0x8210aa(++_0x3beb7b);}(_0x5c3c,0x132));var _0xc5c3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5c3c[_0x3ab9ee];return _0x82ee88;};'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});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file +var _0x4253=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4253,0x14c));var _0x3425=function(_0x49446d,_0x116bff){_0x49446d=_0x49446d-0x0;var _0x2bb11b=_0x4253[_0x49446d];return _0x2bb11b;};'use strict';var _=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var moment=require('moment');var BPromise=require(_0x3425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3425('0x3'));var db=require(_0x3425('0x4'))['db'];var utils=require(_0x3425('0x5'));var logger=require(_0x3425('0x6'))(_0x3425('0x7'));var config=require(_0x3425('0x8'));var jayson=require(_0x3425('0x9'));var client=jayson[_0x3425('0xa')][_0x3425('0xb')]({'port':0x232a});config['redis']=_[_0x3425('0xc')](config[_0x3425('0xd')],{'host':_0x3425('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3425('0xd')]));require(_0x3425('0xf'))['register'](socket);function respondWithRpcPromise(_0x21c54d,_0x562e27,_0x5bcbf0){return new BPromise(function(_0x528436,_0x196d62){return client[_0x3425('0x10')](_0x21c54d,_0x5bcbf0)[_0x3425('0x11')](function(_0x5788e7){logger[_0x3425('0x12')](_0x3425('0x13'),_0x562e27,_0x3425('0x14'));logger['debug'](_0x3425('0x15'),_0x562e27,_0x3425('0x14'),JSON[_0x3425('0x16')](_0x5788e7));if(_0x5788e7[_0x3425('0x17')]){if(_0x5788e7[_0x3425('0x17')][_0x3425('0x18')]===0x1f4){logger[_0x3425('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x562e27,_0x5788e7[_0x3425('0x17')]['message']);return _0x196d62(_0x5788e7[_0x3425('0x17')][_0x3425('0x19')]);}logger['error'](_0x3425('0x13'),_0x562e27,_0x5788e7[_0x3425('0x17')]['message']);return _0x528436(_0x5788e7[_0x3425('0x17')]['message']);}else{logger[_0x3425('0x12')](_0x3425('0x13'),_0x562e27,_0x3425('0x14'));_0x528436(_0x5788e7[_0x3425('0x1a')]['message']);}})[_0x3425('0x1b')](function(_0x5a5876){logger[_0x3425('0x17')](_0x3425('0x13'),_0x562e27,_0x5a5876);_0x196d62(_0x5a5876);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e196b91..398c579 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 _0x18a9=['removeListener','register','length','voicePrefix:','remove','update','emit'];(function(_0xb80d4c,_0x275396){var _0x4cc7e8=function(_0xf2cede){while(--_0xf2cede){_0xb80d4c['push'](_0xb80d4c['shift']());}};_0x4cc7e8(++_0x275396);}(_0x18a9,0x15b));var _0x918a=function(_0x2b3c9d,_0x1c8c0c){_0x2b3c9d=_0x2b3c9d-0x0;var _0x4b8037=_0x18a9[_0x2b3c9d];return _0x4b8037;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x918a('0x0'),_0x918a('0x1')];function createListener(_0x218509,_0x2bd3b8){return function(_0x256789){_0x2bd3b8[_0x918a('0x2')](_0x218509,_0x256789);};}function removeListener(_0x3b9fbf,_0x2a91aa){return function(){VoicePrefixEvents[_0x918a('0x3')](_0x3b9fbf,_0x2a91aa);};}exports[_0x918a('0x4')]=function(_0x45099e){for(var _0x39ca9c=0x0,_0x492c39=events[_0x918a('0x5')];_0x39ca9c<_0x492c39;_0x39ca9c++){var _0x266256=events[_0x39ca9c];var _0x51caca=createListener(_0x918a('0x6')+_0x266256,_0x45099e);VoicePrefixEvents['on'](_0x266256,_0x51caca);}}; \ No newline at end of file +var _0x7217=['voicePrefix:','remove','emit','removeListener','register','length'];(function(_0x4afce0,_0x12efd1){var _0x611887=function(_0x5caa97){while(--_0x5caa97){_0x4afce0['push'](_0x4afce0['shift']());}};_0x611887(++_0x12efd1);}(_0x7217,0xa9));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x7721('0x0'),'update'];function createListener(_0x105754,_0xec5d3f){return function(_0x308464){_0xec5d3f[_0x7721('0x1')](_0x105754,_0x308464);};}function removeListener(_0x363be8,_0x41f292){return function(){VoicePrefixEvents[_0x7721('0x2')](_0x363be8,_0x41f292);};}exports[_0x7721('0x3')]=function(_0xb646e7){for(var _0x4d935b=0x0,_0x560535=events[_0x7721('0x4')];_0x4d935b<_0x560535;_0x4d935b++){var _0x2ddbba=events[_0x4d935b];var _0x7add4f=createListener(_0x7721('0x5')+_0x2ddbba,_0xb646e7);VoicePrefixEvents['on'](_0x2ddbba,_0x7add4f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c385a9b..0e078c3 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c1820,_0x18bb79){_0x1c1820=_0x1c1820-0x0;var _0x6690e6=_0xb10b[_0x1c1820];return _0x6690e6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x13c0a2,_0x38eedb){var _0x12bd36=function(_0x5654f7){while(--_0x5654f7){_0x13c0a2['push'](_0x13c0a2['shift']());}};_0x12bd36(++_0x38eedb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index fcb60c3..110a93d 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 _0x6eb1=['strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','inbound','outbound','leastrecent','fewestcalls','wrandom','rrordered','ringall','setDataValue','rrmemory','getDataValue','type','dialMethod'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x6eb1,0x181));var _0x16eb=function(_0xb5e37f,_0xc624f1){_0xb5e37f=_0xb5e37f-0x0;var _0x23f431=_0x6eb1[_0xb5e37f];return _0x23f431;};'use strict';var Sequelize=require(_0x16eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x16eb('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x3'),_0x16eb('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x16eb('0x2')]('rr','ringall',_0x16eb('0x5'),_0x16eb('0x6'),'random','rrmemory','linear',_0x16eb('0x7'),_0x16eb('0x8')),'allowNull':![],'defaultValue':_0x16eb('0x9'),'set':function(_0x14c08d){this[_0x16eb('0xa')]('strategy',_0x14c08d?_0x14c08d:_0x16eb('0xb'));},'get':function(){var _0x495fcb=this[_0x16eb('0xc')](_0x16eb('0xd'));var _0x13f99e=this[_0x16eb('0xc')](_0x16eb('0xe'));var _0x572204=this[_0x16eb('0xc')](_0x16eb('0xf'));if(_0x495fcb===_0x16eb('0x3')){return _0x572204;}if(_0x13f99e===_0x16eb('0x10')&&_0x572204===_0x16eb('0xb')||_0x13f99e===_0x16eb('0x10')&&_0x572204===_0x16eb('0x11')){return _0x572204;}if(_0x13f99e===_0x16eb('0x12')||_0x13f99e===_0x16eb('0x13')||_0x13f99e===_0x16eb('0x14')){return _0x572204;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x16eb('0x15')](0xb)},'timeout':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x16eb('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':_0x16eb('0x16')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x16eb('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x16eb('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x16eb('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x16eb('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x16eb('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x16eb('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x16eb('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':_0x16eb('0x16')},'announce_holdtime':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no',_0x16eb('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x16eb('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x16eb('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x16eb('0x1')]},'queue_youarenext':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x16eb('0x1')]},'queue_quantity1':{'type':Sequelize[_0x16eb('0x1')]},'queue_quantity2':{'type':Sequelize[_0x16eb('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x16eb('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2c2314){this[_0x16eb('0xa')](_0x16eb('0x19'),_0x2c2314?_0x2c2314[_0x16eb('0x1a')](','):[]);},'get':function(){return this[_0x16eb('0xc')](_0x16eb('0x19'))?this[_0x16eb('0xc')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':_0x16eb('0x16'),'set':function(_0x2d5878){this[_0x16eb('0xa')](_0x16eb('0x1b'),_0x2d5878?_0x2d5878[_0x16eb('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x16eb('0xc')]('joinempty')[_0x16eb('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':'no','set':function(_0x17f82f){this['setDataValue'](_0x16eb('0x1d'),_0x17f82f?_0x17f82f['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x16eb('0x1d'))?this[_0x16eb('0xc')](_0x16eb('0x1d'))[_0x16eb('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x16eb('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x16eb('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x16eb('0x1')]},'acw':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':0x0,'set':function(_0x34363a){this[_0x16eb('0xa')](_0x16eb('0x1f'),_0x34363a);if(_0x34363a){if(this[_0x16eb('0xc')]('wrapuptime')<0x2){this[_0x16eb('0xa')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x16eb('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':0x0,'comment':_0x16eb('0x20')},'dialMethod':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x21'),_0x16eb('0x12'),_0x16eb('0x14'),_0x16eb('0x13'),'booked'),'defaultValue':_0x16eb('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x16eb('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x16eb('0x22')},'dialLimitQueue':{'type':Sequelize[_0x16eb('0x15')](0x4)[_0x16eb('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x16eb('0x24')](0x2)[_0x16eb('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x16eb('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x16eb('0x26'),'dropRate'),'defaultValue':_0x16eb('0x27'),'comment':_0x16eb('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x16eb('0x24')](0x2)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x16eb('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x29')},'dialQueueOptions':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':'tTxX','comment':_0x16eb('0x2a')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'comment':_0x16eb('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x16eb('0x1')],'defaultValue':_0x16eb('0x31')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x16eb('0x2')]('always',_0x16eb('0x32'),_0x16eb('0x33')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x16eb('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0x16eb('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x16eb('0x35')},'dialAMDGreeting':{'type':Sequelize[_0x16eb('0x15')](0x9)[_0x16eb('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x16eb('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x16eb('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x16eb('0x15')](0x9)[_0x16eb('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x16eb('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x16eb('0x15')](0x9)[_0x16eb('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x16eb('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x16eb('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x16eb('0x15')](0x9)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x16eb('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x16eb('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x16eb('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x16eb('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x16eb('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x16eb('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x16eb('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x16eb('0x2')](_0x16eb('0x3f'),_0x16eb('0x40')),'defaultValue':_0x16eb('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x16eb('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16eb('0x41')},'dialCutDigit':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16eb('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16eb('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x16eb('0x15')](0x5)[_0x16eb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16eb('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x16eb('0x15')],'allowNull':!![],'comment':_0x16eb('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':![],'comment':_0x16eb('0x4e'),'set':function(_0xd10313){if(!_0xd10313)this['setDataValue'](_0x16eb('0x4f'),null);this['setDataValue']('mandatoryDisposition',_0xd10313);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x16eb('0x15')](0x3)[_0x16eb('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x16eb('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x16eb('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0xf962=['INTEGER','yes','all','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','booked','roundrobin','progressive','predictive','power'];(function(_0x4a59a4,_0x3a7006){var _0x2cdb98=function(_0x2ec0f9){while(--_0x2ec0f9){_0x4a59a4['push'](_0x4a59a4['shift']());}};_0x2cdb98(++_0x3a7006);}(_0xf962,0x1be));var _0x2f96=function(_0x38848a,_0x307088){_0x38848a=_0x38848a-0x0;var _0x1e3b69=_0xf962[_0x38848a];return _0x1e3b69;};'use strict';var Sequelize=require('sequelize');module[_0x2f96('0x0')]={'name':{'type':Sequelize[_0x2f96('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x3'),_0x2f96('0x4')),'allowNull':![],'defaultValue':_0x2f96('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x2f96('0x5')},'announce':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2f96('0x2')]('rr',_0x2f96('0x6'),_0x2f96('0x7'),_0x2f96('0x8'),'random',_0x2f96('0x9'),'linear',_0x2f96('0xa'),_0x2f96('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x382d56){this[_0x2f96('0xc')]('strategy',_0x382d56?_0x382d56:_0x2f96('0x9'));},'get':function(){var _0x26d4bc=this[_0x2f96('0xd')](_0x2f96('0xe'));var _0x4734ac=this[_0x2f96('0xd')](_0x2f96('0xf'));var _0x217fb6=this[_0x2f96('0xd')](_0x2f96('0x10'));if(_0x26d4bc===_0x2f96('0x3')){return _0x217fb6;}if(_0x4734ac===_0x2f96('0x11')&&_0x217fb6==='rrmemory'||_0x4734ac==='booked'&&_0x217fb6===_0x2f96('0x12')){return _0x217fb6;}if(_0x4734ac===_0x2f96('0x13')||_0x4734ac===_0x2f96('0x14')||_0x4734ac===_0x2f96('0x15')){return _0x217fb6;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2f96('0x16')](0xb)},'timeout':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2f96('0x1')]},'weight':{'type':Sequelize[_0x2f96('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':_0x2f96('0x17')},'autopause':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no',_0x2f96('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2f96('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2f96('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x2f96('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2f96('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2f96('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2f96('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':_0x2f96('0x17')},'announce_holdtime':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x2f96('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2f96('0x1')]},'queue_youarenext':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2f96('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x2f96('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x2f96('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x2f96('0x19')],'set':function(_0x246076){this[_0x2f96('0xc')](_0x2f96('0x1a'),_0x246076?_0x246076['join'](','):[]);},'get':function(){return this[_0x2f96('0xd')]('periodic_announce')?this[_0x2f96('0xd')](_0x2f96('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x2f96('0x17'),'set':function(_0x20dd87){this[_0x2f96('0xc')](_0x2f96('0x1b'),_0x20dd87?_0x20dd87[_0x2f96('0x1c')](','):undefined);},'get':function(){return this[_0x2f96('0xd')]('joinempty')?this[_0x2f96('0xd')](_0x2f96('0x1b'))[_0x2f96('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':'no','set':function(_0x5f1cdf){this['setDataValue'](_0x2f96('0x1e'),_0x5f1cdf?_0x5f1cdf[_0x2f96('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x2f96('0xd')](_0x2f96('0x1e'))[_0x2f96('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2f96('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2f96('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':0x0,'set':function(_0x40bc28){this['setDataValue'](_0x2f96('0x20'),_0x40bc28);if(_0x40bc28){if(this[_0x2f96('0xd')](_0x2f96('0x21'))<0x2){this[_0x2f96('0xc')](_0x2f96('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':0x0,'comment':_0x2f96('0x22')},'dialMethod':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x23'),'progressive',_0x2f96('0x15'),_0x2f96('0x14'),_0x2f96('0x11')),'defaultValue':'progressive','comment':_0x2f96('0x24')},'dialLimitChannel':{'type':Sequelize[_0x2f96('0x16')](0x4)[_0x2f96('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x2f96('0x16')](0x4)[_0x2f96('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f96('0x26')},'dialPowerLevel':{'type':Sequelize[_0x2f96('0x27')](0x2)[_0x2f96('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2f96('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x29'),'dropRate'),'defaultValue':_0x2f96('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2f96('0x27')](0x2)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2f96('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2f96('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2f96('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2f96('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':_0x2f96('0x2d'),'comment':_0x2f96('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x2f')},'dialQueueProject':{'type':Sequelize[_0x2f96('0x1')],'comment':_0x2f96('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f96('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x3,'comment':_0x2f96('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2f96('0x35')},'dialTimezone':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x2f96('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x36'),'never',_0x2f96('0x37')),'defaultValue':_0x2f96('0x36')},'dialAMDActive':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':0x0,'comment':_0x2f96('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2f96('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f96('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x2f96('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2f96('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2f96('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2f96('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f96('0x16')](0x9)[_0x2f96('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2f96('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2f96('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2f96('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2f96('0x16')](0x9)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f96('0x16')](0x5)[_0x2f96('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f96('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2f96('0x16')](0x9)[_0x2f96('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f96('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x2f96('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2f96('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2f96('0x2')](_0x2f96('0x41'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2f96('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f96('0x42')},'dialCutDigit':{'type':Sequelize[_0x2f96('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f96('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2f96('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f96('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x2f96('0x16')](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f96('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2f96('0x16')](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f96('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f96('0x16')](0x5)[_0x2f96('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2f96('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f96('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2f96('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f96('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f96('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2f96('0x4c'),'set':function(_0x70ef4b){if(!_0x70ef4b)this[_0x2f96('0xc')]('mandatoryDispositionPauseId',null);this[_0x2f96('0xc')](_0x2f96('0x4d'),_0x70ef4b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2f96('0x16')](0x3)[_0x2f96('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2f96('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2f96('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0fb5ab0..0b86888 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 _0x2047=['autoAssociation','params','getHoppers','VoiceQueueId','CmHopper','findOne','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','voicePause','interface','flatMap','penalty','Agents','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','removeAgents','addAgents','spread','online','isNil','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','phone','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','fromQuery','all','CmList','addBlackLists','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','VoiceQueues','inbound','outbound','filter','value','includes','type','name','UserProfileResource','destroy','end','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection'];(function(_0x1c9f84,_0x12db77){var _0x250013=function(_0x48ec8f){while(--_0x48ec8f){_0x1c9f84['push'](_0x1c9f84['shift']());}};_0x250013(++_0x12db77);}(_0x2047,0x107));var _0x7204=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2047[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0x7204('0x0'));var rimraf=require(_0x7204('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7204('0x2'));var rp=require('request-promise');var moment=require(_0x7204('0x3'));var BPromise=require(_0x7204('0x4'));var Mustache=require(_0x7204('0x5'));var util=require(_0x7204('0x6'));var path=require(_0x7204('0x7'));var sox=require('sox');var csv=require(_0x7204('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7204('0x9'));var _=require(_0x7204('0xa'));var squel=require(_0x7204('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7204('0x8'));var querystring=require(_0x7204('0xc'));var Papa=require(_0x7204('0xd'));var Redis=require(_0x7204('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7204('0xf'));var as=require(_0x7204('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7204('0x11'))('api');var utils=require(_0x7204('0x12'));var config=require(_0x7204('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7204('0x14'))['db'];config[_0x7204('0x15')]=_[_0x7204('0x16')](config[_0x7204('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x7204('0x17'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x7204('0x18')](socket);function respondWithStatusCode(_0x1f7970,_0x4f2956){_0x4f2956=_0x4f2956||0xcc;return function(_0x420454){if(_0x420454){return _0x1f7970[_0x7204('0x19')](_0x4f2956);}return _0x1f7970[_0x7204('0x1a')](_0x4f2956)['end']();};}function respondWithResult(_0x52f9f0,_0x13cfcc){_0x13cfcc=_0x13cfcc||0xc8;return function(_0x3a18ac){if(_0x3a18ac){return _0x52f9f0['status'](_0x13cfcc)['json'](_0x3a18ac);}};}function respondWithFilteredResult(_0x29a773,_0xe1d34){return function(_0x51b184){if(_0x51b184){var _0x30eaf7=typeof _0xe1d34['offset']==='undefined'&&typeof _0xe1d34[_0x7204('0x1b')]===_0x7204('0x1c');var _0x4779d8=_0x51b184[_0x7204('0x1d')];var _0x49b00a=_0x30eaf7?0x0:_0xe1d34[_0x7204('0x1e')];var _0xde5a20=_0x30eaf7?_0x51b184['count']:_0xe1d34['offset']+_0xe1d34[_0x7204('0x1b')];var _0x345865;if(_0xde5a20>=_0x4779d8){_0xde5a20=_0x4779d8;_0x345865=0xc8;}else{_0x345865=0xce;}_0x29a773[_0x7204('0x1a')](_0x345865);return _0x29a773[_0x7204('0x1f')](_0x7204('0x20'),_0x49b00a+'-'+_0xde5a20+'/'+_0x4779d8)[_0x7204('0x21')](_0x51b184);}return null;};}function patchUpdates(_0x4d957f){return function(_0x2f92ce){try{jsonpatch[_0x7204('0x22')](_0x2f92ce,_0x4d957f,!![]);}catch(_0xfd905f){return BPromise[_0x7204('0x23')](_0xfd905f);}return _0x2f92ce[_0x7204('0x24')]();};}function saveUpdates(_0x42548c,_0x1ade3e){return function(_0x22569a){if(_0x22569a){return _0x22569a[_0x7204('0x25')](_0x42548c)[_0x7204('0x26')](function(_0x39a81f){return _0x39a81f;});}return null;};}function removeEntity(_0x434695,_0x19279b){return function(_0x387049){if(_0x387049){return _0x387049['destroy']()['then'](function(){var _0x47b525=_0x387049[_0x7204('0x27')]({'plain':!![]});var _0x50bb2b=[{'name':_0x7204('0x28'),'value':_0x7204('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':_0x7204('0x2a'),'ignore':![]}];var _0xb68ff4=_(_0x50bb2b)[_0x7204('0x2b')]('ignore')['map'](_0x7204('0x2c'))[_0x7204('0x2c')]();if(_[_0x7204('0x2d')](_0xb68ff4,_0x47b525[_0x7204('0x2e')])){return;}var _0x44df79=_['find'](_0x50bb2b,[_0x7204('0x2c'),_0x47b525[_0x7204('0x2e')]])[_0x7204('0x2f')];return db[_0x7204('0x30')][_0x7204('0x31')]({'where':{'type':_0x44df79,'resourceId':_0x47b525['id']}})[_0x7204('0x26')](function(){return _0x387049;});})[_0x7204('0x26')](function(){_0x434695[_0x7204('0x1a')](0xcc)[_0x7204('0x32')]();});}};}function handleEntityNotFound(_0x35ff2d,_0x457a2b){return function(_0x5ae2d9){if(!_0x5ae2d9){_0x35ff2d[_0x7204('0x19')](0x194);}return _0x5ae2d9;};}function handleError(_0x5cbf31,_0xa8b3e3){_0xa8b3e3=_0xa8b3e3||0x1f4;return function(_0x498b0c){logger[_0x7204('0x33')](_0x498b0c[_0x7204('0x34')]);if(_0x498b0c[_0x7204('0x2f')]){delete _0x498b0c[_0x7204('0x2f')];}_0x5cbf31[_0x7204('0x1a')](_0xa8b3e3)[_0x7204('0x35')](_0x498b0c);};}exports[_0x7204('0x36')]=function(_0x459ce9,_0x2fc9c3){var _0x23380a={},_0x92c6a4={},_0xfcf826={'count':0x0,'rows':[]};var _0x6755ed=_['map'](db[_0x7204('0x37')][_0x7204('0x38')],function(_0x2fa63a){return{'name':_0x2fa63a[_0x7204('0x39')],'type':_0x2fa63a[_0x7204('0x2e')][_0x7204('0x3a')]};});_0x92c6a4[_0x7204('0x3b')]=_[_0x7204('0x3c')](_0x6755ed,_0x7204('0x2f'));_0x92c6a4['query']=_['keys'](_0x459ce9[_0x7204('0x3d')]);_0x92c6a4[_0x7204('0x3e')]=_['intersection'](_0x92c6a4[_0x7204('0x3b')],_0x92c6a4['query']);_0x23380a['attributes']=_[_0x7204('0x3f')](_0x92c6a4[_0x7204('0x3b')],qs[_0x7204('0x40')](_0x459ce9[_0x7204('0x3d')]['fields']));_0x23380a[_0x7204('0x41')]=_0x23380a['attributes'][_0x7204('0x42')]?_0x23380a['attributes']:_0x92c6a4[_0x7204('0x3b')];if(!_0x459ce9['query'][_0x7204('0x43')]('nolimit')){_0x23380a[_0x7204('0x1b')]=qs['limit'](_0x459ce9[_0x7204('0x3d')][_0x7204('0x1b')]);_0x23380a[_0x7204('0x1e')]=qs[_0x7204('0x1e')](_0x459ce9[_0x7204('0x3d')]['offset']);}_0x23380a[_0x7204('0x44')]=qs[_0x7204('0x45')](_0x459ce9[_0x7204('0x3d')][_0x7204('0x45')]);_0x23380a[_0x7204('0x46')]=qs['filters'](_[_0x7204('0x47')](_0x459ce9[_0x7204('0x3d')],_0x92c6a4[_0x7204('0x3e')]),_0x6755ed);if(_0x459ce9[_0x7204('0x3d')][_0x7204('0x2b')]){_0x23380a[_0x7204('0x46')]=_[_0x7204('0x48')](_0x23380a[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0x6755ed,function(_0xba0c88){if(_0xba0c88[_0x7204('0x2e')]!==_0x7204('0x49')){var _0x3a3e07={};_0x3a3e07[_0xba0c88[_0x7204('0x2f')]]={'$like':'%'+_0x459ce9[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x3a3e07;}})});}_0x23380a=_[_0x7204('0x48')]({},_0x23380a,_0x459ce9[_0x7204('0x4a')]);var _0x34337e={'where':_0x23380a[_0x7204('0x46')]};return db['VoiceQueue'][_0x7204('0x1d')](_0x34337e)[_0x7204('0x26')](function(_0x46b06a){_0xfcf826['count']=_0x46b06a;if(_0x459ce9['query'][_0x7204('0x4b')]){_0x23380a[_0x7204('0x4c')]=[{'all':!![]}];}return db[_0x7204('0x37')][_0x7204('0x4d')](_0x23380a);})['then'](function(_0x1e831f){_0xfcf826[_0x7204('0x4e')]=_0x1e831f;return _0xfcf826;})[_0x7204('0x26')](respondWithFilteredResult(_0x2fc9c3,_0x23380a))['catch'](handleError(_0x2fc9c3,null));};exports[_0x7204('0x4f')]=function(_0xcc6ad3,_0x5b5fd7){var _0x579388={'raw':![],'where':{'id':_0xcc6ad3['params']['id']}},_0x5a3fff={};_0x5a3fff[_0x7204('0x3b')]=_[_0x7204('0x50')](db['VoiceQueue']['rawAttributes']);_0x5a3fff['query']=_[_0x7204('0x50')](_0xcc6ad3[_0x7204('0x3d')]);_0x5a3fff[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0x5a3fff[_0x7204('0x3b')],_0x5a3fff['query']);_0x579388[_0x7204('0x41')]=_['intersection'](_0x5a3fff[_0x7204('0x3b')],qs[_0x7204('0x40')](_0xcc6ad3[_0x7204('0x3d')][_0x7204('0x40')]));_0x579388[_0x7204('0x41')]=_0x579388['attributes'][_0x7204('0x42')]?_0x579388['attributes']:_0x5a3fff[_0x7204('0x3b')];if(_0xcc6ad3['query']['includeAll']){_0x579388[_0x7204('0x4c')]=[{'all':!![]}];}_0x579388=_['merge']({},_0x579388,_0xcc6ad3['options']);return db['VoiceQueue'][_0x7204('0x51')](_0x579388)['then'](handleEntityNotFound(_0x5b5fd7,null))[_0x7204('0x26')](respondWithResult(_0x5b5fd7,null))[_0x7204('0x52')](handleError(_0x5b5fd7,null));};exports[_0x7204('0x53')]=function(_0x266c6e,_0x4961b7){return db[_0x7204('0x37')][_0x7204('0x53')](_0x266c6e[_0x7204('0x54')],{})[_0x7204('0x26')](function(_0x579eb3){var _0x47bc1f=_0x266c6e[_0x7204('0x55')][_0x7204('0x27')]({'plain':!![]});if(!_0x47bc1f)throw new Error(_0x7204('0x56'));if(_0x47bc1f['role']===_0x7204('0x55')){var _0x472bd2=_0x579eb3[_0x7204('0x27')]({'plain':!![]});var _0x1b4e00=[{'name':_0x7204('0x28'),'value':_0x7204('0x29')},{'name':_0x7204('0x57'),'value':'outbound'}];var _0xd0b349=_['find'](_0x1b4e00,[_0x7204('0x2c'),_0x472bd2[_0x7204('0x2e')]])['name'];return db['UserProfileSection'][_0x7204('0x51')]({'where':{'name':_0xd0b349,'userProfileId':_0x47bc1f[_0x7204('0x58')]},'raw':!![]})[_0x7204('0x26')](function(_0x57b80e){if(_0x57b80e&&_0x57b80e['autoAssociation']===0x0){return db[_0x7204('0x30')]['create']({'name':_0x472bd2[_0x7204('0x2f')],'resourceId':_0x472bd2['id'],'type':_0x57b80e[_0x7204('0x2f')],'sectionId':_0x57b80e['id']},{})[_0x7204('0x26')](function(){return _0x579eb3;});}else{return _0x579eb3;}})[_0x7204('0x52')](function(_0x4e4a69){logger[_0x7204('0x33')](_0x7204('0x59'),_0x4e4a69);throw _0x4e4a69;});}return _0x579eb3;})[_0x7204('0x26')](respondWithResult(_0x4961b7,0xc9))[_0x7204('0x52')](handleError(_0x4961b7,null));};exports[_0x7204('0x5a')]=function(_0x4202e1,_0xe74e7d){var _0x1da13d={'where':{'id':_0x4202e1['params']['id']}},_0x559230={};_0x559230[_0x7204('0x3b')]=_['keys'](db['VoiceQueue'][_0x7204('0x38')]);_0x1da13d[_0x7204('0x41')]=_[_0x7204('0x3f')](_0x559230[_0x7204('0x3b')],qs[_0x7204('0x40')](_0x4202e1[_0x7204('0x3d')][_0x7204('0x40')]));_0x1da13d[_0x7204('0x41')]=_0x1da13d[_0x7204('0x41')][_0x7204('0x42')]?_0x1da13d[_0x7204('0x41')]:_0x559230[_0x7204('0x3b')];if(_0x4202e1[_0x7204('0x3d')]['includeAll']){_0x1da13d[_0x7204('0x4c')]=[{'all':!![]}];}_0x1da13d=_[_0x7204('0x48')]({},_0x1da13d,_0x4202e1[_0x7204('0x4a')]);return db[_0x7204('0x37')][_0x7204('0x51')](_0x1da13d)['then'](handleEntityNotFound(_0xe74e7d,null))[_0x7204('0x26')](function(_0x3e6948){if(_0x3e6948){var _0x32b426=_0x3e6948[_0x7204('0x27')]({'plain':!![]});_0x32b426=qs[_0x7204('0x5b')](_0x32b426,['id',_0x7204('0x5c'),'updatedAt']);_0x4202e1[_0x7204('0x54')]=_['omit'](_0x4202e1[_0x7204('0x54')],['id',_0x7204('0x5c'),_0x7204('0x5d')]);return db['VoiceQueue'][_0x7204('0x53')](_[_0x7204('0x48')](_0x32b426,_0x4202e1[_0x7204('0x54')]),{'include':_0x4202e1[_0x7204('0x3d')][_0x7204('0x4b')]?[{'all':!![]}]:undefined})[_0x7204('0x26')](function(_0xb6af5f){var _0x3b2027=_0x4202e1['user'][_0x7204('0x27')]({'plain':!![]});if(!_0x3b2027)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2027['role']===_0x7204('0x55')){var _0x25d92a=_0xb6af5f[_0x7204('0x27')]({'plain':!![]});var _0x5effcb=[{'name':_0x7204('0x28'),'value':'inbound'},{'name':_0x7204('0x57'),'value':_0x7204('0x2a')}];var _0x3fc00a=_[_0x7204('0x51')](_0x5effcb,['value',_0x25d92a['type']])['name'];return db[_0x7204('0x5e')][_0x7204('0x51')]({'where':{'name':_0x3fc00a,'userProfileId':_0x3b2027[_0x7204('0x58')]},'raw':!![]})[_0x7204('0x26')](function(_0x3a03ea){if(_0x3a03ea&&_0x3a03ea[_0x7204('0x5f')]===0x0){return db[_0x7204('0x30')][_0x7204('0x53')]({'name':_0x25d92a[_0x7204('0x2f')],'resourceId':_0x25d92a['id'],'type':_0x3a03ea[_0x7204('0x2f')],'sectionId':_0x3a03ea['id']},{})['then'](function(){return _0xb6af5f;});}else{return _0xb6af5f;}})['catch'](function(_0x44cd1e){logger[_0x7204('0x33')](_0x7204('0x59'),_0x44cd1e);throw _0x44cd1e;});}return _0xb6af5f;});}})[_0x7204('0x26')](respondWithResult(_0xe74e7d,0xc9))[_0x7204('0x52')](handleError(_0xe74e7d,null));};exports[_0x7204('0x25')]=function(_0x3017e0,_0x288167){if(_0x3017e0[_0x7204('0x54')]['id']){delete _0x3017e0['body']['id'];}return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x3017e0[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x288167,null))[_0x7204('0x26')](saveUpdates(_0x3017e0[_0x7204('0x54')],null))[_0x7204('0x26')](respondWithResult(_0x288167,null))[_0x7204('0x52')](handleError(_0x288167,null));};exports[_0x7204('0x31')]=function(_0x2c5cec,_0x237eec){return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x2c5cec[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x237eec,null))[_0x7204('0x26')](removeEntity(_0x237eec,null))[_0x7204('0x52')](handleError(_0x237eec,null));};exports[_0x7204('0x61')]=function(_0x3332b9,_0x1f105a,_0x6dad7d){var _0xb310d5={'raw':![],'where':{}};var _0xf2fb6c={};var _0x2998d8={'count':0x0,'rows':[]};return db[_0x7204('0x37')]['findOne']({'where':{'id':_0x3332b9[_0x7204('0x60')]['id']}})['then'](handleEntityNotFound(_0x1f105a,null))[_0x7204('0x26')](function(_0x51696d){if(_0x51696d){_0xf2fb6c['model']=_[_0x7204('0x50')](db['CmHopper'][_0x7204('0x38')]);_0xf2fb6c[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x3332b9['query']);_0xf2fb6c[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0xf2fb6c[_0x7204('0x3b')],_0xf2fb6c[_0x7204('0x3d')]);_0xb310d5[_0x7204('0x41')]=_[_0x7204('0x3f')](_0xf2fb6c['model'],qs[_0x7204('0x40')](_0x3332b9[_0x7204('0x3d')]['fields']));_0xb310d5[_0x7204('0x41')]=_0xb310d5[_0x7204('0x41')]['length']?_0xb310d5['attributes']:_0xf2fb6c[_0x7204('0x3b')];if(!_0x3332b9[_0x7204('0x3d')][_0x7204('0x43')]('nolimit')){_0xb310d5[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x3332b9[_0x7204('0x3d')][_0x7204('0x1b')]);_0xb310d5[_0x7204('0x1e')]=qs[_0x7204('0x1e')](_0x3332b9['query'][_0x7204('0x1e')]);}_0xb310d5[_0x7204('0x44')]=qs[_0x7204('0x45')](_0x3332b9[_0x7204('0x3d')][_0x7204('0x45')]);_0xb310d5[_0x7204('0x46')]=qs[_0x7204('0x3e')](_['pick'](_0x3332b9[_0x7204('0x3d')],_0xf2fb6c['filters']));_0xb310d5[_0x7204('0x46')][_0x7204('0x62')]=_0x51696d['id'];if(_0x3332b9['query'][_0x7204('0x2b')]){_0xb310d5[_0x7204('0x46')]=_[_0x7204('0x48')](_0xb310d5[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0xb310d5[_0x7204('0x41')],function(_0x55ea7a){var _0x1ff81f={};_0x1ff81f[_0x55ea7a]={'$like':'%'+_0x3332b9[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x1ff81f;})});}_0xb310d5=_[_0x7204('0x48')]({},_0xb310d5,_0x3332b9[_0x7204('0x4a')]);return db[_0x7204('0x63')]['count']({'where':_0xb310d5[_0x7204('0x46')]})[_0x7204('0x26')](function(_0x319fff){_0x2998d8[_0x7204('0x1d')]=_0x319fff;if(_0x3332b9['query'][_0x7204('0x4b')]){_0xb310d5[_0x7204('0x4c')]=[{'all':!![]}];}return db[_0x7204('0x63')][_0x7204('0x4d')](_0xb310d5);})[_0x7204('0x26')](function(_0x37247e){_0x2998d8[_0x7204('0x4e')]=_0x37247e;return _0x2998d8;});}})[_0x7204('0x26')](respondWithFilteredResult(_0x1f105a,_0xb310d5))[_0x7204('0x52')](handleError(_0x1f105a,null));};exports['getHopperHistories']=function(_0xb5be0f,_0xcb2408,_0x49d58c){var _0x5888b9={'raw':!![],'where':{}};var _0x41148f={};var _0xb36a06={'count':0x0,'rows':[]};return db[_0x7204('0x37')][_0x7204('0x64')]({'where':{'id':_0xb5be0f[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0xcb2408,null))[_0x7204('0x26')](function(_0x28a49e){if(_0x28a49e){_0x41148f[_0x7204('0x3b')]=_[_0x7204('0x50')](db[_0x7204('0x65')][_0x7204('0x38')]);_0x41148f[_0x7204('0x3d')]=_[_0x7204('0x50')](_0xb5be0f[_0x7204('0x3d')]);_0x41148f[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0x41148f[_0x7204('0x3b')],_0x41148f['query']);_0x5888b9[_0x7204('0x41')]=_[_0x7204('0x3f')](_0x41148f[_0x7204('0x3b')],qs[_0x7204('0x40')](_0xb5be0f[_0x7204('0x3d')][_0x7204('0x40')]));_0x5888b9[_0x7204('0x41')]=_0x5888b9['attributes']['length']?_0x5888b9[_0x7204('0x41')]:_0x41148f[_0x7204('0x3b')];if(!_0xb5be0f[_0x7204('0x3d')][_0x7204('0x43')](_0x7204('0x66'))){_0x5888b9[_0x7204('0x1b')]=qs['limit'](_0xb5be0f[_0x7204('0x3d')][_0x7204('0x1b')]);_0x5888b9['offset']=qs[_0x7204('0x1e')](_0xb5be0f['query'][_0x7204('0x1e')]);}_0x5888b9[_0x7204('0x44')]=qs['sort'](_0xb5be0f[_0x7204('0x3d')][_0x7204('0x45')]);_0x5888b9['where']=qs[_0x7204('0x3e')](_['pick'](_0xb5be0f[_0x7204('0x3d')],_0x41148f[_0x7204('0x3e')]));_0x5888b9[_0x7204('0x46')]['VoiceQueueId']=_0x28a49e['id'];if(_0xb5be0f['query'][_0x7204('0x2b')]){_0x5888b9[_0x7204('0x46')]=_[_0x7204('0x48')](_0x5888b9[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0x5888b9[_0x7204('0x41')],function(_0x3cd1fc){var _0x118469={};_0x118469[_0x3cd1fc]={'$like':'%'+_0xb5be0f[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x118469;})});}_0x5888b9=_[_0x7204('0x48')]({},_0x5888b9,_0xb5be0f[_0x7204('0x4a')]);return db['CmHopperHistory']['count']({'where':_0x5888b9[_0x7204('0x46')]})[_0x7204('0x26')](function(_0x7e08a4){_0xb36a06[_0x7204('0x1d')]=_0x7e08a4;if(_0xb5be0f[_0x7204('0x3d')][_0x7204('0x4b')]){_0x5888b9[_0x7204('0x4c')]=[{'all':!![]}];}return db[_0x7204('0x65')][_0x7204('0x4d')](_0x5888b9);})[_0x7204('0x26')](function(_0x50457e){_0xb36a06[_0x7204('0x4e')]=_0x50457e;return _0xb36a06;});}})['then'](respondWithFilteredResult(_0xcb2408,_0x5888b9))[_0x7204('0x52')](handleError(_0xcb2408,null));};exports[_0x7204('0x67')]=function(_0x2a1293,_0x1c827d,_0x337c71){var _0x162c90={'raw':!![],'where':{}};var _0x1fc388={};var _0x586802={'count':0x0,'rows':[]};return db[_0x7204('0x37')][_0x7204('0x64')]({'where':{'id':_0x2a1293[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x1c827d,null))[_0x7204('0x26')](function(_0x4f7175){if(_0x4f7175){_0x1fc388[_0x7204('0x3b')]=_['keys'](db[_0x7204('0x68')][_0x7204('0x38')]);_0x1fc388[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x2a1293['query']);_0x1fc388[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0x1fc388[_0x7204('0x3b')],_0x1fc388[_0x7204('0x3d')]);_0x162c90[_0x7204('0x41')]=_['intersection'](_0x1fc388[_0x7204('0x3b')],qs['fields'](_0x2a1293[_0x7204('0x3d')]['fields']));_0x162c90[_0x7204('0x41')]=_0x162c90[_0x7204('0x41')][_0x7204('0x42')]?_0x162c90[_0x7204('0x41')]:_0x1fc388[_0x7204('0x3b')];if(!_0x2a1293['query']['hasOwnProperty'](_0x7204('0x66'))){_0x162c90[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x2a1293[_0x7204('0x3d')][_0x7204('0x1b')]);_0x162c90['offset']=qs['offset'](_0x2a1293[_0x7204('0x3d')]['offset']);}_0x162c90['order']=qs[_0x7204('0x45')](_0x2a1293[_0x7204('0x3d')]['sort']);_0x162c90[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x2a1293[_0x7204('0x3d')],_0x1fc388[_0x7204('0x3e')]));_0x162c90[_0x7204('0x46')]['VoiceQueueId']=_0x4f7175['id'];if(_0x2a1293['query'][_0x7204('0x2b')]){_0x162c90['where']=_[_0x7204('0x48')](_0x162c90[_0x7204('0x46')],{'$or':_['map'](_0x162c90['attributes'],function(_0x1cf978){var _0x5855e3={};_0x5855e3[_0x1cf978]={'$like':'%'+_0x2a1293[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x5855e3;})});}_0x162c90=_['merge']({},_0x162c90,_0x2a1293[_0x7204('0x4a')]);return db['CmHopperFinal'][_0x7204('0x1d')]({'where':_0x162c90[_0x7204('0x46')]})[_0x7204('0x26')](function(_0x35d01b){_0x586802['count']=_0x35d01b;if(_0x2a1293['query'][_0x7204('0x4b')]){_0x162c90[_0x7204('0x4c')]=[{'all':!![]}];}return db[_0x7204('0x68')][_0x7204('0x4d')](_0x162c90);})[_0x7204('0x26')](function(_0x367460){_0x586802[_0x7204('0x4e')]=_0x367460;return _0x586802;});}})[_0x7204('0x26')](respondWithFilteredResult(_0x1c827d,_0x162c90))[_0x7204('0x52')](handleError(_0x1c827d,null));};exports[_0x7204('0x69')]=function(_0x856c5a,_0x176ab9,_0x4b7296){var _0x5062ce={'raw':!![],'where':{}};var _0x82dfc0={};var _0x4c3f6e={'count':0x0,'rows':[]};return db[_0x7204('0x37')]['findOne']({'where':{'id':_0x856c5a[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x176ab9,null))['then'](function(_0x5f038b){if(_0x5f038b){_0x82dfc0['model']=_[_0x7204('0x50')](db['CmHopperBlack'][_0x7204('0x38')]);_0x82dfc0[_0x7204('0x3d')]=_['keys'](_0x856c5a['query']);_0x82dfc0[_0x7204('0x3e')]=_['intersection'](_0x82dfc0['model'],_0x82dfc0[_0x7204('0x3d')]);_0x5062ce['attributes']=_[_0x7204('0x3f')](_0x82dfc0[_0x7204('0x3b')],qs[_0x7204('0x40')](_0x856c5a[_0x7204('0x3d')][_0x7204('0x40')]));_0x5062ce[_0x7204('0x41')]=_0x5062ce[_0x7204('0x41')][_0x7204('0x42')]?_0x5062ce[_0x7204('0x41')]:_0x82dfc0[_0x7204('0x3b')];if(!_0x856c5a[_0x7204('0x3d')][_0x7204('0x43')](_0x7204('0x66'))){_0x5062ce[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x856c5a['query'][_0x7204('0x1b')]);_0x5062ce[_0x7204('0x1e')]=qs[_0x7204('0x1e')](_0x856c5a[_0x7204('0x3d')][_0x7204('0x1e')]);}_0x5062ce[_0x7204('0x44')]=qs[_0x7204('0x45')](_0x856c5a[_0x7204('0x3d')]['sort']);_0x5062ce[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x856c5a[_0x7204('0x3d')],_0x82dfc0[_0x7204('0x3e')]));_0x5062ce[_0x7204('0x46')][_0x7204('0x62')]=_0x5f038b['id'];if(_0x856c5a['query'][_0x7204('0x2b')]){_0x5062ce['where']=_[_0x7204('0x48')](_0x5062ce['where'],{'$or':_[_0x7204('0x3c')](_0x5062ce[_0x7204('0x41')],function(_0x4fd93d){var _0x4dd15d={};_0x4dd15d[_0x4fd93d]={'$like':'%'+_0x856c5a[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x4dd15d;})});}_0x5062ce=_['merge']({},_0x5062ce,_0x856c5a[_0x7204('0x4a')]);return db[_0x7204('0x6a')][_0x7204('0x1d')]({'where':_0x5062ce['where']})[_0x7204('0x26')](function(_0x4d5efb){_0x4c3f6e[_0x7204('0x1d')]=_0x4d5efb;if(_0x856c5a[_0x7204('0x3d')]['includeAll']){_0x5062ce['include']=[{'all':!![]}];}return db[_0x7204('0x6a')][_0x7204('0x4d')](_0x5062ce);})[_0x7204('0x26')](function(_0x228ba4){_0x4c3f6e['rows']=_0x228ba4;return _0x4c3f6e;});}})[_0x7204('0x26')](respondWithFilteredResult(_0x176ab9,_0x5062ce))[_0x7204('0x52')](handleError(_0x176ab9,null));};exports[_0x7204('0x6b')]=function(_0x4a394b,_0x3bb58c,_0x3d24b7){var _0x476321={};var _0x5c3090={};var _0x41e2a1;var _0x13791b;return db[_0x7204('0x37')][_0x7204('0x64')]({'where':{'id':_0x4a394b['params']['id']}})['then'](handleEntityNotFound(_0x3bb58c,null))['then'](function(_0x1873ba){if(_0x1873ba){_0x41e2a1=_0x1873ba;_0x5c3090[_0x7204('0x3b')]=_['keys'](db[_0x7204('0x6c')][_0x7204('0x38')]);_0x5c3090[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x4a394b[_0x7204('0x3d')]);_0x5c3090[_0x7204('0x3e')]=_['intersection'](_0x5c3090[_0x7204('0x3b')],_0x5c3090['query']);_0x476321['attributes']=_[_0x7204('0x3f')](_0x5c3090['model'],qs[_0x7204('0x40')](_0x4a394b[_0x7204('0x3d')][_0x7204('0x40')]));_0x476321['attributes']=_0x476321['attributes'][_0x7204('0x42')]?_0x476321[_0x7204('0x41')]:_0x5c3090['model'];_0x476321['order']=qs[_0x7204('0x45')](_0x4a394b[_0x7204('0x3d')][_0x7204('0x45')]);_0x476321['where']=qs['filters'](_[_0x7204('0x47')](_0x4a394b[_0x7204('0x3d')],_0x5c3090['filters']));if(_0x4a394b[_0x7204('0x3d')][_0x7204('0x2b')]){_0x476321['where']=_[_0x7204('0x48')](_0x476321[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0x476321[_0x7204('0x41')],function(_0x486d34){var _0x597039={};_0x597039[_0x486d34]={'$like':'%'+_0x4a394b[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x597039;})});}_0x476321=_['merge']({},_0x476321,_0x4a394b[_0x7204('0x4a')]);return _0x41e2a1[_0x7204('0x6b')](_0x476321);}})[_0x7204('0x26')](function(_0x32771c){if(_0x32771c){_0x13791b=_0x32771c[_0x7204('0x42')];if(!_0x4a394b[_0x7204('0x3d')][_0x7204('0x43')]('nolimit')){_0x476321[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x4a394b[_0x7204('0x3d')][_0x7204('0x1b')]);_0x476321[_0x7204('0x1e')]=qs['offset'](_0x4a394b[_0x7204('0x3d')][_0x7204('0x1e')]);}return _0x41e2a1[_0x7204('0x6b')](_0x476321);}})[_0x7204('0x26')](function(_0x47b98a){if(_0x47b98a){return _0x47b98a?{'count':_0x13791b,'rows':_0x47b98a}:null;}})[_0x7204('0x26')](respondWithResult(_0x3bb58c,null))[_0x7204('0x52')](handleError(_0x3bb58c,null));};exports[_0x7204('0x6d')]=function(_0x21a36b,_0x3bc34b,_0x254b79){var _0x3abd39=_0x21a36b[_0x7204('0x54')][_0x7204('0x6e')];var _0x57d5e6=_[_0x7204('0x3c')](_0x3abd39,'id');return db[_0x7204('0x6c')][_0x7204('0x4d')]({'where':{'id':_0x57d5e6},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7204('0x2f'),'online',_0x7204('0x6f'),_0x7204('0x70')],'raw':!![]}]})[_0x7204('0x26')](function(_0x43e2a0){if(_0x43e2a0){var _0x49e937=_[_0x7204('0x71')](_0x43e2a0,function(_0x3f3d25){var _0x3789b3=_0x3f3d25[_0x7204('0x27')]({'plain':!![]});_0x3789b3['Agents']['forEach'](function(_0x20b8b9){_0x20b8b9[_0x7204('0x72')]=_['find'](_0x3abd39,{'id':_0x3789b3['id']})[_0x7204('0x72')];});return _0x3789b3[_0x7204('0x73')];});return db['VoiceQueue'][_0x7204('0x51')]({'where':{'id':_0x21a36b[_0x7204('0x60')]['id']}})[_0x7204('0x26')](function(_0x200c66){return db['sequelize'][_0x7204('0x74')](function(_0x4b0dff){return _0x200c66['addTeams'](_0x57d5e6,{'transaction':_0x4b0dff})[_0x7204('0x26')](function(){return BPromise['each'](_0x3abd39,function(_0x25937d){return db[_0x7204('0x75')][_0x7204('0x76')]({'TeamId':_0x25937d['id'],'VoiceQueueId':_0x21a36b[_0x7204('0x60')]['id'],'penalty':_0x25937d[_0x7204('0x72')]},{'transaction':_0x4b0dff});});})['then'](function(){return BPromise[_0x7204('0x77')](_0x49e937,function(_0x5b7743){return db[_0x7204('0x78')][_0x7204('0x79')]({'where':{'UserId':_0x5b7743['id'],'VoiceQueueId':_0x21a36b[_0x7204('0x60')]['id']},'defaults':{'penalty':_0x5b7743[_0x7204('0x72')]},'transaction':_0x4b0dff});});})['then'](function(){return BPromise['each'](_[_0x7204('0x2b')](_0x49e937,{'online':!![]}),function(_0x5b87c7){return db[_0x7204('0x7a')][_0x7204('0x76')]({'membername':_0x5b87c7[_0x7204('0x2f')],'UserId':_0x5b87c7['id'],'queue_name':_0x200c66[_0x7204('0x2f')],'VoiceQueueId':_0x200c66['id'],'interface':_['isNil'](_0x5b87c7[_0x7204('0x70')])?util[_0x7204('0x7b')](_0x7204('0x7c'),_0x5b87c7[_0x7204('0x2f')]):_0x5b87c7[_0x7204('0x70')],'paused':_0x5b87c7[_0x7204('0x6f')]||![],'penalty':_0x5b87c7['penalty']},{'transaction':_0x4b0dff});});})['then'](function(){_0x49e937[_0x7204('0x7d')](function(_0x115bbc){socket[_0x7204('0x7e')](_0x7204('0x7f'),{'UserId':_0x115bbc['id'],'VoiceQueueId':_0x200c66['id']});});});});});}})['then'](respondWithStatusCode(_0x3bc34b,null))[_0x7204('0x52')](handleError(_0x3bc34b,null));};exports[_0x7204('0x80')]=function(_0x144e74,_0x508deb,_0x4a1290){return db[_0x7204('0x6c')][_0x7204('0x4d')]({'where':{'id':_0x144e74[_0x7204('0x3d')][_0x7204('0x81')]},'attributes':['id'],'include':[{'model':db[_0x7204('0x82')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7204('0x26')](handleEntityNotFound(_0x508deb,null))[_0x7204('0x26')](function(_0xcc55bf){var _0x2b7cfc=_[_0x7204('0x3c')](_0xcc55bf,'id');var _0x939917=[];var _0x5459bb=[];var _0x2f6804=squel[_0x7204('0x83')]();_0x2f6804[_0x7204('0x84')]('tq.TeamId')['from'](_0x7204('0x85'),'tq')[_0x7204('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7204('0x87'),_0x144e74[_0x7204('0x60')]['id']);for(var _0x285968=0x0;_0x285968<_0xcc55bf[_0x7204('0x42')];_0x285968+=0x1){let _0x436cc7=_0xcc55bf[_0x285968];for(var _0x5e79c8=0x0;_0x5e79c8<_0x436cc7[_0x7204('0x73')][_0x7204('0x42')];_0x5e79c8+=0x1){let _0x75f339=_0x436cc7[_0x7204('0x73')][_0x5e79c8];var _0x3620e6=_0x2f6804['clone']();_0x3620e6['where'](_0x7204('0x88'),_0x75f339['id']);_0x5459bb[_0x7204('0x89')](db[_0x7204('0x8a')][_0x7204('0x3d')](_0x3620e6[_0x7204('0x8b')](),{'type':db[_0x7204('0x8a')][_0x7204('0x8c')][_0x7204('0x8d')]})[_0x7204('0x26')](function(_0x496132){if(_0x496132[_0x7204('0x42')]===0x1){return _0x75f339['id'];}else{var _0x41aa0e=_[_0x7204('0x8e')](_[_0x7204('0x3c')](_0x496132,'TeamId'),function(_0x3da17c){return _[_0x7204('0x2d')](_0x2b7cfc,_0x3da17c);});if(_0x41aa0e){return _0x75f339['id'];}}}));}}return BPromise['all'](_0x5459bb)[_0x7204('0x26')](function(_0x2ed11a){_0x939917=_(_0x939917)['union'](_0x2ed11a)['compact']()[_0x7204('0x2c')]();return db[_0x7204('0x37')]['find']({'where':{'id':_0x144e74[_0x7204('0x60')]['id']}})[_0x7204('0x26')](function(_0x5f2f2b){return db[_0x7204('0x8a')][_0x7204('0x74')](function(_0x341a27){return _0x5f2f2b['removeTeams'](_0x144e74[_0x7204('0x3d')][_0x7204('0x81')],{'transaction':_0x341a27})[_0x7204('0x26')](function(){if(!_['isEmpty'](_0x939917)){return _0x5f2f2b[_0x7204('0x8f')](_0x939917,{'transaction':_0x341a27})[_0x7204('0x26')](function(){return db[_0x7204('0x7a')][_0x7204('0x31')]({'where':{'VoiceQueueId':_0x144e74[_0x7204('0x60')]['id'],'UserId':_0x939917},'transaction':_0x341a27});});}})[_0x7204('0x26')](function(){_0x939917[_0x7204('0x7d')](function(_0xe7cc24){socket[_0x7204('0x7e')]('userVoiceQueue:remove',{'UserId':_0xe7cc24,'VoiceQueueId':_0x5f2f2b['id']});});});});});});})[_0x7204('0x26')](respondWithStatusCode(_0x508deb,null))[_0x7204('0x52')](handleError(_0x508deb,null));};exports[_0x7204('0x90')]=function(_0x5b2043,_0x4e6dc2,_0x235a53){var _0x36d8a8,_0x10c2af;return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x5b2043['params']['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x4e6dc2,null))[_0x7204('0x26')](function(_0xb90568){if(_0xb90568){_0x10c2af=_0xb90568;return _0xb90568['addAgents'](_0x5b2043[_0x7204('0x54')][_0x7204('0x81')],_[_0x7204('0x5b')](_0x5b2043[_0x7204('0x54')],[_0x7204('0x81'),'id'])||{})[_0x7204('0x91')](function(_0x5e9217){for(var _0x4329e1=0x0;_0x4329e1<_0x5b2043['body']['ids'][_0x7204('0x42')];_0x4329e1+=0x1){socket[_0x7204('0x7e')](_0x7204('0x7f'),{'UserId':Number(_0x5b2043['body'][_0x7204('0x81')][_0x4329e1]),'VoiceQueueId':Number(_0x5b2043['params']['id'])});}return _0x5e9217;});}})[_0x7204('0x26')](function(_0x19be5c){_0x36d8a8=_0x19be5c||[];if(_0x10c2af){return db[_0x7204('0x82')][_0x7204('0x4d')]({'where':{'id':_0x5b2043[_0x7204('0x54')][_0x7204('0x81')]},'attributes':['id',_0x7204('0x2f'),_0x7204('0x92'),_0x7204('0x6f'),'interface'],'raw':!![]});}})['then'](function(_0x49965f){if(!_['isEmpty'](_0x49965f)){var _0x3ad5e0=[];for(var _0x19f24f=0x0;_0x19f24f<_0x49965f[_0x7204('0x42')];_0x19f24f++){if(_0x49965f[_0x19f24f][_0x7204('0x92')]){_0x3ad5e0['push'](db['UserVoiceQueueRt'][_0x7204('0x76')]({'membername':_0x49965f[_0x19f24f][_0x7204('0x2f')],'UserId':_0x49965f[_0x19f24f]['id'],'queue_name':_0x10c2af['name'],'VoiceQueueId':_0x10c2af['id'],'interface':_[_0x7204('0x93')](_0x49965f[_0x19f24f][_0x7204('0x70')])?util[_0x7204('0x7b')](_0x7204('0x7c'),_0x49965f[_0x19f24f]['name']):_0x49965f[_0x19f24f][_0x7204('0x70')],'paused':_0x49965f[_0x19f24f][_0x7204('0x6f')]||![],'penalty':_0x5b2043[_0x7204('0x54')][_0x7204('0x72')]||0x0}));}}return BPromise['all'](_0x3ad5e0);}})['then'](function(){return _0x36d8a8;})['then'](respondWithResult(_0x4e6dc2,null))[_0x7204('0x52')](handleError(_0x4e6dc2,null));};exports[_0x7204('0x8f')]=function(_0x3aa5d3,_0xbc5bce,_0x25a69b){return db[_0x7204('0x37')]['find']({'where':{'id':_0x3aa5d3['params']['id']}})[_0x7204('0x26')](handleEntityNotFound(_0xbc5bce,null))[_0x7204('0x26')](function(_0x2d2207){if(_0x2d2207){return _0x2d2207[_0x7204('0x8f')](_0x3aa5d3[_0x7204('0x3d')][_0x7204('0x81')])[_0x7204('0x26')](function(){if(_['isArray'](_0x3aa5d3['query'][_0x7204('0x81')])){for(var _0x42918c=0x0;_0x42918c<_0x3aa5d3[_0x7204('0x3d')]['ids']['length'];_0x42918c+=0x1){socket[_0x7204('0x7e')](_0x7204('0x94'),{'UserId':Number(_0x3aa5d3['query'][_0x7204('0x81')][_0x42918c]),'VoiceQueueId':Number(_0x3aa5d3[_0x7204('0x60')]['id'])});}}else{socket[_0x7204('0x7e')](_0x7204('0x94'),{'UserId':Number(_0x3aa5d3[_0x7204('0x3d')][_0x7204('0x81')]),'VoiceQueueId':Number(_0x3aa5d3['params']['id'])});}});}})[_0x7204('0x26')](function(_0x54b2c0){return db[_0x7204('0x7a')][_0x7204('0x31')]({'where':{'VoiceQueueId':_0x3aa5d3[_0x7204('0x60')]['id'],'UserId':_0x3aa5d3[_0x7204('0x3d')][_0x7204('0x81')]}})['then'](function(){return _0x54b2c0;});})['then'](respondWithStatusCode(_0xbc5bce,null))[_0x7204('0x52')](handleError(_0xbc5bce,null));};exports[_0x7204('0x95')]=function(_0x34aea7,_0x3a8dd9,_0x1fd91f){var _0x3253f6={};var _0x22fe1f={};var _0x299c1d;var _0x755dc1;return db[_0x7204('0x37')]['findOne']({'where':{'id':_0x34aea7['params']['id']}})['then'](handleEntityNotFound(_0x3a8dd9,null))[_0x7204('0x26')](function(_0x4d7b70){if(_0x4d7b70){_0x299c1d=_0x4d7b70;_0x22fe1f[_0x7204('0x3b')]=_[_0x7204('0x50')](db[_0x7204('0x82')][_0x7204('0x38')]);_0x22fe1f['query']=_[_0x7204('0x50')](_0x34aea7[_0x7204('0x3d')]);_0x22fe1f[_0x7204('0x3e')]=_['intersection'](_0x22fe1f[_0x7204('0x3b')],_0x22fe1f[_0x7204('0x3d')]);_0x3253f6[_0x7204('0x41')]=_[_0x7204('0x3f')](_0x22fe1f['model'],qs[_0x7204('0x40')](_0x34aea7[_0x7204('0x3d')][_0x7204('0x40')]));_0x3253f6[_0x7204('0x41')]=_0x3253f6['attributes']['length']?_0x3253f6['attributes']:_0x22fe1f['model'];_0x3253f6['order']=qs[_0x7204('0x45')](_0x34aea7[_0x7204('0x3d')][_0x7204('0x45')]);_0x3253f6[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x34aea7[_0x7204('0x3d')],_0x22fe1f['filters']));if(_0x34aea7['query'][_0x7204('0x2b')]){_0x3253f6[_0x7204('0x46')]=_[_0x7204('0x48')](_0x3253f6[_0x7204('0x46')],{'$or':_['map'](_0x3253f6[_0x7204('0x41')],function(_0x2d7990){var _0x31170c={};_0x31170c[_0x2d7990]={'$like':'%'+_0x34aea7['query']['filter']+'%'};return _0x31170c;})});}_0x3253f6=_[_0x7204('0x48')]({},_0x3253f6,_0x34aea7['options']);return _0x299c1d[_0x7204('0x95')](_0x3253f6);}})[_0x7204('0x26')](function(_0x17dd5a){if(_0x17dd5a){_0x755dc1=_0x17dd5a[_0x7204('0x42')];if(!_0x34aea7[_0x7204('0x3d')][_0x7204('0x43')](_0x7204('0x66'))){_0x3253f6[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x34aea7[_0x7204('0x3d')]['limit']);_0x3253f6[_0x7204('0x1e')]=qs[_0x7204('0x1e')](_0x34aea7[_0x7204('0x3d')]['offset']);}return _0x299c1d[_0x7204('0x95')](_0x3253f6);}})[_0x7204('0x26')](function(_0x4252b7){if(_0x4252b7){return _0x4252b7?{'count':_0x755dc1,'rows':_0x4252b7}:null;}})['then'](respondWithResult(_0x3a8dd9,null))[_0x7204('0x52')](handleError(_0x3a8dd9,null));};exports[_0x7204('0x96')]=function(_0x5999a7,_0x3b8f90,_0x10853d){var _0x3dd547={};var _0x1c89f8={};var _0x81c84d;var _0x5dde45;return db[_0x7204('0x37')]['findOne']({'where':{'id':_0x5999a7[_0x7204('0x60')]['id']}})['then'](handleEntityNotFound(_0x3b8f90,null))[_0x7204('0x26')](function(_0x2fca11){if(_0x2fca11){_0x81c84d=_0x2fca11;_0x1c89f8[_0x7204('0x3b')]=_[_0x7204('0x50')](db['UserVoiceQueueRt']['rawAttributes']);_0x1c89f8[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x5999a7[_0x7204('0x3d')]);_0x1c89f8[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0x1c89f8[_0x7204('0x3b')],_0x1c89f8[_0x7204('0x3d')]);_0x3dd547[_0x7204('0x41')]=_[_0x7204('0x3f')](_0x1c89f8[_0x7204('0x3b')],qs[_0x7204('0x40')](_0x5999a7[_0x7204('0x3d')][_0x7204('0x40')]));_0x3dd547[_0x7204('0x41')]=_0x3dd547['attributes'][_0x7204('0x42')]?_0x3dd547[_0x7204('0x41')]:_0x1c89f8['model'];_0x3dd547[_0x7204('0x44')]=qs['sort'](_0x5999a7[_0x7204('0x3d')][_0x7204('0x45')]);_0x3dd547[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x5999a7['query'],_0x1c89f8['filters']));if(_0x5999a7[_0x7204('0x3d')][_0x7204('0x2b')]){_0x3dd547[_0x7204('0x46')]=_[_0x7204('0x48')](_0x3dd547[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0x3dd547['attributes'],function(_0x475113){var _0x3010ba={};_0x3010ba[_0x475113]={'$like':'%'+_0x5999a7[_0x7204('0x3d')]['filter']+'%'};return _0x3010ba;})});}_0x3dd547=_['merge']({},_0x3dd547,_0x5999a7[_0x7204('0x4a')]);return _0x81c84d[_0x7204('0x96')](_0x3dd547);}})[_0x7204('0x26')](function(_0x201ba0){if(_0x201ba0){_0x5dde45=_0x201ba0[_0x7204('0x42')];if(!_0x5999a7[_0x7204('0x3d')]['hasOwnProperty']('nolimit')){_0x3dd547[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x5999a7[_0x7204('0x3d')][_0x7204('0x1b')]);_0x3dd547['offset']=qs['offset'](_0x5999a7[_0x7204('0x3d')][_0x7204('0x1e')]);}return _0x81c84d[_0x7204('0x96')](_0x3dd547);}})[_0x7204('0x26')](function(_0x273578){return _0x273578?{'count':_0x5dde45,'rows':_0x273578}:null;})[_0x7204('0x26')](respondWithResult(_0x3b8f90,null))[_0x7204('0x52')](handleError(_0x3b8f90,null));};exports[_0x7204('0x97')]=function(_0x1fc812,_0x595cee,_0x2aea08){var _0x339cf5={};var _0x4d9266={};var _0x47cd78;var _0x322e2b;return db[_0x7204('0x37')][_0x7204('0x64')]({'where':{'id':_0x1fc812['params']['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x595cee,null))['then'](function(_0x11ec89){if(_0x11ec89){_0x47cd78=_0x11ec89;_0x4d9266[_0x7204('0x3b')]=_[_0x7204('0x50')](db['CmList'][_0x7204('0x38')]);_0x4d9266[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x1fc812[_0x7204('0x3d')]);_0x4d9266[_0x7204('0x3e')]=_['intersection'](_0x4d9266[_0x7204('0x3b')],_0x4d9266[_0x7204('0x3d')]);_0x339cf5['attributes']=_[_0x7204('0x3f')](_0x4d9266['model'],qs[_0x7204('0x40')](_0x1fc812[_0x7204('0x3d')][_0x7204('0x40')]));_0x339cf5['attributes']=_0x339cf5['attributes'][_0x7204('0x42')]?_0x339cf5[_0x7204('0x41')]:_0x4d9266[_0x7204('0x3b')];_0x339cf5[_0x7204('0x44')]=qs['sort'](_0x1fc812[_0x7204('0x3d')][_0x7204('0x45')]);_0x339cf5[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x1fc812[_0x7204('0x3d')],_0x4d9266[_0x7204('0x3e')]));if(_0x1fc812[_0x7204('0x3d')][_0x7204('0x2b')]){_0x339cf5[_0x7204('0x46')]=_[_0x7204('0x48')](_0x339cf5['where'],{'$or':_[_0x7204('0x3c')](_0x339cf5[_0x7204('0x41')],function(_0x3a13ec){var _0x8d83ca={};_0x8d83ca[_0x3a13ec]={'$like':'%'+_0x1fc812[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x8d83ca;})});}_0x339cf5=_[_0x7204('0x48')]({},_0x339cf5,_0x1fc812[_0x7204('0x4a')]);return _0x47cd78[_0x7204('0x97')](_0x339cf5);}})[_0x7204('0x26')](function(_0x6d0849){if(_0x6d0849){_0x322e2b=_0x6d0849[_0x7204('0x42')];if(!_0x1fc812[_0x7204('0x3d')][_0x7204('0x43')]('nolimit')){_0x339cf5[_0x7204('0x1b')]=qs[_0x7204('0x1b')](_0x1fc812[_0x7204('0x3d')][_0x7204('0x1b')]);_0x339cf5[_0x7204('0x1e')]=qs['offset'](_0x1fc812[_0x7204('0x3d')][_0x7204('0x1e')]);}return _0x47cd78[_0x7204('0x97')](_0x339cf5);}})[_0x7204('0x26')](function(_0xf16b17){if(_0xf16b17){return _0xf16b17?{'count':_0x322e2b,'rows':_0xf16b17}:null;}})[_0x7204('0x26')](respondWithResult(_0x595cee,null))[_0x7204('0x52')](handleError(_0x595cee,null));};exports[_0x7204('0x98')]=function(_0x34e10e,_0x4824fd,_0x1f525d){var _0x13bbf8,_0x1252cd;return db['VoiceQueue']['find']({'where':{'id':_0x34e10e[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x4824fd,null))[_0x7204('0x26')](function(_0x2ce464){if(_0x2ce464){_0x1252cd=_0x2ce464;return _0x2ce464[_0x7204('0x98')](_0x34e10e[_0x7204('0x54')][_0x7204('0x81')],_[_0x7204('0x5b')](_0x34e10e[_0x7204('0x54')],[_0x7204('0x81'),'id'])||{});}return null;})[_0x7204('0x91')](function(_0x217984){var _0x560aca;_0x13bbf8=_0x217984||[];var _0xc53957=[];if(_0x217984){for(var _0x2d7126=0x0;_0x2d7126<_0x217984['length'];_0x2d7126+=0x1){var _0x340077=_0x217984[_0x2d7126][_0x7204('0x27')]({'plain':!![]});_0x1252cd['dialCheckDuplicateType']=_0x34e10e[_0x7204('0x54')][_0x7204('0x99')]?_0x34e10e[_0x7204('0x54')]['dialCheckDuplicateType']:_0x1252cd[_0x7204('0x99')];switch(_0x1252cd[_0x7204('0x99')]){case _0x7204('0x9a'):_0x560aca=squel[_0x7204('0x9b')]()[_0x7204('0x9c')](_0x7204('0x9d'))['fromQuery'](['phone',_0x7204('0x9e'),_0x7204('0x9f'),_0x7204('0xa0'),_0x7204('0x62'),_0x7204('0x5c'),_0x7204('0x5d')],squel[_0x7204('0x83')]()['field']('phone',_0x7204('0xa1'))[_0x7204('0x84')](_0x7204('0xa2'),'scheduledAt')[_0x7204('0x84')]('id',_0x7204('0x9f'))[_0x7204('0x84')](_0x340077[_0x7204('0xa3')]['toString'](),_0x7204('0xa0'))['field'](_0x34e10e[_0x7204('0x60')]['id'][_0x7204('0x8b')](),_0x7204('0x62'))[_0x7204('0x84')](_0x7204('0xa2'),_0x7204('0x5c'))['field'](_0x7204('0xa2'),_0x7204('0x5d'))['from'](_0x7204('0xa4'))[_0x7204('0x46')](_0x7204('0xa5'))[_0x7204('0x46')]('ListId\x20=\x20?',_0x340077[_0x7204('0xa3')][_0x7204('0x8b')]())[_0x7204('0x46')](_0x7204('0xa6'))[_0x7204('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7204('0x83')]()[_0x7204('0x84')](_0x7204('0xa7'))[_0x7204('0xa8')](_0x7204('0xa9'))['where']('VoiceQueueId\x20=\x20?',_0x34e10e[_0x7204('0x60')]['id'][_0x7204('0x8b')]()))['where'](_0x7204('0xaa'),squel[_0x7204('0x83')]()[_0x7204('0x84')](_0x7204('0xab'))['from'](_0x7204('0x9d'))[_0x7204('0x46')]('VoiceQueueId\x20=\x20?',_0x34e10e[_0x7204('0x60')]['id']['toString']())))[_0x7204('0x8b')]();break;case'onlyIfOpen':_0x560aca=squel[_0x7204('0x9b')]()[_0x7204('0x9c')](_0x7204('0x9d'))[_0x7204('0xac')]([_0x7204('0xa1'),_0x7204('0x9e'),_0x7204('0x9f'),_0x7204('0xa0'),_0x7204('0x62'),_0x7204('0x5c'),_0x7204('0x5d')],squel[_0x7204('0x83')]()['field']('phone',_0x7204('0xa1'))[_0x7204('0x84')](_0x7204('0xa2'),_0x7204('0x9e'))[_0x7204('0x84')]('id',_0x7204('0x9f'))['field'](_0x340077[_0x7204('0xa3')][_0x7204('0x8b')](),'ListId')[_0x7204('0x84')](_0x34e10e[_0x7204('0x60')]['id'][_0x7204('0x8b')](),_0x7204('0x62'))['field']('NOW()','createdAt')['field']('NOW()','updatedAt')[_0x7204('0xa8')](_0x7204('0xa4'))[_0x7204('0x46')](_0x7204('0xa5'))[_0x7204('0x46')]('ListId\x20=\x20?',_0x340077[_0x7204('0xa3')][_0x7204('0x8b')]())['where'](_0x7204('0xa6'))[_0x7204('0x46')](_0x7204('0xaa'),squel[_0x7204('0x83')]()[_0x7204('0x84')](_0x7204('0xab'))[_0x7204('0xa8')](_0x7204('0x9d'))['where'](_0x7204('0x87'),_0x34e10e[_0x7204('0x60')]['id']['toString']())))[_0x7204('0x8b')]();break;default:_0x560aca=squel[_0x7204('0x9b')]()['into'](_0x7204('0x9d'))[_0x7204('0xac')]([_0x7204('0xa1'),_0x7204('0x9e'),_0x7204('0x9f'),'ListId',_0x7204('0x62'),'createdAt','updatedAt'],squel[_0x7204('0x83')]()[_0x7204('0x84')](_0x7204('0xa1'),_0x7204('0xa1'))[_0x7204('0x84')](_0x7204('0xa2'),'scheduledAt')[_0x7204('0x84')]('id',_0x7204('0x9f'))[_0x7204('0x84')](_0x340077['CmListId'][_0x7204('0x8b')](),_0x7204('0xa0'))['field'](_0x34e10e[_0x7204('0x60')]['id'][_0x7204('0x8b')](),'VoiceQueueId')[_0x7204('0x84')](_0x7204('0xa2'),_0x7204('0x5c'))[_0x7204('0x84')](_0x7204('0xa2'),_0x7204('0x5d'))[_0x7204('0xa8')](_0x7204('0xa4'))[_0x7204('0x46')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x340077['CmListId'][_0x7204('0x8b')]())[_0x7204('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x7204('0x8b')]();}_0xc53957['push'](db[_0x7204('0x8a')][_0x7204('0x3d')](_0x560aca));}return BPromise[_0x7204('0xad')](_0xc53957);}})[_0x7204('0x26')](function(){return _0x13bbf8;})[_0x7204('0x26')](respondWithResult(_0x4824fd,null))['catch'](handleError(_0x4824fd,null));};exports['removeLists']=function(_0x5dc939,_0x31f598,_0x5c06ed){return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x5dc939[_0x7204('0x60')]['id']}})['then'](handleEntityNotFound(_0x31f598,null))[_0x7204('0x26')](function(_0x3f4414){if(_0x3f4414){return _0x3f4414['removeLists'](_0x5dc939[_0x7204('0x3d')][_0x7204('0x81')]);}})['then'](function(_0x8e00ed){if(_0x8e00ed){return db[_0x7204('0x63')][_0x7204('0x31')]({'where':{'ListId':_0x5dc939['query'][_0x7204('0x81')],'VoiceQueueId':_0x5dc939[_0x7204('0x60')]['id']}})['then'](function(){return _0x8e00ed;});}})[_0x7204('0x26')](respondWithStatusCode(_0x31f598,null))[_0x7204('0x52')](handleError(_0x31f598,null));};exports['getBlackLists']=function(_0x365c08,_0x4a5fd4,_0x1c1f96){var _0x2f0bbc={};var _0x476915={};var _0x28cb25;var _0x2cd5ad;return db[_0x7204('0x37')][_0x7204('0x64')]({'where':{'id':_0x365c08[_0x7204('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a5fd4,null))['then'](function(_0x2ffbe3){if(_0x2ffbe3){_0x28cb25=_0x2ffbe3;_0x476915['model']=_['keys'](db[_0x7204('0xae')][_0x7204('0x38')]);_0x476915[_0x7204('0x3d')]=_[_0x7204('0x50')](_0x365c08[_0x7204('0x3d')]);_0x476915[_0x7204('0x3e')]=_[_0x7204('0x3f')](_0x476915['model'],_0x476915[_0x7204('0x3d')]);_0x2f0bbc['attributes']=_[_0x7204('0x3f')](_0x476915[_0x7204('0x3b')],qs[_0x7204('0x40')](_0x365c08['query'][_0x7204('0x40')]));_0x2f0bbc[_0x7204('0x41')]=_0x2f0bbc[_0x7204('0x41')][_0x7204('0x42')]?_0x2f0bbc[_0x7204('0x41')]:_0x476915[_0x7204('0x3b')];_0x2f0bbc[_0x7204('0x44')]=qs['sort'](_0x365c08[_0x7204('0x3d')]['sort']);_0x2f0bbc[_0x7204('0x46')]=qs[_0x7204('0x3e')](_[_0x7204('0x47')](_0x365c08['query'],_0x476915[_0x7204('0x3e')]));if(_0x365c08['query'][_0x7204('0x2b')]){_0x2f0bbc[_0x7204('0x46')]=_[_0x7204('0x48')](_0x2f0bbc[_0x7204('0x46')],{'$or':_[_0x7204('0x3c')](_0x2f0bbc[_0x7204('0x41')],function(_0x4e750f){var _0x19cc73={};_0x19cc73[_0x4e750f]={'$like':'%'+_0x365c08[_0x7204('0x3d')][_0x7204('0x2b')]+'%'};return _0x19cc73;})});}_0x2f0bbc=_[_0x7204('0x48')]({},_0x2f0bbc,_0x365c08['options']);return _0x28cb25['getBlackLists'](_0x2f0bbc);}})['then'](function(_0x5d0cd1){if(_0x5d0cd1){_0x2cd5ad=_0x5d0cd1['length'];if(!_0x365c08[_0x7204('0x3d')][_0x7204('0x43')]('nolimit')){_0x2f0bbc[_0x7204('0x1b')]=qs['limit'](_0x365c08[_0x7204('0x3d')]['limit']);_0x2f0bbc[_0x7204('0x1e')]=qs['offset'](_0x365c08[_0x7204('0x3d')][_0x7204('0x1e')]);}return _0x28cb25['getBlackLists'](_0x2f0bbc);}})[_0x7204('0x26')](function(_0x14030a){if(_0x14030a){return _0x14030a?{'count':_0x2cd5ad,'rows':_0x14030a}:null;}})[_0x7204('0x26')](respondWithResult(_0x4a5fd4,null))['catch'](handleError(_0x4a5fd4,null));};exports['addBlackLists']=function(_0x2524ed,_0x3fa68c,_0x52bdac){var _0x21caf7,_0x5790cd;return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x2524ed[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x3fa68c,null))[_0x7204('0x26')](function(_0x4b7e50){if(_0x4b7e50){_0x5790cd=_0x4b7e50;return _0x4b7e50[_0x7204('0xaf')](_0x2524ed[_0x7204('0x54')][_0x7204('0x81')],_[_0x7204('0x5b')](_0x2524ed['body'],[_0x7204('0x81'),'id'])||{});}return null;})[_0x7204('0x91')](function(_0x4da7af){var _0x42a1a6;_0x21caf7=_0x4da7af||[];var _0x10aa37=[];if(_0x4da7af){for(var _0x5675f9=0x0;_0x5675f9<_0x4da7af[_0x7204('0x42')];_0x5675f9+=0x1){var _0x1c036=_0x4da7af[_0x5675f9][_0x7204('0x27')]({'plain':!![]});_0x42a1a6=squel[_0x7204('0x9b')]()[_0x7204('0x9c')](_0x7204('0xb0'))['fromQuery'](['phone',_0x7204('0x9f'),_0x7204('0xa0'),_0x7204('0x62'),_0x7204('0x5c'),'updatedAt'],squel[_0x7204('0x83')]()[_0x7204('0x84')](_0x7204('0xa1'),'phone')[_0x7204('0x84')]('id',_0x7204('0x9f'))[_0x7204('0x84')](_0x1c036['CmListId'][_0x7204('0x8b')](),'ListId')[_0x7204('0x84')](_0x2524ed[_0x7204('0x60')]['id']['toString'](),'VoiceQueueId')[_0x7204('0x84')](_0x7204('0xa2'),_0x7204('0x5c'))[_0x7204('0x84')](_0x7204('0xa2'),'updatedAt')[_0x7204('0xa8')](_0x7204('0xa4'))[_0x7204('0x46')](_0x7204('0xa5'))[_0x7204('0x46')](_0x7204('0xb1'),_0x1c036['CmListId']['toString']())[_0x7204('0x46')](_0x7204('0xa6')))[_0x7204('0x8b')]();_0x10aa37[_0x7204('0x89')](db[_0x7204('0x8a')]['query'](_0x42a1a6));}return BPromise[_0x7204('0xad')](_0x10aa37);}})[_0x7204('0x26')](function(){return _0x21caf7;})[_0x7204('0x26')](respondWithResult(_0x3fa68c,null))['catch'](handleError(_0x3fa68c,null));};exports[_0x7204('0xb2')]=function(_0x430f43,_0x33018d,_0x109848){return db[_0x7204('0x37')][_0x7204('0x51')]({'where':{'id':_0x430f43[_0x7204('0x60')]['id']}})[_0x7204('0x26')](handleEntityNotFound(_0x33018d,null))['then'](function(_0x41b984){if(_0x41b984){return _0x41b984[_0x7204('0xb2')](_0x430f43[_0x7204('0x3d')][_0x7204('0x81')]);}})['then'](function(_0x13260d){if(_0x13260d){return db['CmHopperBlack'][_0x7204('0x31')]({'where':{'ListId':_0x430f43[_0x7204('0x3d')][_0x7204('0x81')],'VoiceQueueId':_0x430f43[_0x7204('0x60')]['id']}})[_0x7204('0x26')](function(){return _0x13260d;});}})[_0x7204('0x26')](respondWithStatusCode(_0x33018d,null))[_0x7204('0x52')](handleError(_0x33018d,null));}; \ No newline at end of file +var _0x641e=['teams','Agents','online','voicePause','interface','flatMap','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','forEach','emit','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','spread','userVoiceQueue:save','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','NOW()','scheduledAt','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','ignore','map','value','type','find','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','inbound','CmHopper','findOne','CmHopperHistory','nolimit','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams'];(function(_0xc1e671,_0x33b06d){var _0x365031=function(_0x175a23){while(--_0x175a23){_0xc1e671['push'](_0xc1e671['shift']());}};_0x365031(++_0x33b06d);}(_0x641e,0x104));var _0xe641=function(_0x44f6b7,_0x5b75af){_0x44f6b7=_0x44f6b7-0x0;var _0x5d612a=_0x641e[_0x44f6b7];return _0x5d612a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe641('0x0'));var zipdir=require(_0xe641('0x1'));var jsonpatch=require(_0xe641('0x2'));var rp=require(_0xe641('0x3'));var moment=require(_0xe641('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe641('0x5'));var util=require(_0xe641('0x6'));var path=require(_0xe641('0x7'));var sox=require(_0xe641('0x8'));var csv=require(_0xe641('0x9'));var ejs=require(_0xe641('0xa'));var fs=require('fs');var fs_extra=require(_0xe641('0xb'));var _=require(_0xe641('0xc'));var squel=require(_0xe641('0xd'));var crypto=require('crypto');var jsforce=require(_0xe641('0xe'));var deskjs=require(_0xe641('0xf'));var toCsv=require(_0xe641('0x9'));var querystring=require(_0xe641('0x10'));var Papa=require(_0xe641('0x11'));var Redis=require(_0xe641('0x12'));var authService=require(_0xe641('0x13'));var qs=require(_0xe641('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe641('0x15'));var logger=require(_0xe641('0x16'))(_0xe641('0x17'));var utils=require('../../config/utils');var config=require(_0xe641('0x18'));var licenseUtil=require(_0xe641('0x19'));var db=require(_0xe641('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe641('0x1b'),'port':0x18eb});var socket=require(_0xe641('0x1c'))(new Redis(config[_0xe641('0x1d')]));require(_0xe641('0x1e'))[_0xe641('0x1f')](socket);function respondWithStatusCode(_0x2d7e6e,_0x60d638){_0x60d638=_0x60d638||0xcc;return function(_0x32f1c6){if(_0x32f1c6){return _0x2d7e6e['sendStatus'](_0x60d638);}return _0x2d7e6e['status'](_0x60d638)[_0xe641('0x20')]();};}function respondWithResult(_0x23f007,_0x133830){_0x133830=_0x133830||0xc8;return function(_0x2dfe3e){if(_0x2dfe3e){return _0x23f007[_0xe641('0x21')](_0x133830)[_0xe641('0x22')](_0x2dfe3e);}};}function respondWithFilteredResult(_0x267b8a,_0x4ce7ee){return function(_0x2af739){if(_0x2af739){var _0x35dff7=typeof _0x4ce7ee[_0xe641('0x23')]===_0xe641('0x24')&&typeof _0x4ce7ee[_0xe641('0x25')]===_0xe641('0x24');var _0x55e455=_0x2af739['count'];var _0x212548=_0x35dff7?0x0:_0x4ce7ee[_0xe641('0x23')];var _0x277d53=_0x35dff7?_0x2af739[_0xe641('0x26')]:_0x4ce7ee['offset']+_0x4ce7ee[_0xe641('0x25')];var _0x23414d;if(_0x277d53>=_0x55e455){_0x277d53=_0x55e455;_0x23414d=0xc8;}else{_0x23414d=0xce;}_0x267b8a[_0xe641('0x21')](_0x23414d);return _0x267b8a[_0xe641('0x27')]('Content-Range',_0x212548+'-'+_0x277d53+'/'+_0x55e455)[_0xe641('0x22')](_0x2af739);}return null;};}function patchUpdates(_0x1667f8){return function(_0x59b46a){try{jsonpatch['apply'](_0x59b46a,_0x1667f8,!![]);}catch(_0x5d8a11){return BPromise[_0xe641('0x28')](_0x5d8a11);}return _0x59b46a[_0xe641('0x29')]();};}function saveUpdates(_0x5e178b,_0x77b6e2){return function(_0xe32a78){if(_0xe32a78){return _0xe32a78[_0xe641('0x2a')](_0x5e178b)[_0xe641('0x2b')](function(_0x3bed5b){return _0x3bed5b;});}return null;};}function removeEntity(_0x638cae,_0x1c9419){return function(_0x13f2d4){if(_0x13f2d4){return _0x13f2d4[_0xe641('0x2c')]()[_0xe641('0x2b')](function(){var _0x2319da=_0x13f2d4[_0xe641('0x2d')]({'plain':!![]});var _0x19ff40=[{'name':_0xe641('0x2e'),'value':'inbound','ignore':![]},{'name':_0xe641('0x2f'),'value':_0xe641('0x30'),'ignore':![]}];var _0x2e2434=_(_0x19ff40)['filter'](_0xe641('0x31'))[_0xe641('0x32')](_0xe641('0x33'))[_0xe641('0x33')]();if(_['includes'](_0x2e2434,_0x2319da[_0xe641('0x34')])){return;}var _0x47c6bd=_[_0xe641('0x35')](_0x19ff40,[_0xe641('0x33'),_0x2319da[_0xe641('0x34')]])['name'];return db[_0xe641('0x36')][_0xe641('0x2c')]({'where':{'type':_0x47c6bd,'resourceId':_0x2319da['id']}})[_0xe641('0x2b')](function(){return _0x13f2d4;});})[_0xe641('0x2b')](function(){_0x638cae[_0xe641('0x21')](0xcc)[_0xe641('0x20')]();});}};}function handleEntityNotFound(_0x4629d3,_0x47838e){return function(_0x525dc0){if(!_0x525dc0){_0x4629d3[_0xe641('0x37')](0x194);}return _0x525dc0;};}function handleError(_0x32ce84,_0x38929f){_0x38929f=_0x38929f||0x1f4;return function(_0xaf80e5){logger[_0xe641('0x38')](_0xaf80e5[_0xe641('0x39')]);if(_0xaf80e5[_0xe641('0x3a')]){delete _0xaf80e5[_0xe641('0x3a')];}_0x32ce84[_0xe641('0x21')](_0x38929f)[_0xe641('0x3b')](_0xaf80e5);};}exports[_0xe641('0x3c')]=function(_0x5c07d9,_0x17d70e){var _0x5284f5={},_0xdc490e={},_0x2cb893={'count':0x0,'rows':[]};var _0x520288=_[_0xe641('0x32')](db[_0xe641('0x3d')][_0xe641('0x3e')],function(_0xff75d8){return{'name':_0xff75d8[_0xe641('0x3f')],'type':_0xff75d8[_0xe641('0x34')][_0xe641('0x40')]};});_0xdc490e[_0xe641('0x41')]=_['map'](_0x520288,_0xe641('0x3a'));_0xdc490e[_0xe641('0x42')]=_[_0xe641('0x43')](_0x5c07d9['query']);_0xdc490e[_0xe641('0x44')]=_[_0xe641('0x45')](_0xdc490e['model'],_0xdc490e[_0xe641('0x42')]);_0x5284f5[_0xe641('0x46')]=_[_0xe641('0x45')](_0xdc490e[_0xe641('0x41')],qs[_0xe641('0x47')](_0x5c07d9['query'][_0xe641('0x47')]));_0x5284f5[_0xe641('0x46')]=_0x5284f5['attributes'][_0xe641('0x48')]?_0x5284f5[_0xe641('0x46')]:_0xdc490e[_0xe641('0x41')];if(!_0x5c07d9[_0xe641('0x42')][_0xe641('0x49')]('nolimit')){_0x5284f5['limit']=qs[_0xe641('0x25')](_0x5c07d9[_0xe641('0x42')][_0xe641('0x25')]);_0x5284f5[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x5c07d9[_0xe641('0x42')][_0xe641('0x23')]);}_0x5284f5[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x5c07d9[_0xe641('0x42')][_0xe641('0x4b')]);_0x5284f5[_0xe641('0x4c')]=qs[_0xe641('0x44')](_[_0xe641('0x4d')](_0x5c07d9[_0xe641('0x42')],_0xdc490e['filters']),_0x520288);if(_0x5c07d9[_0xe641('0x42')][_0xe641('0x4e')]){_0x5284f5[_0xe641('0x4c')]=_[_0xe641('0x4f')](_0x5284f5[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x520288,function(_0x3a5484){if(_0x3a5484[_0xe641('0x34')]!==_0xe641('0x50')){var _0x562a5c={};_0x562a5c[_0x3a5484[_0xe641('0x3a')]]={'$like':'%'+_0x5c07d9['query'][_0xe641('0x4e')]+'%'};return _0x562a5c;}})});}_0x5284f5=_[_0xe641('0x4f')]({},_0x5284f5,_0x5c07d9['options']);var _0x3ab9d4={'where':_0x5284f5['where']};return db[_0xe641('0x3d')][_0xe641('0x26')](_0x3ab9d4)[_0xe641('0x2b')](function(_0x3b02d2){_0x2cb893[_0xe641('0x26')]=_0x3b02d2;if(_0x5c07d9[_0xe641('0x42')][_0xe641('0x51')]){_0x5284f5[_0xe641('0x52')]=[{'all':!![]}];}return db['VoiceQueue'][_0xe641('0x53')](_0x5284f5);})[_0xe641('0x2b')](function(_0x5b9dcd){_0x2cb893[_0xe641('0x54')]=_0x5b9dcd;return _0x2cb893;})[_0xe641('0x2b')](respondWithFilteredResult(_0x17d70e,_0x5284f5))[_0xe641('0x55')](handleError(_0x17d70e,null));};exports[_0xe641('0x56')]=function(_0x207d32,_0x2c3b04){var _0xc303f9={'raw':![],'where':{'id':_0x207d32[_0xe641('0x57')]['id']}},_0x3d8cbe={};_0x3d8cbe[_0xe641('0x41')]=_[_0xe641('0x43')](db['VoiceQueue'][_0xe641('0x3e')]);_0x3d8cbe['query']=_[_0xe641('0x43')](_0x207d32[_0xe641('0x42')]);_0x3d8cbe['filters']=_[_0xe641('0x45')](_0x3d8cbe[_0xe641('0x41')],_0x3d8cbe[_0xe641('0x42')]);_0xc303f9['attributes']=_[_0xe641('0x45')](_0x3d8cbe[_0xe641('0x41')],qs['fields'](_0x207d32['query'][_0xe641('0x47')]));_0xc303f9['attributes']=_0xc303f9[_0xe641('0x46')][_0xe641('0x48')]?_0xc303f9[_0xe641('0x46')]:_0x3d8cbe[_0xe641('0x41')];if(_0x207d32[_0xe641('0x42')][_0xe641('0x51')]){_0xc303f9[_0xe641('0x52')]=[{'all':!![]}];}_0xc303f9=_['merge']({},_0xc303f9,_0x207d32[_0xe641('0x58')]);return db[_0xe641('0x3d')][_0xe641('0x35')](_0xc303f9)[_0xe641('0x2b')](handleEntityNotFound(_0x2c3b04,null))['then'](respondWithResult(_0x2c3b04,null))[_0xe641('0x55')](handleError(_0x2c3b04,null));};exports[_0xe641('0x59')]=function(_0x3567f5,_0x504176){return db[_0xe641('0x3d')]['create'](_0x3567f5['body'],{})[_0xe641('0x2b')](function(_0x496b59){var _0x8c9a1b=_0x3567f5['user'][_0xe641('0x2d')]({'plain':!![]});if(!_0x8c9a1b)throw new Error(_0xe641('0x5a'));if(_0x8c9a1b['role']===_0xe641('0x5b')){var _0x26ea53=_0x496b59[_0xe641('0x2d')]({'plain':!![]});var _0x1af161=[{'name':_0xe641('0x2e'),'value':'inbound'},{'name':_0xe641('0x2f'),'value':_0xe641('0x30')}];var _0x672d03=_['find'](_0x1af161,[_0xe641('0x33'),_0x26ea53[_0xe641('0x34')]])['name'];return db[_0xe641('0x5c')][_0xe641('0x35')]({'where':{'name':_0x672d03,'userProfileId':_0x8c9a1b[_0xe641('0x5d')]},'raw':!![]})[_0xe641('0x2b')](function(_0x53a122){if(_0x53a122&&_0x53a122[_0xe641('0x5e')]===0x0){return db[_0xe641('0x36')]['create']({'name':_0x26ea53[_0xe641('0x3a')],'resourceId':_0x26ea53['id'],'type':_0x53a122[_0xe641('0x3a')],'sectionId':_0x53a122['id']},{})[_0xe641('0x2b')](function(){return _0x496b59;});}else{return _0x496b59;}})[_0xe641('0x55')](function(_0x468435){logger['error'](_0xe641('0x5f'),_0x468435);throw _0x468435;});}return _0x496b59;})[_0xe641('0x2b')](respondWithResult(_0x504176,0xc9))[_0xe641('0x55')](handleError(_0x504176,null));};exports['clone']=function(_0x2b9ea6,_0x569a39){var _0x4850f8={'where':{'id':_0x2b9ea6['params']['id']}},_0x1ec26d={};_0x1ec26d[_0xe641('0x41')]=_[_0xe641('0x43')](db[_0xe641('0x3d')][_0xe641('0x3e')]);_0x4850f8[_0xe641('0x46')]=_['intersection'](_0x1ec26d[_0xe641('0x41')],qs[_0xe641('0x47')](_0x2b9ea6[_0xe641('0x42')][_0xe641('0x47')]));_0x4850f8['attributes']=_0x4850f8[_0xe641('0x46')][_0xe641('0x48')]?_0x4850f8[_0xe641('0x46')]:_0x1ec26d[_0xe641('0x41')];if(_0x2b9ea6[_0xe641('0x42')][_0xe641('0x51')]){_0x4850f8[_0xe641('0x52')]=[{'all':!![]}];}_0x4850f8=_[_0xe641('0x4f')]({},_0x4850f8,_0x2b9ea6[_0xe641('0x58')]);return db['VoiceQueue'][_0xe641('0x35')](_0x4850f8)['then'](handleEntityNotFound(_0x569a39,null))[_0xe641('0x2b')](function(_0xf1f318){if(_0xf1f318){var _0x3427e1=_0xf1f318[_0xe641('0x2d')]({'plain':!![]});_0x3427e1=qs['omit'](_0x3427e1,['id',_0xe641('0x60'),_0xe641('0x61')]);_0x2b9ea6[_0xe641('0x62')]=_[_0xe641('0x63')](_0x2b9ea6[_0xe641('0x62')],['id',_0xe641('0x60'),_0xe641('0x61')]);return db[_0xe641('0x3d')][_0xe641('0x59')](_[_0xe641('0x4f')](_0x3427e1,_0x2b9ea6[_0xe641('0x62')]),{'include':_0x2b9ea6[_0xe641('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0xe641('0x2b')](function(_0x13f9e7){var _0x139592=_0x2b9ea6[_0xe641('0x5b')][_0xe641('0x2d')]({'plain':!![]});if(!_0x139592)throw new Error(_0xe641('0x5a'));if(_0x139592['role']===_0xe641('0x5b')){var _0x3a9004=_0x13f9e7[_0xe641('0x2d')]({'plain':!![]});var _0x5c453b=[{'name':'VoiceQueues','value':_0xe641('0x64')},{'name':'QueueCampaigns','value':_0xe641('0x30')}];var _0x62bf16=_[_0xe641('0x35')](_0x5c453b,['value',_0x3a9004[_0xe641('0x34')]])['name'];return db[_0xe641('0x5c')][_0xe641('0x35')]({'where':{'name':_0x62bf16,'userProfileId':_0x139592[_0xe641('0x5d')]},'raw':!![]})[_0xe641('0x2b')](function(_0x24515b){if(_0x24515b&&_0x24515b['autoAssociation']===0x0){return db['UserProfileResource'][_0xe641('0x59')]({'name':_0x3a9004[_0xe641('0x3a')],'resourceId':_0x3a9004['id'],'type':_0x24515b[_0xe641('0x3a')],'sectionId':_0x24515b['id']},{})[_0xe641('0x2b')](function(){return _0x13f9e7;});}else{return _0x13f9e7;}})['catch'](function(_0x275cc3){logger[_0xe641('0x38')](_0xe641('0x5f'),_0x275cc3);throw _0x275cc3;});}return _0x13f9e7;});}})[_0xe641('0x2b')](respondWithResult(_0x569a39,0xc9))['catch'](handleError(_0x569a39,null));};exports['update']=function(_0x347c03,_0x270df4){if(_0x347c03[_0xe641('0x62')]['id']){delete _0x347c03[_0xe641('0x62')]['id'];}return db[_0xe641('0x3d')][_0xe641('0x35')]({'where':{'id':_0x347c03[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x270df4,null))[_0xe641('0x2b')](saveUpdates(_0x347c03[_0xe641('0x62')],null))[_0xe641('0x2b')](respondWithResult(_0x270df4,null))[_0xe641('0x55')](handleError(_0x270df4,null));};exports[_0xe641('0x2c')]=function(_0x282502,_0x21bc08){return db[_0xe641('0x3d')]['find']({'where':{'id':_0x282502[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x21bc08,null))[_0xe641('0x2b')](removeEntity(_0x21bc08,null))[_0xe641('0x55')](handleError(_0x21bc08,null));};exports['getHoppers']=function(_0x34d7b5,_0x166a4d,_0x41c813){var _0x37d641={'raw':![],'where':{}};var _0x5d72e0={};var _0x455e48={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x34d7b5['params']['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x166a4d,null))[_0xe641('0x2b')](function(_0x228ec7){if(_0x228ec7){_0x5d72e0['model']=_[_0xe641('0x43')](db['CmHopper'][_0xe641('0x3e')]);_0x5d72e0['query']=_[_0xe641('0x43')](_0x34d7b5[_0xe641('0x42')]);_0x5d72e0[_0xe641('0x44')]=_[_0xe641('0x45')](_0x5d72e0[_0xe641('0x41')],_0x5d72e0[_0xe641('0x42')]);_0x37d641[_0xe641('0x46')]=_['intersection'](_0x5d72e0[_0xe641('0x41')],qs[_0xe641('0x47')](_0x34d7b5[_0xe641('0x42')][_0xe641('0x47')]));_0x37d641[_0xe641('0x46')]=_0x37d641[_0xe641('0x46')][_0xe641('0x48')]?_0x37d641[_0xe641('0x46')]:_0x5d72e0[_0xe641('0x41')];if(!_0x34d7b5['query'][_0xe641('0x49')]('nolimit')){_0x37d641['limit']=qs[_0xe641('0x25')](_0x34d7b5[_0xe641('0x42')][_0xe641('0x25')]);_0x37d641[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x34d7b5[_0xe641('0x42')][_0xe641('0x23')]);}_0x37d641[_0xe641('0x4a')]=qs['sort'](_0x34d7b5[_0xe641('0x42')]['sort']);_0x37d641['where']=qs[_0xe641('0x44')](_['pick'](_0x34d7b5['query'],_0x5d72e0['filters']));_0x37d641[_0xe641('0x4c')]['VoiceQueueId']=_0x228ec7['id'];if(_0x34d7b5[_0xe641('0x42')][_0xe641('0x4e')]){_0x37d641[_0xe641('0x4c')]=_[_0xe641('0x4f')](_0x37d641[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x37d641[_0xe641('0x46')],function(_0x49a1d8){var _0x1d0de8={};_0x1d0de8[_0x49a1d8]={'$like':'%'+_0x34d7b5['query']['filter']+'%'};return _0x1d0de8;})});}_0x37d641=_['merge']({},_0x37d641,_0x34d7b5[_0xe641('0x58')]);return db[_0xe641('0x65')][_0xe641('0x26')]({'where':_0x37d641[_0xe641('0x4c')]})[_0xe641('0x2b')](function(_0x20ffae){_0x455e48[_0xe641('0x26')]=_0x20ffae;if(_0x34d7b5[_0xe641('0x42')][_0xe641('0x51')]){_0x37d641[_0xe641('0x52')]=[{'all':!![]}];}return db[_0xe641('0x65')]['findAll'](_0x37d641);})[_0xe641('0x2b')](function(_0x5a17ed){_0x455e48[_0xe641('0x54')]=_0x5a17ed;return _0x455e48;});}})['then'](respondWithFilteredResult(_0x166a4d,_0x37d641))[_0xe641('0x55')](handleError(_0x166a4d,null));};exports['getHopperHistories']=function(_0x58facf,_0x5bb49d,_0x118cb1){var _0x5c450f={'raw':!![],'where':{}};var _0x5ddf78={};var _0x13e4b3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe641('0x66')]({'where':{'id':_0x58facf['params']['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x5bb49d,null))[_0xe641('0x2b')](function(_0x3e9a20){if(_0x3e9a20){_0x5ddf78['model']=_[_0xe641('0x43')](db[_0xe641('0x67')][_0xe641('0x3e')]);_0x5ddf78[_0xe641('0x42')]=_[_0xe641('0x43')](_0x58facf[_0xe641('0x42')]);_0x5ddf78[_0xe641('0x44')]=_['intersection'](_0x5ddf78['model'],_0x5ddf78[_0xe641('0x42')]);_0x5c450f['attributes']=_[_0xe641('0x45')](_0x5ddf78['model'],qs[_0xe641('0x47')](_0x58facf['query']['fields']));_0x5c450f['attributes']=_0x5c450f[_0xe641('0x46')][_0xe641('0x48')]?_0x5c450f['attributes']:_0x5ddf78[_0xe641('0x41')];if(!_0x58facf[_0xe641('0x42')][_0xe641('0x49')](_0xe641('0x68'))){_0x5c450f[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x58facf[_0xe641('0x42')][_0xe641('0x25')]);_0x5c450f[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x58facf[_0xe641('0x42')][_0xe641('0x23')]);}_0x5c450f[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x58facf['query'][_0xe641('0x4b')]);_0x5c450f[_0xe641('0x4c')]=qs[_0xe641('0x44')](_[_0xe641('0x4d')](_0x58facf['query'],_0x5ddf78['filters']));_0x5c450f[_0xe641('0x4c')]['VoiceQueueId']=_0x3e9a20['id'];if(_0x58facf[_0xe641('0x42')][_0xe641('0x4e')]){_0x5c450f[_0xe641('0x4c')]=_['merge'](_0x5c450f['where'],{'$or':_[_0xe641('0x32')](_0x5c450f[_0xe641('0x46')],function(_0x3f6464){var _0x3352ff={};_0x3352ff[_0x3f6464]={'$like':'%'+_0x58facf[_0xe641('0x42')][_0xe641('0x4e')]+'%'};return _0x3352ff;})});}_0x5c450f=_[_0xe641('0x4f')]({},_0x5c450f,_0x58facf[_0xe641('0x58')]);return db['CmHopperHistory'][_0xe641('0x26')]({'where':_0x5c450f[_0xe641('0x4c')]})[_0xe641('0x2b')](function(_0x14a55b){_0x13e4b3['count']=_0x14a55b;if(_0x58facf[_0xe641('0x42')][_0xe641('0x51')]){_0x5c450f[_0xe641('0x52')]=[{'all':!![]}];}return db[_0xe641('0x67')][_0xe641('0x53')](_0x5c450f);})[_0xe641('0x2b')](function(_0x2af444){_0x13e4b3['rows']=_0x2af444;return _0x13e4b3;});}})[_0xe641('0x2b')](respondWithFilteredResult(_0x5bb49d,_0x5c450f))[_0xe641('0x55')](handleError(_0x5bb49d,null));};exports['getHopperFinals']=function(_0x4bdc02,_0x4fd76a,_0x279e6c){var _0x5006eb={'raw':!![],'where':{}};var _0x4e2f17={};var _0xd39608={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe641('0x66')]({'where':{'id':_0x4bdc02[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x4fd76a,null))[_0xe641('0x2b')](function(_0x4328c9){if(_0x4328c9){_0x4e2f17[_0xe641('0x41')]=_['keys'](db[_0xe641('0x69')][_0xe641('0x3e')]);_0x4e2f17[_0xe641('0x42')]=_[_0xe641('0x43')](_0x4bdc02[_0xe641('0x42')]);_0x4e2f17[_0xe641('0x44')]=_[_0xe641('0x45')](_0x4e2f17[_0xe641('0x41')],_0x4e2f17[_0xe641('0x42')]);_0x5006eb['attributes']=_['intersection'](_0x4e2f17[_0xe641('0x41')],qs[_0xe641('0x47')](_0x4bdc02[_0xe641('0x42')][_0xe641('0x47')]));_0x5006eb[_0xe641('0x46')]=_0x5006eb[_0xe641('0x46')][_0xe641('0x48')]?_0x5006eb[_0xe641('0x46')]:_0x4e2f17[_0xe641('0x41')];if(!_0x4bdc02[_0xe641('0x42')][_0xe641('0x49')](_0xe641('0x68'))){_0x5006eb[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x4bdc02[_0xe641('0x42')][_0xe641('0x25')]);_0x5006eb[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x4bdc02[_0xe641('0x42')]['offset']);}_0x5006eb[_0xe641('0x4a')]=qs['sort'](_0x4bdc02[_0xe641('0x42')][_0xe641('0x4b')]);_0x5006eb['where']=qs[_0xe641('0x44')](_[_0xe641('0x4d')](_0x4bdc02[_0xe641('0x42')],_0x4e2f17[_0xe641('0x44')]));_0x5006eb[_0xe641('0x4c')][_0xe641('0x6a')]=_0x4328c9['id'];if(_0x4bdc02[_0xe641('0x42')]['filter']){_0x5006eb['where']=_[_0xe641('0x4f')](_0x5006eb[_0xe641('0x4c')],{'$or':_['map'](_0x5006eb[_0xe641('0x46')],function(_0x2d904f){var _0x525dd2={};_0x525dd2[_0x2d904f]={'$like':'%'+_0x4bdc02[_0xe641('0x42')]['filter']+'%'};return _0x525dd2;})});}_0x5006eb=_['merge']({},_0x5006eb,_0x4bdc02[_0xe641('0x58')]);return db[_0xe641('0x69')]['count']({'where':_0x5006eb[_0xe641('0x4c')]})[_0xe641('0x2b')](function(_0x4933d9){_0xd39608[_0xe641('0x26')]=_0x4933d9;if(_0x4bdc02[_0xe641('0x42')]['includeAll']){_0x5006eb[_0xe641('0x52')]=[{'all':!![]}];}return db[_0xe641('0x69')][_0xe641('0x53')](_0x5006eb);})[_0xe641('0x2b')](function(_0x49aae4){_0xd39608[_0xe641('0x54')]=_0x49aae4;return _0xd39608;});}})[_0xe641('0x2b')](respondWithFilteredResult(_0x4fd76a,_0x5006eb))['catch'](handleError(_0x4fd76a,null));};exports[_0xe641('0x6b')]=function(_0x5f09ee,_0x56d9db,_0x55a1f3){var _0x5f18e0={'raw':!![],'where':{}};var _0x29954c={};var _0x30ec20={'count':0x0,'rows':[]};return db[_0xe641('0x3d')]['findOne']({'where':{'id':_0x5f09ee[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x56d9db,null))['then'](function(_0xd885c3){if(_0xd885c3){_0x29954c[_0xe641('0x41')]=_[_0xe641('0x43')](db[_0xe641('0x6c')][_0xe641('0x3e')]);_0x29954c[_0xe641('0x42')]=_[_0xe641('0x43')](_0x5f09ee[_0xe641('0x42')]);_0x29954c[_0xe641('0x44')]=_[_0xe641('0x45')](_0x29954c[_0xe641('0x41')],_0x29954c[_0xe641('0x42')]);_0x5f18e0[_0xe641('0x46')]=_[_0xe641('0x45')](_0x29954c[_0xe641('0x41')],qs['fields'](_0x5f09ee['query'][_0xe641('0x47')]));_0x5f18e0['attributes']=_0x5f18e0[_0xe641('0x46')][_0xe641('0x48')]?_0x5f18e0[_0xe641('0x46')]:_0x29954c['model'];if(!_0x5f09ee['query']['hasOwnProperty'](_0xe641('0x68'))){_0x5f18e0[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x5f09ee[_0xe641('0x42')][_0xe641('0x25')]);_0x5f18e0[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x5f09ee['query'][_0xe641('0x23')]);}_0x5f18e0[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x5f09ee[_0xe641('0x42')][_0xe641('0x4b')]);_0x5f18e0[_0xe641('0x4c')]=qs['filters'](_[_0xe641('0x4d')](_0x5f09ee[_0xe641('0x42')],_0x29954c[_0xe641('0x44')]));_0x5f18e0[_0xe641('0x4c')][_0xe641('0x6a')]=_0xd885c3['id'];if(_0x5f09ee[_0xe641('0x42')][_0xe641('0x4e')]){_0x5f18e0['where']=_[_0xe641('0x4f')](_0x5f18e0[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x5f18e0[_0xe641('0x46')],function(_0x257de9){var _0x54f5ad={};_0x54f5ad[_0x257de9]={'$like':'%'+_0x5f09ee[_0xe641('0x42')]['filter']+'%'};return _0x54f5ad;})});}_0x5f18e0=_[_0xe641('0x4f')]({},_0x5f18e0,_0x5f09ee[_0xe641('0x58')]);return db['CmHopperBlack'][_0xe641('0x26')]({'where':_0x5f18e0['where']})['then'](function(_0xa27e40){_0x30ec20[_0xe641('0x26')]=_0xa27e40;if(_0x5f09ee[_0xe641('0x42')][_0xe641('0x51')]){_0x5f18e0[_0xe641('0x52')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe641('0x53')](_0x5f18e0);})[_0xe641('0x2b')](function(_0x58b5ab){_0x30ec20[_0xe641('0x54')]=_0x58b5ab;return _0x30ec20;});}})[_0xe641('0x2b')](respondWithFilteredResult(_0x56d9db,_0x5f18e0))[_0xe641('0x55')](handleError(_0x56d9db,null));};exports['getTeams']=function(_0x40a7dd,_0x229cd1,_0x2e4aed){var _0x2f48a8={};var _0x4f6e79={};var _0x359b43;var _0x49a1d7;return db[_0xe641('0x3d')]['findOne']({'where':{'id':_0x40a7dd[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x229cd1,null))[_0xe641('0x2b')](function(_0x3a8a0e){if(_0x3a8a0e){_0x359b43=_0x3a8a0e;_0x4f6e79[_0xe641('0x41')]=_[_0xe641('0x43')](db[_0xe641('0x6d')][_0xe641('0x3e')]);_0x4f6e79[_0xe641('0x42')]=_[_0xe641('0x43')](_0x40a7dd[_0xe641('0x42')]);_0x4f6e79[_0xe641('0x44')]=_[_0xe641('0x45')](_0x4f6e79[_0xe641('0x41')],_0x4f6e79[_0xe641('0x42')]);_0x2f48a8[_0xe641('0x46')]=_[_0xe641('0x45')](_0x4f6e79[_0xe641('0x41')],qs[_0xe641('0x47')](_0x40a7dd[_0xe641('0x42')][_0xe641('0x47')]));_0x2f48a8['attributes']=_0x2f48a8[_0xe641('0x46')][_0xe641('0x48')]?_0x2f48a8[_0xe641('0x46')]:_0x4f6e79['model'];_0x2f48a8[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x40a7dd[_0xe641('0x42')][_0xe641('0x4b')]);_0x2f48a8[_0xe641('0x4c')]=qs[_0xe641('0x44')](_[_0xe641('0x4d')](_0x40a7dd[_0xe641('0x42')],_0x4f6e79['filters']));if(_0x40a7dd[_0xe641('0x42')][_0xe641('0x4e')]){_0x2f48a8['where']=_[_0xe641('0x4f')](_0x2f48a8['where'],{'$or':_[_0xe641('0x32')](_0x2f48a8[_0xe641('0x46')],function(_0x4c3cab){var _0x22ebbe={};_0x22ebbe[_0x4c3cab]={'$like':'%'+_0x40a7dd[_0xe641('0x42')]['filter']+'%'};return _0x22ebbe;})});}_0x2f48a8=_[_0xe641('0x4f')]({},_0x2f48a8,_0x40a7dd[_0xe641('0x58')]);return _0x359b43[_0xe641('0x6e')](_0x2f48a8);}})[_0xe641('0x2b')](function(_0x3d8581){if(_0x3d8581){_0x49a1d7=_0x3d8581[_0xe641('0x48')];if(!_0x40a7dd[_0xe641('0x42')]['hasOwnProperty'](_0xe641('0x68'))){_0x2f48a8[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x40a7dd[_0xe641('0x42')][_0xe641('0x25')]);_0x2f48a8[_0xe641('0x23')]=qs['offset'](_0x40a7dd[_0xe641('0x42')][_0xe641('0x23')]);}return _0x359b43['getTeams'](_0x2f48a8);}})[_0xe641('0x2b')](function(_0x5c324e){if(_0x5c324e){return _0x5c324e?{'count':_0x49a1d7,'rows':_0x5c324e}:null;}})[_0xe641('0x2b')](respondWithResult(_0x229cd1,null))[_0xe641('0x55')](handleError(_0x229cd1,null));};exports[_0xe641('0x6f')]=function(_0x533993,_0xb40214,_0xe0e854){var _0x139a5b=_0x533993[_0xe641('0x62')][_0xe641('0x70')];var _0x4b6dc7=_[_0xe641('0x32')](_0x139a5b,'id');return db[_0xe641('0x6d')]['findAll']({'where':{'id':_0x4b6dc7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe641('0x71'),'attributes':['id',_0xe641('0x3a'),_0xe641('0x72'),_0xe641('0x73'),_0xe641('0x74')],'raw':!![]}]})['then'](function(_0x2da5c6){if(_0x2da5c6){var _0x182b52=_[_0xe641('0x75')](_0x2da5c6,function(_0xcaa002){var _0x480407=_0xcaa002['get']({'plain':!![]});_0x480407[_0xe641('0x71')]['forEach'](function(_0x8ae103){_0x8ae103[_0xe641('0x76')]=_[_0xe641('0x35')](_0x139a5b,{'id':_0x480407['id']})[_0xe641('0x76')];});return _0x480407[_0xe641('0x71')];});return db[_0xe641('0x3d')][_0xe641('0x35')]({'where':{'id':_0x533993[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](function(_0x35da5b){return db['sequelize']['transaction'](function(_0x4bf138){return _0x35da5b[_0xe641('0x6f')](_0x4b6dc7,{'transaction':_0x4bf138})[_0xe641('0x2b')](function(){return BPromise[_0xe641('0x77')](_0x139a5b,function(_0x54145e){return db[_0xe641('0x78')][_0xe641('0x79')]({'TeamId':_0x54145e['id'],'VoiceQueueId':_0x533993[_0xe641('0x57')]['id'],'penalty':_0x54145e[_0xe641('0x76')]},{'transaction':_0x4bf138});});})[_0xe641('0x2b')](function(){return BPromise[_0xe641('0x77')](_0x182b52,function(_0x591eda){return db[_0xe641('0x7a')]['findOrCreate']({'where':{'UserId':_0x591eda['id'],'VoiceQueueId':_0x533993[_0xe641('0x57')]['id']},'defaults':{'penalty':_0x591eda['penalty']},'transaction':_0x4bf138});});})[_0xe641('0x2b')](function(){return BPromise[_0xe641('0x77')](_[_0xe641('0x4e')](_0x182b52,{'online':!![]}),function(_0x1de03c){return db[_0xe641('0x7b')][_0xe641('0x79')]({'membername':_0x1de03c['name'],'UserId':_0x1de03c['id'],'queue_name':_0x35da5b['name'],'VoiceQueueId':_0x35da5b['id'],'interface':_[_0xe641('0x7c')](_0x1de03c[_0xe641('0x74')])?util[_0xe641('0x7d')]('SIP/%s',_0x1de03c[_0xe641('0x3a')]):_0x1de03c[_0xe641('0x74')],'paused':_0x1de03c[_0xe641('0x73')]||![],'penalty':_0x1de03c['penalty']},{'transaction':_0x4bf138});});})[_0xe641('0x2b')](function(){_0x182b52[_0xe641('0x7e')](function(_0x1d6f6f){socket[_0xe641('0x7f')]('userVoiceQueue:save',{'UserId':_0x1d6f6f['id'],'VoiceQueueId':_0x35da5b['id']});});});});});}})['then'](respondWithStatusCode(_0xb40214,null))['catch'](handleError(_0xb40214,null));};exports[_0xe641('0x80')]=function(_0x24ed38,_0x17dea7,_0x127a45){return db[_0xe641('0x6d')][_0xe641('0x53')]({'where':{'id':_0x24ed38[_0xe641('0x42')][_0xe641('0x81')]},'attributes':['id'],'include':[{'model':db[_0xe641('0x82')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x17dea7,null))[_0xe641('0x2b')](function(_0x51fde8){var _0x67921c=_[_0xe641('0x32')](_0x51fde8,'id');var _0x24ccf8=[];var _0x531c82=[];var _0xfa17ff=squel[_0xe641('0x83')]();_0xfa17ff[_0xe641('0x84')](_0xe641('0x85'))[_0xe641('0x86')](_0xe641('0x87'),'tq')['join']('user_has_teams','ut',_0xe641('0x88'))[_0xe641('0x4c')]('VoiceQueueId\x20=\x20?',_0x24ed38['params']['id']);for(var _0x32aa59=0x0;_0x32aa59<_0x51fde8[_0xe641('0x48')];_0x32aa59+=0x1){let _0x856d0d=_0x51fde8[_0x32aa59];for(var _0x4d26e0=0x0;_0x4d26e0<_0x856d0d[_0xe641('0x71')][_0xe641('0x48')];_0x4d26e0+=0x1){let _0x1f9198=_0x856d0d[_0xe641('0x71')][_0x4d26e0];var _0x2c3ac4=_0xfa17ff[_0xe641('0x89')]();_0x2c3ac4[_0xe641('0x4c')]('ut.UserId\x20=\x20?',_0x1f9198['id']);_0x531c82[_0xe641('0x8a')](db[_0xe641('0x8b')][_0xe641('0x42')](_0x2c3ac4[_0xe641('0x8c')](),{'type':db['sequelize'][_0xe641('0x8d')]['SELECT']})[_0xe641('0x2b')](function(_0x5c2eb5){if(_0x5c2eb5[_0xe641('0x48')]===0x1){return _0x1f9198['id'];}else{var _0xb38246=_[_0xe641('0x8e')](_['map'](_0x5c2eb5,_0xe641('0x8f')),function(_0x9670d8){return _[_0xe641('0x90')](_0x67921c,_0x9670d8);});if(_0xb38246){return _0x1f9198['id'];}}}));}}return BPromise[_0xe641('0x91')](_0x531c82)[_0xe641('0x2b')](function(_0x2023b9){_0x24ccf8=_(_0x24ccf8)[_0xe641('0x92')](_0x2023b9)[_0xe641('0x93')]()[_0xe641('0x33')]();return db['VoiceQueue'][_0xe641('0x35')]({'where':{'id':_0x24ed38[_0xe641('0x57')]['id']}})['then'](function(_0x507ccc){return db['sequelize'][_0xe641('0x94')](function(_0x977f){return _0x507ccc['removeTeams'](_0x24ed38['query']['ids'],{'transaction':_0x977f})[_0xe641('0x2b')](function(){if(!_[_0xe641('0x95')](_0x24ccf8)){return _0x507ccc[_0xe641('0x96')](_0x24ccf8,{'transaction':_0x977f})[_0xe641('0x2b')](function(){return db['UserVoiceQueueRt'][_0xe641('0x2c')]({'where':{'VoiceQueueId':_0x24ed38[_0xe641('0x57')]['id'],'UserId':_0x24ccf8},'transaction':_0x977f});});}})[_0xe641('0x2b')](function(){_0x24ccf8['forEach'](function(_0x246aa9){socket['emit']('userVoiceQueue:remove',{'UserId':_0x246aa9,'VoiceQueueId':_0x507ccc['id']});});});});});});})['then'](respondWithStatusCode(_0x17dea7,null))[_0xe641('0x55')](handleError(_0x17dea7,null));};exports['addAgents']=function(_0x292fd4,_0x49c86d,_0x506941){var _0x1f347c,_0xdbb4c4;return db['VoiceQueue']['find']({'where':{'id':_0x292fd4[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x49c86d,null))[_0xe641('0x2b')](function(_0x4fbaf9){if(_0x4fbaf9){_0xdbb4c4=_0x4fbaf9;return _0x4fbaf9['addAgents'](_0x292fd4[_0xe641('0x62')][_0xe641('0x81')],_['omit'](_0x292fd4[_0xe641('0x62')],[_0xe641('0x81'),'id'])||{})[_0xe641('0x97')](function(_0x2afeb5){for(var _0x21ebb4=0x0;_0x21ebb4<_0x292fd4[_0xe641('0x62')][_0xe641('0x81')][_0xe641('0x48')];_0x21ebb4+=0x1){socket[_0xe641('0x7f')](_0xe641('0x98'),{'UserId':Number(_0x292fd4[_0xe641('0x62')][_0xe641('0x81')][_0x21ebb4]),'VoiceQueueId':Number(_0x292fd4['params']['id'])});}return _0x2afeb5;});}})['then'](function(_0x110ae8){_0x1f347c=_0x110ae8||[];if(_0xdbb4c4){return db[_0xe641('0x82')][_0xe641('0x53')]({'where':{'id':_0x292fd4[_0xe641('0x62')][_0xe641('0x81')]},'attributes':['id',_0xe641('0x3a'),_0xe641('0x72'),'voicePause',_0xe641('0x74')],'raw':!![]});}})['then'](function(_0x42eb6f){if(!_[_0xe641('0x95')](_0x42eb6f)){var _0x3406df=[];for(var _0x89b238=0x0;_0x89b238<_0x42eb6f[_0xe641('0x48')];_0x89b238++){if(_0x42eb6f[_0x89b238]['online']){_0x3406df[_0xe641('0x8a')](db[_0xe641('0x7b')][_0xe641('0x79')]({'membername':_0x42eb6f[_0x89b238]['name'],'UserId':_0x42eb6f[_0x89b238]['id'],'queue_name':_0xdbb4c4[_0xe641('0x3a')],'VoiceQueueId':_0xdbb4c4['id'],'interface':_['isNil'](_0x42eb6f[_0x89b238]['interface'])?util['format'](_0xe641('0x99'),_0x42eb6f[_0x89b238][_0xe641('0x3a')]):_0x42eb6f[_0x89b238]['interface'],'paused':_0x42eb6f[_0x89b238]['voicePause']||![],'penalty':_0x292fd4[_0xe641('0x62')][_0xe641('0x76')]||0x0}));}}return BPromise[_0xe641('0x91')](_0x3406df);}})[_0xe641('0x2b')](function(){return _0x1f347c;})['then'](respondWithResult(_0x49c86d,null))[_0xe641('0x55')](handleError(_0x49c86d,null));};exports[_0xe641('0x96')]=function(_0xf26d15,_0x3afd64,_0x3ccaca){return db[_0xe641('0x3d')][_0xe641('0x35')]({'where':{'id':_0xf26d15[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x3afd64,null))[_0xe641('0x2b')](function(_0x259d22){if(_0x259d22){return _0x259d22[_0xe641('0x96')](_0xf26d15[_0xe641('0x42')][_0xe641('0x81')])['then'](function(){if(_[_0xe641('0x9a')](_0xf26d15[_0xe641('0x42')][_0xe641('0x81')])){for(var _0x34907e=0x0;_0x34907e<_0xf26d15[_0xe641('0x42')][_0xe641('0x81')][_0xe641('0x48')];_0x34907e+=0x1){socket[_0xe641('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0xf26d15['query'][_0xe641('0x81')][_0x34907e]),'VoiceQueueId':Number(_0xf26d15['params']['id'])});}}else{socket[_0xe641('0x7f')](_0xe641('0x9b'),{'UserId':Number(_0xf26d15[_0xe641('0x42')]['ids']),'VoiceQueueId':Number(_0xf26d15[_0xe641('0x57')]['id'])});}});}})[_0xe641('0x2b')](function(_0x20a6a4){return db[_0xe641('0x7b')][_0xe641('0x2c')]({'where':{'VoiceQueueId':_0xf26d15[_0xe641('0x57')]['id'],'UserId':_0xf26d15['query'][_0xe641('0x81')]}})[_0xe641('0x2b')](function(){return _0x20a6a4;});})[_0xe641('0x2b')](respondWithStatusCode(_0x3afd64,null))[_0xe641('0x55')](handleError(_0x3afd64,null));};exports[_0xe641('0x9c')]=function(_0x539380,_0x2a450a,_0x474c8f){var _0x2a11cf={};var _0x3daa80={};var _0x1ccc8c;var _0x35318a;return db[_0xe641('0x3d')][_0xe641('0x66')]({'where':{'id':_0x539380[_0xe641('0x57')]['id']}})['then'](handleEntityNotFound(_0x2a450a,null))[_0xe641('0x2b')](function(_0x5c63ca){if(_0x5c63ca){_0x1ccc8c=_0x5c63ca;_0x3daa80['model']=_['keys'](db[_0xe641('0x82')][_0xe641('0x3e')]);_0x3daa80['query']=_[_0xe641('0x43')](_0x539380[_0xe641('0x42')]);_0x3daa80['filters']=_[_0xe641('0x45')](_0x3daa80[_0xe641('0x41')],_0x3daa80[_0xe641('0x42')]);_0x2a11cf['attributes']=_['intersection'](_0x3daa80['model'],qs[_0xe641('0x47')](_0x539380['query']['fields']));_0x2a11cf['attributes']=_0x2a11cf[_0xe641('0x46')][_0xe641('0x48')]?_0x2a11cf[_0xe641('0x46')]:_0x3daa80[_0xe641('0x41')];_0x2a11cf[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x539380[_0xe641('0x42')][_0xe641('0x4b')]);_0x2a11cf[_0xe641('0x4c')]=qs['filters'](_[_0xe641('0x4d')](_0x539380[_0xe641('0x42')],_0x3daa80[_0xe641('0x44')]));if(_0x539380[_0xe641('0x42')][_0xe641('0x4e')]){_0x2a11cf[_0xe641('0x4c')]=_[_0xe641('0x4f')](_0x2a11cf[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x2a11cf['attributes'],function(_0x1dfecc){var _0x5ab187={};_0x5ab187[_0x1dfecc]={'$like':'%'+_0x539380[_0xe641('0x42')][_0xe641('0x4e')]+'%'};return _0x5ab187;})});}_0x2a11cf=_[_0xe641('0x4f')]({},_0x2a11cf,_0x539380[_0xe641('0x58')]);return _0x1ccc8c[_0xe641('0x9c')](_0x2a11cf);}})['then'](function(_0x2a7e69){if(_0x2a7e69){_0x35318a=_0x2a7e69[_0xe641('0x48')];if(!_0x539380[_0xe641('0x42')][_0xe641('0x49')](_0xe641('0x68'))){_0x2a11cf['limit']=qs[_0xe641('0x25')](_0x539380[_0xe641('0x42')]['limit']);_0x2a11cf[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x539380[_0xe641('0x42')][_0xe641('0x23')]);}return _0x1ccc8c[_0xe641('0x9c')](_0x2a11cf);}})[_0xe641('0x2b')](function(_0x11fdfe){if(_0x11fdfe){return _0x11fdfe?{'count':_0x35318a,'rows':_0x11fdfe}:null;}})[_0xe641('0x2b')](respondWithResult(_0x2a450a,null))['catch'](handleError(_0x2a450a,null));};exports['getMembers']=function(_0x16d93f,_0x282bf3,_0x31e85d){var _0x4a4a66={};var _0x447003={};var _0x254c5f;var _0x14883a;return db[_0xe641('0x3d')][_0xe641('0x66')]({'where':{'id':_0x16d93f[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x282bf3,null))[_0xe641('0x2b')](function(_0x4748e3){if(_0x4748e3){_0x254c5f=_0x4748e3;_0x447003[_0xe641('0x41')]=_['keys'](db[_0xe641('0x7b')]['rawAttributes']);_0x447003[_0xe641('0x42')]=_['keys'](_0x16d93f[_0xe641('0x42')]);_0x447003[_0xe641('0x44')]=_[_0xe641('0x45')](_0x447003['model'],_0x447003[_0xe641('0x42')]);_0x4a4a66[_0xe641('0x46')]=_[_0xe641('0x45')](_0x447003[_0xe641('0x41')],qs[_0xe641('0x47')](_0x16d93f[_0xe641('0x42')][_0xe641('0x47')]));_0x4a4a66[_0xe641('0x46')]=_0x4a4a66[_0xe641('0x46')]['length']?_0x4a4a66['attributes']:_0x447003['model'];_0x4a4a66['order']=qs[_0xe641('0x4b')](_0x16d93f[_0xe641('0x42')]['sort']);_0x4a4a66[_0xe641('0x4c')]=qs[_0xe641('0x44')](_[_0xe641('0x4d')](_0x16d93f[_0xe641('0x42')],_0x447003[_0xe641('0x44')]));if(_0x16d93f[_0xe641('0x42')]['filter']){_0x4a4a66['where']=_['merge'](_0x4a4a66[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x4a4a66['attributes'],function(_0x128490){var _0x2aa761={};_0x2aa761[_0x128490]={'$like':'%'+_0x16d93f[_0xe641('0x42')][_0xe641('0x4e')]+'%'};return _0x2aa761;})});}_0x4a4a66=_[_0xe641('0x4f')]({},_0x4a4a66,_0x16d93f[_0xe641('0x58')]);return _0x254c5f[_0xe641('0x9d')](_0x4a4a66);}})[_0xe641('0x2b')](function(_0x5501ef){if(_0x5501ef){_0x14883a=_0x5501ef['length'];if(!_0x16d93f[_0xe641('0x42')][_0xe641('0x49')](_0xe641('0x68'))){_0x4a4a66[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x16d93f['query']['limit']);_0x4a4a66[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x16d93f[_0xe641('0x42')][_0xe641('0x23')]);}return _0x254c5f[_0xe641('0x9d')](_0x4a4a66);}})[_0xe641('0x2b')](function(_0x2e601e){return _0x2e601e?{'count':_0x14883a,'rows':_0x2e601e}:null;})[_0xe641('0x2b')](respondWithResult(_0x282bf3,null))[_0xe641('0x55')](handleError(_0x282bf3,null));};exports['getLists']=function(_0x775f02,_0x19d74d,_0x48078d){var _0x30c5d4={};var _0x2ab65a={};var _0x195d3d;var _0x55039a;return db[_0xe641('0x3d')][_0xe641('0x66')]({'where':{'id':_0x775f02[_0xe641('0x57')]['id']}})['then'](handleEntityNotFound(_0x19d74d,null))['then'](function(_0x47a97a){if(_0x47a97a){_0x195d3d=_0x47a97a;_0x2ab65a[_0xe641('0x41')]=_[_0xe641('0x43')](db[_0xe641('0x9e')][_0xe641('0x3e')]);_0x2ab65a[_0xe641('0x42')]=_[_0xe641('0x43')](_0x775f02['query']);_0x2ab65a['filters']=_[_0xe641('0x45')](_0x2ab65a[_0xe641('0x41')],_0x2ab65a[_0xe641('0x42')]);_0x30c5d4[_0xe641('0x46')]=_[_0xe641('0x45')](_0x2ab65a[_0xe641('0x41')],qs['fields'](_0x775f02['query'][_0xe641('0x47')]));_0x30c5d4[_0xe641('0x46')]=_0x30c5d4[_0xe641('0x46')]['length']?_0x30c5d4[_0xe641('0x46')]:_0x2ab65a['model'];_0x30c5d4[_0xe641('0x4a')]=qs['sort'](_0x775f02[_0xe641('0x42')][_0xe641('0x4b')]);_0x30c5d4[_0xe641('0x4c')]=qs[_0xe641('0x44')](_['pick'](_0x775f02[_0xe641('0x42')],_0x2ab65a['filters']));if(_0x775f02[_0xe641('0x42')]['filter']){_0x30c5d4[_0xe641('0x4c')]=_[_0xe641('0x4f')](_0x30c5d4[_0xe641('0x4c')],{'$or':_[_0xe641('0x32')](_0x30c5d4[_0xe641('0x46')],function(_0x247251){var _0x339057={};_0x339057[_0x247251]={'$like':'%'+_0x775f02['query']['filter']+'%'};return _0x339057;})});}_0x30c5d4=_[_0xe641('0x4f')]({},_0x30c5d4,_0x775f02['options']);return _0x195d3d['getLists'](_0x30c5d4);}})[_0xe641('0x2b')](function(_0x9d731a){if(_0x9d731a){_0x55039a=_0x9d731a[_0xe641('0x48')];if(!_0x775f02[_0xe641('0x42')]['hasOwnProperty'](_0xe641('0x68'))){_0x30c5d4[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x775f02['query'][_0xe641('0x25')]);_0x30c5d4['offset']=qs[_0xe641('0x23')](_0x775f02[_0xe641('0x42')][_0xe641('0x23')]);}return _0x195d3d[_0xe641('0x9f')](_0x30c5d4);}})[_0xe641('0x2b')](function(_0x6f1782){if(_0x6f1782){return _0x6f1782?{'count':_0x55039a,'rows':_0x6f1782}:null;}})['then'](respondWithResult(_0x19d74d,null))[_0xe641('0x55')](handleError(_0x19d74d,null));};exports[_0xe641('0xa0')]=function(_0x40466c,_0x3dd5af,_0x2e4404){var _0x17f92b,_0x1942d7;return db[_0xe641('0x3d')][_0xe641('0x35')]({'where':{'id':_0x40466c[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x3dd5af,null))[_0xe641('0x2b')](function(_0x489e92){if(_0x489e92){_0x1942d7=_0x489e92;return _0x489e92[_0xe641('0xa0')](_0x40466c[_0xe641('0x62')][_0xe641('0x81')],_['omit'](_0x40466c['body'],[_0xe641('0x81'),'id'])||{});}return null;})[_0xe641('0x97')](function(_0x19d529){var _0x14fb7a;_0x17f92b=_0x19d529||[];var _0x13a7c3=[];if(_0x19d529){for(var _0x312760=0x0;_0x312760<_0x19d529[_0xe641('0x48')];_0x312760+=0x1){var _0x44ff11=_0x19d529[_0x312760][_0xe641('0x2d')]({'plain':!![]});_0x1942d7[_0xe641('0xa1')]=_0x40466c[_0xe641('0x62')][_0xe641('0xa1')]?_0x40466c['body']['dialCheckDuplicateType']:_0x1942d7[_0xe641('0xa1')];switch(_0x1942d7[_0xe641('0xa1')]){case _0xe641('0xa2'):_0x14fb7a=squel['insert']()[_0xe641('0xa3')](_0xe641('0xa4'))[_0xe641('0xa5')]([_0xe641('0xa6'),'scheduledAt',_0xe641('0xa7'),_0xe641('0xa8'),_0xe641('0x6a'),_0xe641('0x60'),'updatedAt'],squel[_0xe641('0x83')]()['field'](_0xe641('0xa6'),'phone')['field'](_0xe641('0xa9'),_0xe641('0xaa'))['field']('id',_0xe641('0xa7'))[_0xe641('0x84')](_0x44ff11[_0xe641('0xab')][_0xe641('0x8c')](),'ListId')[_0xe641('0x84')](_0x40466c[_0xe641('0x57')]['id']['toString'](),_0xe641('0x6a'))[_0xe641('0x84')](_0xe641('0xa9'),'createdAt')[_0xe641('0x84')]('NOW()','updatedAt')[_0xe641('0x86')]('cm_contacts')['where'](_0xe641('0xac'))[_0xe641('0x4c')](_0xe641('0xad'),_0x44ff11[_0xe641('0xab')]['toString']())[_0xe641('0x4c')](_0xe641('0xae'))[_0xe641('0x4c')](_0xe641('0xaf'),squel[_0xe641('0x83')]()[_0xe641('0x84')](_0xe641('0xb0'))[_0xe641('0x86')](_0xe641('0xb1'))['where'](_0xe641('0xb2'),_0x40466c[_0xe641('0x57')]['id'][_0xe641('0x8c')]()))[_0xe641('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xe641('0xb3'))[_0xe641('0x86')](_0xe641('0xa4'))['where']('VoiceQueueId\x20=\x20?',_0x40466c['params']['id']['toString']())))[_0xe641('0x8c')]();break;case'onlyIfOpen':_0x14fb7a=squel[_0xe641('0xb4')]()[_0xe641('0xa3')](_0xe641('0xa4'))[_0xe641('0xa5')]([_0xe641('0xa6'),'scheduledAt',_0xe641('0xa7'),_0xe641('0xa8'),_0xe641('0x6a'),_0xe641('0x60'),_0xe641('0x61')],squel['select']()[_0xe641('0x84')]('phone','phone')['field'](_0xe641('0xa9'),_0xe641('0xaa'))[_0xe641('0x84')]('id',_0xe641('0xa7'))['field'](_0x44ff11[_0xe641('0xab')]['toString'](),'ListId')[_0xe641('0x84')](_0x40466c[_0xe641('0x57')]['id']['toString'](),'VoiceQueueId')[_0xe641('0x84')](_0xe641('0xa9'),_0xe641('0x60'))[_0xe641('0x84')]('NOW()',_0xe641('0x61'))[_0xe641('0x86')](_0xe641('0xb5'))[_0xe641('0x4c')](_0xe641('0xac'))[_0xe641('0x4c')](_0xe641('0xad'),_0x44ff11['CmListId'][_0xe641('0x8c')]())['where'](_0xe641('0xae'))[_0xe641('0x4c')](_0xe641('0xaf'),squel[_0xe641('0x83')]()[_0xe641('0x84')](_0xe641('0xb3'))['from'](_0xe641('0xa4'))['where'](_0xe641('0xb2'),_0x40466c[_0xe641('0x57')]['id'][_0xe641('0x8c')]())))[_0xe641('0x8c')]();break;default:_0x14fb7a=squel[_0xe641('0xb4')]()['into'](_0xe641('0xa4'))[_0xe641('0xa5')](['phone','scheduledAt','ContactId',_0xe641('0xa8'),_0xe641('0x6a'),_0xe641('0x60'),_0xe641('0x61')],squel[_0xe641('0x83')]()[_0xe641('0x84')](_0xe641('0xa6'),_0xe641('0xa6'))[_0xe641('0x84')](_0xe641('0xa9'),'scheduledAt')[_0xe641('0x84')]('id',_0xe641('0xa7'))[_0xe641('0x84')](_0x44ff11['CmListId'][_0xe641('0x8c')](),_0xe641('0xa8'))[_0xe641('0x84')](_0x40466c['params']['id'][_0xe641('0x8c')](),'VoiceQueueId')[_0xe641('0x84')]('NOW()',_0xe641('0x60'))[_0xe641('0x84')](_0xe641('0xa9'),'updatedAt')['from'](_0xe641('0xb5'))[_0xe641('0x4c')](_0xe641('0xac'))['where']('ListId\x20=\x20?',_0x44ff11['CmListId'][_0xe641('0x8c')]())[_0xe641('0x4c')](_0xe641('0xae')))[_0xe641('0x8c')]();}_0x13a7c3[_0xe641('0x8a')](db[_0xe641('0x8b')][_0xe641('0x42')](_0x14fb7a));}return BPromise[_0xe641('0x91')](_0x13a7c3);}})[_0xe641('0x2b')](function(){return _0x17f92b;})[_0xe641('0x2b')](respondWithResult(_0x3dd5af,null))[_0xe641('0x55')](handleError(_0x3dd5af,null));};exports['removeLists']=function(_0x28482a,_0x3a5546,_0x2ddc15){return db[_0xe641('0x3d')][_0xe641('0x35')]({'where':{'id':_0x28482a[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x3a5546,null))[_0xe641('0x2b')](function(_0x472e94){if(_0x472e94){return _0x472e94[_0xe641('0xb6')](_0x28482a[_0xe641('0x42')]['ids']);}})[_0xe641('0x2b')](function(_0x1b3f5a){if(_0x1b3f5a){return db['CmHopper'][_0xe641('0x2c')]({'where':{'ListId':_0x28482a[_0xe641('0x42')][_0xe641('0x81')],'VoiceQueueId':_0x28482a[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](function(){return _0x1b3f5a;});}})[_0xe641('0x2b')](respondWithStatusCode(_0x3a5546,null))[_0xe641('0x55')](handleError(_0x3a5546,null));};exports[_0xe641('0xb7')]=function(_0x222b28,_0x397480,_0x33e1fe){var _0x307a33={};var _0x1ea710={};var _0x3431ea;var _0x18400f;return db[_0xe641('0x3d')][_0xe641('0x66')]({'where':{'id':_0x222b28[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x397480,null))[_0xe641('0x2b')](function(_0x1ba8b3){if(_0x1ba8b3){_0x3431ea=_0x1ba8b3;_0x1ea710[_0xe641('0x41')]=_[_0xe641('0x43')](db[_0xe641('0x9e')][_0xe641('0x3e')]);_0x1ea710[_0xe641('0x42')]=_['keys'](_0x222b28['query']);_0x1ea710[_0xe641('0x44')]=_['intersection'](_0x1ea710[_0xe641('0x41')],_0x1ea710['query']);_0x307a33[_0xe641('0x46')]=_[_0xe641('0x45')](_0x1ea710[_0xe641('0x41')],qs[_0xe641('0x47')](_0x222b28[_0xe641('0x42')]['fields']));_0x307a33['attributes']=_0x307a33[_0xe641('0x46')][_0xe641('0x48')]?_0x307a33[_0xe641('0x46')]:_0x1ea710[_0xe641('0x41')];_0x307a33[_0xe641('0x4a')]=qs[_0xe641('0x4b')](_0x222b28[_0xe641('0x42')][_0xe641('0x4b')]);_0x307a33[_0xe641('0x4c')]=qs[_0xe641('0x44')](_['pick'](_0x222b28[_0xe641('0x42')],_0x1ea710['filters']));if(_0x222b28[_0xe641('0x42')][_0xe641('0x4e')]){_0x307a33[_0xe641('0x4c')]=_[_0xe641('0x4f')](_0x307a33['where'],{'$or':_[_0xe641('0x32')](_0x307a33[_0xe641('0x46')],function(_0xf396e6){var _0x319b89={};_0x319b89[_0xf396e6]={'$like':'%'+_0x222b28[_0xe641('0x42')][_0xe641('0x4e')]+'%'};return _0x319b89;})});}_0x307a33=_[_0xe641('0x4f')]({},_0x307a33,_0x222b28[_0xe641('0x58')]);return _0x3431ea[_0xe641('0xb7')](_0x307a33);}})[_0xe641('0x2b')](function(_0x1b2f2e){if(_0x1b2f2e){_0x18400f=_0x1b2f2e[_0xe641('0x48')];if(!_0x222b28[_0xe641('0x42')][_0xe641('0x49')](_0xe641('0x68'))){_0x307a33[_0xe641('0x25')]=qs[_0xe641('0x25')](_0x222b28[_0xe641('0x42')][_0xe641('0x25')]);_0x307a33[_0xe641('0x23')]=qs[_0xe641('0x23')](_0x222b28[_0xe641('0x42')]['offset']);}return _0x3431ea['getBlackLists'](_0x307a33);}})[_0xe641('0x2b')](function(_0x1bdbff){if(_0x1bdbff){return _0x1bdbff?{'count':_0x18400f,'rows':_0x1bdbff}:null;}})[_0xe641('0x2b')](respondWithResult(_0x397480,null))[_0xe641('0x55')](handleError(_0x397480,null));};exports[_0xe641('0xb8')]=function(_0x256bec,_0x300f04,_0x52af0c){var _0x2d2d54,_0x125ca2;return db[_0xe641('0x3d')]['find']({'where':{'id':_0x256bec[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x300f04,null))[_0xe641('0x2b')](function(_0x1b7711){if(_0x1b7711){_0x125ca2=_0x1b7711;return _0x1b7711[_0xe641('0xb8')](_0x256bec[_0xe641('0x62')][_0xe641('0x81')],_[_0xe641('0x63')](_0x256bec['body'],[_0xe641('0x81'),'id'])||{});}return null;})[_0xe641('0x97')](function(_0x64732){var _0x1d3809;_0x2d2d54=_0x64732||[];var _0x48d648=[];if(_0x64732){for(var _0x2fff79=0x0;_0x2fff79<_0x64732[_0xe641('0x48')];_0x2fff79+=0x1){var _0x296dea=_0x64732[_0x2fff79]['get']({'plain':!![]});_0x1d3809=squel[_0xe641('0xb4')]()[_0xe641('0xa3')](_0xe641('0xb9'))[_0xe641('0xa5')](['phone','ContactId','ListId',_0xe641('0x6a'),_0xe641('0x60'),_0xe641('0x61')],squel[_0xe641('0x83')]()['field'](_0xe641('0xa6'),'phone')['field']('id','ContactId')[_0xe641('0x84')](_0x296dea[_0xe641('0xab')][_0xe641('0x8c')](),_0xe641('0xa8'))['field'](_0x256bec['params']['id'][_0xe641('0x8c')](),'VoiceQueueId')[_0xe641('0x84')](_0xe641('0xa9'),_0xe641('0x60'))[_0xe641('0x84')]('NOW()','updatedAt')[_0xe641('0x86')](_0xe641('0xb5'))['where'](_0xe641('0xac'))[_0xe641('0x4c')](_0xe641('0xad'),_0x296dea['CmListId'][_0xe641('0x8c')]())['where'](_0xe641('0xae')))[_0xe641('0x8c')]();_0x48d648['push'](db[_0xe641('0x8b')][_0xe641('0x42')](_0x1d3809));}return BPromise['all'](_0x48d648);}})[_0xe641('0x2b')](function(){return _0x2d2d54;})[_0xe641('0x2b')](respondWithResult(_0x300f04,null))[_0xe641('0x55')](handleError(_0x300f04,null));};exports['removeBlackLists']=function(_0x58fe8a,_0x4339ef,_0x583319){return db[_0xe641('0x3d')]['find']({'where':{'id':_0x58fe8a[_0xe641('0x57')]['id']}})[_0xe641('0x2b')](handleEntityNotFound(_0x4339ef,null))[_0xe641('0x2b')](function(_0x186258){if(_0x186258){return _0x186258['removeBlackLists'](_0x58fe8a[_0xe641('0x42')][_0xe641('0x81')]);}})[_0xe641('0x2b')](function(_0x3391ef){if(_0x3391ef){return db[_0xe641('0x6c')]['destroy']({'where':{'ListId':_0x58fe8a[_0xe641('0x42')][_0xe641('0x81')],'VoiceQueueId':_0x58fe8a['params']['id']}})[_0xe641('0x2b')](function(){return _0x3391ef;});}})[_0xe641('0x2b')](respondWithStatusCode(_0x4339ef,null))[_0xe641('0x55')](handleError(_0x4339ef,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8550aa5..0826c5d 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 _0x199f=['../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x50f9b9,_0x1aaecc){var _0x1a6954=function(_0x169e30){while(--_0x169e30){_0x50f9b9['push'](_0x50f9b9['shift']());}};_0x1a6954(++_0x1aaecc);}(_0x199f,0x103));var _0xf199=function(_0x4f5e67,_0x163a00){_0x4f5e67=_0x4f5e67-0x0;var _0xa8e9dc=_0x199f[_0x4f5e67];return _0xa8e9dc;};'use strict';var EventEmitter=require(_0xf199('0x0'));var VoiceQueue=require(_0xf199('0x1'))['db'][_0xf199('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf199('0x3')](0x0);var events={'afterCreate':_0xf199('0x4'),'afterUpdate':'update','afterDestroy':_0xf199('0x5')};function emitEvent(_0x93c991){return function(_0x8730be,_0x46ff7b,_0x5cde39){VoiceQueueEvents[_0xf199('0x6')](_0x93c991+':'+_0x8730be['id'],_0x8730be);VoiceQueueEvents[_0xf199('0x6')](_0x93c991,_0x8730be);_0x5cde39(null);};}for(var e in events){if(events[_0xf199('0x7')](e)){var event=events[e];VoiceQueue[_0xf199('0x8')](e,emitEvent(event));}}module[_0xf199('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xae3e=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae3e,0x1ba));var _0xeae3=function(_0x245c9f,_0x1d9e8c){_0x245c9f=_0x245c9f-0x0;var _0x276b79=_0xae3e[_0x245c9f];return _0x276b79;};'use strict';var EventEmitter=require(_0xeae3('0x0'));var VoiceQueue=require(_0xeae3('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xeae3('0x2')](0x0);var events={'afterCreate':_0xeae3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f962b){return function(_0x7d066c,_0xe98a00,_0x1bc86a){VoiceQueueEvents[_0xeae3('0x4')](_0x2f962b+':'+_0x7d066c['id'],_0x7d066c);VoiceQueueEvents[_0xeae3('0x4')](_0x2f962b,_0x7d066c);_0x1bc86a(null);};}for(var e in events){if(events[_0xeae3('0x5')](e)){var event=events[e];VoiceQueue[_0xeae3('0x6')](e,emitEvent(event));}}module[_0xeae3('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 466735c..3505806 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x24f7f7,_0x23ba8b){var _0x170925=function(_0x3365a3){while(--_0x3365a3){_0x24f7f7['push'](_0x24f7f7['shift']());}};_0x170925(++_0x23ba8b);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x3e2480,_0x2eed70){var _0x652c0=function(_0xaae5d2){while(--_0xaae5d2){_0x3e2480['push'](_0x3e2480['shift']());}};_0x652c0(++_0x2eed70);}(_0x70e0,0x17b));var _0x070e=function(_0x518cbb,_0x4eb818){_0x518cbb=_0x518cbb-0x0;var _0x2bd801=_0x70e0[_0x518cbb];return _0x2bd801;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1a5972d..fe0739e 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 _0x0a68=['socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','util','moment','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis'];(function(_0x5248d6,_0x44c3c9){var _0x15da77=function(_0x1fa9b2){while(--_0x1fa9b2){_0x5248d6['push'](_0x5248d6['shift']());}};_0x15da77(++_0x44c3c9);}(_0x0a68,0x13a));var _0x80a6=function(_0x379d8a,_0x1b8006){_0x379d8a=_0x379d8a-0x0;var _0xd13759=_0x0a68[_0x379d8a];return _0xd13759;};'use strict';var _=require(_0x80a6('0x0'));var util=require(_0x80a6('0x1'));var moment=require(_0x80a6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80a6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80a6('0x4'))('rpc');var config=require(_0x80a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x80a6('0x6')][_0x80a6('0x7')]({'port':0x232a});config['redis']=_[_0x80a6('0x8')](config[_0x80a6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x80a6('0xa'))(new Redis(config[_0x80a6('0x9')]));require(_0x80a6('0xb'))[_0x80a6('0xc')](socket);function respondWithRpcPromise(_0x356e84,_0x3c0703,_0x1c5354){return new BPromise(function(_0x78bde7,_0x203883){return client[_0x80a6('0xd')](_0x356e84,_0x1c5354)[_0x80a6('0xe')](function(_0x5a3ffe){logger[_0x80a6('0xf')](_0x80a6('0x10'),_0x3c0703,_0x80a6('0x11'));logger[_0x80a6('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3c0703,_0x80a6('0x11'),JSON[_0x80a6('0x13')](_0x5a3ffe));if(_0x5a3ffe['error']){if(_0x5a3ffe[_0x80a6('0x14')][_0x80a6('0x15')]===0x1f4){logger[_0x80a6('0x14')](_0x80a6('0x10'),_0x3c0703,_0x5a3ffe[_0x80a6('0x14')][_0x80a6('0x16')]);return _0x203883(_0x5a3ffe[_0x80a6('0x14')][_0x80a6('0x16')]);}logger['error'](_0x80a6('0x10'),_0x3c0703,_0x5a3ffe[_0x80a6('0x14')]['message']);return _0x78bde7(_0x5a3ffe[_0x80a6('0x14')][_0x80a6('0x16')]);}else{logger[_0x80a6('0xf')](_0x80a6('0x10'),_0x3c0703,_0x80a6('0x11'));_0x78bde7(_0x5a3ffe['result'][_0x80a6('0x16')]);}})[_0x80a6('0x17')](function(_0x42f4eb){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3c0703,_0x42f4eb);_0x203883(_0x42f4eb);});});}exports[_0x80a6('0x18')]=function(_0x52c591){var _0x3fb580=this;return new Promise(function(_0xb0343f,_0x1f79e7){return db[_0x80a6('0x19')]['findAll']({'raw':_0x52c591[_0x80a6('0x1a')]?_0x52c591[_0x80a6('0x1a')][_0x80a6('0x1b')]===undefined?!![]:![]:!![],'where':_0x52c591[_0x80a6('0x1a')]?_0x52c591[_0x80a6('0x1a')][_0x80a6('0x1c')]||null:null,'attributes':_0x52c591['options']?_0x52c591['options'][_0x80a6('0x1d')]||null:null,'limit':_0x52c591['options']?_0x52c591['options'][_0x80a6('0x1e')]||null:null,'include':_0x52c591[_0x80a6('0x1a')]?_0x52c591[_0x80a6('0x1a')][_0x80a6('0x1f')]?_[_0x80a6('0x20')](_0x52c591[_0x80a6('0x1a')][_0x80a6('0x1f')],function(_0x465ed2){return{'model':db[_0x465ed2[_0x80a6('0x21')]],'as':_0x465ed2['as'],'attributes':_0x465ed2[_0x80a6('0x1d')],'include':_0x465ed2[_0x80a6('0x1f')]?_[_0x80a6('0x20')](_0x465ed2[_0x80a6('0x1f')],function(_0x3a54f3){return{'model':db[_0x3a54f3[_0x80a6('0x21')]],'as':_0x3a54f3['as'],'attributes':_0x3a54f3[_0x80a6('0x1d')],'include':_0x3a54f3[_0x80a6('0x1f')]?_[_0x80a6('0x20')](_0x3a54f3[_0x80a6('0x1f')],function(_0x5a4539){return{'model':db[_0x5a4539['model']],'as':_0x5a4539['as'],'attributes':_0x5a4539[_0x80a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80a6('0xe')](function(_0x2a249c){logger[_0x80a6('0xf')]('GetVoiceQueue',_0x52c591);logger[_0x80a6('0x12')]('GetVoiceQueue',_0x52c591,JSON[_0x80a6('0x13')](_0x2a249c));_0xb0343f(_0x2a249c);})['catch'](function(_0x1c74ce){logger[_0x80a6('0x14')]('GetVoiceQueue',_0x1c74ce[_0x80a6('0x16')],_0x52c591);_0x1f79e7(_0x3fb580[_0x80a6('0x14')](0x1f4,_0x1c74ce[_0x80a6('0x16')]));});});};exports[_0x80a6('0x22')]=function(_0x23ffec){var _0x376832=this;return new Promise(function(_0x528ca6,_0x39f2c0){return db['VoiceQueue'][_0x80a6('0x23')]({'raw':_0x23ffec[_0x80a6('0x1a')]?_0x23ffec[_0x80a6('0x1a')][_0x80a6('0x1b')]===undefined?!![]:![]:!![],'where':_0x23ffec[_0x80a6('0x1a')]?_0x23ffec[_0x80a6('0x1a')]['where']||null:null,'attributes':_0x23ffec[_0x80a6('0x1a')]?_0x23ffec[_0x80a6('0x1a')][_0x80a6('0x1d')]||null:null,'include':_0x23ffec[_0x80a6('0x1a')]?_0x23ffec['options']['include']?_['map'](_0x23ffec[_0x80a6('0x1a')][_0x80a6('0x1f')],function(_0x2a1824){return{'model':db[_0x2a1824[_0x80a6('0x21')]],'as':_0x2a1824['as'],'attributes':_0x2a1824['attributes'],'include':_0x2a1824[_0x80a6('0x1f')]?_[_0x80a6('0x20')](_0x2a1824['include'],function(_0x1e7ae){return{'model':db[_0x1e7ae[_0x80a6('0x21')]],'as':_0x1e7ae['as'],'attributes':_0x1e7ae[_0x80a6('0x1d')],'include':_0x1e7ae[_0x80a6('0x1f')]?_[_0x80a6('0x20')](_0x1e7ae['include'],function(_0x2e918d){return{'model':db[_0x2e918d['model']],'as':_0x2e918d['as'],'attributes':_0x2e918d[_0x80a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80a6('0xe')](function(_0x3f6b51){logger[_0x80a6('0xf')](_0x80a6('0x22'),_0x23ffec);logger[_0x80a6('0x12')](_0x80a6('0x22'),_0x23ffec,JSON['stringify'](_0x3f6b51));_0x528ca6(_0x3f6b51);})['catch'](function(_0x2abc50){logger[_0x80a6('0x14')](_0x80a6('0x22'),_0x2abc50[_0x80a6('0x16')],_0x23ffec);_0x39f2c0(_0x376832[_0x80a6('0x14')](0x1f4,_0x2abc50[_0x80a6('0x16')]));});});}; \ No newline at end of file +var _0x36dd=['ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','./voiceQueue.socket','register','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue'];(function(_0x1cb577,_0x2c5c6b){var _0x51e33c=function(_0x38f7b4){while(--_0x38f7b4){_0x1cb577['push'](_0x1cb577['shift']());}};_0x51e33c(++_0x2c5c6b);}(_0x36dd,0x73));var _0xd36d=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x36dd[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xd36d('0x0'));var util=require(_0xd36d('0x1'));var moment=require(_0xd36d('0x2'));var BPromise=require(_0xd36d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd36d('0x4'));var db=require(_0xd36d('0x5'))['db'];var utils=require(_0xd36d('0x6'));var logger=require(_0xd36d('0x7'))(_0xd36d('0x8'));var config=require('../../config/environment');var jayson=require(_0xd36d('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd36d('0xa')](config[_0xd36d('0xb')],{'host':_0xd36d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd36d('0xb')]));require(_0xd36d('0xd'))[_0xd36d('0xe')](socket);function respondWithRpcPromise(_0x31a4b1,_0x4869e4,_0x3fada8){return new BPromise(function(_0x90a939,_0x170a0a){return client['request'](_0x31a4b1,_0x3fada8)[_0xd36d('0xf')](function(_0x4c4ea3){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4869e4,_0xd36d('0x10'));logger[_0xd36d('0x11')](_0xd36d('0x12'),_0x4869e4,'request\x20sent',JSON[_0xd36d('0x13')](_0x4c4ea3));if(_0x4c4ea3['error']){if(_0x4c4ea3[_0xd36d('0x14')][_0xd36d('0x15')]===0x1f4){logger[_0xd36d('0x14')](_0xd36d('0x16'),_0x4869e4,_0x4c4ea3['error'][_0xd36d('0x17')]);return _0x170a0a(_0x4c4ea3[_0xd36d('0x14')][_0xd36d('0x17')]);}logger[_0xd36d('0x14')](_0xd36d('0x16'),_0x4869e4,_0x4c4ea3[_0xd36d('0x14')][_0xd36d('0x17')]);return _0x90a939(_0x4c4ea3[_0xd36d('0x14')][_0xd36d('0x17')]);}else{logger[_0xd36d('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x4869e4,'request\x20sent');_0x90a939(_0x4c4ea3[_0xd36d('0x19')][_0xd36d('0x17')]);}})[_0xd36d('0x1a')](function(_0xf168e8){logger[_0xd36d('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x4869e4,_0xf168e8);_0x170a0a(_0xf168e8);});});}exports['GetVoiceQueue']=function(_0xc35292){var _0x1af1ed=this;return new Promise(function(_0x2d1b1d,_0x94efd){return db[_0xd36d('0x1b')][_0xd36d('0x1c')]({'raw':_0xc35292[_0xd36d('0x1d')]?_0xc35292[_0xd36d('0x1d')][_0xd36d('0x1e')]===undefined?!![]:![]:!![],'where':_0xc35292[_0xd36d('0x1d')]?_0xc35292[_0xd36d('0x1d')][_0xd36d('0x1f')]||null:null,'attributes':_0xc35292['options']?_0xc35292[_0xd36d('0x1d')][_0xd36d('0x20')]||null:null,'limit':_0xc35292[_0xd36d('0x1d')]?_0xc35292[_0xd36d('0x1d')]['limit']||null:null,'include':_0xc35292[_0xd36d('0x1d')]?_0xc35292[_0xd36d('0x1d')][_0xd36d('0x21')]?_[_0xd36d('0x22')](_0xc35292['options']['include'],function(_0x339cae){return{'model':db[_0x339cae['model']],'as':_0x339cae['as'],'attributes':_0x339cae['attributes'],'include':_0x339cae['include']?_[_0xd36d('0x22')](_0x339cae[_0xd36d('0x21')],function(_0x13c742){return{'model':db[_0x13c742[_0xd36d('0x23')]],'as':_0x13c742['as'],'attributes':_0x13c742['attributes'],'include':_0x13c742[_0xd36d('0x21')]?_[_0xd36d('0x22')](_0x13c742['include'],function(_0x2a308b){return{'model':db[_0x2a308b[_0xd36d('0x23')]],'as':_0x2a308b['as'],'attributes':_0x2a308b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aca4f){logger[_0xd36d('0x18')](_0xd36d('0x24'),_0xc35292);logger['debug'](_0xd36d('0x24'),_0xc35292,JSON[_0xd36d('0x13')](_0x4aca4f));_0x2d1b1d(_0x4aca4f);})[_0xd36d('0x1a')](function(_0x4fc380){logger['error']('GetVoiceQueue',_0x4fc380[_0xd36d('0x17')],_0xc35292);_0x94efd(_0x1af1ed[_0xd36d('0x14')](0x1f4,_0x4fc380[_0xd36d('0x17')]));});});};exports[_0xd36d('0x25')]=function(_0x53d737){var _0xc8d58=this;return new Promise(function(_0x3014c2,_0x3dff06){return db['VoiceQueue']['find']({'raw':_0x53d737[_0xd36d('0x1d')]?_0x53d737['options'][_0xd36d('0x1e')]===undefined?!![]:![]:!![],'where':_0x53d737[_0xd36d('0x1d')]?_0x53d737['options'][_0xd36d('0x1f')]||null:null,'attributes':_0x53d737[_0xd36d('0x1d')]?_0x53d737[_0xd36d('0x1d')][_0xd36d('0x20')]||null:null,'include':_0x53d737[_0xd36d('0x1d')]?_0x53d737[_0xd36d('0x1d')]['include']?_[_0xd36d('0x22')](_0x53d737[_0xd36d('0x1d')][_0xd36d('0x21')],function(_0x5e95f3){return{'model':db[_0x5e95f3[_0xd36d('0x23')]],'as':_0x5e95f3['as'],'attributes':_0x5e95f3[_0xd36d('0x20')],'include':_0x5e95f3['include']?_[_0xd36d('0x22')](_0x5e95f3[_0xd36d('0x21')],function(_0x386f28){return{'model':db[_0x386f28[_0xd36d('0x23')]],'as':_0x386f28['as'],'attributes':_0x386f28[_0xd36d('0x20')],'include':_0x386f28[_0xd36d('0x21')]?_[_0xd36d('0x22')](_0x386f28[_0xd36d('0x21')],function(_0x48e63e){return{'model':db[_0x48e63e['model']],'as':_0x48e63e['as'],'attributes':_0x48e63e[_0xd36d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd36d('0xf')](function(_0x208c7b){logger[_0xd36d('0x18')](_0xd36d('0x25'),_0x53d737);logger['debug']('ShowVoiceQueue',_0x53d737,JSON['stringify'](_0x208c7b));_0x3014c2(_0x208c7b);})[_0xd36d('0x1a')](function(_0x5c3112){logger['error'](_0xd36d('0x25'),_0x5c3112[_0xd36d('0x17')],_0x53d737);_0x3dff06(_0xc8d58[_0xd36d('0x14')](0x1f4,_0x5c3112[_0xd36d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ee0d750..f052a0c 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 _0x79d4=['remove','update','register','length'];(function(_0x3b2395,_0x1cf2c1){var _0x2e6751=function(_0x4ea274){while(--_0x4ea274){_0x3b2395['push'](_0x3b2395['shift']());}};_0x2e6751(++_0x1cf2c1);}(_0x79d4,0xd8));var _0x479d=function(_0x36d8c7,_0x3eaa5f){_0x36d8c7=_0x36d8c7-0x0;var _0x5ce057=_0x79d4[_0x36d8c7];return _0x5ce057;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x479d('0x0'),_0x479d('0x1')];function createListener(_0x227732,_0x264d63){return function(_0x51c85f){_0x264d63['emit'](_0x227732,_0x51c85f);};}function removeListener(_0x1cbc63,_0x1ced2d){return function(){VoiceQueueEvents['removeListener'](_0x1cbc63,_0x1ced2d);};}exports[_0x479d('0x2')]=function(_0x1d1c10){for(var _0x450a7=0x0,_0xdc5acc=events[_0x479d('0x3')];_0x450a7<_0xdc5acc;_0x450a7++){var _0x124f3e=events[_0x450a7];var _0x45859d=createListener('voiceQueue:'+_0x124f3e,_0x1d1c10);VoiceQueueEvents['on'](_0x124f3e,_0x45859d);}}; \ No newline at end of file +var _0xe5f0=['length','voiceQueue:','save','remove','emit','removeListener','register'];(function(_0xa19f3e,_0x1faacf){var _0x3b61c8=function(_0x118424){while(--_0x118424){_0xa19f3e['push'](_0xa19f3e['shift']());}};_0x3b61c8(++_0x1faacf);}(_0xe5f0,0x17c));var _0x0e5f=function(_0x179cce,_0x239422){_0x179cce=_0x179cce-0x0;var _0x54ac6d=_0xe5f0[_0x179cce];return _0x54ac6d;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0e5f('0x0'),_0x0e5f('0x1'),'update'];function createListener(_0x17c579,_0x100fa7){return function(_0x5667fa){_0x100fa7[_0x0e5f('0x2')](_0x17c579,_0x5667fa);};}function removeListener(_0x37f78c,_0x1545fb){return function(){VoiceQueueEvents[_0x0e5f('0x3')](_0x37f78c,_0x1545fb);};}exports[_0x0e5f('0x4')]=function(_0x331262){for(var _0x1f3e54=0x0,_0x315139=events[_0x0e5f('0x5')];_0x1f3e54<_0x315139;_0x1f3e54++){var _0x46ce4a=events[_0x1f3e54];var _0x154a18=createListener(_0x0e5f('0x6')+_0x46ce4a,_0x331262);VoiceQueueEvents['on'](_0x46ce4a,_0x154a18);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0a965de..c4ea069 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 _0x82a1=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47c5d8,_0x39bd42){var _0x55acdb=function(_0x18b27f){while(--_0x18b27f){_0x47c5d8['push'](_0x47c5d8['shift']());}};_0x55acdb(++_0x39bd42);}(_0x82a1,0x149));var _0x182a=function(_0x9651e6,_0x9a3f6){_0x9651e6=_0x9651e6-0x0;var _0x50d75f=_0x82a1[_0x9651e6];return _0x50d75f;};'use strict';var multer=require(_0x182a('0x0'));var util=require('util');var path=require(_0x182a('0x1'));var timeout=require(_0x182a('0x2'));var express=require(_0x182a('0x3'));var router=express[_0x182a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x182a('0x5'));var interaction=require(_0x182a('0x6'));var config=require(_0x182a('0x7'));var controller=require(_0x182a('0x8'));router[_0x182a('0x9')]('/',auth[_0x182a('0xa')](),controller[_0x182a('0xb')]);router[_0x182a('0x9')]('/describe',auth[_0x182a('0xa')](),controller[_0x182a('0xc')]);router[_0x182a('0x9')](_0x182a('0xd'),auth['isAuthenticated'](),controller[_0x182a('0xe')]);router[_0x182a('0x9')](_0x182a('0xf'),auth[_0x182a('0xa')](),controller['show']);router['post']('/',auth[_0x182a('0xa')](),controller['create']);router[_0x182a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x182a('0x11')]);router[_0x182a('0x12')](_0x182a('0xf'),auth[_0x182a('0xa')](),controller[_0x182a('0x13')]);module[_0x182a('0x14')]=router; \ No newline at end of file +var _0xb14d=['/describe','describe','/index','show','update','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x24f9d2,_0x506f6f){var _0x57e3e1=function(_0x1f988f){while(--_0x1f988f){_0x24f9d2['push'](_0x24f9d2['shift']());}};_0x57e3e1(++_0x506f6f);}(_0xb14d,0x7f));var _0xdb14=function(_0x1f946b,_0x20166c){_0x1f946b=_0x1f946b-0x0;var _0x5e402e=_0xb14d[_0x1f946b];return _0x5e402e;};'use strict';var multer=require(_0xdb14('0x0'));var util=require(_0xdb14('0x1'));var path=require(_0xdb14('0x2'));var timeout=require(_0xdb14('0x3'));var express=require(_0xdb14('0x4'));var router=express[_0xdb14('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb14('0x6'));var interaction=require(_0xdb14('0x7'));var config=require(_0xdb14('0x8'));var controller=require(_0xdb14('0x9'));router[_0xdb14('0xa')]('/',auth[_0xdb14('0xb')](),controller[_0xdb14('0xc')]);router[_0xdb14('0xa')](_0xdb14('0xd'),auth[_0xdb14('0xb')](),controller[_0xdb14('0xe')]);router[_0xdb14('0xa')](_0xdb14('0xf'),auth[_0xdb14('0xb')](),controller['getVoiceQueuesReport']);router[_0xdb14('0xa')]('/:id',auth[_0xdb14('0xb')](),controller[_0xdb14('0x10')]);router['post']('/',auth[_0xdb14('0xb')](),controller['create']);router['put']('/:id',auth[_0xdb14('0xb')](),controller[_0xdb14('0x11')]);router['delete'](_0xdb14('0x12'),auth[_0xdb14('0xb')](),controller['destroy']);module[_0xdb14('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 ca17436..7ce152e 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 _0xaaa1=['getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x197378,_0xe4122c){var _0x40141c=function(_0x488954){while(--_0x488954){_0x197378['push'](_0x197378['shift']());}};_0x40141c(++_0xe4122c);}(_0xaaa1,0x1d8));var _0x1aaa=function(_0x636af2,_0xd19a38){_0x636af2=_0x636af2-0x0;var _0xc11b49=_0xaaa1[_0x636af2];return _0xc11b49;};'use strict';var Sequelize=require(_0x1aaa('0x0'));var moment=require('moment');module[_0x1aaa('0x1')]={'type':{'type':Sequelize[_0x1aaa('0x2')]},'uniqueid':{'type':Sequelize[_0x1aaa('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1aaa('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1aaa('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x5df5ab){var _0x580ff8=moment(_0x5df5ab);var _0x2d56d7=moment(this[_0x1aaa('0x4')](_0x1aaa('0x5')))[_0x1aaa('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x512c62=_0x580ff8[_0x1aaa('0x7')](_0x2d56d7,_0x1aaa('0x8'));this['setDataValue']('queuecallerleaveAt',_0x5df5ab);this[_0x1aaa('0x9')](_0x1aaa('0xa'),_0x512c62||null);}},'position':{'type':Sequelize[_0x1aaa('0xb')]},'count':{'type':Sequelize[_0x1aaa('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1aaa('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1aaa('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1aaa('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1aaa('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x1aaa('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1aaa('0x2')]},'connectedlinename':{'type':Sequelize[_0x1aaa('0x2')]},'accountcode':{'type':Sequelize[_0x1aaa('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1aaa('0x2')]},'priority':{'type':Sequelize[_0x1aaa('0x2')]},'holdtime':{'type':Sequelize[_0x1aaa('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1aaa('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1aaa('0x2')]},'transfer':{'type':Sequelize[_0x1aaa('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1aaa('0xd')},'transferexten':{'type':Sequelize[_0x1aaa('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1aaa('0x2')]},'secondDisposition':{'type':Sequelize[_0x1aaa('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x1aaa('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb66b=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x180b76,_0x561a3e){var _0x1111ae=function(_0x5c6263){while(--_0x5c6263){_0x180b76['push'](_0x180b76['shift']());}};_0x1111ae(++_0x561a3e);}(_0xb66b,0x16e));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbb66('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xbb66('0x1')]},'uniqueid':{'type':Sequelize[_0xbb66('0x1')]},'calleridnum':{'type':Sequelize[_0xbb66('0x1')]},'calleridname':{'type':Sequelize[_0xbb66('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xbb66('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xbb66('0x2')],'set':function(_0x128f94){var _0x519ac8=moment(_0x128f94);var _0x5db15e=moment(this['getDataValue']('queuecallerjoinAt'))[_0xbb66('0x3')](_0xbb66('0x4'));var _0x135d6e=_0x519ac8['diff'](_0x5db15e,'seconds');this[_0xbb66('0x5')](_0xbb66('0x6'),_0x128f94);this['setDataValue'](_0xbb66('0x7'),_0x135d6e||null);}},'position':{'type':Sequelize[_0xbb66('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xbb66('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xbb66('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xbb66('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbb66('0x2')]},'queuecallerexit':{'type':Sequelize[_0xbb66('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xbb66('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xbb66('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbb66('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbb66('0x1')]},'context':{'type':Sequelize[_0xbb66('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbb66('0x1')]},'holdtime':{'type':Sequelize[_0xbb66('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbb66('0x1')]},'transfer':{'type':Sequelize[_0xbb66('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbb66('0x1')],'comment':_0xbb66('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xbb66('0x1')]},'secondDisposition':{'type':Sequelize[_0xbb66('0x1')]},'thirdDisposition':{'type':Sequelize[_0xbb66('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0270d21..4d7e105 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 _0x73d6=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','end','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','then','include','findAll','catch','show','params','fields','includeAll','options','find','create','body','destroy','describe','getVoiceQueuesReport','pick','rows','eml-format','rimraf','moment','mustache'];(function(_0x37e4e6,_0x1d5e3f){var _0x18ce23=function(_0x4976dc){while(--_0x4976dc){_0x37e4e6['push'](_0x37e4e6['shift']());}};_0x18ce23(++_0x1d5e3f);}(_0x73d6,0x158));var _0x673d=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x73d6[_0x332109];return _0x7a6ab2;};'use strict';var emlformat=require(_0x673d('0x0'));var rimraf=require(_0x673d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x673d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x673d('0x3'));var util=require(_0x673d('0x4'));var path=require(_0x673d('0x5'));var sox=require(_0x673d('0x6'));var csv=require(_0x673d('0x7'));var ejs=require(_0x673d('0x8'));var fs=require('fs');var fs_extra=require(_0x673d('0x9'));var _=require(_0x673d('0xa'));var squel=require(_0x673d('0xb'));var crypto=require(_0x673d('0xc'));var jsforce=require(_0x673d('0xd'));var deskjs=require(_0x673d('0xe'));var toCsv=require(_0x673d('0x7'));var querystring=require(_0x673d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x673d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x673d('0x11'));var hardwareService=require(_0x673d('0x12'));var logger=require(_0x673d('0x13'))(_0x673d('0x14'));var utils=require(_0x673d('0x15'));var config=require(_0x673d('0x16'));var licenseUtil=require(_0x673d('0x17'));var db=require(_0x673d('0x18'))['db'];config['redis']=_[_0x673d('0x19')](config[_0x673d('0x1a')],{'host':_0x673d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x673d('0x1a')]));require(_0x673d('0x1c'))[_0x673d('0x1d')](socket);function respondWithStatusCode(_0x4b2815,_0x51a7da){_0x51a7da=_0x51a7da||0xcc;return function(_0x3e06e6){if(_0x3e06e6){return _0x4b2815[_0x673d('0x1e')](_0x51a7da);}return _0x4b2815['status'](_0x51a7da)['end']();};}function respondWithResult(_0x37a463,_0x262a99){_0x262a99=_0x262a99||0xc8;return function(_0x5a950b){if(_0x5a950b){return _0x37a463['status'](_0x262a99)['json'](_0x5a950b);}};}function respondWithFilteredResult(_0x1502b0,_0x3ad0a4){return function(_0x350a71){if(_0x350a71){var _0x51ee81=typeof _0x3ad0a4[_0x673d('0x1f')]===_0x673d('0x20')&&typeof _0x3ad0a4[_0x673d('0x21')]===_0x673d('0x20');var _0x23b83d=_0x350a71[_0x673d('0x22')];var _0x1c4246=_0x51ee81?0x0:_0x3ad0a4[_0x673d('0x1f')];var _0x57b38c=_0x51ee81?_0x350a71['count']:_0x3ad0a4[_0x673d('0x1f')]+_0x3ad0a4[_0x673d('0x21')];var _0x2986f9;if(_0x57b38c>=_0x23b83d){_0x57b38c=_0x23b83d;_0x2986f9=0xc8;}else{_0x2986f9=0xce;}_0x1502b0[_0x673d('0x23')](_0x2986f9);return _0x1502b0[_0x673d('0x24')](_0x673d('0x25'),_0x1c4246+'-'+_0x57b38c+'/'+_0x23b83d)[_0x673d('0x26')](_0x350a71);}return null;};}function patchUpdates(_0xe76152){return function(_0x1a74bf){try{jsonpatch[_0x673d('0x27')](_0x1a74bf,_0xe76152,!![]);}catch(_0xd2cb2e){return BPromise[_0x673d('0x28')](_0xd2cb2e);}return _0x1a74bf[_0x673d('0x29')]();};}function saveUpdates(_0x4fe980,_0x2f7de2){return function(_0x224f0c){if(_0x224f0c){return _0x224f0c[_0x673d('0x2a')](_0x4fe980)['then'](function(_0x4ea132){return _0x4ea132;});}return null;};}function removeEntity(_0x57cdd9,_0x3a9ea5){return function(_0x380bdf){if(_0x380bdf){return _0x380bdf['destroy']()['then'](function(){_0x57cdd9[_0x673d('0x23')](0xcc)[_0x673d('0x2b')]();});}};}function handleEntityNotFound(_0x5217c6,_0x22252d){return function(_0x3cb2e1){if(!_0x3cb2e1){_0x5217c6[_0x673d('0x1e')](0x194);}return _0x3cb2e1;};}function handleError(_0x7dc33a,_0x4184e9){_0x4184e9=_0x4184e9||0x1f4;return function(_0x38bb2c){logger[_0x673d('0x2c')](_0x38bb2c[_0x673d('0x2d')]);if(_0x38bb2c['name']){delete _0x38bb2c[_0x673d('0x2e')];}_0x7dc33a[_0x673d('0x23')](_0x4184e9)[_0x673d('0x2f')](_0x38bb2c);};}exports[_0x673d('0x30')]=function(_0x2f95e6,_0x3fa742){var _0x1fdb09={},_0x93c34b={},_0x4a1eed={'count':0x0,'rows':[]};var _0x466238=_['map'](db[_0x673d('0x31')][_0x673d('0x32')],function(_0x344eb0){return{'name':_0x344eb0[_0x673d('0x33')],'type':_0x344eb0[_0x673d('0x34')][_0x673d('0x35')]};});_0x93c34b[_0x673d('0x36')]=_[_0x673d('0x37')](_0x466238,_0x673d('0x2e'));_0x93c34b['query']=_[_0x673d('0x38')](_0x2f95e6[_0x673d('0x39')]);_0x93c34b['filters']=_[_0x673d('0x3a')](_0x93c34b[_0x673d('0x36')],_0x93c34b[_0x673d('0x39')]);_0x1fdb09[_0x673d('0x3b')]=_[_0x673d('0x3a')](_0x93c34b[_0x673d('0x36')],qs['fields'](_0x2f95e6['query']['fields']));_0x1fdb09[_0x673d('0x3b')]=_0x1fdb09[_0x673d('0x3b')][_0x673d('0x3c')]?_0x1fdb09[_0x673d('0x3b')]:_0x93c34b['model'];if(!_0x2f95e6['query'][_0x673d('0x3d')](_0x673d('0x3e'))){_0x1fdb09[_0x673d('0x21')]=qs[_0x673d('0x21')](_0x2f95e6['query']['limit']);_0x1fdb09['offset']=qs[_0x673d('0x1f')](_0x2f95e6[_0x673d('0x39')][_0x673d('0x1f')]);}_0x1fdb09[_0x673d('0x3f')]=qs[_0x673d('0x40')](_0x2f95e6[_0x673d('0x39')][_0x673d('0x40')]);_0x1fdb09['where']=qs[_0x673d('0x41')](_['pick'](_0x2f95e6[_0x673d('0x39')],_0x93c34b['filters']),_0x466238);if(_0x2f95e6[_0x673d('0x39')]['filter']){_0x1fdb09[_0x673d('0x42')]=_[_0x673d('0x43')](_0x1fdb09['where'],{'$or':_[_0x673d('0x37')](_0x466238,function(_0x40079c){if(_0x40079c['type']!==_0x673d('0x44')){var _0x2fe4e8={};_0x2fe4e8[_0x40079c[_0x673d('0x2e')]]={'$like':'%'+_0x2f95e6['query'][_0x673d('0x45')]+'%'};return _0x2fe4e8;}})});}_0x1fdb09=_[_0x673d('0x43')]({},_0x1fdb09,_0x2f95e6['options']);var _0x27c3ab={'where':_0x1fdb09['where']};return db[_0x673d('0x31')][_0x673d('0x22')](_0x27c3ab)[_0x673d('0x46')](function(_0x2dd320){_0x4a1eed[_0x673d('0x22')]=_0x2dd320;if(_0x2f95e6['query']['includeAll']){_0x1fdb09[_0x673d('0x47')]=[{'all':!![]}];}return db[_0x673d('0x31')][_0x673d('0x48')](_0x1fdb09);})[_0x673d('0x46')](function(_0x1d1608){_0x4a1eed['rows']=_0x1d1608;return _0x4a1eed;})[_0x673d('0x46')](respondWithFilteredResult(_0x3fa742,_0x1fdb09))[_0x673d('0x49')](handleError(_0x3fa742,null));};exports[_0x673d('0x4a')]=function(_0x2d2e9b,_0x4d9ebc){var _0x24b986={'raw':![],'where':{'id':_0x2d2e9b[_0x673d('0x4b')]['id']}},_0x3494bf={};_0x3494bf[_0x673d('0x36')]=_[_0x673d('0x38')](db[_0x673d('0x31')]['rawAttributes']);_0x3494bf[_0x673d('0x39')]=_[_0x673d('0x38')](_0x2d2e9b[_0x673d('0x39')]);_0x3494bf[_0x673d('0x41')]=_['intersection'](_0x3494bf['model'],_0x3494bf[_0x673d('0x39')]);_0x24b986[_0x673d('0x3b')]=_[_0x673d('0x3a')](_0x3494bf[_0x673d('0x36')],qs[_0x673d('0x4c')](_0x2d2e9b[_0x673d('0x39')][_0x673d('0x4c')]));_0x24b986[_0x673d('0x3b')]=_0x24b986[_0x673d('0x3b')]['length']?_0x24b986[_0x673d('0x3b')]:_0x3494bf[_0x673d('0x36')];if(_0x2d2e9b[_0x673d('0x39')][_0x673d('0x4d')]){_0x24b986[_0x673d('0x47')]=[{'all':!![]}];}_0x24b986=_[_0x673d('0x43')]({},_0x24b986,_0x2d2e9b[_0x673d('0x4e')]);return db['VoiceQueueReport'][_0x673d('0x4f')](_0x24b986)[_0x673d('0x46')](handleEntityNotFound(_0x4d9ebc,null))[_0x673d('0x46')](respondWithResult(_0x4d9ebc,null))['catch'](handleError(_0x4d9ebc,null));};exports['create']=function(_0x8fd0cf,_0x127936){return db[_0x673d('0x31')][_0x673d('0x50')](_0x8fd0cf[_0x673d('0x51')],{})[_0x673d('0x46')](respondWithResult(_0x127936,0xc9))[_0x673d('0x49')](handleError(_0x127936,null));};exports[_0x673d('0x2a')]=function(_0x4385bc,_0x440e39){if(_0x4385bc[_0x673d('0x51')]['id']){delete _0x4385bc[_0x673d('0x51')]['id'];}return db[_0x673d('0x31')][_0x673d('0x4f')]({'where':{'id':_0x4385bc[_0x673d('0x4b')]['id']}})[_0x673d('0x46')](handleEntityNotFound(_0x440e39,null))[_0x673d('0x46')](saveUpdates(_0x4385bc[_0x673d('0x51')],null))[_0x673d('0x46')](respondWithResult(_0x440e39,null))[_0x673d('0x49')](handleError(_0x440e39,null));};exports[_0x673d('0x52')]=function(_0x447959,_0x36bc59){return db[_0x673d('0x31')][_0x673d('0x4f')]({'where':{'id':_0x447959[_0x673d('0x4b')]['id']}})[_0x673d('0x46')](handleEntityNotFound(_0x36bc59,null))[_0x673d('0x46')](removeEntity(_0x36bc59,null))['catch'](handleError(_0x36bc59,null));};exports[_0x673d('0x53')]=function(_0x4e2ed8,_0x321c61){return db[_0x673d('0x31')]['describe']()[_0x673d('0x46')](respondWithResult(_0x321c61,null))[_0x673d('0x49')](handleError(_0x321c61,null));};exports[_0x673d('0x54')]=function(_0x30285a,_0x5e14f0){var _0x1e7dc3={},_0x124e2c={},_0x511b84={'count':0x0,'rows':[]};_0x124e2c[_0x673d('0x36')]=_[_0x673d('0x38')](db[_0x673d('0x31')][_0x673d('0x32')]);_0x124e2c[_0x673d('0x39')]=_['keys'](_0x30285a[_0x673d('0x39')]);_0x124e2c['filters']=_[_0x673d('0x3a')](_0x124e2c[_0x673d('0x36')],_0x124e2c[_0x673d('0x39')]);_0x1e7dc3[_0x673d('0x3b')]=_[_0x673d('0x3a')](_0x124e2c['model'],qs[_0x673d('0x4c')](_0x30285a[_0x673d('0x39')][_0x673d('0x4c')]));_0x1e7dc3[_0x673d('0x3b')]=_0x1e7dc3['attributes']['length']?_0x1e7dc3[_0x673d('0x3b')]:_0x124e2c['model'];if(!_0x30285a[_0x673d('0x39')][_0x673d('0x3d')](_0x673d('0x3e'))){_0x1e7dc3[_0x673d('0x21')]=qs[_0x673d('0x21')](_0x30285a[_0x673d('0x39')]['limit']);_0x1e7dc3[_0x673d('0x1f')]=qs[_0x673d('0x1f')](_0x30285a[_0x673d('0x39')][_0x673d('0x1f')]);}_0x1e7dc3[_0x673d('0x3f')]=qs[_0x673d('0x40')](_0x30285a['query']['sort']);_0x1e7dc3[_0x673d('0x42')]=qs[_0x673d('0x41')](_[_0x673d('0x55')](_0x30285a[_0x673d('0x39')],_0x124e2c[_0x673d('0x41')]));if(_0x30285a[_0x673d('0x39')][_0x673d('0x45')]){_0x1e7dc3['where']=_[_0x673d('0x43')](_0x1e7dc3['where'],{'$or':_['map'](_0x1e7dc3[_0x673d('0x3b')],function(_0x1d0a82){var _0x127732={};_0x127732[_0x1d0a82]={'$like':'%'+_0x30285a[_0x673d('0x39')]['filter']+'%'};return _0x127732;})});}_0x1e7dc3=_[_0x673d('0x43')]({},_0x1e7dc3,_0x30285a['options']);var _0x221bc5={'where':_0x1e7dc3[_0x673d('0x42')]};return db[_0x673d('0x31')][_0x673d('0x22')](_0x221bc5)[_0x673d('0x46')](function(_0x3d3343){_0x511b84[_0x673d('0x22')]=_0x3d3343;if(_0x30285a['query'][_0x673d('0x4d')]){_0x1e7dc3[_0x673d('0x47')]=[{'all':!![]}];}return db[_0x673d('0x31')][_0x673d('0x48')](_0x1e7dc3);})[_0x673d('0x46')](function(_0x27f3da){_0x511b84[_0x673d('0x56')]=_0x27f3da;return _0x511b84;})[_0x673d('0x46')](respondWithFilteredResult(_0x5e14f0,_0x1e7dc3,_0x673d('0x54')))['catch'](handleError(_0x5e14f0,null,_0x673d('0x54')));}; \ No newline at end of file +var _0x3088=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','getVoiceQueuesReport','keys','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query'];(function(_0x46de97,_0x44d9f8){var _0x114897=function(_0x25b9fa){while(--_0x25b9fa){_0x46de97['push'](_0x46de97['shift']());}};_0x114897(++_0x44d9f8);}(_0x3088,0x10d));var _0x8308=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x3088[_0x5f1617];return _0x3af5da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8308('0x0'));var zipdir=require(_0x8308('0x1'));var jsonpatch=require(_0x8308('0x2'));var rp=require(_0x8308('0x3'));var moment=require(_0x8308('0x4'));var BPromise=require(_0x8308('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8308('0x6'));var csv=require('to-csv');var ejs=require(_0x8308('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8308('0x8'));var squel=require(_0x8308('0x9'));var crypto=require('crypto');var jsforce=require(_0x8308('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8308('0xb'));var querystring=require(_0x8308('0xc'));var Papa=require(_0x8308('0xd'));var Redis=require(_0x8308('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8308('0xf'));var hardwareService=require(_0x8308('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x8308('0x11'));var config=require(_0x8308('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8308('0x13'))['db'];config[_0x8308('0x14')]=_['defaults'](config[_0x8308('0x14')],{'host':_0x8308('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8308('0x16'))[_0x8308('0x17')](socket);function respondWithStatusCode(_0x1b37d7,_0x419630){_0x419630=_0x419630||0xcc;return function(_0x2c12de){if(_0x2c12de){return _0x1b37d7[_0x8308('0x18')](_0x419630);}return _0x1b37d7[_0x8308('0x19')](_0x419630)[_0x8308('0x1a')]();};}function respondWithResult(_0x1204ce,_0x18a83d){_0x18a83d=_0x18a83d||0xc8;return function(_0x3a535a){if(_0x3a535a){return _0x1204ce['status'](_0x18a83d)['json'](_0x3a535a);}};}function respondWithFilteredResult(_0x1ddb57,_0x4ea131){return function(_0x33f2b7){if(_0x33f2b7){var _0x14e679=typeof _0x4ea131[_0x8308('0x1b')]===_0x8308('0x1c')&&typeof _0x4ea131[_0x8308('0x1d')]==='undefined';var _0x3efbde=_0x33f2b7[_0x8308('0x1e')];var _0x498535=_0x14e679?0x0:_0x4ea131[_0x8308('0x1b')];var _0xc75611=_0x14e679?_0x33f2b7[_0x8308('0x1e')]:_0x4ea131['offset']+_0x4ea131[_0x8308('0x1d')];var _0x475cbc;if(_0xc75611>=_0x3efbde){_0xc75611=_0x3efbde;_0x475cbc=0xc8;}else{_0x475cbc=0xce;}_0x1ddb57[_0x8308('0x19')](_0x475cbc);return _0x1ddb57[_0x8308('0x1f')](_0x8308('0x20'),_0x498535+'-'+_0xc75611+'/'+_0x3efbde)[_0x8308('0x21')](_0x33f2b7);}return null;};}function patchUpdates(_0x1dc412){return function(_0x578760){try{jsonpatch[_0x8308('0x22')](_0x578760,_0x1dc412,!![]);}catch(_0x599e3a){return BPromise[_0x8308('0x23')](_0x599e3a);}return _0x578760[_0x8308('0x24')]();};}function saveUpdates(_0x463cc9,_0x11a322){return function(_0x2b797a){if(_0x2b797a){return _0x2b797a['update'](_0x463cc9)['then'](function(_0x219e0b){return _0x219e0b;});}return null;};}function removeEntity(_0x2f4ab3,_0x124603){return function(_0x2d669b){if(_0x2d669b){return _0x2d669b[_0x8308('0x25')]()[_0x8308('0x26')](function(){_0x2f4ab3[_0x8308('0x19')](0xcc)[_0x8308('0x1a')]();});}};}function handleEntityNotFound(_0x2dbd06,_0x1ffed1){return function(_0x2f0b37){if(!_0x2f0b37){_0x2dbd06[_0x8308('0x18')](0x194);}return _0x2f0b37;};}function handleError(_0x3048d6,_0x4c1097){_0x4c1097=_0x4c1097||0x1f4;return function(_0x3ee697){logger[_0x8308('0x27')](_0x3ee697[_0x8308('0x28')]);if(_0x3ee697[_0x8308('0x29')]){delete _0x3ee697[_0x8308('0x29')];}_0x3048d6[_0x8308('0x19')](_0x4c1097)[_0x8308('0x2a')](_0x3ee697);};}exports[_0x8308('0x2b')]=function(_0x5dbf52,_0x219447){var _0x5aee61={},_0x533f5e={},_0x1691ce={'count':0x0,'rows':[]};var _0x277c98=_[_0x8308('0x2c')](db[_0x8308('0x2d')][_0x8308('0x2e')],function(_0x313fd1){return{'name':_0x313fd1[_0x8308('0x2f')],'type':_0x313fd1[_0x8308('0x30')]['key']};});_0x533f5e[_0x8308('0x31')]=_[_0x8308('0x2c')](_0x277c98,_0x8308('0x29'));_0x533f5e['query']=_['keys'](_0x5dbf52[_0x8308('0x32')]);_0x533f5e[_0x8308('0x33')]=_[_0x8308('0x34')](_0x533f5e[_0x8308('0x31')],_0x533f5e[_0x8308('0x32')]);_0x5aee61[_0x8308('0x35')]=_[_0x8308('0x34')](_0x533f5e[_0x8308('0x31')],qs[_0x8308('0x36')](_0x5dbf52[_0x8308('0x32')][_0x8308('0x36')]));_0x5aee61[_0x8308('0x35')]=_0x5aee61[_0x8308('0x35')][_0x8308('0x37')]?_0x5aee61[_0x8308('0x35')]:_0x533f5e[_0x8308('0x31')];if(!_0x5dbf52[_0x8308('0x32')][_0x8308('0x38')]('nolimit')){_0x5aee61[_0x8308('0x1d')]=qs[_0x8308('0x1d')](_0x5dbf52[_0x8308('0x32')][_0x8308('0x1d')]);_0x5aee61[_0x8308('0x1b')]=qs[_0x8308('0x1b')](_0x5dbf52['query']['offset']);}_0x5aee61[_0x8308('0x39')]=qs[_0x8308('0x3a')](_0x5dbf52[_0x8308('0x32')][_0x8308('0x3a')]);_0x5aee61[_0x8308('0x3b')]=qs[_0x8308('0x33')](_[_0x8308('0x3c')](_0x5dbf52[_0x8308('0x32')],_0x533f5e['filters']),_0x277c98);if(_0x5dbf52['query'][_0x8308('0x3d')]){_0x5aee61[_0x8308('0x3b')]=_[_0x8308('0x3e')](_0x5aee61[_0x8308('0x3b')],{'$or':_[_0x8308('0x2c')](_0x277c98,function(_0x3adf4b){if(_0x3adf4b[_0x8308('0x30')]!==_0x8308('0x3f')){var _0x5451b3={};_0x5451b3[_0x3adf4b[_0x8308('0x29')]]={'$like':'%'+_0x5dbf52['query'][_0x8308('0x3d')]+'%'};return _0x5451b3;}})});}_0x5aee61=_['merge']({},_0x5aee61,_0x5dbf52[_0x8308('0x40')]);var _0x4e352b={'where':_0x5aee61[_0x8308('0x3b')]};return db['VoiceQueueReport'][_0x8308('0x1e')](_0x4e352b)[_0x8308('0x26')](function(_0x205450){_0x1691ce[_0x8308('0x1e')]=_0x205450;if(_0x5dbf52[_0x8308('0x32')][_0x8308('0x41')]){_0x5aee61[_0x8308('0x42')]=[{'all':!![]}];}return db[_0x8308('0x2d')][_0x8308('0x43')](_0x5aee61);})[_0x8308('0x26')](function(_0x58e371){_0x1691ce[_0x8308('0x44')]=_0x58e371;return _0x1691ce;})['then'](respondWithFilteredResult(_0x219447,_0x5aee61))[_0x8308('0x45')](handleError(_0x219447,null));};exports[_0x8308('0x46')]=function(_0x396d25,_0x5792df){var _0xcac6f6={'raw':![],'where':{'id':_0x396d25[_0x8308('0x47')]['id']}},_0x36d54e={};_0x36d54e['model']=_['keys'](db['VoiceQueueReport'][_0x8308('0x2e')]);_0x36d54e[_0x8308('0x32')]=_['keys'](_0x396d25[_0x8308('0x32')]);_0x36d54e[_0x8308('0x33')]=_['intersection'](_0x36d54e[_0x8308('0x31')],_0x36d54e[_0x8308('0x32')]);_0xcac6f6[_0x8308('0x35')]=_[_0x8308('0x34')](_0x36d54e[_0x8308('0x31')],qs['fields'](_0x396d25['query'][_0x8308('0x36')]));_0xcac6f6[_0x8308('0x35')]=_0xcac6f6[_0x8308('0x35')][_0x8308('0x37')]?_0xcac6f6['attributes']:_0x36d54e[_0x8308('0x31')];if(_0x396d25[_0x8308('0x32')][_0x8308('0x41')]){_0xcac6f6[_0x8308('0x42')]=[{'all':!![]}];}_0xcac6f6=_[_0x8308('0x3e')]({},_0xcac6f6,_0x396d25[_0x8308('0x40')]);return db[_0x8308('0x2d')][_0x8308('0x48')](_0xcac6f6)[_0x8308('0x26')](handleEntityNotFound(_0x5792df,null))['then'](respondWithResult(_0x5792df,null))['catch'](handleError(_0x5792df,null));};exports['create']=function(_0x5dbbe0,_0x2b4d24){return db[_0x8308('0x2d')][_0x8308('0x49')](_0x5dbbe0['body'],{})[_0x8308('0x26')](respondWithResult(_0x2b4d24,0xc9))[_0x8308('0x45')](handleError(_0x2b4d24,null));};exports[_0x8308('0x4a')]=function(_0x5546c6,_0x15729a){if(_0x5546c6[_0x8308('0x4b')]['id']){delete _0x5546c6[_0x8308('0x4b')]['id'];}return db[_0x8308('0x2d')][_0x8308('0x48')]({'where':{'id':_0x5546c6[_0x8308('0x47')]['id']}})[_0x8308('0x26')](handleEntityNotFound(_0x15729a,null))[_0x8308('0x26')](saveUpdates(_0x5546c6[_0x8308('0x4b')],null))[_0x8308('0x26')](respondWithResult(_0x15729a,null))[_0x8308('0x45')](handleError(_0x15729a,null));};exports[_0x8308('0x25')]=function(_0x19b5ff,_0x2a5d25){return db['VoiceQueueReport']['find']({'where':{'id':_0x19b5ff['params']['id']}})[_0x8308('0x26')](handleEntityNotFound(_0x2a5d25,null))[_0x8308('0x26')](removeEntity(_0x2a5d25,null))[_0x8308('0x45')](handleError(_0x2a5d25,null));};exports[_0x8308('0x4c')]=function(_0x44c324,_0x1bb64a){return db[_0x8308('0x2d')][_0x8308('0x4c')]()[_0x8308('0x26')](respondWithResult(_0x1bb64a,null))[_0x8308('0x45')](handleError(_0x1bb64a,null));};exports[_0x8308('0x4d')]=function(_0x4bd375,_0x3fb203){var _0x579595={},_0x4dc2ec={},_0x3d4cef={'count':0x0,'rows':[]};_0x4dc2ec[_0x8308('0x31')]=_[_0x8308('0x4e')](db[_0x8308('0x2d')][_0x8308('0x2e')]);_0x4dc2ec[_0x8308('0x32')]=_[_0x8308('0x4e')](_0x4bd375['query']);_0x4dc2ec[_0x8308('0x33')]=_[_0x8308('0x34')](_0x4dc2ec[_0x8308('0x31')],_0x4dc2ec[_0x8308('0x32')]);_0x579595['attributes']=_[_0x8308('0x34')](_0x4dc2ec[_0x8308('0x31')],qs[_0x8308('0x36')](_0x4bd375[_0x8308('0x32')][_0x8308('0x36')]));_0x579595['attributes']=_0x579595[_0x8308('0x35')][_0x8308('0x37')]?_0x579595[_0x8308('0x35')]:_0x4dc2ec[_0x8308('0x31')];if(!_0x4bd375[_0x8308('0x32')]['hasOwnProperty'](_0x8308('0x4f'))){_0x579595[_0x8308('0x1d')]=qs[_0x8308('0x1d')](_0x4bd375['query'][_0x8308('0x1d')]);_0x579595[_0x8308('0x1b')]=qs[_0x8308('0x1b')](_0x4bd375[_0x8308('0x32')]['offset']);}_0x579595[_0x8308('0x39')]=qs['sort'](_0x4bd375[_0x8308('0x32')][_0x8308('0x3a')]);_0x579595[_0x8308('0x3b')]=qs[_0x8308('0x33')](_[_0x8308('0x3c')](_0x4bd375[_0x8308('0x32')],_0x4dc2ec[_0x8308('0x33')]));if(_0x4bd375['query'][_0x8308('0x3d')]){_0x579595[_0x8308('0x3b')]=_[_0x8308('0x3e')](_0x579595[_0x8308('0x3b')],{'$or':_[_0x8308('0x2c')](_0x579595[_0x8308('0x35')],function(_0x3ec887){var _0x56dc7c={};_0x56dc7c[_0x3ec887]={'$like':'%'+_0x4bd375[_0x8308('0x32')][_0x8308('0x3d')]+'%'};return _0x56dc7c;})});}_0x579595=_[_0x8308('0x3e')]({},_0x579595,_0x4bd375[_0x8308('0x40')]);var _0x179d32={'where':_0x579595[_0x8308('0x3b')]};return db['VoiceQueueReport'][_0x8308('0x1e')](_0x179d32)['then'](function(_0x3080b7){_0x3d4cef[_0x8308('0x1e')]=_0x3080b7;if(_0x4bd375[_0x8308('0x32')][_0x8308('0x41')]){_0x579595['include']=[{'all':!![]}];}return db[_0x8308('0x2d')][_0x8308('0x43')](_0x579595);})['then'](function(_0x2fd682){_0x3d4cef[_0x8308('0x44')]=_0x2fd682;return _0x3d4cef;})[_0x8308('0x26')](respondWithFilteredResult(_0x3fb203,_0x579595,_0x8308('0x4d')))[_0x8308('0x45')](handleError(_0x3fb203,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 4e1e21b..195fb54 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 _0x8a7f=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xca6a64,_0x52ed94){var _0x2faba5=function(_0x158a13){while(--_0x158a13){_0xca6a64['push'](_0xca6a64['shift']());}};_0x2faba5(++_0x52ed94);}(_0x8a7f,0x1cb));var _0xf8a7=function(_0x62559b,_0x1969dc){_0x62559b=_0x62559b-0x0;var _0x5df630=_0x8a7f[_0x62559b];return _0x5df630;};'use strict';var EventEmitter=require(_0xf8a7('0x0'));var VoiceQueueReport=require(_0xf8a7('0x1'))['db'][_0xf8a7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf8a7('0x3')](0x0);var events={'afterCreate':_0xf8a7('0x4'),'afterUpdate':_0xf8a7('0x5'),'afterDestroy':'remove'};function emitEvent(_0xce0301){return function(_0x592f07,_0x4894a9,_0x51bbeb){VoiceQueueReportEvents[_0xf8a7('0x6')](_0xce0301+':'+_0x592f07['id'],_0x592f07);VoiceQueueReportEvents[_0xf8a7('0x6')](_0xce0301,_0x592f07);_0x51bbeb(null);};}for(var e in events){if(events[_0xf8a7('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf8a7('0x8')](e,emitEvent(event));}}module[_0xf8a7('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x006c=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x2dfe1c,_0x52165a){var _0x251ca2=function(_0x5ba9ec){while(--_0x5ba9ec){_0x2dfe1c['push'](_0x2dfe1c['shift']());}};_0x251ca2(++_0x52165a);}(_0x006c,0x195));var _0xc006=function(_0x3525b3,_0x71b7aa){_0x3525b3=_0x3525b3-0x0;var _0x287126=_0x006c[_0x3525b3];return _0x287126;};'use strict';var EventEmitter=require(_0xc006('0x0'));var VoiceQueueReport=require(_0xc006('0x1'))['db'][_0xc006('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc006('0x3')](0x0);var events={'afterCreate':_0xc006('0x4'),'afterUpdate':_0xc006('0x5'),'afterDestroy':'remove'};function emitEvent(_0x590dfe){return function(_0x2acedc,_0x5253a2,_0x1c604c){VoiceQueueReportEvents[_0xc006('0x6')](_0x590dfe+':'+_0x2acedc['id'],_0x2acedc);VoiceQueueReportEvents['emit'](_0x590dfe,_0x2acedc);_0x1c604c(null);};}for(var e in events){if(events[_0xc006('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc006('0x8')](e,emitEvent(event));}}module[_0xc006('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 0cff62b..8258a4e 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 _0xed70=['report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x3bda2e,_0x267100){var _0x24abc4=function(_0x219b8c){while(--_0x219b8c){_0x3bda2e['push'](_0x3bda2e['shift']());}};_0x24abc4(++_0x267100);}(_0xed70,0x6f));var _0x0ed7=function(_0x1c487d,_0xbecafe){_0x1c487d=_0x1c487d-0x0;var _0x1866b4=_0xed70[_0x1c487d];return _0x1866b4;};'use strict';var _=require('lodash');var util=require(_0x0ed7('0x0'));var logger=require(_0x0ed7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ed7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ed7('0x3'));var config=require(_0x0ed7('0x4'));var attributes=require(_0x0ed7('0x5'));module[_0x0ed7('0x6')]=function(_0x79167d,_0x4e95b0){return _0x79167d[_0x0ed7('0x7')](_0x0ed7('0x8'),attributes,{'tableName':_0x0ed7('0x9'),'paranoid':![],'indexes':[{'fields':[_0x0ed7('0xa')]},{'fields':[_0x0ed7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6175=['lodash','util','../../config/logger','api','moment','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6175,0xe4));var _0x5617=function(_0x5d801f,_0x1c5fa3){_0x5d801f=_0x5d801f-0x0;var _0x1b9178=_0x6175[_0x5d801f];return _0x1b9178;};'use strict';var _=require(_0x5617('0x0'));var util=require(_0x5617('0x1'));var logger=require(_0x5617('0x2'))(_0x5617('0x3'));var moment=require(_0x5617('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5617('0x5'));var rimraf=require(_0x5617('0x6'));var config=require('../../config/environment');var attributes=require(_0x5617('0x7'));module[_0x5617('0x8')]=function(_0x2a4c36,_0xbe7438){return _0x2a4c36[_0x5617('0x9')](_0x5617('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5617('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d2bfa26..8a9d014 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 _0xab49=['rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','then','debug','stringify','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x32feb7,_0xa419b4){var _0x82ad48=function(_0x3e5960){while(--_0x3e5960){_0x32feb7['push'](_0x32feb7['shift']());}};_0x82ad48(++_0xa419b4);}(_0xab49,0x7d));var _0x9ab4=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xab49[_0x3f4891];return _0x54f2d8;};'use strict';var _=require('lodash');var util=require(_0x9ab4('0x0'));var moment=require(_0x9ab4('0x1'));var BPromise=require(_0x9ab4('0x2'));var rs=require(_0x9ab4('0x3'));var fs=require('fs');var Redis=require(_0x9ab4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab4('0x5'));var logger=require(_0x9ab4('0x6'))(_0x9ab4('0x7'));var config=require(_0x9ab4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9ab4('0x9')]({'port':0x232a});config['redis']=_[_0x9ab4('0xa')](config['redis'],{'host':_0x9ab4('0xb'),'port':0x18eb});var socket=require(_0x9ab4('0xc'))(new Redis(config[_0x9ab4('0xd')]));require(_0x9ab4('0xe'))[_0x9ab4('0xf')](socket);function respondWithRpcPromise(_0x1996f4,_0xb292e4,_0x249b9c){return new BPromise(function(_0xa4aee,_0x4bd93a){return client[_0x9ab4('0x10')](_0x1996f4,_0x249b9c)['then'](function(_0x5cf0a5){logger[_0x9ab4('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0xb292e4,_0x9ab4('0x12'));logger['debug'](_0x9ab4('0x13'),_0xb292e4,_0x9ab4('0x12'),JSON['stringify'](_0x5cf0a5));if(_0x5cf0a5[_0x9ab4('0x14')]){if(_0x5cf0a5[_0x9ab4('0x14')][_0x9ab4('0x15')]===0x1f4){logger[_0x9ab4('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0xb292e4,_0x5cf0a5[_0x9ab4('0x14')][_0x9ab4('0x16')]);return _0x4bd93a(_0x5cf0a5[_0x9ab4('0x14')][_0x9ab4('0x16')]);}logger[_0x9ab4('0x14')](_0x9ab4('0x17'),_0xb292e4,_0x5cf0a5[_0x9ab4('0x14')][_0x9ab4('0x16')]);return _0xa4aee(_0x5cf0a5['error'][_0x9ab4('0x16')]);}else{logger[_0x9ab4('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0xb292e4,_0x9ab4('0x12'));_0xa4aee(_0x5cf0a5[_0x9ab4('0x18')][_0x9ab4('0x16')]);}})[_0x9ab4('0x19')](function(_0x4780b3){logger['error'](_0x9ab4('0x17'),_0xb292e4,_0x4780b3);_0x4bd93a(_0x4780b3);});});}exports[_0x9ab4('0x1a')]=function(_0xff6488){var _0x48d9ea=this;return new Promise(function(_0x2bb3fd,_0x242390){return db[_0x9ab4('0x1b')]['findAll']({'raw':_0xff6488[_0x9ab4('0x1c')]?_0xff6488[_0x9ab4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xff6488['options']?_0xff6488['options'][_0x9ab4('0x1d')]||null:null,'attributes':_0xff6488['options']?_0xff6488[_0x9ab4('0x1c')][_0x9ab4('0x1e')]||null:null,'limit':_0xff6488['options']?_0xff6488[_0x9ab4('0x1c')][_0x9ab4('0x1f')]||null:null,'include':_0xff6488[_0x9ab4('0x1c')]?_0xff6488[_0x9ab4('0x1c')][_0x9ab4('0x20')]?_[_0x9ab4('0x21')](_0xff6488[_0x9ab4('0x1c')][_0x9ab4('0x20')],function(_0x4b1f1a){return{'model':db[_0x4b1f1a['model']],'as':_0x4b1f1a['as'],'attributes':_0x4b1f1a[_0x9ab4('0x1e')],'include':_0x4b1f1a[_0x9ab4('0x20')]?_[_0x9ab4('0x21')](_0x4b1f1a[_0x9ab4('0x20')],function(_0x46db87){return{'model':db[_0x46db87[_0x9ab4('0x22')]],'as':_0x46db87['as'],'attributes':_0x46db87['attributes'],'include':_0x46db87['include']?_[_0x9ab4('0x21')](_0x46db87[_0x9ab4('0x20')],function(_0x1d2722){return{'model':db[_0x1d2722['model']],'as':_0x1d2722['as'],'attributes':_0x1d2722['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ab4('0x23')](function(_0x13db8b){logger['info'](_0x9ab4('0x1a'),_0xff6488);logger[_0x9ab4('0x24')](_0x9ab4('0x1a'),_0xff6488,JSON[_0x9ab4('0x25')](_0x13db8b));_0x2bb3fd(_0x13db8b);})['catch'](function(_0x590a82){logger['error']('GetVoiceQueueReport',_0x590a82[_0x9ab4('0x16')],_0xff6488);_0x242390(_0x48d9ea['error'](0x1f4,_0x590a82[_0x9ab4('0x16')]));});});};exports[_0x9ab4('0x26')]=function(_0x59fa9a){var _0x23aef2=this;return new Promise(function(_0x263e01,_0x4b78ef){return db['VoiceQueueReport'][_0x9ab4('0x27')](_0x59fa9a[_0x9ab4('0x28')],{'raw':_0x59fa9a[_0x9ab4('0x1c')]?_0x59fa9a[_0x9ab4('0x1c')][_0x9ab4('0x29')]===undefined?!![]:![]:!![]})[_0x9ab4('0x23')](function(_0x22ce32){logger['info'](_0x9ab4('0x26'),_0x59fa9a);logger['debug'](_0x9ab4('0x26'),_0x59fa9a,JSON[_0x9ab4('0x25')](_0x22ce32));_0x263e01(_0x22ce32);})[_0x9ab4('0x19')](function(_0x55c51f){logger[_0x9ab4('0x14')](_0x9ab4('0x26'),_0x55c51f[_0x9ab4('0x16')],_0x59fa9a);_0x4b78ef(_0x23aef2[_0x9ab4('0x14')](0x1f4,_0x55c51f[_0x9ab4('0x16')]));});});};exports[_0x9ab4('0x2a')]=function(_0x5c2e6a){var _0x582e84=this;return new Promise(function(_0x46c99f,_0x4bee50){return db[_0x9ab4('0x1b')][_0x9ab4('0x2b')](_0x5c2e6a[_0x9ab4('0x28')],{'raw':_0x5c2e6a[_0x9ab4('0x1c')]?_0x5c2e6a['options'][_0x9ab4('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2e6a['options']?_0x5c2e6a['options'][_0x9ab4('0x1d')]||null:null,'attributes':_0x5c2e6a[_0x9ab4('0x1c')]?_0x5c2e6a[_0x9ab4('0x1c')][_0x9ab4('0x1e')]||null:null,'limit':_0x5c2e6a['options']?_0x5c2e6a['options'][_0x9ab4('0x1f')]||null:null})[_0x9ab4('0x23')](function(_0x5159d5){logger[_0x9ab4('0x11')](_0x9ab4('0x2a'),_0x5c2e6a);logger[_0x9ab4('0x24')](_0x9ab4('0x2a'),_0x5c2e6a,JSON[_0x9ab4('0x25')](_0x5159d5));_0x46c99f(_0x5159d5);})[_0x9ab4('0x19')](function(_0x1d14da){logger[_0x9ab4('0x14')](_0x9ab4('0x2a'),_0x1d14da[_0x9ab4('0x16')],_0x5c2e6a);_0x4bee50(_0x582e84[_0x9ab4('0x14')](0x1f4,_0x1d14da[_0x9ab4('0x16')]));});});}; \ No newline at end of file +var _0xd10c=['map','include','model','debug','VoiceQueueReport','create','stringify','CreateVoiceQueueReport','update','body','UpdateVoiceQueueReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit'];(function(_0x343a60,_0x378996){var _0x3baca2=function(_0x133413){while(--_0x133413){_0x343a60['push'](_0x343a60['shift']());}};_0x3baca2(++_0x378996);}(_0xd10c,0x17c));var _0xcd10=function(_0x18e61b,_0x326ded){_0x18e61b=_0x18e61b-0x0;var _0xd2373f=_0xd10c[_0x18e61b];return _0xd2373f;};'use strict';var _=require('lodash');var util=require(_0xcd10('0x0'));var moment=require('moment');var BPromise=require(_0xcd10('0x1'));var rs=require(_0xcd10('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd10('0x3'))['db'];var utils=require(_0xcd10('0x4'));var logger=require(_0xcd10('0x5'))('rpc');var config=require(_0xcd10('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcd10('0x7')]['http']({'port':0x232a});config['redis']=_[_0xcd10('0x8')](config[_0xcd10('0x9')],{'host':_0xcd10('0xa'),'port':0x18eb});var socket=require(_0xcd10('0xb'))(new Redis(config[_0xcd10('0x9')]));require(_0xcd10('0xc'))[_0xcd10('0xd')](socket);function respondWithRpcPromise(_0x2ad769,_0x45d1fd,_0x5e5a48){return new BPromise(function(_0x143cbd,_0x488a5b){return client['request'](_0x2ad769,_0x5e5a48)[_0xcd10('0xe')](function(_0x393e41){logger[_0xcd10('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x45d1fd,_0xcd10('0x10'));logger['debug'](_0xcd10('0x11'),_0x45d1fd,_0xcd10('0x10'),JSON['stringify'](_0x393e41));if(_0x393e41[_0xcd10('0x12')]){if(_0x393e41['error'][_0xcd10('0x13')]===0x1f4){logger[_0xcd10('0x12')](_0xcd10('0x14'),_0x45d1fd,_0x393e41['error'][_0xcd10('0x15')]);return _0x488a5b(_0x393e41[_0xcd10('0x12')]['message']);}logger[_0xcd10('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x45d1fd,_0x393e41[_0xcd10('0x12')][_0xcd10('0x15')]);return _0x143cbd(_0x393e41['error'][_0xcd10('0x15')]);}else{logger[_0xcd10('0xf')](_0xcd10('0x14'),_0x45d1fd,_0xcd10('0x10'));_0x143cbd(_0x393e41['result'][_0xcd10('0x15')]);}})[_0xcd10('0x16')](function(_0x2595fe){logger[_0xcd10('0x12')](_0xcd10('0x14'),_0x45d1fd,_0x2595fe);_0x488a5b(_0x2595fe);});});}exports[_0xcd10('0x17')]=function(_0x330de5){var _0x4a9e0d=this;return new Promise(function(_0x95dc43,_0x5e69b3){return db['VoiceQueueReport'][_0xcd10('0x18')]({'raw':_0x330de5['options']?_0x330de5[_0xcd10('0x19')][_0xcd10('0x1a')]===undefined?!![]:![]:!![],'where':_0x330de5[_0xcd10('0x19')]?_0x330de5[_0xcd10('0x19')][_0xcd10('0x1b')]||null:null,'attributes':_0x330de5[_0xcd10('0x19')]?_0x330de5['options'][_0xcd10('0x1c')]||null:null,'limit':_0x330de5[_0xcd10('0x19')]?_0x330de5[_0xcd10('0x19')][_0xcd10('0x1d')]||null:null,'include':_0x330de5[_0xcd10('0x19')]?_0x330de5[_0xcd10('0x19')]['include']?_[_0xcd10('0x1e')](_0x330de5['options'][_0xcd10('0x1f')],function(_0x4f6dd4){return{'model':db[_0x4f6dd4[_0xcd10('0x20')]],'as':_0x4f6dd4['as'],'attributes':_0x4f6dd4[_0xcd10('0x1c')],'include':_0x4f6dd4['include']?_[_0xcd10('0x1e')](_0x4f6dd4[_0xcd10('0x1f')],function(_0x106297){return{'model':db[_0x106297[_0xcd10('0x20')]],'as':_0x106297['as'],'attributes':_0x106297[_0xcd10('0x1c')],'include':_0x106297['include']?_[_0xcd10('0x1e')](_0x106297[_0xcd10('0x1f')],function(_0x416ed4){return{'model':db[_0x416ed4[_0xcd10('0x20')]],'as':_0x416ed4['as'],'attributes':_0x416ed4[_0xcd10('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcd10('0xe')](function(_0x55c07a){logger[_0xcd10('0xf')](_0xcd10('0x17'),_0x330de5);logger[_0xcd10('0x21')](_0xcd10('0x17'),_0x330de5,JSON['stringify'](_0x55c07a));_0x95dc43(_0x55c07a);})['catch'](function(_0x13414a){logger[_0xcd10('0x12')](_0xcd10('0x17'),_0x13414a[_0xcd10('0x15')],_0x330de5);_0x5e69b3(_0x4a9e0d[_0xcd10('0x12')](0x1f4,_0x13414a[_0xcd10('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x1f757a){var _0x39a312=this;return new Promise(function(_0xd66b4,_0x5c85e2){return db[_0xcd10('0x22')][_0xcd10('0x23')](_0x1f757a['body'],{'raw':_0x1f757a[_0xcd10('0x19')]?_0x1f757a['options'][_0xcd10('0x1a')]===undefined?!![]:![]:!![]})[_0xcd10('0xe')](function(_0x3fc12b){logger[_0xcd10('0xf')]('CreateVoiceQueueReport',_0x1f757a);logger[_0xcd10('0x21')]('CreateVoiceQueueReport',_0x1f757a,JSON[_0xcd10('0x24')](_0x3fc12b));_0xd66b4(_0x3fc12b);})['catch'](function(_0x1b4e86){logger[_0xcd10('0x12')](_0xcd10('0x25'),_0x1b4e86[_0xcd10('0x15')],_0x1f757a);_0x5c85e2(_0x39a312[_0xcd10('0x12')](0x1f4,_0x1b4e86[_0xcd10('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x509ae2){var _0x8357e7=this;return new Promise(function(_0x4860b8,_0x56f9b0){return db[_0xcd10('0x22')][_0xcd10('0x26')](_0x509ae2[_0xcd10('0x27')],{'raw':_0x509ae2[_0xcd10('0x19')]?_0x509ae2[_0xcd10('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509ae2[_0xcd10('0x19')]?_0x509ae2[_0xcd10('0x19')][_0xcd10('0x1b')]||null:null,'attributes':_0x509ae2[_0xcd10('0x19')]?_0x509ae2[_0xcd10('0x19')][_0xcd10('0x1c')]||null:null,'limit':_0x509ae2[_0xcd10('0x19')]?_0x509ae2['options']['limit']||null:null})[_0xcd10('0xe')](function(_0x3bebcb){logger[_0xcd10('0xf')](_0xcd10('0x28'),_0x509ae2);logger[_0xcd10('0x21')]('UpdateVoiceQueueReport',_0x509ae2,JSON[_0xcd10('0x24')](_0x3bebcb));_0x4860b8(_0x3bebcb);})[_0xcd10('0x16')](function(_0x274d03){logger[_0xcd10('0x12')](_0xcd10('0x28'),_0x274d03[_0xcd10('0x15')],_0x509ae2);_0x56f9b0(_0x8357e7['error'](0x1f4,_0x274d03[_0xcd10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a46f620..eba08ca 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 _0xe043=['register','length','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x2878f8,_0x5ee0f4){var _0x415656=function(_0x355daf){while(--_0x355daf){_0x2878f8['push'](_0x2878f8['shift']());}};_0x415656(++_0x5ee0f4);}(_0xe043,0x113));var _0x3e04=function(_0x19cac2,_0x35893c){_0x19cac2=_0x19cac2-0x0;var _0x1c004b=_0xe043[_0x19cac2];return _0x1c004b;};'use strict';var VoiceQueueReportEvents=require(_0x3e04('0x0'));var events=[_0x3e04('0x1'),_0x3e04('0x2'),_0x3e04('0x3')];function createListener(_0x295306,_0x1d91f5){return function(_0x1df351){_0x1d91f5[_0x3e04('0x4')](_0x295306,_0x1df351);};}function removeListener(_0x58624d,_0x3dff7f){return function(){VoiceQueueReportEvents['removeListener'](_0x58624d,_0x3dff7f);};}exports[_0x3e04('0x5')]=function(_0x55d340){for(var _0x1b30b6=0x0,_0x1638bc=events[_0x3e04('0x6')];_0x1b30b6<_0x1638bc;_0x1b30b6++){var _0x566f0f=events[_0x1b30b6];var _0x2d0b42=createListener('voiceQueueReport:'+_0x566f0f,_0x55d340);VoiceQueueReportEvents['on'](_0x566f0f,_0x2d0b42);}}; \ No newline at end of file +var _0xcb41=['emit','removeListener','register','./voiceQueueReport.events','save','remove','update'];(function(_0x5d8113,_0x14003f){var _0x47d13b=function(_0x4163c1){while(--_0x4163c1){_0x5d8113['push'](_0x5d8113['shift']());}};_0x47d13b(++_0x14003f);}(_0xcb41,0x1df));var _0x1cb4=function(_0x599edb,_0x90ad92){_0x599edb=_0x599edb-0x0;var _0x178727=_0xcb41[_0x599edb];return _0x178727;};'use strict';var VoiceQueueReportEvents=require(_0x1cb4('0x0'));var events=[_0x1cb4('0x1'),_0x1cb4('0x2'),_0x1cb4('0x3')];function createListener(_0x4f9dd0,_0x4309c0){return function(_0x47dba0){_0x4309c0[_0x1cb4('0x4')](_0x4f9dd0,_0x47dba0);};}function removeListener(_0x31d7b5,_0x19b235){return function(){VoiceQueueReportEvents[_0x1cb4('0x5')](_0x31d7b5,_0x19b235);};}exports[_0x1cb4('0x6')]=function(_0x547f4){for(var _0x2eaeb4=0x0,_0x42e7fe=events['length'];_0x2eaeb4<_0x42e7fe;_0x2eaeb4++){var _0x2b51e3=events[_0x2eaeb4];var _0x2a5095=createListener('voiceQueueReport:'+_0x2b51e3,_0x547f4);VoiceQueueReportEvents['on'](_0x2b51e3,_0x2a5095);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 25b8842..5f9e2bc 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 _0x7de4=['../../config/environment','./voiceQueuesLog.controller','index','/:id','isAuthenticated','post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x34e747,_0x173163){var _0x200a90=function(_0x2cfb42){while(--_0x2cfb42){_0x34e747['push'](_0x34e747['shift']());}};_0x200a90(++_0x173163);}(_0x7de4,0xb4));var _0x47de=function(_0x4fd7c5,_0x2c4ad4){_0x4fd7c5=_0x4fd7c5-0x0;var _0x407c74=_0x7de4[_0x4fd7c5];return _0x407c74;};'use strict';var multer=require(_0x47de('0x0'));var util=require('util');var path=require(_0x47de('0x1'));var timeout=require(_0x47de('0x2'));var express=require('express');var router=express[_0x47de('0x3')]();var fs_extra=require(_0x47de('0x4'));var auth=require(_0x47de('0x5'));var interaction=require(_0x47de('0x6'));var config=require(_0x47de('0x7'));var controller=require(_0x47de('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x47de('0x9')]);router['get'](_0x47de('0xa'),auth[_0x47de('0xb')](),controller['show']);router[_0x47de('0xc')]('/',auth[_0x47de('0xb')](),controller[_0x47de('0xd')]);router[_0x47de('0xe')](_0x47de('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x47de('0xf')]('/:id',auth[_0x47de('0xb')](),controller['destroy']);module[_0x47de('0x10')]=router; \ No newline at end of file +var _0x91a6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x349bb4,_0x2fab61){var _0x1311c2=function(_0x54fb9a){while(--_0x54fb9a){_0x349bb4['push'](_0x349bb4['shift']());}};_0x1311c2(++_0x2fab61);}(_0x91a6,0x12d));var _0x691a=function(_0x393470,_0x280944){_0x393470=_0x393470-0x0;var _0x212926=_0x91a6[_0x393470];return _0x212926;};'use strict';var multer=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var path=require(_0x691a('0x2'));var timeout=require(_0x691a('0x3'));var express=require('express');var router=express[_0x691a('0x4')]();var fs_extra=require(_0x691a('0x5'));var auth=require(_0x691a('0x6'));var interaction=require(_0x691a('0x7'));var config=require(_0x691a('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x691a('0x9')]('/',auth[_0x691a('0xa')](),controller[_0x691a('0xb')]);router[_0x691a('0x9')](_0x691a('0xc'),auth[_0x691a('0xa')](),controller[_0x691a('0xd')]);router['post']('/',auth[_0x691a('0xa')](),controller[_0x691a('0xe')]);router['put'](_0x691a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x691a('0xf')](_0x691a('0xc'),auth[_0x691a('0xa')](),controller[_0x691a('0x10')]);module[_0x691a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 01e22bf..2042aca 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 _0x7409=['sequelize','moment','STRING','DATE','format'];(function(_0x475f27,_0x2d3b5b){var _0x11690f=function(_0x17e208){while(--_0x17e208){_0x475f27['push'](_0x475f27['shift']());}};_0x11690f(++_0x2d3b5b);}(_0x7409,0x6e));var _0x9740=function(_0x51a023,_0x40ff38){_0x51a023=_0x51a023-0x0;var _0x1dfe91=_0x7409[_0x51a023];return _0x1dfe91;};'use strict';var Sequelize=require(_0x9740('0x0'));var moment=require(_0x9740('0x1'));module['exports']={'time':{'type':Sequelize[_0x9740('0x2')]},'callid':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9740('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9740('0x3')],'allowNull':![],'defaultValue':moment()[_0x9740('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xf8ae=['sequelize','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xbc56d,_0x3265a5){var _0x31bb0f=function(_0x1b8319){while(--_0x1b8319){_0xbc56d['push'](_0xbc56d['shift']());}};_0x31bb0f(++_0x3265a5);}(_0xf8ae,0x168));var _0xef8a=function(_0xfa66dd,_0x4607f9){_0xfa66dd=_0xfa66dd-0x0;var _0x39af85=_0xf8ae[_0xfa66dd];return _0x39af85;};'use strict';var Sequelize=require(_0xef8a('0x0'));var moment=require(_0xef8a('0x1'));module['exports']={'time':{'type':Sequelize[_0xef8a('0x2')]},'callid':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xef8a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xef8a('0x3')],'allowNull':![],'defaultValue':moment()[_0xef8a('0x4')](_0xef8a('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d0de069..39a2201 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 _0x7203=['save','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','query','intersection','model','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','map','type','VIRTUAL','include','findAll','catch','show','params','keys','fields','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count','set','Content-Range','reject'];(function(_0x3fd8b3,_0x5c5991){var _0x98d7bb=function(_0x333a27){while(--_0x333a27){_0x3fd8b3['push'](_0x3fd8b3['shift']());}};_0x98d7bb(++_0x5c5991);}(_0x7203,0x151));var _0x3720=function(_0x3827fe,_0x2471fd){_0x3827fe=_0x3827fe-0x0;var _0x5bf43d=_0x7203[_0x3827fe];return _0x5bf43d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3720('0x0'));var zipdir=require(_0x3720('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3720('0x2'));var moment=require(_0x3720('0x3'));var BPromise=require(_0x3720('0x4'));var Mustache=require(_0x3720('0x5'));var util=require(_0x3720('0x6'));var path=require(_0x3720('0x7'));var sox=require(_0x3720('0x8'));var csv=require(_0x3720('0x9'));var ejs=require(_0x3720('0xa'));var fs=require('fs');var fs_extra=require(_0x3720('0xb'));var _=require('lodash');var squel=require(_0x3720('0xc'));var crypto=require(_0x3720('0xd'));var jsforce=require(_0x3720('0xe'));var deskjs=require(_0x3720('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3720('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3720('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3720('0x12'));var logger=require(_0x3720('0x13'))(_0x3720('0x14'));var utils=require('../../config/utils');var config=require(_0x3720('0x15'));var licenseUtil=require(_0x3720('0x16'));var db=require(_0x3720('0x17'))['db'];function respondWithStatusCode(_0x56845b,_0x2b5bc1){_0x2b5bc1=_0x2b5bc1||0xcc;return function(_0x33e7bf){if(_0x33e7bf){return _0x56845b['sendStatus'](_0x2b5bc1);}return _0x56845b['status'](_0x2b5bc1)[_0x3720('0x18')]();};}function respondWithResult(_0x1a8051,_0x331e01){_0x331e01=_0x331e01||0xc8;return function(_0x566ee3){if(_0x566ee3){return _0x1a8051[_0x3720('0x19')](_0x331e01)[_0x3720('0x1a')](_0x566ee3);}};}function respondWithFilteredResult(_0x39c440,_0x4da993){return function(_0x5a8245){if(_0x5a8245){var _0x42b591=typeof _0x4da993['offset']==='undefined'&&typeof _0x4da993[_0x3720('0x1b')]===_0x3720('0x1c');var _0x796860=_0x5a8245['count'];var _0x74299f=_0x42b591?0x0:_0x4da993['offset'];var _0x2a7d21=_0x42b591?_0x5a8245[_0x3720('0x1d')]:_0x4da993['offset']+_0x4da993[_0x3720('0x1b')];var _0x3d9a1f;if(_0x2a7d21>=_0x796860){_0x2a7d21=_0x796860;_0x3d9a1f=0xc8;}else{_0x3d9a1f=0xce;}_0x39c440['status'](_0x3d9a1f);return _0x39c440[_0x3720('0x1e')](_0x3720('0x1f'),_0x74299f+'-'+_0x2a7d21+'/'+_0x796860)['json'](_0x5a8245);}return null;};}function patchUpdates(_0x3be337){return function(_0x4d8d14){try{jsonpatch['apply'](_0x4d8d14,_0x3be337,!![]);}catch(_0x557743){return BPromise[_0x3720('0x20')](_0x557743);}return _0x4d8d14[_0x3720('0x21')]();};}function saveUpdates(_0x32749f,_0x9fc5b0){return function(_0x16a0b6){if(_0x16a0b6){return _0x16a0b6['update'](_0x32749f)[_0x3720('0x22')](function(_0x13f7da){return _0x13f7da;});}return null;};}function removeEntity(_0x2a99d2,_0x1b0f3c){return function(_0x5f5677){if(_0x5f5677){return _0x5f5677[_0x3720('0x23')]()[_0x3720('0x22')](function(){_0x2a99d2[_0x3720('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4d37,_0x3bb83a){return function(_0x2551df){if(!_0x2551df){_0x4a4d37['sendStatus'](0x194);}return _0x2551df;};}function handleError(_0x2b43ed,_0xacbfdc){_0xacbfdc=_0xacbfdc||0x1f4;return function(_0x2335b3){logger[_0x3720('0x24')](_0x2335b3[_0x3720('0x25')]);if(_0x2335b3[_0x3720('0x26')]){delete _0x2335b3[_0x3720('0x26')];}_0x2b43ed['status'](_0xacbfdc)[_0x3720('0x27')](_0x2335b3);};}exports[_0x3720('0x28')]=function(_0x23ea2e,_0x157c8a){var _0x1942b7={},_0xf75926={},_0x5190c2={'count':0x0,'rows':[]};var _0x1d74b3=_['map'](db[_0x3720('0x29')][_0x3720('0x2a')],function(_0x420f1c){return{'name':_0x420f1c[_0x3720('0x2b')],'type':_0x420f1c['type'][_0x3720('0x2c')]};});_0xf75926['model']=_['map'](_0x1d74b3,'name');_0xf75926['query']=_['keys'](_0x23ea2e[_0x3720('0x2d')]);_0xf75926['filters']=_[_0x3720('0x2e')](_0xf75926[_0x3720('0x2f')],_0xf75926['query']);_0x1942b7['attributes']=_['intersection'](_0xf75926['model'],qs['fields'](_0x23ea2e['query']['fields']));_0x1942b7[_0x3720('0x30')]=_0x1942b7[_0x3720('0x30')]['length']?_0x1942b7[_0x3720('0x30')]:_0xf75926['model'];if(!_0x23ea2e['query'][_0x3720('0x31')](_0x3720('0x32'))){_0x1942b7[_0x3720('0x1b')]=qs['limit'](_0x23ea2e[_0x3720('0x2d')][_0x3720('0x1b')]);_0x1942b7['offset']=qs[_0x3720('0x33')](_0x23ea2e[_0x3720('0x2d')][_0x3720('0x33')]);}_0x1942b7[_0x3720('0x34')]=qs[_0x3720('0x35')](_0x23ea2e['query']['sort']);_0x1942b7[_0x3720('0x36')]=qs[_0x3720('0x37')](_[_0x3720('0x38')](_0x23ea2e[_0x3720('0x2d')],_0xf75926[_0x3720('0x37')]),_0x1d74b3);if(_0x23ea2e[_0x3720('0x2d')]['filter']){_0x1942b7[_0x3720('0x36')]=_[_0x3720('0x39')](_0x1942b7['where'],{'$or':_[_0x3720('0x3a')](_0x1d74b3,function(_0x568341){if(_0x568341[_0x3720('0x3b')]!==_0x3720('0x3c')){var _0xffb98={};_0xffb98[_0x568341[_0x3720('0x26')]]={'$like':'%'+_0x23ea2e[_0x3720('0x2d')]['filter']+'%'};return _0xffb98;}})});}_0x1942b7=_['merge']({},_0x1942b7,_0x23ea2e['options']);var _0x1dd2b9={'where':_0x1942b7[_0x3720('0x36')]};return db[_0x3720('0x29')][_0x3720('0x1d')](_0x1dd2b9)[_0x3720('0x22')](function(_0x2889e0){_0x5190c2['count']=_0x2889e0;if(_0x23ea2e['query']['includeAll']){_0x1942b7[_0x3720('0x3d')]=[{'all':!![]}];}return db[_0x3720('0x29')][_0x3720('0x3e')](_0x1942b7);})[_0x3720('0x22')](function(_0x37ad21){_0x5190c2['rows']=_0x37ad21;return _0x5190c2;})[_0x3720('0x22')](respondWithFilteredResult(_0x157c8a,_0x1942b7))[_0x3720('0x3f')](handleError(_0x157c8a,null));};exports[_0x3720('0x40')]=function(_0x562bb8,_0x259c65){var _0x247574={'raw':!![],'where':{'id':_0x562bb8[_0x3720('0x41')]['id']}},_0x434fe1={};_0x434fe1['model']=_[_0x3720('0x42')](db[_0x3720('0x29')][_0x3720('0x2a')]);_0x434fe1[_0x3720('0x2d')]=_[_0x3720('0x42')](_0x562bb8[_0x3720('0x2d')]);_0x434fe1[_0x3720('0x37')]=_[_0x3720('0x2e')](_0x434fe1[_0x3720('0x2f')],_0x434fe1['query']);_0x247574['attributes']=_[_0x3720('0x2e')](_0x434fe1['model'],qs[_0x3720('0x43')](_0x562bb8[_0x3720('0x2d')]['fields']));_0x247574[_0x3720('0x30')]=_0x247574['attributes']['length']?_0x247574[_0x3720('0x30')]:_0x434fe1[_0x3720('0x2f')];if(_0x562bb8[_0x3720('0x2d')][_0x3720('0x44')]){_0x247574['include']=[{'all':!![]}];}_0x247574=_[_0x3720('0x39')]({},_0x247574,_0x562bb8[_0x3720('0x45')]);return db['VoiceQueuesLog'][_0x3720('0x46')](_0x247574)[_0x3720('0x22')](handleEntityNotFound(_0x259c65,null))[_0x3720('0x22')](respondWithResult(_0x259c65,null))[_0x3720('0x3f')](handleError(_0x259c65,null));};exports['create']=function(_0x2d0912,_0x3e1618){return db[_0x3720('0x29')][_0x3720('0x47')](_0x2d0912[_0x3720('0x48')],{})[_0x3720('0x22')](respondWithResult(_0x3e1618,0xc9))[_0x3720('0x3f')](handleError(_0x3e1618,null));};exports[_0x3720('0x49')]=function(_0x354466,_0x422c52){if(_0x354466[_0x3720('0x48')]['id']){delete _0x354466['body']['id'];}return db[_0x3720('0x29')][_0x3720('0x46')]({'where':{'id':_0x354466[_0x3720('0x41')]['id']}})[_0x3720('0x22')](handleEntityNotFound(_0x422c52,null))[_0x3720('0x22')](saveUpdates(_0x354466[_0x3720('0x48')],null))[_0x3720('0x22')](respondWithResult(_0x422c52,null))[_0x3720('0x3f')](handleError(_0x422c52,null));};exports['destroy']=function(_0x236f63,_0x1abd3f){return db[_0x3720('0x29')]['find']({'where':{'id':_0x236f63[_0x3720('0x41')]['id']}})[_0x3720('0x22')](handleEntityNotFound(_0x1abd3f,null))[_0x3720('0x22')](removeEntity(_0x1abd3f,null))[_0x3720('0x3f')](handleError(_0x1abd3f,null));}; \ No newline at end of file +var _0xf83e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','includeAll','catch','create','body','update','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x31ee59,_0x33d765){var _0x18c38a=function(_0x2d1596){while(--_0x2d1596){_0x31ee59['push'](_0x31ee59['shift']());}};_0x18c38a(++_0x33d765);}(_0xf83e,0x163));var _0xef83=function(_0x1058d1,_0x122d13){_0x1058d1=_0x1058d1-0x0;var _0x3078cf=_0xf83e[_0x1058d1];return _0x3078cf;};'use strict';var emlformat=require(_0xef83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef83('0x1'));var jsonpatch=require(_0xef83('0x2'));var rp=require(_0xef83('0x3'));var moment=require(_0xef83('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xef83('0x5'));var util=require(_0xef83('0x6'));var path=require(_0xef83('0x7'));var sox=require(_0xef83('0x8'));var csv=require(_0xef83('0x9'));var ejs=require(_0xef83('0xa'));var fs=require('fs');var fs_extra=require(_0xef83('0xb'));var _=require(_0xef83('0xc'));var squel=require('squel');var crypto=require(_0xef83('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xef83('0xe'));var toCsv=require(_0xef83('0x9'));var querystring=require(_0xef83('0xf'));var Papa=require(_0xef83('0x10'));var Redis=require(_0xef83('0x11'));var authService=require(_0xef83('0x12'));var qs=require(_0xef83('0x13'));var as=require(_0xef83('0x14'));var hardwareService=require(_0xef83('0x15'));var logger=require(_0xef83('0x16'))(_0xef83('0x17'));var utils=require(_0xef83('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xef83('0x19'));var db=require(_0xef83('0x1a'))['db'];function respondWithStatusCode(_0x48c47e,_0x2eebfa){_0x2eebfa=_0x2eebfa||0xcc;return function(_0x3356f8){if(_0x3356f8){return _0x48c47e['sendStatus'](_0x2eebfa);}return _0x48c47e[_0xef83('0x1b')](_0x2eebfa)[_0xef83('0x1c')]();};}function respondWithResult(_0x43fba8,_0x141bce){_0x141bce=_0x141bce||0xc8;return function(_0x236432){if(_0x236432){return _0x43fba8[_0xef83('0x1b')](_0x141bce)[_0xef83('0x1d')](_0x236432);}};}function respondWithFilteredResult(_0x4a299f,_0x3bedc0){return function(_0x3ff073){if(_0x3ff073){var _0xdc2dc4=typeof _0x3bedc0['offset']===_0xef83('0x1e')&&typeof _0x3bedc0[_0xef83('0x1f')]===_0xef83('0x1e');var _0x45f38b=_0x3ff073[_0xef83('0x20')];var _0x56de47=_0xdc2dc4?0x0:_0x3bedc0[_0xef83('0x21')];var _0x4e6683=_0xdc2dc4?_0x3ff073['count']:_0x3bedc0[_0xef83('0x21')]+_0x3bedc0[_0xef83('0x1f')];var _0x4dabba;if(_0x4e6683>=_0x45f38b){_0x4e6683=_0x45f38b;_0x4dabba=0xc8;}else{_0x4dabba=0xce;}_0x4a299f[_0xef83('0x1b')](_0x4dabba);return _0x4a299f[_0xef83('0x22')]('Content-Range',_0x56de47+'-'+_0x4e6683+'/'+_0x45f38b)[_0xef83('0x1d')](_0x3ff073);}return null;};}function patchUpdates(_0x24a3e8){return function(_0x184a9f){try{jsonpatch[_0xef83('0x23')](_0x184a9f,_0x24a3e8,!![]);}catch(_0x249d38){return BPromise[_0xef83('0x24')](_0x249d38);}return _0x184a9f[_0xef83('0x25')]();};}function saveUpdates(_0x3edc33,_0x4ad8e1){return function(_0x5645fb){if(_0x5645fb){return _0x5645fb['update'](_0x3edc33)[_0xef83('0x26')](function(_0x45cb1f){return _0x45cb1f;});}return null;};}function removeEntity(_0x56ccef,_0x3f94b7){return function(_0x1d1481){if(_0x1d1481){return _0x1d1481['destroy']()[_0xef83('0x26')](function(){_0x56ccef[_0xef83('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ab81,_0x26b120){return function(_0x2178c3){if(!_0x2178c3){_0x55ab81['sendStatus'](0x194);}return _0x2178c3;};}function handleError(_0x3a0f6a,_0x39d545){_0x39d545=_0x39d545||0x1f4;return function(_0x228cd9){logger[_0xef83('0x27')](_0x228cd9[_0xef83('0x28')]);if(_0x228cd9[_0xef83('0x29')]){delete _0x228cd9[_0xef83('0x29')];}_0x3a0f6a[_0xef83('0x1b')](_0x39d545)[_0xef83('0x2a')](_0x228cd9);};}exports[_0xef83('0x2b')]=function(_0xd7c9e1,_0x109136){var _0x4d37df={},_0x1e003f={},_0x205152={'count':0x0,'rows':[]};var _0x195a0c=_[_0xef83('0x2c')](db[_0xef83('0x2d')][_0xef83('0x2e')],function(_0x24bf93){return{'name':_0x24bf93['fieldName'],'type':_0x24bf93[_0xef83('0x2f')][_0xef83('0x30')]};});_0x1e003f[_0xef83('0x31')]=_[_0xef83('0x2c')](_0x195a0c,_0xef83('0x29'));_0x1e003f[_0xef83('0x32')]=_[_0xef83('0x33')](_0xd7c9e1[_0xef83('0x32')]);_0x1e003f[_0xef83('0x34')]=_['intersection'](_0x1e003f[_0xef83('0x31')],_0x1e003f[_0xef83('0x32')]);_0x4d37df[_0xef83('0x35')]=_[_0xef83('0x36')](_0x1e003f[_0xef83('0x31')],qs[_0xef83('0x37')](_0xd7c9e1[_0xef83('0x32')][_0xef83('0x37')]));_0x4d37df[_0xef83('0x35')]=_0x4d37df[_0xef83('0x35')][_0xef83('0x38')]?_0x4d37df[_0xef83('0x35')]:_0x1e003f[_0xef83('0x31')];if(!_0xd7c9e1[_0xef83('0x32')]['hasOwnProperty'](_0xef83('0x39'))){_0x4d37df[_0xef83('0x1f')]=qs[_0xef83('0x1f')](_0xd7c9e1[_0xef83('0x32')]['limit']);_0x4d37df[_0xef83('0x21')]=qs[_0xef83('0x21')](_0xd7c9e1['query'][_0xef83('0x21')]);}_0x4d37df[_0xef83('0x3a')]=qs['sort'](_0xd7c9e1[_0xef83('0x32')][_0xef83('0x3b')]);_0x4d37df[_0xef83('0x3c')]=qs[_0xef83('0x34')](_[_0xef83('0x3d')](_0xd7c9e1['query'],_0x1e003f[_0xef83('0x34')]),_0x195a0c);if(_0xd7c9e1['query'][_0xef83('0x3e')]){_0x4d37df[_0xef83('0x3c')]=_[_0xef83('0x3f')](_0x4d37df[_0xef83('0x3c')],{'$or':_[_0xef83('0x2c')](_0x195a0c,function(_0x5d04ef){if(_0x5d04ef[_0xef83('0x2f')]!==_0xef83('0x40')){var _0x5e3ec7={};_0x5e3ec7[_0x5d04ef[_0xef83('0x29')]]={'$like':'%'+_0xd7c9e1['query'][_0xef83('0x3e')]+'%'};return _0x5e3ec7;}})});}_0x4d37df=_[_0xef83('0x3f')]({},_0x4d37df,_0xd7c9e1[_0xef83('0x41')]);var _0xacab4d={'where':_0x4d37df[_0xef83('0x3c')]};return db['VoiceQueuesLog'][_0xef83('0x20')](_0xacab4d)[_0xef83('0x26')](function(_0x313388){_0x205152[_0xef83('0x20')]=_0x313388;if(_0xd7c9e1[_0xef83('0x32')]['includeAll']){_0x4d37df[_0xef83('0x42')]=[{'all':!![]}];}return db[_0xef83('0x2d')][_0xef83('0x43')](_0x4d37df);})['then'](function(_0x47f1ef){_0x205152['rows']=_0x47f1ef;return _0x205152;})[_0xef83('0x26')](respondWithFilteredResult(_0x109136,_0x4d37df))['catch'](handleError(_0x109136,null));};exports['show']=function(_0x16bc7a,_0x58de64){var _0x349421={'raw':!![],'where':{'id':_0x16bc7a[_0xef83('0x44')]['id']}},_0x54fbba={};_0x54fbba[_0xef83('0x31')]=_[_0xef83('0x33')](db[_0xef83('0x2d')][_0xef83('0x2e')]);_0x54fbba[_0xef83('0x32')]=_[_0xef83('0x33')](_0x16bc7a['query']);_0x54fbba[_0xef83('0x34')]=_[_0xef83('0x36')](_0x54fbba[_0xef83('0x31')],_0x54fbba[_0xef83('0x32')]);_0x349421['attributes']=_[_0xef83('0x36')](_0x54fbba[_0xef83('0x31')],qs[_0xef83('0x37')](_0x16bc7a[_0xef83('0x32')][_0xef83('0x37')]));_0x349421[_0xef83('0x35')]=_0x349421[_0xef83('0x35')][_0xef83('0x38')]?_0x349421[_0xef83('0x35')]:_0x54fbba[_0xef83('0x31')];if(_0x16bc7a[_0xef83('0x32')][_0xef83('0x45')]){_0x349421[_0xef83('0x42')]=[{'all':!![]}];}_0x349421=_[_0xef83('0x3f')]({},_0x349421,_0x16bc7a[_0xef83('0x41')]);return db[_0xef83('0x2d')]['find'](_0x349421)[_0xef83('0x26')](handleEntityNotFound(_0x58de64,null))['then'](respondWithResult(_0x58de64,null))[_0xef83('0x46')](handleError(_0x58de64,null));};exports['create']=function(_0x8f17eb,_0xc3abbe){return db[_0xef83('0x2d')][_0xef83('0x47')](_0x8f17eb[_0xef83('0x48')],{})['then'](respondWithResult(_0xc3abbe,0xc9))[_0xef83('0x46')](handleError(_0xc3abbe,null));};exports[_0xef83('0x49')]=function(_0x41121d,_0x3b7e69){if(_0x41121d[_0xef83('0x48')]['id']){delete _0x41121d['body']['id'];}return db[_0xef83('0x2d')]['find']({'where':{'id':_0x41121d[_0xef83('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b7e69,null))[_0xef83('0x26')](saveUpdates(_0x41121d[_0xef83('0x48')],null))['then'](respondWithResult(_0x3b7e69,null))['catch'](handleError(_0x3b7e69,null));};exports[_0xef83('0x4a')]=function(_0x462cc6,_0x35f113){return db[_0xef83('0x2d')]['find']({'where':{'id':_0x462cc6[_0xef83('0x44')]['id']}})[_0xef83('0x26')](handleEntityNotFound(_0x35f113,null))['then'](removeEntity(_0x35f113,null))[_0xef83('0x46')](handleError(_0x35f113,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f14a8b8..89cb50c 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 _0x57c8=['voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0xff8a01,_0x480b8a){var _0x1bda8f=function(_0x5190f4){while(--_0x5190f4){_0xff8a01['push'](_0xff8a01['shift']());}};_0x1bda8f(++_0x480b8a);}(_0x57c8,0xa9));var _0x857c=function(_0x3d62b2,_0x3dae5b){_0x3d62b2=_0x3d62b2-0x0;var _0x5467dc=_0x57c8[_0x3d62b2];return _0x5467dc;};'use strict';var _=require(_0x857c('0x0'));var util=require('util');var logger=require(_0x857c('0x1'))('api');var moment=require(_0x857c('0x2'));var BPromise=require(_0x857c('0x3'));var rp=require(_0x857c('0x4'));var fs=require('fs');var path=require(_0x857c('0x5'));var rimraf=require(_0x857c('0x6'));var config=require('../../config/environment');var attributes=require(_0x857c('0x7'));module[_0x857c('0x8')]=function(_0x3d33b6,_0x475d4c){return _0x3d33b6[_0x857c('0x9')](_0x857c('0xa'),attributes,{'tableName':_0x857c('0xb'),'paranoid':![],'indexes':[{'name':_0x857c('0xc'),'fields':[_0x857c('0xd'),_0x857c('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0811=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0xe4637e,_0x510f3f){var _0x1156e6=function(_0x549c53){while(--_0x549c53){_0xe4637e['push'](_0xe4637e['shift']());}};_0x1156e6(++_0x510f3f);}(_0x0811,0xb3));var _0x1081=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0x0811[_0x248d46];return _0x354942;};'use strict';var _=require(_0x1081('0x0'));var util=require(_0x1081('0x1'));var logger=require(_0x1081('0x2'))(_0x1081('0x3'));var moment=require(_0x1081('0x4'));var BPromise=require(_0x1081('0x5'));var rp=require(_0x1081('0x6'));var fs=require('fs');var path=require(_0x1081('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1081('0x8'));module['exports']=function(_0x4c332a,_0xdb1f60){return _0x4c332a[_0x1081('0x9')](_0x1081('0xa'),attributes,{'tableName':_0x1081('0xb'),'paranoid':![],'indexes':[{'name':_0x1081('0xc'),'fields':[_0x1081('0xd'),_0x1081('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8db3d44..678c7a2 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 _0x9efb=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4a4afc,_0x41118e){var _0x4b5d4f=function(_0x39fac2){while(--_0x39fac2){_0x4a4afc['push'](_0x4a4afc['shift']());}};_0x4b5d4f(++_0x41118e);}(_0x9efb,0x143));var _0xb9ef=function(_0xe3b880,_0x3f33a4){_0xe3b880=_0xe3b880-0x0;var _0x2c5564=_0x9efb[_0xe3b880];return _0x2c5564;};'use strict';var _=require('lodash');var util=require(_0xb9ef('0x0'));var moment=require(_0xb9ef('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9ef('0x2'));var fs=require('fs');var Redis=require(_0xb9ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9ef('0x4'));var logger=require(_0xb9ef('0x5'))(_0xb9ef('0x6'));var config=require(_0xb9ef('0x7'));var jayson=require(_0xb9ef('0x8'));var client=jayson[_0xb9ef('0x9')][_0xb9ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c252f,_0x5315ba,_0x856939){return new BPromise(function(_0x537a75,_0x5d522f){return client[_0xb9ef('0xb')](_0x4c252f,_0x856939)[_0xb9ef('0xc')](function(_0x38442e){logger[_0xb9ef('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5315ba,_0xb9ef('0xe'));logger[_0xb9ef('0xf')](_0xb9ef('0x10'),_0x5315ba,_0xb9ef('0xe'),JSON['stringify'](_0x38442e));if(_0x38442e[_0xb9ef('0x11')]){if(_0x38442e[_0xb9ef('0x11')][_0xb9ef('0x12')]===0x1f4){logger[_0xb9ef('0x11')](_0xb9ef('0x13'),_0x5315ba,_0x38442e[_0xb9ef('0x11')][_0xb9ef('0x14')]);return _0x5d522f(_0x38442e[_0xb9ef('0x11')][_0xb9ef('0x14')]);}logger[_0xb9ef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5315ba,_0x38442e[_0xb9ef('0x11')][_0xb9ef('0x14')]);return _0x537a75(_0x38442e['error']['message']);}else{logger[_0xb9ef('0xd')](_0xb9ef('0x13'),_0x5315ba,_0xb9ef('0xe'));_0x537a75(_0x38442e[_0xb9ef('0x15')]['message']);}})['catch'](function(_0x56ef9b){logger[_0xb9ef('0x11')](_0xb9ef('0x13'),_0x5315ba,_0x56ef9b);_0x5d522f(_0x56ef9b);});});} \ No newline at end of file +var _0x155d=['code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x155d,0x89));var _0xd155=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x155d[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xd155('0x0'));var util=require(_0xd155('0x1'));var moment=require(_0xd155('0x2'));var BPromise=require(_0xd155('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd155('0x4'));var db=require(_0xd155('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd155('0x6'));var client=jayson[_0xd155('0x7')][_0xd155('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c6d0,_0x1f0b0a,_0x102bb6){return new BPromise(function(_0x463e8e,_0xca5358){return client[_0xd155('0x9')](_0x16c6d0,_0x102bb6)[_0xd155('0xa')](function(_0x5355b0){logger[_0xd155('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f0b0a,_0xd155('0xc'));logger[_0xd155('0xd')](_0xd155('0xe'),_0x1f0b0a,_0xd155('0xc'),JSON[_0xd155('0xf')](_0x5355b0));if(_0x5355b0[_0xd155('0x10')]){if(_0x5355b0[_0xd155('0x10')][_0xd155('0x11')]===0x1f4){logger[_0xd155('0x10')](_0xd155('0x12'),_0x1f0b0a,_0x5355b0[_0xd155('0x10')][_0xd155('0x13')]);return _0xca5358(_0x5355b0['error'][_0xd155('0x13')]);}logger[_0xd155('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f0b0a,_0x5355b0['error'][_0xd155('0x13')]);return _0x463e8e(_0x5355b0['error']['message']);}else{logger[_0xd155('0xb')](_0xd155('0x12'),_0x1f0b0a,_0xd155('0xc'));_0x463e8e(_0x5355b0[_0xd155('0x14')][_0xd155('0x13')]);}})[_0xd155('0x15')](function(_0x111445){logger[_0xd155('0x10')](_0xd155('0x12'),_0x1f0b0a,_0x111445);_0xca5358(_0x111445);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a7846d5..f782aad 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 _0x9a66=['../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a66,0x103));var _0x69a6=function(_0xc0f540,_0x46cfb3){_0xc0f540=_0xc0f540-0x0;var _0x3edbec=_0x9a66[_0xc0f540];return _0x3edbec;};'use strict';var multer=require('multer');var util=require(_0x69a6('0x0'));var path=require(_0x69a6('0x1'));var timeout=require(_0x69a6('0x2'));var express=require(_0x69a6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x69a6('0x4'));var config=require(_0x69a6('0x5'));var controller=require(_0x69a6('0x6'));router['get']('/',auth[_0x69a6('0x7')](),controller[_0x69a6('0x8')]);router[_0x69a6('0x9')](_0x69a6('0xa'),auth[_0x69a6('0x7')](),controller['describe']);router['get'](_0x69a6('0xb'),auth['isAuthenticated'](),controller[_0x69a6('0xc')]);router[_0x69a6('0x9')](_0x69a6('0xd'),auth[_0x69a6('0x7')](),controller[_0x69a6('0xe')]);router['get'](_0x69a6('0xf'),controller['downloads']);router[_0x69a6('0x9')](_0x69a6('0x10'),auth[_0x69a6('0x7')](),controller[_0x69a6('0x11')]);router[_0x69a6('0x12')]('/',auth[_0x69a6('0x7')](),controller['create']);router[_0x69a6('0x12')]('/:id/transcribe',auth[_0x69a6('0x7')](),controller[_0x69a6('0x13')]);router['put'](_0x69a6('0xb'),auth[_0x69a6('0x7')](),controller['update']);router[_0x69a6('0x14')](_0x69a6('0xb'),auth['isAuthenticated'](),controller[_0x69a6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb0dc=['create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','/:id','/:id/download','download','/:id/transcribe','downloadTranscribe','post'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xb0dc,0x1b7));var _0xcb0d=function(_0x15a9cc,_0x52ca30){_0x15a9cc=_0x15a9cc-0x0;var _0x387120=_0xb0dc[_0x15a9cc];return _0x387120;};'use strict';var multer=require(_0xcb0d('0x0'));var util=require(_0xcb0d('0x1'));var path=require(_0xcb0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb0d('0x3'));var router=express[_0xcb0d('0x4')]();var fs_extra=require(_0xcb0d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcb0d('0x6'));var controller=require(_0xcb0d('0x7'));router[_0xcb0d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb0d('0x8')](_0xcb0d('0x9'),auth[_0xcb0d('0xa')](),controller['describe']);router[_0xcb0d('0x8')](_0xcb0d('0xb'),auth[_0xcb0d('0xa')](),controller['show']);router['get'](_0xcb0d('0xc'),auth[_0xcb0d('0xa')](),controller[_0xcb0d('0xd')]);router[_0xcb0d('0x8')]('/:id/downloads',controller['downloads']);router['get'](_0xcb0d('0xe'),auth[_0xcb0d('0xa')](),controller[_0xcb0d('0xf')]);router[_0xcb0d('0x10')]('/',auth['isAuthenticated'](),controller[_0xcb0d('0x11')]);router[_0xcb0d('0x10')](_0xcb0d('0xe'),auth[_0xcb0d('0xa')](),controller[_0xcb0d('0x12')]);router[_0xcb0d('0x13')](_0xcb0d('0xb'),auth[_0xcb0d('0xa')](),controller[_0xcb0d('0x14')]);router[_0xcb0d('0x15')]('/:id',auth[_0xcb0d('0xa')](),controller[_0xcb0d('0x16')]);module[_0xcb0d('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b541e8d..9c36a35 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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 12394c9..c8cd15d 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 _0x707a=['updateAttributes','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','map','format','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','extname','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','IN_PROGRESS','tempSentiment'];(function(_0x7e8278,_0x28e032){var _0x1e5aa6=function(_0x29c715){while(--_0x29c715){_0x7e8278['push'](_0x7e8278['shift']());}};_0x1e5aa6(++_0x28e032);}(_0x707a,0x9d));var _0xa707=function(_0x12f207,_0x23e709){_0x12f207=_0x12f207-0x0;var _0x2486e6=_0x707a[_0x12f207];return _0x2486e6;};'use strict';var emlformat=require(_0xa707('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa707('0x1'));var moment=require(_0xa707('0x2'));var BPromise=require(_0xa707('0x3'));var Mustache=require(_0xa707('0x4'));var util=require(_0xa707('0x5'));var path=require('path');var sox=require(_0xa707('0x6'));var csv=require('to-csv');var ejs=require(_0xa707('0x7'));var fs=require('fs');var fs_extra=require(_0xa707('0x8'));var _=require(_0xa707('0x9'));var squel=require(_0xa707('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa707('0xb'));var toCsv=require(_0xa707('0xc'));var querystring=require(_0xa707('0xd'));var Papa=require(_0xa707('0xe'));var AWS=require(_0xa707('0xf'));var uuidv4=require(_0xa707('0x10'));var Redis=require('ioredis');var authService=require(_0xa707('0x11'));var qs=require(_0xa707('0x12'));var as=require(_0xa707('0x13'));var hardwareService=require(_0xa707('0x14'));var logger=require(_0xa707('0x15'))(_0xa707('0x16'));var utils=require('../../config/utils');var config=require(_0xa707('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa707('0x18'))['db'];function respondWithStatusCode(_0x2f400c,_0x13f829){_0x13f829=_0x13f829||0xcc;return function(_0x5782a0){if(_0x5782a0){return _0x2f400c[_0xa707('0x19')](_0x13f829);}return _0x2f400c['status'](_0x13f829)[_0xa707('0x1a')]();};}function respondWithResult(_0x499f00,_0x424910){_0x424910=_0x424910||0xc8;return function(_0x9cb6f){if(_0x9cb6f){return _0x499f00[_0xa707('0x1b')](_0x424910)[_0xa707('0x1c')](_0x9cb6f);}};}function respondWithFilteredResult(_0x3b2b4d,_0xc88c31){return function(_0x22bf0a){if(_0x22bf0a){var _0x44fc62=typeof _0xc88c31[_0xa707('0x1d')]==='undefined'&&typeof _0xc88c31[_0xa707('0x1e')]===_0xa707('0x1f');var _0x12f0fe=_0x22bf0a[_0xa707('0x20')];var _0x549430=_0x44fc62?0x0:_0xc88c31[_0xa707('0x1d')];var _0x5f169a=_0x44fc62?_0x22bf0a[_0xa707('0x20')]:_0xc88c31[_0xa707('0x1d')]+_0xc88c31['limit'];var _0x5d2444;if(_0x5f169a>=_0x12f0fe){_0x5f169a=_0x12f0fe;_0x5d2444=0xc8;}else{_0x5d2444=0xce;}_0x3b2b4d['status'](_0x5d2444);return _0x3b2b4d[_0xa707('0x21')](_0xa707('0x22'),_0x549430+'-'+_0x5f169a+'/'+_0x12f0fe)[_0xa707('0x1c')](_0x22bf0a);}return null;};}function patchUpdates(_0x2b23de){return function(_0x2b15e7){try{jsonpatch[_0xa707('0x23')](_0x2b15e7,_0x2b23de,!![]);}catch(_0x5d232a){return BPromise[_0xa707('0x24')](_0x5d232a);}return _0x2b15e7[_0xa707('0x25')]();};}function saveUpdates(_0x11a43b,_0x235845){return function(_0x10279e){if(_0x10279e){return _0x10279e[_0xa707('0x26')](_0x11a43b)['then'](function(_0x11ba0e){return _0x11ba0e;});}return null;};}function removeEntity(_0x491838,_0x3bdbf8){return function(_0x473652){if(_0x473652){return _0x473652[_0xa707('0x27')]()[_0xa707('0x28')](function(){_0x491838['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x758d39,_0x5706b6){return function(_0x521e60){if(!_0x521e60){_0x758d39[_0xa707('0x19')](0x194);}return _0x521e60;};}function handleError(_0x2c0ce,_0x4f0c48){_0x4f0c48=_0x4f0c48||0x1f4;return function(_0x5b251b){logger[_0xa707('0x29')](_0x5b251b['stack']);if(_0x5b251b[_0xa707('0x2a')]){delete _0x5b251b[_0xa707('0x2a')];}_0x2c0ce[_0xa707('0x1b')](_0x4f0c48)[_0xa707('0x2b')](_0x5b251b);};}exports[_0xa707('0x2c')]=function(_0x591cb7,_0x1351f8){var _0x49b33b={},_0x5c49c9={},_0x3e0c4a={'count':0x0,'rows':[]};var _0x210e8e=_['map'](db[_0xa707('0x2d')][_0xa707('0x2e')],function(_0x427179){return{'name':_0x427179[_0xa707('0x2f')],'type':_0x427179[_0xa707('0x30')][_0xa707('0x31')]};});_0x5c49c9[_0xa707('0x32')]=_['differenceBy'](_[_0xa707('0x33')](_0x210e8e,'name'),[_0xa707('0x34')]);_0x5c49c9[_0xa707('0x35')]=_[_0xa707('0x36')](_0x591cb7[_0xa707('0x35')]);_0x5c49c9['filters']=_['intersection'](_0x5c49c9[_0xa707('0x32')],_0x5c49c9['query']);_0x49b33b[_0xa707('0x37')]=_['intersection'](_0x5c49c9['model'],qs[_0xa707('0x38')](_0x591cb7[_0xa707('0x35')]['fields']));_0x49b33b[_0xa707('0x37')]=_0x49b33b[_0xa707('0x37')][_0xa707('0x39')]?_0x49b33b['attributes']:_0x5c49c9[_0xa707('0x32')];if(!_0x591cb7[_0xa707('0x35')][_0xa707('0x3a')](_0xa707('0x3b'))){_0x49b33b[_0xa707('0x1e')]=qs[_0xa707('0x1e')](_0x591cb7[_0xa707('0x35')][_0xa707('0x1e')]);_0x49b33b[_0xa707('0x1d')]=qs[_0xa707('0x1d')](_0x591cb7['query'][_0xa707('0x1d')]);}_0x49b33b['order']=qs['sort'](_0x591cb7[_0xa707('0x35')][_0xa707('0x3c')]);_0x49b33b['where']=qs[_0xa707('0x3d')](_[_0xa707('0x3e')](_0x591cb7[_0xa707('0x35')],_0x5c49c9[_0xa707('0x3d')]),_0x210e8e);if(_0x591cb7[_0xa707('0x35')][_0xa707('0x3f')]){_0x49b33b[_0xa707('0x40')]=_[_0xa707('0x41')](_0x49b33b['where'],{'$or':_[_0xa707('0x33')](_0x210e8e,function(_0x2540f4){if(_0x2540f4[_0xa707('0x30')]!==_0xa707('0x42')){var _0x4780c1={};_0x4780c1[_0x2540f4['name']]={'$like':'%'+_0x591cb7[_0xa707('0x35')]['filter']+'%'};return _0x4780c1;}})});}_0x49b33b=_['merge']({},_0x49b33b,_0x591cb7[_0xa707('0x43')]);var _0x37ac06={'where':_0x49b33b[_0xa707('0x40')]};return db[_0xa707('0x2d')][_0xa707('0x20')](_0x37ac06)['then'](function(_0x5bda20){_0x3e0c4a[_0xa707('0x20')]=_0x5bda20;if(_0x591cb7['query'][_0xa707('0x44')]){_0x49b33b['include']=[{'all':!![]}];}return db[_0xa707('0x2d')][_0xa707('0x45')](_0x49b33b);})[_0xa707('0x28')](function(_0x14f22c){_0x3e0c4a[_0xa707('0x46')]=_0x14f22c;return _0x3e0c4a;})[_0xa707('0x28')](respondWithFilteredResult(_0x1351f8,_0x49b33b))[_0xa707('0x47')](handleError(_0x1351f8,null));};exports[_0xa707('0x48')]=function(_0x3aa49e,_0x93cd2f){var _0x10f92b={'raw':![],'where':{'id':_0x3aa49e[_0xa707('0x49')]['id']}},_0x25ec2c={};_0x25ec2c[_0xa707('0x32')]=_['keys'](db['VoiceRecording'][_0xa707('0x2e')]);_0x25ec2c[_0xa707('0x35')]=_[_0xa707('0x36')](_0x3aa49e[_0xa707('0x35')]);_0x25ec2c[_0xa707('0x3d')]=_[_0xa707('0x4a')](_0x25ec2c[_0xa707('0x32')],_0x25ec2c[_0xa707('0x35')]);_0x10f92b[_0xa707('0x37')]=_['intersection'](_0x25ec2c[_0xa707('0x32')],qs['fields'](_0x3aa49e[_0xa707('0x35')]['fields']));_0x10f92b['attributes']=_0x10f92b[_0xa707('0x37')][_0xa707('0x39')]?_0x10f92b['attributes']:_0x25ec2c[_0xa707('0x32')];if(_0x3aa49e[_0xa707('0x35')][_0xa707('0x44')]){_0x10f92b[_0xa707('0x4b')]=[{'all':!![]}];}_0x10f92b=_['merge']({},_0x10f92b,_0x3aa49e[_0xa707('0x43')]);return db['VoiceRecording'][_0xa707('0x4c')](_0x10f92b)['then'](handleEntityNotFound(_0x93cd2f,null))[_0xa707('0x28')](respondWithResult(_0x93cd2f,null))[_0xa707('0x47')](handleError(_0x93cd2f,null));};exports[_0xa707('0x4d')]=function(_0x4e2e02,_0x5447a2){return db[_0xa707('0x2d')][_0xa707('0x4d')](_0x4e2e02[_0xa707('0x4e')],{})[_0xa707('0x28')](respondWithResult(_0x5447a2,0xc9))[_0xa707('0x47')](handleError(_0x5447a2,null));};exports[_0xa707('0x26')]=function(_0x1314b1,_0x43602b){if(_0x1314b1[_0xa707('0x4e')]['id']){delete _0x1314b1[_0xa707('0x4e')]['id'];}return db[_0xa707('0x2d')][_0xa707('0x4c')]({'where':{'id':_0x1314b1['params']['id']}})['then'](handleEntityNotFound(_0x43602b,null))[_0xa707('0x28')](saveUpdates(_0x1314b1[_0xa707('0x4e')],null))['then'](respondWithResult(_0x43602b,null))[_0xa707('0x47')](handleError(_0x43602b,null));};exports[_0xa707('0x4f')]=function(_0x31e8f2,_0x3294ed){return db[_0xa707('0x2d')]['describe']()[_0xa707('0x28')](respondWithResult(_0x3294ed,null))['catch'](handleError(_0x3294ed,null));};exports['download']=function(_0x44775b,_0x1f1398,_0x3e9b30){var _0x13386d=require('../../components/encryptor');var _0x44667d=![];var _0x268708={};if(_0x44775b[_0xa707('0x35')]['type']&&_0x44775b[_0xa707('0x35')]['type']===_0xa707('0x50')){_0x268708[_0xa707('0x50')]=_0x44775b[_0xa707('0x49')]['id'];}else{_0x268708['id']=_0x44775b[_0xa707('0x49')]['id'];}return db[_0xa707('0x2d')][_0xa707('0x4c')]({'where':_0x268708,'attributes':['id','value'],'raw':!![]})[_0xa707('0x28')](handleEntityNotFound(_0x1f1398,null))[_0xa707('0x28')](function(_0x94d72e){if(_0x94d72e){var _0x38e26f=_0x94d72e[_0xa707('0x51')];var _0x50ad68=util[_0xa707('0x34')](_0xa707('0x52'),_0x38e26f);if(fs[_0xa707('0x53')](_0x50ad68)){_0x44667d=!![];return _0x13386d[_0xa707('0x54')](_0x50ad68,_0x38e26f,config[_0xa707('0x55')][_0xa707('0x56')])['then'](function(){return _0x94d72e;});}return _0x94d72e;}})['then'](function(_0x11dcd6){if(_0x11dcd6){var _0x5bc9e9=_0x11dcd6[_0xa707('0x51')];if(!fs[_0xa707('0x53')](_0x5bc9e9)){throw new db[(_0xa707('0x57'))][(_0xa707('0x58'))](_0xa707('0x59'));}if(_0x11dcd6[_0xa707('0x5a')]){return _0x1f1398[_0xa707('0x5b')](_0x5bc9e9,_0x11dcd6[_0xa707('0x5a')]+path['extname'](_0x5bc9e9),function(){if(_0x44667d){fs[_0xa707('0x5c')](_0x5bc9e9);}});}else{return _0x1f1398[_0xa707('0x5b')](_0x5bc9e9,function(_0x2950d9){if(_0x44667d){fs[_0xa707('0x5c')](_0x5bc9e9);}});}}})[_0xa707('0x47')](function(_0x231e4d){if(_0x231e4d[_0xa707('0x5d')]===_0xa707('0x59')){_0x1f1398['status'](0x194)[_0xa707('0x2b')](_0xa707('0x5e'));}else{return handleError(_0x1f1398,null);}});};exports[_0xa707('0x5f')]=function(_0x49f33c,_0x5b99fd,_0x42a3df){var _0xc1cd2d=require('../../components/encryptor');var _0x35031b=![];var _0x5ce199={'$and':[db[_0xa707('0x60')][_0xa707('0x40')](db[_0xa707('0x60')]['fn'](_0xa707('0x61'),db[_0xa707('0x60')][_0xa707('0x62')](_0xa707('0x50'))),_0x49f33c['query']['token'])]};if(_0x49f33c[_0xa707('0x35')][_0xa707('0x30')]&&_0x49f33c[_0xa707('0x35')]['type']===_0xa707('0x50')){_0x5ce199[_0xa707('0x63')][_0xa707('0x64')]({'uniqueid':_0x49f33c['params']['id']});}else{_0x5ce199[_0xa707('0x63')]['push']({'id':_0x49f33c[_0xa707('0x49')]['id']});}return db[_0xa707('0x2d')][_0xa707('0x4c')]({'where':_0x5ce199,'attributes':['id',_0xa707('0x51')],'raw':!![]})[_0xa707('0x28')](handleEntityNotFound(_0x5b99fd,null))[_0xa707('0x28')](function(_0x42b836){if(_0x42b836){var _0x1bf204=util['format'](_0xa707('0x52'),_0x42b836['value']);if(fs[_0xa707('0x53')](_0x1bf204)){_0x35031b=!![];return _0xc1cd2d['decryptFile'](_0x1bf204,_0x42b836[_0xa707('0x51')],config[_0xa707('0x55')]['recording'])[_0xa707('0x28')](function(){return _0x42b836;});}return _0x42b836;}})[_0xa707('0x28')](function(_0x4a826a){if(_0x4a826a){if(!fs[_0xa707('0x53')](_0x4a826a[_0xa707('0x51')])){throw new db[(_0xa707('0x57'))][(_0xa707('0x58'))](_0xa707('0x59'));}if(_0x4a826a[_0xa707('0x5a')]){return _0x5b99fd[_0xa707('0x5b')](_0x4a826a[_0xa707('0x51')],_0x4a826a[_0xa707('0x5a')]+path[_0xa707('0x65')](_0x4a826a[_0xa707('0x51')]),function(){if(_0x35031b){fs[_0xa707('0x5c')](_0x4a826a[_0xa707('0x51')]);}});}else{return _0x5b99fd[_0xa707('0x5b')](_0x4a826a[_0xa707('0x51')],function(_0x1030a6){if(_0x35031b){fs['unlink'](_0x4a826a[_0xa707('0x51')]);}});}}})['catch'](handleError(_0x5b99fd,null));};exports[_0xa707('0x27')]=function(_0x511c7b,_0x51e24f){return db[_0xa707('0x2d')][_0xa707('0x4c')]({'where':{'id':_0x511c7b[_0xa707('0x49')]['id']}})['then'](function(_0x4169b3){if(_[_0xa707('0x66')](_0x4169b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4169b3;})[_0xa707('0x28')](function(_0x52fb68){var _0x1d6037=_0x52fb68['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1d6037);if(!_[_0xa707('0x66')](_0x52fb68['value'])&&fs[_0xa707('0x53')](_0x1d6037)){logger[_0xa707('0x67')](_0xa707('0x68')+_0x1d6037+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1d6037);}_0x1d6037=_0x1d6037+_0xa707('0x69');if(!_[_0xa707('0x66')](_0x52fb68[_0xa707('0x51')])&&fs[_0xa707('0x53')](_0x1d6037)){logger[_0xa707('0x67')]('File:\x20\x22'+_0x1d6037+_0xa707('0x6a'));fs[_0xa707('0x6b')](_0x1d6037);}return _0x52fb68;})[_0xa707('0x28')](function(_0x531eb3){if(!_0x531eb3)throw new InternalError();return _0x531eb3[_0xa707('0x27')]();})[_0xa707('0x28')](function(){_0x51e24f[_0xa707('0x1b')](0xcc)[_0xa707('0x1a')]();})['catch'](handleError(_0x51e24f,null));};function getBucketslist(_0x155e3c,_0x87d9ee,_0x27929f){return new Promise(function(_0x40b291,_0x4f4f0f){var _0x57224c=new AWS['S3']({'accessKeyId':_0x87d9ee,'secretAccessKey':_0x155e3c,'region':_0x27929f});_0x57224c[_0xa707('0x6c')]({},function(_0x3d12ac,_0x206a73){if(_0x3d12ac){return _0x4f4f0f(_0x3d12ac);}else{return _0x40b291(_0x206a73);}});});}function createBucket(_0x21967a,_0x25aec4,_0xcbca73,_0x54617a){return new Promise(function(_0x316d3b,_0x1254cd){var _0x36edc2=new AWS['S3']({'accessKeyId':_0x25aec4,'secretAccessKey':_0x21967a,'region':_0xcbca73});_0x36edc2['createBucket']({'Bucket':_0x54617a},function(_0xa0104e,_0x35f5d5){if(_0xa0104e){return _0x1254cd(_0xa0104e);}else{return _0x316d3b(_0x35f5d5);}});});}function uploadFile(_0x1460ca,_0xfbbc32,_0x38dd3c,_0x56b6b2,_0x2ad551,_0x2d1c5f){return new Promise(function(_0xb339cb,_0x4fbf7d){var _0x55c722=new AWS['S3']({'accessKeyId':_0xfbbc32,'secretAccessKey':_0x1460ca,'region':_0x38dd3c});_0x55c722[_0xa707('0x6d')]({'Bucket':_0x56b6b2,'Key':_0x2ad551,'Body':_0x2d1c5f},function(_0x26a439,_0x2a5000){if(_0x26a439){return _0x4fbf7d(_0x26a439);}else{return _0xb339cb(_0x2a5000);}});});}function startTranscribe(_0x4ab3c4,_0x54b007,_0x5cb868,_0x325805,_0x1070b2,_0x362cc9){return new Promise(function(_0x4444a3,_0xc1a7b){var _0x32dae2=new AWS[(_0xa707('0x6e'))]({'accessKeyId':_0x54b007,'secretAccessKey':_0x4ab3c4,'region':_0x5cb868});_0x32dae2['startTranscriptionJob']({'TranscriptionJobName':_0x325805,'LanguageCode':_0x1070b2,'Media':{'MediaFileUri':_0x362cc9}},function(_0x4e0e7f,_0x508ab5){if(_0x4e0e7f){return _0xc1a7b(_0x4e0e7f);}else{return _0x4444a3(_0x508ab5);}});});}function transcribe(_0x379b38,_0x30a2e6,_0x3de51f,_0x537198,_0x444cd2,_0x3399e1,_0x5b2305){return new Promise(function(_0x3bd35a,_0xbe541b){var _0x2c3647={};logger[_0xa707('0x67')](util[_0xa707('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x379b38,_0x444cd2));return uploadFile(_0x30a2e6,_0x3de51f,_0x537198,_0x444cd2,path[_0xa707('0x6f')](_0x3399e1),fs['readFileSync'](_0x3399e1))[_0xa707('0x28')](function(_0xd25a10){logger[_0xa707('0x67')](util[_0xa707('0x34')](_0xa707('0x70'),_0x379b38,_0x444cd2,_0xd25a10['Location']));_0x2c3647[_0xa707('0x71')]=_0xd25a10['Bucket'];_0x2c3647[_0xa707('0x72')]=_0xd25a10[_0xa707('0x73')];logger[_0xa707('0x67')](util[_0xa707('0x34')](_0xa707('0x74'),_0x379b38));return startTranscribe(_0x30a2e6,_0x3de51f,_0x537198,uuidv4(),_0x5b2305,_0xd25a10[_0xa707('0x73')]);})[_0xa707('0x28')](function(_0x208dcd){logger[_0xa707('0x67')](util['format'](_0xa707('0x75'),_0x379b38,_0x208dcd[_0xa707('0x76')][_0xa707('0x77')]));_0x2c3647[_0xa707('0x78')]=_0x208dcd['TranscriptionJob'][_0xa707('0x77')];_0x2c3647[_0xa707('0x79')]=_0x208dcd[_0xa707('0x76')][_0xa707('0x7a')];return _0x3bd35a(_0x2c3647);})['catch'](function(_0xe6bac4){return _0xbe541b(_0xe6bac4);});});}exports[_0xa707('0x7b')]=function(_0x2781b6,_0x4cfaae,_0x312fe9){var _0x5a6a58;var _0x257385;var _0x14f6de;var _0x1b1e90=require(_0xa707('0x7c'));return db['VoiceRecording']['findOne']({'where':{'id':_0x2781b6[_0xa707('0x49')]['id']}})[_0xa707('0x28')](function(_0x1cedfb){if(_0x1cedfb){var _0x3a060d=util[_0xa707('0x34')](_0xa707('0x52'),_0x1cedfb[_0xa707('0x51')]);if(fs[_0xa707('0x53')](_0x3a060d)){cypher=!![];return _0x1b1e90[_0xa707('0x54')](_0x3a060d,_0x1cedfb[_0xa707('0x51')],config[_0xa707('0x55')]['recording'])['then'](function(){return _0x1cedfb;});}return _0x1cedfb;}})[_0xa707('0x28')](function(_0x23f42e){if(!_0x23f42e){throw new db[(_0xa707('0x57'))][(_0xa707('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x257385=_0x23f42e;return db['Setting'][_0xa707('0x7d')]({'where':{'id':0x1}});})[_0xa707('0x28')](handleEntityNotFound(_0x4cfaae,null))[_0xa707('0x28')](function(_0x55b114){if(_0x55b114){_0x5a6a58=_0x55b114;if(!_0x5a6a58[_0xa707('0x7e')]||!_0x5a6a58[_0xa707('0x7f')]||!_0x5a6a58[_0xa707('0x80')]||!_0x5a6a58[_0xa707('0x81')]||!_0x5a6a58[_0xa707('0x71')]){throw new db[(_0xa707('0x57'))]['ValidationError'](_0xa707('0x82'));}if(_0x2781b6[_0xa707('0x4e')][_0xa707('0x83')]&&(!_0x5a6a58['sentiment']||!_0x5a6a58[_0xa707('0x84')]||!_0x5a6a58[_0xa707('0x85')]||!_0x5a6a58[_0xa707('0x81')]||!_0x5a6a58['bucket'])){throw new db[(_0xa707('0x57'))]['ValidationError'](_0xa707('0x86'));}return db[_0xa707('0x87')][_0xa707('0x7d')]({'where':{'id':_0x5a6a58[_0xa707('0x7f')]}});}})['then'](function(_0x199c03){if(!_0x199c03){throw new db[(_0xa707('0x57'))][(_0xa707('0x58'))](_0xa707('0x88'));}if(!_0x199c03[_0xa707('0x89')]||!_0x199c03[_0xa707('0x8a')]){throw new db['Sequelize'][(_0xa707('0x58'))](_0xa707('0x8b'));}_0x14f6de=_0x199c03;return getBucketslist(_0x14f6de[_0xa707('0x89')],_0x14f6de[_0xa707('0x8a')],_0x5a6a58[_0xa707('0x80')]);})['then'](function(_0x4aa826){if(_0x4aa826&&_0x4aa826[_0xa707('0x8c')]){var _0x48454c=_[_0xa707('0x4c')](_0x4aa826[_0xa707('0x8c')],function(_0x27afc9){return _0x27afc9[_0xa707('0x8d')]===_0x5a6a58[_0xa707('0x71')];});if(!_0x48454c){logger[_0xa707('0x67')](util[_0xa707('0x34')](_0xa707('0x8e'),_0x2781b6[_0xa707('0x49')]['id'],_0x5a6a58['bucket']));return createBucket(_0x14f6de[_0xa707('0x89')],_0x14f6de[_0xa707('0x8a')],_0x5a6a58[_0xa707('0x80')],_0x5a6a58[_0xa707('0x71')]);}logger['info'](util[_0xa707('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2781b6[_0xa707('0x49')]['id'],_0x5a6a58[_0xa707('0x71')]));return;}})[_0xa707('0x28')](function(_0x2aa6bb){if(_0x257385[_0xa707('0x79')]==='NEW'){return transcribe(_0x2781b6[_0xa707('0x49')]['id'],_0x14f6de['data1'],_0x14f6de[_0xa707('0x8a')],_0x5a6a58[_0xa707('0x80')],_0x5a6a58['bucket'],_0x257385['value'],_0x5a6a58['language']);}else{logger[_0xa707('0x67')](util[_0xa707('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2781b6[_0xa707('0x49')]['id']));return{'transcribeStatus':_0xa707('0x8f')};}})[_0xa707('0x28')](function(_0x319bab){if(_0x319bab){_0x319bab[_0xa707('0x90')]=_0x2781b6['body'][_0xa707('0x83')];return _0x257385[_0xa707('0x91')](_0x319bab);}})[_0xa707('0x28')](respondWithResult(_0x4cfaae,null))[_0xa707('0x47')](handleError(_0x4cfaae,null));};function writeFile(_0x4f1242,_0x3109c1){return new Promise(function(_0x2ebb49,_0x54b0cf){fs['writeFile'](_0x3109c1,_0x4f1242,function(_0x2700dc,_0x437a5a){if(_0x2700dc){return _0x54b0cf(_0x2700dc);}else{return _0x2ebb49(_0x437a5a);}});});}exports[_0xa707('0x92')]=function(_0x2ad011,_0x1da10c,_0x288fb6){return db[_0xa707('0x2d')]['findOne']({'where':{'id':_0x2ad011['params']['id']}})['then'](handleEntityNotFound(_0x1da10c))[_0xa707('0x28')](function(_0x276a99){if(_0x276a99&&_0x276a99['fileText']){var _0x98d087=_0x276a99['fileText'];var _0xeb1318=config[_0xa707('0x93')]+_0xa707('0x94')+_0x276a99['id']+_0xa707('0x95');if(fs['existsSync'](_0xeb1318)){return _0xeb1318;}return writeFile(_0x98d087,_0xeb1318)['then'](function(){return _0xeb1318;});}else{throw new db[(_0xa707('0x57'))][(_0xa707('0x58'))](_0xa707('0x96'));}})['then'](function(_0x5ae47e){return _0x1da10c[_0xa707('0x5b')](_0x5ae47e);})['catch'](handleError(_0x1da10c));}; \ No newline at end of file +var _0xb069=['existsSync','secrets','recording','Sequelize','ValidationError','filename','download','unlink','message','VoiceRecording\x20not\x20found','send','downloads','sequelize','token','$and','push','%s.cypher','decryptFile','extname','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','keys','find','create','body','params','describe','../../components/encryptor','uniqueid','value'];(function(_0x3dcd37,_0xa0cb59){var _0x489d6e=function(_0xb55d76){while(--_0xb55d76){_0x3dcd37['push'](_0x3dcd37['shift']());}};_0x489d6e(++_0xa0cb59);}(_0xb069,0x179));var _0x9b06=function(_0x45ad35,_0x7d1f47){_0x45ad35=_0x45ad35-0x0;var _0x3a7865=_0xb069[_0x45ad35];return _0x3a7865;};'use strict';var emlformat=require(_0x9b06('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b06('0x1'));var rp=require(_0x9b06('0x2'));var moment=require(_0x9b06('0x3'));var BPromise=require(_0x9b06('0x4'));var Mustache=require(_0x9b06('0x5'));var util=require(_0x9b06('0x6'));var path=require(_0x9b06('0x7'));var sox=require(_0x9b06('0x8'));var csv=require(_0x9b06('0x9'));var ejs=require(_0x9b06('0xa'));var fs=require('fs');var fs_extra=require(_0x9b06('0xb'));var _=require('lodash');var squel=require(_0x9b06('0xc'));var crypto=require(_0x9b06('0xd'));var jsforce=require(_0x9b06('0xe'));var deskjs=require(_0x9b06('0xf'));var toCsv=require(_0x9b06('0x9'));var querystring=require(_0x9b06('0x10'));var Papa=require(_0x9b06('0x11'));var AWS=require(_0x9b06('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x9b06('0x13'));var authService=require(_0x9b06('0x14'));var qs=require(_0x9b06('0x15'));var as=require(_0x9b06('0x16'));var hardwareService=require(_0x9b06('0x17'));var logger=require(_0x9b06('0x18'))(_0x9b06('0x19'));var utils=require(_0x9b06('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9b06('0x1b'));var db=require(_0x9b06('0x1c'))['db'];function respondWithStatusCode(_0x1ef633,_0x18482c){_0x18482c=_0x18482c||0xcc;return function(_0x1d467e){if(_0x1d467e){return _0x1ef633[_0x9b06('0x1d')](_0x18482c);}return _0x1ef633[_0x9b06('0x1e')](_0x18482c)[_0x9b06('0x1f')]();};}function respondWithResult(_0x3e90c7,_0x493c7c){_0x493c7c=_0x493c7c||0xc8;return function(_0x138b91){if(_0x138b91){return _0x3e90c7['status'](_0x493c7c)['json'](_0x138b91);}};}function respondWithFilteredResult(_0x23bcc6,_0x269783){return function(_0x691b94){if(_0x691b94){var _0x4c6448=typeof _0x269783[_0x9b06('0x20')]===_0x9b06('0x21')&&typeof _0x269783['limit']===_0x9b06('0x21');var _0x5dd63f=_0x691b94['count'];var _0x5a5d4b=_0x4c6448?0x0:_0x269783[_0x9b06('0x20')];var _0x305283=_0x4c6448?_0x691b94[_0x9b06('0x22')]:_0x269783[_0x9b06('0x20')]+_0x269783[_0x9b06('0x23')];var _0x530541;if(_0x305283>=_0x5dd63f){_0x305283=_0x5dd63f;_0x530541=0xc8;}else{_0x530541=0xce;}_0x23bcc6[_0x9b06('0x1e')](_0x530541);return _0x23bcc6[_0x9b06('0x24')](_0x9b06('0x25'),_0x5a5d4b+'-'+_0x305283+'/'+_0x5dd63f)['json'](_0x691b94);}return null;};}function patchUpdates(_0x5467b1){return function(_0x3d33b7){try{jsonpatch[_0x9b06('0x26')](_0x3d33b7,_0x5467b1,!![]);}catch(_0x2b5a1f){return BPromise['reject'](_0x2b5a1f);}return _0x3d33b7[_0x9b06('0x27')]();};}function saveUpdates(_0x587e9a,_0x4e3fd0){return function(_0x4a5fe5){if(_0x4a5fe5){return _0x4a5fe5[_0x9b06('0x28')](_0x587e9a)['then'](function(_0x10a98a){return _0x10a98a;});}return null;};}function removeEntity(_0x5e7361,_0x2b5ad1){return function(_0x7379ef){if(_0x7379ef){return _0x7379ef[_0x9b06('0x29')]()[_0x9b06('0x2a')](function(){_0x5e7361[_0x9b06('0x1e')](0xcc)[_0x9b06('0x1f')]();});}};}function handleEntityNotFound(_0x3a028c,_0x588030){return function(_0x155a7d){if(!_0x155a7d){_0x3a028c[_0x9b06('0x1d')](0x194);}return _0x155a7d;};}function handleError(_0x164e44,_0x37dbad){_0x37dbad=_0x37dbad||0x1f4;return function(_0x4a2884){logger[_0x9b06('0x2b')](_0x4a2884[_0x9b06('0x2c')]);if(_0x4a2884[_0x9b06('0x2d')]){delete _0x4a2884[_0x9b06('0x2d')];}_0x164e44[_0x9b06('0x1e')](_0x37dbad)['send'](_0x4a2884);};}exports[_0x9b06('0x2e')]=function(_0x4e08c1,_0xcaf143){var _0x5fb205={},_0x2cad2d={},_0x1c045d={'count':0x0,'rows':[]};var _0x1e4210=_[_0x9b06('0x2f')](db[_0x9b06('0x30')][_0x9b06('0x31')],function(_0x564730){return{'name':_0x564730[_0x9b06('0x32')],'type':_0x564730[_0x9b06('0x33')][_0x9b06('0x34')]};});_0x2cad2d[_0x9b06('0x35')]=_[_0x9b06('0x36')](_['map'](_0x1e4210,_0x9b06('0x2d')),[_0x9b06('0x37')]);_0x2cad2d[_0x9b06('0x38')]=_['keys'](_0x4e08c1[_0x9b06('0x38')]);_0x2cad2d[_0x9b06('0x39')]=_['intersection'](_0x2cad2d[_0x9b06('0x35')],_0x2cad2d[_0x9b06('0x38')]);_0x5fb205[_0x9b06('0x3a')]=_[_0x9b06('0x3b')](_0x2cad2d['model'],qs[_0x9b06('0x3c')](_0x4e08c1[_0x9b06('0x38')][_0x9b06('0x3c')]));_0x5fb205['attributes']=_0x5fb205[_0x9b06('0x3a')][_0x9b06('0x3d')]?_0x5fb205['attributes']:_0x2cad2d[_0x9b06('0x35')];if(!_0x4e08c1[_0x9b06('0x38')]['hasOwnProperty']('nolimit')){_0x5fb205['limit']=qs[_0x9b06('0x23')](_0x4e08c1[_0x9b06('0x38')]['limit']);_0x5fb205[_0x9b06('0x20')]=qs[_0x9b06('0x20')](_0x4e08c1[_0x9b06('0x38')][_0x9b06('0x20')]);}_0x5fb205[_0x9b06('0x3e')]=qs[_0x9b06('0x3f')](_0x4e08c1[_0x9b06('0x38')]['sort']);_0x5fb205[_0x9b06('0x40')]=qs[_0x9b06('0x39')](_[_0x9b06('0x41')](_0x4e08c1[_0x9b06('0x38')],_0x2cad2d['filters']),_0x1e4210);if(_0x4e08c1[_0x9b06('0x38')][_0x9b06('0x42')]){_0x5fb205[_0x9b06('0x40')]=_['merge'](_0x5fb205[_0x9b06('0x40')],{'$or':_[_0x9b06('0x2f')](_0x1e4210,function(_0x101b4a){if(_0x101b4a['type']!==_0x9b06('0x43')){var _0x11e172={};_0x11e172[_0x101b4a['name']]={'$like':'%'+_0x4e08c1['query'][_0x9b06('0x42')]+'%'};return _0x11e172;}})});}_0x5fb205=_[_0x9b06('0x44')]({},_0x5fb205,_0x4e08c1[_0x9b06('0x45')]);var _0x2fb466={'where':_0x5fb205['where']};return db[_0x9b06('0x30')][_0x9b06('0x22')](_0x2fb466)[_0x9b06('0x2a')](function(_0x58b98e){_0x1c045d[_0x9b06('0x22')]=_0x58b98e;if(_0x4e08c1[_0x9b06('0x38')]['includeAll']){_0x5fb205[_0x9b06('0x46')]=[{'all':!![]}];}return db[_0x9b06('0x30')][_0x9b06('0x47')](_0x5fb205);})[_0x9b06('0x2a')](function(_0x56d064){_0x1c045d['rows']=_0x56d064;return _0x1c045d;})[_0x9b06('0x2a')](respondWithFilteredResult(_0xcaf143,_0x5fb205))[_0x9b06('0x48')](handleError(_0xcaf143,null));};exports['show']=function(_0x473fd0,_0x26e7c7){var _0x479863={'raw':![],'where':{'id':_0x473fd0['params']['id']}},_0x5e1691={};_0x5e1691[_0x9b06('0x35')]=_[_0x9b06('0x49')](db[_0x9b06('0x30')][_0x9b06('0x31')]);_0x5e1691['query']=_[_0x9b06('0x49')](_0x473fd0[_0x9b06('0x38')]);_0x5e1691['filters']=_[_0x9b06('0x3b')](_0x5e1691[_0x9b06('0x35')],_0x5e1691[_0x9b06('0x38')]);_0x479863['attributes']=_[_0x9b06('0x3b')](_0x5e1691['model'],qs['fields'](_0x473fd0[_0x9b06('0x38')][_0x9b06('0x3c')]));_0x479863[_0x9b06('0x3a')]=_0x479863[_0x9b06('0x3a')][_0x9b06('0x3d')]?_0x479863['attributes']:_0x5e1691['model'];if(_0x473fd0['query']['includeAll']){_0x479863[_0x9b06('0x46')]=[{'all':!![]}];}_0x479863=_[_0x9b06('0x44')]({},_0x479863,_0x473fd0['options']);return db[_0x9b06('0x30')][_0x9b06('0x4a')](_0x479863)[_0x9b06('0x2a')](handleEntityNotFound(_0x26e7c7,null))[_0x9b06('0x2a')](respondWithResult(_0x26e7c7,null))[_0x9b06('0x48')](handleError(_0x26e7c7,null));};exports[_0x9b06('0x4b')]=function(_0x2a25df,_0x3a355a){return db['VoiceRecording'][_0x9b06('0x4b')](_0x2a25df['body'],{})[_0x9b06('0x2a')](respondWithResult(_0x3a355a,0xc9))['catch'](handleError(_0x3a355a,null));};exports[_0x9b06('0x28')]=function(_0x340672,_0x1d8352){if(_0x340672[_0x9b06('0x4c')]['id']){delete _0x340672[_0x9b06('0x4c')]['id'];}return db[_0x9b06('0x30')]['find']({'where':{'id':_0x340672[_0x9b06('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d8352,null))[_0x9b06('0x2a')](saveUpdates(_0x340672[_0x9b06('0x4c')],null))[_0x9b06('0x2a')](respondWithResult(_0x1d8352,null))[_0x9b06('0x48')](handleError(_0x1d8352,null));};exports[_0x9b06('0x4e')]=function(_0x2dc15b,_0x4aecaf){return db[_0x9b06('0x30')][_0x9b06('0x4e')]()['then'](respondWithResult(_0x4aecaf,null))[_0x9b06('0x48')](handleError(_0x4aecaf,null));};exports['download']=function(_0x25ee69,_0x5518dc,_0x390484){var _0x184e12=require(_0x9b06('0x4f'));var _0x102500=![];var _0xa83924={};if(_0x25ee69[_0x9b06('0x38')]['type']&&_0x25ee69['query'][_0x9b06('0x33')]==='uniqueid'){_0xa83924[_0x9b06('0x50')]=_0x25ee69[_0x9b06('0x4d')]['id'];}else{_0xa83924['id']=_0x25ee69[_0x9b06('0x4d')]['id'];}return db[_0x9b06('0x30')]['find']({'where':_0xa83924,'attributes':['id',_0x9b06('0x51')],'raw':!![]})[_0x9b06('0x2a')](handleEntityNotFound(_0x5518dc,null))[_0x9b06('0x2a')](function(_0x53746b){if(_0x53746b){var _0x3046a5=_0x53746b[_0x9b06('0x51')];var _0x26de6f=util[_0x9b06('0x37')]('%s.cypher',_0x3046a5);if(fs[_0x9b06('0x52')](_0x26de6f)){_0x102500=!![];return _0x184e12['decryptFile'](_0x26de6f,_0x3046a5,config[_0x9b06('0x53')][_0x9b06('0x54')])[_0x9b06('0x2a')](function(){return _0x53746b;});}return _0x53746b;}})[_0x9b06('0x2a')](function(_0x4c5c98){if(_0x4c5c98){var _0x192630=_0x4c5c98[_0x9b06('0x51')];if(!fs[_0x9b06('0x52')](_0x192630)){throw new db[(_0x9b06('0x55'))][(_0x9b06('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4c5c98[_0x9b06('0x57')]){return _0x5518dc[_0x9b06('0x58')](_0x192630,_0x4c5c98[_0x9b06('0x57')]+path['extname'](_0x192630),function(){if(_0x102500){fs[_0x9b06('0x59')](_0x192630);}});}else{return _0x5518dc[_0x9b06('0x58')](_0x192630,function(_0x5ec6c5){if(_0x102500){fs[_0x9b06('0x59')](_0x192630);}});}}})[_0x9b06('0x48')](function(_0x810a83){if(_0x810a83[_0x9b06('0x5a')]===_0x9b06('0x5b')){_0x5518dc[_0x9b06('0x1e')](0x194)[_0x9b06('0x5c')]('Not\x20found');}else{return handleError(_0x5518dc,null);}});};exports[_0x9b06('0x5d')]=function(_0x3022e0,_0x355280,_0x36451a){var _0x40b2bd=require(_0x9b06('0x4f'));var _0x4d42b1=![];var _0x255f4b={'$and':[db[_0x9b06('0x5e')]['where'](db[_0x9b06('0x5e')]['fn']('MD5',db[_0x9b06('0x5e')]['col']('uniqueid')),_0x3022e0[_0x9b06('0x38')][_0x9b06('0x5f')])]};if(_0x3022e0[_0x9b06('0x38')]['type']&&_0x3022e0[_0x9b06('0x38')][_0x9b06('0x33')]===_0x9b06('0x50')){_0x255f4b[_0x9b06('0x60')]['push']({'uniqueid':_0x3022e0['params']['id']});}else{_0x255f4b[_0x9b06('0x60')][_0x9b06('0x61')]({'id':_0x3022e0[_0x9b06('0x4d')]['id']});}return db[_0x9b06('0x30')]['find']({'where':_0x255f4b,'attributes':['id',_0x9b06('0x51')],'raw':!![]})[_0x9b06('0x2a')](handleEntityNotFound(_0x355280,null))['then'](function(_0x567b98){if(_0x567b98){var _0x5d48cc=util[_0x9b06('0x37')](_0x9b06('0x62'),_0x567b98[_0x9b06('0x51')]);if(fs[_0x9b06('0x52')](_0x5d48cc)){_0x4d42b1=!![];return _0x40b2bd[_0x9b06('0x63')](_0x5d48cc,_0x567b98[_0x9b06('0x51')],config['secrets'][_0x9b06('0x54')])[_0x9b06('0x2a')](function(){return _0x567b98;});}return _0x567b98;}})['then'](function(_0x13e59b){if(_0x13e59b){if(!fs[_0x9b06('0x52')](_0x13e59b[_0x9b06('0x51')])){throw new db[(_0x9b06('0x55'))][(_0x9b06('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x13e59b[_0x9b06('0x57')]){return _0x355280['download'](_0x13e59b[_0x9b06('0x51')],_0x13e59b['filename']+path[_0x9b06('0x64')](_0x13e59b[_0x9b06('0x51')]),function(){if(_0x4d42b1){fs[_0x9b06('0x59')](_0x13e59b['value']);}});}else{return _0x355280[_0x9b06('0x58')](_0x13e59b[_0x9b06('0x51')],function(_0x3f38e2){if(_0x4d42b1){fs['unlink'](_0x13e59b[_0x9b06('0x51')]);}});}}})[_0x9b06('0x48')](handleError(_0x355280,null));};exports['destroy']=function(_0x3908ad,_0x157ed8){return db[_0x9b06('0x30')][_0x9b06('0x4a')]({'where':{'id':_0x3908ad[_0x9b06('0x4d')]['id']}})['then'](function(_0x735dae){if(_['isNil'](_0x735dae)){throw new ReferenceError(_0x9b06('0x65'));}return _0x735dae;})['then'](function(_0xca6751){var _0x459f95=_0xca6751[_0x9b06('0x51')];logger['info'](_0x9b06('0x66'),_0x459f95);if(!_[_0x9b06('0x67')](_0xca6751[_0x9b06('0x51')])&&fs['existsSync'](_0x459f95)){logger[_0x9b06('0x68')](_0x9b06('0x69')+_0x459f95+_0x9b06('0x6a'));fs[_0x9b06('0x6b')](_0x459f95);}_0x459f95=_0x459f95+_0x9b06('0x6c');if(!_[_0x9b06('0x67')](_0xca6751['value'])&&fs[_0x9b06('0x52')](_0x459f95)){logger[_0x9b06('0x68')](_0x9b06('0x69')+_0x459f95+_0x9b06('0x6a'));fs['unlinkSync'](_0x459f95);}return _0xca6751;})[_0x9b06('0x2a')](function(_0x14208e){if(!_0x14208e)throw new InternalError();return _0x14208e[_0x9b06('0x29')]();})[_0x9b06('0x2a')](function(){_0x157ed8['status'](0xcc)[_0x9b06('0x1f')]();})['catch'](handleError(_0x157ed8,null));};function getBucketslist(_0x50e4ca,_0x4212e3,_0x34ff76){return new Promise(function(_0x2e44da,_0x38d4eb){var _0x5a4641=new AWS['S3']({'accessKeyId':_0x4212e3,'secretAccessKey':_0x50e4ca,'region':_0x34ff76});_0x5a4641[_0x9b06('0x6d')]({},function(_0x174def,_0x31d010){if(_0x174def){return _0x38d4eb(_0x174def);}else{return _0x2e44da(_0x31d010);}});});}function createBucket(_0x51c1af,_0x147cbd,_0x3d2a62,_0x56f0c0){return new Promise(function(_0xe876ca,_0x392273){var _0x257ae7=new AWS['S3']({'accessKeyId':_0x147cbd,'secretAccessKey':_0x51c1af,'region':_0x3d2a62});_0x257ae7['createBucket']({'Bucket':_0x56f0c0},function(_0x56264e,_0x17585b){if(_0x56264e){return _0x392273(_0x56264e);}else{return _0xe876ca(_0x17585b);}});});}function uploadFile(_0x467167,_0x124abd,_0x4441ae,_0x12052c,_0x300b67,_0x5674d3){return new Promise(function(_0x86ec58,_0x570ea5){var _0x531d5d=new AWS['S3']({'accessKeyId':_0x124abd,'secretAccessKey':_0x467167,'region':_0x4441ae});_0x531d5d[_0x9b06('0x6e')]({'Bucket':_0x12052c,'Key':_0x300b67,'Body':_0x5674d3},function(_0x219826,_0xc9bd06){if(_0x219826){return _0x570ea5(_0x219826);}else{return _0x86ec58(_0xc9bd06);}});});}function startTranscribe(_0x3fdcc7,_0x1a08cf,_0x15e4b4,_0xec52fb,_0x242bac,_0x2c5f2a){return new Promise(function(_0x22feb6,_0x137999){var _0x2b226a=new AWS[(_0x9b06('0x6f'))]({'accessKeyId':_0x1a08cf,'secretAccessKey':_0x3fdcc7,'region':_0x15e4b4});_0x2b226a[_0x9b06('0x70')]({'TranscriptionJobName':_0xec52fb,'LanguageCode':_0x242bac,'Media':{'MediaFileUri':_0x2c5f2a}},function(_0x54134f,_0x545ba5){if(_0x54134f){return _0x137999(_0x54134f);}else{return _0x22feb6(_0x545ba5);}});});}function transcribe(_0x98b68b,_0x17ce20,_0x2d9cf4,_0x2ab046,_0x63626c,_0x50e631,_0x17f5dd){return new Promise(function(_0xc07e72,_0x1d60c6){var _0xfce6c0={};logger[_0x9b06('0x68')](util[_0x9b06('0x37')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x98b68b,_0x63626c));return uploadFile(_0x17ce20,_0x2d9cf4,_0x2ab046,_0x63626c,path[_0x9b06('0x71')](_0x50e631),fs[_0x9b06('0x72')](_0x50e631))[_0x9b06('0x2a')](function(_0x48c9e7){logger[_0x9b06('0x68')](util[_0x9b06('0x37')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x98b68b,_0x63626c,_0x48c9e7[_0x9b06('0x73')]));_0xfce6c0[_0x9b06('0x74')]=_0x48c9e7[_0x9b06('0x75')];_0xfce6c0['location']=_0x48c9e7[_0x9b06('0x73')];logger['info'](util['format'](_0x9b06('0x76'),_0x98b68b));return startTranscribe(_0x17ce20,_0x2d9cf4,_0x2ab046,uuidv4(),_0x17f5dd,_0x48c9e7[_0x9b06('0x73')]);})[_0x9b06('0x2a')](function(_0x2494f1){logger[_0x9b06('0x68')](util[_0x9b06('0x37')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x98b68b,_0x2494f1[_0x9b06('0x77')][_0x9b06('0x78')]));_0xfce6c0[_0x9b06('0x79')]=_0x2494f1[_0x9b06('0x77')][_0x9b06('0x78')];_0xfce6c0[_0x9b06('0x7a')]=_0x2494f1[_0x9b06('0x77')]['TranscriptionJobStatus'];return _0xc07e72(_0xfce6c0);})[_0x9b06('0x48')](function(_0x44f803){return _0x1d60c6(_0x44f803);});});}exports[_0x9b06('0x7b')]=function(_0x2da499,_0x342d4d,_0x376432){var _0x2c33c3;var _0x34f01b;var _0x2eaa08;var _0x1c5642=require('../../components/encryptor');return db['VoiceRecording'][_0x9b06('0x7c')]({'where':{'id':_0x2da499['params']['id']}})['then'](function(_0x466c9a){if(_0x466c9a){var _0x5c1310=util[_0x9b06('0x37')]('%s.cypher',_0x466c9a[_0x9b06('0x51')]);if(fs[_0x9b06('0x52')](_0x5c1310)){cypher=!![];return _0x1c5642[_0x9b06('0x63')](_0x5c1310,_0x466c9a[_0x9b06('0x51')],config[_0x9b06('0x53')]['recording'])[_0x9b06('0x2a')](function(){return _0x466c9a;});}return _0x466c9a;}})[_0x9b06('0x2a')](function(_0x4535a7){if(!_0x4535a7){throw new db[(_0x9b06('0x55'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x34f01b=_0x4535a7;return db[_0x9b06('0x7d')][_0x9b06('0x7c')]({'where':{'id':0x1}});})[_0x9b06('0x2a')](handleEntityNotFound(_0x342d4d,null))[_0x9b06('0x2a')](function(_0x3962b1){if(_0x3962b1){_0x2c33c3=_0x3962b1;if(!_0x2c33c3[_0x9b06('0x7e')]||!_0x2c33c3['transcribeAccountId']||!_0x2c33c3[_0x9b06('0x7f')]||!_0x2c33c3['language']||!_0x2c33c3[_0x9b06('0x74')]){throw new db['Sequelize'][(_0x9b06('0x56'))](_0x9b06('0x80'));}if(_0x2da499[_0x9b06('0x4c')][_0x9b06('0x81')]&&(!_0x2c33c3[_0x9b06('0x82')]||!_0x2c33c3[_0x9b06('0x83')]||!_0x2c33c3['sentimentRegion']||!_0x2c33c3[_0x9b06('0x84')]||!_0x2c33c3['bucket'])){throw new db['Sequelize'][(_0x9b06('0x56'))](_0x9b06('0x85'));}return db[_0x9b06('0x86')]['findOne']({'where':{'id':_0x2c33c3[_0x9b06('0x87')]}});}})[_0x9b06('0x2a')](function(_0x150a69){if(!_0x150a69){throw new db[(_0x9b06('0x55'))]['ValidationError'](_0x9b06('0x88'));}if(!_0x150a69[_0x9b06('0x89')]||!_0x150a69['data2']){throw new db[(_0x9b06('0x55'))][(_0x9b06('0x56'))](_0x9b06('0x8a'));}_0x2eaa08=_0x150a69;return getBucketslist(_0x2eaa08[_0x9b06('0x89')],_0x2eaa08[_0x9b06('0x8b')],_0x2c33c3[_0x9b06('0x7f')]);})['then'](function(_0x412d6c){if(_0x412d6c&&_0x412d6c[_0x9b06('0x8c')]){var _0xc31825=_[_0x9b06('0x4a')](_0x412d6c[_0x9b06('0x8c')],function(_0x987429){return _0x987429[_0x9b06('0x8d')]===_0x2c33c3[_0x9b06('0x74')];});if(!_0xc31825){logger[_0x9b06('0x68')](util[_0x9b06('0x37')](_0x9b06('0x8e'),_0x2da499[_0x9b06('0x4d')]['id'],_0x2c33c3['bucket']));return createBucket(_0x2eaa08[_0x9b06('0x89')],_0x2eaa08[_0x9b06('0x8b')],_0x2c33c3[_0x9b06('0x7f')],_0x2c33c3[_0x9b06('0x74')]);}logger[_0x9b06('0x68')](util['format'](_0x9b06('0x8f'),_0x2da499['params']['id'],_0x2c33c3[_0x9b06('0x74')]));return;}})[_0x9b06('0x2a')](function(_0x58c218){if(_0x34f01b[_0x9b06('0x7a')]===_0x9b06('0x90')){return transcribe(_0x2da499[_0x9b06('0x4d')]['id'],_0x2eaa08[_0x9b06('0x89')],_0x2eaa08[_0x9b06('0x8b')],_0x2c33c3['transcribeRegion'],_0x2c33c3[_0x9b06('0x74')],_0x34f01b[_0x9b06('0x51')],_0x2c33c3[_0x9b06('0x84')]);}else{logger[_0x9b06('0x68')](util[_0x9b06('0x37')](_0x9b06('0x91'),_0x2da499[_0x9b06('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x9b06('0x2a')](function(_0x56fa11){if(_0x56fa11){_0x56fa11[_0x9b06('0x92')]=_0x2da499['body'][_0x9b06('0x81')];return _0x34f01b[_0x9b06('0x93')](_0x56fa11);}})[_0x9b06('0x2a')](respondWithResult(_0x342d4d,null))[_0x9b06('0x48')](handleError(_0x342d4d,null));};function writeFile(_0x33cdd3,_0x1d6f7b){return new Promise(function(_0x46fa1e,_0x4dddc3){fs[_0x9b06('0x94')](_0x1d6f7b,_0x33cdd3,function(_0x1ed529,_0x4b98b6){if(_0x1ed529){return _0x4dddc3(_0x1ed529);}else{return _0x46fa1e(_0x4b98b6);}});});}exports['downloadTranscribe']=function(_0x420814,_0x72a924,_0x473f1f){return db['VoiceRecording'][_0x9b06('0x7c')]({'where':{'id':_0x420814[_0x9b06('0x4d')]['id']}})['then'](handleEntityNotFound(_0x72a924))['then'](function(_0x5eacfa){if(_0x5eacfa&&_0x5eacfa[_0x9b06('0x95')]){var _0x2434b1=_0x5eacfa['fileText'];var _0x50bce6=config[_0x9b06('0x96')]+'/server/files/transcribes/transcribe_'+_0x5eacfa['id']+_0x9b06('0x97');if(fs[_0x9b06('0x52')](_0x50bce6)){return _0x50bce6;}return writeFile(_0x2434b1,_0x50bce6)[_0x9b06('0x2a')](function(){return _0x50bce6;});}else{throw new db[(_0x9b06('0x55'))][(_0x9b06('0x56'))](_0x9b06('0x98'));}})['then'](function(_0xa44cf){return _0x72a924[_0x9b06('0x58')](_0xa44cf);})['catch'](handleError(_0x72a924));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d16c882..5fb2ee8 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 _0xbd19=['uniqueid','lodash','util','api','request-promise','path','./voiceRecording.attributes','exports','VoiceRecording'];(function(_0x4ed65a,_0x5a4fb8){var _0x8504d4=function(_0x56ba10){while(--_0x56ba10){_0x4ed65a['push'](_0x4ed65a['shift']());}};_0x8504d4(++_0x5a4fb8);}(_0xbd19,0x1f0));var _0x9bd1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xbd19[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x9bd1('0x0'));var util=require(_0x9bd1('0x1'));var logger=require('../../config/logger')(_0x9bd1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9bd1('0x3'));var fs=require('fs');var path=require(_0x9bd1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9bd1('0x5'));module[_0x9bd1('0x6')]=function(_0x1036eb,_0x1e8127){return _0x1036eb['define'](_0x9bd1('0x7'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9bd1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xece1=['bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','api','moment'];(function(_0x248155,_0x138955){var _0x1a334c=function(_0x38c365){while(--_0x38c365){_0x248155['push'](_0x248155['shift']());}};_0x1a334c(++_0x138955);}(_0xece1,0xda));var _0x1ece=function(_0xa5db38,_0x189d0c){_0xa5db38=_0xa5db38-0x0;var _0x48dc06=_0xece1[_0xa5db38];return _0x48dc06;};'use strict';var _=require(_0x1ece('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ece('0x1'));var moment=require(_0x1ece('0x2'));var BPromise=require(_0x1ece('0x3'));var rp=require(_0x1ece('0x4'));var fs=require('fs');var path=require(_0x1ece('0x5'));var rimraf=require(_0x1ece('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ece('0x7'));module[_0x1ece('0x8')]=function(_0x279e61,_0x50cec0){return _0x279e61[_0x1ece('0x9')](_0x1ece('0xa'),attributes,{'tableName':_0x1ece('0xb'),'paranoid':![],'indexes':[{'name':_0x1ece('0xc'),'fields':[_0x1ece('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 17655ca..09af671 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 _0x0adf=['attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where'];(function(_0x1586c6,_0x59e7da){var _0x957ef1=function(_0x705e7d){while(--_0x705e7d){_0x1586c6['push'](_0x1586c6['shift']());}};_0x957ef1(++_0x59e7da);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x1eb258,_0x41689f){_0x1eb258=_0x1eb258-0x0;var _0x329fbd=_0x0adf[_0x1eb258];return _0x329fbd;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['UpdateVoiceRecording']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')](_0x4e9970[_0xf0ad('0x1a')],{'raw':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1c')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1d')]||null:null,'limit':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1e')]||null:null})[_0xf0ad('0xc')](function(_0x3ece1e){logger[_0xf0ad('0xd')](_0xf0ad('0x1f'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x1f'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x3ece1e));_0x46fb20(_0x3ece1e);})[_0xf0ad('0x17')](function(_0x39b3e8){logger[_0xf0ad('0x13')](_0xf0ad('0x1f'),_0x39b3e8[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8[_0xf0ad('0x13')](0x1f4,_0x39b3e8['message']));});});};exports[_0xf0ad('0x20')]=function(_0x1507a3){var _0x248794=this;return new Promise(function(_0x7377d7,_0x28c280){var _0x30f8ee=require('../../components/encryptor');var _0x2cbe00;return db[_0xf0ad('0x21')][_0xf0ad('0x22')]({'attributes':['id',_0xf0ad('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf0ad('0xc')](function(_0x1ac25c){_0x2cbe00=_0x1ac25c;return db[_0xf0ad('0x18')][_0xf0ad('0x24')](_0x1507a3[_0xf0ad('0x1a')]);})[_0xf0ad('0xc')](function(_0x2d1b2f){if(_0x2cbe00['callRecordingEncryption']&&fs[_0xf0ad('0x25')](_0x2d1b2f['value'])){var _0x83f211=util['format'](_0xf0ad('0x26'),_0x2d1b2f[_0xf0ad('0x27')]);return _0x30f8ee[_0xf0ad('0x28')](_0x2d1b2f[_0xf0ad('0x27')],_0x83f211,config[_0xf0ad('0x29')][_0xf0ad('0x2a')])[_0xf0ad('0xc')](function(){fs[_0xf0ad('0x2b')](_0x2d1b2f['value']);logger['info'](_0xf0ad('0x2c'));return _0x2d1b2f;});}return _0x2d1b2f;})[_0xf0ad('0xc')](function(_0xd608bf){logger[_0xf0ad('0xd')]('CreateVoiceRecording',_0x1507a3);logger[_0xf0ad('0xf')]('CreateVoiceRecording',_0x1507a3,JSON[_0xf0ad('0x11')](_0xd608bf));_0x7377d7(_0xd608bf);})['catch'](function(_0x4136b9){logger['error'](_0xf0ad('0x20'),_0x4136b9[_0xf0ad('0x15')],_0x1507a3);_0x28c280(_0x248794[_0xf0ad('0x13')](0x1f4,_0x4136b9[_0xf0ad('0x15')]));});});}; \ No newline at end of file +var _0x93e9=['http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','debug','stringify','../../components/encryptor','Setting','findOne','existsSync','value','format','%s.cypher','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x8acd15,_0x16bd74){var _0x4e9b90=function(_0x2dffa9){while(--_0x2dffa9){_0x8acd15['push'](_0x8acd15['shift']());}};_0x4e9b90(++_0x16bd74);}(_0x93e9,0xcc));var _0x993e=function(_0x25c881,_0x4d3740){_0x25c881=_0x25c881-0x0;var _0x38ee1e=_0x93e9[_0x25c881];return _0x38ee1e;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['update'](_0x1acd21[_0x993e('0x18')],{'raw':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1b')]||null:null,'attributes':_0x1acd21[_0x993e('0x19')]?_0x1acd21['options'][_0x993e('0x1c')]||null:null,'limit':_0x1acd21['options']?_0x1acd21[_0x993e('0x19')][_0x993e('0x1d')]||null:null})[_0x993e('0xd')](function(_0x5ba2a1){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger[_0x993e('0x1e')](_0x993e('0x16'),_0x1acd21,JSON[_0x993e('0x1f')](_0x5ba2a1));_0x3d6109(_0x5ba2a1);})[_0x993e('0x15')](function(_0xa1c83e){logger[_0x993e('0x12')](_0x993e('0x16'),_0xa1c83e[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9[_0x993e('0x12')](0x1f4,_0xa1c83e[_0x993e('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x2756a7){var _0x279bb8=this;return new Promise(function(_0x52b727,_0x27bbf7){var _0x4f5cc1=require(_0x993e('0x20'));var _0xa03fbd;return db[_0x993e('0x21')][_0x993e('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32e332){_0xa03fbd=_0x32e332;return db[_0x993e('0x17')]['create'](_0x2756a7[_0x993e('0x18')]);})[_0x993e('0xd')](function(_0x248354){if(_0xa03fbd['callRecordingEncryption']&&fs[_0x993e('0x23')](_0x248354[_0x993e('0x24')])){var _0x1f5d51=util[_0x993e('0x25')](_0x993e('0x26'),_0x248354['value']);return _0x4f5cc1[_0x993e('0x27')](_0x248354['value'],_0x1f5d51,config[_0x993e('0x28')]['recording'])[_0x993e('0xd')](function(){fs['unlink'](_0x248354[_0x993e('0x24')]);logger[_0x993e('0xe')](_0x993e('0x29'));return _0x248354;});}return _0x248354;})[_0x993e('0xd')](function(_0xbadd6e){logger[_0x993e('0xe')]('CreateVoiceRecording',_0x2756a7);logger[_0x993e('0x1e')]('CreateVoiceRecording',_0x2756a7,JSON['stringify'](_0xbadd6e));_0x52b727(_0xbadd6e);})[_0x993e('0x15')](function(_0x497d29){logger[_0x993e('0x12')](_0x993e('0x2a'),_0x497d29[_0x993e('0x13')],_0x2756a7);_0x27bbf7(_0x279bb8[_0x993e('0x12')](0x1f4,_0x497d29[_0x993e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c1dd964..707534b 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 _0x409e=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id','update','delete','destroy'];(function(_0x136451,_0x50c4d4){var _0x4e30aa=function(_0x23b08a){while(--_0x23b08a){_0x136451['push'](_0x136451['shift']());}};_0x4e30aa(++_0x50c4d4);}(_0x409e,0x1a3));var _0xe409=function(_0xc298fe,_0x53be01){_0xc298fe=_0xc298fe-0x0;var _0x2096d3=_0x409e[_0xc298fe];return _0x2096d3;};'use strict';var multer=require(_0xe409('0x0'));var util=require(_0xe409('0x1'));var path=require('path');var timeout=require(_0xe409('0x2'));var express=require('express');var router=express[_0xe409('0x3')]();var fs_extra=require(_0xe409('0x4'));var auth=require(_0xe409('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe409('0x6'));router[_0xe409('0x7')]('/',auth[_0xe409('0x8')](),controller[_0xe409('0x9')]);router[_0xe409('0x7')](_0xe409('0xa'),auth[_0xe409('0x8')](),controller[_0xe409('0xb')]);router['get']('/:id',auth[_0xe409('0x8')](),controller[_0xe409('0xc')]);router['post']('/',auth[_0xe409('0x8')](),controller[_0xe409('0xd')]);router['put'](_0xe409('0xe'),auth['isAuthenticated'](),controller[_0xe409('0xf')]);router[_0xe409('0x10')](_0xe409('0xe'),auth[_0xe409('0x8')](),controller[_0xe409('0x11')]);module[_0xe409('0x12')]=router; \ No newline at end of file +var _0x97e7=['./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x464931,_0x46c761){var _0x3771e5=function(_0x4d69e4){while(--_0x4d69e4){_0x464931['push'](_0x464931['shift']());}};_0x3771e5(++_0x46c761);}(_0x97e7,0x103));var _0x797e=function(_0x40d907,_0x59c3a3){_0x40d907=_0x40d907-0x0;var _0x58b8d3=_0x97e7[_0x40d907];return _0x58b8d3;};'use strict';var multer=require(_0x797e('0x0'));var util=require(_0x797e('0x1'));var path=require('path');var timeout=require(_0x797e('0x2'));var express=require(_0x797e('0x3'));var router=express[_0x797e('0x4')]();var fs_extra=require(_0x797e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x797e('0x6'));var config=require('../../config/environment');var controller=require(_0x797e('0x7'));router['get']('/',auth[_0x797e('0x8')](),controller[_0x797e('0x9')]);router[_0x797e('0xa')](_0x797e('0xb'),auth[_0x797e('0x8')](),controller['describe']);router['get'](_0x797e('0xc'),auth[_0x797e('0x8')](),controller['show']);router[_0x797e('0xd')]('/',auth[_0x797e('0x8')](),controller[_0x797e('0xe')]);router[_0x797e('0xf')]('/:id',auth[_0x797e('0x8')](),controller[_0x797e('0x10')]);router[_0x797e('0x11')](_0x797e('0xc'),auth[_0x797e('0x8')](),controller[_0x797e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a0f11ea..de38298 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 _0xf5d8=['moment','attended','STRING','Yes'];(function(_0x1cd4e8,_0x56c1e2){var _0x2d2555=function(_0x3fe423){while(--_0x3fe423){_0x1cd4e8['push'](_0x1cd4e8['shift']());}};_0x2d2555(++_0x56c1e2);}(_0xf5d8,0x9c));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8f5d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0x8f5d('0x1'))},'result':{'type':Sequelize[_0x8f5d('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x8f5d('0x2')]},'transferercalleridname':{'type':Sequelize[_0x8f5d('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8f5d('0x2')]},'transfererconnectedlinename':{'type':Sequelize[_0x8f5d('0x2')]},'transfereraccountcode':{'type':Sequelize[_0x8f5d('0x2')]},'transferercontext':{'type':Sequelize[_0x8f5d('0x2')]},'transfererexten':{'type':Sequelize[_0x8f5d('0x2')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x8f5d('0x2')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x8f5d('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8f5d('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8f5d('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x8f5d('0x2')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x8f5d('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x8f5d('0x2')]},'isexternal':{'type':Sequelize['ENUM'](_0x8f5d('0x3'),'No')},'context':{'type':Sequelize[_0x8f5d('0x2')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x63b9=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x3c98f1,_0x561deb){var _0x41603c=function(_0x543178){while(--_0x543178){_0x3c98f1['push'](_0x3c98f1['shift']());}};_0x41603c(++_0x561deb);}(_0x63b9,0x13c));var _0x963b=function(_0x1c69d4,_0x4b7aed){_0x1c69d4=_0x1c69d4-0x0;var _0x4cc234=_0x63b9[_0x1c69d4];return _0x4cc234;};'use strict';var Sequelize=require(_0x963b('0x0'));var moment=require(_0x963b('0x1'));module[_0x963b('0x2')]={'type':{'type':Sequelize[_0x963b('0x3')](_0x963b('0x4'),_0x963b('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x963b('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x963b('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x963b('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x963b('0x6')]},'transfererexten':{'type':Sequelize[_0x963b('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x963b('0x6')]},'transfereechannel':{'type':Sequelize[_0x963b('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x963b('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x963b('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x963b('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x963b('0x6')]},'transfereeexten':{'type':Sequelize[_0x963b('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x963b('0x6')]},'isexternal':{'type':Sequelize[_0x963b('0x3')](_0x963b('0x7'),'No')},'context':{'type':Sequelize[_0x963b('0x6')]},'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 cf168fe..91424d6 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 _0x1e5f=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoiceTransferReport','include','findAll','catch','show','params','intersection','includeAll','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','type','key'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1e5f,0xb9));var _0xf1e5=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x1e5f[_0x3cd91d];return _0x3b4fab;};'use strict';var emlformat=require(_0xf1e5('0x0'));var rimraf=require(_0xf1e5('0x1'));var zipdir=require(_0xf1e5('0x2'));var jsonpatch=require(_0xf1e5('0x3'));var rp=require(_0xf1e5('0x4'));var moment=require(_0xf1e5('0x5'));var BPromise=require(_0xf1e5('0x6'));var Mustache=require(_0xf1e5('0x7'));var util=require(_0xf1e5('0x8'));var path=require(_0xf1e5('0x9'));var sox=require(_0xf1e5('0xa'));var csv=require(_0xf1e5('0xb'));var ejs=require(_0xf1e5('0xc'));var fs=require('fs');var fs_extra=require(_0xf1e5('0xd'));var _=require(_0xf1e5('0xe'));var squel=require(_0xf1e5('0xf'));var crypto=require(_0xf1e5('0x10'));var jsforce=require(_0xf1e5('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf1e5('0x12'));var Redis=require(_0xf1e5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf1e5('0x14'));var as=require(_0xf1e5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1e5('0x16'))(_0xf1e5('0x17'));var utils=require(_0xf1e5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf1e5('0x19'));var db=require(_0xf1e5('0x1a'))['db'];function respondWithStatusCode(_0x9e1044,_0x49e187){_0x49e187=_0x49e187||0xcc;return function(_0x69bedb){if(_0x69bedb){return _0x9e1044[_0xf1e5('0x1b')](_0x49e187);}return _0x9e1044[_0xf1e5('0x1c')](_0x49e187)[_0xf1e5('0x1d')]();};}function respondWithResult(_0x8e7162,_0x4c242b){_0x4c242b=_0x4c242b||0xc8;return function(_0xbb45be){if(_0xbb45be){return _0x8e7162['status'](_0x4c242b)[_0xf1e5('0x1e')](_0xbb45be);}};}function respondWithFilteredResult(_0x597a,_0x19541d){return function(_0x5f2f3c){if(_0x5f2f3c){var _0x55074f=typeof _0x19541d[_0xf1e5('0x1f')]===_0xf1e5('0x20')&&typeof _0x19541d[_0xf1e5('0x21')]===_0xf1e5('0x20');var _0x98b45b=_0x5f2f3c['count'];var _0x452af1=_0x55074f?0x0:_0x19541d[_0xf1e5('0x1f')];var _0x98e014=_0x55074f?_0x5f2f3c[_0xf1e5('0x22')]:_0x19541d['offset']+_0x19541d[_0xf1e5('0x21')];var _0x281da3;if(_0x98e014>=_0x98b45b){_0x98e014=_0x98b45b;_0x281da3=0xc8;}else{_0x281da3=0xce;}_0x597a[_0xf1e5('0x1c')](_0x281da3);return _0x597a['set'](_0xf1e5('0x23'),_0x452af1+'-'+_0x98e014+'/'+_0x98b45b)[_0xf1e5('0x1e')](_0x5f2f3c);}return null;};}function patchUpdates(_0xe59fb){return function(_0xa657d5){try{jsonpatch[_0xf1e5('0x24')](_0xa657d5,_0xe59fb,!![]);}catch(_0x1b185c){return BPromise[_0xf1e5('0x25')](_0x1b185c);}return _0xa657d5[_0xf1e5('0x26')]();};}function saveUpdates(_0x4c3809,_0x58c9a1){return function(_0x3a660e){if(_0x3a660e){return _0x3a660e['update'](_0x4c3809)['then'](function(_0x3fce9b){return _0x3fce9b;});}return null;};}function removeEntity(_0x2f25e6,_0x288124){return function(_0x2ac001){if(_0x2ac001){return _0x2ac001[_0xf1e5('0x27')]()[_0xf1e5('0x28')](function(){_0x2f25e6[_0xf1e5('0x1c')](0xcc)[_0xf1e5('0x1d')]();});}};}function handleEntityNotFound(_0x3973b0,_0x480873){return function(_0x3e6202){if(!_0x3e6202){_0x3973b0['sendStatus'](0x194);}return _0x3e6202;};}function handleError(_0x15d53f,_0x53e31c){_0x53e31c=_0x53e31c||0x1f4;return function(_0x554fde){logger[_0xf1e5('0x29')](_0x554fde[_0xf1e5('0x2a')]);if(_0x554fde['name']){delete _0x554fde[_0xf1e5('0x2b')];}_0x15d53f[_0xf1e5('0x1c')](_0x53e31c)[_0xf1e5('0x2c')](_0x554fde);};}exports['index']=function(_0x7d9ab7,_0x534c0d){var _0xec0382={},_0x21863c={},_0x2b9cf5={'count':0x0,'rows':[]};var _0x587e18=_[_0xf1e5('0x2d')](db['VoiceTransferReport'][_0xf1e5('0x2e')],function(_0x338ec2){return{'name':_0x338ec2['fieldName'],'type':_0x338ec2[_0xf1e5('0x2f')][_0xf1e5('0x30')]};});_0x21863c[_0xf1e5('0x31')]=_['map'](_0x587e18,_0xf1e5('0x2b'));_0x21863c[_0xf1e5('0x32')]=_[_0xf1e5('0x33')](_0x7d9ab7[_0xf1e5('0x32')]);_0x21863c[_0xf1e5('0x34')]=_['intersection'](_0x21863c[_0xf1e5('0x31')],_0x21863c[_0xf1e5('0x32')]);_0xec0382[_0xf1e5('0x35')]=_['intersection'](_0x21863c[_0xf1e5('0x31')],qs['fields'](_0x7d9ab7['query'][_0xf1e5('0x36')]));_0xec0382[_0xf1e5('0x35')]=_0xec0382[_0xf1e5('0x35')][_0xf1e5('0x37')]?_0xec0382['attributes']:_0x21863c[_0xf1e5('0x31')];if(!_0x7d9ab7['query'][_0xf1e5('0x38')](_0xf1e5('0x39'))){_0xec0382['limit']=qs[_0xf1e5('0x21')](_0x7d9ab7[_0xf1e5('0x32')][_0xf1e5('0x21')]);_0xec0382[_0xf1e5('0x1f')]=qs[_0xf1e5('0x1f')](_0x7d9ab7[_0xf1e5('0x32')][_0xf1e5('0x1f')]);}_0xec0382[_0xf1e5('0x3a')]=qs[_0xf1e5('0x3b')](_0x7d9ab7['query'][_0xf1e5('0x3b')]);_0xec0382[_0xf1e5('0x3c')]=qs[_0xf1e5('0x34')](_[_0xf1e5('0x3d')](_0x7d9ab7[_0xf1e5('0x32')],_0x21863c[_0xf1e5('0x34')]),_0x587e18);if(_0x7d9ab7[_0xf1e5('0x32')][_0xf1e5('0x3e')]){_0xec0382[_0xf1e5('0x3c')]=_['merge'](_0xec0382['where'],{'$or':_[_0xf1e5('0x2d')](_0x587e18,function(_0x2851bb){if(_0x2851bb[_0xf1e5('0x2f')]!==_0xf1e5('0x3f')){var _0x549859={};_0x549859[_0x2851bb[_0xf1e5('0x2b')]]={'$like':'%'+_0x7d9ab7[_0xf1e5('0x32')][_0xf1e5('0x3e')]+'%'};return _0x549859;}})});}_0xec0382=_['merge']({},_0xec0382,_0x7d9ab7[_0xf1e5('0x40')]);var _0x5514e7={'where':_0xec0382['where']};return db[_0xf1e5('0x41')][_0xf1e5('0x22')](_0x5514e7)['then'](function(_0x419c89){_0x2b9cf5[_0xf1e5('0x22')]=_0x419c89;if(_0x7d9ab7[_0xf1e5('0x32')]['includeAll']){_0xec0382[_0xf1e5('0x42')]=[{'all':!![]}];}return db[_0xf1e5('0x41')][_0xf1e5('0x43')](_0xec0382);})['then'](function(_0x1caa08){_0x2b9cf5['rows']=_0x1caa08;return _0x2b9cf5;})[_0xf1e5('0x28')](respondWithFilteredResult(_0x534c0d,_0xec0382))[_0xf1e5('0x44')](handleError(_0x534c0d,null));};exports[_0xf1e5('0x45')]=function(_0x18e7e0,_0x4b16e2){var _0x5edbeb={'raw':!![],'where':{'id':_0x18e7e0[_0xf1e5('0x46')]['id']}},_0x177f18={};_0x177f18[_0xf1e5('0x31')]=_[_0xf1e5('0x33')](db[_0xf1e5('0x41')]['rawAttributes']);_0x177f18[_0xf1e5('0x32')]=_['keys'](_0x18e7e0[_0xf1e5('0x32')]);_0x177f18[_0xf1e5('0x34')]=_['intersection'](_0x177f18[_0xf1e5('0x31')],_0x177f18[_0xf1e5('0x32')]);_0x5edbeb[_0xf1e5('0x35')]=_[_0xf1e5('0x47')](_0x177f18[_0xf1e5('0x31')],qs[_0xf1e5('0x36')](_0x18e7e0[_0xf1e5('0x32')][_0xf1e5('0x36')]));_0x5edbeb[_0xf1e5('0x35')]=_0x5edbeb['attributes']['length']?_0x5edbeb['attributes']:_0x177f18[_0xf1e5('0x31')];if(_0x18e7e0[_0xf1e5('0x32')][_0xf1e5('0x48')]){_0x5edbeb[_0xf1e5('0x42')]=[{'all':!![]}];}_0x5edbeb=_['merge']({},_0x5edbeb,_0x18e7e0[_0xf1e5('0x40')]);return db[_0xf1e5('0x41')]['find'](_0x5edbeb)[_0xf1e5('0x28')](handleEntityNotFound(_0x4b16e2,null))[_0xf1e5('0x28')](respondWithResult(_0x4b16e2,null))[_0xf1e5('0x44')](handleError(_0x4b16e2,null));};exports[_0xf1e5('0x49')]=function(_0xec942,_0x465837){return db[_0xf1e5('0x41')][_0xf1e5('0x49')](_0xec942[_0xf1e5('0x4a')],{})[_0xf1e5('0x28')](respondWithResult(_0x465837,0xc9))[_0xf1e5('0x44')](handleError(_0x465837,null));};exports[_0xf1e5('0x4b')]=function(_0x1dbd91,_0x12a166){if(_0x1dbd91[_0xf1e5('0x4a')]['id']){delete _0x1dbd91['body']['id'];}return db['VoiceTransferReport'][_0xf1e5('0x4c')]({'where':{'id':_0x1dbd91[_0xf1e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x12a166,null))['then'](saveUpdates(_0x1dbd91['body'],null))[_0xf1e5('0x28')](respondWithResult(_0x12a166,null))[_0xf1e5('0x44')](handleError(_0x12a166,null));};exports[_0xf1e5('0x27')]=function(_0x103aed,_0x4e141f){return db[_0xf1e5('0x41')]['find']({'where':{'id':_0x103aed[_0xf1e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e141f,null))[_0xf1e5('0x28')](removeEntity(_0x4e141f,null))['catch'](handleError(_0x4e141f,null));};exports[_0xf1e5('0x4d')]=function(_0x550bc9,_0x3282c3){return db[_0xf1e5('0x41')][_0xf1e5('0x4d')]()[_0xf1e5('0x28')](respondWithResult(_0x3282c3,null))['catch'](handleError(_0x3282c3,null));}; \ No newline at end of file +var _0xfd9e=['crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','VoiceTransferReport','fieldName','key','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xfd9e,0x163));var _0xefd9=function(_0x3fc5cf,_0x14e3e9){_0x3fc5cf=_0x3fc5cf-0x0;var _0x204938=_0xfd9e[_0x3fc5cf];return _0x204938;};'use strict';var emlformat=require(_0xefd9('0x0'));var rimraf=require(_0xefd9('0x1'));var zipdir=require(_0xefd9('0x2'));var jsonpatch=require(_0xefd9('0x3'));var rp=require('request-promise');var moment=require(_0xefd9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefd9('0x5'));var util=require(_0xefd9('0x6'));var path=require(_0xefd9('0x7'));var sox=require(_0xefd9('0x8'));var csv=require(_0xefd9('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(_0xefd9('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xefd9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xefd9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xefd9('0xc'));var as=require(_0xefd9('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefd9('0xe'))(_0xefd9('0xf'));var utils=require(_0xefd9('0x10'));var config=require(_0xefd9('0x11'));var licenseUtil=require(_0xefd9('0x12'));var db=require(_0xefd9('0x13'))['db'];function respondWithStatusCode(_0x5c20ef,_0xb6cc8){_0xb6cc8=_0xb6cc8||0xcc;return function(_0x3ce196){if(_0x3ce196){return _0x5c20ef[_0xefd9('0x14')](_0xb6cc8);}return _0x5c20ef['status'](_0xb6cc8)['end']();};}function respondWithResult(_0x3d4c7b,_0x3a0116){_0x3a0116=_0x3a0116||0xc8;return function(_0x2a8e72){if(_0x2a8e72){return _0x3d4c7b[_0xefd9('0x15')](_0x3a0116)[_0xefd9('0x16')](_0x2a8e72);}};}function respondWithFilteredResult(_0x44eb2a,_0x314bad){return function(_0x4418f1){if(_0x4418f1){var _0x1f84ec=typeof _0x314bad[_0xefd9('0x17')]===_0xefd9('0x18')&&typeof _0x314bad['limit']==='undefined';var _0x6610f4=_0x4418f1[_0xefd9('0x19')];var _0x18ceae=_0x1f84ec?0x0:_0x314bad[_0xefd9('0x17')];var _0x1eddaf=_0x1f84ec?_0x4418f1[_0xefd9('0x19')]:_0x314bad[_0xefd9('0x17')]+_0x314bad[_0xefd9('0x1a')];var _0x3cfb85;if(_0x1eddaf>=_0x6610f4){_0x1eddaf=_0x6610f4;_0x3cfb85=0xc8;}else{_0x3cfb85=0xce;}_0x44eb2a[_0xefd9('0x15')](_0x3cfb85);return _0x44eb2a[_0xefd9('0x1b')](_0xefd9('0x1c'),_0x18ceae+'-'+_0x1eddaf+'/'+_0x6610f4)[_0xefd9('0x16')](_0x4418f1);}return null;};}function patchUpdates(_0xbe18e0){return function(_0x4adbc7){try{jsonpatch[_0xefd9('0x1d')](_0x4adbc7,_0xbe18e0,!![]);}catch(_0x5bda29){return BPromise[_0xefd9('0x1e')](_0x5bda29);}return _0x4adbc7[_0xefd9('0x1f')]();};}function saveUpdates(_0xcfed7d,_0x58c86e){return function(_0x5b3b7f){if(_0x5b3b7f){return _0x5b3b7f[_0xefd9('0x20')](_0xcfed7d)['then'](function(_0x725494){return _0x725494;});}return null;};}function removeEntity(_0x64bc47,_0x2c0cfe){return function(_0x2480dd){if(_0x2480dd){return _0x2480dd[_0xefd9('0x21')]()[_0xefd9('0x22')](function(){_0x64bc47[_0xefd9('0x15')](0xcc)[_0xefd9('0x23')]();});}};}function handleEntityNotFound(_0x4829df,_0x4934b8){return function(_0x12ee31){if(!_0x12ee31){_0x4829df['sendStatus'](0x194);}return _0x12ee31;};}function handleError(_0x43a4e2,_0x3addf7){_0x3addf7=_0x3addf7||0x1f4;return function(_0x4c3d72){logger[_0xefd9('0x24')](_0x4c3d72[_0xefd9('0x25')]);if(_0x4c3d72[_0xefd9('0x26')]){delete _0x4c3d72[_0xefd9('0x26')];}_0x43a4e2[_0xefd9('0x15')](_0x3addf7)[_0xefd9('0x27')](_0x4c3d72);};}exports['index']=function(_0x141120,_0x570996){var _0x5ee19d={},_0x2ce63b={},_0x17e8de={'count':0x0,'rows':[]};var _0x254990=_[_0xefd9('0x28')](db[_0xefd9('0x29')]['rawAttributes'],function(_0x2d1228){return{'name':_0x2d1228[_0xefd9('0x2a')],'type':_0x2d1228['type'][_0xefd9('0x2b')]};});_0x2ce63b[_0xefd9('0x2c')]=_[_0xefd9('0x28')](_0x254990,_0xefd9('0x26'));_0x2ce63b['query']=_[_0xefd9('0x2d')](_0x141120['query']);_0x2ce63b[_0xefd9('0x2e')]=_[_0xefd9('0x2f')](_0x2ce63b[_0xefd9('0x2c')],_0x2ce63b['query']);_0x5ee19d['attributes']=_[_0xefd9('0x2f')](_0x2ce63b['model'],qs[_0xefd9('0x30')](_0x141120[_0xefd9('0x31')][_0xefd9('0x30')]));_0x5ee19d[_0xefd9('0x32')]=_0x5ee19d[_0xefd9('0x32')]['length']?_0x5ee19d[_0xefd9('0x32')]:_0x2ce63b[_0xefd9('0x2c')];if(!_0x141120[_0xefd9('0x31')][_0xefd9('0x33')](_0xefd9('0x34'))){_0x5ee19d['limit']=qs[_0xefd9('0x1a')](_0x141120['query'][_0xefd9('0x1a')]);_0x5ee19d[_0xefd9('0x17')]=qs[_0xefd9('0x17')](_0x141120[_0xefd9('0x31')][_0xefd9('0x17')]);}_0x5ee19d[_0xefd9('0x35')]=qs[_0xefd9('0x36')](_0x141120['query'][_0xefd9('0x36')]);_0x5ee19d[_0xefd9('0x37')]=qs[_0xefd9('0x2e')](_['pick'](_0x141120[_0xefd9('0x31')],_0x2ce63b['filters']),_0x254990);if(_0x141120[_0xefd9('0x31')][_0xefd9('0x38')]){_0x5ee19d['where']=_[_0xefd9('0x39')](_0x5ee19d[_0xefd9('0x37')],{'$or':_[_0xefd9('0x28')](_0x254990,function(_0xca80e4){if(_0xca80e4[_0xefd9('0x3a')]!==_0xefd9('0x3b')){var _0x98fe36={};_0x98fe36[_0xca80e4['name']]={'$like':'%'+_0x141120[_0xefd9('0x31')][_0xefd9('0x38')]+'%'};return _0x98fe36;}})});}_0x5ee19d=_[_0xefd9('0x39')]({},_0x5ee19d,_0x141120[_0xefd9('0x3c')]);var _0xa09bdf={'where':_0x5ee19d['where']};return db[_0xefd9('0x29')]['count'](_0xa09bdf)[_0xefd9('0x22')](function(_0x1bc95e){_0x17e8de[_0xefd9('0x19')]=_0x1bc95e;if(_0x141120['query'][_0xefd9('0x3d')]){_0x5ee19d['include']=[{'all':!![]}];}return db[_0xefd9('0x29')][_0xefd9('0x3e')](_0x5ee19d);})['then'](function(_0x13f4af){_0x17e8de[_0xefd9('0x3f')]=_0x13f4af;return _0x17e8de;})[_0xefd9('0x22')](respondWithFilteredResult(_0x570996,_0x5ee19d))[_0xefd9('0x40')](handleError(_0x570996,null));};exports[_0xefd9('0x41')]=function(_0x57cd28,_0x484464){var _0x179b91={'raw':!![],'where':{'id':_0x57cd28['params']['id']}},_0x1098a0={};_0x1098a0[_0xefd9('0x2c')]=_[_0xefd9('0x2d')](db[_0xefd9('0x29')]['rawAttributes']);_0x1098a0[_0xefd9('0x31')]=_[_0xefd9('0x2d')](_0x57cd28[_0xefd9('0x31')]);_0x1098a0['filters']=_[_0xefd9('0x2f')](_0x1098a0[_0xefd9('0x2c')],_0x1098a0[_0xefd9('0x31')]);_0x179b91[_0xefd9('0x32')]=_[_0xefd9('0x2f')](_0x1098a0[_0xefd9('0x2c')],qs[_0xefd9('0x30')](_0x57cd28['query']['fields']));_0x179b91['attributes']=_0x179b91[_0xefd9('0x32')][_0xefd9('0x42')]?_0x179b91['attributes']:_0x1098a0['model'];if(_0x57cd28['query'][_0xefd9('0x3d')]){_0x179b91[_0xefd9('0x43')]=[{'all':!![]}];}_0x179b91=_[_0xefd9('0x39')]({},_0x179b91,_0x57cd28['options']);return db[_0xefd9('0x29')][_0xefd9('0x44')](_0x179b91)['then'](handleEntityNotFound(_0x484464,null))[_0xefd9('0x22')](respondWithResult(_0x484464,null))[_0xefd9('0x40')](handleError(_0x484464,null));};exports['create']=function(_0x316f21,_0xd1e891){return db[_0xefd9('0x29')][_0xefd9('0x45')](_0x316f21[_0xefd9('0x46')],{})['then'](respondWithResult(_0xd1e891,0xc9))[_0xefd9('0x40')](handleError(_0xd1e891,null));};exports[_0xefd9('0x20')]=function(_0x284923,_0x162d3c){if(_0x284923['body']['id']){delete _0x284923['body']['id'];}return db[_0xefd9('0x29')][_0xefd9('0x44')]({'where':{'id':_0x284923[_0xefd9('0x47')]['id']}})[_0xefd9('0x22')](handleEntityNotFound(_0x162d3c,null))[_0xefd9('0x22')](saveUpdates(_0x284923[_0xefd9('0x46')],null))[_0xefd9('0x22')](respondWithResult(_0x162d3c,null))[_0xefd9('0x40')](handleError(_0x162d3c,null));};exports[_0xefd9('0x21')]=function(_0x263b32,_0x2f20d7){return db[_0xefd9('0x29')][_0xefd9('0x44')]({'where':{'id':_0x263b32['params']['id']}})[_0xefd9('0x22')](handleEntityNotFound(_0x2f20d7,null))[_0xefd9('0x22')](removeEntity(_0x2f20d7,null))[_0xefd9('0x40')](handleError(_0x2f20d7,null));};exports[_0xefd9('0x48')]=function(_0x571b45,_0x1baf9d){return db['VoiceTransferReport'][_0xefd9('0x48')]()[_0xefd9('0x22')](respondWithResult(_0x1baf9d,null))[_0xefd9('0x40')](handleError(_0x1baf9d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 14521f7..ee372bb 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 _0x10b5=['bluebird','path','rimraf','../../config/environment','define','VoiceTransferReport','lodash','../../config/logger','api','moment'];(function(_0x576308,_0xba3291){var _0x1ba9fe=function(_0x124396){while(--_0x124396){_0x576308['push'](_0x576308['shift']());}};_0x1ba9fe(++_0xba3291);}(_0x10b5,0x9c));var _0x510b=function(_0x151f3a,_0x159318){_0x151f3a=_0x151f3a-0x0;var _0x154ae6=_0x10b5[_0x151f3a];return _0x154ae6;};'use strict';var _=require(_0x510b('0x0'));var util=require('util');var logger=require(_0x510b('0x1'))(_0x510b('0x2'));var moment=require(_0x510b('0x3'));var BPromise=require(_0x510b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x510b('0x5'));var rimraf=require(_0x510b('0x6'));var config=require(_0x510b('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x37cffb,_0xe4ab61){return _0x37cffb[_0x510b('0x8')](_0x510b('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62ef=['request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0x62ef,0x89));var _0xf62e=function(_0x487b09,_0x349b11){_0x487b09=_0x487b09-0x0;var _0x28830b=_0x62ef[_0x487b09];return _0x28830b;};'use strict';var _=require(_0xf62e('0x0'));var util=require(_0xf62e('0x1'));var logger=require(_0xf62e('0x2'))(_0xf62e('0x3'));var moment=require(_0xf62e('0x4'));var BPromise=require(_0xf62e('0x5'));var rp=require(_0xf62e('0x6'));var fs=require('fs');var path=require(_0xf62e('0x7'));var rimraf=require(_0xf62e('0x8'));var config=require('../../config/environment');var attributes=require(_0xf62e('0x9'));module[_0xf62e('0xa')]=function(_0x47ded1,_0x9e6eb4){return _0x47ded1[_0xf62e('0xb')](_0xf62e('0xc'),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 943b197..d26a401 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 _0x6638=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','util','bluebird','randomstring'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x6638,0xe4));var _0x8663=function(_0xdd5e36,_0x1fc43d){_0xdd5e36=_0xdd5e36-0x0;var _0x4f7965=_0x6638[_0xdd5e36];return _0x4f7965;};'use strict';var _=require(_0x8663('0x0'));var util=require(_0x8663('0x1'));var moment=require('moment');var BPromise=require(_0x8663('0x2'));var rs=require(_0x8663('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8663('0x4'))['db'];var utils=require(_0x8663('0x5'));var logger=require('../../config/logger')(_0x8663('0x6'));var config=require(_0x8663('0x7'));var jayson=require(_0x8663('0x8'));var client=jayson[_0x8663('0x9')][_0x8663('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc039,_0x20f753,_0x2a3ab4){return new BPromise(function(_0x3ae13e,_0xc4d3c1){return client['request'](_0x5bc039,_0x2a3ab4)[_0x8663('0xb')](function(_0x492aa3){logger[_0x8663('0xc')](_0x8663('0xd'),_0x20f753,_0x8663('0xe'));logger[_0x8663('0xf')](_0x8663('0x10'),_0x20f753,'request\x20sent',JSON['stringify'](_0x492aa3));if(_0x492aa3['error']){if(_0x492aa3['error'][_0x8663('0x11')]===0x1f4){logger['error'](_0x8663('0xd'),_0x20f753,_0x492aa3[_0x8663('0x12')][_0x8663('0x13')]);return _0xc4d3c1(_0x492aa3[_0x8663('0x12')][_0x8663('0x13')]);}logger[_0x8663('0x12')](_0x8663('0xd'),_0x20f753,_0x492aa3[_0x8663('0x12')][_0x8663('0x13')]);return _0x3ae13e(_0x492aa3[_0x8663('0x12')][_0x8663('0x13')]);}else{logger[_0x8663('0xc')](_0x8663('0xd'),_0x20f753,'request\x20sent');_0x3ae13e(_0x492aa3[_0x8663('0x14')]['message']);}})[_0x8663('0x15')](function(_0x113a55){logger[_0x8663('0x12')](_0x8663('0xd'),_0x20f753,_0x113a55);_0xc4d3c1(_0x113a55);});});}exports[_0x8663('0x16')]=function(_0x231f79){var _0xbe471b=this;return new Promise(function(_0x3e55d1,_0xe17286){return db[_0x8663('0x17')][_0x8663('0x18')](_0x231f79[_0x8663('0x19')],{'raw':_0x231f79['options']?_0x231f79[_0x8663('0x1a')][_0x8663('0x1b')]===undefined?!![]:![]:!![]})[_0x8663('0xb')](function(_0xf8581e){logger[_0x8663('0xc')]('CreateVoiceTransferReport',_0x231f79);logger[_0x8663('0xf')](_0x8663('0x16'),_0x231f79,JSON[_0x8663('0x1c')](_0xf8581e));_0x3e55d1(_0xf8581e);})[_0x8663('0x15')](function(_0x19a816){logger['error'](_0x8663('0x16'),_0x19a816[_0x8663('0x13')],_0x231f79);_0xe17286(_0xbe471b[_0x8663('0x12')](0x1f4,_0x19a816[_0x8663('0x13')]));});});}; \ No newline at end of file +var _0xc500=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x314139,_0x3d585c){var _0x149ac7=function(_0x4c5441){while(--_0x4c5441){_0x314139['push'](_0x314139['shift']());}};_0x149ac7(++_0x3d585c);}(_0xc500,0x179));var _0x0c50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc500[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0c50('0x0'));var util=require(_0x0c50('0x1'));var moment=require(_0x0c50('0x2'));var BPromise=require(_0x0c50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c50('0x4'));var db=require(_0x0c50('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c50('0x6'))('rpc');var config=require(_0x0c50('0x7'));var jayson=require(_0x0c50('0x8'));var client=jayson[_0x0c50('0x9')][_0x0c50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x180c48,_0x2f837d,_0x5ddcec){return new BPromise(function(_0x1848d1,_0x5ede76){return client[_0x0c50('0xb')](_0x180c48,_0x5ddcec)['then'](function(_0x417e48){logger[_0x0c50('0xc')](_0x0c50('0xd'),_0x2f837d,_0x0c50('0xe'));logger[_0x0c50('0xf')](_0x0c50('0x10'),_0x2f837d,_0x0c50('0xe'),JSON[_0x0c50('0x11')](_0x417e48));if(_0x417e48['error']){if(_0x417e48['error'][_0x0c50('0x12')]===0x1f4){logger[_0x0c50('0x13')](_0x0c50('0xd'),_0x2f837d,_0x417e48[_0x0c50('0x13')]['message']);return _0x5ede76(_0x417e48[_0x0c50('0x13')][_0x0c50('0x14')]);}logger[_0x0c50('0x13')](_0x0c50('0xd'),_0x2f837d,_0x417e48['error'][_0x0c50('0x14')]);return _0x1848d1(_0x417e48['error'][_0x0c50('0x14')]);}else{logger['info'](_0x0c50('0xd'),_0x2f837d,'request\x20sent');_0x1848d1(_0x417e48[_0x0c50('0x15')][_0x0c50('0x14')]);}})[_0x0c50('0x16')](function(_0x528160){logger[_0x0c50('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x2f837d,_0x528160);_0x5ede76(_0x528160);});});}exports[_0x0c50('0x17')]=function(_0x380135){var _0x524fee=this;return new Promise(function(_0x886ffc,_0x7e4cea){return db[_0x0c50('0x18')][_0x0c50('0x19')](_0x380135[_0x0c50('0x1a')],{'raw':_0x380135['options']?_0x380135[_0x0c50('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x996a76){logger[_0x0c50('0xc')](_0x0c50('0x17'),_0x380135);logger[_0x0c50('0xf')](_0x0c50('0x17'),_0x380135,JSON[_0x0c50('0x11')](_0x996a76));_0x886ffc(_0x996a76);})[_0x0c50('0x16')](function(_0x3a62ec){logger[_0x0c50('0x13')](_0x0c50('0x17'),_0x3a62ec['message'],_0x380135);_0x7e4cea(_0x524fee[_0x0c50('0x13')](0x1f4,_0x3a62ec[_0x0c50('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 4afde53..799f551 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x26fd14,_0x2bef63){var _0x30ef8c=function(_0x2020b2){while(--_0x2020b2){_0x26fd14['push'](_0x26fd14['shift']());}};_0x30ef8c(++_0x2bef63);}(_0x5b02,0xe9));var _0x25b0=function(_0xaa6142,_0x51fcb7){_0xaa6142=_0xaa6142-0x0;var _0x538ee4=_0x5b02[_0xaa6142];return _0x538ee4;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb43b,0x1b2));var _0xbb43=function(_0x10cc19,_0x5b8796){_0x10cc19=_0x10cc19-0x0;var _0x20c2a2=_0xb43b[_0x10cc19];return _0x20c2a2;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2af76f1..85ba8c6 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 _0x99e9=['UserId','sessionId','length','\x20not\x20found!','originate','json','body','callNumber','callbackUrl','format','webbar:originate','hangup\x20fired:','userId','user:%s','webbar:hangup','hangup\x20executed!','catch','answer','answer\x20fired:','hold','hold\x20fired:','entityFound:','webbar:hold','hold\x20executed!','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','NotFound','code','message','result','User','findOne','agent','then','VoiceChannels','all','filter','rows'];(function(_0x2b2792,_0x5d3200){var _0x4c9f42=function(_0x1d7d4d){while(--_0x1d7d4d){_0x2b2792['push'](_0x2b2792['shift']());}};_0x4c9f42(++_0x5d3200);}(_0x99e9,0xb4));var _0x999e=function(_0x2dc70d,_0x26e805){_0x2dc70d=_0x2dc70d-0x0;var _0x3b9ecc=_0x99e9[_0x2dc70d];return _0x3b9ecc;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x999e('0x0'));var db=require(_0x999e('0x1'))['db'];var config=require(_0x999e('0x2'));var util=require(_0x999e('0x3'));var BPromise=require('bluebird');var jayson=require(_0x999e('0x4'));var amiClient=jayson[_0x999e('0x5')][_0x999e('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x999e('0x7'));var Redis=require('ioredis');config[_0x999e('0x8')]=_[_0x999e('0x9')](config[_0x999e('0x8')],{'host':_0x999e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x999e('0x8')]));var Schema=require(_0x999e('0xb'));var originateValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],_0x999e('0xd')]},'callNumber':{'type':_0x999e('0xe'),'required':[!![],_0x999e('0xf')]},'callerId':{'type':_0x999e('0xe')},'callbackUrl':{'type':_0x999e('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],_0x999e('0xd')]},'sessionId':{'type':_0x999e('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],_0x999e('0xd')]},'sessionId':{'type':_0x999e('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],_0x999e('0xd')]},'sessionId':{'type':_0x999e('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x999e('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],_0x999e('0xd')]},'sessionId':{'type':_0x999e('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x999e('0xd')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x999e('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x999e('0xd')]}});function emit(_0x22feac,_0x2dd5f4,_0x289e0e){logger[_0x999e('0x10')](_0x22feac,_0x2dd5f4,JSON[_0x999e('0x11')](_0x289e0e));io['to'](_0x22feac)['emit'](_0x2dd5f4,_0x289e0e);}function handleError(_0x5bb27e){return function(_0x4fcdfb){console[_0x999e('0x12')](_0x999e('0x13'),_0x4fcdfb,_0x4fcdfb instanceof RangeError);logger[_0x999e('0x14')](_0x4fcdfb[_0x999e('0x15')]);if(_0x4fcdfb instanceof RangeError){if(_0x4fcdfb[_0x999e('0x16')]){delete _0x4fcdfb[_0x999e('0x16')];}_0x5bb27e['status'](0x194)['send'](_0x4fcdfb);}else{if(_0x4fcdfb[_0x999e('0x16')]){delete _0x4fcdfb[_0x999e('0x16')];}_0x5bb27e[_0x999e('0x17')](0x1f4)['send'](_0x4fcdfb);}};}function checkError(){return function(_0x351dd7){if(!_0x351dd7){throw new RangeError(_0x999e('0x18'));}return _0x351dd7;};}function respondWithRpcPromise(_0x3b73f0,_0x36fce4){return new BPromise(function(_0x373b80,_0x3750a0){var _0x427bcf=amiClient;return _0x427bcf['request'](_0x3b73f0,_0x36fce4)['then'](function(_0x11a6bf){if(_0x11a6bf[_0x999e('0x14')]){if(_0x11a6bf['error'][_0x999e('0x19')]===0x1f4){return _0x3750a0(_0x11a6bf[_0x999e('0x14')][_0x999e('0x1a')]);}return _0x373b80(_0x11a6bf[_0x999e('0x14')][_0x999e('0x1a')]);}else{_0x373b80(_0x11a6bf[_0x999e('0x1b')]);}})['catch'](function(_0x2e1cc5){_0x3750a0(_0x2e1cc5);});});}function getAgent(_0x4199ff){return db[_0x999e('0x1c')][_0x999e('0x1d')]({'where':{'id':_0x4199ff,'role':_0x999e('0x1e')}})[_0x999e('0x1f')](checkError());}function getAgentCheckSession(_0x44b790,_0x5798f3){return new BPromise(function(_0x28f803,_0x5ba8b0){var _0x4fed13=respondWithRpcPromise(_0x999e('0x20'));var _0x1059bd=getAgent(_0x44b790);Promise[_0x999e('0x21')]([_0x4fed13,_0x1059bd])['then'](function(_0x1ea0e4){var _0x28f7ba=_0x1ea0e4[0x0];var _0x22cd81=_0x1ea0e4[0x1];var _0x4339bf=_[_0x999e('0x22')](_0x28f7ba[_0x999e('0x23')],function(_0x82e067){return _0x82e067[_0x999e('0x24')]==_0x22cd81['id']&&_0x82e067[_0x999e('0x25')]==_0x5798f3;});if(_0x4339bf[_0x999e('0x26')]==0x1){_0x28f803(_0x22cd81);}else{_0x5ba8b0(new RangeError('sessionId\x20'+_0x5798f3+_0x999e('0x27')));}});});}exports[_0x999e('0x28')]=function(_0x371613,_0x4c2ce8){logger[_0x999e('0x10')]('originate\x20fired:',_0x371613['body']);var _0x28a228=originateValidation[_0x999e('0xb')](_0x371613['body']);if(_0x28a228['length']>0x0){return _0x4c2ce8[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x28a228);}var _0x10a17d=_0x371613[_0x999e('0x2a')]['userId'];var _0x2724be=_0x371613[_0x999e('0x2a')][_0x999e('0x2b')];var _0x30247a=_0x371613['body']['callerId'];var _0x44fb32=_0x371613['body'][_0x999e('0x2c')];return getAgent(_0x10a17d)[_0x999e('0x1f')](function(_0x69e059){logger[_0x999e('0x10')]('entityFound:',_0x69e059[_0x999e('0x16')]);emit(util[_0x999e('0x2d')]('user:%s',_0x69e059['name']),_0x999e('0x2e'),{'callNumber':_0x2724be,'callerId':_0x30247a,'callbackUrl':_0x44fb32});return _0x4c2ce8['status'](0xc8)[_0x999e('0x29')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x4c2ce8));};exports['hangup']=function(_0x5360a3,_0x17e257){logger['info'](_0x999e('0x2f'),_0x5360a3['body']);var _0x4cfa34=hangupValidation['validate'](_0x5360a3[_0x999e('0x2a')]);if(_0x4cfa34[_0x999e('0x26')]>0x0){return _0x17e257[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x4cfa34);}var _0x379064=_0x5360a3[_0x999e('0x2a')][_0x999e('0x30')];var _0x176a8c=_0x5360a3['body'][_0x999e('0x25')];return getAgent(_0x379064)[_0x999e('0x1f')](function(_0x1e1229){logger[_0x999e('0x10')]('entityFound:',_0x1e1229[_0x999e('0x16')]);emit(util['format'](_0x999e('0x31'),_0x1e1229[_0x999e('0x16')]),_0x999e('0x32'),{'sessionId':_0x176a8c});return _0x17e257[_0x999e('0x17')](0xc8)['json']({'error':![],'message':_0x999e('0x33')});})[_0x999e('0x34')](handleError(_0x17e257));};exports[_0x999e('0x35')]=function(_0x494222,_0x58dfb2){logger[_0x999e('0x10')](_0x999e('0x36'),_0x494222[_0x999e('0x2a')]);var _0x42a3a0=answerValidation[_0x999e('0xb')](_0x494222[_0x999e('0x2a')]);if(_0x42a3a0[_0x999e('0x26')]>0x0){return _0x58dfb2[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x42a3a0);}var _0xf4fa=_0x494222['body']['userId'];var _0xa5742d=_0x494222[_0x999e('0x2a')][_0x999e('0x25')];return getAgent(_0xf4fa)[_0x999e('0x1f')](function(_0x206991){logger[_0x999e('0x10')]('entityFound:',_0x206991[_0x999e('0x16')]);emit(util['format']('user:%s',_0x206991[_0x999e('0x16')]),'webbar:answer',{'sessionId':_0xa5742d});return _0x58dfb2['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x999e('0x34')](handleError(_0x58dfb2));};exports[_0x999e('0x37')]=function(_0x5e50f5,_0x4542e6){logger[_0x999e('0x10')](_0x999e('0x38'),_0x5e50f5['body']);var _0x4b230d=holdValidation[_0x999e('0xb')](_0x5e50f5[_0x999e('0x2a')]);if(_0x4b230d[_0x999e('0x26')]>0x0){return _0x4542e6['status'](0x190)['json'](_0x4b230d);}var _0x4d0358=_0x5e50f5['body'][_0x999e('0x30')];var _0x56a064=_0x5e50f5['body'][_0x999e('0x25')];return getAgent(_0x4d0358)[_0x999e('0x1f')](function(_0x5843f1){logger[_0x999e('0x10')](_0x999e('0x39'),_0x5843f1['name']);emit(util[_0x999e('0x2d')]('user:%s',_0x5843f1[_0x999e('0x16')]),_0x999e('0x3a'),{'sessionId':_0x56a064});return _0x4542e6['status'](0xc8)[_0x999e('0x29')]({'error':![],'message':_0x999e('0x3b')});})['catch'](handleError(_0x4542e6));};exports['unhold']=function(_0x254292,_0x561fb4){logger['info']('unhold\x20fired:',_0x254292[_0x999e('0x2a')]);var _0x3b2023=unholdValidation[_0x999e('0xb')](_0x254292[_0x999e('0x2a')]);if(_0x3b2023[_0x999e('0x26')]>0x0){return _0x561fb4[_0x999e('0x17')](0x190)['json'](_0x3b2023);}var _0x14f8de=_0x254292[_0x999e('0x2a')]['userId'];var _0x1e506f=_0x254292[_0x999e('0x2a')][_0x999e('0x25')];return getAgent(_0x14f8de)[_0x999e('0x1f')](function(_0x5e4890){logger[_0x999e('0x10')](_0x999e('0x39'),_0x5e4890[_0x999e('0x16')]);emit(util[_0x999e('0x2d')]('user:%s',_0x5e4890[_0x999e('0x16')]),_0x999e('0x3c'),{'sessionId':_0x1e506f});return _0x561fb4[_0x999e('0x17')](0xc8)[_0x999e('0x29')]({'error':![],'message':'unhold\x20executed!'});})[_0x999e('0x34')](handleError(_0x561fb4));};exports[_0x999e('0x3d')]=function(_0x2acc36,_0x291b73){logger[_0x999e('0x10')](_0x999e('0x3e'),_0x291b73[_0x999e('0x2a')]);var _0x1a6925=callsValidation['validate'](_0x2acc36['body']);if(_0x1a6925[_0x999e('0x26')]>0x0){return _0x291b73[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x1a6925);}var _0xefd231=_0x2acc36[_0x999e('0x2a')][_0x999e('0x30')];var _0x23c5fb=respondWithRpcPromise('VoiceChannels');var _0x5579c4=getAgent(_0xefd231);return Promise[_0x999e('0x21')]([_0x23c5fb,_0x5579c4])[_0x999e('0x1f')](function(_0x36c3dc){var _0x3e9531=_0x36c3dc[0x0];var _0x25176f=_0x36c3dc[0x1];var _0x51b329=_[_0x999e('0x22')](_0x3e9531[_0x999e('0x23')],function(_0x30a49d){return _0x30a49d[_0x999e('0x24')]==_0x25176f['id'];});return _0x291b73[_0x999e('0x17')](0xc8)[_0x999e('0x29')]({'count':_0x51b329[_0x999e('0x26')],'rows':_0x51b329});})['catch'](handleError(_0x291b73));};exports[_0x999e('0x3f')]=function(_0x521b7a,_0xe35369){logger[_0x999e('0x10')](_0x999e('0x40'),_0x521b7a[_0x999e('0x2a')]);var _0x440a3c=conferenceValidation[_0x999e('0xb')](_0x521b7a['body']);if(_0x440a3c[_0x999e('0x26')]>0x0){return _0xe35369[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x440a3c);}var _0xe39e00=_0x521b7a[_0x999e('0x2a')][_0x999e('0x30')];return getAgent(_0xe39e00)[_0x999e('0x1f')](function(_0x3d398c){logger[_0x999e('0x10')](_0x999e('0x39'),_0x3d398c[_0x999e('0x16')]);emit(util[_0x999e('0x2d')](_0x999e('0x31'),_0x3d398c[_0x999e('0x16')]),_0x999e('0x41'));return _0xe35369['status'](0xc8)[_0x999e('0x29')]({'error':![],'message':_0x999e('0x42')});})[_0x999e('0x34')](handleError(_0xe35369));};exports[_0x999e('0x43')]=function(_0x4e5e6e,_0x4871c9){logger[_0x999e('0x10')](_0x999e('0x44'),_0x4e5e6e[_0x999e('0x2a')]);var _0x33abdc=transferValidation[_0x999e('0xb')](_0x4e5e6e[_0x999e('0x2a')]);if(_0x33abdc[_0x999e('0x26')]>0x0){return _0x4871c9[_0x999e('0x17')](0x190)[_0x999e('0x29')](_0x33abdc);}var _0x5d4f50=_0x4e5e6e[_0x999e('0x2a')]['userId'];var _0x184b3e=_0x4e5e6e[_0x999e('0x2a')]['sessionId'];var _0x61ba8=_0x4e5e6e[_0x999e('0x2a')][_0x999e('0x45')];return getAgent(_0x5d4f50)[_0x999e('0x1f')](function(_0x17beed){logger['info'](_0x999e('0x39'),_0x17beed[_0x999e('0x16')]);emit(util['format']('user:%s',_0x17beed['name']),_0x999e('0x46'),{'sessionId':_0x184b3e,'transferNumber':_0x61ba8});return _0x4871c9[_0x999e('0x17')](0xc8)[_0x999e('0x29')]({'error':![],'message':_0x999e('0x47')});})[_0x999e('0x34')](handleError(_0x4871c9));}; \ No newline at end of file +var _0xaf80=['../../mysqldb','../../config/environment','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','status','send','name','NotFound','request','then','code','message','result','catch','agent','all','filter','rows','UserId','length','\x20not\x20found!','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','info','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','webbar:transfer','path','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaf80,0x1ef));var _0x0af8=function(_0x59318e,_0xa6be29){_0x59318e=_0x59318e-0x0;var _0x1102c5=_0xaf80[_0x59318e];return _0x1102c5;};'use strict';var path=require(_0x0af8('0x0'));var fs=require('fs');var _=require(_0x0af8('0x1'));var db=require(_0x0af8('0x2'))['db'];var config=require(_0x0af8('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x0af8('0x4')][_0x0af8('0x5')]({'port':0x232a});var logger=require(_0x0af8('0x6'))(_0x0af8('0x7'));var Redis=require(_0x0af8('0x8'));config[_0x0af8('0x9')]=_['defaults'](config['redis'],{'host':_0x0af8('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0af8('0x9')]));var Schema=require(_0x0af8('0xb'));var originateValidation=new Schema({'userId':{'type':_0x0af8('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x0af8('0xd'),'required':[!![],_0x0af8('0xe')]},'callerId':{'type':_0x0af8('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0af8('0xf')]},'sessionId':{'type':_0x0af8('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0af8('0xc'),'required':[!![],_0x0af8('0xf')]},'sessionId':{'type':_0x0af8('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0af8('0xf')]},'sessionId':{'type':_0x0af8('0xd'),'required':[!![],_0x0af8('0x10')]},'transferNumber':{'type':_0x0af8('0xd'),'required':[!![],_0x0af8('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x0af8('0xc'),'required':[!![],_0x0af8('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0af8('0xf')]},'sessionId':{'type':_0x0af8('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0af8('0xc'),'required':[!![],_0x0af8('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0af8('0xc'),'required':[!![],_0x0af8('0xf')]}});function emit(_0x4755cb,_0x325b4c,_0x50d5ba){logger['info'](_0x4755cb,_0x325b4c,JSON['stringify'](_0x50d5ba));io['to'](_0x4755cb)[_0x0af8('0x12')](_0x325b4c,_0x50d5ba);}function handleError(_0x465161){return function(_0x54e946){console[_0x0af8('0x13')](_0x0af8('0x14'),_0x54e946,_0x54e946 instanceof RangeError);logger[_0x0af8('0x15')](_0x54e946['stack']);if(_0x54e946 instanceof RangeError){if(_0x54e946['name']){delete _0x54e946['name'];}_0x465161[_0x0af8('0x16')](0x194)[_0x0af8('0x17')](_0x54e946);}else{if(_0x54e946['name']){delete _0x54e946[_0x0af8('0x18')];}_0x465161['status'](0x1f4)['send'](_0x54e946);}};}function checkError(){return function(_0x40384f){if(!_0x40384f){throw new RangeError(_0x0af8('0x19'));}return _0x40384f;};}function respondWithRpcPromise(_0x29cd4a,_0x5c0dd1){return new BPromise(function(_0x162e95,_0x52778f){var _0x592523=amiClient;return _0x592523[_0x0af8('0x1a')](_0x29cd4a,_0x5c0dd1)[_0x0af8('0x1b')](function(_0x4b0492){if(_0x4b0492[_0x0af8('0x15')]){if(_0x4b0492[_0x0af8('0x15')][_0x0af8('0x1c')]===0x1f4){return _0x52778f(_0x4b0492[_0x0af8('0x15')][_0x0af8('0x1d')]);}return _0x162e95(_0x4b0492['error']['message']);}else{_0x162e95(_0x4b0492[_0x0af8('0x1e')]);}})[_0x0af8('0x1f')](function(_0x359583){_0x52778f(_0x359583);});});}function getAgent(_0xb43164){return db['User']['findOne']({'where':{'id':_0xb43164,'role':_0x0af8('0x20')}})[_0x0af8('0x1b')](checkError());}function getAgentCheckSession(_0x23a102,_0x140104){return new BPromise(function(_0x2e8853,_0x410216){var _0x318476=respondWithRpcPromise('VoiceChannels');var _0x34aa8b=getAgent(_0x23a102);Promise[_0x0af8('0x21')]([_0x318476,_0x34aa8b])[_0x0af8('0x1b')](function(_0x20eab4){var _0x1b94cf=_0x20eab4[0x0];var _0x231230=_0x20eab4[0x1];var _0x4575b0=_[_0x0af8('0x22')](_0x1b94cf[_0x0af8('0x23')],function(_0x270b49){return _0x270b49[_0x0af8('0x24')]==_0x231230['id']&&_0x270b49['sessionId']==_0x140104;});if(_0x4575b0[_0x0af8('0x25')]==0x1){_0x2e8853(_0x231230);}else{_0x410216(new RangeError('sessionId\x20'+_0x140104+_0x0af8('0x26')));}});});}exports['originate']=function(_0x318ca7,_0x1d2d4f){logger['info'](_0x0af8('0x27'),_0x318ca7[_0x0af8('0x28')]);var _0x34b3e5=originateValidation['validate'](_0x318ca7[_0x0af8('0x28')]);if(_0x34b3e5[_0x0af8('0x25')]>0x0){return _0x1d2d4f[_0x0af8('0x16')](0x190)['json'](_0x34b3e5);}var _0x3c4657=_0x318ca7[_0x0af8('0x28')][_0x0af8('0x29')];var _0x1aded0=_0x318ca7[_0x0af8('0x28')][_0x0af8('0x2a')];var _0x4dcdbc=_0x318ca7[_0x0af8('0x28')][_0x0af8('0x2b')];var _0x73d193=_0x318ca7[_0x0af8('0x28')][_0x0af8('0x2c')];return getAgent(_0x3c4657)[_0x0af8('0x1b')](function(_0x13991a){logger[_0x0af8('0x2d')](_0x0af8('0x2e'),_0x13991a[_0x0af8('0x18')]);emit(util[_0x0af8('0x2f')](_0x0af8('0x30'),_0x13991a['name']),_0x0af8('0x31'),{'callNumber':_0x1aded0,'callerId':_0x4dcdbc,'callbackUrl':_0x73d193});return _0x1d2d4f[_0x0af8('0x16')](0xc8)[_0x0af8('0x32')]({'error':![],'message':_0x0af8('0x33')});})[_0x0af8('0x1f')](handleError(_0x1d2d4f));};exports[_0x0af8('0x34')]=function(_0x114ef3,_0x5e971f){logger[_0x0af8('0x2d')](_0x0af8('0x35'),_0x114ef3[_0x0af8('0x28')]);var _0x4d7e1f=hangupValidation[_0x0af8('0xb')](_0x114ef3[_0x0af8('0x28')]);if(_0x4d7e1f[_0x0af8('0x25')]>0x0){return _0x5e971f['status'](0x190)[_0x0af8('0x32')](_0x4d7e1f);}var _0x122382=_0x114ef3[_0x0af8('0x28')][_0x0af8('0x29')];var _0x44c198=_0x114ef3[_0x0af8('0x28')][_0x0af8('0x36')];return getAgent(_0x122382)['then'](function(_0x586924){logger[_0x0af8('0x2d')](_0x0af8('0x2e'),_0x586924['name']);emit(util[_0x0af8('0x2f')](_0x0af8('0x30'),_0x586924['name']),_0x0af8('0x37'),{'sessionId':_0x44c198});return _0x5e971f['status'](0xc8)[_0x0af8('0x32')]({'error':![],'message':_0x0af8('0x38')});})['catch'](handleError(_0x5e971f));};exports[_0x0af8('0x39')]=function(_0x3fefbc,_0x497695){logger[_0x0af8('0x2d')]('answer\x20fired:',_0x3fefbc[_0x0af8('0x28')]);var _0x423eee=answerValidation[_0x0af8('0xb')](_0x3fefbc['body']);if(_0x423eee['length']>0x0){return _0x497695[_0x0af8('0x16')](0x190)[_0x0af8('0x32')](_0x423eee);}var _0x37e54e=_0x3fefbc[_0x0af8('0x28')]['userId'];var _0x1293d8=_0x3fefbc[_0x0af8('0x28')][_0x0af8('0x36')];return getAgent(_0x37e54e)['then'](function(_0x15aa0c){logger[_0x0af8('0x2d')]('entityFound:',_0x15aa0c[_0x0af8('0x18')]);emit(util['format'](_0x0af8('0x30'),_0x15aa0c['name']),'webbar:answer',{'sessionId':_0x1293d8});return _0x497695['status'](0xc8)[_0x0af8('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0x0af8('0x1f')](handleError(_0x497695));};exports['hold']=function(_0x226292,_0x38515e){logger[_0x0af8('0x2d')](_0x0af8('0x3a'),_0x226292[_0x0af8('0x28')]);var _0x562f09=holdValidation['validate'](_0x226292[_0x0af8('0x28')]);if(_0x562f09[_0x0af8('0x25')]>0x0){return _0x38515e[_0x0af8('0x16')](0x190)[_0x0af8('0x32')](_0x562f09);}var _0x3d86e2=_0x226292[_0x0af8('0x28')][_0x0af8('0x29')];var _0x578e52=_0x226292['body'][_0x0af8('0x36')];return getAgent(_0x3d86e2)[_0x0af8('0x1b')](function(_0x394525){logger[_0x0af8('0x2d')]('entityFound:',_0x394525[_0x0af8('0x18')]);emit(util[_0x0af8('0x2f')](_0x0af8('0x30'),_0x394525[_0x0af8('0x18')]),_0x0af8('0x3b'),{'sessionId':_0x578e52});return _0x38515e[_0x0af8('0x16')](0xc8)['json']({'error':![],'message':_0x0af8('0x3c')});})['catch'](handleError(_0x38515e));};exports[_0x0af8('0x3d')]=function(_0x4a43e3,_0xeddce9){logger[_0x0af8('0x2d')](_0x0af8('0x3e'),_0x4a43e3['body']);var _0x1400eb=unholdValidation[_0x0af8('0xb')](_0x4a43e3['body']);if(_0x1400eb[_0x0af8('0x25')]>0x0){return _0xeddce9[_0x0af8('0x16')](0x190)[_0x0af8('0x32')](_0x1400eb);}var _0x2a3db=_0x4a43e3[_0x0af8('0x28')][_0x0af8('0x29')];var _0x26bdc7=_0x4a43e3['body'][_0x0af8('0x36')];return getAgent(_0x2a3db)[_0x0af8('0x1b')](function(_0x49bd57){logger['info'](_0x0af8('0x2e'),_0x49bd57[_0x0af8('0x18')]);emit(util['format'](_0x0af8('0x30'),_0x49bd57[_0x0af8('0x18')]),'webbar:unhold',{'sessionId':_0x26bdc7});return _0xeddce9[_0x0af8('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x0af8('0x1f')](handleError(_0xeddce9));};exports[_0x0af8('0x3f')]=function(_0x553625,_0x1cbc96){logger[_0x0af8('0x2d')]('calls\x20fired:',_0x1cbc96[_0x0af8('0x28')]);var _0x47d16c=callsValidation[_0x0af8('0xb')](_0x553625[_0x0af8('0x28')]);if(_0x47d16c['length']>0x0){return _0x1cbc96['status'](0x190)[_0x0af8('0x32')](_0x47d16c);}var _0x18da9c=_0x553625[_0x0af8('0x28')][_0x0af8('0x29')];var _0x524f79=respondWithRpcPromise(_0x0af8('0x40'));var _0x3910fb=getAgent(_0x18da9c);return Promise[_0x0af8('0x21')]([_0x524f79,_0x3910fb])['then'](function(_0x292f6c){var _0xff0eed=_0x292f6c[0x0];var _0x48879c=_0x292f6c[0x1];var _0x521e35=_[_0x0af8('0x22')](_0xff0eed[_0x0af8('0x23')],function(_0x2c2b10){return _0x2c2b10['UserId']==_0x48879c['id'];});return _0x1cbc96[_0x0af8('0x16')](0xc8)[_0x0af8('0x32')]({'count':_0x521e35[_0x0af8('0x25')],'rows':_0x521e35});})[_0x0af8('0x1f')](handleError(_0x1cbc96));};exports[_0x0af8('0x41')]=function(_0x5c3ab9,_0x143cf){logger['info'](_0x0af8('0x42'),_0x5c3ab9['body']);var _0x2d434a=conferenceValidation[_0x0af8('0xb')](_0x5c3ab9[_0x0af8('0x28')]);if(_0x2d434a[_0x0af8('0x25')]>0x0){return _0x143cf[_0x0af8('0x16')](0x190)[_0x0af8('0x32')](_0x2d434a);}var _0x7c1b83=_0x5c3ab9[_0x0af8('0x28')][_0x0af8('0x29')];return getAgent(_0x7c1b83)['then'](function(_0x3ff94a){logger[_0x0af8('0x2d')](_0x0af8('0x2e'),_0x3ff94a['name']);emit(util['format'](_0x0af8('0x30'),_0x3ff94a[_0x0af8('0x18')]),_0x0af8('0x43'));return _0x143cf[_0x0af8('0x16')](0xc8)[_0x0af8('0x32')]({'error':![],'message':_0x0af8('0x44')});})['catch'](handleError(_0x143cf));};exports[_0x0af8('0x45')]=function(_0x5b1c3a,_0x1d496d){logger[_0x0af8('0x2d')]('transfer\x20fired:',_0x5b1c3a['body']);var _0x563d0d=transferValidation[_0x0af8('0xb')](_0x5b1c3a[_0x0af8('0x28')]);if(_0x563d0d[_0x0af8('0x25')]>0x0){return _0x1d496d[_0x0af8('0x16')](0x190)[_0x0af8('0x32')](_0x563d0d);}var _0x2ee73e=_0x5b1c3a['body'][_0x0af8('0x29')];var _0x4ba986=_0x5b1c3a[_0x0af8('0x28')]['sessionId'];var _0x27cd1c=_0x5b1c3a[_0x0af8('0x28')]['transferNumber'];return getAgent(_0x2ee73e)[_0x0af8('0x1b')](function(_0x1b06fa){logger[_0x0af8('0x2d')](_0x0af8('0x2e'),_0x1b06fa[_0x0af8('0x18')]);emit(util['format'](_0x0af8('0x30'),_0x1b06fa[_0x0af8('0x18')]),_0x0af8('0x46'),{'sessionId':_0x4ba986,'transferNumber':_0x27cd1c});return _0x1d496d[_0x0af8('0x16')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x1d496d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3cd0c8d..abc71e0 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 _0x1a85=['removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addApplications','/:id/notify','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers'];(function(_0x56de67,_0x38b95e){var _0xf51e00=function(_0x26b622){while(--_0x26b622){_0x56de67['push'](_0x56de67['shift']());}};_0xf51e00(++_0x38b95e);}(_0x1a85,0x178));var _0x51a8=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x1a85[_0x547bb6];return _0x1a9154;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./whatsappAccount.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['post']('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x13')]);router[_0x51a8('0x14')]('/:id/dispositions',auth[_0x51a8('0x9')](),controller['addDisposition']);router[_0x51a8('0x14')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x15')]);router[_0x51a8('0x14')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x14')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x16')]);router[_0x51a8('0x14')](_0x51a8('0x17'),controller['notify']);router[_0x51a8('0x14')](_0x51a8('0x18'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x19')]);router[_0x51a8('0x1a')](_0x51a8('0x1b'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router['delete'](_0x51a8('0x1b'),auth['isAuthenticated'](),controller[_0x51a8('0x1d')]);router[_0x51a8('0x1e')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller['removeDispositions']);router[_0x51a8('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51a8('0x1f')]);router['delete'](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);module[_0x51a8('0x21')]=router; \ No newline at end of file +var _0x2ef3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','/:id/notify','/:id/send','send','put','update','delete','removeAnswers'];(function(_0x569719,_0x28e9dd){var _0x368e8b=function(_0x4abb5a){while(--_0x4abb5a){_0x569719['push'](_0x569719['shift']());}};_0x368e8b(++_0x28e9dd);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d8dbb,_0x1898cc){_0x4d8dbb=_0x4d8dbb-0x0;var _0x4411f0=_0x2ef3[_0x4d8dbb];return _0x4411f0;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['get'](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['getApplications']);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x15')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x15')](_0x32ef('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x32ef('0x15')](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['addApplications']);router[_0x32ef('0x15')](_0x32ef('0x18'),controller['notify']);router[_0x32ef('0x15')](_0x32ef('0x19'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1a')]);router[_0x32ef('0x1b')](_0x32ef('0xd'),auth['isAuthenticated'](),controller[_0x32ef('0x1c')]);router['delete'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller['destroy']);router[_0x32ef('0x1d')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller['removeDispositions']);router['delete'](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1e')]);router['delete']('/:id/users',auth[_0x32ef('0xb')](),controller['removeAgents']);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 b2950b2..0edaf92 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 _0xc413=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc413,0x1e2));var _0x3c41=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc413[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x3c41('0x0'));var rs=require(_0x3c41('0x1'));module[_0x3c41('0x2')]={'name':{'type':Sequelize[_0x3c41('0x3')],'unique':_0x3c41('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3c41('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3c41('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x3c41('0x3')]},'type':{'type':Sequelize[_0x3c41('0x5')](_0x3c41('0x6'),_0x3c41('0x7'))},'accountSid':{'type':Sequelize[_0x3c41('0x3')]},'baseUrl':{'type':Sequelize[_0x3c41('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3c41('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3c41('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3c41('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c41('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c41('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3c41('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3c41('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3c41('0xa')],'comment':_0x3c41('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3c41('0xc'),'set':function(_0x5ddcaf){if(!_0x5ddcaf){this[_0x3c41('0xd')]('mandatoryDispositionPauseId',null);}this[_0x3c41('0xd')](_0x3c41('0xe'),_0x5ddcaf);}},'description':{'type':Sequelize[_0x3c41('0x3')]}}; \ No newline at end of file +var _0x08dc=['mandatoryDisposition','sequelize','name','STRING','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x416c6c,_0x16c026){var _0x1d23d8=function(_0x160772){while(--_0x160772){_0x416c6c['push'](_0x416c6c['shift']());}};_0x1d23d8(++_0x16c026);}(_0x08dc,0x1b4));var _0xc08d=function(_0x5c90c6,_0x15e096){_0x5c90c6=_0x5c90c6-0x0;var _0x17b75c=_0x08dc[_0x5c90c6];return _0x17b75c;};'use strict';var Sequelize=require(_0xc08d('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc08d('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xc08d('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc08d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc08d('0x2')]},'type':{'type':Sequelize[_0xc08d('0x3')](_0xc08d('0x4'),_0xc08d('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc08d('0x6')],'defaultValue':function(){return _0xc08d('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc08d('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc08d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc08d('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc08d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc08d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc08d('0x9')],'comment':_0xc08d('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xc08d('0x8')],'defaultValue':![],'comment':_0xc08d('0xb'),'set':function(_0x416944){if(!_0x416944){this[_0xc08d('0xc')](_0xc08d('0xd'),null);}this[_0xc08d('0xc')](_0xc08d('0xe'),_0x416944);}},'description':{'type':Sequelize[_0xc08d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7dbcc05..beb305a 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 _0xc553=['WhatsappAccount','includeAll','include','findAll','show','keys','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','params','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','pick','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','WhatsappAccountId','removeAnswers','addAgents','ids','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','update','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','replace','whatsapp:','messageId','MessageSid','from','notifications','isNil','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','CmList','Contacts','DESC','omit','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','User','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xc553,0x1e7));var _0x3c55=function(_0x2d9fdf,_0xa94c69){_0x2d9fdf=_0x2d9fdf-0x0;var _0x3e6e38=_0xc553[_0x2d9fdf];return _0x3e6e38;};'use strict';var emlformat=require(_0x3c55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c55('0x2'));var moment=require(_0x3c55('0x3'));var BPromise=require(_0x3c55('0x4'));var Mustache=require(_0x3c55('0x5'));var util=require('util');var path=require(_0x3c55('0x6'));var sox=require(_0x3c55('0x7'));var csv=require(_0x3c55('0x8'));var ejs=require(_0x3c55('0x9'));var fs=require('fs');var fs_extra=require(_0x3c55('0xa'));var _=require(_0x3c55('0xb'));var squel=require(_0x3c55('0xc'));var crypto=require(_0x3c55('0xd'));var jsforce=require(_0x3c55('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c55('0x8'));var querystring=require(_0x3c55('0xf'));var Papa=require('papaparse');var Redis=require(_0x3c55('0x10'));var authService=require(_0x3c55('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c55('0x13'))('api');var utils=require(_0x3c55('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c55('0x15'));var db=require(_0x3c55('0x16'))['db'];config[_0x3c55('0x17')]=_[_0x3c55('0x18')](config[_0x3c55('0x17')],{'host':_0x3c55('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c55('0x17')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x3c55('0x1a'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x43d34e,_0x194f94,_0x4f897e,_0x5cea18){return new BPromise(function(_0xd2d7cd,_0x2c92f0){var _0x564752=_0x5cea18||client;return _0x564752[_0x3c55('0x1b')](_0x43d34e,_0x4f897e)[_0x3c55('0x1c')](function(_0x50d68a){logger[_0x3c55('0x1d')](_0x3c55('0x1e'),_0x194f94,_0x3c55('0x1f'));logger[_0x3c55('0x20')](_0x3c55('0x21'),_0x194f94,_0x3c55('0x1f'),JSON[_0x3c55('0x22')](_0x50d68a));if(_0x50d68a[_0x3c55('0x23')]){if(_0x50d68a[_0x3c55('0x23')][_0x3c55('0x24')]===0x1f4){logger['error'](_0x3c55('0x1e'),_0x194f94,_0x50d68a['error'][_0x3c55('0x25')]);return _0x2c92f0(_0x50d68a[_0x3c55('0x23')]['message']);}logger['error'](_0x3c55('0x1e'),_0x194f94,_0x50d68a[_0x3c55('0x23')]['message']);return _0xd2d7cd(_0x50d68a[_0x3c55('0x23')][_0x3c55('0x25')]);}else{logger[_0x3c55('0x1d')](_0x3c55('0x1e'),_0x194f94,_0x3c55('0x1f'));_0xd2d7cd(_0x50d68a['result'][_0x3c55('0x25')]);}})[_0x3c55('0x26')](function(_0x10a5a6){logger[_0x3c55('0x23')](_0x3c55('0x1e'),_0x194f94,_0x10a5a6);_0x2c92f0(_0x10a5a6);});});}function respondWithStatusCode(_0x3d263d,_0x4d5b39){_0x4d5b39=_0x4d5b39||0xcc;return function(_0x42c773){if(_0x42c773){return _0x3d263d[_0x3c55('0x27')](_0x4d5b39);}return _0x3d263d[_0x3c55('0x28')](_0x4d5b39)[_0x3c55('0x29')]();};}function respondWithResult(_0x35a79b,_0xd3f76d){_0xd3f76d=_0xd3f76d||0xc8;return function(_0x5dc880){if(_0x5dc880){return _0x35a79b[_0x3c55('0x28')](_0xd3f76d)[_0x3c55('0x2a')](_0x5dc880);}};}function respondWithFilteredResult(_0x4c21b3,_0x1d2c8b){return function(_0x5d458b){if(_0x5d458b){var _0x21eb8d=typeof _0x1d2c8b[_0x3c55('0x2b')]===_0x3c55('0x2c')&&typeof _0x1d2c8b[_0x3c55('0x2d')]===_0x3c55('0x2c');var _0x3e16ae=_0x5d458b[_0x3c55('0x2e')];var _0x6e9e8b=_0x21eb8d?0x0:_0x1d2c8b[_0x3c55('0x2b')];var _0x4a3f75=_0x21eb8d?_0x5d458b[_0x3c55('0x2e')]:_0x1d2c8b[_0x3c55('0x2b')]+_0x1d2c8b[_0x3c55('0x2d')];var _0x319076;if(_0x4a3f75>=_0x3e16ae){_0x4a3f75=_0x3e16ae;_0x319076=0xc8;}else{_0x319076=0xce;}_0x4c21b3['status'](_0x319076);return _0x4c21b3[_0x3c55('0x2f')](_0x3c55('0x30'),_0x6e9e8b+'-'+_0x4a3f75+'/'+_0x3e16ae)[_0x3c55('0x2a')](_0x5d458b);}return null;};}function patchUpdates(_0x2242c8){return function(_0x396443){try{jsonpatch['apply'](_0x396443,_0x2242c8,!![]);}catch(_0x1cb8eb){return BPromise[_0x3c55('0x31')](_0x1cb8eb);}return _0x396443[_0x3c55('0x32')]();};}function saveUpdates(_0x12e203,_0x2f8c8a){return function(_0x30e70b){if(_0x30e70b){return _0x30e70b['update'](_0x12e203)[_0x3c55('0x1c')](function(_0x3d6b5e){return _0x3d6b5e;});}return null;};}function removeEntity(_0x219884,_0x46c22c){return function(_0x2110b9){if(_0x2110b9){return _0x2110b9[_0x3c55('0x33')]()[_0x3c55('0x1c')](function(){var _0x192f39=_0x2110b9[_0x3c55('0x34')]({'plain':!![]});var _0xa53cf9=_0x3c55('0x35');return db[_0x3c55('0x36')]['destroy']({'where':{'type':_0xa53cf9,'resourceId':_0x192f39['id']}})[_0x3c55('0x1c')](function(){return _0x2110b9;});})[_0x3c55('0x1c')](function(){_0x219884['status'](0xcc)[_0x3c55('0x29')]();});}};}function handleEntityNotFound(_0x2397ec,_0x4d7f3d){return function(_0x13ad12){if(!_0x13ad12){_0x2397ec[_0x3c55('0x27')](0x194);}return _0x13ad12;};}function handleError(_0x228377,_0xecbca4){_0xecbca4=_0xecbca4||0x1f4;return function(_0x28216f){logger[_0x3c55('0x23')](_0x28216f[_0x3c55('0x37')]);if(_0x28216f[_0x3c55('0x38')]){delete _0x28216f[_0x3c55('0x38')];}_0x228377[_0x3c55('0x28')](_0xecbca4)[_0x3c55('0x39')](_0x28216f);};}exports[_0x3c55('0x3a')]=function(_0x15e6fb,_0x2774e4){var _0x41140c={'include':[{'model':db[_0x3c55('0x3b')],'as':_0x3c55('0x3c')}]},_0x5ba98a={},_0x2bc356={'count':0x0,'rows':[]};var _0x40933f=_[_0x3c55('0x3d')](db['WhatsappAccount'][_0x3c55('0x3e')],function(_0x109454){return{'name':_0x109454[_0x3c55('0x3f')],'type':_0x109454[_0x3c55('0x40')]['key']};});_0x5ba98a[_0x3c55('0x41')]=_[_0x3c55('0x3d')](_0x40933f,_0x3c55('0x38'));_0x5ba98a[_0x3c55('0x42')]=_['keys'](_0x15e6fb['query']);_0x5ba98a[_0x3c55('0x43')]=_[_0x3c55('0x44')](_0x5ba98a[_0x3c55('0x41')],_0x5ba98a[_0x3c55('0x42')]);_0x41140c[_0x3c55('0x45')]=_[_0x3c55('0x44')](_0x5ba98a['model'],qs[_0x3c55('0x46')](_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x46')]));_0x41140c['attributes']=_0x41140c[_0x3c55('0x45')][_0x3c55('0x47')]?_0x41140c[_0x3c55('0x45')]:_0x5ba98a['model'];if(!_0x15e6fb[_0x3c55('0x42')]['hasOwnProperty'](_0x3c55('0x48'))){_0x41140c[_0x3c55('0x2d')]=qs['limit'](_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x2d')]);_0x41140c[_0x3c55('0x2b')]=qs[_0x3c55('0x2b')](_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x2b')]);}_0x41140c[_0x3c55('0x49')]=qs[_0x3c55('0x4a')](_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x4a')]);_0x41140c[_0x3c55('0x4b')]=qs['filters'](_['pick'](_0x15e6fb[_0x3c55('0x42')],_0x5ba98a[_0x3c55('0x43')]),_0x40933f);if(_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x4c')]){_0x41140c[_0x3c55('0x4b')]=_[_0x3c55('0x4d')](_0x41140c['where'],{'$or':_[_0x3c55('0x3d')](_0x40933f,function(_0x24eb6d){if(_0x24eb6d[_0x3c55('0x40')]!==_0x3c55('0x4e')){var _0x234617={};_0x234617[_0x24eb6d['name']]={'$like':'%'+_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x4c')]+'%'};return _0x234617;}})});}_0x41140c=_['merge']({},_0x41140c,_0x15e6fb[_0x3c55('0x4f')]);var _0x37a2cc={'where':_0x41140c['where']};return db[_0x3c55('0x50')][_0x3c55('0x2e')](_0x37a2cc)['then'](function(_0x58e552){_0x2bc356[_0x3c55('0x2e')]=_0x58e552;if(_0x15e6fb[_0x3c55('0x42')][_0x3c55('0x51')]){_0x41140c[_0x3c55('0x52')]=[{'all':!![]}];}return db[_0x3c55('0x50')][_0x3c55('0x53')](_0x41140c);})[_0x3c55('0x1c')](function(_0x1602c7){_0x2bc356['rows']=_0x1602c7;return _0x2bc356;})['then'](respondWithFilteredResult(_0x2774e4,_0x41140c))[_0x3c55('0x26')](handleError(_0x2774e4,null));};exports[_0x3c55('0x54')]=function(_0x416c0f,_0x4de4c1){var _0x120405={'raw':![],'where':{'id':_0x416c0f['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3dd6c3={};_0x3dd6c3[_0x3c55('0x41')]=_[_0x3c55('0x55')](db['WhatsappAccount'][_0x3c55('0x3e')]);_0x3dd6c3[_0x3c55('0x42')]=_['keys'](_0x416c0f['query']);_0x3dd6c3['filters']=_[_0x3c55('0x44')](_0x3dd6c3[_0x3c55('0x41')],_0x3dd6c3[_0x3c55('0x42')]);_0x120405[_0x3c55('0x45')]=_['intersection'](_0x3dd6c3['model'],qs[_0x3c55('0x46')](_0x416c0f['query']['fields']));_0x120405['attributes']=_0x120405[_0x3c55('0x45')][_0x3c55('0x47')]?_0x120405[_0x3c55('0x45')]:_0x3dd6c3[_0x3c55('0x41')];if(_0x416c0f[_0x3c55('0x42')][_0x3c55('0x51')]){_0x120405[_0x3c55('0x52')]=[{'all':!![]}];}_0x120405=_[_0x3c55('0x4d')]({},_0x120405,_0x416c0f[_0x3c55('0x4f')]);return db[_0x3c55('0x50')]['find'](_0x120405)[_0x3c55('0x1c')](handleEntityNotFound(_0x4de4c1,null))[_0x3c55('0x1c')](respondWithResult(_0x4de4c1,null))[_0x3c55('0x26')](handleError(_0x4de4c1,null));};exports[_0x3c55('0x56')]=function(_0xf59f64,_0x50873b){return db[_0x3c55('0x50')]['create'](_0xf59f64['body'],{})[_0x3c55('0x1c')](function(_0x36dc34){var _0x308955=_0xf59f64['user'][_0x3c55('0x34')]({'plain':!![]});if(!_0x308955)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x308955[_0x3c55('0x57')]===_0x3c55('0x58')){var _0x15df79=_0x36dc34['get']({'plain':!![]});var _0x5a0fdd=_0x3c55('0x35');return db[_0x3c55('0x59')][_0x3c55('0x5a')]({'where':{'name':_0x5a0fdd,'userProfileId':_0x308955[_0x3c55('0x5b')]},'raw':!![]})[_0x3c55('0x1c')](function(_0x52a5e1){if(_0x52a5e1&&_0x52a5e1[_0x3c55('0x5c')]===0x0){return db['UserProfileResource'][_0x3c55('0x56')]({'name':_0x15df79[_0x3c55('0x38')],'resourceId':_0x15df79['id'],'type':_0x52a5e1['name'],'sectionId':_0x52a5e1['id']},{})[_0x3c55('0x1c')](function(){return _0x36dc34;});}else{return _0x36dc34;}})[_0x3c55('0x26')](function(_0x13c96d){logger[_0x3c55('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13c96d);throw _0x13c96d;});}return _0x36dc34;})[_0x3c55('0x1c')](respondWithResult(_0x50873b,0xc9))['catch'](handleError(_0x50873b,null));};exports['update']=function(_0x2d7e52,_0x43accd){if(_0x2d7e52[_0x3c55('0x5d')]['id']){delete _0x2d7e52[_0x3c55('0x5d')]['id'];}return db[_0x3c55('0x50')][_0x3c55('0x5a')]({'where':{'id':_0x2d7e52[_0x3c55('0x5e')]['id']},'include':[{'model':db[_0x3c55('0x3b')],'as':_0x3c55('0x3c')}]})[_0x3c55('0x1c')](handleEntityNotFound(_0x43accd,null))[_0x3c55('0x1c')](saveUpdates(_0x2d7e52[_0x3c55('0x5d')],null))['then'](respondWithResult(_0x43accd,null))[_0x3c55('0x26')](handleError(_0x43accd,null));};exports[_0x3c55('0x33')]=function(_0x426eb8,_0x173dda){return db[_0x3c55('0x50')]['find']({'where':{'id':_0x426eb8[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x173dda,null))[_0x3c55('0x1c')](removeEntity(_0x173dda,null))[_0x3c55('0x26')](handleError(_0x173dda,null));};exports['describe']=function(_0x43098e,_0x2dc84f){return db[_0x3c55('0x50')]['describe']()[_0x3c55('0x1c')](respondWithResult(_0x2dc84f,null))[_0x3c55('0x26')](handleError(_0x2dc84f,null));};exports[_0x3c55('0x5f')]=function(_0x51a866,_0x1e5a53,_0x206901){if(_0x51a866[_0x3c55('0x5d')]['id']){delete _0x51a866[_0x3c55('0x5d')]['id'];}return db[_0x3c55('0x50')][_0x3c55('0x5a')]({'where':{'id':_0x51a866['params']['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x1e5a53,null))[_0x3c55('0x1c')](function(_0x398784){if(_0x398784){_0x51a866['body']['WhatsappAccountId']=_0x398784['id'];return db[_0x3c55('0x60')]['create'](_0x51a866[_0x3c55('0x5d')]);}})[_0x3c55('0x1c')](respondWithResult(_0x1e5a53,null))[_0x3c55('0x26')](handleError(_0x1e5a53,null));};exports[_0x3c55('0x61')]=function(_0x140ad5,_0x2fae4d,_0x193402){var _0x43db04={'raw':![],'where':{}};var _0x2288fc={};var _0x54683f={'count':0x0,'rows':[]};return db[_0x3c55('0x50')][_0x3c55('0x62')]({'where':{'id':_0x140ad5[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x2fae4d,null))[_0x3c55('0x1c')](function(_0x248357){if(_0x248357){_0x2288fc[_0x3c55('0x41')]=_[_0x3c55('0x55')](db['Disposition'][_0x3c55('0x3e')]);_0x2288fc[_0x3c55('0x42')]=_[_0x3c55('0x55')](_0x140ad5['query']);_0x2288fc['filters']=_[_0x3c55('0x44')](_0x2288fc[_0x3c55('0x41')],_0x2288fc[_0x3c55('0x42')]);_0x43db04[_0x3c55('0x45')]=_['intersection'](_0x2288fc[_0x3c55('0x41')],qs[_0x3c55('0x46')](_0x140ad5['query']['fields']));_0x43db04[_0x3c55('0x45')]=_0x43db04[_0x3c55('0x45')][_0x3c55('0x47')]?_0x43db04['attributes']:_0x2288fc[_0x3c55('0x41')];if(!_0x140ad5[_0x3c55('0x42')][_0x3c55('0x63')](_0x3c55('0x48'))){_0x43db04[_0x3c55('0x2d')]=qs[_0x3c55('0x2d')](_0x140ad5[_0x3c55('0x42')]['limit']);_0x43db04[_0x3c55('0x2b')]=qs[_0x3c55('0x2b')](_0x140ad5[_0x3c55('0x42')]['offset']);}_0x43db04[_0x3c55('0x49')]=qs[_0x3c55('0x4a')](_0x140ad5[_0x3c55('0x42')][_0x3c55('0x4a')]);_0x43db04[_0x3c55('0x4b')]=qs[_0x3c55('0x43')](_[_0x3c55('0x64')](_0x140ad5[_0x3c55('0x42')],_0x2288fc[_0x3c55('0x43')]));_0x43db04[_0x3c55('0x4b')]['WhatsappAccountId']=_0x248357['id'];if(_0x140ad5[_0x3c55('0x42')][_0x3c55('0x4c')]){_0x43db04[_0x3c55('0x4b')]=_[_0x3c55('0x4d')](_0x43db04[_0x3c55('0x4b')],{'$or':_[_0x3c55('0x3d')](_0x43db04[_0x3c55('0x45')],function(_0x35730a){var _0x93b581={};_0x93b581[_0x35730a]={'$like':'%'+_0x140ad5[_0x3c55('0x42')][_0x3c55('0x4c')]+'%'};return _0x93b581;})});}_0x43db04=_[_0x3c55('0x4d')]({},_0x43db04,_0x140ad5['options']);return db['Disposition']['count']({'where':_0x43db04[_0x3c55('0x4b')]})[_0x3c55('0x1c')](function(_0x47c509){_0x54683f[_0x3c55('0x2e')]=_0x47c509;if(_0x140ad5['query'][_0x3c55('0x51')]){_0x43db04[_0x3c55('0x52')]=[{'all':!![]}];}return db[_0x3c55('0x60')][_0x3c55('0x53')](_0x43db04);})['then'](function(_0xe380cf){_0x54683f[_0x3c55('0x65')]=_0xe380cf;return _0x54683f;});}})['then'](respondWithFilteredResult(_0x2fae4d,_0x43db04))[_0x3c55('0x26')](handleError(_0x2fae4d,null));};exports['removeDispositions']=function(_0x2ab5e6,_0x388d32,_0x4a9138){return db[_0x3c55('0x50')][_0x3c55('0x5a')]({'where':{'id':_0x2ab5e6[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x388d32,null))[_0x3c55('0x1c')](function(_0xc9903a){if(_0xc9903a){return _0xc9903a[_0x3c55('0x66')](_0x2ab5e6[_0x3c55('0x42')]['ids']);}})[_0x3c55('0x1c')](respondWithStatusCode(_0x388d32,null))[_0x3c55('0x26')](handleError(_0x388d32,null));};exports[_0x3c55('0x67')]=function(_0x2a9028,_0x24ce2c,_0x5de6f6){if(_0x2a9028['body']['id']){delete _0x2a9028['body']['id'];}return db[_0x3c55('0x50')][_0x3c55('0x5a')]({'where':{'id':_0x2a9028[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x24ce2c,null))[_0x3c55('0x1c')](function(_0x22971d){if(_0x22971d){_0x2a9028['body']['WhatsappAccountId']=_0x22971d['id'];return db[_0x3c55('0x68')][_0x3c55('0x56')](_0x2a9028[_0x3c55('0x5d')]);}})[_0x3c55('0x1c')](respondWithResult(_0x24ce2c,null))[_0x3c55('0x26')](handleError(_0x24ce2c,null));};exports[_0x3c55('0x69')]=function(_0x257037,_0x2f7187,_0x23a93a){var _0xe5a1d3={'raw':![],'where':{}};var _0x12eacb={};var _0x28bdf2={'count':0x0,'rows':[]};return db[_0x3c55('0x50')][_0x3c55('0x62')]({'where':{'id':_0x257037[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x2f7187,null))['then'](function(_0x1e95a9){if(_0x1e95a9){_0x12eacb[_0x3c55('0x41')]=_[_0x3c55('0x55')](db[_0x3c55('0x68')]['rawAttributes']);_0x12eacb['query']=_[_0x3c55('0x55')](_0x257037[_0x3c55('0x42')]);_0x12eacb[_0x3c55('0x43')]=_['intersection'](_0x12eacb[_0x3c55('0x41')],_0x12eacb[_0x3c55('0x42')]);_0xe5a1d3['attributes']=_[_0x3c55('0x44')](_0x12eacb[_0x3c55('0x41')],qs[_0x3c55('0x46')](_0x257037[_0x3c55('0x42')]['fields']));_0xe5a1d3[_0x3c55('0x45')]=_0xe5a1d3[_0x3c55('0x45')][_0x3c55('0x47')]?_0xe5a1d3[_0x3c55('0x45')]:_0x12eacb[_0x3c55('0x41')];if(!_0x257037[_0x3c55('0x42')]['hasOwnProperty'](_0x3c55('0x48'))){_0xe5a1d3[_0x3c55('0x2d')]=qs[_0x3c55('0x2d')](_0x257037[_0x3c55('0x42')][_0x3c55('0x2d')]);_0xe5a1d3[_0x3c55('0x2b')]=qs[_0x3c55('0x2b')](_0x257037['query'][_0x3c55('0x2b')]);}_0xe5a1d3[_0x3c55('0x49')]=qs['sort'](_0x257037[_0x3c55('0x42')][_0x3c55('0x4a')]);_0xe5a1d3[_0x3c55('0x4b')]=qs['filters'](_['pick'](_0x257037[_0x3c55('0x42')],_0x12eacb['filters']));_0xe5a1d3[_0x3c55('0x4b')][_0x3c55('0x6a')]=_0x1e95a9['id'];if(_0x257037[_0x3c55('0x42')][_0x3c55('0x4c')]){_0xe5a1d3[_0x3c55('0x4b')]=_[_0x3c55('0x4d')](_0xe5a1d3[_0x3c55('0x4b')],{'$or':_[_0x3c55('0x3d')](_0xe5a1d3[_0x3c55('0x45')],function(_0x106d74){var _0x56d8f9={};_0x56d8f9[_0x106d74]={'$like':'%'+_0x257037[_0x3c55('0x42')][_0x3c55('0x4c')]+'%'};return _0x56d8f9;})});}_0xe5a1d3=_['merge']({},_0xe5a1d3,_0x257037[_0x3c55('0x4f')]);return db[_0x3c55('0x68')][_0x3c55('0x2e')]({'where':_0xe5a1d3[_0x3c55('0x4b')]})[_0x3c55('0x1c')](function(_0x28c190){_0x28bdf2[_0x3c55('0x2e')]=_0x28c190;if(_0x257037[_0x3c55('0x42')][_0x3c55('0x51')]){_0xe5a1d3['include']=[{'all':!![]}];}return db[_0x3c55('0x68')][_0x3c55('0x53')](_0xe5a1d3);})[_0x3c55('0x1c')](function(_0x88f49e){_0x28bdf2[_0x3c55('0x65')]=_0x88f49e;return _0x28bdf2;});}})['then'](respondWithFilteredResult(_0x2f7187,_0xe5a1d3))['catch'](handleError(_0x2f7187,null));};exports[_0x3c55('0x6b')]=function(_0x5324d8,_0x4fef1e,_0x223579){return db[_0x3c55('0x50')][_0x3c55('0x5a')]({'where':{'id':_0x5324d8['params']['id']}})['then'](handleEntityNotFound(_0x4fef1e,null))[_0x3c55('0x1c')](function(_0x478929){if(_0x478929){return _0x478929[_0x3c55('0x6b')](_0x5324d8[_0x3c55('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x4fef1e,null))[_0x3c55('0x26')](handleError(_0x4fef1e,null));};exports[_0x3c55('0x6c')]=function(_0x33b4a6,_0x26d747,_0x10fe71){return db[_0x3c55('0x50')]['find']({'where':{'id':_0x33b4a6[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x26d747,null))['then'](function(_0x4dc1de){if(_0x4dc1de){return _0x4dc1de['addAgents'](_0x33b4a6['body'][_0x3c55('0x6d')],_['omit'](_0x33b4a6[_0x3c55('0x5d')],[_0x3c55('0x6d'),'id'])||{})[_0x3c55('0x6e')](function(_0x510e65){for(var _0x30cb4f=0x0;_0x30cb4f<_0x33b4a6[_0x3c55('0x5d')][_0x3c55('0x6d')][_0x3c55('0x47')];_0x30cb4f+=0x1){socket[_0x3c55('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x33b4a6[_0x3c55('0x5d')]['ids'][_0x30cb4f]),'WhatsappAccountId':Number(_0x33b4a6[_0x3c55('0x5e')]['id'])});}return _0x510e65;});}})[_0x3c55('0x1c')](respondWithResult(_0x26d747,null))[_0x3c55('0x26')](handleError(_0x26d747,null));};exports[_0x3c55('0x70')]=function(_0xf5d57,_0x48f764,_0x257904){return db['WhatsappAccount'][_0x3c55('0x5a')]({'where':{'id':_0xf5d57[_0x3c55('0x5e')]['id']}})['then'](handleEntityNotFound(_0x48f764,null))[_0x3c55('0x1c')](function(_0x45e27a){if(_0x45e27a){return _0x45e27a['removeAgents'](_0xf5d57[_0x3c55('0x42')][_0x3c55('0x6d')])[_0x3c55('0x1c')](function(){if(_[_0x3c55('0x71')](_0xf5d57[_0x3c55('0x42')][_0x3c55('0x6d')])){for(var _0x4abb7e=0x0;_0x4abb7e<_0xf5d57['query'][_0x3c55('0x6d')][_0x3c55('0x47')];_0x4abb7e+=0x1){socket['emit'](_0x3c55('0x72'),{'UserId':Number(_0xf5d57[_0x3c55('0x42')][_0x3c55('0x6d')][_0x4abb7e]),'WhatsappAccountId':Number(_0xf5d57[_0x3c55('0x5e')]['id'])});}}else{socket[_0x3c55('0x6f')](_0x3c55('0x72'),{'UserId':Number(_0xf5d57[_0x3c55('0x42')][_0x3c55('0x6d')]),'WhatsappAccountId':Number(_0xf5d57[_0x3c55('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x48f764,null))['catch'](handleError(_0x48f764,null));};exports[_0x3c55('0x73')]=function(_0x21f64b,_0x4f2243,_0x1b2c62){var _0xb4d1c4={};var _0x12f6fc={};var _0x1d73f5;var _0x5604d0;return db[_0x3c55('0x50')][_0x3c55('0x62')]({'where':{'id':_0x21f64b[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x4f2243,null))[_0x3c55('0x1c')](function(_0x3dc94b){if(_0x3dc94b){_0x1d73f5=_0x3dc94b;_0x12f6fc[_0x3c55('0x41')]=_[_0x3c55('0x55')](db['User'][_0x3c55('0x3e')]);_0x12f6fc['query']=_[_0x3c55('0x55')](_0x21f64b[_0x3c55('0x42')]);_0x12f6fc['filters']=_['intersection'](_0x12f6fc['model'],_0x12f6fc[_0x3c55('0x42')]);_0xb4d1c4[_0x3c55('0x45')]=_[_0x3c55('0x44')](_0x12f6fc['model'],qs[_0x3c55('0x46')](_0x21f64b[_0x3c55('0x42')]['fields']));_0xb4d1c4[_0x3c55('0x45')]=_0xb4d1c4['attributes'][_0x3c55('0x47')]?_0xb4d1c4[_0x3c55('0x45')]:_0x12f6fc[_0x3c55('0x41')];_0xb4d1c4['order']=qs[_0x3c55('0x4a')](_0x21f64b['query'][_0x3c55('0x4a')]);_0xb4d1c4[_0x3c55('0x4b')]=qs[_0x3c55('0x43')](_[_0x3c55('0x64')](_0x21f64b[_0x3c55('0x42')],_0x12f6fc[_0x3c55('0x43')]));if(_0x21f64b[_0x3c55('0x42')][_0x3c55('0x4c')]){_0xb4d1c4[_0x3c55('0x4b')]=_[_0x3c55('0x4d')](_0xb4d1c4['where'],{'$or':_[_0x3c55('0x3d')](_0xb4d1c4[_0x3c55('0x45')],function(_0xe35849){var _0x414bc4={};_0x414bc4[_0xe35849]={'$like':'%'+_0x21f64b[_0x3c55('0x42')][_0x3c55('0x4c')]+'%'};return _0x414bc4;})});}_0xb4d1c4=_[_0x3c55('0x4d')]({},_0xb4d1c4,_0x21f64b[_0x3c55('0x4f')]);return _0x1d73f5['getAgents'](_0xb4d1c4);}})[_0x3c55('0x1c')](function(_0x40964a){if(_0x40964a){_0x5604d0=_0x40964a[_0x3c55('0x47')];if(!_0x21f64b['query'][_0x3c55('0x63')](_0x3c55('0x48'))){_0xb4d1c4[_0x3c55('0x2d')]=qs[_0x3c55('0x2d')](_0x21f64b[_0x3c55('0x42')][_0x3c55('0x2d')]);_0xb4d1c4[_0x3c55('0x2b')]=qs['offset'](_0x21f64b[_0x3c55('0x42')][_0x3c55('0x2b')]);}return _0x1d73f5[_0x3c55('0x73')](_0xb4d1c4);}})[_0x3c55('0x1c')](function(_0x9ced6a){if(_0x9ced6a){return _0x9ced6a?{'count':_0x5604d0,'rows':_0x9ced6a}:null;}})[_0x3c55('0x1c')](respondWithResult(_0x4f2243,null))[_0x3c55('0x26')](handleError(_0x4f2243,null));};exports[_0x3c55('0x74')]=function(_0x79a468,_0x5a7d01){var _0x5e9206=_0x79a468['params']['id'];var _0x3678f6=_0x79a468['body'];var _0x3b11e5=0xc8;var _0x293340=null;return db[_0x3c55('0x75')]['transaction']({'isolationLevel':db[_0x3c55('0x75')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xa02207){return db[_0x3c55('0x50')]['findOne']({'where':{'id':_0x5e9206},'transaction':_0xa02207})[_0x3c55('0x1c')](function(_0x264cc3){if(_0x264cc3){return db[_0x3c55('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x5e9206},'transaction':_0xa02207})[_0x3c55('0x1c')](function(){var _0x285bf8=_[_0x3c55('0x3d')](_0x3678f6,function(_0x523fd9){_0x523fd9[_0x3c55('0x6a')]=_0x5e9206;return _0x523fd9;});return db[_0x3c55('0x76')]['bulkCreate'](_0x285bf8,{'transaction':_0xa02207});});}else{_0x3b11e5=0x194;_0x293340=[];}});})[_0x3c55('0x1c')](function(){if(_0x3b11e5!==0x194){return db[_0x3c55('0x76')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x5e9206},'order':'priority'})[_0x3c55('0x1c')](function(_0x1514e5){_0x293340=_0x1514e5;});}})['catch'](function(_0x14e662){_0x3b11e5=0x1f4;logger[_0x3c55('0x23')](_0x14e662['stack']);if(_0x14e662[_0x3c55('0x38')]){delete _0x14e662[_0x3c55('0x38')];}_0x293340=_0x14e662;})[_0x3c55('0x77')](function(){if(_0x293340===null){_0x5a7d01['sendStatus'](_0x3b11e5);}else{if(_0x3b11e5===0x1f4){_0x5a7d01['status'](_0x3b11e5)['send'](_0x293340);}else{_0x5a7d01[_0x3c55('0x28')](_0x3b11e5)['json'](_0x293340);}}});};exports[_0x3c55('0x78')]=function(_0xacdb25,_0x18be35,_0x28a3d5){var _0x46346e={};var _0x5e2dc4={};var _0x20a007;var _0xdcf0b0;return db[_0x3c55('0x50')][_0x3c55('0x62')]({'where':{'id':_0xacdb25[_0x3c55('0x5e')]['id']}})[_0x3c55('0x1c')](handleEntityNotFound(_0x18be35,null))[_0x3c55('0x1c')](function(_0x4dff28){if(_0x4dff28){_0x20a007=_0x4dff28;_0x5e2dc4['model']=_[_0x3c55('0x55')](db['WhatsappApplication'][_0x3c55('0x3e')]);_0x5e2dc4[_0x3c55('0x42')]=_[_0x3c55('0x55')](_0xacdb25[_0x3c55('0x42')]);_0x5e2dc4['filters']=_['intersection'](_0x5e2dc4[_0x3c55('0x41')],_0x5e2dc4['query']);_0x46346e[_0x3c55('0x45')]=_[_0x3c55('0x44')](_0x5e2dc4[_0x3c55('0x41')],qs['fields'](_0xacdb25[_0x3c55('0x42')][_0x3c55('0x46')]));_0x46346e['attributes']=_0x46346e[_0x3c55('0x45')][_0x3c55('0x47')]?_0x46346e['attributes']:_0x5e2dc4[_0x3c55('0x41')];_0x46346e[_0x3c55('0x49')]=qs[_0x3c55('0x4a')](_0xacdb25['query'][_0x3c55('0x4a')]);_0x46346e['where']=qs[_0x3c55('0x43')](_[_0x3c55('0x64')](_0xacdb25[_0x3c55('0x42')],_0x5e2dc4[_0x3c55('0x43')]));if(_0xacdb25[_0x3c55('0x42')]['filter']){_0x46346e[_0x3c55('0x4b')]=_[_0x3c55('0x4d')](_0x46346e['where'],{'$or':_[_0x3c55('0x3d')](_0x46346e[_0x3c55('0x45')],function(_0x2f4ae3){var _0x214d10={};_0x214d10[_0x2f4ae3]={'$like':'%'+_0xacdb25[_0x3c55('0x42')]['filter']+'%'};return _0x214d10;})});}_0x46346e=_[_0x3c55('0x4d')]({},_0x46346e,_0xacdb25[_0x3c55('0x4f')]);return _0x20a007[_0x3c55('0x78')](_0x46346e);}})[_0x3c55('0x1c')](function(_0x1c22a9){if(_0x1c22a9){_0xdcf0b0=_0x1c22a9[_0x3c55('0x47')];if(!_0xacdb25['query'][_0x3c55('0x63')](_0x3c55('0x48'))){_0x46346e[_0x3c55('0x2d')]=qs[_0x3c55('0x2d')](_0xacdb25[_0x3c55('0x42')][_0x3c55('0x2d')]);_0x46346e[_0x3c55('0x2b')]=qs[_0x3c55('0x2b')](_0xacdb25['query'][_0x3c55('0x2b')]);}return _0x20a007[_0x3c55('0x78')](_0x46346e);}})[_0x3c55('0x1c')](function(_0xfe9fb0){if(_0xfe9fb0){return _0xfe9fb0?{'count':_0xdcf0b0,'rows':_0xfe9fb0}:null;}})['then'](respondWithResult(_0x18be35,null))[_0x3c55('0x26')](handleError(_0x18be35,null));};exports[_0x3c55('0x79')]=function(_0x3d597f,_0x567c62,_0x23f9f3){var _0x17cb05={'channel':_0x3c55('0x7a')};var _0x55b1e0=[];var _0x2d0f5c=[];var _0x28feed={};return db[_0x3c55('0x50')]['find']({'where':{'id':_0x3d597f[_0x3c55('0x5e')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3c55('0x7b')}]})[_0x3c55('0x1c')](handleEntityNotFound(_0x567c62,null))['then'](function(_0x4d35f6){_0x17cb05[_0x3c55('0x7c')]=_0x4d35f6;if(_0x17cb05['account']&&_0x17cb05[_0x3c55('0x7c')]['type']===_0x3c55('0x7d')&&_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x7e')]){if(_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x7e')][_0x3c55('0x47')]===0x0)return;if(_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x7e')][0x0][_0x3c55('0x7f')]!==_0x3c55('0x80'))return;return db['WhatsappMessage'][_0x3c55('0x81')]({'read':!![],'readAt':_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x7e')][0x0][_0x3c55('0x82')]},{'where':{'messageId':_0x3d597f[_0x3c55('0x5d')]['statuses'][0x0][_0x3c55('0x83')]},'individualHooks':!![]})['then'](function(_0x333573){return _0x567c62[_0x3c55('0x28')](0xc8)[_0x3c55('0x2a')](_0x333573);});}_0x17cb05[_0x3c55('0x84')]=_[_0x3c55('0x85')](_0x4d35f6[_0x3c55('0x7b')],[_0x3c55('0x86')],[_0x3c55('0x87')]);if(_0x17cb05[_0x3c55('0x7c')][_0x3c55('0x7b')]){delete _0x17cb05[_0x3c55('0x7c')][_0x3c55('0x7b')];}return db[_0x3c55('0x88')]['describe']()[_0x3c55('0x1c')](function(_0x2844cd){if(!_0x2844cd){throw new db[(_0x3c55('0x89'))][(_0x3c55('0x8a'))](_0x3c55('0x8b'));}_0x55b1e0=_[_0x3c55('0x8c')](_[_0x3c55('0x55')](_0x2844cd),[_0x3c55('0x8d'),_0x3c55('0x8e')]);_0x2d0f5c=_['difference'](_[_0x3c55('0x55')](_0x2844cd),[_0x3c55('0x8d'),_0x3c55('0x8e'),'CompanyId',_0x3c55('0x8f')]);_0x17cb05[_0x3c55('0x5d')]={'mapKey':_0x3c55('0x90')};if(_0x17cb05[_0x3c55('0x7c')]&&_0x17cb05[_0x3c55('0x7c')][_0x3c55('0x40')]===_0x3c55('0x91')){_0x17cb05[_0x3c55('0x5d')]['from']=_0x3d597f[_0x3c55('0x5d')]['From'][_0x3c55('0x92')](_0x3c55('0x93'),'');_0x17cb05['body']['body']=_0x3d597f['body']['Body'];_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x94')]=_0x3d597f['body'][_0x3c55('0x95')];}if(_0x17cb05[_0x3c55('0x7c')]&&_0x17cb05[_0x3c55('0x7c')][_0x3c55('0x40')]==='sinch'){_0x17cb05['body'][_0x3c55('0x96')]=_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x97')][0x0]['from'];_0x17cb05['body'][_0x3c55('0x5d')]=_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x97')][0x0][_0x3c55('0x25')][_0x3c55('0x5d')];_0x17cb05['body'][_0x3c55('0x94')]=_0x3d597f[_0x3c55('0x5d')][_0x3c55('0x97')][0x0]['message_id'];}if(_0x17cb05[_0x3c55('0x5d')]['id']){delete _0x17cb05[_0x3c55('0x5d')]['id'];}if(_[_0x3c55('0x98')](_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x96')])){throw new db[(_0x3c55('0x89'))]['ValidationError'](_0x3c55('0x99'));}if(_[_0x3c55('0x98')](_0x17cb05[_0x3c55('0x5d')]['body'])||_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x5d')]===''){throw new db[(_0x3c55('0x89'))][(_0x3c55('0x8a'))](_0x3c55('0x9a'));}if(_[_0x3c55('0x98')](_0x17cb05[_0x3c55('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x3c55('0x8a'))](_0x3c55('0x9b')+_0x2d0f5c);}if(!_['includes'](_0x2d0f5c,_0x17cb05['body'][_0x3c55('0x9c')])){throw new db[(_0x3c55('0x89'))][(_0x3c55('0x8a'))](_0x3c55('0x9d')+_0x2d0f5c);}_0x28feed[_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x9c')]]=_0x17cb05['body'][_0x3c55('0x96')];return db[_0x3c55('0x9e')][_0x3c55('0x5a')]({'where':{'id':_0x17cb05[_0x3c55('0x7c')]['ListId']},'include':[{'model':db[_0x3c55('0x88')],'as':_0x3c55('0x9f'),'where':_0x28feed,'limit':0x1,'order':[[_0x3c55('0x8e'),_0x3c55('0xa0')]]}]});})['then'](handleEntityNotFound(_0x567c62,null))[_0x3c55('0x1c')](function(_0x5eeb08){if(_0x5eeb08){_0x17cb05['list']=_[_0x3c55('0xa1')](_0x5eeb08,['Contacts']);if(_0x5eeb08[_0x3c55('0x9f')][_0x3c55('0x47')]){return _0x5eeb08['Contacts'][0x0];}var _0x4dcc9c=_['defaults'](_0x17cb05[_0x3c55('0x5d')],{'firstName':_0x17cb05[_0x3c55('0x5d')]['from'],'ListId':_0x5eeb08['id']});_0x4dcc9c[_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x9c')]]=_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x96')];return db[_0x3c55('0x88')][_0x3c55('0x56')](_0x4dcc9c,{'fields':_0x55b1e0,'raw':!![]});}})[_0x3c55('0x1c')](handleEntityNotFound(_0x567c62,null))[_0x3c55('0x1c')](function(_0x476ce8){if(_0x476ce8){_0x17cb05['contact']=_0x476ce8;var _0x44a9e5={'ContactId':_0x476ce8['id'],'phone':_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x96')],'WhatsappAccountId':_0x3d597f['params']['id']};var _0x4154f7={'ContactId':_0x476ce8['id'],'WhatsappAccountId':_0x3d597f['params']['id'],'closed':![]};return db[_0x3c55('0xa2')][_0x3c55('0x5a')]({'where':_0x4154f7})['then'](function(_0x246f93){if(_0x246f93){return[_0x246f93,![]];}return db[_0x3c55('0xa2')][_0x3c55('0x56')](_0x44a9e5)['then'](function(_0x326218){return[_0x326218,!![]];});});}})['spread'](function(_0x2d8ee3,_0x40935d){_0x17cb05[_0x3c55('0xa3')]=_0x2d8ee3[_0x3c55('0x34')]({'plain':!![]});_0x17cb05['interaction'][_0x3c55('0xa4')]=![];if(_0x40935d){if(_0x17cb05[_0x3c55('0x7c')][_0x3c55('0xa5')]){_0x17cb05[_0x3c55('0x84')][_0x3c55('0xa6')]({'id':0x0,'priority':_0x17cb05[_0x3c55('0x84')][_0x3c55('0x47')]+0x1,'app':_0x3c55('0xa7'),'appdata':_0x3c55('0xa8'),'interval':_0x3c55('0xa9')});}_0x17cb05[_0x3c55('0xa3')]['created']=!![];}return db[_0x3c55('0xaa')]['create']({'phone':_0x17cb05['body'][_0x3c55('0x96')],'messageId':_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x94')],'body':_0x17cb05[_0x3c55('0x5d')][_0x3c55('0x5d')],'WhatsappAccountId':_0x3d597f[_0x3c55('0x5e')]['id'],'WhatsappInteractionId':_0x2d8ee3['id'],'direction':'in','ContactId':_0x2d8ee3[_0x3c55('0xab')],'AttachmentId':_0x17cb05[_0x3c55('0x5d')]['AttachmentId']});})[_0x3c55('0x1c')](function(_0x5f17f2){_0x17cb05['message']=_0x5f17f2;if(_0x17cb05[_0x3c55('0xa3')]['UserId']){return db[_0x3c55('0xac')]['find']({'attributes':['id',_0x3c55('0x38')],'where':{'id':_0x17cb05[_0x3c55('0xa3')][_0x3c55('0xad')]}})['then'](function(_0xa3fc9a){if(_0xa3fc9a){_0x17cb05[_0x3c55('0x84')][_0x3c55('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa3fc9a[_0x3c55('0x38')]+','+(_0x17cb05['account'][_0x3c55('0xaf')]||0xa),'interval':_0x3c55('0xa9')});}return respondWithRpcPromise(_0x3c55('0xb0'),'startRouting',_0x17cb05);});}return respondWithRpcPromise(_0x3c55('0xb0'),_0x3c55('0xb1'),_0x17cb05);})[_0x3c55('0x1c')](function(_0x930e08){if(_0x930e08){var _0x59a70b=0xc8;var _0x2f92d1=_0x3c55('0xb2');logger[_0x3c55('0x1d')](_0x3c55('0x21'),_0x2f92d1,_0x59a70b,'entity\x20found');logger[_0x3c55('0x20')](_0x3c55('0xb3'),_0x2f92d1,_0x59a70b,_0x3c55('0xb4'),JSON[_0x3c55('0x22')](_0x930e08));if(_0x17cb05[_0x3c55('0x7c')][_0x3c55('0x40')]===_0x3c55('0x91')){return _0x567c62[_0x3c55('0x28')](_0x59a70b)[_0x3c55('0x2f')](_0x3c55('0xb5'),_0x3c55('0xb6'))[_0x3c55('0x39')](_0x3c55('0xb7'));}else{return _0x567c62[_0x3c55('0x28')](_0x59a70b)[_0x3c55('0x2a')](_0x930e08);}}});})['catch'](handleError(_0x567c62,null));};exports['send']=function(_0x3ddbd3,_0x723d05,_0x451a9a){var _0x37ca00,_0x2ee6be,_0x531741;if(_[_0x3c55('0x98')](_0x3ddbd3['body'][_0x3c55('0x5d')])||_0x3ddbd3[_0x3c55('0x5d')][_0x3c55('0x5d')]===''){throw new db[(_0x3c55('0x89'))][(_0x3c55('0x8a'))](_0x3c55('0x9a'));}if(_[_0x3c55('0x98')](_0x3ddbd3['body']['to'])){throw new db[(_0x3c55('0x89'))][(_0x3c55('0x8a'))](_0x3c55('0xb8'));}_0x37ca00=_0x3ddbd3['body']['to'];return db['WhatsappAccount'][_0x3c55('0x5a')]({'where':{'id':_0x3ddbd3[_0x3c55('0x5e')]['id']},'include':[{'model':db[_0x3c55('0x9e')],'as':_0x3c55('0xb9'),'include':[{'model':db[_0x3c55('0x88')],'as':_0x3c55('0x9f'),'where':{'mobile':_0x37ca00},'limit':0x1,'order':[[_0x3c55('0x8e'),'DESC']]}]}]})[_0x3c55('0x1c')](handleEntityNotFound(_0x723d05,null))['then'](function(_0x2010ee){if(_0x2010ee&&_0x2010ee[_0x3c55('0xb9')]){_0x2ee6be=_0x2010ee[_0x3c55('0x34')]({'plain':!![]});if(_0x2ee6be[_0x3c55('0xb9')]&&_0x2ee6be[_0x3c55('0xb9')][_0x3c55('0x9f')]['length']){return _0x2ee6be['List'][_0x3c55('0x9f')][0x0];}return db[_0x3c55('0x88')][_0x3c55('0x56')](_[_0x3c55('0x18')](_0x3ddbd3[_0x3c55('0x5d')],{'firstName':_0x37ca00,'mobile':_0x37ca00,'phone':_0x37ca00,'ListId':_0x2ee6be[_0x3c55('0x8f')]}));}})[_0x3c55('0x1c')](handleEntityNotFound(_0x723d05,null))[_0x3c55('0x1c')](function(_0x4e7079){if(_0x4e7079){_0x531741=_0x4e7079;return db['WhatsappInteraction'][_0x3c55('0x5a')]({'where':{'ContactId':_0x531741['id'],'closed':![],'WhatsappAccountId':_0x2ee6be['id']}})['then'](function(_0x368b85){if(_0x368b85){return[_0x368b85,![]];}return db[_0x3c55('0xa2')][_0x3c55('0x56')]({'UserId':_0x3ddbd3[_0x3c55('0x58')]['id'],'ContactId':_0x531741['id'],'WhatsappAccountId':_0x2ee6be['id'],'phone':_0x37ca00,'firstMsgDirection':_0x3c55('0xba'),'Messages':[_[_0x3c55('0x4d')](_0x3ddbd3['body'],{'read':![],'body':_0x3ddbd3[_0x3c55('0x5d')][_0x3c55('0x5d')],'phone':_0x37ca00,'WhatsappAccountId':_0x2ee6be['id'],'UserId':_0x3ddbd3['user']['id'],'ContactId':_0x531741['id']})]},{'include':[{'model':db[_0x3c55('0xaa')],'as':_0x3c55('0xbb')}]})[_0x3c55('0x1c')](function(_0x30808e){return[_0x30808e,!![]];});});}})[_0x3c55('0x6e')](function(_0x564ec5,_0x423fee){if(_0x423fee){return _0x564ec5;}return db['WhatsappMessage'][_0x3c55('0x56')](_[_0x3c55('0x4d')](_0x3ddbd3['body'],{'read':![],'body':_0x3ddbd3[_0x3c55('0x5d')][_0x3c55('0x5d')],'phone':_0x37ca00,'WhatsappAccountId':_0x2ee6be['id'],'WhatsappInteractionId':_0x564ec5['id'],'UserId':_0x3ddbd3['user']['id'],'ContactId':_0x531741['id']}))[_0x3c55('0x1c')](function(_0x393374){_0x564ec5['dataValues'][_0x3c55('0xbb')]=[];_0x564ec5[_0x3c55('0xbc')][_0x3c55('0xbb')][_0x3c55('0xa6')](_0x393374[_0x3c55('0xbc')]);return _0x564ec5;});})['then'](respondWithResult(_0x723d05,null))[_0x3c55('0x26')](handleError(_0x723d05,null));}; \ No newline at end of file +var _0x16d3=['jayson/promise','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','Pause','model','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','messageId','MessageSid','notifications','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','push','applications','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','startRouting','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x581d49,_0x52fcf4){var _0x95f460=function(_0x289d70){while(--_0x289d70){_0x581d49['push'](_0x581d49['shift']());}};_0x95f460(++_0x52fcf4);}(_0x16d3,0x16a));var _0x316d=function(_0x20be7e,_0x56db99){_0x20be7e=_0x20be7e-0x0;var _0x43728c=_0x16d3[_0x20be7e];return _0x43728c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x316d('0x0'));var jsonpatch=require(_0x316d('0x1'));var rp=require('request-promise');var moment=require(_0x316d('0x2'));var BPromise=require(_0x316d('0x3'));var Mustache=require(_0x316d('0x4'));var util=require(_0x316d('0x5'));var path=require('path');var sox=require(_0x316d('0x6'));var csv=require(_0x316d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x316d('0x8'));var squel=require(_0x316d('0x9'));var crypto=require(_0x316d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x316d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x316d('0xc'));var Papa=require('papaparse');var Redis=require(_0x316d('0xd'));var authService=require(_0x316d('0xe'));var qs=require(_0x316d('0xf'));var as=require(_0x316d('0x10'));var hardwareService=require(_0x316d('0x11'));var logger=require(_0x316d('0x12'))(_0x316d('0x13'));var utils=require(_0x316d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x316d('0x15'));var db=require(_0x316d('0x16'))['db'];config[_0x316d('0x17')]=_[_0x316d('0x18')](config[_0x316d('0x17')],{'host':_0x316d('0x19'),'port':0x18eb});var socket=require(_0x316d('0x1a'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x316d('0x1b')](socket);var jayson=require(_0x316d('0x1c'));var client=jayson[_0x316d('0x1d')][_0x316d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x36d070,_0x3ff9cd,_0x6d5e20,_0xed4d32){return new BPromise(function(_0x54fb3c,_0x3fc52c){var _0x30ce43=_0xed4d32||client;return _0x30ce43[_0x316d('0x1f')](_0x36d070,_0x6d5e20)['then'](function(_0x4535bf){logger['info'](_0x316d('0x20'),_0x3ff9cd,_0x316d('0x21'));logger[_0x316d('0x22')](_0x316d('0x23'),_0x3ff9cd,'request\x20sent',JSON[_0x316d('0x24')](_0x4535bf));if(_0x4535bf[_0x316d('0x25')]){if(_0x4535bf['error'][_0x316d('0x26')]===0x1f4){logger[_0x316d('0x25')](_0x316d('0x20'),_0x3ff9cd,_0x4535bf[_0x316d('0x25')][_0x316d('0x27')]);return _0x3fc52c(_0x4535bf[_0x316d('0x25')][_0x316d('0x27')]);}logger[_0x316d('0x25')](_0x316d('0x20'),_0x3ff9cd,_0x4535bf['error'][_0x316d('0x27')]);return _0x54fb3c(_0x4535bf[_0x316d('0x25')][_0x316d('0x27')]);}else{logger[_0x316d('0x28')](_0x316d('0x20'),_0x3ff9cd,_0x316d('0x21'));_0x54fb3c(_0x4535bf[_0x316d('0x29')][_0x316d('0x27')]);}})['catch'](function(_0x4f22a5){logger[_0x316d('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x3ff9cd,_0x4f22a5);_0x3fc52c(_0x4f22a5);});});}function respondWithStatusCode(_0x2581ab,_0x4e2f92){_0x4e2f92=_0x4e2f92||0xcc;return function(_0x36d2a0){if(_0x36d2a0){return _0x2581ab['sendStatus'](_0x4e2f92);}return _0x2581ab[_0x316d('0x2a')](_0x4e2f92)['end']();};}function respondWithResult(_0x512177,_0x3adb9d){_0x3adb9d=_0x3adb9d||0xc8;return function(_0x3bbbd6){if(_0x3bbbd6){return _0x512177[_0x316d('0x2a')](_0x3adb9d)[_0x316d('0x2b')](_0x3bbbd6);}};}function respondWithFilteredResult(_0x5da8e9,_0x7737c5){return function(_0x1fc2aa){if(_0x1fc2aa){var _0x390ad0=typeof _0x7737c5[_0x316d('0x2c')]===_0x316d('0x2d')&&typeof _0x7737c5['limit']===_0x316d('0x2d');var _0x294d51=_0x1fc2aa[_0x316d('0x2e')];var _0x3347ea=_0x390ad0?0x0:_0x7737c5[_0x316d('0x2c')];var _0x40bb7a=_0x390ad0?_0x1fc2aa[_0x316d('0x2e')]:_0x7737c5[_0x316d('0x2c')]+_0x7737c5[_0x316d('0x2f')];var _0x52689f;if(_0x40bb7a>=_0x294d51){_0x40bb7a=_0x294d51;_0x52689f=0xc8;}else{_0x52689f=0xce;}_0x5da8e9[_0x316d('0x2a')](_0x52689f);return _0x5da8e9[_0x316d('0x30')]('Content-Range',_0x3347ea+'-'+_0x40bb7a+'/'+_0x294d51)[_0x316d('0x2b')](_0x1fc2aa);}return null;};}function patchUpdates(_0x1fc5bc){return function(_0x2a4912){try{jsonpatch[_0x316d('0x31')](_0x2a4912,_0x1fc5bc,!![]);}catch(_0x178e2b){return BPromise['reject'](_0x178e2b);}return _0x2a4912[_0x316d('0x32')]();};}function saveUpdates(_0x55b0db,_0x2691af){return function(_0x32f289){if(_0x32f289){return _0x32f289[_0x316d('0x33')](_0x55b0db)['then'](function(_0x4c1046){return _0x4c1046;});}return null;};}function removeEntity(_0x4cbd02,_0x57faf7){return function(_0x84a43f){if(_0x84a43f){return _0x84a43f['destroy']()[_0x316d('0x34')](function(){var _0x311de0=_0x84a43f[_0x316d('0x35')]({'plain':!![]});var _0x538498=_0x316d('0x36');return db[_0x316d('0x37')][_0x316d('0x38')]({'where':{'type':_0x538498,'resourceId':_0x311de0['id']}})[_0x316d('0x34')](function(){return _0x84a43f;});})[_0x316d('0x34')](function(){_0x4cbd02[_0x316d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4778,_0x5a2f90){return function(_0x168d75){if(!_0x168d75){_0x3c4778[_0x316d('0x39')](0x194);}return _0x168d75;};}function handleError(_0x12520c,_0x3ba1da){_0x3ba1da=_0x3ba1da||0x1f4;return function(_0x237323){logger[_0x316d('0x25')](_0x237323[_0x316d('0x3a')]);if(_0x237323[_0x316d('0x3b')]){delete _0x237323[_0x316d('0x3b')];}_0x12520c[_0x316d('0x2a')](_0x3ba1da)['send'](_0x237323);};}exports[_0x316d('0x3c')]=function(_0x19b8fc,_0x3ddb9d){var _0x2bc9f8={'include':[{'model':db['Pause'],'as':_0x316d('0x3d')}]},_0x37c9f4={},_0x281bc8={'count':0x0,'rows':[]};var _0x361380=_[_0x316d('0x3e')](db[_0x316d('0x3f')][_0x316d('0x40')],function(_0x169ce1){return{'name':_0x169ce1['fieldName'],'type':_0x169ce1['type'][_0x316d('0x41')]};});_0x37c9f4['model']=_[_0x316d('0x3e')](_0x361380,_0x316d('0x3b'));_0x37c9f4['query']=_[_0x316d('0x42')](_0x19b8fc[_0x316d('0x43')]);_0x37c9f4['filters']=_[_0x316d('0x44')](_0x37c9f4['model'],_0x37c9f4[_0x316d('0x43')]);_0x2bc9f8['attributes']=_['intersection'](_0x37c9f4['model'],qs[_0x316d('0x45')](_0x19b8fc[_0x316d('0x43')]['fields']));_0x2bc9f8['attributes']=_0x2bc9f8['attributes'][_0x316d('0x46')]?_0x2bc9f8[_0x316d('0x47')]:_0x37c9f4['model'];if(!_0x19b8fc['query'][_0x316d('0x48')](_0x316d('0x49'))){_0x2bc9f8['limit']=qs[_0x316d('0x2f')](_0x19b8fc['query']['limit']);_0x2bc9f8[_0x316d('0x2c')]=qs[_0x316d('0x2c')](_0x19b8fc['query'][_0x316d('0x2c')]);}_0x2bc9f8[_0x316d('0x4a')]=qs['sort'](_0x19b8fc[_0x316d('0x43')][_0x316d('0x4b')]);_0x2bc9f8['where']=qs[_0x316d('0x4c')](_[_0x316d('0x4d')](_0x19b8fc[_0x316d('0x43')],_0x37c9f4[_0x316d('0x4c')]),_0x361380);if(_0x19b8fc[_0x316d('0x43')][_0x316d('0x4e')]){_0x2bc9f8[_0x316d('0x4f')]=_[_0x316d('0x50')](_0x2bc9f8[_0x316d('0x4f')],{'$or':_[_0x316d('0x3e')](_0x361380,function(_0x53bdb1){if(_0x53bdb1[_0x316d('0x51')]!==_0x316d('0x52')){var _0x360141={};_0x360141[_0x53bdb1[_0x316d('0x3b')]]={'$like':'%'+_0x19b8fc['query']['filter']+'%'};return _0x360141;}})});}_0x2bc9f8=_[_0x316d('0x50')]({},_0x2bc9f8,_0x19b8fc[_0x316d('0x53')]);var _0x4f15a0={'where':_0x2bc9f8['where']};return db[_0x316d('0x3f')]['count'](_0x4f15a0)[_0x316d('0x34')](function(_0x3ad2cc){_0x281bc8[_0x316d('0x2e')]=_0x3ad2cc;if(_0x19b8fc[_0x316d('0x43')][_0x316d('0x54')]){_0x2bc9f8[_0x316d('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x316d('0x56')](_0x2bc9f8);})[_0x316d('0x34')](function(_0x35a3d0){_0x281bc8['rows']=_0x35a3d0;return _0x281bc8;})[_0x316d('0x34')](respondWithFilteredResult(_0x3ddb9d,_0x2bc9f8))[_0x316d('0x57')](handleError(_0x3ddb9d,null));};exports[_0x316d('0x58')]=function(_0x602449,_0x2245b4){var _0x36f372={'raw':![],'where':{'id':_0x602449['params']['id']},'include':[{'model':db[_0x316d('0x59')],'as':_0x316d('0x3d')}]},_0x17279c={};_0x17279c[_0x316d('0x5a')]=_[_0x316d('0x42')](db['WhatsappAccount'][_0x316d('0x40')]);_0x17279c[_0x316d('0x43')]=_[_0x316d('0x42')](_0x602449[_0x316d('0x43')]);_0x17279c['filters']=_['intersection'](_0x17279c[_0x316d('0x5a')],_0x17279c['query']);_0x36f372[_0x316d('0x47')]=_[_0x316d('0x44')](_0x17279c[_0x316d('0x5a')],qs[_0x316d('0x45')](_0x602449[_0x316d('0x43')]['fields']));_0x36f372['attributes']=_0x36f372['attributes'][_0x316d('0x46')]?_0x36f372[_0x316d('0x47')]:_0x17279c[_0x316d('0x5a')];if(_0x602449[_0x316d('0x43')][_0x316d('0x54')]){_0x36f372[_0x316d('0x55')]=[{'all':!![]}];}_0x36f372=_[_0x316d('0x50')]({},_0x36f372,_0x602449[_0x316d('0x53')]);return db[_0x316d('0x3f')][_0x316d('0x5b')](_0x36f372)[_0x316d('0x34')](handleEntityNotFound(_0x2245b4,null))[_0x316d('0x34')](respondWithResult(_0x2245b4,null))[_0x316d('0x57')](handleError(_0x2245b4,null));};exports[_0x316d('0x5c')]=function(_0x52550a,_0xfbe7d6){return db['WhatsappAccount'][_0x316d('0x5c')](_0x52550a[_0x316d('0x5d')],{})[_0x316d('0x34')](function(_0x4f3381){var _0x429886=_0x52550a[_0x316d('0x5e')][_0x316d('0x35')]({'plain':!![]});if(!_0x429886)throw new Error(_0x316d('0x5f'));if(_0x429886[_0x316d('0x60')]==='user'){var _0x4bee2c=_0x4f3381[_0x316d('0x35')]({'plain':!![]});var _0x26a4cd='WhatsappAccounts';return db[_0x316d('0x61')]['find']({'where':{'name':_0x26a4cd,'userProfileId':_0x429886['userProfileId']},'raw':!![]})[_0x316d('0x34')](function(_0x32a568){if(_0x32a568&&_0x32a568[_0x316d('0x62')]===0x0){return db['UserProfileResource'][_0x316d('0x5c')]({'name':_0x4bee2c[_0x316d('0x3b')],'resourceId':_0x4bee2c['id'],'type':_0x32a568[_0x316d('0x3b')],'sectionId':_0x32a568['id']},{})['then'](function(){return _0x4f3381;});}else{return _0x4f3381;}})[_0x316d('0x57')](function(_0xdda07a){logger[_0x316d('0x25')](_0x316d('0x63'),_0xdda07a);throw _0xdda07a;});}return _0x4f3381;})[_0x316d('0x34')](respondWithResult(_0xfbe7d6,0xc9))[_0x316d('0x57')](handleError(_0xfbe7d6,null));};exports[_0x316d('0x33')]=function(_0x5e438e,_0x2d6176){if(_0x5e438e[_0x316d('0x5d')]['id']){delete _0x5e438e[_0x316d('0x5d')]['id'];}return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x5e438e[_0x316d('0x64')]['id']},'include':[{'model':db[_0x316d('0x59')],'as':_0x316d('0x3d')}]})[_0x316d('0x34')](handleEntityNotFound(_0x2d6176,null))[_0x316d('0x34')](saveUpdates(_0x5e438e[_0x316d('0x5d')],null))[_0x316d('0x34')](respondWithResult(_0x2d6176,null))[_0x316d('0x57')](handleError(_0x2d6176,null));};exports[_0x316d('0x38')]=function(_0x144fb0,_0x1500c2){return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x144fb0[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x1500c2,null))[_0x316d('0x34')](removeEntity(_0x1500c2,null))[_0x316d('0x57')](handleError(_0x1500c2,null));};exports[_0x316d('0x65')]=function(_0x137607,_0x2a1cfe){return db['WhatsappAccount']['describe']()[_0x316d('0x34')](respondWithResult(_0x2a1cfe,null))['catch'](handleError(_0x2a1cfe,null));};exports[_0x316d('0x66')]=function(_0x3519b2,_0xfe146,_0xa1623b){if(_0x3519b2[_0x316d('0x5d')]['id']){delete _0x3519b2[_0x316d('0x5d')]['id'];}return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x3519b2[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0xfe146,null))[_0x316d('0x34')](function(_0x1d8595){if(_0x1d8595){_0x3519b2['body'][_0x316d('0x67')]=_0x1d8595['id'];return db[_0x316d('0x68')][_0x316d('0x5c')](_0x3519b2[_0x316d('0x5d')]);}})[_0x316d('0x34')](respondWithResult(_0xfe146,null))[_0x316d('0x57')](handleError(_0xfe146,null));};exports[_0x316d('0x69')]=function(_0x237081,_0x18f8b1,_0x3c4efe){var _0x39ec5e={'raw':![],'where':{}};var _0x523190={};var _0x12b3d3={'count':0x0,'rows':[]};return db[_0x316d('0x3f')][_0x316d('0x6a')]({'where':{'id':_0x237081[_0x316d('0x64')]['id']}})['then'](handleEntityNotFound(_0x18f8b1,null))[_0x316d('0x34')](function(_0x23902f){if(_0x23902f){_0x523190[_0x316d('0x5a')]=_[_0x316d('0x42')](db[_0x316d('0x68')][_0x316d('0x40')]);_0x523190['query']=_[_0x316d('0x42')](_0x237081[_0x316d('0x43')]);_0x523190[_0x316d('0x4c')]=_[_0x316d('0x44')](_0x523190[_0x316d('0x5a')],_0x523190[_0x316d('0x43')]);_0x39ec5e['attributes']=_['intersection'](_0x523190[_0x316d('0x5a')],qs[_0x316d('0x45')](_0x237081[_0x316d('0x43')]['fields']));_0x39ec5e[_0x316d('0x47')]=_0x39ec5e[_0x316d('0x47')][_0x316d('0x46')]?_0x39ec5e[_0x316d('0x47')]:_0x523190[_0x316d('0x5a')];if(!_0x237081[_0x316d('0x43')][_0x316d('0x48')](_0x316d('0x49'))){_0x39ec5e[_0x316d('0x2f')]=qs[_0x316d('0x2f')](_0x237081[_0x316d('0x43')][_0x316d('0x2f')]);_0x39ec5e[_0x316d('0x2c')]=qs['offset'](_0x237081[_0x316d('0x43')]['offset']);}_0x39ec5e[_0x316d('0x4a')]=qs['sort'](_0x237081[_0x316d('0x43')]['sort']);_0x39ec5e[_0x316d('0x4f')]=qs[_0x316d('0x4c')](_[_0x316d('0x4d')](_0x237081['query'],_0x523190['filters']));_0x39ec5e[_0x316d('0x4f')][_0x316d('0x67')]=_0x23902f['id'];if(_0x237081[_0x316d('0x43')][_0x316d('0x4e')]){_0x39ec5e[_0x316d('0x4f')]=_[_0x316d('0x50')](_0x39ec5e[_0x316d('0x4f')],{'$or':_[_0x316d('0x3e')](_0x39ec5e['attributes'],function(_0x2d1a58){var _0x4f0e8c={};_0x4f0e8c[_0x2d1a58]={'$like':'%'+_0x237081['query'][_0x316d('0x4e')]+'%'};return _0x4f0e8c;})});}_0x39ec5e=_[_0x316d('0x50')]({},_0x39ec5e,_0x237081['options']);return db[_0x316d('0x68')]['count']({'where':_0x39ec5e[_0x316d('0x4f')]})['then'](function(_0x3be764){_0x12b3d3[_0x316d('0x2e')]=_0x3be764;if(_0x237081[_0x316d('0x43')][_0x316d('0x54')]){_0x39ec5e['include']=[{'all':!![]}];}return db['Disposition'][_0x316d('0x56')](_0x39ec5e);})[_0x316d('0x34')](function(_0x5c49b0){_0x12b3d3[_0x316d('0x6b')]=_0x5c49b0;return _0x12b3d3;});}})[_0x316d('0x34')](respondWithFilteredResult(_0x18f8b1,_0x39ec5e))[_0x316d('0x57')](handleError(_0x18f8b1,null));};exports[_0x316d('0x6c')]=function(_0x4fc979,_0x21e5dc,_0x2634da){return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x4fc979[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x21e5dc,null))[_0x316d('0x34')](function(_0xb003ed){if(_0xb003ed){return _0xb003ed['removeDispositions'](_0x4fc979[_0x316d('0x43')][_0x316d('0x6d')]);}})[_0x316d('0x34')](respondWithStatusCode(_0x21e5dc,null))[_0x316d('0x57')](handleError(_0x21e5dc,null));};exports[_0x316d('0x6e')]=function(_0x3e704a,_0x1ecc5a,_0x116f13){if(_0x3e704a['body']['id']){delete _0x3e704a[_0x316d('0x5d')]['id'];}return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x3e704a['params']['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x1ecc5a,null))['then'](function(_0x54b711){if(_0x54b711){_0x3e704a['body'][_0x316d('0x67')]=_0x54b711['id'];return db['CannedAnswer'][_0x316d('0x5c')](_0x3e704a[_0x316d('0x5d')]);}})[_0x316d('0x34')](respondWithResult(_0x1ecc5a,null))['catch'](handleError(_0x1ecc5a,null));};exports[_0x316d('0x6f')]=function(_0x25ff4c,_0x28f274,_0x3f194a){var _0x130316={'raw':![],'where':{}};var _0x9b9742={};var _0x14bbbd={'count':0x0,'rows':[]};return db[_0x316d('0x3f')]['findOne']({'where':{'id':_0x25ff4c[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x28f274,null))[_0x316d('0x34')](function(_0x367a55){if(_0x367a55){_0x9b9742['model']=_[_0x316d('0x42')](db['CannedAnswer'][_0x316d('0x40')]);_0x9b9742[_0x316d('0x43')]=_[_0x316d('0x42')](_0x25ff4c[_0x316d('0x43')]);_0x9b9742[_0x316d('0x4c')]=_[_0x316d('0x44')](_0x9b9742['model'],_0x9b9742[_0x316d('0x43')]);_0x130316['attributes']=_[_0x316d('0x44')](_0x9b9742[_0x316d('0x5a')],qs[_0x316d('0x45')](_0x25ff4c[_0x316d('0x43')][_0x316d('0x45')]));_0x130316[_0x316d('0x47')]=_0x130316[_0x316d('0x47')]['length']?_0x130316['attributes']:_0x9b9742[_0x316d('0x5a')];if(!_0x25ff4c[_0x316d('0x43')]['hasOwnProperty']('nolimit')){_0x130316[_0x316d('0x2f')]=qs[_0x316d('0x2f')](_0x25ff4c[_0x316d('0x43')][_0x316d('0x2f')]);_0x130316[_0x316d('0x2c')]=qs[_0x316d('0x2c')](_0x25ff4c[_0x316d('0x43')][_0x316d('0x2c')]);}_0x130316['order']=qs[_0x316d('0x4b')](_0x25ff4c['query'][_0x316d('0x4b')]);_0x130316[_0x316d('0x4f')]=qs[_0x316d('0x4c')](_[_0x316d('0x4d')](_0x25ff4c[_0x316d('0x43')],_0x9b9742['filters']));_0x130316[_0x316d('0x4f')][_0x316d('0x67')]=_0x367a55['id'];if(_0x25ff4c[_0x316d('0x43')][_0x316d('0x4e')]){_0x130316[_0x316d('0x4f')]=_['merge'](_0x130316[_0x316d('0x4f')],{'$or':_[_0x316d('0x3e')](_0x130316[_0x316d('0x47')],function(_0x7f09de){var _0x2d69be={};_0x2d69be[_0x7f09de]={'$like':'%'+_0x25ff4c[_0x316d('0x43')][_0x316d('0x4e')]+'%'};return _0x2d69be;})});}_0x130316=_[_0x316d('0x50')]({},_0x130316,_0x25ff4c['options']);return db[_0x316d('0x70')][_0x316d('0x2e')]({'where':_0x130316[_0x316d('0x4f')]})[_0x316d('0x34')](function(_0x4d208a){_0x14bbbd[_0x316d('0x2e')]=_0x4d208a;if(_0x25ff4c[_0x316d('0x43')]['includeAll']){_0x130316[_0x316d('0x55')]=[{'all':!![]}];}return db[_0x316d('0x70')][_0x316d('0x56')](_0x130316);})[_0x316d('0x34')](function(_0x54ecac){_0x14bbbd[_0x316d('0x6b')]=_0x54ecac;return _0x14bbbd;});}})[_0x316d('0x34')](respondWithFilteredResult(_0x28f274,_0x130316))[_0x316d('0x57')](handleError(_0x28f274,null));};exports[_0x316d('0x71')]=function(_0x9b8c67,_0x412590,_0x3054c6){return db['WhatsappAccount'][_0x316d('0x5b')]({'where':{'id':_0x9b8c67[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x412590,null))[_0x316d('0x34')](function(_0x16cd5e){if(_0x16cd5e){return _0x16cd5e[_0x316d('0x71')](_0x9b8c67['query']['ids']);}})[_0x316d('0x34')](respondWithStatusCode(_0x412590,null))[_0x316d('0x57')](handleError(_0x412590,null));};exports['addAgents']=function(_0x2117cc,_0x224cef,_0x3b9875){return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x2117cc['params']['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x224cef,null))['then'](function(_0x239b1d){if(_0x239b1d){return _0x239b1d['addAgents'](_0x2117cc[_0x316d('0x5d')][_0x316d('0x6d')],_[_0x316d('0x72')](_0x2117cc[_0x316d('0x5d')],[_0x316d('0x6d'),'id'])||{})['spread'](function(_0x512535){for(var _0x357ead=0x0;_0x357ead<_0x2117cc[_0x316d('0x5d')][_0x316d('0x6d')][_0x316d('0x46')];_0x357ead+=0x1){socket[_0x316d('0x73')](_0x316d('0x74'),{'UserId':Number(_0x2117cc[_0x316d('0x5d')][_0x316d('0x6d')][_0x357ead]),'WhatsappAccountId':Number(_0x2117cc['params']['id'])});}return _0x512535;});}})[_0x316d('0x34')](respondWithResult(_0x224cef,null))['catch'](handleError(_0x224cef,null));};exports[_0x316d('0x75')]=function(_0x4e33f7,_0x545d32,_0x314e7c){return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x4e33f7[_0x316d('0x64')]['id']}})['then'](handleEntityNotFound(_0x545d32,null))[_0x316d('0x34')](function(_0x1ace80){if(_0x1ace80){return _0x1ace80['removeAgents'](_0x4e33f7[_0x316d('0x43')]['ids'])[_0x316d('0x34')](function(){if(_[_0x316d('0x76')](_0x4e33f7[_0x316d('0x43')][_0x316d('0x6d')])){for(var _0x5c6bc3=0x0;_0x5c6bc3<_0x4e33f7['query'][_0x316d('0x6d')][_0x316d('0x46')];_0x5c6bc3+=0x1){socket[_0x316d('0x73')](_0x316d('0x77'),{'UserId':Number(_0x4e33f7['query'][_0x316d('0x6d')][_0x5c6bc3]),'WhatsappAccountId':Number(_0x4e33f7['params']['id'])});}}else{socket[_0x316d('0x73')](_0x316d('0x77'),{'UserId':Number(_0x4e33f7['query']['ids']),'WhatsappAccountId':Number(_0x4e33f7[_0x316d('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x545d32,null))[_0x316d('0x57')](handleError(_0x545d32,null));};exports[_0x316d('0x78')]=function(_0x234d53,_0x4a3e7e,_0x1e3d89){var _0x38015d={};var _0x44c837={};var _0x32bc29;var _0x55deee;return db['WhatsappAccount']['findOne']({'where':{'id':_0x234d53[_0x316d('0x64')]['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x4a3e7e,null))[_0x316d('0x34')](function(_0x197969){if(_0x197969){_0x32bc29=_0x197969;_0x44c837[_0x316d('0x5a')]=_[_0x316d('0x42')](db[_0x316d('0x79')][_0x316d('0x40')]);_0x44c837[_0x316d('0x43')]=_['keys'](_0x234d53[_0x316d('0x43')]);_0x44c837[_0x316d('0x4c')]=_[_0x316d('0x44')](_0x44c837['model'],_0x44c837[_0x316d('0x43')]);_0x38015d[_0x316d('0x47')]=_[_0x316d('0x44')](_0x44c837[_0x316d('0x5a')],qs[_0x316d('0x45')](_0x234d53[_0x316d('0x43')][_0x316d('0x45')]));_0x38015d['attributes']=_0x38015d[_0x316d('0x47')][_0x316d('0x46')]?_0x38015d['attributes']:_0x44c837['model'];_0x38015d[_0x316d('0x4a')]=qs['sort'](_0x234d53[_0x316d('0x43')][_0x316d('0x4b')]);_0x38015d['where']=qs[_0x316d('0x4c')](_[_0x316d('0x4d')](_0x234d53['query'],_0x44c837[_0x316d('0x4c')]));if(_0x234d53[_0x316d('0x43')][_0x316d('0x4e')]){_0x38015d[_0x316d('0x4f')]=_[_0x316d('0x50')](_0x38015d[_0x316d('0x4f')],{'$or':_[_0x316d('0x3e')](_0x38015d[_0x316d('0x47')],function(_0x443c02){var _0x3e5603={};_0x3e5603[_0x443c02]={'$like':'%'+_0x234d53[_0x316d('0x43')][_0x316d('0x4e')]+'%'};return _0x3e5603;})});}_0x38015d=_[_0x316d('0x50')]({},_0x38015d,_0x234d53[_0x316d('0x53')]);return _0x32bc29[_0x316d('0x78')](_0x38015d);}})[_0x316d('0x34')](function(_0x158285){if(_0x158285){_0x55deee=_0x158285['length'];if(!_0x234d53['query'][_0x316d('0x48')](_0x316d('0x49'))){_0x38015d[_0x316d('0x2f')]=qs[_0x316d('0x2f')](_0x234d53[_0x316d('0x43')]['limit']);_0x38015d[_0x316d('0x2c')]=qs[_0x316d('0x2c')](_0x234d53[_0x316d('0x43')][_0x316d('0x2c')]);}return _0x32bc29['getAgents'](_0x38015d);}})['then'](function(_0x4dec65){if(_0x4dec65){return _0x4dec65?{'count':_0x55deee,'rows':_0x4dec65}:null;}})[_0x316d('0x34')](respondWithResult(_0x4a3e7e,null))[_0x316d('0x57')](handleError(_0x4a3e7e,null));};exports[_0x316d('0x7a')]=function(_0x3d4b50,_0x96f596){var _0x2b600b=_0x3d4b50['params']['id'];var _0x6a6163=_0x3d4b50[_0x316d('0x5d')];var _0x2b8bc2=0xc8;var _0x1275f7=null;return db['sequelize'][_0x316d('0x7b')]({'isolationLevel':db[_0x316d('0x7c')][_0x316d('0x7d')][_0x316d('0x7e')]['READ_COMMITTED']},function(_0x162495){return db[_0x316d('0x3f')][_0x316d('0x6a')]({'where':{'id':_0x2b600b},'transaction':_0x162495})['then'](function(_0x4124ac){if(_0x4124ac){return db[_0x316d('0x7f')][_0x316d('0x38')]({'where':{'WhatsappAccountId':_0x2b600b},'transaction':_0x162495})['then'](function(){var _0x4f5266=_[_0x316d('0x3e')](_0x6a6163,function(_0x2808de){_0x2808de['WhatsappAccountId']=_0x2b600b;return _0x2808de;});return db[_0x316d('0x7f')][_0x316d('0x80')](_0x4f5266,{'transaction':_0x162495});});}else{_0x2b8bc2=0x194;_0x1275f7=[];}});})[_0x316d('0x34')](function(){if(_0x2b8bc2!==0x194){return db[_0x316d('0x7f')][_0x316d('0x81')]({'where':{'WhatsappAccountId':_0x2b600b},'order':_0x316d('0x82')})['then'](function(_0x5bf73a){_0x1275f7=_0x5bf73a;});}})[_0x316d('0x57')](function(_0x14f604){_0x2b8bc2=0x1f4;logger['error'](_0x14f604[_0x316d('0x3a')]);if(_0x14f604[_0x316d('0x3b')]){delete _0x14f604[_0x316d('0x3b')];}_0x1275f7=_0x14f604;})[_0x316d('0x83')](function(){if(_0x1275f7===null){_0x96f596[_0x316d('0x39')](_0x2b8bc2);}else{if(_0x2b8bc2===0x1f4){_0x96f596['status'](_0x2b8bc2)[_0x316d('0x84')](_0x1275f7);}else{_0x96f596[_0x316d('0x2a')](_0x2b8bc2)[_0x316d('0x2b')](_0x1275f7);}}});};exports[_0x316d('0x85')]=function(_0x2061b9,_0x20a3fb,_0x3ca2be){var _0x2f9afb={};var _0x45c571={};var _0x163287;var _0x1df7d1;return db[_0x316d('0x3f')][_0x316d('0x6a')]({'where':{'id':_0x2061b9['params']['id']}})[_0x316d('0x34')](handleEntityNotFound(_0x20a3fb,null))[_0x316d('0x34')](function(_0x1e871f){if(_0x1e871f){_0x163287=_0x1e871f;_0x45c571[_0x316d('0x5a')]=_['keys'](db[_0x316d('0x7f')][_0x316d('0x40')]);_0x45c571['query']=_['keys'](_0x2061b9[_0x316d('0x43')]);_0x45c571[_0x316d('0x4c')]=_['intersection'](_0x45c571[_0x316d('0x5a')],_0x45c571['query']);_0x2f9afb[_0x316d('0x47')]=_[_0x316d('0x44')](_0x45c571[_0x316d('0x5a')],qs[_0x316d('0x45')](_0x2061b9[_0x316d('0x43')][_0x316d('0x45')]));_0x2f9afb[_0x316d('0x47')]=_0x2f9afb[_0x316d('0x47')]['length']?_0x2f9afb[_0x316d('0x47')]:_0x45c571[_0x316d('0x5a')];_0x2f9afb[_0x316d('0x4a')]=qs[_0x316d('0x4b')](_0x2061b9[_0x316d('0x43')][_0x316d('0x4b')]);_0x2f9afb['where']=qs[_0x316d('0x4c')](_[_0x316d('0x4d')](_0x2061b9['query'],_0x45c571['filters']));if(_0x2061b9['query'][_0x316d('0x4e')]){_0x2f9afb[_0x316d('0x4f')]=_[_0x316d('0x50')](_0x2f9afb['where'],{'$or':_[_0x316d('0x3e')](_0x2f9afb[_0x316d('0x47')],function(_0x437aed){var _0x39e229={};_0x39e229[_0x437aed]={'$like':'%'+_0x2061b9[_0x316d('0x43')][_0x316d('0x4e')]+'%'};return _0x39e229;})});}_0x2f9afb=_['merge']({},_0x2f9afb,_0x2061b9[_0x316d('0x53')]);return _0x163287[_0x316d('0x85')](_0x2f9afb);}})['then'](function(_0x21301c){if(_0x21301c){_0x1df7d1=_0x21301c[_0x316d('0x46')];if(!_0x2061b9[_0x316d('0x43')][_0x316d('0x48')](_0x316d('0x49'))){_0x2f9afb['limit']=qs[_0x316d('0x2f')](_0x2061b9[_0x316d('0x43')][_0x316d('0x2f')]);_0x2f9afb[_0x316d('0x2c')]=qs['offset'](_0x2061b9[_0x316d('0x43')]['offset']);}return _0x163287[_0x316d('0x85')](_0x2f9afb);}})[_0x316d('0x34')](function(_0x5b8046){if(_0x5b8046){return _0x5b8046?{'count':_0x1df7d1,'rows':_0x5b8046}:null;}})[_0x316d('0x34')](respondWithResult(_0x20a3fb,null))[_0x316d('0x57')](handleError(_0x20a3fb,null));};exports[_0x316d('0x86')]=function(_0x504f82,_0x4a6d65,_0x23a021){var _0x57d3ed={'channel':_0x316d('0x87')};var _0x48ff59=[];var _0x2ba107=[];var _0x34cc4e={};return db['WhatsappAccount']['find']({'where':{'id':_0x504f82[_0x316d('0x64')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x316d('0x88')}]})[_0x316d('0x34')](handleEntityNotFound(_0x4a6d65,null))[_0x316d('0x34')](function(_0x25a23f){_0x57d3ed[_0x316d('0x89')]=_0x25a23f;if(_0x57d3ed[_0x316d('0x89')]&&_0x57d3ed[_0x316d('0x89')]['type']===_0x316d('0x8a')&&_0x504f82[_0x316d('0x5d')][_0x316d('0x8b')]){if(_0x504f82[_0x316d('0x5d')][_0x316d('0x8b')][_0x316d('0x46')]===0x0)return;if(_0x504f82[_0x316d('0x5d')][_0x316d('0x8b')][0x0]['state']!==_0x316d('0x8c'))return;return db[_0x316d('0x8d')][_0x316d('0x33')]({'read':!![],'readAt':_0x504f82[_0x316d('0x5d')][_0x316d('0x8b')][0x0]['timestamp']},{'where':{'messageId':_0x504f82['body'][_0x316d('0x8b')][0x0][_0x316d('0x8e')]},'individualHooks':!![]})['then'](function(_0x5de897){return _0x4a6d65[_0x316d('0x2a')](0xc8)[_0x316d('0x2b')](_0x5de897);});}_0x57d3ed['applications']=_[_0x316d('0x8f')](_0x25a23f[_0x316d('0x88')],['priority'],[_0x316d('0x90')]);if(_0x57d3ed[_0x316d('0x89')][_0x316d('0x88')]){delete _0x57d3ed[_0x316d('0x89')]['Applications'];}return db[_0x316d('0x91')][_0x316d('0x65')]()['then'](function(_0x5a38fc){if(!_0x5a38fc){throw new db['Sequelize'][(_0x316d('0x92'))](_0x316d('0x93'));}_0x48ff59=_[_0x316d('0x94')](_[_0x316d('0x42')](_0x5a38fc),[_0x316d('0x95'),_0x316d('0x96')]);_0x2ba107=_['difference'](_[_0x316d('0x42')](_0x5a38fc),[_0x316d('0x95'),_0x316d('0x96'),_0x316d('0x97'),'ListId']);_0x57d3ed[_0x316d('0x5d')]={'mapKey':_0x316d('0x98')};if(_0x57d3ed[_0x316d('0x89')]&&_0x57d3ed[_0x316d('0x89')][_0x316d('0x51')]===_0x316d('0x99')){_0x57d3ed['body'][_0x316d('0x9a')]=_0x504f82[_0x316d('0x5d')]['From']['replace']('whatsapp:','');_0x57d3ed[_0x316d('0x5d')][_0x316d('0x5d')]=_0x504f82[_0x316d('0x5d')][_0x316d('0x9b')];_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9c')]=_0x504f82[_0x316d('0x5d')][_0x316d('0x9d')];}if(_0x57d3ed[_0x316d('0x89')]&&_0x57d3ed['account'][_0x316d('0x51')]==='sinch'){_0x57d3ed['body'][_0x316d('0x9a')]=_0x504f82[_0x316d('0x5d')]['notifications'][0x0][_0x316d('0x9a')];_0x57d3ed[_0x316d('0x5d')][_0x316d('0x5d')]=_0x504f82[_0x316d('0x5d')][_0x316d('0x9e')][0x0]['message'][_0x316d('0x5d')];_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9c')]=_0x504f82[_0x316d('0x5d')][_0x316d('0x9e')][0x0][_0x316d('0x8e')];}if(_0x57d3ed[_0x316d('0x5d')]['id']){delete _0x57d3ed[_0x316d('0x5d')]['id'];}if(_[_0x316d('0x9f')](_0x57d3ed[_0x316d('0x5d')]['from'])){throw new db[(_0x316d('0xa0'))][(_0x316d('0x92'))]('from\x20is\x20mandatory');}if(_[_0x316d('0x9f')](_0x57d3ed[_0x316d('0x5d')]['body'])||_0x57d3ed[_0x316d('0x5d')][_0x316d('0x5d')]===''){throw new db['Sequelize'][(_0x316d('0x92'))](_0x316d('0xa1'));}if(_[_0x316d('0x9f')](_0x57d3ed[_0x316d('0x5d')][_0x316d('0xa2')])){throw new db[(_0x316d('0xa0'))]['ValidationError'](_0x316d('0xa3')+_0x2ba107);}if(!_[_0x316d('0xa4')](_0x2ba107,_0x57d3ed[_0x316d('0x5d')][_0x316d('0xa2')])){throw new db['Sequelize'][(_0x316d('0x92'))](_0x316d('0xa5')+_0x2ba107);}_0x34cc4e[_0x57d3ed['body']['mapKey']]=_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9a')];return db[_0x316d('0xa6')][_0x316d('0x5b')]({'where':{'id':_0x57d3ed[_0x316d('0x89')]['ListId']},'include':[{'model':db[_0x316d('0x91')],'as':_0x316d('0xa7'),'where':_0x34cc4e,'limit':0x1,'order':[[_0x316d('0x96'),_0x316d('0xa8')]]}]});})['then'](handleEntityNotFound(_0x4a6d65,null))['then'](function(_0x156181){if(_0x156181){_0x57d3ed[_0x316d('0xa9')]=_['omit'](_0x156181,[_0x316d('0xa7')]);if(_0x156181[_0x316d('0xa7')][_0x316d('0x46')]){return _0x156181[_0x316d('0xa7')][0x0];}var _0x12cc0d=_[_0x316d('0x18')](_0x57d3ed[_0x316d('0x5d')],{'firstName':_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9a')],'ListId':_0x156181['id']});_0x12cc0d[_0x57d3ed['body'][_0x316d('0xa2')]]=_0x57d3ed[_0x316d('0x5d')]['from'];return db[_0x316d('0x91')][_0x316d('0x5c')](_0x12cc0d,{'fields':_0x48ff59,'raw':!![]});}})['then'](handleEntityNotFound(_0x4a6d65,null))[_0x316d('0x34')](function(_0x107c89){if(_0x107c89){_0x57d3ed[_0x316d('0xaa')]=_0x107c89;var _0x96ea39={'ContactId':_0x107c89['id'],'phone':_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9a')],'WhatsappAccountId':_0x504f82[_0x316d('0x64')]['id']};var _0xc2bf76={'ContactId':_0x107c89['id'],'WhatsappAccountId':_0x504f82[_0x316d('0x64')]['id'],'closed':![]};return db[_0x316d('0xab')][_0x316d('0x5b')]({'where':_0xc2bf76})[_0x316d('0x34')](function(_0x18c15c){if(_0x18c15c){return[_0x18c15c,![]];}return db[_0x316d('0xab')]['create'](_0x96ea39)[_0x316d('0x34')](function(_0x37c8fc){return[_0x37c8fc,!![]];});});}})[_0x316d('0xac')](function(_0x22e641,_0x3e0402){_0x57d3ed[_0x316d('0xad')]=_0x22e641[_0x316d('0x35')]({'plain':!![]});_0x57d3ed[_0x316d('0xad')][_0x316d('0xae')]=![];if(_0x3e0402){if(_0x57d3ed[_0x316d('0x89')]['autoclose']){_0x57d3ed['applications'][_0x316d('0xaf')]({'id':0x0,'priority':_0x57d3ed[_0x316d('0xb0')][_0x316d('0x46')]+0x1,'app':_0x316d('0xb1'),'appdata':_0x316d('0xb2'),'interval':_0x316d('0xb3')});}_0x57d3ed[_0x316d('0xad')][_0x316d('0xae')]=!![];}return db['WhatsappMessage'][_0x316d('0x5c')]({'phone':_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9a')],'messageId':_0x57d3ed[_0x316d('0x5d')][_0x316d('0x9c')],'body':_0x57d3ed[_0x316d('0x5d')][_0x316d('0x5d')],'WhatsappAccountId':_0x504f82['params']['id'],'WhatsappInteractionId':_0x22e641['id'],'direction':'in','ContactId':_0x22e641[_0x316d('0xb4')],'AttachmentId':_0x57d3ed[_0x316d('0x5d')]['AttachmentId']});})[_0x316d('0x34')](function(_0x204cec){_0x57d3ed['message']=_0x204cec;if(_0x57d3ed[_0x316d('0xad')][_0x316d('0xb5')]){return db[_0x316d('0x79')][_0x316d('0x5b')]({'attributes':['id','name'],'where':{'id':_0x57d3ed[_0x316d('0xad')][_0x316d('0xb5')]}})[_0x316d('0x34')](function(_0x14bb15){if(_0x14bb15){_0x57d3ed[_0x316d('0xb0')][_0x316d('0xb6')]({'id':0x0,'priority':0x0,'app':_0x316d('0xb7'),'appdata':_0x14bb15[_0x316d('0x3b')]+','+(_0x57d3ed[_0x316d('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0x316d('0xb3')});}return respondWithRpcPromise('Start',_0x316d('0xb8'),_0x57d3ed);});}return respondWithRpcPromise(_0x316d('0xb9'),_0x316d('0xb8'),_0x57d3ed);})[_0x316d('0x34')](function(_0x3b54b7){if(_0x3b54b7){var _0x16cced=0xc8;var _0x26dee2='receiveMessage';logger[_0x316d('0x28')](_0x316d('0x23'),_0x26dee2,_0x16cced,_0x316d('0xba'));logger[_0x316d('0x22')](_0x316d('0xbb'),_0x26dee2,_0x16cced,_0x316d('0xba'),JSON['stringify'](_0x3b54b7));if(_0x57d3ed[_0x316d('0x89')][_0x316d('0x51')]===_0x316d('0x99')){return _0x4a6d65['status'](_0x16cced)['set']('Content-Type',_0x316d('0xbc'))[_0x316d('0x84')](_0x316d('0xbd'));}else{return _0x4a6d65[_0x316d('0x2a')](_0x16cced)['json'](_0x3b54b7);}}});})['catch'](handleError(_0x4a6d65,null));};exports[_0x316d('0x84')]=function(_0x3a3fe0,_0x4e9a4c,_0xe7a686){var _0x5d54ae,_0x5e6c36,_0x573704;if(_['isNil'](_0x3a3fe0[_0x316d('0x5d')][_0x316d('0x5d')])||_0x3a3fe0['body'][_0x316d('0x5d')]===''){throw new db[(_0x316d('0xa0'))]['ValidationError'](_0x316d('0xa1'));}if(_[_0x316d('0x9f')](_0x3a3fe0[_0x316d('0x5d')]['to'])){throw new db[(_0x316d('0xa0'))][(_0x316d('0x92'))](_0x316d('0xbe'));}_0x5d54ae=_0x3a3fe0[_0x316d('0x5d')]['to'];return db[_0x316d('0x3f')][_0x316d('0x5b')]({'where':{'id':_0x3a3fe0['params']['id']},'include':[{'model':db['CmList'],'as':_0x316d('0xbf'),'include':[{'model':db[_0x316d('0x91')],'as':'Contacts','where':{'mobile':_0x5d54ae},'limit':0x1,'order':[['updatedAt',_0x316d('0xa8')]]}]}]})[_0x316d('0x34')](handleEntityNotFound(_0x4e9a4c,null))[_0x316d('0x34')](function(_0x3a0222){if(_0x3a0222&&_0x3a0222[_0x316d('0xbf')]){_0x5e6c36=_0x3a0222[_0x316d('0x35')]({'plain':!![]});if(_0x5e6c36[_0x316d('0xbf')]&&_0x5e6c36[_0x316d('0xbf')][_0x316d('0xa7')][_0x316d('0x46')]){return _0x5e6c36[_0x316d('0xbf')][_0x316d('0xa7')][0x0];}return db[_0x316d('0x91')][_0x316d('0x5c')](_[_0x316d('0x18')](_0x3a3fe0['body'],{'firstName':_0x5d54ae,'mobile':_0x5d54ae,'phone':_0x5d54ae,'ListId':_0x5e6c36['ListId']}));}})['then'](handleEntityNotFound(_0x4e9a4c,null))[_0x316d('0x34')](function(_0x2f6aaf){if(_0x2f6aaf){_0x573704=_0x2f6aaf;return db['WhatsappInteraction'][_0x316d('0x5b')]({'where':{'ContactId':_0x573704['id'],'closed':![],'WhatsappAccountId':_0x5e6c36['id']}})[_0x316d('0x34')](function(_0x4d5581){if(_0x4d5581){return[_0x4d5581,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x3a3fe0[_0x316d('0x5e')]['id'],'ContactId':_0x573704['id'],'WhatsappAccountId':_0x5e6c36['id'],'phone':_0x5d54ae,'firstMsgDirection':_0x316d('0xc0'),'Messages':[_[_0x316d('0x50')](_0x3a3fe0[_0x316d('0x5d')],{'read':![],'body':_0x3a3fe0[_0x316d('0x5d')][_0x316d('0x5d')],'phone':_0x5d54ae,'WhatsappAccountId':_0x5e6c36['id'],'UserId':_0x3a3fe0[_0x316d('0x5e')]['id'],'ContactId':_0x573704['id']})]},{'include':[{'model':db[_0x316d('0x8d')],'as':'Messages'}]})['then'](function(_0x2c2acd){return[_0x2c2acd,!![]];});});}})[_0x316d('0xac')](function(_0x240fe7,_0x4477c9){if(_0x4477c9){return _0x240fe7;}return db[_0x316d('0x8d')][_0x316d('0x5c')](_['merge'](_0x3a3fe0[_0x316d('0x5d')],{'read':![],'body':_0x3a3fe0[_0x316d('0x5d')][_0x316d('0x5d')],'phone':_0x5d54ae,'WhatsappAccountId':_0x5e6c36['id'],'WhatsappInteractionId':_0x240fe7['id'],'UserId':_0x3a3fe0[_0x316d('0x5e')]['id'],'ContactId':_0x573704['id']}))[_0x316d('0x34')](function(_0x19fafa){_0x240fe7[_0x316d('0xc1')][_0x316d('0xc2')]=[];_0x240fe7[_0x316d('0xc1')][_0x316d('0xc2')][_0x316d('0xaf')](_0x19fafa[_0x316d('0xc1')]);return _0x240fe7;});})[_0x316d('0x34')](respondWithResult(_0x4e9a4c,null))['catch'](handleError(_0x4e9a4c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5742222..783ad77 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 _0x9222=['setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount'];(function(_0x550ef9,_0x3a9b13){var _0x252d95=function(_0x32e135){while(--_0x32e135){_0x550ef9['push'](_0x550ef9['shift']());}};_0x252d95(++_0x3a9b13);}(_0x9222,0x1ad));var _0x2922=function(_0x157e5a,_0x179bdb){_0x157e5a=_0x157e5a-0x0;var _0x466a2f=_0x9222[_0x157e5a];return _0x466a2f;};'use strict';var EventEmitter=require(_0x2922('0x0'));var WhatsappAccount=require(_0x2922('0x1'))['db'][_0x2922('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2922('0x3')](0x0);var events={'afterCreate':_0x2922('0x4'),'afterUpdate':_0x2922('0x5'),'afterDestroy':_0x2922('0x6')};function emitEvent(_0x1ce021){return function(_0x238355,_0x2d7925,_0x351bb5){WhatsappAccountEvents['emit'](_0x1ce021+':'+_0x238355['id'],_0x238355);WhatsappAccountEvents['emit'](_0x1ce021,_0x238355);_0x351bb5(null);};}for(var e in events){if(events[_0x2922('0x7')](e)){var event=events[e];WhatsappAccount[_0x2922('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x1e2d=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x48e929,_0x2bd2d0){var _0x58a8ef=function(_0x38ca37){while(--_0x38ca37){_0x48e929['push'](_0x48e929['shift']());}};_0x58a8ef(++_0x2bd2d0);}(_0x1e2d,0x9f));var _0xd1e2=function(_0x2ae9f6,_0xd4264e){_0x2ae9f6=_0x2ae9f6-0x0;var _0xc2aead=_0x1e2d[_0x2ae9f6];return _0xc2aead;};'use strict';var EventEmitter=require(_0xd1e2('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd1e2('0x1')](0x0);var events={'afterCreate':_0xd1e2('0x2'),'afterUpdate':_0xd1e2('0x3'),'afterDestroy':_0xd1e2('0x4')};function emitEvent(_0x17d843){return function(_0x5b8b86,_0x2d2d05,_0xce3a98){WhatsappAccountEvents['emit'](_0x17d843+':'+_0x5b8b86['id'],_0x5b8b86);WhatsappAccountEvents[_0xd1e2('0x5')](_0x17d843,_0x5b8b86);_0xce3a98(null);};}for(var e in events){if(events[_0xd1e2('0x6')](e)){var event=events[e];WhatsappAccount[_0xd1e2('0x7')](e,emitEvent(event));}}module[_0xd1e2('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d65c900..2806a50 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 _0x7e3e=['request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x32a27e,_0x18d802){var _0x2eb69e=function(_0x13cbff){while(--_0x13cbff){_0x32a27e['push'](_0x32a27e['shift']());}};_0x2eb69e(++_0x18d802);}(_0x7e3e,0x140));var _0xe7e3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7e3e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xe7e3('0x0'));var util=require(_0xe7e3('0x1'));var logger=require(_0xe7e3('0x2'))(_0xe7e3('0x3'));var moment=require(_0xe7e3('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7e3('0x5'));var fs=require('fs');var path=require(_0xe7e3('0x6'));var rimraf=require(_0xe7e3('0x7'));var config=require('../../config/environment');var attributes=require(_0xe7e3('0x8'));module[_0xe7e3('0x9')]=function(_0x4ca2a4,_0x3c9ee4){return _0x4ca2a4[_0xe7e3('0xa')](_0xe7e3('0xb'),attributes,{'tableName':_0xe7e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2994=['lodash','util','api','moment','bluebird','path','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x2994,0x1d9));var _0x4299=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2994[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4299('0x0'));var util=require(_0x4299('0x1'));var logger=require('../../config/logger')(_0x4299('0x2'));var moment=require(_0x4299('0x3'));var BPromise=require(_0x4299('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4299('0x5'));var rimraf=require('rimraf');var config=require(_0x4299('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x4299('0x7')]=function(_0x23dd40,_0x2ab3b7){return _0x23dd40[_0x4299('0x8')](_0x4299('0x9'),attributes,{'tableName':_0x4299('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 14a1aeb..2a2feaf 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 _0xb59b=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappAccount','find','options','include','map','model','attributes','ShowWhatsappAccount','stringify','catch','lodash'];(function(_0x327317,_0x1f1d51){var _0x3eb77c=function(_0xed668f){while(--_0xed668f){_0x327317['push'](_0x327317['shift']());}};_0x3eb77c(++_0x1f1d51);}(_0xb59b,0xbd));var _0xbb59=function(_0x175dbc,_0x5ef624){_0x175dbc=_0x175dbc-0x0;var _0x18dc79=_0xb59b[_0x175dbc];return _0x18dc79;};'use strict';var _=require(_0xbb59('0x0'));var util=require('util');var moment=require(_0xbb59('0x1'));var BPromise=require(_0xbb59('0x2'));var rs=require(_0xbb59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb59('0x5'))(_0xbb59('0x6'));var config=require(_0xbb59('0x7'));var jayson=require(_0xbb59('0x8'));var client=jayson[_0xbb59('0x9')][_0xbb59('0xa')]({'port':0x232a});config['redis']=_[_0xbb59('0xb')](config[_0xbb59('0xc')],{'host':_0xbb59('0xd'),'port':0x18eb});var socket=require(_0xbb59('0xe'))(new Redis(config[_0xbb59('0xc')]));require(_0xbb59('0xf'))[_0xbb59('0x10')](socket);function respondWithRpcPromise(_0x3e5b9f,_0x3cbb2e,_0x1952ac){return new BPromise(function(_0x2a9857,_0x48f25a){return client[_0xbb59('0x11')](_0x3e5b9f,_0x1952ac)[_0xbb59('0x12')](function(_0x545111){logger[_0xbb59('0x13')](_0xbb59('0x14'),_0x3cbb2e,_0xbb59('0x15'));logger[_0xbb59('0x16')](_0xbb59('0x17'),_0x3cbb2e,_0xbb59('0x15'),JSON['stringify'](_0x545111));if(_0x545111[_0xbb59('0x18')]){if(_0x545111[_0xbb59('0x18')][_0xbb59('0x19')]===0x1f4){logger[_0xbb59('0x18')](_0xbb59('0x14'),_0x3cbb2e,_0x545111[_0xbb59('0x18')]['message']);return _0x48f25a(_0x545111[_0xbb59('0x18')][_0xbb59('0x1a')]);}logger[_0xbb59('0x18')](_0xbb59('0x14'),_0x3cbb2e,_0x545111[_0xbb59('0x18')][_0xbb59('0x1a')]);return _0x2a9857(_0x545111[_0xbb59('0x18')]['message']);}else{logger[_0xbb59('0x13')](_0xbb59('0x14'),_0x3cbb2e,'request\x20sent');_0x2a9857(_0x545111[_0xbb59('0x1b')]['message']);}})['catch'](function(_0x34afbc){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cbb2e,_0x34afbc);_0x48f25a(_0x34afbc);});});}exports['ShowWhatsappAccount']=function(_0x1db424){var _0x3bb408=this;return new Promise(function(_0x78b2f2,_0x1326c8){return db[_0xbb59('0x1c')][_0xbb59('0x1d')]({'raw':_0x1db424[_0xbb59('0x1e')]?_0x1db424[_0xbb59('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1db424[_0xbb59('0x1e')]?_0x1db424[_0xbb59('0x1e')]['where']||null:null,'attributes':_0x1db424[_0xbb59('0x1e')]?_0x1db424['options']['attributes']||null:null,'include':_0x1db424[_0xbb59('0x1e')]?_0x1db424[_0xbb59('0x1e')][_0xbb59('0x1f')]?_[_0xbb59('0x20')](_0x1db424['options'][_0xbb59('0x1f')],function(_0x57e086){return{'model':db[_0x57e086[_0xbb59('0x21')]],'as':_0x57e086['as'],'attributes':_0x57e086[_0xbb59('0x22')],'include':_0x57e086[_0xbb59('0x1f')]?_['map'](_0x57e086[_0xbb59('0x1f')],function(_0x35cb30){return{'model':db[_0x35cb30[_0xbb59('0x21')]],'as':_0x35cb30['as'],'attributes':_0x35cb30[_0xbb59('0x22')],'include':_0x35cb30[_0xbb59('0x1f')]?_[_0xbb59('0x20')](_0x35cb30['include'],function(_0x584fd7){return{'model':db[_0x584fd7[_0xbb59('0x21')]],'as':_0x584fd7['as'],'attributes':_0x584fd7[_0xbb59('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbb59('0x12')](function(_0x35a7e5){logger[_0xbb59('0x13')](_0xbb59('0x23'),_0x1db424);logger[_0xbb59('0x16')](_0xbb59('0x23'),_0x1db424,JSON[_0xbb59('0x24')](_0x35a7e5));_0x78b2f2(_0x35a7e5);})[_0xbb59('0x25')](function(_0x43dda4){logger[_0xbb59('0x18')](_0xbb59('0x23'),_0x43dda4[_0xbb59('0x1a')],_0x1db424);_0x1326c8(_0x3bb408[_0xbb59('0x18')](0x1f4,_0x43dda4[_0xbb59('0x1a')]));});});}; \ No newline at end of file +var _0xb3ee=['WhatsappAccount','find','options','raw','where','attributes','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','redis','localhost','./whatsappAccount.socket','register','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount'];(function(_0x53dccc,_0xad9fb1){var _0x17241e=function(_0x25391e){while(--_0x25391e){_0x53dccc['push'](_0x53dccc['shift']());}};_0x17241e(++_0xad9fb1);}(_0xb3ee,0x6c));var _0xeb3e=function(_0x159706,_0x45e6b4){_0x159706=_0x159706-0x0;var _0x16720f=_0xb3ee[_0x159706];return _0x16720f;};'use strict';var _=require('lodash');var util=require(_0xeb3e('0x0'));var moment=require(_0xeb3e('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb3e('0x2'));var fs=require('fs');var Redis=require(_0xeb3e('0x3'));var db=require(_0xeb3e('0x4'))['db'];var utils=require(_0xeb3e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeb3e('0x6')][_0xeb3e('0x7')]({'port':0x232a});config[_0xeb3e('0x8')]=_['defaults'](config[_0xeb3e('0x8')],{'host':_0xeb3e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb3e('0x8')]));require(_0xeb3e('0xa'))[_0xeb3e('0xb')](socket);function respondWithRpcPromise(_0x1d3432,_0xf86024,_0x4fd759){return new BPromise(function(_0x25b714,_0x9e2877){return client['request'](_0x1d3432,_0x4fd759)[_0xeb3e('0xc')](function(_0x36b331){logger[_0xeb3e('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0xf86024,_0xeb3e('0xe'));logger[_0xeb3e('0xf')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf86024,_0xeb3e('0xe'),JSON[_0xeb3e('0x10')](_0x36b331));if(_0x36b331[_0xeb3e('0x11')]){if(_0x36b331['error'][_0xeb3e('0x12')]===0x1f4){logger['error'](_0xeb3e('0x13'),_0xf86024,_0x36b331[_0xeb3e('0x11')]['message']);return _0x9e2877(_0x36b331[_0xeb3e('0x11')][_0xeb3e('0x14')]);}logger[_0xeb3e('0x11')](_0xeb3e('0x13'),_0xf86024,_0x36b331['error'][_0xeb3e('0x14')]);return _0x25b714(_0x36b331[_0xeb3e('0x11')][_0xeb3e('0x14')]);}else{logger['info'](_0xeb3e('0x13'),_0xf86024,_0xeb3e('0xe'));_0x25b714(_0x36b331[_0xeb3e('0x15')]['message']);}})[_0xeb3e('0x16')](function(_0x30ff66){logger[_0xeb3e('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0xf86024,_0x30ff66);_0x9e2877(_0x30ff66);});});}exports[_0xeb3e('0x17')]=function(_0x32c05b){var _0x149a73=this;return new Promise(function(_0x255aa9,_0x125a58){return db[_0xeb3e('0x18')][_0xeb3e('0x19')]({'raw':_0x32c05b[_0xeb3e('0x1a')]?_0x32c05b[_0xeb3e('0x1a')][_0xeb3e('0x1b')]===undefined?!![]:![]:!![],'where':_0x32c05b['options']?_0x32c05b[_0xeb3e('0x1a')][_0xeb3e('0x1c')]||null:null,'attributes':_0x32c05b[_0xeb3e('0x1a')]?_0x32c05b['options'][_0xeb3e('0x1d')]||null:null,'include':_0x32c05b[_0xeb3e('0x1a')]?_0x32c05b['options']['include']?_[_0xeb3e('0x1e')](_0x32c05b['options'][_0xeb3e('0x1f')],function(_0x32f798){return{'model':db[_0x32f798[_0xeb3e('0x20')]],'as':_0x32f798['as'],'attributes':_0x32f798['attributes'],'include':_0x32f798[_0xeb3e('0x1f')]?_[_0xeb3e('0x1e')](_0x32f798[_0xeb3e('0x1f')],function(_0x100b87){return{'model':db[_0x100b87[_0xeb3e('0x20')]],'as':_0x100b87['as'],'attributes':_0x100b87['attributes'],'include':_0x100b87[_0xeb3e('0x1f')]?_[_0xeb3e('0x1e')](_0x100b87['include'],function(_0x1d5fa9){return{'model':db[_0x1d5fa9[_0xeb3e('0x20')]],'as':_0x1d5fa9['as'],'attributes':_0x1d5fa9['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb3e('0xc')](function(_0xb7c5fe){logger[_0xeb3e('0xd')](_0xeb3e('0x17'),_0x32c05b);logger[_0xeb3e('0xf')](_0xeb3e('0x17'),_0x32c05b,JSON[_0xeb3e('0x10')](_0xb7c5fe));_0x255aa9(_0xb7c5fe);})[_0xeb3e('0x16')](function(_0x2fbc0c){logger[_0xeb3e('0x11')](_0xeb3e('0x17'),_0x2fbc0c['message'],_0x32c05b);_0x125a58(_0x149a73['error'](0x1f4,_0x2fbc0c[_0xeb3e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c03e5bf..b910790 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 _0xc966=['whatsappAccount:','./whatsappAccount.events','save','emit','removeListener','length'];(function(_0x310130,_0x67824b){var _0x180650=function(_0x5e7729){while(--_0x5e7729){_0x310130['push'](_0x310130['shift']());}};_0x180650(++_0x67824b);}(_0xc966,0x8b));var _0x6c96=function(_0x1810bb,_0x3b572e){_0x1810bb=_0x1810bb-0x0;var _0x1c47f1=_0xc966[_0x1810bb];return _0x1c47f1;};'use strict';var WhatsappAccountEvents=require(_0x6c96('0x0'));var events=[_0x6c96('0x1'),'remove','update'];function createListener(_0x381906,_0x234912){return function(_0x44bee9){_0x234912[_0x6c96('0x2')](_0x381906,_0x44bee9);};}function removeListener(_0x522d0f,_0x208db3){return function(){WhatsappAccountEvents[_0x6c96('0x3')](_0x522d0f,_0x208db3);};}exports['register']=function(_0x2a0d0c){for(var _0x213a01=0x0,_0x4b1416=events[_0x6c96('0x4')];_0x213a01<_0x4b1416;_0x213a01++){var _0x1a8466=events[_0x213a01];var _0x582430=createListener(_0x6c96('0x5')+_0x1a8466,_0x2a0d0c);WhatsappAccountEvents['on'](_0x1a8466,_0x582430);}}; \ No newline at end of file +var _0x20a5=['whatsappAccount:','./whatsappAccount.events','save','removeListener','register','length'];(function(_0xbd4254,_0x31c08b){var _0x46c0f3=function(_0xd0dce7){while(--_0xd0dce7){_0xbd4254['push'](_0xbd4254['shift']());}};_0x46c0f3(++_0x31c08b);}(_0x20a5,0x97));var _0x520a=function(_0x4e1331,_0x53500f){_0x4e1331=_0x4e1331-0x0;var _0x3534ac=_0x20a5[_0x4e1331];return _0x3534ac;};'use strict';var WhatsappAccountEvents=require(_0x520a('0x0'));var events=[_0x520a('0x1'),'remove','update'];function createListener(_0x3efa39,_0x10173a){return function(_0x247bc6){_0x10173a['emit'](_0x3efa39,_0x247bc6);};}function removeListener(_0x9c5ea1,_0x29a114){return function(){WhatsappAccountEvents[_0x520a('0x2')](_0x9c5ea1,_0x29a114);};}exports[_0x520a('0x3')]=function(_0x42737f){for(var _0x52a06f=0x0,_0x1e541e=events[_0x520a('0x4')];_0x52a06f<_0x1e541e;_0x52a06f++){var _0x41c7f2=events[_0x52a06f];var _0x1fe459=createListener(_0x520a('0x5')+_0x41c7f2,_0x42737f);WhatsappAccountEvents['on'](_0x41c7f2,_0x1fe459);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a6c0086..8c7f6dd 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 _0xd3c3=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3c3,0x102));var _0x3d3c=function(_0xfdab16,_0x29abb4){_0xfdab16=_0xfdab16-0x0;var _0x5b3029=_0xd3c3[_0xfdab16];return _0x5b3029;};'use strict';var multer=require(_0x3d3c('0x0'));var util=require(_0x3d3c('0x1'));var path=require(_0x3d3c('0x2'));var timeout=require(_0x3d3c('0x3'));var express=require('express');var router=express[_0x3d3c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d3c('0x5'));var interaction=require(_0x3d3c('0x6'));var config=require(_0x3d3c('0x7'));var controller=require('./whatsappApplication.controller');router[_0x3d3c('0x8')]('/',auth[_0x3d3c('0x9')](),controller['index']);router['get'](_0x3d3c('0xa'),auth[_0x3d3c('0x9')](),controller[_0x3d3c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d3c('0xc')]);router[_0x3d3c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3d3c('0xe')]);router[_0x3d3c('0xf')]('/:id',auth[_0x3d3c('0x9')](),controller[_0x3d3c('0x10')]);module[_0x3d3c('0x11')]=router; \ No newline at end of file +var _0xbfbf=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfbf,0x84));var _0xfbfb=function(_0x577ef2,_0x59fe53){_0x577ef2=_0x577ef2-0x0;var _0x2ac985=_0xbfbf[_0x577ef2];return _0x2ac985;};'use strict';var multer=require(_0xfbfb('0x0'));var util=require('util');var path=require(_0xfbfb('0x1'));var timeout=require(_0xfbfb('0x2'));var express=require('express');var router=express[_0xfbfb('0x3')]();var fs_extra=require(_0xfbfb('0x4'));var auth=require(_0xfbfb('0x5'));var interaction=require(_0xfbfb('0x6'));var config=require(_0xfbfb('0x7'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0xfbfb('0x8')](),controller[_0xfbfb('0x9')]);router[_0xfbfb('0xa')](_0xfbfb('0xb'),auth[_0xfbfb('0x8')](),controller[_0xfbfb('0xc')]);router[_0xfbfb('0xd')]('/',auth[_0xfbfb('0x8')](),controller[_0xfbfb('0xe')]);router[_0xfbfb('0xf')](_0xfbfb('0xb'),auth[_0xfbfb('0x8')](),controller[_0xfbfb('0x10')]);router[_0xfbfb('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfbfb('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 11d42d9..50cb3b2 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 _0xe6e9=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6e9,0xc6));var _0x9e6e=function(_0x4904c4,_0x200164){_0x4904c4=_0x4904c4-0x0;var _0x35bab3=_0xe6e9[_0x4904c4];return _0x35bab3;};'use strict';var Sequelize=require(_0x9e6e('0x0'));module[_0x9e6e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9e6e('0x2')],'allowNull':![],'defaultValue':_0x9e6e('0x3')},'appdata':{'type':Sequelize[_0x9e6e('0x4')]()},'description':{'type':Sequelize[_0x9e6e('0x2')]},'interval':{'type':Sequelize[_0x9e6e('0x2')],'defaultValue':_0x9e6e('0x5')}}; \ No newline at end of file +var _0x047f=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x457934,_0x15d5f6){var _0x1d0256=function(_0x1246bd){while(--_0x1246bd){_0x457934['push'](_0x457934['shift']());}};_0x1d0256(++_0x15d5f6);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf047('0x0'));module[_0xf047('0x1')]={'priority':{'type':Sequelize[_0xf047('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf047('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf047('0x4')]()},'description':{'type':Sequelize[_0xf047('0x3')]},'interval':{'type':Sequelize[_0xf047('0x3')],'defaultValue':_0xf047('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 87543f5..10c1234 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 _0x3cae=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','end','error','name','send','map','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x1b24e4,_0x383b32){var _0xfe7354=function(_0xab5ab5){while(--_0xab5ab5){_0x1b24e4['push'](_0x1b24e4['shift']());}};_0xfe7354(++_0x383b32);}(_0x3cae,0x117));var _0xe3ca=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x3cae[_0xd39959];return _0x1ff69c;};'use strict';var emlformat=require(_0xe3ca('0x0'));var rimraf=require(_0xe3ca('0x1'));var zipdir=require(_0xe3ca('0x2'));var jsonpatch=require(_0xe3ca('0x3'));var rp=require(_0xe3ca('0x4'));var moment=require(_0xe3ca('0x5'));var BPromise=require(_0xe3ca('0x6'));var Mustache=require('mustache');var util=require(_0xe3ca('0x7'));var path=require(_0xe3ca('0x8'));var sox=require('sox');var csv=require(_0xe3ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3ca('0xa'));var _=require(_0xe3ca('0xb'));var squel=require(_0xe3ca('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3ca('0xd'));var deskjs=require(_0xe3ca('0xe'));var toCsv=require(_0xe3ca('0x9'));var querystring=require(_0xe3ca('0xf'));var Papa=require(_0xe3ca('0x10'));var Redis=require(_0xe3ca('0x11'));var authService=require(_0xe3ca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe3ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3ca('0x14'))(_0xe3ca('0x15'));var utils=require(_0xe3ca('0x16'));var config=require(_0xe3ca('0x17'));var licenseUtil=require(_0xe3ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57fa3c,_0x3ff241){_0x3ff241=_0x3ff241||0xcc;return function(_0x5f1c02){if(_0x5f1c02){return _0x57fa3c[_0xe3ca('0x19')](_0x3ff241);}return _0x57fa3c[_0xe3ca('0x1a')](_0x3ff241)['end']();};}function respondWithResult(_0x3d62e2,_0x3a9455){_0x3a9455=_0x3a9455||0xc8;return function(_0x210c69){if(_0x210c69){return _0x3d62e2[_0xe3ca('0x1a')](_0x3a9455)[_0xe3ca('0x1b')](_0x210c69);}};}function respondWithFilteredResult(_0x292251,_0x884795){return function(_0x337b6c){if(_0x337b6c){var _0x5f2e2d=typeof _0x884795['offset']===_0xe3ca('0x1c')&&typeof _0x884795[_0xe3ca('0x1d')]===_0xe3ca('0x1c');var _0x3dae55=_0x337b6c[_0xe3ca('0x1e')];var _0x2d73d9=_0x5f2e2d?0x0:_0x884795['offset'];var _0x2eafde=_0x5f2e2d?_0x337b6c[_0xe3ca('0x1e')]:_0x884795[_0xe3ca('0x1f')]+_0x884795['limit'];var _0x4b7b9f;if(_0x2eafde>=_0x3dae55){_0x2eafde=_0x3dae55;_0x4b7b9f=0xc8;}else{_0x4b7b9f=0xce;}_0x292251['status'](_0x4b7b9f);return _0x292251[_0xe3ca('0x20')]('Content-Range',_0x2d73d9+'-'+_0x2eafde+'/'+_0x3dae55)['json'](_0x337b6c);}return null;};}function patchUpdates(_0x3b7591){return function(_0x1822e4){try{jsonpatch[_0xe3ca('0x21')](_0x1822e4,_0x3b7591,!![]);}catch(_0x149291){return BPromise[_0xe3ca('0x22')](_0x149291);}return _0x1822e4['save']();};}function saveUpdates(_0x3b1a75,_0x3ab26e){return function(_0x5bc481){if(_0x5bc481){return _0x5bc481[_0xe3ca('0x23')](_0x3b1a75)[_0xe3ca('0x24')](function(_0x33dc04){return _0x33dc04;});}return null;};}function removeEntity(_0xd681a7,_0xaf5191){return function(_0x392bdb){if(_0x392bdb){return _0x392bdb[_0xe3ca('0x25')]()[_0xe3ca('0x24')](function(){_0xd681a7[_0xe3ca('0x1a')](0xcc)[_0xe3ca('0x26')]();});}};}function handleEntityNotFound(_0xa5b18f,_0x5098e3){return function(_0x16e1d6){if(!_0x16e1d6){_0xa5b18f['sendStatus'](0x194);}return _0x16e1d6;};}function handleError(_0x11ec88,_0x2fffe4){_0x2fffe4=_0x2fffe4||0x1f4;return function(_0x3de0ef){logger[_0xe3ca('0x27')](_0x3de0ef['stack']);if(_0x3de0ef['name']){delete _0x3de0ef[_0xe3ca('0x28')];}_0x11ec88[_0xe3ca('0x1a')](_0x2fffe4)[_0xe3ca('0x29')](_0x3de0ef);};}exports['index']=function(_0x1dbd98,_0x39dd6e){var _0x1d28a2={},_0x17d3c7={},_0x532662={'count':0x0,'rows':[]};var _0x4dd07f=_[_0xe3ca('0x2a')](db['WhatsappApplication'][_0xe3ca('0x2b')],function(_0x5cf384){return{'name':_0x5cf384['fieldName'],'type':_0x5cf384[_0xe3ca('0x2c')][_0xe3ca('0x2d')]};});_0x17d3c7[_0xe3ca('0x2e')]=_[_0xe3ca('0x2a')](_0x4dd07f,_0xe3ca('0x28'));_0x17d3c7['query']=_[_0xe3ca('0x2f')](_0x1dbd98['query']);_0x17d3c7['filters']=_[_0xe3ca('0x30')](_0x17d3c7[_0xe3ca('0x2e')],_0x17d3c7[_0xe3ca('0x31')]);_0x1d28a2[_0xe3ca('0x32')]=_[_0xe3ca('0x30')](_0x17d3c7[_0xe3ca('0x2e')],qs[_0xe3ca('0x33')](_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x33')]));_0x1d28a2[_0xe3ca('0x32')]=_0x1d28a2[_0xe3ca('0x32')][_0xe3ca('0x34')]?_0x1d28a2['attributes']:_0x17d3c7[_0xe3ca('0x2e')];if(!_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x35')](_0xe3ca('0x36'))){_0x1d28a2[_0xe3ca('0x1d')]=qs[_0xe3ca('0x1d')](_0x1dbd98['query'][_0xe3ca('0x1d')]);_0x1d28a2[_0xe3ca('0x1f')]=qs[_0xe3ca('0x1f')](_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x1f')]);}_0x1d28a2[_0xe3ca('0x37')]=qs[_0xe3ca('0x38')](_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x38')]);_0x1d28a2['where']=qs[_0xe3ca('0x39')](_[_0xe3ca('0x3a')](_0x1dbd98['query'],_0x17d3c7[_0xe3ca('0x39')]),_0x4dd07f);if(_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x3b')]){_0x1d28a2['where']=_[_0xe3ca('0x3c')](_0x1d28a2[_0xe3ca('0x3d')],{'$or':_['map'](_0x4dd07f,function(_0x1a34b0){if(_0x1a34b0['type']!=='VIRTUAL'){var _0x14e94a={};_0x14e94a[_0x1a34b0[_0xe3ca('0x28')]]={'$like':'%'+_0x1dbd98['query'][_0xe3ca('0x3b')]+'%'};return _0x14e94a;}})});}_0x1d28a2=_[_0xe3ca('0x3c')]({},_0x1d28a2,_0x1dbd98[_0xe3ca('0x3e')]);var _0x399142={'where':_0x1d28a2[_0xe3ca('0x3d')]};return db[_0xe3ca('0x3f')][_0xe3ca('0x1e')](_0x399142)[_0xe3ca('0x24')](function(_0x43d703){_0x532662['count']=_0x43d703;if(_0x1dbd98[_0xe3ca('0x31')][_0xe3ca('0x40')]){_0x1d28a2[_0xe3ca('0x41')]=[{'all':!![]}];}return db[_0xe3ca('0x3f')][_0xe3ca('0x42')](_0x1d28a2);})[_0xe3ca('0x24')](function(_0x2a0290){_0x532662[_0xe3ca('0x43')]=_0x2a0290;return _0x532662;})[_0xe3ca('0x24')](respondWithFilteredResult(_0x39dd6e,_0x1d28a2))[_0xe3ca('0x44')](handleError(_0x39dd6e,null));};exports[_0xe3ca('0x45')]=function(_0x25ac6d,_0x5e2412){var _0x4acf7a={'raw':!![],'where':{'id':_0x25ac6d[_0xe3ca('0x46')]['id']}},_0x275010={};_0x275010['model']=_[_0xe3ca('0x2f')](db[_0xe3ca('0x3f')][_0xe3ca('0x2b')]);_0x275010[_0xe3ca('0x31')]=_[_0xe3ca('0x2f')](_0x25ac6d[_0xe3ca('0x31')]);_0x275010[_0xe3ca('0x39')]=_[_0xe3ca('0x30')](_0x275010[_0xe3ca('0x2e')],_0x275010[_0xe3ca('0x31')]);_0x4acf7a[_0xe3ca('0x32')]=_['intersection'](_0x275010[_0xe3ca('0x2e')],qs[_0xe3ca('0x33')](_0x25ac6d['query']['fields']));_0x4acf7a[_0xe3ca('0x32')]=_0x4acf7a[_0xe3ca('0x32')]['length']?_0x4acf7a[_0xe3ca('0x32')]:_0x275010[_0xe3ca('0x2e')];if(_0x25ac6d['query']['includeAll']){_0x4acf7a[_0xe3ca('0x41')]=[{'all':!![]}];}_0x4acf7a=_[_0xe3ca('0x3c')]({},_0x4acf7a,_0x25ac6d[_0xe3ca('0x3e')]);return db[_0xe3ca('0x3f')][_0xe3ca('0x47')](_0x4acf7a)['then'](handleEntityNotFound(_0x5e2412,null))[_0xe3ca('0x24')](respondWithResult(_0x5e2412,null))[_0xe3ca('0x44')](handleError(_0x5e2412,null));};exports[_0xe3ca('0x48')]=function(_0x464e86,_0x396555){return db[_0xe3ca('0x3f')][_0xe3ca('0x48')](_0x464e86[_0xe3ca('0x49')],{})[_0xe3ca('0x24')](respondWithResult(_0x396555,0xc9))['catch'](handleError(_0x396555,null));};exports['update']=function(_0x539d5f,_0x542dfb){if(_0x539d5f[_0xe3ca('0x49')]['id']){delete _0x539d5f[_0xe3ca('0x49')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x539d5f[_0xe3ca('0x46')]['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x542dfb,null))[_0xe3ca('0x24')](saveUpdates(_0x539d5f['body'],null))['then'](respondWithResult(_0x542dfb,null))[_0xe3ca('0x44')](handleError(_0x542dfb,null));};exports['destroy']=function(_0x42d9f7,_0x23d780){return db[_0xe3ca('0x3f')][_0xe3ca('0x47')]({'where':{'id':_0x42d9f7[_0xe3ca('0x46')]['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x23d780,null))[_0xe3ca('0x24')](removeEntity(_0x23d780,null))[_0xe3ca('0x44')](handleError(_0x23d780,null));}; \ No newline at end of file +var _0x85de=['length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','params','WhatsappApplication','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes'];(function(_0x405b7c,_0x5ec349){var _0x2a5255=function(_0x4b5f3d){while(--_0x4b5f3d){_0x405b7c['push'](_0x405b7c['shift']());}};_0x2a5255(++_0x5ec349);}(_0x85de,0x65));var _0xe85d=function(_0x303b91,_0x1b5e56){_0x303b91=_0x303b91-0x0;var _0x4dca31=_0x85de[_0x303b91];return _0x4dca31;};'use strict';var emlformat=require(_0xe85d('0x0'));var rimraf=require(_0xe85d('0x1'));var zipdir=require(_0xe85d('0x2'));var jsonpatch=require(_0xe85d('0x3'));var rp=require(_0xe85d('0x4'));var moment=require(_0xe85d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe85d('0x6'));var util=require(_0xe85d('0x7'));var path=require(_0xe85d('0x8'));var sox=require(_0xe85d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe85d('0xa'));var _=require(_0xe85d('0xb'));var squel=require(_0xe85d('0xc'));var crypto=require(_0xe85d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe85d('0xe'));var toCsv=require(_0xe85d('0xf'));var querystring=require(_0xe85d('0x10'));var Papa=require(_0xe85d('0x11'));var Redis=require(_0xe85d('0x12'));var authService=require(_0xe85d('0x13'));var qs=require(_0xe85d('0x14'));var as=require(_0xe85d('0x15'));var hardwareService=require(_0xe85d('0x16'));var logger=require(_0xe85d('0x17'))(_0xe85d('0x18'));var utils=require(_0xe85d('0x19'));var config=require(_0xe85d('0x1a'));var licenseUtil=require(_0xe85d('0x1b'));var db=require(_0xe85d('0x1c'))['db'];function respondWithStatusCode(_0x233e9a,_0x157b4e){_0x157b4e=_0x157b4e||0xcc;return function(_0x535c99){if(_0x535c99){return _0x233e9a['sendStatus'](_0x157b4e);}return _0x233e9a[_0xe85d('0x1d')](_0x157b4e)[_0xe85d('0x1e')]();};}function respondWithResult(_0x3128e0,_0xffb13b){_0xffb13b=_0xffb13b||0xc8;return function(_0x25e99e){if(_0x25e99e){return _0x3128e0[_0xe85d('0x1d')](_0xffb13b)[_0xe85d('0x1f')](_0x25e99e);}};}function respondWithFilteredResult(_0x5d84ed,_0x5d6e10){return function(_0x483538){if(_0x483538){var _0x49e886=typeof _0x5d6e10[_0xe85d('0x20')]===_0xe85d('0x21')&&typeof _0x5d6e10['limit']===_0xe85d('0x21');var _0x39c88f=_0x483538[_0xe85d('0x22')];var _0x49ab09=_0x49e886?0x0:_0x5d6e10[_0xe85d('0x20')];var _0x106d20=_0x49e886?_0x483538['count']:_0x5d6e10[_0xe85d('0x20')]+_0x5d6e10['limit'];var _0x480303;if(_0x106d20>=_0x39c88f){_0x106d20=_0x39c88f;_0x480303=0xc8;}else{_0x480303=0xce;}_0x5d84ed[_0xe85d('0x1d')](_0x480303);return _0x5d84ed[_0xe85d('0x23')](_0xe85d('0x24'),_0x49ab09+'-'+_0x106d20+'/'+_0x39c88f)[_0xe85d('0x1f')](_0x483538);}return null;};}function patchUpdates(_0x168029){return function(_0x59050a){try{jsonpatch[_0xe85d('0x25')](_0x59050a,_0x168029,!![]);}catch(_0x20c880){return BPromise[_0xe85d('0x26')](_0x20c880);}return _0x59050a[_0xe85d('0x27')]();};}function saveUpdates(_0x1cd9ae,_0x1160a4){return function(_0x34db3d){if(_0x34db3d){return _0x34db3d[_0xe85d('0x28')](_0x1cd9ae)[_0xe85d('0x29')](function(_0x58a716){return _0x58a716;});}return null;};}function removeEntity(_0x18683c,_0x3ca176){return function(_0x46102e){if(_0x46102e){return _0x46102e[_0xe85d('0x2a')]()[_0xe85d('0x29')](function(){_0x18683c[_0xe85d('0x1d')](0xcc)[_0xe85d('0x1e')]();});}};}function handleEntityNotFound(_0x379218,_0xeaacbd){return function(_0x46ff2e){if(!_0x46ff2e){_0x379218[_0xe85d('0x2b')](0x194);}return _0x46ff2e;};}function handleError(_0x374e66,_0x409b08){_0x409b08=_0x409b08||0x1f4;return function(_0x405a86){logger['error'](_0x405a86['stack']);if(_0x405a86[_0xe85d('0x2c')]){delete _0x405a86[_0xe85d('0x2c')];}_0x374e66[_0xe85d('0x1d')](_0x409b08)[_0xe85d('0x2d')](_0x405a86);};}exports['index']=function(_0x2a9da5,_0x200b75){var _0x156c85={},_0x4c6907={},_0x131a4a={'count':0x0,'rows':[]};var _0x562ef2=_['map'](db['WhatsappApplication'][_0xe85d('0x2e')],function(_0x14299d){return{'name':_0x14299d[_0xe85d('0x2f')],'type':_0x14299d[_0xe85d('0x30')][_0xe85d('0x31')]};});_0x4c6907[_0xe85d('0x32')]=_[_0xe85d('0x33')](_0x562ef2,_0xe85d('0x2c'));_0x4c6907[_0xe85d('0x34')]=_[_0xe85d('0x35')](_0x2a9da5[_0xe85d('0x34')]);_0x4c6907['filters']=_['intersection'](_0x4c6907[_0xe85d('0x32')],_0x4c6907[_0xe85d('0x34')]);_0x156c85['attributes']=_[_0xe85d('0x36')](_0x4c6907[_0xe85d('0x32')],qs[_0xe85d('0x37')](_0x2a9da5['query'][_0xe85d('0x37')]));_0x156c85[_0xe85d('0x38')]=_0x156c85['attributes'][_0xe85d('0x39')]?_0x156c85['attributes']:_0x4c6907[_0xe85d('0x32')];if(!_0x2a9da5[_0xe85d('0x34')]['hasOwnProperty'](_0xe85d('0x3a'))){_0x156c85[_0xe85d('0x3b')]=qs[_0xe85d('0x3b')](_0x2a9da5[_0xe85d('0x34')][_0xe85d('0x3b')]);_0x156c85[_0xe85d('0x20')]=qs[_0xe85d('0x20')](_0x2a9da5[_0xe85d('0x34')][_0xe85d('0x20')]);}_0x156c85[_0xe85d('0x3c')]=qs[_0xe85d('0x3d')](_0x2a9da5[_0xe85d('0x34')][_0xe85d('0x3d')]);_0x156c85[_0xe85d('0x3e')]=qs['filters'](_[_0xe85d('0x3f')](_0x2a9da5[_0xe85d('0x34')],_0x4c6907['filters']),_0x562ef2);if(_0x2a9da5[_0xe85d('0x34')]['filter']){_0x156c85[_0xe85d('0x3e')]=_['merge'](_0x156c85[_0xe85d('0x3e')],{'$or':_[_0xe85d('0x33')](_0x562ef2,function(_0x5a1297){if(_0x5a1297[_0xe85d('0x30')]!==_0xe85d('0x40')){var _0x3846ba={};_0x3846ba[_0x5a1297[_0xe85d('0x2c')]]={'$like':'%'+_0x2a9da5[_0xe85d('0x34')][_0xe85d('0x41')]+'%'};return _0x3846ba;}})});}_0x156c85=_[_0xe85d('0x42')]({},_0x156c85,_0x2a9da5['options']);var _0x4312cb={'where':_0x156c85[_0xe85d('0x3e')]};return db['WhatsappApplication'][_0xe85d('0x22')](_0x4312cb)['then'](function(_0xefd6e9){_0x131a4a[_0xe85d('0x22')]=_0xefd6e9;if(_0x2a9da5[_0xe85d('0x34')][_0xe85d('0x43')]){_0x156c85['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xe85d('0x44')](_0x156c85);})[_0xe85d('0x29')](function(_0x20b24e){_0x131a4a[_0xe85d('0x45')]=_0x20b24e;return _0x131a4a;})['then'](respondWithFilteredResult(_0x200b75,_0x156c85))[_0xe85d('0x46')](handleError(_0x200b75,null));};exports[_0xe85d('0x47')]=function(_0x5b695e,_0x22275b){var _0x5ab41d={'raw':!![],'where':{'id':_0x5b695e[_0xe85d('0x48')]['id']}},_0x53e9a5={};_0x53e9a5['model']=_['keys'](db[_0xe85d('0x49')]['rawAttributes']);_0x53e9a5[_0xe85d('0x34')]=_[_0xe85d('0x35')](_0x5b695e[_0xe85d('0x34')]);_0x53e9a5['filters']=_[_0xe85d('0x36')](_0x53e9a5[_0xe85d('0x32')],_0x53e9a5[_0xe85d('0x34')]);_0x5ab41d[_0xe85d('0x38')]=_[_0xe85d('0x36')](_0x53e9a5[_0xe85d('0x32')],qs[_0xe85d('0x37')](_0x5b695e[_0xe85d('0x34')][_0xe85d('0x37')]));_0x5ab41d['attributes']=_0x5ab41d[_0xe85d('0x38')][_0xe85d('0x39')]?_0x5ab41d[_0xe85d('0x38')]:_0x53e9a5[_0xe85d('0x32')];if(_0x5b695e[_0xe85d('0x34')][_0xe85d('0x43')]){_0x5ab41d[_0xe85d('0x4a')]=[{'all':!![]}];}_0x5ab41d=_['merge']({},_0x5ab41d,_0x5b695e[_0xe85d('0x4b')]);return db[_0xe85d('0x49')]['find'](_0x5ab41d)[_0xe85d('0x29')](handleEntityNotFound(_0x22275b,null))[_0xe85d('0x29')](respondWithResult(_0x22275b,null))['catch'](handleError(_0x22275b,null));};exports[_0xe85d('0x4c')]=function(_0x518b43,_0x5062ec){return db['WhatsappApplication'][_0xe85d('0x4c')](_0x518b43[_0xe85d('0x4d')],{})[_0xe85d('0x29')](respondWithResult(_0x5062ec,0xc9))[_0xe85d('0x46')](handleError(_0x5062ec,null));};exports[_0xe85d('0x28')]=function(_0x559547,_0x14cb64){if(_0x559547['body']['id']){delete _0x559547[_0xe85d('0x4d')]['id'];}return db[_0xe85d('0x49')][_0xe85d('0x4e')]({'where':{'id':_0x559547[_0xe85d('0x48')]['id']}})['then'](handleEntityNotFound(_0x14cb64,null))['then'](saveUpdates(_0x559547['body'],null))[_0xe85d('0x29')](respondWithResult(_0x14cb64,null))[_0xe85d('0x46')](handleError(_0x14cb64,null));};exports['destroy']=function(_0x103693,_0x4015e0){return db[_0xe85d('0x49')][_0xe85d('0x4e')]({'where':{'id':_0x103693[_0xe85d('0x48')]['id']}})[_0xe85d('0x29')](handleEntityNotFound(_0x4015e0,null))[_0xe85d('0x29')](removeEntity(_0x4015e0,null))[_0xe85d('0x46')](handleError(_0x4015e0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index fe44b7a..00ebac5 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 _0xb2ff=['utf8mb4_unicode_ci','lodash','util','api','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xb2ff,0x123));var _0xfb2f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb2ff[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var logger=require('../../config/logger')(_0xfb2f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb2f('0x3'));var rimraf=require('rimraf');var config=require(_0xfb2f('0x4'));var attributes=require(_0xfb2f('0x5'));module[_0xfb2f('0x6')]=function(_0x1d3416,_0x542ce7){return _0x1d3416['define'](_0xfb2f('0x7'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb2f('0x8'),'collate':_0xfb2f('0x9')});}; \ No newline at end of file +var _0x16cc=['path','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x485cbc,_0x59f524){var _0x3bae30=function(_0x5f3f90){while(--_0x5f3f90){_0x485cbc['push'](_0x485cbc['shift']());}};_0x3bae30(++_0x59f524);}(_0x16cc,0x120));var _0xc16c=function(_0x3963e5,_0x4b570){_0x3963e5=_0x3963e5-0x0;var _0x50f60d=_0x16cc[_0x3963e5];return _0x50f60d;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require(_0xc16c('0x1'))(_0xc16c('0x2'));var moment=require(_0xc16c('0x3'));var BPromise=require(_0xc16c('0x4'));var rp=require(_0xc16c('0x5'));var fs=require('fs');var path=require(_0xc16c('0x6'));var rimraf=require('rimraf');var config=require(_0xc16c('0x7'));var attributes=require(_0xc16c('0x8'));module[_0xc16c('0x9')]=function(_0x1019ec,_0x5ea82b){return _0x1019ec[_0xc16c('0xa')]('WhatsappApplication',attributes,{'tableName':_0xc16c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc16c('0xc'),'collate':_0xc16c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7ea82cb..6656466 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0x2e6494,_0x3c6a46){var _0x483347=function(_0x112b8e){while(--_0x112b8e){_0x2e6494['push'](_0x2e6494['shift']());}};_0x483347(++_0x3c6a46);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0xf3cd[_0x6899c7];return _0x5186ee;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x15c168,_0x637939){var _0x217d1e=function(_0x13c582){while(--_0x13c582){_0x15c168['push'](_0x15c168['shift']());}};_0x217d1e(++_0x637939);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2635ac,_0x5c6108){_0x2635ac=_0x2635ac-0x0;var _0x693d1e=_0xd0bb[_0x2635ac];return _0x693d1e;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d97b0f9..2952f31 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 _0x4300=['removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','update','whatsappinteraction:destroy','destroy'];(function(_0x13e9db,_0xa4e913){var _0x55637d=function(_0x3534b2){while(--_0x3534b2){_0x13e9db['push'](_0x13e9db['shift']());}};_0x55637d(++_0xa4e913);}(_0x4300,0x1a6));var _0x0430=function(_0x5231bf,_0x5a6109){_0x5231bf=_0x5231bf-0x0;var _0x31f34c=_0x4300[_0x5231bf];return _0x31f34c;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var fs_extra=require(_0x0430('0x2'));var auth=require(_0x0430('0x3'));var interaction=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x0430('0x6')]('/',auth['isAuthenticated'](),controller[_0x0430('0x7')]);router['get'](_0x0430('0x8'),auth[_0x0430('0x9')](),controller[_0x0430('0xa')]);router[_0x0430('0x6')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0xc')]);router[_0x0430('0x6')](_0x0430('0xd'),auth['isAuthenticated'](),controller[_0x0430('0xe')]);router[_0x0430('0x6')](_0x0430('0xf'),auth[_0x0430('0x9')](),controller[_0x0430('0x10')]);router[_0x0430('0x11')]('/',auth[_0x0430('0x9')](),controller[_0x0430('0x12')]);router['post']('/:id/messages',auth[_0x0430('0x9')](),controller[_0x0430('0x13')]);router[_0x0430('0x11')](_0x0430('0x14'),auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),'whatsappinteraction:addtags'),controller[_0x0430('0x17')]);router[_0x0430('0x18')](_0x0430('0xb'),auth[_0x0430('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x0430('0x19')]);router['delete']('/:id',auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),_0x0430('0x1a')),controller[_0x0430('0x1b')]);router['delete']('/:id/tags',auth[_0x0430('0x9')](),controller[_0x0430('0x1c')]);module[_0x0430('0x1d')]=router; \ No newline at end of file +var _0xe626=['whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','post','create','/:id/messages','addMessage','tracked','whatsappinteraction:addtags','addTags','put'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xe626,0x9d));var _0x6e62=function(_0x51d298,_0x50c43b){_0x51d298=_0x51d298-0x0;var _0x14b1c5=_0xe626[_0x51d298];return _0x14b1c5;};'use strict';var multer=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var path=require(_0x6e62('0x2'));var timeout=require(_0x6e62('0x3'));var express=require('express');var router=express[_0x6e62('0x4')]();var fs_extra=require(_0x6e62('0x5'));var auth=require(_0x6e62('0x6'));var interaction=require(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6e62('0x9')]);router[_0x6e62('0xa')]('/describe',auth[_0x6e62('0xb')](),controller[_0x6e62('0xc')]);router[_0x6e62('0xa')](_0x6e62('0xd'),auth['isAuthenticated'](),controller[_0x6e62('0xe')]);router[_0x6e62('0xa')]('/:id/messages',auth[_0x6e62('0xb')](),controller['getMessages']);router[_0x6e62('0xa')]('/:id/download',auth[_0x6e62('0xb')](),controller['download']);router[_0x6e62('0xf')]('/',auth[_0x6e62('0xb')](),controller[_0x6e62('0x10')]);router[_0x6e62('0xf')](_0x6e62('0x11'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x12')]);router['post']('/:id/tags',auth[_0x6e62('0xb')](),interaction[_0x6e62('0x13')]('whatsapp',_0x6e62('0x14')),controller[_0x6e62('0x15')]);router[_0x6e62('0x16')](_0x6e62('0xd'),auth['isAuthenticated'](),interaction[_0x6e62('0x13')](_0x6e62('0x17'),_0x6e62('0x18')),controller[_0x6e62('0x19')]);router[_0x6e62('0x1a')](_0x6e62('0xd'),auth[_0x6e62('0xb')](),interaction[_0x6e62('0x13')](_0x6e62('0x17'),_0x6e62('0x1b')),controller['destroy']);router[_0x6e62('0x1a')](_0x6e62('0x1c'),auth['isAuthenticated'](),controller[_0x6e62('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 97667b2..ec766e3 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 _0x4453=['ENUM','out','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x7ae5ff,_0xbf454d){var _0x34a2b6=function(_0x9754c3){while(--_0x9754c3){_0x7ae5ff['push'](_0x7ae5ff['shift']());}};_0x34a2b6(++_0xbf454d);}(_0x4453,0x9c));var _0x3445=function(_0x4af5ad,_0x5455f9){_0x4af5ad=_0x4af5ad-0x0;var _0x370191=_0x4453[_0x4af5ad];return _0x370191;};'use strict';var Sequelize=require(_0x3445('0x0'));var moment=require(_0x3445('0x1'));module['exports']={'closed':{'type':Sequelize[_0x3445('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3445('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3445('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3445('0x4')]},'note':{'type':Sequelize[_0x3445('0x4')]},'phone':{'type':Sequelize[_0x3445('0x4')]},'read1stAt':{'type':Sequelize[_0x3445('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3445('0x5')]('in',_0x3445('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3445('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3445('0x5')]('in',_0x3445('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa751=['BOOLEAN','STRING','ENUM','out','DATE','sequelize','moment','exports'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0xa751,0x175));var _0x1a75=function(_0x41a29a,_0x54eeaf){_0x41a29a=_0x41a29a-0x0;var _0x5c40b8=_0xa751[_0x41a29a];return _0x5c40b8;};'use strict';var Sequelize=require(_0x1a75('0x0'));var moment=require(_0x1a75('0x1'));module[_0x1a75('0x2')]={'closed':{'type':Sequelize[_0x1a75('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1a75('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1a75('0x4')]},'note':{'type':Sequelize[_0x1a75('0x4')]},'phone':{'type':Sequelize[_0x1a75('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1a75('0x5')]('in',_0x1a75('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1a75('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1a75('0x5')]('in',_0x1a75('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1a75('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c446bf0..5bd589a 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 _0x9b09=['then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','talking','answered','unmanaged','closed','waiting','UserId','total','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','search','conditions','find','unreadMessages','value','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','compact','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','WhatsappInteraction','rawAttributes','include','options','create','describe','addMessage','ids','WhatsappMessage','format','includeAll','findAll','addTags','setTags','omit','Tag','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','createReadStream','pipe','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x9b09,0x1ad));var _0x99b0=function(_0xefdc1c,_0x10f40b){_0xefdc1c=_0xefdc1c-0x0;var _0x48581c=_0x9b09[_0xefdc1c];return _0x48581c;};'use strict';var emlformat=require(_0x99b0('0x0'));var rimraf=require(_0x99b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99b0('0x2'));var rp=require(_0x99b0('0x3'));var moment=require('moment');var BPromise=require(_0x99b0('0x4'));var Mustache=require('mustache');var util=require(_0x99b0('0x5'));var path=require('path');var sox=require(_0x99b0('0x6'));var csv=require(_0x99b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b0('0x8'));var _=require(_0x99b0('0x9'));var squel=require('squel');var crypto=require(_0x99b0('0xa'));var jsforce=require(_0x99b0('0xb'));var deskjs=require(_0x99b0('0xc'));var toCsv=require(_0x99b0('0x7'));var querystring=require(_0x99b0('0xd'));var Papa=require('papaparse');var Redis=require(_0x99b0('0xe'));var authService=require(_0x99b0('0xf'));var qs=require(_0x99b0('0x10'));var as=require(_0x99b0('0x11'));var pdf=require(_0x99b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99b0('0x13'))(_0x99b0('0x14'));var utils=require(_0x99b0('0x15'));var config=require(_0x99b0('0x16'));var licenseUtil=require(_0x99b0('0x17'));var db=require(_0x99b0('0x18'))['db'];config['redis']=_[_0x99b0('0x19')](config['redis'],{'host':_0x99b0('0x1a'),'port':0x18eb});var socket=require(_0x99b0('0x1b'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x99b0('0x1c')](socket);function respondWithStatusCode(_0x2743d3,_0x2331e7){_0x2331e7=_0x2331e7||0xcc;return function(_0x590aa4){if(_0x590aa4){return _0x2743d3['sendStatus'](_0x2331e7);}return _0x2743d3['status'](_0x2331e7)[_0x99b0('0x1d')]();};}function respondWithResult(_0x30c552,_0x4d40ea){_0x4d40ea=_0x4d40ea||0xc8;return function(_0x250e22){if(_0x250e22){return _0x30c552[_0x99b0('0x1e')](_0x4d40ea)[_0x99b0('0x1f')](_0x250e22);}};}function respondWithFilteredResult(_0x7bbb89,_0x1cb302){return function(_0x45317d){if(_0x45317d){var _0x193512=typeof _0x1cb302['offset']===_0x99b0('0x20')&&typeof _0x1cb302[_0x99b0('0x21')]===_0x99b0('0x20');var _0x104a98=_0x45317d[_0x99b0('0x22')];var _0x15b7fd=_0x193512?0x0:_0x1cb302[_0x99b0('0x23')];var _0x1783ca=_0x193512?_0x45317d[_0x99b0('0x22')]:_0x1cb302[_0x99b0('0x23')]+_0x1cb302[_0x99b0('0x21')];var _0x2b27ac;if(_0x1783ca>=_0x104a98){_0x1783ca=_0x104a98;_0x2b27ac=0xc8;}else{_0x2b27ac=0xce;}_0x7bbb89[_0x99b0('0x1e')](_0x2b27ac);return _0x7bbb89[_0x99b0('0x24')](_0x99b0('0x25'),_0x15b7fd+'-'+_0x1783ca+'/'+_0x104a98)[_0x99b0('0x1f')](_0x45317d);}return null;};}function patchUpdates(_0xa469fa){return function(_0x26c2ef){try{jsonpatch[_0x99b0('0x26')](_0x26c2ef,_0xa469fa,!![]);}catch(_0x27b238){return BPromise[_0x99b0('0x27')](_0x27b238);}return _0x26c2ef[_0x99b0('0x28')]();};}function saveUpdates(_0x3be9fc,_0x21e7e3){return function(_0x4b2aa4){if(_0x4b2aa4){return _0x4b2aa4[_0x99b0('0x29')](_0x3be9fc)['then'](function(_0x55f4f1){return _0x55f4f1;});}return null;};}function removeEntity(_0x34075a,_0x3efaab){return function(_0x123f1b){if(_0x123f1b){return _0x123f1b[_0x99b0('0x2a')]()[_0x99b0('0x2b')](function(){_0x34075a['status'](0xcc)[_0x99b0('0x1d')]();});}};}function handleEntityNotFound(_0x154dec,_0x18d113){return function(_0xb1c1ad){if(!_0xb1c1ad){_0x154dec['sendStatus'](0x194);}return _0xb1c1ad;};}function handleError(_0x7dc8a6,_0x2e0850){_0x2e0850=_0x2e0850||0x1f4;return function(_0x5429cd){logger[_0x99b0('0x2c')](_0x5429cd[_0x99b0('0x2d')]);if(_0x5429cd[_0x99b0('0x2e')]){delete _0x5429cd[_0x99b0('0x2e')];}_0x7dc8a6[_0x99b0('0x1e')](_0x2e0850)[_0x99b0('0x2f')](_0x5429cd);};}function getInteractionUsers(_0x233eb6,_0x398885){return new BPromise(function(_0x19c850,_0x5b009e){try{if(_0x398885[_0x233eb6['id']]){_0x233eb6[_0x99b0('0x30')]=_[_0x99b0('0x31')](_0x398885[_0x233eb6['id']],function(_0x473767){return{'id':_0x473767['id'],'fullname':_0x473767[_0x99b0('0x32')]};});}}catch(_0x1c91df){_0x5b009e(_0x1c91df);}_0x19c850(_0x233eb6);});}function getInteractionTags(_0x362227,_0x5ad57a){return new BPromise(function(_0x5ae485,_0x5573cf){try{if(_0x362227[_0x99b0('0x33')]){_0x362227[_0x99b0('0x34')]=[];_0x362227[_0x99b0('0x33')][_0x99b0('0x35')](',')[_0x99b0('0x36')](function(_0x2b249e){_0x362227['Tags'][_0x99b0('0x37')](_0x5ad57a[_0x2b249e]);});}delete _0x362227['TagIds'];}catch(_0x3d9861){_0x5573cf(_0x3d9861);}_0x5ae485(_0x362227);});}function updateWhatsappInteraction(_0x3f1c4c,_0x5db13e,_0x421be7){return new BPromise(function(_0x4a4d34,_0x4e32b2){return getInteractionUsers(_0x3f1c4c,_0x421be7)[_0x99b0('0x2b')](function(_0x42648d){return getInteractionTags(_0x42648d,_0x5db13e);})['then'](function(_0x4e47ce){return getStateInteraction(_0x4e47ce);})[_0x99b0('0x2b')](function(_0x24967e){_0x4a4d34(_0x24967e);})['catch'](function(_0x3d5c5f){_0x4e32b2(_0x3d5c5f);});});}function getStateInteraction(_0x5e091b){return new BPromise(function(_0x2930a9){_0x5e091b['waiting']=0x0;_0x5e091b[_0x99b0('0x38')]=0x0;_0x5e091b[_0x99b0('0x39')]=0x0;_0x5e091b[_0x99b0('0x3a')]=0x0;_0x5e091b['total']=0x0;if(!_0x5e091b[_0x99b0('0x3b')]&&!_0x5e091b['UserId']){_0x5e091b[_0x99b0('0x3c')]+=0x1;}if(!_0x5e091b['closed']&&_0x5e091b[_0x99b0('0x3d')]){_0x5e091b[_0x99b0('0x38')]+=0x1;if(_0x5e091b[_0x99b0('0x3c')]){_0x5e091b[_0x99b0('0x3c')]-=0x1;}}if(_0x5e091b[_0x99b0('0x3b')]&&_0x5e091b[_0x99b0('0x3d')]){_0x5e091b['answered']+=0x1;if(_0x5e091b['talking']){_0x5e091b[_0x99b0('0x38')]-=0x1;}}if(_0x5e091b[_0x99b0('0x3b')]&&!_0x5e091b[_0x99b0('0x3d')]){_0x5e091b[_0x99b0('0x3a')]+=0x1;if(_0x5e091b[_0x99b0('0x3c')]){_0x5e091b['waiting']-=0x1;}}_0x5e091b[_0x99b0('0x3e')]+=0x1;_0x2930a9(_0x5e091b);});}exports['index']=function(_0x482456,_0xc01419){var _0x294b97={},_0x42b7b4={},_0x4c58a6={'count':0x0,'rows':[]};var _0x5b312b=_[_0x99b0('0x31')](db['WhatsappInteraction']['rawAttributes'],function(_0x49fb9d){return{'name':_0x49fb9d['fieldName'],'type':_0x49fb9d[_0x99b0('0x3f')][_0x99b0('0x40')]};});_0x42b7b4['model']=_[_0x99b0('0x31')](_0x5b312b,'name');_0x42b7b4[_0x99b0('0x41')]=_[_0x99b0('0x42')](_0x482456[_0x99b0('0x41')]);_0x42b7b4[_0x99b0('0x43')]=_['intersection'](_0x42b7b4['model'],_0x42b7b4['query']);_0x294b97[_0x99b0('0x44')]=_[_0x99b0('0x45')](_0x42b7b4[_0x99b0('0x46')],qs[_0x99b0('0x47')](_0x482456['query']['fields']));_0x294b97[_0x99b0('0x44')]=_0x294b97[_0x99b0('0x44')][_0x99b0('0x48')]?_0x294b97[_0x99b0('0x44')]:_0x42b7b4['model'];if(!_0x482456[_0x99b0('0x41')][_0x99b0('0x49')](_0x99b0('0x4a'))){_0x294b97['limit']=qs[_0x99b0('0x21')](_0x482456[_0x99b0('0x41')]['limit']);_0x294b97['offset']=qs[_0x99b0('0x23')](_0x482456['query'][_0x99b0('0x23')]);}_0x294b97[_0x99b0('0x4b')]=qs[_0x99b0('0x4c')](_0x482456['query'][_0x99b0('0x4c')]);_0x294b97[_0x99b0('0x4d')]=qs[_0x99b0('0x43')](_[_0x99b0('0x4e')](_0x482456['query'],_0x42b7b4['filters']),_0x5b312b);var _0x57cea0=[];var _0x663789=squel['select']()[_0x99b0('0x4f')]('id')[_0x99b0('0x4f')](_0x99b0('0x2e'))[_0x99b0('0x4f')](_0x99b0('0x50'))[_0x99b0('0x51')]('tools_tags');var _0x4794ea=squel[_0x99b0('0x52')]()['field'](_0x99b0('0x53'))[_0x99b0('0x4f')](_0x99b0('0x54'))[_0x99b0('0x4f')](_0x99b0('0x55'))[_0x99b0('0x51')](_0x99b0('0x56'),'ui')[_0x99b0('0x57')](_0x99b0('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x351653=squel[_0x99b0('0x52')]()[_0x99b0('0x51')](_0x99b0('0x59'),'i')[_0x99b0('0x57')](_0x99b0('0x5a'),'c',_0x99b0('0x5b'))[_0x99b0('0x57')](_0x99b0('0x58'),'o',_0x99b0('0x5c'))[_0x99b0('0x57')](_0x99b0('0x5d'),'a',_0x99b0('0x5e'))[_0x99b0('0x57')]('whatsapp_messages','me',_0x99b0('0x5f'))[_0x99b0('0x57')]('whatsapp_interaction_has_tags','it',_0x99b0('0x60'))[_0x99b0('0x57')](_0x99b0('0x61'),'t','t.id\x20=\x20it.TagId');var _0x45eb3f=squel['expr']();var _0x57cdef=[];var _0x15acd2=squel['expr']();var _0x5ee59c;if(_0x482456[_0x99b0('0x41')]['search']){_0x5ee59c=as['parseSearch'](_0x482456[_0x99b0('0x41')][_0x99b0('0x62')]);var _0x2424e1=_0x5ee59c['sqlOperator'];for(var _0x2294e6=0x0;_0x2294e6<_0x5ee59c[_0x99b0('0x63')][_0x99b0('0x48')];_0x2294e6++){var _0x225e43=_0x5ee59c[_0x99b0('0x63')][_0x2294e6];var _0x31a031='i';var _0x1a8b6a=_[_0x99b0('0x64')](_0x5b312b,[_0x99b0('0x2e'),_0x225e43[_0x99b0('0x4f')]]);if(!_0x1a8b6a){switch(_0x225e43[_0x99b0('0x4f')]){case _0x99b0('0x65'):if(_0x225e43[_0x99b0('0x66')]==0x1){_0x351653[_0x99b0('0x67')]('`'+_0x225e43[_0x99b0('0x4f')]+'`\x20=\x200');}else{_0x351653['having']('`'+_0x225e43[_0x99b0('0x4f')]+_0x99b0('0x68'));}break;case'Contact':if(_0x225e43['operator']===_0x99b0('0x69')){if(_0x225e43['value'][_0x99b0('0x35')]('\x20')[_0x99b0('0x48')]>0x1){_0x45eb3f[_0x2424e1](_0x99b0('0x6a'),qs[_0x99b0('0x6b')](_0x225e43[_0x99b0('0x66')]),null);}else{var _0x1d6a55='%'+_0x225e43['value']+'%';_0x45eb3f[_0x2424e1](_0x99b0('0x6c'),_0x1d6a55,_0x1d6a55,_0x1d6a55);}}else{_0x1a8b6a=_[_0x99b0('0x64')](_0x5b312b,['name',_0x99b0('0x6d')]);_0x225e43[_0x99b0('0x4f')]=_0x99b0('0x6d');_0x5ae1ae=as['buildExpression'](_0x31a031,_0x1a8b6a[_0x99b0('0x3f')],_0x225e43);_0x45eb3f[_0x2424e1](_0x5ae1ae[_0x99b0('0x6e')],_0x5ae1ae['value'][_0x99b0('0x6f')],_0x5ae1ae[_0x99b0('0x66')][_0x99b0('0x1d')]);}break;case'Tag':var _0x549d9a=_0x225e43[_0x99b0('0x66')][_0x99b0('0x35')](',')[_0x99b0('0x31')](function(_0x11ea81){return Number(_0x11ea81);});_0x549d9a[_0x99b0('0x36')](function(_0x54b2d3){_0x15acd2['or'](_0x99b0('0x70'),'%,'+_0x54b2d3+',%');});_0x57cdef=_['union'](_0x57cdef,_0x549d9a);break;case _0x99b0('0x71'):if(_0x225e43['operator']===_0x99b0('0x69')){_0x45eb3f[_0x2424e1](_0x99b0('0x72'),'%'+_0x225e43[_0x99b0('0x66')]+'%',null);}else{_0x1a8b6a=_['find'](_0x5b312b,[_0x99b0('0x2e'),_0x99b0('0x3d')]);_0x225e43[_0x99b0('0x4f')]=_0x99b0('0x3d');_0x5ae1ae=as[_0x99b0('0x73')](_0x31a031,_0x1a8b6a[_0x99b0('0x3f')],_0x225e43);_0x45eb3f[_0x2424e1](_0x5ae1ae[_0x99b0('0x6e')],_0x5ae1ae[_0x99b0('0x66')][_0x99b0('0x6f')],_0x5ae1ae[_0x99b0('0x66')]['end']);}break;case _0x99b0('0x74'):_0x5ae1ae=as[_0x99b0('0x73')]('me',null,_0x225e43);_0x45eb3f[_0x2424e1](_0x5ae1ae[_0x99b0('0x6e')],_0x5ae1ae[_0x99b0('0x66')]['start'],_0x5ae1ae[_0x99b0('0x66')]['end']);break;}}else{var _0x5ae1ae=as[_0x99b0('0x73')](_0x31a031,_0x1a8b6a['type'],_0x225e43);_0x45eb3f[_0x2424e1](_0x5ae1ae[_0x99b0('0x6e')],_0x5ae1ae[_0x99b0('0x66')][_0x99b0('0x6f')],_0x5ae1ae['value'][_0x99b0('0x1d')]);}}}else{var _0x355dd2=_(_0x482456['query'])[_0x99b0('0x42')]()[_0x99b0('0x31')](function(_0xd06a61){return _['some'](_0x5b312b,[_0x99b0('0x2e'),_0xd06a61])?_0xd06a61:undefined;})[_0x99b0('0x75')]()[_0x99b0('0x66')]();if(!_['isEmpty'](_0x355dd2)){_0x355dd2[_0x99b0('0x36')](function(_0x31ee74){if(_0x31ee74==='WhatsappAccountId'){_0x351653[_0x99b0('0x4d')](_0x99b0('0x76'),[]['concat'](_0x482456[_0x99b0('0x41')][_0x31ee74]));}else if(_0x31ee74===_0x99b0('0x77')){var _0x3113ea=JSON[_0x99b0('0x78')](_0x482456[_0x99b0('0x41')][_0x31ee74])[_0x99b0('0x79')];var _0x47850c=JSON[_0x99b0('0x78')](_0x482456[_0x99b0('0x41')][_0x31ee74])[_0x99b0('0x7a')];_0x351653[_0x99b0('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3113ea,_0x47850c);}else{if(_0x482456['query'][_0x31ee74]===_0x99b0('0x7b')){_0x351653[_0x99b0('0x4d')]('i.'+_0x31ee74+_0x99b0('0x7c'));}else{_0x351653[_0x99b0('0x4d')]('i.'+_0x31ee74+_0x99b0('0x7d'),_0x482456[_0x99b0('0x41')][_0x31ee74]);}}});}if(_0x482456[_0x99b0('0x41')]['read']){if(_0x482456[_0x99b0('0x41')][_0x99b0('0x7e')]==0x1){_0x351653['having']('`unreadMessages`\x20=\x200');}else{_0x351653[_0x99b0('0x67')](_0x99b0('0x7f'));}}if(_0x482456[_0x99b0('0x41')]['tag']){_0x57cdef=_[_0x99b0('0x80')](_0x482456[_0x99b0('0x41')][_0x99b0('0x81')])?_0x482456['query'][_0x99b0('0x81')]:new Array(_0x482456[_0x99b0('0x41')][_0x99b0('0x81')]);_0x57cdef[_0x99b0('0x36')](function(_0x3fba1d){_0x15acd2['or'](_0x99b0('0x70'),'%,'+_0x3fba1d+',%');});}if(_0x482456['query'][_0x99b0('0x82')]){var _0xdd823b=_0x482456[_0x99b0('0x41')][_0x99b0('0x82')][_0x99b0('0x83')]('\x5c','\x5c\x5c')[_0x99b0('0x83')](/'/g,'\x27\x27');if(qs[_0x99b0('0x84')](_0xdd823b)){_0x45eb3f['or'](_0x99b0('0x85'),_0xdd823b+'%')['or'](_0x99b0('0x86'),_0xdd823b+'%');}else{_0x45eb3f['or'](_0x99b0('0x87'),qs[_0x99b0('0x6b')](_0xdd823b))['or'](_0x99b0('0x88'),_0xdd823b+'%');}}}_0x351653[_0x99b0('0x4d')](_0x45eb3f);_0x351653[_0x99b0('0x89')]('i.id');var _0x298e57={'type':db[_0x99b0('0x8a')][_0x99b0('0x8b')][_0x99b0('0x8c')],'raw':!![]};var _0x589328=_0x351653[_0x99b0('0x8d')]();_0x589328['field'](_0x99b0('0x8e'));_0x589328['field'](_0x99b0('0x8f'),_0x99b0('0x65'));if(_0x294b97[_0x99b0('0x4b')]){_0x294b97[_0x99b0('0x4b')][_0x99b0('0x36')](function(_0x1aaf32){var _0x568371=_0x1aaf32[0x0]===_0x99b0('0x90')?_0x1aaf32[0x0]:'i.'+_0x1aaf32[0x0];_0x351653[_0x99b0('0x4b')](_0x568371,_0x1aaf32[0x1]==='DESC'?![]:!![]);});}if(!_[_0x99b0('0x91')](_0x57cdef)){_0x351653[_0x99b0('0x67')](_0x15acd2);_0x589328['where'](_0x99b0('0x92'),_0x57cdef);}BPromise[_0x99b0('0x93')]()[_0x99b0('0x2b')](function(){if(!_0x5ee59c){if(_0x482456[_0x99b0('0x41')]['WhatsappAccountId'])return;_0x589328[_0x99b0('0x4d')](_0x99b0('0x94'));_0x351653['where'](_0x99b0('0x94'));return;}if(_0x482456[_0x99b0('0x95')][_0x99b0('0x96')]!==_0x99b0('0x97'))return;return _0x482456[_0x99b0('0x95')][_0x99b0('0x98')]({'attributes':['id'],'raw':!![]})[_0x99b0('0x2b')](function(_0x7eaff8){if(_[_0x99b0('0x91')](_0x7eaff8)){_0x589328[_0x99b0('0x4d')]('i.WhatsappAccountId\x20IS\x20NULL');_0x351653[_0x99b0('0x4d')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x589328[_0x99b0('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x7eaff8,'id'));_0x351653[_0x99b0('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x7eaff8,'id'));}});})['then'](function(){if(_0x482456[_0x99b0('0x95')][_0x99b0('0x96')]===_0x99b0('0x97')&&!_0x5ee59c&&!_0x482456[_0x99b0('0x41')]['WhatsappAccountId'])return[];return db[_0x99b0('0x99')][_0x99b0('0x41')](_0x589328['toString'](),_0x298e57);})[_0x99b0('0x2b')](function(_0x1c495d){_0x4c58a6[_0x99b0('0x22')]=_0x1c495d['length'];if(_0x4c58a6[_0x99b0('0x22')]===0x0)return[];return db[_0x99b0('0x99')]['query'](_0x663789[_0x99b0('0x9a')](),_0x298e57)[_0x99b0('0x2b')](function(_0x53d5ee){_0x57cea0=_[_0x99b0('0x9b')](_0x53d5ee,'id');_0x298e57=_[_0x99b0('0x9c')](_0x298e57,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x482456['query'][_0x99b0('0x47')]){_0x294b97[_0x99b0('0x44')][_0x99b0('0x36')](function(_0xd34d0c){_0x351653[_0x99b0('0x4f')]('i.'+_0xd34d0c);});}else{_0x351653[_0x99b0('0x4f')](_0x99b0('0x8f'),_0x99b0('0x65'));_0x351653[_0x99b0('0x4f')](_0x99b0('0x9d'),_0x99b0('0x9e'));_0x351653[_0x99b0('0x4f')](_0x99b0('0x9f'),_0x99b0('0xa0'));_0x351653[_0x99b0('0x4f')](_0x99b0('0xa1'),_0x99b0('0x90'));_0x351653[_0x99b0('0x4f')](_0x99b0('0xa2'));_0x351653[_0x99b0('0x4f')]('c.firstName','Contact.firstName');_0x351653['field'](_0x99b0('0xa3'),_0x99b0('0xa4'));_0x351653[_0x99b0('0x4f')]('c.email','Contact.email');_0x351653[_0x99b0('0x4f')]('c.phone',_0x99b0('0xa5'));_0x351653[_0x99b0('0x4f')](_0x99b0('0xa6'),_0x99b0('0xa7'));_0x351653['field']('c.fax','Contact.fax');_0x351653[_0x99b0('0x4f')](_0x99b0('0xa8'),_0x99b0('0xa9'));_0x351653[_0x99b0('0x4f')](_0x99b0('0xaa'),_0x99b0('0xab'));_0x351653['field'](_0x99b0('0xac'),_0x99b0('0x33'));}if(_0x294b97['limit'])_0x351653['limit'](_0x294b97[_0x99b0('0x21')]);if(_0x294b97[_0x99b0('0x23')])_0x351653[_0x99b0('0x23')](_0x294b97[_0x99b0('0x23')]);return db['sequelize'][_0x99b0('0x41')](_0x351653['toString'](),_0x298e57);})['then'](function(_0x233401){if(_0x233401[_0x99b0('0x48')]>0x0)_0x4794ea[_0x99b0('0x4d')](_0x99b0('0xad'),_[_0x99b0('0x31')](_0x233401,'id'));return db[_0x99b0('0x99')]['query'](_0x4794ea[_0x99b0('0x9a')](),_0x298e57)['then'](function(_0x53fcc9){var _0x3683e2=_[_0x99b0('0xae')](_0x53fcc9,_0x99b0('0xaf'));var _0x43ed86=[];_0x233401[_0x99b0('0x36')](function(_0x133b84){_0x43ed86[_0x99b0('0x37')](updateWhatsappInteraction(_0x133b84,_0x57cea0,_0x3683e2));});return BPromise[_0x99b0('0xb0')](_0x43ed86);});});})[_0x99b0('0x2b')](function(_0x37966a){_0x4c58a6['rows']=_0x37966a;return _0x4c58a6;})[_0x99b0('0x2b')](respondWithFilteredResult(_0xc01419,_0x294b97))[_0x99b0('0xb1')](handleError(_0xc01419,null));};exports[_0x99b0('0xb2')]=function(_0x5dd45e,_0x178dee){var _0x28ae03={'raw':![],'where':{'id':_0x5dd45e[_0x99b0('0xb3')]['id']}},_0x4814df={};_0x4814df['model']=_['keys'](db[_0x99b0('0xb4')][_0x99b0('0xb5')]);_0x4814df[_0x99b0('0x41')]=_[_0x99b0('0x42')](_0x5dd45e[_0x99b0('0x41')]);_0x4814df[_0x99b0('0x43')]=_['intersection'](_0x4814df['model'],_0x4814df[_0x99b0('0x41')]);_0x28ae03[_0x99b0('0x44')]=_[_0x99b0('0x45')](_0x4814df[_0x99b0('0x46')],qs[_0x99b0('0x47')](_0x5dd45e[_0x99b0('0x41')][_0x99b0('0x47')]));_0x28ae03[_0x99b0('0x44')]=_0x28ae03[_0x99b0('0x44')]['length']?_0x28ae03[_0x99b0('0x44')]:_0x4814df[_0x99b0('0x46')];if(_0x5dd45e[_0x99b0('0x41')]['includeAll']){_0x28ae03[_0x99b0('0xb6')]=[{'all':!![]}];}_0x28ae03=_[_0x99b0('0x9c')]({},_0x28ae03,_0x5dd45e[_0x99b0('0xb7')]);return db[_0x99b0('0xb4')][_0x99b0('0x64')](_0x28ae03)[_0x99b0('0x2b')](handleEntityNotFound(_0x178dee,null))[_0x99b0('0x2b')](respondWithResult(_0x178dee,null))[_0x99b0('0xb1')](handleError(_0x178dee,null));};exports[_0x99b0('0xb8')]=function(_0x21978e,_0x367c1b){return db[_0x99b0('0xb4')][_0x99b0('0xb8')](_0x21978e['body'],{})[_0x99b0('0x2b')](respondWithResult(_0x367c1b,0xc9))[_0x99b0('0xb1')](handleError(_0x367c1b,null));};exports[_0x99b0('0x29')]=function(_0x1a5015,_0xc8292d){if(_0x1a5015[_0x99b0('0x74')]['id']){delete _0x1a5015['body']['id'];}return db[_0x99b0('0xb4')][_0x99b0('0x64')]({'where':{'id':_0x1a5015[_0x99b0('0xb3')]['id']}})[_0x99b0('0x2b')](handleEntityNotFound(_0xc8292d,null))[_0x99b0('0x2b')](saveUpdates(_0x1a5015[_0x99b0('0x74')],null))[_0x99b0('0x2b')](respondWithResult(_0xc8292d,null))[_0x99b0('0xb1')](handleError(_0xc8292d,null));};exports[_0x99b0('0x2a')]=function(_0x31d1cd,_0x2d8750){return db[_0x99b0('0xb4')]['find']({'where':{'id':_0x31d1cd[_0x99b0('0xb3')]['id']}})[_0x99b0('0x2b')](handleEntityNotFound(_0x2d8750,null))['then'](removeEntity(_0x2d8750,null))['catch'](handleError(_0x2d8750,null));};exports[_0x99b0('0xb9')]=function(_0x283e81,_0x34bf77){return db[_0x99b0('0xb4')]['describe']()[_0x99b0('0x2b')](respondWithResult(_0x34bf77,null))[_0x99b0('0xb1')](handleError(_0x34bf77,null));};exports[_0x99b0('0xba')]=function(_0x52ba3f,_0x52c6dc,_0x330081){return db['WhatsappMessage'][_0x99b0('0x64')]({'where':{'id':_0x52ba3f[_0x99b0('0xb3')]['id']}})[_0x99b0('0x2b')](handleEntityNotFound(_0x52c6dc,null))[_0x99b0('0x2b')](function(_0x2fd803){if(_0x2fd803){return _0x2fd803[_0x99b0('0xba')](_0x52ba3f[_0x99b0('0x74')][_0x99b0('0xbb')],_['omit'](_0x52ba3f['body'],[_0x99b0('0xbb'),'id'])||{});}})[_0x99b0('0x2b')](respondWithResult(_0x52c6dc,null))[_0x99b0('0xb1')](handleError(_0x52c6dc,null));};exports['getMessages']=function(_0x5cc51f,_0x41929b,_0x5dde0b){var _0x42db1c={'raw':![],'where':{}};var _0x55fe19={};var _0x363466={'count':0x0,'rows':[]};return db[_0x99b0('0xb4')]['findOne']({'where':{'id':_0x5cc51f[_0x99b0('0xb3')]['id']}})[_0x99b0('0x2b')](handleEntityNotFound(_0x41929b,null))[_0x99b0('0x2b')](function(_0x16a6d3){if(_0x16a6d3){_0x55fe19[_0x99b0('0x46')]=_[_0x99b0('0x42')](db[_0x99b0('0xbc')][_0x99b0('0xb5')]);_0x55fe19[_0x99b0('0x41')]=_[_0x99b0('0x42')](_0x5cc51f[_0x99b0('0x41')]);_0x55fe19[_0x99b0('0x43')]=_['intersection'](_0x55fe19['model'],_0x55fe19[_0x99b0('0x41')]);_0x42db1c[_0x99b0('0x44')]=_['intersection'](_0x55fe19['model'],qs['fields'](_0x5cc51f['query']['fields']));_0x42db1c[_0x99b0('0x44')]=_0x42db1c[_0x99b0('0x44')][_0x99b0('0x48')]?_0x42db1c[_0x99b0('0x44')]:_0x55fe19[_0x99b0('0x46')];if(!_0x5cc51f[_0x99b0('0x41')][_0x99b0('0x49')]('nolimit')){_0x42db1c[_0x99b0('0x21')]=qs[_0x99b0('0x21')](_0x5cc51f[_0x99b0('0x41')]['limit']);_0x42db1c[_0x99b0('0x23')]=qs[_0x99b0('0x23')](_0x5cc51f[_0x99b0('0x41')][_0x99b0('0x23')]);}_0x42db1c[_0x99b0('0x4b')]=qs['sort'](_0x5cc51f[_0x99b0('0x41')]['sort']);_0x42db1c[_0x99b0('0x4d')]=qs[_0x99b0('0x43')](_[_0x99b0('0x4e')](_0x5cc51f[_0x99b0('0x41')],_0x55fe19[_0x99b0('0x43')]));_0x42db1c[_0x99b0('0x4d')][_0x99b0('0xaf')]=_0x16a6d3['id'];if(_0x5cc51f[_0x99b0('0x41')]['filter']){_0x42db1c[_0x99b0('0x4d')]=_[_0x99b0('0x9c')](_0x42db1c[_0x99b0('0x4d')],{'$or':_[_0x99b0('0x31')](_0x42db1c[_0x99b0('0x44')],function(_0xce7018){var _0x41756a={};_0x41756a[_0xce7018]={'$like':'%'+_0x5cc51f['query']['filter']+'%'};return _0x41756a;})});}if(_0x5cc51f[_0x99b0('0x41')][_0x99b0('0x79')]){var _0xec406d=_0x5cc51f[_0x99b0('0x41')][_0x99b0('0x79')][_0x99b0('0x35')](',');var _0x294153={};_0x294153[_0xec406d[0x0]]={'$gte':moment(_0xec406d[0x1])[_0x99b0('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x42db1c[_0x99b0('0x4d')]=_[_0x99b0('0x9c')](_0x42db1c[_0x99b0('0x4d')],_0x294153);}_0x42db1c=_[_0x99b0('0x9c')]({},_0x42db1c,_0x5cc51f[_0x99b0('0xb7')]);return db['WhatsappMessage']['count']({'where':_0x42db1c[_0x99b0('0x4d')]})[_0x99b0('0x2b')](function(_0x316808){_0x363466[_0x99b0('0x22')]=_0x316808;if(_0x5cc51f['query'][_0x99b0('0xbe')]){_0x42db1c[_0x99b0('0xb6')]=[{'all':!![]}];}return db[_0x99b0('0xbc')][_0x99b0('0xbf')](_0x42db1c);})['then'](function(_0x5ce849){_0x363466['rows']=_0x5ce849;return _0x363466;});}})[_0x99b0('0x2b')](respondWithFilteredResult(_0x41929b,_0x42db1c))[_0x99b0('0xb1')](handleError(_0x41929b,null));};exports[_0x99b0('0xc0')]=function(_0x50110f,_0x2e5cc8,_0x406f16){return db['WhatsappInteraction'][_0x99b0('0x64')]({'where':{'id':_0x50110f[_0x99b0('0xb3')]['id']}})['then'](handleEntityNotFound(_0x2e5cc8,null))[_0x99b0('0x2b')](function(_0xfcd597){if(_0xfcd597){return _0xfcd597[_0x99b0('0xc1')](_0x50110f[_0x99b0('0x74')][_0x99b0('0xbb')],_[_0x99b0('0xc2')](_0x50110f[_0x99b0('0x74')],[_0x99b0('0xbb'),'id'])||{})['spread'](function(){return db[_0x99b0('0xc3')][_0x99b0('0xbf')]({'attributes':['id',_0x99b0('0x2e'),_0x99b0('0x50')],'where':{'id':_0x50110f[_0x99b0('0x74')]['ids']}});})[_0x99b0('0x2b')](function(_0x4c07b2){socket[_0x99b0('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x50110f[_0x99b0('0xb3')]['id']),'tags':_0x4c07b2||[]});return{'id':Number(_0x50110f[_0x99b0('0xb3')]['id']),'tags':_0x4c07b2||[]};});}})['then'](respondWithResult(_0x2e5cc8,null))[_0x99b0('0xb1')](handleError(_0x2e5cc8,null));};exports[_0x99b0('0xc5')]=function(_0x2dbf61,_0x558eac,_0x51433f){return db[_0x99b0('0xb4')][_0x99b0('0x64')]({'where':{'id':_0x2dbf61[_0x99b0('0xb3')]['id']}})[_0x99b0('0x2b')](handleEntityNotFound(_0x558eac,null))[_0x99b0('0x2b')](function(_0x30fb68){if(_0x30fb68){return _0x30fb68['removeTags'](_0x2dbf61[_0x99b0('0x41')]['ids']);}})[_0x99b0('0x2b')](respondWithStatusCode(_0x558eac,null))['catch'](handleError(_0x558eac,null));};exports[_0x99b0('0xc6')]=function(_0x188eb2,_0x3007dc){var _0x305186=moment()[_0x99b0('0xc7')]()['toString']();var _0x395485=path[_0x99b0('0xc8')](config[_0x99b0('0xc9')],_0x99b0('0xca'),_0x99b0('0xcb'),_0x99b0('0xcc'));var _0x460284=path[_0x99b0('0xc8')](config[_0x99b0('0xc9')],_0x99b0('0xca'),_0x99b0('0xcb'),_0x99b0('0xcd'));var _0x2c1c3f=path[_0x99b0('0xc8')](_0x395485,_0x305186);var _0x394489=util[_0x99b0('0xbd')]('transcript-%d-%s.zip',_0x188eb2[_0x99b0('0xb3')]['id'],_0x305186);var _0x109c9a=path[_0x99b0('0xc8')](_0x395485,_0x394489);var _0x19b66c=[];_0x19b66c[_0x99b0('0x37')]({'model':db[_0x99b0('0x71')],'as':_0x99b0('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x19b66c[_0x99b0('0x37')]({'model':db[_0x99b0('0xce')],'as':_0x99b0('0xcf'),'attributes':['id',_0x99b0('0xd0'),_0x99b0('0xd1')],'raw':!![]});if(_0x188eb2['query'][_0x99b0('0xcd')]){_0x19b66c['push']({'model':db[_0x99b0('0xd2')],'as':_0x99b0('0xd2'),'raw':!![]});}var _0x11d541=[{'model':db[_0x99b0('0xbc')],'as':_0x99b0('0xd3'),'attributes':['id',_0x99b0('0x74'),_0x99b0('0x77'),_0x99b0('0xd4'),_0x99b0('0xd5'),_0x99b0('0x7e')],'include':_0x19b66c}];_0x11d541[_0x99b0('0x37')]({'model':db[_0x99b0('0xd6')],'as':'Account','attributes':['id',_0x99b0('0x2e')]});_0x11d541[_0x99b0('0x37')]({'model':db['User'],'as':_0x99b0('0xd7'),'attributes':['id',_0x99b0('0x32')]});return db['WhatsappInteraction'][_0x99b0('0x64')]({'where':{'id':_0x188eb2[_0x99b0('0xb3')]['id']},'include':_0x11d541})['then'](handleEntityNotFound(_0x3007dc,null))['then'](function(_0x40bb30){if(_0x40bb30){var _0x57e88a=_0x40bb30[_0x99b0('0xd8')]({'plain':!![]});fs[_0x99b0('0xd9')](_0x2c1c3f);var _0x4c3ccf={'channel':_0x99b0('0xda'),'account':_0x57e88a['Account'][_0x99b0('0x2e')],'agent':_0x57e88a[_0x99b0('0xd7')]?_0x57e88a[_0x99b0('0xd7')][_0x99b0('0x32')]:_0x99b0('0xdb'),'createdAt':moment(_0x57e88a[_0x99b0('0x77')])[_0x99b0('0xbd')](_0x99b0('0xdc'))['toString'](),'closedAt':_0x57e88a[_0x99b0('0x3b')]?moment(_0x57e88a[_0x99b0('0xdd')])[_0x99b0('0xbd')](_0x99b0('0xdc'))[_0x99b0('0x9a')]():'','disposition':_0x57e88a[_0x99b0('0xde')],'messages':_(_0x57e88a[_0x99b0('0xd3')])[_0x99b0('0x82')]({'secret':![]})[_0x99b0('0x31')](function(_0x20a635){if(_0x20a635[_0x99b0('0xd2')]){var _0xd3b410=path[_0x99b0('0xc8')](_0x460284,_0x20a635['Attachment'][_0x99b0('0xdf')]);if(fs[_0x99b0('0xe0')](_0xd3b410)){fs[_0x99b0('0xe1')](_0xd3b410)[_0x99b0('0xe2')](fs['createWriteStream'](path[_0x99b0('0xc8')](_0x2c1c3f,_0x20a635[_0x99b0('0xd2')][_0x99b0('0xdf')])));}}return{'date':moment(_0x20a635[_0x99b0('0x77')])[_0x99b0('0xbd')](_0x99b0('0xdc'))['toString'](),'sender':_0x20a635[_0x99b0('0xd4')]==='out'?_0x20a635[_0x99b0('0x71')]?_0x20a635[_0x99b0('0x71')][_0x99b0('0x32')]:_0x99b0('0xe3'):_0x20a635[_0x99b0('0xcf')][_0x99b0('0xd0')]+(_0x20a635['Contact'][_0x99b0('0xd1')]?'\x20'+_0x20a635['Contact'][_0x99b0('0xd1')]:''),'body':_0x20a635[_0x99b0('0xd2')]?_0x20a635['Attachment'][_0x99b0('0xdf')]:_0x20a635['body'],'direction':_0x20a635['direction']==='out'?'A':'C','secret':_0x20a635[_0x99b0('0xd5')],'read':_0x20a635['read'],'attachment':_0x20a635['Attachment']};})[_0x99b0('0x66')]()};return ejs['renderFile'](path[_0x99b0('0xc8')](config[_0x99b0('0xc9')],_0x99b0('0xca'),_0x99b0('0xe4'),_0x99b0('0xe5')),{'interaction':_0x4c3ccf})['then'](function(_0x15a2a3){var _0x297ca0=path[_0x99b0('0xc8')](_0x2c1c3f,_0x99b0('0xe6')+_0x57e88a['id']+'-'+_0x305186+_0x99b0('0xe7'));var _0x42659b={'path':_0x297ca0,'channel':'Whatsapp','interactionId':_0x57e88a['id']};return pdf[_0x99b0('0xe8')](_0x15a2a3,_0x42659b);})[_0x99b0('0x2b')](function(){return new BPromise(function(_0x17bf3e,_0x4633c7){zipdir(_0x2c1c3f,{'saveTo':_0x109c9a},function(_0x5d0d8f,_0x3ee7eb){if(_0x5d0d8f)return _0x4633c7(_0x5d0d8f);return _0x17bf3e(_0x3ee7eb);});})[_0x99b0('0x2b')](function(){return new BPromise(function(_0x2c77ac,_0x416af9){rimraf(_0x2c1c3f,function(_0x132ecd){if(_0x132ecd)_0x416af9(_0x132ecd);return _0x2c77ac();});});})[_0x99b0('0x2b')](function(){return _0x3007dc[_0x99b0('0xc6')](_0x109c9a,_0x394489,function(_0x1b4bf5){if(_0x1b4bf5){console[_0x99b0('0xe9')]('err',_0x1b4bf5);}else{fs[_0x99b0('0xea')](_0x109c9a);}});});});}else{return _0x3007dc[_0x99b0('0xeb')](0xc8);}})['catch'](handleError(_0x3007dc,null));}; \ No newline at end of file +var _0xca6e=['json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','WhatsappInteraction','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','agent','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','params','keys','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','$gte','format','merge','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','YYYY-MM-DD\x20HH:mm:ss','basename','pipe','out','System','secret','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end'];(function(_0x338d06,_0x315be1){var _0x3b1c29=function(_0x239b66){while(--_0x239b66){_0x338d06['push'](_0x338d06['shift']());}};_0x3b1c29(++_0x315be1);}(_0xca6e,0x1c1));var _0xeca6=function(_0x359664,_0x57fad0){_0x359664=_0x359664-0x0;var _0xedc28f=_0xca6e[_0x359664];return _0xedc28f;};'use strict';var emlformat=require(_0xeca6('0x0'));var rimraf=require(_0xeca6('0x1'));var zipdir=require(_0xeca6('0x2'));var jsonpatch=require(_0xeca6('0x3'));var rp=require(_0xeca6('0x4'));var moment=require('moment');var BPromise=require(_0xeca6('0x5'));var Mustache=require(_0xeca6('0x6'));var util=require('util');var path=require(_0xeca6('0x7'));var sox=require('sox');var csv=require(_0xeca6('0x8'));var ejs=require(_0xeca6('0x9'));var fs=require('fs');var fs_extra=require(_0xeca6('0xa'));var _=require('lodash');var squel=require(_0xeca6('0xb'));var crypto=require('crypto');var jsforce=require(_0xeca6('0xc'));var deskjs=require(_0xeca6('0xd'));var toCsv=require(_0xeca6('0x8'));var querystring=require(_0xeca6('0xe'));var Papa=require(_0xeca6('0xf'));var Redis=require('ioredis');var authService=require(_0xeca6('0x10'));var qs=require(_0xeca6('0x11'));var as=require(_0xeca6('0x12'));var pdf=require(_0xeca6('0x13'));var hardwareService=require(_0xeca6('0x14'));var logger=require('../../config/logger')(_0xeca6('0x15'));var utils=require(_0xeca6('0x16'));var config=require(_0xeca6('0x17'));var licenseUtil=require(_0xeca6('0x18'));var db=require(_0xeca6('0x19'))['db'];config[_0xeca6('0x1a')]=_['defaults'](config['redis'],{'host':_0xeca6('0x1b'),'port':0x18eb});var socket=require(_0xeca6('0x1c'))(new Redis(config[_0xeca6('0x1a')]));require(_0xeca6('0x1d'))['register'](socket);function respondWithStatusCode(_0x431a3f,_0x506744){_0x506744=_0x506744||0xcc;return function(_0x240498){if(_0x240498){return _0x431a3f[_0xeca6('0x1e')](_0x506744);}return _0x431a3f[_0xeca6('0x1f')](_0x506744)[_0xeca6('0x20')]();};}function respondWithResult(_0x17fd17,_0x52f0ea){_0x52f0ea=_0x52f0ea||0xc8;return function(_0x204a34){if(_0x204a34){return _0x17fd17['status'](_0x52f0ea)[_0xeca6('0x21')](_0x204a34);}};}function respondWithFilteredResult(_0x4f5a2f,_0x848ac4){return function(_0x1ea9e2){if(_0x1ea9e2){var _0x1076c9=typeof _0x848ac4['offset']==='undefined'&&typeof _0x848ac4[_0xeca6('0x22')]===_0xeca6('0x23');var _0x2f9211=_0x1ea9e2['count'];var _0x1c7cc3=_0x1076c9?0x0:_0x848ac4[_0xeca6('0x24')];var _0x3bc24c=_0x1076c9?_0x1ea9e2[_0xeca6('0x25')]:_0x848ac4[_0xeca6('0x24')]+_0x848ac4[_0xeca6('0x22')];var _0x3cb68b;if(_0x3bc24c>=_0x2f9211){_0x3bc24c=_0x2f9211;_0x3cb68b=0xc8;}else{_0x3cb68b=0xce;}_0x4f5a2f[_0xeca6('0x1f')](_0x3cb68b);return _0x4f5a2f[_0xeca6('0x26')](_0xeca6('0x27'),_0x1c7cc3+'-'+_0x3bc24c+'/'+_0x2f9211)[_0xeca6('0x21')](_0x1ea9e2);}return null;};}function patchUpdates(_0x14e8ef){return function(_0xe47ed8){try{jsonpatch[_0xeca6('0x28')](_0xe47ed8,_0x14e8ef,!![]);}catch(_0x454bd5){return BPromise[_0xeca6('0x29')](_0x454bd5);}return _0xe47ed8[_0xeca6('0x2a')]();};}function saveUpdates(_0x234179,_0x124586){return function(_0x3fdef3){if(_0x3fdef3){return _0x3fdef3[_0xeca6('0x2b')](_0x234179)['then'](function(_0x48152f){return _0x48152f;});}return null;};}function removeEntity(_0x5d8011,_0x5b5534){return function(_0x2cfe49){if(_0x2cfe49){return _0x2cfe49[_0xeca6('0x2c')]()[_0xeca6('0x2d')](function(){_0x5d8011['status'](0xcc)[_0xeca6('0x20')]();});}};}function handleEntityNotFound(_0x1fbedd,_0x2292fe){return function(_0x42a14c){if(!_0x42a14c){_0x1fbedd[_0xeca6('0x1e')](0x194);}return _0x42a14c;};}function handleError(_0x415132,_0x5e3833){_0x5e3833=_0x5e3833||0x1f4;return function(_0x21c388){logger[_0xeca6('0x2e')](_0x21c388['stack']);if(_0x21c388[_0xeca6('0x2f')]){delete _0x21c388[_0xeca6('0x2f')];}_0x415132[_0xeca6('0x1f')](_0x5e3833)[_0xeca6('0x30')](_0x21c388);};}function getInteractionUsers(_0x25fb20,_0x51ba53){return new BPromise(function(_0x43b04a,_0xd0a5ad){try{if(_0x51ba53[_0x25fb20['id']]){_0x25fb20['Users']=_[_0xeca6('0x31')](_0x51ba53[_0x25fb20['id']],function(_0x3f9dae){return{'id':_0x3f9dae['id'],'fullname':_0x3f9dae[_0xeca6('0x32')]};});}}catch(_0x54e2ee){_0xd0a5ad(_0x54e2ee);}_0x43b04a(_0x25fb20);});}function getInteractionTags(_0x1e8639,_0x14df27){return new BPromise(function(_0x1a4955,_0x247c17){try{if(_0x1e8639[_0xeca6('0x33')]){_0x1e8639[_0xeca6('0x34')]=[];_0x1e8639['TagIds'][_0xeca6('0x35')](',')[_0xeca6('0x36')](function(_0x469da8){_0x1e8639[_0xeca6('0x34')][_0xeca6('0x37')](_0x14df27[_0x469da8]);});}delete _0x1e8639[_0xeca6('0x33')];}catch(_0x428fbc){_0x247c17(_0x428fbc);}_0x1a4955(_0x1e8639);});}function updateWhatsappInteraction(_0x1003f7,_0x1f645b,_0xe4c2e6){return new BPromise(function(_0x2d1169,_0x2637d0){return getInteractionUsers(_0x1003f7,_0xe4c2e6)[_0xeca6('0x2d')](function(_0x4c78b3){return getInteractionTags(_0x4c78b3,_0x1f645b);})[_0xeca6('0x2d')](function(_0x1dbadc){return getStateInteraction(_0x1dbadc);})[_0xeca6('0x2d')](function(_0x578421){_0x2d1169(_0x578421);})[_0xeca6('0x38')](function(_0x452679){_0x2637d0(_0x452679);});});}function getStateInteraction(_0x2f623a){return new BPromise(function(_0x2da721){_0x2f623a[_0xeca6('0x39')]=0x0;_0x2f623a[_0xeca6('0x3a')]=0x0;_0x2f623a[_0xeca6('0x3b')]=0x0;_0x2f623a['unmanaged']=0x0;_0x2f623a[_0xeca6('0x3c')]=0x0;if(!_0x2f623a[_0xeca6('0x3d')]&&!_0x2f623a[_0xeca6('0x3e')]){_0x2f623a[_0xeca6('0x39')]+=0x1;}if(!_0x2f623a[_0xeca6('0x3d')]&&_0x2f623a['UserId']){_0x2f623a['talking']+=0x1;if(_0x2f623a[_0xeca6('0x39')]){_0x2f623a[_0xeca6('0x39')]-=0x1;}}if(_0x2f623a[_0xeca6('0x3d')]&&_0x2f623a['UserId']){_0x2f623a[_0xeca6('0x3b')]+=0x1;if(_0x2f623a['talking']){_0x2f623a['talking']-=0x1;}}if(_0x2f623a[_0xeca6('0x3d')]&&!_0x2f623a[_0xeca6('0x3e')]){_0x2f623a[_0xeca6('0x3f')]+=0x1;if(_0x2f623a[_0xeca6('0x39')]){_0x2f623a[_0xeca6('0x39')]-=0x1;}}_0x2f623a[_0xeca6('0x3c')]+=0x1;_0x2da721(_0x2f623a);});}exports[_0xeca6('0x40')]=function(_0x1f9db7,_0x4f77b9){var _0x470f67={},_0x1fa826={},_0x23d8e5={'count':0x0,'rows':[]};var _0x4d06e3=_[_0xeca6('0x31')](db[_0xeca6('0x41')][_0xeca6('0x42')],function(_0x547d51){return{'name':_0x547d51[_0xeca6('0x43')],'type':_0x547d51[_0xeca6('0x44')]['key']};});_0x1fa826[_0xeca6('0x45')]=_[_0xeca6('0x31')](_0x4d06e3,_0xeca6('0x2f'));_0x1fa826[_0xeca6('0x46')]=_['keys'](_0x1f9db7[_0xeca6('0x46')]);_0x1fa826['filters']=_[_0xeca6('0x47')](_0x1fa826['model'],_0x1fa826['query']);_0x470f67['attributes']=_[_0xeca6('0x47')](_0x1fa826[_0xeca6('0x45')],qs['fields'](_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x48')]));_0x470f67[_0xeca6('0x49')]=_0x470f67['attributes'][_0xeca6('0x4a')]?_0x470f67[_0xeca6('0x49')]:_0x1fa826[_0xeca6('0x45')];if(!_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x4b')](_0xeca6('0x4c'))){_0x470f67['limit']=qs[_0xeca6('0x22')](_0x1f9db7['query'][_0xeca6('0x22')]);_0x470f67['offset']=qs[_0xeca6('0x24')](_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x24')]);}_0x470f67[_0xeca6('0x4d')]=qs[_0xeca6('0x4e')](_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x4e')]);_0x470f67[_0xeca6('0x4f')]=qs[_0xeca6('0x50')](_[_0xeca6('0x51')](_0x1f9db7['query'],_0x1fa826['filters']),_0x4d06e3);var _0x25746a=[];var _0x4278c0=squel[_0xeca6('0x52')]()[_0xeca6('0x53')]('id')[_0xeca6('0x53')]('name')[_0xeca6('0x53')](_0xeca6('0x54'))[_0xeca6('0x55')](_0xeca6('0x56'));var _0x449c15=squel[_0xeca6('0x52')]()[_0xeca6('0x53')](_0xeca6('0x57'))['field'](_0xeca6('0x58'))[_0xeca6('0x53')](_0xeca6('0x59'))[_0xeca6('0x55')](_0xeca6('0x5a'),'ui')[_0xeca6('0x5b')](_0xeca6('0x5c'),'u',_0xeca6('0x5d'));var _0xd732c=squel[_0xeca6('0x52')]()['from']('whatsapp_interactions','i')[_0xeca6('0x5b')](_0xeca6('0x5e'),'c',_0xeca6('0x5f'))[_0xeca6('0x5b')](_0xeca6('0x5c'),'o',_0xeca6('0x60'))[_0xeca6('0x5b')]('whatsapp_accounts','a',_0xeca6('0x61'))['left_join'](_0xeca6('0x62'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xeca6('0x5b')](_0xeca6('0x63'),'it',_0xeca6('0x64'))[_0xeca6('0x5b')](_0xeca6('0x56'),'t',_0xeca6('0x65'));var _0x5ea881=squel[_0xeca6('0x66')]();var _0x593bf7=[];var _0x2ad05b=squel[_0xeca6('0x66')]();var _0x1e63bb;if(_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x67')]){_0x1e63bb=as[_0xeca6('0x68')](_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x67')]);var _0x31946d=_0x1e63bb[_0xeca6('0x69')];for(var _0x134378=0x0;_0x134378<_0x1e63bb[_0xeca6('0x6a')]['length'];_0x134378++){var _0x5a564e=_0x1e63bb[_0xeca6('0x6a')][_0x134378];var _0x214665='i';var _0x797e45=_[_0xeca6('0x6b')](_0x4d06e3,[_0xeca6('0x2f'),_0x5a564e[_0xeca6('0x53')]]);if(!_0x797e45){switch(_0x5a564e['field']){case _0xeca6('0x6c'):if(_0x5a564e[_0xeca6('0x6d')]==0x1){_0xd732c['having']('`'+_0x5a564e[_0xeca6('0x53')]+_0xeca6('0x6e'));}else{_0xd732c[_0xeca6('0x6f')]('`'+_0x5a564e[_0xeca6('0x53')]+'`\x20>\x200');}break;case _0xeca6('0x70'):if(_0x5a564e['operator']===_0xeca6('0x71')){if(_0x5a564e[_0xeca6('0x6d')][_0xeca6('0x35')]('\x20')[_0xeca6('0x4a')]>0x1){_0x5ea881[_0x31946d](_0xeca6('0x72'),qs['getFullTextValue'](_0x5a564e[_0xeca6('0x6d')]),null);}else{var _0x20d211='%'+_0x5a564e[_0xeca6('0x6d')]+'%';_0x5ea881[_0x31946d](_0xeca6('0x73'),_0x20d211,_0x20d211,_0x20d211);}}else{_0x797e45=_[_0xeca6('0x6b')](_0x4d06e3,[_0xeca6('0x2f'),_0xeca6('0x74')]);_0x5a564e[_0xeca6('0x53')]=_0xeca6('0x74');_0x2a7fe0=as[_0xeca6('0x75')](_0x214665,_0x797e45[_0xeca6('0x44')],_0x5a564e);_0x5ea881[_0x31946d](_0x2a7fe0[_0xeca6('0x76')],_0x2a7fe0[_0xeca6('0x6d')][_0xeca6('0x77')],_0x2a7fe0[_0xeca6('0x6d')][_0xeca6('0x20')]);}break;case _0xeca6('0x78'):var _0x3350d1=_0x5a564e['value']['split'](',')[_0xeca6('0x31')](function(_0x55a272){return Number(_0x55a272);});_0x3350d1[_0xeca6('0x36')](function(_0x3976d2){_0x2ad05b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3976d2+',%');});_0x593bf7=_[_0xeca6('0x79')](_0x593bf7,_0x3350d1);break;case _0xeca6('0x7a'):if(_0x5a564e[_0xeca6('0x7b')]==='$substring'){_0x5ea881[_0x31946d](_0xeca6('0x7c'),'%'+_0x5a564e[_0xeca6('0x6d')]+'%',null);}else{_0x797e45=_[_0xeca6('0x6b')](_0x4d06e3,[_0xeca6('0x2f'),_0xeca6('0x3e')]);_0x5a564e[_0xeca6('0x53')]='UserId';_0x2a7fe0=as['buildExpression'](_0x214665,_0x797e45[_0xeca6('0x44')],_0x5a564e);_0x5ea881[_0x31946d](_0x2a7fe0['text'],_0x2a7fe0[_0xeca6('0x6d')][_0xeca6('0x77')],_0x2a7fe0['value'][_0xeca6('0x20')]);}break;case _0xeca6('0x7d'):_0x2a7fe0=as[_0xeca6('0x75')]('me',null,_0x5a564e);_0x5ea881[_0x31946d](_0x2a7fe0[_0xeca6('0x76')],_0x2a7fe0[_0xeca6('0x6d')][_0xeca6('0x77')],_0x2a7fe0[_0xeca6('0x6d')]['end']);break;}}else{var _0x2a7fe0=as[_0xeca6('0x75')](_0x214665,_0x797e45[_0xeca6('0x44')],_0x5a564e);_0x5ea881[_0x31946d](_0x2a7fe0[_0xeca6('0x76')],_0x2a7fe0[_0xeca6('0x6d')][_0xeca6('0x77')],_0x2a7fe0['value']['end']);}}}else{var _0x1c1a42=_(_0x1f9db7[_0xeca6('0x46')])['keys']()['map'](function(_0x5a9101){return _['some'](_0x4d06e3,[_0xeca6('0x2f'),_0x5a9101])?_0x5a9101:undefined;})[_0xeca6('0x7e')]()[_0xeca6('0x6d')]();if(!_[_0xeca6('0x7f')](_0x1c1a42)){_0x1c1a42[_0xeca6('0x36')](function(_0x5eb746){if(_0x5eb746===_0xeca6('0x80')){_0xd732c[_0xeca6('0x4f')](_0xeca6('0x81'),[]['concat'](_0x1f9db7[_0xeca6('0x46')][_0x5eb746]));}else if(_0x5eb746==='createdAt'){var _0x5f25ee=JSON['parse'](_0x1f9db7[_0xeca6('0x46')][_0x5eb746])['$gte'];var _0x3b6a40=JSON[_0xeca6('0x82')](_0x1f9db7[_0xeca6('0x46')][_0x5eb746])[_0xeca6('0x83')];_0xd732c[_0xeca6('0x4f')](_0xeca6('0x84'),_0x5f25ee,_0x3b6a40);}else{if(_0x1f9db7[_0xeca6('0x46')][_0x5eb746]===_0xeca6('0x85')){_0xd732c[_0xeca6('0x4f')]('i.'+_0x5eb746+_0xeca6('0x86'));}else{_0xd732c[_0xeca6('0x4f')]('i.'+_0x5eb746+_0xeca6('0x87'),_0x1f9db7['query'][_0x5eb746]);}}});}if(_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x88')]){if(_0x1f9db7['query'][_0xeca6('0x88')]==0x1){_0xd732c[_0xeca6('0x6f')](_0xeca6('0x89'));}else{_0xd732c[_0xeca6('0x6f')]('`unreadMessages`\x20>\x200');}}if(_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x8a')]){_0x593bf7=_[_0xeca6('0x8b')](_0x1f9db7['query'][_0xeca6('0x8a')])?_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x8a')]:new Array(_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x8a')]);_0x593bf7[_0xeca6('0x36')](function(_0x4d0345){_0x2ad05b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4d0345+',%');});}if(_0x1f9db7['query']['filter']){var _0x212f71=_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x8c')][_0xeca6('0x8d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xeca6('0x8e')](_0x212f71)){_0x5ea881['or'](_0xeca6('0x8f'),_0x212f71+'%')['or'](_0xeca6('0x90'),_0x212f71+'%');}else{_0x5ea881['or'](_0xeca6('0x91'),qs['getFullTextValue'](_0x212f71))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x212f71+'%');}}}_0xd732c[_0xeca6('0x4f')](_0x5ea881);_0xd732c['group']('i.id');var _0x3d9fa5={'type':db[_0xeca6('0x92')][_0xeca6('0x93')][_0xeca6('0x94')],'raw':!![]};var _0x275537=_0xd732c[_0xeca6('0x95')]();_0x275537[_0xeca6('0x53')](_0xeca6('0x96'));_0x275537[_0xeca6('0x53')](_0xeca6('0x97'),'unreadMessages');if(_0x470f67['order']){_0x470f67[_0xeca6('0x4d')][_0xeca6('0x36')](function(_0xfae120){var _0x447397=_0xfae120[0x0]==='contactName'?_0xfae120[0x0]:'i.'+_0xfae120[0x0];_0xd732c[_0xeca6('0x4d')](_0x447397,_0xfae120[0x1]===_0xeca6('0x98')?![]:!![]);});}if(!_[_0xeca6('0x7f')](_0x593bf7)){_0xd732c[_0xeca6('0x6f')](_0x2ad05b);_0x275537[_0xeca6('0x4f')](_0xeca6('0x99'),_0x593bf7);}BPromise['resolve']()[_0xeca6('0x2d')](function(){if(!_0x1e63bb){if(_0x1f9db7['query'][_0xeca6('0x80')])return;_0x275537[_0xeca6('0x4f')](_0xeca6('0x9a'));_0xd732c[_0xeca6('0x4f')](_0xeca6('0x9a'));return;}if(_0x1f9db7[_0xeca6('0x9b')]['role']!=='agent')return;return _0x1f9db7[_0xeca6('0x9b')][_0xeca6('0x9c')]({'attributes':['id'],'raw':!![]})[_0xeca6('0x2d')](function(_0x490242){if(_[_0xeca6('0x7f')](_0x490242)){_0x275537[_0xeca6('0x4f')](_0xeca6('0x9d'));_0xd732c['where'](_0xeca6('0x9d'));}else{_0x275537[_0xeca6('0x4f')](_0xeca6('0x81'),_[_0xeca6('0x31')](_0x490242,'id'));_0xd732c[_0xeca6('0x4f')]('i.WhatsappAccountId\x20IN\x20?',_[_0xeca6('0x31')](_0x490242,'id'));}});})[_0xeca6('0x2d')](function(){if(_0x1f9db7['user'][_0xeca6('0x9e')]===_0xeca6('0x9f')&&!_0x1e63bb&&!_0x1f9db7['query']['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x275537[_0xeca6('0xa0')](),_0x3d9fa5);})['then'](function(_0x426829){_0x23d8e5[_0xeca6('0x25')]=_0x426829['length'];if(_0x23d8e5[_0xeca6('0x25')]===0x0)return[];return db['sequelize'][_0xeca6('0x46')](_0x4278c0['toString'](),_0x3d9fa5)[_0xeca6('0x2d')](function(_0x5b1166){_0x25746a=_[_0xeca6('0xa1')](_0x5b1166,'id');_0x3d9fa5=_['merge'](_0x3d9fa5,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f9db7[_0xeca6('0x46')][_0xeca6('0x48')]){_0x470f67['attributes'][_0xeca6('0x36')](function(_0x32a637){_0xd732c[_0xeca6('0x53')]('i.'+_0x32a637);});}else{_0xd732c[_0xeca6('0x53')](_0xeca6('0x97'),'unreadMessages');_0xd732c[_0xeca6('0x53')]('a.key',_0xeca6('0xa2'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xa3'),_0xeca6('0xa4'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xa5'),_0xeca6('0xa6'));_0xd732c[_0xeca6('0x53')]('i.*');_0xd732c['field'](_0xeca6('0xa7'),_0xeca6('0xa8'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xa9'),_0xeca6('0xaa'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xab'),_0xeca6('0xac'));_0xd732c['field'](_0xeca6('0xad'),'Contact.phone');_0xd732c[_0xeca6('0x53')](_0xeca6('0xae'),_0xeca6('0xaf'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xb0'),_0xeca6('0xb1'));_0xd732c[_0xeca6('0x53')]('o.fullname',_0xeca6('0xb2'));_0xd732c[_0xeca6('0x53')]('o.internal',_0xeca6('0xb3'));_0xd732c[_0xeca6('0x53')](_0xeca6('0xb4'),_0xeca6('0x33'));}if(_0x470f67[_0xeca6('0x22')])_0xd732c['limit'](_0x470f67[_0xeca6('0x22')]);if(_0x470f67['offset'])_0xd732c[_0xeca6('0x24')](_0x470f67['offset']);return db[_0xeca6('0xb5')][_0xeca6('0x46')](_0xd732c[_0xeca6('0xa0')](),_0x3d9fa5);})[_0xeca6('0x2d')](function(_0x2b1b75){if(_0x2b1b75[_0xeca6('0x4a')]>0x0)_0x449c15[_0xeca6('0x4f')](_0xeca6('0xb6'),_[_0xeca6('0x31')](_0x2b1b75,'id'));return db['sequelize']['query'](_0x449c15[_0xeca6('0xa0')](),_0x3d9fa5)['then'](function(_0x3d8a2b){var _0x255a06=_['groupBy'](_0x3d8a2b,_0xeca6('0xb7'));var _0x5d2734=[];_0x2b1b75[_0xeca6('0x36')](function(_0x13a8aa){_0x5d2734[_0xeca6('0x37')](updateWhatsappInteraction(_0x13a8aa,_0x25746a,_0x255a06));});return BPromise['all'](_0x5d2734);});});})[_0xeca6('0x2d')](function(_0x2937dc){_0x23d8e5[_0xeca6('0xb8')]=_0x2937dc;return _0x23d8e5;})[_0xeca6('0x2d')](respondWithFilteredResult(_0x4f77b9,_0x470f67))[_0xeca6('0x38')](handleError(_0x4f77b9,null));};exports['show']=function(_0x53092b,_0x34e594){var _0x4a7ff5={'raw':![],'where':{'id':_0x53092b[_0xeca6('0xb9')]['id']}},_0x23c101={};_0x23c101['model']=_[_0xeca6('0xba')](db[_0xeca6('0x41')][_0xeca6('0x42')]);_0x23c101[_0xeca6('0x46')]=_[_0xeca6('0xba')](_0x53092b['query']);_0x23c101[_0xeca6('0x50')]=_[_0xeca6('0x47')](_0x23c101['model'],_0x23c101[_0xeca6('0x46')]);_0x4a7ff5['attributes']=_[_0xeca6('0x47')](_0x23c101[_0xeca6('0x45')],qs['fields'](_0x53092b[_0xeca6('0x46')]['fields']));_0x4a7ff5[_0xeca6('0x49')]=_0x4a7ff5[_0xeca6('0x49')][_0xeca6('0x4a')]?_0x4a7ff5[_0xeca6('0x49')]:_0x23c101['model'];if(_0x53092b[_0xeca6('0x46')][_0xeca6('0xbb')]){_0x4a7ff5[_0xeca6('0xbc')]=[{'all':!![]}];}_0x4a7ff5=_['merge']({},_0x4a7ff5,_0x53092b[_0xeca6('0xbd')]);return db[_0xeca6('0x41')][_0xeca6('0x6b')](_0x4a7ff5)[_0xeca6('0x2d')](handleEntityNotFound(_0x34e594,null))['then'](respondWithResult(_0x34e594,null))['catch'](handleError(_0x34e594,null));};exports[_0xeca6('0xbe')]=function(_0x34eb3a,_0x1fe111){return db['WhatsappInteraction'][_0xeca6('0xbe')](_0x34eb3a['body'],{})[_0xeca6('0x2d')](respondWithResult(_0x1fe111,0xc9))[_0xeca6('0x38')](handleError(_0x1fe111,null));};exports['update']=function(_0x579bd8,_0x29f954){if(_0x579bd8[_0xeca6('0x7d')]['id']){delete _0x579bd8[_0xeca6('0x7d')]['id'];}return db[_0xeca6('0x41')][_0xeca6('0x6b')]({'where':{'id':_0x579bd8[_0xeca6('0xb9')]['id']}})[_0xeca6('0x2d')](handleEntityNotFound(_0x29f954,null))[_0xeca6('0x2d')](saveUpdates(_0x579bd8[_0xeca6('0x7d')],null))[_0xeca6('0x2d')](respondWithResult(_0x29f954,null))[_0xeca6('0x38')](handleError(_0x29f954,null));};exports[_0xeca6('0x2c')]=function(_0x5be4b8,_0x3c8439){return db[_0xeca6('0x41')]['find']({'where':{'id':_0x5be4b8['params']['id']}})[_0xeca6('0x2d')](handleEntityNotFound(_0x3c8439,null))[_0xeca6('0x2d')](removeEntity(_0x3c8439,null))[_0xeca6('0x38')](handleError(_0x3c8439,null));};exports[_0xeca6('0xbf')]=function(_0x377ee5,_0x5b124b){return db['WhatsappInteraction'][_0xeca6('0xbf')]()['then'](respondWithResult(_0x5b124b,null))['catch'](handleError(_0x5b124b,null));};exports[_0xeca6('0xc0')]=function(_0x4f5ac8,_0x4df72b,_0x369c47){return db['WhatsappMessage'][_0xeca6('0x6b')]({'where':{'id':_0x4f5ac8[_0xeca6('0xb9')]['id']}})[_0xeca6('0x2d')](handleEntityNotFound(_0x4df72b,null))[_0xeca6('0x2d')](function(_0x2fb226){if(_0x2fb226){return _0x2fb226[_0xeca6('0xc0')](_0x4f5ac8['body'][_0xeca6('0xc1')],_[_0xeca6('0xc2')](_0x4f5ac8[_0xeca6('0x7d')],[_0xeca6('0xc1'),'id'])||{});}})[_0xeca6('0x2d')](respondWithResult(_0x4df72b,null))[_0xeca6('0x38')](handleError(_0x4df72b,null));};exports[_0xeca6('0xc3')]=function(_0x22ac40,_0xb7a6cb,_0x544fb9){var _0xed134c={'raw':![],'where':{}};var _0x290ffa={};var _0x38d12b={'count':0x0,'rows':[]};return db[_0xeca6('0x41')][_0xeca6('0xc4')]({'where':{'id':_0x22ac40[_0xeca6('0xb9')]['id']}})['then'](handleEntityNotFound(_0xb7a6cb,null))['then'](function(_0x1ddc15){if(_0x1ddc15){_0x290ffa[_0xeca6('0x45')]=_[_0xeca6('0xba')](db[_0xeca6('0xc5')]['rawAttributes']);_0x290ffa['query']=_['keys'](_0x22ac40[_0xeca6('0x46')]);_0x290ffa[_0xeca6('0x50')]=_[_0xeca6('0x47')](_0x290ffa['model'],_0x290ffa['query']);_0xed134c['attributes']=_[_0xeca6('0x47')](_0x290ffa[_0xeca6('0x45')],qs[_0xeca6('0x48')](_0x22ac40[_0xeca6('0x46')][_0xeca6('0x48')]));_0xed134c['attributes']=_0xed134c[_0xeca6('0x49')][_0xeca6('0x4a')]?_0xed134c['attributes']:_0x290ffa['model'];if(!_0x22ac40[_0xeca6('0x46')][_0xeca6('0x4b')]('nolimit')){_0xed134c['limit']=qs[_0xeca6('0x22')](_0x22ac40[_0xeca6('0x46')]['limit']);_0xed134c[_0xeca6('0x24')]=qs[_0xeca6('0x24')](_0x22ac40['query'][_0xeca6('0x24')]);}_0xed134c['order']=qs[_0xeca6('0x4e')](_0x22ac40[_0xeca6('0x46')][_0xeca6('0x4e')]);_0xed134c[_0xeca6('0x4f')]=qs[_0xeca6('0x50')](_[_0xeca6('0x51')](_0x22ac40['query'],_0x290ffa['filters']));_0xed134c['where'][_0xeca6('0xb7')]=_0x1ddc15['id'];if(_0x22ac40[_0xeca6('0x46')][_0xeca6('0x8c')]){_0xed134c[_0xeca6('0x4f')]=_['merge'](_0xed134c[_0xeca6('0x4f')],{'$or':_['map'](_0xed134c[_0xeca6('0x49')],function(_0x174211){var _0x32b96c={};_0x32b96c[_0x174211]={'$like':'%'+_0x22ac40['query'][_0xeca6('0x8c')]+'%'};return _0x32b96c;})});}if(_0x22ac40[_0xeca6('0x46')][_0xeca6('0xc6')]){var _0x545340=_0x22ac40[_0xeca6('0x46')][_0xeca6('0xc6')][_0xeca6('0x35')](',');var _0x22a7f1={};_0x22a7f1[_0x545340[0x0]]={'$gte':moment(_0x545340[0x1])[_0xeca6('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0xed134c[_0xeca6('0x4f')]=_[_0xeca6('0xc8')](_0xed134c[_0xeca6('0x4f')],_0x22a7f1);}_0xed134c=_[_0xeca6('0xc8')]({},_0xed134c,_0x22ac40[_0xeca6('0xbd')]);return db[_0xeca6('0xc5')][_0xeca6('0x25')]({'where':_0xed134c[_0xeca6('0x4f')]})[_0xeca6('0x2d')](function(_0x1165e0){_0x38d12b[_0xeca6('0x25')]=_0x1165e0;if(_0x22ac40[_0xeca6('0x46')][_0xeca6('0xbb')]){_0xed134c[_0xeca6('0xbc')]=[{'all':!![]}];}return db[_0xeca6('0xc5')][_0xeca6('0xc9')](_0xed134c);})['then'](function(_0x3ab1b5){_0x38d12b['rows']=_0x3ab1b5;return _0x38d12b;});}})[_0xeca6('0x2d')](respondWithFilteredResult(_0xb7a6cb,_0xed134c))[_0xeca6('0x38')](handleError(_0xb7a6cb,null));};exports[_0xeca6('0xca')]=function(_0x328145,_0x5be282,_0x2c5c35){return db[_0xeca6('0x41')]['find']({'where':{'id':_0x328145[_0xeca6('0xb9')]['id']}})[_0xeca6('0x2d')](handleEntityNotFound(_0x5be282,null))[_0xeca6('0x2d')](function(_0x12e7b4){if(_0x12e7b4){return _0x12e7b4[_0xeca6('0xcb')](_0x328145[_0xeca6('0x7d')][_0xeca6('0xc1')],_[_0xeca6('0xc2')](_0x328145[_0xeca6('0x7d')],[_0xeca6('0xc1'),'id'])||{})[_0xeca6('0xcc')](function(){return db[_0xeca6('0x78')]['findAll']({'attributes':['id',_0xeca6('0x2f'),'color'],'where':{'id':_0x328145[_0xeca6('0x7d')][_0xeca6('0xc1')]}});})['then'](function(_0x517c03){socket[_0xeca6('0xcd')](_0xeca6('0xce'),{'id':Number(_0x328145[_0xeca6('0xb9')]['id']),'tags':_0x517c03||[]});return{'id':Number(_0x328145[_0xeca6('0xb9')]['id']),'tags':_0x517c03||[]};});}})['then'](respondWithResult(_0x5be282,null))[_0xeca6('0x38')](handleError(_0x5be282,null));};exports['removeTags']=function(_0x324c4b,_0x54ca54,_0x21308b){return db[_0xeca6('0x41')][_0xeca6('0x6b')]({'where':{'id':_0x324c4b[_0xeca6('0xb9')]['id']}})['then'](handleEntityNotFound(_0x54ca54,null))[_0xeca6('0x2d')](function(_0x54b605){if(_0x54b605){return _0x54b605[_0xeca6('0xcf')](_0x324c4b[_0xeca6('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x54ca54,null))['catch'](handleError(_0x54ca54,null));};exports[_0xeca6('0xd0')]=function(_0x54eccf,_0x450a65){var _0x142cf0=moment()[_0xeca6('0xd1')]()[_0xeca6('0xa0')]();var _0x18187b=path['join'](config[_0xeca6('0xd2')],_0xeca6('0xd3'),_0xeca6('0xd4'),_0xeca6('0xd5'));var _0x4894d4=path['join'](config[_0xeca6('0xd2')],_0xeca6('0xd3'),_0xeca6('0xd4'),_0xeca6('0xd6'));var _0x1984d4=path[_0xeca6('0xd7')](_0x18187b,_0x142cf0);var _0xc6555e=util[_0xeca6('0xc7')](_0xeca6('0xd8'),_0x54eccf[_0xeca6('0xb9')]['id'],_0x142cf0);var _0x196ce6=path[_0xeca6('0xd7')](_0x18187b,_0xc6555e);var _0x49901c=[];_0x49901c[_0xeca6('0x37')]({'model':db[_0xeca6('0x7a')],'as':_0xeca6('0x7a'),'attributes':['id',_0xeca6('0x32')],'raw':!![]});_0x49901c[_0xeca6('0x37')]({'model':db[_0xeca6('0xd9')],'as':_0xeca6('0x70'),'attributes':['id','firstName',_0xeca6('0xda')],'raw':!![]});if(_0x54eccf[_0xeca6('0x46')]['attachments']){_0x49901c[_0xeca6('0x37')]({'model':db[_0xeca6('0xdb')],'as':'Attachment','raw':!![]});}var _0x5f5675=[{'model':db[_0xeca6('0xc5')],'as':_0xeca6('0xdc'),'attributes':['id','body','createdAt',_0xeca6('0xdd'),'secret','read'],'include':_0x49901c}];_0x5f5675[_0xeca6('0x37')]({'model':db[_0xeca6('0xde')],'as':_0xeca6('0xdf'),'attributes':['id','name']});_0x5f5675['push']({'model':db['User'],'as':_0xeca6('0xe0'),'attributes':['id',_0xeca6('0x32')]});return db[_0xeca6('0x41')][_0xeca6('0x6b')]({'where':{'id':_0x54eccf[_0xeca6('0xb9')]['id']},'include':_0x5f5675})['then'](handleEntityNotFound(_0x450a65,null))['then'](function(_0x13266a){if(_0x13266a){var _0x2c4920=_0x13266a['get']({'plain':!![]});fs[_0xeca6('0xe1')](_0x1984d4);var _0x1ed907={'channel':_0xeca6('0xe2'),'account':_0x2c4920[_0xeca6('0xdf')]['name'],'agent':_0x2c4920[_0xeca6('0xe0')]?_0x2c4920[_0xeca6('0xe0')][_0xeca6('0x32')]:'N.A.','createdAt':moment(_0x2c4920['createdAt'])[_0xeca6('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xeca6('0xa0')](),'closedAt':_0x2c4920[_0xeca6('0x3d')]?moment(_0x2c4920['closedAt'])[_0xeca6('0xc7')](_0xeca6('0xe3'))[_0xeca6('0xa0')]():'','disposition':_0x2c4920['disposition'],'messages':_(_0x2c4920[_0xeca6('0xdc')])[_0xeca6('0x8c')]({'secret':![]})[_0xeca6('0x31')](function(_0x5b5cd5){if(_0x5b5cd5[_0xeca6('0xdb')]){var _0xe3793c=path[_0xeca6('0xd7')](_0x4894d4,_0x5b5cd5[_0xeca6('0xdb')][_0xeca6('0xe4')]);if(fs['existsSync'](_0xe3793c)){fs['createReadStream'](_0xe3793c)[_0xeca6('0xe5')](fs['createWriteStream'](path['join'](_0x1984d4,_0x5b5cd5[_0xeca6('0xdb')][_0xeca6('0xe4')])));}}return{'date':moment(_0x5b5cd5['createdAt'])[_0xeca6('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xeca6('0xa0')](),'sender':_0x5b5cd5['direction']===_0xeca6('0xe6')?_0x5b5cd5[_0xeca6('0x7a')]?_0x5b5cd5[_0xeca6('0x7a')][_0xeca6('0x32')]:_0xeca6('0xe7'):_0x5b5cd5[_0xeca6('0x70')]['firstName']+(_0x5b5cd5[_0xeca6('0x70')][_0xeca6('0xda')]?'\x20'+_0x5b5cd5[_0xeca6('0x70')]['lastName']:''),'body':_0x5b5cd5[_0xeca6('0xdb')]?_0x5b5cd5[_0xeca6('0xdb')][_0xeca6('0xe4')]:_0x5b5cd5[_0xeca6('0x7d')],'direction':_0x5b5cd5['direction']===_0xeca6('0xe6')?'A':'C','secret':_0x5b5cd5[_0xeca6('0xe8')],'read':_0x5b5cd5['read'],'attachment':_0x5b5cd5[_0xeca6('0xdb')]};})[_0xeca6('0x6d')]()};return ejs[_0xeca6('0xe9')](path[_0xeca6('0xd7')](config[_0xeca6('0xd2')],_0xeca6('0xd3'),_0xeca6('0xea'),'downloadInteraction.ejs'),{'interaction':_0x1ed907})[_0xeca6('0x2d')](function(_0x1247f6){var _0x2d90e8=path[_0xeca6('0xd7')](_0x1984d4,_0xeca6('0xeb')+_0x2c4920['id']+'-'+_0x142cf0+_0xeca6('0xec'));var _0xbe4e2d={'path':_0x2d90e8,'channel':_0xeca6('0xe2'),'interactionId':_0x2c4920['id']};return pdf[_0xeca6('0xed')](_0x1247f6,_0xbe4e2d);})['then'](function(){return new BPromise(function(_0x46596d,_0x56ac34){zipdir(_0x1984d4,{'saveTo':_0x196ce6},function(_0x59e920,_0x2598bb){if(_0x59e920)return _0x56ac34(_0x59e920);return _0x46596d(_0x2598bb);});})['then'](function(){return new BPromise(function(_0x40a787,_0x497460){rimraf(_0x1984d4,function(_0x4b12d5){if(_0x4b12d5)_0x497460(_0x4b12d5);return _0x40a787();});});})['then'](function(){return _0x450a65[_0xeca6('0xd0')](_0x196ce6,_0xc6555e,function(_0x6f0629){if(_0x6f0629){console[_0xeca6('0xee')](_0xeca6('0xef'),_0x6f0629);}else{fs[_0xeca6('0xf0')](_0x196ce6);}});});});}else{return _0x450a65[_0xeca6('0x1e')](0xc8);}})[_0xeca6('0x38')](handleError(_0x450a65,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 8ecae4b..628b0fd 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 _0x76dc=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','then','unreadMessages'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x76dc,0x1f2));var _0xc76d=function(_0x297b70,_0x537464){_0x297b70=_0x297b70-0x0;var _0x13353d=_0x76dc[_0x297b70];return _0x13353d;};'use strict';var EventEmitter=require(_0xc76d('0x0'));var WhatsappInteraction=require(_0xc76d('0x1'))['db'][_0xc76d('0x2')];var WhatsappMessage=require(_0xc76d('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc76d('0x3')](0x0);var events={'afterCreate':_0xc76d('0x4'),'afterUpdate':'update','afterDestroy':_0xc76d('0x5')};function emitEvent(_0x50ed3a){return function(_0x507ea7,_0x1ae435,_0x29ab70){_0x507ea7[_0xc76d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ce0bd){_0x507ea7[_0xc76d('0x7')](_0xc76d('0x8'),_0x4ce0bd[_0xc76d('0x9')](function(_0x532d6a){return{'id':_0x532d6a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x507ea7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc76d('0xa')](function(_0x2f81bd){_0x507ea7['setDataValue'](_0xc76d('0xb'),_0x2f81bd['length']);WhatsappInteractionEvents[_0xc76d('0xc')](_0x50ed3a+':'+_0x507ea7['id'],_0x507ea7);WhatsappInteractionEvents[_0xc76d('0xc')](_0x50ed3a,_0x507ea7);_0x29ab70(null);})[_0xc76d('0xd')](_0x29ab70(null));};}for(var e in events){if(events[_0xc76d('0xe')](e)){var event=events[e];WhatsappInteraction[_0xc76d('0xf')](e,emitEvent(event));}}module[_0xc76d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x668b=['save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x596dc5,_0x55c65b){var _0x150afd=function(_0x1c517f){while(--_0x1c517f){_0x596dc5['push'](_0x596dc5['shift']());}};_0x150afd(++_0x55c65b);}(_0x668b,0x140));var _0xb668=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x668b[_0x602ca8];return _0x26e8ab;};'use strict';var EventEmitter=require(_0xb668('0x0'));var WhatsappInteraction=require(_0xb668('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb668('0x1'))['db'][_0xb668('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x4092a6){return function(_0x2960f5,_0x48cf74,_0x9b99a8){_0x2960f5[_0xb668('0x5')]({'attributes':['id'],'raw':!![]})[_0xb668('0x6')](function(_0x2778e9){_0x2960f5[_0xb668('0x7')](_0xb668('0x8'),_0x2778e9['map'](function(_0x11bb5e){return{'id':_0x11bb5e['id']};}));return WhatsappMessage[_0xb668('0x9')]({'where':{'WhatsappInteractionId':_0x2960f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb668('0x6')](function(_0x16d50d){_0x2960f5[_0xb668('0x7')](_0xb668('0xa'),_0x16d50d[_0xb668('0xb')]);WhatsappInteractionEvents[_0xb668('0xc')](_0x4092a6+':'+_0x2960f5['id'],_0x2960f5);WhatsappInteractionEvents['emit'](_0x4092a6,_0x2960f5);_0x9b99a8(null);})[_0xb668('0xd')](_0x9b99a8(null));};}for(var e in events){if(events[_0xb668('0xe')](e)){var event=events[e];WhatsappInteraction[_0xb668('0xf')](e,emitEvent(event));}}module[_0xb668('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 10d7ade..18d47c7 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 _0xa76a=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x2e71d3,_0x559739){var _0x34683c=function(_0x2ef3f5){while(--_0x2ef3f5){_0x2e71d3['push'](_0x2e71d3['shift']());}};_0x34683c(++_0x559739);}(_0xa76a,0xad));var _0xaa76=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa76a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xaa76('0x0'));var logger=require(_0xaa76('0x1'))(_0xaa76('0x2'));var moment=require('moment');var BPromise=require(_0xaa76('0x3'));var rp=require(_0xaa76('0x4'));var fs=require('fs');var path=require(_0xaa76('0x5'));var rimraf=require(_0xaa76('0x6'));var config=require(_0xaa76('0x7'));var attributes=require(_0xaa76('0x8'));module[_0xaa76('0x9')]=function(_0x206953,_0x3d68ec){return _0x206953[_0xaa76('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xaa76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a8c79,_0x3717ba,_0x22de67){if(_0x3a8c79[_0xaa76('0xc')]('closed')){_0x3a8c79[_0xaa76('0xd')]=moment()[_0xaa76('0xe')](_0xaa76('0xf'));}_0x22de67(null,_0x3a8c79);}}});}; \ No newline at end of file +var _0x4293=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','rimraf','../../config/environment','exports','define','whatsapp_interactions'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0x4293,0x163));var _0x3429=function(_0x8241c1,_0x1713ef){_0x8241c1=_0x8241c1-0x0;var _0x54afa1=_0x4293[_0x8241c1];return _0x54afa1;};'use strict';var _=require(_0x3429('0x0'));var util=require(_0x3429('0x1'));var logger=require('../../config/logger')(_0x3429('0x2'));var moment=require('moment');var BPromise=require(_0x3429('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3429('0x4'));var config=require(_0x3429('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0x3429('0x6')]=function(_0x439e14,_0x432c4f){return _0x439e14[_0x3429('0x7')]('WhatsappInteraction',attributes,{'tableName':_0x3429('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9f51de,_0x10ad90,_0x15c45a){if(_0x9f51de[_0x3429('0x9')](_0x3429('0xa'))){_0x9f51de[_0x3429('0xb')]=moment()['format'](_0x3429('0xc'));}_0x15c45a(null,_0x9f51de);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 73fd09f..be015a2 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 _0x829d=['omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids'];(function(_0x2dc4dc,_0x46e6cc){var _0x43b699=function(_0x4fbf6f){while(--_0x4fbf6f){_0x2dc4dc['push'](_0x2dc4dc['shift']());}};_0x43b699(++_0x46e6cc);}(_0x829d,0x18f));var _0xd829=function(_0x28314a,_0x409c37){_0x28314a=_0x28314a-0x0;var _0x129f5b=_0x829d[_0x28314a];return _0x129f5b;};'use strict';var _=require(_0xd829('0x0'));var util=require('util');var moment=require(_0xd829('0x1'));var BPromise=require('bluebird');var rs=require(_0xd829('0x2'));var fs=require('fs');var Redis=require(_0xd829('0x3'));var db=require(_0xd829('0x4'))['db'];var utils=require(_0xd829('0x5'));var logger=require(_0xd829('0x6'))(_0xd829('0x7'));var config=require(_0xd829('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd829('0x9')]({'port':0x232a});config[_0xd829('0xa')]=_[_0xd829('0xb')](config[_0xd829('0xa')],{'host':_0xd829('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd829('0xa')]));require(_0xd829('0xd'))[_0xd829('0xe')](socket);function respondWithRpcPromise(_0x379450,_0x61c14e,_0x1a33b3){return new BPromise(function(_0x9a24eb,_0x5ebfa3){return client[_0xd829('0xf')](_0x379450,_0x1a33b3)[_0xd829('0x10')](function(_0x4e6a8a){logger[_0xd829('0x11')](_0xd829('0x12'),_0x61c14e,_0xd829('0x13'));logger[_0xd829('0x14')](_0xd829('0x15'),_0x61c14e,_0xd829('0x13'),JSON[_0xd829('0x16')](_0x4e6a8a));if(_0x4e6a8a[_0xd829('0x17')]){if(_0x4e6a8a['error'][_0xd829('0x18')]===0x1f4){logger[_0xd829('0x17')](_0xd829('0x12'),_0x61c14e,_0x4e6a8a[_0xd829('0x17')][_0xd829('0x19')]);return _0x5ebfa3(_0x4e6a8a[_0xd829('0x17')][_0xd829('0x19')]);}logger[_0xd829('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x61c14e,_0x4e6a8a[_0xd829('0x17')][_0xd829('0x19')]);return _0x9a24eb(_0x4e6a8a[_0xd829('0x17')][_0xd829('0x19')]);}else{logger['info'](_0xd829('0x12'),_0x61c14e,'request\x20sent');_0x9a24eb(_0x4e6a8a[_0xd829('0x1a')][_0xd829('0x19')]);}})[_0xd829('0x1b')](function(_0xfa8377){logger[_0xd829('0x17')](_0xd829('0x12'),_0x61c14e,_0xfa8377);_0x5ebfa3(_0xfa8377);});});}exports['UpdateWhatsappInteraction']=function(_0x9b8e41){var _0x5479aa=this;return new Promise(function(_0x14cfdb,_0x51826c){return db[_0xd829('0x1c')][_0xd829('0x1d')](_0x9b8e41[_0xd829('0x1e')],{'raw':_0x9b8e41['options']?_0x9b8e41[_0xd829('0x1f')][_0xd829('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9b8e41[_0xd829('0x1f')]?_0x9b8e41[_0xd829('0x1f')][_0xd829('0x21')]||null:null,'attributes':_0x9b8e41[_0xd829('0x1f')]?_0x9b8e41['options'][_0xd829('0x22')]||null:null,'limit':_0x9b8e41[_0xd829('0x1f')]?_0x9b8e41[_0xd829('0x1f')][_0xd829('0x23')]||null:null})[_0xd829('0x10')](function(_0x506a5f){logger[_0xd829('0x11')]('UpdateWhatsappInteraction',_0x9b8e41);logger[_0xd829('0x14')](_0xd829('0x24'),_0x9b8e41,JSON[_0xd829('0x16')](_0x506a5f));_0x14cfdb(_0x506a5f);})[_0xd829('0x1b')](function(_0x3a6bce){logger['error'](_0xd829('0x24'),_0x3a6bce[_0xd829('0x19')],_0x9b8e41);_0x51826c(_0x5479aa[_0xd829('0x17')](0x1f4,_0x3a6bce[_0xd829('0x19')]));});});};exports[_0xd829('0x25')]=function(_0x4d162d){return new Promise(function(_0x3f2b1d,_0x5e8415){return db['WhatsappInteraction'][_0xd829('0x26')]({'where':_0x4d162d['options']?_0x4d162d['options']['where']||null:null})['then'](function(_0x1ddf7c){if(_0x1ddf7c){return _0x1ddf7c[_0xd829('0x27')](_0x4d162d['body'][_0xd829('0x28')],_[_0xd829('0x29')](_0x4d162d[_0xd829('0x1e')],[_0xd829('0x28'),'id'])||{});}})[_0xd829('0x2a')](function(_0x12c181){logger[_0xd829('0x11')]('AddTags',_0x4d162d);logger[_0xd829('0x14')](_0xd829('0x2b'),_0x4d162d,JSON[_0xd829('0x16')](_0x12c181));_0x3f2b1d(_0x12c181);})[_0xd829('0x1b')](function(_0x2e660f){logger['error']('AddTags',_0x2e660f[_0xd829('0x19')],_0x4d162d);_0x5e8415(_this[_0xd829('0x17')](0x1f4,_0x2e660f['message']));});});}; \ No newline at end of file +var _0xf064=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','find','addTags'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf064,0xb0));var _0x4f06=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xf064[_0x5de1bc];return _0x19f4b8;};'use strict';var _=require(_0x4f06('0x0'));var util=require(_0x4f06('0x1'));var moment=require(_0x4f06('0x2'));var BPromise=require(_0x4f06('0x3'));var rs=require(_0x4f06('0x4'));var fs=require('fs');var Redis=require(_0x4f06('0x5'));var db=require(_0x4f06('0x6'))['db'];var utils=require(_0x4f06('0x7'));var logger=require(_0x4f06('0x8'))(_0x4f06('0x9'));var config=require(_0x4f06('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4f06('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4f06('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f06('0xd'))(new Redis(config[_0x4f06('0xc')]));require(_0x4f06('0xe'))[_0x4f06('0xf')](socket);function respondWithRpcPromise(_0x17a5f9,_0x4f2653,_0x264927){return new BPromise(function(_0x13e312,_0x17f535){return client['request'](_0x17a5f9,_0x264927)[_0x4f06('0x10')](function(_0x47209d){logger[_0x4f06('0x11')](_0x4f06('0x12'),_0x4f2653,_0x4f06('0x13'));logger['debug'](_0x4f06('0x14'),_0x4f2653,_0x4f06('0x13'),JSON[_0x4f06('0x15')](_0x47209d));if(_0x47209d[_0x4f06('0x16')]){if(_0x47209d['error'][_0x4f06('0x17')]===0x1f4){logger[_0x4f06('0x16')](_0x4f06('0x12'),_0x4f2653,_0x47209d['error'][_0x4f06('0x18')]);return _0x17f535(_0x47209d[_0x4f06('0x16')][_0x4f06('0x18')]);}logger[_0x4f06('0x16')](_0x4f06('0x12'),_0x4f2653,_0x47209d[_0x4f06('0x16')][_0x4f06('0x18')]);return _0x13e312(_0x47209d[_0x4f06('0x16')][_0x4f06('0x18')]);}else{logger[_0x4f06('0x11')](_0x4f06('0x12'),_0x4f2653,'request\x20sent');_0x13e312(_0x47209d[_0x4f06('0x19')][_0x4f06('0x18')]);}})[_0x4f06('0x1a')](function(_0xab0745){logger[_0x4f06('0x16')](_0x4f06('0x12'),_0x4f2653,_0xab0745);_0x17f535(_0xab0745);});});}exports[_0x4f06('0x1b')]=function(_0x41c8bd){var _0x4b3cef=this;return new Promise(function(_0x4c687b,_0x77fc47){return db[_0x4f06('0x1c')]['update'](_0x41c8bd[_0x4f06('0x1d')],{'raw':_0x41c8bd[_0x4f06('0x1e')]?_0x41c8bd[_0x4f06('0x1e')][_0x4f06('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41c8bd[_0x4f06('0x1e')]?_0x41c8bd['options'][_0x4f06('0x20')]||null:null,'attributes':_0x41c8bd['options']?_0x41c8bd[_0x4f06('0x1e')][_0x4f06('0x21')]||null:null,'limit':_0x41c8bd[_0x4f06('0x1e')]?_0x41c8bd[_0x4f06('0x1e')][_0x4f06('0x22')]||null:null})[_0x4f06('0x10')](function(_0xe2a239){logger[_0x4f06('0x11')]('UpdateWhatsappInteraction',_0x41c8bd);logger[_0x4f06('0x23')](_0x4f06('0x1b'),_0x41c8bd,JSON['stringify'](_0xe2a239));_0x4c687b(_0xe2a239);})[_0x4f06('0x1a')](function(_0x5439f8){logger['error'](_0x4f06('0x1b'),_0x5439f8[_0x4f06('0x18')],_0x41c8bd);_0x77fc47(_0x4b3cef[_0x4f06('0x16')](0x1f4,_0x5439f8[_0x4f06('0x18')]));});});};exports[_0x4f06('0x24')]=function(_0x1dc89b){return new Promise(function(_0x5d716e,_0x161a81){return db[_0x4f06('0x1c')][_0x4f06('0x25')]({'where':_0x1dc89b[_0x4f06('0x1e')]?_0x1dc89b[_0x4f06('0x1e')]['where']||null:null})[_0x4f06('0x10')](function(_0x3132d6){if(_0x3132d6){return _0x3132d6[_0x4f06('0x26')](_0x1dc89b[_0x4f06('0x1d')][_0x4f06('0x27')],_[_0x4f06('0x28')](_0x1dc89b[_0x4f06('0x1d')],[_0x4f06('0x27'),'id'])||{});}})[_0x4f06('0x29')](function(_0x597260){logger[_0x4f06('0x11')](_0x4f06('0x2a'),_0x1dc89b);logger[_0x4f06('0x23')](_0x4f06('0x2a'),_0x1dc89b,JSON[_0x4f06('0x15')](_0x597260));_0x5d716e(_0x597260);})[_0x4f06('0x1a')](function(_0x264b9c){logger['error']('AddTags',_0x264b9c[_0x4f06('0x18')],_0x1dc89b);_0x161a81(_this[_0x4f06('0x16')](0x1f4,_0x264b9c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4627c81..cdbc9ee 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 _0x5e32=['save','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x2922e9,_0x5288b2){var _0x1d0bfb=function(_0x20e028){while(--_0x20e028){_0x2922e9['push'](_0x2922e9['shift']());}};_0x1d0bfb(++_0x5288b2);}(_0x5e32,0x161));var _0x25e3=function(_0x5dc755,_0x3254d0){_0x5dc755=_0x5dc755-0x0;var _0x24ce81=_0x5e32[_0x5dc755];return _0x24ce81;};'use strict';var WhatsappInteractionEvents=require(_0x25e3('0x0'));var events=[_0x25e3('0x1'),'remove','update'];function createListener(_0x4816e2,_0x22fcd8){return function(_0x4c631e){_0x22fcd8['emit'](_0x4816e2,_0x4c631e);};}function removeListener(_0x5e061a,_0x1e6c6e){return function(){WhatsappInteractionEvents[_0x25e3('0x2')](_0x5e061a,_0x1e6c6e);};}exports[_0x25e3('0x3')]=function(_0x5c6179){for(var _0x12efcd=0x0,_0x2f8f13=events[_0x25e3('0x4')];_0x12efcd<_0x2f8f13;_0x12efcd++){var _0x33214e=events[_0x12efcd];var _0x456ff7=createListener(_0x25e3('0x5')+_0x33214e,_0x5c6179);WhatsappInteractionEvents['on'](_0x33214e,_0x456ff7);}}; \ No newline at end of file +var _0xe33d=['length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit','removeListener','register'];(function(_0x28c890,_0x2cf296){var _0xcca3a7=function(_0x46a198){while(--_0x46a198){_0x28c890['push'](_0x28c890['shift']());}};_0xcca3a7(++_0x2cf296);}(_0xe33d,0x15a));var _0xde33=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xe33d[_0x13b8f3];return _0x1a6d06;};'use strict';var WhatsappInteractionEvents=require(_0xde33('0x0'));var events=[_0xde33('0x1'),'remove',_0xde33('0x2')];function createListener(_0x208202,_0xe0a66c){return function(_0x156223){_0xe0a66c[_0xde33('0x3')](_0x208202,_0x156223);};}function removeListener(_0x3a8b26,_0x4e208a){return function(){WhatsappInteractionEvents[_0xde33('0x4')](_0x3a8b26,_0x4e208a);};}exports[_0xde33('0x5')]=function(_0x40bb34){for(var _0x60cb86=0x0,_0x45b0a8=events[_0xde33('0x6')];_0x60cb86<_0x45b0a8;_0x60cb86++){var _0xdd76fb=events[_0x60cb86];var _0x3c4569=createListener(_0xde33('0x7')+_0xdd76fb,_0x40bb34);WhatsappInteractionEvents['on'](_0xdd76fb,_0x3c4569);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1dab9b6..77efe58 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 _0x3123=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x30778f,_0x4dec22){var _0x19ea62=function(_0x56c988){while(--_0x56c988){_0x30778f['push'](_0x30778f['shift']());}};_0x19ea62(++_0x4dec22);}(_0x3123,0x146));var _0x3312=function(_0x1c2968,_0x58026d){_0x1c2968=_0x1c2968-0x0;var _0x4d78ce=_0x3123[_0x1c2968];return _0x4d78ce;};'use strict';var multer=require(_0x3312('0x0'));var util=require('util');var path=require(_0x3312('0x1'));var timeout=require(_0x3312('0x2'));var express=require(_0x3312('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3312('0x4'));var interaction=require(_0x3312('0x5'));var config=require(_0x3312('0x6'));var controller=require(_0x3312('0x7'));router[_0x3312('0x8')]('/',auth[_0x3312('0x9')](),controller[_0x3312('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3312('0xb')]);router[_0x3312('0x8')](_0x3312('0xc'),auth[_0x3312('0x9')](),controller[_0x3312('0xd')]);router[_0x3312('0xe')]('/',auth[_0x3312('0x9')](),interaction[_0x3312('0xf')]('whatsapp','whatsappmessage:create'),controller['create']);router['post'](_0x3312('0x10'),controller[_0x3312('0x11')]);router[_0x3312('0x12')](_0x3312('0xc'),auth[_0x3312('0x9')](),controller[_0x3312('0x13')]);router[_0x3312('0x12')](_0x3312('0x14'),auth[_0x3312('0x9')](),controller[_0x3312('0x15')]);router[_0x3312('0x12')](_0x3312('0x16'),auth[_0x3312('0x9')](),controller[_0x3312('0x17')]);router['delete'](_0x3312('0xc'),auth[_0x3312('0x9')](),controller[_0x3312('0x18')]);module['exports']=router; \ No newline at end of file +var _0x58f4=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','put','update','/:id/accept','/:id/reject','reject','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ea028,_0x5d02ac){var _0x528428=function(_0x33de6f){while(--_0x33de6f){_0x3ea028['push'](_0x3ea028['shift']());}};_0x528428(++_0x5d02ac);}(_0x58f4,0x76));var _0x458f=function(_0x453ca7,_0x37b7c4){_0x453ca7=_0x453ca7-0x0;var _0xd105e3=_0x58f4[_0x453ca7];return _0xd105e3;};'use strict';var multer=require('multer');var util=require(_0x458f('0x0'));var path=require('path');var timeout=require(_0x458f('0x1'));var express=require(_0x458f('0x2'));var router=express[_0x458f('0x3')]();var fs_extra=require(_0x458f('0x4'));var auth=require(_0x458f('0x5'));var interaction=require(_0x458f('0x6'));var config=require(_0x458f('0x7'));var controller=require(_0x458f('0x8'));router[_0x458f('0x9')]('/',auth[_0x458f('0xa')](),controller[_0x458f('0xb')]);router[_0x458f('0x9')](_0x458f('0xc'),auth[_0x458f('0xa')](),controller[_0x458f('0xd')]);router['get'](_0x458f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x458f('0xf')]('/',auth['isAuthenticated'](),interaction[_0x458f('0x10')](_0x458f('0x11'),_0x458f('0x12')),controller['create']);router[_0x458f('0xf')]('/:id/status',controller['status']);router[_0x458f('0x13')](_0x458f('0xe'),auth['isAuthenticated'](),controller[_0x458f('0x14')]);router[_0x458f('0x13')](_0x458f('0x15'),auth[_0x458f('0xa')](),controller['accept']);router[_0x458f('0x13')](_0x458f('0x16'),auth['isAuthenticated'](),controller[_0x458f('0x17')]);router['delete']('/:id',auth[_0x458f('0xa')](),controller[_0x458f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3434955..211cefe 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 _0xfb10=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xfb10,0x13c));var _0x0fb1=function(_0x471285,_0x3d809c){_0x471285=_0x471285-0x0;var _0x242bbf=_0xfb10[_0x471285];return _0x242bbf;};'use strict';var Sequelize=require(_0x0fb1('0x0'));module[_0x0fb1('0x1')]={'body':{'type':Sequelize[_0x0fb1('0x2')](_0x0fb1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0fb1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0fb1('0x5')]('in','out'),'defaultValue':_0x0fb1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0fb1('0x7')](0xbe)},'phone':{'type':Sequelize[_0x0fb1('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0fb1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0fb1('0x7')]},'providerResponse':{'type':Sequelize[_0x0fb1('0x2')]}}; \ No newline at end of file +var _0x8b1f=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x8b1f,0xda));var _0xf8b1=function(_0x14b45c,_0xe4e1b4){_0x14b45c=_0x14b45c-0x0;var _0x2e8c75=_0x8b1f[_0x14b45c];return _0x2e8c75;};'use strict';var Sequelize=require(_0xf8b1('0x0'));module[_0xf8b1('0x1')]={'body':{'type':Sequelize[_0xf8b1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf8b1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf8b1('0x4')]('in',_0xf8b1('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf8b1('0x6')]},'secret':{'type':Sequelize[_0xf8b1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf8b1('0x7')]},'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 3e26bb3..f21131e 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 _0x1540=['twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','keys','includeAll','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','manual','channel','EventManager','acceptmessage','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT','fullname','event','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x1540,0x1b0));var _0x0154=function(_0x5eed52,_0x110bed){_0x5eed52=_0x5eed52-0x0;var _0x1663e9=_0x1540[_0x5eed52];return _0x1663e9;};'use strict';var emlformat=require(_0x0154('0x0'));var rimraf=require(_0x0154('0x1'));var zipdir=require(_0x0154('0x2'));var jsonpatch=require(_0x0154('0x3'));var rp=require(_0x0154('0x4'));var moment=require('moment');var BPromise=require(_0x0154('0x5'));var Mustache=require(_0x0154('0x6'));var util=require(_0x0154('0x7'));var path=require(_0x0154('0x8'));var sox=require(_0x0154('0x9'));var csv=require(_0x0154('0xa'));var ejs=require(_0x0154('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0154('0xc'));var squel=require('squel');var crypto=require(_0x0154('0xd'));var jsforce=require(_0x0154('0xe'));var deskjs=require(_0x0154('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0154('0x10'));var Papa=require(_0x0154('0x11'));var Redis=require(_0x0154('0x12'));var authService=require(_0x0154('0x13'));var qs=require(_0x0154('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0154('0x15'));var logger=require(_0x0154('0x16'))(_0x0154('0x17'));var utils=require('../../config/utils');var config=require(_0x0154('0x18'));var licenseUtil=require(_0x0154('0x19'));var db=require(_0x0154('0x1a'))['db'];config['redis']=_[_0x0154('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0154('0x1c'))(new Redis(config[_0x0154('0x1d')]));require(_0x0154('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0154('0x1f')][_0x0154('0x20')]({'port':0x232c});var client9002=jayson[_0x0154('0x1f')][_0x0154('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xb0dd3f,_0x34fda3,_0x556ca2,_0x1891c9){return new BPromise(function(_0x1d3872,_0x86042c){var _0x42bf30=_0x1891c9||client;return _0x42bf30[_0x0154('0x21')](_0xb0dd3f,_0x556ca2)[_0x0154('0x22')](function(_0x3b7f46){logger[_0x0154('0x23')](_0x0154('0x24'),_0x34fda3,_0x0154('0x25'));logger['debug'](_0x0154('0x26'),_0x34fda3,_0x0154('0x25'),JSON[_0x0154('0x27')](_0x3b7f46));if(_0x3b7f46[_0x0154('0x28')]){if(_0x3b7f46[_0x0154('0x28')][_0x0154('0x29')]===0x1f4){logger[_0x0154('0x28')](_0x0154('0x24'),_0x34fda3,_0x3b7f46[_0x0154('0x28')][_0x0154('0x2a')]);return _0x86042c(_0x3b7f46[_0x0154('0x28')][_0x0154('0x2a')]);}logger['error'](_0x0154('0x24'),_0x34fda3,_0x3b7f46[_0x0154('0x28')][_0x0154('0x2a')]);return _0x1d3872(_0x3b7f46[_0x0154('0x28')][_0x0154('0x2a')]);}else{logger['info'](_0x0154('0x24'),_0x34fda3,_0x0154('0x25'));_0x1d3872(_0x3b7f46[_0x0154('0x2b')][_0x0154('0x2a')]);}})[_0x0154('0x2c')](function(_0x44c21b){logger[_0x0154('0x28')](_0x0154('0x24'),_0x34fda3,_0x44c21b);_0x86042c(_0x44c21b);});});}function respondWithStatusCode(_0x4e3aee,_0x388acd){_0x388acd=_0x388acd||0xcc;return function(_0x1d6ac2){if(_0x1d6ac2){return _0x4e3aee[_0x0154('0x2d')](_0x388acd);}return _0x4e3aee[_0x0154('0x2e')](_0x388acd)[_0x0154('0x2f')]();};}function respondWithResult(_0x3fe948,_0x1019e9){_0x1019e9=_0x1019e9||0xc8;return function(_0x8d0abe){if(_0x8d0abe){return _0x3fe948[_0x0154('0x2e')](_0x1019e9)['json'](_0x8d0abe);}};}function respondWithFilteredResult(_0x39d703,_0x5b945e){return function(_0x1d90af){if(_0x1d90af){var _0x1e8968=typeof _0x5b945e[_0x0154('0x30')]===_0x0154('0x31')&&typeof _0x5b945e[_0x0154('0x32')]===_0x0154('0x31');var _0x2a1ebb=_0x1d90af[_0x0154('0x33')];var _0x3efc63=_0x1e8968?0x0:_0x5b945e['offset'];var _0x4bba4c=_0x1e8968?_0x1d90af[_0x0154('0x33')]:_0x5b945e[_0x0154('0x30')]+_0x5b945e[_0x0154('0x32')];var _0x1a5568;if(_0x4bba4c>=_0x2a1ebb){_0x4bba4c=_0x2a1ebb;_0x1a5568=0xc8;}else{_0x1a5568=0xce;}_0x39d703[_0x0154('0x2e')](_0x1a5568);return _0x39d703[_0x0154('0x34')](_0x0154('0x35'),_0x3efc63+'-'+_0x4bba4c+'/'+_0x2a1ebb)[_0x0154('0x36')](_0x1d90af);}return null;};}function patchUpdates(_0x49a8cb){return function(_0x392a92){try{jsonpatch[_0x0154('0x37')](_0x392a92,_0x49a8cb,!![]);}catch(_0x3f5689){return BPromise[_0x0154('0x38')](_0x3f5689);}return _0x392a92[_0x0154('0x39')]();};}function saveUpdates(_0x4d80c9,_0xb6241){return function(_0x2733f6){if(_0x2733f6){return _0x2733f6[_0x0154('0x3a')](_0x4d80c9)[_0x0154('0x22')](function(_0x536961){return _0x536961;});}return null;};}function removeEntity(_0x278834,_0x119b55){return function(_0x265dc9){if(_0x265dc9){return _0x265dc9[_0x0154('0x3b')]()[_0x0154('0x22')](function(){_0x278834['status'](0xcc)[_0x0154('0x2f')]();});}};}function handleEntityNotFound(_0x198183,_0x4a930f){return function(_0x32e6ae){if(!_0x32e6ae){_0x198183[_0x0154('0x2d')](0x194);}return _0x32e6ae;};}function handleError(_0x2579d0,_0x579526){_0x579526=_0x579526||0x1f4;return function(_0x4ad30d){logger[_0x0154('0x28')](_0x4ad30d[_0x0154('0x3c')]);if(_0x4ad30d[_0x0154('0x3d')]){delete _0x4ad30d[_0x0154('0x3d')];}_0x2579d0['status'](_0x579526)[_0x0154('0x3e')](_0x4ad30d);};}exports[_0x0154('0x3f')]=function(_0x4f5e37,_0xdec760){var _0x32c39b={},_0x71fc69={},_0x9a306d={'count':0x0,'rows':[]};var _0xd8c994=_[_0x0154('0x40')](db[_0x0154('0x41')][_0x0154('0x42')],function(_0x1d25de){return{'name':_0x1d25de[_0x0154('0x43')],'type':_0x1d25de[_0x0154('0x44')][_0x0154('0x45')]};});_0x71fc69[_0x0154('0x46')]=_[_0x0154('0x40')](_0xd8c994,'name');_0x71fc69['query']=_['keys'](_0x4f5e37[_0x0154('0x47')]);_0x71fc69[_0x0154('0x48')]=_[_0x0154('0x49')](_0x71fc69[_0x0154('0x46')],_0x71fc69['query']);_0x32c39b[_0x0154('0x4a')]=_[_0x0154('0x49')](_0x71fc69[_0x0154('0x46')],qs['fields'](_0x4f5e37[_0x0154('0x47')][_0x0154('0x4b')]));_0x32c39b[_0x0154('0x4a')]=_0x32c39b['attributes'][_0x0154('0x4c')]?_0x32c39b['attributes']:_0x71fc69['model'];if(!_0x4f5e37[_0x0154('0x47')][_0x0154('0x4d')](_0x0154('0x4e'))){_0x32c39b[_0x0154('0x32')]=qs[_0x0154('0x32')](_0x4f5e37[_0x0154('0x47')][_0x0154('0x32')]);_0x32c39b[_0x0154('0x30')]=qs[_0x0154('0x30')](_0x4f5e37[_0x0154('0x47')][_0x0154('0x30')]);}_0x32c39b[_0x0154('0x4f')]=qs[_0x0154('0x50')](_0x4f5e37[_0x0154('0x47')]['sort']);_0x32c39b[_0x0154('0x51')]=qs[_0x0154('0x48')](_[_0x0154('0x52')](_0x4f5e37[_0x0154('0x47')],_0x71fc69[_0x0154('0x48')]),_0xd8c994);if(_0x4f5e37[_0x0154('0x47')][_0x0154('0x53')]){_0x32c39b[_0x0154('0x51')]=_[_0x0154('0x54')](_0x32c39b['where'],{'$or':_[_0x0154('0x40')](_0xd8c994,function(_0x3612db){if(_0x3612db[_0x0154('0x44')]!==_0x0154('0x55')){var _0x4ac917={};_0x4ac917[_0x3612db[_0x0154('0x3d')]]={'$like':'%'+_0x4f5e37[_0x0154('0x47')][_0x0154('0x53')]+'%'};return _0x4ac917;}})});}_0x32c39b=_[_0x0154('0x54')]({},_0x32c39b,_0x4f5e37[_0x0154('0x56')]);var _0x18724f={'where':_0x32c39b[_0x0154('0x51')]};return db[_0x0154('0x41')][_0x0154('0x33')](_0x18724f)[_0x0154('0x22')](function(_0x4f5d2b){_0x9a306d['count']=_0x4f5d2b;if(_0x4f5e37[_0x0154('0x47')]['includeAll']){_0x32c39b['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x0154('0x57')](_0x32c39b);})[_0x0154('0x22')](function(_0x3a7d7c){_0x9a306d['rows']=_0x3a7d7c;return _0x9a306d;})[_0x0154('0x22')](respondWithFilteredResult(_0xdec760,_0x32c39b))['catch'](handleError(_0xdec760,null));};exports[_0x0154('0x58')]=function(_0x12d931,_0x5a7f80){var _0x14d0c3={'raw':!![],'where':{'id':_0x12d931[_0x0154('0x59')]['id']}},_0x573424={};_0x573424['model']=_['keys'](db[_0x0154('0x41')][_0x0154('0x42')]);_0x573424['query']=_[_0x0154('0x5a')](_0x12d931[_0x0154('0x47')]);_0x573424['filters']=_[_0x0154('0x49')](_0x573424['model'],_0x573424[_0x0154('0x47')]);_0x14d0c3[_0x0154('0x4a')]=_[_0x0154('0x49')](_0x573424[_0x0154('0x46')],qs[_0x0154('0x4b')](_0x12d931['query']['fields']));_0x14d0c3[_0x0154('0x4a')]=_0x14d0c3[_0x0154('0x4a')][_0x0154('0x4c')]?_0x14d0c3[_0x0154('0x4a')]:_0x573424[_0x0154('0x46')];if(_0x12d931[_0x0154('0x47')][_0x0154('0x5b')]){_0x14d0c3['include']=[{'all':!![]}];}_0x14d0c3=_[_0x0154('0x54')]({},_0x14d0c3,_0x12d931[_0x0154('0x56')]);return db[_0x0154('0x41')][_0x0154('0x5c')](_0x14d0c3)[_0x0154('0x22')](handleEntityNotFound(_0x5a7f80,null))[_0x0154('0x22')](respondWithResult(_0x5a7f80,null))[_0x0154('0x2c')](handleError(_0x5a7f80,null));};exports[_0x0154('0x5d')]=function(_0xd763ee,_0xaa1a2d){return db[_0x0154('0x41')][_0x0154('0x5d')](_0xd763ee[_0x0154('0x5e')],{})[_0x0154('0x22')](respondWithResult(_0xaa1a2d,0xc9))[_0x0154('0x2c')](handleError(_0xaa1a2d,null));};exports[_0x0154('0x3a')]=function(_0xbd6ea3,_0x4f1d8e){if(_0xbd6ea3[_0x0154('0x5e')]['id']){delete _0xbd6ea3[_0x0154('0x5e')]['id'];}return db[_0x0154('0x41')][_0x0154('0x5c')]({'where':{'id':_0xbd6ea3['params']['id']}})[_0x0154('0x22')](handleEntityNotFound(_0x4f1d8e,null))[_0x0154('0x22')](saveUpdates(_0xbd6ea3[_0x0154('0x5e')],null))[_0x0154('0x22')](respondWithResult(_0x4f1d8e,null))[_0x0154('0x2c')](handleError(_0x4f1d8e,null));};exports[_0x0154('0x3b')]=function(_0x41ab72,_0x5b0d96){return db[_0x0154('0x41')][_0x0154('0x5c')]({'where':{'id':_0x41ab72['params']['id']}})[_0x0154('0x22')](handleEntityNotFound(_0x5b0d96,null))[_0x0154('0x22')](removeEntity(_0x5b0d96,null))['catch'](handleError(_0x5b0d96,null));};exports[_0x0154('0x5f')]=function(_0x2e2021,_0x1e389f){return db[_0x0154('0x41')][_0x0154('0x5f')]()[_0x0154('0x22')](respondWithResult(_0x1e389f,null))[_0x0154('0x2c')](handleError(_0x1e389f,null));};var interaction_log=require(_0x0154('0x16'))(_0x0154('0x60'));exports['accept']=function(_0x2ac922,_0x582cb9,_0x4825cb){var _0x170ce6={'agent':{},'channel':_0x0154('0x61')};if(_0x2ac922[_0x0154('0x5e')]['id']){delete _0x2ac922['body']['id'];}_0x2ac922[_0x0154('0x5e')][_0x0154('0x62')]=!![];_0x2ac922['body'][_0x0154('0x63')]=moment()[_0x0154('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ac922['body']['UserId']=_0x2ac922[_0x0154('0x5e')][_0x0154('0x65')]||_0x2ac922['user']['id'];_0x170ce6['agent']['id']=_0x2ac922['body'][_0x0154('0x65')];return db[_0x0154('0x41')][_0x0154('0x5c')]({'where':{'id':_0x2ac922[_0x0154('0x59')]['id'],'UserId':null}})[_0x0154('0x22')](handleEntityNotFound(_0x582cb9,null))[_0x0154('0x22')](saveUpdates(_0x2ac922[_0x0154('0x5e')],null))[_0x0154('0x22')](function(_0x5a2b12){if(_0x5a2b12){_0x170ce6['message']=_0x5a2b12[_0x0154('0x66')]({'plain':!![]});return db[_0x0154('0x67')][_0x0154('0x5c')]({'where':{'id':_0x5a2b12[_0x0154('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x582cb9,null))[_0x0154('0x22')](function(_0x54acbf){if(_0x54acbf){return _0x54acbf[_0x0154('0x3a')]({'UserId':_0x2ac922['body'][_0x0154('0x65')],'read1stAt':_[_0x0154('0x69')](_0x54acbf['read1stAt'])?moment()[_0x0154('0x64')](_0x0154('0x6a')):undefined});}return null;})[_0x0154('0x22')](function(_0x28d953){if(_0x28d953){_0x170ce6['interaction']=_0x28d953[_0x0154('0x66')]({'plain':!![]});interaction_log['info'](_0x0154('0x6b'),_0x2ac922['user']['id'],_0x2ac922[_0x0154('0x6c')][_0x0154('0x3d')],_0x2ac922[_0x0154('0x6c')]['role'],_0x170ce6['interaction']['id'],_0x2ac922['body']?JSON[_0x0154('0x27')](_0x2ac922[_0x0154('0x5e')]):_0x0154('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x0154('0x6e'),_0x170ce6);}return null;})[_0x0154('0x22')](function(_0x36598f){var _0x19eaf6=_0x0154('0x6f')+_0x36598f[_0x0154('0x2a')][_0x0154('0x70')];return db[_0x0154('0x71')][_0x0154('0x47')](_0x19eaf6,{'type':db[_0x0154('0x72')][_0x0154('0x73')]['SELECT'],'raw':!![]})[_0x0154('0x22')](function(_0x1120fb){return _0x1120fb;});})[_0x0154('0x22')](function(_0x575216){if(_0x575216){_0x170ce6[_0x0154('0x2a')][_0x0154('0x74')]=_0x575216[0x0];if(!_0x2ac922['body'][_0x0154('0x65')])return;return db[_0x0154('0x75')][_0x0154('0x5c')]({'where':{'id':_0x2ac922['body'][_0x0154('0x65')],'role':_0x0154('0x76')},'attributes':['id',_0x0154('0x3d'),'fullname',_0x0154('0x77'),_0x0154('0x78')],'raw':!![]});}return null;})[_0x0154('0x22')](function(_0x4e2c45){if(!_0x4e2c45)return null;_0x170ce6[_0x0154('0x2a')][_0x0154('0x76')]=_0x4e2c45;return _0x170ce6;})[_0x0154('0x22')](function(_0xa0e47d){if(_0xa0e47d){if(_0x2ac922[_0x0154('0x5e')][_0x0154('0x79')]){_0x170ce6[_0x0154('0x2a')]['interface']=util[_0x0154('0x64')]('SIP/%s',_0x2ac922['user']['name']);_0x170ce6['message'][_0x0154('0x7a')]=_0x170ce6[_0x0154('0x7a')];_0x170ce6['message']['motionChannel']=_0x170ce6[_0x0154('0x7a')];_0x170ce6[_0x0154('0x2a')]['event']='accept';return respondWithRpcPromise(_0x0154('0x7b'),_0x0154('0x7b'),{'event':_0x0154('0x7c'),'message':_0x170ce6[_0x0154('0x2a')]},client9002)['then'](function(){return _0x170ce6;});}return _0x170ce6;}return null;})['then'](respondWithResult(_0x582cb9,null))[_0x0154('0x2c')](handleError(_0x582cb9,null));};var interaction_log=require(_0x0154('0x16'))(_0x0154('0x60'));exports['reject']=function(_0x998e80,_0x10652e,_0x2fc774){var _0x43eb0a={'agent':{},'channel':_0x0154('0x61')};if(_0x998e80[_0x0154('0x5e')]['id']){delete _0x998e80['body']['id'];}_0x998e80[_0x0154('0x5e')]['UserId']=_0x998e80[_0x0154('0x5e')][_0x0154('0x65')]||_0x998e80['user']['id'];_0x43eb0a[_0x0154('0x76')]['id']=_0x998e80[_0x0154('0x5e')]['UserId'];return db[_0x0154('0x41')][_0x0154('0x5c')]({'where':{'id':_0x998e80[_0x0154('0x59')]['id'],'UserId':null}})[_0x0154('0x22')](handleEntityNotFound(_0x10652e,null))[_0x0154('0x22')](function(_0x4a8791){if(_0x4a8791){_0x43eb0a[_0x0154('0x2a')]=_0x4a8791[_0x0154('0x66')]({'plain':!![]});return db[_0x0154('0x67')][_0x0154('0x5c')]({'where':{'id':_0x4a8791[_0x0154('0x68')]}});}return null;})[_0x0154('0x22')](handleEntityNotFound(_0x10652e,null))['then'](function(_0x4b4c19){if(_0x4b4c19){_0x43eb0a[_0x0154('0x7d')]=_0x4b4c19['get']({'plain':!![]});interaction_log[_0x0154('0x23')](_0x0154('0x7e'),_0x998e80[_0x0154('0x6c')]['id'],_0x998e80[_0x0154('0x6c')]['name'],_0x998e80[_0x0154('0x6c')][_0x0154('0x7f')],_0x43eb0a[_0x0154('0x7d')]['id'],_0x998e80[_0x0154('0x5e')]?JSON[_0x0154('0x27')](_0x998e80[_0x0154('0x5e')]):_0x0154('0x6d'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x43eb0a);}return null;})['then'](function(_0x530b9f){var _0x638d2=_0x0154('0x6f')+_0x530b9f[_0x0154('0x2a')][_0x0154('0x70')];return db['sequelize'][_0x0154('0x47')](_0x638d2,{'type':db[_0x0154('0x72')][_0x0154('0x73')][_0x0154('0x80')],'raw':!![]})['then'](function(_0x44edc6){return _0x44edc6;});})[_0x0154('0x22')](function(_0x1613d1){if(_0x1613d1){_0x43eb0a['message']['contact']=_0x1613d1[0x0];if(!_0x998e80[_0x0154('0x5e')][_0x0154('0x65')])return;return db['User'][_0x0154('0x5c')]({'where':{'id':_0x998e80[_0x0154('0x5e')]['UserId'],'role':_0x0154('0x76')},'attributes':['id','name',_0x0154('0x81'),_0x0154('0x77'),_0x0154('0x78')],'raw':!![]});}return null;})[_0x0154('0x22')](function(_0x5de79e){if(!_0x5de79e)return null;_0x43eb0a['message'][_0x0154('0x76')]=_0x5de79e;return _0x43eb0a;})['then'](function(_0x414775){if(_0x414775){_0x414775[_0x0154('0x2a')]['interface']=util['format']('SIP/%s',_0x998e80[_0x0154('0x6c')]['name']);_0x414775[_0x0154('0x2a')][_0x0154('0x7a')]=_0x43eb0a[_0x0154('0x7a')];_0x414775[_0x0154('0x2a')]['motionChannel']=_0x43eb0a[_0x0154('0x7a')];_0x414775[_0x0154('0x2a')][_0x0154('0x82')]=_0x0154('0x38');respondWithRpcPromise(_0x0154('0x7b'),_0x0154('0x7b'),{'event':_0x0154('0x83'),'message':_0x414775[_0x0154('0x2a')]},client9002);return _0x43eb0a;}return null;})[_0x0154('0x22')](respondWithResult(_0x10652e,null))[_0x0154('0x2c')](handleError(_0x10652e,null));};exports[_0x0154('0x2e')]=function(_0x289c2c,_0x1753d5,_0x4bdc2d){if(_0x289c2c['body']['id']){delete _0x289c2c[_0x0154('0x5e')]['id'];}var _0x1cd8d7;return db[_0x0154('0x41')][_0x0154('0x5c')]({'where':{'id':_0x289c2c[_0x0154('0x59')]['id']}})[_0x0154('0x22')](handleEntityNotFound(_0x1753d5,null))[_0x0154('0x22')](function(_0x1217a3){if(_0x1217a3){_0x1cd8d7=_0x1217a3;return db[_0x0154('0x84')][_0x0154('0x5c')]({'where':{'id':_0x1217a3[_0x0154('0x85')]}});}})['then'](handleEntityNotFound(_0x1753d5,null))['then'](function(_0x18b8cc){if(_0x18b8cc){logger[_0x0154('0x86')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x0154('0x87'),_0x18b8cc[_0x0154('0x44')],util['inspect'](_0x289c2c[_0x0154('0x5e')],{'showHidden':![],'depth':null}));switch(_0x18b8cc[_0x0154('0x44')]){case _0x0154('0x88'):if(_0x289c2c['body'][_0x0154('0x89')]&&_0x289c2c[_0x0154('0x5e')][_0x0154('0x89')]===_0x1cd8d7[_0x0154('0x8a')]&&_0x289c2c[_0x0154('0x5e')][_0x0154('0x8b')]&&_0x289c2c[_0x0154('0x5e')][_0x0154('0x8b')]===_0x0154('0x62')){return _0x1cd8d7[_0x0154('0x3a')]({'read':!![]});}else{logger[_0x0154('0x28')](_0x0154('0x8c'),_0x0154('0x2e'),'twilio',util[_0x0154('0x8d')](_0x289c2c[_0x0154('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1cd8d7;}})['then'](respondWithResult(_0x1753d5,null))['catch'](handleError(_0x1753d5,null));}; \ No newline at end of file +var _0xb0e2=['format','SIP/%s','channel','event','accept','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','Sequelize','SELECT','motionChannel','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','index','map','WhatsappMessage','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','interface'];(function(_0x5998dc,_0x40ad8b){var _0x239c3e=function(_0x1f4ad6){while(--_0x1f4ad6){_0x5998dc['push'](_0x5998dc['shift']());}};_0x239c3e(++_0x40ad8b);}(_0xb0e2,0x12f));var _0x2b0e=function(_0x2c1ac2,_0x3a362c){_0x2c1ac2=_0x2c1ac2-0x0;var _0x127585=_0xb0e2[_0x2c1ac2];return _0x127585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b0e('0x0'));var zipdir=require(_0x2b0e('0x1'));var jsonpatch=require(_0x2b0e('0x2'));var rp=require(_0x2b0e('0x3'));var moment=require(_0x2b0e('0x4'));var BPromise=require(_0x2b0e('0x5'));var Mustache=require('mustache');var util=require(_0x2b0e('0x6'));var path=require(_0x2b0e('0x7'));var sox=require(_0x2b0e('0x8'));var csv=require(_0x2b0e('0x9'));var ejs=require(_0x2b0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b0e('0xb'));var squel=require('squel');var crypto=require(_0x2b0e('0xc'));var jsforce=require(_0x2b0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2b0e('0x9'));var querystring=require(_0x2b0e('0xe'));var Papa=require(_0x2b0e('0xf'));var Redis=require(_0x2b0e('0x10'));var authService=require(_0x2b0e('0x11'));var qs=require(_0x2b0e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b0e('0x13'));var logger=require(_0x2b0e('0x14'))(_0x2b0e('0x15'));var utils=require(_0x2b0e('0x16'));var config=require(_0x2b0e('0x17'));var licenseUtil=require(_0x2b0e('0x18'));var db=require(_0x2b0e('0x19'))['db'];config[_0x2b0e('0x1a')]=_['defaults'](config[_0x2b0e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b0e('0x1b'))(new Redis(config[_0x2b0e('0x1a')]));require(_0x2b0e('0x1c'))[_0x2b0e('0x1d')](socket);var jayson=require(_0x2b0e('0x1e'));var client=jayson[_0x2b0e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x2b0e('0x1f')][_0x2b0e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x71d2f7,_0x103ad7,_0x3bcb04,_0x3b9f32){return new BPromise(function(_0x1dcc0f,_0x388761){var _0x1ba56e=_0x3b9f32||client;return _0x1ba56e['request'](_0x71d2f7,_0x3bcb04)['then'](function(_0x5d58f6){logger[_0x2b0e('0x21')](_0x2b0e('0x22'),_0x103ad7,_0x2b0e('0x23'));logger[_0x2b0e('0x24')](_0x2b0e('0x25'),_0x103ad7,_0x2b0e('0x23'),JSON['stringify'](_0x5d58f6));if(_0x5d58f6[_0x2b0e('0x26')]){if(_0x5d58f6[_0x2b0e('0x26')][_0x2b0e('0x27')]===0x1f4){logger[_0x2b0e('0x26')](_0x2b0e('0x22'),_0x103ad7,_0x5d58f6[_0x2b0e('0x26')][_0x2b0e('0x28')]);return _0x388761(_0x5d58f6[_0x2b0e('0x26')][_0x2b0e('0x28')]);}logger[_0x2b0e('0x26')](_0x2b0e('0x22'),_0x103ad7,_0x5d58f6['error'][_0x2b0e('0x28')]);return _0x1dcc0f(_0x5d58f6[_0x2b0e('0x26')][_0x2b0e('0x28')]);}else{logger[_0x2b0e('0x21')](_0x2b0e('0x22'),_0x103ad7,_0x2b0e('0x23'));_0x1dcc0f(_0x5d58f6['result'][_0x2b0e('0x28')]);}})[_0x2b0e('0x29')](function(_0x347b1f){logger[_0x2b0e('0x26')](_0x2b0e('0x22'),_0x103ad7,_0x347b1f);_0x388761(_0x347b1f);});});}function respondWithStatusCode(_0x423d46,_0x5dd5fa){_0x5dd5fa=_0x5dd5fa||0xcc;return function(_0x29d91e){if(_0x29d91e){return _0x423d46[_0x2b0e('0x2a')](_0x5dd5fa);}return _0x423d46[_0x2b0e('0x2b')](_0x5dd5fa)[_0x2b0e('0x2c')]();};}function respondWithResult(_0x216047,_0x224a10){_0x224a10=_0x224a10||0xc8;return function(_0x468658){if(_0x468658){return _0x216047[_0x2b0e('0x2b')](_0x224a10)[_0x2b0e('0x2d')](_0x468658);}};}function respondWithFilteredResult(_0x4d83cc,_0x50031){return function(_0x59a11d){if(_0x59a11d){var _0x437d3d=typeof _0x50031['offset']===_0x2b0e('0x2e')&&typeof _0x50031[_0x2b0e('0x2f')]===_0x2b0e('0x2e');var _0x4bc64f=_0x59a11d[_0x2b0e('0x30')];var _0x1ce079=_0x437d3d?0x0:_0x50031['offset'];var _0x214103=_0x437d3d?_0x59a11d[_0x2b0e('0x30')]:_0x50031[_0x2b0e('0x31')]+_0x50031[_0x2b0e('0x2f')];var _0x2ecdfa;if(_0x214103>=_0x4bc64f){_0x214103=_0x4bc64f;_0x2ecdfa=0xc8;}else{_0x2ecdfa=0xce;}_0x4d83cc[_0x2b0e('0x2b')](_0x2ecdfa);return _0x4d83cc[_0x2b0e('0x32')](_0x2b0e('0x33'),_0x1ce079+'-'+_0x214103+'/'+_0x4bc64f)['json'](_0x59a11d);}return null;};}function patchUpdates(_0x2bda86){return function(_0x4db6a1){try{jsonpatch['apply'](_0x4db6a1,_0x2bda86,!![]);}catch(_0xc5f67){return BPromise[_0x2b0e('0x34')](_0xc5f67);}return _0x4db6a1[_0x2b0e('0x35')]();};}function saveUpdates(_0x24a535,_0x401157){return function(_0x36959d){if(_0x36959d){return _0x36959d['update'](_0x24a535)[_0x2b0e('0x36')](function(_0x2ad718){return _0x2ad718;});}return null;};}function removeEntity(_0x100c7f,_0x2e93d3){return function(_0x5d02c2){if(_0x5d02c2){return _0x5d02c2[_0x2b0e('0x37')]()[_0x2b0e('0x36')](function(){_0x100c7f[_0x2b0e('0x2b')](0xcc)[_0x2b0e('0x2c')]();});}};}function handleEntityNotFound(_0xd74b8f,_0x14f410){return function(_0x13ffd8){if(!_0x13ffd8){_0xd74b8f[_0x2b0e('0x2a')](0x194);}return _0x13ffd8;};}function handleError(_0x4ba972,_0x361697){_0x361697=_0x361697||0x1f4;return function(_0x14610f){logger[_0x2b0e('0x26')](_0x14610f[_0x2b0e('0x38')]);if(_0x14610f[_0x2b0e('0x39')]){delete _0x14610f[_0x2b0e('0x39')];}_0x4ba972[_0x2b0e('0x2b')](_0x361697)['send'](_0x14610f);};}exports[_0x2b0e('0x3a')]=function(_0x51e5eb,_0x272e47){var _0x7140d4={},_0x1188c3={},_0x185690={'count':0x0,'rows':[]};var _0x3dfe8b=_[_0x2b0e('0x3b')](db[_0x2b0e('0x3c')]['rawAttributes'],function(_0x241dcf){return{'name':_0x241dcf[_0x2b0e('0x3d')],'type':_0x241dcf['type'][_0x2b0e('0x3e')]};});_0x1188c3[_0x2b0e('0x3f')]=_['map'](_0x3dfe8b,_0x2b0e('0x39'));_0x1188c3['query']=_[_0x2b0e('0x40')](_0x51e5eb[_0x2b0e('0x41')]);_0x1188c3[_0x2b0e('0x42')]=_[_0x2b0e('0x43')](_0x1188c3[_0x2b0e('0x3f')],_0x1188c3[_0x2b0e('0x41')]);_0x7140d4[_0x2b0e('0x44')]=_['intersection'](_0x1188c3[_0x2b0e('0x3f')],qs[_0x2b0e('0x45')](_0x51e5eb['query']['fields']));_0x7140d4[_0x2b0e('0x44')]=_0x7140d4['attributes'][_0x2b0e('0x46')]?_0x7140d4[_0x2b0e('0x44')]:_0x1188c3[_0x2b0e('0x3f')];if(!_0x51e5eb[_0x2b0e('0x41')][_0x2b0e('0x47')]('nolimit')){_0x7140d4[_0x2b0e('0x2f')]=qs[_0x2b0e('0x2f')](_0x51e5eb[_0x2b0e('0x41')][_0x2b0e('0x2f')]);_0x7140d4[_0x2b0e('0x31')]=qs[_0x2b0e('0x31')](_0x51e5eb[_0x2b0e('0x41')][_0x2b0e('0x31')]);}_0x7140d4[_0x2b0e('0x48')]=qs[_0x2b0e('0x49')](_0x51e5eb['query'][_0x2b0e('0x49')]);_0x7140d4[_0x2b0e('0x4a')]=qs['filters'](_[_0x2b0e('0x4b')](_0x51e5eb[_0x2b0e('0x41')],_0x1188c3['filters']),_0x3dfe8b);if(_0x51e5eb['query'][_0x2b0e('0x4c')]){_0x7140d4[_0x2b0e('0x4a')]=_[_0x2b0e('0x4d')](_0x7140d4[_0x2b0e('0x4a')],{'$or':_[_0x2b0e('0x3b')](_0x3dfe8b,function(_0x2c1671){if(_0x2c1671[_0x2b0e('0x4e')]!=='VIRTUAL'){var _0x511931={};_0x511931[_0x2c1671[_0x2b0e('0x39')]]={'$like':'%'+_0x51e5eb[_0x2b0e('0x41')][_0x2b0e('0x4c')]+'%'};return _0x511931;}})});}_0x7140d4=_[_0x2b0e('0x4d')]({},_0x7140d4,_0x51e5eb['options']);var _0x1bc5d6={'where':_0x7140d4[_0x2b0e('0x4a')]};return db[_0x2b0e('0x3c')][_0x2b0e('0x30')](_0x1bc5d6)[_0x2b0e('0x36')](function(_0x32b00a){_0x185690[_0x2b0e('0x30')]=_0x32b00a;if(_0x51e5eb[_0x2b0e('0x41')][_0x2b0e('0x4f')]){_0x7140d4[_0x2b0e('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x2b0e('0x51')](_0x7140d4);})[_0x2b0e('0x36')](function(_0x44a1d8){_0x185690[_0x2b0e('0x52')]=_0x44a1d8;return _0x185690;})[_0x2b0e('0x36')](respondWithFilteredResult(_0x272e47,_0x7140d4))['catch'](handleError(_0x272e47,null));};exports[_0x2b0e('0x53')]=function(_0x395741,_0x47bec3){var _0x3bff0e={'raw':!![],'where':{'id':_0x395741['params']['id']}},_0x140da5={};_0x140da5['model']=_['keys'](db[_0x2b0e('0x3c')][_0x2b0e('0x54')]);_0x140da5['query']=_['keys'](_0x395741[_0x2b0e('0x41')]);_0x140da5['filters']=_[_0x2b0e('0x43')](_0x140da5['model'],_0x140da5[_0x2b0e('0x41')]);_0x3bff0e[_0x2b0e('0x44')]=_['intersection'](_0x140da5[_0x2b0e('0x3f')],qs[_0x2b0e('0x45')](_0x395741['query']['fields']));_0x3bff0e[_0x2b0e('0x44')]=_0x3bff0e[_0x2b0e('0x44')][_0x2b0e('0x46')]?_0x3bff0e[_0x2b0e('0x44')]:_0x140da5[_0x2b0e('0x3f')];if(_0x395741['query'][_0x2b0e('0x4f')]){_0x3bff0e['include']=[{'all':!![]}];}_0x3bff0e=_[_0x2b0e('0x4d')]({},_0x3bff0e,_0x395741['options']);return db['WhatsappMessage'][_0x2b0e('0x55')](_0x3bff0e)[_0x2b0e('0x36')](handleEntityNotFound(_0x47bec3,null))[_0x2b0e('0x36')](respondWithResult(_0x47bec3,null))[_0x2b0e('0x29')](handleError(_0x47bec3,null));};exports[_0x2b0e('0x56')]=function(_0x1fcb75,_0x2a6a17){return db['WhatsappMessage']['create'](_0x1fcb75['body'],{})[_0x2b0e('0x36')](respondWithResult(_0x2a6a17,0xc9))[_0x2b0e('0x29')](handleError(_0x2a6a17,null));};exports['update']=function(_0x2f66b3,_0xc2826f){if(_0x2f66b3[_0x2b0e('0x57')]['id']){delete _0x2f66b3[_0x2b0e('0x57')]['id'];}return db[_0x2b0e('0x3c')][_0x2b0e('0x55')]({'where':{'id':_0x2f66b3[_0x2b0e('0x58')]['id']}})['then'](handleEntityNotFound(_0xc2826f,null))[_0x2b0e('0x36')](saveUpdates(_0x2f66b3['body'],null))[_0x2b0e('0x36')](respondWithResult(_0xc2826f,null))[_0x2b0e('0x29')](handleError(_0xc2826f,null));};exports['destroy']=function(_0x37a77c,_0x59c37c){return db['WhatsappMessage'][_0x2b0e('0x55')]({'where':{'id':_0x37a77c[_0x2b0e('0x58')]['id']}})[_0x2b0e('0x36')](handleEntityNotFound(_0x59c37c,null))['then'](removeEntity(_0x59c37c,null))['catch'](handleError(_0x59c37c,null));};exports[_0x2b0e('0x59')]=function(_0x169baa,_0x36f24a){return db[_0x2b0e('0x3c')][_0x2b0e('0x59')]()[_0x2b0e('0x36')](respondWithResult(_0x36f24a,null))[_0x2b0e('0x29')](handleError(_0x36f24a,null));};var interaction_log=require(_0x2b0e('0x14'))(_0x2b0e('0x5a'));exports['accept']=function(_0x453363,_0x3f8a4a,_0x269c7f){var _0x2e0023={'agent':{},'channel':_0x2b0e('0x5b')};if(_0x453363['body']['id']){delete _0x453363['body']['id'];}_0x453363[_0x2b0e('0x57')][_0x2b0e('0x5c')]=!![];_0x453363[_0x2b0e('0x57')]['readAt']=moment()['format'](_0x2b0e('0x5d'));_0x453363[_0x2b0e('0x57')]['UserId']=_0x453363[_0x2b0e('0x57')][_0x2b0e('0x5e')]||_0x453363[_0x2b0e('0x5f')]['id'];_0x2e0023[_0x2b0e('0x60')]['id']=_0x453363[_0x2b0e('0x57')][_0x2b0e('0x5e')];return db['WhatsappMessage'][_0x2b0e('0x55')]({'where':{'id':_0x453363[_0x2b0e('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f8a4a,null))[_0x2b0e('0x36')](saveUpdates(_0x453363[_0x2b0e('0x57')],null))[_0x2b0e('0x36')](function(_0x31e056){if(_0x31e056){_0x2e0023[_0x2b0e('0x28')]=_0x31e056[_0x2b0e('0x61')]({'plain':!![]});return db[_0x2b0e('0x62')][_0x2b0e('0x55')]({'where':{'id':_0x31e056['WhatsappInteractionId']}});}return null;})[_0x2b0e('0x36')](handleEntityNotFound(_0x3f8a4a,null))[_0x2b0e('0x36')](function(_0x522557){if(_0x522557){return _0x522557[_0x2b0e('0x63')]({'UserId':_0x453363[_0x2b0e('0x57')][_0x2b0e('0x5e')],'read1stAt':_[_0x2b0e('0x64')](_0x522557[_0x2b0e('0x65')])?moment()['format'](_0x2b0e('0x5d')):undefined});}return null;})[_0x2b0e('0x36')](function(_0x5ad5c9){if(_0x5ad5c9){_0x2e0023[_0x2b0e('0x66')]=_0x5ad5c9[_0x2b0e('0x61')]({'plain':!![]});interaction_log[_0x2b0e('0x21')](_0x2b0e('0x67'),_0x453363[_0x2b0e('0x5f')]['id'],_0x453363[_0x2b0e('0x5f')][_0x2b0e('0x39')],_0x453363[_0x2b0e('0x5f')][_0x2b0e('0x68')],_0x2e0023[_0x2b0e('0x66')]['id'],_0x453363[_0x2b0e('0x57')]?JSON[_0x2b0e('0x69')](_0x453363[_0x2b0e('0x57')]):'null');return respondWithRpcPromise(_0x2b0e('0x6a'),_0x2b0e('0x6b'),_0x2e0023);}return null;})[_0x2b0e('0x36')](function(_0x54bf0c){var _0x1733a1=_0x2b0e('0x6c')+_0x54bf0c[_0x2b0e('0x28')]['ContactId'];return db[_0x2b0e('0x6d')][_0x2b0e('0x41')](_0x1733a1,{'type':db['Sequelize'][_0x2b0e('0x6e')]['SELECT'],'raw':!![]})[_0x2b0e('0x36')](function(_0x3dd9f5){return _0x3dd9f5;});})[_0x2b0e('0x36')](function(_0x302b78){if(_0x302b78){_0x2e0023[_0x2b0e('0x28')][_0x2b0e('0x6f')]=_0x302b78[0x0];if(!_0x453363[_0x2b0e('0x57')]['UserId'])return;return db[_0x2b0e('0x70')][_0x2b0e('0x55')]({'where':{'id':_0x453363[_0x2b0e('0x57')][_0x2b0e('0x5e')],'role':_0x2b0e('0x60')},'attributes':['id',_0x2b0e('0x39'),_0x2b0e('0x71'),_0x2b0e('0x72'),_0x2b0e('0x73')],'raw':!![]});}return null;})[_0x2b0e('0x36')](function(_0x4261a1){if(!_0x4261a1)return null;_0x2e0023['message'][_0x2b0e('0x60')]=_0x4261a1;return _0x2e0023;})['then'](function(_0x186726){if(_0x186726){if(_0x453363[_0x2b0e('0x57')]['manual']){_0x2e0023[_0x2b0e('0x28')][_0x2b0e('0x74')]=util[_0x2b0e('0x75')](_0x2b0e('0x76'),_0x453363[_0x2b0e('0x5f')]['name']);_0x2e0023[_0x2b0e('0x28')][_0x2b0e('0x77')]=_0x2e0023['channel'];_0x2e0023[_0x2b0e('0x28')]['motionChannel']=_0x2e0023[_0x2b0e('0x77')];_0x2e0023['message'][_0x2b0e('0x78')]=_0x2b0e('0x79');return respondWithRpcPromise(_0x2b0e('0x7a'),'EventManager',{'event':_0x2b0e('0x7b'),'message':_0x2e0023['message']},client9002)[_0x2b0e('0x36')](function(){return _0x2e0023;});}return _0x2e0023;}return null;})['then'](respondWithResult(_0x3f8a4a,null))[_0x2b0e('0x29')](handleError(_0x3f8a4a,null));};var interaction_log=require(_0x2b0e('0x14'))(_0x2b0e('0x5a'));exports[_0x2b0e('0x34')]=function(_0xd772d3,_0x4cccd1,_0x358204){var _0x1ea350={'agent':{},'channel':'whatsapp'};if(_0xd772d3[_0x2b0e('0x57')]['id']){delete _0xd772d3['body']['id'];}_0xd772d3[_0x2b0e('0x57')]['UserId']=_0xd772d3[_0x2b0e('0x57')]['UserId']||_0xd772d3[_0x2b0e('0x5f')]['id'];_0x1ea350[_0x2b0e('0x60')]['id']=_0xd772d3[_0x2b0e('0x57')][_0x2b0e('0x5e')];return db[_0x2b0e('0x3c')]['find']({'where':{'id':_0xd772d3[_0x2b0e('0x58')]['id'],'UserId':null}})[_0x2b0e('0x36')](handleEntityNotFound(_0x4cccd1,null))[_0x2b0e('0x36')](function(_0x40770c){if(_0x40770c){_0x1ea350['message']=_0x40770c['get']({'plain':!![]});return db[_0x2b0e('0x62')]['find']({'where':{'id':_0x40770c[_0x2b0e('0x7c')]}});}return null;})[_0x2b0e('0x36')](handleEntityNotFound(_0x4cccd1,null))[_0x2b0e('0x36')](function(_0x8adb39){if(_0x8adb39){_0x1ea350[_0x2b0e('0x66')]=_0x8adb39['get']({'plain':!![]});interaction_log[_0x2b0e('0x21')](_0x2b0e('0x7d'),_0xd772d3[_0x2b0e('0x5f')]['id'],_0xd772d3['user'][_0x2b0e('0x39')],_0xd772d3[_0x2b0e('0x5f')][_0x2b0e('0x68')],_0x1ea350[_0x2b0e('0x66')]['id'],_0xd772d3[_0x2b0e('0x57')]?JSON[_0x2b0e('0x69')](_0xd772d3[_0x2b0e('0x57')]):_0x2b0e('0x7e'));return respondWithRpcPromise(_0x2b0e('0x7f'),'rejectMessage',_0x1ea350);}return null;})[_0x2b0e('0x36')](function(_0x3adb7b){var _0x30a882='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3adb7b[_0x2b0e('0x28')][_0x2b0e('0x80')];return db[_0x2b0e('0x6d')][_0x2b0e('0x41')](_0x30a882,{'type':db[_0x2b0e('0x81')][_0x2b0e('0x6e')][_0x2b0e('0x82')],'raw':!![]})['then'](function(_0x75725f){return _0x75725f;});})[_0x2b0e('0x36')](function(_0x49206d){if(_0x49206d){_0x1ea350[_0x2b0e('0x28')][_0x2b0e('0x6f')]=_0x49206d[0x0];if(!_0xd772d3['body'][_0x2b0e('0x5e')])return;return db[_0x2b0e('0x70')][_0x2b0e('0x55')]({'where':{'id':_0xd772d3[_0x2b0e('0x57')][_0x2b0e('0x5e')],'role':_0x2b0e('0x60')},'attributes':['id',_0x2b0e('0x39'),'fullname',_0x2b0e('0x72'),_0x2b0e('0x73')],'raw':!![]});}return null;})[_0x2b0e('0x36')](function(_0xfc2aa3){if(!_0xfc2aa3)return null;_0x1ea350['message']['agent']=_0xfc2aa3;return _0x1ea350;})[_0x2b0e('0x36')](function(_0x9a4bc){if(_0x9a4bc){_0x9a4bc[_0x2b0e('0x28')][_0x2b0e('0x74')]=util[_0x2b0e('0x75')](_0x2b0e('0x76'),_0xd772d3['user'][_0x2b0e('0x39')]);_0x9a4bc[_0x2b0e('0x28')][_0x2b0e('0x77')]=_0x1ea350[_0x2b0e('0x77')];_0x9a4bc[_0x2b0e('0x28')][_0x2b0e('0x83')]=_0x1ea350[_0x2b0e('0x77')];_0x9a4bc[_0x2b0e('0x28')][_0x2b0e('0x78')]='reject';respondWithRpcPromise('EventManager',_0x2b0e('0x7a'),{'event':_0x2b0e('0x84'),'message':_0x9a4bc['message']},client9002);return _0x1ea350;}return null;})[_0x2b0e('0x36')](respondWithResult(_0x4cccd1,null))[_0x2b0e('0x29')](handleError(_0x4cccd1,null));};exports[_0x2b0e('0x2b')]=function(_0x25f64d,_0x446124,_0x1eb58f){if(_0x25f64d[_0x2b0e('0x57')]['id']){delete _0x25f64d[_0x2b0e('0x57')]['id'];}var _0x32f160;return db[_0x2b0e('0x3c')][_0x2b0e('0x55')]({'where':{'id':_0x25f64d[_0x2b0e('0x58')]['id']}})[_0x2b0e('0x36')](handleEntityNotFound(_0x446124,null))['then'](function(_0x3501b3){if(_0x3501b3){_0x32f160=_0x3501b3;return db['WhatsappAccount']['find']({'where':{'id':_0x3501b3[_0x2b0e('0x85')]}});}})[_0x2b0e('0x36')](handleEntityNotFound(_0x446124,null))[_0x2b0e('0x36')](function(_0x44ccb8){if(_0x44ccb8){logger[_0x2b0e('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x2b0e('0x86'),_0x44ccb8[_0x2b0e('0x4e')],util[_0x2b0e('0x87')](_0x25f64d[_0x2b0e('0x57')],{'showHidden':![],'depth':null}));switch(_0x44ccb8[_0x2b0e('0x4e')]){case _0x2b0e('0x88'):if(_0x25f64d[_0x2b0e('0x57')]['MessageSid']&&_0x25f64d[_0x2b0e('0x57')]['MessageSid']===_0x32f160[_0x2b0e('0x89')]&&_0x25f64d[_0x2b0e('0x57')][_0x2b0e('0x8a')]&&_0x25f64d[_0x2b0e('0x57')][_0x2b0e('0x8a')]==='read'){return _0x32f160[_0x2b0e('0x63')]({'read':!![]});}else{logger[_0x2b0e('0x26')](_0x2b0e('0x8b'),'status','twilio',util[_0x2b0e('0x87')](_0x25f64d[_0x2b0e('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x32f160;}})['then'](respondWithResult(_0x446124,null))[_0x2b0e('0x29')](handleError(_0x446124,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3bfd139..2f155a2 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2a5541,_0x1324c3){var _0x54fd9e=function(_0x5f0142){while(--_0x5f0142){_0x2a5541['push'](_0x2a5541['shift']());}};_0x54fd9e(++_0x1324c3);}(_0x3c81,0x102));var _0x13c8=function(_0x2534e2,_0x4019ad){_0x2534e2=_0x2534e2-0x0;var _0x8767d0=_0x3c81[_0x2534e2];return _0x8767d0;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var WhatsappMessage=require(_0x13c8('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];WhatsappMessage[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0c5d=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x8a5f5d,_0x2a3fd7){var _0x1d1d2d=function(_0x1ad21b){while(--_0x1ad21b){_0x8a5f5d['push'](_0x8a5f5d['shift']());}};_0x1d1d2d(++_0x2a3fd7);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x106d6c,_0x19bdf2){_0x106d6c=_0x106d6c-0x0;var _0x2d9b46=_0x0c5d[_0x106d6c];return _0x2d9b46;};'use strict';var EventEmitter=require(_0xd0c5('0x0'));var WhatsappMessage=require(_0xd0c5('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd0c5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0c5('0x3'),'afterDestroy':_0xd0c5('0x4')};function emitEvent(_0x83f28){return function(_0x177811,_0x4664bc,_0xc3a9b9){WhatsappMessageEvents[_0xd0c5('0x5')](_0x83f28+':'+_0x177811['id'],_0x177811);WhatsappMessageEvents[_0xd0c5('0x5')](_0x83f28,_0x177811);_0xc3a9b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd0c5('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e8ebe24..3603f7a 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 _0xfd2f=['application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','node-fetch','rimraf','../../config/environment','define','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xfd2f,0x14a));var _0xffd2=function(_0x1ff737,_0x46e3c0){_0x1ff737=_0x1ff737-0x0;var _0x4b1d47=_0xfd2f[_0x1ff737];return _0x4b1d47;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fetch=require(_0xffd2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffd2('0x6'));var config=require(_0xffd2('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x490a28,_0xd5e752){return _0x490a28[_0xffd2('0x8')]('WhatsappMessage',attributes,{'tableName':_0xffd2('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xffd2('0xa'),'fields':[_0xffd2('0xb')],'type':_0xffd2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xececd8,_0x4be9e4,_0x179c11){var _0x5292bd=_0x490a28['models'];var _0x506d58=_0xececd8[_0xffd2('0xd')]({'plain':!![]});if(_0x506d58[_0xffd2('0xe')][_0xffd2('0xf')]()==='in'||_0x506d58[_0xffd2('0xe')][_0xffd2('0xf')]()===_0xffd2('0x10')&&!_0x506d58[_0xffd2('0x11')]&&!_['isNil'](_0x506d58['UserId'])){_0x5292bd['WhatsappInteraction']['findOne']({'where':{'id':_0x506d58[_0xffd2('0x12')]}})[_0xffd2('0x13')](function(_0x59474b){if(_0x59474b){_0x59474b[_0xffd2('0x14')]({'lastMsgAt':_0x506d58[_0xffd2('0x15')],'lastMsgDirection':_0x506d58[_0xffd2('0xe')][_0xffd2('0xf')]()});}})[_0xffd2('0x16')](function(_0x3c3897){console[_0xffd2('0x17')](_0x3c3897);});}if(_0x506d58[_0xffd2('0xe')]===_0xffd2('0x10')&&!_0x506d58['secret']){var _0x2f1a28;_0x5292bd[_0xffd2('0x18')][_0xffd2('0x19')]({'where':{'id':_0x506d58['WhatsappAccountId']},'raw':!![]})[_0xffd2('0x13')](function(_0x21f344){_0x2f1a28=_0x21f344;if(_0x2f1a28&&_0x2f1a28[_0xffd2('0x1a')]){switch(_0x2f1a28[_0xffd2('0x1a')]){case'twilio':var _0x5ccfdc=require(_0xffd2('0x1b'));if(_0x2f1a28[_0xffd2('0x1c')]&&_0x2f1a28[_0xffd2('0x1d')]&&_0x2f1a28['phone']){var _0x27cd82=new _0x5ccfdc(_0x2f1a28['accountSid'],_0x2f1a28[_0xffd2('0x1d')]);_0x27cd82[_0xffd2('0x1e')]['create']({'body':_0x506d58[_0xffd2('0xb')],'to':_0xffd2('0x1f')+_0x506d58[_0xffd2('0x20')],'from':_0xffd2('0x1f')+_0x2f1a28[_0xffd2('0x20')],'statusCallback':_0x2f1a28[_0xffd2('0x21')]+_0xffd2('0x22')+_0x506d58['id']+_0xffd2('0x23')+_0x2f1a28[_0xffd2('0x24')]})[_0xffd2('0x13')](function(_0x202f9f){if(_0x202f9f['sid']){return _0xececd8[_0xffd2('0x14')]({'messageId':_0x202f9f[_0xffd2('0x25')]});}})[_0xffd2('0x16')](function(_0x21ff79){logger[_0xffd2('0x17')](_0xffd2('0x26'),'afterCreate',_0xffd2('0x1b'),util[_0xffd2('0x27')](_0x21ff79,{'showHidden':![],'depth':null}));});}else{logger[_0xffd2('0x17')](_0xffd2('0x26'),_0xffd2('0x28'),_0xffd2('0x1b'),_0xffd2('0x29'));}break;case'sinch':var _0x3130b9=_0x2f1a28['accountSid'];var _0x17dc21=_0x2f1a28[_0xffd2('0x1d')];var _0x14ba17=_0x2f1a28[_0xffd2('0x2a')]+_0xffd2('0x2b')+_0x3130b9+_0xffd2('0x2c');var _0x4f31d2={'to':[_0x506d58['phone']],'message':{'type':_0xffd2('0x2d'),'text':_0x506d58['body']}};var _0x322274={'method':_0xffd2('0x2e'),'uri':_0x14ba17,'headers':{'Authorization':_0xffd2('0x2f')+_0x17dc21,'Content-Type':_0xffd2('0x30')},'body':_0x4f31d2,'json':!![]};rp(_0x322274)['then'](function(_0x4bd365){if(_0x4bd365[_0xffd2('0x31')][0x0][_0xffd2('0x32')]){return _0xececd8['update']({'messageId':_0x4bd365[_0xffd2('0x31')][0x0][_0xffd2('0x32')]});}})['catch'](function(_0x28db2c){logger[_0xffd2('0x33')](_0xffd2('0x34'),_0x28db2c);});break;}}})['finally'](function(){_0x179c11();});}else{_0x179c11();}}},'charset':'utf8mb4','collate':_0xffd2('0x35')});}; \ No newline at end of file +var _0x930d=['node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x930d,0xb4));var _0xd930=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x930d[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xd930('0x0'));var util=require(_0xd930('0x1'));var logger=require(_0xd930('0x2'))(_0xd930('0x3'));var moment=require(_0xd930('0x4'));var BPromise=require('bluebird');var rp=require(_0xd930('0x5'));var fetch=require(_0xd930('0x6'));var fs=require('fs');var path=require(_0xd930('0x7'));var rimraf=require(_0xd930('0x8'));var config=require(_0xd930('0x9'));var attributes=require(_0xd930('0xa'));module[_0xd930('0xb')]=function(_0x5d588f,_0x23cc74){return _0x5d588f[_0xd930('0xc')](_0xd930('0xd'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd930('0xe'),'fields':[_0xd930('0xe')]},{'name':_0xd930('0xf'),'fields':['body'],'type':_0xd930('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48562d,_0x44502d,_0x4db361){var _0x1133c2=_0x5d588f[_0xd930('0x11')];var _0x3b548a=_0x48562d['get']({'plain':!![]});if(_0x3b548a[_0xd930('0x12')][_0xd930('0x13')]()==='in'||_0x3b548a[_0xd930('0x12')][_0xd930('0x13')]()===_0xd930('0x14')&&!_0x3b548a[_0xd930('0x15')]&&!_['isNil'](_0x3b548a[_0xd930('0x16')])){_0x1133c2[_0xd930('0x17')][_0xd930('0x18')]({'where':{'id':_0x3b548a['WhatsappInteractionId']}})[_0xd930('0x19')](function(_0x485951){if(_0x485951){_0x485951[_0xd930('0x1a')]({'lastMsgAt':_0x3b548a[_0xd930('0x1b')],'lastMsgDirection':_0x3b548a[_0xd930('0x12')]['toLowerCase']()});}})[_0xd930('0x1c')](function(_0x3d5c1f){console[_0xd930('0x1d')](_0x3d5c1f);});}if(_0x3b548a['direction']===_0xd930('0x14')&&!_0x3b548a[_0xd930('0x15')]){var _0x3b6294;_0x1133c2[_0xd930('0x1e')][_0xd930('0x1f')]({'where':{'id':_0x3b548a['WhatsappAccountId']},'raw':!![]})[_0xd930('0x19')](function(_0x39f31a){_0x3b6294=_0x39f31a;if(_0x3b6294&&_0x3b6294[_0xd930('0x20')]){switch(_0x3b6294[_0xd930('0x20')]){case _0xd930('0x21'):var _0x1aa8c1=require(_0xd930('0x21'));if(_0x3b6294[_0xd930('0x22')]&&_0x3b6294[_0xd930('0x23')]&&_0x3b6294['phone']){var _0x16d457=new _0x1aa8c1(_0x3b6294['accountSid'],_0x3b6294[_0xd930('0x23')]);_0x16d457[_0xd930('0x24')][_0xd930('0x25')]({'body':_0x3b548a[_0xd930('0x26')],'to':_0xd930('0x27')+_0x3b548a[_0xd930('0x28')],'from':_0xd930('0x27')+_0x3b6294[_0xd930('0x28')],'statusCallback':_0x3b6294[_0xd930('0x29')]+_0xd930('0x2a')+_0x3b548a['id']+_0xd930('0x2b')+_0x3b6294[_0xd930('0x2c')]})['then'](function(_0x5dc3fe){if(_0x5dc3fe[_0xd930('0x2d')]){return _0x48562d[_0xd930('0x1a')]({'messageId':_0x5dc3fe[_0xd930('0x2d')]});}})[_0xd930('0x1c')](function(_0xabb4fc){logger[_0xd930('0x1d')](_0xd930('0x2e'),_0xd930('0x2f'),_0xd930('0x21'),util[_0xd930('0x30')](_0xabb4fc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd930('0x2e'),_0xd930('0x2f'),_0xd930('0x21'),_0xd930('0x31'));}break;case'sinch':var _0x17228b=_0x3b6294[_0xd930('0x22')];var _0x3607cb=_0x3b6294[_0xd930('0x23')];var _0x117457=_0x3b6294[_0xd930('0x32')]+_0xd930('0x33')+_0x17228b+_0xd930('0x34');var _0x4deeae={'to':[_0x3b548a[_0xd930('0x28')]],'message':{'type':_0xd930('0x35'),'text':_0x3b548a[_0xd930('0x26')]}};var _0x26446a={'method':'POST','uri':_0x117457,'headers':{'Authorization':_0xd930('0x36')+_0x3607cb,'Content-Type':_0xd930('0x37')},'body':_0x4deeae,'json':!![]};rp(_0x26446a)[_0xd930('0x19')](function(_0x292092){if(_0x292092[_0xd930('0x38')][0x0][_0xd930('0x39')]){return _0x48562d[_0xd930('0x1a')]({'messageId':_0x292092['statuses'][0x0][_0xd930('0x39')]});}})[_0xd930('0x1c')](function(_0x5b3cb3){logger[_0xd930('0x3a')](_0xd930('0x3b'),_0x5b3cb3);});break;}}})['finally'](function(){_0x4db361();});}else{_0x4db361();}}},'charset':_0xd930('0x3c'),'collate':_0xd930('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bc7e546..f128903 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 _0x7a41=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then'];(function(_0xdbeb2e,_0x4f067a){var _0x1597cb=function(_0x58adc4){while(--_0x58adc4){_0xdbeb2e['push'](_0xdbeb2e['shift']());}};_0x1597cb(++_0x4f067a);}(_0x7a41,0x12f));var _0x17a4=function(_0x37c15b,_0x5ae92f){_0x37c15b=_0x37c15b-0x0;var _0x26efd2=_0x7a41[_0x37c15b];return _0x26efd2;};'use strict';var _=require('lodash');var util=require(_0x17a4('0x0'));var moment=require(_0x17a4('0x1'));var BPromise=require(_0x17a4('0x2'));var rs=require(_0x17a4('0x3'));var fs=require('fs');var Redis=require(_0x17a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x17a4('0x5'));var config=require(_0x17a4('0x6'));var jayson=require(_0x17a4('0x7'));var client=jayson[_0x17a4('0x8')][_0x17a4('0x9')]({'port':0x232a});config[_0x17a4('0xa')]=_[_0x17a4('0xb')](config[_0x17a4('0xa')],{'host':_0x17a4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17a4('0xa')]));require(_0x17a4('0xd'))[_0x17a4('0xe')](socket);function respondWithRpcPromise(_0x28ec18,_0x23c614,_0x2fc0d2){return new BPromise(function(_0x30d15e,_0x14324e){return client[_0x17a4('0xf')](_0x28ec18,_0x2fc0d2)[_0x17a4('0x10')](function(_0x24c3b8){logger[_0x17a4('0x11')](_0x17a4('0x12'),_0x23c614,_0x17a4('0x13'));logger[_0x17a4('0x14')](_0x17a4('0x15'),_0x23c614,_0x17a4('0x13'),JSON[_0x17a4('0x16')](_0x24c3b8));if(_0x24c3b8[_0x17a4('0x17')]){if(_0x24c3b8['error'][_0x17a4('0x18')]===0x1f4){logger[_0x17a4('0x17')](_0x17a4('0x12'),_0x23c614,_0x24c3b8['error'][_0x17a4('0x19')]);return _0x14324e(_0x24c3b8[_0x17a4('0x17')][_0x17a4('0x19')]);}logger['error'](_0x17a4('0x12'),_0x23c614,_0x24c3b8['error']['message']);return _0x30d15e(_0x24c3b8[_0x17a4('0x17')]['message']);}else{logger[_0x17a4('0x11')](_0x17a4('0x12'),_0x23c614,_0x17a4('0x13'));_0x30d15e(_0x24c3b8[_0x17a4('0x1a')]['message']);}})[_0x17a4('0x1b')](function(_0x139f48){logger[_0x17a4('0x17')](_0x17a4('0x12'),_0x23c614,_0x139f48);_0x14324e(_0x139f48);});});}exports[_0x17a4('0x1c')]=function(_0x3e0cd8){var _0x11d9ae=this;return new Promise(function(_0x50b882,_0x56452f){return db[_0x17a4('0x1d')]['create'](_0x3e0cd8['body'],{'raw':_0x3e0cd8[_0x17a4('0x1e')]?_0x3e0cd8[_0x17a4('0x1e')][_0x17a4('0x1f')]===undefined?!![]:![]:!![]})[_0x17a4('0x10')](function(_0x2a9876){logger[_0x17a4('0x11')](_0x17a4('0x1c'),_0x3e0cd8);logger[_0x17a4('0x14')](_0x17a4('0x1c'),_0x3e0cd8,JSON[_0x17a4('0x16')](_0x2a9876));_0x50b882(_0x2a9876);})[_0x17a4('0x1b')](function(_0x5df41f){logger['error']('CreateWhatsappMessage',_0x5df41f[_0x17a4('0x19')],_0x3e0cd8);_0x56452f(_0x11d9ae[_0x17a4('0x17')](0x1f4,_0x5df41f['message']));});});}; \ No newline at end of file +var _0x887c=['raw','then','catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappMessage.socket','register','request','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x5dcd65,_0x1b994d){var _0x323879=function(_0x41d5b6){while(--_0x41d5b6){_0x5dcd65['push'](_0x5dcd65['shift']());}};_0x323879(++_0x1b994d);}(_0x887c,0x1c3));var _0xc887=function(_0x27db33,_0x358b84){_0x27db33=_0x27db33-0x0;var _0x2baf30=_0x887c[_0x27db33];return _0x2baf30;};'use strict';var _=require(_0xc887('0x0'));var util=require(_0xc887('0x1'));var moment=require(_0xc887('0x2'));var BPromise=require(_0xc887('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc887('0x4'));var logger=require('../../config/logger')(_0xc887('0x5'));var config=require('../../config/environment');var jayson=require(_0xc887('0x6'));var client=jayson[_0xc887('0x7')][_0xc887('0x8')]({'port':0x232a});config['redis']=_[_0xc887('0x9')](config[_0xc887('0xa')],{'host':_0xc887('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc887('0xa')]));require(_0xc887('0xc'))[_0xc887('0xd')](socket);function respondWithRpcPromise(_0x341b76,_0x17f337,_0x4a4431){return new BPromise(function(_0x1c3a3e,_0x260159){return client[_0xc887('0xe')](_0x341b76,_0x4a4431)['then'](function(_0x566a24){logger[_0xc887('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x17f337,'request\x20sent');logger[_0xc887('0x10')](_0xc887('0x11'),_0x17f337,_0xc887('0x12'),JSON[_0xc887('0x13')](_0x566a24));if(_0x566a24[_0xc887('0x14')]){if(_0x566a24[_0xc887('0x14')][_0xc887('0x15')]===0x1f4){logger[_0xc887('0x14')](_0xc887('0x16'),_0x17f337,_0x566a24['error'][_0xc887('0x17')]);return _0x260159(_0x566a24['error'][_0xc887('0x17')]);}logger[_0xc887('0x14')](_0xc887('0x16'),_0x17f337,_0x566a24[_0xc887('0x14')][_0xc887('0x17')]);return _0x1c3a3e(_0x566a24[_0xc887('0x14')][_0xc887('0x17')]);}else{logger[_0xc887('0xf')](_0xc887('0x16'),_0x17f337,_0xc887('0x12'));_0x1c3a3e(_0x566a24['result'][_0xc887('0x17')]);}})['catch'](function(_0x3815d6){logger[_0xc887('0x14')](_0xc887('0x16'),_0x17f337,_0x3815d6);_0x260159(_0x3815d6);});});}exports[_0xc887('0x18')]=function(_0x1d38c6){var _0x1dfef2=this;return new Promise(function(_0x4e689d,_0x454061){return db[_0xc887('0x19')][_0xc887('0x1a')](_0x1d38c6[_0xc887('0x1b')],{'raw':_0x1d38c6[_0xc887('0x1c')]?_0x1d38c6['options'][_0xc887('0x1d')]===undefined?!![]:![]:!![]})[_0xc887('0x1e')](function(_0x1e935d){logger[_0xc887('0xf')](_0xc887('0x18'),_0x1d38c6);logger['debug'](_0xc887('0x18'),_0x1d38c6,JSON['stringify'](_0x1e935d));_0x4e689d(_0x1e935d);})[_0xc887('0x1f')](function(_0x503f60){logger[_0xc887('0x14')]('CreateWhatsappMessage',_0x503f60[_0xc887('0x17')],_0x1d38c6);_0x454061(_0x1dfef2['error'](0x1f4,_0x503f60[_0xc887('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e5847f9..f2dc7a3 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 _0x38ab=['length','./whatsappMessage.events','save','remove','update','emit','register'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x38ab,0x19e));var _0xb38a=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x38ab[_0x30cd7e];return _0x462a02;};'use strict';var WhatsappMessageEvents=require(_0xb38a('0x0'));var events=[_0xb38a('0x1'),_0xb38a('0x2'),_0xb38a('0x3')];function createListener(_0x3db9a4,_0x12f3f7){return function(_0x52d52b){_0x12f3f7[_0xb38a('0x4')](_0x3db9a4,_0x52d52b);};}function removeListener(_0x2bbc3a,_0x52e9c2){return function(){WhatsappMessageEvents['removeListener'](_0x2bbc3a,_0x52e9c2);};}exports[_0xb38a('0x5')]=function(_0x363fb3){for(var _0x5e9575=0x0,_0x33b26e=events[_0xb38a('0x6')];_0x5e9575<_0x33b26e;_0x5e9575++){var _0x569b73=events[_0x5e9575];var _0x2ab230=createListener('whatsappMessage:'+_0x569b73,_0x363fb3);WhatsappMessageEvents['on'](_0x569b73,_0x2ab230);}}; \ No newline at end of file +var _0xf8a7=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener','register','length'];(function(_0x3ade4e,_0x423b99){var _0x272499=function(_0x23e8ca){while(--_0x23e8ca){_0x3ade4e['push'](_0x3ade4e['shift']());}};_0x272499(++_0x423b99);}(_0xf8a7,0x81));var _0x7f8a=function(_0x1fd94c,_0x587b47){_0x1fd94c=_0x1fd94c-0x0;var _0x6756b0=_0xf8a7[_0x1fd94c];return _0x6756b0;};'use strict';var WhatsappMessageEvents=require(_0x7f8a('0x0'));var events=[_0x7f8a('0x1'),'remove',_0x7f8a('0x2')];function createListener(_0x32c038,_0x592876){return function(_0x4f55a0){_0x592876[_0x7f8a('0x3')](_0x32c038,_0x4f55a0);};}function removeListener(_0xe346e9,_0x1d3698){return function(){WhatsappMessageEvents[_0x7f8a('0x4')](_0xe346e9,_0x1d3698);};}exports[_0x7f8a('0x5')]=function(_0x1f1bf3){for(var _0x31c052=0x0,_0x1ab14c=events[_0x7f8a('0x6')];_0x31c052<_0x1ab14c;_0x31c052++){var _0x5b98ca=events[_0x31c052];var _0xa32bc0=createListener(_0x7f8a('0x7')+_0x5b98ca,_0x1f1bf3);WhatsappMessageEvents['on'](_0x5b98ca,_0xa32bc0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 764da38..3df234a 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 _0x92f3=['../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x92f3,0x1c9));var _0x392f=function(_0x40e5e9,_0x24f21d){_0x40e5e9=_0x40e5e9-0x0;var _0x49de8c=_0x92f3[_0x40e5e9];return _0x49de8c;};'use strict';var multer=require(_0x392f('0x0'));var util=require(_0x392f('0x1'));var path=require(_0x392f('0x2'));var timeout=require(_0x392f('0x3'));var express=require(_0x392f('0x4'));var router=express['Router']();var fs_extra=require(_0x392f('0x5'));var auth=require(_0x392f('0x6'));var interaction=require(_0x392f('0x7'));var config=require('../../config/environment');var controller=require(_0x392f('0x8'));router[_0x392f('0x9')]('/',auth['isAuthenticated'](),controller[_0x392f('0xa')]);router['get'](_0x392f('0xb'),auth['isAuthenticated'](),controller[_0x392f('0xc')]);router[_0x392f('0x9')](_0x392f('0xd'),auth[_0x392f('0xe')](),controller[_0x392f('0xf')]);router['get'](_0x392f('0x10'),auth[_0x392f('0xe')](),controller[_0x392f('0x11')]);router[_0x392f('0x9')](_0x392f('0x12'),auth[_0x392f('0xe')](),controller[_0x392f('0x13')]);router[_0x392f('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x392f('0x14')]);router[_0x392f('0x15')]('/',auth[_0x392f('0xe')](),controller[_0x392f('0x16')]);router['post'](_0x392f('0x12'),auth[_0x392f('0xe')](),controller['addTeams']);router[_0x392f('0x15')](_0x392f('0x17'),auth['isAuthenticated'](),controller[_0x392f('0x18')]);router[_0x392f('0x19')](_0x392f('0xd'),auth[_0x392f('0xe')](),controller[_0x392f('0x1a')]);router['delete']('/:id',auth[_0x392f('0xe')](),controller['destroy']);router[_0x392f('0x1b')](_0x392f('0x12'),auth[_0x392f('0xe')](),controller[_0x392f('0x1c')]);router[_0x392f('0x1b')](_0x392f('0x17'),auth[_0x392f('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x736c=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','describe','get','/:id','isAuthenticated','show'];(function(_0x3a556e,_0x32191b){var _0xfe3a36=function(_0x9b32a3){while(--_0x9b32a3){_0x3a556e['push'](_0x3a556e['shift']());}};_0xfe3a36(++_0x32191b);}(_0x736c,0x190));var _0xc736=function(_0x2ec4d3,_0x544043){_0x2ec4d3=_0x2ec4d3-0x0;var _0x4caf0b=_0x736c[_0x2ec4d3];return _0x4caf0b;};'use strict';var multer=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var path=require('path');var timeout=require(_0xc736('0x2'));var express=require(_0xc736('0x3'));var router=express[_0xc736('0x4')]();var fs_extra=require(_0xc736('0x5'));var auth=require(_0xc736('0x6'));var interaction=require(_0xc736('0x7'));var config=require(_0xc736('0x8'));var controller=require(_0xc736('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc736('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc736('0xb')]);router[_0xc736('0xc')](_0xc736('0xd'),auth[_0xc736('0xe')](),controller[_0xc736('0xf')]);router[_0xc736('0xc')](_0xc736('0x10'),auth['isAuthenticated'](),controller[_0xc736('0x11')]);router[_0xc736('0xc')](_0xc736('0x12'),auth[_0xc736('0xe')](),controller[_0xc736('0x13')]);router[_0xc736('0xc')](_0xc736('0x14'),auth[_0xc736('0xe')](),controller[_0xc736('0x15')]);router[_0xc736('0x16')]('/',auth['isAuthenticated'](),controller[_0xc736('0x17')]);router[_0xc736('0x16')](_0xc736('0x12'),auth[_0xc736('0xe')](),controller[_0xc736('0x18')]);router[_0xc736('0x16')](_0xc736('0x14'),auth['isAuthenticated'](),controller[_0xc736('0x19')]);router[_0xc736('0x1a')](_0xc736('0xd'),auth[_0xc736('0xe')](),controller[_0xc736('0x1b')]);router[_0xc736('0x1c')](_0xc736('0xd'),auth[_0xc736('0xe')](),controller[_0xc736('0x1d')]);router[_0xc736('0x1c')](_0xc736('0x12'),auth[_0xc736('0xe')](),controller[_0xc736('0x1e')]);router['delete']('/:id/users',auth[_0xc736('0xe')](),controller[_0xc736('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 34e5bb9..cb7c977 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 _0x7b05=['STRING','name','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x5945fa,_0x5b286c){var _0x367090=function(_0x4cadd1){while(--_0x4cadd1){_0x5945fa['push'](_0x5945fa['shift']());}};_0x367090(++_0x5b286c);}(_0x7b05,0x91));var _0x57b0=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x7b05[_0x1deee5];return _0x1d6c3a;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'name':{'type':Sequelize[_0x57b0('0x2')],'unique':_0x57b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57b0('0x4')]('rrmemory',_0x57b0('0x5'),_0x57b0('0x6'))},'description':{'type':Sequelize[_0x57b0('0x2')]}}; \ No newline at end of file +var _0x19ea=['name','ENUM','rrmemory','beepall','sequelize'];(function(_0x23273b,_0x2d0666){var _0x23ca49=function(_0x162a08){while(--_0x162a08){_0x23273b['push'](_0x23273b['shift']());}};_0x23ca49(++_0x2d0666);}(_0x19ea,0xfe));var _0xa19e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x19ea[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa19e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa19e('0x2')](_0xa19e('0x3'),_0xa19e('0x4'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 64d894a..c367ef9 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 _0x44ef=['getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','findAll','User','UserId','agent','updatedAt','format','SIP','whatsappPause','createdAt'];(function(_0x411dc3,_0x447538){var _0x3265f2=function(_0x3ecb17){while(--_0x3ecb17){_0x411dc3['push'](_0x411dc3['shift']());}};_0x3265f2(++_0x447538);}(_0x44ef,0xbc));var _0xf44e=function(_0x140c76,_0x586b1c){_0x140c76=_0x140c76-0x0;var _0x3b30c7=_0x44ef[_0x140c76];return _0x3b30c7;};'use strict';var emlformat=require(_0xf44e('0x0'));var rimraf=require(_0xf44e('0x1'));var zipdir=require(_0xf44e('0x2'));var jsonpatch=require(_0xf44e('0x3'));var rp=require(_0xf44e('0x4'));var moment=require(_0xf44e('0x5'));var BPromise=require(_0xf44e('0x6'));var Mustache=require(_0xf44e('0x7'));var util=require(_0xf44e('0x8'));var path=require(_0xf44e('0x9'));var sox=require('sox');var csv=require(_0xf44e('0xa'));var ejs=require(_0xf44e('0xb'));var fs=require('fs');var fs_extra=require(_0xf44e('0xc'));var _=require(_0xf44e('0xd'));var squel=require(_0xf44e('0xe'));var crypto=require(_0xf44e('0xf'));var jsforce=require(_0xf44e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf44e('0xa'));var querystring=require(_0xf44e('0x11'));var Papa=require(_0xf44e('0x12'));var Redis=require(_0xf44e('0x13'));var authService=require(_0xf44e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf44e('0x15'));var hardwareService=require(_0xf44e('0x16'));var logger=require('../../config/logger')(_0xf44e('0x17'));var utils=require(_0xf44e('0x18'));var config=require(_0xf44e('0x19'));var licenseUtil=require(_0xf44e('0x1a'));var db=require(_0xf44e('0x1b'))['db'];config[_0xf44e('0x1c')]=_[_0xf44e('0x1d')](config[_0xf44e('0x1c')],{'host':_0xf44e('0x1e'),'port':0x18eb});var socket=require(_0xf44e('0x1f'))(new Redis(config['redis']));require(_0xf44e('0x20'))[_0xf44e('0x21')](socket);function respondWithStatusCode(_0x10df05,_0x4f396e){_0x4f396e=_0x4f396e||0xcc;return function(_0x5d4d45){if(_0x5d4d45){return _0x10df05[_0xf44e('0x22')](_0x4f396e);}return _0x10df05['status'](_0x4f396e)[_0xf44e('0x23')]();};}function respondWithResult(_0x4e82f7,_0x374178){_0x374178=_0x374178||0xc8;return function(_0x26765d){if(_0x26765d){return _0x4e82f7[_0xf44e('0x24')](_0x374178)[_0xf44e('0x25')](_0x26765d);}};}function respondWithFilteredResult(_0x1e5558,_0x4bab1e){return function(_0x19db67){if(_0x19db67){var _0x536775=typeof _0x4bab1e[_0xf44e('0x26')]===_0xf44e('0x27')&&typeof _0x4bab1e['limit']===_0xf44e('0x27');var _0x5a93f7=_0x19db67[_0xf44e('0x28')];var _0x3a6d99=_0x536775?0x0:_0x4bab1e[_0xf44e('0x26')];var _0x4e58cd=_0x536775?_0x19db67[_0xf44e('0x28')]:_0x4bab1e[_0xf44e('0x26')]+_0x4bab1e[_0xf44e('0x29')];var _0x937066;if(_0x4e58cd>=_0x5a93f7){_0x4e58cd=_0x5a93f7;_0x937066=0xc8;}else{_0x937066=0xce;}_0x1e5558[_0xf44e('0x24')](_0x937066);return _0x1e5558[_0xf44e('0x2a')](_0xf44e('0x2b'),_0x3a6d99+'-'+_0x4e58cd+'/'+_0x5a93f7)[_0xf44e('0x25')](_0x19db67);}return null;};}function patchUpdates(_0xc0dd13){return function(_0x4fcbd5){try{jsonpatch['apply'](_0x4fcbd5,_0xc0dd13,!![]);}catch(_0x509696){return BPromise[_0xf44e('0x2c')](_0x509696);}return _0x4fcbd5[_0xf44e('0x2d')]();};}function saveUpdates(_0x2fbc6b,_0x520715){return function(_0x2a6f6d){if(_0x2a6f6d){return _0x2a6f6d[_0xf44e('0x2e')](_0x2fbc6b)[_0xf44e('0x2f')](function(_0x5b5299){return _0x5b5299;});}return null;};}function removeEntity(_0x2b7e57,_0x3cd410){return function(_0x4e367d){if(_0x4e367d){return _0x4e367d[_0xf44e('0x30')]()['then'](function(){var _0x45fb5a=_0x4e367d['get']({'plain':!![]});var _0x2eaf86=_0xf44e('0x31');return db[_0xf44e('0x32')]['destroy']({'where':{'type':_0x2eaf86,'resourceId':_0x45fb5a['id']}})[_0xf44e('0x2f')](function(){return _0x4e367d;});})[_0xf44e('0x2f')](function(){_0x2b7e57['status'](0xcc)[_0xf44e('0x23')]();});}};}function handleEntityNotFound(_0x523cf8,_0x565d93){return function(_0x5ba39a){if(!_0x5ba39a){_0x523cf8[_0xf44e('0x22')](0x194);}return _0x5ba39a;};}function handleError(_0x3aa84c,_0x3aa79a){_0x3aa79a=_0x3aa79a||0x1f4;return function(_0x1330fa){logger['error'](_0x1330fa['stack']);if(_0x1330fa[_0xf44e('0x33')]){delete _0x1330fa[_0xf44e('0x33')];}_0x3aa84c[_0xf44e('0x24')](_0x3aa79a)[_0xf44e('0x34')](_0x1330fa);};}exports[_0xf44e('0x35')]=function(_0x33620c,_0x4e59b1){var _0x5db1bd={},_0x3a70d3={},_0x303327={'count':0x0,'rows':[]};var _0xb43a95=_[_0xf44e('0x36')](db[_0xf44e('0x37')][_0xf44e('0x38')],function(_0x5990e5){return{'name':_0x5990e5[_0xf44e('0x39')],'type':_0x5990e5[_0xf44e('0x3a')][_0xf44e('0x3b')]};});_0x3a70d3[_0xf44e('0x3c')]=_['map'](_0xb43a95,'name');_0x3a70d3[_0xf44e('0x3d')]=_[_0xf44e('0x3e')](_0x33620c['query']);_0x3a70d3['filters']=_[_0xf44e('0x3f')](_0x3a70d3[_0xf44e('0x3c')],_0x3a70d3[_0xf44e('0x3d')]);_0x5db1bd[_0xf44e('0x40')]=_[_0xf44e('0x3f')](_0x3a70d3[_0xf44e('0x3c')],qs[_0xf44e('0x41')](_0x33620c[_0xf44e('0x3d')]['fields']));_0x5db1bd[_0xf44e('0x40')]=_0x5db1bd[_0xf44e('0x40')][_0xf44e('0x42')]?_0x5db1bd[_0xf44e('0x40')]:_0x3a70d3[_0xf44e('0x3c')];if(!_0x33620c[_0xf44e('0x3d')][_0xf44e('0x43')](_0xf44e('0x44'))){_0x5db1bd[_0xf44e('0x29')]=qs['limit'](_0x33620c[_0xf44e('0x3d')][_0xf44e('0x29')]);_0x5db1bd[_0xf44e('0x26')]=qs[_0xf44e('0x26')](_0x33620c[_0xf44e('0x3d')][_0xf44e('0x26')]);}_0x5db1bd[_0xf44e('0x45')]=qs[_0xf44e('0x46')](_0x33620c['query'][_0xf44e('0x46')]);_0x5db1bd['where']=qs[_0xf44e('0x47')](_[_0xf44e('0x48')](_0x33620c[_0xf44e('0x3d')],_0x3a70d3[_0xf44e('0x47')]),_0xb43a95);if(_0x33620c[_0xf44e('0x3d')]['filter']){_0x5db1bd[_0xf44e('0x49')]=_[_0xf44e('0x4a')](_0x5db1bd[_0xf44e('0x49')],{'$or':_['map'](_0xb43a95,function(_0x16adf4){if(_0x16adf4['type']!=='VIRTUAL'){var _0x40bbc0={};_0x40bbc0[_0x16adf4['name']]={'$like':'%'+_0x33620c[_0xf44e('0x3d')][_0xf44e('0x4b')]+'%'};return _0x40bbc0;}})});}_0x5db1bd=_[_0xf44e('0x4a')]({},_0x5db1bd,_0x33620c[_0xf44e('0x4c')]);var _0x633a60={'where':_0x5db1bd['where']};return db[_0xf44e('0x37')][_0xf44e('0x28')](_0x633a60)[_0xf44e('0x2f')](function(_0x3165f1){_0x303327[_0xf44e('0x28')]=_0x3165f1;if(_0x33620c['query']['includeAll']){_0x5db1bd['include']=[{'all':!![]}];}return db[_0xf44e('0x37')]['findAll'](_0x5db1bd);})['then'](function(_0x43d5cf){_0x303327[_0xf44e('0x4d')]=_0x43d5cf;return _0x303327;})['then'](respondWithFilteredResult(_0x4e59b1,_0x5db1bd))[_0xf44e('0x4e')](handleError(_0x4e59b1,null));};exports[_0xf44e('0x4f')]=function(_0x2f96f9,_0x456c0b){var _0x5f27b4={'raw':!![],'where':{'id':_0x2f96f9[_0xf44e('0x50')]['id']}},_0x34aac9={};_0x34aac9[_0xf44e('0x3c')]=_['keys'](db[_0xf44e('0x37')]['rawAttributes']);_0x34aac9['query']=_[_0xf44e('0x3e')](_0x2f96f9[_0xf44e('0x3d')]);_0x34aac9[_0xf44e('0x47')]=_[_0xf44e('0x3f')](_0x34aac9[_0xf44e('0x3c')],_0x34aac9[_0xf44e('0x3d')]);_0x5f27b4[_0xf44e('0x40')]=_[_0xf44e('0x3f')](_0x34aac9['model'],qs[_0xf44e('0x41')](_0x2f96f9[_0xf44e('0x3d')][_0xf44e('0x41')]));_0x5f27b4[_0xf44e('0x40')]=_0x5f27b4[_0xf44e('0x40')][_0xf44e('0x42')]?_0x5f27b4[_0xf44e('0x40')]:_0x34aac9[_0xf44e('0x3c')];if(_0x2f96f9[_0xf44e('0x3d')]['includeAll']){_0x5f27b4['include']=[{'all':!![]}];}_0x5f27b4=_[_0xf44e('0x4a')]({},_0x5f27b4,_0x2f96f9[_0xf44e('0x4c')]);return db[_0xf44e('0x37')][_0xf44e('0x51')](_0x5f27b4)['then'](handleEntityNotFound(_0x456c0b,null))['then'](respondWithResult(_0x456c0b,null))['catch'](handleError(_0x456c0b,null));};exports[_0xf44e('0x52')]=function(_0x345835,_0x3e3806){return db[_0xf44e('0x37')][_0xf44e('0x52')](_0x345835[_0xf44e('0x53')],{})[_0xf44e('0x2f')](function(_0x24f93c){var _0x40bcaf=_0x345835['user']['get']({'plain':!![]});if(!_0x40bcaf)throw new Error(_0xf44e('0x54'));if(_0x40bcaf[_0xf44e('0x55')]===_0xf44e('0x56')){var _0x146df4=_0x24f93c[_0xf44e('0x57')]({'plain':!![]});var _0x47b51a=_0xf44e('0x31');return db[_0xf44e('0x58')][_0xf44e('0x51')]({'where':{'name':_0x47b51a,'userProfileId':_0x40bcaf[_0xf44e('0x59')]},'raw':!![]})[_0xf44e('0x2f')](function(_0x5ac8c6){if(_0x5ac8c6&&_0x5ac8c6[_0xf44e('0x5a')]===0x0){return db[_0xf44e('0x32')][_0xf44e('0x52')]({'name':_0x146df4[_0xf44e('0x33')],'resourceId':_0x146df4['id'],'type':_0x5ac8c6[_0xf44e('0x33')],'sectionId':_0x5ac8c6['id']},{})[_0xf44e('0x2f')](function(){return _0x24f93c;});}else{return _0x24f93c;}})[_0xf44e('0x4e')](function(_0x194909){logger['error'](_0xf44e('0x5b'),_0x194909);throw _0x194909;});}return _0x24f93c;})['then'](respondWithResult(_0x3e3806,0xc9))['catch'](handleError(_0x3e3806,null));};exports[_0xf44e('0x2e')]=function(_0x5cd456,_0x22bd47){if(_0x5cd456[_0xf44e('0x53')]['id']){delete _0x5cd456[_0xf44e('0x53')]['id'];}return db[_0xf44e('0x37')]['find']({'where':{'id':_0x5cd456[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x22bd47,null))[_0xf44e('0x2f')](saveUpdates(_0x5cd456[_0xf44e('0x53')],null))[_0xf44e('0x2f')](respondWithResult(_0x22bd47,null))[_0xf44e('0x4e')](handleError(_0x22bd47,null));};exports[_0xf44e('0x30')]=function(_0x239128,_0x20a9aa){return db[_0xf44e('0x37')]['find']({'where':{'id':_0x239128['params']['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x20a9aa,null))[_0xf44e('0x2f')](removeEntity(_0x20a9aa,null))[_0xf44e('0x4e')](handleError(_0x20a9aa,null));};exports[_0xf44e('0x5c')]=function(_0x29981a,_0x2d2ad3){return db[_0xf44e('0x37')][_0xf44e('0x5c')]()[_0xf44e('0x2f')](respondWithResult(_0x2d2ad3,null))['catch'](handleError(_0x2d2ad3,null));};exports[_0xf44e('0x5d')]=function(_0x7be0b1,_0x1f629c,_0x2c9bf5){var _0x43cc64={'raw':!![],'where':{}},_0x220ee1={},_0xa24af3;return db[_0xf44e('0x37')]['findOne']({'where':{'id':_0x7be0b1[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x1f629c,null))[_0xf44e('0x2f')](function(_0x3d2e62){if(_0x3d2e62){_0xa24af3=_0x3d2e62[_0xf44e('0x57')]({'plain':!![]});_0x220ee1[_0xf44e('0x3c')]=_[_0xf44e('0x3e')](db[_0xf44e('0x5e')]['rawAttributes']);_0x220ee1[_0xf44e('0x3d')]=_[_0xf44e('0x3e')](_0x7be0b1[_0xf44e('0x3d')]);_0x220ee1[_0xf44e('0x47')]=_[_0xf44e('0x3f')](_0x220ee1[_0xf44e('0x3c')],_0x220ee1[_0xf44e('0x3d')]);_0x43cc64[_0xf44e('0x40')]=_[_0xf44e('0x3f')](_0x220ee1['model'],qs[_0xf44e('0x41')](_0x7be0b1['query']['fields']));_0x43cc64[_0xf44e('0x40')]=_0x43cc64[_0xf44e('0x40')][_0xf44e('0x42')]?_0x43cc64[_0xf44e('0x40')]:_0x220ee1[_0xf44e('0x3c')];if(!_0x7be0b1['query'][_0xf44e('0x43')](_0xf44e('0x44'))){_0x43cc64[_0xf44e('0x29')]=qs[_0xf44e('0x29')](_0x7be0b1[_0xf44e('0x3d')][_0xf44e('0x29')]);_0x43cc64[_0xf44e('0x26')]=qs[_0xf44e('0x26')](_0x7be0b1[_0xf44e('0x3d')]['offset']);}_0x43cc64[_0xf44e('0x45')]=qs['sort'](_0x7be0b1[_0xf44e('0x3d')]['sort']);_0x43cc64[_0xf44e('0x49')]=qs[_0xf44e('0x47')](_[_0xf44e('0x48')](_0x7be0b1[_0xf44e('0x3d')],_0x220ee1['filters']));_0x43cc64[_0xf44e('0x49')]['WhatsappQueueId']=_0x3d2e62['id'];if(_0x7be0b1['query']['filter']){_0x43cc64[_0xf44e('0x49')]=_['merge'](_0x43cc64[_0xf44e('0x49')],{'$or':_[_0xf44e('0x36')](_0x43cc64[_0xf44e('0x40')],function(_0x4bca70){var _0x420e15={};_0x420e15[_0x4bca70]={'$like':'%'+_0x7be0b1[_0xf44e('0x3d')]['filter']+'%'};return _0x420e15;})});}_0x43cc64=_[_0xf44e('0x4a')]({},_0x43cc64,_0x7be0b1[_0xf44e('0x4c')]);return db[_0xf44e('0x5e')][_0xf44e('0x5f')](_0x43cc64);}})[_0xf44e('0x2f')](function(_0x48cf1f){if(_0x48cf1f){return db[_0xf44e('0x60')]['findAndCountAll']({'where':{'id':_['map'](_0x48cf1f,_0xf44e('0x61')),'role':_0xf44e('0x62')},'attributes':['id',_0xf44e('0x33'),'whatsappPause',_0xf44e('0x63'),'createdAt']});}})['then'](function(_0x2dee35){if(_0x2dee35){return{'count':_0x2dee35[_0xf44e('0x28')],'rows':_[_0xf44e('0x36')](_0x2dee35[_0xf44e('0x4d')],function(_0x1618b9){return{'membername':_0x1618b9[_0xf44e('0x33')],'UserId':_0x1618b9['id'],'queue_name':_0xa24af3[_0xf44e('0x33')],'WhatsappQueueId':_0xa24af3['id'],'interface':util[_0xf44e('0x64')]('%s/%s',_0xf44e('0x65'),_0x1618b9[_0xf44e('0x33')]),'penalty':0x0,'paused':_0x1618b9[_0xf44e('0x66')],'createdAt':_0x1618b9[_0xf44e('0x67')],'updatedAt':_0x1618b9[_0xf44e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f629c,_0x43cc64))['catch'](handleError(_0x1f629c,null));};exports[_0xf44e('0x68')]=function(_0x4390c2,_0x360ffa,_0x38dabc){var _0x272635={};var _0x3c2b27={};var _0x2a2d12;var _0x6fffce;return db[_0xf44e('0x37')][_0xf44e('0x69')]({'where':{'id':_0x4390c2[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x360ffa,null))[_0xf44e('0x2f')](function(_0x2b4700){if(_0x2b4700){_0x2a2d12=_0x2b4700;_0x3c2b27['model']=_['keys'](db[_0xf44e('0x6a')][_0xf44e('0x38')]);_0x3c2b27[_0xf44e('0x3d')]=_['keys'](_0x4390c2[_0xf44e('0x3d')]);_0x3c2b27[_0xf44e('0x47')]=_[_0xf44e('0x3f')](_0x3c2b27['model'],_0x3c2b27[_0xf44e('0x3d')]);_0x272635[_0xf44e('0x40')]=_[_0xf44e('0x3f')](_0x3c2b27[_0xf44e('0x3c')],qs[_0xf44e('0x41')](_0x4390c2['query'][_0xf44e('0x41')]));_0x272635[_0xf44e('0x40')]=_0x272635[_0xf44e('0x40')][_0xf44e('0x42')]?_0x272635[_0xf44e('0x40')]:_0x3c2b27[_0xf44e('0x3c')];_0x272635['order']=qs[_0xf44e('0x46')](_0x4390c2[_0xf44e('0x3d')][_0xf44e('0x46')]);_0x272635[_0xf44e('0x49')]=qs[_0xf44e('0x47')](_[_0xf44e('0x48')](_0x4390c2[_0xf44e('0x3d')],_0x3c2b27[_0xf44e('0x47')]));if(_0x4390c2['query']['filter']){_0x272635[_0xf44e('0x49')]=_[_0xf44e('0x4a')](_0x272635['where'],{'$or':_['map'](_0x272635[_0xf44e('0x40')],function(_0x175925){var _0x11a49d={};_0x11a49d[_0x175925]={'$like':'%'+_0x4390c2[_0xf44e('0x3d')][_0xf44e('0x4b')]+'%'};return _0x11a49d;})});}_0x272635=_[_0xf44e('0x4a')]({},_0x272635,_0x4390c2[_0xf44e('0x4c')]);return _0x2a2d12[_0xf44e('0x68')](_0x272635);}})[_0xf44e('0x2f')](function(_0xebd03b){if(_0xebd03b){_0x6fffce=_0xebd03b[_0xf44e('0x42')];if(!_0x4390c2['query'][_0xf44e('0x43')](_0xf44e('0x44'))){_0x272635[_0xf44e('0x29')]=qs[_0xf44e('0x29')](_0x4390c2[_0xf44e('0x3d')]['limit']);_0x272635[_0xf44e('0x26')]=qs[_0xf44e('0x26')](_0x4390c2['query'][_0xf44e('0x26')]);}return _0x2a2d12['getTeams'](_0x272635);}})[_0xf44e('0x2f')](function(_0x344cb7){if(_0x344cb7){return _0x344cb7?{'count':_0x6fffce,'rows':_0x344cb7}:null;}})['then'](respondWithResult(_0x360ffa,null))[_0xf44e('0x4e')](handleError(_0x360ffa,null));};exports[_0xf44e('0x6b')]=function(_0x544a43,_0x2e5120,_0x1acada){var _0x2c63af=_0x544a43[_0xf44e('0x53')][_0xf44e('0x6c')];return db[_0xf44e('0x6a')][_0xf44e('0x5f')]({'where':{'id':_0x2c63af},'attributes':['id'],'include':[{'model':db[_0xf44e('0x60')],'as':_0xf44e('0x6d'),'attributes':['id',_0xf44e('0x33'),_0xf44e('0x6e'),_0xf44e('0x6f'),_0xf44e('0x70')],'raw':!![]}]})[_0xf44e('0x2f')](function(_0x4ddc2e){if(_0x4ddc2e){var _0x2aae43=_[_0xf44e('0x71')](_0x4ddc2e,function(_0x335727){var _0x50d33a=_0x335727[_0xf44e('0x57')]({'plain':!![]});return _0x50d33a[_0xf44e('0x6d')];});return db[_0xf44e('0x37')][_0xf44e('0x51')]({'where':{'id':_0x544a43[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](function(_0xf8a1f3){return db[_0xf44e('0x72')][_0xf44e('0x73')](function(_0x50c190){return _0xf8a1f3[_0xf44e('0x6b')](_0x2c63af,{'transaction':_0x50c190})[_0xf44e('0x2f')](function(){return BPromise['each'](_0x2aae43,function(_0x2341a3){return db[_0xf44e('0x5e')][_0xf44e('0x74')]({'where':{'UserId':_0x2341a3['id'],'WhatsappQueueId':_0x544a43[_0xf44e('0x50')]['id']},'transaction':_0x50c190});});})[_0xf44e('0x2f')](function(){_0x2aae43[_0xf44e('0x75')](function(_0x412223){socket['emit'](_0xf44e('0x76'),{'UserId':_0x412223['id'],'WhatsappQueueId':_0xf8a1f3['id']});});});});});}})[_0xf44e('0x2f')](respondWithStatusCode(_0x2e5120,null))['catch'](handleError(_0x2e5120,null));};exports[_0xf44e('0x77')]=function(_0x8fcbe8,_0x5988d1,_0x70457c){return db[_0xf44e('0x6a')]['findAll']({'where':{'id':_0x8fcbe8[_0xf44e('0x3d')][_0xf44e('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xf44e('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf44e('0x2f')](handleEntityNotFound(_0x5988d1,null))['then'](function(_0x345711){var _0x39cd70=_[_0xf44e('0x36')](_0x345711,'id');var _0x3b0372=[];var _0x3eae02=[];var _0x23f622=squel['select']();_0x23f622[_0xf44e('0x78')](_0xf44e('0x79'))['from']('team_has_whatsapp_queues','tq')['join'](_0xf44e('0x7a'),'ut',_0xf44e('0x7b'))['where'](_0xf44e('0x7c'),_0x8fcbe8[_0xf44e('0x50')]['id']);for(var _0xb00a5b=0x0;_0xb00a5b<_0x345711[_0xf44e('0x42')];_0xb00a5b+=0x1){let _0x372fc0=_0x345711[_0xb00a5b];for(var _0x1c4d56=0x0;_0x1c4d56<_0x372fc0[_0xf44e('0x6d')]['length'];_0x1c4d56+=0x1){let _0xd3ab86=_0x372fc0[_0xf44e('0x6d')][_0x1c4d56];var _0xeef7fd=_0x23f622[_0xf44e('0x7d')]();_0xeef7fd[_0xf44e('0x49')](_0xf44e('0x7e'),_0xd3ab86['id']);_0x3eae02[_0xf44e('0x7f')](db[_0xf44e('0x72')]['query'](_0xeef7fd[_0xf44e('0x80')](),{'type':db[_0xf44e('0x72')][_0xf44e('0x81')][_0xf44e('0x82')]})[_0xf44e('0x2f')](function(_0x35140f){if(_0x35140f['length']===0x1){return _0xd3ab86['id'];}else{var _0x4ab0db=_[_0xf44e('0x83')](_[_0xf44e('0x36')](_0x35140f,_0xf44e('0x84')),function(_0x4c9a0d){return _[_0xf44e('0x85')](_0x39cd70,_0x4c9a0d);});if(_0x4ab0db){return _0xd3ab86['id'];}}}));}}return BPromise[_0xf44e('0x86')](_0x3eae02)['then'](function(_0x4e20bf){_0x3b0372=_(_0x3b0372)[_0xf44e('0x87')](_0x4e20bf)[_0xf44e('0x88')]()['value']();return db[_0xf44e('0x37')][_0xf44e('0x51')]({'where':{'id':_0x8fcbe8['params']['id']}})[_0xf44e('0x2f')](function(_0x59f1b2){return db['sequelize'][_0xf44e('0x73')](function(_0x4ed464){return _0x59f1b2[_0xf44e('0x77')](_0x8fcbe8[_0xf44e('0x3d')]['ids'],{'transaction':_0x4ed464})['then'](function(){if(!_[_0xf44e('0x89')](_0x3b0372)){return _0x59f1b2[_0xf44e('0x8a')](_0x3b0372,{'transaction':_0x4ed464});}})[_0xf44e('0x2f')](function(){_0x3b0372[_0xf44e('0x75')](function(_0x4a2d4c){socket[_0xf44e('0x8b')](_0xf44e('0x8c'),{'UserId':_0x4a2d4c,'WhatsappQueueId':_0x59f1b2['id']});});});});});});})[_0xf44e('0x2f')](respondWithStatusCode(_0x5988d1,null))['catch'](handleError(_0x5988d1,null));};exports[_0xf44e('0x8d')]=function(_0xa3d2ba,_0x7d9dc,_0x360a83){return db['WhatsappQueue'][_0xf44e('0x51')]({'where':{'id':_0xa3d2ba[_0xf44e('0x50')]['id']}})['then'](handleEntityNotFound(_0x7d9dc,null))[_0xf44e('0x2f')](function(_0x51b95b){if(_0x51b95b){return _0x51b95b[_0xf44e('0x8d')](_0xa3d2ba['body'][_0xf44e('0x6c')],_[_0xf44e('0x8e')](_0xa3d2ba[_0xf44e('0x53')],[_0xf44e('0x6c'),'id'])||{})[_0xf44e('0x8f')](function(_0x3a9fa0){for(var _0x21d98c=0x0;_0x21d98c<_0xa3d2ba[_0xf44e('0x53')][_0xf44e('0x6c')][_0xf44e('0x42')];_0x21d98c+=0x1){socket[_0xf44e('0x8b')](_0xf44e('0x76'),{'UserId':Number(_0xa3d2ba['body'][_0xf44e('0x6c')][_0x21d98c]),'WhatsappQueueId':Number(_0xa3d2ba[_0xf44e('0x50')]['id'])});}return _0x3a9fa0;});}})[_0xf44e('0x2f')](respondWithResult(_0x7d9dc,null))[_0xf44e('0x4e')](handleError(_0x7d9dc,null));};exports[_0xf44e('0x8a')]=function(_0x38a56a,_0x1e1e87,_0x1d7c36){return db[_0xf44e('0x37')]['find']({'where':{'id':_0x38a56a[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x1e1e87,null))[_0xf44e('0x2f')](function(_0x238786){if(_0x238786){return _0x238786[_0xf44e('0x8a')](_0x38a56a[_0xf44e('0x3d')][_0xf44e('0x6c')])[_0xf44e('0x2f')](function(){if(_[_0xf44e('0x90')](_0x38a56a['query']['ids'])){for(var _0x56e5ab=0x0;_0x56e5ab<_0x38a56a[_0xf44e('0x3d')]['ids'][_0xf44e('0x42')];_0x56e5ab+=0x1){socket[_0xf44e('0x8b')](_0xf44e('0x8c'),{'UserId':Number(_0x38a56a[_0xf44e('0x3d')][_0xf44e('0x6c')][_0x56e5ab]),'WhatsappQueueId':Number(_0x38a56a[_0xf44e('0x50')]['id'])});}}else{socket[_0xf44e('0x8b')](_0xf44e('0x8c'),{'UserId':Number(_0x38a56a[_0xf44e('0x3d')][_0xf44e('0x6c')]),'WhatsappQueueId':Number(_0x38a56a[_0xf44e('0x50')]['id'])});}});}})[_0xf44e('0x2f')](respondWithStatusCode(_0x1e1e87,null))[_0xf44e('0x4e')](handleError(_0x1e1e87,null));};exports['getAgents']=function(_0x449bf1,_0x41d7e4,_0x2d73c6){var _0xfcc2f0={};var _0x506437={};var _0x1b1c19;var _0x1a18ad;return db[_0xf44e('0x37')][_0xf44e('0x69')]({'where':{'id':_0x449bf1[_0xf44e('0x50')]['id']}})[_0xf44e('0x2f')](handleEntityNotFound(_0x41d7e4,null))[_0xf44e('0x2f')](function(_0x22723a){if(_0x22723a){_0x1b1c19=_0x22723a;_0x506437[_0xf44e('0x3c')]=_[_0xf44e('0x3e')](db[_0xf44e('0x60')][_0xf44e('0x38')]);_0x506437[_0xf44e('0x3d')]=_['keys'](_0x449bf1[_0xf44e('0x3d')]);_0x506437[_0xf44e('0x47')]=_[_0xf44e('0x3f')](_0x506437[_0xf44e('0x3c')],_0x506437[_0xf44e('0x3d')]);_0xfcc2f0['attributes']=_[_0xf44e('0x3f')](_0x506437[_0xf44e('0x3c')],qs[_0xf44e('0x41')](_0x449bf1['query'][_0xf44e('0x41')]));_0xfcc2f0['attributes']=_0xfcc2f0['attributes']['length']?_0xfcc2f0['attributes']:_0x506437['model'];_0xfcc2f0['order']=qs[_0xf44e('0x46')](_0x449bf1[_0xf44e('0x3d')]['sort']);_0xfcc2f0['where']=qs[_0xf44e('0x47')](_[_0xf44e('0x48')](_0x449bf1[_0xf44e('0x3d')],_0x506437[_0xf44e('0x47')]));if(_0x449bf1[_0xf44e('0x3d')]['filter']){_0xfcc2f0['where']=_[_0xf44e('0x4a')](_0xfcc2f0[_0xf44e('0x49')],{'$or':_['map'](_0xfcc2f0[_0xf44e('0x40')],function(_0x485a9e){var _0x2bf13c={};_0x2bf13c[_0x485a9e]={'$like':'%'+_0x449bf1[_0xf44e('0x3d')][_0xf44e('0x4b')]+'%'};return _0x2bf13c;})});}_0xfcc2f0=_[_0xf44e('0x4a')]({},_0xfcc2f0,_0x449bf1[_0xf44e('0x4c')]);return _0x1b1c19[_0xf44e('0x91')](_0xfcc2f0);}})[_0xf44e('0x2f')](function(_0x5d6024){if(_0x5d6024){_0x1a18ad=_0x5d6024[_0xf44e('0x42')];if(!_0x449bf1[_0xf44e('0x3d')]['hasOwnProperty']('nolimit')){_0xfcc2f0[_0xf44e('0x29')]=qs['limit'](_0x449bf1[_0xf44e('0x3d')][_0xf44e('0x29')]);_0xfcc2f0[_0xf44e('0x26')]=qs[_0xf44e('0x26')](_0x449bf1[_0xf44e('0x3d')][_0xf44e('0x26')]);}return _0x1b1c19[_0xf44e('0x91')](_0xfcc2f0);}})[_0xf44e('0x2f')](function(_0x35046a){if(_0x35046a){return _0x35046a?{'count':_0x1a18ad,'rows':_0x35046a}:null;}})[_0xf44e('0x2f')](respondWithResult(_0x41d7e4,null))[_0xf44e('0x4e')](handleError(_0x41d7e4,null));}; \ No newline at end of file +var _0x1325=['transaction','each','emit','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','removeAgents','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','limit','count','set','apply','reject','save','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','update','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','interface','sequelize'];(function(_0x5df9f6,_0x5617d8){var _0x110930=function(_0x5072c8){while(--_0x5072c8){_0x5df9f6['push'](_0x5df9f6['shift']());}};_0x110930(++_0x5617d8);}(_0x1325,0x12c));var _0x5132=function(_0x462d94,_0x1ae1d4){_0x462d94=_0x462d94-0x0;var _0xd3b0c3=_0x1325[_0x462d94];return _0xd3b0c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5132('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5132('0x1'));var rp=require('request-promise');var moment=require(_0x5132('0x2'));var BPromise=require(_0x5132('0x3'));var Mustache=require(_0x5132('0x4'));var util=require(_0x5132('0x5'));var path=require(_0x5132('0x6'));var sox=require(_0x5132('0x7'));var csv=require(_0x5132('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5132('0x9'));var _=require('lodash');var squel=require(_0x5132('0xa'));var crypto=require(_0x5132('0xb'));var jsforce=require(_0x5132('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5132('0x8'));var querystring=require(_0x5132('0xd'));var Papa=require(_0x5132('0xe'));var Redis=require('ioredis');var authService=require(_0x5132('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5132('0x10'));var hardwareService=require(_0x5132('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5132('0x12'));var licenseUtil=require(_0x5132('0x13'));var db=require(_0x5132('0x14'))['db'];config[_0x5132('0x15')]=_[_0x5132('0x16')](config[_0x5132('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5132('0x17'))(new Redis(config[_0x5132('0x15')]));require('./whatsappQueue.socket')[_0x5132('0x18')](socket);function respondWithStatusCode(_0x1d8242,_0xdbd92){_0xdbd92=_0xdbd92||0xcc;return function(_0x4a22b6){if(_0x4a22b6){return _0x1d8242['sendStatus'](_0xdbd92);}return _0x1d8242[_0x5132('0x19')](_0xdbd92)[_0x5132('0x1a')]();};}function respondWithResult(_0x383447,_0x97a16c){_0x97a16c=_0x97a16c||0xc8;return function(_0x1b0308){if(_0x1b0308){return _0x383447[_0x5132('0x19')](_0x97a16c)[_0x5132('0x1b')](_0x1b0308);}};}function respondWithFilteredResult(_0x36823e,_0x1846b3){return function(_0x52732f){if(_0x52732f){var _0xe99141=typeof _0x1846b3[_0x5132('0x1c')]==='undefined'&&typeof _0x1846b3[_0x5132('0x1d')]==='undefined';var _0x366c71=_0x52732f['count'];var _0x399695=_0xe99141?0x0:_0x1846b3[_0x5132('0x1c')];var _0x1b564d=_0xe99141?_0x52732f[_0x5132('0x1e')]:_0x1846b3[_0x5132('0x1c')]+_0x1846b3[_0x5132('0x1d')];var _0x548e51;if(_0x1b564d>=_0x366c71){_0x1b564d=_0x366c71;_0x548e51=0xc8;}else{_0x548e51=0xce;}_0x36823e[_0x5132('0x19')](_0x548e51);return _0x36823e[_0x5132('0x1f')]('Content-Range',_0x399695+'-'+_0x1b564d+'/'+_0x366c71)[_0x5132('0x1b')](_0x52732f);}return null;};}function patchUpdates(_0x5c74a6){return function(_0x3057f9){try{jsonpatch[_0x5132('0x20')](_0x3057f9,_0x5c74a6,!![]);}catch(_0x1cfdcf){return BPromise[_0x5132('0x21')](_0x1cfdcf);}return _0x3057f9[_0x5132('0x22')]();};}function saveUpdates(_0x25cff3,_0x2da385){return function(_0x10d9b1){if(_0x10d9b1){return _0x10d9b1['update'](_0x25cff3)['then'](function(_0x3a7905){return _0x3a7905;});}return null;};}function removeEntity(_0x569901,_0x57a79e){return function(_0x1eea2e){if(_0x1eea2e){return _0x1eea2e[_0x5132('0x23')]()[_0x5132('0x24')](function(){var _0xb4484a=_0x1eea2e[_0x5132('0x25')]({'plain':!![]});var _0x4c620c=_0x5132('0x26');return db[_0x5132('0x27')][_0x5132('0x23')]({'where':{'type':_0x4c620c,'resourceId':_0xb4484a['id']}})[_0x5132('0x24')](function(){return _0x1eea2e;});})['then'](function(){_0x569901['status'](0xcc)[_0x5132('0x1a')]();});}};}function handleEntityNotFound(_0x53ed5c,_0x46aa78){return function(_0x38987b){if(!_0x38987b){_0x53ed5c[_0x5132('0x28')](0x194);}return _0x38987b;};}function handleError(_0xcfa1af,_0x7dc751){_0x7dc751=_0x7dc751||0x1f4;return function(_0x2c8357){logger[_0x5132('0x29')](_0x2c8357[_0x5132('0x2a')]);if(_0x2c8357['name']){delete _0x2c8357[_0x5132('0x2b')];}_0xcfa1af[_0x5132('0x19')](_0x7dc751)[_0x5132('0x2c')](_0x2c8357);};}exports[_0x5132('0x2d')]=function(_0x22b7f6,_0x3b8c4c){var _0xb71d65={},_0x54f7dc={},_0xb93e46={'count':0x0,'rows':[]};var _0x40f853=_[_0x5132('0x2e')](db[_0x5132('0x2f')][_0x5132('0x30')],function(_0x4351e0){return{'name':_0x4351e0[_0x5132('0x31')],'type':_0x4351e0[_0x5132('0x32')][_0x5132('0x33')]};});_0x54f7dc[_0x5132('0x34')]=_[_0x5132('0x2e')](_0x40f853,_0x5132('0x2b'));_0x54f7dc[_0x5132('0x35')]=_['keys'](_0x22b7f6[_0x5132('0x35')]);_0x54f7dc['filters']=_[_0x5132('0x36')](_0x54f7dc[_0x5132('0x34')],_0x54f7dc[_0x5132('0x35')]);_0xb71d65['attributes']=_['intersection'](_0x54f7dc[_0x5132('0x34')],qs[_0x5132('0x37')](_0x22b7f6[_0x5132('0x35')][_0x5132('0x37')]));_0xb71d65[_0x5132('0x38')]=_0xb71d65[_0x5132('0x38')][_0x5132('0x39')]?_0xb71d65[_0x5132('0x38')]:_0x54f7dc[_0x5132('0x34')];if(!_0x22b7f6[_0x5132('0x35')][_0x5132('0x3a')](_0x5132('0x3b'))){_0xb71d65[_0x5132('0x1d')]=qs['limit'](_0x22b7f6[_0x5132('0x35')][_0x5132('0x1d')]);_0xb71d65[_0x5132('0x1c')]=qs[_0x5132('0x1c')](_0x22b7f6[_0x5132('0x35')][_0x5132('0x1c')]);}_0xb71d65['order']=qs[_0x5132('0x3c')](_0x22b7f6[_0x5132('0x35')][_0x5132('0x3c')]);_0xb71d65[_0x5132('0x3d')]=qs[_0x5132('0x3e')](_[_0x5132('0x3f')](_0x22b7f6[_0x5132('0x35')],_0x54f7dc[_0x5132('0x3e')]),_0x40f853);if(_0x22b7f6['query'][_0x5132('0x40')]){_0xb71d65[_0x5132('0x3d')]=_[_0x5132('0x41')](_0xb71d65[_0x5132('0x3d')],{'$or':_[_0x5132('0x2e')](_0x40f853,function(_0x877c62){if(_0x877c62[_0x5132('0x32')]!==_0x5132('0x42')){var _0x2acc09={};_0x2acc09[_0x877c62[_0x5132('0x2b')]]={'$like':'%'+_0x22b7f6['query']['filter']+'%'};return _0x2acc09;}})});}_0xb71d65=_[_0x5132('0x41')]({},_0xb71d65,_0x22b7f6[_0x5132('0x43')]);var _0x441f36={'where':_0xb71d65[_0x5132('0x3d')]};return db['WhatsappQueue'][_0x5132('0x1e')](_0x441f36)['then'](function(_0x30d654){_0xb93e46['count']=_0x30d654;if(_0x22b7f6[_0x5132('0x35')]['includeAll']){_0xb71d65[_0x5132('0x44')]=[{'all':!![]}];}return db[_0x5132('0x2f')][_0x5132('0x45')](_0xb71d65);})[_0x5132('0x24')](function(_0x516ea8){_0xb93e46[_0x5132('0x46')]=_0x516ea8;return _0xb93e46;})[_0x5132('0x24')](respondWithFilteredResult(_0x3b8c4c,_0xb71d65))[_0x5132('0x47')](handleError(_0x3b8c4c,null));};exports[_0x5132('0x48')]=function(_0x48204d,_0x560a08){var _0x1263c9={'raw':!![],'where':{'id':_0x48204d[_0x5132('0x49')]['id']}},_0x5b8875={};_0x5b8875[_0x5132('0x34')]=_[_0x5132('0x4a')](db[_0x5132('0x2f')][_0x5132('0x30')]);_0x5b8875['query']=_[_0x5132('0x4a')](_0x48204d[_0x5132('0x35')]);_0x5b8875[_0x5132('0x3e')]=_[_0x5132('0x36')](_0x5b8875['model'],_0x5b8875[_0x5132('0x35')]);_0x1263c9[_0x5132('0x38')]=_[_0x5132('0x36')](_0x5b8875[_0x5132('0x34')],qs[_0x5132('0x37')](_0x48204d[_0x5132('0x35')][_0x5132('0x37')]));_0x1263c9[_0x5132('0x38')]=_0x1263c9[_0x5132('0x38')][_0x5132('0x39')]?_0x1263c9[_0x5132('0x38')]:_0x5b8875[_0x5132('0x34')];if(_0x48204d['query'][_0x5132('0x4b')]){_0x1263c9[_0x5132('0x44')]=[{'all':!![]}];}_0x1263c9=_['merge']({},_0x1263c9,_0x48204d[_0x5132('0x43')]);return db[_0x5132('0x2f')][_0x5132('0x4c')](_0x1263c9)[_0x5132('0x24')](handleEntityNotFound(_0x560a08,null))['then'](respondWithResult(_0x560a08,null))['catch'](handleError(_0x560a08,null));};exports[_0x5132('0x4d')]=function(_0x24f5d5,_0x4ff218){return db['WhatsappQueue'][_0x5132('0x4d')](_0x24f5d5[_0x5132('0x4e')],{})[_0x5132('0x24')](function(_0xde7c64){var _0x15502c=_0x24f5d5['user']['get']({'plain':!![]});if(!_0x15502c)throw new Error(_0x5132('0x4f'));if(_0x15502c['role']===_0x5132('0x50')){var _0x21e0aa=_0xde7c64[_0x5132('0x25')]({'plain':!![]});var _0x48a8c7=_0x5132('0x26');return db[_0x5132('0x51')][_0x5132('0x4c')]({'where':{'name':_0x48a8c7,'userProfileId':_0x15502c[_0x5132('0x52')]},'raw':!![]})[_0x5132('0x24')](function(_0x2d69c5){if(_0x2d69c5&&_0x2d69c5[_0x5132('0x53')]===0x0){return db[_0x5132('0x27')]['create']({'name':_0x21e0aa[_0x5132('0x2b')],'resourceId':_0x21e0aa['id'],'type':_0x2d69c5[_0x5132('0x2b')],'sectionId':_0x2d69c5['id']},{})['then'](function(){return _0xde7c64;});}else{return _0xde7c64;}})[_0x5132('0x47')](function(_0x37a947){logger[_0x5132('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37a947);throw _0x37a947;});}return _0xde7c64;})['then'](respondWithResult(_0x4ff218,0xc9))[_0x5132('0x47')](handleError(_0x4ff218,null));};exports[_0x5132('0x54')]=function(_0xdb429d,_0x2aa669){if(_0xdb429d['body']['id']){delete _0xdb429d['body']['id'];}return db[_0x5132('0x2f')][_0x5132('0x4c')]({'where':{'id':_0xdb429d[_0x5132('0x49')]['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x2aa669,null))[_0x5132('0x24')](saveUpdates(_0xdb429d[_0x5132('0x4e')],null))[_0x5132('0x24')](respondWithResult(_0x2aa669,null))[_0x5132('0x47')](handleError(_0x2aa669,null));};exports[_0x5132('0x23')]=function(_0x547117,_0x1132af){return db[_0x5132('0x2f')][_0x5132('0x4c')]({'where':{'id':_0x547117[_0x5132('0x49')]['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x1132af,null))[_0x5132('0x24')](removeEntity(_0x1132af,null))[_0x5132('0x47')](handleError(_0x1132af,null));};exports['describe']=function(_0x473f5a,_0x2f4e36){return db[_0x5132('0x2f')]['describe']()['then'](respondWithResult(_0x2f4e36,null))['catch'](handleError(_0x2f4e36,null));};exports[_0x5132('0x55')]=function(_0x26735e,_0x1f0264,_0xbfe4ea){var _0x46538c={'raw':!![],'where':{}},_0x170be5={},_0xfe4c5f;return db[_0x5132('0x2f')][_0x5132('0x56')]({'where':{'id':_0x26735e[_0x5132('0x49')]['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x1f0264,null))[_0x5132('0x24')](function(_0x3b8c82){if(_0x3b8c82){_0xfe4c5f=_0x3b8c82['get']({'plain':!![]});_0x170be5['model']=_['keys'](db[_0x5132('0x57')][_0x5132('0x30')]);_0x170be5[_0x5132('0x35')]=_[_0x5132('0x4a')](_0x26735e[_0x5132('0x35')]);_0x170be5[_0x5132('0x3e')]=_[_0x5132('0x36')](_0x170be5[_0x5132('0x34')],_0x170be5[_0x5132('0x35')]);_0x46538c[_0x5132('0x38')]=_[_0x5132('0x36')](_0x170be5[_0x5132('0x34')],qs[_0x5132('0x37')](_0x26735e['query'][_0x5132('0x37')]));_0x46538c['attributes']=_0x46538c[_0x5132('0x38')]['length']?_0x46538c['attributes']:_0x170be5[_0x5132('0x34')];if(!_0x26735e[_0x5132('0x35')][_0x5132('0x3a')](_0x5132('0x3b'))){_0x46538c[_0x5132('0x1d')]=qs[_0x5132('0x1d')](_0x26735e[_0x5132('0x35')][_0x5132('0x1d')]);_0x46538c[_0x5132('0x1c')]=qs['offset'](_0x26735e[_0x5132('0x35')][_0x5132('0x1c')]);}_0x46538c[_0x5132('0x58')]=qs[_0x5132('0x3c')](_0x26735e[_0x5132('0x35')][_0x5132('0x3c')]);_0x46538c[_0x5132('0x3d')]=qs[_0x5132('0x3e')](_[_0x5132('0x3f')](_0x26735e['query'],_0x170be5['filters']));_0x46538c['where'][_0x5132('0x59')]=_0x3b8c82['id'];if(_0x26735e[_0x5132('0x35')][_0x5132('0x40')]){_0x46538c[_0x5132('0x3d')]=_[_0x5132('0x41')](_0x46538c[_0x5132('0x3d')],{'$or':_[_0x5132('0x2e')](_0x46538c[_0x5132('0x38')],function(_0x1f686f){var _0x311669={};_0x311669[_0x1f686f]={'$like':'%'+_0x26735e[_0x5132('0x35')]['filter']+'%'};return _0x311669;})});}_0x46538c=_[_0x5132('0x41')]({},_0x46538c,_0x26735e['options']);return db['UserWhatsappQueue'][_0x5132('0x45')](_0x46538c);}})[_0x5132('0x24')](function(_0x559c48){if(_0x559c48){return db[_0x5132('0x5a')]['findAndCountAll']({'where':{'id':_[_0x5132('0x2e')](_0x559c48,_0x5132('0x5b')),'role':'agent'},'attributes':['id','name',_0x5132('0x5c'),_0x5132('0x5d'),_0x5132('0x5e')]});}})[_0x5132('0x24')](function(_0x543374){if(_0x543374){return{'count':_0x543374['count'],'rows':_['map'](_0x543374[_0x5132('0x46')],function(_0x4c8d1a){return{'membername':_0x4c8d1a[_0x5132('0x2b')],'UserId':_0x4c8d1a['id'],'queue_name':_0xfe4c5f[_0x5132('0x2b')],'WhatsappQueueId':_0xfe4c5f['id'],'interface':util[_0x5132('0x5f')](_0x5132('0x60'),_0x5132('0x61'),_0x4c8d1a[_0x5132('0x2b')]),'penalty':0x0,'paused':_0x4c8d1a['whatsappPause'],'createdAt':_0x4c8d1a[_0x5132('0x5e')],'updatedAt':_0x4c8d1a[_0x5132('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5132('0x24')](respondWithFilteredResult(_0x1f0264,_0x46538c))[_0x5132('0x47')](handleError(_0x1f0264,null));};exports[_0x5132('0x62')]=function(_0x173a68,_0x3eaa40,_0x53d489){var _0x379ae5={};var _0x2b0da4={};var _0xbb7459;var _0x2296ef;return db[_0x5132('0x2f')][_0x5132('0x56')]({'where':{'id':_0x173a68[_0x5132('0x49')]['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x3eaa40,null))[_0x5132('0x24')](function(_0x1133e6){if(_0x1133e6){_0xbb7459=_0x1133e6;_0x2b0da4['model']=_['keys'](db[_0x5132('0x63')][_0x5132('0x30')]);_0x2b0da4['query']=_[_0x5132('0x4a')](_0x173a68[_0x5132('0x35')]);_0x2b0da4['filters']=_[_0x5132('0x36')](_0x2b0da4['model'],_0x2b0da4[_0x5132('0x35')]);_0x379ae5[_0x5132('0x38')]=_[_0x5132('0x36')](_0x2b0da4[_0x5132('0x34')],qs[_0x5132('0x37')](_0x173a68['query']['fields']));_0x379ae5[_0x5132('0x38')]=_0x379ae5[_0x5132('0x38')][_0x5132('0x39')]?_0x379ae5[_0x5132('0x38')]:_0x2b0da4[_0x5132('0x34')];_0x379ae5[_0x5132('0x58')]=qs[_0x5132('0x3c')](_0x173a68[_0x5132('0x35')]['sort']);_0x379ae5['where']=qs[_0x5132('0x3e')](_['pick'](_0x173a68[_0x5132('0x35')],_0x2b0da4[_0x5132('0x3e')]));if(_0x173a68[_0x5132('0x35')][_0x5132('0x40')]){_0x379ae5[_0x5132('0x3d')]=_[_0x5132('0x41')](_0x379ae5[_0x5132('0x3d')],{'$or':_[_0x5132('0x2e')](_0x379ae5[_0x5132('0x38')],function(_0x3bbc12){var _0x35e550={};_0x35e550[_0x3bbc12]={'$like':'%'+_0x173a68[_0x5132('0x35')][_0x5132('0x40')]+'%'};return _0x35e550;})});}_0x379ae5=_[_0x5132('0x41')]({},_0x379ae5,_0x173a68[_0x5132('0x43')]);return _0xbb7459[_0x5132('0x62')](_0x379ae5);}})[_0x5132('0x24')](function(_0x4735ee){if(_0x4735ee){_0x2296ef=_0x4735ee['length'];if(!_0x173a68['query'][_0x5132('0x3a')](_0x5132('0x3b'))){_0x379ae5[_0x5132('0x1d')]=qs[_0x5132('0x1d')](_0x173a68[_0x5132('0x35')][_0x5132('0x1d')]);_0x379ae5[_0x5132('0x1c')]=qs['offset'](_0x173a68[_0x5132('0x35')][_0x5132('0x1c')]);}return _0xbb7459[_0x5132('0x62')](_0x379ae5);}})[_0x5132('0x24')](function(_0x514665){if(_0x514665){return _0x514665?{'count':_0x2296ef,'rows':_0x514665}:null;}})[_0x5132('0x24')](respondWithResult(_0x3eaa40,null))['catch'](handleError(_0x3eaa40,null));};exports[_0x5132('0x64')]=function(_0x157e3c,_0x5ba896,_0x2bc9df){var _0x231aa7=_0x157e3c[_0x5132('0x4e')][_0x5132('0x65')];return db['Team'][_0x5132('0x45')]({'where':{'id':_0x231aa7},'attributes':['id'],'include':[{'model':db[_0x5132('0x5a')],'as':_0x5132('0x66'),'attributes':['id','name','online','voicePause',_0x5132('0x67')],'raw':!![]}]})['then'](function(_0x543ac0){if(_0x543ac0){var _0x57f65a=_['flatMap'](_0x543ac0,function(_0x5cf0be){var _0x4a5528=_0x5cf0be[_0x5132('0x25')]({'plain':!![]});return _0x4a5528[_0x5132('0x66')];});return db[_0x5132('0x2f')][_0x5132('0x4c')]({'where':{'id':_0x157e3c[_0x5132('0x49')]['id']}})[_0x5132('0x24')](function(_0x3d2a60){return db[_0x5132('0x68')][_0x5132('0x69')](function(_0x397828){return _0x3d2a60[_0x5132('0x64')](_0x231aa7,{'transaction':_0x397828})[_0x5132('0x24')](function(){return BPromise[_0x5132('0x6a')](_0x57f65a,function(_0x31edc1){return db[_0x5132('0x57')]['findOrCreate']({'where':{'UserId':_0x31edc1['id'],'WhatsappQueueId':_0x157e3c['params']['id']},'transaction':_0x397828});});})[_0x5132('0x24')](function(){_0x57f65a['forEach'](function(_0x2a17e1){socket[_0x5132('0x6b')]('userWhatsappQueue:save',{'UserId':_0x2a17e1['id'],'WhatsappQueueId':_0x3d2a60['id']});});});});});}})['then'](respondWithStatusCode(_0x5ba896,null))[_0x5132('0x47')](handleError(_0x5ba896,null));};exports[_0x5132('0x6c')]=function(_0x266643,_0x4b0759,_0x54c259){return db[_0x5132('0x63')][_0x5132('0x45')]({'where':{'id':_0x266643[_0x5132('0x35')][_0x5132('0x65')]},'attributes':['id'],'include':[{'model':db[_0x5132('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5132('0x24')](handleEntityNotFound(_0x4b0759,null))[_0x5132('0x24')](function(_0x551ca8){var _0xc79ecf=_[_0x5132('0x2e')](_0x551ca8,'id');var _0x21536c=[];var _0x45e25a=[];var _0x459b8c=squel[_0x5132('0x6d')]();_0x459b8c[_0x5132('0x6e')]('tq.TeamId')[_0x5132('0x6f')](_0x5132('0x70'),'tq')[_0x5132('0x71')](_0x5132('0x72'),'ut',_0x5132('0x73'))['where']('WhatsappQueueId\x20=\x20?',_0x266643[_0x5132('0x49')]['id']);for(var _0x4c96b9=0x0;_0x4c96b9<_0x551ca8[_0x5132('0x39')];_0x4c96b9+=0x1){let _0xe1a67d=_0x551ca8[_0x4c96b9];for(var _0x2dc970=0x0;_0x2dc970<_0xe1a67d[_0x5132('0x66')][_0x5132('0x39')];_0x2dc970+=0x1){let _0x1adecc=_0xe1a67d[_0x5132('0x66')][_0x2dc970];var _0x43d31d=_0x459b8c['clone']();_0x43d31d[_0x5132('0x3d')](_0x5132('0x74'),_0x1adecc['id']);_0x45e25a[_0x5132('0x75')](db[_0x5132('0x68')][_0x5132('0x35')](_0x43d31d[_0x5132('0x76')](),{'type':db[_0x5132('0x68')]['QueryTypes'][_0x5132('0x77')]})['then'](function(_0x5ebf8e){if(_0x5ebf8e['length']===0x1){return _0x1adecc['id'];}else{var _0x3dea8a=_[_0x5132('0x78')](_[_0x5132('0x2e')](_0x5ebf8e,_0x5132('0x79')),function(_0x2f70a9){return _[_0x5132('0x7a')](_0xc79ecf,_0x2f70a9);});if(_0x3dea8a){return _0x1adecc['id'];}}}));}}return BPromise[_0x5132('0x7b')](_0x45e25a)['then'](function(_0x2e220c){_0x21536c=_(_0x21536c)[_0x5132('0x7c')](_0x2e220c)[_0x5132('0x7d')]()[_0x5132('0x7e')]();return db['WhatsappQueue'][_0x5132('0x4c')]({'where':{'id':_0x266643[_0x5132('0x49')]['id']}})[_0x5132('0x24')](function(_0x4786b0){return db[_0x5132('0x68')][_0x5132('0x69')](function(_0x384a39){return _0x4786b0[_0x5132('0x6c')](_0x266643['query'][_0x5132('0x65')],{'transaction':_0x384a39})[_0x5132('0x24')](function(){if(!_[_0x5132('0x7f')](_0x21536c)){return _0x4786b0['removeAgents'](_0x21536c,{'transaction':_0x384a39});}})[_0x5132('0x24')](function(){_0x21536c[_0x5132('0x80')](function(_0x4c80da){socket['emit'](_0x5132('0x81'),{'UserId':_0x4c80da,'WhatsappQueueId':_0x4786b0['id']});});});});});});})['then'](respondWithStatusCode(_0x4b0759,null))[_0x5132('0x47')](handleError(_0x4b0759,null));};exports['addAgents']=function(_0x8bdf53,_0x3c248a,_0x17dff3){return db[_0x5132('0x2f')]['find']({'where':{'id':_0x8bdf53['params']['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x3c248a,null))['then'](function(_0x372132){if(_0x372132){return _0x372132[_0x5132('0x82')](_0x8bdf53[_0x5132('0x4e')][_0x5132('0x65')],_[_0x5132('0x83')](_0x8bdf53[_0x5132('0x4e')],['ids','id'])||{})['spread'](function(_0x58c1c5){for(var _0x397d3c=0x0;_0x397d3c<_0x8bdf53[_0x5132('0x4e')]['ids'][_0x5132('0x39')];_0x397d3c+=0x1){socket[_0x5132('0x6b')](_0x5132('0x84'),{'UserId':Number(_0x8bdf53[_0x5132('0x4e')][_0x5132('0x65')][_0x397d3c]),'WhatsappQueueId':Number(_0x8bdf53[_0x5132('0x49')]['id'])});}return _0x58c1c5;});}})[_0x5132('0x24')](respondWithResult(_0x3c248a,null))[_0x5132('0x47')](handleError(_0x3c248a,null));};exports[_0x5132('0x85')]=function(_0x3afecb,_0x210d5d,_0x279424){return db[_0x5132('0x2f')]['find']({'where':{'id':_0x3afecb['params']['id']}})[_0x5132('0x24')](handleEntityNotFound(_0x210d5d,null))['then'](function(_0x458578){if(_0x458578){return _0x458578[_0x5132('0x85')](_0x3afecb['query'][_0x5132('0x65')])[_0x5132('0x24')](function(){if(_['isArray'](_0x3afecb[_0x5132('0x35')][_0x5132('0x65')])){for(var _0x8a7ce1=0x0;_0x8a7ce1<_0x3afecb['query'][_0x5132('0x65')]['length'];_0x8a7ce1+=0x1){socket[_0x5132('0x6b')](_0x5132('0x81'),{'UserId':Number(_0x3afecb['query']['ids'][_0x8a7ce1]),'WhatsappQueueId':Number(_0x3afecb[_0x5132('0x49')]['id'])});}}else{socket[_0x5132('0x6b')](_0x5132('0x81'),{'UserId':Number(_0x3afecb[_0x5132('0x35')][_0x5132('0x65')]),'WhatsappQueueId':Number(_0x3afecb[_0x5132('0x49')]['id'])});}});}})[_0x5132('0x24')](respondWithStatusCode(_0x210d5d,null))['catch'](handleError(_0x210d5d,null));};exports[_0x5132('0x86')]=function(_0x5df483,_0xcd3f03,_0x508850){var _0x294146={};var _0x566d79={};var _0x4484a0;var _0x1fa1b3;return db[_0x5132('0x2f')]['findOne']({'where':{'id':_0x5df483[_0x5132('0x49')]['id']}})[_0x5132('0x24')](handleEntityNotFound(_0xcd3f03,null))[_0x5132('0x24')](function(_0x1be041){if(_0x1be041){_0x4484a0=_0x1be041;_0x566d79[_0x5132('0x34')]=_[_0x5132('0x4a')](db[_0x5132('0x5a')][_0x5132('0x30')]);_0x566d79[_0x5132('0x35')]=_[_0x5132('0x4a')](_0x5df483[_0x5132('0x35')]);_0x566d79[_0x5132('0x3e')]=_[_0x5132('0x36')](_0x566d79[_0x5132('0x34')],_0x566d79['query']);_0x294146[_0x5132('0x38')]=_[_0x5132('0x36')](_0x566d79[_0x5132('0x34')],qs[_0x5132('0x37')](_0x5df483[_0x5132('0x35')][_0x5132('0x37')]));_0x294146['attributes']=_0x294146[_0x5132('0x38')]['length']?_0x294146[_0x5132('0x38')]:_0x566d79[_0x5132('0x34')];_0x294146[_0x5132('0x58')]=qs['sort'](_0x5df483[_0x5132('0x35')][_0x5132('0x3c')]);_0x294146['where']=qs[_0x5132('0x3e')](_[_0x5132('0x3f')](_0x5df483[_0x5132('0x35')],_0x566d79['filters']));if(_0x5df483[_0x5132('0x35')][_0x5132('0x40')]){_0x294146[_0x5132('0x3d')]=_['merge'](_0x294146[_0x5132('0x3d')],{'$or':_[_0x5132('0x2e')](_0x294146[_0x5132('0x38')],function(_0x58c3e6){var _0x7a6b6c={};_0x7a6b6c[_0x58c3e6]={'$like':'%'+_0x5df483[_0x5132('0x35')][_0x5132('0x40')]+'%'};return _0x7a6b6c;})});}_0x294146=_[_0x5132('0x41')]({},_0x294146,_0x5df483[_0x5132('0x43')]);return _0x4484a0[_0x5132('0x86')](_0x294146);}})[_0x5132('0x24')](function(_0x324f0d){if(_0x324f0d){_0x1fa1b3=_0x324f0d['length'];if(!_0x5df483[_0x5132('0x35')]['hasOwnProperty'](_0x5132('0x3b'))){_0x294146[_0x5132('0x1d')]=qs[_0x5132('0x1d')](_0x5df483[_0x5132('0x35')][_0x5132('0x1d')]);_0x294146['offset']=qs[_0x5132('0x1c')](_0x5df483[_0x5132('0x35')][_0x5132('0x1c')]);}return _0x4484a0[_0x5132('0x86')](_0x294146);}})[_0x5132('0x24')](function(_0x2b486f){if(_0x2b486f){return _0x2b486f?{'count':_0x1fa1b3,'rows':_0x2b486f}:null;}})['then'](respondWithResult(_0xcd3f03,null))[_0x5132('0x47')](handleError(_0xcd3f03,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 29dc839..fcdcd63 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 _0x78d1=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x78d1,0x7b));var _0x178d=function(_0x54a408,_0x4030e7){_0x54a408=_0x54a408-0x0;var _0x2841bd=_0x78d1[_0x54a408];return _0x2841bd;};'use strict';var EventEmitter=require(_0x178d('0x0'));var WhatsappQueue=require(_0x178d('0x1'))['db'][_0x178d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x178d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x178d('0x4')};function emitEvent(_0x5e9ecc){return function(_0x3e8852,_0x762064,_0x11bb5e){WhatsappQueueEvents['emit'](_0x5e9ecc+':'+_0x3e8852['id'],_0x3e8852);WhatsappQueueEvents[_0x178d('0x5')](_0x5e9ecc,_0x3e8852);_0x11bb5e(null);};}for(var e in events){if(events[_0x178d('0x6')](e)){var event=events[e];WhatsappQueue[_0x178d('0x7')](e,emitEvent(event));}}module[_0x178d('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2e0e=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x4b4429,_0x2e8408){var _0xec4ddf=function(_0x3e1f0d){while(--_0x3e1f0d){_0x4b4429['push'](_0x4b4429['shift']());}};_0xec4ddf(++_0x2e8408);}(_0x2e0e,0xba));var _0xe2e0=function(_0x50837c,_0x29472e){_0x50837c=_0x50837c-0x0;var _0x3edde6=_0x2e0e[_0x50837c];return _0x3edde6;};'use strict';var EventEmitter=require(_0xe2e0('0x0'));var WhatsappQueue=require(_0xe2e0('0x1'))['db'][_0xe2e0('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe2e0('0x3')](0x0);var events={'afterCreate':_0xe2e0('0x4'),'afterUpdate':'update','afterDestroy':_0xe2e0('0x5')};function emitEvent(_0x40d1a3){return function(_0x590c17,_0x3bbaea,_0x1b0eef){WhatsappQueueEvents[_0xe2e0('0x6')](_0x40d1a3+':'+_0x590c17['id'],_0x590c17);WhatsappQueueEvents[_0xe2e0('0x6')](_0x40d1a3,_0x590c17);_0x1b0eef(null);};}for(var e in events){if(events[_0xe2e0('0x7')](e)){var event=events[e];WhatsappQueue[_0xe2e0('0x8')](e,emitEvent(event));}}module[_0xe2e0('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fb799d8..c137331 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 _0x7268=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueue.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7268,0x66));var _0x8726=function(_0x1bda2f,_0x2ecac0){_0x1bda2f=_0x1bda2f-0x0;var _0x502c29=_0x7268[_0x1bda2f];return _0x502c29;};'use strict';var _=require('lodash');var util=require(_0x8726('0x0'));var logger=require(_0x8726('0x1'))(_0x8726('0x2'));var moment=require(_0x8726('0x3'));var BPromise=require(_0x8726('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8726('0x5'));var rimraf=require('rimraf');var config=require(_0x8726('0x6'));var attributes=require(_0x8726('0x7'));module['exports']=function(_0x5b2983,_0x2de0ba){return _0x5b2983[_0x8726('0x8')](_0x8726('0x9'),attributes,{'tableName':_0x8726('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x816c=['lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x816c,0x12c));var _0xc816=function(_0x20e555,_0x40aea6){_0x20e555=_0x20e555-0x0;var _0x182077=_0x816c[_0x20e555];return _0x182077;};'use strict';var _=require(_0xc816('0x0'));var util=require('util');var logger=require(_0xc816('0x1'))('api');var moment=require(_0xc816('0x2'));var BPromise=require(_0xc816('0x3'));var rp=require(_0xc816('0x4'));var fs=require('fs');var path=require(_0xc816('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xc816('0x6')]=function(_0x576c81,_0x25e369){return _0x576c81[_0xc816('0x7')](_0xc816('0x8'),attributes,{'tableName':_0xc816('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c39d297..1ab8217 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 _0xd95c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','findAll','raw','options','where','limit','include','map','model','attributes','info','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xd95c,0x194));var _0xcd95=function(_0x47fb14,_0x546af7){_0x47fb14=_0x47fb14-0x0;var _0x3bb7cd=_0xd95c[_0x47fb14];return _0x3bb7cd;};'use strict';var _=require(_0xcd95('0x0'));var util=require(_0xcd95('0x1'));var moment=require(_0xcd95('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd95('0x4'))['db'];var utils=require(_0xcd95('0x5'));var logger=require(_0xcd95('0x6'))(_0xcd95('0x7'));var config=require(_0xcd95('0x8'));var jayson=require(_0xcd95('0x9'));var client=jayson[_0xcd95('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcd95('0xb')](config[_0xcd95('0xc')],{'host':_0xcd95('0xd'),'port':0x18eb});var socket=require(_0xcd95('0xe'))(new Redis(config[_0xcd95('0xc')]));require(_0xcd95('0xf'))[_0xcd95('0x10')](socket);function respondWithRpcPromise(_0x2fd03a,_0x47b871,_0x430458){return new BPromise(function(_0x3f253a,_0x54b56b){return client['request'](_0x2fd03a,_0x430458)[_0xcd95('0x11')](function(_0xe2e14a){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x47b871,_0xcd95('0x12'));logger[_0xcd95('0x13')](_0xcd95('0x14'),_0x47b871,_0xcd95('0x12'),JSON[_0xcd95('0x15')](_0xe2e14a));if(_0xe2e14a['error']){if(_0xe2e14a['error'][_0xcd95('0x16')]===0x1f4){logger[_0xcd95('0x17')](_0xcd95('0x18'),_0x47b871,_0xe2e14a[_0xcd95('0x17')][_0xcd95('0x19')]);return _0x54b56b(_0xe2e14a[_0xcd95('0x17')][_0xcd95('0x19')]);}logger['error'](_0xcd95('0x18'),_0x47b871,_0xe2e14a[_0xcd95('0x17')][_0xcd95('0x19')]);return _0x3f253a(_0xe2e14a[_0xcd95('0x17')][_0xcd95('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x47b871,_0xcd95('0x12'));_0x3f253a(_0xe2e14a['result'][_0xcd95('0x19')]);}})[_0xcd95('0x1a')](function(_0x2e14d9){logger[_0xcd95('0x17')](_0xcd95('0x18'),_0x47b871,_0x2e14d9);_0x54b56b(_0x2e14d9);});});}exports['GetWhatsappQueue']=function(_0x39d990){var _0x1cf4bd=this;return new Promise(function(_0x32da24,_0x1e3f20){return db[_0xcd95('0x1b')][_0xcd95('0x1c')]({'raw':_0x39d990['options']?_0x39d990['options'][_0xcd95('0x1d')]===undefined?!![]:![]:!![],'where':_0x39d990['options']?_0x39d990[_0xcd95('0x1e')][_0xcd95('0x1f')]||null:null,'attributes':_0x39d990[_0xcd95('0x1e')]?_0x39d990[_0xcd95('0x1e')]['attributes']||null:null,'limit':_0x39d990[_0xcd95('0x1e')]?_0x39d990[_0xcd95('0x1e')][_0xcd95('0x20')]||null:null,'include':_0x39d990[_0xcd95('0x1e')]?_0x39d990[_0xcd95('0x1e')][_0xcd95('0x21')]?_[_0xcd95('0x22')](_0x39d990[_0xcd95('0x1e')][_0xcd95('0x21')],function(_0x2669cf){return{'model':db[_0x2669cf[_0xcd95('0x23')]],'as':_0x2669cf['as'],'attributes':_0x2669cf[_0xcd95('0x24')],'include':_0x2669cf[_0xcd95('0x21')]?_[_0xcd95('0x22')](_0x2669cf[_0xcd95('0x21')],function(_0x4b97fc){return{'model':db[_0x4b97fc[_0xcd95('0x23')]],'as':_0x4b97fc['as'],'attributes':_0x4b97fc[_0xcd95('0x24')],'include':_0x4b97fc[_0xcd95('0x21')]?_[_0xcd95('0x22')](_0x4b97fc[_0xcd95('0x21')],function(_0x337648){return{'model':db[_0x337648[_0xcd95('0x23')]],'as':_0x337648['as'],'attributes':_0x337648[_0xcd95('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x190257){logger[_0xcd95('0x25')](_0xcd95('0x26'),_0x39d990);logger[_0xcd95('0x13')](_0xcd95('0x26'),_0x39d990,JSON[_0xcd95('0x15')](_0x190257));_0x32da24(_0x190257);})['catch'](function(_0x17cbcf){logger['error'](_0xcd95('0x26'),_0x17cbcf[_0xcd95('0x19')],_0x39d990);_0x1e3f20(_0x1cf4bd[_0xcd95('0x17')](0x1f4,_0x17cbcf[_0xcd95('0x19')]));});});};exports[_0xcd95('0x27')]=function(_0x2bc701){var _0x51a3d8=this;return new Promise(function(_0x1507cb,_0x4763e5){return db[_0xcd95('0x1b')][_0xcd95('0x28')]({'raw':_0x2bc701[_0xcd95('0x1e')]?_0x2bc701[_0xcd95('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc701[_0xcd95('0x1e')]?_0x2bc701['options'][_0xcd95('0x1f')]||null:null,'attributes':_0x2bc701[_0xcd95('0x1e')]?_0x2bc701[_0xcd95('0x1e')][_0xcd95('0x24')]||null:null,'include':_0x2bc701['options']?_0x2bc701['options'][_0xcd95('0x21')]?_['map'](_0x2bc701[_0xcd95('0x1e')]['include'],function(_0x21edb5){return{'model':db[_0x21edb5[_0xcd95('0x23')]],'as':_0x21edb5['as'],'attributes':_0x21edb5[_0xcd95('0x24')],'include':_0x21edb5[_0xcd95('0x21')]?_[_0xcd95('0x22')](_0x21edb5[_0xcd95('0x21')],function(_0x36dd63){return{'model':db[_0x36dd63[_0xcd95('0x23')]],'as':_0x36dd63['as'],'attributes':_0x36dd63[_0xcd95('0x24')],'include':_0x36dd63[_0xcd95('0x21')]?_[_0xcd95('0x22')](_0x36dd63[_0xcd95('0x21')],function(_0x6aec3e){return{'model':db[_0x6aec3e[_0xcd95('0x23')]],'as':_0x6aec3e['as'],'attributes':_0x6aec3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd95('0x11')](function(_0x1ea81b){logger[_0xcd95('0x25')](_0xcd95('0x27'),_0x2bc701);logger[_0xcd95('0x13')](_0xcd95('0x27'),_0x2bc701,JSON[_0xcd95('0x15')](_0x1ea81b));_0x1507cb(_0x1ea81b);})[_0xcd95('0x1a')](function(_0x545f99){logger['error'](_0xcd95('0x27'),_0x545f99[_0xcd95('0x19')],_0x2bc701);_0x4763e5(_0x51a3d8[_0xcd95('0x17')](0x1f4,_0x545f99[_0xcd95('0x19')]));});});}; \ No newline at end of file +var _0x562c=['GetWhatsappQueue','WhatsappQueue','findAll','options','raw','limit','include','map','attributes','model','then','info','find','where','ShowWhatsappQueue','debug','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x44b7db,_0x4bfbe3){var _0x559c4b=function(_0xc86573){while(--_0xc86573){_0x44b7db['push'](_0x44b7db['shift']());}};_0x559c4b(++_0x4bfbe3);}(_0x562c,0x113));var _0xc562=function(_0x2c5c5a,_0x5b7cd4){_0x2c5c5a=_0x2c5c5a-0x0;var _0x375bde=_0x562c[_0x2c5c5a];return _0x375bde;};'use strict';var _=require('lodash');var util=require(_0xc562('0x0'));var moment=require('moment');var BPromise=require(_0xc562('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc562('0x2'));var db=require(_0xc562('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc562('0x4'))(_0xc562('0x5'));var config=require(_0xc562('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc562('0x7')][_0xc562('0x8')]({'port':0x232a});config[_0xc562('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc562('0xa'))(new Redis(config[_0xc562('0x9')]));require('./whatsappQueue.socket')[_0xc562('0xb')](socket);function respondWithRpcPromise(_0x3040ae,_0x3751e6,_0x4b3cdc){return new BPromise(function(_0x2559da,_0x215eb7){return client[_0xc562('0xc')](_0x3040ae,_0x4b3cdc)['then'](function(_0x53cba9){logger['info'](_0xc562('0xd'),_0x3751e6,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3751e6,_0xc562('0xe'),JSON[_0xc562('0xf')](_0x53cba9));if(_0x53cba9['error']){if(_0x53cba9[_0xc562('0x10')][_0xc562('0x11')]===0x1f4){logger[_0xc562('0x10')](_0xc562('0xd'),_0x3751e6,_0x53cba9[_0xc562('0x10')][_0xc562('0x12')]);return _0x215eb7(_0x53cba9[_0xc562('0x10')][_0xc562('0x12')]);}logger[_0xc562('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x3751e6,_0x53cba9[_0xc562('0x10')][_0xc562('0x12')]);return _0x2559da(_0x53cba9[_0xc562('0x10')][_0xc562('0x12')]);}else{logger['info'](_0xc562('0xd'),_0x3751e6,_0xc562('0xe'));_0x2559da(_0x53cba9[_0xc562('0x13')]['message']);}})[_0xc562('0x14')](function(_0x167a15){logger[_0xc562('0x10')](_0xc562('0xd'),_0x3751e6,_0x167a15);_0x215eb7(_0x167a15);});});}exports[_0xc562('0x15')]=function(_0xd3c114){var _0x26914f=this;return new Promise(function(_0x39e577,_0x7f016b){return db[_0xc562('0x16')][_0xc562('0x17')]({'raw':_0xd3c114[_0xc562('0x18')]?_0xd3c114[_0xc562('0x18')][_0xc562('0x19')]===undefined?!![]:![]:!![],'where':_0xd3c114[_0xc562('0x18')]?_0xd3c114[_0xc562('0x18')]['where']||null:null,'attributes':_0xd3c114[_0xc562('0x18')]?_0xd3c114[_0xc562('0x18')]['attributes']||null:null,'limit':_0xd3c114['options']?_0xd3c114['options'][_0xc562('0x1a')]||null:null,'include':_0xd3c114['options']?_0xd3c114[_0xc562('0x18')][_0xc562('0x1b')]?_[_0xc562('0x1c')](_0xd3c114[_0xc562('0x18')][_0xc562('0x1b')],function(_0x176ab4){return{'model':db[_0x176ab4['model']],'as':_0x176ab4['as'],'attributes':_0x176ab4[_0xc562('0x1d')],'include':_0x176ab4[_0xc562('0x1b')]?_[_0xc562('0x1c')](_0x176ab4[_0xc562('0x1b')],function(_0x5d1074){return{'model':db[_0x5d1074[_0xc562('0x1e')]],'as':_0x5d1074['as'],'attributes':_0x5d1074['attributes'],'include':_0x5d1074[_0xc562('0x1b')]?_[_0xc562('0x1c')](_0x5d1074[_0xc562('0x1b')],function(_0x4b9f5d){return{'model':db[_0x4b9f5d['model']],'as':_0x4b9f5d['as'],'attributes':_0x4b9f5d[_0xc562('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc562('0x1f')](function(_0x120276){logger[_0xc562('0x20')](_0xc562('0x15'),_0xd3c114);logger['debug'](_0xc562('0x15'),_0xd3c114,JSON['stringify'](_0x120276));_0x39e577(_0x120276);})[_0xc562('0x14')](function(_0x3da704){logger['error']('GetWhatsappQueue',_0x3da704['message'],_0xd3c114);_0x7f016b(_0x26914f[_0xc562('0x10')](0x1f4,_0x3da704[_0xc562('0x12')]));});});};exports['ShowWhatsappQueue']=function(_0x3d6d86){var _0x435b73=this;return new Promise(function(_0x183c3f,_0x5606ef){return db[_0xc562('0x16')][_0xc562('0x21')]({'raw':_0x3d6d86['options']?_0x3d6d86['options'][_0xc562('0x19')]===undefined?!![]:![]:!![],'where':_0x3d6d86[_0xc562('0x18')]?_0x3d6d86[_0xc562('0x18')][_0xc562('0x22')]||null:null,'attributes':_0x3d6d86['options']?_0x3d6d86[_0xc562('0x18')][_0xc562('0x1d')]||null:null,'include':_0x3d6d86[_0xc562('0x18')]?_0x3d6d86['options'][_0xc562('0x1b')]?_[_0xc562('0x1c')](_0x3d6d86[_0xc562('0x18')][_0xc562('0x1b')],function(_0x114b95){return{'model':db[_0x114b95['model']],'as':_0x114b95['as'],'attributes':_0x114b95[_0xc562('0x1d')],'include':_0x114b95[_0xc562('0x1b')]?_[_0xc562('0x1c')](_0x114b95[_0xc562('0x1b')],function(_0x1d3a12){return{'model':db[_0x1d3a12[_0xc562('0x1e')]],'as':_0x1d3a12['as'],'attributes':_0x1d3a12['attributes'],'include':_0x1d3a12[_0xc562('0x1b')]?_[_0xc562('0x1c')](_0x1d3a12['include'],function(_0x536511){return{'model':db[_0x536511[_0xc562('0x1e')]],'as':_0x536511['as'],'attributes':_0x536511[_0xc562('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46e87e){logger[_0xc562('0x20')](_0xc562('0x23'),_0x3d6d86);logger[_0xc562('0x24')](_0xc562('0x23'),_0x3d6d86,JSON[_0xc562('0xf')](_0x46e87e));_0x183c3f(_0x46e87e);})[_0xc562('0x14')](function(_0xdcb3bb){logger[_0xc562('0x10')]('ShowWhatsappQueue',_0xdcb3bb[_0xc562('0x12')],_0x3d6d86);_0x5606ef(_0x435b73[_0xc562('0x10')](0x1f4,_0xdcb3bb[_0xc562('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3377089..ad85de1 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 _0x0585=['remove','update','emit','removeListener','register','whatsappQueue:','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0585,0x1b1));var _0x5058=function(_0x4dc929,_0x10d717){_0x4dc929=_0x4dc929-0x0;var _0xd45ef9=_0x0585[_0x4dc929];return _0xd45ef9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x5058('0x0'),_0x5058('0x1'),_0x5058('0x2')];function createListener(_0x38f7dd,_0x4f19d5){return function(_0xe3403b){_0x4f19d5[_0x5058('0x3')](_0x38f7dd,_0xe3403b);};}function removeListener(_0x5cf23e,_0x5aad8b){return function(){WhatsappQueueEvents[_0x5058('0x4')](_0x5cf23e,_0x5aad8b);};}exports[_0x5058('0x5')]=function(_0x5df883){for(var _0x39bfba=0x0,_0x55da75=events['length'];_0x39bfba<_0x55da75;_0x39bfba++){var _0x152c7a=events[_0x39bfba];var _0xc60957=createListener(_0x5058('0x6')+_0x152c7a,_0x5df883);WhatsappQueueEvents['on'](_0x152c7a,_0xc60957);}}; \ No newline at end of file +var _0xb02e=['./whatsappQueue.events','remove','update','length','whatsappQueue:'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xb02e,0xf5));var _0xeb02=function(_0xba98ec,_0x103d15){_0xba98ec=_0xba98ec-0x0;var _0x57d7d0=_0xb02e[_0xba98ec];return _0x57d7d0;};'use strict';var WhatsappQueueEvents=require(_0xeb02('0x0'));var events=['save',_0xeb02('0x1'),_0xeb02('0x2')];function createListener(_0x5e3d8a,_0x3a3bc3){return function(_0x33f153){_0x3a3bc3['emit'](_0x5e3d8a,_0x33f153);};}function removeListener(_0x4bf101,_0x3a34b7){return function(){WhatsappQueueEvents['removeListener'](_0x4bf101,_0x3a34b7);};}exports['register']=function(_0x16fb46){for(var _0x4e89cd=0x0,_0x5ada83=events[_0xeb02('0x3')];_0x4e89cd<_0x5ada83;_0x4e89cd++){var _0x5bd3bf=events[_0x4e89cd];var _0x53dfa3=createListener(_0xeb02('0x4')+_0x5bd3bf,_0x16fb46);WhatsappQueueEvents['on'](_0x5bd3bf,_0x53dfa3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 22c995c..bfba948 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 _0xad72=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0xad72,0xe4));var _0x2ad7=function(_0x248557,_0x52823a){_0x248557=_0x248557-0x0;var _0xbb251e=_0xad72[_0x248557];return _0xbb251e;};'use strict';var multer=require(_0x2ad7('0x0'));var util=require(_0x2ad7('0x1'));var path=require(_0x2ad7('0x2'));var timeout=require(_0x2ad7('0x3'));var express=require(_0x2ad7('0x4'));var router=express[_0x2ad7('0x5')]();var fs_extra=require(_0x2ad7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2ad7('0x7'));var config=require('../../config/environment');var controller=require(_0x2ad7('0x8'));router[_0x2ad7('0x9')]('/',auth[_0x2ad7('0xa')](),controller[_0x2ad7('0xb')]);router[_0x2ad7('0x9')](_0x2ad7('0xc'),auth[_0x2ad7('0xa')](),controller[_0x2ad7('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2ad7('0xe')]('/',auth['isAuthenticated'](),controller[_0x2ad7('0xf')]);router[_0x2ad7('0x10')](_0x2ad7('0x11'),auth['isAuthenticated'](),controller[_0x2ad7('0x12')]);router['delete'](_0x2ad7('0x11'),auth[_0x2ad7('0xa')](),controller[_0x2ad7('0x13')]);module[_0x2ad7('0x14')]=router; \ No newline at end of file +var _0xef8e=['index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xef8e,0x1f0));var _0xeef8=function(_0x499126,_0x524cda){_0x499126=_0x499126-0x0;var _0x36fe1c=_0xef8e[_0x499126];return _0x36fe1c;};'use strict';var multer=require(_0xeef8('0x0'));var util=require(_0xeef8('0x1'));var path=require(_0xeef8('0x2'));var timeout=require(_0xeef8('0x3'));var express=require(_0xeef8('0x4'));var router=express[_0xeef8('0x5')]();var fs_extra=require(_0xeef8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeef8('0x7'));var config=require(_0xeef8('0x8'));var controller=require(_0xeef8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xeef8('0xa')]);router[_0xeef8('0xb')](_0xeef8('0xc'),auth[_0xeef8('0xd')](),controller[_0xeef8('0xe')]);router['get'](_0xeef8('0xf'),auth['isAuthenticated'](),controller[_0xeef8('0x10')]);router[_0xeef8('0x11')]('/',auth[_0xeef8('0xd')](),controller[_0xeef8('0x12')]);router[_0xeef8('0x13')](_0xeef8('0xf'),auth[_0xeef8('0xd')](),controller[_0xeef8('0x14')]);router[_0xeef8('0x15')]('/:id',auth[_0xeef8('0xd')](),controller['destroy']);module[_0xeef8('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8f8dfa5..c51300f 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4ed764,_0x3be5e9){var _0x5e431c=function(_0x1e2c2a){while(--_0x1e2c2a){_0x4ed764['push'](_0x4ed764['shift']());}};_0x5e431c(++_0x3be5e9);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2900ac,_0x3dd23d){var _0x4e4e8c=function(_0x48d6b5){while(--_0x48d6b5){_0x2900ac['push'](_0x2900ac['shift']());}};_0x4e4e8c(++_0x3dd23d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e0a0c87..831733c 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 _0x9ffd=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x40e8bc,_0x2b1ae6){_0x40e8bc=_0x40e8bc-0x0;var _0x274624=_0x9ffd[_0x40e8bc];return _0x274624;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca906,_0x4d86fe){return function(_0x285002){if(!_0x285002){_0x3ca906['sendStatus'](0x194);}return _0x285002;};}function handleError(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0x1f4;return function(_0x2138b4){logger[_0xd9ff('0x26')](_0x2138b4['stack']);if(_0x2138b4[_0xd9ff('0x27')]){delete _0x2138b4[_0xd9ff('0x27')];}_0x10cbdd[_0xd9ff('0x1b')](_0x159e56)[_0xd9ff('0x28')](_0x2138b4);};}exports['index']=function(_0x1d3684,_0x3792d9){var _0x44b5a7={},_0x45fb63={},_0x263d3a={'count':0x0,'rows':[]};var _0xe516e2=_[_0xd9ff('0x29')](db[_0xd9ff('0x2a')][_0xd9ff('0x2b')],function(_0x5706cf){return{'name':_0x5706cf[_0xd9ff('0x2c')],'type':_0x5706cf['type'][_0xd9ff('0x2d')]};});_0x45fb63[_0xd9ff('0x2e')]=_[_0xd9ff('0x29')](_0xe516e2,'name');_0x45fb63[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x1d3684[_0xd9ff('0x2f')]);_0x45fb63[_0xd9ff('0x31')]=_['intersection'](_0x45fb63[_0xd9ff('0x2e')],_0x45fb63['query']);_0x44b5a7[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x45fb63[_0xd9ff('0x2e')],qs[_0xd9ff('0x34')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x44b5a7[_0xd9ff('0x32')]=_0x44b5a7[_0xd9ff('0x32')][_0xd9ff('0x35')]?_0x44b5a7[_0xd9ff('0x32')]:_0x45fb63[_0xd9ff('0x2e')];if(!_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x36')](_0xd9ff('0x37'))){_0x44b5a7['limit']=qs[_0xd9ff('0x20')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x20')]);_0x44b5a7['offset']=qs[_0xd9ff('0x1f')](_0x1d3684['query'][_0xd9ff('0x1f')]);}_0x44b5a7['order']=qs[_0xd9ff('0x38')](_0x1d3684['query'][_0xd9ff('0x38')]);_0x44b5a7[_0xd9ff('0x39')]=qs[_0xd9ff('0x31')](_['pick'](_0x1d3684['query'],_0x45fb63['filters']),_0xe516e2);if(_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]){_0x44b5a7[_0xd9ff('0x39')]=_[_0xd9ff('0x3b')](_0x44b5a7[_0xd9ff('0x39')],{'$or':_[_0xd9ff('0x29')](_0xe516e2,function(_0x596d29){if(_0x596d29['type']!=='VIRTUAL'){var _0x316d93={};_0x316d93[_0x596d29[_0xd9ff('0x27')]]={'$like':'%'+_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]+'%'};return _0x316d93;}})});}_0x44b5a7=_['merge']({},_0x44b5a7,_0x1d3684[_0xd9ff('0x3c')]);var _0x5b8e17={'where':_0x44b5a7[_0xd9ff('0x39')]};return db[_0xd9ff('0x2a')][_0xd9ff('0x1e')](_0x5b8e17)[_0xd9ff('0x25')](function(_0x59fc07){_0x263d3a[_0xd9ff('0x1e')]=_0x59fc07;if(_0x1d3684[_0xd9ff('0x2f')]['includeAll']){_0x44b5a7[_0xd9ff('0x3d')]=[{'all':!![]}];}return db[_0xd9ff('0x2a')][_0xd9ff('0x3e')](_0x44b5a7);})[_0xd9ff('0x25')](function(_0x1fe44d){_0x263d3a[_0xd9ff('0x3f')]=_0x1fe44d;return _0x263d3a;})['then'](respondWithFilteredResult(_0x3792d9,_0x44b5a7))[_0xd9ff('0x40')](handleError(_0x3792d9,null));};exports[_0xd9ff('0x41')]=function(_0x10533a,_0x39fbbb){var _0x472724={'raw':!![],'where':{'id':_0x10533a[_0xd9ff('0x42')]['id']}},_0x52aab8={};_0x52aab8[_0xd9ff('0x2e')]=_[_0xd9ff('0x30')](db['WhatsappQueueReport']['rawAttributes']);_0x52aab8[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x10533a[_0xd9ff('0x2f')]);_0x52aab8[_0xd9ff('0x31')]=_[_0xd9ff('0x33')](_0x52aab8[_0xd9ff('0x2e')],_0x52aab8['query']);_0x472724[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x52aab8['model'],qs[_0xd9ff('0x34')](_0x10533a[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x472724[_0xd9ff('0x32')]=_0x472724[_0xd9ff('0x32')]['length']?_0x472724['attributes']:_0x52aab8['model'];if(_0x10533a[_0xd9ff('0x2f')]['includeAll']){_0x472724[_0xd9ff('0x3d')]=[{'all':!![]}];}_0x472724=_[_0xd9ff('0x3b')]({},_0x472724,_0x10533a[_0xd9ff('0x3c')]);return db['WhatsappQueueReport'][_0xd9ff('0x43')](_0x472724)[_0xd9ff('0x25')](handleEntityNotFound(_0x39fbbb,null))['then'](respondWithResult(_0x39fbbb,null))[_0xd9ff('0x40')](handleError(_0x39fbbb,null));};exports[_0xd9ff('0x44')]=function(_0x23b224,_0x316854){return db['WhatsappQueueReport'][_0xd9ff('0x44')](_0x23b224['body'],{})[_0xd9ff('0x25')](respondWithResult(_0x316854,0xc9))['catch'](handleError(_0x316854,null));};exports[_0xd9ff('0x24')]=function(_0x3d91e6,_0x2bf37a){if(_0x3d91e6[_0xd9ff('0x45')]['id']){delete _0x3d91e6[_0xd9ff('0x45')]['id'];}return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x3d91e6[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x2bf37a,null))[_0xd9ff('0x25')](saveUpdates(_0x3d91e6['body'],null))['then'](respondWithResult(_0x2bf37a,null))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x46')]=function(_0x40be56,_0x29c6bd){return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x40be56[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x29c6bd,null))[_0xd9ff('0x25')](removeEntity(_0x29c6bd,null))[_0xd9ff('0x40')](handleError(_0x29c6bd,null));};exports[_0xd9ff('0x47')]=function(_0x43a8ae,_0x1e1364){return db[_0xd9ff('0x2a')][_0xd9ff('0x47')]()[_0xd9ff('0x25')](respondWithResult(_0x1e1364,null))[_0xd9ff('0x40')](handleError(_0x1e1364,null));}; \ No newline at end of file +var _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x10a1b3,_0x5ddfc3){_0x10a1b3=_0x10a1b3-0x0;var _0x26c02b=_0xd4f4[_0x10a1b3];return _0x26c02b;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4196f6f..b2bb5a7 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 _0xe536=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe536,0x97));var _0x6e53=function(_0x4c3837,_0x2e9491){_0x4c3837=_0x4c3837-0x0;var _0x149c80=_0xe536[_0x4c3837];return _0x149c80;};'use strict';var _=require(_0x6e53('0x0'));var util=require(_0x6e53('0x1'));var logger=require(_0x6e53('0x2'))('api');var moment=require(_0x6e53('0x3'));var BPromise=require(_0x6e53('0x4'));var rp=require(_0x6e53('0x5'));var fs=require('fs');var path=require(_0x6e53('0x6'));var rimraf=require(_0x6e53('0x7'));var config=require(_0x6e53('0x8'));var attributes=require(_0x6e53('0x9'));module[_0x6e53('0xa')]=function(_0x54fbd2,_0x374fbc){return _0x54fbd2[_0x6e53('0xb')](_0x6e53('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6e53('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x497e=['rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash','api','moment','request-promise'];(function(_0x3494fc,_0x4d6827){var _0x54b144=function(_0x37fd17){while(--_0x37fd17){_0x3494fc['push'](_0x3494fc['shift']());}};_0x54b144(++_0x4d6827);}(_0x497e,0x196));var _0xe497=function(_0x42a24d,_0x2c90ea){_0x42a24d=_0x42a24d-0x0;var _0x2910bb=_0x497e[_0x42a24d];return _0x2910bb;};'use strict';var _=require(_0xe497('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe497('0x1'));var moment=require(_0xe497('0x2'));var BPromise=require('bluebird');var rp=require(_0xe497('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe497('0x4'));var config=require('../../config/environment');var attributes=require(_0xe497('0x5'));module[_0xe497('0x6')]=function(_0x5c8f14,_0x2b01a6){return _0x5c8f14[_0xe497('0x7')](_0xe497('0x8'),attributes,{'tableName':_0xe497('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4b3f0b8..8b4eb63 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 _0x8f02=['../../config/logger','rpc','client','http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8f02,0xc5));var _0x28f0=function(_0x2eb2a3,_0x49f561){_0x2eb2a3=_0x2eb2a3-0x0;var _0x3f578b=_0x8f02[_0x2eb2a3];return _0x3f578b;};'use strict';var _=require(_0x28f0('0x0'));var util=require(_0x28f0('0x1'));var moment=require(_0x28f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x28f0('0x3'));var fs=require('fs');var Redis=require(_0x28f0('0x4'));var db=require(_0x28f0('0x5'))['db'];var utils=require(_0x28f0('0x6'));var logger=require(_0x28f0('0x7'))(_0x28f0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28f0('0x9')][_0x28f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4326e1,_0x3d8385,_0x4f663c){return new BPromise(function(_0x57504c,_0x1564dc){return client[_0x28f0('0xb')](_0x4326e1,_0x4f663c)[_0x28f0('0xc')](function(_0x3dfc6e){logger[_0x28f0('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d8385,'request\x20sent');logger[_0x28f0('0xe')](_0x28f0('0xf'),_0x3d8385,_0x28f0('0x10'),JSON[_0x28f0('0x11')](_0x3dfc6e));if(_0x3dfc6e['error']){if(_0x3dfc6e[_0x28f0('0x12')][_0x28f0('0x13')]===0x1f4){logger[_0x28f0('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d8385,_0x3dfc6e[_0x28f0('0x12')][_0x28f0('0x14')]);return _0x1564dc(_0x3dfc6e[_0x28f0('0x12')]['message']);}logger['error'](_0x28f0('0x15'),_0x3d8385,_0x3dfc6e[_0x28f0('0x12')][_0x28f0('0x14')]);return _0x57504c(_0x3dfc6e[_0x28f0('0x12')]['message']);}else{logger[_0x28f0('0xd')](_0x28f0('0x15'),_0x3d8385,'request\x20sent');_0x57504c(_0x3dfc6e[_0x28f0('0x16')][_0x28f0('0x14')]);}})[_0x28f0('0x17')](function(_0x21d534){logger[_0x28f0('0x12')](_0x28f0('0x15'),_0x3d8385,_0x21d534);_0x1564dc(_0x21d534);});});}exports['CreateWhatsappQueueReport']=function(_0x25af92){var _0x3650a4=this;return new Promise(function(_0x5177f9,_0x16c150){return db[_0x28f0('0x18')][_0x28f0('0x19')](_0x25af92[_0x28f0('0x1a')],{'raw':_0x25af92[_0x28f0('0x1b')]?_0x25af92[_0x28f0('0x1b')][_0x28f0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x499ea8){logger[_0x28f0('0xd')](_0x28f0('0x1d'),_0x25af92);logger[_0x28f0('0xe')](_0x28f0('0x1d'),_0x25af92,JSON[_0x28f0('0x11')](_0x499ea8));_0x5177f9(_0x499ea8);})['catch'](function(_0x159855){logger[_0x28f0('0x12')]('CreateWhatsappQueueReport',_0x159855[_0x28f0('0x14')],_0x25af92);_0x16c150(_0x3650a4['error'](0x1f4,_0x159855[_0x28f0('0x14')]));});});};exports[_0x28f0('0x1e')]=function(_0x46782f){var _0x36f058=this;return new Promise(function(_0x53bf48,_0x548162){return db[_0x28f0('0x18')][_0x28f0('0x1f')](_0x46782f['body'],{'raw':_0x46782f[_0x28f0('0x1b')]?_0x46782f[_0x28f0('0x1b')][_0x28f0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46782f[_0x28f0('0x1b')]?_0x46782f[_0x28f0('0x1b')][_0x28f0('0x20')]||null:null,'attributes':_0x46782f[_0x28f0('0x1b')]?_0x46782f[_0x28f0('0x1b')]['attributes']||null:null,'limit':_0x46782f['options']?_0x46782f[_0x28f0('0x1b')][_0x28f0('0x21')]||null:null})[_0x28f0('0xc')](function(_0x52d4ee){logger['info']('UpdateWhatsappQueueReport',_0x46782f);logger[_0x28f0('0xe')](_0x28f0('0x1e'),_0x46782f,JSON[_0x28f0('0x11')](_0x52d4ee));_0x53bf48(_0x52d4ee);})['catch'](function(_0xf53a64){logger[_0x28f0('0x12')]('UpdateWhatsappQueueReport',_0xf53a64[_0x28f0('0x14')],_0x46782f);_0x548162(_0x36f058['error'](0x1f4,_0xf53a64[_0x28f0('0x14')]));});});}; \ No newline at end of file +var _0x05fc=['http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','debug','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x05fc,0x1e7));var _0xc05f=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x05fc[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0xc05f('0x0'));var moment=require(_0xc05f('0x1'));var BPromise=require(_0xc05f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc05f('0x4'))('rpc');var config=require(_0xc05f('0x5'));var jayson=require(_0xc05f('0x6'));var client=jayson[_0xc05f('0x7')][_0xc05f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40efa0,_0x564492,_0x549fe7){return new BPromise(function(_0x681701,_0x1d9ea1){return client[_0xc05f('0x9')](_0x40efa0,_0x549fe7)[_0xc05f('0xa')](function(_0x5c2b54){logger[_0xc05f('0xb')](_0xc05f('0xc'),_0x564492,_0xc05f('0xd'));logger['debug'](_0xc05f('0xe'),_0x564492,_0xc05f('0xd'),JSON[_0xc05f('0xf')](_0x5c2b54));if(_0x5c2b54['error']){if(_0x5c2b54['error'][_0xc05f('0x10')]===0x1f4){logger[_0xc05f('0x11')](_0xc05f('0xc'),_0x564492,_0x5c2b54[_0xc05f('0x11')][_0xc05f('0x12')]);return _0x1d9ea1(_0x5c2b54[_0xc05f('0x11')][_0xc05f('0x12')]);}logger[_0xc05f('0x11')](_0xc05f('0xc'),_0x564492,_0x5c2b54['error'][_0xc05f('0x12')]);return _0x681701(_0x5c2b54[_0xc05f('0x11')][_0xc05f('0x12')]);}else{logger['info'](_0xc05f('0xc'),_0x564492,_0xc05f('0xd'));_0x681701(_0x5c2b54[_0xc05f('0x13')][_0xc05f('0x12')]);}})[_0xc05f('0x14')](function(_0x50c322){logger[_0xc05f('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x564492,_0x50c322);_0x1d9ea1(_0x50c322);});});}exports[_0xc05f('0x15')]=function(_0x5acce1){var _0x621a4d=this;return new Promise(function(_0x2d97ac,_0x20e3e3){return db[_0xc05f('0x16')][_0xc05f('0x17')](_0x5acce1[_0xc05f('0x18')],{'raw':_0x5acce1[_0xc05f('0x19')]?_0x5acce1['options'][_0xc05f('0x1a')]===undefined?!![]:![]:!![]})[_0xc05f('0xa')](function(_0x4d2d5c){logger['info']('CreateWhatsappQueueReport',_0x5acce1);logger['debug'](_0xc05f('0x15'),_0x5acce1,JSON[_0xc05f('0xf')](_0x4d2d5c));_0x2d97ac(_0x4d2d5c);})['catch'](function(_0x25e274){logger[_0xc05f('0x11')](_0xc05f('0x15'),_0x25e274[_0xc05f('0x12')],_0x5acce1);_0x20e3e3(_0x621a4d['error'](0x1f4,_0x25e274[_0xc05f('0x12')]));});});};exports[_0xc05f('0x1b')]=function(_0x2b03e6){var _0x17d273=this;return new Promise(function(_0xb1fc04,_0x34979e){return db[_0xc05f('0x16')][_0xc05f('0x1c')](_0x2b03e6[_0xc05f('0x18')],{'raw':_0x2b03e6['options']?_0x2b03e6[_0xc05f('0x19')][_0xc05f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b03e6[_0xc05f('0x19')]?_0x2b03e6[_0xc05f('0x19')][_0xc05f('0x1d')]||null:null,'attributes':_0x2b03e6[_0xc05f('0x19')]?_0x2b03e6['options'][_0xc05f('0x1e')]||null:null,'limit':_0x2b03e6[_0xc05f('0x19')]?_0x2b03e6[_0xc05f('0x19')][_0xc05f('0x1f')]||null:null})['then'](function(_0x422b10){logger[_0xc05f('0xb')](_0xc05f('0x1b'),_0x2b03e6);logger[_0xc05f('0x20')](_0xc05f('0x1b'),_0x2b03e6,JSON[_0xc05f('0xf')](_0x422b10));_0xb1fc04(_0x422b10);})[_0xc05f('0x14')](function(_0x4fec3a){logger[_0xc05f('0x11')](_0xc05f('0x1b'),_0x4fec3a['message'],_0x2b03e6);_0x34979e(_0x17d273[_0xc05f('0x11')](0x1f4,_0x4fec3a[_0xc05f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 56ddcc8..ba7261e 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 _0xa11e=['/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xa11e,0x148));var _0xea11=function(_0x40a247,_0x1cfaa6){_0x40a247=_0x40a247-0x0;var _0x4d15ea=_0xa11e[_0x40a247];return _0x4d15ea;};'use strict';var multer=require(_0xea11('0x0'));var util=require('util');var path=require(_0xea11('0x1'));var timeout=require(_0xea11('0x2'));var express=require(_0xea11('0x3'));var router=express[_0xea11('0x4')]();var fs_extra=require(_0xea11('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea11('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xea11('0x7')]('/',auth[_0xea11('0x8')](),controller[_0xea11('0x9')]);router[_0xea11('0x7')](_0xea11('0xa'),auth['isAuthenticated'](),controller[_0xea11('0xb')]);router[_0xea11('0x7')](_0xea11('0xc'),auth[_0xea11('0x8')](),controller['show']);router[_0xea11('0xd')]('/',auth[_0xea11('0x8')](),controller[_0xea11('0xe')]);router[_0xea11('0xf')](_0xea11('0xc'),auth[_0xea11('0x8')](),controller[_0xea11('0x10')]);router[_0xea11('0x11')]('/:id',auth[_0xea11('0x8')](),controller[_0xea11('0x12')]);module[_0xea11('0x13')]=router; \ No newline at end of file +var _0x8aae=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x546fc7,_0x5dfc79){var _0x429e56=function(_0x2dfe9b){while(--_0x2dfe9b){_0x546fc7['push'](_0x546fc7['shift']());}};_0x429e56(++_0x5dfc79);}(_0x8aae,0xf5));var _0xe8aa=function(_0x3c076a,_0x1f8c31){_0x3c076a=_0x3c076a-0x0;var _0x4cac5f=_0x8aae[_0x3c076a];return _0x4cac5f;};'use strict';var multer=require(_0xe8aa('0x0'));var util=require(_0xe8aa('0x1'));var path=require(_0xe8aa('0x2'));var timeout=require(_0xe8aa('0x3'));var express=require(_0xe8aa('0x4'));var router=express['Router']();var fs_extra=require(_0xe8aa('0x5'));var auth=require(_0xe8aa('0x6'));var interaction=require(_0xe8aa('0x7'));var config=require(_0xe8aa('0x8'));var controller=require(_0xe8aa('0x9'));router[_0xe8aa('0xa')]('/',auth[_0xe8aa('0xb')](),controller[_0xe8aa('0xc')]);router[_0xe8aa('0xa')](_0xe8aa('0xd'),auth[_0xe8aa('0xb')](),controller[_0xe8aa('0xe')]);router[_0xe8aa('0xa')](_0xe8aa('0xf'),auth['isAuthenticated'](),controller[_0xe8aa('0x10')]);router[_0xe8aa('0x11')]('/',auth[_0xe8aa('0xb')](),controller[_0xe8aa('0x12')]);router[_0xe8aa('0x13')](_0xe8aa('0xf'),auth[_0xe8aa('0xb')](),controller[_0xe8aa('0x14')]);router[_0xe8aa('0x15')](_0xe8aa('0xf'),auth[_0xe8aa('0xb')](),controller[_0xe8aa('0x16')]);module[_0xe8aa('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 67b429a..422422e 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 _0x8814=['sequelize','ENUM','agent','queue','DATE'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8814,0x1b8));var _0x4881=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x8814[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0x4881('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4881('0x1')]('account',_0x4881('0x2'),_0x4881('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4881('0x4')]}}; \ No newline at end of file +var _0xfd7b=['exports','STRING','account','agent','queue','sequelize'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xfd7b[_0x4e93a9];return _0x43013c;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'uniqueid':{'type':Sequelize[_0xbfd7('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbfd7('0x3'),_0xbfd7('0x4'),_0xbfd7('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 73fb2a8..e5d359f 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 _0xce38=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring'];(function(_0x1d5bec,_0x2fcd83){var _0x349ce6=function(_0x5b2125){while(--_0x5b2125){_0x1d5bec['push'](_0x1d5bec['shift']());}};_0x349ce6(++_0x2fcd83);}(_0xce38,0x8d));var _0x8ce3=function(_0x187f71,_0xf40f00){_0x187f71=_0x187f71-0x0;var _0xdf027a=_0xce38[_0x187f71];return _0xdf027a;};'use strict';var emlformat=require(_0x8ce3('0x0'));var rimraf=require(_0x8ce3('0x1'));var zipdir=require(_0x8ce3('0x2'));var jsonpatch=require(_0x8ce3('0x3'));var rp=require(_0x8ce3('0x4'));var moment=require(_0x8ce3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8ce3('0x6'));var util=require(_0x8ce3('0x7'));var path=require(_0x8ce3('0x8'));var sox=require('sox');var csv=require(_0x8ce3('0x9'));var ejs=require(_0x8ce3('0xa'));var fs=require('fs');var fs_extra=require(_0x8ce3('0xb'));var _=require('lodash');var squel=require(_0x8ce3('0xc'));var crypto=require(_0x8ce3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ce3('0x9'));var querystring=require(_0x8ce3('0xe'));var Papa=require(_0x8ce3('0xf'));var Redis=require(_0x8ce3('0x10'));var authService=require(_0x8ce3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ce3('0x12'));var hardwareService=require(_0x8ce3('0x13'));var logger=require(_0x8ce3('0x14'))('api');var utils=require(_0x8ce3('0x15'));var config=require(_0x8ce3('0x16'));var licenseUtil=require(_0x8ce3('0x17'));var db=require(_0x8ce3('0x18'))['db'];function respondWithStatusCode(_0x394cd6,_0x2764ea){_0x2764ea=_0x2764ea||0xcc;return function(_0x29ba26){if(_0x29ba26){return _0x394cd6[_0x8ce3('0x19')](_0x2764ea);}return _0x394cd6[_0x8ce3('0x1a')](_0x2764ea)[_0x8ce3('0x1b')]();};}function respondWithResult(_0x498e4a,_0x3d2edc){_0x3d2edc=_0x3d2edc||0xc8;return function(_0x32a6c8){if(_0x32a6c8){return _0x498e4a[_0x8ce3('0x1a')](_0x3d2edc)[_0x8ce3('0x1c')](_0x32a6c8);}};}function respondWithFilteredResult(_0x4b6ecc,_0xab3d3c){return function(_0x4d9132){if(_0x4d9132){var _0x1172f3=typeof _0xab3d3c[_0x8ce3('0x1d')]===_0x8ce3('0x1e')&&typeof _0xab3d3c[_0x8ce3('0x1f')]==='undefined';var _0xf5c786=_0x4d9132[_0x8ce3('0x20')];var _0x301095=_0x1172f3?0x0:_0xab3d3c[_0x8ce3('0x1d')];var _0x428291=_0x1172f3?_0x4d9132['count']:_0xab3d3c[_0x8ce3('0x1d')]+_0xab3d3c[_0x8ce3('0x1f')];var _0x45b365;if(_0x428291>=_0xf5c786){_0x428291=_0xf5c786;_0x45b365=0xc8;}else{_0x45b365=0xce;}_0x4b6ecc[_0x8ce3('0x1a')](_0x45b365);return _0x4b6ecc[_0x8ce3('0x21')](_0x8ce3('0x22'),_0x301095+'-'+_0x428291+'/'+_0xf5c786)[_0x8ce3('0x1c')](_0x4d9132);}return null;};}function patchUpdates(_0x5aac9d){return function(_0x1028ae){try{jsonpatch[_0x8ce3('0x23')](_0x1028ae,_0x5aac9d,!![]);}catch(_0x13ae5b){return BPromise[_0x8ce3('0x24')](_0x13ae5b);}return _0x1028ae[_0x8ce3('0x25')]();};}function saveUpdates(_0x2bac1a,_0xf0d6ff){return function(_0x45992d){if(_0x45992d){return _0x45992d[_0x8ce3('0x26')](_0x2bac1a)['then'](function(_0x115bff){return _0x115bff;});}return null;};}function removeEntity(_0x3c8092,_0x4b85ed){return function(_0x567084){if(_0x567084){return _0x567084[_0x8ce3('0x27')]()[_0x8ce3('0x28')](function(){_0x3c8092[_0x8ce3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b0e83,_0x550655){return function(_0x1163cc){if(!_0x1163cc){_0x8b0e83['sendStatus'](0x194);}return _0x1163cc;};}function handleError(_0x36b2b4,_0x2a39db){_0x2a39db=_0x2a39db||0x1f4;return function(_0x176592){logger[_0x8ce3('0x29')](_0x176592[_0x8ce3('0x2a')]);if(_0x176592[_0x8ce3('0x2b')]){delete _0x176592[_0x8ce3('0x2b')];}_0x36b2b4[_0x8ce3('0x1a')](_0x2a39db)[_0x8ce3('0x2c')](_0x176592);};}exports[_0x8ce3('0x2d')]=function(_0x49e940,_0x4c0c5a){var _0x5b0d83={},_0x237b11={},_0x530ba9={'count':0x0,'rows':[]};var _0x16296d=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x41afb1){return{'name':_0x41afb1[_0x8ce3('0x2e')],'type':_0x41afb1[_0x8ce3('0x2f')]['key']};});_0x237b11[_0x8ce3('0x30')]=_['map'](_0x16296d,_0x8ce3('0x2b'));_0x237b11[_0x8ce3('0x31')]=_['keys'](_0x49e940[_0x8ce3('0x31')]);_0x237b11[_0x8ce3('0x32')]=_[_0x8ce3('0x33')](_0x237b11[_0x8ce3('0x30')],_0x237b11[_0x8ce3('0x31')]);_0x5b0d83[_0x8ce3('0x34')]=_[_0x8ce3('0x33')](_0x237b11[_0x8ce3('0x30')],qs[_0x8ce3('0x35')](_0x49e940[_0x8ce3('0x31')]['fields']));_0x5b0d83[_0x8ce3('0x34')]=_0x5b0d83['attributes'][_0x8ce3('0x36')]?_0x5b0d83[_0x8ce3('0x34')]:_0x237b11[_0x8ce3('0x30')];if(!_0x49e940[_0x8ce3('0x31')][_0x8ce3('0x37')](_0x8ce3('0x38'))){_0x5b0d83[_0x8ce3('0x1f')]=qs[_0x8ce3('0x1f')](_0x49e940['query'][_0x8ce3('0x1f')]);_0x5b0d83[_0x8ce3('0x1d')]=qs[_0x8ce3('0x1d')](_0x49e940[_0x8ce3('0x31')][_0x8ce3('0x1d')]);}_0x5b0d83[_0x8ce3('0x39')]=qs[_0x8ce3('0x3a')](_0x49e940[_0x8ce3('0x31')][_0x8ce3('0x3a')]);_0x5b0d83['where']=qs['filters'](_[_0x8ce3('0x3b')](_0x49e940[_0x8ce3('0x31')],_0x237b11[_0x8ce3('0x32')]),_0x16296d);if(_0x49e940[_0x8ce3('0x31')][_0x8ce3('0x3c')]){_0x5b0d83[_0x8ce3('0x3d')]=_[_0x8ce3('0x3e')](_0x5b0d83['where'],{'$or':_[_0x8ce3('0x3f')](_0x16296d,function(_0x28e73d){if(_0x28e73d[_0x8ce3('0x2f')]!==_0x8ce3('0x40')){var _0x30fdd5={};_0x30fdd5[_0x28e73d[_0x8ce3('0x2b')]]={'$like':'%'+_0x49e940['query'][_0x8ce3('0x3c')]+'%'};return _0x30fdd5;}})});}_0x5b0d83=_['merge']({},_0x5b0d83,_0x49e940[_0x8ce3('0x41')]);var _0x515531={'where':_0x5b0d83[_0x8ce3('0x3d')]};return db[_0x8ce3('0x42')]['count'](_0x515531)[_0x8ce3('0x28')](function(_0x4b6886){_0x530ba9[_0x8ce3('0x20')]=_0x4b6886;if(_0x49e940['query'][_0x8ce3('0x43')]){_0x5b0d83[_0x8ce3('0x44')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x8ce3('0x45')](_0x5b0d83);})['then'](function(_0x52bede){_0x530ba9['rows']=_0x52bede;return _0x530ba9;})[_0x8ce3('0x28')](respondWithFilteredResult(_0x4c0c5a,_0x5b0d83))[_0x8ce3('0x46')](handleError(_0x4c0c5a,null));};exports['show']=function(_0x5b7921,_0x4874c0){var _0x21235c={'raw':!![],'where':{'id':_0x5b7921[_0x8ce3('0x47')]['id']}},_0x1ed559={};_0x1ed559[_0x8ce3('0x30')]=_[_0x8ce3('0x48')](db['WhatsappTransferReport'][_0x8ce3('0x49')]);_0x1ed559['query']=_[_0x8ce3('0x48')](_0x5b7921[_0x8ce3('0x31')]);_0x1ed559[_0x8ce3('0x32')]=_['intersection'](_0x1ed559[_0x8ce3('0x30')],_0x1ed559['query']);_0x21235c['attributes']=_[_0x8ce3('0x33')](_0x1ed559[_0x8ce3('0x30')],qs[_0x8ce3('0x35')](_0x5b7921[_0x8ce3('0x31')][_0x8ce3('0x35')]));_0x21235c[_0x8ce3('0x34')]=_0x21235c[_0x8ce3('0x34')][_0x8ce3('0x36')]?_0x21235c[_0x8ce3('0x34')]:_0x1ed559[_0x8ce3('0x30')];if(_0x5b7921[_0x8ce3('0x31')][_0x8ce3('0x43')]){_0x21235c[_0x8ce3('0x44')]=[{'all':!![]}];}_0x21235c=_[_0x8ce3('0x3e')]({},_0x21235c,_0x5b7921[_0x8ce3('0x41')]);return db[_0x8ce3('0x42')][_0x8ce3('0x4a')](_0x21235c)[_0x8ce3('0x28')](handleEntityNotFound(_0x4874c0,null))[_0x8ce3('0x28')](respondWithResult(_0x4874c0,null))[_0x8ce3('0x46')](handleError(_0x4874c0,null));};exports[_0x8ce3('0x4b')]=function(_0x596949,_0x2ee6b6){return db[_0x8ce3('0x42')][_0x8ce3('0x4b')](_0x596949[_0x8ce3('0x4c')],{})[_0x8ce3('0x28')](respondWithResult(_0x2ee6b6,0xc9))[_0x8ce3('0x46')](handleError(_0x2ee6b6,null));};exports['update']=function(_0x237ded,_0x535eeb){if(_0x237ded['body']['id']){delete _0x237ded[_0x8ce3('0x4c')]['id'];}return db[_0x8ce3('0x42')]['find']({'where':{'id':_0x237ded['params']['id']}})[_0x8ce3('0x28')](handleEntityNotFound(_0x535eeb,null))['then'](saveUpdates(_0x237ded[_0x8ce3('0x4c')],null))[_0x8ce3('0x28')](respondWithResult(_0x535eeb,null))[_0x8ce3('0x46')](handleError(_0x535eeb,null));};exports[_0x8ce3('0x27')]=function(_0x3d0754,_0x1fbd4f){return db[_0x8ce3('0x42')][_0x8ce3('0x4a')]({'where':{'id':_0x3d0754[_0x8ce3('0x47')]['id']}})[_0x8ce3('0x28')](handleEntityNotFound(_0x1fbd4f,null))['then'](removeEntity(_0x1fbd4f,null))['catch'](handleError(_0x1fbd4f,null));};exports[_0x8ce3('0x4d')]=function(_0x132ac9,_0x3d755a){return db[_0x8ce3('0x42')][_0x8ce3('0x4d')]()[_0x8ce3('0x28')](respondWithResult(_0x3d755a,null))['catch'](handleError(_0x3d755a,null));}; \ No newline at end of file +var _0x6acf=['include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6acf,0x1d5));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6ac('0x0'));var rimraf=require(_0xf6ac('0x1'));var zipdir=require(_0xf6ac('0x2'));var jsonpatch=require(_0xf6ac('0x3'));var rp=require('request-promise');var moment=require(_0xf6ac('0x4'));var BPromise=require(_0xf6ac('0x5'));var Mustache=require('mustache');var util=require(_0xf6ac('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6ac('0x7'));var fs=require('fs');var fs_extra=require(_0xf6ac('0x8'));var _=require(_0xf6ac('0x9'));var squel=require(_0xf6ac('0xa'));var crypto=require('crypto');var jsforce=require(_0xf6ac('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6ac('0xc'));var querystring=require('querystring');var Papa=require(_0xf6ac('0xd'));var Redis=require(_0xf6ac('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf6ac('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6ac('0x10'));var logger=require(_0xf6ac('0x11'))(_0xf6ac('0x12'));var utils=require(_0xf6ac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf6ac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x411e1d,_0x48f482){_0x48f482=_0x48f482||0xcc;return function(_0x80ca5b){if(_0x80ca5b){return _0x411e1d[_0xf6ac('0x15')](_0x48f482);}return _0x411e1d[_0xf6ac('0x16')](_0x48f482)['end']();};}function respondWithResult(_0x15aad4,_0x256e64){_0x256e64=_0x256e64||0xc8;return function(_0x32b21b){if(_0x32b21b){return _0x15aad4[_0xf6ac('0x16')](_0x256e64)[_0xf6ac('0x17')](_0x32b21b);}};}function respondWithFilteredResult(_0x126783,_0x829f68){return function(_0x1d225a){if(_0x1d225a){var _0x8745ba=typeof _0x829f68['offset']==='undefined'&&typeof _0x829f68[_0xf6ac('0x18')]===_0xf6ac('0x19');var _0x30a8c8=_0x1d225a[_0xf6ac('0x1a')];var _0x5f1b22=_0x8745ba?0x0:_0x829f68[_0xf6ac('0x1b')];var _0x5d0f85=_0x8745ba?_0x1d225a[_0xf6ac('0x1a')]:_0x829f68[_0xf6ac('0x1b')]+_0x829f68[_0xf6ac('0x18')];var _0xd834b0;if(_0x5d0f85>=_0x30a8c8){_0x5d0f85=_0x30a8c8;_0xd834b0=0xc8;}else{_0xd834b0=0xce;}_0x126783[_0xf6ac('0x16')](_0xd834b0);return _0x126783[_0xf6ac('0x1c')](_0xf6ac('0x1d'),_0x5f1b22+'-'+_0x5d0f85+'/'+_0x30a8c8)[_0xf6ac('0x17')](_0x1d225a);}return null;};}function patchUpdates(_0x53d4ec){return function(_0x17484c){try{jsonpatch[_0xf6ac('0x1e')](_0x17484c,_0x53d4ec,!![]);}catch(_0x8b1960){return BPromise[_0xf6ac('0x1f')](_0x8b1960);}return _0x17484c[_0xf6ac('0x20')]();};}function saveUpdates(_0xe8ab35,_0x2ff68e){return function(_0x550876){if(_0x550876){return _0x550876[_0xf6ac('0x21')](_0xe8ab35)[_0xf6ac('0x22')](function(_0x16643d){return _0x16643d;});}return null;};}function removeEntity(_0x9b308,_0x3ba66e){return function(_0x1f16da){if(_0x1f16da){return _0x1f16da[_0xf6ac('0x23')]()[_0xf6ac('0x22')](function(){_0x9b308['status'](0xcc)[_0xf6ac('0x24')]();});}};}function handleEntityNotFound(_0x563738,_0x363404){return function(_0xdf8445){if(!_0xdf8445){_0x563738[_0xf6ac('0x15')](0x194);}return _0xdf8445;};}function handleError(_0x14dfca,_0x1ee25a){_0x1ee25a=_0x1ee25a||0x1f4;return function(_0x5dba48){logger[_0xf6ac('0x25')](_0x5dba48[_0xf6ac('0x26')]);if(_0x5dba48['name']){delete _0x5dba48[_0xf6ac('0x27')];}_0x14dfca['status'](_0x1ee25a)[_0xf6ac('0x28')](_0x5dba48);};}exports[_0xf6ac('0x29')]=function(_0x5dc0ec,_0x2b7708){var _0xc4c07={},_0x4c8d0e={},_0x53f922={'count':0x0,'rows':[]};var _0x25cec5=_[_0xf6ac('0x2a')](db[_0xf6ac('0x2b')][_0xf6ac('0x2c')],function(_0x3b898d){return{'name':_0x3b898d[_0xf6ac('0x2d')],'type':_0x3b898d[_0xf6ac('0x2e')][_0xf6ac('0x2f')]};});_0x4c8d0e[_0xf6ac('0x30')]=_[_0xf6ac('0x2a')](_0x25cec5,'name');_0x4c8d0e[_0xf6ac('0x31')]=_['keys'](_0x5dc0ec[_0xf6ac('0x31')]);_0x4c8d0e['filters']=_[_0xf6ac('0x32')](_0x4c8d0e[_0xf6ac('0x30')],_0x4c8d0e[_0xf6ac('0x31')]);_0xc4c07['attributes']=_[_0xf6ac('0x32')](_0x4c8d0e[_0xf6ac('0x30')],qs[_0xf6ac('0x33')](_0x5dc0ec[_0xf6ac('0x31')][_0xf6ac('0x33')]));_0xc4c07['attributes']=_0xc4c07[_0xf6ac('0x34')][_0xf6ac('0x35')]?_0xc4c07[_0xf6ac('0x34')]:_0x4c8d0e[_0xf6ac('0x30')];if(!_0x5dc0ec['query'][_0xf6ac('0x36')](_0xf6ac('0x37'))){_0xc4c07[_0xf6ac('0x18')]=qs['limit'](_0x5dc0ec['query'][_0xf6ac('0x18')]);_0xc4c07['offset']=qs['offset'](_0x5dc0ec[_0xf6ac('0x31')][_0xf6ac('0x1b')]);}_0xc4c07[_0xf6ac('0x38')]=qs[_0xf6ac('0x39')](_0x5dc0ec[_0xf6ac('0x31')][_0xf6ac('0x39')]);_0xc4c07[_0xf6ac('0x3a')]=qs['filters'](_['pick'](_0x5dc0ec[_0xf6ac('0x31')],_0x4c8d0e[_0xf6ac('0x3b')]),_0x25cec5);if(_0x5dc0ec['query'][_0xf6ac('0x3c')]){_0xc4c07[_0xf6ac('0x3a')]=_[_0xf6ac('0x3d')](_0xc4c07[_0xf6ac('0x3a')],{'$or':_[_0xf6ac('0x2a')](_0x25cec5,function(_0x303dd2){if(_0x303dd2['type']!==_0xf6ac('0x3e')){var _0x4e8cc2={};_0x4e8cc2[_0x303dd2['name']]={'$like':'%'+_0x5dc0ec[_0xf6ac('0x31')]['filter']+'%'};return _0x4e8cc2;}})});}_0xc4c07=_[_0xf6ac('0x3d')]({},_0xc4c07,_0x5dc0ec['options']);var _0x485a3={'where':_0xc4c07[_0xf6ac('0x3a')]};return db['WhatsappTransferReport'][_0xf6ac('0x1a')](_0x485a3)[_0xf6ac('0x22')](function(_0x2c5ffb){_0x53f922[_0xf6ac('0x1a')]=_0x2c5ffb;if(_0x5dc0ec[_0xf6ac('0x31')]['includeAll']){_0xc4c07[_0xf6ac('0x3f')]=[{'all':!![]}];}return db[_0xf6ac('0x2b')][_0xf6ac('0x40')](_0xc4c07);})[_0xf6ac('0x22')](function(_0x26c93c){_0x53f922[_0xf6ac('0x41')]=_0x26c93c;return _0x53f922;})[_0xf6ac('0x22')](respondWithFilteredResult(_0x2b7708,_0xc4c07))[_0xf6ac('0x42')](handleError(_0x2b7708,null));};exports[_0xf6ac('0x43')]=function(_0x1337c1,_0x31d600){var _0x1021e4={'raw':!![],'where':{'id':_0x1337c1[_0xf6ac('0x44')]['id']}},_0x3ea863={};_0x3ea863[_0xf6ac('0x30')]=_[_0xf6ac('0x45')](db['WhatsappTransferReport'][_0xf6ac('0x2c')]);_0x3ea863[_0xf6ac('0x31')]=_[_0xf6ac('0x45')](_0x1337c1[_0xf6ac('0x31')]);_0x3ea863[_0xf6ac('0x3b')]=_[_0xf6ac('0x32')](_0x3ea863[_0xf6ac('0x30')],_0x3ea863[_0xf6ac('0x31')]);_0x1021e4[_0xf6ac('0x34')]=_[_0xf6ac('0x32')](_0x3ea863[_0xf6ac('0x30')],qs[_0xf6ac('0x33')](_0x1337c1[_0xf6ac('0x31')][_0xf6ac('0x33')]));_0x1021e4['attributes']=_0x1021e4[_0xf6ac('0x34')]['length']?_0x1021e4[_0xf6ac('0x34')]:_0x3ea863[_0xf6ac('0x30')];if(_0x1337c1[_0xf6ac('0x31')][_0xf6ac('0x46')]){_0x1021e4[_0xf6ac('0x3f')]=[{'all':!![]}];}_0x1021e4=_[_0xf6ac('0x3d')]({},_0x1021e4,_0x1337c1[_0xf6ac('0x47')]);return db[_0xf6ac('0x2b')][_0xf6ac('0x48')](_0x1021e4)['then'](handleEntityNotFound(_0x31d600,null))[_0xf6ac('0x22')](respondWithResult(_0x31d600,null))[_0xf6ac('0x42')](handleError(_0x31d600,null));};exports[_0xf6ac('0x49')]=function(_0x4b9648,_0x29a281){return db['WhatsappTransferReport']['create'](_0x4b9648[_0xf6ac('0x4a')],{})[_0xf6ac('0x22')](respondWithResult(_0x29a281,0xc9))[_0xf6ac('0x42')](handleError(_0x29a281,null));};exports[_0xf6ac('0x21')]=function(_0x4c54d8,_0xd35fbd){if(_0x4c54d8[_0xf6ac('0x4a')]['id']){delete _0x4c54d8[_0xf6ac('0x4a')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x4c54d8[_0xf6ac('0x44')]['id']}})[_0xf6ac('0x22')](handleEntityNotFound(_0xd35fbd,null))['then'](saveUpdates(_0x4c54d8[_0xf6ac('0x4a')],null))[_0xf6ac('0x22')](respondWithResult(_0xd35fbd,null))[_0xf6ac('0x42')](handleError(_0xd35fbd,null));};exports[_0xf6ac('0x23')]=function(_0x568110,_0x25c8ef){return db[_0xf6ac('0x2b')][_0xf6ac('0x48')]({'where':{'id':_0x568110[_0xf6ac('0x44')]['id']}})[_0xf6ac('0x22')](handleEntityNotFound(_0x25c8ef,null))['then'](removeEntity(_0x25c8ef,null))['catch'](handleError(_0x25c8ef,null));};exports[_0xf6ac('0x4b')]=function(_0x4fd230,_0x176dec){return db[_0xf6ac('0x2b')]['describe']()[_0xf6ac('0x22')](respondWithResult(_0x176dec,null))['catch'](handleError(_0x176dec,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 81b8d75..c798dd6 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 _0x426f=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x3520c0,_0x2ae593){var _0x5496d6=function(_0xd07427){while(--_0xd07427){_0x3520c0['push'](_0x3520c0['shift']());}};_0x5496d6(++_0x2ae593);}(_0x426f,0xf2));var _0xf426=function(_0x4bfff5,_0xbd2a67){_0x4bfff5=_0x4bfff5-0x0;var _0x2383bc=_0x426f[_0x4bfff5];return _0x2383bc;};'use strict';var _=require(_0xf426('0x0'));var util=require(_0xf426('0x1'));var logger=require(_0xf426('0x2'))(_0xf426('0x3'));var moment=require(_0xf426('0x4'));var BPromise=require(_0xf426('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf426('0x6'));var rimraf=require(_0xf426('0x7'));var config=require(_0xf426('0x8'));var attributes=require(_0xf426('0x9'));module['exports']=function(_0x419fc8,_0x400f77){return _0x419fc8[_0xf426('0xa')](_0xf426('0xb'),attributes,{'tableName':_0xf426('0xc'),'paranoid':![],'indexes':[{'name':_0xf426('0xd'),'fields':[_0xf426('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8e8=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x559745,_0x51430c){var _0x4e4def=function(_0x5d263){while(--_0x5d263){_0x559745['push'](_0x559745['shift']());}};_0x4e4def(++_0x51430c);}(_0xa8e8,0x1bb));var _0x8a8e=function(_0x283cf6,_0x14e096){_0x283cf6=_0x283cf6-0x0;var _0x4b40e5=_0xa8e8[_0x283cf6];return _0x4b40e5;};'use strict';var _=require(_0x8a8e('0x0'));var util=require(_0x8a8e('0x1'));var logger=require(_0x8a8e('0x2'))(_0x8a8e('0x3'));var moment=require('moment');var BPromise=require(_0x8a8e('0x4'));var rp=require(_0x8a8e('0x5'));var fs=require('fs');var path=require(_0x8a8e('0x6'));var rimraf=require(_0x8a8e('0x7'));var config=require(_0x8a8e('0x8'));var attributes=require(_0x8a8e('0x9'));module[_0x8a8e('0xa')]=function(_0x19c39a,_0x4118e8){return _0x19c39a[_0x8a8e('0xb')](_0x8a8e('0xc'),attributes,{'tableName':_0x8a8e('0xd'),'paranoid':![],'indexes':[{'name':_0x8a8e('0xe'),'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 4a05406..c37c33f 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 _0x56df=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x56df,0x136));var _0xf56d=function(_0x53ddbf,_0x5bfcbd){_0x53ddbf=_0x53ddbf-0x0;var _0x222f7c=_0x56df[_0x53ddbf];return _0x222f7c;};'use strict';var _=require('lodash');var util=require(_0xf56d('0x0'));var moment=require('moment');var BPromise=require(_0xf56d('0x1'));var rs=require(_0xf56d('0x2'));var fs=require('fs');var Redis=require(_0xf56d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf56d('0x4'));var logger=require(_0xf56d('0x5'))(_0xf56d('0x6'));var config=require('../../config/environment');var jayson=require(_0xf56d('0x7'));var client=jayson[_0xf56d('0x8')][_0xf56d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x273d42,_0x179a8f,_0x405e78){return new BPromise(function(_0xf9b72d,_0x36ff4f){return client[_0xf56d('0xa')](_0x273d42,_0x405e78)[_0xf56d('0xb')](function(_0x169f14){logger[_0xf56d('0xc')](_0xf56d('0xd'),_0x179a8f,_0xf56d('0xe'));logger[_0xf56d('0xf')](_0xf56d('0x10'),_0x179a8f,_0xf56d('0xe'),JSON[_0xf56d('0x11')](_0x169f14));if(_0x169f14[_0xf56d('0x12')]){if(_0x169f14['error']['code']===0x1f4){logger[_0xf56d('0x12')](_0xf56d('0xd'),_0x179a8f,_0x169f14['error']['message']);return _0x36ff4f(_0x169f14['error']['message']);}logger[_0xf56d('0x12')](_0xf56d('0xd'),_0x179a8f,_0x169f14[_0xf56d('0x12')][_0xf56d('0x13')]);return _0xf9b72d(_0x169f14[_0xf56d('0x12')]['message']);}else{logger[_0xf56d('0xc')](_0xf56d('0xd'),_0x179a8f,_0xf56d('0xe'));_0xf9b72d(_0x169f14['result'][_0xf56d('0x13')]);}})[_0xf56d('0x14')](function(_0x208e51){logger[_0xf56d('0x12')](_0xf56d('0xd'),_0x179a8f,_0x208e51);_0x36ff4f(_0x208e51);});});} \ No newline at end of file +var _0x177a=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x177a,0x114));var _0xa177=function(_0x23b001,_0x564f83){_0x23b001=_0x23b001-0x0;var _0x13ea4b=_0x177a[_0x23b001];return _0x13ea4b;};'use strict';var _=require(_0xa177('0x0'));var util=require(_0xa177('0x1'));var moment=require('moment');var BPromise=require(_0xa177('0x2'));var rs=require(_0xa177('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa177('0x4'))['db'];var utils=require(_0xa177('0x5'));var logger=require(_0xa177('0x6'))(_0xa177('0x7'));var config=require(_0xa177('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa177('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6366,_0x895a43,_0x1f3d85){return new BPromise(function(_0x14df73,_0x99d293){return client[_0xa177('0xa')](_0x4a6366,_0x1f3d85)[_0xa177('0xb')](function(_0x1446cf){logger['info'](_0xa177('0xc'),_0x895a43,_0xa177('0xd'));logger[_0xa177('0xe')](_0xa177('0xf'),_0x895a43,_0xa177('0xd'),JSON[_0xa177('0x10')](_0x1446cf));if(_0x1446cf['error']){if(_0x1446cf[_0xa177('0x11')][_0xa177('0x12')]===0x1f4){logger[_0xa177('0x11')](_0xa177('0xc'),_0x895a43,_0x1446cf[_0xa177('0x11')][_0xa177('0x13')]);return _0x99d293(_0x1446cf[_0xa177('0x11')][_0xa177('0x13')]);}logger[_0xa177('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x895a43,_0x1446cf['error'][_0xa177('0x13')]);return _0x14df73(_0x1446cf['error'][_0xa177('0x13')]);}else{logger[_0xa177('0x14')](_0xa177('0xc'),_0x895a43,_0xa177('0xd'));_0x14df73(_0x1446cf[_0xa177('0x15')]['message']);}})[_0xa177('0x16')](function(_0x52de34){logger[_0xa177('0x11')](_0xa177('0xc'),_0x895a43,_0x52de34);_0x99d293(_0x52de34);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 816576b..6bbe067 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4672=['pm2_env','name','Online\x20apps:','filter','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map'];(function(_0x2b2b53,_0x201fb2){var _0x405e84=function(_0x3704f5){while(--_0x3704f5){_0x2b2b53['push'](_0x2b2b53['shift']());}};_0x405e84(++_0x201fb2);}(_0x4672,0x18a));var _0x2467=function(_0x3b4626,_0x14d17b){_0x3b4626=_0x3b4626-0x0;var _0x404a2e=_0x4672[_0x3b4626];return _0x404a2e;};'use strict';var _=require(_0x2467('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x2467('0x1'));var checkLicense=require(_0x2467('0x2'));var rpc=require('./rpc');var config=require(_0x2467('0x3'));var logger=require('./config/logger')(_0x2467('0x4'));var pm2=require(_0x2467('0x5'));var pm2Config=require(_0x2467('0x6'));var schedule=require(_0x2467('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x2467('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x2467('0x9'));function main(){return db[_0x2467('0xa')][_0x2467('0xb')]()[_0x2467('0xc')](function(){if(config[_0x2467('0xd')]){return seedDb[_0x2467('0xe')]();}})[_0x2467('0xc')](function(){return checkLicense[_0x2467('0xe')]();})[_0x2467('0xc')](function(){return rpc['listen']();})[_0x2467('0xc')](function(_0x1b1c63){logger[_0x2467('0xf')](_0x1b1c63);return chat[_0x2467('0x10')]();})['then'](function(){return whatsapp[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return schedule[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return transcribe[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return provider['start']();})[_0x2467('0xc')](function(_0x373ef2){logger[_0x2467('0xf')](_0x373ef2);return pm2[_0x2467('0x10')](pm2Config);})[_0x2467('0xc')](function(_0x265d7e){var _0x15aa74=_0x265d7e['filter'](function(_0x520ad9){return typeof _0x520ad9['exitCode']===_0x2467('0x11')&&_0x520ad9[_0x2467('0x12')]>=0x0;});if(_0x15aa74[_0x2467('0x13')]>0x0){throw new Error(_0x15aa74['length']+_0x2467('0x14')+_[_0x2467('0x15')](_0x15aa74,function(_0x4abd91){return'\x22'+_0x4abd91[_0x2467('0x16')][_0x2467('0x17')]+'\x22';}));}logger[_0x2467('0xf')](_0x2467('0x18'),_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,{'status':_0x2467('0x1a')}),'name')['join']());logger[_0x2467('0xf')]('Offline\x20apps:',_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,function(_0x50e555){return _0x50e555['status']!==_0x2467('0x1a');}),_0x2467('0x17'))['join']()||_0x2467('0x1b'));console[_0x2467('0x1c')](_0x2467('0x1d'));})[_0x2467('0x1e')](function(_0x59f7d2){console[_0x2467('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x59f7d2);logger['error'](_0x2467('0x1f'),_0x59f7d2);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x0cfe=['exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','join','None','App\x20Ready!','catch','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','start','info','filter'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x58cbcb,_0x345a98){_0x58cbcb=_0x58cbcb-0x0;var _0x45619c=_0x0cfe[_0x58cbcb];return _0x45619c;};'use strict';var _=require(_0xe0cf('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe0cf('0x1'));var checkLicense=require(_0xe0cf('0x2'));var rpc=require(_0xe0cf('0x3'));var config=require('./config/environment');var logger=require(_0xe0cf('0x4'))('app');var pm2=require(_0xe0cf('0x5'));var pm2Config=require(_0xe0cf('0x6'));var schedule=require(_0xe0cf('0x7'));var chat=require(_0xe0cf('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xe0cf('0x9'));var provider=require(_0xe0cf('0xa'));function main(){return db[_0xe0cf('0xb')]['sync']()[_0xe0cf('0xc')](function(){if(config[_0xe0cf('0xd')]){return seedDb['default']();}})[_0xe0cf('0xc')](function(){return checkLicense[_0xe0cf('0xe')]();})[_0xe0cf('0xc')](function(){return rpc[_0xe0cf('0xf')]();})[_0xe0cf('0xc')](function(_0x10752a){logger['info'](_0x10752a);return chat[_0xe0cf('0x10')]();})[_0xe0cf('0xc')](function(){return whatsapp[_0xe0cf('0x10')]();})[_0xe0cf('0xc')](function(){return schedule[_0xe0cf('0x10')]();})[_0xe0cf('0xc')](function(){return transcribe[_0xe0cf('0x10')]();})[_0xe0cf('0xc')](function(){return provider[_0xe0cf('0x10')]();})[_0xe0cf('0xc')](function(_0x363fbb){logger[_0xe0cf('0x11')](_0x363fbb);return pm2['start'](pm2Config);})[_0xe0cf('0xc')](function(_0xaa3ab){var _0x3979ba=_0xaa3ab[_0xe0cf('0x12')](function(_0x25b285){return typeof _0x25b285['exitCode']==='number'&&_0x25b285[_0xe0cf('0x13')]>=0x0;});if(_0x3979ba['length']>0x0){throw new Error(_0x3979ba['length']+_0xe0cf('0x14')+_[_0xe0cf('0x15')](_0x3979ba,function(_0x34e25d){return'\x22'+_0x34e25d[_0xe0cf('0x16')][_0xe0cf('0x17')]+'\x22';}));}logger[_0xe0cf('0x11')](_0xe0cf('0x18'),_['map'](_['filter'](_0xaa3ab,{'status':_0xe0cf('0x19')}),_0xe0cf('0x17'))['join']());logger[_0xe0cf('0x11')](_0xe0cf('0x1a'),_[_0xe0cf('0x15')](_[_0xe0cf('0x12')](_0xaa3ab,function(_0x129018){return _0x129018['status']!==_0xe0cf('0x19');}),'name')[_0xe0cf('0x1b')]()||_0xe0cf('0x1c'));console['log'](_0xe0cf('0x1d'));})[_0xe0cf('0x1e')](function(_0x1ef7d4){console[_0xe0cf('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x1ef7d4);logger[_0xe0cf('0x20')](_0xe0cf('0x21'),_0x1ef7d4);process[_0xe0cf('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1b8b465..1a6e466 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6aa7,0x178));var _0x76aa=function(_0x23a042,_0x5c686d){_0x23a042=_0x23a042-0x0;var _0x3ade97=_0x6aa7[_0x23a042];return _0x3ade97;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file +var _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x3a32e7,_0x15bbee){var _0x53a083=function(_0xb54541){while(--_0xb54541){_0x3a32e7['push'](_0x3a32e7['shift']());}};_0x53a083(++_0x15bbee);}(_0x55ca,0x126));var _0xa55c=function(_0x4218d0,_0x18aa4c){_0x4218d0=_0x4218d0-0x0;var _0x2c142c=_0x55ca[_0x4218d0];return _0x2c142c;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9a9fb60..0344df8 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 _0x23bd=['secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString'];(function(_0x2a45b4,_0xa1a757){var _0x2a87fb=function(_0xdd7e79){while(--_0xdd7e79){_0x2a45b4['push'](_0x2a45b4['shift']());}};_0x2a87fb(++_0xa1a757);}(_0x23bd,0x107));var _0xd23b=function(_0x28cde3,_0x5d4fc6){_0x28cde3=_0x28cde3-0x0;var _0x2dba45=_0x23bd[_0x28cde3];return _0x2dba45;};'use strict';var crypto=require(_0xd23b('0x0'));var fs=require('fs');var BPromise=require(_0xd23b('0x1'));var _=require(_0xd23b('0x2'));var config=require(_0xd23b('0x3'));var logger=require(_0xd23b('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd23b('0x5')][_0xd23b('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xd23b('0x7')};if(config[_0xd23b('0x8')]&&config[_0xd23b('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xd23b('0x8')][_0xd23b('0x9')]);if(isSupported){fileOptions[_0xd23b('0x9')]=config['encrypt'][_0xd23b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd23b('0xa')](',\x20');logger[_0xd23b('0xb')](config['encrypt']['algorithm'],_0xd23b('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5ee1dc){return AES_SUPPORTED_RX[_0xd23b('0xd')](_0x5ee1dc);}function getSupportedCiphers(){return crypto[_0xd23b('0xe')]()[_0xd23b('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x14839e){return getSupportedCiphers()[_0xd23b('0x10')](_0x14839e)>-0x1;}function combineOptions(_0x4db625){var _0x20182a={};for(var _0x19bb02 in fileOptions){if(fileOptions[_0xd23b('0x11')](_0x19bb02)){_0x20182a[_0x19bb02]=fileOptions[_0x19bb02];}}if(_0x4db625){for(var _0x30d1ce in _0x4db625){if(_0x4db625[_0xd23b('0x11')](_0x30d1ce)){_0x20182a[_0x30d1ce]=_0x4db625[_0x30d1ce];}}}return _0x20182a;}exports[_0xd23b('0x12')]=function(_0x1974cd,_0x3a6746,_0xaf4809,_0x3b4f16){return new BPromise(function(_0x513625,_0x4ca2d8){_0x3b4f16=combineOptions(_0x3b4f16);var _0x4c1936=new Buffer(_0xaf4809);var _0xe43050=fs[_0xd23b('0x13')](_0x1974cd);var _0x449a95=fs[_0xd23b('0x14')](_0x3a6746);var _0x3f3694=crypto[_0xd23b('0x15')](_0x3b4f16['algorithm'],_0x4c1936);_0xe43050['on'](_0xd23b('0x16'),function(_0x5d11c5){var _0x30d898=new Buffer(_0x3f3694[_0xd23b('0x17')](_0x5d11c5),_0xd23b('0x18'));_0x449a95[_0xd23b('0x19')](_0x30d898);});_0xe43050['on'](_0xd23b('0x1a'),function(){try{var _0xc04ded=new Buffer(_0x3f3694[_0xd23b('0x1b')]('binary'),_0xd23b('0x18'));_0x449a95['write'](_0xc04ded);_0x449a95['end']();_0x449a95['on'](_0xd23b('0x1c'),function(){return _0x513625(_0x3a6746);});}catch(_0x3f3a45){fs[_0xd23b('0x1d')](_0x3a6746);return _0x4ca2d8(_0x3f3a45);}});});};exports[_0xd23b('0x1e')]=function(_0x32c276,_0x4bc10f,_0x499564,_0x16ab0e){return new BPromise(function(_0x4bc328,_0x21e703){_0x16ab0e=combineOptions(_0x16ab0e);var _0x372941=new Buffer(_0x499564);var _0x642c84=fs[_0xd23b('0x13')](_0x32c276);var _0x53a591=fs[_0xd23b('0x14')](_0x4bc10f);var _0x45a22b=crypto[_0xd23b('0x1f')](_0x16ab0e[_0xd23b('0x9')],_0x372941);_0x642c84['on'](_0xd23b('0x16'),function(_0x195f51){var _0x40f4a9=new Buffer(_0x45a22b[_0xd23b('0x17')](_0x195f51),'binary');_0x53a591[_0xd23b('0x19')](_0x40f4a9);});_0x642c84['on'](_0xd23b('0x1a'),function(){try{var _0x140637=new Buffer(_0x45a22b[_0xd23b('0x1b')](_0xd23b('0x18')),_0xd23b('0x18'));_0x53a591[_0xd23b('0x19')](_0x140637);_0x53a591[_0xd23b('0x1a')]();_0x53a591['on']('close',function(){return _0x4bc328(_0x4bc10f);});}catch(_0x2d9992){fs[_0xd23b('0x1d')](_0x4bc10f);return _0x21e703(_0x2d9992);}});});};exports[_0xd23b('0x20')]=function(_0x83b3f2,_0x567cc4,_0x5731ee){var _0x1b3dda=_0x5731ee||stringOptions[_0xd23b('0x9')];var _0x370b55=_0x567cc4||stringOptions[_0xd23b('0x21')];var _0x57c9e7=crypto['createCipher'](_0x1b3dda,_0x370b55);var _0x4e01d4=_0x57c9e7['update'](_0x83b3f2,_0xd23b('0x22'),_0xd23b('0x23'));_0x4e01d4+=_0x57c9e7[_0xd23b('0x1b')](_0xd23b('0x23'));return _0x4e01d4;};exports[_0xd23b('0x24')]=function(_0x3277bb,_0x1520c6,_0x46caf7){var _0x3fa09d=_0x46caf7||stringOptions[_0xd23b('0x9')];var _0xdcd8d2=_0x1520c6||stringOptions['secret'];var _0x52842e=crypto[_0xd23b('0x1f')](_0x3fa09d,_0xdcd8d2);var _0x568370=_0x52842e[_0xd23b('0x17')](_0x3277bb,_0xd23b('0x23'),'utf8');_0x568370+=_0x52842e[_0xd23b('0x1b')]('utf8');return _0x568370;}; \ No newline at end of file +var _0xc8b5=['createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile','createDecipher','unlink','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/environment','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream'];(function(_0x24746b,_0x282bc6){var _0x55b13b=function(_0x12ab32){while(--_0x12ab32){_0x24746b['push'](_0x24746b['shift']());}};_0x55b13b(++_0x282bc6);}(_0xc8b5,0x94));var _0x5c8b=function(_0x584f24,_0x1afe5f){_0x584f24=_0x584f24-0x0;var _0x167476=_0xc8b5[_0x584f24];return _0x167476;};'use strict';var crypto=require(_0x5c8b('0x0'));var fs=require('fs');var BPromise=require(_0x5c8b('0x1'));var _=require(_0x5c8b('0x2'));var config=require(_0x5c8b('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5c8b('0x4')][_0x5c8b('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5c8b('0x6')};if(config[_0x5c8b('0x7')]&&config[_0x5c8b('0x7')][_0x5c8b('0x8')]){var isSupported=isAlgorithmSupported(config[_0x5c8b('0x7')][_0x5c8b('0x8')]);if(isSupported){fileOptions[_0x5c8b('0x8')]=config[_0x5c8b('0x7')][_0x5c8b('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5c8b('0x9')](',\x20');logger[_0x5c8b('0xa')](config['encrypt'][_0x5c8b('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2a23a1){return AES_SUPPORTED_RX[_0x5c8b('0xb')](_0x2a23a1);}function getSupportedCiphers(){return crypto[_0x5c8b('0xc')]()[_0x5c8b('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x9b8e51){return getSupportedCiphers()['indexOf'](_0x9b8e51)>-0x1;}function combineOptions(_0x43b866){var _0x11b60e={};for(var _0x41f0eb in fileOptions){if(fileOptions[_0x5c8b('0xe')](_0x41f0eb)){_0x11b60e[_0x41f0eb]=fileOptions[_0x41f0eb];}}if(_0x43b866){for(var _0x4e709a in _0x43b866){if(_0x43b866['hasOwnProperty'](_0x4e709a)){_0x11b60e[_0x4e709a]=_0x43b866[_0x4e709a];}}}return _0x11b60e;}exports[_0x5c8b('0xf')]=function(_0x3bae24,_0x524d7d,_0x1a4de8,_0x12f781){return new BPromise(function(_0x12aca1,_0x389c66){_0x12f781=combineOptions(_0x12f781);var _0x465c65=new Buffer(_0x1a4de8);var _0x193dce=fs[_0x5c8b('0x10')](_0x3bae24);var _0x27fa37=fs[_0x5c8b('0x11')](_0x524d7d);var _0x163893=crypto[_0x5c8b('0x12')](_0x12f781['algorithm'],_0x465c65);_0x193dce['on'](_0x5c8b('0x13'),function(_0x5022f5){var _0x3b06cd=new Buffer(_0x163893[_0x5c8b('0x14')](_0x5022f5),_0x5c8b('0x15'));_0x27fa37[_0x5c8b('0x16')](_0x3b06cd);});_0x193dce['on'](_0x5c8b('0x17'),function(){try{var _0x53185f=new Buffer(_0x163893[_0x5c8b('0x18')](_0x5c8b('0x15')),'binary');_0x27fa37['write'](_0x53185f);_0x27fa37[_0x5c8b('0x17')]();_0x27fa37['on'](_0x5c8b('0x19'),function(){return _0x12aca1(_0x524d7d);});}catch(_0x38dc17){fs['unlink'](_0x524d7d);return _0x389c66(_0x38dc17);}});});};exports[_0x5c8b('0x1a')]=function(_0x1265ea,_0x5f54f9,_0x2b2773,_0xd088dc){return new BPromise(function(_0x5771a4,_0x4bc56e){_0xd088dc=combineOptions(_0xd088dc);var _0x76a8bc=new Buffer(_0x2b2773);var _0x4b75f3=fs[_0x5c8b('0x10')](_0x1265ea);var _0x21329a=fs[_0x5c8b('0x11')](_0x5f54f9);var _0x1d5af7=crypto[_0x5c8b('0x1b')](_0xd088dc['algorithm'],_0x76a8bc);_0x4b75f3['on']('data',function(_0x950570){var _0x3677c2=new Buffer(_0x1d5af7[_0x5c8b('0x14')](_0x950570),'binary');_0x21329a[_0x5c8b('0x16')](_0x3677c2);});_0x4b75f3['on'](_0x5c8b('0x17'),function(){try{var _0x6e7a7f=new Buffer(_0x1d5af7['final'](_0x5c8b('0x15')),_0x5c8b('0x15'));_0x21329a[_0x5c8b('0x16')](_0x6e7a7f);_0x21329a['end']();_0x21329a['on'](_0x5c8b('0x19'),function(){return _0x5771a4(_0x5f54f9);});}catch(_0xc16614){fs[_0x5c8b('0x1c')](_0x5f54f9);return _0x4bc56e(_0xc16614);}});});};exports[_0x5c8b('0x1d')]=function(_0x15a74b,_0x161b03,_0x2eade8){var _0x460b91=_0x2eade8||stringOptions[_0x5c8b('0x8')];var _0x18befe=_0x161b03||stringOptions[_0x5c8b('0x1e')];var _0x28c8cf=crypto[_0x5c8b('0x12')](_0x460b91,_0x18befe);var _0x20ffc3=_0x28c8cf[_0x5c8b('0x14')](_0x15a74b,_0x5c8b('0x1f'),_0x5c8b('0x20'));_0x20ffc3+=_0x28c8cf[_0x5c8b('0x18')](_0x5c8b('0x20'));return _0x20ffc3;};exports['decryptString']=function(_0x2c9bfa,_0x10e56b,_0x77a1e9){var _0x3f9fc6=_0x77a1e9||stringOptions['algorithm'];var _0x3f9d70=_0x10e56b||stringOptions[_0x5c8b('0x1e')];var _0x338c7c=crypto['createDecipher'](_0x3f9fc6,_0x3f9d70);var _0x425796=_0x338c7c[_0x5c8b('0x14')](_0x2c9bfa,'base64','utf8');_0x425796+=_0x338c7c['final']('utf8');return _0x425796;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index cdef47a..f27b8f1 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 _0xe44a=['csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','range','isInteger','num','forEach','push','format','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','each','%s%d.%s'];(function(_0x13be4c,_0x302093){var _0x172e21=function(_0x460dda){while(--_0x460dda){_0x13be4c['push'](_0x13be4c['shift']());}};_0x172e21(++_0x302093);}(_0xe44a,0x144));var _0xae44=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe44a[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xae44('0x0'));var path=require(_0xae44('0x1'));var _=require(_0xae44('0x2'));var csv=require(_0xae44('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xae44('0x4'));var rimraf=require(_0xae44('0x5'));var db=require(_0xae44('0x6'))['db'];var dbH=require(_0xae44('0x6'))[_0xae44('0x7')];var logger=require(_0xae44('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xae44('0x9')][0x2]);var QUERY=process[_0xae44('0x9')][0x3];var PATH=process[_0xae44('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x228823,_0x2d88e2){var _0x1ee96c={'status':_0x228823};var _0x298020={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d88e2){_0x1ee96c['savename']=_0x2d88e2;}return db['AnalyticExtractedReport'][_0xae44('0xa')](_0x1ee96c,_0x298020);}function main(){var _0x232c41=0x1388;var _0x1a0ff3;logger[_0xae44('0xb')](util['format'](_0xae44('0xc'),EXTRACTED_REPORT_ID,_0xae44('0xd')));return db[_0xae44('0xe')][_0xae44('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xae44('0x10'),_0xae44('0x11')]})[_0xae44('0x12')](function(_0x3dcb0d){if(_0x3dcb0d){_0x1a0ff3=_0x3dcb0d;_0x232c41=_0x1a0ff3[_0xae44('0x11')]||0x1388;}})[_0xae44('0x12')](function(){return dbH['sequelize']['query'](util['format'](_0xae44('0x13'),QUERY),{'type':dbH[_0xae44('0x14')][_0xae44('0x15')][_0xae44('0x16')]});})[_0xae44('0x12')](function(_0x4b76ee){if(!_0x4b76ee[0x0]['num']){return analyticExtractedReport(_0xae44('0x17'));}var _0x1c477e=[];var _0x4aa2ab=0x0;if(_0x1a0ff3[_0xae44('0x10')]){if(_0x4b76ee&&_0x4b76ee['length']){var _0x20f3d9=_[_0xae44('0x18')](_0x4b76ee[0x0]['num']/_0x232c41);var _0x55447d=Number[_0xae44('0x19')](_0x4b76ee[0x0][_0xae44('0x1a')]/_0x232c41)?_0x4b76ee[0x0][_0xae44('0x1a')]%_0x232c41:0x0;_0x20f3d9[_0xae44('0x1b')](function(_0x5ece8a){if(_0x5ece8a>0x0){_0x4aa2ab+=_0x232c41;}_0x1c477e[_0xae44('0x1c')](dbH[_0xae44('0x14')]['query'](util[_0xae44('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x232c41,_0x4aa2ab),{'type':dbH[_0xae44('0x14')][_0xae44('0x15')][_0xae44('0x16')]}));});if(_0x55447d>0x0){_0x4aa2ab+=_0x232c41;_0x1c477e[_0xae44('0x1c')](dbH[_0xae44('0x14')][_0xae44('0x1e')](util[_0xae44('0x1d')](_0xae44('0x1f'),QUERY,_0x55447d,_0x4aa2ab),{'type':dbH[_0xae44('0x14')][_0xae44('0x15')][_0xae44('0x16')]}));}}}else{_0x1c477e[_0xae44('0x1c')](dbH[_0xae44('0x14')][_0xae44('0x1e')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xae44('0x16')]}));}var _0x3d9a93=path[_0xae44('0x20')](PATH);var _0x2f4685=path[_0xae44('0x21')](PATH,_0xae44('0x22'));var _0x3f35e9=_0x1a0ff3[_0xae44('0x10')]&&_0x1c477e[_0xae44('0x23')]>0x1;var _0x303df8=[];if(!fs[_0xae44('0x24')](path[_0xae44('0x25')](_0x3d9a93,_0x2f4685))&&_0x3f35e9){fs['mkdirSync'](path[_0xae44('0x25')](_0x3d9a93,_0x2f4685));}return BPromise[_0xae44('0x26')](_0x1c477e,function(_0xbd9bb9){_0x303df8[_0xae44('0x1c')](_0xbd9bb9);})[_0xae44('0x12')](function(){for(var _0x319dc7=0x0;_0x319dc7<_0x303df8[_0xae44('0x23')];_0x319dc7+=0x1){var _0x5bd2ba;var _0x710f9f=_0x303df8[_0x319dc7];if(_0x3f35e9){_0x5bd2ba=path['join'](_0x3d9a93,_0x2f4685,util['format'](_0xae44('0x27'),_0x2f4685,_0x319dc7,_0xae44('0x28')));}else{_0x5bd2ba=path[_0xae44('0x25')](_0x3d9a93,util[_0xae44('0x1d')](_0xae44('0x29'),_0x2f4685,_0xae44('0x28')));}fs['writeFileSync'](_0x5bd2ba,csv(_0x710f9f));}})['then'](function(){if(_0x3f35e9){return new Promise(function(_0x829f5b){zipdir(path[_0xae44('0x25')](_0x3d9a93,_0x2f4685),{'saveTo':path[_0xae44('0x25')](_0x3d9a93,util[_0xae44('0x1d')](_0xae44('0x29'),_0x2f4685,_0xae44('0x2a')))},function(_0x40673b,_0x1f9f5b){rimraf(path['join'](_0x3d9a93,_0x2f4685),function(){});_0x829f5b(_0xae44('0x2b'));});});}})[_0xae44('0x12')](function(){logger['info'](util[_0xae44('0x1d')](_0xae44('0x2c'),EXTRACTED_REPORT_ID,_0xae44('0xd')));return analyticExtractedReport(_0xae44('0x2d'),_0x3f35e9?util[_0xae44('0x1d')](_0xae44('0x29'),_0x2f4685,_0x3f35e9?_0xae44('0x2a'):_0xae44('0x28')):null);});})[_0xae44('0x2e')](function(_0x30db63){logger[_0xae44('0xb')](util['format'](_0xae44('0x2f'),EXTRACTED_REPORT_ID,'CSV'),util[_0xae44('0x30')](_0x30db63,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xae44('0x31'));})[_0xae44('0x32')](function(){process[_0xae44('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3135=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','bluebird','../../mysqldb','analytics','argv','savename','update','CSV','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x3135,0x13f));var _0x5313=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3135[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x5313('0x0'));var path=require(_0x5313('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x5313('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x5313('0x3'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x5313('0x4'));var EXTRACTED_REPORT_ID=Number(process[_0x5313('0x5')][0x2]);var QUERY=process[_0x5313('0x5')][0x3];var PATH=process[_0x5313('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x108b7b,_0x13dee8){var _0xb37b77={'status':_0x108b7b};var _0x171ad5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13dee8){_0xb37b77[_0x5313('0x6')]=_0x13dee8;}return db['AnalyticExtractedReport'][_0x5313('0x7')](_0xb37b77,_0x171ad5);}function main(){var _0x475596=0x1388;var _0x46b894;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5313('0x8')));return db['Setting'][_0x5313('0x9')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5313('0xa'),_0x5313('0xb')]})[_0x5313('0xc')](function(_0x43b27c){if(_0x43b27c){_0x46b894=_0x43b27c;_0x475596=_0x46b894['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x5313('0xd')]['query'](util[_0x5313('0xe')](_0x5313('0xf'),QUERY),{'type':dbH[_0x5313('0xd')][_0x5313('0x10')][_0x5313('0x11')]});})['then'](function(_0x4297fd){if(!_0x4297fd[0x0][_0x5313('0x12')]){return analyticExtractedReport(_0x5313('0x13'));}var _0x397102=[];var _0x4fcf74=0x0;if(_0x46b894[_0x5313('0xa')]){if(_0x4297fd&&_0x4297fd[_0x5313('0x14')]){var _0x1ab341=_[_0x5313('0x15')](_0x4297fd[0x0][_0x5313('0x12')]/_0x475596);var _0x2157ed=Number[_0x5313('0x16')](_0x4297fd[0x0][_0x5313('0x12')]/_0x475596)?_0x4297fd[0x0][_0x5313('0x12')]%_0x475596:0x0;_0x1ab341[_0x5313('0x17')](function(_0x33ce06){if(_0x33ce06>0x0){_0x4fcf74+=_0x475596;}_0x397102[_0x5313('0x18')](dbH['sequelize'][_0x5313('0x19')](util[_0x5313('0xe')](_0x5313('0x1a'),QUERY,_0x475596,_0x4fcf74),{'type':dbH[_0x5313('0xd')]['QueryTypes'][_0x5313('0x11')]}));});if(_0x2157ed>0x0){_0x4fcf74+=_0x475596;_0x397102['push'](dbH[_0x5313('0xd')][_0x5313('0x19')](util[_0x5313('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2157ed,_0x4fcf74),{'type':dbH[_0x5313('0xd')][_0x5313('0x10')]['SELECT']}));}}}else{_0x397102[_0x5313('0x18')](dbH[_0x5313('0xd')][_0x5313('0x19')](QUERY,{'type':dbH[_0x5313('0xd')][_0x5313('0x10')][_0x5313('0x11')]}));}var _0x4a6c54=path['dirname'](PATH);var _0x51f8f3=path['basename'](PATH,_0x5313('0x1b'));var _0x102926=_0x46b894[_0x5313('0xa')]&&_0x397102[_0x5313('0x14')]>0x1;var _0xf8d148=[];if(!fs[_0x5313('0x1c')](path[_0x5313('0x1d')](_0x4a6c54,_0x51f8f3))&&_0x102926){fs['mkdirSync'](path[_0x5313('0x1d')](_0x4a6c54,_0x51f8f3));}return BPromise[_0x5313('0x1e')](_0x397102,function(_0x107df9){_0xf8d148[_0x5313('0x18')](_0x107df9);})[_0x5313('0xc')](function(){for(var _0x56e79b=0x0;_0x56e79b<_0xf8d148[_0x5313('0x14')];_0x56e79b+=0x1){var _0x55dcf5;var _0x1b61cd=_0xf8d148[_0x56e79b];if(_0x102926){_0x55dcf5=path['join'](_0x4a6c54,_0x51f8f3,util[_0x5313('0xe')](_0x5313('0x1f'),_0x51f8f3,_0x56e79b,_0x5313('0x20')));}else{_0x55dcf5=path[_0x5313('0x1d')](_0x4a6c54,util[_0x5313('0xe')]('%s.%s',_0x51f8f3,'csv'));}fs[_0x5313('0x21')](_0x55dcf5,csv(_0x1b61cd));}})[_0x5313('0xc')](function(){if(_0x102926){return new Promise(function(_0x53ecf0){zipdir(path[_0x5313('0x1d')](_0x4a6c54,_0x51f8f3),{'saveTo':path[_0x5313('0x1d')](_0x4a6c54,util[_0x5313('0xe')](_0x5313('0x22'),_0x51f8f3,_0x5313('0x23')))},function(_0x52b47d,_0x249e53){rimraf(path[_0x5313('0x1d')](_0x4a6c54,_0x51f8f3),function(){});_0x53ecf0('zip\x20finished');});});}})[_0x5313('0xc')](function(){logger[_0x5313('0x24')](util[_0x5313('0xe')](_0x5313('0x25'),EXTRACTED_REPORT_ID,_0x5313('0x8')));return analyticExtractedReport(_0x5313('0x26'),_0x102926?util[_0x5313('0xe')](_0x5313('0x22'),_0x51f8f3,_0x102926?_0x5313('0x23'):_0x5313('0x20')):null);});})['catch'](function(_0x50f36b){logger['info'](util[_0x5313('0xe')](_0x5313('0x27'),EXTRACTED_REPORT_ID,_0x5313('0x8')),util[_0x5313('0x28')](_0x50f36b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5313('0x29'));})['finally'](function(){process[_0x5313('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b847d6a..b4a51bc 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 _0x1045=['MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','push','concat','chunk','keys','forEach','name','startDate','endDate','format','header','pageBreak','margin','landscape','\x20/\x20','Arial','right','Empty','Setting','split','splitSizePdf','then','range','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','createPdfFromHTML','catch','lodash','path','pdfmake/src/printer','zip-dir','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','argv'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x1045,0x15d));var _0x5104=function(_0x121c59,_0x583b72){_0x121c59=_0x121c59-0x0;var _0x1c1b78=_0x1045[_0x121c59];return _0x1c1b78;};'use strict';var _=require(_0x5104('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x5104('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5104('0x2'));var zipdir=require(_0x5104('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0x5104('0x4'))['JSDOM'];var window=new JSDOM('')[_0x5104('0x5')];var BPromise=require(_0x5104('0x6'));var db=require(_0x5104('0x7'))['db'];var dbH=require('../../mysqldb')[_0x5104('0x8')];var logger=require(_0x5104('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5104('0xa')][0x3];var PATH=process[_0x5104('0xa')][0x4];var NAME=process[_0x5104('0xa')][0x5];var FORMAT=_0x5104('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x581d2f,_0x1c41fa){var _0x44ec30={'status':_0x581d2f};var _0x3bf754={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c41fa){_0x44ec30[_0x5104('0xc')]=_0x1c41fa;}return db[_0x5104('0xd')][_0x5104('0xe')](_0x44ec30,_0x3bf754);}function getHeaders(_0x46fb07){return _[_0x5104('0xf')](_0x46fb07,function(_0x2c3794){return{'text':_0x2c3794,'style':_0x5104('0x10')};});}function getRows(_0x2ad1d8,_0x39eee9){return _['map'](_0x39eee9,function(_0x5eb8af){return _(_0x5eb8af)[_0x5104('0x11')](_0x2ad1d8)[_0x5104('0xf')](function(_0x5c3aee){return _0x5c3aee?_[_0x5104('0x12')](_0x5c3aee):'';})['value']();});}function createTable(_0x2d41fd,_0x454531){var _0x1d2ffb={'widths':_[_0x5104('0x13')](Array(_0x2d41fd[_0x5104('0x14')]),0x91),'heights':function(_0x3bf555){return _0x3bf555===0x0?_0x5104('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f5935=getHeaders(_0x2d41fd);_0x1d2ffb[_0x5104('0x16')][_0x5104('0x17')](_0x4f5935);var _0x154656=getRows(_0x2d41fd,_0x454531);_0x1d2ffb['body']=_0x1d2ffb[_0x5104('0x16')][_0x5104('0x18')](_0x154656);return _0x1d2ffb;}function createTables(_0x2f3f14){var _0x535c3c=[];var _0x37fca9=_[_0x5104('0x19')](Object[_0x5104('0x1a')](_0x2f3f14[0x0]),0x5);_0x37fca9[_0x5104('0x1b')](function(_0x390c7d){_0x535c3c[_0x5104('0x17')](createTable(_0x390c7d,_0x2f3f14));});return _0x535c3c;}function getPDFDocDefinition(_0x319523){var _0x39da19=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x5104('0x1c')],moment(EXTRACTED_REPORT[_0x5104('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x5104('0x1e')])[_0x5104('0x1f')](FORMAT));var _0xb56c6b=[];for(var _0x6f3d37=0x0;_0x6f3d37<_0x319523[_0x5104('0x14')];_0x6f3d37++){var _0x52970b=[];if(_0x6f3d37===0x0){_0x52970b[_0x5104('0x17')]({'text':_0x39da19,'style':_0x5104('0x20')});}var _0x425408={'table':_0x319523[_0x6f3d37]};if(_0x6f3d37>0x0){_0x425408[_0x5104('0x21')]='before';_0x425408[_0x5104('0x22')]=[0x0,0x46,0x0,0x0];}_0x52970b[_0x5104('0x17')](_0x425408);_0xb56c6b[_0x5104('0x17')](_0x52970b);}return{'pageSize':'A4','pageOrientation':_0x5104('0x23'),'content':_0xb56c6b,'footer':function(_0x1cfccf,_0x16ef6f){return{'text':_0x1cfccf[_0x5104('0x12')]()+_0x5104('0x24')+_0x16ef6f,'style':'footer'};},'defaultStyle':{'font':_0x5104('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x5104('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2504b7){var _0x3bca17=0x1388;var _0x3b8411;if(!_0x2504b7[0x0]['num']){return analyticExtractedReport(_0x5104('0x27'));}return db[_0x5104('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5104('0x29'),_0x5104('0x2a')]})[_0x5104('0x2b')](function(_0x46a03e){if(_0x46a03e){_0x3b8411=_0x46a03e;_0x3bca17=_0x3b8411['splitSizePdf']||0x3e8;}})['then'](function(){var _0x21c84f=[];var _0x2a4734=0x0;if(_0x3b8411[_0x5104('0x29')]){if(_0x2504b7&&_0x2504b7[_0x5104('0x14')]){var _0x267102=_[_0x5104('0x2c')](_0x2504b7[0x0][_0x5104('0x2d')]/_0x3bca17);var _0x2bc23a=Number['isInteger'](_0x2504b7[0x0][_0x5104('0x2d')]/_0x3bca17)?_0x2504b7[0x0][_0x5104('0x2d')]%_0x3bca17:0x0;_0x267102[_0x5104('0x1b')](function(_0xa204a0){if(_0xa204a0>0x0){_0x2a4734+=_0x3bca17;}_0x21c84f['push'](dbH[_0x5104('0x2e')][_0x5104('0x2f')](util[_0x5104('0x1f')](_0x5104('0x30'),QUERY,_0x3bca17,_0x2a4734),{'type':dbH[_0x5104('0x2e')][_0x5104('0x31')][_0x5104('0x32')]}));});if(_0x2bc23a>0x0){_0x2a4734+=_0x3bca17;_0x21c84f[_0x5104('0x17')](dbH['sequelize'][_0x5104('0x2f')](util[_0x5104('0x1f')](_0x5104('0x30'),QUERY,_0x2bc23a,_0x2a4734),{'type':dbH[_0x5104('0x2e')][_0x5104('0x31')]['SELECT']}));}}}else{_0x21c84f[_0x5104('0x17')](dbH['sequelize'][_0x5104('0x2f')](QUERY,{'type':dbH[_0x5104('0x2e')][_0x5104('0x31')][_0x5104('0x32')]}));}var _0x2b2f2a=path[_0x5104('0x33')](PATH);var _0x3f2e88=path[_0x5104('0x34')](PATH,_0x5104('0x35'));var _0x10c862=_0x3b8411[_0x5104('0x29')]&&_0x21c84f[_0x5104('0x14')]>0x1;var _0x25322b=[];if(!fs[_0x5104('0x36')](path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88))&&_0x10c862){fs[_0x5104('0x38')](path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88));}return BPromise['each'](_0x21c84f,function(_0x1d6715){_0x25322b[_0x5104('0x17')](_0x1d6715);})['then'](function(){var _0x7bfa7=[];for(var _0x2a23e0=0x0;_0x2a23e0<_0x25322b[_0x5104('0x14')];_0x2a23e0+=0x1){var _0x49d16f=_0x25322b[_0x2a23e0];var _0x250525=createTables(_[_0x5104('0x39')](_0x49d16f));var _0x310529;var _0x2da152=getPDFDocDefinition(_0x250525);var _0x50ea44=getPDFPrinter();var _0x60ef36=_0x50ea44[_0x5104('0x3a')](_0x2da152);if(_0x10c862){_0x310529=path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88,util[_0x5104('0x1f')](_0x5104('0x3b'),_0x3f2e88,_0x2a23e0,_0x5104('0x3c')));}else{_0x310529=path['join'](_0x2b2f2a,util[_0x5104('0x1f')]('%s.%s',_0x3f2e88,_0x5104('0x3c')));}_0x7bfa7[_0x5104('0x17')](writePDFDocument(_0x60ef36,_0x310529));}return Promise[_0x5104('0x3d')](_0x7bfa7);})['then'](function(){if(_0x10c862){return new Promise(function(_0x391fcd){zipdir(path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88),{'saveTo':path[_0x5104('0x37')](_0x2b2f2a,util[_0x5104('0x1f')](_0x5104('0x3e'),_0x3f2e88,_0x5104('0x3f')))},function(){rimraf(path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88),function(){});_0x391fcd(_0x5104('0x40'));});});}})['then'](function(){if(!_0x10c862)return;rimraf(path[_0x5104('0x37')](_0x2b2f2a,_0x3f2e88),function(){});})['then'](function(){logger[_0x5104('0x41')](util[_0x5104('0x1f')](_0x5104('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x5104('0x43'),_0x10c862?util[_0x5104('0x1f')]('%s.%s',_0x3f2e88,_0x10c862?'zip':_0x5104('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5104('0x41')](util[_0x5104('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x5104('0xd')][_0x5104('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xfa1e14){EXTRACTED_REPORT=_0xfa1e14;return dbH['sequelize'][_0x5104('0x2f')](util[_0x5104('0x1f')](_0x5104('0x45'),QUERY),{'type':dbH[_0x5104('0x2e')][_0x5104('0x31')][_0x5104('0x32')]});})['then'](extractReport)['catch'](function(_0x303414){logger[_0x5104('0x41')](util[_0x5104('0x1f')](_0x5104('0x46'),EXTRACTED_REPORT_ID,_0x5104('0x47')),util[_0x5104('0x48')](_0x303414,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5104('0x49'));})[_0x5104('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x328b4a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x5104('0x4b'),'italics':__dirname+_0x5104('0x4c'),'bolditalics':__dirname+_0x5104('0x4d')}});return _0x328b4a;}function getPDFDocDefinitionFromHTML(_0x3ba6c,_0x2fcf54){var _0x25e458=util['format'](_0x5104('0x4e'),_0x2fcf54[_0x5104('0x4f')],_0x2fcf54[_0x5104('0x50')]);var _0x425bc0=moment()['format'](_0x5104('0x51'))[_0x5104('0x12')]();var _0x36edf1=htmlToPdfmake(_0x3ba6c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x36edf1],'defaultStyle':{'font':_0x5104('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5104('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5104('0x52')}},'header':function(){return[{'text':_0x5104('0x53'),'style':_0x5104('0x20')}];},'footer':function(_0x31a07b,_0x7abc0d){return[{'text':util['format'](_0x5104('0x54'),_0x25e458,_0x31a07b,_0x7abc0d,_0x425bc0),'style':_0x5104('0x55')}];}};}function writePDFDocument(_0x54990c,_0x8cfe13){return new Promise(function(_0x12a779,_0x5de503){var _0xb560ca=_0x54990c['pipe'](fs[_0x5104('0x56')](_0x8cfe13));_0xb560ca['on'](_0x5104('0x57'),function(){_0x12a779(_0x5104('0x57'));});_0xb560ca['on']('error',function(_0x42d40c){_0x5de503(_0x42d40c);});_0x54990c['end']();});}exports[_0x5104('0x58')]=function(_0xe6a38f,_0xcb359f){var _0x33a058=getPDFPrinter();var _0x1207e1=getPDFDocDefinitionFromHTML(_0xe6a38f,_0xcb359f);var _0x4c306f=_0x33a058['createPdfKitDocument'](_0x1207e1);return writePDFDocument(_0x4c306f,_0xcb359f[_0x5104('0x1')])[_0x5104('0x59')](function(_0x4f884c){throw _0x4f884c;});}; \ No newline at end of file +var _0xfafe=['tableHeader','pick','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','pageBreak','before','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','end','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','html-to-pdfmake','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map'];(function(_0x3d1ca0,_0x8694f4){var _0x4ce05c=function(_0x4656ea){while(--_0x4656ea){_0x3d1ca0['push'](_0x3d1ca0['shift']());}};_0x4ce05c(++_0x8694f4);}(_0xfafe,0x15e));var _0xefaf=function(_0x2cf453,_0x4482c2){_0x2cf453=_0x2cf453-0x0;var _0x23291b=_0xfafe[_0x2cf453];return _0x23291b;};'use strict';var _=require(_0xefaf('0x0'));var fs=require('fs');var util=require(_0xefaf('0x1'));var path=require(_0xefaf('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xefaf('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xefaf('0x4'));var JSDOM=require(_0xefaf('0x5'))[_0xefaf('0x6')];var window=new JSDOM('')[_0xefaf('0x7')];var BPromise=require('bluebird');var db=require(_0xefaf('0x8'))['db'];var dbH=require('../../mysqldb')[_0xefaf('0x9')];var logger=require(_0xefaf('0xa'))(_0xefaf('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xefaf('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xefaf('0xc')][0x4];var NAME=process[_0xefaf('0xc')][0x5];var FORMAT=_0xefaf('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x344970,_0xfdd10d){var _0xaaba8c={'status':_0x344970};var _0x3ac6d8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfdd10d){_0xaaba8c[_0xefaf('0xe')]=_0xfdd10d;}return db[_0xefaf('0xf')][_0xefaf('0x10')](_0xaaba8c,_0x3ac6d8);}function getHeaders(_0xf8bfa4){return _[_0xefaf('0x11')](_0xf8bfa4,function(_0x296fbb){return{'text':_0x296fbb,'style':_0xefaf('0x12')};});}function getRows(_0x323064,_0x554ae1){return _[_0xefaf('0x11')](_0x554ae1,function(_0x3bbe06){return _(_0x3bbe06)[_0xefaf('0x13')](_0x323064)['map'](function(_0x3fb77b){return _0x3fb77b?_['toString'](_0x3fb77b):'';})[_0xefaf('0x14')]();});}function createTable(_0x3ade80,_0x51cf33){var _0x4cff2f={'widths':_[_0xefaf('0x15')](Array(_0x3ade80[_0xefaf('0x16')]),0x91),'heights':function(_0x346bf1){return _0x346bf1===0x0?_0xefaf('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xadbed=getHeaders(_0x3ade80);_0x4cff2f[_0xefaf('0x18')][_0xefaf('0x19')](_0xadbed);var _0x39505d=getRows(_0x3ade80,_0x51cf33);_0x4cff2f[_0xefaf('0x18')]=_0x4cff2f['body'][_0xefaf('0x1a')](_0x39505d);return _0x4cff2f;}function createTables(_0x111aad){var _0x216773=[];var _0x598388=_[_0xefaf('0x1b')](Object[_0xefaf('0x1c')](_0x111aad[0x0]),0x5);_0x598388[_0xefaf('0x1d')](function(_0x2c35a5){_0x216773[_0xefaf('0x19')](createTable(_0x2c35a5,_0x111aad));});return _0x216773;}function getPDFDocDefinition(_0x545181){var _0x46a2fc=util[_0xefaf('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xefaf('0x1f')],moment(EXTRACTED_REPORT[_0xefaf('0x20')])[_0xefaf('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xefaf('0x21')])[_0xefaf('0x1e')](FORMAT));var _0x4d0798=[];for(var _0x5d607e=0x0;_0x5d607e<_0x545181[_0xefaf('0x16')];_0x5d607e++){var _0x3a3893=[];if(_0x5d607e===0x0){_0x3a3893['push']({'text':_0x46a2fc,'style':'header'});}var _0x49a039={'table':_0x545181[_0x5d607e]};if(_0x5d607e>0x0){_0x49a039[_0xefaf('0x22')]=_0xefaf('0x23');_0x49a039['margin']=[0x0,0x46,0x0,0x0];}_0x3a3893[_0xefaf('0x19')](_0x49a039);_0x4d0798['push'](_0x3a3893);}return{'pageSize':'A4','pageOrientation':_0xefaf('0x24'),'content':_0x4d0798,'footer':function(_0x433316,_0x35a1dd){return{'text':_0x433316[_0xefaf('0x25')]()+_0xefaf('0x26')+_0x35a1dd,'style':_0xefaf('0x27')};},'defaultStyle':{'font':_0xefaf('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xefaf('0x29')},'footer':{'alignment':_0xefaf('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x18b84b){var _0x53a887=0x1388;var _0x22f133;if(!_0x18b84b[0x0][_0xefaf('0x2b')]){return analyticExtractedReport(_0xefaf('0x2c'));}return db[_0xefaf('0x2d')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xefaf('0x2e'),_0xefaf('0x2f')]})[_0xefaf('0x30')](function(_0x44efb9){if(_0x44efb9){_0x22f133=_0x44efb9;_0x53a887=_0x22f133[_0xefaf('0x2f')]||0x3e8;}})[_0xefaf('0x30')](function(){var _0x49e410=[];var _0x3ac554=0x0;if(_0x22f133[_0xefaf('0x2e')]){if(_0x18b84b&&_0x18b84b['length']){var _0x43339c=_[_0xefaf('0x31')](_0x18b84b[0x0]['num']/_0x53a887);var _0x5edcd0=Number[_0xefaf('0x32')](_0x18b84b[0x0]['num']/_0x53a887)?_0x18b84b[0x0][_0xefaf('0x2b')]%_0x53a887:0x0;_0x43339c[_0xefaf('0x1d')](function(_0x39cd35){if(_0x39cd35>0x0){_0x3ac554+=_0x53a887;}_0x49e410[_0xefaf('0x19')](dbH[_0xefaf('0x33')][_0xefaf('0x34')](util[_0xefaf('0x1e')](_0xefaf('0x35'),QUERY,_0x53a887,_0x3ac554),{'type':dbH[_0xefaf('0x33')][_0xefaf('0x36')][_0xefaf('0x37')]}));});if(_0x5edcd0>0x0){_0x3ac554+=_0x53a887;_0x49e410['push'](dbH[_0xefaf('0x33')][_0xefaf('0x34')](util[_0xefaf('0x1e')](_0xefaf('0x35'),QUERY,_0x5edcd0,_0x3ac554),{'type':dbH[_0xefaf('0x33')][_0xefaf('0x36')][_0xefaf('0x37')]}));}}}else{_0x49e410[_0xefaf('0x19')](dbH[_0xefaf('0x33')][_0xefaf('0x34')](QUERY,{'type':dbH[_0xefaf('0x33')]['QueryTypes']['SELECT']}));}var _0x565dfe=path[_0xefaf('0x38')](PATH);var _0x57d38d=path[_0xefaf('0x39')](PATH,_0xefaf('0x3a'));var _0x19fdb9=_0x22f133[_0xefaf('0x2e')]&&_0x49e410['length']>0x1;var _0xe765b7=[];if(!fs[_0xefaf('0x3b')](path['join'](_0x565dfe,_0x57d38d))&&_0x19fdb9){fs['mkdirSync'](path[_0xefaf('0x3c')](_0x565dfe,_0x57d38d));}return BPromise[_0xefaf('0x3d')](_0x49e410,function(_0x2db13d){_0xe765b7['push'](_0x2db13d);})[_0xefaf('0x30')](function(){var _0x42bbc0=[];for(var _0x2c6eec=0x0;_0x2c6eec<_0xe765b7['length'];_0x2c6eec+=0x1){var _0x23c9fb=_0xe765b7[_0x2c6eec];var _0x3d2424=createTables(_[_0xefaf('0x3e')](_0x23c9fb));var _0x3fc5f2;var _0x42531a=getPDFDocDefinition(_0x3d2424);var _0x38ceda=getPDFPrinter();var _0xa85819=_0x38ceda['createPdfKitDocument'](_0x42531a);if(_0x19fdb9){_0x3fc5f2=path[_0xefaf('0x3c')](_0x565dfe,_0x57d38d,util['format'](_0xefaf('0x3f'),_0x57d38d,_0x2c6eec,_0xefaf('0x40')));}else{_0x3fc5f2=path[_0xefaf('0x3c')](_0x565dfe,util[_0xefaf('0x1e')](_0xefaf('0x41'),_0x57d38d,'pdf'));}_0x42bbc0[_0xefaf('0x19')](writePDFDocument(_0xa85819,_0x3fc5f2));}return Promise[_0xefaf('0x42')](_0x42bbc0);})[_0xefaf('0x30')](function(){if(_0x19fdb9){return new Promise(function(_0x568454){zipdir(path[_0xefaf('0x3c')](_0x565dfe,_0x57d38d),{'saveTo':path['join'](_0x565dfe,util[_0xefaf('0x1e')](_0xefaf('0x41'),_0x57d38d,'zip'))},function(){rimraf(path[_0xefaf('0x3c')](_0x565dfe,_0x57d38d),function(){});_0x568454(_0xefaf('0x43'));});});}})[_0xefaf('0x30')](function(){if(!_0x19fdb9)return;rimraf(path['join'](_0x565dfe,_0x57d38d),function(){});})[_0xefaf('0x30')](function(){logger[_0xefaf('0x44')](util[_0xefaf('0x1e')](_0xefaf('0x45'),EXTRACTED_REPORT_ID,_0xefaf('0x46')));return analyticExtractedReport('Completed',_0x19fdb9?util[_0xefaf('0x1e')](_0xefaf('0x41'),_0x57d38d,_0x19fdb9?_0xefaf('0x47'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xefaf('0x1e')](_0xefaf('0x48'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xefaf('0x30')](function(_0x5a9f0c){EXTRACTED_REPORT=_0x5a9f0c;return dbH[_0xefaf('0x33')][_0xefaf('0x34')](util['format'](_0xefaf('0x49'),QUERY),{'type':dbH[_0xefaf('0x33')][_0xefaf('0x36')][_0xefaf('0x37')]});})['then'](extractReport)['catch'](function(_0x323692){logger[_0xefaf('0x44')](util['format'](_0xefaf('0x4a'),EXTRACTED_REPORT_ID,_0xefaf('0x46')),util['inspect'](_0x323692,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xefaf('0x4b'));})[_0xefaf('0x4c')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1dea0d=new PdfPrinter({'Arial':{'normal':__dirname+_0xefaf('0x4d'),'bold':__dirname+_0xefaf('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xefaf('0x4f')}});return _0x1dea0d;}function getPDFDocDefinitionFromHTML(_0x30cb42,_0x4427da){var _0xdc4288=util['format'](_0xefaf('0x50'),_0x4427da[_0xefaf('0x51')],_0x4427da['interactionId']);var _0x106aa1=moment()[_0xefaf('0x1e')](_0xefaf('0x52'))['toString']();var _0x2faf81=htmlToPdfmake(_0x30cb42,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2faf81],'defaultStyle':{'font':_0xefaf('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xefaf('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xefaf('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xefaf('0x53')}},'header':function(){return[{'text':_0xefaf('0x54'),'style':'header'}];},'footer':function(_0x2d0b0b,_0x240763){return[{'text':util[_0xefaf('0x1e')](_0xefaf('0x55'),_0xdc4288,_0x2d0b0b,_0x240763,_0x106aa1),'style':_0xefaf('0x27')}];}};}function writePDFDocument(_0x9b3438,_0x48d057){return new Promise(function(_0x2b8e76,_0x23c53e){var _0x35e44e=_0x9b3438[_0xefaf('0x56')](fs['createWriteStream'](_0x48d057));_0x35e44e['on'](_0xefaf('0x57'),function(){_0x2b8e76(_0xefaf('0x57'));});_0x35e44e['on']('error',function(_0x2e8c47){_0x23c53e(_0x2e8c47);});_0x9b3438[_0xefaf('0x58')]();});}exports[_0xefaf('0x59')]=function(_0x20d2a0,_0x42ce3c){var _0xfa3f9a=getPDFPrinter();var _0x3b6dc8=getPDFDocDefinitionFromHTML(_0x20d2a0,_0x42ce3c);var _0x48c5af=_0xfa3f9a[_0xefaf('0x5a')](_0x3b6dc8);return writePDFDocument(_0x48c5af,_0x42ce3c[_0xefaf('0x2')])[_0xefaf('0x5b')](function(_0x2c05a2){throw _0x2c05a2;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a4e3d48..ed31179 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 _0x41ee=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','split','length','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','XLSX','Setting','splitSizeXlsx','query','sequelize','SELECT','then','num','Empty','range','forEach','push','QueryTypes'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x41ee,0x9b));var _0xe41e=function(_0x1735f0,_0x58ab18){_0x1735f0=_0x1735f0-0x0;var _0x3df91b=_0x41ee[_0x1735f0];return _0x3df91b;};'use strict';var util=require(_0xe41e('0x0'));var path=require(_0xe41e('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xe41e('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xe41e('0x3'));var rimraf=require(_0xe41e('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe41e('0x5'))[_0xe41e('0x6')];var logger=require(_0xe41e('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe41e('0x8')][0x2]);var QUERY=process[_0xe41e('0x8')][0x3];var PATH=process[_0xe41e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x545e54,_0x24185f){var _0x351964={'status':_0x545e54};var _0x585833={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x24185f){_0x351964[_0xe41e('0x9')]=_0x24185f;}return db['AnalyticExtractedReport']['update'](_0x351964,_0x585833);}function main(){var _0x2475e5=0x1388;var _0x505b25;logger[_0xe41e('0xa')](util[_0xe41e('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe41e('0xc')));return db[_0xe41e('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe41e('0xe')]})['then'](function(_0x251158){if(_0x251158){_0x505b25=_0x251158;_0x2475e5=_0x505b25[_0xe41e('0xe')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xe41e('0xf')](util[_0xe41e('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe41e('0x10')]['QueryTypes'][_0xe41e('0x11')]});})[_0xe41e('0x12')](function(_0x273756){if(!_0x273756[0x0][_0xe41e('0x13')]){return analyticExtractedReport(_0xe41e('0x14'));}var _0x13034d=[];var _0x53cdca=0x0;if(_0x505b25['split']){if(_0x273756&&_0x273756['length']){var _0x48501e=_[_0xe41e('0x15')](_0x273756[0x0][_0xe41e('0x13')]/_0x2475e5);var _0x335f3a=Number['isInteger'](_0x273756[0x0][_0xe41e('0x13')]/_0x2475e5)?_0x273756[0x0]['num']%_0x2475e5:0x0;_0x48501e[_0xe41e('0x16')](function(_0x59a08f){if(_0x59a08f>0x0){_0x53cdca+=_0x2475e5;}_0x13034d[_0xe41e('0x17')](dbH['sequelize'][_0xe41e('0xf')](util[_0xe41e('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2475e5,_0x53cdca),{'type':dbH[_0xe41e('0x10')][_0xe41e('0x18')][_0xe41e('0x11')]}));});if(_0x335f3a>0x0){_0x53cdca+=_0x2475e5;_0x13034d[_0xe41e('0x17')](dbH[_0xe41e('0x10')][_0xe41e('0xf')](util[_0xe41e('0xb')](_0xe41e('0x19'),QUERY,_0x335f3a,_0x53cdca),{'type':dbH[_0xe41e('0x10')][_0xe41e('0x18')][_0xe41e('0x11')]}));}}}else{_0x13034d[_0xe41e('0x17')](dbH[_0xe41e('0x10')][_0xe41e('0xf')](QUERY,{'type':dbH[_0xe41e('0x10')][_0xe41e('0x18')][_0xe41e('0x11')]}));}var _0x5e0eed=path[_0xe41e('0x1a')](PATH);var _0x37363b=path['basename'](PATH,_0xe41e('0x1b'));var _0x4425b8=_0x505b25[_0xe41e('0x1c')]&&_0x13034d[_0xe41e('0x1d')]>0x1;var _0x2d2860=[];if(!fs['existsSync'](path[_0xe41e('0x1e')](_0x5e0eed,_0x37363b))&&_0x4425b8){fs[_0xe41e('0x1f')](path[_0xe41e('0x1e')](_0x5e0eed,_0x37363b));}return BPromise[_0xe41e('0x20')](_0x13034d,function(_0x4c3ab6){_0x2d2860[_0xe41e('0x17')](_0x4c3ab6);})[_0xe41e('0x12')](function(){for(var _0x385907=0x0;_0x385907<_0x2d2860['length'];_0x385907+=0x1){var _0x545bf0;var _0x2c58a9=_0x2d2860[_0x385907];if(_0x4425b8){_0x545bf0=path[_0xe41e('0x1e')](_0x5e0eed,_0x37363b,util[_0xe41e('0xb')](_0xe41e('0x21'),_0x37363b,_0x385907,_0xe41e('0x22')));}else{_0x545bf0=path[_0xe41e('0x1e')](_0x5e0eed,util[_0xe41e('0xb')](_0xe41e('0x23'),_0x37363b,_0xe41e('0x22')));}fs[_0xe41e('0x24')](_0x545bf0,json2xls(_0x2c58a9),'binary');}})[_0xe41e('0x12')](function(){if(_0x4425b8){return new Promise(function(_0x57d443){zipdir(path[_0xe41e('0x1e')](_0x5e0eed,_0x37363b),{'saveTo':path[_0xe41e('0x1e')](_0x5e0eed,util[_0xe41e('0xb')](_0xe41e('0x23'),_0x37363b,_0xe41e('0x25')))},function(_0x280b7d,_0x155cb8){rimraf(path['join'](_0x5e0eed,_0x37363b),function(){});_0x57d443(_0xe41e('0x26'));});});}})['then'](function(){logger[_0xe41e('0xa')](util[_0xe41e('0xb')](_0xe41e('0x27'),EXTRACTED_REPORT_ID,_0xe41e('0xc')));return analyticExtractedReport('Completed',_0x4425b8?util[_0xe41e('0xb')](_0xe41e('0x23'),_0x37363b,_0x4425b8?'zip':_0xe41e('0x22')):null);});})[_0xe41e('0x28')](function(_0x45ea29){logger[_0xe41e('0xa')](util[_0xe41e('0xb')](_0xe41e('0x29'),EXTRACTED_REPORT_ID,_0xe41e('0xc')),util[_0xe41e('0x2a')](_0x45ea29,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe41e('0x2b'));})['finally'](function(){process[_0xe41e('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6a5f=['path','json2xls','bluebird','rimraf','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','query','sequelize','QueryTypes','num','Empty','isInteger','forEach','SELECT','push','dirname','basename','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util'];(function(_0x585356,_0x423e4e){var _0xac0cf4=function(_0x28d25b){while(--_0x28d25b){_0x585356['push'](_0x585356['shift']());}};_0xac0cf4(++_0x423e4e);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x9f021c,_0x59b485){_0x9f021c=_0x9f021c-0x0;var _0x3f6ca8=_0x6a5f[_0x9f021c];return _0x3f6ca8;};'use strict';var util=require(_0xf6a5('0x0'));var path=require(_0xf6a5('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xf6a5('0x2'));var BPromise=require(_0xf6a5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xf6a5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf6a5('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf6a5('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf6a5('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2919fe,_0x4627d3){var _0x1e3360={'status':_0x2919fe};var _0x19facf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4627d3){_0x1e3360[_0xf6a5('0x7')]=_0x4627d3;}return db[_0xf6a5('0x8')][_0xf6a5('0x9')](_0x1e3360,_0x19facf);}function main(){var _0x1f842a=0x1388;var _0x539ffa;logger[_0xf6a5('0xa')](util[_0xf6a5('0xb')](_0xf6a5('0xc'),EXTRACTED_REPORT_ID,_0xf6a5('0xd')));return db[_0xf6a5('0xe')][_0xf6a5('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf6a5('0x10'),'splitSizeXlsx']})[_0xf6a5('0x11')](function(_0x459f16){if(_0x459f16){_0x539ffa=_0x459f16;_0x1f842a=_0x539ffa[_0xf6a5('0x12')]||0x1388;}})[_0xf6a5('0x11')](function(){return dbH['sequelize'][_0xf6a5('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf6a5('0x14')][_0xf6a5('0x15')]['SELECT']});})[_0xf6a5('0x11')](function(_0x4a8b82){if(!_0x4a8b82[0x0][_0xf6a5('0x16')]){return analyticExtractedReport(_0xf6a5('0x17'));}var _0xf64503=[];var _0xc32639=0x0;if(_0x539ffa[_0xf6a5('0x10')]){if(_0x4a8b82&&_0x4a8b82['length']){var _0x474514=_['range'](_0x4a8b82[0x0]['num']/_0x1f842a);var _0x2b3f96=Number[_0xf6a5('0x18')](_0x4a8b82[0x0][_0xf6a5('0x16')]/_0x1f842a)?_0x4a8b82[0x0][_0xf6a5('0x16')]%_0x1f842a:0x0;_0x474514[_0xf6a5('0x19')](function(_0x4140bd){if(_0x4140bd>0x0){_0xc32639+=_0x1f842a;}_0xf64503['push'](dbH['sequelize'][_0xf6a5('0x13')](util[_0xf6a5('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1f842a,_0xc32639),{'type':dbH[_0xf6a5('0x14')]['QueryTypes'][_0xf6a5('0x1a')]}));});if(_0x2b3f96>0x0){_0xc32639+=_0x1f842a;_0xf64503[_0xf6a5('0x1b')](dbH['sequelize']['query'](util[_0xf6a5('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b3f96,_0xc32639),{'type':dbH[_0xf6a5('0x14')][_0xf6a5('0x15')][_0xf6a5('0x1a')]}));}}}else{_0xf64503[_0xf6a5('0x1b')](dbH[_0xf6a5('0x14')][_0xf6a5('0x13')](QUERY,{'type':dbH[_0xf6a5('0x14')][_0xf6a5('0x15')][_0xf6a5('0x1a')]}));}var _0x244d0b=path[_0xf6a5('0x1c')](PATH);var _0x4669b5=path[_0xf6a5('0x1d')](PATH,'.xlsx');var _0x5968af=_0x539ffa[_0xf6a5('0x10')]&&_0xf64503[_0xf6a5('0x1e')]>0x1;var _0x1bc1d7=[];if(!fs[_0xf6a5('0x1f')](path[_0xf6a5('0x20')](_0x244d0b,_0x4669b5))&&_0x5968af){fs[_0xf6a5('0x21')](path[_0xf6a5('0x20')](_0x244d0b,_0x4669b5));}return BPromise['each'](_0xf64503,function(_0x256ba6){_0x1bc1d7[_0xf6a5('0x1b')](_0x256ba6);})[_0xf6a5('0x11')](function(){for(var _0x4a6003=0x0;_0x4a6003<_0x1bc1d7[_0xf6a5('0x1e')];_0x4a6003+=0x1){var _0x3f5be9;var _0x547cd2=_0x1bc1d7[_0x4a6003];if(_0x5968af){_0x3f5be9=path[_0xf6a5('0x20')](_0x244d0b,_0x4669b5,util[_0xf6a5('0xb')](_0xf6a5('0x22'),_0x4669b5,_0x4a6003,'xlsx'));}else{_0x3f5be9=path[_0xf6a5('0x20')](_0x244d0b,util[_0xf6a5('0xb')](_0xf6a5('0x23'),_0x4669b5,'xlsx'));}fs[_0xf6a5('0x24')](_0x3f5be9,json2xls(_0x547cd2),_0xf6a5('0x25'));}})[_0xf6a5('0x11')](function(){if(_0x5968af){return new Promise(function(_0x5a8742){zipdir(path['join'](_0x244d0b,_0x4669b5),{'saveTo':path[_0xf6a5('0x20')](_0x244d0b,util['format']('%s.%s',_0x4669b5,_0xf6a5('0x26')))},function(_0x1e0807,_0x5a1988){rimraf(path['join'](_0x244d0b,_0x4669b5),function(){});_0x5a8742('zip\x20finished');});});}})[_0xf6a5('0x11')](function(){logger['info'](util[_0xf6a5('0xb')](_0xf6a5('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xf6a5('0x28'),_0x5968af?util[_0xf6a5('0xb')]('%s.%s',_0x4669b5,_0x5968af?_0xf6a5('0x26'):_0xf6a5('0x29')):null);});})['catch'](function(_0x29691f){logger['info'](util[_0xf6a5('0xb')](_0xf6a5('0x2a'),EXTRACTED_REPORT_ID,_0xf6a5('0xd')),util[_0xf6a5('0x2b')](_0x29691f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6a5('0x2c'));})[_0xf6a5('0x2d')](function(){process[_0xf6a5('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 166e918..cd68714 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 _0xfa89=['CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','type','format','context','VoiceExtensionId','inbound','push','Set'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0xfa89,0x15d));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9fa8('0x0'));var util=require(_0x9fa8('0x1'));function rewrite(_0x6f9cdf,_0x1c8ee7){var _0x2b8c96=this;return _0x6f9cdf[_0x9fa8('0x2')]['Interval'][_0x9fa8('0x3')]({'raw':!![]})[_0x9fa8('0x4')](function(_0x29cea5){_0x2b8c96[_0x9fa8('0x5')]=_0x29cea5;return _0x6f9cdf[_0x9fa8('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x1c8ee7[_0x9fa8('0x6')]},'raw':!![]});})['then'](function(_0x45a63e){return _0x6f9cdf['models'][_0x9fa8('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x9fa8('0x8')](_0x45a63e,_0x9fa8('0x9')))}},'order':[{'raw':_0x9fa8('0xa')}],'raw':!![]});})[_0x9fa8('0x4')](function(_0x5328f2){var _0x526b58=_[_0x9fa8('0xb')](_0x5328f2,{'priority':'1'});var _0x2d012e=_[_0x9fa8('0xb')](_0x5328f2,{'isApp':0x1});var _0x70ae12=_[_0x9fa8('0xc')](_0x2d012e,_0x9fa8('0x9'));var _0x2616d7=[_0x9fa8('0xd'),_0x9fa8('0xe')];var _0x17976f=[];var _0x2b5d15=[];for(var _0x5d1292 in _0x70ae12){if(_0x70ae12[_0x9fa8('0xf')](_0x5d1292)){_0x2b8c96[_0x9fa8('0x10')]=0x2;_0x2b8c96[_0x9fa8('0x11')]=[];_0x2b8c96[_0x9fa8('0x12')]=_['find'](_0x526b58,{'exten':_0x70ae12[_0x5d1292][0x0]['exten']});_0x2b8c96[_0x9fa8('0x11')]['push']({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':'Set','appdata':util[_0x9fa8('0x14')]('CDR(type)=%s',_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')]),'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});if(_0x70ae12[_0x5d1292][0x0]['type']===_0x9fa8('0x17')){_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x1a')+_0x70ae12[_0x5d1292][0x0]['VoiceExtensionId'],'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0]['exten'],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});}else if(_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')]===_0x9fa8('0x1b')){if(_0x2b8c96[_0x9fa8('0x12')]){_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x1c')+(_0x2b8c96[_0x9fa8('0x12')][_0x9fa8('0x1d')]?_0x9fa8('0x1e')+_0x2b8c96[_0x9fa8('0x12')]['cutdigits']+'}':_0x9fa8('0x1f')),'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});}_0x2b8c96['extensions'][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':'CDR(routeid)='+_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')],'context':_0x70ae12[_0x5d1292][0x0]['context'],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});var _0x4ffa90=_0x2b8c96['priority']++;_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':'ExecIf','appdata':_0x9fa8('0x20')+(_0x4ffa90+0x2)+_0x9fa8('0x21')+(_0x4ffa90+0x1)+')','context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x4ffa90,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});if(_0x2b8c96[_0x9fa8('0x12')]){_0x2b8c96[_0x9fa8('0x11')]['push']({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':'Set','appdata':_0x2b8c96[_0x9fa8('0x12')][_0x9fa8('0x1d')]?_0x9fa8('0x22')+_0x2b8c96[_0x9fa8('0x12')][_0x9fa8('0x1d')]+'}':_0x9fa8('0x23'),'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96['priority']++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});}_0x2b8c96['extensions'][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x24')+_0x70ae12[_0x5d1292][0x0]['VoiceExtensionId'],'context':_0x70ae12[_0x5d1292][0x0]['context'],'exten':_0x70ae12[_0x5d1292][0x0]['exten'],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});if(_0x2b8c96[_0x9fa8('0x12')]&&_0x2b8c96[_0x9fa8('0x12')]['hasOwnProperty']('recordingFormat')&&_0x2b8c96[_0x9fa8('0x12')][_0x9fa8('0x25')]!==_0x9fa8('0x26')){_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':'Set','appdata':_0x9fa8('0x27'),'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0]['type'],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x28')+_0x2b8c96[_0x9fa8('0x12')]['recordingFormat']||_0x9fa8('0x29'),'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0]['exten'],'priority':_0x2b8c96['priority']++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});}}_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0]['type'],'app':_0x9fa8('0x19'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'exten':_0x70ae12[_0x5d1292][0x0]['exten'],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0]['VoiceExtensionId']});_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x2a'),'context':_0x70ae12[_0x5d1292][0x0]['context'],'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0]['VoiceExtensionId']});_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0]['type'],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x2b'),'context':_0x70ae12[_0x5d1292][0x0]['context'],'exten':_0x70ae12[_0x5d1292][0x0]['exten'],'priority':_0x2b8c96[_0x9fa8('0x10')]++,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});for(var _0x4bd1f4=0x0,_0x4f698b=0x0;_0x4bd1f4<_0x70ae12[_0x5d1292][_0x9fa8('0x2c')];_0x4bd1f4+=0x1,_0x4f698b=0x0){var _0x424c34=_0x70ae12[_0x5d1292][_0x4bd1f4];if(_0x424c34[_0x9fa8('0x13')]){_0x424c34[_0x9fa8('0x13')]=_0x424c34[_0x9fa8('0x13')]['toLowerCase']();}var _0xb34e63=[];var _0xfbaef0=[];delete _0x424c34['id'];delete _0x424c34[_0x9fa8('0x2d')];delete _0x424c34[_0x9fa8('0x2e')];var _0x36cd69=_0x424c34[_0x9fa8('0x2f')]!==_0x9fa8('0x30')?[_0x424c34[_0x9fa8('0x2f')]]:_0x424c34['IntervalId']?_[_0x9fa8('0x8')](_[_0x9fa8('0xb')](_0x2b8c96[_0x9fa8('0x5')],{'IntervalId':_0x424c34['IntervalId']}),_0x9fa8('0x2f')):[];if(_0x424c34[_0x9fa8('0xf')](_0x9fa8('0x31'))){if(_0x424c34[_0x9fa8('0x31')]&&_0x424c34[_0x9fa8('0x31')]!=='--'){_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34[_0x9fa8('0x13')],'app':_0x9fa8('0x19'),'appdata':_0x9fa8('0x32')+_0x424c34['tag'],'context':_0x424c34[_0x9fa8('0x15')],'exten':_0x424c34[_0x9fa8('0x9')],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96['priority']+_0x4f698b++,'VoiceExtensionId':_0x424c34['VoiceExtensionId']});}}if(_0x424c34['type']==='outbound'&&_0x424c34[_0x9fa8('0xf')](_0x9fa8('0x33'))){if(_0x424c34['callerID']){_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34[_0x9fa8('0x13')],'app':'ExecIf','appdata':_0x9fa8('0x34')+_0x424c34[_0x9fa8('0x33')]+')','context':_0x424c34[_0x9fa8('0x15')],'exten':_0x424c34[_0x9fa8('0x9')],'priority':_0x36cd69['length']+_0x2b8c96['priority']+_0x4f698b++,'VoiceExtensionId':_0x424c34['VoiceExtensionId']});}else{_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34[_0x9fa8('0x13')],'app':_0x9fa8('0x35'),'appdata':_0x9fa8('0x36'),'context':_0x424c34['context'],'exten':_0x424c34[_0x9fa8('0x9')],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96[_0x9fa8('0x10')]+_0x4f698b++,'VoiceExtensionId':_0x424c34[_0x9fa8('0x16')]});}}if(_0x424c34[_0x9fa8('0xf')](_0x9fa8('0x37'))){if(_0x2616d7[_0x9fa8('0x38')](_0x424c34[_0x9fa8('0x39')][_0x9fa8('0x3a')]())>=0x0&&_0x424c34[_0x9fa8('0x3b')]!==_0x9fa8('0x3c')){if(_0x424c34[_0x9fa8('0x37')]){_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34[_0x9fa8('0x13')],'app':_0x9fa8('0x35'),'appdata':_0x9fa8('0x3d'),'context':_0x424c34[_0x9fa8('0x15')],'exten':_0x424c34['exten'],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96[_0x9fa8('0x10')]+_0x4f698b++,'VoiceExtensionId':_0x424c34[_0x9fa8('0x16')]});_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34[_0x9fa8('0x13')],'app':'Set','appdata':_0x9fa8('0x3e'),'context':_0x424c34[_0x9fa8('0x15')],'exten':_0x424c34['exten'],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96[_0x9fa8('0x10')]+_0x4f698b++,'VoiceExtensionId':_0x424c34['VoiceExtensionId']});}else{_0xb34e63['push']({'type':_0x424c34[_0x9fa8('0x13')],'app':'ExecIf','appdata':_0x9fa8('0x3f'),'context':_0x424c34[_0x9fa8('0x15')],'exten':_0x424c34[_0x9fa8('0x9')],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96[_0x9fa8('0x10')]+_0x4f698b++,'VoiceExtensionId':_0x424c34[_0x9fa8('0x16')]});_0xb34e63[_0x9fa8('0x18')]({'type':_0x424c34['type'],'app':_0x9fa8('0x19'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x424c34['context'],'exten':_0x424c34[_0x9fa8('0x9')],'priority':_0x36cd69[_0x9fa8('0x2c')]+_0x2b8c96[_0x9fa8('0x10')]+_0x4f698b++,'VoiceExtensionId':_0x424c34['VoiceExtensionId']});}}}for(var _0x1d737c=0x0;_0x1d737c<_0x36cd69[_0x9fa8('0x2c')];_0x1d737c+=0x1){var _0x104d2a=_0x2b8c96[_0x9fa8('0x10')]+_0x36cd69[_0x9fa8('0x2c')];var _0x3ddc2d=_0x1d737c===_0x36cd69[_0x9fa8('0x2c')]-0x1?_0x2b8c96[_0x9fa8('0x10')]+_0xb34e63[_0x9fa8('0x2c')]+_0xfbaef0[_0x9fa8('0x2c')]+0x2:_0x2b8c96[_0x9fa8('0x10')]+_0x1d737c+0x1;_0xb34e63[_0x9fa8('0x40')](_0x1d737c,0x0,{'type':_0x424c34[_0x9fa8('0x13')],'app':'GotoIfTime','appdata':_0x36cd69[_0x1d737c]+'?'+_0x424c34['context']+',${EXTEN},'+_0x104d2a+':'+_0x424c34['context']+_0x9fa8('0x41')+_0x3ddc2d,'exten':_0x424c34[_0x9fa8('0x9')],'context':_0x424c34[_0x9fa8('0x15')],'priority':_0x2b8c96[_0x9fa8('0x10')]+_0x1d737c,'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0]['VoiceExtensionId']});}_0x424c34['priority']=_0xb34e63[_0x9fa8('0x2c')]?_['last'](_0xb34e63)[_0x9fa8('0x10')]+0x1:_0x2b8c96[_0x9fa8('0x10')];_0x2b8c96[_0x9fa8('0x10')]=(_0xfbaef0[_0x9fa8('0x2c')]?_[_0x9fa8('0x42')](_0xfbaef0)[_0x9fa8('0x10')]:_0x424c34[_0x9fa8('0x10')])+0x1;_0x2b8c96[_0x9fa8('0x11')]=_[_0x9fa8('0x43')](_0x2b8c96[_0x9fa8('0x11')],_0xb34e63,[_0x424c34],_0xfbaef0);}_0x2b8c96[_0x9fa8('0x11')][_0x9fa8('0x18')]({'type':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x13')],'app':_0x9fa8('0x44'),'exten':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x9')],'context':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x15')],'priority':_0x2b8c96[_0x9fa8('0x10')],'VoiceExtensionId':_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]});_0x17976f[_0x9fa8('0x18')](_0x70ae12[_0x5d1292][0x0][_0x9fa8('0x16')]);_0x2b5d15=_['concat'](_0x2b5d15,_0x2b8c96[_0x9fa8('0x11')]);}}return _0x6f9cdf[_0x9fa8('0x45')](function(_0x25c9c5){return _0x6f9cdf['models'][_0x9fa8('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x17976f}},'transaction':_0x25c9c5})['then'](function(_0x4747ae){return _0x6f9cdf[_0x9fa8('0x2')][_0x9fa8('0x7')][_0x9fa8('0x46')](_[_0x9fa8('0x47')](_0x2b5d15,_0x9fa8('0x10')),{'transaction':_0x25c9c5});});});})[_0x9fa8('0x48')](function(_0xbbba94){console[_0x9fa8('0x49')](_0xbbba94);});}exports[_0x9fa8('0x4a')]=rewrite; \ No newline at end of file +var _0xb50f=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','intervals','VoiceExtension','IntervalId','then','findAll','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','exten','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','push','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb50f,0x1c5));var _0xfb50=function(_0x4c3f1c,_0x30d1a5){_0x4c3f1c=_0x4c3f1c-0x0;var _0x2119b4=_0xb50f[_0x4c3f1c];return _0x2119b4;};'use strict';var _=require(_0xfb50('0x0'));var util=require(_0xfb50('0x1'));function rewrite(_0x191c92,_0x3cad32){var _0x4cc430=this;return _0x191c92[_0xfb50('0x2')][_0xfb50('0x3')]['findAll']({'raw':!![]})['then'](function(_0x31af65){_0x4cc430[_0xfb50('0x4')]=_0x31af65;return _0x191c92[_0xfb50('0x2')][_0xfb50('0x5')]['findAll']({'where':{'IntervalId':_0x3cad32[_0xfb50('0x6')]},'raw':!![]});})[_0xfb50('0x7')](function(_0x32e16f){return _0x191c92[_0xfb50('0x2')]['VoiceExtension'][_0xfb50('0x8')]({'where':{'exten':{'$in':_[_0xfb50('0x9')](_[_0xfb50('0xa')](_0x32e16f,'exten'))}},'order':[{'raw':_0xfb50('0xb')}],'raw':!![]});})[_0xfb50('0x7')](function(_0x6f701f){var _0x5f32fd=_[_0xfb50('0xc')](_0x6f701f,{'priority':'1'});var _0x5ee9f9=_[_0xfb50('0xc')](_0x6f701f,{'isApp':0x1});var _0x4ddbac=_[_0xfb50('0xd')](_0x5ee9f9,'exten');var _0x1864c2=[_0xfb50('0xe'),_0xfb50('0xf')];var _0x42a791=[];var _0x1955f8=[];for(var _0x217b77 in _0x4ddbac){if(_0x4ddbac[_0xfb50('0x10')](_0x217b77)){_0x4cc430[_0xfb50('0x11')]=0x2;_0x4cc430[_0xfb50('0x12')]=[];_0x4cc430[_0xfb50('0x13')]=_[_0xfb50('0x14')](_0x5f32fd,{'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')]});_0x4cc430['extensions']['push']({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':_0xfb50('0x17'),'appdata':util[_0xfb50('0x18')](_0xfb50('0x19'),_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')]),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430['priority']++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});if(_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')]==='inbound'){_0x4cc430['extensions'][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':_0xfb50('0x17'),'appdata':'CDR(routeid)='+_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')],'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0]['exten'],'priority':_0x4cc430['priority']++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0]['VoiceExtensionId']});}else if(_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')]===_0xfb50('0x1d')){if(_0x4cc430[_0xfb50('0x13')]){_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':_0xfb50('0x17'),'appdata':_0xfb50('0x1e')+(_0x4cc430[_0xfb50('0x13')][_0xfb50('0x1f')]?'${EXTEN:'+_0x4cc430[_0xfb50('0x13')][_0xfb50('0x1f')]+'}':_0xfb50('0x20')),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0]['VoiceExtensionId']});}_0x4cc430[_0xfb50('0x12')]['push']({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':'Set','appdata':_0xfb50('0x21')+_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')],'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0]['VoiceExtensionId']});var _0x48bb40=_0x4cc430[_0xfb50('0x11')]++;_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':_0xfb50('0x22'),'appdata':_0xfb50('0x23')+(_0x48bb40+0x2)+_0xfb50('0x24')+(_0x48bb40+0x1)+')','context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0]['exten'],'priority':_0x48bb40,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});if(_0x4cc430[_0xfb50('0x13')]){_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':_0xfb50('0x17'),'appdata':_0x4cc430['extension'][_0xfb50('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x4cc430[_0xfb50('0x13')]['cutdigits']+'}':_0xfb50('0x25'),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0]['exten'],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});}_0x4cc430['extensions']['push']({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':_0xfb50('0x17'),'appdata':_0xfb50('0x26')+_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')],'context':_0x4ddbac[_0x217b77][0x0]['context'],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});if(_0x4cc430[_0xfb50('0x13')]&&_0x4cc430[_0xfb50('0x13')]['hasOwnProperty'](_0xfb50('0x27'))&&_0x4cc430[_0xfb50('0x13')][_0xfb50('0x27')]!=='none'){_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':_0xfb50('0x17'),'appdata':_0xfb50('0x28'),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0]['exten'],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':'Set','appdata':_0xfb50('0x29')+_0x4cc430[_0xfb50('0x13')][_0xfb50('0x27')]||_0xfb50('0x2a'),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430['priority']++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0]['VoiceExtensionId']});}}_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4ddbac[_0x217b77][0x0]['context'],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0]['VoiceExtensionId']});_0x4cc430[_0xfb50('0x12')][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0]['type'],'app':'Set','appdata':_0xfb50('0x2b'),'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'exten':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x15')],'priority':_0x4cc430[_0xfb50('0x11')]++,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});for(var _0x5f118c=0x0,_0x18be45=0x0;_0x5f118c<_0x4ddbac[_0x217b77][_0xfb50('0x2c')];_0x5f118c+=0x1,_0x18be45=0x0){var _0x1be1bb=_0x4ddbac[_0x217b77][_0x5f118c];if(_0x1be1bb['type']){_0x1be1bb[_0xfb50('0x16')]=_0x1be1bb['type'][_0xfb50('0x2d')]();}var _0x3db9a3=[];var _0x5ed4df=[];delete _0x1be1bb['id'];delete _0x1be1bb['createdAt'];delete _0x1be1bb[_0xfb50('0x2e')];var _0x1c373e=_0x1be1bb[_0xfb50('0x2f')]!==_0xfb50('0x30')?[_0x1be1bb[_0xfb50('0x2f')]]:_0x1be1bb[_0xfb50('0x6')]?_[_0xfb50('0xa')](_[_0xfb50('0xc')](_0x4cc430['intervals'],{'IntervalId':_0x1be1bb['IntervalId']}),_0xfb50('0x2f')):[];if(_0x1be1bb[_0xfb50('0x10')]('tag')){if(_0x1be1bb['tag']&&_0x1be1bb[_0xfb50('0x31')]!=='--'){_0x3db9a3['push']({'type':_0x1be1bb[_0xfb50('0x16')],'app':_0xfb50('0x17'),'appdata':_0xfb50('0x32')+_0x1be1bb['tag'],'context':_0x1be1bb[_0xfb50('0x1a')],'exten':_0x1be1bb['exten'],'priority':_0x1c373e['length']+_0x4cc430[_0xfb50('0x11')]+_0x18be45++,'VoiceExtensionId':_0x1be1bb[_0xfb50('0x1b')]});}}if(_0x1be1bb[_0xfb50('0x16')]===_0xfb50('0x1d')&&_0x1be1bb[_0xfb50('0x10')](_0xfb50('0x33'))){if(_0x1be1bb[_0xfb50('0x33')]){_0x3db9a3[_0xfb50('0x1c')]({'type':_0x1be1bb[_0xfb50('0x16')],'app':_0xfb50('0x22'),'appdata':_0xfb50('0x34')+_0x1be1bb[_0xfb50('0x33')]+')','context':_0x1be1bb[_0xfb50('0x1a')],'exten':_0x1be1bb[_0xfb50('0x15')],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430['priority']+_0x18be45++,'VoiceExtensionId':_0x1be1bb[_0xfb50('0x1b')]});}else{_0x3db9a3['push']({'type':_0x1be1bb['type'],'app':_0xfb50('0x22'),'appdata':_0xfb50('0x35'),'context':_0x1be1bb[_0xfb50('0x1a')],'exten':_0x1be1bb[_0xfb50('0x15')],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430[_0xfb50('0x11')]+_0x18be45++,'VoiceExtensionId':_0x1be1bb[_0xfb50('0x1b')]});}}if(_0x1be1bb[_0xfb50('0x10')](_0xfb50('0x36'))){if(_0x1864c2[_0xfb50('0x37')](_0x1be1bb[_0xfb50('0x38')]['toLowerCase']())>=0x0&&_0x1be1bb['appType']!==_0xfb50('0x39')){if(_0x1be1bb[_0xfb50('0x36')]){_0x3db9a3[_0xfb50('0x1c')]({'type':_0x1be1bb[_0xfb50('0x16')],'app':_0xfb50('0x22'),'appdata':_0xfb50('0x3a'),'context':_0x1be1bb[_0xfb50('0x1a')],'exten':_0x1be1bb['exten'],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430[_0xfb50('0x11')]+_0x18be45++,'VoiceExtensionId':_0x1be1bb['VoiceExtensionId']});_0x3db9a3[_0xfb50('0x1c')]({'type':_0x1be1bb[_0xfb50('0x16')],'app':'Set','appdata':_0xfb50('0x3b'),'context':_0x1be1bb['context'],'exten':_0x1be1bb[_0xfb50('0x15')],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430[_0xfb50('0x11')]+_0x18be45++,'VoiceExtensionId':_0x1be1bb[_0xfb50('0x1b')]});}else{_0x3db9a3[_0xfb50('0x1c')]({'type':_0x1be1bb['type'],'app':_0xfb50('0x22'),'appdata':_0xfb50('0x3c'),'context':_0x1be1bb['context'],'exten':_0x1be1bb[_0xfb50('0x15')],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430[_0xfb50('0x11')]+_0x18be45++,'VoiceExtensionId':_0x1be1bb[_0xfb50('0x1b')]});_0x3db9a3[_0xfb50('0x1c')]({'type':_0x1be1bb[_0xfb50('0x16')],'app':_0xfb50('0x17'),'appdata':_0xfb50('0x3d'),'context':_0x1be1bb[_0xfb50('0x1a')],'exten':_0x1be1bb[_0xfb50('0x15')],'priority':_0x1c373e[_0xfb50('0x2c')]+_0x4cc430['priority']+_0x18be45++,'VoiceExtensionId':_0x1be1bb['VoiceExtensionId']});}}}for(var _0x175279=0x0;_0x175279<_0x1c373e[_0xfb50('0x2c')];_0x175279+=0x1){var _0x3b948f=_0x4cc430[_0xfb50('0x11')]+_0x1c373e[_0xfb50('0x2c')];var _0x38ab85=_0x175279===_0x1c373e[_0xfb50('0x2c')]-0x1?_0x4cc430[_0xfb50('0x11')]+_0x3db9a3[_0xfb50('0x2c')]+_0x5ed4df[_0xfb50('0x2c')]+0x2:_0x4cc430[_0xfb50('0x11')]+_0x175279+0x1;_0x3db9a3['splice'](_0x175279,0x0,{'type':_0x1be1bb['type'],'app':_0xfb50('0x3e'),'appdata':_0x1c373e[_0x175279]+'?'+_0x1be1bb[_0xfb50('0x1a')]+_0xfb50('0x3f')+_0x3b948f+':'+_0x1be1bb[_0xfb50('0x1a')]+_0xfb50('0x3f')+_0x38ab85,'exten':_0x1be1bb[_0xfb50('0x15')],'context':_0x1be1bb['context'],'priority':_0x4cc430['priority']+_0x175279,'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});}_0x1be1bb[_0xfb50('0x11')]=_0x3db9a3[_0xfb50('0x2c')]?_[_0xfb50('0x40')](_0x3db9a3)[_0xfb50('0x11')]+0x1:_0x4cc430[_0xfb50('0x11')];_0x4cc430[_0xfb50('0x11')]=(_0x5ed4df[_0xfb50('0x2c')]?_[_0xfb50('0x40')](_0x5ed4df)[_0xfb50('0x11')]:_0x1be1bb[_0xfb50('0x11')])+0x1;_0x4cc430[_0xfb50('0x12')]=_[_0xfb50('0x41')](_0x4cc430[_0xfb50('0x12')],_0x3db9a3,[_0x1be1bb],_0x5ed4df);}_0x4cc430['extensions'][_0xfb50('0x1c')]({'type':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x16')],'app':_0xfb50('0x42'),'exten':_0x4ddbac[_0x217b77][0x0]['exten'],'context':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1a')],'priority':_0x4cc430[_0xfb50('0x11')],'VoiceExtensionId':_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]});_0x42a791[_0xfb50('0x1c')](_0x4ddbac[_0x217b77][0x0][_0xfb50('0x1b')]);_0x1955f8=_[_0xfb50('0x41')](_0x1955f8,_0x4cc430[_0xfb50('0x12')]);}}return _0x191c92[_0xfb50('0x43')](function(_0x2d769a){return _0x191c92[_0xfb50('0x2')][_0xfb50('0x5')][_0xfb50('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x42a791}},'transaction':_0x2d769a})[_0xfb50('0x7')](function(_0x567606){return _0x191c92['models']['VoiceExtension'][_0xfb50('0x45')](_[_0xfb50('0x46')](_0x1955f8,_0xfb50('0x11')),{'transaction':_0x2d769a});});});})['catch'](function(_0x377c20){console[_0xfb50('0x47')](_0x377c20);});}exports[_0xfb50('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9a108c6..29f6963 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 _0x0967=['finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','createdAt','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','updatedAt','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','sequelize','query','VoiceQueueId','onlyIfOpen','get','all','Campaign','dialCheckDuplicateType','Lists','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0967,0x7e));var _0x7096=function(_0x21515c,_0x158adb){_0x21515c=_0x21515c-0x0;var _0x33c9cd=_0x0967[_0x21515c];return _0x33c9cd;};'use strict';var BPromise=require('bluebird');var util=require(_0x7096('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x7096('0x1'));var Redis=require('ioredis');var db=require(_0x7096('0x2'))['db'];var config=require(_0x7096('0x3'));var logger=require('../../../config/logger')(_0x7096('0x4'));config[_0x7096('0x5')]=_[_0x7096('0x6')](config[_0x7096('0x5')],{'host':_0x7096('0x7'),'port':0x18eb});var socket=require(_0x7096('0x8'))(new Redis(config[_0x7096('0x5')]));require(_0x7096('0x9'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x7096('0xa')][0x2]===_0x7096('0xb')||process[_0x7096('0xa')][0x2]==='null'){throw new Error(_0x7096('0xc'));}var FILEPATH=process[_0x7096('0xa')][0x2];if(!process[_0x7096('0xa')][0x3]||process[_0x7096('0xa')][0x3]==='undefined'||process[_0x7096('0xa')][0x3]===_0x7096('0xd')||!process[_0x7096('0xa')][0x4]||process[_0x7096('0xa')][0x4]==='undefined'||process[_0x7096('0xa')][0x4]===_0x7096('0xd')){throw new Error(_0x7096('0xe'));}var FIELDS=_[_0x7096('0xf')](process[_0x7096('0xa')][0x3][_0x7096('0x10')](','),process['argv'][0x4][_0x7096('0x10')](','));if(!process[_0x7096('0xa')][0x5]||process['argv'][0x5]===_0x7096('0xb')||process[_0x7096('0xa')][0x5]===_0x7096('0xd')){throw new Error(_0x7096('0x11'));}var LISTID=process[_0x7096('0xa')][0x5];var COMPANYID=process[_0x7096('0xa')][0x6]&&process[_0x7096('0xa')][0x6]!==_0x7096('0xb')&&process['argv'][0x6]!==_0x7096('0xd')?process[_0x7096('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x7096('0xb')&&process[_0x7096('0xa')][0x7]!==_0x7096('0xd')?process[_0x7096('0xa')][0x7]:null;if(!process[_0x7096('0xa')][0x8]||process['argv'][0x8]===_0x7096('0xb')||process[_0x7096('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7096('0xa')][0x8];}catch(_0x1ace9f){logger[_0x7096('0x12')](_0x1ace9f);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(_0x27c4ce,_0x406e96,_0x141139,_0x5618fd){var _0x5bf723={'message':_0x406e96};_0x5bf723[_0x27c4ce]=!![];if(_0x141139){_0x5bf723[_0x7096('0x13')]=_0x141139;}if(_0x5618fd){_0x5bf723[_0x7096('0x14')]=_0x5618fd;}return _0x5bf723;}function isEmail(_0x3293e5){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))*$/[_0x7096('0x15')](_0x3293e5);}function checkRow(_0x5b5db3,_0x1dfd39,_0x5b4ceb){return new BPromise(function(_0x414b50,_0x19c7f2){if(_[_0x7096('0x16')](_0x5b5db3)){return _0x19c7f2(handleCheckRowError(_0x7096('0x12'),_0x7096('0x17'),null,_0x5b4ceb));}if(_0x5b5db3['errors']&&_0x5b5db3[_0x7096('0x18')]['length']){var _0x57b8ac=_[_0x7096('0x19')](_0x5b5db3[_0x7096('0x18')],'message')[_0x7096('0x1a')](';');return _0x19c7f2(handleCheckRowError(_0x7096('0x12'),_0x57b8ac,null,_0x5b4ceb));}var _0x49458c={};for(var _0x2ec637 in FIELDS){if(FIELDS[_0x7096('0x1b')](_0x2ec637)&&FIELDS[_0x2ec637]){_0x49458c[_0x2ec637]=_0x5b5db3['data'][0x0][FIELDS[_0x2ec637]]||_0x5b5db3[_0x7096('0x1c')][0x0]['\ufeff'+FIELDS[_0x2ec637]];}}if(!_0x49458c[_0x7096('0x1d')]){return _0x19c7f2(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x5b4ceb));}if(!_0x49458c[_0x7096('0x1e')]){return _0x19c7f2(handleCheckRowError(_0x7096('0x12'),'phone\x20not\x20specified!',null,_0x5b4ceb));}if(_0x49458c[_0x7096('0x1f')]){var _0x5830c9=moment(_0x49458c[_0x7096('0x1f')],_0x7096('0x20'));if(!_0x5830c9['isValid']()){return _0x19c7f2(handleCheckRowError(_0x7096('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5b4ceb));}}if(_0x49458c[_0x7096('0x21')]){if(!isEmail(_0x49458c['email'])){return _0x19c7f2(handleCheckRowError('error',_0x7096('0x22'),null,_0x5b4ceb));}}_0x49458c[_0x7096('0x23')]=LISTID;_0x49458c['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7096('0x24')]&&_0x1dfd39){var _0x5c6c09={};for(var _0x4e4f42=0x0,_0x55b86f=DUPLICATES[_0x7096('0x24')];_0x4e4f42<_0x55b86f;_0x4e4f42+=0x1){_0x5c6c09[DUPLICATES[_0x4e4f42]]=_0x49458c[DUPLICATES[_0x4e4f42]];}var _0x3d25b1=_[_0x7096('0x25')](_0x1dfd39,_0x5c6c09);if(_0x3d25b1){return _0x19c7f2(handleCheckRowError(_0x7096('0x26'),_0x7096('0x27'),_0x3d25b1,_0x5b4ceb));}}return db[_0x7096('0x28')]['create'](_0x49458c,{'raw':!![],'hooks':![],'fields':_[_0x7096('0x29')](_0x49458c)})[_0x7096('0x2a')](function(_0xbd3730){if(DUPLICATES&&DUPLICATES[_0x7096('0x24')]&&_0x1dfd39){_0x1dfd39[_0x7096('0x2b')](_[_0x7096('0x2c')](_0x49458c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xbd3730['id'];return _0x414b50();})[_0x7096('0x2d')](function(_0x41e3db){return _0x19c7f2(handleCheckRowError(_0x7096('0x12'),_0x7096('0x2e')+(_0x41e3db[_0x7096('0x2f')]||JSON[_0x7096('0x30')](_0x41e3db)),null,_0x5b4ceb));});});}function checkHopper(){function _0x5d0fd7(){return function(_0x162923){logger[_0x7096('0x12')](_0x7096('0x31'),_0x7096('0x32'),util[_0x7096('0x33')](_0x162923,{'showHidden':![],'depth':null}));};}var _0xe701e7=function(_0x321da6,_0x519fac){var _0x1216eb=squel[_0x7096('0x34')]()[_0x7096('0x35')](_0x7096('0x36'))[_0x7096('0x37')]([_0x7096('0x1e'),_0x7096('0x38'),_0x7096('0x39'),_0x7096('0x23'),_0x519fac,'createdAt','updatedAt'],squel[_0x7096('0x3a')]()['field'](_0x7096('0x1e'),_0x7096('0x1e'))['field']('NOW()',_0x7096('0x38'))[_0x7096('0x3b')]('id',_0x7096('0x39'))[_0x7096('0x3b')](LISTID[_0x7096('0x3c')](),_0x7096('0x23'))[_0x7096('0x3b')](_0x321da6['id']['toString'](),_0x519fac)[_0x7096('0x3b')](_0x7096('0x3d'),'createdAt')['field'](_0x7096('0x3d'),'updatedAt')[_0x7096('0x3e')]('cm_contacts')[_0x7096('0x3f')](_0x7096('0x40'))[_0x7096('0x3f')](_0x7096('0x41'),LISTID['toString']())[_0x7096('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x7096('0x3f')](_0x7096('0x42'),squel[_0x7096('0x3a')]()[_0x7096('0x3b')]('phone')[_0x7096('0x3e')](_0x7096('0x36'))['where'](_0x519fac+'\x20=\x20?',_0x321da6['id'][_0x7096('0x3c')]())))[_0x7096('0x3c')]();return _0x1216eb;};var _0x40d4dd=function(_0x5a107b,_0x3d737a){var _0x59b973=squel[_0x7096('0x34')]()[_0x7096('0x35')](_0x7096('0x36'))[_0x7096('0x37')]([_0x7096('0x1e'),_0x7096('0x38'),_0x7096('0x39'),_0x7096('0x23'),_0x3d737a,_0x7096('0x43'),'updatedAt'],squel[_0x7096('0x3a')]()[_0x7096('0x3b')](_0x7096('0x1e'),_0x7096('0x1e'))[_0x7096('0x3b')](_0x7096('0x3d'),'scheduledAt')[_0x7096('0x3b')]('id','ContactId')[_0x7096('0x3b')](LISTID[_0x7096('0x3c')](),_0x7096('0x23'))['field'](_0x5a107b['id'][_0x7096('0x3c')](),_0x3d737a)[_0x7096('0x3b')](_0x7096('0x3d'),_0x7096('0x43'))[_0x7096('0x3b')](_0x7096('0x3d'),'updatedAt')['from'](_0x7096('0x44'))[_0x7096('0x3f')]('deletedAt\x20IS\x20NULL')[_0x7096('0x3f')](_0x7096('0x41'),LISTID[_0x7096('0x3c')]())[_0x7096('0x3f')](_0x7096('0x45'),squel[_0x7096('0x46')](hopperContacts))[_0x7096('0x3f')](_0x7096('0x47'))[_0x7096('0x3f')](_0x7096('0x42'),squel[_0x7096('0x3a')]()[_0x7096('0x3b')](_0x7096('0x48'))[_0x7096('0x3e')](_0x7096('0x49'))['where'](_0x3d737a+'\x20=\x20?',_0x5a107b['id'][_0x7096('0x3c')]()))[_0x7096('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7096('0x3a')]()[_0x7096('0x3b')]('phone')[_0x7096('0x3e')](_0x7096('0x36'))[_0x7096('0x3f')](_0x3d737a+'\x20=\x20?',_0x5a107b['id']['toString']())))[_0x7096('0x3c')]();return _0x59b973;};function _0x3c843d(_0x288341,_0x34edfc){var _0x4a7277=squel['insert']()['into'](_0x7096('0x36'))[_0x7096('0x37')]([_0x7096('0x1e'),_0x7096('0x38'),'ContactId',_0x7096('0x23'),_0x34edfc,_0x7096('0x43'),_0x7096('0x4a')],squel['select']()[_0x7096('0x3b')](_0x7096('0x1e'),'phone')[_0x7096('0x3b')](_0x7096('0x3d'),_0x7096('0x38'))['field']('id',_0x7096('0x39'))[_0x7096('0x3b')](LISTID['toString'](),_0x7096('0x23'))[_0x7096('0x3b')](_0x288341['id'][_0x7096('0x3c')](),_0x34edfc)[_0x7096('0x3b')](_0x7096('0x3d'),_0x7096('0x43'))[_0x7096('0x3b')](_0x7096('0x3d'),'updatedAt')[_0x7096('0x3e')]('cm_contacts')['where'](_0x7096('0x40'))[_0x7096('0x3f')](_0x7096('0x41'),LISTID['toString']())[_0x7096('0x3f')](_0x7096('0x45'),squel['str'](hopperContacts))['where'](_0x7096('0x47')))[_0x7096('0x3c')]();return _0x4a7277;}function _0xfe6aef(_0x2e0692,_0x26a6f1){var _0x1bcc33=squel['insert']()[_0x7096('0x35')](_0x7096('0x4b'))[_0x7096('0x37')]([_0x7096('0x1e'),'ContactId',_0x7096('0x23'),_0x26a6f1,_0x7096('0x43'),_0x7096('0x4a')],squel[_0x7096('0x3a')]()[_0x7096('0x3b')](_0x7096('0x1e'),'phone')[_0x7096('0x3b')]('id','ContactId')[_0x7096('0x3b')](LISTID[_0x7096('0x3c')](),_0x7096('0x23'))[_0x7096('0x3b')](_0x2e0692['id'][_0x7096('0x3c')](),_0x26a6f1)[_0x7096('0x3b')](_0x7096('0x3d'),_0x7096('0x43'))['field'](_0x7096('0x3d'),_0x7096('0x4a'))[_0x7096('0x3e')]('cm_contacts')[_0x7096('0x3f')](_0x7096('0x40'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x7096('0x3f')]('id\x20IN\x20?',squel[_0x7096('0x46')](hopperContacts))['where'](_0x7096('0x47')))[_0x7096('0x3c')]();return _0x1bcc33;}return db[_0x7096('0x4c')][_0x7096('0x4d')]({'where':{'type':_0x7096('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7096('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x7096('0x2a')](function(_0x389f93){var _0x4e497d=[];if(_0x389f93){var _0x54db88;for(var _0x8d3bdc=0x0,_0x20005b;_0x8d3bdc<_0x389f93[_0x7096('0x24')];_0x8d3bdc+=0x1){_0x20005b=_0x389f93[_0x8d3bdc]['get']({'plain':!![]});switch(_0x20005b['dialCheckDuplicateType']){case'always':_0x4e497d[_0x7096('0x2b')](db[_0x7096('0x50')][_0x7096('0x51')](_0x40d4dd(_0x20005b,_0x7096('0x52')))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));break;case _0x7096('0x53'):_0x4e497d[_0x7096('0x2b')](db[_0x7096('0x50')][_0x7096('0x51')](_0xe701e7(_0x20005b,_0x7096('0x52')))['then'](function(){})[_0x7096('0x2d')](_0x5d0fd7()));break;default:_0x4e497d[_0x7096('0x2b')](db['sequelize']['query'](_0x3c843d(_0x20005b,_0x7096('0x52')))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));}}}return _0x4e497d;})['all']()[_0x7096('0x2a')](function(){return db[_0x7096('0x4c')][_0x7096('0x4d')]({'where':{'type':_0x7096('0x4e')},'attributes':['id'],'include':[{'model':db[_0x7096('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x233203){var _0x460752=[];if(_0x233203){var _0x166d4b;for(var _0x67b1a6=0x0,_0x2a80bd;_0x67b1a6<_0x233203['length'];_0x67b1a6+=0x1){_0x2a80bd=_0x233203[_0x67b1a6][_0x7096('0x54')]({'plain':!![]});_0x460752['push'](db[_0x7096('0x50')][_0x7096('0x51')](_0xfe6aef(_0x2a80bd,_0x7096('0x52')))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));}}return _0x460752;})[_0x7096('0x55')]();})[_0x7096('0x2a')](function(){return db[_0x7096('0x56')][_0x7096('0x4d')]({'attributes':['id',_0x7096('0x57')],'include':[{'model':db[_0x7096('0x4f')],'as':_0x7096('0x58'),'where':{'id':LISTID}}]})[_0x7096('0x2a')](function(_0x14cf69){var _0x1c4346=[];if(_0x14cf69){for(var _0x39125d=0x0,_0x240b5d;_0x39125d<_0x14cf69[_0x7096('0x24')];_0x39125d+=0x1){_0x240b5d=_0x14cf69[_0x39125d]['get']({'plain':!![]});switch(_0x240b5d[_0x7096('0x57')]){case _0x7096('0x59'):_0x1c4346['push'](db[_0x7096('0x50')][_0x7096('0x51')](_0x40d4dd(_0x240b5d,_0x7096('0x5a')))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));break;case _0x7096('0x53'):_0x1c4346[_0x7096('0x2b')](db[_0x7096('0x50')][_0x7096('0x51')](_0xe701e7(_0x240b5d,_0x7096('0x5a')))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));break;default:_0x1c4346[_0x7096('0x2b')](db[_0x7096('0x50')][_0x7096('0x51')](_0x3c843d(_0x240b5d,'CampaignId'))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));}}}return _0x1c4346;})['all']();})[_0x7096('0x2a')](function(){return db['Campaign'][_0x7096('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7096('0x5b'),'where':{'id':LISTID}}]})[_0x7096('0x2a')](function(_0xc949e0){var _0x5c7219=[];if(_0xc949e0){for(var _0x9ea591=0x0,_0x49a84d;_0x9ea591<_0xc949e0['length'];_0x9ea591+=0x1){_0x49a84d=_0xc949e0[_0x9ea591][_0x7096('0x54')]({'plain':!![]});_0x5c7219['push'](db[_0x7096('0x50')]['query'](_0xfe6aef(_0x49a84d,'CampaignId'))[_0x7096('0x2a')](function(){})[_0x7096('0x2d')](_0x5d0fd7()));}}return _0x5c7219;})['all']();})[_0x7096('0x2d')](function(_0x485527){logger[_0x7096('0x12')](_0x7096('0x5c'),_0x7096('0x5d'),_0x485527[_0x7096('0x2f')]);});}var processPromises=function(_0x27e525){return BPromise['all'](promises)[_0x7096('0x2a')](function(_0x26aaf3){})['catch'](function(_0x3190bb){logger[_0x7096('0x12')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x3190bb));})[_0x7096('0x5e')](function(){socket[_0x7096('0x5f')](_0x7096('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x27e525){return _0x27e525['resume']();}});};var endCsv=function(){return BPromise[_0x7096('0x61')]()[_0x7096('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x7096('0x2a')](function(){socket[_0x7096('0x5f')](_0x7096('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7096('0x62')](FILEPATH);}catch(_0x501d98){logger[_0x7096('0x12')](_0x7096('0x63'),JSON[_0x7096('0x30')](_0x501d98));}finally{process[_0x7096('0x64')](0x0);}});};process['on'](_0x7096('0x65'),function(){logger[_0x7096('0x66')](_0x7096('0x67'));endCsv();});function main(){return BPromise[_0x7096('0x61')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7096('0x10')](',');return db[_0x7096('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7096('0x2a')](function(_0x2a5356){var _0x29d5da=fs[_0x7096('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7096('0x69')](_0x29d5da,{'header':!![],'skipEmptyLines':!![],'step':function(_0x50c52f,_0x53bf8e){total+=0x1;var _0x474377=total;promises[_0x7096('0x2b')](checkRow(_0x50c52f,_0x2a5356,_0x474377)[_0x7096('0x2a')](function(){success+=0x1;})[_0x7096('0x2d')](function(_0x3a9bdc){if(_0x3a9bdc['error']){errors+=0x1;delete _0x3a9bdc[_0x7096('0x12')];}else if(_0x3a9bdc[_0x7096('0x26')]){duplicates+=0x1;delete _0x3a9bdc[_0x7096('0x26')];}rows['push'](_0x3a9bdc);}));if(total%0xc8===0x0){_0x53bf8e[_0x7096('0x6a')]();return processPromises(_0x53bf8e);}},'complete':function(){return processPromises()[_0x7096('0x2a')](function(){logger[_0x7096('0x66')](_0x7096('0x6b'));endCsv();});},'error':function(_0x8fa08d,_0x4a62dc){logger[_0x7096('0x66')](_0x7096('0x6c'),JSON[_0x7096('0x30')](_0x8fa08d));endCsv();}});})[_0x7096('0x2d')](function(_0x4d8457){logger[_0x7096('0x12')](_0x7096('0x6d'),JSON[_0x7096('0x30')](_0x4d8457));});}main(); \ No newline at end of file +var _0xbb96=['argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','join','hasOwnProperty','data','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!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','outbound','BlackLists','Campaign','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register'];(function(_0xa1c82e,_0x407696){var _0x1d3cb4=function(_0x55fffc){while(--_0x55fffc){_0xa1c82e['push'](_0xa1c82e['shift']());}};_0x1d3cb4(++_0x407696);}(_0xbb96,0xd2));var _0x6bb9=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xbb96[_0x2134b7];return _0x6c5914;};'use strict';var BPromise=require('bluebird');var util=require(_0x6bb9('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x6bb9('0x1'));var Papa=require(_0x6bb9('0x2'));var Redis=require(_0x6bb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x6bb9('0x4'));var logger=require(_0x6bb9('0x5'))(_0x6bb9('0x6'));config[_0x6bb9('0x7')]=_[_0x6bb9('0x8')](config[_0x6bb9('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6bb9('0x9'))(new Redis(config[_0x6bb9('0x7')]));require(_0x6bb9('0xa'))[_0x6bb9('0xb')](socket);try{if(!process[_0x6bb9('0xc')][0x2]||process[_0x6bb9('0xc')][0x2]==='undefined'||process[_0x6bb9('0xc')][0x2]===_0x6bb9('0xd')){throw new Error(_0x6bb9('0xe'));}var FILEPATH=process[_0x6bb9('0xc')][0x2];if(!process['argv'][0x3]||process[_0x6bb9('0xc')][0x3]==='undefined'||process[_0x6bb9('0xc')][0x3]===_0x6bb9('0xd')||!process[_0x6bb9('0xc')][0x4]||process[_0x6bb9('0xc')][0x4]===_0x6bb9('0xf')||process[_0x6bb9('0xc')][0x4]===_0x6bb9('0xd')){throw new Error(_0x6bb9('0x10'));}var FIELDS=_[_0x6bb9('0x11')](process[_0x6bb9('0xc')][0x3][_0x6bb9('0x12')](','),process['argv'][0x4][_0x6bb9('0x12')](','));if(!process['argv'][0x5]||process[_0x6bb9('0xc')][0x5]===_0x6bb9('0xf')||process['argv'][0x5]===_0x6bb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6bb9('0xc')][0x5];var COMPANYID=process[_0x6bb9('0xc')][0x6]&&process['argv'][0x6]!==_0x6bb9('0xf')&&process[_0x6bb9('0xc')][0x6]!==_0x6bb9('0xd')?process[_0x6bb9('0xc')][0x6]:null;var DUPLICATES=process[_0x6bb9('0xc')][0x7]&&process[_0x6bb9('0xc')][0x7]!=='undefined'&&process[_0x6bb9('0xc')][0x7]!==_0x6bb9('0xd')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x6bb9('0xc')][0x8]==='undefined'||process[_0x6bb9('0xc')][0x8]===_0x6bb9('0xd')){throw new Error(_0x6bb9('0x13'));}var SOCKET_TIMESTAMP=process[_0x6bb9('0xc')][0x8];}catch(_0x387048){logger[_0x6bb9('0x14')](_0x387048);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(_0x546ceb,_0x122773,_0x390aab,_0x6f54f){var _0x4400b4={'message':_0x122773};_0x4400b4[_0x546ceb]=!![];if(_0x390aab){_0x4400b4[_0x6bb9('0x15')]=_0x390aab;}if(_0x6f54f){_0x4400b4[_0x6bb9('0x16')]=_0x6f54f;}return _0x4400b4;}function isEmail(_0x4c9f76){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'](_0x4c9f76);}function checkRow(_0x2b43be,_0x20d203,_0x20b6b2){return new BPromise(function(_0x33867b,_0x149a5b){if(_[_0x6bb9('0x17')](_0x2b43be)){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x20b6b2));}if(_0x2b43be[_0x6bb9('0x18')]&&_0x2b43be[_0x6bb9('0x18')][_0x6bb9('0x19')]){var _0x1eee59=_[_0x6bb9('0x1a')](_0x2b43be[_0x6bb9('0x18')],_0x6bb9('0x1b'))[_0x6bb9('0x1c')](';');return _0x149a5b(handleCheckRowError('error',_0x1eee59,null,_0x20b6b2));}var _0x390614={};for(var _0x56f84e in FIELDS){if(FIELDS[_0x6bb9('0x1d')](_0x56f84e)&&FIELDS[_0x56f84e]){_0x390614[_0x56f84e]=_0x2b43be[_0x6bb9('0x1e')][0x0][FIELDS[_0x56f84e]]||_0x2b43be[_0x6bb9('0x1e')][0x0]['\ufeff'+FIELDS[_0x56f84e]];}}if(!_0x390614['firstName']){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),_0x6bb9('0x1f'),null,_0x20b6b2));}if(!_0x390614[_0x6bb9('0x20')]){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),_0x6bb9('0x21'),null,_0x20b6b2));}if(_0x390614[_0x6bb9('0x22')]){var _0x5f52fa=moment(_0x390614[_0x6bb9('0x22')],_0x6bb9('0x23'));if(!_0x5f52fa[_0x6bb9('0x24')]()){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),_0x6bb9('0x25'),null,_0x20b6b2));}}if(_0x390614['email']){if(!isEmail(_0x390614[_0x6bb9('0x26')])){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),_0x6bb9('0x27'),null,_0x20b6b2));}}_0x390614['ListId']=LISTID;_0x390614[_0x6bb9('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x20d203){var _0x2bde9f={};for(var _0x4f89f2=0x0,_0x1612bd=DUPLICATES[_0x6bb9('0x19')];_0x4f89f2<_0x1612bd;_0x4f89f2+=0x1){_0x2bde9f[DUPLICATES[_0x4f89f2]]=_0x390614[DUPLICATES[_0x4f89f2]];}var _0x43e1c1=_[_0x6bb9('0x29')](_0x20d203,_0x2bde9f);if(_0x43e1c1){return _0x149a5b(handleCheckRowError(_0x6bb9('0x2a'),_0x6bb9('0x2b'),_0x43e1c1,_0x20b6b2));}}return db[_0x6bb9('0x2c')][_0x6bb9('0x2d')](_0x390614,{'raw':!![],'hooks':![],'fields':_['keys'](_0x390614)})[_0x6bb9('0x2e')](function(_0x4ceb0b){if(DUPLICATES&&DUPLICATES[_0x6bb9('0x19')]&&_0x20d203){_0x20d203[_0x6bb9('0x2f')](_[_0x6bb9('0x30')](_0x390614,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4ceb0b['id'];return _0x33867b();})[_0x6bb9('0x31')](function(_0x603ed9){return _0x149a5b(handleCheckRowError(_0x6bb9('0x14'),_0x6bb9('0x32')+(_0x603ed9[_0x6bb9('0x1b')]||JSON[_0x6bb9('0x33')](_0x603ed9)),null,_0x20b6b2));});});}function checkHopper(){function _0x12556a(){return function(_0x23eab8){logger[_0x6bb9('0x14')](_0x6bb9('0x34'),_0x6bb9('0x35'),util[_0x6bb9('0x36')](_0x23eab8,{'showHidden':![],'depth':null}));};}var _0x4605b0=function(_0x4eb67d,_0x71d023){var _0x188e78=squel[_0x6bb9('0x37')]()[_0x6bb9('0x38')](_0x6bb9('0x39'))[_0x6bb9('0x3a')]([_0x6bb9('0x20'),_0x6bb9('0x3b'),_0x6bb9('0x3c'),_0x6bb9('0x3d'),_0x71d023,_0x6bb9('0x3e'),_0x6bb9('0x3f')],squel[_0x6bb9('0x40')]()[_0x6bb9('0x41')](_0x6bb9('0x20'),_0x6bb9('0x20'))['field']('NOW()',_0x6bb9('0x3b'))[_0x6bb9('0x41')]('id',_0x6bb9('0x3c'))[_0x6bb9('0x41')](LISTID[_0x6bb9('0x42')](),_0x6bb9('0x3d'))['field'](_0x4eb67d['id'][_0x6bb9('0x42')](),_0x71d023)[_0x6bb9('0x41')](_0x6bb9('0x43'),_0x6bb9('0x3e'))['field'](_0x6bb9('0x43'),_0x6bb9('0x3f'))[_0x6bb9('0x44')]('cm_contacts')[_0x6bb9('0x45')](_0x6bb9('0x46'))['where'](_0x6bb9('0x47'),LISTID['toString']())[_0x6bb9('0x45')](_0x6bb9('0x48'))['where'](_0x6bb9('0x49'),squel[_0x6bb9('0x40')]()['field']('phone')['from'](_0x6bb9('0x39'))['where'](_0x71d023+_0x6bb9('0x4a'),_0x4eb67d['id'][_0x6bb9('0x42')]())))[_0x6bb9('0x42')]();return _0x188e78;};var _0x2290c5=function(_0x4415ac,_0xbfdc21){var _0x1567e6=squel[_0x6bb9('0x37')]()['into'](_0x6bb9('0x39'))[_0x6bb9('0x3a')]([_0x6bb9('0x20'),_0x6bb9('0x3b'),_0x6bb9('0x3c'),_0x6bb9('0x3d'),_0xbfdc21,'createdAt','updatedAt'],squel[_0x6bb9('0x40')]()[_0x6bb9('0x41')](_0x6bb9('0x20'),'phone')[_0x6bb9('0x41')](_0x6bb9('0x43'),_0x6bb9('0x3b'))[_0x6bb9('0x41')]('id',_0x6bb9('0x3c'))[_0x6bb9('0x41')](LISTID[_0x6bb9('0x42')](),_0x6bb9('0x3d'))[_0x6bb9('0x41')](_0x4415ac['id'][_0x6bb9('0x42')](),_0xbfdc21)['field'](_0x6bb9('0x43'),_0x6bb9('0x3e'))[_0x6bb9('0x41')]('NOW()','updatedAt')['from'](_0x6bb9('0x4b'))[_0x6bb9('0x45')](_0x6bb9('0x46'))[_0x6bb9('0x45')]('ListId\x20=\x20?',LISTID[_0x6bb9('0x42')]())[_0x6bb9('0x45')](_0x6bb9('0x4c'),squel[_0x6bb9('0x4d')](hopperContacts))[_0x6bb9('0x45')](_0x6bb9('0x48'))[_0x6bb9('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6bb9('0x40')]()[_0x6bb9('0x41')](_0x6bb9('0x4e'))['from'](_0x6bb9('0x4f'))[_0x6bb9('0x45')](_0xbfdc21+_0x6bb9('0x4a'),_0x4415ac['id']['toString']()))['where'](_0x6bb9('0x49'),squel[_0x6bb9('0x40')]()[_0x6bb9('0x41')](_0x6bb9('0x20'))[_0x6bb9('0x44')](_0x6bb9('0x39'))[_0x6bb9('0x45')](_0xbfdc21+_0x6bb9('0x4a'),_0x4415ac['id']['toString']())))[_0x6bb9('0x42')]();return _0x1567e6;};function _0x1920a7(_0x13a74b,_0x4b9e67){var _0xe63a36=squel[_0x6bb9('0x37')]()[_0x6bb9('0x38')](_0x6bb9('0x39'))[_0x6bb9('0x3a')](['phone',_0x6bb9('0x3b'),_0x6bb9('0x3c'),_0x6bb9('0x3d'),_0x4b9e67,'createdAt',_0x6bb9('0x3f')],squel[_0x6bb9('0x40')]()['field'](_0x6bb9('0x20'),'phone')['field']('NOW()',_0x6bb9('0x3b'))['field']('id',_0x6bb9('0x3c'))[_0x6bb9('0x41')](LISTID['toString'](),_0x6bb9('0x3d'))[_0x6bb9('0x41')](_0x13a74b['id'][_0x6bb9('0x42')](),_0x4b9e67)[_0x6bb9('0x41')]('NOW()','createdAt')['field'](_0x6bb9('0x43'),_0x6bb9('0x3f'))[_0x6bb9('0x44')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x6bb9('0x47'),LISTID['toString']())['where'](_0x6bb9('0x4c'),squel[_0x6bb9('0x4d')](hopperContacts))[_0x6bb9('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x6bb9('0x42')]();return _0xe63a36;}function _0x149e46(_0x4807ff,_0x5e0e64){var _0x49639b=squel['insert']()[_0x6bb9('0x38')](_0x6bb9('0x50'))[_0x6bb9('0x3a')]([_0x6bb9('0x20'),_0x6bb9('0x3c'),_0x6bb9('0x3d'),_0x5e0e64,_0x6bb9('0x3e'),_0x6bb9('0x3f')],squel['select']()[_0x6bb9('0x41')](_0x6bb9('0x20'),'phone')[_0x6bb9('0x41')]('id',_0x6bb9('0x3c'))[_0x6bb9('0x41')](LISTID[_0x6bb9('0x42')](),_0x6bb9('0x3d'))[_0x6bb9('0x41')](_0x4807ff['id'][_0x6bb9('0x42')](),_0x5e0e64)[_0x6bb9('0x41')](_0x6bb9('0x43'),_0x6bb9('0x3e'))[_0x6bb9('0x41')](_0x6bb9('0x43'),_0x6bb9('0x3f'))['from'](_0x6bb9('0x4b'))[_0x6bb9('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x6bb9('0x47'),LISTID[_0x6bb9('0x42')]())['where']('id\x20IN\x20?',squel[_0x6bb9('0x4d')](hopperContacts))[_0x6bb9('0x45')](_0x6bb9('0x48')))['toString']();return _0x49639b;}return db[_0x6bb9('0x51')][_0x6bb9('0x52')]({'where':{'type':'outbound'},'attributes':['id',_0x6bb9('0x53')],'include':[{'model':db[_0x6bb9('0x54')],'as':_0x6bb9('0x55'),'where':{'id':LISTID}}]})['then'](function(_0xda6aed){var _0x190db0=[];if(_0xda6aed){var _0x22db0d;for(var _0x4f254c=0x0,_0x3ab971;_0x4f254c<_0xda6aed[_0x6bb9('0x19')];_0x4f254c+=0x1){_0x3ab971=_0xda6aed[_0x4f254c][_0x6bb9('0x56')]({'plain':!![]});switch(_0x3ab971[_0x6bb9('0x53')]){case _0x6bb9('0x57'):_0x190db0[_0x6bb9('0x2f')](db[_0x6bb9('0x58')]['query'](_0x2290c5(_0x3ab971,_0x6bb9('0x59')))[_0x6bb9('0x2e')](function(){})[_0x6bb9('0x31')](_0x12556a()));break;case _0x6bb9('0x5a'):_0x190db0['push'](db[_0x6bb9('0x58')][_0x6bb9('0x5b')](_0x4605b0(_0x3ab971,_0x6bb9('0x59')))[_0x6bb9('0x2e')](function(){})[_0x6bb9('0x31')](_0x12556a()));break;default:_0x190db0[_0x6bb9('0x2f')](db[_0x6bb9('0x58')]['query'](_0x1920a7(_0x3ab971,_0x6bb9('0x59')))[_0x6bb9('0x2e')](function(){})[_0x6bb9('0x31')](_0x12556a()));}}}return _0x190db0;})[_0x6bb9('0x5c')]()[_0x6bb9('0x2e')](function(){return db[_0x6bb9('0x51')][_0x6bb9('0x52')]({'where':{'type':_0x6bb9('0x5d')},'attributes':['id'],'include':[{'model':db[_0x6bb9('0x54')],'as':_0x6bb9('0x5e'),'where':{'id':LISTID}}]})[_0x6bb9('0x2e')](function(_0x23f980){var _0x2c42be=[];if(_0x23f980){var _0x38a73c;for(var _0x5c4556=0x0,_0x18ec52;_0x5c4556<_0x23f980[_0x6bb9('0x19')];_0x5c4556+=0x1){_0x18ec52=_0x23f980[_0x5c4556][_0x6bb9('0x56')]({'plain':!![]});_0x2c42be[_0x6bb9('0x2f')](db['sequelize']['query'](_0x149e46(_0x18ec52,_0x6bb9('0x59')))['then'](function(){})[_0x6bb9('0x31')](_0x12556a()));}}return _0x2c42be;})[_0x6bb9('0x5c')]();})['then'](function(){return db[_0x6bb9('0x5f')][_0x6bb9('0x52')]({'attributes':['id',_0x6bb9('0x53')],'include':[{'model':db[_0x6bb9('0x54')],'as':_0x6bb9('0x55'),'where':{'id':LISTID}}]})[_0x6bb9('0x2e')](function(_0x3dd724){var _0x313440=[];if(_0x3dd724){for(var _0x43e9a8=0x0,_0xf67c73;_0x43e9a8<_0x3dd724['length'];_0x43e9a8+=0x1){_0xf67c73=_0x3dd724[_0x43e9a8][_0x6bb9('0x56')]({'plain':!![]});switch(_0xf67c73[_0x6bb9('0x53')]){case _0x6bb9('0x57'):_0x313440[_0x6bb9('0x2f')](db[_0x6bb9('0x58')][_0x6bb9('0x5b')](_0x2290c5(_0xf67c73,_0x6bb9('0x60')))[_0x6bb9('0x2e')](function(){})[_0x6bb9('0x31')](_0x12556a()));break;case _0x6bb9('0x5a'):_0x313440[_0x6bb9('0x2f')](db[_0x6bb9('0x58')]['query'](_0x4605b0(_0xf67c73,_0x6bb9('0x60')))[_0x6bb9('0x2e')](function(){})['catch'](_0x12556a()));break;default:_0x313440[_0x6bb9('0x2f')](db[_0x6bb9('0x58')][_0x6bb9('0x5b')](_0x1920a7(_0xf67c73,_0x6bb9('0x60')))[_0x6bb9('0x2e')](function(){})[_0x6bb9('0x31')](_0x12556a()));}}}return _0x313440;})['all']();})[_0x6bb9('0x2e')](function(){return db['Campaign'][_0x6bb9('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6bb9('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6bb9('0x2e')](function(_0x5b1dbb){var _0x41b7a1=[];if(_0x5b1dbb){for(var _0x459c60=0x0,_0x586942;_0x459c60<_0x5b1dbb[_0x6bb9('0x19')];_0x459c60+=0x1){_0x586942=_0x5b1dbb[_0x459c60]['get']({'plain':!![]});_0x41b7a1[_0x6bb9('0x2f')](db[_0x6bb9('0x58')][_0x6bb9('0x5b')](_0x149e46(_0x586942,'CampaignId'))['then'](function(){})[_0x6bb9('0x31')](_0x12556a()));}}return _0x41b7a1;})[_0x6bb9('0x5c')]();})[_0x6bb9('0x31')](function(_0x1b3f9e){logger[_0x6bb9('0x14')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x1b3f9e['message']);});}var processPromises=function(_0x1619c4){return BPromise[_0x6bb9('0x5c')](promises)['then'](function(_0x5992bc){})[_0x6bb9('0x31')](function(_0x6c8cf4){logger['error'](_0x6bb9('0x61'),JSON[_0x6bb9('0x33')](_0x6c8cf4));})[_0x6bb9('0x62')](function(){socket[_0x6bb9('0x63')](_0x6bb9('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1619c4){return _0x1619c4['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x6bb9('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x6bb9('0x2e')](function(){socket[_0x6bb9('0x63')](_0x6bb9('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6bb9('0x65')](FILEPATH);}catch(_0x3611cf){logger[_0x6bb9('0x14')](_0x6bb9('0x66'),JSON[_0x6bb9('0x33')](_0x3611cf));}finally{process[_0x6bb9('0x67')](0x0);}});};process['on']('SIGINT',function(){logger[_0x6bb9('0x68')](_0x6bb9('0x69'));endCsv();});function main(){return BPromise[_0x6bb9('0x6a')]()[_0x6bb9('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6bb9('0x12')](',');return db[_0x6bb9('0x2c')][_0x6bb9('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6bb9('0x2e')](function(_0xb83966){var _0x5aa23a=fs[_0x6bb9('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6bb9('0x6c')](_0x5aa23a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x543ab8,_0x14efb9){total+=0x1;var _0x3cd00d=total;promises[_0x6bb9('0x2f')](checkRow(_0x543ab8,_0xb83966,_0x3cd00d)[_0x6bb9('0x2e')](function(){success+=0x1;})[_0x6bb9('0x31')](function(_0x374a55){if(_0x374a55[_0x6bb9('0x14')]){errors+=0x1;delete _0x374a55[_0x6bb9('0x14')];}else if(_0x374a55[_0x6bb9('0x2a')]){duplicates+=0x1;delete _0x374a55['duplicate'];}rows[_0x6bb9('0x2f')](_0x374a55);}));if(total%0xc8===0x0){_0x14efb9[_0x6bb9('0x6d')]();return processPromises(_0x14efb9);}},'complete':function(){return processPromises()[_0x6bb9('0x2e')](function(){logger[_0x6bb9('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4bddd7,_0x47b458){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x4bddd7));endCsv();}});})[_0x6bb9('0x31')](function(_0x1c15d2){logger[_0x6bb9('0x14')](_0x6bb9('0x6e'),JSON[_0x6bb9('0x33')](_0x1c15d2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 676cfa4..88a9c6f 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 _0xc7c4=['argv','existsSync','file\x20doesn\x27t\x20exists','parse','map','No\x20agent\x20available','SIGINT','uncaughtException','path','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','field','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','phone','ContactId','ListId','createdAt','UserId','select','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','fromQuery','updatedAt','.id\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','priority','recallme','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','info','message','exit','errors','code','sequelize','push','catch','error','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists.CmListId=','spread','length','all','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','query','then','dialTimezone','isNil','utcOffset','set','offset','main','start','binding','server/files/tmp','includes','header',',utcOffset','writeFileSync','createReadStream','data','rows','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','affectedRows','contact:import:','unlink','complete','arguments\x20\x20\x20'];(function(_0x3bcae3,_0x35aee3){var _0x2a7843=function(_0x3b0c44){while(--_0x3b0c44){_0x3bcae3['push'](_0x3bcae3['shift']());}};_0x2a7843(++_0x35aee3);}(_0xc7c4,0x13a));var _0x4c7c=function(_0x14feae,_0x49d383){_0x14feae=_0x14feae-0x0;var _0x53ec0b=_0xc7c4[_0x14feae];return _0x53ec0b;};'use strict';var fs=require('fs');var path=require(_0x4c7c('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x4c7c('0x1'));var moment=require(_0x4c7c('0x2'));var squel=require(_0x4c7c('0x3'));var Redis=require(_0x4c7c('0x4'));var db=require(_0x4c7c('0x5'))['db'];var config=require(_0x4c7c('0x6'));var shared=require(_0x4c7c('0x7'));var logger=require(_0x4c7c('0x8'))(_0x4c7c('0x9'));config[_0x4c7c('0xa')]=_[_0x4c7c('0xb')](config[_0x4c7c('0xa')],{'host':_0x4c7c('0xc'),'port':0x18eb});var socket=require(_0x4c7c('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4c7c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x302018){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))*$/[_0x4c7c('0xf')](_0x302018);}function selectNotIn(_0xf70721,_0x300399,_0x2d8bcd,_0x5b485f,_0x123aaf){return squel['select']()[_0x4c7c('0x10')]('phone')[_0x4c7c('0x11')](_0x5b485f)['join'](_0x300399,null,_0x300399+'.id\x20=\x20'+_0x5b485f+'.'+_0x2d8bcd)[_0x4c7c('0x12')](_0x5b485f+'.'+_0x2d8bcd+_0x4c7c('0x13')+_0xf70721+'.'+_0x2d8bcd)[_0x4c7c('0x12')](_0x300399+_0x4c7c('0x14')+_0x123aaf['join']()+')');}function insertCmHopper(_0x244370,_0x3c8462,_0x47a801,_0x488a9c,_0x9a110b){var _0x29d4e3=['cm_contacts.phone',_0x4c7c('0x15'),'cm_contacts.id','cm_contacts.ListId',_0x3c8462+'.'+_0x488a9c,'cm_contacts.createdAt',_0x4c7c('0x16'),_0x4c7c('0x17'),_0x4c7c('0x18'),'\x22'+_0x9a110b+'\x22'];return squel[_0x4c7c('0x19')]()[_0x4c7c('0x1a')]('cm_hopper')['fromQuery']([_0x4c7c('0x1b'),'scheduledat',_0x4c7c('0x1c'),_0x4c7c('0x1d'),_0x488a9c,_0x4c7c('0x1e'),'updatedAt','priority',_0x4c7c('0x1f'),'recallme'],squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](_0x29d4e3)[_0x4c7c('0x11')](_0x3c8462)[_0x4c7c('0x22')](_0x4c7c('0x23'),null,_0x4c7c('0x24')+_0x3c8462+_0x4c7c('0x25'))['join'](_0x47a801,null,_0x47a801+'.id\x20=\x20'+_0x3c8462+'.'+_0x488a9c)[_0x4c7c('0x12')](_0x3c8462+'.CmListId\x20=\x20?',_0x244370)[_0x4c7c('0x12')](_0x4c7c('0x26'),NOW)[_0x4c7c('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3c8462,_0x47a801,_0x488a9c,_0x4c7c('0x27'),[_0x4c7c('0x28'),_0x4c7c('0x29')]))['where'](_0x4c7c('0x2a'),selectNotIn(_0x3c8462,_0x47a801,_0x488a9c,_0x4c7c('0x27'),[_0x4c7c('0x28')])))[_0x4c7c('0x2b')]();}function insertCmHopperBlack(_0x4a58f1,_0x383c85,_0x5de3d2,_0x46e2e2){var _0x2a0727=[_0x4c7c('0x2c'),_0x4c7c('0x2d'),_0x4c7c('0x2e'),_0x383c85+'.'+_0x46e2e2,_0x4c7c('0x2f'),_0x4c7c('0x16')];return squel['insert']()[_0x4c7c('0x1a')](_0x4c7c('0x30'))[_0x4c7c('0x31')](['phone',_0x4c7c('0x1c'),'ListId',_0x46e2e2,_0x4c7c('0x1e'),_0x4c7c('0x32')],squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](_0x2a0727)[_0x4c7c('0x11')](_0x383c85)[_0x4c7c('0x22')](_0x4c7c('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x383c85+_0x4c7c('0x25'))['join'](_0x5de3d2,null,_0x5de3d2+_0x4c7c('0x33')+_0x383c85+'.'+_0x46e2e2)[_0x4c7c('0x12')](_0x383c85+_0x4c7c('0x34'),_0x4a58f1)[_0x4c7c('0x12')](_0x4c7c('0x26'),NOW)[_0x4c7c('0x12')](_0x4c7c('0x2a'),squel[_0x4c7c('0x20')]()[_0x4c7c('0x10')](_0x4c7c('0x1b'))[_0x4c7c('0x11')](_0x4c7c('0x30'))[_0x4c7c('0x12')](_0x4c7c('0x35'),_0x4a58f1)[_0x4c7c('0x12')](_0x46e2e2+_0x4c7c('0x36'),_0x383c85+'.'+_0x46e2e2)))[_0x4c7c('0x2b')]();}function insertTzCmHopper(_0x5747bc,_0x3ffc25,_0x43f211,_0x8e2fa1,_0x2cd31d,_0x412886){var _0x5c2032=[_0x4c7c('0x2c'),_0x4c7c('0x37')+_0x412886+_0x4c7c('0x38'),_0x4c7c('0x2d'),_0x4c7c('0x2e'),_0x3ffc25+'.'+_0x8e2fa1,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x4c7c('0x17'),'cm_contacts.UserId','\x22'+_0x2cd31d+'\x22'];var _0x4bc482=squel[_0x4c7c('0x19')]()[_0x4c7c('0x1a')]('cm_hopper')[_0x4c7c('0x31')]([_0x4c7c('0x1b'),'scheduledat',_0x4c7c('0x1c'),'ListId',_0x8e2fa1,_0x4c7c('0x1e'),_0x4c7c('0x32'),_0x4c7c('0x39'),'UserId',_0x4c7c('0x3a')],squel['select']()['fields'](_0x5c2032)[_0x4c7c('0x11')](_0x3ffc25)[_0x4c7c('0x22')](_0x4c7c('0x23'),null,_0x4c7c('0x24')+_0x3ffc25+_0x4c7c('0x25'))[_0x4c7c('0x22')](_0x43f211,null,_0x43f211+_0x4c7c('0x33')+_0x3ffc25+'.'+_0x8e2fa1)['join'](_0x412886,null,_0x412886+_0x4c7c('0x33')+_0x3ffc25+'.'+_0x8e2fa1)[_0x4c7c('0x12')](_0x3ffc25+_0x4c7c('0x34'),_0x5747bc)[_0x4c7c('0x12')](_0x4c7c('0x26'),NOW)[_0x4c7c('0x12')](_0x4c7c('0x2a'),selectNotIn(_0x3ffc25,_0x43f211,_0x8e2fa1,_0x4c7c('0x27'),[_0x4c7c('0x28'),_0x4c7c('0x29')]))[_0x4c7c('0x12')](_0x4c7c('0x2a'),selectNotIn(_0x3ffc25,_0x43f211,_0x8e2fa1,_0x4c7c('0x27'),['\x22always\x22'])))[_0x4c7c('0x2b')]();return _0x4bc482;}function insertTzCmHopperBlack(_0x15471c,_0x1f2ae4,_0x7e98fd,_0x2244c2){var _0x4a7600=['cm_contacts.phone',_0x4c7c('0x2d'),_0x4c7c('0x2e'),_0x1f2ae4+'.'+_0x2244c2,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x4c7c('0x19')]()['into'](_0x4c7c('0x30'))[_0x4c7c('0x31')]([_0x4c7c('0x1b'),'ContactId',_0x4c7c('0x1d'),_0x2244c2,'createdAt',_0x4c7c('0x32')],squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](_0x4a7600)[_0x4c7c('0x11')](_0x1f2ae4)[_0x4c7c('0x22')](_0x4c7c('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x1f2ae4+_0x4c7c('0x25'))[_0x4c7c('0x22')](_0x7e98fd,null,_0x7e98fd+_0x4c7c('0x33')+_0x1f2ae4+'.'+_0x2244c2)['where'](_0x1f2ae4+_0x4c7c('0x34'),_0x15471c)[_0x4c7c('0x12')](_0x4c7c('0x26'),NOW)[_0x4c7c('0x12')](_0x4c7c('0x2a'),squel[_0x4c7c('0x20')]()['field']('phone')['from'](_0x4c7c('0x30'))[_0x4c7c('0x12')](_0x4c7c('0x35'),_0x15471c)[_0x4c7c('0x12')](_0x2244c2+_0x4c7c('0x36'),_0x1f2ae4+'.'+_0x2244c2)))[_0x4c7c('0x2b')]();}function insertCmContact(_0x51c8b9,_0x459d66,_0x50bfba,_0x24aa5b){var _0x3982c6=_[_0x4c7c('0x3b')](_[_0x4c7c('0x3c')](_0x24aa5b),[_0x4c7c('0x1d'),'CompanyId',_0x4c7c('0x1e'),_0x4c7c('0x32')]);return squel[_0x4c7c('0x19')]()[_0x4c7c('0x1a')]('cm_contacts')[_0x4c7c('0x31')](_0x3982c6,squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](_0x3982c6)['from'](_0x459d66)[_0x4c7c('0x12')]('('+_0x50bfba[_0x4c7c('0x22')](',')+_0x4c7c('0x3d'),squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](_0x50bfba)[_0x4c7c('0x11')](_0x4c7c('0x23'))[_0x4c7c('0x12')](_0x4c7c('0x35'),_0x51c8b9)[_0x4c7c('0x12')](_0x4c7c('0x3e')))[_0x4c7c('0x12')]('id\x20IN\x20?',squel[_0x4c7c('0x20')]()[_0x4c7c('0x10')](_0x4c7c('0x3f'),_0x4c7c('0x40'))[_0x4c7c('0x11')](_0x459d66)['group'](_0x50bfba[_0x4c7c('0x22')](','))))[_0x4c7c('0x2b')]();}function handleStop(){logger[_0x4c7c('0x41')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x8f8869){logger['error'](_0x8f8869[_0x4c7c('0x42')]);process[_0x4c7c('0x43')](0x1);}function handleError(_0x502338,_0x13490a){stats[_0x4c7c('0x44')]['push']({'name':_0x13490a[_0x4c7c('0x45')],'message':_0x13490a[_0x4c7c('0x42')],'row':_0x502338});}function handleQuery(_0x2ce24d){logger[_0x4c7c('0x41')](_0x2ce24d);return db[_0x4c7c('0x46')]['query'](_0x2ce24d)['spread'](function(_0x4dcf26){results[_0x4c7c('0x47')](_0x4dcf26);})[_0x4c7c('0x48')](function(_0x895f2){logger[_0x4c7c('0x49')](_0x895f2[_0x4c7c('0x42')]);});}function updateTzCampaigns(_0x53d7c6){return new Promise(function(_0x29012f,_0x1a38bc){var _0x8ad5b3=squel[_0x4c7c('0x20')]()[_0x4c7c('0x21')](['campaigns.id',_0x4c7c('0x4a')])[_0x4c7c('0x11')](_0x4c7c('0x4b'))[_0x4c7c('0x22')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x4c7c('0x12')](_0x4c7c('0x4c')+_0x53d7c6);db[_0x4c7c('0x46')]['query'](_0x8ad5b3[_0x4c7c('0x2b')]())[_0x4c7c('0x4d')](function(_0x37cd4f){var _0x154f2f=[];for(var _0x459442=0x0;_0x459442<_0x37cd4f[_0x4c7c('0x4e')];_0x459442++){_0x154f2f[_0x4c7c('0x47')](getTimezoneData(_0x37cd4f[_0x459442],tmp_campaigns));}BPromise[_0x4c7c('0x4f')](_0x154f2f)['then'](function(){_0x29012f({'val':0x1});});})[_0x4c7c('0x48')](function(_0x4375f2){logger[_0x4c7c('0x49')](_0x4375f2[_0x4c7c('0x42')]);_0x29012f({'val':0x0});});});}function updateTzVoiceQueues(_0x20cac3){return new Promise(function(_0x3840fa,_0x46b8d2){var _0x4f5907=squel['select']()[_0x4c7c('0x21')]([_0x4c7c('0x50'),_0x4c7c('0x51')])['from']('voice_queues')[_0x4c7c('0x22')]('voice_queues_has_cm_lists',null,_0x4c7c('0x52'))[_0x4c7c('0x12')](_0x4c7c('0x53')+_0x20cac3);db[_0x4c7c('0x46')][_0x4c7c('0x54')](_0x4f5907['toString']())[_0x4c7c('0x4d')](function(_0x232f6c){var _0x1ac3cd=[];for(var _0x14a786=0x0;_0x14a786<_0x232f6c[_0x4c7c('0x4e')];_0x14a786++){_0x1ac3cd['push'](getTimezoneData(_0x232f6c[_0x14a786],tmp_voice_queues));}BPromise[_0x4c7c('0x4f')](_0x1ac3cd)[_0x4c7c('0x55')](function(){_0x3840fa({'val':0x1});});})[_0x4c7c('0x48')](function(_0x1819ce){logger[_0x4c7c('0x49')](_0x1819ce[_0x4c7c('0x42')]);_0x3840fa({'val':0x0});});});}function getTimezoneData(_0x1bec5,_0x4af74c){return new Promise(function(_0xee4b47,_0x334956){var _0x2a13f7=shared['timezones'];var _0x578cc8=_0x2a13f7[_0x1bec5[_0x4c7c('0x56')]];if(_[_0x4c7c('0x57')](_0x578cc8)){_0xee4b47({'ret':0x1});}else{var _0x394d7c=_0x578cc8[_0x4c7c('0x58')];var _0x531661=squel[_0x4c7c('0x19')]()[_0x4c7c('0x1a')](_0x4af74c)[_0x4c7c('0x59')]('id',_0x1bec5['id'])[_0x4c7c('0x59')](_0x4c7c('0x5a'),_0x394d7c)[_0x4c7c('0x59')]('dialTimezone',_0x1bec5[_0x4c7c('0x56')])[_0x4c7c('0x2b')]();return db[_0x4c7c('0x46')]['query'](_0x531661)[_0x4c7c('0x4d')](function(_0x501011){_0xee4b47({'ret':0x1});})[_0x4c7c('0x48')](function(_0x3bae8f){logger[_0x4c7c('0x49')](_0x3bae8f[_0x4c7c('0x42')]);_0x334956({'ret':0x1});});}});}function handleTZQuery(_0x4c6f2b){logger[_0x4c7c('0x41')](_0x4c6f2b);return db[_0x4c7c('0x46')]['query'](_0x4c6f2b)['spread'](function(_0xe6281c){})['catch'](function(_0x379445){logger[_0x4c7c('0x49')](_0x379445['message']);});}function main(_0x58921d,_0x4e2e1c,_0x4ac14e,_0x767a06){logger['info'](_0x4c7c('0x5b'),_0x58921d,JSON['stringify'](_0x4e2e1c));process['send'](_0x4c7c('0x5c'));var _0x141a03=_0x4e2e1c[_0x4c7c('0x5d')];var _0xab46c5=_0x4e2e1c['socket_timestamp'];var _0x51285c=path[_0x4c7c('0x22')](config['root'],_0x4c7c('0x5e'),_0xab46c5+'.csv');hasTZ=_[_0x4c7c('0x3c')](_0x141a03)[_0x4c7c('0x5f')](_0x4c7c('0x56'));var _0x45427f=_[_0x4c7c('0x3c')](_0x141a03)['join']();logger[_0x4c7c('0x41')](_0x4c7c('0x60'),_0x45427f);if(hasTZ)_0x45427f+=_0x4c7c('0x61');fs[_0x4c7c('0x62')](_0x51285c,_0x45427f+'\x0a');Papa['parse'](fs[_0x4c7c('0x63')](_0x58921d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9d7d33,_0x22dcb9){try{for(var _0xc5f30=0x0,_0x144fd2=[];_0xc5f30<_0x9d7d33[_0x4c7c('0x64')][_0x4c7c('0x4e')];_0xc5f30++){stats[_0x4c7c('0x65')]+=0x1;if(_0x9d7d33['errors'][_0xc5f30]){handleError(_0x9d7d33['data'][_0xc5f30],_0x9d7d33[_0x4c7c('0x44')][_0xc5f30]);}else{var _0x5ef2cd=[];for(var _0x3bdfcd in _0x141a03){if(_0x141a03['hasOwnProperty'](_0x3bdfcd)){if(_0x9d7d33['data'][_0xc5f30][_0x141a03[_0x3bdfcd]]){var _0x178e0b=_[_0x4c7c('0x66')](_0x9d7d33['data'][_0xc5f30][_0x141a03[_0x3bdfcd]]['replace'](/"/g,'\x27'));switch(_0x3bdfcd){case _0x4c7c('0x67'):var _0x1f1f62=moment(_0x178e0b,_0x4c7c('0x68'),!![]);if(_0x1f1f62[_0x4c7c('0x69')]()){_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');}else{_0x5ef2cd[_0x4c7c('0x47')](_0x4c7c('0x6a'));}break;case'priority':var _0x4334e1=parseInt(_0x178e0b);_0x178e0b=_[_0x4c7c('0x6b')](_0x4334e1)||_0x4334e1<0x0||_0x4334e1>0x4?_0x767a06?0x3:0x2:_0x4334e1;_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');break;case'UserId':var _0x4530c4=parseInt(_0x178e0b);if(_[_0x4c7c('0x6c')](_0x4530c4)&&_[_0x4c7c('0x5f')](_0x4ac14e,_0x4530c4)){_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x4530c4+'\x22');}else{_0x5ef2cd[_0x4c7c('0x47')](_0x4c7c('0x6d'));}break;case'email':if(isEmail(_0x178e0b)){_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');}else{_0x5ef2cd[_0x4c7c('0x47')](_0x4c7c('0x6e'));}break;case'dateOfBirth':var _0x317319=moment(_0x178e0b,_0x4c7c('0x6f'),!![]);if(_0x317319[_0x4c7c('0x69')]()){_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');}else{_0x5ef2cd[_0x4c7c('0x47')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x3de61f=shared[_0x4c7c('0x70')];var _0xabfa61=_0x3de61f[_0x178e0b];if(!_['isNil'](_0xabfa61)){var _0x50990b=_0xabfa61['utcOffset'];_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');_0x144fd2['push']('\x22'+_0x50990b+'\x22');}break;default:_0x144fd2[_0x4c7c('0x47')]('\x22'+_0x178e0b+'\x22');}}else{switch(_0x3bdfcd){case _0x4c7c('0x71'):case'phone':_0x5ef2cd[_0x4c7c('0x47')](_0x3bdfcd+_0x4c7c('0x72'));break;default:_0x144fd2['push']('\x22\x22');}}}}if(_0x5ef2cd[_0x4c7c('0x4e')]){handleError(_0x9d7d33[_0x4c7c('0x64')][_0xc5f30],{'code':_0x4c7c('0x73'),'message':_0x5ef2cd[_0x4c7c('0x22')]()});}else{fs[_0x4c7c('0x74')](_0x51285c,_0x144fd2['join']()+'\x0a');}_0x144fd2=[];}if(!(stats['rows']%0xc8)){socket[_0x4c7c('0x75')]('contact:import:'+_0xab46c5,stats);stats['errors']=[];}}if(stopped){logger[_0x4c7c('0x41')](_0x4c7c('0x76'));_0x22dcb9['abort']();}}catch(_0x44c29c){handleError(_0x9d7d33[_0x4c7c('0x64')][_0xc5f30],{'code':_0x4c7c('0x77'),'message':_0x44c29c[_0x4c7c('0x42')]});logger[_0x4c7c('0x49')](_0x4c7c('0x78'),_0x44c29c[_0x4c7c('0x42')]);}},'complete':function(){try{var _0x3e54e1=[];var _0x4eb9c7=[];var _0x53d63c=_0x4c7c('0x23');if(_0x4e2e1c[_0x4c7c('0x79')]&&_0x4e2e1c[_0x4c7c('0x79')][_0x4c7c('0x4e')]){_0x53d63c=_0x4c7c('0x7a')+_0xab46c5;_0x3e54e1[_0x4c7c('0x47')](_0x4c7c('0x7b')+_0x53d63c+_0x4c7c('0x7c'));}tmp_campaigns=_0x4c7c('0x7d')+_0xab46c5;tmp_voice_queues=_0x4c7c('0x7e')+_0xab46c5;_0x4eb9c7[_0x4c7c('0x47')](_0x4c7c('0x7b')+tmp_campaigns+_0x4c7c('0x7f'));_0x4eb9c7['push'](_0x4c7c('0x7b')+tmp_voice_queues+_0x4c7c('0x7f'));BPromise[_0x4c7c('0x80')](_0x4eb9c7,handleTZQuery)[_0x4c7c('0x55')](function(_0x522052){updateTzCampaigns(_0x4e2e1c['ListId'])[_0x4c7c('0x55')](function(_0xd9adce){updateTzVoiceQueues(_0x4e2e1c['ListId'])['then'](function(_0xecd390){var _0x4e998a=util[_0x4c7c('0xe')](_0x4c7c('0x81'),_0x51285c,_0x53d63c,_0x45427f,_0x4e2e1c[_0x4c7c('0x1d')],_0x4e2e1c[_0x4c7c('0x82')]||null,NOW,NOW);if(_[_0x4c7c('0x57')](_0x141a03[_0x4c7c('0x67')])){_0x4e998a+=_0x4c7c('0x83');}_0x3e54e1['push'](_0x4e998a);if(_0x4e2e1c[_0x4c7c('0x79')]&&_0x4e2e1c[_0x4c7c('0x79')]['length']){_0x3e54e1[_0x4c7c('0x47')](insertCmContact(_0x4e2e1c[_0x4c7c('0x1d')],_0x53d63c,_0x4e2e1c[_0x4c7c('0x79')],_0x141a03));_0x3e54e1[_0x4c7c('0x47')](_0x4c7c('0x84')+_0x53d63c+';');}if(hasTZ){_0x3e54e1[_0x4c7c('0x47')](insertTzCmHopper(_0x4e2e1c[_0x4c7c('0x1d')],_0x4c7c('0x85'),_0x4c7c('0x86'),_0x4c7c('0x87'),_0x767a06,tmp_voice_queues));_0x3e54e1[_0x4c7c('0x47')](insertTzCmHopperBlack(_0x4e2e1c[_0x4c7c('0x1d')],'voice_queues_has_cm_blacklists',_0x4c7c('0x86'),'VoiceQueueId'));_0x3e54e1[_0x4c7c('0x47')](insertTzCmHopper(_0x4e2e1c[_0x4c7c('0x1d')],_0x4c7c('0x88'),_0x4c7c('0x4b'),_0x4c7c('0x89'),_0x767a06,tmp_campaigns));_0x3e54e1[_0x4c7c('0x47')](insertTzCmHopperBlack(_0x4e2e1c['ListId'],'campaigns_has_cm_blacklists','campaigns',_0x4c7c('0x89')));}else{_0x3e54e1[_0x4c7c('0x47')](insertCmHopper(_0x4e2e1c[_0x4c7c('0x1d')],_0x4c7c('0x85'),'voice_queues','VoiceQueueId',_0x767a06));_0x3e54e1[_0x4c7c('0x47')](insertCmHopperBlack(_0x4e2e1c[_0x4c7c('0x1d')],_0x4c7c('0x8a'),_0x4c7c('0x86'),'VoiceQueueId'));_0x3e54e1[_0x4c7c('0x47')](insertCmHopper(_0x4e2e1c[_0x4c7c('0x1d')],'campaigns_has_cm_lists',_0x4c7c('0x4b'),_0x4c7c('0x89'),_0x767a06));_0x3e54e1[_0x4c7c('0x47')](insertCmHopperBlack(_0x4e2e1c[_0x4c7c('0x1d')],_0x4c7c('0x8b'),_0x4c7c('0x4b'),'CampaignId'));}_0x3e54e1[_0x4c7c('0x47')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x3e54e1['push'](_0x4c7c('0x84')+tmp_voice_queues+';');BPromise[_0x4c7c('0x80')](_0x3e54e1,handleQuery)[_0x4c7c('0x55')](function(_0x45aa0d){stats['finish']=!![];stats[_0x4c7c('0x8c')]=_0x4e2e1c['duplicates']&&_0x4e2e1c[_0x4c7c('0x79')][_0x4c7c('0x4e')]?results[0x2][_0x4c7c('0x8c')]:results[0x0][_0x4c7c('0x8c')];socket[_0x4c7c('0x75')](_0x4c7c('0x8d')+_0xab46c5,stats);fs[_0x4c7c('0x8e')](_0x58921d);fs[_0x4c7c('0x8e')](_0x51285c);process['exit'](0x0);})['catch'](function(_0x148143){logger['error'](_0x148143[_0x4c7c('0x42')]);process[_0x4c7c('0x43')](0x1);});});});});}catch(_0x202ac6){logger[_0x4c7c('0x49')](_0x4c7c('0x8f'),_0x202ac6[_0x4c7c('0x42')]);process[_0x4c7c('0x43')](0x1);}},'error':function(_0xbbe364,_0x4eaeff,_0x28eac5,_0x5dfe6e){throw new Error(_0x5dfe6e);}});}function validate(){if(process['argv']&&process['argv'][_0x4c7c('0x4e')]<0x4){throw new Error(_0x4c7c('0x90'));}var _0x7a499a=path[_0x4c7c('0x22')](config['root'],_0x4c7c('0x5e'),process[_0x4c7c('0x91')][0x2]);if(!fs[_0x4c7c('0x92')](_0x7a499a)){throw new Error(_0x4c7c('0x93'));}var _0x3f31b5={};try{_0x3f31b5=JSON[_0x4c7c('0x94')](process[_0x4c7c('0x91')][0x3]);if(!_0x3f31b5[_0x4c7c('0x5d')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3f31b5['binding']['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x3f31b5[_0x4c7c('0x5d')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x538420=0x0;if(_0x3f31b5[_0x4c7c('0x5d')][_0x4c7c('0x1f')]){_0x538420=0x1;}if(!_0x3f31b5['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3b6da1){throw new Error('body\x20id\x20mandatory');}var _0x46219e=[];try{_0x46219e=_[_0x4c7c('0x95')](JSON[_0x4c7c('0x94')](process[_0x4c7c('0x91')][0x4]),'id');}catch(_0x31c346){logger[_0x4c7c('0x41')](_0x4c7c('0x96'));}main(_0x7a499a,_0x3f31b5,_0x46219e,_0x538420);}validate();process['on'](_0x4c7c('0x97'),handleStop);process['on'](_0x4c7c('0x98'),handleUncaughtException); \ No newline at end of file +var _0x8c45=['firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','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','into','cm_hopper_black','createdAt','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_contacts.UserId','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','push','code','sequelize','spread','catch','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','isNil'];(function(_0x47c882,_0x8a92aa){var _0x205ede=function(_0x2bf8ae){while(--_0x2bf8ae){_0x47c882['push'](_0x47c882['shift']());}};_0x205ede(++_0x8a92aa);}(_0x8c45,0x14d));var _0x58c4=function(_0x3c399c,_0x3dbbc8){_0x3c399c=_0x3c399c-0x0;var _0x3831a1=_0x8c45[_0x3c399c];return _0x3831a1;};'use strict';var fs=require('fs');var path=require(_0x58c4('0x0'));var _=require(_0x58c4('0x1'));var Papa=require('papaparse');var util=require(_0x58c4('0x2'));var BPromise=require(_0x58c4('0x3'));var moment=require(_0x58c4('0x4'));var squel=require(_0x58c4('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x58c4('0x6'));var logger=require(_0x58c4('0x7'))('import');config[_0x58c4('0x8')]=_['defaults'](config[_0x58c4('0x8')],{'host':_0x58c4('0x9'),'port':0x18eb});var socket=require(_0x58c4('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x58c4('0xb')](_0x58c4('0xc'));function isEmail(_0x555055){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'](_0x555055);}function selectNotIn(_0x117a10,_0x56c236,_0x553ead,_0x2caf70,_0x1c223){return squel[_0x58c4('0xd')]()[_0x58c4('0xe')]('phone')[_0x58c4('0xf')](_0x2caf70)[_0x58c4('0x10')](_0x56c236,null,_0x56c236+'.id\x20=\x20'+_0x2caf70+'.'+_0x553ead)['where'](_0x2caf70+'.'+_0x553ead+_0x58c4('0x11')+_0x117a10+'.'+_0x553ead)[_0x58c4('0x12')](_0x56c236+_0x58c4('0x13')+_0x1c223[_0x58c4('0x10')]()+')');}function insertCmHopper(_0x152cac,_0x418150,_0x208732,_0x498b6,_0x313327){var _0x2d246b=[_0x58c4('0x14'),'cm_contacts.scheduledat',_0x58c4('0x15'),_0x58c4('0x16'),_0x418150+'.'+_0x498b6,_0x58c4('0x17'),_0x58c4('0x18'),_0x58c4('0x19'),'cm_contacts.UserId','\x22'+_0x313327+'\x22'];return squel[_0x58c4('0x1a')]()['into'](_0x58c4('0x1b'))[_0x58c4('0x1c')]([_0x58c4('0x1d'),_0x58c4('0x1e'),_0x58c4('0x1f'),_0x58c4('0x20'),_0x498b6,'createdAt',_0x58c4('0x21'),_0x58c4('0x22'),_0x58c4('0x23'),_0x58c4('0x24')],squel[_0x58c4('0xd')]()[_0x58c4('0x25')](_0x2d246b)[_0x58c4('0xf')](_0x418150)[_0x58c4('0x10')](_0x58c4('0x26'),null,_0x58c4('0x27')+_0x418150+_0x58c4('0x28'))['join'](_0x208732,null,_0x208732+'.id\x20=\x20'+_0x418150+'.'+_0x498b6)[_0x58c4('0x12')](_0x418150+_0x58c4('0x29'),_0x152cac)['where'](_0x58c4('0x2a'),NOW)[_0x58c4('0x12')](_0x58c4('0x2b'),selectNotIn(_0x418150,_0x208732,_0x498b6,_0x58c4('0x1b'),[_0x58c4('0x2c'),_0x58c4('0x2d')]))[_0x58c4('0x12')](_0x58c4('0x2b'),selectNotIn(_0x418150,_0x208732,_0x498b6,_0x58c4('0x1b'),[_0x58c4('0x2c')])))[_0x58c4('0x2e')]();}function insertCmHopperBlack(_0xaf0423,_0x390670,_0x9ab06c,_0x2b59ff){var _0x32778b=[_0x58c4('0x14'),'cm_contacts.id',_0x58c4('0x16'),_0x390670+'.'+_0x2b59ff,_0x58c4('0x17'),_0x58c4('0x18')];return squel['insert']()[_0x58c4('0x2f')](_0x58c4('0x30'))['fromQuery'](['phone',_0x58c4('0x1f'),_0x58c4('0x20'),_0x2b59ff,_0x58c4('0x31'),_0x58c4('0x21')],squel['select']()[_0x58c4('0x25')](_0x32778b)[_0x58c4('0xf')](_0x390670)[_0x58c4('0x10')](_0x58c4('0x26'),null,_0x58c4('0x27')+_0x390670+_0x58c4('0x28'))[_0x58c4('0x10')](_0x9ab06c,null,_0x9ab06c+_0x58c4('0x32')+_0x390670+'.'+_0x2b59ff)[_0x58c4('0x12')](_0x390670+_0x58c4('0x29'),_0xaf0423)['where'](_0x58c4('0x2a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x58c4('0xd')]()['field'](_0x58c4('0x1d'))[_0x58c4('0xf')]('cm_hopper_black')[_0x58c4('0x12')](_0x58c4('0x33'),_0xaf0423)[_0x58c4('0x12')](_0x2b59ff+_0x58c4('0x34'),_0x390670+'.'+_0x2b59ff)))['toString']();}function insertTzCmHopper(_0x33b349,_0x77f0d4,_0x43d783,_0x4bbefd,_0x1d2186,_0xed9d2a){var _0x201c70=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0xed9d2a+'.offset-cm_contacts.utcOffset\x20minute)',_0x58c4('0x15'),_0x58c4('0x16'),_0x77f0d4+'.'+_0x4bbefd,'cm_contacts.createdAt',_0x58c4('0x18'),_0x58c4('0x19'),_0x58c4('0x35'),'\x22'+_0x1d2186+'\x22'];var _0x579148=squel[_0x58c4('0x1a')]()[_0x58c4('0x2f')](_0x58c4('0x1b'))['fromQuery']([_0x58c4('0x1d'),_0x58c4('0x1e'),_0x58c4('0x1f'),_0x58c4('0x20'),_0x4bbefd,_0x58c4('0x31'),_0x58c4('0x21'),_0x58c4('0x22'),_0x58c4('0x23'),_0x58c4('0x24')],squel['select']()[_0x58c4('0x25')](_0x201c70)[_0x58c4('0xf')](_0x77f0d4)[_0x58c4('0x10')](_0x58c4('0x26'),null,_0x58c4('0x27')+_0x77f0d4+_0x58c4('0x28'))[_0x58c4('0x10')](_0x43d783,null,_0x43d783+'.id\x20=\x20'+_0x77f0d4+'.'+_0x4bbefd)[_0x58c4('0x10')](_0xed9d2a,null,_0xed9d2a+_0x58c4('0x32')+_0x77f0d4+'.'+_0x4bbefd)['where'](_0x77f0d4+'.CmListId\x20=\x20?',_0x33b349)[_0x58c4('0x12')](_0x58c4('0x2a'),NOW)[_0x58c4('0x12')](_0x58c4('0x2b'),selectNotIn(_0x77f0d4,_0x43d783,_0x4bbefd,_0x58c4('0x1b'),[_0x58c4('0x2c'),'\x22onlyIfOpen\x22']))[_0x58c4('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x77f0d4,_0x43d783,_0x4bbefd,_0x58c4('0x1b'),[_0x58c4('0x2c')])))[_0x58c4('0x2e')]();return _0x579148;}function insertTzCmHopperBlack(_0x520f9b,_0x4851f0,_0xf5d74a,_0x5de86d){var _0x16623c=['cm_contacts.phone',_0x58c4('0x15'),_0x58c4('0x16'),_0x4851f0+'.'+_0x5de86d,_0x58c4('0x17'),_0x58c4('0x18')];return squel['insert']()['into'](_0x58c4('0x30'))[_0x58c4('0x1c')]([_0x58c4('0x1d'),_0x58c4('0x1f'),'ListId',_0x5de86d,_0x58c4('0x31'),_0x58c4('0x21')],squel[_0x58c4('0xd')]()[_0x58c4('0x25')](_0x16623c)[_0x58c4('0xf')](_0x4851f0)['join'](_0x58c4('0x26'),null,_0x58c4('0x27')+_0x4851f0+_0x58c4('0x28'))['join'](_0xf5d74a,null,_0xf5d74a+_0x58c4('0x32')+_0x4851f0+'.'+_0x5de86d)[_0x58c4('0x12')](_0x4851f0+_0x58c4('0x29'),_0x520f9b)[_0x58c4('0x12')](_0x58c4('0x2a'),NOW)[_0x58c4('0x12')](_0x58c4('0x2b'),squel[_0x58c4('0xd')]()[_0x58c4('0xe')](_0x58c4('0x1d'))[_0x58c4('0xf')](_0x58c4('0x30'))[_0x58c4('0x12')]('ListId\x20=\x20?',_0x520f9b)[_0x58c4('0x12')](_0x5de86d+'\x20=\x20?',_0x4851f0+'.'+_0x5de86d)))['toString']();}function insertCmContact(_0x1879a0,_0x2b87d8,_0x578492,_0x45d8c8){var _0x295056=_[_0x58c4('0x36')](_['keys'](_0x45d8c8),[_0x58c4('0x20'),_0x58c4('0x37'),_0x58c4('0x31'),_0x58c4('0x21')]);return squel[_0x58c4('0x1a')]()[_0x58c4('0x2f')](_0x58c4('0x26'))[_0x58c4('0x1c')](_0x295056,squel[_0x58c4('0xd')]()[_0x58c4('0x25')](_0x295056)[_0x58c4('0xf')](_0x2b87d8)[_0x58c4('0x12')]('('+_0x578492[_0x58c4('0x10')](',')+_0x58c4('0x38'),squel['select']()[_0x58c4('0x25')](_0x578492)['from'](_0x58c4('0x26'))[_0x58c4('0x12')](_0x58c4('0x33'),_0x1879a0)['where'](_0x58c4('0x39')))[_0x58c4('0x12')](_0x58c4('0x3a'),squel[_0x58c4('0xd')]()['field']('MIN(id)',_0x58c4('0x3b'))[_0x58c4('0xf')](_0x2b87d8)[_0x58c4('0x3c')](_0x578492[_0x58c4('0x10')](','))))[_0x58c4('0x2e')]();}function handleStop(){logger[_0x58c4('0x3d')](_0x58c4('0x3e'));stopped=!![];}function handleUncaughtException(_0x546e91){logger[_0x58c4('0x3f')](_0x546e91['message']);process['exit'](0x1);}function handleError(_0x279a1e,_0x1ef85f){stats['errors'][_0x58c4('0x40')]({'name':_0x1ef85f[_0x58c4('0x41')],'message':_0x1ef85f['message'],'row':_0x279a1e});}function handleQuery(_0x476f33){logger[_0x58c4('0x3d')](_0x476f33);return db[_0x58c4('0x42')]['query'](_0x476f33)[_0x58c4('0x43')](function(_0x536404){results['push'](_0x536404);})[_0x58c4('0x44')](function(_0x49cdcb){logger[_0x58c4('0x3f')](_0x49cdcb[_0x58c4('0x45')]);});}function updateTzCampaigns(_0x2505d3){return new Promise(function(_0x4aa304,_0x519232){var _0x143b87=squel['select']()[_0x58c4('0x25')]([_0x58c4('0x46'),_0x58c4('0x47')])[_0x58c4('0xf')](_0x58c4('0x48'))[_0x58c4('0x10')](_0x58c4('0x49'),null,_0x58c4('0x4a'))[_0x58c4('0x12')](_0x58c4('0x4b')+_0x2505d3);db[_0x58c4('0x42')][_0x58c4('0x4c')](_0x143b87[_0x58c4('0x2e')]())[_0x58c4('0x43')](function(_0x50a42f){var _0x40f06f=[];for(var _0x26279a=0x0;_0x26279a<_0x50a42f[_0x58c4('0x4d')];_0x26279a++){_0x40f06f[_0x58c4('0x40')](getTimezoneData(_0x50a42f[_0x26279a],tmp_campaigns));}BPromise[_0x58c4('0x4e')](_0x40f06f)[_0x58c4('0x4f')](function(){_0x4aa304({'val':0x1});});})['catch'](function(_0x507f9b){logger[_0x58c4('0x3f')](_0x507f9b['message']);_0x4aa304({'val':0x0});});});}function updateTzVoiceQueues(_0x13ea89){return new Promise(function(_0x4ce357,_0x590f38){var _0x42fd9e=squel[_0x58c4('0xd')]()[_0x58c4('0x25')](['voice_queues.id',_0x58c4('0x50')])['from'](_0x58c4('0x51'))[_0x58c4('0x10')](_0x58c4('0x52'),null,_0x58c4('0x53'))['where'](_0x58c4('0x54')+_0x13ea89);db['sequelize'][_0x58c4('0x4c')](_0x42fd9e['toString']())[_0x58c4('0x43')](function(_0xb1d615){var _0x1bb4d9=[];for(var _0x285aae=0x0;_0x285aae<_0xb1d615['length'];_0x285aae++){_0x1bb4d9[_0x58c4('0x40')](getTimezoneData(_0xb1d615[_0x285aae],tmp_voice_queues));}BPromise[_0x58c4('0x4e')](_0x1bb4d9)[_0x58c4('0x4f')](function(){_0x4ce357({'val':0x1});});})[_0x58c4('0x44')](function(_0x125ef1){logger[_0x58c4('0x3f')](_0x125ef1[_0x58c4('0x45')]);_0x4ce357({'val':0x0});});});}function getTimezoneData(_0x2f4b57,_0x409a6f){return new Promise(function(_0x1170ec,_0x69714c){var _0x4709fc=shared[_0x58c4('0x55')];var _0x33b98e=_0x4709fc[_0x2f4b57[_0x58c4('0x56')]];if(_['isNil'](_0x33b98e)){_0x1170ec({'ret':0x1});}else{var _0x5e558c=_0x33b98e[_0x58c4('0x57')];var _0x41aa6e=squel[_0x58c4('0x1a')]()[_0x58c4('0x2f')](_0x409a6f)[_0x58c4('0x58')]('id',_0x2f4b57['id'])[_0x58c4('0x58')](_0x58c4('0x59'),_0x5e558c)[_0x58c4('0x58')]('dialTimezone',_0x2f4b57[_0x58c4('0x56')])[_0x58c4('0x2e')]();return db[_0x58c4('0x42')]['query'](_0x41aa6e)[_0x58c4('0x43')](function(_0x136cdb){_0x1170ec({'ret':0x1});})['catch'](function(_0x3752d9){logger[_0x58c4('0x3f')](_0x3752d9[_0x58c4('0x45')]);_0x69714c({'ret':0x1});});}});}function handleTZQuery(_0x1693d3){logger[_0x58c4('0x3d')](_0x1693d3);return db[_0x58c4('0x42')][_0x58c4('0x4c')](_0x1693d3)[_0x58c4('0x43')](function(_0x4fd16c){})[_0x58c4('0x44')](function(_0xd757ea){logger[_0x58c4('0x3f')](_0xd757ea[_0x58c4('0x45')]);});}function main(_0x14ce39,_0x2ee0a1,_0x3cc896,_0x1759ec){logger[_0x58c4('0x3d')]('main',_0x14ce39,JSON[_0x58c4('0x5a')](_0x2ee0a1));process['send'](_0x58c4('0x5b'));var _0x2ef55c=_0x2ee0a1[_0x58c4('0x5c')];var _0x175360=_0x2ee0a1[_0x58c4('0x5d')];var _0x3786f1=path[_0x58c4('0x10')](config[_0x58c4('0x5e')],_0x58c4('0x5f'),_0x175360+_0x58c4('0x60'));hasTZ=_['keys'](_0x2ef55c)['includes'](_0x58c4('0x56'));var _0x307cc9=_['keys'](_0x2ef55c)[_0x58c4('0x10')]();logger['info'](_0x58c4('0x61'),_0x307cc9);if(hasTZ)_0x307cc9+=',utcOffset';fs[_0x58c4('0x62')](_0x3786f1,_0x307cc9+'\x0a');Papa['parse'](fs['createReadStream'](_0x14ce39),{'header':!![],'skipEmptyLines':!![],'step':function(_0x6a501c,_0x53d0b4){try{for(var _0x187038=0x0,_0x4fa21e=[];_0x187038<_0x6a501c[_0x58c4('0x63')]['length'];_0x187038++){stats[_0x58c4('0x64')]+=0x1;if(_0x6a501c['errors'][_0x187038]){handleError(_0x6a501c['data'][_0x187038],_0x6a501c[_0x58c4('0x65')][_0x187038]);}else{var _0x3e4a3e=[];for(var _0x5e73c7 in _0x2ef55c){if(_0x2ef55c[_0x58c4('0x66')](_0x5e73c7)){if(_0x6a501c['data'][_0x187038][_0x2ef55c[_0x5e73c7]]){var _0x309eff=_[_0x58c4('0x67')](_0x6a501c[_0x58c4('0x63')][_0x187038][_0x2ef55c[_0x5e73c7]][_0x58c4('0x68')](/"/g,'\x27'));switch(_0x5e73c7){case _0x58c4('0x1e'):var _0x423ca4=moment(_0x309eff,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x423ca4[_0x58c4('0x69')]()){_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');}else{_0x3e4a3e[_0x58c4('0x40')](_0x58c4('0x6a'));}break;case'priority':var _0x2c9ff3=parseInt(_0x309eff);_0x309eff=_[_0x58c4('0x6b')](_0x2c9ff3)||_0x2c9ff3<0x0||_0x2c9ff3>0x4?_0x1759ec?0x3:0x2:_0x2c9ff3;_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');break;case _0x58c4('0x23'):var _0x260b95=parseInt(_0x309eff);if(_['isNumber'](_0x260b95)&&_[_0x58c4('0x6c')](_0x3cc896,_0x260b95)){_0x4fa21e['push']('\x22'+_0x260b95+'\x22');}else{_0x3e4a3e[_0x58c4('0x40')]('agent\x20not\x20exists');}break;case _0x58c4('0x6d'):if(isEmail(_0x309eff)){_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');}else{_0x3e4a3e['push'](_0x58c4('0x6e'));}break;case'dateOfBirth':var _0x17495b=moment(_0x309eff,_0x58c4('0x6f'),!![]);if(_0x17495b['isValid']()){_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');}else{_0x3e4a3e[_0x58c4('0x40')](_0x58c4('0x70'));}break;case _0x58c4('0x56'):var _0x547e5d=shared[_0x58c4('0x55')];var _0x5eef2c=_0x547e5d[_0x309eff];if(!_[_0x58c4('0x71')](_0x5eef2c)){var _0x188e90=_0x5eef2c[_0x58c4('0x57')];_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');_0x4fa21e['push']('\x22'+_0x188e90+'\x22');}break;default:_0x4fa21e[_0x58c4('0x40')]('\x22'+_0x309eff+'\x22');}}else{switch(_0x5e73c7){case _0x58c4('0x72'):case _0x58c4('0x1d'):_0x3e4a3e[_0x58c4('0x40')](_0x5e73c7+'\x20not\x20specified');break;default:_0x4fa21e['push']('\x22\x22');}}}}if(_0x3e4a3e[_0x58c4('0x4d')]){handleError(_0x6a501c[_0x58c4('0x63')][_0x187038],{'code':_0x58c4('0x73'),'message':_0x3e4a3e[_0x58c4('0x10')]()});}else{fs['appendFileSync'](_0x3786f1,_0x4fa21e[_0x58c4('0x10')]()+'\x0a');}_0x4fa21e=[];}if(!(stats[_0x58c4('0x64')]%0xc8)){socket[_0x58c4('0x74')](_0x58c4('0x75')+_0x175360,stats);stats['errors']=[];}}if(stopped){logger[_0x58c4('0x3d')](_0x58c4('0x76'));_0x53d0b4[_0x58c4('0x77')]();}}catch(_0x582265){handleError(_0x6a501c[_0x58c4('0x63')][_0x187038],{'code':'SystemError','message':_0x582265[_0x58c4('0x45')]});logger[_0x58c4('0x3f')](_0x58c4('0x78'),_0x582265[_0x58c4('0x45')]);}},'complete':function(){try{var _0xee9575=[];var _0x2346fd=[];var _0x2aa4e9='cm_contacts';if(_0x2ee0a1['duplicates']&&_0x2ee0a1[_0x58c4('0x79')][_0x58c4('0x4d')]){_0x2aa4e9=_0x58c4('0x7a')+_0x175360;_0xee9575['push'](_0x58c4('0x7b')+_0x2aa4e9+_0x58c4('0x7c'));}tmp_campaigns='campaigns_'+_0x175360;tmp_voice_queues='voice_queues_'+_0x175360;_0x2346fd[_0x58c4('0x40')](_0x58c4('0x7b')+tmp_campaigns+_0x58c4('0x7d'));_0x2346fd[_0x58c4('0x40')](_0x58c4('0x7b')+tmp_voice_queues+_0x58c4('0x7d'));BPromise[_0x58c4('0x7e')](_0x2346fd,handleTZQuery)['then'](function(_0x53bd45){updateTzCampaigns(_0x2ee0a1[_0x58c4('0x20')])[_0x58c4('0x4f')](function(_0x43239d){updateTzVoiceQueues(_0x2ee0a1[_0x58c4('0x20')])['then'](function(_0x5c4151){var _0xe67f9b=util[_0x58c4('0xb')](_0x58c4('0x7f'),_0x3786f1,_0x2aa4e9,_0x307cc9,_0x2ee0a1[_0x58c4('0x20')],_0x2ee0a1[_0x58c4('0x37')]||null,NOW,NOW);if(_[_0x58c4('0x71')](_0x2ef55c[_0x58c4('0x1e')])){_0xe67f9b+=_0x58c4('0x80');}_0xee9575[_0x58c4('0x40')](_0xe67f9b);if(_0x2ee0a1[_0x58c4('0x79')]&&_0x2ee0a1[_0x58c4('0x79')]['length']){_0xee9575[_0x58c4('0x40')](insertCmContact(_0x2ee0a1[_0x58c4('0x20')],_0x2aa4e9,_0x2ee0a1['duplicates'],_0x2ef55c));_0xee9575['push'](_0x58c4('0x81')+_0x2aa4e9+';');}if(hasTZ){_0xee9575[_0x58c4('0x40')](insertTzCmHopper(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x52'),_0x58c4('0x51'),'VoiceQueueId',_0x1759ec,tmp_voice_queues));_0xee9575[_0x58c4('0x40')](insertTzCmHopperBlack(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x82'),_0x58c4('0x51'),_0x58c4('0x83')));_0xee9575[_0x58c4('0x40')](insertTzCmHopper(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x49'),_0x58c4('0x48'),_0x58c4('0x84'),_0x1759ec,tmp_campaigns));_0xee9575[_0x58c4('0x40')](insertTzCmHopperBlack(_0x2ee0a1[_0x58c4('0x20')],'campaigns_has_cm_blacklists',_0x58c4('0x48'),'CampaignId'));}else{_0xee9575['push'](insertCmHopper(_0x2ee0a1['ListId'],'voice_queues_has_cm_lists',_0x58c4('0x51'),_0x58c4('0x83'),_0x1759ec));_0xee9575[_0x58c4('0x40')](insertCmHopperBlack(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x82'),'voice_queues',_0x58c4('0x83')));_0xee9575[_0x58c4('0x40')](insertCmHopper(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x49'),_0x58c4('0x48'),_0x58c4('0x84'),_0x1759ec));_0xee9575['push'](insertCmHopperBlack(_0x2ee0a1[_0x58c4('0x20')],_0x58c4('0x85'),_0x58c4('0x48'),_0x58c4('0x84')));}_0xee9575[_0x58c4('0x40')](_0x58c4('0x81')+tmp_campaigns+';');_0xee9575['push'](_0x58c4('0x81')+tmp_voice_queues+';');BPromise[_0x58c4('0x7e')](_0xee9575,handleQuery)['then'](function(_0x2b8dcf){stats['finish']=!![];stats[_0x58c4('0x86')]=_0x2ee0a1[_0x58c4('0x79')]&&_0x2ee0a1[_0x58c4('0x79')][_0x58c4('0x4d')]?results[0x2]['affectedRows']:results[0x0][_0x58c4('0x86')];socket[_0x58c4('0x74')]('contact:import:'+_0x175360,stats);fs[_0x58c4('0x87')](_0x14ce39);fs[_0x58c4('0x87')](_0x3786f1);process['exit'](0x0);})[_0x58c4('0x44')](function(_0x44198a){logger['error'](_0x44198a[_0x58c4('0x45')]);process[_0x58c4('0x88')](0x1);});});});});}catch(_0x22fca9){logger['error'](_0x58c4('0x89'),_0x22fca9[_0x58c4('0x45')]);process['exit'](0x1);}},'error':function(_0x293a68,_0x2313a9,_0x15cfe0,_0x390037){throw new Error(_0x390037);}});}function validate(){if(process[_0x58c4('0x8a')]&&process[_0x58c4('0x8a')]['length']<0x4){throw new Error(_0x58c4('0x8b'));}var _0x115738=path[_0x58c4('0x10')](config[_0x58c4('0x5e')],_0x58c4('0x5f'),process['argv'][0x2]);if(!fs[_0x58c4('0x8c')](_0x115738)){throw new Error(_0x58c4('0x8d'));}var _0x31af14={};try{_0x31af14=JSON[_0x58c4('0x8e')](process['argv'][0x3]);if(!_0x31af14[_0x58c4('0x5c')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x31af14[_0x58c4('0x5c')][_0x58c4('0x1d')]){throw new Error(_0x58c4('0x8f'));}if(!_0x31af14['binding'][_0x58c4('0x72')]){throw new Error(_0x58c4('0x90'));}var _0x107187=0x0;if(_0x31af14[_0x58c4('0x5c')][_0x58c4('0x23')]){_0x107187=0x1;}if(!_0x31af14[_0x58c4('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x32c5ee){throw new Error(_0x58c4('0x91'));}var _0x3692c6=[];try{_0x3692c6=_[_0x58c4('0x92')](JSON[_0x58c4('0x8e')](process[_0x58c4('0x8a')][0x4]),'id');}catch(_0x51883c){logger[_0x58c4('0x3d')](_0x58c4('0x93'));}main(_0x115738,_0x31af14,_0x3692c6,_0x107187);}validate();process['on']('SIGINT',handleStop);process['on'](_0x58c4('0x94'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 6047c60..7c30829 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d8=['push','queue','variable','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','destexten','Queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound'];(function(_0x353121,_0x416ffd){var _0x298f02=function(_0x2224c5){while(--_0x2224c5){_0x353121['push'](_0x353121['shift']());}};_0x298f02(++_0x416ffd);}(_0x83d8,0xd8));var _0x883d=function(_0x574dcf,_0x3ec141){_0x574dcf=_0x574dcf-0x0;var _0x19e8c0=_0x83d8[_0x574dcf];return _0x19e8c0;};'use strict';exports[_0x883d('0x0')]=function(_0x1d76de,_0x651132){var _0x54ac20=[{'type':_0x883d('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1d76de[_0x883d('0x2')]()){case'voice':switch(_0x651132[_0x883d('0x2')]()){case _0x883d('0x3'):_0x54ac20[_0x883d('0x4')]({'type':'variable','content':'','variableName':_0x883d('0x5')});_0x54ac20['push']({'type':_0x883d('0x6'),'content':'','variableName':'calleridnum'});break;case _0x883d('0x7'):_0x54ac20[_0x883d('0x4')]({'type':_0x883d('0x1'),'content':_0x883d('0x8'),'variableName':null});_0x54ac20['push']({'type':_0x883d('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x54ac20;};exports['getDescriptions']=function(_0x19c357,_0x4ee15a){var _0x365092=[];switch(_0x19c357[_0x883d('0x2')]()){case'voice':switch(_0x4ee15a[_0x883d('0x2')]()){case _0x883d('0x3'):_0x365092=[{'type':_0x883d('0x1'),'content':_0x883d('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0xb'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0xc')},{'type':_0x883d('0xa'),'content':'','key':'Caller\x20Name','keyType':_0x883d('0x6'),'variableName':_0x883d('0xd')},{'type':_0x883d('0xa'),'content':'','key':'Call\x20To','keyType':_0x883d('0x6'),'variableName':_0x883d('0xe')},{'type':'keyValue','content':'','key':_0x883d('0xf'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x5')},{'type':_0x883d('0xa'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x883d('0x10')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x11'),'keyType':_0x883d('0x6'),'variableName':'agentcalledAt'},{'type':_0x883d('0x1'),'content':_0x883d('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x13'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x14')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x15'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x16')},{'type':_0x883d('0x1'),'content':_0x883d('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x18'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x19')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x1a'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x1b')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x1c'),'keyType':_0x883d('0x6'),'variableName':'agentcompleteAt'},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x1d'),'keyType':_0x883d('0x6'),'variableName':_0x883d('0x1e')},{'type':'keyValue','content':'','key':_0x883d('0x1f'),'keyType':_0x883d('0x6'),'variableName':'talktime'}];break;case _0x883d('0x7'):_0x365092=[{'type':_0x883d('0x1'),'content':_0x883d('0x9'),'variableName':null},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x20'),'keyType':_0x883d('0x6'),'keyContent':'','variableName':_0x883d('0x16')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x21'),'keyType':'variable','keyContent':'','variableName':_0x883d('0x22')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x23'),'keyType':_0x883d('0x6'),'keyContent':'','variableName':_0x883d('0x10')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x11'),'keyType':_0x883d('0x6'),'keyContent':'','variableName':_0x883d('0x24')},{'type':_0x883d('0x1'),'content':_0x883d('0x17')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x25'),'keyType':'variable','keyContent':'','variableName':_0x883d('0x26')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x27'),'keyType':'variable','keyContent':'','variableName':_0x883d('0x28')},{'type':_0x883d('0xa'),'content':'','key':'Duration','keyType':_0x883d('0x6'),'keyContent':'','variableName':_0x883d('0x29')},{'type':_0x883d('0xa'),'content':'','key':_0x883d('0x2a'),'keyType':_0x883d('0x6'),'keyContent':'','variableName':_0x883d('0x2b')}];break;}}return _0x365092;}; \ No newline at end of file +var _0x11e7=['***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','Talk\x20Time','talktime','outbound','Called\x20Number','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','calleridnum','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number'];(function(_0x1bd8de,_0x1653f2){var _0x1213bb=function(_0x16827a){while(--_0x16827a){_0x1bd8de['push'](_0x1bd8de['shift']());}};_0x1213bb(++_0x1653f2);}(_0x11e7,0x9c));var _0x711e=function(_0x429f17,_0x35b7e2){_0x429f17=_0x429f17-0x0;var _0x4d4ae5=_0x11e7[_0x429f17];return _0x4d4ae5;};'use strict';exports[_0x711e('0x0')]=function(_0xfb16ca,_0x3741a0){var _0x4d620b=[{'type':'string','content':_0x711e('0x1'),'variableName':null}];switch(_0xfb16ca['toLowerCase']()){case _0x711e('0x2'):switch(_0x3741a0[_0x711e('0x3')]()){case _0x711e('0x4'):_0x4d620b[_0x711e('0x5')]({'type':_0x711e('0x6'),'content':'','variableName':'queue'});_0x4d620b[_0x711e('0x5')]({'type':_0x711e('0x6'),'content':'','variableName':_0x711e('0x7')});break;case'outbound':_0x4d620b[_0x711e('0x5')]({'type':_0x711e('0x8'),'content':_0x711e('0x9'),'variableName':null});_0x4d620b[_0x711e('0x5')]({'type':_0x711e('0x6'),'content':'','variableName':_0x711e('0xa')});break;}}return _0x4d620b;};exports[_0x711e('0xb')]=function(_0xf2f8bf,_0x475285){var _0x5f3368=[];switch(_0xf2f8bf['toLowerCase']()){case _0x711e('0x2'):switch(_0x475285[_0x711e('0x3')]()){case _0x711e('0x4'):_0x5f3368=[{'type':_0x711e('0x8'),'content':_0x711e('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0xe'),'keyType':_0x711e('0x6'),'variableName':'calleridnum'},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0xf'),'keyType':_0x711e('0x6'),'variableName':_0x711e('0x10')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x11'),'keyType':_0x711e('0x6'),'variableName':_0x711e('0x12')},{'type':_0x711e('0xd'),'content':'','key':'UniqueId','keyType':_0x711e('0x6'),'variableName':_0x711e('0x13')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x14'),'keyType':_0x711e('0x6'),'variableName':'agentcalledAt'},{'type':_0x711e('0x8'),'content':_0x711e('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x711e('0x16'),'keyType':_0x711e('0x6'),'variableName':'destcalleridname'},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x17'),'keyType':'variable','variableName':_0x711e('0xa')},{'type':'string','content':_0x711e('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x711e('0x6'),'variableName':_0x711e('0x19')},{'type':'keyValue','content':'','key':_0x711e('0x1a'),'keyType':_0x711e('0x6'),'variableName':_0x711e('0x1b')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x1c'),'keyType':_0x711e('0x6'),'variableName':'agentcompleteAt'},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x1d'),'keyType':_0x711e('0x6'),'variableName':'holdtime'},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x1e'),'keyType':_0x711e('0x6'),'variableName':_0x711e('0x1f')}];break;case _0x711e('0x20'):_0x5f3368=[{'type':_0x711e('0x8'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x21'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x711e('0xd'),'content':'','key':'Member\x20Name','keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x22')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x23'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x13')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x14'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x24')},{'type':_0x711e('0x8'),'content':_0x711e('0x18')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x25'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x26')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x27'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x28')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x29'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x2a')},{'type':_0x711e('0xd'),'content':'','key':_0x711e('0x2b'),'keyType':_0x711e('0x6'),'keyContent':'','variableName':_0x711e('0x2c')}];break;}}return _0x5f3368;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 617a3f6..1269353 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3256=['tracked','user','query','clone','omit','body','html','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','null','Interaction','findOne','then','update','catch','error'];(function(_0x15b840,_0x39eaa3){var _0x241aed=function(_0x5e06ec){while(--_0x5e06ec){_0x15b840['push'](_0x15b840['shift']());}};_0x241aed(++_0x39eaa3);}(_0x3256,0x158));var _0x6325=function(_0x2617ae,_0x238ac4){_0x2617ae=_0x2617ae-0x0;var _0x5a9988=_0x3256[_0x2617ae];return _0x5a9988;};'use strict';var _=require(_0x6325('0x0'));var db=require(_0x6325('0x1'))['db'];var loggers={'openchannel':require(_0x6325('0x2'))('openchannel-interactions'),'mail':require(_0x6325('0x2'))(_0x6325('0x3')),'fax':require(_0x6325('0x2'))(_0x6325('0x4')),'sms':require('../../config/logger')(_0x6325('0x5')),'chat':require(_0x6325('0x2'))(_0x6325('0x6')),'whatsapp':require(_0x6325('0x2'))(_0x6325('0x7'))};function getInteractionId(_0x278508,_0x54f394,_0x45053b){if(_0x278508&&_0x278508[_[_0x6325('0x8')](_0x45053b)+_0x6325('0x9')]){return _0x278508[_[_0x6325('0x8')](_0x45053b)+_0x6325('0x9')];}else if(_0x278508&&_0x278508['id']){return _0x278508['id'];}else if(_0x54f394&&_0x54f394['id']){return _0x54f394['id'];}else{return'unknown';}}function log(_0x52ee4d,_0x1d81ac,_0xbbc113,_0x48c400,_0x4c71a0,_0x7ecb9d){loggers[_0x4c71a0[_0x6325('0xa')]()][_0x52ee4d](_0x6325('0xb'),_0x7ecb9d['toUpperCase'](),_0x1d81ac?_0x1d81ac['id']:null,_0x1d81ac?_0x1d81ac[_0x6325('0xc')]:null,_0x1d81ac?_0x1d81ac['role']:null,getInteractionId(_0xbbc113,_0x48c400,_0x4c71a0),_0xbbc113?JSON['stringify'](_0xbbc113):_0x6325('0xd'));}function updateUser(_0x3be100,_0x50c6b2,_0x462317,_0x3519b3,_0x1295d0){db[_[_0x6325('0x8')](_0x3519b3)+_0x6325('0xe')][_0x6325('0xf')]({'where':{'id':getInteractionId(_0x50c6b2,_0x462317,_0x3519b3)}})[_0x6325('0x10')](function(_0x4c2f67){if(_0x4c2f67){return _0x4c2f67[_0x6325('0x11')]({'UserId':_0x3be100?_0x3be100['id']:null});}})[_0x6325('0x10')](function(_0xf8a08){if(_0xf8a08){log('info',_0x3be100,_0x50c6b2,_0x462317,_0x3519b3,_0x1295d0);}})[_0x6325('0x12')](function(){log(_0x6325('0x13'),_0x3be100,_0x50c6b2,_0x462317,_0x3519b3,_0x1295d0);});}exports[_0x6325('0x14')]=function(_0x4c8257,_0xd2c094){return function(_0x455e81,_0x24f922,_0x38dcb7){var _0x1eb0b0=_0x455e81[_0x6325('0x15')];var _0x21c45d={};var _0x357ab1=_0x455e81[_0x6325('0x16')];if(_0x21c45d){_0x21c45d=_[_0x6325('0x17')](_0x455e81['body']);_0x21c45d=_[_0x6325('0x18')](_0x21c45d,[_0x6325('0x19'),_0x6325('0x1a'),'phone','fax',_0x6325('0x1b')]);}updateUser(_0x1eb0b0,_0x21c45d,_0x357ab1,_0x4c8257,_0xd2c094);_0x38dcb7(null);};}; \ No newline at end of file +var _0xf7c5=['update','error','tracked','user','query','clone','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then'];(function(_0x2b4be9,_0x48ae3f){var _0xd918b4=function(_0x129d0a){while(--_0x129d0a){_0x2b4be9['push'](_0x2b4be9['shift']());}};_0xd918b4(++_0x48ae3f);}(_0xf7c5,0x174));var _0x5f7c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf7c5[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x5f7c('0x0'));var db=require(_0x5f7c('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x5f7c('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x5f7c('0x2'))(_0x5f7c('0x3')),'chat':require(_0x5f7c('0x2'))(_0x5f7c('0x4')),'whatsapp':require(_0x5f7c('0x2'))('whatsapp-interactions')};function getInteractionId(_0x11ea78,_0x43bc2e,_0x4c84d7){if(_0x11ea78&&_0x11ea78[_[_0x5f7c('0x5')](_0x4c84d7)+_0x5f7c('0x6')]){return _0x11ea78[_[_0x5f7c('0x5')](_0x4c84d7)+_0x5f7c('0x6')];}else if(_0x11ea78&&_0x11ea78['id']){return _0x11ea78['id'];}else if(_0x43bc2e&&_0x43bc2e['id']){return _0x43bc2e['id'];}else{return _0x5f7c('0x7');}}function log(_0x1049e6,_0x4c9188,_0xcff555,_0x5b6231,_0x4ee1e4,_0x727560){loggers[_0x4ee1e4[_0x5f7c('0x8')]()][_0x1049e6](_0x5f7c('0x9'),_0x727560[_0x5f7c('0xa')](),_0x4c9188?_0x4c9188['id']:null,_0x4c9188?_0x4c9188[_0x5f7c('0xb')]:null,_0x4c9188?_0x4c9188[_0x5f7c('0xc')]:null,getInteractionId(_0xcff555,_0x5b6231,_0x4ee1e4),_0xcff555?JSON[_0x5f7c('0xd')](_0xcff555):_0x5f7c('0xe'));}function updateUser(_0x2f39e0,_0xdc212c,_0x3bf668,_0x572194,_0x44f998){db[_[_0x5f7c('0x5')](_0x572194)+_0x5f7c('0xf')][_0x5f7c('0x10')]({'where':{'id':getInteractionId(_0xdc212c,_0x3bf668,_0x572194)}})[_0x5f7c('0x11')](function(_0x4a16f2){if(_0x4a16f2){return _0x4a16f2[_0x5f7c('0x12')]({'UserId':_0x2f39e0?_0x2f39e0['id']:null});}})['then'](function(_0x15ab24){if(_0x15ab24){log('info',_0x2f39e0,_0xdc212c,_0x3bf668,_0x572194,_0x44f998);}})['catch'](function(){log(_0x5f7c('0x13'),_0x2f39e0,_0xdc212c,_0x3bf668,_0x572194,_0x44f998);});}exports[_0x5f7c('0x14')]=function(_0xb1cebf,_0x2caa59){return function(_0x26819e,_0xf85f07,_0x6e3a76){var _0x19db73=_0x26819e[_0x5f7c('0x15')];var _0x3602fc={};var _0x2a9e35=_0x26819e[_0x5f7c('0x16')];if(_0x3602fc){_0x3602fc=_[_0x5f7c('0x17')](_0x26819e['body']);_0x3602fc=_[_0x5f7c('0x18')](_0x3602fc,[_0x5f7c('0x19'),_0x5f7c('0x1a'),_0x5f7c('0x1b'),_0x5f7c('0x1c'),_0x5f7c('0x1d')]);}updateUser(_0x19db73,_0x3602fc,_0x2a9e35,_0xb1cebf,_0x2caa59);_0x6e3a76(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3429e9a..ae25284 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 _0x5ecd=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x45a57e,_0x1ec3c0){var _0x33d76e=function(_0x11585d){while(--_0x11585d){_0x45a57e['push'](_0x45a57e['shift']());}};_0x33d76e(++_0x1ec3c0);}(_0x5ecd,0x13d));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var util=require(_0xd5ec('0x0'));var compose=require(_0xd5ec('0x1'));var db=require(_0xd5ec('0x2'))['db'];var config=require(_0xd5ec('0x3'));function getValueFromLicense(_0x33f0e,_0x16d195){if(_0x33f0e&&_0x16d195){if(_0x16d195[_0xd5ec('0x4')]&&_0x16d195[_0xd5ec('0x5')]){var _0x3c898e=_0x16d195[_0xd5ec('0x4')];var _0x3c056a=_0x16d195['license'];var _0x1885d1=_0x3c898e[_0xd5ec('0x6')]('-')[0x4];var _0x15ec64=_0x3c898e['split']('-')[0x0];var _0x3a72e0=crypto[_0xd5ec('0x7')](_0xd5ec('0x8'),util[_0xd5ec('0x9')](_0xd5ec('0xa'),_0x1885d1,_0x3c898e,_0x15ec64));var _0xe7d0de=_0x3a72e0[_0xd5ec('0xb')](_0x3c056a,_0xd5ec('0xc'),_0xd5ec('0xd'));_0xe7d0de+=_0x3a72e0[_0xd5ec('0xe')]('utf8');var _0x246314=JSON[_0xd5ec('0xf')](_0xe7d0de);return _0x246314[_0xd5ec('0x10')](_0x33f0e)?_0x246314[_0x33f0e]:null;}}return null;}function isLimit(_0x54ee8e,_0x3e2bbe,_0xaf4f7a,_0x90daac){var _0x181b20=_0x3e2bbe;return compose()[_0xd5ec('0x11')](function(_0x40fed5,_0x314a49,_0x454167){return db[_0xd5ec('0x12')][_0xd5ec('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xd5ec('0x14')](function(_0x4e47a1){var _0x438b63=getValueFromLicense(_0x54ee8e,_0x4e47a1);return _0x438b63?_0x438b63:_0x181b20;})['then'](function(_0x1fd97b){_0x181b20=_0x1fd97b;return _0xaf4f7a[_0xd5ec('0x15')](_0x90daac);})[_0xd5ec('0x14')](function(_0x438ac6){if(_0x438ac6>=_0x181b20){return _0x314a49['status'](0x193)['json']({'message':util['format'](_0xd5ec('0x16'),_0x54ee8e)});}_0x454167();})['catch'](function(_0x19c49f){_0x454167(_0x19c49f);});});}function isUserLimit(){return isLimit(_0xd5ec('0x17'),0x1,db[_0xd5ec('0x18')],{'where':{'$or':[{'role':_0xd5ec('0x19')},{'role':'user'}]}});}exports[_0xd5ec('0x1a')]=isUserLimit; \ No newline at end of file +var _0xfe9b=['license','split','createDecipher','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1'];(function(_0x13e97d,_0x13231a){var _0x37baa0=function(_0x4a047f){while(--_0x4a047f){_0x13e97d['push'](_0x13e97d['shift']());}};_0x37baa0(++_0x13231a);}(_0xfe9b,0x19f));var _0xbfe9=function(_0x2a3177,_0x1f0efe){_0x2a3177=_0x2a3177-0x0;var _0x4f27ed=_0xfe9b[_0x2a3177];return _0x4f27ed;};'use strict';var crypto=require(_0xbfe9('0x0'));var util=require(_0xbfe9('0x1'));var compose=require(_0xbfe9('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xbfe9('0x3'));function getValueFromLicense(_0x59e994,_0x21d26e){if(_0x59e994&&_0x21d26e){if(_0x21d26e[_0xbfe9('0x4')]&&_0x21d26e[_0xbfe9('0x5')]){var _0x239db4=_0x21d26e['data1'];var _0x231e99=_0x21d26e[_0xbfe9('0x5')];var _0x461af5=_0x239db4[_0xbfe9('0x6')]('-')[0x4];var _0x68095b=_0x239db4[_0xbfe9('0x6')]('-')[0x0];var _0x19b458=crypto[_0xbfe9('0x7')]('aes-256-ctr',util['format'](_0xbfe9('0x8'),_0x461af5,_0x239db4,_0x68095b));var _0x564d7c=_0x19b458[_0xbfe9('0x9')](_0x231e99,_0xbfe9('0xa'),_0xbfe9('0xb'));_0x564d7c+=_0x19b458[_0xbfe9('0xc')](_0xbfe9('0xb'));var _0x177551=JSON[_0xbfe9('0xd')](_0x564d7c);return _0x177551[_0xbfe9('0xe')](_0x59e994)?_0x177551[_0x59e994]:null;}}return null;}function isLimit(_0x4efa20,_0x1ceb41,_0x1589a6,_0x2058c2){var _0x260822=_0x1ceb41;return compose()[_0xbfe9('0xf')](function(_0x428138,_0x550ac2,_0x27dad9){return db[_0xbfe9('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4734b1){var _0xb03211=getValueFromLicense(_0x4efa20,_0x4734b1);return _0xb03211?_0xb03211:_0x260822;})[_0xbfe9('0x11')](function(_0xd58a4f){_0x260822=_0xd58a4f;return _0x1589a6['count'](_0x2058c2);})[_0xbfe9('0x11')](function(_0x42d42d){if(_0x42d42d>=_0x260822){return _0x550ac2[_0xbfe9('0x12')](0x193)[_0xbfe9('0x13')]({'message':util[_0xbfe9('0x14')](_0xbfe9('0x15'),_0x4efa20)});}_0x27dad9();})[_0xbfe9('0x16')](function(_0xf81b8b){_0x27dad9(_0xf81b8b);});});}function isUserLimit(){return isLimit(_0xbfe9('0x17'),0x1,db[_0xbfe9('0x18')],{'where':{'$or':[{'role':_0xbfe9('0x19')},{'role':_0xbfe9('0x1a')}]}});}exports[_0xbfe9('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0cd16a1..efbbab4 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 _0xf065=['forEach','shift','match','indexOf','map','conditions','push','buildExpression','operator','$eq','value','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','[$or]','and','replace','[$and]','split'];(function(_0x127654,_0x39629d){var _0x4a5de1=function(_0x221300){while(--_0x221300){_0x127654['push'](_0x127654['shift']());}};_0x4a5de1(++_0x39629d);}(_0xf065,0x12b));var _0x5f06=function(_0x3edc28,_0x11d1ce){_0x3edc28=_0x3edc28-0x0;var _0x187a92=_0xf065[_0x3edc28];return _0x187a92;};'use strict';var _=require(_0x5f06('0x0'));var moment=require(_0x5f06('0x1'));exports['parseSearch']=function(_0x13263d){var _0xb3b291={'conditions':[]};_0xb3b291['sqlOperator']=_['startsWith'](_0x13263d,_0x5f06('0x2'))?'or':_0x5f06('0x3');var _0x2c135b=_0x13263d[_0x5f06('0x4')](_0x5f06('0x5'),'')['replace'](_0x5f06('0x2'),'')[_0x5f06('0x6')]('||');for(var _0x3cd52c=0x0;_0x3cd52c<_0x2c135b['length'];_0x3cd52c++){var _0x5a430d=_0x2c135b[_0x3cd52c]['split'](':=');var _0x15da1c=_0x5a430d[0x0];var _0x883037=_0x5a430d['slice'](0x1);_0x883037[_0x5f06('0x7')](function(_0x1afd3a){var _0x1efdef=_0x1afd3a['split']('[')[_0x5f06('0x8')]();var _0x2d12df=_0x1afd3a[_0x5f06('0x9')](/\[(.*?)\]/g);_0x2d12df[_0x5f06('0x7')](function(_0x528645){var _0x3df00a=_0x528645[_0x5f06('0x6')]('[')['filter'](function(_0x3bc9f7){return _0x3bc9f7[_0x5f06('0xa')](']')>-0x1;})[_0x5f06('0xb')](function(_0xbb70d0){return _0xbb70d0[_0x5f06('0x6')](']')[0x0];})[0x0];_0xb3b291[_0x5f06('0xc')][_0x5f06('0xd')]({'field':_0x15da1c,'operator':_0x1efdef,'value':_0x3df00a});});});}return _0xb3b291;};exports[_0x5f06('0xe')]=function(_0x33558e,_0x5a49a4,_0x23c7f9){var _0x3e0790={};if(_0x5a49a4==='DATE'){if(_0x23c7f9[_0x5f06('0xf')]===_0x5f06('0x10')){_0x23c7f9[_0x5f06('0xf')]='$between';_0x23c7f9[_0x5f06('0x11')]+=','+_0x23c7f9[_0x5f06('0x11')];}else if(_['includes']([_0x5f06('0x12'),_0x5f06('0x13')],_0x23c7f9['operator'])){_0x23c7f9[_0x5f06('0x11')]=moment(_0x23c7f9[_0x5f06('0x11')])[_0x5f06('0x14')](0x1,'days')[_0x5f06('0x15')](_0x5f06('0x16'));}}if(_0x23c7f9['castTo']){_0x5a49a4=_0x23c7f9[_0x5f06('0x17')];_0x3e0790[_0x5f06('0x18')]=_0x5f06('0x19')+_0x33558e+'.'+_0x23c7f9['field']+'\x20AS\x20'+_0x23c7f9[_0x5f06('0x17')]+')\x20'+parseOperator(_0x23c7f9[_0x5f06('0xf')]);}else{_0x3e0790[_0x5f06('0x18')]=_0x33558e+'.'+_0x23c7f9['field']+'\x20'+parseOperator(_0x23c7f9[_0x5f06('0xf')]);}if(_['includes']([_0x5f06('0x1a'),_0x5f06('0x1b')],_0x23c7f9[_0x5f06('0xf')]))_0x3e0790[_0x5f06('0x18')]='('+_0x3e0790[_0x5f06('0x18')]+_0x5f06('0x1c')+_0x33558e+'.'+_0x23c7f9['field']+_0x5f06('0x1d');_0x3e0790[_0x5f06('0x11')]=parseValue(_0x5a49a4,_0x23c7f9[_0x5f06('0xf')],_0x23c7f9[_0x5f06('0x11')]);return _0x3e0790;};function parseOperator(_0x24ba82){var _0x4b041e;switch(_0x24ba82){case _0x5f06('0x1e'):_0x4b041e=_0x5f06('0x1f');break;case'$notIn':_0x4b041e=_0x5f06('0x20');break;case _0x5f06('0x10'):_0x4b041e=_0x5f06('0x21');break;case _0x5f06('0x1a'):_0x4b041e='<>\x20?';break;case _0x5f06('0x22'):case _0x5f06('0x23'):case _0x5f06('0x24'):_0x4b041e=_0x5f06('0x25');break;case _0x5f06('0x26'):_0x4b041e=_0x5f06('0x27');break;case'$gt':_0x4b041e=_0x5f06('0x28');break;case _0x5f06('0x13'):_0x4b041e=_0x5f06('0x29');break;case'$gte':_0x4b041e='>=\x20?';break;case'$between':_0x4b041e=_0x5f06('0x2a');break;}return _0x4b041e;}function parseValue(_0x11fac2,_0x27b0c7,_0x1d770a){var _0x2ed9eb={'start':undefined,'end':undefined};switch(_0x27b0c7){case'$in':case _0x5f06('0x1b'):_0x2ed9eb[_0x5f06('0x2b')]=_0x1d770a[_0x5f06('0x6')](',');break;case _0x5f06('0x22'):_0x2ed9eb[_0x5f06('0x2b')]='%'+_0x1d770a+'%';break;case _0x5f06('0x23'):_0x2ed9eb[_0x5f06('0x2b')]=_0x1d770a+'%';break;case _0x5f06('0x24'):_0x2ed9eb['start']='%'+_0x1d770a;break;case _0x5f06('0x2c'):var _0x346df9=_0x1d770a[_0x5f06('0x6')](',');var _0x1d770a=_0x346df9[_0x5f06('0x8')]();var _0xb9e5e4=_0x346df9[_0x5f06('0x2d')]();if(_0x11fac2===_0x5f06('0x2e')){_0x1d770a=moment(_0x1d770a)['utcOffset'](0x0,!![])[_0x5f06('0x15')]();_0xb9e5e4=moment(_0xb9e5e4)[_0x5f06('0x2f')](0x0,!![])[_0x5f06('0x14')](0x17,_0x5f06('0x30'))[_0x5f06('0x14')](0x3b,_0x5f06('0x31'))['add'](0x3b,_0x5f06('0x32'))['format']();}_0x2ed9eb={'start':_0x1d770a,'end':_0xb9e5e4};break;default:_0x2ed9eb[_0x5f06('0x2b')]=_0x1d770a;break;}return _0x2ed9eb;} \ No newline at end of file +var _0xf6c5=['\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','length','slice','forEach','split','shift','match','filter','indexOf','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20'];(function(_0x19e80d,_0xb92ab6){var _0x966300=function(_0x4aeaf2){while(--_0x4aeaf2){_0x19e80d['push'](_0x19e80d['shift']());}};_0x966300(++_0xb92ab6);}(_0xf6c5,0xbf));var _0x5f6c=function(_0x4eeb43,_0x3fd58d){_0x4eeb43=_0x4eeb43-0x0;var _0x559af8=_0xf6c5[_0x4eeb43];return _0x559af8;};'use strict';var _=require(_0x5f6c('0x0'));var moment=require(_0x5f6c('0x1'));exports[_0x5f6c('0x2')]=function(_0x398cfc){var _0x3abb35={'conditions':[]};_0x3abb35[_0x5f6c('0x3')]=_[_0x5f6c('0x4')](_0x398cfc,_0x5f6c('0x5'))?'or':_0x5f6c('0x6');var _0x278050=_0x398cfc['replace'](_0x5f6c('0x7'),'')[_0x5f6c('0x8')]('[$or]','')['split']('||');for(var _0x529436=0x0;_0x529436<_0x278050[_0x5f6c('0x9')];_0x529436++){var _0xeacfae=_0x278050[_0x529436]['split'](':=');var _0x1119cc=_0xeacfae[0x0];var _0xb5c9e1=_0xeacfae[_0x5f6c('0xa')](0x1);_0xb5c9e1[_0x5f6c('0xb')](function(_0x39f8b8){var _0x3f25a8=_0x39f8b8[_0x5f6c('0xc')]('[')[_0x5f6c('0xd')]();var _0x448754=_0x39f8b8[_0x5f6c('0xe')](/\[(.*?)\]/g);_0x448754['forEach'](function(_0x119821){var _0x5f4b38=_0x119821['split']('[')[_0x5f6c('0xf')](function(_0x281267){return _0x281267[_0x5f6c('0x10')](']')>-0x1;})['map'](function(_0x52b1c2){return _0x52b1c2['split'](']')[0x0];})[0x0];_0x3abb35['conditions']['push']({'field':_0x1119cc,'operator':_0x3f25a8,'value':_0x5f4b38});});});}return _0x3abb35;};exports[_0x5f6c('0x11')]=function(_0x328d16,_0x354400,_0x17ff74){var _0x273059={};if(_0x354400===_0x5f6c('0x12')){if(_0x17ff74[_0x5f6c('0x13')]===_0x5f6c('0x14')){_0x17ff74[_0x5f6c('0x13')]=_0x5f6c('0x15');_0x17ff74['value']+=','+_0x17ff74[_0x5f6c('0x16')];}else if(_[_0x5f6c('0x17')](['$gt',_0x5f6c('0x18')],_0x17ff74[_0x5f6c('0x13')])){_0x17ff74[_0x5f6c('0x16')]=moment(_0x17ff74['value'])[_0x5f6c('0x19')](0x1,_0x5f6c('0x1a'))[_0x5f6c('0x1b')](_0x5f6c('0x1c'));}}if(_0x17ff74['castTo']){_0x354400=_0x17ff74[_0x5f6c('0x1d')];_0x273059['text']=_0x5f6c('0x1e')+_0x328d16+'.'+_0x17ff74[_0x5f6c('0x1f')]+_0x5f6c('0x20')+_0x17ff74[_0x5f6c('0x1d')]+')\x20'+parseOperator(_0x17ff74[_0x5f6c('0x13')]);}else{_0x273059['text']=_0x328d16+'.'+_0x17ff74[_0x5f6c('0x1f')]+'\x20'+parseOperator(_0x17ff74[_0x5f6c('0x13')]);}if(_[_0x5f6c('0x17')]([_0x5f6c('0x21'),_0x5f6c('0x22')],_0x17ff74[_0x5f6c('0x13')]))_0x273059[_0x5f6c('0x23')]='('+_0x273059[_0x5f6c('0x23')]+_0x5f6c('0x24')+_0x328d16+'.'+_0x17ff74[_0x5f6c('0x1f')]+_0x5f6c('0x25');_0x273059[_0x5f6c('0x16')]=parseValue(_0x354400,_0x17ff74[_0x5f6c('0x13')],_0x17ff74[_0x5f6c('0x16')]);return _0x273059;};function parseOperator(_0xa1523f){var _0x20677a;switch(_0xa1523f){case _0x5f6c('0x26'):_0x20677a=_0x5f6c('0x27');break;case'$notIn':_0x20677a=_0x5f6c('0x28');break;case _0x5f6c('0x14'):_0x20677a='=\x20?';break;case _0x5f6c('0x21'):_0x20677a=_0x5f6c('0x29');break;case _0x5f6c('0x2a'):case'$startsWith':case _0x5f6c('0x2b'):_0x20677a=_0x5f6c('0x2c');break;case _0x5f6c('0x2d'):_0x20677a=_0x5f6c('0x2e');break;case'$gt':_0x20677a=_0x5f6c('0x2f');break;case'$lte':_0x20677a='<=\x20?';break;case _0x5f6c('0x30'):_0x20677a=_0x5f6c('0x31');break;case _0x5f6c('0x15'):_0x20677a=_0x5f6c('0x32');break;}return _0x20677a;}function parseValue(_0x59770d,_0x32d2c3,_0x46e9f9){var _0x10d43f={'start':undefined,'end':undefined};switch(_0x32d2c3){case _0x5f6c('0x26'):case _0x5f6c('0x22'):_0x10d43f['start']=_0x46e9f9[_0x5f6c('0xc')](',');break;case _0x5f6c('0x2a'):_0x10d43f[_0x5f6c('0x33')]='%'+_0x46e9f9+'%';break;case _0x5f6c('0x34'):_0x10d43f[_0x5f6c('0x33')]=_0x46e9f9+'%';break;case _0x5f6c('0x2b'):_0x10d43f[_0x5f6c('0x33')]='%'+_0x46e9f9;break;case'$between':var _0x5ced9a=_0x46e9f9[_0x5f6c('0xc')](',');var _0x46e9f9=_0x5ced9a['shift']();var _0x4d5f1a=_0x5ced9a[_0x5f6c('0x35')]();if(_0x59770d===_0x5f6c('0x12')){_0x46e9f9=moment(_0x46e9f9)['utcOffset'](0x0,!![])[_0x5f6c('0x1b')]();_0x4d5f1a=moment(_0x4d5f1a)['utcOffset'](0x0,!![])[_0x5f6c('0x19')](0x17,_0x5f6c('0x36'))[_0x5f6c('0x19')](0x3b,_0x5f6c('0x37'))[_0x5f6c('0x19')](0x3b,_0x5f6c('0x38'))['format']();}_0x10d43f={'start':_0x46e9f9,'end':_0x4d5f1a};break;default:_0x10d43f[_0x5f6c('0x33')]=_0x46e9f9;break;}return _0x10d43f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 42e42e4..f7ad047 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 _0xdbf5=['includes','split','filters','isEmpty','type','isPlainObject','$gte','utc','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','map','priority','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','intersection','model','attributes','fields','order','sort','where','pick','filter','columns','merge','VIRTUAL','lower','sequelize','parse','keys'];(function(_0x540090,_0x2df1aa){var _0x2c99a7=function(_0x174a0c){while(--_0x174a0c){_0x540090['push'](_0x540090['shift']());}};_0x2c99a7(++_0x2df1aa);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x492f0f,_0x50407a){_0x492f0f=_0x492f0f-0x0;var _0x5b7ed7=_0xdbf5[_0x492f0f];return _0x5b7ed7;};'use strict';var _=require('lodash');var sequelize=require(_0x5dbf('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4bde73){var _0x19d2b4=['ne'];try{var _0xfd972b=JSON[_0x5dbf('0x1')](_0x4bde73);var _0x3afe14=Object[_0x5dbf('0x2')](_0xfd972b)[0x0];return _0x19d2b4[_0x5dbf('0x3')](_0x3afe14);}catch(_0x776036){return![];}}function getOperatorValue(_0x1decd2){var _0x3f8628=JSON[_0x5dbf('0x1')](_0x1decd2);var _0x209b7d=Object[_0x5dbf('0x2')](_0x3f8628)[0x0];var _0x93e657=_0x3f8628[_0x209b7d];return{['$'+_0x209b7d]:_0x93e657};}exports['fields']=function(_0x134810){var _0x501cb1=null;if(_0x134810){_0x501cb1=_0x134810[_0x5dbf('0x4')](',');}return _0x501cb1;};exports[_0x5dbf('0x5')]=function(_0x264007,_0x1813bb){var _0x4efed3={};if(!_[_0x5dbf('0x6')](_0x264007)){_['forOwn'](_0x264007,function(_0x5433f4,_0x1c7389){try{if(_0x1813bb){var _0x5dbc97=_['find'](_0x1813bb,{'name':_0x1c7389})||{};if(hasSequelizeOperator(_0x5433f4)){_0x4efed3[_0x1c7389]=getOperatorValue(_0x5433f4);}else if(_0x5dbc97[_0x5dbf('0x7')]==='DATE'&&_[_0x5dbf('0x8')](_0x5433f4)){var _0x2bb7ed=JSON[_0x5dbf('0x1')](_0x5433f4);var _0x7cb848={'$gte':moment(moment(_0x2bb7ed[_0x5dbf('0x9')])['format']('YYYY-MM-DD'))[_0x5dbf('0xa')]()[_0x5dbf('0xb')](),'$lte':moment(moment(_0x2bb7ed['$lte'])[_0x5dbf('0xb')](_0x5dbf('0xc')))[_0x5dbf('0xa')]()[_0x5dbf('0xd')](0x1,'s')[_0x5dbf('0xb')]()};_0x4efed3[_0x1c7389]=_0x7cb848;}else if(_0x5dbc97[_0x5dbf('0xe')]===_0x5dbf('0xf')){_0x4efed3[_0x1c7389]=_0x5433f4;}else{_0x4efed3[_0x1c7389]=_['isArray'](_0x5433f4)?_0x5433f4:JSON['parse'](_0x5433f4);}}else{_0x4efed3[_0x1c7389]=_[_0x5dbf('0x10')](_0x5433f4)?_0x5433f4:JSON[_0x5dbf('0x1')](_0x5433f4);}}catch(_0x39c7aa){_0x4efed3[_0x1c7389]=_0x5433f4[_0x5dbf('0x4')](',');}});}return _0x4efed3;};exports[_0x5dbf('0x11')]=function(_0x5ce68e){_0x5ce68e=parseInt(_0x5ce68e,0xa);if(!_0x5ce68e||_0x5ce68e<0x0){_0x5ce68e=LIMIT_VALUE;}return _0x5ce68e;};exports[_0x5dbf('0x12')]=function(_0x4dd03c){_0x4dd03c=parseInt(_0x4dd03c,0xa);if(!_0x4dd03c||_0x4dd03c<0x0){_0x4dd03c=0x0;}return _0x4dd03c;};exports['sort']=function(_0x577ca2){var _0x23d1e7,_0x3cedac=null;if(_0x577ca2){_0x23d1e7=_0x577ca2[_0x5dbf('0x4')](',');_0x3cedac=_[_0x5dbf('0x13')](_0x23d1e7,function(_0x1e3cce){if(_0x1e3cce['indexOf']('-')===0x0){return[_0x1e3cce===_0x5dbf('0x14')?sequelize['cast'](sequelize[_0x5dbf('0x15')](_0x5dbf('0x14')),_0x5dbf('0x16')):_0x1e3cce[_0x5dbf('0x17')](0x1),_0x5dbf('0x18')];}else{return[_0x1e3cce===_0x5dbf('0x14')?sequelize['cast'](sequelize[_0x5dbf('0x15')](_0x5dbf('0x14')),_0x5dbf('0x16')):_0x1e3cce,_0x5dbf('0x19')];}});}return _0x3cedac;};exports[_0x5dbf('0x1a')]=function(_0x226b93,_0x290456){if(_[_0x5dbf('0x6')](_0x226b93)){return _0x226b93;}if(_[_0x5dbf('0x10')](_0x226b93)){for(var _0x15a790=0x0;_0x15a790<_0x226b93[_0x5dbf('0x1b')];_0x15a790+=0x1){_0x226b93[_0x15a790]=this[_0x5dbf('0x1a')](_0x226b93[_0x15a790],_0x290456);}return _0x226b93;}if(!_[_0x5dbf('0x1c')](_0x226b93)){return _0x226b93;}if(_[_0x5dbf('0x1d')](_0x290456)){_0x290456=[_0x290456];}if(!_[_0x5dbf('0x10')](_0x290456)){return _0x226b93;}for(var _0x17f135=0x0;_0x17f135<_0x290456[_0x5dbf('0x1b')];_0x17f135+=0x1){_[_0x5dbf('0x1e')](_0x226b93,_0x290456[_0x17f135]);}for(var _0x159e61 in _0x226b93){if(_0x226b93[_0x5dbf('0x1f')](_0x159e61)){_0x226b93[_0x159e61]=this[_0x5dbf('0x1a')](_0x226b93[_0x159e61],_0x290456);}}return _0x226b93;};exports[_0x5dbf('0x20')]=function(_0x21cd00){return _0x21cd00['match'](RegExp(_0x5dbf('0x21')))?!![]:![];};exports[_0x5dbf('0x22')]=function(_0xc4748){return _0xc4748[_0x5dbf('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x5dbf('0x24')]=function(_0x6a276d){var _0x2a65c5=[];_0x6a276d[_0x5dbf('0x4')](/[ ,]+/)[_0x5dbf('0x25')](function(_0x273b63){_0x273b63=_0x273b63[_0x5dbf('0x26')](/([^:]")"+/g,'$1');_0x273b63='+'+_0x273b63+'*';var _0x50a307=/[ `!@#$%^&*()_\-?~]/;if(_0x273b63['match'](_0x50a307))_0x273b63='\x22'+_0x273b63+'\x22';_0x2a65c5[_0x5dbf('0x27')](_0x273b63);});return _0x2a65c5[_0x5dbf('0x28')]('\x20');};exports[_0x5dbf('0x29')]=function(_0x3b73ad,_0x37cf25,_0x4d9faa){var _0x5cc3f1={},_0x1f7527={};if(_0x37cf25[_0x5dbf('0x2a')]['$id']){_0x37cf25[_0x5dbf('0x2a')]['id']=_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x2b')];delete _0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x2b')];}_0x5cc3f1['model']=_[_0x5dbf('0x13')](_0x3b73ad,_0x5dbf('0xe'));_0x5cc3f1[_0x5dbf('0x2a')]=_[_0x5dbf('0x2')](_0x37cf25[_0x5dbf('0x2a')]);_0x5cc3f1['filters']=_[_0x5dbf('0x2c')](_0x5cc3f1[_0x5dbf('0x2d')],_0x5cc3f1[_0x5dbf('0x2a')]);_0x1f7527[_0x5dbf('0x2e')]=_['intersection'](_0x5cc3f1[_0x5dbf('0x2d')],this[_0x5dbf('0x2f')](_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x2f')]));_0x1f7527[_0x5dbf('0x2e')]=_0x1f7527[_0x5dbf('0x2e')][_0x5dbf('0x1b')]?_0x1f7527[_0x5dbf('0x2e')]:_0x5cc3f1[_0x5dbf('0x2d')];if(!_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x1f')]('nolimit')){_0x1f7527[_0x5dbf('0x11')]=this[_0x5dbf('0x11')](_0x37cf25[_0x5dbf('0x2a')]['limit']);_0x1f7527[_0x5dbf('0x12')]=this[_0x5dbf('0x12')](_0x37cf25[_0x5dbf('0x2a')]['offset']);}_0x1f7527[_0x5dbf('0x30')]=this[_0x5dbf('0x31')](_0x37cf25[_0x5dbf('0x2a')]['sort']);_0x1f7527[_0x5dbf('0x32')]=this[_0x5dbf('0x5')](_[_0x5dbf('0x33')](_0x37cf25[_0x5dbf('0x2a')],_0x5cc3f1[_0x5dbf('0x5')]),_0x3b73ad);if(_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x34')]){var _0x2ed355=_0x3b73ad;var _0x4b71c1=_0x37cf25['query']['filter'];if(typeof _0x4b71c1==='object'){_0x2ed355=_[_0x5dbf('0x34')](_0x3b73ad,function(_0x21122d){return _['includes'](_0x4b71c1[_0x5dbf('0x35')],_0x21122d[_0x5dbf('0xe')]);});_0x4b71c1=_0x4b71c1['value'];}_0x1f7527[_0x5dbf('0x32')]=_[_0x5dbf('0x36')](_0x1f7527[_0x5dbf('0x32')],{'$or':_[_0x5dbf('0x13')](_0x2ed355,function(_0x21ae10){if(_0x21ae10[_0x5dbf('0x7')]!==_0x5dbf('0x37')){if(_0x4d9faa){return sequelize[_0x5dbf('0x32')](sequelize['fn'](_0x5dbf('0x38'),sequelize[_0x5dbf('0x15')](_0x21ae10['name'])),{'$like':sequelize['fn'](_0x5dbf('0x38'),'%'+_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x34')]+'%')});}else{var _0x50880d={};_0x50880d[_0x21ae10[_0x5dbf('0xe')]]={'$like':'%'+_0x37cf25[_0x5dbf('0x2a')][_0x5dbf('0x34')]+'%'};return _0x50880d;}}})});}_0x1f7527=_[_0x5dbf('0x36')]({},_0x1f7527,_0x37cf25['options']);return _0x1f7527;}; \ No newline at end of file +var _0xf873=['forOwn','find','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','offset','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','query','$id','name','filters','intersection','model','attributes','nolimit','order','where','filter','object','value','merge','map','VIRTUAL','lower','options','sequelize','moment','parse','keys','includes','fields','split','isEmpty'];(function(_0x45d608,_0x3def2e){var _0x537086=function(_0x33c418){while(--_0x33c418){_0x45d608['push'](_0x45d608['shift']());}};_0x537086(++_0x3def2e);}(_0xf873,0xb2));var _0x3f87=function(_0x4f14c2,_0x4e202f){_0x4f14c2=_0x4f14c2-0x0;var _0x29df21=_0xf873[_0x4f14c2];return _0x29df21;};'use strict';var _=require('lodash');var sequelize=require(_0x3f87('0x0'));var moment=require(_0x3f87('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x311101){var _0x3ef688=['ne'];try{var _0x1c56a3=JSON[_0x3f87('0x2')](_0x311101);var _0x2fbb4f=Object[_0x3f87('0x3')](_0x1c56a3)[0x0];return _0x3ef688[_0x3f87('0x4')](_0x2fbb4f);}catch(_0x4a909e){return![];}}function getOperatorValue(_0x2e2177){var _0x43c8e4=JSON[_0x3f87('0x2')](_0x2e2177);var _0x5a5e37=Object[_0x3f87('0x3')](_0x43c8e4)[0x0];var _0x2c7ccc=_0x43c8e4[_0x5a5e37];return{['$'+_0x5a5e37]:_0x2c7ccc};}exports[_0x3f87('0x5')]=function(_0x41faf2){var _0xd9391d=null;if(_0x41faf2){_0xd9391d=_0x41faf2[_0x3f87('0x6')](',');}return _0xd9391d;};exports['filters']=function(_0x1405ca,_0x435ca8){var _0x32e236={};if(!_[_0x3f87('0x7')](_0x1405ca)){_[_0x3f87('0x8')](_0x1405ca,function(_0xd41ca0,_0x2aa592){try{if(_0x435ca8){var _0x2b7ca0=_[_0x3f87('0x9')](_0x435ca8,{'name':_0x2aa592})||{};if(hasSequelizeOperator(_0xd41ca0)){_0x32e236[_0x2aa592]=getOperatorValue(_0xd41ca0);}else if(_0x2b7ca0[_0x3f87('0xa')]===_0x3f87('0xb')&&_[_0x3f87('0xc')](_0xd41ca0)){var _0xfd5b65=JSON[_0x3f87('0x2')](_0xd41ca0);var _0x5aff02={'$gte':moment(moment(_0xfd5b65[_0x3f87('0xd')])[_0x3f87('0xe')]('YYYY-MM-DD'))[_0x3f87('0xf')]()[_0x3f87('0xe')](),'$lte':moment(moment(_0xfd5b65[_0x3f87('0x10')])[_0x3f87('0xe')](_0x3f87('0x11')))[_0x3f87('0xf')]()[_0x3f87('0x12')](0x1,'s')[_0x3f87('0xe')]()};_0x32e236[_0x2aa592]=_0x5aff02;}else if(_0x2b7ca0['name']===_0x3f87('0x13')){_0x32e236[_0x2aa592]=_0xd41ca0;}else{_0x32e236[_0x2aa592]=_[_0x3f87('0x14')](_0xd41ca0)?_0xd41ca0:JSON[_0x3f87('0x2')](_0xd41ca0);}}else{_0x32e236[_0x2aa592]=_['isArray'](_0xd41ca0)?_0xd41ca0:JSON[_0x3f87('0x2')](_0xd41ca0);}}catch(_0x56d79e){_0x32e236[_0x2aa592]=_0xd41ca0[_0x3f87('0x6')](',');}});}return _0x32e236;};exports[_0x3f87('0x15')]=function(_0x285b2c){_0x285b2c=parseInt(_0x285b2c,0xa);if(!_0x285b2c||_0x285b2c<0x0){_0x285b2c=LIMIT_VALUE;}return _0x285b2c;};exports[_0x3f87('0x16')]=function(_0x3678bc){_0x3678bc=parseInt(_0x3678bc,0xa);if(!_0x3678bc||_0x3678bc<0x0){_0x3678bc=0x0;}return _0x3678bc;};exports['sort']=function(_0x12df6e){var _0x2372d3,_0x996eb8=null;if(_0x12df6e){_0x2372d3=_0x12df6e[_0x3f87('0x6')](',');_0x996eb8=_['map'](_0x2372d3,function(_0x4acd30){if(_0x4acd30['indexOf']('-')===0x0){return[_0x4acd30===_0x3f87('0x17')?sequelize[_0x3f87('0x18')](sequelize[_0x3f87('0x19')]('priority'),_0x3f87('0x1a')):_0x4acd30[_0x3f87('0x1b')](0x1),_0x3f87('0x1c')];}else{return[_0x4acd30===_0x3f87('0x17')?sequelize[_0x3f87('0x18')](sequelize[_0x3f87('0x19')](_0x3f87('0x17')),_0x3f87('0x1a')):_0x4acd30,_0x3f87('0x1d')];}});}return _0x996eb8;};exports[_0x3f87('0x1e')]=function(_0x5df86b,_0x37b8b9){if(_['isEmpty'](_0x5df86b)){return _0x5df86b;}if(_[_0x3f87('0x14')](_0x5df86b)){for(var _0x9ed827=0x0;_0x9ed827<_0x5df86b[_0x3f87('0x1f')];_0x9ed827+=0x1){_0x5df86b[_0x9ed827]=this['omit'](_0x5df86b[_0x9ed827],_0x37b8b9);}return _0x5df86b;}if(!_['isObject'](_0x5df86b)){return _0x5df86b;}if(_[_0x3f87('0x20')](_0x37b8b9)){_0x37b8b9=[_0x37b8b9];}if(!_[_0x3f87('0x14')](_0x37b8b9)){return _0x5df86b;}for(var _0x18df70=0x0;_0x18df70<_0x37b8b9[_0x3f87('0x1f')];_0x18df70+=0x1){_[_0x3f87('0x21')](_0x5df86b,_0x37b8b9[_0x18df70]);}for(var _0x148d8e in _0x5df86b){if(_0x5df86b[_0x3f87('0x22')](_0x148d8e)){_0x5df86b[_0x148d8e]=this[_0x3f87('0x1e')](_0x5df86b[_0x148d8e],_0x37b8b9);}}return _0x5df86b;};exports[_0x3f87('0x23')]=function(_0x2e18cb){return _0x2e18cb[_0x3f87('0x24')](RegExp(_0x3f87('0x25')))?!![]:![];};exports[_0x3f87('0x26')]=function(_0x241d88){return _0x241d88[_0x3f87('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x3f87('0x27')]=function(_0x5d6fc2){var _0x150dbb=[];_0x5d6fc2[_0x3f87('0x6')](/[ ,]+/)[_0x3f87('0x28')](function(_0x2f0f05){_0x2f0f05=_0x2f0f05['replace'](/([^:]")"+/g,'$1');_0x2f0f05='+'+_0x2f0f05+'*';var _0x5c6082=/[ `!@#$%^&*()_\-?~]/;if(_0x2f0f05['match'](_0x5c6082))_0x2f0f05='\x22'+_0x2f0f05+'\x22';_0x150dbb[_0x3f87('0x29')](_0x2f0f05);});return _0x150dbb[_0x3f87('0x2a')]('\x20');};exports[_0x3f87('0x2b')]=function(_0x1d731a,_0x25e332,_0x5e4570){var _0x2d2d4c={},_0x50449c={};if(_0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')]){_0x25e332[_0x3f87('0x2c')]['id']=_0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')];delete _0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')];}_0x2d2d4c['model']=_['map'](_0x1d731a,_0x3f87('0x2e'));_0x2d2d4c[_0x3f87('0x2c')]=_[_0x3f87('0x3')](_0x25e332[_0x3f87('0x2c')]);_0x2d2d4c[_0x3f87('0x2f')]=_[_0x3f87('0x30')](_0x2d2d4c[_0x3f87('0x31')],_0x2d2d4c['query']);_0x50449c[_0x3f87('0x32')]=_['intersection'](_0x2d2d4c[_0x3f87('0x31')],this[_0x3f87('0x5')](_0x25e332[_0x3f87('0x2c')][_0x3f87('0x5')]));_0x50449c['attributes']=_0x50449c[_0x3f87('0x32')]['length']?_0x50449c[_0x3f87('0x32')]:_0x2d2d4c[_0x3f87('0x31')];if(!_0x25e332[_0x3f87('0x2c')][_0x3f87('0x22')](_0x3f87('0x33'))){_0x50449c['limit']=this['limit'](_0x25e332['query'][_0x3f87('0x15')]);_0x50449c[_0x3f87('0x16')]=this[_0x3f87('0x16')](_0x25e332[_0x3f87('0x2c')][_0x3f87('0x16')]);}_0x50449c[_0x3f87('0x34')]=this['sort'](_0x25e332[_0x3f87('0x2c')]['sort']);_0x50449c[_0x3f87('0x35')]=this[_0x3f87('0x2f')](_['pick'](_0x25e332[_0x3f87('0x2c')],_0x2d2d4c[_0x3f87('0x2f')]),_0x1d731a);if(_0x25e332[_0x3f87('0x2c')]['filter']){var _0x246976=_0x1d731a;var _0x588915=_0x25e332['query'][_0x3f87('0x36')];if(typeof _0x588915===_0x3f87('0x37')){_0x246976=_[_0x3f87('0x36')](_0x1d731a,function(_0x13a662){return _[_0x3f87('0x4')](_0x588915['columns'],_0x13a662[_0x3f87('0x2e')]);});_0x588915=_0x588915[_0x3f87('0x38')];}_0x50449c[_0x3f87('0x35')]=_[_0x3f87('0x39')](_0x50449c['where'],{'$or':_[_0x3f87('0x3a')](_0x246976,function(_0x458c79){if(_0x458c79[_0x3f87('0xa')]!==_0x3f87('0x3b')){if(_0x5e4570){return sequelize[_0x3f87('0x35')](sequelize['fn'](_0x3f87('0x3c'),sequelize[_0x3f87('0x19')](_0x458c79[_0x3f87('0x2e')])),{'$like':sequelize['fn']('lower','%'+_0x25e332['query'][_0x3f87('0x36')]+'%')});}else{var _0x2a234={};_0x2a234[_0x458c79[_0x3f87('0x2e')]]={'$like':'%'+_0x25e332[_0x3f87('0x2c')][_0x3f87('0x36')]+'%'};return _0x2a234;}}})});}_0x50449c=_[_0x3f87('0x39')]({},_0x50449c,_0x25e332[_0x3f87('0x3d')]);return _0x50449c;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 875d926..f0d165e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0xffc0df,_0x28ac48){var _0x22f4a8=function(_0x2ab137){while(--_0x2ab137){_0xffc0df['push'](_0xffc0df['shift']());}};_0x22f4a8(++_0x28ac48);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 9bc6e17..bc8e7b8 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 _0x47a9=['createHash','substring','lodash','crypto','bimedia-machine-uuid','execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','join','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress'];(function(_0x3ed0d5,_0x5f0e1f){var _0x5e4563=function(_0x1517ea){while(--_0x1517ea){_0x3ed0d5['push'](_0x3ed0d5['shift']());}};_0x5e4563(++_0x5f0e1f);}(_0x47a9,0x65));var _0x947a=function(_0x18dde0,_0x8192a){_0x18dde0=_0x18dde0-0x0;var _0x186b23=_0x47a9[_0x18dde0];return _0x186b23;};'use strict';var _=require(_0x947a('0x0'));var os=require('os');var crypto=require(_0x947a('0x1'));var machine=require(_0x947a('0x2'));var exec=require('child_process')[_0x947a('0x3')];var config=require('../environment');function getInterfaces(){var _0x493e3c=[];var _0x3260bb=os[_0x947a('0x4')]();var _0x15bec4=_['orderBy'](_[_0x947a('0x5')](_0x3260bb));for(var _0x26287a=0x0;_0x26287a<_0x15bec4[_0x947a('0x6')];_0x26287a++){var _0x2b50d2=_0x3260bb[_0x15bec4[_0x26287a]][_0x947a('0x7')](function(_0x1decf7){return _0x1decf7[_0x947a('0x8')]===_0x947a('0x9')&&_0x1decf7[_0x947a('0xa')]===![];});_0x493e3c=_0x493e3c[_0x947a('0xb')](_0x2b50d2);}return _0x493e3c;}function getFirstInterface(){var _0x2e05ba=_[_0x947a('0xc')](getInterfaces());return{'macAddress':_0x2e05ba&&_0x2e05ba[_0x947a('0xd')]?_0x2e05ba['mac']:_0x947a('0xe'),'ipAddress':_0x2e05ba&&_0x2e05ba[_0x947a('0xf')]?_0x2e05ba[_0x947a('0xf')]:'127.0.0.1'};}exports[_0x947a('0x10')]=getFirstInterface;function getCPUhash(){var _0x5a9573=_['orderBy'](os['cpus']()[_0x947a('0x11')](function(_0x1166e3){return _0x1166e3['model'];}))[_0x947a('0x12')](':');return crypto['createHash'](_0x947a('0x13'))[_0x947a('0x14')](_0x5a9573)[_0x947a('0x15')](_0x947a('0x16'));}exports[_0x947a('0x17')]=function(){var _0x1c2d1e=os[_0x947a('0x18')]();var _0x3df35b=/[0-9a-f-]{36}/;if(config[_0x947a('0x19')]&&_0x3df35b['test'](config['licenseToken'])){return config[_0x947a('0x19')];}else if(_0x1c2d1e===_0x947a('0x1a')){return exec(_0x947a('0x1b'),{'encoding':_0x947a('0x1c')})[_0x947a('0x1d')]('\x0d\x0a','');}else{var _0x525b16=getFirstInterface();var _0x587989=getCPUhash();var _0x462899=_0x587989+'|'+os['hostname']()+'|'+_0x525b16['macAddress']+'|'+_0x525b16[_0x947a('0x1e')];var _0x4b50b8=crypto[_0x947a('0x1f')](_0x947a('0x13'))['update'](_0x462899)[_0x947a('0x15')](_0x947a('0x16'));return _0x4b50b8[_0x947a('0x20')](0x0,0x8)+'-'+_0x4b50b8['substring'](0x8,0xc)+'-'+_0x4b50b8[_0x947a('0x20')](0xc,0x10)+'-'+_0x4b50b8[_0x947a('0x20')](0x10,0x14)+'-'+_0x4b50b8[_0x947a('0x20')](0x14);}}; \ No newline at end of file +var _0x9509=['getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','IPv4','internal','concat','head','mac','address','127.0.0.1','cpus','model','join','createHash','md5','update','digest','hex'];(function(_0x24db30,_0x339d7b){var _0x39ad34=function(_0x2c0692){while(--_0x2c0692){_0x24db30['push'](_0x24db30['shift']());}};_0x39ad34(++_0x339d7b);}(_0x9509,0x1bb));var _0x9950=function(_0x3074b4,_0x24c33c){_0x3074b4=_0x3074b4-0x0;var _0x161374=_0x9509[_0x3074b4];return _0x161374;};'use strict';var _=require(_0x9950('0x0'));var os=require('os');var crypto=require(_0x9950('0x1'));var machine=require(_0x9950('0x2'));var exec=require(_0x9950('0x3'))[_0x9950('0x4')];var config=require(_0x9950('0x5'));function getInterfaces(){var _0x1a1824=[];var _0x1c1497=os[_0x9950('0x6')]();var _0x1efa77=_[_0x9950('0x7')](_['keys'](_0x1c1497));for(var _0x2650a2=0x0;_0x2650a2<_0x1efa77[_0x9950('0x8')];_0x2650a2++){var _0x24e38a=_0x1c1497[_0x1efa77[_0x2650a2]][_0x9950('0x9')](function(_0x1a4822){return _0x1a4822['family']===_0x9950('0xa')&&_0x1a4822[_0x9950('0xb')]===![];});_0x1a1824=_0x1a1824[_0x9950('0xc')](_0x24e38a);}return _0x1a1824;}function getFirstInterface(){var _0x3a5ada=_[_0x9950('0xd')](getInterfaces());return{'macAddress':_0x3a5ada&&_0x3a5ada[_0x9950('0xe')]?_0x3a5ada[_0x9950('0xe')]:'00:00:00:00:00:00','ipAddress':_0x3a5ada&&_0x3a5ada['address']?_0x3a5ada[_0x9950('0xf')]:_0x9950('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x270a91=_[_0x9950('0x7')](os[_0x9950('0x11')]()['map'](function(_0x5c64ed){return _0x5c64ed[_0x9950('0x12')];}))[_0x9950('0x13')](':');return crypto[_0x9950('0x14')](_0x9950('0x15'))[_0x9950('0x16')](_0x270a91)[_0x9950('0x17')](_0x9950('0x18'));}exports[_0x9950('0x19')]=function(){var _0x3ca69f=os[_0x9950('0x1a')]();var _0x5d744a=/[0-9a-f-]{36}/;if(config[_0x9950('0x1b')]&&_0x5d744a[_0x9950('0x1c')](config[_0x9950('0x1b')])){return config['licenseToken'];}else if(_0x3ca69f===_0x9950('0x1d')){return exec(_0x9950('0x1e'),{'encoding':_0x9950('0x1f')})[_0x9950('0x20')]('\x0d\x0a','');}else{var _0x3881d7=getFirstInterface();var _0x3b417f=getCPUhash();var _0x12930f=_0x3b417f+'|'+os[_0x9950('0x21')]()+'|'+_0x3881d7['macAddress']+'|'+_0x3881d7[_0x9950('0x22')];var _0x4707d3=crypto[_0x9950('0x14')](_0x9950('0x15'))[_0x9950('0x16')](_0x12930f)['digest'](_0x9950('0x18'));return _0x4707d3[_0x9950('0x23')](0x0,0x8)+'-'+_0x4707d3[_0x9950('0x23')](0x8,0xc)+'-'+_0x4707d3[_0x9950('0x23')](0xc,0x10)+'-'+_0x4707d3[_0x9950('0x23')](0x10,0x14)+'-'+_0x4707d3[_0x9950('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4079f16..94ff42d 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 _0xec40=['moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','get','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util'];(function(_0x306296,_0x2f55b9){var _0xbd29dd=function(_0x348a72){while(--_0x348a72){_0x306296['push'](_0x306296['shift']());}};_0xbd29dd(++_0x2f55b9);}(_0xec40,0x170));var _0x0ec4=function(_0x58df3b,_0x182132){_0x58df3b=_0x58df3b-0x0;var _0x1c82d6=_0xec40[_0x58df3b];return _0x1c82d6;};'use strict';var util=require(_0x0ec4('0x0'));var moment=require(_0x0ec4('0x1'));var rp=require(_0x0ec4('0x2'));var BPromise=require(_0x0ec4('0x3'));var pkginfo=require('pkginfo')(module,_0x0ec4('0x4'));var db=require(_0x0ec4('0x5'))['db'];var encryptor=require(_0x0ec4('0x6'));var hardware=require(_0x0ec4('0x7'));var logger=require(_0x0ec4('0x8'))(_0x0ec4('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x14972d){return new BPromise(function(_0x5b1805,_0xdf40a){var _0x4123c8=util[_0x0ec4('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x14972d,module['exports'][_0x0ec4('0x4')]);if(oldToken){_0x4123c8=util[_0x0ec4('0xa')](_0x0ec4('0xb'),HOST,_0x14972d,module[_0x0ec4('0xc')][_0x0ec4('0x4')],oldToken);}var _0x3586d6={'uri':_0x4123c8,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3586d6)[_0x0ec4('0xd')](function(_0x186ea7){_0x5b1805(_0x186ea7);})['catch'](function(_0x51f208){_0xdf40a(_0x51f208);});});}function manageLicense(_0x468746,_0x2a2c40){var _0x493b33=_0x2a2c40[_0x0ec4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x493b33[_0x0ec4('0xf')]!==_0x468746&&!_0x493b33['data2']){oldToken=_0x493b33[_0x0ec4('0xf')];}httpRequest(_0x468746)[_0x0ec4('0xd')](function(_0x4a9ae5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4a9ae5[_0x0ec4('0x10')]){isOldTokenSent=![];if(!_0x493b33[_0x0ec4('0x9')]&&_0x493b33['license']!=_0x4a9ae5[_0x0ec4('0x9')]||_0x493b33[_0x0ec4('0x9')]&&_0x493b33['data2']){logger['info'](_0x0ec4('0x11'));}if(_0x493b33[_0x0ec4('0x9')]&&!_0x493b33[_0x0ec4('0x12')]&&_0x493b33[_0x0ec4('0x9')]!=_0x4a9ae5['license']){logger[_0x0ec4('0x13')](_0x0ec4('0x14'));}if(_0x493b33[_0x0ec4('0x9')]&&!_0x493b33[_0x0ec4('0x12')]&&_0x493b33[_0x0ec4('0x9')]==_0x4a9ae5[_0x0ec4('0x9')]){return _0x2a2c40;}return _0x2a2c40[_0x0ec4('0x15')]({'data1':_0x468746,'data2':null,'license':_0x4a9ae5[_0x0ec4('0x9')]});}else{if(_0x4a9ae5[_0x0ec4('0x9')]||_0x493b33[_0x0ec4('0x9')]){if(!_0x493b33[_0x0ec4('0x12')]){if(_0x493b33[_0x0ec4('0xf')]==_0x468746){GRAY_PERIOD_REASON=_0x0ec4('0x16');logger[_0x0ec4('0x13')](_0x0ec4('0x17'));}else{GRAY_PERIOD_REASON=_0x0ec4('0x18');logger[_0x0ec4('0x13')](_0x0ec4('0x19'),_0x493b33[_0x0ec4('0xf')],_0x468746);}logger[_0x0ec4('0x13')](_0x0ec4('0x1a'),GRAY_PERIOD_REASON[_0x0ec4('0x1b')](),moment()[_0x0ec4('0xa')](_0x0ec4('0x1c')));return _0x2a2c40[_0x0ec4('0x15')]({'data2':encryptor['encryptString'](moment()[_0x0ec4('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x0ec4('0x1d')](encryptor['decryptString'](_0x493b33['data2']),_0x0ec4('0x1e'))>DAYS){logger[_0x0ec4('0x13')](_0x0ec4('0x1f'),moment()[_0x0ec4('0xa')](_0x0ec4('0x1c')));isOldTokenSent=![];return _0x2a2c40[_0x0ec4('0x15')]({'data1':_0x468746,'data2':null,'license':null});}}}else{if(_0x493b33[_0x0ec4('0xf')]!=_0x468746){logger[_0x0ec4('0x13')](_0x0ec4('0x19'),_0x493b33[_0x0ec4('0xf')],_0x468746);return _0x2a2c40[_0x0ec4('0x15')]({'data1':_0x468746,'data2':null,'license':null});}}}return _0x2a2c40;})[_0x0ec4('0xd')](function(_0x109733){_0x2a2c40=_0x109733;})[_0x0ec4('0x20')](function(_0x4942bf){logger[_0x0ec4('0x21')](_0x4942bf[_0x0ec4('0x22')]);})[_0x0ec4('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x0ec4('0x24')](),_0x2a2c40);},TIME);});}function defaultLicense(){var _0xab98a=hardware[_0x0ec4('0x24')]();if(_0xab98a){return db['License'][_0x0ec4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xab98a}})[_0x0ec4('0x26')](function(_0x567a04,_0x29b5e7){logger[_0x0ec4('0x13')](_0x0ec4('0x27'),_0xab98a);manageLicense(_0xab98a,_0x567a04);})[_0x0ec4('0x20')](function(_0x5421e7){logger[_0x0ec4('0x21')](_0x5421e7[_0x0ec4('0x22')]);});}}exports[_0x0ec4('0x28')]=defaultLicense; \ No newline at end of file +var _0xcf1a=['format','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x42e2c4,_0x22356d){var _0x100bc5=function(_0x1a0e3b){while(--_0x1a0e3b){_0x42e2c4['push'](_0x42e2c4['shift']());}};_0x100bc5(++_0x22356d);}(_0xcf1a,0x1ed));var _0xacf1=function(_0x4bb7a5,_0x3fec8b){_0x4bb7a5=_0x4bb7a5-0x0;var _0x4075f5=_0xcf1a[_0x4bb7a5];return _0x4075f5;};'use strict';var util=require(_0xacf1('0x0'));var moment=require(_0xacf1('0x1'));var rp=require(_0xacf1('0x2'));var BPromise=require(_0xacf1('0x3'));var pkginfo=require(_0xacf1('0x4'))(module,_0xacf1('0x5'));var db=require(_0xacf1('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xacf1('0x7'));var logger=require(_0xacf1('0x8'))(_0xacf1('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x6c9453){return new BPromise(function(_0x2f4363,_0x55c368){var _0x5a4fb3=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x6c9453,module['exports'][_0xacf1('0x5')]);if(oldToken){_0x5a4fb3=util['format'](_0xacf1('0xa'),HOST,_0x6c9453,module[_0xacf1('0xb')][_0xacf1('0x5')],oldToken);}var _0x42c0f0={'uri':_0x5a4fb3,'method':_0xacf1('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x42c0f0)[_0xacf1('0xd')](function(_0x31ef59){_0x2f4363(_0x31ef59);})['catch'](function(_0x3b150b){_0x55c368(_0x3b150b);});});}function manageLicense(_0x59d95f,_0x444b0a){var _0x3facd4=_0x444b0a['get']({'plain':!![]});if(!isOldTokenSent&&_0x3facd4[_0xacf1('0xe')]!==_0x59d95f&&!_0x3facd4[_0xacf1('0xf')]){oldToken=_0x3facd4['data1'];}httpRequest(_0x59d95f)[_0xacf1('0xd')](function(_0x10292c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x10292c[_0xacf1('0x10')]){isOldTokenSent=![];if(!_0x3facd4[_0xacf1('0x9')]&&_0x3facd4[_0xacf1('0x9')]!=_0x10292c[_0xacf1('0x9')]||_0x3facd4[_0xacf1('0x9')]&&_0x3facd4['data2']){logger[_0xacf1('0x11')](_0xacf1('0x12'));}if(_0x3facd4['license']&&!_0x3facd4[_0xacf1('0xf')]&&_0x3facd4[_0xacf1('0x9')]!=_0x10292c['license']){logger[_0xacf1('0x11')](_0xacf1('0x13'));}if(_0x3facd4[_0xacf1('0x9')]&&!_0x3facd4[_0xacf1('0xf')]&&_0x3facd4[_0xacf1('0x9')]==_0x10292c['license']){return _0x444b0a;}return _0x444b0a[_0xacf1('0x14')]({'data1':_0x59d95f,'data2':null,'license':_0x10292c[_0xacf1('0x9')]});}else{if(_0x10292c[_0xacf1('0x9')]||_0x3facd4[_0xacf1('0x9')]){if(!_0x3facd4[_0xacf1('0xf')]){if(_0x3facd4[_0xacf1('0xe')]==_0x59d95f){GRAY_PERIOD_REASON=_0xacf1('0x15');logger[_0xacf1('0x11')](_0xacf1('0x16'));}else{GRAY_PERIOD_REASON=_0xacf1('0x17');logger[_0xacf1('0x11')](_0xacf1('0x18'),_0x3facd4[_0xacf1('0xe')],_0x59d95f);}logger[_0xacf1('0x11')](_0xacf1('0x19'),GRAY_PERIOD_REASON[_0xacf1('0x1a')](),moment()[_0xacf1('0x1b')](_0xacf1('0x1c')));return _0x444b0a[_0xacf1('0x14')]({'data2':encryptor['encryptString'](moment()[_0xacf1('0x1b')](_0xacf1('0x1c')))});}else{if(moment()['diff'](encryptor[_0xacf1('0x1d')](_0x3facd4[_0xacf1('0xf')]),_0xacf1('0x1e'))>DAYS){logger['info'](_0xacf1('0x1f'),moment()[_0xacf1('0x1b')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x444b0a[_0xacf1('0x14')]({'data1':_0x59d95f,'data2':null,'license':null});}}}else{if(_0x3facd4[_0xacf1('0xe')]!=_0x59d95f){logger[_0xacf1('0x11')](_0xacf1('0x18'),_0x3facd4[_0xacf1('0xe')],_0x59d95f);return _0x444b0a[_0xacf1('0x14')]({'data1':_0x59d95f,'data2':null,'license':null});}}}return _0x444b0a;})[_0xacf1('0xd')](function(_0x3f1977){_0x444b0a=_0x3f1977;})[_0xacf1('0x20')](function(_0x187c2d){logger['error'](_0x187c2d[_0xacf1('0x21')]);})[_0xacf1('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xacf1('0x23')](),_0x444b0a);},TIME);});}function defaultLicense(){var _0x2df9db=hardware[_0xacf1('0x23')]();if(_0x2df9db){return db['License'][_0xacf1('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x2df9db}})['spread'](function(_0x5adfa4,_0x2c3aa6){logger['info'](_0xacf1('0x25'),_0x2df9db);manageLicense(_0x2df9db,_0x5adfa4);})[_0xacf1('0x20')](function(_0x29e263){logger[_0xacf1('0x26')](_0x29e263[_0xacf1('0x21')]);});}}exports[_0xacf1('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3941f5a..d84ec31 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 _0x79db=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','changed','disabled','data1','message','User','findAll','role','sequelize','COUNT','col','admin','telephone','users','forEach','count','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid'];(function(_0x519eb5,_0xb3046e){var _0x5d65d6=function(_0x19fee7){while(--_0x19fee7){_0x519eb5['push'](_0x519eb5['shift']());}};_0x5d65d6(++_0xb3046e);}(_0x79db,0x10b));var _0xb79d=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0x79db[_0x5d9ceb];return _0x33ce82;};'use strict';var util=require(_0xb79d('0x0'));var _=require(_0xb79d('0x1'));var moment=require(_0xb79d('0x2'));var BPromise=require(_0xb79d('0x3'));var hardware=require(_0xb79d('0x4'));var encryptor=require(_0xb79d('0x5'));var db=require(_0xb79d('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb79d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb79d('0x8'),'machineUuid':hardware[_0xb79d('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb79d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xb79d('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26eb6b){return new BPromise(function(_0x285c21,_0x4ffa5b){return db['License'][_0xb79d('0xa')](_[_0xb79d('0xb')](_0x26eb6b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x34e417){return checkLicense(_0x34e417,null);})[_0xb79d('0xc')](function(_0x47b469){_0x285c21(_0x47b469);return;})[_0xb79d('0xd')](function(_0x58d404){_0x4ffa5b(_0x58d404);});});}function checkLicense(_0x5a9379,_0x415dd3){if(!_0x5a9379){demoLicense[_0xb79d('0xe')]=_0x5a9379['data1'];return demoLicense;}try{var _0x1aba02=_0x415dd3||_0x5a9379['license'];if(_[_0xb79d('0xf')](_0x1aba02)){throw new Error(_0xb79d('0x10'));}var _0x5b30d6=_0x5a9379['data1'];var _0x1b3cfd=_0x5a9379[_0xb79d('0x11')];var _0xb448da=_0x5b30d6[_0xb79d('0x12')]('-')[0x4];var _0x1ca329=_0x5b30d6[_0xb79d('0x12')]('-')[0x0];var _0x45cd94=encryptor[_0xb79d('0x13')](_0x1aba02,util[_0xb79d('0x14')](_0xb79d('0x15'),_0xb448da,_0x5b30d6,_0x1ca329));var _0xca85b2=JSON[_0xb79d('0x16')](_0x45cd94);_0xca85b2[_0xb79d('0x17')]=![];_0xca85b2[_0xb79d('0xe')]=_0x5b30d6;_0xca85b2[_0xb79d('0x18')]=hardware[_0xb79d('0x9')]();if(_0x1b3cfd){var _0x173e34=encryptor['decryptString'](_0x1b3cfd);_0xca85b2['gray']=_0x173e34;_0xca85b2[_0xb79d('0x19')]=moment(_0x173e34)[_0xb79d('0x1a')](0x7,'days')['format']();_0xca85b2['grayReason']=_0xca85b2[_0xb79d('0xe')]!=_0xca85b2['machineUuid']?_0xb79d('0x1b'):_0xb79d('0x1c');}return _0xca85b2;}catch(_0x20e021){breakingLicense[_0xb79d('0xe')]=_0x5a9379[_0xb79d('0x1d')];breakingLicense[_0xb79d('0x1e')]=_0x20e021['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f0d58,_0x3aebfb){getLicense()[_0xb79d('0xc')](function(_0x86226f){return db[_0xb79d('0x1f')][_0xb79d('0x20')]({'attributes':[_0xb79d('0x21'),[db[_0xb79d('0x22')]['fn'](_0xb79d('0x23'),db[_0xb79d('0x22')][_0xb79d('0x24')]('role')),'count']],'group':_0xb79d('0x21'),'where':{'role':{'$or':[_0xb79d('0x25'),'user',_0xb79d('0x26')]}},'raw':!![]})[_0xb79d('0xc')](function(_0x3cd84f){var _0x3e5cc5={'user':_0x86226f[_0xb79d('0x27')]||0x0,'telephone':_0x86226f['telephones']||0x0};_0x3cd84f[_0xb79d('0x28')](function(_0x50134b){var _0x17252c=_0x50134b[_0xb79d('0x21')]===_0xb79d('0x25')?'user':_0x50134b[_0xb79d('0x21')];_0x3e5cc5[_0x17252c]-=_0x50134b[_0xb79d('0x29')];if(_0x3e5cc5[_0x17252c]<0x0)_0x3e5cc5[_0x17252c]=0x0;});_0x2f0d58(_0x3e5cc5);return;});})[_0xb79d('0xd')](function(_0x5792fe){_0x3aebfb(_0x5792fe);});});}function checkUserLimits(_0x38787e){return new BPromise(function(_0x2b6653,_0x25d86f){getLimits()[_0xb79d('0xc')](function(_0x5292ca){var _0x41d046=_['pick'](_[_0xb79d('0x2a')](_0x38787e,_0xb79d('0x21')),[_0xb79d('0x25'),'user','telephone']);var _0x549186=(_0x41d046[_0xb79d('0x25')]||0x0)+(_0x41d046[_0xb79d('0x2b')]||0x0);var _0x3ab94a=_0x41d046[_0xb79d('0x26')]||0x0;if(_0x549186>_0x5292ca[_0xb79d('0x2b')])return _0x25d86f(_0xb79d('0x2c'));if(_0x3ab94a>_0x5292ca[_0xb79d('0x26')])return _0x25d86f(_0xb79d('0x2d'));return _0x2b6653();})[_0xb79d('0xd')](function(_0xdbd241){_0x25d86f(_0xdbd241);});});}module[_0xb79d('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x548c=['lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','defaults','then','uuid','data1','license','isEmpty','data2','decryptString','format','%s:%s:%s','demo','machineUuid','getUuid','gray','deadline','add','days','changed','disabled','sequelize','role','count','admin','user','telephone','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util'];(function(_0x2108f7,_0x2ae65b){var _0x527bd6=function(_0x46814f){while(--_0x46814f){_0x2108f7['push'](_0x2108f7['shift']());}};_0x527bd6(++_0x2ae65b);}(_0x548c,0x167));var _0xc548=function(_0x5d447d,_0x3d8e7a){_0x5d447d=_0x5d447d-0x0;var _0xeddcef=_0x548c[_0x5d447d];return _0xeddcef;};'use strict';var util=require(_0xc548('0x0'));var _=require(_0xc548('0x1'));var moment=require(_0xc548('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc548('0x3'));var encryptor=require(_0xc548('0x4'));var db=require(_0xc548('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc548('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc548('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc548('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc548('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2e0f64){return new BPromise(function(_0x1f19be,_0x5b9a09){return db[_0xc548('0x9')]['find'](_[_0xc548('0xa')](_0x2e0f64,{'raw':!![],'where':{'id':0x1}}))[_0xc548('0xb')](function(_0xe490ec){return checkLicense(_0xe490ec,null);})['then'](function(_0x1e6314){_0x1f19be(_0x1e6314);return;})['catch'](function(_0x462d14){_0x5b9a09(_0x462d14);});});}function checkLicense(_0x300193,_0x2b5cb5){if(!_0x300193){demoLicense[_0xc548('0xc')]=_0x300193[_0xc548('0xd')];return demoLicense;}try{var _0x589a03=_0x2b5cb5||_0x300193[_0xc548('0xe')];if(_[_0xc548('0xf')](_0x589a03)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x36b01d=_0x300193[_0xc548('0xd')];var _0x4496b8=_0x300193[_0xc548('0x10')];var _0x43d64d=_0x36b01d['split']('-')[0x4];var _0x3e5fb6=_0x36b01d['split']('-')[0x0];var _0x41fc04=encryptor[_0xc548('0x11')](_0x589a03,util[_0xc548('0x12')](_0xc548('0x13'),_0x43d64d,_0x36b01d,_0x3e5fb6));var _0x162a4e=JSON['parse'](_0x41fc04);_0x162a4e[_0xc548('0x14')]=![];_0x162a4e[_0xc548('0xc')]=_0x36b01d;_0x162a4e[_0xc548('0x15')]=hardware[_0xc548('0x16')]();if(_0x4496b8){var _0x5c6772=encryptor[_0xc548('0x11')](_0x4496b8);_0x162a4e[_0xc548('0x17')]=_0x5c6772;_0x162a4e[_0xc548('0x18')]=moment(_0x5c6772)[_0xc548('0x19')](0x7,_0xc548('0x1a'))['format']();_0x162a4e['grayReason']=_0x162a4e[_0xc548('0xc')]!=_0x162a4e[_0xc548('0x15')]?_0xc548('0x1b'):_0xc548('0x1c');}return _0x162a4e;}catch(_0x2025db){breakingLicense[_0xc548('0xc')]=_0x300193[_0xc548('0xd')];breakingLicense['message']=_0x2025db['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xddb442,_0x17f4a6){getLicense()['then'](function(_0x11e550){return db['User']['findAll']({'attributes':['role',[db[_0xc548('0x1d')]['fn']('COUNT',db['sequelize']['col'](_0xc548('0x1e'))),_0xc548('0x1f')]],'group':_0xc548('0x1e'),'where':{'role':{'$or':[_0xc548('0x20'),_0xc548('0x21'),_0xc548('0x22')]}},'raw':!![]})[_0xc548('0xb')](function(_0x3bd5a8){var _0x5330d1={'user':_0x11e550['users']||0x0,'telephone':_0x11e550['telephones']||0x0};_0x3bd5a8['forEach'](function(_0x2f7a2e){var _0x52ca14=_0x2f7a2e[_0xc548('0x1e')]===_0xc548('0x20')?'user':_0x2f7a2e['role'];_0x5330d1[_0x52ca14]-=_0x2f7a2e[_0xc548('0x1f')];if(_0x5330d1[_0x52ca14]<0x0)_0x5330d1[_0x52ca14]=0x0;});_0xddb442(_0x5330d1);return;});})['catch'](function(_0x1cf295){_0x17f4a6(_0x1cf295);});});}function checkUserLimits(_0x4e7ec9){return new BPromise(function(_0x53d2c9,_0x4b5e64){getLimits()[_0xc548('0xb')](function(_0x167e8c){var _0x2c09ae=_[_0xc548('0x23')](_[_0xc548('0x24')](_0x4e7ec9,'role'),[_0xc548('0x20'),_0xc548('0x21'),'telephone']);var _0x5d49fd=(_0x2c09ae[_0xc548('0x20')]||0x0)+(_0x2c09ae[_0xc548('0x21')]||0x0);var _0x161bd5=_0x2c09ae[_0xc548('0x22')]||0x0;if(_0x5d49fd>_0x167e8c['user'])return _0x4b5e64('License\x20limit\x20reached\x20for\x20users');if(_0x161bd5>_0x167e8c['telephone'])return _0x4b5e64(_0xc548('0x25'));return _0x53d2c9();})[_0xc548('0x26')](function(_0x249268){_0x4b5e64(_0x249268);});});}module[_0xc548('0x27')]={'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 857e135..a5fc8aa 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 _0x3423=['app-id','secret','myappanuglar-secret'];(function(_0x582fec,_0x191666){var _0x4236dd=function(_0x9e038c){while(--_0x9e038c){_0x582fec['push'](_0x582fec['shift']());}};_0x4236dd(++_0x191666);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3342('0x0'),'GOOGLE_ID':_0x3342('0x1'),'GOOGLE_SECRET':_0x3342('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x66fa=['http://localhost:9000','app-id','secret','exports'];(function(_0x308c81,_0x3b1c85){var _0x5cc912=function(_0xbfd935){while(--_0xbfd935){_0x308c81['push'](_0x308c81['shift']());}};_0x5cc912(++_0x3b1c85);}(_0x66fa,0x117));var _0xa66f=function(_0x34510d,_0x31979c){_0x34510d=_0x34510d-0x0;var _0x136cfe=_0x66fa[_0x34510d];return _0x136cfe;};'use strict';module[_0xa66f('0x0')]={'DOMAIN':_0xa66f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa66f('0x2'),'GOOGLE_SECRET':_0xa66f('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1101051..7bd32e3 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc845=['exports','../utils/loggers'];(function(_0x4c428f,_0x27328d){var _0x58333d=function(_0x3d3b8c){while(--_0x3d3b8c){_0x4c428f['push'](_0x4c428f['shift']());}};_0x58333d(++_0x27328d);}(_0xc845,0xbf));var _0x5c84=function(_0x576237,_0x5eb7f8){_0x576237=_0x576237-0x0;var _0x54f7b4=_0xc845[_0x576237];return _0x54f7b4;};'use strict';var fileLogger=require(_0x5c84('0x0'))['fileLogger'];module[_0x5c84('0x1')]=fileLogger; \ No newline at end of file +var _0xe712=['../utils/loggers','fileLogger'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe712,0x9e));var _0x2e71=function(_0xa3333e,_0x57e6c5){_0xa3333e=_0xa3333e-0x0;var _0x1dfd4c=_0xe712[_0xa3333e];return _0x1dfd4c;};'use strict';var fileLogger=require(_0x2e71('0x0'))[_0x2e71('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 062696f..0c8af27 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 _0x6f1d=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x471273,_0x1587f1){var _0x56c63e=function(_0x4464f0){while(--_0x4464f0){_0x471273['push'](_0x471273['shift']());}};_0x56c63e(++_0x1587f1);}(_0x6f1d,0xc8));var _0xd6f1=function(_0x937b22,_0x5cfda9){_0x937b22=_0x937b22-0x0;var _0x5e0121=_0x6f1d[_0x937b22];return _0x5e0121;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xd6f1('0x0'),'script':path[_0xd6f1('0x1')](__dirname,_0xd6f1('0x2'))},{'name':_0xd6f1('0x3'),'script':path['join'](__dirname,_0xd6f1('0x4'))},{'name':_0xd6f1('0x5'),'script':path[_0xd6f1('0x1')](__dirname,_0xd6f1('0x6'))},{'name':_0xd6f1('0x7'),'script':path[_0xd6f1('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xd6f1('0x8'),'script':path['join'](__dirname,_0xd6f1('0x9'))},{'name':'xdr','script':path[_0xd6f1('0x1')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x02e7=['routing','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x332fc6,_0x83bfc5){var _0x5c8796=function(_0x293b0a){while(--_0x293b0a){_0x332fc6['push'](_0x332fc6['shift']());}};_0x5c8796(++_0x83bfc5);}(_0x02e7,0xc0));var _0x702e=function(_0x26d344,_0x187295){_0x26d344=_0x26d344-0x0;var _0x470078=_0x02e7[_0x26d344];return _0x470078;};'use strict';var path=require(_0x702e('0x0'));var os=require('os');var config={'apps':[{'name':_0x702e('0x1'),'script':path[_0x702e('0x2')](__dirname,_0x702e('0x3'))},{'name':_0x702e('0x4'),'script':path[_0x702e('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x702e('0x5'),'script':path[_0x702e('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x702e('0x6'),'script':path[_0x702e('0x2')](__dirname,_0x702e('0x7'))},{'name':_0x702e('0x8'),'script':path[_0x702e('0x2')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x702e('0x2')](__dirname,_0x702e('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 55806fd..e5342bf 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 _0xd993=['delete','dump','saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xd993,0x153));var _0x3d99=function(_0x4fae19,_0x257a9f){_0x4fae19=_0x4fae19-0x0;var _0xc76eeb=_0xd993[_0x4fae19];return _0xc76eeb;};'use strict';var pm2=require(_0x3d99('0x0'));var BPromise=require(_0x3d99('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x32fb16,_0x97be9b){return pm2[_0x3d99('0x2')](function(_0x27b515){if(_0x27b515){return _0x97be9b(_0x27b515);}return _0x32fb16(_0x3d99('0x3'));});});};exports[_0x3d99('0x4')]=function(_0x131407){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x47ee21,_0x3f23bd){return pm2[_0x3d99('0x4')](_0x131407,function(_0x2238fe,_0x5a7db0){if(_0x2238fe){return _0x3f23bd(_0x2238fe);}pm2[_0x3d99('0x6')]();return _0x47ee21(_0x5a7db0);});});});};exports[_0x3d99('0x7')]=function(_0x3b83fc){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x5b1a00,_0x178a37){return pm2[_0x3d99('0x7')](_0x3b83fc,function(_0x5256b7,_0x4b4308){if(_0x5256b7){return _0x178a37(_0x5256b7);}pm2['disconnect']();return _0x5b1a00(_0x4b4308);});});});};exports[_0x3d99('0x8')]=function(_0x30214b){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x573f50,_0x4fbca2){return pm2['restart'](_0x30214b,function(_0x50522c,_0x2288c6){if(_0x50522c){return _0x4fbca2(_0x50522c);}pm2[_0x3d99('0x6')]();return _0x573f50(_0x2288c6);});});});};exports['list']=function(){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x30f8f2,_0x120093){return pm2[_0x3d99('0x9')](function(_0xc69f9,_0x378563){if(_0xc69f9){return _0x120093(_0xc69f9);}pm2['disconnect']();return _0x30f8f2(_0x378563);});});});};exports[_0x3d99('0xa')]=function(_0x56b038){return connect()['then'](function(){return new BPromise(function(_0x529ef6,_0x1b0573){return pm2[_0x3d99('0xa')](_0x56b038,function(_0x436229,_0x5a1fa5){if(_0x436229){return _0x1b0573(_0x436229);}pm2[_0x3d99('0x6')]();return _0x529ef6(_0x5a1fa5);});});});};exports[_0x3d99('0xb')]=function(_0x489344){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x13f462,_0x2b00d5){return pm2[_0x3d99('0xb')](_0x489344,function(_0xfeb695,_0xd89556){if(_0xfeb695){return _0x2b00d5(_0xfeb695);}pm2['disconnect']();return _0x13f462(_0xd89556);});});});};exports[_0x3d99('0xc')]=function(){return connect()[_0x3d99('0x5')](function(){return new BPromise(function(_0x48c551,_0x2deb72){return pm2[_0x3d99('0xc')](function(_0x1293cb){if(_0x1293cb){return _0x2deb72(_0x1293cb);}return _0x48c551(_0x3d99('0xd'));});});});}; \ No newline at end of file +var _0xbf06=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','connect'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xbf06,0x19e));var _0x6bf0=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xbf06[_0x297fd3];return _0x2af381;};'use strict';var pm2=require(_0x6bf0('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x305ee1,_0x35a751){return pm2[_0x6bf0('0x1')](function(_0x920a1d){if(_0x920a1d){return _0x35a751(_0x920a1d);}return _0x305ee1(_0x6bf0('0x2'));});});};exports[_0x6bf0('0x3')]=function(_0x55ea3e){return connect()[_0x6bf0('0x4')](function(){return new BPromise(function(_0x252f49,_0x141c5b){return pm2[_0x6bf0('0x3')](_0x55ea3e,function(_0x3a1247,_0xde31b6){if(_0x3a1247){return _0x141c5b(_0x3a1247);}pm2[_0x6bf0('0x5')]();return _0x252f49(_0xde31b6);});});});};exports[_0x6bf0('0x6')]=function(_0x140851){return connect()['then'](function(){return new BPromise(function(_0x138106,_0x179b33){return pm2[_0x6bf0('0x6')](_0x140851,function(_0xc870a3,_0x5c14b8){if(_0xc870a3){return _0x179b33(_0xc870a3);}pm2[_0x6bf0('0x5')]();return _0x138106(_0x5c14b8);});});});};exports[_0x6bf0('0x7')]=function(_0x2e05f3){return connect()[_0x6bf0('0x4')](function(){return new BPromise(function(_0x1e9533,_0x6c6f67){return pm2[_0x6bf0('0x7')](_0x2e05f3,function(_0x10bf1e,_0x3d8faa){if(_0x10bf1e){return _0x6c6f67(_0x10bf1e);}pm2[_0x6bf0('0x5')]();return _0x1e9533(_0x3d8faa);});});});};exports[_0x6bf0('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x375dd8,_0xfe289a){return pm2[_0x6bf0('0x8')](function(_0x5d3ef3,_0x42f25f){if(_0x5d3ef3){return _0xfe289a(_0x5d3ef3);}pm2[_0x6bf0('0x5')]();return _0x375dd8(_0x42f25f);});});});};exports[_0x6bf0('0x9')]=function(_0x268338){return connect()[_0x6bf0('0x4')](function(){return new BPromise(function(_0x287605,_0x2fa0d3){return pm2[_0x6bf0('0x9')](_0x268338,function(_0x42b9cc,_0x5a1f86){if(_0x42b9cc){return _0x2fa0d3(_0x42b9cc);}pm2['disconnect']();return _0x287605(_0x5a1f86);});});});};exports[_0x6bf0('0xa')]=function(_0x3cf18f){return connect()[_0x6bf0('0x4')](function(){return new BPromise(function(_0x3e0951,_0x3ec000){return pm2[_0x6bf0('0xa')](_0x3cf18f,function(_0x453494,_0x56bb4e){if(_0x453494){return _0x3ec000(_0x453494);}pm2[_0x6bf0('0x5')]();return _0x3e0951(_0x56bb4e);});});});};exports[_0x6bf0('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x27c5d5,_0x542651){return pm2[_0x6bf0('0xb')](function(_0x4288dd){if(_0x4288dd){return _0x542651(_0x4288dd);}return _0x27c5d5(_0x6bf0('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 95af67c..3833507 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 _0x00e7=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit'];(function(_0xb14788,_0x357d54){var _0x1ca143=function(_0x3a1e9b){while(--_0x3a1e9b){_0xb14788['push'](_0xb14788['shift']());}};_0x1ca143(++_0x357d54);}(_0x00e7,0x191));var _0x700e=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0x00e7[_0x75267d];return _0x21ccec;};'use strict';var _=require(_0x700e('0x0'));var moment=require(_0x700e('0x1'));var Redis=require(_0x700e('0x2'));var util=require(_0x700e('0x3'));var config=require(_0x700e('0x4'));var db=require(_0x700e('0x5'))['db'];var logger=require(_0x700e('0x6'))(_0x700e('0x7'));config[_0x700e('0x8')]=_[_0x700e('0x9')](config[_0x700e('0x8')],{'host':_0x700e('0xa'),'port':0x18eb});var io=require(_0x700e('0xb'))(new Redis(config[_0x700e('0x8')]));function closeInteractions(){var _0x44c318=0x0;var _0x11581c=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x700e('0xc')],'where':{'id':0x1}})['then'](function(_0x220c5e){_0x44c318=_0x220c5e[_0x700e('0xc')];if(_0x44c318){return db[_0x700e('0xd')][_0x700e('0xe')]({'raw':!![],'attributes':['id',_0x700e('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x700e('0x10')](_0x220c5e[_0x700e('0xc')],_0x700e('0x11'))}}});}else{return[];}})[_0x700e('0x12')](function(_0x1c4ded){if(_0x1c4ded&&_0x1c4ded[_0x700e('0x13')]){_0x11581c=_[_0x700e('0x14')](_0x1c4ded||[],'id');logger[_0x700e('0x15')](_0x700e('0x16'),_0x11581c['join']());return db[_0x700e('0xd')][_0x700e('0x17')]({'closeReason':_0x700e('0x18'),'disposition':_0x700e('0x19'),'closed':!![],'closedAt':moment()[_0x700e('0x1a')](_0x700e('0x1b'))},{'where':{'id':_0x11581c}});}})[_0x700e('0x12')](function(){if(_0x11581c&&_0x11581c[_0x700e('0x13')]){logger[_0x700e('0x15')](_0x700e('0x1c'),_0x11581c[_0x700e('0x1d')]());for(var _0x4da3bd=0x0;_0x4da3bd<_0x11581c['length'];_0x4da3bd++){io[_0x700e('0x1e')]('chatInteraction:update',{'id':_0x11581c[_0x4da3bd],'closed':!![]});}}})[_0x700e('0x1f')](function(_0x26724a){logger[_0x700e('0x20')](_0x700e('0x21'),_0x26724a?util[_0x700e('0x22')](_0x26724a,{'showHidden':![],'depth':null}):'');});}exports[_0x700e('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6230=['../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','chatInteraction:update','catch','error','start','lodash','ioredis','util'];(function(_0x17648f,_0xa233ee){var _0x1853a5=function(_0x1647a0){while(--_0x1647a0){_0x17648f['push'](_0x17648f['shift']());}};_0x1853a5(++_0xa233ee);}(_0x6230,0x15d));var _0x0623=function(_0x53f3d0,_0x41ca07){_0x53f3d0=_0x53f3d0-0x0;var _0x583eb9=_0x6230[_0x53f3d0];return _0x583eb9;};'use strict';var _=require(_0x0623('0x0'));var moment=require('moment');var Redis=require(_0x0623('0x1'));var util=require(_0x0623('0x2'));var config=require(_0x0623('0x3'));var db=require(_0x0623('0x4'))['db'];var logger=require('../logger')(_0x0623('0x5'));config[_0x0623('0x6')]=_[_0x0623('0x7')](config[_0x0623('0x6')],{'host':_0x0623('0x8'),'port':0x18eb});var io=require(_0x0623('0x9'))(new Redis(config[_0x0623('0x6')]));function closeInteractions(){var _0x59ca15=0x0;var _0x14935a=[];return db[_0x0623('0xa')][_0x0623('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x0623('0xc')](function(_0xf00ca){_0x59ca15=_0xf00ca[_0x0623('0xd')];if(_0x59ca15){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0623('0xe')](_0xf00ca['chatTimeout'],_0x0623('0xf'))}}});}else{return[];}})[_0x0623('0xc')](function(_0x3fda1c){if(_0x3fda1c&&_0x3fda1c['length']){_0x14935a=_[_0x0623('0x10')](_0x3fda1c||[],'id');logger[_0x0623('0x11')](_0x0623('0x12'),_0x14935a[_0x0623('0x13')]());return db[_0x0623('0x14')][_0x0623('0x15')]({'closeReason':_0x0623('0x16'),'disposition':_0x0623('0x17'),'closed':!![],'closedAt':moment()[_0x0623('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x14935a}});}})[_0x0623('0xc')](function(){if(_0x14935a&&_0x14935a['length']){logger[_0x0623('0x11')](_0x0623('0x19'),_0x14935a['join']());for(var _0x3ebadf=0x0;_0x3ebadf<_0x14935a[_0x0623('0x1a')];_0x3ebadf++){io[_0x0623('0x1b')](_0x0623('0x1c'),{'id':_0x14935a[_0x3ebadf],'closed':!![]});}}})[_0x0623('0x1d')](function(_0x13f731){logger[_0x0623('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x13f731?util['inspect'](_0x13f731,{'showHidden':![],'depth':null}):'');});}exports[_0x0623('0x1f')]=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 95b66e9..a4aee11 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 _0xa250=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa250,0x15f));var _0x0a25=function(_0x4f9589,_0x508341){_0x4f9589=_0x4f9589-0x0;var _0x461484=_0xa250[_0x4f9589];return _0x461484;};'use strict';function start(){var _0xf752ba=require(_0x0a25('0x0'));return _0xf752ba['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xcb07=['startAllRefreshIntervals','exports'];(function(_0x126ca9,_0xbc3227){var _0x3afb9e=function(_0x22e791){while(--_0x22e791){_0x126ca9['push'](_0x126ca9['shift']());}};_0x3afb9e(++_0xbc3227);}(_0xcb07,0x15e));var _0x7cb0=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xcb07[_0x5f1cf8];return _0x27d0fa;};'use strict';function start(){var _0xb65afc=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0xb65afc[_0x7cb0('0x0')]();}module[_0x7cb0('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index c560463..6bca4a7 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 _0x6f90=['Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','intersection','length','exists','stop','delete\x20cron','cron','isBetween','startAt','endAt','add','start','stop\x20cron','deleteJob','run','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x6f90,0x198));var _0x06f9=function(_0x193e9b,_0x180a9d){_0x193e9b=_0x193e9b-0x0;var _0x47f52b=_0x6f90[_0x193e9b];return _0x47f52b;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x06f9('0x0'));var _=require('lodash');var moment=require(_0x06f9('0x1'));var CronJobManager=require(_0x06f9('0x2'));var jayson=require(_0x06f9('0x3'));var BPromise=require(_0x06f9('0x4'));var logger=require(_0x06f9('0x5'))(_0x06f9('0x6'));var db=require(_0x06f9('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x06f9('0x8'));var client=jayson[_0x06f9('0x9')][_0x06f9('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x29da26,_0x5bab31){return function(){logger[_0x06f9('0xb')](_0x06f9('0xc'),_0x29da26[_0x06f9('0xd')]);var _0x3573b2=!![];var _0x3c7853=_0x29da26[_0x06f9('0xe')][_0x06f9('0xf')]();var _0x47b954={'account':_0x3c7853,'message':{'from':util[_0x06f9('0x10')](_0x06f9('0x11'),_0x29da26['MailAccount'][_0x06f9('0x12')],_0x29da26[_0x06f9('0xe')][_0x06f9('0xd')]||_0x29da26['MailAccount']['Smtp'][_0x06f9('0x13')]),'to':_0x29da26[_0x06f9('0xd')],'cc':_0x29da26['cc'],'bcc':_0x29da26[_0x06f9('0x14')],'subject':util[_0x06f9('0x10')](_0x06f9('0x15'),_0x5bab31[_0x06f9('0x12')],_0x29da26[_0x06f9('0x16')],_0x29da26[_0x06f9('0x17')])}};var _0x391c93=path[_0x06f9('0x18')](__dirname,_0x06f9('0x19'));var _0xf5e897=_0x5bab31[_0x06f9('0x1a')];var _0x377a68=util[_0x06f9('0x10')](_0x06f9('0x1b'),path[_0x06f9('0x1c')](_0x5bab31['savename'],path[_0x06f9('0x1d')](_0x5bab31['savename'])),_0x06f9('0x1e'));var _0x42c5bf=path['join'](_0x391c93,_0xf5e897);var _0xf81353=path[_0x06f9('0x18')](_0x391c93,_0x377a68);if(fs[_0x06f9('0x1f')](_0x42c5bf)){_0x5bab31[_0x06f9('0x20')]='Sent';_0x47b954[_0x06f9('0x21')][_0x06f9('0x22')]=[{'filename':_0xf5e897,'path':_0x42c5bf}];_0x47b954[_0x06f9('0x21')]['text']=util[_0x06f9('0x10')](_0x06f9('0x23'),JSON[_0x06f9('0x24')](_0x5bab31,null,0x2));}else if(fs[_0x06f9('0x1f')](_0xf81353)){_0x5bab31[_0x06f9('0x20')]=_0x06f9('0x25');_0x47b954[_0x06f9('0x21')]['attachments']=[{'filename':_0x377a68,'path':_0xf81353}];}else{_0x47b954[_0x06f9('0x21')][_0x06f9('0x26')]=_0x06f9('0x27');if(!_0x29da26['sendIfEmpty']){_0x3573b2=![];logger[_0x06f9('0xb')](_0x06f9('0x28'));}}if(_0x3573b2){return client[_0x06f9('0x29')](_0x06f9('0x2a'),_0x47b954)[_0x06f9('0x2b')](function(_0x4586aa){if(_0x4586aa['error']){return logger[_0x06f9('0x2c')](_0x06f9('0x2d'),JSON['stringify'](_0x4586aa));}return logger[_0x06f9('0xb')](_0x06f9('0x2e'));})['catch'](function(_0x4ec87f){return logger[_0x06f9('0x2c')]('error\x20mail',JSON[_0x06f9('0x24')](_0x4ec87f));});}};}function handleError(){return function(_0x158ee4){return logger['error'](JSON[_0x06f9('0x24')](_0x158ee4));};}function handleResult(_0x2bd36e){return function(_0x377656){logger[_0x06f9('0xb')](_0x06f9('0x2f'),JSON['stringify'](_0x377656));if(_0x2bd36e['MailAccount']&&_0x2bd36e['MailAccount'][_0x06f9('0x30')]&&!_[_0x06f9('0x31')](_0x2bd36e[_0x06f9('0xd')])){setTimeout(handleSendEmail(_0x2bd36e,_0x377656),0x3c*0x3e8);}};}function handleJob(_0x3164db){return function(){try{if(_[_0x06f9('0x31')](_0x3164db[_0x06f9('0x16')])){return logger[_0x06f9('0xb')](_0x06f9('0x32'));}if(_[_0x06f9('0x31')](_0x3164db[_0x06f9('0x17')])){return logger['info'](_0x06f9('0x33'));}var _0x287479={'startDate':moment()[_0x06f9('0x34')](_0x3164db[_0x06f9('0x16')],_0x3164db['subtractUnit'])[_0x06f9('0x10')](_0x06f9('0x35')),'endDate':moment()[_0x06f9('0x10')](_0x06f9('0x35')),'type':'scheduled','output':_0x3164db[_0x06f9('0x36')],'name':_0x3164db[_0x06f9('0x12')]};if(!_[_0x06f9('0x31')](_0x3164db[_0x06f9('0x37')])){logger[_0x06f9('0xb')](_0x06f9('0x38'),_0x3164db['DefaultReportId']);return analyticDefaultReportController[_0x06f9('0x39')]({'id':_0x3164db[_0x06f9('0x37')]},_0x287479)[_0x06f9('0x2b')](handleResult(_0x3164db))[_0x06f9('0x3a')](handleError());}if(!_[_0x06f9('0x31')](_0x3164db[_0x06f9('0x3b')])){logger[_0x06f9('0xb')](_0x06f9('0x3c'),_0x3164db[_0x06f9('0x3b')]);return analyticCustomReportController[_0x06f9('0x39')]({'id':_0x3164db[_0x06f9('0x3b')]},_0x287479)[_0x06f9('0x2b')](handleResult(_0x3164db))[_0x06f9('0x3a')](handleError());}}catch(_0x4cbb41){logger[_0x06f9('0x2c')](JSON[_0x06f9('0x24')](_0x4cbb41));}return logger[_0x06f9('0xb')](_0x06f9('0x3d'));};}function getJobs(_0x50b0ef){var _0x7bd618={};if(_0x50b0ef){_0x7bd618['id']=_0x50b0ef;}return db[_0x06f9('0x3e')][_0x06f9('0x3f')]({'where':_0x7bd618,'include':[{'model':db[_0x06f9('0xe')],'attributes':['id','name',_0x06f9('0xd')],'include':[{'model':db[_0x06f9('0x40')],'as':_0x06f9('0x30'),'include':[{'model':db[_0x06f9('0x41')],'as':_0x06f9('0x41')}]}]}]})[_0x06f9('0x2b')](function(_0x272d47){var _0x5034c3=_['keys'](manager[_0x06f9('0x42')]);var _0x16d490=_[_0x06f9('0x43')](_0x272d47,function(_0x13a09b){return _0x13a09b['id'][_0x06f9('0x44')]();});var _0x3f5ed6=_[_0x06f9('0x45')](_0x272d47,function(_0x49f742){return _0x49f742['id']['toString']();});var _0x36fac5=_0x50b0ef?_0x16d490:_['difference'](_0x16d490,_0x5034c3);var _0x264630=_[_0x06f9('0x46')](_0x16d490,_0x5034c3);var _0x5d4998=_['difference'](_0x5034c3,_0x16d490);var _0x1c0f12;var _0x56fb41;for(_0x1c0f12=0x0;_0x1c0f12<_0x5d4998[_0x06f9('0x47')]&&!_0x50b0ef;_0x1c0f12+=0x1){_0x56fb41=_0x5d4998[_0x1c0f12][_0x06f9('0x44')]();if(manager[_0x06f9('0x48')](_0x56fb41)){manager[_0x06f9('0x49')](_0x56fb41);manager['deleteJob'](_0x56fb41);logger[_0x06f9('0xb')](_0x06f9('0x4a'),_0x56fb41);}}logger[_0x06f9('0xb')]('toRun',JSON[_0x06f9('0x24')](_0x36fac5));for(_0x1c0f12=0x0;_0x1c0f12<_0x36fac5[_0x06f9('0x47')];_0x1c0f12+=0x1){_0x56fb41=_0x36fac5[_0x1c0f12][_0x06f9('0x44')]();logger[_0x06f9('0xb')]('index',_0x56fb41);if(_0x50b0ef){logger[_0x06f9('0xb')]('my\x20id',_0x50b0ef);logger['info'](JSON[_0x06f9('0x24')](_0x3f5ed6[_0x56fb41]));BPromise['resolve']()['then'](handleJob(_0x3f5ed6[_0x56fb41]));logger[_0x06f9('0xb')]('run\x20job',_0x3f5ed6[_0x56fb41][_0x06f9('0x12')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]);}else if(_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]&&_0x3f5ed6[_0x56fb41]['active']&&moment()[_0x06f9('0x4c')](_0x3f5ed6[_0x56fb41][_0x06f9('0x4d')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4e')])){manager[_0x06f9('0x4f')](_0x56fb41,_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')],handleJob(_0x3f5ed6[_0x56fb41]));manager[_0x06f9('0x50')](_0x56fb41);logger[_0x06f9('0xb')]('add\x20cron',_0x3f5ed6[_0x56fb41][_0x06f9('0x12')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]);}else if(manager[_0x06f9('0x48')](_0x56fb41)){manager[_0x06f9('0x49')](_0x56fb41);manager['deleteJob'](_0x56fb41);logger[_0x06f9('0xb')](_0x06f9('0x51'),_0x3f5ed6[_0x56fb41][_0x06f9('0x12')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]);}}for(_0x1c0f12=0x0,_0x56fb41;_0x1c0f12<_0x264630[_0x06f9('0x47')]&&!_0x50b0ef;_0x1c0f12+=0x1){_0x56fb41=_0x264630[_0x1c0f12]['toString']();if(manager[_0x06f9('0x48')](_0x56fb41)){if(_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]&&_0x3f5ed6[_0x56fb41]['active']&&moment()['isBetween'](_0x3f5ed6[_0x56fb41][_0x06f9('0x4d')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4e')])){manager['update'](_0x56fb41,_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')],handleJob(_0x3f5ed6[_0x56fb41]));logger[_0x06f9('0xb')]('update\x20cron',_0x3f5ed6[_0x56fb41][_0x06f9('0x12')],_0x3f5ed6[_0x56fb41]['cron']);}else{manager[_0x06f9('0x49')](_0x56fb41);manager[_0x06f9('0x52')](_0x56fb41);logger[_0x06f9('0xb')](_0x06f9('0x51'),_0x3f5ed6[_0x56fb41][_0x06f9('0x12')],_0x3f5ed6[_0x56fb41][_0x06f9('0x4b')]);}}}})[_0x06f9('0x3a')](function(_0x3b61e8){logger[_0x06f9('0x2c')](JSON[_0x06f9('0x24')](_0x3b61e8));});}exports[_0x06f9('0x53')]=function(_0x19b673){return getJobs(_0x19b673);};exports[_0x06f9('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb6bf=['info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x397f5e,_0x452586){var _0x3e08c1=function(_0x1cca5b){while(--_0x1cca5b){_0x397f5e['push'](_0x397f5e['shift']());}};_0x3e08c1(++_0x452586);}(_0xb6bf,0xa9));var _0xfb6b=function(_0x428318,_0x1b44fd){_0x428318=_0x428318-0x0;var _0x23964f=_0xb6bf[_0x428318];return _0x23964f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xfb6b('0x0'));var _=require('lodash');var moment=require(_0xfb6b('0x1'));var CronJobManager=require(_0xfb6b('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xfb6b('0x3'));var logger=require(_0xfb6b('0x4'))(_0xfb6b('0x5'));var db=require(_0xfb6b('0x6'))['db'];var analyticCustomReportController=require(_0xfb6b('0x7'));var analyticDefaultReportController=require(_0xfb6b('0x8'));var client=jayson[_0xfb6b('0x9')][_0xfb6b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3df6be,_0x5e27f1){return function(){logger[_0xfb6b('0xb')](_0xfb6b('0xc'),_0x3df6be[_0xfb6b('0xd')]);var _0x3bf621=!![];var _0x497139=_0x3df6be['MailAccount'][_0xfb6b('0xe')]();var _0x53a350={'account':_0x497139,'message':{'from':util[_0xfb6b('0xf')](_0xfb6b('0x10'),_0x3df6be[_0xfb6b('0x11')][_0xfb6b('0x12')],_0x3df6be[_0xfb6b('0x11')][_0xfb6b('0xd')]||_0x3df6be[_0xfb6b('0x11')][_0xfb6b('0x13')][_0xfb6b('0x14')]),'to':_0x3df6be[_0xfb6b('0xd')],'cc':_0x3df6be['cc'],'bcc':_0x3df6be[_0xfb6b('0x15')],'subject':util[_0xfb6b('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x5e27f1[_0xfb6b('0x12')],_0x3df6be[_0xfb6b('0x16')],_0x3df6be[_0xfb6b('0x17')])}};var _0x5af9c6=path[_0xfb6b('0x18')](__dirname,_0xfb6b('0x19'));var _0x59ad4c=_0x5e27f1[_0xfb6b('0x1a')];var _0x4fac0e=util['format'](_0xfb6b('0x1b'),path[_0xfb6b('0x1c')](_0x5e27f1[_0xfb6b('0x1a')],path[_0xfb6b('0x1d')](_0x5e27f1[_0xfb6b('0x1a')])),'zip');var _0x5f507b=path[_0xfb6b('0x18')](_0x5af9c6,_0x59ad4c);var _0x4d4736=path[_0xfb6b('0x18')](_0x5af9c6,_0x4fac0e);if(fs[_0xfb6b('0x1e')](_0x5f507b)){_0x5e27f1[_0xfb6b('0x1f')]='Sent';_0x53a350['message']['attachments']=[{'filename':_0x59ad4c,'path':_0x5f507b}];_0x53a350[_0xfb6b('0x20')][_0xfb6b('0x21')]=util[_0xfb6b('0xf')](_0xfb6b('0x22'),JSON[_0xfb6b('0x23')](_0x5e27f1,null,0x2));}else if(fs[_0xfb6b('0x1e')](_0x4d4736)){_0x5e27f1[_0xfb6b('0x1f')]=_0xfb6b('0x24');_0x53a350[_0xfb6b('0x20')][_0xfb6b('0x25')]=[{'filename':_0x4fac0e,'path':_0x4d4736}];}else{_0x53a350['message'][_0xfb6b('0x21')]=_0xfb6b('0x26');if(!_0x3df6be[_0xfb6b('0x27')]){_0x3bf621=![];logger[_0xfb6b('0xb')](_0xfb6b('0x28'));}}if(_0x3bf621){return client[_0xfb6b('0x29')](_0xfb6b('0x2a'),_0x53a350)['then'](function(_0x4d4a7e){if(_0x4d4a7e[_0xfb6b('0x2b')]){return logger[_0xfb6b('0x2b')](_0xfb6b('0x2c'),JSON['stringify'](_0x4d4a7e));}return logger['info'](_0xfb6b('0x2d'));})[_0xfb6b('0x2e')](function(_0x2e8532){return logger[_0xfb6b('0x2b')](_0xfb6b('0x2c'),JSON[_0xfb6b('0x23')](_0x2e8532));});}};}function handleError(){return function(_0x314021){return logger[_0xfb6b('0x2b')](JSON['stringify'](_0x314021));};}function handleResult(_0x17fae9){return function(_0x184271){logger[_0xfb6b('0xb')]('data',JSON[_0xfb6b('0x23')](_0x184271));if(_0x17fae9[_0xfb6b('0x11')]&&_0x17fae9[_0xfb6b('0x11')]['Smtp']&&!_['isNil'](_0x17fae9[_0xfb6b('0xd')])){setTimeout(handleSendEmail(_0x17fae9,_0x184271),0x3c*0x3e8);}};}function handleJob(_0x4de7c8){return function(){try{if(_['isNil'](_0x4de7c8[_0xfb6b('0x16')])){return logger[_0xfb6b('0xb')](_0xfb6b('0x2f'));}if(_[_0xfb6b('0x30')](_0x4de7c8[_0xfb6b('0x17')])){return logger[_0xfb6b('0xb')](_0xfb6b('0x31'));}var _0x55af6d={'startDate':moment()[_0xfb6b('0x32')](_0x4de7c8[_0xfb6b('0x16')],_0x4de7c8[_0xfb6b('0x17')])[_0xfb6b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xfb6b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xfb6b('0x33'),'output':_0x4de7c8[_0xfb6b('0x34')],'name':_0x4de7c8[_0xfb6b('0x12')]};if(!_['isNil'](_0x4de7c8[_0xfb6b('0x35')])){logger[_0xfb6b('0xb')](_0xfb6b('0x36'),_0x4de7c8[_0xfb6b('0x35')]);return analyticDefaultReportController[_0xfb6b('0x37')]({'id':_0x4de7c8[_0xfb6b('0x35')]},_0x55af6d)[_0xfb6b('0x38')](handleResult(_0x4de7c8))[_0xfb6b('0x2e')](handleError());}if(!_[_0xfb6b('0x30')](_0x4de7c8[_0xfb6b('0x39')])){logger['info'](_0xfb6b('0x3a'),_0x4de7c8['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x4de7c8[_0xfb6b('0x39')]},_0x55af6d)[_0xfb6b('0x38')](handleResult(_0x4de7c8))[_0xfb6b('0x2e')](handleError());}}catch(_0x3dad36){logger[_0xfb6b('0x2b')](JSON[_0xfb6b('0x23')](_0x3dad36));}return logger[_0xfb6b('0xb')](_0xfb6b('0x3b'));};}function getJobs(_0x3909e2){var _0x157816={};if(_0x3909e2){_0x157816['id']=_0x3909e2;}return db[_0xfb6b('0x3c')][_0xfb6b('0x3d')]({'where':_0x157816,'include':[{'model':db[_0xfb6b('0x11')],'attributes':['id',_0xfb6b('0x12'),_0xfb6b('0xd')],'include':[{'model':db[_0xfb6b('0x3e')],'as':_0xfb6b('0x13'),'include':[{'model':db[_0xfb6b('0x3f')],'as':_0xfb6b('0x3f')}]}]}]})[_0xfb6b('0x38')](function(_0x649021){var _0x56557f=_[_0xfb6b('0x40')](manager[_0xfb6b('0x41')]);var _0x475c84=_[_0xfb6b('0x42')](_0x649021,function(_0x18243f){return _0x18243f['id'][_0xfb6b('0x43')]();});var _0x4b10f8=_[_0xfb6b('0x44')](_0x649021,function(_0x1a5054){return _0x1a5054['id']['toString']();});var _0x228423=_0x3909e2?_0x475c84:_[_0xfb6b('0x45')](_0x475c84,_0x56557f);var _0x36dea2=_[_0xfb6b('0x46')](_0x475c84,_0x56557f);var _0x93fe37=_[_0xfb6b('0x45')](_0x56557f,_0x475c84);var _0x188342;var _0x1c6d09;for(_0x188342=0x0;_0x188342<_0x93fe37[_0xfb6b('0x47')]&&!_0x3909e2;_0x188342+=0x1){_0x1c6d09=_0x93fe37[_0x188342][_0xfb6b('0x43')]();if(manager[_0xfb6b('0x48')](_0x1c6d09)){manager[_0xfb6b('0x49')](_0x1c6d09);manager[_0xfb6b('0x4a')](_0x1c6d09);logger[_0xfb6b('0xb')]('delete\x20cron',_0x1c6d09);}}logger['info']('toRun',JSON[_0xfb6b('0x23')](_0x228423));for(_0x188342=0x0;_0x188342<_0x228423['length'];_0x188342+=0x1){_0x1c6d09=_0x228423[_0x188342][_0xfb6b('0x43')]();logger['info'](_0xfb6b('0x4b'),_0x1c6d09);if(_0x3909e2){logger[_0xfb6b('0xb')](_0xfb6b('0x4c'),_0x3909e2);logger['info'](JSON[_0xfb6b('0x23')](_0x4b10f8[_0x1c6d09]));BPromise['resolve']()[_0xfb6b('0x38')](handleJob(_0x4b10f8[_0x1c6d09]));logger['info'](_0xfb6b('0x4d'),_0x4b10f8[_0x1c6d09][_0xfb6b('0x12')],_0x4b10f8[_0x1c6d09][_0xfb6b('0x4e')]);}else if(_0x4b10f8[_0x1c6d09]['cron']&&_0x4b10f8[_0x1c6d09][_0xfb6b('0x4f')]&&moment()[_0xfb6b('0x50')](_0x4b10f8[_0x1c6d09][_0xfb6b('0x51')],_0x4b10f8[_0x1c6d09][_0xfb6b('0x52')])){manager[_0xfb6b('0x53')](_0x1c6d09,_0x4b10f8[_0x1c6d09][_0xfb6b('0x4e')],handleJob(_0x4b10f8[_0x1c6d09]));manager[_0xfb6b('0x54')](_0x1c6d09);logger[_0xfb6b('0xb')](_0xfb6b('0x55'),_0x4b10f8[_0x1c6d09][_0xfb6b('0x12')],_0x4b10f8[_0x1c6d09]['cron']);}else if(manager[_0xfb6b('0x48')](_0x1c6d09)){manager[_0xfb6b('0x49')](_0x1c6d09);manager[_0xfb6b('0x4a')](_0x1c6d09);logger[_0xfb6b('0xb')](_0xfb6b('0x56'),_0x4b10f8[_0x1c6d09][_0xfb6b('0x12')],_0x4b10f8[_0x1c6d09]['cron']);}}for(_0x188342=0x0,_0x1c6d09;_0x188342<_0x36dea2['length']&&!_0x3909e2;_0x188342+=0x1){_0x1c6d09=_0x36dea2[_0x188342][_0xfb6b('0x43')]();if(manager[_0xfb6b('0x48')](_0x1c6d09)){if(_0x4b10f8[_0x1c6d09][_0xfb6b('0x4e')]&&_0x4b10f8[_0x1c6d09][_0xfb6b('0x4f')]&&moment()['isBetween'](_0x4b10f8[_0x1c6d09][_0xfb6b('0x51')],_0x4b10f8[_0x1c6d09]['endAt'])){manager[_0xfb6b('0x57')](_0x1c6d09,_0x4b10f8[_0x1c6d09]['cron'],handleJob(_0x4b10f8[_0x1c6d09]));logger['info'](_0xfb6b('0x58'),_0x4b10f8[_0x1c6d09][_0xfb6b('0x12')],_0x4b10f8[_0x1c6d09]['cron']);}else{manager['stop'](_0x1c6d09);manager[_0xfb6b('0x4a')](_0x1c6d09);logger[_0xfb6b('0xb')](_0xfb6b('0x56'),_0x4b10f8[_0x1c6d09]['name'],_0x4b10f8[_0x1c6d09]['cron']);}}}})[_0xfb6b('0x2e')](function(_0x5bf53d){logger[_0xfb6b('0x2b')](JSON[_0xfb6b('0x23')](_0x5bf53d));});}exports[_0xfb6b('0x59')]=function(_0x197df5){return getJobs(_0x197df5);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 16b68fb..c859240 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 _0xf6ed=['[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentimentRegion','bucket','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','start','lodash','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data2','transcribeRegion','then','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri'];(function(_0x16946b,_0x5ea65a){var _0x322ea3=function(_0x131958){while(--_0x131958){_0x16946b['push'](_0x16946b['shift']());}};_0x322ea3(++_0x5ea65a);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x32eb82,_0x2bfbd4){_0x32eb82=_0x32eb82-0x0;var _0x5e0432=_0xf6ed[_0x32eb82];return _0x5e0432;};var _=require(_0xdf6e('0x0'));var AWS=require('aws-sdk');var rp=require(_0xdf6e('0x1'));var util=require(_0xdf6e('0x2'));var BPromise=require(_0xdf6e('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xdf6e('0x4'));function getTranscriptionJob(_0x484a22,_0x5f5db0,_0x468b96,_0x5be8b9){return new Promise(function(_0x2a844a,_0x5eb5d1){var _0x1efa53=new AWS[(_0xdf6e('0x5'))]({'accessKeyId':_0x5f5db0,'secretAccessKey':_0x484a22,'region':_0x468b96});_0x1efa53[_0xdf6e('0x6')]({'TranscriptionJobName':_0x5be8b9},function(_0x2a8802,_0x5c8cef){if(_0x2a8802){return _0x5eb5d1(_0x2a8802);}else{return _0x2a844a(_0x5c8cef);}});});}function sentiment(_0x588fd8,_0x3fdb05,_0x230c95,_0x2c4100,_0x3a8881){return new Promise(function(_0x56d897,_0x92cde3){var _0x5ad59b=new AWS[(_0xdf6e('0x7'))]({'accessKeyId':_0x3fdb05,'secretAccessKey':_0x588fd8,'region':_0x230c95});_0x5ad59b['detectSentiment']({'Text':_0x2c4100,'LanguageCode':_0x3a8881[_0xdf6e('0x8')](0x0,0x2)},function(_0x5f5c6e,_0xb0934b){if(_0x5f5c6e){return _0x92cde3(_0x5f5c6e);}else{return _0x56d897(_0xb0934b);}});});}function checkTranscribeJob(_0x142fa3,_0x4aa22d,_0x12e817){var _0x18a504;return new BPromise(function(_0x3c9e75,_0x182299){logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x142fa3['id'],_0x142fa3[_0xdf6e('0xb')]));return getTranscriptionJob(_0x12e817['data1'],_0x12e817[_0xdf6e('0xc')],_0x4aa22d[_0xdf6e('0xd')],_0x142fa3[_0xdf6e('0xb')])[_0xdf6e('0xe')](function(_0x2eb619){logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x142fa3['id'],_0x142fa3[_0xdf6e('0xb')],_0x2eb619['TranscriptionJob'][_0xdf6e('0xf')]));if(!_0x142fa3[_0xdf6e('0x10')]){switch(_0x2eb619['TranscriptionJob']['TranscriptionJobStatus']){case _0xdf6e('0x11'):var _0x3c6a2e={'transcribeStatus':_0x2eb619[_0xdf6e('0x12')]['TranscriptionJobStatus'],'fileUri':_0x2eb619[_0xdf6e('0x12')][_0xdf6e('0x13')][_0xdf6e('0x14')]};logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')](_0xdf6e('0x15'),_0x142fa3['id']));return rp({'uri':_0x2eb619['TranscriptionJob'][_0xdf6e('0x13')][_0xdf6e('0x14')],'json':!![]})[_0xdf6e('0xe')](function(_0x57955e){logger[_0xdf6e('0x9')](util['format'](_0xdf6e('0x16'),_0x142fa3['id']));if(_0x57955e&&_0x57955e[_0xdf6e('0x17')]&&_0x57955e['results'][_0xdf6e('0x18')]&&_0x57955e[_0xdf6e('0x17')][_0xdf6e('0x18')][_0xdf6e('0x19')]){_0x3c6a2e['fileText']='';for(var _0x4fe58f=0x0;_0x4fe58f<_0x57955e[_0xdf6e('0x17')]['transcripts'][_0xdf6e('0x19')];_0x4fe58f++){_0x3c6a2e[_0xdf6e('0x10')]+=_0x57955e[_0xdf6e('0x17')][_0xdf6e('0x18')][_0x4fe58f]['transcript']+'';}}return _0x142fa3[_0xdf6e('0x1a')](_0x3c6a2e);})[_0xdf6e('0xe')](function(){logger[_0xdf6e('0x9')](util['format'](_0xdf6e('0x1b'),_0x142fa3['id']));if(!_0x142fa3[_0xdf6e('0x1c')]){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4aa22d[_0xdf6e('0x1f')]||!_0x4aa22d[_0xdf6e('0x20')]||!_0x4aa22d['sentimentRegion']||!_0x4aa22d[_0xdf6e('0x21')]||!_0x4aa22d['bucket']){throw new db[(_0xdf6e('0x1d'))]['ValidationError'](_0xdf6e('0x22'));}if(!_0x3c6a2e['fileText']){throw new Error(_0xdf6e('0x23'));}if(_0x4aa22d[_0xdf6e('0x20')]===_0x12e817['id']){return _0x12e817;}else{return db['CloudProvider'][_0xdf6e('0x24')]({'where':{'id':_settings[_0xdf6e('0x20')]}});}})[_0xdf6e('0xe')](function(_0x227ab){if(!_0x227ab){throw new db['Sequelize'][(_0xdf6e('0x1e'))](_0xdf6e('0x25'));}if(!_0x227ab[_0xdf6e('0x26')]||!_0x227ab[_0xdf6e('0xc')]){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))](_0xdf6e('0x27'));}_0x18a504=_0x227ab;logger[_0xdf6e('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x142fa3['id']));return sentiment(_0x18a504[_0xdf6e('0x26')],_0x18a504[_0xdf6e('0xc')],_0x4aa22d['sentimentRegion'],_0x3c6a2e['fileText'],_0x4aa22d[_0xdf6e('0x21')]);})[_0xdf6e('0xe')](function(_0x38449c){logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')](_0xdf6e('0x28'),_0x142fa3['id']));return _0x142fa3[_0xdf6e('0x1a')]({'sentiment':_0x38449c[_0xdf6e('0x29')],'sPositive':_0x38449c[_0xdf6e('0x2a')]['Positive'],'sNegative':_0x38449c['SentimentScore'][_0xdf6e('0x2b')],'sMixed':_0x38449c['SentimentScore'][_0xdf6e('0x2c')],'sNeutral':_0x38449c[_0xdf6e('0x2a')]['Neutral']});})[_0xdf6e('0xe')](function(){logger['info'](util[_0xdf6e('0xa')](_0xdf6e('0x1b'),_0x142fa3['id']));_0x3c9e75();});case'FAILED':return _0x142fa3[_0xdf6e('0x1a')]({'transcribeStatus':'FAILED','failureReason':_0x2eb619[_0xdf6e('0x12')][_0xdf6e('0x2d')]})[_0xdf6e('0xe')](function(){logger['info'](util[_0xdf6e('0xa')](_0xdf6e('0x1b'),_0x142fa3['id']));_0x3c9e75();});default:logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')](_0xdf6e('0x2e'),_0x142fa3['id']));break;}}else{return BPromise['resolve']()[_0xdf6e('0xe')](function(){if(!_0x142fa3[_0xdf6e('0x1c')]){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4aa22d[_0xdf6e('0x1f')]||!_0x4aa22d[_0xdf6e('0x20')]||!_0x4aa22d[_0xdf6e('0x2f')]||!_0x4aa22d[_0xdf6e('0x21')]||!_0x4aa22d[_0xdf6e('0x30')]){throw new db[(_0xdf6e('0x1d'))]['ValidationError'](_0xdf6e('0x22'));}if(!_0x142fa3[_0xdf6e('0x10')]){throw new Error(_0xdf6e('0x23'));}if(_0x4aa22d[_0xdf6e('0x20')]===_0x12e817['id']){return _0x12e817;}else{return db['CloudProvider'][_0xdf6e('0x24')]({'where':{'id':_settings[_0xdf6e('0x20')]}});}})['then'](function(_0x10ae3f){if(!_0x10ae3f){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))](_0xdf6e('0x25'));}if(!_0x10ae3f[_0xdf6e('0x26')]||!_0x10ae3f[_0xdf6e('0xc')]){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))](_0xdf6e('0x27'));}_0x18a504=_0x10ae3f;logger['info'](util[_0xdf6e('0xa')](_0xdf6e('0x31'),_0x142fa3['id']));return sentiment(_0x18a504[_0xdf6e('0x26')],_0x18a504[_0xdf6e('0xc')],_0x4aa22d[_0xdf6e('0x2f')],_0x142fa3[_0xdf6e('0x10')],_0x4aa22d[_0xdf6e('0x21')]);})['then'](function(_0x36c2b5){logger['info'](util[_0xdf6e('0xa')](_0xdf6e('0x28'),_0x142fa3['id']));return _0x142fa3[_0xdf6e('0x1a')]({'sentiment':_0x36c2b5[_0xdf6e('0x29')],'sPositive':_0x36c2b5['SentimentScore'][_0xdf6e('0x32')],'sNegative':_0x36c2b5[_0xdf6e('0x2a')][_0xdf6e('0x2b')],'sMixed':_0x36c2b5['SentimentScore'][_0xdf6e('0x2c')],'sNeutral':_0x36c2b5[_0xdf6e('0x2a')][_0xdf6e('0x33')],'transcribeStatus':_0xdf6e('0x11')});})[_0xdf6e('0xe')](function(){logger[_0xdf6e('0x9')](util[_0xdf6e('0xa')](_0xdf6e('0x1b'),_0x142fa3['id']));_0x3c9e75();});}})[_0xdf6e('0x34')](function(_0x5bb648){if(_0x5bb648){if(!_0x5bb648[_0xdf6e('0x35')]||_0x5bb648['name']!==_0xdf6e('0x36')){logger[_0xdf6e('0x37')](util[_0xdf6e('0xa')](_0xdf6e('0x38'),_0x142fa3['id']),util[_0xdf6e('0x39')](_0x5bb648,{'showHidden':![],'depth':null}));}}_0x3c9e75();});});}function checkTranscribe(){var _0x5ef843;var _0x47e822;var _0x4c94aa;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xdf6e('0x3a')}})[_0xdf6e('0xe')](function(_0x4a47c1){if(!_0x4a47c1||!_0x4a47c1[_0xdf6e('0x19')]){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))](_0xdf6e('0x3b'));}_0x5ef843=_0x4a47c1;return db[_0xdf6e('0x3c')][_0xdf6e('0x24')]({'where':{'id':0x1}});})['then'](function(_0x1fe891){if(!_0x1fe891){throw new db[(_0xdf6e('0x1d'))]['ValidationError'](_0xdf6e('0x3d'));}_0x47e822=_0x1fe891;if(!_0x47e822['transcribe']||!_0x47e822[_0xdf6e('0x3e')]||!_0x47e822[_0xdf6e('0xd')]||!_0x47e822[_0xdf6e('0x21')]||!_0x47e822[_0xdf6e('0x30')]){throw new db[(_0xdf6e('0x1d'))]['ValidationError'](_0xdf6e('0x3f'));}return db[_0xdf6e('0x40')][_0xdf6e('0x24')]({'where':{'id':_0x47e822[_0xdf6e('0x3e')]}});})[_0xdf6e('0xe')](function(_0x1275b6){if(!_0x1275b6){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1275b6[_0xdf6e('0x26')]||!_0x1275b6['data2']){throw new db[(_0xdf6e('0x1d'))][(_0xdf6e('0x1e'))](_0xdf6e('0x27'));}_0x4c94aa=_0x1275b6;var _0x3b328c=[];_0x5ef843[_0xdf6e('0x41')](function(_0x5768f1){_0x3b328c[_0xdf6e('0x42')](checkTranscribeJob(_0x5768f1,_0x47e822,_0x4c94aa));});return BPromise[_0xdf6e('0x43')](_0x3b328c);})['catch'](function(_0x15b6b6){if(_0x15b6b6){if(!_0x15b6b6[_0xdf6e('0x35')]||_0x15b6b6['name']!==_0xdf6e('0x36')){logger[_0xdf6e('0x37')](util['inspect'](_0x15b6b6,{'showHidden':![],'depth':null}));}}});}exports[_0xdf6e('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xfbb4=['[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeName','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason'];(function(_0x18b0f3,_0x1a6400){var _0x2ba606=function(_0x563ce7){while(--_0x563ce7){_0x18b0f3['push'](_0x18b0f3['shift']());}};_0x2ba606(++_0x1a6400);}(_0xfbb4,0x186));var _0x4fbb=function(_0x11c15a,_0x167c2b){_0x11c15a=_0x11c15a-0x0;var _0x11570a=_0xfbb4[_0x11c15a];return _0x11570a;};var _=require(_0x4fbb('0x0'));var AWS=require(_0x4fbb('0x1'));var rp=require(_0x4fbb('0x2'));var util=require(_0x4fbb('0x3'));var BPromise=require(_0x4fbb('0x4'));var db=require(_0x4fbb('0x5'))['db'];var logger=require(_0x4fbb('0x6'))(_0x4fbb('0x7'));function getTranscriptionJob(_0x5c67e4,_0x514d23,_0x16c6f2,_0xba265e){return new Promise(function(_0x2b5756,_0x306f07){var _0x5f0b6b=new AWS['TranscribeService']({'accessKeyId':_0x514d23,'secretAccessKey':_0x5c67e4,'region':_0x16c6f2});_0x5f0b6b['getTranscriptionJob']({'TranscriptionJobName':_0xba265e},function(_0x4e57d7,_0xa17d45){if(_0x4e57d7){return _0x306f07(_0x4e57d7);}else{return _0x2b5756(_0xa17d45);}});});}function sentiment(_0x45ac3e,_0x5574b4,_0xc9ddea,_0xc3ed78,_0x4cac34){return new Promise(function(_0x360c27,_0x208526){var _0x1ecd42=new AWS[(_0x4fbb('0x8'))]({'accessKeyId':_0x5574b4,'secretAccessKey':_0x45ac3e,'region':_0xc9ddea});_0x1ecd42[_0x4fbb('0x9')]({'Text':_0xc3ed78,'LanguageCode':_0x4cac34['substring'](0x0,0x2)},function(_0xa148,_0x3e349){if(_0xa148){return _0x208526(_0xa148);}else{return _0x360c27(_0x3e349);}});});}function checkTranscribeJob(_0x3b94dc,_0x2aec34,_0x340523){var _0x486020;return new BPromise(function(_0x5f2a54,_0x19dd5e){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0xc'),_0x3b94dc['id'],_0x3b94dc['transcribeName']));return getTranscriptionJob(_0x340523[_0x4fbb('0xd')],_0x340523['data2'],_0x2aec34['transcribeRegion'],_0x3b94dc[_0x4fbb('0xe')])[_0x4fbb('0xf')](function(_0x4c47ff){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3b94dc['id'],_0x3b94dc['transcribeName'],_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')]));if(!_0x3b94dc[_0x4fbb('0x12')]){switch(_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')]){case _0x4fbb('0x13'):var _0x91e29f={'transcribeStatus':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')],'fileUri':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x14')][_0x4fbb('0x15')]};logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x16'),_0x3b94dc['id']));return rp({'uri':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x14')][_0x4fbb('0x15')],'json':!![]})[_0x4fbb('0xf')](function(_0x2db786){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x17'),_0x3b94dc['id']));if(_0x2db786&&_0x2db786[_0x4fbb('0x18')]&&_0x2db786['results']['transcripts']&&_0x2db786[_0x4fbb('0x18')][_0x4fbb('0x19')][_0x4fbb('0x1a')]){_0x91e29f[_0x4fbb('0x12')]='';for(var _0x505c9d=0x0;_0x505c9d<_0x2db786[_0x4fbb('0x18')][_0x4fbb('0x19')]['length'];_0x505c9d++){_0x91e29f['fileText']+=_0x2db786['results'][_0x4fbb('0x19')][_0x505c9d][_0x4fbb('0x1b')]+'';}}return _0x3b94dc[_0x4fbb('0x1c')](_0x91e29f);})[_0x4fbb('0xf')](function(){logger['info'](util[_0x4fbb('0xb')](_0x4fbb('0x1d'),_0x3b94dc['id']));if(!_0x3b94dc[_0x4fbb('0x1e')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x20'));}if(!_0x2aec34[_0x4fbb('0x21')]||!_0x2aec34[_0x4fbb('0x22')]||!_0x2aec34[_0x4fbb('0x23')]||!_0x2aec34[_0x4fbb('0x24')]||!_0x2aec34[_0x4fbb('0x25')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x91e29f[_0x4fbb('0x12')]){throw new Error(_0x4fbb('0x26'));}if(_0x2aec34[_0x4fbb('0x22')]===_0x340523['id']){return _0x340523;}else{return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_settings[_0x4fbb('0x22')]}});}})[_0x4fbb('0xf')](function(_0x4f112c){if(!_0x4f112c){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x4f112c[_0x4fbb('0xd')]||!_0x4f112c['data2']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x2a'));}_0x486020=_0x4f112c;logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x2b'),_0x3b94dc['id']));return sentiment(_0x486020['data1'],_0x486020[_0x4fbb('0x2c')],_0x2aec34['sentimentRegion'],_0x91e29f['fileText'],_0x2aec34[_0x4fbb('0x24')]);})['then'](function(_0x3c2be1){logger[_0x4fbb('0xa')](util['format'](_0x4fbb('0x2d'),_0x3b94dc['id']));return _0x3b94dc[_0x4fbb('0x1c')]({'sentiment':_0x3c2be1[_0x4fbb('0x2e')],'sPositive':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x30')],'sNegative':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x31')],'sMixed':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x32')],'sNeutral':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x33')]});})[_0x4fbb('0xf')](function(){logger['info'](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b94dc['id']));_0x5f2a54();});case _0x4fbb('0x34'):return _0x3b94dc[_0x4fbb('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x35')]})[_0x4fbb('0xf')](function(){logger['info'](util['format'](_0x4fbb('0x1d'),_0x3b94dc['id']));_0x5f2a54();});default:logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x36'),_0x3b94dc['id']));break;}}else{return BPromise[_0x4fbb('0x37')]()[_0x4fbb('0xf')](function(){if(!_0x3b94dc['tempSentiment']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x20'));}if(!_0x2aec34['sentiment']||!_0x2aec34[_0x4fbb('0x22')]||!_0x2aec34[_0x4fbb('0x23')]||!_0x2aec34['language']||!_0x2aec34['bucket']){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x38'));}if(!_0x3b94dc[_0x4fbb('0x12')]){throw new Error(_0x4fbb('0x26'));}if(_0x2aec34[_0x4fbb('0x22')]===_0x340523['id']){return _0x340523;}else{return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_settings[_0x4fbb('0x22')]}});}})[_0x4fbb('0xf')](function(_0x19ea9d){if(!_0x19ea9d){throw new db[(_0x4fbb('0x29'))][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x19ea9d[_0x4fbb('0xd')]||!_0x19ea9d[_0x4fbb('0x2c')]){throw new db[(_0x4fbb('0x29'))][(_0x4fbb('0x1f'))](_0x4fbb('0x2a'));}_0x486020=_0x19ea9d;logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b94dc['id']));return sentiment(_0x486020[_0x4fbb('0xd')],_0x486020[_0x4fbb('0x2c')],_0x2aec34[_0x4fbb('0x23')],_0x3b94dc[_0x4fbb('0x12')],_0x2aec34[_0x4fbb('0x24')]);})[_0x4fbb('0xf')](function(_0x5bbd77){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3b94dc['id']));return _0x3b94dc[_0x4fbb('0x1c')]({'sentiment':_0x5bbd77[_0x4fbb('0x2e')],'sPositive':_0x5bbd77['SentimentScore'][_0x4fbb('0x30')],'sNegative':_0x5bbd77[_0x4fbb('0x2f')]['Negative'],'sMixed':_0x5bbd77[_0x4fbb('0x2f')][_0x4fbb('0x32')],'sNeutral':_0x5bbd77[_0x4fbb('0x2f')][_0x4fbb('0x33')],'transcribeStatus':_0x4fbb('0x13')});})[_0x4fbb('0xf')](function(){logger['info'](util['format'](_0x4fbb('0x1d'),_0x3b94dc['id']));_0x5f2a54();});}})['catch'](function(_0x574d10){if(_0x574d10){if(!_0x574d10[_0x4fbb('0x39')]||_0x574d10[_0x4fbb('0x39')]!=='SequelizeValidationError'){logger[_0x4fbb('0x3a')](util[_0x4fbb('0xb')](_0x4fbb('0x3b'),_0x3b94dc['id']),util[_0x4fbb('0x3c')](_0x574d10,{'showHidden':![],'depth':null}));}}_0x5f2a54();});});}function checkTranscribe(){var _0x38c149;var _0x143883;var _0x1b736d;return db[_0x4fbb('0x3d')]['findAll']({'where':{'transcribeStatus':_0x4fbb('0x3e')}})[_0x4fbb('0xf')](function(_0x12d624){if(!_0x12d624||!_0x12d624[_0x4fbb('0x1a')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x3f'));}_0x38c149=_0x12d624;return db[_0x4fbb('0x40')]['findOne']({'where':{'id':0x1}});})[_0x4fbb('0xf')](function(_0x236bea){if(!_0x236bea){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x41'));}_0x143883=_0x236bea;if(!_0x143883[_0x4fbb('0x7')]||!_0x143883[_0x4fbb('0x42')]||!_0x143883[_0x4fbb('0x43')]||!_0x143883[_0x4fbb('0x24')]||!_0x143883['bucket']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x44'));}return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_0x143883[_0x4fbb('0x42')]}});})[_0x4fbb('0xf')](function(_0x2030b5){if(!_0x2030b5){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x2030b5['data1']||!_0x2030b5[_0x4fbb('0x2c')]){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x2a'));}_0x1b736d=_0x2030b5;var _0x588f86=[];_0x38c149[_0x4fbb('0x45')](function(_0x12e00f){_0x588f86[_0x4fbb('0x46')](checkTranscribeJob(_0x12e00f,_0x143883,_0x1b736d));});return BPromise[_0x4fbb('0x47')](_0x588f86);})['catch'](function(_0x5a655c){if(_0x5a655c){if(!_0x5a655c['name']||_0x5a655c['name']!==_0x4fbb('0x48')){logger['error'](util['inspect'](_0x5a655c,{'showHidden':![],'depth':null}));}}});}exports[_0x4fbb('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 5149168..1583cc2 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 _0xc4f1=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','[WHATSAPP]\x20Interactions\x20to\x20close:','system'];(function(_0x5dca7b,_0x42330b){var _0x99e3af=function(_0x540743){while(--_0x540743){_0x5dca7b['push'](_0x5dca7b['shift']());}};_0x99e3af(++_0x42330b);}(_0xc4f1,0x8a));var _0x1c4f=function(_0x5dc043,_0x25e5ca){_0x5dc043=_0x5dc043-0x0;var _0x256baf=_0xc4f1[_0x5dc043];return _0x256baf;};'use strict';var _=require(_0x1c4f('0x0'));var moment=require('moment');var Redis=require(_0x1c4f('0x1'));var util=require(_0x1c4f('0x2'));var config=require(_0x1c4f('0x3'));var db=require(_0x1c4f('0x4'))['db'];var logger=require('../logger')(_0x1c4f('0x5'));config[_0x1c4f('0x6')]=_['defaults'](config['redis'],{'host':_0x1c4f('0x7'),'port':0x18eb});var io=require(_0x1c4f('0x8'))(new Redis(config[_0x1c4f('0x6')]));function closeInteractions(){var _0x2c55c6=[];return db[_0x1c4f('0x9')][_0x1c4f('0xa')]({'raw':!![],'attributes':['id',_0x1c4f('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1c4f('0xc')](0x18,_0x1c4f('0xd'))}}})[_0x1c4f('0xe')](function(_0x176e78){if(_0x176e78&&_0x176e78['length']){_0x2c55c6=_['map'](_0x176e78||[],'id');logger['info'](_0x1c4f('0xf'),_0x2c55c6['join']());return db[_0x1c4f('0x9')]['update']({'closeReason':_0x1c4f('0x10'),'disposition':_0x1c4f('0x11'),'closed':!![],'closedAt':moment()[_0x1c4f('0x12')](_0x1c4f('0x13'))},{'where':{'id':_0x2c55c6}});}})[_0x1c4f('0xe')](function(){if(_0x2c55c6&&_0x2c55c6['length']){logger[_0x1c4f('0x14')](_0x1c4f('0x15'),_0x2c55c6[_0x1c4f('0x16')]());for(var _0x23551e=0x0;_0x23551e<_0x2c55c6[_0x1c4f('0x17')];_0x23551e++){io[_0x1c4f('0x18')](_0x1c4f('0x19'),{'id':_0x2c55c6[_0x23551e],'closed':!![]});}}})[_0x1c4f('0x1a')](function(_0x4099c0){logger[_0x1c4f('0x1b')](_0x1c4f('0x1c'),_0x4099c0?util[_0x1c4f('0x1d')](_0x4099c0,{'showHidden':![],'depth':null}):'');});}exports[_0x1c4f('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa24d=['findAll','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa24d,0x1c1));var _0xda24=function(_0x182cdd,_0x20c7d1){_0x182cdd=_0x182cdd-0x0;var _0x5c4424=_0xa24d[_0x182cdd];return _0x5c4424;};'use strict';var _=require(_0xda24('0x0'));var moment=require(_0xda24('0x1'));var Redis=require(_0xda24('0x2'));var util=require(_0xda24('0x3'));var config=require(_0xda24('0x4'));var db=require(_0xda24('0x5'))['db'];var logger=require(_0xda24('0x6'))('schedule');config[_0xda24('0x7')]=_[_0xda24('0x8')](config[_0xda24('0x7')],{'host':_0xda24('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda24('0x7')]));function closeInteractions(){var _0xdba54e=[];return db['WhatsappInteraction'][_0xda24('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xda24('0xb')](0x18,_0xda24('0xc'))}}})[_0xda24('0xd')](function(_0x1dccb2){if(_0x1dccb2&&_0x1dccb2['length']){_0xdba54e=_[_0xda24('0xe')](_0x1dccb2||[],'id');logger[_0xda24('0xf')](_0xda24('0x10'),_0xdba54e[_0xda24('0x11')]());return db[_0xda24('0x12')]['update']({'closeReason':_0xda24('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xda24('0x14')](_0xda24('0x15'))},{'where':{'id':_0xdba54e}});}})['then'](function(){if(_0xdba54e&&_0xdba54e['length']){logger[_0xda24('0xf')](_0xda24('0x16'),_0xdba54e[_0xda24('0x11')]());for(var _0x2d271d=0x0;_0x2d271d<_0xdba54e['length'];_0x2d271d++){io[_0xda24('0x17')]('whatsappInteraction:update',{'id':_0xdba54e[_0x2d271d],'closed':!![]});}}})[_0xda24('0x18')](function(_0x19b731){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x19b731?util[_0xda24('0x19')](_0x19b731,{'showHidden':![],'depth':null}):'');});}exports[_0xda24('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 1901de6..36c1cbc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d61=['finished\x20populating','contacts1','log','hopper1','CmHopper','hopper2','util','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','@xcally.com','CmContact','destroy','bulkCreate','then'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x5d61,0xcc));var _0x15d6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5d61[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x15d6('0x0'));var db=require(_0x15d6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x15d6('0x2')]({'id':i,'firstName':_0x15d6('0x3')+i,'lastName':_0x15d6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x15d6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x15d6('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x15d6('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x15d6('0x2')]({'id':i,'firstName':_0x15d6('0x3')+i,'lastName':_0x15d6('0x4')+i,'phone':0xf879fb460+i,'email':_0x15d6('0x6')+i+_0x15d6('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x15d6('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x15d6('0x5')](),'updatedAt':Date[_0x15d6('0x5')]()});}db[_0x15d6('0x8')][_0x15d6('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x15d6('0xa')](contacts);})[_0x15d6('0xb')](function(){console['log'](_0x15d6('0xc'),_0x15d6('0xd'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db['CmHopper'][_0x15d6('0xa')](hopper);})[_0x15d6('0xb')](function(){console[_0x15d6('0xe')]('finished\x20populating',_0x15d6('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0x15d6('0xb')](function(){console[_0x15d6('0xe')](_0x15d6('0xc'),'contacts2');return db[_0x15d6('0x10')]['bulkCreate'](hopper2);})[_0x15d6('0xb')](function(){console[_0x15d6('0xe')](_0x15d6('0xc'),_0x15d6('0x11'));})['catch'](function(_0x28377a){console[_0x15d6('0xe')](_0x28377a);}); \ No newline at end of file +var _0x8901=['@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','contacts2','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x29917f,_0x49f2ba){var _0x23b1a2=function(_0x7741bb){while(--_0x7741bb){_0x29917f['push'](_0x29917f['shift']());}};_0x23b1a2(++_0x49f2ba);}(_0x8901,0x1cc));var _0x1890=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0x8901[_0x426711];return _0x592991;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1890('0x0')]({'id':i,'firstName':_0x1890('0x1')+i,'lastName':_0x1890('0x2')+i,'phone':0xf879fb460+i,'email':_0x1890('0x3')+i+_0x1890('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x1890('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1890('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x1890('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1890('0x3')+i+_0x1890('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1890('0x5')](),'updatedAt':Date[_0x1890('0x5')]()});}db[_0x1890('0x6')][_0x1890('0x7')]({'where':{}})[_0x1890('0x8')](function(){return db[_0x1890('0x6')][_0x1890('0x9')](contacts);})[_0x1890('0x8')](function(){console[_0x1890('0xa')](_0x1890('0xb'),'contacts1');return db['CmHopper'][_0x1890('0x7')]({'where':{}});})[_0x1890('0x8')](function(){return db[_0x1890('0xc')][_0x1890('0x9')](hopper);})[_0x1890('0x8')](function(){console['log'](_0x1890('0xb'),'hopper1');return db['CmContact'][_0x1890('0x9')](contacts2);})[_0x1890('0x8')](function(){console[_0x1890('0xa')](_0x1890('0xb'),_0x1890('0xd'));return db[_0x1890('0xc')][_0x1890('0x9')](hopper2);})[_0x1890('0x8')](function(){console[_0x1890('0xa')]('finished\x20populating',_0x1890('0xe'));})[_0x1890('0xf')](function(_0x3b5723){console[_0x1890('0xa')](_0x3b5723);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 509b73d..1f4f4f7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7530=['%s%s@xcally.com','friend','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','agent'];(function(_0x15b610,_0x3c4201){var _0xb54f4a=function(_0x99bc00){while(--_0x99bc00){_0x15b610['push'](_0x15b610['shift']());}};_0xb54f4a(++_0x3c4201);}(_0x7530,0x11b));var _0x0753=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x7530[_0x422ac3];return _0x53c0d4;};'use strict';var util=require(_0x0753('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0753('0x1')]({'name':util[_0x0753('0x2')](_0x0753('0x3'),_0x0753('0x4'),i),'fullname':util[_0x0753('0x2')](_0x0753('0x3'),'agent',i),'email':util[_0x0753('0x2')](_0x0753('0x5'),_0x0753('0x4'),i),'role':_0x0753('0x4'),'password':'password','internal':0xfa0+i,'type':_0x0753('0x6'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0x0753('0x7')],'defaultuser':util[_0x0753('0x2')](_0x0753('0x3'),_0x0753('0x4'),i),'encryption':_0x0753('0x8'),'avpf':_0x0753('0x8'),'force_avp':'yes','icesupport':_0x0753('0x8'),'dtlsenable':_0x0753('0x8'),'dtlsverify':'no','dtlscertfile':_0x0753('0x9'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x0753('0xa'),'callerid':util[_0x0753('0x2')](_0x0753('0xb'),util[_0x0753('0x2')](_0x0753('0x3'),'agent',i),0xfa0+i)});}db[_0x0753('0xc')][_0x0753('0xd')](users)[_0x0753('0xe')](function(){console[_0x0753('0xf')](_0x0753('0x10'));})[_0x0753('0x11')](function(_0x41ce53){console[_0x0753('0xf')](_0x41ce53);}); \ No newline at end of file +var _0xb8e7=['format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','catch','../mysqldb','push'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xb8e7,0x12e));var _0x7b8e=function(_0x1ea80a,_0x5d7b9a){_0x1ea80a=_0x1ea80a-0x0;var _0x4e39e9=_0xb8e7[_0x1ea80a];return _0x4e39e9;};'use strict';var util=require('util');var db=require(_0x7b8e('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7b8e('0x1')]({'name':util[_0x7b8e('0x2')](_0x7b8e('0x3'),_0x7b8e('0x4'),i),'fullname':util[_0x7b8e('0x2')]('%s%s',_0x7b8e('0x4'),i),'email':util[_0x7b8e('0x2')](_0x7b8e('0x5'),_0x7b8e('0x4'),i),'role':'agent','password':_0x7b8e('0x6'),'internal':0xfa0+i,'type':_0x7b8e('0x7'),'transport':['udp','ws',_0x7b8e('0x8')],'disallow':[_0x7b8e('0x9')],'allow':['ulaw'],'defaultuser':util[_0x7b8e('0x2')](_0x7b8e('0x3'),_0x7b8e('0x4'),i),'encryption':_0x7b8e('0xa'),'avpf':'yes','force_avp':_0x7b8e('0xa'),'icesupport':_0x7b8e('0xa'),'dtlsenable':_0x7b8e('0xa'),'dtlsverify':'no','dtlscertfile':_0x7b8e('0xb'),'dtlsprivatekey':_0x7b8e('0xc'),'dtlssetup':_0x7b8e('0xd'),'callerid':util['format'](_0x7b8e('0xe'),util[_0x7b8e('0x2')](_0x7b8e('0x3'),_0x7b8e('0x4'),i),0xfa0+i)});}db[_0x7b8e('0xf')]['bulkCreate'](users)[_0x7b8e('0x10')](function(){console[_0x7b8e('0x11')]('add\x20user');})[_0x7b8e('0x12')](function(_0x12df22){console[_0x7b8e('0x11')](_0x12df22);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 02eccad..e67ad09 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2ad=['IvrCampaigns','UserProfileResource','map','where','Campaign','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','WhatsappQueues','Trunks','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','fax','sms','openchannel','whatsapp','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','log','join','default','connection','request','remoteAddress','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll'];(function(_0x307fcf,_0x394370){var _0x35522f=function(_0x3b78ea){while(--_0x3b78ea){_0x307fcf['push'](_0x307fcf['shift']());}};_0x35522f(++_0x394370);}(_0xb2ad,0x16d));var _0xdb2a=function(_0xf79f3a,_0x3fe081){_0xf79f3a=_0xf79f3a-0x0;var _0x270c6b=_0xb2ad[_0xf79f3a];return _0x270c6b;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var BPromise=require('bluebird');var db=require(_0xdb2a('0x1'))['db'];var config=require(_0xdb2a('0x2'));var queryQueues={'attributes':['id',_0xdb2a('0x3')],'include':[{'as':_0xdb2a('0x4'),'model':db[_0xdb2a('0x5')],'attributes':['id','name',_0xdb2a('0x6')],'raw':!![],'where':{'role':_0xdb2a('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdb2a('0x3')],'where':{'role':_0xdb2a('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xdb2a('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdb2a('0x3'),_0xdb2a('0x9')],'where':{'type':_0xdb2a('0xa')}};function getAssociatedResources(_0x49db65,_0x2239e6,_0x29f542){return db['UserProfileSection'][_0xdb2a('0xb')]({'where':{'name':_0x49db65,'userProfileId':_0x2239e6},'raw':!![]})[_0xdb2a('0xc')](function(_0x4bdf25){if(_0x4bdf25){if(_0x4bdf25['autoAssociation']){switch(_0x49db65){case _0xdb2a('0xd'):case _0xdb2a('0xe'):case _0xdb2a('0xf'):case'SmsQueues':case _0xdb2a('0x10'):case _0xdb2a('0x11'):case'WhatsappQueues':return db[_0x29f542]['findAll'](queryQueues);case'Telephones':return db[_0x29f542][_0xdb2a('0x12')](queryTelephones);case'Trunks':return db[_0x29f542][_0xdb2a('0x12')](queryTrunks);case _0xdb2a('0x13'):return db[_0x29f542]['findAll'](queryCampaigns);}}else{return db[_0xdb2a('0x14')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x4bdf25['id']},'raw':!![]})['then'](function(_0x5dbbb1){if(_0x5dbbb1){var _0x8a580e={'where':{'id':_[_0xdb2a('0x15')](_0x5dbbb1,'resourceId')},'raw':!![]};switch(_0x29f542){case'User':_0x8a580e[_0xdb2a('0x16')][_0xdb2a('0x6')]=_0xdb2a('0x8');break;case _0xdb2a('0x17'):_0x8a580e['where'][_0xdb2a('0x9')]=_0xdb2a('0xa');break;}return db[_0x29f542][_0xdb2a('0x12')](_0x8a580e);}else{return[];}});}}else{return[];}})['then'](function(_0x566175){return _0x566175;});}function joinOrLeaveQueues(_0x424583,_0x21d3b2,_0x125233,_0x3a9cb1){_0x424583[_0x21d3b2](util[_0xdb2a('0x18')]('%s:queue:%s',_0x125233,_0x3a9cb1[_0xdb2a('0x3')]));if(_0x3a9cb1['Agents']){for(var _0x444fcf=0x0;_0x444fcf<_0x3a9cb1['Agents']['length'];_0x444fcf+=0x1){_0x424583[_0x21d3b2](util[_0xdb2a('0x18')](_0xdb2a('0x19'),_0x3a9cb1[_0xdb2a('0x4')][_0x444fcf]['name']));}}}function joinOrLeave(_0x1a79ac,_0x871b44,_0x16035f){var _0x391378;if(_0x1a79ac[_0xdb2a('0x1a')][_0xdb2a('0x1b')]['id']){db['User'][_0xdb2a('0x1c')]({'attributes':['id',_0xdb2a('0x3'),'role',_0xdb2a('0x1d')],'where':{'id':_0x1a79ac[_0xdb2a('0x1a')][_0xdb2a('0x1b')]['id']},'include':[{'model':db[_0xdb2a('0x1e')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdb2a('0x1f')],'as':_0xdb2a('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xdb2a('0x21')],'as':_0xdb2a('0x22'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xdb2a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xdb2a('0x24')],'as':_0xdb2a('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xdb2a('0x26')],'as':_0xdb2a('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x852103){if(_0x852103){_0x391378=_0x852103;_0x1a79ac[_0x871b44](util[_0xdb2a('0x18')](_0xdb2a('0x19'),_0x852103[_0xdb2a('0x3')]));var _0x65b6c3=[];switch(_0x852103[_0xdb2a('0x6')]){case _0xdb2a('0x28'):_0x1a79ac[_0x871b44](_0xdb2a('0x29'));_0x1a79ac[_0x871b44](_0xdb2a('0x2a'));if(queryQueues[_0xdb2a('0x2b')](_0xdb2a('0x2c'))){delete queryQueues[_0xdb2a('0x2c')];}_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x2e')][_0xdb2a('0x12')](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x2f')][_0xdb2a('0x12')](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x30')]['findAll'](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x31')][_0xdb2a('0x12')](queryQueues));_0x65b6c3['push'](db[_0xdb2a('0x32')][_0xdb2a('0x12')](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x33')][_0xdb2a('0x12')](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x34')][_0xdb2a('0x12')](queryQueues));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x5')][_0xdb2a('0x12')](queryTelephones));_0x65b6c3[_0xdb2a('0x2d')](db[_0xdb2a('0x35')][_0xdb2a('0x12')](queryTrunks));_0x65b6c3[_0xdb2a('0x2d')](db['Campaign'][_0xdb2a('0x12')](queryCampaigns));_0x65b6c3['push'](db['User'][_0xdb2a('0x12')](queryAgents));break;case _0xdb2a('0x36'):_0x1a79ac[_0x871b44](_0xdb2a('0x29'));_0x1a79ac[_0x871b44](_0xdb2a('0x2a'));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources('VoiceQueues',_0x852103['userProfileId'],_0xdb2a('0x2e')));_0x65b6c3['push'](getAssociatedResources('ChatQueues',_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x2f')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources('FaxQueues',_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x30')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources('SmsQueues',_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x31')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources(_0xdb2a('0x10'),_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x32')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources('OpenchannelQueues',_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x33')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources(_0xdb2a('0x37'),_0x852103['userProfileId'],_0xdb2a('0x34')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources('Telephones',_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x5')));_0x65b6c3[_0xdb2a('0x2d')](getAssociatedResources(_0xdb2a('0x38'),_0x852103['userProfileId'],'Trunk'));_0x65b6c3['push'](getAssociatedResources(_0xdb2a('0x13'),_0x852103[_0xdb2a('0x1d')],_0xdb2a('0x17')));_0x65b6c3['push'](db['User']['findAll'](queryAgents));break;case _0xdb2a('0x7'):_0x1a79ac[_0x871b44]('voice:inbound');_0x1a79ac[_0x871b44](_0xdb2a('0x2a'));_0x65b6c3[_0xdb2a('0x2d')](_0x852103[_0xdb2a('0x39')]({'attributes':['id',_0xdb2a('0x3')]}));_0x65b6c3['push'](_0x852103[_0xdb2a('0x3a')]({'attributes':['id',_0xdb2a('0x3')]}));_0x65b6c3[_0xdb2a('0x2d')](_0x852103['getFaxQueues']({'attributes':['id',_0xdb2a('0x3')]}));_0x65b6c3[_0xdb2a('0x2d')](_0x852103[_0xdb2a('0x3b')]({'attributes':['id',_0xdb2a('0x3')]}));_0x65b6c3['push'](_0x852103[_0xdb2a('0x3c')]({'attributes':['id','name']}));_0x65b6c3[_0xdb2a('0x2d')](_0x852103['getOpenchannelQueues']({'attributes':['id','name']}));_0x65b6c3[_0xdb2a('0x2d')](_0x852103[_0xdb2a('0x3d')]({'attributes':['id',_0xdb2a('0x3')]}));break;}return BPromise[_0xdb2a('0x3e')](_0x65b6c3);}})[_0xdb2a('0xc')](function(_0x474255){if(_0x474255&&_0x474255[_0xdb2a('0x3f')]){for(var _0x4f99d3=0x0;_0x4f99d3<_0x474255[_0xdb2a('0x3f')];_0x4f99d3+=0x1){for(var _0x42010a=0x0;_0x42010a<_0x474255[_0x4f99d3][_0xdb2a('0x3f')];_0x42010a+=0x1){switch(_0x4f99d3){case 0x0:joinOrLeaveQueues(_0x1a79ac,_0x871b44,_0xdb2a('0x40'),_0x474255[_0x4f99d3][_0x42010a]);break;case 0x1:joinOrLeaveQueues(_0x1a79ac,_0x871b44,'chat',_0x474255[_0x4f99d3][_0x42010a]);break;case 0x2:joinOrLeaveQueues(_0x1a79ac,_0x871b44,_0xdb2a('0x41'),_0x474255[_0x4f99d3][_0x42010a]);break;case 0x3:joinOrLeaveQueues(_0x1a79ac,_0x871b44,_0xdb2a('0x42'),_0x474255[_0x4f99d3][_0x42010a]);break;case 0x4:joinOrLeaveQueues(_0x1a79ac,_0x871b44,'mail',_0x474255[_0x4f99d3][_0x42010a]);break;case 0x5:joinOrLeaveQueues(_0x1a79ac,_0x871b44,_0xdb2a('0x43'),_0x474255[_0x4f99d3][_0x42010a]);break;case 0x6:joinOrLeaveQueues(_0x1a79ac,_0x871b44,_0xdb2a('0x44'),_0x474255[_0x4f99d3][_0x42010a]);break;case 0x7:if(_0x391378[_0xdb2a('0x6')]!==_0xdb2a('0x7'))_0x1a79ac[_0x871b44](util['format']('telephone:%s',_0x474255[_0x4f99d3][_0x42010a][_0xdb2a('0x3')]));break;case 0x8:if(_0x391378['role']!==_0xdb2a('0x7'))_0x1a79ac[_0x871b44](util['format'](_0xdb2a('0x45'),_0x474255[_0x4f99d3][_0x42010a][_0xdb2a('0x3')]));break;case 0x9:if(_0x391378[_0xdb2a('0x6')]!=='agent')_0x1a79ac[_0x871b44](util[_0xdb2a('0x18')](_0xdb2a('0x46'),_0x474255[_0x4f99d3][_0x42010a][_0xdb2a('0x9')],_0x474255[_0x4f99d3][_0x42010a]['name']));break;case 0xa:_0x1a79ac[_0x871b44](util[_0xdb2a('0x18')]('user:%s',_0x474255[_0x4f99d3][_0x42010a][_0xdb2a('0x3')]));break;}}}}})[_0xdb2a('0xc')](function(){if(_0x871b44==='leave'){var _0x2ce61c=_[_0xdb2a('0x15')](_0x391378[_0xdb2a('0x47')],'id');return _0x391378[_0xdb2a('0x48')](_0x2ce61c)['then'](function(){for(var _0x1d0864=0x0;_0x1d0864<_0x2ce61c[_0xdb2a('0x3f')];_0x1d0864+=0x1){_0x16035f[_0xdb2a('0x49')](_0xdb2a('0x4a'),{'ChatInteractionId':Number(_0x2ce61c[_0x1d0864]),'UserId':Number(_0x391378['id'])});}});}})[_0xdb2a('0xc')](function(){if(_0x871b44===_0xdb2a('0x4b')){var _0x14d224=_[_0xdb2a('0x15')](_0x391378['MailInteractions'],'id');return _0x391378['removeMailInteractions'](_0x14d224)[_0xdb2a('0xc')](function(){for(var _0x4746e3=0x0;_0x4746e3<_0x14d224[_0xdb2a('0x3f')];_0x4746e3+=0x1){_0x16035f[_0xdb2a('0x49')](_0xdb2a('0x4c'),{'MailInteractionId':Number(_0x14d224[_0x4746e3]),'UserId':Number(_0x391378['id'])});}});}})[_0xdb2a('0xc')](function(){if(_0x871b44===_0xdb2a('0x4b')){var _0x46def4=_[_0xdb2a('0x15')](_0x391378[_0xdb2a('0x22')],'id');return _0x391378[_0xdb2a('0x4d')](_0x46def4)[_0xdb2a('0xc')](function(){for(var _0x287ee0=0x0;_0x287ee0<_0x46def4[_0xdb2a('0x3f')];_0x287ee0+=0x1){_0x16035f['emit'](_0xdb2a('0x4e'),{'FaxInteractionId':Number(_0x46def4[_0x287ee0]),'UserId':Number(_0x391378['id'])});}});}})[_0xdb2a('0xc')](function(){if(_0x871b44===_0xdb2a('0x4b')){var _0x33c4d6=_['map'](_0x391378[_0xdb2a('0x23')],'id');return _0x391378[_0xdb2a('0x4f')](_0x33c4d6)[_0xdb2a('0xc')](function(){for(var _0x52589a=0x0;_0x52589a<_0x33c4d6[_0xdb2a('0x3f')];_0x52589a+=0x1){_0x16035f['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x33c4d6[_0x52589a]),'UserId':Number(_0x391378['id'])});}});}})['then'](function(){if(_0x871b44===_0xdb2a('0x4b')){var _0x3ac41d=_[_0xdb2a('0x15')](_0x391378[_0xdb2a('0x25')],'id');return _0x391378[_0xdb2a('0x50')](_0x3ac41d)[_0xdb2a('0xc')](function(){for(var _0x59ee7d=0x0;_0x59ee7d<_0x3ac41d['length'];_0x59ee7d+=0x1){_0x16035f['emit'](_0xdb2a('0x51'),{'OpenchannelInteractionId':Number(_0x3ac41d[_0x59ee7d]),'UserId':Number(_0x391378['id'])});}});}})[_0xdb2a('0xc')](function(){if(_0x871b44==='leave'){var _0x31b1a1=_['map'](_0x391378['WhatsappInteractions'],'id');return _0x391378[_0xdb2a('0x52')](_0x31b1a1)[_0xdb2a('0xc')](function(){for(var _0x167909=0x0;_0x167909<_0x31b1a1[_0xdb2a('0x3f')];_0x167909+=0x1){_0x16035f[_0xdb2a('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x31b1a1[_0x167909]),'UserId':Number(_0x391378['id'])});}});}})['catch'](function(_0x97a694){_0x1a79ac[_0xdb2a('0x53')](_0x97a694);});}}function onDisconnect(_0x39540b,_0x190bf3){joinOrLeave(_0x39540b,_0xdb2a('0x4b'),_0x190bf3);}function onConnect(_0x7a7fc5){joinOrLeave(_0x7a7fc5,_0xdb2a('0x54'));}exports[_0xdb2a('0x55')]=function(_0x15abb9){_0x15abb9['on'](_0xdb2a('0x56'),function(_0x2d8f19){_0x2d8f19['setMaxListeners'](0x0);_0x2d8f19['address']=_0x2d8f19[_0xdb2a('0x57')][_0xdb2a('0x56')][_0xdb2a('0x58')]+':'+_0x2d8f19[_0xdb2a('0x57')][_0xdb2a('0x56')]['remotePort'];_0x2d8f19[_0xdb2a('0x59')]=new Date();_0x2d8f19[_0xdb2a('0x53')]=function(_0x1eeeb3){console[_0xdb2a('0x53')](_0xdb2a('0x5a')+_0x2d8f19[_0xdb2a('0x5b')][_0xdb2a('0x3')]+'['+_0x2d8f19[_0xdb2a('0x5c')]+']',_0x1eeeb3);};_0x2d8f19['on'](_0xdb2a('0x5d'),function(){onDisconnect(_0x2d8f19,_0x15abb9);_0x2d8f19[_0xdb2a('0x53')](_0xdb2a('0x5e'));});onConnect(_0x2d8f19);_0x2d8f19[_0xdb2a('0x53')](_0xdb2a('0x5f'));});}; \ No newline at end of file +var _0x8d5e=['MailQueue','OpenchannelQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','ChatQueues','SmsQueues','MailQueues'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x8d5e[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var BPromise=require(_0xe8d5('0x2'));var db=require(_0xe8d5('0x3'))['db'];var config=require(_0xe8d5('0x4'));var queryQueues={'attributes':['id',_0xe8d5('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6')],'raw':!![],'where':{'role':_0xe8d5('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':_0xe8d5('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe8d5('0x8')],'where':{'type':_0xe8d5('0x9')}};function getAssociatedResources(_0x1aaa23,_0x20cddc,_0x4e4eae){return db[_0xe8d5('0xa')][_0xe8d5('0xb')]({'where':{'name':_0x1aaa23,'userProfileId':_0x20cddc},'raw':!![]})['then'](function(_0x52b3d8){if(_0x52b3d8){if(_0x52b3d8[_0xe8d5('0xc')]){switch(_0x1aaa23){case _0xe8d5('0xd'):case'ChatQueues':case _0xe8d5('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0xe8d5('0xf'):return db[_0x4e4eae][_0xe8d5('0x10')](queryQueues);case _0xe8d5('0x11'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTelephones);case _0xe8d5('0x12'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTrunks);case _0xe8d5('0x13'):return db[_0x4e4eae][_0xe8d5('0x10')](queryCampaigns);}}else{return db[_0xe8d5('0x14')][_0xe8d5('0x10')]({'attributes':[_0xe8d5('0x15')],'where':{'sectionId':_0x52b3d8['id']},'raw':!![]})['then'](function(_0x2322e6){if(_0x2322e6){var _0xd213e1={'where':{'id':_['map'](_0x2322e6,_0xe8d5('0x15'))},'raw':!![]};switch(_0x4e4eae){case _0xe8d5('0x16'):_0xd213e1[_0xe8d5('0x17')][_0xe8d5('0x6')]='telephone';break;case _0xe8d5('0x18'):_0xd213e1[_0xe8d5('0x17')]['type']='ivr';break;}return db[_0x4e4eae][_0xe8d5('0x10')](_0xd213e1);}else{return[];}});}}else{return[];}})['then'](function(_0x46d317){return _0x46d317;});}function joinOrLeaveQueues(_0x5e3ad2,_0xe2bc71,_0x5933f0,_0x43c0a5){_0x5e3ad2[_0xe2bc71](util[_0xe8d5('0x19')](_0xe8d5('0x1a'),_0x5933f0,_0x43c0a5['name']));if(_0x43c0a5['Agents']){for(var _0x31dda5=0x0;_0x31dda5<_0x43c0a5['Agents'][_0xe8d5('0x1b')];_0x31dda5+=0x1){_0x5e3ad2[_0xe2bc71](util['format'](_0xe8d5('0x1c'),_0x43c0a5[_0xe8d5('0x1d')][_0x31dda5][_0xe8d5('0x5')]));}}}function joinOrLeave(_0x2dc4cc,_0x10de0a,_0x13e7c9){var _0x5c8c96;if(_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']){db['User'][_0xe8d5('0x20')]({'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6'),_0xe8d5('0x21')],'where':{'id':_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe8d5('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x23')],'as':_0xe8d5('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x25')],'as':_0xe8d5('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x27')],'as':_0xe8d5('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x29')],'as':_0xe8d5('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xe8d5('0x2b')](function(_0xc1ad95){if(_0xc1ad95){_0x5c8c96=_0xc1ad95;_0x2dc4cc[_0x10de0a](util['format']('user:%s',_0xc1ad95[_0xe8d5('0x5')]));var _0x215a67=[];switch(_0xc1ad95['role']){case _0xe8d5('0x2c'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));if(queryQueues[_0xe8d5('0x2f')]('include')){delete queryQueues[_0xe8d5('0x30')];}_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x32')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x33')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x34')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x35')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db['MailQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x36')]['findAll'](queryQueues));_0x215a67['push'](db['WhatsappQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67['push'](db[_0xe8d5('0x16')][_0xe8d5('0x10')](queryTelephones));_0x215a67['push'](db[_0xe8d5('0x37')][_0xe8d5('0x10')](queryTrunks));_0x215a67['push'](db[_0xe8d5('0x18')][_0xe8d5('0x10')](queryCampaigns));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x38'):_0x2dc4cc[_0x10de0a]('voice:inbound');_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xd'),_0xc1ad95['userProfileId'],_0xe8d5('0x32')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x39'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x33')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources('FaxQueues',_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x34')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3a'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x35')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3b'),_0xc1ad95['userProfileId'],_0xe8d5('0x3c')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3d'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x36')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xf'),_0xc1ad95[_0xe8d5('0x21')],'WhatsappQueue'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x11'),_0xc1ad95['userProfileId'],_0xe8d5('0x16')));_0x215a67['push'](getAssociatedResources(_0xe8d5('0x12'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x37')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x13'),_0xc1ad95['userProfileId'],'Campaign'));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x7'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a]('voice:outbound');_0x215a67[_0xe8d5('0x31')](_0xc1ad95['getVoiceQueues']({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3e')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3f')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x40')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x41')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x42')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0xe8d5('0x44')](_0x215a67);}})[_0xe8d5('0x2b')](function(_0x25d0f4){if(_0x25d0f4&&_0x25d0f4[_0xe8d5('0x1b')]){for(var _0xa3de7a=0x0;_0xa3de7a<_0x25d0f4[_0xe8d5('0x1b')];_0xa3de7a+=0x1){for(var _0x281346=0x0;_0x281346<_0x25d0f4[_0xa3de7a]['length'];_0x281346+=0x1){switch(_0xa3de7a){case 0x0:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x45'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x1:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x46'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x2:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x47'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x3:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x48'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x4:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x49'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x5:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4a'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x6:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4b'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x7:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4c'),_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x8:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')]('trunk:%s',_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x9:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4d'),_0x25d0f4[_0xa3de7a][_0x281346]['type'],_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;case 0xa:_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x1c'),_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;}}}}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x2233c2=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x22')],'id');return _0x5c8c96['removeChatInteractions'](_0x2233c2)[_0xe8d5('0x2b')](function(){for(var _0xf025b6=0x0;_0xf025b6<_0x2233c2[_0xe8d5('0x1b')];_0xf025b6+=0x1){_0x13e7c9[_0xe8d5('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2233c2[_0xf025b6]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x1218ff=_[_0xe8d5('0x4f')](_0x5c8c96['MailInteractions'],'id');return _0x5c8c96['removeMailInteractions'](_0x1218ff)[_0xe8d5('0x2b')](function(){for(var _0x5a64ca=0x0;_0x5a64ca<_0x1218ff[_0xe8d5('0x1b')];_0x5a64ca+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x51'),{'MailInteractionId':Number(_0x1218ff[_0x5a64ca]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x596f74=_['map'](_0x5c8c96['FaxInteractions'],'id');return _0x5c8c96[_0xe8d5('0x52')](_0x596f74)[_0xe8d5('0x2b')](function(){for(var _0x9a33b4=0x0;_0x9a33b4<_0x596f74[_0xe8d5('0x1b')];_0x9a33b4+=0x1){_0x13e7c9['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x596f74[_0x9a33b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x2ec9dd=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x28')],'id');return _0x5c8c96['removeSmsInteractions'](_0x2ec9dd)[_0xe8d5('0x2b')](function(){for(var _0xe7bbf1=0x0;_0xe7bbf1<_0x2ec9dd[_0xe8d5('0x1b')];_0xe7bbf1+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x53'),{'SmsInteractionId':Number(_0x2ec9dd[_0xe7bbf1]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x23de30=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x54')],'id');return _0x5c8c96[_0xe8d5('0x55')](_0x23de30)[_0xe8d5('0x2b')](function(){for(var _0x3e2ebe=0x0;_0x3e2ebe<_0x23de30[_0xe8d5('0x1b')];_0x3e2ebe+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x56'),{'OpenchannelInteractionId':Number(_0x23de30[_0x3e2ebe]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x1e1e29=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x2a')],'id');return _0x5c8c96[_0xe8d5('0x57')](_0x1e1e29)[_0xe8d5('0x2b')](function(){for(var _0x5e28b4=0x0;_0x5e28b4<_0x1e1e29[_0xe8d5('0x1b')];_0x5e28b4+=0x1){_0x13e7c9['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1e1e29[_0x5e28b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x58')](function(_0x501989){_0x2dc4cc[_0xe8d5('0x59')](_0x501989);});}}function onDisconnect(_0x1967dd,_0x50f81d){joinOrLeave(_0x1967dd,_0xe8d5('0x4e'),_0x50f81d);}function onConnect(_0x12d132){joinOrLeave(_0x12d132,_0xe8d5('0x5a'));}exports[_0xe8d5('0x5b')]=function(_0x2355c8){_0x2355c8['on'](_0xe8d5('0x5c'),function(_0x222dc9){_0x222dc9[_0xe8d5('0x5d')](0x0);_0x222dc9[_0xe8d5('0x5e')]=_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')][_0xe8d5('0x60')]+':'+_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')]['remotePort'];_0x222dc9['connectedAt']=new Date();_0x222dc9[_0xe8d5('0x59')]=function(_0x39dcbd){console[_0xe8d5('0x59')](_0xe8d5('0x61')+_0x222dc9[_0xe8d5('0x62')][_0xe8d5('0x5')]+'['+_0x222dc9['address']+']',_0x39dcbd);};_0x222dc9['on'](_0xe8d5('0x63'),function(){onDisconnect(_0x222dc9,_0x2355c8);_0x222dc9['log'](_0xe8d5('0x64'));});onConnect(_0x222dc9);_0x222dc9['log'](_0xe8d5('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a760928..dc994ed 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 _0x6228=['get','offlineMessage','opened','Sequelize','SELECT','UserId','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','catch','motionChannel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','then','contact','interface','format','SIP/%s','name','agent','channel','incomingmessage','AfterCreateMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6228,0x19d));var _0x8622=function(_0x19bbfc,_0x21231a){_0x19bbfc=_0x19bbfc-0x0;var _0x2a9521=_0x6228[_0x19bbfc];return _0x2a9521;};'use strict';var util=require(_0x8622('0x0'));var db=require(_0x8622('0x1'))['db'];var jayson=require(_0x8622('0x2'));var logger=require(_0x8622('0x3'))(_0x8622('0x4'));var client=jayson[_0x8622('0x5')][_0x8622('0x6')]({'port':0x232a});var triggers=[{'channel':_0x8622('0x7'),'model':_0x8622('0x8'),'event':_0x8622('0x9'),'condition':_0x8622('0xa'),'callback':afterCreate},{'channel':_0x8622('0x7'),'model':_0x8622('0x8'),'event':_0x8622('0xb'),'condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':_0x8622('0x7'),'model':'ChatMessage','event':_0x8622('0x9'),'condition':_0x8622('0xd'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x8622('0xe'),'event':_0x8622('0x9'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x8622('0xf'),'event':_0x8622('0x9'),'condition':_0x8622('0xa'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':'afterUpdate','condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':_0x8622('0x10'),'model':_0x8622('0x11'),'event':'afterCreate','condition':_0x8622('0xd'),'callback':afterCreateMessage},{'channel':_0x8622('0x12'),'model':'WhatsappInteraction','event':_0x8622('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x8622('0x13'),'event':'afterUpdate','condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x8622('0x14'),'event':'afterCreate','condition':_0x8622('0xd'),'callback':afterCreateMessage},{'channel':_0x8622('0x15'),'model':_0x8622('0x16'),'event':_0x8622('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8622('0x15'),'model':_0x8622('0x16'),'event':_0x8622('0xb'),'condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':'Fax','model':_0x8622('0x17'),'event':_0x8622('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8622('0x18'),'model':_0x8622('0x19'),'event':_0x8622('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8622('0x18'),'model':'MailInteraction','event':_0x8622('0xb'),'condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':_0x8622('0x18'),'model':_0x8622('0x1a'),'event':'afterCreate','condition':_0x8622('0xd'),'callback':afterCreateMessage},{'channel':_0x8622('0x1b'),'model':'OpenchannelInteraction','event':_0x8622('0x9'),'condition':_0x8622('0xa'),'callback':afterCreate},{'channel':_0x8622('0x1b'),'model':_0x8622('0x1c'),'event':_0x8622('0xb'),'condition':_0x8622('0xc'),'callback':afterUpdate},{'channel':_0x8622('0x1b'),'model':_0x8622('0x1d'),'event':_0x8622('0x9'),'condition':_0x8622('0xd'),'callback':afterCreateMessage}];function request(_0x3590de){return client[_0x8622('0x1e')](_0x8622('0x1f'),_0x3590de)['then'](function(_0x1772c5){logger[_0x8622('0x20')](_0x8622('0x21'),_0x8622('0x1f'),_0x1772c5);if(_0x1772c5[_0x8622('0x22')]){if(_0x1772c5['error']['code']===0x1f4){logger[_0x8622('0x22')](_0x8622('0x21'),_0x8622('0x1f'),_0x1772c5[_0x8622('0x22')]);}}})[_0x8622('0x23')](function(_0xc68769){logger[_0x8622('0x22')](_0x8622('0x21'),_0x8622('0x1f'),_0xc68769);});}function afterCreateMessage(_0x4d7070){return function(_0x328e33){_0x328e33=_0x328e33['get']({'plain':!![]});_0x328e33['channel']=_0x4d7070;_0x328e33[_0x8622('0x24')]=_0x4d7070;_0x328e33[_0x8622('0x25')]=_0x328e33['direction'];Promise[_0x8622('0x26')]()['then'](function(){if(typeof _0x328e33[_0x8622('0x27')]===_0x8622('0x28'))return null;var _0x56a0c5=_0x8622('0x29')+_0x328e33[_0x8622('0x27')];return db[_0x8622('0x2a')][_0x8622('0x2b')](_0x56a0c5,{'type':db['Sequelize'][_0x8622('0x2c')]['SELECT'],'raw':!![]});})[_0x8622('0x2d')](function(_0x52c181){if(_0x52c181){_0x328e33[_0x8622('0x2e')]=_0x52c181[0x0];}if(typeof _0x328e33['UserId']==='undefined')return;return getAgent(_0x328e33['UserId']);})[_0x8622('0x2d')](function(_0x2df2dc){if(_0x2df2dc){_0x328e33[_0x8622('0x2f')]=util[_0x8622('0x30')](_0x8622('0x31'),_0x2df2dc[_0x8622('0x32')]);_0x328e33[_0x8622('0x33')]=_0x2df2dc;_0x328e33[_0x8622('0x34')]=_0x4d7070;return request({'event':_0x8622('0x35'),'message':_0x328e33});}else{return request({'event':'outgoingmessage','message':_0x328e33});}})[_0x8622('0x23')](function(_0x3887df){logger[_0x8622('0x22')](_0x8622('0x21'),_0x8622('0x36'),_0x3887df);});};}function afterCreateOfflineMessage(_0xa856df){return function(_0x38e40b){_0x38e40b=_0x38e40b[_0x8622('0x37')]({'plain':!![]});_0x38e40b[_0x8622('0x34')]=_0xa856df;_0x38e40b[_0x8622('0x24')]=_0xa856df;_0x38e40b[_0x8622('0x25')]=_0x8622('0x38');return request({'event':_0x38e40b[_0x8622('0x25')],'message':_0x38e40b});};}function afterCreate(_0x140f98,_0x2bfd45){return function(_0x548544){_0x548544=_0x548544[_0x8622('0x37')]({'plain':!![]});_0x548544[_0x8622('0x34')]=_0x140f98;_0x548544[_0x8622('0x24')]=_0x140f98;_0x548544[_0x8622('0x25')]=_0x8622('0x39');Promise['resolve']()[_0x8622('0x2d')](function(){var _0x5ca417=_0x8622('0x29')+_0x548544['ContactId'];return db[_0x8622('0x2a')][_0x8622('0x2b')](_0x5ca417,{'type':db[_0x8622('0x3a')][_0x8622('0x2c')][_0x8622('0x3b')],'raw':!![]});})[_0x8622('0x2d')](function(_0x2098aa){if(_0x2098aa){_0x548544[_0x8622('0x2e')]=_0x2098aa[0x0];}if(typeof _0x548544[_0x8622('0x3c')]==='undefined')return;return getAgent(_0x548544[_0x8622('0x3c')]);})[_0x8622('0x2d')](function(_0x51b120){if(_0x51b120){_0x548544[_0x8622('0x2f')]=util[_0x8622('0x30')](_0x8622('0x31'),_0x51b120[_0x8622('0x32')]);_0x548544[_0x8622('0x33')]=_0x51b120;}return request({'event':_0x2bfd45,'message':_0x548544});})['catch'](function(_0x2ce8eb){logger['error']('Trigger,\x20%s','AfterCreate',_0x2ce8eb);});};}function afterUpdate(_0x2d5e56){return function(_0xf08822){var _0x536eff=_0xf08822[_0x8622('0x3d')](_0x8622('0x3e'))&&_0xf08822['closed'];var _0x180b05=_0xf08822[_0x8622('0x3d')](_0x8622('0x3f'));if(_0x536eff||_0x180b05){var _0x1923ed=_0x536eff?_0x8622('0xc'):'substatus';var _0x30ce9f=_0xf08822['get']({'plain':!![]});_0x30ce9f[_0x8622('0x34')]=_0x2d5e56;_0x30ce9f[_0x8622('0x24')]=_0x2d5e56;_0x30ce9f[_0x8622('0x25')]=_0x536eff?_0x8622('0x3e'):_0x8622('0x3f');var _0x159616=_0x8622('0x29')+_0x30ce9f[_0x8622('0x27')];return db[_0x8622('0x2a')][_0x8622('0x2b')](_0x159616,{'type':db[_0x8622('0x3a')][_0x8622('0x2c')][_0x8622('0x3b')],'raw':!![]})[_0x8622('0x2d')](function(_0x296d72){if(_0x296d72){_0x30ce9f[_0x8622('0x2e')]=_0x296d72[0x0];}if(typeof _0x30ce9f[_0x8622('0x3c')]===_0x8622('0x28'))return;return getAgent(_0x30ce9f[_0x8622('0x3c')]);})[_0x8622('0x2d')](function(_0x2fca72){if(_0x2fca72){_0x30ce9f['interface']=util[_0x8622('0x30')]('SIP/%s',_0x2fca72[_0x8622('0x32')]);_0x30ce9f[_0x8622('0x33')]=_0x2fca72;}return request({'event':_0x1923ed,'message':_0x30ce9f});})[_0x8622('0x23')](function(_0x1c975c){logger['error'](_0x8622('0x21'),_0x8622('0x40'),_0x1c975c);});}};}function getAgent(_0x4d3640){return db[_0x8622('0x41')][_0x8622('0x42')]({'where':{'id':_0x4d3640},'attributes':['id','name',_0x8622('0x43'),_0x8622('0x44'),_0x8622('0x45')],'raw':!![]})[_0x8622('0x2d')](function(_0x2394d8){return _0x2394d8;});}exports[_0x8622('0x46')]=function(){for(var _0x400412=0x0;_0x400412=_0x547298[_0xdfbc('0x10')]){throw Error(_0xdfbc('0x11'));}_0x2bbc91(_0x109ce0);})[_0xdfbc('0x12')](function(_0x4e71b3){_0x3de5c6(_0x4e71b3);});});}; \ No newline at end of file +var _0xa4ca=['../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','isUndefined','updateAttributes','role','agent','count','then','agents','catch','bluebird'];(function(_0x39a0c3,_0xf4db48){var _0x17ea14=function(_0x30b74e){while(--_0x30b74e){_0x39a0c3['push'](_0x39a0c3['shift']());}};_0x17ea14(++_0xf4db48);}(_0xa4ca,0x97));var _0xaa4c=function(_0x9e2ab7,_0x5cd2c0){_0x9e2ab7=_0x9e2ab7-0x0;var _0x9995c6=_0xa4ca[_0x9e2ab7];return _0x9995c6;};'use strict';var _=require('lodash');var BPromise=require(_0xaa4c('0x0'));var db=require(_0xaa4c('0x1'))['db'];var util=require(_0xaa4c('0x2'));var channels=[_0xaa4c('0x3'),_0xaa4c('0x4'),'chat',_0xaa4c('0x5'),_0xaa4c('0x6'),_0xaa4c('0x7'),_0xaa4c('0x8')];exports[_0xaa4c('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x398eb3){_0x398eb3=_0x398eb3[_0xaa4c('0xa')]();return _['includes'](channels,_0x398eb3);};exports['clearBlockUser']=function(_0x4935aa,_0x3ba9cb,_0x30b526,_0x3246f4){var _0x181ead={'loginAttempts':_0x3ba9cb,'blocked':_0x30b526};if(!_[_0xaa4c('0xb')](_0x3246f4)){_0x181ead['blockedAt']=_0x3246f4;}return _0x4935aa[_0xaa4c('0xc')](_0x181ead);};exports['getLicense']=function(_0x18ec6f){return new BPromise(function(_0xfc5fa,_0x17aa60){var _0xf66b71=0x0;if(_0x18ec6f[_0xaa4c('0xd')]!==_0xaa4c('0xe')){_0xfc5fa(_0x18ec6f);}db['User'][_0xaa4c('0xf')]({'where':{'role':_0xaa4c('0xe'),'online':!![],'id':{'$ne':_0x18ec6f['id']}}})[_0xaa4c('0x10')](function(_0xbe960){_0xf66b71=_0xbe960;return util['getLicense']();})['then'](function(_0x10a5f){if(_0x10a5f&&_0x10a5f['agents']&&_0xf66b71>=_0x10a5f[_0xaa4c('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0xfc5fa(_0x18ec6f);})[_0xaa4c('0x12')](function(_0x408771){_0x17aa60(_0x408771);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ab60028..81ed0f2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['status','json','exports','404'];(function(_0x4e2d50,_0x8d864e){var _0x20826e=function(_0x3a2a06){while(--_0x3a2a06){_0x4e2d50['push'](_0x4e2d50['shift']());}};_0x20826e(++_0x8d864e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2027f5,_0x5a68c1){_0x2027f5=_0x2027f5-0x0;var _0x346d21=_0xbdb7[_0x2027f5];return _0x346d21;};'use strict';module[_0x7bdb('0x0')][0x194]=function pageNotFound(_0x366d81,_0x44467d){var _0x2a2c1c=_0x7bdb('0x1');var _0x433850=0x194;var _0x4496ac={'status':_0x433850};_0x44467d[_0x7bdb('0x2')](_0x4496ac[_0x7bdb('0x2')]);_0x44467d['render'](_0x2a2c1c,{},function(_0x28542c,_0x4fd1ad){if(_0x28542c){return _0x44467d['status'](_0x4496ac[_0x7bdb('0x2')])[_0x7bdb('0x3')](_0x4496ac);}_0x44467d['send'](_0x4fd1ad);});}; \ No newline at end of file +var _0x3d2b=['render','send','exports','404','status'];(function(_0x4dd5e9,_0x3fca63){var _0x2ce768=function(_0x73b1e4){while(--_0x73b1e4){_0x4dd5e9['push'](_0x4dd5e9['shift']());}};_0x2ce768(++_0x3fca63);}(_0x3d2b,0x129));var _0xb3d2=function(_0x3f472f,_0xf7f95c){_0x3f472f=_0x3f472f-0x0;var _0x4051d8=_0x3d2b[_0x3f472f];return _0x4051d8;};'use strict';module[_0xb3d2('0x0')][0x194]=function pageNotFound(_0x228b77,_0x4ee594){var _0x2ab5c0=_0xb3d2('0x1');var _0x30ddd3=0x194;var _0x2e57ba={'status':_0x30ddd3};_0x4ee594[_0xb3d2('0x2')](_0x2e57ba[_0xb3d2('0x2')]);_0x4ee594[_0xb3d2('0x3')](_0x2ab5c0,{},function(_0x24c09f,_0x3105dc){if(_0x24c09f){return _0x4ee594['status'](_0x2e57ba[_0xb3d2('0x2')])['json'](_0x2e57ba);}_0x4ee594[_0xb3d2('0x4')](_0x3105dc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1cbc64e..f64a29f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x213d=['../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','UserId','UserSetting','userSetting','Recordings','hasMany','VoiceQueuesRt','cascade','HopperFinals','HopperHistory','ReportAgentPreview','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','CmContact','Contacts','CmList','Lists','cm_user_has_lists','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','Interactions','Applications','List','ListId','TemplateId','MailQueue','team_has_mail_queues','Account','Owner','Tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatOfflineMessage','FaxAccountId','FaxMessage','FaxApplication','TagId','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsQueue','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','ChatInteractions','Company','cm_contact_has_tags','Queue','CampaignId','CmHopperBlack','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','Mohs','mail_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','DeskAccount','int_desk_configuration_has_tags','Description','VariableId','ZendeskConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesAccount','FreshsalesConfiguration','ChatQueueReport','ToId','SessionId','SmsQueueReport','ProjectId','user_has_teams','ChatQueues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccount','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','../config/environment','sequelize','jstz','determine','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.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','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration'];(function(_0x197c47,_0x1cf191){var _0x48a00e=function(_0x3cf694){while(--_0x3cf694){_0x197c47['push'](_0x197c47['shift']());}};_0x48a00e(++_0x1cf191);}(_0x213d,0x153));var _0xd213=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x213d[_0x3ab51d];return _0x29a04e;};'use strict';var config=require(_0xd213('0x0'));var Sequelize=require(_0xd213('0x1'));var _=require('lodash');var jstz=require(_0xd213('0x2'));var timezone=jstz[_0xd213('0x3')]();config['sequelize']=_['defaultsDeep'](config[_0xd213('0x1')],{'database':'motion2','username':_0xd213('0x4'),'password':_0xd213('0x5'),'options':{'host':_0xd213('0x6'),'port':0xcea,'dialect':_0xd213('0x7'),'dialectOptions':{'charset':_0xd213('0x8')},'logging':![],'timezone':timezone[_0xd213('0x9')](),'define':{'charset':_0xd213('0xa'),'collate':_0xd213('0xb')}}});config[_0xd213('0xc')]=_[_0xd213('0xd')](config['sequelizeHistory'],{'database':_0xd213('0xe'),'username':_0xd213('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd213('0x8')},'logging':![],'timezone':timezone[_0xd213('0x9')](),'define':{'charset':_0xd213('0xa'),'collate':_0xd213('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd213('0x1')]['database'],config[_0xd213('0x1')][_0xd213('0xf')],config[_0xd213('0x1')][_0xd213('0x10')],config['sequelize'][_0xd213('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd213('0xc')][_0xd213('0x12')],config[_0xd213('0xc')][_0xd213('0xf')],config[_0xd213('0xc')][_0xd213('0x10')],config[_0xd213('0xc')][_0xd213('0x11')])};db[_0xd213('0x13')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x15'));db[_0xd213('0x16')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x17'));db[_0xd213('0x18')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x19'));db[_0xd213('0x1a')]=db[_0xd213('0x1')]['import'](_0xd213('0x1b'));db[_0xd213('0x1c')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x1d'));db[_0xd213('0x1e')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0xd213('0x1f')]=db['sequelize']['import'](_0xd213('0x20'));db[_0xd213('0x21')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x22'));db['VoiceMail']=db[_0xd213('0x1')][_0xd213('0x14')]('../api/voiceMail/voiceMail.model');db[_0xd213('0x23')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x24'));db[_0xd213('0x25')]=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xd213('0x26')]=db[_0xd213('0x1')]['import'](_0xd213('0x27'));db[_0xd213('0x28')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x29'));db[_0xd213('0x2a')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x2b'));db[_0xd213('0x2c')]=db[_0xd213('0x1')]['import'](_0xd213('0x2d'));db[_0xd213('0x2e')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x2f'));db[_0xd213('0x30')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x31'));db[_0xd213('0x32')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x33'));db['UserChatQueue']=db[_0xd213('0x1')][_0xd213('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xd213('0x34')]=db[_0xd213('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0xd213('0x35')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xd213('0x36')]=db[_0xd213('0x1')]['import'](_0xd213('0x37'));db['UserOpenchannelQueue']=db[_0xd213('0x1')][_0xd213('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xd213('0x38')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x39'));db[_0xd213('0x3a')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x3b'));db[_0xd213('0x3c')]=db[_0xd213('0x1')]['import'](_0xd213('0x3d'));db[_0xd213('0x3e')]=db['sequelize']['import'](_0xd213('0x3f'));db['MailQueue']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x40'));db[_0xd213('0x41')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x42'));db[_0xd213('0x43')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x44'));db[_0xd213('0x45')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x46'));db[_0xd213('0x47')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x48'));db[_0xd213('0x49')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xd213('0x4a')]=db[_0xd213('0x1')]['import']('../api/dashboard/dashboard.model');db[_0xd213('0x4b')]=db['sequelize'][_0xd213('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xd213('0x4c')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x4d'));db['FaxApplication']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x4e'));db['FaxInteraction']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x4f'));db['FaxMessage']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x50'));db[_0xd213('0x51')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/faxQueue/faxQueue.model');db[_0xd213('0x52')]=db[_0xd213('0x1')]['import'](_0xd213('0x53'));db[_0xd213('0x54')]=db[_0xd213('0x1')]['import'](_0xd213('0x55'));db[_0xd213('0x56')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x57'));db[_0xd213('0x58')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xd213('0x59')]=db['sequelize']['import'](_0xd213('0x5a'));db['SmsQueue']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x5b'));db[_0xd213('0x5c')]=db['sequelize'][_0xd213('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0xd213('0x5d')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x5e'));db[_0xd213('0x5f')]=db[_0xd213('0x1')]['import'](_0xd213('0x60'));db[_0xd213('0x61')]=db['sequelize'][_0xd213('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x62'));db[_0xd213('0x63')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x64'));db[_0xd213('0x65')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x66'));db[_0xd213('0x67')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x68'));db['ChatInteraction']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x69'));db['ChatMessage']=db[_0xd213('0x1')]['import'](_0xd213('0x6a'));db['ChatOfflineMessage']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x6b'));db['ChatQueue']=db[_0xd213('0x1')][_0xd213('0x14')]('../api/chatQueue/chatQueue.model');db[_0xd213('0x6c')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x6d'));db[_0xd213('0x6e')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x6f'));db[_0xd213('0x70')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x71'));db['CmContact']=db['sequelize'][_0xd213('0x14')]('../api/cmContact/cmContact.model');db[_0xd213('0x72')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x73'));db['CmHopperBlack']=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xd213('0x74')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x75'));db[_0xd213('0x76')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x77'));db['ReportAgentPreview']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x78'));db[_0xd213('0x79')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x7a'));db[_0xd213('0x7b')]=db['sequelize']['import'](_0xd213('0x7c'));db['Automation']=db['sequelize'][_0xd213('0x14')](_0xd213('0x7d'));db[_0xd213('0x7e')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x7f'));db[_0xd213('0x80')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x81'));db[_0xd213('0x82')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x83'));db['Interval']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x84'));db[_0xd213('0x85')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x86'));db['Cdr']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x87'));db[_0xd213('0x88')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x89'));db[_0xd213('0x8a')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x8b'));db[_0xd213('0x8c')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x8d'));db[_0xd213('0x8e')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x8f'));db[_0xd213('0x90')]=db[_0xd213('0x1')]['import'](_0xd213('0x91'));db[_0xd213('0x92')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x93'));db[_0xd213('0x94')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x95'));db['Integration']=db[_0xd213('0x1')]['import'](_0xd213('0x96'));db[_0xd213('0x97')]=db['sequelize'][_0xd213('0x14')](_0xd213('0x98'));db[_0xd213('0x99')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x9a'));db[_0xd213('0x9b')]=db[_0xd213('0x1')]['import'](_0xd213('0x9c'));db[_0xd213('0x9d')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x9e'));db['AnalyticMetric']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x9f'));db[_0xd213('0xa0')]=db[_0xd213('0x1')]['import'](_0xd213('0xa1'));db[_0xd213('0xa2')]=db['sequelize'][_0xd213('0x14')](_0xd213('0xa3'));db[_0xd213('0xa4')]=db['sequelize'][_0xd213('0x14')](_0xd213('0xa5'));db[_0xd213('0xa6')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xa7'));db['SalesforceField']=db[_0xd213('0x1')]['import'](_0xd213('0xa8'));db[_0xd213('0xa9')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xaa'));db[_0xd213('0xab')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xac'));db[_0xd213('0xad')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xae'));db['DeskAccount']=db[_0xd213('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xd213('0xaf')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xb0'));db[_0xd213('0xb1')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xb2'));db[_0xd213('0xb3')]=db[_0xd213('0x1')]['import'](_0xd213('0xb4'));db[_0xd213('0xb5')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xb6'));db[_0xd213('0xb7')]=db['sequelize'][_0xd213('0x14')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0xd213('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db['sequelize'][_0xd213('0x14')](_0xd213('0xb8'));db[_0xd213('0xb9')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xba'));db[_0xd213('0xbb')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xbc'));db[_0xd213('0xbd')]=db['sequelize']['import'](_0xd213('0xbe'));db[_0xd213('0xbf')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xc0'));db[_0xd213('0xc1')]=db['sequelize'][_0xd213('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xd213('0xc2')]=db[_0xd213('0x1')]['import'](_0xd213('0xc3'));db[_0xd213('0xc4')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xc5'));db[_0xd213('0xc6')]=db[_0xd213('0x1')]['import'](_0xd213('0xc7'));db[_0xd213('0xc8')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xc9'));db[_0xd213('0xca')]=db['sequelize'][_0xd213('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xd213('0xcb')]=db[_0xd213('0x1')]['import'](_0xd213('0xcc'));db[_0xd213('0xcd')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xce'));db['FreshsalesAccount']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xcf'));db['FreshsalesConfiguration']=db['sequelize'][_0xd213('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xd213('0xd0')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xd1'));db[_0xd213('0xd2')]=db[_0xd213('0x1')]['import'](_0xd213('0x96'));db[_0xd213('0xd3')]=db[_0xd213('0x1')]['import']('../api/network/network.model');db['ChatQueueReport']=db['sequelize']['import'](_0xd213('0xd4'));db[_0xd213('0xd5')]=db[_0xd213('0x1')]['import'](_0xd213('0xd6'));db[_0xd213('0xd7')]=db['sequelize'][_0xd213('0x14')](_0xd213('0xd8'));db[_0xd213('0xd9')]=db[_0xd213('0x1')]['import'](_0xd213('0xda'));db[_0xd213('0xdb')]=db[_0xd213('0x1')]['import'](_0xd213('0xdc'));db['SmsQueueReport']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xdd'));db[_0xd213('0xde')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xdf'));db['SquareDetailsReport']=db['sequelize'][_0xd213('0x14')](_0xd213('0xe0'));db[_0xd213('0xe1')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xe2'));db[_0xd213('0xe3')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xe4'));db[_0xd213('0xe5')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xe6'));db['SquareRecording']=db['sequelize']['import'](_0xd213('0xe7'));db[_0xd213('0xe8')]=db['sequelize'][_0xd213('0x14')](_0xd213('0xe9'));db[_0xd213('0xea')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xeb'));db[_0xd213('0xec')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xed'));db[_0xd213('0xee')]=db[_0xd213('0x1')]['import']('../api/campaign/campaign.model');db[_0xd213('0xef')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xf0'));db[_0xd213('0xf1')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xf2'));db[_0xd213('0xf3')]=db[_0xd213('0x1')]['import'](_0xd213('0xf4'));db[_0xd213('0xf5')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xf6'));db['ChatTransferReport']=db['sequelize'][_0xd213('0x14')](_0xd213('0xf7'));db[_0xd213('0xf8')]=db['sequelize']['import'](_0xd213('0xf9'));db[_0xd213('0xfa')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xfb'));db[_0xd213('0xfc')]=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db['sequelize'][_0xd213('0x14')]('../api/cmList/cmList.model');db[_0xd213('0xfd')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0xfe'));db[_0xd213('0xff')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x100'));db['UserProfileSection']=db[_0xd213('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0xd213('0x101')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x102'));db[_0xd213('0x103')]=db[_0xd213('0x1')]['import'](_0xd213('0x104'));db['WhatsappAccount']=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x105'));db[_0xd213('0x106')]=db[_0xd213('0x1')]['import'](_0xd213('0x107'));db[_0xd213('0x108')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x109'));db[_0xd213('0x10a')]=db['sequelize'][_0xd213('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0xd213('0x10b')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x10c'));db[_0xd213('0x10d')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xd213('0x10e')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x10f'));db[_0xd213('0x110')]=db[_0xd213('0x1')][_0xd213('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0xd213('0x111')]=db[_0xd213('0x1')]['import'](_0xd213('0x112'));db[_0xd213('0x113')]=db[_0xd213('0x1')]['import'](_0xd213('0x114'));db[_0xd213('0x115')]=db[_0xd213('0x1')][_0xd213('0x14')](_0xd213('0x116'));db['UserSetting']=db[_0xd213('0x1')]['import']('../api/user-setting/user-setting.model');db[_0xd213('0x13')][_0xd213('0x117')](db['VoiceMail'],{'as':_0xd213('0x118'),'onDelete':'cascade','foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x117')](db[_0xd213('0x11a')],{'as':_0xd213('0x11b'),'onDelete':'cascade','foreignKey':_0xd213('0x119')});db[_0xd213('0x13')]['hasMany'](db[_0xd213('0x1f')],{'as':_0xd213('0x11c'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x32')],{'as':_0xd213('0x11e'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xd213('0x11f'),'hooks':!![]});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x74')],{'as':_0xd213('0x120'),'foreignKey':_0xd213('0x119')});db['User'][_0xd213('0x11d')](db['CmHopperHistory'],{'as':_0xd213('0x121'),'foreignKey':_0xd213('0x119')});db['User']['hasMany'](db[_0xd213('0x122')],{'as':_0xd213('0x122'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')]['hasMany'](db[_0xd213('0x5f')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0xd213('0x13')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x58')],{'as':_0xd213('0x123'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x124')],{'as':_0xd213('0x125'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x43')],{'as':'MailInteractions','foreignKey':_0xd213('0x119')});db['User']['hasMany'](db[_0xd213('0x108')],{'as':_0xd213('0x126'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x13')][_0xd213('0x11d')](db[_0xd213('0x103')],{'as':_0xd213('0x127'),'foreignKey':_0xd213('0x128')});db['User'][_0xd213('0x129')](db[_0xd213('0xff')],{'as':'UserProfile','foreignKey':_0xd213('0x12a')});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x6c')],{'as':_0xd213('0x12c'),'through':'chat_group_has_users'});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x12d')],{'as':_0xd213('0x12e'),'through':'cm_user_has_contacts'});db['User'][_0xd213('0x12b')](db[_0xd213('0x12f')],{'as':_0xd213('0x130'),'through':_0xd213('0x131')});db[_0xd213('0x13')][_0xd213('0x12b')](db['Team'],{'through':'user_has_teams'});db[_0xd213('0x13')]['belongsToMany'](db[_0xd213('0x43')],{'as':'MailInteractions','through':_0xd213('0x132')});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x133')],{'as':'ChatInteractions','through':_0xd213('0x134')});db[_0xd213('0x13')][_0xd213('0x12b')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xd213('0x135')});db[_0xd213('0x13')]['belongsToMany'](db[_0xd213('0x58')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User'][_0xd213('0x12b')](db['OpenchannelInteraction'],{'as':_0xd213('0x136'),'through':'user_has_openchannel_interactions'});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x108')],{'as':_0xd213('0x126'),'through':_0xd213('0x137')});db[_0xd213('0x13')][_0xd213('0x12b')](db['VoiceQueue'],{'as':_0xd213('0x138'),'through':'UserVoiceQueue','required':![]});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0xfd')],{'as':_0xd213('0x139'),'through':_0xd213('0x115'),'required':![]});db['User'][_0xd213('0x12b')](db['MailQueue'],{'as':'MailQueues','through':_0xd213('0x34'),'required':![]});db[_0xd213('0x13')]['belongsToMany'](db[_0xd213('0x13a')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xd213('0x13')][_0xd213('0x12b')](db['FaxQueue'],{'as':_0xd213('0x13b'),'through':_0xd213('0x35'),'required':![]});db['User'][_0xd213('0x12b')](db['SmsQueue'],{'as':_0xd213('0x13c'),'through':_0xd213('0x36'),'required':![]});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x13d')],{'as':_0xd213('0x13e'),'through':'UserOpenchannelQueue','required':![]});db[_0xd213('0x13')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xd213('0x13f'),'through':_0xd213('0x38'),'required':![]});db['User']['belongsToMany'](db[_0xd213('0x12f')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0xd213('0x63')],{'as':'ChatWebsites','through':_0xd213('0x140')});db[_0xd213('0x13')]['belongsToMany'](db[_0xd213('0x4c')],{'as':_0xd213('0x141'),'through':_0xd213('0x142')});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x3e')],{'as':'MailAccounts','through':_0xd213('0x143')});db[_0xd213('0x13')][_0xd213('0x12b')](db[_0xd213('0x5c')],{'as':_0xd213('0x144'),'through':_0xd213('0x145')});db['User'][_0xd213('0x12b')](db['SmsAccount'],{'as':_0xd213('0x146'),'through':'user_has_sms_accounts'});db['User'][_0xd213('0x12b')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xd213('0x147')});db['User'][_0xd213('0x12b')](db[_0xd213('0xe5')],{'as':_0xd213('0x148'),'through':_0xd213('0x149')});db[_0xd213('0x16')][_0xd213('0x11d')](db['VoiceExtension'],{'as':_0xd213('0x14a'),'onDelete':'cascade','foreignKey':_0xd213('0x14b')});db[_0xd213('0x18')]['hasMany'](db[_0xd213('0x1a')],{'onDelete':_0xd213('0x11f')});db[_0xd213('0x1a')][_0xd213('0x11d')](db['VoiceExtension'],{'as':'Applications','onDelete':_0xd213('0x11f')});db[_0xd213('0x1c')]['belongsToMany'](db[_0xd213('0x8c')],{'as':'Sounds','through':_0xd213('0x14c')});db[_0xd213('0x1e')][_0xd213('0x11d')](db[_0xd213('0x32')],{'as':'Members','foreignKey':_0xd213('0x14d')});db[_0xd213('0x1e')][_0xd213('0x11d')](db[_0xd213('0x72')],{'as':_0xd213('0x14e'),'foreignKey':_0xd213('0x14d')});db[_0xd213('0x1e')][_0xd213('0x11d')](db[_0xd213('0x74')],{'as':_0xd213('0x120'),'foreignKey':_0xd213('0x14d')});db['VoiceQueue'][_0xd213('0x11d')](db[_0xd213('0x76')],{'as':_0xd213('0x14f'),'foreignKey':'VoiceQueueId'});db[_0xd213('0x1e')][_0xd213('0x11d')](db[_0xd213('0x122')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xd213('0x1e')][_0xd213('0x11d')](db['CmHopperBlack'],{'as':_0xd213('0x150'),'foreignKey':_0xd213('0x14d')});db[_0xd213('0x1e')]['hasMany'](db['JscriptySessionReport'],{'as':_0xd213('0x151'),'foreignKey':_0xd213('0x14d')});db[_0xd213('0x1e')][_0xd213('0x129')](db[_0xd213('0x2e')],{'as':_0xd213('0x2e'),'foreignKey':_0xd213('0x152')});db[_0xd213('0x1e')][_0xd213('0x129')](db['Trunk'],{'as':_0xd213('0x153'),'foreignKey':_0xd213('0x154')});db[_0xd213('0x1e')][_0xd213('0x129')](db[_0xd213('0x155')],{'as':_0xd213('0x155'),'foreignKey':_0xd213('0x156')});db[_0xd213('0x1e')][_0xd213('0x129')](db[_0xd213('0x85')],{'as':_0xd213('0x157'),'foreignKey':_0xd213('0x158')});db[_0xd213('0x1e')][_0xd213('0x12b')](db['CmList'],{'as':_0xd213('0x130'),'through':_0xd213('0x159')});db[_0xd213('0x1e')][_0xd213('0x12b')](db['User'],{'as':_0xd213('0x15a'),'through':'UserVoiceQueue'});db[_0xd213('0x1e')][_0xd213('0x12b')](db[_0xd213('0xea')],{'as':_0xd213('0x15b'),'through':_0xd213('0x111')});db[_0xd213('0x1e')][_0xd213('0x12b')](db[_0xd213('0x12f')],{'as':'BlackLists','through':_0xd213('0x15c')});db[_0xd213('0x1f')]['belongsTo'](db['User'],{'as':_0xd213('0x13'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x21')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x13'),'foreignKey':'UserId'});db[_0xd213('0x118')]['hasMany'](db[_0xd213('0x23')],{'as':'Messages','onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x15d'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0xd213('0x129')](db[_0xd213('0x118')],{'foreignKey':'mailboxuser','targetKey':_0xd213('0x15e')});db[_0xd213('0x25')][_0xd213('0x11d')](db[_0xd213('0x2a')],{'as':_0xd213('0x15f'),'foreignKey':_0xd213('0x160'),'constraints':![]});db[_0xd213('0x25')][_0xd213('0x11d')](db[_0xd213('0x28')],{'as':_0xd213('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0xd213('0x25')]['belongsTo'](db[_0xd213('0x13')],{'as':'User','foreignKey':_0xd213('0x119')});db[_0xd213('0x25')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x3a')]['belongsTo'](db[_0xd213('0x3e')],{'as':_0xd213('0x3e'),'foreignKey':_0xd213('0x164')});db[_0xd213('0x3a')][_0xd213('0x129')](db[_0xd213('0x110')],{'as':_0xd213('0x110'),'foreignKey':_0xd213('0x165'),'onDelete':_0xd213('0x166')});db[_0xd213('0x3c')]['belongsTo'](db[_0xd213('0x3e')],{'as':'MailAccount','foreignKey':_0xd213('0x164')});db['MailServerOut'][_0xd213('0x129')](db[_0xd213('0x110')],{'as':'CloudProvider','foreignKey':_0xd213('0x165'),'onDelete':_0xd213('0x166')});db['MailAccount'][_0xd213('0x117')](db[_0xd213('0x3a')],{'as':_0xd213('0x167'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x3e')]['hasOne'](db[_0xd213('0x3c')],{'as':_0xd213('0x168'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x3e')]['hasMany'](db[_0xd213('0x80')],{'as':_0xd213('0x169'),'foreignKey':_0xd213('0x164'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x3e')][_0xd213('0x11d')](db[_0xd213('0x7e')],{'as':_0xd213('0x16a'),'foreignKey':_0xd213('0x164')});db['MailAccount'][_0xd213('0x11d')](db[_0xd213('0x45')],{'as':_0xd213('0x16b'),'foreignKey':'MailAccountId'});db[_0xd213('0x3e')][_0xd213('0x11d')](db[_0xd213('0x43')],{'as':_0xd213('0x16c')});db[_0xd213('0x3e')]['hasMany'](db[_0xd213('0x47')],{'as':_0xd213('0x16d')});db[_0xd213('0x3e')]['belongsTo'](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db['MailAccount']['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0xd213('0x170')});db['MailAccount'][_0xd213('0x129')](db[_0xd213('0x85')],{'as':_0xd213('0x157'),'foreignKey':_0xd213('0x158')});db[_0xd213('0x3e')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xd213('0x171')][_0xd213('0x12b')](db['User'],{'as':_0xd213('0x15a'),'through':_0xd213('0x34')});db[_0xd213('0x171')][_0xd213('0x12b')](db[_0xd213('0xea')],{'through':_0xd213('0x172'),'as':_0xd213('0x15b')});db[_0xd213('0x43')][_0xd213('0x11d')](db[_0xd213('0x45')],{'as':'Messages','onDelete':_0xd213('0x11f'),'foreignKey':'MailInteractionId'});db[_0xd213('0x43')]['belongsTo'](db[_0xd213('0x3e')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x164')});db[_0xd213('0x43')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':'ContactId'});db[_0xd213('0x43')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x174'),'foreignKey':_0xd213('0x119')});db['MailInteraction'][_0xd213('0x12b')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xd213('0x175')});db[_0xd213('0x43')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':'mail_interaction_has_tags','as':_0xd213('0x176')});db[_0xd213('0x43')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':'Users','through':_0xd213('0x132'),'foreignKey':_0xd213('0x177')});db[_0xd213('0x45')]['hasMany'](db[_0xd213('0xf1')],{'as':_0xd213('0x178'),'onDelete':'cascade'});db[_0xd213('0x45')]['belongsTo'](db[_0xd213('0x13')],{'as':'User'});db[_0xd213('0x45')][_0xd213('0x129')](db[_0xd213('0x12d')],{'onDelete':_0xd213('0x11f'),'as':_0xd213('0x162')});db['MailMessage']['belongsTo'](db[_0xd213('0x43')],{'as':_0xd213('0x179'),'foreignKey':'MailInteractionId'});db[_0xd213('0x45')][_0xd213('0x129')](db['MailAccount'],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x164')});db[_0xd213('0x45')][_0xd213('0x129')](db['ChatWebsite'],{'as':_0xd213('0x63'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0xd213('0x129')](db['ChatOfflineMessage'],{'as':_0xd213('0x17a'),'foreignKey':'ChatOfflineMessageId'});db[_0xd213('0x47')][_0xd213('0x129')](db[_0xd213('0x13')],{'onDelete':'restrict'});db[_0xd213('0x47')][_0xd213('0x129')](db[_0xd213('0x171')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x47')][_0xd213('0x129')](db[_0xd213('0x3e')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x47')][_0xd213('0x129')](db[_0xd213('0x155')],{'onDelete':_0xd213('0x166'),'foreignKey':'IntervalId'});db[_0xd213('0x47')][_0xd213('0x129')](db['Tag'],{'onDelete':_0xd213('0x166'),'foreignKey':'TagId'});db[_0xd213('0x49')]['belongsTo'](db[_0xd213('0x3e')],{});db[_0xd213('0x49')]['belongsTo'](db[_0xd213('0x12f')],{'as':'List','foreignKey':_0xd213('0x16f')});db['MailQueueReport']['belongsTo'](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x49')][_0xd213('0x129')](db[_0xd213('0x43')],{});db[_0xd213('0x49')][_0xd213('0x129')](db[_0xd213('0x45')],{});db[_0xd213('0x49')]['belongsTo'](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0xd213('0x171')],{});db[_0xd213('0x4a')][_0xd213('0x11d')](db[_0xd213('0x4b')],{'as':'Items','onDelete':'cascade'});db[_0xd213('0x4c')]['hasMany'](db['Disposition'],{'as':_0xd213('0x169'),'foreignKey':_0xd213('0x17b'),'onDelete':_0xd213('0x11f')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0xd213('0x16a'),'foreignKey':_0xd213('0x17b')});db[_0xd213('0x4c')][_0xd213('0x11d')](db[_0xd213('0x124')],{'as':_0xd213('0x16c')});db['FaxAccount'][_0xd213('0x11d')](db['FaxApplication'],{'as':_0xd213('0x16d')});db['FaxAccount'][_0xd213('0x11d')](db[_0xd213('0x1a')],{'as':'Exntensions','onDelete':'cascade'});db[_0xd213('0x4c')][_0xd213('0x11d')](db[_0xd213('0x17c')],{'as':'Messages'});db[_0xd213('0x4c')]['belongsTo'](db[_0xd213('0x2e')],{'as':_0xd213('0x2e')});db[_0xd213('0x4c')][_0xd213('0x129')](db['CmList'],{'as':_0xd213('0x16e'),'foreignKey':'ListId'});db[_0xd213('0x4c')][_0xd213('0x129')](db['Pause'],{'as':_0xd213('0x157'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd213('0x4c')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x142')});db['FaxApplication']['belongsTo'](db[_0xd213('0x13')],{'onDelete':'restrict'});db[_0xd213('0x17d')][_0xd213('0x129')](db['FaxQueue'],{'onDelete':_0xd213('0x166')});db[_0xd213('0x17d')][_0xd213('0x129')](db[_0xd213('0x4c')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x17d')][_0xd213('0x129')](db[_0xd213('0x8e')],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x17e')});db[_0xd213('0x124')][_0xd213('0x11d')](db[_0xd213('0x17c')],{'as':_0xd213('0x16b'),'onDelete':_0xd213('0x11f'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xd213('0x129')](db[_0xd213('0x4c')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x17b')});db[_0xd213('0x124')]['belongsTo'](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x124')]['belongsTo'](db[_0xd213('0x13')],{'as':_0xd213('0x174'),'foreignKey':'UserId'});db[_0xd213('0x124')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xd213('0x124')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x17f'),'as':_0xd213('0x176')});db['FaxInteraction'][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x180'),'through':_0xd213('0x135'),'foreignKey':_0xd213('0x181')});db['FaxMessage'][_0xd213('0x129')](db[_0xd213('0x13')],{'onDelete':'cascade','as':_0xd213('0x13')});db[_0xd213('0x17c')]['belongsTo'](db['FaxInteraction'],{'as':_0xd213('0x179'),'foreignKey':_0xd213('0x181')});db[_0xd213('0x17c')]['belongsTo'](db[_0xd213('0x12d')],{'onDelete':'cascade','as':_0xd213('0x162')});db[_0xd213('0x17c')]['belongsTo'](db[_0xd213('0xf1')],{'as':_0xd213('0xf1'),'foreignKey':_0xd213('0x182')});db[_0xd213('0x17c')][_0xd213('0x129')](db[_0xd213('0x4c')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x17b')});db[_0xd213('0x51')]['belongsToMany'](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x35')});db['FaxQueue'][_0xd213('0x12b')](db['Team'],{'through':_0xd213('0x183'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0xd213('0x4c')],{});db[_0xd213('0x52')][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':'List','foreignKey':_0xd213('0x16f')});db[_0xd213('0x52')][_0xd213('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0xd213('0x163')});db[_0xd213('0x52')][_0xd213('0x129')](db[_0xd213('0x124')],{});db[_0xd213('0x52')][_0xd213('0x129')](db['FaxMessage'],{});db[_0xd213('0x52')][_0xd213('0x129')](db['User'],{});db['FaxQueueReport'][_0xd213('0x129')](db['FaxQueue'],{});db[_0xd213('0x54')][_0xd213('0x11d')](db[_0xd213('0x80')],{'as':_0xd213('0x169'),'foreignKey':'SmsAccountId','onDelete':_0xd213('0x11f')});db[_0xd213('0x54')]['hasMany'](db['CannedAnswer'],{'as':_0xd213('0x16a'),'foreignKey':_0xd213('0x184')});db[_0xd213('0x54')][_0xd213('0x11d')](db['SmsMessage'],{'as':_0xd213('0x16b'),'foreignKey':_0xd213('0x184')});db['SmsAccount'][_0xd213('0x11d')](db[_0xd213('0x58')],{'as':'Interactions'});db[_0xd213('0x54')][_0xd213('0x11d')](db[_0xd213('0x56')],{'as':'Applications'});db[_0xd213('0x54')][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x54')][_0xd213('0x129')](db[_0xd213('0x85')],{'as':_0xd213('0x157'),'foreignKey':_0xd213('0x158')});db['SmsAccount'][_0xd213('0x12b')](db['User'],{'as':_0xd213('0x15a'),'through':_0xd213('0x185')});db[_0xd213('0x56')][_0xd213('0x129')](db['User'],{'onDelete':_0xd213('0x166')});db[_0xd213('0x56')][_0xd213('0x129')](db[_0xd213('0x186')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x56')][_0xd213('0x129')](db[_0xd213('0x54')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x56')][_0xd213('0x129')](db[_0xd213('0x155')],{'onDelete':_0xd213('0x166'),'foreignKey':'IntervalId'});db[_0xd213('0x56')]['belongsTo'](db[_0xd213('0x8e')],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x17e')});db[_0xd213('0x58')][_0xd213('0x11d')](db[_0xd213('0x59')],{'as':'Messages','onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x187')});db['SmsInteraction'][_0xd213('0x129')](db[_0xd213('0x54')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x184')});db[_0xd213('0x58')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db['SmsInteraction'][_0xd213('0x129')](db['User'],{'as':_0xd213('0x174'),'foreignKey':'UserId'});db[_0xd213('0x58')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':'sms_interaction_has_tags','as':_0xd213('0x175')});db[_0xd213('0x58')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x188'),'as':_0xd213('0x176')});db['SmsInteraction'][_0xd213('0x12b')](db['User'],{'as':_0xd213('0x180'),'through':_0xd213('0x189'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xd213('0x129')](db['User'],{'as':_0xd213('0x13')});db[_0xd213('0x59')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xd213('0x162')});db[_0xd213('0x59')][_0xd213('0x129')](db['SmsInteraction'],{'onDelete':_0xd213('0x11f'),'as':'Interaction','foreignKey':_0xd213('0x187')});db[_0xd213('0x59')]['belongsTo'](db[_0xd213('0x54')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x184')});db['SmsQueue'][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x36'),'foreignKey':'SmsQueueId'});db[_0xd213('0x186')][_0xd213('0x12b')](db[_0xd213('0xea')],{'through':_0xd213('0x18a'),'as':_0xd213('0x15b')});db['OpenchannelAccount']['hasMany'](db[_0xd213('0x80')],{'as':_0xd213('0x169'),'foreignKey':_0xd213('0x18b'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x5c')]['hasMany'](db['CannedAnswer'],{'as':_0xd213('0x16a'),'foreignKey':_0xd213('0x18b')});db['OpenchannelAccount'][_0xd213('0x11d')](db[_0xd213('0x5f')],{'as':_0xd213('0x16c'),'foreignKey':_0xd213('0x18b')});db[_0xd213('0x5c')][_0xd213('0x11d')](db[_0xd213('0x61')],{'as':_0xd213('0x16b'),'foreignKey':_0xd213('0x18b')});db[_0xd213('0x5c')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xd213('0x18b')});db[_0xd213('0x5c')][_0xd213('0x129')](db['CmList'],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x5c')][_0xd213('0x129')](db[_0xd213('0x85')],{'as':_0xd213('0x157'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd213('0x5c')][_0xd213('0x12b')](db['User'],{'as':_0xd213('0x15a'),'through':_0xd213('0x145')});db['OpenchannelApplication']['belongsTo'](db[_0xd213('0x13')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x5d')]['belongsTo'](db[_0xd213('0x13d')],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x18c')});db[_0xd213('0x5d')]['belongsTo'](db[_0xd213('0x5c')],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x18b')});db['OpenchannelApplication'][_0xd213('0x129')](db['Interval'],{'onDelete':_0xd213('0x166'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xd213('0x129')](db['Tag'],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x17e')});db[_0xd213('0x5f')][_0xd213('0x11d')](db[_0xd213('0x61')],{'as':_0xd213('0x16b'),'onDelete':_0xd213('0x11f'),'foreignKey':'OpenchannelInteractionId'});db[_0xd213('0x5f')][_0xd213('0x129')](db[_0xd213('0x5c')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x18b')});db[_0xd213('0x5f')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':'Contact','foreignKey':'ContactId'});db[_0xd213('0x5f')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x174'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x5f')]['belongsToMany'](db[_0xd213('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0xd213('0x175')});db[_0xd213('0x5f')][_0xd213('0x12b')](db['Tag'],{'through':_0xd213('0x18d'),'as':'ThroughTags'});db[_0xd213('0x5f')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':'Users','through':_0xd213('0x18e'),'foreignKey':'OpenchannelInteractionId'});db[_0xd213('0x61')][_0xd213('0x129')](db[_0xd213('0x13')],{'onDelete':_0xd213('0x11f'),'as':'User'});db[_0xd213('0x61')][_0xd213('0x129')](db[_0xd213('0x12d')],{'onDelete':_0xd213('0x11f'),'as':_0xd213('0x162')});db[_0xd213('0x61')]['belongsTo'](db[_0xd213('0x5f')],{'onDelete':_0xd213('0x11f'),'as':'Interaction','foreignKey':_0xd213('0x18f')});db['OpenchannelMessage']['belongsTo'](db[_0xd213('0xf1')],{'as':_0xd213('0xf1'),'foreignKey':'AttachmentId'});db[_0xd213('0x61')][_0xd213('0x129')](db[_0xd213('0x5c')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x18b')});db['OpenchannelQueue']['belongsToMany'](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x190'),'foreignKey':_0xd213('0x18c')});db[_0xd213('0x13d')]['belongsToMany'](db[_0xd213('0xea')],{'through':_0xd213('0x191'),'as':_0xd213('0x15b')});db['ChatWebsite'][_0xd213('0x11d')](db[_0xd213('0x80')],{'as':'Dispositions','foreignKey':_0xd213('0x192'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x63')]['hasMany'](db[_0xd213('0x7e')],{'as':_0xd213('0x16a'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xd213('0x11d')](db[_0xd213('0x6e')],{'as':_0xd213('0x193')});db['ChatWebsite'][_0xd213('0x11d')](db[_0xd213('0x133')],{'as':_0xd213('0x16c')});db['ChatWebsite'][_0xd213('0x11d')](db[_0xd213('0x67')],{'as':_0xd213('0x16d')});db[_0xd213('0x63')][_0xd213('0x11d')](db[_0xd213('0x194')],{'as':_0xd213('0x16b')});db['ChatWebsite'][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db['ChatWebsite'][_0xd213('0x129')](db[_0xd213('0x155')],{'as':_0xd213('0x155'),'foreignKey':_0xd213('0x156')});db[_0xd213('0x63')][_0xd213('0x129')](db['MailAccount'],{'as':_0xd213('0x3e'),'foreignKey':'MailAccountId'});db[_0xd213('0x63')]['belongsTo'](db['Pause'],{'as':_0xd213('0x157'),'foreignKey':_0xd213('0x158')});db[_0xd213('0x63')]['belongsToMany'](db[_0xd213('0x13')],{'as':'Agents','through':_0xd213('0x140')});db[_0xd213('0x65')][_0xd213('0x129')](db['OpenchannelAccount'],{});db[_0xd213('0x65')][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x65')]['belongsTo'](db[_0xd213('0x12d')],{'as':'Contact','foreignKey':_0xd213('0x163')});db[_0xd213('0x65')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xd213('0x65')][_0xd213('0x129')](db['OpenchannelMessage'],{});db[_0xd213('0x65')][_0xd213('0x129')](db[_0xd213('0x13')],{});db[_0xd213('0x65')][_0xd213('0x129')](db[_0xd213('0x13d')],{});db[_0xd213('0x67')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x195'),'foreignKey':_0xd213('0x119'),'onDelete':'restrict'});db[_0xd213('0x67')][_0xd213('0x129')](db[_0xd213('0x13a')],{'as':'Queue','foreignKey':_0xd213('0x196'),'onDelete':_0xd213('0x166')});db[_0xd213('0x67')][_0xd213('0x129')](db[_0xd213('0x63')],{'as':_0xd213('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0xd213('0x166')});db[_0xd213('0x67')]['belongsTo'](db[_0xd213('0x8e')],{'onDelete':_0xd213('0x166'),'foreignKey':_0xd213('0x17e')});db[_0xd213('0x133')][_0xd213('0x11d')](db[_0xd213('0x194')],{'as':'Messages','onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x198')});db['ChatInteraction'][_0xd213('0x129')](db[_0xd213('0x63')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x192')});db[_0xd213('0x133')]['belongsTo'](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x133')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':'Owner','foreignKey':_0xd213('0x119')});db[_0xd213('0x133')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x199'),'as':_0xd213('0x175')});db[_0xd213('0x133')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x199'),'as':_0xd213('0x176')});db[_0xd213('0x133')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':'Users','through':_0xd213('0x134'),'foreignKey':_0xd213('0x198')});db[_0xd213('0x194')][_0xd213('0x129')](db[_0xd213('0x13')],{'onDelete':'cascade','as':_0xd213('0x13')});db['ChatMessage']['belongsTo'](db[_0xd213('0x12d')],{'onDelete':_0xd213('0x11f'),'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x194')]['belongsTo'](db[_0xd213('0x133')],{'onDelete':_0xd213('0x11f'),'as':'Interaction','foreignKey':_0xd213('0x198')});db[_0xd213('0x194')][_0xd213('0x129')](db[_0xd213('0xf1')],{'as':_0xd213('0xf1'),'foreignKey':_0xd213('0x182')});db[_0xd213('0x194')][_0xd213('0x129')](db[_0xd213('0x63')],{'as':'Account','foreignKey':_0xd213('0x192')});db[_0xd213('0x17a')]['hasMany'](db[_0xd213('0xf1')],{'as':_0xd213('0x178'),'foreignKey':_0xd213('0x19a'),'onDelete':_0xd213('0x11f'),'hooks':!![]});db['ChatOfflineMessage'][_0xd213('0x129')](db[_0xd213('0x12d')],{'onDelete':_0xd213('0x11f'),'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x17a')][_0xd213('0x129')](db[_0xd213('0x63')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x192')});db[_0xd213('0x13a')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':'UserChatQueue','hooks':!![]});db[_0xd213('0x13a')][_0xd213('0x12b')](db['Team'],{'through':_0xd213('0x19b'),'as':'Teams'});db['ChatGroup'][_0xd213('0x11d')](db['ChatInternalMessage'],{'as':_0xd213('0x16b'),'foreignKey':_0xd213('0x19c'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x6c')]['belongsToMany'](db[_0xd213('0x13')],{'as':_0xd213('0x19d'),'through':_0xd213('0x19e')});db['ChatProactiveAction'][_0xd213('0x129')](db[_0xd213('0x63')],{'as':_0xd213('0x197'),'foreignKey':_0xd213('0x192')});db[_0xd213('0x70')][_0xd213('0x11d')](db['CmContact'],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xd213('0x12d')][_0xd213('0x11d')](db[_0xd213('0x72')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0xd213('0x12d')][_0xd213('0x11d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd213('0x163')});db['CmContact'][_0xd213('0x11d')](db[_0xd213('0x76')],{'as':'HopperHistories','foreignKey':_0xd213('0x163')});db[_0xd213('0x12d')][_0xd213('0x11d')](db[_0xd213('0x122')],{'as':_0xd213('0x122'),'foreignKey':'ContactId'});db[_0xd213('0x12d')][_0xd213('0x11d')](db[_0xd213('0xdb')],{'as':_0xd213('0x151'),'foreignKey':_0xd213('0x163')});db[_0xd213('0x12d')]['hasMany'](db[_0xd213('0x5f')],{'as':_0xd213('0x136'),'foreignKey':_0xd213('0x163'),'onDelete':_0xd213('0x166')});db[_0xd213('0x12d')][_0xd213('0x11d')](db[_0xd213('0x133')],{'as':_0xd213('0x19f'),'foreignKey':_0xd213('0x163'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xd213('0x58')],{'as':_0xd213('0x123'),'foreignKey':_0xd213('0x163'),'onDelete':_0xd213('0x166')});db[_0xd213('0x12d')][_0xd213('0x11d')](db['FaxInteraction'],{'as':_0xd213('0x125'),'foreignKey':_0xd213('0x163'),'onDelete':_0xd213('0x166')});db[_0xd213('0x12d')]['hasMany'](db[_0xd213('0x43')],{'as':'MailInteractions','foreignKey':_0xd213('0x163'),'onDelete':'restrict'});db[_0xd213('0x12d')]['belongsTo'](db[_0xd213('0x70')],{'as':_0xd213('0x1a0'),'foreignKey':'CompanyId'});db[_0xd213('0x12d')][_0xd213('0x129')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0xd213('0x11f')});db['CmContact'][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x180'),'through':'cm_user_has_contacts'});db[_0xd213('0x12d')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'as':_0xd213('0x175'),'through':_0xd213('0x1a1')});db['CmContact'][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':'cm_contact_has_tags','as':_0xd213('0x176')});db[_0xd213('0x72')]['belongsTo'](db['CmContact'],{'as':_0xd213('0x162'),'foreignKey':_0xd213('0x163'),'onDelete':_0xd213('0x11f')});db['CmHopper'][_0xd213('0x129')](db['CmList'],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x72')][_0xd213('0x129')](db['User'],{'as':_0xd213('0x195'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x72')][_0xd213('0x129')](db[_0xd213('0x1e')],{'as':_0xd213('0x1a2'),'foreignKey':_0xd213('0x14d'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x72')][_0xd213('0x129')](db[_0xd213('0xee')],{'as':'Campaign','foreignKey':_0xd213('0x1a3'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x72')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x174'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xd213('0x1a4')]['belongsTo'](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x1a4')][_0xd213('0x129')](db[_0xd213('0x1e')],{'as':_0xd213('0x1a2'),'foreignKey':'VoiceQueueId','onDelete':_0xd213('0x11f')});db[_0xd213('0x1a4')][_0xd213('0x129')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xd213('0x11f')});db[_0xd213('0x1a5')][_0xd213('0x11d')](db['Condition'],{'as':{'plural':_0xd213('0x1a6'),'singular':_0xd213('0x1a7')},'foreignKey':_0xd213('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xd213('0x1a5')][_0xd213('0x11d')](db['Condition'],{'as':{'plural':_0xd213('0x1a9'),'singular':_0xd213('0x1aa')},'foreignKey':_0xd213('0x1ab'),'onDelete':_0xd213('0x11f'),'hooks':!![]});db[_0xd213('0x1a5')]['hasMany'](db[_0xd213('0x7b')],{'as':_0xd213('0x1ac'),'foreignKey':'AutomationId','onDelete':_0xd213('0x11f'),'hooks':!![]});db[_0xd213('0x80')]['hasMany'](db[_0xd213('0x80')],{'as':'Dispositions','foreignKey':_0xd213('0x1ad'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x155')]['hasMany'](db['Interval'],{'as':_0xd213('0x1ae'),'foreignKey':_0xd213('0x156'),'onDelete':_0xd213('0x11f'),'hooks':!![],'required':![]});db[_0xd213('0x155')][_0xd213('0x11d')](db[_0xd213('0x1a')],{'as':_0xd213('0x1af'),'foreignKey':_0xd213('0x156'),'onDelete':_0xd213('0x166')});db[_0xd213('0x155')][_0xd213('0x11d')](db[_0xd213('0x47')],{'as':_0xd213('0x1b0'),'foreignKey':_0xd213('0x156')});db[_0xd213('0x155')][_0xd213('0x11d')](db[_0xd213('0x67')],{'as':_0xd213('0x1b1'),'foreignKey':_0xd213('0x156')});db[_0xd213('0x155')][_0xd213('0x11d')](db[_0xd213('0x17d')],{'as':_0xd213('0x1b2'),'foreignKey':_0xd213('0x156')});db[_0xd213('0x155')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xd213('0x8a')][_0xd213('0x129')](db[_0xd213('0x3e')],{});db['Schedule'][_0xd213('0x129')](db[_0xd213('0x9b')],{'foreignKey':_0xd213('0x1b3')});db[_0xd213('0x8a')][_0xd213('0x129')](db[_0xd213('0x99')],{'foreignKey':'CustomReportId'});db[_0xd213('0x8c')]['belongsToMany'](db[_0xd213('0x1c')],{'as':_0xd213('0x1b4'),'through':_0xd213('0x14c'),'onDelete':_0xd213('0x166')});db['Tag'][_0xd213('0x12b')](db[_0xd213('0x12d')],{'through':_0xd213('0x1a1')});db[_0xd213('0x8e')]['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xd213('0x8e')][_0xd213('0x12b')](db[_0xd213('0x43')],{'through':_0xd213('0x1b5')});db[_0xd213('0x8e')][_0xd213('0x12b')](db[_0xd213('0x58')],{'through':'sms_interaction_has_tags'});db[_0xd213('0x8e')][_0xd213('0x12b')](db[_0xd213('0x124')],{'through':_0xd213('0x17f')});db[_0xd213('0x8e')][_0xd213('0x12b')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xd213('0x8e')]['belongsToMany'](db[_0xd213('0x108')],{'through':'whatsapp_interaction_has_tags'});db[_0xd213('0x92')][_0xd213('0x11d')](db[_0xd213('0x82')],{'as':{'plural':_0xd213('0x1b6'),'singular':_0xd213('0x1b7')},'foreignKey':_0xd213('0x1b8'),'onDelete':_0xd213('0x11f'),'hooks':!![]});db[_0xd213('0x92')][_0xd213('0x11d')](db['Condition'],{'as':{'plural':_0xd213('0x1b9'),'singular':_0xd213('0x1ba')},'foreignKey':_0xd213('0x1bb'),'onDelete':_0xd213('0x11f'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd213('0x7b')],{'as':_0xd213('0x1ac'),'foreignKey':'TriggerId','onDelete':_0xd213('0x11f'),'hooks':!![]});db[_0xd213('0x99')][_0xd213('0x11d')](db[_0xd213('0xa0')],{'as':_0xd213('0x1bc'),'onDelete':_0xd213('0x11f'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xd213('0x9b')][_0xd213('0x11d')](db[_0xd213('0xa0')],{'as':_0xd213('0x1bc'),'onDelete':_0xd213('0x11f'),'foreignKey':'DefaultReportId'});db[_0xd213('0x1bd')][_0xd213('0x11d')](db[_0xd213('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0xd213('0xa0')][_0xd213('0x129')](db['AnalyticMetric'],{'foreignKey':_0xd213('0x1be')});db[_0xd213('0xa4')][_0xd213('0x11d')](db[_0xd213('0xa6')],{'as':_0xd213('0x1bf'),'onDelete':'cascade','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xa6')][_0xd213('0x11d')](db[_0xd213('0x1c1')],{'as':_0xd213('0x1c2'),'onDelete':'cascade','foreignKey':_0xd213('0x1c3')});db[_0xd213('0xa6')][_0xd213('0x11d')](db[_0xd213('0x1c1')],{'as':_0xd213('0x1c4'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xa6')][_0xd213('0x11d')](db[_0xd213('0x1c1')],{'as':_0xd213('0x1bc'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c6')});db['SalesforceConfiguration'][_0xd213('0x129')](db[_0xd213('0xa4')],{'as':_0xd213('0x173'),'foreignKey':'AccountId'});db[_0xd213('0x1c1')][_0xd213('0x11d')](db[_0xd213('0x1c1')],{'as':_0xd213('0x1c7'),'foreignKey':'SubjectId'});db[_0xd213('0x1c1')][_0xd213('0x11d')](db[_0xd213('0x1c1')],{'as':'Description','foreignKey':_0xd213('0x1c5')});db['SalesforceField'][_0xd213('0x11d')](db['SalesforceField'],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0x1c1')]['belongsTo'](db['Variable'],{'as':_0xd213('0x94'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0xd213('0x11d')](db['SugarcrmConfiguration'],{'as':_0xd213('0x1bf'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xab')][_0xd213('0x11d')](db['SugarcrmField'],{'as':_0xd213('0x1c2'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xab')][_0xd213('0x11d')](db[_0xd213('0xad')],{'as':_0xd213('0x1c4'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c5')});db['SugarcrmConfiguration'][_0xd213('0x11d')](db[_0xd213('0xad')],{'as':_0xd213('0x1bc'),'onDelete':_0xd213('0x11f'),'foreignKey':'FieldId'});db[_0xd213('0xab')][_0xd213('0x129')](db[_0xd213('0xa9')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xad')][_0xd213('0x11d')](db[_0xd213('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd213('0xad')][_0xd213('0x11d')](db[_0xd213('0xad')],{'as':'Description','foreignKey':_0xd213('0x1c5')});db[_0xd213('0xad')][_0xd213('0x11d')](db['SugarcrmField'],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0xad')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':'VariableId'});db[_0xd213('0x1c9')]['hasMany'](db[_0xd213('0xaf')],{'as':_0xd213('0x1bf'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c0')});db['DeskConfiguration'][_0xd213('0x11d')](db['DeskField'],{'as':_0xd213('0x1c2'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xaf')][_0xd213('0x11d')](db['DeskField'],{'as':_0xd213('0x1c4'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xaf')][_0xd213('0x11d')](db[_0xd213('0xb1')],{'as':_0xd213('0x1bc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xd213('0xaf')][_0xd213('0x129')](db['DeskAccount'],{'as':_0xd213('0x173'),'foreignKey':'AccountId'});db[_0xd213('0xaf')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x1ca')});db['DeskField'][_0xd213('0x11d')](db[_0xd213('0xb1')],{'as':_0xd213('0x1c7'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xb1')][_0xd213('0x11d')](db['DeskField'],{'as':_0xd213('0x1cb'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xb1')][_0xd213('0x11d')](db['DeskField'],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0xb1')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':_0xd213('0x1cc')});db[_0xd213('0xb3')]['hasMany'](db[_0xd213('0xb5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xb5')]['hasMany'](db[_0xd213('0xb7')],{'as':_0xd213('0x1c2'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xb5')]['hasMany'](db[_0xd213('0xb7')],{'as':_0xd213('0x1c4'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xb5')][_0xd213('0x11d')](db[_0xd213('0xb7')],{'as':_0xd213('0x1bc'),'onDelete':'cascade','foreignKey':_0xd213('0x1c6')});db[_0xd213('0xb5')]['belongsTo'](db[_0xd213('0xb3')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xb7')][_0xd213('0x11d')](db[_0xd213('0xb7')],{'as':_0xd213('0x1c7'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xb7')][_0xd213('0x11d')](db['ZohoField'],{'as':_0xd213('0x1cb'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xb7')]['hasMany'](db[_0xd213('0xb7')],{'as':_0xd213('0x1c8'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0xd213('0x94')],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount'][_0xd213('0x11d')](db['ZendeskConfiguration'],{'as':_0xd213('0x1bf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd213('0x1cd')][_0xd213('0x11d')](db[_0xd213('0xb9')],{'as':_0xd213('0x1c2'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0x1cd')][_0xd213('0x11d')](db[_0xd213('0xb9')],{'as':_0xd213('0x1c4'),'foreignKey':_0xd213('0x1c5')});db['ZendeskConfiguration'][_0xd213('0x11d')](db[_0xd213('0xb9')],{'as':_0xd213('0x1bc'),'foreignKey':'FieldId'});db[_0xd213('0x1cd')][_0xd213('0x129')](db[_0xd213('0x1ce')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0x1cd')][_0xd213('0x12b')](db[_0xd213('0x8e')],{'through':_0xd213('0x1cf')});db['ZendeskField']['hasMany'](db[_0xd213('0xb9')],{'as':_0xd213('0x1c7'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xb9')][_0xd213('0x11d')](db['ZendeskField'],{'as':_0xd213('0x1cb'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xb9')][_0xd213('0x11d')](db[_0xd213('0xb9')],{'as':'Field','foreignKey':_0xd213('0x1c6')});db[_0xd213('0xb9')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':_0xd213('0x1cc')});db['FreshdeskAccount'][_0xd213('0x11d')](db['FreshdeskConfiguration'],{'as':_0xd213('0x1bf'),'onDelete':'cascade','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xbd')]['hasMany'](db[_0xd213('0xbf')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xd213('0xbd')][_0xd213('0x11d')](db[_0xd213('0xbf')],{'as':_0xd213('0x1c4'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xd213('0x11d')](db[_0xd213('0xbf')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd213('0x1c6')});db['FreshdeskConfiguration'][_0xd213('0x129')](db[_0xd213('0xbb')],{'as':'Account','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xbd')][_0xd213('0x12b')](db['Tag'],{'through':_0xd213('0x1d0')});db[_0xd213('0xbf')][_0xd213('0x11d')](db[_0xd213('0xbf')],{'as':_0xd213('0x1c7'),'foreignKey':'SubjectId'});db[_0xd213('0xbf')]['hasMany'](db[_0xd213('0xbf')],{'as':'Description','foreignKey':_0xd213('0x1c5')});db['FreshdeskField'][_0xd213('0x11d')](db[_0xd213('0xbf')],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0xbf')][_0xd213('0x129')](db['Variable'],{'as':_0xd213('0x94'),'foreignKey':_0xd213('0x1cc')});db[_0xd213('0xc1')]['hasMany'](db[_0xd213('0xc2')],{'as':_0xd213('0x1bf'),'onDelete':'cascade','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xc2')][_0xd213('0x11d')](db['VtigerField'],{'as':_0xd213('0x1c2'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xc2')][_0xd213('0x11d')](db[_0xd213('0xc4')],{'as':_0xd213('0x1c4'),'foreignKey':_0xd213('0x1c5')});db['VtigerConfiguration'][_0xd213('0x11d')](db[_0xd213('0xc4')],{'as':_0xd213('0x1bc'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0xc2')][_0xd213('0x129')](db[_0xd213('0xc1')],{'as':_0xd213('0x173'),'foreignKey':'AccountId'});db[_0xd213('0xc4')][_0xd213('0x11d')](db[_0xd213('0xc4')],{'as':_0xd213('0x1c7'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xc4')]['hasMany'](db['VtigerField'],{'as':_0xd213('0x1cb'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xc4')][_0xd213('0x11d')](db['VtigerField'],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0xc4')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':_0xd213('0x1cc')});db[_0xd213('0xc6')]['hasMany'](db[_0xd213('0xc8')],{'as':_0xd213('0x1bf'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xc8')]['hasMany'](db[_0xd213('0x1d1')],{'as':'Subjects','foreignKey':_0xd213('0x1c3')});db[_0xd213('0xc8')]['hasMany'](db[_0xd213('0x1d1')],{'as':_0xd213('0x1c4'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xc8')][_0xd213('0x11d')](db[_0xd213('0x1d1')],{'as':_0xd213('0x1bc'),'foreignKey':'FieldId'});db[_0xd213('0xc8')][_0xd213('0x129')](db[_0xd213('0xc6')],{'as':_0xd213('0x173'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db[_0xd213('0x1d1')],{'as':_0xd213('0x1c7'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0x1d1')]['hasMany'](db[_0xd213('0x1d1')],{'as':_0xd213('0x1cb'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0x1d1')][_0xd213('0x11d')](db[_0xd213('0x1d1')],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0x1d1')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':'VariableId'});db[_0xd213('0xca')]['hasMany'](db[_0xd213('0xcb')],{'as':_0xd213('0x1bf'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xca')][_0xd213('0x129')](db[_0xd213('0x110')],{'as':_0xd213('0x110'),'foreignKey':_0xd213('0x165')});db['Dynamics365Configuration'][_0xd213('0x11d')](db[_0xd213('0xcd')],{'as':_0xd213('0x1c2'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c3')});db[_0xd213('0xcb')][_0xd213('0x11d')](db[_0xd213('0xcd')],{'as':_0xd213('0x1c4'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0xcb')][_0xd213('0x11d')](db[_0xd213('0xcd')],{'as':_0xd213('0x1bc'),'onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x1c6')});db['Dynamics365Configuration'][_0xd213('0x129')](db[_0xd213('0xca')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x1c0')});db[_0xd213('0xcd')][_0xd213('0x11d')](db['Dynamics365Field'],{'as':_0xd213('0x1c7'),'foreignKey':'SubjectId'});db[_0xd213('0xcd')][_0xd213('0x11d')](db[_0xd213('0xcd')],{'as':'Description','foreignKey':_0xd213('0x1c5')});db[_0xd213('0xcd')][_0xd213('0x11d')](db[_0xd213('0xcd')],{'as':'Field','foreignKey':_0xd213('0x1c6')});db[_0xd213('0xcd')][_0xd213('0x129')](db[_0xd213('0x94')],{'as':_0xd213('0x94'),'foreignKey':'VariableId'});db[_0xd213('0x1d2')][_0xd213('0x11d')](db[_0xd213('0x1d3')],{'as':_0xd213('0x1bf'),'onDelete':'cascade','foreignKey':_0xd213('0x1c0')});db[_0xd213('0x1d3')][_0xd213('0x11d')](db[_0xd213('0xd0')],{'as':_0xd213('0x1c2'),'foreignKey':_0xd213('0x1c3')});db['FreshsalesConfiguration'][_0xd213('0x11d')](db[_0xd213('0xd0')],{'as':_0xd213('0x1c4'),'foreignKey':_0xd213('0x1c5')});db[_0xd213('0x1d3')][_0xd213('0x11d')](db[_0xd213('0xd0')],{'as':_0xd213('0x1bc'),'foreignKey':_0xd213('0x1c6')});db[_0xd213('0x1d3')]['belongsTo'](db[_0xd213('0x1d2')],{'as':'Account','foreignKey':_0xd213('0x1c0')});db[_0xd213('0xd0')][_0xd213('0x11d')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xd213('0x1c3')});db[_0xd213('0xd0')][_0xd213('0x11d')](db[_0xd213('0xd0')],{'as':'Description','foreignKey':_0xd213('0x1c5')});db[_0xd213('0xd0')][_0xd213('0x11d')](db[_0xd213('0xd0')],{'as':_0xd213('0x1c8'),'foreignKey':_0xd213('0x1c6')});db['FreshsalesField'][_0xd213('0x129')](db['Variable'],{'as':_0xd213('0x94'),'foreignKey':_0xd213('0x1cc')});db[_0xd213('0x1d4')][_0xd213('0x129')](db[_0xd213('0x63')],{});db[_0xd213('0x1d4')][_0xd213('0x129')](db['CmList'],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x1d4')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':_0xd213('0x162'),'foreignKey':'ContactId'});db[_0xd213('0x1d4')]['belongsTo'](db[_0xd213('0x133')],{});db[_0xd213('0x1d4')][_0xd213('0x129')](db[_0xd213('0x194')],{});db[_0xd213('0x1d4')][_0xd213('0x129')](db[_0xd213('0x13')],{});db['ChatQueueReport'][_0xd213('0x129')](db[_0xd213('0x13a')],{});db[_0xd213('0xd5')]['belongsTo'](db[_0xd213('0x13')],{'onDelete':_0xd213('0x11f'),'foreignKey':'FromId'});db[_0xd213('0xd5')][_0xd213('0x129')](db['User'],{'onDelete':'cascade','foreignKey':_0xd213('0x1d5')});db[_0xd213('0xdb')][_0xd213('0x11d')](db[_0xd213('0xd9')],{'foreignKey':_0xd213('0x1d6'),'onDelete':_0xd213('0x11f')});db[_0xd213('0xdb')][_0xd213('0x11d')](db[_0xd213('0xd7')],{'foreignKey':'SessionId','onDelete':_0xd213('0x11f')});db[_0xd213('0x1d7')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x1d7')]['belongsTo'](db[_0xd213('0x12d')],{'as':'Contact','foreignKey':_0xd213('0x163')});db[_0xd213('0x1d7')][_0xd213('0x129')](db[_0xd213('0x58')],{});db[_0xd213('0x1d7')][_0xd213('0x129')](db[_0xd213('0x59')],{});db[_0xd213('0x1d7')][_0xd213('0x129')](db[_0xd213('0x13')],{});db[_0xd213('0x1d7')][_0xd213('0x129')](db['SmsQueue'],{});db[_0xd213('0xe1')][_0xd213('0x11d')](db[_0xd213('0xdb')],{'foreignKey':_0xd213('0x1d8')});db['JscriptyProject'][_0xd213('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0xd213('0x1d8')});db[_0xd213('0xe1')]['hasMany'](db[_0xd213('0xd7')],{'foreignKey':'ProjectId'});db[_0xd213('0xe5')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':'Users','through':'user_has_square_projects'});db[_0xd213('0xea')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x1d9')});db[_0xd213('0xea')][_0xd213('0x12b')](db[_0xd213('0x1e')],{'through':_0xd213('0x111'),'as':_0xd213('0x138')});db[_0xd213('0xea')][_0xd213('0x12b')](db['MailQueue'],{'through':_0xd213('0x172'),'as':'MailQueues'});db['Team'][_0xd213('0x12b')](db[_0xd213('0x13a')],{'through':_0xd213('0x19b'),'as':_0xd213('0x1da')});db[_0xd213('0xea')][_0xd213('0x12b')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team']['belongsToMany'](db[_0xd213('0x186')],{'through':_0xd213('0x18a'),'as':_0xd213('0x13c')});db[_0xd213('0xea')]['belongsToMany'](db[_0xd213('0x13d')],{'through':_0xd213('0x191'),'as':_0xd213('0x13e')});db[_0xd213('0xea')][_0xd213('0x12b')](db[_0xd213('0x10e')],{'through':'team_has_whatsapp_queues','as':_0xd213('0x13f')});db[_0xd213('0xea')][_0xd213('0x12b')](db[_0xd213('0xfd')],{'through':'TeamVoicePrefix','as':_0xd213('0x139')});db[_0xd213('0xee')]['hasMany'](db[_0xd213('0x72')],{'as':_0xd213('0x14e'),'foreignKey':_0xd213('0x1a3')});db['Campaign'][_0xd213('0x11d')](db[_0xd213('0x74')],{'as':_0xd213('0x120'),'foreignKey':_0xd213('0x1a3')});db['Campaign'][_0xd213('0x11d')](db[_0xd213('0x76')],{'as':_0xd213('0x14f'),'foreignKey':'CampaignId'});db[_0xd213('0xee')][_0xd213('0x11d')](db[_0xd213('0x1a4')],{'as':_0xd213('0x150'),'foreignKey':'CampaignId'});db[_0xd213('0xee')][_0xd213('0x129')](db['Trunk'],{'as':_0xd213('0x2e'),'foreignKey':'TrunkId'});db['Campaign'][_0xd213('0x129')](db['Trunk'],{'as':_0xd213('0x153'),'foreignKey':_0xd213('0x154')});db[_0xd213('0xee')]['belongsTo'](db[_0xd213('0x155')],{'as':_0xd213('0x155'),'foreignKey':_0xd213('0x156')});db[_0xd213('0xee')][_0xd213('0x129')](db[_0xd213('0xe5')],{'as':'SquareProject','foreignKey':_0xd213('0x1db')});db[_0xd213('0xee')][_0xd213('0x12b')](db[_0xd213('0x12f')],{'as':_0xd213('0x130'),'through':_0xd213('0x1dc')});db['Campaign'][_0xd213('0x12b')](db[_0xd213('0x12f')],{'as':_0xd213('0x1dd'),'through':_0xd213('0x1de')});db['Attachment'][_0xd213('0x129')](db[_0xd213('0x17a')],{'as':_0xd213('0x17a'),'foreignKey':_0xd213('0x19a')});db[_0xd213('0xf5')][_0xd213('0x129')](db[_0xd213('0x45')],{});db[_0xd213('0xf5')][_0xd213('0x129')](db['MailInteraction'],{});db[_0xd213('0xf5')][_0xd213('0x129')](db[_0xd213('0x3e')],{'foreignKey':_0xd213('0x1df'),'as':_0xd213('0x1e0')});db[_0xd213('0xf5')][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':'FromUserId','as':_0xd213('0x1e1')});db['MailTransferReport'][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':_0xd213('0x1e2'),'as':_0xd213('0x1e3')});db['MailTransferReport']['belongsTo'](db[_0xd213('0x171')],{'foreignKey':_0xd213('0x1e4'),'as':_0xd213('0x1e5')});db[_0xd213('0xf5')][_0xd213('0x129')](db[_0xd213('0x3e')],{'foreignKey':_0xd213('0x1e6'),'as':_0xd213('0x1e7')});db[_0xd213('0x1e8')][_0xd213('0x129')](db[_0xd213('0x194')],{});db['ChatTransferReport'][_0xd213('0x129')](db['ChatInteraction'],{});db[_0xd213('0x1e8')][_0xd213('0x129')](db[_0xd213('0x63')],{'foreignKey':_0xd213('0x1e9'),'as':_0xd213('0x1e0')});db[_0xd213('0x1e8')][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':_0xd213('0x1ea'),'as':_0xd213('0x1e1')});db[_0xd213('0x1e8')][_0xd213('0x129')](db['User'],{'foreignKey':_0xd213('0x1e2'),'as':_0xd213('0x1e3')});db[_0xd213('0x1e8')][_0xd213('0x129')](db[_0xd213('0x13a')],{'foreignKey':_0xd213('0x1eb'),'as':_0xd213('0x1e5')});db[_0xd213('0x1e8')][_0xd213('0x129')](db[_0xd213('0x63')],{'foreignKey':_0xd213('0x1ec'),'as':_0xd213('0x1e7')});db['FaxTransferReport'][_0xd213('0x129')](db[_0xd213('0x17c')],{});db[_0xd213('0xf8')][_0xd213('0x129')](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0xd213('0x4c')],{'foreignKey':_0xd213('0x1ed'),'as':_0xd213('0x1e0')});db['FaxTransferReport'][_0xd213('0x129')](db['User'],{'foreignKey':'FromUserId','as':_0xd213('0x1e1')});db['FaxTransferReport'][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':'ToUserId','as':_0xd213('0x1e3')});db['FaxTransferReport'][_0xd213('0x129')](db[_0xd213('0x51')],{'foreignKey':_0xd213('0x1ee'),'as':_0xd213('0x1e5')});db['FaxTransferReport'][_0xd213('0x129')](db[_0xd213('0x4c')],{'foreignKey':'ToFaxAccountId','as':_0xd213('0x1e7')});db[_0xd213('0xfa')]['belongsTo'](db[_0xd213('0x61')],{});db[_0xd213('0xfa')]['belongsTo'](db[_0xd213('0x5f')],{});db[_0xd213('0xfa')]['belongsTo'](db[_0xd213('0x5c')],{'foreignKey':_0xd213('0x1ef'),'as':_0xd213('0x1e0')});db[_0xd213('0xfa')]['belongsTo'](db['User'],{'foreignKey':_0xd213('0x1ea'),'as':'FromAgent'});db[_0xd213('0xfa')][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':_0xd213('0x1e2'),'as':_0xd213('0x1e3')});db[_0xd213('0xfa')][_0xd213('0x129')](db['OpenchannelQueue'],{'foreignKey':_0xd213('0x1f0'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0xd213('0x129')](db[_0xd213('0x5c')],{'foreignKey':_0xd213('0x1f1'),'as':'ToAccount'});db[_0xd213('0xfc')]['belongsTo'](db[_0xd213('0x59')],{});db['SmsTransferReport'][_0xd213('0x129')](db['SmsInteraction'],{});db[_0xd213('0xfc')][_0xd213('0x129')](db[_0xd213('0x54')],{'foreignKey':_0xd213('0x1f2'),'as':_0xd213('0x1e0')});db['SmsTransferReport']['belongsTo'](db[_0xd213('0x13')],{'foreignKey':'FromUserId','as':_0xd213('0x1e1')});db[_0xd213('0xfc')][_0xd213('0x129')](db[_0xd213('0x13')],{'foreignKey':_0xd213('0x1e2'),'as':_0xd213('0x1e3')});db[_0xd213('0xfc')][_0xd213('0x129')](db[_0xd213('0x186')],{'foreignKey':_0xd213('0x1f3'),'as':_0xd213('0x1e5')});db[_0xd213('0xfc')][_0xd213('0x129')](db[_0xd213('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xd213('0x12f')][_0xd213('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xd213('0x16f'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x12f')][_0xd213('0x11d')](db[_0xd213('0x79')],{'as':'CustomFields','foreignKey':_0xd213('0x16f')});db[_0xd213('0x12f')][_0xd213('0x11d')](db['CmContact'],{'as':'Contacts','onDelete':_0xd213('0x11f'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x12f')]['hasMany'](db['CmHopperFinal'],{'as':_0xd213('0x120'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x12f')][_0xd213('0x11d')](db[_0xd213('0x76')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xd213('0x12f')]['hasMany'](db[_0xd213('0x122')],{'as':_0xd213('0x122'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x12f')][_0xd213('0x12b')](db[_0xd213('0x1e')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xd213('0x12f')]['belongsToMany'](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0xd213('0x1a')],{'as':'Extensions','onDelete':_0xd213('0x11f')});db[_0xd213('0xfd')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x115')});db[_0xd213('0xfd')][_0xd213('0x12b')](db[_0xd213('0xea')],{'through':_0xd213('0x113'),'as':_0xd213('0x15b')});db[_0xd213('0xff')][_0xd213('0x11d')](db[_0xd213('0x13')],{'as':_0xd213('0x180'),'foreignKey':'userProfileId'});db[_0xd213('0xff')][_0xd213('0x11d')](db['UserProfileSection'],{'as':_0xd213('0x1f4'),'foreignKey':_0xd213('0x12a'),'onDelete':'cascade'});db[_0xd213('0x1f5')][_0xd213('0x11d')](db[_0xd213('0x101')],{'as':_0xd213('0x1f6'),'foreignKey':_0xd213('0x1f7'),'onDelete':'cascade'});db[_0xd213('0x1f8')][_0xd213('0x11d')](db['Disposition'],{'as':_0xd213('0x169'),'foreignKey':_0xd213('0x1f9'),'onDelete':_0xd213('0x11f')});db[_0xd213('0x1f8')][_0xd213('0x11d')](db[_0xd213('0x7e')],{'as':_0xd213('0x16a'),'foreignKey':_0xd213('0x1f9')});db[_0xd213('0x1f8')]['hasMany'](db[_0xd213('0x10a')],{'as':_0xd213('0x16b'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xd213('0x11d')](db[_0xd213('0x108')],{'as':_0xd213('0x16c')});db[_0xd213('0x1f8')][_0xd213('0x11d')](db['WhatsappApplication'],{'as':_0xd213('0x16d')});db['WhatsappAccount'][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':'ListId'});db[_0xd213('0x1f8')][_0xd213('0x129')](db[_0xd213('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xd213('0x158')});db[_0xd213('0x1f8')][_0xd213('0x12b')](db[_0xd213('0x13')],{'as':_0xd213('0x15a'),'through':_0xd213('0x147')});db[_0xd213('0x106')][_0xd213('0x129')](db[_0xd213('0x13')],{'onDelete':'restrict'});db[_0xd213('0x106')][_0xd213('0x129')](db[_0xd213('0x10e')],{'onDelete':_0xd213('0x166')});db[_0xd213('0x106')][_0xd213('0x129')](db[_0xd213('0x1f8')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xd213('0x129')](db[_0xd213('0x155')],{'onDelete':'restrict','foreignKey':_0xd213('0x156')});db[_0xd213('0x106')][_0xd213('0x129')](db[_0xd213('0x8e')],{'onDelete':'restrict','foreignKey':_0xd213('0x17e')});db[_0xd213('0x108')]['hasMany'](db[_0xd213('0x10a')],{'as':_0xd213('0x16b'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':_0xd213('0x173'),'foreignKey':'WhatsappAccountId'});db[_0xd213('0x108')][_0xd213('0x129')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xd213('0x108')][_0xd213('0x129')](db[_0xd213('0x13')],{'as':_0xd213('0x174'),'foreignKey':_0xd213('0x119')});db[_0xd213('0x108')]['belongsToMany'](db[_0xd213('0x8e')],{'through':_0xd213('0x1fa'),'as':_0xd213('0x175')});db['WhatsappInteraction']['belongsToMany'](db[_0xd213('0x8e')],{'through':_0xd213('0x1fa'),'as':_0xd213('0x176')});db[_0xd213('0x108')]['belongsToMany'](db['User'],{'as':_0xd213('0x180'),'through':_0xd213('0x137'),'foreignKey':_0xd213('0x1fb')});db[_0xd213('0x10a')]['belongsTo'](db['User'],{'as':_0xd213('0x13')});db[_0xd213('0x10a')][_0xd213('0x129')](db['CmContact'],{'onDelete':_0xd213('0x11f'),'as':'Contact'});db[_0xd213('0x10a')]['belongsTo'](db[_0xd213('0x108')],{'onDelete':'cascade','as':_0xd213('0x179'),'foreignKey':_0xd213('0x1fb')});db['WhatsappMessage'][_0xd213('0x129')](db[_0xd213('0x1f8')],{'as':_0xd213('0x173'),'foreignKey':_0xd213('0x1f9')});db[_0xd213('0x10b')][_0xd213('0x129')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xd213('0x129')](db[_0xd213('0x12f')],{'as':_0xd213('0x16e'),'foreignKey':_0xd213('0x16f')});db[_0xd213('0x10b')][_0xd213('0x129')](db[_0xd213('0x12d')],{'as':'Contact','foreignKey':_0xd213('0x163')});db['WhatsappQueueReport'][_0xd213('0x129')](db[_0xd213('0x108')],{});db[_0xd213('0x10b')]['belongsTo'](db['WhatsappQueue'],{});db[_0xd213('0x10b')][_0xd213('0x129')](db[_0xd213('0x10a')],{});db['WhatsappQueueReport'][_0xd213('0x129')](db['User'],{});db[_0xd213('0x10d')][_0xd213('0x129')](db['WhatsappMessage'],{});db[_0xd213('0x10d')][_0xd213('0x129')](db[_0xd213('0x108')],{});db[_0xd213('0x10d')]['belongsTo'](db[_0xd213('0x1f8')],{'foreignKey':_0xd213('0x1fc'),'as':_0xd213('0x1e0')});db['WhatsappTransferReport'][_0xd213('0x129')](db['WhatsappAccount'],{'foreignKey':_0xd213('0x1fd'),'as':'ToAccount'});db[_0xd213('0x10d')][_0xd213('0x129')](db[_0xd213('0x10e')],{'foreignKey':_0xd213('0x1fe'),'as':_0xd213('0x1e5')});db[_0xd213('0x10d')]['belongsTo'](db['User'],{'foreignKey':_0xd213('0x1ea'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0xd213('0x13')],{'foreignKey':_0xd213('0x1e2'),'as':_0xd213('0x1e3')});db['WhatsappQueue']['belongsToMany'](db[_0xd213('0x13')],{'as':'Agents','through':_0xd213('0x38'),'foreignKey':'WhatsappQueueId'});db[_0xd213('0x10e')]['belongsToMany'](db[_0xd213('0xea')],{'through':'team_has_whatsapp_queues','as':_0xd213('0x15b')});db['UserSetting']['belongsTo'](db['User'],{'as':'user','foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0xd213('0x110')][_0xd213('0x117')](db[_0xd213('0xca')],{'as':_0xd213('0xca'),'onDelete':_0xd213('0x166')});db[_0xd213('0x110')]['hasOne'](db[_0xd213('0x3a')],{'as':_0xd213('0x167'),'onDelete':_0xd213('0x166')});db['CloudProvider'][_0xd213('0x117')](db[_0xd213('0x3c')],{'as':_0xd213('0x168'),'onDelete':_0xd213('0x166')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb1c8=['cm_user_has_lists','belongsToMany','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefix','VoicePrefixes','ChatQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','SquareProjects','user_has_square_projects','VoiceExtension','SpiedAgents','VoiceContext','Applications','moh_has_sounds','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','uniqueid','AgentReports','CmContact','Contact','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Answers','Interactions','MailApplication','List','TemplateId','user_has_mail_accounts','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','ListId','Dispositions','FaxAccountId','FaxApplication','FaxMessage','user_has_fax_accounts','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','Teams','FaxQueueReport','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatMessage','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','Agent','Campaign','CampaignId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','ParentId','Intervals','AnalyticDefaultReport','DefaultReportId','Mohs','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','CustomReportId','Fields','AnalyticMetric','Configurations','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','VariableId','SubjectId','Field','DeskAccount','DeskConfiguration','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowAccount','ServicenowConfiguration','ServicenowField','ChatQueueReport','FromId','SessionId','ProjectId','team_has_mail_queues','MailQueues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','FromAgent','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','name','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','User','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists'];(function(_0x1fe643,_0xc9b0a3){var _0x3ebd59=function(_0x106e5d){while(--_0x106e5d){_0x1fe643['push'](_0x1fe643['shift']());}};_0x3ebd59(++_0xc9b0a3);}(_0xb1c8,0xd1));var _0x8b1c=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xb1c8[_0x469ac7];return _0x22f3b0;};'use strict';var config=require(_0x8b1c('0x0'));var Sequelize=require(_0x8b1c('0x1'));var _=require(_0x8b1c('0x2'));var jstz=require('jstz');var timezone=jstz[_0x8b1c('0x3')]();config['sequelize']=_[_0x8b1c('0x4')](config['sequelize'],{'database':'motion2','username':_0x8b1c('0x5'),'password':_0x8b1c('0x6'),'options':{'host':_0x8b1c('0x7'),'port':0xcea,'dialect':_0x8b1c('0x8'),'dialectOptions':{'charset':_0x8b1c('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8b1c('0xa'),'collate':_0x8b1c('0xb')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0x8b1c('0xc')],{'database':_0x8b1c('0xd'),'username':_0x8b1c('0x5'),'password':_0x8b1c('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8b1c('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x8b1c('0xe')](),'define':{'charset':_0x8b1c('0xa'),'collate':_0x8b1c('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x8b1c('0xf')],config[_0x8b1c('0x1')][_0x8b1c('0x10')],config['sequelize'][_0x8b1c('0x11')],config['sequelize'][_0x8b1c('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b1c('0xc')][_0x8b1c('0xf')],config['sequelizeHistory'][_0x8b1c('0x10')],config[_0x8b1c('0xc')][_0x8b1c('0x11')],config[_0x8b1c('0xc')]['options'])};db['User']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x14'));db[_0x8b1c('0x15')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x16'));db['VoiceContext']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x17'));db['VoiceExtension']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x18'));db[_0x8b1c('0x19')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x1a'));db['VoiceQueue']=db[_0x8b1c('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x8b1c('0x1b')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x1c'));db[_0x8b1c('0x1d')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x1e'));db['VoiceMail']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x1f'));db[_0x8b1c('0x20')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x21'));db[_0x8b1c('0x22')]=db['sequelize'][_0x8b1c('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8b1c('0x23')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x24'));db[_0x8b1c('0x25')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x26'));db['VoiceQueueReport']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x27'));db[_0x8b1c('0x28')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x29'));db[_0x8b1c('0x2a')]=db['sequelize']['import'](_0x8b1c('0x2b'));db[_0x8b1c('0x2c')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x2d'));db[_0x8b1c('0x2e')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x2f'));db[_0x8b1c('0x30')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x31'));db[_0x8b1c('0x32')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x33'));db[_0x8b1c('0x34')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x35'));db['UserFaxQueue']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x36'));db[_0x8b1c('0x37')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x38'));db[_0x8b1c('0x39')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x3a'));db[_0x8b1c('0x3b')]=db['sequelize']['import'](_0x8b1c('0x3c'));db[_0x8b1c('0x3d')]=db['sequelize'][_0x8b1c('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x3e'));db[_0x8b1c('0x3f')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x40'));db[_0x8b1c('0x41')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x42'));db[_0x8b1c('0x43')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x44'));db[_0x8b1c('0x45')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x46'));db[_0x8b1c('0x47')]=db[_0x8b1c('0x1')]['import']('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x48'));db[_0x8b1c('0x49')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x4a'));db[_0x8b1c('0x4b')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x4c'));db[_0x8b1c('0x4d')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x4e'));db['FaxAccount']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x4f'));db['FaxApplication']=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x50'));db[_0x8b1c('0x51')]=db[_0x8b1c('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/faxMessage/faxMessage.model');db[_0x8b1c('0x52')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x53'));db['FaxQueueReport']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x54'));db['SmsAccount']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x55'));db['SmsApplication']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x56'));db[_0x8b1c('0x57')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x58'));db[_0x8b1c('0x59')]=db[_0x8b1c('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0x8b1c('0x5a')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/smsQueue/smsQueue.model');db[_0x8b1c('0x5b')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x5c'));db[_0x8b1c('0x5d')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x5e'));db[_0x8b1c('0x5f')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x60'));db[_0x8b1c('0x61')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x62'));db[_0x8b1c('0x63')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x64'));db[_0x8b1c('0x65')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x8b1c('0x66')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x67'));db['ChatApplication']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x68'));db[_0x8b1c('0x69')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x6a'));db['ChatMessage']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x6b'));db[_0x8b1c('0x6c')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x6d'));db['ChatQueue']=db[_0x8b1c('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x8b1c('0x6e')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x6f'));db[_0x8b1c('0x70')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x71'));db[_0x8b1c('0x72')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x73'));db['CmContact']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/cmContact/cmContact.model');db[_0x8b1c('0x74')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/cmHopper/cmHopper.model');db[_0x8b1c('0x75')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x76'));db[_0x8b1c('0x77')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8b1c('0x78')]=db[_0x8b1c('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x8b1c('0x79')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x7a'));db[_0x8b1c('0x7b')]=db[_0x8b1c('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/action/action.model');db['Automation']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x7c'));db[_0x8b1c('0x7d')]=db['sequelize'][_0x8b1c('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x8b1c('0x7e')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x7f'));db[_0x8b1c('0x80')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x81'));db[_0x8b1c('0x82')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x83'));db[_0x8b1c('0x84')]=db['sequelize'][_0x8b1c('0x13')]('../api/pause/pause.model');db[_0x8b1c('0x85')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x86'));db[_0x8b1c('0x87')]=db['sequelize'][_0x8b1c('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x8b1c('0x88')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x89'));db[_0x8b1c('0x8a')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x8b'));db[_0x8b1c('0x8c')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x8d'));db[_0x8b1c('0x8e')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x8f'));db[_0x8b1c('0x90')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x91'));db[_0x8b1c('0x92')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x93'));db[_0x8b1c('0x94')]=db['sequelize']['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x95'));db[_0x8b1c('0x96')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x97'));db['AnalyticDefaultReport']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x8b1c('0x98')]=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0x99'));db['AnalyticMetric']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x9a'));db[_0x8b1c('0x9b')]=db['sequelize']['import'](_0x8b1c('0x9c'));db['AnalyticTreeReport']=db[_0x8b1c('0x1')]['import'](_0x8b1c('0x9d'));db[_0x8b1c('0x9e')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x9f'));db[_0x8b1c('0xa0')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xa1'));db['SalesforceField']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xa2'));db[_0x8b1c('0xa3')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xa4'));db[_0x8b1c('0xa5')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xa6'));db[_0x8b1c('0xa7')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xa8'));db['DeskAccount']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0xa9'));db['DeskConfiguration']=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xaa'));db[_0x8b1c('0xab')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intDeskField/intDeskField.model');db[_0x8b1c('0xac')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xad'));db['ZohoConfiguration']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xae'));db[_0x8b1c('0xaf')]=db[_0x8b1c('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x8b1c('0xb0')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xb1'));db['ZendeskConfiguration']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0xb2'));db[_0x8b1c('0xb3')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xb4'));db[_0x8b1c('0xb5')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xb6'));db['FreshdeskConfiguration']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x8b1c('0xb7')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xb8'));db[_0x8b1c('0xb9')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xba'));db['ServicenowAccount']=db[_0x8b1c('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xbb'));db['ServicenowField']=db['sequelize']['import'](_0x8b1c('0xbc'));db[_0x8b1c('0xbd')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8b1c('0xbe')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xbf'));db[_0x8b1c('0xc0')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xc1'));db[_0x8b1c('0xc2')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xc3'));db[_0x8b1c('0xc4')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x8b1c('0xc5')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xc6'));db[_0x8b1c('0x94')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xc7'));db[_0x8b1c('0xc8')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/network/network.model');db['ChatQueueReport']=db['sequelize'][_0x8b1c('0x13')](_0x8b1c('0xc9'));db[_0x8b1c('0xca')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xcb'));db[_0x8b1c('0xcc')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xcd'));db[_0x8b1c('0xce')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xcf'));db[_0x8b1c('0xd0')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xd1'));db[_0x8b1c('0xd2')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xd3'));db[_0x8b1c('0xd4')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xd5'));db[_0x8b1c('0xd6')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x8b1c('0xd7')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xd8'));db[_0x8b1c('0xd9')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xda'));db[_0x8b1c('0xdb')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xdc'));db[_0x8b1c('0xdd')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xde'));db[_0x8b1c('0xdf')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xe0'));db['SquareMessage']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xe1'));db[_0x8b1c('0xe2')]=db[_0x8b1c('0x1')]['import']('../api/team/team.model');db[_0x8b1c('0xe3')]=db['sequelize']['import'](_0x8b1c('0xe4'));db['Campaign']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xe5'));db[_0x8b1c('0xe6')]=db[_0x8b1c('0x1')]['import']('../api/migration/migration.model');db[_0x8b1c('0xe7')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xe8'));db[_0x8b1c('0xe9')]=db['sequelize']['import'](_0x8b1c('0xea'));db[_0x8b1c('0xeb')]=db['sequelize'][_0x8b1c('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8b1c('0xec')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x8b1c('0xed')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8b1c('0xee')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xef'));db['SmsTransferReport']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xf0'));db['CmList']=db[_0x8b1c('0x1')]['import']('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x8b1c('0xf1')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xf2'));db[_0x8b1c('0xf3')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xf4'));db[_0x8b1c('0xf5')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xf6'));db[_0x8b1c('0xf7')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xf8'));db[_0x8b1c('0xf9')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xfa'));db['WhatsappApplication']=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0xfb'));db[_0x8b1c('0xfc')]=db[_0x8b1c('0x1')]['import'](_0x8b1c('0xfd'));db[_0x8b1c('0xfe')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x8b1c('0xff')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x100'));db[_0x8b1c('0x101')]=db[_0x8b1c('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x8b1c('0x102')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x8b1c('0x103')]=db[_0x8b1c('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x8b1c('0x104')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x8b1c('0x105')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x8b1c('0x106')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')](_0x8b1c('0x107'));db[_0x8b1c('0x108')]=db[_0x8b1c('0x1')][_0x8b1c('0x13')]('../api/user-setting/user-setting.model');db[_0x8b1c('0x109')][_0x8b1c('0x10a')](db[_0x8b1c('0x10b')],{'as':'VoiceMail','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10a')](db[_0x8b1c('0x108')],{'as':_0x8b1c('0x10e'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db[_0x8b1c('0x1b')],{'as':_0x8b1c('0x110'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x8b1c('0x111'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db['VoiceExtension'],{'as':_0x8b1c('0x112'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db['User']['hasMany'](db[_0x8b1c('0x77')],{'as':'HopperFinals','foreignKey':_0x8b1c('0x10d')});db['User'][_0x8b1c('0x10f')](db[_0x8b1c('0x78')],{'as':_0x8b1c('0x113'),'foreignKey':'UserId'});db['User'][_0x8b1c('0x10f')](db[_0x8b1c('0x79')],{'as':_0x8b1c('0x79'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db[_0x8b1c('0x5f')],{'as':_0x8b1c('0x114'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db[_0x8b1c('0x69')],{'as':'ChatInteractions','foreignKey':_0x8b1c('0x10d')});db['User']['hasMany'](db[_0x8b1c('0x57')],{'as':_0x8b1c('0x115'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db[_0x8b1c('0x51')],{'as':_0x8b1c('0x116'),'foreignKey':_0x8b1c('0x10d')});db['User'][_0x8b1c('0x10f')](db[_0x8b1c('0x45')],{'as':_0x8b1c('0x117'),'foreignKey':_0x8b1c('0x10d')});db['User']['hasMany'](db[_0x8b1c('0xfc')],{'as':_0x8b1c('0x118'),'foreignKey':'UserId'});db[_0x8b1c('0x109')][_0x8b1c('0x10f')](db[_0x8b1c('0xf7')],{'as':_0x8b1c('0x119'),'foreignKey':_0x8b1c('0x11a')});db[_0x8b1c('0x109')][_0x8b1c('0x11b')](db[_0x8b1c('0xf1')],{'as':_0x8b1c('0xf1'),'foreignKey':_0x8b1c('0x11c')});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x6e')],{'as':_0x8b1c('0x11d'),'through':_0x8b1c('0x11e')});db[_0x8b1c('0x109')]['belongsToMany'](db['CmContact'],{'as':_0x8b1c('0x11f'),'through':_0x8b1c('0x120')});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x122'),'through':_0x8b1c('0x123')});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db['Team'],{'through':_0x8b1c('0x125')});db['User']['belongsToMany'](db[_0x8b1c('0x45')],{'as':_0x8b1c('0x117'),'through':'user_has_mail_interactions'});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x69')],{'as':'ChatInteractions','through':_0x8b1c('0x126')});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x51')],{'as':_0x8b1c('0x116'),'through':'user_has_fax_interactions'});db['User'][_0x8b1c('0x124')](db[_0x8b1c('0x57')],{'as':_0x8b1c('0x115'),'through':_0x8b1c('0x127')});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x5f')],{'as':_0x8b1c('0x114'),'through':_0x8b1c('0x128')});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0xfc')],{'as':_0x8b1c('0x118'),'through':'user_has_whatsapp_interactions'});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x129')],{'as':_0x8b1c('0x12a'),'through':'UserVoiceQueue','required':![]});db['User'][_0x8b1c('0x124')](db[_0x8b1c('0x12b')],{'as':_0x8b1c('0x12c'),'through':_0x8b1c('0x106'),'required':![]});db['User'][_0x8b1c('0x124')](db[_0x8b1c('0x41')],{'as':'MailQueues','through':_0x8b1c('0x34'),'required':![]});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x12d')],{'as':_0x8b1c('0x12e'),'through':_0x8b1c('0x32'),'required':![],'hooks':!![]});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x52')],{'as':_0x8b1c('0x12f'),'through':_0x8b1c('0x130'),'required':![]});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x5a')],{'as':_0x8b1c('0x131'),'through':_0x8b1c('0x37'),'required':![]});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x63')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x102')],{'as':_0x8b1c('0x132'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x8b1c('0x124')](db['CmList'],{'through':_0x8b1c('0x123')});db['User']['belongsToMany'](db[_0x8b1c('0x65')],{'as':_0x8b1c('0x133'),'through':_0x8b1c('0x134')});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x135')],{'as':_0x8b1c('0x136'),'through':'user_has_fax_accounts'});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0x3f')],{'as':_0x8b1c('0x137'),'through':'user_has_mail_accounts'});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db['OpenchannelAccount'],{'as':_0x8b1c('0x138'),'through':_0x8b1c('0x139')});db[_0x8b1c('0x109')]['belongsToMany'](db[_0x8b1c('0x13a')],{'as':'SmsAccounts','through':_0x8b1c('0x13b')});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x8b1c('0x109')][_0x8b1c('0x124')](db[_0x8b1c('0xdd')],{'as':_0x8b1c('0x13c'),'through':_0x8b1c('0x13d')});db[_0x8b1c('0x15')][_0x8b1c('0x10f')](db[_0x8b1c('0x13e')],{'as':_0x8b1c('0x13f'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'ChanSpyId'});db[_0x8b1c('0x140')][_0x8b1c('0x10f')](db['VoiceExtension'],{'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x13e')][_0x8b1c('0x10f')](db[_0x8b1c('0x13e')],{'as':_0x8b1c('0x141'),'onDelete':_0x8b1c('0x10c')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x8b1c('0x8a')],{'as':'Sounds','through':_0x8b1c('0x142')});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db[_0x8b1c('0x2e')],{'as':'Members','foreignKey':_0x8b1c('0x143')});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db[_0x8b1c('0x74')],{'as':_0x8b1c('0x144'),'foreignKey':_0x8b1c('0x143')});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db[_0x8b1c('0x77')],{'as':_0x8b1c('0x145'),'foreignKey':_0x8b1c('0x143')});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db[_0x8b1c('0x78')],{'as':_0x8b1c('0x146'),'foreignKey':'VoiceQueueId'});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db[_0x8b1c('0x79')],{'as':_0x8b1c('0x79'),'foreignKey':'VoiceQueueId'});db[_0x8b1c('0x129')][_0x8b1c('0x10f')](db['CmHopperBlack'],{'as':_0x8b1c('0x147'),'foreignKey':_0x8b1c('0x143')});db['VoiceQueue'][_0x8b1c('0x10f')](db[_0x8b1c('0xd0')],{'as':_0x8b1c('0x148'),'foreignKey':_0x8b1c('0x143')});db[_0x8b1c('0x129')][_0x8b1c('0x11b')](db[_0x8b1c('0x2a')],{'as':'Trunk','foreignKey':_0x8b1c('0x149')});db[_0x8b1c('0x129')]['belongsTo'](db[_0x8b1c('0x2a')],{'as':_0x8b1c('0x14a'),'foreignKey':_0x8b1c('0x14b')});db[_0x8b1c('0x129')][_0x8b1c('0x11b')](db[_0x8b1c('0x82')],{'as':_0x8b1c('0x82'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x8b1c('0x11b')](db['Pause'],{'as':_0x8b1c('0x14c'),'foreignKey':_0x8b1c('0x14d')});db[_0x8b1c('0x129')][_0x8b1c('0x124')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x122'),'through':_0x8b1c('0x14e')});db[_0x8b1c('0x129')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x30')});db[_0x8b1c('0x129')][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'as':'Teams','through':_0x8b1c('0x104')});db['VoiceQueue']['belongsToMany'](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x150'),'through':_0x8b1c('0x151')});db[_0x8b1c('0x1b')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109'),'foreignKey':'UserId'});db[_0x8b1c('0x1d')]['belongsTo'](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109'),'foreignKey':'UserId'});db[_0x8b1c('0x10b')][_0x8b1c('0x10f')](db['VoiceMailMessage'],{'as':_0x8b1c('0x152'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x8b1c('0x153')});db[_0x8b1c('0x20')]['belongsTo'](db[_0x8b1c('0x10b')],{'foreignKey':'mailboxuser','targetKey':_0x8b1c('0x153')});db[_0x8b1c('0x22')][_0x8b1c('0x10f')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x8b1c('0x154'),'constraints':![]});db[_0x8b1c('0x22')][_0x8b1c('0x10f')](db['VoiceAgentReport'],{'as':_0x8b1c('0x155'),'foreignKey':_0x8b1c('0x154'),'constraints':![]});db[_0x8b1c('0x22')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109'),'foreignKey':'UserId'});db[_0x8b1c('0x22')]['belongsTo'](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':'ContactId'});db[_0x8b1c('0x3d')][_0x8b1c('0x11b')](db['MailAccount'],{'as':_0x8b1c('0x3f'),'foreignKey':_0x8b1c('0x158')});db[_0x8b1c('0x3d')][_0x8b1c('0x11b')](db[_0x8b1c('0x103')],{'as':_0x8b1c('0x103'),'foreignKey':'CloudProviderId','onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x15a')][_0x8b1c('0x11b')](db[_0x8b1c('0x3f')],{'as':_0x8b1c('0x3f'),'foreignKey':'MailAccountId'});db[_0x8b1c('0x15a')]['belongsTo'](db[_0x8b1c('0x103')],{'as':_0x8b1c('0x103'),'foreignKey':_0x8b1c('0x15b'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x3f')][_0x8b1c('0x10a')](db[_0x8b1c('0x3d')],{'as':_0x8b1c('0x15c'),'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x3f')]['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0x8b1c('0x10f')](db[_0x8b1c('0x7e')],{'as':'Dispositions','foreignKey':_0x8b1c('0x158'),'onDelete':_0x8b1c('0x10c')});db['MailAccount']['hasMany'](db[_0x8b1c('0x7d')],{'as':_0x8b1c('0x15d'),'foreignKey':_0x8b1c('0x158')});db[_0x8b1c('0x3f')][_0x8b1c('0x10f')](db[_0x8b1c('0x47')],{'as':'Messages','foreignKey':_0x8b1c('0x158')});db[_0x8b1c('0x3f')][_0x8b1c('0x10f')](db[_0x8b1c('0x45')],{'as':_0x8b1c('0x15e')});db[_0x8b1c('0x3f')]['hasMany'](db[_0x8b1c('0x15f')],{'as':_0x8b1c('0x141')});db[_0x8b1c('0x3f')][_0x8b1c('0x11b')](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':'ListId'});db[_0x8b1c('0x3f')][_0x8b1c('0x11b')](db['Template'],{'as':'Template','foreignKey':_0x8b1c('0x161')});db[_0x8b1c('0x3f')]['belongsTo'](db['Pause'],{'as':_0x8b1c('0x14c'),'foreignKey':_0x8b1c('0x14d')});db['MailAccount'][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x162')});db[_0x8b1c('0x41')][_0x8b1c('0x124')](db['User'],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x8b1c('0x10f')](db[_0x8b1c('0x47')],{'as':_0x8b1c('0x152'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x163')});db['MailInteraction'][_0x8b1c('0x11b')](db[_0x8b1c('0x3f')],{'as':_0x8b1c('0x164'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db['MailInteraction'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x166'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x45')]['belongsToMany'](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x167'),'as':_0x8b1c('0x168')});db[_0x8b1c('0x45')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x167'),'as':_0x8b1c('0x169')});db[_0x8b1c('0x45')][_0x8b1c('0x124')](db['User'],{'as':_0x8b1c('0x16a'),'through':_0x8b1c('0x16b'),'foreignKey':_0x8b1c('0x163')});db['MailMessage'][_0x8b1c('0x10f')](db[_0x8b1c('0xe7')],{'as':_0x8b1c('0x16c'),'onDelete':'cascade'});db[_0x8b1c('0x47')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109')});db[_0x8b1c('0x47')][_0x8b1c('0x11b')](db['CmContact'],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x157')});db[_0x8b1c('0x47')][_0x8b1c('0x11b')](db[_0x8b1c('0x45')],{'as':_0x8b1c('0x16d'),'foreignKey':_0x8b1c('0x163')});db[_0x8b1c('0x47')]['belongsTo'](db[_0x8b1c('0x3f')],{'as':_0x8b1c('0x164'),'foreignKey':'MailAccountId'});db[_0x8b1c('0x47')][_0x8b1c('0x11b')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x8b1c('0x16e')});db[_0x8b1c('0x47')][_0x8b1c('0x11b')](db[_0x8b1c('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0x8b1c('0x16f')});db[_0x8b1c('0x15f')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'onDelete':'restrict'});db[_0x8b1c('0x15f')]['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db[_0x8b1c('0x15f')]['belongsTo'](db[_0x8b1c('0x3f')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x15f')][_0x8b1c('0x11b')](db['Interval'],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x170')});db[_0x8b1c('0x15f')][_0x8b1c('0x11b')](db[_0x8b1c('0x8c')],{'onDelete':'restrict','foreignKey':_0x8b1c('0x171')});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db[_0x8b1c('0x3f')],{});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':'List','foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':'Contact','foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x49')]['belongsTo'](db[_0x8b1c('0x45')],{});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db['MailMessage'],{});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{});db[_0x8b1c('0x49')][_0x8b1c('0x11b')](db[_0x8b1c('0x41')],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':'Items','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x135')]['hasMany'](db[_0x8b1c('0x7e')],{'as':_0x8b1c('0x173'),'foreignKey':_0x8b1c('0x174'),'onDelete':_0x8b1c('0x10c')});db['FaxAccount'][_0x8b1c('0x10f')](db['CannedAnswer'],{'as':_0x8b1c('0x15d'),'foreignKey':_0x8b1c('0x174')});db[_0x8b1c('0x135')][_0x8b1c('0x10f')](db['FaxInteraction'],{'as':_0x8b1c('0x15e')});db['FaxAccount'][_0x8b1c('0x10f')](db[_0x8b1c('0x175')],{'as':_0x8b1c('0x141')});db[_0x8b1c('0x135')][_0x8b1c('0x10f')](db[_0x8b1c('0x13e')],{'as':'Exntensions','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x135')][_0x8b1c('0x10f')](db[_0x8b1c('0x176')],{'as':_0x8b1c('0x152')});db[_0x8b1c('0x135')][_0x8b1c('0x11b')](db['Trunk'],{'as':_0x8b1c('0x2a')});db['FaxAccount'][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x135')][_0x8b1c('0x11b')](db[_0x8b1c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b1c('0x14d')});db['FaxAccount']['belongsToMany'](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x177')});db[_0x8b1c('0x175')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x175')][_0x8b1c('0x11b')](db[_0x8b1c('0x52')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x175')]['belongsTo'](db[_0x8b1c('0x135')],{'onDelete':'restrict'});db['FaxApplication'][_0x8b1c('0x11b')](db[_0x8b1c('0x8c')],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x171')});db[_0x8b1c('0x51')][_0x8b1c('0x10f')](db[_0x8b1c('0x176')],{'as':_0x8b1c('0x152'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x8b1c('0x11b')](db[_0x8b1c('0x135')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x174')});db[_0x8b1c('0x51')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x166'),'foreignKey':'UserId'});db['FaxInteraction'][_0x8b1c('0x124')](db['Tag'],{'through':_0x8b1c('0x178'),'as':_0x8b1c('0x168')});db['FaxInteraction'][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x178'),'as':_0x8b1c('0x169')});db['FaxInteraction']['belongsToMany'](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x16a'),'through':_0x8b1c('0x179'),'foreignKey':_0x8b1c('0x17a')});db[_0x8b1c('0x176')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x10c'),'as':'User'});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':_0x8b1c('0x16d'),'foreignKey':'FaxInteractionId'});db[_0x8b1c('0x176')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x157')});db[_0x8b1c('0x176')][_0x8b1c('0x11b')](db[_0x8b1c('0xe7')],{'as':_0x8b1c('0xe7'),'foreignKey':_0x8b1c('0x17b')});db[_0x8b1c('0x176')][_0x8b1c('0x11b')](db[_0x8b1c('0x135')],{'as':_0x8b1c('0x164'),'foreignKey':'FaxAccountId'});db[_0x8b1c('0x52')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x130')});db[_0x8b1c('0x52')]['belongsToMany'](db[_0x8b1c('0xe2')],{'through':_0x8b1c('0x17c'),'as':_0x8b1c('0x17d')});db[_0x8b1c('0x17e')][_0x8b1c('0x11b')](db[_0x8b1c('0x135')],{});db[_0x8b1c('0x17e')][_0x8b1c('0x11b')](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':'ListId'});db[_0x8b1c('0x17e')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b1c('0x17e')]['belongsTo'](db[_0x8b1c('0x51')],{});db[_0x8b1c('0x17e')]['belongsTo'](db['FaxMessage'],{});db[_0x8b1c('0x17e')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{});db[_0x8b1c('0x17e')][_0x8b1c('0x11b')](db[_0x8b1c('0x52')],{});db[_0x8b1c('0x13a')][_0x8b1c('0x10f')](db[_0x8b1c('0x7e')],{'as':_0x8b1c('0x173'),'foreignKey':_0x8b1c('0x17f'),'onDelete':'cascade'});db['SmsAccount'][_0x8b1c('0x10f')](db[_0x8b1c('0x7d')],{'as':_0x8b1c('0x15d'),'foreignKey':_0x8b1c('0x17f')});db[_0x8b1c('0x13a')]['hasMany'](db[_0x8b1c('0x59')],{'as':_0x8b1c('0x152'),'foreignKey':'SmsAccountId'});db[_0x8b1c('0x13a')]['hasMany'](db[_0x8b1c('0x57')],{'as':_0x8b1c('0x15e')});db[_0x8b1c('0x13a')][_0x8b1c('0x10f')](db[_0x8b1c('0x180')],{'as':'Applications'});db[_0x8b1c('0x13a')][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x13a')][_0x8b1c('0x11b')](db[_0x8b1c('0x84')],{'as':_0x8b1c('0x14c'),'foreignKey':_0x8b1c('0x14d')});db[_0x8b1c('0x13a')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x13b')});db[_0x8b1c('0x180')]['belongsTo'](db['User'],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x180')][_0x8b1c('0x11b')](db[_0x8b1c('0x5a')],{'onDelete':'restrict'});db['SmsApplication'][_0x8b1c('0x11b')](db[_0x8b1c('0x13a')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x180')][_0x8b1c('0x11b')](db['Interval'],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x170')});db[_0x8b1c('0x180')][_0x8b1c('0x11b')](db[_0x8b1c('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x8b1c('0x57')][_0x8b1c('0x10f')](db['SmsMessage'],{'as':_0x8b1c('0x152'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'SmsInteractionId'});db[_0x8b1c('0x57')][_0x8b1c('0x11b')](db[_0x8b1c('0x13a')],{'as':_0x8b1c('0x164'),'foreignKey':'SmsAccountId'});db[_0x8b1c('0x57')]['belongsTo'](db['CmContact'],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x57')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x57')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x181'),'as':_0x8b1c('0x168')});db['SmsInteraction'][_0x8b1c('0x124')](db['Tag'],{'through':_0x8b1c('0x181'),'as':'ThroughTags'});db['SmsInteraction'][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x16a'),'through':'user_has_sms_interactions','foreignKey':_0x8b1c('0x182')});db[_0x8b1c('0x59')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109')});db[_0x8b1c('0x59')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x157')});db[_0x8b1c('0x59')]['belongsTo'](db[_0x8b1c('0x57')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x16d'),'foreignKey':_0x8b1c('0x182')});db[_0x8b1c('0x59')][_0x8b1c('0x11b')](db[_0x8b1c('0x13a')],{'as':'Account','foreignKey':_0x8b1c('0x17f')});db[_0x8b1c('0x5a')]['belongsToMany'](db[_0x8b1c('0x109')],{'as':'Agents','through':_0x8b1c('0x37'),'foreignKey':'SmsQueueId'});db[_0x8b1c('0x5a')][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'through':'team_has_sms_queues','as':_0x8b1c('0x17d')});db['OpenchannelAccount']['hasMany'](db[_0x8b1c('0x7e')],{'as':_0x8b1c('0x173'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x5b')]['hasMany'](db[_0x8b1c('0x7d')],{'as':_0x8b1c('0x15d'),'foreignKey':_0x8b1c('0x183')});db[_0x8b1c('0x5b')][_0x8b1c('0x10f')](db[_0x8b1c('0x5f')],{'as':_0x8b1c('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x8b1c('0x5b')][_0x8b1c('0x10f')](db['OpenchannelMessage'],{'as':_0x8b1c('0x152'),'foreignKey':_0x8b1c('0x183')});db[_0x8b1c('0x5b')][_0x8b1c('0x10f')](db[_0x8b1c('0x5d')],{'as':_0x8b1c('0x141'),'foreignKey':_0x8b1c('0x183')});db['OpenchannelAccount'][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db['OpenchannelAccount']['belongsTo'](db[_0x8b1c('0x84')],{'as':_0x8b1c('0x14c'),'foreignKey':_0x8b1c('0x14d')});db[_0x8b1c('0x5b')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x139')});db['OpenchannelApplication']['belongsTo'](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x5d')][_0x8b1c('0x11b')](db[_0x8b1c('0x63')],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x184')});db[_0x8b1c('0x5d')]['belongsTo'](db[_0x8b1c('0x5b')],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x183')});db['OpenchannelApplication'][_0x8b1c('0x11b')](db[_0x8b1c('0x82')],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x170')});db['OpenchannelApplication'][_0x8b1c('0x11b')](db['Tag'],{'onDelete':_0x8b1c('0x159'),'foreignKey':_0x8b1c('0x171')});db[_0x8b1c('0x5f')]['hasMany'](db[_0x8b1c('0x61')],{'as':_0x8b1c('0x152'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x185')});db[_0x8b1c('0x5f')][_0x8b1c('0x11b')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x8b1c('0x183')});db[_0x8b1c('0x5f')][_0x8b1c('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x5f')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':'Owner','foreignKey':_0x8b1c('0x10d')});db['OpenchannelInteraction'][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x186'),'as':'Tags'});db[_0x8b1c('0x5f')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x8b1c('0x5f')][_0x8b1c('0x124')](db['User'],{'as':_0x8b1c('0x16a'),'through':_0x8b1c('0x128'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x109')});db[_0x8b1c('0x61')]['belongsTo'](db['CmContact'],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x157')});db[_0x8b1c('0x61')][_0x8b1c('0x11b')](db[_0x8b1c('0x5f')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x16d'),'foreignKey':'OpenchannelInteractionId'});db[_0x8b1c('0x61')][_0x8b1c('0x11b')](db[_0x8b1c('0xe7')],{'as':'Attachment','foreignKey':_0x8b1c('0x17b')});db[_0x8b1c('0x61')]['belongsTo'](db[_0x8b1c('0x5b')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x183')});db[_0x8b1c('0x63')][_0x8b1c('0x124')](db['User'],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x39'),'foreignKey':_0x8b1c('0x184')});db[_0x8b1c('0x63')][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'through':_0x8b1c('0x187'),'as':_0x8b1c('0x17d')});db[_0x8b1c('0x65')]['hasMany'](db[_0x8b1c('0x7e')],{'as':_0x8b1c('0x173'),'foreignKey':_0x8b1c('0x16e'),'onDelete':_0x8b1c('0x10c')});db['ChatWebsite'][_0x8b1c('0x10f')](db[_0x8b1c('0x7d')],{'as':_0x8b1c('0x15d'),'foreignKey':_0x8b1c('0x16e')});db[_0x8b1c('0x65')][_0x8b1c('0x10f')](db['ChatProactiveAction'],{'as':_0x8b1c('0x188')});db['ChatWebsite'][_0x8b1c('0x10f')](db[_0x8b1c('0x69')],{'as':_0x8b1c('0x15e')});db[_0x8b1c('0x65')][_0x8b1c('0x10f')](db[_0x8b1c('0x189')],{'as':_0x8b1c('0x141')});db[_0x8b1c('0x65')][_0x8b1c('0x10f')](db['ChatMessage'],{'as':_0x8b1c('0x152')});db[_0x8b1c('0x65')][_0x8b1c('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x65')][_0x8b1c('0x11b')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x8b1c('0x65')][_0x8b1c('0x11b')](db['MailAccount'],{'as':_0x8b1c('0x3f'),'foreignKey':_0x8b1c('0x158')});db[_0x8b1c('0x65')]['belongsTo'](db[_0x8b1c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b1c('0x14d')});db[_0x8b1c('0x65')][_0x8b1c('0x124')](db['User'],{'as':_0x8b1c('0x14f'),'through':'user_has_chat_websites'});db[_0x8b1c('0x66')][_0x8b1c('0x11b')](db[_0x8b1c('0x5b')],{});db[_0x8b1c('0x66')][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x66')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':'Contact','foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x66')][_0x8b1c('0x11b')](db[_0x8b1c('0x5f')],{});db[_0x8b1c('0x66')]['belongsTo'](db[_0x8b1c('0x61')],{});db[_0x8b1c('0x66')][_0x8b1c('0x11b')](db['User'],{});db[_0x8b1c('0x66')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x8b1c('0x189')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':'Agent','foreignKey':_0x8b1c('0x10d'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x189')][_0x8b1c('0x11b')](db[_0x8b1c('0x12d')],{'as':_0x8b1c('0x18a'),'foreignKey':_0x8b1c('0x18b'),'onDelete':_0x8b1c('0x159')});db['ChatApplication'][_0x8b1c('0x11b')](db[_0x8b1c('0x65')],{'as':_0x8b1c('0x18c'),'foreignKey':_0x8b1c('0x16e'),'onDelete':'restrict'});db[_0x8b1c('0x189')]['belongsTo'](db[_0x8b1c('0x8c')],{'onDelete':_0x8b1c('0x159'),'foreignKey':'TagId'});db[_0x8b1c('0x69')]['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x18d')});db[_0x8b1c('0x69')]['belongsTo'](db[_0x8b1c('0x65')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x16e')});db['ChatInteraction'][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x69')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x166'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0x69')][_0x8b1c('0x124')](db['Tag'],{'through':_0x8b1c('0x18e'),'as':_0x8b1c('0x168')});db['ChatInteraction'][_0x8b1c('0x124')](db['Tag'],{'through':_0x8b1c('0x18e'),'as':_0x8b1c('0x169')});db['ChatInteraction'][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x16a'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x8b1c('0x18f')][_0x8b1c('0x11b')](db['User'],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x109')});db[_0x8b1c('0x18f')]['belongsTo'](db[_0x8b1c('0x156')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x18f')][_0x8b1c('0x11b')](db[_0x8b1c('0x69')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x16d'),'foreignKey':_0x8b1c('0x18d')});db[_0x8b1c('0x18f')]['belongsTo'](db[_0x8b1c('0xe7')],{'as':'Attachment','foreignKey':_0x8b1c('0x17b')});db['ChatMessage'][_0x8b1c('0x11b')](db[_0x8b1c('0x65')],{'as':'Account','foreignKey':_0x8b1c('0x16e')});db['ChatOfflineMessage'][_0x8b1c('0x10f')](db[_0x8b1c('0xe7')],{'as':_0x8b1c('0x16c'),'foreignKey':_0x8b1c('0x16f'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db[_0x8b1c('0x6c')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'onDelete':_0x8b1c('0x10c'),'as':'Contact','foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x6c')][_0x8b1c('0x11b')](db[_0x8b1c('0x65')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x16e')});db['ChatQueue'][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x32'),'hooks':!![]});db[_0x8b1c('0x12d')][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'through':_0x8b1c('0x190'),'as':'Teams'});db[_0x8b1c('0x6e')][_0x8b1c('0x10f')](db['ChatInternalMessage'],{'as':_0x8b1c('0x152'),'foreignKey':_0x8b1c('0x191'),'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x6e')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':'Members','through':_0x8b1c('0x11e')});db[_0x8b1c('0x70')]['belongsTo'](db[_0x8b1c('0x65')],{'as':'Website','foreignKey':_0x8b1c('0x16e')});db[_0x8b1c('0x72')][_0x8b1c('0x10f')](db[_0x8b1c('0x156')],{'as':'Contacts','foreignKey':_0x8b1c('0x192')});db['CmContact'][_0x8b1c('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0x8b1c('0x10f')](db[_0x8b1c('0x77')],{'as':_0x8b1c('0x145'),'foreignKey':'ContactId'});db[_0x8b1c('0x156')][_0x8b1c('0x10f')](db['CmHopperHistory'],{'as':_0x8b1c('0x146'),'foreignKey':'ContactId'});db['CmContact'][_0x8b1c('0x10f')](db[_0x8b1c('0x79')],{'as':_0x8b1c('0x79'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x156')][_0x8b1c('0x10f')](db[_0x8b1c('0xd0')],{'as':_0x8b1c('0x148'),'foreignKey':_0x8b1c('0x165')});db['CmContact'][_0x8b1c('0x10f')](db[_0x8b1c('0x5f')],{'as':_0x8b1c('0x114'),'foreignKey':_0x8b1c('0x165'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x156')][_0x8b1c('0x10f')](db[_0x8b1c('0x69')],{'as':'ChatInteractions','foreignKey':_0x8b1c('0x165'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x156')][_0x8b1c('0x10f')](db[_0x8b1c('0x57')],{'as':_0x8b1c('0x115'),'foreignKey':_0x8b1c('0x165'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x156')]['hasMany'](db[_0x8b1c('0x51')],{'as':_0x8b1c('0x116'),'foreignKey':_0x8b1c('0x165'),'onDelete':_0x8b1c('0x159')});db['CmContact'][_0x8b1c('0x10f')](db['MailInteraction'],{'as':_0x8b1c('0x117'),'foreignKey':_0x8b1c('0x165'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x156')][_0x8b1c('0x11b')](db[_0x8b1c('0x72')],{'as':_0x8b1c('0x193'),'foreignKey':_0x8b1c('0x192')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':'ListId','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x156')]['belongsToMany'](db[_0x8b1c('0x109')],{'as':'Users','through':_0x8b1c('0x120')});db[_0x8b1c('0x156')][_0x8b1c('0x124')](db['Tag'],{'as':_0x8b1c('0x168'),'through':'cm_contact_has_tags'});db[_0x8b1c('0x156')]['belongsToMany'](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x194'),'as':'ThroughTags'});db[_0x8b1c('0x74')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165'),'onDelete':'cascade'});db['CmHopper'][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':'List','foreignKey':'ListId','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x74')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x195'),'foreignKey':_0x8b1c('0x10d')});db['CmHopper']['belongsTo'](db[_0x8b1c('0x129')],{'as':'Queue','foreignKey':_0x8b1c('0x143'),'onDelete':_0x8b1c('0x10c')});db['CmHopper'][_0x8b1c('0x11b')](db[_0x8b1c('0x196')],{'as':_0x8b1c('0x196'),'foreignKey':_0x8b1c('0x197'),'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x74')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x166'),'foreignKey':'OwnerId'});db[_0x8b1c('0x75')][_0x8b1c('0x11b')](db['CmContact'],{'as':_0x8b1c('0x157'),'foreignKey':'ContactId','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x75')][_0x8b1c('0x11b')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172'),'onDelete':_0x8b1c('0x10c')});db['CmHopperBlack']['belongsTo'](db[_0x8b1c('0x129')],{'as':_0x8b1c('0x18a'),'foreignKey':_0x8b1c('0x143'),'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x75')][_0x8b1c('0x11b')](db[_0x8b1c('0x196')],{'as':_0x8b1c('0x196'),'foreignKey':_0x8b1c('0x197'),'onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x198')][_0x8b1c('0x10f')](db[_0x8b1c('0x80')],{'as':{'plural':_0x8b1c('0x199'),'singular':_0x8b1c('0x19a')},'foreignKey':_0x8b1c('0x19b'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db['Automation'][_0x8b1c('0x10f')](db['Condition'],{'as':{'plural':_0x8b1c('0x19c'),'singular':_0x8b1c('0x19d')},'foreignKey':_0x8b1c('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x8b1c('0x198')][_0x8b1c('0x10f')](db[_0x8b1c('0x19f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x8b1c('0x10c'),'hooks':!![]});db[_0x8b1c('0x7e')]['hasMany'](db['Disposition'],{'as':_0x8b1c('0x173'),'foreignKey':_0x8b1c('0x1a0'),'onDelete':_0x8b1c('0x10c')});db['Interval'][_0x8b1c('0x10f')](db[_0x8b1c('0x82')],{'as':_0x8b1c('0x1a1'),'foreignKey':'IntervalId','onDelete':_0x8b1c('0x10c'),'hooks':!![],'required':![]});db[_0x8b1c('0x82')][_0x8b1c('0x10f')](db[_0x8b1c('0x13e')],{'as':_0x8b1c('0x112'),'foreignKey':_0x8b1c('0x170'),'onDelete':_0x8b1c('0x159')});db['Interval']['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x8b1c('0x170')});db[_0x8b1c('0x82')][_0x8b1c('0x10f')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x8b1c('0x170')});db[_0x8b1c('0x82')][_0x8b1c('0x10f')](db[_0x8b1c('0x175')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x8b1c('0x82')][_0x8b1c('0x10f')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x8b1c('0x88')][_0x8b1c('0x11b')](db[_0x8b1c('0x3f')],{});db[_0x8b1c('0x88')]['belongsTo'](db[_0x8b1c('0x1a2')],{'foreignKey':_0x8b1c('0x1a3')});db[_0x8b1c('0x88')][_0x8b1c('0x11b')](db[_0x8b1c('0x96')],{'foreignKey':'CustomReportId'});db[_0x8b1c('0x8a')][_0x8b1c('0x124')](db[_0x8b1c('0x19')],{'as':_0x8b1c('0x1a4'),'through':_0x8b1c('0x142'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x8c')]['belongsToMany'](db[_0x8b1c('0x156')],{'through':_0x8b1c('0x194')});db[_0x8b1c('0x8c')][_0x8b1c('0x124')](db[_0x8b1c('0x69')],{'through':'chat_interaction_has_tags'});db[_0x8b1c('0x8c')][_0x8b1c('0x124')](db[_0x8b1c('0x45')],{'through':_0x8b1c('0x167')});db['Tag'][_0x8b1c('0x124')](db[_0x8b1c('0x57')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x8b1c('0x124')](db[_0x8b1c('0x51')],{'through':_0x8b1c('0x178')});db[_0x8b1c('0x8c')][_0x8b1c('0x124')](db[_0x8b1c('0x5f')],{'through':_0x8b1c('0x186')});db[_0x8b1c('0x8c')]['belongsToMany'](db[_0x8b1c('0xfc')],{'through':'whatsapp_interaction_has_tags'});db[_0x8b1c('0x90')][_0x8b1c('0x10f')](db[_0x8b1c('0x80')],{'as':{'plural':_0x8b1c('0x1a5'),'singular':_0x8b1c('0x1a6')},'foreignKey':_0x8b1c('0x1a7'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db[_0x8b1c('0x90')][_0x8b1c('0x10f')](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x8b1c('0x1a8'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x8b1c('0x19f')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x8b1c('0x10c'),'hooks':!![]});db[_0x8b1c('0x96')]['hasMany'](db[_0x8b1c('0x9b')],{'as':'Fields','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1a9'),'hooks':!![]});db[_0x8b1c('0x1a2')][_0x8b1c('0x10f')](db[_0x8b1c('0x9b')],{'as':_0x8b1c('0x1aa'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1a3')});db[_0x8b1c('0x1ab')][_0x8b1c('0x10f')](db[_0x8b1c('0x9b')],{'as':_0x8b1c('0x1aa'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'MetricId'});db[_0x8b1c('0x9b')][_0x8b1c('0x11b')](db[_0x8b1c('0x1ab')],{'foreignKey':'MetricId'});db[_0x8b1c('0x9e')][_0x8b1c('0x10f')](db[_0x8b1c('0xa0')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'AccountId'});db[_0x8b1c('0xa0')][_0x8b1c('0x10f')](db[_0x8b1c('0x1ad')],{'as':_0x8b1c('0x1ae'),'onDelete':'cascade','foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x8b1c('0x10f')](db['SalesforceField'],{'as':_0x8b1c('0x1af'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b0')});db['SalesforceConfiguration'][_0x8b1c('0x10f')](db[_0x8b1c('0x1ad')],{'as':'Fields','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xa0')]['belongsTo'](db[_0x8b1c('0x9e')],{'as':'Account','foreignKey':_0x8b1c('0x1b2')});db['SalesforceField'][_0x8b1c('0x10f')](db[_0x8b1c('0x1ad')],{'as':_0x8b1c('0x1b3'),'foreignKey':'SubjectId'});db[_0x8b1c('0x1ad')][_0x8b1c('0x10f')](db['SalesforceField'],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1ad')][_0x8b1c('0x10f')](db[_0x8b1c('0x1ad')],{'as':'Field','foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1ad')]['belongsTo'](db['Variable'],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0xa3')][_0x8b1c('0x10f')](db[_0x8b1c('0xa5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0xa5')][_0x8b1c('0x10f')](db['SugarcrmField'],{'as':_0x8b1c('0x1ae'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b6')});db['SugarcrmConfiguration'][_0x8b1c('0x10f')](db[_0x8b1c('0xa7')],{'as':_0x8b1c('0x1af'),'onDelete':'cascade','foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xa5')][_0x8b1c('0x10f')](db['SugarcrmField'],{'as':_0x8b1c('0x1aa'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xa5')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x8b1c('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0x8b1c('0x1b3'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xa7')][_0x8b1c('0x10f')](db[_0x8b1c('0xa7')],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xa7')][_0x8b1c('0x10f')](db[_0x8b1c('0xa7')],{'as':_0x8b1c('0x1b7'),'foreignKey':_0x8b1c('0x1b1')});db['SugarcrmField'][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0x1b8')]['hasMany'](db[_0x8b1c('0x1b9')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1b9')][_0x8b1c('0x10f')](db[_0x8b1c('0xab')],{'as':_0x8b1c('0x1ae'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'SubjectId'});db[_0x8b1c('0x1b9')]['hasMany'](db[_0x8b1c('0xab')],{'as':_0x8b1c('0x1af'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b0')});db['DeskConfiguration']['hasMany'](db[_0x8b1c('0xab')],{'as':_0x8b1c('0x1aa'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1b9')]['belongsTo'](db[_0x8b1c('0x1b8')],{'as':'Account','foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1b9')]['belongsToMany'](db[_0x8b1c('0x8c')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x8b1c('0x10f')](db[_0x8b1c('0xab')],{'as':'Subject','foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xab')][_0x8b1c('0x10f')](db['DeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0x8b1c('0x10f')](db[_0x8b1c('0xab')],{'as':_0x8b1c('0x1b7'),'foreignKey':'FieldId'});db[_0x8b1c('0xab')][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':_0x8b1c('0x92'),'foreignKey':'VariableId'});db[_0x8b1c('0xac')][_0x8b1c('0x10f')](db['ZohoConfiguration'],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1ba')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0x1ba')][_0x8b1c('0x10f')](db[_0x8b1c('0xaf')],{'as':_0x8b1c('0x1af'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1ba')][_0x8b1c('0x10f')](db[_0x8b1c('0xaf')],{'as':_0x8b1c('0x1aa'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1ba')][_0x8b1c('0x11b')](db[_0x8b1c('0xac')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0xaf')]['hasMany'](db[_0x8b1c('0xaf')],{'as':_0x8b1c('0x1b3'),'foreignKey':'SubjectId'});db[_0x8b1c('0xaf')][_0x8b1c('0x10f')](db['ZohoField'],{'as':_0x8b1c('0x1b4'),'foreignKey':'DescriptionId'});db[_0x8b1c('0xaf')]['hasMany'](db[_0x8b1c('0xaf')],{'as':_0x8b1c('0x1b7'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xaf')]['belongsTo'](db[_0x8b1c('0x92')],{'as':'Variable','foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0xb0')][_0x8b1c('0x10f')](db[_0x8b1c('0x1bb')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'AccountId'});db[_0x8b1c('0x1bb')][_0x8b1c('0x10f')](db[_0x8b1c('0xb3')],{'as':_0x8b1c('0x1ae'),'foreignKey':_0x8b1c('0x1b6')});db['ZendeskConfiguration']['hasMany'](db[_0x8b1c('0xb3')],{'as':_0x8b1c('0x1af'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1bb')][_0x8b1c('0x10f')](db['ZendeskField'],{'as':_0x8b1c('0x1aa'),'foreignKey':_0x8b1c('0x1b1')});db['ZendeskConfiguration'][_0x8b1c('0x11b')](db[_0x8b1c('0xb0')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1bb')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x1bc')});db[_0x8b1c('0xb3')][_0x8b1c('0x10f')](db['ZendeskField'],{'as':_0x8b1c('0x1b3'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xb3')][_0x8b1c('0x10f')](db[_0x8b1c('0xb3')],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xb3')][_0x8b1c('0x10f')](db[_0x8b1c('0xb3')],{'as':_0x8b1c('0x1b7'),'foreignKey':'FieldId'});db[_0x8b1c('0xb3')][_0x8b1c('0x11b')](db['Variable'],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0xb5')]['hasMany'](db[_0x8b1c('0x1bd')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1bd')][_0x8b1c('0x10f')](db[_0x8b1c('0xb7')],{'as':_0x8b1c('0x1ae'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0x1bd')][_0x8b1c('0x10f')](db[_0x8b1c('0xb7')],{'as':'Descriptions','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1bd')][_0x8b1c('0x10f')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1bd')][_0x8b1c('0x11b')](db[_0x8b1c('0xb5')],{'as':_0x8b1c('0x164'),'foreignKey':'AccountId'});db[_0x8b1c('0x1bd')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x1be')});db[_0x8b1c('0xb7')][_0x8b1c('0x10f')](db[_0x8b1c('0xb7')],{'as':_0x8b1c('0x1b3'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xb7')]['hasMany'](db[_0x8b1c('0xb7')],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xb7')][_0x8b1c('0x10f')](db['FreshdeskField'],{'as':_0x8b1c('0x1b7'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0x1bf')][_0x8b1c('0x10f')](db[_0x8b1c('0x1c0')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0x1c0')][_0x8b1c('0x10f')](db[_0x8b1c('0xb9')],{'as':_0x8b1c('0x1ae'),'foreignKey':'SubjectId'});db[_0x8b1c('0x1c0')]['hasMany'](db['VtigerField'],{'as':_0x8b1c('0x1af'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x8b1c('0x10f')](db[_0x8b1c('0xb9')],{'as':'Fields','foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1c0')][_0x8b1c('0x11b')](db[_0x8b1c('0x1bf')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0xb9')][_0x8b1c('0x10f')](db[_0x8b1c('0xb9')],{'as':_0x8b1c('0x1b3'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xb9')][_0x8b1c('0x10f')](db[_0x8b1c('0xb9')],{'as':_0x8b1c('0x1b4'),'foreignKey':'DescriptionId'});db[_0x8b1c('0xb9')]['hasMany'](db[_0x8b1c('0xb9')],{'as':_0x8b1c('0x1b7'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xb9')][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0x1c1')]['hasMany'](db[_0x8b1c('0x1c2')],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'AccountId'});db[_0x8b1c('0x1c2')][_0x8b1c('0x10f')](db['ServicenowField'],{'as':_0x8b1c('0x1ae'),'foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0x1c2')]['hasMany'](db[_0x8b1c('0x1c3')],{'as':_0x8b1c('0x1af'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1c2')][_0x8b1c('0x10f')](db[_0x8b1c('0x1c3')],{'as':'Fields','foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0x1c2')][_0x8b1c('0x11b')](db[_0x8b1c('0x1c1')],{'as':'Account','foreignKey':'AccountId'});db[_0x8b1c('0x1c3')]['hasMany'](db[_0x8b1c('0x1c3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8b1c('0x1c3')][_0x8b1c('0x10f')](db['ServicenowField'],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0x1c3')][_0x8b1c('0x10f')](db['ServicenowField'],{'as':_0x8b1c('0x1b7'),'foreignKey':'FieldId'});db[_0x8b1c('0x1c3')][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':_0x8b1c('0x92'),'foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0xbd')][_0x8b1c('0x10f')](db[_0x8b1c('0xbe')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0xbd')][_0x8b1c('0x11b')](db[_0x8b1c('0x103')],{'as':_0x8b1c('0x103'),'foreignKey':_0x8b1c('0x15b')});db[_0x8b1c('0xbe')][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':_0x8b1c('0x1ae'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b6')});db['Dynamics365Configuration'][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':'Descriptions','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b0')});db['Dynamics365Configuration'][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':'Fields','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xbe')]['belongsTo'](db[_0x8b1c('0xbd')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x1b2')});db['Dynamics365Field'][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':_0x8b1c('0x1b3'),'foreignKey':'SubjectId'});db[_0x8b1c('0xc0')][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':_0x8b1c('0x1b4'),'foreignKey':_0x8b1c('0x1b0')});db['Dynamics365Field'][_0x8b1c('0x10f')](db[_0x8b1c('0xc0')],{'as':_0x8b1c('0x1b7'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xc0')][_0x8b1c('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0xc2')][_0x8b1c('0x10f')](db['FreshsalesConfiguration'],{'as':_0x8b1c('0x1ac'),'onDelete':_0x8b1c('0x10c'),'foreignKey':'AccountId'});db[_0x8b1c('0xc4')][_0x8b1c('0x10f')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xc4')][_0x8b1c('0x10f')](db[_0x8b1c('0xc5')],{'as':_0x8b1c('0x1af'),'foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xc4')][_0x8b1c('0x10f')](db['FreshsalesField'],{'as':_0x8b1c('0x1aa'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xc4')]['belongsTo'](db[_0x8b1c('0xc2')],{'as':_0x8b1c('0x164'),'foreignKey':_0x8b1c('0x1b2')});db[_0x8b1c('0xc5')][_0x8b1c('0x10f')](db[_0x8b1c('0xc5')],{'as':'Subject','foreignKey':_0x8b1c('0x1b6')});db[_0x8b1c('0xc5')][_0x8b1c('0x10f')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x8b1c('0x1b0')});db[_0x8b1c('0xc5')][_0x8b1c('0x10f')](db[_0x8b1c('0xc5')],{'as':_0x8b1c('0x1b7'),'foreignKey':_0x8b1c('0x1b1')});db[_0x8b1c('0xc5')][_0x8b1c('0x11b')](db[_0x8b1c('0x92')],{'as':'Variable','foreignKey':_0x8b1c('0x1b5')});db[_0x8b1c('0x1c4')]['belongsTo'](db[_0x8b1c('0x65')],{});db[_0x8b1c('0x1c4')][_0x8b1c('0x11b')](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x1c4')]['belongsTo'](db[_0x8b1c('0x156')],{'as':'Contact','foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0x1c4')][_0x8b1c('0x11b')](db[_0x8b1c('0x69')],{});db[_0x8b1c('0x1c4')][_0x8b1c('0x11b')](db[_0x8b1c('0x18f')],{});db[_0x8b1c('0x1c4')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{});db[_0x8b1c('0x1c4')][_0x8b1c('0x11b')](db['ChatQueue'],{});db[_0x8b1c('0xca')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1c5')});db['ChatInternalMessage'][_0x8b1c('0x11b')](db['User'],{'onDelete':_0x8b1c('0x10c'),'foreignKey':'ToId'});db[_0x8b1c('0xd0')][_0x8b1c('0x10f')](db[_0x8b1c('0xce')],{'foreignKey':_0x8b1c('0x1c6'),'onDelete':_0x8b1c('0x10c')});db['JscriptySessionReport']['hasMany'](db[_0x8b1c('0xcc')],{'foreignKey':_0x8b1c('0x1c6'),'onDelete':'cascade'});db[_0x8b1c('0xd2')][_0x8b1c('0x11b')](db[_0x8b1c('0x13a')],{});db['SmsQueueReport']['belongsTo'](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0xd2')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0xd2')][_0x8b1c('0x11b')](db[_0x8b1c('0x57')],{});db['SmsQueueReport']['belongsTo'](db[_0x8b1c('0x59')],{});db['SmsQueueReport'][_0x8b1c('0x11b')](db['User'],{});db[_0x8b1c('0xd2')]['belongsTo'](db[_0x8b1c('0x5a')],{});db[_0x8b1c('0xd7')]['hasMany'](db[_0x8b1c('0xd0')],{'foreignKey':_0x8b1c('0x1c7')});db[_0x8b1c('0xd7')][_0x8b1c('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0x8b1c('0x1c7')});db['JscriptyProject'][_0x8b1c('0x10f')](db[_0x8b1c('0xcc')],{'foreignKey':_0x8b1c('0x1c7')});db[_0x8b1c('0xdd')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':'Users','through':'user_has_square_projects'});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':'Agents','through':_0x8b1c('0x125')});db[_0x8b1c('0xe2')]['belongsToMany'](db['VoiceQueue'],{'through':_0x8b1c('0x104'),'as':_0x8b1c('0x12a')});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db['MailQueue'],{'through':_0x8b1c('0x1c8'),'as':_0x8b1c('0x1c9')});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db[_0x8b1c('0x12d')],{'through':_0x8b1c('0x190'),'as':_0x8b1c('0x12e')});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db[_0x8b1c('0x52')],{'through':_0x8b1c('0x17c'),'as':_0x8b1c('0x12f')});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db[_0x8b1c('0x5a')],{'through':_0x8b1c('0x1ca'),'as':_0x8b1c('0x131')});db[_0x8b1c('0xe2')]['belongsToMany'](db[_0x8b1c('0x63')],{'through':_0x8b1c('0x187'),'as':_0x8b1c('0x1cb')});db[_0x8b1c('0xe2')]['belongsToMany'](db[_0x8b1c('0x102')],{'through':_0x8b1c('0x1cc'),'as':_0x8b1c('0x132')});db[_0x8b1c('0xe2')][_0x8b1c('0x124')](db['VoicePrefix'],{'through':_0x8b1c('0x105'),'as':_0x8b1c('0x12c')});db[_0x8b1c('0x196')][_0x8b1c('0x10f')](db[_0x8b1c('0x74')],{'as':'Hoppers','foreignKey':_0x8b1c('0x197')});db[_0x8b1c('0x196')]['hasMany'](db[_0x8b1c('0x77')],{'as':_0x8b1c('0x145'),'foreignKey':_0x8b1c('0x197')});db[_0x8b1c('0x196')][_0x8b1c('0x10f')](db[_0x8b1c('0x78')],{'as':_0x8b1c('0x146'),'foreignKey':'CampaignId'});db[_0x8b1c('0x196')][_0x8b1c('0x10f')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x8b1c('0x197')});db[_0x8b1c('0x196')][_0x8b1c('0x11b')](db[_0x8b1c('0x2a')],{'as':'Trunk','foreignKey':_0x8b1c('0x149')});db[_0x8b1c('0x196')][_0x8b1c('0x11b')](db['Trunk'],{'as':_0x8b1c('0x14a'),'foreignKey':'TrunkBackupId'});db[_0x8b1c('0x196')][_0x8b1c('0x11b')](db[_0x8b1c('0x82')],{'as':_0x8b1c('0x82'),'foreignKey':_0x8b1c('0x170')});db[_0x8b1c('0x196')][_0x8b1c('0x11b')](db['SquareProject'],{'as':_0x8b1c('0xdd'),'foreignKey':_0x8b1c('0x1cd')});db[_0x8b1c('0x196')][_0x8b1c('0x124')](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x122'),'through':_0x8b1c('0x1ce')});db[_0x8b1c('0x196')]['belongsToMany'](db[_0x8b1c('0x121')],{'as':_0x8b1c('0x150'),'through':_0x8b1c('0x1cf')});db[_0x8b1c('0xe7')][_0x8b1c('0x11b')](db[_0x8b1c('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0x8b1c('0x16f')});db['MailTransferReport']['belongsTo'](db[_0x8b1c('0x47')],{});db[_0x8b1c('0xeb')][_0x8b1c('0x11b')](db[_0x8b1c('0x45')],{});db[_0x8b1c('0xeb')]['belongsTo'](db[_0x8b1c('0x3f')],{'foreignKey':_0x8b1c('0x1d0'),'as':'FromAccount'});db['MailTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d1'),'as':'FromAgent'});db['MailTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':'ToUserId','as':_0x8b1c('0x1d2')});db[_0x8b1c('0xeb')][_0x8b1c('0x11b')](db[_0x8b1c('0x41')],{'foreignKey':'ToMailQueueId','as':_0x8b1c('0x1d3')});db['MailTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x3f')],{'foreignKey':_0x8b1c('0x1d4'),'as':_0x8b1c('0x1d5')});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x18f')],{});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x69')],{});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x65')],{'foreignKey':_0x8b1c('0x1d6'),'as':_0x8b1c('0x1d7')});db['ChatTransferReport'][_0x8b1c('0x11b')](db['User'],{'foreignKey':_0x8b1c('0x1d1'),'as':'FromAgent'});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d8'),'as':_0x8b1c('0x1d2')});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x12d')],{'foreignKey':_0x8b1c('0x1d9'),'as':_0x8b1c('0x1d3')});db[_0x8b1c('0xec')][_0x8b1c('0x11b')](db[_0x8b1c('0x65')],{'foreignKey':_0x8b1c('0x1da'),'as':_0x8b1c('0x1d5')});db['FaxTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x176')],{});db[_0x8b1c('0xed')][_0x8b1c('0x11b')](db[_0x8b1c('0x51')],{});db[_0x8b1c('0xed')][_0x8b1c('0x11b')](db[_0x8b1c('0x135')],{'foreignKey':_0x8b1c('0x1db'),'as':_0x8b1c('0x1d7')});db[_0x8b1c('0xed')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8b1c('0xed')]['belongsTo'](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d8'),'as':'ToAgent'});db[_0x8b1c('0xed')][_0x8b1c('0x11b')](db['FaxQueue'],{'foreignKey':_0x8b1c('0x1dc'),'as':_0x8b1c('0x1d3')});db[_0x8b1c('0xed')][_0x8b1c('0x11b')](db[_0x8b1c('0x135')],{'foreignKey':_0x8b1c('0x1dd'),'as':_0x8b1c('0x1d5')});db[_0x8b1c('0xee')][_0x8b1c('0x11b')](db[_0x8b1c('0x61')],{});db[_0x8b1c('0xee')][_0x8b1c('0x11b')](db[_0x8b1c('0x5f')],{});db[_0x8b1c('0xee')][_0x8b1c('0x11b')](db[_0x8b1c('0x5b')],{'foreignKey':_0x8b1c('0x1de'),'as':_0x8b1c('0x1d7')});db['OpenchannelTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d1'),'as':_0x8b1c('0x1df')});db[_0x8b1c('0xee')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':'ToUserId','as':_0x8b1c('0x1d2')});db[_0x8b1c('0xee')]['belongsTo'](db[_0x8b1c('0x63')],{'foreignKey':_0x8b1c('0x1e0'),'as':_0x8b1c('0x1d3')});db[_0x8b1c('0xee')][_0x8b1c('0x11b')](db[_0x8b1c('0x5b')],{'foreignKey':_0x8b1c('0x1e1'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x8b1c('0x59')],{});db[_0x8b1c('0x1e2')]['belongsTo'](db[_0x8b1c('0x57')],{});db['SmsTransferReport'][_0x8b1c('0x11b')](db['SmsAccount'],{'foreignKey':_0x8b1c('0x1e3'),'as':'FromAccount'});db[_0x8b1c('0x1e2')]['belongsTo'](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d1'),'as':'FromAgent'});db[_0x8b1c('0x1e2')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d8'),'as':_0x8b1c('0x1d2')});db['SmsTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x5a')],{'foreignKey':_0x8b1c('0x1e4'),'as':'ToQueue'});db[_0x8b1c('0x1e2')]['belongsTo'](db[_0x8b1c('0x13a')],{'foreignKey':'ToSmsAccountId','as':_0x8b1c('0x1d5')});db[_0x8b1c('0x121')][_0x8b1c('0x10f')](db['Disposition'],{'as':_0x8b1c('0x173'),'foreignKey':'ListId','onDelete':_0x8b1c('0x10c')});db['CmList'][_0x8b1c('0x10f')](db[_0x8b1c('0x7b')],{'as':_0x8b1c('0x1e5'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x121')][_0x8b1c('0x10f')](db['CmContact'],{'as':'Contacts','onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x121')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8b1c('0x172')});db['CmList'][_0x8b1c('0x10f')](db[_0x8b1c('0x78')],{'as':_0x8b1c('0x113'),'foreignKey':_0x8b1c('0x172')});db['CmList'][_0x8b1c('0x10f')](db[_0x8b1c('0x79')],{'as':_0x8b1c('0x79'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0x121')][_0x8b1c('0x124')](db[_0x8b1c('0x129')],{'as':_0x8b1c('0x1e6'),'through':_0x8b1c('0x14e')});db['CmList'][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x123')});db[_0x8b1c('0x12b')]['hasMany'](db[_0x8b1c('0x13e')],{'as':'Extensions','onDelete':_0x8b1c('0x10c')});db[_0x8b1c('0x12b')][_0x8b1c('0x124')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0x8b1c('0x12b')]['belongsToMany'](db[_0x8b1c('0xe2')],{'through':_0x8b1c('0x105'),'as':_0x8b1c('0x17d')});db[_0x8b1c('0xf1')]['hasMany'](db[_0x8b1c('0x109')],{'as':'Users','foreignKey':_0x8b1c('0x11c')});db[_0x8b1c('0xf1')][_0x8b1c('0x10f')](db['UserProfileSection'],{'as':_0x8b1c('0x1e7'),'foreignKey':_0x8b1c('0x11c'),'onDelete':_0x8b1c('0x10c')});db['UserProfileSection'][_0x8b1c('0x10f')](db[_0x8b1c('0xf5')],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db[_0x8b1c('0xf9')]['hasMany'](db[_0x8b1c('0x7e')],{'as':'Dispositions','foreignKey':_0x8b1c('0x1e8'),'onDelete':_0x8b1c('0x10c')});db['WhatsappAccount']['hasMany'](db[_0x8b1c('0x7d')],{'as':'Answers','foreignKey':_0x8b1c('0x1e8')});db['WhatsappAccount'][_0x8b1c('0x10f')](db[_0x8b1c('0xfe')],{'as':_0x8b1c('0x152'),'foreignKey':_0x8b1c('0x1e8')});db[_0x8b1c('0xf9')][_0x8b1c('0x10f')](db[_0x8b1c('0xfc')],{'as':'Interactions'});db['WhatsappAccount'][_0x8b1c('0x10f')](db[_0x8b1c('0x1e9')],{'as':_0x8b1c('0x141')});db['WhatsappAccount'][_0x8b1c('0x11b')](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x8b1c('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x8b1c('0x14d')});db[_0x8b1c('0xf9')][_0x8b1c('0x124')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x1ea')});db[_0x8b1c('0x1e9')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x1e9')][_0x8b1c('0x11b')](db[_0x8b1c('0x102')],{'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x1e9')][_0x8b1c('0x11b')](db[_0x8b1c('0xf9')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0x8b1c('0x159'),'foreignKey':'IntervalId'});db[_0x8b1c('0x1e9')][_0x8b1c('0x11b')](db[_0x8b1c('0x8c')],{'onDelete':'restrict','foreignKey':_0x8b1c('0x171')});db[_0x8b1c('0xfc')][_0x8b1c('0x10f')](db[_0x8b1c('0xfe')],{'as':_0x8b1c('0x152'),'onDelete':_0x8b1c('0x10c'),'foreignKey':_0x8b1c('0x1eb')});db[_0x8b1c('0xfc')]['belongsTo'](db[_0x8b1c('0xf9')],{'as':'Account','foreignKey':_0x8b1c('0x1e8')});db[_0x8b1c('0xfc')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':_0x8b1c('0x157'),'foreignKey':_0x8b1c('0x165')});db[_0x8b1c('0xfc')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x166'),'foreignKey':_0x8b1c('0x10d')});db[_0x8b1c('0xfc')][_0x8b1c('0x124')](db[_0x8b1c('0x8c')],{'through':_0x8b1c('0x1ec'),'as':_0x8b1c('0x168')});db[_0x8b1c('0xfc')][_0x8b1c('0x124')](db['Tag'],{'through':_0x8b1c('0x1ec'),'as':'ThroughTags'});db[_0x8b1c('0xfc')]['belongsToMany'](db['User'],{'as':'Users','through':_0x8b1c('0x1ed'),'foreignKey':_0x8b1c('0x1eb')});db[_0x8b1c('0xfe')][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x109')});db[_0x8b1c('0xfe')]['belongsTo'](db[_0x8b1c('0x156')],{'onDelete':_0x8b1c('0x10c'),'as':'Contact'});db['WhatsappMessage'][_0x8b1c('0x11b')](db[_0x8b1c('0xfc')],{'onDelete':_0x8b1c('0x10c'),'as':_0x8b1c('0x16d'),'foreignKey':_0x8b1c('0x1eb')});db[_0x8b1c('0xfe')]['belongsTo'](db[_0x8b1c('0xf9')],{'as':_0x8b1c('0x164'),'foreignKey':'WhatsappAccountId'});db[_0x8b1c('0xff')][_0x8b1c('0x11b')](db[_0x8b1c('0xf9')],{});db['WhatsappQueueReport'][_0x8b1c('0x11b')](db['CmList'],{'as':_0x8b1c('0x160'),'foreignKey':_0x8b1c('0x172')});db[_0x8b1c('0xff')][_0x8b1c('0x11b')](db[_0x8b1c('0x156')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b1c('0xff')]['belongsTo'](db[_0x8b1c('0xfc')],{});db[_0x8b1c('0xff')][_0x8b1c('0x11b')](db[_0x8b1c('0x102')],{});db['WhatsappQueueReport'][_0x8b1c('0x11b')](db[_0x8b1c('0xfe')],{});db['WhatsappQueueReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{});db[_0x8b1c('0x101')][_0x8b1c('0x11b')](db[_0x8b1c('0xfe')],{});db['WhatsappTransferReport'][_0x8b1c('0x11b')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0xf9')],{'foreignKey':_0x8b1c('0x1ee'),'as':'FromAccount'});db[_0x8b1c('0x101')][_0x8b1c('0x11b')](db[_0x8b1c('0xf9')],{'foreignKey':_0x8b1c('0x1ef'),'as':_0x8b1c('0x1d5')});db[_0x8b1c('0x101')][_0x8b1c('0x11b')](db['WhatsappQueue'],{'foreignKey':_0x8b1c('0x1f0'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d1'),'as':_0x8b1c('0x1df')});db['WhatsappTransferReport'][_0x8b1c('0x11b')](db[_0x8b1c('0x109')],{'foreignKey':_0x8b1c('0x1d8'),'as':_0x8b1c('0x1d2')});db[_0x8b1c('0x102')][_0x8b1c('0x124')](db['User'],{'as':_0x8b1c('0x14f'),'through':_0x8b1c('0x3b'),'foreignKey':_0x8b1c('0x1f1')});db['WhatsappQueue'][_0x8b1c('0x124')](db[_0x8b1c('0xe2')],{'through':'team_has_whatsapp_queues','as':'Teams'});db['UserSetting']['belongsTo'](db[_0x8b1c('0x109')],{'as':_0x8b1c('0x1f2'),'foreignKey':_0x8b1c('0x10d'),'onDelete':_0x8b1c('0x10c'),'hooks':!![]});db['CloudProvider'][_0x8b1c('0x10a')](db[_0x8b1c('0xbd')],{'as':_0x8b1c('0xbd'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x103')][_0x8b1c('0x10a')](db[_0x8b1c('0x3d')],{'as':_0x8b1c('0x15c'),'onDelete':_0x8b1c('0x159')});db[_0x8b1c('0x103')][_0x8b1c('0x10a')](db[_0x8b1c('0x15a')],{'as':_0x8b1c('0x1f3'),'onDelete':_0x8b1c('0x159')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c6e8b91..1315ca5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/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/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./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/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','join','/www','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','express','./api/client-side-logs','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatMessage','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags'];(function(_0x1a8601,_0x39cfe9){var _0x3b7433=function(_0x2f1ef4){while(--_0x2f1ef4){_0x1a8601['push'](_0x1a8601['shift']());}};_0x3b7433(++_0x39cfe9);}(_0x8958,0x93));var _0x8895=function(_0x14d140,_0x19a63e){_0x14d140=_0x14d140-0x0;var _0x139648=_0x8958[_0x14d140];return _0x139648;};'use strict';var path=require('path');var express=require(_0x8895('0x0'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x8895('0x1'));exports['default']=function(_0x38d5d7){return setupLoggers(_0x38d5d7)[_0x8895('0x2')](function(){_0x38d5d7[_0x8895('0x3')]('/api/users',require(_0x8895('0x4')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x5'),require(_0x8895('0x6')));_0x38d5d7[_0x8895('0x3')]('/api/voice/contexts',require(_0x8895('0x7')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x8'),require(_0x8895('0x9')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xa'),require(_0x8895('0xb')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xc'),require(_0x8895('0xd')));_0x38d5d7['use'](_0x8895('0xe'),require(_0x8895('0xf')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x10'),require(_0x8895('0x11')));_0x38d5d7[_0x8895('0x3')]('/api/voice/mails',require(_0x8895('0x12')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x13'),require('./api/voiceMailMessage'));_0x38d5d7['use'](_0x8895('0x14'),require('./api/voiceCallReport'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x15'),require(_0x8895('0x16')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x17'),require('./api/voiceAgentReport'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x18'),require(_0x8895('0x19')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x1a'),require(_0x8895('0x1b')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x1c'),require(_0x8895('0x1d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x1e'),require(_0x8895('0x1f')));_0x38d5d7[_0x8895('0x3')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x38d5d7['use'](_0x8895('0x20'),require(_0x8895('0x21')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x22'),require(_0x8895('0x23')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x24'),require(_0x8895('0x25')));_0x38d5d7['use'](_0x8895('0x26'),require(_0x8895('0x27')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x28'),require(_0x8895('0x29')));_0x38d5d7['use']('/api/mail/applications',require(_0x8895('0x2a')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x2b'),require(_0x8895('0x2c')));_0x38d5d7['use'](_0x8895('0x2d'),require(_0x8895('0x2e')));_0x38d5d7[_0x8895('0x3')]('/api/dashboards/items',require('./api/dashboardItem'));_0x38d5d7[_0x8895('0x3')]('/api/fax/accounts',require(_0x8895('0x2f')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x30'),require(_0x8895('0x31')));_0x38d5d7[_0x8895('0x3')]('/api/fax/interactions',require('./api/faxInteraction'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x32'),require(_0x8895('0x33')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x34'),require('./api/faxQueue'));_0x38d5d7['use'](_0x8895('0x35'),require(_0x8895('0x36')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x37'),require(_0x8895('0x38')));_0x38d5d7['use'](_0x8895('0x39'),require('./api/smsApplication'));_0x38d5d7[_0x8895('0x3')]('/api/sms/interactions',require(_0x8895('0x3a')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x3b'),require(_0x8895('0x3c')));_0x38d5d7[_0x8895('0x3')]('/api/sms/queues',require(_0x8895('0x3d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x3e'),require(_0x8895('0x3f')));_0x38d5d7[_0x8895('0x3')]('/api/openchannel/applications',require(_0x8895('0x40')));_0x38d5d7['use'](_0x8895('0x41'),require('./api/openchannelInteraction'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x42'),require(_0x8895('0x43')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x44'),require('./api/openchannelQueue'));_0x38d5d7[_0x8895('0x3')]('/api/chat/websites',require(_0x8895('0x45')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x46'),require(_0x8895('0x47')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x48'),require('./api/chatApplication'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x49'),require('./api/chatInteraction'));_0x38d5d7[_0x8895('0x3')]('/api/chat/messages',require(_0x8895('0x4a')));_0x38d5d7[_0x8895('0x3')]('/api/chat/offline_messages',require(_0x8895('0x4b')));_0x38d5d7[_0x8895('0x3')]('/api/chat/queues',require('./api/chatQueue'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x4c'),require(_0x8895('0x4d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x4e'),require('./api/chatProactiveAction'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x4f'),require(_0x8895('0x50')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x51'),require(_0x8895('0x52')));_0x38d5d7['use'](_0x8895('0x53'),require('./api/cmHopper'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x54'),require('./api/cmHopperBlack'));_0x38d5d7[_0x8895('0x3')]('/api/cm/hopper_final',require(_0x8895('0x55')));_0x38d5d7['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x38d5d7['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x56'),require('./api/action'));_0x38d5d7['use'](_0x8895('0x57'),require(_0x8895('0x58')));_0x38d5d7['use'](_0x8895('0x59'),require(_0x8895('0x5a')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x5b'),require(_0x8895('0x5c')));_0x38d5d7['use']('/api/conditions',require('./api/condition'));_0x38d5d7[_0x8895('0x3')]('/api/intervals',require(_0x8895('0x5d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x5e'),require(_0x8895('0x5f')));_0x38d5d7['use'](_0x8895('0x60'),require(_0x8895('0x61')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x62'),require(_0x8895('0x63')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x64'),require(_0x8895('0x65')));_0x38d5d7['use'](_0x8895('0x66'),require(_0x8895('0x67')));_0x38d5d7['use'](_0x8895('0x68'),require('./api/tag'));_0x38d5d7['use'](_0x8895('0x69'),require(_0x8895('0x6a')));_0x38d5d7[_0x8895('0x3')]('/api/triggers',require(_0x8895('0x6b')));_0x38d5d7['use'](_0x8895('0x6c'),require(_0x8895('0x6d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x6e'),require(_0x8895('0x6f')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x70'),require('./api/integrationReport'));_0x38d5d7['use'](_0x8895('0x71'),require(_0x8895('0x72')));_0x38d5d7['use'](_0x8895('0x73'),require('./api/analyticDefaultReport'));_0x38d5d7['use'](_0x8895('0x74'),require('./api/analyticExtractedReport'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x75'),require(_0x8895('0x76')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x77'),require(_0x8895('0x78')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x79'),require('./api/analyticTreeReport'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x7a'),require(_0x8895('0x7b')));_0x38d5d7['use'](_0x8895('0x7c'),require(_0x8895('0x7d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x7e'),require(_0x8895('0x7f')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x80'),require(_0x8895('0x81')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x82'),require('./api/intSugarcrmConfiguration'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x83'),require(_0x8895('0x84')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x85'),require('./api/intDeskAccount'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x86'),require(_0x8895('0x87')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x88'),require('./api/intDeskField'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x89'),require(_0x8895('0x8a')));_0x38d5d7['use'](_0x8895('0x8b'),require(_0x8895('0x8c')));_0x38d5d7[_0x8895('0x3')]('/api/integrations/zoho/fields',require(_0x8895('0x8d')));_0x38d5d7[_0x8895('0x3')]('/api/integrations/zendesk/accounts',require(_0x8895('0x8e')));_0x38d5d7[_0x8895('0x3')]('/api/integrations/zendesk/configurations',require(_0x8895('0x8f')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x90'),require(_0x8895('0x91')));_0x38d5d7['use']('/api/integrations/freshdesk/accounts',require(_0x8895('0x92')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x93'),require('./api/intFreshdeskConfiguration'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x94'),require('./api/intFreshdeskField'));_0x38d5d7[_0x8895('0x3')]('/api/integrations/vtiger/accounts',require(_0x8895('0x95')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x96'),require(_0x8895('0x97')));_0x38d5d7[_0x8895('0x3')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x98'),require('./api/intServicenowAccount'));_0x38d5d7[_0x8895('0x3')](_0x8895('0x99'),require(_0x8895('0x9a')));_0x38d5d7[_0x8895('0x3')]('/api/integrations/servicenow/fields',require(_0x8895('0x9b')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x9c'),require(_0x8895('0x9d')));_0x38d5d7[_0x8895('0x3')](_0x8895('0x9e'),require(_0x8895('0x9f')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xa0'),require(_0x8895('0xa1')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xa2'),require(_0x8895('0xa3')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xa4'),require('./api/intFreshsalesConfiguration'));_0x38d5d7['use']('/api/integrations/freshsales/fields',require(_0x8895('0xa5')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xa6'),require(_0x8895('0xa7')));_0x38d5d7[_0x8895('0x3')]('/api/chat/reports/queue',require(_0x8895('0xa8')));_0x38d5d7[_0x8895('0x3')]('/api/chat/internal/messages',require(_0x8895('0xa9')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xaa'),require(_0x8895('0xab')));_0x38d5d7[_0x8895('0x3')]('/api/jscripty/questions/reports',require(_0x8895('0xac')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xad'),require(_0x8895('0xae')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xaf'),require(_0x8895('0xb0')));_0x38d5d7['use'](_0x8895('0xb1'),require(_0x8895('0xb2')));_0x38d5d7['use'](_0x8895('0xb3'),require(_0x8895('0xb4')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xb5'),require(_0x8895('0xb6')));_0x38d5d7['use'](_0x8895('0xb7'),require('./api/setting'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xb8'),require('./api/squareOdbc'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xb9'),require(_0x8895('0xba')));_0x38d5d7[_0x8895('0x3')]('/api/square/recordings',require(_0x8895('0xbb')));_0x38d5d7['use']('/api/square/messages',require(_0x8895('0xbc')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xbd'),require('./api/team'));_0x38d5d7[_0x8895('0x3')]('/api/license',require(_0x8895('0xbe')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xbf'),require(_0x8895('0xc0')));_0x38d5d7[_0x8895('0x3')]('/api/migrations',require('./api/migration'));_0x38d5d7[_0x8895('0x3')]('/api/attachments',require(_0x8895('0xc1')));_0x38d5d7[_0x8895('0x3')]('/api/plugins',require(_0x8895('0xc2')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xc3'),require(_0x8895('0xc4')));_0x38d5d7[_0x8895('0x3')]('/api/chat/reports/transfer',require(_0x8895('0xc5')));_0x38d5d7['use']('/api/fax/reports/transfer',require(_0x8895('0xc6')));_0x38d5d7['use'](_0x8895('0xc7'),require(_0x8895('0xc8')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xc9'),require('./api/smsTransferReport'));_0x38d5d7['use']('/api/cm/lists',require(_0x8895('0xca')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xcb'),require(_0x8895('0xcc')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xcd'),require('./api/userProfile'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xce'),require(_0x8895('0xcf')));_0x38d5d7['use'](_0x8895('0xd0'),require('./api/userProfileResource'));_0x38d5d7[_0x8895('0x3')]('/api/userNotifications',require(_0x8895('0xd1')));_0x38d5d7[_0x8895('0x3')]('/api/whatsapp/accounts',require(_0x8895('0xd2')));_0x38d5d7[_0x8895('0x3')]('/api/whatsapp/applications',require(_0x8895('0xd3')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xd4'),require(_0x8895('0xd5')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xd6'),require(_0x8895('0xd7')));_0x38d5d7['use'](_0x8895('0xd8'),require('./api/whatsappQueueReport'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xd9'),require(_0x8895('0xda')));_0x38d5d7[_0x8895('0x3')]('/api/whatsapp/queues',require(_0x8895('0xdb')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xdc'),require(_0x8895('0xdd')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xde'),require(_0x8895('0xdf')));_0x38d5d7[_0x8895('0x3')]('/api/user-settings',require(_0x8895('0xe0')));_0x38d5d7[_0x8895('0x3')]('/api/auth/local',require('./api/authLocal'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe1'),require(_0x8895('0xe2')));_0x38d5d7[_0x8895('0x3')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe3'),require(_0x8895('0xe4')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe5'),require('./api/rpc'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe6'),require('./api/version'));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe7'),require(_0x8895('0xe8')));_0x38d5d7[_0x8895('0x3')](_0x8895('0xe9'),require(_0x8895('0xea')));_0x38d5d7['use'](_0x8895('0xeb'),require(_0x8895('0xec')));_0x38d5d7['use']('/api/logs',clientSideLogs);_0x38d5d7['use'](_0x8895('0xed'),express[_0x8895('0xee')](path['join'](config[_0x8895('0xef')],'/apidoc')));_0x38d5d7['use']('/www',express[_0x8895('0xee')](path[_0x8895('0xf0')](config[_0x8895('0xef')],_0x8895('0xf1'))));_0x38d5d7[_0x8895('0x3')]('/demo',express[_0x8895('0xee')](path[_0x8895('0xf0')](config[_0x8895('0xef')],'/demo')));_0x38d5d7['use']('/snippet',express[_0x8895('0xee')](path[_0x8895('0xf0')](config[_0x8895('0xef')],_0x8895('0xf2'),_0x8895('0xf3'))));_0x38d5d7[_0x8895('0x3')](_0x8895('0xf4'),express['static'](path[_0x8895('0xf0')](config['root'],_0x8895('0xf5'))));_0x38d5d7['route'](_0x8895('0xf6'))[_0x8895('0xf7')](errors[0x194]);_0x38d5d7[_0x8895('0xf8')]('/*')[_0x8895('0xf7')](function(_0x3dca6c,_0x22968b){_0x22968b[_0x8895('0xf9')](path['resolve'](_0x38d5d7[_0x8895('0xf7')](_0x8895('0xfa'))+_0x8895('0xfb')));});return _0x38d5d7;});}; \ No newline at end of file +var _0x5fd1=['./api/campaign','./api/migration','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./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-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','path','./errors','./config/environment','./utils/client-side-logger','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license'];(function(_0x1a0ace,_0x2596ed){var _0x54c94b=function(_0x5cda25){while(--_0x5cda25){_0x1a0ace['push'](_0x1a0ace['shift']());}};_0x54c94b(++_0x2596ed);}(_0x5fd1,0x155));var _0x15fd=function(_0x15b35c,_0xac8e16){_0x15b35c=_0x15b35c-0x0;var _0x2f623c=_0x5fd1[_0x15b35c];return _0x2f623c;};'use strict';var path=require(_0x15fd('0x0'));var express=require('express');var errors=require(_0x15fd('0x1'));var config=require(_0x15fd('0x2'));var setupLoggers=require(_0x15fd('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x15fd('0x4')]=function(_0x3138f3){return setupLoggers(_0x3138f3)[_0x15fd('0x5')](function(){_0x3138f3['use'](_0x15fd('0x6'),require(_0x15fd('0x7')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x9'),require(_0x15fd('0xa')));_0x3138f3['use'](_0x15fd('0xb'),require(_0x15fd('0xc')));_0x3138f3[_0x15fd('0x8')]('/api/voice/extensions',require(_0x15fd('0xd')));_0x3138f3['use'](_0x15fd('0xe'),require(_0x15fd('0xf')));_0x3138f3['use']('/api/voice/queues',require('./api/voiceQueue'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x10'),require(_0x15fd('0x11')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x12'),require(_0x15fd('0x13')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x14'),require(_0x15fd('0x15')));_0x3138f3['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x16'),require(_0x15fd('0x17')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x18'),require(_0x15fd('0x19')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x1a'),require('./api/voiceAgentReport'));_0x3138f3['use'](_0x15fd('0x1b'),require('./api/voiceQueueReport'));_0x3138f3[_0x15fd('0x8')]('/api/members/reports',require(_0x15fd('0x1c')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x1d'),require('./api/trunk'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x1e'),require(_0x15fd('0x1f')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x20'),require(_0x15fd('0x21')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x22'),require(_0x15fd('0x23')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x24'),require('./api/mailQueue'));_0x3138f3['use'](_0x15fd('0x25'),require(_0x15fd('0x26')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x27'),require(_0x15fd('0x28')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x29'),require('./api/mailMessage'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x2a'),require(_0x15fd('0x2b')));_0x3138f3['use'](_0x15fd('0x2c'),require('./api/mailQueueReport'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x2d'),require(_0x15fd('0x2e')));_0x3138f3['use'](_0x15fd('0x2f'),require(_0x15fd('0x30')));_0x3138f3[_0x15fd('0x8')]('/api/fax/accounts',require(_0x15fd('0x31')));_0x3138f3['use'](_0x15fd('0x32'),require(_0x15fd('0x33')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x34'),require(_0x15fd('0x35')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x36'),require(_0x15fd('0x37')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x38'),require(_0x15fd('0x39')));_0x3138f3['use'](_0x15fd('0x3a'),require(_0x15fd('0x3b')));_0x3138f3['use'](_0x15fd('0x3c'),require(_0x15fd('0x3d')));_0x3138f3['use'](_0x15fd('0x3e'),require(_0x15fd('0x3f')));_0x3138f3['use'](_0x15fd('0x40'),require(_0x15fd('0x41')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x42'),require(_0x15fd('0x43')));_0x3138f3[_0x15fd('0x8')]('/api/sms/queues',require(_0x15fd('0x44')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x45'),require(_0x15fd('0x46')));_0x3138f3['use'](_0x15fd('0x47'),require(_0x15fd('0x48')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x49'),require(_0x15fd('0x4a')));_0x3138f3[_0x15fd('0x8')]('/api/openchannel/messages',require(_0x15fd('0x4b')));_0x3138f3[_0x15fd('0x8')]('/api/openchannel/queues',require(_0x15fd('0x4c')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x4d'),require('./api/chatWebsite'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x4e'),require(_0x15fd('0x4f')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x50'),require(_0x15fd('0x51')));_0x3138f3['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x52'),require(_0x15fd('0x53')));_0x3138f3['use']('/api/chat/offline_messages',require(_0x15fd('0x54')));_0x3138f3['use']('/api/chat/queues',require('./api/chatQueue'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x55'),require(_0x15fd('0x56')));_0x3138f3['use'](_0x15fd('0x57'),require(_0x15fd('0x58')));_0x3138f3[_0x15fd('0x8')]('/api/cm/companies',require(_0x15fd('0x59')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x5a'),require(_0x15fd('0x5b')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x5c'),require(_0x15fd('0x5d')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x5e'),require('./api/cmHopperBlack'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x5f'),require(_0x15fd('0x60')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x61'),require(_0x15fd('0x62')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x63'),require(_0x15fd('0x64')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x65'),require(_0x15fd('0x66')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x67'),require(_0x15fd('0x68')));_0x3138f3['use'](_0x15fd('0x69'),require(_0x15fd('0x6a')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x6b'),require(_0x15fd('0x6c')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x6d'),require(_0x15fd('0x6e')));_0x3138f3['use']('/api/intervals',require(_0x15fd('0x6f')));_0x3138f3['use'](_0x15fd('0x70'),require(_0x15fd('0x71')));_0x3138f3['use'](_0x15fd('0x72'),require(_0x15fd('0x73')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x74'),require(_0x15fd('0x75')));_0x3138f3[_0x15fd('0x8')]('/api/schedules',require(_0x15fd('0x76')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x77'),require(_0x15fd('0x78')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x79'),require(_0x15fd('0x7a')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x7b'),require(_0x15fd('0x7c')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x7d'),require('./api/trigger'));_0x3138f3[_0x15fd('0x8')]('/api/variables',require(_0x15fd('0x7e')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x7f'),require('./api/integration'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x80'),require(_0x15fd('0x81')));_0x3138f3[_0x15fd('0x8')]('/api/analytics/custom_reports',require(_0x15fd('0x82')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x83'),require(_0x15fd('0x84')));_0x3138f3['use'](_0x15fd('0x85'),require(_0x15fd('0x86')));_0x3138f3['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x87'),require(_0x15fd('0x88')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x89'),require(_0x15fd('0x8a')));_0x3138f3['use'](_0x15fd('0x8b'),require(_0x15fd('0x8c')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/salesforce/configurations',require(_0x15fd('0x8d')));_0x3138f3['use'](_0x15fd('0x8e'),require(_0x15fd('0x8f')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x90'),require(_0x15fd('0x91')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x92'),require(_0x15fd('0x93')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x94'),require(_0x15fd('0x95')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x96'),require('./api/intDeskAccount'));_0x3138f3[_0x15fd('0x8')]('/api/integrations/desk/configurations',require(_0x15fd('0x97')));_0x3138f3['use'](_0x15fd('0x98'),require(_0x15fd('0x99')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x9a'),require(_0x15fd('0x9b')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/zoho/fields',require(_0x15fd('0x9c')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x9d'),require(_0x15fd('0x9e')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x9f'),require('./api/intZendeskConfiguration'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xa0'),require(_0x15fd('0xa1')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xa2'),require(_0x15fd('0xa3')));_0x3138f3['use']('/api/integrations/freshdesk/configurations',require(_0x15fd('0xa4')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/freshdesk/fields',require(_0x15fd('0xa5')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/vtiger/accounts',require(_0x15fd('0xa6')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xa7'),require('./api/intVtigerConfiguration'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xa8'),require(_0x15fd('0xa9')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xaa'),require(_0x15fd('0xab')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xac'),require(_0x15fd('0xad')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/servicenow/fields',require(_0x15fd('0xae')));_0x3138f3[_0x15fd('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xaf'),require(_0x15fd('0xb0')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xb1'),require(_0x15fd('0xb2')));_0x3138f3['use'](_0x15fd('0xb3'),require(_0x15fd('0xb4')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xb5'),require(_0x15fd('0xb6')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xb7'),require(_0x15fd('0xb8')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xb9'),require(_0x15fd('0xba')));_0x3138f3['use']('/api/chat/reports/queue',require(_0x15fd('0xbb')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xbc'),require(_0x15fd('0xbd')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xbe'),require(_0x15fd('0xbf')));_0x3138f3['use'](_0x15fd('0xc0'),require('./api/jscriptyQuestionReport'));_0x3138f3[_0x15fd('0x8')]('/api/jscripty/sessions/reports',require(_0x15fd('0xc1')));_0x3138f3['use'](_0x15fd('0xc2'),require(_0x15fd('0xc3')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xc4'),require(_0x15fd('0xc5')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xc6'),require(_0x15fd('0xc7')));_0x3138f3[_0x15fd('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xc8'),require(_0x15fd('0xc9')));_0x3138f3['use'](_0x15fd('0xca'),require(_0x15fd('0xcb')));_0x3138f3[_0x15fd('0x8')]('/api/square/projects',require(_0x15fd('0xcc')));_0x3138f3[_0x15fd('0x8')]('/api/square/recordings',require(_0x15fd('0xcd')));_0x3138f3['use'](_0x15fd('0xce'),require(_0x15fd('0xcf')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xd0'),require(_0x15fd('0xd1')));_0x3138f3['use'](_0x15fd('0xd2'),require('./api/license'));_0x3138f3[_0x15fd('0x8')]('/api/campaigns',require(_0x15fd('0xd3')));_0x3138f3[_0x15fd('0x8')]('/api/migrations',require(_0x15fd('0xd4')));_0x3138f3[_0x15fd('0x8')]('/api/attachments',require('./api/attachment'));_0x3138f3[_0x15fd('0x8')]('/api/plugins',require(_0x15fd('0xd5')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xd6'),require(_0x15fd('0xd7')));_0x3138f3[_0x15fd('0x8')]('/api/chat/reports/transfer',require(_0x15fd('0xd8')));_0x3138f3[_0x15fd('0x8')]('/api/fax/reports/transfer',require(_0x15fd('0xd9')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xda'),require(_0x15fd('0xdb')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xdc'),require(_0x15fd('0xdd')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xde'),require(_0x15fd('0xdf')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xe0'),require(_0x15fd('0xe1')));_0x3138f3[_0x15fd('0x8')]('/api/userProfiles',require(_0x15fd('0xe2')));_0x3138f3['use'](_0x15fd('0xe3'),require(_0x15fd('0xe4')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xe5'),require('./api/userProfileResource'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xe6'),require(_0x15fd('0xe7')));_0x3138f3[_0x15fd('0x8')]('/api/whatsapp/accounts',require(_0x15fd('0xe8')));_0x3138f3[_0x15fd('0x8')]('/api/whatsapp/applications',require(_0x15fd('0xe9')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xea'),require('./api/whatsappInteraction'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xeb'),require(_0x15fd('0xec')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xed'),require(_0x15fd('0xee')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xef'),require(_0x15fd('0xf0')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xf1'),require(_0x15fd('0xf2')));_0x3138f3['use'](_0x15fd('0xf3'),require(_0x15fd('0xf4')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xf5'),require(_0x15fd('0xf6')));_0x3138f3['use']('/api/user-settings',require(_0x15fd('0xf7')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xf8'),require(_0x15fd('0xf9')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xfa'),require(_0x15fd('0xfb')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xfc'),require('./api/authActiveDirectory'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xfd'),require('./api/jira'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0xfe'),require(_0x15fd('0xff')));_0x3138f3[_0x15fd('0x8')]('/api/version',require(_0x15fd('0x100')));_0x3138f3[_0x15fd('0x8')]('/api/system',require(_0x15fd('0x101')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x102'),require('./api/pm2'));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x103'),require(_0x15fd('0x104')));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x105'),clientSideLogs);_0x3138f3[_0x15fd('0x8')](_0x15fd('0x106'),express[_0x15fd('0x107')](path['join'](config[_0x15fd('0x108')],_0x15fd('0x106'))));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x109'),express[_0x15fd('0x107')](path[_0x15fd('0x10a')](config[_0x15fd('0x108')],_0x15fd('0x109'))));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x10b'),express[_0x15fd('0x107')](path[_0x15fd('0x10a')](config[_0x15fd('0x108')],_0x15fd('0x10b'))));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x10c'),express[_0x15fd('0x107')](path[_0x15fd('0x10a')](config[_0x15fd('0x108')],_0x15fd('0x10d'),_0x15fd('0x10e'))));_0x3138f3[_0x15fd('0x8')](_0x15fd('0x10f'),express[_0x15fd('0x107')](path[_0x15fd('0x10a')](config[_0x15fd('0x108')],'/server/files/plugins')));_0x3138f3[_0x15fd('0x110')](_0x15fd('0x111'))['get'](errors[0x194]);_0x3138f3[_0x15fd('0x110')]('/*')[_0x15fd('0x112')](function(_0x121a23,_0x54f6de){_0x54f6de['sendFile'](path['resolve'](_0x3138f3[_0x15fd('0x112')]('appPath')+_0x15fd('0x113')));});return _0x3138f3;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 753f68a..068d9dc 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff9d=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0xff9d,0xf6));var _0xdff9=function(_0x2c1afd,_0x5b3b4b){_0x2c1afd=_0x2c1afd-0x0;var _0x4daae3=_0xff9d[_0x2c1afd];return _0x4daae3;};'use strict';var jayson=require(_0xdff9('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0xdff9('0x1')]=function(){return new Promise(function(_0x1d959e,_0x2dcb4f){var _0x47c941={};_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/user/user.rpc'));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x3')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x4')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/voiceRecording/voiceRecording.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x5')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x6')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x7')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x8')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x9')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0xa')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0xb')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0xc')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0xd')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0xe')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/mailInteraction/mailInteraction.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0xf')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x10')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x11')));_0x47c941=_['merge'](_0x47c941,require('../api/faxAccount/faxAccount.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x12')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x13')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x14')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x15')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x16')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x17')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x18')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x19')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x1a')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x1b')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x1c')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x1d')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x1e')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/chatInteraction/chatInteraction.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x1f')));_0x47c941=_['merge'](_0x47c941,require('../api/chatQueue/chatQueue.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/cmContact/cmContact.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x20')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x21')));_0x47c941=_['merge'](_0x47c941,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x22')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x23')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/interval/interval.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x24')));_0x47c941=_['merge'](_0x47c941,require('../api/sound/sound.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x25')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x26')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x27')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x28')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x29')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x2a')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x2b')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x2c')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x2d')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x2e')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x2f')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x30')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x31')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x32')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x33')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x34')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x35')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x36')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x37')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x38')));_0x47c941=_['merge'](_0x47c941,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x39')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x3a')));_0x47c941=_[_0xdff9('0x2')](_0x47c941,require(_0xdff9('0x3b')));_0x47c941=_['merge'](_0x47c941,require(_0xdff9('0x3c')));var _0x3168c5=jayson[_0xdff9('0x3d')](_0x47c941)['http']();var _0xc90224=config[_0xdff9('0x3e')]['port']||config['port']+0x1;var _0x4070ad=config[_0xdff9('0x3e')]['ip']||_0xdff9('0x3f');_0x3168c5['on'](_0xdff9('0x40'),function(_0x236f5b){return _0x2dcb4f(_0x236f5b);});_0x3168c5['listen'](_0xc90224,_0x4070ad,function(){console[_0xdff9('0x41')](_0xdff9('0x42'),_0x4070ad,_0xc90224);require(_0xdff9('0x43'))['default']();return _0x1d959e(_0xdff9('0x44')+_0x4070ad+':'+_0xc90224);});});}; \ No newline at end of file +var _0x0a9d=['../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x0a9d,0x1ba));var _0xd0a9=function(_0x30d15d,_0x3b3e3d){_0x30d15d=_0x30d15d-0x0;var _0x424cb7=_0x0a9d[_0x30d15d];return _0x424cb7;};'use strict';var jayson=require(_0xd0a9('0x0'));var _=require(_0xd0a9('0x1'));var config=require(_0xd0a9('0x2'));exports['listen']=function(){return new Promise(function(_0x27a6cd,_0x3f418d){var _0x529d5c={};_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x4')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x5')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x6')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x7')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x8')));_0x529d5c=_['merge'](_0x529d5c,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x9')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xa')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xb')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xc')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xd')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/mailServerIn/mailServerIn.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xe')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0xf')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x10')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x11')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x12')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x13')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x14')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x15')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/faxInteraction/faxInteraction.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/faxMessage/faxMessage.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x16')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x17')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x18')));_0x529d5c=_['merge'](_0x529d5c,require('../api/smsInteraction/smsInteraction.rpc'));_0x529d5c=_['merge'](_0x529d5c,require('../api/smsMessage/smsMessage.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/smsQueue/smsQueue.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x19')));_0x529d5c=_['merge'](_0x529d5c,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x1a')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x1b')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x1c')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x1d')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x1e')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x1f')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x20')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x21')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x22')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x23')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x24')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x25')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x26')));_0x529d5c=_['merge'](_0x529d5c,require(_0xd0a9('0x27')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x28')));_0x529d5c=_['merge'](_0x529d5c,require('../api/variable/variable.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x29')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2a')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2b')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2c')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2d')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2e')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x2f')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x30')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x31')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x32')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x529d5c=_['merge'](_0x529d5c,require('../api/setting/setting.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x33')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/squareProject/squareProject.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/squareRecording/squareRecording.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/squareMessage/squareMessage.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/campaign/campaign.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x34')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x35')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x36')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x529d5c=_['merge'](_0x529d5c,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x37')));_0x529d5c=_[_0xd0a9('0x3')](_0x529d5c,require(_0xd0a9('0x38')));var _0x3650af=jayson['server'](_0x529d5c)[_0xd0a9('0x39')]();var _0x1f67f0=config[_0xd0a9('0x3a')][_0xd0a9('0x3b')]||config[_0xd0a9('0x3b')]+0x1;var _0x3ec197=config[_0xd0a9('0x3a')]['ip']||_0xd0a9('0x3c');_0x3650af['on'](_0xd0a9('0x3d'),function(_0x34abd4){return _0x3f418d(_0x34abd4);});_0x3650af['listen'](_0x1f67f0,_0x3ec197,function(){console['log'](_0xd0a9('0x3e'),_0x3ec197,_0x1f67f0);require(_0xd0a9('0x3f'))[_0xd0a9('0x40')]();return _0x27a6cd(_0xd0a9('0x41')+_0x3ec197+':'+_0x1f67f0);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index dcdd06d..7af755c 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 _0xd3e7=['recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','result=','substr','indexOf','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','sendRequest','ANSWER','prototype','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','extension','noop','getVariable'];(function(_0x4c9898,_0x4b016e){var _0x26f389=function(_0x2740fa){while(--_0x2740fa){_0x4c9898['push'](_0x4c9898['shift']());}};_0x26f389(++_0x4b016e);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x7d3e('0x0'));var _=require('lodash');var EventEmitter=require(_0x7d3e('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x7d3e('0x2'));function AGIChannel(_0x211fc8){var _0xffc140=this,_0x1a67cd=new AGIReply(),_0x1e2d44=![],_0xaec336={};EventEmitter[_0x7d3e('0x3')](_0xffc140);_0x211fc8[_0x7d3e('0x4')](_0x7d3e('0x5'));_0x211fc8[_0x7d3e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1a67cd[_0x7d3e('0x4')](_0x7d3e('0x5'));_0x1a67cd['on']('headers',function(_0x5ec654){for(var _0x36c8c2 in _0x5ec654){_0xffc140[_0x36c8c2]=_0x5ec654[_0x36c8c2];}_0xffc140[_0x7d3e('0x7')](_0x7d3e('0x8'));});_0x1a67cd['on'](_0x7d3e('0x9'),function(_0x18c4c3){if(_0x18c4c3[_0x7d3e('0xa')]()=='hangup'){_0xffc140['emit'](_0x7d3e('0xb'));return;}if(_0x18c4c3[_0x7d3e('0xc')](0x0,0xb)==_0x7d3e('0xd')){_0x1e2d44=!![];}if(_0x1e2d44){_0xaec336['rx']+=_0x18c4c3+'\x0a';if(_0x18c4c3[_0x7d3e('0xe')](_0x7d3e('0xf'))!=-0x1){_0x1e2d44=![];}}else{_0xaec336['rx']=_0x18c4c3;}if(_0x1e2d44){return;}if(typeof _0xaec336['cb']==_0x7d3e('0x10')){var _0x5647a5=_0xaec336['rx'][_0x7d3e('0xc')](0x0,0x3),_0x38e4b2=null,_0x4054d1=null;_0x5647a5=parseInt(_0x5647a5);if(isNaN(_0x5647a5)){_0xaec336['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5647a5!=0xc8){_0xaec336['cb'](null,{'code':_0x5647a5,'result':-0x1,'extra':'KO'});return;}_0x38e4b2=_0xaec336['rx'][_0x7d3e('0xc')](0x4)['replace'](_0x7d3e('0x11'),'');if(_0x38e4b2['indexOf']('\x20')!=-0x1){_0x38e4b2=_0x38e4b2[_0x7d3e('0x12')](0x0,_0x38e4b2[_0x7d3e('0x13')]('\x20'));}if(_[_0x7d3e('0x14')](_0x38e4b2,'-1')){_0x38e4b2=parseInt(_0x38e4b2);}_0x4054d1=_0xaec336['rx'][_0x7d3e('0x15')]('\x20');if(_0x4054d1['length']==0x3){_0x4054d1=_0x4054d1[0x2][_0x7d3e('0xc')](0x1,_0x4054d1[0x2][_0x7d3e('0x16')]-0x1);}else if(_0x4054d1[_0x7d3e('0x16')]>0x3){var _0x3a3e24=/\((.+)\)/;var _0x23c5e0=_0xaec336['rx']['match'](_0x3a3e24);if(_0x23c5e0){_0x4054d1=_0x23c5e0[0x1];}else{_0x4054d1=null;}}else{_0x4054d1=null;}_0xaec336['cb'](null,{'code':_0x5647a5,'result':_0x38e4b2,'extra':_0x4054d1});}});_0x211fc8['on']('error',function(_0x4a3d6d){_0xffc140[_0x7d3e('0x7')](_0x7d3e('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x4a3d6d[_0x7d3e('0x18')]));});_0x211fc8['on'](_0x7d3e('0x19'),function(){_0xffc140[_0x7d3e('0x7')](_0x7d3e('0x19'),new AGIError(_0x7d3e('0x1a')));});_0x211fc8['on'](_0x7d3e('0x1b'),function(){_0xffc140['emit'](_0x7d3e('0x1b'),new AGIError(_0x7d3e('0x1c')));_0x211fc8[_0x7d3e('0x1d')]();});_0x211fc8[_0x7d3e('0x1e')](_0x1a67cd);this[_0x7d3e('0x1f')]=function(_0x24f8e5,_0x5bacbd){var _0x24f8e5=_0x24f8e5||'',_0x5bacbd=typeof _0x5bacbd==_0x7d3e('0x10')?_0x5bacbd:new Function();_0xaec336={'tx':_0x24f8e5,'rx':'','cb':_0x5bacbd};_0x211fc8[_0x7d3e('0x20')](_0x24f8e5+'\x0a');},this[_0x7d3e('0x19')]=function(){_0x211fc8['destroy']();};}util[_0x7d3e('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x2b3505){return this[_0x7d3e('0x1f')][_0x7d3e('0x22')](this,_0x2b3505);};AGIChannel['prototype']['answer']=function(){return this[_0x7d3e('0x23')](_0x7d3e('0x24'));};AGIChannel[_0x7d3e('0x25')]['getData']=function(_0x597dcb,_0x27442e,_0x1407d3){_0x597dcb=_0x597dcb===undefined?_0x7d3e('0x26'):_0x597dcb;_0x27442e=_0x27442e===undefined?'5':_0x27442e;_0x1407d3=_0x1407d3===undefined?'1':_0x1407d3;return this[_0x7d3e('0x23')](util[_0x7d3e('0x27')](_0x7d3e('0x28'),_0x597dcb,_0x27442e*0x3e8,_0x1407d3));};AGIChannel[_0x7d3e('0x25')]['noop']=function(_0x45cd39){_0x45cd39=_0x45cd39||'NO\x20MESSAGE';return this[_0x7d3e('0x23')](util['format'](_0x7d3e('0x29'),_0x45cd39));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x2a')]=function(_0x2dd4c5,_0x49b4db){if(_[_0x7d3e('0x2b')](_0x49b4db)){return this[_0x7d3e('0x23')](util[_0x7d3e('0x27')](_0x7d3e('0x2c'),_0x2dd4c5,_0x49b4db[_0x7d3e('0x2d')](',')));}return this['sendRequest'](util['format'](_0x7d3e('0x2c'),_0x2dd4c5,_0x49b4db));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x2e')]=function(_0x54b480){return this[_0x7d3e('0x23')](util[_0x7d3e('0x27')](_0x7d3e('0x2f'),_0x54b480));};AGIChannel['prototype'][_0x7d3e('0x30')]=function(_0x11c1f7){return this['sendRequest'](util['format'](_0x7d3e('0x31'),_0x11c1f7));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x32')]=function(_0x53e3d2){return this['sendRequest'](util[_0x7d3e('0x27')](_0x7d3e('0x33'),_0x53e3d2));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0xb')]=function(){return this[_0x7d3e('0x23')](_0x7d3e('0x34'));};AGIChannel[_0x7d3e('0x25')]['setVariable']=function(_0x9c2aa1,_0x2df4c9){var _0x3e5220=_['isBoolean'](_0x2df4c9)||_[_0x7d3e('0x35')](_0x2df4c9)?_0x2df4c9['toString']():_0x2df4c9;return this[_0x7d3e('0x23')](util['format'](_0x7d3e('0x36'),_0x9c2aa1,_0x3e5220?_0x3e5220[_0x7d3e('0x37')]()[_0x7d3e('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x39')]=function(_0x5b89bd,_0x23e80d){return this[_0x7d3e('0x23')](util['format'](_0x7d3e('0x3a'),_0x5b89bd,_0x23e80d));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x3b')]=function(_0x3a14c5,_0x43ed00){return this['sendRequest'](util[_0x7d3e('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x3a14c5,_0x43ed00));};AGIChannel['prototype'][_0x7d3e('0x3c')]=function(_0x2ef00f,_0x4febb9){return this[_0x7d3e('0x23')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2ef00f,_0x4febb9));};AGIChannel['prototype'][_0x7d3e('0x3d')]=function(_0x4cc809,_0x268420,_0x10050c){_0x268420=_0x268420||this[_0x7d3e('0x3e')];_0x10050c=_0x10050c||0x1;this[_0x7d3e('0x2e')](_0x4cc809);this['setExtension'](_0x268420);this['setPriority'](_0x10050c);return this[_0x7d3e('0x3f')](util[_0x7d3e('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x4cc809,_0x268420,_0x10050c));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x40')]=function(_0x37fe97){return this[_0x7d3e('0x23')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x37fe97));};AGIChannel['prototype'][_0x7d3e('0x41')]=function(_0x56fdfd,_0x9ce08,_0x26f2bb,_0x586200,_0x48f5e9,_0x2e9a6b){_0x9ce08=_0x9ce08||'wav';_0x26f2bb=_0x26f2bb||'';_0x586200=_0x586200===undefined?-0x1:_0x586200==='-1'?-0x1:_0x586200*0x3e8;_0x48f5e9=_0x48f5e9===undefined?'':'s='+_0x48f5e9;_0x2e9a6b=_0x2e9a6b?_0x7d3e('0x42'):'';return this[_0x7d3e('0x23')](util[_0x7d3e('0x27')](_0x7d3e('0x43'),_0x56fdfd,_0x9ce08,_0x26f2bb,_0x586200,_0x2e9a6b,_0x48f5e9));};AGIChannel[_0x7d3e('0x25')]['streamFile']=function(_0x2b901f,_0x46e7b3){_0x46e7b3=_0x46e7b3||'';return this['sendRequest'](util[_0x7d3e('0x27')](_0x7d3e('0x44'),_0x2b901f,_0x46e7b3));};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x45')]=function(_0x2be64e){return this[_0x7d3e('0x2a')]('AGI',_0x2be64e);};AGIChannel[_0x7d3e('0x25')][_0x7d3e('0x46')]=function(_0x1bcead){return this[_0x7d3e('0x2a')]('WAIT',_0x1bcead);};AGIChannel['prototype']['error']=function(_0x7b028b,_0x1a71af){this['noop'](util[_0x7d3e('0x27')](_0x7d3e('0x47'),_0x7b028b['id'],_0x7b028b['label'],_0x1a71af));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7d3e('0x48')]=AGIChannel; \ No newline at end of file +var _0x5c7c=['STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','toLowerCase','hangup','520-Invalid','search','function','substring','no\x20code','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','command','inherits','prototype','sendRequest','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','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','wav','BEEP'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x5c7c,0x172));var _0xc5c7=function(_0x481ee8,_0x5aa574){_0x481ee8=_0x481ee8-0x0;var _0x5ad55f=_0x5c7c[_0x481ee8];return _0x5ad55f;};'use strict';var util=require(_0xc5c7('0x0'));var _=require(_0xc5c7('0x1'));var EventEmitter=require(_0xc5c7('0x2'))[_0xc5c7('0x3')];var AGIReply=require(_0xc5c7('0x4'));var AGIError=require(_0xc5c7('0x5'));function AGIChannel(_0xc17170){var _0x4e4407=this,_0x1c4f6b=new AGIReply(),_0x1cfbf3=![],_0x557ffb={};EventEmitter['call'](_0x4e4407);_0xc17170[_0xc5c7('0x6')](_0xc5c7('0x7'));_0xc17170['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1c4f6b[_0xc5c7('0x6')](_0xc5c7('0x7'));_0x1c4f6b['on'](_0xc5c7('0x8'),function(_0x43520f){for(var _0x571b10 in _0x43520f){_0x4e4407[_0x571b10]=_0x43520f[_0x571b10];}_0x4e4407[_0xc5c7('0x9')](_0xc5c7('0xa'));});_0x1c4f6b['on']('line',function(_0x25ce4e){if(_0x25ce4e[_0xc5c7('0xb')]()==_0xc5c7('0xc')){_0x4e4407['emit']('hangup');return;}if(_0x25ce4e['substring'](0x0,0xb)==_0xc5c7('0xd')){_0x1cfbf3=!![];}if(_0x1cfbf3){_0x557ffb['rx']+=_0x25ce4e+'\x0a';if(_0x25ce4e[_0xc5c7('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x1cfbf3=![];}}else{_0x557ffb['rx']=_0x25ce4e;}if(_0x1cfbf3){return;}if(typeof _0x557ffb['cb']==_0xc5c7('0xf')){var _0x286a3f=_0x557ffb['rx'][_0xc5c7('0x10')](0x0,0x3),_0x1ee659=null,_0x10b566=null;_0x286a3f=parseInt(_0x286a3f);if(isNaN(_0x286a3f)){_0x557ffb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc5c7('0x11')});return;}if(_0x286a3f!=0xc8){_0x557ffb['cb'](null,{'code':_0x286a3f,'result':-0x1,'extra':'KO'});return;}_0x1ee659=_0x557ffb['rx'][_0xc5c7('0x10')](0x4)[_0xc5c7('0x12')]('result=','');if(_0x1ee659[_0xc5c7('0x13')]('\x20')!=-0x1){_0x1ee659=_0x1ee659[_0xc5c7('0x14')](0x0,_0x1ee659['indexOf']('\x20'));}if(_['startsWith'](_0x1ee659,'-1')){_0x1ee659=parseInt(_0x1ee659);}_0x10b566=_0x557ffb['rx'][_0xc5c7('0x15')]('\x20');if(_0x10b566[_0xc5c7('0x16')]==0x3){_0x10b566=_0x10b566[0x2][_0xc5c7('0x10')](0x1,_0x10b566[0x2][_0xc5c7('0x16')]-0x1);}else if(_0x10b566['length']>0x3){var _0x2552ef=/\((.+)\)/;var _0x18bea3=_0x557ffb['rx'][_0xc5c7('0x17')](_0x2552ef);if(_0x18bea3){_0x10b566=_0x18bea3[0x1];}else{_0x10b566=null;}}else{_0x10b566=null;}_0x557ffb['cb'](null,{'code':_0x286a3f,'result':_0x1ee659,'extra':_0x10b566});}});_0xc17170['on'](_0xc5c7('0x18'),function(_0x16e44c){_0x4e4407['emit']('error',new AGIError(_0xc5c7('0x19'),_0x16e44c[_0xc5c7('0x1a')]));});_0xc17170['on']('close',function(){_0x4e4407['emit'](_0xc5c7('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xc17170['on'](_0xc5c7('0x1c'),function(){_0x4e4407[_0xc5c7('0x9')](_0xc5c7('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xc17170[_0xc5c7('0x1d')]();});_0xc17170[_0xc5c7('0x1e')](_0x1c4f6b);this[_0xc5c7('0x1f')]=function(_0x3911f7,_0x14dc81){var _0x3911f7=_0x3911f7||'',_0x14dc81=typeof _0x14dc81=='function'?_0x14dc81:new Function();_0x557ffb={'tx':_0x3911f7,'rx':'','cb':_0x14dc81};_0xc17170['write'](_0x3911f7+'\x0a');},this[_0xc5c7('0x1b')]=function(){_0xc17170[_0xc5c7('0x1d')]();};}util[_0xc5c7('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x22')]=function(_0x1e4a3f){return this[_0xc5c7('0x1f')]['sync'](this,_0x1e4a3f);};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x23')]=function(){return this[_0xc5c7('0x22')](_0xc5c7('0x24'));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x25')]=function(_0x579ab5,_0x1e7ab0,_0x5a0dfa){_0x579ab5=_0x579ab5===undefined?'beep':_0x579ab5;_0x1e7ab0=_0x1e7ab0===undefined?'5':_0x1e7ab0;_0x5a0dfa=_0x5a0dfa===undefined?'1':_0x5a0dfa;return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x27'),_0x579ab5,_0x1e7ab0*0x3e8,_0x5a0dfa));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x28')]=function(_0x5e50ed){_0x5e50ed=_0x5e50ed||_0xc5c7('0x29');return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x2a'),_0x5e50ed));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x2b')]=function(_0x5aca5b,_0x51c860){if(_[_0xc5c7('0x2c')](_0x51c860)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x5aca5b,_0x51c860['join'](',')));}return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x2d'),_0x5aca5b,_0x51c860));};AGIChannel[_0xc5c7('0x21')]['setContext']=function(_0xa7e082){return this['sendRequest'](util[_0xc5c7('0x26')](_0xc5c7('0x2e'),_0xa7e082));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x2f')]=function(_0x159b29){return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x30'),_0x159b29));};AGIChannel[_0xc5c7('0x21')]['setPriority']=function(_0xfebb30){return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x31'),_0xfebb30));};AGIChannel[_0xc5c7('0x21')]['hangup']=function(){return this[_0xc5c7('0x22')](_0xc5c7('0x32'));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x33')]=function(_0x841be4,_0x2c074f){var _0x2848da=_[_0xc5c7('0x34')](_0x2c074f)||_['isNumber'](_0x2c074f)?_0x2c074f[_0xc5c7('0x35')]():_0x2c074f;return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x36'),_0x841be4,_0x2848da?_0x2848da[_0xc5c7('0x35')]()[_0xc5c7('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x37')]=function(_0x19ee07,_0x5198e7){return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x38'),_0x19ee07,_0x5198e7));};AGIChannel[_0xc5c7('0x21')]['sayDigits']=function(_0x65c14c,_0x3b9096){return this['sendRequest'](util[_0xc5c7('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x65c14c,_0x3b9096));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x39')]=function(_0xb63fd9,_0x2b12be){return this[_0xc5c7('0x22')](util['format'](_0xc5c7('0x3a'),_0xb63fd9,_0x2b12be));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x3b')]=function(_0x4326bf,_0x5e77be,_0x4b6f2){_0x5e77be=_0x5e77be||this[_0xc5c7('0x3c')];_0x4b6f2=_0x4b6f2||0x1;this['setContext'](_0x4326bf);this[_0xc5c7('0x2f')](_0x5e77be);this[_0xc5c7('0x3d')](_0x4b6f2);return this[_0xc5c7('0x28')](util[_0xc5c7('0x26')](_0xc5c7('0x3e'),_0x4326bf,_0x5e77be,_0x4b6f2));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x3f')]=function(_0x2ca5b5){return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')](_0xc5c7('0x40'),_0x2ca5b5));};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x41')]=function(_0x2e5f09,_0x3a27d1,_0x269e47,_0x42d3a4,_0x1a67ea,_0x4b0e6a){_0x3a27d1=_0x3a27d1||_0xc5c7('0x42');_0x269e47=_0x269e47||'';_0x42d3a4=_0x42d3a4===undefined?-0x1:_0x42d3a4==='-1'?-0x1:_0x42d3a4*0x3e8;_0x1a67ea=_0x1a67ea===undefined?'':'s='+_0x1a67ea;_0x4b0e6a=_0x4b0e6a?_0xc5c7('0x43'):'';return this[_0xc5c7('0x22')](util[_0xc5c7('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2e5f09,_0x3a27d1,_0x269e47,_0x42d3a4,_0x4b0e6a,_0x1a67ea));};AGIChannel[_0xc5c7('0x21')]['streamFile']=function(_0x592976,_0x5c3cf6){_0x5c3cf6=_0x5c3cf6||'';return this[_0xc5c7('0x22')](util['format'](_0xc5c7('0x44'),_0x592976,_0x5c3cf6));};AGIChannel[_0xc5c7('0x21')]['agi']=function(_0x1419e2){return this['exec'](_0xc5c7('0x45'),_0x1419e2);};AGIChannel[_0xc5c7('0x21')]['wait']=function(_0x3f350b){return this[_0xc5c7('0x2b')](_0xc5c7('0x46'),_0x3f350b);};AGIChannel[_0xc5c7('0x21')][_0xc5c7('0x18')]=function(_0x1d213,_0x555f5c){this[_0xc5c7('0x28')](util[_0xc5c7('0x26')](_0xc5c7('0x47'),_0x1d213['id'],_0x1d213[_0xc5c7('0x48')],_0x555f5c));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 cb24cde..b7ac56a 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 _0x2ba3=['Empty\x20command.','E_AGI_UNDEFINED','push','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x481a5e,_0x45e71d){var _0x4df483=function(_0x5681e3){while(--_0x5681e3){_0x481a5e['push'](_0x481a5e['shift']());}};_0x4df483(++_0x45e71d);}(_0x2ba3,0x87));var _0x32ba=function(_0x33de19,_0x4d54ee){_0x33de19=_0x33de19-0x0;var _0x2f4315=_0x2ba3[_0x33de19];return _0x2f4315;};'use strict';var util=require(_0x32ba('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x32ba('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x32ba('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x32ba('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x32ba('0x4'),'E_AGI_SOCKET_ERROR':_0x32ba('0x5'),'E_AGI_SOCKET_CLOSE':_0x32ba('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x32ba('0x7'),'E_AGI_COMMAND_EMPTY':_0x32ba('0x8'),'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(_0x382d4c){var _0x382d4c=_0x382d4c||null,_0x42c913=_0x42c913||[],_0x17d6ed=0x1,_0x57584d='';if(!error[_0x382d4c]){_0x382d4c=_0x32ba('0x9');}_0x42c913[_0x32ba('0xa')](error[_0x382d4c]);while(arguments[_0x17d6ed]){_0x42c913[_0x32ba('0xa')](arguments[_0x17d6ed]);_0x17d6ed++;}_0x57584d=util['format']['apply'](util,_0x42c913);this[_0x32ba('0xb')]=_0x57584d;this['name']=_0x382d4c;}module[_0x32ba('0xc')]=AGIError; \ No newline at end of file +var _0x2923=['Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x2923,0x1b9));var _0x3292=function(_0x4cce4,_0x3e8690){_0x4cce4=_0x4cce4-0x0;var _0x5ce063=_0x2923[_0x4cce4];return _0x5ce063;};'use strict';var util=require(_0x3292('0x0'));var error={'E_AGI_UNDEFINED':_0x3292('0x1'),'E_AGI_ARGUMENT_PORT':_0x3292('0x2'),'E_AGI_SERVER_ERROR':_0x3292('0x3'),'E_AGI_SERVER_CLOSE':_0x3292('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x3292('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x3292('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x3292('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x3292('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3292('0x9')};function AGIError(_0xb15150){var _0xb15150=_0xb15150||null,_0x5943f3=_0x5943f3||[],_0x2e1ebb=0x1,_0x581156='';if(!error[_0xb15150]){_0xb15150=_0x3292('0xa');}_0x5943f3['push'](error[_0xb15150]);while(arguments[_0x2e1ebb]){_0x5943f3[_0x3292('0xb')](arguments[_0x2e1ebb]);_0x2e1ebb++;}_0x581156=util[_0x3292('0xc')][_0x3292('0xd')](util,_0x5943f3);this[_0x3292('0xe')]=_0x581156;this[_0x3292('0xf')]=_0xb15150;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d052607..5f39d63 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 _0xeb5c=['../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','vswitch','target','default','agicommand','invalid','includes','condition\x20not\x20found','exports','lodash'];(function(_0x249059,_0x158688){var _0x392334=function(_0x4eb829){while(--_0x4eb829){_0x249059['push'](_0x249059['shift']());}};_0x392334(++_0x158688);}(_0xeb5c,0x95));var _0xceb5=function(_0x26fc3f,_0x362887){_0x26fc3f=_0x26fc3f-0x0;var _0x2976c9=_0xeb5c[_0x26fc3f];return _0x2976c9;};'use strict';var _=require(_0xceb5('0x0'));var logger=require(_0xceb5('0x1'))(_0xceb5('0x2'));var verticesWithRetry=[_0xceb5('0x3'),_0xceb5('0x4'),_0xceb5('0x5')];var Graph=function(){this[_0xceb5('0x6')]={};this['edges']={};this[_0xceb5('0x7')]=0x0;};Graph[_0xceb5('0x8')][_0xceb5('0x9')]=function(_0xef85be){this[_0xceb5('0x6')][_0xef85be['id']]=_0xef85be;this[_0xceb5('0xa')][_0xef85be['id']]=[];};Graph['prototype']['addEdge']=function(_0x211813,_0x221798,_0x597552){this['edges'][_0x211813][_0xceb5('0xb')]({'target':_0x221798,'condition':_0x597552});this[_0xceb5('0x7')]+=0x1;};Graph[_0xceb5('0x8')][_0xceb5('0xc')]=function(){return _[_0xceb5('0xc')](this[_0xceb5('0x6')]);};Graph[_0xceb5('0x8')]['relations']=function(){return this[_0xceb5('0x7')];};Graph['prototype'][_0xceb5('0xd')]=function(_0x40e9ca){return this[_0xceb5('0x6')][_0x40e9ca];};Graph[_0xceb5('0x8')][_0xceb5('0xe')]=function(_0x1b0915,_0x95714){if(!this[_0xceb5('0x6')][_0x1b0915]){return logger[_0xceb5('0xf')](_0xceb5('0x10'));}var _0x1d7fc9=_0x95714(this[_0xceb5('0x6')][_0x1b0915]);if(!_0x1d7fc9){return logger['info'](_0xceb5('0x11'));}if(this[_0xceb5('0xa')][_0x1b0915]['length']===0x0){return logger[_0xceb5('0xf')](_0xceb5('0x12'));}for(var _0x31b005=0x0,_0x15fd93=[],_0x18b318=![];_0x31b005\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','then','catch','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','close','timeout','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','result','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','connection','xml2json','syncho','util','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults'];(function(_0x4ed491,_0x18d876){var _0x4fe4d6=function(_0x340475){while(--_0x340475){_0x4ed491['push'](_0x4ed491['shift']());}};_0x4fe4d6(++_0x18d876);}(_0xd90f,0x1b7));var _0xfd90=function(_0x28841d,_0x41c03d){_0x28841d=_0x28841d-0x0;var _0x1d02c6=_0xd90f[_0x28841d];return _0x1d02c6;};'use strict';var parser=require(_0xfd90('0x0'));var _=require('lodash');var syncho=require(_0xfd90('0x1'));var util=require(_0xfd90('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0xfd90('0x3'))('agi');var utilLicense=require(_0xfd90('0x4'));var rpc=require(_0xfd90('0x5'));var mailRpc=require(_0xfd90('0x6'));var Graph=require(_0xfd90('0x7'));var Vertices=require(_0xfd90('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xfd90('0x9')]=_[_0xfd90('0xa')](config[_0xfd90('0x9')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x43b07b){process[_0xfd90('0xb')](function(){syncho(function(){try{setChannelVariables(_0x43b07b);agiHandler(_0x43b07b);}catch(_0x77a02a){logger[_0xfd90('0xc')](_0x77a02a['stack']);}});});}function listeningHandler(){console[_0xfd90('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xfd90('0xe')]);logger['info'](util[_0xfd90('0xf')](_0xfd90('0x10'),config[_0xfd90('0x9')]['ip'],config[_0xfd90('0x9')][_0xfd90('0xe')]));}function errorHandler(_0x1ab16b){if(_0x1ab16b&&_0x1ab16b[_0xfd90('0x11')]&&_0x1ab16b[_0xfd90('0x12')]){logger['error'](util[_0xfd90('0xf')](_0xfd90('0x13'),_0x1ab16b[_0xfd90('0x11')],_0x1ab16b[_0xfd90('0x12')]));}else{logger[_0xfd90('0xc')](util[_0xfd90('0xf')](_0xfd90('0x14'),_0x1ab16b[_0xfd90('0x15')]));}}function closeHandler(){logger[_0xfd90('0x16')](util[_0xfd90('0xf')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfd90('0x17')],this[_0xfd90('0x18')],this[_0xfd90('0x19')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5c898f){logger[_0xfd90('0xc')](_0x5c898f[_0xfd90('0x15')]);}}function timeoutHandler(){logger['info'](util[_0xfd90('0xf')](_0xfd90('0x1a'),this[_0xfd90('0x17')],this[_0xfd90('0x18')],this[_0xfd90('0x19')],this[_0xfd90('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0xfd90('0x16')](util[_0xfd90('0xf')](_0xfd90('0x1c'),this[_0xfd90('0x17')],this[_0xfd90('0x18')],this[_0xfd90('0x19')],this[_0xfd90('0x1b')],this['uniqueid']));this[_0xfd90('0x1d')]=!![];}function getRoot(_0x35324d){return parser[_0xfd90('0x1e')](_0x35324d,{'object':!![]})[_0xfd90('0x1f')][_0xfd90('0x20')];}function addVertex(_0x219b2a,_0x2f6329,_0x5be6c0){_0x2f6329[_0xfd90('0x21')]=_0x5be6c0;if(_0x2f6329[_0xfd90('0x22')](_0xfd90('0x23'))){_0x2f6329[_0xfd90('0x24')]=parseInt(_0x2f6329[_0xfd90('0x23')],0xa);}_0x219b2a[_0xfd90('0x25')](_[_0xfd90('0x26')](_0x2f6329,_0xfd90('0x27')));}function initGraph(_0x4ab855,_0xed79eb){var _0xe18e75=new Graph();for(var _0x3f607e in _0x4ab855){if(_0x4ab855[_0xfd90('0x22')](_0x3f607e)){if(_[_0xfd90('0x28')](_0x4ab855[_0x3f607e])){for(var _0x347c15=0x0;_0x347c15<_0x4ab855[_0x3f607e][_0xfd90('0x29')];_0x347c15+=0x1){addVertex(_0xe18e75,_0x4ab855[_0x3f607e][_0x347c15],_0x3f607e);}}else{addVertex(_0xe18e75,_0x4ab855[_0x3f607e],_0x3f607e);}}}for(var _0x1dbd85=0x0;_0x1dbd85<_0xed79eb[_0xfd90('0x29')];_0x1dbd85+=0x1){if(_0xed79eb[_0x1dbd85][_0xfd90('0x2a')]&&_0xed79eb[_0x1dbd85][_0xfd90('0x2b')]){_0xe18e75['addEdge'](_0xed79eb[_0x1dbd85][_0xfd90('0x2a')],_0xed79eb[_0x1dbd85][_0xfd90('0x2b')],_0xed79eb[_0x1dbd85]['value']);}}return _0xe18e75;}function getSquareProject(_0x48c9e0,_0x5abd77){rpc['getSquareProject'](_0x48c9e0)[_0xfd90('0x2c')](function(_0x5d4164){_0x5abd77(null,_0x5d4164);})[_0xfd90('0x2d')](function(_0x56bf07){_0x5abd77(null,_0x56bf07);});}function createSquareReport(_0x82f7f3,_0x16d858){rpc['createSquareReport'](_0x82f7f3)[_0xfd90('0x2c')](function(_0x48c6eb){if(_0x16d858){_0x16d858(null,_0x48c6eb);}})[_0xfd90('0x2d')](function(_0x43f101){if(_0x16d858){_0x16d858(null,_0x43f101);}});}function setChannelVariables(_0x84b9a4){for(var _0x3d1647 in _0x84b9a4){if(_0x84b9a4[_0xfd90('0x22')](_0x3d1647)){if(_0x3d1647[_0xfd90('0x2e')](_0xfd90('0x2f'))===0x0){_0x84b9a4[_0x3d1647[_0xfd90('0x30')](0x4)]=_0x84b9a4[_0x3d1647];delete _0x84b9a4[_0x3d1647];}}}}function getLogFromObject(_0x19cddb){return util['inspect'](_0x19cddb,{'showHidden':![],'depth':null});}function agiHandler(_0x1f9ebd){var _0x152f32,_0xea29e4,_0x4f6a1e,_0x547c55,_0x4c830a;logger['debug'](_0xfd90('0x31'),JSON[_0xfd90('0x32')](_0x1f9ebd,null,0x2));logger[_0xfd90('0x16')](util[_0xfd90('0xf')](_0xfd90('0x33'),_0x1f9ebd[_0xfd90('0x17')],_0x1f9ebd[_0xfd90('0x18')],_0x1f9ebd[_0xfd90('0x19')],_0x1f9ebd[_0xfd90('0x1b')],_0x1f9ebd[_0xfd90('0x34')]));_0x1f9ebd['on'](_0xfd90('0xc'),errorHandler);_0x1f9ebd['on'](_0xfd90('0x35'),closeHandler);_0x1f9ebd['on'](_0xfd90('0x36'),timeoutHandler);_0x1f9ebd[_0xfd90('0x1d')]=![];_0x1f9ebd['on'](_0xfd90('0x37'),hangupHandler);var _0x148055=getSquareProject[_0xfd90('0x38')](null,_0x1f9ebd[_0xfd90('0x17')]);if(_0x148055){if(_0x148055[_0xfd90('0x39')]){_0x152f32=getRoot(_0x148055[_0xfd90('0x39')]);if(_0x152f32&&_0x152f32[_0xfd90('0x3a')]){logger['debug'](_0xfd90('0x20'),JSON[_0xfd90('0x32')](_0x152f32,null,0x2));_0x1f9ebd['joinAt']=moment()['format'](_0xfd90('0x3b'));_0xea29e4=initGraph(_['omit'](_0x152f32,'mxCell'),_0x152f32[_0xfd90('0x27')]);_0x4f6a1e=new Vertices(_0x1f9ebd,rpc,mailRpc);logger['info'](util[_0xfd90('0xf')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1f9ebd[_0xfd90('0x17')],_0x1f9ebd[_0xfd90('0x18')],_0x1f9ebd[_0xfd90('0x19')],_0x1f9ebd['dnid'],_0x1f9ebd[_0xfd90('0x34')]));_0xea29e4['traverseBFS'](_0x152f32[_0xfd90('0x3a')]['id'],function(_0x344f5c){try{_0x344f5c=_0x4f6a1e['clear'](_0x344f5c);logger[_0xfd90('0x3c')](_0xfd90('0x3d'),JSON['stringify'](_0x344f5c,null,0x2));if(_0x344f5c[_0xfd90('0x21')]===_0xfd90('0x3e')){logger[_0xfd90('0x16')](_0xfd90('0x3f'));_0x1f9ebd[_0xfd90('0x40')]=_0x344f5c[_0xfd90('0x40')]||_0x1f9ebd[_0xfd90('0x40')];_0x1f9ebd[_0xfd90('0x41')]=_0x344f5c[_0xfd90('0x41')];_0x1f9ebd['priority']=_0x344f5c[_0xfd90('0x42')]?_0x344f5c[_0xfd90('0x42')]-0x1:0x1;return null;}else if(_0x344f5c&&_0x4f6a1e[_0x344f5c[_0xfd90('0x21')]]){_0x4c830a=_0x4f6a1e[_0x344f5c[_0xfd90('0x21')]](_0x344f5c);logger['info'](_0xfd90('0x43'),JSON[_0xfd90('0x32')](_0x4c830a,null,0x2));if(_0x4c830a&&_0x4c830a[_0xfd90('0x44')]===AGI_CODE_SUCCESS&&_0x4c830a['result']!==AGI_RESULT_ERROR&&!_0x1f9ebd[_0xfd90('0x1d')]){logger['debug'](_0xfd90('0x43'),getLogFromObject(_0x4c830a));return _[_0xfd90('0x45')](_0x4c830a['result'])?null:_0x4c830a['result'][_0xfd90('0x46')]();}else{logger[_0xfd90('0xc')](_0xfd90('0x43'),getLogFromObject(_0x4c830a));return null;}}else{logger[_0xfd90('0xc')](_0xfd90('0x47'));return null;}}catch(_0x276f54){logger[_0xfd90('0xc')](_0x276f54[_0xfd90('0x15')]);return null;}});if(_0x152f32['finally']){logger['info'](util['format'](_0xfd90('0x48'),_0x1f9ebd[_0xfd90('0x17')],_0x1f9ebd['calleridname'],_0x1f9ebd[_0xfd90('0x19')],_0x1f9ebd['dnid'],_0x1f9ebd[_0xfd90('0x34')]));_0xea29e4[_0xfd90('0x49')](_0x152f32['finally']['id'],function(_0x46f508){try{_0x46f508=_0x4f6a1e[_0xfd90('0x4a')](_0x46f508);logger[_0xfd90('0x3c')]('vertex',JSON[_0xfd90('0x32')](_0x46f508,null,0x2));if(_0x46f508&&_0x4f6a1e[_0x46f508['agicommand']]){_0x4c830a=_0x4f6a1e[_0x46f508[_0xfd90('0x21')]](_0x46f508);if(_0x4c830a){logger[_0xfd90('0x3c')]('response',getLogFromObject(_0x4c830a));return _[_0xfd90('0x45')](_0x4c830a[_0xfd90('0x4b')])?null:_0x4c830a[_0xfd90('0x4b')][_0xfd90('0x46')]();}else{logger[_0xfd90('0xc')](_0xfd90('0x43'),getLogFromObject(_0x4c830a));return null;}}else{logger[_0xfd90('0xc')](_0xfd90('0x47'));return null;}}catch(_0x592369){logger[_0xfd90('0xc')](_0x592369['stack']);return null;}});}logger[_0xfd90('0x16')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1f9ebd[_0xfd90('0x17')],_0x1f9ebd[_0xfd90('0x18')],_0x1f9ebd[_0xfd90('0x19')],_0x1f9ebd['dnid'],_0x1f9ebd[_0xfd90('0x34')]));logger[_0xfd90('0x16')](util[_0xfd90('0xf')](_0xfd90('0x4c'),_0x1f9ebd[_0xfd90('0x40')],_0x1f9ebd[_0xfd90('0x41')],parseInt(_0x1f9ebd[_0xfd90('0x42')],0xa)+0x1));_0x1f9ebd[_0xfd90('0x4d')](_0x1f9ebd[_0xfd90('0x40')],_0x1f9ebd[_0xfd90('0x41')],parseInt(_0x1f9ebd[_0xfd90('0x42')],0xa)+0x1);_0x1f9ebd[_0xfd90('0x35')]();}}else{logger['error'](util['format'](_0xfd90('0x4e'),_0x1f9ebd[_0xfd90('0x17')]));_0x1f9ebd[_0xfd90('0x4d')](_0x1f9ebd[_0xfd90('0x40')],_0x1f9ebd[_0xfd90('0x41')],parseInt(_0x1f9ebd[_0xfd90('0x42')],0xa)+0x1);_0x1f9ebd[_0xfd90('0x35')]();}}else{logger['error'](util[_0xfd90('0xf')](_0xfd90('0x4f'),_0x1f9ebd[_0xfd90('0x17')]));_0x1f9ebd['continueAt'](_0x1f9ebd[_0xfd90('0x40')],_0x1f9ebd['extension'],parseInt(_0x1f9ebd['priority'],0xa)+0x1);_0x1f9ebd['close']();}}function main(){var _0x1298f1;return utilLicense[_0xfd90('0x50')]()[_0xfd90('0x2c')](function(_0x288d8c){if(_0x288d8c){if(_0x288d8c[_0xfd90('0x51')]){if(_0x288d8c[_0xfd90('0x52')]&&_0x288d8c[_0xfd90('0x52')]>0x0){logger['info'](util[_0xfd90('0xf')](_0xfd90('0x53'),_0x288d8c[_0xfd90('0x52')]));_0x1298f1=_0x288d8c['callysquare'];}else{logger['info'](_0xfd90('0x54'));}}else{logger[_0xfd90('0x16')](_0xfd90('0x55'));_0x1298f1=-0x1;}}})[_0xfd90('0x2d')](function(_0x19955c){logger[_0xfd90('0xc')](_0xfd90('0x56'),_0x19955c[_0xfd90('0x15')]);})[_0xfd90('0x57')](function(){var _0x5b24dd=require(_0xfd90('0x58'))(config[_0xfd90('0x9')][_0xfd90('0xe')],config[_0xfd90('0x9')]['ip'],_0x1298f1);_0x5b24dd['on'](_0xfd90('0xc'),errorHandler);_0x5b24dd['on']('listening',listeningHandler);_0x5b24dd['on'](_0xfd90('0x59'),connectionHandler);_0x5b24dd['on'](_0xfd90('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0x4fbb=['context','extension','priority','response','code','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./mailRpc','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','retry','addVertex','omit','length','addEdge','source','target','value','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','traverseBFS','clear','vertex'];(function(_0x186065,_0x36f803){var _0x46304b=function(_0x56fa58){while(--_0x56fa58){_0x186065['push'](_0x186065['shift']());}};_0x46304b(++_0x36f803);}(_0x4fbb,0xc2));var _0xb4fb=function(_0x1f43f3,_0xb131b0){_0x1f43f3=_0x1f43f3-0x0;var _0x5956ad=_0x4fbb[_0x1f43f3];return _0x5956ad;};'use strict';var parser=require(_0xb4fb('0x0'));var _=require(_0xb4fb('0x1'));var syncho=require(_0xb4fb('0x2'));var util=require(_0xb4fb('0x3'));var moment=require(_0xb4fb('0x4'));var config=require(_0xb4fb('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xb4fb('0x6'));var rpc=require(_0xb4fb('0x7'));var mailRpc=require(_0xb4fb('0x8'));var Graph=require('./graph');var Vertices=require(_0xb4fb('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xb4fb('0xa')]=_[_0xb4fb('0xb')](config[_0xb4fb('0xa')],{'ip':_0xb4fb('0xc'),'port':0x11dd});function connectionHandler(_0x248686){process[_0xb4fb('0xd')](function(){syncho(function(){try{setChannelVariables(_0x248686);agiHandler(_0x248686);}catch(_0x477dd1){logger[_0xb4fb('0xe')](_0x477dd1[_0xb4fb('0xf')]);}});});}function listeningHandler(){console[_0xb4fb('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb4fb('0xa')][_0xb4fb('0x11')]);logger[_0xb4fb('0x12')](util[_0xb4fb('0x13')](_0xb4fb('0x14'),config[_0xb4fb('0xa')]['ip'],config[_0xb4fb('0xa')][_0xb4fb('0x11')]));}function errorHandler(_0xdd28fa){if(_0xdd28fa&&_0xdd28fa[_0xb4fb('0x15')]&&_0xdd28fa['message']){logger[_0xb4fb('0xe')](util['format'](_0xb4fb('0x16'),_0xdd28fa[_0xb4fb('0x15')],_0xdd28fa[_0xb4fb('0x17')]));}else{logger[_0xb4fb('0xe')](util[_0xb4fb('0x13')]('[ERROR]\x20%s',_0xdd28fa['stack']));}}function closeHandler(){logger[_0xb4fb('0x12')](util['format'](_0xb4fb('0x18'),this['arg_1'],this[_0xb4fb('0x19')],this['callerid'],this[_0xb4fb('0x1a')],this[_0xb4fb('0x1b')]));try{createSquareReport(this);}catch(_0x426574){logger[_0xb4fb('0xe')](_0x426574[_0xb4fb('0xf')]);}}function timeoutHandler(){logger[_0xb4fb('0x12')](util[_0xb4fb('0x13')](_0xb4fb('0x1c'),this[_0xb4fb('0x1d')],this[_0xb4fb('0x19')],this[_0xb4fb('0x1e')],this[_0xb4fb('0x1a')],this[_0xb4fb('0x1b')]));}function hangupHandler(){logger[_0xb4fb('0x12')](util[_0xb4fb('0x13')](_0xb4fb('0x1f'),this[_0xb4fb('0x1d')],this[_0xb4fb('0x19')],this['callerid'],this[_0xb4fb('0x1a')],this[_0xb4fb('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x14c469){return parser['toJson'](_0x14c469,{'object':!![]})[_0xb4fb('0x20')][_0xb4fb('0x21')];}function addVertex(_0x48065f,_0x319a65,_0x2237a0){_0x319a65[_0xb4fb('0x22')]=_0x2237a0;if(_0x319a65['hasOwnProperty'](_0xb4fb('0x23'))){_0x319a65['maxRetry']=parseInt(_0x319a65[_0xb4fb('0x23')],0xa);}_0x48065f[_0xb4fb('0x24')](_[_0xb4fb('0x25')](_0x319a65,'mxCell'));}function initGraph(_0xdc90dd,_0x1ac887){var _0x20c0ea=new Graph();for(var _0x1956c9 in _0xdc90dd){if(_0xdc90dd['hasOwnProperty'](_0x1956c9)){if(_['isArray'](_0xdc90dd[_0x1956c9])){for(var _0x3e1ec9=0x0;_0x3e1ec9<_0xdc90dd[_0x1956c9]['length'];_0x3e1ec9+=0x1){addVertex(_0x20c0ea,_0xdc90dd[_0x1956c9][_0x3e1ec9],_0x1956c9);}}else{addVertex(_0x20c0ea,_0xdc90dd[_0x1956c9],_0x1956c9);}}}for(var _0x5803f5=0x0;_0x5803f5<_0x1ac887[_0xb4fb('0x26')];_0x5803f5+=0x1){if(_0x1ac887[_0x5803f5]['source']&&_0x1ac887[_0x5803f5]['target']){_0x20c0ea[_0xb4fb('0x27')](_0x1ac887[_0x5803f5][_0xb4fb('0x28')],_0x1ac887[_0x5803f5][_0xb4fb('0x29')],_0x1ac887[_0x5803f5][_0xb4fb('0x2a')]);}}return _0x20c0ea;}function getSquareProject(_0x4178d1,_0x3a3ecd){rpc[_0xb4fb('0x2b')](_0x4178d1)[_0xb4fb('0x2c')](function(_0x297d52){_0x3a3ecd(null,_0x297d52);})[_0xb4fb('0x2d')](function(_0x4f5a00){_0x3a3ecd(null,_0x4f5a00);});}function createSquareReport(_0x51ec40,_0x573760){rpc[_0xb4fb('0x2e')](_0x51ec40)[_0xb4fb('0x2c')](function(_0xf69a26){if(_0x573760){_0x573760(null,_0xf69a26);}})['catch'](function(_0x5b9f2e){if(_0x573760){_0x573760(null,_0x5b9f2e);}});}function setChannelVariables(_0x1320cb){for(var _0x1bbbe1 in _0x1320cb){if(_0x1320cb[_0xb4fb('0x2f')](_0x1bbbe1)){if(_0x1bbbe1[_0xb4fb('0x30')](_0xb4fb('0x31'))===0x0){_0x1320cb[_0x1bbbe1[_0xb4fb('0x32')](0x4)]=_0x1320cb[_0x1bbbe1];delete _0x1320cb[_0x1bbbe1];}}}}function getLogFromObject(_0x42d13b){return util['inspect'](_0x42d13b,{'showHidden':![],'depth':null});}function agiHandler(_0x5e8b03){var _0x339743,_0x54b034,_0x48b971,_0x234015,_0x4aed51;logger['debug'](_0xb4fb('0x33'),JSON[_0xb4fb('0x34')](_0x5e8b03,null,0x2));logger['info'](util[_0xb4fb('0x13')](_0xb4fb('0x35'),_0x5e8b03['arg_1'],_0x5e8b03[_0xb4fb('0x19')],_0x5e8b03[_0xb4fb('0x1e')],_0x5e8b03['dnid'],_0x5e8b03[_0xb4fb('0x1b')]));_0x5e8b03['on']('error',errorHandler);_0x5e8b03['on'](_0xb4fb('0x36'),closeHandler);_0x5e8b03['on'](_0xb4fb('0x37'),timeoutHandler);_0x5e8b03[_0xb4fb('0x38')]=![];_0x5e8b03['on'](_0xb4fb('0x39'),hangupHandler);var _0x19bcd0=getSquareProject['sync'](null,_0x5e8b03[_0xb4fb('0x1d')]);if(_0x19bcd0){if(_0x19bcd0[_0xb4fb('0x3a')]){_0x339743=getRoot(_0x19bcd0[_0xb4fb('0x3a')]);if(_0x339743&&_0x339743[_0xb4fb('0x3b')]){logger[_0xb4fb('0x3c')](_0xb4fb('0x21'),JSON[_0xb4fb('0x34')](_0x339743,null,0x2));_0x5e8b03[_0xb4fb('0x3d')]=moment()[_0xb4fb('0x13')](_0xb4fb('0x3e'));_0x54b034=initGraph(_['omit'](_0x339743,_0xb4fb('0x3f')),_0x339743['mxCell']);_0x48b971=new Vertices(_0x5e8b03,rpc,mailRpc);logger[_0xb4fb('0x12')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5e8b03[_0xb4fb('0x1d')],_0x5e8b03[_0xb4fb('0x19')],_0x5e8b03[_0xb4fb('0x1e')],_0x5e8b03[_0xb4fb('0x1a')],_0x5e8b03[_0xb4fb('0x1b')]));_0x54b034[_0xb4fb('0x40')](_0x339743[_0xb4fb('0x3b')]['id'],function(_0x2e7041){try{_0x2e7041=_0x48b971[_0xb4fb('0x41')](_0x2e7041);logger[_0xb4fb('0x3c')](_0xb4fb('0x42'),JSON[_0xb4fb('0x34')](_0x2e7041,null,0x2));if(_0x2e7041[_0xb4fb('0x22')]==='gotoc'){logger[_0xb4fb('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5e8b03['context']=_0x2e7041[_0xb4fb('0x43')]||_0x5e8b03['context'];_0x5e8b03[_0xb4fb('0x44')]=_0x2e7041['extension'];_0x5e8b03[_0xb4fb('0x45')]=_0x2e7041[_0xb4fb('0x45')]?_0x2e7041[_0xb4fb('0x45')]-0x1:0x1;return null;}else if(_0x2e7041&&_0x48b971[_0x2e7041[_0xb4fb('0x22')]]){_0x4aed51=_0x48b971[_0x2e7041[_0xb4fb('0x22')]](_0x2e7041);logger[_0xb4fb('0x12')](_0xb4fb('0x46'),JSON['stringify'](_0x4aed51,null,0x2));if(_0x4aed51&&_0x4aed51[_0xb4fb('0x47')]===AGI_CODE_SUCCESS&&_0x4aed51[_0xb4fb('0x48')]!==AGI_RESULT_ERROR&&!_0x5e8b03[_0xb4fb('0x38')]){logger[_0xb4fb('0x3c')](_0xb4fb('0x46'),getLogFromObject(_0x4aed51));return _['isUndefined'](_0x4aed51[_0xb4fb('0x48')])?null:_0x4aed51['result']['toString']();}else{logger['error'](_0xb4fb('0x46'),getLogFromObject(_0x4aed51));return null;}}else{logger[_0xb4fb('0xe')](_0xb4fb('0x49'));return null;}}catch(_0x4a40c8){logger['error'](_0x4a40c8['stack']);return null;}});if(_0x339743[_0xb4fb('0x4a')]){logger[_0xb4fb('0x12')](util[_0xb4fb('0x13')](_0xb4fb('0x4b'),_0x5e8b03['arg_1'],_0x5e8b03['calleridname'],_0x5e8b03['callerid'],_0x5e8b03[_0xb4fb('0x1a')],_0x5e8b03['uniqueid']));_0x54b034[_0xb4fb('0x40')](_0x339743[_0xb4fb('0x4a')]['id'],function(_0x4de431){try{_0x4de431=_0x48b971[_0xb4fb('0x41')](_0x4de431);logger[_0xb4fb('0x3c')](_0xb4fb('0x42'),JSON['stringify'](_0x4de431,null,0x2));if(_0x4de431&&_0x48b971[_0x4de431['agicommand']]){_0x4aed51=_0x48b971[_0x4de431['agicommand']](_0x4de431);if(_0x4aed51){logger[_0xb4fb('0x3c')](_0xb4fb('0x46'),getLogFromObject(_0x4aed51));return _[_0xb4fb('0x4c')](_0x4aed51[_0xb4fb('0x48')])?null:_0x4aed51['result'][_0xb4fb('0x4d')]();}else{logger['error'](_0xb4fb('0x46'),getLogFromObject(_0x4aed51));return null;}}else{logger[_0xb4fb('0xe')](_0xb4fb('0x49'));return null;}}catch(_0x26c81d){logger[_0xb4fb('0xe')](_0x26c81d[_0xb4fb('0xf')]);return null;}});}logger[_0xb4fb('0x12')](util[_0xb4fb('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5e8b03['arg_1'],_0x5e8b03['calleridname'],_0x5e8b03[_0xb4fb('0x1e')],_0x5e8b03[_0xb4fb('0x1a')],_0x5e8b03[_0xb4fb('0x1b')]));logger[_0xb4fb('0x12')](util['format'](_0xb4fb('0x4e'),_0x5e8b03[_0xb4fb('0x43')],_0x5e8b03[_0xb4fb('0x44')],parseInt(_0x5e8b03['priority'],0xa)+0x1));_0x5e8b03[_0xb4fb('0x4f')](_0x5e8b03[_0xb4fb('0x43')],_0x5e8b03[_0xb4fb('0x44')],parseInt(_0x5e8b03['priority'],0xa)+0x1);_0x5e8b03[_0xb4fb('0x36')]();}}else{logger[_0xb4fb('0xe')](util[_0xb4fb('0x13')](_0xb4fb('0x50'),_0x5e8b03[_0xb4fb('0x1d')]));_0x5e8b03[_0xb4fb('0x4f')](_0x5e8b03[_0xb4fb('0x43')],_0x5e8b03[_0xb4fb('0x44')],parseInt(_0x5e8b03[_0xb4fb('0x45')],0xa)+0x1);_0x5e8b03[_0xb4fb('0x36')]();}}else{logger[_0xb4fb('0xe')](util[_0xb4fb('0x13')]('Project\x20%s\x20not\x20found',_0x5e8b03['arg_1']));_0x5e8b03[_0xb4fb('0x4f')](_0x5e8b03['context'],_0x5e8b03[_0xb4fb('0x44')],parseInt(_0x5e8b03[_0xb4fb('0x45')],0xa)+0x1);_0x5e8b03[_0xb4fb('0x36')]();}}function main(){var _0x163b61;return utilLicense[_0xb4fb('0x51')]()[_0xb4fb('0x2c')](function(_0x445ddf){if(_0x445ddf){if(_0x445ddf['voice']){if(_0x445ddf[_0xb4fb('0x52')]&&_0x445ddf[_0xb4fb('0x52')]>0x0){logger['info'](util[_0xb4fb('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x445ddf[_0xb4fb('0x52')]));_0x163b61=_0x445ddf[_0xb4fb('0x52')];}else{logger[_0xb4fb('0x12')](_0xb4fb('0x53'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x163b61=-0x1;}}})['catch'](function(_0x1bc0b7){logger[_0xb4fb('0xe')](_0xb4fb('0x54'),_0x1bc0b7[_0xb4fb('0xf')]);})[_0xb4fb('0x4a')](function(){var _0x5cfcd4=require(_0xb4fb('0x55'))(config[_0xb4fb('0xa')]['port'],config[_0xb4fb('0xa')]['ip'],_0x163b61);_0x5cfcd4['on'](_0xb4fb('0xe'),errorHandler);_0x5cfcd4['on'](_0xb4fb('0x56'),listeningHandler);_0x5cfcd4['on']('connection',connectionHandler);_0x5cfcd4['on'](_0xb4fb('0x36'),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 d1a67d3..e44722a 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 _0x7e88=['bluebird','jayson/promise','http','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x4fe3eb,_0x49d94e){var _0x27a8ff=function(_0x1478eb){while(--_0x1478eb){_0x4fe3eb['push'](_0x4fe3eb['shift']());}};_0x27a8ff(++_0x49d94e);}(_0x7e88,0xc8));var _0x87e8=function(_0x1a7078,_0x1a8fd3){_0x1a7078=_0x1a7078-0x0;var _0x233a02=_0x7e88[_0x1a7078];return _0x233a02;};'use strict';var BPromise=require(_0x87e8('0x0'));var jayson=require(_0x87e8('0x1'));var client=jayson['client'][_0x87e8('0x2')]({'port':0x232b});function request(_0x39955b,_0x1102b9){return new BPromise(function(_0x8d4875,_0x5e0d7f){return client[_0x87e8('0x3')](_0x39955b,_0x1102b9)[_0x87e8('0x4')](function(_0x37d2b8){if(_0x37d2b8['error']){return _0x5e0d7f(_0x37d2b8[_0x87e8('0x5')][_0x87e8('0x6')]);}else{return _0x8d4875(_0x37d2b8['result']);}})[_0x87e8('0x7')](function(_0x55d65a){return _0x5e0d7f(_0x55d65a);});});}exports[_0x87e8('0x8')]=function(_0x1f1149,_0x5e807d){return request(_0x87e8('0x9'),{'account':_0x1f1149,'message':_0x5e807d});}; \ No newline at end of file +var _0x7258=['catch','sendMailMessage','bluebird','jayson/promise','http','request','then','error','message','result'];(function(_0x5a727e,_0x4c181f){var _0x50b270=function(_0x2f800b){while(--_0x2f800b){_0x5a727e['push'](_0x5a727e['shift']());}};_0x50b270(++_0x4c181f);}(_0x7258,0xa2));var _0x8725=function(_0x3bf04e,_0x2414b5){_0x3bf04e=_0x3bf04e-0x0;var _0x476feb=_0x7258[_0x3bf04e];return _0x476feb;};'use strict';var BPromise=require(_0x8725('0x0'));var jayson=require(_0x8725('0x1'));var client=jayson['client'][_0x8725('0x2')]({'port':0x232b});function request(_0x5c994b,_0x320b4c){return new BPromise(function(_0x47c781,_0x3c8090){return client[_0x8725('0x3')](_0x5c994b,_0x320b4c)[_0x8725('0x4')](function(_0xbeb18e){if(_0xbeb18e[_0x8725('0x5')]){return _0x3c8090(_0xbeb18e[_0x8725('0x5')][_0x8725('0x6')]);}else{return _0x47c781(_0xbeb18e[_0x8725('0x7')]);}})[_0x8725('0x8')](function(_0x4cc21b){return _0x3c8090(_0x4cc21b);});});}exports[_0x8725('0x9')]=function(_0x25467c,_0x32fd15){return request('SendMail',{'account':_0x25467c,'message':_0x32fd15});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 913026d..3544b66 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 _0x44e6=['stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring','length','slice','trim','emit','line','util'];(function(_0x551f70,_0x21460e){var _0x1de80d=function(_0x140510){while(--_0x140510){_0x551f70['push'](_0x551f70['shift']());}};_0x1de80d(++_0x21460e);}(_0x44e6,0xa9));var _0x644e=function(_0x15783f,_0xbd87be){_0x15783f=_0x15783f-0x0;var _0x1da07e=_0x44e6[_0x15783f];return _0x1da07e;};'use strict';var util=require(_0x644e('0x0'));var Transform=require(_0x644e('0x1'))[_0x644e('0x2')];function AGIReply(_0x69e071){Transform[_0x644e('0x3')](this,_0x69e071);this[_0x644e('0x4')]='';this[_0x644e('0x5')]=![];}util[_0x644e('0x6')](AGIReply,Transform);AGIReply[_0x644e('0x7')][_0x644e('0x8')]=function(_0x31d22c,_0x3cff02,_0x1af15b){var _0x17fa2b='\x0a',_0x3b0f97=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3fc733=-0x1,_0x373693=-0x1,_0x3d8a93='',_0x2f8d1a=0x0,_0x51f7bc='',_0x162090='';this[_0x644e('0x4')]+=_0x31d22c[_0x644e('0x9')]();_0x51f7bc=this[_0x644e('0x4')];if(!this[_0x644e('0x5')]){_0x2f8d1a=0x0;while(_0x3b0f97[_0x2f8d1a]){while((_0x373693=_0x51f7bc[_0x644e('0xa')](_0x3b0f97[_0x2f8d1a]))!=-0x1){_0x3d8a93=_0x3b0f97[_0x2f8d1a];_0x162090=_0x51f7bc[_0x644e('0xb')](0x0,_0x373693);_0x51f7bc=_0x51f7bc[_0x644e('0xb')](_0x373693+_0x3d8a93[_0x644e('0xc')]);var _0x34809e=_0x162090['split'](_0x17fa2b),_0xb39978=0x0,_0x114da5={},_0x30e017='',_0x34bbf1='',_0x5d2f64=-0x1;while(_0x34809e[_0xb39978]){_0x5d2f64=_0x34809e[_0xb39978][_0x644e('0xa')](':');if(_0x5d2f64!=-0x1){_0x30e017=_0x34809e[_0xb39978][_0x644e('0xd')](0x0,_0x5d2f64)[_0x644e('0xe')]();_0x34bbf1=_0x34809e[_0xb39978]['slice'](_0x5d2f64+0x1)[_0x644e('0xe')]();if(_0x30e017[_0x644e('0xc')]>0x0){_0x114da5[_0x30e017]=_0x34bbf1;}}else{}_0xb39978++;}this[_0x644e('0xf')]('headers',_0x114da5);this[_0x644e('0x5')]=!![];}_0x2f8d1a++;}this[_0x644e('0x4')]=_0x51f7bc;}else{while((_0x3fc733=_0x51f7bc['indexOf'](_0x17fa2b))!=-0x1){_0x162090=_0x51f7bc[_0x644e('0xb')](0x0,_0x3fc733);this[_0x644e('0xf')](_0x644e('0x10'),_0x162090);_0x51f7bc=_0x51f7bc[_0x644e('0xb')](_0x3fc733+_0x17fa2b[_0x644e('0xc')]);}this['_localBuffer']=_0x51f7bc;}_0x1af15b();};module['exports']=AGIReply; \ No newline at end of file +var _0x1872=['trim','headers','emit','exports','util','stream','Transform','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','slice'];(function(_0x1e378c,_0x4b11a3){var _0x18bb93=function(_0x3c1f22){while(--_0x3c1f22){_0x1e378c['push'](_0x1e378c['shift']());}};_0x18bb93(++_0x4b11a3);}(_0x1872,0xa6));var _0x2187=function(_0x5f4b36,_0x18cb34){_0x5f4b36=_0x5f4b36-0x0;var _0x4765ec=_0x1872[_0x5f4b36];return _0x4765ec;};'use strict';var util=require(_0x2187('0x0'));var Transform=require(_0x2187('0x1'))[_0x2187('0x2')];function AGIReply(_0x4874ec){Transform['call'](this,_0x4874ec);this['_localBuffer']='';this[_0x2187('0x3')]=![];}util[_0x2187('0x4')](AGIReply,Transform);AGIReply[_0x2187('0x5')][_0x2187('0x6')]=function(_0x507bf0,_0x5f2f47,_0x111d4f){var _0x4135be='\x0a',_0x5d434f=['\x0a\x0a',_0x2187('0x7')],_0x2f1e15=-0x1,_0x1820b8=-0x1,_0x325ef7='',_0x26be44=0x0,_0x6bcf1c='',_0x2e6dc4='';this[_0x2187('0x8')]+=_0x507bf0[_0x2187('0x9')]();_0x6bcf1c=this['_localBuffer'];if(!this[_0x2187('0x3')]){_0x26be44=0x0;while(_0x5d434f[_0x26be44]){while((_0x1820b8=_0x6bcf1c[_0x2187('0xa')](_0x5d434f[_0x26be44]))!=-0x1){_0x325ef7=_0x5d434f[_0x26be44];_0x2e6dc4=_0x6bcf1c[_0x2187('0xb')](0x0,_0x1820b8);_0x6bcf1c=_0x6bcf1c[_0x2187('0xb')](_0x1820b8+_0x325ef7[_0x2187('0xc')]);var _0x450921=_0x2e6dc4['split'](_0x4135be),_0x2781bb=0x0,_0x4fb85d={},_0x243e7a='',_0x55739e='',_0x372831=-0x1;while(_0x450921[_0x2781bb]){_0x372831=_0x450921[_0x2781bb][_0x2187('0xa')](':');if(_0x372831!=-0x1){_0x243e7a=_0x450921[_0x2781bb][_0x2187('0xd')](0x0,_0x372831)[_0x2187('0xe')]();_0x55739e=_0x450921[_0x2781bb][_0x2187('0xd')](_0x372831+0x1)[_0x2187('0xe')]();if(_0x243e7a[_0x2187('0xc')]>0x0){_0x4fb85d[_0x243e7a]=_0x55739e;}}else{}_0x2781bb++;}this['emit'](_0x2187('0xf'),_0x4fb85d);this['_inBody']=!![];}_0x26be44++;}this['_localBuffer']=_0x6bcf1c;}else{while((_0x2f1e15=_0x6bcf1c['indexOf'](_0x4135be))!=-0x1){_0x2e6dc4=_0x6bcf1c[_0x2187('0xb')](0x0,_0x2f1e15);this[_0x2187('0x10')]('line',_0x2e6dc4);_0x6bcf1c=_0x6bcf1c[_0x2187('0xb')](_0x2f1e15+_0x4135be['length']);}this[_0x2187('0x8')]=_0x6bcf1c;}_0x111d4f();};module[_0x2187('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index a50073d..49c91d1 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 _0xc895=['getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','jayson/promise','client','request','then','error','result','catch','getSquareProjects','GetSquareProjects','ShowSquareProject','production'];(function(_0x43cc7e,_0x329283){var _0x5287cd=function(_0x3f02c9){while(--_0x3f02c9){_0x43cc7e['push'](_0x43cc7e['shift']());}};_0x5287cd(++_0x329283);}(_0xc895,0x167));var _0x5c89=function(_0x54d2bd,_0x57c539){_0x54d2bd=_0x54d2bd-0x0;var _0x34f0d4=_0xc895[_0x54d2bd];return _0x34f0d4;};'use strict';var BPromise=require(_0x5c89('0x0'));var moment=require('moment');var _=require(_0x5c89('0x1'));var util=require('util');var jayson=require(_0x5c89('0x2'));var client=jayson[_0x5c89('0x3')]['http']({'port':0x2329});function request(_0x4c1143,_0x7ea854){return new BPromise(function(_0x53f0b5,_0x326836){return client[_0x5c89('0x4')](_0x4c1143,_0x7ea854)[_0x5c89('0x5')](function(_0xf3b980){if(_0xf3b980[_0x5c89('0x6')]){return _0x326836(_0xf3b980[_0x5c89('0x6')]['message']);}else{return _0x53f0b5(_0xf3b980[_0x5c89('0x7')]);}})[_0x5c89('0x8')](function(_0x2353e9){return _0x326836(_0x2353e9);});});}exports[_0x5c89('0x9')]=function(){return request(_0x5c89('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x49f35a){return request(_0x5c89('0xb'),{'options':{'raw':![],'where':{'name':_0x49f35a},'attributes':[_0x5c89('0xc')]}});};exports[_0x5c89('0xd')]=function(_0x499495){return request(_0x5c89('0xe'),{'options':{'raw':![],'where':{'id':_0x499495},'include':[{'model':_0x5c89('0xf'),'as':_0x5c89('0x10'),'include':[{'model':_0x5c89('0x11'),'as':'CloudProvider'}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x5c89('0x12')]=function(_0xe9fb68){return request('ShowSquareProject',{'options':{'where':{'id':_0xe9fb68},'attributes':[_0x5c89('0x13')]}});};exports[_0x5c89('0x14')]=function(_0x4400b7){return request(_0x5c89('0x15'),{'options':{'where':{'id':_0x4400b7},'attributes':[_0x5c89('0x13')]}});};exports[_0x5c89('0x16')]=function(_0x159af9){return request(_0x5c89('0x17'),{'options':{'where':{'id':_0x159af9},'attributes':[_0x5c89('0x13')]}});};exports[_0x5c89('0x18')]=function(_0x4d5d97){return request(_0x5c89('0x19'),{'options':{'where':{'id':_0x4d5d97},'attributes':['dsn']}});};exports['getUserById']=function(_0x15e143){return request(_0x5c89('0x1a'),{'options':{'where':{'id':_0x15e143},'attributes':[_0x5c89('0x13')]}});};exports['getContactByPhone']=function(_0x376608){return request(_0x5c89('0x1b'),{'options':{'where':{'phone':_0x376608[_0x5c89('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x3fa4b1){return request(_0x5c89('0x1d'),{'options':{'where':{'id':_0x3fa4b1},'attributes':[_0x5c89('0x13')]}});};exports[_0x5c89('0x1e')]=function(_0x3e94c9){return request('ShowSound',{'options':{'where':{'id':_0x3e94c9},'attributes':[_0x5c89('0x1f')]}});};exports[_0x5c89('0x20')]=function(_0x3974c4){return request(_0x5c89('0x21'),{'options':{'raw':![],'where':{'id':_0x3974c4},'include':[{'model':'Interval','as':_0x5c89('0x22')}]}});};exports['getSmsAccountById']=function(_0x98ea1b){return request(_0x5c89('0x23'),{'options':{'where':{'id':_0x98ea1b},'attributes':['id',_0x5c89('0x13')]}});};exports[_0x5c89('0x24')]=function(_0xd90d19){return request(_0x5c89('0x25'),{'body':_0xd90d19});};exports[_0x5c89('0x26')]=function(_0x20e86f){return request(_0x5c89('0x27'),{'body':_0x20e86f});};exports[_0x5c89('0x28')]=function(_0x11f789){return request(_0x5c89('0x29'),{'body':_[_0x5c89('0x2a')](_0x11f789,{'project_name':_0x11f789[_0x5c89('0x2b')],'prev_project_name':_0x11f789[_0x5c89('0x2c')]||'','is_subproject':_0x11f789[_0x5c89('0x2c')]?!![]:![],'leaveAt':moment()[_0x5c89('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5c89('0x2e')]=function(_0x5634ec){return request('CreateSquareRecording',{'body':_0x5634ec});};exports[_0x5c89('0x2f')]=function(_0x37a427){return request(_0x5c89('0x30'),{'body':_0x37a427});};exports[_0x5c89('0x31')]=function(_0x159ca5){return request(_0x5c89('0x32'),{'options':{'raw':![],'where':{'phone':_0x159ca5[_0x5c89('0x1c')],'ListId':_0x159ca5[_0x5c89('0x33')]}}})[_0x5c89('0x5')](function(_0x5a9e76){if(_0x5a9e76){return _0x5a9e76;}return request(_0x5c89('0x34'),{'body':_0x159ca5});});};exports[_0x5c89('0x35')]=function(_0x48bbbc){return request(_0x5c89('0x36'),{'options':{'where':{'id':_0x48bbbc},'attributes':[_0x5c89('0x13')]}});};exports[_0x5c89('0x37')]=function(_0x4c174a,_0x579b5f){return request(_0x5c89('0x38'),{'body':{'interface':_0x579b5f},'options':{'where':_0x4c174a}});};exports['agentPause']=function(_0x588cb8,_0xf245e6,_0x1aa265){return request(_0x5c89('0x39'),{'body':{'type':_0xf245e6,'uniqueid':_0x1aa265},'options':{'where':_0x588cb8}});};exports[_0x5c89('0x3a')]=function(_0x4809e1){return request(_0x5c89('0x3b'),{'body':{},'options':{'where':_0x4809e1}});};exports[_0x5c89('0x3c')]=function(_0x49e15c){return request(_0x5c89('0x3d'),{'body':{},'options':{'where':_0x49e15c}});}; \ No newline at end of file +var _0x812b=['CreateSquareReport','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','then','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','client','http','error','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x12dd72,_0x4992b5){var _0x3e9b7c=function(_0x5c0424){while(--_0x5c0424){_0x12dd72['push'](_0x12dd72['shift']());}};_0x3e9b7c(++_0x4992b5);}(_0x812b,0x1a7));var _0xb812=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x812b[_0x55ff3e];return _0x2709eb;};'use strict';var BPromise=require(_0xb812('0x0'));var moment=require(_0xb812('0x1'));var _=require(_0xb812('0x2'));var util=require(_0xb812('0x3'));var jayson=require(_0xb812('0x4'));var client=jayson[_0xb812('0x5')][_0xb812('0x6')]({'port':0x2329});function request(_0x468dff,_0x1f7ae2){return new BPromise(function(_0x51db92,_0x2e7ef1){return client['request'](_0x468dff,_0x1f7ae2)['then'](function(_0x13d89b){if(_0x13d89b['error']){return _0x2e7ef1(_0x13d89b[_0xb812('0x7')]['message']);}else{return _0x51db92(_0x13d89b[_0xb812('0x8')]);}})[_0xb812('0x9')](function(_0x487537){return _0x2e7ef1(_0x487537);});});}exports['getSquareProjects']=function(){return request(_0xb812('0xa'),{'options':{'raw':![],'attributes':['id',_0xb812('0xb'),_0xb812('0xc')]}});};exports[_0xb812('0xd')]=function(_0x4449d4){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4449d4},'attributes':[_0xb812('0xc')]}});};exports[_0xb812('0xe')]=function(_0x3618f7){return request(_0xb812('0xf'),{'options':{'raw':![],'where':{'id':_0x3618f7},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xb812('0x10'),'as':_0xb812('0x10')}]}],'attributes':['id','name',_0xb812('0x11')],'smtp':!![]}});};exports[_0xb812('0x12')]=function(_0x29f874){return request('ShowSquareProject',{'options':{'where':{'id':_0x29f874},'attributes':[_0xb812('0xb')]}});};exports[_0xb812('0x13')]=function(_0x1d00b2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1d00b2},'attributes':['name']}});};exports[_0xb812('0x14')]=function(_0x5e8d26){return request(_0xb812('0x15'),{'options':{'where':{'id':_0x5e8d26},'attributes':['name']}});};exports[_0xb812('0x16')]=function(_0x2a6959){return request(_0xb812('0x17'),{'options':{'where':{'id':_0x2a6959},'attributes':[_0xb812('0x18')]}});};exports['getUserById']=function(_0x152afc){return request(_0xb812('0x19'),{'options':{'where':{'id':_0x152afc},'attributes':['name']}});};exports['getContactByPhone']=function(_0x1d014f){return request(_0xb812('0x1a'),{'options':{'where':{'phone':_0x1d014f[_0xb812('0x1b')]},'attributes':['id']}});};exports[_0xb812('0x1c')]=function(_0x5922b2){return request('ShowTrunk',{'options':{'where':{'id':_0x5922b2},'attributes':[_0xb812('0xb')]}});};exports[_0xb812('0x1d')]=function(_0x355dde){return request(_0xb812('0x1e'),{'options':{'where':{'id':_0x355dde},'attributes':['save_name']}});};exports[_0xb812('0x1f')]=function(_0x214999){return request(_0xb812('0x20'),{'options':{'raw':![],'where':{'id':_0x214999},'include':[{'model':_0xb812('0x21'),'as':_0xb812('0x22')}]}});};exports[_0xb812('0x23')]=function(_0x53d520){return request('ShowSmsAccount',{'options':{'where':{'id':_0x53d520},'attributes':['id',_0xb812('0xb')]}});};exports[_0xb812('0x24')]=function(_0x16568b){return request(_0xb812('0x25'),{'body':_0x16568b});};exports[_0xb812('0x26')]=function(_0x4352e5){return request(_0xb812('0x27'),{'body':_0x4352e5});};exports[_0xb812('0x28')]=function(_0x4aa1bd){return request(_0xb812('0x29'),{'body':_['merge'](_0x4aa1bd,{'project_name':_0x4aa1bd[_0xb812('0x2a')],'prev_project_name':_0x4aa1bd['arg_2']||'','is_subproject':_0x4aa1bd['arg_2']?!![]:![],'leaveAt':moment()[_0xb812('0x2b')](_0xb812('0x2c'))})});};exports['createSquareRecording']=function(_0x4a74ff){return request(_0xb812('0x2d'),{'body':_0x4a74ff});};exports[_0xb812('0x2e')]=function(_0x506e8e){return request(_0xb812('0x2f'),{'body':_0x506e8e});};exports[_0xb812('0x30')]=function(_0x1a07cd){return request(_0xb812('0x31'),{'options':{'raw':![],'where':{'phone':_0x1a07cd[_0xb812('0x1b')],'ListId':_0x1a07cd['ListId']}}})[_0xb812('0x32')](function(_0x2cdff3){if(_0x2cdff3){return _0x2cdff3;}return request('CreateCmContact',{'body':_0x1a07cd});});};exports['getPauseById']=function(_0x4cca35){return request(_0xb812('0x33'),{'options':{'where':{'id':_0x4cca35},'attributes':[_0xb812('0xb')]}});};exports[_0xb812('0x34')]=function(_0x21cccf,_0x394212){return request(_0xb812('0x35'),{'body':{'interface':_0x394212},'options':{'where':_0x21cccf}});};exports[_0xb812('0x36')]=function(_0x4c7799,_0x5bcd49,_0x151331){return request(_0xb812('0x37'),{'body':{'type':_0x5bcd49,'uniqueid':_0x151331},'options':{'where':_0x4c7799}});};exports[_0xb812('0x38')]=function(_0x3ee1c7){return request(_0xb812('0x39'),{'body':{},'options':{'where':_0x3ee1c7}});};exports['agentLogout']=function(_0x3ac9c7){return request('LogoutUser',{'body':{},'options':{'where':_0x3ac9c7}});}; \ 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 d051294..d14f7bb 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 _0x29b7=['exports','./lex'];(function(_0x3ee545,_0x2c0466){var _0x1ca0b1=function(_0x5505e7){while(--_0x5505e7){_0x3ee545['push'](_0x3ee545['shift']());}};_0x1ca0b1(++_0x2c0466);}(_0x29b7,0x17d));var _0x729b=function(_0x3323f5,_0x4be49a){_0x3323f5=_0x3323f5-0x0;var _0xdad148=_0x29b7[_0x3323f5];return _0xdad148;};var polly=require('./polly');var lex=require(_0x729b('0x0'));module[_0x729b('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9f5a=['./polly','./lex','exports'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x9f5a,0xbd));var _0xa9f5=function(_0xfe72b4,_0x393b11){_0xfe72b4=_0xfe72b4-0x0;var _0x1c7b7d=_0x9f5a[_0xfe72b4];return _0x1c7b7d;};var polly=require(_0xa9f5('0x0'));var lex=require(_0xa9f5('0x1'));module[_0xa9f5('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 8dc7a1f..c2c905c 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['exports','./lib/api'];(function(_0x4c913c,_0x38d803){var _0x3a3762=function(_0x4862fd){while(--_0x4862fd){_0x4c913c['push'](_0x4c913c['shift']());}};_0x3a3762(++_0x38d803);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0xe5b5[_0x5ad771];return _0x5b5dce;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +var _0xf109=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf109,0xce));var _0x9f10=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xf109[_0x36ed3c];return _0x52a2e0;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ 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 58b4014..a5f2520 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(_0x57637b,_0x1bf46b){var _0x48eef0=function(_0x325aed){while(--_0x325aed){_0x57637b['push'](_0x57637b['shift']());}};_0x48eef0(++_0x1bf46b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x4d6e0d,_0x4fc605){var _0x3a3f47=function(_0x14a30d){while(--_0x14a30d){_0x4d6e0d['push'](_0x4d6e0d['shift']());}};_0x3a3f47(++_0x4fc605);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 6cd77df..d134b2b 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 _0x1025=['exports','./lib/api'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1025,0xd3));var _0x5102=function(_0x45ce4e,_0x3a367c){_0x45ce4e=_0x45ce4e-0x0;var _0x4a105a=_0x1025[_0x45ce4e];return _0x4a105a;};'use strict';var polly=require(_0x5102('0x0'));module[_0x5102('0x1')]=function(_0x111fba,_0x3edaaf,_0x468af9,_0x2cd837,_0xa5b16f,_0x4eb256,_0x18af29){return polly(_0x111fba,_0x3edaaf,_0x468af9,_0x2cd837,_0xa5b16f,_0x4eb256,_0x18af29);}; \ No newline at end of file +var _0xf639=['exports'];(function(_0x15f347,_0x118a99){var _0x257673=function(_0xaf720c){while(--_0xaf720c){_0x15f347['push'](_0x15f347['shift']());}};_0x257673(++_0x118a99);}(_0xf639,0x126));var _0x9f63=function(_0x4e4d5c,_0x25dd3a){_0x4e4d5c=_0x4e4d5c-0x0;var _0x56854a=_0xf639[_0x4e4d5c];return _0x56854a;};'use strict';var polly=require('./lib/api');module[_0x9f63('0x0')]=function(_0x52361f,_0x34801d,_0x41b483,_0x1c4f83,_0x1544fd,_0x4cb6c1,_0x3c53b7){return polly(_0x52361f,_0x34801d,_0x41b483,_0x1c4f83,_0x1544fd,_0x4cb6c1,_0x3c53b7);}; \ 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 42bf2f9..94ab577 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 _0xa742=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x1ebcf7,_0x5cc034){var _0x3463ab=function(_0x411747){while(--_0x411747){_0x1ebcf7['push'](_0x1ebcf7['shift']());}};_0x3463ab(++_0x5cc034);}(_0xa742,0x1e9));var _0x2a74=function(_0x965454,_0x559962){_0x965454=_0x965454-0x0;var _0x5be9e5=_0xa742[_0x965454];return _0x5be9e5;};'use strict';var fs=require('fs');var path=require(_0x2a74('0x0'));var BPromise=require(_0x2a74('0x1'));var rs=require(_0x2a74('0x2'));var AWS=require(_0x2a74('0x3'));function pollyResult(_0x2a5738,_0x531259,_0x349c37){return new BPromise(function(_0x331a9a,_0x12ffdc){_0x2a5738[_0x2a74('0x4')](_0x531259,function(_0x59223e,_0x484b3a){if(_0x59223e){_0x12ffdc(_0x59223e);}else if(_0x484b3a){if(_0x484b3a['AudioStream']instanceof Buffer){fs['writeFile'](_0x349c37,_0x484b3a[_0x2a74('0x5')],function(_0x33ed53){if(_0x33ed53){_0x12ffdc(_0x33ed53);}else{_0x331a9a();}});}else{_0x12ffdc(new Error(_0x2a74('0x6')));}}else{_0x12ffdc(new Error(_0x2a74('0x7')));}});});}module[_0x2a74('0x8')]=function(_0x3d5ca6,_0x4f9ca3,_0x1b3f7f,_0x33f476,_0x246445,_0x3db0df,_0x2adbff){var _0x46684c=new AWS[(_0x2a74('0x9'))]({'accessKeyId':_0x3d5ca6,'secretAccessKey':_0x4f9ca3,'region':_0x1b3f7f});var _0x25ceb={'Text':_0x246445,'TextType':_0x3db0df||_0x2a74('0xa'),'OutputFormat':_0x2a74('0xb'),'VoiceId':_0x33f476};return pollyResult(_0x46684c,_0x25ceb,_0x2adbff);}; \ No newline at end of file +var _0xce60=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xce60,0x150));var _0x0ce6=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xce60[_0x3df871];return _0x570f7b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x0ce6('0x0'));var rs=require(_0x0ce6('0x1'));var AWS=require(_0x0ce6('0x2'));function pollyResult(_0x2b7750,_0x3a770e,_0x3e8507){return new BPromise(function(_0x1b6d89,_0x325849){_0x2b7750[_0x0ce6('0x3')](_0x3a770e,function(_0xf60cbf,_0x258904){if(_0xf60cbf){_0x325849(_0xf60cbf);}else if(_0x258904){if(_0x258904[_0x0ce6('0x4')]instanceof Buffer){fs[_0x0ce6('0x5')](_0x3e8507,_0x258904[_0x0ce6('0x4')],function(_0x41c2b1){if(_0x41c2b1){_0x325849(_0x41c2b1);}else{_0x1b6d89();}});}else{_0x325849(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x325849(new Error(_0x0ce6('0x6')));}});});}module['exports']=function(_0x2106a3,_0x2628dc,_0x2227df,_0xc71374,_0x41db77,_0x5b8e0b,_0x2f4fde){var _0xbc7d20=new AWS[(_0x0ce6('0x7'))]({'accessKeyId':_0x2106a3,'secretAccessKey':_0x2628dc,'region':_0x2227df});var _0x3e8ed6={'Text':_0x41db77,'TextType':_0x5b8e0b||_0x0ce6('0x8'),'OutputFormat':_0x0ce6('0x9'),'VoiceId':_0xc71374};return pollyResult(_0xbc7d20,_0x3e8ed6,_0x2f4fde);}; \ 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 b39619f..417db4c 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x4a7ca8,_0x504435,_0x57fbc5,_0x1c762a){return asr(_0x4a7ca8,_0x504435,_0x57fbc5);}; \ No newline at end of file +var _0x9bac=['exports'];(function(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0x9bac,0xcc));var _0xc9ba=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9bac[_0x19e35c];return _0x3e1fe8;};'use strict';var asr=require('./lib/api');module[_0xc9ba('0x0')]=function(_0x38abb8,_0x17bb10,_0x4c802f,_0x16fc91){return asr(_0x38abb8,_0x17bb10,_0x4c802f);}; \ 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 5420a8e..612c6a8 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 _0x303a=['url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','LINEAR16','8000'];(function(_0x55502c,_0x41bd65){var _0x4664f2=function(_0x508434){while(--_0x508434){_0x55502c['push'](_0x55502c['shift']());}};_0x4664f2(++_0x41bd65);}(_0x303a,0x1a0));var _0xa303=function(_0x4b662d,_0x5b8058){_0x4b662d=_0x4b662d-0x0;var _0x3b9fd4=_0x303a[_0x4b662d];return _0x3b9fd4;};'use strict';var url=require(_0xa303('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xa303('0x1');module[_0xa303('0x2')]=function(_0x36e548,_0x19d27a,_0x594b49){return new BPromise(function(_0x46c56b,_0x26b47c){var _0x38a354;if(typeof _0x36e548!==_0xa303('0x3')||_0x36e548[_0xa303('0x4')]===0x0){return _0x26b47c(_0xa303('0x5'));}if(typeof _0x19d27a!==_0xa303('0x3')||_0x19d27a[_0xa303('0x4')]===0x0){return _0x26b47c(_0xa303('0x6'));}if(typeof _0x594b49!=='undefined'&&(typeof _0x594b49!=='string'||_0x594b49['length']===0x0)){return _0x26b47c(_0xa303('0x7'));}try{_0x38a354=fs[_0xa303('0x8')](_0x36e548)['toString'](_0xa303('0x9'));}catch(_0x51acca){return _0x26b47c(_0x51acca);}return _0x46c56b({'method':_0xa303('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x19d27a,'body':{'config':{'encoding':_0xa303('0xb'),'sampleRateHertz':_0xa303('0xc'),'languageCode':_0x594b49},'audio':{'content':_0x38a354}},'json':!![]});});}; \ No newline at end of file +var _0x5636=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','url','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5636,0x102));var _0x6563=function(_0x418001,_0x1e09d7){_0x418001=_0x418001-0x0;var _0x4d4270=_0x5636[_0x418001];return _0x4d4270;};'use strict';var url=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x579d5c,_0x44872c,_0x3a95f7){return new BPromise(function(_0x115cc1,_0x4ac653){var _0x166a58;if(typeof _0x579d5c!==_0x6563('0x2')||_0x579d5c[_0x6563('0x3')]===0x0){return _0x4ac653(_0x6563('0x4'));}if(typeof _0x44872c!==_0x6563('0x2')||_0x44872c[_0x6563('0x3')]===0x0){return _0x4ac653(_0x6563('0x5'));}if(typeof _0x3a95f7!==_0x6563('0x6')&&(typeof _0x3a95f7!==_0x6563('0x2')||_0x3a95f7[_0x6563('0x3')]===0x0)){return _0x4ac653(_0x6563('0x7'));}try{_0x166a58=fs[_0x6563('0x8')](_0x579d5c)[_0x6563('0x9')]('base64');}catch(_0x51fdc2){return _0x4ac653(_0x51fdc2);}return _0x115cc1({'method':_0x6563('0xa'),'uri':host+_0x6563('0xb')+_0x44872c,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a95f7},'audio':{'content':_0x166a58}},'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 b042137..10cb4be 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 _0x2329=['exports'];(function(_0x5bee54,_0x579acf){var _0x44a377=function(_0x302e38){while(--_0x302e38){_0x5bee54['push'](_0x5bee54['shift']());}};_0x44a377(++_0x579acf);}(_0x2329,0x122));var _0x9232=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2329[_0xa464c9];return _0x3d73c4;};var asr=require('./asr');module[_0x9232('0x0')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 052bae8..a22863b 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 _0x2caf=['randomstring','sox','url','parse','util','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','speech','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','isFallback','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise'];(function(_0x191261,_0x142ab4){var _0x3a8d43=function(_0x418335){while(--_0x418335){_0x191261['push'](_0x191261['shift']());}};_0x3a8d43(++_0x142ab4);}(_0x2caf,0x18c));var _0xf2ca=function(_0x5dbf5a,_0x4077b8){_0x5dbf5a=_0x5dbf5a-0x0;var _0xe6272a=_0x2caf[_0x5dbf5a];return _0xe6272a;};'use strict';var apiai=require(_0xf2ca('0x0'));var BPromise=require(_0xf2ca('0x1'));var dialogflow=require(_0xf2ca('0x2'));var fs=require('fs');var http=require(_0xf2ca('0x3'));var https=require(_0xf2ca('0x4'));var md5=require(_0xf2ca('0x5'));var path=require(_0xf2ca('0x6'));var querystring=require(_0xf2ca('0x7'));var rp=require(_0xf2ca('0x8'));var rs=require(_0xf2ca('0x9'));var sox=require(_0xf2ca('0xa'));var tts=require('google-tts-api');var urlParse=require(_0xf2ca('0xb'))[_0xf2ca('0xc')];var util=require(_0xf2ca('0xd'));var aws=require(_0xf2ca('0xe'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xf2ca('0xf'));var logger=require(_0xf2ca('0x10'))(_0xf2ca('0x11'));var ISPEECH_API=_0xf2ca('0x12');function downloadFile(_0x5303df,_0x4c4c74){return new BPromise(function(_0x29ff08,_0x2650fc){var _0x3e4f57=urlParse(_0x5303df);var _0x27a41c=_0x3e4f57['protocol']==='https:'?https:http;var _0x47ed68={'host':_0x3e4f57[_0xf2ca('0x13')],'path':_0x3e4f57[_0xf2ca('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x27a41c[_0xf2ca('0x14')](_0x47ed68,function(_0x5b7cea){if(_0x5b7cea[_0xf2ca('0x15')]!==0xc8){logger[_0xf2ca('0x16')](_0xf2ca('0x17')+_0x5303df+_0xf2ca('0x18')+_0x5b7cea[_0xf2ca('0x15')]+'\x20('+_0x5b7cea['statusMessage']+')');_0x2650fc(new Error(_0xf2ca('0x17')+_0x5303df+'\x20failed,\x20status\x20code\x20=\x20'+_0x5b7cea['statusCode']+'\x20('+_0x5b7cea[_0xf2ca('0x19')]+')'));return;}var _0x45d8d5=fs[_0xf2ca('0x1a')](_0x4c4c74);_0x45d8d5['on'](_0xf2ca('0x1b'),function(){logger[_0xf2ca('0x1c')]('finish\x20download\x20file');_0x45d8d5[_0xf2ca('0x1d')](_0x29ff08);});_0x45d8d5['on']('error',function(_0x11fb20){fs[_0xf2ca('0x1e')](_0x4c4c74);logger[_0xf2ca('0x16')](_0xf2ca('0x1f'),_0x11fb20);_0x2650fc(_0x11fb20);});_0x5b7cea[_0xf2ca('0x20')](_0x45d8d5);})['on'](_0xf2ca('0x16'),function(_0x1283ed){logger[_0xf2ca('0x16')](_0x1283ed);_0x2650fc(_0x1283ed);})[_0xf2ca('0x21')]();});}function uploadFile(_0x246991){return new BPromise(function(_0x32d5a0,_0x39e7e8){var _0x585d63=urlParse(_0x246991);var _0x417b65=_0x585d63[_0xf2ca('0x22')]===_0xf2ca('0x23')?https:http;var _0x298fb8={'host':_0x585d63[_0xf2ca('0x13')],'path':_0x585d63[_0xf2ca('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x417b65[_0xf2ca('0x14')](_0x298fb8,function(_0x1213be){if(_0x1213be['statusCode']!==0xc8){_0x39e7e8(new Error(_0xf2ca('0x17')+_0x246991+'\x20failed,\x20status\x20code\x20=\x20'+_0x1213be['statusCode']+'\x20('+_0x1213be[_0xf2ca('0x19')]+')'));return;}var _0x37513d='';_0x1213be['on'](_0xf2ca('0x24'),function(_0x3cbb2d){_0x37513d+=_0x3cbb2d;});_0x1213be['on'](_0xf2ca('0x21'),function(){_0x32d5a0(_0x37513d);});})['on'](_0xf2ca('0x16'),function(_0x3237f5){_0x39e7e8(_0x3237f5);})[_0xf2ca('0x21')]();});}function convertFile(_0x268a86,_0x550bd1){return new BPromise(function(_0x5d8aea,_0x517d4b){var _0x29faee=sox[_0xf2ca('0x25')](_0x268a86,_0x550bd1,{'sampleRate':0x1f40,'format':_0xf2ca('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29faee['on'](_0xf2ca('0x16'),function(_0x30166a){logger[_0xf2ca('0x16')](_0xf2ca('0x27'),_0x30166a);_0x517d4b(_0x30166a);});_0x29faee['on'](_0xf2ca('0x21'),function(){logger[_0xf2ca('0x1c')]('finish\x20to\x20convert');_0x5d8aea();});_0x29faee[_0xf2ca('0x28')]();});}function base64Decode(_0x5a8d0e,_0x539733){var _0x5ce23d=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x2c'));fs[_0xf2ca('0x2d')](_0x5ce23d,_0x5a8d0e,_0xf2ca('0x2e'));return convertFile(_0x5ce23d,_0x539733)[_0xf2ca('0x2f')](function(){try{fs[_0xf2ca('0x1e')](_0x5ce23d);fs[_0xf2ca('0x30')](_0x539733,_0xf2ca('0x31'));}catch(_0x5b2bb2){logger[_0xf2ca('0x16')](_0x5b2bb2);}return _0x539733[_0xf2ca('0x32')]('.')[0x0];});}function base64Encode(_0x266c35){var _0x4c1723=fs[_0xf2ca('0x33')](_0x266c35);return new Buffer(_0x4c1723)[_0xf2ca('0x34')](_0xf2ca('0x2e'));}exports['googleCloudTTS']=function(_0x1e0edf,_0xb2fb9c,_0x5ef4fe,_0x2e5c07,_0x2162fd,_0x430d3a){var _0x407221,_0x4525bf;var _0x2a4844=_0xf2ca('0x35');var _0x509be8=_0xf2ca('0x36')+_0x1e0edf;var _0x3a437a={};if(_0xb2fb9c===_0xf2ca('0x37')){_0x3a437a['input']={'ssml':_0x5ef4fe};}else{_0x3a437a['input']={'text':_0x5ef4fe};};_0x3a437a[_0xf2ca('0x38')]={'languageCode':_0x2e5c07,'ssmlGender':_0x2162fd};_0x3a437a[_0xf2ca('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5045c9={'url':_0x2a4844+_0xf2ca('0x3a')+_0x509be8,'method':_0xf2ca('0x3b'),'json':!![],'body':_0x3a437a};return rp(_0x5045c9)[_0xf2ca('0x2f')](function(_0x319ddf){return new BPromise(function(_0x328a5a,_0x4687a4){_0x407221=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x3c'));var _0x32293c=Buffer[_0xf2ca('0x3d')](_0x319ddf[_0xf2ca('0x3e')],_0xf2ca('0x2e'));return fs[_0xf2ca('0x3f')](_0x407221,_0x32293c,function(_0x44f809){_0x4687a4(_0x44f809);},function(_0x8e10aa){fs[_0xf2ca('0x30')](_0x407221,_0xf2ca('0x31'));_0x328a5a(_0x8e10aa);});});})[_0xf2ca('0x2f')](function(_0x112d9b){_0x4525bf=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+'.wav');return convertFile(_0x407221,_0x4525bf);})[_0xf2ca('0x2f')](function(){try{fs[_0xf2ca('0x1e')](_0x407221);fs[_0xf2ca('0x30')](_0x4525bf,_0xf2ca('0x31'));}catch(_0x3d9724){logger[_0xf2ca('0x16')](_0x3d9724);}logger['info'](_0xf2ca('0x40'),_0x4525bf[_0xf2ca('0x32')]('.')[0x0]);return _0x4525bf[_0xf2ca('0x32')]('.')[0x0];});};exports[_0xf2ca('0x41')]=function(_0x156364,_0x5c90e7){var _0x153a45=_0xf2ca('0x42');var _0x5e40f0,_0x4413bf;var _0x4e500b;var _0x398010={'encoding':_0xf2ca('0x43'),'method':_0xf2ca('0x3b'),'timeout':0x2710,'url':_0x153a45,'headers':{'Content-Type':_0xf2ca('0x44')},'body':_0xf2ca('0x45')+encodeURIComponent(JSON[_0xf2ca('0x46')]([[['jQ1olc',JSON[_0xf2ca('0x46')]([_0x156364,_0x5c90e7||'en',![],_0xf2ca('0x47')]),null,_0xf2ca('0x48')]]]))};return rp(_0x398010)['then'](function(_0x48f9e7){try{_0x4e500b=eval(_0x48f9e7['slice'](0x5))[0x0][0x2];}catch(_0x3c1ee2){throw new Error(_0xf2ca('0x49')+_0x48f9e7[_0xf2ca('0x24')]);}if(!_0x4e500b){if(_0x156364[_0xf2ca('0x4a')]>0xc8){throw new Error(_0xf2ca('0x4b'));}else{throw new Error('lang\x20\x22'+_0x5c90e7+'\x22\x20might\x20not\x20exist');}}try{_0x4e500b=eval(_0x4e500b)[0x0];}catch(_0x316e03){throw new Error(_0xf2ca('0x49')+res[_0xf2ca('0x24')]);}const _0x33516a=_0x4e500b;_0x5e40f0=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x3c'));fs[_0xf2ca('0x2d')](_0x5e40f0,_0x4e500b,{'encoding':_0xf2ca('0x2e')});_0x4413bf=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x2c'));return convertFile(_0x5e40f0,_0x4413bf);})[_0xf2ca('0x2f')](function(){try{fs[_0xf2ca('0x1e')](_0x5e40f0);fs[_0xf2ca('0x30')](_0x4413bf,_0xf2ca('0x31'));}catch(_0x42d973){logger[_0xf2ca('0x16')](_0x42d973);}logger[_0xf2ca('0x1c')](_0xf2ca('0x4c'),_0x4413bf[_0xf2ca('0x32')]('.')[0x0]);return _0x4413bf[_0xf2ca('0x32')]('.')[0x0];});};exports[_0xf2ca('0x4d')]=function(_0x23625a,_0x28dcd9,_0x416579){return google[_0xf2ca('0x4e')](_0x23625a,_0x28dcd9,_0x416579)[_0xf2ca('0x2f')](function(_0x3b269b){logger[_0xf2ca('0x1c')](_0x3b269b['uri']);return rp(_0x3b269b);})[_0xf2ca('0x2f')](function(_0x2032c6){var _0x5ff538='';var _0x2ef923=0x0;try{fs['unlink'](_0x23625a);}catch(_0x274f86){logger[_0xf2ca('0x16')](_0x274f86);}if(_0x2032c6&&_0x2032c6['results']){_0x5ff538=_0x2032c6[_0xf2ca('0x4f')][_0xf2ca('0x50')](function(_0x292720){return _0x292720&&_0x292720[_0xf2ca('0x51')][0x0]&&_0x292720[_0xf2ca('0x51')][0x0]['transcript']?_0x292720[_0xf2ca('0x51')][0x0][_0xf2ca('0x52')]:'';})[_0xf2ca('0x53')]('\x0a');_0x2ef923=_0x2032c6[_0xf2ca('0x4f')][_0xf2ca('0x50')](function(_0xcd0b36){return _0xcd0b36&&_0xcd0b36[_0xf2ca('0x51')][0x0]&&_0xcd0b36[_0xf2ca('0x51')][0x0][_0xf2ca('0x54')]?_0xcd0b36[_0xf2ca('0x51')][0x0][_0xf2ca('0x54')]:0x0;})[_0xf2ca('0x53')]('\x0a');}logger[_0xf2ca('0x1c')](_0xf2ca('0x55'),_0x5ff538);logger[_0xf2ca('0x1c')]('googleASR\x20confidence',_0x2ef923);return{'transcript':_0x5ff538,'confidence':_0x2ef923};})[_0xf2ca('0x56')](function(_0x5683ed){logger[_0xf2ca('0x16')](_0xf2ca('0x57'),_0x5683ed[_0xf2ca('0x15')],_0x5683ed['name'],_0x5683ed[_0xf2ca('0x58')]);});};exports[_0xf2ca('0x59')]=function(_0x59eff4,_0x4a50df,_0x2069e7,_0x2888ec){var _0xca1d9d=apiai(_0x4a50df,{'language':_0x2888ec||'en'});return _0xca1d9d['textRequest'](_0x2069e7,{'sessionId':md5(_0x59eff4)})['then'](function(_0x52b637){logger[_0xf2ca('0x1c')](JSON[_0xf2ca('0x46')](_0x52b637));return{'source':_0x52b637[_0xf2ca('0x5a')][_0xf2ca('0x5b')],'resolvedQuery':_0x52b637['result'][_0xf2ca('0x5c')],'action':_0x52b637[_0xf2ca('0x5a')][_0xf2ca('0x5d')],'actionIncomplete':_0x52b637['result'][_0xf2ca('0x5e')],'speech':_0x52b637[_0xf2ca('0x5a')]['fulfillment'][_0xf2ca('0x5f')],'score':_0x52b637[_0xf2ca('0x5a')]['score'],'statusCode':_0x52b637[_0xf2ca('0x60')][_0xf2ca('0x61')],'endConversation':_0x52b637[_0xf2ca('0x5a')][_0xf2ca('0x62')]['endConversation']||![],'isFallbackIntent':_0x52b637[_0xf2ca('0x5a')][_0xf2ca('0x62')][_0xf2ca('0x63')]};});};exports[_0xf2ca('0x64')]=function(_0x49438f,_0x89d974,_0x4c9cb7,_0x3378ad,_0x540271,_0x44f6bd){var _0x58e913=_0x3378ad[_0xf2ca('0x65')](/\\n/g,'\x0a');var _0x358a7b={'credentials':{'private_key':_0x58e913,'client_email':_0x4c9cb7}};var _0x2b09b9=new dialogflow[(_0xf2ca('0x66'))](_0x358a7b);var _0x5cb3ff=_0x2b09b9[_0xf2ca('0x67')](_0x89d974,md5(_0x49438f));var _0x117e06={'session':_0x5cb3ff,'queryInput':{'text':{'text':_0x540271,'languageCode':_0x44f6bd}}};return _0x2b09b9[_0xf2ca('0x68')](_0x117e06)[_0xf2ca('0x2f')](function(_0x3198bd){if(_0x3198bd&&_0x3198bd[_0xf2ca('0x4a')]){logger[_0xf2ca('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x3198bd));var _0x1e8175=_0x3198bd[0x0];if(_0x1e8175){var _0x22833c={'action':_0x1e8175['queryResult']['action'],'allRequiredParamsPresent':_0x1e8175[_0xf2ca('0x69')][_0xf2ca('0x6a')],'endConversation':_0x1e8175['queryResult']['diagnosticInfo']&&_0x1e8175['queryResult'][_0xf2ca('0x6b')]['fields']?_0x1e8175['queryResult'][_0xf2ca('0x6b')][_0xf2ca('0x6c')][_0xf2ca('0x6d')][_0xf2ca('0x6e')]:![],'fulfillmentText':_0x1e8175[_0xf2ca('0x69')][_0xf2ca('0x6f')],'intentName':_0x1e8175[_0xf2ca('0x69')][_0xf2ca('0x70')][_0xf2ca('0x71')],'intentDisplayName':_0x1e8175[_0xf2ca('0x69')]['intent']['displayName'],'isFallbackIntent':_0x1e8175[_0xf2ca('0x69')][_0xf2ca('0x70')][_0xf2ca('0x72')],'languageCode':_0x1e8175[_0xf2ca('0x69')]['languageCode'],'queryText':_0x1e8175['queryResult'][_0xf2ca('0x73')],'responseId':_0x1e8175[_0xf2ca('0x74')],'score':_0x1e8175[_0xf2ca('0x69')][_0xf2ca('0x75')],'speech':_0x1e8175[_0xf2ca('0x69')]['fulfillmentText'],'providerResponse':JSON[_0xf2ca('0x46')](_0x3198bd)};return _0x22833c;}}});};exports['tildeASR']=function(_0x5cef4c,_0x3e8a6a,_0x5f55dc,_0x566e7a){return tilde[_0xf2ca('0x4e')](_0x5cef4c,_0x3e8a6a,_0x5f55dc,_0x566e7a)[_0xf2ca('0x2f')](function(_0x1057f5){try{fs[_0xf2ca('0x1e')](_0x5cef4c);}catch(_0x2e2274){logger[_0xf2ca('0x16')](_0x2e2274);}logger[_0xf2ca('0x1c')]('Tilde\x20ASR\x20transcription',_0x1057f5[_0xf2ca('0x52')]);logger[_0xf2ca('0x1c')](_0xf2ca('0x76'),_0x1057f5[_0xf2ca('0x54')]);return _0x1057f5;});};exports['awsPolly']=function(_0x5dbff5,_0x46a591,_0x281b03,_0x530fd6,_0x59bdc3,_0x4e27b5){var _0x4869d0=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x3c'));var _0x445586;return aws[_0xf2ca('0x77')](_0x5dbff5,_0x46a591,_0x281b03,_0x530fd6,_0x59bdc3,_0x4e27b5,_0x4869d0)[_0xf2ca('0x2f')](function(){_0x445586=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x2c'));return convertFile(_0x4869d0,_0x445586);})[_0xf2ca('0x2f')](function(){try{fs['unlink'](_0x4869d0);fs['chmodSync'](_0x445586,_0xf2ca('0x31'));}catch(_0x447d6d){logger[_0xf2ca('0x16')](_0x447d6d);}return _0x445586[_0xf2ca('0x32')]('.')[0x0];});};exports[_0xf2ca('0x78')]=function(_0xd21199,_0x4cfe65,_0x58eaf7,_0x15fc49,_0x36b53b,_0x291338){return aws[_0xf2ca('0x79')](_0xd21199,_0x4cfe65,_0x58eaf7,_0x15fc49,_0x36b53b,_0x291338)[_0xf2ca('0x2f')](function(_0x2ebd3b){logger['info'](JSON[_0xf2ca('0x46')](_0x2ebd3b));return _0x2ebd3b;});};exports[_0xf2ca('0x7a')]=function(_0x3ab3b0,_0x772cf,_0x874b51,_0x2bd583){var _0x3b4485=util[_0xf2ca('0x7b')](_0xf2ca('0x7c'),ISPEECH_API,_0x3ab3b0,encodeURIComponent(_0x772cf),_0x874b51,_0x2bd583);var _0x204789=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+_0xf2ca('0x3c'));var _0x5b7b46;return downloadFile(_0x3b4485,_0x204789)['then'](function(){_0x5b7b46=path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs['generate'](0x4)+_0xf2ca('0x2c'));return convertFile(_0x204789,_0x5b7b46);})[_0xf2ca('0x2f')](function(){try{fs[_0xf2ca('0x1e')](_0x204789);fs[_0xf2ca('0x30')](_0x5b7b46,_0xf2ca('0x31'));}catch(_0x18c1be){logger[_0xf2ca('0x16')](_0x18c1be);}return _0x5b7b46[_0xf2ca('0x32')]('.')[0x0];});};exports[_0xf2ca('0x7d')]=function(_0x26e390,_0x54f011,_0x1b9da2,_0x4383f0){var _0x10c8d3=util[_0xf2ca('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x54f011,_0x1b9da2,base64Encode(_0x26e390),_0x4383f0?util['format'](_0xf2ca('0x7e'),encodeURIComponent(_0x4383f0)):_0xf2ca('0x7f'));return uploadFile(_0x10c8d3)[_0xf2ca('0x2f')](function(_0x3f180f){return querystring[_0xf2ca('0xc')](_0x3f180f);});};exports['sestekNDA']=function(_0x41abc3,_0x460ad9){return sestek[_0xf2ca('0x80')](_0x41abc3,_0x460ad9)[_0xf2ca('0x2f')](function(_0x32d801){logger[_0xf2ca('0x1c')](JSON[_0xf2ca('0x46')](_0x32d801));var _0xb2b0f4={'speech':_0x32d801[_0xf2ca('0x81')],'action':_0x32d801[_0xf2ca('0x82')]?_0x32d801['channelData'][_0xf2ca('0x83')]:undefined,'actiondata':_0x32d801[_0xf2ca('0x82')]?_0x32d801[_0xf2ca('0x82')][_0xf2ca('0x84')]:undefined};if(_0x32d801[_0xf2ca('0x82')]&&_0x32d801[_0xf2ca('0x82')][_0xf2ca('0x85')]){return base64Decode(_0x32d801[_0xf2ca('0x82')][_0xf2ca('0x85')][_0xf2ca('0x86')],path[_0xf2ca('0x29')](__dirname,_0xf2ca('0x2a'),rs[_0xf2ca('0x2b')](0x4)+'.wav'))[_0xf2ca('0x2f')](function(_0x43fe5e){_0xb2b0f4['audiofile']=_0x43fe5e;return _0xb2b0f4;});}return _0xb2b0f4;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x161e=['info','close','unlink','download\x20error','pipe','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','asr','uri','results','map','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20confidence','awsPolly','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','./aws','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','statusMessage','finish'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x161e,0x16b));var _0xe161=function(_0x47e504,_0xcebaea){_0x47e504=_0x47e504-0x0;var _0x43a953=_0x161e[_0x47e504];return _0x43a953;};'use strict';var apiai=require(_0xe161('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xe161('0x1'));var fs=require('fs');var http=require(_0xe161('0x2'));var https=require(_0xe161('0x3'));var md5=require('md5');var path=require(_0xe161('0x4'));var querystring=require(_0xe161('0x5'));var rp=require(_0xe161('0x6'));var rs=require(_0xe161('0x7'));var sox=require(_0xe161('0x8'));var tts=require(_0xe161('0x9'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0xe161('0xa'));var google=require('./google');var sestek=require(_0xe161('0xb'));var tilde=require(_0xe161('0xc'));var logger=require(_0xe161('0xd'))('agi');var ISPEECH_API=_0xe161('0xe');function downloadFile(_0x112650,_0x1c4ffb){return new BPromise(function(_0x579041,_0x50d952){var _0x15202a=urlParse(_0x112650);var _0x1f2124=_0x15202a[_0xe161('0xf')]===_0xe161('0x10')?https:http;var _0x55bece={'host':_0x15202a[_0xe161('0x11')],'path':_0x15202a[_0xe161('0x4')],'headers':{'user-agent':_0xe161('0x12')}};_0x1f2124['get'](_0x55bece,function(_0x455136){if(_0x455136[_0xe161('0x13')]!==0xc8){logger[_0xe161('0x14')](_0xe161('0x15')+_0x112650+'\x20failed,\x20status\x20code\x20=\x20'+_0x455136[_0xe161('0x13')]+'\x20('+_0x455136[_0xe161('0x16')]+')');_0x50d952(new Error('request\x20to\x20'+_0x112650+'\x20failed,\x20status\x20code\x20=\x20'+_0x455136[_0xe161('0x13')]+'\x20('+_0x455136[_0xe161('0x16')]+')'));return;}var _0x4f8f00=fs['createWriteStream'](_0x1c4ffb);_0x4f8f00['on'](_0xe161('0x17'),function(){logger[_0xe161('0x18')]('finish\x20download\x20file');_0x4f8f00[_0xe161('0x19')](_0x579041);});_0x4f8f00['on']('error',function(_0x130e55){fs[_0xe161('0x1a')](_0x1c4ffb);logger[_0xe161('0x14')](_0xe161('0x1b'),_0x130e55);_0x50d952(_0x130e55);});_0x455136[_0xe161('0x1c')](_0x4f8f00);})['on'](_0xe161('0x14'),function(_0x12c981){logger[_0xe161('0x14')](_0x12c981);_0x50d952(_0x12c981);})[_0xe161('0x1d')]();});}function uploadFile(_0x4596c3){return new BPromise(function(_0x3129c5,_0x17d79b){var _0x11bf38=urlParse(_0x4596c3);var _0x2c050d=_0x11bf38[_0xe161('0xf')]===_0xe161('0x10')?https:http;var _0x3557f6={'host':_0x11bf38['host'],'path':_0x11bf38[_0xe161('0x4')],'headers':{'user-agent':_0xe161('0x12')}};_0x2c050d['get'](_0x3557f6,function(_0x2fce5b){if(_0x2fce5b[_0xe161('0x13')]!==0xc8){_0x17d79b(new Error(_0xe161('0x15')+_0x4596c3+'\x20failed,\x20status\x20code\x20=\x20'+_0x2fce5b['statusCode']+'\x20('+_0x2fce5b['statusMessage']+')'));return;}var _0x270d52='';_0x2fce5b['on'](_0xe161('0x1e'),function(_0x4983a1){_0x270d52+=_0x4983a1;});_0x2fce5b['on']('end',function(){_0x3129c5(_0x270d52);});})['on'](_0xe161('0x14'),function(_0x969b0f){_0x17d79b(_0x969b0f);})[_0xe161('0x1d')]();});}function convertFile(_0x280ec6,_0x4c9f95){return new BPromise(function(_0x3cf505,_0x1fe6be){var _0x167655=sox['transcode'](_0x280ec6,_0x4c9f95,{'sampleRate':0x1f40,'format':_0xe161('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x167655['on'](_0xe161('0x14'),function(_0x42aab4){logger[_0xe161('0x14')](_0xe161('0x20'),_0x42aab4);_0x1fe6be(_0x42aab4);});_0x167655['on']('end',function(){logger[_0xe161('0x18')](_0xe161('0x21'));_0x3cf505();});_0x167655[_0xe161('0x22')]();});}function base64Decode(_0x5a23bf,_0x116da4){var _0x1999f5=path[_0xe161('0x23')](__dirname,_0xe161('0x24'),rs['generate'](0x4)+_0xe161('0x25'));fs[_0xe161('0x26')](_0x1999f5,_0x5a23bf,_0xe161('0x27'));return convertFile(_0x1999f5,_0x116da4)[_0xe161('0x28')](function(){try{fs[_0xe161('0x1a')](_0x1999f5);fs['chmodSync'](_0x116da4,_0xe161('0x29'));}catch(_0x347e9a){logger[_0xe161('0x14')](_0x347e9a);}return _0x116da4[_0xe161('0x2a')]('.')[0x0];});}function base64Encode(_0x44d3b5){var _0x1e14be=fs[_0xe161('0x2b')](_0x44d3b5);return new Buffer(_0x1e14be)['toString']('base64');}exports[_0xe161('0x2c')]=function(_0x4a5a9c,_0x3a2283,_0x3750b9,_0x428250,_0xdaae02,_0xe6f673){var _0x2f3507,_0x24ef82;var _0x3188e8=_0xe161('0x2d');var _0x280ad6=_0xe161('0x2e')+_0x4a5a9c;var _0x43eed2={};if(_0x3a2283===_0xe161('0x2f')){_0x43eed2[_0xe161('0x30')]={'ssml':_0x3750b9};}else{_0x43eed2['input']={'text':_0x3750b9};};_0x43eed2[_0xe161('0x31')]={'languageCode':_0x428250,'ssmlGender':_0xdaae02};_0x43eed2[_0xe161('0x32')]={'audioEncoding':_0xe161('0x33'),'sampleRateHertz':0x1f40};var _0x48b8e0={'url':_0x3188e8+_0xe161('0x34')+_0x280ad6,'method':_0xe161('0x35'),'json':!![],'body':_0x43eed2};return rp(_0x48b8e0)[_0xe161('0x28')](function(_0x24d27e){return new BPromise(function(_0xecedb2,_0x404166){_0x2f3507=path[_0xe161('0x23')](__dirname,_0xe161('0x24'),rs[_0xe161('0x36')](0x4)+_0xe161('0x37'));var _0x32ba00=Buffer[_0xe161('0x38')](_0x24d27e[_0xe161('0x39')],'base64');return fs[_0xe161('0x3a')](_0x2f3507,_0x32ba00,function(_0x5589b6){_0x404166(_0x5589b6);},function(_0x470288){fs[_0xe161('0x3b')](_0x2f3507,_0xe161('0x29'));_0xecedb2(_0x470288);});});})[_0xe161('0x28')](function(_0x3d177f){_0x24ef82=path['resolve'](__dirname,'tmp',rs[_0xe161('0x36')](0x4)+'.wav');return convertFile(_0x2f3507,_0x24ef82);})['then'](function(){try{fs[_0xe161('0x1a')](_0x2f3507);fs[_0xe161('0x3b')](_0x24ef82,'777');}catch(_0x27f8aa){logger[_0xe161('0x14')](_0x27f8aa);}logger[_0xe161('0x18')]('googleCloudTTS\x20path',_0x24ef82[_0xe161('0x2a')]('.')[0x0]);return _0x24ef82[_0xe161('0x2a')]('.')[0x0];});};exports[_0xe161('0x3c')]=function(_0x4899a3,_0x33bcd7){var _0x2208d2=_0xe161('0x3d');var _0x598dd7,_0x16c581;var _0x5dd8c3;var _0x928d6a={'encoding':_0xe161('0x3e'),'method':_0xe161('0x35'),'timeout':0x2710,'url':_0x2208d2,'headers':{'Content-Type':_0xe161('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0xe161('0x40')]([[[_0xe161('0x41'),JSON[_0xe161('0x40')]([_0x4899a3,_0x33bcd7||'en',![],_0xe161('0x42')]),null,_0xe161('0x43')]]]))};return rp(_0x928d6a)['then'](function(_0x16fa74){try{_0x5dd8c3=eval(_0x16fa74[_0xe161('0x44')](0x5))[0x0][0x2];}catch(_0x37a6aa){throw new Error(_0xe161('0x45')+_0x16fa74[_0xe161('0x1e')]);}if(!_0x5dd8c3){if(_0x4899a3[_0xe161('0x46')]>0xc8){throw new Error(_0xe161('0x47'));}else{throw new Error(_0xe161('0x48')+_0x33bcd7+_0xe161('0x49'));}}try{_0x5dd8c3=eval(_0x5dd8c3)[0x0];}catch(_0x41aacc){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe161('0x1e')]);}const _0x580214=_0x5dd8c3;_0x598dd7=path[_0xe161('0x23')](__dirname,'tmp',rs[_0xe161('0x36')](0x4)+_0xe161('0x37'));fs[_0xe161('0x26')](_0x598dd7,_0x5dd8c3,{'encoding':_0xe161('0x27')});_0x16c581=path[_0xe161('0x23')](__dirname,'tmp',rs[_0xe161('0x36')](0x4)+_0xe161('0x25'));return convertFile(_0x598dd7,_0x16c581);})[_0xe161('0x28')](function(){try{fs[_0xe161('0x1a')](_0x598dd7);fs[_0xe161('0x3b')](_0x16c581,'777');}catch(_0x1955d3){logger[_0xe161('0x14')](_0x1955d3);}logger[_0xe161('0x18')]('goggleTTS\x20path',_0x16c581[_0xe161('0x2a')]('.')[0x0]);return _0x16c581[_0xe161('0x2a')]('.')[0x0];});};exports['googleASR']=function(_0x3eb48e,_0x4ea3dd,_0x106719){return google[_0xe161('0x4a')](_0x3eb48e,_0x4ea3dd,_0x106719)[_0xe161('0x28')](function(_0x11a941){logger[_0xe161('0x18')](_0x11a941[_0xe161('0x4b')]);return rp(_0x11a941);})['then'](function(_0x9b8172){var _0x3db22d='';var _0x5524e1=0x0;try{fs[_0xe161('0x1a')](_0x3eb48e);}catch(_0x1bf91d){logger[_0xe161('0x14')](_0x1bf91d);}if(_0x9b8172&&_0x9b8172[_0xe161('0x4c')]){_0x3db22d=_0x9b8172['results'][_0xe161('0x4d')](function(_0x11d6e5){return _0x11d6e5&&_0x11d6e5[_0xe161('0x4e')][0x0]&&_0x11d6e5[_0xe161('0x4e')][0x0]['transcript']?_0x11d6e5['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x5524e1=_0x9b8172['results'][_0xe161('0x4d')](function(_0x20dcc9){return _0x20dcc9&&_0x20dcc9[_0xe161('0x4e')][0x0]&&_0x20dcc9[_0xe161('0x4e')][0x0][_0xe161('0x4f')]?_0x20dcc9[_0xe161('0x4e')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xe161('0x18')](_0xe161('0x50'),_0x3db22d);logger[_0xe161('0x18')](_0xe161('0x51'),_0x5524e1);return{'transcript':_0x3db22d,'confidence':_0x5524e1};})[_0xe161('0x52')](function(_0x4d1880){logger[_0xe161('0x14')]('[%s]\x20%s:%s',_0x4d1880[_0xe161('0x13')],_0x4d1880[_0xe161('0x53')],_0x4d1880[_0xe161('0x54')]);});};exports[_0xe161('0x55')]=function(_0x35d8e5,_0x29966d,_0x25629e,_0x3a1055){var _0x50d396=apiai(_0x29966d,{'language':_0x3a1055||'en'});return _0x50d396[_0xe161('0x56')](_0x25629e,{'sessionId':md5(_0x35d8e5)})[_0xe161('0x28')](function(_0x28f0df){logger[_0xe161('0x18')](JSON[_0xe161('0x40')](_0x28f0df));return{'source':_0x28f0df[_0xe161('0x57')][_0xe161('0x58')],'resolvedQuery':_0x28f0df[_0xe161('0x57')][_0xe161('0x59')],'action':_0x28f0df[_0xe161('0x57')][_0xe161('0x5a')],'actionIncomplete':_0x28f0df[_0xe161('0x57')][_0xe161('0x5b')],'speech':_0x28f0df[_0xe161('0x57')][_0xe161('0x5c')][_0xe161('0x5d')],'score':_0x28f0df[_0xe161('0x57')][_0xe161('0x5e')],'statusCode':_0x28f0df[_0xe161('0x5f')][_0xe161('0x60')],'endConversation':_0x28f0df['result'][_0xe161('0x61')][_0xe161('0x62')]||![],'isFallbackIntent':_0x28f0df['result']['metadata'][_0xe161('0x63')]};});};exports[_0xe161('0x64')]=function(_0x420f10,_0x1e4295,_0x55dc84,_0x7f0e20,_0xe002eb,_0x5316f8){var _0x3550fd=_0x7f0e20[_0xe161('0x65')](/\\n/g,'\x0a');var _0x560da6={'credentials':{'private_key':_0x3550fd,'client_email':_0x55dc84}};var _0x4850e6=new dialogflow[(_0xe161('0x66'))](_0x560da6);var _0xb8a9ed=_0x4850e6[_0xe161('0x67')](_0x1e4295,md5(_0x420f10));var _0x417c23={'session':_0xb8a9ed,'queryInput':{'text':{'text':_0xe002eb,'languageCode':_0x5316f8}}};return _0x4850e6['detectIntent'](_0x417c23)[_0xe161('0x28')](function(_0x2d7e89){if(_0x2d7e89&&_0x2d7e89[_0xe161('0x46')]){logger['info'](_0xe161('0x68'),JSON['stringify'](_0x2d7e89));var _0x33dbb8=_0x2d7e89[0x0];if(_0x33dbb8){var _0x5656f7={'action':_0x33dbb8[_0xe161('0x69')][_0xe161('0x5a')],'allRequiredParamsPresent':_0x33dbb8[_0xe161('0x69')]['allRequiredParamsPresent'],'endConversation':_0x33dbb8[_0xe161('0x69')]['diagnosticInfo']&&_0x33dbb8[_0xe161('0x69')][_0xe161('0x6a')][_0xe161('0x6b')]?_0x33dbb8[_0xe161('0x69')][_0xe161('0x6a')][_0xe161('0x6b')]['end_conversation'][_0xe161('0x6c')]:![],'fulfillmentText':_0x33dbb8['queryResult']['fulfillmentText'],'intentName':_0x33dbb8['queryResult']['intent'][_0xe161('0x53')],'intentDisplayName':_0x33dbb8['queryResult'][_0xe161('0x6d')][_0xe161('0x6e')],'isFallbackIntent':_0x33dbb8[_0xe161('0x69')][_0xe161('0x6d')][_0xe161('0x6f')],'languageCode':_0x33dbb8[_0xe161('0x69')]['languageCode'],'queryText':_0x33dbb8[_0xe161('0x69')][_0xe161('0x70')],'responseId':_0x33dbb8[_0xe161('0x71')],'score':_0x33dbb8[_0xe161('0x69')][_0xe161('0x72')],'speech':_0x33dbb8['queryResult'][_0xe161('0x73')],'providerResponse':JSON[_0xe161('0x40')](_0x2d7e89)};return _0x5656f7;}}});};exports['tildeASR']=function(_0x4ff610,_0x5b196e,_0x49c53f,_0x4a113c){return tilde[_0xe161('0x4a')](_0x4ff610,_0x5b196e,_0x49c53f,_0x4a113c)['then'](function(_0x2536da){try{fs['unlink'](_0x4ff610);}catch(_0x1690e9){logger[_0xe161('0x14')](_0x1690e9);}logger[_0xe161('0x18')]('Tilde\x20ASR\x20transcription',_0x2536da['transcript']);logger[_0xe161('0x18')](_0xe161('0x74'),_0x2536da['confidence']);return _0x2536da;});};exports[_0xe161('0x75')]=function(_0xa0b06b,_0x30d9cd,_0x4a7819,_0x4d2cff,_0x22e8ef,_0x45e1a3){var _0x14a15a=path[_0xe161('0x23')](__dirname,_0xe161('0x24'),rs['generate'](0x4)+_0xe161('0x37'));var _0x598245;return aws['polly'](_0xa0b06b,_0x30d9cd,_0x4a7819,_0x4d2cff,_0x22e8ef,_0x45e1a3,_0x14a15a)[_0xe161('0x28')](function(){_0x598245=path[_0xe161('0x23')](__dirname,_0xe161('0x24'),rs[_0xe161('0x36')](0x4)+'.wav');return convertFile(_0x14a15a,_0x598245);})[_0xe161('0x28')](function(){try{fs[_0xe161('0x1a')](_0x14a15a);fs[_0xe161('0x3b')](_0x598245,_0xe161('0x29'));}catch(_0x47faa8){logger[_0xe161('0x14')](_0x47faa8);}return _0x598245[_0xe161('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x428bad,_0x402830,_0x1f522e,_0x35d735,_0x15f481,_0x57ed3e){return aws['lex'](_0x428bad,_0x402830,_0x1f522e,_0x35d735,_0x15f481,_0x57ed3e)[_0xe161('0x28')](function(_0x265e2d){logger[_0xe161('0x18')](JSON[_0xe161('0x40')](_0x265e2d));return _0x265e2d;});};exports['ispeechTTS']=function(_0x4e8a1a,_0x4d3c66,_0x3d458f,_0x1093be){var _0x5e0172=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4e8a1a,encodeURIComponent(_0x4d3c66),_0x3d458f,_0x1093be);var _0x2929c3=path['resolve'](__dirname,_0xe161('0x24'),rs[_0xe161('0x36')](0x4)+'.mp3');var _0x5ee453;return downloadFile(_0x5e0172,_0x2929c3)[_0xe161('0x28')](function(){_0x5ee453=path['resolve'](__dirname,_0xe161('0x24'),rs[_0xe161('0x36')](0x4)+_0xe161('0x25'));return convertFile(_0x2929c3,_0x5ee453);})[_0xe161('0x28')](function(){try{fs['unlink'](_0x2929c3);fs[_0xe161('0x3b')](_0x5ee453,'777');}catch(_0x37f9b8){logger[_0xe161('0x14')](_0x37f9b8);}return _0x5ee453['split']('.')[0x0];});};exports[_0xe161('0x76')]=function(_0x315ab6,_0x279e68,_0x5c504e,_0x239c78){var _0x4e07d7=util[_0xe161('0x77')](_0xe161('0x78'),ISPEECH_API,_0x279e68,_0x5c504e,base64Encode(_0x315ab6),_0x239c78?util[_0xe161('0x77')]('model=%s',encodeURIComponent(_0x239c78)):_0xe161('0x79'));return uploadFile(_0x4e07d7)[_0xe161('0x28')](function(_0x235f32){return querystring['parse'](_0x235f32);});};exports['sestekNDA']=function(_0x4ed5a1,_0x37e8be){return sestek[_0xe161('0x7a')](_0x4ed5a1,_0x37e8be)[_0xe161('0x28')](function(_0x2c7607){logger[_0xe161('0x18')](JSON['stringify'](_0x2c7607));var _0x520a0a={'speech':_0x2c7607[_0xe161('0x7b')],'action':_0x2c7607[_0xe161('0x7c')]?_0x2c7607[_0xe161('0x7c')][_0xe161('0x7d')]:undefined,'actiondata':_0x2c7607['channelData']?_0x2c7607[_0xe161('0x7c')]['CustomActionData']:undefined};if(_0x2c7607[_0xe161('0x7c')]&&_0x2c7607[_0xe161('0x7c')][_0xe161('0x7e')]){return base64Decode(_0x2c7607[_0xe161('0x7c')][_0xe161('0x7e')][_0xe161('0x7f')],path[_0xe161('0x23')](__dirname,_0xe161('0x24'),rs[_0xe161('0x36')](0x4)+_0xe161('0x25')))[_0xe161('0x28')](function(_0x1f1714){_0x520a0a['audiofile']=_0x1f1714;return _0x520a0a;});}return _0x520a0a;});};exports[_0xe161('0x80')]=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 e27a8d2..8f34e03 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 _0x01b5=['exports','./nda'];(function(_0x35bdcf,_0x21421c){var _0x5a4fc7=function(_0x374f22){while(--_0x374f22){_0x35bdcf['push'](_0x35bdcf['shift']());}};_0x5a4fc7(++_0x21421c);}(_0x01b5,0xc5));var _0x501b=function(_0x37fc9e,_0x4ac02d){_0x37fc9e=_0x37fc9e-0x0;var _0x5d8709=_0x01b5[_0x37fc9e];return _0x5d8709;};var nda=require(_0x501b('0x0'));module[_0x501b('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'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 f7cda85..e3a9bd9 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 _0xbc4a=['stringify','request-promise','url','../../../../../config/logger','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info'];(function(_0x10278d,_0x46cd70){var _0x3e113c=function(_0x2704dc){while(--_0x2704dc){_0x10278d['push'](_0x10278d['shift']());}};_0x3e113c(++_0x46cd70);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x5a51da,_0x193adc){_0x5a51da=_0x5a51da-0x0;var _0x10bc4d=_0xbc4a[_0x5a51da];return _0x10bc4d;};'use strict';var rp=require(_0xabc4('0x0'));var url=require(_0xabc4('0x1'));var logger=require(_0xabc4('0x2'))('agi');module['exports']=function(_0x4d2996,_0x4fc0f9){var _0x55eb1b={'method':_0xabc4('0x3'),'uri':url['resolve'](_0x4fc0f9[_0xabc4('0x4')],_0xabc4('0x5')),'form':{'grant_type':_0xabc4('0x6'),'username':_0x4fc0f9[_0xabc4('0x7')],'password':_0x4fc0f9[_0xabc4('0x6')]},'json':!![]};return rp(_0x55eb1b)[_0xabc4('0x8')](function(_0x244a46){var _0x28ea0b={'method':_0xabc4('0x3'),'uri':url[_0xabc4('0x9')](_0x4fc0f9[_0xabc4('0xa')],_0xabc4('0xb')),'body':{'type':_0x4fc0f9[_0xabc4('0xc')]||_0xabc4('0xd'),'channelId':_0xabc4('0xe'),'conversation':{'id':_0x4d2996[_0xabc4('0xf')]},'from':{'id':_0x4d2996[_0xabc4('0x10')],'name':_0x4d2996[_0xabc4('0x11')]},'recipient':{'id':_0x4d2996[_0xabc4('0x12')],'name':_0x4d2996[_0xabc4('0x13')]},'text':_0x4fc0f9[_0xabc4('0x14')],'channelData':{}},'headers':{'Authorization':_0xabc4('0x15')+_0x244a46[_0xabc4('0x16')]},'json':!![]};if(_0x4fc0f9[_0xabc4('0x17')]){_0x28ea0b[_0xabc4('0x18')][_0xabc4('0x19')][_0xabc4('0x1a')]=_0x4fc0f9['project'];}if(_0x4fc0f9[_0xabc4('0x1b')]=='1'){_0x28ea0b[_0xabc4('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xabc4('0x1c')};}if(_0x4fc0f9[_0xabc4('0x1d')]){_0x28ea0b[_0xabc4('0x18')]['channelData']['CustomAction']=_0x4fc0f9['custom_action'];if(_0x4fc0f9[_0xabc4('0x1e')]){_0x28ea0b[_0xabc4('0x18')][_0xabc4('0x19')][_0xabc4('0x1f')]=_0x4fc0f9[_0xabc4('0x1e')];}}logger[_0xabc4('0x20')](JSON[_0xabc4('0x21')](_0x28ea0b));return rp(_0x28ea0b);});}; \ No newline at end of file +var _0x3fb7=['channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomActionData','info','stringify','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','project','body'];(function(_0x2b76ba,_0xd18039){var _0x1d3fd5=function(_0x293188){while(--_0x293188){_0x2b76ba['push'](_0x2b76ba['shift']());}};_0x1d3fd5(++_0xd18039);}(_0x3fb7,0x189));var _0x73fb=function(_0x3315b6,_0x3beedc){_0x3315b6=_0x3315b6-0x0;var _0x2c2599=_0x3fb7[_0x3315b6];return _0x2c2599;};'use strict';var rp=require('request-promise');var url=require(_0x73fb('0x0'));var logger=require('../../../../../config/logger')(_0x73fb('0x1'));module[_0x73fb('0x2')]=function(_0x4e9e05,_0xdecce4){var _0x58f523={'method':_0x73fb('0x3'),'uri':url[_0x73fb('0x4')](_0xdecce4[_0x73fb('0x5')],_0x73fb('0x6')),'form':{'grant_type':_0x73fb('0x7'),'username':_0xdecce4[_0x73fb('0x8')],'password':_0xdecce4[_0x73fb('0x7')]},'json':!![]};return rp(_0x58f523)[_0x73fb('0x9')](function(_0x1455de){var _0x2413ee={'method':_0x73fb('0x3'),'uri':url[_0x73fb('0x4')](_0xdecce4[_0x73fb('0xa')],_0x73fb('0xb')),'body':{'type':_0xdecce4[_0x73fb('0xc')]||_0x73fb('0xd'),'channelId':_0x73fb('0xe'),'conversation':{'id':_0x4e9e05[_0x73fb('0xf')]},'from':{'id':_0x4e9e05[_0x73fb('0x10')],'name':_0x4e9e05[_0x73fb('0x11')]},'recipient':{'id':_0x4e9e05[_0x73fb('0x12')],'name':_0x4e9e05[_0x73fb('0x13')]},'text':_0xdecce4['text'],'channelData':{}},'headers':{'Authorization':_0x73fb('0x14')+_0x1455de['access_token']},'json':!![]};if(_0xdecce4[_0x73fb('0x15')]){_0x2413ee[_0x73fb('0x16')][_0x73fb('0x17')][_0x73fb('0x18')]=_0xdecce4[_0x73fb('0x15')];}if(_0xdecce4[_0x73fb('0x19')]=='1'){_0x2413ee[_0x73fb('0x16')][_0x73fb('0x17')][_0x73fb('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x73fb('0x1b')};}if(_0xdecce4[_0x73fb('0x1c')]){_0x2413ee[_0x73fb('0x16')][_0x73fb('0x17')]['CustomAction']=_0xdecce4[_0x73fb('0x1c')];if(_0xdecce4['custom_action_data']){_0x2413ee['body'][_0x73fb('0x17')][_0x73fb('0x1d')]=_0xdecce4['custom_action_data'];}}logger[_0x73fb('0x1e')](JSON[_0x73fb('0x1f')](_0x2413ee));return rp(_0x2413ee);});}; \ 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 d18c0b2..d140d0c 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 _0x29b6=['./lib/api','exports'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0x29b6,0x17e));var _0x629b=function(_0x2501ab,_0x2007fa){_0x2501ab=_0x2501ab-0x0;var _0x1f8263=_0x29b6[_0x2501ab];return _0x1f8263;};'use strict';var asr=require(_0x629b('0x0'));module[_0x629b('0x1')]=function(_0x1a983f,_0xa86e9b,_0x2008d,_0x42ab03){return asr(_0x1a983f,_0xa86e9b,_0x2008d,_0x42ab03);}; \ No newline at end of file +var _0xbd21=['./lib/api','exports'];(function(_0x57b703,_0x5df2c8){var _0x47b455=function(_0x419d88){while(--_0x419d88){_0x57b703['push'](_0x57b703['shift']());}};_0x47b455(++_0x5df2c8);}(_0xbd21,0xc6));var _0x1bd2=function(_0x50c441,_0x16debb){_0x50c441=_0x50c441-0x0;var _0x3c7b4d=_0xbd21[_0x50c441];return _0x3c7b4d;};'use strict';var asr=require(_0x1bd2('0x0'));module[_0x1bd2('0x1')]=function(_0x2e420,_0x5b82ff,_0x3467be,_0x532265){return asr(_0x2e420,_0x5b82ff,_0x3467be,_0x532265);}; \ 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 9cad447..bec3ee1 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 _0x39bf=['moment','crypto','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','send','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','result','final','info','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.','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','close','lodash'];(function(_0x4670ae,_0x2ad06b){var _0x2ddb3a=function(_0x18bcc7){while(--_0x18bcc7){_0x4670ae['push'](_0x4670ae['shift']());}};_0x2ddb3a(++_0x2ad06b);}(_0x39bf,0x8f));var _0xf39b=function(_0x14a385,_0x3d81d0){_0x14a385=_0x14a385-0x0;var _0x48ba32=_0x39bf[_0x14a385];return _0x48ba32;};'use strict';var BPromise=require('bluebird');var _=require(_0xf39b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf39b('0x1'));var crypto=require(_0xf39b('0x2'));var logger=require('../../../../../../config/logger')(_0xf39b('0x3'));module['exports']=function(_0x5e0423,_0x47dc10,_0x35ce49,_0x1c9ad8){return new BPromise(function(_0x42447b,_0x7c4611){logger['info'](_0xf39b('0x4'),_0x1c9ad8||_0xf39b('0x5'));var _0x2099c0=new WebSocket(_0x1c9ad8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3597c7='';var _0x32a9e7='0';var _0x1c49ad='1';var _0x28483d=_0xf39b('0x6');function _0x46effe(_0x232b2c){var _0x269c00=crypto[_0xf39b('0x7')](_0xf39b('0x8'));_0x269c00[_0xf39b('0x9')](_0x232b2c);return _0x269c00[_0xf39b('0xa')](_0xf39b('0xb'));}function _0x53e0da(){try{logger['info'](_0xf39b('0xc'));var _0x353b6a=moment()[_0xf39b('0xd')]();var _0x26600a=_0x46effe(_0x353b6a+_0x47dc10+_0x35ce49);_0x2099c0['send'](JSON['stringify']({'appID':_0x47dc10,'timestamp':_0x353b6a,'appKey':_0x26600a}));var _0x1788f5=fs[_0xf39b('0xe')](_0x5e0423);_0x1788f5['on']('data',function(_0x4c4fd7){_0x2099c0[_0xf39b('0xf')](_0x4c4fd7);});_0x1788f5['on']('close',function(){_0x2099c0[_0xf39b('0xf')]('EOS');});}catch(_0x1abe62){logger[_0xf39b('0x10')](_0xf39b('0x11'),JSON[_0xf39b('0x12')](_0x1abe62));_0x2099c0[_0xf39b('0x13')]();}}function _0x45a45b(_0x84896c){try{if(_0x84896c){var _0x1a89e1=JSON['parse'](_0x84896c);switch(_0x1a89e1['status']){case 0x0:if(_0x1a89e1[_0xf39b('0x14')]){if(_0x1a89e1[_0xf39b('0x14')][_0xf39b('0x15')]){logger[_0xf39b('0x16')]('Tilde\x20ASR\x20hypoteses',JSON[_0xf39b('0x12')](_0x1a89e1[_0xf39b('0x14')][_0xf39b('0x17')]));_0x3597c7=_0x1a89e1[_0xf39b('0x14')][_0xf39b('0x17')][0x0][_0xf39b('0x18')];_0x32a9e7=_0x1a89e1['result'][_0xf39b('0x17')][0x0][_0xf39b('0x19')];_0x1c49ad='0';_0x28483d=_0xf39b('0x1a');_0x2099c0['terminate']();}}break;case 0x1:logger[_0xf39b('0x16')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1c49ad='1';_0x28483d=_0xf39b('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1c49ad='2';_0x28483d=_0xf39b('0x1b');break;case 0x9:logger['info'](_0xf39b('0x1c'));_0x1c49ad='9';_0x28483d=_0xf39b('0x1c');break;case 0xa:logger['info'](_0xf39b('0x1d'));_0x1c49ad='10';_0x28483d='Authentication\x20failed.';break;case 0xb:logger[_0xf39b('0x16')](_0xf39b('0x1e'));_0x1c49ad='11';_0x28483d='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1714e7){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xf39b('0x12')](_0x1714e7));_0x2099c0['terminate']();}}function _0x3eab10(){logger[_0xf39b('0x16')]('Close\x20Tilde\x20ASR\x20socket');_0x42447b({'transcript':_0x3597c7,'confidence':_0x32a9e7,'status':_0x1c49ad,'status_message':_0x28483d});}function _0x3bd95c(_0x1e3af0){logger[_0xf39b('0x10')](_0xf39b('0x1f'));if(!_['isNil'](_0x1e3af0)){logger[_0xf39b('0x10')](_[_0xf39b('0x20')](_0x1e3af0)?JSON['stringify'](_0x1e3af0):_0x1e3af0);}}_0x2099c0['on'](_0xf39b('0x21'),_0x53e0da);_0x2099c0['on'](_0xf39b('0x22'),_0x45a45b);_0x2099c0['on'](_0xf39b('0x23'),_0x3eab10);_0x2099c0['on'](_0xf39b('0x10'),_0x3bd95c);});}; \ No newline at end of file +var _0x6876=['message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x52f570,_0x2bad40){var _0x1add30=function(_0x1f3ae9){while(--_0x1f3ae9){_0x52f570['push'](_0x52f570['shift']());}};_0x1add30(++_0x2bad40);}(_0x6876,0x141));var _0x6687=function(_0x53e0f9,_0x2c84f0){_0x53e0f9=_0x53e0f9-0x0;var _0x46afe5=_0x6876[_0x53e0f9];return _0x46afe5;};'use strict';var BPromise=require('bluebird');var _=require(_0x6687('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6687('0x1'));var crypto=require(_0x6687('0x2'));var logger=require(_0x6687('0x3'))(_0x6687('0x4'));module[_0x6687('0x5')]=function(_0x258f24,_0x56d7f6,_0x3a4971,_0x65f6a7){return new BPromise(function(_0x26ba34,_0x506b3e){logger[_0x6687('0x6')](_0x6687('0x7'),_0x65f6a7||_0x6687('0x8'));var _0x52898a=new WebSocket(_0x65f6a7||_0x6687('0x8'),{'perMessageDeflate':![]});var _0x2ed78b='';var _0x4393bc='0';var _0x425e5c='1';var _0x1e1823=_0x6687('0x9');function _0x471938(_0x251f4d){var _0x36f692=crypto[_0x6687('0xa')]('sha1');_0x36f692[_0x6687('0xb')](_0x251f4d);return _0x36f692[_0x6687('0xc')]('hex');}function _0x3d0e2d(){try{logger[_0x6687('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x333bcd=moment()[_0x6687('0xd')]();var _0x125490=_0x471938(_0x333bcd+_0x56d7f6+_0x3a4971);_0x52898a[_0x6687('0xe')](JSON['stringify']({'appID':_0x56d7f6,'timestamp':_0x333bcd,'appKey':_0x125490}));var _0x39548c=fs[_0x6687('0xf')](_0x258f24);_0x39548c['on'](_0x6687('0x10'),function(_0x47b197){_0x52898a[_0x6687('0xe')](_0x47b197);});_0x39548c['on'](_0x6687('0x11'),function(){_0x52898a['send'](_0x6687('0x12'));});}catch(_0x380442){logger[_0x6687('0x13')](_0x6687('0x14'),JSON[_0x6687('0x15')](_0x380442));_0x52898a[_0x6687('0x16')]();}}function _0x570aae(_0x2b6294){try{if(_0x2b6294){var _0x4131bb=JSON[_0x6687('0x17')](_0x2b6294);switch(_0x4131bb[_0x6687('0x18')]){case 0x0:if(_0x4131bb[_0x6687('0x19')]){if(_0x4131bb[_0x6687('0x19')][_0x6687('0x1a')]){logger[_0x6687('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4131bb[_0x6687('0x19')][_0x6687('0x1b')]));_0x2ed78b=_0x4131bb[_0x6687('0x19')][_0x6687('0x1b')][0x0][_0x6687('0x1c')];_0x4393bc=_0x4131bb['result'][_0x6687('0x1b')][0x0]['likelihood'];_0x425e5c='0';_0x1e1823=_0x6687('0x1d');_0x52898a[_0x6687('0x16')]();}}break;case 0x1:logger[_0x6687('0x6')](_0x6687('0x9'));_0x425e5c='1';_0x1e1823=_0x6687('0x9');break;case 0x2:logger[_0x6687('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x425e5c='2';_0x1e1823=_0x6687('0x1e');break;case 0x9:logger[_0x6687('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x425e5c='9';_0x1e1823=_0x6687('0x1f');break;case 0xa:logger['info'](_0x6687('0x20'));_0x425e5c='10';_0x1e1823=_0x6687('0x20');break;case 0xb:logger[_0x6687('0x6')](_0x6687('0x21'));_0x425e5c='11';_0x1e1823=_0x6687('0x21');}}}catch(_0x8f490d){logger[_0x6687('0x13')](_0x6687('0x22'),JSON[_0x6687('0x15')](_0x8f490d));_0x52898a['terminate']();}}function _0x8c01c7(){logger[_0x6687('0x6')](_0x6687('0x23'));_0x26ba34({'transcript':_0x2ed78b,'confidence':_0x4393bc,'status':_0x425e5c,'status_message':_0x1e1823});}function _0x3583f9(_0x1acf13){logger[_0x6687('0x13')](_0x6687('0x24'));if(!_[_0x6687('0x25')](_0x1acf13)){logger['error'](_[_0x6687('0x26')](_0x1acf13)?JSON[_0x6687('0x15')](_0x1acf13):_0x1acf13);}}_0x52898a['on']('open',_0x3d0e2d);_0x52898a['on'](_0x6687('0x27'),_0x570aae);_0x52898a['on'](_0x6687('0x11'),_0x8c01c7);_0x52898a['on']('error',_0x3583f9);});}; \ 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 f114244..1b0f731 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 _0xe032=['exports','./asr'];(function(_0x5e66ee,_0x24df16){var _0x2997fd=function(_0x13c140){while(--_0x13c140){_0x5e66ee['push'](_0x5e66ee['shift']());}};_0x2997fd(++_0x24df16);}(_0xe032,0x1b9));var _0x2e03=function(_0x57eaa0,_0x32aae5){_0x57eaa0=_0x57eaa0-0x0;var _0x9d53d2=_0xe032[_0x57eaa0];return _0x9d53d2;};var asr=require(_0x2e03('0x0'));module[_0x2e03('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf1da=['./asr','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf1da,0x1a6));var _0xaf1d=function(_0x29fdd0,_0x4afcaf){_0x29fdd0=_0x29fdd0-0x0;var _0x4af6d4=_0xf1da[_0x29fdd0];return _0x4af6d4;};var asr=require(_0xaf1d('0x0'));module[_0xaf1d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 74e494b..0457abe 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 _0xbce1=['util','net','EventEmitter','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0xd753aa,_0x46df74){var _0x5444b3=function(_0x2a6800){while(--_0x2a6800){_0xd753aa['push'](_0xd753aa['shift']());}};_0x5444b3(++_0x46df74);}(_0xbce1,0xbd));var _0x1bce=function(_0x274df8,_0x5aa33e){_0x274df8=_0x274df8-0x0;var _0x448b8f=_0xbce1[_0x274df8];return _0x448b8f;};'use strict';var util=require(_0x1bce('0x0'));var net=require(_0x1bce('0x1'));var EventEmitter=require('events')[_0x1bce('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x1bce('0x3'));var AGIServer=function(_0x3e0fcf,_0x4a554b,_0x1c282c){var _0x52108e=this,_0x3e0fcf=_0x3e0fcf||0x11dd,_0x4a554b=_0x4a554b||_0x1bce('0x4'),_0x3e5358=null,_0x421f2d=0x0;EventEmitter['call'](_0x52108e);function _0x2f8b7c(){if(!_0x3e0fcf){_0x52108e[_0x1bce('0x5')](_0x1bce('0x6'),new AGIError(_0x1bce('0x7')));return![];}_0x3e5358=net[_0x1bce('0x8')]();_0x3e5358[_0x1bce('0x9')](_0x3e0fcf,_0x4a554b);_0x3e5358['on'](_0x1bce('0xa'),function(){_0x52108e['emit'](_0x1bce('0xa'));});_0x3e5358['on']('connection',function(_0x3306e7){_0x3e5358[_0x1bce('0xb')](function(_0x527847,_0x39eb2c){if(_0x527847){_0x52108e[_0x1bce('0x5')](_0x1bce('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x527847));}else if(_0x1c282c&&_0x1c282c<0x0){_0x52108e['emit'](_0x1bce('0x6'),new AGIError(_0x1bce('0xc')));_0x3306e7[_0x1bce('0xd')]();}else if(_0x1c282c&&_0x1c282c>0x0&&_0x1c282c<_0x39eb2c){_0x421f2d+=0x1;_0x52108e['emit'](_0x1bce('0x6'),new AGIError(_0x1bce('0xe'),_0x421f2d));_0x3306e7[_0x1bce('0xd')]();}else{var _0x49dc93=new AGIChannel(_0x3306e7);_0x49dc93['on'](_0x1bce('0xf'),function(){_0x52108e[_0x1bce('0x5')]('connection',_0x49dc93);});}});});_0x3e5358['on'](_0x1bce('0x6'),function(_0x50af05){_0x52108e[_0x1bce('0x5')](_0x1bce('0x6'),new AGIError(_0x1bce('0x10'),_0x50af05[_0x1bce('0x11')]));});_0x3e5358['on']('close',function(){_0x52108e[_0x1bce('0x5')]('close',new AGIError(_0x1bce('0x12')));});}process['nextTick'](function(){_0x2f8b7c();});};util[_0x1bce('0x13')](AGIServer,EventEmitter);module[_0x1bce('0x14')]=function(_0x8c0835,_0x26bf14,_0x58193a){return new AGIServer(_0x8c0835,_0x26bf14,_0x58193a);}; \ No newline at end of file +var _0xb2a4=['util','net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2a4,0xa1));var _0x4b2a=function(_0x1e4fed,_0x176f57){_0x1e4fed=_0x1e4fed-0x0;var _0x6bded0=_0xb2a4[_0x1e4fed];return _0x6bded0;};'use strict';var util=require(_0x4b2a('0x0'));var net=require(_0x4b2a('0x1'));var EventEmitter=require(_0x4b2a('0x2'))[_0x4b2a('0x3')];var AGIError=require(_0x4b2a('0x4'));var AGIChannel=require(_0x4b2a('0x5'));var AGIServer=function(_0x23dc62,_0x2ba79b,_0x16e44d){var _0x1a80c4=this,_0x23dc62=_0x23dc62||0x11dd,_0x2ba79b=_0x2ba79b||_0x4b2a('0x6'),_0x1d37e3=null,_0x2f2c51=0x0;EventEmitter['call'](_0x1a80c4);function _0x3d70fb(){if(!_0x23dc62){_0x1a80c4[_0x4b2a('0x7')](_0x4b2a('0x8'),new AGIError(_0x4b2a('0x9')));return![];}_0x1d37e3=net[_0x4b2a('0xa')]();_0x1d37e3[_0x4b2a('0xb')](_0x23dc62,_0x2ba79b);_0x1d37e3['on'](_0x4b2a('0xc'),function(){_0x1a80c4[_0x4b2a('0x7')]('listening');});_0x1d37e3['on'](_0x4b2a('0xd'),function(_0x4005f3){_0x1d37e3[_0x4b2a('0xe')](function(_0x47257d,_0x62a3d3){if(_0x47257d){_0x1a80c4['emit'](_0x4b2a('0x8'),new AGIError(_0x4b2a('0xf'),_0x47257d));}else if(_0x16e44d&&_0x16e44d<0x0){_0x1a80c4['emit'](_0x4b2a('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x4005f3[_0x4b2a('0x10')]();}else if(_0x16e44d&&_0x16e44d>0x0&&_0x16e44d<_0x62a3d3){_0x2f2c51+=0x1;_0x1a80c4[_0x4b2a('0x7')](_0x4b2a('0x8'),new AGIError(_0x4b2a('0x11'),_0x2f2c51));_0x4005f3[_0x4b2a('0x10')]();}else{var _0x1d4056=new AGIChannel(_0x4005f3);_0x1d4056['on']('ready',function(){_0x1a80c4[_0x4b2a('0x7')](_0x4b2a('0xd'),_0x1d4056);});}});});_0x1d37e3['on'](_0x4b2a('0x8'),function(_0xd316c1){_0x1a80c4['emit'](_0x4b2a('0x8'),new AGIError(_0x4b2a('0xf'),_0xd316c1['code']));});_0x1d37e3['on']('close',function(){_0x1a80c4[_0x4b2a('0x7')](_0x4b2a('0x12'),new AGIError(_0x4b2a('0x13')));});}process[_0x4b2a('0x14')](function(){_0x3d70fb();});};util[_0x4b2a('0x15')](AGIServer,EventEmitter);module[_0x4b2a('0x16')]=function(_0x772e53,_0x69c106,_0x14bfdf){return new AGIServer(_0x772e53,_0x69c106,_0x14bfdf);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0a19da1..d465c3c 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 _0xb10b=['mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','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','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','grammar','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','getUser','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','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','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','createSquareMessage','uniqueid','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','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','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','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','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','setVariable','split','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s'];(function(_0x4fa0f3,_0x54e90f){var _0x39d9ce=function(_0x2ab88f){while(--_0x2ab88f){_0x4fa0f3['push'](_0x4fa0f3['shift']());}};_0x39d9ce(++_0x54e90f);}(_0xb10b,0x12a));var _0xbb10=function(_0x388899,_0x17f370){_0x388899=_0x388899-0x0;var _0x3be17d=_0xb10b[_0x388899];return _0x3be17d;};'use strict';var fs=require('fs');var util=require(_0xbb10('0x0'));var _=require('lodash');var sh=require(_0xbb10('0x1'));var odbc=require(_0xbb10('0x2'))();var rs=require(_0xbb10('0x3'));var moment=require('moment');var Mustache=require(_0xbb10('0x4'));var rp=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var shared=require(_0xbb10('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xbb10('0xa');var recursiveMapAttributes=[_0xbb10('0xb'),'rawBody'];var verticesWithRetry=[_0xbb10('0xc'),_0xbb10('0xd'),_0xbb10('0xe')];var AGIVertices=function(_0x1c3ee5,_0x2353ef,_0x1ce33e){this[_0xbb10('0xf')]=_0x1c3ee5;this[_0xbb10('0x10')]=_0x2353ef;this['mailRpc']=_0x1ce33e;};AGIVertices['prototype'][_0xbb10('0x11')]=function(_0x118a74,_0xce64f3){this['rpc'][_0xbb10('0x12')](_0x118a74)['then'](function(_0x44fb19){_0xce64f3(null,_0x44fb19?_0x44fb19[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x193a27){_0xce64f3(_0x193a27);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x16')]=function(_0x58a612,_0x26e021){this[_0xbb10('0x10')][_0xbb10('0x17')](_0x58a612)[_0xbb10('0x18')](function(_0x3df17b){_0x26e021(null,_0x3df17b?_0x3df17b[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x36b5e8){_0x26e021(_0x36b5e8);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x19')]=function(_0x4a2bfc,_0x2eca0f){this[_0xbb10('0x10')][_0xbb10('0x1a')](_0x4a2bfc)[_0xbb10('0x18')](function(_0x378da8){_0x2eca0f(null,_0x378da8?_0x378da8[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x30efc6){_0x2eca0f(_0x30efc6);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1b')]=function(_0x48b6e9,_0x5ff0cf){this[_0xbb10('0x10')][_0xbb10('0x1c')](_0x48b6e9)[_0xbb10('0x18')](function(_0xdf237d){_0x5ff0cf(null,_0xdf237d?_0xdf237d[_0xbb10('0x1d')]:![]);})['catch'](function(_0x12f888){_0x5ff0cf(_0x12f888);});};AGIVertices[_0xbb10('0x15')]['getUser']=function(_0x4c4b0d,_0x8e2b97){this[_0xbb10('0x10')][_0xbb10('0x1e')](_0x4c4b0d)[_0xbb10('0x18')](function(_0x445761){_0x8e2b97(null,_0x445761?_0x445761[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x436104){_0x8e2b97(_0x436104);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1f')]=function(_0x3ba6cd,_0x26ad93){this['rpc']['getTrunkById'](_0x3ba6cd)['then'](function(_0xc93a04){_0x26ad93(null,_0xc93a04?_0xc93a04[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x4e25ff){_0x26ad93(_0x4e25ff);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x20')]=function(_0x6ed43b,_0x1d5e95){var _0x1acce9=this;this[_0xbb10('0x10')][_0xbb10('0x21')](_0x6ed43b)['then'](function(_0x3796c7){_0x1d5e95(null,_0x3796c7?_0x1acce9[_0xbb10('0x22')](_0x3796c7[_0xbb10('0x23')]):![]);})[_0xbb10('0x14')](function(_0x1d30aa){_0x1d5e95(_0x1d30aa);});};AGIVertices[_0xbb10('0x15')]['getMailAccount']=function(_0x221624,_0x4ee02e){this[_0xbb10('0x10')]['getMailAccountById'](_0x221624)[_0xbb10('0x18')](function(_0x1dcc9c){_0x4ee02e(null,_0x1dcc9c?_0x1dcc9c:![]);})[_0xbb10('0x14')](function(_0x491db4){_0x4ee02e(_0x491db4);});};AGIVertices['prototype'][_0xbb10('0x24')]=function(_0x34f65e,_0x4f590d,_0x359ad4){this[_0xbb10('0x25')][_0xbb10('0x24')](_0x34f65e,_0x4f590d)[_0xbb10('0x18')](function(){_0x359ad4(null);})[_0xbb10('0x14')](function(_0x138bc6){_0x359ad4(_0x138bc6);});};AGIVertices[_0xbb10('0x15')]['getIntervals']=function(_0x25acb3,_0x1da9c9){this[_0xbb10('0x10')][_0xbb10('0x26')](_0x25acb3)[_0xbb10('0x18')](function(_0x9de708){if(_0x9de708){if(_0x9de708[_0xbb10('0x27')]){_0x1da9c9(null,[_0x9de708[_0xbb10('0x28')]]);}else{_0x1da9c9(null,_[_0xbb10('0x29')](_0x9de708['Intervals'],_0xbb10('0x28')));}}else{_0x1da9c9(null,![]);}})[_0xbb10('0x14')](function(_0x1ddd9e){_0x1da9c9(_0x1ddd9e);});};AGIVertices[_0xbb10('0x15')]['getSoundPath']=function(_0x111762){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x111762);};AGIVertices[_0xbb10('0x15')][_0xbb10('0x2a')]=function(_0x26e76a,_0x120d21,_0x15d895){odbc[_0xbb10('0x2b')](_0x26e76a,function(_0x547062){if(_0x547062){logger[_0xbb10('0x2c')](_0xbb10('0x2d'),_0x547062);_0x15d895(_0x547062);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x120d21,function(_0x31bee3,_0x2b0b45){if(_0x31bee3){logger[_0xbb10('0x2e')]('Error\x20executing\x20query\x20%s',_0x120d21);_0x15d895(_0x31bee3);}else{logger[_0xbb10('0x2e')](_0xbb10('0x2f'),_0x120d21);odbc[_0xbb10('0x30')](function(_0x4d1a83){if(_0x4d1a83){logger[_0xbb10('0x2c')](_0xbb10('0x31'),_0x4d1a83);}_0x15d895(null,_0x2b0b45);});}});}});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x32')]=function(_0x4f1cdd,_0xd238e9){this[_0xbb10('0x10')]['getSmsAccountById'](_0x4f1cdd)[_0xbb10('0x18')](function(_0x2e3214){_0xd238e9(null,_0x2e3214?_0x2e3214:![]);})[_0xbb10('0x14')](function(_0x3a9934){_0xd238e9(_0x3a9934);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x33')]=function(_0x5f3d67,_0x1e8f79){this[_0xbb10('0x10')][_0xbb10('0x33')](_0x5f3d67)[_0xbb10('0x18')](function(_0x4943d9){_0x1e8f79(null,_0x4943d9);})[_0xbb10('0x14')](function(_0x331751){_0x1e8f79(_0x331751);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x34')]=function(_0x5e2cfa,_0x351484,_0x202c60){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xbb10('0xf')]['uniqueid'],'node':_0x5e2cfa[_0xbb10('0x35')],'application':_0x5e2cfa[_0xbb10('0x36')],'data':_0x351484||null,'project_name':this['channel'][_0xbb10('0x37')],'callerid':this[_0xbb10('0xf')][_0xbb10('0x38')]})['then'](function(_0x2dd02b){if(_0x202c60){_0x202c60(null,_0x2dd02b);}})[_0xbb10('0x14')](function(_0x3b9fdf){if(_0x202c60){_0x202c60(_0x3b9fdf);}});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x39')]=function(_0x19f94d,_0x190781,_0x3efa96,_0x205bb4){this[_0xbb10('0x10')][_0xbb10('0x39')]({'uniqueid':this[_0xbb10('0xf')]['uniqueid'],'callerid':this[_0xbb10('0xf')][_0xbb10('0x38')],'calleridname':this['channel'][_0xbb10('0x3a')],'context':this[_0xbb10('0xf')][_0xbb10('0x3b')],'extension':this[_0xbb10('0xf')][_0xbb10('0x3c')],'priority':this[_0xbb10('0xf')][_0xbb10('0x3d')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xbb10('0xf')][_0xbb10('0x3e')],'projectName':this[_0xbb10('0xf')]['arg_1'],'saveName':_0x190781,'filename':_0x19f94d['file']||_0x190781,'savePath':_0x3efa96})[_0xbb10('0x18')](function(_0x34cf4e){_0x205bb4(null,_0x34cf4e);})[_0xbb10('0x14')](function(_0xf820fe){_0x205bb4(_0xf820fe);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x3f')]=function(_0x2f2552,_0x460788,_0x2626d8,_0x3d7e7e,_0x550111){this['rpc'][_0xbb10('0x3f')]({'uniqueid':this[_0xbb10('0xf')][_0xbb10('0x40')],'body':_0x2f2552,'direction':_0x460788,'providerName':_0x2626d8,'providerResponse':_0x3d7e7e})[_0xbb10('0x18')](function(_0x36aa7d){if(_0x550111){_0x550111(null,_0x36aa7d);}})[_0xbb10('0x14')](function(_0x358e7e){if(_0x550111){_0x550111(_0x358e7e);}});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x41')]=function(_0x1214f7,_0x19ca3e){this[_0xbb10('0x10')][_0xbb10('0x41')]({'firstName':_[_0xbb10('0x42')](_0x1214f7[_0xbb10('0x13')])||_['isNil'](_0x1214f7[_0xbb10('0x13')])?'callback_'+Math[_0xbb10('0x43')]():_0x1214f7[_0xbb10('0x13')],'lastName':_[_0xbb10('0x42')](_0x1214f7[_0xbb10('0x44')])||_[_0xbb10('0x45')](_0x1214f7[_0xbb10('0x44')])?null:_0x1214f7[_0xbb10('0x44')],'phone':_0x1214f7[_0xbb10('0x46')],'ListId':_0x1214f7[_0xbb10('0x47')],'scheduledat':_0x1214f7[_0xbb10('0x48')],'callbackUniqueid':this[_0xbb10('0xf')][_0xbb10('0x40')],'tags':_0xbb10('0x49'),'description':_0xbb10('0x4a')+_0x1214f7[_0xbb10('0x48')]['toString'](),'priority':_0x1214f7[_0xbb10('0x4b')]})[_0xbb10('0x18')](function(_0x1b83a9){_0x19ca3e(null,_0x1b83a9);})[_0xbb10('0x14')](function(_0xbffa3c){_0x19ca3e(_0xbffa3c);});};AGIVertices[_0xbb10('0x15')]['getPause']=function(_0x120bda,_0x4731ce){this[_0xbb10('0x10')][_0xbb10('0x4c')](_0x120bda)[_0xbb10('0x18')](function(_0x22de7f){_0x4731ce(null,_0x22de7f?_0x22de7f[_0xbb10('0x13')]:![]);})[_0xbb10('0x14')](function(_0x205e01){_0x4731ce(_0x205e01);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x4d')]=function(_0x2a1ce1,_0x16932f,_0x4e7fac){var _0x4ea1a6={'role':_0xbb10('0x4e')};_0x4ea1a6[_0x2a1ce1]=this[_0xbb10('0xf')][_0xbb10('0x38')];this[_0xbb10('0x10')]['agentPause'](_0x4ea1a6,_0x16932f,this['channel'][_0xbb10('0x40')])[_0xbb10('0x18')](function(_0x410bef){_0x4e7fac(null,_[_0xbb10('0x45')](_0x410bef)?![]:!![]);})[_0xbb10('0x14')](function(_0x3e9753){logger[_0xbb10('0x2c')](_0x3e9753);_0x4e7fac(null,![]);});};AGIVertices['prototype'][_0xbb10('0x4f')]=function(_0x216cff,_0x4917a5){var _0x5e03cb={'role':'agent'};_0x5e03cb[_0x216cff]=this[_0xbb10('0xf')][_0xbb10('0x38')];this[_0xbb10('0x10')]['agentUnpause'](_0x5e03cb)['then'](function(_0x5846d1){_0x4917a5(null,_[_0xbb10('0x45')](_0x5846d1)?![]:!![]);})[_0xbb10('0x14')](function(_0x45167a){logger['error'](_0x45167a);_0x4917a5(null,![]);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x50')]=function(_0x5a6538,_0x4a560c){var _0x27d7b9={'role':_0xbb10('0x4e')};_0x27d7b9[_0x5a6538]=this[_0xbb10('0xf')][_0xbb10('0x38')];this['rpc'][_0xbb10('0x50')](_0x27d7b9)[_0xbb10('0x18')](function(_0xa7179d){_0x4a560c(null,_['isNil'](_0xa7179d)?![]:!![]);})[_0xbb10('0x14')](function(_0x2f05bc){logger[_0xbb10('0x2c')](_0x2f05bc);_0x4a560c(null,![]);});};AGIVertices['prototype'][_0xbb10('0x51')]=function(_0x31e85e,_0x3b0f08){var _0x37b65f={'role':'agent'};_0x37b65f[_0x31e85e]=this[_0xbb10('0xf')][_0xbb10('0x38')];var _0x108e5b=_0x31e85e!=_0xbb10('0x52')?util['format'](_0xbb10('0x53'),_0xbb10('0x54'),this[_0xbb10('0xf')][_0xbb10('0x38')]):undefined;this[_0xbb10('0x10')][_0xbb10('0x51')](_0x37b65f,_0x108e5b)[_0xbb10('0x18')](function(_0x4a30c5){_0x3b0f08(null,_['isNil'](_0x4a30c5)?![]:!![]);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x2c')](_0xdfbc0b);_0x3b0f08(null,![]);});};AGIVertices[_0xbb10('0x15')]['shellCommand']=function(_0x5cd089,_0x46f462){sh[_0xbb10('0x55')](_[_0xbb10('0x56')](_0x5cd089),function(_0x3a9677,_0x260e06){var _0x1ad2ed=_0x260e06['replace'](/(\r\n|\n|\r)/gm,'');_0x46f462(null,_0x1ad2ed);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x57')]=function(_0x270fdb,_0x14f16b){scripts[_0xbb10('0x57')](_0x270fdb['apiKey'],_0x270fdb['google_cloud_tts_text_type']||'text',_0x270fdb[_0xbb10('0x58')],_0x270fdb[_0xbb10('0x59')]||_0xbb10('0x5a'),_0x270fdb[_0xbb10('0x5b')]||_0xbb10('0x5c'),_0x270fdb[_0xbb10('0x5d')]||'MP3')[_0xbb10('0x18')](function(_0x4bc316){_0x14f16b(null,_0x4bc316);})['catch'](function(_0x519a54){_0x14f16b(_0x519a54);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x5e')]=function(_0x23b1d5,_0x108f99){scripts['googleTTS'](_0x23b1d5[_0xbb10('0x58')],_0x23b1d5['google_tts_language']||'en',0x1)['then'](function(_0x165fe9){_0x108f99(null,_0x165fe9);})[_0xbb10('0x14')](function(_0x29529c){_0x108f99(_0x29529c);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x5f')]=function(_0x4fccc5,_0x2d52ea){var _0x19fcec={'uri':_0x4fccc5[_0xbb10('0x60')],'method':_0x4fccc5[_0xbb10('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4fccc5[_0xbb10('0x62')])===_0xbb10('0x63')&&parseInt(_0x4fccc5[_0xbb10('0x62')])>=0x1?parseInt(_0x4fccc5['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xbb10('0x64')]([_0xbb10('0x65'),_0xbb10('0x66')],_0x19fcec[_0xbb10('0x61')][_0xbb10('0x67')]())){try{_0x19fcec[_0xbb10('0x68')]=_0x4fccc5[_0xbb10('0x69')]?JSON[_0xbb10('0x6a')](_0x4fccc5['rawBody']):{};}catch(_0x428146){logger[_0xbb10('0x2c')](_0xbb10('0x6b'),_0x428146);}}try{_0x19fcec['headers']=_0x4fccc5['rawHeaders']?JSON['parse'](_0x4fccc5[_0xbb10('0xb')]):{};}catch(_0x5a3c44){logger['error'](_0xbb10('0x6c'),_0x5a3c44);}if(_0x4fccc5[_0xbb10('0x6d')]){try{var _0x33ff06=require(_0x4fccc5[_0xbb10('0x6d')])[_0xbb10('0x6e')](this,_0x19fcec);_0x19fcec[_0xbb10('0x6f')]=Mustache[_0xbb10('0x70')](_0x4fccc5[_0xbb10('0x60')],_0x33ff06,{},['$$','$$']);if(_0x19fcec[_0xbb10('0x71')]){_0x19fcec['headers']=JSON[_0xbb10('0x6a')](Mustache[_0xbb10('0x70')](JSON[_0xbb10('0x72')](_0x19fcec[_0xbb10('0x71')]),_0x33ff06,{},['$$','$$']));}if(_0x19fcec['body']){_0x19fcec['body']=JSON[_0xbb10('0x6a')](Mustache[_0xbb10('0x70')](JSON[_0xbb10('0x72')](_0x19fcec[_0xbb10('0x68')]),_0x33ff06,{},['$$','$$']));}}catch(_0x5ee705){logger[_0xbb10('0x2c')](_0xbb10('0x73'),_0x5ee705);}}rp(_0x19fcec)[_0xbb10('0x18')](function(_0xf7b3e1){var _0x35c1e8={'statusCode':_0xf7b3e1['statusCode']||0xc8,'statusMessage':_0xf7b3e1['statusMessage']||'OK','headers':_0xf7b3e1[_0xbb10('0x71')]||{},'body':_0xf7b3e1[_0xbb10('0x68')]||{}};_0x2d52ea(null,_0x35c1e8);})[_0xbb10('0x14')](function(_0x5239da){var _0x256b35={'statusCode':_0x5239da[_0xbb10('0x74')]||0x1f4,'statusMessage':_0x5239da['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5239da[_0xbb10('0x75')][_0xbb10('0x71')]||{},'body':_0x5239da[_0xbb10('0x75')]['body']||{}};_0x2d52ea(null,_0x256b35);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x76')]=function(_0xfbb365,_0x2d1805){scripts[_0xbb10('0x76')](this[_0xbb10('0xf')][_0xbb10('0x40')],_0xfbb365[_0xbb10('0x77')],_0xfbb365[_0xbb10('0x58')],_0xfbb365['dialogflow_language']||'en')[_0xbb10('0x18')](function(_0x28cc46){_0x2d1805(null,_0x28cc46);})[_0xbb10('0x14')](function(_0xdb7d3e){_0x2d1805(_0xdb7d3e);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x78')]=function(_0x33a6fc,_0x305d52){scripts[_0xbb10('0x78')](this[_0xbb10('0xf')][_0xbb10('0x40')],_0x33a6fc[_0xbb10('0x79')],_0x33a6fc['client_email'],_0x33a6fc['private_key'],_0x33a6fc[_0xbb10('0x58')],_0x33a6fc[_0xbb10('0x7a')]||'en')[_0xbb10('0x18')](function(_0x3fd367){_0x305d52(null,_0x3fd367);})[_0xbb10('0x14')](function(_0x4a717a){_0x305d52(_0x4a717a);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x7b')]=function(_0x3b4d0b,_0x1a51d3){scripts[_0xbb10('0x7b')](this[_0xbb10('0xf')],_0x3b4d0b)['then'](function(_0xb25e71){_0x1a51d3(null,_0xb25e71);})[_0xbb10('0x14')](function(_0x5c00c8){_0x1a51d3(_0x5c00c8);});};AGIVertices[_0xbb10('0x15')]['ispeechTTS']=function(_0xc53c87,_0x28bd76){scripts[_0xbb10('0x7c')](_0xc53c87[_0xbb10('0x77')],_0xc53c87[_0xbb10('0x58')],_0xc53c87['ispeech_tts_language']||_0xbb10('0x5a'),_0xc53c87['speed'])[_0xbb10('0x18')](function(_0x37ec93){_0x28bd76(null,_0x37ec93);})['catch'](function(_0x5aaa20){_0x28bd76(_0x5aaa20);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x7d')]=function(_0x1b77c2,_0x283bab,_0x18d18d){scripts[_0xbb10('0x7d')](_0x283bab,_0x1b77c2[_0xbb10('0x77')],_0x1b77c2[_0xbb10('0x7e')]||_0xbb10('0x5a'),this[_0xbb10('0x7f')](_0x1b77c2[_0xbb10('0x80')])?_0x1b77c2['model']:undefined)[_0xbb10('0x18')](function(_0x3eeceb){_0x18d18d(null,_0x3eeceb);})[_0xbb10('0x14')](function(_0xcd5d35){_0x18d18d(_0xcd5d35);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x81')]=function(_0xfefa17,_0x28bc95){scripts[_0xbb10('0x81')](_0xfefa17[_0xbb10('0x82')],_0xfefa17[_0xbb10('0x83')],_0xfefa17[_0xbb10('0x84')],_0xfefa17['aws_polly_voice']||_0xbb10('0x85'),_0xfefa17['text'],_0xfefa17[_0xbb10('0x86')]||_0xbb10('0x58'))[_0xbb10('0x18')](function(_0x40236c){_0x28bc95(null,_0x40236c);})[_0xbb10('0x14')](function(_0x5371d4){_0x28bc95(_0x5371d4);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x87')]=function(_0x44d1d2,_0x12e89d){scripts[_0xbb10('0x87')](this[_0xbb10('0xf')]['uniqueid'],_0x44d1d2['aws_access_key_id'],_0x44d1d2[_0xbb10('0x83')],_0x44d1d2[_0xbb10('0x88')],_0x44d1d2[_0xbb10('0x58')],_0x44d1d2['aws_bot_name'])[_0xbb10('0x18')](function(_0x3d6a91){_0x12e89d(null,_0x3d6a91);})['catch'](function(_0x2831de){_0x12e89d(_0x2831de);});};AGIVertices[_0xbb10('0x15')]['googleASR']=function(_0xdd3c7e,_0x4d7bca,_0x34cec7){scripts[_0xbb10('0x89')](_0x4d7bca,_0xdd3c7e['key'],_0xdd3c7e[_0xbb10('0x8a')]||_0xbb10('0x5a'))['then'](function(_0x5dae56){_0x34cec7(null,_0x5dae56);})[_0xbb10('0x14')](function(_0x13ae83){_0x34cec7(_0x13ae83);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x8b')]=function(_0x3ceb77,_0x4c3bdc,_0xe7c0a3){scripts[_0xbb10('0x8b')](_0x4c3bdc,_0x3ceb77[_0xbb10('0x8c')],_0x3ceb77['appsecret'],_0x3ceb77[_0xbb10('0x6f')])[_0xbb10('0x18')](function(_0x248887){_0xe7c0a3(null,_0x248887);})[_0xbb10('0x14')](function(_0x44a3e1){_0xe7c0a3(_0x44a3e1);});};AGIVertices[_0xbb10('0x15')][_0xbb10('0x8d')]=function(_0x189f07){var _0x2010d4=_['includes'](verticesWithRetry,_0x189f07['agicommand'])?_0x189f07:_[_0xbb10('0x8e')](_0x189f07);for(var _0xe7238b in _0x2010d4){if(_0x2010d4[_0xbb10('0x8f')](_0xe7238b)){if(_0x2010d4[_0xe7238b]&&_[_0xbb10('0x90')](_0x2010d4[_0xe7238b])){if(_[_0xbb10('0x64')](recursiveMapAttributes,_0xe7238b)){_0x2010d4[_0xe7238b]=this[_0xbb10('0x91')](_0x2010d4[_0xe7238b]);}else{_0x2010d4[_0xe7238b]=this[_0xbb10('0x92')](_0x2010d4[_0xe7238b]);}}}}return _0x2010d4;};AGIVertices[_0xbb10('0x15')][_0xbb10('0x93')]=function(_0x471827){for(var _0xcbaf69 in _0x471827){if(_0x471827[_0xbb10('0x8f')](_0xcbaf69)){if(_[_0xbb10('0x94')](_0x471827[_0xcbaf69])){this['recursiveNodeIndex'](_0x471827[_0xcbaf69]);}else if(_[_0xbb10('0x95')](_0x471827[_0xcbaf69])){for(var _0x123587=0x0;_0x123587<_0x471827[_0xcbaf69][_0xbb10('0x96')];_0x123587++){this[_0xbb10('0x93')](_0x471827[_0xcbaf69][_0x123587]);}}else if(_[_0xbb10('0x90')](_0x471827[_0xcbaf69])){_0x471827[_0xcbaf69]=this[_0xbb10('0x92')](_0x471827[_0xcbaf69]);}}}};AGIVertices[_0xbb10('0x15')][_0xbb10('0x97')]=function(_0x3c6c45,_0x3c92f4){for(var _0x2a1c53 in _0x3c6c45){if(_0x3c6c45['hasOwnProperty'](_0x2a1c53)){if(_[_0xbb10('0x94')](_0x3c6c45[_0x2a1c53])){if(!_['isEmpty'](_0x3c6c45[_0x2a1c53])){this[_0xbb10('0x97')](_0x3c6c45[_0x2a1c53],util[_0xbb10('0x98')](_0xbb10('0x99'),_0x3c92f4,_0x2a1c53));}}else if(_[_0xbb10('0x95')](_0x3c6c45[_0x2a1c53])){for(var _0x2b6e27=0x0;_0x2b6e27<_0x3c6c45[_0x2a1c53][_0xbb10('0x96')];_0x2b6e27++){this['saveRestApiResult'](_0x3c6c45[_0x2a1c53][_0x2b6e27],util[_0xbb10('0x98')]('%s.%s',_0x3c92f4,_0x2a1c53+'['+_0x2b6e27+']'));}}else{if(!_[_0xbb10('0x45')](_0x3c6c45[_0x2a1c53])){this[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0x99'),_0x3c92f4,_0x2a1c53),_0x3c6c45[_0x2a1c53]);}}}}};AGIVertices[_0xbb10('0x15')][_0xbb10('0x91')]=function(_0x3d61e8){try{var _0x25c5b2=JSON[_0xbb10('0x6a')](_0x3d61e8);this[_0xbb10('0x93')](_0x25c5b2);return JSON[_0xbb10('0x72')](_0x25c5b2);}catch(_0x589565){return this[_0xbb10('0x92')](_0x3d61e8);}};AGIVertices['prototype'][_0xbb10('0x92')]=function(_0x36e9b0){var _0x418f63=_0x36e9b0[_0xbb10('0x9b')]('{');for(var _0x44c229=0x1;_0x44c229<_0x418f63[_0xbb10('0x96')];_0x44c229+=0x1){var _0x185ec9=_0x418f63[_0x44c229]['split']('}');if(_0x185ec9[_0xbb10('0x96')]>0x1){_0x36e9b0=_0x36e9b0['replaceAll']('{'+_0x185ec9[0x0]+'}',this['channel'][_0xbb10('0x11')](_0x185ec9[0x0])[_0xbb10('0x9c')]||_0x185ec9[0x0]);}}if(_0x418f63[_0xbb10('0x96')]===0x1){return _0x36e9b0[_0xbb10('0x9d')]();}return this[_0xbb10('0x92')](_0x36e9b0);};AGIVertices[_0xbb10('0x15')]['getAndSetVariable']=function(_0x3d92dc,_0x2c25ab){var _0x39aa9e=this[_0xbb10('0xf')][_0xbb10('0x11')](_0x3d92dc);if(_0x39aa9e[_0xbb10('0x9e')]===-0x1){return _0x39aa9e;}logger['info'](util[_0xbb10('0x98')](_0xbb10('0x9f'),_0x2c25ab,_0x39aa9e[_0xbb10('0x9c')]));return this[_0xbb10('0xf')][_0xbb10('0x9a')](_0x2c25ab,_0x39aa9e[_0xbb10('0x9c')]);};AGIVertices[_0xbb10('0x15')]['isConfigured']=function(_0x33a43e){return _0x33a43e&&_0x33a43e!=='0'&&_0x33a43e!=='-1'&&_0x33a43e!=='';};AGIVertices['prototype'][_0xbb10('0xa0')]=function(_0x4a6660){this['createSquareDetailsReport'][_0xbb10('0x6e')](this,_0x4a6660,'-');_0x4a6660[_0xbb10('0xa1')]=_0x4a6660[_0xbb10('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbb10('0x15')][_0xbb10('0xa2')]=function(_0x4b3fc7){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4b3fc7['label']));if(!this[_0xbb10('0x7f')](_0x4b3fc7[_0xbb10('0x58')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xa4'));}var _0x5abedf='\x22'+_0x4b3fc7[_0xbb10('0x58')]+'\x22';if(this[_0xbb10('0x7f')](_0x4b3fc7[_0xbb10('0x75')])){_0x5abedf+=','+_0x4b3fc7[_0xbb10('0x75')];}var _0x4b3b21=this[_0xbb10('0xf')][_0xbb10('0x55')]('MRCPSynth',_0x5abedf);if(_0x4b3b21['result']===-0x1){return _0x4b3b21;}return this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xa5'),_0x5abedf));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xa6')]=function(_0x2261aa){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0xa7'),_0x2261aa[_0xbb10('0x35')]));if(!this['isConfigured'](_0x2261aa['grammar'])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xa8'));}var _0x7984c1=_0x2261aa['grammar'];if(this[_0xbb10('0x7f')](_0x2261aa[_0xbb10('0x75')])){_0x7984c1+=','+_0x2261aa[_0xbb10('0x75')];}var _0x290280=this[_0xbb10('0xf')][_0xbb10('0x55')]('MRCPRecog',_0x7984c1);if(_0x290280['result']===-0x1){return _0x290280;}var _0x356660=this['getAndSetVariable'](_0xbb10('0xa9'),_0xbb10('0xaa'));if(_0x356660[_0xbb10('0x9e')]===-0x1){return _0x356660;}var _0x15dcde=this[_0xbb10('0xab')](_0xbb10('0xac'),_0xbb10('0xad'));if(_0x15dcde[_0xbb10('0x9e')]===-0x1){return _0x15dcde;}var _0xd3c2c8=this[_0xbb10('0xab')]('RECOG_INSTANCE()',_0xbb10('0xae'));if(_0xd3c2c8['result']===-0x1){return _0xd3c2c8;}return this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0xaf'),_0x7984c1));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x7')]=function(_0x5ee229){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0xb0'),_0x5ee229[_0xbb10('0x35')]));return this[_0xbb10('0xf')]['agi']([_0x5ee229[_0xbb10('0xb1')],_0x5ee229[_0xbb10('0xb2')]]);};AGIVertices[_0xbb10('0x15')][_0xbb10('0xb3')]=function(_0x11d31b){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x11d31b['label']));if(this[_0xbb10('0x7f')](_0x11d31b['timeout'])){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0xb4'),_0x11d31b[_0xbb10('0x62')]));var _0x385ad3=this['channel']['wait'](_0x11d31b[_0xbb10('0x62')]);if(_0x385ad3[_0xbb10('0x9e')]===-0x1){return _0x385ad3;}}return this[_0xbb10('0xf')]['answer']();};AGIVertices[_0xbb10('0x15')][_0xbb10('0x49')]=function(_0x45cfe9){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x45cfe9[_0xbb10('0x35')]));if(!this['isConfigured'](_0x45cfe9[_0xbb10('0x47')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x45cfe9,_0xbb10('0xb5'));}_0x45cfe9[_0xbb10('0x48')]=moment();if(this[_0xbb10('0x7f')](_0x45cfe9[_0xbb10('0xb6')])){_0x45cfe9[_0xbb10('0x48')]=moment()[_0xbb10('0xb7')](_0x45cfe9[_0xbb10('0xb6')],_0xbb10('0xb8'));}if(!this['isConfigured'](_0x45cfe9[_0xbb10('0x4b')])){_0x45cfe9[_0xbb10('0x4b')]=0x2;}this['createCmContact'][_0xbb10('0x6e')](this,_0x45cfe9);return this['channel']['noop'](util[_0xbb10('0x98')](_0xbb10('0xb9'),_0x45cfe9[_0xbb10('0x46')],_0x45cfe9[_0xbb10('0x47')],_0x45cfe9[_0xbb10('0x48')]));};AGIVertices['prototype'][_0xbb10('0xba')]=function(_0x18b749){logger['info'](util[_0xbb10('0x98')](_0xbb10('0xbb'),_0x18b749['label']));var _0x424c96=this['channel'][_0xbb10('0x55')](_0x18b749[_0xbb10('0xbc')],_0x18b749[_0xbb10('0x75')]);if(_0x424c96[_0xbb10('0x9e')]===-0x1){return _0x424c96;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')]('Executed\x20command\x20%s\x20%s',_0x18b749[_0xbb10('0xbc')],_0x18b749[_0xbb10('0x75')]));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xbd')]=function(_0x28dc7b){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x28dc7b['label']));if(!this[_0xbb10('0x7f')](_0x28dc7b[_0xbb10('0x58')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20text\x20configured');}var _0x3b01a3='\x22'+_0x28dc7b[_0xbb10('0x58')]+'\x22';if(this[_0xbb10('0x7f')](_0x28dc7b['options'])){_0x3b01a3+=','+_0x28dc7b['options'];}var _0xe5b08=this['channel'][_0xbb10('0x55')](_0xbb10('0xbe'),_0x3b01a3);if(_0xe5b08[_0xbb10('0x9e')]===-0x1){return _0xe5b08;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xa5'),_0x3b01a3));};AGIVertices['prototype'][_0xbb10('0xbf')]=function(_0x1eca6c){logger['info'](util[_0xbb10('0x98')](_0xbb10('0xc0'),_0x1eca6c[_0xbb10('0x35')]));if(!this['isConfigured'](_0x1eca6c['text'])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xa4'));}var _0x4bce9b='\x22'+_0x1eca6c[_0xbb10('0x58')]+'\x22';if(this[_0xbb10('0x7f')](_0x1eca6c[_0xbb10('0x75')])){_0x4bce9b+=','+_0x1eca6c[_0xbb10('0x75')];}var _0x3d6b3b=this[_0xbb10('0xf')][_0xbb10('0x55')]('MRCPSynth',_0x4bce9b);if(_0x3d6b3b[_0xbb10('0x9e')]===-0x1){return _0x3d6b3b;}return this['channel']['noop'](util['format'](_0xbb10('0xa5'),_0x4bce9b));};AGIVertices[_0xbb10('0x15')]['lumenvoxasr']=function(_0x1f09f1){logger['info'](util[_0xbb10('0x98')](_0xbb10('0xc1'),_0x1f09f1[_0xbb10('0x35')]));if(!this['isConfigured'](_0x1f09f1['grammar'])){return this[_0xbb10('0xf')]['noop'](_0xbb10('0xa8'));}var _0x211172=_0x1f09f1['grammar'];if(this['isConfigured'](_0x1f09f1[_0xbb10('0x75')])){_0x211172+=','+_0x1f09f1[_0xbb10('0x75')];}var _0x30e1dd=this['channel'][_0xbb10('0x55')](_0xbb10('0xc2'),_0x211172);if(_0x30e1dd[_0xbb10('0x9e')]===-0x1){return _0x30e1dd;}var _0x4d47cc=this[_0xbb10('0xab')](_0xbb10('0xa9'),_0xbb10('0xc3'));if(_0x4d47cc[_0xbb10('0x9e')]===-0x1){return _0x4d47cc;}var _0x112b35=this[_0xbb10('0xab')](_0xbb10('0xac'),_0xbb10('0xc4'));if(_0x112b35[_0xbb10('0x9e')]===-0x1){return _0x112b35;}var _0x7c2e8f=this[_0xbb10('0xab')](_0xbb10('0xc5'),_0xbb10('0xc6'));if(_0x7c2e8f['result']===-0x1){return _0x7c2e8f;}return this['channel'][_0xbb10('0xa3')](util['format'](_0xbb10('0xaf'),_0x211172));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xc7')]=function(_0x4e5236){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0xc8'),_0x4e5236[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x4e5236['grammar'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xa8'));}var _0x4dfc92=_0x4e5236[_0xbb10('0xc9')];if(this[_0xbb10('0x7f')](_0x4e5236['options'])){_0x4dfc92+=','+_0x4e5236[_0xbb10('0x75')];}var _0x2f0262=this['channel'][_0xbb10('0x55')](_0xbb10('0xc2'),_0x4dfc92);if(_0x2f0262[_0xbb10('0x9e')]===-0x1){return _0x2f0262;}var _0x3bfba9=this[_0xbb10('0xab')](_0xbb10('0xa9'),_0xbb10('0xca'));if(_0x3bfba9[_0xbb10('0x9e')]===-0x1){return _0x3bfba9;}var _0x1d45c5=this[_0xbb10('0xab')](_0xbb10('0xac'),_0xbb10('0xcb'));if(_0x1d45c5[_0xbb10('0x9e')]===-0x1){return _0x1d45c5;}var _0x3d1ebb=this[_0xbb10('0xab')]('RECOG_INSTANCE()',_0xbb10('0xcc'));if(_0x3d1ebb[_0xbb10('0x9e')]===-0x1){return _0x3d1ebb;}return this['channel']['noop'](util[_0xbb10('0x98')](_0xbb10('0xaf'),_0x4dfc92));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xcd')]=function(_0x27fb82){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0xce'),_0x27fb82[_0xbb10('0x35')]));if(!this['isConfigured'](_0x27fb82['odbc_id'])){return this['channel']['error'](_0x27fb82,'no\x20database\x20selected');}var _0x5d42b1=this[_0xbb10('0x1b')][_0xbb10('0x6e')](this,_0x27fb82[_0xbb10('0xcf')]);if(!_0x5d42b1){return this[_0xbb10('0xf')]['error'](_0x27fb82,_0xbb10('0xd0'));}if(!this[_0xbb10('0x7f')](_0x27fb82[_0xbb10('0xd1')])){return this[_0xbb10('0xf')]['error'](_0x27fb82,'no\x20query\x20configured');}var _0x3057b4=_0x27fb82[_0xbb10('0xd1')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xd2'),_0x3057b4));var _0x3bbdff=this[_0xbb10('0x2a')]['sync'](this,_0x5d42b1,_0x3057b4);this[_0xbb10('0x34')]['sync'](this,_0x27fb82,_0x3057b4);if(!this['isConfigured'](_0x27fb82[_0xbb10('0xd3')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xd4'));}var _0x3b1e6f=this[_0xbb10('0x11')]['sync'](this,_0x27fb82[_0xbb10('0xd3')]);if(!_0x3b1e6f){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x27fb82,_0xbb10('0xd5'));}var _0x6f8d2=this;_0x3bbdff[_0xbb10('0xd6')](function(_0x2776e9,_0xce60f4){Object[_0xbb10('0xd7')](_0x2776e9)[_0xbb10('0xd6')](function(_0xbae19c){_0x6f8d2[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0xd8'),_0x3b1e6f,_0xce60f4,_0xbae19c),_0x2776e9[_0xbae19c]);});});this[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0xd9'),_0x3b1e6f),_0x3bbdff[_0xbb10('0x96')]);return this[_0xbb10('0xf')][_0xbb10('0xa3')](util['format'](_0xbb10('0xda'),_0x3b1e6f));};AGIVertices['prototype'][_0xbb10('0xdb')]=function(_0x242153){logger[_0xbb10('0xdc')](util[_0xbb10('0x98')](_0xbb10('0xdd'),_0x242153['label']));if(!this['isConfigured'](_0x242153['sip_id'])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x242153,'no\x20user\x20selected');}var _0x31b7f9=this[_0xbb10('0xde')][_0xbb10('0x6e')](this,_0x242153['sip_id']);if(!_0x31b7f9){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x242153,_0xbb10('0xdf'));}var _0x5d9e9a=this[_0xbb10('0xf')]['exec'](_0xbb10('0xe0'),[util['format']('SIP/%s',_0x31b7f9),_0x242153['timeout'],_0x242153['opts'],_0x242153['url']]);if(_0x5d9e9a['result']===-0x1){return _0x5d9e9a;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xe1'),'DIAL'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xe2')]=function(_0x2dc986){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0xe3'),_0x2dc986[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x2dc986[_0xbb10('0x77')])){return this[_0xbb10('0xf')]['noop'](_0xbb10('0xe4'));}if(!this[_0xbb10('0x7f')](_0x2dc986[_0xbb10('0x58')])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xa4'));}this[_0xbb10('0xf')][_0xbb10('0xe5')]=!![];this['createSquareDetailsReport'](_0x2dc986);this[_0xbb10('0x3f')](_0x2dc986[_0xbb10('0x58')],'in','','');this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xe6'),_0x2dc986[_0xbb10('0x58')]));var _0x1c0529=this[_0xbb10('0x76')][_0xbb10('0x6e')](this,_0x2dc986);if(_0x1c0529){for(var _0x3c01ff in _0x1c0529){if(_0x1c0529['hasOwnProperty'](_0x3c01ff)){this[_0xbb10('0xf')][_0xbb10('0x9a')](util['format']('DIALOGFLOW_%s',_0x3c01ff[_0xbb10('0x67')]()),_0x1c0529[_0x3c01ff]);}}this[_0xbb10('0x3f')](_0x1c0529['speech'],_0xbb10('0xe7'),_0xbb10('0xe2'),'');return this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xe8'),_0x1c0529[_0xbb10('0xe9')]));}return this[_0xbb10('0xf')]['error'](_0x2dc986,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xbb10('0xea')]=function(_0x4db9ad){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4db9ad[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x4db9ad[_0xbb10('0x79')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xeb'));}if(!this['isConfigured'](_0x4db9ad['client_email'])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xec'));}if(!this[_0xbb10('0x7f')](_0x4db9ad[_0xbb10('0xed')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xee'));}if(!this['isConfigured'](_0x4db9ad[_0xbb10('0x7a')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xef'));}if(!this['isConfigured'](_0x4db9ad[_0xbb10('0x58')])){return this['channel']['noop'](_0xbb10('0xa4'));}this[_0xbb10('0xf')][_0xbb10('0xe5')]=!![];this[_0xbb10('0x34')](_0x4db9ad);this[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x58')],'in','','');this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xf0'),_0x4db9ad[_0xbb10('0x58')]));var _0x3ccc6c=this[_0xbb10('0x78')][_0xbb10('0x6e')](this,_0x4db9ad);if(_0x3ccc6c){for(var _0x553c92 in _0x3ccc6c){if(_0x3ccc6c[_0xbb10('0x8f')](_0x553c92)){if(_0x553c92!==_0xbb10('0xf1')){this[_0xbb10('0xf')]['setVariable'](util['format'](_0xbb10('0xf2'),_0x553c92[_0xbb10('0x67')]()),_0x3ccc6c[_0x553c92]);}}}this[_0xbb10('0x3f')](_0x3ccc6c[_0xbb10('0xe9')],_0xbb10('0xe7'),_0xbb10('0xea'),_0x3ccc6c[_0xbb10('0xf1')]);return this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xf3'),_0x3ccc6c['speech']));}return this['channel']['error'](_0x4db9ad,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xbb10('0x15')][_0xbb10('0xf4')]=function(_0xc92215){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0xf5'),_0xc92215['label']));if(!this[_0xbb10('0x7f')](_0xc92215[_0xbb10('0xf6')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xf7'));}if(!this[_0xbb10('0x7f')](_0xc92215[_0xbb10('0xf8')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xf9'));}if(!this[_0xbb10('0x7f')](_0xc92215[_0xbb10('0xfa')])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xfb'));}if(!this[_0xbb10('0x7f')](_0xc92215['ndassistant_url'])){return this[_0xbb10('0xf')]['noop'](_0xbb10('0xa4'));}this[_0xbb10('0xf')][_0xbb10('0xe5')]=!![];this[_0xbb10('0x34')](_0xc92215);this[_0xbb10('0x3f')](_0xc92215['text'],'in','','');this['channel'][_0xbb10('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0xc92215[_0xbb10('0x58')]));var _0x5621b1=this[_0xbb10('0x7b')][_0xbb10('0x6e')](this,_0xc92215);if(_0x5621b1){for(var _0x3f0a4e in _0x5621b1){if(_0x5621b1[_0xbb10('0x8f')](_0x3f0a4e)){this[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0xfc'),_0x3f0a4e['toUpperCase']()),_0x5621b1[_0x3f0a4e]);}}this[_0xbb10('0x3f')](_0x5621b1['speech'],_0xbb10('0xe7'),'sesteknda','');if(_0x5621b1[_0xbb10('0xfd')]){this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0xfe'),_0x5621b1[_0xbb10('0xfd')]));var _0x5ef974=this[_0xbb10('0xf')][_0xbb10('0xff')](_0x5621b1[_0xbb10('0xfd')]);try{fs['unlink'](_0x5621b1[_0xbb10('0xfd')]+_0xbb10('0x100'));}catch(_0x46df90){logger['error'](_0x46df90);}return _0x5ef974;}else{return this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x101'),_0x5621b1[_0xbb10('0xe9')]));}}return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0xc92215,_0xbb10('0x102'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x103')]=function(_0x28d6ab){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x28d6ab[_0xbb10('0x35')]));return this[_0xbb10('0xf')][_0xbb10('0xa3')]('end');};AGIVertices[_0xbb10('0x15')][_0xbb10('0x104')]=function(_0x132932){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x105'),_0x132932[_0xbb10('0x35')]));var _0x2035e1='';if(_0x132932[_0xbb10('0x106')]){if(!this['isConfigured'](_0x132932[_0xbb10('0x106')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x132932,_0xbb10('0x107'));}else{var _0x4d49a7=parseInt(_0x132932[_0xbb10('0x106')],0xa);if(isNaN(_0x4d49a7)){_0x2035e1=_0x132932[_0xbb10('0x106')];}else{_0x2035e1=this[_0xbb10('0x1f')]['sync'](this,_0x132932['trunk_id']);if(!_0x2035e1){return this[_0xbb10('0xf')]['error'](_0x132932,_0xbb10('0x108'));}}}}else if(_0x132932['trunk_name']){_0x2035e1=_0x132932[_0xbb10('0x109')];}else{return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x132932,_0xbb10('0x107'));}var _0x15e930=this[_0xbb10('0xf')][_0xbb10('0x55')]('DIAL',[util[_0xbb10('0x98')](_0xbb10('0x10a'),_0x2035e1,_0x132932[_0xbb10('0x46')]),_0x132932[_0xbb10('0x62')],_0x132932[_0xbb10('0x10b')],_0x132932[_0xbb10('0x60')]]);if(_0x15e930['result']===-0x1){return _0x15e930;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xe1'),_0xbb10('0xe0')));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x10c')]=function(_0x4f3f44){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x10d'),_0x4f3f44['label']));return this[_0xbb10('0xf')]['noop'](_0xbb10('0x10c'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0xd')]=function(_0x58a447){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x10e'),_0x58a447[_0xbb10('0x35')]));if(_0x58a447[_0xbb10('0xa1')]===0x0){return this[_0xbb10('0xa0')](_0x58a447);}_0x58a447[_0xbb10('0xa1')]-=0x1;if(!this[_0xbb10('0x7f')](_0x58a447[_0xbb10('0x10f')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x58a447,_0xbb10('0x110'));}var _0x5d8005=this['getSound'][_0xbb10('0x6e')](this,_0x58a447[_0xbb10('0x10f')]);if(!_0x5d8005){return this['channel']['error'](_0x58a447,_0xbb10('0x111'));}if(!this[_0xbb10('0x7f')](_0x58a447[_0xbb10('0xd3')])){return this['channel'][_0xbb10('0x2c')](_0xbb10('0xd4'));}var _0x578793=this[_0xbb10('0xf')][_0xbb10('0x112')](_0x5d8005,_0x58a447['response'],_0x58a447['maxdigit']);var _0x3eb533=_0x578793[_0xbb10('0x9e')]?_0x578793[_0xbb10('0x9e')]['toString']():'';logger['info'](_0xbb10('0x113'),JSON[_0xbb10('0x72')](_0x578793));if(_0x578793['result']===-0x1){this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x58a447,_0x3eb533);return _0x578793;}else if(_0x578793['extra']===_0xbb10('0x62')){_0x578793[_0xbb10('0x9e')]=_0x3eb533[_0xbb10('0x96')]>=parseInt(_0x58a447[_0xbb10('0x114')])?'x':'i';}else{_0x578793['result']=_0x3eb533[_0xbb10('0x96')]>=parseInt(_0x58a447['mindigit'])&&_0x3eb533[_0xbb10('0x96')]<=parseInt(_0x58a447[_0xbb10('0x115')])?'x':'i';}var _0x2aaf70=this[_0xbb10('0x11')][_0xbb10('0x6e')](this,_0x58a447[_0xbb10('0xd3')]);if(!_0x2aaf70){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x58a447,'no\x20variable\x20found');}this[_0xbb10('0xf')][_0xbb10('0x9a')](_0x2aaf70,_0x3eb533);if(this[_0xbb10('0x7f')](_0x58a447[_0xbb10('0x116')])){var _0x4b0f04=parseInt(_0x58a447['hiddendigitsnum'],0xa);var _0xd23108=rs[_0xbb10('0x117')]({'charset':'*','length':_0x4b0f04});var _0x183503=_0x3eb533[_0xbb10('0x96')];if(_0x183503>0x0){if(_0x183503>_0x4b0f04){this['createSquareDetailsReport'][_0xbb10('0x6e')](this,_0x58a447,_0x58a447[_0xbb10('0x118')]==='first'?_0xd23108+_0x3eb533[_0xbb10('0x119')](_0x4b0f04):_0x3eb533['substr'](0x0,_0x183503-_0x4b0f04)+_0xd23108);}else{this['createSquareDetailsReport'][_0xbb10('0x6e')](this,_0x58a447,rs[_0xbb10('0x117')]({'charset':'*','length':_0x183503}));}}else{this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x58a447,'');}}else{this[_0xbb10('0x34')]['sync'](this,_0x58a447,_0x3eb533);}return _0x578793;};AGIVertices[_0xbb10('0x15')][_0xbb10('0xe')]=function(_0x356601){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x11a'),_0x356601[_0xbb10('0x35')]));return this[_0xbb10('0xd')](_0x356601);};AGIVertices[_0xbb10('0x15')][_0xbb10('0x11b')]=function(_0x368adb){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x11c'),_0x368adb[_0xbb10('0x35')]));this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x368adb,_0x368adb[_0xbb10('0x11d')]);return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x11e'),_0x368adb[_0xbb10('0x11d')]));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x11f')]=function(_0x2f38d3){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x120'),_0x2f38d3[_0xbb10('0x35')]));if(!this['isConfigured'](_0x2f38d3[_0xbb10('0x82')])||!this[_0xbb10('0x7f')](_0x2f38d3['aws_secret_access_key'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xbb10('0x7f')](_0x2f38d3[_0xbb10('0x58')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20text\x20configured');}this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x121'),_0x2f38d3['text']));var _0x407ce9=this[_0xbb10('0x81')][_0xbb10('0x6e')](this,_0x2f38d3);if(_0x407ce9){this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x122'),_0x407ce9));var _0x135604=this[_0xbb10('0xf')][_0xbb10('0xff')](_0x407ce9);try{fs[_0xbb10('0x123')](_0x407ce9+'.wav');}catch(_0xbbbf68){logger[_0xbb10('0x2c')](_0xbbbf68);}return _0x135604;}return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x2f38d3,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xbb10('0x124')]=function(_0x448a92){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x448a92[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x448a92[_0xbb10('0x82')])||!this['isConfigured'](_0x448a92['aws_secret_access_key'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x448a92[_0xbb10('0x125')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x126'));}if(!this[_0xbb10('0x7f')](_0x448a92[_0xbb10('0x58')])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xa4'));}this[_0xbb10('0xf')][_0xbb10('0xe5')]=!![];this[_0xbb10('0x34')](_0x448a92);this[_0xbb10('0x3f')](_0x448a92[_0xbb10('0x58')],'in','','');this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')]('Trying\x20Amazon\x20Lex:\x20%s',_0x448a92[_0xbb10('0x58')]));var _0x304d0d=this['awsLex']['sync'](this,_0x448a92);if(_0x304d0d){for(var _0x498c54 in _0x304d0d){if(_0x304d0d['hasOwnProperty'](_0x498c54)&&_['isString'](_0x304d0d[_0x498c54])){this['channel']['setVariable'](util['format'](_0xbb10('0x127'),_0x498c54[_0xbb10('0x67')]()),_0x304d0d[_0x498c54]);}}if(_['isNil'](_0x304d0d[_0xbb10('0x128')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x129'));}else{this[_0xbb10('0x3f')](_0x304d0d[_0xbb10('0x128')],_0xbb10('0xe7'),_0xbb10('0x12a'),'');return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x12b'),_0x304d0d['message']));}}return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x448a92,_0xbb10('0x12c'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x12d')]=function(_0x52e1c1){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x52e1c1[_0xbb10('0x35')],_0x52e1c1[_0xbb10('0x62')]));if(!this['isConfigured'](_0x52e1c1[_0xbb10('0x77')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xe4'));}var _0x3333cb='wav';var _0x486a2f=util[_0xbb10('0x98')](_0xbb10('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x108f23=util[_0xbb10('0x98')](_0xbb10('0x99'),_0x486a2f,_0x3333cb);var _0x1a2f42=!![];if(_0x52e1c1[_0xbb10('0x12f')]===_0xbb10('0x130')){_0x1a2f42=![];}var _0x1d941c=this[_0xbb10('0xf')][_0xbb10('0x131')](_0x486a2f,_0x3333cb,_0x52e1c1['intKey'],_0x52e1c1[_0xbb10('0x62')],undefined,_0x1a2f42);if(_0x1d941c[_0xbb10('0x9e')]!==-0x1){this[_0xbb10('0xf')][_0xbb10('0xa3')](util['format'](_0xbb10('0x132'),_0x108f23));var _0x22ffc6=this['googleASR']['sync'](this,_0x52e1c1,_0x108f23);if(_0x22ffc6){for(var _0xeac82d in _0x22ffc6){if(_0x22ffc6['hasOwnProperty'](_0xeac82d)){this[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0x133'),_0xeac82d['toUpperCase']()),_0x22ffc6[_0xeac82d]);}}return this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x134'),JSON[_0xbb10('0x72')](_0x22ffc6)));}}return _0x1d941c;};AGIVertices[_0xbb10('0x15')][_0xbb10('0x135')]=function(_0x1507c6){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x136'),_0x1507c6['label']));if(!this[_0xbb10('0x7f')](_0x1507c6[_0xbb10('0x8c')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x137'));}if(!this['isConfigured'](_0x1507c6[_0xbb10('0x138')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x139'));}var _0x35e49a='wav';var _0x5f1495=util['format'](_0xbb10('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x5dd7bb=util[_0xbb10('0x98')]('%s.%s',_0x5f1495,_0x35e49a);var _0x3c5a32=!![];if(_0x1507c6[_0xbb10('0x12f')]==='NOBEEP'){_0x3c5a32=![];}var _0x129fde=this[_0xbb10('0xf')][_0xbb10('0x131')](_0x5f1495,_0x35e49a,_0x1507c6[_0xbb10('0x13a')],_0x1507c6['timeout'],undefined,_0x3c5a32);if(_0x129fde['result']!==-0x1){this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')]('tilde\x20%s\x20file\x20created',_0x5dd7bb));var _0x31c019=this[_0xbb10('0x8b')][_0xbb10('0x6e')](this,_0x1507c6,_0x5dd7bb);if(_0x31c019){for(var _0x33a92a in _0x31c019){if(_0x31c019[_0xbb10('0x8f')](_0x33a92a)){this['channel'][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0x13b'),_0x33a92a['toUpperCase']()),_0x31c019[_0x33a92a]);}}return this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x13c'),JSON[_0xbb10('0x72')](_0x31c019)));}}return _0x129fde;};AGIVertices['prototype'][_0xbb10('0x13d')]=function(_0x2dbb66){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x13e'),_0x2dbb66[_0xbb10('0x35')]));return this[_0xbb10('0xf')][_0xbb10('0x13f')](_0x2dbb66['context'],_0x2dbb66['extension'],_0x2dbb66[_0xbb10('0x3d')]);};AGIVertices[_0xbb10('0x15')][_0xbb10('0x140')]=function(_0x1b0734){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x141'),_0x1b0734[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x1b0734[_0xbb10('0x142')])){return this[_0xbb10('0xf')]['error'](_0x1b0734,'no\x20condition\x20configured');}try{var _0x2f675c=eval(_0x1b0734[_0xbb10('0x142')])?_0xbb10('0x143'):_0xbb10('0x144');this['channel']['noop'](util[_0xbb10('0x98')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1b0734['condition'],_0x2f675c));return{'code':0xc8,'result':_0x2f675c};}catch(_0x4e2dbb){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xbb10('0x15')][_0xbb10('0x145')]=function(_0x8dfa5e){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x8dfa5e[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x8dfa5e[_0xbb10('0x146')])){return this['channel'][_0xbb10('0x2c')](_0x8dfa5e,_0xbb10('0x147'));}var _0x148e41=this[_0xbb10('0x148')][_0xbb10('0x6e')](this,_0x8dfa5e[_0xbb10('0x146')]);if(!_0x148e41){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x8dfa5e,_0xbb10('0x149'));}for(var _0x46aff8=0x0;_0x46aff8<_0x148e41[_0xbb10('0x96')];_0x46aff8+=0x1){var _0x1c51f1=this[_0xbb10('0xf')][_0xbb10('0x11')](util[_0xbb10('0x98')]('IFTIME(%s?true:false)',_0x148e41[_0x46aff8]));if(_0x1c51f1['result']===-0x1){return _0x1c51f1;}logger['info'](util[_0xbb10('0x98')]('IFTIME\x20%s\x20%s',_0x148e41[_0x46aff8],_0x1c51f1[_0xbb10('0x9c')]));if(_0x1c51f1['extra']===_0xbb10('0x143')){logger['info'](util['format'](_0xbb10('0x14a'),_0x148e41[_0x46aff8],_0xbb10('0x143')));this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x14a'),_0x148e41[_0x46aff8],_0xbb10('0x143')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xbb10('0x98')](_0xbb10('0x14a'),_0x148e41[_0x46aff8],_0xbb10('0x144')));this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x14a'),_0x148e41[_0x46aff8],'false'));}}return{'code':0xc8,'result':_0xbb10('0x144')};};AGIVertices['prototype']['hangup']=function(_0xd11ff7){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x14b'),_0xd11ff7[_0xbb10('0x35')]));return this[_0xbb10('0xf')][_0xbb10('0x14c')]();};AGIVertices['prototype'][_0xbb10('0x14d')]=function(_0x39c814){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x14e'),_0x39c814[_0xbb10('0x35')]));if(!this['isConfigured'](_0x39c814['key'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xe4'));}var _0x35971b=_0xbb10('0x14f');var _0x4dbc8c=util['format'](_0xbb10('0x12e'),FILES_PATH,rs[_0xbb10('0x117')](0x4));var _0x536519=util['format'](_0xbb10('0x99'),_0x4dbc8c,_0x35971b);var _0xed53e6=!![];if(_0x39c814[_0xbb10('0x12f')]===_0xbb10('0x130')){_0xed53e6=![];}var _0x170e2a=this[_0xbb10('0xf')]['recordFile'](_0x4dbc8c,_0x35971b,_0x39c814[_0xbb10('0x13a')],_0x39c814[_0xbb10('0x62')],undefined,_0xed53e6);if(_0x170e2a[_0xbb10('0x9e')]!==-0x1){this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x150'),_0x536519));var _0x22e865=this[_0xbb10('0x7d')]['sync'](this,_0x39c814,_0x536519);if(_0x22e865){for(var _0x54bf10 in _0x22e865){if(_0x22e865['hasOwnProperty'](_0x54bf10)){this[_0xbb10('0xf')][_0xbb10('0x9a')](util[_0xbb10('0x98')](_0xbb10('0x151'),_0x54bf10['toUpperCase']()),_0x22e865[_0x54bf10]);}}return this['channel']['noop'](util[_0xbb10('0x98')](_0xbb10('0x152'),JSON[_0xbb10('0x72')](_0x22e865)));}}return _0x170e2a;};AGIVertices[_0xbb10('0x15')][_0xbb10('0x153')]=function(_0x4065f5){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x154'),_0x4065f5[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x4065f5[_0xbb10('0x77')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20key\x20configured');}if(!this[_0xbb10('0x7f')](_0x4065f5[_0xbb10('0x58')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xa4'));}this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x155'),_0x4065f5[_0xbb10('0x58')]));var _0x2de756=this[_0xbb10('0x7c')][_0xbb10('0x6e')](this,_0x4065f5);if(_0x2de756){this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')]('ispeech\x20%s\x20file\x20created',_0x2de756));var _0x1384cf=this[_0xbb10('0xf')][_0xbb10('0xff')](_0x2de756,_0x4065f5[_0xbb10('0x13a')]);try{fs[_0xbb10('0x123')](_0x2de756+_0xbb10('0x100'));}catch(_0x407413){logger[_0xbb10('0x2c')](_0x407413);}return _0x1384cf;}return this[_0xbb10('0xf')]['error'](_0x4065f5,_0xbb10('0x156'));};AGIVertices['prototype'][_0xbb10('0x157')]=function(_0x2cd1b0){logger['info'](util['format'](_0xbb10('0x158'),_0x2cd1b0[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x2cd1b0[_0xbb10('0x159')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x2cd1b0,_0xbb10('0x15a'));}logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x15b'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x2cd1b0[_0xbb10('0x159')]));var _0x2f76=this[_0xbb10('0x51')]['sync'](this,_0x2cd1b0[_0xbb10('0x159')]);if(_0x2f76){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x15c'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x2cd1b0[_0xbb10('0x159')]));this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this['channel']['callerid'],_0x2cd1b0[_0xbb10('0x159')]));return{'code':0xc8,'result':_0xbb10('0x15d')};}else{logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x15e'),this['channel'][_0xbb10('0x38')],_0x2cd1b0[_0xbb10('0x159')]));this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x15e'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x2cd1b0['findBy']));return{'code':0xc8,'result':_0xbb10('0x15f')};}};AGIVertices[_0xbb10('0x15')]['logout']=function(_0x358e1c){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x160'),_0x358e1c[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x358e1c[_0xbb10('0x159')])){return this['channel'][_0xbb10('0x2c')](_0x358e1c,_0xbb10('0x15a'));}logger[_0xbb10('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbb10('0xf')][_0xbb10('0x38')],_0x358e1c[_0xbb10('0x159')]));var _0x2a13d7=this['agentLogout'][_0xbb10('0x6e')](this,_0x358e1c[_0xbb10('0x159')]);if(_0x2a13d7){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this['channel']['callerid'],_0x358e1c[_0xbb10('0x159')]));this[_0xbb10('0xf')]['noop'](util['format'](_0xbb10('0x15c'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x358e1c[_0xbb10('0x159')]));return{'code':0xc8,'result':_0xbb10('0x15d')};}else{logger[_0xbb10('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbb10('0xf')][_0xbb10('0x38')],_0x358e1c[_0xbb10('0x159')]));this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbb10('0xf')][_0xbb10('0x38')],_0x358e1c[_0xbb10('0x159')]));return{'code':0xc8,'result':_0xbb10('0x15f')};}};AGIVertices['prototype'][_0xbb10('0x161')]=function(_0x264e0e){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x162'),_0x264e0e[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x264e0e[_0xbb10('0x163')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x264e0e,_0xbb10('0x164'));}this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x165'),_0x264e0e['operation']));var _0x1baf96=eval(_0x264e0e[_0xbb10('0x163')]);if(!this[_0xbb10('0x7f')](_0x264e0e['variable_id'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xd4'));}var _0x252d41=this[_0xbb10('0x11')][_0xbb10('0x6e')](this,_0x264e0e['variable_id']);if(!_0x252d41){return this[_0xbb10('0xf')]['error'](_0x264e0e,_0xbb10('0xd5'));}if(_[_0xbb10('0x95')](_0x1baf96)){var _0x2e453a=this;_0x1baf96[_0xbb10('0xd6')](function(_0x55e1a6,_0x163b23){_0x2e453a[_0xbb10('0xf')]['setVariable'](util[_0xbb10('0x98')]('%s[%s]',_0x252d41,_0x163b23),_0x55e1a6);});return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x166'),_0x252d41));}else{return this[_0xbb10('0xf')][_0xbb10('0x9a')](_0x252d41,_0x1baf96);}};AGIVertices[_0xbb10('0x15')][_0xbb10('0xc')]=function(_0x55ee36){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x167'),_0x55ee36[_0xbb10('0x35')]));if(_0x55ee36[_0xbb10('0xa1')]===0x0){return this[_0xbb10('0xa0')](_0x55ee36);}_0x55ee36[_0xbb10('0xa1')]-=0x1;if(!this[_0xbb10('0x7f')](_0x55ee36[_0xbb10('0x10f')])){return this[_0xbb10('0xf')]['error'](_0x55ee36,_0xbb10('0x110'));}var _0x4f4e44=this[_0xbb10('0x20')][_0xbb10('0x6e')](this,_0x55ee36['file_id']);if(!_0x4f4e44){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x55ee36,_0xbb10('0x111'));}var _0x23faed=this[_0xbb10('0xf')][_0xbb10('0x112')](_0x4f4e44,_0x55ee36[_0xbb10('0x168')],_0x55ee36[_0xbb10('0x169')]);var _0x31875c=_0x23faed[_0xbb10('0x9e')];if(_0x23faed['result']===-0x1){this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x55ee36,'-1');return _0x23faed;}else if(_0x23faed[_0xbb10('0x9c')]===_0xbb10('0x62')){_0x23faed[_0xbb10('0x9e')]=_0x23faed[_0xbb10('0x9e')][_0xbb10('0x96')]>0x0?_0x23faed[_0xbb10('0x9e')]:'t';}else if(_[_0xbb10('0x42')](_0x23faed[_0xbb10('0x9e')])){_0x23faed[_0xbb10('0x9e')]='#';_0x31875c='#';}if(!this['isConfigured'](_0x55ee36[_0xbb10('0xd3')])){this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x488d91=this[_0xbb10('0x11')]['sync'](this,_0x55ee36[_0xbb10('0xd3')]);if(!_0x488d91){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x55ee36,_0xbb10('0xd5'));}this[_0xbb10('0xf')]['setVariable'](_0x488d91,_0x31875c);}this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x55ee36,_0x31875c);return _0x23faed;};AGIVertices[_0xbb10('0x15')][_0xbb10('0xa3')]=function(_0x46b106){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x46b106[_0xbb10('0x35')]));return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0x46b106[_0xbb10('0x16a')]||_0x46b106[_0xbb10('0x35')]);};AGIVertices['prototype'][_0xbb10('0x16b')]=function(_0x3b73d4){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x16c'),_0x3b73d4['label']));if(!this[_0xbb10('0x7f')](_0x3b73d4[_0xbb10('0x159')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x3b73d4,_0xbb10('0x15a'));}logger[_0xbb10('0x2e')](util[_0xbb10('0x98')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xbb10('0x38')],_0x3b73d4[_0xbb10('0x159')]));var _0x598ecb=this[_0xbb10('0x16d')][_0xbb10('0x6e')](this,_0x3b73d4[_0xbb10('0x16e')]);var _0x300b74=this[_0xbb10('0x4d')][_0xbb10('0x6e')](this,_0x3b73d4['findBy'],_0x598ecb);if(_0x300b74){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this[_0xbb10('0xf')]['callerid'],_0x3b73d4['findBy']));this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x3b73d4[_0xbb10('0x159')]));return{'code':0xc8,'result':_0xbb10('0x15d')};}else{logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x15e'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x3b73d4[_0xbb10('0x159')]));this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x3b73d4[_0xbb10('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbb10('0x15')][_0xbb10('0x16f')]=function(_0x3a0943){logger['info'](util['format'](_0xbb10('0x170'),_0x3a0943['label']));if(!this[_0xbb10('0x7f')](_0x3a0943[_0xbb10('0x10f')])){return this['channel']['error'](_0x3a0943,_0xbb10('0x110'));}var _0x14daaa=this['getSound'][_0xbb10('0x6e')](this,_0x3a0943[_0xbb10('0x10f')]);if(!_0x14daaa){return this[_0xbb10('0xf')]['error'](_0x3a0943,_0xbb10('0x111'));}var _0xb499a0=this[_0xbb10('0xf')]['exec'](_0xbb10('0x171'),[_0x14daaa,_0x3a0943['opts']]);if(_0xb499a0[_0xbb10('0x9e')]===-0x1){return _0xb499a0;}return this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x172'),_0xbb10('0x171'),_0x14daaa));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x173')]=function(_0x33e548){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x174'),_0x33e548[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x33e548['queue_id'])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x33e548,_0xbb10('0x175'));}var _0x4cd81a='';var _0x31fee1=parseInt(_0x33e548[_0xbb10('0x176')],0xa);if(isNaN(_0x31fee1)){_0x4cd81a=_0x33e548[_0xbb10('0x176')];}else{_0x4cd81a=this[_0xbb10('0x16')]['sync'](this,_0x33e548[_0xbb10('0x176')]);if(!_0x4cd81a){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x33e548,_0xbb10('0x177'));}}var _0x2a77ab='';if(this[_0xbb10('0x7f')](_0x33e548[_0xbb10('0x10f')])){var _0x43201c=this[_0xbb10('0x20')][_0xbb10('0x6e')](this,_0x33e548[_0xbb10('0x10f')]);if(_0x43201c){_0x2a77ab=_0x43201c;}}this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x33e548,_0x4cd81a);if(_0x33e548[_0xbb10('0x10b')][_0xbb10('0x178')]('x')<0x0){_0x33e548['opts']+='x';}if(_0x33e548[_0xbb10('0x10b')]['indexOf']('X')<0x0){_0x33e548['opts']+='X';}this['channel'][_0xbb10('0x9a')]('XMCS-QUEUE',_0x4cd81a?_0x4cd81a[_0xbb10('0x179')]():'');var _0x4adf02=this['channel'][_0xbb10('0x55')]('QUEUE',[_0x4cd81a,_0x33e548[_0xbb10('0x10b')],_0x33e548[_0xbb10('0x60')],_0x2a77ab,_0x33e548[_0xbb10('0x62')],_0x33e548[_0xbb10('0x7')],_0x33e548['macro'],_0x33e548[_0xbb10('0x17a')],'',_0x33e548[_0xbb10('0x17b')]]);if(_0x4adf02[_0xbb10('0x9e')]===-0x1){return _0x4adf02;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')]('Executed\x20command\x20%s\x20%s',_0xbb10('0x17c'),_0x4cd81a));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x17d')]=function(_0x12be2f){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x17e'),_0x12be2f[_0xbb10('0x35')]));var _0x3982dd=_0x12be2f[_0xbb10('0x17f')]||'wav';var _0x5b8ffd=util['format'](_0xbb10('0x180'),this[_0xbb10('0xf')]['uniqueid'],rs[_0xbb10('0x117')](0x5));var _0x28bff2=util['format'](_0xbb10('0x181'),FILES_PATH,_0x5b8ffd,_0x3982dd);var _0x836686=util[_0xbb10('0x98')](_0xbb10('0x12e'),FILES_PATH,_0x5b8ffd);this[_0xbb10('0x39')][_0xbb10('0x6e')](this,_0x12be2f,_0x5b8ffd,_0x28bff2);this[_0xbb10('0xf')][_0xbb10('0x9a')](_0xbb10('0x182'),_0x5b8ffd);logger['info'](_0xbb10('0x183'),_0x836686,_0x3982dd,_0x12be2f[_0xbb10('0x184')],_0x12be2f[_0xbb10('0x62')]);return this[_0xbb10('0xf')]['recordFile'](_0x836686,_0x3982dd,_0x12be2f[_0xbb10('0x184')],_0x12be2f[_0xbb10('0x62')],undefined,!![]);};AGIVertices[_0xbb10('0x15')][_0xbb10('0x185')]=function(_0xcb30de){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x186'),_0xcb30de['label']));if(!this[_0xbb10('0x7f')](_0xcb30de['url'])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x187'));}var _0x5a9680=this[_0xbb10('0x5f')][_0xbb10('0x6e')](this,_0xcb30de);logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x188'),util[_0xbb10('0x189')](_0x5a9680,{'showHidden':![],'depth':null})));if(!this[_0xbb10('0x7f')](_0xcb30de[_0xbb10('0xd3')])){return this[_0xbb10('0xf')]['noop'](_0xbb10('0x18a'));}var _0x571505=this[_0xbb10('0x11')][_0xbb10('0x6e')](this,_0xcb30de[_0xbb10('0xd3')]);if(!_0x571505){return this[_0xbb10('0xf')]['error'](_0xcb30de,_0xbb10('0xd5'));}this[_0xbb10('0xf')]['setVariable'](util[_0xbb10('0x98')](_0xbb10('0x18b'),_0x571505),_0x5a9680[_0xbb10('0x74')]?_0x5a9680[_0xbb10('0x74')]:'200');this[_0xbb10('0xf')]['setVariable'](util[_0xbb10('0x98')]('%s_STATUS_MESSAGE',_0x571505),_0x5a9680[_0xbb10('0x18c')]?_0x5a9680[_0xbb10('0x18c')]:'OK');if(_0x5a9680[_0xbb10('0x68')]){try{this[_0xbb10('0x97')](_0x5a9680[_0xbb10('0x68')],_0x571505);}catch(_0x1ba03d){logger[_0xbb10('0x2c')](util[_0xbb10('0x98')](_0xbb10('0x18d'),_0x571505));}}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0xda'),_0x571505));};AGIVertices[_0xbb10('0x15')]['saydigits']=function(_0x572521){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x18e'),_0x572521[_0xbb10('0x35')]));return this['channel'][_0xbb10('0x18f')](_0x572521[_0xbb10('0x190')][_0xbb10('0x191')](/\s+/g,''),_0x572521[_0xbb10('0x184')]);};AGIVertices['prototype']['saynumber']=function(_0x45a017){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x192'),_0x45a017['label']));return this[_0xbb10('0xf')][_0xbb10('0x193')](_0x45a017[_0xbb10('0x63')]['replace'](/\s+/g,''),_0x45a017['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x2bb476){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x194'),_0x2bb476[_0xbb10('0x35')]));return this[_0xbb10('0xf')]['sayPhonetic'](_0x2bb476['text'],_0x2bb476['escape_digits']);};AGIVertices[_0xbb10('0x15')][_0xbb10('0x195')]=function(_0x4f1723){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x196'),_0x4f1723[_0xbb10('0x35')]));if(!this['isConfigured'](_0x4f1723[_0xbb10('0x197')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')]('no\x20mail\x20account\x20configured');}var _0x38fc36=this[_0xbb10('0x198')][_0xbb10('0x6e')](this,_0x4f1723[_0xbb10('0x197')]);if(!_0x38fc36||!_0x38fc36[_0xbb10('0x199')]){return this[_0xbb10('0xf')]['error'](_0x4f1723,'no\x20mail\x20account\x20found');}var _0x7ec999={'from':util['format']('\x22%s\x22\x20<%s>',_0x38fc36[_0xbb10('0x13')],_0x38fc36[_0xbb10('0x19a')]||_0x38fc36[_0xbb10('0x199')][_0xbb10('0x19b')]),'to':_0x4f1723['to']||'','cc':_0x4f1723['cc']||'','bcc':_0x4f1723[_0xbb10('0x19c')]||'','subject':_0x4f1723[_0xbb10('0x19d')],'html':_0x4f1723[_0xbb10('0x58')],'text':_0x4f1723['text']};if(this[_0xbb10('0x7f')](_0x4f1723[_0xbb10('0x19e')])){}logger[_0xbb10('0xdc')](_0xbb10('0x19f'),JSON[_0xbb10('0x72')](_0x7ec999));this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x4f1723,_0x4f1723[_0xbb10('0x197')]);this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x1a0'),_0x38fc36['name']));this['sendMailMessage'][_0xbb10('0x6e')](this,_0x38fc36['smtpOptions'],_0x7ec999);return this[_0xbb10('0xf')][_0xbb10('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xbb10('0x1a1')]=function(_0x3a69b3){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x1a2'),_0x3a69b3[_0xbb10('0x35')]));return this['channel'][_0xbb10('0xa3')](_0xbb10('0x1a3'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1a4')]=function(_0x5c472e){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x1a5'),_0x5c472e[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x5c472e[_0xbb10('0x1a6')])){return this[_0xbb10('0xf')]['noop']('no\x20sms\x20account\x20configured');}var _0x1d0eb5=this[_0xbb10('0x32')][_0xbb10('0x6e')](this,_0x5c472e[_0xbb10('0x1a6')]);if(!_0x1d0eb5){return this['channel'][_0xbb10('0x2c')](_0x5c472e,_0xbb10('0x1a7'));}var _0x32379b={'body':_0x5c472e[_0xbb10('0x1a8')],'phone':_0x5c472e['to']||'','SmsAccountId':_0x1d0eb5['id']};logger[_0xbb10('0xdc')](_0xbb10('0x1a9'),JSON[_0xbb10('0x72')](_0x32379b));this['createSquareDetailsReport'][_0xbb10('0x6e')](this,_0x5c472e,_0x5c472e[_0xbb10('0x1a6')]);this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x1aa'),_0x1d0eb5[_0xbb10('0x13')]));this[_0xbb10('0x33')]['sync'](this,_0x32379b);return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x1ab'));};AGIVertices['prototype']['set']=function(_0x152c97){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x1ac'),_0x152c97['label']));if(!this[_0xbb10('0x7f')](_0x152c97[_0xbb10('0xd3')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x152c97,'no\x20variable\x20selected');}var _0x36f733=this[_0xbb10('0x11')][_0xbb10('0x6e')](this,_0x152c97[_0xbb10('0xd3')]);if(!_0x36f733){return this[_0xbb10('0xf')]['error'](_0x152c97,_0xbb10('0xd5'));}return this[_0xbb10('0xf')][_0xbb10('0x9a')](_0x36f733,_0x152c97['variable_value']);};AGIVertices['prototype'][_0xbb10('0x1ad')]=function(_0x48c01f){logger[_0xbb10('0x2e')](util['format'](_0xbb10('0x1ae'),_0x48c01f[_0xbb10('0x35')]));this[_0xbb10('0xf')]['noop'](_0xbb10('0x1af'));if(_0x48c01f[_0xbb10('0xb3')]==='yes'){this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0x1b0'));return this['channel'][_0xbb10('0xb3')]();}return this['channel'][_0xbb10('0xa3')](_0xbb10('0x1b1'));};AGIVertices[_0xbb10('0x15')]['subproject']=function(_0x5c38c4){logger['info'](util[_0xbb10('0x98')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5c38c4[_0xbb10('0x35')]));if(!this['isConfigured'](_0x5c38c4[_0xbb10('0x1b2')])){return this[_0xbb10('0xf')]['error'](_0x5c38c4,'no\x20subproject\x20selected');}var _0x27f6e2=this[_0xbb10('0x19')]['sync'](this,_0x5c38c4[_0xbb10('0x1b2')]);if(!this[_0xbb10('0x7f')](_0x27f6e2)){return this[_0xbb10('0xf')]['error'](_0x5c38c4,util[_0xbb10('0x98')](_0xbb10('0x1b3'),_0x5c38c4[_0xbb10('0x1b2')]));}if(_0x27f6e2===this[_0xbb10('0xf')][_0xbb10('0x37')]){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x5c38c4,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xbb10('0x34')][_0xbb10('0x6e')](this,_0x5c38c4,_0x27f6e2);var _0x25ee83=this['channel'][_0xbb10('0x55')](_0xbb10('0x1b4'),util['format'](_0xbb10('0x1b5'),config[_0xbb10('0x7')][_0xbb10('0x1b6')]||_0xbb10('0x1b7'),_0x27f6e2,this[_0xbb10('0xf')][_0xbb10('0x37')]));if(_0x25ee83[_0xbb10('0x9e')]===-0x1){return _0x25ee83;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x172'),_0xbb10('0x1b4'),_0x27f6e2));};AGIVertices[_0xbb10('0x15')]['system']=function(_0x14bb29){logger[_0xbb10('0x2e')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x14bb29[_0xbb10('0x35')]));var _0x31d0fc=this[_0xbb10('0x1b8')][_0xbb10('0x6e')](this,_0x14bb29['command']);this[_0xbb10('0x34')]['sync'](this,_0x14bb29,_0x14bb29['command']);if(this['isConfigured'](_0x14bb29[_0xbb10('0xd3')])){var _0x383384=this[_0xbb10('0x11')][_0xbb10('0x6e')](this,_0x14bb29['variable_id']);if(_0x383384){this[_0xbb10('0xf')]['setVariable'](_0x383384,_0x31d0fc);return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x1b9'),_0x14bb29[_0xbb10('0xb1')],_0x383384));}}return this[_0xbb10('0xf')]['noop'](util['format'](_0xbb10('0x1ba'),_0x14bb29['command']));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1bb')]=function(_0x145426){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x1bc'),_0x145426[_0xbb10('0x35')]));_0x145426[_0xbb10('0x58')]=_0x145426[_0xbb10('0x58')][_0xbb10('0x191')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbb10('0x7f')](_0x145426['apiKey'])){return this[_0xbb10('0xf')]['noop'](_0xbb10('0x1bd'));}if(!this[_0xbb10('0x7f')](_0x145426[_0xbb10('0x58')])){return this[_0xbb10('0xf')][_0xbb10('0xa3')](_0xbb10('0xa4'));}this['channel'][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x1be'),_0x145426['text']));var _0x4a7cf9=this[_0xbb10('0x57')][_0xbb10('0x6e')](this,_0x145426);if(_0x4a7cf9){this['channel']['noop'](util[_0xbb10('0x98')](_0xbb10('0x1bf'),_0x4a7cf9));var _0xeb8dd3=this[_0xbb10('0xf')]['streamFile'](_0x4a7cf9);try{fs[_0xbb10('0x123')](_0x4a7cf9+_0xbb10('0x100'));}catch(_0x203661){logger[_0xbb10('0x2c')](_0x203661);}return _0xeb8dd3;}return this['channel']['error'](_0x145426,_0xbb10('0x1c0'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1c1')]=function(_0x98e790){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x1c2'),_0x98e790['label']));_0x98e790[_0xbb10('0x58')]=_0x98e790[_0xbb10('0x58')][_0xbb10('0x191')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbb10('0x7f')](_0x98e790['text'])){return this['channel'][_0xbb10('0xa3')](_0xbb10('0xa4'));}this[_0xbb10('0xf')][_0xbb10('0xa3')](util['format'](_0xbb10('0x1c3'),_0x98e790[_0xbb10('0x58')]));var _0x66a0b8=this[_0xbb10('0x5e')][_0xbb10('0x6e')](this,_0x98e790);if(_0x66a0b8){this[_0xbb10('0xf')]['noop'](util[_0xbb10('0x98')](_0xbb10('0x1c4'),_0x66a0b8));var _0x40acb4=this[_0xbb10('0xf')][_0xbb10('0xff')](_0x66a0b8);try{fs['unlink'](_0x66a0b8+_0xbb10('0x100'));}catch(_0x3bfcb9){logger[_0xbb10('0x2c')](_0x3bfcb9);}return _0x40acb4;}return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x98e790,_0xbb10('0x1c5'));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1c6')]=function(_0x429aa9){logger['info'](util[_0xbb10('0x98')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x429aa9[_0xbb10('0x35')]));if(!this[_0xbb10('0x7f')](_0x429aa9[_0xbb10('0x159')])){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x429aa9,_0xbb10('0x15a'));}logger['info'](util[_0xbb10('0x98')](_0xbb10('0x15b'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x429aa9[_0xbb10('0x159')]));var _0x2edab5=this['agentUnpause'][_0xbb10('0x6e')](this,_0x429aa9['findBy']);if(_0x2edab5){logger['info'](util[_0xbb10('0x98')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbb10('0xf')][_0xbb10('0x38')],_0x429aa9['findBy']));this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x15c'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x429aa9[_0xbb10('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x15e'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x429aa9[_0xbb10('0x159')]));this[_0xbb10('0xf')]['noop'](util['format'](_0xbb10('0x15e'),this[_0xbb10('0xf')][_0xbb10('0x38')],_0x429aa9['findBy']));return{'code':0xc8,'result':_0xbb10('0x15f')};}};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1c7')]=function(_0x410a5e){logger[_0xbb10('0x2e')](util[_0xbb10('0x98')](_0xbb10('0x1c8'),_0x410a5e[_0xbb10('0x35')]));var _0x48a25d=this[_0xbb10('0xf')][_0xbb10('0x55')]('VOICEMAIL',[_0x410a5e['mailbox'],_0x410a5e['options']]);if(_0x48a25d[_0xbb10('0x9e')]===-0x1){return _0x48a25d;}return this[_0xbb10('0xf')][_0xbb10('0xa3')](util[_0xbb10('0x98')](_0xbb10('0x172'),_0xbb10('0x1c9'),_0x410a5e[_0xbb10('0x1ca')]));};AGIVertices[_0xbb10('0x15')][_0xbb10('0x1cb')]=function(_0x2d208a){logger['info'](util[_0xbb10('0x98')](_0xbb10('0x1cc'),_0x2d208a['label']));if(!this[_0xbb10('0x7f')](_0x2d208a['variable_id'])){return this['channel']['error'](_0x2d208a,_0xbb10('0x1cd'));}var _0x40731b=this['getVariable'][_0xbb10('0x6e')](this,_0x2d208a[_0xbb10('0xd3')]);if(!_0x40731b){return this[_0xbb10('0xf')][_0xbb10('0x2c')](_0x2d208a,_0xbb10('0xd5'));}var _0x951d2c=this[_0xbb10('0xf')]['getVariable'](_0x40731b);return{'code':0xc8,'result':_0x951d2c[_0xbb10('0x9c')]?_0x951d2c['extra']:'-'};};String['prototype']['replaceAll']=function(_0x48c77c,_0x381119){return this[_0xbb10('0x9b')](_0x48c77c)[_0xbb10('0x1ce')](_0x381119);};module[_0xbb10('0x1cf')]=AGIVertices; \ No newline at end of file +var _0xc900=['response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','bcc','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','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','shellCommand','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','.wav','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','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','no\x20variable\x20selected','exports','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','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','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','phone','list_id','scheduledAt','callback','callback_priority','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','rawBody','parse','computedVariables','sync','uri','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','includes','clone','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','hasOwnProperty','saveRestApiResult','setVariable','%s.%s','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','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\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0xc900,0xb3));var _0x0c90=function(_0x5b771e,_0x7af498){_0x5b771e=_0x5b771e-0x0;var _0x43f282=_0xc900[_0x5b771e];return _0x43f282;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x0c90('0x0'));var odbc=require(_0x0c90('0x1'))();var rs=require(_0x0c90('0x2'));var moment=require('moment');var Mustache=require(_0x0c90('0x3'));var rp=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var shared=require(_0x0c90('0x7'));var scripts=require(_0x0c90('0x8'));var FILES_PATH=_0x0c90('0x9');var recursiveMapAttributes=[_0x0c90('0xa'),'rawBody'];var verticesWithRetry=[_0x0c90('0xb'),_0x0c90('0xc'),_0x0c90('0xd')];var AGIVertices=function(_0x29a7ba,_0x128656,_0x3d0f49){this[_0x0c90('0xe')]=_0x29a7ba;this[_0x0c90('0xf')]=_0x128656;this[_0x0c90('0x10')]=_0x3d0f49;};AGIVertices[_0x0c90('0x11')][_0x0c90('0x12')]=function(_0x467e4c,_0x3c3529){this['rpc'][_0x0c90('0x13')](_0x467e4c)['then'](function(_0x452bd1){_0x3c3529(null,_0x452bd1?_0x452bd1['name']:![]);})[_0x0c90('0x14')](function(_0x26fc46){_0x3c3529(_0x26fc46);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x15')]=function(_0x1b0a3a,_0x59ea8e){this[_0x0c90('0xf')][_0x0c90('0x16')](_0x1b0a3a)['then'](function(_0x2c82a4){_0x59ea8e(null,_0x2c82a4?_0x2c82a4[_0x0c90('0x17')]:![]);})[_0x0c90('0x14')](function(_0x5bef7d){_0x59ea8e(_0x5bef7d);});};AGIVertices['prototype'][_0x0c90('0x18')]=function(_0x15ca42,_0x2b8135){this[_0x0c90('0xf')][_0x0c90('0x19')](_0x15ca42)[_0x0c90('0x1a')](function(_0x42321a){_0x2b8135(null,_0x42321a?_0x42321a['name']:![]);})[_0x0c90('0x14')](function(_0x38becc){_0x2b8135(_0x38becc);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1b')]=function(_0x594267,_0x10a775){this[_0x0c90('0xf')][_0x0c90('0x1c')](_0x594267)[_0x0c90('0x1a')](function(_0x315932){_0x10a775(null,_0x315932?_0x315932[_0x0c90('0x1d')]:![]);})['catch'](function(_0x365a42){_0x10a775(_0x365a42);});};AGIVertices['prototype'][_0x0c90('0x1e')]=function(_0x1a021e,_0x47b13c){this[_0x0c90('0xf')][_0x0c90('0x1f')](_0x1a021e)[_0x0c90('0x1a')](function(_0x86dee){_0x47b13c(null,_0x86dee?_0x86dee[_0x0c90('0x17')]:![]);})[_0x0c90('0x14')](function(_0x4dfbc3){_0x47b13c(_0x4dfbc3);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x20')]=function(_0x5695a2,_0x54316b){this[_0x0c90('0xf')][_0x0c90('0x21')](_0x5695a2)[_0x0c90('0x1a')](function(_0x109a5f){_0x54316b(null,_0x109a5f?_0x109a5f['name']:![]);})[_0x0c90('0x14')](function(_0x438652){_0x54316b(_0x438652);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x22')]=function(_0x427c2b,_0x114589){var _0x492028=this;this[_0x0c90('0xf')][_0x0c90('0x23')](_0x427c2b)[_0x0c90('0x1a')](function(_0x13b377){_0x114589(null,_0x13b377?_0x492028['getSoundPath'](_0x13b377['save_name']):![]);})[_0x0c90('0x14')](function(_0x25da6e){_0x114589(_0x25da6e);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x24')]=function(_0x119e09,_0x562664){this[_0x0c90('0xf')][_0x0c90('0x25')](_0x119e09)[_0x0c90('0x1a')](function(_0x47a935){_0x562664(null,_0x47a935?_0x47a935:![]);})[_0x0c90('0x14')](function(_0x553498){_0x562664(_0x553498);});};AGIVertices['prototype'][_0x0c90('0x26')]=function(_0x5071b,_0x2f0835,_0x41189f){this['mailRpc'][_0x0c90('0x26')](_0x5071b,_0x2f0835)['then'](function(){_0x41189f(null);})[_0x0c90('0x14')](function(_0x5a0e75){_0x41189f(_0x5a0e75);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x27')]=function(_0x5e991e,_0x23bedd){this[_0x0c90('0xf')][_0x0c90('0x28')](_0x5e991e)[_0x0c90('0x1a')](function(_0x255c3f){if(_0x255c3f){if(_0x255c3f[_0x0c90('0x29')]){_0x23bedd(null,[_0x255c3f[_0x0c90('0x2a')]]);}else{_0x23bedd(null,_[_0x0c90('0x2b')](_0x255c3f['Intervals'],_0x0c90('0x2a')));}}else{_0x23bedd(null,![]);}})[_0x0c90('0x14')](function(_0x404f78){_0x23bedd(_0x404f78);});};AGIVertices[_0x0c90('0x11')]['getSoundPath']=function(_0x447987){return util[_0x0c90('0x2c')](_0x0c90('0x2d'),FILES_PATH,_0x447987);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x2e')]=function(_0x12d3e8,_0x4716f2,_0x435914){odbc['open'](_0x12d3e8,function(_0x16963d){if(_0x16963d){logger[_0x0c90('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x16963d);_0x435914(_0x16963d);}else{logger[_0x0c90('0x30')](_0x0c90('0x31'));odbc[_0x0c90('0x32')](_0x4716f2,function(_0x27f9ac,_0x141f91){if(_0x27f9ac){logger['info'](_0x0c90('0x33'),_0x4716f2);_0x435914(_0x27f9ac);}else{logger[_0x0c90('0x30')](_0x0c90('0x34'),_0x4716f2);odbc[_0x0c90('0x35')](function(_0x275cc1){if(_0x275cc1){logger[_0x0c90('0x2f')](_0x0c90('0x36'),_0x275cc1);}_0x435914(null,_0x141f91);});}});}});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x37')]=function(_0x4f0227,_0x2cd2c2){this['rpc'][_0x0c90('0x38')](_0x4f0227)['then'](function(_0xb126ef){_0x2cd2c2(null,_0xb126ef?_0xb126ef:![]);})[_0x0c90('0x14')](function(_0x49f8b4){_0x2cd2c2(_0x49f8b4);});};AGIVertices['prototype'][_0x0c90('0x39')]=function(_0x48813b,_0x3b33e3){this[_0x0c90('0xf')][_0x0c90('0x39')](_0x48813b)['then'](function(_0x2ad8eb){_0x3b33e3(null,_0x2ad8eb);})[_0x0c90('0x14')](function(_0x123b58){_0x3b33e3(_0x123b58);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x3a')]=function(_0x1184c4,_0x565b10,_0x424f78){this[_0x0c90('0xf')][_0x0c90('0x3a')]({'uniqueid':this[_0x0c90('0xe')][_0x0c90('0x3b')],'node':_0x1184c4[_0x0c90('0x3c')],'application':_0x1184c4[_0x0c90('0x3d')],'data':_0x565b10||null,'project_name':this['channel'][_0x0c90('0x3e')],'callerid':this['channel'][_0x0c90('0x3f')]})[_0x0c90('0x1a')](function(_0x1a7a36){if(_0x424f78){_0x424f78(null,_0x1a7a36);}})[_0x0c90('0x14')](function(_0x38842c){if(_0x424f78){_0x424f78(_0x38842c);}});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x40')]=function(_0x1d6f3a,_0x21632a,_0x2ee1b0,_0x460cd8){this[_0x0c90('0xf')][_0x0c90('0x40')]({'uniqueid':this[_0x0c90('0xe')][_0x0c90('0x3b')],'callerid':this['channel'][_0x0c90('0x3f')],'calleridname':this[_0x0c90('0xe')][_0x0c90('0x41')],'context':this[_0x0c90('0xe')][_0x0c90('0x42')],'extension':this[_0x0c90('0xe')][_0x0c90('0x43')],'priority':this[_0x0c90('0xe')][_0x0c90('0x44')],'accountcode':this[_0x0c90('0xe')][_0x0c90('0x45')],'dnid':this[_0x0c90('0xe')][_0x0c90('0x46')],'projectName':this[_0x0c90('0xe')]['arg_1'],'saveName':_0x21632a,'filename':_0x1d6f3a[_0x0c90('0x47')]||_0x21632a,'savePath':_0x2ee1b0})[_0x0c90('0x1a')](function(_0x553fea){_0x460cd8(null,_0x553fea);})['catch'](function(_0x4c81d1){_0x460cd8(_0x4c81d1);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x48')]=function(_0x460cf9,_0x3fbdfc,_0x11d2de,_0x594c73,_0x330739){this[_0x0c90('0xf')][_0x0c90('0x48')]({'uniqueid':this['channel'][_0x0c90('0x3b')],'body':_0x460cf9,'direction':_0x3fbdfc,'providerName':_0x11d2de,'providerResponse':_0x594c73})[_0x0c90('0x1a')](function(_0xd639a1){if(_0x330739){_0x330739(null,_0xd639a1);}})[_0x0c90('0x14')](function(_0xc449ea){if(_0x330739){_0x330739(_0xc449ea);}});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x49')]=function(_0x2a339d,_0x1daeed){this[_0x0c90('0xf')]['createCmContact']({'firstName':_[_0x0c90('0x4a')](_0x2a339d['name'])||_[_0x0c90('0x4b')](_0x2a339d[_0x0c90('0x17')])?_0x0c90('0x4c')+Math[_0x0c90('0x4d')]():_0x2a339d[_0x0c90('0x17')],'lastName':_[_0x0c90('0x4a')](_0x2a339d['lastName'])||_['isNil'](_0x2a339d['lastName'])?null:_0x2a339d['lastName'],'phone':_0x2a339d[_0x0c90('0x4e')],'ListId':_0x2a339d[_0x0c90('0x4f')],'scheduledat':_0x2a339d[_0x0c90('0x50')],'callbackUniqueid':this['channel'][_0x0c90('0x3b')],'tags':_0x0c90('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x2a339d[_0x0c90('0x50')]['toString'](),'priority':_0x2a339d[_0x0c90('0x52')]})[_0x0c90('0x1a')](function(_0x42398b){_0x1daeed(null,_0x42398b);})[_0x0c90('0x14')](function(_0x5d0393){_0x1daeed(_0x5d0393);});};AGIVertices[_0x0c90('0x11')]['getPause']=function(_0x344613,_0x2e79a4){this['rpc']['getPauseById'](_0x344613)['then'](function(_0x221fba){_0x2e79a4(null,_0x221fba?_0x221fba[_0x0c90('0x17')]:![]);})[_0x0c90('0x14')](function(_0x2f61cb){_0x2e79a4(_0x2f61cb);});};AGIVertices[_0x0c90('0x11')]['agentPause']=function(_0x3bfd01,_0x25ab13,_0x5ee971){var _0x3eb725={'role':'agent'};_0x3eb725[_0x3bfd01]=this[_0x0c90('0xe')][_0x0c90('0x3f')];this['rpc'][_0x0c90('0x53')](_0x3eb725,_0x25ab13,this['channel']['uniqueid'])['then'](function(_0x2e87c0){_0x5ee971(null,_[_0x0c90('0x4b')](_0x2e87c0)?![]:!![]);})[_0x0c90('0x14')](function(_0x5abd7b){logger['error'](_0x5abd7b);_0x5ee971(null,![]);});};AGIVertices['prototype'][_0x0c90('0x54')]=function(_0xd982c5,_0x120b88){var _0x4c4e5a={'role':_0x0c90('0x55')};_0x4c4e5a[_0xd982c5]=this[_0x0c90('0xe')][_0x0c90('0x3f')];this['rpc'][_0x0c90('0x54')](_0x4c4e5a)[_0x0c90('0x1a')](function(_0x34f57c){_0x120b88(null,_['isNil'](_0x34f57c)?![]:!![]);})[_0x0c90('0x14')](function(_0x1cc7b8){logger[_0x0c90('0x2f')](_0x1cc7b8);_0x120b88(null,![]);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x56')]=function(_0x1cf0a6,_0x19f4ac){var _0x143e0d={'role':_0x0c90('0x55')};_0x143e0d[_0x1cf0a6]=this['channel']['callerid'];this[_0x0c90('0xf')][_0x0c90('0x56')](_0x143e0d)[_0x0c90('0x1a')](function(_0x2faf14){_0x19f4ac(null,_[_0x0c90('0x4b')](_0x2faf14)?![]:!![]);})[_0x0c90('0x14')](function(_0x2f1459){logger[_0x0c90('0x2f')](_0x2f1459);_0x19f4ac(null,![]);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x57')]=function(_0x1d9c34,_0x69255e){var _0x309152={'role':_0x0c90('0x55')};_0x309152[_0x1d9c34]=this[_0x0c90('0xe')]['callerid'];var _0x1bbb21=_0x1d9c34!=_0x0c90('0x58')?util[_0x0c90('0x2c')]('%s/%s@from-sip/n','LOCAL',this[_0x0c90('0xe')]['callerid']):undefined;this[_0x0c90('0xf')][_0x0c90('0x57')](_0x309152,_0x1bbb21)['then'](function(_0x2c64e0){_0x69255e(null,_[_0x0c90('0x4b')](_0x2c64e0)?![]:!![]);})[_0x0c90('0x14')](function(_0x38e3cf){logger['error'](_0x38e3cf);_0x69255e(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x16b38a,_0x2d3287){sh[_0x0c90('0x59')](_[_0x0c90('0x5a')](_0x16b38a),function(_0x4a801f,_0x16a712){var _0x51e699=_0x16a712[_0x0c90('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2d3287(null,_0x51e699);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x5c')]=function(_0x4f580a,_0x10f686){scripts[_0x0c90('0x5c')](_0x4f580a[_0x0c90('0x5d')],_0x4f580a[_0x0c90('0x5e')]||'text',_0x4f580a['text'],_0x4f580a[_0x0c90('0x5f')]||'en-US',_0x4f580a[_0x0c90('0x60')]||_0x0c90('0x61'),_0x4f580a[_0x0c90('0x62')]||_0x0c90('0x63'))[_0x0c90('0x1a')](function(_0x1bebc6){_0x10f686(null,_0x1bebc6);})[_0x0c90('0x14')](function(_0x81fa82){_0x10f686(_0x81fa82);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x64')]=function(_0x53779b,_0x28a2f0){scripts[_0x0c90('0x64')](_0x53779b[_0x0c90('0x65')],_0x53779b[_0x0c90('0x66')]||'en',0x1)[_0x0c90('0x1a')](function(_0x1e6f8b){_0x28a2f0(null,_0x1e6f8b);})[_0x0c90('0x14')](function(_0x1777ac){_0x28a2f0(_0x1777ac);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x67')]=function(_0x4ca596,_0x228d77){var _0x5268f8={'uri':_0x4ca596[_0x0c90('0x68')],'method':_0x4ca596[_0x0c90('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ca596['timeout'])===_0x0c90('0x6a')&&parseInt(_0x4ca596[_0x0c90('0x6b')])>=0x1?parseInt(_0x4ca596[_0x0c90('0x6b')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x0c90('0x6c'),_0x0c90('0x6d')],_0x5268f8['method'][_0x0c90('0x6e')]())){try{_0x5268f8['body']=_0x4ca596[_0x0c90('0x6f')]?JSON['parse'](_0x4ca596['rawBody']):{};}catch(_0x42e76a){logger[_0x0c90('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x42e76a);}}try{_0x5268f8['headers']=_0x4ca596[_0x0c90('0xa')]?JSON[_0x0c90('0x70')](_0x4ca596['rawHeaders']):{};}catch(_0x4a4a64){logger[_0x0c90('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4a4a64);}if(_0x4ca596[_0x0c90('0x71')]){try{var _0x17ae09=require(_0x4ca596[_0x0c90('0x71')])[_0x0c90('0x72')](this,_0x5268f8);_0x5268f8[_0x0c90('0x73')]=Mustache['render'](_0x4ca596[_0x0c90('0x68')],_0x17ae09,{},['$$','$$']);if(_0x5268f8[_0x0c90('0x74')]){_0x5268f8[_0x0c90('0x74')]=JSON['parse'](Mustache['render'](JSON[_0x0c90('0x75')](_0x5268f8[_0x0c90('0x74')]),_0x17ae09,{},['$$','$$']));}if(_0x5268f8[_0x0c90('0x76')]){_0x5268f8['body']=JSON['parse'](Mustache['render'](JSON[_0x0c90('0x75')](_0x5268f8['body']),_0x17ae09,{},['$$','$$']));}}catch(_0x4ecf55){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4ecf55);}}rp(_0x5268f8)[_0x0c90('0x1a')](function(_0x2ca017){var _0x1bf6e0={'statusCode':_0x2ca017[_0x0c90('0x77')]||0xc8,'statusMessage':_0x2ca017[_0x0c90('0x78')]||'OK','headers':_0x2ca017['headers']||{},'body':_0x2ca017['body']||{}};_0x228d77(null,_0x1bf6e0);})['catch'](function(_0x3c6449){var _0x16e8ae={'statusCode':_0x3c6449[_0x0c90('0x77')]||0x1f4,'statusMessage':_0x3c6449[_0x0c90('0x79')]||_0x0c90('0x7a'),'headers':_0x3c6449[_0x0c90('0x7b')]['headers']||{},'body':_0x3c6449[_0x0c90('0x7b')][_0x0c90('0x76')]||{}};_0x228d77(null,_0x16e8ae);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x7c')]=function(_0x1e73f3,_0x1e7c9d){scripts[_0x0c90('0x7c')](this[_0x0c90('0xe')][_0x0c90('0x3b')],_0x1e73f3[_0x0c90('0x7d')],_0x1e73f3[_0x0c90('0x65')],_0x1e73f3[_0x0c90('0x7e')]||'en')['then'](function(_0x2b8d66){_0x1e7c9d(null,_0x2b8d66);})['catch'](function(_0x14b57f){_0x1e7c9d(_0x14b57f);});};AGIVertices['prototype'][_0x0c90('0x7f')]=function(_0x1f1ee2,_0x22294c){scripts[_0x0c90('0x7f')](this['channel']['uniqueid'],_0x1f1ee2[_0x0c90('0x80')],_0x1f1ee2[_0x0c90('0x81')],_0x1f1ee2['private_key'],_0x1f1ee2[_0x0c90('0x65')],_0x1f1ee2[_0x0c90('0x82')]||'en')['then'](function(_0x325796){_0x22294c(null,_0x325796);})[_0x0c90('0x14')](function(_0x578349){_0x22294c(_0x578349);});};AGIVertices[_0x0c90('0x11')]['sestekNDA']=function(_0x1b7acd,_0x1574be){scripts[_0x0c90('0x83')](this[_0x0c90('0xe')],_0x1b7acd)[_0x0c90('0x1a')](function(_0x38ce27){_0x1574be(null,_0x38ce27);})['catch'](function(_0x2c50a7){_0x1574be(_0x2c50a7);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x84')]=function(_0x207021,_0x1306bb){scripts['ispeechTTS'](_0x207021[_0x0c90('0x7d')],_0x207021[_0x0c90('0x65')],_0x207021[_0x0c90('0x85')]||_0x0c90('0x86'),_0x207021[_0x0c90('0x87')])[_0x0c90('0x1a')](function(_0x55a99c){_0x1306bb(null,_0x55a99c);})[_0x0c90('0x14')](function(_0x64e280){_0x1306bb(_0x64e280);});};AGIVertices['prototype'][_0x0c90('0x88')]=function(_0x195a42,_0x53d017,_0x199d05){scripts[_0x0c90('0x88')](_0x53d017,_0x195a42['key'],_0x195a42['ispeech_asr_language']||_0x0c90('0x86'),this[_0x0c90('0x89')](_0x195a42['model'])?_0x195a42[_0x0c90('0x8a')]:undefined)['then'](function(_0x37d1d5){_0x199d05(null,_0x37d1d5);})['catch'](function(_0x56d4c7){_0x199d05(_0x56d4c7);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x8b')]=function(_0x457c40,_0x589c4a){scripts['awsPolly'](_0x457c40[_0x0c90('0x8c')],_0x457c40[_0x0c90('0x8d')],_0x457c40[_0x0c90('0x8e')],_0x457c40[_0x0c90('0x8f')]||_0x0c90('0x90'),_0x457c40['text'],_0x457c40[_0x0c90('0x91')]||'text')[_0x0c90('0x1a')](function(_0x243bf1){_0x589c4a(null,_0x243bf1);})[_0x0c90('0x14')](function(_0x283886){_0x589c4a(_0x283886);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x92')]=function(_0x38a375,_0x5c78b7){scripts['awsLex'](this[_0x0c90('0xe')][_0x0c90('0x3b')],_0x38a375[_0x0c90('0x8c')],_0x38a375[_0x0c90('0x8d')],_0x38a375[_0x0c90('0x93')],_0x38a375[_0x0c90('0x65')],_0x38a375[_0x0c90('0x94')])[_0x0c90('0x1a')](function(_0x5647f9){_0x5c78b7(null,_0x5647f9);})[_0x0c90('0x14')](function(_0x5ba4dd){_0x5c78b7(_0x5ba4dd);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x95')]=function(_0x406886,_0x14f71e,_0xe7700e){scripts[_0x0c90('0x95')](_0x14f71e,_0x406886[_0x0c90('0x7d')],_0x406886['google_asr_language']||'en-US')[_0x0c90('0x1a')](function(_0x4a001d){_0xe7700e(null,_0x4a001d);})[_0x0c90('0x14')](function(_0x3cb5b3){_0xe7700e(_0x3cb5b3);});};AGIVertices[_0x0c90('0x11')]['tildeASR']=function(_0x474e85,_0xe22882,_0x21043a){scripts[_0x0c90('0x96')](_0xe22882,_0x474e85[_0x0c90('0x97')],_0x474e85['appsecret'],_0x474e85['uri'])[_0x0c90('0x1a')](function(_0x3ebc85){_0x21043a(null,_0x3ebc85);})[_0x0c90('0x14')](function(_0x1dc725){_0x21043a(_0x1dc725);});};AGIVertices[_0x0c90('0x11')][_0x0c90('0x98')]=function(_0x4f7d59){var _0x1a0ab6=_[_0x0c90('0x99')](verticesWithRetry,_0x4f7d59[_0x0c90('0x3d')])?_0x4f7d59:_[_0x0c90('0x9a')](_0x4f7d59);for(var _0x5103ae in _0x1a0ab6){if(_0x1a0ab6['hasOwnProperty'](_0x5103ae)){if(_0x1a0ab6[_0x5103ae]&&_[_0x0c90('0x9b')](_0x1a0ab6[_0x5103ae])){if(_[_0x0c90('0x99')](recursiveMapAttributes,_0x5103ae)){_0x1a0ab6[_0x5103ae]=this['replaceObjectAllVariables'](_0x1a0ab6[_0x5103ae]);}else{_0x1a0ab6[_0x5103ae]=this[_0x0c90('0x9c')](_0x1a0ab6[_0x5103ae]);}}}}return _0x1a0ab6;};AGIVertices[_0x0c90('0x11')][_0x0c90('0x9d')]=function(_0x1a5ade){for(var _0x1c1cb3 in _0x1a5ade){if(_0x1a5ade['hasOwnProperty'](_0x1c1cb3)){if(_[_0x0c90('0x9e')](_0x1a5ade[_0x1c1cb3])){this['recursiveNodeIndex'](_0x1a5ade[_0x1c1cb3]);}else if(_[_0x0c90('0x9f')](_0x1a5ade[_0x1c1cb3])){for(var _0x369cd6=0x0;_0x369cd6<_0x1a5ade[_0x1c1cb3][_0x0c90('0xa0')];_0x369cd6++){this['recursiveNodeIndex'](_0x1a5ade[_0x1c1cb3][_0x369cd6]);}}else if(_[_0x0c90('0x9b')](_0x1a5ade[_0x1c1cb3])){_0x1a5ade[_0x1c1cb3]=this[_0x0c90('0x9c')](_0x1a5ade[_0x1c1cb3]);}}}};AGIVertices[_0x0c90('0x11')]['saveRestApiResult']=function(_0x5a2961,_0x4c2771){for(var _0x4930cd in _0x5a2961){if(_0x5a2961[_0x0c90('0xa1')](_0x4930cd)){if(_[_0x0c90('0x9e')](_0x5a2961[_0x4930cd])){if(!_['isEmpty'](_0x5a2961[_0x4930cd])){this['saveRestApiResult'](_0x5a2961[_0x4930cd],util[_0x0c90('0x2c')]('%s.%s',_0x4c2771,_0x4930cd));}}else if(_[_0x0c90('0x9f')](_0x5a2961[_0x4930cd])){for(var _0x13c0f2=0x0;_0x13c0f2<_0x5a2961[_0x4930cd][_0x0c90('0xa0')];_0x13c0f2++){this[_0x0c90('0xa2')](_0x5a2961[_0x4930cd][_0x13c0f2],util[_0x0c90('0x2c')]('%s.%s',_0x4c2771,_0x4930cd+'['+_0x13c0f2+']'));}}else{if(!_[_0x0c90('0x4b')](_0x5a2961[_0x4930cd])){this[_0x0c90('0xe')][_0x0c90('0xa3')](util[_0x0c90('0x2c')](_0x0c90('0xa4'),_0x4c2771,_0x4930cd),_0x5a2961[_0x4930cd]);}}}}};AGIVertices[_0x0c90('0x11')][_0x0c90('0xa5')]=function(_0x46b454){try{var _0x3614d1=JSON[_0x0c90('0x70')](_0x46b454);this['recursiveNodeIndex'](_0x3614d1);return JSON[_0x0c90('0x75')](_0x3614d1);}catch(_0x50df2c){return this[_0x0c90('0x9c')](_0x46b454);}};AGIVertices[_0x0c90('0x11')][_0x0c90('0x9c')]=function(_0x565971){var _0x247146=_0x565971['split']('{');for(var _0x29f22=0x1;_0x29f22<_0x247146[_0x0c90('0xa0')];_0x29f22+=0x1){var _0x2f542b=_0x247146[_0x29f22][_0x0c90('0xa6')]('}');if(_0x2f542b[_0x0c90('0xa0')]>0x1){_0x565971=_0x565971[_0x0c90('0xa7')]('{'+_0x2f542b[0x0]+'}',this[_0x0c90('0xe')][_0x0c90('0x12')](_0x2f542b[0x0])[_0x0c90('0xa8')]||_0x2f542b[0x0]);}}if(_0x247146[_0x0c90('0xa0')]===0x1){return _0x565971['toString']();}return this[_0x0c90('0x9c')](_0x565971);};AGIVertices[_0x0c90('0x11')][_0x0c90('0xa9')]=function(_0x5f0ba0,_0x5f431d){var _0x2dabe6=this[_0x0c90('0xe')]['getVariable'](_0x5f0ba0);if(_0x2dabe6['result']===-0x1){return _0x2dabe6;}logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5f431d,_0x2dabe6[_0x0c90('0xa8')]));return this[_0x0c90('0xe')]['setVariable'](_0x5f431d,_0x2dabe6[_0x0c90('0xa8')]);};AGIVertices[_0x0c90('0x11')]['isConfigured']=function(_0x1fb55a){return _0x1fb55a&&_0x1fb55a!=='0'&&_0x1fb55a!=='-1'&&_0x1fb55a!=='';};AGIVertices['prototype']['maxRetry']=function(_0x8e8e30){this[_0x0c90('0x3a')]['sync'](this,_0x8e8e30,'-');_0x8e8e30['retry']=_0x8e8e30[_0x0c90('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0c90('0x11')][_0x0c90('0xab')]=function(_0x1f0263){logger[_0x0c90('0x30')](util['format'](_0x0c90('0xac'),_0x1f0263[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x1f0263[_0x0c90('0x65')])){return this[_0x0c90('0xe')][_0x0c90('0xad')]('no\x20text\x20configured');}var _0x18cc89='\x22'+_0x1f0263['text']+'\x22';if(this['isConfigured'](_0x1f0263['options'])){_0x18cc89+=','+_0x1f0263[_0x0c90('0x7b')];}var _0x3f7483=this['channel'][_0x0c90('0x59')]('MRCPSynth',_0x18cc89);if(_0x3f7483['result']===-0x1){return _0x3f7483;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xae'),_0x18cc89));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xaf')]=function(_0xf2826b){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0xb0'),_0xf2826b[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0xf2826b[_0x0c90('0xb1')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xb2'));}var _0xee3dfa=_0xf2826b[_0x0c90('0xb1')];if(this[_0x0c90('0x89')](_0xf2826b[_0x0c90('0x7b')])){_0xee3dfa+=','+_0xf2826b[_0x0c90('0x7b')];}var _0x22c846=this['channel'][_0x0c90('0x59')](_0x0c90('0xb3'),_0xee3dfa);if(_0x22c846[_0x0c90('0xb4')]===-0x1){return _0x22c846;}var _0x334ba9=this[_0x0c90('0xa9')](_0x0c90('0xb5'),'MRCP_RECOG_CONFIDENCE');if(_0x334ba9[_0x0c90('0xb4')]===-0x1){return _0x334ba9;}var _0x1f6418=this['getAndSetVariable'](_0x0c90('0xb6'),_0x0c90('0xb7'));if(_0x1f6418[_0x0c90('0xb4')]===-0x1){return _0x1f6418;}var _0x51c503=this[_0x0c90('0xa9')](_0x0c90('0xb8'),_0x0c90('0xb9'));if(_0x51c503[_0x0c90('0xb4')]===-0x1){return _0x51c503;}return this['channel'][_0x0c90('0xad')](util['format'](_0x0c90('0xba'),_0xee3dfa));};AGIVertices['prototype'][_0x0c90('0x5')]=function(_0x471b22){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xbb'),_0x471b22[_0x0c90('0x3c')]));return this[_0x0c90('0xe')][_0x0c90('0x5')]([_0x471b22[_0x0c90('0xbc')],_0x471b22[_0x0c90('0xbd')]]);};AGIVertices[_0x0c90('0x11')][_0x0c90('0xbe')]=function(_0x461206){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xbf'),_0x461206['label']));if(this[_0x0c90('0x89')](_0x461206['timeout'])){logger[_0x0c90('0x30')](util['format'](_0x0c90('0xc0'),_0x461206[_0x0c90('0x6b')]));var _0x43fed2=this[_0x0c90('0xe')]['wait'](_0x461206['timeout']);if(_0x43fed2[_0x0c90('0xb4')]===-0x1){return _0x43fed2;}}return this[_0x0c90('0xe')][_0x0c90('0xbe')]();};AGIVertices[_0x0c90('0x11')][_0x0c90('0x51')]=function(_0xc6aa96){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xc1'),_0xc6aa96[_0x0c90('0x3c')]));if(!this['isConfigured'](_0xc6aa96[_0x0c90('0x4f')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0xc6aa96,_0x0c90('0xc2'));}_0xc6aa96['scheduledAt']=moment();if(this[_0x0c90('0x89')](_0xc6aa96[_0x0c90('0xc3')])){_0xc6aa96['scheduledAt']=moment()['add'](_0xc6aa96['delay'],_0x0c90('0xc4'));}if(!this[_0x0c90('0x89')](_0xc6aa96[_0x0c90('0x52')])){_0xc6aa96[_0x0c90('0x52')]=0x2;}this[_0x0c90('0x49')]['sync'](this,_0xc6aa96);return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xc5'),_0xc6aa96[_0x0c90('0x4e')],_0xc6aa96[_0x0c90('0x4f')],_0xc6aa96['scheduledAt']));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xc6')]=function(_0x4c4a62){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xc7'),_0x4c4a62[_0x0c90('0x3c')]));var _0x3815d9=this[_0x0c90('0xe')][_0x0c90('0x59')](_0x4c4a62['application'],_0x4c4a62[_0x0c90('0x7b')]);if(_0x3815d9['result']===-0x1){return _0x3815d9;}return this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')]('Executed\x20command\x20%s\x20%s',_0x4c4a62[_0x0c90('0xc8')],_0x4c4a62[_0x0c90('0x7b')]));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xc9')]=function(_0x568478){logger[_0x0c90('0x30')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x568478[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x568478['text'])){return this[_0x0c90('0xe')]['noop'](_0x0c90('0xca'));}var _0x3c5eec='\x22'+_0x568478[_0x0c90('0x65')]+'\x22';if(this[_0x0c90('0x89')](_0x568478[_0x0c90('0x7b')])){_0x3c5eec+=','+_0x568478[_0x0c90('0x7b')];}var _0x34ab53=this['channel'][_0x0c90('0x59')]('MRCPSynth',_0x3c5eec);if(_0x34ab53[_0x0c90('0xb4')]===-0x1){return _0x34ab53;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xae'),_0x3c5eec));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xcb')]=function(_0x53fce4){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0xcc'),_0x53fce4[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x53fce4['text'])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xca'));}var _0x33d8f3='\x22'+_0x53fce4['text']+'\x22';if(this[_0x0c90('0x89')](_0x53fce4[_0x0c90('0x7b')])){_0x33d8f3+=','+_0x53fce4[_0x0c90('0x7b')];}var _0x19cc68=this['channel'][_0x0c90('0x59')](_0x0c90('0xcd'),_0x33d8f3);if(_0x19cc68[_0x0c90('0xb4')]===-0x1){return _0x19cc68;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x33d8f3));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xce')]=function(_0x5715d4){logger['info'](util[_0x0c90('0x2c')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5715d4[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x5715d4[_0x0c90('0xb1')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xb2'));}var _0x18e41d=_0x5715d4[_0x0c90('0xb1')];if(this[_0x0c90('0x89')](_0x5715d4['options'])){_0x18e41d+=','+_0x5715d4['options'];}var _0x2b227e=this[_0x0c90('0xe')][_0x0c90('0x59')](_0x0c90('0xb3'),_0x18e41d);if(_0x2b227e[_0x0c90('0xb4')]===-0x1){return _0x2b227e;}var _0x1f8509=this[_0x0c90('0xa9')](_0x0c90('0xb5'),_0x0c90('0xcf'));if(_0x1f8509[_0x0c90('0xb4')]===-0x1){return _0x1f8509;}var _0xcf596b=this[_0x0c90('0xa9')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0xcf596b[_0x0c90('0xb4')]===-0x1){return _0xcf596b;}var _0x346582=this[_0x0c90('0xa9')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x346582[_0x0c90('0xb4')]===-0x1){return _0x346582;}return this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')](_0x0c90('0xba'),_0x18e41d));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xd0')]=function(_0x4295ba){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xd1'),_0x4295ba[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x4295ba[_0x0c90('0xb1')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xb2'));}var _0x1c27b4=_0x4295ba[_0x0c90('0xb1')];if(this[_0x0c90('0x89')](_0x4295ba[_0x0c90('0x7b')])){_0x1c27b4+=','+_0x4295ba['options'];}var _0x27a885=this['channel'][_0x0c90('0x59')](_0x0c90('0xb3'),_0x1c27b4);if(_0x27a885['result']===-0x1){return _0x27a885;}var _0x5c0fd1=this[_0x0c90('0xa9')](_0x0c90('0xb5'),_0x0c90('0xd2'));if(_0x5c0fd1[_0x0c90('0xb4')]===-0x1){return _0x5c0fd1;}var _0x19cd42=this[_0x0c90('0xa9')](_0x0c90('0xb6'),_0x0c90('0xd3'));if(_0x19cd42[_0x0c90('0xb4')]===-0x1){return _0x19cd42;}var _0x554a55=this[_0x0c90('0xa9')](_0x0c90('0xb8'),_0x0c90('0xd4'));if(_0x554a55[_0x0c90('0xb4')]===-0x1){return _0x554a55;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1c27b4));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xd5')]=function(_0x6e35f4){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x6e35f4[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x6e35f4[_0x0c90('0xd6')])){return this['channel'][_0x0c90('0x2f')](_0x6e35f4,_0x0c90('0xd7'));}var _0x2ec59f=this[_0x0c90('0x1b')][_0x0c90('0x72')](this,_0x6e35f4[_0x0c90('0xd6')]);if(!_0x2ec59f){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x6e35f4,'no\x20odbc\x20database\x20found');}if(!this[_0x0c90('0x89')](_0x6e35f4[_0x0c90('0x32')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x6e35f4,_0x0c90('0xd8'));}var _0x146846=_0x6e35f4['query'][_0x0c90('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')](_0x0c90('0xd9'),_0x146846));var _0x28e60b=this[_0x0c90('0x2e')][_0x0c90('0x72')](this,_0x2ec59f,_0x146846);this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x6e35f4,_0x146846);if(!this['isConfigured'](_0x6e35f4[_0x0c90('0xda')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xdb'));}var _0xbfe3a4=this['getVariable'][_0x0c90('0x72')](this,_0x6e35f4[_0x0c90('0xda')]);if(!_0xbfe3a4){return this['channel'][_0x0c90('0x2f')](_0x6e35f4,'no\x20variable\x20found');}var _0x4e1561=this;_0x28e60b[_0x0c90('0xdc')](function(_0x231263,_0x37f232){Object[_0x0c90('0xdd')](_0x231263)['forEach'](function(_0x3ab798){_0x4e1561['channel'][_0x0c90('0xa3')](util[_0x0c90('0x2c')]('%s[%s][%s]',_0xbfe3a4,_0x37f232,_0x3ab798),_0x231263[_0x3ab798]);});});this['channel'][_0x0c90('0xa3')](util['format']('%s_ROWS_COUNT',_0xbfe3a4),_0x28e60b[_0x0c90('0xa0')]);return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xde'),_0xbfe3a4));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xdf')]=function(_0xd63aa3){logger[_0x0c90('0xe0')](util[_0x0c90('0x2c')](_0x0c90('0xe1'),_0xd63aa3['label']));if(!this[_0x0c90('0x89')](_0xd63aa3[_0x0c90('0xe2')])){return this[_0x0c90('0xe')]['error'](_0xd63aa3,_0x0c90('0xe3'));}var _0x3657a5=this['getUser'][_0x0c90('0x72')](this,_0xd63aa3['sip_id']);if(!_0x3657a5){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0xd63aa3,_0x0c90('0xe4'));}var _0x13b4da=this[_0x0c90('0xe')][_0x0c90('0x59')]('DIAL',[util[_0x0c90('0x2c')](_0x0c90('0xe5'),_0x3657a5),_0xd63aa3['timeout'],_0xd63aa3[_0x0c90('0xe6')],_0xd63aa3[_0x0c90('0x68')]]);if(_0x13b4da[_0x0c90('0xb4')]===-0x1){return _0x13b4da;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xe7'),_0x0c90('0xe8')));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xe9')]=function(_0x2b5fe6){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2b5fe6['label']));if(!this[_0x0c90('0x89')](_0x2b5fe6['key'])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xea'));}if(!this[_0x0c90('0x89')](_0x2b5fe6[_0x0c90('0x65')])){return this[_0x0c90('0xe')]['noop'](_0x0c90('0xca'));}this[_0x0c90('0xe')][_0x0c90('0xeb')]=!![];this['createSquareDetailsReport'](_0x2b5fe6);this[_0x0c90('0x48')](_0x2b5fe6[_0x0c90('0x65')],'in','','');this[_0x0c90('0xe')][_0x0c90('0xad')](util['format'](_0x0c90('0xec'),_0x2b5fe6['text']));var _0x4f05c7=this[_0x0c90('0x7c')][_0x0c90('0x72')](this,_0x2b5fe6);if(_0x4f05c7){for(var _0x52e229 in _0x4f05c7){if(_0x4f05c7[_0x0c90('0xa1')](_0x52e229)){this[_0x0c90('0xe')]['setVariable'](util[_0x0c90('0x2c')](_0x0c90('0xed'),_0x52e229[_0x0c90('0x6e')]()),_0x4f05c7[_0x52e229]);}}this[_0x0c90('0x48')](_0x4f05c7[_0x0c90('0xee')],'out',_0x0c90('0xe9'),'');return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xef'),_0x4f05c7[_0x0c90('0xee')]));}return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x2b5fe6,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x0c90('0xf0')]=function(_0x1ed155){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0xf1'),_0x1ed155[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x1ed155[_0x0c90('0x80')])){return this[_0x0c90('0xe')]['noop'](_0x0c90('0xf2'));}if(!this[_0x0c90('0x89')](_0x1ed155['client_email'])){return this[_0x0c90('0xe')]['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x1ed155[_0x0c90('0xf3')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xf4'));}if(!this[_0x0c90('0x89')](_0x1ed155[_0x0c90('0x82')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xf5'));}if(!this[_0x0c90('0x89')](_0x1ed155['text'])){return this[_0x0c90('0xe')][_0x0c90('0xad')]('no\x20text\x20configured');}this[_0x0c90('0xe')]['bot']=!![];this[_0x0c90('0x3a')](_0x1ed155);this['createSquareMessage'](_0x1ed155['text'],'in','','');this[_0x0c90('0xe')]['noop'](util['format'](_0x0c90('0xf6'),_0x1ed155[_0x0c90('0x65')]));var _0xb3860c=this[_0x0c90('0x7f')][_0x0c90('0x72')](this,_0x1ed155);if(_0xb3860c){for(var _0x39477e in _0xb3860c){if(_0xb3860c[_0x0c90('0xa1')](_0x39477e)){if(_0x39477e!==_0x0c90('0xf7')){this['channel'][_0x0c90('0xa3')](util[_0x0c90('0x2c')](_0x0c90('0xed'),_0x39477e[_0x0c90('0x6e')]()),_0xb3860c[_0x39477e]);}}}this[_0x0c90('0x48')](_0xb3860c['speech'],_0x0c90('0xf8'),_0x0c90('0xf0'),_0xb3860c[_0x0c90('0xf7')]);return this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xf9'),_0xb3860c[_0x0c90('0xee')]));}return this['channel']['error'](_0x1ed155,_0x0c90('0xfa'));};AGIVertices[_0x0c90('0x11')][_0x0c90('0xfb')]=function(_0x48ebaf){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x48ebaf[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x48ebaf['ndauth_url'])){return this[_0x0c90('0xe')]['noop'](_0x0c90('0xfc'));}if(!this[_0x0c90('0x89')](_0x48ebaf[_0x0c90('0xfd')])){return this['channel'][_0x0c90('0xad')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x48ebaf['password'])){return this['channel'][_0x0c90('0xad')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x48ebaf[_0x0c90('0xfe')])){return this[_0x0c90('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0x0c90('0xeb')]=!![];this[_0x0c90('0x3a')](_0x48ebaf);this[_0x0c90('0x48')](_0x48ebaf[_0x0c90('0x65')],'in','','');this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xff'),_0x48ebaf[_0x0c90('0x65')]));var _0x14589f=this[_0x0c90('0x83')]['sync'](this,_0x48ebaf);if(_0x14589f){for(var _0x2370b4 in _0x14589f){if(_0x14589f['hasOwnProperty'](_0x2370b4)){this[_0x0c90('0xe')][_0x0c90('0xa3')](util[_0x0c90('0x2c')](_0x0c90('0x100'),_0x2370b4[_0x0c90('0x6e')]()),_0x14589f[_0x2370b4]);}}this[_0x0c90('0x48')](_0x14589f[_0x0c90('0xee')],'out',_0x0c90('0xfb'),'');if(_0x14589f[_0x0c90('0x101')]){this['channel']['noop'](util['format'](_0x0c90('0x102'),_0x14589f[_0x0c90('0x101')]));var _0x259fe9=this[_0x0c90('0xe')][_0x0c90('0x103')](_0x14589f[_0x0c90('0x101')]);try{fs['unlink'](_0x14589f['audiofile']+'.wav');}catch(_0x4f3dcd){logger[_0x0c90('0x2f')](_0x4f3dcd);}return _0x259fe9;}else{return this['channel'][_0x0c90('0xad')](util['format'](_0x0c90('0x104'),_0x14589f[_0x0c90('0xee')]));}}return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x48ebaf,_0x0c90('0x105'));};AGIVertices['prototype'][_0x0c90('0x106')]=function(_0x43a9e6){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x107'),_0x43a9e6[_0x0c90('0x3c')]));return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x106'));};AGIVertices['prototype'][_0x0c90('0x108')]=function(_0x1a2897){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x109'),_0x1a2897[_0x0c90('0x3c')]));var _0x421119='';if(_0x1a2897['trunk_id']){if(!this[_0x0c90('0x89')](_0x1a2897['trunk_id'])){return this[_0x0c90('0xe')]['error'](_0x1a2897,'no\x20trunk\x20selected');}else{var _0x116723=parseInt(_0x1a2897['trunk_id'],0xa);if(isNaN(_0x116723)){_0x421119=_0x1a2897[_0x0c90('0x10a')];}else{_0x421119=this[_0x0c90('0x20')][_0x0c90('0x72')](this,_0x1a2897['trunk_id']);if(!_0x421119){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x1a2897,_0x0c90('0x10b'));}}}}else if(_0x1a2897[_0x0c90('0x10c')]){_0x421119=_0x1a2897[_0x0c90('0x10c')];}else{return this['channel'][_0x0c90('0x2f')](_0x1a2897,_0x0c90('0x10d'));}var _0x346dc7=this[_0x0c90('0xe')][_0x0c90('0x59')](_0x0c90('0xe8'),[util['format'](_0x0c90('0x10e'),_0x421119,_0x1a2897[_0x0c90('0x4e')]),_0x1a2897[_0x0c90('0x6b')],_0x1a2897['opts'],_0x1a2897[_0x0c90('0x68')]]);if(_0x346dc7['result']===-0x1){return _0x346dc7;}return this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0xe7'),'DIAL'));};AGIVertices['prototype']['finally']=function(_0x189804){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x10f'),_0x189804[_0x0c90('0x3c')]));return this['channel'][_0x0c90('0xad')](_0x0c90('0x110'));};AGIVertices[_0x0c90('0x11')]['getdigits']=function(_0x3c573e){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x111'),_0x3c573e[_0x0c90('0x3c')]));if(_0x3c573e[_0x0c90('0x112')]===0x0){return this[_0x0c90('0xaa')](_0x3c573e);}_0x3c573e['retry']-=0x1;if(!this[_0x0c90('0x89')](_0x3c573e[_0x0c90('0x113')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x3c573e,_0x0c90('0x114'));}var _0x140fd4=this[_0x0c90('0x22')]['sync'](this,_0x3c573e[_0x0c90('0x113')]);if(!_0x140fd4){return this['channel']['error'](_0x3c573e,_0x0c90('0x115'));}if(!this[_0x0c90('0x89')](_0x3c573e['variable_id'])){return this['channel'][_0x0c90('0x2f')](_0x0c90('0xdb'));}var _0x1503b8=this[_0x0c90('0xe')]['getData'](_0x140fd4,_0x3c573e[_0x0c90('0x116')],_0x3c573e[_0x0c90('0x117')]);var _0x205acb=_0x1503b8[_0x0c90('0xb4')]?_0x1503b8['result'][_0x0c90('0x118')]():'';logger['info'](_0x0c90('0x119'),JSON[_0x0c90('0x75')](_0x1503b8));if(_0x1503b8[_0x0c90('0xb4')]===-0x1){this[_0x0c90('0x3a')]['sync'](this,_0x3c573e,_0x205acb);return _0x1503b8;}else if(_0x1503b8[_0x0c90('0xa8')]===_0x0c90('0x6b')){_0x1503b8['result']=_0x205acb[_0x0c90('0xa0')]>=parseInt(_0x3c573e[_0x0c90('0x11a')])?'x':'i';}else{_0x1503b8[_0x0c90('0xb4')]=_0x205acb[_0x0c90('0xa0')]>=parseInt(_0x3c573e[_0x0c90('0x11a')])&&_0x205acb[_0x0c90('0xa0')]<=parseInt(_0x3c573e['maxdigit'])?'x':'i';}var _0x3096f5=this['getVariable'][_0x0c90('0x72')](this,_0x3c573e[_0x0c90('0xda')]);if(!_0x3096f5){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x3c573e,_0x0c90('0x11b'));}this[_0x0c90('0xe')][_0x0c90('0xa3')](_0x3096f5,_0x205acb);if(this[_0x0c90('0x89')](_0x3c573e[_0x0c90('0x11c')])){var _0x526600=parseInt(_0x3c573e[_0x0c90('0x11c')],0xa);var _0x30f196=rs['generate']({'charset':'*','length':_0x526600});var _0x3e8d53=_0x205acb[_0x0c90('0xa0')];if(_0x3e8d53>0x0){if(_0x3e8d53>_0x526600){this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x3c573e,_0x3c573e[_0x0c90('0x11d')]===_0x0c90('0x11e')?_0x30f196+_0x205acb[_0x0c90('0x11f')](_0x526600):_0x205acb[_0x0c90('0x11f')](0x0,_0x3e8d53-_0x526600)+_0x30f196);}else{this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x3c573e,rs[_0x0c90('0x120')]({'charset':'*','length':_0x3e8d53}));}}else{this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x3c573e,'');}}else{this[_0x0c90('0x3a')]['sync'](this,_0x3c573e,_0x205acb);}return _0x1503b8;};AGIVertices[_0x0c90('0x11')][_0x0c90('0xd')]=function(_0x5282e3){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x121'),_0x5282e3['label']));return this[_0x0c90('0xc')](_0x5282e3);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x122')]=function(_0x31b2fe){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x123'),_0x31b2fe[_0x0c90('0x3c')]));this['createSquareDetailsReport'][_0x0c90('0x72')](this,_0x31b2fe,_0x31b2fe['goalname']);return this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x124'),_0x31b2fe['goalname']));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x125')]=function(_0x2c6035){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2c6035[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x2c6035[_0x0c90('0x8c')])||!this[_0x0c90('0x89')](_0x2c6035[_0x0c90('0x8d')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x126'));}if(!this[_0x0c90('0x89')](_0x2c6035[_0x0c90('0x65')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xca'));}this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x2c6035[_0x0c90('0x65')]));var _0x4bd3e1=this['awsPolly'][_0x0c90('0x72')](this,_0x2c6035);if(_0x4bd3e1){this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x127'),_0x4bd3e1));var _0x4cabe1=this['channel'][_0x0c90('0x103')](_0x4bd3e1);try{fs[_0x0c90('0x128')](_0x4bd3e1+'.wav');}catch(_0x48b9e7){logger[_0x0c90('0x2f')](_0x48b9e7);}return _0x4cabe1;}return this['channel']['error'](_0x2c6035,_0x0c90('0x129'));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x12a')]=function(_0x47f2e7){logger[_0x0c90('0x30')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x47f2e7[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x47f2e7[_0x0c90('0x8c')])||!this[_0x0c90('0x89')](_0x47f2e7[_0x0c90('0x8d')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x126'));}if(!this[_0x0c90('0x89')](_0x47f2e7[_0x0c90('0x94')])){return this['channel'][_0x0c90('0xad')](_0x0c90('0x12b'));}if(!this[_0x0c90('0x89')](_0x47f2e7[_0x0c90('0x65')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xca'));}this[_0x0c90('0xe')]['bot']=!![];this[_0x0c90('0x3a')](_0x47f2e7);this[_0x0c90('0x48')](_0x47f2e7['text'],'in','','');this['channel']['noop'](util[_0x0c90('0x2c')](_0x0c90('0x12c'),_0x47f2e7[_0x0c90('0x65')]));var _0x25a375=this['awsLex'][_0x0c90('0x72')](this,_0x47f2e7);if(_0x25a375){for(var _0x301c03 in _0x25a375){if(_0x25a375[_0x0c90('0xa1')](_0x301c03)&&_[_0x0c90('0x9b')](_0x25a375[_0x301c03])){this['channel']['setVariable'](util[_0x0c90('0x2c')](_0x0c90('0x12d'),_0x301c03[_0x0c90('0x6e')]()),_0x25a375[_0x301c03]);}}if(_[_0x0c90('0x4b')](_0x25a375['message'])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x12e'));}else{this['createSquareMessage'](_0x25a375[_0x0c90('0x79')],_0x0c90('0xf8'),_0x0c90('0x12f'),'');return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x130'),_0x25a375[_0x0c90('0x79')]));}}return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x47f2e7,_0x0c90('0x131'));};AGIVertices[_0x0c90('0x11')]['googleasr']=function(_0x5886c8){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x132'),_0x5886c8[_0x0c90('0x3c')],_0x5886c8[_0x0c90('0x6b')]));if(!this[_0x0c90('0x89')](_0x5886c8[_0x0c90('0x7d')])){return this['channel'][_0x0c90('0xad')](_0x0c90('0xea'));}var _0x4050df=_0x0c90('0x133');var _0x561a49=util[_0x0c90('0x2c')](_0x0c90('0x134'),FILES_PATH,rs['generate'](0x4));var _0x5bfeef=util['format']('%s.%s',_0x561a49,_0x4050df);var _0x2182cd=!![];if(_0x5886c8['beep']===_0x0c90('0x135')){_0x2182cd=![];}var _0x52c5cc=this[_0x0c90('0xe')]['recordFile'](_0x561a49,_0x4050df,_0x5886c8['intKey'],_0x5886c8[_0x0c90('0x6b')],undefined,_0x2182cd);if(_0x52c5cc['result']!==-0x1){this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x136'),_0x5bfeef));var _0x26c33b=this['googleASR'][_0x0c90('0x72')](this,_0x5886c8,_0x5bfeef);if(_0x26c33b){for(var _0x346e00 in _0x26c33b){if(_0x26c33b[_0x0c90('0xa1')](_0x346e00)){this['channel']['setVariable'](util['format']('GOOGLE_ASR_%s',_0x346e00[_0x0c90('0x6e')]()),_0x26c33b[_0x346e00]);}}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x137'),JSON[_0x0c90('0x75')](_0x26c33b)));}}return _0x52c5cc;};AGIVertices['prototype'][_0x0c90('0x138')]=function(_0xbc0853){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0xbc0853['label']));if(!this[_0x0c90('0x89')](_0xbc0853['appid'])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x139'));}if(!this[_0x0c90('0x89')](_0xbc0853[_0x0c90('0x13a')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x13b'));}var _0x12d402=_0x0c90('0x133');var _0x12ac2b=util['format'](_0x0c90('0x134'),FILES_PATH,rs[_0x0c90('0x120')](0x4));var _0x4b88d1=util[_0x0c90('0x2c')](_0x0c90('0xa4'),_0x12ac2b,_0x12d402);var _0x5ce93f=!![];if(_0xbc0853[_0x0c90('0x13c')]===_0x0c90('0x135')){_0x5ce93f=![];}var _0x241c7a=this[_0x0c90('0xe')]['recordFile'](_0x12ac2b,_0x12d402,_0xbc0853[_0x0c90('0x13d')],_0xbc0853[_0x0c90('0x6b')],undefined,_0x5ce93f);if(_0x241c7a['result']!==-0x1){this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x13e'),_0x4b88d1));var _0x457591=this[_0x0c90('0x96')][_0x0c90('0x72')](this,_0xbc0853,_0x4b88d1);if(_0x457591){for(var _0x2f8419 in _0x457591){if(_0x457591[_0x0c90('0xa1')](_0x2f8419)){this[_0x0c90('0xe')]['setVariable'](util['format'](_0x0c90('0x13f'),_0x2f8419[_0x0c90('0x6e')]()),_0x457591[_0x2f8419]);}}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x457591)));}}return _0x241c7a;};AGIVertices[_0x0c90('0x11')][_0x0c90('0x140')]=function(_0x4d3082){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4d3082['label']));return this[_0x0c90('0xe')][_0x0c90('0x141')](_0x4d3082['context'],_0x4d3082[_0x0c90('0x43')],_0x4d3082['priority']);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x142')]=function(_0x563426){logger[_0x0c90('0x30')](util['format'](_0x0c90('0x143'),_0x563426[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x563426[_0x0c90('0x144')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x563426,'no\x20condition\x20configured');}try{var _0x48afaa=eval(_0x563426['condition'])?_0x0c90('0x145'):_0x0c90('0x146');this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x563426[_0x0c90('0x144')],_0x48afaa));return{'code':0xc8,'result':_0x48afaa};}catch(_0x23d511){return{'code':0xc8,'result':_0x0c90('0x146')};}};AGIVertices['prototype'][_0x0c90('0x147')]=function(_0x32caff){logger['info'](util['format'](_0x0c90('0x148'),_0x32caff[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x32caff['interval_id'])){return this[_0x0c90('0xe')]['error'](_0x32caff,_0x0c90('0x149'));}var _0x534b59=this[_0x0c90('0x27')]['sync'](this,_0x32caff['interval_id']);if(!_0x534b59){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x32caff,_0x0c90('0x14a'));}for(var _0x4de749=0x0;_0x4de749<_0x534b59[_0x0c90('0xa0')];_0x4de749+=0x1){var _0x4122d9=this[_0x0c90('0xe')][_0x0c90('0x12')](util[_0x0c90('0x2c')](_0x0c90('0x14b'),_0x534b59[_0x4de749]));if(_0x4122d9['result']===-0x1){return _0x4122d9;}logger['info'](util[_0x0c90('0x2c')]('IFTIME\x20%s\x20%s',_0x534b59[_0x4de749],_0x4122d9[_0x0c90('0xa8')]));if(_0x4122d9[_0x0c90('0xa8')]==='true'){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x14c'),_0x534b59[_0x4de749],_0x0c90('0x145')));this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x14c'),_0x534b59[_0x4de749],_0x0c90('0x145')));return{'code':0xc8,'result':_0x0c90('0x145')};}else{logger['info'](util[_0x0c90('0x2c')]('IFTIME\x20%s\x20%s',_0x534b59[_0x4de749],_0x0c90('0x146')));this['channel']['noop'](util[_0x0c90('0x2c')](_0x0c90('0x14c'),_0x534b59[_0x4de749],_0x0c90('0x146')));}}return{'code':0xc8,'result':_0x0c90('0x146')};};AGIVertices['prototype'][_0x0c90('0x14d')]=function(_0x214ad3){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x14e'),_0x214ad3['label']));return this[_0x0c90('0xe')][_0x0c90('0x14d')]();};AGIVertices[_0x0c90('0x11')][_0x0c90('0x14f')]=function(_0x567424){logger['info'](util[_0x0c90('0x2c')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x567424[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x567424[_0x0c90('0x7d')])){return this['channel'][_0x0c90('0xad')]('no\x20key\x20configured');}var _0x4ec41b=_0x0c90('0x133');var _0x5ab83c=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x0c90('0x120')](0x4));var _0x5b6284=util[_0x0c90('0x2c')](_0x0c90('0xa4'),_0x5ab83c,_0x4ec41b);var _0x202095=!![];if(_0x567424[_0x0c90('0x13c')]==='NOBEEP'){_0x202095=![];}var _0x5940e5=this[_0x0c90('0xe')][_0x0c90('0x150')](_0x5ab83c,_0x4ec41b,_0x567424[_0x0c90('0x13d')],_0x567424[_0x0c90('0x6b')],undefined,_0x202095);if(_0x5940e5[_0x0c90('0xb4')]!==-0x1){this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x151'),_0x5b6284));var _0x5c64e1=this['ispeechASR']['sync'](this,_0x567424,_0x5b6284);if(_0x5c64e1){for(var _0x2ca781 in _0x5c64e1){if(_0x5c64e1[_0x0c90('0xa1')](_0x2ca781)){this['channel'][_0x0c90('0xa3')](util[_0x0c90('0x2c')](_0x0c90('0x152'),_0x2ca781['toUpperCase']()),_0x5c64e1[_0x2ca781]);}}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x153'),JSON[_0x0c90('0x75')](_0x5c64e1)));}}return _0x5940e5;};AGIVertices[_0x0c90('0x11')][_0x0c90('0x154')]=function(_0x3f03ad){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3f03ad[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x3f03ad[_0x0c90('0x7d')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xea'));}if(!this['isConfigured'](_0x3f03ad['text'])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xca'));}this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x3f03ad[_0x0c90('0x65')]));var _0x397393=this[_0x0c90('0x84')][_0x0c90('0x72')](this,_0x3f03ad);if(_0x397393){this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')]('ispeech\x20%s\x20file\x20created',_0x397393));var _0x47fc0e=this[_0x0c90('0xe')][_0x0c90('0x103')](_0x397393,_0x3f03ad[_0x0c90('0x13d')]);try{fs[_0x0c90('0x128')](_0x397393+'.wav');}catch(_0x3ea8bd){logger[_0x0c90('0x2f')](_0x3ea8bd);}return _0x47fc0e;}return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x3f03ad,_0x0c90('0x155'));};AGIVertices[_0x0c90('0x11')]['login']=function(_0x1c08ec){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x156'),_0x1c08ec['label']));if(!this['isConfigured'](_0x1c08ec[_0x0c90('0x157')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x1c08ec,'no\x20find\x20by\x20configured');}logger[_0x0c90('0x30')](util['format'](_0x0c90('0x158'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x1c08ec[_0x0c90('0x157')]));var _0x4d9ac7=this[_0x0c90('0x57')][_0x0c90('0x72')](this,_0x1c08ec[_0x0c90('0x157')]);if(_0x4d9ac7){logger[_0x0c90('0x30')](util['format'](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x1c08ec[_0x0c90('0x157')]));this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x1c08ec[_0x0c90('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x15a'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x1c08ec[_0x0c90('0x157')]));this[_0x0c90('0xe')][_0x0c90('0xad')](util['format'](_0x0c90('0x15a'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x1c08ec['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0c90('0x11')][_0x0c90('0x15b')]=function(_0xcc6675){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xcc6675['label']));if(!this[_0x0c90('0x89')](_0xcc6675[_0x0c90('0x157')])){return this['channel'][_0x0c90('0x2f')](_0xcc6675,_0x0c90('0x15c'));}logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x158'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0xcc6675['findBy']));var _0x2719a5=this[_0x0c90('0x56')][_0x0c90('0x72')](this,_0xcc6675[_0x0c90('0x157')]);if(_0x2719a5){logger[_0x0c90('0x30')](util['format'](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0xcc6675[_0x0c90('0x157')]));this['channel'][_0x0c90('0xad')](util['format'](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0xcc6675[_0x0c90('0x157')]));return{'code':0xc8,'result':_0x0c90('0x15d')};}else{logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x15a'),this['channel'][_0x0c90('0x3f')],_0xcc6675[_0x0c90('0x157')]));this['channel'][_0x0c90('0xad')](util['format'](_0x0c90('0x15a'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0xcc6675[_0x0c90('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0c90('0x11')]['math']=function(_0x3f239f){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x15e'),_0x3f239f[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x3f239f[_0x0c90('0x15f')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x3f239f,_0x0c90('0x160'));}this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x161'),_0x3f239f[_0x0c90('0x15f')]));var _0x593d7e=eval(_0x3f239f['operation']);if(!this[_0x0c90('0x89')](_0x3f239f[_0x0c90('0xda')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xdb'));}var _0x3dfee3=this[_0x0c90('0x12')][_0x0c90('0x72')](this,_0x3f239f[_0x0c90('0xda')]);if(!_0x3dfee3){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x3f239f,_0x0c90('0x11b'));}if(_[_0x0c90('0x9f')](_0x593d7e)){var _0xd61265=this;_0x593d7e['forEach'](function(_0x4afc8d,_0x5b8381){_0xd61265[_0x0c90('0xe')][_0x0c90('0xa3')](util[_0x0c90('0x2c')]('%s[%s]',_0x3dfee3,_0x5b8381),_0x4afc8d);});return this['channel'][_0x0c90('0xad')](util['format'](_0x0c90('0x162'),_0x3dfee3));}else{return this[_0x0c90('0xe')][_0x0c90('0xa3')](_0x3dfee3,_0x593d7e);}};AGIVertices[_0x0c90('0x11')][_0x0c90('0xb')]=function(_0x21683f){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x21683f[_0x0c90('0x3c')]));if(_0x21683f[_0x0c90('0x112')]===0x0){return this[_0x0c90('0xaa')](_0x21683f);}_0x21683f[_0x0c90('0x112')]-=0x1;if(!this[_0x0c90('0x89')](_0x21683f[_0x0c90('0x113')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x21683f,_0x0c90('0x114'));}var _0x25b7de=this[_0x0c90('0x22')][_0x0c90('0x72')](this,_0x21683f[_0x0c90('0x113')]);if(!_0x25b7de){return this[_0x0c90('0xe')]['error'](_0x21683f,_0x0c90('0x115'));}var _0x4c4ab0=this['channel'][_0x0c90('0x163')](_0x25b7de,_0x21683f[_0x0c90('0x116')],_0x21683f[_0x0c90('0x164')]);var _0x5be100=_0x4c4ab0[_0x0c90('0xb4')];if(_0x4c4ab0[_0x0c90('0xb4')]===-0x1){this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x21683f,'-1');return _0x4c4ab0;}else if(_0x4c4ab0[_0x0c90('0xa8')]===_0x0c90('0x6b')){_0x4c4ab0[_0x0c90('0xb4')]=_0x4c4ab0[_0x0c90('0xb4')][_0x0c90('0xa0')]>0x0?_0x4c4ab0['result']:'t';}else if(_['isEmpty'](_0x4c4ab0[_0x0c90('0xb4')])){_0x4c4ab0['result']='#';_0x5be100='#';}if(!this[_0x0c90('0x89')](_0x21683f[_0x0c90('0xda')])){this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xdb'));}else{var _0x54f67d=this[_0x0c90('0x12')][_0x0c90('0x72')](this,_0x21683f['variable_id']);if(!_0x54f67d){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x21683f,_0x0c90('0x11b'));}this[_0x0c90('0xe')][_0x0c90('0xa3')](_0x54f67d,_0x5be100);}this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x21683f,_0x5be100);return _0x4c4ab0;};AGIVertices[_0x0c90('0x11')][_0x0c90('0xad')]=function(_0x3085a9){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x165'),_0x3085a9[_0x0c90('0x3c')]));return this['channel'][_0x0c90('0xad')](_0x3085a9['output']||_0x3085a9[_0x0c90('0x3c')]);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x166')]=function(_0x329cc3){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x329cc3[_0x0c90('0x3c')]));if(!this['isConfigured'](_0x329cc3[_0x0c90('0x157')])){return this['channel'][_0x0c90('0x2f')](_0x329cc3,'no\x20find\x20by\x20configured');}logger[_0x0c90('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0c90('0xe')]['callerid'],_0x329cc3[_0x0c90('0x157')]));var _0xe392c=this[_0x0c90('0x167')][_0x0c90('0x72')](this,_0x329cc3[_0x0c90('0x168')]);var _0x364bff=this[_0x0c90('0x53')][_0x0c90('0x72')](this,_0x329cc3[_0x0c90('0x157')],_0xe392c);if(_0x364bff){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0c90('0x3f')],_0x329cc3[_0x0c90('0x157')]));this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x329cc3[_0x0c90('0x157')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x0c90('0x15a'),this[_0x0c90('0xe')]['callerid'],_0x329cc3[_0x0c90('0x157')]));this[_0x0c90('0xe')]['noop'](util['format'](_0x0c90('0x159'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x329cc3[_0x0c90('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0c90('0x11')][_0x0c90('0x169')]=function(_0x1116b1){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x16a'),_0x1116b1[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x1116b1[_0x0c90('0x113')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x1116b1,'no\x20file\x20audio\x20selected');}var _0x2ad7d8=this['getSound']['sync'](this,_0x1116b1['file_id']);if(!_0x2ad7d8){return this['channel']['error'](_0x1116b1,'no\x20file\x20audio\x20found');}var _0x3018e3=this[_0x0c90('0xe')][_0x0c90('0x59')](_0x0c90('0x16b'),[_0x2ad7d8,_0x1116b1[_0x0c90('0xe6')]]);if(_0x3018e3[_0x0c90('0xb4')]===-0x1){return _0x3018e3;}return this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2ad7d8));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x16c')]=function(_0x16011e){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x16011e[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x16011e[_0x0c90('0x16d')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x16011e,_0x0c90('0x16e'));}var _0x4e4566='';var _0x35041e=parseInt(_0x16011e['queue_id'],0xa);if(isNaN(_0x35041e)){_0x4e4566=_0x16011e[_0x0c90('0x16d')];}else{_0x4e4566=this['getVoiceQueue'][_0x0c90('0x72')](this,_0x16011e[_0x0c90('0x16d')]);if(!_0x4e4566){return this['channel'][_0x0c90('0x2f')](_0x16011e,_0x0c90('0x16f'));}}var _0x50d07a='';if(this[_0x0c90('0x89')](_0x16011e[_0x0c90('0x113')])){var _0x20f9ad=this[_0x0c90('0x22')][_0x0c90('0x72')](this,_0x16011e['file_id']);if(_0x20f9ad){_0x50d07a=_0x20f9ad;}}this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x16011e,_0x4e4566);if(_0x16011e[_0x0c90('0xe6')][_0x0c90('0x170')]('x')<0x0){_0x16011e[_0x0c90('0xe6')]+='x';}if(_0x16011e['opts']['indexOf']('X')<0x0){_0x16011e[_0x0c90('0xe6')]+='X';}this['channel'][_0x0c90('0xa3')](_0x0c90('0x171'),_0x4e4566?_0x4e4566[_0x0c90('0x172')]():'');var _0x7c123e=this['channel'][_0x0c90('0x59')]('QUEUE',[_0x4e4566,_0x16011e['opts'],_0x16011e[_0x0c90('0x68')],_0x50d07a,_0x16011e[_0x0c90('0x6b')],_0x16011e['agi'],_0x16011e[_0x0c90('0x173')],_0x16011e[_0x0c90('0x174')],'',_0x16011e[_0x0c90('0x175')]]);if(_0x7c123e[_0x0c90('0xb4')]===-0x1){return _0x7c123e;}return this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x176'),'QUEUE',_0x4e4566));};AGIVertices['prototype'][_0x0c90('0x177')]=function(_0x538e7e){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x178'),_0x538e7e[_0x0c90('0x3c')]));var _0x27d2ae=_0x538e7e[_0x0c90('0x179')]||_0x0c90('0x133');var _0x3df112=util[_0x0c90('0x2c')](_0x0c90('0x17a'),this['channel'][_0x0c90('0x3b')],rs['generate'](0x5));var _0x405920=util[_0x0c90('0x2c')](_0x0c90('0x17b'),FILES_PATH,_0x3df112,_0x27d2ae);var _0x5e12b4=util[_0x0c90('0x2c')](_0x0c90('0x134'),FILES_PATH,_0x3df112);this['createSquareRecording']['sync'](this,_0x538e7e,_0x3df112,_0x405920);this['channel'][_0x0c90('0xa3')]('RECORDING_SAVENAME',_0x3df112);logger[_0x0c90('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5e12b4,_0x27d2ae,_0x538e7e[_0x0c90('0x17c')],_0x538e7e[_0x0c90('0x6b')]);return this[_0x0c90('0xe')][_0x0c90('0x150')](_0x5e12b4,_0x27d2ae,_0x538e7e[_0x0c90('0x17c')],_0x538e7e[_0x0c90('0x6b')],undefined,!![]);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x17d')]=function(_0x197378){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x17e'),_0x197378['label']));if(!this['isConfigured'](_0x197378['url'])){return this['channel']['noop'](_0x0c90('0x17f'));}var _0x1ab7e8=this[_0x0c90('0x67')]['sync'](this,_0x197378);logger[_0x0c90('0x30')](util['format']('Response:',util[_0x0c90('0x180')](_0x1ab7e8,{'showHidden':![],'depth':null})));if(!this[_0x0c90('0x89')](_0x197378[_0x0c90('0xda')])){return this[_0x0c90('0xe')][_0x0c90('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xb8964e=this['getVariable']['sync'](this,_0x197378[_0x0c90('0xda')]);if(!_0xb8964e){return this['channel']['error'](_0x197378,_0x0c90('0x11b'));}this[_0x0c90('0xe')][_0x0c90('0xa3')](util[_0x0c90('0x2c')](_0x0c90('0x181'),_0xb8964e),_0x1ab7e8['statusCode']?_0x1ab7e8[_0x0c90('0x77')]:_0x0c90('0x182'));this[_0x0c90('0xe')][_0x0c90('0xa3')](util[_0x0c90('0x2c')]('%s_STATUS_MESSAGE',_0xb8964e),_0x1ab7e8['statusMessage']?_0x1ab7e8['statusMessage']:'OK');if(_0x1ab7e8['body']){try{this[_0x0c90('0xa2')](_0x1ab7e8[_0x0c90('0x76')],_0xb8964e);}catch(_0x34dc9c){logger['error'](util[_0x0c90('0x2c')](_0x0c90('0x183'),_0xb8964e));}}return this['channel'][_0x0c90('0xad')](util['format']('variable\x20%s\x20set',_0xb8964e));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x184')]=function(_0x290dba){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x185'),_0x290dba['label']));return this['channel'][_0x0c90('0x186')](_0x290dba[_0x0c90('0x187')][_0x0c90('0x5b')](/\s+/g,''),_0x290dba[_0x0c90('0x17c')]);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x188')]=function(_0x430bd2){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x189'),_0x430bd2[_0x0c90('0x3c')]));return this[_0x0c90('0xe')][_0x0c90('0x18a')](_0x430bd2['number'][_0x0c90('0x5b')](/\s+/g,''),_0x430bd2[_0x0c90('0x17c')]);};AGIVertices['prototype'][_0x0c90('0x18b')]=function(_0x7587bc){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x18c'),_0x7587bc['label']));return this[_0x0c90('0xe')][_0x0c90('0x18d')](_0x7587bc[_0x0c90('0x65')],_0x7587bc['escape_digits']);};AGIVertices[_0x0c90('0x11')][_0x0c90('0x18e')]=function(_0xddefe4){logger[_0x0c90('0x30')](util['format'](_0x0c90('0x18f'),_0xddefe4['label']));if(!this[_0x0c90('0x89')](_0xddefe4[_0x0c90('0x190')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x191'));}var _0xf3f830=this[_0x0c90('0x24')][_0x0c90('0x72')](this,_0xddefe4[_0x0c90('0x190')]);if(!_0xf3f830||!_0xf3f830[_0x0c90('0x192')]){return this['channel']['error'](_0xddefe4,_0x0c90('0x193'));}var _0x1efe13={'from':util[_0x0c90('0x2c')]('\x22%s\x22\x20<%s>',_0xf3f830[_0x0c90('0x17')],_0xf3f830['email']||_0xf3f830[_0x0c90('0x192')]['user']),'to':_0xddefe4['to']||'','cc':_0xddefe4['cc']||'','bcc':_0xddefe4[_0x0c90('0x194')]||'','subject':_0xddefe4['subject'],'html':_0xddefe4[_0x0c90('0x65')],'text':_0xddefe4[_0x0c90('0x65')]};if(this[_0x0c90('0x89')](_0xddefe4['template_id'])){}logger[_0x0c90('0xe0')]('sendMail\x20message',JSON[_0x0c90('0x75')](_0x1efe13));this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0xddefe4,_0xddefe4[_0x0c90('0x190')]);this[_0x0c90('0xe')][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x195'),_0xf3f830[_0x0c90('0x17')]));this[_0x0c90('0x26')][_0x0c90('0x72')](this,_0xf3f830[_0x0c90('0x196')],_0x1efe13);return this[_0x0c90('0xe')]['noop'](_0x0c90('0x197'));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x198')]=function(_0xe17ede){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x199'),_0xe17ede[_0x0c90('0x3c')]));return this[_0x0c90('0xe')]['noop'](_0x0c90('0x19a'));};AGIVertices[_0x0c90('0x11')]['sendSMS']=function(_0x5a8347){logger['info'](util['format'](_0x0c90('0x19b'),_0x5a8347[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x5a8347[_0x0c90('0x19c')])){return this['channel'][_0x0c90('0xad')](_0x0c90('0x19d'));}var _0x3b4356=this[_0x0c90('0x37')]['sync'](this,_0x5a8347['sms_account_id']);if(!_0x3b4356){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x5a8347,_0x0c90('0x19e'));}var _0x5be6f0={'body':_0x5a8347['sms_text'],'phone':_0x5a8347['to']||'','SmsAccountId':_0x3b4356['id']};logger[_0x0c90('0xe0')](_0x0c90('0x19f'),JSON[_0x0c90('0x75')](_0x5be6f0));this[_0x0c90('0x3a')][_0x0c90('0x72')](this,_0x5a8347,_0x5a8347[_0x0c90('0x19c')]);this[_0x0c90('0xe')][_0x0c90('0xad')](util['format'](_0x0c90('0x1a0'),_0x3b4356[_0x0c90('0x17')]));this[_0x0c90('0x39')][_0x0c90('0x72')](this,_0x5be6f0);return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x1a1'));};AGIVertices[_0x0c90('0x11')]['set']=function(_0xbfda0b){logger[_0x0c90('0x30')](util['format'](_0x0c90('0x1a2'),_0xbfda0b[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0xbfda0b['variable_id'])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0xbfda0b,'no\x20variable\x20selected');}var _0x4cd446=this[_0x0c90('0x12')]['sync'](this,_0xbfda0b[_0x0c90('0xda')]);if(!_0x4cd446){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0xbfda0b,_0x0c90('0x11b'));}return this[_0x0c90('0xe')][_0x0c90('0xa3')](_0x4cd446,_0xbfda0b['variable_value']);};AGIVertices['prototype'][_0x0c90('0x1a3')]=function(_0x1c68ec){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x1a4'),_0x1c68ec[_0x0c90('0x3c')]));this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0x1a5'));if(_0x1c68ec[_0x0c90('0xbe')]===_0x0c90('0x1a6')){this[_0x0c90('0xe')][_0x0c90('0xad')]('Answer');return this['channel'][_0x0c90('0xbe')]();}return this[_0x0c90('0xe')]['noop'](_0x0c90('0x1a7'));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1a8')]=function(_0x5aa210){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x1a9'),_0x5aa210[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x5aa210[_0x0c90('0x1aa')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x5aa210,'no\x20subproject\x20selected');}var _0x3e19b4=this[_0x0c90('0x18')]['sync'](this,_0x5aa210[_0x0c90('0x1aa')]);if(!this[_0x0c90('0x89')](_0x3e19b4)){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x5aa210,util[_0x0c90('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5aa210[_0x0c90('0x1aa')]));}if(_0x3e19b4===this[_0x0c90('0xe')][_0x0c90('0x3e')]){return this['channel'][_0x0c90('0x2f')](_0x5aa210,_0x0c90('0x1ab'));}this[_0x0c90('0x3a')]['sync'](this,_0x5aa210,_0x3e19b4);var _0x2d0763=this['channel'][_0x0c90('0x59')](_0x0c90('0x1ac'),util['format'](_0x0c90('0x1ad'),config['agi'][_0x0c90('0x1ae')]||_0x0c90('0x1af'),_0x3e19b4,this[_0x0c90('0xe')][_0x0c90('0x3e')]));if(_0x2d0763['result']===-0x1){return _0x2d0763;}return this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')]('Executed\x20command\x20%s\x20%s',_0x0c90('0x1ac'),_0x3e19b4));};AGIVertices['prototype'][_0x0c90('0x1b0')]=function(_0x332fa3){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x1b1'),_0x332fa3[_0x0c90('0x3c')]));var _0x1de90d=this[_0x0c90('0x1b2')]['sync'](this,_0x332fa3[_0x0c90('0xbc')]);this['createSquareDetailsReport'][_0x0c90('0x72')](this,_0x332fa3,_0x332fa3[_0x0c90('0xbc')]);if(this['isConfigured'](_0x332fa3['variable_id'])){var _0x2da545=this[_0x0c90('0x12')][_0x0c90('0x72')](this,_0x332fa3[_0x0c90('0xda')]);if(_0x2da545){this[_0x0c90('0xe')][_0x0c90('0xa3')](_0x2da545,_0x1de90d);return this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x332fa3[_0x0c90('0xbc')],_0x2da545));}}return this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')](_0x0c90('0x1b3'),_0x332fa3[_0x0c90('0xbc')]));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1b4')]=function(_0x57984b){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x1b5'),_0x57984b[_0x0c90('0x3c')]));_0x57984b['text']=_0x57984b[_0x0c90('0x65')][_0x0c90('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0c90('0x89')](_0x57984b['apiKey'])){return this['channel'][_0x0c90('0xad')](_0x0c90('0x1b6'));}if(!this[_0x0c90('0x89')](_0x57984b[_0x0c90('0x65')])){return this[_0x0c90('0xe')][_0x0c90('0xad')](_0x0c90('0xca'));}this[_0x0c90('0xe')][_0x0c90('0xad')](util['format'](_0x0c90('0x1b7'),_0x57984b[_0x0c90('0x65')]));var _0x2df9f6=this[_0x0c90('0x5c')][_0x0c90('0x72')](this,_0x57984b);if(_0x2df9f6){this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')](_0x0c90('0x1b8'),_0x2df9f6));var _0x490f85=this[_0x0c90('0xe')][_0x0c90('0x103')](_0x2df9f6);try{fs[_0x0c90('0x128')](_0x2df9f6+_0x0c90('0x1b9'));}catch(_0x3316a3){logger[_0x0c90('0x2f')](_0x3316a3);}return _0x490f85;}return this['channel']['error'](_0x57984b,_0x0c90('0x1ba'));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1bb')]=function(_0x333fe8){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x1bc'),_0x333fe8[_0x0c90('0x3c')]));_0x333fe8['text']=_0x333fe8['text'][_0x0c90('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x333fe8[_0x0c90('0x65')])){return this[_0x0c90('0xe')][_0x0c90('0xad')]('no\x20text\x20configured');}this[_0x0c90('0xe')][_0x0c90('0xad')](util['format'](_0x0c90('0x1bd'),_0x333fe8['text']));var _0x2e3f61=this[_0x0c90('0x64')]['sync'](this,_0x333fe8);if(_0x2e3f61){this['channel'][_0x0c90('0xad')](util[_0x0c90('0x2c')](_0x0c90('0x1be'),_0x2e3f61));var _0x4a4fab=this[_0x0c90('0xe')][_0x0c90('0x103')](_0x2e3f61);try{fs[_0x0c90('0x128')](_0x2e3f61+_0x0c90('0x1b9'));}catch(_0x513e16){logger[_0x0c90('0x2f')](_0x513e16);}return _0x4a4fab;}return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x333fe8,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1bf')]=function(_0x260bf5){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x1c0'),_0x260bf5[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x260bf5['findBy'])){return this[_0x0c90('0xe')]['error'](_0x260bf5,_0x0c90('0x15c'));}logger[_0x0c90('0x30')](util[_0x0c90('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x260bf5[_0x0c90('0x157')]));var _0x1ed298=this[_0x0c90('0x54')][_0x0c90('0x72')](this,_0x260bf5[_0x0c90('0x157')]);if(_0x1ed298){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x159'),this['channel'][_0x0c90('0x3f')],_0x260bf5[_0x0c90('0x157')]));this['channel']['noop'](util[_0x0c90('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x260bf5[_0x0c90('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x15a'),this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x260bf5[_0x0c90('0x157')]));this[_0x0c90('0xe')]['noop'](util[_0x0c90('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0c90('0xe')][_0x0c90('0x3f')],_0x260bf5['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1c1')]=function(_0x33614f){logger[_0x0c90('0x30')](util[_0x0c90('0x2c')](_0x0c90('0x1c2'),_0x33614f[_0x0c90('0x3c')]));var _0x4de140=this[_0x0c90('0xe')][_0x0c90('0x59')](_0x0c90('0x1c3'),[_0x33614f[_0x0c90('0x1c4')],_0x33614f[_0x0c90('0x7b')]]);if(_0x4de140[_0x0c90('0xb4')]===-0x1){return _0x4de140;}return this[_0x0c90('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x0c90('0x1c3'),_0x33614f['mailbox']));};AGIVertices[_0x0c90('0x11')][_0x0c90('0x1c5')]=function(_0x57beb3){logger['info'](util[_0x0c90('0x2c')](_0x0c90('0x1c6'),_0x57beb3[_0x0c90('0x3c')]));if(!this[_0x0c90('0x89')](_0x57beb3[_0x0c90('0xda')])){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x57beb3,_0x0c90('0x1c7'));}var _0x130fed=this[_0x0c90('0x12')][_0x0c90('0x72')](this,_0x57beb3[_0x0c90('0xda')]);if(!_0x130fed){return this[_0x0c90('0xe')][_0x0c90('0x2f')](_0x57beb3,_0x0c90('0x11b'));}var _0x4f6457=this['channel'][_0x0c90('0x12')](_0x130fed);return{'code':0xc8,'result':_0x4f6457[_0x0c90('0xa8')]?_0x4f6457[_0x0c90('0xa8')]:'-'};};String[_0x0c90('0x11')][_0x0c90('0xa7')]=function(_0x5a6d13,_0x365e50){return this[_0x0c90('0xa6')](_0x5a6d13)['join'](_0x365e50);};module[_0x0c90('0x1c8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1a1c521..0d14b7d 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 _0x8759=['syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','catch','finally','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','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8759,0x1a2));var _0x9875=function(_0x19bee5,_0x1d9608){_0x19bee5=_0x19bee5-0x0;var _0x3d1bb8=_0x8759[_0x19bee5];return _0x3d1bb8;};'use strict';var util=require(_0x9875('0x0'));var _=require(_0x9875('0x1'));var moment=require(_0x9875('0x2'));var ami=require('../ami');var logger=require(_0x9875('0x3'))(_0x9875('0x4'));var RpcUser=require(_0x9875('0x5'));var RpcVoiceAgentReport=require(_0x9875('0x6'));function Acw(_0x28ae0a){this[_0x9875('0x7')]=_0x28ae0a[_0x9875('0x7')];this[_0x9875('0x8')]=_0x28ae0a[_0x9875('0x8')];this[_0x9875('0x9')]=_0x28ae0a[_0x9875('0x9')];this[_0x9875('0xa')]={};ami['on'](_0x9875('0xb'),this[_0x9875('0xc')][_0x9875('0xd')](this));ami['on'](_0x9875('0xe'),this['syncHangupRequest'][_0x9875('0xd')](this));ami['on']('hangup',this[_0x9875('0xf')]['bind'](this));ami['on'](_0x9875('0x10'),this['syncAgentRingNoAnswer'][_0x9875('0xd')](this));ami['on'](_0x9875('0x11'),this[_0x9875('0x12')][_0x9875('0xd')](this));ami['on'](_0x9875('0x13'),this[_0x9875('0x14')]['bind'](this));ami['on'](_0x9875('0x15'),this[_0x9875('0x16')]['bind'](this));}function getDiff(_0x480063){var _0x4073b0=moment()[_0x9875('0x17')](0x0);var _0x584fa1=moment(_0x480063)[_0x9875('0x17')](0x0);return _0x4073b0['diff'](_0x584fa1,_0x9875('0x18'));}Acw[_0x9875('0x19')][_0x9875('0x1a')]=function(_0xf11e01){try{var _0x4a4d26=this;var _0xaadc46=this['channels'][_0xf11e01]['interface'];var _0x244d57=this['channels'][_0xf11e01][_0x9875('0x1b')];var _0x14784c=this[_0x9875('0x7')][_0x244d57];var _0x4ffdc8=![];var _0x322b01=_0x9875('0x1c');if(_0x14784c[_0x9875('0x1d')]){if(_0x14784c[_0x9875('0x1e')][_0x9875('0x1f')]){_0x4ffdc8=!![];_0x322b01=_0x14784c[_0x9875('0x1e')]['name'];}}ami[_0x9875('0x20')]({'action':_0x9875('0x21'),'interface':_0xaadc46,'paused':!![],'reason':_0x322b01})['then'](function(_0x1f0402){if(_0x4a4d26[_0x9875('0x8')][_0xaadc46]){return RpcUser[_0x9875('0x22')](_0x4a4d26[_0x9875('0x8')][_0xaadc46]['id'])[_0x9875('0x23')](function(_0xb80183){if(_0xb80183&&!_0xb80183[_0x9875('0x24')]){logger[_0x9875('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xf11e01,_0xaadc46,_0x244d57);var _0x42e165=_0x4a4d26['channels'][_0xf11e01][_0x9875('0x26')]&&_0x4a4d26[_0x9875('0xa')][_0xf11e01][_0x9875('0x27')]?_0x4a4d26[_0x9875('0xa')][_0xf11e01][_0x9875('0x27')]:_0xf11e01;return RpcUser[_0x9875('0x28')](_0x4a4d26[_0x9875('0x8')][_0xaadc46],_0x322b01,_0x42e165)[_0x9875('0x23')](function(_0x508169){if(!_0x4ffdc8){_0x4a4d26[_0x9875('0x9')][_0xaadc46]={};logger[_0x9875('0x25')](_0x9875('0x29'),_0xf11e01,_0x4a4d26[_0x9875('0x7')][_0x244d57]['acwTimeout'],_0xaadc46,_0x244d57);_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2a')]=setTimeout(_0x4a4d26[_0x9875('0x2b')][_0x9875('0xd')](_0x4a4d26,_0xaadc46),_0x4a4d26[_0x9875('0x7')][_0x244d57][_0x9875('0x2c')]*0x3e8);_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2d')]=moment()[_0x9875('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2f')]=_0xf11e01;_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x1b')]=_0x244d57;_0x4a4d26['timers'][_0xaadc46][_0x9875('0x30')]=function(){var _0x517f70=getDiff(_0x4a4d26[_0x9875('0x9')][_0xaadc46]['lastPauseAt']);clearTimeout(_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2a')]);_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2a')]=![];RpcVoiceAgentReport[_0x9875('0x31')]({'acwtime':_0x517f70},_0x4a4d26[_0x9875('0x9')][_0xaadc46][_0x9875('0x2f')],_0xaadc46)[_0x9875('0x23')](function(_0xff1b75){logger[_0x9875('0x25')](_0x9875('0x32'),_0xf11e01,_0x517f70,_0xff1b75);})['catch'](function(_0xbacf7a){logger[_0x9875('0x33')](_0x9875('0x34'),_0xf11e01,_0xbacf7a);});delete _0x4a4d26[_0x9875('0x9')][_0xaadc46];};}});}else{logger[_0x9875('0x25')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0xf11e01,_0xaadc46,_0x244d57);}});}})[_0x9875('0x35')](function(_0x377755){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xf11e01,_0x4a4d26[_0x9875('0x7')][_0x244d57][_0x9875('0x2c')],_0xaadc46,_0x244d57);})[_0x9875('0x36')](function(){delete _0x4a4d26[_0x9875('0xa')][_0xf11e01];});}catch(_0x4acc57){logger['error']('[ACW][START]\x20%s',_0x4acc57[_0x9875('0x37')]);}};Acw[_0x9875('0x19')]['stopAcw']=function(_0x7e76ce){try{var _0x1646e7=this;if(_0x1646e7['timers'][_0x7e76ce]){_0x1646e7[_0x9875('0x9')][_0x7e76ce][_0x9875('0x2a')]=![];var _0x16aa04=_0x1646e7['timers'][_0x7e76ce][_0x9875('0x2f')];var _0x11046a=_0x1646e7['timers'][_0x7e76ce][_0x9875('0x1b')];var _0x58e01e=_0x1646e7[_0x9875('0x7')][_0x11046a][_0x9875('0x2c')];logger[_0x9875('0x25')](_0x9875('0x38'),_0x16aa04,_0x7e76ce);RpcUser['saveUnpause'](this[_0x9875('0x8')][_0x7e76ce]);RpcVoiceAgentReport['update']({'acwtime':_0x58e01e,'agentacw':!![]},_0x16aa04,_0x7e76ce)[_0x9875('0x23')](function(_0x3f4d70){logger[_0x9875('0x25')](_0x9875('0x32'),_0x16aa04,_0x58e01e,_0x3f4d70);})[_0x9875('0x35')](function(_0x4327ed){logger[_0x9875('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x16aa04,_0x4327ed);});}else{logger[_0x9875('0x33')](_0x9875('0x39'),_0x7e76ce);if(_0x1646e7[_0x9875('0x9')]){logger[_0x9875('0x25')]('[ACW][TIMERS]',JSON[_0x9875('0x3a')](_0x1646e7[_0x9875('0x9')]));}}}catch(_0x4fe0da){logger[_0x9875('0x33')](_0x9875('0x3b'),_0x4fe0da[_0x9875('0x37')]);}};Acw[_0x9875('0x19')][_0x9875('0xc')]=function(_0x497c57){try{if(this[_0x9875('0x7')][_0x497c57[_0x9875('0x1b')]]&&(this[_0x9875('0x7')][_0x497c57[_0x9875('0x1b')]][_0x9875('0x4')]||this[_0x9875('0x7')][_0x497c57[_0x9875('0x1b')]]['mandatoryDisposition'])){if(this[_0x9875('0x8')][_0x497c57[_0x9875('0x3c')]]){this[_0x9875('0xa')][_0x497c57[_0x9875('0x2f')]]={'queue':_0x497c57[_0x9875('0x1b')],'interface':_0x497c57[_0x9875('0x3c')],'destlinkedid':_0x497c57[_0x9875('0x27')]};}}}catch(_0x1cb2e1){logger['error'](_0x9875('0x3d'),_0x1cb2e1[_0x9875('0x37')]);}};Acw[_0x9875('0x19')][_0x9875('0x16')]=function(_0x3ee53c){try{if(this[_0x9875('0x7')][_0x3ee53c[_0x9875('0x1b')]]&&(this[_0x9875('0x7')][_0x3ee53c[_0x9875('0x1b')]][_0x9875('0x4')]||this['voiceQueues'][_0x3ee53c['queue']][_0x9875('0x1d')])){if(this['agents'][_0x3ee53c['interface']]){this[_0x9875('0xa')][_0x3ee53c[_0x9875('0x2f')]]={'queue':_0x3ee53c[_0x9875('0x1b')],'interface':_0x3ee53c[_0x9875('0x3c')]};}}}catch(_0x14d294){logger['error'](_0x9875('0x3e'),_0x14d294['message']);}};Acw['prototype'][_0x9875('0x3f')]=function(_0xb47240){try{if(this['channels'][_0xb47240['uniqueid']]&&_[_0x9875('0x40')](this[_0x9875('0xa')][_0xb47240[_0x9875('0x2f')]]['attended'])){logger[_0x9875('0x25')](_0x9875('0x41'),_0xb47240[_0x9875('0x2f')]);this[_0x9875('0x1a')](_0xb47240[_0x9875('0x2f')]);}else if(this['channels'][_0xb47240['linkedid']]&&_[_0x9875('0x40')](this[_0x9875('0xa')][_0xb47240[_0x9875('0x42')]][_0x9875('0x26')])){logger['info'](_0x9875('0x43'),_0xb47240['linkedid']);this[_0x9875('0x1a')](_0xb47240['linkedid']);}}catch(_0x42b862){logger['error'](_0x9875('0x44'),_0x42b862[_0x9875('0x37')]);}};Acw[_0x9875('0x19')]['syncHangup']=function(_0x3f1a1e){try{if(this[_0x9875('0xa')][_0x3f1a1e['uniqueid']]&&this[_0x9875('0xa')][_0x3f1a1e['uniqueid']]['attended']){logger[_0x9875('0x25')](_0x9875('0x45'),_0x3f1a1e[_0x9875('0x2f')]);this[_0x9875('0x1a')](_0x3f1a1e[_0x9875('0x2f')]);}else if(this[_0x9875('0xa')][_0x3f1a1e['linkedid']]&&this['channels'][_0x3f1a1e[_0x9875('0x42')]][_0x9875('0x26')]){logger[_0x9875('0x25')](_0x9875('0x46'),_0x3f1a1e[_0x9875('0x42')]);this['startAcw'](_0x3f1a1e[_0x9875('0x42')]);}}catch(_0x4e1de4){logger[_0x9875('0x33')]('[ACW][syncHangup]\x20%s',_0x4e1de4[_0x9875('0x37')]);}};Acw['prototype'][_0x9875('0x12')]=function(_0xc8a2eb){try{if(!_[_0x9875('0x47')](this[_0x9875('0xa')][_0xc8a2eb['transfereeuniqueid']])){this['startAcw'](_0xc8a2eb['transfereeuniqueid']);if(this[_0x9875('0xa')][_0xc8a2eb[_0x9875('0x48')]]){this[_0x9875('0xa')][_0xc8a2eb[_0x9875('0x48')]][_0x9875('0x26')]=!![];this['channels'][_0xc8a2eb[_0x9875('0x49')]]=this[_0x9875('0xa')][_0xc8a2eb['secondtransfereruniqueid']];delete this[_0x9875('0xa')][_0xc8a2eb['secondtransfereruniqueid']];}}else if(!_['isNil'](this['channels'][_0xc8a2eb[_0x9875('0x49')]])){this['startAcw'](_0xc8a2eb[_0x9875('0x49')]);if(this[_0x9875('0xa')][_0xc8a2eb[_0x9875('0x4a')]]){this[_0x9875('0xa')][_0xc8a2eb['origtransfereruniqueid']][_0x9875('0x26')]=!![];this[_0x9875('0xa')][_0xc8a2eb['transfereeuniqueid']]=this[_0x9875('0xa')][_0xc8a2eb[_0x9875('0x4a')]];delete this[_0x9875('0xa')][_0xc8a2eb['origtransfereruniqueid']];}}}catch(_0x401408){logger[_0x9875('0x33')](_0x9875('0x4b'),_0x401408[_0x9875('0x37')]);}};Acw['prototype'][_0x9875('0x14')]=function(_0xf0e75c){try{if(this['channels'][_0xf0e75c[_0x9875('0x4c')]]){logger[_0x9875('0x25')](_0x9875('0x4d'),JSON['stringify'](_0xf0e75c[_0x9875('0x4c')]));this[_0x9875('0x1a')](_0xf0e75c[_0x9875('0x4c')]);}else if(this[_0x9875('0xa')][_0xf0e75c[_0x9875('0x4e')]]){logger[_0x9875('0x25')](_0x9875('0x4f'),JSON[_0x9875('0x3a')](_0xf0e75c[_0x9875('0x4e')]));this[_0x9875('0x1a')](_0xf0e75c['transfererlinkedid']);}}catch(_0x3a5011){logger['error'](_0x9875('0x50'),_0x3a5011[_0x9875('0x37')]);}};Acw[_0x9875('0x19')][_0x9875('0x51')]=function(_0x44e5c7){try{if(this[_0x9875('0x7')][_0x44e5c7[_0x9875('0x1b')]]&&this[_0x9875('0x7')][_0x44e5c7['queue']][_0x9875('0x52')]===_0x9875('0x53')){if(this[_0x9875('0x8')][_0x44e5c7[_0x9875('0x3c')]]){logger['info'](_0x9875('0x54'),_0x44e5c7[_0x9875('0x2f')],_0x44e5c7[_0x9875('0x3c')],_0x44e5c7[_0x9875('0x1b')]);return RpcUser[_0x9875('0x28')](this['agents'][_0x44e5c7[_0x9875('0x3c')]],_0x9875('0x55'),_0x44e5c7['uniqueid']);}}}catch(_0x230ce2){logger[_0x9875('0x33')](_0x9875('0x56'),_0x230ce2[_0x9875('0x37')]);}};module[_0x9875('0x57')]=Acw; \ No newline at end of file +var _0x541e=['mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','finally','message','stopAcw','uniqueid','[%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','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW'];(function(_0x5cfea2,_0x32275c){var _0x19980c=function(_0x3ae946){while(--_0x3ae946){_0x5cfea2['push'](_0x5cfea2['shift']());}};_0x19980c(++_0x32275c);}(_0x541e,0x92));var _0xe541=function(_0x53d8fe,_0x54c4e1){_0x53d8fe=_0x53d8fe-0x0;var _0x343607=_0x541e[_0x53d8fe];return _0x343607;};'use strict';var util=require(_0xe541('0x0'));var _=require(_0xe541('0x1'));var moment=require('moment');var ami=require(_0xe541('0x2'));var logger=require(_0xe541('0x3'))(_0xe541('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe541('0x5'));function Acw(_0xf5e85c){this[_0xe541('0x6')]=_0xf5e85c[_0xe541('0x6')];this['agents']=_0xf5e85c[_0xe541('0x7')];this[_0xe541('0x8')]=_0xf5e85c[_0xe541('0x8')];this['channels']={};ami['on'](_0xe541('0x9'),this[_0xe541('0xa')][_0xe541('0xb')](this));ami['on'](_0xe541('0xc'),this['syncHangupRequest'][_0xe541('0xb')](this));ami['on'](_0xe541('0xd'),this['syncHangup']['bind'](this));ami['on'](_0xe541('0xe'),this[_0xe541('0xf')][_0xe541('0xb')](this));ami['on'](_0xe541('0x10'),this[_0xe541('0x11')]['bind'](this));ami['on'](_0xe541('0x12'),this[_0xe541('0x13')]['bind'](this));ami['on'](_0xe541('0x14'),this[_0xe541('0x15')]['bind'](this));}function getDiff(_0x1a21d0){var _0xdbd5df=moment()['milliseconds'](0x0);var _0xb58406=moment(_0x1a21d0)[_0xe541('0x16')](0x0);return _0xdbd5df[_0xe541('0x17')](_0xb58406,_0xe541('0x18'));}Acw[_0xe541('0x19')]['startAcw']=function(_0x2e7dbe){try{var _0xf27860=this;var _0x3bc55d=this[_0xe541('0x1a')][_0x2e7dbe][_0xe541('0x1b')];var _0x185b1b=this['channels'][_0x2e7dbe][_0xe541('0x1c')];var _0x3a9f3b=this[_0xe541('0x6')][_0x185b1b];var _0x528ee5=![];var _0x259c50=_0xe541('0x1d');if(_0x3a9f3b[_0xe541('0x1e')]){if(_0x3a9f3b[_0xe541('0x1f')]['name']){_0x528ee5=!![];_0x259c50=_0x3a9f3b[_0xe541('0x1f')][_0xe541('0x20')];}}ami[_0xe541('0x21')]({'action':_0xe541('0x22'),'interface':_0x3bc55d,'paused':!![],'reason':_0x259c50})[_0xe541('0x23')](function(_0xe8f86f){if(_0xf27860[_0xe541('0x7')][_0x3bc55d]){return RpcUser[_0xe541('0x24')](_0xf27860[_0xe541('0x7')][_0x3bc55d]['id'])['then'](function(_0x2effc6){if(_0x2effc6&&!_0x2effc6['voicePause']){logger[_0xe541('0x25')](_0xe541('0x26'),_0x2e7dbe,_0x3bc55d,_0x185b1b);var _0x2f8d80=_0xf27860['channels'][_0x2e7dbe][_0xe541('0x27')]&&_0xf27860[_0xe541('0x1a')][_0x2e7dbe][_0xe541('0x28')]?_0xf27860[_0xe541('0x1a')][_0x2e7dbe]['destlinkedid']:_0x2e7dbe;return RpcUser[_0xe541('0x29')](_0xf27860[_0xe541('0x7')][_0x3bc55d],_0x259c50,_0x2f8d80)[_0xe541('0x23')](function(_0x437129){if(!_0x528ee5){_0xf27860['timers'][_0x3bc55d]={};logger['info'](_0xe541('0x2a'),_0x2e7dbe,_0xf27860[_0xe541('0x6')][_0x185b1b][_0xe541('0x2b')],_0x3bc55d,_0x185b1b);_0xf27860[_0xe541('0x8')][_0x3bc55d][_0xe541('0x2c')]=setTimeout(_0xf27860['stopAcw']['bind'](_0xf27860,_0x3bc55d),_0xf27860[_0xe541('0x6')][_0x185b1b]['acwTimeout']*0x3e8);_0xf27860['timers'][_0x3bc55d][_0xe541('0x2d')]=moment()['format'](_0xe541('0x2e'));_0xf27860[_0xe541('0x8')][_0x3bc55d]['uniqueid']=_0x2e7dbe;_0xf27860[_0xe541('0x8')][_0x3bc55d][_0xe541('0x1c')]=_0x185b1b;_0xf27860['timers'][_0x3bc55d][_0xe541('0x2f')]=function(){var _0x2ed644=getDiff(_0xf27860['timers'][_0x3bc55d]['lastPauseAt']);clearTimeout(_0xf27860['timers'][_0x3bc55d][_0xe541('0x2c')]);_0xf27860[_0xe541('0x8')][_0x3bc55d][_0xe541('0x2c')]=![];RpcVoiceAgentReport[_0xe541('0x30')]({'acwtime':_0x2ed644},_0xf27860[_0xe541('0x8')][_0x3bc55d]['uniqueid'],_0x3bc55d)[_0xe541('0x23')](function(_0x3ca7a7){logger[_0xe541('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x2e7dbe,_0x2ed644,_0x3ca7a7);})[_0xe541('0x31')](function(_0x316f67){logger[_0xe541('0x32')](_0xe541('0x33'),_0x2e7dbe,_0x316f67);});delete _0xf27860[_0xe541('0x8')][_0x3bc55d];};}});}else{logger[_0xe541('0x25')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2e7dbe,_0x3bc55d,_0x185b1b);}});}})['catch'](function(_0x533bb0){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2e7dbe,_0xf27860[_0xe541('0x6')][_0x185b1b]['acwTimeout'],_0x3bc55d,_0x185b1b);})[_0xe541('0x34')](function(){delete _0xf27860[_0xe541('0x1a')][_0x2e7dbe];});}catch(_0x10c1e8){logger[_0xe541('0x32')]('[ACW][START]\x20%s',_0x10c1e8[_0xe541('0x35')]);}};Acw[_0xe541('0x19')][_0xe541('0x36')]=function(_0x5d0831){try{var _0x4d8cd2=this;if(_0x4d8cd2[_0xe541('0x8')][_0x5d0831]){_0x4d8cd2[_0xe541('0x8')][_0x5d0831]['timer']=![];var _0x5d6e32=_0x4d8cd2['timers'][_0x5d0831][_0xe541('0x37')];var _0x42fa86=_0x4d8cd2['timers'][_0x5d0831]['queue'];var _0x5723a4=_0x4d8cd2[_0xe541('0x6')][_0x42fa86][_0xe541('0x2b')];logger[_0xe541('0x25')](_0xe541('0x38'),_0x5d6e32,_0x5d0831);RpcUser['saveUnpause'](this[_0xe541('0x7')][_0x5d0831]);RpcVoiceAgentReport[_0xe541('0x30')]({'acwtime':_0x5723a4,'agentacw':!![]},_0x5d6e32,_0x5d0831)[_0xe541('0x23')](function(_0x4d9265){logger[_0xe541('0x25')](_0xe541('0x39'),_0x5d6e32,_0x5723a4,_0x4d9265);})[_0xe541('0x31')](function(_0xca787c){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x5d6e32,_0xca787c);});}else{logger[_0xe541('0x32')](_0xe541('0x3a'),_0x5d0831);if(_0x4d8cd2['timers']){logger['info'](_0xe541('0x3b'),JSON[_0xe541('0x3c')](_0x4d8cd2[_0xe541('0x8')]));}}}catch(_0x173876){logger['error'](_0xe541('0x3d'),_0x173876[_0xe541('0x35')]);}};Acw[_0xe541('0x19')][_0xe541('0xa')]=function(_0x54e543){try{if(this[_0xe541('0x6')][_0x54e543['queue']]&&(this[_0xe541('0x6')][_0x54e543['queue']][_0xe541('0x4')]||this[_0xe541('0x6')][_0x54e543[_0xe541('0x1c')]][_0xe541('0x1e')])){if(this[_0xe541('0x7')][_0x54e543['interface']]){this[_0xe541('0x1a')][_0x54e543[_0xe541('0x37')]]={'queue':_0x54e543[_0xe541('0x1c')],'interface':_0x54e543['interface'],'destlinkedid':_0x54e543[_0xe541('0x28')]};}}}catch(_0x5b338f){logger['error'](_0xe541('0x3e'),_0x5b338f['message']);}};Acw['prototype'][_0xe541('0x15')]=function(_0x1ae2df){try{if(this['voiceQueues'][_0x1ae2df[_0xe541('0x1c')]]&&(this[_0xe541('0x6')][_0x1ae2df[_0xe541('0x1c')]][_0xe541('0x4')]||this['voiceQueues'][_0x1ae2df['queue']]['mandatoryDisposition'])){if(this[_0xe541('0x7')][_0x1ae2df['interface']]){this[_0xe541('0x1a')][_0x1ae2df[_0xe541('0x37')]]={'queue':_0x1ae2df['queue'],'interface':_0x1ae2df[_0xe541('0x1b')]};}}}catch(_0x542c5c){logger['error'](_0xe541('0x3f'),_0x542c5c['message']);}};Acw[_0xe541('0x19')][_0xe541('0x40')]=function(_0x5ebeb1){try{if(this[_0xe541('0x1a')][_0x5ebeb1[_0xe541('0x37')]]&&_[_0xe541('0x41')](this[_0xe541('0x1a')][_0x5ebeb1[_0xe541('0x37')]][_0xe541('0x27')])){logger[_0xe541('0x25')](_0xe541('0x42'),_0x5ebeb1['uniqueid']);this[_0xe541('0x43')](_0x5ebeb1[_0xe541('0x37')]);}else if(this[_0xe541('0x1a')][_0x5ebeb1[_0xe541('0x44')]]&&_[_0xe541('0x41')](this['channels'][_0x5ebeb1[_0xe541('0x44')]][_0xe541('0x27')])){logger[_0xe541('0x25')](_0xe541('0x45'),_0x5ebeb1['linkedid']);this[_0xe541('0x43')](_0x5ebeb1[_0xe541('0x44')]);}}catch(_0xf3b072){logger[_0xe541('0x32')](_0xe541('0x46'),_0xf3b072[_0xe541('0x35')]);}};Acw[_0xe541('0x19')][_0xe541('0x47')]=function(_0x211238){try{if(this[_0xe541('0x1a')][_0x211238[_0xe541('0x37')]]&&this[_0xe541('0x1a')][_0x211238[_0xe541('0x37')]]['attended']){logger[_0xe541('0x25')](_0xe541('0x48'),_0x211238[_0xe541('0x37')]);this[_0xe541('0x43')](_0x211238['uniqueid']);}else if(this[_0xe541('0x1a')][_0x211238[_0xe541('0x44')]]&&this[_0xe541('0x1a')][_0x211238[_0xe541('0x44')]][_0xe541('0x27')]){logger[_0xe541('0x25')](_0xe541('0x49'),_0x211238['linkedid']);this[_0xe541('0x43')](_0x211238[_0xe541('0x44')]);}}catch(_0x1eef27){logger[_0xe541('0x32')](_0xe541('0x4a'),_0x1eef27['message']);}};Acw[_0xe541('0x19')][_0xe541('0x11')]=function(_0x490410){try{if(!_[_0xe541('0x4b')](this[_0xe541('0x1a')][_0x490410[_0xe541('0x4c')]])){this[_0xe541('0x43')](_0x490410[_0xe541('0x4c')]);if(this[_0xe541('0x1a')][_0x490410[_0xe541('0x4d')]]){this[_0xe541('0x1a')][_0x490410[_0xe541('0x4d')]][_0xe541('0x27')]=!![];this[_0xe541('0x1a')][_0x490410[_0xe541('0x4e')]]=this[_0xe541('0x1a')][_0x490410[_0xe541('0x4d')]];delete this[_0xe541('0x1a')][_0x490410[_0xe541('0x4d')]];}}else if(!_[_0xe541('0x4b')](this[_0xe541('0x1a')][_0x490410['transfertargetuniqueid']])){this[_0xe541('0x43')](_0x490410[_0xe541('0x4e')]);if(this['channels'][_0x490410[_0xe541('0x4f')]]){this['channels'][_0x490410[_0xe541('0x4f')]][_0xe541('0x27')]=!![];this[_0xe541('0x1a')][_0x490410[_0xe541('0x4c')]]=this[_0xe541('0x1a')][_0x490410['origtransfereruniqueid']];delete this[_0xe541('0x1a')][_0x490410['origtransfereruniqueid']];}}}catch(_0x33021f){logger[_0xe541('0x32')](_0xe541('0x50'),_0x33021f['message']);}};Acw[_0xe541('0x19')][_0xe541('0x13')]=function(_0x4d98ad){try{if(this[_0xe541('0x1a')][_0x4d98ad[_0xe541('0x51')]]){logger[_0xe541('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe541('0x3c')](_0x4d98ad[_0xe541('0x51')]));this[_0xe541('0x43')](_0x4d98ad[_0xe541('0x51')]);}else if(this['channels'][_0x4d98ad[_0xe541('0x52')]]){logger[_0xe541('0x25')](_0xe541('0x53'),JSON[_0xe541('0x3c')](_0x4d98ad[_0xe541('0x52')]));this[_0xe541('0x43')](_0x4d98ad[_0xe541('0x52')]);}}catch(_0x515e06){logger[_0xe541('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x515e06[_0xe541('0x35')]);}};Acw[_0xe541('0x19')]['syncAgentRingNoAnswer']=function(_0x2816a5){try{if(this[_0xe541('0x6')][_0x2816a5[_0xe541('0x1c')]]&&this['voiceQueues'][_0x2816a5[_0xe541('0x1c')]][_0xe541('0x54')]==='all'){if(this[_0xe541('0x7')][_0x2816a5[_0xe541('0x1b')]]){logger['info'](_0xe541('0x55'),_0x2816a5[_0xe541('0x37')],_0x2816a5['interface'],_0x2816a5[_0xe541('0x1c')]);return RpcUser['savePause'](this['agents'][_0x2816a5[_0xe541('0x1b')]],_0xe541('0x56'),_0x2816a5[_0xe541('0x37')]);}}}catch(_0x40eb2b){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x40eb2b[_0xe541('0x35')]);}};module[_0xe541('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 57fbd6a..f0b6031 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x5655ae,_0x4a7f95){var _0x91ac07=function(_0x3707ad){while(--_0x3707ad){_0x5655ae['push'](_0x5655ae['shift']());}};_0x91ac07(++_0x4a7f95);}(_0xb10b,0x12a));var _0xbb10=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0xb10b[_0x32a81f];return _0x5b67a2;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x5731d8,_0x5bc356){var _0x370700=function(_0x5e908c){while(--_0x5e908c){_0x5731d8['push'](_0x5731d8['shift']());}};_0x370700(++_0x5bc356);}(_0xb10b,0x12a));var _0xbb10=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0xb10b[_0xc08f00];return _0x8649f7;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0634857..50f716e 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 _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x1a4fd4,_0x5dc347){var _0x2c64ea=function(_0x37fcdd){while(--_0x37fcdd){_0x1a4fd4['push'](_0x1a4fd4['shift']());}};_0x2c64ea(++_0x5dc347);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x46156e,_0x1fb34d){var _0x2daa94=function(_0x2a426f){while(--_0x2a426f){_0x46156e['push'](_0x46156e['shift']());}};_0x2daa94(++_0x1fb34d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 698f802..3458656 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad20=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x5c3fac,_0x5f0267){var _0x382099=function(_0x3f2865){while(--_0x3f2865){_0x5c3fac['push'](_0x5c3fac['shift']());}};_0x382099(++_0x5f0267);}(_0xad20,0xa5));var _0x0ad2=function(_0x4a8eaf,_0x39ce59){_0x4a8eaf=_0x4a8eaf-0x0;var _0x5a658f=_0xad20[_0x4a8eaf];return _0x5a658f;};'use strict';var util=require(_0x0ad2('0x0'));var _=require(_0x0ad2('0x1'));var moment=require(_0x0ad2('0x2'));function checkNameSurname(_0x432492,_0x3b3b90,_0x5b318d){var _0x30523b='';if(!_[_0x0ad2('0x3')](_0x3b3b90)&&_0x0ad2('0x4')===typeof _0x3b3b90){_0x30523b+=_0x3b3b90;}if(!_[_0x0ad2('0x3')](_0x5b318d)&&_0x0ad2('0x4')===typeof _0x5b318d){_0x30523b+='\x20'+_0x5b318d;}if(_0x30523b!==''){return _0x30523b;}return _0x432492;}function Action(_0x450709,_0x180677,_0x53ec9f){this[_0x0ad2('0x5')]=_0x450709;this[_0x0ad2('0x6')]=_0x53ec9f||undefined;this[_0x0ad2('0x7')]=checkNameSurname(_0x180677[_0x0ad2('0x8')][_0x0ad2('0x9')],_0x180677[_0x0ad2('0x8')][_0x0ad2('0xa')],_0x180677[_0x0ad2('0x8')][_0x0ad2('0xb')]);this[_0x0ad2('0xc')]=_0x180677[_0x0ad2('0x8')][_0x0ad2('0x9')];this['queue']=_0x450709['name'];this[_0x0ad2('0xd')]=_0x180677[_0x0ad2('0xd')]||![];this['type']=_0x450709[_0x0ad2('0xe')];this[_0x0ad2('0xf')]=_0x450709['dialQueueTimeout']||0x3;this[_0x0ad2('0x10')]=_0x180677['scheduledat'];this[_0x0ad2('0x11')]=_0x180677[_0x0ad2('0x11')];this[_0x0ad2('0x12')]=_0x180677[_0x0ad2('0x12')];this['countnoanswerretry']=_0x180677[_0x0ad2('0x13')];this[_0x0ad2('0x14')]=_0x180677[_0x0ad2('0x14')];this[_0x0ad2('0x15')]=_0x180677['countdropretry'];this['countabandonedretry']=_0x180677[_0x0ad2('0x16')];this[_0x0ad2('0x17')]=_0x180677[_0x0ad2('0x17')];this[_0x0ad2('0x18')]=_0x180677[_0x0ad2('0x18')];this[_0x0ad2('0x19')]=_0x180677[_0x0ad2('0x19')];this[_0x0ad2('0x1a')]=_0x180677['ListId'];this[_0x0ad2('0x1b')]=_0x180677['UserId'];this[_0x0ad2('0x1c')]=_0x180677['VoiceQueueId'];this[_0x0ad2('0x1d')]=_0x180677[_0x0ad2('0x1d')];this[_0x0ad2('0x1e')]=_0x180677['id'];this[_0x0ad2('0x1f')]=_0x180677[_0x0ad2('0x8')][_0x0ad2('0xa')]||'';this[_0x0ad2('0x20')]=moment()['format'](_0x0ad2('0x21'));this[_0x0ad2('0x22')]=_0x180677[_0x0ad2('0x22')];this[_0x0ad2('0x23')]=_0x180677[_0x0ad2('0x23')];this[_0x0ad2('0x24')]=_0x180677[_0x0ad2('0x24')];this['recallme']=_0x180677[_0x0ad2('0x25')];this[_0x0ad2('0x26')]='';this[_0x0ad2('0x27')]='';}Action[_0x0ad2('0x28')][_0x0ad2('0x29')]=function(){return util[_0x0ad2('0x2a')](_0x0ad2('0x2b'),this[_0x0ad2('0x7')],this[_0x0ad2('0x5')][_0x0ad2('0x2c')]>0x0?this[_0x0ad2('0xc')][_0x0ad2('0x2d')](this[_0x0ad2('0x5')][_0x0ad2('0x2c')]):this[_0x0ad2('0xc')]);};Action[_0x0ad2('0x28')][_0x0ad2('0x2e')]=function(){return this[_0x0ad2('0x2f')];};module['exports']=Action; \ No newline at end of file +var _0x73d0=['callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x12911a,_0x257ddc){var _0x49190e=function(_0x523d40){while(--_0x523d40){_0x12911a['push'](_0x12911a['shift']());}};_0x49190e(++_0x257ddc);}(_0x73d0,0x1ef));var _0x073d=function(_0x5e9e7a,_0x489a17){_0x5e9e7a=_0x5e9e7a-0x0;var _0x1bd048=_0x73d0[_0x5e9e7a];return _0x1bd048;};'use strict';var util=require(_0x073d('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x116c86,_0x35e659,_0x29fab8){var _0x368975='';if(!_[_0x073d('0x1')](_0x35e659)&&_0x073d('0x2')===typeof _0x35e659){_0x368975+=_0x35e659;}if(!_[_0x073d('0x1')](_0x29fab8)&&'string'===typeof _0x29fab8){_0x368975+='\x20'+_0x29fab8;}if(_0x368975!==''){return _0x368975;}return _0x116c86;}function Action(_0x3f20bd,_0xa1af9e,_0x2562c1){this[_0x073d('0x3')]=_0x3f20bd;this[_0x073d('0x4')]=_0x2562c1||undefined;this[_0x073d('0x5')]=checkNameSurname(_0xa1af9e[_0x073d('0x6')][_0x073d('0x7')],_0xa1af9e[_0x073d('0x6')][_0x073d('0x8')],_0xa1af9e[_0x073d('0x6')][_0x073d('0x9')]);this[_0x073d('0xa')]=_0xa1af9e['Contact'][_0x073d('0x7')];this[_0x073d('0xb')]=_0x3f20bd[_0x073d('0x5')];this[_0x073d('0xc')]=_0xa1af9e[_0x073d('0xc')]||![];this[_0x073d('0xd')]=_0x3f20bd[_0x073d('0xd')];this[_0x073d('0xe')]=_0x3f20bd[_0x073d('0xe')]||0x3;this[_0x073d('0xf')]=_0xa1af9e[_0x073d('0xf')];this[_0x073d('0x10')]=_0xa1af9e[_0x073d('0x10')];this['countcongestionretry']=_0xa1af9e[_0x073d('0x11')];this['countnoanswerretry']=_0xa1af9e[_0x073d('0x12')];this[_0x073d('0x13')]=_0xa1af9e[_0x073d('0x13')];this[_0x073d('0x14')]=_0xa1af9e['countdropretry'];this[_0x073d('0x15')]=_0xa1af9e[_0x073d('0x15')];this[_0x073d('0x16')]=_0xa1af9e[_0x073d('0x16')];this[_0x073d('0x17')]=_0xa1af9e[_0x073d('0x17')];this['ContactId']=_0xa1af9e[_0x073d('0x18')];this['ListId']=_0xa1af9e[_0x073d('0x19')];this[_0x073d('0x1a')]=_0xa1af9e[_0x073d('0x1a')];this[_0x073d('0x1b')]=_0xa1af9e[_0x073d('0x1b')];this[_0x073d('0x1c')]=_0xa1af9e[_0x073d('0x1c')];this[_0x073d('0x1d')]=_0xa1af9e['id'];this[_0x073d('0x1e')]=_0xa1af9e[_0x073d('0x6')][_0x073d('0x8')]||'';this[_0x073d('0x1f')]=moment()['format'](_0x073d('0x20'));this[_0x073d('0x21')]=_0xa1af9e['callback'];this['callbackuniqueid']=_0xa1af9e['callbackuniqueid'];this[_0x073d('0x22')]=_0xa1af9e[_0x073d('0x22')];this[_0x073d('0x23')]=_0xa1af9e[_0x073d('0x23')];this[_0x073d('0x24')]='';this[_0x073d('0x25')]='';}Action[_0x073d('0x26')][_0x073d('0x27')]=function(){return util['format'](_0x073d('0x28'),this[_0x073d('0x5')],this[_0x073d('0x3')][_0x073d('0x29')]>0x0?this[_0x073d('0xa')][_0x073d('0x2a')](this[_0x073d('0x3')][_0x073d('0x29')]):this[_0x073d('0xa')]);};Action[_0x073d('0x26')][_0x073d('0x2b')]=function(){return this[_0x073d('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 3a76299..edf0b6a 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a61=['statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','milliseconds','diff','seconds'];(function(_0x37d225,_0x2ed664){var _0x26834b=function(_0x32260c){while(--_0x32260c){_0x37d225['push'](_0x37d225['shift']());}};_0x26834b(++_0x2ed664);}(_0x8a61,0x15c));var _0x18a6=function(_0x32e0de,_0x48784f){_0x32e0de=_0x32e0de-0x0;var _0xd0fc11=_0x8a61[_0x32e0de];return _0xd0fc11;};'use strict';var util=require(_0x18a6('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x42162b,_0xb58524){var _0x442cd9=moment(_0x42162b)['milliseconds'](0x0);var _0x15475e=moment(_0xb58524)[_0x18a6('0x1')](0x0);return _0x442cd9[_0x18a6('0x2')](_0x15475e,_0x18a6('0x3'));}function AgentComplete(_0x2e0d66,_0x38248d){this['state']=0x4;this[_0x18a6('0x4')]=_0x18a6('0x5');this[_0x18a6('0x6')]=_0x2e0d66['scheduledat'];this[_0x18a6('0x7')]=_0x2e0d66['type'];this[_0x18a6('0x8')]=_0x2e0d66['type']===_0x18a6('0x9')?_0x18a6('0xa'):_0x2e0d66[_0x18a6('0x7')];this['countbusyretry']=_0x2e0d66['countbusyretry'];this[_0x18a6('0xb')]=_0x2e0d66['countcongestionretry'];this[_0x18a6('0xc')]=_0x2e0d66[_0x18a6('0xc')];this[_0x18a6('0xd')]=_0x2e0d66[_0x18a6('0xe')]+_0x2e0d66['countcongestionretry']+_0x2e0d66[_0x18a6('0xc')]+_0x2e0d66[_0x18a6('0xf')]+_0x2e0d66[_0x18a6('0x10')]+_0x2e0d66['countabandonedretry']+_0x2e0d66[_0x18a6('0x11')]+_0x2e0d66[_0x18a6('0x12')];this[_0x18a6('0xf')]=_0x2e0d66[_0x18a6('0xf')];this[_0x18a6('0x10')]=_0x2e0d66[_0x18a6('0x10')];this['countabandonedretry']=_0x2e0d66[_0x18a6('0x13')];this[_0x18a6('0x11')]=_0x2e0d66[_0x18a6('0x11')];this[_0x18a6('0x12')]=_0x2e0d66['countagentrejectretry'];this[_0x18a6('0x14')]=_0x38248d['uniqueid'];this[_0x18a6('0x15')]=_0x2e0d66[_0x18a6('0x16')];this[_0x18a6('0x17')]=_0x2e0d66[_0x18a6('0x18')];this[_0x18a6('0x19')]=_0x2e0d66[_0x18a6('0x19')];this[_0x18a6('0x1a')]=_0x2e0d66[_0x18a6('0x1a')];this[_0x18a6('0x1b')]=_0x2e0d66[_0x18a6('0x1b')];this[_0x18a6('0x1c')]=moment()[_0x18a6('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x18a6('0x1e')]=getSeconds(_0x2e0d66[_0x18a6('0x1a')],_0x2e0d66[_0x18a6('0x19')]);this[_0x18a6('0x1f')]=getSeconds(_0x2e0d66[_0x18a6('0x1b')],_0x2e0d66[_0x18a6('0x1a')]);this[_0x18a6('0x20')]=getSeconds(this[_0x18a6('0x1c')],_0x2e0d66[_0x18a6('0x1b')]);this[_0x18a6('0xa')]=_0x38248d[_0x18a6('0xa')];this[_0x18a6('0x21')]=_0x38248d['membername'];this[_0x18a6('0x22')]=_0x38248d[_0x18a6('0x22')];this[_0x18a6('0x23')]=_0x2e0d66['callback'];this['callbackuniqueid']=_0x2e0d66['callbackuniqueid'];this[_0x18a6('0x24')]=_0x2e0d66['callbackat'];this[_0x18a6('0x25')]=_0x2e0d66['recallme'];this[_0x18a6('0x26')]=_0x2e0d66['ContactId'];this[_0x18a6('0x27')]=_0x2e0d66[_0x18a6('0x27')];this[_0x18a6('0x28')]=_0x2e0d66[_0x18a6('0x28')];this[_0x18a6('0x29')]=_0x2e0d66[_0x18a6('0x29')];this[_0x18a6('0x2a')]=_0x2e0d66[_0x18a6('0x2a')];this['originatecalleridnum']=_0x2e0d66['originatecalleridnum']||'';this[_0x18a6('0x2b')]=_0x2e0d66[_0x18a6('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x2ae8=['milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2ae8,0x1c9));var _0x82ae=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2ae8[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x82ae('0x0'));var _=require(_0x82ae('0x1'));var moment=require(_0x82ae('0x2'));function getSeconds(_0x22a15d,_0x366b5e){var _0x1b1a76=moment(_0x22a15d)['milliseconds'](0x0);var _0x40bf=moment(_0x366b5e)[_0x82ae('0x3')](0x0);return _0x1b1a76['diff'](_0x40bf,_0x82ae('0x4'));}function AgentComplete(_0x4423e8,_0x11da19){this[_0x82ae('0x5')]=0x4;this[_0x82ae('0x6')]=_0x82ae('0x7');this[_0x82ae('0x8')]=_0x4423e8['scheduledat'];this[_0x82ae('0x9')]=_0x4423e8[_0x82ae('0x9')];this[_0x82ae('0xa')]=_0x4423e8['type']===_0x82ae('0xb')?_0x82ae('0xc'):_0x4423e8[_0x82ae('0x9')];this[_0x82ae('0xd')]=_0x4423e8['countbusyretry'];this[_0x82ae('0xe')]=_0x4423e8[_0x82ae('0xe')];this['countnoanswerretry']=_0x4423e8[_0x82ae('0xf')];this[_0x82ae('0x10')]=_0x4423e8['countbusyretry']+_0x4423e8['countcongestionretry']+_0x4423e8[_0x82ae('0xf')]+_0x4423e8[_0x82ae('0x11')]+_0x4423e8[_0x82ae('0x12')]+_0x4423e8[_0x82ae('0x13')]+_0x4423e8[_0x82ae('0x14')]+_0x4423e8['countagentrejectretry'];this[_0x82ae('0x11')]=_0x4423e8['countnosuchnumberretry'];this[_0x82ae('0x12')]=_0x4423e8[_0x82ae('0x12')];this[_0x82ae('0x13')]=_0x4423e8[_0x82ae('0x13')];this[_0x82ae('0x14')]=_0x4423e8['countmachineretry'];this['countagentrejectretry']=_0x4423e8[_0x82ae('0x15')];this['uniqueid']=_0x11da19[_0x82ae('0x16')];this[_0x82ae('0x17')]=_0x4423e8[_0x82ae('0x18')];this['calleridnum']=_0x4423e8[_0x82ae('0x19')];this[_0x82ae('0x1a')]=_0x4423e8['starttime'];this[_0x82ae('0x1b')]=_0x4423e8[_0x82ae('0x1b')];this[_0x82ae('0x1c')]=_0x4423e8[_0x82ae('0x1c')];this[_0x82ae('0x1d')]=moment()[_0x82ae('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x82ae('0x1f')]=getSeconds(_0x4423e8[_0x82ae('0x1b')],_0x4423e8[_0x82ae('0x1a')]);this[_0x82ae('0x20')]=getSeconds(_0x4423e8[_0x82ae('0x1c')],_0x4423e8['responsetime']);this[_0x82ae('0x21')]=getSeconds(this[_0x82ae('0x1d')],_0x4423e8['answertime']);this[_0x82ae('0xc')]=_0x11da19[_0x82ae('0xc')];this['membername']=_0x11da19['membername'];this[_0x82ae('0x22')]=_0x11da19[_0x82ae('0x22')];this[_0x82ae('0x23')]=_0x4423e8[_0x82ae('0x23')];this['callbackuniqueid']=_0x4423e8[_0x82ae('0x24')];this['callbackat']=_0x4423e8[_0x82ae('0x25')];this[_0x82ae('0x26')]=_0x4423e8[_0x82ae('0x26')];this[_0x82ae('0x27')]=_0x4423e8[_0x82ae('0x27')];this[_0x82ae('0x28')]=_0x4423e8[_0x82ae('0x28')];this[_0x82ae('0x29')]=_0x4423e8[_0x82ae('0x29')];this['VoiceQueueId']=_0x4423e8[_0x82ae('0x2a')];this[_0x82ae('0x2b')]=_0x4423e8['CampaignId'];this[_0x82ae('0x2c')]=_0x4423e8['originatecalleridnum']||'';this[_0x82ae('0x2d')]=_0x4423e8[_0x82ae('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6786f39..aa0ff30 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac9d=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype'];(function(_0x44dbc3,_0x145c5b){var _0x33ec1f=function(_0x409aa5){while(--_0x409aa5){_0x44dbc3['push'](_0x44dbc3['shift']());}};_0x33ec1f(++_0x145c5b);}(_0xac9d,0x14d));var _0xdac9=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xac9d[_0x4c6d6f];return _0x2d4478;};'use strict';var util=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));function getSeconds(_0x1e6d33,_0x12390c){var _0x27eb7c=moment(_0x1e6d33)[_0xdac9('0x3')](0x0);var _0x1b967e=moment(_0x12390c)['milliseconds'](0x0);return _0x27eb7c[_0xdac9('0x4')](_0x1b967e,'seconds');}function Final(_0x3d56ae){this[_0xdac9('0x5')]=_0x3d56ae[_0xdac9('0x5')];this[_0xdac9('0x6')]=_0x3d56ae[_0xdac9('0x6')];this[_0xdac9('0x7')]=_0x3d56ae['type'];this[_0xdac9('0x8')]=_0x3d56ae['type']===_0xdac9('0x9')?_0xdac9('0xa'):_0x3d56ae[_0xdac9('0x7')];this[_0xdac9('0xb')]=_0x3d56ae[_0xdac9('0xb')];this[_0xdac9('0xc')]=_0x3d56ae[_0xdac9('0xc')];this[_0xdac9('0xd')]=_0x3d56ae[_0xdac9('0xd')];this['countglobal']=_0x3d56ae[_0xdac9('0xb')]+_0x3d56ae[_0xdac9('0xc')]+_0x3d56ae['countnoanswerretry']+_0x3d56ae[_0xdac9('0xe')]+_0x3d56ae[_0xdac9('0xf')]+_0x3d56ae[_0xdac9('0x10')]+_0x3d56ae['countmachineretry']+_0x3d56ae[_0xdac9('0x11')];this[_0xdac9('0xe')]=_0x3d56ae[_0xdac9('0xe')];this['countdropretry']=_0x3d56ae['countdropretry'];this[_0xdac9('0x10')]=_0x3d56ae[_0xdac9('0x10')];this['countmachineretry']=_0x3d56ae[_0xdac9('0x12')];this[_0xdac9('0x11')]=_0x3d56ae[_0xdac9('0x11')];this[_0xdac9('0xa')]=_0x3d56ae[_0xdac9('0xa')];this[_0xdac9('0x13')]=_0x3d56ae[_0xdac9('0x13')];this[_0xdac9('0x14')]=_0x3d56ae['calleridnum'];this[_0xdac9('0x15')]=_0x3d56ae[_0xdac9('0x15')];this['responsetime']=_0x3d56ae[_0xdac9('0x16')];this[_0xdac9('0x17')]=_0x3d56ae[_0xdac9('0x16')];this[_0xdac9('0x18')]=_0x3d56ae['ringtime']||0x0;this['holdtime']=_0x3d56ae[_0xdac9('0x19')]||0x0;this[_0xdac9('0x1a')]=_0x3d56ae[_0xdac9('0x1a')]||0x0;this[_0xdac9('0x1b')]=_0x3d56ae['callback'];this[_0xdac9('0x1c')]=_0x3d56ae[_0xdac9('0x1c')];this[_0xdac9('0x1d')]=_0x3d56ae[_0xdac9('0x1d')];this[_0xdac9('0x1e')]=_0x3d56ae[_0xdac9('0x1e')];this[_0xdac9('0x1f')]=_0x3d56ae[_0xdac9('0x1f')];this[_0xdac9('0x20')]=_0x3d56ae[_0xdac9('0x20')];this['UserId']=_0x3d56ae[_0xdac9('0x21')];this[_0xdac9('0x22')]=_0x3d56ae[_0xdac9('0x22')];this[_0xdac9('0x23')]=_0x3d56ae['CampaignId'];this[_0xdac9('0x24')]=_0x3d56ae['originatecalleridnum']||'';this[_0xdac9('0x25')]=_0x3d56ae[_0xdac9('0x25')]||'';}module['exports']=Final; \ No newline at end of file +var _0x56e6=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x56e6,0x6b));var _0x656e=function(_0x44364,_0x350475){_0x44364=_0x44364-0x0;var _0x40b63b=_0x56e6[_0x44364];return _0x40b63b;};'use strict';var util=require(_0x656e('0x0'));var _=require(_0x656e('0x1'));var moment=require(_0x656e('0x2'));function getSeconds(_0x75e34c,_0x3a7a6a){var _0x3833eb=moment(_0x75e34c)['milliseconds'](0x0);var _0x40a874=moment(_0x3a7a6a)[_0x656e('0x3')](0x0);return _0x3833eb[_0x656e('0x4')](_0x40a874,_0x656e('0x5'));}function Final(_0x123fd4){this[_0x656e('0x6')]=_0x123fd4[_0x656e('0x6')];this['scheduledat']=_0x123fd4[_0x656e('0x7')];this[_0x656e('0x8')]=_0x123fd4[_0x656e('0x8')];this[_0x656e('0x9')]=_0x123fd4[_0x656e('0x8')]===_0x656e('0xa')?_0x656e('0xb'):_0x123fd4[_0x656e('0x8')];this[_0x656e('0xc')]=_0x123fd4[_0x656e('0xc')];this[_0x656e('0xd')]=_0x123fd4[_0x656e('0xd')];this[_0x656e('0xe')]=_0x123fd4[_0x656e('0xe')];this['countglobal']=_0x123fd4['countbusyretry']+_0x123fd4[_0x656e('0xd')]+_0x123fd4[_0x656e('0xe')]+_0x123fd4[_0x656e('0xf')]+_0x123fd4[_0x656e('0x10')]+_0x123fd4['countabandonedretry']+_0x123fd4['countmachineretry']+_0x123fd4[_0x656e('0x11')];this[_0x656e('0xf')]=_0x123fd4['countnosuchnumberretry'];this[_0x656e('0x10')]=_0x123fd4['countdropretry'];this[_0x656e('0x12')]=_0x123fd4[_0x656e('0x12')];this[_0x656e('0x13')]=_0x123fd4[_0x656e('0x13')];this['countagentrejectretry']=_0x123fd4[_0x656e('0x11')];this[_0x656e('0xb')]=_0x123fd4[_0x656e('0xb')];this[_0x656e('0x14')]=_0x123fd4[_0x656e('0x14')];this['calleridnum']=_0x123fd4['calleridnum'];this['starttime']=_0x123fd4[_0x656e('0x15')];this[_0x656e('0x16')]=_0x123fd4['responsetime'];this[_0x656e('0x17')]=_0x123fd4['responsetime'];this['ringtime']=_0x123fd4['ringtime']||0x0;this[_0x656e('0x18')]=_0x123fd4[_0x656e('0x18')]||0x0;this[_0x656e('0x19')]=_0x123fd4[_0x656e('0x19')]||0x0;this['callback']=_0x123fd4[_0x656e('0x1a')];this[_0x656e('0x1b')]=_0x123fd4[_0x656e('0x1b')];this['callbackat']=_0x123fd4[_0x656e('0x1c')];this[_0x656e('0x1d')]=_0x123fd4[_0x656e('0x1d')];this[_0x656e('0x1e')]=_0x123fd4[_0x656e('0x1e')];this[_0x656e('0x1f')]=_0x123fd4[_0x656e('0x1f')];this['UserId']=_0x123fd4[_0x656e('0x20')];this[_0x656e('0x21')]=_0x123fd4['VoiceQueueId'];this['CampaignId']=_0x123fd4[_0x656e('0x22')];this['originatecalleridnum']=_0x123fd4[_0x656e('0x23')]||'';this['originatecalleridname']=_0x123fd4['originatecalleridname']||'';}module[_0x656e('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4a5d655..6f459eb 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48c9=['ListId','UserId','VoiceQueueId','util','milliseconds','diff','seconds','state','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48c9,0x78));var _0x948c=function(_0x10960d,_0x15b7e7){_0x10960d=_0x10960d-0x0;var _0x17b627=_0x48c9[_0x10960d];return _0x17b627;};'use strict';var util=require(_0x948c('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x37e32f,_0x180160){var _0x24d58a=moment(_0x37e32f)[_0x948c('0x1')](0x0);var _0x5ccae7=moment(_0x180160)['milliseconds'](0x0);return _0x24d58a[_0x948c('0x2')](_0x5ccae7,_0x948c('0x3'));}function Hangup(_0x18844e,_0x22e98f){this[_0x948c('0x4')]=0x4;this['statedesc']=_0x948c('0x5');this['scheduledat']=_0x18844e['scheduledat'];this[_0x948c('0x6')]=_0x18844e[_0x948c('0x6')];this[_0x948c('0x7')]=_0x18844e[_0x948c('0x6')]===_0x948c('0x8')?_0x948c('0x9'):_0x18844e['type'];this[_0x948c('0xa')]=_0x18844e[_0x948c('0xa')];this[_0x948c('0xb')]=_0x18844e[_0x948c('0xb')];this[_0x948c('0xc')]=_0x18844e[_0x948c('0xc')];this[_0x948c('0xd')]=_0x18844e[_0x948c('0xa')]+_0x18844e[_0x948c('0xb')]+_0x18844e[_0x948c('0xc')]+_0x18844e['countnosuchnumberretry']+_0x18844e[_0x948c('0xe')]+_0x18844e['countabandonedretry']+_0x18844e[_0x948c('0xf')]+_0x18844e[_0x948c('0x10')];this['countnosuchnumberretry']=_0x18844e[_0x948c('0x11')];this[_0x948c('0xe')]=_0x18844e[_0x948c('0xe')];this['countabandonedretry']=_0x18844e[_0x948c('0x12')];this[_0x948c('0xf')]=_0x18844e['countmachineretry'];this[_0x948c('0x10')]=_0x18844e[_0x948c('0x10')];this[_0x948c('0x13')]=_0x22e98f['uniqueid'];this[_0x948c('0x14')]=_0x18844e[_0x948c('0x15')];this[_0x948c('0x16')]=_0x18844e['number'];this[_0x948c('0x17')]=_0x18844e[_0x948c('0x17')];this[_0x948c('0x18')]=_0x18844e[_0x948c('0x18')];this[_0x948c('0x19')]=moment()['format'](_0x948c('0x1a'));this[_0x948c('0x1b')]=getSeconds(_0x18844e[_0x948c('0x18')],_0x18844e[_0x948c('0x17')]);this[_0x948c('0x1c')]=0x0;this[_0x948c('0x1d')]=getSeconds(this['endtime'],_0x18844e[_0x948c('0x18')]);this['queue']=_0x18844e[_0x948c('0x9')];this['membername']='IVR';this['reason']=_0x22e98f[_0x948c('0x1e')];this['callback']=_0x18844e[_0x948c('0x1f')];this[_0x948c('0x20')]=_0x18844e[_0x948c('0x20')];this[_0x948c('0x21')]=_0x18844e[_0x948c('0x21')];this[_0x948c('0x22')]=_0x18844e[_0x948c('0x22')];this[_0x948c('0x23')]=_0x18844e[_0x948c('0x23')];this[_0x948c('0x24')]=_0x18844e['ListId'];this[_0x948c('0x25')]=_0x18844e[_0x948c('0x25')];this[_0x948c('0x26')]=_0x18844e[_0x948c('0x26')];this['CampaignId']=_0x18844e['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x0e31=['util','moment','seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','format','ringtime','holdtime','talktime','endtime','responsetime','queue','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x0e31,0xc8));var _0x10e3=function(_0x5ec420,_0x2e0af1){_0x5ec420=_0x5ec420-0x0;var _0x4768f2=_0x0e31[_0x5ec420];return _0x4768f2;};'use strict';var util=require(_0x10e3('0x0'));var _=require('lodash');var moment=require(_0x10e3('0x1'));function getSeconds(_0x14f912,_0x3cf1ec){var _0x3e5146=moment(_0x14f912)['milliseconds'](0x0);var _0x11770c=moment(_0x3cf1ec)['milliseconds'](0x0);return _0x3e5146['diff'](_0x11770c,_0x10e3('0x2'));}function Hangup(_0x531e97,_0x5a4372){this[_0x10e3('0x3')]=0x4;this['statedesc']=_0x10e3('0x4');this[_0x10e3('0x5')]=_0x531e97[_0x10e3('0x5')];this['type']=_0x531e97[_0x10e3('0x6')];this[_0x10e3('0x7')]=_0x531e97[_0x10e3('0x6')]===_0x10e3('0x8')?'queue':_0x531e97[_0x10e3('0x6')];this[_0x10e3('0x9')]=_0x531e97[_0x10e3('0x9')];this[_0x10e3('0xa')]=_0x531e97[_0x10e3('0xa')];this[_0x10e3('0xb')]=_0x531e97[_0x10e3('0xb')];this[_0x10e3('0xc')]=_0x531e97[_0x10e3('0x9')]+_0x531e97[_0x10e3('0xa')]+_0x531e97['countnoanswerretry']+_0x531e97[_0x10e3('0xd')]+_0x531e97[_0x10e3('0xe')]+_0x531e97[_0x10e3('0xf')]+_0x531e97[_0x10e3('0x10')]+_0x531e97[_0x10e3('0x11')];this[_0x10e3('0xd')]=_0x531e97[_0x10e3('0xd')];this['countdropretry']=_0x531e97['countdropretry'];this[_0x10e3('0xf')]=_0x531e97[_0x10e3('0xf')];this[_0x10e3('0x10')]=_0x531e97['countmachineretry'];this[_0x10e3('0x11')]=_0x531e97[_0x10e3('0x11')];this['uniqueid']=_0x5a4372[_0x10e3('0x12')];this[_0x10e3('0x13')]=_0x531e97[_0x10e3('0x14')];this['calleridnum']=_0x531e97[_0x10e3('0x15')];this[_0x10e3('0x16')]=_0x531e97['starttime'];this['responsetime']=_0x531e97['responsetime'];this['endtime']=moment()[_0x10e3('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x10e3('0x18')]=getSeconds(_0x531e97['responsetime'],_0x531e97[_0x10e3('0x16')]);this[_0x10e3('0x19')]=0x0;this[_0x10e3('0x1a')]=getSeconds(this[_0x10e3('0x1b')],_0x531e97[_0x10e3('0x1c')]);this[_0x10e3('0x1d')]=_0x531e97[_0x10e3('0x1d')];this['membername']='IVR';this[_0x10e3('0x1e')]=_0x5a4372[_0x10e3('0x1f')];this['callback']=_0x531e97['callback'];this[_0x10e3('0x20')]=_0x531e97[_0x10e3('0x20')];this['callbackat']=_0x531e97[_0x10e3('0x21')];this[_0x10e3('0x22')]=_0x531e97[_0x10e3('0x22')];this[_0x10e3('0x23')]=_0x531e97[_0x10e3('0x23')];this[_0x10e3('0x24')]=_0x531e97[_0x10e3('0x24')];this['UserId']=_0x531e97[_0x10e3('0x25')];this['VoiceQueueId']=_0x531e97['VoiceQueueId'];this[_0x10e3('0x26')]=_0x531e97[_0x10e3('0x26')];}module[_0x10e3('0x27')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index fc0d2d5..55682ac 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b53=['uniqueid','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x30f04d,_0x5634f3){var _0x3bca0c=function(_0x30c73f){while(--_0x30c73f){_0x30f04d['push'](_0x30f04d['shift']());}};_0x3bca0c(++_0x5634f3);}(_0x1b53,0x16d));var _0x31b5=function(_0x5311bd,_0x139753){_0x5311bd=_0x5311bd-0x0;var _0x47aee8=_0x1b53[_0x5311bd];return _0x47aee8;};'use strict';var util=require(_0x31b5('0x0'));var _=require(_0x31b5('0x1'));var moment=require(_0x31b5('0x2'));function getSeconds(_0xcc310e,_0xd36158){var _0x26e997=moment(_0xcc310e)[_0x31b5('0x3')](0x0);var _0x2f336c=moment(_0xd36158)[_0x31b5('0x3')](0x0);return _0x26e997[_0x31b5('0x4')](_0x2f336c,'seconds');}function History(_0x2bf2e4){this[_0x31b5('0x5')]=_0x2bf2e4[_0x31b5('0x5')];this['scheduledat']=_0x2bf2e4['scheduledat']||undefined;this['type']=_0x2bf2e4['type'];this[_0x31b5('0x6')]=_0x2bf2e4[_0x31b5('0x7')]===_0x31b5('0x8')?'queue':_0x2bf2e4['type'];this[_0x31b5('0x9')]=_0x2bf2e4['countbusyretry'];this[_0x31b5('0xa')]=_0x2bf2e4[_0x31b5('0xa')];this[_0x31b5('0xb')]=_0x2bf2e4[_0x31b5('0xb')];this[_0x31b5('0xc')]=_0x2bf2e4[_0x31b5('0x9')]+_0x2bf2e4['countcongestionretry']+_0x2bf2e4[_0x31b5('0xb')]+_0x2bf2e4[_0x31b5('0xd')]+_0x2bf2e4[_0x31b5('0xe')]+_0x2bf2e4['countabandonedretry']+_0x2bf2e4[_0x31b5('0xf')]+_0x2bf2e4[_0x31b5('0x10')];this[_0x31b5('0xd')]=_0x2bf2e4[_0x31b5('0xd')];this['countdropretry']=_0x2bf2e4[_0x31b5('0xe')];this[_0x31b5('0x11')]=_0x2bf2e4[_0x31b5('0x11')];this[_0x31b5('0xf')]=_0x2bf2e4['countmachineretry'];this[_0x31b5('0x10')]=_0x2bf2e4[_0x31b5('0x10')];this['queue']=_0x2bf2e4['queue'];this[_0x31b5('0x12')]=_0x2bf2e4['name'];this[_0x31b5('0x13')]=_0x2bf2e4[_0x31b5('0x14')];this[_0x31b5('0x15')]=_0x2bf2e4['starttime'];this[_0x31b5('0x16')]=_0x2bf2e4[_0x31b5('0x16')];this[_0x31b5('0x17')]=_0x2bf2e4[_0x31b5('0x16')];this[_0x31b5('0x18')]=getSeconds(_0x2bf2e4[_0x31b5('0x16')],_0x2bf2e4[_0x31b5('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x2bf2e4[_0x31b5('0x19')];this[_0x31b5('0x1a')]=_0x2bf2e4[_0x31b5('0x1a')];this[_0x31b5('0x1b')]=_0x2bf2e4[_0x31b5('0x1b')];this['recallme']=_0x2bf2e4[_0x31b5('0x1c')];this[_0x31b5('0x1d')]=_0x2bf2e4[_0x31b5('0x1d')];this['ListId']=_0x2bf2e4[_0x31b5('0x1e')];this[_0x31b5('0x1f')]=_0x2bf2e4['UserId'];this[_0x31b5('0x20')]=_0x2bf2e4[_0x31b5('0x20')];this[_0x31b5('0x21')]=_0x2bf2e4[_0x31b5('0x21')];this[_0x31b5('0x22')]=_0x2bf2e4['originatecalleridnum']||'';this[_0x31b5('0x23')]=_0x2bf2e4['originatecalleridname']||'';}module[_0x31b5('0x24')]=History; \ No newline at end of file +var _0x7f2c=['number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name'];(function(_0x352d23,_0x49ebd5){var _0x882e73=function(_0xf28334){while(--_0xf28334){_0x352d23['push'](_0x352d23['shift']());}};_0x882e73(++_0x49ebd5);}(_0x7f2c,0x15f));var _0xc7f2=function(_0x157712,_0xc29e01){_0x157712=_0x157712-0x0;var _0x23e9d9=_0x7f2c[_0x157712];return _0x23e9d9;};'use strict';var util=require(_0xc7f2('0x0'));var _=require(_0xc7f2('0x1'));var moment=require(_0xc7f2('0x2'));function getSeconds(_0x599e1b,_0x3b8006){var _0x4c1ce1=moment(_0x599e1b)['milliseconds'](0x0);var _0x3b8e92=moment(_0x3b8006)['milliseconds'](0x0);return _0x4c1ce1[_0xc7f2('0x3')](_0x3b8e92,'seconds');}function History(_0x546f3a){this[_0xc7f2('0x4')]=_0x546f3a['uniqueid'];this[_0xc7f2('0x5')]=_0x546f3a['scheduledat']||undefined;this[_0xc7f2('0x6')]=_0x546f3a[_0xc7f2('0x6')];this['campaigntype']=_0x546f3a[_0xc7f2('0x6')]===_0xc7f2('0x7')?_0xc7f2('0x8'):_0x546f3a[_0xc7f2('0x6')];this[_0xc7f2('0x9')]=_0x546f3a[_0xc7f2('0x9')];this[_0xc7f2('0xa')]=_0x546f3a[_0xc7f2('0xa')];this[_0xc7f2('0xb')]=_0x546f3a[_0xc7f2('0xb')];this[_0xc7f2('0xc')]=_0x546f3a[_0xc7f2('0x9')]+_0x546f3a['countcongestionretry']+_0x546f3a['countnoanswerretry']+_0x546f3a['countnosuchnumberretry']+_0x546f3a['countdropretry']+_0x546f3a['countabandonedretry']+_0x546f3a[_0xc7f2('0xd')]+_0x546f3a[_0xc7f2('0xe')];this[_0xc7f2('0xf')]=_0x546f3a[_0xc7f2('0xf')];this[_0xc7f2('0x10')]=_0x546f3a[_0xc7f2('0x10')];this['countabandonedretry']=_0x546f3a['countabandonedretry'];this[_0xc7f2('0xd')]=_0x546f3a[_0xc7f2('0xd')];this[_0xc7f2('0xe')]=_0x546f3a['countagentrejectretry'];this[_0xc7f2('0x8')]=_0x546f3a[_0xc7f2('0x8')];this[_0xc7f2('0x11')]=_0x546f3a[_0xc7f2('0x12')];this['calleridnum']=_0x546f3a[_0xc7f2('0x13')];this[_0xc7f2('0x14')]=_0x546f3a['starttime'];this[_0xc7f2('0x15')]=_0x546f3a['responsetime'];this[_0xc7f2('0x16')]=_0x546f3a[_0xc7f2('0x15')];this[_0xc7f2('0x17')]=getSeconds(_0x546f3a[_0xc7f2('0x15')],_0x546f3a['starttime']);this['holdtime']=0x0;this[_0xc7f2('0x18')]=0x0;this['callback']=_0x546f3a[_0xc7f2('0x19')];this[_0xc7f2('0x1a')]=_0x546f3a[_0xc7f2('0x1a')];this[_0xc7f2('0x1b')]=_0x546f3a[_0xc7f2('0x1b')];this[_0xc7f2('0x1c')]=_0x546f3a[_0xc7f2('0x1c')];this[_0xc7f2('0x1d')]=_0x546f3a['ContactId'];this[_0xc7f2('0x1e')]=_0x546f3a[_0xc7f2('0x1e')];this['UserId']=_0x546f3a[_0xc7f2('0x1f')];this['VoiceQueueId']=_0x546f3a[_0xc7f2('0x20')];this[_0xc7f2('0x21')]=_0x546f3a['CampaignId'];this['originatecalleridnum']=_0x546f3a[_0xc7f2('0x22')]||'';this[_0xc7f2('0x23')]=_0x546f3a[_0xc7f2('0x23')]||'';}module[_0xc7f2('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 739bc5a..88ef0ca 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 _0xe09a=['Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','preview','string','\x22%s\x22\x20<%s>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','UserId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','AMD','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countbusyretry','countabandonedretry','ContactId','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','countglobal','dialDropMaxRetry','dialDropRetryFrequency','minutes','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','timezones','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','Contact','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','getCaller','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','getVoiceQueueRtPauses','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','RUNNING','[getContactDialer2]','tryOriginatePredictive','[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','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalAnsweredCalls','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty'];(function(_0x5152ab,_0x353d22){var _0xab7692=function(_0x4dc456){while(--_0x4dc456){_0x5152ab['push'](_0x5152ab['shift']());}};_0xab7692(++_0x353d22);}(_0xe09a,0x197));var _0xae09=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xe09a[_0x4d2f00];return _0x2d7b7f;};'use strict';var util=require(_0xae09('0x0'));var _=require(_0xae09('0x1'));var BPromise=require('bluebird');var uuid=require(_0xae09('0x2'));var moment=require(_0xae09('0x3'));var rr=require('rr');var md5=require(_0xae09('0x4'));var Redis=require(_0xae09('0x5'));var ut=require(_0xae09('0x6'));var config=require(_0xae09('0x7'));var logger=require(_0xae09('0x8'))(_0xae09('0x9'));var loggerBooked=require(_0xae09('0x8'))(_0xae09('0xa'));var loggerPredictive=require(_0xae09('0x8'))(_0xae09('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0xae09('0xc'));var loggerSyncQueueSummary=require(_0xae09('0x8'))(_0xae09('0xd'));var ami=require(_0xae09('0xe'));config['redis']=_['defaults'](config[_0xae09('0xf')],{'host':_0xae09('0x10'),'port':0x18eb});var io=require(_0xae09('0x11'))(new Redis(config[_0xae09('0xf')]));var cmHopper=require(_0xae09('0x12'));var cmHopperHistory=require(_0xae09('0x13'));var cmHopperBlack=require(_0xae09('0x14'));var voiceQueueRt=require(_0xae09('0x15'));var RpcSetting=require(_0xae09('0x16'));var Action=require(_0xae09('0x17'));var History=require('./history');var Final=require(_0xae09('0x18'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xae09('0x19'));var Hangup=require(_0xae09('0x1a'));var ipAgi=process[_0xae09('0x1b')][_0xae09('0x1c')]||_0xae09('0x1d');var strategy={'rrmemory':_0xae09('0x1e'),'roundrobin':_0xae09('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xae09('0x20')]['enqueue']=function(_0x346834){this['tail']=this[_0xae09('0x21')]?this[_0xae09('0x21')][_0xae09('0x22')](_0x346834):_0x346834();};function Dialer(_0x1094e2,_0x57c6e7){this[_0xae09('0x23')]=new Sequence();this['preview']=_0x57c6e7;this[_0xae09('0x24')]=_0x1094e2[_0xae09('0x24')];this['campaigns']=_0x1094e2[_0xae09('0x25')];this[_0xae09('0x26')]=_0x1094e2[_0xae09('0x26')];this[_0xae09('0x27')]=_0x1094e2[_0xae09('0x27')];this[_0xae09('0x28')]=config['maxNumberOriginate']||0x2;this[_0xae09('0x29')]={};this[_0xae09('0x2a')]={};this['contactsId']={};this[_0xae09('0x2b')]={};this[_0xae09('0x2c')]={};this['startPredictive']={};this['startProgressive']={};this[_0xae09('0x2d')]={};this[_0xae09('0x2e')]={};this['queueBookedRR']={};ami['on'](_0xae09('0x2f'),this[_0xae09('0x30')]['bind'](this));ami['on'](_0xae09('0x31'),this['syncQueueCallerAbandon'][_0xae09('0x32')](this));ami['on'](_0xae09('0x33'),this[_0xae09('0x34')]['bind'](this));ami['on'](_0xae09('0x35'),this['syncAgentComplete'][_0xae09('0x32')](this));ami['on'](_0xae09('0x36'),this[_0xae09('0xd')][_0xae09('0x32')](this));ami['on'](_0xae09('0x37'),this[_0xae09('0x38')]['bind'](this));ami['on'](_0xae09('0x39'),this[_0xae09('0x3a')][_0xae09('0x32')](this));ami['on'](_0xae09('0x3b'),this['syncVarSet'][_0xae09('0x32')](this));ami['on']('queuemember',this[_0xae09('0x3c')][_0xae09('0x32')](this));ami['on'](_0xae09('0x3d'),this[_0xae09('0x3e')]['bind'](this));this[_0xae09('0x3f')]();this[_0xae09('0x40')]();RpcSetting[_0xae09('0x41')]()[_0xae09('0x42')](function(_0x8c3030){previewRecallmeReminderInterval=_0x8c3030[_0xae09('0x43')];});}function isNotNull(_0x520838){return _0x520838!==null&&!_[_0xae09('0x44')](_0x520838);}function checkIsLoggedIn(_0x3b7dc3,_0x44a73c){return function(){if(_0x44a73c<=0x0){_0x3b7dc3['message']='AGENTS_NOT_LOGGED';throw _0x3b7dc3[_0xae09('0x45')]+_0xae09('0x46');}};}function isActive(_0x4e282c){return _0x4e282c;}function checkIsActive(_0x598fd7,_0x2dfb23){return function(){if(!isActive(_0x2dfb23)){_0x598fd7[_0xae09('0x47')]=_0xae09('0x48');throw _0x598fd7['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x1fb066){return function(){if(!isNotNull(_0x1fb066['Interval'])){_0x1fb066['message']=_0xae09('0x49');throw _0x1fb066[_0xae09('0x45')]+_0xae09('0x4a');}if(!isNotNull(_0x1fb066[_0xae09('0x4b')]['Intervals'])){_0x1fb066[_0xae09('0x47')]=_0xae09('0x49');throw _0x1fb066[_0xae09('0x45')]+_0xae09('0x4a');}if(!isNotNull(_[_0xae09('0x4c')](_0x1fb066[_0xae09('0x4b')]['Intervals']))){_0x1fb066['message']=_0xae09('0x49');throw _0x1fb066['name']+_0xae09('0x4a');}};}function msgResponse(_0x270d14,_0x532e91,_0x78aa69){return{'action':_0x270d14,'response':_0x532e91,'message':_0x78aa69,'stack':_0x78aa69};}function myreject(_0x28ff5f){return function(_0x194796){return _0x28ff5f(msgResponse(_0xae09('0x4d'),_0xae09('0x4e'),JSON['stringify'](_0x194796)));};}function getSeconds(_0x26efc1,_0x3f9163){var _0x4c572a=moment(_0x26efc1)[_0xae09('0x4f')](0x0);var _0x35987d=moment(_0x3f9163)['milliseconds'](0x0);return _0x4c572a['diff'](_0x35987d,_0xae09('0x50'));}function emit(_0x583232,_0x370060,_0x57a3fc){io['to'](_0x583232)[_0xae09('0x51')](_0x370060,_0x57a3fc);}function emitVoiceQueueSummary(_0x34bc02){if(_0x34bc02[_0xae09('0x52')]==='outbound'){var _0x25c903={'id':_0x34bc02['id'],'name':_0x34bc02[_0xae09('0x45')],'strategy':_0x34bc02[_0xae09('0x53')],'answered':_0x34bc02[_0xae09('0x54')],'available':_0x34bc02[_0xae09('0x55')],'loggedIn':_0x34bc02[_0xae09('0x56')],'pTalking':_0x34bc02[_0xae09('0x57')],'sumBillable':_0x34bc02[_0xae09('0x58')],'sumDuration':_0x34bc02['sumDuration'],'sumHoldTime':_0x34bc02[_0xae09('0x59')]||0x0,'talking':_0x34bc02[_0xae09('0x5a')],'total':_0x34bc02[_0xae09('0x5b')],'type':_0x34bc02['type'],'unmanaged':_0x34bc02[_0xae09('0x5c')],'abandoned':_0x34bc02[_0xae09('0x5d')],'waiting':_0x34bc02[_0xae09('0x5e')],'loggedInDb':_0x34bc02[_0xae09('0x5f')],'dialActive':_0x34bc02[_0xae09('0x60')],'dialMethod':_0x34bc02[_0xae09('0x61')],'dialOriginateCallerIdName':_0x34bc02[_0xae09('0x62')],'dialOriginateCallerIdNumber':_0x34bc02[_0xae09('0x63')],'dialOriginateTimeout':_0x34bc02['dialOriginateTimeout'],'dialPrefix':_0x34bc02[_0xae09('0x64')],'outboundAnswerAgiCallsDay':_0x34bc02['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x34bc02[_0xae09('0x65')],'outboundBlacklistCallsDay':_0x34bc02[_0xae09('0x66')],'outboundBusyCallsDay':_0x34bc02['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x34bc02['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x34bc02[_0xae09('0x67')],'outboundDropCallsDayCallersExit':_0x34bc02['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x34bc02[_0xae09('0x68')],'outboundNoAnswerCallsDay':_0x34bc02['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x34bc02[_0xae09('0x69')],'outboundOriginateFailureCallsDay':_0x34bc02[_0xae09('0x6a')],'outboundReCallsDay':_0x34bc02[_0xae09('0x6b')],'outboundRejectCallsDay':_0x34bc02[_0xae09('0x6c')],'outboundUnknownCallsDay':_0x34bc02['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x34bc02['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34bc02['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x34bc02[_0xae09('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x34bc02[_0xae09('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x34bc02['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x34bc02['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x34bc02[_0xae09('0x6f')],'predictiveIntervalHitRate':_0x34bc02[_0xae09('0x70')],'predictiveIntervalMultiplicativeFactor':_0x34bc02[_0xae09('0x71')],'predictiveIntervalPauses':_0x34bc02['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x34bc02[_0xae09('0x72')],'predictiveIntervalTotalCalls':_0x34bc02[_0xae09('0x73')],'message':_0x34bc02[_0xae09('0x47')],'originated':_0x34bc02[_0xae09('0x74')],'erlangCalls':_0x34bc02[_0xae09('0x75')],'erlangCallToSecond':_0x34bc02[_0xae09('0x76')],'erlangAbandonmentRate':_0x34bc02[_0xae09('0x77')],'erlangBusyFactor':_0x34bc02[_0xae09('0x78')],'startPredictive':_0x34bc02[_0xae09('0x79')],'startProgressive':_0x34bc02[_0xae09('0x7a')]};if(_0x34bc02[_0xae09('0x7b')]){_0x25c903[_0xae09('0x7b')]={'id':_0x34bc02[_0xae09('0x7b')]['id'],'name':_0x34bc02[_0xae09('0x7b')][_0xae09('0x45')],'active':_0x34bc02['Trunk'][_0xae09('0x7c')],'callerid':_0x34bc02[_0xae09('0x7b')][_0xae09('0x7d')]};}if(_0x34bc02[_0xae09('0x4b')]){_0x25c903['Interval']={'id':_0x34bc02[_0xae09('0x4b')]['id'],'name':_0x34bc02[_0xae09('0x4b')]['name']};}var _0x3e7d1e=md5(JSON['stringify'](_0x25c903));if(_0x34bc02[_0xae09('0x4')]!==_0x3e7d1e){_0x34bc02['md5']=_0x3e7d1e;emit(util[_0xae09('0x7e')](_0xae09('0x7f'),_0x25c903[_0xae09('0x45')]),_0xae09('0x80'),_0x25c903);}}}function emitCampaignSummary(_0x5cd8c4){if(_0x5cd8c4['type']===_0xae09('0x81')){emit(util['format'](_0xae09('0x82'),_0x5cd8c4[_0xae09('0x45')]),'campaign:save',_0x5cd8c4);}}function checkGetDataPredictive(_0x76860f){if(isNotNull(_0x76860f)&&!_['isEmpty'](_0x76860f)){loggerPredictive['info'](_0xae09('0x83'));loggerPredictive[_0xae09('0x84')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76860f[_0xae09('0x73')]);loggerPredictive[_0xae09('0x84')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76860f[_0xae09('0x85')]);loggerPredictive[_0xae09('0x84')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76860f['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xae09('0x84')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76860f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xae09('0x84')](_0xae09('0x86'),_0x76860f['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xae09('0x84')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76860f['predictiveIntervalAvgTalktime']);loggerPredictive[_0xae09('0x84')](_0xae09('0x87'));if(_0x76860f[_0xae09('0x73')]>0x0){if(!_[_0xae09('0x44')](_0x76860f[_0xae09('0x6d')])&&_0x76860f[_0xae09('0x6d')]>0x0){return!![];}loggerPredictive[_0xae09('0x84')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xae09('0x44')](_0x76860f[_0xae09('0x88')])&&_0x76860f[_0xae09('0x88')]>0x0){return!![];}loggerPredictive['info'](_0xae09('0x89'));}else{loggerPredictive[_0xae09('0x84')](_0xae09('0x8a'));}}else{loggerPredictive['info'](_0xae09('0x8b'));}return![];}function mergeDataErlangB(_0xd57ab0){return function(_0xc513e1){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xae09('0x84')](_0xae09('0x8c'),_0xc513e1[_0xae09('0x75')]);loggerPredictive[_0xae09('0x84')](_0xae09('0x8d'),_0xc513e1[_0xae09('0x76')]);loggerPredictive[_0xae09('0x84')](_0xae09('0x8e'),_0xc513e1[_0xae09('0x77')]);loggerPredictive[_0xae09('0x84')](_0xae09('0x8f'),_0xc513e1[_0xae09('0x78')]);loggerPredictive[_0xae09('0x84')](_0xae09('0x8e'),_0xc513e1[_0xae09('0x77')]);loggerPredictive['info'](_0xae09('0x87'));_['merge'](_0xd57ab0,_0xc513e1);};}function getDiff(_0x17b093){var _0x1d9c2a=moment()[_0xae09('0x4f')](0x0);var _0x49ef67=moment(_0x17b093)[_0xae09('0x4f')](0x0);return _0x1d9c2a['diff'](_0x49ef67,_0xae09('0x50'));}function ifInterval(_0x30bf8d,_0x21eaaa){if(_[_0xae09('0x44')](_0x21eaaa)){return![];}return getDiff(_0x21eaaa)<_0x30bf8d*0x3c;}function freeVariablesPredictive(_0x5b17f0){if(isNotNull(_0x5b17f0)){if(!_['isUndefined'](_0x5b17f0[_0xae09('0x7a')])){_0x5b17f0[_0xae09('0x7a')]=undefined;loggerPredictive[_0xae09('0x84')](_0x5b17f0[_0xae09('0x45')],_0xae09('0x90'));}if(!_[_0xae09('0x44')](_0x5b17f0['startPredictive'])){_0x5b17f0[_0xae09('0x79')]=undefined;loggerPredictive[_0xae09('0x84')](_0x5b17f0[_0xae09('0x45')],_0xae09('0x91'));}if(!_[_0xae09('0x44')](_0x5b17f0[_0xae09('0x92')])){clearInterval(_0x5b17f0[_0xae09('0x92')]);_0x5b17f0[_0xae09('0x92')]=undefined;loggerPredictive[_0xae09('0x84')](_0x5b17f0[_0xae09('0x45')],_0xae09('0x93'));}}}function erlangb(_0x104181,_0x546107){if(_0x546107===0x0){return 0x0;}var _0x1fb96a=0x1;for(var _0x2ca7ff=0x1;_0x2ca7ff<=_0x546107;_0x2ca7ff+=0x1){_0x1fb96a=0x1+_0x1fb96a*_0x2ca7ff/_0x104181;}return 0x1/_0x1fb96a;}function isVoiceQueueOutbound(_0x4c16f7){return _0x4c16f7===_0xae09('0x94');}function isNotPreview(_0x41ebce){return _0x41ebce!==_0xae09('0x95');}function isCampaignIvr(_0x50951e){return _0x50951e==='ivr';}function getCallerId(_0x1bf38e,_0x10efd2,_0xa69913){if(!_[_0xae09('0x44')](_0xa69913)&&typeof _0xa69913===_0xae09('0x96')&&!_['isEmpty'](_0xa69913)){if(!_[_0xae09('0x44')](_0x10efd2)&&typeof _0x10efd2===_0xae09('0x96')&&!_[_0xae09('0x4c')](_0x10efd2)){return util[_0xae09('0x7e')](_0xae09('0x97'),_0x10efd2,_0xa69913);}return util[_0xae09('0x7e')]('\x22%s\x22\x20<%s>',_0xa69913,_0xa69913);}if(!_[_0xae09('0x44')](_0x1bf38e)&&typeof _0x1bf38e===_0xae09('0x96')&&!_[_0xae09('0x4c')](_0x1bf38e)){return _0x1bf38e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4c6622,_0x2d6a03){return function(_0x335975){freeVariablesPredictive(_0x2d6a03);emitVoiceQueueSummary(_0x2d6a03);emitCampaignSummary(_0x2d6a03);loggerSyncQueueSummary[_0xae09('0x98')](_0x4c6622,util['inspect'](_0x335975,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x30c939,_0x116eb3){return function(_0x61f568){loggerPredictive[_0xae09('0x98')](_0x116eb3[_0xae09('0x45')],_0x30c939);loggerPredictive[_0xae09('0x98')](_0x61f568[_0xae09('0x99')]);freeVariablesPredictive(_0x116eb3);};}function loggerCatch(_0x14d94d){return function(_0x1a71e6){logger[_0xae09('0x98')](_0x14d94d,util[_0xae09('0x9a')](_0x1a71e6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x280218){return _0x280218&&!_[_0xae09('0x44')](_0x280218)&&_0x280218[_0xae09('0x9b')]>0x0;}function decremetOriginate(_0x472472){if(!_[_0xae09('0x44')](_0x472472)&&_0x472472!==null){if(typeof _0x472472[_0xae09('0x74')]!==_0xae09('0x9c')){if(_0x472472[_0xae09('0x74')]>0x0){_0x472472[_0xae09('0x74')]-=0x1;}else{logger[_0xae09('0x98')](_0xae09('0x9d'));}}}else{logger['error'](_0xae09('0x9e'));}}function checkContactLowerLimitOriginate(_0x2cd87d,_0x35fee4,_0x5e3273){if(_0x35fee4>_0x5e3273){for(var _0x3315e4=0x0;_0x3315e4<_0x35fee4-_0x5e3273;_0x3315e4+=0x1){decremetOriginate(_0x2cd87d);}}}function loggerGetContactDialer(_0x2164d4,_0x536911,_0x23463d){return function(_0x103e59){checkContactLowerLimitOriginate(_0x536911,_0x23463d,0x0);logger[_0xae09('0x98')](_0x2164d4,util[_0xae09('0x9a')](_0x103e59,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x33fd8f){return function(_0xa762f2){if(isNotNull(_0xa762f2)&&isNotNull(_0xa762f2[0x0])){if(_0xa762f2[0x0][_0xae09('0x9f')]>0x0){_0x33fd8f[_0xae09('0x47')]='RESCHEDULED_CONTACTS';logger[_0xae09('0x84')](_0xae09('0xa0')+_0x33fd8f['name'],_0xa762f2[0x0][_0xae09('0x9f')],_0xae09('0xa1'));}else{_0x33fd8f[_0xae09('0x47')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xae09('0x84')](_0xae09('0xa2')+_0x33fd8f[_0xae09('0x45')]);}}};}function notSendMessagesQueue(_0x5e3c8e){if(_0x5e3c8e[_0xae09('0xa3')]){freeVariablesPredictive(_0x5e3c8e);if(_0x5e3c8e[_0xae09('0x74')]===0x0&&_0x5e3c8e[_0xae09('0x5a')]===0x0&&_0x5e3c8e[_0xae09('0x5e')]===0x0&&(_0x5e3c8e[_0xae09('0x57')]||0x0)===0x0){_0x5e3c8e[_0xae09('0xa3')]=![];_0x5e3c8e['available']=0x0;_0x5e3c8e[_0xae09('0x47')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xae09('0x98')](_0xae09('0xa4'),_0x5e3c8e[_0xae09('0x45')],_0xae09('0xa5'));}else{_0x5e3c8e[_0xae09('0x47')]=_0xae09('0xa6');loggerSyncQueueSummary[_0xae09('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5e3c8e[_0xae09('0x45')],_0xae09('0xa7'));}emitVoiceQueueSummary(_0x5e3c8e);}}function notSendMessagesCampaign(_0x4014ad){if(_0x4014ad[_0xae09('0xa3')]){if(_0x4014ad[_0xae09('0x74')]===0x0){_0x4014ad[_0xae09('0xa3')]=![];_0x4014ad[_0xae09('0x47')]=_0xae09('0x48');loggerSyncQueueSummary[_0xae09('0x98')](_0xae09('0xa8'),_0x4014ad[_0xae09('0x45')],'is\x20not\x20active');}else{_0x4014ad['message']=_0xae09('0xa6');loggerSyncQueueSummary[_0xae09('0x98')](_0xae09('0xa8'),_0x4014ad[_0xae09('0x45')],'is\x20disactive');}emitCampaignSummary(_0x4014ad);}}function createObjHistory(_0x228fe8,_0x480d32,_0x3b634f,_0x5bb59f,_0x37f8e3){_0x228fe8[_0xae09('0x47')]=_0x3b634f;var _0x4a3582=new Action(_0x228fe8,_0x480d32);var _0x1bda39=new History(_0x4a3582);_0x1bda39[_0xae09('0xa9')]=_0x5bb59f;_0x1bda39['statedesc']=_0x37f8e3;_0x1bda39[_0xae09('0xaa')]=_0x4a3582[_0xae09('0xab')];return _0x1bda39;}Dialer[_0xae09('0x20')][_0xae09('0x40')]=function(){var _0x11fe24=this;setInterval(function(){_0x11fe24[_0xae09('0xac')](_0x11fe24[_0xae09('0x2b')],_0xae09('0xad'));_0x11fe24[_0xae09('0xac')](_0x11fe24[_0xae09('0x2a')],_0xae09('0xae'));},0x32c8);};Dialer[_0xae09('0x20')]['clearZombieChannels']=function(_0x5938a3,_0x39d5a3){var _0x244787=this;for(var _0x49410b in _0x5938a3){if(typeof _0x5938a3[_0x49410b]!==_0xae09('0x9c')){this[_0xae09('0x23')][_0xae09('0xaf')](function(){if(!_['isNil'](_0x5938a3[_0x49410b])){return ami[_0xae09('0xb0')]({'action':'status','channel':_0x5938a3[_0x49410b][_0xae09('0xb1')]})[_0xae09('0xb2')](function(_0x67a012){if(_0x67a012[_0xae09('0x47')]===_0xae09('0xb3')){setTimeout(function(){if(_0x5938a3[_0x49410b]&&_0x5938a3[_0x49410b][_0xae09('0x52')]!==_0xae09('0x81')){_0x244787[_0xae09('0xb4')](_0x244787[_0xae09('0x24')][_0x5938a3[_0x49410b][_0xae09('0xb5')]]);logger[_0xae09('0x98')](_0xae09('0xb6'),_0x39d5a3,_0x49410b,_0x5938a3[_0x49410b][_0xae09('0xb5')]);delete _0x5938a3[_0x49410b];}if(_0x5938a3[_0x49410b]&&_0x5938a3[_0x49410b]['type']==='ivr'){_0x244787['updateOriginated'](_0x244787[_0xae09('0x25')][_0x5938a3[_0x49410b][_0xae09('0xb5')]]);logger[_0xae09('0x98')](_0xae09('0xb7'),_0x39d5a3,_0x49410b,_0x5938a3[_0x49410b]['queue']);delete _0x5938a3[_0x49410b];}},0x2328);}});}});}}};Dialer[_0xae09('0x20')]['countReScheduled']=function(_0x1a62b2){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopper[_0xae09('0xb9')](_0x1a62b2))[_0xae09('0xb2')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xae09('0xba')]=function(_0x316bf5){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopperBlack[_0xae09('0xba')](_0x316bf5))[_0xae09('0xb2')](loggerCatch(_0xae09('0xbb')));};Dialer[_0xae09('0x20')][_0xae09('0xbc')]=function(_0x14126e){return BPromise[_0xae09('0xb8')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x14126e))[_0xae09('0xb2')](loggerCatch(_0xae09('0xbd')));};Dialer[_0xae09('0x20')]['averageHandleTime']=function(_0x191158){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopperHistory[_0xae09('0xbe')](_0x191158))[_0xae09('0xb2')](loggerCatch(_0xae09('0xbf')));};Dialer[_0xae09('0x20')][_0xae09('0xc0')]=function(_0x39ec14){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopper[_0xae09('0xc0')](_0x39ec14))[_0xae09('0xb2')](loggerCatch(_0xae09('0xc1')));};Dialer['prototype'][_0xae09('0xc2')]=function(_0x5b1322,_0x2612e0,_0xd56f83){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopper[_0xae09('0xc2')](_0x5b1322,_0x2612e0,_0xd56f83))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0xae09('0x20')][_0xae09('0xc3')]=function(_0x4fb466,_0x2c6deb,_0x38d3c9,_0x26452f,_0x1c1325){return BPromise[_0xae09('0xb8')]()['then'](cmHopper['getContactDialer'](_0x4fb466,_0x2c6deb,_0x38d3c9,_0x26452f))[_0xae09('0xb2')](function(_0x31005c){_0x1c1325[_0xae09('0xc4')]-=_0x38d3c9;_0x1c1325[_0xae09('0xc4')]=_0x1c1325['temp']>0x0?_0x1c1325[_0xae09('0xc4')]:0x0;loggerCatch(_0xae09('0xc5'))(_0x31005c);});};Dialer[_0xae09('0x20')]['getContactDialerIvr']=function(_0x23f3b5,_0x5258cb,_0x1536db,_0x15a758){return BPromise['resolve']()[_0xae09('0x42')](cmHopper[_0xae09('0xc6')](_0x23f3b5,_0x5258cb,_0x1536db))[_0xae09('0xb2')](function(_0x43acce){_0x15a758[_0xae09('0xc4')]-=_0x5258cb;_0x15a758[_0xae09('0xc4')]=_0x15a758[_0xae09('0xc4')]>0x0?_0x15a758['temp']:0x0;loggerCatch(_0xae09('0xc7'))(_0x43acce);});};Dialer[_0xae09('0x20')]['getVoiceQueueRtPauses']=function(_0x3ef38c){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3ef38c))['catch'](loggerCatch(_0xae09('0xc8')));};Dialer[_0xae09('0x20')]['moveContactManagedDialer']=function(_0x71f1ec){return BPromise[_0xae09('0xb8')]()['then'](cmHopper[_0xae09('0xc9')](_0x71f1ec))[_0xae09('0xb2')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xae09('0x20')][_0xae09('0xca')]=function(_0x4d1b0b){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopperHistory['createHistory'](_0x4d1b0b))[_0xae09('0xb2')](loggerCatch(_0xae09('0xcb')));};Dialer[_0xae09('0x20')][_0xae09('0xb4')]=function(_0x5082c5){if(!_[_0xae09('0x44')](_0x5082c5)&&_0x5082c5!==null){if(typeof _0x5082c5[_0xae09('0x74')]!==_0xae09('0x9c')){if(_0x5082c5[_0xae09('0x74')]>0x0){_0x5082c5[_0xae09('0x74')]-=0x1;}else{logger[_0xae09('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xae09('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xae09('0x20')][_0xae09('0xcc')]=function(_0x433a0e,_0x4c9277){var _0x5e990d=this;return function(_0x2a5cdc){_0x5e990d[_0xae09('0xb4')](_0x4c9277);logger['error'](_0x433a0e,util[_0xae09('0x9a')](_0x2a5cdc,{'showHidden':![],'depth':null}));};};Dialer[_0xae09('0x20')][_0xae09('0xcd')]=function(_0x249fa1,_0x26c529,_0x3dd9d6){var _0x444cfb={'state':0x19,'statedesc':_0xae09('0xce')};this[_0xae09('0xb4')](_0x26c529);this[_0xae09('0xcf')](_[_0xae09('0xd0')](_0x444cfb,_[_0xae09('0xd1')](_0x3dd9d6,['ContactId','ListId',_0xae09('0xd2'),_0xae09('0xd3'),_0xae09('0xd4')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xae09('0x98')](_0x249fa1);};Dialer[_0xae09('0x20')][_0xae09('0xd5')]=function(_0x5832e8){return _0x5832e8===_0xae09('0xd6');};Dialer['prototype'][_0xae09('0xd7')]=function(_0x410c93){return!_[_0xae09('0x44')](_0x410c93)&&_0x410c93&&!_[_0xae09('0x44')](_0x410c93[_0xae09('0x45')])&&!_[_0xae09('0x44')](_0x410c93[_0xae09('0x7c')])&&_0x410c93[_0xae09('0x7c')]&&(this[_0xae09('0x27')][util[_0xae09('0x7e')](_0xae09('0xd8'),_0x410c93['name'])][_0xae09('0xd9')]===_0xae09('0xda')||this[_0xae09('0x27')][util['format'](_0xae09('0xd8'),_0x410c93[_0xae09('0x45')])][_0xae09('0xd9')]===_0xae09('0xdb'));};Dialer[_0xae09('0x20')]['saveInDb']=function(_0x25f7a1,_0xa0d845,_0x7856df){this[_0xae09('0xca')](_0x25f7a1)[_0xae09('0xb2')](loggerCatch(_0xa0d845));this['moveContactManagedDialer'](_0x25f7a1)[_0xae09('0xb2')](loggerCatch(_0x7856df));};Dialer['prototype'][_0xae09('0xdc')]=function(_0x63602a){var _0xd37cfc=this[_0xae09('0x2b')][_0x63602a[_0xae09('0xdd')]];var _0x23fec6;if(!_[_0xae09('0xde')](_0x63602a)&&!_[_0xae09('0xde')](_0x63602a['variable'])&&!_[_0xae09('0xde')](_0x63602a[_0xae09('0xdf')][_0xae09('0xe0')])&&_0x63602a[_0xae09('0xe1')]===_0xae09('0xe2')&&_0xd37cfc){if(_0xd37cfc[_0xae09('0x52')]!==_0xae09('0x81')&&this['voiceQueues'][_0xd37cfc['queue']][_0xae09('0xe3')]&&_0x63602a[_0xae09('0xe4')]===_0xae09('0xe5')){delete this['uniqueId'][_0x63602a['uniqueid']];this[_0xae09('0xb4')](this[_0xae09('0x24')][_0xd37cfc[_0xae09('0xb5')]]);this['voiceQueues'][_0xd37cfc[_0xae09('0xb5')]][_0xae09('0x65')]+=0x1;this[_0xae09('0x24')][_0xd37cfc[_0xae09('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x23fec6=new Hangup(_0xd37cfc,_0x63602a);_0x23fec6[_0xae09('0xa9')]=0x12;_0x23fec6[_0xae09('0xe6')]=_0xae09('0xe7');_0x23fec6[_0xae09('0xe8')]='AMD';ami[_0xae09('0x51')](_0xae09('0xe9'),ut[_0xae09('0xea')](_0x23fec6,'amd'));this[_0xae09('0xcf')](_0x23fec6,_0xae09('0xeb'),_0xae09('0xec'));}if(_0xd37cfc[_0xae09('0x52')]!=='ivr'&&this[_0xae09('0x24')][_0xd37cfc[_0xae09('0xb5')]]['dialAMDActive']&&_0x63602a[_0xae09('0xe4')]===_0xae09('0xed')){var _0x586bb6=this;return new BPromise(function(_0x5b9bd4,_0x4d5bc7){delete _0x586bb6[_0xae09('0x2b')][_0x63602a[_0xae09('0xdd')]];_0x586bb6['updateOriginated'](_0x586bb6[_0xae09('0x24')][_0xd37cfc['queue']]);_0x586bb6[_0xae09('0x24')][_0xd37cfc['queue']]['outboundAnswerCallsDay']+=0x1;_0x586bb6[_0xae09('0x24')][_0xd37cfc[_0xae09('0xb5')]][_0xae09('0xee')]+=0x1;var _0x1a1630=_0x586bb6[_0xae09('0x24')][_0xd37cfc[_0xae09('0xb5')]];var _0x142de6=new Hangup(_0xd37cfc,_0x63602a);_0x142de6[_0xae09('0xa9')]=0x13;_0x142de6['statedesc']='Machine';_0x142de6[_0xae09('0xe8')]=_0xae09('0xef');_0x142de6[_0xae09('0xf0')]+=0x1;_0x142de6['countglobal']+=0x1;_0x142de6['amd']=!![];ami[_0xae09('0x51')]('custom:amd',ut[_0xae09('0xea')](_0x142de6,_0xae09('0xf1')));_0x586bb6['createHistory'](_0x142de6)[_0xae09('0xb2')](loggerCatch(_0xae09('0xf2')));if(_0x142de6['countbusyretry']+_0x142de6[_0xae09('0xf3')]+_0x142de6[_0xae09('0xf4')]+_0x142de6[_0xae09('0xf5')]+_0x142de6[_0xae09('0xf6')]+_0x142de6['countabandonedretry']+_0x142de6[_0xae09('0xf0')]+_0x142de6[_0xae09('0xf7')]>=_0x1a1630[_0xae09('0xf8')]){_0x586bb6[_0xae09('0xf9')](_0x142de6,_0x5b9bd4,_0x4d5bc7,_0xae09('0xfa'));}else{if(_0x142de6[_0xae09('0xf0')]>=_0x1a1630[_0xae09('0xfb')]){_0x586bb6[_0xae09('0xfc')](_0x142de6,_0x5b9bd4,_0x4d5bc7,_0xae09('0xfd'));}else{_0x586bb6[_0xae09('0xc0')]({'active':![],'countmachineretry':_0x142de6[_0xae09('0xf0')],'scheduledat':moment()[_0xae09('0xfe')](_0x1a1630['dialMachineRetryFrequency'],'minutes')[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x142de6['ContactId'],'ListId':_0x142de6[_0xae09('0x100')],'VoiceQueueId':_0x142de6[_0xae09('0xd3')]||undefined,'CampaignId':_0x142de6[_0xae09('0xd4')]||undefined})['catch'](loggerCatch(_0xae09('0x101')));_0x5b9bd4({'reschedule':0x1});}}});}if(_0xd37cfc[_0xae09('0x52')]==='ivr'&&this[_0xae09('0x25')][_0xd37cfc[_0xae09('0xb5')]][_0xae09('0xe3')]&&_0x63602a['value']===_0xae09('0xe5')){delete this[_0xae09('0x2b')][_0x63602a['uniqueid']];this[_0xae09('0xb4')](this[_0xae09('0x25')][_0xd37cfc[_0xae09('0xb5')]]);_0x23fec6=new Hangup(_0xd37cfc,_0x63602a);_0x23fec6['state']=0x12;_0x23fec6[_0xae09('0xe6')]=_0xae09('0xe7');_0x23fec6[_0xae09('0xe8')]=_0xae09('0xef');ami[_0xae09('0x51')](_0xae09('0xe9'),ut[_0xae09('0xea')](_0x23fec6,'amd'));this[_0xae09('0xcf')](_0x23fec6,_0xae09('0x102'),_0xae09('0x103'));}if(_0xd37cfc[_0xae09('0x52')]===_0xae09('0x81')&&this[_0xae09('0x25')][_0xd37cfc['queue']][_0xae09('0xe3')]&&_0x63602a[_0xae09('0xe4')]==='MACHINE'){var _0x586bb6=this;return new BPromise(function(_0x4d9e78,_0x9e7925){delete _0x586bb6[_0xae09('0x2b')][_0x63602a[_0xae09('0xdd')]];_0x586bb6[_0xae09('0xb4')](_0x586bb6[_0xae09('0x25')][_0xd37cfc[_0xae09('0xb5')]]);_0x586bb6[_0xae09('0x25')][_0xd37cfc[_0xae09('0xb5')]][_0xae09('0x65')]+=0x1;_0x586bb6[_0xae09('0x25')][_0xd37cfc[_0xae09('0xb5')]][_0xae09('0xee')]+=0x1;var _0x5073e2=_0x586bb6[_0xae09('0x25')][_0xd37cfc['queue']];var _0x23ce53=new Hangup(_0xd37cfc,_0x63602a);_0x23ce53[_0xae09('0xa9')]=0x13;_0x23ce53[_0xae09('0xe6')]=_0xae09('0x104');_0x23ce53[_0xae09('0xe8')]=_0xae09('0xef');_0x23ce53[_0xae09('0xf0')]+=0x1;_0x23ce53['countglobal']+=0x1;_0x23ce53[_0xae09('0xf1')]=!![];ami[_0xae09('0x51')](_0xae09('0xe9'),ut[_0xae09('0xea')](_0x23ce53,_0xae09('0xf1')));_0x586bb6[_0xae09('0xca')](_0x23ce53)[_0xae09('0xb2')](loggerCatch(_0xae09('0xf2')));if(_0x23ce53[_0xae09('0x105')]+_0x23ce53[_0xae09('0xf3')]+_0x23ce53[_0xae09('0xf4')]+_0x23ce53[_0xae09('0xf5')]+_0x23ce53['countdropretry']+_0x23ce53[_0xae09('0x106')]+_0x23ce53[_0xae09('0xf0')]+_0x23ce53[_0xae09('0xf7')]>=_0x5073e2['dialGlobalMaxRetry']){_0x586bb6[_0xae09('0xf9')](_0x23ce53,_0x4d9e78,_0x9e7925,_0xae09('0xfa'));}else{if(_0x23ce53[_0xae09('0xf0')]>=_0x5073e2[_0xae09('0xfb')]){_0x586bb6['createStateFinal'](_0x23ce53,_0x4d9e78,_0x9e7925,_0xae09('0xfd'));}else{_0x586bb6['rescheduleContact']({'active':![],'countmachineretry':_0x23ce53[_0xae09('0xf0')],'scheduledat':moment()['add'](_0x5073e2['dialMachineRetryFrequency'],'minutes')['format'](_0xae09('0xff')),'ContactId':_0x23ce53[_0xae09('0x107')],'ListId':_0x23ce53[_0xae09('0x100')],'VoiceQueueId':_0x23ce53[_0xae09('0xd3')]||undefined,'CampaignId':_0x23ce53['CampaignId']||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x101')));_0x4d9e78({'reschedule':0x1});}}});}}};Dialer[_0xae09('0x20')][_0xae09('0x38')]=function(_0x1290af){var _0x471377=this[_0xae09('0x2b')][_0x1290af[_0xae09('0xdd')]];var _0x5bd84a=this;var _0x214dbf;if(_0x471377&&_0x471377[_0xae09('0x52')]===_0xae09('0x81')){delete this[_0xae09('0x2b')][_0x1290af[_0xae09('0xdd')]];this[_0xae09('0xb4')](this['campaigns'][_0x471377[_0xae09('0xb5')]]);this[_0xae09('0x25')][_0x471377[_0xae09('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x214dbf=new Hangup(_0x471377,_0x1290af);this[_0xae09('0xca')](_0x214dbf)['catch'](loggerCatch(_0xae09('0x108')));this[_0xae09('0xc9')](_0x214dbf)['catch'](loggerCatch(_0xae09('0x109')));}if(_0x471377&&_0x471377[_0xae09('0x52')]!==_0xae09('0x81')&&isNotNull(this[_0xae09('0x24')][_0x471377[_0xae09('0xb5')]][_0xae09('0x10a')])){delete this['uniqueId'][_0x1290af['uniqueid']];this[_0xae09('0xb4')](this[_0xae09('0x24')][_0x471377['queue']]);this[_0xae09('0x24')][_0x471377['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x471377[_0xae09('0xb5')]][_0xae09('0xee')]+=0x1;_0x214dbf=new Hangup(_0x471377,_0x1290af);_0x214dbf['state']=0x10;_0x214dbf[_0xae09('0xe6')]=_0xae09('0x10b');_0x214dbf['membername']=_0xae09('0x10c');this[_0xae09('0xca')](_0x214dbf)[_0xae09('0xb2')](loggerCatch(_0xae09('0x108')));this['moveContactManagedDialer'](_0x214dbf)[_0xae09('0xb2')](loggerCatch(_0xae09('0x109')));}if(_0x471377&&_0x471377['type']!==_0xae09('0x81')&&!isNotNull(this[_0xae09('0x24')][_0x471377[_0xae09('0xb5')]]['dialQueueProject'])){delete this[_0xae09('0x2b')][_0x1290af[_0xae09('0xdd')]];this[_0xae09('0xb4')](this[_0xae09('0x24')][_0x471377[_0xae09('0xb5')]]);this[_0xae09('0x24')][_0x471377[_0xae09('0xb5')]][_0xae09('0x10d')]+=0x1;_0x214dbf=new Hangup(_0x471377,_0x1290af);_0x214dbf['state']=0xc;_0x214dbf[_0xae09('0xe6')]=_0x1290af[_0xae09('0x10e')];_0x214dbf[_0xae09('0xe8')]=_0xae09('0x10f');this[_0xae09('0xca')](_0x214dbf)['catch'](loggerCatch(_0xae09('0x108')));this[_0xae09('0xc9')](_0x214dbf)['catch'](loggerCatch(_0xae09('0x109')));}};Dialer[_0xae09('0x20')][_0xae09('0x110')]=function(_0x4a247a){var _0x4dc4d3=this[_0xae09('0x2b')][_0x4a247a[_0xae09('0xdd')]];var _0x6cca10=this;if(this['voiceQueues'][_0x4a247a[_0xae09('0xb5')]]){if(_0x4dc4d3&&_0x4dc4d3[_0xae09('0x52')]!==_0xae09('0x81')){delete this[_0xae09('0x2b')][_0x4a247a[_0xae09('0xdd')]];this['voiceQueues'][_0x4a247a['queue']][_0xae09('0x65')]+=0x1;var _0x3ae16a=new AgentComplete(_0x4dc4d3,_0x4a247a);if(_0x4a247a[_0xae09('0x111')]===_0xae09('0x112')){_0x3ae16a[_0xae09('0x113')]=this[_0xae09('0x24')][_0x4a247a[_0xae09('0xb5')]][_0xae09('0x114')]&&this['voiceQueues'][_0x4a247a['queue']][_0xae09('0x115')]?moment()['format'](_0xae09('0xff')):undefined;}this[_0xae09('0xca')](_0x3ae16a)[_0xae09('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xae09('0xc9')](_0x3ae16a)['catch'](loggerCatch(_0xae09('0x116')));}}};Dialer['prototype'][_0xae09('0x30')]=function(_0x514c50){if(this[_0xae09('0x24')][_0x514c50[_0xae09('0xb5')]]){if(this['uniqueId'][_0x514c50[_0xae09('0xdd')]]&&this[_0xae09('0x2b')][_0x514c50[_0xae09('0xdd')]][_0xae09('0x52')]!==_0xae09('0x81')){this[_0xae09('0xb4')](this['voiceQueues'][_0x514c50[_0xae09('0xb5')]]);this[_0xae09('0x2b')][_0x514c50[_0xae09('0xdd')]]['answertime']=moment()[_0xae09('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xae09('0x117')]=function(_0xa066c8){this[_0xae09('0xca')](_0xa066c8)[_0xae09('0xb2')](loggerCatch(_0xae09('0x118')));this['moveContactManagedDialer'](_0xa066c8)['catch'](loggerCatch(_0xae09('0x119')));};Dialer[_0xae09('0x20')][_0xae09('0x11a')]=function(_0x4cc32c){var _0x1d54e1=this['uniqueId'][_0x4cc32c['uniqueid']];var _0x50b3d1=this;if(this['voiceQueues'][_0x4cc32c[_0xae09('0xb5')]]){if(_0x1d54e1&&_0x1d54e1[_0xae09('0x52')]!==_0xae09('0x81')){delete this[_0xae09('0x2b')][_0x4cc32c[_0xae09('0xdd')]];this['updateOriginated'](this['voiceQueues'][_0x4cc32c['queue']]);_0x1d54e1[_0xae09('0x11b')]=moment()[_0xae09('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4bf64b=new QueueCallerAbandon(_0x1d54e1,_0x4cc32c);if(getSeconds(_0x1d54e1[_0xae09('0x11b')],_0x1d54e1[_0xae09('0x11c')])>=_0x1d54e1[_0xae09('0x11d')]){this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]][_0xae09('0x11e')]+=0x1;this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4bf64b[_0xae09('0xa9')]=0xa;_0x4bf64b[_0xae09('0xe6')]=_0xae09('0x11f');_0x4bf64b[_0xae09('0x120')]=_0xae09('0x121');_0x4bf64b[_0xae09('0x113')]=this['voiceQueues'][_0x4cc32c[_0xae09('0xb5')]][_0xae09('0x114')]?moment()['format'](_0xae09('0xff')):undefined;_0x4bf64b['countdropretry']+=0x1;_0x4bf64b[_0xae09('0x122')]+=0x1;if(_0x4bf64b[_0xae09('0xf6')]>=this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]][_0xae09('0x123')]){this['queueCallerAbandonCreateState'](_0x4bf64b);}else{this[_0xae09('0xc0')]({'active':![],'countdropretry':_0x4bf64b[_0xae09('0xf6')],'scheduledat':moment()[_0xae09('0xfe')](this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]][_0xae09('0x124')],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x1d54e1['ContactId'],'ListId':_0x1d54e1[_0xae09('0x100')],'VoiceQueueId':_0x1d54e1[_0xae09('0xd3')]||undefined,'CampaignId':_0x1d54e1[_0xae09('0xd4')]||undefined})[_0xae09('0xb2')](loggerCatch('[rescheduleContact][Drop]'));var _0x32309e=new History(_0x4bf64b);_0x32309e[_0xae09('0xa9')]=0xa;_0x32309e[_0xae09('0xe6')]='Drop';_0x32309e['starttime']=moment()[_0xae09('0x7e')](_0xae09('0xff'));_0x32309e[_0xae09('0xaa')]=_0x32309e[_0xae09('0xab')];_0x32309e[_0xae09('0x126')]=_0x4bf64b[_0xae09('0x126')];_0x32309e[_0xae09('0x127')]=_0x4bf64b[_0xae09('0x127')];this[_0xae09('0xca')](_0x32309e)[_0xae09('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x4cc32c['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4bf64b['state']=0xb;_0x4bf64b['statedesc']=_0xae09('0x128');_0x4bf64b[_0xae09('0x120')]=_0xae09('0x129');_0x4bf64b[_0xae09('0x106')]+=0x1;_0x4bf64b[_0xae09('0x122')]+=0x1;if(_0x4bf64b['countabandonedretry']>=this[_0xae09('0x24')][_0x4cc32c['queue']][_0xae09('0x12a')]){this[_0xae09('0x117')](_0x4bf64b);}else{this[_0xae09('0xc0')]({'active':![],'countabandonedretry':_0x4bf64b[_0xae09('0x106')],'scheduledat':moment()[_0xae09('0xfe')](this[_0xae09('0x24')][_0x4cc32c[_0xae09('0xb5')]][_0xae09('0x12b')],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x1d54e1[_0xae09('0x107')],'ListId':_0x1d54e1[_0xae09('0x100')],'VoiceQueueId':_0x1d54e1[_0xae09('0xd3')]||undefined,'CampaignId':_0x1d54e1[_0xae09('0xd4')]||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x12c')));var _0x32309e=new History(_0x4bf64b);_0x32309e[_0xae09('0xa9')]=0xb;_0x32309e[_0xae09('0xe6')]=_0xae09('0x128');_0x32309e[_0xae09('0xab')]=moment()[_0xae09('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x32309e[_0xae09('0xaa')]=_0x32309e[_0xae09('0xab')];_0x32309e[_0xae09('0x126')]=_0x4bf64b[_0xae09('0x126')];_0x32309e[_0xae09('0x127')]=_0x4bf64b[_0xae09('0x127')];this[_0xae09('0xca')](_0x32309e)[_0xae09('0xb2')](loggerCatch(_0xae09('0x12d')));}}}}};Dialer[_0xae09('0x20')][_0xae09('0x3a')]=function(_0x3b08fe){if(this['actions'][_0x3b08fe[_0xae09('0xdd')]]){this[_0xae09('0x2a')][_0x3b08fe['uniqueid']][_0xae09('0xb1')]=_0x3b08fe[_0xae09('0xb1')];}if(this[_0xae09('0x2b')][_0x3b08fe['uniqueid']]){this['uniqueId'][_0x3b08fe['uniqueid']][_0xae09('0xb1')]=_0x3b08fe['channel'];}};Dialer[_0xae09('0x20')]['syncQueueMember']=function(_0x35a3db){if(strategy[this['voiceQueues'][this['actions'][_0x35a3db[_0xae09('0x12e')]][_0xae09('0xb5')]][_0xae09('0x53')]]==='roundrobin'){if(this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]]&&_[_0xae09('0xde')](this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0x12f')])&&_0x35a3db[_0xae09('0xd9')]==='1'&&_0x35a3db[_0xae09('0x130')]==='0'){if(this[_0xae09('0x26')][_0x35a3db[_0xae09('0x131')]]){if(!this[_0xae09('0x26')][_0x35a3db[_0xae09('0x131')]][_0xae09('0x12f')]){this['agents'][_0x35a3db['stateinterface']][_0xae09('0x12f')]=!![];this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0x12f')]=!![];this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0x131')]=_0x35a3db[_0xae09('0x131')];}}}}else if((strategy[this[_0xae09('0x24')][this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0xb5')]][_0xae09('0x53')]]||_0xae09('0x1e'))===_0xae09('0x1e')){if(this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]]){if(this['agents'][_0x35a3db['stateinterface']]){this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]]['stateinterface']=_0x35a3db[_0xae09('0x131')];if(_[_0xae09('0xde')](this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0xb5')]])){this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]][_0xae09('0xb5')]]=[];}this[_0xae09('0x2e')][this['actions'][_0x35a3db[_0xae09('0x12e')]][_0xae09('0xb5')]]['push'](_[_0xae09('0xd0')](_['pick'](this[_0xae09('0x2a')][_0x35a3db[_0xae09('0x12e')]],['idHopper',_0xae09('0x131')]),{'status':_0x35a3db[_0xae09('0xd9')],'paused':_0x35a3db[_0xae09('0x130')]}));}}}};function unlockQueueStatus(_0x5c4bc3,_0x15965c){setTimeout(function(){if(_[_0xae09('0x44')](_0x5c4bc3[_0xae09('0x132')])){loggerBooked['error'](_0xae09('0x133'),_0x15965c);}_0x5c4bc3[_0xae09('0x132')]=!![];loggerBooked[_0xae09('0x84')](_0xae09('0x134'),_0x15965c,JSON[_0xae09('0x135')](_[_0xae09('0xd1')](_0x5c4bc3,[_0xae09('0x45'),_0xae09('0x132')])));},0x1f3);}Dialer[_0xae09('0x20')][_0xae09('0x3e')]=function(_0x4d4709){var _0x4a4a05=this;var _0x27ca51=_0x4a4a05[_0xae09('0x24')][_0x4a4a05['actions'][_0x4d4709['actionid']][_0xae09('0xb5')]];if(strategy[this[_0xae09('0x24')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]]['queue']][_0xae09('0x53')]]===_0xae09('0x1f')){if(this['actions'][_0x4d4709[_0xae09('0x12e')]]&&this[_0xae09('0x2a')][_0x4d4709['actionid']]['stateinterface']){this['preview'][_0xae09('0x136')](this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0x137')],this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0x131')])['catch'](function(_0xb1e5a9){logger['error'](_0xae09('0x138'),util[_0xae09('0x9a')](_0xb1e5a9,{'showHidden':![],'depth':null}));})[_0xae09('0x22')](function(){_0x4a4a05[_0xae09('0xb4')](_0x4a4a05[_0xae09('0x24')][_0x4a4a05['actions'][_0x4d4709['actionid']][_0xae09('0xb5')]]);_0x4a4a05[_0xae09('0x26')][_0x4a4a05['actions'][_0x4d4709[_0xae09('0x12e')]][_0xae09('0x131')]][_0xae09('0x12f')]=![];delete _0x4a4a05['actions'][_0x4d4709[_0xae09('0x12e')]];unlockQueueStatus(_0x27ca51);});}else{this[_0xae09('0xb4')](this[_0xae09('0x24')][this[_0xae09('0x2a')][_0x4d4709['actionid']][_0xae09('0xb5')]]);this[_0xae09('0xc0')]({'active':![],'ContactId':this['actions'][_0x4d4709[_0xae09('0x12e')]][_0xae09('0x107')],'ListId':this['actions'][_0x4d4709[_0xae09('0x12e')]][_0xae09('0x100')],'VoiceQueueId':this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xd3')]||undefined,'CampaignId':this['actions'][_0x4d4709['actionid']][_0xae09('0xd4')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x4d4709['actionid']];unlockQueueStatus(_0x27ca51);}}else if((strategy[this[_0xae09('0x24')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]][_0xae09('0x53')]]||_0xae09('0x1e'))===_0xae09('0x1e')){var _0x12c6c9;if(this['actions'][_0x4d4709[_0xae09('0x12e')]]&&!_[_0xae09('0x4c')](this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]])){if(this['queueBookedRR'][_0x4a4a05[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]]['queue']]){this[_0xae09('0x139')][_0x4a4a05[_0xae09('0x2a')][_0x4d4709['actionid']][_0xae09('0xb5')]]=this['queueBookedRR'][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]]?this[_0xae09('0x139')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]]:this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]]?this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x4d4709['actionid']][_0xae09('0xb5')]][_0xae09('0x13a')]||0x0:0x0;}this[_0xae09('0x2e')][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]][_0xae09('0xb5')]]['_rr']=this['queueBookedRR'][this[_0xae09('0x2a')][_0x4d4709[_0xae09('0x12e')]]['queue']];for(var _0x240a05=0x0;_0x240a05=0x0;})[_0xae09('0xb2')](myreject(_0x555def)));}}else{_0x108654[_0xae09('0x153')](ami[_0xae09('0xb0')]({'action':_0xae09('0x154'),'command':util['format'](_0xae09('0x155'),_0x594002,!_[_0xae09('0x44')](config[_0xae09('0x157')][_0x19f4e9])?_0x19f4e9:'')})['then'](function(_0xe4bacf){return _0xe4bacf['content'][_0xae09('0x158')](_0xae09('0x159'))>=0x0;})[_0xae09('0xb2')](myreject(_0x555def)));}BPromise[_0xae09('0x15a')](_0x108654)[_0xae09('0x42')](function(_0xecadd2){var _0x1500d6=_[_0xae09('0x15b')](_0xecadd2);if(_0x1500d6){return _0x41efdb(_0x1500d6);}else{_0x49dde1['message']=_0x11d52e?_0xae09('0x15c'):'INTERVAL_IS_OVERTIME';return _0x555def(msgResponse(_0xae09('0x15d'),_0xae09('0x14d'),_0xae09('0x15e')+_0x11d52e+'\x20'+_0xc46e26+'\x20Interval\x20is\x20overtime:\x20'+util[_0xae09('0x9a')](_0x594002,{'showHidden':![],'depth':null})+_0xae09('0x15f')+_0x19f4e9));}})[_0xae09('0xb2')](function(_0x112ae7){return _0x555def(msgResponse(_0xae09('0x14a'),_0xae09('0x14d'),JSON['stringify'](_0x112ae7)));});});};Dialer[_0xae09('0x20')][_0xae09('0x160')]=function(_0x2d5cb8){var _0x232930=this;return function(){switch(_0x2d5cb8[_0xae09('0x61')]){case _0xae09('0x161'):freeVariablesPredictive(_0x2d5cb8);_0x232930[_0xae09('0x162')](_0x2d5cb8,0x1);break;case _0xae09('0x163'):freeVariablesPredictive(_0x2d5cb8);_0x232930[_0xae09('0x162')](_0x2d5cb8,_0x2d5cb8[_0xae09('0x164')]);break;case'predictive':_0x232930[_0xae09('0xb')](_0x2d5cb8);break;case _0xae09('0xa'):freeVariablesPredictive(_0x2d5cb8);_0x232930[_0xae09('0x162')](_0x2d5cb8,0x1);break;default:freeVariablesPredictive(_0x2d5cb8);logger[_0xae09('0x98')](_0xae09('0x165'),_0x2d5cb8[_0xae09('0x45')],_0xae09('0x166'));}};};Dialer['prototype'][_0xae09('0x167')]=function(_0x2158df){return BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](cmHopper[_0xae09('0x168')](_0x2158df['id'],previewRecallmeReminderInterval))['then'](function(_0x398dcb){for(var _0x339a49=0x0;_0x339a49<_0x398dcb[_0xae09('0x9b')];_0x339a49++){var _0xb7e20c=_0x398dcb[_0x339a49][_0xae09('0x169')][_0xae09('0x45')];if(_0xb7e20c)io['to'](util[_0xae09('0x7e')](_0xae09('0x16a'),_0xb7e20c))[_0xae09('0x51')]('user:dialPreviewRecallReminder',{'hopper':_0x398dcb[_0x339a49]});}})[_0xae09('0xb2')](function(_0x2ebced){});};Dialer['prototype'][_0xae09('0x16b')]=function(_0x4b0e65){var _0x13c526=this;return function(){_0x13c526['handleIvr'](_0x4b0e65);};};Dialer[_0xae09('0x20')][_0xae09('0xd')]=function(_0x3b0338){var _0x38a480=this;if(isNotPreview(_0x3b0338[_0xae09('0x61')])){if(isVoiceQueueOutbound(_0x3b0338[_0xae09('0x52')])&&isActive(_0x3b0338[_0xae09('0x60')])){_0x3b0338['sendMessageOneNotActive']=!![];BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](checkIsLoggedIn(_0x3b0338,_0x3b0338[_0xae09('0x56')]))[_0xae09('0x42')](checkIsActive(_0x3b0338,_0x3b0338[_0xae09('0x60')]))[_0xae09('0x42')](checkInterval(_0x3b0338))['then'](_0x38a480[_0xae09('0x145')](_0x3b0338))[_0xae09('0x42')](_0x38a480[_0xae09('0x149')](_0x3b0338[_0xae09('0x16c')],_0x3b0338[_0xae09('0x16d')],_0x3b0338[_0xae09('0x45')],_0x3b0338))['then'](_0x38a480[_0xae09('0x14b')](_0x3b0338['Interval'],_0x3b0338[_0xae09('0x16d')],_0x3b0338[_0xae09('0x45')],_0x3b0338))[_0xae09('0x42')](_0x38a480[_0xae09('0x160')](_0x3b0338))[_0xae09('0xb2')](loggerCatchQueueSummary(_0xae09('0x16e'),_0x3b0338));}else{notSendMessagesQueue(_0x3b0338);}}else{freeVariablesPredictive(_0x3b0338);if(_0x3b0338[_0xae09('0x16f')]){_0x38a480[_0xae09('0x167')](_0x3b0338);}}};Dialer[_0xae09('0x20')][_0xae09('0x144')]=function(){var _0x9b27a2=this;var _0x54e985;for(var _0x63c364 in this[_0xae09('0x25')]){if(typeof this[_0xae09('0x25')][_0x63c364]!==_0xae09('0x9c')){_0x54e985=this[_0xae09('0x25')][_0x63c364];if(isCampaignIvr(_0x54e985[_0xae09('0x52')])&&isActive(_0x54e985[_0xae09('0x7c')])){_0x54e985[_0xae09('0xa3')]=!![];BPromise[_0xae09('0xb8')]()[_0xae09('0x42')](checkIsActive(_0x54e985,_0x54e985[_0xae09('0x7c')]))[_0xae09('0x42')](checkInterval(_0x54e985))['then'](_0x9b27a2[_0xae09('0x145')](_0x54e985))['then'](_0x9b27a2['checkIfTime'](_0x54e985['dialGlobalInterval'],_0x54e985[_0xae09('0x16d')],_0x54e985['name'],_0x54e985))[_0xae09('0x42')](_0x9b27a2['checkIfTimeIntervals'](_0x54e985[_0xae09('0x4b')],_0x54e985[_0xae09('0x16d')],_0x54e985[_0xae09('0x45')],_0x54e985))[_0xae09('0x42')](_0x9b27a2[_0xae09('0x16b')](_0x54e985))[_0xae09('0xb2')](loggerCatchQueueSummary(_0xae09('0x170'),_0x54e985));}else{notSendMessagesCampaign(_0x54e985);}}}};function getCallerIdRandom(_0x5db9b4,_0x92dd65){var _0x18c018;var _0x3acca0;var _0x616461;if(_0x92dd65<=0x0){_0x92dd65=0x1;}_0x18c018=new RegExp(_0xae09('0x171')+_0x92dd65+'}$');_0x3acca0=Math[_0xae09('0x172')](0xa,_0x92dd65-0x1);_0x616461=Math['pow'](0xa,_0x92dd65)-0x1;return util[_0xae09('0x7e')]('%s',_[_0xae09('0x173')](_0x5db9b4,_0x18c018,_[_0xae09('0x174')](_0x3acca0,_0x616461)));}function extractCalleridName(_0x5a7c21){var _0x60c3b1=_0x5a7c21[_0xae09('0x175')](/"(.*?)"/);return _0x60c3b1?_0x60c3b1[0x1]:_0x5a7c21;}function extractCalleridNumber(_0x4828ee){var _0x50a3d9=_0x4828ee['match'](/<(.*?)>/);return _0x50a3d9?_0x50a3d9[0x1]:_0x4828ee;}Dialer[_0xae09('0x20')][_0xae09('0x176')]=function(_0x5b5caa,_0x2dcdbc){var _0x2f0f66=this;var _0x2aa13a=uuid['v4']();this[_0xae09('0x2a')][_0x2aa13a]=new Action(_0x5b5caa,_0x2dcdbc,_0x2aa13a);return new BPromise(function(_0x2cf57c,_0x434d8a){if(_['isUndefined'](_0x5b5caa)&&typeof _0x5b5caa!=='object'){return _0x434d8a(msgResponse(_0xae09('0x177'),_0xae09('0x14d'),'voiceQueue\x20is\x20undefine'));}if(_[_0xae09('0x44')](_0x2dcdbc[_0xae09('0x178')]['phone'])||_0x2dcdbc[_0xae09('0x178')][_0xae09('0x179')]===null){return _0x434d8a(msgResponse(_0xae09('0x177'),_0xae09('0x14d'),_0xae09('0x17a')));}var _0x259905={'XMD-CALLERID':_0x2f0f66[_0xae09('0x2a')][_0x2aa13a]['getCaller'](),'XMD-AGI':_0x5b5caa[_0xae09('0x10a')]?util[_0xae09('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5b5caa[_0xae09('0x10a')]):_0xae09('0x17b'),'XMD-AGIAFTER':_0x5b5caa['dialQueueProject2']?util['format'](_0xae09('0x17c'),ipAgi,_0x5b5caa[_0xae09('0x114')]):_0xae09('0x17b'),'XMD-QUEUE':_0x5b5caa['type']===_0xae09('0x94')?util[_0xae09('0x7e')](_0xae09('0x17d'),_0x5b5caa[_0xae09('0x45')],_0x5b5caa['dialQueueOptions']||'',_0x5b5caa[_0xae09('0x115')]?'c':'',_0x5b5caa[_0xae09('0x11d')]||0x3):_0xae09('0x17b'),'XMD-CONTACTID':_0x2dcdbc[_0xae09('0x107')],'XMD-CDRTYPE':_0xae09('0x9'),'CALLERID(all)':_0x2f0f66[_0xae09('0x2a')][_0x2aa13a][_0xae09('0x17e')](),'XMD-AMD':_0x5b5caa[_0xae09('0xe3')]?'ACTIVE':_0xae09('0x17b'),'XMD-DESTINATION':_0xae09('0xe2')};if(_0x5b5caa[_0xae09('0xe3')]){_0x259905['XMD-AMDINITIALSILENCE']=_0x5b5caa['dialAMDInitialSilence']||0x9c4;_0x259905[_0xae09('0x17f')]=_0x5b5caa[_0xae09('0x180')]||0x5dc;_0x259905[_0xae09('0x181')]=_0x5b5caa['dialAMDAfterGreetingSilence']||0x320;_0x259905['XMD-AMDTOTALANALYSISTIME']=_0x5b5caa['dialAMDTotalAnalysisTime']||0x1388;_0x259905['XMD-AMDMINWORDLENGTH']=_0x5b5caa[_0xae09('0x182')]||0x64;_0x259905[_0xae09('0x183')]=_0x5b5caa[_0xae09('0x184')]||0x32;_0x259905[_0xae09('0x185')]=_0x5b5caa['dialAMDMaximumNumberOfWords']||0x3;_0x259905[_0xae09('0x186')]=_0x5b5caa['dialAMDSilenceThreshold']||0x100;_0x259905[_0xae09('0x187')]=_0x5b5caa[_0xae09('0x188')]||0x1388;}if(_0x5b5caa[_0xae09('0x52')]===_0xae09('0x94')){_0x259905['XMD-VOICEQUEUEID']=_0x2dcdbc['VoiceQueueId'];}else{_0x259905[_0xae09('0x189')]=_0x2dcdbc[_0xae09('0xd4')];}for(var _0x5e108a in _0x2dcdbc[_0xae09('0x178')]){if(typeof _0x2dcdbc['Contact'][_0x5e108a]!=='undefined'){if(isNotNull(_0x2dcdbc[_0xae09('0x178')][_0x5e108a])&&_0x5e108a!=='id'&&_0x5e108a!==_0xae09('0x18a')&&_0x5e108a!==_0xae09('0x18b')&&_0x5e108a!==_0xae09('0x18c')){_0x259905[util[_0xae09('0x7e')](_0xae09('0x18d'),_0xae09('0x18e'),_['toUpper'](_0x5e108a))]=_0x2dcdbc[_0xae09('0x178')][_0x5e108a];}}}var _0x4d9b2a=_0x2f0f66[_0xae09('0xd7')](_0x5b5caa[_0xae09('0x7b')])?getCallerId(_0x5b5caa[_0xae09('0x7b')]['callerid'],_0x5b5caa[_0xae09('0x62')],_0x5b5caa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5b5caa[_0xae09('0x63')],_0x5b5caa[_0xae09('0x18f')]):_0x5b5caa[_0xae09('0x63')]):getCallerId(_[_0xae09('0xde')](_0x5b5caa[_0xae09('0x146')])?_0x5b5caa[_0xae09('0x7b')][_0xae09('0x7d')]:_0x5b5caa[_0xae09('0x146')][_0xae09('0x7d')],_0x5b5caa[_0xae09('0x62')],_0x5b5caa[_0xae09('0x18f')]>0x0?getCallerIdRandom(_0x5b5caa[_0xae09('0x63')],_0x5b5caa['dialRandomLastDigitCallerIdNumber']):_0x5b5caa['dialOriginateCallerIdNumber']);if(_0x4d9b2a){_0x259905[_0xae09('0x190')]=_0x2f0f66[_0xae09('0x2a')][_0x2aa13a][_0xae09('0x191')]=extractCalleridName(_0x4d9b2a);_0x259905[_0xae09('0x192')]=_0x2f0f66['actions'][_0x2aa13a][_0xae09('0x193')]=extractCalleridNumber(_0x4d9b2a);}return ami['Action']({'actionid':_0x2aa13a,'action':_0xae09('0x177'),'channel':_0x2f0f66['isTrunkReachable'](_0x5b5caa[_0xae09('0x7b')])?util[_0xae09('0x7e')](_0xae09('0x194'),_0x5b5caa[_0xae09('0x7b')]['name'],isNotNull(_0x5b5caa[_0xae09('0x64')])?_0x5b5caa['dialPrefix'][_0xae09('0x195')]()||'':'',_0x5b5caa[_0xae09('0x196')]>0x0?_0x2dcdbc[_0xae09('0x178')][_0xae09('0x179')][_0xae09('0x197')](_0x5b5caa['dialCutDigit']):_0x2dcdbc[_0xae09('0x178')][_0xae09('0x179')]):util[_0xae09('0x7e')](_0xae09('0x194'),_[_0xae09('0xde')](_0x5b5caa['TrunkBackup'])?_0x5b5caa['Trunk']['name']:_0x5b5caa[_0xae09('0x146')][_0xae09('0x45')],isNotNull(_0x5b5caa['dialPrefix'])?_0x5b5caa[_0xae09('0x64')]['trim']()||'':'',_0x5b5caa[_0xae09('0x196')]>0x0?_0x2dcdbc[_0xae09('0x178')][_0xae09('0x179')][_0xae09('0x197')](_0x5b5caa[_0xae09('0x196')]):_0x2dcdbc[_0xae09('0x178')]['phone']),'callerid':_0x4d9b2a,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x259905,'timeout':(_0x5b5caa[_0xae09('0x198')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2aa13a})[_0xae09('0x42')](function(_0x251280){return _0x2cf57c(_0x251280);})['catch'](function(_0x538a16){_0x5b5caa['outboundOriginateFailureCallsDay']+=0x1;var _0x4ca4d9=new History(_0x2f0f66['actions'][_0x2aa13a]);logger[_0xae09('0x98')](util['format'](_0xae09('0x199'),JSON[_0xae09('0x135')](_0x538a16)));_0x4ca4d9[_0xae09('0xa9')]=0xe;_0x4ca4d9[_0xae09('0xe6')]=_0xae09('0x19a');_0x4ca4d9[_0xae09('0xab')]=moment()[_0xae09('0x7e')](_0xae09('0xff'));_0x4ca4d9[_0xae09('0xaa')]=_0x4ca4d9[_0xae09('0xab')];_0x2f0f66[_0xae09('0xca')](_0x4ca4d9)[_0xae09('0xb2')](loggerCatch(_0xae09('0x19b')));_0x2f0f66[_0xae09('0xc9')](_0x4ca4d9)[_0xae09('0xb2')](loggerCatch('[originate][error]'))[_0xae09('0x22')](function(){delete _0x2f0f66['actions'][_0x2aa13a];return _0x434d8a(msgResponse(_0xae09('0x177'),_0xae09('0x4e'),_0xae09('0x19c')));});});});};Dialer[_0xae09('0x20')][_0xae09('0x34')]=function(_0x256dfa){var _0x59a58c=this[_0xae09('0x2a')][_0x256dfa[_0xae09('0x12e')]];if(_0x59a58c){delete this[_0xae09('0x2a')][_0x256dfa[_0xae09('0x12e')]];_0x59a58c[_0xae09('0x11c')]=moment()[_0xae09('0x7e')](_0xae09('0xff'));var _0x5622b8=_0x59a58c[_0xae09('0x52')]===_0xae09('0x81')?this[_0xae09('0x25')][_0x59a58c[_0xae09('0xb5')]]:this[_0xae09('0x24')][_0x59a58c[_0xae09('0x19d')]()];if(!this[_0xae09('0xd5')](_0x256dfa[_0xae09('0x19e')])){this[_0xae09('0xb4')](_0x5622b8);return this['callProgressDetecting'](_0x59a58c,_0x5622b8,_0x256dfa)[_0xae09('0xb2')](loggerCatch(_0xae09('0x19f')));}this[_0xae09('0x2b')][_0x256dfa['uniqueid']]=_0x59a58c;}};Dialer['prototype']['checkRetriveMax']=function(_0x2f6bdc,_0x221c9c,_0x381ab8){var _0x4046b8=new History(_0x221c9c);if(_0x4046b8['countbusyretry']+_0x4046b8[_0xae09('0xf3')]+_0x4046b8['countnoanswerretry']+_0x4046b8[_0xae09('0xf5')]+_0x4046b8[_0xae09('0xf6')]+_0x4046b8[_0xae09('0x106')]+_0x4046b8[_0xae09('0xf0')]+_0x4046b8[_0xae09('0xf7')]>=_0x381ab8['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2f6bdc){case 0x3:if(_0x4046b8[_0xae09('0xf4')]>=_0x381ab8[_0xae09('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4046b8[_0xae09('0xf4')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8[_0xae09('0x1a1')],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8[_0xae09('0x100')],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8['CampaignId']||undefined})[_0xae09('0xb2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x4046b8[_0xae09('0x105')]>=_0x381ab8[_0xae09('0x1a2')]-0x1){return!![];}this[_0xae09('0xc0')]({'active':![],'countbusyretry':_0x4046b8[_0xae09('0x105')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8['dialBusyRetryFrequency'],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8['ListId'],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8[_0xae09('0xd4')]||undefined})['catch'](loggerCatch(_0xae09('0x1a3')));break;case 0x8:if(_0x4046b8[_0xae09('0xf3')]>=_0x381ab8[_0xae09('0x1a4')]-0x1){return!![];}this[_0xae09('0xc0')]({'active':![],'countcongestionretry':_0x4046b8[_0xae09('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x381ab8[_0xae09('0x1a5')],_0xae09('0x125'))['format'](_0xae09('0xff')),'ContactId':_0x4046b8['ContactId'],'ListId':_0x4046b8[_0xae09('0x100')],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8[_0xae09('0xd4')]||undefined})['catch'](loggerCatch(_0xae09('0x1a6')));break;case 0x0:if(_0x4046b8[_0xae09('0xf5')]>=_0x381ab8[_0xae09('0x1a7')]-0x1){return!![];}else{this[_0xae09('0xc0')]({'active':![],'countnosuchnumberretry':_0x4046b8[_0xae09('0xf5')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8[_0xae09('0x1a8')],'minutes')[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8[_0xae09('0x100')],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8[_0xae09('0xd4')]||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x1a9')));}break;case 0xa:if(_0x4046b8[_0xae09('0xf6')]>=_0x381ab8['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4046b8[_0xae09('0xf6')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8['dialDropRetryFrequency'],_0xae09('0x125'))['format'](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8[_0xae09('0x100')],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8['CampaignId']||undefined})[_0xae09('0xb2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4046b8[_0xae09('0x106')]>=_0x381ab8['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xae09('0xc0')]({'active':![],'countabandonedretry':_0x4046b8[_0xae09('0x106')]+=0x1,'scheduledat':moment()['add'](_0x381ab8[_0xae09('0x12b')],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8[_0xae09('0x100')],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8['CampaignId']||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x12c')));break;case 0x13:if(_0x4046b8[_0xae09('0xf0')]>=_0x381ab8[_0xae09('0xfb')]-0x1){return!![];}this[_0xae09('0xc0')]({'active':![],'countmachineretry':_0x4046b8[_0xae09('0xf0')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8[_0xae09('0x1aa')],_0xae09('0x125'))[_0xae09('0x7e')](_0xae09('0xff')),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8['ListId'],'VoiceQueueId':_0x4046b8['VoiceQueueId']||undefined,'CampaignId':_0x4046b8[_0xae09('0xd4')]||undefined})['catch'](loggerCatch(_0xae09('0x101')));break;case 0x14:if(_0x4046b8[_0xae09('0xf7')]>=_0x381ab8[_0xae09('0x1ab')]-0x1){return!![];}this[_0xae09('0xc0')]({'active':![],'countagentrejectretry':_0x4046b8[_0xae09('0xf7')]+=0x1,'scheduledat':moment()[_0xae09('0xfe')](_0x381ab8[_0xae09('0x1ac')],_0xae09('0x125'))[_0xae09('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4046b8[_0xae09('0x107')],'ListId':_0x4046b8['ListId'],'VoiceQueueId':_0x4046b8[_0xae09('0xd3')]||undefined,'CampaignId':_0x4046b8['CampaignId']||undefined})['catch'](loggerCatch(_0xae09('0x1ad')));break;default:return!![];}};Dialer['prototype'][_0xae09('0x1ae')]=function(_0x2334cd,_0x297547,_0x4d40fa){var _0x5b57ef=this;var _0x2fcde2=new History(_0x2334cd);return new BPromise(function(_0x5a3339,_0x4d1e24){if(_[_0xae09('0x44')](_0x297547)&&typeof _0x297547!==_0xae09('0x1af')){return _0x4d1e24(msgResponse(_0xae09('0x1b0'),_0xae09('0x14d'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4d40fa)&&typeof _0x4d40fa!==_0xae09('0x1af')){return _0x4d1e24(msgResponse(_0xae09('0x1b0'),_0xae09('0x14d'),_0xae09('0x1b1')));}switch(_0x4d40fa[_0xae09('0x111')]){case'0':_0x297547[_0xae09('0x69')]+=0x1;_0x2fcde2[_0xae09('0xa9')]=0x0;_0x2fcde2[_0xae09('0xe6')]='NoSuchNumber';_0x2fcde2['countnosuchnumberretry']+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;ami[_0xae09('0x51')](_0xae09('0x1b2'),ut[_0xae09('0xea')](_0x2334cd,'nosuchnumber'));_0x5b57ef['createHistory'](_0x2fcde2)[_0xae09('0xb2')](loggerCatch(_0xae09('0xf2')));if(_0x5b57ef[_0xae09('0x1b3')](0x0,_0x2334cd,_0x297547)){if(_0x2fcde2[_0xae09('0xf5')]>=_0x297547[_0xae09('0x1a7')]){_0x5b57ef['createStateFinal'](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1b4'));}else{_0x5b57ef['stateGlobal'](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1b4'));}}break;case'3':_0x297547[_0xae09('0x1b5')]+=0x1;_0x2fcde2[_0xae09('0xa9')]=0x3;_0x2fcde2[_0xae09('0xe6')]=_0xae09('0x1b6');_0x2fcde2[_0xae09('0xf4')]+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;ami[_0xae09('0x51')](_0xae09('0x1b7'),ut[_0xae09('0xea')](_0x2334cd,_0xae09('0x1b8')));_0x5b57ef['createHistory'](_0x2fcde2)[_0xae09('0xb2')](loggerCatch(_0xae09('0x1b9')));if(_0x5b57ef['checkRetriveMax'](0x3,_0x2334cd,_0x297547)){if(_0x2fcde2['countnoanswerretry']>=_0x297547[_0xae09('0x1a0')]){_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1ba'));}else{_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1ba'));}}break;case'5':_0x297547[_0xae09('0x1bb')]+=0x1;_0x2fcde2['state']=0x5;_0x2fcde2[_0xae09('0xe6')]='Busy';_0x2fcde2[_0xae09('0x105')]+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;ami[_0xae09('0x51')](_0xae09('0x1bc'),ut[_0xae09('0xea')](_0x2334cd,_0xae09('0x1bd')));_0x5b57ef[_0xae09('0xca')](_0x2fcde2)['catch'](loggerCatch(_0xae09('0x1be')));if(_0x5b57ef[_0xae09('0x1b3')](0x5,_0x2334cd,_0x297547)){if(_0x2fcde2['countbusyretry']>=_0x297547[_0xae09('0x1a2')]){_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,'reason\x205\x20busy');}else{_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1bf'));}}break;case'8':_0x297547['outboundCongestionCallsDay']+=0x1;_0x2fcde2[_0xae09('0xa9')]=0x8;_0x2fcde2['statedesc']=_0xae09('0x1c0');_0x2fcde2[_0xae09('0xf3')]+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;ami[_0xae09('0x51')]('custom:agentcongestion',ut[_0xae09('0xea')](_0x2334cd,_0xae09('0x1c1')));_0x5b57ef['createHistory'](_0x2fcde2)['catch'](loggerCatch(_0xae09('0x1c2')));if(_0x5b57ef[_0xae09('0x1b3')](0x8,_0x2334cd,_0x297547)){if(_0x2fcde2[_0xae09('0xf3')]>=_0x297547[_0xae09('0x1a4')]){_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1c3'));}else{_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,'reason\x208\x20congestion');}}break;case'11':_0x297547[_0xae09('0x1c4')]+=0x1;_0x2fcde2[_0xae09('0xa9')]=0xb;_0x2fcde2[_0xae09('0xe6')]=_0xae09('0x128');_0x2fcde2['countabandonedretry']+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;_0x5b57ef[_0xae09('0xca')](_0x2fcde2)[_0xae09('0xb2')](loggerCatch(_0xae09('0x12d')));if(_0x5b57ef['checkRetriveMax'](0xb,_0x2334cd,_0x297547)){if(_0x2fcde2[_0xae09('0x106')]>=_0x297547[_0xae09('0x12a')]){_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1c5'));}else{_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1c5'));}}break;case'20':_0x297547[_0xae09('0x6c')]+=0x1;_0x2fcde2[_0xae09('0xa9')]=0x14;_0x2fcde2[_0xae09('0xe6')]='AgentReject';_0x2fcde2[_0xae09('0xf7')]+=0x1;_0x2fcde2[_0xae09('0x122')]+=0x1;ami[_0xae09('0x51')]('custom:agentreject',ut['buildObj'](_0x2334cd,_0xae09('0x1c6')));_0x5b57ef[_0xae09('0xca')](_0x2fcde2)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5b57ef[_0xae09('0x1b3')](0x14,_0x2334cd,_0x297547)){if(_0x2fcde2[_0xae09('0xf7')]>=_0x297547[_0xae09('0x1ab')]){_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1c7'));}else{_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0xae09('0x1c7'));}}break;default:_0x297547[_0xae09('0x10d')]+=0x1;_0x2fcde2[_0xae09('0xa9')]=0xc;_0x2fcde2[_0xae09('0xe6')]=_0x4d40fa[_0xae09('0x111')];_0x5b57ef['createHistory'](_0x2fcde2)[_0xae09('0xb2')](loggerCatch(_0xae09('0x1c8')));if(_0x5b57ef[_0xae09('0x1b3')](_0x4d40fa[_0xae09('0x111')],_0x2334cd,_0x297547)){if(_0x2fcde2[_0xae09('0x105')]+_0x2fcde2['countcongestionretry']+_0x2fcde2['countnoanswerretry']+_0x2fcde2['countnosuchnumberretry']+_0x2fcde2[_0xae09('0xf6')]+_0x2fcde2[_0xae09('0x106')]+_0x2fcde2['countmachineretry']+_0x2fcde2[_0xae09('0xf7')]>=_0x297547[_0xae09('0xf8')]){_0x5b57ef[_0xae09('0xf9')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0x4d40fa[_0xae09('0x111')]);}else{_0x5b57ef[_0xae09('0xfc')](_0x2fcde2,_0x5a3339,_0x4d1e24,_0x4d40fa['reason']);}}}});};Dialer[_0xae09('0x20')][_0xae09('0xf9')]=function(_0x48cad1,_0x44cb2,_0x1a07f7,_0x5c0275){var _0x20d78e=new Final(_0x48cad1);_0x20d78e[_0xae09('0xa9')]=0xf;_0x20d78e[_0xae09('0xe6')]='Global';this[_0xae09('0xfc')](_0x20d78e,_0x44cb2,_0x1a07f7,_0x5c0275);};Dialer[_0xae09('0x20')][_0xae09('0xfc')]=function(_0x2ec628,_0x5b060b,_0x48a7d7,_0x22dfc4){this[_0xae09('0xc9')](_0x2ec628)[_0xae09('0x42')](function(){return _0x5b060b(msgResponse(_0xae09('0x1b0'),_0xae09('0xd6'),_0x22dfc4));})['catch'](function(){return _0x48a7d7(msgResponse(_0xae09('0x1c9'),'Failure',_0xae09('0x1ca')));});};Dialer[_0xae09('0x20')]['predictive']=function(_0x52cd56){var _0x555e84=_0x52cd56['dialPredictiveOptimizationPercentage']/0x64;var _0x3482f7=_0x52cd56[_0xae09('0x68')]/(_0x52cd56[_0xae09('0x68')]+_0x52cd56['outboundAnswerCallsDay']);var _0xb70524=Math['round'](_0x52cd56[_0xae09('0x72')]*(_0x52cd56[_0xae09('0x1cb')]/0x64));var _0x850167=Math[_0xae09('0x1cc')](_0x52cd56[_0xae09('0x72')]*(_0x52cd56[_0xae09('0x1cd')]/0x64));var _0x2ed16a=_0x52cd56[_0xae09('0x55')]+_0x52cd56[_0xae09('0x5a')];var _0x3d2657=Math['floor'](_0x52cd56['erlangCalls']*_0x52cd56[_0xae09('0x77')]*_0x52cd56[_0xae09('0x70')]*_0x52cd56[_0xae09('0x71')]);if(_[_0xae09('0x44')](_0x52cd56[_0xae09('0x7a')])){if(!_['isUndefined'](_0x52cd56[_0xae09('0x79')])){_0x52cd56[_0xae09('0x79')]=undefined;loggerPredictive[_0xae09('0x98')](_0xae09('0x1ce'),_0xae09('0x1cf'));}if(!_[_0xae09('0x44')](_0x52cd56['handlePredictive'])){loggerPredictive[_0xae09('0x98')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x52cd56[_0xae09('0x92')]);_0x52cd56[_0xae09('0x92')]=undefined;}_0x52cd56['startProgressive']=moment()[_0xae09('0x7e')](_0xae09('0xff'));loggerPredictive[_0xae09('0x84')](_0x52cd56[_0xae09('0x45')],_0xae09('0x1d0'),_0x52cd56['startProgressive']);this[_0xae09('0x162')](_0x52cd56,0x1);}else if(ifInterval(_0x52cd56[_0xae09('0x1d1')],_0x52cd56[_0xae09('0x7a')])){this[_0xae09('0x162')](_0x52cd56,0x1);loggerPredictiveCalls[_0xae09('0x84')](_0xae09('0x1d2'),_0x52cd56['startProgressive'],_0x52cd56[_0xae09('0x45')]);_0x52cd56[_0xae09('0x75')]=0x0;_0x52cd56['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x555e84<_0x3482f7&&_0x52cd56[_0xae09('0x1d3')]===_0xae09('0x1d4')){freeVariablesPredictive(_0x52cd56);loggerPredictive[_0xae09('0x84')](_0xae09('0x1d5'),_0xae09('0x1d6'),_0x3482f7,_0xae09('0x7a'),_0x52cd56['name']);}else if(_0x3d2657<_0x52cd56[_0xae09('0x6f')]&&_0x52cd56[_0xae09('0x1d3')]===_0xae09('0x1d4')){freeVariablesPredictive(_0x52cd56);loggerPredictive[_0xae09('0x84')](_0xae09('0x1d7'),'Max\x20Drop\x20',_0x3d2657,'Drop\x20in\x20this\x20interval',_0x52cd56['predictiveIntervalErlangCallsDroppedCalls'],_0xae09('0x7a'),_0x52cd56[_0xae09('0x45')]);}else if(!ifInterval(_0x52cd56[_0xae09('0x1d1')],_0x52cd56[_0xae09('0x7a')])&&_[_0xae09('0x44')](_0x52cd56['startPredictive'])&&!_[_0xae09('0x44')](_0x52cd56[_0xae09('0x7a')])){_0x52cd56['startPredictive']=moment()[_0xae09('0x7e')](_0xae09('0xff'));loggerPredictive['info'](_0x52cd56[_0xae09('0x45')],_0xae09('0x1d8'),_0x52cd56[_0xae09('0x79')]);this[_0xae09('0x1d9')](_0x52cd56[_0xae09('0x1d1')])['then'](this[_0xae09('0x1da')](_0x52cd56))[_0xae09('0x42')](mergeDataErlangB(_0x52cd56))[_0xae09('0x42')](this[_0xae09('0x1db')](_0x52cd56))[_0xae09('0xb2')](loggerCatchPredictive(_0xae09('0x1dc'),_0x52cd56));}else if(!ifInterval(_0x52cd56[_0xae09('0x1d1')],_0x52cd56[_0xae09('0x79')])){_0x52cd56['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x52cd56['startPredictive']=moment()[_0xae09('0x7e')](_0xae09('0xff'));loggerPredictive[_0xae09('0x84')](_0x52cd56[_0xae09('0x45')],_0xae09('0x1dd'),_0x52cd56['startPredictive']);clearInterval(_0x52cd56[_0xae09('0x92')]);_0x52cd56[_0xae09('0x92')]=undefined;this['averageHandleTime'](_0x52cd56[_0xae09('0x1d1')])['then'](this[_0xae09('0x1da')](_0x52cd56))[_0xae09('0x42')](mergeDataErlangB(_0x52cd56))[_0xae09('0x42')](this[_0xae09('0x1db')](_0x52cd56))[_0xae09('0xb2')](loggerCatchPredictive(_0xae09('0x1de'),_0x52cd56));}else if(_0x52cd56[_0xae09('0x72')]&&_0x2ed16a<_0x52cd56['predictiveIntervalAvailable']-_0x850167){freeVariablesPredictive(_0x52cd56);loggerPredictive[_0xae09('0x84')](_0x52cd56[_0xae09('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2ed16a,_0xae09('0x1df'),_0x52cd56[_0xae09('0x72')],'-',_0x850167,'=',_0x52cd56[_0xae09('0x72')]-_0x850167,')');}else if(_0x52cd56[_0xae09('0x72')]&&_0x2ed16a>_0x52cd56[_0xae09('0x72')]+_0xb70524){freeVariablesPredictive(_0x52cd56);loggerPredictive[_0xae09('0x84')](_0x52cd56[_0xae09('0x45')],_0xae09('0x1e0'),_0x2ed16a,_0xae09('0x1e1'),_0x52cd56[_0xae09('0x72')],'+',_0xb70524,'=',_0x52cd56[_0xae09('0x72')]+_0xb70524,')');}};Dialer[_0xae09('0x20')][_0xae09('0x1da')]=function(_0x233e10){var _0xe8a2b4=this;return function(_0x497755){return new BPromise(function(_0x311cb9,_0x3bcf2d){_[_0xae09('0xd0')](_0x233e10,_0x497755[0x0]);if(checkGetDataPredictive(_0x497755[0x0])){var _0x221847=_0x233e10['predictiveIntervalAvailable']=_0x233e10[_0xae09('0x5a')]+_0x233e10[_0xae09('0x55')];var _0x58059f=_0x233e10[_0xae09('0x1d1')]*0x3c;var _0x215b86=_0x497755[0x0][_0xae09('0x6d')]+_0x497755[0x0][_0xae09('0x88')];var _0x247c68=(_0x497755[0x0]['predictiveIntervalAnsweredCalls']+_0x497755[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x497755[0x0][_0xae09('0x6e')])/_0x497755[0x0][_0xae09('0x73')];_0x233e10[_0xae09('0x70')]=_0x247c68>0x0?_0x247c68:0x1;switch(_0x233e10[_0xae09('0x1d3')]){case _0xae09('0x1d4'):var _0x56a826=_0x233e10[_0xae09('0x1e2')]/0x64;return _0xe8a2b4[_0xae09('0x1e3')](_0x221847,_0x58059f,_0x215b86,_0x247c68,_0x56a826)[_0xae09('0x42')](function(_0x1a0c9d){return _0x311cb9(_0x1a0c9d);});case _0xae09('0x1e4'):var _0x19c64c=_0x233e10[_0xae09('0x1e2')]/0x64;return _0xe8a2b4[_0xae09('0x1e5')](_0x221847,_0x58059f,_0x215b86,_0x247c68,_0x19c64c)[_0xae09('0x42')](function(_0x4a7081){return _0x311cb9(_0x4a7081);});default:return _0x3bcf2d(msgResponse(_0xae09('0x1e6'),_0xae09('0x14d'),'Unknown\x20Predictive'));}}else{return _0x3bcf2d(msgResponse(_0xae09('0x1e6'),_0xae09('0x14d'),_0xae09('0x1e7')));}});};};Dialer[_0xae09('0x20')][_0xae09('0x1e8')]=function(_0x34774f){var _0x5a9614=this;return function(_0x4e5ab7){return new BPromise(function(_0x4569b7,_0x3e22ed){_[_0xae09('0xd0')](_0x34774f,_0x4e5ab7[0x0]);if(checkGetDataPredictive(_0x4e5ab7[0x0])){loggerPredictive['info'](JSON[_0xae09('0x135')](_0x4e5ab7[0x0]));if(_0x34774f[_0xae09('0x1d3')]===_0xae09('0x1d4')){return _0x5a9614['getVoiceQueueRtPauses'](_0x34774f['id'])[_0xae09('0x42')](function(_0x1a5188){var _0x410a51=_0x34774f['loggedIn']-_0x1a5188[0x0][_0xae09('0x1e9')];var _0x5646e8=_0x34774f[_0xae09('0x1d1')]*0x3c;var _0x1ce349=_0x4e5ab7[0x0]['predictiveIntervalAvgTalktime']+_0x4e5ab7[0x0][_0xae09('0x88')];var _0x4cfd8f=(_0x4e5ab7[0x0][_0xae09('0x85')]+_0x4e5ab7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4e5ab7[0x0][_0xae09('0x6e')])/_0x4e5ab7[0x0][_0xae09('0x73')];var _0x237e83=_0x34774f[_0xae09('0x1e2')]/0x64;_0x34774f[_0xae09('0x1ea')]=_0x1a5188[0x0]['outboundQueuePauses']||0x0;_0x34774f[_0xae09('0x70')]=_0x4cfd8f>0x0?_0x4cfd8f:0x1;return _0x5a9614[_0xae09('0x1e3')](_0x410a51,_0x5646e8,_0x1ce349,_0x4cfd8f,_0x237e83);})[_0xae09('0x42')](function(_0x1c8ee4){return _0x4569b7(_0x1c8ee4);})[_0xae09('0xb2')](function(_0x133408){return _0x3e22ed(msgResponse(_0xae09('0x1eb'),_0xae09('0x14d'),JSON[_0xae09('0x135')](_0x133408)));});}if(_0x34774f[_0xae09('0x1d3')]===_0xae09('0x1e4')){return _0x5a9614[_0xae09('0x1ec')](_0x34774f['id'])['then'](function(_0x27ccd7){var _0x15d645=_0x34774f[_0xae09('0x56')]-_0x27ccd7[0x0][_0xae09('0x1e9')];var _0x242d4f=_0x34774f[_0xae09('0x1d1')]*0x3c;var _0x491281=_0x4e5ab7[0x0]['predictiveIntervalAvgTalktime']+_0x4e5ab7[0x0][_0xae09('0x88')];var _0x439692=(_0x4e5ab7[0x0]['predictiveIntervalAnsweredCalls']+_0x4e5ab7[0x0][_0xae09('0x11e')]+_0x4e5ab7[0x0][_0xae09('0x6e')])/_0x4e5ab7[0x0][_0xae09('0x73')];var _0x3cf7b2=_0x34774f['dialPredictiveOptimizationPercentage']/0x64;_0x34774f['predictiveIntervalPauses']=_0x27ccd7[0x0][_0xae09('0x1e9')]||0x0;_0x34774f[_0xae09('0x70')]=_0x439692>0x0?_0x439692:0x1;return _0x5a9614['busyFactor'](_0x15d645,_0x242d4f,_0x491281,_0x439692,_0x3cf7b2);})['then'](function(_0xbc7ca){return _0x4569b7(_0xbc7ca);})[_0xae09('0xb2')](function(_0x203fcc){return _0x3e22ed(msgResponse(_0xae09('0x1eb'),_0xae09('0x14d'),JSON['stringify'](_0x203fcc)));});}}else{return _0x3e22ed(msgResponse('[getDataPredictive]',_0xae09('0x14d'),'check\x20failure'));}});};};Dialer['prototype'][_0xae09('0x1db')]=function(_0x4a4d51){var _0x2f64f3=this;return function(){var _0x35c7d2=0x0;var _0x3b994e=Math[_0xae09('0x1ed')](_0x4a4d51[_0xae09('0x76')]*0x3e8);if(_0x3b994e>0x0){_0x3b994e=_0x3b994e<0x64?0x64:_0x3b994e;loggerPredictive[_0xae09('0x84')](_0x4a4d51[_0xae09('0x45')],_0xae09('0x1ee'),_0x3b994e,_0xae09('0x4f'));_0x4a4d51[_0xae09('0x92')]=setInterval(function(){_0x2f64f3[_0xae09('0x92')](_0x4a4d51);loggerPredictiveCalls['info'](_0xae09('0x1ef'),_0x35c7d2+=0x1);},_0x3b994e);}else{loggerPredictive[_0xae09('0x84')](_0x4a4d51[_0xae09('0x45')],_0xae09('0x1f0'));}};};Dialer[_0xae09('0x20')]['checkContactBlack']=function(_0x2b5266,_0xf74f18){var _0x59fddc=this;return function(_0x5bd8fa){if(_[_0xae09('0x4c')](_0x5bd8fa)){if(_[_0xae09('0xde')](_0xf74f18[_0xae09('0xd2')])||!_0xf74f18[_0xae09('0x1f1')]){if(_0x2b5266['dialMethod']==='booked'){_0x2b5266[_0xae09('0x132')]=_[_0xae09('0x44')](_0x2b5266[_0xae09('0x132')])?!![]:_0x2b5266[_0xae09('0x132')];var _0x1888cf=uuid['v4']();_0x59fddc['actions'][_0x1888cf]=new Action(_0x2b5266,_0xf74f18,_0x1888cf);loggerBooked[_0xae09('0x84')](_0xae09('0x1f2'),_0x1888cf,_0xae09('0x1f3'),JSON[_0xae09('0x135')](_0x2b5266[_0xae09('0x132')]),'Queue:\x20',_0x2b5266[_0xae09('0x45')]);if(_0x2b5266['queueStatusComplete']){_0x2b5266[_0xae09('0x132')]=![];_0x59fddc[_0xae09('0x2e')][_0x59fddc[_0xae09('0x2a')][_0x1888cf]['queue']]=[];ami[_0xae09('0xb0')]({'actionid':_0x1888cf,'action':_0xae09('0x1f4'),'queue':_0x2b5266[_0xae09('0x45')]})[_0xae09('0xb2')](function(){_0x59fddc['updateOriginated'](_0x2b5266);_0x59fddc[_0xae09('0xc0')]({'active':![],'ContactId':_0x59fddc[_0xae09('0x2a')][_0x1888cf]['ContactId'],'ListId':_0x59fddc['actions'][_0x1888cf]['ListId'],'VoiceQueueId':_0x59fddc[_0xae09('0x2a')][_0x1888cf][_0xae09('0xd3')]||undefined,'CampaignId':_0x59fddc[_0xae09('0x2a')][_0x1888cf][_0xae09('0xd4')]||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x1f5')));delete _0x59fddc[_0xae09('0x2a')][_0x1888cf];});}else{loggerBooked['info'](_0xae09('0x1f6'),JSON[_0xae09('0x135')](_0x2b5266['queueStatusComplete']),_0xae09('0x1f7'),_0x2b5266[_0xae09('0x45')]);_0x59fddc[_0xae09('0xb4')](_0x2b5266);_0x59fddc[_0xae09('0xc0')]({'active':![],'ContactId':_0x59fddc[_0xae09('0x2a')][_0x1888cf]['ContactId'],'ListId':_0x59fddc[_0xae09('0x2a')][_0x1888cf][_0xae09('0x100')],'VoiceQueueId':_0x59fddc[_0xae09('0x2a')][_0x1888cf]['VoiceQueueId']||undefined,'CampaignId':_0x59fddc['actions'][_0x1888cf]['CampaignId']||undefined})[_0xae09('0xb2')](loggerCatch(_0xae09('0x1f5')));delete _0x59fddc[_0xae09('0x2a')][_0x1888cf];}}else{return _0x59fddc[_0xae09('0x176')](_0x2b5266,_0xf74f18);}}else{if(getDiff(_0xf74f18[_0xae09('0x1f8')])<_0x2b5266[_0xae09('0x1f9')]*0x3c){if(_0xf74f18[_0xae09('0x169')]&&!_0xf74f18['Agent'][_0xae09('0x1fa')]){_0x59fddc[_0xae09('0x95')]['run'](_0xf74f18['id'])[_0xae09('0x22')](function(){_0x59fddc[_0xae09('0xb4')](_0x2b5266);});}else{_0x59fddc[_0xae09('0xc2')]({'active':![]},_0xf74f18['id'],0x1)[_0xae09('0x22')](function(){_0x59fddc['updateOriginated'](_0x2b5266);});}}else{_0x2b5266[_0xae09('0x6b')]+=0x1;_0x59fddc[_0xae09('0xb4')](_0x2b5266);if(_0x2b5266[_0xae09('0x1fb')]){_0x59fddc[_0xae09('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xf74f18[_0xae09('0x107')],'ListId':_0xf74f18[_0xae09('0x100')],'VoiceQueueId':_0xf74f18['VoiceQueueId']||undefined,'CampaignId':_0xf74f18[_0xae09('0xd4')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x59fddc[_0xae09('0xca')](createObjHistory(_0x2b5266,_0xf74f18,_0xae09('0x1fc'),0x17,_0xae09('0x1fd')))[_0xae09('0xb2')](loggerCatch(_0xae09('0x1fe')));}else{_0x59fddc[_0xae09('0xcf')](createObjHistory(_0x2b5266,_0xf74f18,_0xae09('0x1ff'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2b5266[_0xae09('0x66')]+=0x1;_0x59fddc[_0xae09('0xcf')](createObjHistory(_0x2b5266,_0xf74f18,'BLACKLIST',0xd,_0xae09('0x200')),'[Originate][historyBlacklist]',_0xae09('0x201'));throw _0xae09('0x202');}};};Dialer[_0xae09('0x20')][_0xae09('0x203')]=function(_0x5a0b9d){var _0x1461b3=this;var _0x1b45b7=_0x5a0b9d[_0xae09('0x204')]-_0x5a0b9d[_0xae09('0x74')]-_0x5a0b9d['temp'];emitCampaignSummary(_0x5a0b9d);if(_0x1b45b7>0x0){if(_0x1b45b7>this['maxNumberOriginate']){_0x1b45b7=this[_0xae09('0x28')];}_0x5a0b9d[_0xae09('0xc4')]+=_0x1b45b7;this[_0xae09('0xc6')](_0x5a0b9d['id'],_0x1b45b7,_0x5a0b9d[_0xae09('0x205')],_0x5a0b9d)['then'](function(_0x624926){_0x5a0b9d[_0xae09('0xc4')]-=_0x1b45b7;_0x5a0b9d[_0xae09('0xc4')]=_0x5a0b9d['temp']>0x0?_0x5a0b9d[_0xae09('0xc4')]:0x0;if(!checkContactEmpty(_0x624926)){_0x5a0b9d[_0xae09('0x47')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xae09('0x84')](_0xae09('0x206')+_0x5a0b9d['name']);}else{_0x5a0b9d['originated']+=_0x624926[_0xae09('0x9b')];_0x5a0b9d[_0xae09('0x47')]='RUNNING';for(var _0x1621d5=0x0;_0x1621d5<_0x624926[_0xae09('0x9b')];_0x1621d5+=0x1){_0x5a0b9d[_0xae09('0x207')]+=0x1;if(_['isNil'](_0x624926[_0x1621d5])||_['isNil'](_0x624926[_0x1621d5][_0xae09('0x178')])||_['isNil'](_0x624926[_0x1621d5][_0xae09('0x178')][_0xae09('0x179')])){_0x1461b3['emptyContact'](_0xae09('0x208'),_0x5a0b9d,_0x624926[_0x1621d5]);}else{_0x1461b3[_0xae09('0xbc')](_['pick'](_0x624926[_0x1621d5],[_0xae09('0xd4'),_0xae09('0x209')]))['then'](_0x1461b3[_0xae09('0x20a')](_0x5a0b9d,_0x624926[_0x1621d5]))['catch'](_0x1461b3[_0xae09('0xcc')]('[actionOriginateIvr]\x20',_0x5a0b9d));}}}})[_0xae09('0xb2')](loggerGetContactDialer(_0xae09('0x20b'),_0x5a0b9d,_0x1b45b7));}};Dialer[_0xae09('0x20')][_0xae09('0x162')]=function(_0x480d93,_0x56a9bc){var _0x42500f=this;var _0x3924f8=[];var _0x2215c7=_0x56a9bc>=0x1?_0x56a9bc:0x1;if(_0x480d93[_0xae09('0x61')]==='booked'){_0x2215c7=0x1;}var _0x34a241=Math[_0xae09('0x1ed')](_0x480d93['available']*_0x2215c7)-_0x480d93[_0xae09('0x74')]-_0x480d93[_0xae09('0xc4')];emitVoiceQueueSummary(_0x480d93);if(_0x480d93[_0xae09('0x20c')]>0x0){var _0x423836=_0x480d93[_0xae09('0x20c')]-_0x480d93[_0xae09('0x74')]-_0x480d93['talking']-_0x480d93[_0xae09('0xc4')]-_0x480d93[_0xae09('0x57')];if(_0x34a241>_0x423836){_0x34a241=_0x423836;}}if(_0x34a241>0x0){if(_0x480d93[_0xae09('0x61')]===_0xae09('0xa')){_0x34a241=0x1;}if(_0x34a241>this[_0xae09('0x28')]){_0x34a241=this[_0xae09('0x28')];}_0x480d93[_0xae09('0xc4')]+=_0x34a241;for(var _0x20a4bd in this[_0xae09('0x26')]){if(typeof this['agents'][_0x20a4bd]!==_0xae09('0x9c')){if(this[_0xae09('0x26')][_0x20a4bd]['state']===_0xae09('0x20d')&&this[_0xae09('0x26')][_0x20a4bd]['status']===_0xae09('0xda')){_0x3924f8[_0xae09('0x153')](this['agents'][_0x20a4bd]['id']);}}}this['getContactDialer'](_0x480d93['id'],_0x3924f8,_0x34a241,_0x480d93[_0xae09('0x205')],_0x480d93)[_0xae09('0x42')](function(_0x206118){_0x480d93[_0xae09('0xc4')]-=_0x34a241;_0x480d93[_0xae09('0xc4')]=_0x480d93[_0xae09('0xc4')]>0x0?_0x480d93['temp']:0x0;if(!checkContactEmpty(_0x206118)){_0x42500f['countReScheduled'](_0x480d93)[_0xae09('0x42')](sendMessageReschedule(_0x480d93))[_0xae09('0xb2')](loggerCatch(_0xae09('0x20e')));}else{_0x480d93[_0xae09('0x74')]+=_0x206118['length'];_0x480d93['message']=_0x480d93[_0xae09('0x61')]===_0xae09('0xa')?_0xae09('0x20f'):_0xae09('0x210');for(var _0x4d6d5a=0x0;_0x4d6d5a<_0x206118['length'];_0x4d6d5a+=0x1){if(_[_0xae09('0xde')](_0x206118[_0x4d6d5a])||_['isNil'](_0x206118[_0x4d6d5a]['Contact'])||_['isNil'](_0x206118[_0x4d6d5a][_0xae09('0x178')][_0xae09('0x179')])){_0x42500f[_0xae09('0xcd')](_0xae09('0x208'),_0x480d93,_0x206118[_0x4d6d5a]);}else{_0x42500f[_0xae09('0xba')](_[_0xae09('0xd1')](_0x206118[_0x4d6d5a],[_0xae09('0xd3'),_0xae09('0x209')]))['then'](_0x42500f[_0xae09('0x20a')](_0x480d93,_0x206118[_0x4d6d5a]))[_0xae09('0xb2')](_0x42500f[_0xae09('0xcc')]('[actionOriginate]\x20',_0x480d93));}}}})[_0xae09('0xb2')](loggerGetContactDialer(_0xae09('0x211'),_0x480d93,_0x34a241));}};Dialer[_0xae09('0x20')]['handlePredictive']=function(_0x181358){if(_0x181358['dialLimitQueue']>0x0){var _0x34de51=_0x181358['dialLimitQueue']-_0x181358[_0xae09('0x74')]-_0x181358['talking'];if(_0x34de51>0x0){this[_0xae09('0x212')](_0x181358);}else{loggerPredictiveCalls[_0xae09('0x84')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x181358);}};Dialer[_0xae09('0x20')][_0xae09('0x212')]=function(_0x454837){var _0x2508bc=this;var _0x586e4a=[];_0x454837[_0xae09('0x74')]+=0x1;for(var _0x4a2ef3 in this[_0xae09('0x26')]){if(typeof this[_0xae09('0x26')][_0x4a2ef3]!==_0xae09('0x9c')){if(this['agents'][_0x4a2ef3]['state']===_0xae09('0x20d')&&this[_0xae09('0x26')][_0x4a2ef3][_0xae09('0xd9')]===_0xae09('0xda')){_0x586e4a[_0xae09('0x153')](this[_0xae09('0x26')][_0x4a2ef3]['id']);}}}this['getContactDialer'](_0x454837['id'],_0x586e4a,0x1,_0x454837[_0xae09('0x205')],_0x454837)[_0xae09('0x42')](function(_0x47d443){if(!checkContactEmpty(_0x47d443)){checkContactLowerLimitOriginate(_0x454837,0x1,0x0);_0x2508bc['countReScheduled'](_0x454837)['then'](sendMessageReschedule(_0x454837))[_0xae09('0xb2')](loggerCatch(_0xae09('0x20e')));}else{_0x454837[_0xae09('0x47')]=_0xae09('0x210');if(_['isNil'](_0x47d443[0x0])||_[_0xae09('0xde')](_0x47d443[0x0][_0xae09('0x178')])||_[_0xae09('0xde')](_0x47d443[0x0]['Contact'][_0xae09('0x179')])){_0x2508bc[_0xae09('0xcd')](_0xae09('0x208'),_0x454837,_0x47d443[0x0]);}else{_0x2508bc['checkIsBlackList'](_[_0xae09('0xd1')](_0x47d443[0x0],[_0xae09('0xd3'),_0xae09('0x209')]))['then'](_0x2508bc[_0xae09('0x20a')](_0x454837,_0x47d443[0x0]))['catch'](_0x2508bc[_0xae09('0xcc')](_0xae09('0x213'),_0x454837));}}})[_0xae09('0xb2')](loggerGetContactDialer(_0xae09('0x214'),_0x454837,0x1));emitVoiceQueueSummary(_0x454837);};Dialer[_0xae09('0x20')][_0xae09('0x1e3')]=function(_0x393524,_0x1bcd91,_0x2e0830,_0x3e6490,_0x13c697,_0x12ab98){loggerPredictive['info'](_0xae09('0x215'));loggerPredictive[_0xae09('0x84')]('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',_0x393524);loggerPredictive[_0xae09('0x84')](_0xae09('0x216'),_0x1bcd91);loggerPredictive[_0xae09('0x84')](_0xae09('0x217'),_0x2e0830);loggerPredictive[_0xae09('0x84')]('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',_0x3e6490);loggerPredictive['info'](_0xae09('0x218'),_0x13c697);loggerPredictive[_0xae09('0x84')](_0xae09('0x87'));return new BPromise(function(_0x3f2382,_0x15e3c1){if(_0x393524<=0x0||isNaN(_0x393524)){return _0x15e3c1(msgResponse(_0xae09('0x219'),_0xae09('0x4e'),'m\x20=\x20'+_0x393524));}if(_0x2e0830<=0x0||isNaN(_0x2e0830)){return _0x15e3c1(msgResponse(_0xae09('0x219'),_0xae09('0x4e'),_0xae09('0x21a')+_0x2e0830));}if(_0x3e6490<=0x0||isNaN(_0x3e6490)){return _0x15e3c1(msgResponse(_0xae09('0x219'),_0xae09('0x4e'),_0xae09('0x21b')+_0x3e6490));}if(_0x1bcd91<=0x0||isNaN(_0x1bcd91)){return _0x15e3c1(msgResponse(_0xae09('0x219'),'Error','interval\x20=\x20'+_0x1bcd91));}if(_0x13c697<=0x0||isNaN(_0x13c697)){return _0x15e3c1(msgResponse(_0xae09('0x219'),_0xae09('0x4e'),_0xae09('0x21c')+_0x13c697));}_0x12ab98=_0x12ab98||0x0;var _0x148388=0x1/_0x2e0830;var _0x20afb2=0x0;var _0x18f5cb=0x0;var _0x5caa5a=0x0;var _0x5a44e1=0x0;for(var _0x2ceaf7=0x0;_0x5caa5a<_0x13c697;_0x2ceaf7+=0x1){_0x18f5cb=_0x2ceaf7/_0x1bcd91;_0x20afb2=(_0x3e6490*_0x18f5cb+_0x12ab98)/_0x148388;_0x5caa5a=erlangb(_0x20afb2,_0x393524);_0x5a44e1=_0x20afb2/_0x393524*(0x1-erlangb(_0x20afb2,_0x393524));}return _0x3f2382({'erlangCalls':_0x2ceaf7,'erlangCallToSecond':_0x1bcd91/_0x2ceaf7,'erlangAbandonmentRate':_0x5caa5a,'erlangBusyFactor':_0x5a44e1});});};Dialer[_0xae09('0x20')]['busyFactor']=function(_0xe6abed,_0x3414b9,_0x8a1773,_0x31aa70,_0x4f1a74,_0x304c30){loggerPredictive[_0xae09('0x84')](_0xae09('0x21d'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe6abed);loggerPredictive[_0xae09('0x84')](_0xae09('0x216'),_0x3414b9);loggerPredictive[_0xae09('0x84')](_0xae09('0x217'),_0x8a1773);loggerPredictive[_0xae09('0x84')](_0xae09('0x21e'),_0x31aa70);loggerPredictive[_0xae09('0x84')](_0xae09('0x21f'),_0x4f1a74);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x1cb537,_0x2f1069){if(_0xe6abed<=0x0||isNaN(_0xe6abed)){return _0x2f1069(msgResponse(_0xae09('0x220'),_0xae09('0x4e'),'m\x20=\x20'+_0xe6abed));}if(_0x8a1773<=0x0||isNaN(_0x8a1773)){return _0x2f1069(msgResponse(_0xae09('0x220'),_0xae09('0x4e'),'Ts\x20=\x20'+_0x8a1773));}if(_0x31aa70<=0x0||isNaN(_0x31aa70)){return _0x2f1069(msgResponse(_0xae09('0x220'),'Error',_0xae09('0x21b')+_0x31aa70));}if(_0x3414b9<=0x0||isNaN(_0x3414b9)){return _0x2f1069(msgResponse('[busyFactor]',_0xae09('0x4e'),'interval\x20=\x20'+_0x3414b9));}if(_0x4f1a74<=0x0||isNaN(_0x4f1a74)){return _0x2f1069(msgResponse('[busyFactor]',_0xae09('0x4e'),_0xae09('0x221')+_0x4f1a74));}_0x304c30=_0x304c30||0x0;var _0x53fb00=0x1/_0x8a1773;var _0x1ba6ed=0x0;var _0x4a5c13=0x0;var _0xd3e39e=0x0;var _0x3acd58=0x0;for(var _0xd6088a=0x0;_0x3acd58<_0x4f1a74;_0xd6088a+=0x1){_0x4a5c13=_0xd6088a/_0x3414b9;_0x1ba6ed=(_0x31aa70*_0x4a5c13+_0x304c30)/_0x53fb00;_0xd3e39e=erlangb(_0x1ba6ed,_0xe6abed);_0x3acd58=_0x1ba6ed/_0xe6abed*(0x1-erlangb(_0x1ba6ed,_0xe6abed));}return _0x1cb537({'erlangCalls':_0xd6088a,'erlangCallToSecond':_0x3414b9/_0xd6088a,'erlangAbandonmentRate':_0xd3e39e,'erlangBusyFactor':_0x3acd58});});};module[_0xae09('0x222')]=Dialer; \ No newline at end of file +var _0xf4eb=['[callProgressDetecting]\x20','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','handlePredictive','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','seconds','type','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','format','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','---------------------------','merge','milliseconds','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','endtime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','reachable','SIP/%s','unmonitored','moveContactManagedDialer','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','statedesc','HangupInAMD','membername','AMD','emit','buildObj','amd','[syncHangupInAMD]','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','ContactId','CampaignId','[rescheduleContact][Machine]','HANGUP','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countcongestionretry','countdropretry','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','cause-txt','[syncHangupIvr]','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countglobal','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','push','command','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','launchHandleIvr','checkIfTimeIntervals','dialTimezone','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','replace','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','callProgressDetecting'];(function(_0x520a14,_0xe0a38a){var _0x414519=function(_0x4e0d7f){while(--_0x4e0d7f){_0x520a14['push'](_0x520a14['shift']());}};_0x414519(++_0xe0a38a);}(_0xf4eb,0x83));var _0xbf4e=function(_0x4ac520,_0x4a2b6d){_0x4ac520=_0x4ac520-0x0;var _0x57d39b=_0xf4eb[_0x4ac520];return _0x57d39b;};'use strict';var util=require(_0xbf4e('0x0'));var _=require('lodash');var BPromise=require(_0xbf4e('0x1'));var uuid=require(_0xbf4e('0x2'));var moment=require(_0xbf4e('0x3'));var rr=require('rr');var md5=require(_0xbf4e('0x4'));var Redis=require(_0xbf4e('0x5'));var ut=require('../preview/util/util');var config=require(_0xbf4e('0x6'));var logger=require(_0xbf4e('0x7'))(_0xbf4e('0x8'));var loggerBooked=require('../../../config/logger')(_0xbf4e('0x9'));var loggerPredictive=require('../../../config/logger')(_0xbf4e('0xa'));var loggerPredictiveCalls=require(_0xbf4e('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbf4e('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xbf4e('0xb')]=_[_0xbf4e('0xc')](config[_0xbf4e('0xb')],{'host':_0xbf4e('0xd'),'port':0x18eb});var io=require(_0xbf4e('0xe'))(new Redis(config[_0xbf4e('0xb')]));var cmHopper=require(_0xbf4e('0xf'));var cmHopperHistory=require(_0xbf4e('0x10'));var cmHopperBlack=require(_0xbf4e('0x11'));var voiceQueueRt=require(_0xbf4e('0x12'));var RpcSetting=require(_0xbf4e('0x13'));var Action=require('./action');var History=require('./history');var Final=require(_0xbf4e('0x14'));var AgentComplete=require(_0xbf4e('0x15'));var QueueCallerAbandon=require(_0xbf4e('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xbf4e('0x17')][_0xbf4e('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0xbf4e('0x19'),'roundrobin':_0xbf4e('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xbf4e('0x1b')]=function(_0x25da76){this[_0xbf4e('0x1c')]=this['tail']?this[_0xbf4e('0x1c')][_0xbf4e('0x1d')](_0x25da76):_0x25da76();};function Dialer(_0x50f86a,_0x44a7cf){this['sequence']=new Sequence();this[_0xbf4e('0x1e')]=_0x44a7cf;this[_0xbf4e('0x1f')]=_0x50f86a['voiceQueues'];this[_0xbf4e('0x20')]=_0x50f86a[_0xbf4e('0x20')];this[_0xbf4e('0x21')]=_0x50f86a[_0xbf4e('0x21')];this[_0xbf4e('0x22')]=_0x50f86a['trunks'];this[_0xbf4e('0x23')]=config[_0xbf4e('0x23')]||0x2;this[_0xbf4e('0x24')]={};this[_0xbf4e('0x25')]={};this[_0xbf4e('0x26')]={};this[_0xbf4e('0x27')]={};this[_0xbf4e('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0xbf4e('0x29')]={};this[_0xbf4e('0x2a')]={};this['queueBookedRR']={};ami['on'](_0xbf4e('0x2b'),this[_0xbf4e('0x2c')]['bind'](this));ami['on'](_0xbf4e('0x2d'),this['syncQueueCallerAbandon'][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x2f'),this['syncOriginateResponse'][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x30'),this[_0xbf4e('0x31')]['bind'](this));ami['on'](_0xbf4e('0x32'),this[_0xbf4e('0x33')][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x34'),this[_0xbf4e('0x35')][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x36'),this[_0xbf4e('0x37')][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x38'),this['syncVarSet'][_0xbf4e('0x2e')](this));ami['on'](_0xbf4e('0x39'),this['syncQueueMember']['bind'](this));ami['on'](_0xbf4e('0x3a'),this[_0xbf4e('0x3b')]['bind'](this));this[_0xbf4e('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0xbf4e('0x3d')]()[_0xbf4e('0x3e')](function(_0x3e7aa8){previewRecallmeReminderInterval=_0x3e7aa8['previewRecallmeReminderInterval'];});}function isNotNull(_0x25e6be){return _0x25e6be!==null&&!_[_0xbf4e('0x3f')](_0x25e6be);}function checkIsLoggedIn(_0x3c4eed,_0x14629b){return function(){if(_0x14629b<=0x0){_0x3c4eed[_0xbf4e('0x40')]=_0xbf4e('0x41');throw _0x3c4eed[_0xbf4e('0x42')]+_0xbf4e('0x43');}};}function isActive(_0x168271){return _0x168271;}function checkIsActive(_0x395811,_0x3b7742){return function(){if(!isActive(_0x3b7742)){_0x395811[_0xbf4e('0x40')]='NOT_ACTIVE';throw _0x395811[_0xbf4e('0x42')]+_0xbf4e('0x44');}};}function checkInterval(_0x295870){return function(){if(!isNotNull(_0x295870[_0xbf4e('0x45')])){_0x295870[_0xbf4e('0x40')]=_0xbf4e('0x46');throw _0x295870[_0xbf4e('0x42')]+_0xbf4e('0x47');}if(!isNotNull(_0x295870['Interval'][_0xbf4e('0x48')])){_0x295870[_0xbf4e('0x40')]=_0xbf4e('0x46');throw _0x295870[_0xbf4e('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbf4e('0x49')](_0x295870['Interval']['Intervals']))){_0x295870[_0xbf4e('0x40')]=_0xbf4e('0x46');throw _0x295870[_0xbf4e('0x42')]+_0xbf4e('0x47');}};}function msgResponse(_0x1662ba,_0xe35621,_0x456d8b){return{'action':_0x1662ba,'response':_0xe35621,'message':_0x456d8b,'stack':_0x456d8b};}function myreject(_0x51f389){return function(_0x4f6312){return _0x51f389(msgResponse(_0xbf4e('0x4a'),_0xbf4e('0x4b'),JSON[_0xbf4e('0x4c')](_0x4f6312)));};}function getSeconds(_0x95efc4,_0x1bc25d){var _0x270924=moment(_0x95efc4)['milliseconds'](0x0);var _0x51d396=moment(_0x1bc25d)['milliseconds'](0x0);return _0x270924['diff'](_0x51d396,_0xbf4e('0x4d'));}function emit(_0x58c20b,_0x5b034b,_0x27f69a){io['to'](_0x58c20b)['emit'](_0x5b034b,_0x27f69a);}function emitVoiceQueueSummary(_0x5ccd7d){if(_0x5ccd7d[_0xbf4e('0x4e')]==='outbound'){var _0x5da35a={'id':_0x5ccd7d['id'],'name':_0x5ccd7d[_0xbf4e('0x42')],'strategy':_0x5ccd7d[_0xbf4e('0x4f')],'answered':_0x5ccd7d[_0xbf4e('0x50')],'available':_0x5ccd7d[_0xbf4e('0x51')],'loggedIn':_0x5ccd7d[_0xbf4e('0x52')],'pTalking':_0x5ccd7d[_0xbf4e('0x53')],'sumBillable':_0x5ccd7d['sumBillable'],'sumDuration':_0x5ccd7d[_0xbf4e('0x54')],'sumHoldTime':_0x5ccd7d[_0xbf4e('0x55')]||0x0,'talking':_0x5ccd7d[_0xbf4e('0x56')],'total':_0x5ccd7d[_0xbf4e('0x57')],'type':_0x5ccd7d[_0xbf4e('0x4e')],'unmanaged':_0x5ccd7d[_0xbf4e('0x58')],'abandoned':_0x5ccd7d['abandoned'],'waiting':_0x5ccd7d[_0xbf4e('0x59')],'loggedInDb':_0x5ccd7d[_0xbf4e('0x5a')],'dialActive':_0x5ccd7d[_0xbf4e('0x5b')],'dialMethod':_0x5ccd7d[_0xbf4e('0x5c')],'dialOriginateCallerIdName':_0x5ccd7d[_0xbf4e('0x5d')],'dialOriginateCallerIdNumber':_0x5ccd7d[_0xbf4e('0x5e')],'dialOriginateTimeout':_0x5ccd7d['dialOriginateTimeout'],'dialPrefix':_0x5ccd7d[_0xbf4e('0x5f')],'outboundAnswerAgiCallsDay':_0x5ccd7d[_0xbf4e('0x60')],'outboundAnswerCallsDay':_0x5ccd7d['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5ccd7d['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5ccd7d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5ccd7d[_0xbf4e('0x61')],'outboundDropCallsDayACS':_0x5ccd7d[_0xbf4e('0x62')],'outboundDropCallsDayCallersExit':_0x5ccd7d[_0xbf4e('0x63')],'outboundDropCallsDayTimeout':_0x5ccd7d[_0xbf4e('0x64')],'outboundNoAnswerCallsDay':_0x5ccd7d[_0xbf4e('0x65')],'outboundNoSuchCallsDay':_0x5ccd7d[_0xbf4e('0x66')],'outboundOriginateFailureCallsDay':_0x5ccd7d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5ccd7d[_0xbf4e('0x67')],'outboundRejectCallsDay':_0x5ccd7d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5ccd7d[_0xbf4e('0x68')],'predictiveIntervalAnsweredCalls':_0x5ccd7d[_0xbf4e('0x69')],'predictiveIntervalAvgHoldtime':_0x5ccd7d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5ccd7d[_0xbf4e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x5ccd7d[_0xbf4e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x5ccd7d['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5ccd7d[_0xbf4e('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ccd7d[_0xbf4e('0x6d')],'predictiveIntervalHitRate':_0x5ccd7d[_0xbf4e('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x5ccd7d[_0xbf4e('0x6f')],'predictiveIntervalPauses':_0x5ccd7d['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5ccd7d[_0xbf4e('0x70')],'predictiveIntervalTotalCalls':_0x5ccd7d['predictiveIntervalTotalCalls'],'message':_0x5ccd7d[_0xbf4e('0x40')],'originated':_0x5ccd7d[_0xbf4e('0x71')],'erlangCalls':_0x5ccd7d['erlangCalls'],'erlangCallToSecond':_0x5ccd7d[_0xbf4e('0x72')],'erlangAbandonmentRate':_0x5ccd7d['erlangAbandonmentRate'],'erlangBusyFactor':_0x5ccd7d[_0xbf4e('0x73')],'startPredictive':_0x5ccd7d[_0xbf4e('0x74')],'startProgressive':_0x5ccd7d[_0xbf4e('0x75')]};if(_0x5ccd7d['Trunk']){_0x5da35a[_0xbf4e('0x76')]={'id':_0x5ccd7d[_0xbf4e('0x76')]['id'],'name':_0x5ccd7d[_0xbf4e('0x76')][_0xbf4e('0x42')],'active':_0x5ccd7d[_0xbf4e('0x76')][_0xbf4e('0x77')],'callerid':_0x5ccd7d[_0xbf4e('0x76')][_0xbf4e('0x78')]};}if(_0x5ccd7d[_0xbf4e('0x45')]){_0x5da35a['Interval']={'id':_0x5ccd7d['Interval']['id'],'name':_0x5ccd7d[_0xbf4e('0x45')][_0xbf4e('0x42')]};}var _0x14f69d=md5(JSON['stringify'](_0x5da35a));if(_0x5ccd7d[_0xbf4e('0x4')]!==_0x14f69d){_0x5ccd7d['md5']=_0x14f69d;emit(util[_0xbf4e('0x79')]('voice:queue:%s',_0x5da35a[_0xbf4e('0x42')]),'voice_queue:save',_0x5da35a);}}}function emitCampaignSummary(_0x337c21){if(_0x337c21[_0xbf4e('0x4e')]===_0xbf4e('0x7a')){emit(util[_0xbf4e('0x79')]('campaign:ivr:%s',_0x337c21[_0xbf4e('0x42')]),_0xbf4e('0x7b'),_0x337c21);}}function checkGetDataPredictive(_0x5459a5){if(isNotNull(_0x5459a5)&&!_['isEmpty'](_0x5459a5)){loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x7d'));loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x7e'),_0x5459a5[_0xbf4e('0x7f')]);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x80'),_0x5459a5[_0xbf4e('0x69')]);loggerPredictive[_0xbf4e('0x7c')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5459a5[_0xbf4e('0x81')]);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x82'),_0x5459a5[_0xbf4e('0x6b')]);loggerPredictive['info'](_0xbf4e('0x83'),_0x5459a5[_0xbf4e('0x84')]);loggerPredictive[_0xbf4e('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5459a5[_0xbf4e('0x6a')]);loggerPredictive[_0xbf4e('0x7c')]('---------------------------');if(_0x5459a5[_0xbf4e('0x7f')]>0x0){if(!_[_0xbf4e('0x3f')](_0x5459a5[_0xbf4e('0x6a')])&&_0x5459a5[_0xbf4e('0x6a')]>0x0){return!![];}loggerPredictive[_0xbf4e('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xbf4e('0x3f')](_0x5459a5[_0xbf4e('0x84')])&&_0x5459a5[_0xbf4e('0x84')]>0x0){return!![];}loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x85'));}else{loggerPredictive['info'](_0xbf4e('0x86'));}}else{loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x87'));}return![];}function mergeDataErlangB(_0x590582){return function(_0x215ab2){loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x88'));loggerPredictive[_0xbf4e('0x7c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x215ab2[_0xbf4e('0x89')]);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x8a'),_0x215ab2[_0xbf4e('0x72')]);loggerPredictive[_0xbf4e('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x215ab2['erlangAbandonmentRate']);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x8b'),_0x215ab2[_0xbf4e('0x73')]);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x8c'),_0x215ab2[_0xbf4e('0x8d')]);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x8e'));_[_0xbf4e('0x8f')](_0x590582,_0x215ab2);};}function getDiff(_0x44946c){var _0x296797=moment()['milliseconds'](0x0);var _0x273a89=moment(_0x44946c)[_0xbf4e('0x90')](0x0);return _0x296797[_0xbf4e('0x91')](_0x273a89,'seconds');}function ifInterval(_0x955c7f,_0x550c21){if(_[_0xbf4e('0x3f')](_0x550c21)){return![];}return getDiff(_0x550c21)<_0x955c7f*0x3c;}function freeVariablesPredictive(_0x15775f){if(isNotNull(_0x15775f)){if(!_[_0xbf4e('0x3f')](_0x15775f[_0xbf4e('0x75')])){_0x15775f[_0xbf4e('0x75')]=undefined;loggerPredictive[_0xbf4e('0x7c')](_0x15775f[_0xbf4e('0x42')],_0xbf4e('0x92'));}if(!_[_0xbf4e('0x3f')](_0x15775f[_0xbf4e('0x74')])){_0x15775f[_0xbf4e('0x74')]=undefined;loggerPredictive[_0xbf4e('0x7c')](_0x15775f['name'],_0xbf4e('0x93'));}if(!_[_0xbf4e('0x3f')](_0x15775f['handlePredictive'])){clearInterval(_0x15775f['handlePredictive']);_0x15775f['handlePredictive']=undefined;loggerPredictive[_0xbf4e('0x7c')](_0x15775f[_0xbf4e('0x42')],_0xbf4e('0x94'));}}}function erlangb(_0x2b03b0,_0x164805){if(_0x164805===0x0){return 0x0;}var _0x5e1754=0x1;for(var _0x4983f4=0x1;_0x4983f4<=_0x164805;_0x4983f4+=0x1){_0x5e1754=0x1+_0x5e1754*_0x4983f4/_0x2b03b0;}return 0x1/_0x5e1754;}function isVoiceQueueOutbound(_0x3146dc){return _0x3146dc===_0xbf4e('0x95');}function isNotPreview(_0x4b4488){return _0x4b4488!==_0xbf4e('0x1e');}function isCampaignIvr(_0x39257b){return _0x39257b===_0xbf4e('0x7a');}function getCallerId(_0x785aef,_0x443a8a,_0xd0b4c6){if(!_[_0xbf4e('0x3f')](_0xd0b4c6)&&typeof _0xd0b4c6==='string'&&!_[_0xbf4e('0x49')](_0xd0b4c6)){if(!_[_0xbf4e('0x3f')](_0x443a8a)&&typeof _0x443a8a==='string'&&!_[_0xbf4e('0x49')](_0x443a8a)){return util[_0xbf4e('0x79')]('\x22%s\x22\x20<%s>',_0x443a8a,_0xd0b4c6);}return util[_0xbf4e('0x79')]('\x22%s\x22\x20<%s>',_0xd0b4c6,_0xd0b4c6);}if(!_[_0xbf4e('0x3f')](_0x785aef)&&typeof _0x785aef===_0xbf4e('0x96')&&!_[_0xbf4e('0x49')](_0x785aef)){return _0x785aef;}return _0xbf4e('0x97');}function loggerCatchQueueSummary(_0x4a9b80,_0x4a0994){return function(_0x228d95){freeVariablesPredictive(_0x4a0994);emitVoiceQueueSummary(_0x4a0994);emitCampaignSummary(_0x4a0994);loggerSyncQueueSummary['error'](_0x4a9b80,util[_0xbf4e('0x98')](_0x228d95,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x253ee6,_0x396032){return function(_0x322c02){loggerPredictive[_0xbf4e('0x99')](_0x396032['name'],_0x253ee6);loggerPredictive['error'](_0x322c02[_0xbf4e('0x9a')]);freeVariablesPredictive(_0x396032);};}function loggerCatch(_0x266da1){return function(_0x5388ad){logger[_0xbf4e('0x99')](_0x266da1,util['inspect'](_0x5388ad,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2aa04e){return _0x2aa04e&&!_[_0xbf4e('0x3f')](_0x2aa04e)&&_0x2aa04e[_0xbf4e('0x9b')]>0x0;}function decremetOriginate(_0x9b9b4b){if(!_[_0xbf4e('0x3f')](_0x9b9b4b)&&_0x9b9b4b!==null){if(typeof _0x9b9b4b[_0xbf4e('0x71')]!==_0xbf4e('0x9c')){if(_0x9b9b4b[_0xbf4e('0x71')]>0x0){_0x9b9b4b['originated']-=0x1;}else{logger['error'](_0xbf4e('0x9d'));}}}else{logger[_0xbf4e('0x99')](_0xbf4e('0x9e'));}}function checkContactLowerLimitOriginate(_0x86b63c,_0x2d30e9,_0x1040b1){if(_0x2d30e9>_0x1040b1){for(var _0x46bbe6=0x0;_0x46bbe6<_0x2d30e9-_0x1040b1;_0x46bbe6+=0x1){decremetOriginate(_0x86b63c);}}}function loggerGetContactDialer(_0x9f129e,_0x3f3fb4,_0x343372){return function(_0x1bfc77){checkContactLowerLimitOriginate(_0x3f3fb4,_0x343372,0x0);logger[_0xbf4e('0x99')](_0x9f129e,util[_0xbf4e('0x98')](_0x1bfc77,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b6065){return function(_0x48767d){if(isNotNull(_0x48767d)&&isNotNull(_0x48767d[0x0])){if(_0x48767d[0x0][_0xbf4e('0x9f')]>0x0){_0x2b6065['message']=_0xbf4e('0xa0');logger['info'](_0xbf4e('0xa1')+_0x2b6065[_0xbf4e('0x42')],_0x48767d[0x0][_0xbf4e('0x9f')],'contacts');}else{_0x2b6065['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xbf4e('0x7c')](_0xbf4e('0xa2')+_0x2b6065['name']);}}};}function notSendMessagesQueue(_0x5f56ca){if(_0x5f56ca[_0xbf4e('0xa3')]){freeVariablesPredictive(_0x5f56ca);if(_0x5f56ca['originated']===0x0&&_0x5f56ca[_0xbf4e('0x56')]===0x0&&_0x5f56ca['waiting']===0x0&&(_0x5f56ca[_0xbf4e('0x53')]||0x0)===0x0){_0x5f56ca[_0xbf4e('0xa3')]=![];_0x5f56ca[_0xbf4e('0x51')]=0x0;_0x5f56ca[_0xbf4e('0x40')]=_0xbf4e('0xa4');loggerSyncQueueSummary[_0xbf4e('0x99')](_0xbf4e('0xa5'),_0x5f56ca[_0xbf4e('0x42')],'is\x20not\x20active');}else{_0x5f56ca['message']=_0xbf4e('0xa6');loggerSyncQueueSummary[_0xbf4e('0x99')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5f56ca['name'],_0xbf4e('0xa7'));}emitVoiceQueueSummary(_0x5f56ca);}}function notSendMessagesCampaign(_0x35e16a){if(_0x35e16a[_0xbf4e('0xa3')]){if(_0x35e16a[_0xbf4e('0x71')]===0x0){_0x35e16a['sendMessageOneNotActive']=![];_0x35e16a[_0xbf4e('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xbf4e('0xa8'),_0x35e16a[_0xbf4e('0x42')],_0xbf4e('0xa9'));}else{_0x35e16a[_0xbf4e('0x40')]=_0xbf4e('0xa6');loggerSyncQueueSummary[_0xbf4e('0x99')](_0xbf4e('0xa8'),_0x35e16a['name'],_0xbf4e('0xa7'));}emitCampaignSummary(_0x35e16a);}}function createObjHistory(_0x3a00d6,_0x1f2740,_0x480d51,_0x2c7af3,_0x347187){_0x3a00d6[_0xbf4e('0x40')]=_0x480d51;var _0x1cc42a=new Action(_0x3a00d6,_0x1f2740);var _0x2871e9=new History(_0x1cc42a);_0x2871e9[_0xbf4e('0xaa')]=_0x2c7af3;_0x2871e9['statedesc']=_0x347187;_0x2871e9[_0xbf4e('0xab')]=_0x1cc42a['starttime'];return _0x2871e9;}Dialer[_0xbf4e('0xac')][_0xbf4e('0xad')]=function(){var _0x17dbb8=this;setInterval(function(){_0x17dbb8[_0xbf4e('0xae')](_0x17dbb8[_0xbf4e('0x27')],_0xbf4e('0xaf'));_0x17dbb8['clearZombieChannels'](_0x17dbb8[_0xbf4e('0x25')],_0xbf4e('0xb0'));},0x32c8);};Dialer['prototype'][_0xbf4e('0xae')]=function(_0x444b62,_0x433b45){var _0x1b5db4=this;for(var _0x114911 in _0x444b62){if(typeof _0x444b62[_0x114911]!=='undefined'){this['sequence'][_0xbf4e('0x1b')](function(){if(!_[_0xbf4e('0xb1')](_0x444b62[_0x114911])){return ami[_0xbf4e('0xb2')]({'action':_0xbf4e('0xb3'),'channel':_0x444b62[_0x114911][_0xbf4e('0xb4')]})[_0xbf4e('0xb5')](function(_0x4b9982){if(_0x4b9982[_0xbf4e('0x40')]===_0xbf4e('0xb6')){setTimeout(function(){if(_0x444b62[_0x114911]&&_0x444b62[_0x114911][_0xbf4e('0x4e')]!=='ivr'){_0x1b5db4[_0xbf4e('0xb7')](_0x1b5db4['voiceQueues'][_0x444b62[_0x114911][_0xbf4e('0xb8')]]);logger[_0xbf4e('0x99')](_0xbf4e('0xb9'),_0x433b45,_0x114911,_0x444b62[_0x114911]['queue']);delete _0x444b62[_0x114911];}if(_0x444b62[_0x114911]&&_0x444b62[_0x114911][_0xbf4e('0x4e')]===_0xbf4e('0x7a')){_0x1b5db4[_0xbf4e('0xb7')](_0x1b5db4[_0xbf4e('0x20')][_0x444b62[_0x114911][_0xbf4e('0xb8')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x433b45,_0x114911,_0x444b62[_0x114911][_0xbf4e('0xb8')]);delete _0x444b62[_0x114911];}},0x2328);}});}});}}};Dialer[_0xbf4e('0xac')][_0xbf4e('0xba')]=function(_0x7ae75c){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopper[_0xbf4e('0xba')](_0x7ae75c))[_0xbf4e('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xbc')]=function(_0x4a8095){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopperBlack[_0xbf4e('0xbc')](_0x4a8095))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xbd')));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xbe')]=function(_0x176787){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopperBlack['checkIsBlackListIvr'](_0x176787))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xbf')));};Dialer[_0xbf4e('0xac')]['averageHandleTime']=function(_0x5d8445){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopperHistory['avgHandleTime'](_0x5d8445))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xc0')));};Dialer[_0xbf4e('0xac')]['rescheduleContact']=function(_0xfadd3a){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopper[_0xbf4e('0xc1')](_0xfadd3a))[_0xbf4e('0xb5')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0xdca37a,_0x1274ca,_0x26a2b4){return BPromise['resolve']()[_0xbf4e('0x3e')](cmHopper[_0xbf4e('0xc2')](_0xdca37a,_0x1274ca,_0x26a2b4))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xc3')));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xc4')]=function(_0x2113d5,_0x4641f1,_0x37c5ff,_0x413534,_0x5348ad){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopper[_0xbf4e('0xc4')](_0x2113d5,_0x4641f1,_0x37c5ff,_0x413534))[_0xbf4e('0xb5')](function(_0x112cdb){_0x5348ad[_0xbf4e('0xc5')]-=_0x37c5ff;_0x5348ad[_0xbf4e('0xc5')]=_0x5348ad[_0xbf4e('0xc5')]>0x0?_0x5348ad['temp']:0x0;loggerCatch(_0xbf4e('0xc6'))(_0x112cdb);});};Dialer[_0xbf4e('0xac')][_0xbf4e('0xc7')]=function(_0x3a4f0c,_0x368707,_0x35fa79,_0x2c0018){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopper['getContactDialerIvr'](_0x3a4f0c,_0x368707,_0x35fa79))[_0xbf4e('0xb5')](function(_0x1fceed){_0x2c0018['temp']-=_0x368707;_0x2c0018[_0xbf4e('0xc5')]=_0x2c0018[_0xbf4e('0xc5')]>0x0?_0x2c0018[_0xbf4e('0xc5')]:0x0;loggerCatch(_0xbf4e('0xc8'))(_0x1fceed);});};Dialer[_0xbf4e('0xac')][_0xbf4e('0xc9')]=function(_0xe2f045){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](voiceQueueRt[_0xbf4e('0xc9')](_0xe2f045))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xca')));};Dialer[_0xbf4e('0xac')]['moveContactManagedDialer']=function(_0x78f7ff){return BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](cmHopper['moveContactManagedDialer'](_0x78f7ff))[_0xbf4e('0xb5')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xcb')]=function(_0x196536){return BPromise['resolve']()[_0xbf4e('0x3e')](cmHopperHistory[_0xbf4e('0xcb')](_0x196536))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xcc')));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xb7')]=function(_0x4b426a){if(!_[_0xbf4e('0x3f')](_0x4b426a)&&_0x4b426a!==null){if(typeof _0x4b426a[_0xbf4e('0x71')]!==_0xbf4e('0x9c')){if(_0x4b426a[_0xbf4e('0x71')]>0x0){_0x4b426a[_0xbf4e('0x71')]-=0x1;}else{logger[_0xbf4e('0x99')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xbf4e('0x99')](_0xbf4e('0xcd'));}};Dialer[_0xbf4e('0xac')][_0xbf4e('0xce')]=function(_0x33a767,_0x391661){var _0x56b3ad=this;return function(_0xdb5c93){_0x56b3ad['updateOriginated'](_0x391661);logger['error'](_0x33a767,util[_0xbf4e('0x98')](_0xdb5c93,{'showHidden':![],'depth':null}));};};Dialer[_0xbf4e('0xac')][_0xbf4e('0xcf')]=function(_0x3e5f32,_0x5b7b4c,_0x15a71f){var _0x568943={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x5b7b4c);this[_0xbf4e('0xd0')](_[_0xbf4e('0x8f')](_0x568943,_[_0xbf4e('0xd1')](_0x15a71f,['ContactId',_0xbf4e('0xd2'),_0xbf4e('0xd3'),_0xbf4e('0xd4'),'CampaignId'])),_0xbf4e('0xd5'),_0xbf4e('0xd6'));logger['error'](_0x3e5f32);};Dialer['prototype'][_0xbf4e('0xd7')]=function(_0x376dc1){return _0x376dc1==='Success';};Dialer['prototype'][_0xbf4e('0xd8')]=function(_0x5a6385){return!_[_0xbf4e('0x3f')](_0x5a6385)&&_0x5a6385&&!_[_0xbf4e('0x3f')](_0x5a6385[_0xbf4e('0x42')])&&!_['isUndefined'](_0x5a6385[_0xbf4e('0x77')])&&_0x5a6385[_0xbf4e('0x77')]&&(this[_0xbf4e('0x22')][util[_0xbf4e('0x79')]('SIP/%s',_0x5a6385['name'])]['status']===_0xbf4e('0xd9')||this[_0xbf4e('0x22')][util[_0xbf4e('0x79')](_0xbf4e('0xda'),_0x5a6385['name'])][_0xbf4e('0xb3')]===_0xbf4e('0xdb'));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xd0')]=function(_0x1d3a9f,_0x4f4372,_0x46db45){this[_0xbf4e('0xcb')](_0x1d3a9f)[_0xbf4e('0xb5')](loggerCatch(_0x4f4372));this[_0xbf4e('0xdc')](_0x1d3a9f)[_0xbf4e('0xb5')](loggerCatch(_0x46db45));};Dialer[_0xbf4e('0xac')][_0xbf4e('0xdd')]=function(_0x36cfca){var _0x2b7c94=this['uniqueId'][_0x36cfca[_0xbf4e('0xde')]];var _0x24fbd4;if(!_[_0xbf4e('0xb1')](_0x36cfca)&&!_[_0xbf4e('0xb1')](_0x36cfca[_0xbf4e('0xdf')])&&!_[_0xbf4e('0xb1')](_0x36cfca[_0xbf4e('0xdf')][_0xbf4e('0xe0')])&&_0x36cfca[_0xbf4e('0xe1')]===_0xbf4e('0xe2')&&_0x2b7c94){if(_0x2b7c94[_0xbf4e('0x4e')]!==_0xbf4e('0x7a')&&this[_0xbf4e('0x1f')][_0x2b7c94['queue']][_0xbf4e('0xe3')]&&_0x36cfca[_0xbf4e('0xe4')]==='HANGUP'){delete this[_0xbf4e('0x27')][_0x36cfca[_0xbf4e('0xde')]];this[_0xbf4e('0xb7')](this[_0xbf4e('0x1f')][_0x2b7c94[_0xbf4e('0xb8')]]);this['voiceQueues'][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0xe5')]+=0x1;this[_0xbf4e('0x1f')][_0x2b7c94[_0xbf4e('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x24fbd4=new Hangup(_0x2b7c94,_0x36cfca);_0x24fbd4[_0xbf4e('0xaa')]=0x12;_0x24fbd4[_0xbf4e('0xe6')]=_0xbf4e('0xe7');_0x24fbd4[_0xbf4e('0xe8')]=_0xbf4e('0xe9');ami[_0xbf4e('0xea')]('custom:amd',ut[_0xbf4e('0xeb')](_0x24fbd4,_0xbf4e('0xec')));this[_0xbf4e('0xd0')](_0x24fbd4,'[syncHangupInAMD][createHistory]',_0xbf4e('0xed'));}if(_0x2b7c94[_0xbf4e('0x4e')]!==_0xbf4e('0x7a')&&this['voiceQueues'][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0xe3')]&&_0x36cfca['value']==='MACHINE'){var _0xc9767a=this;return new BPromise(function(_0x4a14e1,_0x1e8b73){delete _0xc9767a[_0xbf4e('0x27')][_0x36cfca[_0xbf4e('0xde')]];_0xc9767a[_0xbf4e('0xb7')](_0xc9767a[_0xbf4e('0x1f')][_0x2b7c94[_0xbf4e('0xb8')]]);_0xc9767a[_0xbf4e('0x1f')][_0x2b7c94[_0xbf4e('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0xc9767a['voiceQueues'][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0x60')]+=0x1;var _0x142944=_0xc9767a[_0xbf4e('0x1f')][_0x2b7c94[_0xbf4e('0xb8')]];var _0x1cf1db=new Hangup(_0x2b7c94,_0x36cfca);_0x1cf1db[_0xbf4e('0xaa')]=0x13;_0x1cf1db[_0xbf4e('0xe6')]='Machine';_0x1cf1db[_0xbf4e('0xe8')]='AMD';_0x1cf1db[_0xbf4e('0xee')]+=0x1;_0x1cf1db['countglobal']+=0x1;_0x1cf1db['amd']=!![];ami[_0xbf4e('0xea')]('custom:amd',ut[_0xbf4e('0xeb')](_0x1cf1db,_0xbf4e('0xec')));_0xc9767a[_0xbf4e('0xcb')](_0x1cf1db)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xef')));if(_0x1cf1db[_0xbf4e('0xf0')]+_0x1cf1db['countcongestionretry']+_0x1cf1db[_0xbf4e('0xf1')]+_0x1cf1db['countnosuchnumberretry']+_0x1cf1db['countdropretry']+_0x1cf1db[_0xbf4e('0xf2')]+_0x1cf1db['countmachineretry']+_0x1cf1db[_0xbf4e('0xf3')]>=_0x142944[_0xbf4e('0xf4')]){_0xc9767a[_0xbf4e('0xf5')](_0x1cf1db,_0x4a14e1,_0x1e8b73,_0xbf4e('0xf6'));}else{if(_0x1cf1db[_0xbf4e('0xee')]>=_0x142944['dialMachineMaxRetry']){_0xc9767a[_0xbf4e('0xf7')](_0x1cf1db,_0x4a14e1,_0x1e8b73,_0xbf4e('0xf8'));}else{_0xc9767a[_0xbf4e('0xc1')]({'active':![],'countmachineretry':_0x1cf1db[_0xbf4e('0xee')],'scheduledat':moment()[_0xbf4e('0xf9')](_0x142944[_0xbf4e('0xfa')],_0xbf4e('0xfb'))[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1cf1db[_0xbf4e('0xfc')],'ListId':_0x1cf1db[_0xbf4e('0xd2')],'VoiceQueueId':_0x1cf1db[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x1cf1db[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xfe')));_0x4a14e1({'reschedule':0x1});}}});}if(_0x2b7c94[_0xbf4e('0x4e')]===_0xbf4e('0x7a')&&this[_0xbf4e('0x20')][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0xe3')]&&_0x36cfca[_0xbf4e('0xe4')]===_0xbf4e('0xff')){delete this[_0xbf4e('0x27')][_0x36cfca[_0xbf4e('0xde')]];this[_0xbf4e('0xb7')](this[_0xbf4e('0x20')][_0x2b7c94['queue']]);_0x24fbd4=new Hangup(_0x2b7c94,_0x36cfca);_0x24fbd4[_0xbf4e('0xaa')]=0x12;_0x24fbd4['statedesc']=_0xbf4e('0xe7');_0x24fbd4[_0xbf4e('0xe8')]=_0xbf4e('0xe9');ami[_0xbf4e('0xea')](_0xbf4e('0x100'),ut[_0xbf4e('0xeb')](_0x24fbd4,_0xbf4e('0xec')));this[_0xbf4e('0xd0')](_0x24fbd4,_0xbf4e('0x101'),_0xbf4e('0x102'));}if(_0x2b7c94[_0xbf4e('0x4e')]===_0xbf4e('0x7a')&&this['campaigns'][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0xe3')]&&_0x36cfca[_0xbf4e('0xe4')]===_0xbf4e('0x103')){var _0xc9767a=this;return new BPromise(function(_0x2de3b3,_0x488521){delete _0xc9767a[_0xbf4e('0x27')][_0x36cfca[_0xbf4e('0xde')]];_0xc9767a['updateOriginated'](_0xc9767a[_0xbf4e('0x20')][_0x2b7c94[_0xbf4e('0xb8')]]);_0xc9767a['campaigns'][_0x2b7c94[_0xbf4e('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0xc9767a['campaigns'][_0x2b7c94[_0xbf4e('0xb8')]][_0xbf4e('0x60')]+=0x1;var _0x5b5a2f=_0xc9767a[_0xbf4e('0x20')][_0x2b7c94['queue']];var _0x4ea30d=new Hangup(_0x2b7c94,_0x36cfca);_0x4ea30d['state']=0x13;_0x4ea30d[_0xbf4e('0xe6')]=_0xbf4e('0x104');_0x4ea30d['membername']=_0xbf4e('0xe9');_0x4ea30d['countmachineretry']+=0x1;_0x4ea30d['countglobal']+=0x1;_0x4ea30d[_0xbf4e('0xec')]=!![];ami[_0xbf4e('0xea')](_0xbf4e('0x100'),ut['buildObj'](_0x4ea30d,'amd'));_0xc9767a[_0xbf4e('0xcb')](_0x4ea30d)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xef')));if(_0x4ea30d['countbusyretry']+_0x4ea30d[_0xbf4e('0x105')]+_0x4ea30d[_0xbf4e('0xf1')]+_0x4ea30d['countnosuchnumberretry']+_0x4ea30d[_0xbf4e('0x106')]+_0x4ea30d[_0xbf4e('0xf2')]+_0x4ea30d[_0xbf4e('0xee')]+_0x4ea30d[_0xbf4e('0xf3')]>=_0x5b5a2f[_0xbf4e('0xf4')]){_0xc9767a[_0xbf4e('0xf5')](_0x4ea30d,_0x2de3b3,_0x488521,_0xbf4e('0xf6'));}else{if(_0x4ea30d[_0xbf4e('0xee')]>=_0x5b5a2f[_0xbf4e('0x107')]){_0xc9767a[_0xbf4e('0xf7')](_0x4ea30d,_0x2de3b3,_0x488521,_0xbf4e('0xf8'));}else{_0xc9767a[_0xbf4e('0xc1')]({'active':![],'countmachineretry':_0x4ea30d[_0xbf4e('0xee')],'scheduledat':moment()[_0xbf4e('0xf9')](_0x5b5a2f[_0xbf4e('0xfa')],'minutes')[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x4ea30d['ContactId'],'ListId':_0x4ea30d[_0xbf4e('0xd2')],'VoiceQueueId':_0x4ea30d[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x4ea30d['CampaignId']||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0xfe')));_0x2de3b3({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbf4e('0x35')]=function(_0x589d4b){var _0x322a7=this[_0xbf4e('0x27')][_0x589d4b[_0xbf4e('0xde')]];var _0x4f7a8b=this;var _0x36d0fd;if(_0x322a7&&_0x322a7[_0xbf4e('0x4e')]===_0xbf4e('0x7a')){delete this['uniqueId'][_0x589d4b['uniqueid']];this[_0xbf4e('0xb7')](this[_0xbf4e('0x20')][_0x322a7[_0xbf4e('0xb8')]]);this[_0xbf4e('0x20')][_0x322a7['queue']][_0xbf4e('0x109')]+=0x1;_0x36d0fd=new Hangup(_0x322a7,_0x589d4b);this[_0xbf4e('0xcb')](_0x36d0fd)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x10a')));this[_0xbf4e('0xdc')](_0x36d0fd)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x322a7&&_0x322a7['type']!==_0xbf4e('0x7a')&&isNotNull(this['voiceQueues'][_0x322a7[_0xbf4e('0xb8')]][_0xbf4e('0x10b')])){delete this[_0xbf4e('0x27')][_0x589d4b['uniqueid']];this[_0xbf4e('0xb7')](this[_0xbf4e('0x1f')][_0x322a7[_0xbf4e('0xb8')]]);this[_0xbf4e('0x1f')][_0x322a7[_0xbf4e('0xb8')]][_0xbf4e('0xe5')]+=0x1;this['voiceQueues'][_0x322a7[_0xbf4e('0xb8')]][_0xbf4e('0x60')]+=0x1;_0x36d0fd=new Hangup(_0x322a7,_0x589d4b);_0x36d0fd['state']=0x10;_0x36d0fd['statedesc']=_0xbf4e('0x10c');_0x36d0fd[_0xbf4e('0xe8')]=_0xbf4e('0x10d');this['createHistory'](_0x36d0fd)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x10a')));this[_0xbf4e('0xdc')](_0x36d0fd)[_0xbf4e('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x322a7&&_0x322a7[_0xbf4e('0x4e')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x322a7[_0xbf4e('0xb8')]][_0xbf4e('0x10b')])){delete this[_0xbf4e('0x27')][_0x589d4b[_0xbf4e('0xde')]];this[_0xbf4e('0xb7')](this['voiceQueues'][_0x322a7[_0xbf4e('0xb8')]]);this[_0xbf4e('0x1f')][_0x322a7['queue']][_0xbf4e('0x68')]+=0x1;_0x36d0fd=new Hangup(_0x322a7,_0x589d4b);_0x36d0fd[_0xbf4e('0xaa')]=0xc;_0x36d0fd[_0xbf4e('0xe6')]=_0x589d4b[_0xbf4e('0x10e')];_0x36d0fd[_0xbf4e('0xe8')]='Unknow';this[_0xbf4e('0xcb')](_0x36d0fd)['catch'](loggerCatch(_0xbf4e('0x10a')));this['moveContactManagedDialer'](_0x36d0fd)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x10f')));}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x31')]=function(_0x50c896){var _0x24a82a=this[_0xbf4e('0x27')][_0x50c896[_0xbf4e('0xde')]];var _0x142e74=this;if(this[_0xbf4e('0x1f')][_0x50c896[_0xbf4e('0xb8')]]){if(_0x24a82a&&_0x24a82a[_0xbf4e('0x4e')]!==_0xbf4e('0x7a')){delete this[_0xbf4e('0x27')][_0x50c896[_0xbf4e('0xde')]];this[_0xbf4e('0x1f')][_0x50c896[_0xbf4e('0xb8')]][_0xbf4e('0xe5')]+=0x1;var _0x1bca76=new AgentComplete(_0x24a82a,_0x50c896);if(_0x50c896[_0xbf4e('0x110')]===_0xbf4e('0x111')){_0x1bca76[_0xbf4e('0x112')]=this[_0xbf4e('0x1f')][_0x50c896[_0xbf4e('0xb8')]][_0xbf4e('0x113')]&&this[_0xbf4e('0x1f')][_0x50c896[_0xbf4e('0xb8')]][_0xbf4e('0x114')]?moment()['format'](_0xbf4e('0x108')):undefined;}this[_0xbf4e('0xcb')](_0x1bca76)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x115')));this[_0xbf4e('0xdc')](_0x1bca76)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x116')));}}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x2c')]=function(_0x343041){if(this[_0xbf4e('0x1f')][_0x343041[_0xbf4e('0xb8')]]){if(this[_0xbf4e('0x27')][_0x343041[_0xbf4e('0xde')]]&&this['uniqueId'][_0x343041['uniqueid']][_0xbf4e('0x4e')]!==_0xbf4e('0x7a')){this[_0xbf4e('0xb7')](this[_0xbf4e('0x1f')][_0x343041[_0xbf4e('0xb8')]]);this[_0xbf4e('0x27')][_0x343041[_0xbf4e('0xde')]][_0xbf4e('0x117')]=moment()[_0xbf4e('0x79')](_0xbf4e('0x108'));}}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x118')]=function(_0x25fbd8){this[_0xbf4e('0xcb')](_0x25fbd8)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x115')));this[_0xbf4e('0xdc')](_0x25fbd8)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x4edac6){var _0x58d8de=this[_0xbf4e('0x27')][_0x4edac6[_0xbf4e('0xde')]];var _0x140371=this;if(this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]]){if(_0x58d8de&&_0x58d8de[_0xbf4e('0x4e')]!==_0xbf4e('0x7a')){delete this[_0xbf4e('0x27')][_0x4edac6[_0xbf4e('0xde')]];this['updateOriginated'](this['voiceQueues'][_0x4edac6[_0xbf4e('0xb8')]]);_0x58d8de[_0xbf4e('0x119')]=moment()[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x8f3046=new QueueCallerAbandon(_0x58d8de,_0x4edac6);if(getSeconds(_0x58d8de[_0xbf4e('0x119')],_0x58d8de['responsetime'])>=_0x58d8de['dialQueueTimeout']){this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x81')]+=0x1;this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x64')]+=0x1;this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x6d')]+=0x1;_0x8f3046[_0xbf4e('0xaa')]=0xa;_0x8f3046[_0xbf4e('0xe6')]=_0xbf4e('0x11a');_0x8f3046[_0xbf4e('0x11b')]=_0xbf4e('0x11c');_0x8f3046['agiafterat']=this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x113')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x8f3046[_0xbf4e('0x106')]+=0x1;_0x8f3046['countglobal']+=0x1;if(_0x8f3046[_0xbf4e('0x106')]>=this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x11d')]){this[_0xbf4e('0x118')](_0x8f3046);}else{this[_0xbf4e('0xc1')]({'active':![],'countdropretry':_0x8f3046[_0xbf4e('0x106')],'scheduledat':moment()[_0xbf4e('0xf9')](this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]]['dialDropRetryFrequency'],_0xbf4e('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58d8de[_0xbf4e('0xfc')],'ListId':_0x58d8de['ListId'],'VoiceQueueId':_0x58d8de[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x58d8de[_0xbf4e('0xfd')]||undefined})['catch'](loggerCatch(_0xbf4e('0x11e')));var _0x438213=new History(_0x8f3046);_0x438213[_0xbf4e('0xaa')]=0xa;_0x438213[_0xbf4e('0xe6')]=_0xbf4e('0x11a');_0x438213[_0xbf4e('0x11f')]=moment()[_0xbf4e('0x79')](_0xbf4e('0x108'));_0x438213[_0xbf4e('0xab')]=_0x438213['starttime'];_0x438213[_0xbf4e('0x120')]=_0x8f3046['calleridname'];_0x438213[_0xbf4e('0x121')]=_0x8f3046[_0xbf4e('0x121')];this[_0xbf4e('0xcb')](_0x438213)['catch'](loggerCatch(_0xbf4e('0x122')));}}else{this['voiceQueues'][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x6b')]+=0x1;this[_0xbf4e('0x1f')][_0x4edac6['queue']][_0xbf4e('0x63')]+=0x1;_0x8f3046[_0xbf4e('0xaa')]=0xb;_0x8f3046['statedesc']=_0xbf4e('0x123');_0x8f3046['dropreason']=_0xbf4e('0x124');_0x8f3046[_0xbf4e('0xf2')]+=0x1;_0x8f3046[_0xbf4e('0x125')]+=0x1;if(_0x8f3046[_0xbf4e('0xf2')]>=this['voiceQueues'][_0x4edac6['queue']][_0xbf4e('0x126')]){this[_0xbf4e('0x118')](_0x8f3046);}else{this[_0xbf4e('0xc1')]({'active':![],'countabandonedretry':_0x8f3046['countabandonedretry'],'scheduledat':moment()[_0xbf4e('0xf9')](this[_0xbf4e('0x1f')][_0x4edac6[_0xbf4e('0xb8')]][_0xbf4e('0x127')],_0xbf4e('0xfb'))[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58d8de[_0xbf4e('0xfc')],'ListId':_0x58d8de[_0xbf4e('0xd2')],'VoiceQueueId':_0x58d8de[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x58d8de[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x128')));var _0x438213=new History(_0x8f3046);_0x438213['state']=0xb;_0x438213[_0xbf4e('0xe6')]=_0xbf4e('0x123');_0x438213['starttime']=moment()[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x438213[_0xbf4e('0xab')]=_0x438213['starttime'];_0x438213[_0xbf4e('0x120')]=_0x8f3046['calleridname'];_0x438213[_0xbf4e('0x121')]=_0x8f3046[_0xbf4e('0x121')];this[_0xbf4e('0xcb')](_0x438213)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x129')));}}}}};Dialer['prototype'][_0xbf4e('0x37')]=function(_0xc139e8){if(this['actions'][_0xc139e8[_0xbf4e('0xde')]]){this[_0xbf4e('0x25')][_0xc139e8[_0xbf4e('0xde')]][_0xbf4e('0xb4')]=_0xc139e8[_0xbf4e('0xb4')];}if(this[_0xbf4e('0x27')][_0xc139e8['uniqueid']]){this[_0xbf4e('0x27')][_0xc139e8['uniqueid']][_0xbf4e('0xb4')]=_0xc139e8['channel'];}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x12a')]=function(_0x40792c){if(strategy[this[_0xbf4e('0x1f')][this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]][_0xbf4e('0x4f')]]===_0xbf4e('0x1a')){if(this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]]&&_['isNil'](this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]][_0xbf4e('0x12c')])&&_0x40792c[_0xbf4e('0xb3')]==='1'&&_0x40792c[_0xbf4e('0x12d')]==='0'){if(this[_0xbf4e('0x21')][_0x40792c['stateinterface']]){if(!this['agents'][_0x40792c[_0xbf4e('0x12e')]]['locked']){this['agents'][_0x40792c[_0xbf4e('0x12e')]][_0xbf4e('0x12c')]=!![];this['actions'][_0x40792c['actionid']][_0xbf4e('0x12c')]=!![];this[_0xbf4e('0x25')][_0x40792c['actionid']][_0xbf4e('0x12e')]=_0x40792c[_0xbf4e('0x12e')];}}}}else if((strategy[this[_0xbf4e('0x1f')][this['actions'][_0x40792c['actionid']]['queue']][_0xbf4e('0x4f')]]||_0xbf4e('0x19'))===_0xbf4e('0x19')){if(this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]]){if(this[_0xbf4e('0x21')][_0x40792c[_0xbf4e('0x12e')]]){this['actions'][_0x40792c[_0xbf4e('0x12b')]]['stateinterface']=_0x40792c[_0xbf4e('0x12e')];if(_[_0xbf4e('0xb1')](this[_0xbf4e('0x2a')][this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]]['queue']])){this[_0xbf4e('0x2a')][this[_0xbf4e('0x25')][_0x40792c['actionid']]['queue']]=[];}this[_0xbf4e('0x2a')][this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]]['queue']]['push'](_['merge'](_['pick'](this[_0xbf4e('0x25')][_0x40792c[_0xbf4e('0x12b')]],[_0xbf4e('0x12f'),_0xbf4e('0x12e')]),{'status':_0x40792c['status'],'paused':_0x40792c[_0xbf4e('0x12d')]}));}}}};function unlockQueueStatus(_0x2283ba,_0xeacaf4){setTimeout(function(){if(_[_0xbf4e('0x3f')](_0x2283ba[_0xbf4e('0x130')])){loggerBooked['error'](_0xbf4e('0x131'),_0xeacaf4);}_0x2283ba[_0xbf4e('0x130')]=!![];loggerBooked[_0xbf4e('0x7c')](_0xbf4e('0x132'),_0xeacaf4,JSON[_0xbf4e('0x4c')](_[_0xbf4e('0xd1')](_0x2283ba,[_0xbf4e('0x42'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0xbf4e('0x3b')]=function(_0x4712ee){var _0x428f73=this;var _0x48ce0a=_0x428f73[_0xbf4e('0x1f')][_0x428f73[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]]['queue']];if(strategy[this[_0xbf4e('0x1f')][this['actions'][_0x4712ee[_0xbf4e('0x12b')]]['queue']][_0xbf4e('0x4f')]]===_0xbf4e('0x1a')){if(this[_0xbf4e('0x25')][_0x4712ee['actionid']]&&this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0x12e')]){this[_0xbf4e('0x1e')][_0xbf4e('0x133')](this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0x12f')],this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0x12e')])[_0xbf4e('0xb5')](function(_0x1af04c){logger[_0xbf4e('0x99')](_0xbf4e('0x134'),util[_0xbf4e('0x98')](_0x1af04c,{'showHidden':![],'depth':null}));})[_0xbf4e('0x1d')](function(){_0x428f73['updateOriginated'](_0x428f73[_0xbf4e('0x1f')][_0x428f73[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]]);_0x428f73['agents'][_0x428f73[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0x12e')]]['locked']=![];delete _0x428f73[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]];unlockQueueStatus(_0x48ce0a);});}else{this[_0xbf4e('0xb7')](this[_0xbf4e('0x1f')][this[_0xbf4e('0x25')][_0x4712ee['actionid']][_0xbf4e('0xb8')]]);this[_0xbf4e('0xc1')]({'active':![],'ContactId':this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xfc')],'ListId':this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xd2')],'VoiceQueueId':this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xd4')]||undefined,'CampaignId':this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xfd')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]];unlockQueueStatus(_0x48ce0a);}}else if((strategy[this[_0xbf4e('0x1f')][this['actions'][_0x4712ee['actionid']]['queue']]['strategy']]||'rrmemory')==='rrmemory'){var _0x18c138;if(this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]]&&!_['isEmpty'](this['queueBooked'][this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]])){if(this[_0xbf4e('0x135')][_0x428f73['actions'][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]]){this[_0xbf4e('0x135')][_0x428f73[_0xbf4e('0x25')][_0x4712ee['actionid']][_0xbf4e('0xb8')]]=this[_0xbf4e('0x135')][this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]]['queue']]?this[_0xbf4e('0x135')][this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]]:this[_0xbf4e('0x2a')][this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]]?this[_0xbf4e('0x2a')][this['actions'][_0x4712ee[_0xbf4e('0x12b')]][_0xbf4e('0xb8')]][_0xbf4e('0x136')]||0x0:0x0;}this[_0xbf4e('0x2a')][this[_0xbf4e('0x25')][_0x4712ee[_0xbf4e('0x12b')]]['queue']][_0xbf4e('0x136')]=this[_0xbf4e('0x135')][this['actions'][_0x4712ee[_0xbf4e('0x12b')]]['queue']];for(var _0x2210ed=0x0;_0x2210ed=0x0;})[_0xbf4e('0xb5')](myreject(_0x227fab)));}}else{_0x37a01d[_0xbf4e('0x14c')](ami[_0xbf4e('0xb2')]({'action':_0xbf4e('0x14d'),'command':util[_0xbf4e('0x79')](_0xbf4e('0x14f'),_0x1ae90c,!_[_0xbf4e('0x3f')](config[_0xbf4e('0x149')][_0x529679])?_0x529679:'')})['then'](function(_0x588d0e){return _0x588d0e['content'][_0xbf4e('0x14e')](_0xbf4e('0x150'))>=0x0;})['catch'](myreject(_0x227fab)));}BPromise[_0xbf4e('0x151')](_0x37a01d)[_0xbf4e('0x3e')](function(_0x454d46){var _0x13546c=_[_0xbf4e('0x152')](_0x454d46);if(_0x13546c){return _0xd37555(_0x13546c);}else{_0x28cf36[_0xbf4e('0x40')]=_0x3c2bdf?_0xbf4e('0x153'):_0xbf4e('0x154');return _0x227fab(msgResponse(_0xbf4e('0x155'),_0xbf4e('0x146'),'Global:\x20'+_0x3c2bdf+'\x20'+_0x15885e+_0xbf4e('0x156')+util['inspect'](_0x1ae90c,{'showHidden':![],'depth':null})+_0xbf4e('0x157')+_0x529679));}})[_0xbf4e('0xb5')](function(_0x5ddbf9){return _0x227fab(msgResponse(_0xbf4e('0x145'),_0xbf4e('0x146'),JSON[_0xbf4e('0x4c')](_0x5ddbf9)));});});};Dialer[_0xbf4e('0xac')][_0xbf4e('0x158')]=function(_0x16274c){var _0xa6261a=this;return function(){switch(_0x16274c['dialMethod']){case'progressive':freeVariablesPredictive(_0x16274c);_0xa6261a['handlePower'](_0x16274c,0x1);break;case _0xbf4e('0x159'):freeVariablesPredictive(_0x16274c);_0xa6261a['handlePower'](_0x16274c,_0x16274c[_0xbf4e('0x15a')]);break;case _0xbf4e('0xa'):_0xa6261a[_0xbf4e('0xa')](_0x16274c);break;case _0xbf4e('0x9'):freeVariablesPredictive(_0x16274c);_0xa6261a[_0xbf4e('0x15b')](_0x16274c,0x1);break;default:freeVariablesPredictive(_0x16274c);logger[_0xbf4e('0x99')](_0xbf4e('0x15c'),_0x16274c['name'],_0xbf4e('0x15d'));}};};Dialer[_0xbf4e('0xac')][_0xbf4e('0x15e')]=function(_0x3ba879){return BPromise[_0xbf4e('0xbb')]()['then'](cmHopper[_0xbf4e('0x15f')](_0x3ba879['id'],previewRecallmeReminderInterval))['then'](function(_0x41bd24){for(var _0x2da776=0x0;_0x2da776<_0x41bd24['length'];_0x2da776++){var _0x200179=_0x41bd24[_0x2da776][_0xbf4e('0x160')]['name'];if(_0x200179)io['to'](util[_0xbf4e('0x79')]('user:%s',_0x200179))['emit'](_0xbf4e('0x161'),{'hopper':_0x41bd24[_0x2da776]});}})[_0xbf4e('0xb5')](function(_0x30a1d0){});};Dialer[_0xbf4e('0xac')][_0xbf4e('0x162')]=function(_0x312912){var _0x3dbe38=this;return function(){_0x3dbe38['handleIvr'](_0x312912);};};Dialer['prototype'][_0xbf4e('0x33')]=function(_0x53b750){var _0x2ecfc1=this;if(isNotPreview(_0x53b750[_0xbf4e('0x5c')])){if(isVoiceQueueOutbound(_0x53b750['type'])&&isActive(_0x53b750[_0xbf4e('0x5b')])){_0x53b750[_0xbf4e('0xa3')]=!![];BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](checkIsLoggedIn(_0x53b750,_0x53b750[_0xbf4e('0x52')]))[_0xbf4e('0x3e')](checkIsActive(_0x53b750,_0x53b750[_0xbf4e('0x5b')]))[_0xbf4e('0x3e')](checkInterval(_0x53b750))[_0xbf4e('0x3e')](_0x2ecfc1[_0xbf4e('0x140')](_0x53b750))[_0xbf4e('0x3e')](_0x2ecfc1[_0xbf4e('0x144')](_0x53b750['dialGlobalInterval'],_0x53b750['dialTimezone'],_0x53b750[_0xbf4e('0x42')],_0x53b750))[_0xbf4e('0x3e')](_0x2ecfc1[_0xbf4e('0x163')](_0x53b750[_0xbf4e('0x45')],_0x53b750[_0xbf4e('0x164')],_0x53b750[_0xbf4e('0x42')],_0x53b750))['then'](_0x2ecfc1[_0xbf4e('0x158')](_0x53b750))[_0xbf4e('0xb5')](loggerCatchQueueSummary('[syncQueueSummary]',_0x53b750));}else{notSendMessagesQueue(_0x53b750);}}else{freeVariablesPredictive(_0x53b750);if(_0x53b750['dialPreviewRecallmeReminder']){_0x2ecfc1['checkPreviewRecallReminder'](_0x53b750);}}};Dialer[_0xbf4e('0xac')]['syncCampaigns']=function(){var _0x3adc6a=this;var _0x3acceb;for(var _0x51f13d in this['campaigns']){if(typeof this['campaigns'][_0x51f13d]!==_0xbf4e('0x9c')){_0x3acceb=this[_0xbf4e('0x20')][_0x51f13d];if(isCampaignIvr(_0x3acceb[_0xbf4e('0x4e')])&&isActive(_0x3acceb['active'])){_0x3acceb[_0xbf4e('0xa3')]=!![];BPromise[_0xbf4e('0xbb')]()[_0xbf4e('0x3e')](checkIsActive(_0x3acceb,_0x3acceb['active']))[_0xbf4e('0x3e')](checkInterval(_0x3acceb))[_0xbf4e('0x3e')](_0x3adc6a['checkIsTrunkReachable'](_0x3acceb))['then'](_0x3adc6a[_0xbf4e('0x144')](_0x3acceb[_0xbf4e('0x165')],_0x3acceb[_0xbf4e('0x164')],_0x3acceb[_0xbf4e('0x42')],_0x3acceb))[_0xbf4e('0x3e')](_0x3adc6a[_0xbf4e('0x163')](_0x3acceb[_0xbf4e('0x45')],_0x3acceb[_0xbf4e('0x164')],_0x3acceb[_0xbf4e('0x42')],_0x3acceb))['then'](_0x3adc6a[_0xbf4e('0x162')](_0x3acceb))['catch'](loggerCatchQueueSummary(_0xbf4e('0x166'),_0x3acceb));}else{notSendMessagesCampaign(_0x3acceb);}}}};function getCallerIdRandom(_0xcd7165,_0xd62d24){var _0x100f3d;var _0x51ddfa;var _0x52262e;if(_0xd62d24<=0x0){_0xd62d24=0x1;}_0x100f3d=new RegExp(_0xbf4e('0x167')+_0xd62d24+'}$');_0x51ddfa=Math['pow'](0xa,_0xd62d24-0x1);_0x52262e=Math['pow'](0xa,_0xd62d24)-0x1;return util[_0xbf4e('0x79')]('%s',_[_0xbf4e('0x168')](_0xcd7165,_0x100f3d,_['random'](_0x51ddfa,_0x52262e)));}function extractCalleridName(_0x840c37){var _0x5d94d0=_0x840c37['match'](/"(.*?)"/);return _0x5d94d0?_0x5d94d0[0x1]:_0x840c37;}function extractCalleridNumber(_0xee362){var _0x402fe7=_0xee362[_0xbf4e('0x169')](/<(.*?)>/);return _0x402fe7?_0x402fe7[0x1]:_0xee362;}Dialer[_0xbf4e('0xac')]['actionOriginate']=function(_0x383a80,_0x111604){var _0x48a9cc=this;var _0x28ad4e=uuid['v4']();this[_0xbf4e('0x25')][_0x28ad4e]=new Action(_0x383a80,_0x111604,_0x28ad4e);return new BPromise(function(_0x22cb05,_0x3818ad){if(_[_0xbf4e('0x3f')](_0x383a80)&&typeof _0x383a80!==_0xbf4e('0x16a')){return _0x3818ad(msgResponse(_0xbf4e('0x16b'),_0xbf4e('0x146'),_0xbf4e('0x16c')));}if(_['isUndefined'](_0x111604[_0xbf4e('0x16d')][_0xbf4e('0x16e')])||_0x111604[_0xbf4e('0x16d')][_0xbf4e('0x16e')]===null){return _0x3818ad(msgResponse(_0xbf4e('0x16b'),'Failure',_0xbf4e('0x16f')));}var _0x442338={'XMD-CALLERID':_0x48a9cc[_0xbf4e('0x25')][_0x28ad4e][_0xbf4e('0x170')](),'XMD-AGI':_0x383a80[_0xbf4e('0x10b')]?util['format'](_0xbf4e('0x171'),ipAgi,_0x383a80[_0xbf4e('0x10b')]):_0xbf4e('0x172'),'XMD-AGIAFTER':_0x383a80[_0xbf4e('0x113')]?util[_0xbf4e('0x79')](_0xbf4e('0x171'),ipAgi,_0x383a80['dialQueueProject2']):_0xbf4e('0x172'),'XMD-QUEUE':_0x383a80[_0xbf4e('0x4e')]===_0xbf4e('0x95')?util['format']('\x22%s,%s%s,,,%s\x22',_0x383a80[_0xbf4e('0x42')],_0x383a80[_0xbf4e('0x173')]||'',_0x383a80[_0xbf4e('0x114')]?'c':'',_0x383a80[_0xbf4e('0x174')]||0x3):_0xbf4e('0x172'),'XMD-CONTACTID':_0x111604[_0xbf4e('0xfc')],'XMD-CDRTYPE':_0xbf4e('0x8'),'CALLERID(all)':_0x48a9cc[_0xbf4e('0x25')][_0x28ad4e]['getCaller'](),'XMD-AMD':_0x383a80[_0xbf4e('0xe3')]?_0xbf4e('0x175'):_0xbf4e('0x172'),'XMD-DESTINATION':_0xbf4e('0xe2')};if(_0x383a80['dialAMDActive']){_0x442338[_0xbf4e('0x176')]=_0x383a80[_0xbf4e('0x177')]||0x9c4;_0x442338[_0xbf4e('0x178')]=_0x383a80[_0xbf4e('0x179')]||0x5dc;_0x442338[_0xbf4e('0x17a')]=_0x383a80[_0xbf4e('0x17b')]||0x320;_0x442338[_0xbf4e('0x17c')]=_0x383a80['dialAMDTotalAnalysisTime']||0x1388;_0x442338[_0xbf4e('0x17d')]=_0x383a80[_0xbf4e('0x17e')]||0x64;_0x442338[_0xbf4e('0x17f')]=_0x383a80[_0xbf4e('0x180')]||0x32;_0x442338[_0xbf4e('0x181')]=_0x383a80[_0xbf4e('0x182')]||0x3;_0x442338[_0xbf4e('0x183')]=_0x383a80[_0xbf4e('0x184')]||0x100;_0x442338[_0xbf4e('0x185')]=_0x383a80[_0xbf4e('0x186')]||0x1388;}if(_0x383a80['type']===_0xbf4e('0x95')){_0x442338[_0xbf4e('0x187')]=_0x111604['VoiceQueueId'];}else{_0x442338[_0xbf4e('0x188')]=_0x111604[_0xbf4e('0xfd')];}for(var _0x5877a6 in _0x111604['Contact']){if(typeof _0x111604['Contact'][_0x5877a6]!==_0xbf4e('0x9c')){if(isNotNull(_0x111604[_0xbf4e('0x16d')][_0x5877a6])&&_0x5877a6!=='id'&&_0x5877a6!=='tags'&&_0x5877a6!==_0xbf4e('0x189')&&_0x5877a6!=='updatedAt'){_0x442338[util['format'](_0xbf4e('0x18a'),_0xbf4e('0x18b'),_[_0xbf4e('0x18c')](_0x5877a6))]=_0x111604[_0xbf4e('0x16d')][_0x5877a6];}}}var _0x15ea3c=_0x48a9cc[_0xbf4e('0xd8')](_0x383a80[_0xbf4e('0x76')])?getCallerId(_0x383a80['Trunk'][_0xbf4e('0x78')],_0x383a80['dialOriginateCallerIdName'],_0x383a80['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x383a80[_0xbf4e('0x5e')],_0x383a80[_0xbf4e('0x18d')]):_0x383a80[_0xbf4e('0x5e')]):getCallerId(_[_0xbf4e('0xb1')](_0x383a80[_0xbf4e('0x141')])?_0x383a80[_0xbf4e('0x76')][_0xbf4e('0x78')]:_0x383a80[_0xbf4e('0x141')][_0xbf4e('0x78')],_0x383a80[_0xbf4e('0x5d')],_0x383a80['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x383a80[_0xbf4e('0x5e')],_0x383a80[_0xbf4e('0x18d')]):_0x383a80[_0xbf4e('0x5e')]);if(_0x15ea3c){_0x442338[_0xbf4e('0x18e')]=_0x48a9cc[_0xbf4e('0x25')][_0x28ad4e][_0xbf4e('0x18f')]=extractCalleridName(_0x15ea3c);_0x442338[_0xbf4e('0x190')]=_0x48a9cc[_0xbf4e('0x25')][_0x28ad4e][_0xbf4e('0x191')]=extractCalleridNumber(_0x15ea3c);}return ami['Action']({'actionid':_0x28ad4e,'action':_0xbf4e('0x16b'),'channel':_0x48a9cc['isTrunkReachable'](_0x383a80[_0xbf4e('0x76')])?util[_0xbf4e('0x79')](_0xbf4e('0x192'),_0x383a80[_0xbf4e('0x76')][_0xbf4e('0x42')],isNotNull(_0x383a80[_0xbf4e('0x5f')])?_0x383a80['dialPrefix'][_0xbf4e('0x193')]()||'':'',_0x383a80[_0xbf4e('0x194')]>0x0?_0x111604[_0xbf4e('0x16d')][_0xbf4e('0x16e')]['substring'](_0x383a80[_0xbf4e('0x194')]):_0x111604['Contact']['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x383a80[_0xbf4e('0x141')])?_0x383a80[_0xbf4e('0x76')]['name']:_0x383a80[_0xbf4e('0x141')][_0xbf4e('0x42')],isNotNull(_0x383a80[_0xbf4e('0x5f')])?_0x383a80[_0xbf4e('0x5f')][_0xbf4e('0x193')]()||'':'',_0x383a80[_0xbf4e('0x194')]>0x0?_0x111604[_0xbf4e('0x16d')][_0xbf4e('0x16e')][_0xbf4e('0x195')](_0x383a80[_0xbf4e('0x194')]):_0x111604[_0xbf4e('0x16d')][_0xbf4e('0x16e')]),'callerid':_0x15ea3c,'Exten':_0xbf4e('0xe2'),'Context':_0xbf4e('0x196'),'Priority':'1','variable':_0x442338,'timeout':(_0x383a80[_0xbf4e('0x197')]||0x1e)*0x3e8,'async':!![],'channelid':_0x28ad4e})[_0xbf4e('0x3e')](function(_0x5b9172){return _0x22cb05(_0x5b9172);})['catch'](function(_0x728e06){_0x383a80[_0xbf4e('0x198')]+=0x1;var _0x21e80a=new History(_0x48a9cc[_0xbf4e('0x25')][_0x28ad4e]);logger[_0xbf4e('0x99')](util[_0xbf4e('0x79')](_0xbf4e('0x199'),JSON['stringify'](_0x728e06)));_0x21e80a[_0xbf4e('0xaa')]=0xe;_0x21e80a['statedesc']=_0xbf4e('0x19a');_0x21e80a['starttime']=moment()[_0xbf4e('0x79')](_0xbf4e('0x108'));_0x21e80a[_0xbf4e('0xab')]=_0x21e80a[_0xbf4e('0x11f')];_0x48a9cc[_0xbf4e('0xcb')](_0x21e80a)['catch'](loggerCatch('[originate][error]'));_0x48a9cc[_0xbf4e('0xdc')](_0x21e80a)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x19b')))[_0xbf4e('0x1d')](function(){delete _0x48a9cc['actions'][_0x28ad4e];return _0x3818ad(msgResponse(_0xbf4e('0x16b'),_0xbf4e('0x4b'),_0xbf4e('0x19c')));});});});};Dialer[_0xbf4e('0xac')][_0xbf4e('0x19d')]=function(_0x2eb44c){var _0x2252c0=this['actions'][_0x2eb44c['actionid']];if(_0x2252c0){delete this[_0xbf4e('0x25')][_0x2eb44c[_0xbf4e('0x12b')]];_0x2252c0[_0xbf4e('0x19e')]=moment()[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x38a35a=_0x2252c0['type']===_0xbf4e('0x7a')?this[_0xbf4e('0x20')][_0x2252c0[_0xbf4e('0xb8')]]:this['voiceQueues'][_0x2252c0[_0xbf4e('0x19f')]()];if(!this[_0xbf4e('0xd7')](_0x2eb44c['response'])){this[_0xbf4e('0xb7')](_0x38a35a);return this[_0xbf4e('0x1a0')](_0x2252c0,_0x38a35a,_0x2eb44c)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1a1')));}this[_0xbf4e('0x27')][_0x2eb44c[_0xbf4e('0xde')]]=_0x2252c0;}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x1a2')]=function(_0x250d70,_0x59ff81,_0x1b733e){var _0x40fd89=new History(_0x59ff81);if(_0x40fd89[_0xbf4e('0xf0')]+_0x40fd89[_0xbf4e('0x105')]+_0x40fd89[_0xbf4e('0xf1')]+_0x40fd89[_0xbf4e('0x1a3')]+_0x40fd89[_0xbf4e('0x106')]+_0x40fd89[_0xbf4e('0xf2')]+_0x40fd89[_0xbf4e('0xee')]+_0x40fd89[_0xbf4e('0xf3')]>=_0x1b733e['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x250d70){case 0x3:if(_0x40fd89['countnoanswerretry']>=_0x1b733e[_0xbf4e('0x1a4')]-0x1){return!![];}this[_0xbf4e('0xc1')]({'active':![],'countnoanswerretry':_0x40fd89[_0xbf4e('0xf1')]+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0x1a5')],_0xbf4e('0xfb'))[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x40fd89['ContactId'],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})['catch'](loggerCatch(_0xbf4e('0x1a6')));break;case 0x5:if(_0x40fd89['countbusyretry']>=_0x1b733e[_0xbf4e('0x1a7')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x40fd89[_0xbf4e('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x1b733e['dialBusyRetryFrequency'],_0xbf4e('0xfb'))[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89['VoiceQueueId']||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1a8')));break;case 0x8:if(_0x40fd89[_0xbf4e('0x105')]>=_0x1b733e[_0xbf4e('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x40fd89[_0xbf4e('0x105')]+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0x1aa')],_0xbf4e('0xfb'))[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x40fd89['countnosuchnumberretry']>=_0x1b733e['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xbf4e('0xc1')]({'active':![],'countnosuchnumberretry':_0x40fd89['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0x1ab')],'minutes')[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89['VoiceQueueId']||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1ac')));}break;case 0xa:if(_0x40fd89[_0xbf4e('0x106')]>=_0x1b733e['dialDropMaxRetry']-0x1){return!![];}this[_0xbf4e('0xc1')]({'active':![],'countdropretry':_0x40fd89[_0xbf4e('0x106')]+=0x1,'scheduledat':moment()['add'](_0x1b733e['dialDropRetryFrequency'],_0xbf4e('0xfb'))[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x11e')));break;case 0xb:if(_0x40fd89[_0xbf4e('0xf2')]>=_0x1b733e[_0xbf4e('0x126')]-0x1){return!![];}this[_0xbf4e('0xc1')]({'active':![],'countabandonedretry':_0x40fd89[_0xbf4e('0xf2')]+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0x127')],_0xbf4e('0xfb'))[_0xbf4e('0x79')](_0xbf4e('0x108')),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89['ListId'],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x40fd89[_0xbf4e('0xee')]>=_0x1b733e[_0xbf4e('0x107')]-0x1){return!![];}this[_0xbf4e('0xc1')]({'active':![],'countmachineretry':_0x40fd89[_0xbf4e('0xee')]+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0xfa')],_0xbf4e('0xfb'))[_0xbf4e('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40fd89[_0xbf4e('0xfc')],'ListId':_0x40fd89['ListId'],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x40fd89[_0xbf4e('0xf3')]>=_0x1b733e['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x40fd89[_0xbf4e('0xf3')]+=0x1,'scheduledat':moment()[_0xbf4e('0xf9')](_0x1b733e[_0xbf4e('0x1ad')],_0xbf4e('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40fd89['ContactId'],'ListId':_0x40fd89[_0xbf4e('0xd2')],'VoiceQueueId':_0x40fd89[_0xbf4e('0xd4')]||undefined,'CampaignId':_0x40fd89[_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1ae')));break;default:return!![];}};Dialer[_0xbf4e('0xac')]['callProgressDetecting']=function(_0x41082d,_0x4d927f,_0x37d6b4){var _0x11bde9=this;var _0x39ced5=new History(_0x41082d);return new BPromise(function(_0xb92dd3,_0x161f5f){if(_[_0xbf4e('0x3f')](_0x4d927f)&&typeof _0x4d927f!==_0xbf4e('0x16a')){return _0x161f5f(msgResponse(_0xbf4e('0x1af'),_0xbf4e('0x146'),_0xbf4e('0x1b0')));}if(_[_0xbf4e('0x3f')](_0x37d6b4)&&typeof _0x37d6b4!=='object'){return _0x161f5f(msgResponse(_0xbf4e('0x1af'),_0xbf4e('0x146'),_0xbf4e('0x1b1')));}switch(_0x37d6b4[_0xbf4e('0x110')]){case'0':_0x4d927f[_0xbf4e('0x66')]+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0x0;_0x39ced5['statedesc']=_0xbf4e('0x1b2');_0x39ced5[_0xbf4e('0x1a3')]+=0x1;_0x39ced5[_0xbf4e('0x125')]+=0x1;ami['emit'](_0xbf4e('0x1b3'),ut['buildObj'](_0x41082d,_0xbf4e('0x1b4')));_0x11bde9[_0xbf4e('0xcb')](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x11bde9[_0xbf4e('0x1a2')](0x0,_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0x1a3')]>=_0x4d927f[_0xbf4e('0x1b5')]){_0x11bde9[_0xbf4e('0xf7')](_0x39ced5,_0xb92dd3,_0x161f5f,'reason\x200\x20no\x20such\x20number....');}else{_0x11bde9[_0xbf4e('0xf5')](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1b6'));}}break;case'3':_0x4d927f[_0xbf4e('0x65')]+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0x3;_0x39ced5[_0xbf4e('0xe6')]='NoAnswer';_0x39ced5[_0xbf4e('0xf1')]+=0x1;_0x39ced5[_0xbf4e('0x125')]+=0x1;ami[_0xbf4e('0xea')](_0xbf4e('0x1b7'),ut[_0xbf4e('0xeb')](_0x41082d,_0xbf4e('0x1b8')));_0x11bde9['createHistory'](_0x39ced5)['catch'](loggerCatch(_0xbf4e('0x1b9')));if(_0x11bde9[_0xbf4e('0x1a2')](0x3,_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0xf1')]>=_0x4d927f[_0xbf4e('0x1a4')]){_0x11bde9[_0xbf4e('0xf7')](_0x39ced5,_0xb92dd3,_0x161f5f,'reason\x203\x20ringing\x20no\x20answer');}else{_0x11bde9[_0xbf4e('0xf5')](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1ba'));}}break;case'5':_0x4d927f[_0xbf4e('0x1bb')]+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0x5;_0x39ced5[_0xbf4e('0xe6')]='Busy';_0x39ced5[_0xbf4e('0xf0')]+=0x1;_0x39ced5[_0xbf4e('0x125')]+=0x1;ami[_0xbf4e('0xea')](_0xbf4e('0x1bc'),ut[_0xbf4e('0xeb')](_0x41082d,_0xbf4e('0x1bd')));_0x11bde9['createHistory'](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x11bde9['checkRetriveMax'](0x5,_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0xf0')]>=_0x4d927f[_0xbf4e('0x1a7')]){_0x11bde9[_0xbf4e('0xf7')](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1be'));}else{_0x11bde9['stateGlobal'](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1be'));}}break;case'8':_0x4d927f[_0xbf4e('0x61')]+=0x1;_0x39ced5['state']=0x8;_0x39ced5[_0xbf4e('0xe6')]=_0xbf4e('0x1bf');_0x39ced5[_0xbf4e('0x105')]+=0x1;_0x39ced5['countglobal']+=0x1;ami[_0xbf4e('0xea')](_0xbf4e('0x1c0'),ut[_0xbf4e('0xeb')](_0x41082d,_0xbf4e('0x1c1')));_0x11bde9[_0xbf4e('0xcb')](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x11bde9[_0xbf4e('0x1a2')](0x8,_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0x105')]>=_0x4d927f[_0xbf4e('0x1a9')]){_0x11bde9['createStateFinal'](_0x39ced5,_0xb92dd3,_0x161f5f,'reason\x208\x20congestion');}else{_0x11bde9['stateGlobal'](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1c2'));}}break;case'11':_0x4d927f[_0xbf4e('0x1c3')]+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0xb;_0x39ced5[_0xbf4e('0xe6')]=_0xbf4e('0x123');_0x39ced5['countabandonedretry']+=0x1;_0x39ced5['countglobal']+=0x1;_0x11bde9[_0xbf4e('0xcb')](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x129')));if(_0x11bde9[_0xbf4e('0x1a2')](0xb,_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0xf2')]>=_0x4d927f[_0xbf4e('0x126')]){_0x11bde9[_0xbf4e('0xf7')](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1c4'));}else{_0x11bde9[_0xbf4e('0xf5')](_0x39ced5,_0xb92dd3,_0x161f5f,'reason\x2011\x20abandoned');}}break;case'20':_0x4d927f['outboundRejectCallsDay']+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0x14;_0x39ced5[_0xbf4e('0xe6')]=_0xbf4e('0x1c5');_0x39ced5['countagentrejectretry']+=0x1;_0x39ced5[_0xbf4e('0x125')]+=0x1;ami[_0xbf4e('0xea')]('custom:agentreject',ut['buildObj'](_0x41082d,_0xbf4e('0x1c6')));_0x11bde9['createHistory'](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1c7')));if(_0x11bde9[_0xbf4e('0x1a2')](0x14,_0x41082d,_0x4d927f)){if(_0x39ced5['countagentrejectretry']>=_0x4d927f['dialAgentRejectMaxRetry']){_0x11bde9['createStateFinal'](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1c8'));}else{_0x11bde9[_0xbf4e('0xf5')](_0x39ced5,_0xb92dd3,_0x161f5f,_0xbf4e('0x1c8'));}}break;default:_0x4d927f[_0xbf4e('0x68')]+=0x1;_0x39ced5[_0xbf4e('0xaa')]=0xc;_0x39ced5[_0xbf4e('0xe6')]=_0x37d6b4[_0xbf4e('0x110')];_0x11bde9[_0xbf4e('0xcb')](_0x39ced5)[_0xbf4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x11bde9['checkRetriveMax'](_0x37d6b4[_0xbf4e('0x110')],_0x41082d,_0x4d927f)){if(_0x39ced5[_0xbf4e('0xf0')]+_0x39ced5[_0xbf4e('0x105')]+_0x39ced5[_0xbf4e('0xf1')]+_0x39ced5['countnosuchnumberretry']+_0x39ced5[_0xbf4e('0x106')]+_0x39ced5[_0xbf4e('0xf2')]+_0x39ced5[_0xbf4e('0xee')]+_0x39ced5[_0xbf4e('0xf3')]>=_0x4d927f[_0xbf4e('0xf4')]){_0x11bde9[_0xbf4e('0xf5')](_0x39ced5,_0xb92dd3,_0x161f5f,_0x37d6b4['reason']);}else{_0x11bde9['createStateFinal'](_0x39ced5,_0xb92dd3,_0x161f5f,_0x37d6b4[_0xbf4e('0x110')]);}}}});};Dialer[_0xbf4e('0xac')]['stateGlobal']=function(_0x1d1ee9,_0x43b83d,_0xe66526,_0x5cec85){var _0x1beedd=new Final(_0x1d1ee9);_0x1beedd[_0xbf4e('0xaa')]=0xf;_0x1beedd['statedesc']=_0xbf4e('0x1c9');this['createStateFinal'](_0x1beedd,_0x43b83d,_0xe66526,_0x5cec85);};Dialer[_0xbf4e('0xac')][_0xbf4e('0xf7')]=function(_0x13cf3a,_0x1ed07d,_0x2883c1,_0x4f08a5){this[_0xbf4e('0xdc')](_0x13cf3a)[_0xbf4e('0x3e')](function(){return _0x1ed07d(msgResponse('[callProgressDetecting]','Success',_0x4f08a5));})['catch'](function(){return _0x2883c1(msgResponse(_0xbf4e('0x1ca'),_0xbf4e('0x146'),_0xbf4e('0x1cb')));});};Dialer[_0xbf4e('0xac')][_0xbf4e('0xa')]=function(_0x2a431d){var _0x5dec58=_0x2a431d[_0xbf4e('0x1cc')]/0x64;var _0xd9d051=_0x2a431d['outboundDropCallsDayTimeout']/(_0x2a431d[_0xbf4e('0x64')]+_0x2a431d['outboundAnswerCallsDay']);var _0x1f1cc9=Math['round'](_0x2a431d[_0xbf4e('0x70')]*(_0x2a431d[_0xbf4e('0x1cd')]/0x64));var _0x7ad379=Math['round'](_0x2a431d[_0xbf4e('0x70')]*(_0x2a431d[_0xbf4e('0x1ce')]/0x64));var _0x1e6800=_0x2a431d[_0xbf4e('0x51')]+_0x2a431d[_0xbf4e('0x56')];var _0x55b44f=Math[_0xbf4e('0x1cf')](_0x2a431d[_0xbf4e('0x89')]*_0x2a431d['erlangAbandonmentRate']*_0x2a431d[_0xbf4e('0x6e')]*_0x2a431d[_0xbf4e('0x6f')]);if(_[_0xbf4e('0x3f')](_0x2a431d['startProgressive'])){if(!_[_0xbf4e('0x3f')](_0x2a431d['startPredictive'])){_0x2a431d[_0xbf4e('0x74')]=undefined;loggerPredictive[_0xbf4e('0x99')](_0xbf4e('0x1d0'),_0xbf4e('0x1d1'));}if(!_[_0xbf4e('0x3f')](_0x2a431d[_0xbf4e('0x1d2')])){loggerPredictive['error'](_0xbf4e('0x1d0'),_0xbf4e('0x1d3'));clearInterval(_0x2a431d[_0xbf4e('0x1d2')]);_0x2a431d[_0xbf4e('0x1d2')]=undefined;}_0x2a431d[_0xbf4e('0x75')]=moment()[_0xbf4e('0x79')](_0xbf4e('0x108'));loggerPredictive[_0xbf4e('0x7c')](_0x2a431d[_0xbf4e('0x42')],_0xbf4e('0x1d4'),_0x2a431d['startProgressive']);this[_0xbf4e('0x15b')](_0x2a431d,0x1);}else if(ifInterval(_0x2a431d['dialPredictiveInterval'],_0x2a431d[_0xbf4e('0x75')])){this[_0xbf4e('0x15b')](_0x2a431d,0x1);loggerPredictiveCalls['info'](_0xbf4e('0x1d5'),_0x2a431d[_0xbf4e('0x75')],_0x2a431d[_0xbf4e('0x42')]);_0x2a431d[_0xbf4e('0x89')]=0x0;_0x2a431d['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5dec58<_0xd9d051&&_0x2a431d[_0xbf4e('0x1d6')]===_0xbf4e('0x1d7')){freeVariablesPredictive(_0x2a431d);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x1d8'),'Dropped\x20calls\x20day',_0xd9d051,'startProgressive',_0x2a431d[_0xbf4e('0x42')]);}else if(_0x55b44f<_0x2a431d[_0xbf4e('0x6d')]&&_0x2a431d['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x2a431d);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x1d9'),_0xbf4e('0x1da'),_0x55b44f,_0xbf4e('0x1db'),_0x2a431d[_0xbf4e('0x6d')],_0xbf4e('0x75'),_0x2a431d[_0xbf4e('0x42')]);}else if(!ifInterval(_0x2a431d[_0xbf4e('0x1dc')],_0x2a431d[_0xbf4e('0x75')])&&_[_0xbf4e('0x3f')](_0x2a431d['startPredictive'])&&!_[_0xbf4e('0x3f')](_0x2a431d[_0xbf4e('0x75')])){_0x2a431d[_0xbf4e('0x74')]=moment()['format'](_0xbf4e('0x108'));loggerPredictive['info'](_0x2a431d[_0xbf4e('0x42')],_0xbf4e('0x1dd'),_0x2a431d[_0xbf4e('0x74')]);this[_0xbf4e('0x1de')](_0x2a431d['dialPredictiveInterval'])[_0xbf4e('0x3e')](this[_0xbf4e('0x1df')](_0x2a431d))[_0xbf4e('0x3e')](mergeDataErlangB(_0x2a431d))['then'](this[_0xbf4e('0x1e0')](_0x2a431d))[_0xbf4e('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2a431d));}else if(!ifInterval(_0x2a431d['dialPredictiveInterval'],_0x2a431d[_0xbf4e('0x74')])){_0x2a431d['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2a431d[_0xbf4e('0x74')]=moment()[_0xbf4e('0x79')](_0xbf4e('0x108'));loggerPredictive[_0xbf4e('0x7c')](_0x2a431d[_0xbf4e('0x42')],_0xbf4e('0x1e1'),_0x2a431d['startPredictive']);clearInterval(_0x2a431d[_0xbf4e('0x1d2')]);_0x2a431d[_0xbf4e('0x1d2')]=undefined;this[_0xbf4e('0x1de')](_0x2a431d['dialPredictiveInterval'])[_0xbf4e('0x3e')](this['getDataPredictive'](_0x2a431d))[_0xbf4e('0x3e')](mergeDataErlangB(_0x2a431d))[_0xbf4e('0x3e')](this[_0xbf4e('0x1e0')](_0x2a431d))['catch'](loggerCatchPredictive(_0xbf4e('0x1e2'),_0x2a431d));}else if(_0x2a431d[_0xbf4e('0x70')]&&_0x1e6800<_0x2a431d['predictiveIntervalAvailable']-_0x7ad379){freeVariablesPredictive(_0x2a431d);loggerPredictive[_0xbf4e('0x7c')](_0x2a431d['name'],_0xbf4e('0x1e3'),_0x1e6800,_0xbf4e('0x1e4'),_0x2a431d['predictiveIntervalAvailable'],'-',_0x7ad379,'=',_0x2a431d[_0xbf4e('0x70')]-_0x7ad379,')');}else if(_0x2a431d[_0xbf4e('0x70')]&&_0x1e6800>_0x2a431d[_0xbf4e('0x70')]+_0x1f1cc9){freeVariablesPredictive(_0x2a431d);loggerPredictive[_0xbf4e('0x7c')](_0x2a431d[_0xbf4e('0x42')],_0xbf4e('0x1e3'),_0x1e6800,_0xbf4e('0x1e5'),_0x2a431d[_0xbf4e('0x70')],'+',_0x1f1cc9,'=',_0x2a431d[_0xbf4e('0x70')]+_0x1f1cc9,')');}};Dialer['prototype'][_0xbf4e('0x1df')]=function(_0x5f0fb7){var _0x2d5d2c=this;return function(_0x68cd8d){return new BPromise(function(_0x31a3e2,_0x1e55bc){_[_0xbf4e('0x8f')](_0x5f0fb7,_0x68cd8d[0x0]);if(checkGetDataPredictive(_0x68cd8d[0x0])){var _0x2fd481=_0x5f0fb7[_0xbf4e('0x70')]=_0x5f0fb7[_0xbf4e('0x56')]+_0x5f0fb7[_0xbf4e('0x51')];var _0x5ac03a=_0x5f0fb7[_0xbf4e('0x1dc')]*0x3c;var _0x1008ac=_0x68cd8d[0x0][_0xbf4e('0x6a')]+_0x68cd8d[0x0][_0xbf4e('0x84')];var _0x28d67b=(_0x68cd8d[0x0][_0xbf4e('0x69')]+_0x68cd8d[0x0][_0xbf4e('0x81')]+_0x68cd8d[0x0][_0xbf4e('0x6b')])/_0x68cd8d[0x0][_0xbf4e('0x7f')];_0x5f0fb7[_0xbf4e('0x6e')]=_0x28d67b>0x0?_0x28d67b:0x1;switch(_0x5f0fb7['dialPredictiveOptimization']){case _0xbf4e('0x1d7'):var _0x5d59fe=_0x5f0fb7[_0xbf4e('0x1cc')]/0x64;return _0x2d5d2c[_0xbf4e('0x1e6')](_0x2fd481,_0x5ac03a,_0x1008ac,_0x28d67b,_0x5d59fe)['then'](function(_0x5e771d){return _0x31a3e2(_0x5e771d);});case _0xbf4e('0x1e7'):var _0x2f6908=_0x5f0fb7[_0xbf4e('0x1cc')]/0x64;return _0x2d5d2c[_0xbf4e('0x1e8')](_0x2fd481,_0x5ac03a,_0x1008ac,_0x28d67b,_0x2f6908)[_0xbf4e('0x3e')](function(_0x3b37f6){return _0x31a3e2(_0x3b37f6);});default:return _0x1e55bc(msgResponse(_0xbf4e('0x1e9'),_0xbf4e('0x146'),'Unknown\x20Predictive'));}}else{return _0x1e55bc(msgResponse(_0xbf4e('0x1e9'),_0xbf4e('0x146'),'check\x20failure'));}});};};Dialer['prototype'][_0xbf4e('0x1ea')]=function(_0x38f5b2){var _0x2bb62d=this;return function(_0x5be6c5){return new BPromise(function(_0x5c9f5e,_0x5b9546){_[_0xbf4e('0x8f')](_0x38f5b2,_0x5be6c5[0x0]);if(checkGetDataPredictive(_0x5be6c5[0x0])){loggerPredictive['info'](JSON[_0xbf4e('0x4c')](_0x5be6c5[0x0]));if(_0x38f5b2[_0xbf4e('0x1d6')]===_0xbf4e('0x1d7')){return _0x2bb62d['getVoiceQueueRtPauses'](_0x38f5b2['id'])[_0xbf4e('0x3e')](function(_0x284493){var _0x2087dd=_0x38f5b2[_0xbf4e('0x52')]-_0x284493[0x0][_0xbf4e('0x1eb')];var _0x2cb073=_0x38f5b2[_0xbf4e('0x1dc')]*0x3c;var _0x5e5991=_0x5be6c5[0x0][_0xbf4e('0x6a')]+_0x5be6c5[0x0][_0xbf4e('0x84')];var _0x188df1=(_0x5be6c5[0x0][_0xbf4e('0x69')]+_0x5be6c5[0x0][_0xbf4e('0x81')]+_0x5be6c5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5be6c5[0x0]['predictiveIntervalTotalCalls'];var _0x4f1f1d=_0x38f5b2['dialPredictiveOptimizationPercentage']/0x64;_0x38f5b2[_0xbf4e('0x1ec')]=_0x284493[0x0][_0xbf4e('0x1eb')]||0x0;_0x38f5b2['predictiveIntervalHitRate']=_0x188df1>0x0?_0x188df1:0x1;return _0x2bb62d[_0xbf4e('0x1e6')](_0x2087dd,_0x2cb073,_0x5e5991,_0x188df1,_0x4f1f1d);})[_0xbf4e('0x3e')](function(_0x2c37ee){return _0x5c9f5e(_0x2c37ee);})[_0xbf4e('0xb5')](function(_0x5e18b1){return _0x5b9546(msgResponse('[CatchErlangB]',_0xbf4e('0x146'),JSON[_0xbf4e('0x4c')](_0x5e18b1)));});}if(_0x38f5b2[_0xbf4e('0x1d6')]===_0xbf4e('0x1e7')){return _0x2bb62d[_0xbf4e('0xc9')](_0x38f5b2['id'])[_0xbf4e('0x3e')](function(_0x5476e3){var _0x5a1deb=_0x38f5b2[_0xbf4e('0x52')]-_0x5476e3[0x0][_0xbf4e('0x1eb')];var _0x4ae16b=_0x38f5b2[_0xbf4e('0x1dc')]*0x3c;var _0x53db67=_0x5be6c5[0x0][_0xbf4e('0x6a')]+_0x5be6c5[0x0][_0xbf4e('0x84')];var _0x78e701=(_0x5be6c5[0x0][_0xbf4e('0x69')]+_0x5be6c5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5be6c5[0x0][_0xbf4e('0x6b')])/_0x5be6c5[0x0]['predictiveIntervalTotalCalls'];var _0x263d44=_0x38f5b2['dialPredictiveOptimizationPercentage']/0x64;_0x38f5b2[_0xbf4e('0x1ec')]=_0x5476e3[0x0]['outboundQueuePauses']||0x0;_0x38f5b2[_0xbf4e('0x6e')]=_0x78e701>0x0?_0x78e701:0x1;return _0x2bb62d['busyFactor'](_0x5a1deb,_0x4ae16b,_0x53db67,_0x78e701,_0x263d44);})[_0xbf4e('0x3e')](function(_0x408302){return _0x5c9f5e(_0x408302);})[_0xbf4e('0xb5')](function(_0x4bb1cf){return _0x5b9546(msgResponse(_0xbf4e('0x1ed'),'Failure',JSON[_0xbf4e('0x4c')](_0x4bb1cf)));});}}else{return _0x5b9546(msgResponse(_0xbf4e('0x1e9'),'Failure',_0xbf4e('0x1ee')));}});};};Dialer[_0xbf4e('0xac')]['startMethodPredictive']=function(_0x562010){var _0x54a0dd=this;return function(){var _0x3ffb9b=0x0;var _0x11287e=Math[_0xbf4e('0x1cf')](_0x562010[_0xbf4e('0x72')]*0x3e8);if(_0x11287e>0x0){_0x11287e=_0x11287e<0x64?0x64:_0x11287e;loggerPredictive[_0xbf4e('0x7c')](_0x562010[_0xbf4e('0x42')],_0xbf4e('0x1ef'),_0x11287e,_0xbf4e('0x90'));_0x562010[_0xbf4e('0x1d2')]=setInterval(function(){_0x54a0dd['handlePredictive'](_0x562010);loggerPredictiveCalls[_0xbf4e('0x7c')]('[handlePredictive]',_0x3ffb9b+=0x1);},_0x11287e);}else{loggerPredictive[_0xbf4e('0x7c')](_0x562010[_0xbf4e('0x42')],_0xbf4e('0x1f0'));}};};Dialer[_0xbf4e('0xac')][_0xbf4e('0x1f1')]=function(_0x1963b8,_0x5da5f7){var _0x5715dc=this;return function(_0x256f7e){if(_['isEmpty'](_0x256f7e)){if(_[_0xbf4e('0xb1')](_0x5da5f7[_0xbf4e('0xd3')])||!_0x5da5f7[_0xbf4e('0x1f2')]){if(_0x1963b8[_0xbf4e('0x5c')]===_0xbf4e('0x9')){_0x1963b8[_0xbf4e('0x130')]=_[_0xbf4e('0x3f')](_0x1963b8['queueStatusComplete'])?!![]:_0x1963b8[_0xbf4e('0x130')];var _0x9224a6=uuid['v4']();_0x5715dc['actions'][_0x9224a6]=new Action(_0x1963b8,_0x5da5f7,_0x9224a6);loggerBooked[_0xbf4e('0x7c')](_0xbf4e('0x1f3'),_0x9224a6,_0xbf4e('0x1f4'),JSON[_0xbf4e('0x4c')](_0x1963b8[_0xbf4e('0x130')]),_0xbf4e('0x1f5'),_0x1963b8[_0xbf4e('0x42')]);if(_0x1963b8[_0xbf4e('0x130')]){_0x1963b8[_0xbf4e('0x130')]=![];_0x5715dc['queueBooked'][_0x5715dc[_0xbf4e('0x25')][_0x9224a6]['queue']]=[];ami['Action']({'actionid':_0x9224a6,'action':_0xbf4e('0x1f6'),'queue':_0x1963b8[_0xbf4e('0x42')]})[_0xbf4e('0xb5')](function(){_0x5715dc[_0xbf4e('0xb7')](_0x1963b8);_0x5715dc[_0xbf4e('0xc1')]({'active':![],'ContactId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6][_0xbf4e('0xfc')],'ListId':_0x5715dc['actions'][_0x9224a6]['ListId'],'VoiceQueueId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6]['VoiceQueueId']||undefined,'CampaignId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6][_0xbf4e('0xfd')]||undefined})[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1f7')));delete _0x5715dc[_0xbf4e('0x25')][_0x9224a6];});}else{loggerBooked[_0xbf4e('0x7c')](_0xbf4e('0x1f8'),JSON['stringify'](_0x1963b8['queueStatusComplete']),_0xbf4e('0x1f5'),_0x1963b8[_0xbf4e('0x42')]);_0x5715dc[_0xbf4e('0xb7')](_0x1963b8);_0x5715dc['rescheduleContact']({'active':![],'ContactId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6][_0xbf4e('0xfc')],'ListId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6][_0xbf4e('0xd2')],'VoiceQueueId':_0x5715dc['actions'][_0x9224a6]['VoiceQueueId']||undefined,'CampaignId':_0x5715dc[_0xbf4e('0x25')][_0x9224a6][_0xbf4e('0xfd')]||undefined})['catch'](loggerCatch(_0xbf4e('0x1f7')));delete _0x5715dc[_0xbf4e('0x25')][_0x9224a6];}}else{return _0x5715dc[_0xbf4e('0x1f9')](_0x1963b8,_0x5da5f7);}}else{if(getDiff(_0x5da5f7[_0xbf4e('0x1fa')])<_0x1963b8['dialRecallMeTimeout']*0x3c){if(_0x5da5f7['Agent']&&!_0x5da5f7[_0xbf4e('0x160')]['voicePause']){_0x5715dc[_0xbf4e('0x1e')][_0xbf4e('0x133')](_0x5da5f7['id'])['finally'](function(){_0x5715dc[_0xbf4e('0xb7')](_0x1963b8);});}else{_0x5715dc[_0xbf4e('0xc2')]({'active':![]},_0x5da5f7['id'],0x1)[_0xbf4e('0x1d')](function(){_0x5715dc[_0xbf4e('0xb7')](_0x1963b8);});}}else{_0x1963b8['outboundReCallsDay']+=0x1;_0x5715dc['updateOriginated'](_0x1963b8);if(_0x1963b8[_0xbf4e('0x1fb')]){_0x5715dc['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5da5f7['ContactId'],'ListId':_0x5da5f7[_0xbf4e('0xd2')],'VoiceQueueId':_0x5da5f7['VoiceQueueId']||undefined,'CampaignId':_0x5da5f7['CampaignId']||undefined})[_0xbf4e('0xb5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x5715dc[_0xbf4e('0xcb')](createObjHistory(_0x1963b8,_0x5da5f7,_0xbf4e('0x1fc'),0x17,_0xbf4e('0x1fd')))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x1fe')));}else{_0x5715dc[_0xbf4e('0xd0')](createObjHistory(_0x1963b8,_0x5da5f7,_0xbf4e('0x1ff'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xbf4e('0x200'));}}}}else{_0x1963b8[_0xbf4e('0x201')]+=0x1;_0x5715dc[_0xbf4e('0xd0')](createObjHistory(_0x1963b8,_0x5da5f7,_0xbf4e('0x202'),0xd,_0xbf4e('0x203')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xbf4e('0x204');}};};Dialer['prototype'][_0xbf4e('0x205')]=function(_0x14edae){var _0xfd9fd8=this;var _0x23a353=_0x14edae[_0xbf4e('0x206')]-_0x14edae[_0xbf4e('0x71')]-_0x14edae[_0xbf4e('0xc5')];emitCampaignSummary(_0x14edae);if(_0x23a353>0x0){if(_0x23a353>this[_0xbf4e('0x23')]){_0x23a353=this[_0xbf4e('0x23')];}_0x14edae[_0xbf4e('0xc5')]+=_0x23a353;this[_0xbf4e('0xc7')](_0x14edae['id'],_0x23a353,_0x14edae['dialOrderByScheduledAt'],_0x14edae)['then'](function(_0x6b7326){_0x14edae[_0xbf4e('0xc5')]-=_0x23a353;_0x14edae['temp']=_0x14edae[_0xbf4e('0xc5')]>0x0?_0x14edae[_0xbf4e('0xc5')]:0x0;if(!checkContactEmpty(_0x6b7326)){_0x14edae['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xbf4e('0x7c')](_0xbf4e('0x207')+_0x14edae[_0xbf4e('0x42')]);}else{_0x14edae[_0xbf4e('0x71')]+=_0x6b7326['length'];_0x14edae['message']='RUNNING';for(var _0x29e4b5=0x0;_0x29e4b5<_0x6b7326['length'];_0x29e4b5+=0x1){_0x14edae[_0xbf4e('0x208')]+=0x1;if(_[_0xbf4e('0xb1')](_0x6b7326[_0x29e4b5])||_[_0xbf4e('0xb1')](_0x6b7326[_0x29e4b5]['Contact'])||_[_0xbf4e('0xb1')](_0x6b7326[_0x29e4b5][_0xbf4e('0x16d')][_0xbf4e('0x16e')])){_0xfd9fd8[_0xbf4e('0xcf')](_0xbf4e('0x209'),_0x14edae,_0x6b7326[_0x29e4b5]);}else{_0xfd9fd8['checkIsBlackListIvr'](_[_0xbf4e('0xd1')](_0x6b7326[_0x29e4b5],[_0xbf4e('0xfd'),'Contact.phone']))['then'](_0xfd9fd8[_0xbf4e('0x1f1')](_0x14edae,_0x6b7326[_0x29e4b5]))[_0xbf4e('0xb5')](_0xfd9fd8[_0xbf4e('0xce')](_0xbf4e('0x20a'),_0x14edae));}}}})['catch'](loggerGetContactDialer(_0xbf4e('0x20b'),_0x14edae,_0x23a353));}};Dialer[_0xbf4e('0xac')]['handlePower']=function(_0x2607b9,_0x139fe2){var _0x50d3f1=this;var _0x3b00d2=[];var _0x4ca126=_0x139fe2>=0x1?_0x139fe2:0x1;if(_0x2607b9['dialMethod']===_0xbf4e('0x9')){_0x4ca126=0x1;}var _0x37ba94=Math[_0xbf4e('0x1cf')](_0x2607b9[_0xbf4e('0x51')]*_0x4ca126)-_0x2607b9[_0xbf4e('0x71')]-_0x2607b9[_0xbf4e('0xc5')];emitVoiceQueueSummary(_0x2607b9);if(_0x2607b9[_0xbf4e('0x20c')]>0x0){var _0xc1e1e=_0x2607b9['dialLimitQueue']-_0x2607b9['originated']-_0x2607b9[_0xbf4e('0x56')]-_0x2607b9[_0xbf4e('0xc5')]-_0x2607b9[_0xbf4e('0x53')];if(_0x37ba94>_0xc1e1e){_0x37ba94=_0xc1e1e;}}if(_0x37ba94>0x0){if(_0x2607b9[_0xbf4e('0x5c')]==='booked'){_0x37ba94=0x1;}if(_0x37ba94>this[_0xbf4e('0x23')]){_0x37ba94=this['maxNumberOriginate'];}_0x2607b9[_0xbf4e('0xc5')]+=_0x37ba94;for(var _0x19b800 in this[_0xbf4e('0x21')]){if(typeof this['agents'][_0x19b800]!==_0xbf4e('0x9c')){if(this[_0xbf4e('0x21')][_0x19b800][_0xbf4e('0xaa')]===_0xbf4e('0x20d')&&this['agents'][_0x19b800][_0xbf4e('0xb3')]==='reachable'){_0x3b00d2['push'](this[_0xbf4e('0x21')][_0x19b800]['id']);}}}this['getContactDialer'](_0x2607b9['id'],_0x3b00d2,_0x37ba94,_0x2607b9['dialOrderByScheduledAt'],_0x2607b9)[_0xbf4e('0x3e')](function(_0xd4a506){_0x2607b9['temp']-=_0x37ba94;_0x2607b9[_0xbf4e('0xc5')]=_0x2607b9[_0xbf4e('0xc5')]>0x0?_0x2607b9['temp']:0x0;if(!checkContactEmpty(_0xd4a506)){_0x50d3f1[_0xbf4e('0xba')](_0x2607b9)['then'](sendMessageReschedule(_0x2607b9))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x20e')));}else{_0x2607b9['originated']+=_0xd4a506['length'];_0x2607b9[_0xbf4e('0x40')]=_0x2607b9[_0xbf4e('0x5c')]===_0xbf4e('0x9')?_0xbf4e('0x175'):'RUNNING';for(var _0x23522a=0x0;_0x23522a<_0xd4a506[_0xbf4e('0x9b')];_0x23522a+=0x1){if(_[_0xbf4e('0xb1')](_0xd4a506[_0x23522a])||_[_0xbf4e('0xb1')](_0xd4a506[_0x23522a][_0xbf4e('0x16d')])||_[_0xbf4e('0xb1')](_0xd4a506[_0x23522a][_0xbf4e('0x16d')][_0xbf4e('0x16e')])){_0x50d3f1[_0xbf4e('0xcf')](_0xbf4e('0x209'),_0x2607b9,_0xd4a506[_0x23522a]);}else{_0x50d3f1[_0xbf4e('0xbc')](_['pick'](_0xd4a506[_0x23522a],[_0xbf4e('0xd4'),_0xbf4e('0x20f')]))[_0xbf4e('0x3e')](_0x50d3f1[_0xbf4e('0x1f1')](_0x2607b9,_0xd4a506[_0x23522a]))[_0xbf4e('0xb5')](_0x50d3f1[_0xbf4e('0xce')](_0xbf4e('0x209'),_0x2607b9));}}}})[_0xbf4e('0xb5')](loggerGetContactDialer(_0xbf4e('0x210'),_0x2607b9,_0x37ba94));}};Dialer[_0xbf4e('0xac')]['handlePredictive']=function(_0x3e6fd3){if(_0x3e6fd3['dialLimitQueue']>0x0){var _0x5c1c59=_0x3e6fd3[_0xbf4e('0x20c')]-_0x3e6fd3['originated']-_0x3e6fd3[_0xbf4e('0x56')];if(_0x5c1c59>0x0){this[_0xbf4e('0x211')](_0x3e6fd3);}else{loggerPredictiveCalls[_0xbf4e('0x7c')](_0xbf4e('0x212'));}}else{this['tryOriginatePredictive'](_0x3e6fd3);}};Dialer[_0xbf4e('0xac')][_0xbf4e('0x211')]=function(_0x3a0215){var _0x42c638=this;var _0x10dbbf=[];_0x3a0215[_0xbf4e('0x71')]+=0x1;for(var _0x407331 in this['agents']){if(typeof this['agents'][_0x407331]!==_0xbf4e('0x9c')){if(this[_0xbf4e('0x21')][_0x407331][_0xbf4e('0xaa')]===_0xbf4e('0x20d')&&this['agents'][_0x407331]['status']===_0xbf4e('0xd9')){_0x10dbbf['push'](this['agents'][_0x407331]['id']);}}}this[_0xbf4e('0xc4')](_0x3a0215['id'],_0x10dbbf,0x1,_0x3a0215[_0xbf4e('0x213')],_0x3a0215)[_0xbf4e('0x3e')](function(_0x21e79c){if(!checkContactEmpty(_0x21e79c)){checkContactLowerLimitOriginate(_0x3a0215,0x1,0x0);_0x42c638[_0xbf4e('0xba')](_0x3a0215)[_0xbf4e('0x3e')](sendMessageReschedule(_0x3a0215))[_0xbf4e('0xb5')](loggerCatch(_0xbf4e('0x20e')));}else{_0x3a0215[_0xbf4e('0x40')]='RUNNING';if(_[_0xbf4e('0xb1')](_0x21e79c[0x0])||_[_0xbf4e('0xb1')](_0x21e79c[0x0]['Contact'])||_[_0xbf4e('0xb1')](_0x21e79c[0x0][_0xbf4e('0x16d')][_0xbf4e('0x16e')])){_0x42c638[_0xbf4e('0xcf')](_0xbf4e('0x209'),_0x3a0215,_0x21e79c[0x0]);}else{_0x42c638[_0xbf4e('0xbc')](_[_0xbf4e('0xd1')](_0x21e79c[0x0],[_0xbf4e('0xd4'),_0xbf4e('0x20f')]))[_0xbf4e('0x3e')](_0x42c638[_0xbf4e('0x1f1')](_0x3a0215,_0x21e79c[0x0]))['catch'](_0x42c638[_0xbf4e('0xce')](_0xbf4e('0x214'),_0x3a0215));}}})['catch'](loggerGetContactDialer(_0xbf4e('0x215'),_0x3a0215,0x1));emitVoiceQueueSummary(_0x3a0215);};Dialer['prototype'][_0xbf4e('0x1e6')]=function(_0xa721e7,_0x27733d,_0x5f2ab8,_0x1186ba,_0x4f6f2c,_0x38d213){loggerPredictive[_0xbf4e('0x7c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x216'),_0xa721e7);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x217'),_0x27733d);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x218'),_0x5f2ab8);loggerPredictive['info'](_0xbf4e('0x219'),_0x1186ba);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x21a'),_0x4f6f2c);loggerPredictive[_0xbf4e('0x7c')]('---------------------------');return new BPromise(function(_0x2041e3,_0x1ac486){if(_0xa721e7<=0x0||isNaN(_0xa721e7)){return _0x1ac486(msgResponse(_0xbf4e('0x21b'),_0xbf4e('0x4b'),'m\x20=\x20'+_0xa721e7));}if(_0x5f2ab8<=0x0||isNaN(_0x5f2ab8)){return _0x1ac486(msgResponse(_0xbf4e('0x21b'),_0xbf4e('0x4b'),_0xbf4e('0x21c')+_0x5f2ab8));}if(_0x1186ba<=0x0||isNaN(_0x1186ba)){return _0x1ac486(msgResponse('[abandonmentRate]',_0xbf4e('0x4b'),'p\x20=\x20'+_0x1186ba));}if(_0x27733d<=0x0||isNaN(_0x27733d)){return _0x1ac486(msgResponse(_0xbf4e('0x21b'),_0xbf4e('0x4b'),_0xbf4e('0x21d')+_0x27733d));}if(_0x4f6f2c<=0x0||isNaN(_0x4f6f2c)){return _0x1ac486(msgResponse(_0xbf4e('0x21b'),_0xbf4e('0x4b'),'Amax\x20=\x20'+_0x4f6f2c));}_0x38d213=_0x38d213||0x0;var _0x32e67f=0x1/_0x5f2ab8;var _0x78d0dd=0x0;var _0x2bba79=0x0;var _0x475591=0x0;var _0x4becaf=0x0;for(var _0x1e8ee3=0x0;_0x475591<_0x4f6f2c;_0x1e8ee3+=0x1){_0x2bba79=_0x1e8ee3/_0x27733d;_0x78d0dd=(_0x1186ba*_0x2bba79+_0x38d213)/_0x32e67f;_0x475591=erlangb(_0x78d0dd,_0xa721e7);_0x4becaf=_0x78d0dd/_0xa721e7*(0x1-erlangb(_0x78d0dd,_0xa721e7));}return _0x2041e3({'erlangCalls':_0x1e8ee3,'erlangCallToSecond':_0x27733d/_0x1e8ee3,'erlangAbandonmentRate':_0x475591,'erlangBusyFactor':_0x4becaf});});};Dialer['prototype'][_0xbf4e('0x1e8')]=function(_0x335d01,_0x2eb504,_0x270593,_0x41ca6f,_0xfdf8c5,_0x23d166){loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x21e'));loggerPredictive[_0xbf4e('0x7c')]('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',_0x335d01);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x217'),_0x2eb504);loggerPredictive['info'](_0xbf4e('0x218'),_0x270593);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x219'),_0x41ca6f);loggerPredictive[_0xbf4e('0x7c')](_0xbf4e('0x21f'),_0xfdf8c5);loggerPredictive[_0xbf4e('0x7c')]('---------------------------');return new BPromise(function(_0xc1a4f0,_0x2ef609){if(_0x335d01<=0x0||isNaN(_0x335d01)){return _0x2ef609(msgResponse(_0xbf4e('0x220'),_0xbf4e('0x4b'),'m\x20=\x20'+_0x335d01));}if(_0x270593<=0x0||isNaN(_0x270593)){return _0x2ef609(msgResponse(_0xbf4e('0x220'),_0xbf4e('0x4b'),'Ts\x20=\x20'+_0x270593));}if(_0x41ca6f<=0x0||isNaN(_0x41ca6f)){return _0x2ef609(msgResponse(_0xbf4e('0x220'),_0xbf4e('0x4b'),_0xbf4e('0x221')+_0x41ca6f));}if(_0x2eb504<=0x0||isNaN(_0x2eb504)){return _0x2ef609(msgResponse(_0xbf4e('0x220'),_0xbf4e('0x4b'),_0xbf4e('0x21d')+_0x2eb504));}if(_0xfdf8c5<=0x0||isNaN(_0xfdf8c5)){return _0x2ef609(msgResponse(_0xbf4e('0x220'),'Error',_0xbf4e('0x222')+_0xfdf8c5));}_0x23d166=_0x23d166||0x0;var _0x1e678b=0x1/_0x270593;var _0x1be68a=0x0;var _0x6c5d2=0x0;var _0x1a6721=0x0;var _0x291229=0x0;for(var _0x1b03a4=0x0;_0x291229<_0xfdf8c5;_0x1b03a4+=0x1){_0x6c5d2=_0x1b03a4/_0x2eb504;_0x1be68a=(_0x41ca6f*_0x6c5d2+_0x23d166)/_0x1e678b;_0x1a6721=erlangb(_0x1be68a,_0x335d01);_0x291229=_0x1be68a/_0x335d01*(0x1-erlangb(_0x1be68a,_0x335d01));}return _0xc1a4f0({'erlangCalls':_0x1b03a4,'erlangCallToSecond':_0x2eb504/_0x1b03a4,'erlangAbandonmentRate':_0x1a6721,'erlangBusyFactor':_0x291229});});};module[_0xbf4e('0x223')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 3893a9b..f48fc44 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf91e=['type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat'];(function(_0x5eddad,_0x35d518){var _0x59eb5f=function(_0x21ea36){while(--_0x21ea36){_0x5eddad['push'](_0x5eddad['shift']());}};_0x59eb5f(++_0x35d518);}(_0xf91e,0x73));var _0xef91=function(_0x1bf855,_0xed7250){_0x1bf855=_0x1bf855-0x0;var _0x1fd120=_0xf91e[_0x1bf855];return _0x1fd120;};'use strict';var util=require(_0xef91('0x0'));var _=require('lodash');var moment=require(_0xef91('0x1'));function getSeconds(_0x4b6122,_0x383764){var _0x1d20e0=moment(_0x4b6122)[_0xef91('0x2')](0x0);var _0x1b2418=moment(_0x383764)[_0xef91('0x2')](0x0);return _0x1d20e0['diff'](_0x1b2418,_0xef91('0x3'));}function QueueCallerAbandon(_0xcdd90f,_0x5e3ac6){this[_0xef91('0x4')]=_0xcdd90f[_0xef91('0x4')];this[_0xef91('0x5')]=_0xcdd90f[_0xef91('0x5')];this['campaigntype']=_0xcdd90f[_0xef91('0x5')]==='outbound'?'queue':_0xcdd90f[_0xef91('0x5')];this['countbusyretry']=_0xcdd90f[_0xef91('0x6')];this[_0xef91('0x7')]=_0xcdd90f[_0xef91('0x7')];this['countnoanswerretry']=_0xcdd90f[_0xef91('0x8')];this[_0xef91('0x9')]=_0xcdd90f[_0xef91('0x6')]+_0xcdd90f[_0xef91('0x7')]+_0xcdd90f[_0xef91('0x8')]+_0xcdd90f[_0xef91('0xa')]+_0xcdd90f[_0xef91('0xb')]+_0xcdd90f[_0xef91('0xc')]+_0xcdd90f[_0xef91('0xd')]+_0xcdd90f['countagentrejectretry'];this['countnosuchnumberretry']=_0xcdd90f['countnosuchnumberretry'];this[_0xef91('0xb')]=_0xcdd90f['countdropretry'];this[_0xef91('0xc')]=_0xcdd90f['countabandonedretry'];this[_0xef91('0xd')]=_0xcdd90f['countmachineretry'];this[_0xef91('0xe')]=_0xcdd90f['countagentrejectretry'];this[_0xef91('0xf')]=_0x5e3ac6[_0xef91('0xf')];this['calleridname']=_0xcdd90f[_0xef91('0x10')];this['calleridnum']=_0xcdd90f[_0xef91('0x11')];this[_0xef91('0x12')]=_0xcdd90f[_0xef91('0x12')];this[_0xef91('0x13')]=_0xcdd90f[_0xef91('0x13')];this[_0xef91('0x14')]=_0xcdd90f['droptime'];this[_0xef91('0x15')]=this[_0xef91('0x14')];this[_0xef91('0x16')]=getSeconds(_0xcdd90f['responsetime'],_0xcdd90f[_0xef91('0x12')]);this[_0xef91('0x17')]=getSeconds(this['droptime'],_0xcdd90f['responsetime']);this['talktime']=0x0;this[_0xef91('0x18')]=_0x5e3ac6['queue'];this[_0xef91('0x19')]=_0x5e3ac6[_0xef91('0x1a')];this[_0xef91('0x1b')]=_0x5e3ac6[_0xef91('0x1b')];this[_0xef91('0x1c')]=_0xcdd90f[_0xef91('0x1c')];this[_0xef91('0x1d')]=_0xcdd90f[_0xef91('0x1d')];this[_0xef91('0x1e')]=_0xcdd90f[_0xef91('0x1e')];this[_0xef91('0x1f')]=_0xcdd90f['recallme'];this[_0xef91('0x20')]=_0xcdd90f[_0xef91('0x20')];this[_0xef91('0x21')]=_0xcdd90f['ListId'];this[_0xef91('0x22')]=_0xcdd90f['UserId'];this[_0xef91('0x23')]=_0xcdd90f[_0xef91('0x23')];this[_0xef91('0x24')]=_0xcdd90f[_0xef91('0x24')];this['originatecalleridnum']=_0xcdd90f[_0xef91('0x25')]||'';this[_0xef91('0x26')]=_0xcdd90f['originatecalleridname']||'';}module[_0xef91('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x9e9b=['countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0xd73835,_0x6ab070){var _0x48c4cf=function(_0x3234c9){while(--_0x3234c9){_0xd73835['push'](_0xd73835['shift']());}};_0x48c4cf(++_0x6ab070);}(_0x9e9b,0x66));var _0xb9e9=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0x9e9b[_0x2f037f];return _0x2d1573;};'use strict';var util=require(_0xb9e9('0x0'));var _=require(_0xb9e9('0x1'));var moment=require(_0xb9e9('0x2'));function getSeconds(_0x36cbae,_0x3bd785){var _0x322b6c=moment(_0x36cbae)[_0xb9e9('0x3')](0x0);var _0x9497ba=moment(_0x3bd785)[_0xb9e9('0x3')](0x0);return _0x322b6c[_0xb9e9('0x4')](_0x9497ba,_0xb9e9('0x5'));}function QueueCallerAbandon(_0x20c23a,_0x4faeb2){this[_0xb9e9('0x6')]=_0x20c23a[_0xb9e9('0x6')];this['type']=_0x20c23a[_0xb9e9('0x7')];this['campaigntype']=_0x20c23a[_0xb9e9('0x7')]==='outbound'?_0xb9e9('0x8'):_0x20c23a[_0xb9e9('0x7')];this[_0xb9e9('0x9')]=_0x20c23a['countbusyretry'];this[_0xb9e9('0xa')]=_0x20c23a['countcongestionretry'];this[_0xb9e9('0xb')]=_0x20c23a[_0xb9e9('0xb')];this['countglobal']=_0x20c23a[_0xb9e9('0x9')]+_0x20c23a[_0xb9e9('0xa')]+_0x20c23a[_0xb9e9('0xb')]+_0x20c23a['countnosuchnumberretry']+_0x20c23a[_0xb9e9('0xc')]+_0x20c23a[_0xb9e9('0xd')]+_0x20c23a[_0xb9e9('0xe')]+_0x20c23a[_0xb9e9('0xf')];this[_0xb9e9('0x10')]=_0x20c23a[_0xb9e9('0x10')];this[_0xb9e9('0xc')]=_0x20c23a['countdropretry'];this[_0xb9e9('0xd')]=_0x20c23a[_0xb9e9('0xd')];this[_0xb9e9('0xe')]=_0x20c23a[_0xb9e9('0xe')];this[_0xb9e9('0xf')]=_0x20c23a[_0xb9e9('0xf')];this[_0xb9e9('0x11')]=_0x4faeb2[_0xb9e9('0x11')];this['calleridname']=_0x20c23a[_0xb9e9('0x12')];this['calleridnum']=_0x20c23a[_0xb9e9('0x13')];this[_0xb9e9('0x14')]=_0x20c23a['starttime'];this[_0xb9e9('0x15')]=_0x20c23a['responsetime'];this[_0xb9e9('0x16')]=_0x20c23a[_0xb9e9('0x16')];this[_0xb9e9('0x17')]=this['droptime'];this[_0xb9e9('0x18')]=getSeconds(_0x20c23a[_0xb9e9('0x15')],_0x20c23a['starttime']);this[_0xb9e9('0x19')]=getSeconds(this['droptime'],_0x20c23a[_0xb9e9('0x15')]);this['talktime']=0x0;this[_0xb9e9('0x8')]=_0x4faeb2[_0xb9e9('0x8')];this[_0xb9e9('0x1a')]=_0x4faeb2[_0xb9e9('0x1b')];this[_0xb9e9('0x1c')]=_0x4faeb2[_0xb9e9('0x1c')];this[_0xb9e9('0x1d')]=_0x20c23a[_0xb9e9('0x1d')];this[_0xb9e9('0x1e')]=_0x20c23a[_0xb9e9('0x1e')];this['callbackat']=_0x20c23a['callbackat'];this[_0xb9e9('0x1f')]=_0x20c23a['recallme'];this[_0xb9e9('0x20')]=_0x20c23a[_0xb9e9('0x20')];this['ListId']=_0x20c23a[_0xb9e9('0x21')];this[_0xb9e9('0x22')]=_0x20c23a['UserId'];this[_0xb9e9('0x23')]=_0x20c23a[_0xb9e9('0x23')];this[_0xb9e9('0x24')]=_0x20c23a[_0xb9e9('0x24')];this['originatecalleridnum']=_0x20c23a['originatecalleridnum']||'';this['originatecalleridname']=_0x20c23a[_0xb9e9('0x25')]||'';}module[_0xb9e9('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0bb6ac3..4b1b799 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(_0x5a7627,_0x16703f){var _0x41821a=function(_0x44ecdf){while(--_0x44ecdf){_0x5a7627['push'](_0x5a7627['shift']());}};_0x41821a(++_0x16703f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x4f749f,_0x414449){var _0x424c48=function(_0x570991){while(--_0x570991){_0x4f749f['push'](_0x4f749f['shift']());}};_0x424c48(++_0x414449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 fb7d0d4..8719a53 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 _0x6324=['hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','error','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','path','./util/gs','fax','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider'];(function(_0x498616,_0x473ddc){var _0xb32929=function(_0x19ebb4){while(--_0x19ebb4){_0x498616['push'](_0x498616['shift']());}};_0xb32929(++_0x473ddc);}(_0x6324,0x142));var _0x4632=function(_0x5c13d5,_0x38a129){_0x5c13d5=_0x5c13d5-0x0;var _0x361eb9=_0x6324[_0x5c13d5];return _0x361eb9;};'use strict';var util=require(_0x4632('0x0'));var _=require(_0x4632('0x1'));var BPromise=require(_0x4632('0x2'));var uuid=require(_0x4632('0x3'));var moment=require('moment');var path=require(_0x4632('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4632('0x5'));var logger=require('../../../config/logger')(_0x4632('0x6'));var ami=require('../ami');var rpcDb=require(_0x4632('0x7'));var Channel=require(_0x4632('0x8'));var ut=require(_0x4632('0x9'));var Action=require(_0x4632('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4632('0xb'));var faxMessage=require(_0x4632('0xc'));function Fax(_0x390a46){this['channels']={};this[_0x4632('0xd')]=_0x390a46[_0x4632('0xd')];this['trunks']=_0x390a46['trunks'];this[_0x4632('0xe')]={};ami['on'](_0x4632('0xf'),this[_0x4632('0x10')][_0x4632('0x11')](this));ami['on'](_0x4632('0x12'),this[_0x4632('0x13')][_0x4632('0x11')](this));ami['on'](_0x4632('0x14'),this['syncNewState'][_0x4632('0x11')](this));ami['on']('newexten',this[_0x4632('0x15')][_0x4632('0x11')](this));ami['on'](_0x4632('0x16'),this[_0x4632('0x17')]['bind'](this));ami['on'](_0x4632('0x18'),this[_0x4632('0x19')][_0x4632('0x11')](this));ami['on'](_0x4632('0x1a'),this[_0x4632('0x1b')]['bind'](this));ami['on']('originateresponse',this[_0x4632('0x1c')][_0x4632('0x11')](this));}Fax[_0x4632('0x1d')][_0x4632('0x10')]=function(_0x48fbb1){if(_0x48fbb1[_0x4632('0x1e')]===_0x4632('0x1f')){for(var _0x1a94c0 in this['faxAccounts']){if(this[_0x4632('0xd')][_0x4632('0x20')](_0x1a94c0)){if(_0x48fbb1['exten']===this['faxAccounts'][_0x1a94c0][_0x4632('0x21')]){this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]]={};this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]][_0x4632('0x24')]=_0x48fbb1[_0x4632('0x24')];this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]]['id']=this[_0x4632('0xd')][_0x1a94c0]['id'];this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]][_0x4632('0x25')]=this[_0x4632('0xd')][_0x1a94c0][_0x4632('0x25')];logger[_0x4632('0x26')](_0x48fbb1[_0x4632('0x23')],_0x4632('0x27'));}}}}if(this[_0x4632('0xe')][_0x48fbb1[_0x4632('0x23')]]){this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]]={};this[_0x4632('0x22')][_0x48fbb1[_0x4632('0x23')]][_0x4632('0x24')]=_0x48fbb1[_0x4632('0x24')];logger[_0x4632('0x26')](_0x48fbb1[_0x4632('0x23')],_0x4632('0x27'));}};Fax[_0x4632('0x1d')][_0x4632('0x13')]=function(_0x2a0b11){if(this[_0x4632('0x22')][_0x2a0b11['uniqueid']]){for(var _0x57798a in _0x2a0b11[_0x4632('0x28')]){if(_0x2a0b11[_0x4632('0x28')][_0x4632('0x20')](_0x57798a)){this[_0x4632('0x22')][_0x2a0b11[_0x4632('0x23')]][_0x57798a]=_0x2a0b11[_0x4632('0x29')];}}}};Fax[_0x4632('0x1d')]['syncNewState']=function(_0x42d505){if(this[_0x4632('0x22')][_0x42d505['uniqueid']]){this[_0x4632('0x22')][_0x42d505['uniqueid']][_0x4632('0x2a')]=_0x42d505['channelstate'];this['channels'][_0x42d505[_0x4632('0x23')]][_0x4632('0x2b')]=_0x42d505[_0x4632('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x395f4e){if(this[_0x4632('0x22')][_0x395f4e['uniqueid']]){for(var _0x4aab76 in _0x395f4e[_0x4632('0x28')]){if(_0x395f4e[_0x4632('0x28')]['hasOwnProperty'](_0x4aab76)){this[_0x4632('0x22')][_0x395f4e[_0x4632('0x23')]][_0x4aab76]=_0x395f4e[_0x4632('0x29')];}}}};Fax[_0x4632('0x1d')][_0x4632('0x17')]=function(_0x47b2b5){if(this[_0x4632('0x22')][_0x47b2b5[_0x4632('0x23')]]){this['channels'][_0x47b2b5['uniqueid']][_0x4632('0x2c')]=_0x47b2b5['operation'];this['channels'][_0x47b2b5[_0x4632('0x23')]]['status']=_0x47b2b5[_0x4632('0x2d')];this[_0x4632('0x22')][_0x47b2b5[_0x4632('0x23')]]['localstationid']=_0x47b2b5[_0x4632('0x21')];this[_0x4632('0x22')][_0x47b2b5[_0x4632('0x23')]][_0x4632('0x2e')]=_0x47b2b5[_0x4632('0x2e')];logger['info'](_0x47b2b5['uniqueid'],_0x4632('0x2f'));}};Fax[_0x4632('0x1d')][_0x4632('0x19')]=function(_0x4f40af){var _0x5a3fb4=this;if(this['channels'][_0x4f40af[_0x4632('0x23')]]){var _0x393ef2=this['channels'][_0x4f40af[_0x4632('0x23')]]['id'];this[_0x4632('0x22')][_0x4f40af[_0x4632('0x23')]][_0x4632('0x30')]=_0x4f40af[_0x4632('0x30')];this[_0x4632('0x22')][_0x4f40af[_0x4632('0x23')]][_0x4632('0x31')]=_0x4f40af[_0x4632('0x31')];this[_0x4632('0x22')][_0x4f40af[_0x4632('0x23')]][_0x4632('0x21')]=_0x4f40af['localstationid'];this[_0x4632('0x22')][_0x4f40af[_0x4632('0x23')]]['resolution']=_0x4f40af[_0x4632('0x32')];this[_0x4632('0x22')][_0x4f40af['uniqueid']][_0x4632('0x33')]=_0x4f40af['transferrate'];this[_0x4632('0x22')][_0x4f40af[_0x4632('0x23')]][_0x4632('0x2e')]=_0x4f40af[_0x4632('0x2e')];this['channels'][_0x4f40af[_0x4632('0x23')]][_0x4632('0x34')]=_0x4f40af[_0x4632('0x34')];if(this[_0x4632('0x22')][_0x4f40af['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4f40af[_0x4632('0x2e')],_0x4632('0x35'),function(_0x351cb1){logger['info'](_0x4f40af[_0x4632('0x23')],_0x4632('0x36'),_0x351cb1[_0x4632('0x37')]);attachment[_0x4632('0x38')]({'name':path[_0x4632('0x39')](_0x4f40af[_0x4632('0x2e')])[_0x4632('0x25')],'basename':path['parse'](_0x4f40af[_0x4632('0x2e')])[_0x4632('0x25')]+_0x4632('0x3a'),'type':_0x4632('0x3b')})[_0x4632('0x3c')](function(_0x4d1d50){faxAccount['notify'](_0x393ef2,{'from':_0x4f40af[_0x4632('0x34')],'mapKey':_0x4632('0x6'),'body':path[_0x4632('0x39')](_0x4f40af[_0x4632('0x2e')])['name']+_0x4632('0x3a'),'AttachmentId':_0x4d1d50['id']})[_0x4632('0x3d')](function(_0x1ef8e1){logger[_0x4632('0x3e')](_0x4f40af[_0x4632('0x23')],'\x20notify\x20',JSON[_0x4632('0x3f')](_0x1ef8e1));});})[_0x4632('0x3d')](function(_0x378665){logger[_0x4632('0x3e')](_0x4f40af[_0x4632('0x23')],_0x4632('0x40'),JSON[_0x4632('0x3f')](_0x378665));});});}logger[_0x4632('0x26')](_0x4f40af[_0x4632('0x23')],_0x4632('0x40'));}};Fax[_0x4632('0x1d')]['syncOriginateResponse']=function(_0xc3ffd0){if(this[_0x4632('0xe')][_0xc3ffd0[_0x4632('0x23')]]){_['merge'](this[_0x4632('0x22')][_0xc3ffd0[_0x4632('0x23')]],_[_0x4632('0x41')](_0xc3ffd0,[_0x4632('0x42'),_0x4632('0x43')]));}};function updateStatus(_0x70a4fd){if(_0x70a4fd[_0x4632('0x44')]){faxMessage[_0x4632('0x45')](_0x70a4fd[_0x4632('0x44')],{'failMessage':_0x4632('0x46')})['then'](function(_0x35afe5){ut[_0x4632('0x47')]('[Fax][Message][Error][Updated]',_0x35afe5);})[_0x4632('0x3d')](function(_0x3a21c6){ut[_0x4632('0x47')](_0x4632('0x48'),_0x3a21c6);});}else{ut[_0x4632('0x47')](_0x4632('0x49'));}}Fax[_0x4632('0x1d')][_0x4632('0x4a')]=function(_0x31b42d,_0x1b66e0,_0x3e66d8){var _0x2a50f7=this;var _0x3471b4={};if(_0x1b66e0){_0x3471b4={'read':_0x1b66e0};}else{_0x3471b4={'failMessage':_0x3e66d8};}if(this[_0x4632('0xe')][_0x31b42d][_0x4632('0x44')]){faxMessage[_0x4632('0x45')](this[_0x4632('0xe')][_0x31b42d][_0x4632('0x44')],_0x3471b4)[_0x4632('0x3c')](function(_0x36c824){ut['logger'](_0x4632('0x4b'),_0x36c824);})[_0x4632('0x3d')](function(_0x3ea966){ut[_0x4632('0x47')](_0x4632('0x4c'),_0x3ea966);})[_0x4632('0x4d')](function(){delete _0x2a50f7['channels'][_0x31b42d];delete _0x2a50f7[_0x4632('0xe')][_0x31b42d];});}else{ut[_0x4632('0x47')](_0x4632('0x4e'));delete this['channels'][_0x31b42d];delete this[_0x4632('0xe')][_0x31b42d];}};Fax[_0x4632('0x1d')]['syncHangup']=function(_0x17bc91){var _0x1aa4f0=this;if(this[_0x4632('0x22')][_0x17bc91['uniqueid']]){if(this[_0x4632('0xe')][_0x17bc91[_0x4632('0x23')]]){this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]]['id']=this[_0x4632('0xe')][_0x17bc91[_0x4632('0x23')]]['id'];this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]][_0x4632('0x25')]=this[_0x4632('0xe')][_0x17bc91['uniqueid']][_0x4632('0x25')];}logger[_0x4632('0x26')](_0x17bc91['uniqueid'],this[_0x4632('0xe')][_0x17bc91['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x4632('0x4f'),JSON[_0x4632('0x3f')](this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]]));if(this[_0x4632('0xe')][_0x17bc91[_0x4632('0x23')]]){if(this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]][_0x4632('0x50')]>0x0&&this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]][_0x4632('0x16')]===_0x4632('0x51')){this[_0x4632('0x4a')](_0x17bc91['uniqueid'],!![]);}else{this['updateStatus'](_0x17bc91[_0x4632('0x23')],![],this[_0x4632('0x22')][_0x17bc91[_0x4632('0x23')]][_0x4632('0x52')]?_0x4632('0x53')+this[_0x4632('0x22')][_0x17bc91['uniqueid']][_0x4632('0x52')]:_0x4632('0x54'));}}}};Fax[_0x4632('0x1d')][_0x4632('0x55')]=function(_0x5d1994){var _0x529be1=this;return new BPromise(function(_0x28428f,_0x4c547c){_0x529be1[_0x4632('0x56')](_0x5d1994,_0x529be1[_0x4632('0xd')][_0x5d1994[_0x4632('0x57')]])[_0x4632('0x3c')](function(_0xc5515f){ut['logger'](_0x4632('0x58'),_0xc5515f);_0x28428f(ut[_0x4632('0x37')]('Fax\x20received'));})['catch'](function(_0x2a2cdb){ut[_0x4632('0x47')](_0x4632('0x59'),_0x2a2cdb);updateStatus(_0x5d1994);_0x4c547c(ut[_0x4632('0x37')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x10f7ab){var _0x5b37cc=this;return new BPromise(function(_0x3af9ec,_0x3595fa){var _0x390844=_0x5b37cc[_0x4632('0x5a')](_0x5b37cc[_0x4632('0xd')][_0x10f7ab[_0x4632('0x57')]][_0x4632('0x5b')],_0x10f7ab);if(_0x390844[_0x4632('0x5c')]){_0x3af9ec(ut[_0x4632('0x37')](_0x4632('0x5d')));}else{_0x3595fa(ut[_0x4632('0x37')](_0x390844[_0x4632('0x37')]));}});};function originate(_0x1c5c49,_0x3d5e65,_0x461700){return new BPromise(function(_0x1b2905,_0x550c4d){if(_0x461700){var _0x2b6d66=util[_0x4632('0x5e')](_0x4632('0x5f'),path[_0x4632('0x39')](_0x1c5c49[_0x4632('0x4')])[_0x4632('0x25')],_0x1c5c49[_0x4632('0x4')]);gs[_0x4632('0x60')](_0x2b6d66)[_0x4632('0x3c')](function(){_0x1c5c49[_0x4632('0x4')]=util[_0x4632('0x5e')](_0x4632('0x61'),path[_0x4632('0x39')](_0x1c5c49['path'])[_0x4632('0x62')],path[_0x4632('0x39')](_0x1c5c49[_0x4632('0x4')])[_0x4632('0x25')]);_0x3d5e65[_0x4632('0x63')]=_0x1c5c49[_0x4632('0x4')];ut['logger'](_0x4632('0x64'),'');ami[_0x4632('0x65')](ut['variablesAction'](_0x1c5c49,_0x3d5e65))[_0x4632('0x3c')](function(_0x458688){_0x1b2905(_0x458688);})[_0x4632('0x3d')](function(_0x182b19){_0x550c4d(_0x182b19);});})[_0x4632('0x3d')](function(_0x5a09b9){_0x550c4d(_0x5a09b9);});}else{ami[_0x4632('0x65')](ut[_0x4632('0x66')](_0x1c5c49,_0x3d5e65))[_0x4632('0x3c')](function(_0x505e2a){_0x1b2905(_0x505e2a);})[_0x4632('0x3d')](function(_0x400a95){_0x550c4d(_0x400a95);});}});}Fax[_0x4632('0x1d')][_0x4632('0x56')]=function(_0x365341,_0x3a3f3a){var _0x35ca5d=this;return new BPromise(function(_0x295b86,_0x48fb81){var _0x36de42=uuid['v4']();var _0x9603f5=ut[_0x4632('0x67')](_0x365341,_0x3a3f3a);_0x35ca5d['actions'][_0x36de42]=new Action(_0x36de42,_0x3a3f3a,_0x365341);var _0xfc48bd=_0x35ca5d[_0x4632('0xe')][_0x36de42];if(path['parse'](_0x365341['path'])[_0x4632('0x68')]===_0x4632('0x3a')){originate(_0xfc48bd,_0x9603f5,!![])['then'](function(_0x63d3e1){_0x295b86(_0x63d3e1);})[_0x4632('0x3d')](function(_0x2f1f22){_0x48fb81(_0x2f1f22);});}else{originate(_0xfc48bd,_0x9603f5,![])[_0x4632('0x3c')](function(_0x40b7c5){_0x295b86(_0x40b7c5);})[_0x4632('0x3d')](function(_0x43edfd){_0x48fb81(_0x43edfd);});}});};Fax[_0x4632('0x1d')]['isTrunkReachable']=function(_0x1604da){return!_[_0x4632('0x69')](_0x1604da)&&!_[_0x4632('0x69')](_0x1604da[_0x4632('0x25')])&&!_['isNil'](_0x1604da[_0x4632('0x6a')])&&_0x1604da[_0x4632('0x6a')]&&!_[_0x4632('0x69')](this[_0x4632('0x6b')][util[_0x4632('0x5e')]('SIP/%s',_0x1604da[_0x4632('0x25')])])&&!_[_0x4632('0x69')](this[_0x4632('0x6b')][util[_0x4632('0x5e')](_0x4632('0x6c'),_0x1604da[_0x4632('0x25')])][_0x4632('0x2d')])&&(this[_0x4632('0x6b')][util['format'](_0x4632('0x6c'),_0x1604da[_0x4632('0x25')])][_0x4632('0x2d')]===_0x4632('0x6d')||this[_0x4632('0x6b')][util[_0x4632('0x5e')]('SIP/%s',_0x1604da[_0x4632('0x25')])][_0x4632('0x2d')]===_0x4632('0x6e'));};Fax[_0x4632('0x1d')][_0x4632('0x5a')]=function(_0x3ad5f0,_0x310c9c){if(!this['isTrunkReachable'](_0x3ad5f0)){ut[_0x4632('0x47')](_0x4632('0x6f'),_[_0x4632('0x69')](_0x3ad5f0)?'':_0x3ad5f0[_0x4632('0x25')]+_0x4632('0x70'));return{'isValid':![],'message':_0x4632('0x71')};}if(_[_0x4632('0x69')](_0x310c9c['fax'])){ut[_0x4632('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4632('0x3f')](_0x310c9c));return{'isValid':![],'message':_0x4632('0x72')};}if(_[_0x4632('0x69')](_0x310c9c[_0x4632('0x4')])){ut[_0x4632('0x47')](_0x4632('0x73'),JSON[_0x4632('0x3f')](_0x310c9c));return{'isValid':![],'message':_0x4632('0x74')};}return{'isValid':!![],'message':_0x4632('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0x4b17=['[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','.pdf','isTrunkReachable','isNil','SIP/%s','status','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','bluebird','moment','path','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','fax','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally'];(function(_0xa75d28,_0x1958d4){var _0x37da57=function(_0x2c5b61){while(--_0x2c5b61){_0xa75d28['push'](_0xa75d28['shift']());}};_0x37da57(++_0x1958d4);}(_0x4b17,0x10f));var _0x74b1=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x4b17[_0x13f980];return _0x27153c;};'use strict';var util=require(_0x74b1('0x0'));var _=require('lodash');var BPromise=require(_0x74b1('0x1'));var uuid=require('uuid');var moment=require(_0x74b1('0x2'));var path=require(_0x74b1('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x74b1('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0x74b1('0x5'));var rpcDb=require(_0x74b1('0x6'));var Channel=require(_0x74b1('0x7'));var ut=require(_0x74b1('0x8'));var Action=require(_0x74b1('0x9'));var faxAccount=require(_0x74b1('0xa'));var attachment=require(_0x74b1('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x287e3e){this[_0x74b1('0xc')]={};this[_0x74b1('0xd')]=_0x287e3e[_0x74b1('0xd')];this[_0x74b1('0xe')]=_0x287e3e['trunks'];this[_0x74b1('0xf')]={};ami['on'](_0x74b1('0x10'),this['syncNewchannel'][_0x74b1('0x11')](this));ami['on'](_0x74b1('0x12'),this[_0x74b1('0x13')][_0x74b1('0x11')](this));ami['on']('newstate',this[_0x74b1('0x14')]['bind'](this));ami['on']('newexten',this[_0x74b1('0x15')][_0x74b1('0x11')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x74b1('0x16'),this['syncReceiveFax']['bind'](this));ami['on'](_0x74b1('0x17'),this[_0x74b1('0x18')][_0x74b1('0x11')](this));ami['on'](_0x74b1('0x19'),this[_0x74b1('0x1a')][_0x74b1('0x11')](this));}Fax['prototype'][_0x74b1('0x1b')]=function(_0x213b28){if(_0x213b28[_0x74b1('0x1c')]===_0x74b1('0x1d')){for(var _0xde2736 in this[_0x74b1('0xd')]){if(this[_0x74b1('0xd')]['hasOwnProperty'](_0xde2736)){if(_0x213b28[_0x74b1('0x1e')]===this[_0x74b1('0xd')][_0xde2736]['localstationid']){this[_0x74b1('0xc')][_0x213b28[_0x74b1('0x1f')]]={};this[_0x74b1('0xc')][_0x213b28[_0x74b1('0x1f')]][_0x74b1('0x20')]=_0x213b28[_0x74b1('0x20')];this[_0x74b1('0xc')][_0x213b28[_0x74b1('0x1f')]]['id']=this['faxAccounts'][_0xde2736]['id'];this[_0x74b1('0xc')][_0x213b28['uniqueid']]['name']=this['faxAccounts'][_0xde2736][_0x74b1('0x21')];logger[_0x74b1('0x22')](_0x213b28[_0x74b1('0x1f')],_0x74b1('0x23'));}}}}if(this[_0x74b1('0xf')][_0x213b28['uniqueid']]){this[_0x74b1('0xc')][_0x213b28['uniqueid']]={};this[_0x74b1('0xc')][_0x213b28[_0x74b1('0x1f')]][_0x74b1('0x20')]=_0x213b28[_0x74b1('0x20')];logger[_0x74b1('0x22')](_0x213b28[_0x74b1('0x1f')],_0x74b1('0x23'));}};Fax[_0x74b1('0x24')]['syncVarSet']=function(_0x322e61){if(this[_0x74b1('0xc')][_0x322e61[_0x74b1('0x1f')]]){for(var _0x5c32d2 in _0x322e61[_0x74b1('0x25')]){if(_0x322e61[_0x74b1('0x25')][_0x74b1('0x26')](_0x5c32d2)){this[_0x74b1('0xc')][_0x322e61[_0x74b1('0x1f')]][_0x5c32d2]=_0x322e61[_0x74b1('0x27')];}}}};Fax[_0x74b1('0x24')][_0x74b1('0x14')]=function(_0x4fbe3d){if(this[_0x74b1('0xc')][_0x4fbe3d[_0x74b1('0x1f')]]){this['channels'][_0x4fbe3d[_0x74b1('0x1f')]][_0x74b1('0x28')]=_0x4fbe3d[_0x74b1('0x28')];this['channels'][_0x4fbe3d[_0x74b1('0x1f')]][_0x74b1('0x29')]=_0x4fbe3d['channelstatedesc'];}};Fax[_0x74b1('0x24')][_0x74b1('0x15')]=function(_0x2211b2){if(this[_0x74b1('0xc')][_0x2211b2[_0x74b1('0x1f')]]){for(var _0x32a8d6 in _0x2211b2[_0x74b1('0x25')]){if(_0x2211b2[_0x74b1('0x25')]['hasOwnProperty'](_0x32a8d6)){this[_0x74b1('0xc')][_0x2211b2['uniqueid']][_0x32a8d6]=_0x2211b2['value'];}}}};Fax[_0x74b1('0x24')]['syncFaxStatus']=function(_0x52d96f){if(this[_0x74b1('0xc')][_0x52d96f[_0x74b1('0x1f')]]){this[_0x74b1('0xc')][_0x52d96f[_0x74b1('0x1f')]][_0x74b1('0x2a')]=_0x52d96f[_0x74b1('0x2a')];this[_0x74b1('0xc')][_0x52d96f[_0x74b1('0x1f')]]['status']=_0x52d96f['status'];this['channels'][_0x52d96f[_0x74b1('0x1f')]]['localstationid']=_0x52d96f['localstationid'];this[_0x74b1('0xc')][_0x52d96f[_0x74b1('0x1f')]][_0x74b1('0x2b')]=_0x52d96f['filename'];logger[_0x74b1('0x22')](_0x52d96f['uniqueid'],_0x74b1('0x2c'));}};Fax[_0x74b1('0x24')]['syncReceiveFax']=function(_0x514d0e){var _0x1be766=this;if(this[_0x74b1('0xc')][_0x514d0e['uniqueid']]){var _0x5e2007=this[_0x74b1('0xc')][_0x514d0e['uniqueid']]['id'];this[_0x74b1('0xc')][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x2d')]=_0x514d0e[_0x74b1('0x2d')];this[_0x74b1('0xc')][_0x514d0e['uniqueid']][_0x74b1('0x2e')]=_0x514d0e['pagestransferred'];this[_0x74b1('0xc')][_0x514d0e['uniqueid']][_0x74b1('0x2f')]=_0x514d0e['localstationid'];this['channels'][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x30')]=_0x514d0e[_0x74b1('0x30')];this['channels'][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x31')]=_0x514d0e[_0x74b1('0x31')];this['channels'][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x2b')]=_0x514d0e['filename'];this['channels'][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x32')]=_0x514d0e[_0x74b1('0x32')];if(this[_0x74b1('0xc')][_0x514d0e[_0x74b1('0x1f')]][_0x74b1('0x2e')]>0x0){tiff2pdf(_0x514d0e[_0x74b1('0x2b')],'/var/opt/motion2/server/files/attachments/',function(_0x19d393){logger[_0x74b1('0x22')](_0x514d0e[_0x74b1('0x1f')],_0x74b1('0x33'),_0x19d393[_0x74b1('0x34')]);attachment['create']({'name':path[_0x74b1('0x35')](_0x514d0e[_0x74b1('0x2b')])['name'],'basename':path['parse'](_0x514d0e[_0x74b1('0x2b')])[_0x74b1('0x21')]+'.pdf','type':_0x74b1('0x36')})[_0x74b1('0x37')](function(_0x2675c6){faxAccount[_0x74b1('0x38')](_0x5e2007,{'from':_0x514d0e[_0x74b1('0x32')],'mapKey':_0x74b1('0x39'),'body':path[_0x74b1('0x35')](_0x514d0e['filename'])['name']+'.pdf','AttachmentId':_0x2675c6['id']})[_0x74b1('0x3a')](function(_0x455355){logger[_0x74b1('0x3b')](_0x514d0e[_0x74b1('0x1f')],_0x74b1('0x3c'),JSON['stringify'](_0x455355));});})[_0x74b1('0x3a')](function(_0x2f4e45){logger[_0x74b1('0x3b')](_0x514d0e[_0x74b1('0x1f')],_0x74b1('0x3d'),JSON[_0x74b1('0x3e')](_0x2f4e45));});});}logger[_0x74b1('0x22')](_0x514d0e[_0x74b1('0x1f')],_0x74b1('0x3d'));}};Fax[_0x74b1('0x24')][_0x74b1('0x1a')]=function(_0x3038f9){if(this['actions'][_0x3038f9[_0x74b1('0x1f')]]){_[_0x74b1('0x3f')](this['channels'][_0x3038f9[_0x74b1('0x1f')]],_['pick'](_0x3038f9,[_0x74b1('0x40'),_0x74b1('0x41')]));}};function updateStatus(_0x5459b6){if(_0x5459b6[_0x74b1('0x42')]){faxMessage[_0x74b1('0x43')](_0x5459b6[_0x74b1('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x74b1('0x37')](function(_0x418652){ut[_0x74b1('0x44')](_0x74b1('0x45'),_0x418652);})[_0x74b1('0x3a')](function(_0x5f1355){ut[_0x74b1('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x5f1355);});}else{ut[_0x74b1('0x44')](_0x74b1('0x46'));}}Fax['prototype'][_0x74b1('0x47')]=function(_0x12ec28,_0x180fff,_0x54a221){var _0x3b6838=this;var _0x37b907={};if(_0x180fff){_0x37b907={'read':_0x180fff};}else{_0x37b907={'failMessage':_0x54a221};}if(this['actions'][_0x12ec28][_0x74b1('0x42')]){faxMessage['update'](this['actions'][_0x12ec28][_0x74b1('0x42')],_0x37b907)[_0x74b1('0x37')](function(_0x1525db){ut[_0x74b1('0x44')](_0x74b1('0x48'),_0x1525db);})['catch'](function(_0x145ce3){ut[_0x74b1('0x44')]('[Fax][Message][NoUpdate1]',_0x145ce3);})[_0x74b1('0x49')](function(){delete _0x3b6838[_0x74b1('0xc')][_0x12ec28];delete _0x3b6838[_0x74b1('0xf')][_0x12ec28];});}else{ut['logger'](_0x74b1('0x4a'));delete this[_0x74b1('0xc')][_0x12ec28];delete this[_0x74b1('0xf')][_0x12ec28];}};Fax['prototype'][_0x74b1('0x18')]=function(_0x3b4338){var _0x473a01=this;if(this[_0x74b1('0xc')][_0x3b4338[_0x74b1('0x1f')]]){if(this[_0x74b1('0xf')][_0x3b4338['uniqueid']]){this[_0x74b1('0xc')][_0x3b4338['uniqueid']]['id']=this['actions'][_0x3b4338[_0x74b1('0x1f')]]['id'];this['channels'][_0x3b4338['uniqueid']][_0x74b1('0x21')]=this[_0x74b1('0xf')][_0x3b4338[_0x74b1('0x1f')]]['name'];}logger[_0x74b1('0x22')](_0x3b4338[_0x74b1('0x1f')],this[_0x74b1('0xf')][_0x3b4338[_0x74b1('0x1f')]]?_0x74b1('0x4b'):_0x74b1('0x4c'),JSON[_0x74b1('0x3e')](this[_0x74b1('0xc')][_0x3b4338[_0x74b1('0x1f')]]));if(this[_0x74b1('0xf')][_0x3b4338[_0x74b1('0x1f')]]){if(this[_0x74b1('0xc')][_0x3b4338['uniqueid']]['faxpages']>0x0&&this[_0x74b1('0xc')][_0x3b4338['uniqueid']][_0x74b1('0x4d')]===_0x74b1('0x4e')){this['updateStatus'](_0x3b4338['uniqueid'],!![]);}else{this[_0x74b1('0x47')](_0x3b4338[_0x74b1('0x1f')],![],this[_0x74b1('0xc')][_0x3b4338[_0x74b1('0x1f')]][_0x74b1('0x4f')]?_0x74b1('0x50')+this[_0x74b1('0xc')][_0x3b4338[_0x74b1('0x1f')]][_0x74b1('0x4f')]:_0x74b1('0x51'));}}}};Fax[_0x74b1('0x24')][_0x74b1('0x52')]=function(_0x4d14b1){var _0x3549b5=this;return new BPromise(function(_0x1de918,_0x378f63){_0x3549b5[_0x74b1('0x53')](_0x4d14b1,_0x3549b5['faxAccounts'][_0x4d14b1[_0x74b1('0x54')]])[_0x74b1('0x37')](function(_0x5ada76){ut[_0x74b1('0x44')]('[Fax][execOriginate][success]',_0x5ada76);_0x1de918(ut[_0x74b1('0x34')](_0x74b1('0x55')));})['catch'](function(_0xf721c){ut[_0x74b1('0x44')](_0x74b1('0x56'),_0xf721c);updateStatus(_0x4d14b1);_0x378f63(ut['message'](_0x74b1('0x57')));});});};Fax['prototype'][_0x74b1('0x58')]=function(_0x154ad4){var _0x3e92cb=this;return new BPromise(function(_0x327878,_0x264698){var _0x4167e7=_0x3e92cb[_0x74b1('0x59')](_0x3e92cb[_0x74b1('0xd')][_0x154ad4[_0x74b1('0x54')]][_0x74b1('0x5a')],_0x154ad4);if(_0x4167e7[_0x74b1('0x5b')]){_0x327878(ut[_0x74b1('0x34')](_0x74b1('0x5c')));}else{_0x264698(ut['message'](_0x4167e7[_0x74b1('0x34')]));}});};function originate(_0x2a12b0,_0x39aabf,_0x31756f){return new BPromise(function(_0x30692c,_0x228f8f){if(_0x31756f){var _0x2e94d6=util[_0x74b1('0x5d')](_0x74b1('0x5e'),path['parse'](_0x2a12b0[_0x74b1('0x3')])['name'],_0x2a12b0[_0x74b1('0x3')]);gs['execute'](_0x2e94d6)['then'](function(){_0x2a12b0[_0x74b1('0x3')]=util[_0x74b1('0x5d')](_0x74b1('0x5f'),path['parse'](_0x2a12b0[_0x74b1('0x3')])[_0x74b1('0x60')],path['parse'](_0x2a12b0[_0x74b1('0x3')])[_0x74b1('0x21')]);_0x39aabf[_0x74b1('0x61')]=_0x2a12b0[_0x74b1('0x3')];ut[_0x74b1('0x44')](_0x74b1('0x62'),'');ami[_0x74b1('0x63')](ut[_0x74b1('0x64')](_0x2a12b0,_0x39aabf))[_0x74b1('0x37')](function(_0x444092){_0x30692c(_0x444092);})['catch'](function(_0x2b1119){_0x228f8f(_0x2b1119);});})[_0x74b1('0x3a')](function(_0xdcb4c6){_0x228f8f(_0xdcb4c6);});}else{ami['Action'](ut[_0x74b1('0x64')](_0x2a12b0,_0x39aabf))[_0x74b1('0x37')](function(_0x1b7e22){_0x30692c(_0x1b7e22);})[_0x74b1('0x3a')](function(_0x458b5e){_0x228f8f(_0x458b5e);});}});}Fax['prototype'][_0x74b1('0x53')]=function(_0x155ca8,_0x505de5){var _0x11b94e=this;return new BPromise(function(_0x121a42,_0x36733f){var _0x359e05=uuid['v4']();var _0x211f12=ut['addVariables'](_0x155ca8,_0x505de5);_0x11b94e[_0x74b1('0xf')][_0x359e05]=new Action(_0x359e05,_0x505de5,_0x155ca8);var _0x1633dd=_0x11b94e[_0x74b1('0xf')][_0x359e05];if(path['parse'](_0x155ca8['path'])[_0x74b1('0x65')]===_0x74b1('0x66')){originate(_0x1633dd,_0x211f12,!![])[_0x74b1('0x37')](function(_0x286012){_0x121a42(_0x286012);})[_0x74b1('0x3a')](function(_0x5d8729){_0x36733f(_0x5d8729);});}else{originate(_0x1633dd,_0x211f12,![])[_0x74b1('0x37')](function(_0x548393){_0x121a42(_0x548393);})['catch'](function(_0x1a66c6){_0x36733f(_0x1a66c6);});}});};Fax[_0x74b1('0x24')][_0x74b1('0x67')]=function(_0x2da0f2){return!_[_0x74b1('0x68')](_0x2da0f2)&&!_[_0x74b1('0x68')](_0x2da0f2[_0x74b1('0x21')])&&!_[_0x74b1('0x68')](_0x2da0f2['active'])&&_0x2da0f2['active']&&!_['isNil'](this[_0x74b1('0xe')][util[_0x74b1('0x5d')](_0x74b1('0x69'),_0x2da0f2[_0x74b1('0x21')])])&&!_[_0x74b1('0x68')](this[_0x74b1('0xe')][util[_0x74b1('0x5d')](_0x74b1('0x69'),_0x2da0f2[_0x74b1('0x21')])][_0x74b1('0x6a')])&&(this[_0x74b1('0xe')][util[_0x74b1('0x5d')]('SIP/%s',_0x2da0f2[_0x74b1('0x21')])][_0x74b1('0x6a')]===_0x74b1('0x6b')||this[_0x74b1('0xe')][util[_0x74b1('0x5d')](_0x74b1('0x69'),_0x2da0f2['name'])][_0x74b1('0x6a')]===_0x74b1('0x6c'));};Fax[_0x74b1('0x24')]['checkTrunk']=function(_0x418a03,_0x43443e){if(!this[_0x74b1('0x67')](_0x418a03)){ut[_0x74b1('0x44')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x74b1('0x68')](_0x418a03)?'':_0x418a03[_0x74b1('0x21')]+_0x74b1('0x6d'));return{'isValid':![],'message':_0x74b1('0x6e')};}if(_[_0x74b1('0x68')](_0x43443e['fax'])){ut[_0x74b1('0x44')](_0x74b1('0x6f'),JSON['stringify'](_0x43443e));return{'isValid':![],'message':_0x74b1('0x70')};}if(_[_0x74b1('0x68')](_0x43443e['path'])){ut[_0x74b1('0x44')](_0x74b1('0x71'),JSON[_0x74b1('0x3e')](_0x43443e));return{'isValid':![],'message':_0x74b1('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7cf3ea9..5cfe8da 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 _0xdeb7=['preview','lodash','inspect','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x29ce4a,_0x246e82){var _0x62aaa2=function(_0x1a0917){while(--_0x1a0917){_0x29ce4a['push'](_0x29ce4a['shift']());}};_0x62aaa2(++_0x246e82);}(_0xdeb7,0x16e));var _0x7deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb7[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x7deb('0x0'));var BPromise=require(_0x7deb('0x1'));var logger=require(_0x7deb('0x2'))(_0x7deb('0x3'));var _=require(_0x7deb('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x548626){return function(_0x275f6e){logger['error'](_0x548626,util[_0x7deb('0x5')](_0x275f6e,{'showHidden':![],'depth':null}));};}exports[_0x7deb('0x6')]=function(_0x5b2ba5,_0x2be446){return BPromise['resolve']()['then'](faxAccount['notify'](_0x5b2ba5,_0x2be446))[_0x7deb('0x7')](loggerCatch(_0x7deb('0x8')));}; \ No newline at end of file +var _0xbb49=['preview','inspect','notify','resolve','then','catch','util','bluebird','../../../config/logger'];(function(_0x39eefc,_0x4d4410){var _0x4f86f9=function(_0x4daf49){while(--_0x4daf49){_0x39eefc['push'](_0x39eefc['shift']());}};_0x4f86f9(++_0x4d4410);}(_0xbb49,0x1da));var _0x9bb4=function(_0x32ab63,_0x4d6d70){_0x32ab63=_0x32ab63-0x0;var _0x18af42=_0xbb49[_0x32ab63];return _0x18af42;};'use strict';var util=require(_0x9bb4('0x0'));var BPromise=require(_0x9bb4('0x1'));var logger=require(_0x9bb4('0x2'))(_0x9bb4('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x45ab98){return function(_0x543a59){logger['error'](_0x45ab98,util[_0x9bb4('0x4')](_0x543a59,{'showHidden':![],'depth':null}));};}exports[_0x9bb4('0x5')]=function(_0x456881,_0x5dcd8d){return BPromise[_0x9bb4('0x6')]()[_0x9bb4('0x7')](faxAccount['notify'](_0x456881,_0x5dcd8d))[_0x9bb4('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e322729..474a07d 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 _0xb231=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','execute','info'];(function(_0x3612d5,_0xba7292){var _0x2febbf=function(_0x15a004){while(--_0x15a004){_0x3612d5['push'](_0x3612d5['shift']());}};_0x2febbf(++_0xba7292);}(_0xb231,0xb3));var _0x1b23=function(_0x2f7630,_0x14d1e7){_0x2f7630=_0x2f7630-0x0;var _0x264919=_0xb231[_0x2f7630];return _0x264919;};'use strict';var util=require(_0x1b23('0x0'));var logger=require('../../../../config/logger')(_0x1b23('0x1'));var BPromise=require(_0x1b23('0x2'));var exec=require('child_process')['exec'];exports[_0x1b23('0x3')]=function(_0xf90f4b){return new BPromise(function(_0x37893a,_0x4aa608){exec(_0xf90f4b,function(_0x2206d9,_0x50193a,_0x34049c){logger[_0x1b23('0x4')](_0x1b23('0x5'),_0x50193a);if(_0x2206d9){logger[_0x1b23('0x4')]('Exec\x20gs',_0x1b23('0x6'),util[_0x1b23('0x7')](_0x2206d9,{'showHidden':![],'depth':null}),_0x50193a,_0x34049c);_0x4aa608(_0x2206d9);}_0x37893a(_0x50193a);});});}; \ No newline at end of file +var _0x4e6b=['exec','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird','child_process'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x4e6b,0x114));var _0xb4e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4e6b[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xb4e6('0x0'));var logger=require(_0xb4e6('0x1'))('fax');var BPromise=require(_0xb4e6('0x2'));var exec=require(_0xb4e6('0x3'))[_0xb4e6('0x4')];exports['execute']=function(_0x44807c){return new BPromise(function(_0x13d58f,_0x569aea){exec(_0x44807c,function(_0x5978a7,_0x196aef,_0x1d1264){logger[_0xb4e6('0x5')](_0xb4e6('0x6'),_0x196aef);if(_0x5978a7){logger['info'](_0xb4e6('0x6'),_0xb4e6('0x7'),util['inspect'](_0x5978a7,{'showHidden':![],'depth':null}),_0x196aef,_0x1d1264);_0x569aea(_0x5978a7);}_0x13d58f(_0x196aef);});});}; \ 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 c37e413..f0a748a 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 _0xb275=['util','lodash','message','logger','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb275,0x14a));var _0x5b27=function(_0x13899b,_0x2eac91){_0x13899b=_0x13899b-0x0;var _0x4c0b26=_0xb275[_0x13899b];return _0x4c0b26;};'use strict';var util=require(_0x5b27('0x0'));var _=require(_0x5b27('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports[_0x5b27('0x2')]=function(_0x3c2855){return{'message':_0x3c2855};};exports[_0x5b27('0x3')]=function(_0x111ae7,_0x209f10){logger['info'](_0x111ae7,util[_0x5b27('0x4')](_0x209f10,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3187b5,_0x40d709){var _0x47641c={'XMF-ECM':_0x40d709[_0x5b27('0x5')],'XMF-HEADERINFO':_0x40d709[_0x5b27('0x6')],'XMF-MINRATE':_0x40d709[_0x5b27('0x7')],'XMF-MAXRATE':_0x40d709[_0x5b27('0x8')],'XMF-MODEM':util[_0x5b27('0x9')](_0x5b27('0xa'),_0x40d709[_0x5b27('0xb')]),'XMF-GATEWAY':_0x40d709[_0x5b27('0xc')],'XMF-FAXDETECT':_0x40d709[_0x5b27('0xd')],'XMF-T38TIMEOUT':_0x40d709[_0x5b27('0xe')],'XMF-LOCALSTATIONID':_0x40d709[_0x5b27('0xf')],'XMF-PATH':_0x3187b5['path']};return _0x47641c;};exports[_0x5b27('0x10')]=function(_0x593ddf,_0xd762c1){return{'actionid':_0x593ddf[_0x5b27('0x11')],'action':_0x5b27('0x12'),'channel':_0x593ddf[_0x5b27('0x13')],'Exten':_0x5b27('0x14'),'Context':_0x5b27('0x15'),'Priority':'1','callerid':util[_0x5b27('0x9')]('\x22%s\x22\x20<%s>',_0x593ddf['headerinfo']?_0x593ddf[_0x5b27('0x6')]:'',_0x593ddf[_0x5b27('0xf')]),'variable':_0xd762c1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x593ddf[_0x5b27('0x11')]};}; \ No newline at end of file +var _0x907c=['fax','message','inspect','ecm','headerinfo','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','moment','../../../../config/logger'];(function(_0x4fb1e4,_0x9664d3){var _0x16bb7a=function(_0x494b46){while(--_0x494b46){_0x4fb1e4['push'](_0x4fb1e4['shift']());}};_0x16bb7a(++_0x9664d3);}(_0x907c,0x12e));var _0xc907=function(_0x4c5bab,_0x248b58){_0x4c5bab=_0x4c5bab-0x0;var _0x1fbc02=_0x907c[_0x4c5bab];return _0x1fbc02;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc907('0x0'));var logger=require(_0xc907('0x1'))(_0xc907('0x2'));exports[_0xc907('0x3')]=function(_0x93e43b){return{'message':_0x93e43b};};exports['logger']=function(_0x4d5baa,_0x4f1a12){logger['info'](_0x4d5baa,util[_0xc907('0x4')](_0x4f1a12,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1d72ce,_0x2c3a14){var _0x4bfa82={'XMF-ECM':_0x2c3a14[_0xc907('0x5')],'XMF-HEADERINFO':_0x2c3a14[_0xc907('0x6')],'XMF-MINRATE':_0x2c3a14['minrate'],'XMF-MAXRATE':_0x2c3a14['maxrate'],'XMF-MODEM':util[_0xc907('0x7')](_0xc907('0x8'),_0x2c3a14['modem']),'XMF-GATEWAY':_0x2c3a14[_0xc907('0x9')],'XMF-FAXDETECT':_0x2c3a14[_0xc907('0xa')],'XMF-T38TIMEOUT':_0x2c3a14[_0xc907('0xb')],'XMF-LOCALSTATIONID':_0x2c3a14[_0xc907('0xc')],'XMF-PATH':_0x1d72ce[_0xc907('0xd')]};return _0x4bfa82;};exports['variablesAction']=function(_0x1e599f,_0x87f23d){return{'actionid':_0x1e599f['uniqueid'],'action':_0xc907('0xe'),'channel':_0x1e599f[_0xc907('0xf')],'Exten':_0xc907('0x10'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xc907('0x11'),_0x1e599f['headerinfo']?_0x1e599f[_0xc907('0x6')]:'',_0x1e599f['localstationid']),'variable':_0x87f23d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1e599f[_0xc907('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 310e723..9e2fa8a 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 _0x5da7=['util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','listen','sync','error','[index.js][main]','inspect','bluebird'];(function(_0x1c31fc,_0x39514d){var _0x400ade=function(_0x32e2e1){while(--_0x32e2e1){_0x1c31fc['push'](_0x1c31fc['shift']());}};_0x400ade(++_0x39514d);}(_0x5da7,0x180));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x75da('0x0'));var util=require(_0x75da('0x1'));var moment=require(_0x75da('0x2'));var server=require(_0x75da('0x3'));var Realtime=require(_0x75da('0x4'));var Report=require(_0x75da('0x5'));var Acw=require(_0x75da('0x6'));var Trigger=require(_0x75da('0x7'));var Dialer=require(_0x75da('0x8'));var Preview=require(_0x75da('0x9'));var Fax=require('./fax');var user=require(_0x75da('0xa'));var voiceQueue=require(_0x75da('0xb'));var voiceQueueReport=require(_0x75da('0xc'));var voiceCallReport=require(_0x75da('0xd'));var trunk=require('./rpc/trunk');var trigger=require(_0x75da('0xe'));var template=require(_0x75da('0xf'));var cmHopperHistory=require(_0x75da('0x10'));var campaign=require(_0x75da('0x11'));var voiceExtension=require(_0x75da('0x12'));var faxAccount=require(_0x75da('0x13'));var zendesk=require(_0x75da('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x75da('0x15'));var freshdesk=require(_0x75da('0x16'));var desk=require(_0x75da('0x17'));var zoho=require(_0x75da('0x18'));var vtiger=require(_0x75da('0x19'));var freshsales=require(_0x75da('0x1a'));var servicenow=require(_0x75da('0x1b'));var dynamics365=require(_0x75da('0x1c'));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(_0x75da('0x1d'))(_0x75da('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x75da('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x75da('0x20')](_0x75da('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x75da('0x21')]()['then'](user[_0x75da('0x22')]())[_0x75da('0x23')](realtime[_0x75da('0x24')]())[_0x75da('0x23')](user[_0x75da('0x25')]())['then'](realtime[_0x75da('0x26')]())[_0x75da('0x23')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x75da('0x23')](voiceQueue[_0x75da('0x27')]())[_0x75da('0x23')](realtime[_0x75da('0x28')]())[_0x75da('0x23')](trigger[_0x75da('0x29')]())['then'](realtime[_0x75da('0x2a')]())[_0x75da('0x23')](template[_0x75da('0x2b')]())[_0x75da('0x23')](realtime[_0x75da('0x2c')]())[_0x75da('0x23')](zendesk[_0x75da('0x2d')]())['then'](realtime['initZendeskAccounts']())[_0x75da('0x23')](salesforce[_0x75da('0x2e')]())[_0x75da('0x23')](realtime[_0x75da('0x2f')]())['then'](sugarcrm[_0x75da('0x30')]())['then'](realtime[_0x75da('0x31')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x75da('0x23')](realtime[_0x75da('0x32')]())[_0x75da('0x23')](desk[_0x75da('0x33')]())['then'](realtime[_0x75da('0x34')]())[_0x75da('0x23')](zoho[_0x75da('0x35')]())['then'](realtime[_0x75da('0x36')]())[_0x75da('0x23')](vtiger['getVtigerAccounts']())[_0x75da('0x23')](realtime['initVtigerAccounts']())[_0x75da('0x23')](freshsales[_0x75da('0x37')]())[_0x75da('0x23')](realtime[_0x75da('0x38')]())[_0x75da('0x23')](servicenow[_0x75da('0x39')]())[_0x75da('0x23')](realtime[_0x75da('0x3a')]())[_0x75da('0x23')](dynamics365[_0x75da('0x3b')]())[_0x75da('0x23')](realtime[_0x75da('0x3c')]())[_0x75da('0x23')](campaign[_0x75da('0x3d')]())[_0x75da('0x23')](realtime[_0x75da('0x3e')]())[_0x75da('0x23')](voiceExtension[_0x75da('0x3f')]())[_0x75da('0x23')](realtime['initVoiceExtensions']())[_0x75da('0x23')](faxAccount[_0x75da('0x40')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x75da('0x23')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x75da('0x41')]())[_0x75da('0x23')](cmHopperHistory[_0x75da('0x42')]())[_0x75da('0x23')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x75da('0x23')](realtime[_0x75da('0x43')]())['then'](voiceCallReport[_0x75da('0x44')]())[_0x75da('0x23')](realtime[_0x75da('0x45')]())[_0x75da('0x46')](function(_0x3a1874){logger['error'](_0x75da('0x47'),util['inspect'](_0x3a1874,{'showHidden':![],'depth':null}));});}function main(){return server[_0x75da('0x48')](realtime,preview,fax)['then'](function(_0x184c91){return initRealtime();})[_0x75da('0x23')](function(){return initParams();})[_0x75da('0x23')](function(){report[_0x75da('0x49')]();setInterval(initRealtime,0x1388);})[_0x75da('0x46')](function(_0x588dba){logger[_0x75da('0x4a')](_0x75da('0x4b'),util[_0x75da('0x4c')](_0x588dba,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5a17=['getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','error','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x5a17,0x1a6));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x75a1('0x0'));var moment=require(_0x75a1('0x1'));var server=require(_0x75a1('0x2'));var Realtime=require(_0x75a1('0x3'));var Report=require(_0x75a1('0x4'));var Acw=require(_0x75a1('0x5'));var Trigger=require(_0x75a1('0x6'));var Dialer=require(_0x75a1('0x7'));var Preview=require('./preview');var Fax=require(_0x75a1('0x8'));var user=require(_0x75a1('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x75a1('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x75a1('0xb'));var trigger=require(_0x75a1('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x75a1('0xd'));var campaign=require(_0x75a1('0xe'));var voiceExtension=require(_0x75a1('0xf'));var faxAccount=require(_0x75a1('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x75a1('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x75a1('0x12'));var zoho=require(_0x75a1('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x75a1('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x75a1('0x15'));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()[_0x75a1('0x16')](_0x75a1('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x75a1('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x75a1('0x18')](user[_0x75a1('0x19')]())[_0x75a1('0x18')](realtime[_0x75a1('0x1a')]())['then'](user[_0x75a1('0x1b')]())['then'](realtime[_0x75a1('0x1c')]())[_0x75a1('0x18')](trunk['getTrunks']())['then'](realtime[_0x75a1('0x1d')]())[_0x75a1('0x18')](voiceQueue[_0x75a1('0x1e')]())[_0x75a1('0x18')](realtime['initVoiceQueues']())[_0x75a1('0x18')](trigger[_0x75a1('0x1f')]())[_0x75a1('0x18')](realtime[_0x75a1('0x20')]())[_0x75a1('0x18')](template['getTemplates']())['then'](realtime[_0x75a1('0x21')]())[_0x75a1('0x18')](zendesk['getZendeskAccounts']())['then'](realtime[_0x75a1('0x22')]())[_0x75a1('0x18')](salesforce[_0x75a1('0x23')]())[_0x75a1('0x18')](realtime[_0x75a1('0x24')]())['then'](sugarcrm[_0x75a1('0x25')]())[_0x75a1('0x18')](realtime[_0x75a1('0x26')]())[_0x75a1('0x18')](freshdesk[_0x75a1('0x27')]())[_0x75a1('0x18')](realtime[_0x75a1('0x28')]())[_0x75a1('0x18')](desk[_0x75a1('0x29')]())[_0x75a1('0x18')](realtime[_0x75a1('0x2a')]())[_0x75a1('0x18')](zoho[_0x75a1('0x2b')]())['then'](realtime[_0x75a1('0x2c')]())[_0x75a1('0x18')](vtiger[_0x75a1('0x2d')]())['then'](realtime[_0x75a1('0x2e')]())[_0x75a1('0x18')](freshsales[_0x75a1('0x2f')]())[_0x75a1('0x18')](realtime[_0x75a1('0x30')]())[_0x75a1('0x18')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0x75a1('0x18')](dynamics365[_0x75a1('0x31')]())[_0x75a1('0x18')](realtime[_0x75a1('0x32')]())[_0x75a1('0x18')](campaign[_0x75a1('0x33')]())['then'](realtime[_0x75a1('0x34')]())[_0x75a1('0x18')](voiceExtension[_0x75a1('0x35')]())[_0x75a1('0x18')](realtime['initVoiceExtensions']())[_0x75a1('0x18')](faxAccount[_0x75a1('0x36')]())[_0x75a1('0x18')](realtime[_0x75a1('0x37')]())[_0x75a1('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x75a1('0x38')]()[_0x75a1('0x18')](voiceQueueReport[_0x75a1('0x39')]())[_0x75a1('0x18')](realtime[_0x75a1('0x3a')]())[_0x75a1('0x18')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x75a1('0x18')](realtime['initVoiceQueueHopperHistory']())[_0x75a1('0x18')](cmHopperHistory[_0x75a1('0x3b')]())[_0x75a1('0x18')](realtime['initCampaignHopperHistory']())[_0x75a1('0x18')](voiceCallReport[_0x75a1('0x3c')]())[_0x75a1('0x18')](realtime[_0x75a1('0x3d')]())[_0x75a1('0x3e')](function(_0x1f3089){logger['error'](_0x75a1('0x3f'),util[_0x75a1('0x40')](_0x1f3089,{'showHidden':![],'depth':null}));});}function main(){return server[_0x75a1('0x41')](realtime,preview,fax)['then'](function(_0x11ff8c){return initRealtime();})[_0x75a1('0x18')](function(){return initParams();})[_0x75a1('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x75a1('0x3e')](function(_0xfe5fbf){logger[_0x75a1('0x42')](_0x75a1('0x43'),util['inspect'](_0xfe5fbf,{'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 da6a79c..4e533b7 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x539fb1,_0x2130c2){var _0xf82190=function(_0x5aeba7){while(--_0x5aeba7){_0x539fb1['push'](_0x539fb1['shift']());}};_0xf82190(++_0x2130c2);}(_0xe706,0xa3));var _0x6e70=function(_0x47b63a,_0x3a3c6f){_0x47b63a=_0x47b63a-0x0;var _0x19e9ce=_0xe706[_0x47b63a];return _0x19e9ce;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x3402c5,_0x367e36){var _0x585348=function(_0xc7d242){while(--_0xc7d242){_0x3402c5['push'](_0x3402c5['shift']());}};_0x585348(++_0x367e36);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xcb91[_0xc77819];return _0x1c9434;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 00f5bf0..9d51de5 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 _0x5596=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x10d08a,_0x5f0de0){var _0x2e0408=function(_0x5f5c3d){while(--_0x5f5c3d){_0x10d08a['push'](_0x10d08a['shift']());}};_0x2e0408(++_0x5f0de0);}(_0x5596,0x81));var _0x6559=function(_0x296e29,_0x4071fb){_0x296e29=_0x296e29-0x0;var _0x30bbf0=_0x5596[_0x296e29];return _0x30bbf0;};'use strict';function Campaign(_0x41c0f7){this['id']=_0x41c0f7['id']||0x0;this['name']=_0x41c0f7[_0x6559('0x0')]||'';this['type']=_0x41c0f7[_0x6559('0x1')]||_0x6559('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x6559('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x6559('0x4')]='';this[_0x6559('0x5')]=!![];this[_0x6559('0x6')]=_0x41c0f7['active'];this['limitCalls']=_0x41c0f7[_0x6559('0x7')];this[_0x6559('0x8')]=_0x41c0f7[_0x6559('0x8')]||null;this[_0x6559('0x9')]=_0x41c0f7[_0x6559('0x9')]?_0x41c0f7[_0x6559('0x9')]:null;this[_0x6559('0xa')]=_0x41c0f7[_0x6559('0xa')];this[_0x6559('0xb')]=_0x41c0f7[_0x6559('0xb')];this[_0x6559('0xc')]=_0x41c0f7[_0x6559('0xc')]||0x1e;this[_0x6559('0xd')]=_0x41c0f7['dialCongestionMaxRetry'];this[_0x6559('0xe')]=_0x41c0f7['dialCongestionRetryFrequency'];this[_0x6559('0xf')]=_0x41c0f7[_0x6559('0xf')];this[_0x6559('0x10')]=_0x41c0f7[_0x6559('0x10')];this['dialNoAnswerMaxRetry']=_0x41c0f7[_0x6559('0x11')];this[_0x6559('0x12')]=_0x41c0f7['dialNoAnswerRetryFrequency'];this[_0x6559('0x13')]=_0x41c0f7[_0x6559('0x13')];this[_0x6559('0x14')]=_0x41c0f7[_0x6559('0x14')]||0x3;this[_0x6559('0x15')]=_0x41c0f7[_0x6559('0x15')]||0x96;this['dialDropMaxRetry']=_0x41c0f7[_0x6559('0x16')]||0x3;this[_0x6559('0x17')]=_0x41c0f7[_0x6559('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x41c0f7[_0x6559('0x18')]||0x3;this[_0x6559('0x19')]=_0x41c0f7['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x41c0f7['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x41c0f7['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x41c0f7[_0x6559('0x1a')]||0x3;this[_0x6559('0x1b')]=_0x41c0f7[_0x6559('0x1b')]||0x96;this[_0x6559('0x1c')]=_0x41c0f7[_0x6559('0x1c')]||_0x6559('0x1d');this['dialPrefix']=_0x41c0f7[_0x6559('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x41c0f7['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6559('0x1f')]=_0x41c0f7['dialCutDigit']||undefined;this[_0x6559('0x20')]=_0x41c0f7[_0x6559('0x20')]?_0x41c0f7[_0x6559('0x20')]:undefined;this['Trunk']=_0x41c0f7[_0x6559('0x21')]?_0x41c0f7[_0x6559('0x21')]:undefined;this[_0x6559('0x22')]=_0x41c0f7[_0x6559('0x22')]?_0x41c0f7['Interval']:undefined;this[_0x6559('0x23')]=_0x41c0f7[_0x6559('0x23')]?_0x41c0f7[_0x6559('0x23')]:undefined;this[_0x6559('0x24')]=_0x41c0f7['SquareProject']?_0x41c0f7[_0x6559('0x23')][_0x6559('0x0')]:undefined;this[_0x6559('0x25')]=_0x41c0f7[_0x6559('0x25')]||![];this[_0x6559('0x26')]=_0x41c0f7[_0x6559('0x26')];this[_0x6559('0x27')]=_0x41c0f7[_0x6559('0x27')];this[_0x6559('0x28')]=_0x41c0f7['dialAMDAfterGreetingSilence'];this[_0x6559('0x29')]=_0x41c0f7[_0x6559('0x29')];this[_0x6559('0x2a')]=_0x41c0f7[_0x6559('0x2a')];this['dialAMDBetweenWordsSilence']=_0x41c0f7[_0x6559('0x2b')];this[_0x6559('0x2c')]=_0x41c0f7[_0x6559('0x2c')];this[_0x6559('0x2d')]=_0x41c0f7[_0x6559('0x2d')];this[_0x6559('0x2e')]=_0x41c0f7[_0x6559('0x2e')];}module[_0x6559('0x2f')]=Campaign; \ No newline at end of file +var _0xc9d9=['limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrTotalCallsDays','message','active'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc9d9,0x17a));var _0x9c9d=function(_0x448acd,_0x13040a){_0x448acd=_0x448acd-0x0;var _0x1935d8=_0xc9d9[_0x448acd];return _0x1935d8;};'use strict';function Campaign(_0x16e2fd){this['id']=_0x16e2fd['id']||0x0;this['name']=_0x16e2fd['name']||'';this[_0x9c9d('0x0')]=_0x16e2fd[_0x9c9d('0x0')]||'campaign';this[_0x9c9d('0x1')]=0x0;this[_0x9c9d('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x9c9d('0x3')]=0x0;this[_0x9c9d('0x4')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x16e2fd[_0x9c9d('0x5')];this[_0x9c9d('0x6')]=_0x16e2fd[_0x9c9d('0x6')];this['dialTimezone']=_0x16e2fd['dialTimezone']||null;this[_0x9c9d('0x7')]=_0x16e2fd[_0x9c9d('0x7')]?_0x16e2fd[_0x9c9d('0x7')]:null;this[_0x9c9d('0x8')]=_0x16e2fd[_0x9c9d('0x8')];this[_0x9c9d('0x9')]=_0x16e2fd[_0x9c9d('0x9')];this[_0x9c9d('0xa')]=_0x16e2fd[_0x9c9d('0xa')]||0x1e;this[_0x9c9d('0xb')]=_0x16e2fd[_0x9c9d('0xb')];this[_0x9c9d('0xc')]=_0x16e2fd[_0x9c9d('0xc')];this['dialBusyMaxRetry']=_0x16e2fd[_0x9c9d('0xd')];this[_0x9c9d('0xe')]=_0x16e2fd[_0x9c9d('0xe')];this[_0x9c9d('0xf')]=_0x16e2fd[_0x9c9d('0xf')];this[_0x9c9d('0x10')]=_0x16e2fd[_0x9c9d('0x10')];this[_0x9c9d('0x11')]=_0x16e2fd[_0x9c9d('0x11')];this[_0x9c9d('0x12')]=_0x16e2fd[_0x9c9d('0x12')]||0x3;this[_0x9c9d('0x13')]=_0x16e2fd['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x16e2fd[_0x9c9d('0x14')]||0x3;this['dialDropRetryFrequency']=_0x16e2fd[_0x9c9d('0x15')]||0x96;this[_0x9c9d('0x16')]=_0x16e2fd['dialAbandonedMaxRetry']||0x3;this[_0x9c9d('0x17')]=_0x16e2fd[_0x9c9d('0x17')]||0x96;this['dialMachineMaxRetry']=_0x16e2fd[_0x9c9d('0x18')]||0x3;this[_0x9c9d('0x19')]=_0x16e2fd['dialMachineRetryFrequency']||0x96;this[_0x9c9d('0x1a')]=_0x16e2fd[_0x9c9d('0x1a')]||0x3;this[_0x9c9d('0x1b')]=_0x16e2fd[_0x9c9d('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x16e2fd[_0x9c9d('0x1c')]||_0x9c9d('0x1d');this[_0x9c9d('0x1e')]=_0x16e2fd[_0x9c9d('0x1e')]||undefined;this[_0x9c9d('0x1f')]=_0x16e2fd['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9c9d('0x20')]=_0x16e2fd[_0x9c9d('0x20')]||undefined;this[_0x9c9d('0x21')]=_0x16e2fd['TrunkBackup']?_0x16e2fd[_0x9c9d('0x21')]:undefined;this[_0x9c9d('0x22')]=_0x16e2fd['Trunk']?_0x16e2fd[_0x9c9d('0x22')]:undefined;this[_0x9c9d('0x23')]=_0x16e2fd[_0x9c9d('0x23')]?_0x16e2fd[_0x9c9d('0x23')]:undefined;this[_0x9c9d('0x24')]=_0x16e2fd['SquareProject']?_0x16e2fd[_0x9c9d('0x24')]:undefined;this['dialQueueProject']=_0x16e2fd[_0x9c9d('0x24')]?_0x16e2fd[_0x9c9d('0x24')][_0x9c9d('0x25')]:undefined;this['dialAMDActive']=_0x16e2fd['dialAMDActive']||![];this[_0x9c9d('0x26')]=_0x16e2fd[_0x9c9d('0x26')];this[_0x9c9d('0x27')]=_0x16e2fd[_0x9c9d('0x27')];this[_0x9c9d('0x28')]=_0x16e2fd[_0x9c9d('0x28')];this[_0x9c9d('0x29')]=_0x16e2fd[_0x9c9d('0x29')];this[_0x9c9d('0x2a')]=_0x16e2fd[_0x9c9d('0x2a')];this[_0x9c9d('0x2b')]=_0x16e2fd[_0x9c9d('0x2b')];this[_0x9c9d('0x2c')]=_0x16e2fd[_0x9c9d('0x2c')];this['dialAMDSilenceThreshold']=_0x16e2fd[_0x9c9d('0x2d')];this[_0x9c9d('0x2e')]=_0x16e2fd['dialAMDMaximumWordLength'];}module[_0x9c9d('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f159a80..77dd3a9 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 _0xa693=['exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x366bf9,_0xc18730){var _0x1b72a4=function(_0x4ddd3f){while(--_0x4ddd3f){_0x366bf9['push'](_0x366bf9['shift']());}};_0x1b72a4(++_0xc18730);}(_0xa693,0xf1));var _0x3a69=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xa693[_0x118653];return _0xc11fa6;};'use strict';function Channel(){this[_0x3a69('0x0')]=null;this[_0x3a69('0x1')]='';this[_0x3a69('0x2')]='';this[_0x3a69('0x3')]=0x0;this[_0x3a69('0x4')]='';this[_0x3a69('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3a69('0x6')]=0x0;this[_0x3a69('0x7')]=0x0;this[_0x3a69('0x8')]=0x0;this[_0x3a69('0x9')]=![];this[_0x3a69('0xa')]=null;this[_0x3a69('0xb')]=null;this[_0x3a69('0xc')]=![];this['abandoned']=![];this[_0x3a69('0xd')]='';this[_0x3a69('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3a69('0xf')]=null;this['tag']=null;this[_0x3a69('0x10')]=null;this[_0x3a69('0x11')]=![];this[_0x3a69('0x12')]=null;this[_0x3a69('0x13')]=null;this[_0x3a69('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x3a69('0x15')]=undefined;this[_0x3a69('0x16')]=undefined;this['mohtime']=0x0;}module[_0x3a69('0x17')]=Channel; \ No newline at end of file +var _0x9962=['tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','type'];(function(_0x39ba00,_0x369bfb){var _0x50488=function(_0x19b46d){while(--_0x19b46d){_0x39ba00['push'](_0x39ba00['shift']());}};_0x50488(++_0x369bfb);}(_0x9962,0xb8));var _0x2996=function(_0x21c791,_0x2f7665){_0x21c791=_0x21c791-0x0;var _0x24bcb6=_0x9962[_0x21c791];return _0x24bcb6;};'use strict';function Channel(){this[_0x2996('0x0')]=null;this['channel']='';this[_0x2996('0x1')]='';this[_0x2996('0x2')]=0x0;this[_0x2996('0x3')]='';this['connectedlinenum']=undefined;this[_0x2996('0x4')]=undefined;this['accountcode']=0x0;this[_0x2996('0x5')]='';this[_0x2996('0x6')]=0x0;this['linkedid']=0x0;this[_0x2996('0x7')]=0x0;this[_0x2996('0x8')]=![];this['answertime']=null;this[_0x2996('0x9')]=null;this[_0x2996('0xa')]=![];this[_0x2996('0xb')]=![];this[_0x2996('0xc')]='';this[_0x2996('0xd')]='';this['duration']=0x0;this[_0x2996('0xe')]=0x0;this['holdtime']=0x0;this[_0x2996('0xf')]=null;this[_0x2996('0x10')]=null;this[_0x2996('0x11')]=null;this[_0x2996('0x12')]=![];this['monitorFilename']=null;this[_0x2996('0x13')]=null;this[_0x2996('0x14')]=[];this[_0x2996('0x15')]=undefined;this[_0x2996('0x16')]=undefined;this['transferType']=undefined;this[_0x2996('0x17')]=0x0;}module[_0x2996('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d641839..bd381b6 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 _0x8dec=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x1b8d1c,_0x395b3b){var _0x159a0b=function(_0x564655){while(--_0x564655){_0x1b8d1c['push'](_0x1b8d1c['shift']());}};_0x159a0b(++_0x395b3b);}(_0x8dec,0x1b0));var _0xc8de=function(_0x2aeba4,_0x47184c){_0x2aeba4=_0x2aeba4-0x0;var _0x3db727=_0x8dec[_0x2aeba4];return _0x3db727;};'use strict';function DeskAccount(_0x3b3f25){this['id']=_0x3b3f25['id']||0x0;this[_0xc8de('0x0')]=_0x3b3f25[_0xc8de('0x0')]||'';this[_0xc8de('0x1')]=_0x3b3f25[_0xc8de('0x1')]||'';this[_0xc8de('0x2')]=_0x3b3f25[_0xc8de('0x2')]||'';this[_0xc8de('0x3')]=_0x3b3f25[_0xc8de('0x3')]||'';this[_0xc8de('0x4')]=_0x3b3f25['password']||'';this[_0xc8de('0x5')]=_0x3b3f25['consumerKey']||'';this[_0xc8de('0x6')]=_0x3b3f25[_0xc8de('0x6')]||'';this['token']=_0x3b3f25[_0xc8de('0x7')]||'';this['tokenSecret']=_0x3b3f25[_0xc8de('0x8')]||'';this[_0xc8de('0x9')]=_0x3b3f25[_0xc8de('0x9')]||'';this[_0xc8de('0xa')]=_0x3b3f25['serverUrl']||'';this['Configurations']=_0x3b3f25[_0xc8de('0xb')]||{};}module[_0xc8de('0xc')]=DeskAccount; \ No newline at end of file +var _0x9e3d=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username'];(function(_0x5ca7f5,_0x1548d8){var _0x23f405=function(_0x10d16f){while(--_0x10d16f){_0x5ca7f5['push'](_0x5ca7f5['shift']());}};_0x23f405(++_0x1548d8);}(_0x9e3d,0x1d2));var _0xd9e3=function(_0x50294e,_0x3a59ec){_0x50294e=_0x50294e-0x0;var _0x318989=_0x9e3d[_0x50294e];return _0x318989;};'use strict';function DeskAccount(_0x11241b){this['id']=_0x11241b['id']||0x0;this['name']=_0x11241b[_0xd9e3('0x0')]||'';this[_0xd9e3('0x1')]=_0x11241b['username']||'';this[_0xd9e3('0x2')]=_0x11241b[_0xd9e3('0x2')]||'';this[_0xd9e3('0x3')]=_0x11241b[_0xd9e3('0x3')]||'';this[_0xd9e3('0x4')]=_0x11241b['password']||'';this[_0xd9e3('0x5')]=_0x11241b[_0xd9e3('0x5')]||'';this[_0xd9e3('0x6')]=_0x11241b['consumerSecret']||'';this[_0xd9e3('0x7')]=_0x11241b[_0xd9e3('0x7')]||'';this[_0xd9e3('0x8')]=_0x11241b['tokenSecret']||'';this['type']=_0x11241b['type']||'';this[_0xd9e3('0x9')]=_0x11241b[_0xd9e3('0x9')]||'';this[_0xd9e3('0xa')]=_0x11241b[_0xd9e3('0xa')]||{};}module[_0xd9e3('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d66c491..90a28ff 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 _0x4a38=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x2fd719,_0xa1c429){var _0x3fcc83=function(_0x8e31fa){while(--_0x8e31fa){_0x2fd719['push'](_0x2fd719['shift']());}};_0x3fcc83(++_0xa1c429);}(_0x4a38,0x10a));var _0x84a3=function(_0x3e4f47,_0x5c35cc){_0x3e4f47=_0x3e4f47-0x0;var _0xa65175=_0x4a38[_0x3e4f47];return _0xa65175;};'use strict';function Dynamics365Account(_0x3d861e){this['id']=_0x3d861e['id']||0x0;this[_0x84a3('0x0')]=_0x3d861e['name']||'';this[_0x84a3('0x1')]=_0x3d861e[_0x84a3('0x1')]||'';this['password']=_0x3d861e[_0x84a3('0x2')]||'';this['remoteUri']=_0x3d861e[_0x84a3('0x3')]||'';this[_0x84a3('0x4')]=_0x3d861e['tenantId']||'';this[_0x84a3('0x5')]=_0x3d861e[_0x84a3('0x5')]||'';this['clientSecret']=_0x3d861e[_0x84a3('0x6')]||{};this[_0x84a3('0x7')]=_0x3d861e[_0x84a3('0x7')]||'';this[_0x84a3('0x8')]=_0x3d861e[_0x84a3('0x8')]||![];this[_0x84a3('0x9')]=_0x3d861e[_0x84a3('0x9')]||{};this[_0x84a3('0xa')]=_0x3d861e['CloudProvider']||{};}module[_0x84a3('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x9240=['name','username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x9240,0x181));var _0x0924=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x9240[_0x369151];return _0x4292d5;};'use strict';function Dynamics365Account(_0x209160){this['id']=_0x209160['id']||0x0;this['name']=_0x209160[_0x0924('0x0')]||'';this[_0x0924('0x1')]=_0x209160[_0x0924('0x1')]||'';this[_0x0924('0x2')]=_0x209160[_0x0924('0x2')]||'';this['remoteUri']=_0x209160[_0x0924('0x3')]||'';this[_0x0924('0x4')]=_0x209160[_0x0924('0x4')]||'';this['clientId']=_0x209160['clientId']||'';this[_0x0924('0x5')]=_0x209160[_0x0924('0x5')]||{};this[_0x0924('0x6')]=_0x209160[_0x0924('0x6')]||'';this[_0x0924('0x7')]=_0x209160[_0x0924('0x7')]||![];this[_0x0924('0x8')]=_0x209160[_0x0924('0x8')]||{};this[_0x0924('0x9')]=_0x209160[_0x0924('0x9')]||{};}module[_0x0924('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 e2fd620..5b0a26a 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 _0x258c=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x51c45c,_0x5dd7a1){var _0x22ac3f=function(_0x82e027){while(--_0x82e027){_0x51c45c['push'](_0x51c45c['shift']());}};_0x22ac3f(++_0x5dd7a1);}(_0x258c,0x17b));var _0xc258=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x258c[_0x122ef9];return _0x42fba0;};'use strict';function FaxAccount(_0x1ed9d3){this['id']=_0x1ed9d3['id']||0x0;this[_0xc258('0x0')]=_0x1ed9d3['name']||'';this['description']=_0x1ed9d3[_0xc258('0x1')];this[_0xc258('0x2')]=_0x1ed9d3[_0xc258('0x2')];this['headerinfo']=_0x1ed9d3[_0xc258('0x3')];this[_0xc258('0x4')]=_0x1ed9d3[_0xc258('0x4')];this[_0xc258('0x5')]=_0x1ed9d3[_0xc258('0x5')]||0x960;this[_0xc258('0x6')]=_0x1ed9d3[_0xc258('0x6')]||0x3840;this[_0xc258('0x7')]=_0x1ed9d3[_0xc258('0x7')]||_0xc258('0x8');this[_0xc258('0x9')]=_0x1ed9d3[_0xc258('0x9')]||'no';this[_0xc258('0xa')]=_0x1ed9d3['faxdetect']||'no';this[_0xc258('0xb')]=_0x1ed9d3[_0xc258('0xb')]||0x1388;this['tech']=_0x1ed9d3['tech']||_0xc258('0xc');this[_0xc258('0xd')]=_0x1ed9d3[_0xc258('0xd')]?_0x1ed9d3['Trunk']:undefined;this[_0xc258('0xe')]=_0x1ed9d3[_0xc258('0xe')];this['key']=_0x1ed9d3[_0xc258('0xf')];}module[_0xc258('0x10')]=FaxAccount; \ No newline at end of file +var _0x1a01=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a01,0x18a));var _0x11a0=function(_0x18cf9a,_0xb19502){_0x18cf9a=_0x18cf9a-0x0;var _0x1203f7=_0x1a01[_0x18cf9a];return _0x1203f7;};'use strict';function FaxAccount(_0x5b03cb){this['id']=_0x5b03cb['id']||0x0;this['name']=_0x5b03cb[_0x11a0('0x0')]||'';this[_0x11a0('0x1')]=_0x5b03cb[_0x11a0('0x1')];this['ecm']=_0x5b03cb[_0x11a0('0x2')];this[_0x11a0('0x3')]=_0x5b03cb[_0x11a0('0x3')];this[_0x11a0('0x4')]=_0x5b03cb[_0x11a0('0x4')];this['minrate']=_0x5b03cb['minrate']||0x960;this[_0x11a0('0x5')]=_0x5b03cb['maxrate']||0x3840;this[_0x11a0('0x6')]=_0x5b03cb[_0x11a0('0x6')]||_0x11a0('0x7');this[_0x11a0('0x8')]=_0x5b03cb[_0x11a0('0x8')]||'no';this[_0x11a0('0x9')]=_0x5b03cb['faxdetect']||'no';this[_0x11a0('0xa')]=_0x5b03cb['t38timeout']||0x1388;this[_0x11a0('0xb')]=_0x5b03cb[_0x11a0('0xb')]||_0x11a0('0xc');this['Trunk']=_0x5b03cb['Trunk']?_0x5b03cb[_0x11a0('0xd')]:undefined;this[_0x11a0('0xe')]=_0x5b03cb[_0x11a0('0xe')];this[_0x11a0('0xf')]=_0x5b03cb['key'];}module[_0x11a0('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 d894d03..ae4d910 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 _0x26f6=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x26f6,0x1b9));var _0x626f=function(_0x843550,_0x298d5e){_0x843550=_0x843550-0x0;var _0x47cafe=_0x26f6[_0x843550];return _0x47cafe;};'use strict';function FreshdeskAccount(_0x47e094){this['id']=_0x47e094['id']||0x0;this[_0x626f('0x0')]=_0x47e094['name']||'';this[_0x626f('0x1')]=_0x47e094['username']||'';this[_0x626f('0x2')]=_0x47e094[_0x626f('0x3')]||'';this['remoteUri']=_0x47e094[_0x626f('0x4')]||'';this[_0x626f('0x5')]=_0x47e094[_0x626f('0x5')]||'';this[_0x626f('0x6')]=_0x47e094[_0x626f('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x15cd=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x2e46d0,_0x37cfc1){var _0x160812=function(_0x39ba25){while(--_0x39ba25){_0x2e46d0['push'](_0x2e46d0['shift']());}};_0x160812(++_0x37cfc1);}(_0x15cd,0x1b9));var _0xd15c=function(_0x125a8a,_0x490d31){_0x125a8a=_0x125a8a-0x0;var _0xe767a5=_0x15cd[_0x125a8a];return _0xe767a5;};'use strict';function FreshdeskAccount(_0x28168d){this['id']=_0x28168d['id']||0x0;this[_0xd15c('0x0')]=_0x28168d[_0xd15c('0x0')]||'';this['username']=_0x28168d[_0xd15c('0x1')]||'';this[_0xd15c('0x2')]=_0x28168d['token']||'';this['remoteUri']=_0x28168d[_0xd15c('0x3')]||'';this[_0xd15c('0x4')]=_0x28168d[_0xd15c('0x4')]||'';this[_0xd15c('0x5')]=_0x28168d[_0xd15c('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 86e558f..76c60fe 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 _0x6b8f=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x6815c6,_0x547fae){var _0x1501aa=function(_0x207e20){while(--_0x207e20){_0x6815c6['push'](_0x6815c6['shift']());}};_0x1501aa(++_0x547fae);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x5b1859,_0x2ef4bb){_0x5b1859=_0x5b1859-0x0;var _0x11dda0=_0x6b8f[_0x5b1859];return _0x11dda0;};'use strict';function FreshsalesAccount(_0x21be63){this['id']=_0x21be63['id']||0x0;this[_0xf6b8('0x0')]=_0x21be63['name']||'';this[_0xf6b8('0x1')]=_0x21be63['username']||'';this['apiKey']=_0x21be63[_0xf6b8('0x2')]||'';this[_0xf6b8('0x3')]=_0x21be63['remoteUri']||'';this[_0xf6b8('0x4')]=_0x21be63[_0xf6b8('0x4')]||'';this[_0xf6b8('0x5')]=_0x21be63['Configurations']||{};}module[_0xf6b8('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x6dc0=['token','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x575e50,_0xa1c92d){var _0x1057b1=function(_0x12ac8d){while(--_0x12ac8d){_0x575e50['push'](_0x575e50['shift']());}};_0x1057b1(++_0xa1c92d);}(_0x6dc0,0x18c));var _0x06dc=function(_0x275fab,_0x1e7bd7){_0x275fab=_0x275fab-0x0;var _0x1a0f2c=_0x6dc0[_0x275fab];return _0x1a0f2c;};'use strict';function FreshsalesAccount(_0x18f656){this['id']=_0x18f656['id']||0x0;this['name']=_0x18f656[_0x06dc('0x0')]||'';this[_0x06dc('0x1')]=_0x18f656[_0x06dc('0x1')]||'';this[_0x06dc('0x2')]=_0x18f656[_0x06dc('0x3')]||'';this['remoteUri']=_0x18f656['remoteUri']||'';this[_0x06dc('0x4')]=_0x18f656[_0x06dc('0x4')]||'';this['Configurations']=_0x18f656[_0x06dc('0x5')]||{};}module[_0x06dc('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 2120e30..86bbd5a 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 _0xe5ee=['count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xe5ee,0xd2));var _0xee5e=function(_0x3d1b9f,_0x246553){_0x3d1b9f=_0x3d1b9f-0x0;var _0x1ca522=_0xe5ee[_0x3d1b9f];return _0x1ca522;};'use strict';function QueueReport(){this[_0xee5e('0x0')]='inbound';this[_0xee5e('0x1')]='';this[_0xee5e('0x2')]='';this['calleridname']='';this[_0xee5e('0x3')]='';this[_0xee5e('0x4')]=null;this[_0xee5e('0x5')]=null;this['position']=0x1;this[_0xee5e('0x6')]=0x1;this[_0xee5e('0x7')]=![];this[_0xee5e('0x8')]=null;this['queuecallercomplete']=![];this[_0xee5e('0x9')]=null;this[_0xee5e('0xa')]=![];this['queuecallerexitAt']=null;this[_0xee5e('0xb')]=0x1;this[_0xee5e('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xee5e('0xd')]='';this[_0xee5e('0xe')]='';this[_0xee5e('0xf')]='';this[_0xee5e('0x10')]='';this[_0xee5e('0x11')]=0x0;this[_0xee5e('0x12')]=![];this[_0xee5e('0x13')]='';this['motionChannel']=_0xee5e('0x14');this[_0xee5e('0x15')]=0x0;this[_0xee5e('0x16')]={};}module[_0xee5e('0x17')]=QueueReport; \ No newline at end of file +var _0xd2c2=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridname','queue','queuecallerjoinAt','position','count'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0xd2c2,0x1a2));var _0x2d2c=function(_0x2ce676,_0x1506a8){_0x2ce676=_0x2ce676-0x0;var _0x1e8ddf=_0xd2c2[_0x2ce676];return _0x1e8ddf;};'use strict';function QueueReport(){this[_0x2d2c('0x0')]=_0x2d2c('0x1');this['uniqueid']='';this['calleridnum']='';this[_0x2d2c('0x2')]='';this[_0x2d2c('0x3')]='';this[_0x2d2c('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x2d2c('0x5')]=0x1;this[_0x2d2c('0x6')]=0x1;this[_0x2d2c('0x7')]=![];this[_0x2d2c('0x8')]=null;this[_0x2d2c('0x9')]=![];this[_0x2d2c('0xa')]=null;this[_0x2d2c('0xb')]=![];this[_0x2d2c('0xc')]=null;this[_0x2d2c('0xd')]=0x1;this[_0x2d2c('0xe')]='';this['connectedlinenum']='';this[_0x2d2c('0xf')]='';this['accountcode']='';this[_0x2d2c('0x10')]='';this[_0x2d2c('0x11')]='';this[_0x2d2c('0x12')]='';this[_0x2d2c('0x13')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x2d2c('0x14')]=_0x2d2c('0x15');this[_0x2d2c('0x16')]=0x0;this[_0x2d2c('0x17')]={};}module[_0x2d2c('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c2beaac..158ce16 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 _0x7382=['serverUrl','Configurations','exports','name','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x7382,0x111));var _0x2738=function(_0x4c3e46,_0x13b09c){_0x4c3e46=_0x4c3e46-0x0;var _0x2edf6a=_0x7382[_0x4c3e46];return _0x2edf6a;};'use strict';function SalesforceAccount(_0xa7d3b1){this['id']=_0xa7d3b1['id']||0x0;this[_0x2738('0x0')]=_0xa7d3b1['name']||'';this['username']=_0xa7d3b1['username']||'';this['remoteUri']=_0xa7d3b1['remoteUri']||'';this[_0x2738('0x1')]=_0xa7d3b1[_0x2738('0x1')]||'';this[_0x2738('0x2')]=_0xa7d3b1[_0x2738('0x2')]||'';this[_0x2738('0x3')]=_0xa7d3b1['clientSecret']||'';this[_0x2738('0x4')]=_0xa7d3b1[_0x2738('0x4')]||'';this[_0x2738('0x5')]=_0xa7d3b1['type']||_0x2738('0x6');this[_0x2738('0x7')]=_0xa7d3b1[_0x2738('0x7')]||'';this['Configurations']=_0xa7d3b1[_0x2738('0x8')]||{};}module[_0x2738('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x55d6=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken'];(function(_0x1edd09,_0x32a475){var _0x15325e=function(_0x31ae8d){while(--_0x31ae8d){_0x1edd09['push'](_0x1edd09['shift']());}};_0x15325e(++_0x32a475);}(_0x55d6,0x112));var _0x655d=function(_0x5109b4,_0x5c5523){_0x5109b4=_0x5109b4-0x0;var _0x180ea3=_0x55d6[_0x5109b4];return _0x180ea3;};'use strict';function SalesforceAccount(_0x4f9d4f){this['id']=_0x4f9d4f['id']||0x0;this[_0x655d('0x0')]=_0x4f9d4f['name']||'';this[_0x655d('0x1')]=_0x4f9d4f[_0x655d('0x1')]||'';this[_0x655d('0x2')]=_0x4f9d4f[_0x655d('0x2')]||'';this[_0x655d('0x3')]=_0x4f9d4f['password']||'';this[_0x655d('0x4')]=_0x4f9d4f[_0x655d('0x4')]||'';this['clientSecret']=_0x4f9d4f['clientSecret']||'';this[_0x655d('0x5')]=_0x4f9d4f['securityToken']||'';this[_0x655d('0x6')]=_0x4f9d4f[_0x655d('0x6')]||'integrationTab';this[_0x655d('0x7')]=_0x4f9d4f['serverUrl']||'';this[_0x655d('0x8')]=_0x4f9d4f[_0x655d('0x8')]||{};}module[_0x655d('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 8bbc178..8bf9b20 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 _0x72f4=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1be33f,_0x58d8cb){var _0x142f9a=function(_0x1a4603){while(--_0x1a4603){_0x1be33f['push'](_0x1be33f['shift']());}};_0x142f9a(++_0x58d8cb);}(_0x72f4,0x133));var _0x472f=function(_0x32697f,_0x350beb){_0x32697f=_0x32697f-0x0;var _0x1c4542=_0x72f4[_0x32697f];return _0x1c4542;};'use strict';function ServicenowAccount(_0x1c16e7){this['id']=_0x1c16e7['id']||0x0;this[_0x472f('0x0')]=_0x1c16e7[_0x472f('0x0')]||'';this[_0x472f('0x1')]=_0x1c16e7['username']||'';this[_0x472f('0x2')]=_0x1c16e7['password']||'';this[_0x472f('0x3')]=_0x1c16e7[_0x472f('0x3')]||'';this[_0x472f('0x4')]=_0x1c16e7[_0x472f('0x4')]||'';this[_0x472f('0x5')]=_0x1c16e7[_0x472f('0x5')]||{};}module[_0x472f('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x170d=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x40677d,_0x53f599){var _0x37076c=function(_0x39bfc1){while(--_0x39bfc1){_0x40677d['push'](_0x40677d['shift']());}};_0x37076c(++_0x53f599);}(_0x170d,0x163));var _0xd170=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x170d[_0x40a045];return _0x1a687c;};'use strict';function ServicenowAccount(_0xe645d4){this['id']=_0xe645d4['id']||0x0;this[_0xd170('0x0')]=_0xe645d4[_0xd170('0x0')]||'';this[_0xd170('0x1')]=_0xe645d4[_0xd170('0x1')]||'';this[_0xd170('0x2')]=_0xe645d4[_0xd170('0x2')]||'';this[_0xd170('0x3')]=_0xe645d4[_0xd170('0x3')]||'';this[_0xd170('0x4')]=_0xe645d4[_0xd170('0x4')]||'';this['Configurations']=_0xe645d4[_0xd170('0x5')]||{};}module[_0xd170('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 3bda696..c6ea659 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 _0x8b51=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1a5c70,_0x57ba37){var _0x512a2c=function(_0x4faea0){while(--_0x4faea0){_0x1a5c70['push'](_0x1a5c70['shift']());}};_0x512a2c(++_0x57ba37);}(_0x8b51,0xef));var _0x18b5=function(_0x29adb2,_0x48616f){_0x29adb2=_0x29adb2-0x0;var _0x250229=_0x8b51[_0x29adb2];return _0x250229;};'use strict';function SugarcrmAccount(_0x19fb8a){this['id']=_0x19fb8a['id']||0x0;this[_0x18b5('0x0')]=_0x19fb8a[_0x18b5('0x0')]||'';this[_0x18b5('0x1')]=_0x19fb8a[_0x18b5('0x1')]||'';this[_0x18b5('0x2')]=_0x19fb8a[_0x18b5('0x2')]||'';this['remoteUri']=_0x19fb8a[_0x18b5('0x3')]||'';this[_0x18b5('0x4')]=_0x19fb8a[_0x18b5('0x4')]||'';this['Configurations']=_0x19fb8a[_0x18b5('0x5')]||{};}module[_0x18b5('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x94fe=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x94fe,0x1b7));var _0xe94f=function(_0x1c859d,_0x3f87fb){_0x1c859d=_0x1c859d-0x0;var _0x214ce4=_0x94fe[_0x1c859d];return _0x214ce4;};'use strict';function SugarcrmAccount(_0x217d9b){this['id']=_0x217d9b['id']||0x0;this[_0xe94f('0x0')]=_0x217d9b[_0xe94f('0x0')]||'';this[_0xe94f('0x1')]=_0x217d9b[_0xe94f('0x1')]||'';this[_0xe94f('0x2')]=_0x217d9b[_0xe94f('0x2')]||'';this[_0xe94f('0x3')]=_0x217d9b[_0xe94f('0x3')]||'';this[_0xe94f('0x4')]=_0x217d9b[_0xe94f('0x4')]||'';this[_0xe94f('0x5')]=_0x217d9b[_0xe94f('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d58a541..f29dfa3 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 _0x17ae=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x17ae,0x1c5));var _0xe17a=function(_0x3344ab,_0x153df3){_0x3344ab=_0x3344ab-0x0;var _0x527ae9=_0x17ae[_0x3344ab];return _0x527ae9;};'use strict';function Telephone(_0x30b139){this['id']=_0x30b139['id']||0x0;this['name']=_0x30b139[_0xe17a('0x0')]||'';this[_0xe17a('0x1')]=_0x30b139[_0xe17a('0x1')]||'';this[_0xe17a('0x2')]=_0xe17a('0x3');this[_0xe17a('0x4')]=0x0;this['status']=_0xe17a('0x3');this[_0xe17a('0x5')]='';}module[_0xe17a('0x6')]=Telephone; \ No newline at end of file +var _0x74f3=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x54fccc,_0x202ffc){var _0x9a1f1f=function(_0x403e7a){while(--_0x403e7a){_0x54fccc['push'](_0x54fccc['shift']());}};_0x9a1f1f(++_0x202ffc);}(_0x74f3,0xc1));var _0x374f=function(_0x3579b2,_0x18f317){_0x3579b2=_0x3579b2-0x0;var _0x5745aa=_0x74f3[_0x3579b2];return _0x5745aa;};'use strict';function Telephone(_0x1c52e2){this['id']=_0x1c52e2['id']||0x0;this[_0x374f('0x0')]=_0x1c52e2[_0x374f('0x0')]||'';this[_0x374f('0x1')]=_0x1c52e2[_0x374f('0x1')]||'';this[_0x374f('0x2')]=_0x374f('0x3');this[_0x374f('0x4')]=0x0;this[_0x374f('0x5')]=_0x374f('0x3');this[_0x374f('0x6')]='';}module[_0x374f('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3a18034..93cb053 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(_0xe050ff,_0x512c24){var _0x4c7fff=function(_0x3cb85f){while(--_0x3cb85f){_0xe050ff['push'](_0xe050ff['shift']());}};_0x4c7fff(++_0x512c24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 _0xa9e0=['exports','name'];(function(_0x402f3f,_0x3b959c){var _0x39569c=function(_0x35a433){while(--_0x35a433){_0x402f3f['push'](_0x402f3f['shift']());}};_0x39569c(++_0x3b959c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 8e77a50..9c0afe7 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x5eb8,0xb0));var _0x85eb=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x5eb8[_0x307bf6];return _0x2878fc;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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 ba1f651..a7ab9e7 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 _0x2b20=['unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','address','defaultuser','active','name'];(function(_0x40ea35,_0x1d8264){var _0x7d308a=function(_0x2b8bbb){while(--_0x2b8bbb){_0x40ea35['push'](_0x40ea35['shift']());}};_0x7d308a(++_0x1d8264);}(_0x2b20,0x11b));var _0x02b2=function(_0x5ed00f,_0x10e9de){_0x5ed00f=_0x5ed00f-0x0;var _0x3c05b1=_0x2b20[_0x5ed00f];return _0x3c05b1;};'use strict';function Trunk(_0x22d8e8){this['id']=_0x22d8e8['id']||0x0;this[_0x02b2('0x0')]=_0x22d8e8[_0x02b2('0x0')]||![];this[_0x02b2('0x1')]=_0x22d8e8['name']||'';this['state']=_0x02b2('0x2');this[_0x02b2('0x3')]=0x0;this[_0x02b2('0x4')]=_0x02b2('0x2');this[_0x02b2('0x5')]=_0x22d8e8[_0x02b2('0x5')]&&_0x22d8e8['registry'][_0x02b2('0x6')](':')?_0x22d8e8['registry'][_0x02b2('0x7')](':')[0x0]:'';this[_0x02b2('0x8')]='';this[_0x02b2('0x9')]='';this['domain']='';this[_0x02b2('0xa')]='';this[_0x02b2('0xb')]='';this[_0x02b2('0xc')]=_0x02b2('0x2');this['registrationtime']='';this[_0x02b2('0xd')]='';this['defaultuser']=_0x22d8e8[_0x02b2('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb6f0=['split','host','port','domain','refresh','stateRegistry','address','defaultuser','active','name','state','unknown','status','registry','indexOf'];(function(_0x74b2c2,_0x166aac){var _0x2230ba=function(_0xdb9cab){while(--_0xdb9cab){_0x74b2c2['push'](_0x74b2c2['shift']());}};_0x2230ba(++_0x166aac);}(_0xb6f0,0x152));var _0x0b6f=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xb6f0[_0x412e27];return _0x53da42;};'use strict';function Trunk(_0x438376){this['id']=_0x438376['id']||0x0;this[_0x0b6f('0x0')]=_0x438376[_0x0b6f('0x0')]||![];this[_0x0b6f('0x1')]=_0x438376[_0x0b6f('0x1')]||'';this[_0x0b6f('0x2')]=_0x0b6f('0x3');this['stateTime']=0x0;this[_0x0b6f('0x4')]='unknown';this[_0x0b6f('0x5')]=_0x438376['registry']&&_0x438376[_0x0b6f('0x5')][_0x0b6f('0x6')](':')?_0x438376[_0x0b6f('0x5')][_0x0b6f('0x7')](':')[0x0]:'';this[_0x0b6f('0x8')]='';this[_0x0b6f('0x9')]='';this[_0x0b6f('0xa')]='';this['domainport']='';this[_0x0b6f('0xb')]='';this[_0x0b6f('0xc')]='unknown';this['registrationtime']='';this[_0x0b6f('0xd')]='';this['defaultuser']=_0x438376[_0x0b6f('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fc779b1..5e88fa9 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 _0xf7fa=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xe023c5,_0x1ca243){var _0x29b030=function(_0x24ce54){while(--_0x24ce54){_0xe023c5['push'](_0xe023c5['shift']());}};_0x29b030(++_0x1ca243);}(_0xf7fa,0x1ee));var _0xaf7f=function(_0x4de50f,_0x2a47d3){_0x4de50f=_0x4de50f-0x0;var _0x53bbf3=_0xf7fa[_0x4de50f];return _0x53bbf3;};'use strict';function voiceExtension(_0xf42532){this['id']=_0xf42532['id']||0x0;this[_0xaf7f('0x0')]=_0xf42532[_0xaf7f('0x0')]||'';this[_0xaf7f('0x1')]=_0xf42532['recordingFormat']||_0xaf7f('0x2');this['mandatoryDisposition']=_0xf42532[_0xaf7f('0x3')]||![];}module[_0xaf7f('0x4')]=voiceExtension; \ No newline at end of file +var _0x2d50=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5dcecc,_0xcae07d){var _0x85bc26=function(_0x391492){while(--_0x391492){_0x5dcecc['push'](_0x5dcecc['shift']());}};_0x85bc26(++_0xcae07d);}(_0x2d50,0x17a));var _0x02d5=function(_0x7c694d,_0x3413c4){_0x7c694d=_0x7c694d-0x0;var _0x25c7de=_0x2d50[_0x7c694d];return _0x25c7de;};'use strict';function voiceExtension(_0x43403b){this['id']=_0x43403b['id']||0x0;this[_0x02d5('0x0')]=_0x43403b[_0x02d5('0x0')]||'';this[_0x02d5('0x1')]=_0x43403b[_0x02d5('0x1')]||_0x02d5('0x2');this[_0x02d5('0x3')]=_0x43403b[_0x02d5('0x3')]||![];}module[_0x02d5('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 1964447..b74e72e 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 _0x62a0=['outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62a0,0x19c));var _0x062a=function(_0x2ab4de,_0x1c598f){_0x2ab4de=_0x2ab4de-0x0;var _0x126469=_0x62a0[_0x2ab4de];return _0x126469;};'use strict';var statusDesc=['unknown',_0x062a('0x0'),_0x062a('0x1'),'busy',_0x062a('0x2'),_0x062a('0x3'),_0x062a('0x4'),'ringinuse',_0x062a('0x5')];var monitorFormat={'wav':_0x062a('0x6'),'wav49':_0x062a('0x7'),'gsm':_0x062a('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x062a('0x9')};function VoiceQueue(_0x114ed7){this['id']=_0x114ed7['id']||0x0;this['name']=_0x114ed7[_0x062a('0xa')]||'';this['monitor_format']=_0x114ed7[_0x062a('0xb')]||'';this[_0x062a('0xc')]=_0x114ed7[_0x062a('0xc')]||_0x062a('0xd');this[_0x062a('0xe')]=0x0;this['talking']=0x0;this[_0x062a('0xf')]=0x0;this[_0x062a('0x10')]=0x0;this['sumDuration']=0x0;this[_0x062a('0x11')]=0x0;this[_0x062a('0x12')]=0x0;this[_0x062a('0x13')]=0x0;this[_0x062a('0x14')]=0x0;this[_0x062a('0x15')]=0x0;this[_0x062a('0x16')]=0x0;this[_0x062a('0x17')]=_0x114ed7[_0x062a('0x17')]||![];this[_0x062a('0x18')]=_0x114ed7[_0x062a('0x18')]||0xa;this['autopause']=_0x114ed7[_0x062a('0x19')]||'no';this[_0x062a('0x1a')]=!![];this[_0x062a('0x1b')]='';this['originated']=0x0;this[_0x062a('0x1c')]=0x0;this[_0x062a('0x1d')]=_0x114ed7['dialTimezone']||null;this[_0x062a('0x1e')]=_0x114ed7[_0x062a('0x1e')]?_0x114ed7[_0x062a('0x1e')]:null;this[_0x062a('0x1f')]=_0x114ed7[_0x062a('0x1f')];this[_0x062a('0x20')]=_0x114ed7[_0x062a('0x20')]||_0x062a('0x21');this[_0x062a('0x22')]=_0x114ed7[_0x062a('0x22')]||0x0;this[_0x062a('0x23')]=_0x114ed7['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x114ed7[_0x062a('0x24')]||0x1;this['dialPredictiveOptimization']=_0x114ed7[_0x062a('0x25')]||_0x062a('0x26');this['dialPredictiveOptimizationPercentage']=_0x114ed7[_0x062a('0x27')]||0.03;this[_0x062a('0x28')]=_0x114ed7[_0x062a('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x114ed7[_0x062a('0x29')]||_0x062a('0x2a');this['dialOriginateCallerIdNumber']=_0x114ed7['dialOriginateCallerIdNumber']||_0x062a('0x2a');this['dialOriginateTimeout']=_0x114ed7[_0x062a('0x2b')]||0x1e;this[_0x062a('0x2c')]=_0x114ed7[_0x062a('0x2c')]||_0x062a('0x2d');this[_0x062a('0x2e')]=_0x114ed7[_0x062a('0x2e')]||0x3;this[_0x062a('0x2f')]=_0x114ed7[_0x062a('0x2f')]||undefined;this[_0x062a('0x30')]=_0x114ed7[_0x062a('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x114ed7['dialCongestionRetryFrequency']||0x96;this[_0x062a('0x31')]=_0x114ed7['dialBusyMaxRetry']||0x3;this[_0x062a('0x32')]=_0x114ed7[_0x062a('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x114ed7['dialNoAnswerMaxRetry']||0x3;this[_0x062a('0x33')]=_0x114ed7[_0x062a('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x114ed7[_0x062a('0x34')]||0x3;this[_0x062a('0x35')]=_0x114ed7[_0x062a('0x35')]||0x96;this[_0x062a('0x36')]=_0x114ed7[_0x062a('0x36')]||0x3;this['dialDropRetryFrequency']=_0x114ed7[_0x062a('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x114ed7[_0x062a('0x38')]||0x3;this[_0x062a('0x39')]=_0x114ed7[_0x062a('0x39')]||0x96;this[_0x062a('0x3a')]=_0x114ed7[_0x062a('0x3a')]||0x3;this[_0x062a('0x3b')]=_0x114ed7[_0x062a('0x3b')]||0x96;this[_0x062a('0x3c')]=_0x114ed7['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x114ed7[_0x062a('0x3d')]||0x96;this[_0x062a('0x3e')]=_0x114ed7[_0x062a('0x3e')]||0x4;this[_0x062a('0x3f')]=_0x114ed7[_0x062a('0x3f')]?_0x114ed7[_0x062a('0x3f')]:undefined;this['TrunkBackup']=_0x114ed7[_0x062a('0x40')]?_0x114ed7[_0x062a('0x40')]:undefined;this[_0x062a('0x41')]=_0x114ed7[_0x062a('0x41')]||undefined;this[_0x062a('0x42')]=_0x114ed7[_0x062a('0x42')]?_0x114ed7[_0x062a('0x42')]:undefined;this[_0x062a('0x43')]=_0x114ed7[_0x062a('0x43')]||_0x062a('0x44');this[_0x062a('0x45')]=_0x114ed7[_0x062a('0x45')]||undefined;this[_0x062a('0x46')]=_0x114ed7[_0x062a('0x46')]||undefined;this[_0x062a('0x47')]=strategy[_0x114ed7[_0x062a('0x47')]]||_0x062a('0x48');this[_0x062a('0x49')]=!![];this[_0x062a('0x4a')]=_0x114ed7[_0x062a('0x4a')]||![];this[_0x062a('0x4b')]=_0x114ed7[_0x062a('0x4b')];this[_0x062a('0x4c')]=_0x114ed7[_0x062a('0x4c')];this[_0x062a('0x4d')]=_0x114ed7[_0x062a('0x4d')];this[_0x062a('0x4e')]=_0x114ed7[_0x062a('0x4e')];this[_0x062a('0x4f')]=_0x114ed7['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x114ed7[_0x062a('0x50')];this['dialAMDMaximumNumberOfWords']=_0x114ed7[_0x062a('0x51')];this[_0x062a('0x52')]=_0x114ed7['dialAMDSilenceThreshold'];this[_0x062a('0x53')]=_0x114ed7['dialAMDMaximumWordLength'];this[_0x062a('0x54')]=0x0;this['pTalking']=0x0;this[_0x062a('0x55')]=_0x114ed7['timeout'];this[_0x062a('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x062a('0x57')]=0x0;this[_0x062a('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x062a('0x59')]=0x0;this[_0x062a('0x5a')]=0x0;this[_0x062a('0x5b')]=0x0;this[_0x062a('0x5c')]=0x0;this[_0x062a('0x5d')]=0x0;this[_0x062a('0x5e')]=0x0;this[_0x062a('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x062a('0x60')]=0x0;this[_0x062a('0x61')]=undefined;this[_0x062a('0x62')]=undefined;this[_0x062a('0x63')]=undefined;this[_0x062a('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x062a('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x062a('0x66')]=0x0;this[_0x062a('0x67')]=0x0;this[_0x062a('0x68')]=0x0;this[_0x062a('0x69')]=0x0;this[_0x062a('0x6a')]=_0x114ed7[_0x062a('0x6b')]||0x14;this[_0x062a('0x6c')]=_0x114ed7[_0x062a('0x6b')]||0xa;this[_0x062a('0x6d')]=0x0;this[_0x062a('0x6e')]=0x0;this[_0x062a('0x6f')]=0x1;this[_0x062a('0x70')]=0x0;this[_0x062a('0x71')]=0x0;this[_0x062a('0x72')]=0x0;this[_0x062a('0x73')]=0x0;this['dialRecallMeTimeout']=_0x114ed7['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x114ed7[_0x062a('0x74')]||![];this[_0x062a('0x75')]=!!_0x114ed7[_0x062a('0x75')]||![];this[_0x062a('0x76')]=!!_0x114ed7[_0x062a('0x76')]||![];this['dialQueueProject2']=_0x114ed7[_0x062a('0x77')]||undefined;this['dialAgiAfterHangupClient']=_0x114ed7['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x114ed7[_0x062a('0x78')]||![];this[_0x062a('0xb')]=monitorFormat[_0x114ed7[_0x062a('0xb')]]?monitorFormat[_0x114ed7['monitor_format']]:undefined;this[_0x062a('0x79')]=_0x114ed7[_0x062a('0x79')]||![];this[_0x062a('0x7a')]=_0x114ed7['mandatoryDispositionPause']?_0x114ed7[_0x062a('0x7a')]:undefined;}module[_0x062a('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x2058=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','answered','sumDuration','unmanaged','abandoned','loggedIn','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x2058,0x184));var _0x8205=function(_0x1e9b13,_0x78c34b){_0x1e9b13=_0x1e9b13-0x0;var _0x27254f=_0x2058[_0x1e9b13];return _0x27254f;};'use strict';var statusDesc=[_0x8205('0x0'),_0x8205('0x1'),_0x8205('0x2'),_0x8205('0x3'),'invalid',_0x8205('0x4'),'ringing',_0x8205('0x5'),_0x8205('0x6')];var monitorFormat={'wav':_0x8205('0x7'),'wav49':_0x8205('0x8'),'gsm':_0x8205('0x9')};var strategy={'rrmemory':_0x8205('0xa'),'roundrobin':_0x8205('0xb')};function VoiceQueue(_0x5002a1){this['id']=_0x5002a1['id']||0x0;this[_0x8205('0xc')]=_0x5002a1[_0x8205('0xc')]||'';this[_0x8205('0xd')]=_0x5002a1[_0x8205('0xd')]||'';this[_0x8205('0xe')]=_0x5002a1[_0x8205('0xe')]||'inbound';this[_0x8205('0xf')]=0x0;this[_0x8205('0x10')]=0x0;this['total']=0x0;this[_0x8205('0x11')]=0x0;this[_0x8205('0x12')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x8205('0x13')]=0x0;this[_0x8205('0x14')]=0x0;this[_0x8205('0x15')]=0x0;this['available']=0x0;this[_0x8205('0x16')]=_0x5002a1[_0x8205('0x16')]||![];this['acwTimeout']=_0x5002a1['acwTimeout']||0xa;this[_0x8205('0x17')]=_0x5002a1['autopause']||'no';this[_0x8205('0x18')]=!![];this[_0x8205('0x19')]='';this[_0x8205('0x1a')]=0x0;this[_0x8205('0x1b')]=0x0;this[_0x8205('0x1c')]=_0x5002a1['dialTimezone']||null;this[_0x8205('0x1d')]=_0x5002a1[_0x8205('0x1d')]?_0x5002a1[_0x8205('0x1d')]:null;this[_0x8205('0x1e')]=_0x5002a1[_0x8205('0x1e')];this['dialMethod']=_0x5002a1[_0x8205('0x1f')]||_0x8205('0x20');this['dialLimitChannel']=_0x5002a1[_0x8205('0x21')]||0x0;this[_0x8205('0x22')]=_0x5002a1[_0x8205('0x22')]||0x0;this[_0x8205('0x23')]=_0x5002a1[_0x8205('0x23')]||0x1;this[_0x8205('0x24')]=_0x5002a1[_0x8205('0x24')]||_0x8205('0x25');this[_0x8205('0x26')]=_0x5002a1['dialPredictiveOptimizationPercentage']||0.03;this[_0x8205('0x27')]=_0x5002a1[_0x8205('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x5002a1['dialOriginateCallerIdName']||_0x8205('0x28');this['dialOriginateCallerIdNumber']=_0x5002a1[_0x8205('0x29')]||'anonymous';this['dialOriginateTimeout']=_0x5002a1[_0x8205('0x2a')]||0x1e;this['dialQueueOptions']=_0x5002a1['dialQueueOptions']||_0x8205('0x2b');this[_0x8205('0x2c')]=_0x5002a1[_0x8205('0x2c')]||0x3;this[_0x8205('0x2d')]=_0x5002a1[_0x8205('0x2d')]||undefined;this[_0x8205('0x2e')]=_0x5002a1['dialCongestionMaxRetry']||0x3;this[_0x8205('0x2f')]=_0x5002a1[_0x8205('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x5002a1['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x5002a1[_0x8205('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x5002a1[_0x8205('0x31')]||0x3;this[_0x8205('0x32')]=_0x5002a1[_0x8205('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5002a1[_0x8205('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5002a1[_0x8205('0x34')]||0x96;this[_0x8205('0x35')]=_0x5002a1['dialDropMaxRetry']||0x3;this[_0x8205('0x36')]=_0x5002a1[_0x8205('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x5002a1[_0x8205('0x37')]||0x3;this[_0x8205('0x38')]=_0x5002a1[_0x8205('0x38')]||0x96;this[_0x8205('0x39')]=_0x5002a1[_0x8205('0x39')]||0x3;this[_0x8205('0x3a')]=_0x5002a1[_0x8205('0x3a')]||0x96;this[_0x8205('0x3b')]=_0x5002a1[_0x8205('0x3b')]||0x3;this[_0x8205('0x3c')]=_0x5002a1[_0x8205('0x3c')]||0x96;this[_0x8205('0x3d')]=_0x5002a1[_0x8205('0x3d')]||0x4;this['Trunk']=_0x5002a1[_0x8205('0x3e')]?_0x5002a1[_0x8205('0x3e')]:undefined;this['TrunkBackup']=_0x5002a1[_0x8205('0x3f')]?_0x5002a1[_0x8205('0x3f')]:undefined;this[_0x8205('0x40')]=_0x5002a1[_0x8205('0x40')]||undefined;this[_0x8205('0x41')]=_0x5002a1['Interval']?_0x5002a1['Interval']:undefined;this[_0x8205('0x42')]=_0x5002a1['dialOrderByScheduledAt']||_0x8205('0x43');this[_0x8205('0x44')]=_0x5002a1[_0x8205('0x44')]||undefined;this['dialCutDigit']=_0x5002a1[_0x8205('0x45')]||undefined;this[_0x8205('0x46')]=strategy[_0x5002a1[_0x8205('0x46')]]||_0x8205('0xa');this[_0x8205('0x47')]=!![];this[_0x8205('0x48')]=_0x5002a1['dialAMDActive']||![];this[_0x8205('0x49')]=_0x5002a1[_0x8205('0x49')];this[_0x8205('0x4a')]=_0x5002a1[_0x8205('0x4a')];this[_0x8205('0x4b')]=_0x5002a1['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5002a1[_0x8205('0x4c')];this[_0x8205('0x4d')]=_0x5002a1[_0x8205('0x4d')];this[_0x8205('0x4e')]=_0x5002a1['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x5002a1[_0x8205('0x4f')];this[_0x8205('0x50')]=_0x5002a1[_0x8205('0x50')];this[_0x8205('0x51')]=_0x5002a1[_0x8205('0x51')];this[_0x8205('0x52')]=0x0;this[_0x8205('0x53')]=0x0;this[_0x8205('0x54')]=_0x5002a1[_0x8205('0x54')];this[_0x8205('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x8205('0x56')]=0x0;this[_0x8205('0x57')]=0x0;this[_0x8205('0x58')]=0x0;this[_0x8205('0x59')]=0x0;this[_0x8205('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x8205('0x5b')]=0x0;this[_0x8205('0x5c')]=0x0;this[_0x8205('0x5d')]=0x0;this[_0x8205('0x5e')]=undefined;this['startPredictive']=undefined;this[_0x8205('0x5f')]=undefined;this[_0x8205('0x60')]=1.05;this[_0x8205('0x61')]=0x0;this[_0x8205('0x62')]=0x0;this[_0x8205('0x63')]=0x0;this[_0x8205('0x64')]=0x0;this[_0x8205('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8205('0x66')]=0x0;this[_0x8205('0x67')]=0x0;this[_0x8205('0x68')]=_0x5002a1[_0x8205('0x69')]||0x14;this[_0x8205('0x6a')]=_0x5002a1[_0x8205('0x69')]||0xa;this[_0x8205('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8205('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x8205('0x6d')]=0x0;this[_0x8205('0x6e')]=0x0;this[_0x8205('0x6f')]=_0x5002a1[_0x8205('0x6f')]||0x1e;this[_0x8205('0x70')]=_0x5002a1[_0x8205('0x70')]||![];this['dialPreviewAutoRecallMe']=!!_0x5002a1['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x5002a1['dialPreviewRecallmeReminder']||![];this[_0x8205('0x71')]=_0x5002a1[_0x8205('0x71')]||undefined;this[_0x8205('0x72')]=_0x5002a1[_0x8205('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x5002a1[_0x8205('0x73')]||![];this['monitor_format']=monitorFormat[_0x5002a1[_0x8205('0xd')]]?monitorFormat[_0x5002a1[_0x8205('0xd')]]:undefined;this[_0x8205('0x74')]=_0x5002a1[_0x8205('0x74')]||![];this[_0x8205('0x75')]=_0x5002a1['mandatoryDispositionPause']?_0x5002a1[_0x8205('0x75')]:undefined;}module[_0x8205('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 01d9e68..0052664 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 _0x4a2b=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x8e36b3,_0x4b02ed){var _0x3c91f9=function(_0x33923e){while(--_0x33923e){_0x8e36b3['push'](_0x8e36b3['shift']());}};_0x3c91f9(++_0x4b02ed);}(_0x4a2b,0x165));var _0xb4a2=function(_0x33ffa2,_0x2ed662){_0x33ffa2=_0x33ffa2-0x0;var _0x42bfd4=_0x4a2b[_0x33ffa2];return _0x42bfd4;};'use strict';function VtigerAccount(_0x5c3fdc){this['id']=_0x5c3fdc['id']||0x0;this[_0xb4a2('0x0')]=_0x5c3fdc[_0xb4a2('0x0')]||'';this['username']=_0x5c3fdc[_0xb4a2('0x1')]||'';this[_0xb4a2('0x2')]=_0x5c3fdc[_0xb4a2('0x2')]||'';this['remoteUri']=_0x5c3fdc[_0xb4a2('0x3')]||'';this[_0xb4a2('0x4')]=_0x5c3fdc[_0xb4a2('0x4')]||'';this[_0xb4a2('0x5')]=_0x5c3fdc['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0952=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x42003e,_0x41f367){var _0x3eaeb4=function(_0x439d58){while(--_0x439d58){_0x42003e['push'](_0x42003e['shift']());}};_0x3eaeb4(++_0x41f367);}(_0x0952,0xcb));var _0x2095=function(_0x12858c,_0x5e518a){_0x12858c=_0x12858c-0x0;var _0x53ccf7=_0x0952[_0x12858c];return _0x53ccf7;};'use strict';function VtigerAccount(_0x50ca9d){this['id']=_0x50ca9d['id']||0x0;this[_0x2095('0x0')]=_0x50ca9d['name']||'';this[_0x2095('0x1')]=_0x50ca9d[_0x2095('0x1')]||'';this[_0x2095('0x2')]=_0x50ca9d[_0x2095('0x2')]||'';this['remoteUri']=_0x50ca9d[_0x2095('0x3')]||'';this[_0x2095('0x4')]=_0x50ca9d[_0x2095('0x4')]||'';this[_0x2095('0x5')]=_0x50ca9d[_0x2095('0x5')]||{};}module[_0x2095('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index dea5e61..63e931b 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 _0x8992=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8992,0x9b));var _0x2899=function(_0x4c1343,_0x3c43ce){_0x4c1343=_0x4c1343-0x0;var _0x10a165=_0x8992[_0x4c1343];return _0x10a165;};'use strict';function ZendeskAccount(_0x4c9ef4){this['id']=_0x4c9ef4['id']||0x0;this[_0x2899('0x0')]=_0x4c9ef4[_0x2899('0x0')]||'';this[_0x2899('0x1')]=_0x4c9ef4[_0x2899('0x1')]||'';this[_0x2899('0x2')]=_0x4c9ef4[_0x2899('0x2')]||'';this[_0x2899('0x3')]=_0x4c9ef4[_0x2899('0x3')]||'';this[_0x2899('0x4')]=_0x4c9ef4[_0x2899('0x4')]||'';this['authType']=_0x4c9ef4['authType']||'';this['type']=_0x4c9ef4[_0x2899('0x5')]||_0x2899('0x6');this['serverUrl']=_0x4c9ef4[_0x2899('0x7')]||'';this[_0x2899('0x8')]=_0x4c9ef4[_0x2899('0x8')]||{};}module[_0x2899('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x4a64=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a64,0xbf));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x480008){this['id']=_0x480008['id']||0x0;this[_0x44a6('0x0')]=_0x480008[_0x44a6('0x0')]||'';this[_0x44a6('0x1')]=_0x480008[_0x44a6('0x1')]||'';this[_0x44a6('0x2')]=_0x480008[_0x44a6('0x2')]||'';this[_0x44a6('0x3')]=_0x480008[_0x44a6('0x3')]||'';this['remoteUri']=_0x480008[_0x44a6('0x4')]||'';this[_0x44a6('0x5')]=_0x480008['authType']||'';this[_0x44a6('0x6')]=_0x480008[_0x44a6('0x6')]||_0x44a6('0x7');this[_0x44a6('0x8')]=_0x480008['serverUrl']||'';this[_0x44a6('0x9')]=_0x480008[_0x44a6('0x9')]||{};}module[_0x44a6('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3b8f143..9eb723c 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 _0x0cd3=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0cd3,0x1a2));var _0x30cd=function(_0x139c66,_0x35ebac){_0x139c66=_0x139c66-0x0;var _0x44bf9a=_0x0cd3[_0x139c66];return _0x44bf9a;};'use strict';function ZohoAccount(_0xcda9e8){this['id']=_0xcda9e8['id']||0x0;this[_0x30cd('0x0')]=_0xcda9e8['name']||'';this['description']=_0xcda9e8[_0x30cd('0x1')]||'';this[_0x30cd('0x2')]=_0xcda9e8[_0x30cd('0x2')]||'';this[_0x30cd('0x3')]=_0xcda9e8[_0x30cd('0x3')]||'';this['clientId']=_0xcda9e8[_0x30cd('0x4')]||'';this[_0x30cd('0x5')]=_0xcda9e8[_0x30cd('0x5')]||'';this[_0x30cd('0x6')]=_0xcda9e8[_0x30cd('0x6')]||'';this[_0x30cd('0x7')]=_0xcda9e8['code']||'';this[_0x30cd('0x8')]=_0xcda9e8[_0x30cd('0x8')]||'';this[_0x30cd('0x9')]=_0xcda9e8['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x4373=['exports','name','description','host','zone','clientId','clientSecret','refreshToken','Configurations'];(function(_0x5c0a65,_0x51e331){var _0x3100cd=function(_0xce96f3){while(--_0xce96f3){_0x5c0a65['push'](_0x5c0a65['shift']());}};_0x3100cd(++_0x51e331);}(_0x4373,0xf4));var _0x3437=function(_0xca455d,_0xb09db){_0xca455d=_0xca455d-0x0;var _0x33f32d=_0x4373[_0xca455d];return _0x33f32d;};'use strict';function ZohoAccount(_0x24013b){this['id']=_0x24013b['id']||0x0;this['name']=_0x24013b[_0x3437('0x0')]||'';this['description']=_0x24013b[_0x3437('0x1')]||'';this['host']=_0x24013b[_0x3437('0x2')]||'';this[_0x3437('0x3')]=_0x24013b[_0x3437('0x3')]||'';this[_0x3437('0x4')]=_0x24013b[_0x3437('0x4')]||'';this[_0x3437('0x5')]=_0x24013b[_0x3437('0x5')]||'';this['serverUrl']=_0x24013b['serverUrl']||'';this['code']=_0x24013b['code']||'';this[_0x3437('0x6')]=_0x24013b[_0x3437('0x6')]||'';this[_0x3437('0x7')]=_0x24013b[_0x3437('0x7')]||{};}module[_0x3437('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 87a0d69..327fd81 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 _0xa2fc=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','phone','Contact','firstName','active','calleridnum','countcongestionretry','countnoanswerretry','countbusyretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback'];(function(_0x5a5e27,_0x2aa822){var _0x3f5fde=function(_0x3f2596){while(--_0x3f2596){_0x5a5e27['push'](_0x5a5e27['shift']());}};_0x3f5fde(++_0x2aa822);}(_0xa2fc,0x8e));var _0xca2f=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0xa2fc[_0xabbd2f];return _0x34a040;};'use strict';var util=require(_0xca2f('0x0'));var _=require(_0xca2f('0x1'));var moment=require(_0xca2f('0x2'));function checkNameSurname(_0x3738ec,_0x3c9747,_0x1a4f32){var _0x295ab8='';if(!_[_0xca2f('0x3')](_0x3c9747)&&_0xca2f('0x4')===typeof _0x3c9747){_0x295ab8+=_0x3c9747;}if(!_[_0xca2f('0x3')](_0x1a4f32)&&_0xca2f('0x4')===typeof _0x1a4f32){_0x295ab8+='\x20'+_0x1a4f32;}if(_0x295ab8!==''){return _0x295ab8;}return _0x3738ec;}function Action(_0x503fb8,_0x2129c9,_0x5e811a,_0x561353,_0x445e46){this[_0xca2f('0x5')]=_0x5e811a||undefined;this[_0xca2f('0x6')]=_0x503fb8['id'];this[_0xca2f('0x7')]=_0x2129c9[_0xca2f('0x8')];this[_0xca2f('0x9')]=_0x2129c9[_0xca2f('0x9')];this[_0xca2f('0xa')]='queue';this[_0xca2f('0xb')]=![];this[_0xca2f('0xc')]=_[_0xca2f('0x3')](_0x503fb8['Agent'])?undefined:_0x503fb8[_0xca2f('0xd')][_0xca2f('0x8')];this[_0xca2f('0xe')]=this[_0xca2f('0xc')]?util[_0xca2f('0xf')]('SIP/%s',this[_0xca2f('0xc')]):_0x561353||undefined;this[_0xca2f('0x10')]=checkNameSurname(_0x503fb8['Contact'][_0xca2f('0x11')],_0x503fb8[_0xca2f('0x12')][_0xca2f('0x13')],_0x503fb8[_0xca2f('0x12')]['lastName']);this[_0xca2f('0x14')]=_0x503fb8['active']||![];this[_0xca2f('0x15')]=_0x503fb8['Contact'][_0xca2f('0x11')];this['scheduledat']=_0x503fb8['scheduledat'];this['countbusyretry']=_0x503fb8['countbusyretry']||0x0;this[_0xca2f('0x16')]=_0x503fb8[_0xca2f('0x16')]||0x0;this['countnoanswerretry']=_0x503fb8[_0xca2f('0x17')]||0x0;this['countglobal']=(_0x503fb8[_0xca2f('0x18')]||0x0)+(_0x503fb8['countcongestionretry']||0x0)+(_0x503fb8['countnoanswerretry']||0x0)+(_0x503fb8['countnosuchnumberretry']||0x0)+(_0x503fb8['countdropretry']||0x0)+(_0x503fb8[_0xca2f('0x19')]||0x0)+(_0x503fb8[_0xca2f('0x1a')]||0x0)+(_0x503fb8['countagentrejectretry']||0x0);this[_0xca2f('0x1b')]=_0x503fb8[_0xca2f('0x1b')]||0x0;this['countdropretry']=_0x503fb8['countdropretry']||0x0;this['countabandonedretry']=_0x503fb8[_0xca2f('0x19')]||0x0;this[_0xca2f('0x1a')]=_0x503fb8[_0xca2f('0x1a')]||0x0;this['countagentrejectretry']=_0x503fb8[_0xca2f('0x1c')]||0x0;this[_0xca2f('0x1d')]=_0x503fb8['callback'];this[_0xca2f('0x1e')]=_0x503fb8[_0xca2f('0x1e')];this['callbackat']=_0x503fb8[_0xca2f('0x1f')];this[_0xca2f('0x20')]=_0x503fb8[_0xca2f('0x20')];this[_0xca2f('0x21')]=_0x503fb8[_0xca2f('0x21')];this['ListId']=_0x503fb8[_0xca2f('0x22')];this[_0xca2f('0x23')]=_[_0xca2f('0x3')](_0x503fb8['Agent'])?_0x503fb8['UserId']:_0x503fb8['Agent']['id'];this[_0xca2f('0x24')]=_0x503fb8['VoiceQueueId'];this[_0xca2f('0x25')]='';this['originatecalleridname']='';}Action[_0xca2f('0x26')][_0xca2f('0x27')]=function(){return util[_0xca2f('0xf')](_0xca2f('0x28'),this[_0xca2f('0x10')],this[_0xca2f('0x29')]);};module[_0xca2f('0x2a')]=Action; \ No newline at end of file +var _0x8d71=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x51b4c1,_0x25ed2a){var _0x2985bb=function(_0x27ced4){while(--_0x27ced4){_0x51b4c1['push'](_0x51b4c1['shift']());}};_0x2985bb(++_0x25ed2a);}(_0x8d71,0x1e2));var _0x18d7=function(_0x1c31cc,_0x53783e){_0x1c31cc=_0x1c31cc-0x0;var _0x165e6b=_0x8d71[_0x1c31cc];return _0x165e6b;};'use strict';var util=require(_0x18d7('0x0'));var _=require(_0x18d7('0x1'));var moment=require(_0x18d7('0x2'));function checkNameSurname(_0x535c57,_0x33a223,_0x41d0f2){var _0x1e405d='';if(!_['isNil'](_0x33a223)&&'string'===typeof _0x33a223){_0x1e405d+=_0x33a223;}if(!_[_0x18d7('0x3')](_0x41d0f2)&&'string'===typeof _0x41d0f2){_0x1e405d+='\x20'+_0x41d0f2;}if(_0x1e405d!==''){return _0x1e405d;}return _0x535c57;}function Action(_0x439c8d,_0x1f87e5,_0x182357,_0x4ef2d0,_0x5e1169){this['uniqueid']=_0x182357||undefined;this['idContact']=_0x439c8d['id'];this['queue']=_0x1f87e5['name'];this['type']=_0x1f87e5['type'];this[_0x18d7('0x4')]='queue';this[_0x18d7('0x5')]=![];this['membername']=_[_0x18d7('0x3')](_0x439c8d[_0x18d7('0x6')])?undefined:_0x439c8d['Agent'][_0x18d7('0x7')];this[_0x18d7('0x8')]=this[_0x18d7('0x9')]?util[_0x18d7('0xa')](_0x18d7('0xb'),this['membername']):_0x4ef2d0||undefined;this[_0x18d7('0xc')]=checkNameSurname(_0x439c8d[_0x18d7('0xd')][_0x18d7('0xe')],_0x439c8d[_0x18d7('0xd')][_0x18d7('0xf')],_0x439c8d[_0x18d7('0xd')][_0x18d7('0x10')]);this[_0x18d7('0x11')]=_0x439c8d[_0x18d7('0x11')]||![];this[_0x18d7('0x12')]=_0x439c8d[_0x18d7('0xd')][_0x18d7('0xe')];this['scheduledat']=_0x439c8d[_0x18d7('0x13')];this[_0x18d7('0x14')]=_0x439c8d['countbusyretry']||0x0;this['countcongestionretry']=_0x439c8d[_0x18d7('0x15')]||0x0;this[_0x18d7('0x16')]=_0x439c8d[_0x18d7('0x16')]||0x0;this['countglobal']=(_0x439c8d[_0x18d7('0x14')]||0x0)+(_0x439c8d[_0x18d7('0x15')]||0x0)+(_0x439c8d['countnoanswerretry']||0x0)+(_0x439c8d[_0x18d7('0x17')]||0x0)+(_0x439c8d[_0x18d7('0x18')]||0x0)+(_0x439c8d[_0x18d7('0x19')]||0x0)+(_0x439c8d[_0x18d7('0x1a')]||0x0)+(_0x439c8d['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x439c8d[_0x18d7('0x17')]||0x0;this[_0x18d7('0x18')]=_0x439c8d['countdropretry']||0x0;this[_0x18d7('0x19')]=_0x439c8d[_0x18d7('0x19')]||0x0;this[_0x18d7('0x1a')]=_0x439c8d[_0x18d7('0x1a')]||0x0;this[_0x18d7('0x1b')]=_0x439c8d[_0x18d7('0x1b')]||0x0;this[_0x18d7('0x1c')]=_0x439c8d[_0x18d7('0x1c')];this['callbackuniqueid']=_0x439c8d[_0x18d7('0x1d')];this[_0x18d7('0x1e')]=_0x439c8d[_0x18d7('0x1e')];this[_0x18d7('0x1f')]=_0x439c8d[_0x18d7('0x1f')];this[_0x18d7('0x20')]=_0x439c8d[_0x18d7('0x20')];this[_0x18d7('0x21')]=_0x439c8d[_0x18d7('0x21')];this[_0x18d7('0x22')]=_[_0x18d7('0x3')](_0x439c8d[_0x18d7('0x6')])?_0x439c8d[_0x18d7('0x22')]:_0x439c8d[_0x18d7('0x6')]['id'];this[_0x18d7('0x23')]=_0x439c8d[_0x18d7('0x23')];this[_0x18d7('0x24')]='';this[_0x18d7('0x25')]='';}Action[_0x18d7('0x26')][_0x18d7('0x27')]=function(){return util['format'](_0x18d7('0x28'),this[_0x18d7('0xc')],this[_0x18d7('0x29')]);};module[_0x18d7('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4c187b2..1f64b6d 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 _0xe14b=['sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','unlock','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','phone','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','error','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','message','erlangCalls','erlangCallToSecond','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','preview','clearZombieChannels','outbound','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','decrementTalkink','loggerError','[action]','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue'];(function(_0xbd1e1,_0x3eff17){var _0x4b01ac=function(_0x41ba77){while(--_0x41ba77){_0xbd1e1['push'](_0xbd1e1['shift']());}};_0x4b01ac(++_0x3eff17);}(_0xe14b,0x93));var _0xbe14=function(_0x1e53e3,_0x182441){_0x1e53e3=_0x1e53e3-0x0;var _0x3f62ab=_0xe14b[_0x1e53e3];return _0x3f62ab;};'use strict';var util=require(_0xbe14('0x0'));var _=require(_0xbe14('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xbe14('0x2'));var md5=require(_0xbe14('0x3'));var Redis=require('ioredis');var config=require(_0xbe14('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xbe14('0x5'))(_0xbe14('0x6'));var ami=require(_0xbe14('0x7'));var rpcDb=require(_0xbe14('0x8'));var Action=require(_0xbe14('0x9'));var ut=require(_0xbe14('0xa'));config[_0xbe14('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbe14('0xc'))(new Redis(config[_0xbe14('0xb')]));var Sequence=function(){};Sequence[_0xbe14('0xd')][_0xbe14('0xe')]=function(_0x53c7ea){this['tail']=this[_0xbe14('0xf')]?this[_0xbe14('0xf')]['finally'](_0x53c7ea):_0x53c7ea();};function Preview(_0x254c3b){this[_0xbe14('0x10')]=new Sequence();this[_0xbe14('0x11')]=_0x254c3b[_0xbe14('0x12')];this[_0xbe14('0x13')]=_0x254c3b[_0xbe14('0x13')];this[_0xbe14('0x14')]={};this[_0xbe14('0x15')]=_0x254c3b[_0xbe14('0x15')];this[_0xbe14('0x16')]=0x0;ami['on'](_0xbe14('0x17'),this[_0xbe14('0x18')][_0xbe14('0x19')](this));ami['on']('hangup',this['syncHangup'][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1a'),this[_0xbe14('0x1b')][_0xbe14('0x19')](this));ami['on']('dialend',this[_0xbe14('0x1c')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1d'),this[_0xbe14('0x1e')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1f'),this[_0xbe14('0x20')]['bind'](this));ami['on'](_0xbe14('0x21'),this[_0xbe14('0x22')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x23'),this[_0xbe14('0x24')][_0xbe14('0x19')](this));this['loopCampaigns'](this[_0xbe14('0x11')]);}function emit(_0x4a1bbd,_0x417c8d,_0xc12977){io['to'](_0x4a1bbd)[_0xbe14('0x25')](_0x417c8d,_0xc12977);}function emitCampaignPreview(_0x51dc0b){if(_0x51dc0b[_0xbe14('0x26')]==='outbound'){var _0x3c1c85={'id':_0x51dc0b['id'],'name':_0x51dc0b['name'],'strategy':_0x51dc0b[_0xbe14('0x27')],'answered':_0x51dc0b['answered'],'available':_0x51dc0b[_0xbe14('0x28')],'loggedIn':_0x51dc0b[_0xbe14('0x29')],'pTalking':_0x51dc0b['pTalking'],'sumBillable':_0x51dc0b[_0xbe14('0x2a')],'sumDuration':_0x51dc0b['sumDuration'],'sumHoldTime':_0x51dc0b[_0xbe14('0x2b')]||0x0,'talking':_0x51dc0b['talking'],'total':_0x51dc0b[_0xbe14('0x2c')],'type':_0x51dc0b[_0xbe14('0x26')],'unmanaged':_0x51dc0b[_0xbe14('0x2d')],'abandoned':_0x51dc0b[_0xbe14('0x2e')],'waiting':_0x51dc0b[_0xbe14('0x2f')],'loggedInDb':_0x51dc0b[_0xbe14('0x30')],'dialActive':_0x51dc0b['dialActive'],'dialMethod':_0x51dc0b[_0xbe14('0x31')],'dialOriginateCallerIdName':_0x51dc0b[_0xbe14('0x32')],'dialOriginateCallerIdNumber':_0x51dc0b[_0xbe14('0x33')],'dialOriginateTimeout':_0x51dc0b[_0xbe14('0x34')],'dialPrefix':_0x51dc0b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x51dc0b[_0xbe14('0x35')],'outboundAnswerCallsDay':_0x51dc0b[_0xbe14('0x36')],'outboundBlacklistCallsDay':_0x51dc0b['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x51dc0b[_0xbe14('0x37')],'outboundCongestionCallsDay':_0x51dc0b[_0xbe14('0x38')],'outboundDropCallsDayACS':_0x51dc0b[_0xbe14('0x39')],'outboundDropCallsDayCallersExit':_0x51dc0b[_0xbe14('0x3a')],'outboundDropCallsDayTimeout':_0x51dc0b[_0xbe14('0x3b')],'outboundNoAnswerCallsDay':_0x51dc0b[_0xbe14('0x3c')],'outboundNoSuchCallsDay':_0x51dc0b[_0xbe14('0x3d')],'outboundOriginateFailureCallsDay':_0x51dc0b[_0xbe14('0x3e')],'outboundReCallsDay':_0x51dc0b[_0xbe14('0x3f')],'outboundRejectCallsDay':_0x51dc0b[_0xbe14('0x40')],'outboundUnknownCallsDay':_0x51dc0b[_0xbe14('0x41')],'outboundAbandonedCallsDay':_0x51dc0b[_0xbe14('0x42')],'predictiveIntervalAnsweredCalls':_0x51dc0b[_0xbe14('0x43')],'predictiveIntervalAvgHoldtime':_0x51dc0b[_0xbe14('0x44')],'predictiveIntervalAvgTalktime':_0x51dc0b[_0xbe14('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x51dc0b[_0xbe14('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x51dc0b[_0xbe14('0x47')],'predictiveIntervalErlangCalls':_0x51dc0b[_0xbe14('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x51dc0b[_0xbe14('0x49')],'predictiveIntervalHitRate':_0x51dc0b[_0xbe14('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x51dc0b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x51dc0b[_0xbe14('0x4b')],'predictiveIntervalAvailable':_0x51dc0b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51dc0b['predictiveIntervalTotalCalls'],'message':_0x51dc0b[_0xbe14('0x4c')],'originated':_0x51dc0b['originated'],'erlangCalls':_0x51dc0b[_0xbe14('0x4d')],'erlangCallToSecond':_0x51dc0b[_0xbe14('0x4e')],'erlangAbandonmentRate':_0x51dc0b['erlangAbandonmentRate'],'erlangBusyFactor':_0x51dc0b['erlangBusyFactor'],'startPredictive':_0x51dc0b['startPredictive'],'startProgressive':_0x51dc0b[_0xbe14('0x4f')]};if(_0x51dc0b[_0xbe14('0x50')]){_0x3c1c85['Trunk']={'id':_0x51dc0b[_0xbe14('0x50')]['id'],'name':_0x51dc0b[_0xbe14('0x50')][_0xbe14('0x51')],'active':_0x51dc0b[_0xbe14('0x50')][_0xbe14('0x52')],'callerid':_0x51dc0b['Trunk']['callerid']};}if(_0x51dc0b[_0xbe14('0x53')]){_0x3c1c85['Interval']={'id':_0x51dc0b['Interval']['id'],'name':_0x51dc0b['Interval'][_0xbe14('0x51')]};}var _0x393f6b=md5(JSON[_0xbe14('0x54')](_0x3c1c85));if(_0x51dc0b[_0xbe14('0x3')]!==_0x393f6b){_0x51dc0b[_0xbe14('0x3')]=_0x393f6b;emit(util[_0xbe14('0x55')](_0xbe14('0x56'),_0x3c1c85[_0xbe14('0x51')]),_0xbe14('0x57'),_0x3c1c85);}}}function emitVoiceQueueChannelRemove(_0x2dfd5a){logger[_0xbe14('0x58')](_0xbe14('0x59'),JSON['stringify'](_0x2dfd5a));emit(util['format'](_0xbe14('0x56'),_0x2dfd5a[_0xbe14('0x51')]),_0xbe14('0x5a'),_0x2dfd5a);io['emit'](_0xbe14('0x5b'),_0x2dfd5a);}function notSendMessagesQueue(_0x2aa453){if(_0x2aa453[_0xbe14('0x5c')]){if(_0x2aa453[_0xbe14('0x5d')]===0x0&&_0x2aa453[_0xbe14('0x5e')]===0x0){_0x2aa453[_0xbe14('0x5c')]=![];_0x2aa453[_0xbe14('0x28')]=0x0;_0x2aa453[_0xbe14('0x5f')]=0x0;_0x2aa453[_0xbe14('0x4c')]='NOT_ACTIVE';ut[_0xbe14('0x60')](_0xbe14('0x61'),_0x2aa453[_0xbe14('0x51')]+_0xbe14('0x62'));}else{_0x2aa453[_0xbe14('0x4c')]=_0xbe14('0x63');ut['logger'](_0xbe14('0x61'),_0x2aa453[_0xbe14('0x51')]+_0xbe14('0x64'));}emitCampaignPreview(_0x2aa453);}}Preview[_0xbe14('0xd')]['loopCampaigns']=function(){var _0x4bfa96=this;setInterval(function(){_0x4bfa96[_0xbe14('0x65')]();},0x7cf);};Preview[_0xbe14('0xd')][_0xbe14('0x65')]=function(){var _0x51c859=this['campaignsPreview'];this[_0xbe14('0x16')]+=0x1;for(var _0x59ae4d in _0x51c859){if(_0x51c859['hasOwnProperty'](_0x59ae4d)&&(_0x51c859[_0x59ae4d][_0xbe14('0x31')]===_0xbe14('0x66')||_0x51c859[_0x59ae4d][_0xbe14('0x31')]==='booked')&&_0x51c859[_0x59ae4d]['type']==='outbound'){if(this[_0xbe14('0x16')]>0x7){this[_0xbe14('0x16')]=0x0;this[_0xbe14('0x67')]();}}if(_0x51c859['hasOwnProperty'](_0x59ae4d)&&_0x51c859[_0x59ae4d][_0xbe14('0x31')]===_0xbe14('0x66')&&_0x51c859[_0x59ae4d][_0xbe14('0x26')]===_0xbe14('0x68')){if(_0x51c859[_0x59ae4d]['dialActive']){this['setMessage'](_0x51c859[_0x59ae4d]);if(_0x51c859[_0x59ae4d][_0xbe14('0x69')])this[_0xbe14('0x6a')](_0x51c859[_0x59ae4d]);}else{notSendMessagesQueue(_0x51c859[_0x59ae4d]);}}}};Preview[_0xbe14('0xd')][_0xbe14('0x6b')]=function(_0x2550dc){var _0x4f2d95=this;this['sequence'][_0xbe14('0xe')](function(){if(!_[_0xbe14('0x6c')](_0x4f2d95[_0xbe14('0x14')][_0x2550dc])){loggerAction[_0xbe14('0x58')]('[clearZombieChannels][talking]',_0x2550dc,_0xbe14('0x6d'),_0x4f2d95[_0xbe14('0x14')][_0x2550dc]['queue'],_0xbe14('0x6e'),JSON[_0xbe14('0x54')](_0x4f2d95[_0xbe14('0x11')][_0x4f2d95[_0xbe14('0x14')][_0x2550dc]['queue']]['originated']),_0xbe14('0x6f'),JSON[_0xbe14('0x54')](_0x4f2d95['campaignsPreview'][_0x4f2d95['actions'][_0x2550dc][_0xbe14('0x70')]][_0xbe14('0x5e')]),JSON[_0xbe14('0x54')](_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x71')]),JSON[_0xbe14('0x54')](_[_0xbe14('0x72')](_0x4f2d95['actions'][_0x2550dc],[_0xbe14('0x73'),_0xbe14('0x74'),_0xbe14('0x75'),_0xbe14('0x76')])));return ami[_0xbe14('0x77')]({'action':'status','channel':_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x78')]})[_0xbe14('0x79')](function(_0x20f46d){if(_0x20f46d[_0xbe14('0x4c')]===_0xbe14('0x7a')){setTimeout(function(){if(_0x4f2d95['actions'][_0x2550dc]){ut['updateOriginated'](_0x4f2d95[_0xbe14('0x11')][_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]],'[clearZombieChannel]');if(_0x4f2d95['actions'][_0x2550dc][_0xbe14('0x71')]===!![]){ut[_0xbe14('0x7b')](_0x4f2d95['campaignsPreview'][_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]],'[clearZombieChannel]');ut[_0xbe14('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2550dc,_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]);}ut[_0xbe14('0x7c')]('[Dialer][checkChannel][Preview]'+_0x2550dc,_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]);delete _0x4f2d95['actions'][_0x2550dc];}},0x2328);}});}});};Preview[_0xbe14('0xd')][_0xbe14('0x67')]=function(){var _0x2210cc=this;loggerAction[_0xbe14('0x58')](_0xbe14('0x7d'),_['size'](this[_0xbe14('0x14')]));for(var _0x34cd66 in this[_0xbe14('0x14')]){if(_0x2210cc[_0xbe14('0x14')][_0xbe14('0x7e')](_0x34cd66)){_0x2210cc[_0xbe14('0x6b')](_0x34cd66);}}};Preview[_0xbe14('0xd')]['recallMe']=function(_0x72c875){var _0x1b47a4=this;rpcDb[_0xbe14('0x7f')](_0x72c875['id'],ut[_0xbe14('0x80')](this[_0xbe14('0x15')]))[_0xbe14('0x81')](function(_0xd8f78f){if(!_[_0xbe14('0x6c')](_0xd8f78f)){for(var _0x285b6e=0x0;_0x285b6e<_0xd8f78f[_0xbe14('0x82')];_0x285b6e+=0x1){if(ut[_0xbe14('0x83')](_0xd8f78f[_0x285b6e]['scheduledat'])<_0x72c875['dialRecallMeTimeout']*0x3c){if(_0xd8f78f[_0x285b6e]['Agent']&&!_0xd8f78f[_0x285b6e][_0xbe14('0x84')][_0xbe14('0x85')]){_0x1b47a4[_0xbe14('0x86')](_0xd8f78f[_0x285b6e]['id'])[_0xbe14('0x81')](ut[_0xbe14('0x87')](_0xbe14('0x88')))[_0xbe14('0x79')](ut[_0xbe14('0x87')](_0xbe14('0x88')));}else{rpcDb[_0xbe14('0x89')](_0xd8f78f[_0x285b6e]['id']);}}else{var _0x603816=new Action(_0xd8f78f[_0x285b6e],_0x72c875);_0x603816[_0xbe14('0x8a')]=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));_0x72c875[_0xbe14('0x3f')]+=0x1;ut[_0xbe14('0x8c')](_0x603816,0x17,_0xbe14('0x8d'));if(_0x72c875[_0xbe14('0x8e')]){rpcDb[_0xbe14('0x8f')](ut[_0xbe14('0x90')](_0xd8f78f[_0x285b6e]));rpcDb['createCustomerHistory'](_0x603816,_0xbe14('0x91'));}else{ut[_0xbe14('0x8c')](_0x603816,0x16,_0xbe14('0x92'));rpcDb[_0xbe14('0x93')](_0x603816,_0xbe14('0x94'));rpcDb[_0xbe14('0x95')](_0x603816,_0xbe14('0x94'));}}}}})[_0xbe14('0x79')](ut[_0xbe14('0x87')](_0xbe14('0x96')));};Preview['prototype'][_0xbe14('0x97')]=function(_0x442ec4){_0x442ec4[_0xbe14('0x5c')]=!![];if(ut[_0xbe14('0x98')](_0x442ec4[_0xbe14('0x29')])){_0x442ec4['message']=_0xbe14('0x99');}else if(!ut[_0xbe14('0x9a')](_0x442ec4[_0xbe14('0x9b')])){_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0x9c');}else if(!this['isTrunkReachable'](_0x442ec4[_0xbe14('0x50')])){if(!this[_0xbe14('0x9d')](_0x442ec4[_0xbe14('0x9e')])){_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0x9f');}else{_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0xa0');}}else{_0x442ec4[_0xbe14('0x4c')]='ACTIVE';}emitCampaignPreview(_0x442ec4);};Preview[_0xbe14('0xd')][_0xbe14('0xa1')]=function(_0x2fdf5d,_0x20b12e,_0x5982b7){var _0xa4b2a3=this;var _0x445302=this['actions'][_0x20b12e];var _0x4eedd2=this[_0xbe14('0x11')][_0x445302[_0xbe14('0x70')]];var _0x2d2643;if(_0x4eedd2){switch(_0x5982b7){case'1':_0x4eedd2[_0xbe14('0x3d')]+=0x1;_0x445302[_0xbe14('0xa2')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x0,'NoSuchNumber');ami['emit'](_0xbe14('0xa5'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xa7')));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xa8'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xac'));}else{if(_0x445302['countnosuchnumberretry']>=_0x4eedd2[_0xbe14('0xad')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xac'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xa2'),_0x4eedd2[_0xbe14('0xb0')]),_0x445302['unlockAgent'],_0x445302[_0xbe14('0xb1')]);}}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;case _0xbe14('0xb3'):var _0x28da4a=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));_0x445302[_0xbe14('0xb4')]=_0x28da4a;_0x445302['answertime']=_0x28da4a;_0x445302[_0xbe14('0x71')]=!![];_0x4eedd2[_0xbe14('0x5e')]+=0x1;logger[_0xbe14('0x58')](_0xbe14('0xb5'),_0x445302[_0xbe14('0xb6')],_0xbe14('0xb7'),_0x4eedd2['name'],_0xbe14('0x6f'),_0x4eedd2[_0xbe14('0x5e')]);ami[_0xbe14('0x25')](_0xbe14('0xb8'),ut['buildObj'](_0x445302,_0xbe14('0xb9'),this[_0xbe14('0x11')][_0x445302[_0xbe14('0x70')]]));if(_0x4eedd2[_0xbe14('0xba')]){ami[_0xbe14('0x25')](_0xbe14('0xbb'),ut[_0xbe14('0xbc')](_0x445302));}break;case'16':ami['emit'](_0xbe14('0xbd'),ut['buildObj'](_0x445302,_0xbe14('0xbe'),this['campaignsPreview'][_0x445302[_0xbe14('0x70')]]));emitVoiceQueueChannelRemove(ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xbe')));_0x4eedd2['outboundAnswerCallsDay']+=0x1;_0x4eedd2[_0xbe14('0x2c')]+=0x1;_0x4eedd2[_0xbe14('0xbf')]+=0x1;ut[_0xbe14('0x7b')](_0x4eedd2,'[16]');_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x4,_0xbe14('0xc0'));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xc1'));rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xc2'));rpcDb[_0xbe14('0xc3')](_0x445302);_0x4eedd2[_0xbe14('0xc4')]+=_0x445302[_0xbe14('0xc5')];_0x4eedd2[_0xbe14('0x2a')]+=_0x445302['talktime'];logger[_0xbe14('0x58')](_0xbe14('0xc6'),_0x445302[_0xbe14('0xb6')],'\x20Queue',_0x4eedd2[_0xbe14('0x51')],_0xbe14('0x6f'),_0x4eedd2[_0xbe14('0x5e')]);delete this['actions'][_0x2fdf5d[_0xbe14('0xb2')]];break;case _0xbe14('0xc7'):_0x4eedd2['outboundBusyCallsDay']+=0x1;_0x445302[_0xbe14('0xc8')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x5,'Busy');ami['emit'](_0xbe14('0xc9'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xca')));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xcb'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,'Global');rpcDb['createCustomerFinal'](_0x2d2643,_0xbe14('0xcc'));}else{if(_0x445302[_0xbe14('0xc8')]>=_0x4eedd2[_0xbe14('0xcd')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xcb'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,'countbusyretry',_0x4eedd2[_0xbe14('0xce')]),_0x445302['unlockAgent'],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xcf'):_0x4eedd2[_0xbe14('0x3c')]+=0x1;_0x445302[_0xbe14('0xd0')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x3,_0xbe14('0xd1'));ami['emit'](_0xbe14('0xd2'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xd3')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xd4'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xd5'));}else{if(_0x445302[_0xbe14('0xd0')]>=_0x4eedd2[_0xbe14('0xd6')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xd4'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xd0'),_0x4eedd2[_0xbe14('0xd7')]),_0x445302[_0xbe14('0xd8')],_0x445302['activeContact']);}}break;case _0xbe14('0xd9'):_0x4eedd2['outboundCongestionCallsDay']+=0x1;_0x445302[_0xbe14('0xda')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x8,_0xbe14('0xdb'));ami['emit']('custom:agentcongestion',ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xdc')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xdd'));if(ut['totalGlobal'](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,'Global');rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xde'));}else{if(_0x445302[_0xbe14('0xda')]>=_0x4eedd2[_0xbe14('0xdf')]){rpcDb['createCustomerFinal'](_0x445302,_0xbe14('0xdd'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x445302,_0xbe14('0xda'),_0x4eedd2[_0xbe14('0xce')]),_0x445302[_0xbe14('0xd8')],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xe0'):_0x4eedd2['outboundRejectCallsDay']+=0x1;_0x445302[_0xbe14('0xe1')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut['totalGlobal'](_0x445302);ut['logCustomer'](_0x445302,0x14,_0xbe14('0xe2'));ami[_0xbe14('0x25')]('custom:agentreject',ut[_0xbe14('0xa6')](_0x445302,'agentreject'));rpcDb[_0xbe14('0x93')](_0x445302,'[syncHangupRequest][logAgentReject]');if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2['dialGlobalMaxRetry']){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0x14,'AgentReject');rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xe3'));}else{if(_0x445302['countagentrejectretry']>=_0x4eedd2['dialAgentRejectMaxRetry']){rpcDb[_0xbe14('0x95')](_0x445302,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xe1'),_0x4eedd2[_0xbe14('0xe4')]),_0x445302[_0xbe14('0xd8')],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xe5'):_0x4eedd2[_0xbe14('0x42')]+=0x1;_0x445302['countabandonedretry']+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0xb,_0xbe14('0xe6'));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xe7'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut['cloneAction'](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x445302[_0xbe14('0xe8')]>=_0x4eedd2['dialAbandonedMaxRety']){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xe7'));}else{rpcDb[_0xbe14('0xae')](ut['scheduledAt'](_0x445302,_0xbe14('0xe9'),_0x4eedd2['dialAbandonedRetryFrequency']),_0x445302[_0xbe14('0xd8')],_0x445302['activeContact']);}}break;case'18':_0x4eedd2['outboundUnknownCallsDay']+=0x1;_0x445302[_0xbe14('0xea')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut['logCustomer'](_0x445302,0x12,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);ami[_0xbe14('0x25')](_0xbe14('0xed'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xee')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xef'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xef'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;case'19':_0x4eedd2[_0xbe14('0x41')]+=0x1;_0x445302['countglobal']=ut['totalGlobal'](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x13,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);ami[_0xbe14('0x25')](_0xbe14('0xed'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xee')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xf0'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xf0'));}else{rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xf0'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;default:if(_0x445302[_0xbe14('0x71')]){ut[_0xbe14('0x7b')](_0x4eedd2,_0xbe14('0xf1'));ut[_0xbe14('0x7c')](_0xbe14('0xf2')+_0x4eedd2[_0xbe14('0x51')],_0x2fdf5d);}_0x4eedd2['outboundUnknownCallsDay']+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0xc,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);rpcDb[_0xbe14('0x93')](_0x445302,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut['cloneAction'](_0x445302,0xf,_0xbe14('0xab'));rpcDb['createCustomerFinal'](_0x2d2643,_0xbe14('0xf3'));}else{rpcDb['createCustomerFinal'](_0x445302,_0xbe14('0xf3'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];}if(!(_0x445302[_0xbe14('0x71')]&&_0x5982b7==='16')){ut[_0xbe14('0xf4')](_0x4eedd2,_0xbe14('0xf5'));logger[_0xbe14('0x58')](_0xbe14('0xf6'),_0x445302[_0xbe14('0xb6')],'\x20Queue',_0x4eedd2[_0xbe14('0x51')],_0xbe14('0x6e'),_0x4eedd2[_0xbe14('0x5d')]);}if(_0x5982b7!==_0xbe14('0xb3')){delete this['actions'][_0x2fdf5d[_0xbe14('0xb2')]];delete this['actions'][_0x2fdf5d[_0xbe14('0xf7')]];}}};Preview['prototype'][_0xbe14('0xf8')]=function(_0x3e7588,_0x24fa89,_0x5c134f){if(_[_0xbe14('0xf9')](_0x24fa89)&&'object'!==typeof _0x24fa89){return;}if(_[_0xbe14('0xf9')](_0x5c134f)&&_0xbe14('0xfa')!==typeof _0x5c134f){return;}switch(_0x5c134f[_0xbe14('0xfb')]){case'0':ut[_0xbe14('0xfc')](_0x3e7588,0x0,_0xbe14('0xfd'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0xff'));break;case'3':ut[_0xbe14('0xfc')](_0x3e7588,0x3,_0xbe14('0xd1'));rpcDb['createAgentHistory'](_0x3e7588,_0xbe14('0x100'));break;case'5':ut['logAgent'](_0x3e7588,0x5,_0xbe14('0x101'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x102'));break;case'8':ut['logAgent'](_0x3e7588,0x8,_0xbe14('0xdb'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x103'));break;case'22':ut[_0xbe14('0xfc')](_0x3e7588,0x16,_0xbe14('0x104'));rpcDb['createAgentHistory'](_0x3e7588,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbe14('0xfc')](_0x3e7588,0xc,_0x5c134f['reason']);rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x103'));}ut[_0xbe14('0xf4')](_0x24fa89,_0xbe14('0x105'));logger['info'](_0xbe14('0x106'),_0x3e7588[_0xbe14('0xb6')],'\x20Queue',_0x24fa89[_0xbe14('0x51')],_0xbe14('0x6e'),_0x24fa89[_0xbe14('0x5d')]);delete this[_0xbe14('0x14')][_0x3e7588['uniqueid']];};Preview[_0xbe14('0xd')][_0xbe14('0x107')]=function(_0x37aff6,_0x3374d8,_0x3b7920,_0x469ef3,_0x208fae){var _0x310d42=this;return new BPromise(function(_0x9c229f,_0x1e8989){if(_['isNil'](_0x3374d8)||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x108')])||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x108')]['phone'])||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x75')])){_0x1e8989(ut[_0xbe14('0x4c')]('Contact\x20is\x20undefined',_0x469ef3,_0x208fae));return;}var _0x431602=uuid['v4']();var _0x3778e0=_0x310d42[_0xbe14('0x11')][_0x3374d8[_0xbe14('0x6d')][_0xbe14('0x51')]];var _0x2306f6=_0x3b7920?_0x310d42[_0xbe14('0x15')][_0x3b7920]['id']:undefined;_0x310d42['actions'][_0x431602]=new Action(_0x3374d8,_0x3778e0,_0x431602,_0x3b7920,_0x2306f6);var _0x2c2e46=_0x310d42['actions'][_0x431602];_0x2c2e46[_0xbe14('0xd8')]=_0x469ef3;_0x2c2e46[_0xbe14('0xb1')]=_0x208fae;_0x2c2e46[_0xbe14('0x109')]=_0x3b7920;if(_[_0xbe14('0x10a')](_0x37aff6)){_0x310d42[_0xbe14('0x10b')](_0x2c2e46,_0x3778e0,_0x3374d8,_0x3b7920)['then'](function(_0x5db8e8){logger[_0xbe14('0x58')](_0xbe14('0x10c'),_0xbe14('0x10d')+_0x2c2e46[_0xbe14('0x70')]+'\x20IdHopper:\x20'+_0x2c2e46[_0xbe14('0x10e')],JSON[_0xbe14('0x54')](_0x5db8e8));ami[_0xbe14('0x25')]('custom:agentcalled',ut[_0xbe14('0xa6')](_0x2c2e46,'called',_0x310d42['campaignsPreview'][_0x2c2e46[_0xbe14('0x70')]]));_0x9c229f(ut[_0xbe14('0x4c')](_0xbe14('0x10f')));})['catch'](function(_0x3ea9c2){ut[_0xbe14('0x60')]('[Preview][execCall][failure]',_0x3ea9c2);_0x1e8989(ut[_0xbe14('0x4c')](_0xbe14('0x110'),_0x469ef3,_0x208fae));});}else{_0x3778e0[_0xbe14('0x111')]+=0x1;ut['logBlacklist'](_0x2c2e46);rpcDb[_0xbe14('0x112')](_0x2c2e46,_0xbe14('0x113'));delete _0x310d42[_0xbe14('0x14')][_0x431602];_0x1e8989(ut[_0xbe14('0x4c')](_0xbe14('0x114'),_0x469ef3,_0x208fae));}});};Preview['prototype'][_0xbe14('0x9d')]=function(_0x2dc3a6){return!_[_0xbe14('0x6c')](_0x2dc3a6)&&!_['isNil'](_0x2dc3a6[_0xbe14('0x51')])&&!_[_0xbe14('0x6c')](_0x2dc3a6[_0xbe14('0x52')])&&_0x2dc3a6[_0xbe14('0x52')]&&!_[_0xbe14('0x6c')](this[_0xbe14('0x13')][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])])&&!_[_0xbe14('0x6c')](this[_0xbe14('0x13')][util['format'](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])][_0xbe14('0x116')])&&(this['trunks'][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])]['status']===_0xbe14('0x117')||this['trunks'][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6['name'])][_0xbe14('0x116')]===_0xbe14('0x118'));};Preview['prototype'][_0xbe14('0x86')]=function(_0x1e1540,_0x133ae9){var _0x27c892=this;return new BPromise(function(_0x246a02,_0x1662df){_0x27c892['execRun'](_0x1e1540,_0x133ae9)['then'](function(_0x319d08){_0x246a02(_[_0xbe14('0x72')](_0x319d08,[_0xbe14('0x4c')]));})[_0xbe14('0x79')](function(_0x48ec55){if(_0x48ec55[_0xbe14('0x119')]){rpcDb['unlockContact'](_0x1e1540);}if(_0x48ec55[_0xbe14('0x52')]){rpcDb[_0xbe14('0x89')](_0x1e1540);}_0x1662df(_['pick'](_0x48ec55,[_0xbe14('0x4c')]));});});};Preview[_0xbe14('0xd')][_0xbe14('0x11a')]=function(_0x1f06ec,_0x1137a9){var _0x17c8cc=this;return new BPromise(function(_0x1b7d69,_0x8625bb){var _0x220d5d,_0x3117fc;rpcDb[_0xbe14('0x11b')](_0x1f06ec)[_0xbe14('0x81')](function(_0x4ed1f7){if(!_[_0xbe14('0x6c')](_0x4ed1f7[0x0])){_0x3117fc=_0x4ed1f7[0x0][_0xbe14('0x11c')]?![]:!![];_0x220d5d=_0x4ed1f7[0x0][_0xbe14('0x11c')]?!![]:![];_0x220d5d=_0x1137a9?!![]:_0x220d5d;}var _0x4087b6=_0x17c8cc['validateContact'](_0x4ed1f7);if(_0x4087b6[_0xbe14('0x11d')]){rpcDb[_0xbe14('0x11e')](_['pick'](_0x4ed1f7[0x0],[_0xbe14('0x75'),_0xbe14('0x11f')]))[_0xbe14('0x81')](function(_0x4a6fc3){_0x17c8cc[_0xbe14('0x107')](_0x4a6fc3,_0x4ed1f7[0x0],_0x1137a9,_0x3117fc,_0x220d5d)[_0xbe14('0x81')](function(_0x25a038){_0x1b7d69(_0x25a038);})[_0xbe14('0x79')](function(_0x2279d1){_0x8625bb(_0x2279d1);});})['catch'](function(_0x23208d){ut[_0xbe14('0x60')](_0xbe14('0x120'),_0x23208d);_0x8625bb(ut[_0xbe14('0x4c')](_0xbe14('0x121'),_0x3117fc,_0x220d5d));});}else{_0x8625bb(ut['message'](_0x4087b6[_0xbe14('0x4c')],_0x3117fc,_0x220d5d));}})[_0xbe14('0x79')](function(_0x8eeaef){ut[_0xbe14('0x60')](_0xbe14('0x122'),_0x8eeaef);_0x8625bb(ut[_0xbe14('0x4c')](_0xbe14('0x121'),![],!![]));});});};Preview[_0xbe14('0xd')]['validateContact']=function(_0x5c25dc){if(_[_0xbe14('0x6c')](_0x5c25dc)||_[_0xbe14('0x10a')](_0x5c25dc)||!_[_0xbe14('0x6c')](_0x5c25dc[0x0][_0xbe14('0x84')])&&_[_0xbe14('0x6c')](_0x5c25dc[0x0]['Agent'][_0xbe14('0x51')])){ut[_0xbe14('0x60')](_0xbe14('0x123'),_0x5c25dc);return{'isValid':![],'message':_0xbe14('0x124')};}var _0x1257b2=this[_0xbe14('0x11')][_0x5c25dc[0x0][_0xbe14('0x6d')][_0xbe14('0x51')]];_0x1257b2['message']=_0xbe14('0xa0');if(_[_0xbe14('0x6c')](_0x1257b2)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x1257b2);return{'isValid':![],'message':_0xbe14('0x125')};}if(!this['isTrunkReachable'](_0x1257b2[_0xbe14('0x50')])){ut[_0xbe14('0x60')](_0xbe14('0x126'),_0xbe14('0x127')+_0x1257b2[_0xbe14('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xbe14('0x9d')](_0x1257b2[_0xbe14('0x9e')])){ut[_0xbe14('0x60')](_0xbe14('0x126'),_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x128'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x1257b2[_0xbe14('0x9b')])){ut['logger'](_0xbe14('0x129'),_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x12a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x12a')};}return{'isValid':!![],'message':_0xbe14('0x12b')};};Preview[_0xbe14('0xd')][_0xbe14('0x10b')]=function(_0x2e5106,_0x156fb3,_0x513b6f,_0x2fd64c){var _0x5d5fad=this;return new BPromise(function(_0x5e8d27,_0x4e849c){var _0x4e3261=_0x2e5106[_0xbe14('0xb6')];var _0x1c899d=_0x5d5fad['isTrunkReachable'](_0x156fb3[_0xbe14('0x50')])?util['format'](_0xbe14('0x12c'),_0x156fb3['Trunk'][_0xbe14('0x51')],_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x12d')])?'':_0x156fb3[_0xbe14('0x12d')][_0xbe14('0x12e')]()||'',_0x156fb3['dialCutDigit']>0x0?_0x513b6f[_0xbe14('0x108')][_0xbe14('0x12f')][_0xbe14('0x130')](_0x156fb3[_0xbe14('0x131')]):_0x513b6f['Contact']['phone']):util['format'](_0xbe14('0x12c'),_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x9e')])?_0x156fb3[_0xbe14('0x50')][_0xbe14('0x51')]:_0x156fb3['TrunkBackup']['name'],_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x12d')])?'':_0x156fb3[_0xbe14('0x12d')][_0xbe14('0x12e')]()||'',_0x156fb3[_0xbe14('0x131')]>0x0?_0x513b6f['Contact'][_0xbe14('0x12f')]['substring'](_0x156fb3[_0xbe14('0x131')]):_0x513b6f[_0xbe14('0x108')][_0xbe14('0x12f')]);var _0x1d1c84=_0x5d5fad['isTrunkReachable'](_0x156fb3[_0xbe14('0x50')])?ut[_0xbe14('0x132')](_0x156fb3[_0xbe14('0x50')][_0xbe14('0x133')],_0x156fb3['dialOriginateCallerIdName'],_0x156fb3[_0xbe14('0x134')]>0x0?ut[_0xbe14('0x135')](_0x156fb3[_0xbe14('0x33')],_0x156fb3['dialRandomLastDigitCallerIdNumber']):_0x156fb3['dialOriginateCallerIdNumber']):ut[_0xbe14('0x132')](_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x9e')])?_0x156fb3['Trunk'][_0xbe14('0x133')]:_0x156fb3[_0xbe14('0x9e')][_0xbe14('0x133')],_0x156fb3[_0xbe14('0x32')],_0x156fb3[_0xbe14('0x134')]>0x0?ut[_0xbe14('0x135')](_0x156fb3['dialOriginateCallerIdNumber'],_0x156fb3[_0xbe14('0x134')]):_0x156fb3[_0xbe14('0x33')]);if(_0x1d1c84){_0x2e5106[_0xbe14('0x136')]=ut[_0xbe14('0x137')](_0x1d1c84);_0x2e5106[_0xbe14('0x138')]=ut['extractCalleridNumber'](_0x1d1c84);}var _0x4d2094=ut[_0xbe14('0x139')](_0x156fb3,_0x513b6f,_0x1c899d,_0x1d1c84,_0x4e3261,_0x2e5106);_['merge'](_0x2e5106,ut[_0xbe14('0x13a')](_0x4d2094));_0x2e5106['starttime']=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));ami[_0xbe14('0x77')](ut['variablesAction'](_0x2e5106,_0x156fb3,_0x4d2094,_0x2e5106[_0xbe14('0xb1')],_0x2fd64c))[_0xbe14('0x81')](function(_0x2602ec){_0x156fb3[_0xbe14('0x5d')]+=0x1;logger[_0xbe14('0x58')](_0xbe14('0x13b'),_0x4e3261,_0xbe14('0xb7'),_0x156fb3[_0xbe14('0x51')],_0xbe14('0x6e'),_0x156fb3[_0xbe14('0x5d')]);_0x5e8d27(_0x2602ec);})['catch'](function(_0x1f1fb9){ut[_0xbe14('0xfc')](_0x2e5106,0xe,_0xbe14('0x13c'));rpcDb[_0xbe14('0xfe')](_0x2e5106,_0xbe14('0x13d'));_0x4e849c(_0x1f1fb9);});});};Preview[_0xbe14('0xd')][_0xbe14('0x1e')]=function(_0x36010e){if(this['actions'][_0x36010e[_0xbe14('0xb2')]]){this[_0xbe14('0x14')][_0x36010e[_0xbe14('0xb2')]][_0xbe14('0x78')]=_0x36010e[_0xbe14('0x78')];}};Preview[_0xbe14('0xd')]['syncOriginateResponse']=function(_0x479c1a){var _0x4f09fb=this;var _0x598ccc=this[_0xbe14('0x14')][_0x479c1a[_0xbe14('0x13e')]];if(_0x598ccc){if(_0x598ccc['lookAgent']&&this[_0xbe14('0x15')][_0x598ccc['lookAgent']]){ut[_0xbe14('0x13f')](_0x598ccc,this[_0xbe14('0x15')][_0x598ccc[_0xbe14('0x109')]][_0xbe14('0x51')],this[_0xbe14('0x15')][_0x598ccc[_0xbe14('0x109')]]['id']);}var _0x4f727c=_[_0xbe14('0x140')](_0x598ccc);_0x4f727c[_0xbe14('0xb4')]=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));var _0xc7acb6=_0x4f09fb[_0xbe14('0x11')][_0x598ccc[_0xbe14('0x70')]];if(ut[_0xbe14('0x141')](_0x479c1a[_0xbe14('0x142')])){if(_0x598ccc['unlockAgent']){rpcDb[_0xbe14('0x143')](_0x598ccc['idContact']);}if(_0x598ccc[_0xbe14('0xb1')]){rpcDb['disableContact'](_0x598ccc['idContact']);}ami[_0xbe14('0x25')](_0xbe14('0x144'),ut[_0xbe14('0xa6')](_0x598ccc,'rejected',this[_0xbe14('0x11')][_0x598ccc['queue']]));this[_0xbe14('0xf8')](_0x4f727c,_0xc7acb6,_0x479c1a);}else{_0x598ccc['starttime']=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));ut[_0xbe14('0xfc')](_0x4f727c,0x4,_0xbe14('0xc0'));rpcDb[_0xbe14('0xfe')](_0x4f727c,_0xbe14('0x145'));}}};Preview['prototype'][_0xbe14('0x146')]=function(_0x1100c1){var _0x4d46a3=this;var _0x52cdfd=this['actions'][_0x1100c1[_0xbe14('0xb2')]];var _0x40ef0a;if(_0x52cdfd){_0x40ef0a=this[_0xbe14('0x11')][_0x52cdfd[_0xbe14('0x70')]];logger[_0xbe14('0x58')](_0xbe14('0x147'),_0x1100c1[_0xbe14('0xb2')],'\x20Queue',_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a[_0xbe14('0x5e')]);}if(this['actions'][_0x1100c1[_0xbe14('0xb2')]]&&_0x1100c1[_0xbe14('0xb2')]!==_0x1100c1[_0xbe14('0xb6')]){if(_0x1100c1['cause']==='16'&&this['actions'][_0x1100c1[_0xbe14('0xb2')]]['dialAnswer']){this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}else if(this[_0xbe14('0x14')][_0x1100c1[_0xbe14('0xb2')]][_0xbe14('0x71')]){logger['info'](_0xbe14('0x149'),_0x1100c1['linkedid'],_0x1100c1[_0xbe14('0x148')],_0xbe14('0xb7'),_0x40ef0a[_0xbe14('0x51')],'pTalking:\x20',_0x40ef0a[_0xbe14('0x5e')]);this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1['linkedid'],_0x1100c1['cause']);}}else if(_0x52cdfd&&_[_0xbe14('0x6c')](_0x52cdfd[_0xbe14('0x14a')])&&_0x40ef0a[_0xbe14('0x14b')]&&_0x1100c1['linkedid']===_0x1100c1[_0xbe14('0xb6')]&&_[_0xbe14('0x6c')](_0x1100c1['reason'])&&_0x1100c1['cause']==='16'&&_0x1100c1['channelstate']==='6'&&_['isUndefined'](_0x52cdfd[_0xbe14('0x14c')])){if(_0x52cdfd[_0xbe14('0xd8')]){rpcDb['unlockContact'](_0x52cdfd['idContact']);}if(_0x52cdfd[_0xbe14('0xb1')]){rpcDb[_0xbe14('0x89')](_0x52cdfd[_0xbe14('0x10e')]);}_0x1100c1['reason']='22';this[_0xbe14('0xf8')](_0x52cdfd,_0x40ef0a,_0x1100c1);}else if(_0x52cdfd&&_0x52cdfd[_0xbe14('0x14c')]){if(_0x1100c1[_0xbe14('0x148')]==='16'&&this[_0xbe14('0x14')][_0x1100c1['linkedid']][_0xbe14('0x71')]){logger[_0xbe14('0x58')]('[syncHangup][talking][transfer]',_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')],_0xbe14('0xb7'),_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a['pTalking']);this['callProgressDetectingCustomer'](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}else if(this[_0xbe14('0x14')][_0x1100c1[_0xbe14('0xb2')]]['dialAnswer']){logger[_0xbe14('0x58')](_0xbe14('0x149'),_0x1100c1['linkedid'],_0x1100c1[_0xbe14('0x148')],'\x20Queue',_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a['pTalking']);this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}}};Preview[_0xbe14('0xd')][_0xbe14('0x1c')]=function(_0xac2d63){if(this[_0xbe14('0x14')][_0xac2d63[_0xbe14('0xf7')]]&&_0xac2d63['destlinkedid']!==_0xac2d63[_0xbe14('0x14d')]){this[_0xbe14('0xa1')](_0xac2d63,_0xac2d63[_0xbe14('0xf7')],_0xac2d63['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x2a5e45){if(this[_0xbe14('0x14')][_0x2a5e45[_0xbe14('0xb2')]]&&_0x2a5e45['linkedid']!==_0x2a5e45['uniqueid']&&!this[_0xbe14('0x14')][_0x2a5e45[_0xbe14('0xb2')]][_0xbe14('0x71')]){if(_0x2a5e45[_0xbe14('0x148')]==='1'){this[_0xbe14('0xa1')](_0x2a5e45,_0x2a5e45[_0xbe14('0xb2')],_0x2a5e45[_0xbe14('0x148')]);}}};Preview[_0xbe14('0xd')][_0xbe14('0x14e')]=function(_0x4b76dd,_0x43509d,_0x3a2890){if(this[_0xbe14('0x14')][_0x4b76dd]){if(_[_0xbe14('0x6c')](this[_0xbe14('0x14')][_0x4b76dd]['variables'])){this[_0xbe14('0x14')][_0x4b76dd]['variables']={};}this['actions'][_0x4b76dd][_0xbe14('0x14f')][_0x43509d]=_0x3a2890;}};Preview[_0xbe14('0xd')]['syncVarSet']=function(_0x494083){try{if(!_[_0xbe14('0x6c')](_0x494083)){if(ut[_0xbe14('0x150')](_[_0xbe14('0x151')](_0x494083[_0xbe14('0x152')])[0x0])){this[_0xbe14('0x14e')](_0x494083['uniqueid'],_['keys'](_0x494083[_0xbe14('0x152')])[0x0],_0x494083['value']);}}}catch(_0x76e84){logger[_0xbe14('0x153')]('[syncVarSet][Preview]',util['inspect'](_0x76e84,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xbe14('0x22')]=function(_0x4ee0ad){if(_0x4ee0ad){if(this[_0xbe14('0x14')][_0x4ee0ad[_0xbe14('0x154')]]){this['actions'][_0x4ee0ad[_0xbe14('0x154')]][_0xbe14('0x14c')]=!![];}}};Preview[_0xbe14('0xd')][_0xbe14('0x24')]=function(_0x2ed138){if(_0x2ed138){if(this['actions'][_0x2ed138[_0xbe14('0x155')]]){this[_0xbe14('0x14')][_0x2ed138[_0xbe14('0x155')]][_0xbe14('0x14c')]=!![];}}};module[_0xbe14('0x156')]=Preview; \ No newline at end of file +var _0x8d0e=['rescheduleContact','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','logger','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','merge','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','unlockContact','idContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','reason','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','outbound','name','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','dialMethod','preview','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','scheduledat','Agent','[RecallMe]','logger2','disableContact','starttime','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry'];(function(_0x2b955b,_0x25b512){var _0x28da9f=function(_0x3c8d43){while(--_0x3c8d43){_0x2b955b['push'](_0x2b955b['shift']());}};_0x28da9f(++_0x25b512);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x27b4c1,_0x567e5d){_0x27b4c1=_0x27b4c1-0x0;var _0x10ffae=_0x8d0e[_0x27b4c1];return _0x10ffae;};'use strict';var util=require(_0xe8d0('0x0'));var _=require(_0xe8d0('0x1'));var BPromise=require(_0xe8d0('0x2'));var uuid=require(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var md5=require(_0xe8d0('0x5'));var Redis=require(_0xe8d0('0x6'));var config=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('preview');var loggerAction=require(_0xe8d0('0x8'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xe8d0('0x9'));var Action=require(_0xe8d0('0xa'));var ut=require(_0xe8d0('0xb'));config[_0xe8d0('0xc')]=_[_0xe8d0('0xd')](config[_0xe8d0('0xc')],{'host':_0xe8d0('0xe'),'port':0x18eb});var io=require(_0xe8d0('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe8d0('0x10')][_0xe8d0('0x11')]=function(_0x463159){this['tail']=this['tail']?this[_0xe8d0('0x12')][_0xe8d0('0x13')](_0x463159):_0x463159();};function Preview(_0x3da047){this[_0xe8d0('0x14')]=new Sequence();this[_0xe8d0('0x15')]=_0x3da047[_0xe8d0('0x16')];this['trunks']=_0x3da047[_0xe8d0('0x17')];this[_0xe8d0('0x18')]={};this['agents']=_0x3da047[_0xe8d0('0x19')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xe8d0('0x1a')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x1c'),this[_0xe8d0('0x1d')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x1e'),this['syncHangupRequest'][_0xe8d0('0x1b')](this));ami['on']('dialend',this[_0xe8d0('0x1f')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x20'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xe8d0('0x21')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x22'),this[_0xe8d0('0x23')][_0xe8d0('0x1b')](this));ami['on']('blindtransfer',this[_0xe8d0('0x24')][_0xe8d0('0x1b')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x554402,_0x384a60,_0x35d131){io['to'](_0x554402)[_0xe8d0('0x25')](_0x384a60,_0x35d131);}function emitCampaignPreview(_0x1fbfe8){if(_0x1fbfe8[_0xe8d0('0x26')]===_0xe8d0('0x27')){var _0x1bd25c={'id':_0x1fbfe8['id'],'name':_0x1fbfe8[_0xe8d0('0x28')],'strategy':_0x1fbfe8[_0xe8d0('0x29')],'answered':_0x1fbfe8['answered'],'available':_0x1fbfe8[_0xe8d0('0x2a')],'loggedIn':_0x1fbfe8[_0xe8d0('0x2b')],'pTalking':_0x1fbfe8['pTalking'],'sumBillable':_0x1fbfe8[_0xe8d0('0x2c')],'sumDuration':_0x1fbfe8[_0xe8d0('0x2d')],'sumHoldTime':_0x1fbfe8[_0xe8d0('0x2e')]||0x0,'talking':_0x1fbfe8[_0xe8d0('0x2f')],'total':_0x1fbfe8[_0xe8d0('0x30')],'type':_0x1fbfe8[_0xe8d0('0x26')],'unmanaged':_0x1fbfe8[_0xe8d0('0x31')],'abandoned':_0x1fbfe8[_0xe8d0('0x32')],'waiting':_0x1fbfe8[_0xe8d0('0x33')],'loggedInDb':_0x1fbfe8[_0xe8d0('0x34')],'dialActive':_0x1fbfe8[_0xe8d0('0x35')],'dialMethod':_0x1fbfe8['dialMethod'],'dialOriginateCallerIdName':_0x1fbfe8[_0xe8d0('0x36')],'dialOriginateCallerIdNumber':_0x1fbfe8[_0xe8d0('0x37')],'dialOriginateTimeout':_0x1fbfe8[_0xe8d0('0x38')],'dialPrefix':_0x1fbfe8['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1fbfe8[_0xe8d0('0x39')],'outboundAnswerCallsDay':_0x1fbfe8[_0xe8d0('0x3a')],'outboundBlacklistCallsDay':_0x1fbfe8['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1fbfe8[_0xe8d0('0x3b')],'outboundCongestionCallsDay':_0x1fbfe8[_0xe8d0('0x3c')],'outboundDropCallsDayACS':_0x1fbfe8[_0xe8d0('0x3d')],'outboundDropCallsDayCallersExit':_0x1fbfe8[_0xe8d0('0x3e')],'outboundDropCallsDayTimeout':_0x1fbfe8[_0xe8d0('0x3f')],'outboundNoAnswerCallsDay':_0x1fbfe8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1fbfe8[_0xe8d0('0x40')],'outboundOriginateFailureCallsDay':_0x1fbfe8['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1fbfe8['outboundReCallsDay'],'outboundRejectCallsDay':_0x1fbfe8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1fbfe8[_0xe8d0('0x41')],'outboundAbandonedCallsDay':_0x1fbfe8[_0xe8d0('0x42')],'predictiveIntervalAnsweredCalls':_0x1fbfe8[_0xe8d0('0x43')],'predictiveIntervalAvgHoldtime':_0x1fbfe8['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1fbfe8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1fbfe8[_0xe8d0('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1fbfe8['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1fbfe8[_0xe8d0('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x1fbfe8[_0xe8d0('0x46')],'predictiveIntervalHitRate':_0x1fbfe8[_0xe8d0('0x47')],'predictiveIntervalMultiplicativeFactor':_0x1fbfe8[_0xe8d0('0x48')],'predictiveIntervalPauses':_0x1fbfe8[_0xe8d0('0x49')],'predictiveIntervalAvailable':_0x1fbfe8['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1fbfe8[_0xe8d0('0x4a')],'message':_0x1fbfe8[_0xe8d0('0x4b')],'originated':_0x1fbfe8[_0xe8d0('0x4c')],'erlangCalls':_0x1fbfe8[_0xe8d0('0x4d')],'erlangCallToSecond':_0x1fbfe8['erlangCallToSecond'],'erlangAbandonmentRate':_0x1fbfe8[_0xe8d0('0x4e')],'erlangBusyFactor':_0x1fbfe8[_0xe8d0('0x4f')],'startPredictive':_0x1fbfe8['startPredictive'],'startProgressive':_0x1fbfe8[_0xe8d0('0x50')]};if(_0x1fbfe8['Trunk']){_0x1bd25c[_0xe8d0('0x51')]={'id':_0x1fbfe8['Trunk']['id'],'name':_0x1fbfe8[_0xe8d0('0x51')]['name'],'active':_0x1fbfe8[_0xe8d0('0x51')][_0xe8d0('0x52')],'callerid':_0x1fbfe8[_0xe8d0('0x51')][_0xe8d0('0x53')]};}if(_0x1fbfe8['Interval']){_0x1bd25c[_0xe8d0('0x54')]={'id':_0x1fbfe8[_0xe8d0('0x54')]['id'],'name':_0x1fbfe8[_0xe8d0('0x54')]['name']};}var _0x2a66f8=md5(JSON[_0xe8d0('0x55')](_0x1bd25c));if(_0x1fbfe8[_0xe8d0('0x5')]!==_0x2a66f8){_0x1fbfe8[_0xe8d0('0x5')]=_0x2a66f8;emit(util[_0xe8d0('0x56')]('voice:queue:%s',_0x1bd25c[_0xe8d0('0x28')]),_0xe8d0('0x57'),_0x1bd25c);}}}function emitVoiceQueueChannelRemove(_0x10970d){logger[_0xe8d0('0x58')](_0xe8d0('0x59'),JSON[_0xe8d0('0x55')](_0x10970d));emit(util[_0xe8d0('0x56')](_0xe8d0('0x5a'),_0x10970d['name']),'voice_queue_channel:remove',_0x10970d);io[_0xe8d0('0x25')](_0xe8d0('0x5b'),_0x10970d);}function notSendMessagesQueue(_0x45e2dc){if(_0x45e2dc[_0xe8d0('0x5c')]){if(_0x45e2dc[_0xe8d0('0x4c')]===0x0&&_0x45e2dc['pTalking']===0x0){_0x45e2dc[_0xe8d0('0x5c')]=![];_0x45e2dc['available']=0x0;_0x45e2dc[_0xe8d0('0x5d')]=0x0;_0x45e2dc[_0xe8d0('0x4b')]=_0xe8d0('0x5e');ut['logger'](_0xe8d0('0x5f'),_0x45e2dc[_0xe8d0('0x28')]+_0xe8d0('0x60'));}else{_0x45e2dc[_0xe8d0('0x4b')]=_0xe8d0('0x61');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x45e2dc['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x45e2dc);}}Preview[_0xe8d0('0x10')]['loopCampaigns']=function(){var _0x1e6e8f=this;setInterval(function(){_0x1e6e8f[_0xe8d0('0x62')]();},0x7cf);};Preview[_0xe8d0('0x10')][_0xe8d0('0x62')]=function(){var _0x2fd21e=this[_0xe8d0('0x15')];this[_0xe8d0('0x63')]+=0x1;for(var _0x3cbca5 in _0x2fd21e){if(_0x2fd21e['hasOwnProperty'](_0x3cbca5)&&(_0x2fd21e[_0x3cbca5][_0xe8d0('0x64')]===_0xe8d0('0x65')||_0x2fd21e[_0x3cbca5]['dialMethod']==='booked')&&_0x2fd21e[_0x3cbca5][_0xe8d0('0x26')]===_0xe8d0('0x27')){if(this[_0xe8d0('0x63')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe8d0('0x66')]();}}if(_0x2fd21e[_0xe8d0('0x67')](_0x3cbca5)&&_0x2fd21e[_0x3cbca5]['dialMethod']===_0xe8d0('0x65')&&_0x2fd21e[_0x3cbca5][_0xe8d0('0x26')]==='outbound'){if(_0x2fd21e[_0x3cbca5][_0xe8d0('0x35')]){this[_0xe8d0('0x68')](_0x2fd21e[_0x3cbca5]);if(_0x2fd21e[_0x3cbca5][_0xe8d0('0x69')])this[_0xe8d0('0x6a')](_0x2fd21e[_0x3cbca5]);}else{notSendMessagesQueue(_0x2fd21e[_0x3cbca5]);}}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6b')]=function(_0x11339d){var _0x1ce97d=this;this['sequence'][_0xe8d0('0x11')](function(){if(!_[_0xe8d0('0x6c')](_0x1ce97d[_0xe8d0('0x18')][_0x11339d])){loggerAction[_0xe8d0('0x58')](_0xe8d0('0x6d'),_0x11339d,_0xe8d0('0x6e'),_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')],_0xe8d0('0x70'),JSON[_0xe8d0('0x55')](_0x1ce97d[_0xe8d0('0x15')][_0x1ce97d[_0xe8d0('0x18')][_0x11339d]['queue']][_0xe8d0('0x4c')]),_0xe8d0('0x71'),JSON[_0xe8d0('0x55')](_0x1ce97d[_0xe8d0('0x15')][_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')]][_0xe8d0('0x72')]),JSON['stringify'](_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x73')]),JSON[_0xe8d0('0x55')](_[_0xe8d0('0x74')](_0x1ce97d['actions'][_0x11339d],[_0xe8d0('0x75'),'UserId',_0xe8d0('0x76'),_0xe8d0('0x77')])));return ami[_0xe8d0('0x78')]({'action':_0xe8d0('0x79'),'channel':_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x7a')]})[_0xe8d0('0x7b')](function(_0x52b8b2){if(_0x52b8b2[_0xe8d0('0x4b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1ce97d['actions'][_0x11339d]){ut[_0xe8d0('0x7c')](_0x1ce97d['campaignsPreview'][_0x1ce97d[_0xe8d0('0x18')][_0x11339d]['queue']],_0xe8d0('0x7d'));if(_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x73')]===!![]){ut[_0xe8d0('0x7e')](_0x1ce97d['campaignsPreview'][_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')]],_0xe8d0('0x7d'));ut[_0xe8d0('0x7f')](_0xe8d0('0x80')+_0x11339d,_0x1ce97d['actions'][_0x11339d][_0xe8d0('0x6f')]);}ut[_0xe8d0('0x7f')](_0xe8d0('0x81')+_0x11339d,_0x1ce97d['actions'][_0x11339d][_0xe8d0('0x6f')]);delete _0x1ce97d['actions'][_0x11339d];}},0x2328);}});}});};Preview['prototype'][_0xe8d0('0x66')]=function(){var _0x37040a=this;loggerAction['info'](_0xe8d0('0x82'),_[_0xe8d0('0x83')](this['actions']));for(var _0x2a54c1 in this[_0xe8d0('0x18')]){if(_0x37040a[_0xe8d0('0x18')][_0xe8d0('0x67')](_0x2a54c1)){_0x37040a['clearZombieChannel'](_0x2a54c1);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6a')]=function(_0x25e5ab){var _0x76316a=this;rpcDb['getContactRecallMe'](_0x25e5ab['id'],ut[_0xe8d0('0x84')](this[_0xe8d0('0x19')]))[_0xe8d0('0x85')](function(_0x35e0d5){if(!_[_0xe8d0('0x6c')](_0x35e0d5)){for(var _0x29667c=0x0;_0x29667c<_0x35e0d5['length'];_0x29667c+=0x1){if(ut['getDiff'](_0x35e0d5[_0x29667c][_0xe8d0('0x86')])<_0x25e5ab['dialRecallMeTimeout']*0x3c){if(_0x35e0d5[_0x29667c][_0xe8d0('0x87')]&&!_0x35e0d5[_0x29667c][_0xe8d0('0x87')]['voicePause']){_0x76316a['run'](_0x35e0d5[_0x29667c]['id'])[_0xe8d0('0x85')](ut['logger2'](_0xe8d0('0x88')))['catch'](ut[_0xe8d0('0x89')](_0xe8d0('0x88')));}else{rpcDb[_0xe8d0('0x8a')](_0x35e0d5[_0x29667c]['id']);}}else{var _0x4e2abc=new Action(_0x35e0d5[_0x29667c],_0x25e5ab);_0x4e2abc[_0xe8d0('0x8b')]=moment()[_0xe8d0('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x25e5ab[_0xe8d0('0x8c')]+=0x1;ut['logCustomer'](_0x4e2abc,0x17,_0xe8d0('0x8d'));if(_0x25e5ab['dialRecallInQueue']){rpcDb[_0xe8d0('0x8e')](ut[_0xe8d0('0x8f')](_0x35e0d5[_0x29667c]));rpcDb[_0xe8d0('0x90')](_0x4e2abc,_0xe8d0('0x91'));}else{ut[_0xe8d0('0x92')](_0x4e2abc,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e2abc,_0xe8d0('0x93'));rpcDb['createCustomerFinal'](_0x4e2abc,_0xe8d0('0x93'));}}}}})[_0xe8d0('0x7b')](ut[_0xe8d0('0x89')](_0xe8d0('0x94')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x68')]=function(_0x177485){_0x177485[_0xe8d0('0x5c')]=!![];if(ut[_0xe8d0('0x95')](_0x177485[_0xe8d0('0x2b')])){_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x96');}else if(!ut[_0xe8d0('0x97')](_0x177485[_0xe8d0('0x35')])){_0x177485[_0xe8d0('0x4b')]='NOT_ACTIVE';}else if(!this[_0xe8d0('0x98')](_0x177485[_0xe8d0('0x51')])){if(!this[_0xe8d0('0x98')](_0x177485[_0xe8d0('0x99')])){_0x177485[_0xe8d0('0x4b')]='TRUNK_IS_NOT_REACHABLE';}else{_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x9a');}}else{_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x9a');}emitCampaignPreview(_0x177485);};Preview[_0xe8d0('0x10')][_0xe8d0('0x9b')]=function(_0x51eb0b,_0x13ceb4,_0x40cb5c){var _0x24be86=this;var _0x23955c=this[_0xe8d0('0x18')][_0x13ceb4];var _0x556d7e=this['campaignsPreview'][_0x23955c[_0xe8d0('0x6f')]];var _0x54c04f;if(_0x556d7e){switch(_0x40cb5c){case'1':_0x556d7e[_0xe8d0('0x40')]+=0x1;_0x23955c[_0xe8d0('0x9c')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x0,_0xe8d0('0x9e'));ami[_0xe8d0('0x25')](_0xe8d0('0x9f'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xa1')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xa2'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xa7'));}else{if(_0x23955c[_0xe8d0('0x9c')]>=_0x556d7e[_0xe8d0('0xa8')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0x9c'),_0x556d7e[_0xe8d0('0xaa')]),_0x23955c['unlockAgent'],_0x23955c[_0xe8d0('0xab')]);}}delete this['actions'][_0x51eb0b[_0xe8d0('0xac')]];break;case _0xe8d0('0xad'):var _0x22791b=moment()['format'](_0xe8d0('0xae'));_0x23955c[_0xe8d0('0xaf')]=_0x22791b;_0x23955c[_0xe8d0('0xb0')]=_0x22791b;_0x23955c[_0xe8d0('0x73')]=!![];_0x556d7e[_0xe8d0('0x72')]+=0x1;logger['info'](_0xe8d0('0xb1'),_0x23955c[_0xe8d0('0xb2')],_0xe8d0('0xb3'),_0x556d7e[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x556d7e[_0xe8d0('0x72')]);ami[_0xe8d0('0x25')](_0xe8d0('0xb4'),ut['buildObj'](_0x23955c,_0xe8d0('0xb5'),this[_0xe8d0('0x15')][_0x23955c[_0xe8d0('0x6f')]]));if(_0x556d7e[_0xe8d0('0xb6')]){ami['emit'](_0xe8d0('0xb7'),ut[_0xe8d0('0xb8')](_0x23955c));}break;case'16':ami[_0xe8d0('0x25')]('custom:agentcomplete',ut[_0xe8d0('0xa0')](_0x23955c,'complete',this[_0xe8d0('0x15')][_0x23955c['queue']]));emitVoiceQueueChannelRemove(ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xb9')));_0x556d7e[_0xe8d0('0x3a')]+=0x1;_0x556d7e[_0xe8d0('0x30')]+=0x1;_0x556d7e[_0xe8d0('0xba')]+=0x1;ut[_0xe8d0('0x7e')](_0x556d7e,_0xe8d0('0xbb'));_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x4,_0xe8d0('0xbd'));rpcDb[_0xe8d0('0x90')](_0x23955c,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xbe'));rpcDb[_0xe8d0('0xbf')](_0x23955c);_0x556d7e[_0xe8d0('0x2d')]+=_0x23955c[_0xe8d0('0xc0')];_0x556d7e[_0xe8d0('0x2c')]+=_0x23955c[_0xe8d0('0xc0')];logger[_0xe8d0('0x58')](_0xe8d0('0xc1'),_0x23955c[_0xe8d0('0xb2')],'\x20Queue',_0x556d7e[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x556d7e[_0xe8d0('0x72')]);delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];break;case'BUSY':_0x556d7e['outboundBusyCallsDay']+=0x1;_0x23955c[_0xe8d0('0xc2')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x5,_0xe8d0('0xc3'));ami['emit'](_0xe8d0('0xc4'),ut['buildObj'](_0x23955c,_0xe8d0('0xc5')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xc6'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut['cloneAction'](_0x23955c,0xf,'Global');rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xc7'));}else{if(_0x23955c[_0xe8d0('0xc2')]>=_0x556d7e[_0xe8d0('0xc8')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xc6'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xc2'),_0x556d7e['dialBusyRetryFrequency']),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case _0xe8d0('0xcb'):_0x556d7e[_0xe8d0('0xcc')]+=0x1;_0x23955c['countnoanswerretry']+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x3,_0xe8d0('0xcd'));ami[_0xe8d0('0x25')](_0xe8d0('0xce'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xcf')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xd0'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xd1'));}else{if(_0x23955c[_0xe8d0('0xd2')]>=_0x556d7e[_0xe8d0('0xd3')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xd0'));}else{rpcDb[_0xe8d0('0xc9')](ut['scheduledAt'](_0x23955c,'countnoanswerretry',_0x556d7e[_0xe8d0('0xd4')]),_0x23955c[_0xe8d0('0xca')],_0x23955c['activeContact']);}}break;case _0xe8d0('0xd5'):_0x556d7e[_0xe8d0('0x3c')]+=0x1;_0x23955c[_0xe8d0('0xd6')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x8,_0xe8d0('0xd7'));ami[_0xe8d0('0x25')]('custom:agentcongestion',ut['buildObj'](_0x23955c,_0xe8d0('0xd8')));rpcDb[_0xe8d0('0x90')](_0x23955c,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb['createCustomerFinal'](_0x54c04f,_0xe8d0('0xd9'));}else{if(_0x23955c['countcongestionretry']>=_0x556d7e['dialCongestionMaxRetry']){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xda'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xd6'),_0x556d7e['dialBusyRetryFrequency']),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case'CANCEL':_0x556d7e[_0xe8d0('0xdb')]+=0x1;_0x23955c[_0xe8d0('0xdc')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x14,_0xe8d0('0xdd'));ami[_0xe8d0('0x25')](_0xe8d0('0xde'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xdf')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xe0'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0x14,_0xe8d0('0xdd'));rpcDb['createCustomerFinal'](_0x54c04f,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x23955c['countagentrejectretry']>=_0x556d7e['dialAgentRejectMaxRetry']){rpcDb[_0xe8d0('0xa6')](_0x23955c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xa9')](_0x23955c,'countagentrejectretry',_0x556d7e[_0xe8d0('0xe1')]),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case _0xe8d0('0xe2'):_0x556d7e[_0xe8d0('0x42')]+=0x1;_0x23955c[_0xe8d0('0xe3')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0xb,_0xe8d0('0xe4'));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xe5'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,'Global');rpcDb[_0xe8d0('0xa6')](_0x54c04f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x23955c[_0xe8d0('0xe6')]>=_0x556d7e[_0xe8d0('0xe7')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xe5'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xe3'),_0x556d7e[_0xe8d0('0xe8')]),_0x23955c['unlockAgent'],_0x23955c[_0xe8d0('0xab')]);}}break;case'18':_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c[_0xe8d0('0xe9')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x12,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);ami[_0xe8d0('0x25')](_0xe8d0('0xeb'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xec')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xed'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xed'));}else{rpcDb['createCustomerFinal'](_0x23955c,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];break;case'19':_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x13,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);ami['emit'](_0xe8d0('0xeb'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xec')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xee'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut['cloneAction'](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xee'));}else{rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xee'));}delete this['actions'][_0x51eb0b['linkedid']];break;default:if(_0x23955c[_0xe8d0('0x73')]){ut['decrementTalkink'](_0x556d7e,_0xe8d0('0xef'));ut['loggerError'](_0xe8d0('0xf0')+_0x556d7e[_0xe8d0('0x28')],_0x51eb0b);}_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0xc,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xf1'));if(ut['totalGlobal'](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xe8d0('0xa6')](_0x23955c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe8d0('0x18')][_0x51eb0b['linkedid']];}if(!(_0x23955c['dialAnswer']&&_0x40cb5c==='16')){ut['updateOriginated'](_0x556d7e,_0xe8d0('0xf2'));logger['info'](_0xe8d0('0xf3'),_0x23955c['uniqueid'],_0xe8d0('0xb3'),_0x556d7e['name'],'originated:\x20',_0x556d7e[_0xe8d0('0x4c')]);}if(_0x40cb5c!=='ANSWER'){delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xf4')]];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0xf5')]=function(_0x57c5ae,_0x43062c,_0x5c7a76){if(_[_0xe8d0('0xf6')](_0x43062c)&&_0xe8d0('0xf7')!==typeof _0x43062c){return;}if(_[_0xe8d0('0xf6')](_0x5c7a76)&&_0xe8d0('0xf7')!==typeof _0x5c7a76){return;}switch(_0x5c7a76['reason']){case'0':ut[_0xe8d0('0xf8')](_0x57c5ae,0x0,_0xe8d0('0x9e'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfa'));break;case'3':ut[_0xe8d0('0xf8')](_0x57c5ae,0x3,_0xe8d0('0xcd'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe8d0('0xf8')](_0x57c5ae,0x5,_0xe8d0('0xc3'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfb'));break;case'8':ut[_0xe8d0('0xf8')](_0x57c5ae,0x8,_0xe8d0('0xd7'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfc'));break;case'22':ut['logAgent'](_0x57c5ae,0x16,_0xe8d0('0xfd'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x57c5ae,0xc,_0x5c7a76['reason']);rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfc'));}ut[_0xe8d0('0x7c')](_0x43062c,_0xe8d0('0xfe'));logger['info'](_0xe8d0('0xff'),_0x57c5ae['uniqueid'],'\x20Queue',_0x43062c[_0xe8d0('0x28')],'originated:\x20',_0x43062c['originated']);delete this[_0xe8d0('0x18')][_0x57c5ae['uniqueid']];};Preview[_0xe8d0('0x10')][_0xe8d0('0x100')]=function(_0x57d57f,_0xc9a56d,_0xc6fd9a,_0x5dbf91,_0x436574){var _0x729c89=this;return new BPromise(function(_0x33f42e,_0x30fee6){if(_[_0xe8d0('0x6c')](_0xc9a56d)||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x101')])||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x101')][_0xe8d0('0x102')])||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x76')])){_0x30fee6(ut[_0xe8d0('0x4b')]('Contact\x20is\x20undefined',_0x5dbf91,_0x436574));return;}var _0x2dd9b5=uuid['v4']();var _0x3ccf5d=_0x729c89[_0xe8d0('0x15')][_0xc9a56d[_0xe8d0('0x6e')][_0xe8d0('0x28')]];var _0x2f7371=_0xc6fd9a?_0x729c89[_0xe8d0('0x19')][_0xc6fd9a]['id']:undefined;_0x729c89[_0xe8d0('0x18')][_0x2dd9b5]=new Action(_0xc9a56d,_0x3ccf5d,_0x2dd9b5,_0xc6fd9a,_0x2f7371);var _0x4c073=_0x729c89[_0xe8d0('0x18')][_0x2dd9b5];_0x4c073[_0xe8d0('0xca')]=_0x5dbf91;_0x4c073[_0xe8d0('0xab')]=_0x436574;_0x4c073[_0xe8d0('0x103')]=_0xc6fd9a;if(_[_0xe8d0('0x104')](_0x57d57f)){_0x729c89[_0xe8d0('0x105')](_0x4c073,_0x3ccf5d,_0xc9a56d,_0xc6fd9a)[_0xe8d0('0x85')](function(_0x35b681){logger[_0xe8d0('0x58')](_0xe8d0('0x106'),'Queue:\x20'+_0x4c073[_0xe8d0('0x6f')]+_0xe8d0('0x107')+_0x4c073['idContact'],JSON['stringify'](_0x35b681));ami[_0xe8d0('0x25')]('custom:agentcalled',ut['buildObj'](_0x4c073,_0xe8d0('0x108'),_0x729c89[_0xe8d0('0x15')][_0x4c073['queue']]));_0x33f42e(ut['message'](_0xe8d0('0x109')));})[_0xe8d0('0x7b')](function(_0x57db94){ut[_0xe8d0('0x10a')](_0xe8d0('0x10b'),_0x57db94);_0x30fee6(ut['message']('Call\x20failed',_0x5dbf91,_0x436574));});}else{_0x3ccf5d[_0xe8d0('0x10c')]+=0x1;ut[_0xe8d0('0x10d')](_0x4c073);rpcDb[_0xe8d0('0x10e')](_0x4c073,_0xe8d0('0x10f'));delete _0x729c89[_0xe8d0('0x18')][_0x2dd9b5];_0x30fee6(ut['message'](_0xe8d0('0x110'),_0x5dbf91,_0x436574));}});};Preview[_0xe8d0('0x10')]['isTrunkReachable']=function(_0x5a5253){return!_[_0xe8d0('0x6c')](_0x5a5253)&&!_[_0xe8d0('0x6c')](_0x5a5253['name'])&&!_[_0xe8d0('0x6c')](_0x5a5253[_0xe8d0('0x52')])&&_0x5a5253['active']&&!_['isNil'](this[_0xe8d0('0x17')][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])])&&!_[_0xe8d0('0x6c')](this[_0xe8d0('0x17')][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')])&&(this['trunks'][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')]===_0xe8d0('0x112')||this[_0xe8d0('0x17')][util[_0xe8d0('0x56')]('SIP/%s',_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')]===_0xe8d0('0x113'));};Preview[_0xe8d0('0x10')]['run']=function(_0x29a256,_0x31d174){var _0x5f0a2f=this;return new BPromise(function(_0x183c1f,_0x4a520d){_0x5f0a2f[_0xe8d0('0x114')](_0x29a256,_0x31d174)[_0xe8d0('0x85')](function(_0x44816a){_0x183c1f(_['pick'](_0x44816a,[_0xe8d0('0x4b')]));})[_0xe8d0('0x7b')](function(_0x24b26f){if(_0x24b26f[_0xe8d0('0x115')]){rpcDb['unlockContact'](_0x29a256);}if(_0x24b26f[_0xe8d0('0x52')]){rpcDb[_0xe8d0('0x8a')](_0x29a256);}_0x4a520d(_[_0xe8d0('0x74')](_0x24b26f,['message']));});});};Preview[_0xe8d0('0x10')]['execRun']=function(_0xa57cb9,_0x48cae3){var _0x1e3993=this;return new BPromise(function(_0x52c05c,_0x4a667f){var _0x596011,_0x3e1c17;rpcDb[_0xe8d0('0x116')](_0xa57cb9)[_0xe8d0('0x85')](function(_0xd82505){if(!_[_0xe8d0('0x6c')](_0xd82505[0x0])){_0x3e1c17=_0xd82505[0x0]['recallme']?![]:!![];_0x596011=_0xd82505[0x0][_0xe8d0('0x117')]?!![]:![];_0x596011=_0x48cae3?!![]:_0x596011;}var _0x1ac76c=_0x1e3993[_0xe8d0('0x118')](_0xd82505);if(_0x1ac76c[_0xe8d0('0x119')]){rpcDb[_0xe8d0('0x11a')](_[_0xe8d0('0x74')](_0xd82505[0x0],[_0xe8d0('0x76'),_0xe8d0('0x11b')]))[_0xe8d0('0x85')](function(_0x598287){_0x1e3993[_0xe8d0('0x100')](_0x598287,_0xd82505[0x0],_0x48cae3,_0x3e1c17,_0x596011)['then'](function(_0xa3b334){_0x52c05c(_0xa3b334);})['catch'](function(_0x36efb3){_0x4a667f(_0x36efb3);});})[_0xe8d0('0x7b')](function(_0xa51da){ut[_0xe8d0('0x10a')](_0xe8d0('0x11c'),_0xa51da);_0x4a667f(ut['message'](_0xe8d0('0x11d'),_0x3e1c17,_0x596011));});}else{_0x4a667f(ut[_0xe8d0('0x4b')](_0x1ac76c[_0xe8d0('0x4b')],_0x3e1c17,_0x596011));}})['catch'](function(_0x21d2f7){ut[_0xe8d0('0x10a')](_0xe8d0('0x11e'),_0x21d2f7);_0x4a667f(ut[_0xe8d0('0x4b')](_0xe8d0('0x11d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x1b3a0d){if(_['isNil'](_0x1b3a0d)||_[_0xe8d0('0x104')](_0x1b3a0d)||!_[_0xe8d0('0x6c')](_0x1b3a0d[0x0][_0xe8d0('0x87')])&&_[_0xe8d0('0x6c')](_0x1b3a0d[0x0]['Agent'][_0xe8d0('0x28')])){ut[_0xe8d0('0x10a')](_0xe8d0('0x11f'),_0x1b3a0d);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2e35ef=this['campaignsPreview'][_0x1b3a0d[0x0][_0xe8d0('0x6e')][_0xe8d0('0x28')]];_0x2e35ef[_0xe8d0('0x4b')]=_0xe8d0('0x9a');if(_[_0xe8d0('0x6c')](_0x2e35ef)){ut[_0xe8d0('0x10a')](_0xe8d0('0x120'),_0x2e35ef);return{'isValid':![],'message':_0xe8d0('0x121')};}if(!this[_0xe8d0('0x98')](_0x2e35ef[_0xe8d0('0x51')])){ut['logger'](_0xe8d0('0x122'),_0xe8d0('0x123')+_0x2e35ef[_0xe8d0('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x2e35ef[_0xe8d0('0x99')])){ut[_0xe8d0('0x10a')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2e35ef[_0xe8d0('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe8d0('0x124')};}}if(!ut[_0xe8d0('0x97')](_0x2e35ef[_0xe8d0('0x35')])){ut[_0xe8d0('0x10a')](_0xe8d0('0x125'),_0x2e35ef['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xe8d0('0x123')+_0x2e35ef[_0xe8d0('0x28')]+_0xe8d0('0x126')};}return{'isValid':!![],'message':_0xe8d0('0x127')};};Preview[_0xe8d0('0x10')]['execCall']=function(_0x110b6a,_0x951308,_0x235ccf,_0x5bda3a){var _0x31bfe=this;return new BPromise(function(_0x5cc742,_0x3e6b07){var _0x5a40c2=_0x110b6a[_0xe8d0('0xb2')];var _0x48bad4=_0x31bfe[_0xe8d0('0x98')](_0x951308[_0xe8d0('0x51')])?util[_0xe8d0('0x56')]('SIP/%s/%s%s',_0x951308['Trunk'][_0xe8d0('0x28')],_[_0xe8d0('0x6c')](_0x951308[_0xe8d0('0x128')])?'':_0x951308[_0xe8d0('0x128')][_0xe8d0('0x129')]()||'',_0x951308[_0xe8d0('0x12a')]>0x0?_0x235ccf[_0xe8d0('0x101')]['phone']['substring'](_0x951308[_0xe8d0('0x12a')]):_0x235ccf[_0xe8d0('0x101')]['phone']):util[_0xe8d0('0x56')]('SIP/%s/%s%s',_[_0xe8d0('0x6c')](_0x951308['TrunkBackup'])?_0x951308['Trunk'][_0xe8d0('0x28')]:_0x951308[_0xe8d0('0x99')]['name'],_['isNil'](_0x951308[_0xe8d0('0x128')])?'':_0x951308['dialPrefix'][_0xe8d0('0x129')]()||'',_0x951308['dialCutDigit']>0x0?_0x235ccf[_0xe8d0('0x101')][_0xe8d0('0x102')][_0xe8d0('0x12b')](_0x951308['dialCutDigit']):_0x235ccf[_0xe8d0('0x101')][_0xe8d0('0x102')]);var _0x5e7090=_0x31bfe[_0xe8d0('0x98')](_0x951308[_0xe8d0('0x51')])?ut[_0xe8d0('0x12c')](_0x951308[_0xe8d0('0x51')][_0xe8d0('0x53')],_0x951308[_0xe8d0('0x36')],_0x951308[_0xe8d0('0x12d')]>0x0?ut[_0xe8d0('0x12e')](_0x951308[_0xe8d0('0x37')],_0x951308['dialRandomLastDigitCallerIdNumber']):_0x951308[_0xe8d0('0x37')]):ut[_0xe8d0('0x12c')](_[_0xe8d0('0x6c')](_0x951308['TrunkBackup'])?_0x951308[_0xe8d0('0x51')][_0xe8d0('0x53')]:_0x951308['TrunkBackup'][_0xe8d0('0x53')],_0x951308[_0xe8d0('0x36')],_0x951308[_0xe8d0('0x12d')]>0x0?ut['getCallerIdRandom'](_0x951308['dialOriginateCallerIdNumber'],_0x951308['dialRandomLastDigitCallerIdNumber']):_0x951308['dialOriginateCallerIdNumber']);if(_0x5e7090){_0x110b6a[_0xe8d0('0x12f')]=ut['extractCalleridName'](_0x5e7090);_0x110b6a[_0xe8d0('0x130')]=ut['extractCalleridNumber'](_0x5e7090);}var _0x226957=ut['addVariables'](_0x951308,_0x235ccf,_0x48bad4,_0x5e7090,_0x5a40c2,_0x110b6a);_[_0xe8d0('0x131')](_0x110b6a,ut['toLowerVariables'](_0x226957));_0x110b6a[_0xe8d0('0x8b')]=moment()[_0xe8d0('0x56')](_0xe8d0('0xae'));ami[_0xe8d0('0x78')](ut[_0xe8d0('0x132')](_0x110b6a,_0x951308,_0x226957,_0x110b6a['activeContact'],_0x5bda3a))['then'](function(_0x21e895){_0x951308[_0xe8d0('0x4c')]+=0x1;logger['info']('[originated][increment]',_0x5a40c2,'\x20Queue',_0x951308[_0xe8d0('0x28')],_0xe8d0('0x70'),_0x951308['originated']);_0x5cc742(_0x21e895);})[_0xe8d0('0x7b')](function(_0x657240){ut[_0xe8d0('0xf8')](_0x110b6a,0xe,_0xe8d0('0x133'));rpcDb[_0xe8d0('0xf9')](_0x110b6a,_0xe8d0('0x134'));_0x3e6b07(_0x657240);});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x135')]=function(_0x342d25){if(this['actions'][_0x342d25[_0xe8d0('0xac')]]){this['actions'][_0x342d25[_0xe8d0('0xac')]][_0xe8d0('0x7a')]=_0x342d25['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x11533f){var _0x50ff29=this;var _0x2ed64c=this[_0xe8d0('0x18')][_0x11533f['actionid']];if(_0x2ed64c){if(_0x2ed64c['lookAgent']&&this[_0xe8d0('0x19')][_0x2ed64c['lookAgent']]){ut[_0xe8d0('0x136')](_0x2ed64c,this[_0xe8d0('0x19')][_0x2ed64c['lookAgent']][_0xe8d0('0x28')],this['agents'][_0x2ed64c[_0xe8d0('0x103')]]['id']);}var _0x262bdc=_[_0xe8d0('0x137')](_0x2ed64c);_0x262bdc['responsetime']=moment()[_0xe8d0('0x56')](_0xe8d0('0xae'));var _0x1abe4d=_0x50ff29['campaignsPreview'][_0x2ed64c['queue']];if(ut[_0xe8d0('0x138')](_0x11533f['response'])){if(_0x2ed64c[_0xe8d0('0xca')]){rpcDb[_0xe8d0('0x139')](_0x2ed64c[_0xe8d0('0x13a')]);}if(_0x2ed64c[_0xe8d0('0xab')]){rpcDb['disableContact'](_0x2ed64c[_0xe8d0('0x13a')]);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x2ed64c,_0xe8d0('0x13b'),this[_0xe8d0('0x15')][_0x2ed64c[_0xe8d0('0x6f')]]));this[_0xe8d0('0xf5')](_0x262bdc,_0x1abe4d,_0x11533f);}else{_0x2ed64c[_0xe8d0('0x8b')]=moment()['format'](_0xe8d0('0xae'));ut['logAgent'](_0x262bdc,0x4,'Answer');rpcDb[_0xe8d0('0xf9')](_0x262bdc,_0xe8d0('0x13c'));}}};Preview[_0xe8d0('0x10')]['syncHangup']=function(_0x18d5d8){var _0x2f5242=this;var _0x391eb7=this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]];var _0x527668;if(_0x391eb7){_0x527668=this[_0xe8d0('0x15')][_0x391eb7[_0xe8d0('0x6f')]];logger[_0xe8d0('0x58')](_0xe8d0('0x13d'),_0x18d5d8[_0xe8d0('0xac')],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);}if(this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]]&&_0x18d5d8['linkedid']!==_0x18d5d8[_0xe8d0('0xb2')]){if(_0x18d5d8['cause']==='16'&&this['actions'][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8['linkedid'],_0x18d5d8[_0xe8d0('0x13e')]);}else if(this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){logger[_0xe8d0('0x58')](_0xe8d0('0x13f'),_0x18d5d8['linkedid'],_0x18d5d8[_0xe8d0('0x13e')],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8['linkedid'],_0x18d5d8['cause']);}}else if(_0x391eb7&&_[_0xe8d0('0x6c')](_0x391eb7[_0xe8d0('0x140')])&&_0x527668[_0xe8d0('0x141')]&&_0x18d5d8[_0xe8d0('0xac')]===_0x18d5d8[_0xe8d0('0xb2')]&&_[_0xe8d0('0x6c')](_0x18d5d8['reason'])&&_0x18d5d8[_0xe8d0('0x13e')]==='16'&&_0x18d5d8[_0xe8d0('0x142')]==='6'&&_[_0xe8d0('0xf6')](_0x391eb7[_0xe8d0('0x143')])){if(_0x391eb7[_0xe8d0('0xca')]){rpcDb['unlockContact'](_0x391eb7[_0xe8d0('0x13a')]);}if(_0x391eb7[_0xe8d0('0xab')]){rpcDb[_0xe8d0('0x8a')](_0x391eb7['idContact']);}_0x18d5d8[_0xe8d0('0x144')]='22';this[_0xe8d0('0xf5')](_0x391eb7,_0x527668,_0x18d5d8);}else if(_0x391eb7&&_0x391eb7[_0xe8d0('0x143')]){if(_0x18d5d8[_0xe8d0('0x13e')]==='16'&&this['actions'][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){logger[_0xe8d0('0x58')](_0xe8d0('0x145'),_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8['cause'],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8[_0xe8d0('0x13e')]);}else if(this['actions'][_0x18d5d8[_0xe8d0('0xac')]]['dialAnswer']){logger[_0xe8d0('0x58')](_0xe8d0('0x13f'),_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8['cause'],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],'pTalking:\x20',_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8[_0xe8d0('0x13e')]);}}};Preview[_0xe8d0('0x10')]['syncDialEnd']=function(_0x37ab7c){if(this[_0xe8d0('0x18')][_0x37ab7c['destlinkedid']]&&_0x37ab7c[_0xe8d0('0xf4')]!==_0x37ab7c['destuniqueid']){this['callProgressDetectingCustomer'](_0x37ab7c,_0x37ab7c[_0xe8d0('0xf4')],_0x37ab7c[_0xe8d0('0xea')]);}};Preview[_0xe8d0('0x10')]['syncHangupRequest']=function(_0x3eaa1f){if(this[_0xe8d0('0x18')][_0x3eaa1f['linkedid']]&&_0x3eaa1f[_0xe8d0('0xac')]!==_0x3eaa1f['uniqueid']&&!this[_0xe8d0('0x18')][_0x3eaa1f[_0xe8d0('0xac')]][_0xe8d0('0x73')]){if(_0x3eaa1f['cause']==='1'){this[_0xe8d0('0x9b')](_0x3eaa1f,_0x3eaa1f[_0xe8d0('0xac')],_0x3eaa1f[_0xe8d0('0x13e')]);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x146')]=function(_0x28d34f,_0xf323b4,_0x783fa){if(this['actions'][_0x28d34f]){if(_[_0xe8d0('0x6c')](this[_0xe8d0('0x18')][_0x28d34f][_0xe8d0('0x147')])){this[_0xe8d0('0x18')][_0x28d34f][_0xe8d0('0x147')]={};}this[_0xe8d0('0x18')][_0x28d34f]['variables'][_0xf323b4]=_0x783fa;}};Preview[_0xe8d0('0x10')][_0xe8d0('0x21')]=function(_0x1fa83e){try{if(!_[_0xe8d0('0x6c')](_0x1fa83e)){if(ut[_0xe8d0('0x148')](_[_0xe8d0('0x149')](_0x1fa83e[_0xe8d0('0x14a')])[0x0])){this[_0xe8d0('0x146')](_0x1fa83e[_0xe8d0('0xb2')],_[_0xe8d0('0x149')](_0x1fa83e[_0xe8d0('0x14a')])[0x0],_0x1fa83e['value']);}}}catch(_0x475248){logger[_0xe8d0('0x14b')](_0xe8d0('0x14c'),util[_0xe8d0('0x14d')](_0x475248,{'showHidden':![],'depth':null}));}};Preview[_0xe8d0('0x10')]['syncAttendedTransfer']=function(_0x564361){if(_0x564361){if(this[_0xe8d0('0x18')][_0x564361[_0xe8d0('0x14e')]]){this[_0xe8d0('0x18')][_0x564361['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x24')]=function(_0xb5f1b3){if(_0xb5f1b3){if(this[_0xe8d0('0x18')][_0xb5f1b3[_0xe8d0('0x14f')]]){this[_0xe8d0('0x18')][_0xb5f1b3['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d016280..6461057 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 _0x1e55=['unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x1e55,0x1c3));var _0x51e5=function(_0x3c8423,_0x172993){_0x3c8423=_0x3c8423-0x0;var _0x466ed3=_0x1e55[_0x3c8423];return _0x466ed3;};'use strict';var util=require(_0x51e5('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0x51e5('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x51e5('0x2'));var cmHopperHistory=require(_0x51e5('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x51e5('0x4'));var agentReportPreview=require(_0x51e5('0x5'));var voiceQueueReport=require(_0x51e5('0x6'));function loggerCatch(_0x558deb){return function(_0x465c66){logger[_0x51e5('0x7')](_0x558deb,util[_0x51e5('0x8')](_0x465c66,{'showHidden':![],'depth':null}));};}function create(_0x1c4d4e){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopperHistory['createHistory'](_0x1c4d4e))[_0x51e5('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x49b93b){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](agentReportPreview[_0x51e5('0xc')](_0x49b93b))[_0x51e5('0xb')](loggerCatch(_0x51e5('0xd')));}function moveContact(_0x3ae08a){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopper[_0x51e5('0xe')](_0x3ae08a,!![]))[_0x51e5('0xb')](loggerCatch(_0x51e5('0xf')));}exports[_0x51e5('0x10')]=function(_0x1317fd){return BPromise[_0x51e5('0x9')]()['then'](cmHopperBlack[_0x51e5('0x10')](_0x1317fd))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x51e5('0x11')]=function(_0x5be8e3){return BPromise['resolve']()[_0x51e5('0xa')](cmHopper[_0x51e5('0x11')](_0x5be8e3))['catch'](loggerCatch(_0x51e5('0x12')));};exports[_0x51e5('0xc')]=function(_0x23f96a,_0x1568e0){create(_0x23f96a)['catch'](loggerCatch(_0x1568e0));moveContact(_0x23f96a)[_0x51e5('0xb')](loggerCatch(_0x1568e0));};exports[_0x51e5('0x13')]=function(_0xbf6275,_0x2c0c76){createAgent(_0xbf6275)[_0x51e5('0xb')](loggerCatch(_0x2c0c76));};exports[_0x51e5('0x14')]=function(_0x3229c0,_0x466afd){create(_0x3229c0)['catch'](loggerCatch(_0x466afd));};exports['createCustomerFinal']=function(_0x3552d2,_0x5c6fa3){moveContact(_0x3552d2)[_0x51e5('0xb')](loggerCatch(_0x5c6fa3));};exports['rescheduleContact']=function(_0x48c4cf,_0x3f1861,_0x42bafd){if(_0x3f1861){_0x48c4cf[_0x51e5('0x15')]=null;}if(_0x42bafd){_0x48c4cf[_0x51e5('0x16')]=![];}return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopper['rescheduleContact'](_0x48c4cf))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x17')));};exports[_0x51e5('0x18')]=function(_0x5b45b5){return BPromise[_0x51e5('0x9')]()['then'](cmHopper[_0x51e5('0x18')](_0x5b45b5))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x19')));};exports[_0x51e5('0x1a')]=function(_0x4f0c76){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopper[_0x51e5('0x1a')]({'UserId':null},_0x4f0c76,0x1))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x1b')));};exports['disableContact']=function(_0x1a62c4){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopper['unlockContact']({'active':![]},_0x1a62c4,0x1))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x1c')));};exports[_0x51e5('0x1d')]=function(_0x38e2e4){var _0x106ce2={};_0x106ce2[_0x51e5('0x1e')]=_0x38e2e4[_0x51e5('0x1e')];_0x106ce2[_0x51e5('0x1f')]=_0x38e2e4[_0x51e5('0x1f')];_0x106ce2[_0x51e5('0x20')]=_0x38e2e4[_0x51e5('0x20')];_0x106ce2['calleridname']=_0x38e2e4[_0x51e5('0x21')];_0x106ce2[_0x51e5('0x22')]=_0x38e2e4[_0x51e5('0x22')];_0x106ce2[_0x51e5('0x23')]=_0x38e2e4['answertime'];_0x106ce2[_0x51e5('0x24')]=_0x38e2e4[_0x51e5('0x25')];_0x106ce2[_0x51e5('0x26')]=0x1;_0x106ce2['queuecallercompleteAt']=_0x38e2e4[_0x51e5('0x27')];_0x106ce2['connectedlinename']=_0x38e2e4[_0x51e5('0x28')];_0x106ce2[_0x51e5('0x29')]=_0x51e5('0x2a');_0x106ce2['exten']=_0x51e5('0x2b');_0x106ce2[_0x51e5('0x2c')]=0x0;_0x106ce2[_0x51e5('0x2d')]=0x1;_0x106ce2[_0x51e5('0x2e')]=_0x38e2e4[_0x51e5('0x28')];_0x106ce2[_0x51e5('0x2f')]=_0x51e5('0x30');return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](voiceQueueReport['create'](_0x106ce2))[_0x51e5('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x17b4c3,_0x210b96){return BPromise[_0x51e5('0x9')]()[_0x51e5('0xa')](cmHopper['getContactRecallMe'](_0x17b4c3,_0x210b96))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x31')));};exports[_0x51e5('0x32')]=function(_0x4dd299){return BPromise[_0x51e5('0x9')]()['then'](cmHopper[_0x51e5('0x33')](_0x4dd299,!![],!![]))[_0x51e5('0xb')](loggerCatch(_0x51e5('0x34')));}; \ No newline at end of file +var _0xb17f=['util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','exten','xcally-motion-preview','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xb17f,0xf0));var _0xfb17=function(_0x463d2f,_0x492575){_0x463d2f=_0x463d2f-0x0;var _0x42ddb2=_0xb17f[_0x463d2f];return _0x42ddb2;};'use strict';var util=require(_0xfb17('0x0'));var BPromise=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))(_0xfb17('0x3'));var _=require(_0xfb17('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xfb17('0x5'));var cmHopperBlack=require(_0xfb17('0x6'));var voiceQueueRt=require(_0xfb17('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xfb17('0x8'));function loggerCatch(_0x215773){return function(_0x2f679a){logger[_0xfb17('0x9')](_0x215773,util[_0xfb17('0xa')](_0x2f679a,{'showHidden':![],'depth':null}));};}function create(_0x106eb2){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopperHistory[_0xfb17('0xd')](_0x106eb2))[_0xfb17('0xe')](loggerCatch(_0xfb17('0xf')));}function createAgent(_0x5d5045){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](agentReportPreview['createHistory'](_0x5d5045))[_0xfb17('0xe')](loggerCatch(_0xfb17('0xf')));}function moveContact(_0x26c60c){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopper[_0xfb17('0x10')](_0x26c60c,!![]))[_0xfb17('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x12be9d){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopperBlack['checkIsBlackList'](_0x12be9d))[_0xfb17('0xe')](loggerCatch(_0xfb17('0x11')));};exports['getContactPreview']=function(_0x29c174){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopper[_0xfb17('0x12')](_0x29c174))[_0xfb17('0xe')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5825f5,_0x1db3c4){create(_0x5825f5)[_0xfb17('0xe')](loggerCatch(_0x1db3c4));moveContact(_0x5825f5)[_0xfb17('0xe')](loggerCatch(_0x1db3c4));};exports[_0xfb17('0x13')]=function(_0x2290d6,_0x3cc3d6){createAgent(_0x2290d6)[_0xfb17('0xe')](loggerCatch(_0x3cc3d6));};exports[_0xfb17('0x14')]=function(_0x3e0559,_0x20e371){create(_0x3e0559)[_0xfb17('0xe')](loggerCatch(_0x20e371));};exports[_0xfb17('0x15')]=function(_0x3e9d11,_0x2e70d5){moveContact(_0x3e9d11)[_0xfb17('0xe')](loggerCatch(_0x2e70d5));};exports['rescheduleContact']=function(_0x12f2da,_0x6e60a5,_0x1067b5){if(_0x6e60a5){_0x12f2da[_0xfb17('0x16')]=null;}if(_0x1067b5){_0x12f2da['active']=![];}return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopper[_0xfb17('0x17')](_0x12f2da))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x1bc8f9){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopper[_0xfb17('0x18')](_0x1bc8f9))[_0xfb17('0xe')](loggerCatch(_0xfb17('0x19')));};exports[_0xfb17('0x1a')]=function(_0x279f5c){return BPromise['resolve']()[_0xfb17('0xc')](cmHopper[_0xfb17('0x1a')]({'UserId':null},_0x279f5c,0x1))[_0xfb17('0xe')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x50e8bd){return BPromise['resolve']()[_0xfb17('0xc')](cmHopper[_0xfb17('0x1a')]({'active':![]},_0x50e8bd,0x1))[_0xfb17('0xe')](loggerCatch(_0xfb17('0x1b')));};exports['crateCustomerReportQueue']=function(_0x17cb2d){var _0x3f4217={};_0x3f4217['type']=_0x17cb2d['type'];_0x3f4217[_0xfb17('0x1c')]=_0x17cb2d[_0xfb17('0x1c')];_0x3f4217[_0xfb17('0x1d')]=_0x17cb2d[_0xfb17('0x1d')];_0x3f4217[_0xfb17('0x1e')]=_0x17cb2d[_0xfb17('0x1e')];_0x3f4217[_0xfb17('0x1f')]=_0x17cb2d['queue'];_0x3f4217[_0xfb17('0x20')]=_0x17cb2d[_0xfb17('0x21')];_0x3f4217[_0xfb17('0x22')]=_0x17cb2d[_0xfb17('0x21')];_0x3f4217[_0xfb17('0x23')]=0x1;_0x3f4217['queuecallercompleteAt']=_0x17cb2d[_0xfb17('0x24')];_0x3f4217['connectedlinename']=_0x17cb2d[_0xfb17('0x25')];_0x3f4217[_0xfb17('0x26')]='from-sip';_0x3f4217[_0xfb17('0x27')]=_0xfb17('0x28');_0x3f4217['holdtime']=0x0;_0x3f4217[_0xfb17('0x29')]=0x1;_0x3f4217['lastAssignedTo']=_0x17cb2d[_0xfb17('0x25')];_0x3f4217['queuecallerexitreason']=_0xfb17('0x2a');return BPromise['resolve']()['then'](voiceQueueReport[_0xfb17('0x2b')](_0x3f4217))['catch'](loggerCatch(_0xfb17('0x2c')));};exports[_0xfb17('0x2d')]=function(_0x186dc2,_0x5a05a){return BPromise['resolve']()[_0xfb17('0xc')](cmHopper[_0xfb17('0x2d')](_0x186dc2,_0x5a05a))[_0xfb17('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xfb17('0x2e')]=function(_0x2c4a20){return BPromise[_0xfb17('0xb')]()[_0xfb17('0xc')](cmHopper[_0xfb17('0x17')](_0x2c4a20,!![],!![]))[_0xfb17('0xe')](loggerCatch(_0xfb17('0x2f')));}; \ 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 3668499..d27f407 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 _0xa3cf=['callbackuniqueid','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','preview','env','XCALLY_IP_AGI','loggerCatch','inspect','info','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','dialer','VoiceQueueId','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname','uniqueid','channelAgent','\x22%s\x22\x20<%s>','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','scheduledAt','active','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','motionChannel','mandatoryDisposition','queue','agentReadyId','not_inuse','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','callback'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa3cf,0x1a2));var _0xfa3c=function(_0x1aa696,_0x51da2c){_0x1aa696=_0x1aa696-0x0;var _0x53db41=_0xa3cf[_0x1aa696];return _0x53db41;};'use strict';var util=require(_0xfa3c('0x0'));var _=require('lodash');var moment=require(_0xfa3c('0x1'));var logger=require('../../../../config/logger')(_0xfa3c('0x2'));var ipAgi=process[_0xfa3c('0x3')][_0xfa3c('0x4')]||'127.0.0.1';function getSeconds(_0x5a67e1,_0x4f4acd){var _0x585a8c=moment(_0x5a67e1)['milliseconds'](0x0);var _0x4de251=moment(_0x4f4acd)['milliseconds'](0x0);return _0x585a8c['diff'](_0x4de251,'seconds');}exports[_0xfa3c('0x5')]=function(_0x147791){return function(_0x4a9ce1){logger['error'](_0x147791,util[_0xfa3c('0x6')](_0x4a9ce1,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5924c2,_0x3c5523){logger[_0xfa3c('0x7')](_0x5924c2,util[_0xfa3c('0x6')](_0x3c5523,{'showHidden':![],'depth':null}));};exports[_0xfa3c('0x8')]=function(_0x54f2d0,_0x493c0d){logger['error'](_0x54f2d0,util[_0xfa3c('0x6')](_0x493c0d,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4a8ad5){return function(_0x1100eb){logger[_0xfa3c('0x7')](_0x4a8ad5,util[_0xfa3c('0x6')](_0x1100eb,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3e415d,_0x1f4dcc,_0x3c32c2){return{'message':_0x3e415d,'unlock':_0x1f4dcc,'active':_0x3c32c2};};exports[_0xfa3c('0x9')]=function(_0x4b4bc7,_0x56aba6,_0x33f676){if(!_[_0xfa3c('0xa')](_0x33f676)&&_0xfa3c('0xb')===typeof _0x33f676&&!_[_0xfa3c('0xc')](_0x33f676)){if(!_[_0xfa3c('0xa')](_0x56aba6)&&'string'===typeof _0x56aba6&&!_['isEmpty'](_0x56aba6)){return util[_0xfa3c('0xd')]('\x22%s\x22\x20<%s>',_0x56aba6,_0x33f676);}return util[_0xfa3c('0xd')]('\x22%s\x22\x20<%s>',_0x33f676,_0x33f676);}if(!_[_0xfa3c('0xa')](_0x4b4bc7)&&_0xfa3c('0xb')===typeof _0x4b4bc7&&!_[_0xfa3c('0xc')](_0x4b4bc7)){return _0x4b4bc7;}return _0xfa3c('0xe');};exports['isActive']=function(_0x52b4f0){if(_[_0xfa3c('0xf')](_0x52b4f0)){return![];}return _0x52b4f0;};exports[_0xfa3c('0x10')]=function(_0x5bc6e4,_0x1fa35b,_0x55b5eb,_0x45a00f,_0x13d48f,_0x1a26e6){var _0x2e1bfb={'XMD-QUEUE':_0x1fa35b[_0xfa3c('0x11')]?_0x1fa35b[_0xfa3c('0x11')][_0xfa3c('0x12')]:'','XMD-CALLERID':_0x45a00f,'XMD-CALLERID-PREVIEW':_0x1a26e6?util[_0xfa3c('0xd')]('\x22%s\x22\x20<%s>',_0x1a26e6['calleridname'],_0x1a26e6[_0xfa3c('0x13')]):_0x45a00f,'XMD-DIALID':_0x13d48f,'XMD-CONTACTID':_0x1fa35b['ContactId'],'XMD-CDRTYPE':_0xfa3c('0x14'),'CALLERID(all)':_0x45a00f,'XMD-VOICEQUEUEID':_0x1fa35b[_0xfa3c('0x15')],'XMD-DIALCHANNEL':_0x55b5eb,'XMD-DIALTIMEOUT':_0x5bc6e4['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xfa3c('0xd')]('\x22rtTxX%s%s\x22',_0x5bc6e4[_0xfa3c('0x16')]?'g':'',_['isEmpty'](_0x5bc6e4[_0xfa3c('0x17')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5bc6e4['dialPreviewUrl']||'','XMD-AGI':_0x5bc6e4[_0xfa3c('0x18')]?util[_0xfa3c('0xd')](_0xfa3c('0x19'),ipAgi,_0x5bc6e4[_0xfa3c('0x18')]):_0xfa3c('0x1a'),'XMD-AGIAFTER':_0x5bc6e4[_0xfa3c('0x16')]?util[_0xfa3c('0xd')](_0xfa3c('0x19'),ipAgi,_0x5bc6e4[_0xfa3c('0x16')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1a26e6?_0x1a26e6[_0xfa3c('0x1b')]:'','XMD-ORIGINATECALLERIDNAME':_0x1a26e6?_0x1a26e6[_0xfa3c('0x1c')]:'','XMD-DESTINATION':_0xfa3c('0x1d'),'SIPADDHEADER':_0xfa3c('0x1e')};if(!_[_0xfa3c('0xc')](_0x5bc6e4[_0xfa3c('0x17')])){_0x2e1bfb[util[_0xfa3c('0xd')]('%s',_0xfa3c('0x1f'))]=_0x5bc6e4[_0xfa3c('0x17')];_0x2e1bfb[util[_0xfa3c('0xd')]('%s',_0xfa3c('0x20'))]=_0x13d48f;}if(_0x1fa35b&&_0x1fa35b[_0xfa3c('0x21')]){for(var _0x51e1a6 in _0x1fa35b[_0xfa3c('0x21')]){if(_0x1fa35b['Contact'][_0xfa3c('0x22')](_0x51e1a6)){if(!_[_0xfa3c('0xf')](_0x1fa35b[_0xfa3c('0x21')][_0x51e1a6])&&_0x51e1a6!=='id'&&_0x51e1a6!=='tags'&&_0x51e1a6!==_0xfa3c('0x23')&&_0x51e1a6!==_0xfa3c('0x24')){_0x2e1bfb[util[_0xfa3c('0xd')](_0xfa3c('0x25'),_0xfa3c('0x26'),_[_0xfa3c('0x27')](_0x51e1a6))]=_0x1fa35b[_0xfa3c('0x21')][_0x51e1a6];}}}}return _0x2e1bfb;};exports[_0xfa3c('0x28')]=function(_0x3f6c84){var _0x592922={};for(var _0x5a5107 in _0x3f6c84){if(_0x3f6c84[_0xfa3c('0x22')](_0x5a5107)){_0x592922[util[_0xfa3c('0xd')]('%s',_[_0xfa3c('0x29')](_0x5a5107))]=_0x3f6c84[_0x5a5107];}}return{'variables':_0x592922};};exports[_0xfa3c('0x2a')]=function(_0x29181c,_0x5212ca){if(!_[_0xfa3c('0xf')](_0x29181c)){if(_0x29181c[_0xfa3c('0x22')](_0xfa3c('0x2b'))){if(_0x29181c[_0xfa3c('0x2b')]>0x0){_0x29181c[_0xfa3c('0x2b')]-=0x1;}else{logger[_0xfa3c('0x2c')](_0xfa3c('0x2d'),_0x5212ca);}}}else{logger[_0xfa3c('0x2c')](_0xfa3c('0x2e'),_0x5212ca);}};exports['logBlacklist']=function(_0x1f0f50){var _0x6fc0f0=moment()[_0xfa3c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f0f50[_0xfa3c('0x2f')]=0xd;_0x1f0f50[_0xfa3c('0x30')]=_0xfa3c('0x31');_0x1f0f50[_0xfa3c('0x32')]=_0x6fc0f0;_0x1f0f50[_0xfa3c('0x33')]=_0x6fc0f0;_0x1f0f50[_0xfa3c('0x34')]=_0x6fc0f0;};exports['logAgent']=function(_0x4a8aa3,_0x3d7992,_0x5541d2){var _0x72ef30=moment()[_0xfa3c('0xd')](_0xfa3c('0x35'));_0x4a8aa3[_0xfa3c('0x2f')]=_0x3d7992;_0x4a8aa3['statedesc']=_0x5541d2;_0x4a8aa3[_0xfa3c('0x33')]=_0x72ef30;_0x4a8aa3[_0xfa3c('0x36')]=getSeconds(_0x4a8aa3[_0xfa3c('0x33')],_0x4a8aa3[_0xfa3c('0x32')]);};exports[_0xfa3c('0x37')]=function(_0x55bbc7,_0x277c4,_0x5adb3c){_0x55bbc7[_0xfa3c('0x38')]=_0x277c4;_0x55bbc7[_0xfa3c('0x39')]=_0x5adb3c;};exports[_0xfa3c('0x3a')]=function(_0x3730f3,_0x2ca6ab,_0x2bfea0){var _0x34c934=moment()[_0xfa3c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x3730f3[_0xfa3c('0x2f')]=_0x2ca6ab;_0x3730f3[_0xfa3c('0x30')]=_0x2bfea0;_0x3730f3[_0xfa3c('0x33')]=_0x3730f3[_0xfa3c('0x33')]?_0x3730f3['responsetime']:_0x34c934;_0x3730f3[_0xfa3c('0x34')]=_0x3730f3[_0xfa3c('0x34')]?_0x3730f3['endtime']:_0x34c934;_0x3730f3[_0xfa3c('0x36')]=getSeconds(_0x3730f3['responsetime']||0x0,_0x3730f3[_0xfa3c('0x32')]||0x0);_0x3730f3[_0xfa3c('0x3b')]=_0x3730f3[_0xfa3c('0x3c')]?getSeconds(_0x3730f3['endtime'],_0x3730f3[_0xfa3c('0x3c')]):0x0;};exports[_0xfa3c('0x3d')]=function(_0x875d88){return _0x875d88==='Failure';};exports[_0xfa3c('0x3e')]=function(_0x2d6fae,_0x2621b7,_0x2a4846,_0x124043,_0x5a1843){var _0x182f4f=_0x124043?'RECALL':_0x2d6fae[_0xfa3c('0x3f')];_0x182f4f=_0x5a1843?'BOOKED':_0x182f4f;return{'actionid':_0x2d6fae[_0xfa3c('0x40')],'action':'originate','channel':_0x2d6fae[_0xfa3c('0x41')],'callerid':util[_0xfa3c('0xd')](_0xfa3c('0x42'),_0x182f4f,_0x2d6fae['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xfa3c('0x43'),'Priority':'1','variable':_0x2a4846,'timeout':(_0x2621b7[_0xfa3c('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d6fae[_0xfa3c('0x40')]};};exports[_0xfa3c('0x45')]=function(_0x1f904c){return _0x1f904c[_0xfa3c('0x46')]+_0x1f904c[_0xfa3c('0x47')]+_0x1f904c[_0xfa3c('0x48')]+_0x1f904c[_0xfa3c('0x49')]+_0x1f904c[_0xfa3c('0x4a')];};exports['cloneAction']=function(_0x103556){var _0x27fbed=_[_0xfa3c('0x4b')](_0x103556);_0x27fbed[_0xfa3c('0x2f')]=0xf;_0x27fbed[_0xfa3c('0x30')]='Global';return _0x27fbed;};exports[_0xfa3c('0x4c')]=function(_0x551026,_0x3b21c4,_0x5965b6){var _0x477dd0={};_0x477dd0[_0x3b21c4]=_0x551026[_0x3b21c4];_0x477dd0[_0xfa3c('0x4d')]=![];_0x477dd0['scheduledat']=moment()['add'](_0x5965b6,_0xfa3c('0x4e'))['format'](_0xfa3c('0x35'));_0x477dd0[_0xfa3c('0x4f')]=_0x551026['ContactId'];_0x477dd0[_0xfa3c('0x50')]=_0x551026[_0xfa3c('0x50')];_0x477dd0[_0xfa3c('0x15')]=_0x551026[_0xfa3c('0x15')]||undefined;return _0x477dd0;};exports[_0xfa3c('0x51')]=function(_0x1b459e,_0x169417){if(!_[_0xfa3c('0xf')](_0x1b459e)){if(_0x1b459e[_0xfa3c('0x52')]>0x0){_0x1b459e[_0xfa3c('0x52')]-=0x1;}else{logger['error'](_0x169417,_0xfa3c('0x53'));}}else{logger[_0xfa3c('0x2c')](_0x169417,_0xfa3c('0x54'));}};exports[_0xfa3c('0x55')]=function(_0x32b498){if(_0x32b498<=0x0){return!![];}return![];};exports[_0xfa3c('0x56')]=function(_0x21fff1,_0x582a6f,_0x33dbd9){_0x21fff1[_0xfa3c('0x57')]=_0x582a6f;_0x21fff1[_0xfa3c('0x12')]=_0x21fff1['queue'];_0x21fff1[_0xfa3c('0x58')]=_0x21fff1[_0xfa3c('0x41')];_0x21fff1[_0xfa3c('0x59')]='voice';if(_0x33dbd9){_0x21fff1[_0xfa3c('0x5a')]=_0x33dbd9[_0xfa3c('0x5a')];}return _0x21fff1;};exports['buildAcw']=function(_0x21dd25){var _0x50c464={};_0x50c464[_0xfa3c('0x5b')]=_0x21dd25[_0xfa3c('0x5b')];_0x50c464[_0xfa3c('0x58')]=_0x21dd25[_0xfa3c('0x41')];_0x50c464[_0xfa3c('0x40')]=_0x21dd25['uniqueid'];return _0x50c464;};exports[_0xfa3c('0x5c')]=function(_0x306bb6){var _0x8fd248=[];for(var _0x5d4503 in _0x306bb6){if(_0x306bb6['hasOwnProperty'](_0x5d4503)){if(!_[_0xfa3c('0xf')](_0x306bb6[_0x5d4503])&&_0x306bb6[_0x5d4503]['state']===_0xfa3c('0x5d')&&_0x306bb6[_0x5d4503]['status']===_0xfa3c('0x5e')){_0x8fd248['push'](_0x306bb6[_0x5d4503]['id']);}}}return _0x8fd248;};exports[_0xfa3c('0x5f')]=function(_0x4877e9){var _0x3d5e0e=moment()['milliseconds'](0x0);var _0x2396fa=moment(_0x4877e9)[_0xfa3c('0x60')](0x0);return _0x3d5e0e[_0xfa3c('0x61')](_0x2396fa,_0xfa3c('0x62'));};exports[_0xfa3c('0x63')]=function(_0x492116){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x492116['ContactId'],'ListId':_0x492116['ListId'],'VoiceQueueId':_0x492116[_0xfa3c('0x15')]||undefined,'CampaignId':_0x492116[_0xfa3c('0x64')]||undefined};};exports['filterKey']=function(_0x196a3a){if(_0x196a3a===_0xfa3c('0x40')||_0x196a3a===_0xfa3c('0x65')||_0x196a3a===_0xfa3c('0x5b')||_0x196a3a===_0xfa3c('0x66')||_0x196a3a===_0xfa3c('0x67')||_0x196a3a===_0xfa3c('0x68')||_0x196a3a===_0xfa3c('0x38')||_0x196a3a===_0xfa3c('0x41')||_0x196a3a==='calleridname'||_0x196a3a===_0xfa3c('0x4d')||_0x196a3a===_0xfa3c('0x13')||_0x196a3a==='scheduledat'||_0x196a3a===_0xfa3c('0x46')||_0x196a3a===_0xfa3c('0x47')||_0x196a3a==='countnoanswerretry'||_0x196a3a==='countglobal'||_0x196a3a===_0xfa3c('0x69')||_0x196a3a===_0xfa3c('0x6a')||_0x196a3a==='callbackat'||_0x196a3a==='recallme'||_0x196a3a==='ContactId'||_0x196a3a===_0xfa3c('0x50')||_0x196a3a===_0xfa3c('0x39')||_0x196a3a==='VoiceQueueId'||_0x196a3a===_0xfa3c('0x6b')||_0x196a3a==='xmd-voicequeueid'||_0x196a3a===_0xfa3c('0x6c')||_0x196a3a==='xmd-phone'||_0x196a3a==='xmd-listid'||_0x196a3a===_0xfa3c('0x6d')||_0x196a3a===_0xfa3c('0x6e')||_0x196a3a===_0xfa3c('0x6f')||_0x196a3a==='xmd-dialid'||_0x196a3a==='xmd-dialchannel'||_0x196a3a===_0xfa3c('0x70')||_0x196a3a===_0xfa3c('0x71')||_0x196a3a==='xmd-callerid'||_0x196a3a==='xmd-agiafter'||_0x196a3a===_0xfa3c('0x72')||_0x196a3a==='rtpaudioqos'||_0x196a3a==='rtpaudioqosbridged'||_0x196a3a===_0xfa3c('0x73')||_0x196a3a===_0xfa3c('0x74')||_0x196a3a===_0xfa3c('0x75')||_0x196a3a===_0xfa3c('0x76')||_0x196a3a==='rtpaudioqosrtt'||_0x196a3a==='rtpaudioqosrttbridged'||_0x196a3a===_0xfa3c('0x77')||_0x196a3a===_0xfa3c('0x78')||_0x196a3a==='rtpaudioqosjitter'||_0x196a3a===_0xfa3c('0x74')||_0x196a3a==='rtpaudioqosloss'||_0x196a3a==='rtpaudioqoslossbridged'||_0x196a3a===_0xfa3c('0x79')||_0x196a3a==='rtpaudioqosrttbridged'||_0x196a3a===_0xfa3c('0x7a')||_0x196a3a===_0xfa3c('0x7b')||_0x196a3a==='state'||_0x196a3a===_0xfa3c('0x30')){return![];}return!![];};exports[_0xfa3c('0x7c')]=function(_0x2e44cc,_0x334b55){var _0x37d94d,_0x338988,_0x1aab41;if(_0x334b55<=0x0){_0x334b55=0x1;}_0x37d94d=new RegExp(_0xfa3c('0x7d')+_0x334b55+'}$');_0x338988=Math[_0xfa3c('0x7e')](0xa,_0x334b55-0x1);_0x1aab41=Math[_0xfa3c('0x7e')](0xa,_0x334b55)-0x1;return util[_0xfa3c('0xd')]('%s',_[_0xfa3c('0x7f')](_0x2e44cc,_0x37d94d,_[_0xfa3c('0x80')](_0x338988,_0x1aab41)));};exports['extractCalleridName']=function(_0x29963d){var _0x4dbeb3=_0x29963d[_0xfa3c('0x81')](/"(.*?)"/);return _0x4dbeb3?_0x4dbeb3[0x1]:_0x29963d;};exports[_0xfa3c('0x82')]=function(_0x9fa935){var _0x2d78ab=_0x9fa935[_0xfa3c('0x81')](/<(.*?)>/);return _0x2d78ab?_0x2d78ab[0x1]:_0x9fa935;}; \ No newline at end of file +var _0x89ad=['filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitter','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','motionChannel','voice','mandatoryDisposition','buildAcw','status','push','createBody'];(function(_0x3f3fb3,_0x4373fe){var _0x559344=function(_0xbe19e9){while(--_0xbe19e9){_0x3f3fb3['push'](_0x3f3fb3['shift']());}};_0x559344(++_0x4373fe);}(_0x89ad,0x13c));var _0xd89a=function(_0x5d1b3c,_0x41945e){_0x5d1b3c=_0x5d1b3c-0x0;var _0x45176a=_0x89ad[_0x5d1b3c];return _0x45176a;};'use strict';var util=require(_0xd89a('0x0'));var _=require(_0xd89a('0x1'));var moment=require('moment');var logger=require(_0xd89a('0x2'))(_0xd89a('0x3'));var ipAgi=process[_0xd89a('0x4')][_0xd89a('0x5')]||_0xd89a('0x6');function getSeconds(_0x312fdd,_0x597d34){var _0x382d68=moment(_0x312fdd)['milliseconds'](0x0);var _0x266558=moment(_0x597d34)[_0xd89a('0x7')](0x0);return _0x382d68[_0xd89a('0x8')](_0x266558,_0xd89a('0x9'));}exports[_0xd89a('0xa')]=function(_0x21c943){return function(_0x585a18){logger[_0xd89a('0xb')](_0x21c943,util['inspect'](_0x585a18,{'showHidden':![],'depth':null}));};};exports[_0xd89a('0xc')]=function(_0x2c350c,_0x1a50f8){logger[_0xd89a('0xd')](_0x2c350c,util[_0xd89a('0xe')](_0x1a50f8,{'showHidden':![],'depth':null}));};exports[_0xd89a('0xf')]=function(_0x4d7d14,_0x121d11){logger[_0xd89a('0xb')](_0x4d7d14,util['inspect'](_0x121d11,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4365e6){return function(_0x31f6d3){logger[_0xd89a('0xd')](_0x4365e6,util[_0xd89a('0xe')](_0x31f6d3,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xcef7d7,_0x5067e7,_0x1cb61b){return{'message':_0xcef7d7,'unlock':_0x5067e7,'active':_0x1cb61b};};exports['getCallerId']=function(_0x172d2d,_0x44e5a1,_0x10be61){if(!_[_0xd89a('0x10')](_0x10be61)&&_0xd89a('0x11')===typeof _0x10be61&&!_[_0xd89a('0x12')](_0x10be61)){if(!_[_0xd89a('0x10')](_0x44e5a1)&&_0xd89a('0x11')===typeof _0x44e5a1&&!_[_0xd89a('0x12')](_0x44e5a1)){return util[_0xd89a('0x13')](_0xd89a('0x14'),_0x44e5a1,_0x10be61);}return util[_0xd89a('0x13')](_0xd89a('0x14'),_0x10be61,_0x10be61);}if(!_['isUndefined'](_0x172d2d)&&_0xd89a('0x11')===typeof _0x172d2d&&!_[_0xd89a('0x12')](_0x172d2d)){return _0x172d2d;}return _0xd89a('0x15');};exports[_0xd89a('0x16')]=function(_0x23c05a){if(_[_0xd89a('0x17')](_0x23c05a)){return![];}return _0x23c05a;};exports['addVariables']=function(_0x81ae56,_0x5195d3,_0x3caa3c,_0x13670f,_0x15e319,_0x202fb5){var _0x15c50b={'XMD-QUEUE':_0x5195d3['Queue']?_0x5195d3[_0xd89a('0x18')]['name']:'','XMD-CALLERID':_0x13670f,'XMD-CALLERID-PREVIEW':_0x202fb5?util[_0xd89a('0x13')](_0xd89a('0x14'),_0x202fb5[_0xd89a('0x19')],_0x202fb5[_0xd89a('0x1a')]):_0x13670f,'XMD-DIALID':_0x15e319,'XMD-CONTACTID':_0x5195d3[_0xd89a('0x1b')],'XMD-CDRTYPE':_0xd89a('0x1c'),'CALLERID(all)':_0x13670f,'XMD-VOICEQUEUEID':_0x5195d3[_0xd89a('0x1d')],'XMD-DIALCHANNEL':_0x3caa3c,'XMD-DIALTIMEOUT':_0x81ae56['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd89a('0x1e'),_0x81ae56['dialQueueProject2']?'g':'',_[_0xd89a('0x12')](_0x81ae56[_0xd89a('0x1f')])?'':_0xd89a('0x20')),'XMD-DIALURL':_0x81ae56[_0xd89a('0x21')]||'','XMD-AGI':_0x81ae56[_0xd89a('0x22')]?util['format'](_0xd89a('0x23'),ipAgi,_0x81ae56[_0xd89a('0x22')]):_0xd89a('0x24'),'XMD-AGIAFTER':_0x81ae56['dialQueueProject2']?util[_0xd89a('0x13')](_0xd89a('0x23'),ipAgi,_0x81ae56[_0xd89a('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x202fb5?_0x202fb5[_0xd89a('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x202fb5?_0x202fb5['originatecalleridname']:'','XMD-DESTINATION':_0xd89a('0x27'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xd89a('0x12')](_0x81ae56[_0xd89a('0x1f')])){_0x15c50b[util[_0xd89a('0x13')]('%s',_0xd89a('0x28'))]=_0x81ae56[_0xd89a('0x1f')];_0x15c50b[util[_0xd89a('0x13')]('%s',_0xd89a('0x29'))]=_0x15e319;}if(_0x5195d3&&_0x5195d3[_0xd89a('0x2a')]){for(var _0xc4e8d0 in _0x5195d3[_0xd89a('0x2a')]){if(_0x5195d3[_0xd89a('0x2a')]['hasOwnProperty'](_0xc4e8d0)){if(!_['isNil'](_0x5195d3['Contact'][_0xc4e8d0])&&_0xc4e8d0!=='id'&&_0xc4e8d0!==_0xd89a('0x2b')&&_0xc4e8d0!==_0xd89a('0x2c')&&_0xc4e8d0!==_0xd89a('0x2d')){_0x15c50b[util['format'](_0xd89a('0x2e'),_0xd89a('0x2f'),_[_0xd89a('0x30')](_0xc4e8d0))]=_0x5195d3[_0xd89a('0x2a')][_0xc4e8d0];}}}}return _0x15c50b;};exports[_0xd89a('0x31')]=function(_0x5d6298){var _0x181552={};for(var _0xeff85b in _0x5d6298){if(_0x5d6298['hasOwnProperty'](_0xeff85b)){_0x181552[util[_0xd89a('0x13')]('%s',_[_0xd89a('0x32')](_0xeff85b))]=_0x5d6298[_0xeff85b];}}return{'variables':_0x181552};};exports['updateOriginated']=function(_0x369abc,_0xb462ce){if(!_['isNil'](_0x369abc)){if(_0x369abc[_0xd89a('0x33')](_0xd89a('0x34'))){if(_0x369abc[_0xd89a('0x34')]>0x0){_0x369abc[_0xd89a('0x34')]-=0x1;}else{logger[_0xd89a('0xb')](_0xd89a('0x35'),_0xb462ce);}}}else{logger[_0xd89a('0xb')](_0xd89a('0x36'),_0xb462ce);}};exports[_0xd89a('0x37')]=function(_0x15136e){var _0x3ceacf=moment()[_0xd89a('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x15136e[_0xd89a('0x38')]=0xd;_0x15136e[_0xd89a('0x39')]=_0xd89a('0x3a');_0x15136e['starttime']=_0x3ceacf;_0x15136e[_0xd89a('0x3b')]=_0x3ceacf;_0x15136e['endtime']=_0x3ceacf;};exports[_0xd89a('0x3c')]=function(_0x2f12ff,_0x3980c1,_0x5483e8){var _0x3ddce7=moment()[_0xd89a('0x13')](_0xd89a('0x3d'));_0x2f12ff[_0xd89a('0x38')]=_0x3980c1;_0x2f12ff['statedesc']=_0x5483e8;_0x2f12ff[_0xd89a('0x3b')]=_0x3ddce7;_0x2f12ff['ringtime']=getSeconds(_0x2f12ff['responsetime'],_0x2f12ff[_0xd89a('0x3e')]);};exports['logLookAgent']=function(_0xa7f20e,_0x50cd5e,_0x4873d8){_0xa7f20e['membername']=_0x50cd5e;_0xa7f20e[_0xd89a('0x3f')]=_0x4873d8;};exports[_0xd89a('0x40')]=function(_0x5b8bb6,_0x4e3ca6,_0x25cd49){var _0xe5290f=moment()[_0xd89a('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b8bb6[_0xd89a('0x38')]=_0x4e3ca6;_0x5b8bb6['statedesc']=_0x25cd49;_0x5b8bb6[_0xd89a('0x3b')]=_0x5b8bb6['responsetime']?_0x5b8bb6['responsetime']:_0xe5290f;_0x5b8bb6[_0xd89a('0x41')]=_0x5b8bb6[_0xd89a('0x41')]?_0x5b8bb6[_0xd89a('0x41')]:_0xe5290f;_0x5b8bb6[_0xd89a('0x42')]=getSeconds(_0x5b8bb6['responsetime']||0x0,_0x5b8bb6[_0xd89a('0x3e')]||0x0);_0x5b8bb6[_0xd89a('0x43')]=_0x5b8bb6[_0xd89a('0x44')]?getSeconds(_0x5b8bb6[_0xd89a('0x41')],_0x5b8bb6[_0xd89a('0x44')]):0x0;};exports[_0xd89a('0x45')]=function(_0x547c75){return _0x547c75===_0xd89a('0x46');};exports[_0xd89a('0x47')]=function(_0x5d2ebe,_0x1f74bd,_0x186f1b,_0x24fe85,_0x55b26c){var _0x21ae4a=_0x24fe85?_0xd89a('0x48'):_0x5d2ebe['calleridname'];_0x21ae4a=_0x55b26c?_0xd89a('0x49'):_0x21ae4a;return{'actionid':_0x5d2ebe['uniqueid'],'action':_0xd89a('0x4a'),'channel':_0x5d2ebe[_0xd89a('0x4b')],'callerid':util['format'](_0xd89a('0x14'),_0x21ae4a,_0x5d2ebe[_0xd89a('0x1a')]),'Exten':_0xd89a('0x27'),'Context':_0xd89a('0x4c'),'Priority':'1','variable':_0x186f1b,'timeout':(_0x1f74bd[_0xd89a('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5d2ebe[_0xd89a('0x4e')]};};exports[_0xd89a('0x4f')]=function(_0x37c45f){return _0x37c45f[_0xd89a('0x50')]+_0x37c45f[_0xd89a('0x51')]+_0x37c45f[_0xd89a('0x52')]+_0x37c45f[_0xd89a('0x53')]+_0x37c45f[_0xd89a('0x54')];};exports['cloneAction']=function(_0x4cd8bd){var _0xa402a0=_[_0xd89a('0x55')](_0x4cd8bd);_0xa402a0[_0xd89a('0x38')]=0xf;_0xa402a0['statedesc']=_0xd89a('0x56');return _0xa402a0;};exports[_0xd89a('0x57')]=function(_0x5cdb37,_0xd29cfe,_0x1f2335){var _0x220b4c={};_0x220b4c[_0xd29cfe]=_0x5cdb37[_0xd29cfe];_0x220b4c[_0xd89a('0x58')]=![];_0x220b4c[_0xd89a('0x59')]=moment()[_0xd89a('0x5a')](_0x1f2335,'minutes')[_0xd89a('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x220b4c[_0xd89a('0x1b')]=_0x5cdb37[_0xd89a('0x1b')];_0x220b4c[_0xd89a('0x5b')]=_0x5cdb37['ListId'];_0x220b4c[_0xd89a('0x1d')]=_0x5cdb37[_0xd89a('0x1d')]||undefined;return _0x220b4c;};exports[_0xd89a('0x5c')]=function(_0x4003e7,_0x2bce7e){if(!_[_0xd89a('0x17')](_0x4003e7)){if(_0x4003e7[_0xd89a('0x5d')]>0x0){_0x4003e7['pTalking']-=0x1;}else{logger['error'](_0x2bce7e,_0xd89a('0x5e'));}}else{logger[_0xd89a('0xb')](_0x2bce7e,_0xd89a('0x5f'));}};exports['IsNotLoggedIn']=function(_0x23d43f){if(_0x23d43f<=0x0){return!![];}return![];};exports['buildObj']=function(_0x58d3c3,_0x312ca5,_0x2e00fa){_0x58d3c3['lastevent']=_0x312ca5;_0x58d3c3['name']=_0x58d3c3[_0xd89a('0x60')];_0x58d3c3['interface']=_0x58d3c3[_0xd89a('0x4b')];_0x58d3c3[_0xd89a('0x61')]=_0xd89a('0x62');if(_0x2e00fa){_0x58d3c3[_0xd89a('0x63')]=_0x2e00fa['mandatoryDisposition'];}return _0x58d3c3;};exports[_0xd89a('0x64')]=function(_0x57a7cf){var _0x27b9d8={};_0x27b9d8[_0xd89a('0x60')]=_0x57a7cf[_0xd89a('0x60')];_0x27b9d8['interface']=_0x57a7cf['channelAgent'];_0x27b9d8[_0xd89a('0x4e')]=_0x57a7cf[_0xd89a('0x4e')];return _0x27b9d8;};exports['agentReadyId']=function(_0x403067){var _0x4542fb=[];for(var _0xef1c1e in _0x403067){if(_0x403067[_0xd89a('0x33')](_0xef1c1e)){if(!_[_0xd89a('0x17')](_0x403067[_0xef1c1e])&&_0x403067[_0xef1c1e][_0xd89a('0x38')]==='not_inuse'&&_0x403067[_0xef1c1e][_0xd89a('0x65')]==='reachable'){_0x4542fb[_0xd89a('0x66')](_0x403067[_0xef1c1e]['id']);}}}return _0x4542fb;};exports['getDiff']=function(_0x3239a2){var _0x57f5cf=moment()[_0xd89a('0x7')](0x0);var _0x4ec416=moment(_0x3239a2)[_0xd89a('0x7')](0x0);return _0x57f5cf[_0xd89a('0x8')](_0x4ec416,_0xd89a('0x9'));};exports[_0xd89a('0x67')]=function(_0x3b6720){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b6720[_0xd89a('0x1b')],'ListId':_0x3b6720[_0xd89a('0x5b')],'VoiceQueueId':_0x3b6720[_0xd89a('0x1d')]||undefined,'CampaignId':_0x3b6720['CampaignId']||undefined};};exports[_0xd89a('0x68')]=function(_0x1b4461){if(_0x1b4461===_0xd89a('0x4e')||_0x1b4461===_0xd89a('0x69')||_0x1b4461===_0xd89a('0x60')||_0x1b4461===_0xd89a('0x6a')||_0x1b4461===_0xd89a('0x6b')||_0x1b4461==='dialAnswer'||_0x1b4461===_0xd89a('0x6c')||_0x1b4461==='channelAgent'||_0x1b4461===_0xd89a('0x19')||_0x1b4461===_0xd89a('0x58')||_0x1b4461===_0xd89a('0x1a')||_0x1b4461===_0xd89a('0x59')||_0x1b4461===_0xd89a('0x50')||_0x1b4461==='countcongestionretry'||_0x1b4461===_0xd89a('0x52')||_0x1b4461===_0xd89a('0x6d')||_0x1b4461===_0xd89a('0x6e')||_0x1b4461==='callbackuniqueid'||_0x1b4461===_0xd89a('0x6f')||_0x1b4461===_0xd89a('0x70')||_0x1b4461===_0xd89a('0x1b')||_0x1b4461===_0xd89a('0x5b')||_0x1b4461===_0xd89a('0x3f')||_0x1b4461===_0xd89a('0x1d')||_0x1b4461===_0xd89a('0x71')||_0x1b4461===_0xd89a('0x72')||_0x1b4461===_0xd89a('0x73')||_0x1b4461===_0xd89a('0x74')||_0x1b4461===_0xd89a('0x75')||_0x1b4461==='xmd-dialurl'||_0x1b4461===_0xd89a('0x76')||_0x1b4461==='xmd-dialoptions'||_0x1b4461==='xmd-dialid'||_0x1b4461==='xmd-dialchannel'||_0x1b4461===_0xd89a('0x77')||_0x1b4461===_0xd89a('0x78')||_0x1b4461===_0xd89a('0x79')||_0x1b4461===_0xd89a('0x7a')||_0x1b4461===_0xd89a('0x7b')||_0x1b4461===_0xd89a('0x7c')||_0x1b4461===_0xd89a('0x7d')||_0x1b4461==='rtpaudioqosjitter'||_0x1b4461===_0xd89a('0x7e')||_0x1b4461===_0xd89a('0x7f')||_0x1b4461===_0xd89a('0x80')||_0x1b4461===_0xd89a('0x81')||_0x1b4461==='rtpaudioqosrttbridged'||_0x1b4461===_0xd89a('0x7c')||_0x1b4461===_0xd89a('0x7d')||_0x1b4461===_0xd89a('0x82')||_0x1b4461===_0xd89a('0x7e')||_0x1b4461===_0xd89a('0x7f')||_0x1b4461==='rtpaudioqoslossbridged'||_0x1b4461==='rtpaudioqosrtt'||_0x1b4461==='rtpaudioqosrttbridged'||_0x1b4461===_0xd89a('0x83')||_0x1b4461==='bridgepvtcallid'||_0x1b4461===_0xd89a('0x38')||_0x1b4461===_0xd89a('0x39')){return![];}return!![];};exports[_0xd89a('0x84')]=function(_0x1499ef,_0x56dcb0){var _0x2653e0,_0x299c9f,_0x13fa11;if(_0x56dcb0<=0x0){_0x56dcb0=0x1;}_0x2653e0=new RegExp(_0xd89a('0x85')+_0x56dcb0+'}$');_0x299c9f=Math[_0xd89a('0x86')](0xa,_0x56dcb0-0x1);_0x13fa11=Math[_0xd89a('0x86')](0xa,_0x56dcb0)-0x1;return util['format']('%s',_[_0xd89a('0x87')](_0x1499ef,_0x2653e0,_[_0xd89a('0x88')](_0x299c9f,_0x13fa11)));};exports[_0xd89a('0x89')]=function(_0x20a7a4){var _0x1e0c2d=_0x20a7a4[_0xd89a('0x8a')](/"(.*?)"/);return _0x1e0c2d?_0x1e0c2d[0x1]:_0x20a7a4;};exports[_0xd89a('0x8b')]=function(_0x283bc2){var _0x3f85ef=_0x283bc2[_0xd89a('0x8a')](/<(.*?)>/);return _0x3f85ef?_0x3f85ef[0x1]:_0x283bc2;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6711760..6c046f6 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 _0x3538=['queuepause','voicequeuechannel','voicequeuechannelhangup','string','number','boolean'];(function(_0x58da9a,_0x10001e){var _0x4b7503=function(_0x5d3f18){while(--_0x5d3f18){_0x58da9a['push'](_0x58da9a['shift']());}};_0x4b7503(++_0x10001e);}(_0x3538,0xbd));var _0x8353=function(_0x2f3311,_0x29e0d6){_0x2f3311=_0x2f3311-0x0;var _0xecb735=_0x3538[_0x2f3311];return _0xecb735;};'use strict';exports['queueadd']={'queue':{'type':_0x8353('0x0'),'required':!![]},'interface':{'type':_0x8353('0x0'),'required':!![]},'membername':{'type':_0x8353('0x0'),'required':!![]},'penalty':{'type':_0x8353('0x1'),'required':![]},'paused':{'type':_0x8353('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x8353('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x8353('0x3')]={'interface':{'type':_0x8353('0x0'),'required':!![]},'paused':{'type':_0x8353('0x2')},'reason':{'type':_0x8353('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x8353('0x4')]={'uniqueid':{'type':_0x8353('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8353('0x0'),'required':!![]},'filename':{'type':_0x8353('0x0')},'format':{'type':_0x8353('0x0')},'mixmonitorid':{'type':_0x8353('0x0')}};exports[_0x8353('0x5')]={'uniqueid':{'type':_0x8353('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8353('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xe91d=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x6347ca,_0x5c345e){var _0x193c95=function(_0x29b449){while(--_0x29b449){_0x6347ca['push'](_0x6347ca['shift']());}};_0x193c95(++_0x5c345e);}(_0xe91d,0x1b4));var _0xde91=function(_0x1ec7b0,_0x2eb52a){_0x1ec7b0=_0x1ec7b0-0x0;var _0x5aff54=_0xe91d[_0x1ec7b0];return _0x5aff54;};'use strict';exports[_0xde91('0x0')]={'queue':{'type':_0xde91('0x1'),'required':!![]},'interface':{'type':_0xde91('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xde91('0x2'),'required':![]},'paused':{'type':_0xde91('0x3'),'required':![]}};exports[_0xde91('0x4')]={'queue':{'type':_0xde91('0x1'),'required':!![]},'interface':{'type':_0xde91('0x1'),'required':!![]}};exports[_0xde91('0x5')]={'interface':{'type':_0xde91('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xde91('0x1'),'required':![]}};exports[_0xde91('0x6')]={'module':{'type':'string','required':![]}};exports[_0xde91('0x7')]={'uniqueid':{'type':_0xde91('0x1'),'required':!![]}};exports[_0xde91('0x8')]={'uniqueid':{'type':_0xde91('0x1'),'required':!![]},'filename':{'type':_0xde91('0x1')},'format':{'type':_0xde91('0x1')},'mixmonitorid':{'type':_0xde91('0x1')}};exports[_0xde91('0x9')]={'uniqueid':{'type':_0xde91('0x1'),'required':!![]}};exports[_0xde91('0xa')]={'uniqueid':{'type':_0xde91('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xde91('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 25a9b9b..9213506 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 _0xa0a7=['../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','initAgents','length','mergeFromDatabase','initTelephones','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','abandoned','diff','queuecallerexitAt','queuecallerjoinAt','seconds','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','util','lodash','moment','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount'];(function(_0x32e786,_0x4f8a4d){var _0x13ab55=function(_0x3fe0fa){while(--_0x3fe0fa){_0x32e786['push'](_0x32e786['shift']());}};_0x13ab55(++_0x4f8a4d);}(_0xa0a7,0x1a2));var _0x7a0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0a7[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var util=require(_0x7a0a('0x0'));var _=require(_0x7a0a('0x1'));var moment=require(_0x7a0a('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x7a0a('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x7a0a('0x4'));var Trigger=require(_0x7a0a('0x5'));var Template=require(_0x7a0a('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x7a0a('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x7a0a('0x8'));var FreshdeskAccount=require(_0x7a0a('0x9'));var SugarcrmAccount=require(_0x7a0a('0xa'));var ZohoAccount=require(_0x7a0a('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x7a0a('0xc'));var ServicenowAccount=require(_0x7a0a('0xd'));var Dynamics365Account=require(_0x7a0a('0xe'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x7a0a('0xf'));var Realtime=function(){this[_0x7a0a('0x10')]={};this[_0x7a0a('0x11')]={};this[_0x7a0a('0x12')]={};this[_0x7a0a('0x13')]={};this['triggers']={};this[_0x7a0a('0x14')]={};this[_0x7a0a('0x15')]={};this[_0x7a0a('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7a0a('0x17')]={};this[_0x7a0a('0x18')]={};this[_0x7a0a('0x19')]={};this[_0x7a0a('0x1a')]={};this['timers']={};this[_0x7a0a('0x1b')]={};this[_0x7a0a('0x1c')]={};this[_0x7a0a('0x1d')]={};this[_0x7a0a('0x1e')]={};this[_0x7a0a('0x1f')]={};this[_0x7a0a('0x20')]={};this[_0x7a0a('0x21')]={};this['vtigerAccounts']={};this[_0x7a0a('0x22')]={};this[_0x7a0a('0x23')]={};this['freshsalesAccounts']={};this[_0x7a0a('0x24')]={};};function freeIsNotKey(_0x1eb349,_0x45e8e0,_0xa03752){var _0x5c4417=_['mapKeys'](_0x1eb349,function(_0x250463,_0xb7bb2d){return _0x250463[_0xa03752];});for(var _0x8e8673 in _0x45e8e0){if(_0x45e8e0[_0x7a0a('0x25')](_0x8e8673)){if(!_0x5c4417[_0x8e8673]){delete _0x45e8e0[_0x8e8673];}}}}function freeIsNotKeySip(_0x2ce005,_0x383ae9){var _0x1dcb4e=_[_0x7a0a('0x26')](_0x2ce005,function(_0x3e2f53,_0x4ce145){return util[_0x7a0a('0x27')](_0x7a0a('0x28'),_0x3e2f53[_0x7a0a('0x29')]);});for(var _0x178bda in _0x383ae9){if(_0x383ae9[_0x7a0a('0x25')](_0x178bda)){if(!_0x1dcb4e[_0x178bda]){delete _0x383ae9[_0x178bda];}}}}function freeIsNotKeyAgent(_0x51ff16,_0x4fde2a){var _0x32d93=_[_0x7a0a('0x26')](_0x51ff16,function(_0x556e34,_0x174e45){var _0x400dd2=_[_0x7a0a('0x2a')](_0x556e34[_0x7a0a('0x2b')])?util[_0x7a0a('0x27')](_0x7a0a('0x28'),_0x556e34[_0x7a0a('0x29')]):_0x556e34[_0x7a0a('0x2b')];return _0x400dd2;});for(var _0x4c0332 in _0x4fde2a){if(_0x4fde2a[_0x7a0a('0x25')](_0x4c0332)){if(!_0x32d93[_0x4c0332]){delete _0x4fde2a[_0x4c0332];}}}}function clearVoiceCallReports(_0x3732c9){_0x3732c9[_0x7a0a('0x2c')]=0x0;_0x3732c9[_0x7a0a('0x2d')]=0x0;_0x3732c9[_0x7a0a('0x2e')]=0x0;_0x3732c9[_0x7a0a('0x2f')]=0x0;_0x3732c9['sumBillable']=0x0;}function clearCampaigns(_0x492587){if(!_[_0x7a0a('0x30')](_0x492587)){for(var _0x24b66a in _0x492587){if(_0x492587['hasOwnProperty'](_0x24b66a)){_0x492587[_0x24b66a][_0x7a0a('0x31')]=0x0;_0x492587[_0x24b66a][_0x7a0a('0x32')]=0x0;}}}}function clearVoiceQueues(_0x2fe633){if(!_[_0x7a0a('0x30')](_0x2fe633)){for(var _0x542ba4 in _0x2fe633){if(_0x2fe633[_0x7a0a('0x25')](_0x542ba4)){_0x2fe633[_0x542ba4][_0x7a0a('0x2c')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x2d')]=0x0;_0x2fe633[_0x542ba4]['unmanaged']=0x0;_0x2fe633[_0x542ba4]['abandoned']=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x2e')]=0x0;_0x2fe633[_0x542ba4]['sumDuration']=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x33')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x34')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x35')]=0x0;_0x2fe633[_0x542ba4]['outboundBusyCallsDay']=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x36')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x37')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x38')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x39')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3a')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3b')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3c')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3d')]=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3e')]=0x0;_0x2fe633[_0x542ba4]['outboundAnswerAgiCallsDay']=0x0;_0x2fe633[_0x542ba4]['outboundAnswerCallsDay']=0x0;_0x2fe633[_0x542ba4][_0x7a0a('0x3f')]=!![];}}}}Realtime[_0x7a0a('0x40')]['mergeFromDatabase']=function(_0x5a8866,_0x37c31a){for(var _0x14c71b in _0x37c31a){if(_0x5a8866[_0x7a0a('0x25')](_0x14c71b)){_0x5a8866[_0x14c71b]=_0x37c31a[_0x14c71b];}}};Realtime[_0x7a0a('0x40')][_0x7a0a('0x41')]=function(){var _0x117c74=this;return function(_0x14bab9){if(_0x14bab9){freeIsNotKeyAgent(_0x14bab9,_0x117c74['agents']);for(var _0x9d4c85=0x0,_0x55cb26={},_0x5178b7={};_0x9d4c85<_0x14bab9[_0x7a0a('0x42')];_0x9d4c85+=0x1){_0x55cb26=_0x14bab9[_0x9d4c85];var _0x216ac5=_[_0x7a0a('0x2a')](_0x55cb26[_0x7a0a('0x2b')])?util['format'](_0x7a0a('0x28'),_0x55cb26[_0x7a0a('0x29')]):_0x55cb26[_0x7a0a('0x2b')];if(_['isUndefined'](_0x117c74[_0x7a0a('0x10')][_0x216ac5])){_0x117c74['agents'][_0x216ac5]=new Agent(_0x55cb26);}else{_0x117c74[_0x7a0a('0x43')](_0x117c74[_0x7a0a('0x10')][_0x216ac5],_0x55cb26);}}}return _0x117c74[_0x7a0a('0x10')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x44')]=function(){var _0x13c121=this;return function(_0x541189){if(_0x541189){freeIsNotKeySip(_0x541189,_0x13c121['telephones']);for(var _0x4c9e93=0x0,_0x271e54={},_0x17c061={};_0x4c9e93<_0x541189[_0x7a0a('0x42')];_0x4c9e93+=0x1){_0x271e54=_0x541189[_0x4c9e93];if(_[_0x7a0a('0x45')](_0x13c121['telephones'][util['format'](_0x7a0a('0x28'),_0x271e54[_0x7a0a('0x29')])])){_0x13c121[_0x7a0a('0x11')][util[_0x7a0a('0x27')]('SIP/%s',_0x271e54[_0x7a0a('0x29')])]=new Telephone(_0x271e54);}else{_0x13c121[_0x7a0a('0x43')](_0x13c121[_0x7a0a('0x11')][util['format'](_0x7a0a('0x28'),_0x271e54[_0x7a0a('0x29')])],_0x271e54);}}}return _0x13c121[_0x7a0a('0x11')];};};Realtime['prototype'][_0x7a0a('0x46')]=function(){var _0x382ed5=this;return function(_0x32ce2d){if(_0x32ce2d){freeIsNotKeySip(_0x32ce2d,_0x382ed5[_0x7a0a('0x12')]);for(var _0x1e26ed=0x0,_0x17c9a1={},_0x8b2eda={};_0x1e26ed<_0x32ce2d[_0x7a0a('0x42')];_0x1e26ed+=0x1){_0x17c9a1=_0x32ce2d[_0x1e26ed];if(_[_0x7a0a('0x45')](_0x382ed5[_0x7a0a('0x12')][util['format'](_0x7a0a('0x28'),_0x17c9a1[_0x7a0a('0x29')])])){_0x382ed5[_0x7a0a('0x12')][util[_0x7a0a('0x27')](_0x7a0a('0x28'),_0x17c9a1['name'])]=new Trunk(_0x17c9a1);}else{_0x382ed5[_0x7a0a('0x43')](_0x382ed5['trunks'][util['format'](_0x7a0a('0x28'),_0x17c9a1['name'])],_0x17c9a1);}}}return _0x382ed5[_0x7a0a('0x12')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x47')]=function(){var _0x57d035=this;return function(_0x33510f){if(_0x33510f){freeIsNotKey(_0x33510f,_0x57d035[_0x7a0a('0x13')],_0x7a0a('0x29'));for(var _0x557b53=0x0,_0x4ab33e={},_0x2cc649={};_0x557b53<_0x33510f['length'];_0x557b53+=0x1){_0x4ab33e=_0x33510f[_0x557b53];if(_[_0x7a0a('0x45')](_0x57d035[_0x7a0a('0x13')][_0x4ab33e[_0x7a0a('0x29')]])){_0x57d035['voiceQueues'][_0x4ab33e['name']]=new VoiceQueue(_0x4ab33e);}else{_0x57d035['mergeFromDatabase'](_0x57d035[_0x7a0a('0x13')][_0x4ab33e[_0x7a0a('0x29')]],_0x4ab33e);}}}return _0x57d035['voiceQueues'];};};Realtime['prototype'][_0x7a0a('0x48')]=function(){var _0x29297b=this;return function(_0x2c0ded){if(_0x2c0ded){freeIsNotKey(_0x2c0ded,_0x29297b[_0x7a0a('0x49')],'id');for(var _0xafe8b6=0x0,_0x7de5f={},_0xb60a5c={};_0xafe8b6<_0x2c0ded[_0x7a0a('0x42')];_0xafe8b6+=0x1){_0x7de5f=_0x2c0ded[_0xafe8b6];if(_['isUndefined'](_0x29297b[_0x7a0a('0x49')][_0x7de5f['id']])){_0x29297b[_0x7a0a('0x49')][_0x7de5f['id']]=new Trigger(_0x7de5f);}else{_0x29297b[_0x7a0a('0x43')](_0x29297b[_0x7a0a('0x49')][_0x7de5f['id']],_0x7de5f);}}}return _0x29297b[_0x7a0a('0x49')];};};Realtime[_0x7a0a('0x40')]['initTemplates']=function(){var _0xcb1904=this;return function(_0x17870a){if(_0x17870a){freeIsNotKey(_0x17870a,_0xcb1904[_0x7a0a('0x15')],'id');for(var _0x32d3ad=0x0,_0x523a02={},_0x2da5ce={};_0x32d3ad<_0x17870a[_0x7a0a('0x42')];_0x32d3ad+=0x1){_0x523a02=_0x17870a[_0x32d3ad];if(_[_0x7a0a('0x45')](_0xcb1904[_0x7a0a('0x15')][_0x523a02['id']])){_0xcb1904['templates'][_0x523a02['id']]=new Template(_0x523a02);}else{_0xcb1904[_0x7a0a('0x43')](_0xcb1904[_0x7a0a('0x15')][_0x523a02['id']],_0x523a02);}}}return _0xcb1904[_0x7a0a('0x15')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x4a')]=function(){var _0x31232b=this;return function(_0x443556){if(_0x443556){freeIsNotKey(_0x443556,_0x31232b['zendeskAccounts'],'id');for(var _0x4646e6=0x0,_0x34c253={},_0x1f8b11={};_0x4646e6<_0x443556[_0x7a0a('0x42')];_0x4646e6+=0x1){_0x34c253=_0x443556[_0x4646e6];if(_[_0x7a0a('0x45')](_0x31232b[_0x7a0a('0x1c')][_0x34c253['id']])){_0x31232b[_0x7a0a('0x1c')][_0x34c253['id']]=new ZendeskAccount(_0x34c253);}else{_0x31232b[_0x7a0a('0x43')](_0x31232b[_0x7a0a('0x1c')][_0x34c253['id']],_0x34c253);}}}return _0x31232b['zendeskAccounts'];};};Realtime[_0x7a0a('0x40')]['initSalesforceAccounts']=function(){var _0x5ac345=this;return function(_0xecb994){if(_0xecb994){freeIsNotKey(_0xecb994,_0x5ac345[_0x7a0a('0x1d')],'id');for(var _0x246a10=0x0,_0x2eac21={},_0x46ef19={};_0x246a10<_0xecb994[_0x7a0a('0x42')];_0x246a10+=0x1){_0x2eac21=_0xecb994[_0x246a10];if(_[_0x7a0a('0x45')](_0x5ac345[_0x7a0a('0x1d')][_0x2eac21['id']])){_0x5ac345[_0x7a0a('0x1d')][_0x2eac21['id']]=new SalesforceAccount(_0x2eac21);}else{_0x5ac345['mergeFromDatabase'](_0x5ac345[_0x7a0a('0x1d')][_0x2eac21['id']],_0x2eac21);}}}return _0x5ac345[_0x7a0a('0x1d')];};};Realtime['prototype'][_0x7a0a('0x4b')]=function(){var _0x2a08cf=this;return function(_0xbac4f){if(_0xbac4f){freeIsNotKey(_0xbac4f,_0x2a08cf[_0x7a0a('0x1f')],'id');for(var _0x4fae84=0x0,_0x4ff6f4={},_0x74a566={};_0x4fae84<_0xbac4f[_0x7a0a('0x42')];_0x4fae84+=0x1){_0x4ff6f4=_0xbac4f[_0x4fae84];if(_[_0x7a0a('0x45')](_0x2a08cf[_0x7a0a('0x1f')][_0x4ff6f4['id']])){_0x2a08cf[_0x7a0a('0x1f')][_0x4ff6f4['id']]=new FreshdeskAccount(_0x4ff6f4);}else{_0x2a08cf['mergeFromDatabase'](_0x2a08cf[_0x7a0a('0x1f')][_0x4ff6f4['id']],_0x4ff6f4);}}}return _0x2a08cf[_0x7a0a('0x1f')];};};Realtime[_0x7a0a('0x40')]['initZohoAccounts']=function(){var _0x2eaa02=this;return function(_0x37b7dd){if(_0x37b7dd){freeIsNotKey(_0x37b7dd,_0x2eaa02['zohoAccounts'],'id');for(var _0x23a7b2=0x0,_0x2d81a1={},_0x29aced={};_0x23a7b2<_0x37b7dd[_0x7a0a('0x42')];_0x23a7b2+=0x1){_0x2d81a1=_0x37b7dd[_0x23a7b2];if(_['isUndefined'](_0x2eaa02[_0x7a0a('0x20')][_0x2d81a1['id']])){_0x2eaa02['zohoAccounts'][_0x2d81a1['id']]=new ZohoAccount(_0x2d81a1);}else{_0x2eaa02['mergeFromDatabase'](_0x2eaa02[_0x7a0a('0x20')][_0x2d81a1['id']],_0x2d81a1);}}}return _0x2eaa02[_0x7a0a('0x20')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x4c')]=function(){var _0x2240b6=this;return function(_0x89afb3){if(_0x89afb3){freeIsNotKey(_0x89afb3,_0x2240b6[_0x7a0a('0x21')],'id');for(var _0x58db49=0x0,_0x30e59b={},_0x47dc63={};_0x58db49<_0x89afb3['length'];_0x58db49+=0x1){_0x30e59b=_0x89afb3[_0x58db49];if(_[_0x7a0a('0x45')](_0x2240b6[_0x7a0a('0x21')][_0x30e59b['id']])){_0x2240b6[_0x7a0a('0x21')][_0x30e59b['id']]=new DeskAccount(_0x30e59b);}else{_0x2240b6['mergeFromDatabase'](_0x2240b6[_0x7a0a('0x21')][_0x30e59b['id']],_0x30e59b);}}}return _0x2240b6[_0x7a0a('0x21')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x4d')]=function(){var _0xba45bb=this;return function(_0x2ef4fe){if(_0x2ef4fe){freeIsNotKey(_0x2ef4fe,_0xba45bb[_0x7a0a('0x1e')],'id');for(var _0x4f46d0=0x0,_0xd19602={},_0x35e560={};_0x4f46d0<_0x2ef4fe[_0x7a0a('0x42')];_0x4f46d0+=0x1){_0xd19602=_0x2ef4fe[_0x4f46d0];if(_['isUndefined'](_0xba45bb[_0x7a0a('0x1e')][_0xd19602['id']])){_0xba45bb['sugarcrmAccounts'][_0xd19602['id']]=new SugarcrmAccount(_0xd19602);}else{_0xba45bb[_0x7a0a('0x43')](_0xba45bb['sugarcrmAccounts'][_0xd19602['id']],_0xd19602);}}}return _0xba45bb[_0x7a0a('0x1e')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x4e')]=function(){var _0x121f48=this;return function(_0x1a6d71){if(_0x1a6d71){freeIsNotKey(_0x1a6d71,_0x121f48[_0x7a0a('0x4f')],'id');for(var _0x5e3787=0x0,_0x1688f9={},_0x1ae55a={};_0x5e3787<_0x1a6d71['length'];_0x5e3787+=0x1){_0x1688f9=_0x1a6d71[_0x5e3787];if(_['isUndefined'](_0x121f48[_0x7a0a('0x4f')][_0x1688f9['id']])){_0x121f48[_0x7a0a('0x4f')][_0x1688f9['id']]=new VtigerAccount(_0x1688f9);}else{_0x121f48['mergeFromDatabase'](_0x121f48[_0x7a0a('0x4f')][_0x1688f9['id']],_0x1688f9);}}}return _0x121f48['vtigerAccounts'];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x50')]=function(){var _0x322787=this;return function(_0x7c906){if(_0x7c906){freeIsNotKey(_0x7c906,_0x322787['servicenowAccounts'],'id');for(var _0x52a922=0x0,_0x52fbdb={},_0x83df75={};_0x52a922<_0x7c906[_0x7a0a('0x42')];_0x52a922+=0x1){_0x52fbdb=_0x7c906[_0x52a922];if(_[_0x7a0a('0x45')](_0x322787[_0x7a0a('0x22')][_0x52fbdb['id']])){_0x322787['servicenowAccounts'][_0x52fbdb['id']]=new ServicenowAccount(_0x52fbdb);}else{_0x322787[_0x7a0a('0x43')](_0x322787[_0x7a0a('0x22')][_0x52fbdb['id']],_0x52fbdb);}}}return _0x322787[_0x7a0a('0x22')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x51')]=function(){var _0x3dfc96=this;return function(_0x21e968){if(_0x21e968){freeIsNotKey(_0x21e968,_0x3dfc96['dynamics365Accounts'],'id');for(var _0x4bbc0f=0x0,_0x59d4a9={},_0x4ad39d={};_0x4bbc0f<_0x21e968[_0x7a0a('0x42')];_0x4bbc0f+=0x1){_0x59d4a9=_0x21e968[_0x4bbc0f];if(_[_0x7a0a('0x45')](_0x3dfc96[_0x7a0a('0x23')][_0x59d4a9['id']])){_0x3dfc96[_0x7a0a('0x23')][_0x59d4a9['id']]=new Dynamics365Account(_0x59d4a9);}else{_0x3dfc96['mergeFromDatabase'](_0x3dfc96[_0x7a0a('0x23')][_0x59d4a9['id']],_0x59d4a9);}}}return _0x3dfc96[_0x7a0a('0x23')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x52')]=function(){var _0x11148d=this;return function(_0x24785a){if(_0x24785a){freeIsNotKey(_0x24785a,_0x11148d[_0x7a0a('0x53')],'id');for(var _0x573c4c=0x0,_0xf0aaf7={},_0x1508e8={};_0x573c4c<_0x24785a[_0x7a0a('0x42')];_0x573c4c+=0x1){_0xf0aaf7=_0x24785a[_0x573c4c];if(_['isUndefined'](_0x11148d['freshsalesAccounts'][_0xf0aaf7['id']])){_0x11148d[_0x7a0a('0x53')][_0xf0aaf7['id']]=new FreshsalesAccount(_0xf0aaf7);}else{_0x11148d[_0x7a0a('0x43')](_0x11148d['freshsalesAccounts'][_0xf0aaf7['id']],_0xf0aaf7);}}}return _0x11148d[_0x7a0a('0x53')];};};Realtime['prototype'][_0x7a0a('0x54')]=function(){var _0x5451de=this;return function(_0x298d84){for(var _0x1e95fe=0x0;_0x1e95fe<_0x298d84['length'];_0x1e95fe+=0x1){_['merge'](_0x5451de[_0x7a0a('0x13')][_0x298d84[_0x1e95fe][_0x7a0a('0x29')]],_0x298d84[_0x1e95fe]);}return _0x5451de[_0x7a0a('0x13')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x55')]=function(){var _0x3e36bb=this;return function(_0x53f1f4){clearVoiceQueues(_0x3e36bb['voiceQueues']);if(_0x53f1f4){_0x53f1f4=_[_0x7a0a('0x56')](_0x53f1f4,_0x7a0a('0x57'));for(var _0x456865 in _0x53f1f4){if(_0x53f1f4['hasOwnProperty'](_0x456865)){var _0x42bab3={};for(var _0x112b92=0x0;_0x112b92<_0x53f1f4[_0x456865][_0x7a0a('0x42')];_0x112b92+=0x1){var _0x29c61e=_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x58')];if(_0x3e36bb[_0x7a0a('0x13')][_0x29c61e]){if(_0x53f1f4[_0x456865][_0x112b92]['queuecallerexit']){_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x59')]+=0x1;}if(_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x5a')]){_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x5b')]+=0x1;}_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x2e')]+=moment(_0x53f1f4[_0x456865][_0x112b92]['queuecallerleaveAt'])[_0x7a0a('0x5c')](moment(_0x53f1f4[_0x456865][_0x112b92]['queuecallerjoinAt']),'seconds')||0x0;if(_0x112b92===_0x53f1f4[_0x456865][_0x7a0a('0x42')]-0x1){_0x3e36bb['voiceQueues'][_0x29c61e][_0x7a0a('0x2f')]+=moment(_0x53f1f4[_0x456865][_0x112b92]['queuecallercompleteAt']||_0x53f1f4[_0x456865][_0x112b92]['queuecallerabandonAt']||_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x5d')])[_0x7a0a('0x5c')](moment(_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x5e')]),_0x7a0a('0x5f'))||0x0;_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x2c')]+=0x1;if(_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x60')]){_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x2d')]+=0x1;_0x3e36bb[_0x7a0a('0x13')][_0x29c61e]['sumBillable']+=moment(_0x53f1f4[_0x456865][_0x112b92][_0x7a0a('0x61')])[_0x7a0a('0x5c')](moment(_0x53f1f4[_0x456865][_0x112b92]['queuecallerleaveAt']),_0x7a0a('0x5f'))||0x0;}}else{_0x3e36bb[_0x7a0a('0x13')][_0x29c61e][_0x7a0a('0x2f')]+=_0x3e36bb[_0x7a0a('0x13')][_0x29c61e]['sumHoldTime']||0x0;}}}}}}return _0x3e36bb[_0x7a0a('0x13')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x62')]=function(){var _0x39e5f4=this;return function(_0x31563b){clearVoiceCallReports(_0x39e5f4[_0x7a0a('0x16')]);if(_0x31563b){for(var _0x36edcd=0x0;_0x36edcd<_0x31563b['length'];_0x36edcd+=0x1){_0x39e5f4[_0x7a0a('0x16')][_0x7a0a('0x2c')]+=0x1;_0x39e5f4['outbound']['sumDuration']+=_0x31563b[_0x36edcd][_0x7a0a('0x63')];if(_0x31563b[_0x36edcd][_0x7a0a('0x64')]==='ANSWERED'){_0x39e5f4[_0x7a0a('0x16')]['answered']+=0x1;_0x39e5f4[_0x7a0a('0x16')][_0x7a0a('0x2e')]+=_0x31563b[_0x36edcd][_0x7a0a('0x63')]-_0x31563b[_0x36edcd][_0x7a0a('0x65')]||0x0;_0x39e5f4[_0x7a0a('0x16')][_0x7a0a('0x33')]+=_0x31563b[_0x36edcd][_0x7a0a('0x65')];}}}return _0x39e5f4[_0x7a0a('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x29fb49=this;return function(_0x123710){if(_0x123710){freeIsNotKey(_0x123710,_0x29fb49[_0x7a0a('0x14')],_0x7a0a('0x29'));for(var _0x5a694f=0x0,_0x549317={};_0x5a694f<_0x123710[_0x7a0a('0x42')];_0x5a694f+=0x1){_0x549317=_0x123710[_0x5a694f];if(_[_0x7a0a('0x45')](_0x29fb49[_0x7a0a('0x14')][_0x549317[_0x7a0a('0x29')]])){_0x29fb49['campaigns'][_0x549317['name']]=new Campaign(_0x549317);}else{_0x29fb49[_0x7a0a('0x43')](_0x29fb49[_0x7a0a('0x14')][_0x549317['name']],_0x549317);_0x29fb49[_0x7a0a('0x14')][_0x549317[_0x7a0a('0x29')]]['dialQueueProject']=_0x549317['SquareProject']?_0x549317[_0x7a0a('0x66')][_0x7a0a('0x29')]:undefined;}}}return _0x29fb49[_0x7a0a('0x14')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x67')]=function(){var _0x5927da=this;return function(_0x2fadb2){if(_0x2fadb2){freeIsNotKey(_0x2fadb2,_0x5927da[_0x7a0a('0x17')],'id');for(var _0x24a16b=0x0,_0x387869={};_0x24a16b<_0x2fadb2[_0x7a0a('0x42')];_0x24a16b+=0x1){_0x387869=_0x2fadb2[_0x24a16b];if(_[_0x7a0a('0x45')](_0x5927da[_0x7a0a('0x17')][_0x387869['id']])){_0x5927da['voiceExtensions'][_0x387869['id']]=new VoiceExtension(_0x387869);}else{_0x5927da[_0x7a0a('0x43')](_0x5927da[_0x7a0a('0x17')][_0x387869['id']],_0x387869);}}}return _0x5927da[_0x7a0a('0x17')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x68')]=function(){var _0x584e24=this;return function(_0x504adc){clearCampaigns(_0x584e24[_0x7a0a('0x14')]);for(var _0x27e847=0x0;_0x27e847<_0x504adc['length'];_0x27e847+=0x1){_[_0x7a0a('0x69')](_0x584e24[_0x7a0a('0x14')][_0x504adc[_0x27e847][_0x7a0a('0x29')]],_0x504adc[_0x27e847]);}return _0x584e24[_0x7a0a('0x14')];};};Realtime[_0x7a0a('0x40')][_0x7a0a('0x6a')]=function(){var _0x8a1fcc=this;return function(_0x51c6af){if(_0x51c6af){freeIsNotKey(_0x51c6af,_0x8a1fcc[_0x7a0a('0x24')],'id');for(var _0x34139d=0x0,_0x4de17f={},_0x3a88b1={};_0x34139d<_0x51c6af[_0x7a0a('0x42')];_0x34139d+=0x1){_0x4de17f=_0x51c6af[_0x34139d];if(_['isUndefined'](_0x8a1fcc[_0x7a0a('0x24')][_0x4de17f['id']])){_0x8a1fcc[_0x7a0a('0x24')][_0x4de17f['id']]=new FaxAccount(_0x4de17f);}else{_0x8a1fcc[_0x7a0a('0x43')](_0x8a1fcc[_0x7a0a('0x24')][_0x4de17f['id']],_0x4de17f);}}}return _0x8a1fcc['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x85d3=['initTelephones','telephones','length','initTrunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initZohoAccounts','deskAccounts','initVtigerAccounts','vtigerAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','trunks','voiceQueues','campaigns','templates','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','isNil','format','SIP/%s','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','prototype','initAgents','name','isUndefined','mergeFromDatabase'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x85d3,0x95));var _0x385d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x85d3[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x385d('0x2'));var Telephone=require(_0x385d('0x3'));var Trunk=require(_0x385d('0x4'));var VoiceQueue=require(_0x385d('0x5'));var Trigger=require(_0x385d('0x6'));var Template=require(_0x385d('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x385d('0x8'));var ZendeskAccount=require(_0x385d('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x385d('0xa'));var SugarcrmAccount=require(_0x385d('0xb'));var ZohoAccount=require(_0x385d('0xc'));var DeskAccount=require(_0x385d('0xd'));var VtigerAccount=require(_0x385d('0xe'));var ServicenowAccount=require(_0x385d('0xf'));var Dynamics365Account=require(_0x385d('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x385d('0x11'));var Realtime=function(){this[_0x385d('0x12')]={};this['telephones']={};this[_0x385d('0x13')]={};this[_0x385d('0x14')]={};this['triggers']={};this[_0x385d('0x15')]={};this[_0x385d('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x385d('0x17')]={};this[_0x385d('0x18')]={};this[_0x385d('0x19')]={};this[_0x385d('0x1a')]={};this[_0x385d('0x1b')]={};this[_0x385d('0x1c')]={};this[_0x385d('0x1d')]={};this[_0x385d('0x1e')]={};this[_0x385d('0x1f')]={};this[_0x385d('0x20')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x385d('0x21')]={};this[_0x385d('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x51d164,_0xf85f63,_0x29c163){var _0x44a3c2=_['mapKeys'](_0x51d164,function(_0x57b623,_0x25d2a3){return _0x57b623[_0x29c163];});for(var _0x1eed4d in _0xf85f63){if(_0xf85f63[_0x385d('0x23')](_0x1eed4d)){if(!_0x44a3c2[_0x1eed4d]){delete _0xf85f63[_0x1eed4d];}}}}function freeIsNotKeySip(_0xe3a374,_0x5cb8a1){var _0x3728ab=_[_0x385d('0x24')](_0xe3a374,function(_0x162c2a,_0x3df790){return util['format']('SIP/%s',_0x162c2a['name']);});for(var _0x3e3038 in _0x5cb8a1){if(_0x5cb8a1[_0x385d('0x23')](_0x3e3038)){if(!_0x3728ab[_0x3e3038]){delete _0x5cb8a1[_0x3e3038];}}}}function freeIsNotKeyAgent(_0x18adba,_0x6bd1e6){var _0x55164a=_[_0x385d('0x24')](_0x18adba,function(_0x207184,_0x3246aa){var _0x42bb86=_[_0x385d('0x25')](_0x207184['interface'])?util[_0x385d('0x26')](_0x385d('0x27'),_0x207184['name']):_0x207184[_0x385d('0x28')];return _0x42bb86;});for(var _0x540633 in _0x6bd1e6){if(_0x6bd1e6[_0x385d('0x23')](_0x540633)){if(!_0x55164a[_0x540633]){delete _0x6bd1e6[_0x540633];}}}}function clearVoiceCallReports(_0x27ef28){_0x27ef28[_0x385d('0x29')]=0x0;_0x27ef28[_0x385d('0x2a')]=0x0;_0x27ef28['sumHoldTime']=0x0;_0x27ef28[_0x385d('0x2b')]=0x0;_0x27ef28[_0x385d('0x2c')]=0x0;}function clearCampaigns(_0xe50c1d){if(!_[_0x385d('0x2d')](_0xe50c1d)){for(var _0x197dc7 in _0xe50c1d){if(_0xe50c1d[_0x385d('0x23')](_0x197dc7)){_0xe50c1d[_0x197dc7][_0x385d('0x2e')]=0x0;_0xe50c1d[_0x197dc7][_0x385d('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x2bd7f5){if(!_[_0x385d('0x2d')](_0x2bd7f5)){for(var _0xff91c3 in _0x2bd7f5){if(_0x2bd7f5[_0x385d('0x23')](_0xff91c3)){_0x2bd7f5[_0xff91c3][_0x385d('0x29')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x2a')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x30')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x31')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x32')]=0x0;_0x2bd7f5[_0xff91c3]['sumDuration']=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x2c')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x33')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x34')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x35')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x36')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x37')]=0x0;_0x2bd7f5[_0xff91c3]['outboundUnknownCallsDay']=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x38')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x39')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x3a')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x3b')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x3c')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x3d')]=0x0;_0x2bd7f5[_0xff91c3][_0x385d('0x33')]=0x0;_0x2bd7f5[_0xff91c3]['outboundAnswerCallsDay']=0x0;_0x2bd7f5[_0xff91c3]['queueStatusComplete']=!![];}}}}Realtime[_0x385d('0x3e')]['mergeFromDatabase']=function(_0x19a6b1,_0x396acb){for(var _0x18237e in _0x396acb){if(_0x19a6b1['hasOwnProperty'](_0x18237e)){_0x19a6b1[_0x18237e]=_0x396acb[_0x18237e];}}};Realtime[_0x385d('0x3e')][_0x385d('0x3f')]=function(){var _0x56acba=this;return function(_0x41fe08){if(_0x41fe08){freeIsNotKeyAgent(_0x41fe08,_0x56acba[_0x385d('0x12')]);for(var _0x5c11ad=0x0,_0x3d3852={},_0x4b1703={};_0x5c11ad<_0x41fe08['length'];_0x5c11ad+=0x1){_0x3d3852=_0x41fe08[_0x5c11ad];var _0x29f61a=_[_0x385d('0x25')](_0x3d3852[_0x385d('0x28')])?util[_0x385d('0x26')]('SIP/%s',_0x3d3852[_0x385d('0x40')]):_0x3d3852[_0x385d('0x28')];if(_[_0x385d('0x41')](_0x56acba[_0x385d('0x12')][_0x29f61a])){_0x56acba['agents'][_0x29f61a]=new Agent(_0x3d3852);}else{_0x56acba[_0x385d('0x42')](_0x56acba[_0x385d('0x12')][_0x29f61a],_0x3d3852);}}}return _0x56acba[_0x385d('0x12')];};};Realtime[_0x385d('0x3e')][_0x385d('0x43')]=function(){var _0x18be5b=this;return function(_0x574b68){if(_0x574b68){freeIsNotKeySip(_0x574b68,_0x18be5b[_0x385d('0x44')]);for(var _0x5c6c23=0x0,_0x5d67ec={},_0x3c1165={};_0x5c6c23<_0x574b68[_0x385d('0x45')];_0x5c6c23+=0x1){_0x5d67ec=_0x574b68[_0x5c6c23];if(_['isUndefined'](_0x18be5b['telephones'][util[_0x385d('0x26')](_0x385d('0x27'),_0x5d67ec[_0x385d('0x40')])])){_0x18be5b['telephones'][util[_0x385d('0x26')]('SIP/%s',_0x5d67ec[_0x385d('0x40')])]=new Telephone(_0x5d67ec);}else{_0x18be5b[_0x385d('0x42')](_0x18be5b['telephones'][util[_0x385d('0x26')](_0x385d('0x27'),_0x5d67ec[_0x385d('0x40')])],_0x5d67ec);}}}return _0x18be5b[_0x385d('0x44')];};};Realtime[_0x385d('0x3e')][_0x385d('0x46')]=function(){var _0x44badd=this;return function(_0x156582){if(_0x156582){freeIsNotKeySip(_0x156582,_0x44badd['trunks']);for(var _0x34e9c4=0x0,_0x2935db={},_0x2cd61c={};_0x34e9c4<_0x156582[_0x385d('0x45')];_0x34e9c4+=0x1){_0x2935db=_0x156582[_0x34e9c4];if(_[_0x385d('0x41')](_0x44badd[_0x385d('0x13')][util[_0x385d('0x26')]('SIP/%s',_0x2935db[_0x385d('0x40')])])){_0x44badd['trunks'][util[_0x385d('0x26')](_0x385d('0x27'),_0x2935db[_0x385d('0x40')])]=new Trunk(_0x2935db);}else{_0x44badd[_0x385d('0x42')](_0x44badd['trunks'][util['format'](_0x385d('0x27'),_0x2935db['name'])],_0x2935db);}}}return _0x44badd[_0x385d('0x13')];};};Realtime[_0x385d('0x3e')][_0x385d('0x47')]=function(){var _0x49dc2a=this;return function(_0x258c87){if(_0x258c87){freeIsNotKey(_0x258c87,_0x49dc2a[_0x385d('0x14')],_0x385d('0x40'));for(var _0x14a817=0x0,_0x1fdecf={},_0x514b59={};_0x14a817<_0x258c87[_0x385d('0x45')];_0x14a817+=0x1){_0x1fdecf=_0x258c87[_0x14a817];if(_['isUndefined'](_0x49dc2a[_0x385d('0x14')][_0x1fdecf['name']])){_0x49dc2a[_0x385d('0x14')][_0x1fdecf[_0x385d('0x40')]]=new VoiceQueue(_0x1fdecf);}else{_0x49dc2a[_0x385d('0x42')](_0x49dc2a[_0x385d('0x14')][_0x1fdecf[_0x385d('0x40')]],_0x1fdecf);}}}return _0x49dc2a[_0x385d('0x14')];};};Realtime['prototype'][_0x385d('0x48')]=function(){var _0x68d06d=this;return function(_0x198dfe){if(_0x198dfe){freeIsNotKey(_0x198dfe,_0x68d06d['triggers'],'id');for(var _0x49d0be=0x0,_0x54fc32={},_0x7d1087={};_0x49d0be<_0x198dfe[_0x385d('0x45')];_0x49d0be+=0x1){_0x54fc32=_0x198dfe[_0x49d0be];if(_[_0x385d('0x41')](_0x68d06d[_0x385d('0x49')][_0x54fc32['id']])){_0x68d06d[_0x385d('0x49')][_0x54fc32['id']]=new Trigger(_0x54fc32);}else{_0x68d06d['mergeFromDatabase'](_0x68d06d[_0x385d('0x49')][_0x54fc32['id']],_0x54fc32);}}}return _0x68d06d[_0x385d('0x49')];};};Realtime[_0x385d('0x3e')]['initTemplates']=function(){var _0xb22646=this;return function(_0x6b0ae4){if(_0x6b0ae4){freeIsNotKey(_0x6b0ae4,_0xb22646[_0x385d('0x16')],'id');for(var _0x371eb2=0x0,_0x42c88b={},_0x339e18={};_0x371eb2<_0x6b0ae4[_0x385d('0x45')];_0x371eb2+=0x1){_0x42c88b=_0x6b0ae4[_0x371eb2];if(_[_0x385d('0x41')](_0xb22646[_0x385d('0x16')][_0x42c88b['id']])){_0xb22646[_0x385d('0x16')][_0x42c88b['id']]=new Template(_0x42c88b);}else{_0xb22646[_0x385d('0x42')](_0xb22646[_0x385d('0x16')][_0x42c88b['id']],_0x42c88b);}}}return _0xb22646['templates'];};};Realtime['prototype'][_0x385d('0x4a')]=function(){var _0x5c9f9f=this;return function(_0x43779b){if(_0x43779b){freeIsNotKey(_0x43779b,_0x5c9f9f[_0x385d('0x1c')],'id');for(var _0x17e0ac=0x0,_0x423518={},_0x7fa8c7={};_0x17e0ac<_0x43779b[_0x385d('0x45')];_0x17e0ac+=0x1){_0x423518=_0x43779b[_0x17e0ac];if(_[_0x385d('0x41')](_0x5c9f9f['zendeskAccounts'][_0x423518['id']])){_0x5c9f9f[_0x385d('0x1c')][_0x423518['id']]=new ZendeskAccount(_0x423518);}else{_0x5c9f9f[_0x385d('0x42')](_0x5c9f9f[_0x385d('0x1c')][_0x423518['id']],_0x423518);}}}return _0x5c9f9f[_0x385d('0x1c')];};};Realtime[_0x385d('0x3e')]['initSalesforceAccounts']=function(){var _0x5ac7c3=this;return function(_0x2481c5){if(_0x2481c5){freeIsNotKey(_0x2481c5,_0x5ac7c3['salesforceAccounts'],'id');for(var _0x5b5fdc=0x0,_0x5680ae={},_0x17b75a={};_0x5b5fdc<_0x2481c5[_0x385d('0x45')];_0x5b5fdc+=0x1){_0x5680ae=_0x2481c5[_0x5b5fdc];if(_[_0x385d('0x41')](_0x5ac7c3['salesforceAccounts'][_0x5680ae['id']])){_0x5ac7c3[_0x385d('0x1d')][_0x5680ae['id']]=new SalesforceAccount(_0x5680ae);}else{_0x5ac7c3['mergeFromDatabase'](_0x5ac7c3[_0x385d('0x1d')][_0x5680ae['id']],_0x5680ae);}}}return _0x5ac7c3[_0x385d('0x1d')];};};Realtime[_0x385d('0x3e')]['initFreshdeskAccounts']=function(){var _0x552d88=this;return function(_0xee94f){if(_0xee94f){freeIsNotKey(_0xee94f,_0x552d88[_0x385d('0x1f')],'id');for(var _0x1123ff=0x0,_0x31489c={},_0x243d0a={};_0x1123ff<_0xee94f[_0x385d('0x45')];_0x1123ff+=0x1){_0x31489c=_0xee94f[_0x1123ff];if(_[_0x385d('0x41')](_0x552d88[_0x385d('0x1f')][_0x31489c['id']])){_0x552d88[_0x385d('0x1f')][_0x31489c['id']]=new FreshdeskAccount(_0x31489c);}else{_0x552d88[_0x385d('0x42')](_0x552d88[_0x385d('0x1f')][_0x31489c['id']],_0x31489c);}}}return _0x552d88[_0x385d('0x1f')];};};Realtime['prototype'][_0x385d('0x4b')]=function(){var _0x57ac22=this;return function(_0x8392ca){if(_0x8392ca){freeIsNotKey(_0x8392ca,_0x57ac22[_0x385d('0x20')],'id');for(var _0x507546=0x0,_0x38bc36={},_0x9fa24c={};_0x507546<_0x8392ca[_0x385d('0x45')];_0x507546+=0x1){_0x38bc36=_0x8392ca[_0x507546];if(_[_0x385d('0x41')](_0x57ac22[_0x385d('0x20')][_0x38bc36['id']])){_0x57ac22[_0x385d('0x20')][_0x38bc36['id']]=new ZohoAccount(_0x38bc36);}else{_0x57ac22[_0x385d('0x42')](_0x57ac22['zohoAccounts'][_0x38bc36['id']],_0x38bc36);}}}return _0x57ac22['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x406ecb=this;return function(_0x3881bc){if(_0x3881bc){freeIsNotKey(_0x3881bc,_0x406ecb[_0x385d('0x4c')],'id');for(var _0x2acece=0x0,_0x318d7a={},_0x7a706b={};_0x2acece<_0x3881bc[_0x385d('0x45')];_0x2acece+=0x1){_0x318d7a=_0x3881bc[_0x2acece];if(_[_0x385d('0x41')](_0x406ecb[_0x385d('0x4c')][_0x318d7a['id']])){_0x406ecb[_0x385d('0x4c')][_0x318d7a['id']]=new DeskAccount(_0x318d7a);}else{_0x406ecb['mergeFromDatabase'](_0x406ecb[_0x385d('0x4c')][_0x318d7a['id']],_0x318d7a);}}}return _0x406ecb[_0x385d('0x4c')];};};Realtime[_0x385d('0x3e')]['initSugarcrmAccounts']=function(){var _0x40f54b=this;return function(_0x48aba9){if(_0x48aba9){freeIsNotKey(_0x48aba9,_0x40f54b[_0x385d('0x1e')],'id');for(var _0x1b1443=0x0,_0x56cdaf={},_0x38df52={};_0x1b1443<_0x48aba9['length'];_0x1b1443+=0x1){_0x56cdaf=_0x48aba9[_0x1b1443];if(_[_0x385d('0x41')](_0x40f54b[_0x385d('0x1e')][_0x56cdaf['id']])){_0x40f54b[_0x385d('0x1e')][_0x56cdaf['id']]=new SugarcrmAccount(_0x56cdaf);}else{_0x40f54b[_0x385d('0x42')](_0x40f54b[_0x385d('0x1e')][_0x56cdaf['id']],_0x56cdaf);}}}return _0x40f54b[_0x385d('0x1e')];};};Realtime[_0x385d('0x3e')][_0x385d('0x4d')]=function(){var _0x429d34=this;return function(_0x37da3f){if(_0x37da3f){freeIsNotKey(_0x37da3f,_0x429d34[_0x385d('0x4e')],'id');for(var _0x54238a=0x0,_0x4f9dc1={},_0x4c835e={};_0x54238a<_0x37da3f['length'];_0x54238a+=0x1){_0x4f9dc1=_0x37da3f[_0x54238a];if(_['isUndefined'](_0x429d34[_0x385d('0x4e')][_0x4f9dc1['id']])){_0x429d34[_0x385d('0x4e')][_0x4f9dc1['id']]=new VtigerAccount(_0x4f9dc1);}else{_0x429d34[_0x385d('0x42')](_0x429d34[_0x385d('0x4e')][_0x4f9dc1['id']],_0x4f9dc1);}}}return _0x429d34['vtigerAccounts'];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x265e8e=this;return function(_0x7408c3){if(_0x7408c3){freeIsNotKey(_0x7408c3,_0x265e8e[_0x385d('0x4f')],'id');for(var _0x1e3b04=0x0,_0x2a56cc={},_0x1597c1={};_0x1e3b04<_0x7408c3[_0x385d('0x45')];_0x1e3b04+=0x1){_0x2a56cc=_0x7408c3[_0x1e3b04];if(_[_0x385d('0x41')](_0x265e8e['servicenowAccounts'][_0x2a56cc['id']])){_0x265e8e[_0x385d('0x4f')][_0x2a56cc['id']]=new ServicenowAccount(_0x2a56cc);}else{_0x265e8e[_0x385d('0x42')](_0x265e8e[_0x385d('0x4f')][_0x2a56cc['id']],_0x2a56cc);}}}return _0x265e8e[_0x385d('0x4f')];};};Realtime[_0x385d('0x3e')][_0x385d('0x50')]=function(){var _0x54a320=this;return function(_0x53cc03){if(_0x53cc03){freeIsNotKey(_0x53cc03,_0x54a320[_0x385d('0x21')],'id');for(var _0x199c99=0x0,_0x331d8a={},_0x442092={};_0x199c99<_0x53cc03[_0x385d('0x45')];_0x199c99+=0x1){_0x331d8a=_0x53cc03[_0x199c99];if(_[_0x385d('0x41')](_0x54a320[_0x385d('0x21')][_0x331d8a['id']])){_0x54a320[_0x385d('0x21')][_0x331d8a['id']]=new Dynamics365Account(_0x331d8a);}else{_0x54a320[_0x385d('0x42')](_0x54a320[_0x385d('0x21')][_0x331d8a['id']],_0x331d8a);}}}return _0x54a320[_0x385d('0x21')];};};Realtime['prototype'][_0x385d('0x51')]=function(){var _0x3aeb17=this;return function(_0xdf6626){if(_0xdf6626){freeIsNotKey(_0xdf6626,_0x3aeb17[_0x385d('0x22')],'id');for(var _0x418ca4=0x0,_0x4e240d={},_0x3c5f8b={};_0x418ca4<_0xdf6626[_0x385d('0x45')];_0x418ca4+=0x1){_0x4e240d=_0xdf6626[_0x418ca4];if(_[_0x385d('0x41')](_0x3aeb17[_0x385d('0x22')][_0x4e240d['id']])){_0x3aeb17[_0x385d('0x22')][_0x4e240d['id']]=new FreshsalesAccount(_0x4e240d);}else{_0x3aeb17[_0x385d('0x42')](_0x3aeb17[_0x385d('0x22')][_0x4e240d['id']],_0x4e240d);}}}return _0x3aeb17['freshsalesAccounts'];};};Realtime['prototype'][_0x385d('0x52')]=function(){var _0x5cadc7=this;return function(_0x552cf7){for(var _0x2a702a=0x0;_0x2a702a<_0x552cf7[_0x385d('0x45')];_0x2a702a+=0x1){_[_0x385d('0x53')](_0x5cadc7['voiceQueues'][_0x552cf7[_0x2a702a][_0x385d('0x40')]],_0x552cf7[_0x2a702a]);}return _0x5cadc7['voiceQueues'];};};Realtime[_0x385d('0x3e')][_0x385d('0x54')]=function(){var _0x4152d1=this;return function(_0x52cb14){clearVoiceQueues(_0x4152d1['voiceQueues']);if(_0x52cb14){_0x52cb14=_[_0x385d('0x55')](_0x52cb14,_0x385d('0x56'));for(var _0x1f9b05 in _0x52cb14){if(_0x52cb14[_0x385d('0x23')](_0x1f9b05)){var _0x1f47f5={};for(var _0x452537=0x0;_0x452537<_0x52cb14[_0x1f9b05][_0x385d('0x45')];_0x452537+=0x1){var _0x2a5196=_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x57')];if(_0x4152d1[_0x385d('0x14')][_0x2a5196]){if(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x58')]){_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x30')]+=0x1;}if(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x59')]){_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x31')]+=0x1;}_0x4152d1[_0x385d('0x14')][_0x2a5196]['sumHoldTime']+=moment(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5a')])[_0x385d('0x5b')](moment(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5c')]),_0x385d('0x5d'))||0x0;if(_0x452537===_0x52cb14[_0x1f9b05][_0x385d('0x45')]-0x1){_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x2b')]+=moment(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5e')]||_0x52cb14[_0x1f9b05][_0x452537]['queuecallerabandonAt']||_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5f')])[_0x385d('0x5b')](moment(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5c')]),'seconds')||0x0;_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x29')]+=0x1;if(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x60')]){_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x2a')]+=0x1;_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x2c')]+=moment(_0x52cb14[_0x1f9b05][_0x452537][_0x385d('0x5e')])[_0x385d('0x5b')](moment(_0x52cb14[_0x1f9b05][_0x452537]['queuecallerleaveAt']),_0x385d('0x5d'))||0x0;}}else{_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x2b')]+=_0x4152d1[_0x385d('0x14')][_0x2a5196][_0x385d('0x32')]||0x0;}}}}}}return _0x4152d1[_0x385d('0x14')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x2fba26=this;return function(_0x53d551){clearVoiceCallReports(_0x2fba26[_0x385d('0x61')]);if(_0x53d551){for(var _0x1c2a8a=0x0;_0x1c2a8a<_0x53d551[_0x385d('0x45')];_0x1c2a8a+=0x1){_0x2fba26[_0x385d('0x61')]['total']+=0x1;_0x2fba26[_0x385d('0x61')][_0x385d('0x2b')]+=_0x53d551[_0x1c2a8a][_0x385d('0x62')];if(_0x53d551[_0x1c2a8a]['disposition']===_0x385d('0x63')){_0x2fba26[_0x385d('0x61')]['answered']+=0x1;_0x2fba26[_0x385d('0x61')][_0x385d('0x32')]+=_0x53d551[_0x1c2a8a][_0x385d('0x62')]-_0x53d551[_0x1c2a8a][_0x385d('0x64')]||0x0;_0x2fba26[_0x385d('0x61')][_0x385d('0x2c')]+=_0x53d551[_0x1c2a8a][_0x385d('0x64')];}}}return _0x2fba26[_0x385d('0x61')];};};Realtime[_0x385d('0x3e')][_0x385d('0x65')]=function(){var _0x274946=this;return function(_0x43d171){if(_0x43d171){freeIsNotKey(_0x43d171,_0x274946[_0x385d('0x15')],_0x385d('0x40'));for(var _0x4d6223=0x0,_0x1e9452={};_0x4d6223<_0x43d171[_0x385d('0x45')];_0x4d6223+=0x1){_0x1e9452=_0x43d171[_0x4d6223];if(_[_0x385d('0x41')](_0x274946[_0x385d('0x15')][_0x1e9452[_0x385d('0x40')]])){_0x274946[_0x385d('0x15')][_0x1e9452[_0x385d('0x40')]]=new Campaign(_0x1e9452);}else{_0x274946[_0x385d('0x42')](_0x274946[_0x385d('0x15')][_0x1e9452[_0x385d('0x40')]],_0x1e9452);_0x274946[_0x385d('0x15')][_0x1e9452['name']][_0x385d('0x66')]=_0x1e9452[_0x385d('0x67')]?_0x1e9452['SquareProject'][_0x385d('0x40')]:undefined;}}}return _0x274946['campaigns'];};};Realtime[_0x385d('0x3e')]['initVoiceExtensions']=function(){var _0x3eb917=this;return function(_0x306c2a){if(_0x306c2a){freeIsNotKey(_0x306c2a,_0x3eb917[_0x385d('0x68')],'id');for(var _0x2da01e=0x0,_0x429fc7={};_0x2da01e<_0x306c2a[_0x385d('0x45')];_0x2da01e+=0x1){_0x429fc7=_0x306c2a[_0x2da01e];if(_['isUndefined'](_0x3eb917[_0x385d('0x68')][_0x429fc7['id']])){_0x3eb917[_0x385d('0x68')][_0x429fc7['id']]=new VoiceExtension(_0x429fc7);}else{_0x3eb917[_0x385d('0x42')](_0x3eb917[_0x385d('0x68')][_0x429fc7['id']],_0x429fc7);}}}return _0x3eb917[_0x385d('0x68')];};};Realtime[_0x385d('0x3e')][_0x385d('0x69')]=function(){var _0x4c5780=this;return function(_0x25dc2b){clearCampaigns(_0x4c5780['campaigns']);for(var _0x1dad74=0x0;_0x1dad74<_0x25dc2b[_0x385d('0x45')];_0x1dad74+=0x1){_[_0x385d('0x53')](_0x4c5780[_0x385d('0x15')][_0x25dc2b[_0x1dad74]['name']],_0x25dc2b[_0x1dad74]);}return _0x4c5780[_0x385d('0x15')];};};Realtime[_0x385d('0x3e')]['initFaxAccounts']=function(){var _0x3f4581=this;return function(_0x87a874){if(_0x87a874){freeIsNotKey(_0x87a874,_0x3f4581[_0x385d('0x6a')],'id');for(var _0x3cb27a=0x0,_0x16c476={},_0x4d259c={};_0x3cb27a<_0x87a874['length'];_0x3cb27a+=0x1){_0x16c476=_0x87a874[_0x3cb27a];if(_[_0x385d('0x41')](_0x3f4581[_0x385d('0x6a')][_0x16c476['id']])){_0x3f4581[_0x385d('0x6a')][_0x16c476['id']]=new FaxAccount(_0x16c476);}else{_0x3f4581[_0x385d('0x42')](_0x3f4581[_0x385d('0x6a')][_0x16c476['id']],_0x16c476);}}}return _0x3f4581[_0x385d('0x6a')];};};module[_0x385d('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f3864f7..7387698 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 _0xa127=['from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','monitor','monitors','monitorFilename','filename','createdAt','membername','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','voiceCallReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','queue','lastdata','context','from-voip-provider','callerid'];(function(_0x317cc5,_0x3b6179){var _0x44fe81=function(_0x3b43b5){while(--_0x3b43b5){_0x317cc5['push'](_0x317cc5['shift']());}};_0x44fe81(++_0x3b6179);}(_0xa127,0x182));var _0x7a12=function(_0xf0b977,_0xe512bd){_0xf0b977=_0xf0b977-0x0;var _0x32199c=_0xa127[_0xf0b977];return _0x32199c;};'use strict';var _=require(_0x7a12('0x0'));var moment=require(_0x7a12('0x1'));var util=require('util');var config=require(_0x7a12('0x2'));var ami=require(_0x7a12('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x7a12('0x4'));var RpcVoiceDialReport=require(_0x7a12('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x7a12('0x6'));var RpcVoiceRecording=require(_0x7a12('0x7'));var RpcVoiceTransferReport=require(_0x7a12('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x7a12('0x9'));var VoiceAgentReport=require(_0x7a12('0xa'));var VoiceDialReport=require(_0x7a12('0xb'));var UserReport=require(_0x7a12('0xc'));function Report(_0x1df8b7){this[_0x7a12('0xd')]=_0x1df8b7;this[_0x7a12('0xe')]=_0x1df8b7[_0x7a12('0xe')];this[_0x7a12('0xf')]=_0x1df8b7[_0x7a12('0xf')];}Report[_0x7a12('0x10')][_0x7a12('0x11')]=function(_0x4ca1fa){var _0x2e7ea3=new VoiceQueueReport(this['realtime']);var _0x448c48=new VoiceAgentReport(this[_0x7a12('0xd')]);var _0x54ab64=new VoiceDialReport(this[_0x7a12('0xd')]);var _0x496618=new VoiceCallReport(this[_0x7a12('0xd')]);var _0x127878=new UserReport(this[_0x7a12('0xd')]);if(config[_0x7a12('0x12')]&&config[_0x7a12('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x7a12('0x13')][_0x7a12('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x7a12('0x15')]['bind'](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x7a12('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x7a12('0x16')]['bind'](this));ami['on']('blindtransfer',this[_0x7a12('0x17')][_0x7a12('0x14')](this));ami['on'](_0x7a12('0x18'),this[_0x7a12('0x19')][_0x7a12('0x14')](this));}};Report[_0x7a12('0x10')][_0x7a12('0x1a')]=function(_0x5b2f85){var _0x33c0f3;_0x33c0f3=_[_0x7a12('0x1b')](this['agents'],function(_0x104446){return _0x104446[_0x7a12('0x1c')]==_0x5b2f85||_0x104446[_0x7a12('0x1d')]==_0x5b2f85;});if(_[_0x7a12('0x1e')](_0x33c0f3)){var _0x4d3d54=_[_0x7a12('0x1b')](this[_0x7a12('0xf')],function(_0x213315){return _0x213315[_0x7a12('0x1c')]==_0x5b2f85||_0x213315[_0x7a12('0x1d')]==_0x5b2f85;});if(_0x4d3d54){_0x33c0f3=_[_0x7a12('0x1b')](this['agents'],function(_0x234f9c){return _0x234f9c[_0x7a12('0x1f')]==util[_0x7a12('0x20')]('SIP/%s',_0x4d3d54[_0x7a12('0x1d')]);});}}return _0x33c0f3;};Report[_0x7a12('0x10')][_0x7a12('0x13')]=function(_0x469c39){for(var _0x4e26b0=0x0;_0x4e26b0<_0x469c39[_0x7a12('0x21')];_0x4e26b0+=0x1){var _0x154a23=this[_0x7a12('0x1a')](_0x469c39[_0x4e26b0][_0x7a12('0x22')]);if(_0x154a23){_0x469c39[_0x4e26b0][_0x7a12('0x1c')]=_0x154a23[_0x7a12('0x1c')];_0x469c39[_0x4e26b0][_0x7a12('0x23')]=!![];_0x469c39[_0x4e26b0]['lastAssignedTo']=_0x154a23[_0x7a12('0x1d')];_0x469c39[_0x4e26b0][_0x7a12('0x1f')]=_['isNil'](_0x154a23[_0x7a12('0x1f')])?util[_0x7a12('0x20')](_0x7a12('0x24'),_0x154a23[_0x7a12('0x1d')]):_0x154a23[_0x7a12('0x1f')];if(_0x469c39[_0x4e26b0][_0x7a12('0x25')]){_0x469c39[_0x4e26b0][_0x7a12('0x26')]=moment()[_0x7a12('0x20')](_0x7a12('0x27'));}if(_0x469c39[_0x4e26b0][_0x7a12('0x28')]){_0x469c39[_0x4e26b0]['queuecallerexitAt']=moment()['format'](_0x7a12('0x27'));}RpcMemberReport[_0x7a12('0x13')](_0x469c39[_0x4e26b0]);}RpcVoiceQueueReport[_0x7a12('0x29')](_0x469c39[_0x4e26b0]);}};function extractCalleridNumber(_0x529828){var _0x37e981=_0x529828[_0x7a12('0x2a')](/<(.*?)>/);return _0x37e981?_0x37e981[0x1]:_0x529828;}Report[_0x7a12('0x10')][_0x7a12('0x2b')]=function(_0x1e81cd){for(var _0x3e5dda=0x0;_0x3e5dda/);return _0x22a717?_0x22a717[0x1]:_0x5badc5;}Report[_0x6bcd('0x10')]['getAgentByInternal']=function(_0x77023e){for(var _0x421968=0x0;_0x421968',_0x505f68[_0x6bcd('0x45')],_0x505f68['calleridnum']);}if(RpcVoiceTransferReport[_0x6bcd('0x46')][_0x505f68['linkedid']]){var _0x1e9a57=RpcVoiceTransferReport[_0x6bcd('0x46')][_0x505f68[_0x6bcd('0x47')]];_0x1e9a57[_0x6bcd('0x48')]=_0x505f68[_0x6bcd('0x49')];RpcVoiceTransferReport[_0x6bcd('0x1c')](_0x1e9a57);delete RpcVoiceTransferReport[_0x6bcd('0x46')][_0x505f68[_0x6bcd('0x47')]];}if(_[_0x6bcd('0x23')](_0x505f68[_0x6bcd('0x37')])){_0x505f68[_0x6bcd('0x37')]=this[_0x6bcd('0x31')](_0x505f68);}if(_['isNil'](_0x505f68[_0x6bcd('0x4a')])){var _0xd5c5b=_0x505f68[_0x6bcd('0x4b')][_0x6bcd('0x4c')]('-')[0x0];var _0x1e125d=this[_0x6bcd('0xe')][_0xd5c5b];if(!_0x1e125d)_0x1e125d=this[_0x6bcd('0x32')](_0x505f68[_0x6bcd('0x21')]);if(_0x1e125d){_0x505f68[_0x6bcd('0x4a')]=_0x1e125d['id'];_0x505f68[_0x6bcd('0x4d')]=_0x1e125d[_0x6bcd('0x22')];}}RpcVoiceCallReport['create'](_0x505f68);if(_0x505f68['monitor']){for(var _0x24d51c=0x0;_0x24d51c<_0x505f68['monitors'][_0x6bcd('0x26')];_0x24d51c+=0x1){_0x505f68['monitorFilename']=_0x505f68['monitors'][_0x24d51c][_0x6bcd('0x4e')];_0x505f68[_0x6bcd('0x4f')]=_0x505f68[_0x6bcd('0x50')][_0x24d51c]['createdAt'];if(_0x505f68['exten']==_0x6bcd('0x3e')){_0x505f68[_0x6bcd('0x40')]=_0x505f68[_0x6bcd('0x44')];_0x505f68[_0x6bcd('0x45')]=_0x505f68[_0x6bcd('0x51')];_0x505f68[_0x6bcd('0x44')]=_0x505f68[_0x6bcd('0x21')];_0x505f68['connectedlinename']=_0x505f68['membername'];_0x505f68[_0x6bcd('0x36')]=_0x505f68[_0x6bcd('0x41')];}else if(_0x505f68[_0x6bcd('0x36')]=='xcally-motion-dialer'){_0x505f68[_0x6bcd('0x40')]=_0x505f68[_0x6bcd('0x35')];_0x505f68['exten']=_0x505f68[_0x6bcd('0x41')];}RpcVoiceRecording[_0x6bcd('0x2e')](_0x505f68);}}};Report[_0x6bcd('0x10')]['voiceAgentReport']=function(_0x171b13){if(_['isArray'](_0x171b13)){_0x171b13['forEach'](function(_0x401471){RpcVoiceAgentReport['create'](_0x401471);});}else{RpcVoiceAgentReport[_0x6bcd('0x2e')](_0x171b13);}};Report[_0x6bcd('0x10')][_0x6bcd('0x1a')]=function(_0x20ecb8){RpcVoiceDialReport[_0x6bcd('0x2e')](_0x20ecb8);var _0x9d1357;var _0x14cabf;var _0x4e791c=_0x20ecb8[_0x6bcd('0x4b')];if(_[_0x6bcd('0x52')](_0x4e791c,_0x6bcd('0x53'))){_0x14cabf=_0x4e791c[_0x6bcd('0x54')](_0x4e791c[_0x6bcd('0x55')]('/')+0x1,_0x4e791c[_0x6bcd('0x55')]('@'));_0x9d1357=_[_0x6bcd('0x20')](this[_0x6bcd('0xe')],function(_0x3a5429){return _0x3a5429[_0x6bcd('0x56')]==_0x14cabf||_0x3a5429['phone']==_0x14cabf||_0x3a5429[_0x6bcd('0x21')]==_0x14cabf;});}else{_0x14cabf=_0x4e791c[_0x6bcd('0x54')](_0x4e791c['indexOf']('/')+0x1,_0x4e791c['lastIndexOf']('-'));_0x9d1357=this[_0x6bcd('0x1f')](_0x14cabf);}if(_0x9d1357){_0x20ecb8[_0x6bcd('0x24')]=_[_0x6bcd('0x23')](_0x9d1357['interface'])?util['format'](_0x6bcd('0x25'),_0x9d1357[_0x6bcd('0x22')]):_0x9d1357[_0x6bcd('0x24')];_0x20ecb8['membername']=_0x9d1357[_0x6bcd('0x22')];_0x20ecb8[_0x6bcd('0x21')]=_0x9d1357['accountcode'];RpcMemberReport[_0x6bcd('0x1a')](_0x20ecb8);}};Report[_0x6bcd('0x10')]['blindTransfer']=function(_0x392187){RpcVoiceTransferReport[_0x6bcd('0x46')][_0x392187['transfererlinkedid']]=_0x392187;};Report[_0x6bcd('0x10')][_0x6bcd('0x1e')]=function(_0x162841){RpcVoiceTransferReport[_0x6bcd('0x1e')](_0x162841);};module[_0x6bcd('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 26dd1a0..ceb0be6 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 _0x32a9=['trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','resolve','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','state','debug','[userReport][registry]','find','username','stateRegistry','merge','event','actionid','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','lodash','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter'];(function(_0x5dfdf1,_0x2910be){var _0x238d61=function(_0x62ed26){while(--_0x62ed26){_0x5dfdf1['push'](_0x5dfdf1['shift']());}};_0x238d61(++_0x2910be);}(_0x32a9,0x163));var _0x932a=function(_0x1d432d,_0x401149){_0x1d432d=_0x1d432d-0x0;var _0x338acb=_0x32a9[_0x1d432d];return _0x338acb;};'use strict';var _=require(_0x932a('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x932a('0x1'));var BPromise=require(_0x932a('0x2'));var config=require(_0x932a('0x3'));var logger=require(_0x932a('0x4'))(_0x932a('0x5'));var ami=require(_0x932a('0x6'));config[_0x932a('0x7')]=_['defaults'](config['redis'],{'host':_0x932a('0x8'),'port':0x18eb});var io=require(_0x932a('0x9'))(new Redis(config[_0x932a('0x7')]));function UserReport(_0x17feb8){this[_0x932a('0xa')]=_0x17feb8[_0x932a('0xa')];this['agents']=_0x17feb8[_0x932a('0xb')];this[_0x932a('0xc')]=_0x17feb8[_0x932a('0xc')];ami['on'](_0x932a('0xd'),this[_0x932a('0xe')][_0x932a('0xf')](this));ami['on'](_0x932a('0x10'),this['syncRegistry'][_0x932a('0xf')](this));ami['on'](_0x932a('0x11'),this[_0x932a('0x12')][_0x932a('0xf')](this));ami['on'](_0x932a('0x13'),this[_0x932a('0x14')][_0x932a('0xf')](this));return this[_0x932a('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0x932a('0x16')](ami[_0x932a('0x17')]())[_0x932a('0x18')](function(_0xf48ed4){logger[_0x932a('0x19')](_0x932a('0x1a'),util[_0x932a('0x1b')](_0xf48ed4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x932a('0x1c')]())[_0x932a('0x18')](function(_0x5ee50a){logger['error'](_0x932a('0x1d'),util[_0x932a('0x1b')](_0x5ee50a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x932a('0x1e')]()[_0x932a('0x16')](ami['actionSipPeerStatus']())['catch'](function(_0x182571){logger[_0x932a('0x19')](_0x932a('0x1f'),util['inspect'](_0x182571,{'showHidden':![],'depth':null}));});}UserReport[_0x932a('0x20')][_0x932a('0x15')]=function(){setInterval(function(){BPromise[_0x932a('0x1e')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x932a('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x932a('0x20')][_0x932a('0x21')]=function(_0x2b94a2){return _0x2b94a2!==null&&!_['isUndefined'](_0x2b94a2);};UserReport['prototype'][_0x932a('0x22')]=function(_0x101a77,_0x315629,_0x184f7c){io['to'](_0x101a77)[_0x932a('0x22')](_0x315629,_0x184f7c);};UserReport['prototype'][_0x932a('0xe')]=function(_0x58672b){try{if(this['isNotNull'](_0x58672b)){logger[_0x932a('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x58672b['username'],_0x58672b[_0x932a('0x24')]);logger[_0x932a('0x25')](_0x932a('0x26'),util['inspect'](_0x58672b,{'showHidden':![],'depth':null}));var _0x535fd9=_[_0x932a('0x27')](this['trunks'],{'defaultuser':_0x58672b[_0x932a('0x28')]});if(_0x535fd9){_0x58672b[_0x932a('0x29')]=_0x58672b['state'];_[_0x932a('0x2a')](_0x535fd9,_['omit'](_0x58672b,[_0x932a('0x2b'),_0x932a('0x2c'),_0x932a('0x28'),_0x932a('0x24')]));logger[_0x932a('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x932a('0x1b')](_0x535fd9,{'showHidden':![],'depth':null}));this[_0x932a('0x22')](util[_0x932a('0x2d')]('trunk:%s',_0x535fd9[_0x932a('0x2e')]),'trunk:save',_0x535fd9);}}}catch(_0x365ffb){logger[_0x932a('0x19')](_0x932a('0x26'),util[_0x932a('0x1b')](_0x365ffb,{'showHidden':![],'depth':null}));}};UserReport[_0x932a('0x20')][_0x932a('0x12')]=function(_0x1b72df){try{if(this['isNotNull'](_0x1b72df)){logger[_0x932a('0x23')](_0x932a('0x2f'),_0x1b72df[_0x932a('0x30')],_0x1b72df[_0x932a('0x24')]);logger[_0x932a('0x25')](_0x932a('0x31'),util[_0x932a('0x1b')](_0x1b72df,{'showHidden':![],'depth':null}));if(this[_0x932a('0xb')][_0x1b72df[_0x932a('0x30')]]){if(!this[_0x932a('0xb')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x32')]||_0x1b72df['state'][_0x932a('0x33')]()==_0x932a('0x34')){this[_0x932a('0xb')][_0x1b72df['device']][_0x932a('0x32')]=![];if(this[_0x932a('0xb')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x24')]!==_0x1b72df[_0x932a('0x24')]['toLowerCase']()){this['agents'][_0x1b72df[_0x932a('0x30')]][_0x932a('0x35')]=_[_0x932a('0x36')](moment()['format']('x'));}this[_0x932a('0xb')][_0x1b72df['device']][_0x932a('0x24')]=_0x1b72df[_0x932a('0x24')]['toLowerCase']();this[_0x932a('0xb')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x37')](_0x1b72df);}}else if(this[_0x932a('0xc')][_0x1b72df['device']]){if(this[_0x932a('0xc')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x24')]!==_0x1b72df['state'][_0x932a('0x33')]()){this[_0x932a('0xc')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x35')]=_['toNumber'](moment()[_0x932a('0x2d')]('x'));}this[_0x932a('0xc')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x24')]=_0x1b72df[_0x932a('0x24')][_0x932a('0x33')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x932a('0x1b')](this[_0x932a('0xc')][_0x1b72df[_0x932a('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x932a('0x2d')](_0x932a('0x38'),this['telephones'][_0x1b72df[_0x932a('0x30')]][_0x932a('0x2e')]),_0x932a('0x39'),this[_0x932a('0xc')][_0x1b72df[_0x932a('0x30')]]);}else if(this[_0x932a('0xa')][_0x1b72df['device']]){if(this[_0x932a('0xa')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x24')]!==_0x1b72df[_0x932a('0x24')]['toLowerCase']()){this[_0x932a('0xa')][_0x1b72df[_0x932a('0x30')]]['stateTime']=_[_0x932a('0x36')](moment()[_0x932a('0x2d')]('x'));}this[_0x932a('0xa')][_0x1b72df[_0x932a('0x30')]][_0x932a('0x24')]=_0x1b72df['state']['toLowerCase']();logger[_0x932a('0x25')](_0x932a('0x3a'),util['inspect'](this['trunks'][_0x1b72df[_0x932a('0x30')]],{'showHidden':![],'depth':null}));this[_0x932a('0x22')](util['format']('trunk:%s',this['trunks'][_0x1b72df[_0x932a('0x30')]][_0x932a('0x2e')]),_0x932a('0x3b'),this['trunks'][_0x1b72df[_0x932a('0x30')]]);}else if(_[_0x932a('0x3c')](_0x1b72df[_0x932a('0x30')],_0x932a('0x3d'))){var _0x48463e=_0x1b72df[_0x932a('0x30')];var _0x2ea938=_0x48463e[_0x932a('0x3e')](_0x48463e['indexOf']('/')+0x1,_0x48463e['indexOf']('@'));var _0x18cce4=_['find'](this[_0x932a('0xb')],function(_0x164a54){return _0x164a54[_0x932a('0x3f')]==_0x2ea938||_0x164a54[_0x932a('0x40')]==_0x2ea938||_0x164a54['accountcode']==_0x2ea938;});if(_0x18cce4){if(_0x18cce4[_0x932a('0x24')]!==_0x1b72df[_0x932a('0x24')]['toLowerCase']()){_0x18cce4[_0x932a('0x35')]=_[_0x932a('0x36')](moment()['format']('x'));}_0x18cce4['state']=_0x1b72df[_0x932a('0x24')][_0x932a('0x33')]();_0x18cce4[_0x932a('0x32')]=!![];_0x18cce4['updateStatusRealtime'](_0x1b72df);}}}}catch(_0x155754){logger['error'](_0x932a('0x31'),util[_0x932a('0x1b')](_0x155754,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x932a('0x14')]=function(_0x21d81b){try{if(this[_0x932a('0x21')](_0x21d81b)&&this[_0x932a('0x21')](_0x21d81b[_0x932a('0x13')])){logger[_0x932a('0x23')](_0x932a('0x41'),_0x21d81b[_0x932a('0x42')],_0x21d81b[_0x932a('0x43')],_0x21d81b['peerstatus']);logger[_0x932a('0x25')](_0x932a('0x44'),util[_0x932a('0x1b')](_0x21d81b,{'showHidden':![],'depth':null}));if(this[_0x932a('0xb')][_0x21d81b['peer']]){if(!this[_0x932a('0xb')][_0x21d81b[_0x932a('0x42')]][_0x932a('0x32')]||_0x21d81b[_0x932a('0x13')][_0x932a('0x33')]()=='registered'){this['agents'][_0x21d81b['peer']]['local']=![];this[_0x932a('0xb')][_0x21d81b[_0x932a('0x42')]][_0x932a('0x45')]=_0x21d81b[_0x932a('0x13')]['toLowerCase']();this['agents'][_0x21d81b[_0x932a('0x42')]]['address']=_0x21d81b[_0x932a('0x43')];this[_0x932a('0xb')][_0x21d81b['peer']]['updateStatusRealtime'](_0x21d81b);}}else if(this[_0x932a('0xc')][_0x21d81b['peer']]){this['telephones'][_0x21d81b[_0x932a('0x42')]][_0x932a('0x45')]=_0x21d81b[_0x932a('0x13')][_0x932a('0x33')]();this['telephones'][_0x21d81b[_0x932a('0x42')]]['address']=_0x21d81b[_0x932a('0x43')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x932a('0x1b')](this[_0x932a('0xc')][_0x21d81b[_0x932a('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this['telephones'][_0x21d81b[_0x932a('0x42')]][_0x932a('0x2e')]),_0x932a('0x39'),this[_0x932a('0xc')][_0x21d81b[_0x932a('0x42')]]);}else if(this[_0x932a('0xa')][_0x21d81b['peer']]){this[_0x932a('0xa')][_0x21d81b[_0x932a('0x42')]][_0x932a('0x45')]=_0x21d81b[_0x932a('0x13')][_0x932a('0x33')]();this[_0x932a('0xa')][_0x21d81b[_0x932a('0x42')]][_0x932a('0x43')]=_0x21d81b['address'];logger[_0x932a('0x25')](_0x932a('0x46'),util[_0x932a('0x1b')](this['trunks'][_0x21d81b[_0x932a('0x42')]],{'showHidden':![],'depth':null}));this[_0x932a('0x22')](util[_0x932a('0x2d')](_0x932a('0x47'),this[_0x932a('0xa')][_0x21d81b[_0x932a('0x42')]]['name']),_0x932a('0x3b'),this[_0x932a('0xa')][_0x21d81b[_0x932a('0x42')]]);}}}catch(_0x353cda){logger['error'](_0x932a('0x44'),util[_0x932a('0x1b')](_0x353cda,{'showHidden':![],'depth':null}));}};module[_0x932a('0x48')]=UserReport; \ No newline at end of file +var _0xe822=['[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','find','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','resolve','actionSipShowRegistry','error','[userReport][sipshowregistry]','then','catch','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','username','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:'];(function(_0x1da508,_0x59b40d){var _0x3e3744=function(_0x5da3ab){while(--_0x5da3ab){_0x1da508['push'](_0x1da508['shift']());}};_0x3e3744(++_0x59b40d);}(_0xe822,0x1ce));var _0x2e82=function(_0x5f44f5,_0x40df7d){_0x5f44f5=_0x5f44f5-0x0;var _0x274ff1=_0xe822[_0x5f44f5];return _0x274ff1;};'use strict';var _=require(_0x2e82('0x0'));var moment=require(_0x2e82('0x1'));var util=require(_0x2e82('0x2'));var Redis=require(_0x2e82('0x3'));var BPromise=require(_0x2e82('0x4'));var config=require(_0x2e82('0x5'));var logger=require(_0x2e82('0x6'))(_0x2e82('0x7'));var ami=require(_0x2e82('0x8'));config[_0x2e82('0x9')]=_['defaults'](config[_0x2e82('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2e82('0xa'))(new Redis(config[_0x2e82('0x9')]));function UserReport(_0x45dde1){this[_0x2e82('0xb')]=_0x45dde1['trunks'];this[_0x2e82('0xc')]=_0x45dde1['agents'];this[_0x2e82('0xd')]=_0x45dde1[_0x2e82('0xd')];ami['on']('registryentry',this[_0x2e82('0xe')][_0x2e82('0xf')](this));ami['on'](_0x2e82('0x10'),this[_0x2e82('0xe')][_0x2e82('0xf')](this));ami['on'](_0x2e82('0x11'),this['syncDeviceState'][_0x2e82('0xf')](this));ami['on'](_0x2e82('0x12'),this[_0x2e82('0x13')][_0x2e82('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x2e82('0x14')]()['then'](ami[_0x2e82('0x15')]())['catch'](function(_0x2e4b9f){logger[_0x2e82('0x16')](_0x2e82('0x17'),util['inspect'](_0x2e4b9f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x2e82('0x14')]()[_0x2e82('0x18')](ami['actionDeviceStateList']())[_0x2e82('0x19')](function(_0xe4d301){logger[_0x2e82('0x16')]('[userReport][devicestatelist]',util[_0x2e82('0x1a')](_0xe4d301,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2e82('0x14')]()['then'](ami[_0x2e82('0x1b')]())[_0x2e82('0x19')](function(_0x55234d){logger[_0x2e82('0x16')](_0x2e82('0x1c'),util['inspect'](_0x55234d,{'showHidden':![],'depth':null}));});}UserReport[_0x2e82('0x1d')][_0x2e82('0x1e')]=function(){setInterval(function(){BPromise['resolve']()[_0x2e82('0x18')](showSipRegistrations())['then'](listDeviceStates())[_0x2e82('0x18')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x2e82('0x1f')]=function(_0xf2d08a){return _0xf2d08a!==null&&!_['isUndefined'](_0xf2d08a);};UserReport['prototype'][_0x2e82('0x20')]=function(_0x147792,_0xb78c2a,_0x2124ca){io['to'](_0x147792)['emit'](_0xb78c2a,_0x2124ca);};UserReport['prototype'][_0x2e82('0xe')]=function(_0xbca320){try{if(this[_0x2e82('0x1f')](_0xbca320)){logger[_0x2e82('0x21')](_0x2e82('0x22'),_0xbca320['username'],_0xbca320[_0x2e82('0x23')]);logger[_0x2e82('0x24')](_0x2e82('0x25'),util[_0x2e82('0x1a')](_0xbca320,{'showHidden':![],'depth':null}));var _0x3d4dc0=_['find'](this[_0x2e82('0xb')],{'defaultuser':_0xbca320[_0x2e82('0x26')]});if(_0x3d4dc0){_0xbca320[_0x2e82('0x27')]=_0xbca320[_0x2e82('0x23')];_[_0x2e82('0x28')](_0x3d4dc0,_[_0x2e82('0x29')](_0xbca320,[_0x2e82('0x2a'),'actionid','username',_0x2e82('0x23')]));logger[_0x2e82('0x24')](_0x2e82('0x2b'),util['inspect'](_0x3d4dc0,{'showHidden':![],'depth':null}));this[_0x2e82('0x20')](util[_0x2e82('0x2c')](_0x2e82('0x2d'),_0x3d4dc0[_0x2e82('0x2e')]),'trunk:save',_0x3d4dc0);}}}catch(_0x2f1da6){logger[_0x2e82('0x16')](_0x2e82('0x25'),util[_0x2e82('0x1a')](_0x2f1da6,{'showHidden':![],'depth':null}));}};UserReport[_0x2e82('0x1d')][_0x2e82('0x2f')]=function(_0x33d776){try{if(this[_0x2e82('0x1f')](_0x33d776)){logger[_0x2e82('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x33d776[_0x2e82('0x30')],_0x33d776[_0x2e82('0x23')]);logger[_0x2e82('0x24')]('[userReport][devicestatechange]',util['inspect'](_0x33d776,{'showHidden':![],'depth':null}));if(this[_0x2e82('0xc')][_0x33d776[_0x2e82('0x30')]]){if(!this['agents'][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x31')]||_0x33d776[_0x2e82('0x23')][_0x2e82('0x32')]()==_0x2e82('0x33')){this['agents'][_0x33d776[_0x2e82('0x30')]]['local']=![];if(this[_0x2e82('0xc')][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x23')]!==_0x33d776[_0x2e82('0x23')][_0x2e82('0x32')]()){this[_0x2e82('0xc')][_0x33d776['device']][_0x2e82('0x34')]=_[_0x2e82('0x35')](moment()['format']('x'));}this['agents'][_0x33d776['device']][_0x2e82('0x23')]=_0x33d776['state']['toLowerCase']();this[_0x2e82('0xc')][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x36')](_0x33d776);}}else if(this['telephones'][_0x33d776[_0x2e82('0x30')]]){if(this['telephones'][_0x33d776[_0x2e82('0x30')]]['state']!==_0x33d776[_0x2e82('0x23')][_0x2e82('0x32')]()){this['telephones'][_0x33d776[_0x2e82('0x30')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['telephones'][_0x33d776['device']]['state']=_0x33d776[_0x2e82('0x23')][_0x2e82('0x32')]();logger[_0x2e82('0x24')](_0x2e82('0x37'),util['inspect'](this[_0x2e82('0xd')][_0x33d776[_0x2e82('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this['telephones'][_0x33d776[_0x2e82('0x30')]]['name']),'telephone:save',this[_0x2e82('0xd')][_0x33d776[_0x2e82('0x30')]]);}else if(this[_0x2e82('0xb')][_0x33d776[_0x2e82('0x30')]]){if(this[_0x2e82('0xb')][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x23')]!==_0x33d776[_0x2e82('0x23')]['toLowerCase']()){this[_0x2e82('0xb')][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x34')]=_[_0x2e82('0x35')](moment()[_0x2e82('0x2c')]('x'));}this['trunks'][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x23')]=_0x33d776['state']['toLowerCase']();logger[_0x2e82('0x24')](_0x2e82('0x38'),util[_0x2e82('0x1a')](this[_0x2e82('0xb')][_0x33d776[_0x2e82('0x30')]],{'showHidden':![],'depth':null}));this[_0x2e82('0x20')](util[_0x2e82('0x2c')]('trunk:%s',this[_0x2e82('0xb')][_0x33d776[_0x2e82('0x30')]][_0x2e82('0x2e')]),'trunk:save',this['trunks'][_0x33d776[_0x2e82('0x30')]]);}else if(_['startsWith'](_0x33d776[_0x2e82('0x30')],_0x2e82('0x39'))){var _0x237dce=_0x33d776[_0x2e82('0x30')];var _0x4bad5a=_0x237dce[_0x2e82('0x3a')](_0x237dce[_0x2e82('0x3b')]('/')+0x1,_0x237dce[_0x2e82('0x3b')]('@'));var _0x576d46=_[_0x2e82('0x3c')](this[_0x2e82('0xc')],function(_0x5c78b8){return _0x5c78b8['mobile']==_0x4bad5a||_0x5c78b8['phone']==_0x4bad5a||_0x5c78b8['accountcode']==_0x4bad5a;});if(_0x576d46){if(_0x576d46[_0x2e82('0x23')]!==_0x33d776[_0x2e82('0x23')][_0x2e82('0x32')]()){_0x576d46[_0x2e82('0x34')]=_['toNumber'](moment()[_0x2e82('0x2c')]('x'));}_0x576d46[_0x2e82('0x23')]=_0x33d776['state'][_0x2e82('0x32')]();_0x576d46[_0x2e82('0x31')]=!![];_0x576d46['updateStatusRealtime'](_0x33d776);}}}}catch(_0x4a472d){logger['error'](_0x2e82('0x3d'),util[_0x2e82('0x1a')](_0x4a472d,{'showHidden':![],'depth':null}));}};UserReport[_0x2e82('0x1d')][_0x2e82('0x13')]=function(_0x5025ae){try{if(this[_0x2e82('0x1f')](_0x5025ae)&&this[_0x2e82('0x1f')](_0x5025ae[_0x2e82('0x12')])){logger['info'](_0x2e82('0x3e'),_0x5025ae['peer'],_0x5025ae[_0x2e82('0x3f')],_0x5025ae['peerstatus']);logger[_0x2e82('0x24')](_0x2e82('0x40'),util[_0x2e82('0x1a')](_0x5025ae,{'showHidden':![],'depth':null}));if(this[_0x2e82('0xc')][_0x5025ae[_0x2e82('0x41')]]){if(!this['agents'][_0x5025ae['peer']][_0x2e82('0x31')]||_0x5025ae[_0x2e82('0x12')][_0x2e82('0x32')]()==_0x2e82('0x42')){this[_0x2e82('0xc')][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x31')]=![];this['agents'][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x43')]=_0x5025ae[_0x2e82('0x12')][_0x2e82('0x32')]();this['agents'][_0x5025ae['peer']][_0x2e82('0x3f')]=_0x5025ae[_0x2e82('0x3f')];this[_0x2e82('0xc')][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x36')](_0x5025ae);}}else if(this[_0x2e82('0xd')][_0x5025ae['peer']]){this[_0x2e82('0xd')][_0x5025ae['peer']][_0x2e82('0x43')]=_0x5025ae['peerstatus'][_0x2e82('0x32')]();this[_0x2e82('0xd')][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x3f')]=_0x5025ae[_0x2e82('0x3f')];logger['debug'](_0x2e82('0x44'),util[_0x2e82('0x1a')](this[_0x2e82('0xd')][_0x5025ae[_0x2e82('0x41')]],{'showHidden':![],'depth':null}));this[_0x2e82('0x20')](util[_0x2e82('0x2c')](_0x2e82('0x45'),this[_0x2e82('0xd')][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x2e')]),_0x2e82('0x46'),this[_0x2e82('0xd')][_0x5025ae[_0x2e82('0x41')]]);}else if(this[_0x2e82('0xb')][_0x5025ae[_0x2e82('0x41')]]){this['trunks'][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x43')]=_0x5025ae[_0x2e82('0x12')]['toLowerCase']();this[_0x2e82('0xb')][_0x5025ae[_0x2e82('0x41')]][_0x2e82('0x3f')]=_0x5025ae[_0x2e82('0x3f')];logger[_0x2e82('0x24')](_0x2e82('0x47'),util['inspect'](this['trunks'][_0x5025ae[_0x2e82('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x2e82('0x2c')](_0x2e82('0x2d'),this[_0x2e82('0xb')][_0x5025ae['peer']][_0x2e82('0x2e')]),_0x2e82('0x48'),this[_0x2e82('0xb')][_0x5025ae[_0x2e82('0x41')]]);}}}catch(_0x1f2cbb){logger[_0x2e82('0x16')](_0x2e82('0x40'),util['inspect'](_0x1f2cbb,{'showHidden':![],'depth':null}));}};module[_0x2e82('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index af9dfdc..54b4c74 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 _0x81e9=['variables','bind','agentconnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','hangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','voice','merge','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','reason','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','hasOwnProperty','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x81e9,0x1b7));var _0x981e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x81e9[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x981e('0x0'));var moment=require('moment');var util=require(_0x981e('0x1'));var Redis=require(_0x981e('0x2'));var config=require(_0x981e('0x3'));var logger=require(_0x981e('0x4'))(_0x981e('0x5'));var ami=require('../ami');config[_0x981e('0x6')]=_[_0x981e('0x7')](config[_0x981e('0x6')],{'host':_0x981e('0x8'),'port':0x18eb});var io=require(_0x981e('0x9'))(new Redis(config[_0x981e('0x6')]));function VoiceAgentReport(_0x33d1de){this[_0x981e('0xa')]={};this[_0x981e('0xb')]=_0x33d1de[_0x981e('0xa')];this[_0x981e('0xc')]=_0x33d1de['voiceQueues'];this[_0x981e('0xd')]=_0x33d1de[_0x981e('0xd')];this[_0x981e('0xe')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x981e('0xf')](this));ami['on'](_0x981e('0x10'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this[_0x981e('0x11')]['bind'](this));ami['on'](_0x981e('0x12'),this[_0x981e('0x13')][_0x981e('0xf')](this));ami['on'](_0x981e('0x14'),this['syncAgentComplete'][_0x981e('0xf')](this));ami['on'](_0x981e('0x15'),this['syncVarSet'][_0x981e('0xf')](this));ami['on'](_0x981e('0x16'),this['syncHangup'][_0x981e('0xf')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x981e('0xf')](this));ami['on'](_0x981e('0x17'),this[_0x981e('0x18')][_0x981e('0xf')](this));ami['on'](_0x981e('0x19'),this[_0x981e('0x1a')][_0x981e('0xf')](this));}VoiceAgentReport['prototype']['emit']=function(_0x19bd11,_0x999539,_0x1195f2){io['to'](_0x19bd11)[_0x981e('0x1b')](_0x999539,_0x1195f2);};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x1d')]=function(_0x3d72bc){return _0x3d72bc!==null&&!_[_0x981e('0x1e')](_0x3d72bc);};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x1f')]=function(_0x2f165d){try{if(this[_0x981e('0x1d')](_0x2f165d)){logger[_0x981e('0x20')](_0x981e('0x21'),_0x2f165d['uniqueid'],_0x2f165d[_0x981e('0x22')],_0x2f165d[_0x981e('0x23')]);logger[_0x981e('0x24')](_0x981e('0x25'),_0x2f165d[_0x981e('0x26')],util[_0x981e('0x27')](_0x2f165d,{'showHidden':![],'depth':null}));if(_[_0x981e('0x1e')](this[_0x981e('0xa')][_0x2f165d['uniqueid']])){this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]]={};}if(_[_0x981e('0x1e')](this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]][_0x2f165d[_0x981e('0x23')]])){this[_0x981e('0xa')][_0x2f165d['uniqueid']][_0x2f165d[_0x981e('0x23')]]={'agentcalledAt':moment()['format'](_0x981e('0x28')),'lastevent':_0x981e('0x29'),'mandatoryDisposition':this['voiceQueues'][_0x2f165d[_0x981e('0x2a')]]?this[_0x981e('0xc')][_0x2f165d[_0x981e('0x2a')]][_0x981e('0x2b')]||![]:![],'type':this[_0x981e('0xc')][_0x2f165d[_0x981e('0x2a')]]?this[_0x981e('0xc')][_0x2f165d[_0x981e('0x2a')]][_0x981e('0x2c')]||'inbound':'inbound','variables':this['variables'][_0x2f165d[_0x981e('0x26')]],'motionChannel':_0x981e('0x2d')};}_[_0x981e('0x2e')](this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]][_0x2f165d[_0x981e('0x23')]],_[_0x981e('0x2f')](_0x2f165d,['event','privilege']));logger[_0x981e('0x24')](_0x981e('0x30'),_0x2f165d[_0x981e('0x26')],util[_0x981e('0x27')](this[_0x981e('0xa')][_0x2f165d['uniqueid']][_0x2f165d['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')](_0x981e('0x31'),this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]][_0x2f165d['destuniqueid']]);var _0x5540ce={'id':this[_0x981e('0xd')][_0x2f165d['interface']]['id'],'calleridnum':this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]][_0x2f165d[_0x981e('0x23')]][_0x981e('0x32')],'queue':this[_0x981e('0xa')][_0x2f165d[_0x981e('0x26')]][_0x2f165d[_0x981e('0x23')]][_0x981e('0x2a')],'variables':this['channels'][_0x2f165d['uniqueid']][_0x2f165d[_0x981e('0x23')]]['variables']};logger[_0x981e('0x24')](_0x981e('0x33'),_0x2f165d['uniqueid'],util['inspect'](_0x5540ce,{'showHidden':![],'depth':null}));this[_0x981e('0x1b')](util[_0x981e('0x34')](_0x981e('0x35'),_0x2f165d[_0x981e('0x22')]),_0x981e('0x36'),_0x5540ce);}}catch(_0x248f73){logger['error'](_0x981e('0x37'),_0x2f165d[_0x981e('0x26')],util[_0x981e('0x27')](_0x248f73,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')]['syncAgentConnect']=function(_0x400fdc){try{if(this['isNotNull'](_0x400fdc)){if(this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]]){logger[_0x981e('0x24')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x400fdc[_0x981e('0x26')],util[_0x981e('0x27')](_0x400fdc,{'showHidden':![],'depth':null}));for(var _0x5673f0 in this[_0x981e('0xa')][_0x400fdc['uniqueid']]){if(this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]]['hasOwnProperty'](_0x5673f0)){if(_0x400fdc[_0x981e('0x23')]===_0x5673f0){logger[_0x981e('0x20')](_0x981e('0x38'),_0x400fdc['uniqueid'],_0x400fdc[_0x981e('0x22')],_0x400fdc[_0x981e('0x23')]);this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x39')]=moment()[_0x981e('0x34')](_0x981e('0x28'));this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x3a')]=_0x400fdc['connectedlinename'];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x3b')]=_0x400fdc[_0x981e('0x3b')];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]['destchannelstate']=_0x400fdc[_0x981e('0x3c')];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]['destchannelstatedesc']=_0x400fdc[_0x981e('0x3d')];this[_0x981e('0xa')][_0x400fdc['uniqueid']][_0x5673f0][_0x981e('0x3e')]=_0x400fdc['holdtime'];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x3f')]=_0x981e('0x40');if(this[_0x981e('0xb')][this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]['uniqueid']]){var _0x3729cc=this[_0x981e('0xb')][this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x26')]][_0x981e('0x41')];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x41')]=_0x3729cc;_0x400fdc[_0x981e('0x41')]=_0x3729cc;}_[_0x981e('0x2e')](this[_0x981e('0xd')][_0x400fdc[_0x981e('0x42')]],_[_0x981e('0x43')](_0x400fdc,[_0x981e('0x2a'),_0x981e('0x44'),_0x981e('0x41')]));logger[_0x981e('0x24')](_0x981e('0x45'),_0x400fdc[_0x981e('0x26')],util[_0x981e('0x27')](this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x400fdc[_0x981e('0x23')]],{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')](_0x981e('0x46'),this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x400fdc['destuniqueid']]);logger[_0x981e('0x24')](_0x981e('0x47'),_0x400fdc[_0x981e('0x26')],util[_0x981e('0x27')](this[_0x981e('0xa')][_0x400fdc['uniqueid']][_0x400fdc['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x981e('0x34')]('user:%s',_0x400fdc[_0x981e('0x22')]),_0x981e('0x48'),this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x400fdc[_0x981e('0x23')]]);}else if(!this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x49')]&&!this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x14')]){logger[_0x981e('0x20')](_0x981e('0x4a'),_0x400fdc[_0x981e('0x26')],this['channels'][_0x400fdc['uniqueid']][_0x5673f0]['membername'],_0x5673f0);this['channels'][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x49')]=!![];this['channels'][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x4b')]=moment()[_0x981e('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]['answeredelsewheredestinationuniqueid']=_0x400fdc[_0x981e('0x23')];this['channels'][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x4c')]=_0x400fdc[_0x981e('0x22')];this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0][_0x981e('0x3f')]=_0x981e('0x4d');this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]['reason']=_0x981e('0x4d');logger['debug'](_0x981e('0x4e'),_0x400fdc[_0x981e('0x26')],util[_0x981e('0x27')](this['channels'][_0x400fdc[_0x981e('0x26')]][_0x5673f0],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0x981e('0xa')][_0x400fdc[_0x981e('0x26')]][_0x5673f0]);}}}}}}catch(_0xd5ff00){logger[_0x981e('0x4f')](_0x981e('0x50'),_0x400fdc[_0x981e('0x26')],util[_0x981e('0x27')](_0xd5ff00,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x11')]=function(_0x57cef5){try{if(this[_0x981e('0x1d')](_0x57cef5)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x57cef5[_0x981e('0x26')],util[_0x981e('0x27')](_0x57cef5,{'showHidden':![],'depth':null}));if(this[_0x981e('0xa')][_0x57cef5['uniqueid']]&&this[_0x981e('0xa')][_0x57cef5[_0x981e('0x26')]][_0x57cef5[_0x981e('0x23')]]){logger[_0x981e('0x20')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x57cef5[_0x981e('0x26')],_0x57cef5[_0x981e('0x22')],_0x57cef5[_0x981e('0x23')]);this['channels'][_0x57cef5[_0x981e('0x26')]][_0x57cef5[_0x981e('0x23')]][_0x981e('0x49')]=!![];this[_0x981e('0xa')][_0x57cef5[_0x981e('0x26')]][_0x57cef5['destuniqueid']][_0x981e('0x4b')]=moment()[_0x981e('0x34')](_0x981e('0x28'));this['channels'][_0x57cef5[_0x981e('0x26')]][_0x57cef5[_0x981e('0x23')]][_0x981e('0x3f')]='rejected';this[_0x981e('0xa')][_0x57cef5[_0x981e('0x26')]][_0x57cef5[_0x981e('0x23')]][_0x981e('0x51')]=_0x981e('0x52');logger[_0x981e('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x57cef5[_0x981e('0x26')],util[_0x981e('0x27')](this[_0x981e('0xa')][_0x57cef5['uniqueid']][_0x57cef5[_0x981e('0x23')]],{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')](_0x981e('0x53'),this[_0x981e('0xa')][_0x57cef5[_0x981e('0x26')]][_0x57cef5[_0x981e('0x23')]]);}}}catch(_0x4623b6){logger[_0x981e('0x4f')](_0x981e('0x54'),_0x57cef5[_0x981e('0x26')],util[_0x981e('0x27')](_0x4623b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')]['syncQueueCallerAbandon']=function(_0x4d3cb0){try{if(this[_0x981e('0x1d')](_0x4d3cb0)){logger[_0x981e('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x4d3cb0[_0x981e('0x26')],util[_0x981e('0x27')](_0x4d3cb0,{'showHidden':![],'depth':null}));if(this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]]){for(var _0x583169 in this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]]){if(this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]]['hasOwnProperty'](_0x583169)&&!this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169][_0x981e('0x49')]&&!this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169][_0x981e('0x14')]){logger[_0x981e('0x20')](_0x981e('0x55'),_0x4d3cb0[_0x981e('0x26')],this[_0x981e('0xa')][_0x4d3cb0['uniqueid']][_0x583169]['membername'],_0x583169);this['channels'][_0x4d3cb0[_0x981e('0x26')]][_0x583169][_0x981e('0x49')]=!![];this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169][_0x981e('0x4b')]=moment()[_0x981e('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169][_0x981e('0x3f')]=_0x981e('0x56');this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169]['reason']=_0x981e('0x56');logger[_0x981e('0x24')](_0x981e('0x57'),_0x4d3cb0[_0x981e('0x26')],util['inspect'](this['channels'][_0x4d3cb0['uniqueid']][_0x583169],{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')]('custom:agentqueuecallerabandon',this[_0x981e('0xa')][_0x4d3cb0[_0x981e('0x26')]][_0x583169]);}}}}}catch(_0x12c142){logger[_0x981e('0x4f')]('[%s][voiceAgentReport][queuecallerabandon]',_0x4d3cb0[_0x981e('0x26')],util[_0x981e('0x27')](_0x12c142,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x2ebc86){try{if(this['isNotNull'](_0x2ebc86)){logger['debug'](_0x981e('0x58'),_0x2ebc86[_0x981e('0x26')],util[_0x981e('0x27')](_0x2ebc86,{'showHidden':![],'depth':null}));if(this['channels'][_0x2ebc86[_0x981e('0x26')]]){for(var _0x4f60c7 in this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]]){if(this[_0x981e('0xa')][_0x2ebc86['uniqueid']]['hasOwnProperty'](_0x4f60c7)){if(this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x39')]&&!this[_0x981e('0xa')][_0x2ebc86['uniqueid']][_0x4f60c7][_0x981e('0x14')]){logger[_0x981e('0x20')](_0x981e('0x59'),_0x2ebc86[_0x981e('0x26')],this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x22')],_0x4f60c7);this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x14')]=!![];this[_0x981e('0xa')][_0x2ebc86['uniqueid']][_0x4f60c7][_0x981e('0x5a')]=moment()[_0x981e('0x34')](_0x981e('0x28'));this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x3f')]=_0x981e('0x5b');this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x51')]=_0x2ebc86[_0x981e('0x51')]==_0x981e('0x5c')?_0x981e('0x5d'):_0x2ebc86[_0x981e('0x51')];this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x5e')]=_0x2ebc86[_0x981e('0x5e')];if(this['voiceQueues'][_0x2ebc86['queue']]&&this[_0x981e('0xc')][_0x2ebc86[_0x981e('0x2a')]][_0x981e('0x5f')]){this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7][_0x981e('0x60')]=this['voiceQueues'][_0x2ebc86[_0x981e('0x2a')]][_0x981e('0x61')];this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7]['agentacw']=!![];}this[_0x981e('0xd')][_0x2ebc86['interface']]=_[_0x981e('0x2f')](this[_0x981e('0xd')][_0x2ebc86[_0x981e('0x42')]],['queue',_0x981e('0x44')]);logger[_0x981e('0x24')](_0x981e('0x62'),_0x2ebc86[_0x981e('0x26')],util[_0x981e('0x27')](this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7],{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')]('custom:agentcomplete',this[_0x981e('0xa')][_0x2ebc86[_0x981e('0x26')]][_0x4f60c7]);logger[_0x981e('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2ebc86['uniqueid'],util['inspect']({'id':this['agents'][_0x2ebc86['interface']]['id'],'destaccountcode':_0x2ebc86[_0x981e('0x63')]},{'showHidden':![],'depth':null}));this[_0x981e('0x1b')](util['format']('user:%s',_0x2ebc86[_0x981e('0x22')]),'user:agentcomplete',{'id':this[_0x981e('0xd')][_0x2ebc86[_0x981e('0x42')]]['id'],'destaccountcode':_0x2ebc86[_0x981e('0x63')]});}}}}}}catch(_0x558b92){logger[_0x981e('0x4f')](_0x981e('0x64'),_0x2ebc86[_0x981e('0x26')],util[_0x981e('0x27')](_0x558b92,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x65')]=function(_0x19ad40){try{if(this[_0x981e('0x1d')](_0x19ad40)){logger[_0x981e('0x24')](_0x981e('0x66'),_0x19ad40['uniqueid'],util[_0x981e('0x27')](_0x19ad40,{'showHidden':![],'depth':null}));this[_0x981e('0x67')](_0x19ad40['uniqueid'],_[_0x981e('0x68')](_0x19ad40['variable'])[0x0],_0x19ad40['value']);if(this[_0x981e('0xa')][_0x19ad40['uniqueid']]){for(var _0x1cafa7 in this[_0x981e('0xa')][_0x19ad40['uniqueid']]){if(this['channels'][_0x19ad40[_0x981e('0x26')]][_0x981e('0x69')](_0x1cafa7)){logger[_0x981e('0x20')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x19ad40[_0x981e('0x26')],_0x1cafa7,_[_0x981e('0x68')](_0x19ad40[_0x981e('0x6a')])[0x0],_0x19ad40['value']);if(_[_0x981e('0x1e')](this[_0x981e('0xa')][_0x19ad40['uniqueid']][_0x1cafa7][_0x981e('0xe')])){this[_0x981e('0xa')][_0x19ad40[_0x981e('0x26')]][_0x1cafa7][_0x981e('0xe')]={};}this[_0x981e('0xa')][_0x19ad40[_0x981e('0x26')]][_0x1cafa7][_0x981e('0xe')]=this[_0x981e('0xe')][_0x19ad40[_0x981e('0x26')]];}}}}}catch(_0x516ec9){logger[_0x981e('0x4f')](_0x981e('0x6b'),_0x19ad40[_0x981e('0x26')],util[_0x981e('0x27')](_0x516ec9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')]['addVariable']=function(_0x547612,_0xc85676,_0x1c9b70){var _0x191e09=[_0x981e('0x6c'),_0x981e('0x6d'),_0x981e('0x6e'),_0x981e('0x6f'),_0x981e('0x70'),_0x981e('0x71'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x981e('0x72'),_0x981e('0x73'),_0x981e('0x74'),_0x981e('0x75'),_0x981e('0x76'),_0x981e('0x77'),_0x981e('0x78'),_0x981e('0x79'),_0x981e('0x22'),'memberpenalty','memberrealtime'];if(!_[_0x981e('0x7a')](_0xc85676)&&!_[_0x981e('0x7b')](_0x191e09,_0xc85676)){if(_[_0x981e('0x1e')](this[_0x981e('0xe')][_0x547612])){this[_0x981e('0xe')][_0x547612]={};}this[_0x981e('0xe')][_0x547612][_0xc85676]=_0x1c9b70;}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x7c')]=function(_0x5c5464){try{if(this['isNotNull'](_0x5c5464)){logger[_0x981e('0x24')](_0x981e('0x7d'),_0x5c5464[_0x981e('0x26')],util[_0x981e('0x27')](_0x5c5464,{'showHidden':![],'depth':null}));if(this[_0x981e('0xa')][_0x5c5464['uniqueid']]){for(var _0x4901f2 in this[_0x981e('0xa')][_0x5c5464[_0x981e('0x26')]]){if(this[_0x981e('0xa')][_0x5c5464[_0x981e('0x26')]][_0x981e('0x69')](_0x4901f2)){if(this[_0x981e('0xa')][_0x5c5464[_0x981e('0x26')]][_0x4901f2]['reason']==_0x981e('0x5c')&&this[_0x981e('0xa')][_0x5c5464[_0x981e('0x26')]][_0x4901f2]['agentcomplete']){logger[_0x981e('0x20')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5c5464['uniqueid'],_0x4901f2);this[_0x981e('0xa')][_0x5c5464[_0x981e('0x26')]][_0x4901f2][_0x981e('0x5a')]=moment()['format'](_0x981e('0x28'));}}}logger[_0x981e('0x24')](_0x981e('0x7e'),_0x5c5464[_0x981e('0x26')],util[_0x981e('0x27')](_[_0x981e('0x7f')](this[_0x981e('0xa')][_0x5c5464['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x981e('0x1b')](_0x981e('0x80'),_[_0x981e('0x7f')](this['channels'][_0x5c5464['uniqueid']]));delete this['channels'][_0x5c5464['uniqueid']];}if(this[_0x981e('0xe')][_0x5c5464[_0x981e('0x26')]]){delete this[_0x981e('0xe')][_0x5c5464[_0x981e('0x26')]];}}}catch(_0x3189b6){logger[_0x981e('0x4f')]('[%s][voiceAgentReport][hangup]',_0x5c5464[_0x981e('0x26')],util['inspect'](_0x3189b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x18')]=function(_0x344a21){try{if(this['isNotNull'](_0x344a21)){logger[_0x981e('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x344a21[_0x981e('0x26')],util['inspect'](_0x344a21,{'showHidden':![],'depth':null}));if(this['channels'][_0x344a21['transfereeuniqueid']]){for(var _0x5be960 in this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]]){if(this[_0x981e('0xa')][_0x344a21['transfereeuniqueid']][_0x981e('0x69')](_0x5be960)){if(_0x344a21['origtransfereruniqueid']===_0x5be960){logger[_0x981e('0x20')](_0x981e('0x82'),_0x344a21[_0x981e('0x26')],this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]][_0x5be960][_0x981e('0x22')],_0x5be960);var _0x5b4d8b=moment();this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]][_0x5be960][_0x981e('0x14')]=!![];this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]][_0x5be960]['agentcompleteAt']=moment()[_0x981e('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x344a21['transfereeuniqueid']][_0x5be960][_0x981e('0x3f')]=_0x981e('0x5b');this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]][_0x5be960][_0x981e('0x51')]=_0x981e('0x5c');this['channels'][_0x344a21[_0x981e('0x81')]][_0x5be960][_0x981e('0x5e')]=_0x5b4d8b[_0x981e('0x83')](this['channels'][_0x344a21[_0x981e('0x81')]][_0x5be960][_0x981e('0x39')],_0x981e('0x84'));}}}}if(this[_0x981e('0xa')][_0x344a21[_0x981e('0x85')]]){var _0x94ab7d=this[_0x981e('0xa')][_0x344a21[_0x981e('0x85')]];this[_0x981e('0xa')][_0x344a21['secondtransfereruniqueid']]=this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]];this[_0x981e('0xa')][_0x344a21[_0x981e('0x81')]]=_0x94ab7d;}}}catch(_0x10acd5){logger[_0x981e('0x4f')](_0x981e('0x86'),_0x344a21[_0x981e('0x26')],util['inspect'](_0x10acd5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x1a')]=function(_0x44c8d4){try{if(this['isNotNull'](_0x44c8d4)){logger['debug'](_0x981e('0x87'),_0x44c8d4[_0x981e('0x26')],util[_0x981e('0x27')](_0x44c8d4,{'showHidden':![],'depth':null}));if(this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]]){for(var _0x1a5998 in this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]]){if(this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]][_0x981e('0x69')](_0x1a5998)){if(_0x44c8d4[_0x981e('0x88')]===_0x1a5998){logger[_0x981e('0x20')](_0x981e('0x89'),_0x44c8d4[_0x981e('0x26')],this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]][_0x1a5998][_0x981e('0x22')],_0x1a5998);var _0x1a9bae=moment();this[_0x981e('0xa')][_0x44c8d4['transfereeuniqueid']][_0x1a5998][_0x981e('0x14')]=!![];this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]][_0x1a5998][_0x981e('0x5a')]=_0x1a9bae;this['channels'][_0x44c8d4['transfereeuniqueid']][_0x1a5998][_0x981e('0x3f')]=_0x981e('0x5b');this['channels'][_0x44c8d4[_0x981e('0x81')]][_0x1a5998]['reason']=_0x981e('0x5c');this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]][_0x1a5998][_0x981e('0x5e')]=_0x1a9bae[_0x981e('0x83')](this[_0x981e('0xa')][_0x44c8d4[_0x981e('0x81')]][_0x1a5998][_0x981e('0x39')],'seconds');}}}}}}catch(_0x5792d2){logger['error'](_0x981e('0x8a'),_0x44c8d4['uniqueid'],util[_0x981e('0x27')](_0x5792d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x8b')]=function(_0x13c0ea){var _0x3a923b='';try{if(this[_0x981e('0x1d')](_0x13c0ea)){logger[_0x981e('0x24')](_0x981e('0x8c'),_0x13c0ea['uniqueid'],util['inspect'](_0x13c0ea,{'showHidden':![],'depth':null}));if(_0x13c0ea['channel']){_0x3a923b=_0x13c0ea[_0x981e('0x8d')][_0x981e('0x8e')](0x0,_0x13c0ea[_0x981e('0x8d')]['lastIndexOf']('-'));if(this['agents'][_0x3a923b]){logger[_0x981e('0x20')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x13c0ea[_0x981e('0x26')],_0x3a923b);this[_0x981e('0xd')][_0x3a923b][_0x981e('0x8f')]=!![];}}}}catch(_0xb957d8){logger['error'](_0x981e('0x90'),_0x13c0ea[_0x981e('0x26')],util[_0x981e('0x27')](_0xb957d8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x981e('0x1c')][_0x981e('0x91')]=function(_0x3f6e50){var _0x468d31='';try{if(this[_0x981e('0x1d')](_0x3f6e50)){logger['debug'](_0x981e('0x92'),_0x3f6e50[_0x981e('0x26')],util['inspect'](_0x3f6e50,{'showHidden':![],'depth':null}));if(_0x3f6e50[_0x981e('0x8d')]){_0x468d31=_0x3f6e50[_0x981e('0x8d')][_0x981e('0x8e')](0x0,_0x3f6e50[_0x981e('0x8d')][_0x981e('0x93')]('-'));if(this[_0x981e('0xd')][_0x468d31]){logger[_0x981e('0x20')](_0x981e('0x94'),_0x3f6e50['uniqueid'],_0x468d31);this[_0x981e('0xd')][_0x468d31]['onhold']=![];}}}}catch(_0x9e9524){logger[_0x981e('0x4f')](_0x981e('0x95'),_0x3f6e50['uniqueid'],util[_0x981e('0x27')](_0x9e9524,{'showHidden':![],'depth':null}));}};module[_0x981e('0x96')]=VoiceAgentReport; \ No newline at end of file +var _0xd31b=['isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','variables','voice','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','prototype','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:%s','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','keys','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','isNotNull'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xd31b,0x1b5));var _0xbd31=function(_0x53e6a8,_0x5839ab){_0x53e6a8=_0x53e6a8-0x0;var _0x2b6dcc=_0xd31b[_0x53e6a8];return _0x2b6dcc;};'use strict';var _=require(_0xbd31('0x0'));var moment=require(_0xbd31('0x1'));var util=require(_0xbd31('0x2'));var Redis=require(_0xbd31('0x3'));var config=require(_0xbd31('0x4'));var logger=require(_0xbd31('0x5'))(_0xbd31('0x6'));var ami=require(_0xbd31('0x7'));config[_0xbd31('0x8')]=_['defaults'](config[_0xbd31('0x8')],{'host':_0xbd31('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd31('0x8')]));function VoiceAgentReport(_0x4321a4){this[_0xbd31('0xa')]={};this[_0xbd31('0xb')]=_0x4321a4[_0xbd31('0xa')];this[_0xbd31('0xc')]=_0x4321a4['voiceQueues'];this[_0xbd31('0xd')]=_0x4321a4['agents'];this['variables']={};ami['on'](_0xbd31('0xe'),this[_0xbd31('0xf')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x11'),this[_0xbd31('0x12')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x13'),this[_0xbd31('0x14')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x15'),this[_0xbd31('0x16')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x17'),this[_0xbd31('0x18')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x19'),this[_0xbd31('0x1a')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x1b'),this[_0xbd31('0x1c')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x1d'),this[_0xbd31('0x1e')][_0xbd31('0x10')](this));ami['on'](_0xbd31('0x1f'),this['syncMusicOnHoldStop'][_0xbd31('0x10')](this));ami['on']('attendedtransfer',this[_0xbd31('0x20')]['bind'](this));ami['on'](_0xbd31('0x21'),this[_0xbd31('0x22')][_0xbd31('0x10')](this));}VoiceAgentReport['prototype'][_0xbd31('0x23')]=function(_0xff2f7e,_0x3a8215,_0x28c2e4){io['to'](_0xff2f7e)[_0xbd31('0x23')](_0x3a8215,_0x28c2e4);};VoiceAgentReport['prototype'][_0xbd31('0x24')]=function(_0x3c0900){return _0x3c0900!==null&&!_[_0xbd31('0x25')](_0x3c0900);};VoiceAgentReport['prototype'][_0xbd31('0xf')]=function(_0x4620ac){try{if(this[_0xbd31('0x24')](_0x4620ac)){logger[_0xbd31('0x26')](_0xbd31('0x27'),_0x4620ac[_0xbd31('0x28')],_0x4620ac[_0xbd31('0x29')],_0x4620ac[_0xbd31('0x2a')]);logger[_0xbd31('0x2b')](_0xbd31('0x2c'),_0x4620ac[_0xbd31('0x28')],util['inspect'](_0x4620ac,{'showHidden':![],'depth':null}));if(_[_0xbd31('0x25')](this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]])){this[_0xbd31('0xa')][_0x4620ac['uniqueid']]={};}if(_[_0xbd31('0x25')](this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]])){this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]]={'agentcalledAt':moment()[_0xbd31('0x2d')](_0xbd31('0x2e')),'lastevent':_0xbd31('0x2f'),'mandatoryDisposition':this[_0xbd31('0xc')][_0x4620ac['queue']]?this[_0xbd31('0xc')][_0x4620ac[_0xbd31('0x30')]][_0xbd31('0x31')]||![]:![],'type':this[_0xbd31('0xc')][_0x4620ac[_0xbd31('0x30')]]?this[_0xbd31('0xc')][_0x4620ac['queue']]['type']||_0xbd31('0x32'):_0xbd31('0x32'),'variables':this[_0xbd31('0x33')][_0x4620ac[_0xbd31('0x28')]],'motionChannel':_0xbd31('0x34')};}_[_0xbd31('0x35')](this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac['destuniqueid']],_[_0xbd31('0x36')](_0x4620ac,[_0xbd31('0x37'),_0xbd31('0x38')]));logger[_0xbd31('0x2b')](_0xbd31('0x39'),_0x4620ac[_0xbd31('0x28')],util[_0xbd31('0x3a')](this['channels'][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]],{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x3b'),this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]]);var _0x4217eb={'id':this[_0xbd31('0xd')][_0x4620ac[_0xbd31('0x3c')]]['id'],'calleridnum':this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac['destuniqueid']][_0xbd31('0x3d')],'queue':this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]][_0xbd31('0x30')],'variables':this[_0xbd31('0xa')][_0x4620ac[_0xbd31('0x28')]][_0x4620ac[_0xbd31('0x2a')]]['variables']};logger[_0xbd31('0x2b')](_0xbd31('0x3e'),_0x4620ac['uniqueid'],util['inspect'](_0x4217eb,{'showHidden':![],'depth':null}));this['emit'](util[_0xbd31('0x2d')]('user:%s',_0x4620ac[_0xbd31('0x29')]),_0xbd31('0x3f'),_0x4217eb);}}catch(_0x1a0339){logger[_0xbd31('0x40')]('[%s][voiceAgentReport][agentcalled]',_0x4620ac[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x1a0339,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x12')]=function(_0x6f301c){try{if(this[_0xbd31('0x24')](_0x6f301c)){if(this['channels'][_0x6f301c['uniqueid']]){logger[_0xbd31('0x2b')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x6f301c[_0xbd31('0x28')],util['inspect'](_0x6f301c,{'showHidden':![],'depth':null}));for(var _0x4159b2 in this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]]){if(this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0xbd31('0x42')](_0x4159b2)){if(_0x6f301c['destuniqueid']===_0x4159b2){logger['info'](_0xbd31('0x43'),_0x6f301c['uniqueid'],_0x6f301c[_0xbd31('0x29')],_0x6f301c[_0xbd31('0x2a')]);this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x44')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2]['connectedlinename']=_0x6f301c[_0xbd31('0x45')];this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x46')]=_0x6f301c[_0xbd31('0x46')];this['channels'][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x47')]=_0x6f301c[_0xbd31('0x47')];this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x48')]=_0x6f301c['destchannelstatedesc'];this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x49')]=_0x6f301c[_0xbd31('0x49')];this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x4a')]=_0xbd31('0x4b');if(this[_0xbd31('0xb')][this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x28')]]){var _0x4fbae9=this[_0xbd31('0xb')][this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x28')]][_0xbd31('0x4c')];this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x4159b2]['routealias']=_0x4fbae9;_0x6f301c['routealias']=_0x4fbae9;}_['merge'](this['agents'][_0x6f301c[_0xbd31('0x3c')]],_[_0xbd31('0x4d')](_0x6f301c,[_0xbd31('0x30'),'destconnectedlinenum','routealias']));logger['debug'](_0xbd31('0x4e'),_0x6f301c[_0xbd31('0x28')],util[_0xbd31('0x3a')](this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x6f301c[_0xbd31('0x2a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xbd31('0x4f'),this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x6f301c['destuniqueid']]);logger[_0xbd31('0x2b')](_0xbd31('0x50'),_0x6f301c['uniqueid'],util['inspect'](this['channels'][_0x6f301c[_0xbd31('0x28')]][_0x6f301c[_0xbd31('0x2a')]],{'showHidden':![],'depth':null}));this[_0xbd31('0x23')](util[_0xbd31('0x2d')]('user:%s',_0x6f301c['membername']),_0xbd31('0x51'),this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x6f301c[_0xbd31('0x2a')]]);}else if(!this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x13')]&&!this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x17')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x6f301c['uniqueid'],this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2]['membername'],_0x4159b2);this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x13')]=!![];this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2]['agentringnoanswerAt']=moment()[_0xbd31('0x2d')](_0xbd31('0x2e'));this['channels'][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x52')]=_0x6f301c[_0xbd31('0x2a')];this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x53')]=_0x6f301c[_0xbd31('0x29')];this[_0xbd31('0xa')][_0x6f301c['uniqueid']][_0x4159b2][_0xbd31('0x4a')]=_0xbd31('0x54');this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2][_0xbd31('0x55')]=_0xbd31('0x54');logger[_0xbd31('0x2b')](_0xbd31('0x56'),_0x6f301c[_0xbd31('0x28')],util['inspect'](this['channels'][_0x6f301c[_0xbd31('0x28')]][_0x4159b2],{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x57'),this[_0xbd31('0xa')][_0x6f301c[_0xbd31('0x28')]][_0x4159b2]);}}}}}}catch(_0x45a8dd){logger[_0xbd31('0x40')](_0xbd31('0x58'),_0x6f301c['uniqueid'],util[_0xbd31('0x3a')](_0x45a8dd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x14')]=function(_0x1d1093){try{if(this[_0xbd31('0x24')](_0x1d1093)){logger[_0xbd31('0x2b')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x1d1093[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x1d1093,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]]&&this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]][_0x1d1093[_0xbd31('0x2a')]]){logger[_0xbd31('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1d1093['uniqueid'],_0x1d1093[_0xbd31('0x29')],_0x1d1093[_0xbd31('0x2a')]);this[_0xbd31('0xa')][_0x1d1093['uniqueid']][_0x1d1093[_0xbd31('0x2a')]][_0xbd31('0x13')]=!![];this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]][_0x1d1093['destuniqueid']]['agentringnoanswerAt']=moment()[_0xbd31('0x2d')](_0xbd31('0x2e'));this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]][_0x1d1093[_0xbd31('0x2a')]][_0xbd31('0x4a')]=_0xbd31('0x59');this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]][_0x1d1093[_0xbd31('0x2a')]]['reason']=_0xbd31('0x59');logger[_0xbd31('0x2b')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x1d1093[_0xbd31('0x28')],util['inspect'](this[_0xbd31('0xa')][_0x1d1093[_0xbd31('0x28')]][_0x1d1093[_0xbd31('0x2a')]],{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x5a'),this['channels'][_0x1d1093['uniqueid']][_0x1d1093[_0xbd31('0x2a')]]);}}}catch(_0x58ed31){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x1d1093['uniqueid'],util[_0xbd31('0x3a')](_0x58ed31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')]['syncQueueCallerAbandon']=function(_0x5a1859){try{if(this[_0xbd31('0x24')](_0x5a1859)){logger[_0xbd31('0x2b')](_0xbd31('0x5b'),_0x5a1859[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x5a1859,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]]){for(var _0x174cab in this['channels'][_0x5a1859[_0xbd31('0x28')]]){if(this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0xbd31('0x42')](_0x174cab)&&!this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x13')]&&!this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x17')]){logger['info'](_0xbd31('0x5c'),_0x5a1859[_0xbd31('0x28')],this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x29')],_0x174cab);this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x13')]=!![];this[_0xbd31('0xa')][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x5d')]=moment()[_0xbd31('0x2d')](_0xbd31('0x2e'));this['channels'][_0x5a1859[_0xbd31('0x28')]][_0x174cab][_0xbd31('0x4a')]=_0xbd31('0x5e');this['channels'][_0x5a1859[_0xbd31('0x28')]][_0x174cab]['reason']=_0xbd31('0x5e');logger[_0xbd31('0x2b')](_0xbd31('0x5f'),_0x5a1859[_0xbd31('0x28')],util['inspect'](this['channels'][_0x5a1859[_0xbd31('0x28')]][_0x174cab],{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x60'),this[_0xbd31('0xa')][_0x5a1859['uniqueid']][_0x174cab]);}}}}}catch(_0x4daa7a){logger[_0xbd31('0x40')](_0xbd31('0x61'),_0x5a1859[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x4daa7a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')]['syncAgentComplete']=function(_0xd1b675){try{if(this[_0xbd31('0x24')](_0xd1b675)){logger[_0xbd31('0x2b')](_0xbd31('0x62'),_0xd1b675['uniqueid'],util[_0xbd31('0x3a')](_0xd1b675,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0xd1b675['uniqueid']]){for(var _0x2ad511 in this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]]){if(this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0xbd31('0x42')](_0x2ad511)){if(this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511][_0xbd31('0x44')]&&!this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511]['agentcomplete']){logger[_0xbd31('0x26')](_0xbd31('0x63'),_0xd1b675[_0xbd31('0x28')],this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511]['membername'],_0x2ad511);this[_0xbd31('0xa')][_0xd1b675['uniqueid']][_0x2ad511]['agentcomplete']=!![];this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511][_0xbd31('0x64')]=moment()[_0xbd31('0x2d')](_0xbd31('0x2e'));this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511][_0xbd31('0x4a')]=_0xbd31('0x65');this['channels'][_0xd1b675['uniqueid']][_0x2ad511][_0xbd31('0x55')]=_0xd1b675[_0xbd31('0x55')]==_0xbd31('0x66')?_0xbd31('0x67'):_0xd1b675[_0xbd31('0x55')];this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511][_0xbd31('0x68')]=_0xd1b675[_0xbd31('0x68')];if(this[_0xbd31('0xc')][_0xd1b675[_0xbd31('0x30')]]&&this['voiceQueues'][_0xd1b675[_0xbd31('0x30')]][_0xbd31('0x69')]){this['channels'][_0xd1b675[_0xbd31('0x28')]][_0x2ad511]['acwtime']=this[_0xbd31('0xc')][_0xd1b675['queue']][_0xbd31('0x6a')];this[_0xbd31('0xa')][_0xd1b675[_0xbd31('0x28')]][_0x2ad511]['agentacw']=!![];}this['agents'][_0xd1b675[_0xbd31('0x3c')]]=_['omit'](this['agents'][_0xd1b675['interface']],[_0xbd31('0x30'),'destconnectedlinenum']);logger[_0xbd31('0x2b')](_0xbd31('0x6b'),_0xd1b675[_0xbd31('0x28')],util[_0xbd31('0x3a')](this[_0xbd31('0xa')][_0xd1b675['uniqueid']][_0x2ad511],{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x6c'),this[_0xbd31('0xa')][_0xd1b675['uniqueid']][_0x2ad511]);logger[_0xbd31('0x2b')](_0xbd31('0x6d'),_0xd1b675['uniqueid'],util[_0xbd31('0x3a')]({'id':this[_0xbd31('0xd')][_0xd1b675['interface']]['id'],'destaccountcode':_0xd1b675[_0xbd31('0x6e')]},{'showHidden':![],'depth':null}));this[_0xbd31('0x23')](util[_0xbd31('0x2d')](_0xbd31('0x6f'),_0xd1b675[_0xbd31('0x29')]),_0xbd31('0x70'),{'id':this[_0xbd31('0xd')][_0xd1b675[_0xbd31('0x3c')]]['id'],'destaccountcode':_0xd1b675[_0xbd31('0x6e')]});}}}}}}catch(_0x10e6e3){logger[_0xbd31('0x40')]('[%s][voiceAgentReport][agentcomplete]',_0xd1b675['uniqueid'],util['inspect'](_0x10e6e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x1a')]=function(_0x50784c){try{if(this[_0xbd31('0x24')](_0x50784c)){logger[_0xbd31('0x2b')](_0xbd31('0x71'),_0x50784c[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x50784c,{'showHidden':![],'depth':null}));this['addVariable'](_0x50784c[_0xbd31('0x28')],_[_0xbd31('0x72')](_0x50784c['variable'])[0x0],_0x50784c['value']);if(this['channels'][_0x50784c['uniqueid']]){for(var _0x1e768c in this['channels'][_0x50784c['uniqueid']]){if(this['channels'][_0x50784c[_0xbd31('0x28')]][_0xbd31('0x42')](_0x1e768c)){logger[_0xbd31('0x26')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x50784c['uniqueid'],_0x1e768c,_[_0xbd31('0x72')](_0x50784c[_0xbd31('0x73')])[0x0],_0x50784c['value']);if(_[_0xbd31('0x25')](this['channels'][_0x50784c['uniqueid']][_0x1e768c]['variables'])){this[_0xbd31('0xa')][_0x50784c[_0xbd31('0x28')]][_0x1e768c][_0xbd31('0x33')]={};}this['channels'][_0x50784c['uniqueid']][_0x1e768c][_0xbd31('0x33')]=this[_0xbd31('0x33')][_0x50784c[_0xbd31('0x28')]];}}}}}catch(_0x5c1db0){logger['error'](_0xbd31('0x74'),_0x50784c[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x5c1db0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbd31('0x75')]=function(_0x80b987,_0x41adc4,_0x40c365){var _0x203523=[_0xbd31('0x76'),_0xbd31('0x77'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xbd31('0x78'),_0xbd31('0x79'),_0xbd31('0x7a'),_0xbd31('0x7b'),_0xbd31('0x7c'),_0xbd31('0x7d'),'bridgepvtcallid',_0xbd31('0x7e'),_0xbd31('0x7f'),_0xbd31('0x80'),_0xbd31('0x81'),'membername',_0xbd31('0x82'),_0xbd31('0x83')];if(!_['isNil'](_0x41adc4)&&!_[_0xbd31('0x84')](_0x203523,_0x41adc4)){if(_['isUndefined'](this[_0xbd31('0x33')][_0x80b987])){this[_0xbd31('0x33')][_0x80b987]={};}this[_0xbd31('0x33')][_0x80b987][_0x41adc4]=_0x40c365;}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x1c')]=function(_0x140af4){try{if(this[_0xbd31('0x24')](_0x140af4)){logger['debug'](_0xbd31('0x85'),_0x140af4[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x140af4,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0x140af4[_0xbd31('0x28')]]){for(var _0x4837b2 in this['channels'][_0x140af4['uniqueid']]){if(this[_0xbd31('0xa')][_0x140af4[_0xbd31('0x28')]][_0xbd31('0x42')](_0x4837b2)){if(this[_0xbd31('0xa')][_0x140af4[_0xbd31('0x28')]][_0x4837b2][_0xbd31('0x55')]==_0xbd31('0x66')&&this['channels'][_0x140af4[_0xbd31('0x28')]][_0x4837b2][_0xbd31('0x17')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x140af4['uniqueid'],_0x4837b2);this[_0xbd31('0xa')][_0x140af4[_0xbd31('0x28')]][_0x4837b2][_0xbd31('0x64')]=moment()['format'](_0xbd31('0x2e'));}}}logger[_0xbd31('0x2b')](_0xbd31('0x86'),_0x140af4[_0xbd31('0x28')],util[_0xbd31('0x3a')](_[_0xbd31('0x87')](this[_0xbd31('0xa')][_0x140af4['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xbd31('0x23')](_0xbd31('0x88'),_[_0xbd31('0x87')](this[_0xbd31('0xa')][_0x140af4[_0xbd31('0x28')]]));delete this['channels'][_0x140af4['uniqueid']];}if(this[_0xbd31('0x33')][_0x140af4[_0xbd31('0x28')]]){delete this['variables'][_0x140af4[_0xbd31('0x28')]];}}}catch(_0x10caec){logger[_0xbd31('0x40')](_0xbd31('0x89'),_0x140af4[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x10caec,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x20')]=function(_0xb3911c){try{if(this[_0xbd31('0x24')](_0xb3911c)){logger[_0xbd31('0x2b')](_0xbd31('0x8a'),_0xb3911c[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0xb3911c,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]]){for(var _0x2184cb in this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]]){if(this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]][_0xbd31('0x42')](_0x2184cb)){if(_0xb3911c[_0xbd31('0x8c')]===_0x2184cb){logger[_0xbd31('0x26')](_0xbd31('0x8d'),_0xb3911c[_0xbd31('0x28')],this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]][_0x2184cb][_0xbd31('0x29')],_0x2184cb);var _0x25d040=moment();this['channels'][_0xb3911c[_0xbd31('0x8b')]][_0x2184cb][_0xbd31('0x17')]=!![];this[_0xbd31('0xa')][_0xb3911c['transfereeuniqueid']][_0x2184cb][_0xbd31('0x64')]=moment()[_0xbd31('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xb3911c[_0xbd31('0x8b')]][_0x2184cb]['lastevent']='complete';this['channels'][_0xb3911c[_0xbd31('0x8b')]][_0x2184cb][_0xbd31('0x55')]=_0xbd31('0x66');this['channels'][_0xb3911c['transfereeuniqueid']][_0x2184cb][_0xbd31('0x68')]=_0x25d040[_0xbd31('0x8e')](this[_0xbd31('0xa')][_0xb3911c['transfereeuniqueid']][_0x2184cb]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0xb3911c[_0xbd31('0x8f')]]){var _0x5dfbe0=this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8f')]];this['channels'][_0xb3911c[_0xbd31('0x8f')]]=this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]];this[_0xbd31('0xa')][_0xb3911c[_0xbd31('0x8b')]]=_0x5dfbe0;}}}catch(_0xd9aabb){logger[_0xbd31('0x40')]('[%s][voiceAgentReport][attendedtransfer]',_0xb3911c[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0xd9aabb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')][_0xbd31('0x22')]=function(_0x461021){try{if(this[_0xbd31('0x24')](_0x461021)){logger['debug'](_0xbd31('0x90'),_0x461021[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x461021,{'showHidden':![],'depth':null}));if(this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]]){for(var _0x4bab77 in this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]]){if(this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]][_0xbd31('0x42')](_0x4bab77)){if(_0x461021[_0xbd31('0x91')]===_0x4bab77){logger['info'](_0xbd31('0x92'),_0x461021['uniqueid'],this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]][_0x4bab77]['membername'],_0x4bab77);var _0x3a3e2e=moment();this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]][_0x4bab77][_0xbd31('0x17')]=!![];this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]][_0x4bab77]['agentcompleteAt']=_0x3a3e2e;this['channels'][_0x461021[_0xbd31('0x8b')]][_0x4bab77][_0xbd31('0x4a')]=_0xbd31('0x65');this[_0xbd31('0xa')][_0x461021['transfereeuniqueid']][_0x4bab77]['reason']=_0xbd31('0x66');this[_0xbd31('0xa')][_0x461021[_0xbd31('0x8b')]][_0x4bab77][_0xbd31('0x68')]=_0x3a3e2e[_0xbd31('0x8e')](this['channels'][_0x461021[_0xbd31('0x8b')]][_0x4bab77][_0xbd31('0x44')],'seconds');}}}}}}catch(_0x244147){logger['error'](_0xbd31('0x93'),_0x461021[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x244147,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd31('0x41')]['syncMusicOnHoldStart']=function(_0x5bff66){var _0x450fe5='';try{if(this['isNotNull'](_0x5bff66)){logger[_0xbd31('0x2b')](_0xbd31('0x94'),_0x5bff66[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x5bff66,{'showHidden':![],'depth':null}));if(_0x5bff66[_0xbd31('0x95')]){_0x450fe5=_0x5bff66[_0xbd31('0x95')][_0xbd31('0x96')](0x0,_0x5bff66[_0xbd31('0x95')][_0xbd31('0x97')]('-'));if(this[_0xbd31('0xd')][_0x450fe5]){logger['info'](_0xbd31('0x98'),_0x5bff66[_0xbd31('0x28')],_0x450fe5);this[_0xbd31('0xd')][_0x450fe5]['onhold']=!![];}}}}catch(_0x14a706){logger['error'](_0xbd31('0x99'),_0x5bff66['uniqueid'],util['inspect'](_0x14a706,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbd31('0x9a')]=function(_0x41752a){var _0x2dde38='';try{if(this[_0xbd31('0x24')](_0x41752a)){logger[_0xbd31('0x2b')](_0xbd31('0x9b'),_0x41752a[_0xbd31('0x28')],util[_0xbd31('0x3a')](_0x41752a,{'showHidden':![],'depth':null}));if(_0x41752a[_0xbd31('0x95')]){_0x2dde38=_0x41752a[_0xbd31('0x95')][_0xbd31('0x96')](0x0,_0x41752a[_0xbd31('0x95')]['lastIndexOf']('-'));if(this[_0xbd31('0xd')][_0x2dde38]){logger[_0xbd31('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x41752a['uniqueid'],_0x2dde38);this[_0xbd31('0xd')][_0x2dde38][_0xbd31('0x9c')]=![];}}}}catch(_0x2aeb71){logger[_0xbd31('0x40')]('[%s][voiceAgentReport][musiconholdstop]',_0x41752a['uniqueid'],util[_0xbd31('0x3a')](_0x2aeb71,{'showHidden':![],'depth':null}));}};module[_0xbd31('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0510962..218c959 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 _0x7816=['[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastdata','set','type','[%s][voiceCallReport][newstate]\x20event:','answered','connectedlinename','calleridname','destinationchannel','UserId','membername','answertime','holdtime','diff','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','find','isNil','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','value','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','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','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','resolve','then','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','util','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','queue','agi','dial','playback','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','newstate','syncNewState','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','syncNewChannel','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','accountcode','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','CDR(routeAlias)','applicationdata','startsWith'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x7816,0x71));var _0x6781=function(_0x422d6a,_0x20d24f){_0x422d6a=_0x422d6a-0x0;var _0x3bff4b=_0x7816[_0x422d6a];return _0x3bff4b;};'use strict';var _=require(_0x6781('0x0'));var moment=require('moment');var util=require(_0x6781('0x1'));var path=require('path');var Redis=require(_0x6781('0x2'));var config=require('../../../config/environment');var logger=require(_0x6781('0x3'))(_0x6781('0x4'));var ami=require(_0x6781('0x5'));var Channel=require(_0x6781('0x6'));var RpcSetting=require(_0x6781('0x7'));var applications=['set',_0x6781('0x8'),_0x6781('0x9'),_0x6781('0xa'),_0x6781('0xb'),'voicemail'];var dispositions=[_0x6781('0xc'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x6781('0xc'),_0x6781('0xd'),_0x6781('0xe'),'FAILED',_0x6781('0xf'),_0x6781('0xf')];config[_0x6781('0x10')]=_[_0x6781('0x11')](config[_0x6781('0x10')],{'host':_0x6781('0x12'),'port':0x18eb});var io=require(_0x6781('0x13'))(new Redis(config[_0x6781('0x10')]));function VoiceCallReport(_0x9d2ffb){this['channels']=_0x9d2ffb[_0x6781('0x14')];this[_0x6781('0x15')]=_0x9d2ffb[_0x6781('0x15')];this['blindTransfers']={};ami['on'](_0x6781('0x16'),this[_0x6781('0x17')]['bind'](this));ami['on']('newexten',this[_0x6781('0x17')][_0x6781('0x18')](this));ami['on'](_0x6781('0x19'),this['syncNewChannel'][_0x6781('0x18')](this));ami['on'](_0x6781('0x1a'),this[_0x6781('0x1b')][_0x6781('0x18')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x6781('0x1c')]['bind'](this));ami['on']('newcallerid',this[_0x6781('0x1d')][_0x6781('0x18')](this));ami['on'](_0x6781('0x1e'),this['syncAttendedTransfer'][_0x6781('0x18')](this));ami['on'](_0x6781('0x1f'),this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0x6781('0x20')][_0x6781('0x18')](this));ami['on'](_0x6781('0x21'),this[_0x6781('0x22')][_0x6781('0x18')](this));try{logger[_0x6781('0x23')](_0x6781('0x24'));ami[_0x6781('0x25')]();}catch(_0x322e86){logger[_0x6781('0x26')](_0x6781('0x27'),util['inspect'](_0x322e86,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6781('0x28')][_0x6781('0x29')]=function(_0x5d7657){return _0x5d7657!==null&&!_[_0x6781('0x2a')](_0x5d7657);};VoiceCallReport[_0x6781('0x28')][_0x6781('0x2b')]=function(_0x428f49,_0x501652,_0x37114d){io['to'](_0x428f49)[_0x6781('0x2b')](_0x501652,_0x37114d);};VoiceCallReport[_0x6781('0x28')]['syncNewCallerId']=function(_0x59118d){try{if(this[_0x6781('0x29')](_0x59118d)){logger['info'](_0x6781('0x2c'),_0x59118d[_0x6781('0x2d')],_0x59118d['calleridname'],_0x59118d[_0x6781('0x2e')]);logger[_0x6781('0x2f')](_0x6781('0x30'),_0x59118d[_0x6781('0x2d')],util[_0x6781('0x31')](_0x59118d,{'showHidden':![],'depth':null}));if(_0x59118d[_0x6781('0x2d')]===_0x59118d[_0x6781('0x32')]){if(!_['isUndefined'](this['channels'][_0x59118d[_0x6781('0x2d')]])){_[_0x6781('0x33')](this[_0x6781('0x14')][_0x59118d[_0x6781('0x2d')]],_[_0x6781('0x34')](_0x59118d,_[_0x6781('0x35')](this[_0x6781('0x14')][_0x59118d[_0x6781('0x2d')]])));}}if(_0x59118d[_0x6781('0x36')]===_0x6781('0x37')){if(this[_0x6781('0x15')][_0x59118d[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]){if(_0x59118d[_0x6781('0x3a')]==_0x6781('0x3b')){this['agents'][_0x59118d[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x3c')]=_0x59118d[_0x6781('0x3d')];this[_0x6781('0x2b')](util[_0x6781('0x3e')](_0x6781('0x3f'),this[_0x6781('0x15')][_0x59118d[_0x6781('0x38')]['split']('-')[0x0]][_0x6781('0x40')]),_0x6781('0x41'),{'destaccountcode':this[_0x6781('0x15')][_0x59118d[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x59118d[_0x6781('0x3d')]});}}}}}catch(_0x53406c){logger[_0x6781('0x26')](_0x6781('0x42'),_0x59118d[_0x6781('0x2d')],util[_0x6781('0x31')](_0x53406c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6781('0x28')][_0x6781('0x43')]=function(_0x18b9a7){try{if(this[_0x6781('0x29')](_0x18b9a7)){logger[_0x6781('0x2f')]('[%s][voiceCallReport][newchannel]\x20event:',_0x18b9a7[_0x6781('0x2d')],util['inspect'](_0x18b9a7,{'showHidden':![],'depth':null}));if(this[_0x6781('0x14')][_0x18b9a7[_0x6781('0x2d')]])return;if(_0x18b9a7[_0x6781('0x38')]===_0x6781('0x44'))return;if(_0x18b9a7[_0x6781('0x2d')]!==_0x18b9a7[_0x6781('0x32')]&&!this[_0x6781('0x45')][_0x18b9a7[_0x6781('0x32')]])return;logger['info'](_0x6781('0x46'),_0x18b9a7[_0x6781('0x2d')],_0x18b9a7['context'],_0x18b9a7[_0x6781('0x3a')]);this[_0x6781('0x14')][_0x18b9a7[_0x6781('0x2d')]]=new Channel();this[_0x6781('0x14')][_0x18b9a7[_0x6781('0x2d')]][_0x6781('0x47')]=moment()[_0x6781('0x3e')](_0x6781('0x48'));this['channels'][_0x18b9a7[_0x6781('0x2d')]][_0x6781('0x49')]=dispositions[_[_0x6781('0x4a')](_0x18b9a7[_0x6781('0x4b')])];_[_0x6781('0x33')](this[_0x6781('0x14')][_0x18b9a7[_0x6781('0x2d')]],_[_0x6781('0x34')](_0x18b9a7,_[_0x6781('0x35')](this[_0x6781('0x14')][_0x18b9a7[_0x6781('0x2d')]])));if(_0x18b9a7[_0x6781('0x36')]===_0x6781('0x37')){if(this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]){if(_[_0x6781('0x2a')](this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x3c')])){this['agents'][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x3c')]=_0x18b9a7['exten'];logger[_0x6781('0x2f')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x18b9a7[_0x6781('0x2d')],util['inspect']({'id':this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x6781('0x15')][_0x18b9a7['channel'][_0x6781('0x39')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x18b9a7['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x6781('0x3e')](_0x6781('0x3f'),this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x40')]),_0x6781('0x41'),{'id':this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x6781('0x15')][_0x18b9a7[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x4c')],'destconnectedlinenum':_0x18b9a7[_0x6781('0x3a')]});}}}}}catch(_0x49bf45){logger[_0x6781('0x26')]('[%s][voiceCallReport][newchannel]',_0x18b9a7[_0x6781('0x2d')],util['inspect'](_0x49bf45,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6781('0x28')][_0x6781('0x17')]=function(_0x2b6d06){try{if(this['isNotNull'](_0x2b6d06)){logger['debug'](_0x6781('0x4d'),_0x2b6d06[_0x6781('0x2d')],util[_0x6781('0x31')](_0x2b6d06,{'showHidden':![],'depth':null}));if(_0x2b6d06[_0x6781('0x38')]===_0x6781('0x44')||_0x2b6d06[_0x6781('0x3a')]==='h')return;if(_0x2b6d06[_0x6781('0x2d')]===_0x2b6d06[_0x6781('0x32')]||this[_0x6781('0x45')][_0x2b6d06[_0x6781('0x32')]]){_0x2b6d06[_0x6781('0x4e')]=_0x2b6d06['application'][_0x6781('0x4f')]();var _0x1cd2f4=_0x2b6d06['appdata']&&_0x2b6d06[_0x6781('0x50')]['startsWith'](_0x6781('0x51'))?_0x2b6d06[_0x6781('0x50')]:_0x2b6d06[_0x6781('0x50')]||_0x2b6d06[_0x6781('0x52')];_0x2b6d06[_0x6781('0x52')]=_0x2b6d06[_0x6781('0x50')]&&_0x2b6d06[_0x6781('0x50')][_0x6781('0x53')](_0x6781('0x51'))?_0x2b6d06[_0x6781('0x50')]:(_0x2b6d06[_0x6781('0x50')]||_0x2b6d06[_0x6781('0x52')])[_0x6781('0x4f')]();logger['info'](_0x6781('0x54'),_0x2b6d06[_0x6781('0x2d')],_0x2b6d06[_0x6781('0x4e')],_0x2b6d06[_0x6781('0x52')]);if(_['isUndefined'](this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]])){this[_0x6781('0x14')][_0x2b6d06['uniqueid']]=new Channel();this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]][_0x6781('0x47')]=_0x2b6d06[_0x6781('0x55')]?moment()[_0x6781('0x56')](moment['duration'](_0x2b6d06['duration'])[_0x6781('0x57')](),_0x6781('0x57'))[_0x6781('0x3e')](_0x6781('0x48')):moment()[_0x6781('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2b6d06['uniqueid']][_0x6781('0x49')]=_0x6781('0xc');}_[_0x6781('0x33')](this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]],_['pick'](_0x2b6d06,_[_0x6781('0x35')](this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]])));if(_[_0x6781('0x58')](applications,_0x2b6d06[_0x6781('0x4e')])){this['channels'][_0x2b6d06[_0x6781('0x2d')]]['lastapplication']=_0x2b6d06['application'];this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]][_0x6781('0x59')]=_0x2b6d06['applicationdata'];if(_0x2b6d06[_0x6781('0x4e')]===_0x6781('0x5a')&&_['startsWith'](_0x2b6d06[_0x6781('0x52')][_0x6781('0x4f')](),'cdr(')){var _0x5cb51c=_0x2b6d06[_0x6781('0x52')]['split']('=');var _0x5e7a16=_0x5cb51c[0x0][_0x6781('0x4f')]()['match'](/cdr\((.*)\)/);if(_0x5e7a16){if(_0x5e7a16[0x1]===_0x6781('0x5b')&&!_['isNil'](this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]][_0x5e7a16[0x1]]))return;this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]][_0x5e7a16[0x1]]=_0x5cb51c[0x1];}}else if(_0x2b6d06['application']===_0x6781('0x8')){this[_0x6781('0x14')][_0x2b6d06[_0x6781('0x2d')]][_0x6781('0x8')]=_0x1cd2f4['split'](',')[0x0];}}}}}catch(_0x3fb88){logger['error']('[%s][voiceCallReport][newexten]',_0x2b6d06[_0x6781('0x2d')],util['inspect'](_0x3fb88,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6781('0x1b')]=function(_0x3c2c17){try{if(this[_0x6781('0x29')](_0x3c2c17)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x3c2c17[_0x6781('0x2d')],_0x3c2c17['linkedid'],_0x3c2c17['calleridname'],_0x3c2c17[_0x6781('0x2e')]);logger['debug'](_0x6781('0x5c'),_0x3c2c17[_0x6781('0x2d')],util[_0x6781('0x31')](_0x3c2c17,{'showHidden':![],'depth':null}));if(_0x3c2c17['channelstate']!=='6')return;if(_0x3c2c17[_0x6781('0x2d')]!==_0x3c2c17[_0x6781('0x32')]){var _0xffbf6=moment();if(this['channels'][_0x3c2c17['linkedid']]){if(!this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x5d')]){this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x5d')]=!![];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]]['answertime']=_0xffbf6[_0x6781('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x47')]){this['channels'][_0x3c2c17['linkedid']]['holdtime']=_0xffbf6['diff'](this['channels'][_0x3c2c17[_0x6781('0x32')]]['starttime'],_0x6781('0x57'));}}this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]]['linkedid']=_0x3c2c17[_0x6781('0x2d')];if(_0x3c2c17[_0x6781('0x2e')]!=='xcally-motion-preview'){this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]]['connectedlinenum']=_0x3c2c17[_0x6781('0x2e')];}this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x5e')]=_0x3c2c17[_0x6781('0x5f')];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x60')]=_0x3c2c17[_0x6781('0x38')];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x49')]=dispositions[_[_0x6781('0x4a')](_0x3c2c17[_0x6781('0x4b')])];if(this[_0x6781('0x15')][_0x3c2c17['channel'][_0x6781('0x39')]('-')[0x0]]){this['channels'][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x61')]=this['agents'][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['id'];this[_0x6781('0x14')][_0x3c2c17['linkedid']][_0x6781('0x62')]=this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x40')];}}if(this['channels'][_0x3c2c17[_0x6781('0x2d')]]){if(!this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x5d')]){this[_0x6781('0x14')][_0x3c2c17['uniqueid']][_0x6781('0x5d')]=!![];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x63')]=_0xffbf6['format'](_0x6781('0x48'));if(this[_0x6781('0x14')][_0x3c2c17['uniqueid']][_0x6781('0x47')]){this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x64')]=_0xffbf6[_0x6781('0x65')](this['channels'][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x47')],'seconds');}}if(_0x3c2c17[_0x6781('0x2e')]!==_0x6781('0x3b')){this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]]['connectedlinenum']=_0x3c2c17[_0x6781('0x2e')];}this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x5e')]=_0x3c2c17[_0x6781('0x5f')];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x60')]=_0x3c2c17[_0x6781('0x38')];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x49')]=dispositions[_[_0x6781('0x4a')](_0x3c2c17[_0x6781('0x4b')])];}}else{if(this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]]){if(this[_0x6781('0x15')][_0x3c2c17['channel'][_0x6781('0x39')]('-')[0x0]]){this['channels'][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x61')]=this['agents'][_0x3c2c17['channel'][_0x6781('0x39')]('-')[0x0]]['id'];this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x62')]=this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x40')];}}}if(_0x3c2c17['context']===_0x6781('0x37')){if(this[_0x6781('0x15')][_0x3c2c17['channel'][_0x6781('0x39')]('-')[0x0]]){this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x3c')]=_0x3c2c17[_0x6781('0x3a')];var _0x47c799,_0x5f22d9;if(this['channels'][_0x3c2c17[_0x6781('0x2d')]]){_0x47c799=this[_0x6781('0x14')][_0x3c2c17['uniqueid']]['routealias'];_0x5f22d9=this['channels'][_0x3c2c17[_0x6781('0x2d')]][_0x6781('0x8')];}else if(this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]]){_0x47c799=this[_0x6781('0x14')][_0x3c2c17['linkedid']][_0x6781('0x66')];_0x5f22d9=this[_0x6781('0x14')][_0x3c2c17[_0x6781('0x32')]][_0x6781('0x8')];}logger[_0x6781('0x2f')](_0x6781('0x67'),_0x3c2c17[_0x6781('0x2d')],util[_0x6781('0x31')]({'id':this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x4c')],'destconnectedlinenum':_0x3c2c17[_0x6781('0x3a')],'routealias':_0x47c799,'queue':_0x5f22d9||undefined},{'showHidden':![],'depth':null}));this[_0x6781('0x2b')](util['format'](_0x6781('0x3f'),this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]]['name']),_0x6781('0x41'),{'id':this[_0x6781('0x15')][_0x3c2c17['channel'][_0x6781('0x39')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x6781('0x15')][_0x3c2c17[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x4c')],'destconnectedlinenum':_0x3c2c17['exten'],'routealias':_0x47c799,'queue':_0x5f22d9||undefined});}}}}catch(_0x453692){logger[_0x6781('0x26')](_0x6781('0x68'),_0x3c2c17[_0x6781('0x2d')],util[_0x6781('0x31')](_0x453692,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6781('0x69')]=function(_0x4096a7,_0x4c8e18){try{if(this[_0x6781('0x14')][_0x4096a7]){logger[_0x6781('0x23')](_0x6781('0x6a'),_0x4096a7,_0x4c8e18);this['channels'][_0x4096a7][_0x6781('0x6b')]=!![];if(_[_0x6781('0x6c')](_0x4c8e18,_0x6781('0x6d'))){_0x4c8e18=_0x4c8e18[_0x6781('0x6e')]('.wav49','.WAV');}this[_0x6781('0x14')][_0x4096a7]['monitorFilename']=_0x4c8e18;var _0x5b1569=_[_0x6781('0x6f')](this[_0x6781('0x14')][_0x4096a7]['monitors'],{'filename':_0x4c8e18});if(_[_0x6781('0x70')](_0x5b1569)){this[_0x6781('0x14')][_0x4096a7][_0x6781('0x71')]['push']({'filename':_0x4c8e18,'createdAt':moment()[_0x6781('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6781('0x72')});}}}catch(_0x189f85){logger[_0x6781('0x26')](_0x6781('0x73'),_0x4096a7,util[_0x6781('0x31')](_0x189f85,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6781('0x28')][_0x6781('0x74')]=function(_0x487d3a){try{if(this[_0x6781('0x29')](_0x487d3a)){logger[_0x6781('0x2f')](_0x6781('0x75'),_0x487d3a[_0x6781('0x2d')],util[_0x6781('0x31')](_0x487d3a,{'showHidden':![],'depth':null}));if(this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]]&&_0x487d3a['channel']!='OutgoingSpoolFailed'){if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')])){if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x77')])){logger[_0x6781('0x23')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x487d3a['uniqueid'],_0x487d3a['value']);this[_0x6781('0x69')](_0x487d3a['uniqueid'],_0x487d3a['value']);}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x78')])){logger['info'](_0x6781('0x79'),_0x487d3a[_0x6781('0x2d')],_0x487d3a['value']);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x2e')]=_0x487d3a['value'];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x7a')])){logger[_0x6781('0x23')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x487d3a['uniqueid'],_0x487d3a[_0x6781('0x7b')]);this['channels'][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x7c')]=_0x487d3a[_0x6781('0x7b')];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x7d')])){logger[_0x6781('0x23')](_0x6781('0x7e'),_0x487d3a['uniqueid'],_0x487d3a[_0x6781('0x7b')]);this[_0x6781('0x14')][_0x487d3a['uniqueid']][_0x6781('0x5b')]=_0x487d3a[_0x6781('0x7b')];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x7f')])){logger[_0x6781('0x23')](_0x6781('0x80'),_0x487d3a[_0x6781('0x2d')],_0x487d3a['value'][_0x6781('0x39')](',')[0x0]);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]]['queue']=_0x487d3a[_0x6781('0x7b')]['split'](',')[0x0];}else if(this['isNotNull'](_0x487d3a[_0x6781('0x76')][_0x6781('0x81')])){logger[_0x6781('0x23')](_0x6781('0x82'),_0x487d3a[_0x6781('0x2d')],_0x487d3a[_0x6781('0x7b')]);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x83')]=_0x487d3a['value'];}else if(this[_0x6781('0x29')](_0x487d3a['variable'][_0x6781('0x84')])){logger[_0x6781('0x23')](_0x6781('0x85'),_0x487d3a[_0x6781('0x2d')],_0x487d3a[_0x6781('0x7b')]);this['channels'][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x86')]=_0x487d3a[_0x6781('0x7b')];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x87')])){logger[_0x6781('0x23')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x487d3a[_0x6781('0x2d')],_0x487d3a[_0x6781('0x7b')]);this['channels'][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x88')]=_0x487d3a[_0x6781('0x7b')];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x89')])){logger[_0x6781('0x23')](_0x6781('0x8a'),_0x487d3a[_0x6781('0x2d')],_0x487d3a['value']);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x8')]=_0x487d3a['value'];}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x8b')])){logger[_0x6781('0x23')](_0x6781('0x8c'),_0x487d3a['uniqueid'],_0x487d3a['value']);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x2d')]][_0x6781('0x8d')]=_0x487d3a['value'];}}}else if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')][_0x6781('0x77')])){if(_0x487d3a[_0x6781('0x7b')]){var _0x50b503=path[_0x6781('0x8e')](_0x487d3a['value'])[_0x6781('0x40')];logger[_0x6781('0x23')](_0x6781('0x8f'),_0x50b503,_0x487d3a[_0x6781('0x7b')]);this[_0x6781('0x69')](_0x50b503,_0x487d3a[_0x6781('0x7b')]);}}else if(this['channels'][_0x487d3a['linkedid']]){if(this[_0x6781('0x29')](_0x487d3a[_0x6781('0x76')])){if(this[_0x6781('0x29')](_0x487d3a['variable']['sipcallid'])){logger[_0x6781('0x23')](_0x6781('0x8c'),_0x487d3a[_0x6781('0x32')],_0x487d3a[_0x6781('0x7b')]);this[_0x6781('0x14')][_0x487d3a[_0x6781('0x32')]][_0x6781('0x90')]=_0x487d3a[_0x6781('0x7b')];}}}}}catch(_0x2f4127){logger['error'](_0x6781('0x91'),_0x487d3a['uniqueid'],util['inspect'](_0x2f4127,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6781('0x28')][_0x6781('0x1c')]=function(_0x293b04){try{if(this[_0x6781('0x29')](_0x293b04)){logger['debug'](_0x6781('0x92'),_0x293b04[_0x6781('0x2d')],util[_0x6781('0x31')](_0x293b04,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x293b04[_0x6781('0x32')]]){if(this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x32')]]){this['channels'][this['blindTransfers'][_0x293b04[_0x6781('0x32')]]['linkedid']][_0x6781('0x2d')]=_0x293b04[_0x6781('0x2d')];this['channels'][this[_0x6781('0x45')][_0x293b04['linkedid']]['linkedid']]['answered']=this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]]['answered'];this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04['linkedid']]['linkedid']]['answertime']=this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x63')];this[_0x6781('0x14')][this['blindTransfers'][_0x293b04['linkedid']][_0x6781('0x32')]]['destinationchannel']=this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x32')]][_0x6781('0x38')];this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x32')]]['disposition']=this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]]['disposition'];this['channels'][_0x293b04[_0x6781('0x2d')]]=this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x32')]];delete this[_0x6781('0x14')][this['blindTransfers'][_0x293b04[_0x6781('0x32')]][_0x6781('0x32')]];}else if(this[_0x6781('0x14')][this['blindTransfers'][_0x293b04[_0x6781('0x32')]]['uniqueid']]){this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04['linkedid']][_0x6781('0x2d')]][_0x6781('0x2d')]=[this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x2d')]][_0x6781('0x32')],this[_0x6781('0x14')][this['blindTransfers'][_0x293b04[_0x6781('0x32')]][_0x6781('0x2d')]]['linkedid']=this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]]['uniqueid']][_0x6781('0x2d')]][0x0];this[_0x6781('0x14')][this['blindTransfers'][_0x293b04[_0x6781('0x32')]][_0x6781('0x2d')]][_0x6781('0x5d')]=this[_0x6781('0x14')][_0x293b04['uniqueid']][_0x6781('0x5d')];this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x2d')]][_0x6781('0x63')]=this[_0x6781('0x14')][_0x293b04['uniqueid']][_0x6781('0x63')];this['channels'][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]]['uniqueid']][_0x6781('0x60')]=this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]][_0x6781('0x2d')]][_0x6781('0x38')];this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04['linkedid']][_0x6781('0x2d')]][_0x6781('0x49')]=this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x49')];this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]]=this[_0x6781('0x14')][this['blindTransfers'][_0x293b04[_0x6781('0x32')]]['uniqueid']];delete this[_0x6781('0x14')][this[_0x6781('0x45')][_0x293b04[_0x6781('0x32')]]['uniqueid']];}}if(this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]]){logger[_0x6781('0x23')](_0x6781('0x93'),_0x293b04[_0x6781('0x2d')],_0x293b04[_0x6781('0x94')]);var _0x5bb64a=moment();this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x95')]=_0x5bb64a[_0x6781('0x3e')](_0x6781('0x48'));this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x55')]=_0x5bb64a[_0x6781('0x65')](this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x47')],_0x6781('0x57'));if(this[_0x6781('0x14')][_0x293b04['uniqueid']][_0x6781('0x5d')]){this[_0x6781('0x14')][_0x293b04['uniqueid']][_0x6781('0x96')]=_0x5bb64a[_0x6781('0x65')](this['channels'][_0x293b04['uniqueid']][_0x6781('0x63')],_0x6781('0x57'));this[_0x6781('0x14')][_0x293b04[_0x6781('0x2d')]][_0x6781('0x64')]=this[_0x6781('0x14')][_0x293b04['uniqueid']]['duration']-this['channels'][_0x293b04[_0x6781('0x2d')]][_0x6781('0x96')];}if(_0x293b04[_0x6781('0x36')]===_0x6781('0x37')){if(this['agents'][_0x293b04['channel']['split']('-')[0x0]]){this[_0x6781('0x15')][_0x293b04['channel'][_0x6781('0x39')]('-')[0x0]]=_[_0x6781('0x97')](this[_0x6781('0x15')][_0x293b04[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]],[_0x6781('0x3c')]);logger['debug'](_0x6781('0x98'),_0x293b04['uniqueid'],util[_0x6781('0x31')]({'id':this[_0x6781('0x15')][_0x293b04['channel'][_0x6781('0x39')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x293b04[_0x6781('0x38')]['split']('-')[0x0]][_0x6781('0x4c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x6781('0x3e')](_0x6781('0x3f'),this[_0x6781('0x15')][_0x293b04['channel'][_0x6781('0x39')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0x6781('0x15')][_0x293b04['channel'][_0x6781('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x6781('0x15')][_0x293b04[_0x6781('0x38')][_0x6781('0x39')]('-')[0x0]][_0x6781('0x4c')]});for(var _0x1e40c0=0x0;_0x1e40c00x0?_0x1185b2:0x0;this['voiceQueues'][_0x1290a4[_0xf0ad('0x6c')]][_0xf0ad('0x2b')]=this[_0xf0ad('0x10')][_0x1290a4[_0xf0ad('0x6c')]][_0xf0ad('0x2b')]>_[_0xf0ad('0x6e')](_0x1290a4[_0xf0ad('0x70')])?_['toNumber'](_0x1290a4[_0xf0ad('0x70')]):this[_0xf0ad('0x10')][_0x1290a4['queue']]['talking'];this['emitVoiceQueueSummary'](this[_0xf0ad('0x10')][_0x1290a4[_0xf0ad('0x6c')]],_0xf0ad('0x12'));}logger[_0xf0ad('0x42')](_0xf0ad('0x71'),util['inspect'](this['voiceQueues'][_0x1290a4[_0xf0ad('0x6c')]],{'showHidden':![],'depth':null}));ami[_0xf0ad('0x41')](_0xf0ad('0x72'),this['voiceQueues'][_0x1290a4[_0xf0ad('0x6c')]]);}}}catch(_0x512946){logger['error'](_0xf0ad('0x68'),util[_0xf0ad('0x38')](_0x512946,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x15')]=function(_0x422c93){logger[_0xf0ad('0x42')](_0xf0ad('0x73'),util['inspect'](_0x422c93,{'showHidden':![],'depth':null}));this[_0xf0ad('0x66')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x3462a2){try{if(this[_0xf0ad('0x6a')](_0x3462a2)){logger[_0xf0ad('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3462a2['uniqueid'],util[_0xf0ad('0x38')](_0x3462a2,{'showHidden':![],'depth':null}));if(_[_0xf0ad('0x62')](this[_0xf0ad('0x39')][_0x3462a2['uniqueid']]))this[_0xf0ad('0x39')][_0x3462a2[_0xf0ad('0x45')]]=[];if(_[_0xf0ad('0x62')](this[_0xf0ad('0xe')][_0x3462a2[_0xf0ad('0x45')]]))this['channels'][_0x3462a2['uniqueid']]={};var _0x43fe94=new QueueReport();_0x43fe94[_0xf0ad('0x48')]=_0x3462a2[_0xf0ad('0x6c')];_0x43fe94['type']=this['voiceQueues'][_0x43fe94[_0xf0ad('0x48')]]&&this['voiceQueues'][_0x43fe94[_0xf0ad('0x48')]][_0xf0ad('0x4f')]?this[_0xf0ad('0x10')][_0x43fe94[_0xf0ad('0x48')]]['type']||_0xf0ad('0x50'):_0xf0ad('0x50');_0x43fe94['queue']=_0x3462a2[_0xf0ad('0x6c')];_0x43fe94[_0xf0ad('0x74')]=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));_0x43fe94['position']=_0x3462a2[_0xf0ad('0x76')];_0x43fe94[_0xf0ad('0x77')]=_0x3462a2[_0xf0ad('0x77')];_0x43fe94[_0xf0ad('0x45')]=_0x3462a2[_0xf0ad('0x45')];_0x43fe94[_0xf0ad('0x78')]=this[_0xf0ad('0xe')][_0x3462a2['uniqueid']][_0xf0ad('0x78')];logger[_0xf0ad('0x79')](_0xf0ad('0x7a'),_0x43fe94[_0xf0ad('0x48')],_0x43fe94[_0xf0ad('0x4f')]);_['merge'](_0x43fe94,_[_0xf0ad('0x7b')](_0x3462a2,_[_0xf0ad('0x7c')](_0x43fe94)));this[_0xf0ad('0x39')][_0x3462a2[_0xf0ad('0x45')]][_0xf0ad('0x7d')](_0x43fe94);this['channels'][_0x3462a2[_0xf0ad('0x45')]]=_0x43fe94;this['emitVoiceQueueChannelSave'](_0x43fe94,_0xf0ad('0x7e'));}}catch(_0x11e9a7){logger['error'](_0xf0ad('0x7f'),_0x3462a2[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x11e9a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x80')]=function(_0x32698d){try{if(this[_0xf0ad('0x6a')](_0x32698d)){logger[_0xf0ad('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x32698d[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x32698d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x32698d['uniqueid']]){var _0xe61c3d=_[_0xf0ad('0x81')](this[_0xf0ad('0x39')][_0x32698d[_0xf0ad('0x45')]]);_0xe61c3d[_0xf0ad('0x82')]=![];_0xe61c3d[_0xf0ad('0x83')]=null;_0xe61c3d['holdtime']=_0x32698d[_0xf0ad('0x84')];_0xe61c3d[_0xf0ad('0x85')]=_0x32698d[_0xf0ad('0x85')];_0xe61c3d['queuecallerabandon']=!![];_0xe61c3d['queuecallerabandonAt']=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));_0xe61c3d[_0xf0ad('0x4b')]=_0xf0ad('0x86');_0xe61c3d[_0xf0ad('0x87')]=null;logger[_0xf0ad('0x79')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xe61c3d[_0xf0ad('0x48')],_0xe61c3d['type']);this[_0xf0ad('0xe')][_0x32698d[_0xf0ad('0x45')]]=_0xe61c3d;this[_0xf0ad('0x3f')](_0xe61c3d,_0xf0ad('0x17'));}}}catch(_0x3f9c00){logger['error'](_0xf0ad('0x88'),_0x32698d[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x3f9c00,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x5eb50c){try{if(this[_0xf0ad('0x6a')](_0x5eb50c)){logger['debug'](_0xf0ad('0x89'),_0x5eb50c[_0xf0ad('0x45')],util['inspect'](_0x5eb50c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5eb50c[_0xf0ad('0x45')]]){var _0x4e9cd4=_[_0xf0ad('0x81')](this[_0xf0ad('0x39')][_0x5eb50c[_0xf0ad('0x45')]]);_0x4e9cd4[_0xf0ad('0x8a')]=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));_0x4e9cd4[_0xf0ad('0x8b')]=_0x5eb50c['connectedlinenum'];_0x4e9cd4['connectedlinename']=_0x5eb50c[_0xf0ad('0x8c')];logger[_0xf0ad('0x79')](_0xf0ad('0x8d'),_0x4e9cd4[_0xf0ad('0x48')],_0x4e9cd4[_0xf0ad('0x4f')],_0x5eb50c[_0xf0ad('0x8b')],_0x5eb50c[_0xf0ad('0x8c')]);this[_0xf0ad('0xe')][_0x5eb50c['uniqueid']]=_0x4e9cd4;this[_0xf0ad('0x8e')](_0x4e9cd4,'queuecallerleave');}}}catch(_0x381890){logger['error'](_0xf0ad('0x89'),_0x5eb50c[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x381890,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x1d')]=function(_0x583a1b){try{if(this[_0xf0ad('0x6a')](_0x583a1b)){logger[_0xf0ad('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x583a1b[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x583a1b,{'showHidden':![],'depth':null}));if(this[_0xf0ad('0x39')][_0x583a1b['uniqueid']]){var _0x3f64a1=_[_0xf0ad('0x81')](this['queueReports'][_0x583a1b['uniqueid']]);_0x3f64a1[_0xf0ad('0x82')]=!![];_0x3f64a1[_0xf0ad('0x4b')]='COMPLETEDBYAGENT';logger[_0xf0ad('0x79')](_0xf0ad('0x8f'),_0x3f64a1[_0xf0ad('0x48')],_0x3f64a1['type']);}}}catch(_0x3aea85){logger[_0xf0ad('0x36')](_0xf0ad('0x90'),_0x583a1b[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x3aea85,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x1b')]=function(_0x130812){try{if(this[_0xf0ad('0x6a')](_0x130812)){logger['debug'](_0xf0ad('0x91'),_0x130812[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x130812,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x130812[_0xf0ad('0x45')]]){var _0x39b04d=_[_0xf0ad('0x81')](this[_0xf0ad('0x39')][_0x130812[_0xf0ad('0x45')]]);_0x39b04d[_0xf0ad('0x17')]=![];_0x39b04d[_0xf0ad('0x92')]=null;_0x39b04d[_0xf0ad('0x93')]=!![];_0x39b04d[_0xf0ad('0x87')]=_0x130812['membername'];_0x39b04d[_0xf0ad('0x84')]=_0x130812['holdtime'];_0x39b04d[_0xf0ad('0x82')]=!![];_0x39b04d[_0xf0ad('0x94')]=![];_0x39b04d['queuecallerexitAt']=null;if(!_0x39b04d[_0xf0ad('0x95')]){if(_0x130812[_0xf0ad('0x96')]==_0xf0ad('0x95')){_0x39b04d[_0xf0ad('0x4b')]='COMPLETED';logger[_0xf0ad('0x79')](_0xf0ad('0x97'),_0x39b04d[_0xf0ad('0x48')],_0x39b04d['type']);}else{if(_[_0xf0ad('0x98')](_0x130812[_0xf0ad('0x32')][_0xf0ad('0x99')](),_0xf0ad('0x9a'))){if(this[_0xf0ad('0x39')][_0x130812[_0xf0ad('0x9b')]]){var _0x2b14be=_[_0xf0ad('0x81')](this['queueReports'][_0x130812[_0xf0ad('0x9b')]]);_0x2b14be[_0xf0ad('0x82')]=![];_0x2b14be[_0xf0ad('0x94')]=!![];_0x2b14be['queuecallerexitAt']=moment(_0x39b04d[_0xf0ad('0x74')])[_0xf0ad('0x9c')](_0x130812['holdtime'],'seconds')[_0xf0ad('0x46')](_0xf0ad('0x75'));_0x2b14be[_0xf0ad('0x4b')]=_0xf0ad('0x9d');_0x2b14be[_0xf0ad('0x95')]=!![];_0x2b14be[_0xf0ad('0x9e')]=_0xf0ad('0x9f');_0x2b14be['transferexten']=_0x130812['destexten'];_0x2b14be[_0xf0ad('0xa0')]=_0x130812['uniqueid'];logger[_0xf0ad('0x79')](_0xf0ad('0xa1'),_0x2b14be[_0xf0ad('0x48')],_0x2b14be[_0xf0ad('0x4f')]);var _0x1ea257=this[_0xf0ad('0x39')][_0x130812[_0xf0ad('0x9b')]];this[_0xf0ad('0x39')][_0x130812['linkedid']]=this[_0xf0ad('0x39')][_0x130812['uniqueid']];this[_0xf0ad('0x39')][_0x130812[_0xf0ad('0x45')]]=_0x1ea257;}}else{_0x39b04d['queuecallerexitreason']=_0xf0ad('0xa2')+_0x130812['reason']['toUpperCase']();logger[_0xf0ad('0x79')](_0xf0ad('0xa3'),_0x39b04d[_0xf0ad('0x48')],_0x39b04d[_0xf0ad('0x4f')],_0x39b04d[_0xf0ad('0x4b')]);}}}this['channels'][_0x130812[_0xf0ad('0x45')]]=_0x39b04d;this[_0xf0ad('0x3f')](_0x39b04d,'agentcomplete');}}}catch(_0x1a6148){logger[_0xf0ad('0x36')](_0xf0ad('0x91'),_0x130812[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x1a6148,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x1e')]=function(_0x556288){try{if(this['isNotNull'](_0x556288)){logger['debug'](_0xf0ad('0xa4'),_0x556288[_0xf0ad('0x45')],util['inspect'](_0x556288,{'showHidden':![],'depth':null}));this['addVariable'](_0x556288[_0xf0ad('0x45')],_[_0xf0ad('0x7c')](_0x556288[_0xf0ad('0xa5')])[0x0],_0x556288['value']);if(this[_0xf0ad('0x39')][_0x556288[_0xf0ad('0x45')]]){var _0xba621b=_[_0xf0ad('0x81')](this[_0xf0ad('0x39')][_0x556288['uniqueid']]);if(_0xba621b){if(this[_0xf0ad('0x6a')](_0x556288[_0xf0ad('0xa5')])&&this[_0xf0ad('0x6a')](_0x556288['variable'][_0xf0ad('0xa6')])){switch(_0x556288[_0xf0ad('0xa7')]){case _0xf0ad('0xa8'):_0xba621b['queuecallerexit']=![];_0xba621b[_0xf0ad('0xa9')]=null;break;case'TIMEOUT':_0xba621b['lastevent']=_0xf0ad('0xaa');_0xba621b[_0xf0ad('0x94')]=!![];_0xba621b[_0xf0ad('0xa9')]=moment()[_0xf0ad('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xba621b[_0xf0ad('0x8a')]=moment()[_0xf0ad('0x46')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xf0ad('0xab'),_0x556288[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0xba621b,{'showHidden':![],'depth':null}));ami[_0xf0ad('0x41')](_0xf0ad('0xac'),_0xba621b);break;default:_0xba621b[_0xf0ad('0x94')]=!![];_0xba621b['queuecallerexitAt']=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));_0xba621b['queuecallerleaveAt']=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));}_0xba621b['queuecallerabandon']=![];_0xba621b[_0xf0ad('0x92')]=null;_0xba621b[_0xf0ad('0x4b')]=_0x556288['value'];this['channels'][_0x556288[_0xf0ad('0x45')]]=_0xba621b;this['emitVoiceQueueChannelRemove'](_0xba621b,_0xf0ad('0xad'));}else if(this['isNotNull'](_0x556288['variable'])&&this[_0xf0ad('0x6a')](_0x556288['variable'][_0xf0ad('0xae')])){if(!_0xba621b['queuecallerabandon']){_0xba621b[_0xf0ad('0x94')]=!![];_0xba621b[_0xf0ad('0xa9')]=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));_0xba621b['queuecallerexitreason']=_0xf0ad('0xaf');_0xba621b[_0xf0ad('0x8a')]=moment()[_0xf0ad('0x46')](_0xf0ad('0x75'));this[_0xf0ad('0xe')][_0x556288[_0xf0ad('0x45')]]=_0xba621b;}}logger[_0xf0ad('0x79')](_0xf0ad('0xb0'),_0x556288['uniqueid'],_0xba621b[_0xf0ad('0x48')],_0xba621b[_0xf0ad('0x4f')],_[_0xf0ad('0x7c')](_0x556288[_0xf0ad('0xa5')])[0x0],_0x556288[_0xf0ad('0xa7')]);_0xba621b[_0xf0ad('0x3b')]=this[_0xf0ad('0x3b')][_0x556288[_0xf0ad('0x45')]];}}}}catch(_0x26877d){logger[_0xf0ad('0x36')](_0xf0ad('0xa4'),_0x556288[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x26877d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0xb1')]=function(_0x5c1b85,_0x1ea0f8,_0x18b77a){var _0xd5558a=[_0xf0ad('0xb2'),_0xf0ad('0xb3'),_0xf0ad('0xb4'),_0xf0ad('0xb5'),_0xf0ad('0xb6'),_0xf0ad('0xb7'),_0xf0ad('0xb8'),_0xf0ad('0xb9'),_0xf0ad('0xba'),_0xf0ad('0xbb'),_0xf0ad('0xbc'),_0xf0ad('0xbd'),_0xf0ad('0xbe'),_0xf0ad('0xbf'),_0xf0ad('0xc0'),'memberlastcall',_0xf0ad('0xc1'),'memberpenalty','memberrealtime'];if(!_[_0xf0ad('0xc2')](_0x1ea0f8)&&!_[_0xf0ad('0xc3')](_0xd5558a,_0x1ea0f8)){if(_['isUndefined'](this[_0xf0ad('0x3b')][_0x5c1b85])){this[_0xf0ad('0x3b')][_0x5c1b85]={};}this[_0xf0ad('0x3b')][_0x5c1b85][_0x1ea0f8]=_0x18b77a;}};VoiceQueueReport[_0xf0ad('0xa')][_0xf0ad('0x1f')]=function(_0x28bcb0){try{if(this[_0xf0ad('0x6a')](_0x28bcb0)){logger[_0xf0ad('0x42')](_0xf0ad('0xc4'),_0x28bcb0[_0xf0ad('0x45')],util[_0xf0ad('0x38')](_0x28bcb0,{'showHidden':![],'depth':null}));if(this[_0xf0ad('0x39')][_0x28bcb0[_0xf0ad('0x45')]]){for(var _0x5db683=0x0,_0x2cde2d={};_0x5db6830x0?_0x30c693:0x0;this[_0x7670('0x14')][_0x145b71['queue']]['talking']=this['voiceQueues'][_0x145b71[_0x7670('0x6a')]][_0x7670('0x33')]>_[_0x7670('0x6f')](_0x145b71[_0x7670('0x70')])?_[_0x7670('0x6f')](_0x145b71['loggedin']):this[_0x7670('0x14')][_0x145b71[_0x7670('0x6a')]][_0x7670('0x33')];this[_0x7670('0x71')](this['voiceQueues'][_0x145b71[_0x7670('0x6a')]],_0x7670('0x16'));}logger[_0x7670('0x48')](_0x7670('0x72'),util[_0x7670('0x3f')](this[_0x7670('0x14')][_0x145b71[_0x7670('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x7670('0x46')]('custom:queuesummary',this[_0x7670('0x14')][_0x145b71[_0x7670('0x6a')]]);}}}catch(_0x7a53d0){logger[_0x7670('0x41')](_0x7670('0x69'),util[_0x7670('0x3f')](_0x7a53d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7670('0x19')]=function(_0x215884){logger[_0x7670('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x215884,{'showHidden':![],'depth':null}));this[_0x7670('0x15')]=!![];};VoiceQueueReport[_0x7670('0xb')][_0x7670('0x1b')]=function(_0x53fec8){try{if(this[_0x7670('0x64')](_0x53fec8)){logger[_0x7670('0x48')](_0x7670('0x73'),_0x53fec8[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x53fec8,{'showHidden':![],'depth':null}));if(_[_0x7670('0x74')](this[_0x7670('0x10')][_0x53fec8[_0x7670('0x4e')]]))this[_0x7670('0x10')][_0x53fec8[_0x7670('0x4e')]]=[];if(_['isUndefined'](this[_0x7670('0x12')][_0x53fec8[_0x7670('0x4e')]]))this[_0x7670('0x12')][_0x53fec8[_0x7670('0x4e')]]={};var _0x2ec5c7=new QueueReport();_0x2ec5c7['name']=_0x53fec8[_0x7670('0x6a')];_0x2ec5c7[_0x7670('0x5c')]=this['voiceQueues'][_0x2ec5c7[_0x7670('0x4c')]]&&this[_0x7670('0x14')][_0x2ec5c7[_0x7670('0x4c')]][_0x7670('0x5c')]?this[_0x7670('0x14')][_0x2ec5c7['name']][_0x7670('0x5c')]||'inbound':_0x7670('0x53');_0x2ec5c7['queue']=_0x53fec8[_0x7670('0x6a')];_0x2ec5c7['queuecallerjoinAt']=moment()[_0x7670('0x4a')](_0x7670('0x75'));_0x2ec5c7['position']=_0x53fec8[_0x7670('0x76')];_0x2ec5c7[_0x7670('0x77')]=_0x53fec8[_0x7670('0x77')];_0x2ec5c7[_0x7670('0x4e')]=_0x53fec8['uniqueid'];_0x2ec5c7[_0x7670('0x78')]=this[_0x7670('0x12')][_0x53fec8[_0x7670('0x4e')]][_0x7670('0x78')];logger[_0x7670('0x6b')](_0x7670('0x79'),_0x2ec5c7['name'],_0x2ec5c7[_0x7670('0x5c')]);_['merge'](_0x2ec5c7,_['pick'](_0x53fec8,_[_0x7670('0x7a')](_0x2ec5c7)));this[_0x7670('0x10')][_0x53fec8[_0x7670('0x4e')]][_0x7670('0x7b')](_0x2ec5c7);this[_0x7670('0x12')][_0x53fec8[_0x7670('0x4e')]]=_0x2ec5c7;this[_0x7670('0x47')](_0x2ec5c7,_0x7670('0x1a'));}}catch(_0x199424){logger[_0x7670('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x53fec8[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x199424,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7670('0xb')][_0x7670('0x1d')]=function(_0x30dfcc){try{if(this['isNotNull'](_0x30dfcc)){logger['debug'](_0x7670('0x7c'),_0x30dfcc[_0x7670('0x4e')],util['inspect'](_0x30dfcc,{'showHidden':![],'depth':null}));if(this[_0x7670('0x10')][_0x30dfcc[_0x7670('0x4e')]]){var _0x744b3b=_[_0x7670('0x7d')](this[_0x7670('0x10')][_0x30dfcc[_0x7670('0x4e')]]);_0x744b3b['queuecallercomplete']=![];_0x744b3b[_0x7670('0x7e')]=null;_0x744b3b[_0x7670('0x7f')]=_0x30dfcc[_0x7670('0x7f')];_0x744b3b[_0x7670('0x80')]=_0x30dfcc[_0x7670('0x80')];_0x744b3b[_0x7670('0x1c')]=!![];_0x744b3b['queuecallerabandonAt']=moment()[_0x7670('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x744b3b['queuecallerexitreason']='ABANDONED';_0x744b3b['lastAssignedTo']=null;logger[_0x7670('0x6b')](_0x7670('0x81'),_0x744b3b[_0x7670('0x4c')],_0x744b3b[_0x7670('0x5c')]);this['channels'][_0x30dfcc[_0x7670('0x4e')]]=_0x744b3b;this[_0x7670('0x44')](_0x744b3b,'queuecallerabandon');}}}catch(_0x15fa6c){logger[_0x7670('0x41')](_0x7670('0x7c'),_0x30dfcc[_0x7670('0x4e')],util['inspect'](_0x15fa6c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7670('0xb')]['syncQueueCallerLeave']=function(_0x3df227){try{if(this[_0x7670('0x64')](_0x3df227)){logger[_0x7670('0x48')](_0x7670('0x82'),_0x3df227[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x3df227,{'showHidden':![],'depth':null}));if(this[_0x7670('0x10')][_0x3df227[_0x7670('0x4e')]]){var _0xec8058=_[_0x7670('0x7d')](this[_0x7670('0x10')][_0x3df227[_0x7670('0x4e')]]);_0xec8058['queuecallerleaveAt']=moment()[_0x7670('0x4a')](_0x7670('0x75'));_0xec8058[_0x7670('0x83')]=_0x3df227[_0x7670('0x83')];_0xec8058[_0x7670('0x84')]=_0x3df227['connectedlinename'];logger[_0x7670('0x6b')](_0x7670('0x85'),_0xec8058['name'],_0xec8058['type'],_0x3df227[_0x7670('0x83')],_0x3df227[_0x7670('0x84')]);this[_0x7670('0x12')][_0x3df227[_0x7670('0x4e')]]=_0xec8058;this[_0x7670('0x47')](_0xec8058,_0x7670('0x86'));}}}catch(_0x58cd3b){logger[_0x7670('0x41')](_0x7670('0x82'),_0x3df227[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x58cd3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7670('0x22')]=function(_0x4eae71){try{if(this[_0x7670('0x64')](_0x4eae71)){logger['debug'](_0x7670('0x87'),_0x4eae71[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x4eae71,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4eae71['uniqueid']]){var _0x35e969=_[_0x7670('0x7d')](this[_0x7670('0x10')][_0x4eae71[_0x7670('0x4e')]]);_0x35e969[_0x7670('0x88')]=!![];_0x35e969['queuecallerexitreason']=_0x7670('0x89');logger[_0x7670('0x6b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x35e969['name'],_0x35e969[_0x7670('0x5c')]);}}}catch(_0x30e2f2){logger[_0x7670('0x41')](_0x7670('0x87'),_0x4eae71[_0x7670('0x4e')],util['inspect'](_0x30e2f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7670('0xb')][_0x7670('0x20')]=function(_0x10427c){try{if(this[_0x7670('0x64')](_0x10427c)){logger[_0x7670('0x48')](_0x7670('0x8a'),_0x10427c[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x10427c,{'showHidden':![],'depth':null}));if(this[_0x7670('0x10')][_0x10427c[_0x7670('0x4e')]]){var _0x178abe=_['last'](this['queueReports'][_0x10427c[_0x7670('0x4e')]]);_0x178abe[_0x7670('0x1c')]=![];_0x178abe[_0x7670('0x8b')]=null;_0x178abe['assigned']=!![];_0x178abe['lastAssignedTo']=_0x10427c[_0x7670('0x8c')];_0x178abe[_0x7670('0x7f')]=_0x10427c[_0x7670('0x7f')];_0x178abe['queuecallercomplete']=!![];_0x178abe[_0x7670('0x8d')]=![];_0x178abe['queuecallerexitAt']=null;if(!_0x178abe[_0x7670('0x8e')]){if(_0x10427c[_0x7670('0x8f')]=='transfer'){_0x178abe[_0x7670('0x4f')]=_0x7670('0x90');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x178abe[_0x7670('0x4c')],_0x178abe[_0x7670('0x5c')]);}else{if(_[_0x7670('0x91')](_0x10427c[_0x7670('0x3b')][_0x7670('0x92')](),_0x7670('0x93'))){if(this[_0x7670('0x10')][_0x10427c[_0x7670('0x94')]]){var _0x376c31=_['last'](this[_0x7670('0x10')][_0x10427c[_0x7670('0x94')]]);_0x376c31[_0x7670('0x88')]=![];_0x376c31[_0x7670('0x8d')]=!![];_0x376c31['queuecallerexitAt']=moment(_0x178abe[_0x7670('0x95')])['add'](_0x10427c['holdtime'],_0x7670('0x96'))[_0x7670('0x4a')](_0x7670('0x75'));_0x376c31['queuecallerexitreason']=_0x7670('0x97');_0x376c31[_0x7670('0x8e')]=!![];_0x376c31[_0x7670('0x98')]=_0x7670('0x99');_0x376c31[_0x7670('0x9a')]=_0x10427c[_0x7670('0x9b')];_0x376c31[_0x7670('0x9c')]=_0x10427c[_0x7670('0x4e')];logger['info'](_0x7670('0x9d'),_0x376c31['name'],_0x376c31[_0x7670('0x5c')]);var _0x49808d=this[_0x7670('0x10')][_0x10427c[_0x7670('0x94')]];this[_0x7670('0x10')][_0x10427c[_0x7670('0x94')]]=this['queueReports'][_0x10427c[_0x7670('0x4e')]];this[_0x7670('0x10')][_0x10427c['uniqueid']]=_0x49808d;}}else{_0x178abe[_0x7670('0x4f')]=_0x7670('0x9e')+_0x10427c['reason'][_0x7670('0x9f')]();logger[_0x7670('0x6b')](_0x7670('0xa0'),_0x178abe[_0x7670('0x4c')],_0x178abe[_0x7670('0x5c')],_0x178abe[_0x7670('0x4f')]);}}}this[_0x7670('0x12')][_0x10427c['uniqueid']]=_0x178abe;this[_0x7670('0x44')](_0x178abe,_0x7670('0x1f'));}}}catch(_0x51dcd7){logger[_0x7670('0x41')](_0x7670('0x8a'),_0x10427c[_0x7670('0x4e')],util['inspect'](_0x51dcd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7670('0xb')][_0x7670('0x24')]=function(_0xd17a85){try{if(this[_0x7670('0x64')](_0xd17a85)){logger[_0x7670('0x48')](_0x7670('0xa1'),_0xd17a85['uniqueid'],util['inspect'](_0xd17a85,{'showHidden':![],'depth':null}));this[_0x7670('0xa2')](_0xd17a85[_0x7670('0x4e')],_[_0x7670('0x7a')](_0xd17a85[_0x7670('0xa3')])[0x0],_0xd17a85[_0x7670('0xa4')]);if(this[_0x7670('0x10')][_0xd17a85[_0x7670('0x4e')]]){var _0x59cca2=_['last'](this[_0x7670('0x10')][_0xd17a85[_0x7670('0x4e')]]);if(_0x59cca2){if(this['isNotNull'](_0xd17a85[_0x7670('0xa3')])&&this[_0x7670('0x64')](_0xd17a85['variable'][_0x7670('0xa5')])){switch(_0xd17a85[_0x7670('0xa4')]){case _0x7670('0xa6'):_0x59cca2[_0x7670('0x8d')]=![];_0x59cca2[_0x7670('0xa7')]=null;break;case _0x7670('0xa8'):_0x59cca2[_0x7670('0xa9')]='timeout';_0x59cca2[_0x7670('0x8d')]=!![];_0x59cca2[_0x7670('0xa7')]=moment()['format'](_0x7670('0x75'));_0x59cca2['queuecallerleaveAt']=moment()[_0x7670('0x4a')](_0x7670('0x75'));logger[_0x7670('0x48')](_0x7670('0xaa'),_0xd17a85['uniqueid'],util[_0x7670('0x3f')](_0x59cca2,{'showHidden':![],'depth':null}));ami['emit'](_0x7670('0xab'),_0x59cca2);break;default:_0x59cca2[_0x7670('0x8d')]=!![];_0x59cca2[_0x7670('0xa7')]=moment()[_0x7670('0x4a')](_0x7670('0x75'));_0x59cca2[_0x7670('0xac')]=moment()[_0x7670('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x59cca2[_0x7670('0x1c')]=![];_0x59cca2[_0x7670('0x8b')]=null;_0x59cca2[_0x7670('0x4f')]=_0xd17a85[_0x7670('0xa4')];this['channels'][_0xd17a85[_0x7670('0x4e')]]=_0x59cca2;this['emitVoiceQueueChannelRemove'](_0x59cca2,_0x7670('0x23'));}else if(this[_0x7670('0x64')](_0xd17a85['variable'])&&this[_0x7670('0x64')](_0xd17a85['variable']['queueposition'])){if(!_0x59cca2[_0x7670('0x1c')]){_0x59cca2[_0x7670('0x8d')]=!![];_0x59cca2[_0x7670('0xa7')]=moment()[_0x7670('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x59cca2['queuecallerexitreason']='EXITWITHKEY';_0x59cca2[_0x7670('0xac')]=moment()[_0x7670('0x4a')](_0x7670('0x75'));this[_0x7670('0x12')][_0xd17a85['uniqueid']]=_0x59cca2;}}logger[_0x7670('0x6b')](_0x7670('0xad'),_0xd17a85[_0x7670('0x4e')],_0x59cca2[_0x7670('0x4c')],_0x59cca2[_0x7670('0x5c')],_['keys'](_0xd17a85[_0x7670('0xa3')])[0x0],_0xd17a85['value']);_0x59cca2['variables']=this[_0x7670('0x40')][_0xd17a85[_0x7670('0x4e')]];}}}}catch(_0x446c6e){logger[_0x7670('0x41')]('[%s][voiceQueueReport][varset]',_0xd17a85[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x446c6e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7670('0xb')][_0x7670('0xa2')]=function(_0x149341,_0xf4855c,_0x20ca59){var _0x3efd48=[_0x7670('0xae'),_0x7670('0xaf'),_0x7670('0xb0'),_0x7670('0xb1'),'rtpaudioqosloss',_0x7670('0xb2'),_0x7670('0xb3'),'rtpaudioqosrttbridged',_0x7670('0xb4'),'sipuri',_0x7670('0xb5'),'bridgepvtcallid',_0x7670('0xb6'),'memberdynamic','memberinterface',_0x7670('0xb7'),'membername','memberpenalty',_0x7670('0xb8')];if(!_[_0x7670('0x39')](_0xf4855c)&&!_[_0x7670('0xb9')](_0x3efd48,_0xf4855c)){if(_[_0x7670('0x74')](this['variables'][_0x149341])){this[_0x7670('0x40')][_0x149341]={};}this[_0x7670('0x40')][_0x149341][_0xf4855c]=_0x20ca59;}};VoiceQueueReport[_0x7670('0xb')][_0x7670('0x26')]=function(_0x282892){try{if(this[_0x7670('0x64')](_0x282892)){logger[_0x7670('0x48')](_0x7670('0xba'),_0x282892[_0x7670('0x4e')],util[_0x7670('0x3f')](_0x282892,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x282892[_0x7670('0x4e')]]){for(var _0x25ea29=0x0,_0x224f8c={};_0x25ea29=0x0?moment(_0x1896d0[_0x963d('0x14')])['diff'](_0x1896d0['starttime'],_0x963d('0xb')):null,'data1':_0x963d('0x16'),'data2':_0x1896d0[_0x963d('0x17')],'data3':_0x1896d0[_0x963d('0xe')],'data4':_0x1896d0[_0x963d('0x18')]||null,'role':'agent','internal':_0x1896d0[_0x963d('0x17')]?_[_0x963d('0x10')](_0x1896d0[_0x963d('0x17')]):undefined,'uniqueid':_0x1896d0[_0x963d('0x11')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xfe28=['CreateMemberReport','membername','TALKING','starttime','endtime','outbound','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','toNumber','accountcode','voiceDialReport'];(function(_0x3d0528,_0x21a0b7){var _0x4ebb2d=function(_0x536ec8){while(--_0x536ec8){_0x3d0528['push'](_0x3d0528['shift']());}};_0x4ebb2d(++_0x21a0b7);}(_0xfe28,0x1a8));var _0x8fe2=function(_0x156221,_0x1c4b88){_0x156221=_0x156221-0x0;var _0x1e9b89=_0xfe28[_0x156221];return _0x1e9b89;};'use strict';var moment=require(_0x8fe2('0x0'));var _=require(_0x8fe2('0x1'));var util=require(_0x8fe2('0x2'));var client=require(_0x8fe2('0x3'));exports[_0x8fe2('0x4')]=function(_0x43e65e){var _0x7bc77e=_0x43e65e['queuecallercompleteAt']||_0x43e65e[_0x8fe2('0x5')];return client[_0x8fe2('0x6')]('CreateMemberReport',{'body':{'channel':_0x8fe2('0x7'),'membername':_0x43e65e[_0x8fe2('0x8')],'interface':_[_0x8fe2('0x9')](_0x43e65e[_0x8fe2('0xa')])?util[_0x8fe2('0xb')](_0x8fe2('0xc'),_0x43e65e[_0x8fe2('0x8')]):_0x43e65e[_0x8fe2('0xa')],'type':'TALKING','enterAt':_0x43e65e[_0x8fe2('0xd')],'exitAt':_0x7bc77e,'duration':moment(_0x7bc77e)[_0x8fe2('0xe')](_0x43e65e[_0x8fe2('0xd')],_0x8fe2('0xf')),'data1':_0x8fe2('0x10'),'data2':_0x43e65e[_0x8fe2('0x11')],'data3':_0x43e65e[_0x8fe2('0x12')],'data4':null,'data5':_0x43e65e[_0x8fe2('0x13')],'role':_0x8fe2('0x14'),'internal':_0x43e65e['accountcode']?_[_0x8fe2('0x15')](_0x43e65e[_0x8fe2('0x16')]):undefined,'uniqueid':_0x43e65e['uniqueid']},'log':'CreateMemberReport'});};exports[_0x8fe2('0x17')]=function(_0x1b5124){return client['Request'](_0x8fe2('0x18'),{'body':{'channel':'voice','membername':_0x1b5124[_0x8fe2('0x19')],'interface':_0x1b5124[_0x8fe2('0xa')],'type':_0x8fe2('0x1a'),'enterAt':_0x1b5124[_0x8fe2('0x1b')],'exitAt':_0x1b5124[_0x8fe2('0x1c')],'duration':moment(_0x1b5124[_0x8fe2('0x1c')])[_0x8fe2('0xe')](_0x1b5124[_0x8fe2('0x1b')],_0x8fe2('0xf'))>=0x0?moment(_0x1b5124['endtime'])[_0x8fe2('0xe')](_0x1b5124[_0x8fe2('0x1b')],'seconds'):null,'data1':_0x8fe2('0x1d'),'data2':_0x1b5124[_0x8fe2('0x16')],'data3':_0x1b5124[_0x8fe2('0x12')],'data4':_0x1b5124[_0x8fe2('0x1e')]||null,'role':'agent','internal':_0x1b5124['accountcode']?_['toNumber'](_0x1b5124[_0x8fe2('0x16')]):undefined,'uniqueid':_0x1b5124[_0x8fe2('0x1f')]},'log':_0x8fe2('0x18')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5e2d8f0..e4aec54 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 _0x5453=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x514880,_0x34b591){var _0x376093=function(_0x39c4c6){while(--_0x39c4c6){_0x514880['push'](_0x514880['shift']());}};_0x376093(++_0x34b591);}(_0x5453,0x18b));var _0x3545=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5453[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x3545('0x0'));exports[_0x3545('0x1')]=function(){return client[_0x3545('0x2')](_0x3545('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3545('0x4'),_0x3545('0x5')]},'log':_0x3545('0x6')});}; \ No newline at end of file +var _0x19c3=['Request','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x220744,_0x234bb2){var _0x9f2636=function(_0x2ddc63){while(--_0x2ddc63){_0x220744['push'](_0x220744['shift']());}};_0x9f2636(++_0x234bb2);}(_0x19c3,0xf9));var _0x319c=function(_0x3e8b7a,_0x250853){_0x3e8b7a=_0x3e8b7a-0x0;var _0x2619b5=_0x19c3[_0x3e8b7a];return _0x2619b5;};'use strict';var client=require(_0x319c('0x0'));exports['getSettings']=function(){return client[_0x319c('0x1')](_0x319c('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x319c('0x3')]},'log':_0x319c('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5b93bd3..d32745b 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 _0xfdf4=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x4c03a5,_0x42cd06){var _0xa018e6=function(_0x253641){while(--_0x253641){_0x4c03a5['push'](_0x4c03a5['shift']());}};_0xa018e6(++_0x42cd06);}(_0xfdf4,0x1c6));var _0x4fdf=function(_0x38619a,_0x19ce9a){_0x38619a=_0x38619a-0x0;var _0x556c43=_0xfdf4[_0x38619a];return _0x556c43;};'use strict';var client=require(_0x4fdf('0x0'));exports[_0x4fdf('0x1')]=function(_0x595b85){return function(_0x4505db){return client[_0x4fdf('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x4fdf('0x3'),_0x4fdf('0x4')]},'log':_0x4fdf('0x5')});};}; \ No newline at end of file +var _0x0a68=['GetTemplate','name','html','../client','Request'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x0a68,0x12f));var _0x80a6=function(_0x45d46d,_0x1f1b53){_0x45d46d=_0x45d46d-0x0;var _0x15ccc3=_0x0a68[_0x45d46d];return _0x15ccc3;};'use strict';var client=require(_0x80a6('0x0'));exports['getTemplates']=function(_0x159e2d){return function(_0x1a6a68){return client[_0x80a6('0x1')](_0x80a6('0x2'),{'options':{'raw':!![],'attributes':['id',_0x80a6('0x3'),_0x80a6('0x4')]},'log':_0x80a6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 316a45a..878e249 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 _0xcea9=['data4','data7','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data3'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0xcea9,0xec));var _0x9cea=function(_0x1a73d9,_0x45a528){_0x1a73d9=_0x1a73d9-0x0;var _0x16313a=_0xcea9[_0x1a73d9];return _0x16313a;};'use strict';var client=require('../client');exports[_0x9cea('0x0')]=function(_0x26ccdb){return function(_0x2623e7){return client['Request'](_0x9cea('0x1'),{'options':{'raw':![],'attributes':['id',_0x9cea('0x2'),_0x9cea('0x3'),_0x9cea('0x4')],'include':[{'model':_0x9cea('0x5'),'as':_0x9cea('0x6'),'attributes':['id',_0x9cea('0x7'),_0x9cea('0x8'),_0x9cea('0x9')]},{'model':_0x9cea('0x5'),'as':_0x9cea('0xa'),'attributes':['id',_0x9cea('0x7'),'operator',_0x9cea('0x9')]},{'model':_0x9cea('0xb'),'as':_0x9cea('0xc'),'attributes':['id',_0x9cea('0xd'),_0x9cea('0xe'),'data2',_0x9cea('0xf'),_0x9cea('0x10'),'data5','data6',_0x9cea('0x11')]}]},'log':_0x9cea('0x1')});};}; \ No newline at end of file +var _0x4479=['data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','operator','value','field','Action','Actions','action'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x4479,0x16f));var _0x9447=function(_0x2c10a7,_0x23431b){_0x2c10a7=_0x2c10a7-0x0;var _0x44bcb3=_0x4479[_0x2c10a7];return _0x44bcb3;};'use strict';var client=require('../client');exports[_0x9447('0x0')]=function(_0x293797){return function(_0x4b390e){return client[_0x9447('0x1')](_0x9447('0x2'),{'options':{'raw':![],'attributes':['id',_0x9447('0x3'),_0x9447('0x4'),'status'],'include':[{'model':_0x9447('0x5'),'as':_0x9447('0x6'),'attributes':['id','field',_0x9447('0x7'),_0x9447('0x8')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x9447('0x9'),'operator',_0x9447('0x8')]},{'model':_0x9447('0xa'),'as':_0x9447('0xb'),'attributes':['id',_0x9447('0xc'),_0x9447('0xd'),_0x9447('0xe'),_0x9447('0xf'),_0x9447('0x10'),_0x9447('0x11'),_0x9447('0x12'),_0x9447('0x13')]}]},'log':_0x9447('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e1d1253..872b67b 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 _0x29fb=['name','defaultuser','../client','Request','GetTrunk'];(function(_0x240575,_0x2b137b){var _0x3b13af=function(_0x4931f0){while(--_0x4931f0){_0x240575['push'](_0x240575['shift']());}};_0x3b13af(++_0x2b137b);}(_0x29fb,0x13d));var _0xb29f=function(_0x5977a8,_0xfd2bad){_0x5977a8=_0x5977a8-0x0;var _0x473fb1=_0x29fb[_0x5977a8];return _0x473fb1;};'use strict';var client=require(_0xb29f('0x0'));exports['getTrunks']=function(_0x1b45c0){return function(_0x17eba9){return client[_0xb29f('0x1')](_0xb29f('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb29f('0x3'),'registry',_0xb29f('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xa03c=['registry','defaultuser','getTrunks','Request','GetTrunk','name'];(function(_0x5c6a88,_0x50a2ba){var _0x3c2896=function(_0x574f22){while(--_0x574f22){_0x5c6a88['push'](_0x5c6a88['shift']());}};_0x3c2896(++_0x50a2ba);}(_0xa03c,0x16a));var _0xca03=function(_0x1b5549,_0xea75dc){_0x1b5549=_0x1b5549-0x0;var _0x1ad591=_0xa03c[_0x1b5549];return _0x1ad591;};'use strict';var client=require('../client');exports[_0xca03('0x0')]=function(_0x43c424){return function(_0x7be704){return client[_0xca03('0x1')](_0xca03('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xca03('0x3'),_0xca03('0x4'),_0xca03('0x5')]},'log':_0xca03('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 611086e..447acb0 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x3a27a8,_0x4c5e23){var _0x3be69e=function(_0x464aeb){while(--_0x464aeb){_0x3a27a8['push'](_0x3a27a8['shift']());}};_0x3be69e(++_0x4c5e23);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xcb91[_0x3de873];return _0x380b8c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x9b6b99,_0x3d4f0c){var _0x3ac94c=function(_0x52a1a3){while(--_0x52a1a3){_0x9b6b99['push'](_0x9b6b99['shift']());}};_0x3ac94c(++_0x3d4f0c);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 704560d..8796c88 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 _0x3381=['../client','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x3381,0x1b4));var _0x1338=function(_0x16316c,_0x403e45){_0x16316c=_0x16316c-0x0;var _0x5067b6=_0x3381[_0x16316c];return _0x5067b6;};'use strict';var client=require(_0x1338('0x0'));exports['create']=function(_0xf662a){return client['Request'](_0x1338('0x1'),{'body':_0xf662a,'log':_0x1338('0x1')});};exports['update']=function(_0x499452,_0x3165ba,_0x462f01){return client[_0x1338('0x2')](_0x1338('0x3'),{'body':_0x499452,'options':{'where':{'uniqueid':_0x3165ba,'interface':_0x462f01,'agentcomplete':!![]}},'log':_0x1338('0x3')});}; \ No newline at end of file +var _0x01ab=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x106b1f,_0x592341){var _0x5bd362=function(_0x21261c){while(--_0x21261c){_0x106b1f['push'](_0x106b1f['shift']());}};_0x5bd362(++_0x592341);}(_0x01ab,0x138));var _0xb01a=function(_0x180fda,_0x1af14f){_0x180fda=_0x180fda-0x0;var _0x3bddc9=_0x01ab[_0x180fda];return _0x3bddc9;};'use strict';var client=require(_0xb01a('0x0'));exports[_0xb01a('0x1')]=function(_0x179e98){return client[_0xb01a('0x2')](_0xb01a('0x3'),{'body':_0x179e98,'log':_0xb01a('0x3')});};exports[_0xb01a('0x4')]=function(_0x5bc0bf,_0x56a97f,_0x34af72){return client[_0xb01a('0x2')](_0xb01a('0x5'),{'body':_0x5bc0bf,'options':{'where':{'uniqueid':_0x56a97f,'interface':_0x34af72,'agentcomplete':!![]}},'log':_0xb01a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6c61b7b..0bc17d4 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 _0xac91=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xac91,0x119));var _0x1ac9=function(_0x553956,_0x57a991){_0x553956=_0x553956-0x0;var _0x2e4172=_0xac91[_0x553956];return _0x2e4172;};'use strict';var moment=require(_0x1ac9('0x0'));var util=require('util');var _=require(_0x1ac9('0x1'));var client=require('../client');exports[_0x1ac9('0x2')]=function(_0x304c2f){return client[_0x1ac9('0x3')](_0x1ac9('0x4'),{'body':_[_0x1ac9('0x5')](_0x304c2f,{'source':_0x304c2f[_0x1ac9('0x6')],'destinationcontext':_0x304c2f['context'],'callerid':_0x304c2f[_0x1ac9('0x7')],'amaflags':_0x1ac9('0x8')}),'log':_0x1ac9('0x4')});};exports[_0x1ac9('0x9')]=function(){return function(){return client[_0x1ac9('0x3')](_0x1ac9('0xa'),{'options':{'where':{'type':[_0x1ac9('0xb')],'createdAt':{'$between':[moment()[_0x1ac9('0xc')](_0x1ac9('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1ac9('0xd'))[_0x1ac9('0xe')](_0x1ac9('0xf'))]}},'attributes':[_0x1ac9('0x10'),_0x1ac9('0x11'),_0x1ac9('0x12'),_0x1ac9('0x13')]},'log':_0x1ac9('0x14')});};}; \ No newline at end of file +var _0x5eef=['YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','startOf','day','format'];(function(_0x55a802,_0x10ab3a){var _0x1a0461=function(_0x43d162){while(--_0x43d162){_0x55a802['push'](_0x55a802['shift']());}};_0x1a0461(++_0x10ab3a);}(_0x5eef,0x65));var _0xf5ee=function(_0x1e0975,_0x1950b5){_0x1e0975=_0x1e0975-0x0;var _0x1e7065=_0x5eef[_0x1e0975];return _0x1e7065;};'use strict';var moment=require(_0xf5ee('0x0'));var util=require(_0xf5ee('0x1'));var _=require(_0xf5ee('0x2'));var client=require('../client');exports['create']=function(_0x3c5f7f){return client['Request'](_0xf5ee('0x3'),{'body':_[_0xf5ee('0x4')](_0x3c5f7f,{'source':_0x3c5f7f['calleridnum'],'destinationcontext':_0x3c5f7f[_0xf5ee('0x5')],'callerid':_0x3c5f7f[_0xf5ee('0x6')],'amaflags':_0xf5ee('0x7')}),'log':_0xf5ee('0x3')});};exports[_0xf5ee('0x8')]=function(){return function(){return client[_0xf5ee('0x9')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf5ee('0xa')](_0xf5ee('0xb'))[_0xf5ee('0xc')](_0xf5ee('0xd')),moment()[_0xf5ee('0xe')](_0xf5ee('0xb'))[_0xf5ee('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xf5ee('0xf'),_0xf5ee('0x10'),_0xf5ee('0x11')]},'log':_0xf5ee('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3e5ef5d..35226d5 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 _0x60fd=['../client','create','CreateVoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60fd,0x93));var _0xd60f=function(_0x3582bf,_0x37ff9b){_0x3582bf=_0x3582bf-0x0;var _0x3e2c5b=_0x60fd[_0x3582bf];return _0x3e2c5b;};'use strict';var client=require(_0xd60f('0x0'));exports[_0xd60f('0x1')]=function(_0x566636){return client['Request'](_0xd60f('0x2'),{'body':_0x566636,'log':_0xd60f('0x2')});}; \ No newline at end of file +var _0x8590=['Request','CreateVoiceDialReport','create'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x8590,0x155));var _0x0859=function(_0x212ffc,_0x2fd777){_0x212ffc=_0x212ffc-0x0;var _0x4407a6=_0x8590[_0x212ffc];return _0x4407a6;};'use strict';var client=require('../client');exports[_0x0859('0x0')]=function(_0x1b8ac7){return client[_0x0859('0x1')](_0x0859('0x2'),{'body':_0x1b8ac7,'log':_0x0859('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index edf4a35..9d43691 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 _0xf996=['../client','getVoiceExtensions','Request','exten'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0xf996,0x74));var _0x6f99=function(_0x337796,_0x2edbc9){_0x337796=_0x337796-0x0;var _0x15c164=_0xf996[_0x337796];return _0x15c164;};'use strict';var client=require(_0x6f99('0x0'));exports[_0x6f99('0x1')]=function(){return function(){return client[_0x6f99('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6f99('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xb84e=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x3d1ac7,_0x236ed0){var _0x5c89e2=function(_0x670374){while(--_0x670374){_0x3d1ac7['push'](_0x3d1ac7['shift']());}};_0x5c89e2(++_0x236ed0);}(_0xb84e,0xbf));var _0xeb84=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xb84e[_0x4c3ffe];return _0x28d3eb;};'use strict';var client=require('../client');exports[_0xeb84('0x0')]=function(){return function(){return client[_0xeb84('0x1')](_0xeb84('0x2'),{'options':{'raw':!![],'attributes':['id',_0xeb84('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7805350..e22509b 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 _0xaba6=['dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','acwTimeout','autopause','type','dialActive'];(function(_0x52872d,_0x2cbd5b){var _0x1a5481=function(_0x236c10){while(--_0x236c10){_0x52872d['push'](_0x52872d['shift']());}};_0x1a5481(++_0x2cbd5b);}(_0xaba6,0xe2));var _0x6aba=function(_0x57524e,_0x236f11){_0x57524e=_0x57524e-0x0;var _0x4a0867=_0xaba6[_0x57524e];return _0x4a0867;};'use strict';var client=require(_0x6aba('0x0'));exports[_0x6aba('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x6aba('0x2'),_0x6aba('0x3'),'monitor_format',_0x6aba('0x4'),_0x6aba('0x5'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x6aba('0x6'),'dialPredictiveOptimization',_0x6aba('0x7'),_0x6aba('0x8'),'dialOriginateCallerIdName',_0x6aba('0x9'),_0x6aba('0xa'),'dialQueueOptions',_0x6aba('0xb'),_0x6aba('0xc'),_0x6aba('0xd'),_0x6aba('0xe'),_0x6aba('0xf'),_0x6aba('0x10'),_0x6aba('0x11'),'dialNoAnswerRetryFrequency',_0x6aba('0x12'),_0x6aba('0x13'),_0x6aba('0x14'),_0x6aba('0x15'),'dialCheckDuplicateType',_0x6aba('0x16'),_0x6aba('0x17'),'dialAMDGreeting',_0x6aba('0x18'),_0x6aba('0x19'),_0x6aba('0x1a'),'dialAMDBetweenWordsSilence',_0x6aba('0x1b'),_0x6aba('0x1c'),_0x6aba('0x1d'),'timeout',_0x6aba('0x1e'),_0x6aba('0x1f'),_0x6aba('0x20'),_0x6aba('0x21'),_0x6aba('0x22'),_0x6aba('0x23'),_0x6aba('0x24'),'strategy',_0x6aba('0x25'),_0x6aba('0x26'),_0x6aba('0x27'),'dialNoSuchNumberRetryFrequency',_0x6aba('0x28'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x6aba('0x29'),'dialMachineMaxRetry',_0x6aba('0x2a'),_0x6aba('0x2b'),_0x6aba('0x2c'),_0x6aba('0x2d'),_0x6aba('0x2e'),_0x6aba('0x2f'),_0x6aba('0x30'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x6aba('0x31'),'as':_0x6aba('0x31'),'attributes':['id',_0x6aba('0x32'),_0x6aba('0x33'),_0x6aba('0x34')]},{'model':_0x6aba('0x35'),'as':_0x6aba('0x36'),'attributes':['id',_0x6aba('0x32')]},{'model':_0x6aba('0x31'),'as':_0x6aba('0x37'),'attributes':['id',_0x6aba('0x32'),_0x6aba('0x33'),_0x6aba('0x34')]},{'model':_0x6aba('0x38'),'as':_0x6aba('0x38'),'attributes':['id',_0x6aba('0x32')],'include':[{'model':_0x6aba('0x38'),'as':_0x6aba('0x39'),'attributes':['id',_0x6aba('0x32'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x1ee0=['dialPreviewRecallmeReminder','Trunk','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1ee0,0xe7));var _0x01ee=function(_0x28d428,_0x90eaae){_0x28d428=_0x28d428-0x0;var _0x4f6e16=_0x1ee0[_0x28d428];return _0x4f6e16;};'use strict';var client=require(_0x01ee('0x0'));exports[_0x01ee('0x1')]=function(){return function(){return client[_0x01ee('0x2')](_0x01ee('0x3'),{'options':{'raw':![],'attributes':['id',_0x01ee('0x4'),'acw','acwTimeout',_0x01ee('0x5'),_0x01ee('0x6'),_0x01ee('0x7'),'dialActive',_0x01ee('0x8'),'dialLimitChannel',_0x01ee('0x9'),_0x01ee('0xa'),_0x01ee('0xb'),'dialPredictiveOptimizationPercentage',_0x01ee('0xc'),_0x01ee('0xd'),_0x01ee('0xe'),'dialOriginateTimeout',_0x01ee('0xf'),_0x01ee('0x10'),_0x01ee('0x11'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x01ee('0x12'),'dialNoAnswerMaxRetry',_0x01ee('0x13'),'dialGlobalMaxRetry',_0x01ee('0x14'),_0x01ee('0x15'),_0x01ee('0x16'),'dialCheckDuplicateType',_0x01ee('0x17'),_0x01ee('0x18'),_0x01ee('0x19'),'dialAMDAfterGreetingSilence',_0x01ee('0x1a'),'dialAMDMinWordLength',_0x01ee('0x1b'),_0x01ee('0x1c'),'dialAMDSilenceThreshold',_0x01ee('0x1d'),_0x01ee('0x1e'),_0x01ee('0x1f'),_0x01ee('0x20'),_0x01ee('0x21'),_0x01ee('0x22'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x01ee('0x23'),'dialRandomLastDigitCallerIdNumber',_0x01ee('0x24'),_0x01ee('0x25'),_0x01ee('0x26'),_0x01ee('0x27'),_0x01ee('0x28'),_0x01ee('0x29'),_0x01ee('0x2a'),'dialMachineMaxRetry',_0x01ee('0x2b'),'dialAgentRejectMaxRetry',_0x01ee('0x2c'),_0x01ee('0x2d'),_0x01ee('0x2e'),_0x01ee('0x2f'),_0x01ee('0x30'),_0x01ee('0x31')],'include':[{'model':_0x01ee('0x32'),'as':_0x01ee('0x32'),'attributes':['id','name',_0x01ee('0x33'),_0x01ee('0x34')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x01ee('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x01ee('0x4'),_0x01ee('0x33'),_0x01ee('0x34')]},{'model':_0x01ee('0x35'),'as':_0x01ee('0x35'),'attributes':['id',_0x01ee('0x4')],'include':[{'model':'Interval','as':_0x01ee('0x36'),'attributes':['id',_0x01ee('0x4'),_0x01ee('0x37')]}]}]},'log':_0x01ee('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8392da6..92e8a3c 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(_0x5ebb68,_0x592065){var _0x44b467=function(_0x49e9f6){while(--_0x49e9f6){_0x5ebb68['push'](_0x5ebb68['shift']());}};_0x44b467(++_0x592065);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x351c9e,_0x222c83){var _0x352084=function(_0x40af75){while(--_0x40af75){_0x351c9e['push'](_0x351c9e['shift']());}};_0x352084(++_0x222c83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 2b81368..ccb331e 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 _0x6244=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x262182,_0x14b864){var _0x84b98f=function(_0x33935e){while(--_0x33935e){_0x262182['push'](_0x262182['shift']());}};_0x84b98f(++_0x14b864);}(_0x6244,0xa3));var _0x4624=function(_0x13ddeb,_0xdc8f34){_0x13ddeb=_0x13ddeb-0x0;var _0x5b42fb=_0x6244[_0x13ddeb];return _0x5b42fb;};'use strict';var client=require('../client');exports[_0x4624('0x0')]=function(_0x4875db){return function(){return client[_0x4624('0x1')](_0x4624('0x2'),{'options':{'where':{'VoiceQueueId':_0x4875db,'paused':!![]},'raw':!![]},'log':_0x4624('0x0')});};}; \ No newline at end of file +var _0x7c97=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x23baed,_0x460460){var _0x1beaa9=function(_0x55220e){while(--_0x55220e){_0x23baed['push'](_0x23baed['shift']());}};_0x1beaa9(++_0x460460);}(_0x7c97,0x179));var _0x77c9=function(_0x22b82b,_0x4407cd){_0x22b82b=_0x22b82b-0x0;var _0x220523=_0x7c97[_0x22b82b];return _0x220523;};'use strict';var client=require(_0x77c9('0x0'));exports[_0x77c9('0x1')]=function(_0x5c02a8){return function(){return client['Request'](_0x77c9('0x2'),{'options':{'where':{'VoiceQueueId':_0x5c02a8,'paused':!![]},'raw':!![]},'log':_0x77c9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bffe81d..f40ad0a 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(_0x17d319,_0x197775){var _0x3e940a=function(_0x49e84e){while(--_0x49e84e){_0x17d319['push'](_0x17d319['shift']());}};_0x3e940a(++_0x197775);}(_0x7a54,0x106));var _0x47a5=function(_0x1b7962,_0x222f28){_0x1b7962=_0x1b7962-0x0;var _0x39aaa8=_0x7a54[_0x1b7962];return _0x39aaa8;};'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(_0x752b97,_0x49046b){var _0x46f368=function(_0x2c75a2){while(--_0x2c75a2){_0x752b97['push'](_0x752b97['shift']());}};_0x46f368(++_0x49046b);}(_0x7a54,0x106));var _0x47a5=function(_0x1f5fd1,_0x5b5b10){_0x1f5fd1=_0x1f5fd1-0x0;var _0x245fa0=_0x7a54[_0x1f5fd1];return _0x245fa0;};'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 861e279..59cb63f 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 _0x5b56=['attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetlinkedid','origtransfererexten','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','isexternal','context','extension','blind'];(function(_0x289856,_0x5e53cc){var _0x3b9249=function(_0x5a60a6){while(--_0x5a60a6){_0x289856['push'](_0x289856['shift']());}};_0x3b9249(++_0x5e53cc);}(_0x5b56,0x1f2));var _0x65b5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5b56[_0x138adb];return _0x1b27f2;};'use strict';var client=require('../client');exports[_0x65b5('0x0')]={};exports['blindTransfer']=function(_0x5589af){return client[_0x65b5('0x1')](_0x65b5('0x2'),{'body':{'result':_0x5589af['result'],'transfererchannel':_0x5589af[_0x65b5('0x3')],'transferercalleridnum':_0x5589af['transferercalleridnum'],'transferercalleridname':_0x5589af[_0x65b5('0x4')],'transfererconnectedlinenum':_0x5589af['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5589af[_0x65b5('0x5')],'transfereraccountcode':_0x5589af[_0x65b5('0x6')],'transferercontext':_0x5589af[_0x65b5('0x7')],'transfererexten':_0x5589af[_0x65b5('0x8')],'transfererlinkedid':_0x5589af[_0x65b5('0x9')],'transfereechannel':_0x5589af[_0x65b5('0xa')],'transfereecalleridnum':_0x5589af[_0x65b5('0xb')],'transfereecalleridname':_0x5589af['transfereecalleridname'],'transfereeconnectedlinenum':_0x5589af[_0x65b5('0xc')],'transfereeconnectedlinename':_0x5589af[_0x65b5('0xd')],'transfereeaccountcode':_0x5589af['transfereeaccountcode'],'transfereecontext':_0x5589af[_0x65b5('0xe')],'transfereeexten':_0x5589af[_0x65b5('0xf')],'transfereelinkedid':_0x5589af['transfereelinkedid'],'isexternal':_0x5589af[_0x65b5('0x10')],'context':_0x5589af[_0x65b5('0x11')],'extension':_0x5589af[_0x65b5('0x12')],'type':_0x65b5('0x13')},'log':_0x65b5('0x2')});};exports[_0x65b5('0x14')]=function(_0xf0b84d){return client[_0x65b5('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0xf0b84d[_0x65b5('0x15')],'transfererchannel':_0xf0b84d['origtransfererchannel'],'transferercalleridnum':_0xf0b84d[_0x65b5('0x16')],'transferercalleridname':_0xf0b84d[_0x65b5('0x17')],'transfererconnectedlinenum':_0xf0b84d[_0x65b5('0x18')],'transfererconnectedlinename':_0xf0b84d[_0x65b5('0x19')],'transfereraccountcode':_0xf0b84d[_0x65b5('0x1a')],'transferercontext':_0xf0b84d[_0x65b5('0x1b')],'transfererexten':_0xf0b84d[_0x65b5('0x1c')],'transfererlinkedid':_0xf0b84d[_0x65b5('0x1d')],'transfereechannel':_0xf0b84d[_0x65b5('0x1e')],'transfereecalleridnum':_0xf0b84d[_0x65b5('0x1f')],'transfereecalleridname':_0xf0b84d[_0x65b5('0x20')],'transfereeconnectedlinenum':_0xf0b84d[_0x65b5('0x21')],'transfereeconnectedlinename':_0xf0b84d['transfertargetconnectedlinename'],'transfereeaccountcode':_0xf0b84d['transfertargetaccountcode'],'transfereecontext':_0xf0b84d[_0x65b5('0x22')],'transfereeexten':_0xf0b84d['transfertargetexten'],'transfereelinkedid':_0xf0b84d[_0x65b5('0x23')],'isexternal':_0xf0b84d[_0x65b5('0x10')],'context':_0xf0b84d['origtransferercontext'],'extension':_0xf0b84d[_0x65b5('0x24')],'type':'attended'},'log':_0x65b5('0x2')});}; \ No newline at end of file +var _0xdd61=['transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0xdd61,0x174));var _0x1dd6=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xdd61[_0xd1d19a];return _0x52a79d;};'use strict';var client=require(_0x1dd6('0x0'));exports[_0x1dd6('0x1')]={};exports[_0x1dd6('0x2')]=function(_0x3a0df7){return client[_0x1dd6('0x3')](_0x1dd6('0x4'),{'body':{'result':_0x3a0df7[_0x1dd6('0x5')],'transfererchannel':_0x3a0df7[_0x1dd6('0x6')],'transferercalleridnum':_0x3a0df7['transferercalleridnum'],'transferercalleridname':_0x3a0df7['transferercalleridname'],'transfererconnectedlinenum':_0x3a0df7[_0x1dd6('0x7')],'transfererconnectedlinename':_0x3a0df7[_0x1dd6('0x8')],'transfereraccountcode':_0x3a0df7['transfereraccountcode'],'transferercontext':_0x3a0df7['transferercontext'],'transfererexten':_0x3a0df7[_0x1dd6('0x9')],'transfererlinkedid':_0x3a0df7[_0x1dd6('0xa')],'transfereechannel':_0x3a0df7[_0x1dd6('0xb')],'transfereecalleridnum':_0x3a0df7[_0x1dd6('0xc')],'transfereecalleridname':_0x3a0df7['transfereecalleridname'],'transfereeconnectedlinenum':_0x3a0df7[_0x1dd6('0xd')],'transfereeconnectedlinename':_0x3a0df7[_0x1dd6('0xe')],'transfereeaccountcode':_0x3a0df7[_0x1dd6('0xf')],'transfereecontext':_0x3a0df7[_0x1dd6('0x10')],'transfereeexten':_0x3a0df7[_0x1dd6('0x11')],'transfereelinkedid':_0x3a0df7['transfereelinkedid'],'isexternal':_0x3a0df7[_0x1dd6('0x12')],'context':_0x3a0df7[_0x1dd6('0x13')],'extension':_0x3a0df7[_0x1dd6('0x14')],'type':'blind'},'log':_0x1dd6('0x4')});};exports[_0x1dd6('0x15')]=function(_0x3ede15){return client[_0x1dd6('0x3')](_0x1dd6('0x4'),{'body':{'result':_0x3ede15[_0x1dd6('0x5')],'transfererchannel':_0x3ede15[_0x1dd6('0x16')],'transferercalleridnum':_0x3ede15[_0x1dd6('0x17')],'transferercalleridname':_0x3ede15['origtransferercalleridname'],'transfererconnectedlinenum':_0x3ede15['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3ede15[_0x1dd6('0x18')],'transfereraccountcode':_0x3ede15['origtransfereraccountcode'],'transferercontext':_0x3ede15[_0x1dd6('0x19')],'transfererexten':_0x3ede15[_0x1dd6('0x1a')],'transfererlinkedid':_0x3ede15[_0x1dd6('0x1b')],'transfereechannel':_0x3ede15[_0x1dd6('0x1c')],'transfereecalleridnum':_0x3ede15['transfertargetcalleridnum'],'transfereecalleridname':_0x3ede15[_0x1dd6('0x1d')],'transfereeconnectedlinenum':_0x3ede15[_0x1dd6('0x1e')],'transfereeconnectedlinename':_0x3ede15[_0x1dd6('0x1f')],'transfereeaccountcode':_0x3ede15[_0x1dd6('0x20')],'transfereecontext':_0x3ede15[_0x1dd6('0x21')],'transfereeexten':_0x3ede15[_0x1dd6('0x22')],'transfereelinkedid':_0x3ede15[_0x1dd6('0x23')],'isexternal':_0x3ede15[_0x1dd6('0x12')],'context':_0x3ede15[_0x1dd6('0x24')],'extension':_0x3ede15['origtransfererexten'],'type':_0x1dd6('0x25')},'log':_0x1dd6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 62a94d0..18c00a5 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 _0x9fe7=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','values','channels','uniqueid','channel','%s.%s','filename','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','voicechannel','resolve','Action','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','then','message','catch','isConnected','pick','command','Command','voiceQueues','strategy','answered','available','sumBillable','sumHoldTime','abandoned','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9fe7,0x1df));var _0x79fe=function(_0x4f9b49,_0x7a9d2e){_0x4f9b49=_0x4f9b49-0x0;var _0x56ac39=_0x9fe7[_0x4f9b49];return _0x56ac39;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var jayson=require('jayson/promise');var schema=require(_0x79fe('0x2'));var BPromise=require('bluebird');var moment=require(_0x79fe('0x3'));var config=require(_0x79fe('0x4'));var properties=require(_0x79fe('0x5'));var ami=require('../ami');exports[_0x79fe('0x6')]=function(_0x627ec4,_0x14e975,_0x4af9f6){return new BPromise(function(_0x3cec9c,_0x2a5aef){var _0x2ba246={'QueuePause':function(_0x4c8314){return new Promise(function(_0x24faa0,_0x264323){var _0x29b317=util[_0x79fe('0x7')](_0x79fe('0x8'),'SIP',_0x4c8314[_0x79fe('0x9')]);if(_0x627ec4[_0x79fe('0xa')]&&_0x627ec4['timers'][_0x29b317]&&_0x627ec4[_0x79fe('0xa')][_0x29b317][_0x79fe('0xb')]){_0x627ec4[_0x79fe('0xa')][_0x29b317][_0x79fe('0xc')]();}if(_0x627ec4['agents'][_0x29b317]){_0x627ec4[_0x79fe('0xd')][_0x29b317][_0x79fe('0xe')]({'statePause':_0x4c8314[_0x79fe('0xf')]?!![]:![]});}_0x24faa0({'code':0xc8,'message':_0x79fe('0x10')});});},'Reload':function(_0x1a83f2){var _0x260734=this;return new Promise(function(_0x42bbe4,_0x1abd7f){if(ami['isConnected']()==![]){return _0x1abd7f(_0x260734[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}_0x1a83f2=_['pick'](_0x1a83f2,_[_0x79fe('0x16')](properties[_0x79fe('0x17')]));_0x1a83f2[_0x79fe('0x18')]=_0x79fe('0x19');return ami['Action'](_0x1a83f2)[_0x79fe('0x1a')](function(_0x16f93a){_0x42bbe4({'code':0xc8,'message':_0x16f93a[_0x79fe('0x1b')]});})[_0x79fe('0x1c')](function(_0x536641){_0x1abd7f(_0x260734['error'](0x1f5,_0x536641[_0x79fe('0x1b')]));});});},'Command':function(_0x1a1224){var _0x25e51f=this;return new Promise(function(_0x4bca4d,_0x891611){if(ami[_0x79fe('0x1d')]()==![]){return _0x891611(_0x25e51f[_0x79fe('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x79fe('0x12')]['username'],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}_0x1a1224=_[_0x79fe('0x1e')](_0x1a1224,_0x79fe('0x1f'));_0x1a1224[_0x79fe('0x18')]=_0x79fe('0x20');return ami['Action'](_0x1a1224)['then'](function(_0x107641){_0x4bca4d({'code':0xc8,'message':_0x107641['content']});})[_0x79fe('0x1c')](function(_0x3721bc){_0x891611(_0x25e51f['error'](0x1f5,_0x3721bc['message']));});});},'VoiceQueues':function(_0x454e93){return new Promise(function(_0x321778,_0x59339b){var _0x46d93d=[];for(var _0x1c1f74 in _0x627ec4['voiceQueues']){if(_0x627ec4['voiceQueues']['hasOwnProperty'](_0x1c1f74)){var _0x3720fa=_0x627ec4[_0x79fe('0x21')][_0x1c1f74];var _0x36ead5={'id':_0x3720fa['id'],'name':_0x3720fa['name'],'strategy':_0x3720fa[_0x79fe('0x22')],'answered':_0x3720fa[_0x79fe('0x23')],'available':_0x3720fa[_0x79fe('0x24')],'loggedIn':_0x3720fa['loggedIn'],'pTalking':_0x3720fa['pTalking'],'sumBillable':_0x3720fa[_0x79fe('0x25')],'sumDuration':_0x3720fa['sumDuration'],'sumHoldTime':_0x3720fa[_0x79fe('0x26')]||0x0,'talking':_0x3720fa['talking'],'total':_0x3720fa['total'],'type':_0x3720fa['type'],'unmanaged':_0x3720fa['unmanaged'],'abandoned':_0x3720fa[_0x79fe('0x27')],'waiting':_0x3720fa[_0x79fe('0x28')],'loggedInDb':_0x3720fa['loggedInDb']};if(_0x3720fa[_0x79fe('0x29')]==='outbound'){_0x36ead5[_0x79fe('0x2a')]=_0x3720fa[_0x79fe('0x2a')];_0x36ead5[_0x79fe('0x2b')]=_0x3720fa[_0x79fe('0x2b')];_0x36ead5[_0x79fe('0x2c')]=_0x3720fa['dialOriginateCallerIdName'];_0x36ead5[_0x79fe('0x2d')]=_0x3720fa[_0x79fe('0x2d')];_0x36ead5[_0x79fe('0x2e')]=_0x3720fa[_0x79fe('0x2e')];_0x36ead5[_0x79fe('0x2f')]=_0x3720fa[_0x79fe('0x2f')];_0x36ead5['temp']=_0x3720fa[_0x79fe('0x30')];_0x36ead5[_0x79fe('0x31')]=_0x3720fa[_0x79fe('0x31')];_0x36ead5[_0x79fe('0x32')]=_0x3720fa[_0x79fe('0x32')];_0x36ead5[_0x79fe('0x33')]=_0x3720fa['outboundBlacklistCallsDay'];_0x36ead5[_0x79fe('0x34')]=_0x3720fa['outboundBusyCallsDay'];_0x36ead5[_0x79fe('0x35')]=_0x3720fa['outboundCongestionCallsDay'];_0x36ead5[_0x79fe('0x36')]=_0x3720fa['outboundDropCallsDayACS'];_0x36ead5[_0x79fe('0x37')]=_0x3720fa[_0x79fe('0x37')];_0x36ead5[_0x79fe('0x38')]=_0x3720fa['outboundDropCallsDayTimeout'];_0x36ead5[_0x79fe('0x39')]=_0x3720fa[_0x79fe('0x39')];_0x36ead5[_0x79fe('0x3a')]=_0x3720fa[_0x79fe('0x3a')];_0x36ead5[_0x79fe('0x3b')]=_0x3720fa['outboundOriginateFailureCallsDay'];_0x36ead5['outboundReCallsDay']=_0x3720fa[_0x79fe('0x3c')];_0x36ead5['outboundRejectCallsDay']=_0x3720fa[_0x79fe('0x3d')];_0x36ead5[_0x79fe('0x3e')]=_0x3720fa['outboundUnknownCallsDay'];_0x36ead5[_0x79fe('0x3f')]=_0x3720fa[_0x79fe('0x3f')];_0x36ead5[_0x79fe('0x40')]=_0x3720fa[_0x79fe('0x40')];_0x36ead5[_0x79fe('0x41')]=_0x3720fa[_0x79fe('0x41')];_0x36ead5['predictiveIntervalDroppedCallsCallersExit']=_0x3720fa[_0x79fe('0x42')];_0x36ead5[_0x79fe('0x43')]=_0x3720fa[_0x79fe('0x43')];_0x36ead5[_0x79fe('0x44')]=_0x3720fa['predictiveIntervalErlangCalls'];_0x36ead5[_0x79fe('0x45')]=_0x3720fa['predictiveIntervalErlangCallsDroppedCalls'];_0x36ead5[_0x79fe('0x46')]=_0x3720fa['predictiveIntervalHitRate'];_0x36ead5[_0x79fe('0x47')]=_0x3720fa['predictiveIntervalMultiplicativeFactor'];_0x36ead5[_0x79fe('0x48')]=_0x3720fa[_0x79fe('0x48')];_0x36ead5['predictiveIntervalAvailable']=_0x3720fa['predictiveIntervalAvailable'];_0x36ead5[_0x79fe('0x49')]=_0x3720fa[_0x79fe('0x49')];_0x36ead5[_0x79fe('0x1b')]=_0x3720fa[_0x79fe('0x1b')];_0x36ead5['originated']=_0x3720fa['originated'];_0x36ead5[_0x79fe('0x4a')]=_0x3720fa[_0x79fe('0x4a')];_0x36ead5[_0x79fe('0x4b')]=_0x3720fa[_0x79fe('0x4b')];_0x36ead5[_0x79fe('0x4c')]=_0x3720fa[_0x79fe('0x4c')];_0x36ead5[_0x79fe('0x4d')]=_0x3720fa[_0x79fe('0x4d')];_0x36ead5['startPredictive']=_0x3720fa[_0x79fe('0x4e')];_0x36ead5[_0x79fe('0x4f')]=_0x3720fa[_0x79fe('0x4f')];}if(_0x3720fa[_0x79fe('0x50')]){_0x36ead5[_0x79fe('0x50')]={'id':_0x3720fa[_0x79fe('0x50')]['id'],'name':_0x3720fa['Trunk'][_0x79fe('0x9')],'active':_0x3720fa[_0x79fe('0x50')][_0x79fe('0x51')],'callerid':_0x3720fa[_0x79fe('0x50')][_0x79fe('0x52')]};}if(_0x3720fa[_0x79fe('0x53')]){_0x36ead5['Interval']={'id':_0x3720fa[_0x79fe('0x53')]['id'],'name':_0x3720fa[_0x79fe('0x53')][_0x79fe('0x9')]};}_0x46d93d['push'](_0x36ead5);}}_0x321778({'count':_0x46d93d[_0x79fe('0x54')],'rows':_0x46d93d});});},'UpdateVoiceQueue':function(_0x563b71){return new Promise(function(_0x569c78,_0x28068f){var _0x379272=_[_0x79fe('0x55')](_0x627ec4['voiceQueues'],{'id':parseInt(_0x563b71['id'])});var _0x2aebbc=_[_0x79fe('0x56')](_0x563b71,['id']);if(_0x379272){for(var _0x42c5af in _0x2aebbc){if(typeof _0x2aebbc[_0x42c5af]!=='undefined'&&typeof _0x379272[_0x42c5af]!=='undefined'){_0x379272[_0x42c5af]=_0x2aebbc[_0x42c5af];}}_0x569c78(_0x379272);}else{_0x28068f();}});},'VoiceChannels':function(_0x4b904d){return new Promise(function(_0x205d67,_0x1594ce){var _0xd5de03=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x58')]);_0x205d67({'count':_0xd5de03[_0x79fe('0x54')],'rows':_0xd5de03});});},'VoiceChannelMixMonitor':function(_0x23f270){var _0x2b46ad=this;return new Promise(function(_0x5a1779,_0x41f153){if(ami[_0x79fe('0x1d')]()==![]){return _0x41f153(_0x2b46ad['error'](0x1f4,[config[_0x79fe('0x12')]['ip'],config['asterisk'][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x1761d7=schema(properties['voicechannel'])[_0x79fe('0x2')](_0x23f270);if(_0x1761d7[_0x79fe('0x54')]>0x0){return _0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f4,_['map'](_0x1761d7,'message')[_0x79fe('0x15')](',\x20')));}var _0x1ce058=_['find'](_0x627ec4[_0x79fe('0x58')],{'uniqueid':_0x23f270[_0x79fe('0x59')]});if(_0x1ce058&&_0x1ce058[_0x79fe('0x5a')]){var _0xeb0195=util['format'](_0x79fe('0x5b'),_0x23f270[_0x79fe('0x5c')]||_0x23f270[_0x79fe('0x59')],_0x23f270['format']||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x1ce058['channel'],'file':_0xeb0195,'options':_0x79fe('0x5d')})[_0x79fe('0x1a')](function(_0x4f0ca8){var _0x1ccd76=_[_0x79fe('0x55')](_0x1ce058[_0x79fe('0x5e')],{'filename':'/var/spool/asterisk/monitor/'+_0xeb0195['toLowerCase']()});if(_['isNil'](_0x1ccd76)){_0x1ce058[_0x79fe('0x5e')]['push']({'filename':_0x79fe('0x5f')+_0xeb0195[_0x79fe('0x60')](),'createdAt':moment()[_0x79fe('0x7')](_0x79fe('0x61')),'mixmonitorid':_0x4f0ca8[_0x79fe('0x62')],'status':_0x79fe('0x63')});}else{_0x1ccd76[_0x79fe('0x62')]=_0x4f0ca8[_0x79fe('0x62')];_0x1ccd76[_0x79fe('0x64')]=_0x79fe('0x63');}_0x5a1779({'code':0xc8,'message':[_0x23f270[_0x79fe('0x59')],'MixMonitor\x20Success',_0x4f0ca8[_0x79fe('0x62')]][_0x79fe('0x15')]('\x20'),'mixmonitorid':_0x4f0ca8['mixmonitorid']});})[_0x79fe('0x1c')](function(_0x5eca77){_0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f5,[_0x23f270[_0x79fe('0x59')],_0x5eca77['message'][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5ef724){var _0x492ac1=this;return new Promise(function(_0x9728b9,_0x272272){if(ami[_0x79fe('0x1d')]()==![]){return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x562f29=schema(properties[_0x79fe('0x65')])[_0x79fe('0x2')](_0x5ef724);if(_0x562f29[_0x79fe('0x54')]>0x0){return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f4,_['map'](_0x562f29,_0x79fe('0x1b'))['join'](',\x20')));}var _0x24da87=_['find'](_0x627ec4[_0x79fe('0x58')],{'uniqueid':_0x5ef724[_0x79fe('0x59')]});if(_0x24da87){return BPromise[_0x79fe('0x66')]()[_0x79fe('0x1a')](function(){if(_0x24da87['channel']){return ami[_0x79fe('0x67')]({'action':_0x79fe('0x68'),'channel':_0x24da87[_0x79fe('0x5a')],'mixmonitorid':_0x5ef724[_0x79fe('0x62')]})['catch'](function(_0x9e880c){});}})[_0x79fe('0x1a')](function(){if(_0x24da87['destinationchannel']){return ami[_0x79fe('0x67')]({'action':'StopMixMonitor','channel':_0x24da87['destinationchannel'],'mixmonitorid':_0x5ef724[_0x79fe('0x62')]})[_0x79fe('0x1c')](function(_0x60161c){});}})['then'](function(_0x58adb7){var _0x21fda0=_['find'](_0x24da87['monitors'],{'mixmonitorid':_0x5ef724[_0x79fe('0x62')]});if(_0x21fda0){_0x21fda0[_0x79fe('0x64')]=_0x79fe('0x69');}})[_0x79fe('0x1a')](function(){var _0x54b3fb=util[_0x79fe('0x7')](_0x79fe('0x5b'),_0x5ef724[_0x79fe('0x5c')]||_0x5ef724[_0x79fe('0x59')],_0x5ef724['format']||_0x79fe('0x6a'));var _0x36e157=_['find'](_0x24da87[_0x79fe('0x5e')],{'filename':_0x79fe('0x5f')+_0x54b3fb[_0x79fe('0x60')]()});if(_0x36e157){_0x36e157[_0x79fe('0x64')]=_0x79fe('0x69');}})[_0x79fe('0x1a')](function(){_0x9728b9({'code':0xc8,'message':[_0x5ef724[_0x79fe('0x59')],_0x79fe('0x6b')][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x35ea01){_0x272272(_0x492ac1['error'](0x1f5,[_0x5ef724[_0x79fe('0x59')],_0x35ea01[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')));});}else{return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannels':function(_0x177777){return new Promise(function(_0x492d92,_0xdf3368){var _0x238d57=_[_0x79fe('0x57')](_0x627ec4['queueChannels']);_0x492d92({'count':_0x238d57['length'],'rows':_0x238d57});});},'VoiceQueuesChannel':function(_0x5e7a6e){var _0x4cec0c=this;return new Promise(function(_0x16525f,_0x485b00){var _0x31440b=schema(properties[_0x79fe('0x6d')])[_0x79fe('0x2')](_0x5e7a6e);if(_0x31440b[_0x79fe('0x54')]>0x0){return _0x485b00(_0x4cec0c[_0x79fe('0x11')](0x1f4,_['map'](_0x31440b,_0x79fe('0x1b'))['join'](',\x20')));}var _0x234f4d=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x5e7a6e[_0x79fe('0x59')]});if(_0x234f4d){_0x16525f(_0x234f4d);}else{return _0x485b00(_0x4cec0c[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x467f5b){var _0x54bd13=this;return new Promise(function(_0x24d539,_0x50c361){if(ami[_0x79fe('0x1d')]()==![]){return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config['asterisk'][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x46f42a=schema(properties['voicequeuechannelhangup'])[_0x79fe('0x2')](_0x467f5b);if(_0x46f42a[_0x79fe('0x54')]>0x0){return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f4,_['map'](_0x46f42a,_0x79fe('0x1b'))[_0x79fe('0x15')](',\x20')));}var _0x3db2ed=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x467f5b[_0x79fe('0x59')]});if(_0x3db2ed&&_0x3db2ed[_0x79fe('0x5a')]){return ami[_0x79fe('0x67')]({'action':_0x79fe('0x6f'),'channel':_0x3db2ed['channel']})[_0x79fe('0x1a')](function(_0x5122c8){_0x24d539({'code':0xc8,'message':[_0x467f5b[_0x79fe('0x59')],_0x5122c8[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x5d6035){_0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f5,[_0x467f5b['uniqueid'],_0x5d6035[_0x79fe('0x1b')][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x18262c){var _0x256035=this;return new Promise(function(_0x1b370f,_0x5490ff){if(ami[_0x79fe('0x1d')]()==![]){return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x24c6ad=schema(properties[_0x79fe('0x70')])[_0x79fe('0x2')](_0x18262c);if(_0x24c6ad['length']>0x0){return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f4,_['map'](_0x24c6ad,_0x79fe('0x1b'))['join'](',\x20')));}var _0x38cb89=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x18262c[_0x79fe('0x59')]});if(_0x38cb89&&_0x38cb89[_0x79fe('0x5a')]){return ami['Action']({'action':_0x79fe('0x71'),'channel':_0x38cb89[_0x79fe('0x5a')],'exten':_0x18262c[_0x79fe('0x72')],'context':_0x18262c[_0x79fe('0x73')]||_0x38cb89['context'],'priority':0x1})[_0x79fe('0x1a')](function(_0x4c25b1){_0x1b370f({'code':0xc8,'message':[_0x18262c[_0x79fe('0x59')],_0x4c25b1[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x55e65a){_0x5490ff(_0x256035[_0x79fe('0x11')](0x1f5,[_0x18262c['uniqueid'],_0x55e65a[_0x79fe('0x1b')][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'Agents':function(_0x19c444){return new Promise(function(_0x3aa36b,_0x40392a){var _0x41bb50=_['values'](_0x627ec4['agents']);_0x3aa36b({'count':_0x41bb50[_0x79fe('0x54')],'rows':_0x41bb50});});},'Telephones':function(_0x141661){return new Promise(function(_0x1034a5,_0x550501){var _0xfde41e=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x74')]);_0x1034a5({'count':_0xfde41e[_0x79fe('0x54')],'rows':_0xfde41e});});},'Trunks':function(_0x285e73){return new Promise(function(_0x4ccda7,_0x3fbb0e){var _0xfb2ee6=_[_0x79fe('0x57')](_0x627ec4['trunks']);_0x4ccda7({'count':_0xfb2ee6[_0x79fe('0x54')],'rows':_0xfb2ee6});});},'OutboundChannels':function(_0x187a5a){return new Promise(function(_0x3362a6,_0x175ee6){var _0x5c00c6=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x75')]);_0x3362a6({'count':_0x5c00c6['length'],'rows':_0x5c00c6});});},'Outbound':function(_0x40a2ba){return new Promise(function(_0x125940,_0x227a97){_0x125940(_0x627ec4[_0x79fe('0x76')]);});},'Campaigns':function(_0x4887c4){return new Promise(function(_0x56c8d2,_0x345c7f){var _0x3ad4b7=_['values'](_0x627ec4['campaigns']);_0x56c8d2({'count':_0x3ad4b7['length'],'rows':_0x3ad4b7});});},'VoiceQueuesPreview':function(_0x381d08){var _0x309ef2=this;return new Promise(function(_0xd783c9,_0x32aae7){_0x14e975[_0x79fe('0x77')](_0x381d08['id'])['then'](function(_0x3521ff){_0xd783c9({'code':0xc8,'message':_0x3521ff[_0x79fe('0x1b')]});})['catch'](function(_0x39d0a7){_0x32aae7(_0x309ef2['error'](0x1f4,_0x39d0a7['message']));});});},'EventManager':function(_0x4662f8){var _0x359773=this;return new Promise(function(_0x13cf1a,_0x2fe027){if(!_0x4662f8[_0x79fe('0x78')]){return _0x2fe027(_0x359773[_0x79fe('0x11')](0x1f4,_0x79fe('0x79')));}ami[_0x79fe('0x7a')](_0x79fe('0x7b')+_0x4662f8[_0x79fe('0x78')],_0x4662f8[_0x79fe('0x1b')]);_0x13cf1a({'code':0xc8,'message':_0x4662f8});});},'FaxAccounts':function(_0x57a104){return new Promise(function(_0x56eff3,_0x245b77){var _0x1562da=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x7c')]);_0x56eff3({'count':_0x1562da[_0x79fe('0x54')],'rows':_0x1562da});});},'SendFax':function(_0x2beaf4){var _0x3e910e=this;return new Promise(function(_0x3390b2,_0x5ce655){_0x4af9f6[_0x79fe('0x7d')](_0x2beaf4)[_0x79fe('0x1a')](function(_0x25ce8d){_0x3390b2({'code':0xc8,'message':_0x25ce8d[_0x79fe('0x1b')]});})['catch'](function(_0xfcbd13){_0x5ce655(_0x3e910e['error'](0x1f4,_0xfcbd13[_0x79fe('0x1b')]));});});},'CheckAfterSend':function(_0x482d04){var _0x46151b=this;return new Promise(function(_0x44b212,_0x1d0b25){_0x4af9f6[_0x79fe('0x7e')](_0x482d04)[_0x79fe('0x1a')](function(_0x37d301){_0x44b212({'code':0xc8,'message':_0x37d301['message']});})['catch'](function(_0x2837b7){_0x1d0b25(_0x46151b[_0x79fe('0x11')](0x1f4,_0x2837b7[_0x79fe('0x1b')]));});});}};var _0x182e01=jayson[_0x79fe('0x7f')](_0x2ba246)['http']();_0x182e01['on'](_0x79fe('0x11'),function(_0x4e6725){return _0x2a5aef(_0x4e6725);});_0x182e01['listen'](0x232a,_0x79fe('0x80'),function(){console['log'](_0x79fe('0x81'),0x232a);return _0x3cec9c(_0x79fe('0x82')+0x232a);});});}; \ No newline at end of file +var _0x6ec2=['error','asterisk','username','ami\x20disconnected','join','module','action','Reload','Action','message','pick','command','Command','content','catch','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','channel','%s.%s','filename','uniqueid','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','then','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','emit','custom:','event','faxAccounts','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','QueuePause','isConnected'];(function(_0x5d2be4,_0x16c38a){var _0x1b6cfc=function(_0x51242e){while(--_0x51242e){_0x5d2be4['push'](_0x5d2be4['shift']());}};_0x1b6cfc(++_0x16c38a);}(_0x6ec2,0x78));var _0x26ec=function(_0x1d6137,_0x574d62){_0x1d6137=_0x1d6137-0x0;var _0x33529c=_0x6ec2[_0x1d6137];return _0x33529c;};'use strict';var _=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var jayson=require(_0x26ec('0x2'));var schema=require(_0x26ec('0x3'));var BPromise=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var config=require('../../../config/environment');var properties=require(_0x26ec('0x6'));var ami=require(_0x26ec('0x7'));exports[_0x26ec('0x8')]=function(_0x13f29c,_0x375e01,_0x4ce209){return new BPromise(function(_0x3b5955,_0x4e8781){var _0x4cadb0={'QueuePause':function(_0xf2cd1d){return new Promise(function(_0x2802e7,_0x14c6ae){var _0x4a70c4=util[_0x26ec('0x9')]('%s/%s',_0x26ec('0xa'),_0xf2cd1d[_0x26ec('0xb')]);if(_0x13f29c[_0x26ec('0xc')]&&_0x13f29c[_0x26ec('0xc')][_0x4a70c4]&&_0x13f29c[_0x26ec('0xc')][_0x4a70c4][_0x26ec('0xd')]){_0x13f29c[_0x26ec('0xc')][_0x4a70c4][_0x26ec('0xe')]();}if(_0x13f29c[_0x26ec('0xf')][_0x4a70c4]){_0x13f29c[_0x26ec('0xf')][_0x4a70c4]['updateStatusRealtime']({'statePause':_0xf2cd1d['pause']?!![]:![]});}_0x2802e7({'code':0xc8,'message':_0x26ec('0x10')});});},'Reload':function(_0x1bec27){var _0x1149fb=this;return new Promise(function(_0x25ba7c,_0x4142fe){if(ami[_0x26ec('0x11')]()==![]){return _0x4142fe(_0x1149fb[_0x26ec('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x26ec('0x13')][_0x26ec('0x14')],_0x26ec('0x15')][_0x26ec('0x16')]('\x20')));}_0x1bec27=_['pick'](_0x1bec27,_['keys'](properties[_0x26ec('0x17')]));_0x1bec27[_0x26ec('0x18')]=_0x26ec('0x19');return ami[_0x26ec('0x1a')](_0x1bec27)['then'](function(_0x17282d){_0x25ba7c({'code':0xc8,'message':_0x17282d[_0x26ec('0x1b')]});})['catch'](function(_0x5ef1e5){_0x4142fe(_0x1149fb['error'](0x1f5,_0x5ef1e5[_0x26ec('0x1b')]));});});},'Command':function(_0x38516d){var _0x60511e=this;return new Promise(function(_0x4f6eb5,_0x4ad50c){if(ami[_0x26ec('0x11')]()==![]){return _0x4ad50c(_0x60511e[_0x26ec('0x12')](0x1f4,[config[_0x26ec('0x13')]['ip'],config[_0x26ec('0x13')][_0x26ec('0x14')],_0x26ec('0x15')]['join']('\x20')));}_0x38516d=_[_0x26ec('0x1c')](_0x38516d,_0x26ec('0x1d'));_0x38516d[_0x26ec('0x18')]=_0x26ec('0x1e');return ami[_0x26ec('0x1a')](_0x38516d)['then'](function(_0x5202e6){_0x4f6eb5({'code':0xc8,'message':_0x5202e6[_0x26ec('0x1f')]});})[_0x26ec('0x20')](function(_0x65aea3){_0x4ad50c(_0x60511e['error'](0x1f5,_0x65aea3['message']));});});},'VoiceQueues':function(_0x19cadf){return new Promise(function(_0xaf6c39,_0x16aba4){var _0x365fac=[];for(var _0x4030ea in _0x13f29c[_0x26ec('0x21')]){if(_0x13f29c[_0x26ec('0x21')]['hasOwnProperty'](_0x4030ea)){var _0x50fedc=_0x13f29c['voiceQueues'][_0x4030ea];var _0x45509f={'id':_0x50fedc['id'],'name':_0x50fedc[_0x26ec('0xb')],'strategy':_0x50fedc[_0x26ec('0x22')],'answered':_0x50fedc[_0x26ec('0x23')],'available':_0x50fedc[_0x26ec('0x24')],'loggedIn':_0x50fedc[_0x26ec('0x25')],'pTalking':_0x50fedc[_0x26ec('0x26')],'sumBillable':_0x50fedc['sumBillable'],'sumDuration':_0x50fedc[_0x26ec('0x27')],'sumHoldTime':_0x50fedc['sumHoldTime']||0x0,'talking':_0x50fedc[_0x26ec('0x28')],'total':_0x50fedc[_0x26ec('0x29')],'type':_0x50fedc['type'],'unmanaged':_0x50fedc[_0x26ec('0x2a')],'abandoned':_0x50fedc[_0x26ec('0x2b')],'waiting':_0x50fedc[_0x26ec('0x2c')],'loggedInDb':_0x50fedc[_0x26ec('0x2d')]};if(_0x50fedc[_0x26ec('0x2e')]===_0x26ec('0x2f')){_0x45509f['dialActive']=_0x50fedc[_0x26ec('0x30')];_0x45509f['dialMethod']=_0x50fedc[_0x26ec('0x31')];_0x45509f['dialOriginateCallerIdName']=_0x50fedc[_0x26ec('0x32')];_0x45509f[_0x26ec('0x33')]=_0x50fedc['dialOriginateCallerIdNumber'];_0x45509f[_0x26ec('0x34')]=_0x50fedc[_0x26ec('0x34')];_0x45509f[_0x26ec('0x35')]=_0x50fedc[_0x26ec('0x35')];_0x45509f[_0x26ec('0x36')]=_0x50fedc[_0x26ec('0x36')];_0x45509f['outboundAnswerAgiCallsDay']=_0x50fedc['outboundAnswerAgiCallsDay'];_0x45509f['outboundAnswerCallsDay']=_0x50fedc['outboundAnswerCallsDay'];_0x45509f['outboundBlacklistCallsDay']=_0x50fedc[_0x26ec('0x37')];_0x45509f[_0x26ec('0x38')]=_0x50fedc[_0x26ec('0x38')];_0x45509f[_0x26ec('0x39')]=_0x50fedc[_0x26ec('0x39')];_0x45509f['outboundDropCallsDayACS']=_0x50fedc[_0x26ec('0x3a')];_0x45509f[_0x26ec('0x3b')]=_0x50fedc[_0x26ec('0x3b')];_0x45509f[_0x26ec('0x3c')]=_0x50fedc[_0x26ec('0x3c')];_0x45509f['outboundNoAnswerCallsDay']=_0x50fedc[_0x26ec('0x3d')];_0x45509f[_0x26ec('0x3e')]=_0x50fedc[_0x26ec('0x3e')];_0x45509f[_0x26ec('0x3f')]=_0x50fedc[_0x26ec('0x3f')];_0x45509f[_0x26ec('0x40')]=_0x50fedc[_0x26ec('0x40')];_0x45509f[_0x26ec('0x41')]=_0x50fedc[_0x26ec('0x41')];_0x45509f[_0x26ec('0x42')]=_0x50fedc['outboundUnknownCallsDay'];_0x45509f['predictiveIntervalAnsweredCalls']=_0x50fedc[_0x26ec('0x43')];_0x45509f[_0x26ec('0x44')]=_0x50fedc['predictiveIntervalAvgHoldtime'];_0x45509f[_0x26ec('0x45')]=_0x50fedc['predictiveIntervalAvgTalktime'];_0x45509f[_0x26ec('0x46')]=_0x50fedc[_0x26ec('0x46')];_0x45509f[_0x26ec('0x47')]=_0x50fedc[_0x26ec('0x47')];_0x45509f[_0x26ec('0x48')]=_0x50fedc[_0x26ec('0x48')];_0x45509f['predictiveIntervalErlangCallsDroppedCalls']=_0x50fedc[_0x26ec('0x49')];_0x45509f[_0x26ec('0x4a')]=_0x50fedc[_0x26ec('0x4a')];_0x45509f[_0x26ec('0x4b')]=_0x50fedc[_0x26ec('0x4b')];_0x45509f[_0x26ec('0x4c')]=_0x50fedc[_0x26ec('0x4c')];_0x45509f[_0x26ec('0x4d')]=_0x50fedc[_0x26ec('0x4d')];_0x45509f[_0x26ec('0x4e')]=_0x50fedc[_0x26ec('0x4e')];_0x45509f[_0x26ec('0x1b')]=_0x50fedc[_0x26ec('0x1b')];_0x45509f[_0x26ec('0x4f')]=_0x50fedc[_0x26ec('0x4f')];_0x45509f['erlangCalls']=_0x50fedc[_0x26ec('0x50')];_0x45509f[_0x26ec('0x51')]=_0x50fedc[_0x26ec('0x51')];_0x45509f[_0x26ec('0x52')]=_0x50fedc[_0x26ec('0x52')];_0x45509f[_0x26ec('0x53')]=_0x50fedc['erlangBusyFactor'];_0x45509f['startPredictive']=_0x50fedc[_0x26ec('0x54')];_0x45509f['startProgressive']=_0x50fedc[_0x26ec('0x55')];}if(_0x50fedc[_0x26ec('0x56')]){_0x45509f[_0x26ec('0x56')]={'id':_0x50fedc[_0x26ec('0x56')]['id'],'name':_0x50fedc[_0x26ec('0x56')][_0x26ec('0xb')],'active':_0x50fedc[_0x26ec('0x56')][_0x26ec('0x57')],'callerid':_0x50fedc['Trunk'][_0x26ec('0x58')]};}if(_0x50fedc[_0x26ec('0x59')]){_0x45509f[_0x26ec('0x59')]={'id':_0x50fedc['Interval']['id'],'name':_0x50fedc[_0x26ec('0x59')][_0x26ec('0xb')]};}_0x365fac[_0x26ec('0x5a')](_0x45509f);}}_0xaf6c39({'count':_0x365fac[_0x26ec('0x5b')],'rows':_0x365fac});});},'UpdateVoiceQueue':function(_0xe89d5f){return new Promise(function(_0x1d698b,_0x42724f){var _0xbfc5a2=_[_0x26ec('0x5c')](_0x13f29c[_0x26ec('0x21')],{'id':parseInt(_0xe89d5f['id'])});var _0x211947=_[_0x26ec('0x5d')](_0xe89d5f,['id']);if(_0xbfc5a2){for(var _0x2950bd in _0x211947){if(typeof _0x211947[_0x2950bd]!==_0x26ec('0x5e')&&typeof _0xbfc5a2[_0x2950bd]!=='undefined'){_0xbfc5a2[_0x2950bd]=_0x211947[_0x2950bd];}}_0x1d698b(_0xbfc5a2);}else{_0x42724f();}});},'VoiceChannels':function(_0x59cda3){return new Promise(function(_0x121e2f,_0x5be55c){var _0x4f873e=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x60')]);_0x121e2f({'count':_0x4f873e[_0x26ec('0x5b')],'rows':_0x4f873e});});},'VoiceChannelMixMonitor':function(_0x551045){var _0x4a5ce1=this;return new Promise(function(_0x5edd85,_0x534a11){if(ami[_0x26ec('0x11')]()==![]){return _0x534a11(_0x4a5ce1['error'](0x1f4,[config[_0x26ec('0x13')]['ip'],config[_0x26ec('0x13')]['username'],'ami\x20disconnected'][_0x26ec('0x16')]('\x20')));}var _0x2d5866=schema(properties['voicechannel'])[_0x26ec('0x3')](_0x551045);if(_0x2d5866[_0x26ec('0x5b')]>0x0){return _0x534a11(_0x4a5ce1['error'](0x1f4,_['map'](_0x2d5866,_0x26ec('0x1b'))[_0x26ec('0x16')](',\x20')));}var _0x10a4f3=_['find'](_0x13f29c[_0x26ec('0x60')],{'uniqueid':_0x551045['uniqueid']});if(_0x10a4f3&&_0x10a4f3[_0x26ec('0x61')]){var _0x179f9f=util[_0x26ec('0x9')](_0x26ec('0x62'),_0x551045[_0x26ec('0x63')]||_0x551045[_0x26ec('0x64')],_0x551045['format']||_0x26ec('0x65'));return ami[_0x26ec('0x1a')]({'action':'MixMonitor','channel':_0x10a4f3[_0x26ec('0x61')],'file':_0x179f9f,'options':_0x26ec('0x66')})['then'](function(_0x316416){var _0x47b2e9=_['find'](_0x10a4f3[_0x26ec('0x67')],{'filename':_0x26ec('0x68')+_0x179f9f[_0x26ec('0x69')]()});if(_['isNil'](_0x47b2e9)){_0x10a4f3['monitors'][_0x26ec('0x5a')]({'filename':_0x26ec('0x68')+_0x179f9f[_0x26ec('0x69')](),'createdAt':moment()['format'](_0x26ec('0x6a')),'mixmonitorid':_0x316416[_0x26ec('0x6b')],'status':'rec'});}else{_0x47b2e9['mixmonitorid']=_0x316416[_0x26ec('0x6b')];_0x47b2e9['status']=_0x26ec('0x6c');}_0x5edd85({'code':0xc8,'message':[_0x551045[_0x26ec('0x64')],_0x26ec('0x6d'),_0x316416[_0x26ec('0x6b')]]['join']('\x20'),'mixmonitorid':_0x316416['mixmonitorid']});})[_0x26ec('0x20')](function(_0xad1ee7){_0x534a11(_0x4a5ce1[_0x26ec('0x12')](0x1f5,[_0x551045[_0x26ec('0x64')],_0xad1ee7[_0x26ec('0x1b')][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')));});}else{return _0x534a11(_0x4a5ce1['error'](0x1f5,_0x26ec('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x4a67e4){var _0x41d0fa=this;return new Promise(function(_0x2e77a9,_0x2e0c77){if(ami[_0x26ec('0x11')]()==![]){return _0x2e0c77(_0x41d0fa[_0x26ec('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x26ec('0x13')][_0x26ec('0x14')],_0x26ec('0x15')][_0x26ec('0x16')]('\x20')));}var _0x53ffa5=schema(properties[_0x26ec('0x6f')])[_0x26ec('0x3')](_0x4a67e4);if(_0x53ffa5['length']>0x0){return _0x2e0c77(_0x41d0fa[_0x26ec('0x12')](0x1f4,_[_0x26ec('0x70')](_0x53ffa5,_0x26ec('0x1b'))[_0x26ec('0x16')](',\x20')));}var _0x2a9c55=_[_0x26ec('0x5c')](_0x13f29c[_0x26ec('0x60')],{'uniqueid':_0x4a67e4['uniqueid']});if(_0x2a9c55){return BPromise[_0x26ec('0x71')]()[_0x26ec('0x72')](function(){if(_0x2a9c55['channel']){return ami[_0x26ec('0x1a')]({'action':_0x26ec('0x73'),'channel':_0x2a9c55[_0x26ec('0x61')],'mixmonitorid':_0x4a67e4[_0x26ec('0x6b')]})[_0x26ec('0x20')](function(_0x3ba1c8){});}})[_0x26ec('0x72')](function(){if(_0x2a9c55[_0x26ec('0x74')]){return ami[_0x26ec('0x1a')]({'action':_0x26ec('0x73'),'channel':_0x2a9c55[_0x26ec('0x74')],'mixmonitorid':_0x4a67e4[_0x26ec('0x6b')]})[_0x26ec('0x20')](function(_0x35bac1){});}})[_0x26ec('0x72')](function(_0x4a8769){var _0x504aa6=_['find'](_0x2a9c55['monitors'],{'mixmonitorid':_0x4a67e4[_0x26ec('0x6b')]});if(_0x504aa6){_0x504aa6[_0x26ec('0x75')]=_0x26ec('0x76');}})['then'](function(){var _0x1ae4a5=util['format'](_0x26ec('0x62'),_0x4a67e4[_0x26ec('0x63')]||_0x4a67e4[_0x26ec('0x64')],_0x4a67e4['format']||_0x26ec('0x65'));var _0x2579c2=_[_0x26ec('0x5c')](_0x2a9c55[_0x26ec('0x67')],{'filename':_0x26ec('0x68')+_0x1ae4a5['toLowerCase']()});if(_0x2579c2){_0x2579c2[_0x26ec('0x75')]=_0x26ec('0x76');}})['then'](function(){_0x2e77a9({'code':0xc8,'message':[_0x4a67e4[_0x26ec('0x64')],_0x26ec('0x77')][_0x26ec('0x16')]('\x20')});})['catch'](function(_0x29aac1){_0x2e0c77(_0x41d0fa[_0x26ec('0x12')](0x1f5,[_0x4a67e4[_0x26ec('0x64')],_0x29aac1[_0x26ec('0x1b')][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')));});}else{return _0x2e0c77(_0x41d0fa[_0x26ec('0x12')](0x1f5,_0x26ec('0x6e')));}});},'VoiceQueuesChannels':function(_0x1bb8ea){return new Promise(function(_0x2e283e,_0x1ab092){var _0x6ab7d4=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x78')]);_0x2e283e({'count':_0x6ab7d4[_0x26ec('0x5b')],'rows':_0x6ab7d4});});},'VoiceQueuesChannel':function(_0x463cba){var _0x5d4514=this;return new Promise(function(_0x483cec,_0x1abe14){var _0x3596d3=schema(properties[_0x26ec('0x79')])[_0x26ec('0x3')](_0x463cba);if(_0x3596d3[_0x26ec('0x5b')]>0x0){return _0x1abe14(_0x5d4514[_0x26ec('0x12')](0x1f4,_['map'](_0x3596d3,_0x26ec('0x1b'))[_0x26ec('0x16')](',\x20')));}var _0x474cf3=_[_0x26ec('0x5c')](_0x13f29c[_0x26ec('0x78')],{'uniqueid':_0x463cba[_0x26ec('0x64')]});if(_0x474cf3){_0x483cec(_0x474cf3);}else{return _0x1abe14(_0x5d4514[_0x26ec('0x12')](0x1f5,_0x26ec('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x8f92bf){var _0x19245c=this;return new Promise(function(_0x3e777c,_0x5db03e){if(ami[_0x26ec('0x11')]()==![]){return _0x5db03e(_0x19245c[_0x26ec('0x12')](0x1f4,[config[_0x26ec('0x13')]['ip'],config['asterisk'][_0x26ec('0x14')],_0x26ec('0x15')]['join']('\x20')));}var _0x1c2155=schema(properties['voicequeuechannelhangup'])[_0x26ec('0x3')](_0x8f92bf);if(_0x1c2155[_0x26ec('0x5b')]>0x0){return _0x5db03e(_0x19245c[_0x26ec('0x12')](0x1f4,_[_0x26ec('0x70')](_0x1c2155,_0x26ec('0x1b'))[_0x26ec('0x16')](',\x20')));}var _0x504b25=_[_0x26ec('0x5c')](_0x13f29c[_0x26ec('0x78')],{'uniqueid':_0x8f92bf['uniqueid']});if(_0x504b25&&_0x504b25[_0x26ec('0x61')]){return ami[_0x26ec('0x1a')]({'action':'Hangup','channel':_0x504b25[_0x26ec('0x61')]})['then'](function(_0x461820){_0x3e777c({'code':0xc8,'message':[_0x8f92bf[_0x26ec('0x64')],_0x461820['message'][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')});})['catch'](function(_0x12fd59){_0x5db03e(_0x19245c[_0x26ec('0x12')](0x1f5,[_0x8f92bf[_0x26ec('0x64')],_0x12fd59[_0x26ec('0x1b')][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')));});}else{return _0x5db03e(_0x19245c[_0x26ec('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x423015){var _0x367f19=this;return new Promise(function(_0x5781bb,_0x511bc7){if(ami['isConnected']()==![]){return _0x511bc7(_0x367f19[_0x26ec('0x12')](0x1f4,[config[_0x26ec('0x13')]['ip'],config[_0x26ec('0x13')]['username'],_0x26ec('0x15')][_0x26ec('0x16')]('\x20')));}var _0x32a7f1=schema(properties[_0x26ec('0x7a')])[_0x26ec('0x3')](_0x423015);if(_0x32a7f1[_0x26ec('0x5b')]>0x0){return _0x511bc7(_0x367f19[_0x26ec('0x12')](0x1f4,_['map'](_0x32a7f1,_0x26ec('0x1b'))[_0x26ec('0x16')](',\x20')));}var _0x1385e4=_[_0x26ec('0x5c')](_0x13f29c[_0x26ec('0x78')],{'uniqueid':_0x423015[_0x26ec('0x64')]});if(_0x1385e4&&_0x1385e4[_0x26ec('0x61')]){return ami[_0x26ec('0x1a')]({'action':_0x26ec('0x7b'),'channel':_0x1385e4[_0x26ec('0x61')],'exten':_0x423015[_0x26ec('0x7c')],'context':_0x423015[_0x26ec('0x7d')]||_0x1385e4[_0x26ec('0x7d')],'priority':0x1})[_0x26ec('0x72')](function(_0x3ed214){_0x5781bb({'code':0xc8,'message':[_0x423015[_0x26ec('0x64')],_0x3ed214[_0x26ec('0x1b')][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')});})[_0x26ec('0x20')](function(_0x3d197f){_0x511bc7(_0x367f19[_0x26ec('0x12')](0x1f5,[_0x423015[_0x26ec('0x64')],_0x3d197f[_0x26ec('0x1b')][_0x26ec('0x69')]()][_0x26ec('0x16')]('\x20')));});}else{return _0x511bc7(_0x367f19['error'](0x1f5,_0x26ec('0x6e')));}});},'Agents':function(_0x6bb743){return new Promise(function(_0x42ae13,_0x2fd410){var _0xe558f4=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0xf')]);_0x42ae13({'count':_0xe558f4[_0x26ec('0x5b')],'rows':_0xe558f4});});},'Telephones':function(_0x3c1f1c){return new Promise(function(_0x54d0f3,_0x2309b3){var _0x3ce8eb=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x7e')]);_0x54d0f3({'count':_0x3ce8eb[_0x26ec('0x5b')],'rows':_0x3ce8eb});});},'Trunks':function(_0x9eaa77){return new Promise(function(_0x13ca0b,_0x44f706){var _0x55b0fb=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x7f')]);_0x13ca0b({'count':_0x55b0fb['length'],'rows':_0x55b0fb});});},'OutboundChannels':function(_0x2b14c8){return new Promise(function(_0xa3ca2,_0x5d3e6b){var _0x57c1ea=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x80')]);_0xa3ca2({'count':_0x57c1ea[_0x26ec('0x5b')],'rows':_0x57c1ea});});},'Outbound':function(_0x45c2d9){return new Promise(function(_0x1ee360,_0x63d051){_0x1ee360(_0x13f29c[_0x26ec('0x2f')]);});},'Campaigns':function(_0x100554){return new Promise(function(_0xbac8ed,_0x33b422){var _0x5c604c=_[_0x26ec('0x5f')](_0x13f29c['campaigns']);_0xbac8ed({'count':_0x5c604c[_0x26ec('0x5b')],'rows':_0x5c604c});});},'VoiceQueuesPreview':function(_0x4dd8f6){var _0x5945a9=this;return new Promise(function(_0x5637f6,_0x49e271){_0x375e01[_0x26ec('0x81')](_0x4dd8f6['id'])[_0x26ec('0x72')](function(_0xb6c857){_0x5637f6({'code':0xc8,'message':_0xb6c857[_0x26ec('0x1b')]});})[_0x26ec('0x20')](function(_0x4a394e){_0x49e271(_0x5945a9['error'](0x1f4,_0x4a394e['message']));});});},'EventManager':function(_0xab5773){var _0x39a003=this;return new Promise(function(_0x20b9ae,_0x3b832a){if(!_0xab5773['event']){return _0x3b832a(_0x39a003[_0x26ec('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x26ec('0x82')](_0x26ec('0x83')+_0xab5773[_0x26ec('0x84')],_0xab5773[_0x26ec('0x1b')]);_0x20b9ae({'code':0xc8,'message':_0xab5773});});},'FaxAccounts':function(_0x88de21){return new Promise(function(_0x5e5870,_0x408d88){var _0x5aadb0=_[_0x26ec('0x5f')](_0x13f29c[_0x26ec('0x85')]);_0x5e5870({'count':_0x5aadb0[_0x26ec('0x5b')],'rows':_0x5aadb0});});},'SendFax':function(_0x554a01){var _0x3df968=this;return new Promise(function(_0x49a672,_0x3440c3){_0x4ce209['send'](_0x554a01)[_0x26ec('0x72')](function(_0x357f2f){_0x49a672({'code':0xc8,'message':_0x357f2f[_0x26ec('0x1b')]});})[_0x26ec('0x20')](function(_0x481ed7){_0x3440c3(_0x3df968[_0x26ec('0x12')](0x1f4,_0x481ed7['message']));});});},'CheckAfterSend':function(_0x2cefa0){var _0x39b8df=this;return new Promise(function(_0x1f3972,_0x4bf4ac){_0x4ce209['checkAfterSend'](_0x2cefa0)[_0x26ec('0x72')](function(_0x1497b8){_0x1f3972({'code':0xc8,'message':_0x1497b8[_0x26ec('0x1b')]});})[_0x26ec('0x20')](function(_0x4f3bbb){_0x4bf4ac(_0x39b8df['error'](0x1f4,_0x4f3bbb[_0x26ec('0x1b')]));});});}};var _0x4aa432=jayson[_0x26ec('0x86')](_0x4cadb0)['http']();_0x4aa432['on'](_0x26ec('0x12'),function(_0x4da032){return _0x4e8781(_0x4da032);});_0x4aa432[_0x26ec('0x8')](0x232a,_0x26ec('0x87'),function(){console[_0x26ec('0x88')](_0x26ec('0x89'),0x232a);return _0x3b5955('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index feca1d0..66128b7 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 _0xb903=['data1','data2','data5','xmd-contactid','data3','split','phone','destcalleridnum','calleridnum','firstName','fax','ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','push','user:%s','format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info'];(function(_0x2fb014,_0x4fc399){var _0x2e3104=function(_0x2747a5){while(--_0x2747a5){_0x2fb014['push'](_0x2fb014['shift']());}};_0x2e3104(++_0x4fc399);}(_0xb903,0x185));var _0x3b90=function(_0x559083,_0x2cb5c2){_0x559083=_0x559083-0x0;var _0x502e7c=_0xb903[_0x559083];return _0x502e7c;};'use strict';var _=require(_0x3b90('0x0'));var BPromise=require(_0x3b90('0x1'));var Redis=require(_0x3b90('0x2'));var util=require(_0x3b90('0x3'));var config=require('../../../../config/environment');var logger=require(_0x3b90('0x4'))(_0x3b90('0x5'));var cmContactRpc=require(_0x3b90('0x6'));config[_0x3b90('0x7')]=_[_0x3b90('0x8')](config[_0x3b90('0x7')],{'host':_0x3b90('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b90('0x7')]));function emit(_0x5e845a,_0x55792c,_0x153283,_0x2e4c06,_0x42efe8){logger[_0x3b90('0xa')]('[CM][%s][%s]',_0x5e845a,_0x55792c['id'],_0x153283,_0x2e4c06,JSON['stringify'](_0x42efe8));io['to'](_0x153283)['emit'](_0x2e4c06,_0x42efe8);}exports['exec']=function(_0x56261b,_0x55db3f,_0x336913,_0x5af39c){var _0x574955,_0x30c49c;var _0x233509={};var _0x4bb8f4=Number(_0x336913[_0x3b90('0xb')]);var _0x174c0d=_0x336913[_0x3b90('0xc')]?Boolean(Number(_0x336913['data2'])):![];var _0x5447df;var _0x58c4d1=![];if(!_['isNil'](_0x336913['data5'])){if(_0x336913[_0x3b90('0xd')]=='1')_0x58c4d1=!![];}if(!_0x58c4d1){if(_0x5af39c[_0x3b90('0xe')]){_0x233509['id']=_0x5af39c['xmd-contactid'];}}if(!_0x233509['id']){_0x233509['ListId']=_0x4bb8f4;_0x5447df=_0x336913[_0x3b90('0xf')]&&_0x336913[_0x3b90('0xf')]!=='0'?_0x336913[_0x3b90('0xf')][_0x3b90('0x10')](','):[_0x3b90('0x11')];_0x233509['$or']=_['map'](_0x5447df,function(_0xd83280){var _0x5420dc={};_0x5420dc[_0xd83280]=_0x5af39c['routeId']?_0x5af39c[_0x3b90('0x12')]:_0x5af39c[_0x3b90('0x13')];return _0x5420dc;});}var _0x11ad7d=['id',_0x3b90('0x14'),'lastName',_0x3b90('0x11'),'mobile',_0x3b90('0x15'),_0x3b90('0x16'),'createdAt',_0x3b90('0x17'),_0x3b90('0x18')];var _0x3642c0=_[_0x3b90('0x19')](_0x11ad7d,_0x5447df);BPromise[_0x3b90('0x1a')]()[_0x3b90('0x1b')](cmContactRpc[_0x3b90('0x1c')]({'attributes':_0x3642c0,'where':_0x233509}))[_0x3b90('0x1b')](function(_0xa98414){_0x30c49c=_0xa98414;if(!_[_0x3b90('0x1d')](_0x30c49c)){if(_0x30c49c['length']===0x1){_0x574955=_0x30c49c[0x0];logger[_0x3b90('0xa')](_0x3b90('0x1e'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_0x574955['id']);}else{logger[_0x3b90('0xa')](_0x3b90('0x20'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_['map'](_0x30c49c,'id')['join'](','));}return;}else{logger[_0x3b90('0xa')](_0x3b90('0x21'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);var _0x2ffa1a={'ListId':_0x4bb8f4};var _0x583523=_0x336913[_0x3b90('0x22')]&&_0x336913[_0x3b90('0x22')]!=='0'?_0x336913[_0x3b90('0x22')]:'phone';if(_0x174c0d){logger[_0x3b90('0xa')](_0x3b90('0x23'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);_0x2ffa1a[_0x583523]=_[_0x3b90('0x24')](_0x5af39c[_0x3b90('0x25')])?_0x5af39c[_0x3b90('0x13')]:_0x5af39c['destcalleridnum'];if(_[_0x3b90('0x24')](_0x5af39c['routeId'])){_0x2ffa1a[_0x3b90('0x14')]=_0x5af39c[_0x3b90('0x26')]&&_0x5af39c[_0x3b90('0x26')]!==_0x3b90('0x27')?_0x5af39c[_0x3b90('0x26')]:_0x3b90('0x28');}else{_0x2ffa1a[_0x3b90('0x14')]=_0x5af39c[_0x3b90('0x29')]&&_0x5af39c['destcalleridname']!==''?_0x5af39c[_0x3b90('0x29')]:_0x3b90('0x28');}return BPromise[_0x3b90('0x1a')]()[_0x3b90('0x1b')](cmContactRpc['createContact'](_0x2ffa1a))['then'](function(_0xd33ac9){_0x574955=_0xd33ac9;_0x30c49c[_0x3b90('0x2a')](_0xd33ac9);if(_0x574955){logger[_0x3b90('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_0x574955['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);_0x2ffa1a[_0x583523]=_[_0x3b90('0x24')](_0x5af39c['routeId'])?_0x5af39c[_0x3b90('0x13')]:_0x5af39c[_0x3b90('0x12')];if(_[_0x3b90('0x24')](_0x5af39c['routeId'])){_0x2ffa1a['firstName']=_0x5af39c[_0x3b90('0x26')]&&_0x5af39c[_0x3b90('0x26')]!==_0x3b90('0x27')?_0x5af39c[_0x3b90('0x26')]:'Unknown';}else{_0x2ffa1a['firstName']=_0x5af39c[_0x3b90('0x29')]&&_0x5af39c[_0x3b90('0x29')]!==''?_0x5af39c['destcalleridname']:_0x3b90('0x28');}_0x574955=_0x2ffa1a;_0x30c49c[_0x3b90('0x2a')](_0x2ffa1a);return;}}})[_0x3b90('0x1b')](function(){if(_0x56261b){emit(_0x5af39c[_0x3b90('0x1f')],_0x55db3f,util['format'](_0x3b90('0x2b'),_0x56261b['name']),util[_0x3b90('0x2c')](_0x3b90('0x2d'),_0x336913[_0x3b90('0x2e')][_0x3b90('0x2f')]()),{'evt':_[_0x3b90('0x30')](_0x5af39c,{'autoCreate':_0x174c0d}),'contact':_0x574955===undefined?{}:_0x574955,'contacts':_0x30c49c[_0x3b90('0x31')]===0x0?undefined:_0x30c49c});}});}; \ No newline at end of file +var _0xb4e6=['format','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','union','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','Unknown','','destcalleridname','createContact'];(function(_0x10952a,_0x2e3adf){var _0x249a4e=function(_0x28e9a0){while(--_0x28e9a0){_0x10952a['push'](_0x10952a['shift']());}};_0x249a4e(++_0x2e3adf);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xb4e6[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x6b4e('0x0'));var BPromise=require('bluebird');var Redis=require(_0x6b4e('0x1'));var util=require(_0x6b4e('0x2'));var config=require(_0x6b4e('0x3'));var logger=require(_0x6b4e('0x4'))(_0x6b4e('0x5'));var cmContactRpc=require(_0x6b4e('0x6'));config[_0x6b4e('0x7')]=_['defaults'](config[_0x6b4e('0x7')],{'host':_0x6b4e('0x8'),'port':0x18eb});var io=require(_0x6b4e('0x9'))(new Redis(config['redis']));function emit(_0xd3138f,_0x570346,_0x4f00be,_0x2311d9,_0x48c870){logger['info'](_0x6b4e('0xa'),_0xd3138f,_0x570346['id'],_0x4f00be,_0x2311d9,JSON[_0x6b4e('0xb')](_0x48c870));io['to'](_0x4f00be)[_0x6b4e('0xc')](_0x2311d9,_0x48c870);}exports[_0x6b4e('0xd')]=function(_0x14cf84,_0x46cbe1,_0x323487,_0x49c734){var _0x39b4ec,_0x3bba86;var _0x58c67d={};var _0x2a4d0f=Number(_0x323487[_0x6b4e('0xe')]);var _0x432399=_0x323487[_0x6b4e('0xf')]?Boolean(Number(_0x323487[_0x6b4e('0xf')])):![];var _0xa3d358;var _0x1db513=![];if(!_['isNil'](_0x323487[_0x6b4e('0x10')])){if(_0x323487[_0x6b4e('0x10')]=='1')_0x1db513=!![];}if(!_0x1db513){if(_0x49c734['xmd-contactid']){_0x58c67d['id']=_0x49c734[_0x6b4e('0x11')];}}if(!_0x58c67d['id']){_0x58c67d['ListId']=_0x2a4d0f;_0xa3d358=_0x323487[_0x6b4e('0x12')]&&_0x323487[_0x6b4e('0x12')]!=='0'?_0x323487[_0x6b4e('0x12')][_0x6b4e('0x13')](','):[_0x6b4e('0x14')];_0x58c67d[_0x6b4e('0x15')]=_['map'](_0xa3d358,function(_0x5775f4){var _0x67496d={};_0x67496d[_0x5775f4]=_0x49c734[_0x6b4e('0x16')]?_0x49c734[_0x6b4e('0x17')]:_0x49c734[_0x6b4e('0x18')];return _0x67496d;});}var _0x101d0a=['id',_0x6b4e('0x19'),_0x6b4e('0x1a'),_0x6b4e('0x14'),_0x6b4e('0x1b'),_0x6b4e('0x1c'),_0x6b4e('0x1d'),'createdAt',_0x6b4e('0x1e'),_0x6b4e('0x1f')];var _0x31fb9d=_[_0x6b4e('0x20')](_0x101d0a,_0xa3d358);BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc['getContacts']({'attributes':_0x31fb9d,'where':_0x58c67d}))[_0x6b4e('0x21')](function(_0x163dea){_0x3bba86=_0x163dea;if(!_[_0x6b4e('0x22')](_0x3bba86)){if(_0x3bba86[_0x6b4e('0x23')]===0x1){_0x39b4ec=_0x3bba86[0x0];logger[_0x6b4e('0x24')](_0x6b4e('0x25'),_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}else{logger['info'](_0x6b4e('0x27'),_0x49c734['uniqueid'],_0x46cbe1['id'],_[_0x6b4e('0x28')](_0x3bba86,'id')[_0x6b4e('0x29')](','));}return;}else{logger[_0x6b4e('0x24')](_0x6b4e('0x2a'),_0x49c734['uniqueid'],_0x46cbe1['id']);var _0xec7d35={'ListId':_0x2a4d0f};var _0x3f72d7=_0x323487['data4']&&_0x323487[_0x6b4e('0x2b')]!=='0'?_0x323487[_0x6b4e('0x2b')]:_0x6b4e('0x14');if(_0x432399){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734['routeId'])?_0x49c734[_0x6b4e('0x18')]:_0x49c734[_0x6b4e('0x17')];if(_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])){_0xec7d35['firstName']=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==''?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734['destcalleridname']&&_0x49c734['destcalleridname']!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}return BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc[_0x6b4e('0x31')](_0xec7d35))[_0x6b4e('0x21')](function(_0x5c1444){_0x39b4ec=_0x5c1444;_0x3bba86['push'](_0x5c1444);if(_0x39b4ec){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}return;});}else{logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])?_0x49c734[_0x6b4e('0x18')]:_0x49c734['destcalleridnum'];if(_['isNil'](_0x49c734[_0x6b4e('0x16')])){_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x30')]&&_0x49c734[_0x6b4e('0x30')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}_0x39b4ec=_0xec7d35;_0x3bba86['push'](_0xec7d35);return;}}})[_0x6b4e('0x21')](function(){if(_0x14cf84){emit(_0x49c734[_0x6b4e('0x26')],_0x46cbe1,util[_0x6b4e('0x32')]('user:%s',_0x14cf84[_0x6b4e('0x33')]),util['format'](_0x6b4e('0x34'),_0x323487[_0x6b4e('0x35')][_0x6b4e('0x36')]()),{'evt':_['merge'](_0x49c734,{'autoCreate':_0x432399}),'contact':_0x39b4ec===undefined?{}:_0x39b4ec,'contacts':_0x3bba86['length']===0x0?undefined:_0x3bba86});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3f2faef..16d4a57 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 _0x761c=['accounts','queue','routeId','urlforward','script','parse','render','query','search','replace','channel','AllConditions','every','some','AnyConditions','checkConditions','operator','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','value','membername','lastevent','mailSubstatus','substatus','created','equals','exports','util','url','mustache','./urlforward','./integration','./cmContact','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','stringify','clone','undefined','motionChannel','voice','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','interface','action','toLowerCase','motionbar','browser','data2','html','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data6','600','winApplication','format','user:%s','name','merge','jscripty','trigger:%s','integration','exec'];(function(_0x14f115,_0x5681a0){var _0x540040=function(_0x2dcf43){while(--_0x2dcf43){_0x14f115['push'](_0x14f115['shift']());}};_0x540040(++_0x5681a0);}(_0x761c,0x18a));var _0xc761=function(_0x4ee3a8,_0x44d42f){_0x4ee3a8=_0x4ee3a8-0x0;var _0x2c21dc=_0x761c[_0x4ee3a8];return _0x2c21dc;};'use strict';var util=require(_0xc761('0x0'));var _=require('lodash');var url=require(_0xc761('0x1'));var Mustache=require(_0xc761('0x2'));var Redis=require('ioredis');var urlforward=require(_0xc761('0x3'));var integration=require(_0xc761('0x4'));var cmContact=require(_0xc761('0x5'));var script=require('./script');var config=require(_0xc761('0x6'));var logger=require('../../../config/logger')(_0xc761('0x7'));var ami=require(_0xc761('0x8'));config[_0xc761('0x9')]=_[_0xc761('0xa')](config[_0xc761('0x9')],{'host':_0xc761('0xb'),'port':0x18eb});var io=require(_0xc761('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x3bdf6f,_0x2cf2e9){return _0x3bdf6f==_0x2cf2e9;},'not_equals':function(_0x175c1c,_0x2440e3){return _0x175c1c!=_0x2440e3;}};var barAndWebActions=[_0xc761('0xd'),_0xc761('0x1'),_0xc761('0xe')];function Trigger(_0x49add8){this['triggers']=_0x49add8[_0xc761('0xf')];this[_0xc761('0x10')]=_0x49add8['agents'];this['voiceQueues']=_0x49add8[_0xc761('0x11')];this['templates']=_0x49add8[_0xc761('0x12')];this['voiceExtensions']=_0x49add8[_0xc761('0x13')];this['zendeskAccounts']=_0x49add8[_0xc761('0x14')];this[_0xc761('0x15')]=_0x49add8[_0xc761('0x15')];this[_0xc761('0x16')]=_0x49add8[_0xc761('0x16')];this[_0xc761('0x17')]=_0x49add8[_0xc761('0x17')];this['zohoAccounts']=_0x49add8['zohoAccounts'];this[_0xc761('0x18')]=_0x49add8[_0xc761('0x18')];this[_0xc761('0x19')]=_0x49add8['vtigerAccounts'];this[_0xc761('0x1a')]=_0x49add8[_0xc761('0x1a')];this[_0xc761('0x1b')]=_0x49add8[_0xc761('0x1b')];this[_0xc761('0x1c')]=_0x49add8['freshsalesAccounts'];this['accounts']={'zendesk':this[_0xc761('0x14')],'salesforce':this[_0xc761('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xc761('0x1d')],'desk':this[_0xc761('0x18')],'vtiger':this[_0xc761('0x19')],'dynamics365':this[_0xc761('0x1b')],'freshsales':this[_0xc761('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xc761('0x1e'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x21'),this[_0xc761('0x1f')]['bind'](this));ami['on'](_0xc761('0x22'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc761('0x24'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x25'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x26'),this[_0xc761('0x1f')]['bind'](this));ami['on'](_0xc761('0x27'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xc761('0x20')](this));ami['on'](_0xc761('0x28'),this['syncCustomEvent'][_0xc761('0x20')](this));ami['on']('custom:queuecallerabandon',this[_0xc761('0x1f')]['bind'](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xc761('0x20')](this));ami['on'](_0xc761('0x29'),this[_0xc761('0x2a')][_0xc761('0x20')](this));ami['on']('custom:dialconnect',this[_0xc761('0x2a')][_0xc761('0x20')](this));ami['on'](_0xc761('0x2b'),this[_0xc761('0x2a')][_0xc761('0x20')](this));ami['on']('custom:newinteraction',this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x2c'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x2d'),this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x2e'),this[_0xc761('0x1f')]['bind'](this));ami['on'](_0xc761('0x2f'),this[_0xc761('0x1f')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xc761('0x1f')][_0xc761('0x20')](this));ami['on'](_0xc761('0x30'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0xc761('0x1f')][_0xc761('0x20')](this));}Trigger[_0xc761('0x31')][_0xc761('0x32')]=function(_0x49a84c,_0x1489a7,_0x58d2b6){logger['info'](_0x49a84c,_0x1489a7,JSON[_0xc761('0x33')](_0x58d2b6));io['to'](_0x49a84c)[_0xc761('0x32')](_0x1489a7,_0x58d2b6);};Trigger[_0xc761('0x31')]['syncCustomEvent']=function(_0x1362dd){var _0x23156b=_[_0xc761('0x34')](_0x1362dd);if(typeof _0x23156b['motionChannel']===_0xc761('0x35')){_0x23156b[_0xc761('0x36')]=_0xc761('0x37');}this['checkTriggers'](_0x23156b);};Trigger[_0xc761('0x31')][_0xc761('0x2a')]=function(_0x49924c){if(this[_0xc761('0x10')][_0x49924c['interface']]){this['syncCustomEvent'](_0x49924c);}};Trigger[_0xc761('0x31')][_0xc761('0x38')]=function(_0x2d5c20){var _0x1e15fb;for(var _0x589155 in this['triggers']){if(this[_0xc761('0xf')][_0xc761('0x39')](_0x589155)){if(this[_0xc761('0xf')][_0x589155][_0xc761('0x3a')]){_0x1e15fb=this[_0xc761('0x3b')](this[_0xc761('0xf')][_0x589155],_0x2d5c20);if(_0x1e15fb){_['merge'](_0x2d5c20,_0x2d5c20[_0xc761('0x3c')]);for(var _0x1aaf67=0x0,_0x27f86c,_0x4617fc,_0x47b25d;_0x1aaf670x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x43ec72,_0x5e399c){var _0x5d17da=function(_0x4f2294){while(--_0x4f2294){_0x43ec72['push'](_0x43ec72['shift']());}};_0x5d17da(++_0x5e399c);}(_0x55ca,0x126));var _0xa55c=function(_0x36feba,_0x541932){_0x36feba=_0x36feba-0x0;var _0x358e41=_0x55ca[_0x36feba];return _0x358e41;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index d95396e..b48da73 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 _0xde03=['validateEmail','email','userEmail','length','internalemailaddress','toUpperCase','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','destcalleridnum','calleridnum','POST','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','Bearer\x20','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','queue','callDirection','phonecalls','assign','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','data2','resolve','data5','clientId','username','password','clientSecret','catch','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','then','value','isNil'];(function(_0x3bda40,_0x9cfddb){var _0xe129ea=function(_0x55ff76){while(--_0x55ff76){_0x3bda40['push'](_0x3bda40['shift']());}};_0xe129ea(++_0x9cfddb);}(_0xde03,0x1a2));var _0x3de0=function(_0xdf1b2f,_0x4bc183){_0xdf1b2f=_0xdf1b2f-0x0;var _0x42521d=_0xde03[_0xdf1b2f];return _0x42521d;};'use strict';var _=require(_0x3de0('0x0'));var rp=require(_0x3de0('0x1'));var util=require('util');var intUtil=require(_0x3de0('0x2'));var md5=require(_0x3de0('0x3'));var Redis=require(_0x3de0('0x4'));var logger=require(_0x3de0('0x5'))(_0x3de0('0x6'));var config=require(_0x3de0('0x7'));config[_0x3de0('0x8')]=_[_0x3de0('0x9')](config[_0x3de0('0x8')],{'host':_0x3de0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3de0('0x8')]));function getAuthToken(_0x48089b,_0x3a7e4d,_0x2be5a1){if(_0x48089b[_0x3de0('0xb')]){_0x48089b[_0x3de0('0xc')]=_0x48089b[_0x3de0('0xd')]['data7'];_0x48089b['tenantId']=_0x48089b['CloudProvider'][_0x3de0('0xe')];return Promise[_0x3de0('0xf')](_0x48089b[_0x3de0('0xd')][_0x3de0('0x10')]);}var _0x193377={'method':'POST','uri':_0x3a7e4d,'form':{'client_id':_0x48089b[_0x3de0('0x11')],'resource':_0x48089b[_0x3de0('0xc')],'username':_0x48089b[_0x3de0('0x12')],'password':_0x48089b[_0x3de0('0x13')],'grant_type':'password','client_secret':_0x48089b[_0x3de0('0x14')]},'json':!![]};return rp(_0x193377)['then'](function(_0x12e2b7){return _0x12e2b7['access_token'];})[_0x3de0('0x15')](function(_0xfd9f13){logger[_0x3de0('0x16')]('['+[_0x2be5a1['toUpperCase']()]+_0x3de0('0x17'));return _0xfd9f13['message'];});}function getUser(_0x3f0cc1,_0x21ded5,_0x3ed388,_0x38d86e,_0xdda662,_0x57e06a){return new Promise(function(_0x4baf93,_0x143465){return getAuthToken(_0x21ded5,_0x38d86e,_0x57e06a)['then'](function(_0x184209){var _0x1b0f69={'method':_0x3de0('0x18'),'uri':_0xdda662+_0x3de0('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x184209,'OData-Version':_0x3de0('0x1a')},'json':!![]};return rp(_0x1b0f69);})[_0x3de0('0x1b')](function(_0x1dda5d){var _0xf00908=_0x1dda5d[_0x3de0('0x1c')];var _0x60293=![];var _0x128bdf=null;if(!_[_0x3de0('0x1d')](_0x3ed388)){if(intUtil[_0x3de0('0x1e')](_0x3ed388[_0x3de0('0x1f')])){_0x3f0cc1[_0x3de0('0x20')]=_0x3ed388[_0x3de0('0x1f')];for(_0x128bdf=0x0;_0x128bdf<_0xf00908[_0x3de0('0x21')];_0x128bdf++){if(_0xf00908[_0x128bdf][_0x3de0('0x22')]===_0x3ed388['email']&&!_0xf00908[_0x128bdf]['isdisabled']){_0x60293=!![];logger['info']('['+[_0x57e06a[_0x3de0('0x23')]()]+']\x20Agent\x20found\x20'+_0xf00908[_0x128bdf][_0x3de0('0x24')]+'!');_0x3f0cc1[_0x3de0('0x25')]=_0xf00908[_0x128bdf][_0x3de0('0x24')];}}}}if(!_0x60293){logger[_0x3de0('0x26')]('['+[_0x57e06a[_0x3de0('0x23')]()]+_0x3de0('0x27'));_0x3f0cc1['userEmail']=_0x21ded5[_0x3de0('0x12')];for(_0x128bdf=0x0;_0x128bdf<_0xf00908[_0x3de0('0x21')];_0x128bdf++){if(_0xf00908[_0x128bdf]['internalemailaddress']===_0x21ded5[_0x3de0('0x12')]){_0x3f0cc1[_0x3de0('0x25')]=_0xf00908[_0x128bdf]['systemuserid'];}}}_0x4baf93(_0x3f0cc1);})[_0x3de0('0x15')](function(_0x4b8392){_0x143465(_0x4b8392[_0x3de0('0x28')]);});});}function createEndUser(_0x38c2b5,_0xf7aa6,_0x3dae13,_0x495c67,_0x46f6e1,_0x55319e){return new Promise(function(_0x33b370,_0x429ab2){return getAuthToken(_0xf7aa6,_0x3dae13,_0x55319e)[_0x3de0('0x1b')](function(_0x40d56e){var _0xd8dba=_0x55319e['toLowerCase']()===_0x3de0('0x29')?_0x46f6e1[_0x3de0('0x2a')]:_0x46f6e1[_0x3de0('0x2b')];var _0x571727={'method':_0x3de0('0x2c'),'uri':_0x495c67+_0x3de0('0x2d'),'body':{'telephone1':_0xd8dba,'fullname':_0xd8dba,'firstname':_0xd8dba,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x38c2b5[_0x3de0('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x40d56e,'OData-Version':_0x3de0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x571727);})[_0x3de0('0x1b')](function(_0x56a836){var _0x39f9e9=_0x56a836[_0x3de0('0x2e')][_0x3de0('0x2f')];var _0x31cac2=_0x39f9e9[_0x3de0('0x30')](_0x39f9e9[_0x3de0('0x31')]('(')+0x1,_0x39f9e9['lastIndexOf'](')'));_0x38c2b5[_0x3de0('0x32')]=_0x31cac2;_0x33b370(_0x38c2b5);})[_0x3de0('0x15')](function(_0x297f09){_0x429ab2(_0x297f09[_0x3de0('0x28')]);});});}function getEndUser(_0x41c5c4,_0x3c92e4,_0x505d35,_0x114f17,_0x480726,_0x4e1c12,_0x52e7f4){var _0x4e467d=_0x4e1c12[_0x3de0('0x33')]()===_0x3de0('0x29')?_0x480726[_0x3de0('0x2a')]:_0x480726['calleridnum'];return getAuthToken(_0x3c92e4,_0x505d35,_0x4e1c12)['then'](function(_0x453015){var _0x4e4b07={'method':_0x3de0('0x18'),'uri':_0x114f17+_0x3de0('0x34')+_0x4e467d[_0x3de0('0x35')]('+',_0x3de0('0x36'))+'\x27','headers':{'Authorization':_0x3de0('0x37')+_0x453015,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e4b07);})[_0x3de0('0x1b')](function(_0x5ac0e5){var _0x1f8959=![];if(!_0x5ac0e5)return _0x1f8959;var _0x7c3d9a=_0x5ac0e5[_0x3de0('0x1c')];for(var _0x467305=0x0;_0x467305<_0x7c3d9a['length'];_0x467305++){if(_0x7c3d9a[_0x467305][_0x3de0('0x38')]===_0x4e467d){_0x1f8959=!![];_0x41c5c4[_0x3de0('0x32')]=_0x7c3d9a[_0x467305][_0x3de0('0x39')];}}return _0x1f8959;})[_0x3de0('0x1b')](function(_0x4f0762){if(_0x4f0762)return _0x41c5c4;if(_0x52e7f4===_0x3de0('0x3a')){logger['info']('['+[_0x4e1c12[_0x3de0('0x23')]()]+_0x3de0('0x3b'));return _0x41c5c4;}return createEndUser(_0x41c5c4,_0x3c92e4,_0x505d35,_0x114f17,_0x480726,_0x4e1c12)[_0x3de0('0x1b')](function(_0x46aa0f){logger['info']('['+[_0x4e1c12[_0x3de0('0x23')]()]+_0x3de0('0x3c'),_0x46aa0f['enduserId']);return _0x46aa0f;});});}function getCustomFields(_0x35f984,_0x5a46ca,_0x16faaa){var _0x1c6acd={};if(_0x35f984[_0x3de0('0x21')]>0x0){_[_0x3de0('0x3d')](_0x35f984,function(_0x18031f){if(_[_0x3de0('0x3e')]([_0x3de0('0x3f'),'picklist'],_0x18031f[_0x3de0('0x40')])&&_0x18031f[_0x3de0('0x41')]&&!_0x18031f[_0x3de0('0x42')]){var _0x20f005=_0x18031f[_0x3de0('0x43')]['toLowerCase']();var _0x57f0f6=_0x20f005[_0x3de0('0x30')](0x0,_0x20f005[_0x3de0('0x44')]('_'));var _0x1decdb=_0x20f005[_0x3de0('0x30')](_0x20f005['indexOf']('_')+0x1);if(_0x57f0f6===_0x16faaa){_0x1c6acd[_0x1decdb]=_0x18031f[_0x3de0('0x45')];}}});}return _0x1c6acd;}function getTicket(_0x57a350,_0x2a7588,_0x40e0c2,_0x310f03,_0x2db9d8,_0x1c8a5d,_0x28f7a3){return new Promise(function(_0x28c1f3,_0x1356a1){var _0x17dc29;return getAuthToken(_0x2a7588,_0x40e0c2,_0x28f7a3)[_0x3de0('0x1b')](function(_0x5a734c){if(_0x1c8a5d[_0x3de0('0x46')]===_0x3de0('0x47')){_0x17dc29={'method':_0x3de0('0x2c'),'uri':_0x310f03+'incidents','body':Object['assign']({},{'title':intUtil[_0x3de0('0x48')](_0x1c8a5d[_0x3de0('0x49')],_0x2db9d8,'\x20'),'description':intUtil[_0x3de0('0x48')](_0x1c8a5d[_0x3de0('0x4a')],_0x2db9d8,'\x0a'),'customerid_contact@odata.bind':_0x57a350[_0x3de0('0x32')]?_0x3de0('0x4b')+_0x57a350['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x57a350[_0x3de0('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1c8a5d[_0x3de0('0x4c')],_0x2db9d8,_0x1c8a5d[_0x3de0('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x5a734c,'OData-Version':_0x3de0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1c8a5d[_0x3de0('0x46')]===_0x3de0('0x4d')){var _0x61c277=_0x57a350['enduserId']?[{'partyid_systemuser@odata.bind':_0x3de0('0x4e')+_0x57a350[_0x3de0('0x25')]+')','participationtypemask':_0x57a350['callDirection']===_0x3de0('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x57a350[_0x3de0('0x32')]+')','participationtypemask':_0x57a350[_0x3de0('0x50')]===_0x3de0('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x57a350[_0x3de0('0x25')]+')','participationtypemask':_0x57a350[_0x3de0('0x50')]===_0x3de0('0x4f')?0x2:0x1}];_0x17dc29={'method':_0x3de0('0x2c'),'uri':_0x310f03+_0x3de0('0x51'),'body':Object[_0x3de0('0x52')]({},{'subject':intUtil[_0x3de0('0x48')](_0x1c8a5d[_0x3de0('0x49')],_0x2db9d8,'\x20'),'phonenumber':String(_0x2db9d8[_0x3de0('0x2b')]),'description':intUtil['getString'](_0x1c8a5d['Descriptions'],_0x2db9d8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x57a350[_0x3de0('0x32')]?_0x3de0('0x4b')+_0x57a350[_0x3de0('0x32')]+')':undefined,'ownerid@odata.bind':_0x3de0('0x4e')+_0x57a350[_0x3de0('0x25')]+')','directioncode':_0x57a350['callDirection']===_0x3de0('0x4f')?![]:!![],'phonecall_activity_parties':_0x61c277},getCustomFields(_0x1c8a5d['Fields'],_0x2db9d8,_0x1c8a5d['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5a734c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x17dc29);})[_0x3de0('0x1b')](function(_0x2deb01){var _0x82e143=_0x2deb01[_0x3de0('0x2e')][_0x3de0('0x2f')];var _0x40b8b0=_0x82e143[_0x3de0('0x30')](_0x82e143[_0x3de0('0x31')]('(')+0x1,_0x82e143[_0x3de0('0x31')](')'));_0x57a350[_0x3de0('0x53')]=_0x40b8b0;_0x28c1f3(_0x57a350);})[_0x3de0('0x15')](function(_0x807c2c){_0x1356a1(_0x807c2c[_0x3de0('0x28')]);});});}function emit(_0x287855,_0x447bf6,_0x297a24,_0x4c528a){var _0x4e1206={'uri':util[_0x3de0('0x54')](_0x3de0('0x55'),_0x287855,_0x297a24,_0x4c528a)};io['to'](util['format'](_0x3de0('0x56'),_0x447bf6))[_0x3de0('0x57')]('trigger:browser:url',_0x4e1206);}exports['cs']=function(_0x1d136f,_0x102d53,_0xf6f874,_0x3f1e01,_0x29c8f2,_0x286412,_0x2f985b,_0x51b359){var _0x2c772a={};_0x286412[_0x3de0('0xc')]=_0x286412[_0x3de0('0xb')]?intUtil['stripTrailingSlash'](_0x286412['CloudProvider']['data7']):intUtil[_0x3de0('0x58')](_0x286412[_0x3de0('0xc')]);_0x286412[_0x3de0('0x59')]=intUtil[_0x3de0('0x58')](_0x286412[_0x3de0('0x59')]);_0x2c772a['callDirection']=_0x51b359===_0x3de0('0x4f')||_0x51b359===_0x3de0('0x5a')?_0x3de0('0x4f'):_0x3de0('0x29');var _0x32661c=_0x286412[_0x3de0('0xb')]?util[_0x3de0('0x54')](_0x3de0('0x5b'),_0x286412[_0x3de0('0xd')][_0x3de0('0x5c')]):util[_0x3de0('0x54')]('%s/api/data/v9.0/',_0x286412['remoteUri']);var _0xe1bf9c=util[_0x3de0('0x54')](_0x3de0('0x5d'),_0x286412[_0x3de0('0x5e')]);var _0x24285f=util[_0x3de0('0x54')](_0x3de0('0x5f'),_0x286412[_0x3de0('0x59')],_0x102d53[_0x3de0('0x60')],md5(_0x102d53[_0x3de0('0x60')]));if(_0x29c8f2&&_0x29c8f2[_0x3de0('0x61')]){logger[_0x3de0('0x26')](_0x3de0('0x62'),'Recording\x20is\x20enabled!');_0x102d53['recordingURL']=_0x24285f;}else if(_0x2f985b&&_0x2f985b[_0x3de0('0x63')]&&_0x2f985b[_0x3de0('0x63')]!=='none'){logger[_0x3de0('0x26')](_0x3de0('0x64'),_0x3de0('0x65'));_0x102d53[_0x3de0('0x66')]=_0x24285f;}else{_0x102d53[_0x3de0('0x66')]='';}return getUser(_0x2c772a,_0x286412,_0x3f1e01,_0xe1bf9c,_0x32661c,_0x51b359)[_0x3de0('0x1b')](function(_0x285656){logger[_0x3de0('0x26')]('['+_0x51b359[_0x3de0('0x23')]()+_0x3de0('0x67'),_0x285656[_0x3de0('0x25')]);logger[_0x3de0('0x26')]('['+_0x51b359[_0x3de0('0x23')]()+_0x3de0('0x68'),_0x285656[_0x3de0('0x20')]);return getEndUser(_0x285656,_0x286412,_0xe1bf9c,_0x32661c,_0x102d53,_0x51b359,_0xf6f874[_0x3de0('0x69')]);})[_0x3de0('0x1b')](function(_0x47e8da){logger[_0x3de0('0x26')]('['+_0x51b359[_0x3de0('0x23')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x47e8da[_0x3de0('0x32')]);logger[_0x3de0('0x26')]('['+_0x51b359[_0x3de0('0x23')]()+_0x3de0('0x6a'),_0x102d53['calleridnum']);return getTicket(_0x47e8da,_0x286412,_0xe1bf9c,_0x32661c,_0x102d53,_0xf6f874,_0x51b359);})[_0x3de0('0x1b')](function(_0x5c52bf){logger['info'](util[_0x3de0('0x54')]('['+_0x51b359['toUpperCase']()+_0x3de0('0x6b'),_0xf6f874['ticketType'],_0x5c52bf['ticketId']));logger[_0x3de0('0x26')](util[_0x3de0('0x54')]('['+_0x51b359[_0x3de0('0x23')]()+_0x3de0('0x6c'),_0x51b359));if(_0x51b359!=='unmanaged'){logger[_0x3de0('0x26')]('['+_0x51b359[_0x3de0('0x23')]()+']',_0x3de0('0x6d'));emit(_0x286412['remoteUri'],_0x3f1e01[_0x3de0('0x6e')],_0xf6f874['ticketType'],_0x5c52bf['ticketId']);}})['catch'](function(_0x2fcde8){logger[_0x3de0('0x16')]('['+_0x51b359[_0x3de0('0x23')]()+_0x3de0('0x6f'),_0x2fcde8[_0x3de0('0x28')]);});}; \ No newline at end of file +var _0x5abf=[']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','ioredis','../../../../config/environment','defaults','redis','remoteUri','data7','tenantId','CloudProvider','data2','data5','POST','clientId','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','catch','replace','%2b','value','telephone1','enduserId',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','modernAuthentication','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:'];(function(_0x52f14e,_0x458724){var _0x23b181=function(_0x3bf46a){while(--_0x3bf46a){_0x52f14e['push'](_0x52f14e['shift']());}};_0x23b181(++_0x458724);}(_0x5abf,0xd5));var _0xf5ab=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x5abf[_0x32c04b];return _0x2947b1;};'use strict';var _=require('lodash');var rp=require(_0xf5ab('0x0'));var util=require(_0xf5ab('0x1'));var intUtil=require(_0xf5ab('0x2'));var md5=require('md5');var Redis=require(_0xf5ab('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xf5ab('0x4'));config['redis']=_[_0xf5ab('0x5')](config[_0xf5ab('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf5ab('0x6')]));function getAuthToken(_0x54f42f,_0x4ab34f,_0x3b3a72){if(_0x54f42f['modernAuthentication']){_0x54f42f[_0xf5ab('0x7')]=_0x54f42f['CloudProvider'][_0xf5ab('0x8')];_0x54f42f[_0xf5ab('0x9')]=_0x54f42f[_0xf5ab('0xa')][_0xf5ab('0xb')];return Promise['resolve'](_0x54f42f[_0xf5ab('0xa')][_0xf5ab('0xc')]);}var _0x36fb57={'method':_0xf5ab('0xd'),'uri':_0x4ab34f,'form':{'client_id':_0x54f42f[_0xf5ab('0xe')],'resource':_0x54f42f[_0xf5ab('0x7')],'username':_0x54f42f['username'],'password':_0x54f42f[_0xf5ab('0xf')],'grant_type':'password','client_secret':_0x54f42f[_0xf5ab('0x10')]},'json':!![]};return rp(_0x36fb57)['then'](function(_0x18ee52){return _0x18ee52[_0xf5ab('0x11')];})['catch'](function(_0x4a83a4){logger[_0xf5ab('0x12')]('['+[_0x3b3a72[_0xf5ab('0x13')]()]+_0xf5ab('0x14'));return _0x4a83a4[_0xf5ab('0x15')];});}function getUser(_0x1fef52,_0x2052d3,_0x4fefd5,_0xa972a4,_0x4344f7,_0x18f6e8){return new Promise(function(_0x47e833,_0x187448){return getAuthToken(_0x2052d3,_0xa972a4,_0x18f6e8)[_0xf5ab('0x16')](function(_0x3e6be4){var _0x9318d0={'method':_0xf5ab('0x17'),'uri':_0x4344f7+_0xf5ab('0x18'),'headers':{'Authorization':_0xf5ab('0x19')+_0x3e6be4,'OData-Version':_0xf5ab('0x1a')},'json':!![]};return rp(_0x9318d0);})[_0xf5ab('0x16')](function(_0x2e20b3){var _0x7eddea=_0x2e20b3['value'];var _0x42dbfd=![];var _0x898429=null;if(!_[_0xf5ab('0x1b')](_0x4fefd5)){if(intUtil[_0xf5ab('0x1c')](_0x4fefd5['email'])){_0x1fef52[_0xf5ab('0x1d')]=_0x4fefd5[_0xf5ab('0x1e')];for(_0x898429=0x0;_0x898429<_0x7eddea[_0xf5ab('0x1f')];_0x898429++){if(_0x7eddea[_0x898429][_0xf5ab('0x20')]===_0x4fefd5[_0xf5ab('0x1e')]&&!_0x7eddea[_0x898429][_0xf5ab('0x21')]){_0x42dbfd=!![];logger[_0xf5ab('0x22')]('['+[_0x18f6e8[_0xf5ab('0x13')]()]+_0xf5ab('0x23')+_0x7eddea[_0x898429]['systemuserid']+'!');_0x1fef52[_0xf5ab('0x24')]=_0x7eddea[_0x898429][_0xf5ab('0x25')];}}}}if(!_0x42dbfd){logger[_0xf5ab('0x22')]('['+[_0x18f6e8[_0xf5ab('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1fef52['userEmail']=_0x2052d3['username'];for(_0x898429=0x0;_0x898429<_0x7eddea[_0xf5ab('0x1f')];_0x898429++){if(_0x7eddea[_0x898429]['internalemailaddress']===_0x2052d3[_0xf5ab('0x26')]){_0x1fef52[_0xf5ab('0x24')]=_0x7eddea[_0x898429][_0xf5ab('0x25')];}}}_0x47e833(_0x1fef52);})['catch'](function(_0x5514dc){_0x187448(_0x5514dc[_0xf5ab('0x15')]);});});}function createEndUser(_0x2d7489,_0x5aedba,_0x4ace72,_0x2e2a35,_0x40f4b1,_0xff9f45){return new Promise(function(_0x211ce1,_0x430143){return getAuthToken(_0x5aedba,_0x4ace72,_0xff9f45)[_0xf5ab('0x16')](function(_0x2d0707){var _0x25f807=_0xff9f45[_0xf5ab('0x27')]()===_0xf5ab('0x28')?_0x40f4b1[_0xf5ab('0x29')]:_0x40f4b1[_0xf5ab('0x2a')];var _0x7225a9={'method':_0xf5ab('0xd'),'uri':_0x2e2a35+_0xf5ab('0x2b'),'body':{'telephone1':_0x25f807,'fullname':_0x25f807,'firstname':_0x25f807,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2d7489['userId']+')'},'headers':{'Authorization':_0xf5ab('0x19')+_0x2d0707,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x7225a9);})[_0xf5ab('0x16')](function(_0x1a8d09){var _0x48de60=_0x1a8d09[_0xf5ab('0x2c')][_0xf5ab('0x2d')];var _0x39f6c4=_0x48de60[_0xf5ab('0x2e')](_0x48de60[_0xf5ab('0x2f')]('(')+0x1,_0x48de60['lastIndexOf'](')'));_0x2d7489['enduserId']=_0x39f6c4;_0x211ce1(_0x2d7489);})[_0xf5ab('0x30')](function(_0x1cf00a){_0x430143(_0x1cf00a[_0xf5ab('0x15')]);});});}function getEndUser(_0x7dd80b,_0x1b12ea,_0x5887df,_0x1788ad,_0x193bad,_0xa2a73c,_0x5bd903){var _0x4ab559=_0xa2a73c[_0xf5ab('0x27')]()==='outbound'?_0x193bad[_0xf5ab('0x29')]:_0x193bad['calleridnum'];return getAuthToken(_0x1b12ea,_0x5887df,_0xa2a73c)[_0xf5ab('0x16')](function(_0x2068c8){var _0x1f5e4c={'method':'GET','uri':_0x1788ad+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x4ab559[_0xf5ab('0x31')]('+',_0xf5ab('0x32'))+'\x27','headers':{'Authorization':_0xf5ab('0x19')+_0x2068c8,'If-None-Match':null,'OData-Version':_0xf5ab('0x1a')},'json':!![]};return rp(_0x1f5e4c);})[_0xf5ab('0x16')](function(_0x4fcbf0){var _0x1576e7=![];if(!_0x4fcbf0)return _0x1576e7;var _0x268904=_0x4fcbf0[_0xf5ab('0x33')];for(var _0x1066e5=0x0;_0x1066e5<_0x268904['length'];_0x1066e5++){if(_0x268904[_0x1066e5][_0xf5ab('0x34')]===_0x4ab559){_0x1576e7=!![];_0x7dd80b[_0xf5ab('0x35')]=_0x268904[_0x1066e5]['contactid'];}}return _0x1576e7;})[_0xf5ab('0x16')](function(_0x14bcf5){if(_0x14bcf5)return _0x7dd80b;if(_0x5bd903==='nothing'){logger[_0xf5ab('0x22')]('['+[_0xa2a73c[_0xf5ab('0x13')]()]+_0xf5ab('0x36'));return _0x7dd80b;}return createEndUser(_0x7dd80b,_0x1b12ea,_0x5887df,_0x1788ad,_0x193bad,_0xa2a73c)[_0xf5ab('0x16')](function(_0x21c7f6){logger[_0xf5ab('0x22')]('['+[_0xa2a73c[_0xf5ab('0x13')]()]+_0xf5ab('0x37'),_0x21c7f6[_0xf5ab('0x35')]);return _0x21c7f6;});});}function getCustomFields(_0x451954,_0x3a6685,_0x55c06c){var _0x2da6a8={};if(_0x451954['length']>0x0){_[_0xf5ab('0x38')](_0x451954,function(_0x328850){if(_[_0xf5ab('0x39')]([_0xf5ab('0x3a'),_0xf5ab('0x3b')],_0x328850[_0xf5ab('0x3c')])&&_0x328850[_0xf5ab('0x3d')]&&!_0x328850[_0xf5ab('0x3e')]){var _0x13f4e4=_0x328850[_0xf5ab('0x3f')]['toLowerCase']();var _0x3c745a=_0x13f4e4[_0xf5ab('0x2e')](0x0,_0x13f4e4[_0xf5ab('0x40')]('_'));var _0xd2417c=_0x13f4e4[_0xf5ab('0x2e')](_0x13f4e4[_0xf5ab('0x40')]('_')+0x1);if(_0x3c745a===_0x55c06c){_0x2da6a8[_0xd2417c]=_0x328850['content'];}}});}return _0x2da6a8;}function getTicket(_0x5c446c,_0x5a375d,_0x3df7c5,_0x5233e0,_0x2e1c7d,_0x1bfab1,_0x28d7b6){return new Promise(function(_0x1ff442,_0x2fa42d){var _0x131e4c;return getAuthToken(_0x5a375d,_0x3df7c5,_0x28d7b6)[_0xf5ab('0x16')](function(_0x46709e){if(_0x1bfab1[_0xf5ab('0x41')]===_0xf5ab('0x42')){_0x131e4c={'method':_0xf5ab('0xd'),'uri':_0x5233e0+'incidents','body':Object['assign']({},{'title':intUtil[_0xf5ab('0x43')](_0x1bfab1[_0xf5ab('0x44')],_0x2e1c7d,'\x20'),'description':intUtil[_0xf5ab('0x43')](_0x1bfab1[_0xf5ab('0x45')],_0x2e1c7d,'\x0a'),'customerid_contact@odata.bind':_0x5c446c['enduserId']?_0xf5ab('0x46')+_0x5c446c[_0xf5ab('0x35')]+')':undefined,'ownerid@odata.bind':_0xf5ab('0x47')+_0x5c446c[_0xf5ab('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x1bfab1[_0xf5ab('0x48')],_0x2e1c7d,_0x1bfab1[_0xf5ab('0x41')])),'headers':{'Authorization':_0xf5ab('0x19')+_0x46709e,'OData-Version':_0xf5ab('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1bfab1[_0xf5ab('0x41')]===_0xf5ab('0x49')){var _0x17b19c=_0x5c446c[_0xf5ab('0x35')]?[{'partyid_systemuser@odata.bind':_0xf5ab('0x47')+_0x5c446c[_0xf5ab('0x24')]+')','participationtypemask':_0x5c446c[_0xf5ab('0x4a')]===_0xf5ab('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5c446c[_0xf5ab('0x35')]+')','participationtypemask':_0x5c446c[_0xf5ab('0x4a')]===_0xf5ab('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5c446c['userId']+')','participationtypemask':_0x5c446c[_0xf5ab('0x4a')]===_0xf5ab('0x4b')?0x2:0x1}];_0x131e4c={'method':_0xf5ab('0xd'),'uri':_0x5233e0+_0xf5ab('0x4c'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x1bfab1[_0xf5ab('0x44')],_0x2e1c7d,'\x20'),'phonenumber':String(_0x2e1c7d['calleridnum']),'description':intUtil['getString'](_0x1bfab1['Descriptions'],_0x2e1c7d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5c446c[_0xf5ab('0x35')]?_0xf5ab('0x46')+_0x5c446c[_0xf5ab('0x35')]+')':undefined,'ownerid@odata.bind':_0xf5ab('0x47')+_0x5c446c[_0xf5ab('0x24')]+')','directioncode':_0x5c446c[_0xf5ab('0x4a')]===_0xf5ab('0x4b')?![]:!![],'phonecall_activity_parties':_0x17b19c},getCustomFields(_0x1bfab1[_0xf5ab('0x48')],_0x2e1c7d,_0x1bfab1[_0xf5ab('0x41')])),'headers':{'Authorization':_0xf5ab('0x19')+_0x46709e,'OData-Version':_0xf5ab('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x131e4c);})['then'](function(_0x38ff0a){var _0x208743=_0x38ff0a[_0xf5ab('0x2c')][_0xf5ab('0x2d')];var _0x59a9e6=_0x208743[_0xf5ab('0x2e')](_0x208743[_0xf5ab('0x2f')]('(')+0x1,_0x208743[_0xf5ab('0x2f')](')'));_0x5c446c['ticketId']=_0x59a9e6;_0x1ff442(_0x5c446c);})[_0xf5ab('0x30')](function(_0x24ec45){_0x2fa42d(_0x24ec45['message']);});});}function emit(_0x1bb18f,_0x481023,_0x31dfa5,_0x2f3a72){var _0xa45b6={'uri':util[_0xf5ab('0x4d')](_0xf5ab('0x4e'),_0x1bb18f,_0x31dfa5,_0x2f3a72)};io['to'](util[_0xf5ab('0x4d')]('user:%s',_0x481023))[_0xf5ab('0x4f')](_0xf5ab('0x50'),_0xa45b6);}exports['cs']=function(_0x21deb3,_0x202ede,_0xd4c404,_0x5e6eb1,_0x408280,_0x2744bd,_0x1909c3,_0x2084d8){var _0x1961c6={};_0x2744bd['remoteUri']=_0x2744bd['modernAuthentication']?intUtil[_0xf5ab('0x51')](_0x2744bd[_0xf5ab('0xa')][_0xf5ab('0x8')]):intUtil['stripTrailingSlash'](_0x2744bd[_0xf5ab('0x7')]);_0x2744bd[_0xf5ab('0x52')]=intUtil[_0xf5ab('0x51')](_0x2744bd[_0xf5ab('0x52')]);_0x1961c6['callDirection']=_0x2084d8==='queue'||_0x2084d8==='unmanaged'?_0xf5ab('0x4b'):'outbound';var _0x3313c3=_0x2744bd[_0xf5ab('0x53')]?util['format'](_0xf5ab('0x54'),_0x2744bd[_0xf5ab('0xa')][_0xf5ab('0x8')]):util[_0xf5ab('0x4d')](_0xf5ab('0x54'),_0x2744bd[_0xf5ab('0x7')]);var _0x83d2bf=util[_0xf5ab('0x4d')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2744bd[_0xf5ab('0x9')]);var _0x1bce17=util[_0xf5ab('0x4d')](_0xf5ab('0x55'),_0x2744bd[_0xf5ab('0x52')],_0x202ede[_0xf5ab('0x56')],md5(_0x202ede[_0xf5ab('0x56')]));if(_0x408280&&_0x408280[_0xf5ab('0x57')]){logger[_0xf5ab('0x22')]('[QUEUE]',_0xf5ab('0x58'));_0x202ede[_0xf5ab('0x59')]=_0x1bce17;}else if(_0x1909c3&&_0x1909c3[_0xf5ab('0x5a')]&&_0x1909c3['recordingFormat']!==_0xf5ab('0x5b')){logger[_0xf5ab('0x22')]('[OUTBOUND]',_0xf5ab('0x58'));_0x202ede[_0xf5ab('0x59')]=_0x1bce17;}else{_0x202ede[_0xf5ab('0x59')]='';}return getUser(_0x1961c6,_0x2744bd,_0x5e6eb1,_0x83d2bf,_0x3313c3,_0x2084d8)[_0xf5ab('0x16')](function(_0x58556b){logger[_0xf5ab('0x22')]('['+_0x2084d8[_0xf5ab('0x13')]()+_0xf5ab('0x5c'),_0x58556b['userId']);logger[_0xf5ab('0x22')]('['+_0x2084d8[_0xf5ab('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x58556b[_0xf5ab('0x1d')]);return getEndUser(_0x58556b,_0x2744bd,_0x83d2bf,_0x3313c3,_0x202ede,_0x2084d8,_0xd4c404[_0xf5ab('0x5d')]);})['then'](function(_0x234905){logger['info']('['+_0x2084d8['toUpperCase']()+_0xf5ab('0x5e'),_0x234905[_0xf5ab('0x35')]);logger[_0xf5ab('0x22')]('['+_0x2084d8['toUpperCase']()+_0xf5ab('0x5f'),_0x202ede['calleridnum']);return getTicket(_0x234905,_0x2744bd,_0x83d2bf,_0x3313c3,_0x202ede,_0xd4c404,_0x2084d8);})['then'](function(_0x376d43){logger['info'](util[_0xf5ab('0x4d')]('['+_0x2084d8[_0xf5ab('0x13')]()+_0xf5ab('0x60'),_0xd4c404['ticketType'],_0x376d43[_0xf5ab('0x61')]));logger[_0xf5ab('0x22')](util[_0xf5ab('0x4d')]('['+_0x2084d8['toUpperCase']()+_0xf5ab('0x62'),_0x2084d8));if(_0x2084d8!==_0xf5ab('0x63')){logger['info']('['+_0x2084d8['toUpperCase']()+']',_0xf5ab('0x64'));emit(_0x2744bd['remoteUri'],_0x5e6eb1[_0xf5ab('0x65')],_0xd4c404[_0xf5ab('0x41')],_0x376d43[_0xf5ab('0x61')]);}})[_0xf5ab('0x30')](function(_0x28fb8a){logger[_0xf5ab('0x12')]('['+_0x2084d8[_0xf5ab('0x13')]()+_0xf5ab('0x66'),_0x28fb8a['message']);});}; \ 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 3813bf1..96aa0c6 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 _0x29ac=['uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x29ac,0x1eb));var _0xc29a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x29ac[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xc29a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xc29a('0x1'));var Redis=require(_0xc29a('0x2'));var intUtil=require(_0xc29a('0x3'));var config=require(_0xc29a('0x4'));var logger=require(_0xc29a('0x5'))(_0xc29a('0x6'));config[_0xc29a('0x7')]=_['defaults'](config['redis'],{'host':_0xc29a('0x8'),'port':0x18eb});var io=require(_0xc29a('0x9'))(new Redis(config[_0xc29a('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xc29a('0xa')};function emit(_0x5c6101,_0x312da9,_0xc29e74){io['to'](_0x5c6101)[_0xc29a('0xb')](_0x312da9,_0xc29e74);}function getTicket(_0x27f1fa,_0x116de9,_0x53b995,_0x140925,_0x395702){logger[_0xc29a('0xc')]('Creating\x20new\x20ticket...');var _0x531ba9=_[_0xc29a('0xd')]({'responder_id':_0x116de9['id'],'requester_id':_0x53b995['id'],'name':util[_0xc29a('0xe')](_0xc29a('0xf'),_0x395702[_0xc29a('0x10')]),'phone':_0x395702[_0xc29a('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc29a('0x12')](_0x140925[_0xc29a('0x13')],_0x395702,'\x20'),'description':intUtil[_0xc29a('0x12')](_0x140925[_0xc29a('0x14')],_0x395702,_0xc29a('0x15')),'tags':getTags(_0x140925[_0xc29a('0x16')],_0xc29a('0x17'))},getCustomFields(_0x140925[_0xc29a('0x18')],_0x395702));_0x531ba9[_0xc29a('0x19')]=_['mapValues'](_[_0xc29a('0x1a')](_0x531ba9[_0xc29a('0x19')],'id'),_0xc29a('0x1b'));return request({'uri':util[_0xc29a('0xe')](_0xc29a('0x1c'),_0x27f1fa[_0xc29a('0x1d')]),'method':_0xc29a('0x1e'),'body':_0x531ba9})[_0xc29a('0x1f')](function(_0xc466){logger[_0xc29a('0xc')](_0xc29a('0x20'));return _0xc466;});}function getUser(_0x3c448f,_0x8c2cf3){if(intUtil['validateEmail'](_0x8c2cf3)){return request({'uri':util['format']('%s/api/v2/agents',_0x3c448f[_0xc29a('0x1d')]),'qs':{'email':_0x8c2cf3}})[_0xc29a('0x1f')](function(_0x334b5b){if(_0x334b5b[_0xc29a('0x21')]){logger[_0xc29a('0xc')](_0xc29a('0x22'));return _[_0xc29a('0x23')](_0x334b5b,function(_0x17f8e6){return _0x17f8e6[_0xc29a('0x24')]['email']===_0x8c2cf3;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc29a('0xe')](_0xc29a('0x25'),_0x3c448f[_0xc29a('0x1d')])})[_0xc29a('0x1f')](function(_0x32c53a){logger[_0xc29a('0xc')]('Admin\x20account\x20selected.');return _0x32c53a;});}});}else{logger[_0xc29a('0xc')](_0xc29a('0x26'));return request({'uri':util['format'](_0xc29a('0x25'),_0x3c448f[_0xc29a('0x1d')])})['then'](function(_0x2846c7){logger['info']('Admin\x20account\x20selected.');return _0x2846c7;});}}function getEndUser(_0x111066,_0x57b401,_0x3a672d){logger['info'](_0xc29a('0x27'),_0x3a672d);return request({'uri':util[_0xc29a('0xe')](_0xc29a('0x28'),_0x111066['remoteUri']),'qs':{'phone':_0x3a672d}})[_0xc29a('0x1f')](function(_0x33f3f9){if(_0x33f3f9[_0xc29a('0x21')]){logger[_0xc29a('0xc')](_0xc29a('0x29'));return _['find'](_0x33f3f9,{'phone':_0x3a672d});}else{logger[_0xc29a('0xc')](_0xc29a('0x2a'));return request({'uri':util[_0xc29a('0xe')](_0xc29a('0x28'),_0x111066[_0xc29a('0x1d')]),'method':_0xc29a('0x1e'),'body':{'name':_0x57b401,'phone':_0x3a672d}})[_0xc29a('0x1f')](function(_0x4a00b6){logger['info'](_0xc29a('0x2b'));return _0x4a00b6;});}});}function getAuth(_0x46d1a6){return util[_0xc29a('0xe')](_0xc29a('0x2c'),new Buffer(_0x46d1a6[_0xc29a('0x2d')]+':X')[_0xc29a('0x2e')](_0xc29a('0x2f')));}function request(_0x5dc3f9){logger[_0xc29a('0x30')]('[HTTP]',JSON[_0xc29a('0x31')](_0x5dc3f9));return rp(_[_0xc29a('0x32')](_0x5dc3f9,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x35742b,_0x105cb5){var _0x18a16c=[];if(_0x35742b&&_0x35742b[_0xc29a('0x21')]>0x0){_0x18a16c=_[_0xc29a('0x33')](_0x35742b,_0x105cb5);}return _0x18a16c;}function getCustomFields(_0x49b3c7,_0x20c7aa){var _0x23317e=[];var _0x43c5ba={'custom_fields':[]};if(_0x49b3c7[_0xc29a('0x21')]>0x0){_[_0xc29a('0x34')](_0x49b3c7,function(_0x165e3e){if(_[_0xc29a('0x35')]([_0xc29a('0x36'),_0xc29a('0x37')],_0x165e3e[_0xc29a('0x38')])&&_0x165e3e[_0xc29a('0x39')]&&!_0x165e3e[_0xc29a('0x3a')]){_0x43c5ba[_0x165e3e[_0xc29a('0x39')][_0xc29a('0x3b')]()]=_0x165e3e[_0xc29a('0x3c')][_0xc29a('0x2e')]();}else if(_[_0xc29a('0x35')]([_0xc29a('0x36'),_0xc29a('0x37')],_0x165e3e[_0xc29a('0x38')])&&_0x165e3e[_0xc29a('0x3d')]&&_0x165e3e[_0xc29a('0x3a')]){_0x43c5ba[_0xc29a('0x19')]['push']({'id':_0x165e3e[_0xc29a('0x3d')],'value':_0x165e3e[_0xc29a('0x3c')][_0xc29a('0x2e')]()});}else if(_0x165e3e[_0xc29a('0x38')]==='variable'&&_0x165e3e[_0xc29a('0x3e')]&&_0x165e3e[_0xc29a('0x3d')]&&_0x165e3e[_0xc29a('0x3a')]){_0x20c7aa[_0x165e3e[_0xc29a('0x3e')]]&&_0x43c5ba[_0xc29a('0x19')][_0xc29a('0x3f')]({'id':_0x165e3e['idField'],'value':_0x20c7aa[_0x165e3e[_0xc29a('0x3e')]][_0xc29a('0x2e')]()});}else if(_0x165e3e['type']===_0xc29a('0x40')&&_0x165e3e[_0xc29a('0x41')]&&_0x165e3e[_0xc29a('0x41')][_0xc29a('0x17')]&&_0x165e3e[_0xc29a('0x3d')]&&_0x165e3e[_0xc29a('0x3a')]){_0x20c7aa[_0x165e3e[_0xc29a('0x41')][_0xc29a('0x17')][_0xc29a('0x3b')]()]&&_0x43c5ba[_0xc29a('0x19')]['push']({'id':_0x165e3e[_0xc29a('0x3d')],'value':_0x20c7aa[_0x165e3e['Variable'][_0xc29a('0x17')]['toLowerCase']()][_0xc29a('0x2e')]()});}});}return _0x43c5ba;}exports[_0xc29a('0x42')]=function(_0x2083df,_0x5c330b,_0x5eaf30,_0x18bb6f,_0x150169,_0x40b8e8){var _0x2990d3,_0x18b559;_0x40b8e8[_0xc29a('0x1d')]=intUtil[_0xc29a('0x43')](_0x40b8e8[_0xc29a('0x1d')]);_0x40b8e8[_0xc29a('0x44')]=intUtil['stripTrailingSlash'](_0x40b8e8[_0xc29a('0x44')]);if(_0x150169&&_0x150169['monitor_format']){logger[_0xc29a('0xc')](_0xc29a('0x45'),_0xc29a('0x46'));_0x5c330b[_0xc29a('0x47')]=util['format'](_0xc29a('0x48'),_0x40b8e8['serverUrl'],_0x5c330b['uniqueid'],md5(_0x5c330b[_0xc29a('0x49')]));}else{_0x5c330b[_0xc29a('0x47')]='';}headers['Authorization']=getAuth(_0x40b8e8);return getUser(_0x40b8e8,_0x18bb6f[_0xc29a('0x4a')])['then'](function(_0x573e0f){_0x2990d3=_0x573e0f;logger[_0xc29a('0xc')](_0xc29a('0x4b'),_0x2990d3['id']);return getEndUser(_0x40b8e8,_0x5c330b['calleridname'],_0x5c330b[_0xc29a('0x11')]);})[_0xc29a('0x1f')](function(_0x28e775){_0x18b559=_0x28e775;logger[_0xc29a('0xc')](_0xc29a('0x4c'),_0x18b559['id']);return getTicket(_0x40b8e8,_0x2990d3,_0x18b559,_0x5eaf30,_0x5c330b);})['then'](function(_0x3e514f){if(_0x3e514f&&_0x3e514f['id']){logger[_0xc29a('0xc')](_0xc29a('0x20'));logger[_0xc29a('0xc')](_0xc29a('0x4d'),_0x3e514f['id']);logger[_0xc29a('0xc')](_0xc29a('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc29a('0xe')](_0xc29a('0x4e'),_0x18bb6f['name']),'trigger:browser:url',{'uri':util[_0xc29a('0xe')](_0xc29a('0x4f'),_0x40b8e8[_0xc29a('0x1d')],_0x3e514f['id'])});}})[_0xc29a('0x50')](function(_0x1ccfaf){logger[_0xc29a('0x51')](_0xc29a('0x45'),JSON[_0xc29a('0x31')](_0x1ccfaf));});};exports[_0xc29a('0x52')]=function(_0x387aab,_0x4d6e9e,_0x1b50fb,_0x2941d8,_0x418fa9,_0xd6462f,_0xfc185e){var _0x5980e4,_0x477aaf;_0xd6462f[_0xc29a('0x1d')]=intUtil[_0xc29a('0x43')](_0xd6462f[_0xc29a('0x1d')]);_0xd6462f[_0xc29a('0x44')]=intUtil[_0xc29a('0x43')](_0xd6462f[_0xc29a('0x44')]);if(_0xfc185e&&_0xfc185e[_0xc29a('0x53')]&&_0xfc185e[_0xc29a('0x53')]!==_0xc29a('0x54')){logger['info'](_0xc29a('0x55'),_0xc29a('0x46'));_0x4d6e9e[_0xc29a('0x47')]=util[_0xc29a('0xe')](_0xc29a('0x48'),_0xd6462f['serverUrl'],_0x4d6e9e[_0xc29a('0x49')],md5(_0x4d6e9e[_0xc29a('0x49')]));}headers[_0xc29a('0x56')]=getAuth(_0xd6462f);return getUser(_0xd6462f,_0x2941d8[_0xc29a('0x4a')])[_0xc29a('0x1f')](function(_0x4f5aec){_0x5980e4=_0x4f5aec;logger[_0xc29a('0xc')]('The\x20User\x20ID\x20is:',_0x5980e4['id']);return getEndUser(_0xd6462f,_0x4d6e9e[_0xc29a('0x57')],_0x4d6e9e['destcalleridnum']);})[_0xc29a('0x1f')](function(_0x98b32d){_0x477aaf=_0x98b32d;logger[_0xc29a('0xc')](_0xc29a('0x4c'),_0x477aaf['id']);return getTicket(_0xd6462f,_0x5980e4,_0x477aaf,_0x1b50fb,_0x4d6e9e);})[_0xc29a('0x1f')](function(_0x263045){if(_0x263045&&_0x263045['id']){logger['info']('Ticket\x20created!');logger[_0xc29a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x263045['id']);logger[_0xc29a('0xc')](_0xc29a('0x55'),_0xc29a('0x58'));emit(util[_0xc29a('0xe')](_0xc29a('0x4e'),_0x2941d8['name']),_0xc29a('0x59'),{'uri':util[_0xc29a('0xe')](_0xc29a('0x4f'),_0xd6462f[_0xc29a('0x1d')],_0x263045['id'])});}})[_0xc29a('0x50')](function(_0x470c6a){logger['error'](_0xc29a('0x55'),JSON[_0xc29a('0x31')](_0x470c6a));});};exports[_0xc29a('0x5a')]=function(_0x1be34f,_0x4b7f29,_0x26c0dc,_0x25aaf9,_0x3e5d80,_0x314f6b){var _0x436f11,_0x4bd057;_0x314f6b[_0xc29a('0x1d')]=intUtil[_0xc29a('0x43')](_0x314f6b[_0xc29a('0x1d')]);_0x314f6b[_0xc29a('0x44')]=intUtil[_0xc29a('0x43')](_0x314f6b[_0xc29a('0x44')]);if(_0x3e5d80&&_0x3e5d80[_0xc29a('0x5b')]){logger[_0xc29a('0xc')]('['+_0x4b7f29[_0xc29a('0x5c')]['toUpperCase']()+']',_0xc29a('0x46'));_0x4b7f29[_0xc29a('0x47')]=util[_0xc29a('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x314f6b[_0xc29a('0x44')],_0x4b7f29[_0xc29a('0x49')],md5(_0x4b7f29[_0xc29a('0x49')]));}else{_0x4b7f29['recordingURL']='';}headers['Authorization']=getAuth(_0x314f6b);return getUser(_0x314f6b,'')[_0xc29a('0x1f')](function(_0x2653c1){_0x436f11=_0x2653c1;logger[_0xc29a('0xc')](_0xc29a('0x4b'),_0x436f11['id']);return getEndUser(_0x314f6b,_0x4b7f29['calleridname'],_0x4b7f29[_0xc29a('0x11')]);})[_0xc29a('0x1f')](function(_0x41831e){_0x4bd057=_0x41831e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4bd057['id']);return getTicket(_0x314f6b,_0x436f11,_0x4bd057,_0x26c0dc,_0x4b7f29);})[_0xc29a('0x1f')](function(_0x29313a){if(_0x29313a){logger[_0xc29a('0xc')](_0xc29a('0x20'));logger[_0xc29a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x29313a['id']);}})[_0xc29a('0x50')](function(_0xd2278d){logger['error']('['+_0x4b7f29[_0xc29a('0x5c')][_0xc29a('0x5d')]()+']',JSON['stringify'](_0xd2278d));});}; \ No newline at end of file +var _0x3ade=['Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','length','map','forEach','includes','string','picklist','type','nameField','toLowerCase','toString','idField','customField','custom_fields','content','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','catch','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','calleridnum','getString','Descriptions','
','Tags','name','Fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3ade,0x96));var _0xe3ad=function(_0xc3b5ef,_0x300f79){_0xc3b5ef=_0xc3b5ef-0x0;var _0x3d13bc=_0x3ade[_0xc3b5ef];return _0x3d13bc;};'use strict';var _=require('lodash');var rp=require(_0xe3ad('0x0'));var md5=require(_0xe3ad('0x1'));var util=require(_0xe3ad('0x2'));var Redis=require(_0xe3ad('0x3'));var intUtil=require(_0xe3ad('0x4'));var config=require(_0xe3ad('0x5'));var logger=require('../../../../config/logger')(_0xe3ad('0x6'));config[_0xe3ad('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe3ad('0x8'))(new Redis(config[_0xe3ad('0x7')]));var headers={'Content-Type':_0xe3ad('0x9'),'Accept':_0xe3ad('0x9')};function emit(_0x41546c,_0x1e89e1,_0x34f1fb){io['to'](_0x41546c)['emit'](_0x1e89e1,_0x34f1fb);}function getTicket(_0x19b0ec,_0x54e53f,_0x4e2a60,_0x5b913e,_0x44fc55){logger[_0xe3ad('0xa')](_0xe3ad('0xb'));var _0x281faa=_['merge']({'responder_id':_0x54e53f['id'],'requester_id':_0x4e2a60['id'],'name':util[_0xe3ad('0xc')]('Caller\x20-\x20%s',_0x44fc55['calleridname']),'phone':_0x44fc55[_0xe3ad('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5b913e['Subjects'],_0x44fc55,'\x20'),'description':intUtil[_0xe3ad('0xe')](_0x5b913e[_0xe3ad('0xf')],_0x44fc55,_0xe3ad('0x10')),'tags':getTags(_0x5b913e[_0xe3ad('0x11')],_0xe3ad('0x12'))},getCustomFields(_0x5b913e[_0xe3ad('0x13')],_0x44fc55));_0x281faa['custom_fields']=_[_0xe3ad('0x14')](_['keyBy'](_0x281faa['custom_fields'],'id'),'value');return request({'uri':util['format'](_0xe3ad('0x15'),_0x19b0ec[_0xe3ad('0x16')]),'method':_0xe3ad('0x17'),'body':_0x281faa})[_0xe3ad('0x18')](function(_0x74a6eb){logger[_0xe3ad('0xa')](_0xe3ad('0x19'));return _0x74a6eb;});}function getUser(_0x4a7771,_0x57a8d0){if(intUtil[_0xe3ad('0x1a')](_0x57a8d0)){return request({'uri':util[_0xe3ad('0xc')](_0xe3ad('0x1b'),_0x4a7771[_0xe3ad('0x16')]),'qs':{'email':_0x57a8d0}})[_0xe3ad('0x18')](function(_0x285202){if(_0x285202['length']){logger[_0xe3ad('0xa')](_0xe3ad('0x1c'));return _[_0xe3ad('0x1d')](_0x285202,function(_0x3e7a99){return _0x3e7a99[_0xe3ad('0x1e')]['email']===_0x57a8d0;});}else{logger[_0xe3ad('0xa')](_0xe3ad('0x1f'));return request({'uri':util[_0xe3ad('0xc')](_0xe3ad('0x20'),_0x4a7771[_0xe3ad('0x16')])})['then'](function(_0x257bd8){logger[_0xe3ad('0xa')](_0xe3ad('0x21'));return _0x257bd8;});}});}else{logger[_0xe3ad('0xa')](_0xe3ad('0x22'));return request({'uri':util[_0xe3ad('0xc')](_0xe3ad('0x20'),_0x4a7771[_0xe3ad('0x16')])})[_0xe3ad('0x18')](function(_0x1dc510){logger['info'](_0xe3ad('0x21'));return _0x1dc510;});}}function getEndUser(_0x2c4a66,_0x20d0a2,_0x53b9e5){logger[_0xe3ad('0xa')](_0xe3ad('0x23'),_0x53b9e5);return request({'uri':util['format'](_0xe3ad('0x24'),_0x2c4a66[_0xe3ad('0x16')]),'qs':{'phone':_0x53b9e5}})[_0xe3ad('0x18')](function(_0x379fe9){if(_0x379fe9['length']){logger['info'](_0xe3ad('0x25'));return _[_0xe3ad('0x1d')](_0x379fe9,{'phone':_0x53b9e5});}else{logger[_0xe3ad('0xa')](_0xe3ad('0x26'));return request({'uri':util[_0xe3ad('0xc')](_0xe3ad('0x24'),_0x2c4a66[_0xe3ad('0x16')]),'method':_0xe3ad('0x17'),'body':{'name':_0x20d0a2,'phone':_0x53b9e5}})[_0xe3ad('0x18')](function(_0x576423){logger[_0xe3ad('0xa')](_0xe3ad('0x27'));return _0x576423;});}});}function getAuth(_0x49ab64){return util[_0xe3ad('0xc')](_0xe3ad('0x28'),new Buffer(_0x49ab64[_0xe3ad('0x29')]+':X')['toString'](_0xe3ad('0x2a')));}function request(_0xef1ee9){logger[_0xe3ad('0x2b')](_0xe3ad('0x2c'),JSON[_0xe3ad('0x2d')](_0xef1ee9));return rp(_[_0xe3ad('0x2e')](_0xef1ee9,{'method':_0xe3ad('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x31d074,_0x50f021){var _0x261415=[];if(_0x31d074&&_0x31d074[_0xe3ad('0x30')]>0x0){_0x261415=_[_0xe3ad('0x31')](_0x31d074,_0x50f021);}return _0x261415;}function getCustomFields(_0x55cb6d,_0x2c639d){var _0x324e61=[];var _0x2baf20={'custom_fields':[]};if(_0x55cb6d[_0xe3ad('0x30')]>0x0){_[_0xe3ad('0x32')](_0x55cb6d,function(_0x36d630){if(_[_0xe3ad('0x33')]([_0xe3ad('0x34'),_0xe3ad('0x35')],_0x36d630[_0xe3ad('0x36')])&&_0x36d630['nameField']&&!_0x36d630['customField']){_0x2baf20[_0x36d630[_0xe3ad('0x37')][_0xe3ad('0x38')]()]=_0x36d630['content'][_0xe3ad('0x39')]();}else if(_[_0xe3ad('0x33')]([_0xe3ad('0x34'),_0xe3ad('0x35')],_0x36d630[_0xe3ad('0x36')])&&_0x36d630[_0xe3ad('0x3a')]&&_0x36d630[_0xe3ad('0x3b')]){_0x2baf20[_0xe3ad('0x3c')]['push']({'id':_0x36d630['idField'],'value':_0x36d630[_0xe3ad('0x3d')][_0xe3ad('0x39')]()});}else if(_0x36d630[_0xe3ad('0x36')]===_0xe3ad('0x3e')&&_0x36d630[_0xe3ad('0x3f')]&&_0x36d630[_0xe3ad('0x3a')]&&_0x36d630[_0xe3ad('0x3b')]){_0x2c639d[_0x36d630[_0xe3ad('0x3f')]]&&_0x2baf20['custom_fields'][_0xe3ad('0x40')]({'id':_0x36d630[_0xe3ad('0x3a')],'value':_0x2c639d[_0x36d630[_0xe3ad('0x3f')]]['toString']()});}else if(_0x36d630[_0xe3ad('0x36')]===_0xe3ad('0x41')&&_0x36d630[_0xe3ad('0x42')]&&_0x36d630[_0xe3ad('0x42')][_0xe3ad('0x12')]&&_0x36d630['idField']&&_0x36d630[_0xe3ad('0x3b')]){_0x2c639d[_0x36d630['Variable'][_0xe3ad('0x12')][_0xe3ad('0x38')]()]&&_0x2baf20['custom_fields'][_0xe3ad('0x40')]({'id':_0x36d630[_0xe3ad('0x3a')],'value':_0x2c639d[_0x36d630[_0xe3ad('0x42')][_0xe3ad('0x12')][_0xe3ad('0x38')]()][_0xe3ad('0x39')]()});}});}return _0x2baf20;}exports['queue']=function(_0x59a237,_0x2d7b2d,_0x17c7eb,_0x22cd21,_0x51d153,_0x3f353b){var _0x368255,_0x48a9b9;_0x3f353b['remoteUri']=intUtil[_0xe3ad('0x43')](_0x3f353b[_0xe3ad('0x16')]);_0x3f353b['serverUrl']=intUtil[_0xe3ad('0x43')](_0x3f353b[_0xe3ad('0x44')]);if(_0x51d153&&_0x51d153[_0xe3ad('0x45')]){logger[_0xe3ad('0xa')]('[QUEUE]',_0xe3ad('0x46'));_0x2d7b2d[_0xe3ad('0x47')]=util[_0xe3ad('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f353b[_0xe3ad('0x44')],_0x2d7b2d[_0xe3ad('0x48')],md5(_0x2d7b2d[_0xe3ad('0x48')]));}else{_0x2d7b2d['recordingURL']='';}headers[_0xe3ad('0x49')]=getAuth(_0x3f353b);return getUser(_0x3f353b,_0x22cd21[_0xe3ad('0x4a')])[_0xe3ad('0x18')](function(_0xcc65c7){_0x368255=_0xcc65c7;logger[_0xe3ad('0xa')](_0xe3ad('0x4b'),_0x368255['id']);return getEndUser(_0x3f353b,_0x2d7b2d[_0xe3ad('0x4c')],_0x2d7b2d[_0xe3ad('0xd')]);})['then'](function(_0x4fc78a){_0x48a9b9=_0x4fc78a;logger['info'](_0xe3ad('0x4d'),_0x48a9b9['id']);return getTicket(_0x3f353b,_0x368255,_0x48a9b9,_0x17c7eb,_0x2d7b2d);})[_0xe3ad('0x18')](function(_0x3ab59b){if(_0x3ab59b&&_0x3ab59b['id']){logger[_0xe3ad('0xa')](_0xe3ad('0x19'));logger[_0xe3ad('0xa')](_0xe3ad('0x4e'),_0x3ab59b['id']);logger[_0xe3ad('0xa')](_0xe3ad('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe3ad('0xc')]('user:%s',_0x22cd21[_0xe3ad('0x12')]),_0xe3ad('0x50'),{'uri':util['format'](_0xe3ad('0x51'),_0x3f353b['remoteUri'],_0x3ab59b['id'])});}})['catch'](function(_0x13cb01){logger[_0xe3ad('0x52')](_0xe3ad('0x4f'),JSON[_0xe3ad('0x2d')](_0x13cb01));});};exports[_0xe3ad('0x53')]=function(_0x16a392,_0x130688,_0x17915b,_0x373967,_0xf97732,_0x26c054,_0x35ff1e){var _0xe74a98,_0x2549c6;_0x26c054['remoteUri']=intUtil[_0xe3ad('0x43')](_0x26c054[_0xe3ad('0x16')]);_0x26c054[_0xe3ad('0x44')]=intUtil[_0xe3ad('0x43')](_0x26c054[_0xe3ad('0x44')]);if(_0x35ff1e&&_0x35ff1e[_0xe3ad('0x54')]&&_0x35ff1e['recordingFormat']!==_0xe3ad('0x55')){logger[_0xe3ad('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x130688['recordingURL']=util[_0xe3ad('0xc')](_0xe3ad('0x56'),_0x26c054[_0xe3ad('0x44')],_0x130688['uniqueid'],md5(_0x130688['uniqueid']));}headers['Authorization']=getAuth(_0x26c054);return getUser(_0x26c054,_0x373967[_0xe3ad('0x4a')])[_0xe3ad('0x18')](function(_0x64e469){_0xe74a98=_0x64e469;logger[_0xe3ad('0xa')](_0xe3ad('0x4b'),_0xe74a98['id']);return getEndUser(_0x26c054,_0x130688[_0xe3ad('0x57')],_0x130688[_0xe3ad('0x58')]);})[_0xe3ad('0x18')](function(_0x113770){_0x2549c6=_0x113770;logger[_0xe3ad('0xa')]('The\x20Enduser\x20ID\x20is:',_0x2549c6['id']);return getTicket(_0x26c054,_0xe74a98,_0x2549c6,_0x17915b,_0x130688);})[_0xe3ad('0x18')](function(_0x5caefe){if(_0x5caefe&&_0x5caefe['id']){logger['info'](_0xe3ad('0x19'));logger[_0xe3ad('0xa')](_0xe3ad('0x4e'),_0x5caefe['id']);logger['info'](_0xe3ad('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe3ad('0x5a'),_0x373967['name']),_0xe3ad('0x50'),{'uri':util[_0xe3ad('0xc')](_0xe3ad('0x51'),_0x26c054[_0xe3ad('0x16')],_0x5caefe['id'])});}})[_0xe3ad('0x5b')](function(_0x31fc2b){logger[_0xe3ad('0x52')]('[OUTBOUND]',JSON[_0xe3ad('0x2d')](_0x31fc2b));});};exports[_0xe3ad('0x5c')]=function(_0x54beb9,_0x5eb396,_0xc93387,_0x2c9ca0,_0x3c2d86,_0x4180e2){var _0x2de048,_0x3627e9;_0x4180e2[_0xe3ad('0x16')]=intUtil[_0xe3ad('0x43')](_0x4180e2[_0xe3ad('0x16')]);_0x4180e2[_0xe3ad('0x44')]=intUtil[_0xe3ad('0x43')](_0x4180e2['serverUrl']);if(_0x3c2d86&&_0x3c2d86[_0xe3ad('0x45')]){logger[_0xe3ad('0xa')]('['+_0x5eb396[_0xe3ad('0x5d')][_0xe3ad('0x5e')]()+']','Recording\x20is\x20enabled!');_0x5eb396['recordingURL']=util['format'](_0xe3ad('0x56'),_0x4180e2[_0xe3ad('0x44')],_0x5eb396[_0xe3ad('0x48')],md5(_0x5eb396[_0xe3ad('0x48')]));}else{_0x5eb396[_0xe3ad('0x47')]='';}headers['Authorization']=getAuth(_0x4180e2);return getUser(_0x4180e2,'')[_0xe3ad('0x18')](function(_0x44413f){_0x2de048=_0x44413f;logger['info'](_0xe3ad('0x4b'),_0x2de048['id']);return getEndUser(_0x4180e2,_0x5eb396[_0xe3ad('0x4c')],_0x5eb396[_0xe3ad('0xd')]);})[_0xe3ad('0x18')](function(_0x114a83){_0x3627e9=_0x114a83;logger[_0xe3ad('0xa')](_0xe3ad('0x4d'),_0x3627e9['id']);return getTicket(_0x4180e2,_0x2de048,_0x3627e9,_0xc93387,_0x5eb396);})[_0xe3ad('0x18')](function(_0x197286){if(_0x197286){logger[_0xe3ad('0xa')](_0xe3ad('0x19'));logger[_0xe3ad('0xa')](_0xe3ad('0x4e'),_0x197286['id']);}})[_0xe3ad('0x5b')](function(_0x42c729){logger[_0xe3ad('0x52')]('['+_0x5eb396[_0xe3ad('0x5d')][_0xe3ad('0x5e')]()+']',JSON[_0xe3ad('0x2d')](_0x42c729));});}; \ 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 8aa9871..623c5c7 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 _0xc6f6=['catch','error','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','length','email','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','headers','ticketId','task','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','queue','unmanaged','outbound','agentEmail','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','adminEmail','adminId','Requested\x20Resource\x20not\x20Found'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc6f6,0x8f));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6c6f('0x0'));var rp=require(_0x6c6f('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x6c6f('0x2'));var Promise=require('bluebird');var Redis=require(_0x6c6f('0x3'));var intUtil=require(_0x6c6f('0x4'));var config=require(_0x6c6f('0x5'));var logger=require(_0x6c6f('0x6'))(_0x6c6f('0x7'));config['redis']=_['defaults'](config[_0x6c6f('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6c6f('0x9'))(new Redis(config[_0x6c6f('0x8')]));function getAdminId(_0x3b7bc6,_0x725585,_0x178397,_0x499310){return new Promise(function(_0x250b01,_0xe8b078){var _0x27ac64=![];var _0x22d768={'method':_0x6c6f('0xa'),'uri':_0x499310+_0x6c6f('0xb'),'json':!![]};_0x22d768['headers']=_0x178397;logger[_0x6c6f('0xc')](_0x6c6f('0xd'));return rp(_0x22d768)[_0x6c6f('0xe')](function(_0x3f4df2){if(_0x3f4df2){var _0x276a55=_0x3f4df2[_0x6c6f('0xf')];var _0x5a8515=null;for(_0x5a8515=0x0;_0x5a8515<_0x276a55['length'];_0x5a8515++){if(_0x276a55[_0x5a8515]['email']===_0x3b7bc6[_0x6c6f('0x10')]){_0x3b7bc6[_0x6c6f('0x11')]=_0x276a55[_0x5a8515]['id'];_0x27ac64=!![];}}if(_0x27ac64){logger['info']('Admin\x20found:',_0x3b7bc6[_0x6c6f('0x11')]);_0x250b01(_0x3b7bc6);}else{_0xe8b078({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xe8b078({'statusCode':0x194,'message':_0x6c6f('0x12')});}})[_0x6c6f('0x13')](function(_0x5c6d4e){logger[_0x6c6f('0x14')]('['+[_0x725585['toUpperCase']()]+']',_0x5c6d4e[_0x6c6f('0x15')]);_0xe8b078(_0x5c6d4e);});});}function getUser(_0x5316dc,_0x12d12d,_0x33695c){return function(_0x5d56cd){return new Promise(function(_0x468214,_0xb960f0){var _0x47cc43={'method':_0x6c6f('0xa'),'uri':_0x33695c+'/api/selector/owners','json':!![]};_0x47cc43['headers']=_0x12d12d;logger['info'](_0x6c6f('0x16'));return rp(_0x47cc43)[_0x6c6f('0xe')](function(_0x2ec96b){if(_0x2ec96b){var _0x321062=_0x2ec96b[_0x6c6f('0xf')];var _0x3d8b39=![];var _0x4aa216=null;if(_0x5d56cd['agentEmail']!==null){logger[_0x6c6f('0xc')](_0x6c6f('0x17'),_0x5d56cd['agentEmail']);_0x5d56cd[_0x6c6f('0x18')]=_0x5d56cd['agentEmail'];for(_0x4aa216=0x0;_0x4aa216<_0x321062[_0x6c6f('0x19')];_0x4aa216++){if(_0x321062[_0x4aa216][_0x6c6f('0x1a')]===_0x5d56cd['agentEmail']){_0x3d8b39=!![];_0x5d56cd[_0x6c6f('0x1b')]=_0x321062[_0x4aa216]['id'];logger[_0x6c6f('0xc')](_0x6c6f('0x1c'),_0x5d56cd['userId']);}}}if(!_0x3d8b39){logger['info'](_0x6c6f('0x1d'));_0x5d56cd[_0x6c6f('0x18')]=_0x5d56cd[_0x6c6f('0x10')];_0x5d56cd[_0x6c6f('0x1b')]=_0x5d56cd['adminId'];_0x3d8b39=!![];}if(_0x3d8b39){_0x468214(_0x5d56cd);}else{_0xb960f0({'statusCode':0x194,'message':_0x6c6f('0x12')});}}else{_0xb960f0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6c6f('0x13')](function(_0xb9814a){logger[_0x6c6f('0x14')]('['+[_0x5316dc[_0x6c6f('0x1e')]()]+']',_0xb9814a[_0x6c6f('0x15')]);_0xb960f0(_0xb9814a);});});};}function searchContact(_0x3c4229,_0x3908ce,_0x2da137,_0x5d145f){return new Promise(function(_0x2878d9,_0x27c25c){var _0x37cdcb={'method':_0x6c6f('0xa'),'headers':_0x3908ce,'uri':_0x3c4229+'/api/lookup?q='+_0x5d145f+_0x6c6f('0x1f')+_0x2da137+'&entities=contact','json':!![]};rp(_0x37cdcb)[_0x6c6f('0xe')](function(_0x2b96ff){var _0x5481b4=_[_0x6c6f('0x20')](_0x2b96ff[_0x6c6f('0x21')]['contacts'],[_0x2da137,_0x5d145f]);_0x2878d9(_0x5481b4);})[_0x6c6f('0x13')](function(_0x165fe0){_0x27c25c(_0x165fe0);});});}function getEndUser(_0xce06cd,_0x290b5c,_0x345bb0){return function(_0x29eadc){return new Promise(function(_0x25ec55,_0x406db4){logger[_0x6c6f('0xc')](util[_0x6c6f('0x22')](_0x6c6f('0x23'),_0x29eadc[_0x6c6f('0x24')]));searchContact(_0x345bb0,_0x290b5c,_0x6c6f('0x25'),_0x29eadc[_0x6c6f('0x24')])['then'](function(_0x2160bc){if(_0x2160bc){_0x29eadc[_0x6c6f('0x26')]=_0x2160bc['id'];logger[_0x6c6f('0xc')](_0x6c6f('0x27'),_0x29eadc['endUserId']);return _0x25ec55(_0x29eadc);}searchContact(_0x345bb0,_0x290b5c,'work_number',_0x29eadc[_0x6c6f('0x24')])[_0x6c6f('0xe')](function(_0x2d8e55){if(_0x2d8e55){_0x29eadc['endUserId']=_0x2d8e55['id'];logger[_0x6c6f('0xc')](_0x6c6f('0x28'),_0x29eadc[_0x6c6f('0x26')]);return _0x25ec55(_0x29eadc);}createEndUser(_0x29eadc,_0xce06cd,_0x290b5c,_0x345bb0)[_0x6c6f('0xe')](function(_0x236a9a){logger[_0x6c6f('0xc')](_0x6c6f('0x29'),_0x236a9a[_0x6c6f('0x26')]);return _0x25ec55(_0x236a9a);});});})[_0x6c6f('0x13')](function(_0x43f1e0){_0x406db4(_0x43f1e0);});});};}function createEndUser(_0xc0d7b7,_0x1bb7ac,_0x5b0e47,_0x9ace54){return new Promise(function(_0x254905,_0xdc7f07){var _0x4da99e=moment();var _0x319ad3={'method':'POST','uri':_0x9ace54+'/api/contacts','body':{'contact':{'last_name':_0xc0d7b7[_0x6c6f('0x24')],'work_number':_0xc0d7b7['contactNumber'],'mobile_number':_0xc0d7b7['contactNumber'],'owner_id':_0xc0d7b7['userId'],'created_at':_0x4da99e[_0x6c6f('0x22')](_0x6c6f('0x2a'))}},'json':!![]};_0x319ad3['headers']=_0x5b0e47;logger['info'](_0x6c6f('0x2b'));return rp(_0x319ad3)[_0x6c6f('0xe')](function(_0xe2ada3){_0xc0d7b7[_0x6c6f('0x26')]=_0xe2ada3[_0x6c6f('0x2c')]['id'];_0x254905(_0xc0d7b7);})['catch'](function(_0x4e626d){logger[_0x6c6f('0x14')]('['+[_0x1bb7ac[_0x6c6f('0x1e')]()]+']',_0x4e626d[_0x6c6f('0x15')]);_0xdc7f07(_0x4e626d[_0x6c6f('0x15')]);});});}function getTicket(_0x128786,_0x385d5b,_0x43d00a,_0x568220,_0x992e5e){return function(_0x2cd42e){logger[_0x6c6f('0xc')](_0x6c6f('0x2d'));return new Promise(function(_0x26773d,_0x582812){var _0x3a30a8=moment();var _0x14d0d0={'method':_0x6c6f('0x2e'),'uri':_0x43d00a+_0x6c6f('0x2f'),'body':{'title':intUtil[_0x6c6f('0x30')](_0x568220[_0x6c6f('0x31')],_0x992e5e,'\x20'),'description':intUtil['getString'](_0x568220[_0x6c6f('0x32')],_0x992e5e,'\x0a'),'owner_id':_0x2cd42e['userId'],'creater_id':_0x2cd42e[_0x6c6f('0x11')],'targetable_id':_0x2cd42e['endUserId'],'targetable_type':_0x6c6f('0x33'),'created_at':_0x3a30a8[_0x6c6f('0x22')](_0x6c6f('0x2a')),'due_date':_0x3a30a8[_0x6c6f('0x34')](0x1e,'m')[_0x6c6f('0x22')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x14d0d0[_0x6c6f('0x35')]=_0x385d5b;return rp(_0x14d0d0)[_0x6c6f('0xe')](function(_0x91ba9c){_0x2cd42e[_0x6c6f('0x36')]=_0x91ba9c[_0x6c6f('0x37')]['id'];logger[_0x6c6f('0xc')]('Task\x20created:',_0x2cd42e[_0x6c6f('0x36')]);_0x26773d(_0x2cd42e);})['catch'](function(_0xcd331b){logger[_0x6c6f('0x14')]('['+[_0x128786[_0x6c6f('0x1e')]()]+']',_0xcd331b['message']);_0x582812(_0xcd331b['message']);});});};}function emit(_0x27d56a,_0xbb7968,_0x3b3b33){var _0x3b0859={'uri':_0x27d56a+'/contacts/'+_0x3b3b33};io['to'](util[_0x6c6f('0x22')]('user:%s',_0xbb7968))[_0x6c6f('0x38')](_0x6c6f('0x39'),_0x3b0859);}exports['cs']=function(_0x46e0d9,_0x488517,_0x232468,_0x3afe8f,_0x5d3f1c,_0x32168f,_0x18cb95,_0x228bee){var _0x21e405={};var _0x5b9b1f={'Authorization':_0x6c6f('0x3a')+_0x32168f[_0x6c6f('0x3b')]};_0x32168f[_0x6c6f('0x3c')]=intUtil['stripTrailingSlash'](_0x32168f[_0x6c6f('0x3c')]);_0x32168f['serverUrl']=intUtil[_0x6c6f('0x3d')](_0x32168f[_0x6c6f('0x3e')]);var _0x216266=_0x32168f[_0x6c6f('0x3c')];_0x21e405[_0x6c6f('0x10')]=_0x32168f[_0x6c6f('0x3f')];_0x21e405[_0x6c6f('0x24')]=_0x228bee[_0x6c6f('0x40')]()==='outbound'?_0x488517['destcalleridnum']:_0x488517[_0x6c6f('0x41')];_0x21e405['callDirection']=_0x228bee===_0x6c6f('0x42')||_0x228bee===_0x6c6f('0x43')?_0x6c6f('0x42'):_0x6c6f('0x44');if(_0x3afe8f){_0x21e405[_0x6c6f('0x45')]=_0x3afe8f[_0x6c6f('0x1a')];}var _0x520f73=util[_0x6c6f('0x22')](_0x6c6f('0x46'),_0x32168f[_0x6c6f('0x3e')],_0x488517[_0x6c6f('0x47')],md5(_0x488517[_0x6c6f('0x47')]));if(_0x5d3f1c&&_0x5d3f1c[_0x6c6f('0x48')]){logger['info']('[QUEUE]',_0x6c6f('0x49'));_0x488517['recordingURL']=_0x520f73;}else if(_0x18cb95&&_0x18cb95[_0x6c6f('0x4a')]&&_0x18cb95['recordingFormat']!==_0x6c6f('0x4b')){logger[_0x6c6f('0xc')]('[OUTBOUND]',_0x6c6f('0x49'));_0x488517[_0x6c6f('0x4c')]=_0x520f73;}else{_0x488517[_0x6c6f('0x4c')]='';}return getAdminId(_0x21e405,_0x228bee,_0x5b9b1f,_0x216266)['then'](getUser(_0x228bee,_0x5b9b1f,_0x216266))[_0x6c6f('0xe')](getEndUser(_0x228bee,_0x5b9b1f,_0x216266))['then'](getTicket(_0x228bee,_0x5b9b1f,_0x216266,_0x232468,_0x488517))['then'](function(_0x25c655){logger[_0x6c6f('0xc')](util[_0x6c6f('0x22')](_0x6c6f('0x4d'),_0x25c655[_0x6c6f('0x36')]));if(_0x228bee!==_0x6c6f('0x43')){logger[_0x6c6f('0xc')]('['+[_0x228bee[_0x6c6f('0x1e')]()]+']',_0x6c6f('0x4e'));emit(_0x216266,_0x3afe8f[_0x6c6f('0x4f')],_0x25c655[_0x6c6f('0x26')]);}})['catch'](function(_0x128bc1){logger[_0x6c6f('0x14')]('['+[_0x228bee[_0x6c6f('0x1e')]()]+_0x6c6f('0x50'),util['inspect'](_0x128bc1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd543=['YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','/api/tasks','getString','Subjects','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','util','moment','ioredis','redis','defaults','socket.io-emitter','/api/selector/owners','then','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20created:','POST','/api/contacts'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xd543,0x71));var _0x3d54=function(_0x131551,_0xb444b1){_0x131551=_0x131551-0x0;var _0x329958=_0xd543[_0x131551];return _0x329958;};'use strict';var _=require('lodash');var rp=require(_0x3d54('0x0'));var md5=require(_0x3d54('0x1'));var util=require(_0x3d54('0x2'));var moment=require(_0x3d54('0x3'));var Promise=require('bluebird');var Redis=require(_0x3d54('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x3d54('0x5')]=_[_0x3d54('0x6')](config[_0x3d54('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3d54('0x7'))(new Redis(config[_0x3d54('0x5')]));function getAdminId(_0x3dcd09,_0x467c5a,_0x15ebfc,_0x2c94e9){return new Promise(function(_0xa6c182,_0x287de9){var _0x1cfdf9=![];var _0x2587b1={'method':'GET','uri':_0x2c94e9+_0x3d54('0x8'),'json':!![]};_0x2587b1['headers']=_0x15ebfc;logger['info']('Getting\x20admin\x20information');return rp(_0x2587b1)[_0x3d54('0x9')](function(_0x4ddb0d){if(_0x4ddb0d){var _0x28b1c5=_0x4ddb0d['users'];var _0x133609=null;for(_0x133609=0x0;_0x133609<_0x28b1c5[_0x3d54('0xa')];_0x133609++){if(_0x28b1c5[_0x133609][_0x3d54('0xb')]===_0x3dcd09['adminEmail']){_0x3dcd09[_0x3d54('0xc')]=_0x28b1c5[_0x133609]['id'];_0x1cfdf9=!![];}}if(_0x1cfdf9){logger[_0x3d54('0xd')](_0x3d54('0xe'),_0x3dcd09[_0x3d54('0xc')]);_0xa6c182(_0x3dcd09);}else{_0x287de9({'statusCode':0x194,'message':_0x3d54('0xf')});}}else{_0x287de9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3d54('0x10')](function(_0x4b649f){logger[_0x3d54('0x11')]('['+[_0x467c5a[_0x3d54('0x12')]()]+']',_0x4b649f['message']);_0x287de9(_0x4b649f);});});}function getUser(_0x24d8ef,_0x53ceac,_0x4939cf){return function(_0x3063ad){return new Promise(function(_0x5e914f,_0x287abd){var _0xd72501={'method':_0x3d54('0x13'),'uri':_0x4939cf+'/api/selector/owners','json':!![]};_0xd72501[_0x3d54('0x14')]=_0x53ceac;logger[_0x3d54('0xd')](_0x3d54('0x15'));return rp(_0xd72501)[_0x3d54('0x9')](function(_0x35f075){if(_0x35f075){var _0x568af8=_0x35f075['users'];var _0x2c6011=![];var _0x2b2dc0=null;if(_0x3063ad[_0x3d54('0x16')]!==null){logger[_0x3d54('0xd')](_0x3d54('0x17'),_0x3063ad[_0x3d54('0x16')]);_0x3063ad[_0x3d54('0x18')]=_0x3063ad[_0x3d54('0x16')];for(_0x2b2dc0=0x0;_0x2b2dc0<_0x568af8['length'];_0x2b2dc0++){if(_0x568af8[_0x2b2dc0][_0x3d54('0xb')]===_0x3063ad['agentEmail']){_0x2c6011=!![];_0x3063ad[_0x3d54('0x19')]=_0x568af8[_0x2b2dc0]['id'];logger['info'](_0x3d54('0x1a'),_0x3063ad[_0x3d54('0x19')]);}}}if(!_0x2c6011){logger['info'](_0x3d54('0x1b'));_0x3063ad['userEmail']=_0x3063ad[_0x3d54('0x1c')];_0x3063ad[_0x3d54('0x19')]=_0x3063ad[_0x3d54('0xc')];_0x2c6011=!![];}if(_0x2c6011){_0x5e914f(_0x3063ad);}else{_0x287abd({'statusCode':0x194,'message':_0x3d54('0xf')});}}else{_0x287abd({'statusCode':0x194,'message':_0x3d54('0xf')});}})['catch'](function(_0x33dc54){logger[_0x3d54('0x11')]('['+[_0x24d8ef[_0x3d54('0x12')]()]+']',_0x33dc54['message']);_0x287abd(_0x33dc54);});});};}function searchContact(_0x4c25d8,_0x31812e,_0x5197e0,_0xd7d180){return new Promise(function(_0xf71cb7,_0x4d8039){var _0x2201e0={'method':_0x3d54('0x13'),'headers':_0x31812e,'uri':_0x4c25d8+_0x3d54('0x1d')+_0xd7d180+_0x3d54('0x1e')+_0x5197e0+_0x3d54('0x1f'),'json':!![]};rp(_0x2201e0)[_0x3d54('0x9')](function(_0x28cd72){var _0x14f1e6=_[_0x3d54('0x20')](_0x28cd72['contacts'][_0x3d54('0x21')],[_0x5197e0,_0xd7d180]);_0xf71cb7(_0x14f1e6);})['catch'](function(_0x483eb3){_0x4d8039(_0x483eb3);});});}function getEndUser(_0x1c3194,_0x1addc1,_0x1163e0){return function(_0xb58656){return new Promise(function(_0x32490c,_0x2f1e1a){logger[_0x3d54('0xd')](util[_0x3d54('0x22')](_0x3d54('0x23'),_0xb58656[_0x3d54('0x24')]));searchContact(_0x1163e0,_0x1addc1,_0x3d54('0x25'),_0xb58656['contactNumber'])[_0x3d54('0x9')](function(_0x15fc7e){if(_0x15fc7e){_0xb58656['endUserId']=_0x15fc7e['id'];logger[_0x3d54('0xd')](_0x3d54('0x26'),_0xb58656[_0x3d54('0x27')]);return _0x32490c(_0xb58656);}searchContact(_0x1163e0,_0x1addc1,'work_number',_0xb58656['contactNumber'])[_0x3d54('0x9')](function(_0x484d8a){if(_0x484d8a){_0xb58656['endUserId']=_0x484d8a['id'];logger[_0x3d54('0xd')]('Contact\x20found\x20work_number:',_0xb58656[_0x3d54('0x27')]);return _0x32490c(_0xb58656);}createEndUser(_0xb58656,_0x1c3194,_0x1addc1,_0x1163e0)[_0x3d54('0x9')](function(_0x29b8e7){logger[_0x3d54('0xd')](_0x3d54('0x28'),_0x29b8e7[_0x3d54('0x27')]);return _0x32490c(_0x29b8e7);});});})['catch'](function(_0x461c33){_0x2f1e1a(_0x461c33);});});};}function createEndUser(_0x1b3740,_0x461c15,_0x1539a5,_0x4c0a2e){return new Promise(function(_0x2cec1b,_0x50d056){var _0x100944=moment();var _0x37dd3e={'method':_0x3d54('0x29'),'uri':_0x4c0a2e+_0x3d54('0x2a'),'body':{'contact':{'last_name':_0x1b3740[_0x3d54('0x24')],'work_number':_0x1b3740[_0x3d54('0x24')],'mobile_number':_0x1b3740[_0x3d54('0x24')],'owner_id':_0x1b3740['userId'],'created_at':_0x100944['format'](_0x3d54('0x2b'))}},'json':!![]};_0x37dd3e[_0x3d54('0x14')]=_0x1539a5;logger[_0x3d54('0xd')](_0x3d54('0x2c'));return rp(_0x37dd3e)[_0x3d54('0x9')](function(_0x2e2eef){_0x1b3740[_0x3d54('0x27')]=_0x2e2eef[_0x3d54('0x2d')]['id'];_0x2cec1b(_0x1b3740);})['catch'](function(_0x27ec6d){logger[_0x3d54('0x11')]('['+[_0x461c15['toUpperCase']()]+']',_0x27ec6d[_0x3d54('0x2e')]);_0x50d056(_0x27ec6d[_0x3d54('0x2e')]);});});}function getTicket(_0x2aba8c,_0x11b1d5,_0x384c47,_0x16309e,_0x51527e){return function(_0x53b9a6){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x4968f3,_0x113766){var _0x589d4c=moment();var _0x317437={'method':'POST','uri':_0x384c47+_0x3d54('0x2f'),'body':{'title':intUtil[_0x3d54('0x30')](_0x16309e[_0x3d54('0x31')],_0x51527e,'\x20'),'description':intUtil[_0x3d54('0x30')](_0x16309e['Descriptions'],_0x51527e,'\x0a'),'owner_id':_0x53b9a6[_0x3d54('0x19')],'creater_id':_0x53b9a6[_0x3d54('0xc')],'targetable_id':_0x53b9a6[_0x3d54('0x27')],'targetable_type':_0x3d54('0x32'),'created_at':_0x589d4c[_0x3d54('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x589d4c['add'](0x1e,'m')[_0x3d54('0x22')](_0x3d54('0x2b'))},'json':!![]};_0x317437[_0x3d54('0x14')]=_0x11b1d5;return rp(_0x317437)[_0x3d54('0x9')](function(_0x458024){_0x53b9a6[_0x3d54('0x33')]=_0x458024[_0x3d54('0x34')]['id'];logger['info'](_0x3d54('0x35'),_0x53b9a6[_0x3d54('0x33')]);_0x4968f3(_0x53b9a6);})[_0x3d54('0x10')](function(_0x5bcc0a){logger[_0x3d54('0x11')]('['+[_0x2aba8c[_0x3d54('0x12')]()]+']',_0x5bcc0a[_0x3d54('0x2e')]);_0x113766(_0x5bcc0a['message']);});});};}function emit(_0x454a65,_0x511697,_0xae67){var _0x4df253={'uri':_0x454a65+_0x3d54('0x36')+_0xae67};io['to'](util[_0x3d54('0x22')](_0x3d54('0x37'),_0x511697))[_0x3d54('0x38')]('trigger:browser:url',_0x4df253);}exports['cs']=function(_0x43bea5,_0x39cbbd,_0xfa623d,_0x1e1bdc,_0x380b9,_0x44f8fb,_0x3c39ab,_0x11a975){var _0x108b1a={};var _0x5ef1d0={'Authorization':'Token\x20token='+_0x44f8fb[_0x3d54('0x39')]};_0x44f8fb[_0x3d54('0x3a')]=intUtil[_0x3d54('0x3b')](_0x44f8fb[_0x3d54('0x3a')]);_0x44f8fb[_0x3d54('0x3c')]=intUtil[_0x3d54('0x3b')](_0x44f8fb[_0x3d54('0x3c')]);var _0x459ec6=_0x44f8fb[_0x3d54('0x3a')];_0x108b1a['adminEmail']=_0x44f8fb[_0x3d54('0x3d')];_0x108b1a['contactNumber']=_0x11a975['toLowerCase']()===_0x3d54('0x3e')?_0x39cbbd[_0x3d54('0x3f')]:_0x39cbbd[_0x3d54('0x40')];_0x108b1a[_0x3d54('0x41')]=_0x11a975===_0x3d54('0x42')||_0x11a975===_0x3d54('0x43')?'queue':_0x3d54('0x3e');if(_0x1e1bdc){_0x108b1a[_0x3d54('0x16')]=_0x1e1bdc[_0x3d54('0xb')];}var _0x3e393c=util['format'](_0x3d54('0x44'),_0x44f8fb[_0x3d54('0x3c')],_0x39cbbd[_0x3d54('0x45')],md5(_0x39cbbd[_0x3d54('0x45')]));if(_0x380b9&&_0x380b9[_0x3d54('0x46')]){logger[_0x3d54('0xd')]('[QUEUE]',_0x3d54('0x47'));_0x39cbbd[_0x3d54('0x48')]=_0x3e393c;}else if(_0x3c39ab&&_0x3c39ab[_0x3d54('0x49')]&&_0x3c39ab[_0x3d54('0x49')]!==_0x3d54('0x4a')){logger[_0x3d54('0xd')](_0x3d54('0x4b'),_0x3d54('0x47'));_0x39cbbd[_0x3d54('0x48')]=_0x3e393c;}else{_0x39cbbd[_0x3d54('0x48')]='';}return getAdminId(_0x108b1a,_0x11a975,_0x5ef1d0,_0x459ec6)[_0x3d54('0x9')](getUser(_0x11a975,_0x5ef1d0,_0x459ec6))[_0x3d54('0x9')](getEndUser(_0x11a975,_0x5ef1d0,_0x459ec6))[_0x3d54('0x9')](getTicket(_0x11a975,_0x5ef1d0,_0x459ec6,_0xfa623d,_0x39cbbd))[_0x3d54('0x9')](function(_0x534c55){logger[_0x3d54('0xd')](util[_0x3d54('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x534c55[_0x3d54('0x33')]));if(_0x11a975!==_0x3d54('0x43')){logger['info']('['+[_0x11a975[_0x3d54('0x12')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x459ec6,_0x1e1bdc[_0x3d54('0x4c')],_0x534c55['endUserId']);}})[_0x3d54('0x10')](function(_0x1ae929){logger[_0x3d54('0x11')]('['+[_0x11a975[_0x3d54('0x12')]()]+_0x3d54('0x4d'),util['inspect'](_0x1ae929,{'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 4a05817..a0f118b 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 _0x6694=['./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','routeId','outbound','log','EVENT\x20UNKNOWN','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x15c99b,_0x2f8941){var _0x30b17a=function(_0x445c30){while(--_0x445c30){_0x15c99b['push'](_0x15c99b['shift']());}};_0x30b17a(++_0x2f8941);}(_0x6694,0x18e));var _0x4669=function(_0x17dea3,_0x31f7e2){_0x17dea3=_0x17dea3-0x0;var _0x5c50f8=_0x6694[_0x17dea3];return _0x5c50f8;};'use strict';var _=require('lodash');var util=require(_0x4669('0x0'));var zendesk=require(_0x4669('0x1'));var salesforce=require(_0x4669('0x2'));var sugarcrm=require(_0x4669('0x3'));var freshdesk=require(_0x4669('0x4'));var zoho=require(_0x4669('0x5'));var desk=require(_0x4669('0x6'));var vtiger=require(_0x4669('0x7'));var servicenow=require(_0x4669('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x4669('0x9'));var integrations=[_0x4669('0xa'),_0x4669('0xb'),_0x4669('0xc'),_0x4669('0xd'),_0x4669('0xe'),_0x4669('0xf'),_0x4669('0x10'),_0x4669('0x11'),_0x4669('0x12'),_0x4669('0x13')];exports[_0x4669('0x14')]=function(_0x19fefb,_0x4bd413,_0x3f18aa,_0x4a3c22,_0x395a70,_0x1fc780){if(_0x3f18aa){if(_[_0x4669('0x15')](integrations,_0x19fefb[_0x4669('0x16')][_0x4669('0x17')]())){try{var _0x1e08e5=null;var _0x145ccd='';var _0x9e4b99=_0x3f18aa[_0x19fefb[_0x4669('0x16')][_0x4669('0x17')]()];if(_0x9e4b99){var _0x18bdf3=_0x9e4b99[_0x19fefb[_0x4669('0x18')]];if(_0x18bdf3){var _0x50b912=_[_0x4669('0x19')](_0x18bdf3['Configurations'],{'id':parseInt(_0x19fefb['data3'],0xa)});if(_0x50b912){if(_0x4a3c22){if(_0x395a70&&_0x4bd413['queue']){_0x145ccd='queue';}else if(_0x4bd413[_0x4669('0x1a')]){_0x145ccd=_0x4669('0x1b');}else{console[_0x4669('0x1c')](_0x4669('0x1d'),_0x4bd413);}}else{_0x145ccd='unmanaged';}switch(_0x19fefb[_0x4669('0x16')][_0x4669('0x17')]()){case _0x4669('0xa'):zendesk[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case _0x4669('0xb'):salesforce[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case'sugarcrm':sugarcrm[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case _0x4669('0xd'):freshdesk[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case'zoho':zoho[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case _0x4669('0xf'):desk[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case'vtiger':vtiger[_0x145ccd](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780);break;case _0x4669('0x12'):freshsales['cs'](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780,_0x145ccd);break;case _0x4669('0x13'):servicenow['cs'](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780,_0x145ccd);break;case _0x4669('0x11'):dynamics365['cs'](_0x19fefb,_0x4bd413,_0x50b912,_0x4a3c22,_0x395a70,_0x18bdf3,_0x1fc780,_0x145ccd);break;default:console['log']('unknown\x20integration');}}else{_0x1e08e5=require(_0x4669('0x1e'))(_0x19fefb['data1'][_0x4669('0x17')]());_0x1e08e5[_0x4669('0x1f')](_0x4669('0x20'),util[_0x4669('0x21')](_0x4669('0x22'),_0x19fefb[_0x4669('0x16')]['toLowerCase'](),_0x19fefb[_0x4669('0x23')]));}}else{_0x1e08e5=require('../../../../config/logger')(_0x19fefb[_0x4669('0x16')][_0x4669('0x17')]());_0x1e08e5[_0x4669('0x1f')](_0x4669('0x20'),util['format'](_0x4669('0x24'),_0x19fefb['data1'][_0x4669('0x17')](),_0x19fefb[_0x4669('0x18')]));}}else{}}catch(_0x345d67){console[_0x4669('0x1f')](_0x345d67);}}}}; \ No newline at end of file +var _0x1c3f=['toLowerCase','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zendesk','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','desk','vtiger','dynamics365','servicenow','includes'];(function(_0x2c94d4,_0x43af5a){var _0x138a94=function(_0x1ab63e){while(--_0x1ab63e){_0x2c94d4['push'](_0x2c94d4['shift']());}};_0x138a94(++_0x43af5a);}(_0x1c3f,0x1ab));var _0xf1c3=function(_0x2dd25a,_0x473907){_0x2dd25a=_0x2dd25a-0x0;var _0x59f26c=_0x1c3f[_0x2dd25a];return _0x59f26c;};'use strict';var _=require(_0xf1c3('0x0'));var util=require(_0xf1c3('0x1'));var zendesk=require(_0xf1c3('0x2'));var salesforce=require(_0xf1c3('0x3'));var sugarcrm=require(_0xf1c3('0x4'));var freshdesk=require(_0xf1c3('0x5'));var zoho=require(_0xf1c3('0x6'));var desk=require(_0xf1c3('0x7'));var vtiger=require(_0xf1c3('0x8'));var servicenow=require(_0xf1c3('0x9'));var dynamics365=require(_0xf1c3('0xa'));var freshsales=require(_0xf1c3('0xb'));var integrations=['zendesk','salesforce','sugarcrm','freshdesk','zoho',_0xf1c3('0xc'),_0xf1c3('0xd'),_0xf1c3('0xe'),'freshsales',_0xf1c3('0xf')];exports['exec']=function(_0x5303d6,_0xe6b5a0,_0x2d6ed9,_0x529ab7,_0x3a3390,_0x46746d){if(_0x2d6ed9){if(_[_0xf1c3('0x10')](integrations,_0x5303d6['data1'][_0xf1c3('0x11')]())){try{var _0x2de3ef=null;var _0x31f7f8='';var _0x5e9e0b=_0x2d6ed9[_0x5303d6['data1'][_0xf1c3('0x11')]()];if(_0x5e9e0b){var _0x364a85=_0x5e9e0b[_0x5303d6['data2']];if(_0x364a85){var _0x359163=_[_0xf1c3('0x12')](_0x364a85['Configurations'],{'id':parseInt(_0x5303d6[_0xf1c3('0x13')],0xa)});if(_0x359163){if(_0x529ab7){if(_0x3a3390&&_0xe6b5a0[_0xf1c3('0x14')]){_0x31f7f8='queue';}else if(_0xe6b5a0[_0xf1c3('0x15')]){_0x31f7f8=_0xf1c3('0x16');}else{console[_0xf1c3('0x17')](_0xf1c3('0x18'),_0xe6b5a0);}}else{_0x31f7f8=_0xf1c3('0x19');}switch(_0x5303d6[_0xf1c3('0x1a')]['toLowerCase']()){case _0xf1c3('0x1b'):zendesk[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case'salesforce':salesforce[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case _0xf1c3('0x1c'):sugarcrm[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case _0xf1c3('0x1d'):freshdesk[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case'zoho':zoho[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case'desk':desk[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case _0xf1c3('0xd'):vtiger[_0x31f7f8](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d);break;case'freshsales':freshsales['cs'](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d,_0x31f7f8);break;case _0xf1c3('0xf'):servicenow['cs'](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d,_0x31f7f8);break;case'dynamics365':dynamics365['cs'](_0x5303d6,_0xe6b5a0,_0x359163,_0x529ab7,_0x3a3390,_0x364a85,_0x46746d,_0x31f7f8);break;default:console[_0xf1c3('0x17')](_0xf1c3('0x1e'));}}else{_0x2de3ef=require(_0xf1c3('0x1f'))(_0x5303d6[_0xf1c3('0x1a')][_0xf1c3('0x11')]());_0x2de3ef[_0xf1c3('0x20')](_0xf1c3('0x21'),util[_0xf1c3('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5303d6[_0xf1c3('0x1a')]['toLowerCase'](),_0x5303d6[_0xf1c3('0x13')]));}}else{_0x2de3ef=require(_0xf1c3('0x1f'))(_0x5303d6[_0xf1c3('0x1a')][_0xf1c3('0x11')]());_0x2de3ef[_0xf1c3('0x20')]('[EXEC]',util[_0xf1c3('0x22')](_0xf1c3('0x23'),_0x5303d6['data1'][_0xf1c3('0x11')](),_0x5303d6[_0xf1c3('0x24')]));}}else{}}catch(_0x1961c8){console[_0xf1c3('0x20')](_0x1961c8);}}}}; \ 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 989214f..6aebdf9 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 _0x4a15=['jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','lead','WhoId','account','Case','contact','ContactId','leadId','sobject','isNil','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','No\x20Company','upperFirst','create','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','monitor_format','lastevent','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x4a15,0x79));var _0x54a1=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x4a15[_0x354164];return _0x5db9a8;};'use strict';var _=require(_0x54a1('0x0'));var rp=require(_0x54a1('0x1'));var moment=require(_0x54a1('0x2'));var BPromise=require(_0x54a1('0x3'));var md5=require(_0x54a1('0x4'));var jsforce=require(_0x54a1('0x5'));var util=require(_0x54a1('0x6'));var Redis=require(_0x54a1('0x7'));var intUtil=require(_0x54a1('0x8'));var config=require(_0x54a1('0x9'));var logger=require(_0x54a1('0xa'))(_0x54a1('0xb'));config[_0x54a1('0xc')]=_[_0x54a1('0xd')](config[_0x54a1('0xc')],{'host':_0x54a1('0xe'),'port':0x18eb});var io=require(_0x54a1('0xf'))(new Redis(config[_0x54a1('0xc')]));function emit(_0x280c3a,_0x571a89,_0x5661e0){io['to'](_0x280c3a)[_0x54a1('0x10')](_0x571a89,_0x5661e0);}function getTicket(_0x3e73d6,_0x33afa3,_0x2bb3db,_0x5e058e,_0x88387f,_0x2bb914,_0x2e5603,_0x225c24){var _0x24999b=Object['assign']({},{'OwnerId':_0x33afa3['id'],'Subject':intUtil[_0x54a1('0x11')](_0x5e058e['Subjects'],_0x88387f,'\x20'),'Description':intUtil[_0x54a1('0x11')](_0x5e058e[_0x54a1('0x12')],_0x88387f,'\x0a')},getCustomFields(_0x2bb914,_0x88387f));if(_0x2bb3db){if(_0x5e058e[_0x54a1('0x13')]===_0x54a1('0x14')){_0x24999b[_0x54a1('0x15')]=moment[_0x54a1('0x16')]();_0x24999b[_0x54a1('0x17')]=![];_0x24999b['IsRecurrence']=![];if(_0x2bb3db[_0x54a1('0x18')]==='contact'||_0x2bb3db[_0x54a1('0x18')]===_0x54a1('0x19')){_0x24999b[_0x54a1('0x1a')]=_0x2bb3db['id'];}else if(_0x2bb3db[_0x54a1('0x18')]===_0x54a1('0x1b')){_0x24999b['WhatId']=_0x2bb3db['id'];}}else if(_0x5e058e[_0x54a1('0x13')]===_0x54a1('0x1c')){if(_0x2bb3db[_0x54a1('0x18')]===_0x54a1('0x1d')){_0x24999b[_0x54a1('0x1e')]=_0x2bb3db['id'];}else if(_0x2bb3db['endUserType']==='account'){_0x24999b['AccountId']=_0x2bb3db['id'];}else if(_0x2bb3db[_0x54a1('0x18')]==='lead'&&_0x5e058e['leadId']){_0x24999b[_0x5e058e[_0x54a1('0x1f')]]=_0x2bb3db['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2e5603[_0x54a1('0x20')](_0x5e058e['ticketType'])['create'](_0x24999b);}function getUser(_0x322f38,_0x338bfb,_0x3b2054){if(!_[_0x54a1('0x21')](_0x338bfb)&&intUtil['validateEmail'](_0x338bfb)){var _0x342998={'Email':_0x338bfb};var _0x457588={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b2054[_0x54a1('0x20')](_0x54a1('0x22'))[_0x54a1('0x23')](_0x342998,_0x457588)[_0x54a1('0x24')]()[_0x54a1('0x25')](function(_0x3e745b){if(_0x3e745b[_0x54a1('0x26')]){var _0x1de6ac=_[_0x54a1('0x23')](_0x3e745b,function(_0x580885){return _0x580885[_0x54a1('0x27')]===_0x338bfb;});if(_0x1de6ac){logger[_0x54a1('0x28')](_0x54a1('0x29'),_0x338bfb);return BPromise[_0x54a1('0x2a')]({'id':_0x1de6ac['Id'],'name':_0x1de6ac[_0x54a1('0x2b')]});}}else{logger[_0x54a1('0x28')](_0x54a1('0x2c'),_0x338bfb);return _0x3b2054[_0x54a1('0x2d')]()[_0x54a1('0x25')](function(_0x1ae81d){return BPromise[_0x54a1('0x2a')]({'id':_0x1ae81d['user_id'],'name':_0x1ae81d[_0x54a1('0x2e')]});});}});}else{logger[_0x54a1('0x28')](_0x54a1('0x2c'),_0x338bfb);return _0x3b2054['identity']()[_0x54a1('0x25')](function(_0x457eef){return BPromise[_0x54a1('0x2a')]({'id':_0x457eef[_0x54a1('0x2f')],'name':_0x457eef['display_name']});});}}function getEndUser(_0x29573d,_0x38008b,_0x4dc26d,_0x32c7b0,_0xadfb21){var _0x2e8927={'$or':{'Phone':_0x32c7b0}};var _0x237729={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x54a1('0x2a')]()[_0x54a1('0x25')](function(){logger[_0x54a1('0x28')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x32c7b0,_0x38008b[_0x54a1('0x30')]);switch(_0x38008b[_0x54a1('0x30')]){case _0x54a1('0x31'):var _0x5ea0e8=_[_0x54a1('0x32')](_0x2e8927);if(_0x38008b[_0x54a1('0x33')]){var _0x53ede3={};_0x53ede3[_0x38008b[_0x54a1('0x33')]]=_0x32c7b0;_['merge'](_0x5ea0e8['$or'],_0x53ede3);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x34'))[_0x54a1('0x23')](_0x5ea0e8,_0x237729)[_0x54a1('0x24')]()[_0x54a1('0x25')](function(_0x244676){if(_0x244676&&_0x244676[_0x54a1('0x26')]){return _0x244676;}else{var _0xbdd714=_['cloneDeep'](_0x2e8927);if(_0x38008b[_0x54a1('0x35')]){var _0x470e94={};_0x470e94[_0x38008b[_0x54a1('0x35')]]=_0x32c7b0;_[_0x54a1('0x36')](_0xbdd714[_0x54a1('0x37')],_0x470e94);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x38'))[_0x54a1('0x23')](_0xbdd714,_0x237729);}});case _0x54a1('0x39'):var _0x316d9d=_['cloneDeep'](_0x2e8927);if(_0x38008b['additionalSearchAccount']){var _0x53ede3={};_0x53ede3[_0x38008b[_0x54a1('0x3a')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x316d9d[_0x54a1('0x37')],_0x53ede3);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x3b'))[_0x54a1('0x23')](_0x316d9d,_0x237729)[_0x54a1('0x24')]()[_0x54a1('0x25')](function(_0x974465){if(_0x974465&&_0x974465['length']){return _0x974465;}else{var _0x9f3ee6=_['cloneDeep'](_0x2e8927);if(_0x38008b['additionalSearchContact']){var _0x2dde9c={};_0x2dde9c[_0x38008b[_0x54a1('0x33')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x9f3ee6[_0x54a1('0x37')],_0x2dde9c);}return _0xadfb21[_0x54a1('0x20')]('Contact')['find'](_0x9f3ee6,_0x237729)[_0x54a1('0x25')](function(_0x46deea){if(_0x46deea&&_0x46deea[_0x54a1('0x26')]){return _0x46deea;}else{var _0x5d69f2=_['cloneDeep'](_0x2e8927);if(_0x38008b[_0x54a1('0x35')]){var _0x413816={};_0x413816[_0x38008b[_0x54a1('0x35')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x5d69f2[_0x54a1('0x37')],_0x413816);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x38'))[_0x54a1('0x23')](_0x5d69f2,_0x237729);}});}});case _0x54a1('0x1d'):var _0x5ea0e8=_[_0x54a1('0x32')](_0x2e8927);if(_0x38008b[_0x54a1('0x33')]){var _0x53ede3={};_0x53ede3[_0x38008b[_0x54a1('0x33')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x5ea0e8['$or'],_0x53ede3);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x34'))[_0x54a1('0x23')](_0x5ea0e8,_0x237729)[_0x54a1('0x24')]();case _0x54a1('0x19'):var _0x5cbe62=_[_0x54a1('0x32')](_0x2e8927);if(_0x38008b[_0x54a1('0x35')]){var _0x53ede3={};_0x53ede3[_0x38008b[_0x54a1('0x35')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x5cbe62['$or'],_0x53ede3);}return _0xadfb21[_0x54a1('0x20')](_0x54a1('0x38'))['find'](_0x5cbe62,_0x237729);case _0x54a1('0x1b'):var _0x316d9d=_[_0x54a1('0x32')](_0x2e8927);if(_0x38008b[_0x54a1('0x3a')]){var _0x53ede3={};_0x53ede3[_0x38008b[_0x54a1('0x3a')]]=_0x32c7b0;_[_0x54a1('0x36')](_0x316d9d[_0x54a1('0x37')],_0x53ede3);}return _0xadfb21['sobject']('Account')[_0x54a1('0x23')](_0x316d9d,_0x237729);default:return null;}})[_0x54a1('0x25')](function(_0x26d810){if(_0x26d810&&_0x26d810[_0x54a1('0x26')]){var _0x4360f8=_['first'](_0x26d810);if(_0x4360f8){return BPromise[_0x54a1('0x2a')]({'id':_0x4360f8['Id'],'name':_0x4360f8['Name'],'phone':_0x4360f8[_0x54a1('0x3c')],'endUserType':_0x4360f8[_0x54a1('0x3d')][_0x54a1('0x3e')][_0x54a1('0x3f')]()});}}})[_0x54a1('0x25')](function(_0x1c7d1e){if(_0x1c7d1e){logger[_0x54a1('0x28')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1c7d1e[_0x54a1('0x18')],_0x32c7b0);return BPromise['resolve'](_0x1c7d1e);}else{logger[_0x54a1('0x28')](_0x54a1('0x40'),_0x32c7b0);var _0x3bcc3a={'Phone':_0x32c7b0};if(_0x38008b[_0x54a1('0x41')]){if(_0x38008b[_0x54a1('0x41')]==='contact'){logger[_0x54a1('0x28')](_0x54a1('0x42'),_0x32c7b0,_0x38008b[_0x54a1('0x41')]);_0x3bcc3a[_0x54a1('0x43')]=_0x4dc26d!==_0x54a1('0x44')?_0x4dc26d:util[_0x54a1('0x45')]('Caller\x20-\x20%s',_0x32c7b0);}else if(_0x38008b[_0x54a1('0x41')]==='lead'){logger[_0x54a1('0x28')](_0x54a1('0x42'),_0x32c7b0,_0x38008b[_0x54a1('0x41')]);_0x3bcc3a[_0x54a1('0x43')]=_0x4dc26d!==_0x54a1('0x44')?_0x4dc26d:util[_0x54a1('0x45')]('Caller\x20-\x20%s',_0x32c7b0);_0x3bcc3a['Company']=_0x54a1('0x46');}else if(_0x38008b[_0x54a1('0x41')]===_0x54a1('0x1b')){logger[_0x54a1('0x28')](_0x54a1('0x42'),_0x32c7b0,_0x38008b['moduleCreate']);_0x3bcc3a[_0x54a1('0x2b')]=_0x4dc26d!==_0x54a1('0x44')?_0x4dc26d:util['format']('Caller\x20-\x20%s',_0x32c7b0);}else{return null;}}return _0xadfb21[_0x54a1('0x20')](_[_0x54a1('0x47')](_0x38008b['moduleCreate']))[_0x54a1('0x48')](_0x3bcc3a)[_0x54a1('0x25')](function(_0x3dd812){return BPromise['resolve']({'id':_0x3dd812['id'],'endUserType':_0x38008b[_0x54a1('0x41')]});});}});}function getCustomFields(_0x57bd66,_0x357e75){var _0x4ab05f={};if(_0x57bd66[_0x54a1('0x26')]>0x0){_['forEach'](_0x57bd66,function(_0x4ddd24){if(_['includes']([_0x54a1('0x49'),_0x54a1('0x4a')],_0x4ddd24['type'])&&_0x4ddd24[_0x54a1('0x4b')]){_0x4ab05f[_0x4ddd24[_0x54a1('0x4b')]]=_0x4ddd24[_0x54a1('0x4c')][_0x54a1('0x4d')]();}else if(_0x4ddd24['type']===_0x54a1('0x4e')&&_0x4ddd24[_0x54a1('0x4f')]&&_0x4ddd24[_0x54a1('0x4b')]){_0x357e75[_0x4ddd24['variableName']]&&(_0x4ab05f[_0x4ddd24[_0x54a1('0x4b')]]=_0x357e75[_0x4ddd24[_0x54a1('0x4f')]]['toString']());}else if(_0x4ddd24['type']===_0x54a1('0x50')&&_0x4ddd24[_0x54a1('0x51')]&&_0x4ddd24[_0x54a1('0x51')][_0x54a1('0x52')]&&_0x4ddd24[_0x54a1('0x4b')]){_0x357e75[_0x4ddd24[_0x54a1('0x51')][_0x54a1('0x52')][_0x54a1('0x3f')]()]&&(_0x4ab05f[_0x4ddd24[_0x54a1('0x4b')]]=_0x357e75[_0x4ddd24[_0x54a1('0x51')][_0x54a1('0x52')][_0x54a1('0x3f')]()][_0x54a1('0x4d')]());}});}return _0x4ab05f;}function getConnection(_0x277ef8){var _0x5d6aa2=_0x277ef8[_0x54a1('0x53')][_0x54a1('0x54')](_0x277ef8[_0x54a1('0x55')]);var _0x2be8ec=new jsforce['Connection']({'oauth2':{'loginUrl':_0x277ef8[_0x54a1('0x56')]||_0x54a1('0x57'),'clientId':_0x277ef8[_0x54a1('0x58')],'clientSecret':_0x277ef8['clientSecret']}});return _0x2be8ec['login'](_0x277ef8[_0x54a1('0x59')],_0x5d6aa2)[_0x54a1('0x25')](function(){logger[_0x54a1('0x28')](_0x54a1('0x5a'));return _0x2be8ec;});}exports[_0x54a1('0x5b')]=function(_0x37f572,_0x4f9286,_0x4f07e3,_0x38d4f6,_0x227e7b,_0x2ad693){var _0x524e03,_0xae77b3,_0x5c1017,_0x384bff;_0x2ad693['serverUrl']=intUtil[_0x54a1('0x5c')](_0x2ad693[_0x54a1('0x5d')]);_0x2ad693[_0x54a1('0x56')]=intUtil[_0x54a1('0x5c')](_0x2ad693['remoteUri']);if(_0x227e7b&&_0x227e7b['monitor_format']){logger[_0x54a1('0x28')](_0x54a1('0x5e'),_0x54a1('0x5f'));_0x4f9286['recordingURL']=util[_0x54a1('0x45')](_0x54a1('0x60'),_0x2ad693[_0x54a1('0x5d')],_0x4f9286[_0x54a1('0x61')],md5(_0x4f9286[_0x54a1('0x61')]));}else{_0x4f9286[_0x54a1('0x62')]='';}return getConnection(_0x2ad693)[_0x54a1('0x25')](function(_0xb53220){_0x384bff=_0xb53220;return getUser(_0x2ad693,_0x38d4f6[_0x54a1('0x63')],_0x384bff);})[_0x54a1('0x25')](function(_0x3b72bf){_0x524e03=_0x3b72bf;return getEndUser(_0x2ad693,_0x4f07e3,_0x4f9286['calleridname'],_0x4f9286['calleridnum'],_0x384bff);})['then'](function(_0x2eeb4a){_0xae77b3=_0x2eeb4a;return getTicket(_0x2ad693,_0x524e03,_0xae77b3,_0x4f07e3,_0x4f9286,_0x4f07e3['Fields'],_0x384bff,_0x54a1('0x5b'));})[_0x54a1('0x25')](function(_0x387b88){_0x5c1017=_0x387b88;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x5c1017['id']);logger[_0x54a1('0x28')](_0x54a1('0x64'),_0x5c1017['id'],_0x38d4f6['name'],_0x2ad693['type']);switch(_0x2ad693['type']){case _0x54a1('0x65'):emit(util[_0x54a1('0x45')]('user:%s',_0x38d4f6[_0x54a1('0x52')]),_0x54a1('0x66'),{'recordId':_0x5c1017['id']});break;case _0x54a1('0x67'):emit(util[_0x54a1('0x45')](_0x54a1('0x68'),_0x38d4f6[_0x54a1('0x52')]),_0x54a1('0x69'),{'uri':util[_0x54a1('0x45')](_0x54a1('0x6a'),_0x384bff['instanceUrl'],_0x5c1017['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x54a1('0x6b')](function(_0x3e4040){logger[_0x54a1('0x6c')](_0x54a1('0x5e'),_0x3e4040);});};exports[_0x54a1('0x6d')]=function(_0x350c6c,_0x414506,_0x1a3b09,_0x3f6746,_0x3a74e4,_0x4b15f3,_0x148878){var _0x3c8a61,_0x4936d2,_0x4e66b4,_0x412241;_0x4b15f3[_0x54a1('0x5d')]=intUtil[_0x54a1('0x5c')](_0x4b15f3[_0x54a1('0x5d')]);_0x4b15f3[_0x54a1('0x56')]=intUtil[_0x54a1('0x5c')](_0x4b15f3['remoteUri']);if(_0x148878&&_0x148878[_0x54a1('0x6e')]&&_0x148878[_0x54a1('0x6e')]!==_0x54a1('0x6f')){logger[_0x54a1('0x28')]('[OUTBOUND]',_0x54a1('0x5f'));_0x414506[_0x54a1('0x62')]=util[_0x54a1('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b15f3[_0x54a1('0x5d')],_0x414506['uniqueid'],md5(_0x414506[_0x54a1('0x61')]));}return getConnection(_0x4b15f3)[_0x54a1('0x25')](function(_0xf05d23){_0x412241=_0xf05d23;return getUser(_0x4b15f3,_0x3f6746[_0x54a1('0x63')],_0x412241);})[_0x54a1('0x25')](function(_0x40114f){_0x3c8a61=_0x40114f;return getEndUser(_0x4b15f3,_0x1a3b09,_0x414506[_0x54a1('0x70')],_0x414506[_0x54a1('0x71')],_0x412241);})[_0x54a1('0x25')](function(_0x30e1b9){_0x4936d2=_0x30e1b9;return getTicket(_0x4b15f3,_0x3c8a61,_0x4936d2,_0x1a3b09,_0x414506,_0x1a3b09[_0x54a1('0x72')],_0x412241,_0x54a1('0x6d'));})['then'](function(_0x488ea7){_0x4e66b4=_0x488ea7;logger[_0x54a1('0x28')](_0x54a1('0x73'),_0x4e66b4['id']);logger[_0x54a1('0x28')](_0x54a1('0x74'),_0x4e66b4['id'],_0x3f6746[_0x54a1('0x52')],_0x4b15f3[_0x54a1('0x3e')]);switch(_0x4b15f3['type']){case _0x54a1('0x65'):emit(util[_0x54a1('0x45')](_0x54a1('0x68'),_0x3f6746['name']),_0x54a1('0x66'),{'recordId':_0x4e66b4['id']});break;case _0x54a1('0x67'):emit(util[_0x54a1('0x45')](_0x54a1('0x68'),_0x3f6746[_0x54a1('0x52')]),_0x54a1('0x69'),{'uri':util[_0x54a1('0x45')](_0x54a1('0x6a'),_0x412241[_0x54a1('0x75')],_0x4e66b4['id'])});break;default:logger[_0x54a1('0x6c')](_0x54a1('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x54a1('0x6b')](function(_0x708229){logger[_0x54a1('0x6c')](_0x54a1('0x76'),_0x708229);});};exports['unmanaged']=function(_0x5eea9c,_0x2d8dbf,_0x25bb92,_0x4607f7,_0x5e5c63,_0x4b67a6){var _0x20eb72,_0x4ebe33,_0x3f6ce1,_0x34e7fe;_0x4b67a6[_0x54a1('0x5d')]=intUtil['stripTrailingSlash'](_0x4b67a6['serverUrl']);_0x4b67a6['remoteUri']=intUtil['stripTrailingSlash'](_0x4b67a6[_0x54a1('0x56')]);if(_0x5e5c63&&_0x5e5c63[_0x54a1('0x77')]){logger['info']('['+_0x2d8dbf[_0x54a1('0x78')]['toUpperCase']()+']',_0x54a1('0x5f'));_0x2d8dbf[_0x54a1('0x62')]=util['format'](_0x54a1('0x60'),_0x4b67a6[_0x54a1('0x5d')],_0x2d8dbf['uniqueid'],md5(_0x2d8dbf[_0x54a1('0x61')]));}else{_0x2d8dbf['recordingURL']='';}return getConnection(_0x4b67a6)[_0x54a1('0x25')](function(_0x4bdb00){_0x34e7fe=_0x4bdb00;if(!_[_0x54a1('0x21')](_0x4607f7)){return getUser(_0x4b67a6,_0x4607f7[_0x54a1('0x52')],_0x34e7fe);}else{return getUser(_0x4b67a6,null,_0x34e7fe);}})[_0x54a1('0x25')](function(_0x130ec0){_0x20eb72=_0x130ec0;return getEndUser(_0x4b67a6,_0x25bb92,_0x2d8dbf[_0x54a1('0x79')],_0x2d8dbf[_0x54a1('0x7a')],_0x34e7fe);})['then'](function(_0x25bca8){_0x4ebe33=_0x25bca8;return getTicket(_0x4b67a6,_0x20eb72,_0x4ebe33,_0x25bb92,_0x2d8dbf,_0x25bb92['Fields'],_0x34e7fe);})[_0x54a1('0x25')](function(_0x210699){_0x3f6ce1=_0x210699;logger['info']('['+_0x2d8dbf[_0x54a1('0x78')]['toUpperCase']()+_0x54a1('0x7b'),_0x3f6ce1['id']);logger['info']('['+_0x2d8dbf[_0x54a1('0x78')][_0x54a1('0x7c')]()+_0x54a1('0x7d'),_0x4b67a6[_0x54a1('0x3e')]);})[_0x54a1('0x6b')](function(_0x32880c){logger[_0x54a1('0x6c')]('['+_0x2d8dbf['lastevent'][_0x54a1('0x7c')]()+']',_0x32880c);});}; \ No newline at end of file +var _0x600b=['stripTrailingSlash','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','ticketType','Task','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','execute','then','length','find','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','No\x20Company','upperFirst','create','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0xe84164,_0x20f8d5){var _0x4f585f=function(_0x27230f){while(--_0x27230f){_0xe84164['push'](_0xe84164['shift']());}};_0x4f585f(++_0x20f8d5);}(_0x600b,0x100));var _0xb600=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x600b[_0x11ca63];return _0x41f1f6;};'use strict';var _=require('lodash');var rp=require(_0xb600('0x0'));var moment=require(_0xb600('0x1'));var BPromise=require(_0xb600('0x2'));var md5=require(_0xb600('0x3'));var jsforce=require('jsforce');var util=require(_0xb600('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xb600('0x5'));var logger=require(_0xb600('0x6'))(_0xb600('0x7'));config[_0xb600('0x8')]=_['defaults'](config[_0xb600('0x8')],{'host':_0xb600('0x9'),'port':0x18eb});var io=require(_0xb600('0xa'))(new Redis(config['redis']));function emit(_0x219a12,_0xf0b3f9,_0xf22dc4){io['to'](_0x219a12)[_0xb600('0xb')](_0xf0b3f9,_0xf22dc4);}function getTicket(_0x3c22dd,_0x358c82,_0x2c8b93,_0x5a50c6,_0x4fb390,_0x178ea7,_0x1dd9cc,_0x567df6){var _0x33b91b=Object['assign']({},{'OwnerId':_0x358c82['id'],'Subject':intUtil[_0xb600('0xc')](_0x5a50c6['Subjects'],_0x4fb390,'\x20'),'Description':intUtil['getString'](_0x5a50c6['Descriptions'],_0x4fb390,'\x0a')},getCustomFields(_0x178ea7,_0x4fb390));if(_0x2c8b93){if(_0x5a50c6[_0xb600('0xd')]===_0xb600('0xe')){_0x33b91b['ActivityDate']=moment[_0xb600('0xf')]();_0x33b91b[_0xb600('0x10')]=![];_0x33b91b['IsRecurrence']=![];if(_0x2c8b93[_0xb600('0x11')]===_0xb600('0x12')||_0x2c8b93[_0xb600('0x11')]===_0xb600('0x13')){_0x33b91b[_0xb600('0x14')]=_0x2c8b93['id'];}else if(_0x2c8b93['endUserType']===_0xb600('0x15')){_0x33b91b[_0xb600('0x16')]=_0x2c8b93['id'];}}else if(_0x5a50c6['ticketType']==='Case'){if(_0x2c8b93[_0xb600('0x11')]===_0xb600('0x12')){_0x33b91b[_0xb600('0x17')]=_0x2c8b93['id'];}else if(_0x2c8b93[_0xb600('0x11')]===_0xb600('0x15')){_0x33b91b[_0xb600('0x18')]=_0x2c8b93['id'];}else if(_0x2c8b93[_0xb600('0x11')]===_0xb600('0x13')&&_0x5a50c6['leadId']){_0x33b91b[_0x5a50c6['leadId']]=_0x2c8b93['id'];}else{logger[_0xb600('0x19')](_0xb600('0x1a'));}}}return _0x1dd9cc[_0xb600('0x1b')](_0x5a50c6['ticketType'])['create'](_0x33b91b);}function getUser(_0x31f14b,_0x4a93a8,_0x4053d2){if(!_[_0xb600('0x1c')](_0x4a93a8)&&intUtil[_0xb600('0x1d')](_0x4a93a8)){var _0x15e314={'Email':_0x4a93a8};var _0x21656d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4053d2[_0xb600('0x1b')](_0xb600('0x1e'))['find'](_0x15e314,_0x21656d)[_0xb600('0x1f')]()[_0xb600('0x20')](function(_0x3e6a8d){if(_0x3e6a8d[_0xb600('0x21')]){var _0x1f77b8=_[_0xb600('0x22')](_0x3e6a8d,function(_0x1e8250){return _0x1e8250[_0xb600('0x23')]===_0x4a93a8;});if(_0x1f77b8){logger[_0xb600('0x19')]('Agent\x20%s\x20found.',_0x4a93a8);return BPromise['resolve']({'id':_0x1f77b8['Id'],'name':_0x1f77b8[_0xb600('0x24')]});}}else{logger[_0xb600('0x19')](_0xb600('0x25'),_0x4a93a8);return _0x4053d2[_0xb600('0x26')]()[_0xb600('0x20')](function(_0x5b7008){return BPromise[_0xb600('0x27')]({'id':_0x5b7008[_0xb600('0x28')],'name':_0x5b7008[_0xb600('0x29')]});});}});}else{logger[_0xb600('0x19')](_0xb600('0x25'),_0x4a93a8);return _0x4053d2[_0xb600('0x26')]()[_0xb600('0x20')](function(_0x526d7e){return BPromise[_0xb600('0x27')]({'id':_0x526d7e[_0xb600('0x28')],'name':_0x526d7e[_0xb600('0x29')]});});}}function getEndUser(_0x15e65a,_0x32c035,_0xe7aae1,_0x5c4b50,_0x4349d4){var _0x32e7bd={'$or':{'Phone':_0x5c4b50}};var _0x2dda59={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb600('0x27')]()[_0xb600('0x20')](function(){logger[_0xb600('0x19')](_0xb600('0x2a'),_0x5c4b50,_0x32c035['moduleSearch']);switch(_0x32c035[_0xb600('0x2b')]){case _0xb600('0x2c'):var _0x3fbb78=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035[_0xb600('0x2e')]){var _0x58e713={};_0x58e713[_0x32c035[_0xb600('0x2e')]]=_0x5c4b50;_['merge'](_0x3fbb78['$or'],_0x58e713);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x2f'))[_0xb600('0x22')](_0x3fbb78,_0x2dda59)[_0xb600('0x1f')]()[_0xb600('0x20')](function(_0xb755){if(_0xb755&&_0xb755[_0xb600('0x21')]){return _0xb755;}else{var _0x42272e=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035[_0xb600('0x30')]){var _0x6d385b={};_0x6d385b[_0x32c035[_0xb600('0x30')]]=_0x5c4b50;_[_0xb600('0x31')](_0x42272e[_0xb600('0x32')],_0x6d385b);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x33'))[_0xb600('0x22')](_0x42272e,_0x2dda59);}});case'account_contact_lead':var _0xe9dfd5=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035[_0xb600('0x34')]){var _0x58e713={};_0x58e713[_0x32c035[_0xb600('0x34')]]=_0x5c4b50;_[_0xb600('0x31')](_0xe9dfd5[_0xb600('0x32')],_0x58e713);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x35'))[_0xb600('0x22')](_0xe9dfd5,_0x2dda59)['execute']()[_0xb600('0x20')](function(_0x2c3e56){if(_0x2c3e56&&_0x2c3e56[_0xb600('0x21')]){return _0x2c3e56;}else{var _0x18458e=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035[_0xb600('0x2e')]){var _0x3fae64={};_0x3fae64[_0x32c035[_0xb600('0x2e')]]=_0x5c4b50;_[_0xb600('0x31')](_0x18458e['$or'],_0x3fae64);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x2f'))[_0xb600('0x22')](_0x18458e,_0x2dda59)['then'](function(_0xa6ac4f){if(_0xa6ac4f&&_0xa6ac4f['length']){return _0xa6ac4f;}else{var _0x988283=_['cloneDeep'](_0x32e7bd);if(_0x32c035['additionalSearchLead']){var _0x4e6143={};_0x4e6143[_0x32c035['additionalSearchLead']]=_0x5c4b50;_[_0xb600('0x31')](_0x988283['$or'],_0x4e6143);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x33'))['find'](_0x988283,_0x2dda59);}});}});case _0xb600('0x12'):var _0x3fbb78=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035[_0xb600('0x2e')]){var _0x58e713={};_0x58e713[_0x32c035[_0xb600('0x2e')]]=_0x5c4b50;_[_0xb600('0x31')](_0x3fbb78['$or'],_0x58e713);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x2f'))['find'](_0x3fbb78,_0x2dda59)['execute']();case _0xb600('0x13'):var _0x5fa3c2=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035['additionalSearchLead']){var _0x58e713={};_0x58e713[_0x32c035[_0xb600('0x30')]]=_0x5c4b50;_[_0xb600('0x31')](_0x5fa3c2[_0xb600('0x32')],_0x58e713);}return _0x4349d4[_0xb600('0x1b')](_0xb600('0x33'))[_0xb600('0x22')](_0x5fa3c2,_0x2dda59);case _0xb600('0x15'):var _0xe9dfd5=_[_0xb600('0x2d')](_0x32e7bd);if(_0x32c035['additionalSearchAccount']){var _0x58e713={};_0x58e713[_0x32c035[_0xb600('0x34')]]=_0x5c4b50;_[_0xb600('0x31')](_0xe9dfd5[_0xb600('0x32')],_0x58e713);}return _0x4349d4[_0xb600('0x1b')]('Account')[_0xb600('0x22')](_0xe9dfd5,_0x2dda59);default:return null;}})['then'](function(_0x518b89){if(_0x518b89&&_0x518b89[_0xb600('0x21')]){var _0x49e28e=_[_0xb600('0x36')](_0x518b89);if(_0x49e28e){return BPromise[_0xb600('0x27')]({'id':_0x49e28e['Id'],'name':_0x49e28e[_0xb600('0x24')],'phone':_0x49e28e[_0xb600('0x37')],'endUserType':_0x49e28e[_0xb600('0x38')]['type'][_0xb600('0x39')]()});}}})[_0xb600('0x20')](function(_0x729442){if(_0x729442){logger[_0xb600('0x19')](_0xb600('0x3a'),_0x729442[_0xb600('0x11')],_0x5c4b50);return BPromise[_0xb600('0x27')](_0x729442);}else{logger['info'](_0xb600('0x3b'),_0x5c4b50);var _0xc95996={'Phone':_0x5c4b50};if(_0x32c035['moduleCreate']){if(_0x32c035[_0xb600('0x3c')]===_0xb600('0x12')){logger['info'](_0xb600('0x3d'),_0x5c4b50,_0x32c035[_0xb600('0x3c')]);_0xc95996[_0xb600('0x3e')]=_0xe7aae1!==''?_0xe7aae1:util[_0xb600('0x3f')]('Caller\x20-\x20%s',_0x5c4b50);}else if(_0x32c035[_0xb600('0x3c')]===_0xb600('0x13')){logger[_0xb600('0x19')](_0xb600('0x3d'),_0x5c4b50,_0x32c035['moduleCreate']);_0xc95996[_0xb600('0x3e')]=_0xe7aae1!==_0xb600('0x40')?_0xe7aae1:util[_0xb600('0x3f')](_0xb600('0x41'),_0x5c4b50);_0xc95996['Company']=_0xb600('0x42');}else if(_0x32c035[_0xb600('0x3c')]===_0xb600('0x15')){logger[_0xb600('0x19')](_0xb600('0x3d'),_0x5c4b50,_0x32c035[_0xb600('0x3c')]);_0xc95996[_0xb600('0x24')]=_0xe7aae1!==''?_0xe7aae1:util['format'](_0xb600('0x41'),_0x5c4b50);}else{return null;}}return _0x4349d4[_0xb600('0x1b')](_[_0xb600('0x43')](_0x32c035[_0xb600('0x3c')]))[_0xb600('0x44')](_0xc95996)['then'](function(_0x415762){return BPromise[_0xb600('0x27')]({'id':_0x415762['id'],'endUserType':_0x32c035['moduleCreate']});});}});}function getCustomFields(_0x91f966,_0x3be473){var _0x44f26c={};if(_0x91f966[_0xb600('0x21')]>0x0){_['forEach'](_0x91f966,function(_0x31256b){if(_['includes']([_0xb600('0x45'),_0xb600('0x46')],_0x31256b['type'])&&_0x31256b[_0xb600('0x47')]){_0x44f26c[_0x31256b['idField']]=_0x31256b[_0xb600('0x48')][_0xb600('0x49')]();}else if(_0x31256b[_0xb600('0x4a')]===_0xb600('0x4b')&&_0x31256b['variableName']&&_0x31256b[_0xb600('0x47')]){_0x3be473[_0x31256b[_0xb600('0x4c')]]&&(_0x44f26c[_0x31256b['idField']]=_0x3be473[_0x31256b[_0xb600('0x4c')]][_0xb600('0x49')]());}else if(_0x31256b[_0xb600('0x4a')]===_0xb600('0x4d')&&_0x31256b[_0xb600('0x4e')]&&_0x31256b[_0xb600('0x4e')][_0xb600('0x4f')]&&_0x31256b[_0xb600('0x47')]){_0x3be473[_0x31256b[_0xb600('0x4e')][_0xb600('0x4f')][_0xb600('0x39')]()]&&(_0x44f26c[_0x31256b['idField']]=_0x3be473[_0x31256b[_0xb600('0x4e')]['name'][_0xb600('0x39')]()][_0xb600('0x49')]());}});}return _0x44f26c;}function getConnection(_0x43d404){var _0x55f911=_0x43d404[_0xb600('0x50')][_0xb600('0x51')](_0x43d404['securityToken']);var _0x340837=new jsforce['Connection']({'oauth2':{'loginUrl':_0x43d404[_0xb600('0x52')]||_0xb600('0x53'),'clientId':_0x43d404[_0xb600('0x54')],'clientSecret':_0x43d404[_0xb600('0x55')]}});return _0x340837[_0xb600('0x56')](_0x43d404[_0xb600('0x57')],_0x55f911)[_0xb600('0x20')](function(){logger[_0xb600('0x19')](_0xb600('0x58'));return _0x340837;});}exports['queue']=function(_0x16381f,_0x2905a6,_0x1a3663,_0x56adeb,_0xfe67c1,_0x54dd27){var _0x587e39,_0xf2479,_0x138308,_0xfd535a;_0x54dd27[_0xb600('0x59')]=intUtil['stripTrailingSlash'](_0x54dd27[_0xb600('0x59')]);_0x54dd27[_0xb600('0x52')]=intUtil['stripTrailingSlash'](_0x54dd27[_0xb600('0x52')]);if(_0xfe67c1&&_0xfe67c1[_0xb600('0x5a')]){logger['info'](_0xb600('0x5b'),'Recording\x20is\x20enabled!');_0x2905a6[_0xb600('0x5c')]=util[_0xb600('0x3f')](_0xb600('0x5d'),_0x54dd27[_0xb600('0x59')],_0x2905a6[_0xb600('0x5e')],md5(_0x2905a6[_0xb600('0x5e')]));}else{_0x2905a6[_0xb600('0x5c')]='';}return getConnection(_0x54dd27)[_0xb600('0x20')](function(_0x136301){_0xfd535a=_0x136301;return getUser(_0x54dd27,_0x56adeb[_0xb600('0x5f')],_0xfd535a);})[_0xb600('0x20')](function(_0x35e35f){_0x587e39=_0x35e35f;return getEndUser(_0x54dd27,_0x1a3663,_0x2905a6['calleridname'],_0x2905a6['calleridnum'],_0xfd535a);})[_0xb600('0x20')](function(_0x23028a){_0xf2479=_0x23028a;return getTicket(_0x54dd27,_0x587e39,_0xf2479,_0x1a3663,_0x2905a6,_0x1a3663[_0xb600('0x60')],_0xfd535a,'queue');})[_0xb600('0x20')](function(_0x37b06f){_0x138308=_0x37b06f;logger['info'](_0xb600('0x61'),_0x138308['id']);logger['info'](_0xb600('0x62'),_0x138308['id'],_0x56adeb['name'],_0x54dd27[_0xb600('0x4a')]);switch(_0x54dd27[_0xb600('0x4a')]){case _0xb600('0x63'):emit(util[_0xb600('0x3f')](_0xb600('0x64'),_0x56adeb[_0xb600('0x4f')]),'trigger:salesforce:display',{'recordId':_0x138308['id']});break;case _0xb600('0x65'):emit(util[_0xb600('0x3f')](_0xb600('0x64'),_0x56adeb[_0xb600('0x4f')]),_0xb600('0x66'),{'uri':util[_0xb600('0x3f')](_0xb600('0x67'),_0xfd535a[_0xb600('0x68')],_0x138308['id'])});break;default:logger[_0xb600('0x69')](_0xb600('0x6a'));}})[_0xb600('0x6b')](function(_0x2625f0){logger[_0xb600('0x69')](_0xb600('0x5b'),_0x2625f0);});};exports[_0xb600('0x6c')]=function(_0x24028f,_0x443150,_0x463f7b,_0x5450a2,_0x2334f2,_0x228b37,_0x47c313){var _0x2af1d8,_0x5e5491,_0x2be05c,_0x559342;_0x228b37[_0xb600('0x59')]=intUtil['stripTrailingSlash'](_0x228b37['serverUrl']);_0x228b37['remoteUri']=intUtil['stripTrailingSlash'](_0x228b37[_0xb600('0x52')]);if(_0x47c313&&_0x47c313[_0xb600('0x6d')]&&_0x47c313['recordingFormat']!=='none'){logger[_0xb600('0x19')](_0xb600('0x6e'),_0xb600('0x6f'));_0x443150['recordingURL']=util[_0xb600('0x3f')](_0xb600('0x5d'),_0x228b37[_0xb600('0x59')],_0x443150[_0xb600('0x5e')],md5(_0x443150[_0xb600('0x5e')]));}return getConnection(_0x228b37)[_0xb600('0x20')](function(_0x427cb1){_0x559342=_0x427cb1;return getUser(_0x228b37,_0x5450a2[_0xb600('0x5f')],_0x559342);})['then'](function(_0xb9b9fa){_0x2af1d8=_0xb9b9fa;return getEndUser(_0x228b37,_0x463f7b,_0x443150[_0xb600('0x70')],_0x443150[_0xb600('0x71')],_0x559342);})[_0xb600('0x20')](function(_0x5a291a){_0x5e5491=_0x5a291a;return getTicket(_0x228b37,_0x2af1d8,_0x5e5491,_0x463f7b,_0x443150,_0x463f7b[_0xb600('0x60')],_0x559342,'outbound');})[_0xb600('0x20')](function(_0x350dff){_0x2be05c=_0x350dff;logger[_0xb600('0x19')](_0xb600('0x72'),_0x2be05c['id']);logger['info'](_0xb600('0x73'),_0x2be05c['id'],_0x5450a2[_0xb600('0x4f')],_0x228b37[_0xb600('0x4a')]);switch(_0x228b37[_0xb600('0x4a')]){case _0xb600('0x63'):emit(util['format'](_0xb600('0x64'),_0x5450a2[_0xb600('0x4f')]),_0xb600('0x74'),{'recordId':_0x2be05c['id']});break;case _0xb600('0x65'):emit(util[_0xb600('0x3f')](_0xb600('0x64'),_0x5450a2[_0xb600('0x4f')]),_0xb600('0x66'),{'uri':util[_0xb600('0x3f')](_0xb600('0x67'),_0x559342[_0xb600('0x68')],_0x2be05c['id'])});break;default:logger[_0xb600('0x69')](_0xb600('0x6e'),_0xb600('0x75'));}})[_0xb600('0x6b')](function(_0x231615){logger['error'](_0xb600('0x6e'),_0x231615);});};exports[_0xb600('0x76')]=function(_0x12923a,_0x1ef91c,_0x1c3250,_0xc08af6,_0x26bfa6,_0x5e1aac){var _0x4be8a8,_0xea3814,_0x38cfd1,_0x520c1d;_0x5e1aac[_0xb600('0x59')]=intUtil[_0xb600('0x77')](_0x5e1aac[_0xb600('0x59')]);_0x5e1aac[_0xb600('0x52')]=intUtil[_0xb600('0x77')](_0x5e1aac[_0xb600('0x52')]);if(_0x26bfa6&&_0x26bfa6[_0xb600('0x5a')]){logger[_0xb600('0x19')]('['+_0x1ef91c[_0xb600('0x78')][_0xb600('0x79')]()+']',_0xb600('0x6f'));_0x1ef91c[_0xb600('0x5c')]=util[_0xb600('0x3f')](_0xb600('0x5d'),_0x5e1aac[_0xb600('0x59')],_0x1ef91c[_0xb600('0x5e')],md5(_0x1ef91c[_0xb600('0x5e')]));}else{_0x1ef91c['recordingURL']='';}return getConnection(_0x5e1aac)[_0xb600('0x20')](function(_0x5b24a0){_0x520c1d=_0x5b24a0;if(!_[_0xb600('0x1c')](_0xc08af6)){return getUser(_0x5e1aac,_0xc08af6['name'],_0x520c1d);}else{return getUser(_0x5e1aac,null,_0x520c1d);}})['then'](function(_0x55ff44){_0x4be8a8=_0x55ff44;return getEndUser(_0x5e1aac,_0x1c3250,_0x1ef91c['calleridname'],_0x1ef91c[_0xb600('0x7a')],_0x520c1d);})[_0xb600('0x20')](function(_0x11a173){_0xea3814=_0x11a173;return getTicket(_0x5e1aac,_0x4be8a8,_0xea3814,_0x1c3250,_0x1ef91c,_0x1c3250[_0xb600('0x60')],_0x520c1d);})[_0xb600('0x20')](function(_0x32f681){_0x38cfd1=_0x32f681;logger['info']('['+_0x1ef91c[_0xb600('0x78')][_0xb600('0x79')]()+_0xb600('0x7b'),_0x38cfd1['id']);logger[_0xb600('0x19')]('['+_0x1ef91c[_0xb600('0x78')]['toUpperCase']()+_0xb600('0x7c'),_0x5e1aac[_0xb600('0x4a')]);})[_0xb600('0x6b')](function(_0xb2cea){logger['error']('['+_0x1ef91c[_0xb600('0x78')][_0xb600('0x79')]()+']',_0xb2cea);});}; \ 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 f527e84..48df836 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 _0x44c4=['forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','Variable','name','incident','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm'];(function(_0x2edfdf,_0x79762){var _0x218970=function(_0x21c256){while(--_0x21c256){_0x2edfdf['push'](_0x2edfdf['shift']());}};_0x218970(++_0x79762);}(_0x44c4,0x117));var _0x444c=function(_0x4c1c05,_0x3d566b){_0x4c1c05=_0x4c1c05-0x0;var _0x3f79ed=_0x44c4[_0x4c1c05];return _0x3f79ed;};'use strict';var _=require(_0x444c('0x0'));var Promise=require(_0x444c('0x1'));var rp=require('request-promise');var util=require(_0x444c('0x2'));var md5=require(_0x444c('0x3'));var Redis=require(_0x444c('0x4'));var intUtil=require(_0x444c('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x444c('0x6')]=_[_0x444c('0x7')](config[_0x444c('0x6')],{'host':_0x444c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x444c('0x6')]));function getAdminUser(_0x3c2b6e,_0x4b23c4,_0x4e70f9,_0x939ffd,_0x5a4b36,_0x34a0b0){return new Promise(function(_0x27a503,_0x3a96a1){var _0x333a05={'method':_0x444c('0x9'),'uri':_0x939ffd+_0x444c('0xa')+'&'+_0x5a4b36+'&'+_0x34a0b0,'auth':_0x4b23c4,'json':!![]};return rp(_0x333a05)[_0x444c('0xb')](function(_0x38da0d){if(_0x38da0d[_0x444c('0xc')][_0x444c('0xd')]>0x0){_0x4e70f9[_0x444c('0xe')]=_0x38da0d[_0x444c('0xc')][0x0][_0x444c('0xf')];}logger[_0x444c('0x10')]('['+[_0x3c2b6e[_0x444c('0x11')]()]+_0x444c('0x12'),_0x4e70f9);_0x27a503(_0x4e70f9);})[_0x444c('0x13')](function(_0x13615e){logger[_0x444c('0x14')]('['+[_0x3c2b6e[_0x444c('0x11')]()]+']',_0x13615e[_0x444c('0x15')]);_0x3a96a1(_0x13615e['message']);});});}function getUser(_0x430e4b,_0x5b73e7,_0x3ab0ea,_0x265c6a,_0x58a505){return function(_0x39a248){logger['info']('['+[_0x430e4b[_0x444c('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x39a248);return new Promise(function(_0x59dc86,_0x37e590){if(intUtil[_0x444c('0x16')](_0x39a248[_0x444c('0x17')])){var _0x22fdb2={'method':'GET','uri':_0x3ab0ea+_0x444c('0x18')+_0x39a248[_0x444c('0x17')]+'&'+_0x265c6a+'&'+_0x58a505,'auth':_0x5b73e7,'json':!![]};logger[_0x444c('0x10')]('['+[_0x430e4b[_0x444c('0x11')]()]+_0x444c('0x19'),_0x22fdb2);return rp(_0x22fdb2)['then'](function(_0x226e64){logger[_0x444c('0x10')]('['+[_0x430e4b['toUpperCase']()]+'],\x20getUser\x20entity',_0x226e64);if(_0x226e64[_0x444c('0xc')][_0x444c('0xd')]>0x0&&String(_0x226e64[_0x444c('0xc')][0x0][_0x444c('0x1a')])===_0x444c('0x1b')){_0x39a248[_0x444c('0x1c')]=_0x226e64[_0x444c('0xc')][0x0]['sys_id'];}else{_0x39a248[_0x444c('0x1c')]=_0x39a248[_0x444c('0xe')];_0x39a248['userEmail']=_0x39a248[_0x444c('0x1d')];}logger[_0x444c('0x10')]('['+[_0x430e4b[_0x444c('0x11')]()]+_0x444c('0x1e'),_0x39a248);_0x59dc86(_0x39a248);})[_0x444c('0x13')](function(_0x3f3f2e){logger['error']('['+[_0x430e4b['toUpperCase']()]+']',_0x3f3f2e[_0x444c('0x15')]);_0x37e590(_0x3f3f2e[_0x444c('0x15')]);});}else{logger['info']('['+[_0x430e4b['toUpperCase']()]+_0x444c('0x1f'));_0x39a248['userId']=_0x39a248[_0x444c('0xe')];_0x39a248[_0x444c('0x17')]=_0x39a248['adminEmail'];_0x59dc86(_0x39a248);}});};}function createEndUser(_0x58b997,_0x37b4f6,_0x406766,_0x36857c,_0x59edb9){logger[_0x444c('0x10')]('['+[_0x58b997['toUpperCase']()]+_0x444c('0x20'),_0x406766);return new Promise(function(_0x431c35,_0x2db70a){var _0x9e21a9={'method':_0x444c('0x21'),'uri':_0x36857c+_0x444c('0x22')+_0x59edb9,'body':{'user_name':_0x406766['endUserNumber'],'roles':_0x444c('0x23'),'first_name':_0x406766[_0x444c('0x24')],'active':_0x444c('0x1b'),'date_format':_0x444c('0x25'),'phone':_0x406766['endUserNumber']},'auth':_0x37b4f6,'json':!![]};return rp(_0x9e21a9)[_0x444c('0xb')](function(_0x15ef90){logger[_0x444c('0x10')]('['+[_0x58b997[_0x444c('0x11')]()]+_0x444c('0x26'),_0x15ef90['result']);_0x406766[_0x444c('0x27')]=_0x15ef90[_0x444c('0xc')][_0x444c('0xf')];_0x431c35(_0x406766);})[_0x444c('0x13')](function(_0x54c194){logger[_0x444c('0x14')]('['+[_0x58b997[_0x444c('0x11')]()]+']',_0x54c194['message']);_0x2db70a(_0x54c194[_0x444c('0x15')]);});});}function getEndUser(_0x3f7130,_0x4c07f7,_0x2036ac,_0x51f797,_0x29de72){return function(_0x35a3d1){logger[_0x444c('0x10')]('['+[_0x3f7130[_0x444c('0x11')]()]+_0x444c('0x28'),_0x35a3d1);return new Promise(function(_0x557b11,_0x407bf3){var _0x4875f6={'method':_0x444c('0x9'),'uri':_0x2036ac+'sys_user?sysparm_query=phone%3D'+_0x35a3d1[_0x444c('0x24')]+'&'+_0x51f797+'&'+_0x29de72,'auth':_0x4c07f7,'json':!![]};return rp(_0x4875f6)['then'](function(_0x2ce19b){if(_0x2ce19b['result'][_0x444c('0xd')]>0x0){_0x35a3d1[_0x444c('0x27')]=_0x2ce19b[_0x444c('0xc')][0x0][_0x444c('0xf')];logger[_0x444c('0x10')]('['+[_0x3f7130[_0x444c('0x11')]()]+'],\x20getEndUser\x20crm',_0x35a3d1);_0x557b11(_0x35a3d1);}else{return createEndUser(_0x3f7130,_0x4c07f7,_0x35a3d1,_0x2036ac,_0x51f797)[_0x444c('0xb')](function(_0x25fe38){logger[_0x444c('0x10')]('['+[_0x3f7130[_0x444c('0x11')]()]+_0x444c('0x29'),_0x25fe38);_0x557b11(_0x25fe38);});}})[_0x444c('0x13')](function(_0x398730){logger[_0x444c('0x14')]('['+[_0x3f7130[_0x444c('0x11')]()]+']',_0x398730[_0x444c('0x15')]);_0x407bf3(_0x398730['message']);});});};}function getCustomFields(_0x156703,_0x1aa041){var _0xf8a15f={};if(_0x156703['length']>0x0){_[_0x444c('0x2a')](_0x156703,function(_0xc7154f){if(_[_0x444c('0x2b')]([_0x444c('0x2c'),_0x444c('0x2d')],_0xc7154f[_0x444c('0x2e')])&&_0xc7154f['nameField']&&!_0xc7154f[_0x444c('0x2f')]){_0xf8a15f[_0xc7154f[_0x444c('0x30')][_0x444c('0x31')]()]=_0xc7154f[_0x444c('0x32')][_0x444c('0x33')]();}else if(_[_0x444c('0x2b')](['string',_0x444c('0x2d')],_0xc7154f[_0x444c('0x2e')])&&_0xc7154f[_0x444c('0x34')]&&_0xc7154f[_0x444c('0x2f')]){_0xf8a15f[_0xc7154f['idField'][_0x444c('0x31')]()]=_0xc7154f['content'][_0x444c('0x33')]();}else if(_0xc7154f[_0x444c('0x2e')]===_0x444c('0x35')&&_0xc7154f[_0x444c('0x36')]&&_0xc7154f['idField']&&_0xc7154f['customField']){_0xf8a15f[_0xc7154f[_0x444c('0x34')][_0x444c('0x31')]()]=_0x1aa041[_0xc7154f[_0x444c('0x36')]][_0x444c('0x33')]();}else if(_0xc7154f[_0x444c('0x2e')]==='customVariable'&&_0xc7154f['Variable']&&_0xc7154f[_0x444c('0x37')][_0x444c('0x38')]&&_0xc7154f[_0x444c('0x34')]&&_0xc7154f[_0x444c('0x2f')]){_0xf8a15f[_0xc7154f[_0x444c('0x34')]['toLowerCase']()]=_0x1aa041[_0xc7154f['Variable'][_0x444c('0x38')][_0x444c('0x31')]()][_0x444c('0x33')]();}});}return _0xf8a15f;}function getTicket(_0x20a41a,_0x46b185,_0xc028ab,_0x21f222,_0x2e214f,_0x5ce186){return function(_0x181063){logger[_0x444c('0x10')]('['+[_0x20a41a[_0x444c('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x181063);return new Promise(function(_0x127b85,_0x139b40){var _0x52d73c=_0x20a41a[_0x444c('0x31')]()==='outbound'?_0x181063[_0x444c('0x1c')]:_0x181063[_0x444c('0x27')];var _0x1400f1={'method':_0x444c('0x21'),'uri':_0xc028ab+_0x444c('0x39')+'?'+_0x5ce186,'body':Object['assign']({},{'active':_0x444c('0x1b'),'caller_id':_0x52d73c,'assigned_to':_0x181063[_0x444c('0x1c')],'short_description':intUtil['getString'](_0x21f222[_0x444c('0x3a')],_0x2e214f,'\x20'),'description':intUtil[_0x444c('0x3b')](_0x21f222[_0x444c('0x3c')],_0x2e214f,'\x0a')},getCustomFields(_0x21f222['Fields'],_0x2e214f)),'auth':_0x46b185,'json':!![]};return rp(_0x1400f1)[_0x444c('0xb')](function(_0x15aa47){logger[_0x444c('0x10')]('['+[_0x20a41a[_0x444c('0x11')]()]+_0x444c('0x3d'),_0x15aa47[_0x444c('0xc')]);_0x181063[_0x444c('0x3e')]=_0x15aa47[_0x444c('0xc')][_0x444c('0xf')];_0x181063['ticketNumber']=_0x15aa47[_0x444c('0xc')][_0x444c('0x3f')];logger['info']('['+[_0x20a41a['toUpperCase']()]+']\x20getTicket\x20crm',_0x181063);_0x127b85(_0x181063);})[_0x444c('0x13')](function(_0x5c4594){logger[_0x444c('0x14')]('['+[_0x20a41a[_0x444c('0x11')]()]+']',_0x5c4594[_0x444c('0x15')]);_0x139b40(_0x5c4594['message']);});});};}function createRemoteTag(_0x16f273,_0x40471d,_0x4058b3,_0x73cd91){return new Promise(function(_0x3c57ea,_0x86d033){var _0x139f57={'method':'POST','uri':_0x4058b3+'label'+'?'+_0x73cd91,'body':{'short_description':_0x16f273,'global':!![],'active':!![],'name':_0x16f273},'auth':_0x40471d,'json':!![]};return rp(_0x139f57)[_0x444c('0xb')](function(_0x176545){var _0x58cdef=_0x176545[_0x444c('0xc')][_0x444c('0xf')];_0x3c57ea(_0x58cdef);});});}function getRemoteTag(_0x1b8a87,_0x4a71d7,_0x237d1f,_0xd35700,_0x3a3506){return new Promise(function(_0x592b41,_0x3aa9a3){var _0x5a467f={'method':_0x444c('0x9'),'uri':_0x237d1f+_0x444c('0x40')+_0x444c('0x41')+_0x1b8a87+'&'+_0xd35700,'auth':_0x4a71d7,'json':!![]};return rp(_0x5a467f)['then'](function(_0x39bc64){if(_0x39bc64[_0x444c('0xc')][_0x444c('0xd')]>0x0){var _0xcc5441=_0x39bc64[_0x444c('0xc')][0x0][_0x444c('0xf')];_0x592b41(_0xcc5441);}else{return createRemoteTag(_0x1b8a87,_0x4a71d7,_0x237d1f,_0xd35700)[_0x444c('0xb')](function(_0x40591e){_0x592b41(_0x40591e);});}});});}function assignTagToIncident(_0x1485a0,_0x45c947,_0xd0a074,_0xb2d26b,_0x5a9af7){return new Promise(function(_0x4a3698,_0x484105){var _0x2fcf9e={'method':'POST','uri':_0xd0a074+_0x444c('0x42')+'?'+_0x5a9af7,'body':{'label':_0x1485a0,'table':_0x444c('0x39'),'id_type':_0x444c('0x43'),'table_key':_0xb2d26b['ticketId'],'title':'Incident\x20-\x20'+_0xb2d26b[_0x444c('0x44')],'id_display':_0xb2d26b[_0x444c('0x44')]},'auth':_0x45c947,'json':!![]};return rp(_0x2fcf9e)[_0x444c('0xb')](function(_0xa407b8){_0x4a3698();})[_0x444c('0x13')](function(){_0x4a3698();});});}function manageTags(_0x104bf6,_0x40a1ba,_0x33c427,_0x3baf92,_0x373819,_0x3a82b6,_0x214d7e){return new Promise(function(_0x31ae7f,_0x5ab0e9){var _0x16ca9f=[];_0x40a1ba[_0x444c('0x2a')](function(_0xd7b3f3){_0x16ca9f[_0x444c('0x45')](getRemoteTag(_0xd7b3f3,_0x33c427,_0x3baf92,_0x3a82b6,_0x214d7e));});return Promise[_0x444c('0x46')](_0x16ca9f)['then'](function(_0x5e7460){if(_0x5e7460[_0x444c('0xd')]){logger['info']('['+[_0x104bf6[_0x444c('0x11')]()]+_0x444c('0x47'),_0x5e7460);var _0x426cbc=[];_0x5e7460['forEach'](function(_0x582b50){_0x426cbc['push'](assignTagToIncident(_0x582b50,_0x33c427,_0x3baf92,_0x373819,_0x3a82b6));});return Promise['all'](_0x426cbc)['then'](function(){_0x31ae7f();})['catch'](function(){_0x31ae7f();});}else{_0x31ae7f();}});});}function getTags(_0x3c8eac,_0x18bbff,_0x4f49d6,_0x375772,_0x3dfa3b,_0x2033b6){return function(_0x417f19){return new Promise(function(_0x3a412a,_0x15b88e){var _0x562d17=[];var _0x716ab7=_0x375772['Tags'];if(_0x716ab7&&_0x716ab7[_0x444c('0xd')]>0x0){_0x562d17=_[_0x444c('0x48')](_0x716ab7,_0x444c('0x38'));}if(_0x562d17['length']>0x0){return manageTags(_0x3c8eac,_0x562d17,_0x18bbff,_0x4f49d6,_0x417f19,_0x3dfa3b,_0x2033b6)['then'](function(){_0x3a412a(_0x417f19);});}else{_0x3a412a(_0x417f19);}});};}function emit(_0x283d6e,_0x1c1708,_0x5e966e){var _0x1997ef=_0x444c('0x49')+_0x444c('0x4a')+_0x444c('0x4b')+_0x444c('0x4c');var _0x5ae89b={'uri':_0x283d6e+_0x444c('0x4d')+_0x5e966e+_0x1997ef};io['to'](util[_0x444c('0x4e')](_0x444c('0x4f'),_0x1c1708))[_0x444c('0x50')]('trigger:browser:url',_0x5ae89b);}exports['cs']=function(_0x45227d,_0x545697,_0x2290fd,_0x441351,_0x2508a8,_0x28a483,_0x5721b6,_0x27d874){var _0x158813={};var _0x109d4a={'user':_0x28a483[_0x444c('0x51')],'pass':_0x28a483[_0x444c('0x52')]};var _0x1a66a5=_0x444c('0x53');var _0x1f7b3e=_0x444c('0x54');_0x28a483[_0x444c('0x55')]=intUtil[_0x444c('0x56')](_0x28a483[_0x444c('0x55')]);_0x28a483[_0x444c('0x57')]=intUtil[_0x444c('0x56')](_0x28a483[_0x444c('0x57')]);var _0x473995=util[_0x444c('0x4e')](_0x444c('0x58'),_0x28a483[_0x444c('0x55')]);_0x158813[_0x444c('0x17')]=!_[_0x444c('0x59')](_0x441351)?_0x441351[_0x444c('0x5a')]:null;_0x158813[_0x444c('0x1d')]=_0x28a483[_0x444c('0x5a')];_0x158813[_0x444c('0x24')]=_0x27d874[_0x444c('0x31')]()==='outbound'?_0x545697['destcalleridnum']:_0x545697[_0x444c('0x5b')];_0x158813[_0x444c('0x5c')]=_0x27d874===_0x444c('0x5d')||_0x27d874===_0x444c('0x5e')?_0x444c('0x5d'):'outbound';var _0x11a4d8=util['format'](_0x444c('0x5f'),_0x28a483[_0x444c('0x57')],_0x545697['uniqueid'],md5(_0x545697[_0x444c('0x60')]));if(_0x2508a8&&_0x2508a8[_0x444c('0x61')]){logger[_0x444c('0x10')](_0x444c('0x62'),_0x444c('0x63'));_0x545697[_0x444c('0x64')]=_0x11a4d8;}else if(_0x5721b6&&_0x5721b6[_0x444c('0x65')]&&_0x5721b6[_0x444c('0x65')]!=='none'){logger[_0x444c('0x10')](_0x444c('0x66'),'Recording\x20is\x20enabled!');_0x545697['recordingURL']=_0x11a4d8;}else{_0x545697[_0x444c('0x64')]='';}return getAdminUser(_0x27d874,_0x109d4a,_0x158813,_0x473995,_0x1f7b3e,_0x1a66a5)[_0x444c('0xb')](getUser(_0x27d874,_0x109d4a,_0x473995,_0x1f7b3e,_0x1a66a5))[_0x444c('0xb')](getEndUser(_0x27d874,_0x109d4a,_0x473995,_0x1f7b3e,_0x1a66a5))['then'](getTicket(_0x27d874,_0x109d4a,_0x473995,_0x2290fd,_0x545697,_0x1f7b3e))[_0x444c('0xb')](function(_0x2a557f){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2a557f[_0x444c('0x3e')]));logger[_0x444c('0x10')](util[_0x444c('0x4e')](_0x444c('0x67'),_0x27d874));if(_0x27d874!==_0x444c('0x5e')){logger[_0x444c('0x10')]('['+[_0x27d874[_0x444c('0x11')]()]+']',_0x444c('0x68'));emit(_0x28a483[_0x444c('0x55')],_0x441351[_0x444c('0x38')],_0x2a557f[_0x444c('0x3e')]);}})['catch'](function(_0x308763){logger['error']('['+[_0x27d874[_0x444c('0x11')]()]+_0x444c('0x69'),util[_0x444c('0x6a')](_0x308763,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7231=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','string','picklist','nameField','customField','toLowerCase','content','toString','includes','type','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','POST','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x375093,_0x3a4528){var _0x55a67e=function(_0x1a033c){while(--_0x1a033c){_0x375093['push'](_0x375093['shift']());}};_0x55a67e(++_0x3a4528);}(_0x7231,0xe2));var _0x1723=function(_0x1adf4f,_0x2e1204){_0x1adf4f=_0x1adf4f-0x0;var _0x45a764=_0x7231[_0x1adf4f];return _0x45a764;};'use strict';var _=require(_0x1723('0x0'));var Promise=require(_0x1723('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x1723('0x2'));var Redis=require(_0x1723('0x3'));var intUtil=require(_0x1723('0x4'));var config=require(_0x1723('0x5'));var logger=require(_0x1723('0x6'))('servicenow');config['redis']=_['defaults'](config[_0x1723('0x7')],{'host':_0x1723('0x8'),'port':0x18eb});var io=require(_0x1723('0x9'))(new Redis(config[_0x1723('0x7')]));function getAdminUser(_0x4e2a82,_0xdcc2c0,_0x5c985e,_0x5840c5,_0x14565c,_0x4a42ce){return new Promise(function(_0x14172b,_0x58146b){var _0x10f6d6={'method':_0x1723('0xa'),'uri':_0x5840c5+_0x1723('0xb')+'&'+_0x14565c+'&'+_0x4a42ce,'auth':_0xdcc2c0,'json':!![]};return rp(_0x10f6d6)[_0x1723('0xc')](function(_0x4a2dc3){if(_0x4a2dc3[_0x1723('0xd')]['length']>0x0){_0x5c985e[_0x1723('0xe')]=_0x4a2dc3['result'][0x0]['sys_id'];}logger[_0x1723('0xf')]('['+[_0x4e2a82['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x5c985e);_0x14172b(_0x5c985e);})[_0x1723('0x10')](function(_0x459483){logger[_0x1723('0x11')]('['+[_0x4e2a82[_0x1723('0x12')]()]+']',_0x459483[_0x1723('0x13')]);_0x58146b(_0x459483[_0x1723('0x13')]);});});}function getUser(_0x239a45,_0x3deef0,_0x434223,_0x1f2414,_0x118fb1){return function(_0x151eec){logger['info']('['+[_0x239a45[_0x1723('0x12')]()]+_0x1723('0x14'),_0x151eec);return new Promise(function(_0x15c99c,_0x1f9481){if(intUtil[_0x1723('0x15')](_0x151eec[_0x1723('0x16')])){var _0x20c213={'method':_0x1723('0xa'),'uri':_0x434223+_0x1723('0x17')+_0x151eec[_0x1723('0x16')]+'&'+_0x1f2414+'&'+_0x118fb1,'auth':_0x3deef0,'json':!![]};logger['info']('['+[_0x239a45[_0x1723('0x12')]()]+_0x1723('0x18'),_0x20c213);return rp(_0x20c213)[_0x1723('0xc')](function(_0x8340db){logger[_0x1723('0xf')]('['+[_0x239a45[_0x1723('0x12')]()]+_0x1723('0x19'),_0x8340db);if(_0x8340db[_0x1723('0xd')][_0x1723('0x1a')]>0x0&&String(_0x8340db['result'][0x0][_0x1723('0x1b')])===_0x1723('0x1c')){_0x151eec[_0x1723('0x1d')]=_0x8340db['result'][0x0][_0x1723('0x1e')];}else{_0x151eec[_0x1723('0x1d')]=_0x151eec['adminId'];_0x151eec[_0x1723('0x16')]=_0x151eec[_0x1723('0x1f')];}logger[_0x1723('0xf')]('['+[_0x239a45[_0x1723('0x12')]()]+_0x1723('0x20'),_0x151eec);_0x15c99c(_0x151eec);})[_0x1723('0x10')](function(_0x3ffe57){logger['error']('['+[_0x239a45['toUpperCase']()]+']',_0x3ffe57[_0x1723('0x13')]);_0x1f9481(_0x3ffe57['message']);});}else{logger['info']('['+[_0x239a45[_0x1723('0x12')]()]+']\x20using\x20admin\x20profile');_0x151eec[_0x1723('0x1d')]=_0x151eec['adminId'];_0x151eec['userEmail']=_0x151eec[_0x1723('0x1f')];_0x15c99c(_0x151eec);}});};}function createEndUser(_0x8971eb,_0x37a42f,_0x534dae,_0x221045,_0x4622ed){logger['info']('['+[_0x8971eb[_0x1723('0x12')]()]+_0x1723('0x21'),_0x534dae);return new Promise(function(_0x6b8769,_0x157973){var _0x137df7={'method':'POST','uri':_0x221045+_0x1723('0x22')+_0x4622ed,'body':{'user_name':_0x534dae['endUserNumber'],'roles':_0x1723('0x23'),'first_name':_0x534dae['endUserNumber'],'active':_0x1723('0x1c'),'date_format':_0x1723('0x24'),'phone':_0x534dae[_0x1723('0x25')]},'auth':_0x37a42f,'json':!![]};return rp(_0x137df7)[_0x1723('0xc')](function(_0x3ca3c4){logger[_0x1723('0xf')]('['+[_0x8971eb[_0x1723('0x12')]()]+_0x1723('0x26'),_0x3ca3c4['result']);_0x534dae[_0x1723('0x27')]=_0x3ca3c4[_0x1723('0xd')][_0x1723('0x1e')];_0x6b8769(_0x534dae);})[_0x1723('0x10')](function(_0x3e9ddc){logger[_0x1723('0x11')]('['+[_0x8971eb[_0x1723('0x12')]()]+']',_0x3e9ddc[_0x1723('0x13')]);_0x157973(_0x3e9ddc[_0x1723('0x13')]);});});}function getEndUser(_0x567975,_0x2904fa,_0x46d7f5,_0x520984,_0x2b584a){return function(_0x4ce84c){logger['info']('['+[_0x567975[_0x1723('0x12')]()]+_0x1723('0x28'),_0x4ce84c);return new Promise(function(_0x2769ea,_0x39e92b){var _0xe758aa={'method':_0x1723('0xa'),'uri':_0x46d7f5+_0x1723('0x29')+_0x4ce84c[_0x1723('0x25')]+'&'+_0x520984+'&'+_0x2b584a,'auth':_0x2904fa,'json':!![]};return rp(_0xe758aa)[_0x1723('0xc')](function(_0x533267){if(_0x533267[_0x1723('0xd')][_0x1723('0x1a')]>0x0){_0x4ce84c['endUserId']=_0x533267['result'][0x0][_0x1723('0x1e')];logger['info']('['+[_0x567975['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x4ce84c);_0x2769ea(_0x4ce84c);}else{return createEndUser(_0x567975,_0x2904fa,_0x4ce84c,_0x46d7f5,_0x520984)[_0x1723('0xc')](function(_0x3f9dc1){logger[_0x1723('0xf')]('['+[_0x567975[_0x1723('0x12')]()]+_0x1723('0x2a'),_0x3f9dc1);_0x2769ea(_0x3f9dc1);});}})[_0x1723('0x10')](function(_0x1d9918){logger[_0x1723('0x11')]('['+[_0x567975['toUpperCase']()]+']',_0x1d9918['message']);_0x39e92b(_0x1d9918[_0x1723('0x13')]);});});};}function getCustomFields(_0x373183,_0x4555f9){var _0xec6548={};if(_0x373183['length']>0x0){_[_0x1723('0x2b')](_0x373183,function(_0x41eca3){if(_['includes']([_0x1723('0x2c'),_0x1723('0x2d')],_0x41eca3['type'])&&_0x41eca3[_0x1723('0x2e')]&&!_0x41eca3[_0x1723('0x2f')]){_0xec6548[_0x41eca3[_0x1723('0x2e')][_0x1723('0x30')]()]=_0x41eca3[_0x1723('0x31')][_0x1723('0x32')]();}else if(_[_0x1723('0x33')]([_0x1723('0x2c'),_0x1723('0x2d')],_0x41eca3[_0x1723('0x34')])&&_0x41eca3[_0x1723('0x35')]&&_0x41eca3[_0x1723('0x2f')]){_0xec6548[_0x41eca3[_0x1723('0x35')][_0x1723('0x30')]()]=_0x41eca3[_0x1723('0x31')]['toString']();}else if(_0x41eca3['type']===_0x1723('0x36')&&_0x41eca3[_0x1723('0x37')]&&_0x41eca3[_0x1723('0x35')]&&_0x41eca3[_0x1723('0x2f')]){_0xec6548[_0x41eca3['idField'][_0x1723('0x30')]()]=_0x4555f9[_0x41eca3[_0x1723('0x37')]][_0x1723('0x32')]();}else if(_0x41eca3[_0x1723('0x34')]===_0x1723('0x38')&&_0x41eca3['Variable']&&_0x41eca3[_0x1723('0x39')][_0x1723('0x3a')]&&_0x41eca3['idField']&&_0x41eca3[_0x1723('0x2f')]){_0xec6548[_0x41eca3[_0x1723('0x35')]['toLowerCase']()]=_0x4555f9[_0x41eca3['Variable']['name'][_0x1723('0x30')]()][_0x1723('0x32')]();}});}return _0xec6548;}function getTicket(_0x180554,_0x1be9a6,_0x492bbf,_0x596911,_0x3ebe74,_0x1eef14){return function(_0x6645ee){logger[_0x1723('0xf')]('['+[_0x180554[_0x1723('0x12')]()]+_0x1723('0x3b'),_0x6645ee);return new Promise(function(_0x164645,_0x436eda){var _0x3e60d3=_0x180554['toLowerCase']()==='outbound'?_0x6645ee[_0x1723('0x1d')]:_0x6645ee[_0x1723('0x27')];var _0x285541={'method':'POST','uri':_0x492bbf+'incident'+'?'+_0x1eef14,'body':Object[_0x1723('0x3c')]({},{'active':'true','caller_id':_0x3e60d3,'assigned_to':_0x6645ee[_0x1723('0x1d')],'short_description':intUtil[_0x1723('0x3d')](_0x596911['Subjects'],_0x3ebe74,'\x20'),'description':intUtil[_0x1723('0x3d')](_0x596911[_0x1723('0x3e')],_0x3ebe74,'\x0a')},getCustomFields(_0x596911['Fields'],_0x3ebe74)),'auth':_0x1be9a6,'json':!![]};return rp(_0x285541)[_0x1723('0xc')](function(_0x7c8b97){logger['info']('['+[_0x180554[_0x1723('0x12')]()]+_0x1723('0x3f'),_0x7c8b97[_0x1723('0xd')]);_0x6645ee[_0x1723('0x40')]=_0x7c8b97[_0x1723('0xd')]['sys_id'];_0x6645ee[_0x1723('0x41')]=_0x7c8b97[_0x1723('0xd')]['number'];logger[_0x1723('0xf')]('['+[_0x180554[_0x1723('0x12')]()]+']\x20getTicket\x20crm',_0x6645ee);_0x164645(_0x6645ee);})['catch'](function(_0x333a88){logger[_0x1723('0x11')]('['+[_0x180554['toUpperCase']()]+']',_0x333a88[_0x1723('0x13')]);_0x436eda(_0x333a88['message']);});});};}function createRemoteTag(_0x40df4b,_0x80a02f,_0x532247,_0x21fc1a){return new Promise(function(_0x2ac02f,_0xbd4d0){var _0x4d6754={'method':'POST','uri':_0x532247+_0x1723('0x42')+'?'+_0x21fc1a,'body':{'short_description':_0x40df4b,'global':!![],'active':!![],'name':_0x40df4b},'auth':_0x80a02f,'json':!![]};return rp(_0x4d6754)[_0x1723('0xc')](function(_0x5e1271){var _0x20d410=_0x5e1271[_0x1723('0xd')]['sys_id'];_0x2ac02f(_0x20d410);});});}function getRemoteTag(_0x1652e0,_0x3edab4,_0x5249fd,_0x33e83e,_0x5c71c8){return new Promise(function(_0x4f7eaa,_0x77e12){var _0x4ce435={'method':_0x1723('0xa'),'uri':_0x5249fd+_0x1723('0x42')+'?sysparm_query=name%3D'+_0x1652e0+'&'+_0x33e83e,'auth':_0x3edab4,'json':!![]};return rp(_0x4ce435)[_0x1723('0xc')](function(_0x2d45e5){if(_0x2d45e5[_0x1723('0xd')][_0x1723('0x1a')]>0x0){var _0x3551dd=_0x2d45e5[_0x1723('0xd')][0x0][_0x1723('0x1e')];_0x4f7eaa(_0x3551dd);}else{return createRemoteTag(_0x1652e0,_0x3edab4,_0x5249fd,_0x33e83e)[_0x1723('0xc')](function(_0x269db7){_0x4f7eaa(_0x269db7);});}});});}function assignTagToIncident(_0x161816,_0x3806a1,_0x3ad6dd,_0x350a64,_0x274872){return new Promise(function(_0x48abfb,_0x21df8c){var _0x5a6ae={'method':_0x1723('0x43'),'uri':_0x3ad6dd+_0x1723('0x44')+'?'+_0x274872,'body':{'label':_0x161816,'table':'incident','id_type':'Incident','table_key':_0x350a64[_0x1723('0x40')],'title':'Incident\x20-\x20'+_0x350a64[_0x1723('0x41')],'id_display':_0x350a64[_0x1723('0x41')]},'auth':_0x3806a1,'json':!![]};return rp(_0x5a6ae)[_0x1723('0xc')](function(_0x59a59e){_0x48abfb();})[_0x1723('0x10')](function(){_0x48abfb();});});}function manageTags(_0x455a7b,_0x140147,_0x8530ea,_0xa611a0,_0x3af79f,_0x22ee53,_0x5c9699){return new Promise(function(_0x38af1a,_0x4e958a){var _0x260dd0=[];_0x140147[_0x1723('0x2b')](function(_0x359c1c){_0x260dd0[_0x1723('0x45')](getRemoteTag(_0x359c1c,_0x8530ea,_0xa611a0,_0x22ee53,_0x5c9699));});return Promise[_0x1723('0x46')](_0x260dd0)[_0x1723('0xc')](function(_0x55500a){if(_0x55500a[_0x1723('0x1a')]){logger[_0x1723('0xf')]('['+[_0x455a7b[_0x1723('0x12')]()]+_0x1723('0x47'),_0x55500a);var _0x329982=[];_0x55500a[_0x1723('0x2b')](function(_0x295f7d){_0x329982['push'](assignTagToIncident(_0x295f7d,_0x8530ea,_0xa611a0,_0x3af79f,_0x22ee53));});return Promise[_0x1723('0x46')](_0x329982)[_0x1723('0xc')](function(){_0x38af1a();})[_0x1723('0x10')](function(){_0x38af1a();});}else{_0x38af1a();}});});}function getTags(_0x54b212,_0x3f8716,_0x5953f7,_0x3b8c59,_0x4f4120,_0x445f2b){return function(_0x3eb830){return new Promise(function(_0x162f9a,_0x58f3c5){var _0x45084c=[];var _0x20dbee=_0x3b8c59[_0x1723('0x48')];if(_0x20dbee&&_0x20dbee['length']>0x0){_0x45084c=_[_0x1723('0x49')](_0x20dbee,_0x1723('0x3a'));}if(_0x45084c[_0x1723('0x1a')]>0x0){return manageTags(_0x54b212,_0x45084c,_0x3f8716,_0x5953f7,_0x3eb830,_0x4f4120,_0x445f2b)['then'](function(){_0x162f9a(_0x3eb830);});}else{_0x162f9a(_0x3eb830);}});};}function emit(_0x4bf6b6,_0x3c59a1,_0x32d446){var _0x2e6ec4=_0x1723('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x1723('0x4b')+'%255EORDERBYDESCnumber';var _0x2dbb93={'uri':_0x4bf6b6+_0x1723('0x4c')+_0x32d446+_0x2e6ec4};io['to'](util[_0x1723('0x4d')](_0x1723('0x4e'),_0x3c59a1))[_0x1723('0x4f')](_0x1723('0x50'),_0x2dbb93);}exports['cs']=function(_0x1a32e9,_0x59cc5b,_0x17ee7f,_0x360edc,_0x11387f,_0x1d41b9,_0x4ea776,_0xdeeed2){var _0x12b1e6={};var _0x2db6cd={'user':_0x1d41b9[_0x1723('0x51')],'pass':_0x1d41b9[_0x1723('0x52')]};var _0x4db445=_0x1723('0x53');var _0xff0c83=_0x1723('0x54');_0x1d41b9[_0x1723('0x55')]=intUtil['stripTrailingSlash'](_0x1d41b9[_0x1723('0x55')]);_0x1d41b9['serverUrl']=intUtil[_0x1723('0x56')](_0x1d41b9[_0x1723('0x57')]);var _0x131c4f=util[_0x1723('0x4d')](_0x1723('0x58'),_0x1d41b9[_0x1723('0x55')]);_0x12b1e6[_0x1723('0x16')]=!_[_0x1723('0x59')](_0x360edc)?_0x360edc[_0x1723('0x5a')]:null;_0x12b1e6[_0x1723('0x1f')]=_0x1d41b9[_0x1723('0x5a')];_0x12b1e6[_0x1723('0x25')]=_0xdeeed2['toLowerCase']()==='outbound'?_0x59cc5b[_0x1723('0x5b')]:_0x59cc5b[_0x1723('0x5c')];_0x12b1e6['callDirection']=_0xdeeed2===_0x1723('0x5d')||_0xdeeed2===_0x1723('0x5e')?_0x1723('0x5d'):_0x1723('0x5f');var _0x514fad=util[_0x1723('0x4d')](_0x1723('0x60'),_0x1d41b9['serverUrl'],_0x59cc5b['uniqueid'],md5(_0x59cc5b[_0x1723('0x61')]));if(_0x11387f&&_0x11387f[_0x1723('0x62')]){logger[_0x1723('0xf')](_0x1723('0x63'),_0x1723('0x64'));_0x59cc5b[_0x1723('0x65')]=_0x514fad;}else if(_0x4ea776&&_0x4ea776[_0x1723('0x66')]&&_0x4ea776[_0x1723('0x66')]!=='none'){logger[_0x1723('0xf')](_0x1723('0x67'),_0x1723('0x64'));_0x59cc5b['recordingURL']=_0x514fad;}else{_0x59cc5b[_0x1723('0x65')]='';}return getAdminUser(_0xdeeed2,_0x2db6cd,_0x12b1e6,_0x131c4f,_0xff0c83,_0x4db445)[_0x1723('0xc')](getUser(_0xdeeed2,_0x2db6cd,_0x131c4f,_0xff0c83,_0x4db445))[_0x1723('0xc')](getEndUser(_0xdeeed2,_0x2db6cd,_0x131c4f,_0xff0c83,_0x4db445))[_0x1723('0xc')](getTicket(_0xdeeed2,_0x2db6cd,_0x131c4f,_0x17ee7f,_0x59cc5b,_0xff0c83))[_0x1723('0xc')](function(_0x39bd24){logger['info'](util[_0x1723('0x4d')](_0x1723('0x68'),_0x39bd24[_0x1723('0x40')]));logger['info'](util[_0x1723('0x4d')](_0x1723('0x69'),_0xdeeed2));if(_0xdeeed2!==_0x1723('0x5e')){logger[_0x1723('0xf')]('['+[_0xdeeed2[_0x1723('0x12')]()]+']',_0x1723('0x6a'));emit(_0x1d41b9['remoteUri'],_0x360edc['name'],_0x39bd24[_0x1723('0x40')]);}})[_0x1723('0x10')](function(_0x53e958){logger['error']('['+[_0xdeeed2['toUpperCase']()]+_0x1723('0x6b'),util['inspect'](_0x53e958,{'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 10d3942..570a9eb 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 _0x4b12=['Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase','isNil','calleridname','lodash','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString'];(function(_0xc43b00,_0x1c1d6d){var _0x3eafa7=function(_0x52e8ec){while(--_0x52e8ec){_0xc43b00['push'](_0xc43b00['shift']());}};_0x3eafa7(++_0x1c1d6d);}(_0x4b12,0x1ce));var _0x24b1=function(_0x21cecc,_0x2a16fa){_0x21cecc=_0x21cecc-0x0;var _0x3f6702=_0x4b12[_0x21cecc];return _0x3f6702;};'use strict';var _=require(_0x24b1('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x24b1('0x1'));var Redis=require(_0x24b1('0x2'));var intUtil=require(_0x24b1('0x3'));var config=require(_0x24b1('0x4'));var logger=require('../../../../config/logger')(_0x24b1('0x5'));config[_0x24b1('0x6')]=_['defaults'](config[_0x24b1('0x6')],{'host':_0x24b1('0x7'),'port':0x18eb});var io=require(_0x24b1('0x8'))(new Redis(config[_0x24b1('0x6')]));var def={'method':_0x24b1('0x9'),'json':!![]};function emit(_0x311848,_0x12c4b0,_0x5be541){io['to'](_0x311848)[_0x24b1('0xa')](_0x12c4b0,_0x5be541);}function getTicket(_0x163c42,_0x1ac80a,_0x550374,_0x3cd248,_0x510bc0,_0x1e37c9,_0x20725f,_0x15fccd){logger['info'](_0x24b1('0xb'));var _0x2e9f32=new Date();var _0x183fb0=[{'name':_0x24b1('0xc'),'value':intUtil[_0x24b1('0xd')](_0x3cd248[_0x24b1('0xe')],_0x510bc0,'\x20')},{'name':_0x24b1('0xf'),'value':_0x1ac80a['id']},{'name':_0x24b1('0x10'),'value':_0x1ac80a['id']},{'name':_0x24b1('0x11'),'value':intUtil[_0x24b1('0xd')](_0x3cd248['Descriptions'],_0x510bc0,'\x0a')},{'name':_0x24b1('0x12'),'value':_0x2e9f32[_0x24b1('0x13')]()[_0x24b1('0x14')](0x0,0x13)[_0x24b1('0x15')]('T','\x20')},{'name':_0x24b1('0x16'),'value':'0'},{'name':_0x24b1('0x17'),'value':'15'},{'name':'parent_id','value':_0x550374['id']},{'name':_0x24b1('0x18'),'value':_0x24b1('0x19')},{'name':_0x24b1('0x1a'),'value':_0x550374[_0x24b1('0xc')]},{'name':'direction','value':_0x15fccd}];if(_0x1e37c9[_0x24b1('0x1b')]){_[_0x24b1('0x1c')](_0x1e37c9,function(_0x2337a9){if(_0x510bc0[_0x2337a9[_0x24b1('0x1d')]]){_0x183fb0[_0x24b1('0x1e')]({'name':_0x2337a9['idField'],'value':_0x510bc0[_0x2337a9[_0x24b1('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x24b1('0x1f'),'response_type':_0x24b1('0x1f'),'rest_data':JSON[_0x24b1('0x20')]({'session':_0x20725f['id'],'module_name':_0x24b1('0x21'),'name_value_list':_0x183fb0})}});}function getAuth(_0x40b223){return util[_0x24b1('0x22')](_0x24b1('0x23'),new Buffer(_0x40b223[_0x24b1('0x24')]+':X')[_0x24b1('0x25')](_0x24b1('0x26')));}function getServerInfo(_0x51c3d3){return request({'form':{'method':'get_server_info','input_type':_0x24b1('0x1f'),'response_type':_0x24b1('0x1f'),'rest_data':JSON[_0x24b1('0x20')]({'session':_0x51c3d3['id']})}});}function getUser(_0x530c8d,_0x5343de,_0x318597){if(!_['isNil'](_0x5343de)){logger[_0x24b1('0x27')](_0x24b1('0x28'),_0x5343de);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x24b1('0x1f'),'rest_data':JSON['stringify']({'session':_0x318597['id'],'module_name':_0x24b1('0x29'),'query':util[_0x24b1('0x22')](_0x24b1('0x2a'),_0x5343de),'order_by':'','offset':'0','select_fields':['id',_0x24b1('0xc'),_0x24b1('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x24b1('0x2c')](function(_0x332625){if(_0x332625[_0x24b1('0x2d')]['length']){var _0xfb635f=_[_0x24b1('0x2e')](_0x332625[_0x24b1('0x2d')],function(_0xc7a27b){return _0xc7a27b[_0x24b1('0x2f')][_0x24b1('0x2b')][_0x24b1('0x30')]===_0x5343de;});if(_0xfb635f){logger[_0x24b1('0x27')](_0x24b1('0x31'));return BPromise[_0x24b1('0x32')]({'id':_0xfb635f[_0x24b1('0x2f')]['id']['value'],'name':_0xfb635f['name_value_list']['name']['value']});}}logger[_0x24b1('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x318597[_0x24b1('0x2f')]['user_id']['value'],'name':_0x318597[_0x24b1('0x2f')][_0x24b1('0x2b')]['value']});});}else{logger[_0x24b1('0x27')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x24b1('0x32')]({'id':_0x318597[_0x24b1('0x2f')][_0x24b1('0x33')][_0x24b1('0x30')],'name':_0x318597['name_value_list'][_0x24b1('0x2b')][_0x24b1('0x30')]});}}function getEndUser(_0x20b2e3,_0x29ec10,_0x3dd04e,_0x222462){logger['info'](_0x24b1('0x34'),_0x3dd04e);return request({'form':{'method':_0x24b1('0x35'),'input_type':'JSON','response_type':_0x24b1('0x1f'),'rest_data':JSON['stringify']({'session':_0x222462['id'],'module_name':'Contacts','query':util[_0x24b1('0x22')](_0x24b1('0x36'),_0x3dd04e),'order_by':'','offset':'0','select_fields':['id',_0x24b1('0xc'),_0x24b1('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x24b1('0x2c')](function(_0x1f440f){if(_0x1f440f[_0x24b1('0x2d')][_0x24b1('0x1b')]){var _0x37aed8=_[_0x24b1('0x2e')](_0x1f440f[_0x24b1('0x2d')],function(_0x26faec){return _0x26faec['name_value_list'][_0x24b1('0x37')][_0x24b1('0x30')]===_0x3dd04e;});if(_0x37aed8){logger[_0x24b1('0x27')]('Enduser\x20found!');return BPromise[_0x24b1('0x32')]({'id':_0x37aed8[_0x24b1('0x2f')]['id']['value'],'name':_0x37aed8['name_value_list'][_0x24b1('0xc')][_0x24b1('0x30')],'phone':_0x37aed8[_0x24b1('0x2f')][_0x24b1('0x37')][_0x24b1('0x30')]});}}else{logger[_0x24b1('0x27')](_0x24b1('0x38'));return request({'form':{'method':_0x24b1('0x39'),'input_type':_0x24b1('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x222462['id'],'module_name':_0x24b1('0x19'),'name_value_list':[{'name':_0x24b1('0x3a'),'value':_0x29ec10!==_0x24b1('0x3b')?_0x29ec10:util['format'](_0x24b1('0x3c'),_0x3dd04e)},{'name':_0x24b1('0x37'),'value':_0x3dd04e}]})}})[_0x24b1('0x2c')](function(_0x131df5){logger[_0x24b1('0x27')]('Enduser\x20created.');return BPromise[_0x24b1('0x32')]({'id':_0x131df5['id'],'name':_0x131df5[_0x24b1('0x2d')][_0x24b1('0x3a')]['value'],'phone':_0x131df5[_0x24b1('0x2d')][_0x24b1('0x37')]['value']});});}});}function request(_0x4ed249){logger[_0x24b1('0x3d')](_0x24b1('0x3e'),JSON[_0x24b1('0x20')](_0x4ed249));return rp(_[_0x24b1('0x3f')](def,_0x4ed249));}function getTags(_0x44abbc,_0x169fa7){var _0x38b1e8=[];if(_0x44abbc&&_0x44abbc[_0x24b1('0x1b')]>0x0){_0x38b1e8=_['map'](_0x44abbc,_0x169fa7);}return _0x38b1e8;}function getCustomFields(_0x4afdc8,_0x153c55){var _0xd74ef8=[];var _0x45aa56={'custom_fields':[]};if(_0x4afdc8[_0x24b1('0x1b')]>0x0){_[_0x24b1('0x1c')](_0x4afdc8,function(_0x5a0d21){if(_0x5a0d21[_0x24b1('0x40')]===_0x24b1('0x41')&&_0x5a0d21['nameField']&&!_0x5a0d21[_0x24b1('0x42')]){_0x45aa56[_0x5a0d21[_0x24b1('0x43')][_0x24b1('0x44')]()]=_0x5a0d21[_0x24b1('0x45')][_0x24b1('0x25')]();}else if(_0x5a0d21[_0x24b1('0x40')]===_0x24b1('0x41')&&_0x5a0d21[_0x24b1('0x46')]&&_0x5a0d21[_0x24b1('0x42')]){_0x45aa56[_0x24b1('0x47')][_0x24b1('0x1e')]({'id':_0x5a0d21['idField'],'value':_0x5a0d21[_0x24b1('0x45')][_0x24b1('0x25')]()});}else if(_0x5a0d21[_0x24b1('0x40')]===_0x24b1('0x48')&&_0x5a0d21[_0x24b1('0x1d')]&&_0x5a0d21['idField']&&_0x5a0d21[_0x24b1('0x42')]){_0x153c55[_0x5a0d21['variableName']]&&_0x45aa56[_0x24b1('0x47')][_0x24b1('0x1e')]({'id':_0x5a0d21['idField'],'value':_0x153c55[_0x5a0d21[_0x24b1('0x1d')]]['toString']()});}else if(_0x5a0d21[_0x24b1('0x40')]===_0x24b1('0x49')&&_0x5a0d21[_0x24b1('0x4a')]&&_0x5a0d21[_0x24b1('0x4a')][_0x24b1('0xc')]&&_0x5a0d21[_0x24b1('0x46')]&&_0x5a0d21[_0x24b1('0x42')]){_0x153c55[_0x5a0d21['Variable']['name'][_0x24b1('0x44')]()]&&_0x45aa56[_0x24b1('0x47')][_0x24b1('0x1e')]({'id':_0x5a0d21[_0x24b1('0x46')],'value':_0x153c55[_0x5a0d21[_0x24b1('0x4a')]['name'][_0x24b1('0x44')]()][_0x24b1('0x25')]()});}});}return _0x45aa56;}function getConnection(_0x41a182){return request({'method':_0x24b1('0x9'),'form':{'method':'login','input_type':_0x24b1('0x1f'),'response_type':'JSON','rest_data':JSON[_0x24b1('0x20')]({'user_auth':{'user_name':_0x41a182['username'],'password':_0x41a182['password'],'encryption':_0x24b1('0x4b')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x24b1('0x2c')](function(_0xc01746){var _0x25ce69=_0xc01746;if(_0x25ce69['id']){def[_0x24b1('0x4c')]=_0x25ce69['id'];return BPromise['resolve'](_0x25ce69);}else{throw new Error(util[_0x24b1('0x22')](_0x24b1('0x4d'),_0x41a182['id']));}});}function setRelationship(_0x17e883,_0x1f2b24,_0x47c532,_0x26db0c){return request({'form':{'method':_0x24b1('0x4e'),'input_type':_0x24b1('0x1f'),'response_type':_0x24b1('0x1f'),'rest_data':JSON[_0x24b1('0x20')]({'session':_0x17e883['id'],'module_name':_0x24b1('0x21'),'module_id':_0x47c532['id'],'link_field_name':_0x26db0c,'related_ids':[_0x1f2b24['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x24b1('0x4f')]=function(_0x1fc576,_0x288890,_0x40afae,_0x45f889,_0x1febbd,_0x1fb78a){var _0x3797d1,_0x3c7bc7,_0x2dd5bf,_0x28b6c6;_0x1fb78a[_0x24b1('0x50')]=intUtil[_0x24b1('0x51')](_0x1fb78a[_0x24b1('0x50')]);_0x1fb78a['serverUrl']=intUtil[_0x24b1('0x51')](_0x1fb78a['serverUrl']);def[_0x24b1('0x52')]=util['format'](_0x24b1('0x53'),_0x1fb78a['remoteUri']);if(_0x1febbd&&_0x1febbd['monitor_format']){logger[_0x24b1('0x27')](_0x24b1('0x54'),_0x24b1('0x55'));_0x288890[_0x24b1('0x56')]=util[_0x24b1('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fb78a[_0x24b1('0x57')],_0x288890[_0x24b1('0x58')],md5(_0x288890[_0x24b1('0x58')]));}else{_0x288890[_0x24b1('0x56')]='';}return getConnection(_0x1fb78a)[_0x24b1('0x2c')](function(_0x3e0e4a){_0x28b6c6=_0x3e0e4a;return getUser(_0x1fb78a,_0x45f889[_0x24b1('0xc')],_0x28b6c6);})[_0x24b1('0x2c')](function(_0x21b61e){_0x3797d1=_0x21b61e;logger[_0x24b1('0x27')](_0x24b1('0x59'),_0x3797d1['id']);return getEndUser(_0x1fb78a,_0x288890['calleridname'],_0x288890[_0x24b1('0x5a')],_0x28b6c6);})[_0x24b1('0x2c')](function(_0x3e0370){_0x3c7bc7=_0x3e0370;logger[_0x24b1('0x27')](_0x24b1('0x5b'),_0x3c7bc7['id']);return getTicket(_0x1fb78a,_0x3797d1,_0x3c7bc7,_0x40afae,_0x288890,_0x40afae[_0x24b1('0x5c')],_0x28b6c6,_0x24b1('0x5d'));})[_0x24b1('0x2c')](function(_0x199875){_0x2dd5bf=_0x199875;logger[_0x24b1('0x27')](_0x24b1('0x5e'));logger[_0x24b1('0x27')](_0x24b1('0x5f'),_0x2dd5bf['id']);return setRelationship(_0x28b6c6,_0x3797d1,_0x2dd5bf,_0x24b1('0x60'));})[_0x24b1('0x2c')](function(){return setRelationship(_0x28b6c6,_0x3c7bc7,_0x2dd5bf,_0x24b1('0x61'));})[_0x24b1('0x2c')](function(){return getServerInfo(_0x28b6c6);})[_0x24b1('0x2c')](function(_0x2ddba6){var _0x23b01a=parseInt(_0x2ddba6[_0x24b1('0x62')][_0x24b1('0x63')](0x0));var _0x2e7dfd=util[_0x24b1('0x22')](_0x24b1('0x64'),_0x1fb78a[_0x24b1('0x50')],_0x2dd5bf['id']);if(_0x23b01a>0x6){_0x2e7dfd=util['format'](_0x24b1('0x65'),_0x1fb78a['remoteUri'],_0x2dd5bf['id']);}logger[_0x24b1('0x27')](_0x24b1('0x54'),_0x24b1('0x66'));emit(util[_0x24b1('0x22')](_0x24b1('0x67'),_0x45f889[_0x24b1('0xc')]),_0x24b1('0x68'),{'uri':_0x2e7dfd});})['catch'](function(_0x2f5b08){logger[_0x24b1('0x69')]('[QUEUE]',JSON['stringify'](_0x2f5b08));});};exports[_0x24b1('0x6a')]=function(_0x1b13d2,_0x5e7e87,_0x3550c1,_0x5c6d6e,_0x21d93c,_0x595e2c,_0x55c75d){var _0x464fff,_0x549c78,_0x25f7c7,_0x28b313;_0x595e2c[_0x24b1('0x50')]=intUtil[_0x24b1('0x51')](_0x595e2c[_0x24b1('0x50')]);_0x595e2c[_0x24b1('0x57')]=intUtil[_0x24b1('0x51')](_0x595e2c[_0x24b1('0x57')]);def['uri']=util['format'](_0x24b1('0x53'),_0x595e2c['remoteUri']);if(_0x55c75d&&_0x55c75d['recordingFormat']&&_0x55c75d['recordingFormat']!==_0x24b1('0x6b')){logger[_0x24b1('0x27')]('[OUTBOUND]',_0x24b1('0x55'));_0x5e7e87[_0x24b1('0x56')]=util['format'](_0x24b1('0x6c'),_0x595e2c[_0x24b1('0x57')],_0x5e7e87[_0x24b1('0x58')],md5(_0x5e7e87['uniqueid']));}return getConnection(_0x595e2c)['then'](function(_0x3ad979){_0x28b313=_0x3ad979;return getUser(_0x595e2c,_0x5c6d6e['name'],_0x28b313);})[_0x24b1('0x2c')](function(_0xd0344c){_0x464fff=_0xd0344c;logger[_0x24b1('0x27')]('The\x20User\x20ID\x20is:',_0x464fff['id']);return getEndUser(_0x595e2c,_0x5e7e87[_0x24b1('0x6d')],_0x5e7e87[_0x24b1('0x6e')],_0x28b313);})[_0x24b1('0x2c')](function(_0x4456db){_0x549c78=_0x4456db;logger[_0x24b1('0x27')](_0x24b1('0x5b'),_0x549c78['id']);return getTicket(_0x595e2c,_0x464fff,_0x549c78,_0x3550c1,_0x5e7e87,_0x3550c1[_0x24b1('0x5c')],_0x28b313,_0x24b1('0x6f'));})['then'](function(_0x1f1990){_0x25f7c7=_0x1f1990;logger[_0x24b1('0x27')](_0x24b1('0x5e'));logger[_0x24b1('0x27')]('The\x20Ticket\x20ID\x20is:',_0x25f7c7['id']);return setRelationship(_0x28b313,_0x464fff,_0x25f7c7,'users');})['then'](function(){return setRelationship(_0x28b313,_0x549c78,_0x25f7c7,_0x24b1('0x61'));})['then'](function(){return getServerInfo(_0x28b313);})[_0x24b1('0x2c')](function(_0x262b5b){var _0x535208=parseInt(_0x262b5b[_0x24b1('0x62')][_0x24b1('0x63')](0x0));var _0x2c57e4=util[_0x24b1('0x22')](_0x24b1('0x64'),_0x595e2c['remoteUri'],_0x25f7c7['id']);if(_0x535208>0x6){_0x2c57e4=util[_0x24b1('0x22')](_0x24b1('0x65'),_0x595e2c[_0x24b1('0x50')],_0x25f7c7['id']);}logger[_0x24b1('0x27')](_0x24b1('0x70'),_0x24b1('0x66'));emit(util[_0x24b1('0x22')](_0x24b1('0x67'),_0x5c6d6e[_0x24b1('0xc')]),_0x24b1('0x68'),{'uri':_0x2c57e4});})[_0x24b1('0x71')](function(_0x11ef97){logger[_0x24b1('0x69')]('[OUTBOUND]',JSON[_0x24b1('0x20')](_0x11ef97));});};exports[_0x24b1('0x72')]=function(_0xcd133b,_0x16c8ab,_0x423340,_0x53c091,_0xb93859,_0x1ddd3c){var _0x292dd5,_0x1f71c9,_0x3fb94f,_0x52bb82;_0x1ddd3c[_0x24b1('0x50')]=intUtil[_0x24b1('0x51')](_0x1ddd3c[_0x24b1('0x50')]);_0x1ddd3c[_0x24b1('0x57')]=intUtil[_0x24b1('0x51')](_0x1ddd3c[_0x24b1('0x57')]);def[_0x24b1('0x52')]=util[_0x24b1('0x22')](_0x24b1('0x53'),_0x1ddd3c[_0x24b1('0x50')]);if(_0xb93859&&_0xb93859['monitor_format']){logger[_0x24b1('0x27')]('['+_0x16c8ab[_0x24b1('0x73')][_0x24b1('0x74')]()+']',_0x24b1('0x55'));_0x16c8ab['recordingURL']=util[_0x24b1('0x22')](_0x24b1('0x6c'),_0x1ddd3c['serverUrl'],_0x16c8ab[_0x24b1('0x58')],md5(_0x16c8ab[_0x24b1('0x58')]));}else{_0x16c8ab['recordingURL']='';}return getConnection(_0x1ddd3c)[_0x24b1('0x2c')](function(_0x4be03f){_0x52bb82=_0x4be03f;if(!_[_0x24b1('0x75')](_0x53c091)){return getUser(_0x1ddd3c,_0x53c091['name'],_0x52bb82);}else{return getUser(_0x1ddd3c,null,_0x52bb82);}})[_0x24b1('0x2c')](function(_0x13f5d2){_0x292dd5=_0x13f5d2;logger[_0x24b1('0x27')](_0x24b1('0x59'),_0x292dd5['id']);return getEndUser(_0x1ddd3c,_0x16c8ab[_0x24b1('0x76')],_0x16c8ab['calleridnum'],_0x52bb82);})[_0x24b1('0x2c')](function(_0x3223e8){_0x1f71c9=_0x3223e8;logger[_0x24b1('0x27')](_0x24b1('0x5b'),_0x1f71c9['id']);return getTicket(_0x1ddd3c,_0x292dd5,_0x1f71c9,_0x423340,_0x16c8ab,_0x423340[_0x24b1('0x5c')],_0x52bb82,'Inbound');})[_0x24b1('0x2c')](function(_0x86e16f){_0x3fb94f=_0x86e16f;logger['info']('Ticket\x20created!');logger[_0x24b1('0x27')](_0x24b1('0x5f'),_0x3fb94f['id']);return setRelationship(_0x52bb82,_0x292dd5,_0x3fb94f,_0x24b1('0x60'));})[_0x24b1('0x2c')](function(){return setRelationship(_0x52bb82,_0x1f71c9,_0x3fb94f,_0x24b1('0x61'));})[_0x24b1('0x2c')](function(){return getServerInfo(_0x52bb82);})[_0x24b1('0x71')](function(_0x59a67c){logger[_0x24b1('0x69')]('['+_0x16c8ab['lastevent'][_0x24b1('0x74')]()+']',JSON['stringify'](_0x59a67c));});}; \ No newline at end of file +var _0xf49e=['Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','customField','nameField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','lodash','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0xf49e,0x13b));var _0xef49=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf49e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xef49('0x0'));var rp=require('request-promise');var BPromise=require(_0xef49('0x1'));var md5=require(_0xef49('0x2'));var util=require(_0xef49('0x3'));var Redis=require('ioredis');var intUtil=require(_0xef49('0x4'));var config=require(_0xef49('0x5'));var logger=require('../../../../config/logger')(_0xef49('0x6'));config[_0xef49('0x7')]=_[_0xef49('0x8')](config[_0xef49('0x7')],{'host':_0xef49('0x9'),'port':0x18eb});var io=require(_0xef49('0xa'))(new Redis(config[_0xef49('0x7')]));var def={'method':_0xef49('0xb'),'json':!![]};function emit(_0x33c148,_0x129583,_0x369fd1){io['to'](_0x33c148)[_0xef49('0xc')](_0x129583,_0x369fd1);}function getTicket(_0x43bcd7,_0x271f38,_0x25bb19,_0x2d5190,_0x4496d0,_0x3b3f91,_0x148e79,_0x2ada54){logger[_0xef49('0xd')](_0xef49('0xe'));var _0x2e1664=new Date();var _0x58e363=[{'name':_0xef49('0xf'),'value':intUtil[_0xef49('0x10')](_0x2d5190[_0xef49('0x11')],_0x4496d0,'\x20')},{'name':_0xef49('0x12'),'value':_0x271f38['id']},{'name':_0xef49('0x13'),'value':_0x271f38['id']},{'name':_0xef49('0x14'),'value':intUtil[_0xef49('0x10')](_0x2d5190[_0xef49('0x15')],_0x4496d0,'\x0a')},{'name':_0xef49('0x16'),'value':_0x2e1664[_0xef49('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xef49('0x18'),'value':'0'},{'name':_0xef49('0x19'),'value':'15'},{'name':_0xef49('0x1a'),'value':_0x25bb19['id']},{'name':_0xef49('0x1b'),'value':_0xef49('0x1c')},{'name':'parent_name','value':_0x25bb19[_0xef49('0xf')]},{'name':'direction','value':_0x2ada54}];if(_0x3b3f91[_0xef49('0x1d')]){_[_0xef49('0x1e')](_0x3b3f91,function(_0x2220da){if(_0x4496d0[_0x2220da[_0xef49('0x1f')]]){_0x58e363[_0xef49('0x20')]({'name':_0x2220da[_0xef49('0x21')],'value':_0x4496d0[_0x2220da[_0xef49('0x1f')]]});}});}return request({'form':{'method':_0xef49('0x22'),'input_type':_0xef49('0x23'),'response_type':'JSON','rest_data':JSON[_0xef49('0x24')]({'session':_0x148e79['id'],'module_name':_0xef49('0x25'),'name_value_list':_0x58e363})}});}function getAuth(_0x3a4ac7){return util[_0xef49('0x26')]('Basic\x20%s',new Buffer(_0x3a4ac7[_0xef49('0x27')]+':X')[_0xef49('0x28')](_0xef49('0x29')));}function getServerInfo(_0x670c0d){return request({'form':{'method':_0xef49('0x2a'),'input_type':_0xef49('0x23'),'response_type':_0xef49('0x23'),'rest_data':JSON[_0xef49('0x24')]({'session':_0x670c0d['id']})}});}function getUser(_0xb3a4d0,_0x3c7da2,_0x5ba675){if(!_[_0xef49('0x2b')](_0x3c7da2)){logger[_0xef49('0xd')](_0xef49('0x2c'),_0x3c7da2);return request({'form':{'method':_0xef49('0x2d'),'input_type':'JSON','response_type':_0xef49('0x23'),'rest_data':JSON[_0xef49('0x24')]({'session':_0x5ba675['id'],'module_name':_0xef49('0x2e'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3c7da2),'order_by':'','offset':'0','select_fields':['id','name',_0xef49('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xef49('0x30')](function(_0x3b8faf){if(_0x3b8faf[_0xef49('0x31')]['length']){var _0x827265=_[_0xef49('0x32')](_0x3b8faf[_0xef49('0x31')],function(_0x56a9b2){return _0x56a9b2['name_value_list'][_0xef49('0x2f')]['value']===_0x3c7da2;});if(_0x827265){logger[_0xef49('0xd')](_0xef49('0x33'));return BPromise[_0xef49('0x34')]({'id':_0x827265[_0xef49('0x35')]['id'][_0xef49('0x36')],'name':_0x827265['name_value_list'][_0xef49('0xf')][_0xef49('0x36')]});}}logger[_0xef49('0xd')](_0xef49('0x37'));return BPromise[_0xef49('0x34')]({'id':_0x5ba675[_0xef49('0x35')][_0xef49('0x38')][_0xef49('0x36')],'name':_0x5ba675[_0xef49('0x35')][_0xef49('0x2f')]['value']});});}else{logger[_0xef49('0xd')](_0xef49('0x39'));return BPromise['resolve']({'id':_0x5ba675['name_value_list'][_0xef49('0x38')][_0xef49('0x36')],'name':_0x5ba675['name_value_list'][_0xef49('0x2f')]['value']});}}function getEndUser(_0x147871,_0xfa9117,_0x42685f,_0x46c8af){logger[_0xef49('0xd')](_0xef49('0x3a'),_0x42685f);return request({'form':{'method':_0xef49('0x2d'),'input_type':_0xef49('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x46c8af['id'],'module_name':_0xef49('0x1c'),'query':util['format'](_0xef49('0x3b'),_0x42685f),'order_by':'','offset':'0','select_fields':['id',_0xef49('0xf'),_0xef49('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x578710){if(_0x578710[_0xef49('0x31')][_0xef49('0x1d')]){var _0x5cfbcb=_[_0xef49('0x32')](_0x578710[_0xef49('0x31')],function(_0x2273a0){return _0x2273a0[_0xef49('0x35')]['phone_home'][_0xef49('0x36')]===_0x42685f;});if(_0x5cfbcb){logger[_0xef49('0xd')](_0xef49('0x3d'));return BPromise[_0xef49('0x34')]({'id':_0x5cfbcb[_0xef49('0x35')]['id']['value'],'name':_0x5cfbcb[_0xef49('0x35')][_0xef49('0xf')][_0xef49('0x36')],'phone':_0x5cfbcb[_0xef49('0x35')][_0xef49('0x3c')][_0xef49('0x36')]});}}else{logger[_0xef49('0xd')](_0xef49('0x3e'));return request({'form':{'method':'set_entry','input_type':_0xef49('0x23'),'response_type':_0xef49('0x23'),'rest_data':JSON[_0xef49('0x24')]({'session':_0x46c8af['id'],'module_name':'Contacts','name_value_list':[{'name':_0xef49('0x3f'),'value':_0xfa9117!==_0xef49('0x40')?_0xfa9117:util['format'](_0xef49('0x41'),_0x42685f)},{'name':_0xef49('0x3c'),'value':_0x42685f}]})}})[_0xef49('0x30')](function(_0x283440){logger[_0xef49('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x283440['id'],'name':_0x283440['entry_list'][_0xef49('0x3f')][_0xef49('0x36')],'phone':_0x283440['entry_list'][_0xef49('0x3c')][_0xef49('0x36')]});});}});}function request(_0x1842c3){logger[_0xef49('0x42')](_0xef49('0x43'),JSON[_0xef49('0x24')](_0x1842c3));return rp(_['merge'](def,_0x1842c3));}function getTags(_0x3de8ad,_0x1700dc){var _0x4d6a15=[];if(_0x3de8ad&&_0x3de8ad[_0xef49('0x1d')]>0x0){_0x4d6a15=_[_0xef49('0x44')](_0x3de8ad,_0x1700dc);}return _0x4d6a15;}function getCustomFields(_0x27d4aa,_0x34655e){var _0x7da783=[];var _0x5bbb6a={'custom_fields':[]};if(_0x27d4aa[_0xef49('0x1d')]>0x0){_[_0xef49('0x1e')](_0x27d4aa,function(_0x569e70){if(_0x569e70[_0xef49('0x45')]===_0xef49('0x46')&&_0x569e70['nameField']&&!_0x569e70[_0xef49('0x47')]){_0x5bbb6a[_0x569e70[_0xef49('0x48')][_0xef49('0x49')]()]=_0x569e70[_0xef49('0x4a')][_0xef49('0x28')]();}else if(_0x569e70[_0xef49('0x45')]===_0xef49('0x46')&&_0x569e70['idField']&&_0x569e70['customField']){_0x5bbb6a[_0xef49('0x4b')]['push']({'id':_0x569e70[_0xef49('0x21')],'value':_0x569e70[_0xef49('0x4a')][_0xef49('0x28')]()});}else if(_0x569e70[_0xef49('0x45')]==='variable'&&_0x569e70[_0xef49('0x1f')]&&_0x569e70[_0xef49('0x21')]&&_0x569e70['customField']){_0x34655e[_0x569e70[_0xef49('0x1f')]]&&_0x5bbb6a[_0xef49('0x4b')][_0xef49('0x20')]({'id':_0x569e70[_0xef49('0x21')],'value':_0x34655e[_0x569e70[_0xef49('0x1f')]][_0xef49('0x28')]()});}else if(_0x569e70[_0xef49('0x45')]===_0xef49('0x4c')&&_0x569e70[_0xef49('0x4d')]&&_0x569e70['Variable'][_0xef49('0xf')]&&_0x569e70['idField']&&_0x569e70[_0xef49('0x47')]){_0x34655e[_0x569e70[_0xef49('0x4d')]['name'][_0xef49('0x49')]()]&&_0x5bbb6a[_0xef49('0x4b')]['push']({'id':_0x569e70[_0xef49('0x21')],'value':_0x34655e[_0x569e70[_0xef49('0x4d')]['name']['toLowerCase']()][_0xef49('0x28')]()});}});}return _0x5bbb6a;}function getConnection(_0x4571b0){return request({'method':'POST','form':{'method':_0xef49('0x4e'),'input_type':_0xef49('0x23'),'response_type':_0xef49('0x23'),'rest_data':JSON[_0xef49('0x24')]({'user_auth':{'user_name':_0x4571b0[_0xef49('0x4f')],'password':_0x4571b0['password'],'encryption':_0xef49('0x50')},'application':_0xef49('0x51')})}})['then'](function(_0x1adac0){var _0x1ce356=_0x1adac0;if(_0x1ce356['id']){def[_0xef49('0x52')]=_0x1ce356['id'];return BPromise[_0xef49('0x34')](_0x1ce356);}else{throw new Error(util['format'](_0xef49('0x53'),_0x4571b0['id']));}});}function setRelationship(_0x2922e3,_0x49885c,_0x95288e,_0xbf65c4){return request({'form':{'method':_0xef49('0x54'),'input_type':_0xef49('0x23'),'response_type':_0xef49('0x23'),'rest_data':JSON[_0xef49('0x24')]({'session':_0x2922e3['id'],'module_name':_0xef49('0x25'),'module_id':_0x95288e['id'],'link_field_name':_0xbf65c4,'related_ids':[_0x49885c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xef49('0x55')]=function(_0x38db87,_0x531dfe,_0x380b55,_0x426ae9,_0x31aa43,_0x2ce9d7){var _0x59ef03,_0x3c74d8,_0x3d074f,_0x1a279a;_0x2ce9d7[_0xef49('0x56')]=intUtil['stripTrailingSlash'](_0x2ce9d7[_0xef49('0x56')]);_0x2ce9d7[_0xef49('0x57')]=intUtil['stripTrailingSlash'](_0x2ce9d7[_0xef49('0x57')]);def[_0xef49('0x58')]=util[_0xef49('0x26')]('%s/service/v4_1/rest.php',_0x2ce9d7[_0xef49('0x56')]);if(_0x31aa43&&_0x31aa43[_0xef49('0x59')]){logger[_0xef49('0xd')](_0xef49('0x5a'),_0xef49('0x5b'));_0x531dfe['recordingURL']=util[_0xef49('0x26')](_0xef49('0x5c'),_0x2ce9d7[_0xef49('0x57')],_0x531dfe['uniqueid'],md5(_0x531dfe[_0xef49('0x5d')]));}else{_0x531dfe[_0xef49('0x5e')]='';}return getConnection(_0x2ce9d7)[_0xef49('0x30')](function(_0x16c9d4){_0x1a279a=_0x16c9d4;return getUser(_0x2ce9d7,_0x426ae9['name'],_0x1a279a);})[_0xef49('0x30')](function(_0x2c4c44){_0x59ef03=_0x2c4c44;logger['info']('The\x20User\x20ID\x20is:',_0x59ef03['id']);return getEndUser(_0x2ce9d7,_0x531dfe[_0xef49('0x5f')],_0x531dfe[_0xef49('0x60')],_0x1a279a);})['then'](function(_0x277948){_0x3c74d8=_0x277948;logger['info'](_0xef49('0x61'),_0x3c74d8['id']);return getTicket(_0x2ce9d7,_0x59ef03,_0x3c74d8,_0x380b55,_0x531dfe,_0x380b55[_0xef49('0x62')],_0x1a279a,_0xef49('0x63'));})[_0xef49('0x30')](function(_0x1c25cf){_0x3d074f=_0x1c25cf;logger[_0xef49('0xd')](_0xef49('0x64'));logger[_0xef49('0xd')](_0xef49('0x65'),_0x3d074f['id']);return setRelationship(_0x1a279a,_0x59ef03,_0x3d074f,_0xef49('0x66'));})[_0xef49('0x30')](function(){return setRelationship(_0x1a279a,_0x3c74d8,_0x3d074f,_0xef49('0x67'));})[_0xef49('0x30')](function(){return getServerInfo(_0x1a279a);})[_0xef49('0x30')](function(_0x14c349){var _0x52521c=parseInt(_0x14c349[_0xef49('0x68')]['charAt'](0x0));var _0x9a6e31=util[_0xef49('0x26')](_0xef49('0x69'),_0x2ce9d7['remoteUri'],_0x3d074f['id']);if(_0x52521c>0x6){_0x9a6e31=util[_0xef49('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2ce9d7[_0xef49('0x56')],_0x3d074f['id']);}logger[_0xef49('0xd')](_0xef49('0x5a'),_0xef49('0x6a'));emit(util['format'](_0xef49('0x6b'),_0x426ae9['name']),_0xef49('0x6c'),{'uri':_0x9a6e31});})[_0xef49('0x6d')](function(_0x47ea55){logger[_0xef49('0x6e')](_0xef49('0x5a'),JSON[_0xef49('0x24')](_0x47ea55));});};exports[_0xef49('0x6f')]=function(_0x33c3e0,_0x361bcb,_0x31fbf3,_0x5f1afd,_0x40992b,_0x458e70,_0x5975a6){var _0x2c5a41,_0x22f297,_0x46ef2f,_0x197390;_0x458e70[_0xef49('0x56')]=intUtil['stripTrailingSlash'](_0x458e70['remoteUri']);_0x458e70['serverUrl']=intUtil[_0xef49('0x70')](_0x458e70[_0xef49('0x57')]);def['uri']=util['format'](_0xef49('0x71'),_0x458e70[_0xef49('0x56')]);if(_0x5975a6&&_0x5975a6[_0xef49('0x72')]&&_0x5975a6[_0xef49('0x72')]!=='none'){logger['info'](_0xef49('0x73'),_0xef49('0x5b'));_0x361bcb[_0xef49('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x458e70[_0xef49('0x57')],_0x361bcb[_0xef49('0x5d')],md5(_0x361bcb[_0xef49('0x5d')]));}return getConnection(_0x458e70)[_0xef49('0x30')](function(_0x1b1802){_0x197390=_0x1b1802;return getUser(_0x458e70,_0x5f1afd[_0xef49('0xf')],_0x197390);})[_0xef49('0x30')](function(_0x45aea5){_0x2c5a41=_0x45aea5;logger['info'](_0xef49('0x74'),_0x2c5a41['id']);return getEndUser(_0x458e70,_0x361bcb[_0xef49('0x75')],_0x361bcb[_0xef49('0x76')],_0x197390);})[_0xef49('0x30')](function(_0x416bf9){_0x22f297=_0x416bf9;logger[_0xef49('0xd')]('The\x20Enduser\x20ID\x20is:',_0x22f297['id']);return getTicket(_0x458e70,_0x2c5a41,_0x22f297,_0x31fbf3,_0x361bcb,_0x31fbf3['Fields'],_0x197390,_0xef49('0x77'));})[_0xef49('0x30')](function(_0x9f9aa7){_0x46ef2f=_0x9f9aa7;logger[_0xef49('0xd')]('Ticket\x20created!');logger[_0xef49('0xd')](_0xef49('0x65'),_0x46ef2f['id']);return setRelationship(_0x197390,_0x2c5a41,_0x46ef2f,_0xef49('0x66'));})[_0xef49('0x30')](function(){return setRelationship(_0x197390,_0x22f297,_0x46ef2f,_0xef49('0x67'));})[_0xef49('0x30')](function(){return getServerInfo(_0x197390);})[_0xef49('0x30')](function(_0x560b6d){var _0x3a7b76=parseInt(_0x560b6d[_0xef49('0x68')][_0xef49('0x78')](0x0));var _0x61d203=util[_0xef49('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x458e70[_0xef49('0x56')],_0x46ef2f['id']);if(_0x3a7b76>0x6){_0x61d203=util[_0xef49('0x26')](_0xef49('0x79'),_0x458e70[_0xef49('0x56')],_0x46ef2f['id']);}logger['info'](_0xef49('0x73'),_0xef49('0x6a'));emit(util[_0xef49('0x26')](_0xef49('0x6b'),_0x5f1afd[_0xef49('0xf')]),_0xef49('0x6c'),{'uri':_0x61d203});})[_0xef49('0x6d')](function(_0x3db27e){logger['error'](_0xef49('0x73'),JSON[_0xef49('0x24')](_0x3db27e));});};exports[_0xef49('0x7a')]=function(_0x5c08a2,_0x4cecc4,_0x58a7a5,_0x4218e5,_0x579f55,_0x5edfd9){var _0x542aed,_0x330051,_0x166725,_0x5312be;_0x5edfd9[_0xef49('0x56')]=intUtil[_0xef49('0x70')](_0x5edfd9[_0xef49('0x56')]);_0x5edfd9[_0xef49('0x57')]=intUtil[_0xef49('0x70')](_0x5edfd9[_0xef49('0x57')]);def[_0xef49('0x58')]=util[_0xef49('0x26')]('%s/service/v4_1/rest.php',_0x5edfd9[_0xef49('0x56')]);if(_0x579f55&&_0x579f55[_0xef49('0x59')]){logger[_0xef49('0xd')]('['+_0x4cecc4['lastevent']['toUpperCase']()+']',_0xef49('0x5b'));_0x4cecc4[_0xef49('0x5e')]=util[_0xef49('0x26')](_0xef49('0x5c'),_0x5edfd9['serverUrl'],_0x4cecc4['uniqueid'],md5(_0x4cecc4[_0xef49('0x5d')]));}else{_0x4cecc4[_0xef49('0x5e')]='';}return getConnection(_0x5edfd9)[_0xef49('0x30')](function(_0x252e37){_0x5312be=_0x252e37;if(!_[_0xef49('0x2b')](_0x4218e5)){return getUser(_0x5edfd9,_0x4218e5['name'],_0x5312be);}else{return getUser(_0x5edfd9,null,_0x5312be);}})['then'](function(_0x13d0f7){_0x542aed=_0x13d0f7;logger['info']('The\x20User\x20ID\x20is:',_0x542aed['id']);return getEndUser(_0x5edfd9,_0x4cecc4[_0xef49('0x5f')],_0x4cecc4[_0xef49('0x60')],_0x5312be);})[_0xef49('0x30')](function(_0x411c6e){_0x330051=_0x411c6e;logger[_0xef49('0xd')](_0xef49('0x61'),_0x330051['id']);return getTicket(_0x5edfd9,_0x542aed,_0x330051,_0x58a7a5,_0x4cecc4,_0x58a7a5[_0xef49('0x62')],_0x5312be,'Inbound');})[_0xef49('0x30')](function(_0x1f7cbf){_0x166725=_0x1f7cbf;logger[_0xef49('0xd')]('Ticket\x20created!');logger[_0xef49('0xd')](_0xef49('0x65'),_0x166725['id']);return setRelationship(_0x5312be,_0x542aed,_0x166725,_0xef49('0x66'));})[_0xef49('0x30')](function(){return setRelationship(_0x5312be,_0x330051,_0x166725,_0xef49('0x67'));})[_0xef49('0x30')](function(){return getServerInfo(_0x5312be);})[_0xef49('0x6d')](function(_0x60f36d){logger[_0xef49('0x6e')]('['+_0x4cecc4[_0xef49('0x7b')]['toUpperCase']()+']',JSON[_0xef49('0x24')](_0x60f36d));});}; \ 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 6343550..805b7c4 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 _0xd522=['length','sortBy','type','string','push','content','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','lodash','util','getString'];(function(_0x4924fc,_0x2f1a03){var _0xb11cbf=function(_0x4effba){while(--_0x4effba){_0x4924fc['push'](_0x4924fc['shift']());}};_0xb11cbf(++_0x2f1a03);}(_0xd522,0x1eb));var _0x2d52=function(_0x53badf,_0x5c9d99){_0x53badf=_0x53badf-0x0;var _0x1ab460=_0xd522[_0x53badf];return _0x1ab460;};'use strict';var _=require(_0x2d52('0x0'));var util=require(_0x2d52('0x1'));exports[_0x2d52('0x2')]=function(_0xb1ae6e,_0x55d23d,_0x30dce0){var _0x58ed87=[];if(_0xb1ae6e[_0x2d52('0x3')]>0x0){var _0x5cca3a=_[_0x2d52('0x4')](_0xb1ae6e,['id']);for(var _0x124845=0x0;_0x124845<_0x5cca3a[_0x2d52('0x3')];_0x124845++){var _0x2d1db7=_0x5cca3a[_0x124845];if(_0x2d1db7[_0x2d52('0x5')]===_0x2d52('0x6')){_0x58ed87[_0x2d52('0x7')](_0x2d1db7[_0x2d52('0x8')]);}else if(_0x2d1db7['type']==='variable'&&_0x2d1db7[_0x2d52('0x9')]){_0x55d23d[_0x2d1db7[_0x2d52('0x9')]]&&_0x58ed87[_0x2d52('0x7')](_0x55d23d[_0x2d1db7[_0x2d52('0x9')]][_0x2d52('0xa')]());}else if(_0x2d1db7[_0x2d52('0x5')]===_0x2d52('0xb')&&_0x2d1db7['Variable']&&_0x2d1db7['Variable'][_0x2d52('0xc')]){_0x55d23d[_0x2d1db7[_0x2d52('0xd')][_0x2d52('0xc')][_0x2d52('0xe')]()]&&_0x58ed87['push'](_0x55d23d[_0x2d1db7[_0x2d52('0xd')]['name'][_0x2d52('0xe')]()][_0x2d52('0xa')]());}else if(_0x2d1db7['type']===_0x2d52('0xf')){if(_0x2d1db7[_0x2d52('0x10')]==='string'&&_0x2d1db7[_0x2d52('0x11')]){_0x58ed87[_0x2d52('0x7')](util[_0x2d52('0x12')]('%s:\x20%s',_0x2d1db7[_0x2d52('0x11')],_0x2d1db7[_0x2d52('0x13')]));}else if(_0x2d1db7[_0x2d52('0x10')]===_0x2d52('0x14')&&_0x2d1db7['variableName']&&_0x2d1db7['key']){_0x55d23d[_0x2d1db7[_0x2d52('0x9')]]&&_0x58ed87[_0x2d52('0x7')](util[_0x2d52('0x12')](_0x2d52('0x15'),_0x2d1db7[_0x2d52('0x11')],_0x55d23d[_0x2d1db7[_0x2d52('0x9')]]));}else if(_0x2d1db7['keyType']==='customVariable'&&_0x2d1db7['Variable']&&_0x2d1db7[_0x2d52('0xd')][_0x2d52('0xc')]&&_0x2d1db7[_0x2d52('0x11')]){_0x55d23d[_0x2d1db7[_0x2d52('0xd')][_0x2d52('0xc')]['toLowerCase']()]&&_0x58ed87['push'](util[_0x2d52('0x12')](_0x2d52('0x15'),_0x2d1db7[_0x2d52('0x11')],_0x55d23d[_0x2d1db7[_0x2d52('0xd')][_0x2d52('0xc')][_0x2d52('0xe')]()]));}}}}return _0x58ed87[_0x2d52('0x16')](_0x30dce0);};exports[_0x2d52('0x17')]=function(_0x2b72d7){var _0xbba2cb=_0x2b72d7[_0x2d52('0x18')](-0x1);if(_0xbba2cb==='/'){_0x2b72d7=_0x2b72d7[_0x2d52('0x19')](0x0,_0x2b72d7['lastIndexOf'](_0xbba2cb));}return _0x2b72d7;};exports['validateEmail']=function(_0xbd4f78){if(!_['isNil'](_0xbd4f78)&&_0xbd4f78!==''){var _0x221b90=/^(([^<>()\[\]\\.,;:\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 _0x221b90['test'](String(_0xbd4f78)[_0x2d52('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x4ad5=['keyValue','keyType','string','key','%s:\x20%s','keyContent','format','join','slice','validateEmail','isNil','lodash','length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x14b0eb,_0x44add5){var _0x9ed44d=function(_0x38fbce){while(--_0x38fbce){_0x14b0eb['push'](_0x14b0eb['shift']());}};_0x9ed44d(++_0x44add5);}(_0x4ad5,0x192));var _0x54ad=function(_0x196504,_0x576908){_0x196504=_0x196504-0x0;var _0x35b373=_0x4ad5[_0x196504];return _0x35b373;};'use strict';var _=require(_0x54ad('0x0'));var util=require('util');exports['getString']=function(_0x401680,_0x432e65,_0x3f9896){var _0x4ef3af=[];if(_0x401680[_0x54ad('0x1')]>0x0){var _0x1533a3=_['sortBy'](_0x401680,['id']);for(var _0x1c5e1a=0x0;_0x1c5e1a<_0x1533a3[_0x54ad('0x1')];_0x1c5e1a++){var _0x25ad34=_0x1533a3[_0x1c5e1a];if(_0x25ad34[_0x54ad('0x2')]==='string'){_0x4ef3af[_0x54ad('0x3')](_0x25ad34[_0x54ad('0x4')]);}else if(_0x25ad34['type']===_0x54ad('0x5')&&_0x25ad34[_0x54ad('0x6')]){_0x432e65[_0x25ad34[_0x54ad('0x6')]]&&_0x4ef3af[_0x54ad('0x3')](_0x432e65[_0x25ad34[_0x54ad('0x6')]][_0x54ad('0x7')]());}else if(_0x25ad34[_0x54ad('0x2')]===_0x54ad('0x8')&&_0x25ad34[_0x54ad('0x9')]&&_0x25ad34[_0x54ad('0x9')][_0x54ad('0xa')]){_0x432e65[_0x25ad34[_0x54ad('0x9')]['name'][_0x54ad('0xb')]()]&&_0x4ef3af[_0x54ad('0x3')](_0x432e65[_0x25ad34['Variable'][_0x54ad('0xa')][_0x54ad('0xb')]()][_0x54ad('0x7')]());}else if(_0x25ad34[_0x54ad('0x2')]===_0x54ad('0xc')){if(_0x25ad34[_0x54ad('0xd')]===_0x54ad('0xe')&&_0x25ad34[_0x54ad('0xf')]){_0x4ef3af[_0x54ad('0x3')](util['format'](_0x54ad('0x10'),_0x25ad34['key'],_0x25ad34[_0x54ad('0x11')]));}else if(_0x25ad34[_0x54ad('0xd')]===_0x54ad('0x5')&&_0x25ad34[_0x54ad('0x6')]&&_0x25ad34[_0x54ad('0xf')]){_0x432e65[_0x25ad34[_0x54ad('0x6')]]&&_0x4ef3af[_0x54ad('0x3')](util[_0x54ad('0x12')]('%s:\x20%s',_0x25ad34['key'],_0x432e65[_0x25ad34[_0x54ad('0x6')]]));}else if(_0x25ad34['keyType']==='customVariable'&&_0x25ad34[_0x54ad('0x9')]&&_0x25ad34[_0x54ad('0x9')][_0x54ad('0xa')]&&_0x25ad34['key']){_0x432e65[_0x25ad34[_0x54ad('0x9')]['name'][_0x54ad('0xb')]()]&&_0x4ef3af[_0x54ad('0x3')](util['format']('%s:\x20%s',_0x25ad34['key'],_0x432e65[_0x25ad34[_0x54ad('0x9')]['name'][_0x54ad('0xb')]()]));}}}}return _0x4ef3af[_0x54ad('0x13')](_0x3f9896);};exports['stripTrailingSlash']=function(_0x29cb31){var _0x45b5e1=_0x29cb31[_0x54ad('0x14')](-0x1);if(_0x45b5e1==='/'){_0x29cb31=_0x29cb31['substring'](0x0,_0x29cb31['lastIndexOf'](_0x45b5e1));}return _0x29cb31;};exports[_0x54ad('0x15')]=function(_0x46b19f){if(!_[_0x54ad('0x16')](_0x46b19f)&&_0x46b19f!==''){var _0x2c2390=/^(([^<>()\[\]\\.,;:\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 _0x2c2390['test'](String(_0x46b19f)[_0x54ad('0xb')]());}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 93c1e84..f7b1ce9 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(_0x2657f4,_0x2e5594){var _0x370086=function(_0x3bc22a){while(--_0x3bc22a){_0x2657f4['push'](_0x2657f4['shift']());}};_0x370086(++_0x2e5594);}(_0xe706,0xa3));var _0x6e70=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0xe706[_0xadd0d2];return _0x2d564c;};'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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','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]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 b98ee82..c17787d 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 _0x1164=['emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','info','ticket','format','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','Basic\x20%s','debug','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','push','variableName','custom_fields','Variable','name','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','integrationTab','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0x1164,0x1a6));var _0x4116=function(_0x216ee2,_0x2bfc27){_0x216ee2=_0x216ee2-0x0;var _0x3d1766=_0x1164[_0x216ee2];return _0x3d1766;};'use strict';var _=require(_0x4116('0x0'));var rp=require(_0x4116('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x4116('0x2'));var intUtil=require(_0x4116('0x3'));var config=require(_0x4116('0x4'));var logger=require('../../../../config/logger')(_0x4116('0x5'));config[_0x4116('0x6')]=_[_0x4116('0x7')](config['redis'],{'host':_0x4116('0x8'),'port':0x18eb});var io=require(_0x4116('0x9'))(new Redis(config[_0x4116('0x6')]));function emit(_0x28eed8,_0x3f0b09,_0x339f13){io['to'](_0x28eed8)[_0x4116('0xa')](_0x3f0b09,_0x339f13);}var headers={'Content-Type':_0x4116('0xb'),'Accept':_0x4116('0xb')};function getTicket(_0x2e744b,_0x4ac897,_0x2c0b5c,_0x183c8a,_0x231d59){logger['info'](_0x4116('0xc'));return request({'uri':util['format'](_0x4116('0xd'),_0x2e744b[_0x4116('0xe')]),'method':_0x4116('0xf'),'body':{'ticket':_[_0x4116('0x10')]({'requester_id':_0x2c0b5c['id'],'submitter_id':_0x4ac897?_0x4ac897['id']:undefined,'assignee_id':_0x4ac897?_0x4ac897['id']:undefined,'tags':getTags(_0x183c8a[_0x4116('0x11')],'name'),'subject':intUtil[_0x4116('0x12')](_0x183c8a[_0x4116('0x13')],_0x231d59,'\x20'),'description':intUtil[_0x4116('0x12')](_0x183c8a[_0x4116('0x14')],_0x231d59,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4116('0x12')](_0x183c8a['Descriptions'],_0x231d59,'\x0a')}},getCustomFields(_0x183c8a[_0x4116('0x15')],_0x231d59))}})[_0x4116('0x16')](function(_0x205981){logger[_0x4116('0x17')]('Ticket\x20created!');return _0x205981[_0x4116('0x18')];});}function getUser(_0x172a8f,_0x2feb27){if(intUtil['validateEmail'](_0x2feb27)){logger[_0x4116('0x17')]('Getting\x20agent\x20with\x20email',_0x2feb27);return request({'uri':util[_0x4116('0x19')]('%s/search.json',_0x172a8f['remoteUri']),'qs':{'query':util[_0x4116('0x19')](_0x4116('0x1a'),_0x2feb27)}})[_0x4116('0x16')](function(_0x558ab0){if(_0x558ab0[_0x4116('0x1b')]){logger[_0x4116('0x17')]('Agent\x20found!');return _[_0x4116('0x1c')](_0x558ab0[_0x4116('0x1d')],{'email':_0x2feb27,'role':_0x4116('0x1e')});}else{logger[_0x4116('0x17')](_0x4116('0x1f'));return request({'uri':util['format'](_0x4116('0x20'),_0x172a8f['remoteUri'])})['then'](function(_0x1ca73c){logger[_0x4116('0x17')]('Admin\x20account\x20selected.');return _0x1ca73c[_0x4116('0x21')];});}});}else{logger[_0x4116('0x17')](_0x4116('0x1f'));return request({'uri':util[_0x4116('0x19')](_0x4116('0x20'),_0x172a8f[_0x4116('0xe')])})[_0x4116('0x16')](function(_0xac7af1){logger['info'](_0x4116('0x22'));return _0xac7af1[_0x4116('0x21')];});}}function getEndUser(_0x16ccdc,_0x13a105,_0x56a6e1){logger[_0x4116('0x17')]('Searching\x20enduser\x20with\x20phone',_0x56a6e1);return request({'uri':util[_0x4116('0x19')](_0x4116('0x23'),_0x16ccdc['remoteUri']),'qs':{'query':util[_0x4116('0x19')](_0x4116('0x24'),_0x56a6e1)}})[_0x4116('0x16')](function(_0x53b0ac){var _0x769878;if(_0x53b0ac[_0x4116('0x1d')][_0x4116('0x25')]){_0x53b0ac[_0x4116('0x1d')]=_[_0x4116('0x26')](_0x53b0ac[_0x4116('0x1d')],{'suspended':![],'role':_0x4116('0x27')});if(_0x53b0ac[_0x4116('0x1d')][_0x4116('0x25')]){_0x769878=_[_0x4116('0x28')](_0x53b0ac[_0x4116('0x1d')]);}}if(_0x769878){logger[_0x4116('0x17')](_0x4116('0x29'));return _0x769878;}else{logger['info'](_0x4116('0x2a'));return request({'uri':util[_0x4116('0x19')](_0x4116('0x2b'),_0x16ccdc[_0x4116('0xe')]),'method':_0x4116('0xf'),'body':{'user':{'role':_0x4116('0x27'),'name':util[_0x4116('0x19')](_0x4116('0x2c'),_0x13a105||_0x56a6e1),'phone':_0x56a6e1}}})[_0x4116('0x16')](function(_0x149f48){logger['info']('Enduser\x20created.');return _0x149f48[_0x4116('0x21')];});}});}function getAuth(_0x14f9bf){var _0x1e4ef6;if(_0x14f9bf[_0x4116('0x2d')]===_0x4116('0x2e')){_0x1e4ef6=util['format'](_0x4116('0x2f'),_0x14f9bf[_0x4116('0x30')],_0x14f9bf[_0x4116('0x2e')]);}else if(_0x14f9bf[_0x4116('0x2d')]==='token'){_0x1e4ef6=util[_0x4116('0x19')]('%s/token:%s',_0x14f9bf[_0x4116('0x30')],_0x14f9bf['token']);}return util['format'](_0x4116('0x31'),new Buffer(_0x1e4ef6)['toString']('base64'));}function request(_0x4844b9){logger[_0x4116('0x32')]('[HTTP]',JSON[_0x4116('0x33')](_0x4844b9));return rp(_[_0x4116('0x7')](_0x4844b9,{'method':_0x4116('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4b2c5f,_0x1e1b74){var _0x1664a9=[];if(_0x4b2c5f&&_0x4b2c5f[_0x4116('0x25')]>0x0){_0x1664a9=_[_0x4116('0x35')](_0x4b2c5f,_0x1e1b74);}return _0x1664a9;}function getCustomFields(_0x59df2a,_0x4ad014){var _0x31c35e=[];var _0x557516={'custom_fields':[]};if(_0x59df2a['length']>0x0){_['forEach'](_0x59df2a,function(_0x32404c){if(_[_0x4116('0x36')]([_0x4116('0x37'),_0x4116('0x38')],_0x32404c[_0x4116('0x39')])&&_0x32404c[_0x4116('0x3a')]&&!_0x32404c[_0x4116('0x3b')]){_0x557516[_0x32404c['nameField'][_0x4116('0x3c')]()]=_0x32404c[_0x4116('0x3d')][_0x4116('0x3e')]();}else if(_[_0x4116('0x36')]([_0x4116('0x37'),_0x4116('0x38')],_0x32404c[_0x4116('0x39')])&&_0x32404c[_0x4116('0x3f')]&&_0x32404c[_0x4116('0x3b')]){_0x557516['custom_fields'][_0x4116('0x40')]({'id':_0x32404c[_0x4116('0x3f')],'value':_0x32404c['content'][_0x4116('0x3e')]()});}else if(_0x32404c[_0x4116('0x39')]==='variable'&&_0x32404c[_0x4116('0x41')]&&_0x32404c[_0x4116('0x3f')]&&_0x32404c['customField']){_0x4ad014[_0x32404c[_0x4116('0x41')]]&&_0x557516[_0x4116('0x42')]['push']({'id':_0x32404c[_0x4116('0x3f')],'value':_0x4ad014[_0x32404c['variableName']][_0x4116('0x3e')]()});}else if(_0x32404c[_0x4116('0x39')]==='customVariable'&&_0x32404c['Variable']&&_0x32404c[_0x4116('0x43')]['name']&&_0x32404c[_0x4116('0x3f')]&&_0x32404c[_0x4116('0x3b')]){_0x4ad014[_0x32404c[_0x4116('0x43')]['name'][_0x4116('0x3c')]()]&&_0x557516[_0x4116('0x42')][_0x4116('0x40')]({'id':_0x32404c[_0x4116('0x3f')],'value':_0x4ad014[_0x32404c[_0x4116('0x43')][_0x4116('0x44')]['toLowerCase']()][_0x4116('0x3e')]()});}});}return _0x557516;}exports[_0x4116('0x45')]=function(_0x468af5,_0x6b4b4e,_0x59f4d7,_0x5e49c6,_0x12b36a,_0x2ad672){var _0x5083ca,_0x3b9469;_0x2ad672['remoteUri']=intUtil['stripTrailingSlash'](_0x2ad672['remoteUri']);_0x2ad672['serverUrl']=intUtil['stripTrailingSlash'](_0x2ad672[_0x4116('0x46')]);if(_0x12b36a&&_0x12b36a['monitor_format']){logger[_0x4116('0x17')](_0x4116('0x47'),_0x4116('0x48'));_0x6b4b4e[_0x4116('0x49')]=util[_0x4116('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ad672['serverUrl'],_0x6b4b4e[_0x4116('0x4a')],md5(_0x6b4b4e[_0x4116('0x4a')]));}else{_0x6b4b4e[_0x4116('0x49')]='';}headers[_0x4116('0x4b')]=getAuth(_0x2ad672);return getUser(_0x2ad672,_0x5e49c6['email'])[_0x4116('0x16')](function(_0x16d3e9){_0x5083ca=_0x16d3e9;logger[_0x4116('0x17')](_0x4116('0x4c'),_0x5083ca['id']);return getEndUser(_0x2ad672,_0x6b4b4e['calleridname'],_0x6b4b4e[_0x4116('0x4d')]);})['then'](function(_0x35cf9e){_0x3b9469=_0x35cf9e;logger[_0x4116('0x17')]('The\x20Enduser\x20ID\x20is:',_0x3b9469['id']);return getTicket(_0x2ad672,_0x5083ca,_0x3b9469,_0x59f4d7,_0x6b4b4e);})['then'](function(_0x188d3a){if(_0x188d3a){logger[_0x4116('0x17')]('The\x20Ticket\x20ID\x20is:',_0x188d3a['id']);switch(_0x2ad672['type']){case _0x4116('0x4e'):logger[_0x4116('0x17')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4116('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ad672[_0x4116('0xe')],_0x5083ca['id'],_0x188d3a['id']),'method':'POST'});case _0x4116('0x4f'):logger[_0x4116('0x17')](_0x4116('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4116('0x19')](_0x4116('0x50'),_0x5e49c6['name']),_0x4116('0x51'),{'uri':util['format'](_0x4116('0x52'),_0x2ad672['remoteUri'][_0x4116('0x53')](_0x4116('0x54'),''),_0x188d3a['id'])});break;default:logger[_0x4116('0x55')](_0x4116('0x47'),_0x4116('0x56'));}}})[_0x4116('0x57')](function(_0x1e1d22){logger[_0x4116('0x55')](_0x4116('0x58'),util[_0x4116('0x59')](_0x1e1d22,{'showHidden':!![],'depth':null}));});};exports[_0x4116('0x5a')]=function(_0x400717,_0x12fdcc,_0x26bddb,_0x132d92,_0x59f47b,_0x55bf9c,_0x288019){var _0x234d47,_0xc64857;_0x55bf9c[_0x4116('0xe')]=intUtil[_0x4116('0x5b')](_0x55bf9c[_0x4116('0xe')]);_0x55bf9c[_0x4116('0x46')]=intUtil['stripTrailingSlash'](_0x55bf9c[_0x4116('0x46')]);if(_0x288019&&_0x288019[_0x4116('0x5c')]&&_0x288019['recordingFormat']!==_0x4116('0x5d')){logger[_0x4116('0x17')]('[OUTBOUND]',_0x4116('0x48'));_0x12fdcc[_0x4116('0x49')]=util[_0x4116('0x19')](_0x4116('0x5e'),_0x55bf9c[_0x4116('0x46')],_0x12fdcc['uniqueid'],md5(_0x12fdcc['uniqueid']));}headers[_0x4116('0x4b')]=getAuth(_0x55bf9c);return getUser(_0x55bf9c,_0x132d92['email'])[_0x4116('0x16')](function(_0x1324d1){_0x234d47=_0x1324d1;logger[_0x4116('0x17')](_0x4116('0x4c'),_0x234d47['id']);return getEndUser(_0x55bf9c,_0x12fdcc[_0x4116('0x5f')],_0x12fdcc[_0x4116('0x60')]);})[_0x4116('0x16')](function(_0x4fce97){_0xc64857=_0x4fce97;logger['info']('The\x20Enduser\x20ID\x20is:',_0xc64857['id']);return getTicket(_0x55bf9c,_0x234d47,_0xc64857,_0x26bddb,_0x12fdcc);})[_0x4116('0x16')](function(_0x1af307){if(_0x1af307){logger[_0x4116('0x17')](_0x4116('0x61'),_0x1af307['id']);switch(_0x55bf9c[_0x4116('0x39')]){case'integrationTab':logger[_0x4116('0x17')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4116('0x19')](_0x4116('0x62'),_0x55bf9c[_0x4116('0xe')],_0x234d47['id'],_0x1af307['id']),'method':_0x4116('0xf')});case'newTab':logger[_0x4116('0x17')](_0x4116('0x63'),_0x4116('0x64'));emit(util['format'](_0x4116('0x50'),_0x132d92[_0x4116('0x44')]),'trigger:browser:url',{'uri':util['format'](_0x4116('0x52'),_0x55bf9c[_0x4116('0xe')]['replace'](_0x4116('0x54'),''),_0x1af307['id'])});break;default:logger[_0x4116('0x55')](_0x4116('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x116eb8){logger[_0x4116('0x55')](_0x4116('0x65'),util[_0x4116('0x59')](_0x116eb8,{'showHidden':!![],'depth':null}));});};exports[_0x4116('0x66')]=function(_0x31bda1,_0x41f324,_0x2ac868,_0x63fde0,_0x372f8c,_0x28adfc){var _0x3b70ca,_0x4f8a61;_0x28adfc[_0x4116('0xe')]=intUtil[_0x4116('0x5b')](_0x28adfc[_0x4116('0xe')]);_0x28adfc[_0x4116('0x46')]=intUtil['stripTrailingSlash'](_0x28adfc[_0x4116('0x46')]);if(_0x372f8c&&_0x372f8c['monitor_format']){logger[_0x4116('0x17')]('['+_0x41f324[_0x4116('0x67')][_0x4116('0x68')]()+']',_0x4116('0x48'));_0x41f324['recordingURL']=util[_0x4116('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28adfc[_0x4116('0x46')],_0x41f324[_0x4116('0x4a')],md5(_0x41f324[_0x4116('0x4a')]));}else{_0x41f324[_0x4116('0x49')]='';}headers[_0x4116('0x4b')]=getAuth(_0x28adfc);return getUser(_0x28adfc)[_0x4116('0x16')](function(_0x7a98a3){_0x3b70ca=_0x7a98a3;logger[_0x4116('0x17')](_0x4116('0x4c'),_0x3b70ca['id']);return getEndUser(_0x28adfc,_0x41f324[_0x4116('0x69')],_0x41f324[_0x4116('0x4d')]);})[_0x4116('0x16')](function(_0x306f5d){_0x4f8a61=_0x306f5d;logger[_0x4116('0x17')](_0x4116('0x6a'),_0x4f8a61['id']);return getTicket(_0x28adfc,_0x3b70ca,_0x4f8a61,_0x2ac868,_0x41f324);})['then'](function(_0x404fa2){if(_0x404fa2){logger[_0x4116('0x17')](_0x4116('0x61'),_0x404fa2['id']);}})[_0x4116('0x57')](function(_0x17f5e0){logger[_0x4116('0x55')]('['+_0x41f324[_0x4116('0x67')]['toUpperCase']()+']'+_0x4116('0x6b'),util['inspect'](_0x17f5e0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x53c6=['unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','\x20Error\x20running\x20Zendesk\x20integration','inspect','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','type','nameField','customField','content','picklist','idField','custom_fields','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x2412a4,_0x3f6966){var _0x8e16c4=function(_0x1a510a){while(--_0x1a510a){_0x2412a4['push'](_0x2412a4['shift']());}};_0x8e16c4(++_0x3f6966);}(_0x53c6,0x1d2));var _0x653c=function(_0x451e80,_0x311964){_0x451e80=_0x451e80-0x0;var _0x2c07ad=_0x53c6[_0x451e80];return _0x2c07ad;};'use strict';var _=require('lodash');var rp=require(_0x653c('0x0'));var md5=require(_0x653c('0x1'));var util=require(_0x653c('0x2'));var Redis=require(_0x653c('0x3'));var intUtil=require(_0x653c('0x4'));var config=require(_0x653c('0x5'));var logger=require(_0x653c('0x6'))(_0x653c('0x7'));config[_0x653c('0x8')]=_[_0x653c('0x9')](config[_0x653c('0x8')],{'host':_0x653c('0xa'),'port':0x18eb});var io=require(_0x653c('0xb'))(new Redis(config[_0x653c('0x8')]));function emit(_0x39ecf5,_0x81ea18,_0x16120e){io['to'](_0x39ecf5)[_0x653c('0xc')](_0x81ea18,_0x16120e);}var headers={'Content-Type':_0x653c('0xd'),'Accept':_0x653c('0xd')};function getTicket(_0x44829f,_0x408965,_0x47e657,_0x56a58c,_0x5443fb){logger[_0x653c('0xe')](_0x653c('0xf'));return request({'uri':util[_0x653c('0x10')]('%s/tickets.json',_0x44829f[_0x653c('0x11')]),'method':_0x653c('0x12'),'body':{'ticket':_[_0x653c('0x13')]({'requester_id':_0x47e657['id'],'submitter_id':_0x408965?_0x408965['id']:undefined,'assignee_id':_0x408965?_0x408965['id']:undefined,'tags':getTags(_0x56a58c[_0x653c('0x14')],_0x653c('0x15')),'subject':intUtil['getString'](_0x56a58c[_0x653c('0x16')],_0x5443fb,'\x20'),'description':intUtil[_0x653c('0x17')](_0x56a58c[_0x653c('0x18')],_0x5443fb,'\x0a'),'comment':{'public':![],'body':intUtil[_0x653c('0x17')](_0x56a58c[_0x653c('0x18')],_0x5443fb,'\x0a')}},getCustomFields(_0x56a58c[_0x653c('0x19')],_0x5443fb))}})['then'](function(_0x2d1cdb){logger[_0x653c('0xe')](_0x653c('0x1a'));return _0x2d1cdb[_0x653c('0x1b')];});}function getUser(_0x55313f,_0x3af6c8){if(intUtil[_0x653c('0x1c')](_0x3af6c8)){logger[_0x653c('0xe')](_0x653c('0x1d'),_0x3af6c8);return request({'uri':util[_0x653c('0x10')](_0x653c('0x1e'),_0x55313f[_0x653c('0x11')]),'qs':{'query':util[_0x653c('0x10')](_0x653c('0x1f'),_0x3af6c8)}})['then'](function(_0x2a755f){if(_0x2a755f['count']){logger[_0x653c('0xe')]('Agent\x20found!');return _[_0x653c('0x20')](_0x2a755f[_0x653c('0x21')],{'email':_0x3af6c8,'role':_0x653c('0x22')});}else{logger[_0x653c('0xe')](_0x653c('0x23'));return request({'uri':util['format']('%s/users/me.json',_0x55313f['remoteUri'])})['then'](function(_0x10c0d1){logger[_0x653c('0xe')]('Admin\x20account\x20selected.');return _0x10c0d1['user'];});}});}else{logger['info'](_0x653c('0x23'));return request({'uri':util['format'](_0x653c('0x24'),_0x55313f[_0x653c('0x11')])})[_0x653c('0x25')](function(_0x13a288){logger['info'](_0x653c('0x26'));return _0x13a288[_0x653c('0x27')];});}}function getEndUser(_0x4a7416,_0x5d0984,_0x3a4e0e){logger[_0x653c('0xe')]('Searching\x20enduser\x20with\x20phone',_0x3a4e0e);return request({'uri':util['format'](_0x653c('0x1e'),_0x4a7416['remoteUri']),'qs':{'query':util[_0x653c('0x10')]('type:user\x20role:end-user\x20phone:%s',_0x3a4e0e)}})[_0x653c('0x25')](function(_0x31d1ba){var _0x465bce;if(_0x31d1ba[_0x653c('0x21')]['length']){_0x31d1ba[_0x653c('0x21')]=_[_0x653c('0x28')](_0x31d1ba[_0x653c('0x21')],{'suspended':![],'role':_0x653c('0x29')});if(_0x31d1ba[_0x653c('0x21')][_0x653c('0x2a')]){_0x465bce=_[_0x653c('0x2b')](_0x31d1ba['results']);}}if(_0x465bce){logger[_0x653c('0xe')](_0x653c('0x2c'));return _0x465bce;}else{logger[_0x653c('0xe')](_0x653c('0x2d'));return request({'uri':util[_0x653c('0x10')](_0x653c('0x2e'),_0x4a7416[_0x653c('0x11')]),'method':_0x653c('0x12'),'body':{'user':{'role':_0x653c('0x29'),'name':util[_0x653c('0x10')](_0x653c('0x2f'),_0x5d0984||_0x3a4e0e),'phone':_0x3a4e0e}}})[_0x653c('0x25')](function(_0x215cd6){logger[_0x653c('0xe')](_0x653c('0x30'));return _0x215cd6[_0x653c('0x27')];});}});}function getAuth(_0x7edf60){var _0x544122;if(_0x7edf60[_0x653c('0x31')]===_0x653c('0x32')){_0x544122=util[_0x653c('0x10')]('%s:%s',_0x7edf60[_0x653c('0x33')],_0x7edf60['password']);}else if(_0x7edf60[_0x653c('0x31')]===_0x653c('0x34')){_0x544122=util[_0x653c('0x10')](_0x653c('0x35'),_0x7edf60[_0x653c('0x33')],_0x7edf60[_0x653c('0x34')]);}return util[_0x653c('0x10')](_0x653c('0x36'),new Buffer(_0x544122)[_0x653c('0x37')](_0x653c('0x38')));}function request(_0x416a4a){logger[_0x653c('0x39')](_0x653c('0x3a'),JSON[_0x653c('0x3b')](_0x416a4a));return rp(_['defaults'](_0x416a4a,{'method':_0x653c('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x3e585c,_0x274622){var _0x3cffc8=[];if(_0x3e585c&&_0x3e585c['length']>0x0){_0x3cffc8=_[_0x653c('0x3d')](_0x3e585c,_0x274622);}return _0x3cffc8;}function getCustomFields(_0x1508a,_0x298e2d){var _0x3e96d3=[];var _0x1c3541={'custom_fields':[]};if(_0x1508a[_0x653c('0x2a')]>0x0){_[_0x653c('0x3e')](_0x1508a,function(_0x192c4a){if(_['includes']([_0x653c('0x3f'),'picklist'],_0x192c4a[_0x653c('0x40')])&&_0x192c4a[_0x653c('0x41')]&&!_0x192c4a[_0x653c('0x42')]){_0x1c3541[_0x192c4a[_0x653c('0x41')]['toLowerCase']()]=_0x192c4a[_0x653c('0x43')][_0x653c('0x37')]();}else if(_['includes']([_0x653c('0x3f'),_0x653c('0x44')],_0x192c4a['type'])&&_0x192c4a[_0x653c('0x45')]&&_0x192c4a[_0x653c('0x42')]){_0x1c3541[_0x653c('0x46')]['push']({'id':_0x192c4a[_0x653c('0x45')],'value':_0x192c4a[_0x653c('0x43')][_0x653c('0x37')]()});}else if(_0x192c4a[_0x653c('0x40')]===_0x653c('0x47')&&_0x192c4a[_0x653c('0x48')]&&_0x192c4a[_0x653c('0x45')]&&_0x192c4a[_0x653c('0x42')]){_0x298e2d[_0x192c4a[_0x653c('0x48')]]&&_0x1c3541['custom_fields'][_0x653c('0x49')]({'id':_0x192c4a['idField'],'value':_0x298e2d[_0x192c4a[_0x653c('0x48')]]['toString']()});}else if(_0x192c4a[_0x653c('0x40')]===_0x653c('0x4a')&&_0x192c4a[_0x653c('0x4b')]&&_0x192c4a[_0x653c('0x4b')][_0x653c('0x15')]&&_0x192c4a['idField']&&_0x192c4a[_0x653c('0x42')]){_0x298e2d[_0x192c4a['Variable'][_0x653c('0x15')][_0x653c('0x4c')]()]&&_0x1c3541[_0x653c('0x46')][_0x653c('0x49')]({'id':_0x192c4a['idField'],'value':_0x298e2d[_0x192c4a[_0x653c('0x4b')][_0x653c('0x15')][_0x653c('0x4c')]()][_0x653c('0x37')]()});}});}return _0x1c3541;}exports[_0x653c('0x4d')]=function(_0x36aa2c,_0xb07e32,_0x1b9f67,_0x38dae6,_0x3d7f5e,_0x4900e8){var _0x39ee97,_0xd1cfa5;_0x4900e8['remoteUri']=intUtil[_0x653c('0x4e')](_0x4900e8['remoteUri']);_0x4900e8[_0x653c('0x4f')]=intUtil[_0x653c('0x4e')](_0x4900e8[_0x653c('0x4f')]);if(_0x3d7f5e&&_0x3d7f5e[_0x653c('0x50')]){logger[_0x653c('0xe')](_0x653c('0x51'),_0x653c('0x52'));_0xb07e32[_0x653c('0x53')]=util[_0x653c('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4900e8[_0x653c('0x4f')],_0xb07e32[_0x653c('0x54')],md5(_0xb07e32[_0x653c('0x54')]));}else{_0xb07e32[_0x653c('0x53')]='';}headers[_0x653c('0x55')]=getAuth(_0x4900e8);return getUser(_0x4900e8,_0x38dae6[_0x653c('0x56')])[_0x653c('0x25')](function(_0x1f8374){_0x39ee97=_0x1f8374;logger['info']('The\x20User\x20ID\x20is:',_0x39ee97['id']);return getEndUser(_0x4900e8,_0xb07e32[_0x653c('0x57')],_0xb07e32[_0x653c('0x58')]);})[_0x653c('0x25')](function(_0x37c865){_0xd1cfa5=_0x37c865;logger[_0x653c('0xe')](_0x653c('0x59'),_0xd1cfa5['id']);return getTicket(_0x4900e8,_0x39ee97,_0xd1cfa5,_0x1b9f67,_0xb07e32);})['then'](function(_0x30ac76){if(_0x30ac76){logger['info'](_0x653c('0x5a'),_0x30ac76['id']);switch(_0x4900e8[_0x653c('0x40')]){case _0x653c('0x5b'):logger['info'](_0x653c('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x653c('0x10')](_0x653c('0x5c'),_0x4900e8[_0x653c('0x11')],_0x39ee97['id'],_0x30ac76['id']),'method':_0x653c('0x12')});case _0x653c('0x5d'):logger[_0x653c('0xe')](_0x653c('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x653c('0x10')](_0x653c('0x5e'),_0x38dae6[_0x653c('0x15')]),_0x653c('0x5f'),{'uri':util[_0x653c('0x10')](_0x653c('0x60'),_0x4900e8[_0x653c('0x11')][_0x653c('0x61')](_0x653c('0x62'),''),_0x30ac76['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x653c('0x63')](function(_0x31e7fe){logger['error'](_0x653c('0x64'),util['inspect'](_0x31e7fe,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x11d4fd,_0x4351ac,_0x3a045e,_0x510e88,_0x4ad348,_0x18745b,_0x2bfe2c){var _0x38af10,_0x526390;_0x18745b[_0x653c('0x11')]=intUtil[_0x653c('0x4e')](_0x18745b[_0x653c('0x11')]);_0x18745b[_0x653c('0x4f')]=intUtil[_0x653c('0x4e')](_0x18745b[_0x653c('0x4f')]);if(_0x2bfe2c&&_0x2bfe2c[_0x653c('0x65')]&&_0x2bfe2c['recordingFormat']!=='none'){logger[_0x653c('0xe')](_0x653c('0x66'),'Recording\x20is\x20enabled!');_0x4351ac[_0x653c('0x53')]=util[_0x653c('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18745b[_0x653c('0x4f')],_0x4351ac[_0x653c('0x54')],md5(_0x4351ac['uniqueid']));}headers[_0x653c('0x55')]=getAuth(_0x18745b);return getUser(_0x18745b,_0x510e88[_0x653c('0x56')])['then'](function(_0xf6dd7b){_0x38af10=_0xf6dd7b;logger[_0x653c('0xe')](_0x653c('0x67'),_0x38af10['id']);return getEndUser(_0x18745b,_0x4351ac[_0x653c('0x68')],_0x4351ac['destcalleridnum']);})[_0x653c('0x25')](function(_0x5ec7c4){_0x526390=_0x5ec7c4;logger[_0x653c('0xe')](_0x653c('0x59'),_0x526390['id']);return getTicket(_0x18745b,_0x38af10,_0x526390,_0x3a045e,_0x4351ac);})[_0x653c('0x25')](function(_0x2dee6d){if(_0x2dee6d){logger['info'](_0x653c('0x5a'),_0x2dee6d['id']);switch(_0x18745b[_0x653c('0x40')]){case _0x653c('0x5b'):logger[_0x653c('0xe')]('[OUTBOUND]',_0x653c('0x69'));return request({'uri':util[_0x653c('0x10')](_0x653c('0x5c'),_0x18745b[_0x653c('0x11')],_0x38af10['id'],_0x2dee6d['id']),'method':_0x653c('0x12')});case'newTab':logger[_0x653c('0xe')](_0x653c('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x653c('0x10')](_0x653c('0x5e'),_0x510e88['name']),_0x653c('0x5f'),{'uri':util[_0x653c('0x10')](_0x653c('0x60'),_0x18745b[_0x653c('0x11')][_0x653c('0x61')](_0x653c('0x62'),''),_0x2dee6d['id'])});break;default:logger['error'](_0x653c('0x66'),_0x653c('0x6a'));}}})[_0x653c('0x63')](function(_0x19d8e5){logger[_0x653c('0x6b')](_0x653c('0x6c'),util['inspect'](_0x19d8e5,{'showHidden':!![],'depth':null}));});};exports[_0x653c('0x6d')]=function(_0x129aca,_0x2d3c92,_0x1568a5,_0x407018,_0x45e8a5,_0x3b9826){var _0x4a1af1,_0x548fcd;_0x3b9826[_0x653c('0x11')]=intUtil[_0x653c('0x4e')](_0x3b9826['remoteUri']);_0x3b9826[_0x653c('0x4f')]=intUtil[_0x653c('0x4e')](_0x3b9826[_0x653c('0x4f')]);if(_0x45e8a5&&_0x45e8a5[_0x653c('0x50')]){logger[_0x653c('0xe')]('['+_0x2d3c92['lastevent'][_0x653c('0x6e')]()+']','Recording\x20is\x20enabled!');_0x2d3c92[_0x653c('0x53')]=util['format'](_0x653c('0x6f'),_0x3b9826[_0x653c('0x4f')],_0x2d3c92[_0x653c('0x54')],md5(_0x2d3c92['uniqueid']));}else{_0x2d3c92['recordingURL']='';}headers[_0x653c('0x55')]=getAuth(_0x3b9826);return getUser(_0x3b9826)[_0x653c('0x25')](function(_0x40f5fa){_0x4a1af1=_0x40f5fa;logger[_0x653c('0xe')](_0x653c('0x67'),_0x4a1af1['id']);return getEndUser(_0x3b9826,_0x2d3c92['calleridname'],_0x2d3c92[_0x653c('0x58')]);})['then'](function(_0x97ff5a){_0x548fcd=_0x97ff5a;logger['info'](_0x653c('0x59'),_0x548fcd['id']);return getTicket(_0x3b9826,_0x4a1af1,_0x548fcd,_0x1568a5,_0x2d3c92);})['then'](function(_0x69ac8a){if(_0x69ac8a){logger[_0x653c('0xe')]('The\x20Ticket\x20ID\x20is:',_0x69ac8a['id']);}})['catch'](function(_0x345d03){logger[_0x653c('0x6b')]('['+_0x2d3c92[_0x653c('0x70')][_0x653c('0x6e')]()+']'+_0x653c('0x71'),util[_0x653c('0x72')](_0x345d03,{'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 9276562..f74f2a2 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 _0x125f=['forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','email','Agent\x20found!','findIndex','Administrator','profile','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','unmanaged','toUpperCase','calleridname','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','emit','[HTTP]','stringify','length'];(function(_0x46c598,_0x487872){var _0xd7fe9a=function(_0xe4ca73){while(--_0xe4ca73){_0x46c598['push'](_0x46c598['shift']());}};_0xd7fe9a(++_0x487872);}(_0x125f,0x1b6));var _0xf125=function(_0xf8203c,_0xcd768f){_0xf8203c=_0xf8203c-0x0;var _0x876d83=_0x125f[_0xf8203c];return _0x876d83;};'use strict';var _=require(_0xf125('0x0'));var rp=require(_0xf125('0x1'));var md5=require(_0xf125('0x2'));var util=require(_0xf125('0x3'));var intUtil=require('./util');var moment=require(_0xf125('0x4'));var Redis=require(_0xf125('0x5'));var BPromise=require(_0xf125('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf125('0x7'))('zoho');config[_0xf125('0x8')]=_[_0xf125('0x9')](config['redis'],{'host':_0xf125('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf125('0x8')]));function emit(_0x52834,_0x281bc5,_0x4a7d8f){io['to'](_0x52834)[_0xf125('0xb')](_0x281bc5,_0x4a7d8f);}function request(_0x23b803){logger['debug'](_0xf125('0xc'),JSON[_0xf125('0xd')](_0x23b803));return rp(_0x23b803);}function getCustomFields(_0x1b7132,_0x3cc8bd){var _0x290526={};if(_0x1b7132[_0xf125('0xe')]>0x0){_[_0xf125('0xf')](_0x1b7132,function(_0x1843ec){if(_[_0xf125('0x10')]([_0xf125('0x11'),'picklist'],_0x1843ec[_0xf125('0x12')])&&_0x1843ec[_0xf125('0x13')]){_0x290526[_0x1843ec['idField']]=_0x1843ec[_0xf125('0x14')][_0xf125('0x15')]();}else if(_0x1843ec[_0xf125('0x12')]===_0xf125('0x16')&&_0x1843ec[_0xf125('0x17')]&&_0x1843ec[_0xf125('0x13')]&&_0x3cc8bd[_0x1843ec['variableName']]){_0x290526[_0x1843ec[_0xf125('0x13')]]=_0x3cc8bd[_0x1843ec[_0xf125('0x17')]]['toString']();}else if(_0x1843ec['type']===_0xf125('0x18')&&_0x1843ec['Variable']&&_0x1843ec['Variable'][_0xf125('0x19')]&&_0x1843ec['idField']&&_0x3cc8bd[_0x1843ec[_0xf125('0x1a')][_0xf125('0x19')][_0xf125('0x1b')]()]){_0x290526[_0x1843ec[_0xf125('0x13')]]=_0x3cc8bd[_0x1843ec[_0xf125('0x1a')]['name'][_0xf125('0x1b')]()]['toString']();}});}return _0x290526;}function getName(_0x3ef88a){if(_0x3ef88a['indexOf']('\x20')>0x0){var _0x9184bb=_0x3ef88a[_0xf125('0x1c')](/ (.+)/);if(_0x9184bb[0x1]){return _0x9184bb;}}return[_0x3ef88a,_0x3ef88a];}var accountsTokens={};function getAccessToken(_0x56bf3f){return new Promise(function(_0x4d1b67,_0x4220c4){if(!_[_0xf125('0x1d')](accountsTokens[_0x56bf3f['id']])&&!_['isNil'](accountsTokens[_0x56bf3f['id']][_0xf125('0x1e')])){if(moment()[_0xf125('0x1f')](accountsTokens[_0x56bf3f['id']][_0xf125('0x20')])){_0x4d1b67(accountsTokens[_0x56bf3f['id']][_0xf125('0x1e')]);}}var _0x68a5e2;switch(_0x56bf3f[_0xf125('0x21')]){case'US':_0x68a5e2=_0xf125('0x22');break;case'AU':_0x68a5e2='https://accounts.zoho.com.au';break;case'EU':_0x68a5e2=_0xf125('0x23');break;case'IN':_0x68a5e2=_0xf125('0x24');break;case'CN':_0x68a5e2=_0xf125('0x25');break;default:_0x68a5e2=_0xf125('0x23');break;}var _0x53df23={'method':'POST','uri':_0x68a5e2+_0xf125('0x26'),'qs':{'refresh_token':_0x56bf3f[_0xf125('0x27')],'client_id':_0x56bf3f['clientId'],'client_secret':_0x56bf3f['clientSecret'],'grant_type':_0xf125('0x28')},'json':!![]};return rp(_0x53df23)['then'](function(_0x387c6d){accountsTokens[_0x56bf3f['id']]={'access_token':_0x387c6d[_0xf125('0x1e')],'expires_in':moment()['add'](_0x387c6d[_0xf125('0x20')],'seconds')};_0x4d1b67(_0x387c6d[_0xf125('0x1e')]);})[_0xf125('0x29')](function(_0x448525){logger[_0xf125('0x2a')](_0xf125('0x2b'),_0x448525['stack']);_0x4220c4(_0x448525);});});}function getUser(_0x366aa9,_0x219c2c,_0x4f6120,_0xe12891){logger[_0xf125('0x2c')](_0xf125('0x2d'));return request({'method':_0xf125('0x2e'),'uri':util[_0xf125('0x2f')](_0xf125('0x30'),_0x219c2c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf125('0x31')+_0x366aa9},'json':!![]})[_0xf125('0x32')](function(_0x1e6514){if(_0x1e6514[_0xf125('0x33')]){var _0x46a59b=-0x1;if(_['isArrayLikeObject'](_0x1e6514[_0xf125('0x33')])){if(!_[_0xf125('0x1d')](_0xe12891)){_0x46a59b=_['findIndex'](_0x1e6514[_0xf125('0x33')],function(_0x1535ad){return _0x1535ad[_0xf125('0x34')]===_0xe12891;});}if(_0x46a59b>=0x0){logger[_0xf125('0x2c')](_0xf125('0x35'));}else{logger[_0xf125('0x2c')]('Using\x20the\x20admin\x20account!');_0x46a59b=_[_0xf125('0x36')](_0x1e6514['users'],function(_0x47d518){return _0x47d518['profile'][_0xf125('0x19')]===_0xf125('0x37');});}return _0x1e6514['users'][_0x46a59b];}else{if(_0x1e6514['user'][_0xf125('0x38')][_0xf125('0x19')]==='Administrator'){logger[_0xf125('0x2c')](_0xf125('0x39'));user=_0x1e6514[_0xf125('0x3a')];return user;}else{logger['error'](_0xf125('0x3b'),JSON[_0xf125('0xd')](_0x1e6514));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf125('0xd')](_0x1e6514));}}}else{logger[_0xf125('0x2a')]('The\x20failing\x20result\x20is',JSON[_0xf125('0xd')](_0x1e6514));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf125('0xd')](_0x1e6514));}})[_0xf125('0x29')](function(_0x10e4d5){console['error'](_0x10e4d5);});}function getZohoUser(_0x5d2d93,_0xbd4c3c){return new BPromise(function(_0x504d28,_0x3a9d67){request(_0x5d2d93)[_0xf125('0x32')](function(_0x4d9d38){var _0x5bfc17=null;if(_0x4d9d38){_0x5bfc17=_0x4d9d38[_0xf125('0x3c')][0x0];_0x5bfc17['enduserType']=_0xbd4c3c;}_0x504d28(_0x5bfc17);})[_0xf125('0x29')](function(_0x53c63b){_0x3a9d67(_0x53c63b);});});}function createEndUser(_0x4810d4,_0x1a4fa6,_0x4a44ba,_0x22c86d,_0xef7311,_0x5cc2c2){var _0x4a44ba=getName(_0x4a44ba);return request({'method':_0xf125('0x3d'),'uri':_0xf125('0x3e')+_0x1a4fa6+_0xf125('0x3f')+_[_0xf125('0x40')](_0x5cc2c2[_0xf125('0x41')])+'s','body':{'data':[{'Last_Name':_0x4a44ba[0x1],'First_Name':_0x4a44ba[0x0],'Phone':_0x22c86d,'Owner':{'name':!_['isNil'](_0xef7311[_0xf125('0x42')][_0xf125('0x19')])?_0xef7311[_0xf125('0x42')][_0xf125('0x19')]:!_[_0xf125('0x1d')](_0xef7311[_0xf125('0x43')])?_0xef7311[_0xf125('0x43')]+'\x20'+_0xef7311['last_name']:_0xef7311[_0xf125('0x44')],'id':_0xef7311['id']}}]},'headers':{'Authorization':_0xf125('0x31')+_0x4810d4},'json':!![]})['then'](function(_0x1a223f){if(_0x1a223f&&_0x1a223f['data'][0x0][_0xf125('0x45')]===_0xf125('0x46')){var _0x4074d7=_0x1a223f['data'][0x0][_0xf125('0x47')];_0x4074d7[_0xf125('0x48')]=_[_0xf125('0x40')](_0x5cc2c2['moduleCreate'])+'s';return _0x4074d7;}logger['error'](_0xf125('0x3b'),JSON[_0xf125('0xd')](data));throw new Error(_0xf125('0x49')+JSON[_0xf125('0xd')](data));})[_0xf125('0x29')](function(_0x84cdc0){console[_0xf125('0x4a')]('CREATE\x20ERROR',_0x84cdc0);});}function getEndUser(_0x2037d2,_0x28d97d,_0x564448,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788){var _0x433206={'method':_0xf125('0x2e'),'uri':'','headers':{'Authorization':_0xf125('0x31')+_0x2037d2},'json':!![]};switch(_0x4b0788[_0xf125('0x4b')]){case _0xf125('0x4c'):_0x433206[_0xf125('0x4d')]='https://www.zohoapis.'+_0x28d97d+_0xf125('0x4e')+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x4f'))['then'](function(_0x143ce4){if(_0x143ce4)return _0x143ce4;_0x433206['uri']='https://www.zohoapis.'+_0x28d97d+_0xf125('0x50')+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x51'))[_0xf125('0x32')](function(_0x447862){if(_0x447862)return _0x447862;if(_0x4b0788[_0xf125('0x41')]!=_0xf125('0x52')){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});});break;case _0xf125('0x53'):_0x433206[_0xf125('0x4d')]=_0xf125('0x3e')+_0x28d97d+_0xf125('0x4e')+_0x55f3a6+'))';return getZohoUser(_0x433206,'Contacts')[_0xf125('0x32')](function(_0x3778a4){if(_0x3778a4)return _0x3778a4;if(_0x4b0788[_0xf125('0x41')]!='nothing'){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});break;case'lead':_0x433206[_0xf125('0x4d')]=_0xf125('0x3e')+_0x28d97d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x51'))[_0xf125('0x32')](function(_0x5e4d05){if(_0x5e4d05)return _0x5e4d05;if(_0x4b0788['moduleCreate']!=_0xf125('0x52')){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});break;}}function getCall(_0x9e6faa,_0x23e321,_0x3c80a2,_0x6dbcbf,_0x18d616,_0xe5ede9,_0x481c33,_0x23964a){logger[_0xf125('0x2c')](_0xf125('0x54'));var _0x2b9018={};_0x2b9018[_0xf125('0x55')]={'name':!_[_0xf125('0x1d')](_0x6dbcbf[_0xf125('0x42')][_0xf125('0x19')])&&!_[_0xf125('0x1d')](_0x6dbcbf[_0xf125('0x38')]['name'])&&_0x6dbcbf['profile']['name']===_0xf125('0x56')?_0x6dbcbf[_0xf125('0x42')][_0xf125('0x19')]:!_['isNil'](_0x6dbcbf[_0xf125('0x43')])?_0x6dbcbf['first_name']+'\x20'+_0x6dbcbf[_0xf125('0x44')]:_0x6dbcbf[_0xf125('0x44')],'id':_0x6dbcbf['id']};_0x2b9018[_0xf125('0x57')]=intUtil['getString'](_0xe5ede9[_0xf125('0x58')],_0x481c33,'\x20');_0x2b9018[_0xf125('0x59')]=intUtil[_0xf125('0x5a')](_0xe5ede9[_0xf125('0x5b')],_0x481c33,'\x0a');if(_0x18d616[_0xf125('0x48')]===_0xf125('0x4f')){_0x2b9018['Who_Id']={'name':!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5c')])?_0x18d616[_0xf125('0x5c')]:!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5d')])?_0x18d616[_0xf125('0x5d')]+'\x20'+_0x18d616[_0xf125('0x5e')]:_0x18d616[_0xf125('0x5e')],'id':_0x18d616['id']};}if(_0x18d616[_0xf125('0x48')]===_0xf125('0x51')){_0x2b9018[_0xf125('0x5f')]={'name':!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5c')])?_0x18d616[_0xf125('0x5c')]:!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5d')])?_0x18d616[_0xf125('0x5d')]+'\x20'+_0x18d616[_0xf125('0x5e')]:_0x18d616[_0xf125('0x5e')],'id':_0x18d616['id']};_0x2b9018[_0xf125('0x60')]=_['startCase'](_0x18d616['enduserType']);}if(_0x481c33['talktime']){_0x2b9018[_0xf125('0x61')]=moment[_0xf125('0x62')](parseInt(_0x481c33[_0xf125('0x63')])*0x3e8)[_0xf125('0x2f')](_0xf125('0x64'));}else if(_0x481c33[_0xf125('0x65')]&&_0x481c33[_0xf125('0x66')]){_0x2b9018[_0xf125('0x61')]=moment[_0xf125('0x62')](moment(_0x481c33[_0xf125('0x66')],_0xf125('0x67'))['diff'](moment(_0x481c33[_0xf125('0x68')],_0xf125('0x67'))))[_0xf125('0x2f')](_0xf125('0x64'));}switch(_0x481c33[_0xf125('0x69')]){case _0xf125('0x6a'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x6c');break;case _0xf125('0x6d'):case _0xf125('0x6e'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x6f');break;case _0xf125('0x70'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x71');break;case'abandoned':_0x2b9018[_0xf125('0x6b')]='Abandoned';break;case _0xf125('0x72'):_0x2b9018['Call_Result']=_0xf125('0x73');default:}_0x2b9018['Call_Start_Time']=(_0x23964a===_0xf125('0x74')?moment(_0x481c33[_0xf125('0x68')])[_0xf125('0x2f')](_0xf125('0x67')):moment(_0x481c33[_0xf125('0x75')])[_0xf125('0x2f')](_0xf125('0x67')))||moment()['format'](_0xf125('0x67'));_0x2b9018['Call_Type']=_0x23964a||_0xf125('0x76');_0x2b9018=_[_0xf125('0x77')](_0x2b9018,getCustomFields(_0xe5ede9[_0xf125('0x78')],_0x481c33));return request({'method':_0xf125('0x3d'),'uri':'https://www.zohoapis.'+_0x23e321+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9e6faa},'body':{'data':[_0x2b9018]},'json':!![]})[_0xf125('0x32')](function(_0x19c9b8){if(_0x19c9b8&&_0x19c9b8['data'][0x0][_0xf125('0x45')]==='SUCCESS'){logger[_0xf125('0x2c')]('Call\x20created!');return{'id':_0x19c9b8['data'][0x0]['details']['id']};}})[_0xf125('0x29')](function(_0xaf582){logger[_0xf125('0x2c')](_0xf125('0x79'),_0xaf582[_0xf125('0x7a')]);console['log'](_0xf125('0x79'),_0xaf582);});}exports[_0xf125('0x7b')]=function(_0x56712e,_0x33a25b,_0x1c0506,_0x22aee0,_0x106148,_0x24cc9d){var _0x266855,_0x2ce2c1,_0x3c68fc;_0x24cc9d[_0xf125('0x7c')]=intUtil['stripTrailingSlash'](_0x24cc9d[_0xf125('0x7c')]);_0x24cc9d[_0xf125('0x7d')]=intUtil[_0xf125('0x7e')](_0x24cc9d['serverUrl']);if(_0x106148&&_0x106148[_0xf125('0x7f')]){logger[_0xf125('0x2c')](_0xf125('0x80'),_0xf125('0x81'));_0x33a25b[_0xf125('0x82')]=_0x24cc9d['serverUrl']+_0xf125('0x83')+_0x33a25b[_0xf125('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x33a25b[_0xf125('0x84')]);}else{_0x33a25b[_0xf125('0x82')]='';}var _0x4d3767=_0x24cc9d['host']===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x24cc9d)[_0xf125('0x32')](function(_0x46aaab){_0x3c68fc=_0x46aaab;return getUser(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x22aee0[_0xf125('0x34')]);})[_0xf125('0x32')](function(_0x30a291){_0x266855=_0x30a291;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x266855['id']);return getEndUser(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x33a25b['calleridname'],_0x33a25b[_0xf125('0x87')],_0x266855,_0x1c0506);})[_0xf125('0x32')](function(_0x255b51){_0x2ce2c1=_0x255b51;return getCall(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x266855,_0x2ce2c1,_0x1c0506,_0x33a25b,_0xf125('0x76'));})[_0xf125('0x32')](function(_0x12ed08){if(_0x12ed08){logger[_0xf125('0x2c')](_0xf125('0x88'),_0x12ed08['id']);logger[_0xf125('0x2c')]('[QUEUE]',_0xf125('0x89'));emit(util[_0xf125('0x2f')](_0xf125('0x8a'),_0x22aee0[_0xf125('0x19')]),_0xf125('0x8b'),{'uri':_0xf125('0x8c')+_0x24cc9d[_0xf125('0x7c')]+_0xf125('0x8d')+_0x12ed08['id']});}})[_0xf125('0x29')](function(_0x1fa4ab){logger[_0xf125('0x2a')](_0xf125('0x80'),JSON['stringify'](_0x1fa4ab));});};exports[_0xf125('0x74')]=function(_0x3536e7,_0x3d276f,_0x13c382,_0x169e1c,_0x460af1,_0x220dd7,_0x21af61){var _0x333ffc,_0x119622,_0x1dfb52;_0x220dd7[_0xf125('0x7c')]=intUtil[_0xf125('0x7e')](_0x220dd7['host']);_0x220dd7[_0xf125('0x7d')]=intUtil[_0xf125('0x7e')](_0x220dd7[_0xf125('0x7d')]);if(_0x21af61&&_0x21af61[_0xf125('0x8e')]&&_0x21af61[_0xf125('0x8e')]!==_0xf125('0x8f')){logger[_0xf125('0x2c')](_0xf125('0x90'),_0xf125('0x81'));_0x3d276f[_0xf125('0x82')]=_0x220dd7['serverUrl']+_0xf125('0x83')+_0x3d276f['uniqueid']+_0xf125('0x91')+md5(_0x3d276f[_0xf125('0x84')]);}var _0x492a0e=_0x220dd7[_0xf125('0x7c')]===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x220dd7)[_0xf125('0x32')](function(_0x3480ba){_0x1dfb52=_0x3480ba;return getUser(_0x1dfb52,_0x492a0e,_0x220dd7,_0x169e1c['email']);})[_0xf125('0x32')](function(_0x59acf9){_0x333ffc=_0x59acf9;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x333ffc['id']);return getEndUser(_0x1dfb52,_0x492a0e,_0x220dd7,_0x3d276f[_0xf125('0x92')],_0x3d276f[_0xf125('0x93')],_0x333ffc,_0x13c382);})['then'](function(_0x5de69b){_0x119622=_0x5de69b;return getCall(_0x1dfb52,_0x492a0e,_0x220dd7,_0x333ffc,_0x119622,_0x13c382,_0x3d276f,'Outbound');})['then'](function(_0x2846f6){if(_0x2846f6){logger[_0xf125('0x2c')](_0xf125('0x88'),_0x2846f6['id']);logger['info'](_0xf125('0x90'),_0xf125('0x89'));emit(util[_0xf125('0x2f')](_0xf125('0x8a'),_0x169e1c[_0xf125('0x19')]),_0xf125('0x8b'),{'uri':_0xf125('0x8c')+_0x220dd7[_0xf125('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2846f6['id']});}})[_0xf125('0x29')](function(_0x7182e3){logger['error'](_0xf125('0x90'),JSON[_0xf125('0xd')](_0x7182e3));});};exports[_0xf125('0x94')]=function(_0xacc159,_0x216ca4,_0x32c15d,_0x445499,_0x4f25bb,_0x559852){var _0x476738,_0x111a14,_0x1af9e4;_0x559852['host']=intUtil[_0xf125('0x7e')](_0x559852[_0xf125('0x7c')]);_0x559852['serverUrl']=intUtil[_0xf125('0x7e')](_0x559852['serverUrl']);if(_0x4f25bb&&_0x4f25bb['monitor_format']){logger[_0xf125('0x2c')]('['+_0x216ca4[_0xf125('0x69')][_0xf125('0x95')]()+']',_0xf125('0x81'));_0x216ca4['recordingURL']=_0x559852[_0xf125('0x7d')]+_0xf125('0x83')+_0x216ca4[_0xf125('0x84')]+_0xf125('0x91')+md5(_0x216ca4[_0xf125('0x84')]);}else{_0x216ca4[_0xf125('0x82')]='';}var _0x438727=_0x559852['host']===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x559852)[_0xf125('0x32')](function(_0x5c1813){_0x1af9e4=_0x5c1813;return getUser(_0x1af9e4,_0x438727,_0x559852);})[_0xf125('0x32')](function(_0x15a90a){_0x476738=_0x15a90a;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x476738['id']);return getEndUser(_0x1af9e4,_0x438727,_0x559852,_0x216ca4[_0xf125('0x96')],_0x216ca4['calleridnum'],_0x476738,_0x32c15d);})[_0xf125('0x32')](function(_0x423890){_0x111a14=_0x423890;return getCall(_0x1af9e4,_0x438727,_0x559852,_0x476738,_0x111a14,_0x32c15d,_0x216ca4,'Inbound');})[_0xf125('0x32')](function(_0x51d271){if(_0x51d271){logger['info'](_0xf125('0x88'),_0x51d271['id']);}})[_0xf125('0x29')](function(_0x5157ae){logger['error']('['+_0x216ca4[_0xf125('0x69')][_0xf125('0x95')]()+']',JSON['stringify'](_0x5157ae));});}; \ No newline at end of file +var _0x7560=['details','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','zoho.eu','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','forEach','string','idField','toString','variable','variableName','type','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','log','CREATE\x20ERROR','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','profile','administrator','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','Rejected','timeout','Timeout','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','Call\x20created!'];(function(_0x10c96a,_0x11a299){var _0x25754d=function(_0x5a1dc8){while(--_0x5a1dc8){_0x10c96a['push'](_0x10c96a['shift']());}};_0x25754d(++_0x11a299);}(_0x7560,0x1ee));var _0x0756=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x7560[_0x267c52];return _0x46c47b;};'use strict';var _=require('lodash');var rp=require(_0x0756('0x0'));var md5=require(_0x0756('0x1'));var util=require('util');var intUtil=require(_0x0756('0x2'));var moment=require(_0x0756('0x3'));var Redis=require(_0x0756('0x4'));var BPromise=require(_0x0756('0x5'));var config=require(_0x0756('0x6'));var logger=require(_0x0756('0x7'))(_0x0756('0x8'));config[_0x0756('0x9')]=_[_0x0756('0xa')](config[_0x0756('0x9')],{'host':_0x0756('0xb'),'port':0x18eb});var io=require(_0x0756('0xc'))(new Redis(config[_0x0756('0x9')]));function emit(_0xa7002e,_0x5d90cf,_0x49ee78){io['to'](_0xa7002e)[_0x0756('0xd')](_0x5d90cf,_0x49ee78);}function request(_0x691384){logger[_0x0756('0xe')]('[HTTP]',JSON['stringify'](_0x691384));return rp(_0x691384);}function getCustomFields(_0x754a29,_0x4ba14c){var _0x529307={};if(_0x754a29['length']>0x0){_[_0x0756('0xf')](_0x754a29,function(_0x3644dd){if(_['includes']([_0x0756('0x10'),'picklist'],_0x3644dd['type'])&&_0x3644dd[_0x0756('0x11')]){_0x529307[_0x3644dd[_0x0756('0x11')]]=_0x3644dd['content'][_0x0756('0x12')]();}else if(_0x3644dd['type']===_0x0756('0x13')&&_0x3644dd[_0x0756('0x14')]&&_0x3644dd['idField']&&_0x4ba14c[_0x3644dd[_0x0756('0x14')]]){_0x529307[_0x3644dd[_0x0756('0x11')]]=_0x4ba14c[_0x3644dd[_0x0756('0x14')]]['toString']();}else if(_0x3644dd[_0x0756('0x15')]===_0x0756('0x16')&&_0x3644dd['Variable']&&_0x3644dd['Variable'][_0x0756('0x17')]&&_0x3644dd['idField']&&_0x4ba14c[_0x3644dd[_0x0756('0x18')][_0x0756('0x17')]['toLowerCase']()]){_0x529307[_0x3644dd[_0x0756('0x11')]]=_0x4ba14c[_0x3644dd[_0x0756('0x18')][_0x0756('0x17')][_0x0756('0x19')]()][_0x0756('0x12')]();}});}return _0x529307;}function getName(_0x52da2c){if(_0x52da2c[_0x0756('0x1a')]('\x20')>0x0){var _0x403bcd=_0x52da2c[_0x0756('0x1b')](/ (.+)/);if(_0x403bcd[0x1]){return _0x403bcd;}}return[_0x52da2c,_0x52da2c];}var accountsTokens={};function getAccessToken(_0x25d494){return new Promise(function(_0x15c486,_0x1d7506){if(!_[_0x0756('0x1c')](accountsTokens[_0x25d494['id']])&&!_[_0x0756('0x1c')](accountsTokens[_0x25d494['id']][_0x0756('0x1d')])){if(moment()[_0x0756('0x1e')](accountsTokens[_0x25d494['id']][_0x0756('0x1f')])){_0x15c486(accountsTokens[_0x25d494['id']][_0x0756('0x1d')]);}}var _0x38f0dd;switch(_0x25d494[_0x0756('0x20')]){case'US':_0x38f0dd='https://accounts.zoho.com';break;case'AU':_0x38f0dd=_0x0756('0x21');break;case'EU':_0x38f0dd=_0x0756('0x22');break;case'IN':_0x38f0dd='https://accounts.zoho.in';break;case'CN':_0x38f0dd=_0x0756('0x23');break;default:_0x38f0dd=_0x0756('0x22');break;}var _0x24fee3={'method':_0x0756('0x24'),'uri':_0x38f0dd+_0x0756('0x25'),'qs':{'refresh_token':_0x25d494[_0x0756('0x26')],'client_id':_0x25d494[_0x0756('0x27')],'client_secret':_0x25d494[_0x0756('0x28')],'grant_type':_0x0756('0x29')},'json':!![]};return rp(_0x24fee3)[_0x0756('0x2a')](function(_0x583b8f){accountsTokens[_0x25d494['id']]={'access_token':_0x583b8f[_0x0756('0x1d')],'expires_in':moment()[_0x0756('0x2b')](_0x583b8f[_0x0756('0x1f')],_0x0756('0x2c'))};_0x15c486(_0x583b8f[_0x0756('0x1d')]);})[_0x0756('0x2d')](function(_0x823459){logger[_0x0756('0x2e')](_0x0756('0x2f'),_0x823459[_0x0756('0x30')]);_0x1d7506(_0x823459);});});}function getUser(_0xf9fafe,_0x40ff2d,_0x42d71d,_0x423d67){logger[_0x0756('0x31')](_0x0756('0x32'));return request({'method':_0x0756('0x33'),'uri':util[_0x0756('0x34')](_0x0756('0x35'),_0x40ff2d),'qs':{'type':_0x0756('0x36')},'headers':{'Authorization':_0x0756('0x37')+_0xf9fafe},'json':!![]})[_0x0756('0x2a')](function(_0x35837d){if(_0x35837d[_0x0756('0x38')]){var _0x5b4230=-0x1;if(_[_0x0756('0x39')](_0x35837d[_0x0756('0x38')])){if(!_[_0x0756('0x1c')](_0x423d67)){_0x5b4230=_[_0x0756('0x3a')](_0x35837d[_0x0756('0x38')],function(_0x1f1522){return _0x1f1522[_0x0756('0x3b')]===_0x423d67;});}if(_0x5b4230>=0x0){logger[_0x0756('0x31')](_0x0756('0x3c'));}else{logger[_0x0756('0x31')](_0x0756('0x3d'));_0x5b4230=_[_0x0756('0x3a')](_0x35837d[_0x0756('0x38')],function(_0x1da516){return _0x1da516['profile']['name']===_0x0756('0x3e');});}return _0x35837d['users'][_0x5b4230];}else{if(_0x35837d[_0x0756('0x3f')]['profile']['name']===_0x0756('0x3e')){logger[_0x0756('0x31')](_0x0756('0x3d'));user=_0x35837d[_0x0756('0x3f')];return user;}else{logger['error'](_0x0756('0x40'),JSON[_0x0756('0x41')](_0x35837d));throw new Error(_0x0756('0x42')+JSON['stringify'](_0x35837d));}}}else{logger[_0x0756('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x0756('0x41')](_0x35837d));throw new Error(_0x0756('0x42')+JSON[_0x0756('0x41')](_0x35837d));}})[_0x0756('0x2d')](function(_0x48b4ab){console[_0x0756('0x2e')](_0x48b4ab);});}function getZohoUser(_0x3a1fcd,_0x4cdba6){return new BPromise(function(_0xebd34b,_0x2620a6){request(_0x3a1fcd)[_0x0756('0x2a')](function(_0x194bae){var _0x31cff3=null;if(_0x194bae){_0x31cff3=_0x194bae[_0x0756('0x43')][0x0];_0x31cff3[_0x0756('0x44')]=_0x4cdba6;}_0xebd34b(_0x31cff3);})[_0x0756('0x2d')](function(_0x476fb1){_0x2620a6(_0x476fb1);});});}function createEndUser(_0x1be530,_0x19ddb9,_0x4da439,_0x45128a,_0x109a7d,_0x287421){var _0x4da439=getName(_0x4da439);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x19ddb9+_0x0756('0x45')+_[_0x0756('0x46')](_0x287421[_0x0756('0x47')])+'s','body':{'data':[{'Last_Name':_0x4da439[0x1],'First_Name':_0x4da439[0x0],'Phone':_0x45128a,'Owner':{'name':!_['isNil'](_0x109a7d[_0x0756('0x48')][_0x0756('0x17')])?_0x109a7d[_0x0756('0x48')][_0x0756('0x17')]:!_[_0x0756('0x1c')](_0x109a7d['first_name'])?_0x109a7d[_0x0756('0x49')]+'\x20'+_0x109a7d['last_name']:_0x109a7d[_0x0756('0x4a')],'id':_0x109a7d['id']}}]},'headers':{'Authorization':_0x0756('0x37')+_0x1be530},'json':!![]})[_0x0756('0x2a')](function(_0x46f392){if(_0x46f392&&_0x46f392['data'][0x0][_0x0756('0x4b')]===_0x0756('0x4c')){var _0xafffe5=_0x46f392[_0x0756('0x43')][0x0]['details'];_0xafffe5[_0x0756('0x44')]=_[_0x0756('0x46')](_0x287421[_0x0756('0x47')])+'s';return _0xafffe5;}logger['error'](_0x0756('0x40'),JSON[_0x0756('0x41')](data));throw new Error('Error:\x20'+JSON[_0x0756('0x41')](data));})['catch'](function(_0x7d4142){console[_0x0756('0x4d')](_0x0756('0x4e'),_0x7d4142);});}function getEndUser(_0x38c424,_0x4b70ff,_0x56bf74,_0x284779,_0x4a1f9a,_0x5f1fd8,_0x3fa68f){var _0x42fa18={'method':'GET','uri':'','headers':{'Authorization':_0x0756('0x37')+_0x38c424},'json':!![]};switch(_0x3fa68f[_0x0756('0x4f')]){case'contact_lead':_0x42fa18[_0x0756('0x50')]=_0x0756('0x51')+_0x4b70ff+_0x0756('0x52')+_0x4a1f9a+'))';return getZohoUser(_0x42fa18,_0x0756('0x53'))[_0x0756('0x2a')](function(_0x4bef29){if(_0x4bef29)return _0x4bef29;_0x42fa18[_0x0756('0x50')]='https://www.zohoapis.'+_0x4b70ff+_0x0756('0x54')+_0x4a1f9a+'))';return getZohoUser(_0x42fa18,_0x0756('0x55'))[_0x0756('0x2a')](function(_0x6f7e91){if(_0x6f7e91)return _0x6f7e91;if(_0x3fa68f[_0x0756('0x47')]!=_0x0756('0x56')){return createEndUser(_0x38c424,_0x4b70ff,_0x284779,_0x4a1f9a,_0x5f1fd8,_0x3fa68f);}else{return{};}});});break;case _0x0756('0x57'):_0x42fa18[_0x0756('0x50')]=_0x0756('0x51')+_0x4b70ff+_0x0756('0x52')+_0x4a1f9a+'))';return getZohoUser(_0x42fa18,'Contacts')[_0x0756('0x2a')](function(_0x12e018){if(_0x12e018)return _0x12e018;if(_0x3fa68f['moduleCreate']!=_0x0756('0x56')){return createEndUser(_0x38c424,_0x4b70ff,_0x284779,_0x4a1f9a,_0x5f1fd8,_0x3fa68f);}else{return{};}});break;case'lead':_0x42fa18[_0x0756('0x50')]=_0x0756('0x51')+_0x4b70ff+_0x0756('0x54')+_0x4a1f9a+'))';return getZohoUser(_0x42fa18,'Leads')[_0x0756('0x2a')](function(_0x2f9279){if(_0x2f9279)return _0x2f9279;if(_0x3fa68f[_0x0756('0x47')]!='nothing'){return createEndUser(_0x38c424,_0x4b70ff,_0x284779,_0x4a1f9a,_0x5f1fd8,_0x3fa68f);}else{return{};}});break;}}function getCall(_0x419893,_0x3e83ba,_0x4785bd,_0xde4d6b,_0x57d647,_0x9f52ac,_0x11c02f,_0x4eedbd){logger[_0x0756('0x31')](_0x0756('0x58'));var _0x3933a5={};_0x3933a5['Owner']={'name':!_['isNil'](_0xde4d6b[_0x0756('0x48')][_0x0756('0x17')])&&!_['isNil'](_0xde4d6b[_0x0756('0x59')][_0x0756('0x17')])&&_0xde4d6b['profile']['name']===_0x0756('0x5a')?_0xde4d6b['role'][_0x0756('0x17')]:!_[_0x0756('0x1c')](_0xde4d6b[_0x0756('0x49')])?_0xde4d6b[_0x0756('0x49')]+'\x20'+_0xde4d6b[_0x0756('0x4a')]:_0xde4d6b[_0x0756('0x4a')],'id':_0xde4d6b['id']};_0x3933a5['Subject']=intUtil[_0x0756('0x5b')](_0x9f52ac[_0x0756('0x5c')],_0x11c02f,'\x20');_0x3933a5[_0x0756('0x5d')]=intUtil[_0x0756('0x5b')](_0x9f52ac[_0x0756('0x5e')],_0x11c02f,'\x0a');if(_0x57d647[_0x0756('0x44')]==='Contacts'){_0x3933a5[_0x0756('0x5f')]={'name':!_[_0x0756('0x1c')](_0x57d647['Full_Name'])?_0x57d647['Full_Name']:!_[_0x0756('0x1c')](_0x57d647[_0x0756('0x60')])?_0x57d647[_0x0756('0x60')]+'\x20'+_0x57d647['Last_Name']:_0x57d647[_0x0756('0x61')],'id':_0x57d647['id']};}if(_0x57d647[_0x0756('0x44')]==='Leads'){_0x3933a5['What_Id']={'name':!_['isNil'](_0x57d647['Full_Name'])?_0x57d647[_0x0756('0x62')]:!_[_0x0756('0x1c')](_0x57d647['First_Name'])?_0x57d647['First_Name']+'\x20'+_0x57d647['Last_Name']:_0x57d647['Last_Name'],'id':_0x57d647['id']};_0x3933a5[_0x0756('0x63')]=_[_0x0756('0x46')](_0x57d647[_0x0756('0x44')]);}if(_0x11c02f[_0x0756('0x64')]){_0x3933a5[_0x0756('0x65')]=moment[_0x0756('0x66')](parseInt(_0x11c02f[_0x0756('0x64')])*0x3e8)[_0x0756('0x34')](_0x0756('0x67'));}else if(_0x11c02f[_0x0756('0x68')]&&_0x11c02f[_0x0756('0x69')]){_0x3933a5[_0x0756('0x65')]=moment[_0x0756('0x66')](moment(_0x11c02f[_0x0756('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x0756('0x6a')](moment(_0x11c02f[_0x0756('0x6b')],_0x0756('0x6c'))))[_0x0756('0x34')](_0x0756('0x67'));}switch(_0x11c02f[_0x0756('0x6d')]){case _0x0756('0x6e'):_0x3933a5[_0x0756('0x6f')]=_0x0756('0x70');break;case'complete':case _0x0756('0x71'):_0x3933a5[_0x0756('0x6f')]='Answered';break;case'rejected':_0x3933a5[_0x0756('0x6f')]=_0x0756('0x72');break;case'abandoned':_0x3933a5['Call_Result']='Abandoned';break;case _0x0756('0x73'):_0x3933a5[_0x0756('0x6f')]=_0x0756('0x74');default:}_0x3933a5['Call_Start_Time']=(_0x4eedbd==='outbound'?moment(_0x11c02f[_0x0756('0x6b')])[_0x0756('0x34')](_0x0756('0x6c')):moment(_0x11c02f[_0x0756('0x75')])[_0x0756('0x34')](_0x0756('0x6c')))||moment()[_0x0756('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x3933a5[_0x0756('0x76')]=_0x4eedbd||'Inbound';_0x3933a5=_['merge'](_0x3933a5,getCustomFields(_0x9f52ac[_0x0756('0x77')],_0x11c02f));return request({'method':'POST','uri':_0x0756('0x51')+_0x3e83ba+_0x0756('0x78'),'headers':{'Authorization':_0x0756('0x37')+_0x419893},'body':{'data':[_0x3933a5]},'json':!![]})[_0x0756('0x2a')](function(_0x3d5254){if(_0x3d5254&&_0x3d5254['data'][0x0][_0x0756('0x4b')]===_0x0756('0x4c')){logger[_0x0756('0x31')](_0x0756('0x79'));return{'id':_0x3d5254['data'][0x0][_0x0756('0x7a')]['id']};}})[_0x0756('0x2d')](function(_0x55aedd){logger[_0x0756('0x31')]('err',_0x55aedd[_0x0756('0x30')]);console['log']('err',_0x55aedd);});}exports[_0x0756('0x7b')]=function(_0x19185c,_0x252972,_0x221ac0,_0xdaef22,_0x138d1a,_0x558a8d){var _0x569a4b,_0x5a2c81,_0x53d246;_0x558a8d['host']=intUtil[_0x0756('0x7c')](_0x558a8d['host']);_0x558a8d[_0x0756('0x7d')]=intUtil[_0x0756('0x7c')](_0x558a8d['serverUrl']);if(_0x138d1a&&_0x138d1a[_0x0756('0x7e')]){logger[_0x0756('0x31')](_0x0756('0x7f'),_0x0756('0x80'));_0x252972[_0x0756('0x81')]=_0x558a8d['serverUrl']+_0x0756('0x82')+_0x252972[_0x0756('0x83')]+_0x0756('0x84')+md5(_0x252972['uniqueid']);}else{_0x252972['recordingURL']='';}var _0x4b9738=_0x558a8d[_0x0756('0x85')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x558a8d)[_0x0756('0x2a')](function(_0x1cdf30){_0x53d246=_0x1cdf30;return getUser(_0x53d246,_0x4b9738,_0x558a8d,_0xdaef22['email']);})['then'](function(_0x561610){_0x569a4b=_0x561610;logger[_0x0756('0x31')](_0x0756('0x86'),_0x569a4b['id']);return getEndUser(_0x53d246,_0x4b9738,_0x558a8d,_0x252972[_0x0756('0x87')],_0x252972[_0x0756('0x88')],_0x569a4b,_0x221ac0);})[_0x0756('0x2a')](function(_0x3c4b6f){_0x5a2c81=_0x3c4b6f;return getCall(_0x53d246,_0x4b9738,_0x558a8d,_0x569a4b,_0x5a2c81,_0x221ac0,_0x252972,_0x0756('0x89'));})[_0x0756('0x2a')](function(_0x510613){if(_0x510613){logger[_0x0756('0x31')](_0x0756('0x8a'),_0x510613['id']);logger['info'](_0x0756('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0756('0x8b'),_0xdaef22[_0x0756('0x17')]),'trigger:browser:url',{'uri':_0x0756('0x8c')+_0x558a8d[_0x0756('0x85')]+_0x0756('0x8d')+_0x510613['id']});}})[_0x0756('0x2d')](function(_0x162ee6){logger[_0x0756('0x2e')](_0x0756('0x7f'),JSON['stringify'](_0x162ee6));});};exports['outbound']=function(_0x1923d7,_0x5ae06e,_0x4b39d2,_0x39b2fb,_0x589787,_0x5b2d9e,_0x27d1e9){var _0x122f35,_0x100f4c,_0x159fa4;_0x5b2d9e['host']=intUtil['stripTrailingSlash'](_0x5b2d9e[_0x0756('0x85')]);_0x5b2d9e[_0x0756('0x7d')]=intUtil[_0x0756('0x7c')](_0x5b2d9e[_0x0756('0x7d')]);if(_0x27d1e9&&_0x27d1e9[_0x0756('0x8e')]&&_0x27d1e9['recordingFormat']!==_0x0756('0x8f')){logger[_0x0756('0x31')](_0x0756('0x90'),_0x0756('0x80'));_0x5ae06e[_0x0756('0x81')]=_0x5b2d9e[_0x0756('0x7d')]+_0x0756('0x82')+_0x5ae06e[_0x0756('0x83')]+_0x0756('0x84')+md5(_0x5ae06e[_0x0756('0x83')]);}var _0x32ae3d=_0x5b2d9e[_0x0756('0x85')]==='zoho.eu'?'eu':_0x0756('0x91');return getAccessToken(_0x5b2d9e)['then'](function(_0x25e3eb){_0x159fa4=_0x25e3eb;return getUser(_0x159fa4,_0x32ae3d,_0x5b2d9e,_0x39b2fb[_0x0756('0x3b')]);})[_0x0756('0x2a')](function(_0x397ef2){_0x122f35=_0x397ef2;logger[_0x0756('0x31')]('The\x20User\x20ID\x20is:',_0x122f35['id']);return getEndUser(_0x159fa4,_0x32ae3d,_0x5b2d9e,_0x5ae06e[_0x0756('0x92')],_0x5ae06e[_0x0756('0x93')],_0x122f35,_0x4b39d2);})[_0x0756('0x2a')](function(_0x40e388){_0x100f4c=_0x40e388;return getCall(_0x159fa4,_0x32ae3d,_0x5b2d9e,_0x122f35,_0x100f4c,_0x4b39d2,_0x5ae06e,_0x0756('0x94'));})['then'](function(_0x295511){if(_0x295511){logger['info'](_0x0756('0x8a'),_0x295511['id']);logger[_0x0756('0x31')](_0x0756('0x90'),_0x0756('0x95'));emit(util['format']('user:%s',_0x39b2fb[_0x0756('0x17')]),_0x0756('0x96'),{'uri':_0x0756('0x8c')+_0x5b2d9e[_0x0756('0x85')]+_0x0756('0x8d')+_0x295511['id']});}})[_0x0756('0x2d')](function(_0x2e1748){logger['error'](_0x0756('0x90'),JSON['stringify'](_0x2e1748));});};exports[_0x0756('0x97')]=function(_0xd7651a,_0x641538,_0x32b6d9,_0x6557c6,_0x598555,_0x3706ba){var _0x2934cc,_0x1ca264,_0x24c716;_0x3706ba[_0x0756('0x85')]=intUtil[_0x0756('0x7c')](_0x3706ba['host']);_0x3706ba[_0x0756('0x7d')]=intUtil[_0x0756('0x7c')](_0x3706ba[_0x0756('0x7d')]);if(_0x598555&&_0x598555['monitor_format']){logger['info']('['+_0x641538['lastevent'][_0x0756('0x98')]()+']',_0x0756('0x80'));_0x641538['recordingURL']=_0x3706ba[_0x0756('0x7d')]+_0x0756('0x82')+_0x641538[_0x0756('0x83')]+_0x0756('0x84')+md5(_0x641538[_0x0756('0x83')]);}else{_0x641538[_0x0756('0x81')]='';}var _0x28e059=_0x3706ba[_0x0756('0x85')]===_0x0756('0x99')?'eu':_0x0756('0x91');return getAccessToken(_0x3706ba)[_0x0756('0x2a')](function(_0x3eed2f){_0x24c716=_0x3eed2f;return getUser(_0x24c716,_0x28e059,_0x3706ba);})[_0x0756('0x2a')](function(_0x4159b8){_0x2934cc=_0x4159b8;logger[_0x0756('0x31')](_0x0756('0x86'),_0x2934cc['id']);return getEndUser(_0x24c716,_0x28e059,_0x3706ba,_0x641538[_0x0756('0x87')],_0x641538['calleridnum'],_0x2934cc,_0x32b6d9);})['then'](function(_0x16f56e){_0x1ca264=_0x16f56e;return getCall(_0x24c716,_0x28e059,_0x3706ba,_0x2934cc,_0x1ca264,_0x32b6d9,_0x641538,'Inbound');})[_0x0756('0x2a')](function(_0xd6f607){if(_0xd6f607){logger[_0x0756('0x31')](_0x0756('0x8a'),_0xd6f607['id']);}})[_0x0756('0x2d')](function(_0x453afb){logger[_0x0756('0x2e')]('['+_0x641538[_0x0756('0x6d')][_0x0756('0x98')]()+']',JSON[_0x0756('0x41')](_0x453afb));});}; \ 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 86bc459..86b34cc 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 _0x46ee=['shelljs','trigger','data2','Script','render','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x4146e9,_0x22ff8f){var _0x319e01=function(_0x479f15){while(--_0x479f15){_0x4146e9['push'](_0x4146e9['shift']());}};_0x319e01(++_0x22ff8f);}(_0x46ee,0x14f));var _0xe46e=function(_0x576ee6,_0x4b1470){_0x576ee6=_0x576ee6-0x0;var _0x23c039=_0x46ee[_0x576ee6];return _0x23c039;};'use strict';var util=require(_0xe46e('0x0'));var sh=require(_0xe46e('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xe46e('0x2'));exports['exec']=function(_0x4ae563,_0x987468){var _0x868d68=_0x4ae563[_0xe46e('0x3')]?_0x4ae563[_0xe46e('0x3')]:_0xe46e('0x4');var _0x523dd0=_0x4ae563['data3']?Mustache[_0xe46e('0x5')](_0x4ae563[_0xe46e('0x6')],_0x987468):_0x987468;sh['exec'](_0x523dd0,function(_0x3f98eb,_0x228bcd,_0x1edb96){if(_0x3f98eb!==0x0){logger[_0xe46e('0x7')](util['format'](_0xe46e('0x8'),_0x868d68,_0x523dd0,_0x3f98eb,_0x1edb96));}else{logger[_0xe46e('0x9')](util[_0xe46e('0xa')](_0xe46e('0xb'),_0x868d68,_0x523dd0,_0x228bcd));}});}; \ No newline at end of file +var _0x7bf8=['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','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render'];(function(_0x57012c,_0x457dd9){var _0x3bb06d=function(_0x4d2e72){while(--_0x4d2e72){_0x57012c['push'](_0x57012c['shift']());}};_0x3bb06d(++_0x457dd9);}(_0x7bf8,0x1d2));var _0x87bf=function(_0x1f1762,_0x1c8f2a){_0x1f1762=_0x1f1762-0x0;var _0x3e0c8c=_0x7bf8[_0x1f1762];return _0x3e0c8c;};'use strict';var util=require(_0x87bf('0x0'));var sh=require(_0x87bf('0x1'));var Mustache=require(_0x87bf('0x2'));var logger=require(_0x87bf('0x3'))(_0x87bf('0x4'));exports[_0x87bf('0x5')]=function(_0x3756fe,_0x4f23aa){var _0x2ebb29=_0x3756fe[_0x87bf('0x6')]?_0x3756fe[_0x87bf('0x6')]:_0x87bf('0x7');var _0x558eb6=_0x3756fe[_0x87bf('0x8')]?Mustache[_0x87bf('0x9')](_0x3756fe['data3'],_0x4f23aa):_0x4f23aa;sh[_0x87bf('0x5')](_0x558eb6,function(_0x598299,_0x2a4e70,_0x37b426){if(_0x598299!==0x0){logger[_0x87bf('0xa')](util[_0x87bf('0xb')](_0x87bf('0xc'),_0x2ebb29,_0x558eb6,_0x598299,_0x37b426));}else{logger['info'](util['format'](_0x87bf('0xd'),_0x2ebb29,_0x558eb6,_0x2a4e70));}});}; \ 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 9c7bd21..365ad1d 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 _0x9f3d=['name','message','request-promise','util','lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','headers','parse','data6','error','GET','DELETE','POST','PUT','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','then',',\x20request\x20body:\x20','object','stringify','info','format','%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'];(function(_0x5ae117,_0x47a5a6){var _0x7858a=function(_0x25ae03){while(--_0x25ae03){_0x5ae117['push'](_0x5ae117['shift']());}};_0x7858a(++_0x47a5a6);}(_0x9f3d,0xd4));var _0xd9f3=function(_0x197782,_0x41c3b7){_0x197782=_0x197782-0x0;var _0x502d43=_0x9f3d[_0x197782];return _0x502d43;};'use strict';var rp=require(_0xd9f3('0x0'));var util=require(_0xd9f3('0x1'));var _=require(_0xd9f3('0x2'));var Mustache=require(_0xd9f3('0x3'));var logger=require('../../../../config/logger')(_0xd9f3('0x4'));exports[_0xd9f3('0x5')]=function(_0x58755e,_0x3b305c){var _0x7cab3a,_0x59596d;var _0x31e9ee={'method':_0x58755e['data1'][_0xd9f3('0x6')](),'uri':Mustache[_0xd9f3('0x7')](_0x58755e[_0xd9f3('0x8')],_0x3b305c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x58755e['data5'])==='number'&&parseInt(_0x58755e['data5'])>=0x1&&parseInt(_0x58755e[_0xd9f3('0x9')])<=0xa?parseInt(_0x58755e['data5'])*0x3e8:0x5*0x3e8};try{_0x31e9ee[_0xd9f3('0xa')]=_0x58755e['data6']?JSON[_0xd9f3('0xb')](Mustache['render'](_0x58755e[_0xd9f3('0xc')],_0x3b305c)):{};}catch(_0x3bb0e5){logger[_0xd9f3('0xd')](_0x3bb0e5['stack']);}switch(_0x58755e['data1'][_0xd9f3('0x6')]()){case _0xd9f3('0xe'):case _0xd9f3('0xf'):_0x7cab3a=null;_0x31e9ee['qs']=_0x3b305c;break;case _0xd9f3('0x10'):case _0xd9f3('0x11'):if(_0x58755e[_0xd9f3('0x12')]){try{_0x7cab3a=JSON[_0xd9f3('0xb')](Mustache[_0xd9f3('0x7')](_0x58755e[_0xd9f3('0x12')],_0x3b305c));_0x31e9ee['body']=_0x7cab3a;}catch(_0x988212){logger[_0xd9f3('0xd')](_0x988212[_0xd9f3('0x13')]);logger['error'](_0xd9f3('0x14'));}}else{_0x7cab3a=_0x3b305c;_0x31e9ee[_0xd9f3('0x15')]=_0x7cab3a;}break;}logger['info'](util['format'](_0xd9f3('0x16'),_0x58755e[_0xd9f3('0x17')],_0x58755e[_0xd9f3('0x8')],JSON['stringify'](_0x31e9ee)));rp(_0x31e9ee)[_0xd9f3('0x18')](function(_0x3fb108){_0x7cab3a=!_['isNil'](_0x7cab3a)?_0xd9f3('0x19')+_0x7cab3a:'';_0x59596d=typeof _0x3fb108[_0xd9f3('0x15')]===_0xd9f3('0x1a')?JSON[_0xd9f3('0x1b')](_0x3fb108[_0xd9f3('0x15')]):_0x3fb108['body'];logger[_0xd9f3('0x1c')](util[_0xd9f3('0x1d')](_0xd9f3('0x1e'),_0x58755e[_0xd9f3('0x17')],_0x58755e[_0xd9f3('0x8')],_0x3fb108[_0xd9f3('0x1f')],_0x59596d));})['catch'](function(_0x338105){logger['error'](util[_0xd9f3('0x1d')](_0xd9f3('0x20'),_0x58755e[_0xd9f3('0x17')],_0x58755e[_0xd9f3('0x8')],_0x338105[_0xd9f3('0x1f')],_0x338105[_0xd9f3('0x21')],_0x338105[_0xd9f3('0x22')]));});}; \ No newline at end of file +var _0xa2cc=['stringify','isNil',',\x20request\x20body:\x20','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','parse','error','stack','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format'];(function(_0x11bcea,_0x593673){var _0x5db600=function(_0x590bdb){while(--_0x590bdb){_0x11bcea['push'](_0x11bcea['shift']());}};_0x5db600(++_0x593673);}(_0xa2cc,0xef));var _0xca2c=function(_0x34d20c,_0x34abe6){_0x34d20c=_0x34d20c-0x0;var _0x56d278=_0xa2cc[_0x34d20c];return _0x56d278;};'use strict';var rp=require(_0xca2c('0x0'));var util=require(_0xca2c('0x1'));var _=require(_0xca2c('0x2'));var Mustache=require(_0xca2c('0x3'));var logger=require(_0xca2c('0x4'))(_0xca2c('0x5'));exports[_0xca2c('0x6')]=function(_0x10c40e,_0x3c6e64){var _0xc20a4d,_0x4b44f0;var _0x494297={'method':_0x10c40e[_0xca2c('0x7')][_0xca2c('0x8')](),'uri':Mustache[_0xca2c('0x9')](_0x10c40e[_0xca2c('0xa')],_0x3c6e64),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10c40e[_0xca2c('0xb')])==='number'&&parseInt(_0x10c40e['data5'])>=0x1&&parseInt(_0x10c40e[_0xca2c('0xb')])<=0xa?parseInt(_0x10c40e[_0xca2c('0xb')])*0x3e8:0x5*0x3e8};try{_0x494297[_0xca2c('0xc')]=_0x10c40e[_0xca2c('0xd')]?JSON[_0xca2c('0xe')](Mustache[_0xca2c('0x9')](_0x10c40e[_0xca2c('0xd')],_0x3c6e64)):{};}catch(_0xacbc6){logger[_0xca2c('0xf')](_0xacbc6[_0xca2c('0x10')]);}switch(_0x10c40e[_0xca2c('0x7')][_0xca2c('0x8')]()){case _0xca2c('0x11'):case _0xca2c('0x12'):_0xc20a4d=null;_0x494297['qs']=_0x3c6e64;break;case'POST':case _0xca2c('0x13'):if(_0x10c40e[_0xca2c('0x14')]){try{_0xc20a4d=JSON[_0xca2c('0xe')](Mustache[_0xca2c('0x9')](_0x10c40e[_0xca2c('0x14')],_0x3c6e64));_0x494297[_0xca2c('0x15')]=_0xc20a4d;}catch(_0x250b92){logger['error'](_0x250b92[_0xca2c('0x10')]);logger[_0xca2c('0xf')](_0xca2c('0x16'));}}else{_0xc20a4d=_0x3c6e64;_0x494297[_0xca2c('0x15')]=_0xc20a4d;}break;}logger[_0xca2c('0x17')](util[_0xca2c('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x10c40e[_0xca2c('0x7')],_0x10c40e[_0xca2c('0xa')],JSON[_0xca2c('0x19')](_0x494297)));rp(_0x494297)['then'](function(_0x186a15){_0xc20a4d=!_[_0xca2c('0x1a')](_0xc20a4d)?_0xca2c('0x1b')+_0xc20a4d:'';_0x4b44f0=typeof _0x186a15[_0xca2c('0x15')]==='object'?JSON['stringify'](_0x186a15['body']):_0x186a15[_0xca2c('0x15')];logger[_0xca2c('0x17')](util[_0xca2c('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x10c40e['data1'],_0x10c40e[_0xca2c('0xa')],_0x186a15[_0xca2c('0x1c')],_0x4b44f0));})[_0xca2c('0x1d')](function(_0x6728b1){logger['error'](util[_0xca2c('0x18')](_0xca2c('0x1e'),_0x10c40e[_0xca2c('0x7')],_0x10c40e[_0xca2c('0xa')],_0x6728b1[_0xca2c('0x1c')],_0x6728b1[_0xca2c('0x1f')],_0x6728b1[_0xca2c('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9c72b95..98d859e 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 _0x3b9e=['routing','error','message','catch','jayson/promise','bluebird','../../config/logger','client','Request','request','then','debug','rpc'];(function(_0x266ba0,_0xeeeaad){var _0x3ffdf8=function(_0x251e82){while(--_0x251e82){_0x266ba0['push'](_0x266ba0['shift']());}};_0x3ffdf8(++_0xeeeaad);}(_0x3b9e,0x1cb));var _0xe3b9=function(_0xc3cb3b,_0x54138d){_0xc3cb3b=_0xc3cb3b-0x0;var _0x23cc6c=_0x3b9e[_0xc3cb3b];return _0x23cc6c;};'use strict';var jayson=require(_0xe3b9('0x0'));var BPromise=require(_0xe3b9('0x1'));var logger=require(_0xe3b9('0x2'))('routing');var client=jayson[_0xe3b9('0x3')]['http']({'port':0x2329});client[_0xe3b9('0x4')]=function(_0x503d60,_0x1a0da7){return new BPromise(function(_0x30dd20,_0x22862e){return client[_0xe3b9('0x5')](_0x503d60,_0x1a0da7)[_0xe3b9('0x6')](function(_0x69e24){logger[_0xe3b9('0x7')](_0xe3b9('0x8'),_0xe3b9('0x9'),_0x503d60,_0x1a0da7,_0x69e24);if(_0x69e24[_0xe3b9('0xa')]){logger[_0xe3b9('0xa')]('rpc',_0xe3b9('0x9'),_0x503d60,_0x69e24[_0xe3b9('0xa')][_0xe3b9('0xb')],_0x1a0da7);return _0x22862e(_0x69e24['error'][_0xe3b9('0xb')]);}else{return _0x30dd20(_0x69e24['result']);}})[_0xe3b9('0xc')](function(_0x41aae8){logger[_0xe3b9('0xa')](_0xe3b9('0x8'),_0xe3b9('0x9'),_0x503d60,_0x41aae8,_0x1a0da7);return _0x22862e(_0x41aae8);});});};module['exports']=client; \ No newline at end of file +var _0x52e4=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','request','then','debug','rpc','routing'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x52e4,0x1f4));var _0x452e=function(_0x1537a1,_0x338d7d){_0x1537a1=_0x1537a1-0x0;var _0x17b8f8=_0x52e4[_0x1537a1];return _0x17b8f8;};'use strict';var jayson=require(_0x452e('0x0'));var BPromise=require(_0x452e('0x1'));var logger=require(_0x452e('0x2'))('routing');var client=jayson['client'][_0x452e('0x3')]({'port':0x2329});client[_0x452e('0x4')]=function(_0x16e450,_0x164095){return new BPromise(function(_0x1382f2,_0x1713dd){return client[_0x452e('0x5')](_0x16e450,_0x164095)[_0x452e('0x6')](function(_0x35e55d){logger[_0x452e('0x7')](_0x452e('0x8'),_0x452e('0x9'),_0x16e450,_0x164095,_0x35e55d);if(_0x35e55d[_0x452e('0xa')]){logger['error'](_0x452e('0x8'),_0x452e('0x9'),_0x16e450,_0x35e55d[_0x452e('0xa')][_0x452e('0xb')],_0x164095);return _0x1713dd(_0x35e55d['error'][_0x452e('0xb')]);}else{return _0x1382f2(_0x35e55d[_0x452e('0xc')]);}})[_0x452e('0xd')](function(_0x48a978){logger[_0x452e('0xa')]('rpc','routing',_0x16e450,_0x48a978,_0x164095);return _0x1713dd(_0x48a978);});});};module[_0x452e('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b8d50c6..e1a9549 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 _0x8385=['./lib/email','./rpc/mailAccount','../../config/logger','email','getMailAccounts','initMailAccounts','then','mailAccounts','listen','loginMailFrequency','catch','error','./server','./realtime'];(function(_0x76f60d,_0x4eef3b){var _0x4074bf=function(_0x4a9d96){while(--_0x4a9d96){_0x76f60d['push'](_0x76f60d['shift']());}};_0x4074bf(++_0x4eef3b);}(_0x8385,0xfa));var _0x5838=function(_0x6ffb30,_0x453154){_0x6ffb30=_0x6ffb30-0x0;var _0x338414=_0x8385[_0x6ffb30];return _0x338414;};'use strict';var server=require(_0x5838('0x0'));var Realtime=require(_0x5838('0x1'));var EmailChannel=require(_0x5838('0x2'));var mailAccount=require(_0x5838('0x3'));var setting=require('./rpc/setting');var logger=require(_0x5838('0x4'))(_0x5838('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x5838('0x6')]())['then'](realtime[_0x5838('0x7')]())[_0x5838('0x8')](function(){email['refresh'](realtime[_0x5838('0x9')]);return realtime;});}function main(){return server[_0x5838('0xa')](realtime,email)[_0x5838('0x8')](function(){return initRealtime();})[_0x5838('0x8')](function(){return setting['getSettings']();})[_0x5838('0x8')](function(_0x1d50f4){return setInterval(initRealtime,_0x1d50f4[_0x5838('0xb')]*0x3e8);})[_0x5838('0xc')](function(_0x532a2a){logger[_0x5838('0xd')]('Email\x20service\x20initialization',_0x532a2a);});}main(); \ No newline at end of file +var _0x50e6=['../../config/logger','email','then','initMailAccounts','refresh','getSettings','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x359068,_0x5bf191){var _0x1175f1=function(_0x44fbb9){while(--_0x44fbb9){_0x359068['push'](_0x359068['shift']());}};_0x1175f1(++_0x5bf191);}(_0x50e6,0x15a));var _0x650e=function(_0x558df9,_0x3481d5){_0x558df9=_0x558df9-0x0;var _0x34e516=_0x50e6[_0x558df9];return _0x34e516;};'use strict';var server=require(_0x650e('0x0'));var Realtime=require(_0x650e('0x1'));var EmailChannel=require(_0x650e('0x2'));var mailAccount=require(_0x650e('0x3'));var setting=require(_0x650e('0x4'));var logger=require(_0x650e('0x5'))(_0x650e('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount['getMailAccounts']())[_0x650e('0x7')](realtime[_0x650e('0x8')]())[_0x650e('0x7')](function(){email[_0x650e('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x650e('0x7')](function(){return initRealtime();})[_0x650e('0x7')](function(){return setting[_0x650e('0xa')]();})[_0x650e('0x7')](function(_0x54116a){return setInterval(initRealtime,_0x54116a['loginMailFrequency']*0x3e8);})[_0x650e('0xb')](function(_0x24fbaa){logger[_0x650e('0xc')]('Email\x20service\x20initialization',_0x24fbaa);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index fe59a98..978edfb 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 _0xa985=['lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','imapAccounts','smtp','prototype','name','key','active','status','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','mailAccounts','disabled','emit','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','messageStatus','sendMail','send','verifySmtp','Smtp','verified','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa985,0x131));var _0x5a98=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xa985[_0xd09668];return _0x68726;};'use strict';var _=require(_0x5a98('0x0'));var moment=require(_0x5a98('0x1'));var BPromise=require(_0x5a98('0x2'));var md5=require(_0x5a98('0x3'));var Redis=require(_0x5a98('0x4'));var config=require(_0x5a98('0x5'));var logger=require(_0x5a98('0x6'))(_0x5a98('0x7'));config[_0x5a98('0x8')]=_['defaults'](config[_0x5a98('0x8')],{'host':_0x5a98('0x9'),'port':0x18eb});var io=require(_0x5a98('0xa'))(new Redis(config[_0x5a98('0x8')]));var EmailImap=require(_0x5a98('0xb'));var EmailSmtp=require(_0x5a98('0xc'));var mailAccount=require(_0x5a98('0xd'));var md5Accounts={};function EmailChannel(_0x149cbe){logger[_0x5a98('0xe')]('start\x20email\x20channel');this['mailAccounts']=_0x149cbe['mailAccounts'];this[_0x5a98('0xf')]={};this[_0x5a98('0x10')]=new EmailSmtp();}EmailChannel[_0x5a98('0x11')]['emit']=function(_0x4322f7){var _0x425656=this['mailAccounts'][_0x4322f7];var _0x8e617f={'id':_0x425656['id'],'name':_0x425656[_0x5a98('0x12')],'key':_0x425656[_0x5a98('0x13')],'active':_0x425656[_0x5a98('0x14')],'Imap':{'status':_0x425656['Imap'][_0x5a98('0x15')],'messageStatus':_0x425656[_0x5a98('0x16')]['messageStatus'],'total':_0x425656[_0x5a98('0x16')][_0x5a98('0x17')]}};if(_[_0x5a98('0x18')](md5Accounts[_0x4322f7])){md5Accounts[_0x4322f7]={};}var _0x517121=md5(JSON[_0x5a98('0x19')](_0x8e617f));if(md5Accounts[_0x4322f7]['md5']!==_0x517121){md5Accounts[_0x4322f7][_0x5a98('0x3')]=_0x517121;io['emit'](_0x5a98('0x1a'),_0x8e617f);}};EmailChannel[_0x5a98('0x11')][_0x5a98('0x1b')]=function(_0x546fb8){for(var _0x56e2a6 in _0x546fb8){if(_0x546fb8[_0x5a98('0x1c')](_0x56e2a6)){if(_0x546fb8[_0x56e2a6]['Imap']&&_0x546fb8[_0x56e2a6]['active']){var _0x228818=_0x546fb8[_0x56e2a6][_0x5a98('0x16')];if(!_0x228818['service']&&_0x546fb8[_0x56e2a6][_0x5a98('0x1d')]!==_0x5a98('0x1e'))_0x228818[_0x5a98('0x1f')]=_0x546fb8[_0x56e2a6][_0x5a98('0x1d')];if(!this[_0x5a98('0xf')][_0x5a98('0x1c')](_0x228818['id'])){this[_0x5a98('0xf')][_0x228818['id']]=new EmailImap(_0x228818,_0x546fb8[_0x56e2a6][_0x5a98('0x7')]);this['imapAccounts'][_0x228818['id']]['on'](_0x5a98('0x20'),this[_0x5a98('0x21')][_0x5a98('0x22')](this,_0x56e2a6));this[_0x5a98('0xf')][_0x228818['id']]['on'](_0x5a98('0x7'),this[_0x5a98('0x23')][_0x5a98('0x22')](this,_0x56e2a6));this[_0x5a98('0xf')][_0x228818['id']]['on'](_0x5a98('0x24'),this[_0x5a98('0x25')]['bind'](this,_0x56e2a6));this['imapAccounts'][_0x228818['id']]['on']('error',this[_0x5a98('0x26')][_0x5a98('0x22')](this,_0x56e2a6));}}else{if(_[_0x5a98('0x18')](this['mailAccounts'][_0x56e2a6][_0x5a98('0x16')])){this[_0x5a98('0x27')][_0x56e2a6][_0x5a98('0x16')]={};}this[_0x5a98('0x27')][_0x56e2a6][_0x5a98('0x16')][_0x5a98('0x15')]=_0x5a98('0x28');this[_0x5a98('0x27')][_0x56e2a6][_0x5a98('0x16')]['messageStatus']='';this[_0x5a98('0x29')](_0x56e2a6);}}}};EmailChannel[_0x5a98('0x11')][_0x5a98('0x21')]=function(_0x373b74,_0x308b00){if(this[_0x5a98('0x27')][_0x373b74]){this[_0x5a98('0x27')][_0x373b74]['Imap'][_0x5a98('0x15')]='connected';this[_0x5a98('0x27')][_0x373b74]['Imap']['messageStatus']=_0x308b00[_0x5a98('0x12')];if(_0x308b00[_0x5a98('0x2a')]){this['mailAccounts'][_0x373b74][_0x5a98('0x16')][_0x5a98('0x17')]=_0x308b00[_0x5a98('0x2a')][_0x5a98('0x17')];}return this[_0x5a98('0x29')](_0x373b74);}};EmailChannel[_0x5a98('0x11')][_0x5a98('0x23')]=function(_0xa0f17c,_0x4a6f0f){logger[_0x5a98('0xe')](_0x5a98('0x2b'),_0x4a6f0f[_0x5a98('0x2c')],_0x4a6f0f[_0x5a98('0x2d')],_0x4a6f0f[_0x5a98('0x2e')],_0xa0f17c);if(this['mailAccounts'][_0xa0f17c]){return mailAccount[_0x5a98('0x2f')](_0xa0f17c,_0x4a6f0f)[_0x5a98('0x30')](function(_0x4172cb){if(_0x4172cb){logger[_0x5a98('0xe')](_0x5a98('0x31'));}})[_0x5a98('0x32')](function(_0x47daa3){logger[_0x5a98('0x33')](_0x5a98('0x34'),JSON['stringify'](_0x47daa3));});}};EmailChannel[_0x5a98('0x11')][_0x5a98('0x25')]=function(_0x2ece4b){if(this[_0x5a98('0x27')][_0x2ece4b]&&this[_0x5a98('0x27')][_0x2ece4b][_0x5a98('0x16')]){if(this['imapAccounts'][this[_0x5a98('0x27')][_0x2ece4b]['Imap']['id']]){delete this[_0x5a98('0xf')][this['mailAccounts'][_0x2ece4b][_0x5a98('0x16')]['id']];}this[_0x5a98('0x27')][_0x2ece4b]['Imap'][_0x5a98('0x35')]=moment();this[_0x5a98('0x29')](_0x2ece4b);}};EmailChannel[_0x5a98('0x11')]['handleImapError']=function(_0xdcc692,_0x2965ea){if(this[_0x5a98('0x27')][_0xdcc692]){this[_0x5a98('0x27')][_0xdcc692][_0x5a98('0x16')][_0x5a98('0x15')]=_0x5a98('0x33');this['mailAccounts'][_0xdcc692][_0x5a98('0x16')][_0x5a98('0x36')]=_0x2965ea;return this[_0x5a98('0x29')](_0xdcc692);}};EmailChannel[_0x5a98('0x11')][_0x5a98('0x37')]=function(_0x2337d1,_0x57f4f4){return this[_0x5a98('0x10')][_0x5a98('0x38')](_0x2337d1,_0x57f4f4);};EmailChannel[_0x5a98('0x11')][_0x5a98('0x39')]=function(_0x5cdf45){var _0x25560d=this;if(this[_0x5a98('0x27')][_0x5cdf45['id']]){if(_[_0x5a98('0x18')](this[_0x5a98('0x27')][_0x5cdf45['id']]['Smtp'])){this[_0x5a98('0x27')][_0x5cdf45['id']][_0x5a98('0x3a')]={};}this[_0x5a98('0x27')][_0x5cdf45['id']]['Smtp'][_0x5a98('0x35')]=moment();return new BPromise(function(_0x516925,_0x315ca1){return _0x25560d['smtp']['verify'](_0x5cdf45)['then'](function(_0x5b0907){_0x25560d['mailAccounts'][_0x5cdf45['id']][_0x5a98('0x3a')][_0x5a98('0x15')]=_0x5a98('0x3b');_0x25560d['mailAccounts'][_0x5cdf45['id']][_0x5a98('0x3a')]['messageStatus']='';_0x25560d[_0x5a98('0x29')](_0x5cdf45['id']);_0x516925(_0x5b0907);})['catch'](function(_0x5d95a0){_0x25560d[_0x5a98('0x27')][_0x5cdf45['id']][_0x5a98('0x3a')][_0x5a98('0x15')]=_0x5a98('0x33');_0x25560d[_0x5a98('0x27')][_0x5cdf45['id']][_0x5a98('0x3a')][_0x5a98('0x36')]=_0x5d95a0;_0x25560d[_0x5a98('0x29')](_0x5cdf45['id']);_0x315ca1(_0x5d95a0);});});}return this['smtp']['verify'](_0x5cdf45);};module[_0x5a98('0x3c')]=EmailChannel; \ No newline at end of file +var _0x049d=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','ioredis','../../../config/logger','email','redis','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','messageStatus','Imap','total','isNil','md5','refresh','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','status','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x049d,0x1dc));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd049('0x0'));var moment=require(_0xd049('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xd049('0x2'));var config=require('../../../config/environment');var logger=require(_0xd049('0x3'))(_0xd049('0x4'));config[_0xd049('0x5')]=_['defaults'](config[_0xd049('0x5')],{'host':_0xd049('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd049('0x5')]));var EmailImap=require(_0xd049('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x26a4fe){logger[_0xd049('0x8')](_0xd049('0x9'));this[_0xd049('0xa')]=_0x26a4fe[_0xd049('0xa')];this[_0xd049('0xb')]={};this[_0xd049('0xc')]=new EmailSmtp();}EmailChannel[_0xd049('0xd')][_0xd049('0xe')]=function(_0x162acf){var _0x39e86d=this['mailAccounts'][_0x162acf];var _0x2373a8={'id':_0x39e86d['id'],'name':_0x39e86d[_0xd049('0xf')],'key':_0x39e86d['key'],'active':_0x39e86d[_0xd049('0x10')],'Imap':{'status':_0x39e86d['Imap']['status'],'messageStatus':_0x39e86d['Imap'][_0xd049('0x11')],'total':_0x39e86d[_0xd049('0x12')][_0xd049('0x13')]}};if(_[_0xd049('0x14')](md5Accounts[_0x162acf])){md5Accounts[_0x162acf]={};}var _0x54e8db=md5(JSON['stringify'](_0x2373a8));if(md5Accounts[_0x162acf][_0xd049('0x15')]!==_0x54e8db){md5Accounts[_0x162acf][_0xd049('0x15')]=_0x54e8db;io[_0xd049('0xe')]('mailAccount:update',_0x2373a8);}};EmailChannel[_0xd049('0xd')][_0xd049('0x16')]=function(_0x1de4ef){for(var _0x521265 in _0x1de4ef){if(_0x1de4ef[_0xd049('0x17')](_0x521265)){if(_0x1de4ef[_0x521265][_0xd049('0x12')]&&_0x1de4ef[_0x521265]['active']){var _0x5cc414=_0x1de4ef[_0x521265][_0xd049('0x12')];if(!_0x5cc414[_0xd049('0x18')]&&_0x1de4ef[_0x521265][_0xd049('0x19')]!=='custom')_0x5cc414[_0xd049('0x18')]=_0x1de4ef[_0x521265][_0xd049('0x19')];if(!this['imapAccounts'][_0xd049('0x17')](_0x5cc414['id'])){this[_0xd049('0xb')][_0x5cc414['id']]=new EmailImap(_0x5cc414,_0x1de4ef[_0x521265][_0xd049('0x4')]);this[_0xd049('0xb')][_0x5cc414['id']]['on'](_0xd049('0x1a'),this[_0xd049('0x1b')][_0xd049('0x1c')](this,_0x521265));this['imapAccounts'][_0x5cc414['id']]['on'](_0xd049('0x4'),this[_0xd049('0x1d')][_0xd049('0x1c')](this,_0x521265));this['imapAccounts'][_0x5cc414['id']]['on']('end',this[_0xd049('0x1e')]['bind'](this,_0x521265));this['imapAccounts'][_0x5cc414['id']]['on'](_0xd049('0x1f'),this[_0xd049('0x20')][_0xd049('0x1c')](this,_0x521265));}}else{if(_[_0xd049('0x14')](this['mailAccounts'][_0x521265][_0xd049('0x12')])){this[_0xd049('0xa')][_0x521265]['Imap']={};}this[_0xd049('0xa')][_0x521265][_0xd049('0x12')][_0xd049('0x21')]=_0xd049('0x22');this[_0xd049('0xa')][_0x521265]['Imap']['messageStatus']='';this[_0xd049('0xe')](_0x521265);}}}};EmailChannel[_0xd049('0xd')][_0xd049('0x1b')]=function(_0x3ade9e,_0xf5133e){if(this[_0xd049('0xa')][_0x3ade9e]){this['mailAccounts'][_0x3ade9e]['Imap']['status']=_0xd049('0x23');this[_0xd049('0xa')][_0x3ade9e][_0xd049('0x12')][_0xd049('0x11')]=_0xf5133e[_0xd049('0xf')];if(_0xf5133e[_0xd049('0x24')]){this['mailAccounts'][_0x3ade9e][_0xd049('0x12')][_0xd049('0x13')]=_0xf5133e[_0xd049('0x24')][_0xd049('0x13')];}return this['emit'](_0x3ade9e);}};EmailChannel[_0xd049('0xd')][_0xd049('0x1d')]=function(_0x1da874,_0x5e408c){logger[_0xd049('0x8')](_0xd049('0x25'),_0x5e408c[_0xd049('0x26')],_0x5e408c[_0xd049('0x27')],_0x5e408c[_0xd049('0x28')],_0x1da874);if(this[_0xd049('0xa')][_0x1da874]){return mailAccount['notify'](_0x1da874,_0x5e408c)[_0xd049('0x29')](function(_0x20fcbc){if(_0x20fcbc){logger[_0xd049('0x8')](_0xd049('0x2a'));}})[_0xd049('0x2b')](function(_0x207a72){logger['error'](_0xd049('0x2c'),JSON[_0xd049('0x2d')](_0x207a72));});}};EmailChannel[_0xd049('0xd')]['handleImapEnd']=function(_0x35be9e){if(this[_0xd049('0xa')][_0x35be9e]&&this[_0xd049('0xa')][_0x35be9e][_0xd049('0x12')]){if(this['imapAccounts'][this[_0xd049('0xa')][_0x35be9e]['Imap']['id']]){delete this['imapAccounts'][this[_0xd049('0xa')][_0x35be9e][_0xd049('0x12')]['id']];}this[_0xd049('0xa')][_0x35be9e][_0xd049('0x12')]['lastSync']=moment();this[_0xd049('0xe')](_0x35be9e);}};EmailChannel['prototype'][_0xd049('0x20')]=function(_0x12768e,_0x5ab882){if(this['mailAccounts'][_0x12768e]){this['mailAccounts'][_0x12768e][_0xd049('0x12')][_0xd049('0x21')]=_0xd049('0x1f');this[_0xd049('0xa')][_0x12768e][_0xd049('0x12')][_0xd049('0x11')]=_0x5ab882;return this['emit'](_0x12768e);}};EmailChannel[_0xd049('0xd')]['sendMail']=function(_0x5e09b2,_0x1865f3){return this['smtp'][_0xd049('0x2e')](_0x5e09b2,_0x1865f3);};EmailChannel['prototype'][_0xd049('0x2f')]=function(_0x4cd881){var _0x39bf0f=this;if(this[_0xd049('0xa')][_0x4cd881['id']]){if(_['isNil'](this[_0xd049('0xa')][_0x4cd881['id']][_0xd049('0x30')])){this[_0xd049('0xa')][_0x4cd881['id']][_0xd049('0x30')]={};}this[_0xd049('0xa')][_0x4cd881['id']][_0xd049('0x30')][_0xd049('0x31')]=moment();return new BPromise(function(_0x52ef83,_0xbdf14c){return _0x39bf0f[_0xd049('0xc')][_0xd049('0x32')](_0x4cd881)['then'](function(_0x1f4860){_0x39bf0f['mailAccounts'][_0x4cd881['id']][_0xd049('0x30')][_0xd049('0x21')]=_0xd049('0x33');_0x39bf0f[_0xd049('0xa')][_0x4cd881['id']][_0xd049('0x30')]['messageStatus']='';_0x39bf0f[_0xd049('0xe')](_0x4cd881['id']);_0x52ef83(_0x1f4860);})[_0xd049('0x2b')](function(_0x3a0dbe){_0x39bf0f['mailAccounts'][_0x4cd881['id']][_0xd049('0x30')][_0xd049('0x21')]=_0xd049('0x1f');_0x39bf0f[_0xd049('0xa')][_0x4cd881['id']][_0xd049('0x30')]['messageStatus']=_0x3a0dbe;_0x39bf0f['emit'](_0x4cd881['id']);_0xbdf14c(_0x3a0dbe);});});}return this[_0xd049('0xc')][_0xd049('0x32')](_0x4cd881);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 30dd76c..71d173b 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 _0xaf1b=['mailbox','handleOpenBox','emit','box','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','getAccount','account','once','handleReady','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','CloudProvider','data5','password','authentication','host','port','tls','required','openBox'];(function(_0x3dd481,_0x8889b0){var _0x195ae6=function(_0x251b22){while(--_0x251b22){_0x3dd481['push'](_0x3dd481['shift']());}};_0x195ae6(++_0x8889b0);}(_0xaf1b,0x11a));var _0xbaf1=function(_0xd3db79,_0x115bbd){_0xd3db79=_0xd3db79-0x0;var _0x5c2b87=_0xaf1b[_0xd3db79];return _0x5c2b87;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var Imap=require(_0xbaf1('0x2'));var simpleParser=require(_0xbaf1('0x3'))[_0xbaf1('0x4')];var Iconv=require(_0xbaf1('0x5'))[_0xbaf1('0x6')];var EventEmitter=require(_0xbaf1('0x7'))[_0xbaf1('0x8')];var utils=require(_0xbaf1('0x9'));var logger=require(_0xbaf1('0xa'))(_0xbaf1('0xb'));function EmailImap(_0x7dd657,_0x2f05ad){this['mailbox']=_0xbaf1('0xc');this['account']=this[_0xbaf1('0xd')](_0x7dd657,_0x2f05ad);this['imap']=new Imap(this[_0xbaf1('0xe')]);this[_0xbaf1('0x2')][_0xbaf1('0xf')]('ready',this[_0xbaf1('0x10')][_0xbaf1('0x11')](this));this['imap'][_0xbaf1('0xf')]('end',this[_0xbaf1('0x12')][_0xbaf1('0x11')](this));this[_0xbaf1('0x2')]['on'](_0xbaf1('0x13'),this[_0xbaf1('0x14')][_0xbaf1('0x11')](this));this['imap']['connect']();}util[_0xbaf1('0x15')](EmailImap,EventEmitter);EmailImap[_0xbaf1('0x16')][_0xbaf1('0xd')]=function(_0xb6f7d8,_0x1d94da){var _0x1097d6={'connTimeout':_0xb6f7d8[_0xbaf1('0x17')]?_0xb6f7d8['connTimeout']*0x3e8:0x2710,'authTimeout':_0xb6f7d8[_0xbaf1('0x18')]?_0xb6f7d8[_0xbaf1('0x18')]*0x3e8:0x1388};if(_0xb6f7d8[_0xbaf1('0x19')]){_0x1097d6[_0xbaf1('0x1a')]=_0xb6f7d8[_0xbaf1('0x1a')];_0x1097d6[_0xbaf1('0xb')]=_0x1d94da||_0xb6f7d8[_0xbaf1('0x1a')]||_0xbaf1('0x1b');if(_0xb6f7d8['modernAuthentication']){_0x1097d6[_0xbaf1('0x1c')]=utils['generateXOAuth2Token'](_0xb6f7d8[_0xbaf1('0x1d')][_0xbaf1('0x1e')],_0xb6f7d8[_0xbaf1('0x1a')]);}else{_0x1097d6[_0xbaf1('0x1f')]=_0xb6f7d8['password'];}}else{if(_0xb6f7d8[_0xbaf1('0x20')]){_0x1097d6['user']=_0xb6f7d8[_0xbaf1('0x1a')];_0x1097d6[_0xbaf1('0x1f')]=_0xb6f7d8['password'];}}_0x1097d6[_0xbaf1('0x21')]=_0xb6f7d8[_0xbaf1('0x21')];_0x1097d6[_0xbaf1('0x22')]=_0xb6f7d8[_0xbaf1('0x22')]||0x3e1;if(_0xb6f7d8[_0xbaf1('0x23')]){_0x1097d6[_0xbaf1('0x23')]=!![];}else{_0x1097d6['tls']=![];_0x1097d6['autotls']=_0xbaf1('0x24');}return _0x1097d6;};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x10')]=function(){this['imap'][_0xbaf1('0x25')](this[_0xbaf1('0x26')],![],this[_0xbaf1('0x27')]['bind'](this));};EmailImap[_0xbaf1('0x16')]['handleOpenBox']=function(_0x1e7847,_0x181c9d){if(_0x1e7847){this[_0xbaf1('0x14')](_0x1e7847,!![]);}else{this[_0xbaf1('0x28')](_0xbaf1('0x29'),_0x181c9d);this['readUnseen']();}};EmailImap['prototype'][_0xbaf1('0x2a')]=function(_0xda1d6c){if(_0xda1d6c){this[_0xbaf1('0x14')](_0xda1d6c,!![]);}else{this[_0xbaf1('0x2')]['end']();}};EmailImap[_0xbaf1('0x16')]['readUnseen']=function(){this[_0xbaf1('0x2')][_0xbaf1('0x2b')]([_0xbaf1('0x2c')],this[_0xbaf1('0x2d')][_0xbaf1('0x11')](this));};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x2d')]=function(_0x4db035,_0x108295){if(_0x4db035){this[_0xbaf1('0x14')](_0x4db035,!![]);}else{if(_0x108295[_0xbaf1('0x2e')]){try{var _0x29f528=this[_0xbaf1('0x2')][_0xbaf1('0x2f')](_0x108295,{'bodies':'','markSeen':!![]});_0x29f528['on'](_0xbaf1('0x30'),this[_0xbaf1('0x31')]['bind'](this));_0x29f528[_0xbaf1('0xf')](_0xbaf1('0x13'),this[_0xbaf1('0x32')][_0xbaf1('0x11')](this));_0x29f528['once'](_0xbaf1('0x33'),this['handleFetchEnd'][_0xbaf1('0x11')](this));}catch(_0x582f19){logger[_0xbaf1('0x13')](_0x582f19);}}else{this[_0xbaf1('0x2')][_0xbaf1('0x34')](!![],this[_0xbaf1('0x2a')]['bind'](this));}}};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x31')]=function(_0x40eccd){_0x40eccd['on'](_0xbaf1('0x35'),this[_0xbaf1('0x36')][_0xbaf1('0x11')](this));_0x40eccd[_0xbaf1('0xf')]('attributes',this[_0xbaf1('0x37')][_0xbaf1('0x11')](this));_0x40eccd[_0xbaf1('0xf')](_0xbaf1('0x33'),this[_0xbaf1('0x38')][_0xbaf1('0x11')](this));};EmailImap[_0xbaf1('0x16')]['handleMessageBody']=function(_0xe654f5){simpleParser(_0xe654f5,{'Iconv':Iconv},this['handleSimpleParser'][_0xbaf1('0x11')](this));};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x37')]=function(){};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x38')]=function(){};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x39')]=function(_0x367823,_0x15e27f){if(_0x367823){logger['error'](_0x367823);}else{var _0x4e4fd1=this;utils['parser'](this[_0xbaf1('0xe')],_0x15e27f,function(_0x2e1417){_0x4e4fd1['emit'](_0xbaf1('0xb'),_0x2e1417);});}};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x3a')]=function(){this['imap'][_0xbaf1('0x34')](!![],this[_0xbaf1('0x2a')][_0xbaf1('0x11')](this));};EmailImap['prototype'][_0xbaf1('0x32')]=function(_0x39d196){this['handleError'](_0x39d196);this['imap'][_0xbaf1('0x34')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype'][_0xbaf1('0x12')]=function(){this[_0xbaf1('0x28')](_0xbaf1('0x33'));};EmailImap[_0xbaf1('0x16')][_0xbaf1('0x14')]=function(_0x394814,_0x986a3e){logger[_0xbaf1('0x13')]('handleError',this[_0xbaf1('0xe')][_0xbaf1('0xb')],JSON[_0xbaf1('0x3b')](_0x394814));var _0x314ac3='';if(_0x394814){if(_0x394814['textCode']){_0x314ac3=_0x394814[_0xbaf1('0x3c')];}else{for(var _0x51445a in _0x394814){if(_0x394814[_0xbaf1('0x3d')](_0x51445a)){_0x314ac3+=_[_0xbaf1('0x3e')](_0x51445a)+':\x20'+_0x394814[_0x51445a]+'\x0a';}}}}if(_0x986a3e){this[_0xbaf1('0x2')]['end']();}else{this[_0xbaf1('0x28')](_0xbaf1('0x13'),_0x314ac3);this[_0xbaf1('0x28')]('end');}};module[_0xbaf1('0x3f')]=EmailImap; \ No newline at end of file +var _0x2a07=['INBOX','account','getAccount','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox'];(function(_0x330478,_0x24d8c7){var _0x25e8f3=function(_0x2e9b72){while(--_0x2e9b72){_0x330478['push'](_0x330478['shift']());}};_0x25e8f3(++_0x24d8c7);}(_0x2a07,0x74));var _0x72a0=function(_0x224ad9,_0x5d97a7){_0x224ad9=_0x224ad9-0x0;var _0x532997=_0x2a07[_0x224ad9];return _0x532997;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var Imap=require(_0x72a0('0x2'));var simpleParser=require(_0x72a0('0x3'))[_0x72a0('0x4')];var Iconv=require('iconv')[_0x72a0('0x5')];var EventEmitter=require(_0x72a0('0x6'))[_0x72a0('0x7')];var utils=require(_0x72a0('0x8'));var logger=require(_0x72a0('0x9'))(_0x72a0('0xa'));function EmailImap(_0x3ccf6d,_0x20dab9){this[_0x72a0('0xb')]=_0x72a0('0xc');this[_0x72a0('0xd')]=this[_0x72a0('0xe')](_0x3ccf6d,_0x20dab9);this[_0x72a0('0x2')]=new Imap(this[_0x72a0('0xd')]);this[_0x72a0('0x2')][_0x72a0('0xf')]('ready',this[_0x72a0('0x10')][_0x72a0('0x11')](this));this['imap'][_0x72a0('0xf')](_0x72a0('0x12'),this[_0x72a0('0x13')][_0x72a0('0x11')](this));this[_0x72a0('0x2')]['on']('error',this[_0x72a0('0x14')][_0x72a0('0x11')](this));this[_0x72a0('0x2')][_0x72a0('0x15')]();}util[_0x72a0('0x16')](EmailImap,EventEmitter);EmailImap[_0x72a0('0x17')][_0x72a0('0xe')]=function(_0x5e0b5f,_0x4930c5){var _0xe103dc={'connTimeout':_0x5e0b5f[_0x72a0('0x18')]?_0x5e0b5f[_0x72a0('0x18')]*0x3e8:0x2710,'authTimeout':_0x5e0b5f[_0x72a0('0x19')]?_0x5e0b5f[_0x72a0('0x19')]*0x3e8:0x1388};if(_0x5e0b5f[_0x72a0('0x1a')]){_0xe103dc['user']=_0x5e0b5f[_0x72a0('0x1b')];_0xe103dc[_0x72a0('0xa')]=_0x4930c5||_0x5e0b5f[_0x72a0('0x1b')]||_0x72a0('0x1c');if(_0x5e0b5f[_0x72a0('0x1d')]){_0xe103dc['xoauth2']=utils[_0x72a0('0x1e')](_0x5e0b5f[_0x72a0('0x1f')][_0x72a0('0x20')],_0x5e0b5f['user']);}else{_0xe103dc[_0x72a0('0x21')]=_0x5e0b5f[_0x72a0('0x21')];}}else{if(_0x5e0b5f[_0x72a0('0x22')]){_0xe103dc[_0x72a0('0x1b')]=_0x5e0b5f['user'];_0xe103dc[_0x72a0('0x21')]=_0x5e0b5f['password'];}}_0xe103dc[_0x72a0('0x23')]=_0x5e0b5f[_0x72a0('0x23')];_0xe103dc[_0x72a0('0x24')]=_0x5e0b5f['port']||0x3e1;if(_0x5e0b5f[_0x72a0('0x25')]){_0xe103dc[_0x72a0('0x25')]=!![];}else{_0xe103dc[_0x72a0('0x25')]=![];_0xe103dc[_0x72a0('0x26')]='required';}return _0xe103dc;};EmailImap[_0x72a0('0x17')][_0x72a0('0x10')]=function(){this[_0x72a0('0x2')][_0x72a0('0x27')](this[_0x72a0('0xb')],![],this[_0x72a0('0x28')]['bind'](this));};EmailImap['prototype'][_0x72a0('0x28')]=function(_0x2d8b68,_0x123df4){if(_0x2d8b68){this[_0x72a0('0x14')](_0x2d8b68,!![]);}else{this[_0x72a0('0x29')](_0x72a0('0x2a'),_0x123df4);this[_0x72a0('0x2b')]();}};EmailImap[_0x72a0('0x17')][_0x72a0('0x2c')]=function(_0x12dcc9){if(_0x12dcc9){this['handleError'](_0x12dcc9,!![]);}else{this[_0x72a0('0x2')][_0x72a0('0x12')]();}};EmailImap[_0x72a0('0x17')][_0x72a0('0x2b')]=function(){this[_0x72a0('0x2')][_0x72a0('0x2d')]([_0x72a0('0x2e')],this[_0x72a0('0x2f')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')]['handleReadUnseen']=function(_0x41efc1,_0x17e955){if(_0x41efc1){this[_0x72a0('0x14')](_0x41efc1,!![]);}else{if(_0x17e955[_0x72a0('0x30')]){try{var _0x13c04=this[_0x72a0('0x2')][_0x72a0('0x31')](_0x17e955,{'bodies':'','markSeen':!![]});_0x13c04['on']('message',this[_0x72a0('0x32')][_0x72a0('0x11')](this));_0x13c04[_0x72a0('0xf')](_0x72a0('0x33'),this[_0x72a0('0x34')][_0x72a0('0x11')](this));_0x13c04[_0x72a0('0xf')](_0x72a0('0x12'),this['handleFetchEnd'][_0x72a0('0x11')](this));}catch(_0x1fb485){logger[_0x72a0('0x33')](_0x1fb485);}}else{this['imap'][_0x72a0('0x35')](!![],this['handleCloseBox'][_0x72a0('0x11')](this));}}};EmailImap[_0x72a0('0x17')][_0x72a0('0x32')]=function(_0x3a293f){_0x3a293f['on'](_0x72a0('0x36'),this[_0x72a0('0x37')][_0x72a0('0x11')](this));_0x3a293f[_0x72a0('0xf')](_0x72a0('0x38'),this[_0x72a0('0x39')][_0x72a0('0x11')](this));_0x3a293f[_0x72a0('0xf')]('end',this[_0x72a0('0x3a')]['bind'](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x37')]=function(_0x446222){simpleParser(_0x446222,{'Iconv':Iconv},this[_0x72a0('0x3b')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x39')]=function(){};EmailImap[_0x72a0('0x17')][_0x72a0('0x3a')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x41cfc3,_0x1d9403){if(_0x41cfc3){logger[_0x72a0('0x33')](_0x41cfc3);}else{var _0x2f8f42=this;utils[_0x72a0('0x3c')](this['account'],_0x1d9403,function(_0x3bdd4e){_0x2f8f42[_0x72a0('0x29')]('email',_0x3bdd4e);});}};EmailImap[_0x72a0('0x17')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0x72a0('0x2c')]['bind'](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x34')]=function(_0x1250ac){this[_0x72a0('0x14')](_0x1250ac);this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x13')]=function(){this['emit'](_0x72a0('0x12'));};EmailImap[_0x72a0('0x17')]['handleError']=function(_0x2a8ddf,_0x1f2897){logger[_0x72a0('0x33')](_0x72a0('0x14'),this[_0x72a0('0xd')][_0x72a0('0xa')],JSON['stringify'](_0x2a8ddf));var _0x27d06f='';if(_0x2a8ddf){if(_0x2a8ddf['textCode']){_0x27d06f=_0x2a8ddf[_0x72a0('0x3d')];}else{for(var _0x4ac6dd in _0x2a8ddf){if(_0x2a8ddf[_0x72a0('0x3e')](_0x4ac6dd)){_0x27d06f+=_[_0x72a0('0x3f')](_0x4ac6dd)+':\x20'+_0x2a8ddf[_0x4ac6dd]+'\x0a';}}}}if(_0x1f2897){this['imap'][_0x72a0('0x12')]();}else{this['emit'](_0x72a0('0x33'),_0x27d06f);this[_0x72a0('0x29')](_0x72a0('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2221095..b815fc4 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 _0x3d04=['nodemailer-plugin-inline-base64','prototype','send','sendMail','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0x10ae7e,_0x5dc031){var _0x4dd665=function(_0x3bea29){while(--_0x3bea29){_0x10ae7e['push'](_0x10ae7e['shift']());}};_0x4dd665(++_0x5dc031);}(_0x3d04,0x6b));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var nodemailer=require(_0x43d0('0x0'));var inlineBase64=require(_0x43d0('0x1'));function EmailSmtp(){}EmailSmtp[_0x43d0('0x2')][_0x43d0('0x3')]=function(_0x143d7a,_0x4d0e9d){return new Promise(function(_0x2060a6,_0xba8c80){var _0x4b0f69=nodemailer['createTransport'](_0x143d7a);_0x4b0f69['use']('compile',inlineBase64());_0x4b0f69[_0x43d0('0x4')](_0x4d0e9d,function(_0x139e88,_0x239d69){if(_0x139e88){_0xba8c80(_0x139e88['toString']());}else{_0x2060a6(_0x239d69);}});});};EmailSmtp[_0x43d0('0x2')][_0x43d0('0x5')]=function(_0x416621){return new Promise(function(_0x538bbe,_0x5e967b){var _0x587e5f=nodemailer['createTransport'](_0x416621);_0x587e5f[_0x43d0('0x5')](function(_0x17e94d,_0x4f78ff){if(_0x17e94d){_0x5e967b(_0x17e94d[_0x43d0('0x6')]());}else{if(_0x4f78ff){_0x538bbe(_0x4f78ff);}else{_0x5e967b(_0x43d0('0x7'));}}});});};module[_0x43d0('0x8')]=EmailSmtp; \ No newline at end of file +var _0x5654=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x77d98d,_0x57ebc2){var _0x973893=function(_0x5847a8){while(--_0x5847a8){_0x77d98d['push'](_0x77d98d['shift']());}};_0x973893(++_0x57ebc2);}(_0x5654,0x18a));var _0x4565=function(_0x40ce0d,_0x4cdef9){_0x40ce0d=_0x40ce0d-0x0;var _0x57e3c1=_0x5654[_0x40ce0d];return _0x57e3c1;};'use strict';var nodemailer=require(_0x4565('0x0'));var inlineBase64=require(_0x4565('0x1'));function EmailSmtp(){}EmailSmtp[_0x4565('0x2')][_0x4565('0x3')]=function(_0x241c76,_0x28991c){return new Promise(function(_0x1b8d2b,_0x28c9bd){var _0x223e56=nodemailer[_0x4565('0x4')](_0x241c76);_0x223e56['use'](_0x4565('0x5'),inlineBase64());_0x223e56[_0x4565('0x6')](_0x28991c,function(_0x40d930,_0x217b35){if(_0x40d930){_0x28c9bd(_0x40d930[_0x4565('0x7')]());}else{_0x1b8d2b(_0x217b35);}});});};EmailSmtp[_0x4565('0x2')][_0x4565('0x8')]=function(_0x10a8b4){return new Promise(function(_0x92aa74,_0xdda39c){var _0x2e43ef=nodemailer[_0x4565('0x4')](_0x10a8b4);_0x2e43ef[_0x4565('0x8')](function(_0x3e6d87,_0x1f8e23){if(_0x3e6d87){_0xdda39c(_0x3e6d87['toString']());}else{if(_0x1f8e23){_0x92aa74(_0x1f8e23);}else{_0xdda39c(_0x4565('0x9'));}}});});};module[_0x4565('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 082e058..4fce614 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 _0xa268=['attachments','forEach','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','test','html','replace','includes','0x1?_0x298062[_0x8a26('0x11')](0x0,-0x1)['join']('\x20'):_0x548fd5[_0x8a26('0xc')];}return _0x8a26('0x12');}function getLastName(_0x5947fe){var _0x1beefc=_[_0x8a26('0x6')](_0x5947fe[_0x8a26('0x7')]);if(_0x1beefc&&_0x1beefc[_0x8a26('0xc')]){var _0x48210a=_0x1beefc['name'][_0x8a26('0xf')](/\s+/);return _0x48210a[_0x8a26('0x10')]>0x1?_0x48210a[_0x8a26('0x13')]():'';}return'';}function getMails(_0x25c588,_0x1b6ccf){var _0x385573='';for(var _0x3c6d11=0x0;_0x3c6d11<_0x1b6ccf[_0x8a26('0x7')][_0x8a26('0x10')];_0x3c6d11+=0x1){if(_0x1b6ccf[_0x8a26('0x7')][_0x3c6d11][_0x8a26('0x8')]!==_0x25c588){if(!_[_0x8a26('0x14')](_0x385573)){_0x385573+=',';}_0x385573+=_0x1b6ccf[_0x8a26('0x7')][_0x3c6d11]['name']||_0x1b6ccf[_0x8a26('0x7')][_0x3c6d11][_0x8a26('0x8')]||'';_0x385573+='\x20<';_0x385573+=_0x1b6ccf[_0x8a26('0x7')][_0x3c6d11][_0x8a26('0x8')]?_0x1b6ccf['value'][_0x3c6d11][_0x8a26('0x8')]:_0x8a26('0x9')+random[_0x8a26('0xa')](0x6)+_0x8a26('0xb');_0x385573+='>';}}return _0x385573;}function parseEmail(_0x2b9277,_0x3ebc65,_0xbc84e9){if(_0x3ebc65['html']){var _0x579325=/)<[^<]*)*<\/script>/gi;while(_0x579325[_0x8a26('0x15')](_0x3ebc65[_0x8a26('0x16')])){_0x3ebc65[_0x8a26('0x16')]=_0x3ebc65[_0x8a26('0x16')][_0x8a26('0x17')](_0x579325,'');}if(_0x3ebc65['html'][_0x8a26('0x18')](_0x8a26('0x19'))){var _0x4bb364=[];_0x3ebc65[_0x8a26('0x1a')][_0x8a26('0x1b')](_0x474297=>{_0x4bb364['push'](_0x474297[_0x8a26('0x1c')]);});var _0x15a4bb=/]+>/g;var _0xdf8866=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x207002=_0x3ebc65[_0x8a26('0x16')]['replace'](_0xdf8866,_0x8a26('0x1d'));var _0x5b28e2=_0x207002[_0x8a26('0x17')](_0x15a4bb,'_IMG');for(let _0x3cf65d=0x0;_0x3cf65d<_0x4bb364[_0x8a26('0x10')];_0x3cf65d++){var _0x297764=_0x5b28e2['replace'](_0x8a26('0x1e'),_0x8a26('0x1f')+_0x4bb364[_0x3cf65d]+_0x8a26('0x20'));_0x5b28e2=_0x297764;}_0x3ebc65[_0x8a26('0x16')]=_0x5b28e2;}_0xbc84e9[_0x8a26('0x21')]=_0x3ebc65['html'];}else{_0xbc84e9[_0x8a26('0x21')]=_0x3ebc65[_0x8a26('0x22')];}if(_0xbc84e9[_0x8a26('0x21')]){_0xbc84e9['body']=_0xbc84e9['body'][_0x8a26('0x17')](/0x0){var _0x1488f7=[_0x8a26('0x34'),_0x8a26('0x35'),_0x8a26('0x36')];for(var _0x461581=0x0;_0x461581<_0x3ebc65[_0x8a26('0x33')][_0x8a26('0x10')];_0x461581++){var _0x55b0e0=_[_0x8a26('0xe')](_0x1488f7,_0x3ebc65[_0x8a26('0x33')][_0x461581][_0x8a26('0x37')]);if(_0x55b0e0>=0x0){_0xbc84e9[_0x8a26('0x38')]=!![];}}}return _0xbc84e9;}exports[_0x8a26('0x39')]=function(_0x39ec6e,_0x3904cf,_0x1439b3){var _0x255c8f={'from':getAddress(_0x3904cf[_0x8a26('0x3a')]),'firstName':getFirstName(_0x3904cf[_0x8a26('0x3a')]),'lastName':getLastName(_0x3904cf[_0x8a26('0x3a')]),'mapKey':_0x8a26('0x26'),'message':{'from':getMails(_0x39ec6e[_0x8a26('0x26')],_0x3904cf[_0x8a26('0x3a')]),'to':_0x39ec6e['email'],'cc':'','subject':_0x3904cf['subject']||'','messageId':_0x3904cf[_0x8a26('0x3b')],'inReplyTo':_0x3904cf['inReplyTo'],'sentAt':moment(_0x3904cf['date'])[_0x8a26('0x3c')](_0x8a26('0x3d')),'attach':![],'attachments':[]}};if(!_0x3904cf['html']&&!_0x3904cf[_0x8a26('0x22')]){var _0x58f344=_[_0x8a26('0x3e')](_0x3904cf[_0x8a26('0x1a')],{'contentType':_0x8a26('0x3f')});if(_0x58f344[_0x8a26('0x10')]){logger[_0x8a26('0x40')](util['format'](_0x8a26('0x41'),_0x3904cf[_0x8a26('0x3b')]));tnef[_0x8a26('0x42')](_[_0x8a26('0x43')](_0x58f344)[_0x8a26('0x30')],function(_0x54deed,_0x4ead72){if(_0x4ead72){_0x3904cf[_0x8a26('0x16')]=_0x4ead72['BodyHTML']||_0x8a26('0x44');if(_0x4ead72['Attachments']){for(var _0x34cc5c=0x0;_0x34cc5c<_0x4ead72[_0x8a26('0x45')][_0x8a26('0x10')];_0x34cc5c++){var _0x5f49d7=_0x4ead72[_0x8a26('0x45')][_0x34cc5c];_0x255c8f[_0x8a26('0x24')][_0x8a26('0x1a')][_0x8a26('0x31')]({'filename':_0x5f49d7[_0x8a26('0x46')],'content':Buffer[_0x8a26('0x3a')](_0x5f49d7['Data'])});}}}_0x1439b3(parseEmail(_0x39ec6e,_0x3904cf,_0x255c8f));});}else{_0x3904cf['html']=_0x8a26('0x44');_0x1439b3(parseEmail(_0x39ec6e,_0x3904cf,_0x255c8f));}}else{_0x1439b3(parseEmail(_0x39ec6e,_0x3904cf,_0x255c8f));}};exports['generateXOAuth2Token']=function(_0x53c6f7,_0x11058a){var _0x2ed9d7=[_0x8a26('0x47')+(_0x11058a||''),_0x8a26('0x48')+_0x53c6f7,'',''];return Buffer[_0x8a26('0x3a')](_0x2ed9d7[_0x8a26('0x2d')](''),_0x8a26('0x49'))[_0x8a26('0x4a')](_0x8a26('0x4b'));}; \ No newline at end of file +var _0x235a=['message','originCc','includes','bcc','attach','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','Data','user=','utf-8','toString','base64','lodash','moment','randomstring','path','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','head','isEmpty','html','replace','attachments','push','filename','_SRC','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x5ce38a['slice'](0x0,-0x1)[_0xa235('0x10')]('\x20'):_0x2daea5[_0xa235('0xb')];}return _0xa235('0x11');}function getLastName(_0x3fe532){var _0x17be62=_[_0xa235('0x12')](_0x3fe532[_0xa235('0x6')]);if(_0x17be62&&_0x17be62[_0xa235('0xb')]){var _0x3c420e=_0x17be62[_0xa235('0xb')][_0xa235('0xe')](/\s+/);return _0x3c420e[_0xa235('0xf')]>0x1?_0x3c420e['pop']():'';}return'';}function getMails(_0x4cc13e,_0x26f7f2){var _0xab6433='';for(var _0x2fbe05=0x0;_0x2fbe05<_0x26f7f2['value'][_0xa235('0xf')];_0x2fbe05+=0x1){if(_0x26f7f2[_0xa235('0x6')][_0x2fbe05][_0xa235('0x7')]!==_0x4cc13e){if(!_[_0xa235('0x13')](_0xab6433)){_0xab6433+=',';}_0xab6433+=_0x26f7f2['value'][_0x2fbe05][_0xa235('0xb')]||_0x26f7f2[_0xa235('0x6')][_0x2fbe05][_0xa235('0x7')]||'';_0xab6433+='\x20<';_0xab6433+=_0x26f7f2[_0xa235('0x6')][_0x2fbe05]['address']?_0x26f7f2[_0xa235('0x6')][_0x2fbe05][_0xa235('0x7')]:_0xa235('0x8')+random[_0xa235('0x9')](0x6)+_0xa235('0xa');_0xab6433+='>';}}return _0xab6433;}function parseEmail(_0x278aec,_0x2d6625,_0x468447){if(_0x2d6625[_0xa235('0x14')]){var _0x3c16e7=/)<[^<]*)*<\/script>/gi;while(_0x3c16e7['test'](_0x2d6625[_0xa235('0x14')])){_0x2d6625[_0xa235('0x14')]=_0x2d6625['html'][_0xa235('0x15')](_0x3c16e7,'');}if(_0x2d6625[_0xa235('0x14')]['includes']('{_0x4f8691[_0xa235('0x17')](_0x37d673[_0xa235('0x18')]);});var _0x5a30a9=/]+>/g;var _0x31cd39=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x128c0f=_0x2d6625[_0xa235('0x14')][_0xa235('0x15')](_0x31cd39,_0xa235('0x19'));var _0x3891ad=_0x128c0f['replace'](_0x5a30a9,'_IMG');for(let _0x90809c=0x0;_0x90809c<_0x4f8691['length'];_0x90809c++){var _0x5cd19d=_0x3891ad[_0xa235('0x15')]('_IMG',_0xa235('0x1a')+_0x4f8691[_0x90809c]+'\x20]');_0x3891ad=_0x5cd19d;}_0x2d6625[_0xa235('0x14')]=_0x3891ad;}_0x468447[_0xa235('0x1b')]=_0x2d6625[_0xa235('0x14')];}else{_0x468447['body']=_0x2d6625[_0xa235('0x1c')];}if(_0x468447[_0xa235('0x1b')]){_0x468447[_0xa235('0x1b')]=_0x468447[_0xa235('0x1b')][_0xa235('0x15')](/0x0){var _0x1c61f1=[_0xa235('0x2e'),'X-Auto-Response-Suppress:\x20All',_0xa235('0x2f')];for(var _0x189d16=0x0;_0x189d16<_0x2d6625[_0xa235('0x2d')][_0xa235('0xf')];_0x189d16++){var _0x276065=_['indexOf'](_0x1c61f1,_0x2d6625[_0xa235('0x2d')][_0x189d16][_0xa235('0x30')]);if(_0x276065>=0x0){_0x468447['isAutoreply']=!![];}}}return _0x468447;}exports[_0xa235('0x31')]=function(_0x15a09a,_0xf52570,_0x2983ef){var _0xacff2a={'from':getAddress(_0xf52570[_0xa235('0x32')]),'firstName':getFirstName(_0xf52570[_0xa235('0x32')]),'lastName':getLastName(_0xf52570[_0xa235('0x32')]),'mapKey':_0xa235('0x4'),'message':{'from':getMails(_0x15a09a['email'],_0xf52570[_0xa235('0x32')]),'to':_0x15a09a[_0xa235('0x4')],'cc':'','subject':_0xf52570[_0xa235('0x33')]||'','messageId':_0xf52570['messageId'],'inReplyTo':_0xf52570['inReplyTo'],'sentAt':moment(_0xf52570[_0xa235('0x34')])['format'](_0xa235('0x35')),'attach':![],'attachments':[]}};if(!_0xf52570[_0xa235('0x14')]&&!_0xf52570[_0xa235('0x1c')]){var _0x50cfe7=_[_0xa235('0x36')](_0xf52570[_0xa235('0x16')],{'contentType':_0xa235('0x37')});if(_0x50cfe7['length']){logger[_0xa235('0x38')](util[_0xa235('0x25')](_0xa235('0x39'),_0xf52570[_0xa235('0x3a')]));tnef[_0xa235('0x3b')](_[_0xa235('0x3c')](_0x50cfe7)[_0xa235('0x2b')],function(_0xb37809,_0x3e8403){if(_0x3e8403){_0xf52570[_0xa235('0x14')]=_0x3e8403[_0xa235('0x3d')]||'

Empty\x20message

';if(_0x3e8403[_0xa235('0x3e')]){for(var _0x5d32fd=0x0;_0x5d32fd<_0x3e8403[_0xa235('0x3e')][_0xa235('0xf')];_0x5d32fd++){var _0x1317a2=_0x3e8403[_0xa235('0x3e')][_0x5d32fd];_0xacff2a[_0xa235('0x1e')][_0xa235('0x16')]['push']({'filename':_0x1317a2[_0xa235('0x3f')],'content':Buffer['from'](_0x1317a2[_0xa235('0x40')])});}}}_0x2983ef(parseEmail(_0x15a09a,_0xf52570,_0xacff2a));});}else{_0xf52570[_0xa235('0x14')]='

Empty\x20message

';_0x2983ef(parseEmail(_0x15a09a,_0xf52570,_0xacff2a));}}else{_0x2983ef(parseEmail(_0x15a09a,_0xf52570,_0xacff2a));}};exports['generateXOAuth2Token']=function(_0x561973,_0x2520ed){var _0x8bf1b8=[_0xa235('0x41')+(_0x2520ed||''),'auth=Bearer\x20'+_0x561973,'',''];return Buffer[_0xa235('0x32')](_0x8bf1b8[_0xa235('0x10')](''),_0xa235('0x42'))[_0xa235('0x43')](_0xa235('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9970cfa..2809c23 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 _0x444f=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x444f,0x1da));var _0xf444=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0x444f[_0x5b311b];return _0x4fa0de;};'use strict';var _=require(_0xf444('0x0'));function MailAccount(_0x32541a){this['id']=_0x32541a['id']||0x0;this[_0xf444('0x1')]=_0x32541a[_0xf444('0x1')]||_0xf444('0x2');this[_0xf444('0x3')]=_0x32541a[_0xf444('0x3')]||_0xf444('0x4');this['active']=_0x32541a[_0xf444('0x5')]||![];this[_0xf444('0x6')]=_0x32541a[_0xf444('0x6')]||[];this[_0xf444('0x7')]=_0x32541a['Smtp']||[];}module[_0xf444('0x8')]=MailAccount; \ No newline at end of file +var _0x46c4=['active','Imap','Smtp','exports','lodash','name','key'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x46c4,0xac));var _0x446c=function(_0x59fa29,_0x147fed){_0x59fa29=_0x59fa29-0x0;var _0x31bb16=_0x46c4[_0x59fa29];return _0x31bb16;};'use strict';var _=require(_0x446c('0x0'));function MailAccount(_0x51e8fc){this['id']=_0x51e8fc['id']||0x0;this[_0x446c('0x1')]=_0x51e8fc[_0x446c('0x1')]||'Service';this[_0x446c('0x2')]=_0x51e8fc[_0x446c('0x2')]||'SERV';this[_0x446c('0x3')]=_0x51e8fc[_0x446c('0x3')]||![];this[_0x446c('0x4')]=_0x51e8fc['Imap']||[];this[_0x446c('0x5')]=_0x51e8fc[_0x446c('0x5')]||[];}module[_0x446c('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e89979b..29715c9 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 _0xb831=['prototype','initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x1bd691,_0x40d7db){var _0x88b618=function(_0x4991fb){while(--_0x4991fb){_0x1bd691['push'](_0x1bd691['shift']());}};_0x88b618(++_0x40d7db);}(_0xb831,0x95));var _0x1b83=function(_0x33a48c,_0x4676f1){_0x33a48c=_0x33a48c-0x0;var _0x512897=_0xb831[_0x33a48c];return _0x512897;};'use strict';var _=require(_0x1b83('0x0'));var MailAccount=require(_0x1b83('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4f04ab,_0x596b10,_0x246d5f){var _0x40e060=_[_0x1b83('0x2')](_0x4f04ab,function(_0x1b34a8,_0xd2eb4){return _0x1b34a8[_0x246d5f];});for(var _0x44759b in _0x596b10){if(_0x596b10[_0x1b83('0x3')](_0x44759b)){if(!_0x40e060[_0x44759b]){delete _0x596b10[_0x44759b];}}}}Realtime['prototype'][_0x1b83('0x4')]=function(_0x58445f,_0x2e2e8b){for(var _0x584c51 in _0x2e2e8b){if(_0x58445f[_0x1b83('0x3')](_0x584c51)){_0x58445f[_0x584c51]=_0x2e2e8b[_0x584c51];}}};Realtime[_0x1b83('0x5')][_0x1b83('0x6')]=function(){var _0x96df0e=this;return function(_0x1166be){if(_0x1166be){freeIsNotKey(_0x1166be,_0x96df0e[_0x1b83('0x7')],'id');for(var _0x3213a9=0x0,_0x25c1ac={},_0x3cca75={};_0x3213a9<_0x1166be[_0x1b83('0x8')];_0x3213a9+=0x1){_0x25c1ac=_0x1166be[_0x3213a9];if(_['isUndefined'](_0x96df0e[_0x1b83('0x7')][_0x25c1ac['id']])){_0x96df0e[_0x1b83('0x7')][_0x25c1ac['id']]=new MailAccount(_0x25c1ac);}else{_[_0x1b83('0x9')](_0x96df0e[_0x1b83('0x7')][_0x25c1ac['id']],_0x25c1ac);}}}return _0x96df0e[_0x1b83('0x7')];};};module[_0x1b83('0xa')]=Realtime; \ No newline at end of file +var _0xe424=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash'];(function(_0x4811a5,_0x48fadc){var _0x1c6a8a=function(_0x2435e2){while(--_0x2435e2){_0x4811a5['push'](_0x4811a5['shift']());}};_0x1c6a8a(++_0x48fadc);}(_0xe424,0x6d));var _0x4e42=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xe424[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require(_0x4e42('0x0'));var MailAccount=require(_0x4e42('0x1'));var Realtime=function(){this[_0x4e42('0x2')]={};};function freeIsNotKey(_0x38b23d,_0x775860,_0x4fca8d){var _0x1303f7=_[_0x4e42('0x3')](_0x38b23d,function(_0x32b8a3,_0x11cb89){return _0x32b8a3[_0x4fca8d];});for(var _0x3ac86b in _0x775860){if(_0x775860[_0x4e42('0x4')](_0x3ac86b)){if(!_0x1303f7[_0x3ac86b]){delete _0x775860[_0x3ac86b];}}}}Realtime[_0x4e42('0x5')][_0x4e42('0x6')]=function(_0x2d5660,_0x5a6e8a){for(var _0x6aebac in _0x5a6e8a){if(_0x2d5660['hasOwnProperty'](_0x6aebac)){_0x2d5660[_0x6aebac]=_0x5a6e8a[_0x6aebac];}}};Realtime[_0x4e42('0x5')][_0x4e42('0x7')]=function(){var _0x497ec9=this;return function(_0x2efd2f){if(_0x2efd2f){freeIsNotKey(_0x2efd2f,_0x497ec9[_0x4e42('0x2')],'id');for(var _0x4aa369=0x0,_0x42eb08={},_0x55429c={};_0x4aa369<_0x2efd2f[_0x4e42('0x8')];_0x4aa369+=0x1){_0x42eb08=_0x2efd2f[_0x4aa369];if(_[_0x4e42('0x9')](_0x497ec9[_0x4e42('0x2')][_0x42eb08['id']])){_0x497ec9[_0x4e42('0x2')][_0x42eb08['id']]=new MailAccount(_0x42eb08);}else{_[_0x4e42('0xa')](_0x497ec9['mailAccounts'][_0x42eb08['id']],_0x42eb08);}}}return _0x497ec9[_0x4e42('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 00ac6e1..8c346ba 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 _0x1329=['active','key','ListId','TemplateId','Imap','CloudProvider','name','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','provider','email'];(function(_0x30bffb,_0x123bf5){var _0x2b373d=function(_0x2aee4e){while(--_0x2aee4e){_0x30bffb['push'](_0x30bffb['shift']());}};_0x2b373d(++_0x123bf5);}(_0x1329,0x199));var _0x9132=function(_0x1d9304,_0x132221){_0x1d9304=_0x1d9304-0x0;var _0x48fc9a=_0x1329[_0x1d9304];return _0x48fc9a;};'use strict';var client=require(_0x9132('0x0'));exports[_0x9132('0x1')]=function(){return function(){return client[_0x9132('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x9132('0x3'),'service',_0x9132('0x4'),_0x9132('0x5'),_0x9132('0x6'),_0x9132('0x7'),_0x9132('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x9132('0x9'),'include':[{'model':_0x9132('0xa'),'attributes':['id',_0x9132('0xb'),'service','type',_0x9132('0xc')],'as':_0x9132('0xa')}]},{'model':_0x9132('0xd'),'as':_0x9132('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x9132('0xb'),'service','type',_0x9132('0xc')],'as':_0x9132('0xa')}]}]},'log':_0x9132('0xf')});};};exports[_0x9132('0x10')]=function(_0x72c009,_0x1df6e1){return client[_0x9132('0x2')](_0x9132('0x11'),{'account':{'id':_0x72c009},'body':_0x1df6e1,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x33af=['type','data5','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service','email','active','ListId','TemplateId','Imap','CloudProvider'];(function(_0x45271c,_0x1bf2d8){var _0x44bfda=function(_0x46b3f6){while(--_0x46b3f6){_0x45271c['push'](_0x45271c['shift']());}};_0x44bfda(++_0x1bf2d8);}(_0x33af,0xec));var _0xf33a=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0x33af[_0x3794a0];return _0x5bdaba;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(){return function(){return client['Request'](_0xf33a('0x1'),{'options':{'attributes':['id',_0xf33a('0x2'),_0xf33a('0x3'),_0xf33a('0x4'),_0xf33a('0x5'),_0xf33a('0x6'),'key',_0xf33a('0x7'),_0xf33a('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0xf33a('0x9'),'include':[{'model':_0xf33a('0xa'),'attributes':['id',_0xf33a('0x2'),_0xf33a('0x4'),_0xf33a('0xb'),_0xf33a('0xc')],'as':'CloudProvider'}]},{'model':_0xf33a('0xd'),'as':_0xf33a('0xe'),'include':[{'model':_0xf33a('0xa'),'attributes':['id',_0xf33a('0x2'),_0xf33a('0x4'),_0xf33a('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':_0xf33a('0xf')});};};exports[_0xf33a('0x10')]=function(_0x170468,_0x22bd5c){return client[_0xf33a('0x11')]('NotifyMailAccount',{'account':{'id':_0x170468},'body':_0x22bd5c,'log':_0xf33a('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f96c15b..6bfd493 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 _0xf163=['ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0xf2be6f,_0x25d427){var _0xed8007=function(_0x375c77){while(--_0x375c77){_0xf2be6f['push'](_0xf2be6f['shift']());}};_0xed8007(++_0x25d427);}(_0xf163,0x18f));var _0x3f16=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xf163[_0x2d6197];return _0x4d0e75;};'use strict';var client=require(_0x3f16('0x0'));exports['getSettings']=function(){return client['Request'](_0x3f16('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3f16('0x2')]},'log':_0x3f16('0x3')});}; \ No newline at end of file +var _0x1ab0=['getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x12dafa,_0x51ce5){var _0x1f3784=function(_0xcdae68){while(--_0xcdae68){_0x12dafa['push'](_0x12dafa['shift']());}};_0x1f3784(++_0x51ce5);}(_0x1ab0,0xc4));var _0x01ab=function(_0x46bb27,_0x327845){_0x46bb27=_0x46bb27-0x0;var _0x597c0b=_0x1ab0[_0x46bb27];return _0x597c0b;};'use strict';var client=require('../client');exports[_0x01ab('0x0')]=function(){return client[_0x01ab('0x1')](_0x01ab('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x01ab('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f910a49..50ff770 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 6dfc72d..05f8fb1 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 _0x9d90=['http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','lodash'];(function(_0x50aa73,_0xc78ffe){var _0x3fb978=function(_0xc9a48c){while(--_0xc9a48c){_0x50aa73['push'](_0x50aa73['shift']());}};_0x3fb978(++_0xc78ffe);}(_0x9d90,0x175));var _0x09d9=function(_0x4a09c6,_0x376340){_0x4a09c6=_0x4a09c6-0x0;var _0x176863=_0x9d90[_0x4a09c6];return _0x176863;};'use strict';var _=require(_0x09d9('0x0'));var http=require(_0x09d9('0x1'));var express=require(_0x09d9('0x2'));var sticky=require(_0x09d9('0x3'));var Redis=require(_0x09d9('0x4'));var config=require(_0x09d9('0x5'));var app=express();var server=http[_0x09d9('0x6')](app);server[_0x09d9('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x09d9('0x8')])){var socketio=require(_0x09d9('0x9'))(server,{'transports':[_0x09d9('0xa'),_0x09d9('0xb')]});config[_0x09d9('0xc')]=_['defaults'](config[_0x09d9('0xc')],{'host':'localhost','port':0x18eb});socketio[_0x09d9('0xd')](require(_0x09d9('0xe'))({'pubClient':new Redis(config[_0x09d9('0xc')]),'subClient':new Redis(config[_0x09d9('0xc')])}));require(_0x09d9('0xf'))[_0x09d9('0x10')]();require(_0x09d9('0x11'))[_0x09d9('0x10')](socketio);require(_0x09d9('0x12'))[_0x09d9('0x10')](app);require(_0x09d9('0x13'))[_0x09d9('0x10')](app);}else{server[_0x09d9('0x14')]('listening',function(){console[_0x09d9('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x2411=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','express','sticky-session','ioredis','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/express','../../routes','listening','log'];(function(_0x4d344a,_0x293363){var _0x38b83d=function(_0x9738ee){while(--_0x9738ee){_0x4d344a['push'](_0x4d344a['shift']());}};_0x38b83d(++_0x293363);}(_0x2411,0x179));var _0x1241=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x2411[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x1241('0x0'));var sticky=require(_0x1241('0x1'));var Redis=require(_0x1241('0x2'));var config=require(_0x1241('0x3'));var app=express();var server=http[_0x1241('0x4')](app);server[_0x1241('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x1241('0x6'))(server,{'transports':[_0x1241('0x7'),_0x1241('0x8')]});config[_0x1241('0x9')]=_[_0x1241('0xa')](config['redis'],{'host':_0x1241('0xb'),'port':0x18eb});socketio[_0x1241('0xc')](require(_0x1241('0xd'))({'pubClient':new Redis(config[_0x1241('0x9')]),'subClient':new Redis(config[_0x1241('0x9')])}));require('../../config/triggers')[_0x1241('0xe')]();require('../../config/socketio')['default'](socketio);require(_0x1241('0xf'))[_0x1241('0xe')](app);require(_0x1241('0x10'))[_0x1241('0xe')](app);}else{server['once'](_0x1241('0x11'),function(){console[_0x1241('0x12')](_0x1241('0x13'),config[_0x1241('0x14')]);});}exports=module[_0x1241('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 71cfcb7..37a4756 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 _0xe2ad=['bluebird','../../config/logger','routing','http','then','debug','rpc','error','message','catch','exports','jayson/promise'];(function(_0x3b5657,_0x12acd2){var _0xc054d0=function(_0x324f44){while(--_0x324f44){_0x3b5657['push'](_0x3b5657['shift']());}};_0xc054d0(++_0x12acd2);}(_0xe2ad,0xef));var _0xde2a=function(_0x455de2,_0x4cd4de){_0x455de2=_0x455de2-0x0;var _0x5c6d70=_0xe2ad[_0x455de2];return _0x5c6d70;};'use strict';var jayson=require(_0xde2a('0x0'));var BPromise=require(_0xde2a('0x1'));var logger=require(_0xde2a('0x2'))(_0xde2a('0x3'));var client=jayson['client'][_0xde2a('0x4')]({'port':0x2329});client['Request']=function(_0x5ba1c8,_0x189758){return new BPromise(function(_0x51dc24,_0x286cdd){return client['request'](_0x5ba1c8,_0x189758)[_0xde2a('0x5')](function(_0xb4eaf9){logger[_0xde2a('0x6')](_0xde2a('0x7'),_0xde2a('0x3'),_0x5ba1c8,_0x189758,_0xb4eaf9);if(_0xb4eaf9[_0xde2a('0x8')]){logger[_0xde2a('0x8')](_0xde2a('0x7'),_0xde2a('0x3'),_0x5ba1c8,_0xb4eaf9['error']['message'],_0x189758);return _0x286cdd(_0xb4eaf9[_0xde2a('0x8')][_0xde2a('0x9')]);}else{return _0x51dc24(_0xb4eaf9['result']);}})[_0xde2a('0xa')](function(_0xeb230){logger[_0xde2a('0x8')]('rpc',_0xde2a('0x3'),_0x5ba1c8,_0xeb230,_0x189758);return _0x286cdd(_0xeb230);});});};module[_0xde2a('0xb')]=client; \ No newline at end of file +var _0x3f79=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then','error','rpc','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3f79,0x80));var _0x93f7=function(_0x5a5749,_0x5d6d43){_0x5a5749=_0x5a5749-0x0;var _0xc4393f=_0x3f79[_0x5a5749];return _0xc4393f;};'use strict';var jayson=require(_0x93f7('0x0'));var BPromise=require(_0x93f7('0x1'));var logger=require(_0x93f7('0x2'))(_0x93f7('0x3'));var client=jayson[_0x93f7('0x4')]['http']({'port':0x2329});client[_0x93f7('0x5')]=function(_0x1fa2ba,_0x59788a){return new BPromise(function(_0x405569,_0x591b40){return client[_0x93f7('0x6')](_0x1fa2ba,_0x59788a)[_0x93f7('0x7')](function(_0x4db317){logger['debug']('rpc',_0x93f7('0x3'),_0x1fa2ba,_0x59788a,_0x4db317);if(_0x4db317['error']){logger[_0x93f7('0x8')](_0x93f7('0x9'),_0x93f7('0x3'),_0x1fa2ba,_0x4db317[_0x93f7('0x8')][_0x93f7('0xa')],_0x59788a);return _0x591b40(_0x4db317[_0x93f7('0x8')][_0x93f7('0xa')]);}else{return _0x405569(_0x4db317[_0x93f7('0xb')]);}})[_0x93f7('0xc')](function(_0x476c18){logger[_0x93f7('0x8')](_0x93f7('0x9'),_0x93f7('0x3'),_0x1fa2ba,_0x476c18,_0x59788a);return _0x591b40(_0x476c18);});});};module[_0x93f7('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f5acbd6..afcb378 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 _0x0fb0=['initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues'];(function(_0x4f03a9,_0x3fcec0){var _0xb28b01=function(_0x56b779){while(--_0x56b779){_0x4f03a9['push'](_0x4f03a9['shift']());}};_0xb28b01(++_0x3fcec0);}(_0x0fb0,0x1b4));var _0x00fb=function(_0x4e113f,_0x307471){_0x4e113f=_0x4e113f-0x0;var _0x4760b6=_0x0fb0[_0x4e113f];return _0x4760b6;};'use strict';var BPromise=require(_0x00fb('0x0'));var server=require(_0x00fb('0x1'));var Realtime=require(_0x00fb('0x2'));var user=require('./rpc/user');var interval=require(_0x00fb('0x3'));var openchannelQueue=require(_0x00fb('0x4'));var chatQueue=require(_0x00fb('0x5'));var smsQueue=require(_0x00fb('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x00fb('0x7'));var whatsappQueue=require(_0x00fb('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x00fb('0x9')]()['then'](user[_0x00fb('0xa')]())['then'](realtime[_0x00fb('0xb')]())[_0x00fb('0xc')](interval[_0x00fb('0xd')]())['then'](realtime[_0x00fb('0xe')]())[_0x00fb('0xc')](openchannelQueue[_0x00fb('0xf')]())['then'](realtime['initOpenchannelQueues']())[_0x00fb('0xc')](chatQueue[_0x00fb('0x10')]())[_0x00fb('0xc')](realtime[_0x00fb('0x11')]())['then'](smsQueue['getSmsQueues']())[_0x00fb('0xc')](realtime[_0x00fb('0x12')]())[_0x00fb('0xc')](mailQueue[_0x00fb('0x13')]())['then'](realtime[_0x00fb('0x14')]())[_0x00fb('0xc')](faxQueue[_0x00fb('0x15')]())[_0x00fb('0xc')](realtime[_0x00fb('0x16')]())[_0x00fb('0xc')](whatsappQueue['getWhatsappQueues']())[_0x00fb('0xc')](realtime[_0x00fb('0x17')]())[_0x00fb('0xc')](function(){return realtime;});}function main(){return server[_0x00fb('0x18')](realtime)[_0x00fb('0xc')](function(_0x5379a8){return initRealtime();})[_0x00fb('0xc')](function(_0x48b10d){return setInterval(initRealtime,0x1388);})[_0x00fb('0x19')](function(_0x51124d){console[_0x00fb('0x1a')](_0x51124d);});}main(); \ No newline at end of file +var _0xd82c=['getSmsQueues','getMailQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd82c,0x156));var _0xcd82=function(_0x45b2b5,_0x273192){_0x45b2b5=_0x45b2b5-0x0;var _0x1fd982=_0xd82c[_0x45b2b5];return _0x1fd982;};'use strict';var BPromise=require(_0xcd82('0x0'));var server=require(_0xcd82('0x1'));var Realtime=require(_0xcd82('0x2'));var user=require(_0xcd82('0x3'));var interval=require(_0xcd82('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xcd82('0x5'));var smsQueue=require(_0xcd82('0x6'));var mailQueue=require(_0xcd82('0x7'));var faxQueue=require(_0xcd82('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xcd82('0x9')]()[_0xcd82('0xa')](user[_0xcd82('0xb')]())[_0xcd82('0xa')](realtime['initAgents']())[_0xcd82('0xa')](interval[_0xcd82('0xc')]())[_0xcd82('0xa')](realtime[_0xcd82('0xd')]())[_0xcd82('0xa')](openchannelQueue[_0xcd82('0xe')]())[_0xcd82('0xa')](realtime[_0xcd82('0xf')]())['then'](chatQueue[_0xcd82('0x10')]())['then'](realtime[_0xcd82('0x11')]())[_0xcd82('0xa')](smsQueue[_0xcd82('0x12')]())[_0xcd82('0xa')](realtime['initSmsQueues']())[_0xcd82('0xa')](mailQueue[_0xcd82('0x13')]())['then'](realtime['initMailQueues']())[_0xcd82('0xa')](faxQueue['getFaxQueues']())['then'](realtime['initFaxQueues']())['then'](whatsappQueue[_0xcd82('0x14')]())[_0xcd82('0xa')](realtime[_0xcd82('0x15')]())[_0xcd82('0xa')](function(){return realtime;});}function main(){return server[_0xcd82('0x16')](realtime)[_0xcd82('0xa')](function(_0x4cb6de){return initRealtime();})[_0xcd82('0xa')](function(_0x5d507c){return setInterval(initRealtime,0x1388);})['catch'](function(_0x7fe11a){console[_0xcd82('0x17')](_0x7fe11a);});}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 0742cf7..2af8985 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x1261[_0x371b64];return _0x3cf3b1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0x1261[_0x3c3e72];return _0x48a7e5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 887244e..aa11ac7 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 _0x7397=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x7397,0x123));var _0x7739=function(_0x7f7b1c,_0x8c3053){_0x7f7b1c=_0x7f7b1c-0x0;var _0x3117af=_0x7397[_0x7f7b1c];return _0x3117af;};'use strict';var BPromise=require(_0x7739('0x0'));var jayson=require(_0x7739('0x1'));var client=jayson[_0x7739('0x2')][_0x7739('0x3')]({'port':0x232b});function request(_0x30f46f,_0x399490){return new BPromise(function(_0x4ee457,_0x317a31){return client[_0x7739('0x4')](_0x30f46f,_0x399490)['then'](function(_0x199ecb){if(_0x199ecb['error']){return _0x317a31(_0x199ecb[_0x7739('0x5')][_0x7739('0x6')]);}else{return _0x4ee457(_0x199ecb[_0x7739('0x7')]);}})[_0x7739('0x8')](function(_0x3c9711){return _0x317a31(_0x3c9711);});});}exports[_0x7739('0x9')]=function(_0x111187,_0x21033d){return request(_0x7739('0xa'),{'account':_0x111187,'message':_0x21033d});}; \ No newline at end of file +var _0x5c63=['jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x116a18,_0x4006ee){var _0x31fcf4=function(_0x228de4){while(--_0x228de4){_0x116a18['push'](_0x116a18['shift']());}};_0x31fcf4(++_0x4006ee);}(_0x5c63,0x12b));var _0x35c6=function(_0x17f6d0,_0x2204ec){_0x17f6d0=_0x17f6d0-0x0;var _0x2c7b25=_0x5c63[_0x17f6d0];return _0x2c7b25;};'use strict';var BPromise=require(_0x35c6('0x0'));var jayson=require(_0x35c6('0x1'));var client=jayson[_0x35c6('0x2')][_0x35c6('0x3')]({'port':0x232b});function request(_0x12c90,_0x5a00ae){return new BPromise(function(_0x59250a,_0x4ccd2f){return client[_0x35c6('0x4')](_0x12c90,_0x5a00ae)[_0x35c6('0x5')](function(_0x44c866){if(_0x44c866[_0x35c6('0x6')]){return _0x4ccd2f(_0x44c866[_0x35c6('0x6')][_0x35c6('0x7')]);}else{return _0x59250a(_0x44c866[_0x35c6('0x8')]);}})[_0x35c6('0x9')](function(_0x2f1102){return _0x4ccd2f(_0x2f1102);});});}exports[_0x35c6('0xa')]=function(_0xd736d8,_0x39defb){return request(_0x35c6('0xb'),{'account':_0xd736d8,'message':_0x39defb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0f1938e..f8cdaa0 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 _0x0c8d=['format','openchannelPause','chatStatusTime','chatCapacity','mailStatus','whatsappStatusTime','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','length','Status','StatusTime','toNumber'];(function(_0x303a13,_0x5a6501){var _0x1c642c=function(_0x1f6789){while(--_0x1f6789){_0x303a13['push'](_0x303a13['shift']());}};_0x1c642c(++_0x5a6501);}(_0x0c8d,0x79));var _0xd0c8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x0c8d[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var moment=require(_0xd0c8('0x0'));var md5=require(_0xd0c8('0x1'));var Redis=require(_0xd0c8('0x2'));var config=require(_0xd0c8('0x3'));config[_0xd0c8('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0c8('0x4')]));function Agent(_0x15d739){this['id']=_0x15d739['id']||0x0;this[_0xd0c8('0x5')]=_0x15d739['name']||'';this[_0xd0c8('0x6')]=_0x15d739['online']||!![];this[_0xd0c8('0x7')]=_0x15d739[_0xd0c8('0x7')]||![];this[_0xd0c8('0x8')]=_0x15d739[_0xd0c8('0x8')]||![];this[_0xd0c8('0x9')]=_0x15d739['mailPause']||![];this[_0xd0c8('0xa')]=_0x15d739[_0xd0c8('0xa')]||![];this[_0xd0c8('0xb')]=_0x15d739[_0xd0c8('0xb')]||![];this['openchannelPause']=_0x15d739['openchannelPause']||![];this[_0xd0c8('0xc')]=_0xd0c8('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x15d739['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xd0c8('0xd');this[_0xd0c8('0xe')]=0x0;this['mailCapacity']=_0x15d739[_0xd0c8('0xf')]||0x0;this[_0xd0c8('0x10')]=0x0;this[_0xd0c8('0x11')]=_0xd0c8('0xd');this[_0xd0c8('0x12')]=0x0;this[_0xd0c8('0x13')]=_0x15d739[_0xd0c8('0x13')]||0x0;this[_0xd0c8('0x14')]=0x0;this[_0xd0c8('0x15')]=_0xd0c8('0xd');this[_0xd0c8('0x16')]=0x0;this[_0xd0c8('0x17')]=_0x15d739['smsCapacity']||0x0;this[_0xd0c8('0x18')]=0x0;this[_0xd0c8('0x19')]=_0xd0c8('0xd');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x15d739[_0xd0c8('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xd0c8('0xd');this[_0xd0c8('0x1b')]=0x0;this['openchannelCapacity']=_0x15d739[_0xd0c8('0x1c')]||0x0;this[_0xd0c8('0x1d')]=0x0;this['busy']=![];this[_0xd0c8('0x1e')]=undefined;this[_0xd0c8('0x1')]='';this[_0xd0c8('0x1f')]();}Agent[_0xd0c8('0x20')][_0xd0c8('0x21')]=function(_0x2cd879){if(this[_0x2cd879+_0xd0c8('0x22')]>0x0){if(this[_0x2cd879+_0xd0c8('0x23')]>0x0&&this[_0x2cd879+_0xd0c8('0x22')]>=this[_0x2cd879+_0xd0c8('0x23')]){return _0xd0c8('0x24');}else{return _0xd0c8('0x25');}}else{return _0xd0c8('0x26');}};Agent[_0xd0c8('0x20')][_0xd0c8('0x1f')]=function(){var _0x1fbe73=[_0xd0c8('0x27'),_0xd0c8('0x28'),_0xd0c8('0x29'),'fax','sms',_0xd0c8('0x2a')];for(var _0x41cfd9=0x0;_0x41cfd9<_0x1fbe73[_0xd0c8('0x2b')];_0x41cfd9+=0x1){var _0x2ebc92=this[_0xd0c8('0x21')](_0x1fbe73[_0x41cfd9]);if(this[_0x1fbe73[_0x41cfd9]+_0xd0c8('0x2c')]!==_0x2ebc92){this[_0x1fbe73[_0x41cfd9]+_0xd0c8('0x2d')]=_[_0xd0c8('0x2e')](moment()[_0xd0c8('0x2f')]('x'));}this[_0x1fbe73[_0x41cfd9]+'Status']=_0x2ebc92;}var _0x3f8897={'id':this['id'],'name':this[_0xd0c8('0x5')],'online':this[_0xd0c8('0x6')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xd0c8('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd0c8('0x30')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd0c8('0x31')],'chatCapacity':this[_0xd0c8('0x32')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xd0c8('0x33')],'mailStatusTime':this[_0xd0c8('0xe')],'mailCapacity':this[_0xd0c8('0xf')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xd0c8('0x11')],'faxStatusTime':this[_0xd0c8('0x12')],'faxCapacity':this[_0xd0c8('0x13')],'faxCurrentCapacity':this[_0xd0c8('0x14')],'smsStatus':this[_0xd0c8('0x15')],'smsStatusTime':this[_0xd0c8('0x16')],'smsCapacity':this[_0xd0c8('0x17')],'smsCurrentCapacity':this[_0xd0c8('0x18')],'whatsappStatus':this[_0xd0c8('0x19')],'whatsappStatusTime':this[_0xd0c8('0x34')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xd0c8('0x1b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd0c8('0x1d')],'busy':this['busy'],'busyQueue':this[_0xd0c8('0x1e')]};var _0x6de030=md5(JSON[_0xd0c8('0x35')](_0x3f8897));if(this[_0xd0c8('0x1')]!==_0x6de030){this[_0xd0c8('0x1')]=_0x6de030;io[_0xd0c8('0x36')](_0xd0c8('0x37'),_0x3f8897);}};module['exports']=Agent; \ No newline at end of file +var _0xa768=['whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','smsPause','chatCurrentCapacity','smsStatus','whatsappCurrentCapacity','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','exports','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x39adec,_0x184c9f){var _0x394a73=function(_0x339de8){while(--_0x339de8){_0x39adec['push'](_0x39adec['shift']());}};_0x394a73(++_0x184c9f);}(_0xa768,0x93));var _0x8a76=function(_0x3c6313,_0x48811a){_0x3c6313=_0x3c6313-0x0;var _0x53e98f=_0xa768[_0x3c6313];return _0x53e98f;};'use strict';var _=require('lodash');var moment=require(_0x8a76('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x8a76('0x1'));config[_0x8a76('0x2')]=_[_0x8a76('0x3')](config[_0x8a76('0x2')],{'host':_0x8a76('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x108fe2){this['id']=_0x108fe2['id']||0x0;this[_0x8a76('0x5')]=_0x108fe2['name']||'';this[_0x8a76('0x6')]=_0x108fe2[_0x8a76('0x6')]||!![];this[_0x8a76('0x7')]=_0x108fe2[_0x8a76('0x7')]||![];this[_0x8a76('0x8')]=_0x108fe2['chatPause']||![];this[_0x8a76('0x9')]=_0x108fe2[_0x8a76('0x9')]||![];this[_0x8a76('0xa')]=_0x108fe2[_0x8a76('0xa')]||![];this['smsPause']=_0x108fe2['smsPause']||![];this[_0x8a76('0xb')]=_0x108fe2[_0x8a76('0xb')]||![];this[_0x8a76('0xc')]=_0x8a76('0xd');this[_0x8a76('0xe')]=0x0;this[_0x8a76('0xf')]=_0x108fe2['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x8a76('0x10')]=_0x8a76('0xd');this[_0x8a76('0x11')]=0x0;this[_0x8a76('0x12')]=_0x108fe2['mailCapacity']||0x0;this[_0x8a76('0x13')]=0x0;this[_0x8a76('0x14')]=_0x8a76('0xd');this[_0x8a76('0x15')]=0x0;this[_0x8a76('0x16')]=_0x108fe2[_0x8a76('0x16')]||0x0;this[_0x8a76('0x17')]=0x0;this['smsStatus']=_0x8a76('0xd');this[_0x8a76('0x18')]=0x0;this[_0x8a76('0x19')]=_0x108fe2[_0x8a76('0x19')]||0x0;this[_0x8a76('0x1a')]=0x0;this[_0x8a76('0x1b')]=_0x8a76('0xd');this[_0x8a76('0x1c')]=0x0;this[_0x8a76('0x1d')]=_0x108fe2[_0x8a76('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x8a76('0x1e')]=_0x8a76('0xd');this['openchannelStatusTime']=0x0;this[_0x8a76('0x1f')]=_0x108fe2['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8a76('0x20')]=![];this[_0x8a76('0x21')]=undefined;this[_0x8a76('0x22')]='';this[_0x8a76('0x23')]();}Agent[_0x8a76('0x24')][_0x8a76('0x25')]=function(_0x1a8b0a){if(this[_0x1a8b0a+_0x8a76('0x26')]>0x0){if(this[_0x1a8b0a+_0x8a76('0x27')]>0x0&&this[_0x1a8b0a+_0x8a76('0x26')]>=this[_0x1a8b0a+_0x8a76('0x27')]){return _0x8a76('0x28');}else{return _0x8a76('0x29');}}else{return'idle';}};Agent[_0x8a76('0x24')][_0x8a76('0x23')]=function(){var _0x523f3e=['mail','chat',_0x8a76('0x2a'),_0x8a76('0x2b'),'sms',_0x8a76('0x2c')];for(var _0xcc82c0=0x0;_0xcc82c0<_0x523f3e[_0x8a76('0x2d')];_0xcc82c0+=0x1){var _0x5e6482=this[_0x8a76('0x25')](_0x523f3e[_0xcc82c0]);if(this[_0x523f3e[_0xcc82c0]+_0x8a76('0x2e')]!==_0x5e6482){this[_0x523f3e[_0xcc82c0]+_0x8a76('0x2f')]=_[_0x8a76('0x30')](moment()['format']('x'));}this[_0x523f3e[_0xcc82c0]+'Status']=_0x5e6482;}var _0x54c2f6={'id':this['id'],'name':this[_0x8a76('0x5')],'online':this['online'],'voicePause':this[_0x8a76('0x7')],'chatPause':this[_0x8a76('0x8')],'mailPause':this[_0x8a76('0x9')],'smsPause':this[_0x8a76('0x31')],'faxPause':this[_0x8a76('0xa')],'openchannelPause':this[_0x8a76('0xb')],'chatStatus':this[_0x8a76('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8a76('0x32')],'mailStatus':this[_0x8a76('0x10')],'mailStatusTime':this[_0x8a76('0x11')],'mailCapacity':this[_0x8a76('0x12')],'mailCurrentCapacity':this[_0x8a76('0x13')],'faxStatus':this[_0x8a76('0x14')],'faxStatusTime':this[_0x8a76('0x15')],'faxCapacity':this[_0x8a76('0x16')],'faxCurrentCapacity':this[_0x8a76('0x17')],'smsStatus':this[_0x8a76('0x33')],'smsStatusTime':this[_0x8a76('0x18')],'smsCapacity':this[_0x8a76('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x8a76('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x8a76('0x34')],'openchannelStatus':this[_0x8a76('0x1e')],'openchannelStatusTime':this[_0x8a76('0x35')],'openchannelCapacity':this[_0x8a76('0x1f')],'openchannelCurrentCapacity':this[_0x8a76('0x36')],'busy':this[_0x8a76('0x20')],'busyQueue':this['busyQueue']};var _0x5efaca=md5(JSON[_0x8a76('0x37')](_0x54c2f6));if(this[_0x8a76('0x22')]!==_0x5efaca){this[_0x8a76('0x22')]=_0x5efaca;io[_0x8a76('0x38')]('user:save',_0x54c2f6);}};module[_0x8a76('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 66e2148..26711c3 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 _0x39d6=['defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x5a66b7,_0x517636){var _0x5f56e3=function(_0x1c602d){while(--_0x1c602d){_0x5a66b7['push'](_0x5a66b7['shift']());}};_0x5f56e3(++_0x517636);}(_0x39d6,0x1db));var _0x639d=function(_0x565de9,_0x114287){_0x565de9=_0x565de9-0x0;var _0x5f5dab=_0x39d6[_0x565de9];return _0x5f5dab;};'use strict';var _=require(_0x639d('0x0'));var md5=require(_0x639d('0x1'));var util=require(_0x639d('0x2'));var Redis=require(_0x639d('0x3'));var config=require(_0x639d('0x4'));config['redis']=_[_0x639d('0x5')](config[_0x639d('0x6')],{'host':_0x639d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x639d('0x6')]));function ChatQueue(_0x4f9b66){this['id']=_0x4f9b66['id']||0x0;this[_0x639d('0x8')]=_0x4f9b66[_0x639d('0x8')]||'';this[_0x639d('0x9')]=_0x4f9b66[_0x639d('0x9')]||0xa;this[_0x639d('0xa')]=_0x4f9b66[_0x639d('0xa')]||_0x639d('0xb');this[_0x639d('0xc')]=_0x4f9b66['Agents'];this[_0x639d('0xd')]={};this[_0x639d('0xe')]=0x0;this[_0x639d('0x1')]='';this[_0x639d('0xf')]();this[_0x639d('0x10')]();}ChatQueue[_0x639d('0x11')][_0x639d('0xf')]=function(){var _0x3d3759=this[_0x639d('0xd')]['_rr'];this[_0x639d('0xd')]=_[_0x639d('0x12')](this[_0x639d('0xc')],'id');this['mapAgentsId'][_0x639d('0x13')]=_0x3d3759;};ChatQueue['prototype'][_0x639d('0x10')]=function(){this[_0x639d('0x14')]=0x0;this['paused']=0x0;for(var _0x17d113=0x0;_0x17d113=0x0?this[_0x639d('0x19')]:0x0;var _0x931e83={'id':this['id'],'available':this['available'],'loggedIn':this[_0x639d('0x14')],'name':this[_0x639d('0x8')],'paused':this['paused'],'waiting':this[_0x639d('0xe')]};var _0x3f3437=md5(JSON[_0x639d('0x1a')](_0x931e83));if(this['md5']!==_0x3f3437){this[_0x639d('0x1')]=_0x3f3437;io['to'](util[_0x639d('0x1b')](_0x639d('0x1c'),_0x931e83['name']))[_0x639d('0x1d')](_0x639d('0x1e'),_0x931e83);}};module[_0x639d('0x1f')]=ChatQueue; \ No newline at end of file +var _0x8990=['util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','_rr','Agents','prototype','loggedIn','paused','length','online','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5'];(function(_0x33971b,_0xcf6a45){var _0xb9d234=function(_0x58c021){while(--_0x58c021){_0x33971b['push'](_0x33971b['shift']());}};_0xb9d234(++_0xcf6a45);}(_0x8990,0x143));var _0x0899=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0x8990[_0x316904];return _0xfa9a21;};'use strict';var _=require(_0x0899('0x0'));var md5=require(_0x0899('0x1'));var util=require(_0x0899('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0899('0x3')]=_['defaults'](config['redis'],{'host':_0x0899('0x4'),'port':0x18eb});var io=require(_0x0899('0x5'))(new Redis(config['redis']));function ChatQueue(_0x5b51f3){this['id']=_0x5b51f3['id']||0x0;this[_0x0899('0x6')]=_0x5b51f3[_0x0899('0x6')]||'';this['timeout']=_0x5b51f3[_0x0899('0x7')]||0xa;this[_0x0899('0x8')]=_0x5b51f3[_0x0899('0x8')]||_0x0899('0x9');this['Agents']=_0x5b51f3['Agents'];this[_0x0899('0xa')]={};this[_0x0899('0xb')]=0x0;this[_0x0899('0x1')]='';this[_0x0899('0xc')]();this['updateRealtime']();}ChatQueue['prototype'][_0x0899('0xc')]=function(){var _0x357c7d=this[_0x0899('0xa')][_0x0899('0xd')];this['mapAgentsId']=_['map'](this[_0x0899('0xe')],'id');this['mapAgentsId'][_0x0899('0xd')]=_0x357c7d;};ChatQueue[_0x0899('0xf')]['updateRealtime']=function(){this[_0x0899('0x10')]=0x0;this[_0x0899('0x11')]=0x0;for(var _0x130e4c=0x0;_0x130e4c=0x0?this[_0x0899('0x14')]:0x0;var _0x4388b0={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0899('0x10')],'name':this['name'],'paused':this[_0x0899('0x11')],'waiting':this[_0x0899('0xb')]};var _0x186a0e=md5(JSON['stringify'](_0x4388b0));if(this[_0x0899('0x1')]!==_0x186a0e){this['md5']=_0x186a0e;io['to'](util[_0x0899('0x15')](_0x0899('0x16'),_0x4388b0[_0x0899('0x6')]))[_0x0899('0x17')](_0x0899('0x18'),_0x4388b0);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index defbd2f..3b1c862 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 _0x104d=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name'];(function(_0x1b6e8d,_0x57ef1e){var _0x55f0bb=function(_0x4b5a71){while(--_0x4b5a71){_0x1b6e8d['push'](_0x1b6e8d['shift']());}};_0x55f0bb(++_0x57ef1e);}(_0x104d,0x137));var _0xd104=function(_0x43b0d5,_0x499afb){_0x43b0d5=_0x43b0d5-0x0;var _0x25909e=_0x104d[_0x43b0d5];return _0x25909e;};'use strict';var _=require(_0xd104('0x0'));var md5=require(_0xd104('0x1'));var util=require(_0xd104('0x2'));var Redis=require(_0xd104('0x3'));var config=require('../../../config/environment');config[_0xd104('0x4')]=_['defaults'](config[_0xd104('0x4')],{'host':_0xd104('0x5'),'port':0x18eb});var io=require(_0xd104('0x6'))(new Redis(config[_0xd104('0x4')]));function FaxQueue(_0x58d6fb){this['id']=_0x58d6fb['id']||0x0;this[_0xd104('0x7')]=_0x58d6fb[_0xd104('0x7')]||'';this[_0xd104('0x8')]=_0x58d6fb[_0xd104('0x8')]||0xa;this['strategy']=_0x58d6fb[_0xd104('0x9')]||_0xd104('0xa');this[_0xd104('0xb')]=_0x58d6fb['Agents'];this[_0xd104('0xc')]={};this[_0xd104('0xd')]=0x0;this[_0xd104('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xd104('0xe')][_0xd104('0xf')]=function(){var _0x5b0d50=this['mapAgentsId'][_0xd104('0x10')];this[_0xd104('0xc')]=_[_0xd104('0x11')](this[_0xd104('0xb')],'id');this[_0xd104('0xc')][_0xd104('0x10')]=_0x5b0d50;};FaxQueue[_0xd104('0xe')][_0xd104('0x12')]=function(){this[_0xd104('0x13')]=0x0;this[_0xd104('0x14')]=0x0;for(var _0x4ccf55=0x0;_0x4ccf55=0x0?this[_0xd104('0x18')]:0x0;var _0x1692ea={'id':this['id'],'available':this[_0xd104('0x18')],'loggedIn':this[_0xd104('0x13')],'name':this[_0xd104('0x7')],'paused':this[_0xd104('0x14')],'waiting':this[_0xd104('0xd')]};var _0x5223a1=md5(JSON[_0xd104('0x19')](_0x1692ea));if(this[_0xd104('0x1')]!==_0x5223a1){this[_0xd104('0x1')]=_0x5223a1;io['to'](util['format']('fax:queue:%s',_0x1692ea[_0xd104('0x7')]))[_0xd104('0x1a')](_0xd104('0x1b'),_0x1692ea);}};module[_0xd104('0x1c')]=FaxQueue; \ No newline at end of file +var _0x84a6=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','paused','available','stringify','md5','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x42e8a6,_0xc5c6f3){var _0xd1b0c5=function(_0x2c6507){while(--_0x2c6507){_0x42e8a6['push'](_0x42e8a6['shift']());}};_0xd1b0c5(++_0xc5c6f3);}(_0x84a6,0x17b));var _0x684a=function(_0x2c3069,_0xb2f898){_0x2c3069=_0x2c3069-0x0;var _0x2ace87=_0x84a6[_0x2c3069];return _0x2ace87;};'use strict';var _=require(_0x684a('0x0'));var md5=require('md5');var util=require(_0x684a('0x1'));var Redis=require(_0x684a('0x2'));var config=require(_0x684a('0x3'));config[_0x684a('0x4')]=_[_0x684a('0x5')](config[_0x684a('0x4')],{'host':_0x684a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x684a('0x4')]));function FaxQueue(_0x13be1b){this['id']=_0x13be1b['id']||0x0;this[_0x684a('0x7')]=_0x13be1b[_0x684a('0x7')]||'';this[_0x684a('0x8')]=_0x13be1b[_0x684a('0x8')]||0xa;this[_0x684a('0x9')]=_0x13be1b[_0x684a('0x9')]||'beepall';this['Agents']=_0x13be1b[_0x684a('0xa')];this[_0x684a('0xb')]={};this[_0x684a('0xc')]=0x0;this['md5']='';this[_0x684a('0xd')]();this[_0x684a('0xe')]();}FaxQueue[_0x684a('0xf')][_0x684a('0xd')]=function(){var _0x73793f=this['mapAgentsId'][_0x684a('0x10')];this[_0x684a('0xb')]=_[_0x684a('0x11')](this[_0x684a('0xa')],'id');this[_0x684a('0xb')][_0x684a('0x10')]=_0x73793f;};FaxQueue[_0x684a('0xf')][_0x684a('0xe')]=function(){this[_0x684a('0x12')]=0x0;this['paused']=0x0;for(var _0x7d7a3b=0x0;_0x7d7a3b=0x0?this['available']:0x0;var _0x721b53={'id':this['id'],'available':this[_0x684a('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x684a('0x7')],'paused':this[_0x684a('0x14')],'waiting':this['waiting']};var _0x5a2a60=md5(JSON[_0x684a('0x16')](_0x721b53));if(this[_0x684a('0x17')]!==_0x5a2a60){this[_0x684a('0x17')]=_0x5a2a60;io['to'](util[_0x684a('0x18')]('fax:queue:%s',_0x721b53['name']))[_0x684a('0x19')](_0x684a('0x1a'),_0x721b53);}};module[_0x684a('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 36a9f32..702b61d 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 _0x54e7=['name','Intervals','exports'];(function(_0x3fb4ea,_0x38f631){var _0x2d10c5=function(_0x2d33c1){while(--_0x2d33c1){_0x3fb4ea['push'](_0x3fb4ea['shift']());}};_0x2d10c5(++_0x38f631);}(_0x54e7,0x1c5));var _0x754e=function(_0x27be22,_0x52465e){_0x27be22=_0x27be22-0x0;var _0x17ecb6=_0x54e7[_0x27be22];return _0x17ecb6;};'use strict';function Interval(_0x214a98){this['id']=_0x214a98['id']||0x0;this[_0x754e('0x0')]=_0x214a98[_0x754e('0x0')]||'';this[_0x754e('0x1')]=_0x214a98['Intervals']||{};}module[_0x754e('0x2')]=Interval; \ No newline at end of file +var _0xf0f7=['Intervals','exports','name'];(function(_0x1b431c,_0x2bf363){var _0x5017a1=function(_0x188627){while(--_0x188627){_0x1b431c['push'](_0x1b431c['shift']());}};_0x5017a1(++_0x2bf363);}(_0xf0f7,0x152));var _0x7f0f=function(_0x2ad7c0,_0x5d6ff5){_0x2ad7c0=_0x2ad7c0-0x0;var _0x1a2a9d=_0xf0f7[_0x2ad7c0];return _0x1a2a9d;};'use strict';function Interval(_0x5550e9){this['id']=_0x5550e9['id']||0x0;this['name']=_0x5550e9[_0x7f0f('0x0')]||'';this[_0x7f0f('0x1')]=_0x5550e9[_0x7f0f('0x1')]||{};}module[_0x7f0f('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 43872aa..60cbf02 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 _0xb52a=['mail_queue:save','lodash','md5','util','../../../config/environment','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','waiting','format','mail:queue:%s','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb52a,0x88));var _0xab52=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb52a[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xab52('0x0'));var md5=require(_0xab52('0x1'));var util=require(_0xab52('0x2'));var Redis=require('ioredis');var config=require(_0xab52('0x3'));config['redis']=_[_0xab52('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xab52('0x5'))(new Redis(config['redis']));function MailQueue(_0x18e948){this['id']=_0x18e948['id']||0x0;this[_0xab52('0x6')]=_0x18e948[_0xab52('0x6')]||'';this[_0xab52('0x7')]=_0x18e948[_0xab52('0x7')]||0xa;this[_0xab52('0x8')]=_0x18e948[_0xab52('0x8')]||_0xab52('0x9');this[_0xab52('0xa')]=_0x18e948[_0xab52('0xa')];this[_0xab52('0xb')]={};this['waiting']=0x0;this[_0xab52('0x1')]='';this[_0xab52('0xc')]();this['updateRealtime']();}MailQueue['prototype'][_0xab52('0xc')]=function(){var _0x4c9c3a=this[_0xab52('0xb')][_0xab52('0xd')];this[_0xab52('0xb')]=_[_0xab52('0xe')](this[_0xab52('0xa')],'id');this[_0xab52('0xb')][_0xab52('0xd')]=_0x4c9c3a;};MailQueue[_0xab52('0xf')]['updateRealtime']=function(){this[_0xab52('0x10')]=0x0;this[_0xab52('0x11')]=0x0;for(var _0x4ce252=0x0;_0x4ce252=0x0?this[_0xab52('0x15')]:0x0;var _0x42a765={'id':this['id'],'available':this[_0xab52('0x15')],'loggedIn':this[_0xab52('0x10')],'name':this[_0xab52('0x6')],'paused':this['paused'],'waiting':this[_0xab52('0x16')]};var _0x106ae0=md5(JSON['stringify'](_0x42a765));if(this[_0xab52('0x1')]!==_0x106ae0){this[_0xab52('0x1')]=_0x106ae0;io['to'](util[_0xab52('0x17')](_0xab52('0x18'),_0x42a765['name']))[_0xab52('0x19')](_0xab52('0x1a'),_0x42a765);}};module['exports']=MailQueue; \ No newline at end of file +var _0x88e7=['paused','available','waiting','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','_rr','mapAgentsId','map','loggedIn','length','online','mailPause'];(function(_0x58a4ac,_0x26f3e7){var _0x435e2d=function(_0x1a5660){while(--_0x1a5660){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x435e2d(++_0x26f3e7);}(_0x88e7,0x10c));var _0x788e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x88e7[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x788e('0x0'));var md5=require(_0x788e('0x1'));var util=require(_0x788e('0x2'));var Redis=require(_0x788e('0x3'));var config=require(_0x788e('0x4'));config['redis']=_[_0x788e('0x5')](config[_0x788e('0x6')],{'host':_0x788e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x788e('0x6')]));function MailQueue(_0x4b8eeb){this['id']=_0x4b8eeb['id']||0x0;this['name']=_0x4b8eeb[_0x788e('0x8')]||'';this['timeout']=_0x4b8eeb[_0x788e('0x9')]||0xa;this[_0x788e('0xa')]=_0x4b8eeb[_0x788e('0xa')]||_0x788e('0xb');this[_0x788e('0xc')]=_0x4b8eeb[_0x788e('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x788e('0x1')]='';this[_0x788e('0xd')]();this[_0x788e('0xe')]();}MailQueue['prototype'][_0x788e('0xd')]=function(){var _0x42dd07=this['mapAgentsId'][_0x788e('0xf')];this[_0x788e('0x10')]=_[_0x788e('0x11')](this[_0x788e('0xc')],'id');this[_0x788e('0x10')][_0x788e('0xf')]=_0x42dd07;};MailQueue['prototype'][_0x788e('0xe')]=function(){this[_0x788e('0x12')]=0x0;this['paused']=0x0;for(var _0x4b8592=0x0;_0x4b8592=0x0?this[_0x788e('0x17')]:0x0;var _0x3d06a7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x788e('0x12')],'name':this[_0x788e('0x8')],'paused':this['paused'],'waiting':this[_0x788e('0x18')]};var _0x2390b8=md5(JSON['stringify'](_0x3d06a7));if(this[_0x788e('0x1')]!==_0x2390b8){this['md5']=_0x2390b8;io['to'](util[_0x788e('0x19')](_0x788e('0x1a'),_0x3d06a7[_0x788e('0x8')]))['emit'](_0x788e('0x1b'),_0x3d06a7);}};module[_0x788e('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ebe4e66..f425c8c 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0x2ef3,0xba));var _0x32ef=function(_0x365ddb,_0x1b00fa){_0x365ddb=_0x365ddb-0x0;var _0x14153a=_0x2ef3[_0x365ddb];return _0x14153a;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x326f,0xd1));var _0xf326=function(_0x2f2caf,_0x3fde8a){_0x2f2caf=_0x2f2caf-0x0;var _0x485be1=_0x326f[_0x2f2caf];return _0x485be1;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0d9722d..45d9db4 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 _0x7980=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3cce32,_0x185a07){var _0x485d74=function(_0x27aa36){while(--_0x27aa36){_0x3cce32['push'](_0x3cce32['shift']());}};_0x485d74(++_0x185a07);}(_0x7980,0xab));var _0x0798=function(_0x1c9d4d,_0x1092c0){_0x1c9d4d=_0x1c9d4d-0x0;var _0x5c56dc=_0x7980[_0x1c9d4d];return _0x5c56dc;};'use strict';var _=require(_0x0798('0x0'));var md5=require(_0x0798('0x1'));var util=require(_0x0798('0x2'));var Redis=require(_0x0798('0x3'));var config=require(_0x0798('0x4'));config['redis']=_[_0x0798('0x5')](config[_0x0798('0x6')],{'host':_0x0798('0x7'),'port':0x18eb});var io=require(_0x0798('0x8'))(new Redis(config[_0x0798('0x6')]));function SmsQueue(_0x581bf3){this['id']=_0x581bf3['id']||0x0;this[_0x0798('0x9')]=_0x581bf3['name']||'';this[_0x0798('0xa')]=_0x581bf3[_0x0798('0xa')]||0xa;this[_0x0798('0xb')]=_0x581bf3['strategy']||'beepall';this[_0x0798('0xc')]=_0x581bf3[_0x0798('0xc')];this[_0x0798('0xd')]={};this[_0x0798('0xe')]=0x0;this[_0x0798('0x1')]='';this[_0x0798('0xf')]();this[_0x0798('0x10')]();}SmsQueue[_0x0798('0x11')][_0x0798('0xf')]=function(){var _0x234d37=this['mapAgentsId'][_0x0798('0x12')];this[_0x0798('0xd')]=_['map'](this['Agents'],'id');this[_0x0798('0xd')][_0x0798('0x12')]=_0x234d37;};SmsQueue[_0x0798('0x11')][_0x0798('0x10')]=function(){this[_0x0798('0x13')]=0x0;this[_0x0798('0x14')]=0x0;for(var _0xfd88af=0x0;_0xfd88af=0x0?this[_0x0798('0x17')]:0x0;var _0x46e74c={'id':this['id'],'available':this[_0x0798('0x17')],'loggedIn':this[_0x0798('0x13')],'name':this['name'],'paused':this[_0x0798('0x14')],'waiting':this[_0x0798('0xe')]};var _0x4f3f01=md5(JSON[_0x0798('0x18')](_0x46e74c));if(this[_0x0798('0x1')]!==_0x4f3f01){this[_0x0798('0x1')]=_0x4f3f01;io['to'](util[_0x0798('0x19')](_0x0798('0x1a'),_0x46e74c[_0x0798('0x9')]))[_0x0798('0x1b')](_0x0798('0x1c'),_0x46e74c);}};module[_0x0798('0x1d')]=SmsQueue; \ No newline at end of file +var _0xee11=['smsPause','available','md5','format','sms:queue:%s','sms_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x559add,_0x153177){var _0x1892af=function(_0xc1f90e){while(--_0xc1f90e){_0x559add['push'](_0x559add['shift']());}};_0x1892af(++_0x153177);}(_0xee11,0x146));var _0x1ee1=function(_0x4b1eda,_0x1ca265){_0x4b1eda=_0x4b1eda-0x0;var _0x520e6b=_0xee11[_0x4b1eda];return _0x520e6b;};'use strict';var _=require(_0x1ee1('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x1ee1('0x1'));var config=require(_0x1ee1('0x2'));config[_0x1ee1('0x3')]=_[_0x1ee1('0x4')](config[_0x1ee1('0x3')],{'host':_0x1ee1('0x5'),'port':0x18eb});var io=require(_0x1ee1('0x6'))(new Redis(config[_0x1ee1('0x3')]));function SmsQueue(_0x517892){this['id']=_0x517892['id']||0x0;this[_0x1ee1('0x7')]=_0x517892[_0x1ee1('0x7')]||'';this[_0x1ee1('0x8')]=_0x517892[_0x1ee1('0x8')]||0xa;this[_0x1ee1('0x9')]=_0x517892['strategy']||'beepall';this[_0x1ee1('0xa')]=_0x517892[_0x1ee1('0xa')];this[_0x1ee1('0xb')]={};this[_0x1ee1('0xc')]=0x0;this['md5']='';this[_0x1ee1('0xd')]();this['updateRealtime']();}SmsQueue[_0x1ee1('0xe')][_0x1ee1('0xd')]=function(){var _0x43cbdd=this[_0x1ee1('0xb')]['_rr'];this[_0x1ee1('0xb')]=_[_0x1ee1('0xf')](this['Agents'],'id');this[_0x1ee1('0xb')][_0x1ee1('0x10')]=_0x43cbdd;};SmsQueue[_0x1ee1('0xe')][_0x1ee1('0x11')]=function(){this[_0x1ee1('0x12')]=0x0;this[_0x1ee1('0x13')]=0x0;for(var _0x1a23e4=0x0;_0x1a23e4=0x0?this[_0x1ee1('0x17')]:0x0;var _0xff3d76={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1ee1('0x12')],'name':this[_0x1ee1('0x7')],'paused':this['paused'],'waiting':this[_0x1ee1('0xc')]};var _0xa5ec64=md5(JSON['stringify'](_0xff3d76));if(this['md5']!==_0xa5ec64){this[_0x1ee1('0x18')]=_0xa5ec64;io['to'](util[_0x1ee1('0x19')](_0x1ee1('0x1a'),_0xff3d76[_0x1ee1('0x7')]))['emit'](_0x1ee1('0x1b'),_0xff3d76);}};module[_0x1ee1('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 5dd52a0..2d5cff0 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 _0x0706=['map','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','exports','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x4574d9,_0x224f1a){var _0x30cea4=function(_0x4d26a5){while(--_0x4d26a5){_0x4574d9['push'](_0x4574d9['shift']());}};_0x30cea4(++_0x224f1a);}(_0x0706,0x7b));var _0x6070=function(_0x2a2b82,_0x4126ea){_0x2a2b82=_0x2a2b82-0x0;var _0x5c059d=_0x0706[_0x2a2b82];return _0x5c059d;};'use strict';var _=require('lodash');var md5=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var Redis=require('ioredis');var config=require(_0x6070('0x2'));config[_0x6070('0x3')]=_['defaults'](config['redis'],{'host':_0x6070('0x4'),'port':0x18eb});var io=require(_0x6070('0x5'))(new Redis(config[_0x6070('0x3')]));function WhatsappQueue(_0x468b5c){this['id']=_0x468b5c['id']||0x0;this['name']=_0x468b5c[_0x6070('0x6')]||'';this[_0x6070('0x7')]=_0x468b5c[_0x6070('0x7')]||0xa;this[_0x6070('0x8')]=_0x468b5c[_0x6070('0x8')]||_0x6070('0x9');this[_0x6070('0xa')]=_0x468b5c['Agents'];this[_0x6070('0xb')]={};this[_0x6070('0xc')]=0x0;this[_0x6070('0x0')]='';this[_0x6070('0xd')]();this[_0x6070('0xe')]();}WhatsappQueue[_0x6070('0xf')][_0x6070('0xd')]=function(){var _0x4da8d6=this[_0x6070('0xb')][_0x6070('0x10')];this[_0x6070('0xb')]=_[_0x6070('0x11')](this[_0x6070('0xa')],'id');this[_0x6070('0xb')]['_rr']=_0x4da8d6;};WhatsappQueue['prototype'][_0x6070('0xe')]=function(){this[_0x6070('0x12')]=0x0;this[_0x6070('0x13')]=0x0;for(var _0xe01eb8=0x0;_0xe01eb8=0x0?this['available']:0x0;var _0x10a253={'id':this['id'],'available':this[_0x6070('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6070('0x6')],'paused':this[_0x6070('0x13')],'waiting':this[_0x6070('0xc')]};var _0x547109=md5(JSON[_0x6070('0x18')](_0x10a253));if(this[_0x6070('0x0')]!==_0x547109){this[_0x6070('0x0')]=_0x547109;io['to'](util['format'](_0x6070('0x19'),_0x10a253['name']))[_0x6070('0x1a')]('whatsapp_queue:save',_0x10a253);}};module[_0x6070('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x62df=['_rr','map','paused','length','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x5040b9,_0x22145a){var _0x24cd1d=function(_0x56ad89){while(--_0x56ad89){_0x5040b9['push'](_0x5040b9['shift']());}};_0x24cd1d(++_0x22145a);}(_0x62df,0x12e));var _0xf62d=function(_0x3f8c85,_0x4712eb){_0x3f8c85=_0x3f8c85-0x0;var _0x34ec76=_0x62df[_0x3f8c85];return _0x34ec76;};'use strict';var _=require(_0xf62d('0x0'));var md5=require(_0xf62d('0x1'));var util=require(_0xf62d('0x2'));var Redis=require(_0xf62d('0x3'));var config=require(_0xf62d('0x4'));config[_0xf62d('0x5')]=_['defaults'](config[_0xf62d('0x5')],{'host':_0xf62d('0x6'),'port':0x18eb});var io=require(_0xf62d('0x7'))(new Redis(config[_0xf62d('0x5')]));function WhatsappQueue(_0x254fbc){this['id']=_0x254fbc['id']||0x0;this[_0xf62d('0x8')]=_0x254fbc[_0xf62d('0x8')]||'';this[_0xf62d('0x9')]=_0x254fbc[_0xf62d('0x9')]||0xa;this[_0xf62d('0xa')]=_0x254fbc[_0xf62d('0xa')]||_0xf62d('0xb');this[_0xf62d('0xc')]=_0x254fbc['Agents'];this[_0xf62d('0xd')]={};this[_0xf62d('0xe')]=0x0;this[_0xf62d('0x1')]='';this[_0xf62d('0xf')]();this[_0xf62d('0x10')]();}WhatsappQueue[_0xf62d('0x11')]['updateRouting']=function(){var _0x5414c8=this[_0xf62d('0xd')][_0xf62d('0x12')];this[_0xf62d('0xd')]=_[_0xf62d('0x13')](this[_0xf62d('0xc')],'id');this[_0xf62d('0xd')][_0xf62d('0x12')]=_0x5414c8;};WhatsappQueue[_0xf62d('0x11')][_0xf62d('0x10')]=function(){this['loggedIn']=0x0;this[_0xf62d('0x14')]=0x0;for(var _0x47113e=0x0;_0x47113e=0x0?this[_0xf62d('0x19')]:0x0;var _0x3cef43={'id':this['id'],'available':this[_0xf62d('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xf62d('0x8')],'paused':this[_0xf62d('0x14')],'waiting':this[_0xf62d('0xe')]};var _0x3ca732=md5(JSON[_0xf62d('0x1a')](_0x3cef43));if(this[_0xf62d('0x1')]!==_0x3ca732){this[_0xf62d('0x1')]=_0x3ca732;io['to'](util[_0xf62d('0x1b')](_0xf62d('0x1c'),_0x3cef43['name']))[_0xf62d('0x1d')](_0xf62d('0x1e'),_0x3cef43);}};module[_0xf62d('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8435f95..c124223 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8643aec..61967cd 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 _0x7292=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2874a5,_0x2e78fa){var _0xedda89=function(_0x59131d){while(--_0x59131d){_0x2874a5['push'](_0x2874a5['shift']());}};_0xedda89(++_0x2e78fa);}(_0x7292,0xde));var _0x2729=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7292[_0x13b8f3];return _0x1a6d06;};'use strict';var client=require(_0x2729('0x0'));exports[_0x2729('0x1')]=function(_0x34d0f4,_0x493585){return client[_0x2729('0x2')]('UpdateChatInteraction',{'body':_0x493585,'options':{'where':{'id':_0x34d0f4}},'log':_0x2729('0x3')});};exports[_0x2729('0x4')]=function(_0x1e9ce0,_0x255498){return client[_0x2729('0x2')](_0x2729('0x5'),{'body':_0x255498,'options':{'where':{'id':_0x1e9ce0}},'log':_0x2729('0x6')});}; \ No newline at end of file +var _0xa48c=['update','UpdateChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x315add,_0x5e9ace){var _0x40956b=function(_0x5273d2){while(--_0x5273d2){_0x315add['push'](_0x315add['shift']());}};_0x40956b(++_0x5e9ace);}(_0xa48c,0x133));var _0xca48=function(_0x5f4b06,_0x3e5997){_0x5f4b06=_0x5f4b06-0x0;var _0x55cc05=_0xa48c[_0x5f4b06];return _0x55cc05;};'use strict';var client=require(_0xca48('0x0'));exports[_0xca48('0x1')]=function(_0x47105e,_0x1ac36f){return client['Request'](_0xca48('0x2'),{'body':_0x1ac36f,'options':{'where':{'id':_0x47105e}},'log':_0xca48('0x3')});};exports['addTags']=function(_0x3b68f0,_0x361009){return client[_0xca48('0x4')](_0xca48('0x5'),{'body':_0x361009,'options':{'where':{'id':_0x3b68f0}},'log':_0xca48('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 017e56d..5abe637 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 _0x3579=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x57869b,_0x54672d){var _0x582bbb=function(_0x766d43){while(--_0x766d43){_0x57869b['push'](_0x57869b['shift']());}};_0x582bbb(++_0x54672d);}(_0x3579,0x1c3));var _0x9357=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x3579[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0x9357('0x0'));exports['create']=function(_0x4fbe3f){return client[_0x9357('0x1')](_0x9357('0x2'),{'body':_0x4fbe3f,'log':_0x9357('0x3')});}; \ No newline at end of file +var _0x57cd=['Request','createChatMessage','../client'];(function(_0x232b4b,_0x2d6502){var _0x6a29bb=function(_0x17d44d){while(--_0x17d44d){_0x232b4b['push'](_0x232b4b['shift']());}};_0x6a29bb(++_0x2d6502);}(_0x57cd,0xe0));var _0xd57c=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0x57cd[_0x526046];return _0x5b92a2;};'use strict';var client=require(_0xd57c('0x0'));exports['create']=function(_0x1b8c9c){return client[_0xd57c('0x1')]('CreateChatMessage',{'body':_0x1b8c9c,'log':_0xd57c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 46f194d..4212d96 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 _0x3c17=['chatPause','../client','Request','name','timeout','strategy','Agents','online'];(function(_0x2e6724,_0xee938a){var _0x3eb41b=function(_0x1e68aa){while(--_0x1e68aa){_0x2e6724['push'](_0x2e6724['shift']());}};_0x3eb41b(++_0xee938a);}(_0x3c17,0x1a1));var _0x73c1=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x3c17[_0x1eda20];return _0x31b953;};'use strict';var client=require(_0x73c1('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x73c1('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x73c1('0x2'),_0x73c1('0x3'),_0x73c1('0x4')],'include':[{'model':'User','as':_0x73c1('0x5'),'attributes':['id',_0x73c1('0x2'),_0x73c1('0x6'),_0x73c1('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x1dcc=['Agents','name','../client','getChatQueues','Request','GetChatQueue','timeout','User'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3597dc,_0x35f05a){_0x3597dc=_0x3597dc-0x0;var _0x2c6e24=_0x1dcc[_0x3597dc];return _0x2c6e24;};'use strict';var client=require(_0xc1dc('0x0'));exports[_0xc1dc('0x1')]=function(){return function(){return client[_0xc1dc('0x2')](_0xc1dc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc1dc('0x4'),'strategy'],'include':[{'model':_0xc1dc('0x5'),'as':_0xc1dc('0x6'),'attributes':['id',_0xc1dc('0x7'),'online','chatPause']}]},'log':_0xc1dc('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 95491df..6fc6f13 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 _0x5a8c=['Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','create'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x4d161e,_0x523a15){_0x4d161e=_0x4d161e-0x0;var _0x55d845=_0x5a8c[_0x4d161e];return _0x55d845;};'use strict';var client=require(_0xc5a8('0x0'));exports[_0xc5a8('0x1')]=function(_0x4de0b0){return client[_0xc5a8('0x2')](_0xc5a8('0x3'),{'body':_0x4de0b0,'log':_0xc5a8('0x3')});};exports[_0xc5a8('0x4')]=function(_0x5d67ef,_0x2d862c){return client[_0xc5a8('0x2')]('UpdateChatQueueReport',{'body':_0x2d862c,'options':{'where':{'uniqueid':_0x5d67ef},'order':[['id',_0xc5a8('0x5')]],'limit':0x1},'log':_0xc5a8('0x6')});}; \ No newline at end of file +var _0xecd5=['update','UpdateChatQueueReport','create','Request','CreateChatQueueReport'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0xecd5,0x110));var _0x5ecd=function(_0x477559,_0x529c0c){_0x477559=_0x477559-0x0;var _0x5a3cdc=_0xecd5[_0x477559];return _0x5a3cdc;};'use strict';var client=require('../client');exports[_0x5ecd('0x0')]=function(_0x2baced){return client[_0x5ecd('0x1')]('CreateChatQueueReport',{'body':_0x2baced,'log':_0x5ecd('0x2')});};exports[_0x5ecd('0x3')]=function(_0x469fd0,_0x458bb3){return client['Request'](_0x5ecd('0x4'),{'body':_0x458bb3,'options':{'where':{'uniqueid':_0x469fd0},'order':[['id','DESC']],'limit':0x1},'log':_0x5ecd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e623952..a8a32f6 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ed556,_0x7698a3){var _0x45f551=function(_0x16216c){while(--_0x16216c){_0x1ed556['push'](_0x1ed556['shift']());}};_0x45f551(++_0x7698a3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1202a2,_0x2912d9){var _0x3a8ac6=function(_0x3fd5fe){while(--_0x3fd5fe){_0x1202a2['push'](_0x1202a2['shift']());}};_0x3a8ac6(++_0x2912d9);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 5eaa377..7508110 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 _0x6565=['Request','../client','create'];(function(_0x13d097,_0x2fa4e2){var _0x192739=function(_0x42574f){while(--_0x42574f){_0x13d097['push'](_0x13d097['shift']());}};_0x192739(++_0x2fa4e2);}(_0x6565,0x1e4));var _0x5656=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x6565[_0x189b3b];return _0x7c4721;};'use strict';var client=require(_0x5656('0x0'));exports[_0x5656('0x1')]=function(_0x61f395){return client[_0x5656('0x2')]('CreateFaxMessage',{'body':_0x61f395,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x0881=['CreateFaxMessage','createFaxMessage'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x0881,0x108));var _0x1088=function(_0x8b4966,_0x1f4ec3){_0x8b4966=_0x8b4966-0x0;var _0x4e3470=_0x0881[_0x8b4966];return _0x4e3470;};'use strict';var client=require('../client');exports['create']=function(_0x318840){return client['Request'](_0x1088('0x0'),{'body':_0x318840,'log':_0x1088('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1737c1b..d20a24f 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 _0xace2=['online','faxPause','getFaxQueues','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x427651,_0x3a80b2){var _0x46a049=function(_0x142739){while(--_0x142739){_0x427651['push'](_0x427651['shift']());}};_0x46a049(++_0x3a80b2);}(_0xace2,0x1d9));var _0x2ace=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xace2[_0x9a3e0f];return _0x3d2a9a;};'use strict';var client=require(_0x2ace('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2ace('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x2ace('0x2'),_0x2ace('0x3'),_0x2ace('0x4')],'include':[{'model':_0x2ace('0x5'),'as':_0x2ace('0x6'),'attributes':['id',_0x2ace('0x2'),_0x2ace('0x7'),_0x2ace('0x8')]}]},'log':_0x2ace('0x9')});};}; \ No newline at end of file +var _0xefe1=['faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x5663d9,_0x4a0853){var _0x4ff61d=function(_0x4546e4){while(--_0x4546e4){_0x5663d9['push'](_0x5663d9['shift']());}};_0x4ff61d(++_0x4a0853);}(_0xefe1,0x14c));var _0x1efe=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xefe1[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0x1efe('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x1efe('0x1')](_0x1efe('0x2'),{'options':{'raw':![],'attributes':['id',_0x1efe('0x3'),_0x1efe('0x4'),'strategy'],'include':[{'model':_0x1efe('0x5'),'as':_0x1efe('0x6'),'attributes':['id',_0x1efe('0x3'),_0x1efe('0x7'),_0x1efe('0x8')]}]},'log':_0x1efe('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c8fb230..6a859b1 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 _0x5520=['CreateFaxQueueReport','DESC','UpdateFaxQueueReport','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5520,0x165));var _0x0552=function(_0x130dfa,_0x7c44cb){_0x130dfa=_0x130dfa-0x0;var _0x44b58f=_0x5520[_0x130dfa];return _0x44b58f;};'use strict';var client=require(_0x0552('0x0'));exports[_0x0552('0x1')]=function(_0x53a4be){return client[_0x0552('0x2')](_0x0552('0x3'),{'body':_0x53a4be,'log':_0x0552('0x3')});};exports['update']=function(_0x32433a,_0x12e4f5){return client[_0x0552('0x2')]('UpdateFaxQueueReport',{'body':_0x12e4f5,'options':{'where':{'uniqueid':_0x32433a},'order':[['id',_0x0552('0x4')]],'limit':0x1},'log':_0x0552('0x5')});}; \ No newline at end of file +var _0x3863=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x39a2b5,_0x243fc2){var _0x2f2b26=function(_0x53272e){while(--_0x53272e){_0x39a2b5['push'](_0x39a2b5['shift']());}};_0x2f2b26(++_0x243fc2);}(_0x3863,0xa9));var _0x3386=function(_0x24583f,_0x413d59){_0x24583f=_0x24583f-0x0;var _0xabd413=_0x3863[_0x24583f];return _0xabd413;};'use strict';var client=require(_0x3386('0x0'));exports[_0x3386('0x1')]=function(_0x563c8e){return client[_0x3386('0x2')]('CreateFaxQueueReport',{'body':_0x563c8e,'log':_0x3386('0x3')});};exports[_0x3386('0x4')]=function(_0x1f15d0,_0x1ca165){return client[_0x3386('0x2')](_0x3386('0x5'),{'body':_0x1ca165,'options':{'where':{'uniqueid':_0x1f15d0},'order':[['id',_0x3386('0x6')]],'limit':0x1},'log':_0x3386('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9e13c72..958c847 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 _0xb749=['getIntervals','../client','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xb749,0x1a1));var _0x9b74=function(_0x38404b,_0x3003f2){_0x38404b=_0x38404b-0x0;var _0x26e33a=_0xb749[_0x38404b];return _0x26e33a;};'use strict';var client=require(_0x9b74('0x0'));exports['getIntervals']=function(){return function(){return client[_0x9b74('0x1')](_0x9b74('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9b74('0x3')],'include':[{'model':_0x9b74('0x4'),'as':_0x9b74('0x5'),'attributes':['id',_0x9b74('0x3'),_0x9b74('0x6')]}]},'log':_0x9b74('0x7')});};}; \ No newline at end of file +var _0xcfb7=['Intervals','interval','getIntervals','Request','GetInterval','name'];(function(_0x4346ae,_0x588646){var _0x412649=function(_0x37d906){while(--_0x37d906){_0x4346ae['push'](_0x4346ae['shift']());}};_0x412649(++_0x588646);}(_0xcfb7,0x164));var _0x7cfb=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xcfb7[_0x31e29a];return _0x32d892;};'use strict';var client=require('../client');exports[_0x7cfb('0x0')]=function(){return function(){return client[_0x7cfb('0x1')](_0x7cfb('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7cfb('0x3')],'include':[{'model':'Interval','as':_0x7cfb('0x4'),'attributes':['id',_0x7cfb('0x3'),_0x7cfb('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index eb993bd..52781bb 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 _0xf2e3=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x46d02b,_0x32be3f){var _0x5c2ecc=function(_0x4c587){while(--_0x4c587){_0x46d02b['push'](_0x46d02b['shift']());}};_0x5c2ecc(++_0x32be3f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf2e3[_0x40a825];return _0x273a54;};'use strict';var client=require(_0x3f2e('0x0'));exports['update']=function(_0x143e9e,_0x231b2b){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'body':_0x231b2b,'options':{'where':{'id':_0x143e9e}},'log':_0x3f2e('0x3')});};exports[_0x3f2e('0x4')]=function(_0x3938e2,_0xabcf5c){return client[_0x3f2e('0x1')]('AddTagsToMailInteraction',{'body':_0xabcf5c,'options':{'where':{'id':_0x3938e2}},'log':_0x3f2e('0x5')});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x366028,_0x33ec1d){var _0x2577be=function(_0xb95f08){while(--_0xb95f08){_0x366028['push'](_0x366028['shift']());}};_0x2577be(++_0x33ec1d);}(_0x77e6,0x1a6));var _0x677e=function(_0x11bc21,_0x3abc84){_0x11bc21=_0x11bc21-0x0;var _0xa17e02=_0x77e6[_0x11bc21];return _0xa17e02;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2e2a967..72e009d 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 _0x7aad=['CreateMailMessage','../client','create','Request'];(function(_0x2442f4,_0xffec7c){var _0x505bb8=function(_0x51dc29){while(--_0x51dc29){_0x2442f4['push'](_0x2442f4['shift']());}};_0x505bb8(++_0xffec7c);}(_0x7aad,0x175));var _0xd7aa=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7aad[_0x397cfb];return _0x15fed9;};'use strict';var client=require(_0xd7aa('0x0'));exports[_0xd7aa('0x1')]=function(_0x493872){return client[_0xd7aa('0x2')](_0xd7aa('0x3'),{'body':_0x493872,'log':'createMailMessage'});}; \ No newline at end of file +var _0x301e=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0xdac383,_0x505d99){var _0x3e783d=function(_0x29c22a){while(--_0x29c22a){_0xdac383['push'](_0xdac383['shift']());}};_0x3e783d(++_0x505d99);}(_0x301e,0xc0));var _0xe301=function(_0x23aa0b,_0x5c4573){_0x23aa0b=_0x23aa0b-0x0;var _0x53c170=_0x301e[_0x23aa0b];return _0x53c170;};'use strict';var client=require(_0xe301('0x0'));exports[_0xe301('0x1')]=function(_0x30e94b){return client[_0xe301('0x2')](_0xe301('0x3'),{'body':_0x30e94b,'log':_0xe301('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6e77e15..fa39f21 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 _0xd018=['GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xd018,0xda));var _0x8d01=function(_0x495519,_0x1b702a){_0x495519=_0x495519-0x0;var _0x47005f=_0xd018[_0x495519];return _0x47005f;};'use strict';var client=require(_0x8d01('0x0'));exports[_0x8d01('0x1')]=function(){return function(){return client['Request'](_0x8d01('0x2'),{'options':{'raw':![],'attributes':['id',_0x8d01('0x3'),_0x8d01('0x4'),_0x8d01('0x5')],'include':[{'model':_0x8d01('0x6'),'as':_0x8d01('0x7'),'attributes':['id',_0x8d01('0x3'),_0x8d01('0x8'),_0x8d01('0x9')]}]},'log':_0x8d01('0x1')});};}; \ No newline at end of file +var _0x20c3=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','User','Agents'];(function(_0x447d6a,_0x549700){var _0x3d6303=function(_0x3b3820){while(--_0x3b3820){_0x447d6a['push'](_0x447d6a['shift']());}};_0x3d6303(++_0x549700);}(_0x20c3,0x1b0));var _0x320c=function(_0x3bddcc,_0x15574f){_0x3bddcc=_0x3bddcc-0x0;var _0x10afc1=_0x20c3[_0x3bddcc];return _0x10afc1;};'use strict';var client=require(_0x320c('0x0'));exports[_0x320c('0x1')]=function(){return function(){return client[_0x320c('0x2')](_0x320c('0x3'),{'options':{'raw':![],'attributes':['id',_0x320c('0x4'),_0x320c('0x5'),'strategy'],'include':[{'model':_0x320c('0x6'),'as':_0x320c('0x7'),'attributes':['id',_0x320c('0x4'),_0x320c('0x8'),_0x320c('0x9')]}]},'log':_0x320c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7defe71..3f2b6ff 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 _0xcac6=['create','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x1a50a6,_0x400207){var _0x9cd101=function(_0x4abe53){while(--_0x4abe53){_0x1a50a6['push'](_0x1a50a6['shift']());}};_0x9cd101(++_0x400207);}(_0xcac6,0x159));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x6cac('0x0')]=function(_0x3884d8){return client['Request'](_0x6cac('0x1'),{'body':_0x3884d8,'log':'CreateMailQueueReport'});};exports[_0x6cac('0x2')]=function(_0x4f31a1,_0x3ebbb9){return client['Request']('UpdateMailQueueReport',{'body':_0x3ebbb9,'options':{'where':{'uniqueid':_0x4f31a1},'order':[['id',_0x6cac('0x3')]],'limit':0x1},'log':_0x6cac('0x4')});}; \ No newline at end of file +var _0xb504=['CreateMailQueueReport','update','DESC','../client','create','Request'];(function(_0x217ebc,_0x5364dc){var _0x373824=function(_0x44c98f){while(--_0x44c98f){_0x217ebc['push'](_0x217ebc['shift']());}};_0x373824(++_0x5364dc);}(_0xb504,0x153));var _0x4b50=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb504[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x4b50('0x0'));exports[_0x4b50('0x1')]=function(_0xec34d5){return client[_0x4b50('0x2')](_0x4b50('0x3'),{'body':_0xec34d5,'log':_0x4b50('0x3')});};exports[_0x4b50('0x4')]=function(_0xc42eaa,_0x3c01ec){return client[_0x4b50('0x2')]('UpdateMailQueueReport',{'body':_0x3c01ec,'options':{'where':{'uniqueid':_0xc42eaa},'order':[['id',_0x4b50('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 d226488..4a0a2e0 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 _0x4e23=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x580ced,_0x323a1b){var _0x168024=function(_0x31d72b){while(--_0x31d72b){_0x580ced['push'](_0x580ced['shift']());}};_0x168024(++_0x323a1b);}(_0x4e23,0x7a));var _0x34e2=function(_0x274dc0,_0x25e513){_0x274dc0=_0x274dc0-0x0;var _0x52d234=_0x4e23[_0x274dc0];return _0x52d234;};'use strict';var client=require(_0x34e2('0x0'));exports[_0x34e2('0x1')]=function(_0x336278,_0x3466d0){return client[_0x34e2('0x2')](_0x34e2('0x3'),{'body':_0x3466d0,'options':{'where':{'id':_0x336278}},'log':_0x34e2('0x4')});};exports[_0x34e2('0x5')]=function(_0x566b0c,_0x1eca05){return client[_0x34e2('0x2')](_0x34e2('0x6'),{'body':_0x1eca05,'options':{'where':{'id':_0x566b0c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa23d=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client','update'];(function(_0x4367b5,_0x584591){var _0x410e96=function(_0x30075b){while(--_0x30075b){_0x4367b5['push'](_0x4367b5['shift']());}};_0x410e96(++_0x584591);}(_0xa23d,0xdc));var _0xda23=function(_0x2646a2,_0x39d58b){_0x2646a2=_0x2646a2-0x0;var _0x5b895a=_0xa23d[_0x2646a2];return _0x5b895a;};'use strict';var client=require(_0xda23('0x0'));exports[_0xda23('0x1')]=function(_0x8305ad,_0x1c0c03){return client[_0xda23('0x2')](_0xda23('0x3'),{'body':_0x1c0c03,'options':{'where':{'id':_0x8305ad}},'log':_0xda23('0x4')});};exports['addTags']=function(_0x26d0fb,_0x6b04d7){return client['Request'](_0xda23('0x5'),{'body':_0x6b04d7,'options':{'where':{'id':_0x26d0fb}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1cb6fb8..7307765 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 _0x089d=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x089d,0x69));var _0xd089=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x089d[_0x1b2ff7];return _0x31656a;};'use strict';var client=require(_0xd089('0x0'));exports[_0xd089('0x1')]=function(_0xc64fd0){return client[_0xd089('0x2')](_0xd089('0x3'),{'body':_0xc64fd0,'log':_0xd089('0x4')});}; \ No newline at end of file +var _0xc4f7=['CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2f65d0,_0x5d846e){var _0x1df3a1=function(_0x1d4e59){while(--_0x1d4e59){_0x2f65d0['push'](_0x2f65d0['shift']());}};_0x1df3a1(++_0x5d846e);}(_0xc4f7,0x84));var _0x7c4f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc4f7[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports['create']=function(_0x4c6dcc){return client['Request'](_0x7c4f('0x0'),{'body':_0x4c6dcc,'log':_0x7c4f('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8ecfe41..5250a7e 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 _0x2e30=['Agents','name','openchannelPause','timeout','strategy','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e30,0x1e3));var _0x02e3=function(_0x41a2e3,_0x572a7f){_0x41a2e3=_0x41a2e3-0x0;var _0x2db638=_0x2e30[_0x41a2e3];return _0x2db638;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x02e3('0x0'),_0x02e3('0x1')],'include':[{'model':_0x02e3('0x2'),'as':_0x02e3('0x3'),'attributes':['id',_0x02e3('0x4'),'online',_0x02e3('0x5')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xc582=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','Agents','online','openchannelPause'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0xc582,0x132));var _0x2c58=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc582[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x2c58('0x0'));exports[_0x2c58('0x1')]=function(){return function(){return client[_0x2c58('0x2')](_0x2c58('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c58('0x4'),_0x2c58('0x5'),'strategy'],'include':[{'model':'User','as':_0x2c58('0x6'),'attributes':['id',_0x2c58('0x4'),_0x2c58('0x7'),_0x2c58('0x8')]}]},'log':_0x2c58('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ff0e5e1..29eaf71 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 _0xb04a=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x30d63f,_0xde07c3){var _0x3ad9cb=function(_0x18f12b){while(--_0x18f12b){_0x30d63f['push'](_0x30d63f['shift']());}};_0x3ad9cb(++_0xde07c3);}(_0xb04a,0x1ed));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xab04('0x0'));exports[_0xab04('0x1')]=function(_0x53cfee){return client[_0xab04('0x2')](_0xab04('0x3'),{'body':_0x53cfee,'log':_0xab04('0x3')});};exports[_0xab04('0x4')]=function(_0x203721,_0x202ec8){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x202ec8,'options':{'where':{'uniqueid':_0x203721},'order':[['id',_0xab04('0x5')]],'limit':0x1},'log':_0xab04('0x6')});}; \ No newline at end of file +var _0x6075=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6075,0x142));var _0x5607=function(_0x161d69,_0x48198d){_0x161d69=_0x161d69-0x0;var _0x57aa9a=_0x6075[_0x161d69];return _0x57aa9a;};'use strict';var client=require(_0x5607('0x0'));exports[_0x5607('0x1')]=function(_0x491939){return client[_0x5607('0x2')](_0x5607('0x3'),{'body':_0x491939,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x1a5179,_0x541f8e){return client['Request'](_0x5607('0x4'),{'body':_0x541f8e,'options':{'where':{'uniqueid':_0x1a5179},'order':[['id','DESC']],'limit':0x1},'log':_0x5607('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 5d7093e..8880e35 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 _0xe4b8=['update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','../client'];(function(_0x508840,_0xb1559e){var _0x1ca6ee=function(_0x30c068){while(--_0x30c068){_0x508840['push'](_0x508840['shift']());}};_0x1ca6ee(++_0xb1559e);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe4b8[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x8e4b('0x0'));exports[_0x8e4b('0x1')]=function(_0x273b40,_0x7cd0d3){return client[_0x8e4b('0x2')](_0x8e4b('0x3'),{'body':_0x7cd0d3,'options':{'where':{'id':_0x273b40}},'log':_0x8e4b('0x4')});};exports['addTags']=function(_0x4fa340,_0x35e679){return client[_0x8e4b('0x2')](_0x8e4b('0x5'),{'body':_0x35e679,'options':{'where':{'id':_0x4fa340}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xfd0f=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x1d2798,_0x5909f2){var _0x2127ea=function(_0xeafb62){while(--_0xeafb62){_0x1d2798['push'](_0x1d2798['shift']());}};_0x2127ea(++_0x5909f2);}(_0xfd0f,0x1b8));var _0xffd0=function(_0xc9b3cd,_0x51ce9b){_0xc9b3cd=_0xc9b3cd-0x0;var _0x294be4=_0xfd0f[_0xc9b3cd];return _0x294be4;};'use strict';var client=require(_0xffd0('0x0'));exports[_0xffd0('0x1')]=function(_0x498df9,_0x568847){return client[_0xffd0('0x2')](_0xffd0('0x3'),{'body':_0x568847,'options':{'where':{'id':_0x498df9}},'log':'updateSmsInteraction'});};exports[_0xffd0('0x4')]=function(_0x5e9c0a,_0x303f38){return client[_0xffd0('0x2')](_0xffd0('0x5'),{'body':_0x303f38,'options':{'where':{'id':_0x5e9c0a}},'log':_0xffd0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7a12c4e..961e364 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 _0xd1f2=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd1f2,0x14a));var _0x2d1f=function(_0x207d68,_0x4e7084){_0x207d68=_0x207d68-0x0;var _0x2ad5f2=_0xd1f2[_0x207d68];return _0x2ad5f2;};'use strict';var client=require(_0x2d1f('0x0'));exports[_0x2d1f('0x1')]=function(_0x1f1982){return client[_0x2d1f('0x2')](_0x2d1f('0x3'),{'body':_0x1f1982,'log':_0x2d1f('0x4')});}; \ No newline at end of file +var _0xdd66=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x38700d,_0x2f0b15){var _0x35af38=function(_0x4c492e){while(--_0x4c492e){_0x38700d['push'](_0x38700d['shift']());}};_0x35af38(++_0x2f0b15);}(_0xdd66,0x13d));var _0x6dd6=function(_0x156036,_0x32aa4f){_0x156036=_0x156036-0x0;var _0x1ed0a4=_0xdd66[_0x156036];return _0x1ed0a4;};'use strict';var client=require(_0x6dd6('0x0'));exports[_0x6dd6('0x1')]=function(_0x21c5b7){return client[_0x6dd6('0x2')](_0x6dd6('0x3'),{'body':_0x21c5b7,'log':_0x6dd6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 02e0f12..1b1ed17 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x21464,_0x24ed0d){var _0x43d352=function(_0x5a3cf6){while(--_0x5a3cf6){_0x21464['push'](_0x21464['shift']());}};_0x43d352(++_0x24ed0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x2c0ffb,_0x185c6b){var _0x1a5806=function(_0x547398){while(--_0x547398){_0x2c0ffb['push'](_0x2c0ffb['shift']());}};_0x1a5806(++_0x185c6b);}(_0xe706,0xa3));var _0x6e70=function(_0x501401,_0x2d8737){_0x501401=_0x501401-0x0;var _0xfd0a47=_0xe706[_0x501401];return _0xfd0a47;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 5816a5d..07b812c 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2729cd,_0x462966){var _0x1c259=function(_0x51f3a4){while(--_0x51f3a4){_0x2729cd['push'](_0x2729cd['shift']());}};_0x1c259(++_0x462966);}(_0x008c,0x188));var _0xc008=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x008c[_0xeaba4b];return _0x32f4fd;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2cf384,_0x50ce36){var _0x5d7346=function(_0x148176){while(--_0x148176){_0x2cf384['push'](_0x2cf384['shift']());}};_0x5d7346(++_0x50ce36);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4e96828..4b4e940 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(_0x354c20,_0x48b67e){var _0x17c419=function(_0x519a84){while(--_0x519a84){_0x354c20['push'](_0x354c20['shift']());}};_0x17c419(++_0x48b67e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x1eaab9,_0x23ba6a){var _0x56955d=function(_0xb9d4e1){while(--_0xb9d4e1){_0x1eaab9['push'](_0x1eaab9['shift']());}};_0x56955d(++_0x23ba6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 d1c01fd..82ff84a 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 _0x9c63=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9c63,0x1a7));var _0x39c6=function(_0x466481,_0x3f195f){_0x466481=_0x466481-0x0;var _0x1e2a5d=_0x9c63[_0x466481];return _0x1e2a5d;};'use strict';var client=require(_0x39c6('0x0'));exports[_0x39c6('0x1')]=function(_0x13162f,_0x30f25a){return client[_0x39c6('0x2')]('UpdateWhatsappInteraction',{'body':_0x30f25a,'options':{'where':{'id':_0x13162f}},'log':_0x39c6('0x3')});};exports[_0x39c6('0x4')]=function(_0x521670,_0x59c413){return client[_0x39c6('0x2')](_0x39c6('0x5'),{'body':_0x59c413,'options':{'where':{'id':_0x521670}},'log':_0x39c6('0x6')});}; \ No newline at end of file +var _0xe626=['updateWhatsappInteraction','addTags','../client','update','UpdateWhatsappInteraction'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xe626,0x9d));var _0x6e62=function(_0x569da2,_0x26aa52){_0x569da2=_0x569da2-0x0;var _0x211bcf=_0xe626[_0x569da2];return _0x211bcf;};'use strict';var client=require(_0x6e62('0x0'));exports[_0x6e62('0x1')]=function(_0x14eb81,_0x1e49b0){return client['Request'](_0x6e62('0x2'),{'body':_0x1e49b0,'options':{'where':{'id':_0x14eb81}},'log':_0x6e62('0x3')});};exports[_0x6e62('0x4')]=function(_0xb5cd38,_0x2ebc77){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x2ebc77,'options':{'where':{'id':_0xb5cd38}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e1907d2..9869ddd 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 _0xfcbc=['CreateWhatsappMessage','../client','create'];(function(_0x154c81,_0x523d49){var _0x955c6e=function(_0x6480ac){while(--_0x6480ac){_0x154c81['push'](_0x154c81['shift']());}};_0x955c6e(++_0x523d49);}(_0xfcbc,0xaf));var _0xcfcb=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xfcbc[_0x26b80e];return _0x84a8a8;};'use strict';var client=require(_0xcfcb('0x0'));exports[_0xcfcb('0x1')]=function(_0x4e38f1){return client['Request'](_0xcfcb('0x2'),{'body':_0x4e38f1,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2156=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2156,0xe3));var _0x6215=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2156[_0x53ccf2];return _0x5a2964;};'use strict';var client=require(_0x6215('0x0'));exports[_0x6215('0x1')]=function(_0x49a7d2){return client[_0x6215('0x2')](_0x6215('0x3'),{'body':_0x49a7d2,'log':_0x6215('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 37bf78d..7fcd276 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 _0xaf82=['whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User','Agents','online'];(function(_0x27cfbb,_0x4f8398){var _0x2e5e75=function(_0x57003e){while(--_0x57003e){_0x27cfbb['push'](_0x27cfbb['shift']());}};_0x2e5e75(++_0x4f8398);}(_0xaf82,0x19f));var _0x2af8=function(_0x377bb1,_0x4ccfa8){_0x377bb1=_0x377bb1-0x0;var _0x43b0ff=_0xaf82[_0x377bb1];return _0x43b0ff;};'use strict';var client=require(_0x2af8('0x0'));exports[_0x2af8('0x1')]=function(){return function(){return client['Request'](_0x2af8('0x2'),{'options':{'raw':![],'attributes':['id',_0x2af8('0x3'),_0x2af8('0x4'),'strategy'],'include':[{'model':_0x2af8('0x5'),'as':_0x2af8('0x6'),'attributes':['id',_0x2af8('0x3'),_0x2af8('0x7'),_0x2af8('0x8')]}]},'log':_0x2af8('0x1')});};}; \ No newline at end of file +var _0x4b52=['Agents','online','whatsappPause','getWhatsappQueues','Request','timeout','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b52,0x1b6));var _0x24b5=function(_0x4f9bb3,_0x2deddd){_0x4f9bb3=_0x4f9bb3-0x0;var _0x1e4d18=_0x4b52[_0x4f9bb3];return _0x1e4d18;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x24b5('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x24b5('0x1'),'strategy'],'include':[{'model':_0x24b5('0x2'),'as':_0x24b5('0x3'),'attributes':['id','name',_0x24b5('0x4'),_0x24b5('0x5')]}]},'log':_0x24b5('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 17dc414..113fde7 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 _0xd2e3=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x3e0bb6,_0x42b76c){var _0x324a96=function(_0x2a351f){while(--_0x2a351f){_0x3e0bb6['push'](_0x3e0bb6['shift']());}};_0x324a96(++_0x42b76c);}(_0xd2e3,0x166));var _0x3d2e=function(_0x286705,_0x2b25e0){_0x286705=_0x286705-0x0;var _0x1b531c=_0xd2e3[_0x286705];return _0x1b531c;};'use strict';var client=require(_0x3d2e('0x0'));exports[_0x3d2e('0x1')]=function(_0x4b503e){return client[_0x3d2e('0x2')](_0x3d2e('0x3'),{'body':_0x4b503e,'log':_0x3d2e('0x3')});};exports['update']=function(_0x473d5f,_0x1233a0){return client[_0x3d2e('0x2')](_0x3d2e('0x4'),{'body':_0x1233a0,'options':{'where':{'uniqueid':_0x473d5f},'order':[['id',_0x3d2e('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xd011=['UpdateWhatsappQueueReport','DESC','../client','create','Request','update'];(function(_0x3f1bf9,_0x3c909d){var _0x21bedb=function(_0x40b68f){while(--_0x40b68f){_0x3f1bf9['push'](_0x3f1bf9['shift']());}};_0x21bedb(++_0x3c909d);}(_0xd011,0x116));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1d01('0x0'));exports[_0x1d01('0x1')]=function(_0x129a11){return client[_0x1d01('0x2')]('CreateWhatsappQueueReport',{'body':_0x129a11,'log':'CreateWhatsappQueueReport'});};exports[_0x1d01('0x3')]=function(_0x153c85,_0x2bfb54){return client['Request'](_0x1d01('0x4'),{'body':_0x2bfb54,'options':{'where':{'uniqueid':_0x153c85},'order':[['id',_0x1d01('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 a429249..4ffce67 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 _0x48f8=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules'];(function(_0xe2ae1,_0x2a534a){var _0x4d12f5=function(_0x122455){while(--_0x122455){_0xe2ae1['push'](_0xe2ae1['shift']());}};_0x4d12f5(++_0x2a534a);}(_0x48f8,0xa0));var _0x848f=function(_0x599e38,_0x158e19){_0x599e38=_0x599e38-0x0;var _0x5c6717=_0x48f8[_0x599e38];return _0x5c6717;};'use strict';var schema=require('validate');var _=require(_0x848f('0x0'));var util=require(_0x848f('0x1'));var seqqueue=require(_0x848f('0x2'));var logger=require('../../../../config/logger')(_0x848f('0x3'));var strategy=require(_0x848f('0x4'));var queue=schema({'name':{'type':_0x848f('0x5'),'required':!![],'message':_0x848f('0x6')},'timeout':{'type':_0x848f('0x7'),'message':_0x848f('0x8')}});function writeLog(_0x153bd6,_0x43418d,_0x17a666){return logger[_0x848f('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x153bd6,_0x43418d['name'],_0x17a666));}function handleFindAgent(_0x1e275a){return function(_0x595b1a){return _0x595b1a[_0x848f('0xa')][_0x848f('0xb')]()===_0x1e275a[_0x848f('0xb')]();};}exports[_0x848f('0xc')]=function(_0x126ed5,_0x8240e7,_0x32632a,_0x5980fb){return function(_0x13dcfb){try{var _0x1cf461={'name':_0x8240e7[0x0],'timeout':_0x8240e7[0x1]};var _0x5bd7cb=queue[_0x848f('0xd')](_0x1cf461,{'typecast':!![]});if(_0x5bd7cb[_0x848f('0xe')]){logger[_0x848f('0xf')](_0x848f('0x10'),_0x126ed5,_[_0x848f('0x11')](_0x5bd7cb,_0x848f('0x12'))[_0x848f('0x13')](',\x20'));_0x13dcfb[_0x848f('0x14')]();}else{var _0x4f313a=_[_0x848f('0x15')](_0x32632a[_0x848f('0x16')],handleFindAgent(_0x1cf461['name']));if(_0x4f313a){var _0x263228=(_0x1cf461[_0x848f('0x17')]||0xa)*0x3e8;var _0x595fb7,_0x44e4c3;var _0xd97c7b=seqqueue[_0x848f('0x18')](_0x263228);_0xd97c7b['id']=_0x126ed5;_0xd97c7b[_0x848f('0x19')]=_0x263228;_0xd97c7b[_0x848f('0x1a')]=_0x5980fb[_0x848f('0x1a')];writeLog(_0x126ed5,_0x4f313a,util[_0x848f('0x1b')](_0x848f('0x1c'),_0x263228));_0x32632a[_0x848f('0x1d')][_0x126ed5]['on'](_0x848f('0x1e'),function(){logger[_0x848f('0x9')](_0x848f('0x1f'),_0x126ed5);clearTimeout(_0x44e4c3);_0x44e4c3=undefined;_0xd97c7b['close']();if(_0x32632a['rules'][_0x126ed5]){delete _0x32632a[_0x848f('0x1d')][_0x126ed5];}_0x13dcfb[_0x848f('0x14')]();});_0x32632a['rules'][_0x126ed5]['on'](_0x848f('0x20'),function(){if(_0x32632a[_0x848f('0x1d')][_0x126ed5]){delete _0x32632a['rules'][_0x126ed5];}});_0x44e4c3=setTimeout(function(){logger['info'](_0x848f('0x21'),_0x126ed5);clearTimeout(_0x44e4c3);_0xd97c7b['close']();_0x13dcfb['next']();},_0x263228);strategy[_0x848f('0x22')](_0xd97c7b,_0x4f313a,_0x32632a,_0x5980fb);}else{logger[_0x848f('0xf')](_0x848f('0x23'),_0x126ed5,_0x1cf461[_0x848f('0xa')]);_0x13dcfb['stop']();}}}catch(_0x275fdf){console[_0x848f('0x24')](_0x275fdf);logger[_0x848f('0xf')]('[%s][QUEUE]\x20%s',_0x126ed5,_0x275fdf[_0x848f('0x25')]);_0x13dcfb[_0x848f('0x14')]();}};}; \ No newline at end of file +var _0x4ed3=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','name','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x200429,_0x49da68){var _0x14796f=function(_0x9e2dbd){while(--_0x9e2dbd){_0x200429['push'](_0x200429['shift']());}};_0x14796f(++_0x49da68);}(_0x4ed3,0x18d));var _0x34ed=function(_0x30d68b,_0x12526a){_0x30d68b=_0x30d68b-0x0;var _0x526b44=_0x4ed3[_0x30d68b];return _0x526b44;};'use strict';var schema=require(_0x34ed('0x0'));var _=require(_0x34ed('0x1'));var util=require(_0x34ed('0x2'));var seqqueue=require(_0x34ed('0x3'));var logger=require(_0x34ed('0x4'))(_0x34ed('0x5'));var strategy=require(_0x34ed('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x34ed('0x7'),'message':_0x34ed('0x8')}});function writeLog(_0x19962a,_0xf4f052,_0x3b9d43){return logger[_0x34ed('0x9')](util[_0x34ed('0xa')](_0x34ed('0xb'),_0x19962a,_0xf4f052['name'],_0x3b9d43));}function handleFindAgent(_0xfa4a4f){return function(_0x457da1){return _0x457da1['name'][_0x34ed('0xc')]()===_0xfa4a4f[_0x34ed('0xc')]();};}exports[_0x34ed('0xd')]=function(_0x532921,_0x142f6d,_0x50e9a4,_0x1608e6){return function(_0x5cbf05){try{var _0xdba1cb={'name':_0x142f6d[0x0],'timeout':_0x142f6d[0x1]};var _0x2c4d2b=queue['validate'](_0xdba1cb,{'typecast':!![]});if(_0x2c4d2b[_0x34ed('0xe')]){logger['error'](_0x34ed('0xf'),_0x532921,_['map'](_0x2c4d2b,_0x34ed('0x10'))[_0x34ed('0x11')](',\x20'));_0x5cbf05[_0x34ed('0x12')]();}else{var _0x2ef15d=_[_0x34ed('0x13')](_0x50e9a4[_0x34ed('0x14')],handleFindAgent(_0xdba1cb[_0x34ed('0x15')]));if(_0x2ef15d){var _0x349e9d=(_0xdba1cb[_0x34ed('0x16')]||0xa)*0x3e8;var _0x57d2eb,_0xc87b76;var _0x582cd4=seqqueue['createQueue'](_0x349e9d);_0x582cd4['id']=_0x532921;_0x582cd4[_0x34ed('0x17')]=_0x349e9d;_0x582cd4[_0x34ed('0x18')]=_0x1608e6[_0x34ed('0x18')];writeLog(_0x532921,_0x2ef15d,util['format']('START:%s',_0x349e9d));_0x50e9a4[_0x34ed('0x19')][_0x532921]['on'](_0x34ed('0x1a'),function(){logger[_0x34ed('0x9')](_0x34ed('0x1b'),_0x532921);clearTimeout(_0xc87b76);_0xc87b76=undefined;_0x582cd4[_0x34ed('0x1c')]();if(_0x50e9a4[_0x34ed('0x19')][_0x532921]){delete _0x50e9a4[_0x34ed('0x19')][_0x532921];}_0x5cbf05['stop']();});_0x50e9a4[_0x34ed('0x19')][_0x532921]['on'](_0x34ed('0x1d'),function(){if(_0x50e9a4[_0x34ed('0x19')][_0x532921]){delete _0x50e9a4[_0x34ed('0x19')][_0x532921];}});_0xc87b76=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x532921);clearTimeout(_0xc87b76);_0x582cd4[_0x34ed('0x1c')]();_0x5cbf05[_0x34ed('0x1e')]();},_0x349e9d);strategy[_0x34ed('0x1f')](_0x582cd4,_0x2ef15d,_0x50e9a4,_0x1608e6);}else{logger[_0x34ed('0x20')](_0x34ed('0x21'),_0x532921,_0xdba1cb[_0x34ed('0x15')]);_0x5cbf05[_0x34ed('0x12')]();}}}catch(_0x1ba689){console[_0x34ed('0x22')](_0x1ba689);logger['error']('[%s][QUEUE]\x20%s',_0x532921,_0x1ba689[_0x34ed('0x23')]);_0x5cbf05[_0x34ed('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 afe9417..a7b877a 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 _0x535c=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','getMustacheRender','Message','create','then','body','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','error','message','providerName','amazonlex','providerResponse','dialogState','catch','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x535c,0x147));var _0xc535=function(_0x58ab22,_0x42c988){_0x58ab22=_0x58ab22-0x0;var _0x3bedba=_0x535c[_0x58ab22];return _0x3bedba;};'use strict';var _=require(_0xc535('0x0'));var moment=require('moment');var AWS=require(_0xc535('0x1'));var utils=require(_0xc535('0x2'));var logger=require(_0xc535('0x3'))(_0xc535('0x4'));var rpc={'chatMessage':require(_0xc535('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc535('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc535('0x7')),'whatsappMessage':require(_0xc535('0x8'))};exports[_0xc535('0x9')]=function(_0x2d862c,_0x34691e){return function(_0x904dc1){try{if(!_[_0xc535('0xa')](this[_0xc535('0xb')][_0xc535('0xc')])){logger[_0xc535('0xd')](_0xc535('0xe'),_0x2d862c,_0xc535('0xf'));return _0x904dc1[_0xc535('0x10')]();}var _0x1d7f59={'ContactId':this[_0xc535('0x11')]['id'],'sentAt':moment()[_0xc535('0x12')](_0xc535('0x13')),'direction':_0xc535('0x14')};if(this['channel']===_0xc535('0x15')||this[_0xc535('0x16')]===_0xc535('0x17')){_0x1d7f59['phone']=this['interaction']['phone'];}var _0x561f8e=this[_0xc535('0x16')];if(_0x561f8e===_0xc535('0x18')){_0x1d7f59[_0xc535('0x19')]=this[_0xc535('0x1a')]['id'];}else{_0x1d7f59[_['upperFirst'](_0x561f8e)+_0xc535('0x1b')]=this['account']['id'];}_0x1d7f59[_[_0xc535('0x1c')](_0x561f8e)+_0xc535('0x1d')]=this[_0xc535('0xb')]['id'];if(this[_0xc535('0xb')]['created']){var _0x5a05ad=_0x34691e[0x4];if(!_['isEmpty'](_0x5a05ad)){_0x1d7f59['body']=utils[_0xc535('0x1e')](_0x5a05ad,this);return rpc[_0x561f8e+_0xc535('0x1f')][_0xc535('0x20')](_0x1d7f59)[_0xc535('0x21')](function(_0x51f62a){logger[_0xc535('0xd')](_0xc535('0xe'),_0x2d862c,_0x1d7f59[_0xc535('0x22')]);})['catch'](function(_0x37f4be){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2d862c,JSON[_0xc535('0x23')](_0x37f4be));})[_0xc535('0x24')](function(){logger['info'](_0xc535('0x25'),_0x2d862c);_0x904dc1[_0xc535('0x26')]();});}else{logger[_0xc535('0xd')](_0xc535('0x27'),_0x2d862c);_0x904dc1[_0xc535('0x26')]();}}else{var _0x531a1e=this;var _0x120da9=new AWS['LexRuntime']({'accessKeyId':_0x34691e[0x0],'secretAccessKey':_0x34691e[0x1],'region':_0x34691e[0x2]});var _0x4ef4d9={'botAlias':_0xc535('0x28'),'botName':_0x34691e[0x3],'inputText':this['message']['body'],'userId':this[_0xc535('0x16')]+':'+this[_0xc535('0xb')]['id'][_0xc535('0x29')]()};_0x120da9['postText'](_0x4ef4d9,function(_0x21ff2c,_0x35c627){if(_0x21ff2c){logger[_0xc535('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x2d862c,_0x21ff2c['message']);_0x904dc1[_0xc535('0x10')]();}else if(_0x35c627&&_0x35c627[_0xc535('0x2b')]){_0x531a1e['body']['amazonlex']=_0x35c627;_0x1d7f59[_0xc535('0x22')]=_0x35c627[_0xc535('0x2b')];_0x1d7f59[_0xc535('0x2c')]=_0xc535('0x2d');_0x1d7f59[_0xc535('0x2e')]=JSON[_0xc535('0x23')](_0x35c627);return rpc[_0x561f8e+_0xc535('0x1f')][_0xc535('0x20')](_0x1d7f59)['then'](function(_0x2f8155){logger[_0xc535('0xd')](_0xc535('0xe'),_0x2d862c,_0x1d7f59[_0xc535('0x22')]);if(_0x35c627[_0xc535('0x2f')]=='Failed'){_0x904dc1[_0xc535('0x10')]();}else{_0x904dc1[_0xc535('0x26')]();}})[_0xc535('0x30')](function(_0x17f2ac){logger['error'](_0xc535('0xe'),_0x2d862c,JSON[_0xc535('0x23')](_0x17f2ac));_0x904dc1[_0xc535('0x10')]();});}else{_0x904dc1[_0xc535('0x10')]();}});}}catch(_0x3aac78){logger[_0xc535('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x2d862c,JSON['stringify'](_0x3aac78));_0x904dc1[_0xc535('0x26')]();}};}; \ No newline at end of file +var _0x6822=['whatsapp','phone','upperFirst','account','InteractionId','created','body','getMustacheRender','Message','create','then','info','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','dialogState','Failed','next','catch','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','sms','channel'];(function(_0x395282,_0x3ceb32){var _0x347140=function(_0x1a17a6){while(--_0x1a17a6){_0x395282['push'](_0x395282['shift']());}};_0x347140(++_0x3ceb32);}(_0x6822,0x1cd));var _0x2682=function(_0xbbe4e2,_0x47e391){_0xbbe4e2=_0xbbe4e2-0x0;var _0xed5a48=_0x6822[_0xbbe4e2];return _0xed5a48;};'use strict';var _=require('lodash');var moment=require(_0x2682('0x0'));var AWS=require(_0x2682('0x1'));var utils=require(_0x2682('0x2'));var logger=require(_0x2682('0x3'))('routing');var rpc={'chatMessage':require(_0x2682('0x4')),'openchannelMessage':require(_0x2682('0x5')),'mailMessage':require(_0x2682('0x6')),'smsMessage':require(_0x2682('0x7')),'faxMessage':require(_0x2682('0x8')),'whatsappMessage':require(_0x2682('0x9'))};exports['consequence']=function(_0x9a815f,_0x1f6229){return function(_0x3b07c2){try{if(!_[_0x2682('0xa')](this[_0x2682('0xb')][_0x2682('0xc')])){logger['info'](_0x2682('0xd'),_0x9a815f,_0x2682('0xe'));return _0x3b07c2['next']();}var _0x257260={'ContactId':this[_0x2682('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2682('0x10')};if(this['channel']===_0x2682('0x11')||this[_0x2682('0x12')]===_0x2682('0x13')){_0x257260[_0x2682('0x14')]=this[_0x2682('0xb')][_0x2682('0x14')];}var _0x115921=this[_0x2682('0x12')];if(_0x115921==='chat'){_0x257260['ChatWebsiteId']=this['account']['id'];}else{_0x257260[_[_0x2682('0x15')](_0x115921)+'AccountId']=this[_0x2682('0x16')]['id'];}_0x257260[_['upperFirst'](_0x115921)+_0x2682('0x17')]=this[_0x2682('0xb')]['id'];if(this[_0x2682('0xb')][_0x2682('0x18')]){var _0xd82f41=_0x1f6229[0x4];if(!_['isEmpty'](_0xd82f41)){_0x257260[_0x2682('0x19')]=utils[_0x2682('0x1a')](_0xd82f41,this);return rpc[_0x115921+_0x2682('0x1b')][_0x2682('0x1c')](_0x257260)[_0x2682('0x1d')](function(_0x428343){logger[_0x2682('0x1e')](_0x2682('0xd'),_0x9a815f,_0x257260[_0x2682('0x19')]);})['catch'](function(_0x55a0da){logger[_0x2682('0x1f')](_0x2682('0xd'),_0x9a815f,JSON[_0x2682('0x20')](_0x55a0da));})[_0x2682('0x21')](function(){logger[_0x2682('0x1e')](_0x2682('0x22'),_0x9a815f);_0x3b07c2[_0x2682('0x23')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x9a815f);_0x3b07c2[_0x2682('0x23')]();}}else{var _0xc27cc0=this;var _0x5cb894=new AWS[(_0x2682('0x24'))]({'accessKeyId':_0x1f6229[0x0],'secretAccessKey':_0x1f6229[0x1],'region':_0x1f6229[0x2]});var _0x16c399={'botAlias':_0x2682('0x25'),'botName':_0x1f6229[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0x2682('0xb')]['id'][_0x2682('0x26')]()};_0x5cb894[_0x2682('0x27')](_0x16c399,function(_0x75daab,_0x39610e){if(_0x75daab){logger['error']('[%s][AMAZONLEX]\x20%s',_0x9a815f,_0x75daab[_0x2682('0x28')]);_0x3b07c2['next']();}else if(_0x39610e&&_0x39610e[_0x2682('0x28')]){_0xc27cc0[_0x2682('0x19')][_0x2682('0x29')]=_0x39610e;_0x257260['body']=_0x39610e['message'];_0x257260[_0x2682('0x2a')]='amazonlex';_0x257260[_0x2682('0x2b')]=JSON[_0x2682('0x20')](_0x39610e);return rpc[_0x115921+_0x2682('0x1b')]['create'](_0x257260)['then'](function(_0x26fc08){logger['info']('[%s][AMAZONLEX]\x20%s',_0x9a815f,_0x257260[_0x2682('0x19')]);if(_0x39610e[_0x2682('0x2c')]==_0x2682('0x2d')){_0x3b07c2[_0x2682('0x2e')]();}else{_0x3b07c2[_0x2682('0x23')]();}})[_0x2682('0x2f')](function(_0x581039){logger[_0x2682('0x1f')](_0x2682('0xd'),_0x9a815f,JSON[_0x2682('0x20')](_0x581039));_0x3b07c2[_0x2682('0x2e')]();});}else{_0x3b07c2[_0x2682('0x2e')]();}});}}catch(_0x5f500a){logger[_0x2682('0x1f')](_0x2682('0xd'),_0x9a815f,JSON['stringify'](_0x5f500a));_0x3b07c2[_0x2682('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ea47c01..99c4082 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 _0x6f17=['mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','InteractionId','Message','messageId','replace',''+_[_0x76f1('0x2f')](_0x5bf0a1[_0x76f1('0x11')],_0x76f1('0x30'),_0x76f1('0x31'))+'';_0x5bf0a1[_0x76f1('0x32')]={'Auto-Submitted':_0x76f1('0x33'),'X-Auto-Response-Suppress':_0x76f1('0x34'),'Precedence':_0x76f1('0x35')};return mailRpc[_0x76f1('0x36')](this[_0x76f1('0x2a')][_0x76f1('0x37')],_0x5bf0a1)[_0x76f1('0x38')](function(_0x9f9292){logger[_0x76f1('0x13')](_0x76f1('0x39'),_0xd3aaee);_0x5bf0a1[_0x76f1('0x2e')]=_0x9f9292[_0x76f1('0x22')][_0x76f1('0x2e')];return rpc[_0x1e5a96+'Message'][_0x76f1('0x3a')](_0x5bf0a1);})['then'](function(_0x36b3e7){logger['info'](_0x76f1('0x14'),_0xd3aaee,JSON['stringify'](_0x36b3e7));})[_0x76f1('0x3b')](function(_0x51d80b){logger[_0x76f1('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0xd3aaee,JSON['stringify'](_0x51d80b));})['finally'](function(){Promise[_0x76f1('0x3d')]()['then'](function(){if(_0x2a1c4f[0x0]!=='2'||_0x4b39d9[_0x76f1('0x1b')])return;return rpc[_0x1e5a96+_0x76f1('0x3e')][_0x76f1('0x3f')](_0x4b39d9['id'],{'autoreplyExecuted':!![]})[_0x76f1('0x38')](function(_0x2860bf){logger['info'](_0x76f1('0x1c'),_0xd3aaee,JSON[_0x76f1('0x40')](_0x2860bf));})['catch'](function(_0x3ecc0a){logger['error'](_0x76f1('0x41'),_0xd3aaee,JSON[_0x76f1('0x40')](_0x3ecc0a));});})['then'](function(){_0x1561c2['next']();});});}else{return rpc[this[_0x76f1('0xf')]+_0x76f1('0x2d')][_0x76f1('0x3a')](_0x5bf0a1)[_0x76f1('0x38')](function(){logger[_0x76f1('0x13')]('[%s][AUTOREPLY]\x20%s',_0xd3aaee,_0x5bf0a1['body']);})[_0x76f1('0x3b')](function(_0x5b9ad4){logger[_0x76f1('0x3c')](_0x76f1('0x14'),_0xd3aaee,JSON[_0x76f1('0x40')](_0x5b9ad4));})['finally'](function(){Promise[_0x76f1('0x3d')]()[_0x76f1('0x38')](function(){if(_0x2a1c4f[0x0]!=='2'||_0x4b39d9[_0x76f1('0x1b')])return;return rpc[_0x1e5a96+'Interaction'][_0x76f1('0x3f')](_0x4b39d9['id'],{'autoreplyExecuted':!![]})[_0x76f1('0x38')](function(_0x52648a){logger[_0x76f1('0x13')](_0x76f1('0x1c'),_0xd3aaee,JSON['stringify'](_0x52648a));})[_0x76f1('0x3b')](function(_0x428c43){logger[_0x76f1('0x3c')](_0x76f1('0x41'),_0xd3aaee,JSON[_0x76f1('0x40')](_0x428c43));});})[_0x76f1('0x38')](function(){_0x1561c2[_0x76f1('0x1a')]();});});}}}catch(_0x348f50){logger[_0x76f1('0x3c')](_0x76f1('0x14'),_0xd3aaee,JSON[_0x76f1('0x40')](_0x348f50));_0x1561c2[_0x76f1('0x42')]();}};}; \ No newline at end of file +var _0x8ae9=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','info','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','inReplyTo','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions'];(function(_0x47c9a9,_0x42de2d){var _0x571a7c=function(_0x289194){while(--_0x289194){_0x47c9a9['push'](_0x47c9a9['shift']());}};_0x571a7c(++_0x42de2d);}(_0x8ae9,0x161));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x98ae('0x1'))(_0x98ae('0x2'));var rpc={'chatMessage':require(_0x98ae('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x98ae('0x4')),'smsMessage':require(_0x98ae('0x5')),'faxMessage':require(_0x98ae('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x98ae('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x98ae('0x8')),'smsInteraction':require(_0x98ae('0x9')),'faxInteraction':require(_0x98ae('0xa')),'whatsappInteraction':require(_0x98ae('0xb'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3a232e,_0x1d6b52,_0x160660,_0x51f789){return function(_0x45988a){try{var _0x5b73ae=this[_0x98ae('0xc')];if(_0x5b73ae===_0x98ae('0xd')&&_0x51f789['body']['isAutoreply']){logger['info'](_0x98ae('0xe'),_0x3a232e,_0x98ae('0xf'));return _0x45988a['next']();}if(_0x1d6b52[0x0]==='1'&&(_[_0x98ae('0x10')](this[_0x98ae('0x11')][_0x98ae('0x12')])||!this[_0x98ae('0x11')][_0x98ae('0x12')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3a232e,_0x98ae('0x13'));return _0x45988a[_0x98ae('0x14')]();}if(_0x1d6b52[0x0]==='2'&&this[_0x98ae('0x11')][_0x98ae('0x15')]){logger[_0x98ae('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a232e,'One\x20Time\x20already\x20sent');return _0x45988a[_0x98ae('0x14')]();}var _0x48da58={'ContactId':this[_0x98ae('0x17')]['id'],'sentAt':moment()['format'](_0x98ae('0x18')),'direction':_0x98ae('0x19')};if(this[_0x98ae('0xc')]===_0x98ae('0xd')){_0x48da58[_0x98ae('0x1a')]=utils[_0x98ae('0x1b')](_0x1d6b52[0x2],this);}else{_0x48da58[_0x98ae('0x1a')]=utils['getMustacheRender'](_0x1d6b52[0x1],this);}if(this[_0x98ae('0x1c')]){_0x48da58['to']=this[_0x98ae('0x1c')][_0x98ae('0x1d')]||'';if(this['channel']===_0x98ae('0xd')&&_0x1d6b52[0x1]==='1'){_0x48da58['cc']=this[_0x98ae('0x1c')]['cc']||'';}_0x48da58['from']=this[_0x98ae('0x1c')]['to']||'';_0x48da58[_0x98ae('0x1e')]=this['message'][_0x98ae('0x1e')]||'';_0x48da58[_0x98ae('0x1f')]=!![];if(this[_0x98ae('0x1c')][_0x98ae('0x20')]){_0x48da58[_0x98ae('0x20')]='';_0x48da58[_0x98ae('0x20')]+=_[_0x98ae('0x21')](this[_0x98ae('0x1c')][_0x98ae('0x20')],_0x98ae('0x22'))?'':_0x98ae('0x23');_0x48da58[_0x98ae('0x20')]+=this['message'][_0x98ae('0x20')];}}if(this['channel']===_0x98ae('0x24')){_0x48da58[_0x98ae('0x25')]=this[_0x98ae('0x26')]['id'];}else{_0x48da58[_['upperFirst'](this[_0x98ae('0xc')])+_0x98ae('0x27')]=this[_0x98ae('0x26')]['id'];}_0x48da58[_[_0x98ae('0x28')](this[_0x98ae('0xc')])+'InteractionId']=this[_0x98ae('0x11')]['id'];var _0xf6b99a=this[_0x98ae('0x11')];if(rpc[this[_0x98ae('0xc')]+_0x98ae('0x29')]){if(this[_0x98ae('0xc')]==='mail'){_0x48da58[_0x98ae('0x2a')]=this[_0x98ae('0x1c')][_0x98ae('0x2b')];_0x48da58[_0x98ae('0x2c')]=_0x98ae('0x2d')+_[_0x98ae('0x2e')](_0x48da58[_0x98ae('0x1a')],_0x98ae('0x2f'),_0x98ae('0x30'))+_0x98ae('0x31');_0x48da58['headers']={'Auto-Submitted':_0x98ae('0x32'),'X-Auto-Response-Suppress':_0x98ae('0x33'),'Precedence':_0x98ae('0x34')};return mailRpc[_0x98ae('0x35')](this[_0x98ae('0x26')][_0x98ae('0x36')],_0x48da58)[_0x98ae('0x37')](function(_0x4a5aac){logger[_0x98ae('0x16')](_0x98ae('0x38'),_0x3a232e);_0x48da58[_0x98ae('0x2b')]=_0x4a5aac['message']['messageId'];return rpc[_0x5b73ae+_0x98ae('0x29')][_0x98ae('0x39')](_0x48da58);})[_0x98ae('0x37')](function(_0x205786){logger[_0x98ae('0x16')](_0x98ae('0xe'),_0x3a232e,JSON[_0x98ae('0x3a')](_0x205786));})[_0x98ae('0x3b')](function(_0x293c59){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x3a232e,JSON[_0x98ae('0x3a')](_0x293c59));})[_0x98ae('0x3c')](function(){Promise['resolve']()[_0x98ae('0x37')](function(){if(_0x1d6b52[0x0]!=='2'||_0xf6b99a[_0x98ae('0x15')])return;return rpc[_0x5b73ae+_0x98ae('0x3d')][_0x98ae('0x3e')](_0xf6b99a['id'],{'autoreplyExecuted':!![]})[_0x98ae('0x37')](function(_0x4adb6e){logger[_0x98ae('0x16')](_0x98ae('0x3f'),_0x3a232e,JSON[_0x98ae('0x3a')](_0x4adb6e));})['catch'](function(_0x3631c6){logger[_0x98ae('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a232e,JSON[_0x98ae('0x3a')](_0x3631c6));});})[_0x98ae('0x37')](function(){_0x45988a[_0x98ae('0x14')]();});});}else{return rpc[this['channel']+_0x98ae('0x29')]['create'](_0x48da58)[_0x98ae('0x37')](function(){logger[_0x98ae('0x16')]('[%s][AUTOREPLY]\x20%s',_0x3a232e,_0x48da58['body']);})[_0x98ae('0x3b')](function(_0x597633){logger[_0x98ae('0x40')]('[%s][AUTOREPLY]\x20%s',_0x3a232e,JSON['stringify'](_0x597633));})['finally'](function(){Promise[_0x98ae('0x41')]()[_0x98ae('0x37')](function(){if(_0x1d6b52[0x0]!=='2'||_0xf6b99a[_0x98ae('0x15')])return;return rpc[_0x5b73ae+_0x98ae('0x3d')][_0x98ae('0x3e')](_0xf6b99a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x58ff0f){logger[_0x98ae('0x16')](_0x98ae('0x3f'),_0x3a232e,JSON[_0x98ae('0x3a')](_0x58ff0f));})[_0x98ae('0x3b')](function(_0x4bd7d5){logger[_0x98ae('0x40')](_0x98ae('0x42'),_0x3a232e,JSON[_0x98ae('0x3a')](_0x4bd7d5));});})[_0x98ae('0x37')](function(){_0x45988a[_0x98ae('0x14')]();});});}}}catch(_0x1c82b7){logger[_0x98ae('0x40')](_0x98ae('0xe'),_0x3a232e,JSON[_0x98ae('0x3a')](_0x1c82b7));_0x45988a[_0x98ae('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index d84c3c4..6c4bcb1 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x394c=['finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x394c,0x1a0));var _0xc394=function(_0x25e95a,_0x2efe4a){_0x25e95a=_0x25e95a-0x0;var _0x2b35e8=_0x394c[_0x25e95a];return _0x2b35e8;};'use strict';var moment=require('moment');var logger=require(_0xc394('0x0'))(_0xc394('0x1'));var rpc={'chatInteraction':require(_0xc394('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc394('0x3')),'mailInteraction':require(_0xc394('0x4')),'faxInteraction':require(_0xc394('0x5')),'whatsappInteraction':require(_0xc394('0x6'))};exports[_0xc394('0x7')]=function(_0xad0625,_0x52a668,_0x2f0869,_0x124bb2){return function(_0x2be234){try{logger[_0xc394('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0xad0625,_0x52a668[0x0]);var _0xd2d539={'closed':0x1,'closedAt':moment()[_0xc394('0x9')](_0xc394('0xa')),'closeReason':_0xc394('0xb'),'disposition':_0x52a668[0x0]};if(rpc[_0x124bb2[_0xc394('0xc')]+_0xc394('0xd')]){rpc[_0x124bb2[_0xc394('0xc')]+_0xc394('0xd')][_0xc394('0xe')](_0x124bb2[_0xc394('0xf')]['id'],_0xd2d539)[_0xc394('0x10')](function(_0x76c9a2){logger[_0xc394('0x8')](_0xc394('0x11'),_0xad0625,_0x124bb2['interaction']['id']);})['catch'](function(_0x98e1fc){logger[_0xc394('0x12')](_0xc394('0x13'),_0xad0625,JSON[_0xc394('0x14')](_0x98e1fc));})[_0xc394('0x15')](function(){_0x2be234[_0xc394('0x16')]();});}}catch(_0x51d566){logger[_0xc394('0x12')](_0xc394('0x13'),_0xad0625,JSON[_0xc394('0x14')](_0x51d566));_0x2be234['stop']();}};}; \ No newline at end of file +var _0xd101=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','interaction','then','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger','routing'];(function(_0x27842c,_0x324fcb){var _0x493de8=function(_0x1f6c85){while(--_0x1f6c85){_0x27842c['push'](_0x27842c['shift']());}};_0x493de8(++_0x324fcb);}(_0xd101,0x12e));var _0x1d10=function(_0x3cddaf,_0x16977b){_0x3cddaf=_0x3cddaf-0x0;var _0x526c8a=_0xd101[_0x3cddaf];return _0x526c8a;};'use strict';var moment=require('moment');var logger=require(_0x1d10('0x0'))(_0x1d10('0x1'));var rpc={'chatInteraction':require(_0x1d10('0x2')),'openchannelInteraction':require(_0x1d10('0x3')),'smsInteraction':require(_0x1d10('0x4')),'mailInteraction':require(_0x1d10('0x5')),'faxInteraction':require(_0x1d10('0x6')),'whatsappInteraction':require(_0x1d10('0x7'))};exports['consequence']=function(_0x1df843,_0x3b5377,_0x5ceac0,_0x5843aa){return function(_0x1a6a33){try{logger[_0x1d10('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x1df843,_0x3b5377[0x0]);var _0x12cbdb={'closed':0x1,'closedAt':moment()[_0x1d10('0x9')](_0x1d10('0xa')),'closeReason':_0x1d10('0xb'),'disposition':_0x3b5377[0x0]};if(rpc[_0x5843aa['channel']+_0x1d10('0xc')]){rpc[_0x5843aa['channel']+_0x1d10('0xc')]['update'](_0x5843aa[_0x1d10('0xd')]['id'],_0x12cbdb)[_0x1d10('0xe')](function(_0x4a746b){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1df843,_0x5843aa['interaction']['id']);})['catch'](function(_0x5ddc63){logger[_0x1d10('0xf')](_0x1d10('0x10'),_0x1df843,JSON[_0x1d10('0x11')](_0x5ddc63));})['finally'](function(){_0x1a6a33[_0x1d10('0x12')]();});}}catch(_0x12391e){logger[_0x1d10('0xf')](_0x1d10('0x10'),_0x1df843,JSON[_0x1d10('0x11')](_0x12391e));_0x1a6a33[_0x1d10('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 33ba99c..a200b38 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcedf=['apiai-promise','md5','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','endConversation','stop','lodash','moment'];(function(_0x14e76c,_0x2ced08){var _0x19059c=function(_0x11967e){while(--_0x11967e){_0x14e76c['push'](_0x14e76c['shift']());}};_0x19059c(++_0x2ced08);}(_0xcedf,0x1b6));var _0xfced=function(_0x1f9918,_0x11cd48){_0x1f9918=_0x1f9918-0x0;var _0x324635=_0xcedf[_0x1f9918];return _0x324635;};'use strict';var _=require(_0xfced('0x0'));var moment=require(_0xfced('0x1'));var apiai=require(_0xfced('0x2'));var md5=require(_0xfced('0x3'));var utils=require('./utils');var logger=require(_0xfced('0x4'))(_0xfced('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfced('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfced('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xfced('0x8')]=function(_0x571725,_0x2cc4d1){return function(_0x5bd518){try{if(!_['isNil'](this[_0xfced('0x9')][_0xfced('0xa')])){logger[_0xfced('0xb')](_0xfced('0xc'),_0x571725,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5bd518[_0xfced('0xd')]();}var _0x3487bd={'ContactId':this[_0xfced('0xe')]['id'],'sentAt':moment()[_0xfced('0xf')](_0xfced('0x10')),'direction':_0xfced('0x11')};if(this[_0xfced('0x12')]===_0xfced('0x13')||this[_0xfced('0x12')]==='whatsapp'){_0x3487bd[_0xfced('0x14')]=this['interaction'][_0xfced('0x14')];}var _0x5792c1=this[_0xfced('0x12')];if(_0x5792c1===_0xfced('0x15')){_0x3487bd['ChatWebsiteId']=this[_0xfced('0x16')]['id'];}else{_0x3487bd[_[_0xfced('0x17')](_0x5792c1)+_0xfced('0x18')]=this[_0xfced('0x16')]['id'];}_0x3487bd[_[_0xfced('0x17')](_0x5792c1)+_0xfced('0x19')]=this[_0xfced('0x9')]['id'];if(this[_0xfced('0x9')]['created']){var _0x95b06f=_0x2cc4d1[0x2];if(!_['isEmpty'](_0x95b06f)){_0x3487bd[_0xfced('0x1a')]=utils[_0xfced('0x1b')](_0x95b06f,this);return rpc[_0x5792c1+_0xfced('0x1c')][_0xfced('0x1d')](_0x3487bd)[_0xfced('0x1e')](function(_0x27e988){logger[_0xfced('0xb')](_0xfced('0xc'),_0x571725,_0x3487bd[_0xfced('0x1a')]);})[_0xfced('0x1f')](function(_0x4dc7ba){logger[_0xfced('0x20')](_0xfced('0xc'),_0x571725,JSON[_0xfced('0x21')](_0x4dc7ba));})[_0xfced('0x22')](function(){logger[_0xfced('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x571725);_0x5bd518['stop']();});}else{logger[_0xfced('0xb')](_0xfced('0x23'),_0x571725);_0x5bd518['stop']();}}else{var _0x12f832=this;var _0x445862=apiai(_0x2cc4d1[0x0],{'language':_0x2cc4d1[0x1]||'en'});return _0x445862[_0xfced('0x24')](this[_0xfced('0x25')][_0xfced('0x1a')],{'sessionId':md5(this[_0xfced('0x9')]['id'])})['then'](function(_0x16d9a3){_0x12f832[_0xfced('0x1a')][_0xfced('0x26')]=_0x16d9a3;_0x3487bd[_0xfced('0x1a')]=_0x16d9a3[_0xfced('0x27')]['fulfillment']['speech'];_0x3487bd[_0xfced('0x28')]=_0xfced('0x26');_0x3487bd[_0xfced('0x29')]=JSON[_0xfced('0x21')](_0x16d9a3);return rpc[_0x5792c1+'Message'][_0xfced('0x1d')](_0x3487bd)['then'](function(_0x506855){logger[_0xfced('0xb')](_0xfced('0xc'),_0x571725,_0x3487bd['body']);if(_0x16d9a3[_0xfced('0x27')]['metadata'][_0xfced('0x2a')]){_0x5bd518[_0xfced('0xd')]();}else{_0x5bd518[_0xfced('0x2b')]();}})[_0xfced('0x1f')](function(_0x561698){logger[_0xfced('0x20')](_0xfced('0xc'),_0x571725,JSON[_0xfced('0x21')](_0x561698));_0x5bd518[_0xfced('0xd')]();});})['catch'](function(_0x1fab8d){logger[_0xfced('0x20')](_0xfced('0xc'),_0x571725,_0x1fab8d['message']);_0x5bd518[_0xfced('0xd')]();});}}catch(_0x6fdd87){logger[_0xfced('0x20')](_0xfced('0xc'),_0x571725,JSON[_0xfced('0x21')](_0x6fdd87));_0x5bd518[_0xfced('0x2b')]();}};}; \ No newline at end of file +var _0x5581=['AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','info','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','providerName','providerResponse','stringify','metadata','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x52deb5,_0x1af6e0){var _0x31935e=function(_0x91b3e4){while(--_0x91b3e4){_0x52deb5['push'](_0x52deb5['shift']());}};_0x31935e(++_0x1af6e0);}(_0x5581,0x115));var _0x1558=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x5581[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x1558('0x0'));var moment=require('moment');var apiai=require(_0x1558('0x1'));var md5=require(_0x1558('0x2'));var utils=require(_0x1558('0x3'));var logger=require(_0x1558('0x4'))(_0x1558('0x5'));var rpc={'chatMessage':require(_0x1558('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1558('0x7')),'smsMessage':require(_0x1558('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1558('0x9'))};exports[_0x1558('0xa')]=function(_0x5043c0,_0x3d784e){return function(_0x15c3f2){try{if(!_[_0x1558('0xb')](this[_0x1558('0xc')][_0x1558('0xd')])){logger['info'](_0x1558('0xe'),_0x5043c0,_0x1558('0xf'));return _0x15c3f2[_0x1558('0x10')]();}var _0x296193={'ContactId':this[_0x1558('0x11')]['id'],'sentAt':moment()[_0x1558('0x12')](_0x1558('0x13')),'direction':_0x1558('0x14')};if(this[_0x1558('0x15')]===_0x1558('0x16')||this[_0x1558('0x15')]===_0x1558('0x17')){_0x296193[_0x1558('0x18')]=this['interaction'][_0x1558('0x18')];}var _0x3d3a00=this[_0x1558('0x15')];if(_0x3d3a00===_0x1558('0x19')){_0x296193[_0x1558('0x1a')]=this[_0x1558('0x1b')]['id'];}else{_0x296193[_[_0x1558('0x1c')](_0x3d3a00)+_0x1558('0x1d')]=this[_0x1558('0x1b')]['id'];}_0x296193[_['upperFirst'](_0x3d3a00)+_0x1558('0x1e')]=this[_0x1558('0xc')]['id'];if(this[_0x1558('0xc')]['created']){var _0x14ea77=_0x3d784e[0x2];if(!_[_0x1558('0x1f')](_0x14ea77)){_0x296193[_0x1558('0x20')]=utils[_0x1558('0x21')](_0x14ea77,this);return rpc[_0x3d3a00+_0x1558('0x22')]['create'](_0x296193)['then'](function(_0x451547){logger[_0x1558('0x23')](_0x1558('0xe'),_0x5043c0,_0x296193[_0x1558('0x20')]);})[_0x1558('0x24')](function(_0x114d86){logger[_0x1558('0x25')](_0x1558('0xe'),_0x5043c0,JSON['stringify'](_0x114d86));})['finally'](function(){logger['info'](_0x1558('0x26'),_0x5043c0);_0x15c3f2[_0x1558('0x27')]();});}else{logger[_0x1558('0x23')](_0x1558('0x28'),_0x5043c0);_0x15c3f2[_0x1558('0x27')]();}}else{var _0x1646b7=this;var _0x251aa9=apiai(_0x3d784e[0x0],{'language':_0x3d784e[0x1]||'en'});return _0x251aa9[_0x1558('0x29')](this['message'][_0x1558('0x20')],{'sessionId':md5(this['interaction']['id'])})[_0x1558('0x2a')](function(_0x10928c){_0x1646b7[_0x1558('0x20')][_0x1558('0x2b')]=_0x10928c;_0x296193[_0x1558('0x20')]=_0x10928c[_0x1558('0x2c')][_0x1558('0x2d')]['speech'];_0x296193[_0x1558('0x2e')]=_0x1558('0x2b');_0x296193[_0x1558('0x2f')]=JSON[_0x1558('0x30')](_0x10928c);return rpc[_0x3d3a00+_0x1558('0x22')]['create'](_0x296193)[_0x1558('0x2a')](function(_0x3927ac){logger[_0x1558('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x5043c0,_0x296193[_0x1558('0x20')]);if(_0x10928c[_0x1558('0x2c')][_0x1558('0x31')]['endConversation']){_0x15c3f2[_0x1558('0x10')]();}else{_0x15c3f2['stop']();}})[_0x1558('0x24')](function(_0x2a7637){logger['error'](_0x1558('0xe'),_0x5043c0,JSON['stringify'](_0x2a7637));_0x15c3f2['next']();});})[_0x1558('0x24')](function(_0x3b22cc){logger[_0x1558('0x25')](_0x1558('0xe'),_0x5043c0,_0x3b22cc[_0x1558('0x32')]);_0x15c3f2['next']();});}}catch(_0x4b651f){logger[_0x1558('0x25')](_0x1558('0xe'),_0x5043c0,JSON[_0x1558('0x30')](_0x4b651f));_0x15c3f2[_0x1558('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 80783db..c4b2e95 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd11=['body','catch','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','providerName','providerResponse','fulfillmentText','push','all','next','lodash','dialogflow','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s'];(function(_0x2ace7c,_0x52f120){var _0x2396d2=function(_0x33293d){while(--_0x33293d){_0x2ace7c['push'](_0x2ace7c['shift']());}};_0x2396d2(++_0x52f120);}(_0xdd11,0xf1));var _0x1dd1=function(_0x48cc04,_0x37efcb){_0x48cc04=_0x48cc04-0x0;var _0x9b4bf2=_0xdd11[_0x48cc04];return _0x9b4bf2;};'use strict';var _=require(_0x1dd1('0x0'));var dialogflow=require(_0x1dd1('0x1'));var md5=require(_0x1dd1('0x2'));var moment=require(_0x1dd1('0x3'));var Promise=require(_0x1dd1('0x4'));var logger=require('../../../../config/logger')(_0x1dd1('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x1dd1('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1dd1('0x7')),'smsMessage':require(_0x1dd1('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1dd1('0x9'))};function createMessage(_0xeae621,_0x440d40,_0x24dbeb,_0x9034a0){return new Promise(function(_0x155e44,_0x13ced0){var _0x11d961=_['clone'](_0x24dbeb);_0x11d961['body']=_0x9034a0;return rpc[_0x440d40+_0x1dd1('0xa')][_0x1dd1('0xb')](_0x11d961)[_0x1dd1('0xc')](function(){logger[_0x1dd1('0xd')](_0x1dd1('0xe'),_0xeae621,_0x11d961[_0x1dd1('0xf')]);_0x155e44();})[_0x1dd1('0x10')](function(_0x3102d6){logger['error'](_0x1dd1('0xe'),_0xeae621,JSON[_0x1dd1('0x11')](_0x3102d6));_0x13ced0(_0x3102d6);});});}exports[_0x1dd1('0x12')]=function(_0x39f892,_0x5ee12e){return function(_0x410385){try{if(!_['isNil'](this[_0x1dd1('0x13')][_0x1dd1('0x14')])){logger[_0x1dd1('0xd')](_0x1dd1('0xe'),_0x39f892,_0x1dd1('0x15'));return _0x410385['next']();}var _0x362433={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1dd1('0x16')](_0x1dd1('0x17')),'direction':_0x1dd1('0x18')};if(this[_0x1dd1('0x19')]===_0x1dd1('0x1a')||this['channel']==='whatsapp'){_0x362433[_0x1dd1('0x1b')]=this[_0x1dd1('0x13')][_0x1dd1('0x1b')];}var _0x2cec48=this['channel'];if(_0x2cec48==='chat'){_0x362433[_0x1dd1('0x1c')]=this[_0x1dd1('0x1d')]['id'];}else{_0x362433[_[_0x1dd1('0x1e')](_0x2cec48)+_0x1dd1('0x1f')]=this[_0x1dd1('0x1d')]['id'];}_0x362433[_['upperFirst'](_0x2cec48)+'InteractionId']=this[_0x1dd1('0x13')]['id'];if(this[_0x1dd1('0x13')]['created']){var _0x4e11ab=_0x5ee12e[0x4];if(!_['isEmpty'](_0x4e11ab)){_0x362433[_0x1dd1('0xf')]=utils['getMustacheRender'](_0x4e11ab,this);return rpc[_0x2cec48+'Message']['create'](_0x362433)[_0x1dd1('0xc')](function(_0x582935){logger[_0x1dd1('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x39f892,_0x362433[_0x1dd1('0xf')]);})[_0x1dd1('0x10')](function(_0x47908e){logger[_0x1dd1('0x20')](_0x1dd1('0xe'),_0x39f892,JSON[_0x1dd1('0x11')](_0x47908e));})['finally'](function(){logger[_0x1dd1('0xd')](_0x1dd1('0x21'),_0x39f892);_0x410385['stop']();});}else{logger[_0x1dd1('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x39f892);_0x410385[_0x1dd1('0x22')]();}}else{var _0xcc8644=this;var _0x139eb6=_0x5ee12e[0x2][_0x1dd1('0x23')](/\\n/g,'\x0a');var _0xc4e1c5={'credentials':{'private_key':_0x139eb6,'client_email':_0x5ee12e[0x1]}};var _0x47009e=new dialogflow['SessionsClient'](_0xc4e1c5);var _0x4a7461=_0x47009e['sessionPath'](_0x5ee12e[0x0],md5(_0xcc8644['interaction']['id']));var _0x1fd741={'session':_0x4a7461,'queryInput':{'text':{'text':_0xcc8644[_0x1dd1('0x24')][_0x1dd1('0xf')],'languageCode':_0x5ee12e[0x3]||'en'}}};return _0x47009e[_0x1dd1('0x25')](_0x1fd741)['then'](function(_0x7053da){if(_0x7053da&&_0x7053da[_0x1dd1('0x26')]){_0xcc8644['body'][_0x1dd1('0x27')]=_0x7053da;var _0x3cf249=_0x7053da[0x0];var _0x12743d=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x29')]&&_0x3cf249[_0x1dd1('0x28')]['diagnosticInfo'][_0x1dd1('0x2a')]?_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x29')][_0x1dd1('0x2a')][_0x1dd1('0x2b')][_0x1dd1('0x2c')]:![];_0xcc8644[_0x1dd1('0xf')]['DIALOGFLOWV2_ACTION']=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x2d')];_0xcc8644[_0x1dd1('0xf')][_0x1dd1('0x2e')]=_0x3cf249['queryResult'][_0x1dd1('0x2f')];_0xcc8644[_0x1dd1('0xf')][_0x1dd1('0x30')]=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x29')]&&_0x3cf249[_0x1dd1('0x28')]['diagnosticInfo'][_0x1dd1('0x2a')]?_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x29')][_0x1dd1('0x2a')]['end_conversation'][_0x1dd1('0x2c')]:![];_0xcc8644['body'][_0x1dd1('0x31')]=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x32')][_0x1dd1('0x33')];_0xcc8644[_0x1dd1('0xf')][_0x1dd1('0x34')]=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x32')][_0x1dd1('0x35')];_0xcc8644['body'][_0x1dd1('0x36')]=_0x3cf249[_0x1dd1('0x28')]['intent']['isFallback'];_0xcc8644[_0x1dd1('0xf')][_0x1dd1('0x37')]=_0x3cf249[_0x1dd1('0x28')][_0x1dd1('0x38')];_0xcc8644[_0x1dd1('0xf')][_0x1dd1('0x39')]=_0x3cf249[_0x1dd1('0x28')]['queryText'];_0xcc8644[_0x1dd1('0xf')]['DIALOGFLOWV2_SCORE']=_0x3cf249['queryResult']['intentDetectionConfidence'];_0x362433[_0x1dd1('0x3a')]=_0x1dd1('0x27');_0x362433[_0x1dd1('0x3b')]=JSON[_0x1dd1('0x11')](_0x7053da);var _0x4bb621=[];for(var _0x50ec30=0x0;_0x50ec30<_0x7053da[_0x1dd1('0x26')];_0x50ec30++){var _0x23ded1=_0x7053da[_0x50ec30];if(_0x23ded1&&_0x23ded1[_0x1dd1('0x28')]&&_0x23ded1['queryResult'][_0x1dd1('0x3c')]){_0x4bb621[_0x1dd1('0x3d')](createMessage(_0x39f892,_0x2cec48,_0x362433,_0x23ded1[_0x1dd1('0x28')][_0x1dd1('0x3c')]));}}return Promise[_0x1dd1('0x3e')](_0x4bb621)['then'](function(){if(_0x12743d){_0x410385[_0x1dd1('0x3f')]();}else{_0x410385[_0x1dd1('0x22')]();}})[_0x1dd1('0x10')](function(_0x7e681b){logger['error'](_0x1dd1('0xe'),_0x39f892,JSON[_0x1dd1('0x11')](_0x7e681b));_0x410385[_0x1dd1('0x3f')]();});}})[_0x1dd1('0x10')](function(_0x515ad4){logger[_0x1dd1('0x20')](_0x1dd1('0xe'),_0x39f892,_0x515ad4[_0x1dd1('0x24')]);_0x410385[_0x1dd1('0x3f')]();});}}catch(_0x52d636){logger[_0x1dd1('0x20')](_0x1dd1('0xe'),_0x39f892,JSON['stringify'](_0x52d636));_0x410385[_0x1dd1('0x22')]();}};}; \ No newline at end of file +var _0xd116=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','push','fulfillmentText','all','stop','catch','error','lodash','dialogflow','md5','moment','bluebird','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','InteractionId','created','isEmpty','info'];(function(_0x2bf37d,_0x5c3bcd){var _0x4c40df=function(_0x589881){while(--_0x589881){_0x2bf37d['push'](_0x2bf37d['shift']());}};_0x4c40df(++_0x5c3bcd);}(_0xd116,0x6a));var _0x6d11=function(_0x3f70c0,_0x114061){_0x3f70c0=_0x3f70c0-0x0;var _0x55737f=_0xd116[_0x3f70c0];return _0x55737f;};'use strict';var _=require(_0x6d11('0x0'));var dialogflow=require(_0x6d11('0x1'));var md5=require(_0x6d11('0x2'));var moment=require(_0x6d11('0x3'));var Promise=require(_0x6d11('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x6d11('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6d11('0x6')),'smsMessage':require(_0x6d11('0x7')),'faxMessage':require(_0x6d11('0x8')),'whatsappMessage':require(_0x6d11('0x9'))};function createMessage(_0x31e4bb,_0x42bf3a,_0x336a68,_0x1c2e87){return new Promise(function(_0x4c37e1,_0x55b391){var _0x6719d1=_['clone'](_0x336a68);_0x6719d1[_0x6d11('0xa')]=_0x1c2e87;return rpc[_0x42bf3a+_0x6d11('0xb')]['create'](_0x6719d1)[_0x6d11('0xc')](function(){logger['info'](_0x6d11('0xd'),_0x31e4bb,_0x6719d1[_0x6d11('0xa')]);_0x4c37e1();})['catch'](function(_0x56825a){logger['error'](_0x6d11('0xd'),_0x31e4bb,JSON[_0x6d11('0xe')](_0x56825a));_0x55b391(_0x56825a);});});}exports[_0x6d11('0xf')]=function(_0x590283,_0x36377d){return function(_0x561817){try{if(!_[_0x6d11('0x10')](this[_0x6d11('0x11')][_0x6d11('0x12')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x590283,_0x6d11('0x13'));return _0x561817[_0x6d11('0x14')]();}var _0x1cbff9={'ContactId':this[_0x6d11('0x15')]['id'],'sentAt':moment()[_0x6d11('0x16')](_0x6d11('0x17')),'direction':_0x6d11('0x18')};if(this[_0x6d11('0x19')]==='sms'||this[_0x6d11('0x19')]===_0x6d11('0x1a')){_0x1cbff9['phone']=this['interaction'][_0x6d11('0x1b')];}var _0x2f8c04=this[_0x6d11('0x19')];if(_0x2f8c04==='chat'){_0x1cbff9[_0x6d11('0x1c')]=this[_0x6d11('0x1d')]['id'];}else{_0x1cbff9[_['upperFirst'](_0x2f8c04)+'AccountId']=this['account']['id'];}_0x1cbff9[_['upperFirst'](_0x2f8c04)+_0x6d11('0x1e')]=this[_0x6d11('0x11')]['id'];if(this[_0x6d11('0x11')][_0x6d11('0x1f')]){var _0xc6bfa5=_0x36377d[0x4];if(!_[_0x6d11('0x20')](_0xc6bfa5)){_0x1cbff9['body']=utils['getMustacheRender'](_0xc6bfa5,this);return rpc[_0x2f8c04+_0x6d11('0xb')]['create'](_0x1cbff9)[_0x6d11('0xc')](function(_0x408848){logger[_0x6d11('0x21')](_0x6d11('0xd'),_0x590283,_0x1cbff9[_0x6d11('0xa')]);})['catch'](function(_0xb19882){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x590283,JSON['stringify'](_0xb19882));})[_0x6d11('0x22')](function(){logger[_0x6d11('0x21')](_0x6d11('0x23'),_0x590283);_0x561817['stop']();});}else{logger[_0x6d11('0x21')](_0x6d11('0x24'),_0x590283);_0x561817['stop']();}}else{var _0x1ba8dd=this;var _0x1d0bbc=_0x36377d[0x2][_0x6d11('0x25')](/\\n/g,'\x0a');var _0x5135ba={'credentials':{'private_key':_0x1d0bbc,'client_email':_0x36377d[0x1]}};var _0xc847f1=new dialogflow['SessionsClient'](_0x5135ba);var _0x4ee9ce=_0xc847f1[_0x6d11('0x26')](_0x36377d[0x0],md5(_0x1ba8dd[_0x6d11('0x11')]['id']));var _0xa38206={'session':_0x4ee9ce,'queryInput':{'text':{'text':_0x1ba8dd[_0x6d11('0x27')]['body'],'languageCode':_0x36377d[0x3]||'en'}}};return _0xc847f1[_0x6d11('0x28')](_0xa38206)['then'](function(_0x20d175){if(_0x20d175&&_0x20d175[_0x6d11('0x29')]){_0x1ba8dd['body'][_0x6d11('0x2a')]=_0x20d175;var _0x21b6e4=_0x20d175[0x0];var _0x4a6230=_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x2c')]&&_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x2c')][_0x6d11('0x2d')]?_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x2c')][_0x6d11('0x2d')]['end_conversation'][_0x6d11('0x2e')]:![];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x2f')]=_0x21b6e4['queryResult']['action'];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x30')]=_0x21b6e4['queryResult'][_0x6d11('0x31')];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x32')]=_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x2c')]&&_0x21b6e4[_0x6d11('0x2b')]['diagnosticInfo'][_0x6d11('0x2d')]?_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x2c')][_0x6d11('0x2d')][_0x6d11('0x33')]['boolValue']:![];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x34')]=_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x35')][_0x6d11('0x36')];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x37')]=_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x35')][_0x6d11('0x38')];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x39')]=_0x21b6e4['queryResult'][_0x6d11('0x35')][_0x6d11('0x3a')];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x3b')]=_0x21b6e4[_0x6d11('0x2b')]['languageCode'];_0x1ba8dd[_0x6d11('0xa')][_0x6d11('0x3c')]=_0x21b6e4[_0x6d11('0x2b')][_0x6d11('0x3d')];_0x1ba8dd[_0x6d11('0xa')]['DIALOGFLOWV2_SCORE']=_0x21b6e4['queryResult'][_0x6d11('0x3e')];_0x1cbff9[_0x6d11('0x3f')]=_0x6d11('0x2a');_0x1cbff9['providerResponse']=JSON[_0x6d11('0xe')](_0x20d175);var _0x42e44b=[];for(var _0x31f4c0=0x0;_0x31f4c0<_0x20d175[_0x6d11('0x29')];_0x31f4c0++){var _0x5cc7d2=_0x20d175[_0x31f4c0];if(_0x5cc7d2&&_0x5cc7d2[_0x6d11('0x2b')]&&_0x5cc7d2[_0x6d11('0x2b')]['fulfillmentText']){_0x42e44b[_0x6d11('0x40')](createMessage(_0x590283,_0x2f8c04,_0x1cbff9,_0x5cc7d2['queryResult'][_0x6d11('0x41')]));}}return Promise[_0x6d11('0x42')](_0x42e44b)['then'](function(){if(_0x4a6230){_0x561817[_0x6d11('0x14')]();}else{_0x561817[_0x6d11('0x43')]();}})[_0x6d11('0x44')](function(_0x10b921){logger[_0x6d11('0x45')](_0x6d11('0xd'),_0x590283,JSON[_0x6d11('0xe')](_0x10b921));_0x561817[_0x6d11('0x14')]();});}})['catch'](function(_0x226071){logger[_0x6d11('0x45')](_0x6d11('0xd'),_0x590283,_0x226071[_0x6d11('0x27')]);_0x561817[_0x6d11('0x14')]();});}}catch(_0x426870){logger[_0x6d11('0x45')](_0x6d11('0xd'),_0x590283,JSON[_0x6d11('0xe')](_0x426870));_0x561817[_0x6d11('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 664f062..ee1d45c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2ee=['string','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing'];(function(_0x58c8d7,_0x1fe645){var _0x1b252c=function(_0x2f68fc){while(--_0x2f68fc){_0x58c8d7['push'](_0x58c8d7['shift']());}};_0x1b252c(++_0x1fe645);}(_0xb2ee,0xbf));var _0xeb2e=function(_0x5a12f8,_0x1b0912){_0x5a12f8=_0x5a12f8-0x0;var _0x18a9b1=_0xb2ee[_0x5a12f8];return _0x18a9b1;};'use strict';var schema=require(_0xeb2e('0x0'));var _=require(_0xeb2e('0x1'));var htmlToText=require(_0xeb2e('0x2'));var utils=require('./utils');var logger=require(_0xeb2e('0x3'))(_0xeb2e('0x4'));var gotoif=schema({'condition':{'type':_0xeb2e('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xeb2e('0x6'),'message':_0xeb2e('0x7')},'priorityFalse':{'type':_0xeb2e('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x4ebfd9,_0x338d40){return function(_0x26733b){try{var _0x49f0c7={'condition':htmlToText[_0xeb2e('0x8')](utils[_0xeb2e('0x9')](_0x338d40[0x0],this),{'wordwrap':![]})[_0xeb2e('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x338d40[0x1],'priorityFalse':_0x338d40[0x2]};var _0x110f4d=gotoif[_0xeb2e('0x0')](_0x49f0c7,{'typecast':!![]});if(_0x110f4d[_0xeb2e('0xb')]){logger[_0xeb2e('0xc')](_0xeb2e('0xd'),_0x4ebfd9,_[_0xeb2e('0xe')](_0x110f4d,_0xeb2e('0xf'))[_0xeb2e('0x10')](',\x20'));_0x26733b[_0xeb2e('0x11')]();}else{try{var _0x3d59c2=eval('('+_0x49f0c7[_0xeb2e('0x12')]+')');var _0x1e4506=_0x3d59c2?_0x49f0c7['priorityTrue']:_0x49f0c7[_0xeb2e('0x13')];logger[_0xeb2e('0x14')](_0xeb2e('0x15'),_0x4ebfd9,_0x49f0c7[_0xeb2e('0x12')],_0x3d59c2,_0x1e4506||_0xeb2e('0x16'));if(_0x1e4506){var _0x9ebc20=_[_0xeb2e('0x17')](_0x26733b[_0xeb2e('0x18')](),{'p':_0x1e4506});if(_0x9ebc20>=0x0){logger[_0xeb2e('0x14')](_0xeb2e('0x19'),_0x4ebfd9,_0x1e4506||_0xeb2e('0x16'),_0x9ebc20);_0x26733b[_0xeb2e('0x16')](_0x9ebc20);}else{logger[_0xeb2e('0x14')](_0xeb2e('0x1a'),_0x4ebfd9,_0x1e4506||_0xeb2e('0x16'));_0x26733b['stop']();}}else{_0x26733b[_0xeb2e('0x16')]();}}catch(_0x184b93){logger['error'](_0xeb2e('0x1b'),_0x4ebfd9,_0x184b93[_0xeb2e('0xf')]);_0x26733b[_0xeb2e('0x11')]();}}}catch(_0x514d0a){logger[_0xeb2e('0xc')](_0xeb2e('0xd'),_0x4ebfd9,JSON['stringify'](_0x514d0a));_0x26733b[_0xeb2e('0x11')]();}};}; \ No newline at end of file +var _0x9e45=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils'];(function(_0x355c66,_0x41570b){var _0x35389f=function(_0x834d8e){while(--_0x834d8e){_0x355c66['push'](_0x355c66['shift']());}};_0x35389f(++_0x41570b);}(_0x9e45,0x1ec));var _0x59e4=function(_0x4954e0,_0xb50c6d){_0x4954e0=_0x4954e0-0x0;var _0x2f40d0=_0x9e45[_0x4954e0];return _0x2f40d0;};'use strict';var schema=require(_0x59e4('0x0'));var _=require(_0x59e4('0x1'));var htmlToText=require(_0x59e4('0x2'));var utils=require(_0x59e4('0x3'));var logger=require(_0x59e4('0x4'))(_0x59e4('0x5'));var gotoif=schema({'condition':{'type':_0x59e4('0x6'),'required':!![],'message':_0x59e4('0x7')},'priorityTrue':{'type':_0x59e4('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x59e4('0x8'),'message':_0x59e4('0x9')}});exports[_0x59e4('0xa')]=function(_0x325e13,_0x327e16){return function(_0x356050){try{var _0x5e457b={'condition':htmlToText[_0x59e4('0xb')](utils['getMustacheRender'](_0x327e16[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x327e16[0x1],'priorityFalse':_0x327e16[0x2]};var _0x51c6f2=gotoif['validate'](_0x5e457b,{'typecast':!![]});if(_0x51c6f2[_0x59e4('0xc')]){logger[_0x59e4('0xd')](_0x59e4('0xe'),_0x325e13,_[_0x59e4('0xf')](_0x51c6f2,'message')[_0x59e4('0x10')](',\x20'));_0x356050[_0x59e4('0x11')]();}else{try{var _0x2daeb8=eval('('+_0x5e457b[_0x59e4('0x12')]+')');var _0x4a5037=_0x2daeb8?_0x5e457b[_0x59e4('0x13')]:_0x5e457b[_0x59e4('0x14')];logger[_0x59e4('0x15')](_0x59e4('0x16'),_0x325e13,_0x5e457b[_0x59e4('0x12')],_0x2daeb8,_0x4a5037||'next');if(_0x4a5037){var _0x4b1e98=_[_0x59e4('0x17')](_0x356050[_0x59e4('0x18')](),{'p':_0x4a5037});if(_0x4b1e98>=0x0){logger['info'](_0x59e4('0x19'),_0x325e13,_0x4a5037||_0x59e4('0x1a'),_0x4b1e98);_0x356050[_0x59e4('0x1a')](_0x4b1e98);}else{logger[_0x59e4('0x15')](_0x59e4('0x1b'),_0x325e13,_0x4a5037||_0x59e4('0x1a'));_0x356050[_0x59e4('0x11')]();}}else{_0x356050['next']();}}catch(_0x4b7b56){logger[_0x59e4('0xd')](_0x59e4('0x1c'),_0x325e13,_0x4b7b56[_0x59e4('0x1d')]);_0x356050[_0x59e4('0x11')]();}}}catch(_0x4313e5){logger[_0x59e4('0xd')]('[%s][GOTOIF]\x20%s',_0x325e13,JSON[_0x59e4('0x1e')](_0x4313e5));_0x356050['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index fab918f..998f0a1 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 _0x20bd=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','info'];(function(_0x3774b9,_0x558927){var _0x5343bd=function(_0xeaa157){while(--_0xeaa157){_0x3774b9['push'](_0x3774b9['shift']());}};_0x5343bd(++_0x558927);}(_0x20bd,0x1d6));var _0xd20b=function(_0x355f9b,_0x26812e){_0x355f9b=_0x355f9b-0x0;var _0x7fb027=_0x20bd[_0x355f9b];return _0x7fb027;};'use strict';var schema=require(_0xd20b('0x0'));var _=require(_0xd20b('0x1'));var logger=require(_0xd20b('0x2'))(_0xd20b('0x3'));var gotop=schema({'priority':{'type':_0xd20b('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd20b('0x5')]=function(_0x7ff129,_0x466ec3){return function(_0x44b0ac){try{var _0x3a23dd={'priority':_0x466ec3[0x0]};var _0x13dec3=gotop['validate'](_0x3a23dd,{'typecast':!![]});if(_0x13dec3['length']){logger[_0xd20b('0x6')](_0xd20b('0x7'),_0x7ff129,_['map'](_0x13dec3,_0xd20b('0x8'))[_0xd20b('0x9')](',\x20'));_0x44b0ac[_0xd20b('0xa')]();}else{logger['info'](_0xd20b('0xb'),_0x7ff129,_0x3a23dd['priority']);if(_0x3a23dd['priority']){var _0x1da0aa=_[_0xd20b('0xc')](_0x44b0ac[_0xd20b('0xd')](),{'p':_0x3a23dd[_0xd20b('0xe')]});if(_0x1da0aa>=0x0){logger[_0xd20b('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x7ff129,_0x3a23dd[_0xd20b('0xe')]||_0xd20b('0x10'),_0x1da0aa);_0x44b0ac[_0xd20b('0x10')](_0x1da0aa);}else{logger[_0xd20b('0xf')](_0xd20b('0x11'),_0x7ff129,_0x3a23dd['priority']||_0xd20b('0x10'));_0x44b0ac[_0xd20b('0xa')]();}}else{_0x44b0ac[_0xd20b('0x10')]();}}}catch(_0x555007){logger['error'](_0xd20b('0x7'),_0x7ff129,JSON['stringify'](_0x555007));_0x44b0ac['stop']();}};}; \ No newline at end of file +var _0x7df9=['stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7df9,0x89));var _0x97df=function(_0x52c342,_0x5ee6f1){_0x52c342=_0x52c342-0x0;var _0x1d02f7=_0x7df9[_0x52c342];return _0x1d02f7;};'use strict';var schema=require('validate');var _=require(_0x97df('0x0'));var logger=require(_0x97df('0x1'))(_0x97df('0x2'));var gotop=schema({'priority':{'type':_0x97df('0x3'),'required':!![],'message':_0x97df('0x4')}});exports[_0x97df('0x5')]=function(_0x7d8766,_0x30b6e2){return function(_0x2b22fa){try{var _0x226a2a={'priority':_0x30b6e2[0x0]};var _0x5c8ce2=gotop['validate'](_0x226a2a,{'typecast':!![]});if(_0x5c8ce2['length']){logger[_0x97df('0x6')]('[%s][GOTOP]\x20%s',_0x7d8766,_[_0x97df('0x7')](_0x5c8ce2,'message')[_0x97df('0x8')](',\x20'));_0x2b22fa[_0x97df('0x9')]();}else{logger[_0x97df('0xa')](_0x97df('0xb'),_0x7d8766,_0x226a2a[_0x97df('0xc')]);if(_0x226a2a[_0x97df('0xc')]){var _0x467a67=_[_0x97df('0xd')](_0x2b22fa['rules'](),{'p':_0x226a2a[_0x97df('0xc')]});if(_0x467a67>=0x0){logger[_0x97df('0xa')](_0x97df('0xe'),_0x7d8766,_0x226a2a[_0x97df('0xc')]||_0x97df('0xf'),_0x467a67);_0x2b22fa[_0x97df('0xf')](_0x467a67);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x7d8766,_0x226a2a[_0x97df('0xc')]||'next');_0x2b22fa[_0x97df('0x9')]();}}else{_0x2b22fa[_0x97df('0xf')]();}}}catch(_0x4d3734){logger['error']('[%s][GOTOP]\x20%s',_0x7d8766,JSON[_0x97df('0x10')](_0x4d3734));_0x2b22fa[_0x97df('0x9')]();}};}; \ 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 e249eb5..424559b 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 _0xed3c=['create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','channel','upperFirst','AccountId','account','InteractionId','interaction','Message'];(function(_0x31dc6a,_0x51040f){var _0x283cbc=function(_0x5ee3c5){while(--_0x5ee3c5){_0x31dc6a['push'](_0x31dc6a['shift']());}};_0x283cbc(++_0x51040f);}(_0xed3c,0x1a6));var _0xced3=function(_0x2e2e41,_0x3a7848){_0x2e2e41=_0x2e2e41-0x0;var _0x266226=_0xed3c[_0x2e2e41];return _0x266226;};'use strict';var _=require(_0xced3('0x0'));var utils=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xced3('0x4')),'mailMessage':require(_0xced3('0x5')),'smsMessage':require(_0xced3('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xced3('0x7')]=function(_0x1ada18,_0x2f92f8){return function(_0x1cd694){try{var _0x4795cd={'body':utils['getMustacheRender'](_0x2f92f8[0x0],this),'ContactId':this['contact']['id']};if(this[_0xced3('0x8')]==='chat'){_0x4795cd['ChatWebsiteId']=this['account']['id'];}else{_0x4795cd[_[_0xced3('0x9')](this[_0xced3('0x8')])+_0xced3('0xa')]=this[_0xced3('0xb')]['id'];}_0x4795cd[_[_0xced3('0x9')](this['channel'])+_0xced3('0xc')]=this[_0xced3('0xd')]['id'];if(rpc[this[_0xced3('0x8')]+'Message']){return rpc[this[_0xced3('0x8')]+_0xced3('0xe')][_0xced3('0xf')](_0x4795cd)[_0xced3('0x10')](function(_0x457caf){logger[_0xced3('0x11')](_0xced3('0x12'),_0x1ada18,_0x4795cd['body']);_0x1cd694[_0xced3('0x13')]();})['catch'](function(_0xf2db6f){logger[_0xced3('0x14')](_0xced3('0x12'),_0x1ada18,JSON[_0xced3('0x15')](_0xf2db6f));_0x1cd694['stop']();});}}catch(_0x146a21){logger[_0xced3('0x14')]('[%s][MESSAGE]\x20%s',_0x1ada18,JSON[_0xced3('0x15')](_0x146a21));_0x1cd694[_0xced3('0x16')]();}};}; \ No newline at end of file +var _0x2bb0=['create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x2bb0,0xf3));var _0x02bb=function(_0x2ca5b2,_0x147aab){_0x2ca5b2=_0x2ca5b2-0x0;var _0xb7e5ef=_0x2bb0[_0x2ca5b2];return _0xb7e5ef;};'use strict';var _=require(_0x02bb('0x0'));var utils=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('routing');var rpc={'chatMessage':require(_0x02bb('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x02bb('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x02bb('0x5'))};exports[_0x02bb('0x6')]=function(_0x8e4057,_0x390ff7){return function(_0x43dbb7){try{var _0x16bb7c={'body':utils[_0x02bb('0x7')](_0x390ff7[0x0],this),'ContactId':this['contact']['id']};if(this[_0x02bb('0x8')]===_0x02bb('0x9')){_0x16bb7c[_0x02bb('0xa')]=this['account']['id'];}else{_0x16bb7c[_[_0x02bb('0xb')](this['channel'])+_0x02bb('0xc')]=this[_0x02bb('0xd')]['id'];}_0x16bb7c[_['upperFirst'](this[_0x02bb('0x8')])+_0x02bb('0xe')]=this[_0x02bb('0xf')]['id'];if(rpc[this['channel']+_0x02bb('0x10')]){return rpc[this['channel']+_0x02bb('0x10')][_0x02bb('0x11')](_0x16bb7c)[_0x02bb('0x12')](function(_0x5c8728){logger[_0x02bb('0x13')](_0x02bb('0x14'),_0x8e4057,_0x16bb7c[_0x02bb('0x15')]);_0x43dbb7['next']();})[_0x02bb('0x16')](function(_0x55ec40){logger[_0x02bb('0x17')](_0x02bb('0x14'),_0x8e4057,JSON[_0x02bb('0x18')](_0x55ec40));_0x43dbb7[_0x02bb('0x19')]();});}}catch(_0x264ef4){logger[_0x02bb('0x17')]('[%s][MESSAGE]\x20%s',_0x8e4057,JSON['stringify'](_0x264ef4));_0x43dbb7[_0x02bb('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 738ffac..d145196 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 _0xf696=['consequence','info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger'];(function(_0x58a91a,_0x451667){var _0x50f5fb=function(_0x23fc2f){while(--_0x23fc2f){_0x58a91a['push'](_0x58a91a['shift']());}};_0x50f5fb(++_0x451667);}(_0xf696,0x142));var _0x6f69=function(_0x589518,_0x3d17f3){_0x589518=_0x589518-0x0;var _0xfa3a17=_0xf696[_0x589518];return _0xfa3a17;};'use strict';var utils=require(_0x6f69('0x0'));var logger=require(_0x6f69('0x1'))('routing');exports[_0x6f69('0x2')]=function(_0x171b84,_0x509309){return function(_0x46dccd){try{logger[_0x6f69('0x3')]('[%s][NOOP]\x20%s',_0x171b84,utils[_0x6f69('0x4')](_0x509309[0x0],this));_0x46dccd['next']();}catch(_0x169d5f){logger[_0x6f69('0x5')](_0x6f69('0x6'),_0x171b84,JSON[_0x6f69('0x7')](_0x169d5f));_0x46dccd[_0x6f69('0x8')]();}};}; \ No newline at end of file +var _0x8a45=['[%s][NOOP]\x20%s','getMustacheRender','next','stop','../../../../config/logger','routing','info'];(function(_0x3a8d27,_0x555172){var _0x4daf4f=function(_0x57f758){while(--_0x57f758){_0x3a8d27['push'](_0x3a8d27['shift']());}};_0x4daf4f(++_0x555172);}(_0x8a45,0x66));var _0x58a4=function(_0x1cf7a6,_0x3c2961){_0x1cf7a6=_0x1cf7a6-0x0;var _0x331010=_0x8a45[_0x1cf7a6];return _0x331010;};'use strict';var utils=require('./utils');var logger=require(_0x58a4('0x0'))(_0x58a4('0x1'));exports['consequence']=function(_0x4d3741,_0x2f1a54){return function(_0x278730){try{logger[_0x58a4('0x2')](_0x58a4('0x3'),_0x4d3741,utils[_0x58a4('0x4')](_0x2f1a54[0x0],this));_0x278730[_0x58a4('0x5')]();}catch(_0x32b542){logger['error'](_0x58a4('0x3'),_0x4d3741,JSON['stringify'](_0x32b542));_0x278730[_0x58a4('0x6')]();}};}; \ 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 ad7ecd2..fbb2eef 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 _0x4e95=['util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','message','chat','AccountId','name','QueueReport','create','catch','error','accepted','info','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0x4e95,0xe0));var _0x54e9=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x4e95[_0x2b9b7f];return _0x4ed19a;};'use strict';var schema=require('validate');var _=require(_0x54e9('0x0'));var util=require(_0x54e9('0x1'));var seqqueue=require(_0x54e9('0x2'));var moment=require('moment');var Redis=require(_0x54e9('0x3'));var config=require(_0x54e9('0x4'));var logger=require(_0x54e9('0x5'))(_0x54e9('0x6'));var strategy=require(_0x54e9('0x7'));config['redis']=_['defaults'](config[_0x54e9('0x8')],{'host':_0x54e9('0x9'),'port':0x18eb});var io=require(_0x54e9('0xa'))(new Redis(config['redis']));var attributes=['id',_0x54e9('0xb'),_0x54e9('0xc'),_0x54e9('0xd'),_0x54e9('0xe'),_0x54e9('0xf')];function emit(_0x2ceae7,_0x234f7c,_0x138cfd){io['to'](_0x2ceae7)['emit'](_0x234f7c,_0x138cfd);}function emitChannelQueueInteraction(_0x2c71fb,_0x451df7,_0x5f2ad0,_0x496b9d,_0x47f0e2,_0x5bbbf2,_0x240def,_0xfa593d){var _0x1a5503=_[_0x54e9('0x10')](_0x5f2ad0);_0x1a5503['queue_id']=_0xfa593d;_0x1a5503[_0x54e9('0xd')]=_0x451df7;_0x1a5503[_0x54e9('0xc')]=_0x496b9d;_0x1a5503['id']=_0x47f0e2;if(_0x5bbbf2){_0x240def[util['format']('%sQueuesWaitingInteractions',_0x2c71fb)][_0x47f0e2]=_[_0x54e9('0x11')](_0x1a5503,attributes);}else{delete _0x240def[util[_0x54e9('0x12')](_0x54e9('0x13'),_0x2c71fb)][_0x47f0e2];}emit(util['format'](_0x54e9('0x14'),_0x2c71fb,_0x451df7),util[_0x54e9('0x12')](_0x54e9('0x15'),_0x2c71fb,_0x5bbbf2?_0x54e9('0x16'):_0x54e9('0x17')),_[_0x54e9('0x11')](_0x1a5503,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x54e9('0x18')),'chatQueueReport':require(_0x54e9('0x19')),'smsQueueReport':require(_0x54e9('0x1a')),'faxQueueReport':require(_0x54e9('0x1b')),'whatsappQueueReport':require(_0x54e9('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x54e9('0x1d')},'timeout':{'type':_0x54e9('0x1e'),'message':_0x54e9('0x1f')}});function startRouting(_0x5c5792,_0x2a04fb,_0x22f4af,_0x408e5e){if(_0x5c5792&&_0x2a04fb&&_0x22f4af){_0x2a04fb[_0x54e9('0x20')]+=0x1;var _0x40a8f6={'uniqueid':_0x5c5792,'from':_0x22f4af[_0x54e9('0x21')]?_0x22f4af['body']['from']:'','joinAt':moment()[_0x54e9('0x12')](_0x54e9('0x22')),'ContactId':_0x22f4af[_0x54e9('0x23')]?_0x22f4af['contact']['id']:null,'ListId':_0x22f4af[_0x54e9('0x24')]?_0x22f4af[_0x54e9('0x24')]['id']:null};_0x40a8f6[_[_0x54e9('0x25')](_0x22f4af['channel'])+_0x54e9('0x26')]=_0x2a04fb['id']||null;_0x40a8f6[_[_0x54e9('0x25')](_0x22f4af[_0x54e9('0x27')])+'InteractionId']=_0x22f4af[_0x54e9('0x28')]?_0x22f4af[_0x54e9('0x28')]['id']:null;_0x40a8f6[_['upperFirst'](_0x22f4af[_0x54e9('0x27')])+'MessageId']=_0x22f4af[_0x54e9('0x29')]?_0x22f4af[_0x54e9('0x29')]['id']:null;_0x40a8f6[_[_0x54e9('0x25')](_0x22f4af[_0x54e9('0x27')])+(_0x22f4af[_0x54e9('0x27')]!==_0x54e9('0x2a')?_0x54e9('0x2b'):'WebsiteId')]=_0x22f4af[_0x54e9('0xc')]?_0x22f4af['account']['id']:null;logger['info'](util[_0x54e9('0x12')]('[%s][START:QUEUE][NAME:%s]',_0x5c5792,_0x2a04fb[_0x54e9('0x2c')]));emitChannelQueueInteraction(_0x22f4af[_0x54e9('0x27')],_0x2a04fb[_0x54e9('0x2c')],_0x40a8f6,_0x22f4af[_0x54e9('0xc')][_0x54e9('0x2c')],_0x22f4af[_0x54e9('0x29')]['id'],!![],_0x408e5e,_0x2a04fb['id']);if(rpc[_0x22f4af[_0x54e9('0x27')]+_0x54e9('0x2d')]){return rpc[_0x22f4af[_0x54e9('0x27')]+'QueueReport'][_0x54e9('0x2e')](_0x40a8f6)[_0x54e9('0x2f')](function(_0x10e429){logger[_0x54e9('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0x3bf52b,_0x5a7564,_0x2cb9e8,_0x366196){if(_0x3bf52b&&_0x5a7564){_0x5a7564[_0x54e9('0x20')]-=0x1;var _0x276a9c={'leaveAt':moment()['format'](_0x54e9('0x22')),'acceptAt':moment()[_0x54e9('0x12')](_0x54e9('0x22')),'reason':_0x54e9('0x31')};logger[_0x54e9('0x32')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x3bf52b,_0x5a7564[_0x54e9('0x2c')]));emitChannelQueueInteraction(_0x2cb9e8[_0x54e9('0x27')],_0x5a7564[_0x54e9('0x2c')],_0x2cb9e8[_0x54e9('0x21')],_0x2cb9e8[_0x54e9('0xc')][_0x54e9('0x2c')],_0x2cb9e8[_0x54e9('0x29')]['id'],![],_0x366196,_0x5a7564['id']);if(rpc[_0x2cb9e8['channel']+_0x54e9('0x2d')]){return rpc[_0x2cb9e8['channel']+'QueueReport'][_0x54e9('0x33')](_0x3bf52b,_0x276a9c)[_0x54e9('0x2f')](function(_0x4dea02){logger[_0x54e9('0x30')](_0x54e9('0x34'));});}}}function endRouting(_0x4935c3,_0x2898ad,_0x480ec3,_0x1bed92){if(_0x4935c3&&_0x2898ad){_0x2898ad[_0x54e9('0x20')]-=0x1;var _0x45b333={'leaveAt':moment()['format'](_0x54e9('0x22')),'exitAt':moment()[_0x54e9('0x12')](_0x54e9('0x22')),'reason':'timeout'};logger[_0x54e9('0x32')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x4935c3,_0x2898ad[_0x54e9('0x2c')]));emitChannelQueueInteraction(_0x480ec3[_0x54e9('0x27')],_0x2898ad[_0x54e9('0x2c')],_0x480ec3[_0x54e9('0x21')],_0x480ec3[_0x54e9('0xc')]['name'],_0x480ec3['message']['id'],![],_0x1bed92);if(rpc[_0x480ec3[_0x54e9('0x27')]+'QueueReport']){return rpc[_0x480ec3[_0x54e9('0x27')]+_0x54e9('0x2d')]['update'](_0x4935c3,_0x45b333)[_0x54e9('0x2f')](function(_0x5f22a4){logger[_0x54e9('0x30')](_0x54e9('0x34'));});}}}function handleFindQueue(_0x16a0fa){return function(_0x525f23){return _0x525f23[_0x54e9('0x2c')]['toLowerCase']()===_0x16a0fa[_0x54e9('0x35')]();};}exports[_0x54e9('0x36')]=function(_0x473fe6,_0x4a77ea,_0x25b7d3,_0x22e2a2){return function(_0x16b3de){try{var _0x4b30ab={'name':_0x4a77ea[0x0],'timeout':_0x4a77ea[0x1]};var _0x438da5=queue['validate'](_0x4b30ab,{'typecast':!![]});if(_0x438da5[_0x54e9('0x37')]){logger[_0x54e9('0x30')](_0x54e9('0x38'),_0x473fe6,_[_0x54e9('0x39')](_0x438da5,_0x54e9('0x29'))[_0x54e9('0x3a')](',\x20'));_0x16b3de[_0x54e9('0x3b')]();}else{var _0x422959=_[_0x54e9('0x3c')](_0x25b7d3[_0x22e2a2[_0x54e9('0x27')]+_0x54e9('0x3d')],handleFindQueue(_0x4b30ab[_0x54e9('0x2c')]));if(_0x422959){startRouting(_0x473fe6,_0x422959,_0x22e2a2,_0x25b7d3);var _0x5a31cd=(_0x422959[_0x54e9('0x3e')]||0xa)*0x3e8;var _0x40e2d7=(_0x4b30ab[_0x54e9('0x3e')]||0x14)*0x3e8;var _0x72da7b,_0x578067;if(_0x5a31cd>_0x40e2d7){_0x40e2d7=_0x5a31cd;}var _0x27df2e=seqqueue[_0x54e9('0x3f')](_0x5a31cd);_0x27df2e['id']=_0x473fe6;_0x27df2e[_0x54e9('0x40')]=_0x5a31cd;_0x27df2e['qtimeout']=_0x40e2d7;_0x27df2e[_0x54e9('0x27')]=_0x22e2a2[_0x54e9('0x27')];_0x25b7d3[_0x54e9('0x41')][_0x473fe6]['on'](_0x54e9('0x42'),function(){logger[_0x54e9('0x32')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x473fe6);stopRouting(_0x473fe6,_0x422959,_0x22e2a2,_0x25b7d3);clearTimeout(_0x72da7b);_0x72da7b=undefined;_0x27df2e[_0x54e9('0x43')](!![]);if(_0x25b7d3['rules'][_0x473fe6]){delete _0x25b7d3[_0x54e9('0x41')][_0x473fe6];}_0x16b3de[_0x54e9('0x3b')]();});_0x25b7d3[_0x54e9('0x41')][_0x473fe6]['on']('complete',function(){if(_0x25b7d3[_0x54e9('0x41')][_0x473fe6]){delete _0x25b7d3['rules'][_0x473fe6];}});_0x72da7b=setTimeout(function(){logger[_0x54e9('0x32')](_0x54e9('0x44'),_0x473fe6);endRouting(_0x473fe6,_0x422959,_0x22e2a2,_0x25b7d3);clearTimeout(_0x72da7b);_0x27df2e[_0x54e9('0x43')](!![]);_0x16b3de[_0x54e9('0x45')]();},_0x40e2d7);switch(_0x422959[_0x54e9('0x46')]){case _0x54e9('0x47'):strategy[_0x54e9('0x47')](_0x27df2e,_0x422959,_0x25b7d3,_0x22e2a2);break;default:strategy['beepall'](_0x27df2e,_0x422959,_0x25b7d3,_0x22e2a2);}}else{logger['error'](_0x54e9('0x48'),_0x473fe6,_0x4b30ab[_0x54e9('0x2c')]);_0x16b3de[_0x54e9('0x3b')]();}}}catch(_0x1defac){console[_0x54e9('0x49')](_0x1defac);logger[_0x54e9('0x30')](_0x54e9('0x38'),_0x473fe6,_0x1defac[_0x54e9('0x4a')]);_0x16b3de[_0x54e9('0x3b')]();}};}; \ No newline at end of file +var _0x60e0=['complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','InteractionId','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close'];(function(_0x2922ac,_0x32c7f0){var _0x8cf28a=function(_0x5016ce){while(--_0x5016ce){_0x2922ac['push'](_0x2922ac['shift']());}};_0x8cf28a(++_0x32c7f0);}(_0x60e0,0x176));var _0x060e=function(_0x19c046,_0x2c4599){_0x19c046=_0x19c046-0x0;var _0x20eb0d=_0x60e0[_0x19c046];return _0x20eb0d;};'use strict';var schema=require(_0x060e('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x060e('0x1'));var moment=require('moment');var Redis=require(_0x060e('0x2'));var config=require(_0x060e('0x3'));var logger=require(_0x060e('0x4'))(_0x060e('0x5'));var strategy=require(_0x060e('0x6'));config['redis']=_[_0x060e('0x7')](config[_0x060e('0x8')],{'host':_0x060e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x060e('0xa'),_0x060e('0xb'),_0x060e('0xc'),_0x060e('0xd'),_0x060e('0xe')];function emit(_0x483a03,_0x57a343,_0x55bf0d){io['to'](_0x483a03)[_0x060e('0xf')](_0x57a343,_0x55bf0d);}function emitChannelQueueInteraction(_0x380e55,_0x3b2841,_0x554df9,_0x3a4ac4,_0x3d9f22,_0x68387f,_0x3d8030,_0x58bfed){var _0x7046f6=_['clone'](_0x554df9);_0x7046f6[_0x060e('0xa')]=_0x58bfed;_0x7046f6[_0x060e('0xc')]=_0x3b2841;_0x7046f6['account']=_0x3a4ac4;_0x7046f6['id']=_0x3d9f22;if(_0x68387f){_0x3d8030[util[_0x060e('0x10')](_0x060e('0x11'),_0x380e55)][_0x3d9f22]=_[_0x060e('0x12')](_0x7046f6,attributes);}else{delete _0x3d8030[util['format']('%sQueuesWaitingInteractions',_0x380e55)][_0x3d9f22];}emit(util[_0x060e('0x10')](_0x060e('0x13'),_0x380e55,_0x3b2841),util[_0x060e('0x10')](_0x060e('0x14'),_0x380e55,_0x68387f?_0x060e('0x15'):_0x060e('0x16')),_['pick'](_0x7046f6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x060e('0x17')),'chatQueueReport':require(_0x060e('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x060e('0x19'))};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 startRouting(_0x30afb0,_0x116cdd,_0x574cc4,_0x7c0b5f){if(_0x30afb0&&_0x116cdd&&_0x574cc4){_0x116cdd[_0x060e('0x1a')]+=0x1;var _0x48f050={'uniqueid':_0x30afb0,'from':_0x574cc4[_0x060e('0x1b')]?_0x574cc4[_0x060e('0x1b')][_0x060e('0xd')]:'','joinAt':moment()[_0x060e('0x10')](_0x060e('0x1c')),'ContactId':_0x574cc4['contact']?_0x574cc4['contact']['id']:null,'ListId':_0x574cc4['list']?_0x574cc4[_0x060e('0x1d')]['id']:null};_0x48f050[_['upperFirst'](_0x574cc4['channel'])+'QueueId']=_0x116cdd['id']||null;_0x48f050[_[_0x060e('0x1e')](_0x574cc4[_0x060e('0x1f')])+_0x060e('0x20')]=_0x574cc4['interaction']?_0x574cc4['interaction']['id']:null;_0x48f050[_[_0x060e('0x1e')](_0x574cc4[_0x060e('0x1f')])+_0x060e('0x21')]=_0x574cc4[_0x060e('0x22')]?_0x574cc4[_0x060e('0x22')]['id']:null;_0x48f050[_['upperFirst'](_0x574cc4[_0x060e('0x1f')])+(_0x574cc4[_0x060e('0x1f')]!==_0x060e('0x23')?_0x060e('0x24'):'WebsiteId')]=_0x574cc4[_0x060e('0xb')]?_0x574cc4[_0x060e('0xb')]['id']:null;logger[_0x060e('0x25')](util[_0x060e('0x10')](_0x060e('0x26'),_0x30afb0,_0x116cdd['name']));emitChannelQueueInteraction(_0x574cc4[_0x060e('0x1f')],_0x116cdd['name'],_0x48f050,_0x574cc4[_0x060e('0xb')][_0x060e('0x27')],_0x574cc4[_0x060e('0x22')]['id'],!![],_0x7c0b5f,_0x116cdd['id']);if(rpc[_0x574cc4['channel']+_0x060e('0x28')]){return rpc[_0x574cc4['channel']+_0x060e('0x28')][_0x060e('0x29')](_0x48f050)[_0x060e('0x2a')](function(_0x58baba){logger['error'](_0x060e('0x2b'));});}}}function stopRouting(_0x45015b,_0x131f69,_0x1d4ada,_0x234031){if(_0x45015b&&_0x131f69){_0x131f69['waiting']-=0x1;var _0x52269a={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x060e('0x10')](_0x060e('0x1c')),'reason':'accepted'};logger[_0x060e('0x25')](util[_0x060e('0x10')](_0x060e('0x2c'),_0x45015b,_0x131f69['name']));emitChannelQueueInteraction(_0x1d4ada[_0x060e('0x1f')],_0x131f69[_0x060e('0x27')],_0x1d4ada[_0x060e('0x1b')],_0x1d4ada['account']['name'],_0x1d4ada[_0x060e('0x22')]['id'],![],_0x234031,_0x131f69['id']);if(rpc[_0x1d4ada[_0x060e('0x1f')]+_0x060e('0x28')]){return rpc[_0x1d4ada[_0x060e('0x1f')]+_0x060e('0x28')][_0x060e('0x2d')](_0x45015b,_0x52269a)[_0x060e('0x2a')](function(_0x19f933){logger[_0x060e('0x2e')](_0x060e('0x2f'));});}}}function endRouting(_0x345e0c,_0x4dc7b6,_0x2f84a2,_0x58caec){if(_0x345e0c&&_0x4dc7b6){_0x4dc7b6[_0x060e('0x1a')]-=0x1;var _0x92a233={'leaveAt':moment()[_0x060e('0x10')](_0x060e('0x1c')),'exitAt':moment()[_0x060e('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x060e('0x30')};logger[_0x060e('0x25')](util[_0x060e('0x10')](_0x060e('0x31'),_0x345e0c,_0x4dc7b6[_0x060e('0x27')]));emitChannelQueueInteraction(_0x2f84a2['channel'],_0x4dc7b6[_0x060e('0x27')],_0x2f84a2['body'],_0x2f84a2[_0x060e('0xb')][_0x060e('0x27')],_0x2f84a2[_0x060e('0x22')]['id'],![],_0x58caec);if(rpc[_0x2f84a2[_0x060e('0x1f')]+_0x060e('0x28')]){return rpc[_0x2f84a2['channel']+_0x060e('0x28')][_0x060e('0x2d')](_0x345e0c,_0x92a233)['catch'](function(_0x3d8230){logger[_0x060e('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x510963){return function(_0xb321c4){return _0xb321c4[_0x060e('0x27')][_0x060e('0x32')]()===_0x510963['toLowerCase']();};}exports[_0x060e('0x33')]=function(_0xea30a2,_0x5a1fd1,_0x4ec6d2,_0x2f66fb){return function(_0x3abc4d){try{var _0xc907b3={'name':_0x5a1fd1[0x0],'timeout':_0x5a1fd1[0x1]};var _0x12bf15=queue[_0x060e('0x0')](_0xc907b3,{'typecast':!![]});if(_0x12bf15['length']){logger[_0x060e('0x2e')](_0x060e('0x34'),_0xea30a2,_[_0x060e('0x35')](_0x12bf15,_0x060e('0x22'))[_0x060e('0x36')](',\x20'));_0x3abc4d[_0x060e('0x37')]();}else{var _0x5ea331=_[_0x060e('0x38')](_0x4ec6d2[_0x2f66fb[_0x060e('0x1f')]+_0x060e('0x39')],handleFindQueue(_0xc907b3['name']));if(_0x5ea331){startRouting(_0xea30a2,_0x5ea331,_0x2f66fb,_0x4ec6d2);var _0x5b2708=(_0x5ea331[_0x060e('0x30')]||0xa)*0x3e8;var _0x58f994=(_0xc907b3['timeout']||0x14)*0x3e8;var _0xcc9cb,_0x33e3a1;if(_0x5b2708>_0x58f994){_0x58f994=_0x5b2708;}var _0x42e880=seqqueue[_0x060e('0x3a')](_0x5b2708);_0x42e880['id']=_0xea30a2;_0x42e880[_0x060e('0x3b')]=_0x5b2708;_0x42e880[_0x060e('0x3c')]=_0x58f994;_0x42e880[_0x060e('0x1f')]=_0x2f66fb[_0x060e('0x1f')];_0x4ec6d2[_0x060e('0x3d')][_0xea30a2]['on']('end',function(){logger[_0x060e('0x25')](_0x060e('0x3e'),_0xea30a2);stopRouting(_0xea30a2,_0x5ea331,_0x2f66fb,_0x4ec6d2);clearTimeout(_0xcc9cb);_0xcc9cb=undefined;_0x42e880[_0x060e('0x3f')](!![]);if(_0x4ec6d2[_0x060e('0x3d')][_0xea30a2]){delete _0x4ec6d2['rules'][_0xea30a2];}_0x3abc4d[_0x060e('0x37')]();});_0x4ec6d2['rules'][_0xea30a2]['on'](_0x060e('0x40'),function(){if(_0x4ec6d2[_0x060e('0x3d')][_0xea30a2]){delete _0x4ec6d2[_0x060e('0x3d')][_0xea30a2];}});_0xcc9cb=setTimeout(function(){logger[_0x060e('0x25')](_0x060e('0x41'),_0xea30a2);endRouting(_0xea30a2,_0x5ea331,_0x2f66fb,_0x4ec6d2);clearTimeout(_0xcc9cb);_0x42e880[_0x060e('0x3f')](!![]);_0x3abc4d[_0x060e('0x42')]();},_0x58f994);switch(_0x5ea331[_0x060e('0x43')]){case'rrmemory':strategy[_0x060e('0x44')](_0x42e880,_0x5ea331,_0x4ec6d2,_0x2f66fb);break;default:strategy[_0x060e('0x45')](_0x42e880,_0x5ea331,_0x4ec6d2,_0x2f66fb);}}else{logger[_0x060e('0x2e')](_0x060e('0x46'),_0xea30a2,_0xc907b3[_0x060e('0x27')]);_0x3abc4d[_0x060e('0x37')]();}}}catch(_0x1ad8df){console[_0x060e('0x47')](_0x1ad8df);logger[_0x060e('0x2e')]('[%s][QUEUE]\x20%s',_0xea30a2,_0x1ad8df[_0x060e('0x48')]);_0x3abc4d[_0x060e('0x37')]();}};}; \ 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 afaffce..96c9ef0 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 _0x3cd2=['busyQueue','showNotification','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agent','agents','channel','busy'];(function(_0x1b0597,_0xeffacc){var _0x2b6a2a=function(_0x4da070){while(--_0x4da070){_0x1b0597['push'](_0x1b0597['shift']());}};_0x2b6a2a(++_0xeffacc);}(_0x3cd2,0x11f));var _0x23cd=function(_0xc7c10e,_0x1fb74e){_0xc7c10e=_0xc7c10e-0x0;var _0x3c6224=_0x3cd2[_0xc7c10e];return _0x3c6224;};'use strict';var _=require(_0x23cd('0x0'));var uuid=require('uuid');var util=require(_0x23cd('0x1'));var logger=require(_0x23cd('0x2'))('routing');var Agent=function(_0x7e8be6,_0x384cfe,_0x2215e0,_0xc2babe){this[_0x23cd('0x3')]=uuid['v4']();this[_0x23cd('0x4')]=_0x7e8be6;this['agent']=_0x384cfe;this['realtime']=_0x2215e0;this[_0x23cd('0x5')]=_0xc2babe;this[_0x23cd('0x4')][_0x23cd('0x6')](this[_0x23cd('0x7')][_0x23cd('0x8')](this),this[_0x23cd('0x9')]['bind'](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x23cd('0x8')](this));this[_0x23cd('0x4')]['on'](_0x23cd('0xa'),this[_0x23cd('0xb')]['bind'](this));};Agent['prototype'][_0x23cd('0x6')]=function(){this[_0x23cd('0x4')][_0x23cd('0x6')](this['handleRun'][_0x23cd('0x8')](this),this[_0x23cd('0x9')][_0x23cd('0x8')](this));};Agent[_0x23cd('0xc')][_0x23cd('0xb')]=function(){this[_0x23cd('0x9')](!![]);};Agent[_0x23cd('0xc')]['handleRun']=function(_0x40936a){logger[_0x23cd('0xd')](_0x23cd('0xe'),this['squeue']['id'],this['agent']['id']);if(_[_0x23cd('0xf')](this[_0x23cd('0x10')]['agents'][this[_0x23cd('0x11')]['id']])){logger[_0x23cd('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x23cd('0x4')]['id'],this[_0x23cd('0x11')]['id']);setTimeout(this['push'][_0x23cd('0x8')](this),0x3e8);}else{if(this[_0x23cd('0x5')]['forcedOwnership']||util['isAgentAvailable'](this[_0x23cd('0x4')]['id'],this[_0x23cd('0x10')][_0x23cd('0x12')][this['agent']['id']],this['squeue'][_0x23cd('0x13')],![])){this[_0x23cd('0x10')]['agents'][this[_0x23cd('0x11')]['id']][_0x23cd('0x14')]=!![];this['realtime']['agents'][this[_0x23cd('0x11')]['id']][_0x23cd('0x15')]=undefined;util[_0x23cd('0x16')](this[_0x23cd('0x3')],this[_0x23cd('0x4')]['id'],this['realtime'][_0x23cd('0x12')][this[_0x23cd('0x11')]['id']],null,this[_0x23cd('0x5')]);util['writeLog'](this['squeue']['id'],this[_0x23cd('0x10')]['agents'][this[_0x23cd('0x11')]['id']],'RINGING'+(this[_0x23cd('0x5')][_0x23cd('0x17')]?':FORCED':''));}else{logger['info'](_0x23cd('0x18'),this[_0x23cd('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x23cd('0x6')][_0x23cd('0x8')](this),0x3e8);}}};Agent[_0x23cd('0xc')][_0x23cd('0x9')]=function(_0x148cfe){if(_[_0x23cd('0xf')](this[_0x23cd('0x10')][_0x23cd('0x12')][this[_0x23cd('0x11')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x23cd('0x4')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x23cd('0x4')]['id'],this['agent']['id']);util[_0x23cd('0x19')](this[_0x23cd('0x3')],this[_0x23cd('0x4')]['id'],this[_0x23cd('0x10')][_0x23cd('0x12')][this[_0x23cd('0x11')]['id']],null,this[_0x23cd('0x5')]);this['realtime'][_0x23cd('0x12')][this[_0x23cd('0x11')]['id']][_0x23cd('0x14')]=![];this[_0x23cd('0x10')][_0x23cd('0x12')][this['agent']['id']][_0x23cd('0x15')]=undefined;util['writeLog'](this['squeue']['id'],this[_0x23cd('0x10')][_0x23cd('0x12')][this[_0x23cd('0x11')]['id']],_0x148cfe?_0x23cd('0x1a'):'TIMEOUT');}if(!_0x148cfe){setTimeout(this[_0x23cd('0x6')]['bind'](this),0x3e8);}};function agent(_0x3ee167,_0x523fe3,_0x23fe8f,_0x254ef4){return new Agent(_0x3ee167,_0x523fe3,_0x23fe8f,_0x254ef4);}module[_0x23cd('0x1b')]=agent; \ No newline at end of file +var _0xe08f=['agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busyQueue','STOP','TIMEOUT','./util','../../../../../config/logger','routing','squeue'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xe08f,0x128));var _0xfe08=function(_0x38068c,_0x2491be){_0x38068c=_0x38068c-0x0;var _0x2c5ac6=_0xe08f[_0x38068c];return _0x2c5ac6;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xfe08('0x0'));var logger=require(_0xfe08('0x1'))(_0xfe08('0x2'));var Agent=function(_0x7207cc,_0x315a91,_0x456dbf,_0x6fc6e3){this['notificationId']=uuid['v4']();this[_0xfe08('0x3')]=_0x7207cc;this[_0xfe08('0x4')]=_0x315a91;this[_0xfe08('0x5')]=_0x456dbf;this[_0xfe08('0x2')]=_0x6fc6e3;this[_0xfe08('0x3')]['push'](this[_0xfe08('0x6')][_0xfe08('0x7')](this),this[_0xfe08('0x8')][_0xfe08('0x7')](this));this[_0xfe08('0x3')]['on'](_0xfe08('0x9'),this[_0xfe08('0x8')][_0xfe08('0x7')](this));this[_0xfe08('0x3')]['on'](_0xfe08('0xa'),this[_0xfe08('0xb')][_0xfe08('0x7')](this));};Agent[_0xfe08('0xc')][_0xfe08('0xd')]=function(){this[_0xfe08('0x3')]['push'](this['handleRun'][_0xfe08('0x7')](this),this['handleTimeout']['bind'](this));};Agent[_0xfe08('0xc')][_0xfe08('0xb')]=function(){this[_0xfe08('0x8')](!![]);};Agent[_0xfe08('0xc')]['handleRun']=function(_0x3070a8){logger[_0xfe08('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xfe08('0x3')]['id'],this[_0xfe08('0x4')]['id']);if(_[_0xfe08('0xf')](this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']])){logger[_0xfe08('0xe')](_0xfe08('0x11'),this[_0xfe08('0x3')]['id'],this[_0xfe08('0x4')]['id']);setTimeout(this[_0xfe08('0xd')][_0xfe08('0x7')](this),0x3e8);}else{if(this[_0xfe08('0x2')][_0xfe08('0x12')]||util['isAgentAvailable'](this[_0xfe08('0x3')]['id'],this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']],this[_0xfe08('0x3')][_0xfe08('0x13')],![])){this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']][_0xfe08('0x14')]=!![];this[_0xfe08('0x5')][_0xfe08('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0xfe08('0x15')](this[_0xfe08('0x16')],this[_0xfe08('0x3')]['id'],this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']],null,this[_0xfe08('0x2')]);util[_0xfe08('0x17')](this[_0xfe08('0x3')]['id'],this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']],_0xfe08('0x18')+(this[_0xfe08('0x2')]['forcedOwnership']?':FORCED':''));}else{logger[_0xfe08('0xe')](_0xfe08('0x19'),this[_0xfe08('0x3')]['id'],this[_0xfe08('0x4')]['id']);setTimeout(this[_0xfe08('0xd')][_0xfe08('0x7')](this),0x3e8);}}};Agent['prototype'][_0xfe08('0x8')]=function(_0x217490){if(_[_0xfe08('0xf')](this[_0xfe08('0x5')]['agents'][this[_0xfe08('0x4')]['id']])){return logger[_0xfe08('0xe')](_0xfe08('0x11'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xfe08('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xfe08('0x3')]['id'],this[_0xfe08('0x4')]['id']);util[_0xfe08('0x1a')](this[_0xfe08('0x16')],this['squeue']['id'],this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']],null,this[_0xfe08('0x2')]);this['realtime']['agents'][this[_0xfe08('0x4')]['id']][_0xfe08('0x14')]=![];this[_0xfe08('0x5')][_0xfe08('0x10')][this[_0xfe08('0x4')]['id']][_0xfe08('0x1b')]=undefined;util[_0xfe08('0x17')](this[_0xfe08('0x3')]['id'],this['realtime'][_0xfe08('0x10')][this['agent']['id']],_0x217490?_0xfe08('0x1c'):_0xfe08('0x1d'));}if(!_0x217490){setTimeout(this['push'][_0xfe08('0x7')](this),0x3e8);}};function agent(_0x3aa420,_0x2d6692,_0x5192d7,_0x55e362){return new Agent(_0x3aa420,_0x2d6692,_0x5192d7,_0x55e362);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index b8b805e..792b5e4 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 _0xa990=['handleRun','bind','handleTimeout','handleDrained','prototype','isNil','Agents','agents','channel','writeLog','RINGING','busy','busyQueue','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','notificationId','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','push'];(function(_0x41452f,_0x3e8a7d){var _0x1e1471=function(_0x37779b){while(--_0x37779b){_0x41452f['push'](_0x41452f['shift']());}};_0x1e1471(++_0x3e8a7d);}(_0xa990,0xc9));var _0x0a99=function(_0x1c1b9d,_0x483db6){_0x1c1b9d=_0x1c1b9d-0x0;var _0x2f0ad7=_0xa990[_0x1c1b9d];return _0x2f0ad7;};'use strict';var _=require(_0x0a99('0x0'));var uuid=require(_0x0a99('0x1'));var util=require(_0x0a99('0x2'));var logger=require(_0x0a99('0x3'))(_0x0a99('0x4'));var Beepall=function(_0x3d0232,_0x3a06c9,_0x394f1c,_0x4d4992){this['notificationId']=uuid['v4']();this[_0x0a99('0x5')]=_0x3d0232;this[_0x0a99('0x6')]=_0x3a06c9;this[_0x0a99('0x7')]=_0x394f1c;this[_0x0a99('0x4')]=_0x4d4992;this[_0x0a99('0x5')][_0x0a99('0x8')](this[_0x0a99('0x9')][_0x0a99('0xa')](this),this[_0x0a99('0xb')][_0x0a99('0xa')](this));this[_0x0a99('0x5')]['on']('timeout',this[_0x0a99('0xb')][_0x0a99('0xa')](this));this['squeue']['on']('drained',this[_0x0a99('0xc')][_0x0a99('0xa')](this));};Beepall[_0x0a99('0xd')][_0x0a99('0x8')]=function(){this[_0x0a99('0x5')]['push'](this[_0x0a99('0x9')][_0x0a99('0xa')](this),this['handleTimeout'][_0x0a99('0xa')](this));};Beepall[_0x0a99('0xd')][_0x0a99('0xc')]=function(_0x2bbf1a){this[_0x0a99('0xb')](!![]);};Beepall[_0x0a99('0xd')][_0x0a99('0x9')]=function(_0x2ff68d){var _0x4b6946=!![];if(!_['isNil'](this[_0x0a99('0x6')])&&!_[_0x0a99('0xe')](this[_0x0a99('0x6')]['Agents'])&&this[_0x0a99('0x6')]['Agents']['length']>0x0){for(var _0x20104c=0x0,_0x3bab16;_0x20104c0x0){for(var _0x412041=0x0,_0x72df;_0x4120410x0&&_0x12a2a5[_0x307888+'CurrentCapacity']>=_0x12a2a5[_0x307888+_0x2f07('0x23')]){writeLog(_0x2c495f,_0x12a2a5,_0x307888[_0x2f07('0x25')]()+_0x2f07('0x26'));return![];}}return!![];};exports[_0x2f07('0x27')]=function(_0x20e4f8,_0x139ea8,_0x787aad,_0xfc52cf,_0x3d7fff){return sendNotification(!![],_0x20e4f8,_0x139ea8,_0x787aad,_0xfc52cf,_0x3d7fff);};exports[_0x2f07('0x28')]=function(_0x3b4e2f,_0x279eb3,_0x4c607a,_0x1accef,_0x2b806a){return sendNotification(![],_0x3b4e2f,_0x279eb3,_0x4c607a,_0x1accef,_0x2b806a);};exports[_0x2f07('0x29')]=writeLog; \ No newline at end of file +var _0x323f=['getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','writeLog','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','\x20interaction','notificationSound','account','notificationShake','body','queue','msg'];(function(_0x128fbb,_0x5871ad){var _0x3ef4ae=function(_0x3f04be){while(--_0x3f04be){_0x128fbb['push'](_0x128fbb['shift']());}};_0x3ef4ae(++_0x5871ad);}(_0x323f,0x1ee));var _0xf323=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x323f[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var utils=require('../utils');var Mustache=require(_0xf323('0x1'));var Redis=require(_0xf323('0x2'));var config=require(_0xf323('0x3'));var logger=require(_0xf323('0x4'))(_0xf323('0x5'));config[_0xf323('0x6')]=_[_0xf323('0x7')](config[_0xf323('0x6')],{'host':_0xf323('0x8'),'port':0x18eb});var io=require(_0xf323('0x9'))(new Redis(config['redis']));function emit(_0xb9a667,_0x444cba,_0x1af70d){io['to'](_0xb9a667)[_0xf323('0xa')](_0x444cba,_0x1af70d);}function sendNotification(_0x8abeac,_0x3c416a,_0x105b93,_0x2b24a2,_0x10d1ff,_0x21e82e){io['to'](util[_0xf323('0xb')](_0xf323('0xc'),_0x2b24a2[_0xf323('0xd')]))[_0xf323('0xa')](_0xf323('0xe'),_0x2b24a2);var _0xb6ec37=_0x21e82e||{};var _0x11a363=_0x105b93['split']('.');var _0x1b6a09={'uniqueid':_0x3c416a,'channel':_0x11a363[0x0],'id':_0x11a363[0x1],'title':_0x11a363[0x0]+_0xf323('0xf'),'interactionId':_0x11a363[0x2],'queue':_0x10d1ff?_0x10d1ff[_0xf323('0xd')]:null,'sound':_0xb6ec37['account'][_0xf323('0x10')],'shake':_0xb6ec37[_0xf323('0x11')][_0xf323('0x12')]};try{if(!_0xb6ec37[_0xf323('0x13')]){_0xb6ec37[_0xf323('0x13')]={};}if(_0x10d1ff){_0xb6ec37[_0xf323('0x13')]['queue']=_0x10d1ff;}else if(_0xb6ec37['body'][_0xf323('0x14')]){delete _0xb6ec37[_0xf323('0x13')][_0xf323('0x14')];}_0x1b6a09[_0xf323('0x15')]=utils[_0xf323('0x16')](_0xb6ec37['account'][_0xf323('0x17')],_0xb6ec37);}catch(_0x1632ad){_0x1b6a09[_0xf323('0x15')]=_0xf323('0x18');logger['error'](util[_0xf323('0xb')](_0xf323('0x19'),_0x3c416a,_0x1632ad[_0xf323('0x1a')]));}io['to'](util[_0xf323('0xb')]('user:%s',_0x2b24a2[_0xf323('0xd')]))[_0xf323('0xa')](util['format'](_0xf323('0x1b'),_0x8abeac?_0xf323('0x1c'):_0xf323('0x1d')),_0x1b6a09);}function writeLog(_0x183ce0,_0x58e22b,_0xdc7891){return logger[_0xf323('0x1e')](util[_0xf323('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x183ce0,_0x58e22b[_0xf323('0xd')],_0xdc7891));}exports[_0xf323('0x1f')]=function(_0x3e1c49,_0x3450d6,_0x13ec1f,_0xa3362c){if(_0x3450d6[_0xf323('0x20')]){writeLog(_0x3e1c49,_0x3450d6,_0xf323('0x21'));return![];}if(!_0x3450d6[_0xf323('0x22')]){writeLog(_0x3e1c49,_0x3450d6,'OFFLINE');return![];}if(_0x3450d6[_0x13ec1f+_0xf323('0x23')]){writeLog(_0x3e1c49,_0x3450d6,_0xf323('0x24'));return![];}if(_0xa3362c&&_0x3450d6[_0xf323('0x25')](_0x13ec1f+_0xf323('0x26'))&&_0x3450d6[_0xf323('0x25')](_0x13ec1f+_0xf323('0x27'))){if(_0x3450d6[_0x13ec1f+'Capacity']>0x0&&_0x3450d6[_0x13ec1f+_0xf323('0x27')]>=_0x3450d6[_0x13ec1f+'Capacity']){writeLog(_0x3e1c49,_0x3450d6,_0x13ec1f[_0xf323('0x28')]()+_0xf323('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x46663b,_0x3c95ce,_0x2b6254,_0x3dcf65,_0x46e3b1){return sendNotification(!![],_0x46663b,_0x3c95ce,_0x2b6254,_0x3dcf65,_0x46e3b1);};exports['hideNotification']=function(_0x44c944,_0x34b536,_0x12c7d5,_0x30a5d7,_0x4260f3){return sendNotification(![],_0x44c944,_0x34b536,_0x12c7d5,_0x30a5d7,_0x4260f3);};exports[_0xf323('0x2a')]=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 d008b1e..1e83b58 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 _0x8b33=['[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0x8b33,0x134));var _0x38b3=function(_0x202c46,_0x2dd00a){_0x202c46=_0x202c46-0x0;var _0x13b503=_0x8b33[_0x202c46];return _0x13b503;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x38b3('0x0'));var utils=require(_0x38b3('0x1'));var logger=require(_0x38b3('0x2'))(_0x38b3('0x3'));var system=schema({'command':{'type':_0x38b3('0x4'),'required':!![],'message':_0x38b3('0x5')}});exports[_0x38b3('0x6')]=function(_0x762953,_0x2a4c0e){return function(_0x561d09){try{var _0x2c82b0={'command':_0x2a4c0e[0x0]};var _0x144886=system[_0x38b3('0x7')](_0x2c82b0,{'typecast':!![]});if(_0x144886[_0x38b3('0x8')]){logger[_0x38b3('0x9')](_0x38b3('0xa'),_0x762953,_[_0x38b3('0xb')](_0x144886,_0x38b3('0xc'))[_0x38b3('0xd')](',\x20'));logger[_0x38b3('0xe')](_0x38b3('0xf'),_0x762953);_0x561d09[_0x38b3('0x10')]();}else{var _0xbf447b=this;var _0x3d6130=utils['getMustacheRender'](_0x2a4c0e[0x0],this);logger['info'](_0x38b3('0x11'),_0x762953,_0x3d6130);sh['exec'](_['trim'](_0x3d6130),function(_0x3ac85b,_0x4deda4){logger[_0x38b3('0xe')](_0x38b3('0x12'),_0x762953,_0x3ac85b);if(_0x3ac85b==0x0){var _0x488001=_0x4deda4[_0x38b3('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x38b3('0x14')](_0x2a4c0e[0x1])||_['isEmpty'](_0x2a4c0e[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x762953);_0xbf447b[_0x38b3('0x15')][_0x2a4c0e[0x1]]=_0x488001;}else{logger[_0x38b3('0xe')](_0x38b3('0x16'),_0x762953,_0x2a4c0e[0x1],_0x488001);_0xbf447b[_0x38b3('0x15')][_0x2a4c0e[0x1]]=_0x488001;}}_0x561d09[_0x38b3('0x10')]();});}}catch(_0x618500){logger['error'](_0x38b3('0xa'),_0x762953,_[_0x38b3('0x17')](_0x618500)?JSON[_0x38b3('0x18')](_0x618500):_0x618500);logger[_0x38b3('0xe')](_0x38b3('0xf'),_0x762953);_0x561d09[_0x38b3('0x10')]();}};}; \ No newline at end of file +var _0xe5ec=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender'];(function(_0x37fdf9,_0xf43605){var _0xda938=function(_0x20d2da){while(--_0x20d2da){_0x37fdf9['push'](_0x37fdf9['shift']());}};_0xda938(++_0xf43605);}(_0xe5ec,0x1b4));var _0xce5e=function(_0x2b6b89,_0x172ec0){_0x2b6b89=_0x2b6b89-0x0;var _0x5aa6af=_0xe5ec[_0x2b6b89];return _0x5aa6af;};'use strict';var schema=require(_0xce5e('0x0'));var sh=require('shelljs');var _=require(_0xce5e('0x1'));var utils=require(_0xce5e('0x2'));var logger=require(_0xce5e('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xce5e('0x4')]=function(_0x29b62d,_0xc9c505){return function(_0xdb1d60){try{var _0x10d862={'command':_0xc9c505[0x0]};var _0x538418=system['validate'](_0x10d862,{'typecast':!![]});if(_0x538418[_0xce5e('0x5')]){logger[_0xce5e('0x6')](_0xce5e('0x7'),_0x29b62d,_[_0xce5e('0x8')](_0x538418,_0xce5e('0x9'))[_0xce5e('0xa')](',\x20'));logger[_0xce5e('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x29b62d);_0xdb1d60[_0xce5e('0xc')]();}else{var _0x36f6a8=this;var _0x59a2da=utils[_0xce5e('0xd')](_0xc9c505[0x0],this);logger[_0xce5e('0xb')](_0xce5e('0xe'),_0x29b62d,_0x59a2da);sh[_0xce5e('0xf')](_[_0xce5e('0x10')](_0x59a2da),function(_0x252b69,_0xcc395){logger[_0xce5e('0xb')](_0xce5e('0x11'),_0x29b62d,_0x252b69);if(_0x252b69==0x0){var _0x110202=_0xcc395[_0xce5e('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xce5e('0x13')](_0xc9c505[0x1])||_[_0xce5e('0x14')](_0xc9c505[0x1])){logger[_0xce5e('0xb')](_0xce5e('0x15'),_0x29b62d);_0x36f6a8[_0xce5e('0x16')][_0xc9c505[0x1]]=_0x110202;}else{logger[_0xce5e('0xb')](_0xce5e('0x17'),_0x29b62d,_0xc9c505[0x1],_0x110202);_0x36f6a8[_0xce5e('0x16')][_0xc9c505[0x1]]=_0x110202;}}_0xdb1d60[_0xce5e('0xc')]();});}}catch(_0x4677e5){logger[_0xce5e('0x6')](_0xce5e('0x7'),_0x29b62d,_['isObject'](_0x4677e5)?JSON[_0xce5e('0x18')](_0x4677e5):_0x4677e5);logger[_0xce5e('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x29b62d);_0xdb1d60[_0xce5e('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 c31e643..22f88ed 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 _0x054e=['lodash','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','[%s][TAG]\x20%s','isObject','validate'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x054e,0x9b));var _0xe054=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x054e[_0x4ed1d4];return _0x28e363;};'use strict';var schema=require(_0xe054('0x0'));var _=require(_0xe054('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe054('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe054('0x3')),'whatsappInteraction':require(_0xe054('0x4'))};var logger=require('../../../../config/logger')(_0xe054('0x5'));var tag=schema({'tag':{'type':_0xe054('0x6'),'required':!![],'message':_0xe054('0x7')}});exports[_0xe054('0x8')]=function(_0x53cd10,_0x20bde1,_0x2bde21,_0xf31d17){return function(_0x8f28d5){try{var _0x28e133={'tag':_0x20bde1[0x0]};var _0x449d03=tag[_0xe054('0x0')](_0x28e133,{'typecast':!![]});if(_0x449d03[_0xe054('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x53cd10,_['map'](_0x449d03,_0xe054('0xa'))[_0xe054('0xb')](',\x20'));logger['info'](_0xe054('0xc'),_0x53cd10);_0x8f28d5['next']();}else{var _0x214e3d={'ids':[_0x20bde1[0x0]]};if(rpc[_0xf31d17[_0xe054('0xd')]+_0xe054('0xe')]){rpc[_0xf31d17[_0xe054('0xd')]+'Interaction'][_0xe054('0xf')](_0xf31d17['interaction']['id'],_0x214e3d)[_0xe054('0x10')](function(_0x278e4c){logger[_0xe054('0x11')](_0xe054('0x12'),_0x53cd10,_0x20bde1[0x1],_0xf31d17[_0xe054('0xd')],_0xf31d17['interaction']['id']);})[_0xe054('0x13')](function(_0x6a0538){logger[_0xe054('0x14')]('[%s][TAG]\x20%s',_0x53cd10,JSON[_0xe054('0x15')](_0x6a0538));logger[_0xe054('0x11')](_0xe054('0xc'),_0x53cd10);})[_0xe054('0x16')](function(){_0x8f28d5[_0xe054('0x17')]();});}}}catch(_0x2c0c6d){logger['error'](_0xe054('0x18'),_0x53cd10,_[_0xe054('0x19')](_0x2c0c6d)?JSON[_0xe054('0x15')](_0x2c0c6d):_0x2c0c6d);logger[_0xe054('0x11')](_0xe054('0xc'),_0x53cd10);_0x8f28d5[_0xe054('0x17')]();}};}; \ No newline at end of file +var _0xb339=['routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x1b09c3,_0x482620){var _0x357179=function(_0xbee606){while(--_0xbee606){_0x1b09c3['push'](_0x1b09c3['shift']());}};_0x357179(++_0x482620);}(_0xb339,0x7b));var _0x9b33=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0xb339[_0x44c742];return _0x40fcf0;};'use strict';var schema=require(_0x9b33('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9b33('0x1')),'smsInteraction':require(_0x9b33('0x2')),'mailInteraction':require(_0x9b33('0x3')),'faxInteraction':require(_0x9b33('0x4')),'whatsappInteraction':require(_0x9b33('0x5'))};var logger=require(_0x9b33('0x6'))(_0x9b33('0x7'));var tag=schema({'tag':{'type':_0x9b33('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9b33('0x9')]=function(_0x2df9b0,_0x179ed3,_0x50de23,_0x3e44a7){return function(_0x527d56){try{var _0x39bef3={'tag':_0x179ed3[0x0]};var _0x3db8fc=tag['validate'](_0x39bef3,{'typecast':!![]});if(_0x3db8fc[_0x9b33('0xa')]){logger[_0x9b33('0xb')](_0x9b33('0xc'),_0x2df9b0,_[_0x9b33('0xd')](_0x3db8fc,_0x9b33('0xe'))[_0x9b33('0xf')](',\x20'));logger[_0x9b33('0x10')](_0x9b33('0x11'),_0x2df9b0);_0x527d56[_0x9b33('0x12')]();}else{var _0x1398ef={'ids':[_0x179ed3[0x0]]};if(rpc[_0x3e44a7[_0x9b33('0x13')]+'Interaction']){rpc[_0x3e44a7[_0x9b33('0x13')]+'Interaction'][_0x9b33('0x14')](_0x3e44a7['interaction']['id'],_0x1398ef)['then'](function(_0x490923){logger[_0x9b33('0x10')](_0x9b33('0x15'),_0x2df9b0,_0x179ed3[0x1],_0x3e44a7[_0x9b33('0x13')],_0x3e44a7[_0x9b33('0x16')]['id']);})[_0x9b33('0x17')](function(_0x2c35c0){logger['error'](_0x9b33('0xc'),_0x2df9b0,JSON[_0x9b33('0x18')](_0x2c35c0));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2df9b0);})[_0x9b33('0x19')](function(){_0x527d56[_0x9b33('0x12')]();});}}}catch(_0x663d63){logger[_0x9b33('0xb')]('[%s][TAG]\x20%s',_0x2df9b0,_['isObject'](_0x663d63)?JSON[_0x9b33('0x18')](_0x663d63):_0x663d63);logger['info'](_0x9b33('0x11'),_0x2df9b0);_0x527d56[_0x9b33('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 6cb0285..832fa1c 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 _0xb5f8=['routing','lodash','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','utf8','POST','application/json-rpc','then','parse','result','logged','&serviceId=','stringify','info','catch','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger'];(function(_0x4432c5,_0x425d80){var _0x292515=function(_0x41ed5d){while(--_0x41ed5d){_0x4432c5['push'](_0x4432c5['shift']());}};_0x292515(++_0x425d80);}(_0xb5f8,0x1c0));var _0x8b5f=function(_0x5576b5,_0x461662){_0x5576b5=_0x5576b5-0x0;var _0x2b3708=_0xb5f8[_0x5576b5];return _0x2b3708;};'use strict';var rp=require(_0x8b5f('0x0'));var logger=require(_0x8b5f('0x1'))(_0x8b5f('0x2'));var _=require(_0x8b5f('0x3'));var arr=[];exports['consequence']=function(_0x47431c,_0x2471b2){return function(_0x2aa543){var _0x321c4f=_0x2471b2[0xa];var _0x4f772d=_0x2471b2[0xb];var _0x3485de=_0x2471b2[0xc];var _0x1da05f=_0x2471b2[0xd];var _0x5abb51=_0x2471b2[0xe];var _0x5f0582=_0x2471b2[0xf]['replace'](/\n/g,_0x8b5f('0x4'));var _0x2fa3c6=_0x2471b2[0x10][_0x8b5f('0x5')](/\n/g,'\x20');if(!arr[_0x8b5f('0x6')](_0x4f772d)){arr[_0x8b5f('0x7')](_0x4f772d);var _0x49e83b=_0x2471b2[0x3];var _0xafb937=_0x2471b2[0x4];var _0x5b8ceb=_0x2471b2[0x1];var _0x439eda=_0x2471b2[0x0];var _0x1d6b68={};_0x1d6b68[_0x8b5f('0x8')]=_0x2471b2[0x8]+_0x8b5f('0x9')+_0x3485de+'|'+_0x321c4f+'|'+_0x1da05f+'|'+_0x4f772d+'|'+_0x5abb51;_0x1d6b68[_0x8b5f('0xa')]=_0x2471b2[0x7]+_0x8b5f('0x9')+_0x3485de+'|'+_0x321c4f+'|'+_0x1da05f+'|'+_0x4f772d+'|'+_0x5abb51+'|'+_0x5f0582+'|'+_0x2fa3c6;_0x1d6b68['title']=_0x2471b2[0x9];var _0x34acc7={};_0x34acc7[_0x8b5f('0xb')]=_0x8b5f('0xc');_0x34acc7[_0x8b5f('0xd')]='login';var _0x478a45=[];_0x478a45[_0x8b5f('0x7')](_0x2471b2[0x2]);_0x478a45['push'](_0x2471b2[0x5]);_0x478a45['push'](_0x2471b2[0x6]);_0x34acc7['params']=_0x478a45;_0x34acc7['id']=0x1;var _0x395a39=JSON['stringify'](_0x34acc7);var _0x557087={'encoding':_0x8b5f('0xe'),'method':_0x8b5f('0xf'),'timeout':0x2710,'url':_0x49e83b,'headers':{'Content-Type':_0x8b5f('0x10')},'body':_0x395a39};return rp(_0x557087)[_0x8b5f('0x11')](function(_0x4a586e){const _0xab45f2=JSON[_0x8b5f('0x12')](_0x4a586e);if(!_0xab45f2[_0x8b5f('0x13')][_0x8b5f('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xc5eb88=_0x4f772d;var _0x54b1a8='channelId='+_0x5b8ceb+_0x8b5f('0x15')+_0x439eda+'&sessionId='+_0xc5eb88+'&data='+JSON[_0x8b5f('0x16')](_0x1d6b68);var _0x54b818=_0xafb937+'?'+_0x54b1a8;return rp(_0x54b818);})[_0x8b5f('0x11')](function(_0x32f06e){logger[_0x8b5f('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x47431c,_0x32f06e);_0x2aa543['stop']();})[_0x8b5f('0x18')](function(_0xf4a8e){logger[_0x8b5f('0x19')](_0x8b5f('0x1a'),_0x47431c,_['isObject'](_0xf4a8e)?JSON['stringify'](_0xf4a8e):_0xf4a8e);_0x2aa543[_0x8b5f('0x1b')]();});}else{logger[_0x8b5f('0x17')](_0x8b5f('0x1c'),_0x47431c);_0x2aa543[_0x8b5f('0x1d')]();}};}; \ No newline at end of file +var _0x5961=['2.0','login','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc'];(function(_0x4ce713,_0x342695){var _0x5e9883=function(_0x47c394){while(--_0x47c394){_0x4ce713['push'](_0x4ce713['shift']());}};_0x5e9883(++_0x342695);}(_0x5961,0x150));var _0x1596=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x5961[_0xcfc44];return _0x307a25;};'use strict';var rp=require(_0x1596('0x0'));var logger=require(_0x1596('0x1'))(_0x1596('0x2'));var _=require(_0x1596('0x3'));var arr=[];exports[_0x1596('0x4')]=function(_0x47c472,_0xedce29){return function(_0x4f78c0){var _0x4fa35c=_0xedce29[0xa];var _0x4d93c1=_0xedce29[0xb];var _0x2a559b=_0xedce29[0xc];var _0xcdfcf=_0xedce29[0xd];var _0x5c6fec=_0xedce29[0xe];var _0x407da2=_0xedce29[0xf]['replace'](/\n/g,_0x1596('0x5'));var _0xc3b659=_0xedce29[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x1596('0x6')](_0x4d93c1)){arr[_0x1596('0x7')](_0x4d93c1);var _0x242c0a=_0xedce29[0x3];var _0x3ac028=_0xedce29[0x4];var _0x5f1e28=_0xedce29[0x1];var _0x5f4a2c=_0xedce29[0x0];var _0x503337={};_0x503337[_0x1596('0x8')]=_0xedce29[0x8]+_0x1596('0x9')+_0x2a559b+'|'+_0x4fa35c+'|'+_0xcdfcf+'|'+_0x4d93c1+'|'+_0x5c6fec;_0x503337['urlOnRing']=_0xedce29[0x7]+'?params='+_0x2a559b+'|'+_0x4fa35c+'|'+_0xcdfcf+'|'+_0x4d93c1+'|'+_0x5c6fec+'|'+_0x407da2+'|'+_0xc3b659;_0x503337[_0x1596('0xa')]=_0xedce29[0x9];var _0x397a2a={};_0x397a2a[_0x1596('0xb')]=_0x1596('0xc');_0x397a2a['method']=_0x1596('0xd');var _0x1b4de9=[];_0x1b4de9[_0x1596('0x7')](_0xedce29[0x2]);_0x1b4de9[_0x1596('0x7')](_0xedce29[0x5]);_0x1b4de9[_0x1596('0x7')](_0xedce29[0x6]);_0x397a2a['params']=_0x1b4de9;_0x397a2a['id']=0x1;var _0x11686c=JSON[_0x1596('0xe')](_0x397a2a);var _0x34a480={'encoding':_0x1596('0xf'),'method':_0x1596('0x10'),'timeout':0x2710,'url':_0x242c0a,'headers':{'Content-Type':_0x1596('0x11')},'body':_0x11686c};return rp(_0x34a480)[_0x1596('0x12')](function(_0x532806){const _0x2b730d=JSON[_0x1596('0x13')](_0x532806);if(!_0x2b730d[_0x1596('0x14')][_0x1596('0x15')]){throw new Error(_0x1596('0x16'));}var _0x2fc451=_0x4d93c1;var _0x18c61f='channelId='+_0x5f1e28+_0x1596('0x17')+_0x5f4a2c+'&sessionId='+_0x2fc451+_0x1596('0x18')+JSON[_0x1596('0xe')](_0x503337);var _0x1ade02=_0x3ac028+'?'+_0x18c61f;return rp(_0x1ade02);})['then'](function(_0xa552f8){logger['info'](_0x1596('0x19'),_0x47c472,_0xa552f8);_0x4f78c0['stop']();})[_0x1596('0x1a')](function(_0x9e1f){logger[_0x1596('0x1b')]('[%s][TVOX]\x20%s',_0x47c472,_[_0x1596('0x1c')](_0x9e1f)?JSON[_0x1596('0xe')](_0x9e1f):_0x9e1f);_0x4f78c0['stop']();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x47c472);_0x4f78c0['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index fa6c9c4..1f57fd1 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(_0x2bd98a,_0x79f146){var _0x43d6af=function(_0x2c3c94){while(--_0x2c3c94){_0x2bd98a['push'](_0x2bd98a['shift']());}};_0x43d6af(++_0x79f146);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x54cfa8,_0x38f0d9){var _0x5d90bb=function(_0x2c2a48){while(--_0x2c2a48){_0x54cfa8['push'](_0x54cfa8['shift']());}};_0x5d90bb(++_0x38f0d9);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8322d09..1902c81 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 _0x6282=['loggedIn','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','existsSync','join','app','.js','autoreply','appdata','split','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','emit','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','name','paused','mailQueues','available','waiting','openchannelQueues'];(function(_0x144fd5,_0x515a39){var _0x44d846=function(_0x5911d2){while(--_0x5911d2){_0x144fd5['push'](_0x144fd5['shift']());}};_0x44d846(++_0x515a39);}(_0x6282,0x76));var _0x2628=function(_0x3176e2,_0x272935){_0x3176e2=_0x3176e2-0x0;var _0x4622bf=_0x6282[_0x3176e2];return _0x4622bf;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var fs=require('fs');var jayson=require(_0x2628('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require(_0x2628('0x4'));var config=require(_0x2628('0x5'));var logger=require('../../../config/logger')(_0x2628('0x6'));var rpc={'openchannelQueueReport':require(_0x2628('0x7')),'mailQueueReport':require(_0x2628('0x8')),'chatQueueReport':require(_0x2628('0x9')),'smsQueueReport':require(_0x2628('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x2628('0xb'))};var RuleEngine=require(_0x2628('0xc'));function getId(_0x2170a7,_0xbae7c3,_0x3d320c){return util[_0x2628('0xd')](_0x2628('0xe'),_0x2170a7,_0xbae7c3||0x0,_0x3d320c||0x0);}function getIntervals(_0x1d12a5,_0x3f9015){var _0xd7d01=[];if(!_[_0x2628('0xf')](_0x3f9015[_0x2628('0x10')])&&!_[_0x2628('0xf')](_0x1d12a5[_0x3f9015[_0x2628('0x10')]])&&!_[_0x2628('0xf')](_0x1d12a5[_0x3f9015['IntervalId']]['Intervals'])){_0xd7d01=_[_0x2628('0x11')](_0x1d12a5[_0x3f9015[_0x2628('0x10')]][_0x2628('0x12')],_0x2628('0x13'));}else if(!_['isNil'](_0x3f9015['interval'])){_0xd7d01=[_0x3f9015[_0x2628('0x13')]];}return _0xd7d01;}exports[_0x2628('0x14')]=function(_0x4d2cfb){_0x4d2cfb[_0x2628('0x15')]={};return new BPromise(function(_0x2f59ca,_0x513aee){var _0x645884={'Start':function(_0x16e67a){var _0x457163=this;return new Promise(function(_0x4f418d,_0x13a728){if(_0x16e67a){try{var _0x1551e4=[];var _0x51df16=getId(_0x16e67a[_0x2628('0x16')],_0x16e67a['message']?_0x16e67a[_0x2628('0x17')]['id']:0x0,_0x16e67a[_0x2628('0x18')]?_0x16e67a['interaction']['id']:0x0);if(_0x16e67a[_0x2628('0x19')]&&_[_0x2628('0x1a')](_0x16e67a['applications'])&&_0x16e67a[_0x2628('0x19')]['length']){for(var _0x2066ec=0x0;_0x2066ec<_0x16e67a['applications']['length'];_0x2066ec+=0x1){var _0xcf0862=_0x16e67a[_0x2628('0x19')][_0x2066ec];if(fs[_0x2628('0x1b')](path[_0x2628('0x1c')](__dirname,_0x2628('0x19'),_0xcf0862[_0x2628('0x1d')]+_0x2628('0x1e')))){var _0x41c2ba=[];switch(_0xcf0862[_0x2628('0x1d')]['toLowerCase']()){case _0x2628('0x1f'):var _0x267647=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');if(_0x16e67a[_0x2628('0x16')]==='mail'){_0x41c2ba[_0x2628('0x22')](_0x267647[0x0]);_0x41c2ba[_0x2628('0x22')](_0x267647[0x1]);_0x41c2ba[_0x2628('0x22')](_0x267647[_0x2628('0x23')](0x2,_0x267647[_0x2628('0x24')])['join'](','));}else{_0x41c2ba['push'](_0x267647[0x0]);_0x41c2ba[_0x2628('0x22')](_0x267647[_0x2628('0x23')](0x1,_0x267647[_0x2628('0x24')])[_0x2628('0x1c')](','));}break;case _0x2628('0x25'):var _0x571711=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');_0x41c2ba[_0x2628('0x22')](_0x571711[0x0]);_0x41c2ba[_0x2628('0x22')](_0x571711[0x1]);_0x41c2ba[_0x2628('0x22')](_0x571711[_0x2628('0x23')](0x2,_0x571711['length'])['join'](','));break;case _0x2628('0x26'):var _0x29ffee=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');_0x41c2ba['push'](_0x29ffee[0x0]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x1]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x2]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x3]);_0x41c2ba[_0x2628('0x22')](_0x29ffee['slice'](0x4,_0x29ffee[_0x2628('0x24')])[_0x2628('0x1c')](','));break;case _0x2628('0x27'):var _0x19530e=_0xcf0862['appdata'][_0x2628('0x21')](',');_0x41c2ba[_0x2628('0x22')](_0x19530e[0x0]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x1]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x2]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x3]);_0x41c2ba[_0x2628('0x22')](_0x19530e[_0x2628('0x23')](0x4,_0x19530e[_0x2628('0x24')])[_0x2628('0x1c')](','));break;case'message':_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x20')]);break;case _0x2628('0x28'):_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x29')]);_0x41c2ba['push'](_0xcf0862['appdata']);break;case _0x2628('0x2a'):var _0x42930c=utils[_0x2628('0x2b')](_0x16e67a['account'][_0x2628('0x2c')],_0x16e67a);var _0x187327=_0xcf0862[_0x2628('0x20')]['split'](',');_0x41c2ba[_0x2628('0x22')](_0x187327[0x0]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x1]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x2]);_0x41c2ba['push'](_0x187327[0x3]);_0x41c2ba['push'](_0x187327[0x4]);_0x41c2ba['push'](_0x187327[0x5]);_0x41c2ba['push'](_0x187327[0x6]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x7]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x8]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x9]);_0x41c2ba['push'](_0x187327[0xa]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x18')]['id']);_0x41c2ba[_0x2628('0x22')](_0x16e67a['message']['id']);_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x2d')]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x18')][_0x2628('0x2e')]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x2f')]['body']);_0x41c2ba[_0x2628('0x22')](_0x42930c);break;default:_0x41c2ba=_[_0x2628('0xf')](_0xcf0862[_0x2628('0x20')])?[]:_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');}var _0x2bc23f={'id':util['format'](_0x2628('0x30'),_0x51df16,_0xcf0862['id'],_0xcf0862['app']),'condition':require(_0x2628('0x31'))[_0x2628('0x32')](_0x51df16,getIntervals(_0x4d2cfb[_0x2628('0x33')],_0xcf0862),_0x4d2cfb),'consequence':require(_0x2628('0x34')+_0xcf0862[_0x2628('0x1d')])['consequence'](_0x51df16,_0x41c2ba,_0x4d2cfb,_0x16e67a),'p':_0xcf0862[_0x2628('0x35')]||0x0};logger['info']('Push\x20new\x20rule',_0x2bc23f['id'],_0x2628('0x36'),getIntervals(_0x4d2cfb[_0x2628('0x33')],_0xcf0862)[_0x2628('0x1c')](_0x2628('0x37')));_0x1551e4[_0x2628('0x22')](_0x2bc23f);}else{logger['error'](_0x2628('0x38'),path[_0x2628('0x1c')](__dirname,_0x2628('0x19'),_0xcf0862[_0x2628('0x1d')]+_0x2628('0x1e')));}}_0x4d2cfb['rules'][_0x51df16]=new RuleEngine(_0x1551e4);_0x4d2cfb[_0x2628('0x15')][_0x51df16]['execute'](_0x16e67a,function(_0x39b67d){logger[_0x2628('0x39')](_0x2628('0x3a'),JSON[_0x2628('0x3b')](_0x39b67d['matchPath']));if(_0x4d2cfb['rules'][_0x51df16]){_0x4d2cfb[_0x2628('0x15')][_0x51df16][_0x2628('0x3c')]('complete');}});return _0x4f418d({'code':0xc8,'message':_0x16e67a});}else{logger[_0x2628('0x39')](_0x2628('0x3d'));return _0x4f418d({'code':0xc8,'message':_0x16e67a});}}catch(_0x39560e){logger[_0x2628('0x3e')](_0x39560e['stack']);return _0x13a728(_0x457163[_0x2628('0x3e')](0x1f4,_0x39560e));}}return _0x13a728(_0x2628('0x3f'));});},'AcceptMessage':function(_0x1a34ee){var _0x29847f=this;return new Promise(function(_0x166b92,_0xc7f79f){if(_0x1a34ee[_0x2628('0x40')]&&_0x1a34ee[_0x2628('0x40')]['id']){if(_0x4d2cfb['agents'][_0x1a34ee[_0x2628('0x40')]['id']]){_0x4d2cfb['agents'][_0x1a34ee[_0x2628('0x40')]['id']]['busy']=![];_0x4d2cfb[_0x2628('0x41')][_0x1a34ee[_0x2628('0x40')]['id']][_0x2628('0x42')]=undefined;}}if(_0x1a34ee[_0x2628('0x17')]&&_0x1a34ee[_0x2628('0x17')]['id']){try{var _0x4a60e0=getId(_0x1a34ee[_0x2628('0x16')],_0x1a34ee['message']?_0x1a34ee[_0x2628('0x17')]['id']:0x0,_0x1a34ee[_0x2628('0x18')]?_0x1a34ee[_0x2628('0x18')]['id']:0x0);if(_0x4d2cfb['rules'][_0x4a60e0]){_0x4d2cfb[_0x2628('0x15')][_0x4a60e0][_0x2628('0x3c')]('end');if(rpc[_0x1a34ee[_0x2628('0x16')]+_0x2628('0x43')]){rpc[_0x1a34ee[_0x2628('0x16')]+_0x2628('0x43')][_0x2628('0x44')](_0x4a60e0,{'UserId':_0x1a34ee['message'][_0x2628('0x45')]})['catch'](function(_0x307ab6){logger[_0x2628('0x3e')](_0x2628('0x46'));});}}return _0x166b92({'code':0xc8,'message':_0x1a34ee});}catch(_0x9ac767){logger[_0x2628('0x3e')](_0x9ac767[_0x2628('0x47')]);return _0xc7f79f(_0x29847f[_0x2628('0x3e')](0x1f4,_0x9ac767));}}logger['error'](_0x2628('0x48'));return _0xc7f79f(_0x29847f[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'RejectMessage':function(_0x403c78){var _0x1838c7=this;return new Promise(function(_0x426538,_0x1aa06a){if(_0x403c78[_0x2628('0x40')]&&_0x403c78[_0x2628('0x40')]['id']){try{if(_0x4d2cfb['agents'][_0x403c78['agent']['id']]){_0x4d2cfb[_0x2628('0x41')][_0x403c78[_0x2628('0x40')]['id']][_0x2628('0x49')]=![];_0x4d2cfb[_0x2628('0x41')][_0x403c78[_0x2628('0x40')]['id']]['busyQueue']=undefined;}return _0x426538({'code':0xc8,'message':_0x403c78});}catch(_0x5b8882){logger[_0x2628('0x3e')](_0x5b8882['stack']);return _0x1aa06a(_0x1838c7[_0x2628('0x3e')](0x1f4,_0x5b8882));}}logger[_0x2628('0x3e')](_0x2628('0x48'));return _0x1aa06a(_0x1838c7[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'AbandonInteraction':function(_0x2e677){var _0x158831=this;return new Promise(function(_0x35c19c,_0x227cba){if(_0x2e677[_0x2628('0x16')]&&_0x2e677[_0x2628('0x18')]&&_0x2e677[_0x2628('0x18')]['id']){try{var _0x8d450=getId(_0x2e677[_0x2628('0x16')],_0x2e677[_0x2628('0x17')]?_0x2e677[_0x2628('0x17')]['id']:0x0,_0x2e677[_0x2628('0x18')]?_0x2e677[_0x2628('0x18')]['id']:0x0);if(_0x4d2cfb[_0x2628('0x15')][_0x8d450]){_0x4d2cfb[_0x2628('0x15')][_0x8d450][_0x2628('0x3c')](_0x2628('0x4a'));}return _0x35c19c({'code':0xc8,'message':_0x2e677});}catch(_0x4af3ec){logger[_0x2628('0x3e')](_0x4af3ec[_0x2628('0x47')]);return _0x227cba(_0x158831['error'](0x1f4,_0x4af3ec));}}logger[_0x2628('0x3e')](_0x2628('0x48'));return _0x227cba(_0x158831[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'AgentCapacity':function(_0x13187b){var _0x12b166=this;return new Promise(function(_0x20ed7c,_0x167cd1){if(_0x4d2cfb['agents'][_0x2628('0x4b')](_0x13187b['id'])){for(var _0x38c0bc in _0x13187b[_0x2628('0x4c')]){if(_0x13187b['capacity'][_0x2628('0x4b')](_0x38c0bc)){if(_0x4d2cfb[_0x2628('0x41')][_0x13187b['id']][_0x2628('0x4b')](_0x38c0bc+_0x2628('0x4d'))){_0x4d2cfb[_0x2628('0x41')][_0x13187b['id']][_0x38c0bc+_0x2628('0x4d')]=parseInt(_0x13187b[_0x2628('0x4c')][_0x38c0bc],0xa);}}}_0x4d2cfb['agents'][_0x13187b['id']]['updateRealtime']();return _0x20ed7c({'code':0xc8,'message':_0x4d2cfb['agents'][_0x13187b['id']]});}else{return _0x167cd1(_0x12b166[_0x2628('0x3e')](0x1f4,_0x2628('0x4e')));}});},'Agents':function(_0x4ba90b){return new Promise(function(_0x1bbb9a,_0x36bcaf){var _0x35f400=_['values'](_0x4d2cfb['agents']);_0x1bbb9a({'count':_0x35f400['length'],'rows':_0x35f400});});},'ChatQueues':function(_0x54f9c0){return new Promise(function(_0x3a3477,_0x1d7ad0){var _0x160484=[];for(var _0x2e388b in _0x4d2cfb[_0x2628('0x4f')]){if(_0x4d2cfb['chatQueues']['hasOwnProperty'](_0x2e388b)){var _0x4c77a2=_0x4d2cfb[_0x2628('0x4f')][_0x2e388b];var _0xe5b565={'id':_0x4c77a2['id'],'available':_0x4c77a2['available'],'loggedIn':_0x4c77a2['loggedIn'],'name':_0x4c77a2[_0x2628('0x50')],'paused':_0x4c77a2[_0x2628('0x51')],'waiting':_0x4c77a2['waiting']};_0x160484[_0x2628('0x22')](_0xe5b565);}}_0x3a3477({'count':_0x160484[_0x2628('0x24')],'rows':_0x160484});});},'MailQueues':function(_0x4623f9){return new Promise(function(_0x49f25b,_0x5e987a){var _0xdbd0ef=[];for(var _0x16e88e in _0x4d2cfb['mailQueues']){if(_0x4d2cfb[_0x2628('0x52')][_0x2628('0x4b')](_0x16e88e)){var _0x13580f=_0x4d2cfb['mailQueues'][_0x16e88e];var _0x3f8c1f={'id':_0x13580f['id'],'available':_0x13580f[_0x2628('0x53')],'loggedIn':_0x13580f['loggedIn'],'name':_0x13580f[_0x2628('0x50')],'paused':_0x13580f[_0x2628('0x51')],'waiting':_0x13580f[_0x2628('0x54')]};_0xdbd0ef[_0x2628('0x22')](_0x3f8c1f);}}_0x49f25b({'count':_0xdbd0ef['length'],'rows':_0xdbd0ef});});},'OpenchannelQueues':function(_0x7fab14){return new Promise(function(_0xdfddbe,_0x2d7837){var _0x4a2190=[];for(var _0x5aae96 in _0x4d2cfb['openchannelQueues']){if(_0x4d2cfb[_0x2628('0x55')][_0x2628('0x4b')](_0x5aae96)){var _0x54f46f=_0x4d2cfb[_0x2628('0x55')][_0x5aae96];var _0x4a7008={'id':_0x54f46f['id'],'available':_0x54f46f['available'],'loggedIn':_0x54f46f[_0x2628('0x56')],'name':_0x54f46f[_0x2628('0x50')],'paused':_0x54f46f['paused'],'waiting':_0x54f46f[_0x2628('0x54')]};_0x4a2190[_0x2628('0x22')](_0x4a7008);}}_0xdfddbe({'count':_0x4a2190[_0x2628('0x24')],'rows':_0x4a2190});});},'SmsQueues':function(_0x21ecd2){return new Promise(function(_0x121435,_0x2957ff){var _0x59e8d0=[];for(var _0x35ad7c in _0x4d2cfb['smsQueues']){if(_0x4d2cfb[_0x2628('0x57')]['hasOwnProperty'](_0x35ad7c)){var _0x2ad999=_0x4d2cfb[_0x2628('0x57')][_0x35ad7c];var _0x24d571={'id':_0x2ad999['id'],'available':_0x2ad999[_0x2628('0x53')],'loggedIn':_0x2ad999[_0x2628('0x56')],'name':_0x2ad999[_0x2628('0x50')],'paused':_0x2ad999[_0x2628('0x51')],'waiting':_0x2ad999[_0x2628('0x54')]};_0x59e8d0[_0x2628('0x22')](_0x24d571);}}_0x121435({'count':_0x59e8d0[_0x2628('0x24')],'rows':_0x59e8d0});});},'FaxQueues':function(_0x2676ce){return new Promise(function(_0x3ce557,_0x37178e){var _0x254007=[];for(var _0x454497 in _0x4d2cfb['faxQueues']){if(_0x4d2cfb[_0x2628('0x58')][_0x2628('0x4b')](_0x454497)){var _0x443456=_0x4d2cfb[_0x2628('0x58')][_0x454497];var _0x20821e={'id':_0x443456['id'],'available':_0x443456[_0x2628('0x53')],'loggedIn':_0x443456[_0x2628('0x56')],'name':_0x443456[_0x2628('0x50')],'paused':_0x443456['paused'],'waiting':_0x443456[_0x2628('0x54')]};_0x254007['push'](_0x20821e);}}_0x3ce557({'count':_0x254007[_0x2628('0x24')],'rows':_0x254007});});},'WhatsappQueues':function(_0x548239){return new Promise(function(_0x307587,_0x40dad6){var _0x3e8898=[];for(var _0x42a309 in _0x4d2cfb[_0x2628('0x59')]){if(_0x4d2cfb['whatsappQueues'][_0x2628('0x4b')](_0x42a309)){var _0x343439=_0x4d2cfb[_0x2628('0x59')][_0x42a309];var _0x1c3e42={'id':_0x343439['id'],'available':_0x343439[_0x2628('0x53')],'loggedIn':_0x343439[_0x2628('0x56')],'name':_0x343439[_0x2628('0x50')],'paused':_0x343439[_0x2628('0x51')],'waiting':_0x343439[_0x2628('0x54')]};_0x3e8898[_0x2628('0x22')](_0x1c3e42);}}_0x307587({'count':_0x3e8898[_0x2628('0x24')],'rows':_0x3e8898});});},'ChatQueuesWaitingInteractions':function(_0x5c9a08){return new Promise(function(_0x9f9e0a,_0x4a6902){var _0x118d26=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5b')]);_0x9f9e0a({'count':_0x118d26[_0x2628('0x24')],'rows':_0x118d26});});},'MailQueuesWaitingInteractions':function(_0x4b5de9){return new Promise(function(_0x50032b,_0x4998dd){var _0x40478b=_['values'](_0x4d2cfb[_0x2628('0x5c')]);_0x50032b({'count':_0x40478b['length'],'rows':_0x40478b});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d98df){return new Promise(function(_0x2d294c,_0x2f1e8c){var _0x47f297=_[_0x2628('0x5a')](_0x4d2cfb['openchannelQueuesWaitingInteractions']);_0x2d294c({'count':_0x47f297['length'],'rows':_0x47f297});});},'SmsQueuesWaitingInteractions':function(_0xc9e57c){return new Promise(function(_0x1440f7,_0xbd2b20){var _0x28fdad=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5d')]);_0x1440f7({'count':_0x28fdad[_0x2628('0x24')],'rows':_0x28fdad});});},'FaxQueuesWaitingInteractions':function(_0x564619){return new Promise(function(_0x10c130,_0x245061){var _0x492a36=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5e')]);_0x10c130({'count':_0x492a36[_0x2628('0x24')],'rows':_0x492a36});});},'WhatsappQueuesWaitingInteractions':function(_0x3cb7f7){return new Promise(function(_0x581371,_0x28dc3b){var _0x4db794=_['values'](_0x4d2cfb[_0x2628('0x5f')]);_0x581371({'count':_0x4db794[_0x2628('0x24')],'rows':_0x4db794});});}};var _0x361b69=jayson[_0x2628('0x60')](_0x645884)[_0x2628('0x61')]();_0x361b69['on']('error',function(_0xfd6fdf){logger['error'](JSON[_0x2628('0x3b')](_0xfd6fdf));return _0x513aee(_0xfd6fdf);});_0x361b69[_0x2628('0x14')](0x232c,_0x2628('0x62'),function(){console[_0x2628('0x63')](_0x2628('0x64'),0x232c);return _0x2f59ca(_0x2628('0x65')+0x232c);});});}; \ No newline at end of file +var _0x4899=['openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','interaction','applications','length','existsSync','join','.js','app','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','message','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues'];(function(_0x1650ff,_0x1c1069){var _0x3b4bc4=function(_0x2d1384){while(--_0x2d1384){_0x1650ff['push'](_0x1650ff['shift']());}};_0x3b4bc4(++_0x1c1069);}(_0x4899,0x74));var _0x9489=function(_0x37b5cf,_0x38900b){_0x37b5cf=_0x37b5cf-0x0;var _0x44dec7=_0x4899[_0x37b5cf];return _0x44dec7;};'use strict';var _=require(_0x9489('0x0'));var util=require('util');var path=require(_0x9489('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x9489('0x2'));var uuid=require('uuid');var utils=require(_0x9489('0x3'));var config=require(_0x9489('0x4'));var logger=require(_0x9489('0x5'))(_0x9489('0x6'));var rpc={'openchannelQueueReport':require(_0x9489('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x9489('0x8')),'smsQueueReport':require(_0x9489('0x9')),'faxQueueReport':require(_0x9489('0xa')),'whatsappQueueReport':require(_0x9489('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x553c77,_0x1379eb,_0x5ec4cf){return util[_0x9489('0xc')](_0x9489('0xd'),_0x553c77,_0x1379eb||0x0,_0x5ec4cf||0x0);}function getIntervals(_0x52f169,_0x1dac7c){var _0x12480e=[];if(!_[_0x9489('0xe')](_0x1dac7c[_0x9489('0xf')])&&!_[_0x9489('0xe')](_0x52f169[_0x1dac7c[_0x9489('0xf')]])&&!_[_0x9489('0xe')](_0x52f169[_0x1dac7c[_0x9489('0xf')]]['Intervals'])){_0x12480e=_[_0x9489('0x10')](_0x52f169[_0x1dac7c[_0x9489('0xf')]][_0x9489('0x11')],'interval');}else if(!_['isNil'](_0x1dac7c[_0x9489('0x12')])){_0x12480e=[_0x1dac7c[_0x9489('0x12')]];}return _0x12480e;}exports[_0x9489('0x13')]=function(_0x4c3003){_0x4c3003[_0x9489('0x14')]={};return new BPromise(function(_0x51ecea,_0x3bbbf8){var _0x5d3c68={'Start':function(_0x98390b){var _0x18a0aa=this;return new Promise(function(_0x1cb631,_0x33c217){if(_0x98390b){try{var _0x424e63=[];var _0x4c1389=getId(_0x98390b[_0x9489('0x15')],_0x98390b['message']?_0x98390b['message']['id']:0x0,_0x98390b[_0x9489('0x16')]?_0x98390b[_0x9489('0x16')]['id']:0x0);if(_0x98390b[_0x9489('0x17')]&&_['isArray'](_0x98390b[_0x9489('0x17')])&&_0x98390b[_0x9489('0x17')]['length']){for(var _0x5347b2=0x0;_0x5347b2<_0x98390b[_0x9489('0x17')][_0x9489('0x18')];_0x5347b2+=0x1){var _0x362ec7=_0x98390b[_0x9489('0x17')][_0x5347b2];if(fs[_0x9489('0x19')](path[_0x9489('0x1a')](__dirname,_0x9489('0x17'),_0x362ec7['app']+_0x9489('0x1b')))){var _0x2f5535=[];switch(_0x362ec7[_0x9489('0x1c')]['toLowerCase']()){case _0x9489('0x1d'):var _0x105d2a=_0x362ec7[_0x9489('0x1e')][_0x9489('0x1f')](',');if(_0x98390b[_0x9489('0x15')]===_0x9489('0x20')){_0x2f5535['push'](_0x105d2a[0x0]);_0x2f5535[_0x9489('0x21')](_0x105d2a[0x1]);_0x2f5535[_0x9489('0x21')](_0x105d2a[_0x9489('0x22')](0x2,_0x105d2a[_0x9489('0x18')])[_0x9489('0x1a')](','));}else{_0x2f5535[_0x9489('0x21')](_0x105d2a[0x0]);_0x2f5535[_0x9489('0x21')](_0x105d2a[_0x9489('0x22')](0x1,_0x105d2a[_0x9489('0x18')])[_0x9489('0x1a')](','));}break;case _0x9489('0x23'):var _0x2f54e7=_0x362ec7[_0x9489('0x1e')][_0x9489('0x1f')](',');_0x2f5535[_0x9489('0x21')](_0x2f54e7[0x0]);_0x2f5535[_0x9489('0x21')](_0x2f54e7[0x1]);_0x2f5535['push'](_0x2f54e7[_0x9489('0x22')](0x2,_0x2f54e7['length'])['join'](','));break;case'dialogflowv2':var _0x42ff88=_0x362ec7[_0x9489('0x1e')]['split'](',');_0x2f5535[_0x9489('0x21')](_0x42ff88[0x0]);_0x2f5535[_0x9489('0x21')](_0x42ff88[0x1]);_0x2f5535[_0x9489('0x21')](_0x42ff88[0x2]);_0x2f5535['push'](_0x42ff88[0x3]);_0x2f5535['push'](_0x42ff88[_0x9489('0x22')](0x4,_0x42ff88['length'])[_0x9489('0x1a')](','));break;case _0x9489('0x24'):var _0x19d472=_0x362ec7[_0x9489('0x1e')][_0x9489('0x1f')](',');_0x2f5535['push'](_0x19d472[0x0]);_0x2f5535['push'](_0x19d472[0x1]);_0x2f5535[_0x9489('0x21')](_0x19d472[0x2]);_0x2f5535[_0x9489('0x21')](_0x19d472[0x3]);_0x2f5535[_0x9489('0x21')](_0x19d472['slice'](0x4,_0x19d472[_0x9489('0x18')])['join'](','));break;case _0x9489('0x25'):_0x2f5535[_0x9489('0x21')](_0x362ec7[_0x9489('0x1e')]);break;case _0x9489('0x26'):_0x2f5535['push'](_0x362ec7[_0x9489('0x27')]);_0x2f5535[_0x9489('0x21')](_0x362ec7[_0x9489('0x1e')]);break;case'tvox':var _0x2c101e=utils['getMustacheRender'](_0x98390b[_0x9489('0x28')][_0x9489('0x29')],_0x98390b);var _0x4c2f69=_0x362ec7[_0x9489('0x1e')][_0x9489('0x1f')](',');_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x0]);_0x2f5535['push'](_0x4c2f69[0x1]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x2]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x3]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x4]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x5]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x6]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x7]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x8]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0x9]);_0x2f5535[_0x9489('0x21')](_0x4c2f69[0xa]);_0x2f5535[_0x9489('0x21')](_0x98390b[_0x9489('0x16')]['id']);_0x2f5535[_0x9489('0x21')](_0x98390b[_0x9489('0x25')]['id']);_0x2f5535[_0x9489('0x21')](_0x362ec7[_0x9489('0x2a')]);_0x2f5535[_0x9489('0x21')](_0x98390b[_0x9489('0x16')][_0x9489('0x2b')]);_0x2f5535[_0x9489('0x21')](_0x98390b[_0x9489('0x2c')][_0x9489('0x2c')]);_0x2f5535[_0x9489('0x21')](_0x2c101e);break;default:_0x2f5535=_['isNil'](_0x362ec7['appdata'])?[]:_0x362ec7['appdata'][_0x9489('0x1f')](',');}var _0x28d721={'id':util[_0x9489('0xc')](_0x9489('0x2d'),_0x4c1389,_0x362ec7['id'],_0x362ec7[_0x9489('0x1c')]),'condition':require(_0x9489('0x2e'))[_0x9489('0x2f')](_0x4c1389,getIntervals(_0x4c3003[_0x9489('0x30')],_0x362ec7),_0x4c3003),'consequence':require(_0x9489('0x31')+_0x362ec7[_0x9489('0x1c')])[_0x9489('0x32')](_0x4c1389,_0x2f5535,_0x4c3003,_0x98390b),'p':_0x362ec7['priority']||0x0};logger[_0x9489('0x33')](_0x9489('0x34'),_0x28d721['id'],_0x9489('0x35'),getIntervals(_0x4c3003[_0x9489('0x30')],_0x362ec7)[_0x9489('0x1a')](_0x9489('0x36')));_0x424e63[_0x9489('0x21')](_0x28d721);}else{logger[_0x9489('0x37')](_0x9489('0x38'),path['join'](__dirname,_0x9489('0x17'),_0x362ec7[_0x9489('0x1c')]+_0x9489('0x1b')));}}_0x4c3003[_0x9489('0x14')][_0x4c1389]=new RuleEngine(_0x424e63);_0x4c3003[_0x9489('0x14')][_0x4c1389][_0x9489('0x39')](_0x98390b,function(_0xee4f6){logger['info'](_0x9489('0x3a'),JSON[_0x9489('0x3b')](_0xee4f6[_0x9489('0x3c')]));if(_0x4c3003[_0x9489('0x14')][_0x4c1389]){_0x4c3003[_0x9489('0x14')][_0x4c1389][_0x9489('0x3d')]('complete');}});return _0x1cb631({'code':0xc8,'message':_0x98390b});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x1cb631({'code':0xc8,'message':_0x98390b});}}catch(_0x23d298){logger[_0x9489('0x37')](_0x23d298[_0x9489('0x3e')]);return _0x33c217(_0x18a0aa[_0x9489('0x37')](0x1f4,_0x23d298));}}return _0x33c217(_0x9489('0x3f'));});},'AcceptMessage':function(_0x2a0f00){var _0x18aac0=this;return new Promise(function(_0x188f1a,_0x2d6f66){if(_0x2a0f00[_0x9489('0x40')]&&_0x2a0f00[_0x9489('0x40')]['id']){if(_0x4c3003[_0x9489('0x41')][_0x2a0f00[_0x9489('0x40')]['id']]){_0x4c3003['agents'][_0x2a0f00[_0x9489('0x40')]['id']][_0x9489('0x42')]=![];_0x4c3003[_0x9489('0x41')][_0x2a0f00[_0x9489('0x40')]['id']][_0x9489('0x43')]=undefined;}}if(_0x2a0f00['message']&&_0x2a0f00['message']['id']){try{var _0x131895=getId(_0x2a0f00[_0x9489('0x15')],_0x2a0f00[_0x9489('0x25')]?_0x2a0f00[_0x9489('0x25')]['id']:0x0,_0x2a0f00[_0x9489('0x16')]?_0x2a0f00[_0x9489('0x16')]['id']:0x0);if(_0x4c3003[_0x9489('0x14')][_0x131895]){_0x4c3003[_0x9489('0x14')][_0x131895][_0x9489('0x3d')](_0x9489('0x44'));if(rpc[_0x2a0f00[_0x9489('0x15')]+_0x9489('0x45')]){rpc[_0x2a0f00[_0x9489('0x15')]+_0x9489('0x45')][_0x9489('0x46')](_0x131895,{'UserId':_0x2a0f00[_0x9489('0x25')][_0x9489('0x47')]})[_0x9489('0x48')](function(_0x3be848){logger[_0x9489('0x37')](_0x9489('0x49'));});}}return _0x188f1a({'code':0xc8,'message':_0x2a0f00});}catch(_0x179b93){logger[_0x9489('0x37')](_0x179b93[_0x9489('0x3e')]);return _0x2d6f66(_0x18aac0[_0x9489('0x37')](0x1f4,_0x179b93));}}logger['error'](_0x9489('0x4a'));return _0x2d6f66(_0x18aac0[_0x9489('0x37')](0x1f4,_0x9489('0x4a')));});},'RejectMessage':function(_0x3b7023){var _0x4e91c3=this;return new Promise(function(_0x41331a,_0x1edcc1){if(_0x3b7023[_0x9489('0x40')]&&_0x3b7023['agent']['id']){try{if(_0x4c3003['agents'][_0x3b7023[_0x9489('0x40')]['id']]){_0x4c3003['agents'][_0x3b7023[_0x9489('0x40')]['id']]['busy']=![];_0x4c3003[_0x9489('0x41')][_0x3b7023[_0x9489('0x40')]['id']][_0x9489('0x43')]=undefined;}return _0x41331a({'code':0xc8,'message':_0x3b7023});}catch(_0x3b5b60){logger[_0x9489('0x37')](_0x3b5b60['stack']);return _0x1edcc1(_0x4e91c3['error'](0x1f4,_0x3b5b60));}}logger['error']('message\x20is\x20empty');return _0x1edcc1(_0x4e91c3['error'](0x1f4,_0x9489('0x4a')));});},'AbandonInteraction':function(_0x5d8390){var _0x56e6fd=this;return new Promise(function(_0x29c78f,_0x1adaa4){if(_0x5d8390[_0x9489('0x15')]&&_0x5d8390[_0x9489('0x16')]&&_0x5d8390[_0x9489('0x16')]['id']){try{var _0x27126e=getId(_0x5d8390[_0x9489('0x15')],_0x5d8390['message']?_0x5d8390[_0x9489('0x25')]['id']:0x0,_0x5d8390['interaction']?_0x5d8390[_0x9489('0x16')]['id']:0x0);if(_0x4c3003['rules'][_0x27126e]){_0x4c3003['rules'][_0x27126e][_0x9489('0x3d')](_0x9489('0x44'));}return _0x29c78f({'code':0xc8,'message':_0x5d8390});}catch(_0x45b0b6){logger[_0x9489('0x37')](_0x45b0b6[_0x9489('0x3e')]);return _0x1adaa4(_0x56e6fd[_0x9489('0x37')](0x1f4,_0x45b0b6));}}logger[_0x9489('0x37')](_0x9489('0x4a'));return _0x1adaa4(_0x56e6fd[_0x9489('0x37')](0x1f4,_0x9489('0x4a')));});},'AgentCapacity':function(_0x292ab1){var _0x2164d8=this;return new Promise(function(_0x2ae177,_0x5056e5){if(_0x4c3003[_0x9489('0x41')]['hasOwnProperty'](_0x292ab1['id'])){for(var _0x51466e in _0x292ab1[_0x9489('0x4b')]){if(_0x292ab1[_0x9489('0x4b')][_0x9489('0x4c')](_0x51466e)){if(_0x4c3003[_0x9489('0x41')][_0x292ab1['id']][_0x9489('0x4c')](_0x51466e+_0x9489('0x4d'))){_0x4c3003[_0x9489('0x41')][_0x292ab1['id']][_0x51466e+_0x9489('0x4d')]=parseInt(_0x292ab1[_0x9489('0x4b')][_0x51466e],0xa);}}}_0x4c3003[_0x9489('0x41')][_0x292ab1['id']][_0x9489('0x4e')]();return _0x2ae177({'code':0xc8,'message':_0x4c3003['agents'][_0x292ab1['id']]});}else{return _0x5056e5(_0x2164d8[_0x9489('0x37')](0x1f4,_0x9489('0x4f')));}});},'Agents':function(_0x56e3f9){return new Promise(function(_0x533e93,_0x4044cb){var _0x186608=_[_0x9489('0x50')](_0x4c3003[_0x9489('0x41')]);_0x533e93({'count':_0x186608[_0x9489('0x18')],'rows':_0x186608});});},'ChatQueues':function(_0x16f995){return new Promise(function(_0x203818,_0x19ee5c){var _0x5b6051=[];for(var _0x49487f in _0x4c3003[_0x9489('0x51')]){if(_0x4c3003[_0x9489('0x51')][_0x9489('0x4c')](_0x49487f)){var _0x2afe85=_0x4c3003['chatQueues'][_0x49487f];var _0xfdd005={'id':_0x2afe85['id'],'available':_0x2afe85[_0x9489('0x52')],'loggedIn':_0x2afe85[_0x9489('0x53')],'name':_0x2afe85[_0x9489('0x54')],'paused':_0x2afe85[_0x9489('0x55')],'waiting':_0x2afe85[_0x9489('0x56')]};_0x5b6051['push'](_0xfdd005);}}_0x203818({'count':_0x5b6051[_0x9489('0x18')],'rows':_0x5b6051});});},'MailQueues':function(_0x1d6f21){return new Promise(function(_0x2f2606,_0x2c9e30){var _0x266178=[];for(var _0x85a66 in _0x4c3003[_0x9489('0x57')]){if(_0x4c3003[_0x9489('0x57')]['hasOwnProperty'](_0x85a66)){var _0x495f03=_0x4c3003[_0x9489('0x57')][_0x85a66];var _0x7ca6aa={'id':_0x495f03['id'],'available':_0x495f03['available'],'loggedIn':_0x495f03[_0x9489('0x53')],'name':_0x495f03[_0x9489('0x54')],'paused':_0x495f03[_0x9489('0x55')],'waiting':_0x495f03[_0x9489('0x56')]};_0x266178[_0x9489('0x21')](_0x7ca6aa);}}_0x2f2606({'count':_0x266178[_0x9489('0x18')],'rows':_0x266178});});},'OpenchannelQueues':function(_0x1a57a4){return new Promise(function(_0x451bad,_0x1cafdb){var _0x2b06ef=[];for(var _0x5bc1e7 in _0x4c3003[_0x9489('0x58')]){if(_0x4c3003[_0x9489('0x58')][_0x9489('0x4c')](_0x5bc1e7)){var _0x1ffa4c=_0x4c3003[_0x9489('0x58')][_0x5bc1e7];var _0x547ad1={'id':_0x1ffa4c['id'],'available':_0x1ffa4c[_0x9489('0x52')],'loggedIn':_0x1ffa4c['loggedIn'],'name':_0x1ffa4c[_0x9489('0x54')],'paused':_0x1ffa4c[_0x9489('0x55')],'waiting':_0x1ffa4c['waiting']};_0x2b06ef[_0x9489('0x21')](_0x547ad1);}}_0x451bad({'count':_0x2b06ef['length'],'rows':_0x2b06ef});});},'SmsQueues':function(_0x445383){return new Promise(function(_0x1c350a,_0x56cb67){var _0x432705=[];for(var _0x3b4c09 in _0x4c3003[_0x9489('0x59')]){if(_0x4c3003['smsQueues'][_0x9489('0x4c')](_0x3b4c09)){var _0x723303=_0x4c3003[_0x9489('0x59')][_0x3b4c09];var _0x4cab9a={'id':_0x723303['id'],'available':_0x723303[_0x9489('0x52')],'loggedIn':_0x723303['loggedIn'],'name':_0x723303[_0x9489('0x54')],'paused':_0x723303[_0x9489('0x55')],'waiting':_0x723303[_0x9489('0x56')]};_0x432705[_0x9489('0x21')](_0x4cab9a);}}_0x1c350a({'count':_0x432705['length'],'rows':_0x432705});});},'FaxQueues':function(_0x73876b){return new Promise(function(_0x17a468,_0x226f89){var _0x1e288a=[];for(var _0x34c0e5 in _0x4c3003[_0x9489('0x5a')]){if(_0x4c3003[_0x9489('0x5a')][_0x9489('0x4c')](_0x34c0e5)){var _0x4707bf=_0x4c3003['faxQueues'][_0x34c0e5];var _0x1475ab={'id':_0x4707bf['id'],'available':_0x4707bf[_0x9489('0x52')],'loggedIn':_0x4707bf[_0x9489('0x53')],'name':_0x4707bf['name'],'paused':_0x4707bf[_0x9489('0x55')],'waiting':_0x4707bf['waiting']};_0x1e288a['push'](_0x1475ab);}}_0x17a468({'count':_0x1e288a[_0x9489('0x18')],'rows':_0x1e288a});});},'WhatsappQueues':function(_0x1f7ca4){return new Promise(function(_0x2205ca,_0x4a4844){var _0x2b7894=[];for(var _0x538e22 in _0x4c3003[_0x9489('0x5b')]){if(_0x4c3003[_0x9489('0x5b')][_0x9489('0x4c')](_0x538e22)){var _0x200da6=_0x4c3003[_0x9489('0x5b')][_0x538e22];var _0x171515={'id':_0x200da6['id'],'available':_0x200da6[_0x9489('0x52')],'loggedIn':_0x200da6['loggedIn'],'name':_0x200da6[_0x9489('0x54')],'paused':_0x200da6[_0x9489('0x55')],'waiting':_0x200da6[_0x9489('0x56')]};_0x2b7894[_0x9489('0x21')](_0x171515);}}_0x2205ca({'count':_0x2b7894[_0x9489('0x18')],'rows':_0x2b7894});});},'ChatQueuesWaitingInteractions':function(_0x113b81){return new Promise(function(_0x3e4d5e,_0x1e1e34){var _0x487c91=_['values'](_0x4c3003[_0x9489('0x5c')]);_0x3e4d5e({'count':_0x487c91[_0x9489('0x18')],'rows':_0x487c91});});},'MailQueuesWaitingInteractions':function(_0x39a7b4){return new Promise(function(_0x247c57,_0xe8e53d){var _0x2f7747=_[_0x9489('0x50')](_0x4c3003[_0x9489('0x5d')]);_0x247c57({'count':_0x2f7747['length'],'rows':_0x2f7747});});},'OpenchannelQueuesWaitingInteractions':function(_0x590ee1){return new Promise(function(_0x5906e8,_0x2c3243){var _0x56c45e=_[_0x9489('0x50')](_0x4c3003[_0x9489('0x5e')]);_0x5906e8({'count':_0x56c45e[_0x9489('0x18')],'rows':_0x56c45e});});},'SmsQueuesWaitingInteractions':function(_0x156075){return new Promise(function(_0x4616cd,_0xcab1c7){var _0x56e235=_[_0x9489('0x50')](_0x4c3003['smsQueuesWaitingInteractions']);_0x4616cd({'count':_0x56e235[_0x9489('0x18')],'rows':_0x56e235});});},'FaxQueuesWaitingInteractions':function(_0x389748){return new Promise(function(_0x2df324,_0x511350){var _0x1398c1=_[_0x9489('0x50')](_0x4c3003[_0x9489('0x5f')]);_0x2df324({'count':_0x1398c1[_0x9489('0x18')],'rows':_0x1398c1});});},'WhatsappQueuesWaitingInteractions':function(_0x1c7830){return new Promise(function(_0x2e1981,_0x196da8){var _0x297b7c=_[_0x9489('0x50')](_0x4c3003[_0x9489('0x60')]);_0x2e1981({'count':_0x297b7c[_0x9489('0x18')],'rows':_0x297b7c});});}};var _0x12ad3f=jayson[_0x9489('0x61')](_0x5d3c68)[_0x9489('0x62')]();_0x12ad3f['on'](_0x9489('0x37'),function(_0x3085d0){logger[_0x9489('0x37')](JSON[_0x9489('0x3b')](_0x3085d0));return _0x3bbbf8(_0x3085d0);});_0x12ad3f[_0x9489('0x13')](0x232c,_0x9489('0x63'),function(){console[_0x9489('0x64')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x51ecea(_0x9489('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4bda527..a57bf2e 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 _0xb195=['bluebird','lodash','../../../config/logger','routing','client','http','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0xb195,0x149));var _0x5b19=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb195[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0x5b19('0x0'));var BPromise=require(_0x5b19('0x1'));var jayson=require('jayson/promise');var _=require(_0x5b19('0x2'));var logger=require(_0x5b19('0x3'))(_0x5b19('0x4'));var client=jayson[_0x5b19('0x5')][_0x5b19('0x6')]({'port':0x232a});function request(_0x16df6c,_0x5972f0){return new BPromise(function(_0xb59d5c,_0x52e066){return client['request'](_0x16df6c,_0x5972f0)['then'](function(_0x589745){if(_0x589745[_0x5b19('0x7')]){return _0x52e066(_0x589745[_0x5b19('0x7')][_0x5b19('0x8')]);}else{return _0xb59d5c(_0x589745[_0x5b19('0x9')]);}})[_0x5b19('0xa')](function(_0x378433){return _0x52e066(_0x378433);});});}exports[_0x5b19('0xb')]=function(_0x47b1ab,_0x1e10f8,_0x35d595){return function(_0x327fea){if(_0x35d595['rules']&&!_0x35d595['rules'][_0x47b1ab]){logger[_0x5b19('0xc')](_0x5b19('0xd'),_0x47b1ab);return _0x327fea[_0x5b19('0xe')]();}var _0x2f6793=[];for(var _0xcf41b8=0x0;_0xcf41b8<_0x1e10f8[_0x5b19('0xf')];_0xcf41b8+=0x1){_0x2f6793['push'](request(_0x5b19('0x10'),{'command':util[_0x5b19('0x11')](_0x5b19('0x12'),_0x1e10f8[_0xcf41b8])})[_0x5b19('0x13')](function(_0x5cab4b){return _0x5cab4b&&_0x5cab4b['message']&&_0x5cab4b[_0x5b19('0x8')][_0x5b19('0x14')](_0x5b19('0x15'))>=0x0?!![]:![];})[_0x5b19('0xa')](function(_0x3d3f4f){logger['error'](_0x5b19('0x16'),_0x47b1ab,_0x1e10f8[_0xcf41b8]);}));}BPromise[_0x5b19('0x17')](_0x2f6793)[_0x5b19('0x13')](function(_0xad09d4){var _0x4b60a6=_[_0x5b19('0x18')](_0xad09d4);logger[_0x5b19('0xc')](_0x5b19('0x19'),_0x47b1ab,_0x1e10f8[_0x5b19('0x1a')]('\x20|\x20'),_0x4b60a6);_0x327fea[_0x5b19('0x1b')](_0x4b60a6);})[_0x5b19('0xa')](function(_0x518eb0){console['log'](_0x518eb0);logger[_0x5b19('0x7')](_0x5b19('0x19'),_0x47b1ab,_0x1e10f8[_0x5b19('0x1a')](_0x5b19('0x1c')),_0x518eb0[_0x5b19('0x1d')]);_0x327fea[_0x5b19('0xe')]();});};}; \ No newline at end of file +var _0x6359=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','util','bluebird','lodash','routing','client','http','request','then','error','message','condition','rules','info'];(function(_0x33beba,_0x39e91a){var _0xd0586a=function(_0x2d532d){while(--_0x2d532d){_0x33beba['push'](_0x33beba['shift']());}};_0xd0586a(++_0x39e91a);}(_0x6359,0x143));var _0x9635=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6359[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x9635('0x0'));var BPromise=require(_0x9635('0x1'));var jayson=require('jayson/promise');var _=require(_0x9635('0x2'));var logger=require('../../../config/logger')(_0x9635('0x3'));var client=jayson[_0x9635('0x4')][_0x9635('0x5')]({'port':0x232a});function request(_0x182e5a,_0x190c49){return new BPromise(function(_0x4b9b71,_0x2bdc43){return client[_0x9635('0x6')](_0x182e5a,_0x190c49)[_0x9635('0x7')](function(_0x540518){if(_0x540518[_0x9635('0x8')]){return _0x2bdc43(_0x540518[_0x9635('0x8')][_0x9635('0x9')]);}else{return _0x4b9b71(_0x540518['result']);}})['catch'](function(_0x3c6c70){return _0x2bdc43(_0x3c6c70);});});}exports[_0x9635('0xa')]=function(_0x84426e,_0x278f84,_0x34eda6){return function(_0x33524b){if(_0x34eda6[_0x9635('0xb')]&&!_0x34eda6[_0x9635('0xb')][_0x84426e]){logger[_0x9635('0xc')](_0x9635('0xd'),_0x84426e);return _0x33524b['stop']();}var _0x8137b5=[];for(var _0x2e3b44=0x0;_0x2e3b44<_0x278f84['length'];_0x2e3b44+=0x1){_0x8137b5[_0x9635('0xe')](request(_0x9635('0xf'),{'command':util[_0x9635('0x10')]('iftime\x20%s',_0x278f84[_0x2e3b44])})[_0x9635('0x7')](function(_0x225a5f){return _0x225a5f&&_0x225a5f[_0x9635('0x9')]&&_0x225a5f[_0x9635('0x9')][_0x9635('0x11')](_0x9635('0x12'))>=0x0?!![]:![];})[_0x9635('0x13')](function(_0xec5364){logger[_0x9635('0x8')](_0x9635('0x14'),_0x84426e,_0x278f84[_0x2e3b44]);}));}BPromise[_0x9635('0x15')](_0x8137b5)[_0x9635('0x7')](function(_0x65d966){var _0x5715b2=_[_0x9635('0x16')](_0x65d966);logger[_0x9635('0xc')](_0x9635('0x17'),_0x84426e,_0x278f84[_0x9635('0x18')](_0x9635('0x19')),_0x5715b2);_0x33524b[_0x9635('0x1a')](_0x5715b2);})[_0x9635('0x13')](function(_0x26f71c){console['log'](_0x26f71c);logger['error'](_0x9635('0x17'),_0x84426e,_0x278f84[_0x9635('0x18')](_0x9635('0x19')),_0x26f71c['stack']);_0x33524b[_0x9635('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f750afc..ae2aaa5 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 _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x216794,_0xca1003){var _0x573284=function(_0x738bb2){while(--_0x738bb2){_0x216794['push'](_0x216794['shift']());}};_0x573284(++_0xca1003);}(_0x76dc,0x1f2));var _0xc76d=function(_0xbcb76b,_0x4d54dd){_0xbcb76b=_0xbcb76b-0x0;var _0xfb9758=_0x76dc[_0xbcb76b];return _0xfb9758;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file +var _0x16d2=['blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','called','connectedlinename','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','timeout','holdtime','ringtime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x16d2,0x123));var _0x216d=function(_0x2a0bf0,_0x247ffd){_0x2a0bf0=_0x2a0bf0-0x0;var _0x104fd6=_0x16d2[_0x2a0bf0];return _0x104fd6;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var utils=require(_0x216d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x371e93,_0x1688cc){utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x5'),_0x371e93[_0x216d('0x6')],_0x371e93['channel'],_0x371e93[_0x216d('0x7')],_0x371e93[_0x216d('0x8')],_0x371e93[_0x216d('0x9')],_0x371e93[_0x216d('0xa')],_0x371e93[_0x216d('0xb')],_0x371e93[_0x216d('0xc')]));if(_0x371e93[_0x216d('0x7')]){utils[_0x216d('0xd')](_0x371e93['queue'])[_0x216d('0xe')](function(_0x1aeb55){if(_0x1aeb55){_0x371e93[_0x216d('0xf')]=_0x1aeb55[_0x216d('0xf')];_0x371e93[_0x216d('0x10')]=_0x371e93[_0x216d('0x11')]?_0x1aeb55['acw']:![];_0x371e93[_0x216d('0x12')]=_0x371e93['agentacw']?_0x1aeb55[_0x216d('0x13')]:0x0;}utils[_0x216d('0x14')](_0x216d('0x15'),_0x371e93);});}else{utils[_0x216d('0x14')](_0x216d('0x15'),_0x371e93);}if(_0x1688cc){delete transfers[_0x371e93[_0x216d('0x6')]];}else{delete agents[_0x371e93['destuniqueid']];}}exports[_0x216d('0x16')]=function(_0x4c07d0){try{utils[_0x216d('0x17')](util[_0x216d('0x4')]('[%s][agents][agentcalled]',_0x4c07d0[_0x216d('0x6')]),_0x4c07d0);agents[_0x4c07d0[_0x216d('0x18')]]=_0x4c07d0;agents[_0x4c07d0['destuniqueid']][_0x216d('0x19')]=utils['now']();agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0xc')]=_0x216d('0x1a');agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0xb')]=null;agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0x1b')]=null;utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4c07d0[_0x216d('0x6')],agents[_0x4c07d0['destuniqueid']]['membername'],_0x4c07d0[_0x216d('0x18')]));}catch(_0x35dbe8){utils['error'](util[_0x216d('0x4')](_0x216d('0x1c'),_0x4c07d0['uniqueid']),_0x35dbe8);}};exports[_0x216d('0x1d')]=function(_0x13b8e0){try{if(!_[_0x216d('0x1e')](agents[_0x13b8e0[_0x216d('0x18')]])){utils['debug'](util[_0x216d('0x4')](_0x216d('0x1f'),_0x13b8e0[_0x216d('0x6')]),_0x13b8e0);utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x13b8e0[_0x216d('0x6')],agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x8')],_0x13b8e0[_0x216d('0x18')]));agents[_0x13b8e0[_0x216d('0x18')]]['agentringnoanswer']=!![];agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x20')]=utils[_0x216d('0x21')]();agents[_0x13b8e0['destuniqueid']]['lastevent']='timeout';agents[_0x13b8e0['destuniqueid']]['reason']=_0x216d('0x22');agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x23')]=_0x13b8e0[_0x216d('0x24')]?parseInt(_0x13b8e0[_0x216d('0x24')])/0x3e8:0x0;agents[_0x13b8e0['destuniqueid']]['talktime']=0x0;unanswered[_0x216d('0x25')](_0x13b8e0['destuniqueid']);}}catch(_0x23d1c3){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x1f'),_0x13b8e0[_0x216d('0x6')]),_0x23d1c3);}};exports[_0x216d('0x27')]=function(_0x28fcc2){try{_[_0x216d('0x28')](agents,function(_0x169cfa,_0x28f56a){if(_0x169cfa[_0x216d('0x6')]==_0x28fcc2[_0x216d('0x6')]&&!_[_0x216d('0x29')](unanswered,_0x169cfa['destuniqueid'])){utils[_0x216d('0x17')](util[_0x216d('0x4')](_0x216d('0x2a'),_0x28fcc2['uniqueid']),_0x28fcc2);utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x2b'),_0x28fcc2[_0x216d('0x6')],_0x169cfa['membername'],_0x169cfa[_0x216d('0x18')]));_0x169cfa[_0x216d('0x1d')]=!![];_0x169cfa[_0x216d('0x20')]=utils[_0x216d('0x21')]();_0x169cfa[_0x216d('0xc')]=_0x216d('0x2c');_0x169cfa[_0x216d('0x2d')]=_0x216d('0x2c');_0x169cfa[_0x216d('0x23')]=_0x28fcc2[_0x216d('0x23')];_0x169cfa[_0x216d('0x2e')]=0x0;writeDB(_0x169cfa);}});}catch(_0x4a2caa){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x2a'),_0x28fcc2['uniqueid']),_0x4a2caa);}};exports[_0x216d('0x2f')]=function(_0x2e86f9){try{if(agents[_0x2e86f9['destuniqueid']]){utils[_0x216d('0x17')](util['format']('[%s][agents][agentconnect]',_0x2e86f9[_0x216d('0x6')]),_0x2e86f9);utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x30'),_0x2e86f9['uniqueid'],agents[_0x2e86f9['destuniqueid']]['membername'],_0x2e86f9[_0x216d('0x18')]));agents[_0x2e86f9[_0x216d('0x18')]]['agentconnectAt']=utils[_0x216d('0x21')]();agents[_0x2e86f9[_0x216d('0x18')]]['connectedlinenum']=_0x2e86f9[_0x216d('0xb')];agents[_0x2e86f9[_0x216d('0x18')]][_0x216d('0x1b')]=_0x2e86f9[_0x216d('0x1b')];agents[_0x2e86f9[_0x216d('0x18')]][_0x216d('0x23')]=_0x2e86f9[_0x216d('0x24')];agents[_0x2e86f9[_0x216d('0x18')]]['lastevent']='connect';_[_0x216d('0x28')](agents,function(_0x2be24f,_0x504a34){if(_0x2be24f[_0x216d('0x18')]!=_0x2e86f9[_0x216d('0x18')]&&_0x2be24f[_0x216d('0x6')]==_0x2e86f9['uniqueid']){_0x2be24f[_0x216d('0x2e')]=0x0;_0x2be24f[_0x216d('0x23')]=_0x2e86f9[_0x216d('0x24')];_0x2be24f[_0x216d('0x1d')]=!![];_0x2be24f['agentringnoanswerAt']=utils[_0x216d('0x21')]();_0x2be24f[_0x216d('0xc')]='answered_elsewhere';_0x2be24f[_0x216d('0x2d')]=_0x216d('0x31');_0x2be24f['answeredelsewheredestinationuniqueid']=_0x2e86f9['destuniqueid'];_0x2be24f[_0x216d('0x32')]=_0x2e86f9[_0x216d('0x8')];writeDB(_0x2be24f);}});}}catch(_0x3c491e){utils['error'](util[_0x216d('0x4')]('[%s][agents][agentconnect]',_0x2e86f9['uniqueid']),_0x3c491e);}};exports[_0x216d('0x11')]=function(_0x43336e){try{if(!_[_0x216d('0x1e')](agents[_0x43336e['destuniqueid']])){utils[_0x216d('0x17')](util['format'](_0x216d('0x33'),_0x43336e[_0x216d('0x6')]),_0x43336e);utils[_0x216d('0x3')](util['format'](_0x216d('0x34'),_0x43336e[_0x216d('0x6')],agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x8')],_0x43336e['destuniqueid']));agents[_0x43336e['destuniqueid']]['agentcomplete']=!![];agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x2e')]=utils[_0x216d('0x36')](agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x35')],agents[_0x43336e['destuniqueid']][_0x216d('0x37')]);agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x2d')]=_0x43336e[_0x216d('0x2d')];agents[_0x43336e['destuniqueid']][_0x216d('0xc')]='complete';writeDB(agents[_0x43336e[_0x216d('0x18')]]);}}catch(_0x36179){utils[_0x216d('0x26')](util['format']('[%s][agents][agentcomplete]',_0x43336e[_0x216d('0x6')]),_0x36179);}};exports[_0x216d('0x38')]=function(_0x3932a3){try{if(!_[_0x216d('0x1e')](agents[_0x3932a3[_0x216d('0x39')]])){utils[_0x216d('0x17')](util['format']('[%s][agents][blindtransfer]',_0x3932a3[_0x216d('0x6')]),_0x3932a3);utils['info'](util[_0x216d('0x4')](_0x216d('0x3a'),_0x3932a3['uniqueid'],agents[_0x3932a3['transfereruniqueid']]['membername'],agents[_0x3932a3['transfereruniqueid']][_0x216d('0x6')]));agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3b')]=!![];agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3c')]=_0x216d('0x3d');agents[_0x3932a3[_0x216d('0x39')]]['transferexten']=_0x3932a3[_0x216d('0x3e')];agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3f')]=agents[_0x3932a3['transfereruniqueid']][_0x216d('0x6')];}}catch(_0x10fe2e){utils[_0x216d('0x26')](util[_0x216d('0x4')]('[%s][agents][blindtransfer]',_0x3932a3[_0x216d('0x6')]),_0x10fe2e);}};exports[_0x216d('0x40')]=function(_0x18a0bf){try{utils[_0x216d('0x17')](util['format'](_0x216d('0x41'),_0x18a0bf[_0x216d('0x42')]),_0x18a0bf);if(_0x18a0bf['origtransfereruniqueid']==_0x18a0bf[_0x216d('0x43')]){if(!_['isNil'](agents[_0x18a0bf[_0x216d('0x44')]])){utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x45'),_0x18a0bf[_0x216d('0x42')],agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x8')]));agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x3b')]=!![];agents[_0x18a0bf['secondtransfereruniqueid']][_0x216d('0x3c')]=_0x216d('0x46');agents[_0x18a0bf['secondtransfereruniqueid']][_0x216d('0x47')]=_0x18a0bf[_0x216d('0x48')];agents[_0x18a0bf['secondtransfereruniqueid']]['transferuniqueid']=_0x18a0bf[_0x216d('0x42')];}if(_0x18a0bf['transfereeuniqueid']&&agents[_0x18a0bf[_0x216d('0x49')]]){agents[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4a')]=0x1;transfers[_0x18a0bf['transfereeuniqueid']]=_[_0x216d('0x4b')](agents[_0x18a0bf['transfereeuniqueid']]);transfers[_0x18a0bf['transfereeuniqueid']][_0x216d('0xa')]=agents[_0x18a0bf[_0x216d('0x44')]]['calleridnum'];transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4c')]=agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x4c')];transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x19')]=utils['now']();transfers[_0x18a0bf['transfereeuniqueid']][_0x216d('0x37')]=utils[_0x216d('0x21')]();transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x23')]=0x0;transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4a')]=0x2;}}else if(_0x18a0bf[_0x216d('0x44')]==_0x18a0bf[_0x216d('0x4d')]){if(!_[_0x216d('0x1e')](agents[_0x18a0bf[_0x216d('0x42')]])){utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x18a0bf['origtransfereruniqueid'],agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x8')]));agents[_0x18a0bf['origtransfereruniqueid']][_0x216d('0x3b')]=!![];agents[_0x18a0bf['origtransfereruniqueid']]['transfertype']=_0x216d('0x46');agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x47')]=_0x18a0bf[_0x216d('0x4e')];agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x3f')]=_0x18a0bf[_0x216d('0x44')];}if(_0x18a0bf[_0x216d('0x4f')]&&agents[_0x18a0bf[_0x216d('0x4f')]]){agents[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4a')]=0x1;transfers[_0x18a0bf[_0x216d('0x4f')]]=_[_0x216d('0x4b')](agents[_0x18a0bf[_0x216d('0x4f')]]);transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0xa')]=agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0xa')];transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4c')]=agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x4c')];transfers[_0x18a0bf['transfertargetuniqueid']][_0x216d('0x19')]=utils['now']();transfers[_0x18a0bf[_0x216d('0x4f')]]['agentconnectAt']=utils[_0x216d('0x21')]();transfers[_0x18a0bf[_0x216d('0x4f')]]['holdtime']=0x0;transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4a')]=0x2;}}}catch(_0x3729b6){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x41'),_0x18a0bf[_0x216d('0x42')]),_0x3729b6);}};exports[_0x216d('0x50')]=function(_0x2727c7){try{utils['debug'](util[_0x216d('0x4')](_0x216d('0x51'),_0x2727c7[_0x216d('0x6')]),_0x2727c7);if(agents[_0x2727c7['uniqueid']]&&agents[_0x2727c7['uniqueid']]['reason']==='timeout'){if(_0x2727c7[_0x216d('0x52')]==='21'){agents[_0x2727c7['uniqueid']][_0x216d('0x2d')]=_0x216d('0x53');agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]=_0x216d('0x53');}utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x54'),_0x2727c7[_0x216d('0x6')],agents[_0x2727c7['uniqueid']][_0x216d('0x8')],agents[_0x2727c7[_0x216d('0x6')]]['reason'],agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(agents[_0x2727c7[_0x216d('0x6')]]);var _0x1650fd=unanswered[_0x216d('0x55')](_0x2727c7[_0x216d('0x6')]);if(_0x1650fd>-0x1){unanswered['splice'](_0x1650fd,0x1);}}if(transfers[_0x2727c7['uniqueid']]){transfers[_0x2727c7[_0x216d('0x6')]]['agentcomplete']=!![];transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();transfers[_0x2727c7['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x37')]);transfers[_0x2727c7['uniqueid']][_0x216d('0x2d')]=_0x216d('0x56');transfers[_0x2727c7[_0x216d('0x6')]]['lastevent']='complete';utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x54'),_0x2727c7[_0x216d('0x6')],transfers[_0x2727c7[_0x216d('0x6')]]['membername'],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x2d')],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(transfers[_0x2727c7['uniqueid']],!![]);}if(agents[_0x2727c7[_0x216d('0x6')]]&&agents[_0x2727c7['uniqueid']][_0x216d('0x37')]){agents[_0x2727c7['uniqueid']][_0x216d('0x11')]=!![];agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();agents[_0x2727c7[_0x216d('0x6')]]['talktime']=utils[_0x216d('0x36')](agents[_0x2727c7['uniqueid']]['agentcompleteAt'],agents[_0x2727c7['uniqueid']]['agentconnectAt']);agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0x2d')]=agents[_0x2727c7[_0x216d('0x6')]]['transfer']?'transfer':_0x216d('0x56');agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]=_0x216d('0x57');utils[_0x216d('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2727c7[_0x216d('0x6')],agents[_0x2727c7['uniqueid']][_0x216d('0x8')],agents[_0x2727c7['uniqueid']][_0x216d('0x2d')],agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(agents[_0x2727c7[_0x216d('0x6')]]);}}catch(_0x4899d1){utils['error'](util[_0x216d('0x4')](_0x216d('0x51'),_0x2727c7[_0x216d('0x6')]),_0x4899d1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 5069bb3..149ce42 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 _0xe861=['destinationchannel','toNumber','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','noop','execif','gotoif','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','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','interface','calleridnum','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0xe861,0xb3));var _0x1e86=function(_0x2a060c,_0x3db687){_0x2a060c=_0x2a060c-0x0;var _0x239be0=_0xe861[_0x2a060c];return _0x239be0;};'use strict';var _=require(_0x1e86('0x0'));var util=require(_0x1e86('0x1'));var utils=require(_0x1e86('0x2'));var transfers=require(_0x1e86('0x3'));var dispositions=[_0x1e86('0x4'),_0x1e86('0x5'),_0x1e86('0x5'),'NO\x20ANSWER',_0x1e86('0x4'),_0x1e86('0x4'),_0x1e86('0x6'),_0x1e86('0x7'),'FAILED','FAILED',_0x1e86('0x5')];var channels={};function writeDB(_0x213a1c){var _0xcb9988;if(transfers[_0x1e86('0x8')][_0x213a1c[_0x1e86('0x9')]]){_0xcb9988=_0x213a1c['uniqueid'];_0x213a1c['uniqueid']=transfers['blinds'][_0x213a1c['uniqueid']][_0x1e86('0xa')];}utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0xd'),_0x213a1c['uniqueid'],_0x213a1c[_0x1e86('0xe')],_0x213a1c[_0x1e86('0xf')],_0x213a1c['membername'],_0x213a1c[_0x1e86('0x10')],_0x213a1c[_0x1e86('0x11')],_0x213a1c[_0x1e86('0x12')],_0x213a1c[_0x1e86('0x13')]));if(_0x213a1c['accountcode']){utils['getUserByInternal'](_0x213a1c[_0x1e86('0x14')])['then'](function(_0x1ade52){if(_0x1ade52){_0x213a1c[_0x1e86('0x15')]=_0x1ade52['id'];}utils[_0x1e86('0x16')]('CreateVoiceCallReport',_0x213a1c);});}else{utils['request'](_0x1e86('0x17'),_0x213a1c);}if(channels[_0x213a1c[_0x1e86('0x9')]]){delete channels[_0x213a1c[_0x1e86('0x9')]];}else if(_0xcb9988&&channels[_0xcb9988]){if(!transfers[_0x1e86('0x8')][_0xcb9988][_0x1e86('0x18')])delete transfers[_0x1e86('0x8')][_0xcb9988];delete channels[_0xcb9988];}}exports[_0x1e86('0x19')]=function(_0x37dfd0){try{utils[_0x1e86('0x1a')](util[_0x1e86('0xc')](_0x1e86('0x1b'),_0x37dfd0['uniqueid']),_0x37dfd0);if(_0x37dfd0[_0x1e86('0x9')]==_0x37dfd0[_0x1e86('0x1c')]&&_0x37dfd0['channel']!='OutgoingSpoolFailed'){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x1d'),_0x37dfd0[_0x1e86('0x9')],_0x37dfd0[_0x1e86('0x1e')],_0x37dfd0[_0x1e86('0x1f')]));channels[_0x37dfd0[_0x1e86('0x9')]]={'uniqueid':_0x37dfd0[_0x1e86('0x9')],'accountcode':_0x37dfd0[_0x1e86('0x14')],'source':_0x37dfd0[_0x1e86('0x11')],'destination':_0x37dfd0[_0x1e86('0x1f')],'destinationcontext':_0x37dfd0[_0x1e86('0x1e')],'channel':_0x37dfd0[_0x1e86('0xe')],'starttime':utils[_0x1e86('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1e86('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x2cd835){utils[_0x1e86('0x21')](util['format']('[%s][calls][newchannel]',_0x37dfd0[_0x1e86('0x9')]),_0x2cd835);}};exports[_0x1e86('0x22')]=function(_0x3a1079){try{utils[_0x1e86('0x1a')](util['format'](_0x1e86('0x23'),_0x3a1079[_0x1e86('0x9')]),_0x3a1079);if(!_[_0x1e86('0x24')](channels[_0x3a1079[_0x1e86('0x9')]])&&_0x3a1079['channelstate']==0x6){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x25'),_0x3a1079[_0x1e86('0x9')],_0x3a1079[_0x1e86('0x1e')],_0x3a1079['channel']));if(_[_0x1e86('0x24')](channels[_0x3a1079[_0x1e86('0x9')]][_0x1e86('0x26')])){channels[_0x3a1079[_0x1e86('0x9')]]['systemanswertime']=utils[_0x1e86('0x20')]();}}else if(!_[_0x1e86('0x24')](channels[_0x3a1079['linkedid']])&&_0x3a1079[_0x1e86('0x27')]==0x6&&_0x3a1079['context']!=_0x1e86('0x28')){utils[_0x1e86('0xb')](util[_0x1e86('0xc')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3a1079['uniqueid'],_0x3a1079[_0x1e86('0x1c')],_0x3a1079[_0x1e86('0x1e')],_0x3a1079[_0x1e86('0xe')]));channels[_0x3a1079['linkedid']]['accountcode']=_0x3a1079[_0x1e86('0x14')];channels[_0x3a1079[_0x1e86('0x1c')]][_0x1e86('0x29')]=_0x3a1079[_0x1e86('0xe')];if(_['isNil'](channels[_0x3a1079[_0x1e86('0x1c')]]['answertime'])){channels[_0x3a1079[_0x1e86('0x1c')]]['answertime']=utils[_0x1e86('0x20')]();}channels[_0x3a1079[_0x1e86('0x1c')]]['disposition']=dispositions[_[_0x1e86('0x2a')](_0x3a1079[_0x1e86('0x27')])]||'ANSWERED';}}catch(_0x6eb2d){utils[_0x1e86('0x21')](util['format'](_0x1e86('0x23'),_0x3a1079['uniqueid']),_0x6eb2d);}};exports[_0x1e86('0x2b')]=function(_0x41d487){try{if(!_[_0x1e86('0x24')](channels[_0x41d487[_0x1e86('0x9')]])){utils[_0x1e86('0x1a')](util[_0x1e86('0xc')]('[%s][calls][hangup]',_0x41d487[_0x1e86('0x9')]),_0x41d487);if(_['isNil'](channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x2c')])){channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x2c')]=_0x41d487[_0x1e86('0x2d')]+'\x20<'+_0x41d487[_0x1e86('0x11')]+'>';}utils[_0x1e86('0xb')](util[_0x1e86('0xc')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x41d487[_0x1e86('0x9')],channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x2c')],_0x41d487[_0x1e86('0x2e')]));channels[_0x41d487['uniqueid']][_0x1e86('0x2f')]=utils[_0x1e86('0x20')]();channels[_0x41d487['uniqueid']][_0x1e86('0x30')]=utils[_0x1e86('0x31')](channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x2f')],channels[_0x41d487['uniqueid']][_0x1e86('0x32')]);channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x33')]=channels[_0x41d487[_0x1e86('0x9')]]['answertime']?utils[_0x1e86('0x31')](channels[_0x41d487[_0x1e86('0x9')]][_0x1e86('0x2f')],channels[_0x41d487[_0x1e86('0x9')]]['answertime']):0x0;writeDB(channels[_0x41d487[_0x1e86('0x9')]]);}}catch(_0x30f21f){utils[_0x1e86('0x21')](util[_0x1e86('0xc')](_0x1e86('0x34'),_0x41d487['uniqueid']),_0x30f21f);}};exports[_0x1e86('0x35')]=function(_0x412ba8){try{if(!_['isNil'](channels[_0x412ba8[_0x1e86('0x36')]])){utils[_0x1e86('0x1a')](util[_0x1e86('0xc')](_0x1e86('0x37'),_0x412ba8[_0x1e86('0x38')]),_0x412ba8);if(channels[_0x412ba8['localtwolinkedid']][_0x1e86('0xe')]==_0x412ba8[_0x1e86('0x39')]){utils[_0x1e86('0xb')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x412ba8[_0x1e86('0x38')],_0x412ba8[_0x1e86('0x36')],_0x412ba8['secondtransfererchannel']));channels[_0x412ba8[_0x1e86('0x36')]]['destinationchannel']=_0x412ba8[_0x1e86('0x3a')];channels[_0x412ba8[_0x1e86('0x36')]][_0x1e86('0x3b')]='_attended';}else if(channels[_0x412ba8[_0x1e86('0x36')]]['channel']=_0x412ba8[_0x1e86('0x3c')]){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x3d'),_0x412ba8[_0x1e86('0x38')],_0x412ba8['localtwolinkedid'],_0x412ba8[_0x1e86('0x3e')]));channels[_0x412ba8[_0x1e86('0x36')]][_0x1e86('0x29')]=_0x412ba8['origtransfererchannel'];channels[_0x412ba8[_0x1e86('0x36')]]['userfield']=_0x1e86('0x3f');}}}catch(_0x2259b8){utils[_0x1e86('0x21')](util[_0x1e86('0xc')](_0x1e86('0x37'),_0x412ba8[_0x1e86('0x38')]),_0x2259b8);}};exports[_0x1e86('0x40')]=function(_0x28724f){try{if(!_[_0x1e86('0x24')](channels[_0x28724f[_0x1e86('0x9')]])){utils[_0x1e86('0x1a')](util['format'](_0x1e86('0x41'),_0x28724f[_0x1e86('0x9')]),_0x28724f);channels[_0x28724f[_0x1e86('0x9')]][_0x1e86('0x42')]=utils['now']();utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x43'),_0x28724f[_0x1e86('0x9')],channels[_0x28724f[_0x1e86('0x9')]][_0x1e86('0x42')]));}}catch(_0x325d95){utils[_0x1e86('0x21')](util[_0x1e86('0xc')](_0x1e86('0x41'),_0x28724f[_0x1e86('0x9')]),_0x325d95);}};exports[_0x1e86('0x44')]=function(_0x361e0e){try{if(!_[_0x1e86('0x24')](channels[_0x361e0e['uniqueid']])){utils[_0x1e86('0x1a')](util[_0x1e86('0xc')](_0x1e86('0x45'),_0x361e0e['uniqueid']),_0x361e0e);if(!_['isNil'](channels[_0x361e0e[_0x1e86('0x9')]][_0x1e86('0x42')])){channels[_0x361e0e[_0x1e86('0x9')]][_0x1e86('0x46')]+=utils[_0x1e86('0x31')](utils['now'](),channels[_0x361e0e[_0x1e86('0x9')]][_0x1e86('0x42')]);utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x47'),_0x361e0e['uniqueid'],channels[_0x361e0e['uniqueid']][_0x1e86('0x46')]));delete channels[_0x361e0e['uniqueid']]['musiconholdstartAt'];}}}catch(_0x17b7a8){utils[_0x1e86('0x21')](util['format'](_0x1e86('0x45'),_0x361e0e[_0x1e86('0x9')]),_0x17b7a8);}};exports[_0x1e86('0x48')]=function(_0x30046b){try{if(!_[_0x1e86('0x24')](channels[_0x30046b[_0x1e86('0x9')]])){utils[_0x1e86('0x1a')](util[_0x1e86('0xc')](_0x1e86('0x49'),_0x30046b[_0x1e86('0x9')]),_0x30046b);if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x4b')])){utils['info'](util[_0x1e86('0xc')](_0x1e86('0x4c'),_0x30046b[_0x1e86('0x9')],_0x30046b['value']));channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0x4d')]=_0x30046b[_0x1e86('0x4e')];}if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x4f')])){utils[_0x1e86('0xb')](util[_0x1e86('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x30046b[_0x1e86('0x9')],_0x30046b[_0x1e86('0x4e')]));channels[_0x30046b[_0x1e86('0x9')]]['destination']=_0x30046b[_0x1e86('0x4e')];channels[_0x30046b['uniqueid']][_0x1e86('0x2c')]='\x22'+_0x30046b[_0x1e86('0x4e')]+_0x1e86('0x50')+_0x30046b[_0x1e86('0x4e')]+'>';}if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x51')])||!_[_0x1e86('0x24')](_0x30046b['variable']['xmd-callerid'])){utils[_0x1e86('0xb')](util[_0x1e86('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x30046b[_0x1e86('0x9')],!_[_0x1e86('0x24')](_0x30046b['variable']['xmd-callerid-preview'])?_0x1e86('0x51'):_0x1e86('0x52'),_0x30046b[_0x1e86('0x4e')]));channels[_0x30046b['uniqueid']]['callerid']=_0x30046b['value'];}if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x53')])||!_[_0x1e86('0x24')](_0x30046b['variable'][_0x1e86('0x54')])){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x55'),_0x30046b[_0x1e86('0x9')],!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x53')])?_0x1e86('0x53'):_0x1e86('0x54'),_0x30046b['value']));channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0x56')]=_0x1e86('0x57');channels[_0x30046b[_0x1e86('0x9')]]['lastdata']=_0x30046b[_0x1e86('0x4e')];channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0xf')]=!![];}if(!_['isNil'](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x58')])){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x59'),_0x30046b[_0x1e86('0x9')],_0x30046b[_0x1e86('0x4e')]));channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0x5a')]=_0x30046b[_0x1e86('0x4e')];}if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x5b')])){utils[_0x1e86('0xb')](util[_0x1e86('0xc')](_0x1e86('0x5c'),_0x30046b[_0x1e86('0x9')],_0x30046b['value']));channels[_0x30046b[_0x1e86('0x9')]]['type']=_0x30046b[_0x1e86('0x4e')];}if(!_[_0x1e86('0x24')](_0x30046b['variable'][_0x1e86('0x5d')])){utils['info'](util[_0x1e86('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x30046b[_0x1e86('0x9')],_0x30046b[_0x1e86('0x4e')]));channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0x5e')]=_0x30046b['value'];}if(!_[_0x1e86('0x24')](_0x30046b[_0x1e86('0x4a')][_0x1e86('0x5f')])){utils['info'](util[_0x1e86('0xc')](_0x1e86('0x60'),_0x30046b['uniqueid'],_0x30046b[_0x1e86('0x4e')]));channels[_0x30046b[_0x1e86('0x9')]][_0x1e86('0x5f')]=_0x30046b[_0x1e86('0x4e')];}}}catch(_0x542004){utils[_0x1e86('0x21')](util[_0x1e86('0xc')](_0x1e86('0x49'),_0x30046b[_0x1e86('0x9')]),_0x542004);}};exports['newexten']=function(_0x34e9ea){try{if(!_['isNil'](channels[_0x34e9ea[_0x1e86('0x9')]])){utils[_0x1e86('0x1a')](util[_0x1e86('0xc')](_0x1e86('0x61'),_0x34e9ea[_0x1e86('0x9')]),_0x34e9ea);utils[_0x1e86('0xb')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x34e9ea[_0x1e86('0x9')],_0x34e9ea[_0x1e86('0x62')],_0x34e9ea[_0x1e86('0x63')]));if(_0x34e9ea['application']['toLowerCase']()==_0x1e86('0x64')&&_[_0x1e86('0x65')](_0x34e9ea[_0x1e86('0x63')][_0x1e86('0x66')](),_0x1e86('0x67'))){var _0x10004e=_0x34e9ea[_0x1e86('0x63')][_0x1e86('0x68')]('=');var _0x1b48c1=_0x10004e[0x0]['substring'](_0x10004e[0x0]['lastIndexOf']('(')+0x1,_0x10004e[0x0][_0x1e86('0x69')](')'));var _0x4b40c1=_0x10004e[0x1];channels[_0x34e9ea[_0x1e86('0x9')]][_0x1b48c1]=_0x4b40c1;}if(!_['includes']([_0x1e86('0x2b'),_0x1e86('0x6a'),_0x1e86('0x6b'),_0x1e86('0x64'),_0x1e86('0x6c')],_0x34e9ea['application'][_0x1e86('0x66')]())){channels[_0x34e9ea[_0x1e86('0x9')]][_0x1e86('0x56')]=_0x34e9ea[_0x1e86('0x62')];channels[_0x34e9ea['uniqueid']][_0x1e86('0x6d')]=_0x34e9ea[_0x1e86('0x63')];}}}catch(_0x426279){utils[_0x1e86('0x21')](util[_0x1e86('0xc')]('[%s][calls][newexten]',_0x34e9ea[_0x1e86('0x9')]),_0x426279);}}; \ No newline at end of file +var _0x5e8d=['transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','ANSWERED','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid'];(function(_0x19e050,_0x363100){var _0x533a3f=function(_0x17d04e){while(--_0x17d04e){_0x19e050['push'](_0x19e050['shift']());}};_0x533a3f(++_0x363100);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x5c6c67,_0x4cc516){_0x5c6c67=_0x5c6c67-0x0;var _0xd83cfb=_0x5e8d[_0x5c6c67];return _0xd83cfb;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var utils=require(_0xd5e8('0x2'));var transfers=require(_0xd5e8('0x3'));var dispositions=[_0xd5e8('0x4'),_0xd5e8('0x5'),_0xd5e8('0x5'),'NO\x20ANSWER',_0xd5e8('0x4'),_0xd5e8('0x4'),'ANSWERED',_0xd5e8('0x6'),_0xd5e8('0x5'),_0xd5e8('0x5'),'FAILED'];var channels={};function writeDB(_0x31c6bb){var _0x4196e2;if(transfers[_0xd5e8('0x7')][_0x31c6bb[_0xd5e8('0x8')]]){_0x4196e2=_0x31c6bb['uniqueid'];_0x31c6bb['uniqueid']=transfers[_0xd5e8('0x7')][_0x31c6bb[_0xd5e8('0x8')]][_0xd5e8('0x9')];}utils[_0xd5e8('0xa')](util['format'](_0xd5e8('0xb'),_0x31c6bb[_0xd5e8('0x8')],_0x31c6bb['channel'],_0x31c6bb[_0xd5e8('0xc')],_0x31c6bb[_0xd5e8('0xd')],_0x31c6bb[_0xd5e8('0xe')],_0x31c6bb[_0xd5e8('0xf')],_0x31c6bb[_0xd5e8('0x10')],_0x31c6bb[_0xd5e8('0x11')]));if(_0x31c6bb[_0xd5e8('0x12')]){utils[_0xd5e8('0x13')](_0x31c6bb[_0xd5e8('0x12')])['then'](function(_0x5a6665){if(_0x5a6665){_0x31c6bb[_0xd5e8('0x14')]=_0x5a6665['id'];}utils[_0xd5e8('0x15')](_0xd5e8('0x16'),_0x31c6bb);});}else{utils[_0xd5e8('0x15')](_0xd5e8('0x16'),_0x31c6bb);}if(channels[_0x31c6bb[_0xd5e8('0x8')]]){delete channels[_0x31c6bb['uniqueid']];}else if(_0x4196e2&&channels[_0x4196e2]){if(!transfers[_0xd5e8('0x7')][_0x4196e2][_0xd5e8('0x17')])delete transfers[_0xd5e8('0x7')][_0x4196e2];delete channels[_0x4196e2];}}exports[_0xd5e8('0x18')]=function(_0x5dc327){try{utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')]('[%s][calls][newchannel]',_0x5dc327[_0xd5e8('0x8')]),_0x5dc327);if(_0x5dc327[_0xd5e8('0x8')]==_0x5dc327[_0xd5e8('0x1b')]&&_0x5dc327[_0xd5e8('0x1c')]!=_0xd5e8('0x1d')){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x1e'),_0x5dc327['uniqueid'],_0x5dc327[_0xd5e8('0x1f')],_0x5dc327[_0xd5e8('0x20')]));channels[_0x5dc327[_0xd5e8('0x8')]]={'uniqueid':_0x5dc327[_0xd5e8('0x8')],'accountcode':_0x5dc327[_0xd5e8('0x12')],'source':_0x5dc327[_0xd5e8('0xf')],'destination':_0x5dc327[_0xd5e8('0x20')],'destinationcontext':_0x5dc327[_0xd5e8('0x1f')],'channel':_0x5dc327[_0xd5e8('0x1c')],'starttime':utils[_0xd5e8('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd5e8('0x4'),'amaflags':_0xd5e8('0x22')};}}catch(_0x4592e5){utils['error'](util['format']('[%s][calls][newchannel]',_0x5dc327['uniqueid']),_0x4592e5);}};exports[_0xd5e8('0x23')]=function(_0x5620cb){try{utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')]('[%s][calls][newstate]',_0x5620cb['uniqueid']),_0x5620cb);if(!_[_0xd5e8('0x24')](channels[_0x5620cb[_0xd5e8('0x8')]])&&_0x5620cb[_0xd5e8('0x25')]==0x6){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x26'),_0x5620cb[_0xd5e8('0x8')],_0x5620cb[_0xd5e8('0x1f')],_0x5620cb[_0xd5e8('0x1c')]));if(_['isNil'](channels[_0x5620cb[_0xd5e8('0x8')]]['systemanswertime'])){channels[_0x5620cb[_0xd5e8('0x8')]][_0xd5e8('0x27')]=utils[_0xd5e8('0x21')]();}}else if(!_[_0xd5e8('0x24')](channels[_0x5620cb[_0xd5e8('0x1b')]])&&_0x5620cb['channelstate']==0x6&&_0x5620cb[_0xd5e8('0x1f')]!=_0xd5e8('0x28')){utils['info'](util[_0xd5e8('0x1a')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5620cb[_0xd5e8('0x8')],_0x5620cb[_0xd5e8('0x1b')],_0x5620cb[_0xd5e8('0x1f')],_0x5620cb[_0xd5e8('0x1c')]));channels[_0x5620cb[_0xd5e8('0x1b')]][_0xd5e8('0x12')]=_0x5620cb[_0xd5e8('0x12')];channels[_0x5620cb[_0xd5e8('0x1b')]]['destinationchannel']=_0x5620cb[_0xd5e8('0x1c')];if(_[_0xd5e8('0x24')](channels[_0x5620cb[_0xd5e8('0x1b')]][_0xd5e8('0x29')])){channels[_0x5620cb[_0xd5e8('0x1b')]][_0xd5e8('0x29')]=utils[_0xd5e8('0x21')]();}channels[_0x5620cb[_0xd5e8('0x1b')]]['disposition']=dispositions[_['toNumber'](_0x5620cb['channelstate'])]||_0xd5e8('0x2a');}}catch(_0x3c4e8c){utils[_0xd5e8('0x2b')](util[_0xd5e8('0x1a')](_0xd5e8('0x2c'),_0x5620cb[_0xd5e8('0x8')]),_0x3c4e8c);}};exports[_0xd5e8('0x2d')]=function(_0x55482b){try{if(!_['isNil'](channels[_0x55482b[_0xd5e8('0x8')]])){utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')](_0xd5e8('0x2e'),_0x55482b[_0xd5e8('0x8')]),_0x55482b);if(_[_0xd5e8('0x24')](channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x2f')])){channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x2f')]=_0x55482b[_0xd5e8('0x30')]+'\x20<'+_0x55482b['calleridnum']+'>';}utils[_0xd5e8('0xa')](util['format'](_0xd5e8('0x31'),_0x55482b['uniqueid'],channels[_0x55482b[_0xd5e8('0x8')]]['callerid'],_0x55482b[_0xd5e8('0x32')]));channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x33')]=utils[_0xd5e8('0x21')]();channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x34')]=utils['diffTime'](channels[_0x55482b['uniqueid']][_0xd5e8('0x33')],channels[_0x55482b[_0xd5e8('0x8')]]['starttime']);channels[_0x55482b['uniqueid']][_0xd5e8('0x35')]=channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x29')]?utils[_0xd5e8('0x36')](channels[_0x55482b[_0xd5e8('0x8')]][_0xd5e8('0x33')],channels[_0x55482b['uniqueid']]['answertime']):0x0;writeDB(channels[_0x55482b[_0xd5e8('0x8')]]);}}catch(_0x3b09f2){utils['error'](util[_0xd5e8('0x1a')](_0xd5e8('0x2e'),_0x55482b[_0xd5e8('0x8')]),_0x3b09f2);}};exports[_0xd5e8('0x37')]=function(_0x1cdc62){try{if(!_[_0xd5e8('0x24')](channels[_0x1cdc62['localtwolinkedid']])){utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')]('[%s][calls][attendedtransfer]',_0x1cdc62['origtransfereruniqueid']),_0x1cdc62);if(channels[_0x1cdc62[_0xd5e8('0x38')]][_0xd5e8('0x1c')]==_0x1cdc62[_0xd5e8('0x39')]){utils['info'](util['format'](_0xd5e8('0x3a'),_0x1cdc62[_0xd5e8('0x3b')],_0x1cdc62['localtwolinkedid'],_0x1cdc62[_0xd5e8('0x3c')]));channels[_0x1cdc62[_0xd5e8('0x38')]][_0xd5e8('0x3d')]=_0x1cdc62[_0xd5e8('0x3c')];channels[_0x1cdc62[_0xd5e8('0x38')]][_0xd5e8('0x3e')]=_0xd5e8('0x3f');}else if(channels[_0x1cdc62['localtwolinkedid']][_0xd5e8('0x1c')]=_0x1cdc62[_0xd5e8('0x40')]){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x3a'),_0x1cdc62[_0xd5e8('0x3b')],_0x1cdc62[_0xd5e8('0x38')],_0x1cdc62[_0xd5e8('0x41')]));channels[_0x1cdc62['localtwolinkedid']][_0xd5e8('0x3d')]=_0x1cdc62[_0xd5e8('0x41')];channels[_0x1cdc62[_0xd5e8('0x38')]][_0xd5e8('0x3e')]=_0xd5e8('0x3f');}}}catch(_0x4db32f){utils[_0xd5e8('0x2b')](util[_0xd5e8('0x1a')](_0xd5e8('0x42'),_0x1cdc62[_0xd5e8('0x3b')]),_0x4db32f);}};exports['musiconholdstart']=function(_0x1c0a44){try{if(!_[_0xd5e8('0x24')](channels[_0x1c0a44[_0xd5e8('0x8')]])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x1c0a44['uniqueid']),_0x1c0a44);channels[_0x1c0a44[_0xd5e8('0x8')]][_0xd5e8('0x43')]=utils[_0xd5e8('0x21')]();utils['info'](util[_0xd5e8('0x1a')](_0xd5e8('0x44'),_0x1c0a44['uniqueid'],channels[_0x1c0a44['uniqueid']]['musiconholdstartAt']));}}catch(_0x379338){utils[_0xd5e8('0x2b')](util[_0xd5e8('0x1a')](_0xd5e8('0x45'),_0x1c0a44['uniqueid']),_0x379338);}};exports[_0xd5e8('0x46')]=function(_0x340f40){try{if(!_[_0xd5e8('0x24')](channels[_0x340f40[_0xd5e8('0x8')]])){utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')](_0xd5e8('0x47'),_0x340f40['uniqueid']),_0x340f40);if(!_[_0xd5e8('0x24')](channels[_0x340f40[_0xd5e8('0x8')]]['musiconholdstartAt'])){channels[_0x340f40[_0xd5e8('0x8')]][_0xd5e8('0x48')]+=utils['diffTime'](utils[_0xd5e8('0x21')](),channels[_0x340f40['uniqueid']][_0xd5e8('0x43')]);utils[_0xd5e8('0xa')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x340f40[_0xd5e8('0x8')],channels[_0x340f40[_0xd5e8('0x8')]]['mohtime']));delete channels[_0x340f40[_0xd5e8('0x8')]][_0xd5e8('0x43')];}}}catch(_0x47944c){utils[_0xd5e8('0x2b')](util[_0xd5e8('0x1a')](_0xd5e8('0x47'),_0x340f40[_0xd5e8('0x8')]),_0x47944c);}};exports[_0xd5e8('0x49')]=function(_0x578348){try{if(!_['isNil'](channels[_0x578348[_0xd5e8('0x8')]])){utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')](_0xd5e8('0x4a'),_0x578348[_0xd5e8('0x8')]),_0x578348);if(!_['isNil'](_0x578348['variable'][_0xd5e8('0x4b')])){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x4c'),_0x578348[_0xd5e8('0x8')],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348['uniqueid']][_0xd5e8('0x4e')]=_0x578348[_0xd5e8('0x4d')];}if(!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x50')])){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x51'),_0x578348[_0xd5e8('0x8')],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]]['destination']=_0x578348[_0xd5e8('0x4d')];channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x2f')]='\x22'+_0x578348[_0xd5e8('0x4d')]+'\x22\x20<'+_0x578348[_0xd5e8('0x4d')]+'>';}if(!_['isNil'](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x52')])||!_['isNil'](_0x578348['variable']['xmd-callerid'])){utils[_0xd5e8('0xa')](util['format'](_0xd5e8('0x53'),_0x578348[_0xd5e8('0x8')],!_['isNil'](_0x578348['variable'][_0xd5e8('0x52')])?_0xd5e8('0x52'):_0xd5e8('0x54'),_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x2f')]=_0x578348[_0xd5e8('0x4d')];}if(!_[_0xd5e8('0x24')](_0x578348['variable'][_0xd5e8('0x55')])||!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x56')])){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')](_0xd5e8('0x53'),_0x578348['uniqueid'],!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')]['xmd-queue'])?_0xd5e8('0x55'):_0xd5e8('0x56'),_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x57')]=_0xd5e8('0x58');channels[_0x578348[_0xd5e8('0x8')]]['lastdata']=_0x578348[_0xd5e8('0x4d')];channels[_0x578348[_0xd5e8('0x8')]]['queue']=!![];}if(!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x59')])){utils[_0xd5e8('0xa')](util['format'](_0xd5e8('0x5a'),_0x578348[_0xd5e8('0x8')],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]]['ContactId']=_0x578348[_0xd5e8('0x4d')];}if(!_['isNil'](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x5b')])){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x578348['uniqueid'],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x5c')]=_0x578348['value'];}if(!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')][_0xd5e8('0x5d')])){utils['info'](util['format'](_0xd5e8('0x5e'),_0x578348['uniqueid'],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x5f')]=_0x578348[_0xd5e8('0x4d')];}if(!_[_0xd5e8('0x24')](_0x578348[_0xd5e8('0x4f')]['sipcallid'])){utils[_0xd5e8('0xa')](util[_0xd5e8('0x1a')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x578348[_0xd5e8('0x8')],_0x578348[_0xd5e8('0x4d')]));channels[_0x578348[_0xd5e8('0x8')]][_0xd5e8('0x60')]=_0x578348[_0xd5e8('0x4d')];}}}catch(_0x32ca06){utils['error'](util[_0xd5e8('0x1a')](_0xd5e8('0x4a'),_0x578348[_0xd5e8('0x8')]),_0x32ca06);}};exports[_0xd5e8('0x61')]=function(_0x3eeb35){try{if(!_[_0xd5e8('0x24')](channels[_0x3eeb35[_0xd5e8('0x8')]])){utils[_0xd5e8('0x19')](util[_0xd5e8('0x1a')](_0xd5e8('0x62'),_0x3eeb35[_0xd5e8('0x8')]),_0x3eeb35);utils[_0xd5e8('0xa')](util['format'](_0xd5e8('0x63'),_0x3eeb35[_0xd5e8('0x8')],_0x3eeb35[_0xd5e8('0x64')],_0x3eeb35[_0xd5e8('0x65')]));if(_0x3eeb35[_0xd5e8('0x64')][_0xd5e8('0x66')]()==_0xd5e8('0x67')&&_[_0xd5e8('0x68')](_0x3eeb35[_0xd5e8('0x65')][_0xd5e8('0x66')](),'cdr')){var _0x41110d=_0x3eeb35['appdata'][_0xd5e8('0x69')]('=');var _0x4191a0=_0x41110d[0x0][_0xd5e8('0x6a')](_0x41110d[0x0][_0xd5e8('0x6b')]('(')+0x1,_0x41110d[0x0][_0xd5e8('0x6b')](')'));var _0x51fa9d=_0x41110d[0x1];channels[_0x3eeb35[_0xd5e8('0x8')]][_0x4191a0]=_0x51fa9d;}if(!_[_0xd5e8('0x6c')]([_0xd5e8('0x2d'),_0xd5e8('0x6d'),_0xd5e8('0x6e'),_0xd5e8('0x67'),_0xd5e8('0x6f')],_0x3eeb35[_0xd5e8('0x64')][_0xd5e8('0x66')]())){channels[_0x3eeb35[_0xd5e8('0x8')]][_0xd5e8('0x57')]=_0x3eeb35[_0xd5e8('0x64')];channels[_0x3eeb35['uniqueid']][_0xd5e8('0x70')]=_0x3eeb35[_0xd5e8('0x65')];}}}catch(_0xfa5724){utils[_0xd5e8('0x2b')](util[_0xd5e8('0x1a')](_0xd5e8('0x62'),_0x3eeb35[_0xd5e8('0x8')]),_0xfa5724);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b531318..f2cc682 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 _0xb029=['[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x5e8fc,_0x1ccc06){var _0x41c58c=function(_0x495f2c){while(--_0x495f2c){_0x5e8fc['push'](_0x5e8fc['shift']());}};_0x41c58c(++_0x1ccc06);}(_0xb029,0x149));var _0x9b02=function(_0x4cf9ea,_0x44fdf5){_0x4cf9ea=_0x4cf9ea-0x0;var _0x8363ca=_0xb029[_0x4cf9ea];return _0x8363ca;};'use strict';var utils=require(_0x9b02('0x0'));exports[_0x9b02('0x1')]=function(){utils[_0x9b02('0x2')](_0x9b02('0x3'));};exports[_0x9b02('0x4')]=function(){utils[_0x9b02('0x2')](_0x9b02('0x5'));};exports[_0x9b02('0x6')]=function(){utils[_0x9b02('0x2')](_0x9b02('0x7'));};exports[_0x9b02('0x8')]=function(_0x3b4256){utils[_0x9b02('0x8')](_0x9b02('0x9'),_0x3b4256);};exports['close']=function(){utils[_0x9b02('0x2')](_0x9b02('0xa'));};exports[_0x9b02('0xb')]=function(_0x55329a){}; \ No newline at end of file +var _0x968d=['shutdown','[core]\x20shutdown','error','[core]\x20error','close','[core]\x20close','./utils','info'];(function(_0xe18129,_0x47d7bd){var _0x4fd878=function(_0x3c06b1){while(--_0x3c06b1){_0xe18129['push'](_0xe18129['shift']());}};_0x4fd878(++_0x47d7bd);}(_0x968d,0x16e));var _0xd968=function(_0x3a03a1,_0x24270b){_0x3a03a1=_0x3a03a1-0x0;var _0x3b9495=_0x968d[_0x3a03a1];return _0x3b9495;};'use strict';var utils=require(_0xd968('0x0'));exports['connect']=function(){utils[_0xd968('0x1')]('[core]\x20connected');};exports[_0xd968('0x2')]=function(){utils[_0xd968('0x1')](_0xd968('0x3'));};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports[_0xd968('0x4')]=function(_0x4244ea){utils[_0xd968('0x4')](_0xd968('0x5'),_0x4244ea);};exports[_0xd968('0x6')]=function(){utils[_0xd968('0x1')](_0xd968('0x7'));};exports['managerevent']=function(_0x110269){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c9cc219..9b5036f 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 _0xc5fd=['debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','assign','answertime','now','lastevent','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','diffTime','endtime','starttime','holdtime','billableseconds','lodash','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','newexten','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr(routeid)','split','error'];(function(_0xcb6fcc,_0x5dcf79){var _0x188aaf=function(_0xaca8d9){while(--_0xaca8d9){_0xcb6fcc['push'](_0xcb6fcc['shift']());}};_0x188aaf(++_0x5dcf79);}(_0xc5fd,0x74));var _0xdc5f=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0xc5fd[_0x3ef4f1];return _0x69953c;};'use strict';var _=require(_0xdc5f('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x417dea){utils['info'](util[_0xdc5f('0x1')](_0xdc5f('0x2'),_0x417dea[_0xdc5f('0x3')],_0x417dea[_0xdc5f('0x4')],_0x417dea['dialstring'],_0x417dea[_0xdc5f('0x5')],_0x417dea[_0xdc5f('0x6')],_0x417dea[_0xdc5f('0x7')]));utils['request']('CreateVoiceDialReport',_0x417dea);delete dials[_0x417dea['uniqueid']];}exports[_0xdc5f('0x8')]=function(_0x5f4fd3){try{utils['debug'](util['format'](_0xdc5f('0x9'),_0x5f4fd3[_0xdc5f('0x3')]),_0x5f4fd3);utils[_0xdc5f('0xa')](util['format'](_0xdc5f('0xb'),_0x5f4fd3['uniqueid'],_0x5f4fd3['application'],_0x5f4fd3[_0xdc5f('0xc')]));if(_0x5f4fd3[_0xdc5f('0xd')][_0xdc5f('0xe')]()=='set'&&_[_0xdc5f('0xf')](_0x5f4fd3[_0xdc5f('0xc')][_0xdc5f('0xe')](),_0xdc5f('0x10'))){var _0x23401a=_0x5f4fd3[_0xdc5f('0xc')][_0xdc5f('0x11')]('=');dials[_0x5f4fd3[_0xdc5f('0x3')]]={'routeId':_0x23401a[0x1]};}}catch(_0x573949){utils[_0xdc5f('0x12')](util['format']('[%s][dials][newexten]',_0x5f4fd3[_0xdc5f('0x3')]),_0x573949);}};exports['varset']=function(_0x2fa581){try{utils[_0xdc5f('0x13')](util['format']('[%s][dials][varset]',_0x2fa581[_0xdc5f('0x3')]),_0x2fa581);if(!_[_0xdc5f('0x14')](_0x2fa581[_0xdc5f('0x15')][_0xdc5f('0x16')])){utils[_0xdc5f('0xa')](util[_0xdc5f('0x1')](_0xdc5f('0x17'),_0x2fa581[_0xdc5f('0x3')],_0x2fa581[_0xdc5f('0x18')]));dials[_0x2fa581['uniqueid']]={'routeId':_0x2fa581[_0xdc5f('0x18')]};}}catch(_0x1a0cb2){utils[_0xdc5f('0x12')](util[_0xdc5f('0x1')]('[%s][dials][varset]',_0x2fa581['uniqueid']),_0x1a0cb2);}};exports[_0xdc5f('0x19')]=function(_0x309029){try{if(!_[_0xdc5f('0x14')](dials[_0x309029[_0xdc5f('0x3')]])){utils['debug'](util['format'](_0xdc5f('0x1a'),_0x309029[_0xdc5f('0x3')]),_0x309029);dials[_0x309029[_0xdc5f('0x3')]]=_['assign'](dials[_0x309029[_0xdc5f('0x3')]],_0x309029);dials[_0x309029[_0xdc5f('0x3')]]['starttime']=utils['now']();dials[_0x309029[_0xdc5f('0x3')]]['lastevent']='called';utils[_0xdc5f('0xa')](util['format'](_0xdc5f('0x1b'),_0x309029[_0xdc5f('0x3')],dials[_0x309029['uniqueid']]['starttime']));}}catch(_0x534a29){utils['error'](util['format'](_0xdc5f('0x1a'),_0x309029[_0xdc5f('0x3')]),_0x534a29);}};exports[_0xdc5f('0x1c')]=function(_0x343258){try{if(!_[_0xdc5f('0x14')](dials[_0x343258[_0xdc5f('0x3')]])){utils[_0xdc5f('0x13')](util[_0xdc5f('0x1')]('[%s][dials][dialend]',_0x343258[_0xdc5f('0x3')]),_0x343258);dials[_0x343258[_0xdc5f('0x3')]][_0xdc5f('0x7')]=_0x343258[_0xdc5f('0x7')];if(_0x343258[_0xdc5f('0x7')]==_0xdc5f('0x1d')){dials[_0x343258[_0xdc5f('0x3')]]=_[_0xdc5f('0x1e')](dials[_0x343258[_0xdc5f('0x3')]],_0x343258);dials[_0x343258[_0xdc5f('0x3')]][_0xdc5f('0x1f')]=utils[_0xdc5f('0x20')]();dials[_0x343258[_0xdc5f('0x3')]][_0xdc5f('0x21')]='connect';utils[_0xdc5f('0xa')](util[_0xdc5f('0x1')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x343258['uniqueid'],_0x343258[_0xdc5f('0x7')],dials[_0x343258[_0xdc5f('0x3')]][_0xdc5f('0x1f')]));}else{utils[_0xdc5f('0xa')](util[_0xdc5f('0x1')]('[%s][dials][dialend]\x20dialstatus:%s',_0x343258[_0xdc5f('0x3')],_0x343258[_0xdc5f('0x7')]));}}}catch(_0x2bbc76){utils[_0xdc5f('0x12')](util[_0xdc5f('0x1')](_0xdc5f('0x22'),_0x343258[_0xdc5f('0x3')]),_0x2bbc76);}};exports[_0xdc5f('0x23')]=function(_0x16c2dd){try{if(!_[_0xdc5f('0x14')](dials[_0x16c2dd[_0xdc5f('0x3')]])){utils[_0xdc5f('0x13')](util[_0xdc5f('0x1')](_0xdc5f('0x24'),_0x16c2dd[_0xdc5f('0x3')]),_0x16c2dd);utils[_0xdc5f('0xa')](util[_0xdc5f('0x1')](_0xdc5f('0x25'),_0x16c2dd[_0xdc5f('0x3')],_0x16c2dd[_0xdc5f('0x5')],_0x16c2dd['calleridname'],_0x16c2dd[_0xdc5f('0x26')]));dials[_0x16c2dd[_0xdc5f('0x3')]]=_[_0xdc5f('0x1e')](dials[_0x16c2dd[_0xdc5f('0x3')]],{'endtime':utils['now'](),'lastevent':_0xdc5f('0x27')});dials[_0x16c2dd[_0xdc5f('0x3')]]['duration']=utils[_0xdc5f('0x28')](dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x29')],dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x2a')]);dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x2b')]=utils[_0xdc5f('0x28')](dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x1f')]||dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x29')],dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x2a')]);dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x2c')]=dials[_0x16c2dd[_0xdc5f('0x3')]][_0xdc5f('0x1f')]?utils[_0xdc5f('0x28')](dials[_0x16c2dd['uniqueid']][_0xdc5f('0x29')],dials[_0x16c2dd[_0xdc5f('0x3')]]['answertime']):0x0;writeDB(dials[_0x16c2dd[_0xdc5f('0x3')]]);}}catch(_0x23082e){utils[_0xdc5f('0x12')](util[_0xdc5f('0x1')](_0xdc5f('0x24'),_0x16c2dd[_0xdc5f('0x3')]),_0x23082e);}}; \ No newline at end of file +var _0x7492=['diffTime','endtime','holdtime','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','isNil','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','cause-txt','duration'];(function(_0x2efb12,_0x7dca65){var _0x22d623=function(_0x363924){while(--_0x363924){_0x2efb12['push'](_0x2efb12['shift']());}};_0x22d623(++_0x7dca65);}(_0x7492,0xe9));var _0x2749=function(_0x20614f,_0x58a9ec){_0x20614f=_0x20614f-0x0;var _0x39fd7b=_0x7492[_0x20614f];return _0x39fd7b;};'use strict';var _=require('lodash');var util=require(_0x2749('0x0'));var utils=require(_0x2749('0x1'));var dials={};function writeDB(_0x533f29){utils[_0x2749('0x2')](util[_0x2749('0x3')](_0x2749('0x4'),_0x533f29[_0x2749('0x5')],_0x533f29[_0x2749('0x6')],_0x533f29[_0x2749('0x7')],_0x533f29[_0x2749('0x8')],_0x533f29[_0x2749('0x9')],_0x533f29['dialstatus']));utils['request']('CreateVoiceDialReport',_0x533f29);delete dials[_0x533f29[_0x2749('0x5')]];}exports[_0x2749('0xa')]=function(_0x3d02bf){try{utils[_0x2749('0xb')](util[_0x2749('0x3')](_0x2749('0xc'),_0x3d02bf[_0x2749('0x5')]),_0x3d02bf);utils[_0x2749('0x2')](util[_0x2749('0x3')](_0x2749('0xd'),_0x3d02bf[_0x2749('0x5')],_0x3d02bf[_0x2749('0xe')],_0x3d02bf[_0x2749('0xf')]));if(_0x3d02bf['application'][_0x2749('0x10')]()==_0x2749('0x11')&&_[_0x2749('0x12')](_0x3d02bf[_0x2749('0xf')][_0x2749('0x10')](),_0x2749('0x13'))){var _0x41b6df=_0x3d02bf[_0x2749('0xf')][_0x2749('0x14')]('=');dials[_0x3d02bf[_0x2749('0x5')]]={'routeId':_0x41b6df[0x1]};}}catch(_0x14f964){utils[_0x2749('0x15')](util[_0x2749('0x3')](_0x2749('0xc'),_0x3d02bf['uniqueid']),_0x14f964);}};exports[_0x2749('0x16')]=function(_0x53117d){try{utils['debug'](util[_0x2749('0x3')](_0x2749('0x17'),_0x53117d[_0x2749('0x5')]),_0x53117d);if(!_['isNil'](_0x53117d[_0x2749('0x18')][_0x2749('0x19')])){utils[_0x2749('0x2')](util[_0x2749('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x53117d['uniqueid'],_0x53117d[_0x2749('0x1a')]));dials[_0x53117d['uniqueid']]={'routeId':_0x53117d[_0x2749('0x1a')]};}}catch(_0x17e665){utils[_0x2749('0x15')](util['format'](_0x2749('0x17'),_0x53117d[_0x2749('0x5')]),_0x17e665);}};exports[_0x2749('0x1b')]=function(_0x2e784c){try{if(!_[_0x2749('0x1c')](dials[_0x2e784c[_0x2749('0x5')]])){utils[_0x2749('0xb')](util[_0x2749('0x3')]('[%s][dials][dialbegin]',_0x2e784c[_0x2749('0x5')]),_0x2e784c);dials[_0x2e784c[_0x2749('0x5')]]=_[_0x2749('0x1d')](dials[_0x2e784c[_0x2749('0x5')]],_0x2e784c);dials[_0x2e784c[_0x2749('0x5')]][_0x2749('0x1e')]=utils[_0x2749('0x1f')]();dials[_0x2e784c[_0x2749('0x5')]]['lastevent']='called';utils[_0x2749('0x2')](util['format'](_0x2749('0x20'),_0x2e784c[_0x2749('0x5')],dials[_0x2e784c[_0x2749('0x5')]][_0x2749('0x1e')]));}}catch(_0x3bbb8a){utils[_0x2749('0x15')](util[_0x2749('0x3')]('[%s][dials][dialbegin]',_0x2e784c[_0x2749('0x5')]),_0x3bbb8a);}};exports['dialend']=function(_0x112e09){try{if(!_[_0x2749('0x1c')](dials[_0x112e09['uniqueid']])){utils['debug'](util[_0x2749('0x3')](_0x2749('0x21'),_0x112e09[_0x2749('0x5')]),_0x112e09);dials[_0x112e09[_0x2749('0x5')]][_0x2749('0x22')]=_0x112e09[_0x2749('0x22')];if(_0x112e09[_0x2749('0x22')]==_0x2749('0x23')){dials[_0x112e09[_0x2749('0x5')]]=_['assign'](dials[_0x112e09['uniqueid']],_0x112e09);dials[_0x112e09[_0x2749('0x5')]][_0x2749('0x24')]=utils['now']();dials[_0x112e09[_0x2749('0x5')]]['lastevent']=_0x2749('0x25');utils['info'](util[_0x2749('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x112e09[_0x2749('0x5')],_0x112e09[_0x2749('0x22')],dials[_0x112e09[_0x2749('0x5')]][_0x2749('0x24')]));}else{utils['info'](util[_0x2749('0x3')](_0x2749('0x26'),_0x112e09[_0x2749('0x5')],_0x112e09[_0x2749('0x22')]));}}}catch(_0x1258e7){utils['error'](util[_0x2749('0x3')](_0x2749('0x21'),_0x112e09[_0x2749('0x5')]),_0x1258e7);}};exports[_0x2749('0x27')]=function(_0x35dac3){try{if(!_[_0x2749('0x1c')](dials[_0x35dac3[_0x2749('0x5')]])){utils[_0x2749('0xb')](util[_0x2749('0x3')](_0x2749('0x28'),_0x35dac3[_0x2749('0x5')]),_0x35dac3);utils['info'](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x35dac3['uniqueid'],_0x35dac3[_0x2749('0x8')],_0x35dac3['calleridname'],_0x35dac3[_0x2749('0x29')]));dials[_0x35dac3[_0x2749('0x5')]]=_[_0x2749('0x1d')](dials[_0x35dac3[_0x2749('0x5')]],{'endtime':utils[_0x2749('0x1f')](),'lastevent':'complete'});dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x2a')]=utils[_0x2749('0x2b')](dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x2c')],dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x1e')]);dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x2d')]=utils['diffTime'](dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x24')]||dials[_0x35dac3['uniqueid']]['endtime'],dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x1e')]);dials[_0x35dac3['uniqueid']]['billableseconds']=dials[_0x35dac3[_0x2749('0x5')]]['answertime']?utils[_0x2749('0x2b')](dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x2c')],dials[_0x35dac3[_0x2749('0x5')]][_0x2749('0x24')]):0x0;writeDB(dials[_0x35dac3[_0x2749('0x5')]]);}}catch(_0x987022){utils[_0x2749('0x15')](util[_0x2749('0x3')](_0x2749('0x28'),_0x35dac3[_0x2749('0x5')]),_0x987022);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5389b7b..a0d8fa9 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 _0x3693=['fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','debug','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x3693,0xb8));var _0x3369=function(_0x25e6f2,_0x4f991e){_0x25e6f2=_0x25e6f2-0x0;var _0xd6de90=_0x3693[_0x25e6f2];return _0xd6de90;};var AsteriskManager=require(_0x3369('0x0'));var config=require('../../config/environment');var utils=require(_0x3369('0x1'));var util=require(_0x3369('0x2'));var isXDREnabled=config[_0x3369('0x3')]&&config[_0x3369('0x3')][_0x3369('0x4')]?!config[_0x3369('0x3')][_0x3369('0x4')]:!![];var isProduction=config[_0x3369('0x5')]===_0x3369('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x3369('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0x3369('0x7')]['ip'],config[_0x3369('0x7')]['username'],config[_0x3369('0x7')][_0x3369('0x8')],!![]);ami[_0x3369('0x9')]();if(!isXDREnabled){utils[_0x3369('0xa')](_0x3369('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x3369('0xa')](_0x3369('0xc'));}else{var agents=require(_0x3369('0xd'));var calls=require(_0x3369('0xe'));var queues=require('./queues.controller');var recordings=require(_0x3369('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x3369('0x10'));var core=require(_0x3369('0x11'));ami['on'](_0x3369('0x12'),core[_0x3369('0x12')]);ami['on'](_0x3369('0x13'),core[_0x3369('0x13')]);ami['on'](_0x3369('0x14'),core[_0x3369('0x14')]);ami['on'](_0x3369('0x15'),core['error']);ami['on'](_0x3369('0x16'),core[_0x3369('0x16')]);ami['on'](_0x3369('0x17'),core[_0x3369('0x17')]);ami['on'](_0x3369('0x18'),function(_0x43b464){try{utils['debug'](util['format'](_0x3369('0x19'),_0x43b464[_0x3369('0x1a')]),_0x43b464);members[_0x3369('0x18')](_0x43b464);}catch(_0x3aa3d9){utils[_0x3369('0x15')](util['format'](_0x3369('0x19'),_0x43b464[_0x3369('0x1a')]),_0x3aa3d9);}});ami['on'](_0x3369('0x1b'),function(_0x33bc69){try{utils['debug'](util[_0x3369('0x1c')](_0x3369('0x1d'),_0x33bc69[_0x3369('0x1e')]),_0x33bc69);agents[_0x3369('0x1b')](_0x33bc69);}catch(_0x1e58e0){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x1d'),_0x33bc69[_0x3369('0x1e')]),_0x1e58e0);}});ami['on']('agentringnoanswer',function(_0x20c358){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')]('[%s][index][agentringnoanswer]',_0x20c358[_0x3369('0x1e')]),_0x20c358);agents[_0x3369('0x20')](_0x20c358);}catch(_0x2c53b5){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x21'),_0x20c358['uniqueid']),_0x2c53b5);}});ami['on'](_0x3369('0x22'),function(_0x238249){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x23'),_0x238249['uniqueid']),_0x238249);agents[_0x3369('0x22')](_0x238249);queues[_0x3369('0x22')](_0x238249);}catch(_0x2cdbef){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x23'),_0x238249['uniqueid']),_0x2cdbef);}});ami['on']('agentcomplete',function(_0x1f4eb5){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x24'),_0x1f4eb5['uniqueid']),_0x1f4eb5);agents['agentcomplete'](_0x1f4eb5);queues[_0x3369('0x25')](_0x1f4eb5);members[_0x3369('0x25')](_0x1f4eb5);}catch(_0xf98b33){utils[_0x3369('0x15')](util['format'](_0x3369('0x24'),_0x1f4eb5[_0x3369('0x1e')]),_0xf98b33);}});ami['on'](_0x3369('0x26'),function(_0x5e20b9){try{utils[_0x3369('0x1f')](util['format'](_0x3369('0x27'),_0x5e20b9['uniqueid']),_0x5e20b9);agents[_0x3369('0x26')](_0x5e20b9);queues[_0x3369('0x26')](_0x5e20b9);}catch(_0x457774){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x27'),_0x5e20b9[_0x3369('0x1e')]),_0x457774);}});ami['on'](_0x3369('0x28'),function(_0x5bf083){try{utils['debug'](util[_0x3369('0x1c')](_0x3369('0x29'),_0x5bf083[_0x3369('0x1e')]),_0x5bf083);queues[_0x3369('0x28')](_0x5bf083);recordings[_0x3369('0x28')](_0x5bf083);}catch(_0x436ecb){utils[_0x3369('0x15')](util['format']('[%s][index][queuecallerjoin]',_0x5bf083[_0x3369('0x1e')]),_0x436ecb);}});ami['on'](_0x3369('0x2a'),function(_0x463ae8){try{utils['debug'](util['format'](_0x3369('0x2b'),_0x463ae8['uniqueid']),_0x463ae8);queues[_0x3369('0x2a')](_0x463ae8);}catch(_0x35256b){utils['error'](util[_0x3369('0x1c')](_0x3369('0x2b'),_0x463ae8[_0x3369('0x1e')]),_0x35256b);}});ami['on'](_0x3369('0x2c'),function(_0x29b996){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x2d'),_0x29b996['uniqueid']),_0x29b996);queues[_0x3369('0x2c')](_0x29b996);calls[_0x3369('0x2c')](_0x29b996);}catch(_0x20430f){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x2d'),_0x29b996[_0x3369('0x1e')]),_0x20430f);}});ami['on']('musiconholdstop',function(_0x41646a){try{utils[_0x3369('0x1f')](util['format'](_0x3369('0x2e'),_0x41646a[_0x3369('0x1e')]),_0x41646a);queues[_0x3369('0x2f')](_0x41646a);calls[_0x3369('0x2f')](_0x41646a);}catch(_0x50f241){utils[_0x3369('0x15')](util['format'](_0x3369('0x2e'),_0x41646a[_0x3369('0x1e')]),_0x50f241);}});ami['on']('newstate',function(_0x2271a0){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x30'),_0x2271a0['uniqueid']),_0x2271a0);calls[_0x3369('0x31')](_0x2271a0);recordings[_0x3369('0x31')](_0x2271a0);}catch(_0x357a7e){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x30'),_0x2271a0['uniqueid']),_0x357a7e);}});ami['on'](_0x3369('0x32'),function(_0x11f196){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x33'),_0x11f196[_0x3369('0x1e')]),_0x11f196);calls[_0x3369('0x32')](_0x11f196);recordings[_0x3369('0x32')](_0x11f196);dials['hangup'](_0x11f196);agents[_0x3369('0x32')](_0x11f196);queues['hangup'](_0x11f196);}catch(_0xf148c1){utils['error'](util['format'](_0x3369('0x33'),_0x11f196['uniqueid']),_0xf148c1);}});ami['on']('cdr',function(_0x121a10){try{utils[_0x3369('0x1f')](util['format'](_0x3369('0x34'),_0x121a10['uniqueid']),_0x121a10);members[_0x3369('0x35')](_0x121a10);}catch(_0x471d3f){utils[_0x3369('0x15')](util['format'](_0x3369('0x34'),_0x121a10[_0x3369('0x1e')]),_0x471d3f);}});ami['on'](_0x3369('0x36'),function(_0x8f7892){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')]('[%s][index][blindtransfer]',_0x8f7892['uniqueid']),_0x8f7892);queues[_0x3369('0x36')](_0x8f7892);agents[_0x3369('0x36')](_0x8f7892);transfers[_0x3369('0x36')](_0x8f7892);recordings['blindtransfer'](_0x8f7892);}catch(_0x2c65e7){utils[_0x3369('0x15')](util['format'](_0x3369('0x37'),_0x8f7892[_0x3369('0x1e')]),_0x2c65e7);}});ami['on'](_0x3369('0x38'),function(_0x2d4004){try{utils['debug'](util[_0x3369('0x1c')](_0x3369('0x39'),_0x2d4004[_0x3369('0x3a')]),_0x2d4004);queues[_0x3369('0x38')](_0x2d4004);transfers[_0x3369('0x38')](_0x2d4004);agents[_0x3369('0x38')](_0x2d4004);calls[_0x3369('0x38')](_0x2d4004);}catch(_0x1320d7){utils[_0x3369('0x15')](util[_0x3369('0x1c')]('[%s][index][attendedtransfer]',_0x2d4004['origtransfereruniqueid']),_0x1320d7);}});ami['on']('varset',function(_0x86497a){try{utils['debug'](util[_0x3369('0x1c')](_0x3369('0x3b'),_0x86497a[_0x3369('0x1e')]),_0x86497a);queues[_0x3369('0x3c')](_0x86497a);recordings[_0x3369('0x3c')](_0x86497a);calls['varset'](_0x86497a);dials[_0x3369('0x3c')](_0x86497a);}catch(_0x1f6d02){utils[_0x3369('0x15')](util['format'](_0x3369('0x3b'),_0x86497a['uniqueid']),_0x1f6d02);}});ami['on'](_0x3369('0x3d'),function(_0x8fc02b){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')](_0x3369('0x3e'),_0x8fc02b[_0x3369('0x1e')]),_0x8fc02b);calls['newexten'](_0x8fc02b);recordings[_0x3369('0x3d')](_0x8fc02b);dials[_0x3369('0x3d')](_0x8fc02b);}catch(_0x3c54e5){utils[_0x3369('0x15')](util['format'](_0x3369('0x3e'),_0x8fc02b[_0x3369('0x1e')]),_0x3c54e5);}});ami['on'](_0x3369('0x3f'),function(_0x4d7bf7){try{utils[_0x3369('0x1f')](util['format'](_0x3369('0x40'),_0x4d7bf7[_0x3369('0x1e')]),_0x4d7bf7);calls[_0x3369('0x3f')](_0x4d7bf7);recordings[_0x3369('0x3f')](_0x4d7bf7);}catch(_0x2e2b68){utils[_0x3369('0x15')](util[_0x3369('0x1c')]('[%s][index][newchannel]',_0x4d7bf7[_0x3369('0x1e')]),_0x2e2b68);}});ami['on'](_0x3369('0x41'),function(_0x2e2f5c){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')]('[%s][index][dialbegin]',_0x2e2f5c[_0x3369('0x1e')]),_0x2e2f5c);dials[_0x3369('0x41')](_0x2e2f5c);}catch(_0x2a4cce){utils[_0x3369('0x15')](util[_0x3369('0x1c')](_0x3369('0x42'),_0x2e2f5c[_0x3369('0x1e')]),_0x2a4cce);}});ami['on']('dialend',function(_0x7ac0a6){try{utils[_0x3369('0x1f')](util[_0x3369('0x1c')]('[%s][index][dialend]',_0x7ac0a6[_0x3369('0x1e')]),_0x7ac0a6);dials['dialend'](_0x7ac0a6);}catch(_0x50cdc9){utils['error'](util['format'](_0x3369('0x43'),_0x7ac0a6[_0x3369('0x1e')]),_0x50cdc9);}});} \ No newline at end of file +var _0x9e7a=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x31912d,_0x2b19e3){var _0x33a939=function(_0x228d92){while(--_0x228d92){_0x31912d['push'](_0x31912d['shift']());}};_0x33a939(++_0x2b19e3);}(_0x9e7a,0x16d));var _0xa9e7=function(_0xea4a44,_0x59d454){_0xea4a44=_0xea4a44-0x0;var _0x224a2d=_0x9e7a[_0xea4a44];return _0x224a2d;};var AsteriskManager=require(_0xa9e7('0x0'));var config=require('../../config/environment');var utils=require(_0xa9e7('0x1'));var util=require(_0xa9e7('0x2'));var isXDREnabled=config[_0xa9e7('0x3')]&&config[_0xa9e7('0x3')][_0xa9e7('0x4')]?!config[_0xa9e7('0x3')]['disabled']:!![];var isProduction=config[_0xa9e7('0x5')]===_0xa9e7('0x6')||![];var isLocalAsterisk=config[_0xa9e7('0x3')]&&config[_0xa9e7('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xa9e7('0x7')][_0xa9e7('0x8')],config[_0xa9e7('0x7')]['ip'],config[_0xa9e7('0x7')][_0xa9e7('0x9')],config[_0xa9e7('0x7')][_0xa9e7('0xa')],!![]);ami[_0xa9e7('0xb')]();if(!isXDREnabled){utils[_0xa9e7('0xc')](_0xa9e7('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0xa9e7('0xe'));var queues=require('./queues.controller');var recordings=require(_0xa9e7('0xf'));var members=require(_0xa9e7('0x10'));var dials=require('./dials.controller');var transfers=require(_0xa9e7('0x11'));var core=require('./core.controller');ami['on'](_0xa9e7('0x12'),core[_0xa9e7('0x12')]);ami['on']('shutdown',core[_0xa9e7('0x13')]);ami['on']('fullybooted',core[_0xa9e7('0x14')]);ami['on']('error',core[_0xa9e7('0x15')]);ami['on'](_0xa9e7('0x16'),core[_0xa9e7('0x16')]);ami['on'](_0xa9e7('0x17'),core[_0xa9e7('0x17')]);ami['on'](_0xa9e7('0x18'),function(_0xb8a2dc){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x1b'),_0xb8a2dc[_0xa9e7('0x1c')]),_0xb8a2dc);members[_0xa9e7('0x18')](_0xb8a2dc);}catch(_0x490ab7){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x1b'),_0xb8a2dc['device']),_0x490ab7);}});ami['on'](_0xa9e7('0x1d'),function(_0x10a48f){try{utils[_0xa9e7('0x19')](util['format'](_0xa9e7('0x1e'),_0x10a48f[_0xa9e7('0x1f')]),_0x10a48f);agents[_0xa9e7('0x1d')](_0x10a48f);}catch(_0x2962c1){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x1e'),_0x10a48f[_0xa9e7('0x1f')]),_0x2962c1);}});ami['on']('agentringnoanswer',function(_0x44bf94){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x20'),_0x44bf94[_0xa9e7('0x1f')]),_0x44bf94);agents[_0xa9e7('0x21')](_0x44bf94);}catch(_0x2f7ea8){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')]('[%s][index][agentringnoanswer]',_0x44bf94['uniqueid']),_0x2f7ea8);}});ami['on']('agentconnect',function(_0x316002){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')]('[%s][index][agentconnect]',_0x316002['uniqueid']),_0x316002);agents[_0xa9e7('0x22')](_0x316002);queues[_0xa9e7('0x22')](_0x316002);}catch(_0x2861d7){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')]('[%s][index][agentconnect]',_0x316002[_0xa9e7('0x1f')]),_0x2861d7);}});ami['on'](_0xa9e7('0x23'),function(_0xe531d1){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x24'),_0xe531d1[_0xa9e7('0x1f')]),_0xe531d1);agents['agentcomplete'](_0xe531d1);queues[_0xa9e7('0x23')](_0xe531d1);members[_0xa9e7('0x23')](_0xe531d1);}catch(_0x2781af){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x24'),_0xe531d1[_0xa9e7('0x1f')]),_0x2781af);}});ami['on'](_0xa9e7('0x25'),function(_0xf29a40){try{utils[_0xa9e7('0x19')](util['format']('[%s][index][queuecallerabandon]',_0xf29a40[_0xa9e7('0x1f')]),_0xf29a40);agents[_0xa9e7('0x25')](_0xf29a40);queues[_0xa9e7('0x25')](_0xf29a40);}catch(_0x333bbe){utils[_0xa9e7('0x15')](util['format'](_0xa9e7('0x26'),_0xf29a40[_0xa9e7('0x1f')]),_0x333bbe);}});ami['on'](_0xa9e7('0x27'),function(_0x5057a7){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x28'),_0x5057a7[_0xa9e7('0x1f')]),_0x5057a7);queues[_0xa9e7('0x27')](_0x5057a7);recordings[_0xa9e7('0x27')](_0x5057a7);}catch(_0x25745a){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x28'),_0x5057a7[_0xa9e7('0x1f')]),_0x25745a);}});ami['on'](_0xa9e7('0x29'),function(_0xa69860){try{utils['debug'](util[_0xa9e7('0x1a')](_0xa9e7('0x2a'),_0xa69860[_0xa9e7('0x1f')]),_0xa69860);queues[_0xa9e7('0x29')](_0xa69860);}catch(_0xd4d2c5){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x2a'),_0xa69860[_0xa9e7('0x1f')]),_0xd4d2c5);}});ami['on'](_0xa9e7('0x2b'),function(_0x47f056){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x2c'),_0x47f056[_0xa9e7('0x1f')]),_0x47f056);queues[_0xa9e7('0x2b')](_0x47f056);calls['musiconholdstart'](_0x47f056);}catch(_0x599f95){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x2c'),_0x47f056[_0xa9e7('0x1f')]),_0x599f95);}});ami['on']('musiconholdstop',function(_0xda6d28){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')]('[%s][index][musiconholdstop]',_0xda6d28['uniqueid']),_0xda6d28);queues[_0xa9e7('0x2d')](_0xda6d28);calls[_0xa9e7('0x2d')](_0xda6d28);}catch(_0xe0584c){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x2e'),_0xda6d28['uniqueid']),_0xe0584c);}});ami['on'](_0xa9e7('0x2f'),function(_0x3648f3){try{utils['debug'](util[_0xa9e7('0x1a')]('[%s][index][newstate]',_0x3648f3['uniqueid']),_0x3648f3);calls[_0xa9e7('0x2f')](_0x3648f3);recordings[_0xa9e7('0x2f')](_0x3648f3);}catch(_0x3291b3){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x30'),_0x3648f3['uniqueid']),_0x3291b3);}});ami['on'](_0xa9e7('0x31'),function(_0x21df2b){try{utils['debug'](util[_0xa9e7('0x1a')](_0xa9e7('0x32'),_0x21df2b[_0xa9e7('0x1f')]),_0x21df2b);calls['hangup'](_0x21df2b);recordings[_0xa9e7('0x31')](_0x21df2b);dials[_0xa9e7('0x31')](_0x21df2b);agents['hangup'](_0x21df2b);queues['hangup'](_0x21df2b);}catch(_0x38c905){utils['error'](util['format'](_0xa9e7('0x32'),_0x21df2b[_0xa9e7('0x1f')]),_0x38c905);}});ami['on'](_0xa9e7('0x33'),function(_0x3dc53c){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')]('[%s][index][cdr]',_0x3dc53c[_0xa9e7('0x1f')]),_0x3dc53c);members[_0xa9e7('0x33')](_0x3dc53c);}catch(_0x56aac9){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')]('[%s][index][cdr]',_0x3dc53c[_0xa9e7('0x1f')]),_0x56aac9);}});ami['on']('blindtransfer',function(_0x576414){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x34'),_0x576414[_0xa9e7('0x1f')]),_0x576414);queues['blindtransfer'](_0x576414);agents[_0xa9e7('0x35')](_0x576414);transfers[_0xa9e7('0x35')](_0x576414);recordings['blindtransfer'](_0x576414);}catch(_0x29eca3){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x34'),_0x576414[_0xa9e7('0x1f')]),_0x29eca3);}});ami['on'](_0xa9e7('0x36'),function(_0x55c0b1){try{utils[_0xa9e7('0x19')](util['format'](_0xa9e7('0x37'),_0x55c0b1[_0xa9e7('0x38')]),_0x55c0b1);queues[_0xa9e7('0x36')](_0x55c0b1);transfers['attendedtransfer'](_0x55c0b1);agents['attendedtransfer'](_0x55c0b1);calls[_0xa9e7('0x36')](_0x55c0b1);}catch(_0x2044a1){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')]('[%s][index][attendedtransfer]',_0x55c0b1[_0xa9e7('0x38')]),_0x2044a1);}});ami['on'](_0xa9e7('0x39'),function(_0x54edd6){try{utils[_0xa9e7('0x19')](util[_0xa9e7('0x1a')](_0xa9e7('0x3a'),_0x54edd6[_0xa9e7('0x1f')]),_0x54edd6);queues[_0xa9e7('0x39')](_0x54edd6);recordings[_0xa9e7('0x39')](_0x54edd6);calls[_0xa9e7('0x39')](_0x54edd6);dials['varset'](_0x54edd6);}catch(_0x21a50b){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')](_0xa9e7('0x3a'),_0x54edd6[_0xa9e7('0x1f')]),_0x21a50b);}});ami['on']('newexten',function(_0x5368a8){try{utils[_0xa9e7('0x19')](util['format'](_0xa9e7('0x3b'),_0x5368a8['uniqueid']),_0x5368a8);calls[_0xa9e7('0x3c')](_0x5368a8);recordings[_0xa9e7('0x3c')](_0x5368a8);dials[_0xa9e7('0x3c')](_0x5368a8);}catch(_0x3cbef9){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x3b'),_0x5368a8['uniqueid']),_0x3cbef9);}});ami['on'](_0xa9e7('0x3d'),function(_0x5482cb){try{utils['debug'](util['format'](_0xa9e7('0x3e'),_0x5482cb['uniqueid']),_0x5482cb);calls[_0xa9e7('0x3d')](_0x5482cb);recordings[_0xa9e7('0x3d')](_0x5482cb);}catch(_0xbbd360){utils[_0xa9e7('0x15')](util[_0xa9e7('0x1a')]('[%s][index][newchannel]',_0x5482cb[_0xa9e7('0x1f')]),_0xbbd360);}});ami['on']('dialbegin',function(_0x517c51){try{utils['debug'](util[_0xa9e7('0x1a')](_0xa9e7('0x3f'),_0x517c51[_0xa9e7('0x1f')]),_0x517c51);dials[_0xa9e7('0x40')](_0x517c51);}catch(_0x171e3){utils['error'](util['format'](_0xa9e7('0x41'),_0x517c51[_0xa9e7('0x1f')]),_0x171e3);}});ami['on'](_0xa9e7('0x42'),function(_0x5993c3){try{utils['debug'](util[_0xa9e7('0x1a')](_0xa9e7('0x43'),_0x5993c3[_0xa9e7('0x1f')]),_0x5993c3);dials[_0xa9e7('0x42')](_0x5993c3);}catch(_0x2bd647){utils['error'](util[_0xa9e7('0x1a')](_0xa9e7('0x43'),_0x5993c3[_0xa9e7('0x1f')]),_0x2bd647);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7ecff75..5a0f27b 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 _0x6364=['[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','then','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','debug','[%s][members][cdr]','data1','source','data3'];(function(_0x39a5b4,_0x5e60c7){var _0x1200dd=function(_0x3ba066){while(--_0x3ba066){_0x39a5b4['push'](_0x39a5b4['shift']());}};_0x1200dd(++_0x5e60c7);}(_0x6364,0x8f));var _0x4636=function(_0x547c89,_0x17d597){_0x547c89=_0x547c89-0x0;var _0x186d5a=_0x6364[_0x547c89];return _0x186d5a;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x4636('0x0'));var members={};var exclude=[_0x4636('0x1'),_0x4636('0x2')];function writeDB(_0x17b25f){utils[_0x4636('0x3')](util[_0x4636('0x4')](_0x4636('0x5'),_0x17b25f[_0x4636('0x6')],_0x17b25f['interface'],_0x17b25f[_0x4636('0x7')],_0x17b25f[_0x4636('0x8')],_0x17b25f[_0x4636('0x9')],_0x17b25f[_0x4636('0xa')]));if(_0x17b25f[_0x4636('0xb')]){utils['getUserByInterface'](_0x17b25f[_0x4636('0xb')])[_0x4636('0xc')](function(_0x122d94){if(_0x122d94){_0x17b25f[_0x4636('0x9')]=_0x122d94['name'];_0x17b25f[_0x4636('0xd')]=_0x122d94[_0x4636('0xd')];utils[_0x4636('0xe')](_0x4636('0xf'),_0x17b25f);}else{utils[_0x4636('0x10')](_0x17b25f['interface'][_0x4636('0x11')]('/')[0x1])[_0x4636('0xc')](function(_0xbcc1b6){if(_0xbcc1b6){_0x17b25f[_0x4636('0x9')]=_0xbcc1b6['name'];_0x17b25f[_0x4636('0xd')]=_0xbcc1b6[_0x4636('0xd')];utils[_0x4636('0xe')](_0x4636('0xf'),_0x17b25f);}});}})[_0x4636('0x12')](function(_0x4e478d){utils['error'](util[_0x4636('0x4')](_0x4636('0x13'),_0x17b25f[_0x4636('0x6')]),_0x4e478d);});}delete members[_0x17b25f[_0x4636('0xb')]];}function startsWith(_0x495fb9,_0x1e432f){return _[_0x4636('0x14')](_0x495fb9,function(_0x20859a){return _[_0x4636('0x15')](_0x1e432f,_0x20859a);});}exports[_0x4636('0x16')]=function(_0x216748){try{utils['debug'](util[_0x4636('0x4')](_0x4636('0x17'),members[_0x216748[_0x4636('0x18')]]?members[_0x216748[_0x4636('0x18')]]['uniqueid']:_0x216748[_0x4636('0x18')]),_0x216748);utils['info'](util['format'](_0x4636('0x19'),members[_0x216748[_0x4636('0x18')]]?members[_0x216748['device']][_0x4636('0x6')]:_0x216748[_0x4636('0x18')],_0x216748['state'],_0x216748[_0x4636('0x18')]));switch(_0x216748[_0x4636('0x1a')]){case'INUSE':case _0x4636('0x1b'):if(!startsWith(exclude,_0x216748[_0x4636('0x18')])){members[_0x216748[_0x4636('0x18')]]={'channel':'voice','interface':_0x216748[_0x4636('0x18')],'type':'TALKING','enterAt':utils[_0x4636('0x1c')](),'role':_0x4636('0x1d')};}break;case _0x4636('0x1e'):if(!_[_0x4636('0x1f')](members[_0x216748[_0x4636('0x18')]])){members[_0x216748[_0x4636('0x18')]][_0x4636('0x20')]=utils[_0x4636('0x1c')]();members[_0x216748[_0x4636('0x18')]][_0x4636('0x21')]=utils[_0x4636('0x22')](members[_0x216748[_0x4636('0x18')]][_0x4636('0x20')],members[_0x216748[_0x4636('0x18')]][_0x4636('0x23')]);if(members[_0x216748[_0x4636('0x18')]][_0x4636('0x6')]){writeDB(members[_0x216748[_0x4636('0x18')]]);}}break;default:break;}}catch(_0x2d4df5){utils[_0x4636('0x24')](util['format'](_0x4636('0x17'),members[_0x216748['device']]?members[_0x216748[_0x4636('0x18')]][_0x4636('0x6')]:_0x216748[_0x4636('0x18')]),_0x2d4df5);}};exports['agentcomplete']=function(_0x5e163c){try{if(!_['isNil'](members[_0x5e163c[_0x4636('0xb')]])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x5e163c[_0x4636('0x6')]),_0x5e163c);utils['info'](util['format'](_0x4636('0x25'),_0x5e163c['uniqueid'],_0x5e163c[_0x4636('0xb')],_0x5e163c[_0x4636('0x26')]));members[_0x5e163c[_0x4636('0xb')]]=_[_0x4636('0x27')](members[_0x5e163c[_0x4636('0xb')]],{'data4':_0x5e163c[_0x4636('0x26')],'uniqueid':_0x5e163c[_0x4636('0x6')]});}}catch(_0x5e8e13){utils[_0x4636('0x24')](util[_0x4636('0x4')]('[%s][members][agentcomplete]',_0x5e163c[_0x4636('0x6')]),_0x5e8e13);}};exports['cdr']=function(_0x187316){try{utils[_0x4636('0x28')](util['format'](_0x4636('0x29'),_0x187316[_0x4636('0x6')]),_0x187316);if(_0x187316[_0x4636('0x7')]){var _0x481a0c=_0x187316[_0x4636('0x7')][_0x4636('0x11')]('-')[0x0];if(!_[_0x4636('0x1f')](members[_0x481a0c])){members[_0x481a0c]=_[_0x4636('0x27')](members[_0x481a0c],{'data1':members[_0x481a0c][_0x4636('0x2a')]||_0x187316['type'],'data2':members[_0x481a0c][_0x4636('0x8')]||_0x187316[_0x4636('0x2b')],'data3':members[_0x481a0c][_0x4636('0x2c')]||_0x187316['destination'],'uniqueid':members[_0x481a0c]['uniqueid']||_0x187316[_0x4636('0x6')]});utils[_0x4636('0x3')](util['format'](_0x4636('0x2d'),_0x187316[_0x4636('0x6')],members[_0x481a0c][_0x4636('0x2a')],members[_0x481a0c]['data2'],members[_0x481a0c][_0x4636('0x2c')]));if(members[_0x481a0c]['exitAt']){writeDB(members[_0x481a0c]);}}}if(_0x187316[_0x4636('0x2e')]){var _0x357372=_0x187316[_0x4636('0x2e')][_0x4636('0x11')]('-')[0x0];if(!_[_0x4636('0x1f')](members[_0x357372])){members[_0x357372]=_[_0x4636('0x27')](members[_0x357372],{'data1':members[_0x357372][_0x4636('0x2a')]||_0x187316[_0x4636('0xa')],'data2':members[_0x357372]['data2']||_0x187316['source'],'data3':members[_0x357372][_0x4636('0x2c')]||_0x187316['destination'],'uniqueid':members[_0x357372][_0x4636('0x6')]||_0x187316['uniqueid']});utils[_0x4636('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x187316[_0x4636('0x6')],members[_0x357372][_0x4636('0x2a')],members[_0x357372][_0x4636('0x8')],members[_0x357372][_0x4636('0x2c')]));if(members[_0x357372][_0x4636('0x20')]){writeDB(members[_0x357372]);}}}}catch(_0x1c2c0b){utils['error'](util['format'](_0x4636('0x29'),_0x187316[_0x4636('0x6')]),_0x1c2c0b);}}; \ No newline at end of file +var _0xf6a6=['Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','type','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','./utils','Local/_attended@transfer'];(function(_0x3a59fe,_0xab4b2f){var _0x1b8e2f=function(_0x19886a){while(--_0x19886a){_0x3a59fe['push'](_0x3a59fe['shift']());}};_0x1b8e2f(++_0xab4b2f);}(_0xf6a6,0x147));var _0x6f6a=function(_0x37f59f,_0x541e56){_0x37f59f=_0x37f59f-0x0;var _0x14a696=_0xf6a6[_0x37f59f];return _0x14a696;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6f6a('0x0'));var members={};var exclude=[_0x6f6a('0x1'),_0x6f6a('0x2')];function writeDB(_0x1dfe34){utils[_0x6f6a('0x3')](util[_0x6f6a('0x4')](_0x6f6a('0x5'),_0x1dfe34[_0x6f6a('0x6')],_0x1dfe34['interface'],_0x1dfe34['channel'],_0x1dfe34[_0x6f6a('0x7')],_0x1dfe34['membername'],_0x1dfe34[_0x6f6a('0x8')]));if(_0x1dfe34[_0x6f6a('0x9')]){utils[_0x6f6a('0xa')](_0x1dfe34[_0x6f6a('0x9')])[_0x6f6a('0xb')](function(_0x3dbea5){if(_0x3dbea5){_0x1dfe34[_0x6f6a('0xc')]=_0x3dbea5[_0x6f6a('0xd')];_0x1dfe34['internal']=_0x3dbea5[_0x6f6a('0xe')];utils[_0x6f6a('0xf')](_0x6f6a('0x10'),_0x1dfe34);}else{utils[_0x6f6a('0x11')](_0x1dfe34[_0x6f6a('0x9')][_0x6f6a('0x12')]('/')[0x1])[_0x6f6a('0xb')](function(_0x1bcc47){if(_0x1bcc47){_0x1dfe34[_0x6f6a('0xc')]=_0x1bcc47[_0x6f6a('0xd')];_0x1dfe34[_0x6f6a('0xe')]=_0x1bcc47['internal'];utils[_0x6f6a('0xf')](_0x6f6a('0x10'),_0x1dfe34);}});}})[_0x6f6a('0x13')](function(_0x22b683){utils[_0x6f6a('0x14')](util[_0x6f6a('0x4')]('[%s][members][writeDB]',_0x1dfe34['uniqueid']),_0x22b683);});}delete members[_0x1dfe34[_0x6f6a('0x9')]];}function startsWith(_0x57d2a0,_0x2ef149){return _['some'](_0x57d2a0,function(_0x51a3be){return _[_0x6f6a('0x15')](_0x2ef149,_0x51a3be);});}exports['devicestatechange']=function(_0x2e2ac5){try{utils[_0x6f6a('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x2e2ac5[_0x6f6a('0x17')]]?members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x6')]:_0x2e2ac5[_0x6f6a('0x17')]),_0x2e2ac5);utils[_0x6f6a('0x3')](util['format'](_0x6f6a('0x18'),members[_0x2e2ac5[_0x6f6a('0x17')]]?members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x6')]:_0x2e2ac5['device'],_0x2e2ac5['state'],_0x2e2ac5['device']));switch(_0x2e2ac5[_0x6f6a('0x19')]){case'INUSE':case _0x6f6a('0x1a'):if(!startsWith(exclude,_0x2e2ac5[_0x6f6a('0x17')])){members[_0x2e2ac5['device']]={'channel':_0x6f6a('0x1b'),'interface':_0x2e2ac5[_0x6f6a('0x17')],'type':_0x6f6a('0x1c'),'enterAt':utils[_0x6f6a('0x1d')](),'role':_0x6f6a('0x1e')};}break;case _0x6f6a('0x1f'):if(!_[_0x6f6a('0x20')](members[_0x2e2ac5['device']])){members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x21')]=utils[_0x6f6a('0x1d')]();members[_0x2e2ac5['device']]['duration']=utils['diffTime'](members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x21')],members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x22')]);if(members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x6')]){writeDB(members[_0x2e2ac5[_0x6f6a('0x17')]]);}}break;default:break;}}catch(_0x2a4139){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x2e2ac5['device']]?members[_0x2e2ac5[_0x6f6a('0x17')]][_0x6f6a('0x6')]:_0x2e2ac5[_0x6f6a('0x17')]),_0x2a4139);}};exports[_0x6f6a('0x23')]=function(_0x5d2f92){try{if(!_['isNil'](members[_0x5d2f92['interface']])){utils[_0x6f6a('0x16')](util['format']('[%s][members][agentcomplete]',_0x5d2f92['uniqueid']),_0x5d2f92);utils[_0x6f6a('0x3')](util[_0x6f6a('0x4')](_0x6f6a('0x24'),_0x5d2f92[_0x6f6a('0x6')],_0x5d2f92[_0x6f6a('0x9')],_0x5d2f92[_0x6f6a('0x25')]));members[_0x5d2f92[_0x6f6a('0x9')]]=_['assign'](members[_0x5d2f92[_0x6f6a('0x9')]],{'data4':_0x5d2f92[_0x6f6a('0x25')],'uniqueid':_0x5d2f92['uniqueid']});}}catch(_0x315331){utils['error'](util[_0x6f6a('0x4')](_0x6f6a('0x26'),_0x5d2f92['uniqueid']),_0x315331);}};exports[_0x6f6a('0x27')]=function(_0x593d61){try{utils[_0x6f6a('0x16')](util['format'](_0x6f6a('0x28'),_0x593d61['uniqueid']),_0x593d61);if(_0x593d61[_0x6f6a('0x29')]){var _0x2d2f5e=_0x593d61[_0x6f6a('0x29')][_0x6f6a('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2d2f5e])){members[_0x2d2f5e]=_['assign'](members[_0x2d2f5e],{'data1':members[_0x2d2f5e]['data1']||_0x593d61[_0x6f6a('0x8')],'data2':members[_0x2d2f5e]['data2']||_0x593d61['source'],'data3':members[_0x2d2f5e][_0x6f6a('0x2a')]||_0x593d61[_0x6f6a('0x2b')],'uniqueid':members[_0x2d2f5e][_0x6f6a('0x6')]||_0x593d61[_0x6f6a('0x6')]});utils[_0x6f6a('0x3')](util[_0x6f6a('0x4')](_0x6f6a('0x2c'),_0x593d61['uniqueid'],members[_0x2d2f5e]['data1'],members[_0x2d2f5e][_0x6f6a('0x7')],members[_0x2d2f5e][_0x6f6a('0x2a')]));if(members[_0x2d2f5e]['exitAt']){writeDB(members[_0x2d2f5e]);}}}if(_0x593d61[_0x6f6a('0x2d')]){var _0xcb5c9c=_0x593d61[_0x6f6a('0x2d')]['split']('-')[0x0];if(!_[_0x6f6a('0x20')](members[_0xcb5c9c])){members[_0xcb5c9c]=_['assign'](members[_0xcb5c9c],{'data1':members[_0xcb5c9c][_0x6f6a('0x2e')]||_0x593d61[_0x6f6a('0x8')],'data2':members[_0xcb5c9c][_0x6f6a('0x7')]||_0x593d61['source'],'data3':members[_0xcb5c9c][_0x6f6a('0x2a')]||_0x593d61[_0x6f6a('0x2b')],'uniqueid':members[_0xcb5c9c][_0x6f6a('0x6')]||_0x593d61['uniqueid']});utils[_0x6f6a('0x3')](util[_0x6f6a('0x4')](_0x6f6a('0x2c'),_0x593d61['uniqueid'],members[_0xcb5c9c][_0x6f6a('0x2e')],members[_0xcb5c9c][_0x6f6a('0x7')],members[_0xcb5c9c]['data3']));if(members[_0xcb5c9c][_0x6f6a('0x21')]){writeDB(members[_0xcb5c9c]);}}}}catch(_0x2a2df3){utils[_0x6f6a('0x14')](util[_0x6f6a('0x4')](_0x6f6a('0x28'),_0x593d61['uniqueid']),_0x2a2df3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0ed6297..94ed871 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 _0x9055=['holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum'];(function(_0x2d34a6,_0x4adbb0){var _0x341ba0=function(_0x5affbc){while(--_0x5affbc){_0x2d34a6['push'](_0x2d34a6['shift']());}};_0x341ba0(++_0x4adbb0);}(_0x9055,0x9b));var _0x5905=function(_0x1e0bfe,_0x19a453){_0x1e0bfe=_0x1e0bfe-0x0;var _0xb3a289=_0x9055[_0x1e0bfe];return _0xb3a289;};'use strict';var _=require(_0x5905('0x0'));var util=require(_0x5905('0x1'));var utils=require(_0x5905('0x2'));var queues={};function writeDB(_0x2e9cb9){utils[_0x5905('0x3')](util[_0x5905('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2e9cb9[_0x5905('0x5')],_0x2e9cb9['channel'],_0x2e9cb9[_0x5905('0x6')],_0x2e9cb9[_0x5905('0x7')],_0x2e9cb9[_0x5905('0x8')],_0x2e9cb9[_0x5905('0x9')],_0x2e9cb9['queuecallerexitreason']));if(_0x2e9cb9[_0x5905('0x6')]){utils[_0x5905('0xa')](_0x2e9cb9[_0x5905('0x6')])[_0x5905('0xb')](function(_0x24fb81){if(_0x24fb81){_0x2e9cb9[_0x5905('0xc')]=_0x24fb81[_0x5905('0xc')];}utils[_0x5905('0xd')](_0x5905('0xe'),_0x2e9cb9);});}else{utils[_0x5905('0xd')](_0x5905('0xe'),_0x2e9cb9);}if(_0x2e9cb9[_0x5905('0xf')]){delete queues[_0x2e9cb9[_0x5905('0xf')]];}else{delete queues[_0x2e9cb9[_0x5905('0x5')]];}}exports['queuecallerjoin']=function(_0x17db14){try{utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x11'),_0x17db14['uniqueid']),_0x17db14);utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x12'),_0x17db14[_0x5905('0x5')],_0x17db14[_0x5905('0x6')],_0x17db14['position']));queues[_0x17db14['uniqueid']]=_[_0x5905('0x13')](_0x17db14,{'originalposition':_0x17db14[_0x5905('0x14')],'queuecallerjoinAt':utils[_0x5905('0x15')](),'mohtime':0x0});}catch(_0x14c0e5){utils[_0x5905('0x16')](util[_0x5905('0x4')](_0x5905('0x11'),_0x17db14[_0x5905('0x5')]),_0x14c0e5);}};exports[_0x5905('0x17')]=function(_0x1090e2){try{if(!_[_0x5905('0x18')](queues[_0x1090e2[_0x5905('0x5')]])){utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x19'),_0x1090e2[_0x5905('0x5')]),_0x1090e2);if(queues[_0x1090e2['uniqueid']][_0x5905('0x1a')]){if(!queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x1b')]&&!queues[_0x1090e2[_0x5905('0x5')]]['queuecallerexit']){queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x1c')]=!![];queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x1d')]=utils[_0x5905('0x15')]();queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x1e')]=_0x5905('0x1f');}utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x20'),_0x1090e2[_0x5905('0x5')],queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x21')],queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0x1e')]));writeDB(queues[_0x1090e2[_0x5905('0x5')]]);}else if(queues[_0x1090e2['uniqueid']][_0x5905('0xf')]){utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x22'),_0x1090e2['uniqueid'],queues[_0x1090e2['uniqueid']][_0x5905('0x21')],queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0xf')]));queues[queues[_0x1090e2[_0x5905('0x5')]][_0x5905('0xf')]]=queues[_0x1090e2['uniqueid']];queues[queues[_0x1090e2['uniqueid']]['transfereduniqueid']][_0x5905('0x23')]=0x2;delete queues[_0x1090e2[_0x5905('0x5')]];}}}catch(_0x9c96fe){utils[_0x5905('0x16')](util['format'](_0x5905('0x19'),_0x1090e2[_0x5905('0x5')]),_0x9c96fe);}};exports['varset']=function(_0x35e32b){try{utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x24'),_0x35e32b[_0x5905('0x5')]),_0x35e32b);if(!_[_0x5905('0x18')](_0x35e32b[_0x5905('0x25')][_0x5905('0x26')])&&_0x35e32b[_0x5905('0x27')][_0x5905('0x28')]()!==_0x5905('0x29')){if(!_[_0x5905('0x18')](queues[_0x35e32b[_0x5905('0x5')]])){queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x1b')]=![];queues[_0x35e32b['uniqueid']][_0x5905('0x2a')]=null;queues[_0x35e32b[_0x5905('0x5')]]['queuecallerexit']=!![];queues[_0x35e32b['uniqueid']][_0x5905('0x2b')]=utils[_0x5905('0x15')]();queues[_0x35e32b[_0x5905('0x5')]]['queuecallerexitreason']=_0x35e32b[_0x5905('0x27')][_0x5905('0x28')]();utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x2c'),_0x35e32b[_0x5905('0x5')],queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x21')],_0x35e32b[_0x5905('0x27')],queues[_0x35e32b['uniqueid']][_0x5905('0x1e')]));writeDB(queues[_0x35e32b['uniqueid']]);}}else if(!_[_0x5905('0x18')](_0x35e32b[_0x5905('0x25')][_0x5905('0x2d')])){if(!_[_0x5905('0x18')](queues[_0x35e32b[_0x5905('0x5')]])&&!queues[_0x35e32b['uniqueid']]['queuecallerabandon']){queues[_0x35e32b['uniqueid']][_0x5905('0x1b')]=![];queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x2a')]=null;queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x2e')]=!![];queues[_0x35e32b['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x1e')]=_0x5905('0x2f');utils[_0x5905('0x3')](util['format'](_0x5905('0x30'),_0x35e32b['uniqueid'],queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x21')],_0x35e32b[_0x5905('0x27')],queues[_0x35e32b[_0x5905('0x5')]][_0x5905('0x1e')]));}}}catch(_0x372020){utils['error'](util[_0x5905('0x4')](_0x5905('0x24'),_0x35e32b[_0x5905('0x5')]),_0x372020);}};exports[_0x5905('0x1b')]=function(_0x603b6b){try{if(!_[_0x5905('0x18')](queues[_0x603b6b[_0x5905('0x5')]])){utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x31'),_0x603b6b[_0x5905('0x5')]),_0x603b6b);queues[_0x603b6b[_0x5905('0x5')]][_0x5905('0x2e')]=![];queues[_0x603b6b[_0x5905('0x5')]][_0x5905('0x2b')]=null;queues[_0x603b6b['uniqueid']][_0x5905('0x1b')]=!![];queues[_0x603b6b[_0x5905('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x603b6b['uniqueid']][_0x5905('0x1e')]=_0x5905('0x32');utils[_0x5905('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x603b6b[_0x5905('0x5')],queues[_0x603b6b['uniqueid']]['name'],queues[_0x603b6b[_0x5905('0x5')]][_0x5905('0x1e')]));}}catch(_0x5b07c8){utils[_0x5905('0x16')](util[_0x5905('0x4')](_0x5905('0x31'),_0x603b6b[_0x5905('0x5')]),_0x5b07c8);}};exports[_0x5905('0x33')]=function(_0x288399){try{if(!_[_0x5905('0x18')](queues[_0x288399[_0x5905('0x5')]])){utils[_0x5905('0x10')](util['format'](_0x5905('0x34'),_0x288399[_0x5905('0x5')]),_0x288399);utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x35'),_0x288399[_0x5905('0x5')],queues[_0x288399[_0x5905('0x5')]]['name'],_0x288399[_0x5905('0x36')],_0x288399['connectedlinename']));queues[_0x288399['uniqueid']][_0x5905('0x33')]=!![];queues[_0x288399[_0x5905('0x5')]]['queuecallerleaveAt']=utils[_0x5905('0x15')]();queues[_0x288399['uniqueid']][_0x5905('0x37')]=utils[_0x5905('0x38')](queues[_0x288399[_0x5905('0x5')]][_0x5905('0x1a')],queues[_0x288399['uniqueid']][_0x5905('0x39')]);queues[_0x288399[_0x5905('0x5')]][_0x5905('0x14')]=_0x288399[_0x5905('0x14')];queues[_0x288399[_0x5905('0x5')]][_0x5905('0x3a')]=_0x288399[_0x5905('0x3a')];queues[_0x288399[_0x5905('0x5')]][_0x5905('0x36')]=_0x288399[_0x5905('0x36')];queues[_0x288399[_0x5905('0x5')]][_0x5905('0x3b')]=_0x288399[_0x5905('0x3b')];}}catch(_0x2db954){utils['error'](util[_0x5905('0x4')](_0x5905('0x34'),_0x288399[_0x5905('0x5')]),_0x2db954);}};exports[_0x5905('0x3c')]=function(_0x7df00a){try{if(!_[_0x5905('0x18')](queues[_0x7df00a[_0x5905('0x5')]])){utils['debug'](util[_0x5905('0x4')](_0x5905('0x3d'),_0x7df00a[_0x5905('0x5')]),_0x7df00a);utils[_0x5905('0x3')](util[_0x5905('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x7df00a[_0x5905('0x5')],queues[_0x7df00a['uniqueid']][_0x5905('0x21')],_0x7df00a[_0x5905('0x3e')],_0x7df00a[_0x5905('0x3f')]));queues[_0x7df00a['uniqueid']][_0x5905('0x1b')]=![];queues[_0x7df00a[_0x5905('0x5')]][_0x5905('0x1b')]=![];queues[_0x7df00a[_0x5905('0x5')]][_0x5905('0x2a')]=null;queues[_0x7df00a['uniqueid']][_0x5905('0x2e')]=![];queues[_0x7df00a[_0x5905('0x5')]][_0x5905('0x1e')]=null;queues[_0x7df00a[_0x5905('0x5')]][_0x5905('0x2b')]=null;queues[_0x7df00a[_0x5905('0x5')]][_0x5905('0x40')]=!![];queues[_0x7df00a['uniqueid']][_0x5905('0x9')]=_0x7df00a[_0x5905('0x3f')];queues[_0x7df00a['uniqueid']]['lastAssignedTo']=_0x7df00a[_0x5905('0x3e')];}}catch(_0x18f8d3){utils[_0x5905('0x16')](util[_0x5905('0x4')](_0x5905('0x3d'),_0x7df00a['uniqueid']),_0x18f8d3);}};exports[_0x5905('0x41')]=function(_0x2e8784){try{if(!_['isNil'](queues[_0x2e8784['uniqueid']])){if(queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x1a')]){utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x42'),_0x2e8784[_0x5905('0x5')]),_0x2e8784);queues[_0x2e8784[_0x5905('0x5')]]['queuecallerabandon']=![];queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x1b')]=![];queues[_0x2e8784['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x2e')]=![];queues[_0x2e8784['uniqueid']][_0x5905('0x2b')]=null;queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x40')]=!![];queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x7')]=_0x2e8784[_0x5905('0x3e')];queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x1c')]=!![];queues[_0x2e8784[_0x5905('0x5')]]['queuecallercompleteAt']=utils[_0x5905('0x15')]();if(_0x2e8784[_0x5905('0x43')]=='transfer'){if(!queues[_0x2e8784['uniqueid']][_0x5905('0x44')]){queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x1e')]=_0x5905('0x45');}}else{queues[_0x2e8784[_0x5905('0x5')]]['queuecallerexitreason']=_0x5905('0x46')+_0x2e8784[_0x5905('0x43')][_0x5905('0x28')]();}utils[_0x5905('0x3')](util[_0x5905('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2e8784[_0x5905('0x5')],queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x21')],_0x2e8784[_0x5905('0x3e')],queues[_0x2e8784[_0x5905('0x5')]][_0x5905('0x1e')]));writeDB(queues[_0x2e8784[_0x5905('0x5')]]);}}}catch(_0x212b6f){utils['error'](util[_0x5905('0x4')](_0x5905('0x42'),_0x2e8784['uniqueid']),_0x212b6f);}};exports[_0x5905('0x47')]=function(_0x1e6271){try{if(!_[_0x5905('0x18')](queues[_0x1e6271[_0x5905('0x48')]])){utils['debug'](util[_0x5905('0x4')](_0x5905('0x49'),_0x1e6271[_0x5905('0x5')]),_0x1e6271);queues[_0x1e6271['transfereeuniqueid']][_0x5905('0x44')]=!![];queues[_0x1e6271[_0x5905('0x48')]]['transfertype']=_0x5905('0x4a');queues[_0x1e6271['transfereeuniqueid']][_0x5905('0x4b')]=_0x1e6271[_0x5905('0x4c')];queues[_0x1e6271[_0x5905('0x48')]][_0x5905('0x4d')]=_0x1e6271[_0x5905('0x48')];queues[_0x1e6271['transfereeuniqueid']][_0x5905('0x1e')]=_0x5905('0x4e');utils[_0x5905('0x3')](util['format'](_0x5905('0x4f'),_0x1e6271[_0x5905('0x5')],queues[_0x1e6271['transfereeuniqueid']][_0x5905('0x21')],_0x1e6271[_0x5905('0x48')],_0x1e6271['extension']));}}catch(_0x5b1f25){utils['error'](util[_0x5905('0x4')]('[%s][queues][blindtransfer]',_0x1e6271[_0x5905('0x5')]),_0x5b1f25);}};exports['attendedtransfer']=function(_0x11030c){try{utils[_0x5905('0x10')](util['format']('[%s][queues][attendedtransfer]',_0x11030c[_0x5905('0x50')]),_0x11030c);if(_0x11030c[_0x5905('0x50')]==_0x11030c['origtransfererlinkedid']){if(!_[_0x5905('0x18')](queues[_0x11030c[_0x5905('0x51')]])){utils['info'](util[_0x5905('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x11030c[_0x5905('0x50')],queues[_0x11030c['secondtransfererlinkedid']]['name'],_0x11030c[_0x5905('0x52')]));queues[_0x11030c[_0x5905('0x51')]][_0x5905('0x44')]=!![];queues[_0x11030c['secondtransfererlinkedid']][_0x5905('0x53')]=_0x5905('0x54');queues[_0x11030c[_0x5905('0x51')]][_0x5905('0x4b')]=_0x11030c[_0x5905('0x52')];queues[_0x11030c[_0x5905('0x51')]][_0x5905('0x4d')]=_0x11030c[_0x5905('0x50')];queues[_0x11030c[_0x5905('0x51')]][_0x5905('0x1e')]=_0x5905('0x55');}if(!_[_0x5905('0x18')](queues[_0x11030c[_0x5905('0x56')]])){if(_0x11030c[_0x5905('0x57')]&&queues[_0x11030c[_0x5905('0x57')]]){queues[_0x11030c[_0x5905('0x57')]][_0x5905('0x23')]=0x1;queues[_0x11030c[_0x5905('0x48')]]=_[_0x5905('0x58')](queues[_0x11030c[_0x5905('0x57')]]);queues[_0x11030c[_0x5905('0x48')]][_0x5905('0xf')]=_0x11030c['transfertargetuniqueid'];queues[_0x11030c[_0x5905('0x48')]]['queuecallerenterreason']=0x2;queues[_0x11030c['transfereeuniqueid']][_0x5905('0x8')]=queues[_0x11030c['secondtransfererlinkedid']][_0x5905('0x8')];queues[_0x11030c[_0x5905('0x48')]]['calleridname']=queues[_0x11030c[_0x5905('0x51')]][_0x5905('0x59')];queues[_0x11030c['transfereeuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x11030c['transfereeuniqueid']][_0x5905('0x1a')]=utils[_0x5905('0x15')]();queues[_0x11030c['transfereeuniqueid']][_0x5905('0x37')]=0x0;queues[_0x11030c[_0x5905('0x48')]]['mohtime']=0x0;utils[_0x5905('0x3')](util['format'](_0x5905('0x5a'),_0x11030c['origtransfereruniqueid'],queues[_0x11030c[_0x5905('0x48')]]['name'],queues[_0x11030c['transfereeuniqueid']][_0x5905('0x8')],queues[_0x11030c[_0x5905('0x48')]][_0x5905('0x59')]));}else{utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x5b'),_0x11030c[_0x5905('0x50')],queues[_0x11030c[_0x5905('0x56')]][_0x5905('0x21')],_0x11030c[_0x5905('0x51')]));queues[_0x11030c[_0x5905('0x56')]][_0x5905('0xf')]=_0x11030c[_0x5905('0x51')];}}}else if(_0x11030c['secondtransfereruniqueid']==_0x11030c[_0x5905('0x51')]){if(!_[_0x5905('0x18')](queues[_0x11030c['origtransfererlinkedid']])){utils['info'](util[_0x5905('0x4')](_0x5905('0x5c'),_0x11030c['origtransfereruniqueid'],queues[_0x11030c[_0x5905('0x56')]][_0x5905('0x21')],_0x11030c[_0x5905('0x5d')],_0x11030c[_0x5905('0x5e')]));queues[_0x11030c['origtransfererlinkedid']][_0x5905('0x44')]=!![];queues[_0x11030c[_0x5905('0x56')]]['transfertype']=_0x5905('0x54');queues[_0x11030c[_0x5905('0x56')]][_0x5905('0x4b')]=_0x11030c[_0x5905('0x5e')];queues[_0x11030c[_0x5905('0x56')]][_0x5905('0x4d')]=_0x11030c[_0x5905('0x5d')];queues[_0x11030c[_0x5905('0x56')]][_0x5905('0x1e')]=_0x5905('0x55');}if(!_[_0x5905('0x18')](queues[_0x11030c['secondtransfererlinkedid']])){if(_0x11030c[_0x5905('0x5f')]&&queues[_0x11030c[_0x5905('0x5f')]]){queues[_0x11030c[_0x5905('0x5f')]][_0x5905('0x23')]=0x1;queues[_0x11030c[_0x5905('0x60')]]=_[_0x5905('0x58')](queues[_0x11030c[_0x5905('0x5f')]]);queues[_0x11030c['transfertargetuniqueid']][_0x5905('0xf')]=_0x11030c[_0x5905('0x60')];queues[_0x11030c[_0x5905('0x60')]]['queuecallerenterreason']=0x2;queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x8')]=queues[_0x11030c[_0x5905('0x56')]]['calleridnum'];queues[_0x11030c['transfertargetuniqueid']][_0x5905('0x59')]=queues[_0x11030c['origtransfererlinkedid']]['calleridname'];queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x39')]=utils[_0x5905('0x15')]();queues[_0x11030c['transfertargetuniqueid']][_0x5905('0x1a')]=utils[_0x5905('0x15')]();queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x37')]=0x0;queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x61')]=0x0;utils[_0x5905('0x3')](util[_0x5905('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x11030c[_0x5905('0x50')],queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x21')],queues[_0x11030c[_0x5905('0x60')]][_0x5905('0xf')],queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x8')],queues[_0x11030c[_0x5905('0x60')]][_0x5905('0x59')]));}else{utils[_0x5905('0x3')](util['format'](_0x5905('0x5b'),_0x11030c[_0x5905('0x50')],queues[_0x11030c[_0x5905('0x51')]]['name'],_0x11030c[_0x5905('0x56')]));queues[_0x11030c[_0x5905('0x51')]][_0x5905('0xf')]=_0x11030c[_0x5905('0x56')];}}}}catch(_0x49c32e){utils[_0x5905('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x11030c[_0x5905('0x50')]),_0x49c32e);}};exports[_0x5905('0x62')]=function(_0x512d22){try{if(!_[_0x5905('0x18')](queues[_0x512d22[_0x5905('0x5')]])){utils['debug'](util[_0x5905('0x4')](_0x5905('0x63'),_0x512d22[_0x5905('0x5')]),_0x512d22);queues[_0x512d22[_0x5905('0x5')]]['musiconholdstartAt']=utils[_0x5905('0x15')]();utils[_0x5905('0x3')](util['format'](_0x5905('0x64'),_0x512d22['uniqueid'],queues[_0x512d22[_0x5905('0x5')]][_0x5905('0x21')],queues[_0x512d22[_0x5905('0x5')]][_0x5905('0x65')]));}}catch(_0x41c365){utils[_0x5905('0x16')](util[_0x5905('0x4')](_0x5905('0x63'),_0x512d22[_0x5905('0x5')]),_0x41c365);}};exports[_0x5905('0x66')]=function(_0x46a72c){try{if(!_[_0x5905('0x18')](queues[_0x46a72c[_0x5905('0x5')]])){if(!_[_0x5905('0x18')](queues[_0x46a72c[_0x5905('0x5')]][_0x5905('0x65')])){utils[_0x5905('0x10')](util[_0x5905('0x4')](_0x5905('0x67'),_0x46a72c['uniqueid']),_0x46a72c);queues[_0x46a72c[_0x5905('0x5')]][_0x5905('0x61')]+=utils['diffTime'](utils[_0x5905('0x15')](),queues[_0x46a72c[_0x5905('0x5')]][_0x5905('0x65')]);utils[_0x5905('0x3')](util[_0x5905('0x4')](_0x5905('0x68'),_0x46a72c[_0x5905('0x5')],queues[_0x46a72c[_0x5905('0x5')]]['name'],queues[_0x46a72c[_0x5905('0x5')]][_0x5905('0x61')]));delete queues[_0x46a72c[_0x5905('0x5')]][_0x5905('0x65')];}}}catch(_0x186a05){utils[_0x5905('0x16')](util[_0x5905('0x4')]('[%s][queues][musiconholdstop]',_0x46a72c[_0x5905('0x5')]),_0x186a05);}}; \ No newline at end of file +var _0x23b2=['[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','then','type','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup','isNil','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT'];(function(_0x30a608,_0x30c8f5){var _0x208973=function(_0x2482c0){while(--_0x2482c0){_0x30a608['push'](_0x30a608['shift']());}};_0x208973(++_0x30c8f5);}(_0x23b2,0x1d2));var _0x223b=function(_0x4b392f,_0x544a9d){_0x4b392f=_0x4b392f-0x0;var _0x24e7d2=_0x23b2[_0x4b392f];return _0x24e7d2;};'use strict';var _=require('lodash');var util=require(_0x223b('0x0'));var utils=require(_0x223b('0x1'));var queues={};function writeDB(_0x3b96f5){utils[_0x223b('0x2')](util['format'](_0x223b('0x3'),_0x3b96f5['uniqueid'],_0x3b96f5['channel'],_0x3b96f5[_0x223b('0x4')],_0x3b96f5[_0x223b('0x5')],_0x3b96f5[_0x223b('0x6')],_0x3b96f5[_0x223b('0x7')],_0x3b96f5['queuecallerexitreason']));if(_0x3b96f5['queue']){utils['getVoiceQueueByName'](_0x3b96f5[_0x223b('0x4')])[_0x223b('0x8')](function(_0xd95364){if(_0xd95364){_0x3b96f5[_0x223b('0x9')]=_0xd95364['type'];}utils['request'](_0x223b('0xa'),_0x3b96f5);});}else{utils['request'](_0x223b('0xa'),_0x3b96f5);}if(_0x3b96f5[_0x223b('0xb')]){delete queues[_0x3b96f5[_0x223b('0xb')]];}else{delete queues[_0x3b96f5[_0x223b('0xc')]];}}exports[_0x223b('0xd')]=function(_0x54fc8f){try{utils['debug'](util[_0x223b('0xe')](_0x223b('0xf'),_0x54fc8f[_0x223b('0xc')]),_0x54fc8f);utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x10'),_0x54fc8f[_0x223b('0xc')],_0x54fc8f[_0x223b('0x4')],_0x54fc8f['position']));queues[_0x54fc8f[_0x223b('0xc')]]=_[_0x223b('0x11')](_0x54fc8f,{'originalposition':_0x54fc8f['position'],'queuecallerjoinAt':utils[_0x223b('0x12')](),'mohtime':0x0});}catch(_0x30b4db){utils[_0x223b('0x13')](util[_0x223b('0xe')]('[%s][queues][queuecallerjoin]',_0x54fc8f[_0x223b('0xc')]),_0x30b4db);}};exports[_0x223b('0x14')]=function(_0x54287d){try{if(!_[_0x223b('0x15')](queues[_0x54287d['uniqueid']])){utils[_0x223b('0x16')](util[_0x223b('0xe')]('[%s][queues][hangup]',_0x54287d['uniqueid']),_0x54287d);if(queues[_0x54287d[_0x223b('0xc')]]['queuecallerleaveAt']){if(!queues[_0x54287d[_0x223b('0xc')]][_0x223b('0x17')]&&!queues[_0x54287d[_0x223b('0xc')]][_0x223b('0x18')]){queues[_0x54287d['uniqueid']][_0x223b('0x19')]=!![];queues[_0x54287d['uniqueid']][_0x223b('0x1a')]=utils[_0x223b('0x12')]();queues[_0x54287d[_0x223b('0xc')]][_0x223b('0x1b')]=_0x223b('0x1c');}utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x1d'),_0x54287d['uniqueid'],queues[_0x54287d[_0x223b('0xc')]][_0x223b('0x1e')],queues[_0x54287d['uniqueid']][_0x223b('0x1b')]));writeDB(queues[_0x54287d[_0x223b('0xc')]]);}else if(queues[_0x54287d['uniqueid']][_0x223b('0xb')]){utils[_0x223b('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x54287d[_0x223b('0xc')],queues[_0x54287d[_0x223b('0xc')]]['name'],queues[_0x54287d[_0x223b('0xc')]][_0x223b('0xb')]));queues[queues[_0x54287d[_0x223b('0xc')]][_0x223b('0xb')]]=queues[_0x54287d['uniqueid']];queues[queues[_0x54287d[_0x223b('0xc')]][_0x223b('0xb')]][_0x223b('0x1f')]=0x2;delete queues[_0x54287d[_0x223b('0xc')]];}}}catch(_0x25032c){utils[_0x223b('0x13')](util['format'](_0x223b('0x20'),_0x54287d['uniqueid']),_0x25032c);}};exports['varset']=function(_0x4cca79){try{utils['debug'](util[_0x223b('0xe')](_0x223b('0x21'),_0x4cca79['uniqueid']),_0x4cca79);if(!_[_0x223b('0x15')](_0x4cca79['variable']['queuestatus'])&&_0x4cca79['value'][_0x223b('0x22')]()!==_0x223b('0x23')){if(!_[_0x223b('0x15')](queues[_0x4cca79['uniqueid']])){queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x17')]=![];queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x24')]=null;queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x18')]=!![];queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x25')]=utils[_0x223b('0x12')]();queues[_0x4cca79[_0x223b('0xc')]]['queuecallerexitreason']=_0x4cca79[_0x223b('0x26')][_0x223b('0x22')]();utils[_0x223b('0x2')](util['format'](_0x223b('0x27'),_0x4cca79['uniqueid'],queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x1e')],_0x4cca79[_0x223b('0x26')],queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x1b')]));writeDB(queues[_0x4cca79['uniqueid']]);}}else if(!_[_0x223b('0x15')](_0x4cca79[_0x223b('0x28')][_0x223b('0x29')])){if(!_['isNil'](queues[_0x4cca79[_0x223b('0xc')]])&&!queues[_0x4cca79['uniqueid']][_0x223b('0x17')]){queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x17')]=![];queues[_0x4cca79[_0x223b('0xc')]]['queuecallerabandonAt']=null;queues[_0x4cca79[_0x223b('0xc')]][_0x223b('0x18')]=!![];queues[_0x4cca79['uniqueid']][_0x223b('0x25')]=utils[_0x223b('0x12')]();queues[_0x4cca79['uniqueid']][_0x223b('0x1b')]='EXITWITHKEY';utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x2a'),_0x4cca79['uniqueid'],queues[_0x4cca79[_0x223b('0xc')]]['name'],_0x4cca79['value'],queues[_0x4cca79[_0x223b('0xc')]]['queuecallerexitreason']));}}}catch(_0x58d776){utils[_0x223b('0x13')](util[_0x223b('0xe')](_0x223b('0x21'),_0x4cca79[_0x223b('0xc')]),_0x58d776);}};exports['queuecallerabandon']=function(_0x33a28d){try{if(!_['isNil'](queues[_0x33a28d['uniqueid']])){utils[_0x223b('0x16')](util[_0x223b('0xe')](_0x223b('0x2b'),_0x33a28d[_0x223b('0xc')]),_0x33a28d);queues[_0x33a28d[_0x223b('0xc')]][_0x223b('0x18')]=![];queues[_0x33a28d['uniqueid']][_0x223b('0x25')]=null;queues[_0x33a28d[_0x223b('0xc')]][_0x223b('0x17')]=!![];queues[_0x33a28d['uniqueid']][_0x223b('0x24')]=utils[_0x223b('0x12')]();queues[_0x33a28d[_0x223b('0xc')]][_0x223b('0x1b')]=_0x223b('0x2c');utils[_0x223b('0x2')](util[_0x223b('0xe')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x33a28d['uniqueid'],queues[_0x33a28d[_0x223b('0xc')]]['name'],queues[_0x33a28d[_0x223b('0xc')]]['queuecallerexitreason']));}}catch(_0x5db16b){utils[_0x223b('0x13')](util[_0x223b('0xe')](_0x223b('0x2b'),_0x33a28d['uniqueid']),_0x5db16b);}};exports['queuecallerleave']=function(_0x2f3958){try{if(!_['isNil'](queues[_0x2f3958[_0x223b('0xc')]])){utils[_0x223b('0x16')](util['format'](_0x223b('0x2d'),_0x2f3958[_0x223b('0xc')]),_0x2f3958);utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x2e'),_0x2f3958[_0x223b('0xc')],queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x1e')],_0x2f3958[_0x223b('0x2f')],_0x2f3958[_0x223b('0x30')]));queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x31')]=!![];queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x32')]=utils[_0x223b('0x12')]();queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x33')]=utils[_0x223b('0x34')](queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x32')],queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x35')]);queues[_0x2f3958['uniqueid']][_0x223b('0x36')]=_0x2f3958['position'];queues[_0x2f3958[_0x223b('0xc')]]['count']=_0x2f3958[_0x223b('0x37')];queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x2f')]=_0x2f3958['connectedlinenum'];queues[_0x2f3958[_0x223b('0xc')]][_0x223b('0x30')]=_0x2f3958['connectedlinename'];}}catch(_0xa271bc){utils[_0x223b('0x13')](util[_0x223b('0xe')](_0x223b('0x2d'),_0x2f3958[_0x223b('0xc')]),_0xa271bc);}};exports[_0x223b('0x38')]=function(_0x5df29c){try{if(!_[_0x223b('0x15')](queues[_0x5df29c['uniqueid']])){utils[_0x223b('0x16')](util[_0x223b('0xe')](_0x223b('0x39'),_0x5df29c[_0x223b('0xc')]),_0x5df29c);utils['info'](util[_0x223b('0xe')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5df29c[_0x223b('0xc')],queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x1e')],_0x5df29c[_0x223b('0x3a')],_0x5df29c[_0x223b('0x3b')]));queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x17')]=![];queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x17')]=![];queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x24')]=null;queues[_0x5df29c[_0x223b('0xc')]]['queuecallerexit']=![];queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x1b')]=null;queues[_0x5df29c[_0x223b('0xc')]]['queuecallerexitAt']=null;queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x3c')]=!![];queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x7')]=_0x5df29c[_0x223b('0x3b')];queues[_0x5df29c[_0x223b('0xc')]][_0x223b('0x5')]=_0x5df29c['membername'];}}catch(_0x4e9a39){utils[_0x223b('0x13')](util['format'](_0x223b('0x39'),_0x5df29c['uniqueid']),_0x4e9a39);}};exports['agentcomplete']=function(_0x3ec457){try{if(!_[_0x223b('0x15')](queues[_0x3ec457['uniqueid']])){if(queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x32')]){utils[_0x223b('0x16')](util[_0x223b('0xe')](_0x223b('0x3d'),_0x3ec457[_0x223b('0xc')]),_0x3ec457);queues[_0x3ec457['uniqueid']][_0x223b('0x17')]=![];queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x17')]=![];queues[_0x3ec457['uniqueid']][_0x223b('0x24')]=null;queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x18')]=![];queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x25')]=null;queues[_0x3ec457[_0x223b('0xc')]]['assigned']=!![];queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x5')]=_0x3ec457[_0x223b('0x3a')];queues[_0x3ec457[_0x223b('0xc')]]['queuecallercomplete']=!![];queues[_0x3ec457['uniqueid']][_0x223b('0x1a')]=utils[_0x223b('0x12')]();if(_0x3ec457['reason']==_0x223b('0x3e')){if(!queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x3e')]){queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x1b')]='TRANSFER';}}else{queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x1b')]='COMPLETEDBY'+_0x3ec457['reason']['toUpperCase']();}utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x3f'),_0x3ec457['uniqueid'],queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x1e')],_0x3ec457[_0x223b('0x3a')],queues[_0x3ec457[_0x223b('0xc')]][_0x223b('0x1b')]));writeDB(queues[_0x3ec457[_0x223b('0xc')]]);}}}catch(_0x38067c){utils[_0x223b('0x13')](util['format'](_0x223b('0x3d'),_0x3ec457['uniqueid']),_0x38067c);}};exports[_0x223b('0x40')]=function(_0x37ff7f){try{if(!_['isNil'](queues[_0x37ff7f['transfereeuniqueid']])){utils[_0x223b('0x16')](util[_0x223b('0xe')](_0x223b('0x41'),_0x37ff7f[_0x223b('0xc')]),_0x37ff7f);queues[_0x37ff7f['transfereeuniqueid']]['transfer']=!![];queues[_0x37ff7f[_0x223b('0x42')]][_0x223b('0x43')]=_0x223b('0x44');queues[_0x37ff7f[_0x223b('0x42')]][_0x223b('0x45')]=_0x37ff7f[_0x223b('0x46')];queues[_0x37ff7f[_0x223b('0x42')]][_0x223b('0x47')]=_0x37ff7f['transfereeuniqueid'];queues[_0x37ff7f['transfereeuniqueid']][_0x223b('0x1b')]=_0x223b('0x48');utils['info'](util[_0x223b('0xe')](_0x223b('0x49'),_0x37ff7f[_0x223b('0xc')],queues[_0x37ff7f[_0x223b('0x42')]][_0x223b('0x1e')],_0x37ff7f[_0x223b('0x42')],_0x37ff7f['extension']));}}catch(_0xe31576){utils[_0x223b('0x13')](util[_0x223b('0xe')](_0x223b('0x41'),_0x37ff7f[_0x223b('0xc')]),_0xe31576);}};exports['attendedtransfer']=function(_0x402abe){try{utils[_0x223b('0x16')](util[_0x223b('0xe')]('[%s][queues][attendedtransfer]',_0x402abe['origtransfereruniqueid']),_0x402abe);if(_0x402abe[_0x223b('0x4a')]==_0x402abe[_0x223b('0x4b')]){if(!_[_0x223b('0x15')](queues[_0x402abe[_0x223b('0x4c')]])){utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x4d'),_0x402abe[_0x223b('0x4a')],queues[_0x402abe[_0x223b('0x4c')]][_0x223b('0x1e')],_0x402abe[_0x223b('0x4e')]));queues[_0x402abe[_0x223b('0x4c')]][_0x223b('0x3e')]=!![];queues[_0x402abe['secondtransfererlinkedid']][_0x223b('0x43')]=_0x223b('0x4f');queues[_0x402abe['secondtransfererlinkedid']]['transferexten']=_0x402abe[_0x223b('0x4e')];queues[_0x402abe[_0x223b('0x4c')]]['transferuniqueid']=_0x402abe[_0x223b('0x4a')];queues[_0x402abe[_0x223b('0x4c')]]['queuecallerexitreason']=_0x223b('0x50');}if(!_[_0x223b('0x15')](queues[_0x402abe['origtransfererlinkedid']])){if(_0x402abe['transfereelinkedid']&&queues[_0x402abe[_0x223b('0x51')]]){queues[_0x402abe[_0x223b('0x51')]][_0x223b('0x1f')]=0x1;queues[_0x402abe[_0x223b('0x42')]]=_[_0x223b('0x52')](queues[_0x402abe['transfereelinkedid']]);queues[_0x402abe[_0x223b('0x42')]]['transfereduniqueid']=_0x402abe['transfertargetuniqueid'];queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x1f')]=0x2;queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x6')]=queues[_0x402abe[_0x223b('0x4c')]][_0x223b('0x6')];queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x53')]=queues[_0x402abe[_0x223b('0x4c')]][_0x223b('0x53')];queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x35')]=utils[_0x223b('0x12')]();queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x32')]=utils['now']();queues[_0x402abe['transfereeuniqueid']][_0x223b('0x33')]=0x0;queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x54')]=0x0;utils['info'](util[_0x223b('0xe')](_0x223b('0x55'),_0x402abe['origtransfereruniqueid'],queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x1e')],queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x6')],queues[_0x402abe[_0x223b('0x42')]][_0x223b('0x53')]));}else{utils[_0x223b('0x2')](util[_0x223b('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x402abe['origtransfereruniqueid'],queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0x1e')],_0x402abe['secondtransfererlinkedid']));queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0xb')]=_0x402abe[_0x223b('0x4c')];}}}else if(_0x402abe[_0x223b('0x56')]==_0x402abe[_0x223b('0x4c')]){if(!_[_0x223b('0x15')](queues[_0x402abe[_0x223b('0x4b')]])){utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x57'),_0x402abe[_0x223b('0x4a')],queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0x1e')],_0x402abe[_0x223b('0x56')],_0x402abe[_0x223b('0x58')]));queues[_0x402abe['origtransfererlinkedid']]['transfer']=!![];queues[_0x402abe['origtransfererlinkedid']][_0x223b('0x43')]=_0x223b('0x4f');queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0x45')]=_0x402abe[_0x223b('0x58')];queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0x47')]=_0x402abe['secondtransfereruniqueid'];queues[_0x402abe[_0x223b('0x4b')]]['queuecallerexitreason']=_0x223b('0x50');}if(!_['isNil'](queues[_0x402abe[_0x223b('0x4c')]])){if(_0x402abe['transfertargetlinkedid']&&queues[_0x402abe['transfertargetlinkedid']]){queues[_0x402abe[_0x223b('0x59')]]['queuecallerenterreason']=0x1;queues[_0x402abe[_0x223b('0x5a')]]=_[_0x223b('0x52')](queues[_0x402abe[_0x223b('0x59')]]);queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0xb')]=_0x402abe['transfertargetuniqueid'];queues[_0x402abe[_0x223b('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0x6')]=queues[_0x402abe[_0x223b('0x4b')]]['calleridnum'];queues[_0x402abe['transfertargetuniqueid']]['calleridname']=queues[_0x402abe[_0x223b('0x4b')]][_0x223b('0x53')];queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0x35')]=utils[_0x223b('0x12')]();queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0x32')]=utils[_0x223b('0x12')]();queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0x33')]=0x0;queues[_0x402abe['transfertargetuniqueid']][_0x223b('0x54')]=0x0;utils[_0x223b('0x2')](util[_0x223b('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x402abe[_0x223b('0x4a')],queues[_0x402abe['transfertargetuniqueid']]['name'],queues[_0x402abe['transfertargetuniqueid']][_0x223b('0xb')],queues[_0x402abe[_0x223b('0x5a')]][_0x223b('0x6')],queues[_0x402abe['transfertargetuniqueid']]['calleridname']));}else{utils[_0x223b('0x2')](util['format'](_0x223b('0x5b'),_0x402abe[_0x223b('0x4a')],queues[_0x402abe[_0x223b('0x4c')]][_0x223b('0x1e')],_0x402abe[_0x223b('0x4b')]));queues[_0x402abe['secondtransfererlinkedid']][_0x223b('0xb')]=_0x402abe['origtransfererlinkedid'];}}}}catch(_0x4c9d7e){utils['error'](util[_0x223b('0xe')](_0x223b('0x5c'),_0x402abe[_0x223b('0x4a')]),_0x4c9d7e);}};exports[_0x223b('0x5d')]=function(_0x5e4a6a){try{if(!_[_0x223b('0x15')](queues[_0x5e4a6a[_0x223b('0xc')]])){utils[_0x223b('0x16')](util[_0x223b('0xe')](_0x223b('0x5e'),_0x5e4a6a['uniqueid']),_0x5e4a6a);queues[_0x5e4a6a[_0x223b('0xc')]]['musiconholdstartAt']=utils[_0x223b('0x12')]();utils[_0x223b('0x2')](util[_0x223b('0xe')](_0x223b('0x5f'),_0x5e4a6a[_0x223b('0xc')],queues[_0x5e4a6a['uniqueid']][_0x223b('0x1e')],queues[_0x5e4a6a[_0x223b('0xc')]]['musiconholdstartAt']));}}catch(_0x4fbbdc){utils[_0x223b('0x13')](util['format'](_0x223b('0x5e'),_0x5e4a6a[_0x223b('0xc')]),_0x4fbbdc);}};exports[_0x223b('0x60')]=function(_0x3cba3c){try{if(!_[_0x223b('0x15')](queues[_0x3cba3c[_0x223b('0xc')]])){if(!_[_0x223b('0x15')](queues[_0x3cba3c['uniqueid']][_0x223b('0x61')])){utils['debug'](util[_0x223b('0xe')](_0x223b('0x62'),_0x3cba3c['uniqueid']),_0x3cba3c);queues[_0x3cba3c[_0x223b('0xc')]][_0x223b('0x54')]+=utils['diffTime'](utils[_0x223b('0x12')](),queues[_0x3cba3c[_0x223b('0xc')]][_0x223b('0x61')]);utils[_0x223b('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3cba3c['uniqueid'],queues[_0x3cba3c['uniqueid']]['name'],queues[_0x3cba3c[_0x223b('0xc')]][_0x223b('0x54')]));delete queues[_0x3cba3c[_0x223b('0xc')]]['musiconholdstartAt'];}}}catch(_0xda444b){utils[_0x223b('0x13')](util[_0x223b('0xe')](_0x223b('0x62'),_0x3cba3c[_0x223b('0xc')]),_0xda444b);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5dc2479..5714f9e 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 _0xd93d=['[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0xd93d,0x19b));var _0xdd93=function(_0x740297,_0x560a88){_0x740297=_0x740297-0x0;var _0x282646=_0xd93d[_0x740297];return _0x282646;};'use strict';var _=require(_0xdd93('0x0'));var util=require(_0xdd93('0x1'));var utils=require(_0xdd93('0x2'));var transfers=require(_0xdd93('0x3'));var recordings={};function writeDB(_0x12563c){var _0xc17a55;utils['info'](util[_0xdd93('0x4')](_0xdd93('0x5'),_0x12563c[_0xdd93('0x6')]));if(transfers[_0xdd93('0x7')][_0x12563c[_0xdd93('0x6')]]){_0xc17a55=_0x12563c[_0xdd93('0x6')];_0x12563c[_0xdd93('0x6')]=transfers[_0xdd93('0x7')][_0x12563c[_0xdd93('0x6')]]['transfereeuniqueid'];}if(_0x12563c[_0xdd93('0x8')]){utils['getUserByInternal'](_0x12563c[_0xdd93('0x8')])['then'](function(_0x2f4e1d){if(_0x2f4e1d){_0x12563c[_0xdd93('0x9')]=_0x2f4e1d[_0xdd93('0xa')];_0x12563c[_0xdd93('0xb')]=_0x2f4e1d['id'];}utils[_0xdd93('0xc')](_0xdd93('0xd'),_0x12563c);});}else{utils[_0xdd93('0xc')]('CreateVoiceRecording',_0x12563c);}if(_0xc17a55)delete transfers[_0xdd93('0x7')][_0xc17a55];}exports[_0xdd93('0xe')]=function(_0x1bcbf2){try{utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x10'),_0x1bcbf2[_0xdd93('0x6')]),_0x1bcbf2);if(_0x1bcbf2[_0xdd93('0x6')]==_0x1bcbf2[_0xdd93('0x11')]){utils['info'](util['format'](_0xdd93('0x12'),_0x1bcbf2[_0xdd93('0x6')],_0x1bcbf2[_0xdd93('0x13')],_0x1bcbf2['exten']));recordings[_0x1bcbf2[_0xdd93('0x6')]]={'uniqueid':_0x1bcbf2[_0xdd93('0x6')],'accountcode':_0x1bcbf2[_0xdd93('0x8')],'exten':_0x1bcbf2[_0xdd93('0x14')],'context':_0x1bcbf2[_0xdd93('0x13')],'channel':_0x1bcbf2[_0xdd93('0x15')],'monitors':[]};}}catch(_0x5f5011){utils['error'](util[_0xdd93('0x4')](_0xdd93('0x10'),_0x1bcbf2[_0xdd93('0x6')]),_0x5f5011);}};exports[_0xdd93('0x16')]=function(_0x2fdfe9){try{utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x17'),_0x2fdfe9[_0xdd93('0x6')]),_0x2fdfe9);if(!_[_0xdd93('0x18')](recordings[_0x2fdfe9[_0xdd93('0x6')]])&&_0x2fdfe9['channelstate']==0x6){utils[_0xdd93('0x19')](util[_0xdd93('0x4')](_0xdd93('0x1a'),_0x2fdfe9[_0xdd93('0x6')],_0x2fdfe9['context'],_0x2fdfe9[_0xdd93('0x15')]));}else if(!_[_0xdd93('0x18')](recordings[_0x2fdfe9[_0xdd93('0x11')]])&&_0x2fdfe9[_0xdd93('0x1b')]==0x6&&_0x2fdfe9['context']!=_0xdd93('0x1c')){utils[_0xdd93('0x19')](util['format'](_0xdd93('0x1d'),_0x2fdfe9[_0xdd93('0x6')],_0x2fdfe9[_0xdd93('0x11')],_0x2fdfe9[_0xdd93('0x13')],_0x2fdfe9[_0xdd93('0x15')]));recordings[_0x2fdfe9[_0xdd93('0x11')]][_0xdd93('0x8')]=_0x2fdfe9['accountcode'];}}catch(_0x333be1){utils[_0xdd93('0x1e')](util[_0xdd93('0x4')](_0xdd93('0x17'),_0x2fdfe9['uniqueid']),_0x333be1);}};exports['varset']=function(_0x45f79f){try{if(!_['isNil'](_0x45f79f[_0xdd93('0x1f')])&&!_[_0xdd93('0x18')](_0x45f79f['variable'][_0xdd93('0x20')])){utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x21'),_0x45f79f[_0xdd93('0x6')]),_0x45f79f);utils['info'](util[_0xdd93('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x45f79f[_0xdd93('0x6')],_0x45f79f['variable'],_0x45f79f[_0xdd93('0x22')]));if(_[_0xdd93('0x23')](_0x45f79f[_0xdd93('0x22')],_0xdd93('0x24'))){_0x45f79f[_0xdd93('0x22')]=_0x45f79f[_0xdd93('0x22')][_0xdd93('0x25')](_0xdd93('0x24'),_0xdd93('0x26'));}if(recordings[_0x45f79f[_0xdd93('0x11')]]){var _0x1136c4=_[_0xdd93('0x27')](recordings[_0x45f79f['linkedid']]['monitors'],{'value':_0x45f79f[_0xdd93('0x22')]});if(_[_0xdd93('0x18')](_0x1136c4)){recordings[_0x45f79f['linkedid']][_0xdd93('0x28')][_0xdd93('0x29')]({'value':_0x45f79f[_0xdd93('0x22')]});}}}}catch(_0x3e47b8){utils['error'](util[_0xdd93('0x4')]('[%s][recordings][varset]',_0x45f79f[_0xdd93('0x6')]),_0x3e47b8);}};exports[_0xdd93('0x2a')]=function(_0x270edd){try{if(!_[_0xdd93('0x18')](recordings[_0x270edd[_0xdd93('0x6')]])){utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x2b'),_0x270edd[_0xdd93('0x6')]),_0x270edd);utils[_0xdd93('0x19')](util[_0xdd93('0x4')](_0xdd93('0x2c'),_0x270edd[_0xdd93('0x6')],_0x270edd['calleridnum'],_0x270edd[_0xdd93('0x2d')],_0x270edd[_0xdd93('0x2e')]));recordings[_0x270edd['uniqueid']]['calleridnum']=_0x270edd[_0xdd93('0x2f')];recordings[_0x270edd['uniqueid']][_0xdd93('0x2d')]=_0x270edd['calleridname'];recordings[_0x270edd[_0xdd93('0x6')]]['connectedlinenum']=_0x270edd[_0xdd93('0x30')];recordings[_0x270edd[_0xdd93('0x6')]][_0xdd93('0x31')]=_0x270edd[_0xdd93('0x31')];if(recordings[_0x270edd[_0xdd93('0x6')]][_0xdd93('0x32')]==_0xdd93('0x33')&&recordings[_0x270edd[_0xdd93('0x6')]][_0xdd93('0x8')]){recordings[_0x270edd['uniqueid']][_0xdd93('0x30')]=recordings[_0x270edd['uniqueid']][_0xdd93('0x8')];recordings[_0x270edd['uniqueid']][_0xdd93('0x31')]='';}recordings[_0x270edd['uniqueid']][_0xdd93('0x28')][_0xdd93('0x34')](function(_0x5eb52d){var _0x77358d=_['clone'](recordings[_0x270edd['uniqueid']]);_0x77358d[_0xdd93('0x22')]=_0x5eb52d[_0xdd93('0x22')];writeDB(_0x77358d);});delete recordings[_0x270edd[_0xdd93('0x6')]];}}catch(_0x162399){utils[_0xdd93('0x1e')](util[_0xdd93('0x4')](_0xdd93('0x2b'),_0x270edd[_0xdd93('0x6')]),_0x162399);}};exports[_0xdd93('0x35')]=function(_0x2ac4d1){try{if(!_[_0xdd93('0x18')](recordings[_0x2ac4d1[_0xdd93('0x6')]])){utils['debug'](util['format'](_0xdd93('0x36'),_0x2ac4d1['uniqueid']),_0x2ac4d1);utils[_0xdd93('0x19')](util[_0xdd93('0x4')](_0xdd93('0x37'),_0x2ac4d1[_0xdd93('0x6')],_0x2ac4d1[_0xdd93('0x38')],_0x2ac4d1['appdata']));if(_0x2ac4d1['application'][_0xdd93('0x39')]()=='set'&&_[_0xdd93('0x3a')](_0x2ac4d1[_0xdd93('0x3b')][_0xdd93('0x39')](),_0xdd93('0x3c'))){var _0x1b921c=_0x2ac4d1[_0xdd93('0x3b')][_0xdd93('0x3d')]('=');var _0xfcaf86=_0x1b921c[0x0]['substring'](_0x1b921c[0x0][_0xdd93('0x3e')]('(')+0x1,_0x1b921c[0x0]['lastIndexOf'](')'));var _0xe4d1d5=_0x1b921c[0x1];recordings[_0x2ac4d1[_0xdd93('0x6')]][_0xfcaf86]=_0xe4d1d5;}}}catch(_0x28334a){utils['error'](util['format']('[%s][recordings][newexten]',_0x2ac4d1[_0xdd93('0x6')]),_0x28334a);}};exports[_0xdd93('0x3f')]=function(_0x3aca49){try{if(!_[_0xdd93('0x18')](recordings[_0x3aca49[_0xdd93('0x6')]])){utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x40'),_0x3aca49[_0xdd93('0x6')]),_0x3aca49);utils[_0xdd93('0x19')](util[_0xdd93('0x4')](_0xdd93('0x41'),_0x3aca49[_0xdd93('0x6')],_0x3aca49['queue']));recordings[_0x3aca49['uniqueid']][_0xdd93('0x42')]=_0x3aca49[_0xdd93('0x42')];}}catch(_0x5e7587){utils[_0xdd93('0x1e')](util[_0xdd93('0x4')](_0xdd93('0x40'),_0x3aca49[_0xdd93('0x6')]),_0x5e7587);}};exports[_0xdd93('0x43')]=function(_0x23565b){try{utils[_0xdd93('0xf')](util[_0xdd93('0x4')](_0xdd93('0x44'),_0x23565b[_0xdd93('0x6')]),_0x23565b);utils[_0xdd93('0x19')](util[_0xdd93('0x4')](_0xdd93('0x45'),_0x23565b[_0xdd93('0x6')],_0x23565b['transferercalleridnum'],_0x23565b[_0xdd93('0x46')],_0x23565b[_0xdd93('0x47')],_0x23565b[_0xdd93('0x48')]));if(recordings[_0x23565b[_0xdd93('0x49')]]&&transfers['blinds'][_0x23565b[_0xdd93('0x49')]]){transfers[_0xdd93('0x7')][_0x23565b[_0xdd93('0x49')]]['recording']=!![];}}catch(_0xc8fdc6){utils[_0xdd93('0x1e')](util['format'](_0xdd93('0x44'),_0x23565b[_0xdd93('0x6')]),_0xc8fdc6);}}; \ No newline at end of file +var _0x97a8=['clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','connectedlinenum','forEach'];(function(_0x2d7fa1,_0x4cca90){var _0x4dc8cc=function(_0x4bd463){while(--_0x4bd463){_0x2d7fa1['push'](_0x2d7fa1['shift']());}};_0x4dc8cc(++_0x4cca90);}(_0x97a8,0xab));var _0x897a=function(_0x5209ca,_0x19c98d){_0x5209ca=_0x5209ca-0x0;var _0x4a042b=_0x97a8[_0x5209ca];return _0x4a042b;};'use strict';var _=require(_0x897a('0x0'));var util=require('util');var utils=require(_0x897a('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x584248){var _0x3eb910;utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x4'),_0x584248['uniqueid']));if(transfers['blinds'][_0x584248[_0x897a('0x5')]]){_0x3eb910=_0x584248['uniqueid'];_0x584248[_0x897a('0x5')]=transfers[_0x897a('0x6')][_0x584248[_0x897a('0x5')]]['transfereeuniqueid'];}if(_0x584248[_0x897a('0x7')]){utils[_0x897a('0x8')](_0x584248[_0x897a('0x7')])[_0x897a('0x9')](function(_0x4c7677){if(_0x4c7677){_0x584248['membername']=_0x4c7677[_0x897a('0xa')];_0x584248[_0x897a('0xb')]=_0x4c7677['id'];}utils[_0x897a('0xc')](_0x897a('0xd'),_0x584248);});}else{utils[_0x897a('0xc')](_0x897a('0xd'),_0x584248);}if(_0x3eb910)delete transfers[_0x897a('0x6')][_0x3eb910];}exports[_0x897a('0xe')]=function(_0x54e183){try{utils['debug'](util[_0x897a('0x3')](_0x897a('0xf'),_0x54e183['uniqueid']),_0x54e183);if(_0x54e183[_0x897a('0x5')]==_0x54e183[_0x897a('0x10')]){utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x11'),_0x54e183['uniqueid'],_0x54e183[_0x897a('0x12')],_0x54e183[_0x897a('0x13')]));recordings[_0x54e183[_0x897a('0x5')]]={'uniqueid':_0x54e183[_0x897a('0x5')],'accountcode':_0x54e183[_0x897a('0x7')],'exten':_0x54e183['exten'],'context':_0x54e183['context'],'channel':_0x54e183[_0x897a('0x14')],'monitors':[]};}}catch(_0x2bd06d){utils['error'](util[_0x897a('0x3')](_0x897a('0xf'),_0x54e183[_0x897a('0x5')]),_0x2bd06d);}};exports[_0x897a('0x15')]=function(_0x595879){try{utils[_0x897a('0x16')](util['format'](_0x897a('0x17'),_0x595879[_0x897a('0x5')]),_0x595879);if(!_[_0x897a('0x18')](recordings[_0x595879[_0x897a('0x5')]])&&_0x595879[_0x897a('0x19')]==0x6){utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x1a'),_0x595879['uniqueid'],_0x595879[_0x897a('0x12')],_0x595879[_0x897a('0x14')]));}else if(!_[_0x897a('0x18')](recordings[_0x595879[_0x897a('0x10')]])&&_0x595879[_0x897a('0x19')]==0x6&&_0x595879['context']!=_0x897a('0x1b')){utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x1c'),_0x595879['uniqueid'],_0x595879[_0x897a('0x10')],_0x595879[_0x897a('0x12')],_0x595879['channel']));recordings[_0x595879[_0x897a('0x10')]]['accountcode']=_0x595879[_0x897a('0x7')];}}catch(_0x5e2e9b){utils[_0x897a('0x1d')](util[_0x897a('0x3')](_0x897a('0x17'),_0x595879[_0x897a('0x5')]),_0x5e2e9b);}};exports[_0x897a('0x1e')]=function(_0x4befd1){try{if(!_[_0x897a('0x18')](_0x4befd1[_0x897a('0x1f')])&&!_[_0x897a('0x18')](_0x4befd1['variable'][_0x897a('0x20')])){utils[_0x897a('0x16')](util[_0x897a('0x3')](_0x897a('0x21'),_0x4befd1[_0x897a('0x5')]),_0x4befd1);utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x22'),_0x4befd1[_0x897a('0x5')],_0x4befd1[_0x897a('0x1f')],_0x4befd1[_0x897a('0x23')]));if(_[_0x897a('0x24')](_0x4befd1[_0x897a('0x23')],'.wav49')){_0x4befd1[_0x897a('0x23')]=_0x4befd1[_0x897a('0x23')][_0x897a('0x25')]('.wav49',_0x897a('0x26'));}if(recordings[_0x4befd1[_0x897a('0x10')]]){var _0xf148c0=_[_0x897a('0x27')](recordings[_0x4befd1[_0x897a('0x10')]][_0x897a('0x28')],{'value':_0x4befd1['value']});if(_[_0x897a('0x18')](_0xf148c0)){recordings[_0x4befd1['linkedid']][_0x897a('0x28')][_0x897a('0x29')]({'value':_0x4befd1[_0x897a('0x23')]});}}}}catch(_0x30342b){utils[_0x897a('0x1d')](util['format'](_0x897a('0x21'),_0x4befd1[_0x897a('0x5')]),_0x30342b);}};exports[_0x897a('0x2a')]=function(_0x3e601b){try{if(!_[_0x897a('0x18')](recordings[_0x3e601b[_0x897a('0x5')]])){utils[_0x897a('0x16')](util[_0x897a('0x3')](_0x897a('0x2b'),_0x3e601b['uniqueid']),_0x3e601b);utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x2c'),_0x3e601b[_0x897a('0x5')],_0x3e601b['calleridnum'],_0x3e601b[_0x897a('0x2d')],_0x3e601b[_0x897a('0x2e')]));recordings[_0x3e601b['uniqueid']][_0x897a('0x2f')]=_0x3e601b[_0x897a('0x2f')];recordings[_0x3e601b['uniqueid']][_0x897a('0x2d')]=_0x3e601b['calleridname'];recordings[_0x3e601b[_0x897a('0x5')]]['connectedlinenum']=_0x3e601b['connectedlinenum'];recordings[_0x3e601b['uniqueid']][_0x897a('0x30')]=_0x3e601b[_0x897a('0x30')];if(recordings[_0x3e601b[_0x897a('0x5')]]['type']=='outbound'&&recordings[_0x3e601b[_0x897a('0x5')]][_0x897a('0x7')]){recordings[_0x3e601b['uniqueid']][_0x897a('0x31')]=recordings[_0x3e601b[_0x897a('0x5')]][_0x897a('0x7')];recordings[_0x3e601b[_0x897a('0x5')]][_0x897a('0x30')]='';}recordings[_0x3e601b['uniqueid']][_0x897a('0x28')][_0x897a('0x32')](function(_0x5238e2){var _0x5e4022=_[_0x897a('0x33')](recordings[_0x3e601b[_0x897a('0x5')]]);_0x5e4022[_0x897a('0x23')]=_0x5238e2[_0x897a('0x23')];writeDB(_0x5e4022);});delete recordings[_0x3e601b[_0x897a('0x5')]];}}catch(_0x3166cc){utils[_0x897a('0x1d')](util['format'](_0x897a('0x2b'),_0x3e601b[_0x897a('0x5')]),_0x3166cc);}};exports[_0x897a('0x34')]=function(_0x20d987){try{if(!_[_0x897a('0x18')](recordings[_0x20d987[_0x897a('0x5')]])){utils[_0x897a('0x16')](util[_0x897a('0x3')]('[%s][recordings][newexten]',_0x20d987[_0x897a('0x5')]),_0x20d987);utils[_0x897a('0x2')](util['format'](_0x897a('0x35'),_0x20d987[_0x897a('0x5')],_0x20d987['application'],_0x20d987[_0x897a('0x36')]));if(_0x20d987[_0x897a('0x37')]['toLowerCase']()==_0x897a('0x38')&&_['startsWith'](_0x20d987[_0x897a('0x36')]['toLowerCase'](),_0x897a('0x39'))){var _0x43bed4=_0x20d987[_0x897a('0x36')][_0x897a('0x3a')]('=');var _0x5571a4=_0x43bed4[0x0]['substring'](_0x43bed4[0x0][_0x897a('0x3b')]('(')+0x1,_0x43bed4[0x0][_0x897a('0x3b')](')'));var _0xf67631=_0x43bed4[0x1];recordings[_0x20d987[_0x897a('0x5')]][_0x5571a4]=_0xf67631;}}}catch(_0x3a7850){utils['error'](util['format'](_0x897a('0x3c'),_0x20d987[_0x897a('0x5')]),_0x3a7850);}};exports[_0x897a('0x3d')]=function(_0x38d82b){try{if(!_[_0x897a('0x18')](recordings[_0x38d82b['uniqueid']])){utils[_0x897a('0x16')](util['format'](_0x897a('0x3e'),_0x38d82b[_0x897a('0x5')]),_0x38d82b);utils[_0x897a('0x2')](util[_0x897a('0x3')](_0x897a('0x3f'),_0x38d82b[_0x897a('0x5')],_0x38d82b[_0x897a('0x40')]));recordings[_0x38d82b[_0x897a('0x5')]][_0x897a('0x40')]=_0x38d82b[_0x897a('0x40')];}}catch(_0xd3fe4b){utils[_0x897a('0x1d')](util[_0x897a('0x3')](_0x897a('0x3e'),_0x38d82b['uniqueid']),_0xd3fe4b);}};exports[_0x897a('0x41')]=function(_0x25f04e){try{utils[_0x897a('0x16')](util[_0x897a('0x3')]('[%s][recordings][blindtransfer]',_0x25f04e[_0x897a('0x5')]),_0x25f04e);utils['info'](util['format'](_0x897a('0x42'),_0x25f04e[_0x897a('0x5')],_0x25f04e[_0x897a('0x43')],_0x25f04e[_0x897a('0x44')],_0x25f04e[_0x897a('0x45')],_0x25f04e[_0x897a('0x46')]));if(recordings[_0x25f04e[_0x897a('0x47')]]&&transfers[_0x897a('0x6')][_0x25f04e[_0x897a('0x47')]]){transfers[_0x897a('0x6')][_0x25f04e['transfereruniqueid']][_0x897a('0x48')]=!![];}}catch(_0x5f05ec){utils['error'](util[_0x897a('0x3')](_0x897a('0x49'),_0x25f04e['uniqueid']),_0x5f05ec);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8e4ab43..23aa5d7 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 _0x9ba6=['debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','lodash','./utils','info','format','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','error','attendedtransfer'];(function(_0x507ea9,_0x5894e9){var _0x8abb72=function(_0x51e476){while(--_0x51e476){_0x507ea9['push'](_0x507ea9['shift']());}};_0x8abb72(++_0x5894e9);}(_0x9ba6,0xd7));var _0x69ba=function(_0x56bbc6,_0x24779f){_0x56bbc6=_0x56bbc6-0x0;var _0x21c98e=_0x9ba6[_0x56bbc6];return _0x21c98e;};'use strict';var _=require(_0x69ba('0x0'));var util=require('util');var utils=require(_0x69ba('0x1'));function writeDB(_0x5cbc27){utils[_0x69ba('0x2')](util[_0x69ba('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x5cbc27[_0x69ba('0x4')]===_0x69ba('0x5')?_0x5cbc27[_0x69ba('0x6')]:_0x5cbc27['uniqueid'],_0x5cbc27[_0x69ba('0x4')]));utils['request'](_0x69ba('0x7'),_0x5cbc27);}exports[_0x69ba('0x8')]={};exports[_0x69ba('0x9')]=function(_0x54cbfd){try{utils['debug'](util['format'](_0x69ba('0xa'),_0x54cbfd[_0x69ba('0xb')]),_0x54cbfd);utils['info'](util[_0x69ba('0x3')](_0x69ba('0xc'),_0x54cbfd[_0x69ba('0xb')],_0x54cbfd[_0x69ba('0xd')],_0x54cbfd[_0x69ba('0xe')],_0x54cbfd['transfereecalleridnum'],_0x54cbfd[_0x69ba('0xf')]));_0x54cbfd[_0x69ba('0x4')]='blind';exports[_0x69ba('0x8')][_0x54cbfd[_0x69ba('0x10')]]=_0x54cbfd;writeDB(_0x54cbfd);}catch(_0x50d757){utils[_0x69ba('0x11')](util[_0x69ba('0x3')](_0x69ba('0xa'),_0x54cbfd[_0x69ba('0xb')]),_0x50d757);}};exports[_0x69ba('0x12')]=function(_0x5df1a8){try{utils[_0x69ba('0x13')](util['format'](_0x69ba('0x14'),_0x5df1a8[_0x69ba('0x6')]),_0x5df1a8);utils[_0x69ba('0x2')](util['format'](_0x69ba('0x15'),_0x5df1a8[_0x69ba('0x6')],_0x5df1a8[_0x69ba('0x16')],_0x5df1a8[_0x69ba('0x17')],_0x5df1a8['transfertargetcalleridnum'],_0x5df1a8[_0x69ba('0x18')]));_0x5df1a8=_[_0x69ba('0x19')](_0x5df1a8,{'transfererchannel':_0x5df1a8[_0x69ba('0x1a')],'transferercalleridnum':_0x5df1a8['origtransferercalleridnum'],'transferercalleridname':_0x5df1a8[_0x69ba('0x17')],'transfererconnectedlinenum':_0x5df1a8['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5df1a8[_0x69ba('0x1b')],'transfereraccountcode':_0x5df1a8[_0x69ba('0x1c')],'transferercontext':_0x5df1a8['secondtransferercontext'],'transfererexten':_0x5df1a8[_0x69ba('0x1d')],'transfererlinkedid':_0x5df1a8['origtransfererlinkedid'],'context':_0x5df1a8[_0x69ba('0x1e')],'extension':_0x5df1a8[_0x69ba('0x1f')],'type':'attended'});if(_[_0x69ba('0x20')](_0x5df1a8[_0x69ba('0x21')])){_0x5df1a8=_[_0x69ba('0x19')](_0x5df1a8,{'transfereechannel':_0x5df1a8[_0x69ba('0x22')],'transfereecalleridnum':_0x5df1a8[_0x69ba('0x23')],'transfereecalleridname':_0x5df1a8[_0x69ba('0x18')],'transfereeconnectedlinenum':_0x5df1a8[_0x69ba('0x24')],'transfereeconnectedlinename':_0x5df1a8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5df1a8[_0x69ba('0x25')],'transfereecontext':_0x5df1a8[_0x69ba('0x26')],'transfereeexten':_0x5df1a8['transfertargetexten'],'transfereelinkedid':_0x5df1a8['transfertargetlinkedid']});}writeDB(_0x5df1a8);}catch(_0x1cd985){utils[_0x69ba('0x11')](util[_0x69ba('0x3')](_0x69ba('0x14'),_0x5df1a8['origtransfereruniqueid']),_0x1cd985);}}; \ No newline at end of file +var _0xebfd=['[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xebfd,0x18e));var _0xdebf=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xebfd[_0x3dea7d];return _0x53919a;};'use strict';var _=require(_0xdebf('0x0'));var util=require(_0xdebf('0x1'));var utils=require(_0xdebf('0x2'));function writeDB(_0xaa00a5){utils[_0xdebf('0x3')](util[_0xdebf('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0xaa00a5[_0xdebf('0x5')]===_0xdebf('0x6')?_0xaa00a5['origtransfereruniqueid']:_0xaa00a5[_0xdebf('0x7')],_0xaa00a5[_0xdebf('0x5')]));utils[_0xdebf('0x8')](_0xdebf('0x9'),_0xaa00a5);}exports[_0xdebf('0xa')]={};exports['blindtransfer']=function(_0x2e8735){try{utils[_0xdebf('0xb')](util[_0xdebf('0x4')](_0xdebf('0xc'),_0x2e8735['uniqueid']),_0x2e8735);utils[_0xdebf('0x3')](util[_0xdebf('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2e8735[_0xdebf('0x7')],_0x2e8735[_0xdebf('0xd')],_0x2e8735[_0xdebf('0xe')],_0x2e8735[_0xdebf('0xf')],_0x2e8735[_0xdebf('0x10')]));_0x2e8735[_0xdebf('0x5')]='blind';exports['blinds'][_0x2e8735[_0xdebf('0x11')]]=_0x2e8735;writeDB(_0x2e8735);}catch(_0x32f9e5){utils[_0xdebf('0x12')](util[_0xdebf('0x4')]('[%s][transfers][blindtransfer]',_0x2e8735['uniqueid']),_0x32f9e5);}};exports[_0xdebf('0x13')]=function(_0x3ec691){try{utils['debug'](util['format'](_0xdebf('0x14'),_0x3ec691[_0xdebf('0x15')]),_0x3ec691);utils[_0xdebf('0x3')](util[_0xdebf('0x4')](_0xdebf('0x16'),_0x3ec691[_0xdebf('0x15')],_0x3ec691[_0xdebf('0x17')],_0x3ec691[_0xdebf('0x18')],_0x3ec691['transfertargetcalleridnum'],_0x3ec691[_0xdebf('0x19')]));_0x3ec691=_[_0xdebf('0x1a')](_0x3ec691,{'transfererchannel':_0x3ec691[_0xdebf('0x1b')],'transferercalleridnum':_0x3ec691['origtransferercalleridnum'],'transferercalleridname':_0x3ec691[_0xdebf('0x18')],'transfererconnectedlinenum':_0x3ec691['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3ec691[_0xdebf('0x1c')],'transfereraccountcode':_0x3ec691[_0xdebf('0x1d')],'transferercontext':_0x3ec691[_0xdebf('0x1e')],'transfererexten':_0x3ec691[_0xdebf('0x1f')],'transfererlinkedid':_0x3ec691[_0xdebf('0x20')],'context':_0x3ec691[_0xdebf('0x21')],'extension':_0x3ec691[_0xdebf('0x22')],'type':_0xdebf('0x6')});if(_[_0xdebf('0x23')](_0x3ec691[_0xdebf('0x24')])){_0x3ec691=_[_0xdebf('0x1a')](_0x3ec691,{'transfereechannel':_0x3ec691[_0xdebf('0x25')],'transfereecalleridnum':_0x3ec691['transfertargetcalleridnum'],'transfereecalleridname':_0x3ec691[_0xdebf('0x19')],'transfereeconnectedlinenum':_0x3ec691['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ec691[_0xdebf('0x26')],'transfereeaccountcode':_0x3ec691[_0xdebf('0x27')],'transfereecontext':_0x3ec691['transfertargetcontext'],'transfereeexten':_0x3ec691[_0xdebf('0x28')],'transfereelinkedid':_0x3ec691[_0xdebf('0x29')]});}writeDB(_0x3ec691);}catch(_0x3d144d){utils[_0xdebf('0x12')](util[_0xdebf('0x4')](_0xdebf('0x14'),_0x3ec691['origtransfereruniqueid']),_0x3d144d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 780671b..4a122c1 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 _0x8e23=['internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','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','diffTime','sumTime','format','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','xdr','debug','error','request','then','inspect','catch','[utils][request]\x20name:%s','GetUser'];(function(_0x5014de,_0x2e5b19){var _0x19a5c4=function(_0xf23b33){while(--_0xf23b33){_0x5014de['push'](_0x5014de['shift']());}};_0x19a5c4(++_0x2e5b19);}(_0x8e23,0xae));var _0x38e2=function(_0x3a8d41,_0x463ae7){_0x3a8d41=_0x3a8d41-0x0;var _0x546478=_0x8e23[_0x3a8d41];return _0x546478;};'use strict';var BPromise=require(_0x38e2('0x0'));var jayson=require(_0x38e2('0x1'));var moment=require('moment');var util=require(_0x38e2('0x2'));var client=jayson['client'][_0x38e2('0x3')]({'port':0x2329});var logger=require(_0x38e2('0x4'))(_0x38e2('0x5'));exports['info']=function(_0x4847df,_0xd71524){logger['info'](_0x4847df,_0xd71524?util['inspect'](_0xd71524,{'showHidden':![],'depth':null}):'');};exports[_0x38e2('0x6')]=function(_0x6dddbe,_0x2c2be6){logger[_0x38e2('0x6')](_0x6dddbe,_0x2c2be6?util['inspect'](_0x2c2be6,{'showHidden':![],'depth':null}):'');};exports[_0x38e2('0x7')]=function(_0x3961a9,_0x3c28fd){logger[_0x38e2('0x7')](_0x3961a9,_0x3c28fd?util['inspect'](_0x3c28fd,{'showHidden':![],'depth':null}):'');};exports[_0x38e2('0x8')]=function(_0xd4796,_0x37afc2){return client[_0x38e2('0x8')](_0xd4796,{'body':_0x37afc2})[_0x38e2('0x9')](function(_0x42cdfd){logger[_0x38e2('0x6')]('[utils][request]\x20name:%s',_0xd4796,_0x42cdfd?util[_0x38e2('0xa')](_0x42cdfd,{'showHidden':![],'depth':null}):'');})[_0x38e2('0xb')](function(_0x3f1995){logger[_0x38e2('0x7')](_0x38e2('0xc'),_0xd4796,_0x3f1995?util['inspect'](_0x3f1995,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2eec92){return client['request'](_0x38e2('0xd'),{'options':{'raw':!![],'attributes':['id',_0x38e2('0xe'),_0x38e2('0xf'),_0x38e2('0x10')],'where':_0x2eec92,'limit':0x1}})[_0x38e2('0x9')](function(_0x1a997f){logger[_0x38e2('0x6')](_0x38e2('0x11'),JSON['stringify'](_0x2eec92),_0x1a997f?util['inspect'](_0x1a997f,{'showHidden':![],'depth':null}):'');return _0x1a997f[_0x38e2('0x12')][_0x38e2('0x13')]?_0x1a997f[_0x38e2('0x12')][0x0]:null;});}exports[_0x38e2('0x14')]=function(_0x2194c8){return new BPromise(function(_0x329996,_0x16f12c){if(_0x2194c8){return getUser({'internal':_0x2194c8})['then'](function(_0x5b4d27){logger[_0x38e2('0x15')](_0x38e2('0x16'),_0x2194c8,_0x5b4d27?'found':_0x38e2('0x17'));return _0x329996(_0x5b4d27);})[_0x38e2('0xb')](function(_0x587ab0){logger[_0x38e2('0x7')]('[utils][getUserByInternal]',_0x587ab0?util[_0x38e2('0xa')](_0x587ab0,{'showHidden':![],'depth':null}):'');return _0x329996(null);});}return _0x329996(null);});};exports['getUserByInterface']=function(_0x46614c){return new BPromise(function(_0x4bf886,_0x3a84ea){if(_0x46614c){return getUser({'interface':_0x46614c})[_0x38e2('0x9')](function(_0x24fdea){logger[_0x38e2('0x15')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x46614c,_0x24fdea?_0x38e2('0x18'):_0x38e2('0x17'));return _0x4bf886(_0x24fdea);})[_0x38e2('0xb')](function(_0x49fa59){logger[_0x38e2('0x7')](_0x38e2('0x19'),_0x49fa59?util[_0x38e2('0xa')](_0x49fa59,{'showHidden':![],'depth':null}):'');return _0x4bf886(null);});}return _0x4bf886(null);});};exports[_0x38e2('0x1a')]=function(_0x4a38d1){return new BPromise(function(_0x4d026e,_0x12dba2){if(_0x4a38d1){return getUser({'name':_0x4a38d1})[_0x38e2('0x9')](function(_0x2afa66){logger[_0x38e2('0x15')](_0x38e2('0x1b'),_0x4a38d1,_0x2afa66?_0x38e2('0x18'):_0x38e2('0x17'));return _0x4d026e(_0x2afa66);})['catch'](function(_0xafe9c2){logger[_0x38e2('0x7')](_0x38e2('0x1c'),_0xafe9c2?util['inspect'](_0xafe9c2,{'showHidden':![],'depth':null}):'');return _0x4d026e(null);});}return _0x4d026e(null);});};exports[_0x38e2('0x1d')]=function(_0x42b8b2){return new BPromise(function(_0x12c077,_0x187949){if(_0x42b8b2){return client[_0x38e2('0x8')](_0x38e2('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x38e2('0xf'),_0x38e2('0x1f'),_0x38e2('0x20'),'acwTimeout'],'where':{'name':_0x42b8b2},'limit':0x1}})[_0x38e2('0x9')](function(_0x4e6394){logger[_0x38e2('0x6')](_0x38e2('0x21'),_0x42b8b2,_0x4e6394?util[_0x38e2('0xa')](_0x4e6394,{'showHidden':![],'depth':null}):'');logger[_0x38e2('0x15')](_0x38e2('0x22'),_0x42b8b2,_0x4e6394?'found':_0x38e2('0x17'));return _0x12c077(_0x4e6394['result'][_0x38e2('0x13')]?_0x4e6394[_0x38e2('0x12')][0x0]:null);})[_0x38e2('0xb')](function(_0x5b646e){logger['error'](_0x38e2('0x23'),_0x5b646e?util['inspect'](_0x5b646e,{'showHidden':![],'depth':null}):'');return _0x12c077(null);});}return _0x12c077(null);});};exports[_0x38e2('0x24')]=function(_0x39e229,_0x11735b){return moment(_0x39e229)[_0x38e2('0x25')](_0x11735b,_0x38e2('0x26'))['format'](_0x38e2('0x27'));};exports[_0x38e2('0x28')]=function(_0x411bea,_0x4f370d){return moment(_0x411bea)[_0x38e2('0x29')](_0x4f370d,_0x38e2('0x26'))['format'](_0x38e2('0x27'));};exports[_0x38e2('0x2a')]=function(_0x132b6e,_0x5baf35){return moment(_0x132b6e)['diff'](moment(_0x5baf35),_0x38e2('0x26'));};exports[_0x38e2('0x2b')]=function(_0x39c973,_0x431627){return parseInt(_0x39c973,0xa)+parseInt(_0x431627,0xa);};exports['now']=function(){return moment()[_0x38e2('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x38e2('0x2d')]=function(_0x28ee39,_0xb4deb0){if(_0xb4deb0){return moment(_0x28ee39)[_0x38e2('0x2d')](_0xb4deb0);}return!![];};exports[_0x38e2('0x2e')]=function(_0x1d8623,_0x53db12){if(_0x53db12){return moment(_0x1d8623)[_0x38e2('0x2e')](_0x53db12);}else if(_0x1d8623){return!![];}return![];}; \ No newline at end of file +var _0x3dc3=['seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','interface','then','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]'];(function(_0x4d4b94,_0x549163){var _0x261d44=function(_0x5e563b){while(--_0x5e563b){_0x4d4b94['push'](_0x4d4b94['shift']());}};_0x261d44(++_0x549163);}(_0x3dc3,0xea));var _0x33dc=function(_0x22d60d,_0x4b2b29){_0x22d60d=_0x22d60d-0x0;var _0x3f26d5=_0x3dc3[_0x22d60d];return _0x3f26d5;};'use strict';var BPromise=require(_0x33dc('0x0'));var jayson=require('jayson/promise');var moment=require(_0x33dc('0x1'));var util=require(_0x33dc('0x2'));var client=jayson[_0x33dc('0x3')][_0x33dc('0x4')]({'port':0x2329});var logger=require(_0x33dc('0x5'))(_0x33dc('0x6'));exports[_0x33dc('0x7')]=function(_0x46cc35,_0x53cb55){logger['info'](_0x46cc35,_0x53cb55?util[_0x33dc('0x8')](_0x53cb55,{'showHidden':![],'depth':null}):'');};exports[_0x33dc('0x9')]=function(_0x280d28,_0x4739d0){logger[_0x33dc('0x9')](_0x280d28,_0x4739d0?util[_0x33dc('0x8')](_0x4739d0,{'showHidden':![],'depth':null}):'');};exports[_0x33dc('0xa')]=function(_0x5ca9a9,_0x2d1e3d){logger[_0x33dc('0xa')](_0x5ca9a9,_0x2d1e3d?util[_0x33dc('0x8')](_0x2d1e3d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xf1e24,_0x2eb8ac){return client[_0x33dc('0xb')](_0xf1e24,{'body':_0x2eb8ac})['then'](function(_0x17bec5){logger[_0x33dc('0x9')]('[utils][request]\x20name:%s',_0xf1e24,_0x17bec5?util['inspect'](_0x17bec5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e0b72){logger[_0x33dc('0xa')](_0x33dc('0xc'),_0xf1e24,_0x4e0b72?util[_0x33dc('0x8')](_0x4e0b72,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2a6d10){return client['request'](_0x33dc('0xd'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x33dc('0xe')],'where':_0x2a6d10,'limit':0x1}})[_0x33dc('0xf')](function(_0x120d61){logger[_0x33dc('0x9')](_0x33dc('0x10'),JSON[_0x33dc('0x11')](_0x2a6d10),_0x120d61?util[_0x33dc('0x8')](_0x120d61,{'showHidden':![],'depth':null}):'');return _0x120d61['result']['length']?_0x120d61[_0x33dc('0x12')][0x0]:null;});}exports[_0x33dc('0x13')]=function(_0x3e6aa2){return new BPromise(function(_0x2353bf,_0x1a0fd9){if(_0x3e6aa2){return getUser({'internal':_0x3e6aa2})[_0x33dc('0xf')](function(_0x2d40e6){logger[_0x33dc('0x7')](_0x33dc('0x14'),_0x3e6aa2,_0x2d40e6?_0x33dc('0x15'):_0x33dc('0x16'));return _0x2353bf(_0x2d40e6);})[_0x33dc('0x17')](function(_0x35e156){logger[_0x33dc('0xa')](_0x33dc('0x18'),_0x35e156?util[_0x33dc('0x8')](_0x35e156,{'showHidden':![],'depth':null}):'');return _0x2353bf(null);});}return _0x2353bf(null);});};exports['getUserByInterface']=function(_0x5c22ff){return new BPromise(function(_0x27bf1c,_0x2cd153){if(_0x5c22ff){return getUser({'interface':_0x5c22ff})[_0x33dc('0xf')](function(_0x17749e){logger[_0x33dc('0x7')](_0x33dc('0x19'),_0x5c22ff,_0x17749e?_0x33dc('0x15'):_0x33dc('0x16'));return _0x27bf1c(_0x17749e);})[_0x33dc('0x17')](function(_0x2c63b0){logger[_0x33dc('0xa')](_0x33dc('0x1a'),_0x2c63b0?util[_0x33dc('0x8')](_0x2c63b0,{'showHidden':![],'depth':null}):'');return _0x27bf1c(null);});}return _0x27bf1c(null);});};exports[_0x33dc('0x1b')]=function(_0x25dd1a){return new BPromise(function(_0x4c5d11,_0x3b580e){if(_0x25dd1a){return getUser({'name':_0x25dd1a})[_0x33dc('0xf')](function(_0x37965d){logger[_0x33dc('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x25dd1a,_0x37965d?_0x33dc('0x15'):_0x33dc('0x16'));return _0x4c5d11(_0x37965d);})[_0x33dc('0x17')](function(_0x3bf0d1){logger[_0x33dc('0xa')]('[utils][getUserByName]',_0x3bf0d1?util[_0x33dc('0x8')](_0x3bf0d1,{'showHidden':![],'depth':null}):'');return _0x4c5d11(null);});}return _0x4c5d11(null);});};exports[_0x33dc('0x1c')]=function(_0xb553f2){return new BPromise(function(_0x1fe079,_0x2d46f3){if(_0xb553f2){return client[_0x33dc('0xb')](_0x33dc('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x33dc('0x1e'),'type',_0x33dc('0x1f'),'acwTimeout'],'where':{'name':_0xb553f2},'limit':0x1}})[_0x33dc('0xf')](function(_0x592534){logger[_0x33dc('0x9')](_0x33dc('0x20'),_0xb553f2,_0x592534?util[_0x33dc('0x8')](_0x592534,{'showHidden':![],'depth':null}):'');logger[_0x33dc('0x7')](_0x33dc('0x21'),_0xb553f2,_0x592534?_0x33dc('0x15'):_0x33dc('0x16'));return _0x1fe079(_0x592534[_0x33dc('0x12')][_0x33dc('0x22')]?_0x592534['result'][0x0]:null);})[_0x33dc('0x17')](function(_0x187b57){logger[_0x33dc('0xa')](_0x33dc('0x23'),_0x187b57?util[_0x33dc('0x8')](_0x187b57,{'showHidden':![],'depth':null}):'');return _0x1fe079(null);});}return _0x1fe079(null);});};exports['addTime']=function(_0x5bea4c,_0x470195){return moment(_0x5bea4c)['add'](_0x470195,_0x33dc('0x24'))[_0x33dc('0x25')](_0x33dc('0x26'));};exports['subtractTime']=function(_0x3635d0,_0x3e4537){return moment(_0x3635d0)[_0x33dc('0x27')](_0x3e4537,'seconds')[_0x33dc('0x25')](_0x33dc('0x26'));};exports[_0x33dc('0x28')]=function(_0x3c9698,_0xfad9ce){return moment(_0x3c9698)[_0x33dc('0x29')](moment(_0xfad9ce),_0x33dc('0x24'));};exports[_0x33dc('0x2a')]=function(_0x2ceee7,_0x47ec12){return parseInt(_0x2ceee7,0xa)+parseInt(_0x47ec12,0xa);};exports['now']=function(){return moment()[_0x33dc('0x25')](_0x33dc('0x26'));};exports[_0x33dc('0x2b')]=function(_0xd551fb,_0x58f7d9){if(_0x58f7d9){return moment(_0xd551fb)[_0x33dc('0x2b')](_0x58f7d9);}return!![];};exports['isBefore']=function(_0x4d4cee,_0x22e17c){if(_0x22e17c){return moment(_0x4d4cee)[_0x33dc('0x2c')](_0x22e17c);}else if(_0x4d4cee){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 18b496e..35c2d64 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 _0x20f2=['./loggers','safeTemplate','./mask-sensitive-data','/var','log','xcally','join','client','role','name','then','catch','user','no-user','data','timestamp','error','api','set','client-side-logger','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','connection','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','agent_name','test','url','fs-extra','lodash','express-winston','path','util'];(function(_0x5900ac,_0x9095d0){var _0x4d419d=function(_0x44cbab){while(--_0x44cbab){_0x5900ac['push'](_0x5900ac['shift']());}};_0x4d419d(++_0x9095d0);}(_0x20f2,0x1a2));var _0x220f=function(_0x167143,_0x147a58){_0x167143=_0x167143-0x0;var _0x4d273c=_0x20f2[_0x167143];return _0x4d273c;};var fs=require(_0x220f('0x0'));var _=require(_0x220f('0x1'));var ewinston=require(_0x220f('0x2'));var path=require(_0x220f('0x3'));var util=require(_0x220f('0x4'));var fileLogger=require(_0x220f('0x5'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x220f('0x6')];var maskSensitiveData=require(_0x220f('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x4b8f0e(_0x23d1aa){var _0x1a2b2b=path['join'](_0x220f('0x8'),_0x220f('0x9'),_0x220f('0xa'));var _0x45d9ff=path[_0x220f('0xb')](_0x220f('0xc'),_0x23d1aa[_0x220f('0xd')]+'-'+_0x23d1aa[_0x220f('0xe')]);return fs['ensureDir'](path['join'](_0x1a2b2b,_0x45d9ff))[_0x220f('0xf')](function(){var _0x3a6afd=fileLogger('client',path[_0x220f('0xb')](_0x1a2b2b,_0x45d9ff));return _0x3a6afd;})[_0x220f('0x10')](function(_0x4f2101){throw _0x4f2101;});}this[_0x220f('0x9')]=function(_0x4e4b17,_0x13e4be,_0x4a2c0d,_0x9f89d9){return _0x4b8f0e(_0x4e4b17[_0x220f('0x11')])[_0x220f('0xf')](function(_0x2a2ffe){var _0x5c8bd8=_0x2a2ffe[_0x13e4be];return _0x5c8bd8;})[_0x220f('0xf')](function(_0x1be65d){var _0x3c9765=_0x4e4b17[_0x220f('0x11')]?_0x4e4b17[_0x220f('0x11')]['id']:_0x220f('0x12');var _0x2791f6=_0x9f89d9[_0x220f('0x13')];var _0x559246=_0x9f89d9[_0x220f('0x14')];var _0x336054=new Date(Number(_0x559246));return _0x1be65d(_0x3c9765,_0x336054,_0x4a2c0d,_0x2791f6);})[_0x220f('0x10')](function(_0x3338a3){fileLogger(_0x220f('0xc'))[_0x220f('0x15')](_0x3338a3);});};}function setupLoggers(_0x5d8aca){return new Promise(function(_0xd2d642){var _0x2ab968=new ClientSideLogger();var _0x496d4e=fileLogger(_0x220f('0x16'));var _0x97e4b0=fileLogger('auth');_0x5d8aca[_0x220f('0x17')](_0x220f('0x18'),_0x2ab968);_0x5d8aca['use'](ewinston[_0x220f('0x19')]({'winstonInstance':_0x496d4e,'meta':![],'statusLevels':!![],'msg':function(_0x22449e,_0x134041){var _0x4a04ad=_0x220f('0x1a');if(!_[_0x220f('0x1b')](_0x22449e[_0x220f('0x1c')])){_0x4a04ad+=_0x220f('0x1d');var _0x2c00ba=_0x22449e[_0x220f('0x1c')];maskSensitiveData(_0x2c00ba);}return safeTemplate(util[_0x220f('0x1e')](_0x4a04ad,_0x22449e[_0x220f('0x1f')],_0x22449e['headers'][_0x220f('0x20')]?_0x22449e[_0x220f('0x21')][_0x220f('0x20')]:_0x22449e[_0x220f('0x22')]['remoteAddress']||_0x22449e['ip'],_0x22449e['url'],_0x134041[_0x220f('0x23')],_0x134041[_0x220f('0x24')],_0x22449e[_0x220f('0x11')]?_0x22449e[_0x220f('0x11')]['id']:null,_0x22449e[_0x220f('0x11')]?_0x22449e['user'][_0x220f('0xe')]:null,_0x22449e[_0x220f('0x11')]?_0x22449e[_0x220f('0x11')]['role']:null,_0x2c00ba?util[_0x220f('0x25')](_0x2c00ba,![],null):''));}}));_0x5d8aca[_0x220f('0x26')](ewinston['logger']({'winstonInstance':_0x97e4b0,'meta':![],'statusLevels':!![],'msg':function(_0x4a116a,_0xf902f8){var _0x35d959=_0x220f('0x27');if(_0x4a116a['body']&&_0x4a116a[_0x220f('0x1c')][_0x220f('0x28')]&&_0x4a116a['body'][_0x220f('0x29')]){_0x35d959=_0x220f('0x2a');}return util[_0x220f('0x1e')](_0x35d959,_0x4a116a[_0x220f('0x1f')],_0x4a116a[_0x220f('0x21')][_0x220f('0x20')]?_0x4a116a[_0x220f('0x21')][_0x220f('0x20')]:_0x4a116a['connection'][_0x220f('0x2b')]||_0x4a116a['ip'],_0x4a116a['url'],_0xf902f8[_0x220f('0x23')],_0xf902f8['responseTime'],_0x4a116a[_0x220f('0x11')]?_0x4a116a['user']['id']:null,_0x4a116a[_0x220f('0x11')]?_0x4a116a['user']['name']:null,_0x4a116a[_0x220f('0x11')]?_0x4a116a[_0x220f('0x11')]['role']:null,_0x4a116a['body']&&_0x4a116a['body'][_0x220f('0x28')]?_0x4a116a[_0x220f('0x1c')][_0x220f('0x28')]:'other',_0x4a116a[_0x220f('0x1c')]&&_0x4a116a[_0x220f('0x1c')]['agent_id']?_0x4a116a['body']['agent_id']:'',_0x4a116a['body']&&_0x4a116a[_0x220f('0x1c')][_0x220f('0x2c')]?_0x4a116a[_0x220f('0x1c')][_0x220f('0x2c')]:'');},'ignoreRoute':function(_0x3b8586){var _0x402e7c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x402e7c[_0x220f('0x2d')](_0x3b8586[_0x220f('0x2e')]);}}));return _0xd2d642();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x882d=['log','xcally','client','role','name','ensureDir','then','catch','user','data','timestamp','api','auth','set','client-side-logger','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','responseTime','device','agent_name','test','setupLoggers','fs-extra','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','join','/var'];(function(_0x40c71d,_0x4e8cbb){var _0x19e54c=function(_0x11a527){while(--_0x11a527){_0x40c71d['push'](_0x40c71d['shift']());}};_0x19e54c(++_0x4e8cbb);}(_0x882d,0x1b0));var _0xd882=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x882d[_0x591a90];return _0x551587;};var fs=require(_0xd882('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0xd882('0x1'));var fileLogger=require(_0xd882('0x2'))[_0xd882('0x3')];var safeTemplate=require('./safe-template')[_0xd882('0x4')];var maskSensitiveData=require('./mask-sensitive-data')[_0xd882('0x5')];function ClientSideLogger(){function _0x56ec7c(_0x43a8d3){var _0x22f44f=path[_0xd882('0x6')](_0xd882('0x7'),_0xd882('0x8'),_0xd882('0x9'));var _0x223159=path[_0xd882('0x6')](_0xd882('0xa'),_0x43a8d3[_0xd882('0xb')]+'-'+_0x43a8d3[_0xd882('0xc')]);return fs[_0xd882('0xd')](path['join'](_0x22f44f,_0x223159))[_0xd882('0xe')](function(){var _0x276592=fileLogger(_0xd882('0xa'),path[_0xd882('0x6')](_0x22f44f,_0x223159));return _0x276592;})[_0xd882('0xf')](function(_0x2c5d9c){throw _0x2c5d9c;});}this[_0xd882('0x8')]=function(_0xe82df3,_0x463cfe,_0x1a2600,_0x47d58c){return _0x56ec7c(_0xe82df3[_0xd882('0x10')])[_0xd882('0xe')](function(_0x110f4d){var _0x4b0854=_0x110f4d[_0x463cfe];return _0x4b0854;})['then'](function(_0x58db8a){var _0x26fe2f=_0xe82df3[_0xd882('0x10')]?_0xe82df3['user']['id']:'no-user';var _0x2a831b=_0x47d58c[_0xd882('0x11')];var _0x4d3997=_0x47d58c[_0xd882('0x12')];var _0x45ba41=new Date(Number(_0x4d3997));return _0x58db8a(_0x26fe2f,_0x45ba41,_0x1a2600,_0x2a831b);})[_0xd882('0xf')](function(_0x5c4314){fileLogger(_0xd882('0xa'))['error'](_0x5c4314);});};}function setupLoggers(_0x4ac3b8){return new Promise(function(_0x1746ed){var _0x42d928=new ClientSideLogger();var _0x4c0227=fileLogger(_0xd882('0x13'));var _0x43912e=fileLogger(_0xd882('0x14'));_0x4ac3b8[_0xd882('0x15')](_0xd882('0x16'),_0x42d928);_0x4ac3b8[_0xd882('0x17')](ewinston[_0xd882('0x18')]({'winstonInstance':_0x4c0227,'meta':![],'statusLevels':!![],'msg':function(_0x454e4d,_0x4389cf){var _0x1e51e2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x454e4d[_0xd882('0x19')])){_0x1e51e2+=_0xd882('0x1a');var _0x5d07c2=_0x454e4d[_0xd882('0x19')];maskSensitiveData(_0x5d07c2);}return safeTemplate(util[_0xd882('0x1b')](_0x1e51e2,_0x454e4d[_0xd882('0x1c')],_0x454e4d[_0xd882('0x1d')]['x-forwarded-for']?_0x454e4d[_0xd882('0x1d')][_0xd882('0x1e')]:_0x454e4d[_0xd882('0x1f')]['remoteAddress']||_0x454e4d['ip'],_0x454e4d[_0xd882('0x20')],_0x4389cf[_0xd882('0x21')],_0x4389cf['responseTime'],_0x454e4d[_0xd882('0x10')]?_0x454e4d['user']['id']:null,_0x454e4d[_0xd882('0x10')]?_0x454e4d['user'][_0xd882('0xc')]:null,_0x454e4d['user']?_0x454e4d[_0xd882('0x10')]['role']:null,_0x5d07c2?util[_0xd882('0x22')](_0x5d07c2,![],null):''));}}));_0x4ac3b8[_0xd882('0x17')](ewinston[_0xd882('0x18')]({'winstonInstance':_0x43912e,'meta':![],'statusLevels':!![],'msg':function(_0x421336,_0x1f3f93){var _0x1d79a2=_0xd882('0x23');if(_0x421336[_0xd882('0x19')]&&_0x421336[_0xd882('0x19')]['device']&&_0x421336[_0xd882('0x19')][_0xd882('0x24')]){_0x1d79a2=_0xd882('0x25');}return util['format'](_0x1d79a2,_0x421336['method'],_0x421336[_0xd882('0x1d')][_0xd882('0x1e')]?_0x421336[_0xd882('0x1d')][_0xd882('0x1e')]:_0x421336['connection'][_0xd882('0x26')]||_0x421336['ip'],_0x421336[_0xd882('0x20')],_0x1f3f93[_0xd882('0x21')],_0x1f3f93[_0xd882('0x27')],_0x421336[_0xd882('0x10')]?_0x421336[_0xd882('0x10')]['id']:null,_0x421336[_0xd882('0x10')]?_0x421336[_0xd882('0x10')][_0xd882('0xc')]:null,_0x421336[_0xd882('0x10')]?_0x421336['user'][_0xd882('0xb')]:null,_0x421336[_0xd882('0x19')]&&_0x421336[_0xd882('0x19')][_0xd882('0x28')]?_0x421336['body'][_0xd882('0x28')]:'other',_0x421336[_0xd882('0x19')]&&_0x421336['body']['agent_id']?_0x421336[_0xd882('0x19')][_0xd882('0x24')]:'',_0x421336[_0xd882('0x19')]&&_0x421336[_0xd882('0x19')][_0xd882('0x29')]?_0x421336[_0xd882('0x19')][_0xd882('0x29')]:'');},'ignoreRoute':function(_0x351697){var _0x2ea014=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2ea014[_0xd882('0x2a')](_0x351697['url']);}}));return _0x1746ed();});}exports[_0xd882('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index cfd15bc..a99e08a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5bf=['bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','}}}','meta','keys','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','%s-%s','error','File','fileLogger','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','white','bold\x20white','bold\x20green','gray'];(function(_0x248f86,_0x47b892){var _0x53f443=function(_0x304085){while(--_0x304085){_0x248f86['push'](_0x248f86['shift']());}};_0x53f443(++_0x47b892);}(_0xe5bf,0x142));var _0xfe5b=function(_0x599d25,_0x2e7b29){_0x599d25=_0x599d25-0x0;var _0x284b66=_0xe5bf[_0x599d25];return _0x284b66;};'use strict';var path=require('path');var util=require(_0xfe5b('0x0'));var moment=require(_0xfe5b('0x1'));var winston=require(_0xfe5b('0x2'));var config=require(_0xfe5b('0x3'));var debugLevel=config[_0xfe5b('0x4')]?config['debugLevel']['toLowerCase']():_0xfe5b('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':_0xfe5b('0x6'),'error':'red','warn':'bold\x20yellow','info':_0xfe5b('0x7'),'print':_0xfe5b('0x8'),'success':_0xfe5b('0x9'),'http':_0xfe5b('0xa'),'verbose':_0xfe5b('0xb'),'debug':_0xfe5b('0xc'),'silly':_0xfe5b('0xd')};winston[_0xfe5b('0xe')](XC_LOG_COLORS);function getLogFileName(_0x32781f,_0x60c188,_0x14c65f){var _0x4aa91d=_0x32781f||'/var/log/xcally';return path[_0xfe5b('0xf')](_0x4aa91d,util['format']('%s-%s.log',_0x60c188,_0x14c65f));}function formatter(_0x450b1e,_0x2345f5){_0x2345f5['message']=_0x2345f5['message']['replace'](/@@{/g,_0xfe5b('0x10'))[_0xfe5b('0x11')](/}@@/g,'}}}')[_0xfe5b('0x11')](/@{/g,'{{')[_0xfe5b('0x11')](/}@/g,'}}');return util[_0xfe5b('0x12')](_0xfe5b('0x13'),moment()[_0xfe5b('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2345f5[_0xfe5b('0x14')][_0xfe5b('0x15')](),_0x450b1e,_0x2345f5[_0xfe5b('0x16')]);}function fileFormat(_0x150332,_0x2c429b){_0x2c429b['message']=_0x2c429b['message'][_0xfe5b('0x11')](/@@{/g,_0xfe5b('0x10'))[_0xfe5b('0x11')](/}@@/g,_0xfe5b('0x17'))[_0xfe5b('0x11')](/@{/g,'{{')[_0xfe5b('0x11')](/}@/g,'}}');var _0x54b56e=_0x2c429b[_0xfe5b('0x18')]&&Object[_0xfe5b('0x19')](_0x2c429b['meta'])[_0xfe5b('0x1a')]?'\x0a\x09'+JSON[_0xfe5b('0x1b')](_0x2c429b[_0xfe5b('0x18')]):'';return util[_0xfe5b('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xfe5b('0x12')](_0xfe5b('0x1c')),_0x2c429b[_0xfe5b('0x14')][_0xfe5b('0x15')](),_0x150332,_0x2c429b['message'],_0x54b56e);}function consoleLogger(){var _0x483ede=new winston[(_0xfe5b('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfe5b('0x1e'))][(_0xfe5b('0x1f'))]({'level':_0xfe5b('0x20'),'json':![],'formatter':function(_0x2f896b){return formatter('',_0x2f896b);}})]});return _0x483ede;}function fileLogger(_0x356574,_0x56d206){var _0x4d313e=new winston[(_0xfe5b('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xfe5b('0x12')](_0xfe5b('0x21'),_0x356574,_0xfe5b('0x22')),'filename':getLogFileName(_0x56d206,_0x356574,_0xfe5b('0x22')),'level':_0xfe5b('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf84988){return fileFormat(_0x356574,_0xf84988);}}),new winston[(_0xfe5b('0x1e'))][(_0xfe5b('0x23'))]({'name':util[_0xfe5b('0x12')](_0xfe5b('0x21'),_0x356574,debugLevel),'filename':getLogFileName(_0x56d206,_0x356574,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3329ca){return fileFormat(_0x356574,_0x3329ca);}}),new winston[(_0xfe5b('0x1e'))]['Console']({'level':_0xfe5b('0x20'),'json':![],'formatter':function(_0x41dcad){return fileFormat(_0x356574,_0x41dcad);}})]});return _0x4d313e;}exports['consoleLogger']=consoleLogger;exports[_0xfe5b('0x24')]=fileLogger; \ No newline at end of file +var _0xccb9=['level','toUpperCase','Logger','transports','Console','File','error','%s-%s','warn','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','}}}','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x1f249f,_0x243cbe){var _0x5193df=function(_0x201b8e){while(--_0x201b8e){_0x1f249f['push'](_0x1f249f['shift']());}};_0x5193df(++_0x243cbe);}(_0xccb9,0xa2));var _0x9ccb=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xccb9[_0x4dc7b9];return _0x3ab114;};'use strict';var path=require(_0x9ccb('0x0'));var util=require(_0x9ccb('0x1'));var moment=require('moment');var winston=require(_0x9ccb('0x2'));var config=require(_0x9ccb('0x3'));var debugLevel=config[_0x9ccb('0x4')]?config[_0x9ccb('0x4')][_0x9ccb('0x5')]():'info';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':_0x9ccb('0x6'),'warn':_0x9ccb('0x7'),'info':'white','print':_0x9ccb('0x8'),'success':'bold\x20green','http':_0x9ccb('0x9'),'verbose':_0x9ccb('0xa'),'debug':_0x9ccb('0xb'),'silly':_0x9ccb('0xc')};winston[_0x9ccb('0xd')](XC_LOG_COLORS);function getLogFileName(_0x261c19,_0x452cb8,_0x5744aa){var _0x10abf7=_0x261c19||_0x9ccb('0xe');return path[_0x9ccb('0xf')](_0x10abf7,util[_0x9ccb('0x10')]('%s-%s.log',_0x452cb8,_0x5744aa));}function formatter(_0x5242c9,_0x40672c){_0x40672c[_0x9ccb('0x11')]=_0x40672c['message']['replace'](/@@{/g,_0x9ccb('0x12'))[_0x9ccb('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x9ccb('0x13')](/}@/g,'}}');return util[_0x9ccb('0x10')](_0x9ccb('0x14'),moment()['format'](_0x9ccb('0x15')),_0x40672c['level']['toUpperCase'](),_0x5242c9,_0x40672c[_0x9ccb('0x11')]);}function fileFormat(_0x2201b2,_0x28499b){_0x28499b[_0x9ccb('0x11')]=_0x28499b[_0x9ccb('0x11')][_0x9ccb('0x13')](/@@{/g,_0x9ccb('0x12'))[_0x9ccb('0x13')](/}@@/g,_0x9ccb('0x16'))['replace'](/@{/g,'{{')[_0x9ccb('0x13')](/}@/g,'}}');var _0x3025e5=_0x28499b['meta']&&Object[_0x9ccb('0x17')](_0x28499b[_0x9ccb('0x18')])[_0x9ccb('0x19')]?'\x0a\x09'+JSON[_0x9ccb('0x1a')](_0x28499b[_0x9ccb('0x18')]):'';return util[_0x9ccb('0x10')](_0x9ccb('0x1b'),moment()[_0x9ccb('0x10')](_0x9ccb('0x15')),_0x28499b[_0x9ccb('0x1c')][_0x9ccb('0x1d')](),_0x2201b2,_0x28499b['message'],_0x3025e5);}function consoleLogger(){var _0x2a501a=new winston[(_0x9ccb('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9ccb('0x1f'))][(_0x9ccb('0x20'))]({'level':'warn','json':![],'formatter':function(_0x331218){return formatter('',_0x331218);}})]});return _0x2a501a;}function fileLogger(_0x5c5f7e,_0x19546f){var _0x3a8cd3=new winston[(_0x9ccb('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9ccb('0x1f'))][(_0x9ccb('0x21'))]({'name':util[_0x9ccb('0x10')]('%s-%s',_0x5c5f7e,_0x9ccb('0x22')),'filename':getLogFileName(_0x19546f,_0x5c5f7e,_0x9ccb('0x22')),'level':_0x9ccb('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4bb1ab){return fileFormat(_0x5c5f7e,_0x4bb1ab);}}),new winston['transports'][(_0x9ccb('0x21'))]({'name':util[_0x9ccb('0x10')](_0x9ccb('0x23'),_0x5c5f7e,debugLevel),'filename':getLogFileName(_0x19546f,_0x5c5f7e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a47a6){return fileFormat(_0x5c5f7e,_0x1a47a6);}}),new winston[(_0x9ccb('0x1f'))][(_0x9ccb('0x20'))]({'level':_0x9ccb('0x24'),'json':![],'formatter':function(_0x835c1){return fileFormat(_0x5c5f7e,_0x835c1);}})]});return _0x3a8cd3;}exports['consoleLogger']=consoleLogger;exports[_0x9ccb('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ed15f2b..b873b91 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x1a85,0x178));var _0x51a8=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x1a85[_0x37d0bc];return _0x170e60;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdb28,0x106));var _0x8db2=function(_0x5c8f96,_0x2372d0){_0x5c8f96=_0x5c8f96-0x0;var _0x326f1b=_0xdb28[_0x5c8f96];return _0x326f1b;};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 diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 1bcd543..6004cf8 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 _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x2652ee,_0x3f2c99){var _0x8c30c5=function(_0x1e8f06){while(--_0x1e8f06){_0x2652ee['push'](_0x2652ee['shift']());}};_0x8c30c5(++_0x3f2c99);}(_0x4213,0x77));var _0x3421=function(_0x3185f7,_0x59d21b){_0x3185f7=_0x3185f7-0x0;var _0x139361=_0x4213[_0x3185f7];return _0x139361;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file +var _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x14a0,0x8e));var _0x014a=function(_0x1f9962,_0x544ef4){_0x1f9962=_0x1f9962-0x0;var _0x54face=_0x14a0[_0x1f9962];return _0x54face;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file